2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
24 #include <muse_camera.h>
25 #include <muse_camera_msg.h>
26 #include <muse_core_ipc.h>
27 #include <muse_core_module.h>
28 #include <camera_private.h>
29 #include <muse_core.h>
31 #include <Elementary.h>
32 #include <tbm_surface_internal.h>
35 #include <Ecore_Wayland.h>
36 #include <wayland-client.h>
37 #include <tizen-extension-client-protocol.h>
38 #else /* HAVE_WAYLAND */
40 #endif /* HAVE_WAYLAND */
41 #ifdef EVAS_RENDERER_SUPPORT
42 #include <mm_evas_renderer.h>
43 #endif /* EVAS_RENDERER_SUPPORT */
48 #define LOG_TAG "TIZEN_N_CAMERA"
52 static void __global(void *data, struct wl_registry *registry,
53 uint32_t name, const char *interface, uint32_t version)
55 struct tizen_surface **tz_surface = NULL;
62 tz_surface = (struct tizen_surface **)data;
65 LOGW("NULL interface");
69 LOGI("interface %s", interface);
71 if (strcmp(interface, "tizen_surface") == 0) {
72 LOGD("binding tizen surface for wayland");
74 *tz_surface = wl_registry_bind(registry, name, &tizen_surface_interface, version);
75 if (*tz_surface == NULL)
76 LOGE("failed to bind");
84 static void __global_remove(void *data, struct wl_registry *wl_registry, uint32_t name)
90 static const struct wl_registry_listener _camera_wl_registry_listener = {
95 void __parent_id_getter(void *data, struct tizen_resource *tizen_resource, uint32_t id)
102 *((unsigned int *)data) = id;
104 LOGD("[CLIENT] got parent_id [%u] from server", id);
109 static const struct tizen_resource_listener _camera_tz_resource_listener = {
113 int _get_wl_info(Evas_Object *obj, camera_wl_info_s *wl_info)
115 int ret = CAMERA_ERROR_NONE;
116 Ecore_Wl_Window *window = NULL;
117 struct wl_display *display = NULL;
118 struct wl_surface *surface = NULL;
119 struct wl_registry *registry = NULL;
120 struct tizen_surface *tz_surface = NULL;
121 struct tizen_resource *tz_resource = NULL;
123 if (!obj || !wl_info) {
124 LOGE("NULL parameter %p %p", obj, wl_info);
125 return CAMERA_ERROR_INVALID_OPERATION;
128 window = elm_win_wl_window_get(obj);
130 LOGE("failed to get wayland window");
131 ret = CAMERA_ERROR_INVALID_OPERATION;
135 surface = (struct wl_surface *)ecore_wl_window_surface_get(window);
137 LOGE("failed to get wayland surface");
138 ret = CAMERA_ERROR_INVALID_OPERATION;
142 display = (struct wl_display *)ecore_wl_display_get();
144 LOGE("failed to get wayland display");
145 ret = CAMERA_ERROR_INVALID_OPERATION;
149 registry = wl_display_get_registry(display);
151 LOGE("failed to get wayland registry");
152 ret = CAMERA_ERROR_INVALID_OPERATION;
156 wl_registry_add_listener(registry, &_camera_wl_registry_listener, &tz_surface);
158 wl_display_dispatch(display);
159 wl_display_roundtrip(display);
162 LOGE("failed to get tizen surface");
163 ret = CAMERA_ERROR_INVALID_OPERATION;
167 /* Get parent_id which is unique in a entire systemw. */
168 tz_resource = tizen_surface_get_tizen_resource(tz_surface, surface);
170 LOGE("failed to get tizen resurce");
171 ret = CAMERA_ERROR_INVALID_OPERATION;
175 wl_info->parent_id = 0;
177 tizen_resource_add_listener(tz_resource, &_camera_tz_resource_listener, &wl_info->parent_id);
179 wl_display_roundtrip(display);
181 if (wl_info->parent_id > 0) {
183 Ecore_Evas *ecore_evas = NULL;
184 ret = CAMERA_ERROR_NONE;
186 wl_info->evas_obj = obj;
188 evas_object_geometry_get(obj, &wl_info->window_x, &wl_info->window_y,
189 &wl_info->window_width, &wl_info->window_height);
191 ecore_evas = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
193 rotation = ecore_evas_rotation_get(ecore_evas);
194 if (rotation == 90 || rotation == 270) {
195 int temp = wl_info->window_width;
197 LOGD("swap width and height %d, %d", wl_info->window_width, wl_info->window_height);
199 wl_info->window_width = wl_info->window_height;
200 wl_info->window_height = temp;
203 LOGW("failed to get ecore_evas.. skip rotation check");
206 LOGD("evas object : %p, rotation : %d, parent id : %u, window : %d,%d,%dx%d",
207 wl_info->evas_obj, rotation, wl_info->parent_id,
208 wl_info->window_x, wl_info->window_y,
209 wl_info->window_width, wl_info->window_height);
211 ret = CAMERA_ERROR_INVALID_OPERATION;
212 LOGE("failed to get parent id");
217 tizen_surface_destroy(tz_surface);
222 tizen_resource_destroy(tz_resource);
227 wl_registry_destroy(registry);
233 #endif /* HAVE_WAYLAND */
235 static int _import_tbm_key(tbm_bufmgr bufmgr, unsigned int tbm_key, tbm_bo *bo, tbm_bo_handle *bo_handle)
237 tbm_bo tmp_bo = NULL;
238 tbm_bo_handle tmp_bo_handle = {NULL, };
240 if (bufmgr == NULL || bo == NULL || bo_handle == NULL || tbm_key == 0) {
241 LOGE("invalid parameter - bufmgr %p, bo %p, bo_handle %p, key %d",
242 bufmgr, bo, bo_handle, tbm_key);
246 tmp_bo = tbm_bo_import(bufmgr, tbm_key);
247 if (tmp_bo == NULL) {
248 LOGE("bo import failed - bufmgr %p, key %d", bufmgr, tbm_key);
252 tmp_bo_handle = tbm_bo_map(tmp_bo, TBM_DEVICE_CPU, TBM_OPTION_READ);
253 if (tmp_bo_handle.ptr == NULL) {
254 LOGE("bo map failed %p", tmp_bo);
255 tbm_bo_unref(tmp_bo);
260 tbm_bo_unmap(tmp_bo);
262 /* set bo and bo_handle */
264 *bo_handle = tmp_bo_handle;
269 static void _release_imported_bo(tbm_bo *bo)
271 if (bo == NULL || *bo == NULL) {
282 static int _client_wait_for_cb_return(muse_camera_api_e api, camera_cb_info_s *cb_info, int time_out)
284 int ret = CAMERA_ERROR_NONE;
287 LOGD("Enter api : %d", api);
289 g_mutex_lock(&(cb_info->api_mutex[api]));
291 if (cb_info->api_activating[api] == 0) {
292 end_time = g_get_monotonic_time() + time_out * G_TIME_SPAN_SECOND;
293 if (g_cond_wait_until(&(cb_info->api_cond[api]), &(cb_info->api_mutex[api]), end_time)) {
294 ret = cb_info->api_ret[api];
295 cb_info->api_activating[api] = 0;
297 LOGD("return value : 0x%x", ret);
299 ret = CAMERA_ERROR_INVALID_OPERATION;
301 LOGE("api %d was TIMED OUT!", api);
304 ret = cb_info->api_ret[api];
305 cb_info->api_activating[api] = 0;
307 LOGD("condition is already checked for the api[%d], return[0x%x]", api, ret);
310 g_mutex_unlock(&(cb_info->api_mutex[api]));
315 int _camera_get_tbm_surface_format(int in_format, uint32_t *out_format)
317 if (in_format <= MM_PIXEL_FORMAT_INVALID ||
318 in_format >= MM_PIXEL_FORMAT_NUM ||
319 out_format == NULL) {
320 LOGE("INVALID_PARAMETER : in_format %d, out_format ptr %p", in_format, out_format);
321 return CAMERA_ERROR_INVALID_PARAMETER;
325 case MM_PIXEL_FORMAT_NV12:
326 case MM_PIXEL_FORMAT_NV12T:
327 *out_format = TBM_FORMAT_NV12;
329 case MM_PIXEL_FORMAT_NV16:
330 *out_format = TBM_FORMAT_NV16;
332 case MM_PIXEL_FORMAT_NV21:
333 *out_format = TBM_FORMAT_NV21;
335 case MM_PIXEL_FORMAT_YUYV:
336 *out_format = TBM_FORMAT_YUYV;
338 case MM_PIXEL_FORMAT_UYVY:
339 case MM_PIXEL_FORMAT_ITLV_JPEG_UYVY:
340 *out_format = TBM_FORMAT_UYVY;
342 case MM_PIXEL_FORMAT_422P:
343 *out_format = TBM_FORMAT_YUV422;
345 case MM_PIXEL_FORMAT_I420:
346 *out_format = TBM_FORMAT_YUV420;
348 case MM_PIXEL_FORMAT_YV12:
349 *out_format = TBM_FORMAT_YVU420;
351 case MM_PIXEL_FORMAT_RGB565:
352 *out_format = TBM_FORMAT_RGB565;
354 case MM_PIXEL_FORMAT_RGB888:
355 *out_format = TBM_FORMAT_RGB888;
357 case MM_PIXEL_FORMAT_RGBA:
358 *out_format = TBM_FORMAT_RGBA8888;
360 case MM_PIXEL_FORMAT_ARGB:
361 *out_format = TBM_FORMAT_ARGB8888;
364 LOGE("invalid in_format %d", in_format);
365 return CAMERA_ERROR_INVALID_PARAMETER;
368 return CAMERA_ERROR_NONE;
372 int _camera_get_media_packet_mimetype(int in_format, media_format_mimetype_e *mimetype)
374 if (in_format <= MM_PIXEL_FORMAT_INVALID ||
375 in_format >= MM_PIXEL_FORMAT_NUM ||
377 LOGE("INVALID_PARAMETER : in_format %d, mimetype ptr %p", in_format, mimetype);
378 return CAMERA_ERROR_INVALID_PARAMETER;
382 case MM_PIXEL_FORMAT_NV12:
383 case MM_PIXEL_FORMAT_NV12T:
384 *mimetype = MEDIA_FORMAT_NV12;
386 case MM_PIXEL_FORMAT_NV16:
387 *mimetype = MEDIA_FORMAT_NV16;
389 case MM_PIXEL_FORMAT_NV21:
390 *mimetype = MEDIA_FORMAT_NV21;
392 case MM_PIXEL_FORMAT_YUYV:
393 *mimetype = MEDIA_FORMAT_YUYV;
395 case MM_PIXEL_FORMAT_UYVY:
396 case MM_PIXEL_FORMAT_ITLV_JPEG_UYVY:
397 *mimetype = MEDIA_FORMAT_UYVY;
399 case MM_PIXEL_FORMAT_422P:
400 *mimetype = MEDIA_FORMAT_422P;
402 case MM_PIXEL_FORMAT_I420:
403 *mimetype = MEDIA_FORMAT_I420;
405 case MM_PIXEL_FORMAT_YV12:
406 *mimetype = MEDIA_FORMAT_YV12;
408 case MM_PIXEL_FORMAT_RGB565:
409 *mimetype = MEDIA_FORMAT_RGB565;
411 case MM_PIXEL_FORMAT_RGB888:
412 *mimetype = MEDIA_FORMAT_RGB888;
414 case MM_PIXEL_FORMAT_RGBA:
415 *mimetype = MEDIA_FORMAT_RGBA;
417 case MM_PIXEL_FORMAT_ARGB:
418 *mimetype = MEDIA_FORMAT_ARGB;
421 LOGE("invalid in_format %d", in_format);
422 return CAMERA_ERROR_INVALID_PARAMETER;
425 return CAMERA_ERROR_NONE;
428 void _camera_preview_frame_create(camera_stream_data_s *stream, int num_buffer_key,
429 tbm_bo_handle *buffer_bo_handle, tbm_bo_handle *data_bo_handle, camera_preview_data_s *frame)
432 unsigned char *buf_pos = NULL;
434 if (stream == NULL || buffer_bo_handle == NULL || frame == NULL) {
435 LOGE("invalid parameter - stream:%p, buffer_bo_handle:%p", stream, buffer_bo_handle);
440 if (stream->format == MM_PIXEL_FORMAT_ITLV_JPEG_UYVY)
441 frame->format = MM_PIXEL_FORMAT_UYVY;
443 frame->format = stream->format;
445 frame->width = stream->width;
446 frame->height = stream->height;
447 frame->timestamp = stream->timestamp;
448 frame->num_of_planes = stream->num_planes;
450 if (num_buffer_key == 0) {
452 if (data_bo_handle == NULL || data_bo_handle->ptr == NULL) {
453 LOGE("no data pointer");
457 buf_pos = data_bo_handle->ptr;
459 if (stream->format == MM_PIXEL_FORMAT_ENCODED_H264) {
460 frame->data.encoded_plane.data = buf_pos;
461 frame->data.encoded_plane.size = stream->data.encoded.length_data;
462 total_size = stream->data.encoded.length_data;
464 switch (stream->num_planes) {
466 frame->data.single_plane.yuv = buf_pos;
467 frame->data.single_plane.size = stream->data.yuv420.length_yuv;
468 total_size = stream->data.yuv420.length_yuv;
471 frame->data.double_plane.y = buf_pos;
472 frame->data.double_plane.y_size = stream->data.yuv420sp.length_y;
473 buf_pos += stream->data.yuv420sp.length_y;
474 frame->data.double_plane.uv = buf_pos;
475 frame->data.double_plane.uv_size = stream->data.yuv420sp.length_uv;
476 total_size = stream->data.yuv420sp.length_y + \
477 stream->data.yuv420sp.length_uv;
480 frame->data.triple_plane.y = buf_pos;
481 frame->data.triple_plane.y_size = stream->data.yuv420p.length_y;
482 buf_pos += stream->data.yuv420p.length_y;
483 frame->data.triple_plane.u = buf_pos;
484 frame->data.triple_plane.u_size = stream->data.yuv420p.length_u;
485 buf_pos += stream->data.yuv420p.length_u;
486 frame->data.triple_plane.v = buf_pos;
487 frame->data.triple_plane.v_size = stream->data.yuv420p.length_v;
488 total_size = stream->data.yuv420p.length_y + \
489 stream->data.yuv420p.length_u + \
490 stream->data.yuv420p.length_v;
498 switch (stream->num_planes) {
500 frame->data.single_plane.yuv = buffer_bo_handle[0].ptr;
501 frame->data.single_plane.size = stream->data.yuv420.length_yuv;
502 total_size = stream->data.yuv420.length_yuv;
505 frame->data.double_plane.y = buffer_bo_handle[0].ptr;
506 if (stream->num_planes == (unsigned int)num_buffer_key)
507 frame->data.double_plane.uv = buffer_bo_handle[1].ptr;
509 frame->data.double_plane.uv = buffer_bo_handle[0].ptr + stream->data.yuv420sp.length_y;
510 frame->data.double_plane.y_size = stream->data.yuv420sp.length_y;
511 frame->data.double_plane.uv_size = stream->data.yuv420sp.length_uv;
512 total_size = stream->data.yuv420sp.length_y + \
513 stream->data.yuv420sp.length_uv;
516 frame->data.triple_plane.y = buffer_bo_handle[0].ptr;
517 if (stream->num_planes == (unsigned int)num_buffer_key) {
518 frame->data.triple_plane.u = buffer_bo_handle[1].ptr;
519 frame->data.triple_plane.v = buffer_bo_handle[2].ptr;
521 frame->data.triple_plane.u = buffer_bo_handle[0].ptr + stream->data.yuv420p.length_y;
522 frame->data.triple_plane.v = buffer_bo_handle[1].ptr + stream->data.yuv420p.length_u;
524 frame->data.triple_plane.y_size = stream->data.yuv420p.length_y;
525 frame->data.triple_plane.u_size = stream->data.yuv420p.length_u;
526 frame->data.triple_plane.v_size = stream->data.yuv420p.length_v;
527 total_size = stream->data.yuv420p.length_y + \
528 stream->data.yuv420p.length_u + \
529 stream->data.yuv420p.length_v;
537 LOGD("format %d, %dx%d, size %d plane num %d",
538 frame.format, frame.width, frame.height, total_size, frame.num_of_planes);
544 int _camera_media_packet_data_create(int tbm_key, int num_buffer_key, tbm_bo bo,
545 tbm_bo *buffer_bo, tbm_bo data_bo, camera_media_packet_data **mp_data)
548 int ret = CAMERA_ERROR_NONE;
549 camera_media_packet_data *tmp_mp_data = NULL;
551 if (*mp_data == NULL) {
552 tmp_mp_data = g_new0(camera_media_packet_data, 1);
554 tmp_mp_data->tbm_key = tbm_key;
555 tmp_mp_data->num_buffer_key = num_buffer_key;
556 tmp_mp_data->bo = bo;
557 tmp_mp_data->data_bo = data_bo;
558 tmp_mp_data->ref_cnt++;
560 for (i = 0 ; i < num_buffer_key ; i++)
561 tmp_mp_data->buffer_bo[i] = buffer_bo[i];
563 *mp_data = tmp_mp_data;
564 /*LOGD("mp_data %p", tmp_mp_data);*/
566 ret = CAMERA_ERROR_OUT_OF_MEMORY;
567 LOGE("failed to alloc media packet data");
570 ((camera_media_packet_data *)*mp_data)->ref_cnt++;
576 void _camera_media_packet_data_release(camera_media_packet_data *mp_data, camera_cb_info_s *cb_info)
581 if (mp_data == NULL || cb_info == NULL) {
582 LOGE("NULL data %p or cb_info %p", mp_data, cb_info);
586 if (mp_data->ref_cnt > 1) {
588 LOGD("mp_data is still referenced(current %d)", mp_data->ref_cnt);
590 /* release imported bo */
591 for (i = 0 ; i < mp_data->num_buffer_key ; i++) {
592 tbm_bo_unref(mp_data->buffer_bo[i]);
593 mp_data->buffer_bo[i] = NULL;
597 _release_imported_bo(&mp_data->bo);
598 _release_imported_bo(&mp_data->data_bo);
601 tbm_key = mp_data->tbm_key;
602 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
603 cb_info->fd, cb_info, INT, tbm_key);
612 int _camera_media_packet_create(camera_cb_info_s *cb_info, camera_stream_data_s *stream,
613 camera_media_packet_data *mp_data, media_packet_h *packet)
615 media_packet_h pkt = NULL;
616 bool make_pkt_fmt = false;
617 tbm_surface_h tsurf = NULL;
618 tbm_surface_info_s tsurf_info;
619 media_format_mimetype_e mimetype = MEDIA_FORMAT_NV12;
620 uint32_t bo_format = 0;
623 int num_buffer_key = 0;
624 tbm_bo *buffer_bo = NULL;
626 if (cb_info == NULL || stream == NULL || mp_data == NULL || packet == NULL) {
627 LOGE("invalid parameter - cb_info:%p, stream:%p, mp_data:%p, packet:%p",
628 cb_info, stream, mp_data, packet);
629 return CAMERA_ERROR_INVALID_PARAMETER;
632 memset(&tsurf_info, 0x0, sizeof(tbm_surface_info_s));
633 buffer_bo = mp_data->buffer_bo;
634 num_buffer_key = mp_data->num_buffer_key;
636 /* create tbm surface */
637 for (i = 0 ; i < BUFFER_MAX_PLANE_NUM ; i++)
638 tsurf_info.planes[i].stride = stream->stride[i];
640 /* get tbm surface format */
641 ret = _camera_get_tbm_surface_format(stream->format, &bo_format);
642 ret |= _camera_get_media_packet_mimetype(stream->format, &mimetype);
644 if (ret == CAMERA_ERROR_NONE) {
645 tsurf_info.width = stream->width;
646 tsurf_info.height = stream->height;
647 tsurf_info.format = bo_format;
648 tsurf_info.bpp = tbm_surface_internal_get_bpp(bo_format);
649 tsurf_info.num_planes = tbm_surface_internal_get_num_planes(bo_format);
651 if (num_buffer_key > 0) {
653 case TBM_FORMAT_NV12:
654 case TBM_FORMAT_NV21:
655 tsurf_info.planes[0].size = stream->stride[0] * stream->elevation[0];
656 tsurf_info.planes[1].size = stream->stride[1] * stream->elevation[1];
657 tsurf_info.planes[0].offset = 0;
658 if (num_buffer_key == 1)
659 tsurf_info.planes[1].offset = tsurf_info.planes[0].size;
660 tsurf_info.size = tsurf_info.planes[0].size + tsurf_info.planes[1].size;
662 case TBM_FORMAT_YUV420:
663 case TBM_FORMAT_YVU420:
664 tsurf_info.planes[0].size = stream->stride[0] * stream->elevation[0];
665 tsurf_info.planes[1].size = stream->stride[1] * stream->elevation[1];
666 tsurf_info.planes[2].size = stream->stride[2] * stream->elevation[2];
667 tsurf_info.planes[0].offset = 0;
668 if (num_buffer_key == 1) {
669 tsurf_info.planes[1].offset = tsurf_info.planes[0].size;
670 tsurf_info.planes[2].offset = tsurf_info.planes[0].size + tsurf_info.planes[1].size;
672 tsurf_info.size = tsurf_info.planes[0].size + tsurf_info.planes[1].size + tsurf_info.planes[2].size;
674 case TBM_FORMAT_UYVY:
675 case TBM_FORMAT_YUYV:
676 tsurf_info.planes[0].size = (stream->stride[0] * stream->elevation[0]) << 1;
677 tsurf_info.planes[0].offset = 0;
678 tsurf_info.size = tsurf_info.planes[0].size;
684 tsurf = tbm_surface_internal_create_with_bos(&tsurf_info, buffer_bo, num_buffer_key);
685 } else if (mp_data->data_bo) {
687 case TBM_FORMAT_NV12:
688 case TBM_FORMAT_NV21:
689 tsurf_info.planes[0].size = stream->width * stream->height;
690 tsurf_info.planes[1].size = (tsurf_info.planes[0].size) >> 1;
691 tsurf_info.planes[0].offset = 0;
692 tsurf_info.planes[1].offset = tsurf_info.planes[0].size;
693 tsurf_info.size = tsurf_info.planes[0].size + tsurf_info.planes[1].size;
695 case TBM_FORMAT_YUV420:
696 case TBM_FORMAT_YVU420:
697 tsurf_info.planes[0].size = stream->width * stream->height;
698 tsurf_info.planes[1].size = (stream->width >> 1) * (stream->height >> 1);
699 tsurf_info.planes[2].size = tsurf_info.planes[1].size;
700 tsurf_info.planes[0].offset = 0;
701 tsurf_info.planes[1].offset = tsurf_info.planes[0].size;
702 tsurf_info.planes[2].offset = tsurf_info.planes[0].size + tsurf_info.planes[1].size;
703 tsurf_info.size = tsurf_info.planes[0].size + tsurf_info.planes[1].size + tsurf_info.planes[2].size;
705 case TBM_FORMAT_UYVY:
706 case TBM_FORMAT_YUYV:
707 tsurf_info.planes[0].size = (stream->width * stream->height) << 1;
708 tsurf_info.planes[0].offset = 0;
709 tsurf_info.size = tsurf_info.planes[0].size;
715 tsurf = tbm_surface_internal_create_with_bos(&tsurf_info, &mp_data->data_bo, 1);
717 /*LOGD("tbm surface %p", tsurf);*/
721 /* check media packet format */
722 if (cb_info->pkt_fmt) {
723 int pkt_fmt_width = 0;
724 int pkt_fmt_height = 0;
725 media_format_mimetype_e pkt_fmt_mimetype = MEDIA_FORMAT_NV12;
727 media_format_get_video_info(cb_info->pkt_fmt, &pkt_fmt_mimetype, &pkt_fmt_width, &pkt_fmt_height, NULL, NULL);
728 if (pkt_fmt_mimetype != mimetype ||
729 pkt_fmt_width != stream->width ||
730 pkt_fmt_height != stream->height) {
731 LOGW("different format. current 0x%x, %dx%d, new 0x%x, %dx%d",
732 pkt_fmt_mimetype, pkt_fmt_width, pkt_fmt_height, mimetype, stream->width, stream->height);
733 media_format_unref(cb_info->pkt_fmt);
734 cb_info->pkt_fmt = NULL;
741 /* create packet format */
743 LOGW("make new pkt_fmt - mimetype 0x%x, %dx%d", mimetype, stream->width, stream->height);
744 ret = media_format_create(&cb_info->pkt_fmt);
745 if (ret == MEDIA_FORMAT_ERROR_NONE) {
746 ret = media_format_set_video_mime(cb_info->pkt_fmt, mimetype);
747 ret |= media_format_set_video_width(cb_info->pkt_fmt, stream->width);
748 ret |= media_format_set_video_height(cb_info->pkt_fmt, stream->height);
749 LOGW("media_format_set_video_mime,width,height ret : 0x%x", ret);
751 LOGW("media_format_create failed");
755 /* create media packet */
756 ret = media_packet_create_from_tbm_surface(cb_info->pkt_fmt,
757 tsurf, (media_packet_finalize_cb)_camera_media_packet_finalize,
758 (void *)cb_info, &pkt);
759 if (ret != MEDIA_PACKET_ERROR_NONE) {
760 LOGE("media_packet_create_from_tbm_surface failed");
762 tbm_surface_destroy(tsurf);
766 LOGE("failed to create tbm surface %dx%d, format %d, num_buffer_key %d, data_bo %p",
767 stream->width, stream->height, stream->format, num_buffer_key, mp_data->data_bo);
771 LOGD("media packet %p, internal buffer %p", pkt, stream->internal_buffer);
773 /* set media packet data */
774 ret = media_packet_set_extra(pkt, (void *)mp_data);
775 if (ret != MEDIA_PACKET_ERROR_NONE) {
776 LOGE("media_packet_set_extra failed");
778 _camera_media_packet_data_release(mp_data, cb_info);
781 media_packet_destroy(pkt);
784 /* set timestamp : msec -> nsec */
785 if (media_packet_set_pts(pkt, (uint64_t)(stream->timestamp) * 1000000) != MEDIA_PACKET_ERROR_NONE)
786 LOGW("media_packet_set_pts failed");
795 int _camera_media_packet_finalize(media_packet_h pkt, int error_code, void *user_data)
798 camera_cb_info_s *cb_info = (camera_cb_info_s *)user_data;
799 camera_media_packet_data *mp_data = NULL;
800 tbm_surface_h tsurf = NULL;
802 if (pkt == NULL || cb_info == NULL) {
803 LOGE("invalid parameter buffer %p, cb_info %p", pkt, cb_info);
804 return MEDIA_PACKET_FINALIZE;
807 ret = media_packet_get_extra(pkt, (void **)&mp_data);
808 if (ret != MEDIA_PACKET_ERROR_NONE) {
809 LOGE("media_packet_get_extra failed 0x%x", ret);
810 return MEDIA_PACKET_FINALIZE;
813 /*LOGD("mp_data %p", mp_data);*/
815 g_mutex_lock(&cb_info->mp_data_mutex);
817 _camera_media_packet_data_release(mp_data, cb_info);
820 g_mutex_unlock(&cb_info->mp_data_mutex);
822 ret = media_packet_get_tbm_surface(pkt, &tsurf);
823 if (ret != MEDIA_PACKET_ERROR_NONE) {
824 LOGE("media_packet_get_tbm_surface failed 0x%x", ret);
825 return MEDIA_PACKET_FINALIZE;
829 tbm_surface_destroy(tsurf);
833 return MEDIA_PACKET_FINALIZE;
836 static void _client_user_callback(camera_cb_info_s *cb_info, char *recv_msg, muse_camera_event_e event)
842 tbm_bo_handle bo_handle = {NULL, };
844 if (recv_msg == NULL || event >= MUSE_CAMERA_EVENT_TYPE_NUM) {
845 LOGE("invalid parameter - camera msg %p, event %d", recv_msg, event);
849 LOGD("get camera msg %s, event %d", recv_msg, event);
851 if (event == MUSE_CAMERA_EVENT_TYPE_PREVIEW) {
852 if (!(CHECK_PREVIEW_CB(cb_info, PREVIEW_CB_TYPE_EVAS)) &&
853 cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW] == NULL &&
854 cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] == NULL) {
855 LOGW("all preview callback from user are NULL");
858 } else if (cb_info->user_cb[event] == NULL) {
859 LOGW("user callback for event %d is not set", event);
864 case MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE:
870 muse_camera_msg_get(previous, recv_msg);
871 muse_camera_msg_get(current, recv_msg);
872 muse_camera_msg_get(by_policy, recv_msg);
874 LOGD("STATE CHANGE - previous %d, current %d, by_policy %d",
875 previous, current, by_policy);
877 ((camera_state_changed_cb)cb_info->user_cb[event])((camera_state_e)previous,
878 (camera_state_e)current, (bool)by_policy, cb_info->user_data[event]);
881 case MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE:
885 muse_camera_msg_get(state, recv_msg);
887 LOGD("FOCUS state - %d", state);
889 ((camera_focus_changed_cb)cb_info->user_cb[event])((camera_focus_state_e)state, cb_info->user_data[event]);
892 case MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE:
893 LOGD("CAPTURE_COMPLETED");
894 ((camera_capture_completed_cb)cb_info->user_cb[event])(cb_info->user_data[event]);
896 case MUSE_CAMERA_EVENT_TYPE_PREVIEW:
897 case MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW:
899 int e_type = MUSE_CAMERA_EVENT_TYPE_PREVIEW;
902 int num_buffer_key = 0;
903 int buffer_key[BUFFER_MAX_PLANE_NUM] = {0, };
905 unsigned char *buf_pos = NULL;
907 tbm_bo buffer_bo[BUFFER_MAX_PLANE_NUM] = {NULL, };
908 tbm_bo_handle buffer_bo_handle[BUFFER_MAX_PLANE_NUM] = {{.ptr = NULL}, };
909 tbm_bo data_bo = NULL;
910 tbm_bo_handle data_bo_handle = {.ptr = NULL};
912 camera_preview_data_s frame;
913 camera_stream_data_s *stream = NULL;
914 camera_media_packet_data *mp_data = NULL;
915 media_packet_h pkt = NULL;
917 muse_camera_msg_get(tbm_key, recv_msg);
918 muse_camera_msg_get(num_buffer_key, recv_msg);
919 muse_camera_msg_get_array(buffer_key, recv_msg);
920 muse_camera_msg_get(data_key, recv_msg);
922 memset(&frame, 0x0, sizeof(camera_preview_data_s));
925 LOGE("invalid key %d", tbm_key);
930 /* import tbm data_bo and get virtual address */
931 if (!_import_tbm_key(cb_info->bufmgr, data_key, &data_bo, &data_bo_handle)) {
932 LOGE("failed to import data key %d", data_key);
933 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
934 cb_info->fd, cb_info, INT, tbm_key);
939 /* import tbm bo and get virtual address */
940 if (!_import_tbm_key(cb_info->bufmgr, tbm_key, &bo, &bo_handle)) {
941 LOGE("failed to import key %d", tbm_key);
942 _release_imported_bo(&data_bo);
943 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
944 cb_info->fd, cb_info, INT, tbm_key);
948 buf_pos = (unsigned char *)bo_handle.ptr;
950 /* get stream info */
951 stream = (camera_stream_data_s *)buf_pos;
953 for (i = 0 ; i < num_buffer_key ; i++) {
954 /* import buffer bo and get virtual address */
955 if (!_import_tbm_key(cb_info->bufmgr, buffer_key[i], &buffer_bo[i], &buffer_bo_handle[i])) {
956 LOGE("failed to import buffer key %d", buffer_key[i]);
958 /* release imported bo */
959 _release_imported_bo(&data_bo);
960 _release_imported_bo(&bo);
962 for (i -= 1 ; i >= 0 ; i--)
963 _release_imported_bo(&buffer_bo[i]);
965 /* send return buffer */
966 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
967 cb_info->fd, cb_info, INT, tbm_key);
973 /* call preview callback */
974 if (cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW]) {
975 _camera_preview_frame_create(stream, num_buffer_key, buffer_bo_handle, &data_bo_handle, &frame);
977 e_type = MUSE_CAMERA_EVENT_TYPE_PREVIEW;
978 ((camera_preview_cb)cb_info->user_cb[e_type])(&frame, cb_info->user_data[e_type]);
981 /* call media packet callback */
982 if (cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW]) {
983 ret = _camera_media_packet_data_create(tbm_key, num_buffer_key, bo, buffer_bo, data_bo, &mp_data);
985 if (ret == CAMERA_ERROR_NONE) {
986 ret = _camera_media_packet_create(cb_info, stream, mp_data, &pkt);
988 e_type = MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW;
989 if (ret == CAMERA_ERROR_NONE) {
990 ((camera_media_packet_preview_cb)cb_info->user_cb[e_type])(pkt, cb_info->user_data[e_type]);
992 _camera_media_packet_data_release(mp_data, cb_info);
998 /* call evas renderer */
999 if (CHECK_PREVIEW_CB(cb_info, PREVIEW_CB_TYPE_EVAS)) {
1000 #ifdef EVAS_RENDERER_SUPPORT
1001 ret = _camera_media_packet_data_create(tbm_key, num_buffer_key, bo, buffer_bo, data_bo, &mp_data);
1003 if (ret == CAMERA_ERROR_NONE) {
1004 ret = _camera_media_packet_create(cb_info, stream, mp_data, &pkt);
1006 if (ret == CAMERA_ERROR_NONE) {
1007 g_mutex_lock(&cb_info->evas_mutex);
1009 if (cb_info->run_evas_render)
1010 mm_evas_renderer_write(pkt, cb_info->evas_info);
1012 LOGW("evas renderer is stopped, skip this buffer...");
1013 media_packet_destroy(pkt);
1018 g_mutex_unlock(&cb_info->evas_mutex);
1020 _camera_media_packet_data_release(mp_data, cb_info);
1024 #else /* EVAS_RENDERER_SUPPORT */
1025 LOGW("evas renderer is not supported");
1026 #endif /* EVAS_RENDERER_SUPPORT */
1029 /* send message for preview callback return */
1030 if (!CHECK_PREVIEW_CB(cb_info, PREVIEW_CB_TYPE_EVAS))
1031 muse_camera_msg_send_no_return(MUSE_CAMERA_API_PREVIEW_CB_RETURN, cb_info->fd, cb_info);
1033 if (mp_data == NULL) {
1034 /* release imported bo */
1035 for (i = 0 ; i < num_buffer_key ; i++)
1036 _release_imported_bo(&buffer_bo[i]);
1038 /* unmap and unref tbm bo */
1039 _release_imported_bo(&data_bo);
1040 _release_imported_bo(&bo);
1043 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
1044 cb_info->fd, cb_info, INT, tbm_key);
1046 /*LOGD("return buffer Done");*/
1050 case MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS:
1054 muse_camera_msg_get(percent, recv_msg);
1056 LOGD("HDR progress - %d \%", percent);
1058 ((camera_attr_hdr_progress_cb)cb_info->user_cb[event])(percent, cb_info->user_data[event]);
1061 case MUSE_CAMERA_EVENT_TYPE_INTERRUPTED:
1067 muse_camera_msg_get(policy, recv_msg);
1068 muse_camera_msg_get(previous, recv_msg);
1069 muse_camera_msg_get(current, recv_msg);
1071 LOGD("INTERRUPTED - policy %d, state previous %d, current %d",
1072 policy, previous, current);
1074 ((camera_interrupted_cb)cb_info->user_cb[event])((camera_policy_e)policy,
1075 (camera_state_e)previous, (camera_state_e)current, cb_info->user_data[event]);
1078 case MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION:
1081 camera_detected_face_s *faces = NULL;
1083 muse_camera_msg_get(count, recv_msg);
1084 muse_camera_msg_get(tbm_key, recv_msg);
1086 if (count > 0 && tbm_key > 0) {
1087 LOGD("FACE_DETECTION - count %d, tbm_key %d", count, tbm_key);
1089 if (!_import_tbm_key(cb_info->bufmgr, tbm_key, &bo, &bo_handle))
1093 faces = bo_handle.ptr;
1095 ((camera_face_detected_cb)cb_info->user_cb[event])(faces, count, cb_info->user_data[event]);
1101 for (i = 0 ; i < count ; i++) {
1102 LOGD("id[%2d] - score %d, position (%d,%d,%dx%d)",
1103 i, faces[i].score, faces[i].x, faces[i].y, faces[i].width, faces[i].height);
1109 _release_imported_bo(&bo);
1112 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
1113 cb_info->fd, cb_info, INT, tbm_key);
1115 LOGD("return buffer done");
1117 LOGE("invalid message - count %d, key %d", count, tbm_key);
1121 case MUSE_CAMERA_EVENT_TYPE_ERROR:
1124 int current_state = 0;
1126 muse_camera_msg_get(error, recv_msg);
1127 muse_camera_msg_get(current_state, recv_msg);
1129 LOGE("ERROR - error 0x%x, current_state %d", error, current_state);
1131 ((camera_error_cb)cb_info->user_cb[event])((camera_error_e)error,
1132 (camera_state_e)current_state, cb_info->user_data[event]);
1135 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_RESOLUTION:
1136 muse_camera_msg_get(param1, recv_msg);
1137 muse_camera_msg_get(param2, recv_msg);
1139 LOGD("SUPPORTED_PREVIEW_RESOLUTION - %d x %d", param1, param2);
1141 if (((camera_supported_preview_resolution_cb)cb_info->user_cb[event])(param1, param2, cb_info->user_data[event]) == false) {
1142 cb_info->user_cb[event] = NULL;
1143 cb_info->user_data[event] = NULL;
1144 LOGD("stop foreach callback for SUPPORTED_PREVIEW_RESOLUTION");
1147 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_RESOLUTION:
1148 muse_camera_msg_get(param1, recv_msg);
1149 muse_camera_msg_get(param2, recv_msg);
1151 LOGD("SUPPORTED_CAPTURE_RESOLUTION - %d x %d", param1, param2);
1153 if (((camera_supported_capture_resolution_cb)cb_info->user_cb[event])(param1, param2, cb_info->user_data[event]) == false) {
1154 cb_info->user_cb[event] = NULL;
1155 cb_info->user_data[event] = NULL;
1156 LOGD("stop foreach callback for SUPPORTED_CAPTURE_RESOLUTION");
1159 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_FORMAT:
1160 muse_camera_msg_get(param1, recv_msg);
1162 LOGD("SUPPORTED_CAPTURE_FORMAT - %d ", param1);
1164 if (((camera_supported_capture_format_cb)cb_info->user_cb[event])((camera_pixel_format_e)param1, cb_info->user_data[event]) == false) {
1165 cb_info->user_cb[event] = NULL;
1166 cb_info->user_data[event] = NULL;
1167 LOGD("stop foreach callback for SUPPORTED_CAPTURE_FORMAT");
1170 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_FORMAT:
1171 muse_camera_msg_get(param1, recv_msg);
1173 LOGD("SUPPORTED_PREVIEW_FORMAT - %d ", param1);
1175 if (((camera_supported_preview_format_cb)cb_info->user_cb[event])((camera_pixel_format_e)param1, cb_info->user_data[event]) == false) {
1176 cb_info->user_cb[event] = NULL;
1177 cb_info->user_data[event] = NULL;
1178 LOGD("stop foreach callback for SUPPORTED_PREVIEW_FORMAT");
1181 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_AF_MODE:
1182 muse_camera_msg_get(param1, recv_msg);
1184 LOGD("SUPPORTED_AF_MODE - %d ", param1);
1186 if (((camera_attr_supported_af_mode_cb)cb_info->user_cb[event])((camera_attr_af_mode_e)param1, cb_info->user_data[event]) == false) {
1187 cb_info->user_cb[event] = NULL;
1188 cb_info->user_data[event] = NULL;
1189 LOGD("stop foreach callback for SUPPORTED_AF_MODE");
1192 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EXPOSURE_MODE:
1193 muse_camera_msg_get(param1, recv_msg);
1195 LOGD("SUPPORTED_EXPOSURE_MODE - %d ", param1);
1197 if (((camera_attr_supported_exposure_mode_cb)cb_info->user_cb[event])((camera_attr_exposure_mode_e)param1, cb_info->user_data[event]) == false) {
1198 cb_info->user_cb[event] = NULL;
1199 cb_info->user_data[event] = NULL;
1200 LOGD("stop foreach callback for SUPPORTED_EXPOSURE_MODE");
1203 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_ISO:
1204 muse_camera_msg_get(param1, recv_msg);
1206 LOGD("SUPPORTED_ISO - %d ", param1);
1208 if (((camera_attr_supported_iso_cb)cb_info->user_cb[event])((camera_attr_iso_e)param1, cb_info->user_data[event]) == false) {
1209 cb_info->user_cb[event] = NULL;
1210 cb_info->user_data[event] = NULL;
1211 LOGD("stop foreach callback for SUPPORTED_ISO");
1214 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_WHITEBALANCE:
1215 muse_camera_msg_get(param1, recv_msg);
1217 LOGD("SUPPORTED_WHITEBALANCE - %d ", param1);
1219 if (((camera_attr_supported_whitebalance_cb)cb_info->user_cb[event])((camera_attr_whitebalance_e)param1, cb_info->user_data[event]) == false) {
1220 cb_info->user_cb[event] = NULL;
1221 cb_info->user_data[event] = NULL;
1222 LOGD("stop foreach callback for SUPPORTED_WHITEBALANCE");
1225 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EFFECT:
1226 muse_camera_msg_get(param1, recv_msg);
1228 LOGD("SUPPORTED_EFFECT - %d ", param1);
1230 if (((camera_attr_supported_effect_cb)cb_info->user_cb[event])((camera_attr_effect_mode_e)param1, cb_info->user_data[event]) == false) {
1231 cb_info->user_cb[event] = NULL;
1232 cb_info->user_data[event] = NULL;
1233 LOGD("stop foreach callback for SUPPORTED_EFFECT");
1236 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_SCENE_MODE:
1237 muse_camera_msg_get(param1, recv_msg);
1239 LOGD("SUPPORTED_SCENE_MODE - %d ", param1);
1241 if (((camera_attr_supported_scene_mode_cb)cb_info->user_cb[event])((camera_attr_scene_mode_e)param1, cb_info->user_data[event]) == false) {
1242 cb_info->user_cb[event] = NULL;
1243 cb_info->user_data[event] = NULL;
1244 LOGD("stop foreach callback for SUPPORTED_SCENE_MODE");
1247 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FLASH_MODE:
1248 muse_camera_msg_get(param1, recv_msg);
1250 LOGD("SUPPORTED_FLASH_MODE - %d ", param1);
1252 if (((camera_attr_supported_flash_mode_cb)cb_info->user_cb[event])((camera_attr_flash_mode_e)param1, cb_info->user_data[event]) == false) {
1253 cb_info->user_cb[event] = NULL;
1254 cb_info->user_data[event] = NULL;
1255 LOGD("stop foreach callback for SUPPORTED_FLASH_MODE");
1258 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS:
1259 muse_camera_msg_get(param1, recv_msg);
1261 LOGD("SUPPORTED_FPS - %d ", param1);
1263 if (((camera_attr_supported_fps_cb)cb_info->user_cb[event])((camera_attr_fps_e)param1, cb_info->user_data[event]) == false) {
1264 cb_info->user_cb[event] = NULL;
1265 cb_info->user_data[event] = NULL;
1266 LOGD("stop foreach callback for SUPPORTED_FPS");
1269 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS_BY_RESOLUTION:
1270 muse_camera_msg_get(param1, recv_msg);
1272 LOGD("SUPPORTED_FPS_BY_RESOLUTION - %d ", param1);
1274 if (((camera_attr_supported_fps_cb)cb_info->user_cb[event])((camera_attr_fps_e)param1, cb_info->user_data[event]) == false) {
1275 cb_info->user_cb[event] = NULL;
1276 cb_info->user_data[event] = NULL;
1277 LOGD("stop foreach callback for SUPPORTED_FPS_BY_RESOLUTION");
1280 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_FLIP:
1281 muse_camera_msg_get(param1, recv_msg);
1283 LOGD("SUPPORTED_STREAM_FLIP - %d ", param1);
1285 if (((camera_attr_supported_stream_flip_cb)cb_info->user_cb[event])((camera_flip_e)param1, cb_info->user_data[event]) == false) {
1286 cb_info->user_cb[event] = NULL;
1287 cb_info->user_data[event] = NULL;
1288 LOGD("stop foreach callback for SUPPORTED_STREAM_FLIP");
1291 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION:
1292 muse_camera_msg_get(param1, recv_msg);
1294 LOGD("SUPPORTED_STREAM_ROTATION - %d ", param1);
1296 if (((camera_attr_supported_stream_rotation_cb)cb_info->user_cb[event])((camera_rotation_e)param1, cb_info->user_data[event]) == false) {
1297 cb_info->user_cb[event] = NULL;
1298 cb_info->user_data[event] = NULL;
1299 LOGD("stop foreach callback for SUPPORTED_STREAM_ROTATION");
1302 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE:
1303 muse_camera_msg_get(param1, recv_msg);
1305 LOGD("SUPPORTED_THEATER_MODE - %d ", param1);
1307 if (((camera_attr_supported_theater_mode_cb)cb_info->user_cb[event])((camera_attr_theater_mode_e)param1, cb_info->user_data[event]) == false) {
1308 cb_info->user_cb[event] = NULL;
1309 cb_info->user_data[event] = NULL;
1310 LOGD("stop foreach callback for SUPPORTED_THEATER_MODE");
1313 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PTZ_TYPE:
1314 muse_camera_msg_get(param1, recv_msg);
1316 LOGD("SUPPORTED_PTZ_TYPE - %d ", param1);
1318 if (((camera_attr_supported_ptz_type_cb)cb_info->user_cb[event])((camera_attr_ptz_type_e)param1, cb_info->user_data[event]) == false) {
1319 cb_info->user_cb[event] = NULL;
1320 cb_info->user_data[event] = NULL;
1321 LOGD("stop foreach callback for SUPPORTED_PTZ_TYPE");
1324 case MUSE_CAMERA_EVENT_TYPE_CAPTURE:
1326 camera_image_data_s *rImage = NULL;
1327 camera_image_data_s *rPostview = NULL;
1328 camera_image_data_s *rThumbnail = NULL;
1329 unsigned char *buf_pos = NULL;
1330 int tbm_key_main = 0;
1331 int tbm_key_post = 0;
1332 int tbm_key_thumb = 0;
1333 tbm_bo bo_main = NULL;
1334 tbm_bo bo_post = NULL;
1335 tbm_bo bo_thumb = NULL;
1336 tbm_bo_handle bo_main_handle = {NULL, };
1337 tbm_bo_handle bo_post_handle = {NULL, };
1338 tbm_bo_handle bo_thumb_handle = {NULL, };
1340 muse_camera_msg_get(tbm_key_main, recv_msg);
1341 muse_camera_msg_get(tbm_key_post, recv_msg);
1342 muse_camera_msg_get(tbm_key_thumb, recv_msg);
1344 LOGD("camera capture callback came in. tbm_key_main %d, tbm_key_post %d, tbm_key_thumb %d",
1345 tbm_key_main, tbm_key_post, tbm_key_thumb);
1347 if (tbm_key_main <= 0) {
1348 LOGE("invalid tbm_key_main %d", tbm_key_main);
1352 /* import tbm bo and get virtual address */
1353 if (!_import_tbm_key(cb_info->bufmgr, tbm_key_main, &bo_main, &bo_main_handle))
1356 buf_pos = (unsigned char *)bo_main_handle.ptr;
1357 rImage = (camera_image_data_s *)buf_pos;
1358 rImage->data = buf_pos + sizeof(camera_image_data_s);
1360 LOGD("image info %dx%d, size : %d", rImage->height, rImage->width, rImage->size);
1362 if (tbm_key_post > 0) {
1363 /* import tbm bo and get virtual address */
1364 if (!_import_tbm_key(cb_info->bufmgr, tbm_key_post, &bo_post, &bo_post_handle))
1367 buf_pos = (unsigned char *)bo_post_handle.ptr;
1368 rPostview = (camera_image_data_s *)buf_pos;
1369 LOGD("rPostview->size : %d", rPostview->size);
1370 rPostview->data = buf_pos + sizeof(camera_image_data_s);
1373 if (tbm_key_thumb > 0) {
1374 /* import tbm bo and get virtual address */
1375 if (!_import_tbm_key(cb_info->bufmgr, tbm_key_thumb, &bo_thumb, &bo_thumb_handle))
1378 buf_pos = (unsigned char *)bo_thumb_handle.ptr;
1380 rThumbnail = (camera_image_data_s *)buf_pos;
1381 LOGD("rThumbnail->size : %d", rThumbnail->size);
1382 rThumbnail->data = buf_pos + sizeof(camera_image_data_s);
1385 ((camera_capturing_cb)cb_info->user_cb[event])(rImage, rPostview, rThumbnail, cb_info->user_data[event]);
1387 /* unmap and unref tbm bo */
1388 _release_imported_bo(&bo_main);
1391 tbm_key = tbm_key_main;
1392 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
1393 cb_info->fd, cb_info, INT, tbm_key);
1395 if (tbm_key_post > 0) {
1396 /* unmap and unref tbm bo */
1397 _release_imported_bo(&bo_post);
1400 tbm_key = tbm_key_post;
1401 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
1402 cb_info->fd, cb_info, INT, tbm_key);
1405 if (tbm_key_thumb > 0) {
1406 /* unmap and unref tbm bo */
1407 _release_imported_bo(&bo_thumb);
1410 tbm_key = tbm_key_thumb;
1411 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
1412 cb_info->fd, cb_info, INT, tbm_key);
1415 LOGD("return buffer done");
1418 case MUSE_CAMERA_EVENT_TYPE_VIDEO_FRAME_RENDER_ERROR:
1421 LOGW("Unknown event : %d", event);
1428 static bool _camera_idle_event_callback(void *data)
1430 camera_cb_info_s *cb_info = NULL;
1431 camera_idle_event_s *cam_idle_event = (camera_idle_event_s *)data;
1433 if (cam_idle_event == NULL) {
1434 LOGE("cam_idle_event is NULL");
1439 g_mutex_lock(&cam_idle_event->event_mutex);
1441 cb_info = cam_idle_event->cb_info;
1442 if (cb_info == NULL) {
1443 LOGW("camera cb_info is NULL. event %d", cam_idle_event->event);
1444 goto IDLE_EVENT_CALLBACK_DONE;
1447 /* remove event from list */
1448 g_mutex_lock(&cb_info->idle_event_mutex);
1449 if (cb_info->idle_event_list)
1450 cb_info->idle_event_list = g_list_remove(cb_info->idle_event_list, (gpointer)cam_idle_event);
1452 /*LOGD("remove camera idle event %p, %p", cam_idle_event, cb_info->idle_event_list);*/
1453 g_mutex_unlock(&cb_info->idle_event_mutex);
1456 _client_user_callback(cam_idle_event->cb_info, cam_idle_event->recv_msg, cam_idle_event->event);
1458 /* send signal for waiting thread */
1459 g_cond_signal(&cb_info->idle_event_cond);
1461 IDLE_EVENT_CALLBACK_DONE:
1462 /* unlock and release event */
1463 g_mutex_unlock(&cam_idle_event->event_mutex);
1464 g_mutex_clear(&cam_idle_event->event_mutex);
1466 g_free(cam_idle_event);
1467 cam_idle_event = NULL;
1472 static void *_camera_msg_handler_func(gpointer data)
1477 int event_class = 0;
1478 camera_message_s *cam_msg = NULL;
1479 camera_idle_event_s *cam_idle_event = NULL;
1480 camera_cb_info_s *cb_info = (camera_cb_info_s *)data;
1482 if (cb_info == NULL) {
1483 LOGE("cb_info NULL");
1489 g_mutex_lock(&cb_info->msg_handler_mutex);
1491 while (g_atomic_int_get(&cb_info->msg_handler_running)) {
1492 if (g_queue_is_empty(cb_info->msg_queue)) {
1493 LOGD("signal wait...");
1494 g_cond_wait(&cb_info->msg_handler_cond, &cb_info->msg_handler_mutex);
1495 LOGD("signal received");
1497 if (g_atomic_int_get(&cb_info->msg_handler_running) == 0) {
1498 LOGD("stop event thread");
1503 cam_msg = (camera_message_s *)g_queue_pop_head(cb_info->msg_queue);
1505 g_mutex_unlock(&cb_info->msg_handler_mutex);
1507 if (cam_msg == NULL) {
1508 LOGE("NULL message");
1509 g_mutex_lock(&cb_info->msg_handler_mutex);
1515 if (api < MUSE_CAMERA_API_MAX) {
1516 g_mutex_lock(&cb_info->api_mutex[api]);
1518 if (muse_camera_msg_get(ret, cam_msg->recv_msg)) {
1519 cb_info->api_ret[api] = ret;
1520 cb_info->api_activating[api] = 1;
1522 LOGD("camera api %d - return 0x%x", ret);
1524 g_cond_signal(&cb_info->api_cond[api]);
1526 LOGE("failed to get camera ret for api %d, msg %s", api, cam_msg->recv_msg);
1529 g_mutex_unlock(&cb_info->api_mutex[api]);
1530 } else if (api == MUSE_CAMERA_CB_EVENT) {
1534 if (!muse_camera_msg_get(event, cam_msg->recv_msg) ||
1535 !muse_camera_msg_get(event_class, cam_msg->recv_msg)) {
1536 LOGE("failed to get camera event %d, class %d", event, event_class);
1541 g_mutex_lock(&cb_info->msg_handler_mutex);
1545 switch (event_class) {
1546 case MUSE_CAMERA_EVENT_CLASS_THREAD_SUB:
1547 _client_user_callback(cb_info, cam_msg->recv_msg, event);
1549 case MUSE_CAMERA_EVENT_CLASS_THREAD_MAIN:
1550 cam_idle_event = g_new0(camera_idle_event_s, 1);
1551 if (cam_idle_event == NULL) {
1552 LOGE("cam_idle_event alloc failed");
1556 cam_idle_event->event = event;
1557 cam_idle_event->cb_info = cb_info;
1558 g_mutex_init(&cam_idle_event->event_mutex);
1559 memcpy(cam_idle_event->recv_msg, cam_msg->recv_msg, sizeof(cam_idle_event->recv_msg));
1561 LOGD("add camera event[%d, %p] to IDLE", event, cam_idle_event);
1563 g_mutex_lock(&cb_info->idle_event_mutex);
1564 cb_info->idle_event_list = g_list_append(cb_info->idle_event_list, (gpointer)cam_idle_event);
1565 g_mutex_unlock(&cb_info->idle_event_mutex);
1567 g_idle_add_full(G_PRIORITY_DEFAULT,
1568 (GSourceFunc)_camera_idle_event_callback,
1569 (gpointer)cam_idle_event,
1573 LOGE("unknown camera event class %d", event_class);
1577 LOGE("unknown camera api[%d] message[%s]", api, cam_msg->recv_msg);
1583 g_mutex_lock(&cb_info->msg_handler_mutex);
1586 /* remove remained event */
1587 while (!g_queue_is_empty(cb_info->msg_queue)) {
1588 cam_msg = (camera_message_s *)g_queue_pop_head(cb_info->msg_queue);
1590 LOGD("remove camera message %p", cam_msg);
1594 LOGW("NULL camera message");
1598 g_mutex_unlock(&cb_info->msg_handler_mutex);
1605 static void _camera_remove_idle_event_all(camera_cb_info_s *cb_info)
1607 camera_idle_event_s *cam_idle_event = NULL;
1608 gboolean ret = TRUE;
1610 gint64 end_time = 0;
1612 if (cb_info == NULL) {
1613 LOGE("cb_info is NULL");
1617 g_mutex_lock(&cb_info->idle_event_mutex);
1619 if (cb_info->idle_event_list == NULL) {
1620 LOGD("No idle event is remained.");
1622 list = cb_info->idle_event_list;
1625 cam_idle_event = list->data;
1626 list = g_list_next(list);
1628 if (!cam_idle_event) {
1629 LOGW("Fail to remove idle event. The event is NULL");
1631 if (g_mutex_trylock(&cam_idle_event->event_mutex)) {
1632 ret = g_idle_remove_by_data(cam_idle_event);
1634 LOGD("remove idle event [%p], ret[%d]", cam_idle_event, ret);
1637 cam_idle_event->cb_info = NULL;
1638 LOGW("idle callback for event %p will be called later", cam_idle_event);
1641 cb_info->idle_event_list = g_list_remove(cb_info->idle_event_list, (gpointer)cam_idle_event);
1643 g_mutex_unlock(&cam_idle_event->event_mutex);
1646 g_mutex_clear(&cam_idle_event->event_mutex);
1648 g_free(cam_idle_event);
1649 cam_idle_event = NULL;
1651 LOGD("remove idle event done");
1654 LOGW("event lock failed. it's being called...");
1656 end_time = g_get_monotonic_time() + G_TIME_SPAN_MILLISECOND * 100;
1658 if (g_cond_wait_until(&cb_info->idle_event_cond, &cb_info->idle_event_mutex, end_time))
1659 LOGW("signal received");
1666 g_list_free(cb_info->idle_event_list);
1667 cb_info->idle_event_list = NULL;
1670 g_mutex_unlock(&cb_info->idle_event_mutex);
1675 static void *_camera_msg_recv_func(gpointer data)
1684 char *recv_msg = NULL;
1685 char **parse_str = NULL;
1686 camera_cb_info_s *cb_info = (camera_cb_info_s *)data;
1688 if (cb_info == NULL) {
1689 LOGE("cb_info NULL");
1695 parse_str = (char **)malloc(sizeof(char *) * CAMERA_PARSE_STRING_SIZE);
1696 if (parse_str == NULL) {
1697 LOGE("parse_str malloc failed");
1701 for (i = 0 ; i < CAMERA_PARSE_STRING_SIZE ; i++) {
1702 parse_str[i] = (char *)malloc(sizeof(char) * MUSE_CAMERA_MSG_MAX_LENGTH);
1703 if (parse_str[i] == NULL) {
1704 LOGE("parse_str[%d] malloc failed", i);
1705 goto CB_HANDLER_EXIT;
1709 recv_msg = cb_info->recv_msg;
1711 while (g_atomic_int_get(&cb_info->msg_recv_running)) {
1712 ret = muse_core_ipc_recv_msg(cb_info->fd, recv_msg);
1715 recv_msg[ret] = '\0';
1721 /*LOGD("recvMSg : %s, length : %d", recv_msg, ret);*/
1723 /* Need to split the combined entering msgs.
1724 This module supports up to 200 combined msgs. */
1725 for (str_pos = 0; str_pos < ret; str_pos++) {
1726 if (recv_msg[str_pos] == '}') {
1727 memset(parse_str[num_token], 0x0, sizeof(char) * MUSE_CAMERA_MSG_MAX_LENGTH);
1728 strncpy(parse_str[num_token], recv_msg + prev_pos, str_pos - prev_pos + 1);
1729 LOGD("splitted msg : [%s], Index : %d", parse_str[num_token], num_token);
1730 prev_pos = str_pos+1;
1735 /*LOGD("num_token : %d", num_token);*/
1737 /* Re-construct to the useful single msg. */
1738 for (i = 0; i < num_token; i++) {
1739 if (i >= CAMERA_PARSE_STRING_SIZE) {
1740 LOGE("invalid token index %d", i);
1747 if (!muse_camera_msg_get(api, parse_str[i])) {
1748 LOGE("failed to get camera api");
1752 if (api != MUSE_CAMERA_CB_EVENT) {
1753 LOGD("check api_class");
1754 if (muse_camera_msg_get(api_class, parse_str[i]))
1755 LOGD("camera api_class[%d]", api_class);
1758 if (api_class == MUSE_CAMERA_API_CLASS_IMMEDIATE) {
1759 g_mutex_lock(&cb_info->api_mutex[api]);
1761 if (!muse_camera_msg_get(ret, parse_str[i])) {
1762 LOGE("failed to get camera ret");
1763 g_mutex_unlock(&cb_info->api_mutex[api]);
1767 cb_info->api_ret[api] = ret;
1768 cb_info->api_activating[api] = 1;
1770 if (api == MUSE_CAMERA_API_CREATE) {
1771 if (ret != CAMERA_ERROR_NONE) {
1772 g_atomic_int_set(&cb_info->msg_recv_running, 0);
1773 LOGE("camera create error 0x%x. close client cb handler", ret);
1775 } else if (api == MUSE_CAMERA_API_DESTROY) {
1776 if (ret == CAMERA_ERROR_NONE) {
1777 g_atomic_int_set(&cb_info->msg_recv_running, 0);
1778 LOGD("camera destroy done. close client cb handler");
1782 g_cond_signal(&cb_info->api_cond[api]);
1783 g_mutex_unlock(&cb_info->api_mutex[api]);
1784 } else if (api_class == MUSE_CAMERA_API_CLASS_THREAD_SUB || api == MUSE_CAMERA_CB_EVENT) {
1785 camera_message_s *cam_msg = g_new0(camera_message_s, 1);
1786 if (cam_msg == NULL) {
1787 LOGE("failed to alloc cam_msg");
1792 memcpy(cam_msg->recv_msg, parse_str[i], sizeof(cam_msg->recv_msg));
1794 LOGD("add camera message to queue : api %d", api);
1796 g_mutex_lock(&cb_info->msg_handler_mutex);
1797 g_queue_push_tail(cb_info->msg_queue, (gpointer)cam_msg);
1798 g_cond_signal(&cb_info->msg_handler_cond);
1799 g_mutex_unlock(&cb_info->msg_handler_mutex);
1801 LOGW("unknown camera api %d and api_class %d", api, api_class);
1807 LOGD("client cb exit");
1811 for (i = 0 ; i < CAMERA_PARSE_STRING_SIZE ; i++) {
1814 parse_str[i] = NULL;
1825 static camera_cb_info_s *_client_callback_new(gint sockfd)
1827 camera_cb_info_s *cb_info = NULL;
1828 gint *tmp_activating = NULL;
1829 gint *tmp_ret = NULL;
1832 g_return_val_if_fail(sockfd > 0, NULL);
1834 cb_info = g_new0(camera_cb_info_s, 1);
1835 if (cb_info == NULL) {
1836 LOGE("cb_info failed");
1840 g_mutex_init(&cb_info->msg_handler_mutex);
1841 g_cond_init(&cb_info->msg_handler_cond);
1842 g_mutex_init(&cb_info->idle_event_mutex);
1843 g_cond_init(&cb_info->idle_event_cond);
1844 g_mutex_init(&cb_info->mp_data_mutex);
1845 #ifdef EVAS_RENDERER_SUPPORT
1846 g_mutex_init(&cb_info->evas_mutex);
1847 #endif /* EVAS_RENDERER_SUPPORT */
1849 for (i = 0 ; i < MUSE_CAMERA_API_MAX ; i++) {
1850 g_mutex_init(&cb_info->api_mutex[i]);
1851 g_cond_init(&cb_info->api_cond[i]);
1854 tmp_activating = g_new0(gint, MUSE_CAMERA_API_MAX);
1855 if (tmp_activating == NULL) {
1856 LOGE("tmp_activating failed");
1860 tmp_ret = g_new0(gint, MUSE_CAMERA_API_MAX);
1861 if (tmp_ret == NULL) {
1862 LOGE("tmp_ret failed");
1866 cb_info->msg_queue = g_queue_new();
1867 if (cb_info->msg_queue == NULL) {
1868 LOGE("msg_queue new failed");
1872 g_atomic_int_set(&cb_info->msg_handler_running, 1);
1873 cb_info->msg_handler_thread = g_thread_try_new("camera_msg_handler",
1874 _camera_msg_handler_func, (gpointer)cb_info, NULL);
1875 if (cb_info->msg_handler_thread == NULL) {
1876 LOGE("message handler thread creation failed");
1880 cb_info->fd = sockfd;
1881 cb_info->api_activating = tmp_activating;
1882 cb_info->api_ret = tmp_ret;
1883 cb_info->preview_cb_flag = 0;
1884 #ifdef EVAS_RENDERER_SUPPORT
1885 cb_info->evas_info = NULL;
1886 #endif /* EVAS_RENDERER_SUPPORT */
1888 g_atomic_int_set(&cb_info->msg_recv_running, 1);
1889 cb_info->msg_recv_thread = g_thread_try_new("camera_msg_recv",
1890 _camera_msg_recv_func, (gpointer)cb_info, NULL);
1891 if (cb_info->msg_recv_thread == NULL) {
1892 LOGE("message receive thread creation failed");
1900 if (cb_info->msg_handler_thread) {
1901 g_mutex_lock(&cb_info->msg_handler_mutex);
1902 g_atomic_int_set(&cb_info->msg_handler_running, 0);
1903 g_cond_signal(&cb_info->msg_handler_cond);
1904 g_mutex_unlock(&cb_info->msg_handler_mutex);
1906 g_thread_join(cb_info->msg_handler_thread);
1907 g_thread_unref(cb_info->msg_handler_thread);
1908 cb_info->msg_handler_thread = NULL;
1911 for (i = 0 ; i < MUSE_CAMERA_API_MAX ; i++) {
1912 g_mutex_clear(&cb_info->api_mutex[i]);
1913 g_cond_clear(&cb_info->api_cond[i]);
1916 g_mutex_clear(&cb_info->msg_handler_mutex);
1917 g_cond_clear(&cb_info->msg_handler_cond);
1918 g_mutex_clear(&cb_info->idle_event_mutex);
1919 g_cond_clear(&cb_info->idle_event_cond);
1920 g_mutex_clear(&cb_info->mp_data_mutex);
1921 #ifdef EVAS_RENDERER_SUPPORT
1922 g_mutex_clear(&cb_info->evas_mutex);
1923 #endif /* EVAS_RENDERER_SUPPORT */
1925 if (cb_info->msg_queue) {
1926 g_queue_free(cb_info->msg_queue);
1927 cb_info->msg_queue = NULL;
1934 if (tmp_activating) {
1935 g_free(tmp_activating);
1936 tmp_activating = NULL;
1946 static void _client_callback_destroy(camera_cb_info_s *cb_info)
1950 g_return_if_fail(cb_info != NULL);
1952 LOGD("MSG receive thread[%p] destroy", cb_info->msg_recv_thread);
1954 g_thread_join(cb_info->msg_recv_thread);
1955 g_thread_unref(cb_info->msg_recv_thread);
1956 cb_info->msg_recv_thread = NULL;
1958 LOGD("msg thread removed");
1960 g_mutex_lock(&cb_info->msg_handler_mutex);
1961 g_atomic_int_set(&cb_info->msg_handler_running, 0);
1962 g_cond_signal(&cb_info->msg_handler_cond);
1963 g_mutex_unlock(&cb_info->msg_handler_mutex);
1965 g_thread_join(cb_info->msg_handler_thread);
1966 g_thread_unref(cb_info->msg_handler_thread);
1967 cb_info->msg_handler_thread = NULL;
1969 g_queue_free(cb_info->msg_queue);
1970 cb_info->msg_queue = NULL;
1972 for (i = 0 ; i < MUSE_CAMERA_API_MAX ; i++) {
1973 g_mutex_clear(&cb_info->api_mutex[i]);
1974 g_cond_clear(&cb_info->api_cond[i]);
1977 g_mutex_clear(&cb_info->msg_handler_mutex);
1978 g_cond_clear(&cb_info->msg_handler_cond);
1979 g_mutex_clear(&cb_info->idle_event_mutex);
1980 g_cond_clear(&cb_info->idle_event_cond);
1981 g_mutex_clear(&cb_info->mp_data_mutex);
1982 #ifdef EVAS_RENDERER_SUPPORT
1983 g_mutex_clear(&cb_info->evas_mutex);
1984 #endif /* EVAS_RENDERER_SUPPORT */
1986 LOGD("event thread removed");
1988 if (cb_info->fd > -1) {
1989 muse_core_connection_close(cb_info->fd);
1993 if (cb_info->bufmgr) {
1994 tbm_bufmgr_deinit(cb_info->bufmgr);
1995 cb_info->bufmgr = NULL;
1997 if (cb_info->api_activating) {
1998 g_free(cb_info->api_activating);
1999 cb_info->api_activating = NULL;
2001 if (cb_info->api_ret) {
2002 g_free(cb_info->api_ret);
2003 cb_info->api_ret = NULL;
2005 if (cb_info->pkt_fmt) {
2006 media_format_unref(cb_info->pkt_fmt);
2007 cb_info->pkt_fmt = NULL;
2010 #ifdef EVAS_RENDERER_SUPPORT
2011 if (cb_info->evas_info)
2012 mm_evas_renderer_destroy(&cb_info->evas_info);
2013 #endif /* EVAS_RENDERER_SUPPORT */
2015 cb_info->preview_cb_flag = 0;
2024 int _camera_start_evas_rendering(camera_h camera)
2026 int ret = CAMERA_ERROR_NONE;
2027 camera_cli_s *pc = (camera_cli_s *)camera;
2029 if (camera == NULL) {
2030 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2031 return CAMERA_ERROR_INVALID_PARAMETER;
2034 if (pc->cb_info == NULL) {
2035 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2036 return CAMERA_ERROR_INVALID_PARAMETER;
2041 if (!CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
2042 LOGE("EVAS surface is not set");
2043 return CAMERA_ERROR_NONE;
2046 #ifdef EVAS_RENDERER_SUPPORT
2047 g_mutex_lock(&pc->cb_info->evas_mutex);
2049 /* set evas render flag as RUN */
2050 pc->cb_info->run_evas_render = true;
2051 ret = CAMERA_ERROR_NONE;
2053 g_mutex_unlock(&pc->cb_info->evas_mutex);
2054 #else /* EVAS_RENDERER_SUPPORT */
2055 LOGW("evas renderer is not supported");
2056 ret = CAMERA_ERROR_NOT_SUPPORTED;
2057 #endif /* EVAS_RENDERER_SUPPORT */
2063 int _camera_stop_evas_rendering(camera_h camera, bool keep_screen)
2065 int ret = CAMERA_ERROR_NONE;
2066 camera_cli_s *pc = (camera_cli_s *)camera;
2068 if (camera == NULL) {
2069 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2070 return CAMERA_ERROR_INVALID_PARAMETER;
2073 if (pc->cb_info == NULL) {
2074 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2075 return CAMERA_ERROR_INVALID_PARAMETER;
2078 LOGD("stop - keep screen %d", keep_screen);
2080 if (!CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
2081 LOGE("EVAS surface is not set");
2082 return CAMERA_ERROR_NONE;
2085 #ifdef EVAS_RENDERER_SUPPORT
2086 g_mutex_lock(&pc->cb_info->evas_mutex);
2088 /* set evas render flag as STOP and release buffers */
2089 pc->cb_info->run_evas_render = false;
2091 ret = mm_evas_renderer_retrieve_all_packets(pc->cb_info->evas_info, keep_screen);
2092 if (ret != MM_ERROR_NONE) {
2093 LOGE("mm_evas_renderer_retrieve_all_packets failed 0x%x", ret);
2094 ret = CAMERA_ERROR_INVALID_OPERATION;
2097 g_mutex_unlock(&pc->cb_info->evas_mutex);
2098 #else /* EVAS_RENDERER_SUPPORT */
2099 LOGW("evas renderer is not supported");
2100 ret = CAMERA_ERROR_NOT_SUPPORTED;
2101 #endif /* EVAS_RENDERER_SUPPORT */
2107 int camera_create(camera_device_e device, camera_h *camera)
2111 int ret = CAMERA_ERROR_NONE;
2113 camera_cli_s *pc = NULL;
2114 tbm_bufmgr bufmgr = NULL;
2116 muse_camera_api_e api = MUSE_CAMERA_API_CREATE;
2117 muse_core_api_module_e muse_module = MUSE_CAMERA;
2118 int device_type = (int)device;
2120 if (camera == NULL) {
2121 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2122 return CAMERA_ERROR_INVALID_PARAMETER;
2125 bufmgr = tbm_bufmgr_init(-1);
2126 if (bufmgr == NULL) {
2127 LOGE("get tbm bufmgr failed");
2128 return CAMERA_ERROR_INVALID_OPERATION;
2131 sock_fd = muse_core_client_new();
2133 LOGE("muse_core_client_new failed - returned fd %d", sock_fd);
2134 ret = CAMERA_ERROR_INVALID_OPERATION;
2140 sndMsg = muse_core_msg_json_factory_new(api,
2141 MUSE_TYPE_INT, "module", muse_module,
2142 MUSE_TYPE_INT, PARAM_DEVICE_TYPE, device_type,
2143 MUSE_TYPE_INT, "pid", pid,
2146 muse_core_ipc_send_msg(sock_fd, sndMsg);
2147 muse_core_msg_json_factory_free(sndMsg);
2149 pc = g_new0(camera_cli_s, 1);
2151 LOGE("camera_cli_s alloc failed");
2152 ret = CAMERA_ERROR_OUT_OF_MEMORY;
2156 pc->cb_info = _client_callback_new(sock_fd);
2157 if (pc->cb_info == NULL) {
2158 LOGE("cb_info alloc failed");
2159 ret = CAMERA_ERROR_OUT_OF_MEMORY;
2163 LOGD("cb info : %d", pc->cb_info->fd);
2165 ret = _client_wait_for_cb_return(api, pc->cb_info, CALLBACK_TIME_OUT);
2166 if (ret == CAMERA_ERROR_NONE) {
2167 intptr_t handle = 0;
2168 muse_camera_msg_get_pointer(handle, pc->cb_info->recv_msg);
2170 LOGE("Receiving Handle Failed!!");
2171 ret = CAMERA_ERROR_INVALID_OPERATION;
2175 pc->remote_handle = handle;
2176 pc->cb_info->bufmgr = bufmgr;
2178 ret = camera_set_display((camera_h)pc, CAMERA_DISPLAY_TYPE_NONE, NULL);
2179 if (ret != CAMERA_ERROR_NONE) {
2180 LOGE("init display failed 0x%x", ret);
2184 LOGD("camera create 0x%x", pc->remote_handle);
2185 *camera = (camera_h)pc;
2193 tbm_bufmgr_deinit(bufmgr);
2197 _client_callback_destroy(pc->cb_info);
2203 LOGE("camera create error : 0x%x", ret);
2208 int camera_destroy(camera_h camera)
2210 if (camera == NULL) {
2211 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2212 return CAMERA_ERROR_INVALID_PARAMETER;
2215 int ret = CAMERA_ERROR_NONE;
2216 muse_camera_api_e api = MUSE_CAMERA_API_DESTROY;
2217 camera_cli_s *pc = (camera_cli_s *)camera;
2222 if (pc->cb_info == NULL) {
2223 LOGE("cb_info NULL, INVALID_PARAMETER");
2224 return CAMERA_ERROR_INVALID_PARAMETER;
2227 sock_fd = pc->cb_info->fd;
2229 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2230 if (ret == CAMERA_ERROR_NONE) {
2231 _camera_remove_idle_event_all(pc->cb_info);
2232 _client_callback_destroy(pc->cb_info);
2238 LOGE("camera destroy error : 0x%x", ret);
2244 int camera_start_preview(camera_h camera)
2246 int ret = CAMERA_ERROR_NONE;
2247 muse_camera_api_e api = MUSE_CAMERA_API_START_PREVIEW;
2248 camera_cli_s *pc = (camera_cli_s *)camera;
2251 if (camera == NULL) {
2252 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2253 return CAMERA_ERROR_INVALID_PARAMETER;
2256 if (pc->cb_info == NULL) {
2257 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2258 return CAMERA_ERROR_INVALID_PARAMETER;
2263 sock_fd = pc->cb_info->fd;
2265 muse_camera_msg_send_longtime(api, sock_fd, pc->cb_info, ret);
2267 if (ret != CAMERA_ERROR_NONE) {
2268 LOGE("start preview failed 0x%x", ret);
2269 } else if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
2270 ret = _camera_start_evas_rendering(camera);
2273 LOGD("ret : 0x%x", ret);
2278 int camera_stop_preview(camera_h camera)
2280 int ret = CAMERA_ERROR_NONE;
2282 camera_cli_s *pc = NULL;
2283 muse_camera_api_e api = MUSE_CAMERA_API_STOP_PREVIEW;
2285 if (camera == NULL) {
2286 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2287 return CAMERA_ERROR_INVALID_PARAMETER;
2290 pc = (camera_cli_s *)camera;
2292 if (pc->cb_info == NULL) {
2293 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2294 return CAMERA_ERROR_INVALID_PARAMETER;
2297 sock_fd = pc->cb_info->fd;
2301 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
2302 camera_state_e current_state = CAMERA_STATE_NONE;
2304 ret = camera_get_state(camera, ¤t_state);
2305 if (ret != CAMERA_ERROR_NONE) {
2306 LOGE("failed to get current state 0x%x", ret);
2310 if (current_state == CAMERA_STATE_PREVIEW) {
2311 ret = _camera_stop_evas_rendering(camera, false);
2312 if (ret != CAMERA_ERROR_NONE)
2317 /* send stop preview message */
2318 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2320 LOGD("ret : 0x%x", ret);
2325 int camera_start_capture(camera_h camera, camera_capturing_cb capturing_cb, camera_capture_completed_cb completed_cb, void *user_data)
2327 if (camera == NULL) {
2328 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2329 return CAMERA_ERROR_INVALID_PARAMETER;
2331 int ret = CAMERA_ERROR_NONE;
2333 camera_cli_s *pc = (camera_cli_s *)camera;
2334 muse_camera_api_e api = MUSE_CAMERA_API_START_CAPTURE;
2336 int is_capturing_cb = 0;
2337 int is_completed_cb = 0;
2338 LOGD("Enter, handle :%x", pc->remote_handle);
2340 if (pc->cb_info == NULL) {
2341 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2342 return CAMERA_ERROR_INVALID_PARAMETER;
2345 sock_fd = pc->cb_info->fd;
2347 if (capturing_cb != NULL) {
2348 is_capturing_cb = 1;
2349 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = capturing_cb;
2350 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = user_data;
2353 if (completed_cb != NULL) {
2354 is_completed_cb = 1;
2355 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = completed_cb;
2356 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = user_data;
2359 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, is_capturing_cb, INT, is_completed_cb);
2360 LOGD("is_capturing_cb :%d, is_completed_cb : %d", is_capturing_cb, is_completed_cb);
2361 LOGD("ret : 0x%x", ret);
2365 bool camera_is_supported_continuous_capture(camera_h camera)
2367 if (camera == NULL) {
2368 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2372 int ret = CAMERA_ERROR_NONE;
2373 camera_cli_s *pc = (camera_cli_s *)camera;
2374 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_CONTINUOUS_CAPTURE;
2377 if (pc->cb_info == NULL) {
2378 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2379 return CAMERA_ERROR_INVALID_PARAMETER;
2382 sock_fd = pc->cb_info->fd;
2384 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2385 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2386 LOGD("ret : 0x%x", ret);
2390 int camera_start_continuous_capture(camera_h camera, int count, int interval, camera_capturing_cb capturing_cb, camera_capture_completed_cb completed_cb , void *user_data)
2392 if (camera == NULL) {
2393 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2394 return CAMERA_ERROR_INVALID_PARAMETER;
2397 int ret = CAMERA_ERROR_NONE;
2399 camera_cli_s *pc = (camera_cli_s *)camera;
2400 muse_camera_api_e api = MUSE_CAMERA_API_START_CONTINUOUS_CAPTURE;
2402 LOGD("Enter, handle :%x", pc->remote_handle);
2405 if (pc->cb_info == NULL) {
2406 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2407 return CAMERA_ERROR_INVALID_PARAMETER;
2409 sock_fd = pc->cb_info->fd;
2411 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = capturing_cb;
2412 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = user_data;
2413 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = completed_cb;
2415 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, count, INT, interval);
2417 LOGD("ret : 0x%x", ret);
2422 int camera_stop_continuous_capture(camera_h camera)
2424 if (camera == NULL) {
2425 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2426 return CAMERA_ERROR_INVALID_PARAMETER;
2430 int ret = CAMERA_ERROR_NONE;
2432 camera_cli_s *pc = (camera_cli_s *)camera;
2433 muse_camera_api_e api = MUSE_CAMERA_API_STOP_CONTINUOUS_CAPTURE;
2434 LOGD("Enter, handle :%x", pc->remote_handle);
2436 if (pc->cb_info == NULL) {
2437 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2438 return CAMERA_ERROR_INVALID_PARAMETER;
2440 sock_fd = pc->cb_info->fd;
2441 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2442 LOGD("ret : 0x%x", ret);
2446 bool camera_is_supported_face_detection(camera_h camera)
2448 if (camera == NULL) {
2449 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2452 int ret = CAMERA_ERROR_NONE;
2454 camera_cli_s *pc = (camera_cli_s *)camera;
2455 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_FACE_DETECTION;
2457 if (pc->cb_info == NULL) {
2458 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2459 return CAMERA_ERROR_INVALID_PARAMETER;
2461 sock_fd = pc->cb_info->fd;
2463 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2464 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2465 LOGD("ret : 0x%x", ret);
2469 bool camera_is_supported_zero_shutter_lag(camera_h camera)
2471 if (camera == NULL) {
2472 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2475 int ret = CAMERA_ERROR_NONE;
2477 camera_cli_s *pc = (camera_cli_s *)camera;
2478 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_ZERO_SHUTTER_LAG;
2480 if (pc->cb_info == NULL) {
2481 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2482 return CAMERA_ERROR_INVALID_PARAMETER;
2484 sock_fd = pc->cb_info->fd;
2486 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2487 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2488 LOGD("ret : 0x%x", ret);
2492 bool camera_is_supported_media_packet_preview_cb(camera_h camera)
2494 if (camera == NULL) {
2495 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2499 int ret = CAMERA_ERROR_NONE;
2501 camera_cli_s *pc = (camera_cli_s *)camera;
2502 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_MEDIA_PACKET_PREVIEW_CB;
2504 if (pc->cb_info == NULL) {
2505 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2506 return CAMERA_ERROR_INVALID_PARAMETER;
2508 sock_fd = pc->cb_info->fd;
2510 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2511 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2512 LOGD("ret : 0x%x", ret);
2516 int camera_get_device_count(camera_h camera, int *device_count)
2518 if (camera == NULL || device_count == NULL) {
2519 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2520 return CAMERA_ERROR_INVALID_PARAMETER;
2522 int ret = CAMERA_ERROR_NONE;
2524 camera_cli_s *pc = (camera_cli_s *)camera;
2525 muse_camera_api_e api = MUSE_CAMERA_API_GET_DEVICE_COUNT;
2527 if (pc->cb_info == NULL) {
2528 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2529 return CAMERA_ERROR_INVALID_PARAMETER;
2531 sock_fd = pc->cb_info->fd;
2532 int get_device_count;
2534 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2535 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2537 if (ret == CAMERA_ERROR_NONE) {
2538 muse_camera_msg_get(get_device_count, pc->cb_info->recv_msg);
2539 *device_count = get_device_count;
2541 LOGD("ret : 0x%x", ret);
2545 int camera_start_face_detection(camera_h camera, camera_face_detected_cb callback, void *user_data)
2547 if (camera == NULL) {
2548 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2549 return CAMERA_ERROR_INVALID_PARAMETER;
2552 int ret = CAMERA_ERROR_NONE;
2554 camera_cli_s *pc = (camera_cli_s *)camera;
2555 muse_camera_api_e api = MUSE_CAMERA_API_START_FACE_DETECTION;
2557 LOGD("Enter, handle :%x", pc->remote_handle);
2559 if (pc->cb_info == NULL) {
2560 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2561 return CAMERA_ERROR_INVALID_PARAMETER;
2563 sock_fd = pc->cb_info->fd;
2564 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION] = callback;
2565 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION] = user_data;
2567 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2568 LOGD("ret : 0x%x", ret);
2572 int camera_stop_face_detection(camera_h camera)
2574 if (camera == NULL) {
2575 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2576 return CAMERA_ERROR_INVALID_PARAMETER;
2579 int ret = CAMERA_ERROR_NONE;
2581 camera_cli_s *pc = (camera_cli_s *)camera;
2582 muse_camera_api_e api = MUSE_CAMERA_API_STOP_FACE_DETECTION;
2583 LOGD("Enter, handle :%x", pc->remote_handle);
2585 if (pc->cb_info == NULL) {
2586 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2587 return CAMERA_ERROR_INVALID_PARAMETER;
2589 sock_fd = pc->cb_info->fd;
2590 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2591 LOGD("ret : 0x%x", ret);
2595 int camera_get_state(camera_h camera, camera_state_e *state)
2597 if (camera == NULL || state == NULL) {
2598 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2599 return CAMERA_ERROR_INVALID_PARAMETER;
2601 int ret = CAMERA_ERROR_NONE;
2603 camera_cli_s *pc = (camera_cli_s *)camera;
2604 muse_camera_api_e api = MUSE_CAMERA_API_GET_STATE;
2606 if (pc->cb_info == NULL) {
2607 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2608 return CAMERA_ERROR_INVALID_PARAMETER;
2610 sock_fd = pc->cb_info->fd;
2613 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2614 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2616 if (ret == CAMERA_ERROR_NONE) {
2617 muse_camera_msg_get(get_state, pc->cb_info->recv_msg);
2618 *state = (camera_state_e)get_state;
2620 LOGD("ret : 0x%x", ret);
2624 int camera_start_focusing(camera_h camera, bool continuous)
2626 if (camera == NULL) {
2627 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2628 return CAMERA_ERROR_INVALID_PARAMETER;
2631 int ret = CAMERA_ERROR_NONE;
2633 camera_cli_s *pc = (camera_cli_s *)camera;
2634 muse_camera_api_e api = MUSE_CAMERA_API_START_FOCUSING;
2636 if (pc->cb_info == NULL) {
2637 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2638 return CAMERA_ERROR_INVALID_PARAMETER;
2640 sock_fd = pc->cb_info->fd;
2641 int is_continuous = (int)continuous;
2643 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2644 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, is_continuous);
2645 LOGD("ret : 0x%x", ret);
2649 int camera_cancel_focusing(camera_h camera)
2651 if (camera == NULL) {
2652 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2653 return CAMERA_ERROR_INVALID_PARAMETER;
2656 int ret = CAMERA_ERROR_NONE;
2658 camera_cli_s *pc = (camera_cli_s *)camera;
2659 muse_camera_api_e api = MUSE_CAMERA_API_CANCEL_FOCUSING;
2661 if (pc->cb_info == NULL) {
2662 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2663 return CAMERA_ERROR_INVALID_PARAMETER;
2665 sock_fd = pc->cb_info->fd;
2667 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2668 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2669 LOGD("ret : 0x%x", ret);
2673 int camera_set_display(camera_h camera, camera_display_type_e type, camera_display_h display)
2675 int ret = CAMERA_ERROR_NONE;
2676 void *set_display_handle = NULL;
2677 Evas_Object *obj = NULL;
2678 const char *object_type = NULL;
2680 camera_wl_info_s *wl_info = NULL;
2681 #endif /* HAVE_WAYLAND */
2682 camera_cli_s *pc = (camera_cli_s *)camera;
2683 camera_cb_info_s *cb_info = NULL;
2684 muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY;
2685 camera_state_e current_state = CAMERA_STATE_NONE;
2688 if (camera == NULL) {
2689 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2690 return CAMERA_ERROR_INVALID_PARAMETER;
2693 if (type < CAMERA_DISPLAY_TYPE_OVERLAY || type > CAMERA_DISPLAY_TYPE_NONE) {
2694 LOGE("invalid type %d", type);
2695 return CAMERA_ERROR_INVALID_PARAMETER;
2698 if (type != CAMERA_DISPLAY_TYPE_NONE && display == NULL) {
2699 LOGE("display type[%d] is not NONE, but display handle is NULL", type);
2700 return CAMERA_ERROR_INVALID_PARAMETER;
2703 if (pc->cb_info == NULL) {
2704 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2705 return CAMERA_ERROR_INVALID_PARAMETER;
2708 cb_info = (camera_cb_info_s *)pc->cb_info;
2709 sock_fd = cb_info->fd;
2711 ret = camera_get_state(camera, ¤t_state);
2712 if (ret != CAMERA_ERROR_NONE) {
2713 LOGE("failed to get current state 0x%x", ret);
2717 if (current_state != CAMERA_STATE_CREATED) {
2718 LOGE("INVALID_STATE : current %d", current_state);
2719 return CAMERA_ERROR_INVALID_STATE;
2722 LOGD("Enter, remote_handle : %x display : 0x%x", pc->remote_handle, display);
2724 if (type == CAMERA_DISPLAY_TYPE_NONE) {
2725 set_display_handle = 0;
2726 LOGD("display type NONE");
2728 obj = (Evas_Object *)display;
2729 object_type = evas_object_type_get(obj);
2731 if (type == CAMERA_DISPLAY_TYPE_OVERLAY && !strcmp(object_type, "elm_win")) {
2733 /* get wayland parent id */
2734 if (_get_wl_info(obj, &pc->wl_info) != CAMERA_ERROR_NONE) {
2735 LOGE("failed to get wayland info");
2736 return CAMERA_ERROR_INVALID_OPERATION;
2739 set_display_handle = (void *)&pc->wl_info;
2740 #else /* HAVE_WAYLAND */
2741 /* x window overlay surface */
2742 set_display_handle = (void *)elm_win_xwindow_get(obj);
2743 #endif /* HAVE_WAYLAND */
2744 LOGD("display type OVERLAY : handle %p", set_display_handle);
2745 } else if (type == CAMERA_DISPLAY_TYPE_EVAS && !strcmp(object_type, "image")) {
2746 /* evas object surface */
2747 set_display_handle = (void *)display;
2748 LOGD("display type EVAS : handle %p", set_display_handle);
2750 #ifdef EVAS_RENDERER_SUPPORT
2751 g_mutex_lock(&cb_info->evas_mutex);
2753 if (cb_info->evas_info) {
2754 LOGW("destroy existed evas renderer %p", cb_info->evas_info);
2755 ret = mm_evas_renderer_destroy(&cb_info->evas_info);
2756 if (ret != MM_ERROR_NONE) {
2757 LOGE("failed to destroy evas renderer %p", cb_info->evas_info);
2758 g_mutex_unlock(&cb_info->evas_mutex);
2759 return CAMERA_ERROR_INVALID_OPERATION;
2763 /* create evas renderer */
2764 ret = mm_evas_renderer_create(&cb_info->evas_info, (Evas_Object *)set_display_handle);
2765 if (ret == MM_ERROR_NONE) {
2766 camera_flip_e flip = CAMERA_FLIP_NONE;
2767 camera_display_mode_e mode = CAMERA_DISPLAY_MODE_LETTER_BOX;
2768 camera_rotation_e rotation = CAMERA_ROTATION_NONE;
2775 camera_get_display_flip(camera, &flip);
2776 camera_get_display_mode(camera, &mode);
2777 camera_get_display_rotation(camera, &rotation);
2778 camera_is_display_visible(camera, &visible);
2779 camera_attr_get_display_roi_area(camera, &x, &y, &width, &height);
2781 LOGD("current setting : flip %d, mode %d, rotation %d, visible %d, roi %d,%d,%dx%d",
2782 flip, mode, rotation, visible, x, y, width, height);
2784 ret = mm_evas_renderer_set_flip(cb_info->evas_info, flip);
2785 ret |= mm_evas_renderer_set_geometry(cb_info->evas_info, mode);
2786 ret |= mm_evas_renderer_set_rotation(cb_info->evas_info, rotation);
2787 ret |= mm_evas_renderer_set_visible(cb_info->evas_info, visible);
2788 ret |= mm_evas_renderer_set_roi_area(cb_info->evas_info, x, y, width, height);
2791 g_mutex_unlock(&cb_info->evas_mutex);
2793 if (ret != MM_ERROR_NONE) {
2794 LOGE("mm_evas_renderer error 0x%x", ret);
2795 return CAMERA_ERROR_INVALID_OPERATION;
2797 #else /* EVAS_RENDERER_SUPPORT */
2798 LOGE("EVAS surface is not supported");
2799 return CAMERA_ERROR_NOT_SUPPORTED;
2800 #endif /* EVAS_RENDERER_SUPPORT */
2802 LOGE("unknown evas object [%p,%s] or type [%d] mismatch", obj, object_type, type);
2803 return CAMERA_ERROR_INVALID_PARAMETER;
2806 LOGE("failed to get evas object type from %p", obj);
2807 return CAMERA_ERROR_INVALID_PARAMETER;
2811 pc->display_handle = (intptr_t)set_display_handle;
2813 if (type == CAMERA_DISPLAY_TYPE_OVERLAY) {
2815 wl_info = &pc->wl_info;
2816 muse_camera_msg_send_array_and_value(api, sock_fd, cb_info, ret,
2817 wl_info, 5, sizeof(int), INT, type);
2819 LOGD("wayland parent id : %d, window %d,%d,%dx%d",
2820 wl_info->parent_id, wl_info->window_x, wl_info->window_y,
2821 wl_info->window_width, wl_info->window_height);
2822 #else /* HAVE_WAYLAND */
2823 muse_camera_msg_send2(api, sock_fd, cb_info, ret, INT, type, INT, set_display_handle);
2825 LOGD("x id : %d", (int)set_display_handle);
2826 #endif /* HAVE_WAYLAND */
2828 muse_camera_msg_send1(api, sock_fd, cb_info, ret, INT, type);
2830 if (ret != CAMERA_ERROR_NONE)
2831 LOGE("set display error 0x%x", ret);
2832 else if (type == CAMERA_DISPLAY_TYPE_EVAS)
2833 SET_PREVIEW_CB_TYPE(cb_info, PREVIEW_CB_TYPE_EVAS);
2838 int camera_set_preview_resolution(camera_h camera, int width, int height)
2840 if (camera == NULL) {
2841 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2842 return CAMERA_ERROR_INVALID_PARAMETER;
2844 int ret = CAMERA_ERROR_NONE;
2846 camera_cli_s *pc = (camera_cli_s *)camera;
2847 muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_RESOLUTION;
2849 if (pc->cb_info == NULL) {
2850 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2851 return CAMERA_ERROR_INVALID_PARAMETER;
2853 sock_fd = pc->cb_info->fd;
2855 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2856 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, width, INT, height);
2857 LOGD("ret : 0x%x", ret);
2862 int camera_set_capture_resolution(camera_h camera, int width, int height)
2864 if (camera == NULL) {
2865 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2866 return CAMERA_ERROR_INVALID_PARAMETER;
2869 int ret = CAMERA_ERROR_NONE;
2871 camera_cli_s *pc = (camera_cli_s *)camera;
2872 muse_camera_api_e api = MUSE_CAMERA_API_SET_CAPTURE_RESOLUTION;
2874 if (pc->cb_info == NULL) {
2875 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2876 return CAMERA_ERROR_INVALID_PARAMETER;
2878 sock_fd = pc->cb_info->fd;
2880 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2881 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, width, INT, height);
2882 LOGD("ret : 0x%x", ret);
2886 int camera_set_capture_format(camera_h camera, camera_pixel_format_e format)
2888 if (camera == NULL) {
2889 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2890 return CAMERA_ERROR_INVALID_PARAMETER;
2893 int ret = CAMERA_ERROR_NONE;
2894 int set_format = (int)format;
2896 camera_cli_s *pc = (camera_cli_s *)camera;
2897 muse_camera_api_e api = MUSE_CAMERA_API_SET_CAPTURE_FORMAT;
2899 if (pc->cb_info == NULL) {
2900 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2901 return CAMERA_ERROR_INVALID_PARAMETER;
2903 sock_fd = pc->cb_info->fd;
2905 LOGD("Enter, remote_handle : %x, capture_format: %d", pc->remote_handle, set_format);
2906 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_format);
2907 LOGD("ret : 0x%x", ret);
2911 int camera_set_preview_format(camera_h camera, camera_pixel_format_e format)
2913 if (camera == NULL) {
2914 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2915 return CAMERA_ERROR_INVALID_PARAMETER;
2918 int ret = CAMERA_ERROR_NONE;
2919 int set_format = (int)format;
2921 camera_cli_s *pc = (camera_cli_s *)camera;
2922 muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_FORMAT;
2924 if (pc->cb_info == NULL) {
2925 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2926 return CAMERA_ERROR_INVALID_PARAMETER;
2928 sock_fd = pc->cb_info->fd;
2930 LOGD("Enter, remote_handle : %x, capture_format: %d", pc->remote_handle, set_format);
2931 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_format);
2932 LOGD("ret : 0x%x", ret);
2936 int camera_get_preview_resolution(camera_h camera, int *width, int *height)
2938 if (camera == NULL || width == NULL || height == NULL) {
2939 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2940 return CAMERA_ERROR_INVALID_PARAMETER;
2944 int ret = CAMERA_ERROR_NONE;
2946 camera_cli_s *pc = (camera_cli_s *)camera;
2947 muse_camera_api_e api = MUSE_CAMERA_API_GET_PREVIEW_RESOLUTION;
2949 if (pc->cb_info == NULL) {
2950 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2951 return CAMERA_ERROR_INVALID_PARAMETER;
2953 sock_fd = pc->cb_info->fd;
2957 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2958 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2960 if (ret == CAMERA_ERROR_NONE) {
2961 muse_camera_msg_get(get_width, pc->cb_info->recv_msg);
2962 muse_camera_msg_get(get_height, pc->cb_info->recv_msg);
2964 *height = get_height;
2966 LOGD("ret : 0x%x", ret);
2970 int camera_set_display_rotation(camera_h camera, camera_rotation_e rotation)
2972 int ret = CAMERA_ERROR_NONE;
2973 int set_rotation = (int)rotation;
2974 camera_cli_s *pc = NULL;
2976 if (camera == NULL) {
2977 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2978 return CAMERA_ERROR_INVALID_PARAMETER;
2981 if (rotation < CAMERA_ROTATION_NONE || rotation > CAMERA_ROTATION_270) {
2982 LOGE("Invalid rotation %d", rotation);
2983 return CAMERA_ERROR_INVALID_PARAMETER;
2986 pc = (camera_cli_s *)camera;
2988 if (pc->cb_info == NULL) {
2989 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2990 return CAMERA_ERROR_INVALID_PARAMETER;
2993 #ifdef EVAS_RENDERER_SUPPORT
2994 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
2995 g_mutex_lock(&pc->cb_info->evas_mutex);
2997 ret = mm_evas_renderer_set_rotation(pc->cb_info->evas_info, rotation);
2999 g_mutex_unlock(&pc->cb_info->evas_mutex);
3001 if (ret != MM_ERROR_NONE) {
3002 LOGE("failed to set rotation for evas surface 0x%x", ret);
3003 return CAMERA_ERROR_INVALID_OPERATION;
3006 #endif /* EVAS_RENDERER_SUPPORT */
3008 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_ROTATION,
3009 pc->cb_info->fd, pc->cb_info, ret, INT, set_rotation);
3014 int camera_get_display_rotation(camera_h camera, camera_rotation_e *rotation)
3016 int ret = CAMERA_ERROR_NONE;
3017 int get_rotation = CAMERA_ROTATION_NONE;
3018 camera_cli_s *pc = NULL;
3020 if (camera == NULL || rotation == NULL) {
3021 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3022 return CAMERA_ERROR_INVALID_PARAMETER;
3025 pc = (camera_cli_s *)camera;
3027 if (pc->cb_info == NULL) {
3028 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3029 return CAMERA_ERROR_INVALID_PARAMETER;
3032 muse_camera_msg_send(MUSE_CAMERA_API_GET_DISPLAY_ROTATION,
3033 pc->cb_info->fd, pc->cb_info, ret);
3035 if (ret == CAMERA_ERROR_NONE) {
3036 muse_camera_msg_get(get_rotation, pc->cb_info->recv_msg);
3037 *rotation = (camera_rotation_e)get_rotation;
3043 int camera_set_display_flip(camera_h camera, camera_flip_e flip)
3045 int ret = CAMERA_ERROR_NONE;
3046 int set_flip = (int)flip;
3047 camera_cli_s *pc = NULL;
3049 if (camera == NULL) {
3050 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3051 return CAMERA_ERROR_INVALID_PARAMETER;
3054 if (flip < CAMERA_FLIP_NONE || flip > CAMERA_FLIP_BOTH) {
3055 LOGE("Invalid flip %d", flip);
3056 return CAMERA_ERROR_INVALID_PARAMETER;
3059 pc = (camera_cli_s *)camera;
3061 if (pc->cb_info == NULL) {
3062 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3063 return CAMERA_ERROR_INVALID_PARAMETER;
3066 #ifdef EVAS_RENDERER_SUPPORT
3067 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
3068 g_mutex_lock(&pc->cb_info->evas_mutex);
3070 ret = mm_evas_renderer_set_flip(pc->cb_info->evas_info, flip);
3072 g_mutex_unlock(&pc->cb_info->evas_mutex);
3074 if (ret != MM_ERROR_NONE) {
3075 LOGE("failed to set flip for evas surface 0x%x", ret);
3076 return CAMERA_ERROR_INVALID_OPERATION;
3079 #endif /* EVAS_RENDERER_SUPPORT */
3081 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_FLIP,
3082 pc->cb_info->fd, pc->cb_info, ret, INT, set_flip);
3087 int camera_get_display_flip(camera_h camera, camera_flip_e *flip)
3089 int ret = CAMERA_ERROR_NONE;
3090 int get_flip = CAMERA_FLIP_NONE;
3091 camera_cli_s *pc = NULL;
3093 if (camera == NULL || flip == NULL) {
3094 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3095 return CAMERA_ERROR_INVALID_PARAMETER;
3098 pc = (camera_cli_s *)camera;
3100 if (pc->cb_info == NULL) {
3101 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3102 return CAMERA_ERROR_INVALID_PARAMETER;
3105 muse_camera_msg_send(MUSE_CAMERA_API_GET_DISPLAY_FLIP,
3106 pc->cb_info->fd, pc->cb_info, ret);
3108 if (ret == CAMERA_ERROR_NONE) {
3109 muse_camera_msg_get(get_flip, pc->cb_info->recv_msg);
3110 *flip = (camera_flip_e)get_flip;
3116 int camera_set_display_visible(camera_h camera, bool visible)
3118 int ret = CAMERA_ERROR_NONE;
3119 int set_visible = (int)visible;
3120 camera_cli_s *pc = NULL;
3122 if (camera == NULL) {
3123 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3124 return CAMERA_ERROR_INVALID_PARAMETER;
3127 pc = (camera_cli_s *)camera;
3129 if (pc->cb_info == NULL) {
3130 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3131 return CAMERA_ERROR_INVALID_PARAMETER;
3134 #ifdef EVAS_RENDERER_SUPPORT
3135 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
3136 g_mutex_lock(&pc->cb_info->evas_mutex);
3138 ret = mm_evas_renderer_set_visible(pc->cb_info->evas_info, visible);
3140 g_mutex_unlock(&pc->cb_info->evas_mutex);
3142 if (ret != MM_ERROR_NONE) {
3143 LOGE("failed to set visible for evas surface 0x%x", ret);
3144 return CAMERA_ERROR_INVALID_OPERATION;
3147 #endif /* EVAS_RENDERER_SUPPORT */
3149 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_VISIBLE,
3150 pc->cb_info->fd, pc->cb_info, ret, INT, set_visible);
3155 int camera_is_display_visible(camera_h camera, bool *visible)
3157 int ret = CAMERA_ERROR_NONE;
3158 int get_visible = true;
3159 camera_cli_s *pc = NULL;
3161 if (camera == NULL || visible == NULL) {
3162 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3163 return CAMERA_ERROR_INVALID_PARAMETER;
3166 pc = (camera_cli_s *)camera;
3168 if (pc->cb_info == NULL) {
3169 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3170 return CAMERA_ERROR_INVALID_PARAMETER;
3173 muse_camera_msg_send(MUSE_CAMERA_API_IS_DISPLAY_VISIBLE,
3174 pc->cb_info->fd, pc->cb_info, ret);
3176 if (ret == CAMERA_ERROR_NONE) {
3177 muse_camera_msg_get(get_visible, pc->cb_info->recv_msg);
3178 *visible = (bool)get_visible;
3184 int camera_set_display_mode(camera_h camera, camera_display_mode_e mode)
3186 int ret = CAMERA_ERROR_NONE;
3187 int set_mode = (int)mode;
3188 camera_cli_s *pc = NULL;
3190 if (camera == NULL) {
3191 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3192 return CAMERA_ERROR_INVALID_PARAMETER;
3195 if (mode < CAMERA_DISPLAY_MODE_LETTER_BOX || mode > CAMERA_DISPLAY_MODE_CUSTOM_ROI) {
3196 LOGE("Invalid mode %d", mode);
3197 return CAMERA_ERROR_INVALID_PARAMETER;
3200 pc = (camera_cli_s *)camera;
3202 if (pc->cb_info == NULL) {
3203 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3204 return CAMERA_ERROR_INVALID_PARAMETER;
3207 #ifdef EVAS_RENDERER_SUPPORT
3208 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
3209 g_mutex_lock(&pc->cb_info->evas_mutex);
3211 ret = mm_evas_renderer_set_geometry(pc->cb_info->evas_info, mode);
3213 g_mutex_unlock(&pc->cb_info->evas_mutex);
3215 if (ret != MM_ERROR_NONE) {
3216 LOGE("failed to set geometry for evas surface 0x%x", ret);
3217 return CAMERA_ERROR_INVALID_OPERATION;
3220 #endif /* EVAS_RENDERER_SUPPORT */
3222 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_MODE,
3223 pc->cb_info->fd, pc->cb_info, ret, INT, set_mode);
3228 int camera_get_display_mode(camera_h camera, camera_display_mode_e *mode)
3230 int ret = CAMERA_ERROR_NONE;
3231 int get_mode = CAMERA_DISPLAY_MODE_LETTER_BOX;
3232 camera_cli_s *pc = NULL;
3234 if (camera == NULL || mode == NULL) {
3235 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3236 return CAMERA_ERROR_INVALID_PARAMETER;
3239 pc = (camera_cli_s *)camera;
3241 if (pc->cb_info == NULL) {
3242 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3243 return CAMERA_ERROR_INVALID_PARAMETER;
3246 muse_camera_msg_send(MUSE_CAMERA_API_GET_DISPLAY_MODE,
3247 pc->cb_info->fd, pc->cb_info, ret);
3249 if (ret == CAMERA_ERROR_NONE) {
3250 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
3251 *mode = (camera_display_mode_e)get_mode;
3257 int camera_get_capture_resolution(camera_h camera, int *width, int *height)
3259 if (camera == NULL || width == NULL || height == NULL) {
3260 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3261 return CAMERA_ERROR_INVALID_PARAMETER;
3263 int ret = CAMERA_ERROR_NONE;
3265 camera_cli_s *pc = (camera_cli_s *)camera;
3266 muse_camera_api_e api = MUSE_CAMERA_API_GET_CAPTURE_RESOLUTION;
3268 if (pc->cb_info == NULL) {
3269 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3270 return CAMERA_ERROR_INVALID_PARAMETER;
3272 sock_fd = pc->cb_info->fd;
3276 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3277 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3279 if (ret == CAMERA_ERROR_NONE) {
3280 muse_camera_msg_get(get_width, pc->cb_info->recv_msg);
3281 muse_camera_msg_get(get_height, pc->cb_info->recv_msg);
3283 *height = get_height;
3285 LOGD("ret : 0x%x", ret);
3289 int camera_get_capture_format(camera_h camera, camera_pixel_format_e *format)
3291 if (camera == NULL || format == NULL) {
3292 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3293 return CAMERA_ERROR_INVALID_PARAMETER;
3295 int ret = CAMERA_ERROR_NONE;
3297 camera_cli_s *pc = (camera_cli_s *)camera;
3298 muse_camera_api_e api = MUSE_CAMERA_API_GET_CAPTURE_FORMAT;
3301 if (pc->cb_info == NULL) {
3302 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3303 return CAMERA_ERROR_INVALID_PARAMETER;
3305 sock_fd = pc->cb_info->fd;
3307 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3308 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3310 if (ret == CAMERA_ERROR_NONE) {
3311 muse_camera_msg_get(get_format, pc->cb_info->recv_msg);
3312 *format = (camera_pixel_format_e)get_format;
3314 LOGD("ret : 0x%x", ret);
3318 int camera_get_preview_format(camera_h camera, camera_pixel_format_e *format)
3320 if (camera == NULL || format == NULL) {
3321 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3322 return CAMERA_ERROR_INVALID_PARAMETER;
3325 int ret = CAMERA_ERROR_NONE;
3327 camera_cli_s *pc = (camera_cli_s *)camera;
3328 muse_camera_api_e api = MUSE_CAMERA_API_GET_PREVIEW_FORMAT;
3331 if (pc->cb_info == NULL) {
3332 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3333 return CAMERA_ERROR_INVALID_PARAMETER;
3335 sock_fd = pc->cb_info->fd;
3337 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3338 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3340 if (ret == CAMERA_ERROR_NONE) {
3341 muse_camera_msg_get(get_format, pc->cb_info->recv_msg);
3342 *format = (camera_pixel_format_e)get_format;
3344 LOGD("ret : 0x%x", ret);
3348 int camera_get_facing_direction(camera_h camera, camera_facing_direction_e *facing_direciton)
3350 if (camera == NULL || facing_direciton == NULL) {
3351 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3352 return CAMERA_ERROR_INVALID_PARAMETER;
3355 int ret = CAMERA_ERROR_NONE;
3357 camera_cli_s *pc = (camera_cli_s *)camera;
3358 muse_camera_api_e api = MUSE_CAMERA_API_GET_FACING_DIRECTION;
3360 if (pc->cb_info == NULL) {
3361 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3362 return CAMERA_ERROR_INVALID_PARAMETER;
3364 sock_fd = pc->cb_info->fd;
3365 int get_facing_direction;
3367 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3368 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3370 if (ret == CAMERA_ERROR_NONE) {
3371 muse_camera_msg_get(get_facing_direction, pc->cb_info->recv_msg);
3372 *facing_direciton = (camera_facing_direction_e)get_facing_direction;
3374 LOGD("ret : 0x%x", ret);
3378 int camera_set_preview_cb(camera_h camera, camera_preview_cb callback, void *user_data)
3380 if (camera == NULL || callback == NULL) {
3381 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3382 return CAMERA_ERROR_INVALID_PARAMETER;
3384 int ret = CAMERA_ERROR_NONE;
3386 camera_cli_s *pc = (camera_cli_s *)camera;
3387 camera_cb_info_s *cb_info = (camera_cb_info_s *)pc->cb_info;
3389 if (pc->cb_info == NULL) {
3390 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3391 return CAMERA_ERROR_INVALID_PARAMETER;
3393 sock_fd = pc->cb_info->fd;
3394 muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_CB;
3396 LOGD("Enter, handle :%x", pc->remote_handle);
3398 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = callback;
3399 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = user_data;
3400 SET_PREVIEW_CB_TYPE(cb_info, PREVIEW_CB_TYPE_USER);
3402 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3403 LOGD("ret : 0x%x", ret);
3407 int camera_unset_preview_cb(camera_h camera)
3409 if (camera == NULL) {
3410 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3411 return CAMERA_ERROR_INVALID_PARAMETER;
3414 int ret = CAMERA_ERROR_NONE;
3416 camera_cli_s *pc = (camera_cli_s *)camera;
3417 camera_cb_info_s *cb_info = (camera_cb_info_s *)pc->cb_info;
3418 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_PREVIEW_CB;
3420 LOGD("Enter, handle :%x", pc->remote_handle);
3423 if (pc->cb_info == NULL) {
3424 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3425 return CAMERA_ERROR_INVALID_PARAMETER;
3427 sock_fd = pc->cb_info->fd;
3428 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = (void *)NULL;
3429 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = (void *)NULL;
3430 UNSET_PREVIEW_CB_TYPE(cb_info, PREVIEW_CB_TYPE_USER);
3432 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3433 LOGD("ret : 0x%x", ret);
3437 int camera_set_media_packet_preview_cb(camera_h camera, camera_media_packet_preview_cb callback, void *user_data)
3439 if (camera == NULL) {
3440 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
3441 return CAMERA_ERROR_INVALID_PARAMETER;
3444 if (camera_is_supported_media_packet_preview_cb(camera) == false) {
3445 LOGE("NOT SUPPORTED");
3446 return CAMERA_ERROR_NOT_SUPPORTED;
3449 if (callback == NULL) {
3450 LOGE("INVALID_PARAMETER(0x%08x) - callback", CAMERA_ERROR_INVALID_PARAMETER);
3451 return CAMERA_ERROR_INVALID_PARAMETER;
3454 int ret = CAMERA_ERROR_NONE;
3456 camera_cli_s *pc = (camera_cli_s *)camera;
3457 muse_camera_api_e api = MUSE_CAMERA_API_SET_MEDIA_PACKET_PREVIEW_CB;
3459 LOGD("Enter, handle :%x", pc->remote_handle);
3462 if (pc->cb_info == NULL) {
3463 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3464 return CAMERA_ERROR_INVALID_PARAMETER;
3466 sock_fd = pc->cb_info->fd;
3467 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = callback;
3468 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = user_data;
3470 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3471 LOGD("ret : 0x%x", ret);
3475 int camera_unset_media_packet_preview_cb(camera_h camera)
3477 if (camera == NULL) {
3478 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3479 return CAMERA_ERROR_INVALID_PARAMETER;
3482 int ret = CAMERA_ERROR_NONE;
3484 camera_cli_s *pc = (camera_cli_s *)camera;
3485 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_MEDIA_PACKET_PREVIEW_CB;
3487 LOGD("Enter, handle :%x", pc->remote_handle);
3490 if (pc->cb_info == NULL) {
3491 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3492 return CAMERA_ERROR_INVALID_PARAMETER;
3494 sock_fd = pc->cb_info->fd;
3495 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = (void *)NULL;
3496 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = (void *)NULL;
3498 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3499 LOGD("ret : 0x%x", ret);
3503 int camera_set_state_changed_cb(camera_h camera, camera_state_changed_cb callback, void *user_data)
3505 if (camera == NULL || callback == NULL) {
3506 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3507 return CAMERA_ERROR_INVALID_PARAMETER;
3509 int ret = CAMERA_ERROR_NONE;
3511 camera_cli_s *pc = (camera_cli_s *)camera;
3512 muse_camera_api_e api = MUSE_CAMERA_API_SET_STATE_CHANGED_CB;
3514 LOGD("Enter, handle :%x", pc->remote_handle);
3517 if (pc->cb_info == NULL) {
3518 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3519 return CAMERA_ERROR_INVALID_PARAMETER;
3521 sock_fd = pc->cb_info->fd;
3522 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = callback;
3523 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = user_data;
3525 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3526 LOGD("ret : 0x%x", ret);
3529 int camera_unset_state_changed_cb(camera_h camera)
3531 if (camera == NULL) {
3532 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3533 return CAMERA_ERROR_INVALID_PARAMETER;
3535 int ret = CAMERA_ERROR_NONE;
3537 camera_cli_s *pc = (camera_cli_s *)camera;
3538 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_STATE_CHANGED_CB;
3540 LOGD("Enter, handle :%x", pc->remote_handle);
3543 if (pc->cb_info == NULL) {
3544 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3545 return CAMERA_ERROR_INVALID_PARAMETER;
3547 sock_fd = pc->cb_info->fd;
3548 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = (void *)NULL;
3549 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = (void *)NULL;
3551 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3552 LOGD("ret : 0x%x", ret);
3556 int camera_set_interrupted_cb(camera_h camera, camera_interrupted_cb callback, void *user_data)
3558 if (camera == NULL || callback == NULL) {
3559 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3560 return CAMERA_ERROR_INVALID_PARAMETER;
3562 int ret = CAMERA_ERROR_NONE;
3564 camera_cli_s *pc = (camera_cli_s *)camera;
3565 muse_camera_api_e api = MUSE_CAMERA_API_SET_INTERRUPTED_CB;
3567 LOGD("Enter, handle :%x", pc->remote_handle);
3570 if (pc->cb_info == NULL) {
3571 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3572 return CAMERA_ERROR_INVALID_PARAMETER;
3574 sock_fd = pc->cb_info->fd;
3575 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = callback;
3576 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = user_data;
3578 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3579 LOGD("ret : 0x%x", ret);
3583 int camera_unset_interrupted_cb(camera_h camera)
3585 if (camera == NULL) {
3586 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3587 return CAMERA_ERROR_INVALID_PARAMETER;
3589 int ret = CAMERA_ERROR_NONE;
3591 camera_cli_s *pc = (camera_cli_s *)camera;
3592 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_INTERRUPTED_CB;
3594 LOGD("Enter, handle :%x", pc->remote_handle);
3597 if (pc->cb_info == NULL) {
3598 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3599 return CAMERA_ERROR_INVALID_PARAMETER;
3601 sock_fd = pc->cb_info->fd;
3602 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = (void *)NULL;
3603 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = (void *)NULL;
3605 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3606 LOGD("ret : 0x%x", ret);
3610 int camera_set_focus_changed_cb(camera_h camera, camera_focus_changed_cb callback, void *user_data)
3612 if (camera == NULL || callback == NULL) {
3613 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3614 return CAMERA_ERROR_INVALID_PARAMETER;
3616 int ret = CAMERA_ERROR_NONE;
3618 camera_cli_s *pc = (camera_cli_s *)camera;
3619 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOCUS_CHANGED_CB;
3621 LOGD("Enter, handle :%x", pc->remote_handle);
3624 if (pc->cb_info == NULL) {
3625 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3626 return CAMERA_ERROR_INVALID_PARAMETER;
3628 sock_fd = pc->cb_info->fd;
3629 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = callback;
3630 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = user_data;
3632 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3633 LOGD("ret : 0x%x", ret);
3637 int camera_unset_focus_changed_cb(camera_h camera)
3639 if (camera == NULL) {
3640 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3641 return CAMERA_ERROR_INVALID_PARAMETER;
3643 int ret = CAMERA_ERROR_NONE;
3645 camera_cli_s *pc = (camera_cli_s *)camera;
3646 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_FOCUS_CHANGED_CB;
3648 LOGD("Enter, handle :%x", pc->remote_handle);
3651 if (pc->cb_info == NULL) {
3652 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3653 return CAMERA_ERROR_INVALID_PARAMETER;
3655 sock_fd = pc->cb_info->fd;
3656 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = (void *)NULL;
3657 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = (void *)NULL;
3659 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3660 LOGD("ret : 0x%x", ret);
3664 int camera_set_error_cb(camera_h camera, camera_error_cb callback, void *user_data)
3666 if (camera == NULL || callback == NULL) {
3667 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3668 return CAMERA_ERROR_INVALID_PARAMETER;
3670 int ret = CAMERA_ERROR_NONE;
3672 camera_cli_s *pc = (camera_cli_s *)camera;
3673 muse_camera_api_e api = MUSE_CAMERA_API_SET_ERROR_CB;
3675 LOGD("Enter, handle :%x", pc->remote_handle);
3678 if (pc->cb_info == NULL) {
3679 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3680 return CAMERA_ERROR_INVALID_PARAMETER;
3682 sock_fd = pc->cb_info->fd;
3683 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_ERROR] = callback;
3684 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_ERROR] = user_data;
3686 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3687 LOGD("ret : 0x%x", ret);
3691 int camera_unset_error_cb(camera_h camera)
3693 if (camera == NULL) {
3694 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3695 return CAMERA_ERROR_INVALID_PARAMETER;
3697 int ret = CAMERA_ERROR_NONE;
3699 camera_cli_s *pc = (camera_cli_s *)camera;
3700 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_ERROR_CB;
3702 LOGD("Enter, handle :%x", pc->remote_handle);
3705 if (pc->cb_info == NULL) {
3706 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3707 return CAMERA_ERROR_INVALID_PARAMETER;
3709 sock_fd = pc->cb_info->fd;
3710 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_ERROR] = (void *)NULL;
3711 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_ERROR] = (void *)NULL;
3713 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3714 LOGD("ret : 0x%x", ret);
3718 int camera_foreach_supported_preview_resolution(camera_h camera, camera_supported_preview_resolution_cb foreach_cb , void *user_data)
3720 if (camera == NULL || foreach_cb == NULL) {
3721 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3722 return CAMERA_ERROR_INVALID_PARAMETER;
3724 int ret = CAMERA_ERROR_NONE;
3726 camera_cli_s *pc = (camera_cli_s *)camera;
3727 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_PREVIEW_RESOLUTION;
3729 LOGD("Enter, handle :%x", pc->remote_handle);
3732 if (pc->cb_info == NULL) {
3733 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3734 return CAMERA_ERROR_INVALID_PARAMETER;
3736 sock_fd = pc->cb_info->fd;
3737 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_RESOLUTION] = foreach_cb;
3738 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_RESOLUTION] = user_data;
3740 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3741 LOGD("ret : 0x%x", ret);
3745 int camera_foreach_supported_capture_resolution(camera_h camera, camera_supported_capture_resolution_cb foreach_cb , void *user_data)
3747 if (camera == NULL || foreach_cb == NULL) {
3748 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3749 return CAMERA_ERROR_INVALID_PARAMETER;
3751 int ret = CAMERA_ERROR_NONE;
3753 camera_cli_s *pc = (camera_cli_s *)camera;
3754 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_CAPTURE_RESOLUTION;
3756 LOGD("Enter, handle :%x", pc->remote_handle);
3759 if (pc->cb_info == NULL) {
3760 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3761 return CAMERA_ERROR_INVALID_PARAMETER;
3763 sock_fd = pc->cb_info->fd;
3764 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_RESOLUTION] = foreach_cb;
3765 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_RESOLUTION] = user_data;
3767 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3768 LOGD("ret : 0x%x", ret);
3772 int camera_foreach_supported_capture_format(camera_h camera, camera_supported_capture_format_cb foreach_cb , void *user_data)
3774 if (camera == NULL || foreach_cb == NULL) {
3775 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3776 return CAMERA_ERROR_INVALID_PARAMETER;
3778 int ret = CAMERA_ERROR_NONE;
3780 camera_cli_s *pc = (camera_cli_s *)camera;
3781 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_CAPTURE_FORMAT;
3783 LOGD("Enter, handle :%x", pc->remote_handle);
3786 if (pc->cb_info == NULL) {
3787 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3788 return CAMERA_ERROR_INVALID_PARAMETER;
3790 sock_fd = pc->cb_info->fd;
3791 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_FORMAT] = foreach_cb;
3792 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_FORMAT] = user_data;
3794 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3795 LOGD("ret : 0x%x", ret);
3800 int camera_foreach_supported_preview_format(camera_h camera, camera_supported_preview_format_cb foreach_cb , void *user_data)
3802 if (camera == NULL || foreach_cb == NULL) {
3803 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3804 return CAMERA_ERROR_INVALID_PARAMETER;
3806 int ret = CAMERA_ERROR_NONE;
3808 camera_cli_s *pc = (camera_cli_s *)camera;
3809 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_PREVIEW_FORMAT;
3811 LOGD("Enter, handle :%x", pc->remote_handle);
3814 if (pc->cb_info == NULL) {
3815 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3816 return CAMERA_ERROR_INVALID_PARAMETER;
3818 sock_fd = pc->cb_info->fd;
3819 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_FORMAT] = foreach_cb;
3820 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_FORMAT] = user_data;
3822 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3823 LOGD("ret : 0x%x", ret);
3828 int camera_get_recommended_preview_resolution(camera_h camera, int *width, int *height)
3830 if (camera == NULL || width == NULL || height == NULL) {
3831 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3832 return CAMERA_ERROR_INVALID_PARAMETER;
3834 int ret = CAMERA_ERROR_NONE;
3836 camera_cli_s *pc = (camera_cli_s *)camera;
3837 muse_camera_api_e api = MUSE_CAMERA_API_GET_RECOMMENDED_PREVIEW_RESOLUTION;
3839 if (pc->cb_info == NULL) {
3840 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3841 return CAMERA_ERROR_INVALID_PARAMETER;
3843 sock_fd = pc->cb_info->fd;
3847 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3848 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3850 if (ret == CAMERA_ERROR_NONE) {
3851 muse_camera_msg_get(get_width, pc->cb_info->recv_msg);
3852 muse_camera_msg_get(get_height, pc->cb_info->recv_msg);
3854 *height = get_height;
3856 LOGD("ret : 0x%x", ret);
3861 int camera_attr_get_lens_orientation(camera_h camera, int *angle)
3863 if (camera == NULL || angle == NULL) {
3864 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3865 return CAMERA_ERROR_INVALID_PARAMETER;
3867 int ret = CAMERA_ERROR_NONE;
3869 camera_cli_s *pc = (camera_cli_s *)camera;
3870 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_LENS_ORIENTATION;
3872 if (pc->cb_info == NULL) {
3873 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3874 return CAMERA_ERROR_INVALID_PARAMETER;
3876 sock_fd = pc->cb_info->fd;
3879 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3880 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3882 if (ret == CAMERA_ERROR_NONE) {
3883 muse_camera_msg_get(get_angle, pc->cb_info->recv_msg);
3886 LOGD("ret : 0x%x", ret);
3890 int camera_attr_set_theater_mode(camera_h camera, camera_attr_theater_mode_e mode)
3892 if (camera == NULL) {
3893 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3894 return CAMERA_ERROR_INVALID_PARAMETER;
3896 int ret = CAMERA_ERROR_NONE;
3897 camera_cli_s *pc = (camera_cli_s *)camera;
3898 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_THEATER_MODE;
3900 if (pc->cb_info == NULL) {
3901 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3902 return CAMERA_ERROR_INVALID_PARAMETER;
3904 sock_fd = pc->cb_info->fd;
3905 int set_mode = (int)mode;
3906 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3907 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
3908 LOGD("ret : 0x%x", ret);
3912 int camera_attr_get_theater_mode(camera_h camera, camera_attr_theater_mode_e *mode)
3914 if (camera == NULL || mode == NULL) {
3915 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3916 return CAMERA_ERROR_INVALID_PARAMETER;
3919 int ret = CAMERA_ERROR_NONE;
3920 camera_cli_s *pc = (camera_cli_s *)camera;
3921 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_THEATER_MODE;
3923 if (pc->cb_info == NULL) {
3924 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3925 return CAMERA_ERROR_INVALID_PARAMETER;
3927 sock_fd = pc->cb_info->fd;
3929 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3930 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3932 if (ret == CAMERA_ERROR_NONE) {
3933 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
3934 *mode = (camera_attr_theater_mode_e)get_mode;
3936 LOGD("ret : 0x%x", ret);
3940 int camera_attr_foreach_supported_theater_mode(camera_h camera, camera_attr_supported_theater_mode_cb foreach_cb, void *user_data)
3942 if (camera == NULL || foreach_cb == NULL) {
3943 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3944 return CAMERA_ERROR_INVALID_PARAMETER;
3946 int ret = CAMERA_ERROR_NONE;
3948 camera_cli_s *pc = (camera_cli_s *)camera;
3949 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_THEATER_MODE;
3951 LOGD("Enter, handle :%x", pc->remote_handle);
3954 if (pc->cb_info == NULL) {
3955 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3956 return CAMERA_ERROR_INVALID_PARAMETER;
3958 sock_fd = pc->cb_info->fd;
3959 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE] = foreach_cb;
3960 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE] = user_data;
3962 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3964 LOGD("Finish, return :%x", ret);
3969 int camera_attr_set_preview_fps(camera_h camera, camera_attr_fps_e fps)
3971 if (camera == NULL) {
3972 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3973 return CAMERA_ERROR_INVALID_PARAMETER;
3975 int ret = CAMERA_ERROR_NONE;
3976 camera_cli_s *pc = (camera_cli_s *)camera;
3977 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_PREVIEW_FPS;
3979 if (pc->cb_info == NULL) {
3980 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3981 return CAMERA_ERROR_INVALID_PARAMETER;
3983 sock_fd = pc->cb_info->fd;
3984 int set_fps = (int)fps;
3985 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3986 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_fps);
3987 LOGD("ret : 0x%x", ret);
3992 int camera_attr_set_image_quality(camera_h camera, int quality)
3994 if (camera == NULL) {
3995 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3996 return CAMERA_ERROR_INVALID_PARAMETER;
3998 int ret = CAMERA_ERROR_NONE;
4000 camera_cli_s *pc = (camera_cli_s *)camera;
4001 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_IMAGE_QUALITY;
4003 if (pc->cb_info == NULL) {
4004 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4005 return CAMERA_ERROR_INVALID_PARAMETER;
4007 sock_fd = pc->cb_info->fd;
4008 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4009 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, quality);
4010 LOGD("ret : 0x%x", ret);
4014 int camera_attr_get_preview_fps(camera_h camera, camera_attr_fps_e *fps)
4016 if (camera == NULL || fps == NULL) {
4017 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4018 return CAMERA_ERROR_INVALID_PARAMETER;
4020 int ret = CAMERA_ERROR_NONE;
4022 camera_cli_s *pc = (camera_cli_s *)camera;
4023 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_PREVIEW_FPS;
4026 if (pc->cb_info == NULL) {
4027 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4028 return CAMERA_ERROR_INVALID_PARAMETER;
4030 sock_fd = pc->cb_info->fd;
4032 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4033 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4035 if (ret == CAMERA_ERROR_NONE) {
4036 muse_camera_msg_get(get_fps, pc->cb_info->recv_msg);
4037 *fps = (camera_attr_fps_e)get_fps;
4039 LOGD("ret : 0x%x", ret);
4044 int camera_attr_get_image_quality(camera_h camera, int *quality)
4046 if (camera == NULL || quality == NULL) {
4047 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4048 return CAMERA_ERROR_INVALID_PARAMETER;
4050 int ret = CAMERA_ERROR_NONE;
4052 camera_cli_s *pc = (camera_cli_s *)camera;
4053 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_IMAGE_QUALITY;
4055 if (pc->cb_info == NULL) {
4056 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4057 return CAMERA_ERROR_INVALID_PARAMETER;
4059 sock_fd = pc->cb_info->fd;
4061 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4062 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4064 if (ret == CAMERA_ERROR_NONE) {
4065 muse_camera_msg_get(get_quality, pc->cb_info->recv_msg);
4066 *quality = get_quality;
4068 LOGD("ret : 0x%x", ret);
4073 int camera_attr_get_encoded_preview_bitrate(camera_h camera, int *bitrate)
4075 if (camera == NULL || bitrate == NULL) {
4076 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4077 return CAMERA_ERROR_INVALID_PARAMETER;
4080 int ret = CAMERA_ERROR_NONE;
4082 camera_cli_s *pc = (camera_cli_s *)camera;
4083 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ENCODED_PREVIEW_BITRATE;
4085 if (pc->cb_info == NULL) {
4086 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4087 return CAMERA_ERROR_INVALID_PARAMETER;
4089 sock_fd = pc->cb_info->fd;
4092 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4093 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4095 if (ret == CAMERA_ERROR_NONE) {
4096 muse_camera_msg_get(get_bitrate, pc->cb_info->recv_msg);
4097 *bitrate = get_bitrate;
4099 LOGD("ret : 0x%x", ret);
4104 int camera_attr_set_encoded_preview_bitrate(camera_h camera, int bitrate)
4106 if (camera == NULL) {
4107 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4108 return CAMERA_ERROR_INVALID_PARAMETER;
4111 int ret = CAMERA_ERROR_NONE;
4113 camera_cli_s *pc = (camera_cli_s *)camera;
4114 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ENCODED_PREVIEW_BITRATE;
4116 if (pc->cb_info == NULL) {
4117 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4118 return CAMERA_ERROR_INVALID_PARAMETER;
4120 sock_fd = pc->cb_info->fd;
4121 int set_bitrate = bitrate;
4122 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4123 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_bitrate);
4124 LOGD("ret : 0x%x", ret);
4129 int camera_attr_get_encoded_preview_gop_interval(camera_h camera, int *interval)
4131 if (camera == NULL || interval == NULL) {
4132 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4133 return CAMERA_ERROR_INVALID_PARAMETER;
4136 int ret = CAMERA_ERROR_NONE;
4138 camera_cli_s *pc = (camera_cli_s *)camera;
4139 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ENCODED_PREVIEW_GOP_INTERVAL;
4141 if (pc->cb_info == NULL) {
4142 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4143 return CAMERA_ERROR_INVALID_PARAMETER;
4145 sock_fd = pc->cb_info->fd;
4146 int get_gop_interval;
4148 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4149 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4151 if (ret == CAMERA_ERROR_NONE) {
4152 muse_camera_msg_get(get_gop_interval, pc->cb_info->recv_msg);
4153 *interval = get_gop_interval;
4155 LOGD("ret : 0x%x", ret);
4160 int camera_attr_set_encoded_preview_gop_interval(camera_h camera, int interval)
4162 if (camera == NULL) {
4163 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4164 return CAMERA_ERROR_INVALID_PARAMETER;
4167 int ret = CAMERA_ERROR_NONE;
4169 camera_cli_s *pc = (camera_cli_s *)camera;
4170 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ENCODED_PREVIEW_GOP_INTERVAL;
4172 if (pc->cb_info == NULL) {
4173 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4174 return CAMERA_ERROR_INVALID_PARAMETER;
4176 sock_fd = pc->cb_info->fd;
4177 int set_gop_interval = interval;
4178 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4179 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_gop_interval);
4180 LOGD("ret : 0x%x", ret);
4185 int camera_attr_set_zoom(camera_h camera, int zoom)
4187 if (camera == NULL) {
4188 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4189 return CAMERA_ERROR_INVALID_PARAMETER;
4191 int ret = CAMERA_ERROR_NONE;
4193 camera_cli_s *pc = (camera_cli_s *)camera;
4194 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ZOOM;
4196 if (pc->cb_info == NULL) {
4197 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4198 return CAMERA_ERROR_INVALID_PARAMETER;
4200 sock_fd = pc->cb_info->fd;
4202 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4203 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, zoom);
4204 LOGD("ret : 0x%x", ret);
4208 int camera_attr_set_af_mode(camera_h camera, camera_attr_af_mode_e mode)
4210 if (camera == NULL) {
4211 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4212 return CAMERA_ERROR_INVALID_PARAMETER;
4214 int ret = CAMERA_ERROR_NONE;
4216 camera_cli_s *pc = (camera_cli_s *)camera;
4217 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_AF_MODE;
4219 if (pc->cb_info == NULL) {
4220 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4221 return CAMERA_ERROR_INVALID_PARAMETER;
4223 sock_fd = pc->cb_info->fd;
4224 int set_mode = (int)mode;
4225 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4226 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
4227 LOGD("ret : 0x%x", ret);
4231 int camera_attr_set_af_area(camera_h camera, int x, int y)
4233 if (camera == NULL) {
4234 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4235 return CAMERA_ERROR_INVALID_PARAMETER;
4237 int ret = CAMERA_ERROR_NONE;
4238 camera_cli_s *pc = (camera_cli_s *)camera;
4239 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_AF_AREA;
4240 int sock_fd = pc->cb_info->fd;
4241 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4242 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, x, INT, y);
4243 LOGD("ret : 0x%x", ret);
4248 int camera_attr_clear_af_area(camera_h camera)
4250 if (camera == NULL) {
4251 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4252 return CAMERA_ERROR_INVALID_PARAMETER;
4254 int ret = CAMERA_ERROR_NONE;
4256 camera_cli_s *pc = (camera_cli_s *)camera;
4257 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_CLEAR_AF_AREA;
4259 if (pc->cb_info == NULL) {
4260 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4261 return CAMERA_ERROR_INVALID_PARAMETER;
4263 sock_fd = pc->cb_info->fd;
4264 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4265 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4266 LOGD("ret : 0x%x", ret);
4271 int camera_attr_set_exposure_mode(camera_h camera, camera_attr_exposure_mode_e mode)
4273 if (camera == NULL) {
4274 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4275 return CAMERA_ERROR_INVALID_PARAMETER;
4278 if (mode < CAMERA_ATTR_EXPOSURE_MODE_OFF || mode > CAMERA_ATTR_EXPOSURE_MODE_CUSTOM) {
4279 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4280 return CAMERA_ERROR_INVALID_PARAMETER;
4283 int ret = CAMERA_ERROR_NONE;
4284 camera_cli_s *pc = (camera_cli_s *)camera;
4285 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EXPOSURE_MODE;
4286 int set_mode = (int)mode;
4288 if (pc->cb_info == NULL) {
4289 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4290 return CAMERA_ERROR_INVALID_PARAMETER;
4292 sock_fd = pc->cb_info->fd;
4293 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4294 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
4295 LOGD("ret : 0x%x", ret);
4300 int camera_attr_set_exposure(camera_h camera, int value)
4302 if (camera == NULL) {
4303 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4304 return CAMERA_ERROR_INVALID_PARAMETER;
4306 int ret = CAMERA_ERROR_NONE;
4308 camera_cli_s *pc = (camera_cli_s *)camera;
4309 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EXPOSURE;
4311 if (pc->cb_info == NULL) {
4312 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4313 return CAMERA_ERROR_INVALID_PARAMETER;
4315 sock_fd = pc->cb_info->fd;
4317 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4318 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, value);
4319 LOGD("ret : 0x%x", ret);
4324 int camera_attr_set_iso(camera_h camera, camera_attr_iso_e iso)
4326 if (camera == NULL) {
4327 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4328 return CAMERA_ERROR_INVALID_PARAMETER;
4330 int ret = CAMERA_ERROR_NONE;
4332 camera_cli_s *pc = (camera_cli_s *)camera;
4333 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ISO;
4335 if (pc->cb_info == NULL) {
4336 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4337 return CAMERA_ERROR_INVALID_PARAMETER;
4339 sock_fd = pc->cb_info->fd;
4340 int set_iso = (int)iso;
4341 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4342 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_iso);
4343 LOGD("ret : 0x%x", ret);
4348 int camera_attr_set_brightness(camera_h camera, int level)
4350 if (camera == NULL) {
4351 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4352 return CAMERA_ERROR_INVALID_PARAMETER;
4354 int ret = CAMERA_ERROR_NONE;
4356 camera_cli_s *pc = (camera_cli_s *)camera;
4357 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_BRIGHTNESS;
4359 if (pc->cb_info == NULL) {
4360 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4361 return CAMERA_ERROR_INVALID_PARAMETER;
4363 sock_fd = pc->cb_info->fd;
4365 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4366 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, level);
4367 LOGD("ret : 0x%x", ret);
4372 int camera_attr_set_contrast(camera_h camera, int level)
4374 if (camera == NULL) {
4375 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4376 return CAMERA_ERROR_INVALID_PARAMETER;
4378 int ret = CAMERA_ERROR_NONE;
4380 camera_cli_s *pc = (camera_cli_s *)camera;
4381 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_CONTRAST;
4383 if (pc->cb_info == NULL) {
4384 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4385 return CAMERA_ERROR_INVALID_PARAMETER;
4387 sock_fd = pc->cb_info->fd;
4389 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4390 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, level);
4391 LOGD("ret : 0x%x", ret);
4396 int camera_attr_set_whitebalance(camera_h camera, camera_attr_whitebalance_e wb)
4398 if (camera == NULL) {
4399 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4400 return CAMERA_ERROR_INVALID_PARAMETER;
4403 if (wb < CAMERA_ATTR_WHITE_BALANCE_NONE || wb > CAMERA_ATTR_WHITE_BALANCE_CUSTOM) {
4404 LOGE("invalid white balance %d", wb);
4405 return CAMERA_ERROR_INVALID_PARAMETER;
4408 int ret = CAMERA_ERROR_NONE;
4410 camera_cli_s *pc = (camera_cli_s *)camera;
4411 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_WHITEBALANCE;
4413 if (pc->cb_info == NULL) {
4414 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4415 return CAMERA_ERROR_INVALID_PARAMETER;
4417 sock_fd = pc->cb_info->fd;
4418 int set_whitebalance = (int)wb;
4419 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4420 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_whitebalance);
4421 LOGD("ret : 0x%x", ret);
4426 int camera_attr_set_effect(camera_h camera, camera_attr_effect_mode_e effect)
4428 if (camera == NULL) {
4429 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4430 return CAMERA_ERROR_INVALID_PARAMETER;
4432 int ret = CAMERA_ERROR_NONE;
4434 camera_cli_s *pc = (camera_cli_s *)camera;
4435 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EFFECT;
4437 if (pc->cb_info == NULL) {
4438 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4439 return CAMERA_ERROR_INVALID_PARAMETER;
4441 sock_fd = pc->cb_info->fd;
4442 int set_effect = (int)effect;
4443 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4444 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_effect);
4445 LOGD("ret : 0x%x", ret);
4450 int camera_attr_set_scene_mode(camera_h camera, camera_attr_scene_mode_e mode)
4452 if (camera == NULL) {
4453 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4454 return CAMERA_ERROR_INVALID_PARAMETER;
4456 int ret = CAMERA_ERROR_NONE;
4458 camera_cli_s *pc = (camera_cli_s *)camera;
4459 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_SCENE_MODE;
4461 if (pc->cb_info == NULL) {
4462 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4463 return CAMERA_ERROR_INVALID_PARAMETER;
4465 sock_fd = pc->cb_info->fd;
4466 int set_mode = (int)mode;
4467 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4468 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
4469 LOGD("ret : 0x%x", ret);
4474 int camera_attr_enable_tag(camera_h camera, bool enable)
4476 if (camera == NULL) {
4477 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4478 return CAMERA_ERROR_INVALID_PARAMETER;
4480 int ret = CAMERA_ERROR_NONE;
4481 camera_cli_s *pc = (camera_cli_s *)camera;
4482 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_TAG;
4484 if (pc->cb_info == NULL) {
4485 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4486 return CAMERA_ERROR_INVALID_PARAMETER;
4488 sock_fd = pc->cb_info->fd;
4489 int set_enable = (int)enable;
4491 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4492 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
4493 LOGD("ret : 0x%x", ret);
4498 int camera_attr_set_tag_image_description(camera_h camera, const char *description)
4500 if (camera == NULL) {
4501 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4502 return CAMERA_ERROR_INVALID_PARAMETER;
4504 if (description == NULL) {
4505 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4506 return CAMERA_ERROR_INVALID_PARAMETER;
4508 int ret = CAMERA_ERROR_NONE;
4509 camera_cli_s *pc = (camera_cli_s *)camera;
4510 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_IMAGE_DESCRIPTION;
4512 if (pc->cb_info == NULL) {
4513 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4514 return CAMERA_ERROR_INVALID_PARAMETER;
4516 sock_fd = pc->cb_info->fd;
4517 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4518 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, STRING, description);
4519 LOGD("ret : 0x%x", ret);
4524 int camera_attr_set_tag_orientation(camera_h camera, camera_attr_tag_orientation_e orientation)
4526 if (camera == NULL) {
4527 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4528 return CAMERA_ERROR_INVALID_PARAMETER;
4530 int ret = CAMERA_ERROR_NONE;
4531 camera_cli_s *pc = (camera_cli_s *)camera;
4532 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_ORIENTATION;
4534 if (pc->cb_info == NULL) {
4535 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4536 return CAMERA_ERROR_INVALID_PARAMETER;
4538 sock_fd = pc->cb_info->fd;
4539 int set_orientation = (int)orientation;
4541 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4542 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_orientation);
4543 LOGD("ret : 0x%x", ret);
4548 int camera_attr_set_tag_software(camera_h camera, const char *software)
4550 if (camera == NULL) {
4551 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4552 return CAMERA_ERROR_INVALID_PARAMETER;
4554 if (software == NULL) {
4555 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4556 return CAMERA_ERROR_INVALID_PARAMETER;
4558 int ret = CAMERA_ERROR_NONE;
4559 camera_cli_s *pc = (camera_cli_s *)camera;
4560 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_SOFTWARE;
4562 if (pc->cb_info == NULL) {
4563 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4564 return CAMERA_ERROR_INVALID_PARAMETER;
4566 sock_fd = pc->cb_info->fd;
4567 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4568 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, STRING, software);
4569 LOGD("ret : 0x%x", ret);
4574 int camera_attr_set_geotag(camera_h camera, double latitude , double longitude, double altitude)
4576 if (camera == NULL) {
4577 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4578 return CAMERA_ERROR_INVALID_PARAMETER;
4580 int ret = CAMERA_ERROR_NONE;
4581 camera_cli_s *pc = (camera_cli_s *)camera;
4582 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_GEOTAG;
4584 if (pc->cb_info == NULL) {
4585 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4586 return CAMERA_ERROR_INVALID_PARAMETER;
4588 sock_fd = pc->cb_info->fd;
4589 double set_geotag[3] = { latitude, longitude, altitude };
4591 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4592 muse_camera_msg_send_array(api, sock_fd, pc->cb_info, ret,
4593 set_geotag, sizeof(set_geotag), sizeof(double));
4594 LOGD("ret : 0x%x", ret);
4599 int camera_attr_remove_geotag(camera_h camera)
4601 if (camera == NULL) {
4602 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4603 return CAMERA_ERROR_INVALID_PARAMETER;
4605 int ret = CAMERA_ERROR_NONE;
4606 camera_cli_s *pc = (camera_cli_s *)camera;
4607 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_REMOVE_GEOTAG;
4609 if (pc->cb_info == NULL) {
4610 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4611 return CAMERA_ERROR_INVALID_PARAMETER;
4613 sock_fd = pc->cb_info->fd;
4614 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4615 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4616 LOGD("ret : 0x%x", ret);
4621 int camera_attr_set_flash_mode(camera_h camera, camera_attr_flash_mode_e mode)
4623 if (camera == NULL) {
4624 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4625 return CAMERA_ERROR_INVALID_PARAMETER;
4627 int ret = CAMERA_ERROR_NONE;
4628 camera_cli_s *pc = (camera_cli_s *)camera;
4629 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_FLASH_MODE;
4631 if (pc->cb_info == NULL) {
4632 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4633 return CAMERA_ERROR_INVALID_PARAMETER;
4635 sock_fd = pc->cb_info->fd;
4636 int set_mode = (int)mode;
4638 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4639 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
4640 LOGD("ret : 0x%x", ret);
4645 int camera_attr_get_zoom(camera_h camera, int *zoom)
4647 if (camera == NULL || zoom == NULL) {
4648 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4649 return CAMERA_ERROR_INVALID_PARAMETER;
4651 int ret = CAMERA_ERROR_NONE;
4653 camera_cli_s *pc = (camera_cli_s *)camera;
4654 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ZOOM;
4657 if (pc->cb_info == NULL) {
4658 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4659 return CAMERA_ERROR_INVALID_PARAMETER;
4661 sock_fd = pc->cb_info->fd;
4663 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4664 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4666 if (ret == CAMERA_ERROR_NONE) {
4667 muse_camera_msg_get(get_zoom, pc->cb_info->recv_msg);
4670 LOGD("ret : 0x%x", ret);
4675 int camera_attr_get_zoom_range(camera_h camera, int *min, int *max)
4677 if (camera == NULL || min == NULL || max == NULL) {
4678 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4679 return CAMERA_ERROR_INVALID_PARAMETER;
4681 int ret = CAMERA_ERROR_NONE;
4682 camera_cli_s *pc = (camera_cli_s *)camera;
4684 if (pc->cb_info == NULL) {
4685 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4686 return CAMERA_ERROR_INVALID_PARAMETER;
4688 sock_fd = pc->cb_info->fd;
4689 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ZOOM_RANGE;
4693 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4694 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4696 if (ret == CAMERA_ERROR_NONE) {
4697 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
4698 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
4702 LOGD("ret : 0x%x", ret);
4707 int camera_attr_get_af_mode(camera_h camera, camera_attr_af_mode_e *mode)
4709 if (camera == NULL || mode == NULL) {
4710 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4711 return CAMERA_ERROR_INVALID_PARAMETER;
4713 int ret = CAMERA_ERROR_NONE;
4714 camera_cli_s *pc = (camera_cli_s *)camera;
4716 if (pc->cb_info == NULL) {
4717 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4718 return CAMERA_ERROR_INVALID_PARAMETER;
4720 sock_fd = pc->cb_info->fd;
4721 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_AF_MODE;
4724 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4725 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4727 if (ret == CAMERA_ERROR_NONE) {
4728 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
4729 *mode = (camera_attr_af_mode_e)get_mode;
4731 LOGD("ret : 0x%x", ret);
4736 int camera_attr_get_exposure_mode(camera_h camera, camera_attr_exposure_mode_e *mode)
4738 if (camera == NULL || mode == NULL) {
4739 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4740 return CAMERA_ERROR_INVALID_PARAMETER;
4742 int ret = CAMERA_ERROR_NONE;
4743 camera_cli_s *pc = (camera_cli_s *)camera;
4745 if (pc->cb_info == NULL) {
4746 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4747 return CAMERA_ERROR_INVALID_PARAMETER;
4749 sock_fd = pc->cb_info->fd;
4750 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE_MODE;
4753 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4754 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4756 if (ret == CAMERA_ERROR_NONE) {
4757 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
4758 *mode = (camera_attr_exposure_mode_e)get_mode;
4760 LOGD("ret : 0x%x", ret);
4764 int camera_attr_get_exposure(camera_h camera, int *value)
4766 if (camera == NULL || value == NULL) {
4767 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4768 return CAMERA_ERROR_INVALID_PARAMETER;
4770 int ret = CAMERA_ERROR_NONE;
4771 camera_cli_s *pc = (camera_cli_s *)camera;
4773 if (pc->cb_info == NULL) {
4774 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4775 return CAMERA_ERROR_INVALID_PARAMETER;
4777 sock_fd = pc->cb_info->fd;
4778 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE;
4781 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4782 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4784 if (ret == CAMERA_ERROR_NONE) {
4785 muse_camera_msg_get(get_value, pc->cb_info->recv_msg);
4788 LOGD("ret : 0x%x", ret);
4793 int camera_attr_get_exposure_range(camera_h camera, int *min, int *max)
4795 if (camera == NULL || min == NULL || max == NULL) {
4796 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4797 return CAMERA_ERROR_INVALID_PARAMETER;
4799 int ret = CAMERA_ERROR_NONE;
4800 camera_cli_s *pc = (camera_cli_s *)camera;
4802 if (pc->cb_info == NULL) {
4803 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4804 return CAMERA_ERROR_INVALID_PARAMETER;
4806 sock_fd = pc->cb_info->fd;
4807 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE_RANGE;
4811 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4812 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4814 if (ret == CAMERA_ERROR_NONE) {
4815 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
4816 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
4820 LOGD("ret : 0x%x", ret);
4825 int camera_attr_get_iso(camera_h camera, camera_attr_iso_e *iso)
4827 if (camera == NULL || iso == NULL) {
4828 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4829 return CAMERA_ERROR_INVALID_PARAMETER;
4831 int ret = CAMERA_ERROR_NONE;
4832 camera_cli_s *pc = (camera_cli_s *)camera;
4834 if (pc->cb_info == NULL) {
4835 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4836 return CAMERA_ERROR_INVALID_PARAMETER;
4838 sock_fd = pc->cb_info->fd;
4839 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ISO;
4842 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4843 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4845 if (ret == CAMERA_ERROR_NONE) {
4846 muse_camera_msg_get(get_iso, pc->cb_info->recv_msg);
4847 *iso = (camera_attr_iso_e)get_iso;
4849 LOGD("ret : 0x%x", ret);
4854 int camera_attr_get_brightness(camera_h camera, int *level)
4856 if (camera == NULL || level == NULL) {
4857 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4858 return CAMERA_ERROR_INVALID_PARAMETER;
4860 int ret = CAMERA_ERROR_NONE;
4861 camera_cli_s *pc = (camera_cli_s *)camera;
4863 if (pc->cb_info == NULL) {
4864 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4865 return CAMERA_ERROR_INVALID_PARAMETER;
4867 sock_fd = pc->cb_info->fd;
4868 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_BRIGHTNESS;
4871 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4872 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4874 if (ret == CAMERA_ERROR_NONE) {
4875 muse_camera_msg_get(get_level, pc->cb_info->recv_msg);
4878 LOGD("ret : 0x%x", ret);
4883 int camera_attr_get_brightness_range(camera_h camera, int *min, int *max)
4885 if (camera == NULL || min == NULL || max == NULL) {
4886 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4887 return CAMERA_ERROR_INVALID_PARAMETER;
4889 int ret = CAMERA_ERROR_NONE;
4890 camera_cli_s *pc = (camera_cli_s *)camera;
4892 if (pc->cb_info == NULL) {
4893 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4894 return CAMERA_ERROR_INVALID_PARAMETER;
4896 sock_fd = pc->cb_info->fd;
4897 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_BRIGHTNESS_RANGE;
4901 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4902 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4904 if (ret == CAMERA_ERROR_NONE) {
4905 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
4906 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
4910 LOGD("ret : 0x%x", ret);
4915 int camera_attr_get_contrast(camera_h camera, int *level)
4917 if (camera == NULL || level == NULL) {
4918 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4919 return CAMERA_ERROR_INVALID_PARAMETER;
4921 int ret = CAMERA_ERROR_NONE;
4922 camera_cli_s *pc = (camera_cli_s *)camera;
4923 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_CONTRAST;
4925 if (pc->cb_info == NULL) {
4926 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4927 return CAMERA_ERROR_INVALID_PARAMETER;
4929 sock_fd = pc->cb_info->fd;
4932 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4933 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4935 if (ret == CAMERA_ERROR_NONE) {
4936 muse_camera_msg_get(get_level, pc->cb_info->recv_msg);
4939 LOGD("ret : 0x%x", ret);
4944 int camera_attr_get_contrast_range(camera_h camera, int *min , int *max)
4946 if (camera == NULL || min == NULL || max == NULL) {
4947 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4948 return CAMERA_ERROR_INVALID_PARAMETER;
4950 int ret = CAMERA_ERROR_NONE;
4951 camera_cli_s *pc = (camera_cli_s *)camera;
4952 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_CONTRAST_RANGE;
4954 if (pc->cb_info == NULL) {
4955 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4956 return CAMERA_ERROR_INVALID_PARAMETER;
4958 sock_fd = pc->cb_info->fd;
4962 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4963 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4965 if (ret == CAMERA_ERROR_NONE) {
4966 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
4967 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
4971 LOGD("ret : 0x%x", ret);
4976 int camera_attr_get_whitebalance(camera_h camera, camera_attr_whitebalance_e *wb)
4978 if (camera == NULL || wb == NULL) {
4979 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4980 return CAMERA_ERROR_INVALID_PARAMETER;
4982 int ret = CAMERA_ERROR_NONE;
4983 camera_cli_s *pc = (camera_cli_s *)camera;
4984 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_WHITEBALANCE;
4986 if (pc->cb_info == NULL) {
4987 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4988 return CAMERA_ERROR_INVALID_PARAMETER;
4990 sock_fd = pc->cb_info->fd;
4993 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4994 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4996 if (ret == CAMERA_ERROR_NONE) {
4997 muse_camera_msg_get(get_wb, pc->cb_info->recv_msg);
4998 *wb = (camera_attr_whitebalance_e)get_wb;
5000 LOGD("ret : 0x%x", ret);
5005 int camera_attr_get_effect(camera_h camera, camera_attr_effect_mode_e *effect)
5007 if (camera == NULL || effect == NULL) {
5008 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5009 return CAMERA_ERROR_INVALID_PARAMETER;
5012 int ret = CAMERA_ERROR_NONE;
5013 camera_cli_s *pc = (camera_cli_s *)camera;
5014 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EFFECT;
5016 if (pc->cb_info == NULL) {
5017 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5018 return CAMERA_ERROR_INVALID_PARAMETER;
5020 sock_fd = pc->cb_info->fd;
5023 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5024 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5026 if (ret == CAMERA_ERROR_NONE) {
5027 muse_camera_msg_get(get_effect, pc->cb_info->recv_msg);
5028 *effect = (camera_attr_effect_mode_e)get_effect;
5030 LOGD("ret : 0x%x", ret);
5035 int camera_attr_get_scene_mode(camera_h camera, camera_attr_scene_mode_e *mode)
5037 if (camera == NULL || mode == NULL) {
5038 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5039 return CAMERA_ERROR_INVALID_PARAMETER;
5042 int ret = CAMERA_ERROR_NONE;
5043 camera_cli_s *pc = (camera_cli_s *)camera;
5044 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_SCENE_MODE;
5046 if (pc->cb_info == NULL) {
5047 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5048 return CAMERA_ERROR_INVALID_PARAMETER;
5050 sock_fd = pc->cb_info->fd;
5053 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5054 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5056 if (ret == CAMERA_ERROR_NONE) {
5057 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
5058 *mode = (camera_attr_scene_mode_e)get_mode;
5060 LOGD("ret : 0x%x", ret);
5065 int camera_attr_is_enabled_tag(camera_h camera, bool *enable)
5067 if (camera == NULL || enable == NULL) {
5068 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5069 return CAMERA_ERROR_INVALID_PARAMETER;
5072 int ret = CAMERA_ERROR_NONE;
5073 camera_cli_s *pc = (camera_cli_s *)camera;
5074 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_TAG;
5076 if (pc->cb_info == NULL) {
5077 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5078 return CAMERA_ERROR_INVALID_PARAMETER;
5080 sock_fd = pc->cb_info->fd;
5083 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5084 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5086 if (ret == CAMERA_ERROR_NONE) {
5087 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
5088 *enable = (bool)get_enabled;
5090 LOGD("ret : 0x%x", ret);
5095 int camera_attr_get_tag_image_description(camera_h camera, char **description)
5097 if (camera == NULL || description == NULL) {
5098 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5099 return CAMERA_ERROR_INVALID_PARAMETER;
5102 int ret = CAMERA_ERROR_NONE;
5103 camera_cli_s *pc = (camera_cli_s *)camera;
5104 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_IMAGE_DESCRIPTION;
5106 if (pc->cb_info == NULL) {
5107 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5108 return CAMERA_ERROR_INVALID_PARAMETER;
5110 sock_fd = pc->cb_info->fd;
5111 char get_description[MUSE_CAMERA_MSG_MAX_LENGTH] = {0,};
5113 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5114 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5116 if (ret == CAMERA_ERROR_NONE) {
5117 muse_camera_msg_get_string(get_description, pc->cb_info->recv_msg);
5118 *description = strdup(get_description);
5120 LOGD("ret : 0x%x", ret);
5125 int camera_attr_get_tag_orientation(camera_h camera, camera_attr_tag_orientation_e *orientation)
5127 if (camera == NULL || orientation == NULL) {
5128 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5129 return CAMERA_ERROR_INVALID_PARAMETER;
5132 int ret = CAMERA_ERROR_NONE;
5133 camera_cli_s *pc = (camera_cli_s *)camera;
5134 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_ORIENTATION;
5136 if (pc->cb_info == NULL) {
5137 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5138 return CAMERA_ERROR_INVALID_PARAMETER;
5140 sock_fd = pc->cb_info->fd;
5141 int get_orientation;
5143 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5144 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5146 if (ret == CAMERA_ERROR_NONE) {
5147 muse_camera_msg_get(get_orientation, pc->cb_info->recv_msg);
5148 *orientation = (camera_attr_tag_orientation_e)get_orientation;
5149 LOGD("success, orientation : %d", *orientation);
5151 LOGD("ret : 0x%x", ret);
5156 int camera_attr_get_tag_software(camera_h camera, char **software)
5158 if (camera == NULL || software == NULL) {
5159 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5160 return CAMERA_ERROR_INVALID_PARAMETER;
5163 int ret = CAMERA_ERROR_NONE;
5164 camera_cli_s *pc = (camera_cli_s *)camera;
5165 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_SOFTWARE;
5167 if (pc->cb_info == NULL) {
5168 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5169 return CAMERA_ERROR_INVALID_PARAMETER;
5171 sock_fd = pc->cb_info->fd;
5172 char get_software[MUSE_CAMERA_MSG_MAX_LENGTH] = {0,};
5174 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5175 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5177 if (ret == CAMERA_ERROR_NONE) {
5178 muse_camera_msg_get_string(get_software, pc->cb_info->recv_msg);
5179 *software = strdup(get_software);
5181 LOGD("ret : 0x%x", ret);
5186 int camera_attr_get_geotag(camera_h camera, double *latitude , double *longitude, double *altitude)
5188 if (camera == NULL || latitude == NULL || longitude == NULL || altitude == NULL) {
5189 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5190 return CAMERA_ERROR_INVALID_PARAMETER;
5193 int ret = CAMERA_ERROR_NONE;
5194 camera_cli_s *pc = (camera_cli_s *)camera;
5195 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_GEOTAG;
5196 double get_geotag[3] = {0,};
5198 if (pc->cb_info == NULL) {
5199 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5200 return CAMERA_ERROR_INVALID_PARAMETER;
5202 sock_fd = pc->cb_info->fd;
5204 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5206 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5208 if (ret == CAMERA_ERROR_NONE) {
5209 muse_camera_msg_get_array(get_geotag, pc->cb_info->recv_msg);
5210 *latitude = get_geotag[0];
5211 *longitude = get_geotag[1];
5212 *altitude = get_geotag[2];
5214 LOGD("ret : 0x%x", ret);
5216 LOGE("Returned value is not valid : 0x%x", ret);
5223 int camera_attr_get_flash_mode(camera_h camera, camera_attr_flash_mode_e *mode)
5225 if (camera == NULL || mode == NULL) {
5226 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5227 return CAMERA_ERROR_INVALID_PARAMETER;
5230 int ret = CAMERA_ERROR_NONE;
5231 camera_cli_s *pc = (camera_cli_s *)camera;
5232 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_FLASH_MODE;
5234 if (pc->cb_info == NULL) {
5235 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5236 return CAMERA_ERROR_INVALID_PARAMETER;
5238 sock_fd = pc->cb_info->fd;
5241 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5242 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5244 if (ret == CAMERA_ERROR_NONE) {
5245 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
5246 *mode = (camera_attr_flash_mode_e)get_mode;
5248 LOGD("ret : 0x%x", ret);
5253 int camera_get_flash_state(camera_device_e device, camera_flash_state_e *state)
5257 int ret = CAMERA_ERROR_NONE;
5258 camera_cli_s *pc = NULL;
5259 int get_flash_state = 0;
5261 /* create muse connection */
5262 muse_camera_api_e api = MUSE_CAMERA_API_GET_FLASH_STATE;
5263 muse_core_api_module_e muse_module = MUSE_CAMERA;
5264 int device_type = (int)device;
5266 if (state == NULL) {
5267 LOGE("invalid pointer for state");
5268 return CAMERA_ERROR_INVALID_PARAMETER;
5271 sock_fd = muse_core_client_new();
5273 LOGE("muse_core_client_new failed - returned fd %d", sock_fd);
5274 ret = CAMERA_ERROR_INVALID_OPERATION;
5278 sndMsg = muse_core_msg_json_factory_new(api,
5279 MUSE_TYPE_INT, "module", muse_module,
5280 MUSE_TYPE_INT, PARAM_DEVICE_TYPE, device_type,
5283 muse_core_ipc_send_msg(sock_fd, sndMsg);
5284 muse_core_msg_json_factory_free(sndMsg);
5286 pc = g_new0(camera_cli_s, 1);
5288 LOGE("camera_cli_s alloc failed");
5289 ret = CAMERA_ERROR_OUT_OF_MEMORY;
5293 pc->cb_info = _client_callback_new(sock_fd);
5294 if (pc->cb_info == NULL) {
5295 LOGE("cb_info alloc failed");
5296 ret = CAMERA_ERROR_OUT_OF_MEMORY;
5300 ret = _client_wait_for_cb_return(api, pc->cb_info, CALLBACK_TIME_OUT);
5302 if (ret == CAMERA_ERROR_NONE) {
5303 muse_camera_msg_get(get_flash_state, pc->cb_info->recv_msg);
5304 *state = (camera_flash_state_e)get_flash_state;
5307 LOGD("Flash state : %d\n", *state);
5310 /* release resources */
5312 g_atomic_int_set(&pc->cb_info->msg_recv_running, 0);
5313 g_atomic_int_set(&pc->cb_info->msg_handler_running, 0);
5314 _client_callback_destroy(pc->cb_info);
5324 int camera_attr_foreach_supported_af_mode(camera_h camera, camera_attr_supported_af_mode_cb foreach_cb, void *user_data)
5326 if (camera == NULL || foreach_cb == NULL) {
5327 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5328 return CAMERA_ERROR_INVALID_PARAMETER;
5330 int ret = CAMERA_ERROR_NONE;
5332 camera_cli_s *pc = (camera_cli_s *)camera;
5333 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_AF_MODE;
5335 LOGD("Enter, handle :%x", pc->remote_handle);
5338 if (pc->cb_info == NULL) {
5339 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5340 return CAMERA_ERROR_INVALID_PARAMETER;
5342 sock_fd = pc->cb_info->fd;
5343 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_AF_MODE] = foreach_cb;
5344 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_AF_MODE] = user_data;
5346 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5347 LOGD("ret : 0x%x", ret);
5352 int camera_attr_foreach_supported_exposure_mode(camera_h camera, camera_attr_supported_exposure_mode_cb foreach_cb , void *user_data)
5354 if (camera == NULL || foreach_cb == NULL) {
5355 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5356 return CAMERA_ERROR_INVALID_PARAMETER;
5358 int ret = CAMERA_ERROR_NONE;
5360 camera_cli_s *pc = (camera_cli_s *)camera;
5361 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_EXPOSURE_MODE;
5363 LOGD("Enter, handle :%x", pc->remote_handle);
5366 if (pc->cb_info == NULL) {
5367 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5368 return CAMERA_ERROR_INVALID_PARAMETER;
5370 sock_fd = pc->cb_info->fd;
5371 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EXPOSURE_MODE] = foreach_cb;
5372 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EXPOSURE_MODE] = user_data;
5374 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5375 LOGD("ret : 0x%x", ret);
5380 int camera_attr_foreach_supported_iso(camera_h camera, camera_attr_supported_iso_cb foreach_cb, void *user_data)
5382 if (camera == NULL || foreach_cb == NULL) {
5383 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5384 return CAMERA_ERROR_INVALID_PARAMETER;
5386 int ret = CAMERA_ERROR_NONE;
5388 camera_cli_s *pc = (camera_cli_s *)camera;
5389 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_ISO;
5391 LOGD("Enter, handle :%x", pc->remote_handle);
5394 if (pc->cb_info == NULL) {
5395 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5396 return CAMERA_ERROR_INVALID_PARAMETER;
5398 sock_fd = pc->cb_info->fd;
5399 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_ISO] = foreach_cb;
5400 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_ISO] = user_data;
5402 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5403 LOGD("ret : 0x%x", ret);
5408 int camera_attr_foreach_supported_whitebalance(camera_h camera, camera_attr_supported_whitebalance_cb foreach_cb , void *user_data)
5410 if (camera == NULL || foreach_cb == NULL) {
5411 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5412 return CAMERA_ERROR_INVALID_PARAMETER;
5414 int ret = CAMERA_ERROR_NONE;
5416 camera_cli_s *pc = (camera_cli_s *)camera;
5417 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_WHITEBALANCE;
5419 LOGD("Enter, handle :%x", pc->remote_handle);
5422 if (pc->cb_info == NULL) {
5423 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5424 return CAMERA_ERROR_INVALID_PARAMETER;
5426 sock_fd = pc->cb_info->fd;
5427 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_WHITEBALANCE] = foreach_cb;
5428 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_WHITEBALANCE] = user_data;
5430 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5431 LOGD("ret : 0x%x", ret);
5436 int camera_attr_foreach_supported_effect(camera_h camera, camera_attr_supported_effect_cb foreach_cb , void *user_data)
5438 if (camera == NULL || foreach_cb == NULL) {
5439 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5440 return CAMERA_ERROR_INVALID_PARAMETER;
5442 int ret = CAMERA_ERROR_NONE;
5444 camera_cli_s *pc = (camera_cli_s *)camera;
5445 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_EFFECT;
5447 LOGD("Enter, handle :%x", pc->remote_handle);
5450 if (pc->cb_info == NULL) {
5451 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5452 return CAMERA_ERROR_INVALID_PARAMETER;
5454 sock_fd = pc->cb_info->fd;
5455 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EFFECT] = foreach_cb;
5456 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EFFECT] = user_data;
5458 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5459 LOGD("ret : 0x%x", ret);
5464 int camera_attr_foreach_supported_scene_mode(camera_h camera, camera_attr_supported_scene_mode_cb foreach_cb , void *user_data)
5466 if (camera == NULL || foreach_cb == NULL) {
5467 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5468 return CAMERA_ERROR_INVALID_PARAMETER;
5470 int ret = CAMERA_ERROR_NONE;
5472 camera_cli_s *pc = (camera_cli_s *)camera;
5473 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_SCENE_MODE;
5475 LOGD("Enter, handle :%x", pc->remote_handle);
5478 if (pc->cb_info == NULL) {
5479 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5480 return CAMERA_ERROR_INVALID_PARAMETER;
5482 sock_fd = pc->cb_info->fd;
5483 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_SCENE_MODE] = foreach_cb;
5484 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_SCENE_MODE] = user_data;
5486 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5487 LOGD("ret : 0x%x", ret);
5492 int camera_attr_foreach_supported_flash_mode(camera_h camera, camera_attr_supported_flash_mode_cb foreach_cb , void *user_data)
5494 if (camera == NULL || foreach_cb == NULL) {
5495 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5496 return CAMERA_ERROR_INVALID_PARAMETER;
5498 int ret = CAMERA_ERROR_NONE;
5500 camera_cli_s *pc = (camera_cli_s *)camera;
5501 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FLASH_MODE;
5503 LOGD("Enter, handle :%x", pc->remote_handle);
5506 if (pc->cb_info == NULL) {
5507 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5508 return CAMERA_ERROR_INVALID_PARAMETER;
5510 sock_fd = pc->cb_info->fd;
5511 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FLASH_MODE] = foreach_cb;
5512 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FLASH_MODE] = user_data;
5514 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5515 LOGD("ret : 0x%x", ret);
5520 int camera_attr_foreach_supported_fps(camera_h camera, camera_attr_supported_fps_cb foreach_cb , void *user_data)
5522 if (camera == NULL || foreach_cb == NULL) {
5523 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5524 return CAMERA_ERROR_INVALID_PARAMETER;
5526 int ret = CAMERA_ERROR_NONE;
5528 camera_cli_s *pc = (camera_cli_s *)camera;
5529 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FPS;
5531 if (pc->cb_info == NULL) {
5532 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5533 return CAMERA_ERROR_INVALID_PARAMETER;
5535 sock_fd = pc->cb_info->fd;
5536 LOGD("Enter, handle :%x", pc->remote_handle);
5537 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS] = foreach_cb;
5538 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS] = user_data;
5540 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5541 LOGD("Enter, handle :%x", pc->remote_handle);
5545 int camera_attr_foreach_supported_fps_by_resolution(camera_h camera, int width, int height, camera_attr_supported_fps_cb foreach_cb, void *user_data)
5547 if (camera == NULL || foreach_cb == NULL) {
5548 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5549 return CAMERA_ERROR_INVALID_PARAMETER;
5551 int ret = CAMERA_ERROR_NONE;
5553 camera_cli_s *pc = (camera_cli_s *)camera;
5554 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FPS_BY_RESOLUTION;
5556 if (pc->cb_info == NULL) {
5557 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5558 return CAMERA_ERROR_INVALID_PARAMETER;
5560 sock_fd = pc->cb_info->fd;
5561 LOGD("Enter, handle :%x", pc->remote_handle);
5562 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS_BY_RESOLUTION] = foreach_cb;
5563 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS_BY_RESOLUTION] = user_data;
5565 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, width, INT, height);
5566 LOGD("ret : 0x%x", ret);
5570 int camera_attr_foreach_supported_stream_flip(camera_h camera, camera_attr_supported_stream_flip_cb foreach_cb, void *user_data)
5572 if (camera == NULL || foreach_cb == NULL) {
5573 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5574 return CAMERA_ERROR_INVALID_PARAMETER;
5576 int ret = CAMERA_ERROR_NONE;
5578 camera_cli_s *pc = (camera_cli_s *)camera;
5579 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_STREAM_FLIP;
5581 if (pc->cb_info == NULL) {
5582 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5583 return CAMERA_ERROR_INVALID_PARAMETER;
5585 sock_fd = pc->cb_info->fd;
5586 LOGD("Enter, handle :%x", pc->remote_handle);
5587 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_FLIP] = foreach_cb;
5588 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_FLIP] = user_data;
5590 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5591 LOGD("ret : 0x%x", ret);
5596 int camera_attr_foreach_supported_stream_rotation(camera_h camera, camera_attr_supported_stream_rotation_cb foreach_cb, void *user_data)
5598 if (camera == NULL || foreach_cb == NULL) {
5599 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5600 return CAMERA_ERROR_INVALID_PARAMETER;
5602 int ret = CAMERA_ERROR_NONE;
5604 camera_cli_s *pc = (camera_cli_s *)camera;
5605 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_STREAM_ROTATION;
5607 if (pc->cb_info == NULL) {
5608 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5609 return CAMERA_ERROR_INVALID_PARAMETER;
5611 sock_fd = pc->cb_info->fd;
5612 LOGD("Enter, handle :%x", pc->remote_handle);
5613 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION] = foreach_cb;
5614 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION] = user_data;
5616 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5617 LOGD("ret : 0x%x", ret);
5622 int camera_attr_set_stream_rotation(camera_h camera , camera_rotation_e rotation)
5624 if (camera == NULL) {
5625 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5626 return CAMERA_ERROR_INVALID_PARAMETER;
5629 int ret = CAMERA_ERROR_NONE;
5630 camera_cli_s *pc = (camera_cli_s *)camera;
5631 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_STREAM_ROTATION;
5633 if (pc->cb_info == NULL) {
5634 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5635 return CAMERA_ERROR_INVALID_PARAMETER;
5637 sock_fd = pc->cb_info->fd;
5638 int set_rotation = (int)rotation;
5640 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5641 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_rotation);
5642 LOGD("ret : 0x%x", ret);
5647 int camera_attr_get_stream_rotation(camera_h camera , camera_rotation_e *rotation)
5649 if (camera == NULL || rotation == NULL) {
5650 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5651 return CAMERA_ERROR_INVALID_PARAMETER;
5654 int ret = CAMERA_ERROR_NONE;
5655 camera_cli_s *pc = (camera_cli_s *)camera;
5656 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_STREAM_ROTATION;
5658 if (pc->cb_info == NULL) {
5659 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5660 return CAMERA_ERROR_INVALID_PARAMETER;
5662 sock_fd = pc->cb_info->fd;
5665 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5666 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5668 if (ret == CAMERA_ERROR_NONE) {
5669 muse_camera_msg_get(get_rotation, pc->cb_info->recv_msg);
5670 *rotation = (camera_rotation_e)get_rotation;
5672 LOGD("ret : 0x%x", ret);
5677 int camera_attr_set_stream_flip(camera_h camera , camera_flip_e flip)
5679 if (camera == NULL) {
5680 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5681 return CAMERA_ERROR_INVALID_PARAMETER;
5684 int ret = CAMERA_ERROR_NONE;
5685 camera_cli_s *pc = (camera_cli_s *)camera;
5686 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_STREAM_FLIP;
5688 if (pc->cb_info == NULL) {
5689 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5690 return CAMERA_ERROR_INVALID_PARAMETER;
5692 sock_fd = pc->cb_info->fd;
5693 int set_flip = (int)flip;
5695 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5696 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_flip);
5697 LOGD("ret : 0x%x", ret);
5702 int camera_attr_get_stream_flip(camera_h camera , camera_flip_e *flip)
5704 if (camera == NULL || flip == NULL) {
5705 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5706 return CAMERA_ERROR_INVALID_PARAMETER;
5709 int ret = CAMERA_ERROR_NONE;
5710 camera_cli_s *pc = (camera_cli_s *)camera;
5711 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_STREAM_FLIP;
5713 if (pc->cb_info == NULL) {
5714 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5715 return CAMERA_ERROR_INVALID_PARAMETER;
5717 sock_fd = pc->cb_info->fd;
5720 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5721 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5723 if (ret == CAMERA_ERROR_NONE) {
5724 muse_camera_msg_get(get_flip, pc->cb_info->recv_msg);
5725 *flip = (camera_flip_e)get_flip;
5727 LOGD("ret : 0x%x", ret);
5731 int camera_attr_set_hdr_mode(camera_h camera, camera_attr_hdr_mode_e mode)
5733 if (camera == NULL) {
5734 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5735 return CAMERA_ERROR_INVALID_PARAMETER;
5738 int ret = CAMERA_ERROR_NONE;
5739 camera_cli_s *pc = (camera_cli_s *)camera;
5740 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_HDR_MODE;
5742 if (pc->cb_info == NULL) {
5743 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5744 return CAMERA_ERROR_INVALID_PARAMETER;
5746 sock_fd = pc->cb_info->fd;
5747 int set_mode = (int)mode;
5749 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5750 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
5751 LOGD("ret : 0x%x", ret);
5756 int camera_attr_get_hdr_mode(camera_h camera, camera_attr_hdr_mode_e *mode)
5758 if (camera == NULL) {
5759 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5760 return CAMERA_ERROR_INVALID_PARAMETER;
5763 LOGE("INVALID_PARAMETER(0x%08x) - mode", CAMERA_ERROR_INVALID_PARAMETER);
5764 return CAMERA_ERROR_INVALID_PARAMETER;
5766 int ret = CAMERA_ERROR_NONE;
5767 camera_cli_s *pc = (camera_cli_s *)camera;
5768 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_HDR_MODE;
5770 if (pc->cb_info == NULL) {
5771 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5772 return CAMERA_ERROR_INVALID_PARAMETER;
5774 sock_fd = pc->cb_info->fd;
5777 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5778 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5780 if (ret == CAMERA_ERROR_NONE) {
5781 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
5782 *mode = (camera_attr_hdr_mode_e)get_mode;
5784 LOGD("ret : 0x%x", ret);
5789 bool camera_attr_is_supported_hdr_capture(camera_h camera)
5791 if (camera == NULL) {
5792 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5796 int ret = CAMERA_ERROR_NONE;
5797 camera_cli_s *pc = (camera_cli_s *)camera;
5798 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_HDR_CAPTURE;
5800 if (pc->cb_info == NULL) {
5801 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5802 return CAMERA_ERROR_INVALID_PARAMETER;
5804 sock_fd = pc->cb_info->fd;
5805 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5806 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5807 LOGD("ret : 0x%x", ret);
5812 int camera_attr_set_hdr_capture_progress_cb(camera_h camera, camera_attr_hdr_progress_cb callback, void *user_data)
5814 int ret = CAMERA_ERROR_NONE;
5815 camera_cli_s *pc = (camera_cli_s *)camera;
5816 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_HDR_CAPTURE_PROGRESS_CB;
5819 if (camera == NULL) {
5820 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5821 return CAMERA_ERROR_INVALID_PARAMETER;
5824 if (pc->cb_info == NULL) {
5825 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5826 return CAMERA_ERROR_INVALID_PARAMETER;
5829 sock_fd = pc->cb_info->fd;
5831 LOGD("Enter, handle :%x", pc->remote_handle);
5833 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5835 if (ret == CAMERA_ERROR_NONE) {
5836 if (callback == NULL) {
5837 LOGE("INVALID_PARAMETER(0x%08x) - callback", CAMERA_ERROR_INVALID_PARAMETER);
5838 return CAMERA_ERROR_INVALID_PARAMETER;
5841 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = callback;
5842 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = user_data;
5845 LOGD("ret : 0x%x", ret);
5851 int camera_attr_unset_hdr_capture_progress_cb(camera_h camera)
5853 if (camera == NULL) {
5854 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5855 return CAMERA_ERROR_INVALID_PARAMETER;
5858 int ret = CAMERA_ERROR_NONE;
5860 camera_cli_s *pc = (camera_cli_s *)camera;
5861 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_UNSET_HDR_CAPTURE_PROGRESS_CB;
5863 if (pc->cb_info == NULL) {
5864 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5865 return CAMERA_ERROR_INVALID_PARAMETER;
5867 sock_fd = pc->cb_info->fd;
5868 LOGD("Enter, handle :%x", pc->remote_handle);
5870 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = (void *)NULL;
5871 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = (void *)NULL;
5873 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5874 LOGD("ret : 0x%x", ret);
5879 int camera_attr_enable_anti_shake(camera_h camera, bool enable)
5881 if (camera == NULL) {
5882 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5883 return CAMERA_ERROR_INVALID_PARAMETER;
5886 int ret = CAMERA_ERROR_NONE;
5887 camera_cli_s *pc = (camera_cli_s *)camera;
5888 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_ANTI_SHAKE;
5890 if (pc->cb_info == NULL) {
5891 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5892 return CAMERA_ERROR_INVALID_PARAMETER;
5894 sock_fd = pc->cb_info->fd;
5895 int set_enable = (int)enable;
5897 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5898 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
5899 LOGD("ret : 0x%x", ret);
5904 int camera_attr_is_enabled_anti_shake(camera_h camera , bool *enabled)
5906 if (camera == NULL) {
5907 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5908 return CAMERA_ERROR_INVALID_PARAMETER;
5910 if (enabled == NULL) {
5911 LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER);
5912 return CAMERA_ERROR_INVALID_PARAMETER;
5914 int ret = CAMERA_ERROR_NONE;
5915 camera_cli_s *pc = (camera_cli_s *)camera;
5916 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_ANTI_SHAKE;
5918 if (pc->cb_info == NULL) {
5919 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5920 return CAMERA_ERROR_INVALID_PARAMETER;
5922 sock_fd = pc->cb_info->fd;
5925 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5926 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5928 if (ret == CAMERA_ERROR_NONE) {
5929 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
5930 *enabled = (bool)get_enabled;
5932 LOGD("ret : 0x%x", ret);
5937 bool camera_attr_is_supported_anti_shake(camera_h camera)
5940 if (camera == NULL) {
5941 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5945 int ret = CAMERA_ERROR_NONE;
5946 camera_cli_s *pc = (camera_cli_s *)camera;
5947 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_ANTI_SHAKE;
5949 if (pc->cb_info == NULL) {
5950 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5951 return CAMERA_ERROR_INVALID_PARAMETER;
5953 sock_fd = pc->cb_info->fd;
5954 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5955 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5956 LOGD("ret : 0x%x", ret);
5961 int camera_attr_enable_video_stabilization(camera_h camera, bool enable)
5963 if (camera == NULL) {
5964 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5965 return CAMERA_ERROR_INVALID_PARAMETER;
5968 int ret = CAMERA_ERROR_NONE;
5969 camera_cli_s *pc = (camera_cli_s *)camera;
5970 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_VIDEO_STABILIZATION;
5972 if (pc->cb_info == NULL) {
5973 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5974 return CAMERA_ERROR_INVALID_PARAMETER;
5976 sock_fd = pc->cb_info->fd;
5977 int set_enable = (int)enable;
5979 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5980 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
5981 LOGD("ret : 0x%x", ret);
5986 int camera_attr_is_enabled_video_stabilization(camera_h camera, bool *enabled)
5988 if (camera == NULL) {
5989 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5990 return CAMERA_ERROR_INVALID_PARAMETER;
5992 if (enabled == NULL) {
5993 LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER);
5994 return CAMERA_ERROR_INVALID_PARAMETER;
5996 int ret = CAMERA_ERROR_NONE;
5997 camera_cli_s *pc = (camera_cli_s *)camera;
5998 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_VIDEO_STABILIZATION;
6000 if (pc->cb_info == NULL) {
6001 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6002 return CAMERA_ERROR_INVALID_PARAMETER;
6004 sock_fd = pc->cb_info->fd;
6007 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6008 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6010 if (ret == CAMERA_ERROR_NONE) {
6011 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
6012 *enabled = (bool)get_enabled;
6014 LOGD("ret : 0x%x", ret);
6019 bool camera_attr_is_supported_video_stabilization(camera_h camera)
6021 if (camera == NULL) {
6022 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6026 int ret = CAMERA_ERROR_NONE;
6027 camera_cli_s *pc = (camera_cli_s *)camera;
6028 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_VIDEO_STABILIZATION;
6030 if (pc->cb_info == NULL) {
6031 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6032 return CAMERA_ERROR_INVALID_PARAMETER;
6034 sock_fd = pc->cb_info->fd;
6035 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6036 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6037 LOGD("ret : 0x%x", ret);
6042 int camera_attr_enable_auto_contrast(camera_h camera, bool enable)
6044 if (camera == NULL) {
6045 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6046 return CAMERA_ERROR_INVALID_PARAMETER;
6049 int ret = CAMERA_ERROR_NONE;
6050 camera_cli_s *pc = (camera_cli_s *)camera;
6051 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_AUTO_CONTRAST;
6053 if (pc->cb_info == NULL) {
6054 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6055 return CAMERA_ERROR_INVALID_PARAMETER;
6057 sock_fd = pc->cb_info->fd;
6058 int set_enable = (int)enable;
6060 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6061 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
6062 LOGD("ret : 0x%x", ret);
6067 int camera_attr_is_enabled_auto_contrast(camera_h camera, bool *enabled)
6069 if (camera == NULL) {
6070 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
6071 return CAMERA_ERROR_INVALID_PARAMETER;
6073 if (enabled == NULL) {
6074 LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER);
6075 return CAMERA_ERROR_INVALID_PARAMETER;
6077 int ret = CAMERA_ERROR_NONE;
6078 camera_cli_s *pc = (camera_cli_s *)camera;
6079 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_AUTO_CONTRAST;
6081 if (pc->cb_info == NULL) {
6082 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6083 return CAMERA_ERROR_INVALID_PARAMETER;
6085 sock_fd = pc->cb_info->fd;
6088 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6089 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6091 if (ret == CAMERA_ERROR_NONE) {
6092 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
6093 *enabled = (bool)get_enabled;
6095 LOGD("ret : 0x%x", ret);
6100 bool camera_attr_is_supported_auto_contrast(camera_h camera)
6102 if (camera == NULL) {
6103 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6107 int ret = CAMERA_ERROR_NONE;
6108 camera_cli_s *pc = (camera_cli_s *)camera;
6109 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_AUTO_CONTRAST;
6111 if (pc->cb_info == NULL) {
6112 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6113 return CAMERA_ERROR_INVALID_PARAMETER;
6115 sock_fd = pc->cb_info->fd;
6116 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6117 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6118 LOGD("ret : 0x%x", ret);
6123 int camera_attr_disable_shutter_sound(camera_h camera, bool disable)
6125 if (camera == NULL) {
6126 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6127 return CAMERA_ERROR_INVALID_PARAMETER;
6130 int ret = CAMERA_ERROR_NONE;
6131 camera_cli_s *pc = (camera_cli_s *)camera;
6132 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_DISABLE_SHUTTER_SOUND;
6134 if (pc->cb_info == NULL) {
6135 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6136 return CAMERA_ERROR_INVALID_PARAMETER;
6138 sock_fd = pc->cb_info->fd;
6139 int set_disable = (int)disable;
6141 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6142 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_disable);
6143 LOGD("ret : 0x%x", ret);
6148 int camera_attr_set_pan(camera_h camera, camera_attr_ptz_move_type_e move_type, int pan_step)
6150 if (camera == NULL) {
6151 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6152 return CAMERA_ERROR_INVALID_PARAMETER;
6155 camera_cli_s *pc = (camera_cli_s *)camera;
6156 if (pc->cb_info == NULL) {
6157 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6158 return CAMERA_ERROR_INVALID_PARAMETER;
6161 int ret = CAMERA_ERROR_NONE;
6162 int sock_fd = pc->cb_info->fd;
6163 int set_move_type = (int)move_type;
6164 int set_pan_step = pan_step;
6165 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_PAN;
6167 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6168 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, set_move_type, INT, set_pan_step);
6169 LOGD("ret : 0x%x", ret);
6174 int camera_attr_get_pan(camera_h camera, int *pan_step)
6176 if (camera == NULL || pan_step == NULL) {
6177 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6178 return CAMERA_ERROR_INVALID_PARAMETER;
6181 camera_cli_s *pc = (camera_cli_s *)camera;
6182 if (pc->cb_info == NULL) {
6183 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6184 return CAMERA_ERROR_INVALID_PARAMETER;
6187 int ret = CAMERA_ERROR_NONE;
6188 int sock_fd = pc->cb_info->fd;
6190 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_PAN;
6192 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6193 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6195 if (ret == CAMERA_ERROR_NONE) {
6196 muse_camera_msg_get(get_pan_step, pc->cb_info->recv_msg);
6197 *pan_step = get_pan_step;
6199 LOGD("ret : 0x%x", ret);
6204 int camera_attr_get_pan_range(camera_h camera, int *min, int *max)
6206 if (camera == NULL || min == NULL || max == NULL) {
6207 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6208 return CAMERA_ERROR_INVALID_PARAMETER;
6211 camera_cli_s *pc = (camera_cli_s *)camera;
6212 if (pc->cb_info == NULL) {
6213 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6214 return CAMERA_ERROR_INVALID_PARAMETER;
6217 int ret = CAMERA_ERROR_NONE;
6218 int sock_fd = pc->cb_info->fd;
6221 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_PAN_RANGE;
6223 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6224 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6226 if (ret == CAMERA_ERROR_NONE) {
6227 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
6228 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
6232 LOGD("ret : 0x%x", ret);
6237 int camera_attr_set_tilt(camera_h camera, camera_attr_ptz_move_type_e move_type, int tilt_step)
6239 if (camera == NULL) {
6240 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6241 return CAMERA_ERROR_INVALID_PARAMETER;
6244 camera_cli_s *pc = (camera_cli_s *)camera;
6245 if (pc->cb_info == NULL) {
6246 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6247 return CAMERA_ERROR_INVALID_PARAMETER;
6250 int ret = CAMERA_ERROR_NONE;
6251 int sock_fd = pc->cb_info->fd;
6252 int set_move_type = (int)move_type;
6253 int set_tilt_step = tilt_step;
6254 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TILT;
6256 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6257 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, set_move_type, INT, set_tilt_step);
6258 LOGD("ret : 0x%x", ret);
6263 int camera_attr_get_tilt(camera_h camera, int *tilt_step)
6265 if (camera == NULL || tilt_step == NULL) {
6266 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6267 return CAMERA_ERROR_INVALID_PARAMETER;
6270 camera_cli_s *pc = (camera_cli_s *)camera;
6271 if (pc->cb_info == NULL) {
6272 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6273 return CAMERA_ERROR_INVALID_PARAMETER;
6276 int ret = CAMERA_ERROR_NONE;
6277 int sock_fd = pc->cb_info->fd;
6279 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TILT;
6281 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6282 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6284 if (ret == CAMERA_ERROR_NONE) {
6285 muse_camera_msg_get(get_tilt_step, pc->cb_info->recv_msg);
6286 *tilt_step = get_tilt_step;
6288 LOGD("ret : 0x%x", ret);
6293 int camera_attr_get_tilt_range(camera_h camera, int *min, int *max)
6295 if (camera == NULL || min == NULL || max == NULL) {
6296 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6297 return CAMERA_ERROR_INVALID_PARAMETER;
6300 camera_cli_s *pc = (camera_cli_s *)camera;
6301 if (pc->cb_info == NULL) {
6302 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6303 return CAMERA_ERROR_INVALID_PARAMETER;
6306 int ret = CAMERA_ERROR_NONE;
6307 int sock_fd = pc->cb_info->fd;
6310 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TILT_RANGE;
6312 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6313 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6315 if (ret == CAMERA_ERROR_NONE) {
6316 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
6317 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
6321 LOGD("ret : 0x%x", ret);
6326 int camera_attr_set_ptz_type(camera_h camera, camera_attr_ptz_type_e ptz_type)
6328 if (camera == NULL) {
6329 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6330 return CAMERA_ERROR_INVALID_PARAMETER;
6333 camera_cli_s *pc = (camera_cli_s *)camera;
6334 if (pc->cb_info == NULL) {
6335 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6336 return CAMERA_ERROR_INVALID_PARAMETER;
6339 int ret = CAMERA_ERROR_NONE;
6340 int sock_fd = pc->cb_info->fd;
6341 int set_ptz_type = (int)ptz_type;
6342 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_PTZ_TYPE;
6344 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6345 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_ptz_type);
6346 LOGD("ret : 0x%x", ret);
6351 int camera_attr_foreach_supported_ptz_type(camera_h camera, camera_attr_supported_ptz_type_cb foreach_cb, void *user_data)
6353 if (camera == NULL || foreach_cb == NULL) {
6354 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6355 return CAMERA_ERROR_INVALID_PARAMETER;
6357 int ret = CAMERA_ERROR_NONE;
6359 camera_cli_s *pc = (camera_cli_s *)camera;
6360 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_PTZ_TYPE;
6362 if (pc->cb_info == NULL) {
6363 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6364 return CAMERA_ERROR_INVALID_PARAMETER;
6366 sock_fd = pc->cb_info->fd;
6367 LOGD("Enter, handle :%x", pc->remote_handle);
6368 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PTZ_TYPE] = foreach_cb;
6369 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PTZ_TYPE] = user_data;
6371 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6372 LOGD("ret : 0x%x", ret);
6377 int camera_attr_set_display_roi_area(camera_h camera, int x, int y, int width, int height)
6379 if (camera == NULL) {
6380 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6381 return CAMERA_ERROR_INVALID_PARAMETER;
6384 camera_cli_s *pc = (camera_cli_s *)camera;
6385 if (pc->cb_info == NULL) {
6386 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6387 return CAMERA_ERROR_INVALID_PARAMETER;
6390 int ret = CAMERA_ERROR_NONE;
6391 int sock_fd = pc->cb_info->fd;
6392 int set_display_roi_area[4] = {x, y, width, height};
6393 muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY_ROI_AREA;
6395 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6397 #ifdef EVAS_RENDERER_SUPPORT
6398 if(CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
6399 g_mutex_lock(&pc->cb_info->evas_mutex);
6401 ret = mm_evas_renderer_set_roi_area(pc->cb_info->evas_info, x, y, width, height);
6403 g_mutex_unlock(&pc->cb_info->evas_mutex);
6405 if (ret != MM_ERROR_NONE) {
6406 LOGE("mm_evas_renderer_set_roi_area error 0x%x", ret);
6407 return CAMERA_ERROR_INVALID_OPERATION;
6410 #endif /* EVAS_RENDERER_SUPPORT */
6412 muse_camera_msg_send_array(api, sock_fd, pc->cb_info, ret,
6413 set_display_roi_area, sizeof(set_display_roi_area), sizeof(int));
6415 LOGD("ret : 0x%x", ret);
6421 int camera_attr_get_display_roi_area(camera_h camera, int *x, int *y, int *width, int *height)
6423 if (camera == NULL || x == NULL || y == NULL || width == NULL || height == NULL) {
6424 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6425 return CAMERA_ERROR_INVALID_PARAMETER;
6428 camera_cli_s *pc = (camera_cli_s *)camera;
6429 if (pc->cb_info == NULL) {
6430 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6431 return CAMERA_ERROR_INVALID_PARAMETER;
6434 int ret = CAMERA_ERROR_NONE;
6435 int sock_fd = pc->cb_info->fd;
6436 int get_display_roi_area[4] = {0,};
6437 muse_camera_api_e api = MUSE_CAMERA_API_GET_DISPLAY_ROI_AREA;
6439 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6441 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6443 if (ret == CAMERA_ERROR_NONE) {
6444 muse_camera_msg_get_array(get_display_roi_area, pc->cb_info->recv_msg);
6446 *x = get_display_roi_area[0];
6447 *y = get_display_roi_area[1];
6448 *width = get_display_roi_area[2];
6449 *height = get_display_roi_area[3];
6451 LOGD("ret : 0x%x", ret);
6453 LOGE("Returned value is not valid : 0x%x", ret);