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>
34 #include <Ecore_Wayland.h>
35 #include <wayland-client.h>
36 #include <tizen-extension-client-protocol.h>
37 #ifdef TIZEN_FEATURE_EVAS_RENDERER
38 #include <mm_evas_renderer.h>
39 #endif /* TIZEN_FEATURE_EVAS_RENDERER */
44 #define LOG_TAG "TIZEN_N_CAMERA"
47 static void __global(void *data, struct wl_registry *registry,
48 uint32_t name, const char *interface, uint32_t version)
50 struct tizen_surface **tz_surface = NULL;
57 tz_surface = (struct tizen_surface **)data;
60 LOGW("NULL interface");
64 /*LOGI("interface %s", interface);*/
66 if (strcmp(interface, "tizen_surface") == 0) {
67 LOGD("binding tizen surface for wayland");
69 *tz_surface = wl_registry_bind(registry, name, &tizen_surface_interface, version);
70 if (*tz_surface == NULL)
71 LOGE("failed to bind");
79 static void __global_remove(void *data, struct wl_registry *wl_registry, uint32_t name)
85 static const struct wl_registry_listener _camera_wl_registry_listener = {
90 void __parent_id_getter(void *data, struct tizen_resource *tizen_resource, uint32_t id)
97 *((unsigned int *)data) = id;
99 LOGD("[CLIENT] got parent_id [%u] from server", id);
104 static const struct tizen_resource_listener _camera_tz_resource_listener = {
108 int _get_wl_info(Evas_Object *obj, camera_wl_info_s *wl_info)
110 int ret = CAMERA_ERROR_NONE;
111 Ecore_Wl_Window *window = NULL;
112 struct wl_display *display = NULL;
113 struct wl_surface *surface = NULL;
114 struct wl_registry *registry = NULL;
115 struct tizen_surface *tz_surface = NULL;
116 struct tizen_resource *tz_resource = NULL;
118 if (!obj || !wl_info) {
119 LOGE("NULL parameter %p %p", obj, wl_info);
120 return CAMERA_ERROR_INVALID_OPERATION;
123 window = elm_win_wl_window_get(obj);
125 LOGE("failed to get wayland window");
126 ret = CAMERA_ERROR_INVALID_OPERATION;
130 surface = (struct wl_surface *)ecore_wl_window_surface_get(window);
132 LOGE("failed to get wayland surface");
133 ret = CAMERA_ERROR_INVALID_OPERATION;
137 display = (struct wl_display *)ecore_wl_display_get();
139 LOGE("failed to get wayland display");
140 ret = CAMERA_ERROR_INVALID_OPERATION;
144 registry = wl_display_get_registry(display);
146 LOGE("failed to get wayland registry");
147 ret = CAMERA_ERROR_INVALID_OPERATION;
151 wl_registry_add_listener(registry, &_camera_wl_registry_listener, &tz_surface);
153 wl_display_dispatch(display);
154 wl_display_roundtrip(display);
157 LOGE("failed to get tizen surface");
158 ret = CAMERA_ERROR_INVALID_OPERATION;
162 /* Get parent_id which is unique in a entire systemw. */
163 tz_resource = tizen_surface_get_tizen_resource(tz_surface, surface);
165 LOGE("failed to get tizen resurce");
166 ret = CAMERA_ERROR_INVALID_OPERATION;
170 wl_info->parent_id = 0;
172 tizen_resource_add_listener(tz_resource, &_camera_tz_resource_listener, &wl_info->parent_id);
174 wl_display_roundtrip(display);
176 if (wl_info->parent_id > 0) {
178 Ecore_Evas *ecore_evas = NULL;
179 ret = CAMERA_ERROR_NONE;
181 wl_info->evas_obj = obj;
183 evas_object_geometry_get(obj, &wl_info->window_x, &wl_info->window_y,
184 &wl_info->window_width, &wl_info->window_height);
186 ecore_evas = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
188 rotation = ecore_evas_rotation_get(ecore_evas);
189 if (rotation == 90 || rotation == 270) {
190 int temp = wl_info->window_width;
192 LOGD("swap width and height %d, %d", wl_info->window_width, wl_info->window_height);
194 wl_info->window_width = wl_info->window_height;
195 wl_info->window_height = temp;
198 LOGW("failed to get ecore_evas.. skip rotation check");
201 LOGD("evas object : %p, rotation : %d, parent id : %u, window : %d,%d,%dx%d",
202 wl_info->evas_obj, rotation, wl_info->parent_id,
203 wl_info->window_x, wl_info->window_y,
204 wl_info->window_width, wl_info->window_height);
206 ret = CAMERA_ERROR_INVALID_OPERATION;
207 LOGE("failed to get parent id");
212 tizen_surface_destroy(tz_surface);
217 tizen_resource_destroy(tz_resource);
222 wl_registry_destroy(registry);
229 static int _import_tbm_key(tbm_bufmgr bufmgr, unsigned int tbm_key, tbm_bo *bo, tbm_bo_handle *bo_handle)
231 tbm_bo tmp_bo = NULL;
232 tbm_bo_handle tmp_bo_handle = {NULL, };
234 if (bufmgr == NULL || bo == NULL || bo_handle == NULL || tbm_key == 0) {
235 LOGE("invalid parameter - bufmgr %p, bo %p, bo_handle %p, key %d",
236 bufmgr, bo, bo_handle, tbm_key);
240 tmp_bo = tbm_bo_import(bufmgr, tbm_key);
241 if (tmp_bo == NULL) {
242 LOGE("bo import failed - bufmgr %p, key %d", bufmgr, tbm_key);
246 tmp_bo_handle = tbm_bo_map(tmp_bo, TBM_DEVICE_CPU, TBM_OPTION_READ);
247 if (tmp_bo_handle.ptr == NULL) {
248 LOGE("bo map failed %p", tmp_bo);
249 tbm_bo_unref(tmp_bo);
254 tbm_bo_unmap(tmp_bo);
256 /* set bo and bo_handle */
258 *bo_handle = tmp_bo_handle;
263 static void _release_imported_bo(tbm_bo *bo)
265 if (bo == NULL || *bo == NULL) {
276 static int _client_wait_for_cb_return(muse_camera_api_e api, camera_cb_info_s *cb_info, int time_out)
278 int ret = CAMERA_ERROR_NONE;
281 /*LOGD("Enter api : %d", api);*/
283 g_mutex_lock(&(cb_info->api_mutex[api]));
285 if (cb_info->api_activating[api] == 0) {
286 end_time = g_get_monotonic_time() + time_out * G_TIME_SPAN_SECOND;
287 if (g_cond_wait_until(&(cb_info->api_cond[api]), &(cb_info->api_mutex[api]), end_time)) {
288 ret = cb_info->api_ret[api];
289 cb_info->api_activating[api] = 0;
291 /*LOGD("return value : 0x%x", ret);*/
293 ret = CAMERA_ERROR_INVALID_OPERATION;
294 LOGE("api %d was TIMED OUT!", api);
297 ret = cb_info->api_ret[api];
298 cb_info->api_activating[api] = 0;
300 /*LOGD("condition is already checked for the api[%d], return[0x%x]", api, ret);*/
303 g_mutex_unlock(&(cb_info->api_mutex[api]));
308 int _camera_get_tbm_surface_format(int in_format, uint32_t *out_format)
310 if (in_format <= MM_PIXEL_FORMAT_INVALID ||
311 in_format >= MM_PIXEL_FORMAT_NUM ||
312 out_format == NULL) {
313 LOGE("INVALID_PARAMETER : in_format %d, out_format ptr %p", in_format, out_format);
314 return CAMERA_ERROR_INVALID_PARAMETER;
318 case MM_PIXEL_FORMAT_NV12:
319 case MM_PIXEL_FORMAT_NV12T:
320 *out_format = TBM_FORMAT_NV12;
322 case MM_PIXEL_FORMAT_NV16:
323 *out_format = TBM_FORMAT_NV16;
325 case MM_PIXEL_FORMAT_NV21:
326 *out_format = TBM_FORMAT_NV21;
328 case MM_PIXEL_FORMAT_YUYV:
329 *out_format = TBM_FORMAT_YUYV;
331 case MM_PIXEL_FORMAT_UYVY:
332 case MM_PIXEL_FORMAT_ITLV_JPEG_UYVY:
333 *out_format = TBM_FORMAT_UYVY;
335 case MM_PIXEL_FORMAT_422P:
336 *out_format = TBM_FORMAT_YUV422;
338 case MM_PIXEL_FORMAT_I420:
339 *out_format = TBM_FORMAT_YUV420;
341 case MM_PIXEL_FORMAT_YV12:
342 *out_format = TBM_FORMAT_YVU420;
344 case MM_PIXEL_FORMAT_RGB565:
345 *out_format = TBM_FORMAT_RGB565;
347 case MM_PIXEL_FORMAT_RGB888:
348 *out_format = TBM_FORMAT_RGB888;
350 case MM_PIXEL_FORMAT_RGBA:
351 *out_format = TBM_FORMAT_RGBA8888;
353 case MM_PIXEL_FORMAT_ARGB:
354 *out_format = TBM_FORMAT_ARGB8888;
357 LOGE("invalid in_format %d", in_format);
358 return CAMERA_ERROR_INVALID_PARAMETER;
361 return CAMERA_ERROR_NONE;
365 int _camera_get_media_packet_mimetype(int in_format, media_format_mimetype_e *mimetype)
367 if (in_format <= MM_PIXEL_FORMAT_INVALID ||
368 in_format >= MM_PIXEL_FORMAT_NUM ||
370 LOGE("INVALID_PARAMETER : in_format %d, mimetype ptr %p", in_format, mimetype);
371 return CAMERA_ERROR_INVALID_PARAMETER;
375 case MM_PIXEL_FORMAT_NV12:
376 case MM_PIXEL_FORMAT_NV12T:
377 *mimetype = MEDIA_FORMAT_NV12;
379 case MM_PIXEL_FORMAT_NV16:
380 *mimetype = MEDIA_FORMAT_NV16;
382 case MM_PIXEL_FORMAT_NV21:
383 *mimetype = MEDIA_FORMAT_NV21;
385 case MM_PIXEL_FORMAT_YUYV:
386 *mimetype = MEDIA_FORMAT_YUYV;
388 case MM_PIXEL_FORMAT_UYVY:
389 case MM_PIXEL_FORMAT_ITLV_JPEG_UYVY:
390 *mimetype = MEDIA_FORMAT_UYVY;
392 case MM_PIXEL_FORMAT_422P:
393 *mimetype = MEDIA_FORMAT_422P;
395 case MM_PIXEL_FORMAT_I420:
396 *mimetype = MEDIA_FORMAT_I420;
398 case MM_PIXEL_FORMAT_YV12:
399 *mimetype = MEDIA_FORMAT_YV12;
401 case MM_PIXEL_FORMAT_RGB565:
402 *mimetype = MEDIA_FORMAT_RGB565;
404 case MM_PIXEL_FORMAT_RGB888:
405 *mimetype = MEDIA_FORMAT_RGB888;
407 case MM_PIXEL_FORMAT_RGBA:
408 *mimetype = MEDIA_FORMAT_RGBA;
410 case MM_PIXEL_FORMAT_ARGB:
411 *mimetype = MEDIA_FORMAT_ARGB;
414 LOGE("invalid in_format %d", in_format);
415 return CAMERA_ERROR_INVALID_PARAMETER;
418 return CAMERA_ERROR_NONE;
421 void _camera_preview_frame_create(camera_stream_data_s *stream, int num_buffer_key,
422 tbm_bo_handle *buffer_bo_handle, tbm_bo_handle *data_bo_handle, camera_preview_data_s *frame)
425 unsigned char *buf_pos = NULL;
427 if (stream == NULL || buffer_bo_handle == NULL || frame == NULL) {
428 LOGE("invalid parameter - stream:%p, buffer_bo_handle:%p", stream, buffer_bo_handle);
433 if (stream->format == MM_PIXEL_FORMAT_ITLV_JPEG_UYVY)
434 frame->format = MM_PIXEL_FORMAT_UYVY;
436 frame->format = stream->format;
438 frame->width = stream->width;
439 frame->height = stream->height;
440 frame->timestamp = stream->timestamp;
441 frame->num_of_planes = stream->num_planes;
443 if (num_buffer_key == 0) {
445 if (data_bo_handle == NULL || data_bo_handle->ptr == NULL) {
446 LOGE("no data pointer");
450 buf_pos = data_bo_handle->ptr;
452 if (stream->format == MM_PIXEL_FORMAT_ENCODED_H264) {
453 frame->data.encoded_plane.data = buf_pos;
454 frame->data.encoded_plane.size = stream->data.encoded.length_data;
455 total_size = stream->data.encoded.length_data;
457 switch (stream->num_planes) {
459 frame->data.single_plane.yuv = buf_pos;
460 frame->data.single_plane.size = stream->data.yuv420.length_yuv;
461 total_size = stream->data.yuv420.length_yuv;
464 frame->data.double_plane.y = buf_pos;
465 frame->data.double_plane.y_size = stream->data.yuv420sp.length_y;
466 buf_pos += stream->data.yuv420sp.length_y;
467 frame->data.double_plane.uv = buf_pos;
468 frame->data.double_plane.uv_size = stream->data.yuv420sp.length_uv;
469 total_size = stream->data.yuv420sp.length_y + \
470 stream->data.yuv420sp.length_uv;
473 frame->data.triple_plane.y = buf_pos;
474 frame->data.triple_plane.y_size = stream->data.yuv420p.length_y;
475 buf_pos += stream->data.yuv420p.length_y;
476 frame->data.triple_plane.u = buf_pos;
477 frame->data.triple_plane.u_size = stream->data.yuv420p.length_u;
478 buf_pos += stream->data.yuv420p.length_u;
479 frame->data.triple_plane.v = buf_pos;
480 frame->data.triple_plane.v_size = stream->data.yuv420p.length_v;
481 total_size = stream->data.yuv420p.length_y + \
482 stream->data.yuv420p.length_u + \
483 stream->data.yuv420p.length_v;
491 switch (stream->num_planes) {
493 frame->data.single_plane.yuv = buffer_bo_handle[0].ptr;
494 frame->data.single_plane.size = stream->data.yuv420.length_yuv;
495 total_size = stream->data.yuv420.length_yuv;
498 frame->data.double_plane.y = buffer_bo_handle[0].ptr;
499 if (stream->num_planes == (unsigned int)num_buffer_key)
500 frame->data.double_plane.uv = buffer_bo_handle[1].ptr;
502 frame->data.double_plane.uv = buffer_bo_handle[0].ptr + stream->data.yuv420sp.length_y;
503 frame->data.double_plane.y_size = stream->data.yuv420sp.length_y;
504 frame->data.double_plane.uv_size = stream->data.yuv420sp.length_uv;
505 total_size = stream->data.yuv420sp.length_y + \
506 stream->data.yuv420sp.length_uv;
509 frame->data.triple_plane.y = buffer_bo_handle[0].ptr;
510 if (stream->num_planes == (unsigned int)num_buffer_key) {
511 frame->data.triple_plane.u = buffer_bo_handle[1].ptr;
512 frame->data.triple_plane.v = buffer_bo_handle[2].ptr;
514 frame->data.triple_plane.u = buffer_bo_handle[0].ptr + stream->data.yuv420p.length_y;
515 frame->data.triple_plane.v = buffer_bo_handle[1].ptr + stream->data.yuv420p.length_u;
517 frame->data.triple_plane.y_size = stream->data.yuv420p.length_y;
518 frame->data.triple_plane.u_size = stream->data.yuv420p.length_u;
519 frame->data.triple_plane.v_size = stream->data.yuv420p.length_v;
520 total_size = stream->data.yuv420p.length_y + \
521 stream->data.yuv420p.length_u + \
522 stream->data.yuv420p.length_v;
530 LOGD("format %d, %dx%d, size %d plane num %d",
531 frame.format, frame.width, frame.height, total_size, frame.num_of_planes);
537 int _camera_media_packet_data_create(int tbm_key, int num_buffer_key, tbm_bo bo,
538 tbm_bo *buffer_bo, tbm_bo data_bo, camera_media_packet_data **mp_data)
541 int ret = CAMERA_ERROR_NONE;
542 camera_media_packet_data *tmp_mp_data = NULL;
544 if (*mp_data == NULL) {
545 tmp_mp_data = g_new0(camera_media_packet_data, 1);
547 tmp_mp_data->tbm_key = tbm_key;
548 tmp_mp_data->num_buffer_key = num_buffer_key;
549 tmp_mp_data->bo = bo;
550 tmp_mp_data->data_bo = data_bo;
551 tmp_mp_data->ref_cnt++;
553 for (i = 0 ; i < num_buffer_key ; i++)
554 tmp_mp_data->buffer_bo[i] = buffer_bo[i];
556 *mp_data = tmp_mp_data;
557 /*LOGD("mp_data %p", tmp_mp_data);*/
559 ret = CAMERA_ERROR_OUT_OF_MEMORY;
560 LOGE("failed to alloc media packet data");
563 ((camera_media_packet_data *)*mp_data)->ref_cnt++;
569 void _camera_media_packet_data_release(camera_media_packet_data *mp_data, camera_cb_info_s *cb_info)
574 if (mp_data == NULL || cb_info == NULL) {
575 LOGE("NULL data %p or cb_info %p", mp_data, cb_info);
579 if (mp_data->ref_cnt > 1) {
581 LOGD("mp_data is still referenced(current %d)", mp_data->ref_cnt);
583 /* release imported bo */
584 for (i = 0 ; i < mp_data->num_buffer_key ; i++) {
585 tbm_bo_unref(mp_data->buffer_bo[i]);
586 mp_data->buffer_bo[i] = NULL;
590 _release_imported_bo(&mp_data->bo);
591 _release_imported_bo(&mp_data->data_bo);
594 tbm_key = mp_data->tbm_key;
595 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
596 cb_info->fd, cb_info, INT, tbm_key);
605 int _camera_media_packet_create(camera_cb_info_s *cb_info, camera_stream_data_s *stream,
606 camera_media_packet_data *mp_data, media_packet_h *packet)
608 media_packet_h pkt = NULL;
609 bool make_pkt_fmt = false;
610 tbm_surface_h tsurf = NULL;
611 tbm_surface_info_s tsurf_info;
612 media_format_mimetype_e mimetype = MEDIA_FORMAT_NV12;
613 uint32_t bo_format = 0;
616 int num_buffer_key = 0;
617 tbm_bo *buffer_bo = NULL;
619 if (cb_info == NULL || stream == NULL || mp_data == NULL || packet == NULL) {
620 LOGE("invalid parameter - cb_info:%p, stream:%p, mp_data:%p, packet:%p",
621 cb_info, stream, mp_data, packet);
622 return CAMERA_ERROR_INVALID_PARAMETER;
625 memset(&tsurf_info, 0x0, sizeof(tbm_surface_info_s));
626 buffer_bo = mp_data->buffer_bo;
627 num_buffer_key = mp_data->num_buffer_key;
629 /* create tbm surface */
630 for (i = 0 ; i < BUFFER_MAX_PLANE_NUM ; i++)
631 tsurf_info.planes[i].stride = stream->stride[i];
633 /* get tbm surface format */
634 ret = _camera_get_tbm_surface_format(stream->format, &bo_format);
635 ret |= _camera_get_media_packet_mimetype(stream->format, &mimetype);
637 if (ret == CAMERA_ERROR_NONE) {
638 tsurf_info.width = stream->width;
639 tsurf_info.height = stream->height;
640 tsurf_info.format = bo_format;
641 tsurf_info.bpp = tbm_surface_internal_get_bpp(bo_format);
642 tsurf_info.num_planes = tbm_surface_internal_get_num_planes(bo_format);
644 if (num_buffer_key > 0) {
646 case TBM_FORMAT_NV12:
647 case TBM_FORMAT_NV21:
648 tsurf_info.planes[0].size = stream->stride[0] * stream->elevation[0];
649 tsurf_info.planes[1].size = stream->stride[1] * stream->elevation[1];
650 tsurf_info.planes[0].offset = 0;
651 if (num_buffer_key == 1)
652 tsurf_info.planes[1].offset = tsurf_info.planes[0].size;
653 tsurf_info.size = tsurf_info.planes[0].size + tsurf_info.planes[1].size;
655 case TBM_FORMAT_YUV420:
656 case TBM_FORMAT_YVU420:
657 tsurf_info.planes[0].size = stream->stride[0] * stream->elevation[0];
658 tsurf_info.planes[1].size = stream->stride[1] * stream->elevation[1];
659 tsurf_info.planes[2].size = stream->stride[2] * stream->elevation[2];
660 tsurf_info.planes[0].offset = 0;
661 if (num_buffer_key == 1) {
662 tsurf_info.planes[1].offset = tsurf_info.planes[0].size;
663 tsurf_info.planes[2].offset = tsurf_info.planes[0].size + tsurf_info.planes[1].size;
665 tsurf_info.size = tsurf_info.planes[0].size + tsurf_info.planes[1].size + tsurf_info.planes[2].size;
667 case TBM_FORMAT_UYVY:
668 case TBM_FORMAT_YUYV:
669 tsurf_info.planes[0].size = (stream->stride[0] * stream->elevation[0]) << 1;
670 tsurf_info.planes[0].offset = 0;
671 tsurf_info.size = tsurf_info.planes[0].size;
677 tsurf = tbm_surface_internal_create_with_bos(&tsurf_info, buffer_bo, num_buffer_key);
678 } else if (mp_data->data_bo) {
680 case TBM_FORMAT_NV12:
681 case TBM_FORMAT_NV21:
682 tsurf_info.planes[0].size = stream->width * stream->height;
683 tsurf_info.planes[1].size = (tsurf_info.planes[0].size) >> 1;
684 tsurf_info.planes[0].offset = 0;
685 tsurf_info.planes[1].offset = tsurf_info.planes[0].size;
686 tsurf_info.size = tsurf_info.planes[0].size + tsurf_info.planes[1].size;
688 case TBM_FORMAT_YUV420:
689 case TBM_FORMAT_YVU420:
690 tsurf_info.planes[0].size = stream->width * stream->height;
691 tsurf_info.planes[1].size = (stream->width >> 1) * (stream->height >> 1);
692 tsurf_info.planes[2].size = tsurf_info.planes[1].size;
693 tsurf_info.planes[0].offset = 0;
694 tsurf_info.planes[1].offset = tsurf_info.planes[0].size;
695 tsurf_info.planes[2].offset = tsurf_info.planes[0].size + tsurf_info.planes[1].size;
696 tsurf_info.size = tsurf_info.planes[0].size + tsurf_info.planes[1].size + tsurf_info.planes[2].size;
698 case TBM_FORMAT_UYVY:
699 case TBM_FORMAT_YUYV:
700 tsurf_info.planes[0].size = (stream->width * stream->height) << 1;
701 tsurf_info.planes[0].offset = 0;
702 tsurf_info.size = tsurf_info.planes[0].size;
708 tsurf = tbm_surface_internal_create_with_bos(&tsurf_info, &mp_data->data_bo, 1);
710 /*LOGD("tbm surface %p", tsurf);*/
714 /* check media packet format */
715 if (cb_info->pkt_fmt) {
716 int pkt_fmt_width = 0;
717 int pkt_fmt_height = 0;
718 media_format_mimetype_e pkt_fmt_mimetype = MEDIA_FORMAT_NV12;
720 media_format_get_video_info(cb_info->pkt_fmt, &pkt_fmt_mimetype, &pkt_fmt_width, &pkt_fmt_height, NULL, NULL);
721 if (pkt_fmt_mimetype != mimetype ||
722 pkt_fmt_width != stream->width ||
723 pkt_fmt_height != stream->height) {
724 LOGW("different format. current 0x%x, %dx%d, new 0x%x, %dx%d",
725 pkt_fmt_mimetype, pkt_fmt_width, pkt_fmt_height, mimetype, stream->width, stream->height);
726 media_format_unref(cb_info->pkt_fmt);
727 cb_info->pkt_fmt = NULL;
734 /* create packet format */
736 LOGW("make new pkt_fmt - mimetype 0x%x, %dx%d", mimetype, stream->width, stream->height);
737 ret = media_format_create(&cb_info->pkt_fmt);
738 if (ret == MEDIA_FORMAT_ERROR_NONE) {
739 ret = media_format_set_video_mime(cb_info->pkt_fmt, mimetype);
740 ret |= media_format_set_video_width(cb_info->pkt_fmt, stream->width);
741 ret |= media_format_set_video_height(cb_info->pkt_fmt, stream->height);
742 LOGW("media_format_set_video_mime,width,height ret : 0x%x", ret);
744 LOGW("media_format_create failed");
748 /* create media packet */
749 ret = media_packet_create_from_tbm_surface(cb_info->pkt_fmt,
750 tsurf, (media_packet_finalize_cb)_camera_media_packet_finalize,
751 (void *)cb_info, &pkt);
752 if (ret != MEDIA_PACKET_ERROR_NONE) {
753 LOGE("media_packet_create_from_tbm_surface failed");
755 tbm_surface_destroy(tsurf);
759 LOGE("failed to create tbm surface %dx%d, format %d, num_buffer_key %d, data_bo %p",
760 stream->width, stream->height, stream->format, num_buffer_key, mp_data->data_bo);
764 LOGD("media packet %p, internal buffer %p", pkt, stream->internal_buffer);
766 /* set media packet data */
767 ret = media_packet_set_extra(pkt, (void *)mp_data);
768 if (ret != MEDIA_PACKET_ERROR_NONE) {
769 LOGE("media_packet_set_extra failed");
771 _camera_media_packet_data_release(mp_data, cb_info);
774 media_packet_destroy(pkt);
777 /* set timestamp : msec -> nsec */
778 if (media_packet_set_pts(pkt, (uint64_t)(stream->timestamp) * 1000000) != MEDIA_PACKET_ERROR_NONE)
779 LOGW("media_packet_set_pts failed");
788 int _camera_media_packet_finalize(media_packet_h pkt, int error_code, void *user_data)
791 camera_cb_info_s *cb_info = (camera_cb_info_s *)user_data;
792 camera_media_packet_data *mp_data = NULL;
793 tbm_surface_h tsurf = NULL;
795 if (pkt == NULL || cb_info == NULL) {
796 LOGE("invalid parameter buffer %p, cb_info %p", pkt, cb_info);
797 return MEDIA_PACKET_FINALIZE;
800 ret = media_packet_get_extra(pkt, (void **)&mp_data);
801 if (ret != MEDIA_PACKET_ERROR_NONE) {
802 LOGE("media_packet_get_extra failed 0x%x", ret);
803 return MEDIA_PACKET_FINALIZE;
806 /*LOGD("mp_data %p", mp_data);*/
808 g_mutex_lock(&cb_info->mp_data_mutex);
810 _camera_media_packet_data_release(mp_data, cb_info);
813 g_mutex_unlock(&cb_info->mp_data_mutex);
815 ret = media_packet_get_tbm_surface(pkt, &tsurf);
816 if (ret != MEDIA_PACKET_ERROR_NONE) {
817 LOGE("media_packet_get_tbm_surface failed 0x%x", ret);
818 return MEDIA_PACKET_FINALIZE;
822 tbm_surface_destroy(tsurf);
826 return MEDIA_PACKET_FINALIZE;
829 static void _client_user_callback(camera_cb_info_s *cb_info, char *recv_msg, muse_camera_event_e event)
835 tbm_bo_handle bo_handle = {NULL, };
837 if (recv_msg == NULL || event >= MUSE_CAMERA_EVENT_TYPE_NUM) {
838 LOGE("invalid parameter - camera msg %p, event %d", recv_msg, event);
842 /*LOGD("get camera msg %s, event %d", recv_msg, event);*/
844 if (event == MUSE_CAMERA_EVENT_TYPE_PREVIEW) {
845 if (!(CHECK_PREVIEW_CB(cb_info, PREVIEW_CB_TYPE_EVAS)) &&
846 cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW] == NULL &&
847 cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] == NULL) {
848 LOGW("all preview callback from user are NULL");
851 } else if (cb_info->user_cb[event] == NULL) {
852 LOGW("user callback for event %d is not set", event);
857 case MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE:
863 muse_camera_msg_get(previous, recv_msg);
864 muse_camera_msg_get(current, recv_msg);
865 muse_camera_msg_get(by_policy, recv_msg);
867 LOGD("STATE CHANGE - previous %d, current %d, by_policy %d",
868 previous, current, by_policy);
870 ((camera_state_changed_cb)cb_info->user_cb[event])((camera_state_e)previous,
871 (camera_state_e)current, (bool)by_policy, cb_info->user_data[event]);
874 case MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE:
878 muse_camera_msg_get(state, recv_msg);
880 LOGD("FOCUS state - %d", state);
882 ((camera_focus_changed_cb)cb_info->user_cb[event])((camera_focus_state_e)state, cb_info->user_data[event]);
885 case MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE:
886 LOGD("CAPTURE_COMPLETED");
887 ((camera_capture_completed_cb)cb_info->user_cb[event])(cb_info->user_data[event]);
889 case MUSE_CAMERA_EVENT_TYPE_PREVIEW:
890 case MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW:
892 int e_type = MUSE_CAMERA_EVENT_TYPE_PREVIEW;
895 int num_buffer_key = 0;
896 int buffer_key[BUFFER_MAX_PLANE_NUM] = {0, };
898 unsigned char *buf_pos = NULL;
900 tbm_bo buffer_bo[BUFFER_MAX_PLANE_NUM] = {NULL, };
901 tbm_bo_handle buffer_bo_handle[BUFFER_MAX_PLANE_NUM] = {{.ptr = NULL}, };
902 tbm_bo data_bo = NULL;
903 tbm_bo_handle data_bo_handle = {.ptr = NULL};
905 camera_preview_data_s frame;
906 camera_stream_data_s *stream = NULL;
907 camera_media_packet_data *mp_data = NULL;
908 media_packet_h pkt = NULL;
910 muse_camera_msg_get(tbm_key, recv_msg);
911 muse_camera_msg_get(num_buffer_key, recv_msg);
912 muse_camera_msg_get_array(buffer_key, recv_msg);
913 muse_camera_msg_get(data_key, recv_msg);
915 memset(&frame, 0x0, sizeof(camera_preview_data_s));
918 LOGE("invalid key %d", tbm_key);
923 /* import tbm data_bo and get virtual address */
924 if (!_import_tbm_key(cb_info->bufmgr, data_key, &data_bo, &data_bo_handle)) {
925 LOGE("failed to import data key %d", data_key);
926 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
927 cb_info->fd, cb_info, INT, tbm_key);
932 /* import tbm bo and get virtual address */
933 if (!_import_tbm_key(cb_info->bufmgr, tbm_key, &bo, &bo_handle)) {
934 LOGE("failed to import key %d", tbm_key);
935 _release_imported_bo(&data_bo);
936 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
937 cb_info->fd, cb_info, INT, tbm_key);
941 buf_pos = (unsigned char *)bo_handle.ptr;
943 /* get stream info */
944 stream = (camera_stream_data_s *)buf_pos;
946 for (i = 0 ; i < num_buffer_key ; i++) {
947 /* import buffer bo and get virtual address */
948 if (!_import_tbm_key(cb_info->bufmgr, buffer_key[i], &buffer_bo[i], &buffer_bo_handle[i])) {
949 LOGE("failed to import buffer key %d", buffer_key[i]);
951 /* release imported bo */
952 _release_imported_bo(&data_bo);
953 _release_imported_bo(&bo);
955 for (i -= 1 ; i >= 0 ; i--)
956 _release_imported_bo(&buffer_bo[i]);
958 /* send return buffer */
959 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
960 cb_info->fd, cb_info, INT, tbm_key);
966 /* call preview callback */
967 if (cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW]) {
968 _camera_preview_frame_create(stream, num_buffer_key, buffer_bo_handle, &data_bo_handle, &frame);
970 e_type = MUSE_CAMERA_EVENT_TYPE_PREVIEW;
971 ((camera_preview_cb)cb_info->user_cb[e_type])(&frame, cb_info->user_data[e_type]);
974 /* call media packet callback */
975 if (cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW]) {
976 ret = _camera_media_packet_data_create(tbm_key, num_buffer_key, bo, buffer_bo, data_bo, &mp_data);
978 if (ret == CAMERA_ERROR_NONE) {
979 ret = _camera_media_packet_create(cb_info, stream, mp_data, &pkt);
981 e_type = MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW;
982 if (ret == CAMERA_ERROR_NONE) {
983 ((camera_media_packet_preview_cb)cb_info->user_cb[e_type])(pkt, cb_info->user_data[e_type]);
985 _camera_media_packet_data_release(mp_data, cb_info);
991 /* call evas renderer */
992 if (CHECK_PREVIEW_CB(cb_info, PREVIEW_CB_TYPE_EVAS)) {
993 #ifdef TIZEN_FEATURE_EVAS_RENDERER
994 ret = _camera_media_packet_data_create(tbm_key, num_buffer_key, bo, buffer_bo, data_bo, &mp_data);
996 if (ret == CAMERA_ERROR_NONE) {
997 ret = _camera_media_packet_create(cb_info, stream, mp_data, &pkt);
999 if (ret == CAMERA_ERROR_NONE) {
1000 g_mutex_lock(&cb_info->evas_mutex);
1002 if (cb_info->run_evas_render)
1003 mm_evas_renderer_write(pkt, cb_info->evas_info);
1005 LOGW("evas renderer is stopped, skip this buffer...");
1006 media_packet_destroy(pkt);
1011 g_mutex_unlock(&cb_info->evas_mutex);
1013 _camera_media_packet_data_release(mp_data, cb_info);
1017 #else /* TIZEN_FEATURE_EVAS_RENDERER */
1018 LOGW("evas renderer is not supported");
1019 #endif /* TIZEN_FEATURE_EVAS_RENDERER */
1022 /* send message for preview callback return */
1023 if (!CHECK_PREVIEW_CB(cb_info, PREVIEW_CB_TYPE_EVAS))
1024 muse_camera_msg_send_no_return(MUSE_CAMERA_API_PREVIEW_CB_RETURN, cb_info->fd, cb_info);
1026 if (mp_data == NULL) {
1027 /* release imported bo */
1028 for (i = 0 ; i < num_buffer_key ; i++)
1029 _release_imported_bo(&buffer_bo[i]);
1031 /* unmap and unref tbm bo */
1032 _release_imported_bo(&data_bo);
1033 _release_imported_bo(&bo);
1036 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
1037 cb_info->fd, cb_info, INT, tbm_key);
1039 /*LOGD("return buffer Done");*/
1043 case MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS:
1047 muse_camera_msg_get(percent, recv_msg);
1049 LOGD("HDR progress - %d \%", percent);
1051 ((camera_attr_hdr_progress_cb)cb_info->user_cb[event])(percent, cb_info->user_data[event]);
1054 case MUSE_CAMERA_EVENT_TYPE_INTERRUPTED:
1060 muse_camera_msg_get(policy, recv_msg);
1061 muse_camera_msg_get(previous, recv_msg);
1062 muse_camera_msg_get(current, recv_msg);
1064 LOGD("INTERRUPTED - policy %d, state previous %d, current %d",
1065 policy, previous, current);
1067 ((camera_interrupted_cb)cb_info->user_cb[event])((camera_policy_e)policy,
1068 (camera_state_e)previous, (camera_state_e)current, cb_info->user_data[event]);
1071 case MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION:
1074 camera_detected_face_s *faces = NULL;
1076 muse_camera_msg_get(count, recv_msg);
1077 muse_camera_msg_get(tbm_key, recv_msg);
1079 if (count > 0 && tbm_key > 0) {
1080 LOGD("FACE_DETECTION - count %d, tbm_key %d", count, tbm_key);
1082 if (!_import_tbm_key(cb_info->bufmgr, tbm_key, &bo, &bo_handle))
1086 faces = bo_handle.ptr;
1088 ((camera_face_detected_cb)cb_info->user_cb[event])(faces, count, cb_info->user_data[event]);
1094 for (i = 0 ; i < count ; i++) {
1095 LOGD("id[%2d] - score %d, position (%d,%d,%dx%d)",
1096 i, faces[i].score, faces[i].x, faces[i].y, faces[i].width, faces[i].height);
1102 _release_imported_bo(&bo);
1105 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
1106 cb_info->fd, cb_info, INT, tbm_key);
1108 /*LOGD("return buffer done");*/
1110 LOGE("invalid message - count %d, key %d", count, tbm_key);
1114 case MUSE_CAMERA_EVENT_TYPE_ERROR:
1117 int current_state = 0;
1119 muse_camera_msg_get(error, recv_msg);
1120 muse_camera_msg_get(current_state, recv_msg);
1122 LOGE("ERROR - error 0x%x, current_state %d", error, current_state);
1124 ((camera_error_cb)cb_info->user_cb[event])((camera_error_e)error,
1125 (camera_state_e)current_state, cb_info->user_data[event]);
1128 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_RESOLUTION:
1129 muse_camera_msg_get(param1, recv_msg);
1130 muse_camera_msg_get(param2, recv_msg);
1132 /*LOGD("SUPPORTED_PREVIEW_RESOLUTION - %d x %d", param1, param2);*/
1134 if (((camera_supported_preview_resolution_cb)cb_info->user_cb[event])(param1, param2, cb_info->user_data[event]) == false) {
1135 cb_info->user_cb[event] = NULL;
1136 cb_info->user_data[event] = NULL;
1137 LOGW("stop foreach callback for SUPPORTED_PREVIEW_RESOLUTION");
1140 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_RESOLUTION:
1141 muse_camera_msg_get(param1, recv_msg);
1142 muse_camera_msg_get(param2, recv_msg);
1144 /*LOGD("SUPPORTED_CAPTURE_RESOLUTION - %d x %d", param1, param2);*/
1146 if (((camera_supported_capture_resolution_cb)cb_info->user_cb[event])(param1, param2, cb_info->user_data[event]) == false) {
1147 cb_info->user_cb[event] = NULL;
1148 cb_info->user_data[event] = NULL;
1149 LOGW("stop foreach callback for SUPPORTED_CAPTURE_RESOLUTION");
1152 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_FORMAT:
1153 muse_camera_msg_get(param1, recv_msg);
1155 /*LOGD("SUPPORTED_CAPTURE_FORMAT - %d ", param1);*/
1157 if (((camera_supported_capture_format_cb)cb_info->user_cb[event])((camera_pixel_format_e)param1, cb_info->user_data[event]) == false) {
1158 cb_info->user_cb[event] = NULL;
1159 cb_info->user_data[event] = NULL;
1160 LOGW("stop foreach callback for SUPPORTED_CAPTURE_FORMAT");
1163 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_FORMAT:
1164 muse_camera_msg_get(param1, recv_msg);
1166 /*LOGD("SUPPORTED_PREVIEW_FORMAT - %d ", param1);*/
1168 if (((camera_supported_preview_format_cb)cb_info->user_cb[event])((camera_pixel_format_e)param1, cb_info->user_data[event]) == false) {
1169 cb_info->user_cb[event] = NULL;
1170 cb_info->user_data[event] = NULL;
1171 LOGW("stop foreach callback for SUPPORTED_PREVIEW_FORMAT");
1174 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_AF_MODE:
1175 muse_camera_msg_get(param1, recv_msg);
1177 /*LOGD("SUPPORTED_AF_MODE - %d ", param1);*/
1179 if (((camera_attr_supported_af_mode_cb)cb_info->user_cb[event])((camera_attr_af_mode_e)param1, cb_info->user_data[event]) == false) {
1180 cb_info->user_cb[event] = NULL;
1181 cb_info->user_data[event] = NULL;
1182 LOGW("stop foreach callback for SUPPORTED_AF_MODE");
1185 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EXPOSURE_MODE:
1186 muse_camera_msg_get(param1, recv_msg);
1188 /*LOGD("SUPPORTED_EXPOSURE_MODE - %d ", param1);*/
1190 if (((camera_attr_supported_exposure_mode_cb)cb_info->user_cb[event])((camera_attr_exposure_mode_e)param1, cb_info->user_data[event]) == false) {
1191 cb_info->user_cb[event] = NULL;
1192 cb_info->user_data[event] = NULL;
1193 LOGW("stop foreach callback for SUPPORTED_EXPOSURE_MODE");
1196 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_ISO:
1197 muse_camera_msg_get(param1, recv_msg);
1199 /*LOGD("SUPPORTED_ISO - %d ", param1);*/
1201 if (((camera_attr_supported_iso_cb)cb_info->user_cb[event])((camera_attr_iso_e)param1, cb_info->user_data[event]) == false) {
1202 cb_info->user_cb[event] = NULL;
1203 cb_info->user_data[event] = NULL;
1204 LOGW("stop foreach callback for SUPPORTED_ISO");
1207 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_WHITEBALANCE:
1208 muse_camera_msg_get(param1, recv_msg);
1210 /*LOGD("SUPPORTED_WHITEBALANCE - %d ", param1);*/
1212 if (((camera_attr_supported_whitebalance_cb)cb_info->user_cb[event])((camera_attr_whitebalance_e)param1, cb_info->user_data[event]) == false) {
1213 cb_info->user_cb[event] = NULL;
1214 cb_info->user_data[event] = NULL;
1215 LOGW("stop foreach callback for SUPPORTED_WHITEBALANCE");
1218 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EFFECT:
1219 muse_camera_msg_get(param1, recv_msg);
1221 /*LOGD("SUPPORTED_EFFECT - %d ", param1);*/
1223 if (((camera_attr_supported_effect_cb)cb_info->user_cb[event])((camera_attr_effect_mode_e)param1, cb_info->user_data[event]) == false) {
1224 cb_info->user_cb[event] = NULL;
1225 cb_info->user_data[event] = NULL;
1226 LOGW("stop foreach callback for SUPPORTED_EFFECT");
1229 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_SCENE_MODE:
1230 muse_camera_msg_get(param1, recv_msg);
1232 /*LOGD("SUPPORTED_SCENE_MODE - %d ", param1);*/
1234 if (((camera_attr_supported_scene_mode_cb)cb_info->user_cb[event])((camera_attr_scene_mode_e)param1, cb_info->user_data[event]) == false) {
1235 cb_info->user_cb[event] = NULL;
1236 cb_info->user_data[event] = NULL;
1237 LOGW("stop foreach callback for SUPPORTED_SCENE_MODE");
1240 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FLASH_MODE:
1241 muse_camera_msg_get(param1, recv_msg);
1243 /*LOGD("SUPPORTED_FLASH_MODE - %d ", param1);*/
1245 if (((camera_attr_supported_flash_mode_cb)cb_info->user_cb[event])((camera_attr_flash_mode_e)param1, cb_info->user_data[event]) == false) {
1246 cb_info->user_cb[event] = NULL;
1247 cb_info->user_data[event] = NULL;
1248 LOGW("stop foreach callback for SUPPORTED_FLASH_MODE");
1251 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS:
1252 muse_camera_msg_get(param1, recv_msg);
1254 /*LOGD("SUPPORTED_FPS - %d ", param1);*/
1256 if (((camera_attr_supported_fps_cb)cb_info->user_cb[event])((camera_attr_fps_e)param1, cb_info->user_data[event]) == false) {
1257 cb_info->user_cb[event] = NULL;
1258 cb_info->user_data[event] = NULL;
1259 LOGW("stop foreach callback for SUPPORTED_FPS");
1262 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS_BY_RESOLUTION:
1263 muse_camera_msg_get(param1, recv_msg);
1265 /*LOGD("SUPPORTED_FPS_BY_RESOLUTION - %d ", param1);*/
1267 if (((camera_attr_supported_fps_cb)cb_info->user_cb[event])((camera_attr_fps_e)param1, cb_info->user_data[event]) == false) {
1268 cb_info->user_cb[event] = NULL;
1269 cb_info->user_data[event] = NULL;
1270 LOGW("stop foreach callback for SUPPORTED_FPS_BY_RESOLUTION");
1273 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_FLIP:
1274 muse_camera_msg_get(param1, recv_msg);
1276 /*LOGD("SUPPORTED_STREAM_FLIP - %d ", param1);*/
1278 if (((camera_attr_supported_stream_flip_cb)cb_info->user_cb[event])((camera_flip_e)param1, cb_info->user_data[event]) == false) {
1279 cb_info->user_cb[event] = NULL;
1280 cb_info->user_data[event] = NULL;
1281 LOGW("stop foreach callback for SUPPORTED_STREAM_FLIP");
1284 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION:
1285 muse_camera_msg_get(param1, recv_msg);
1287 /*LOGD("SUPPORTED_STREAM_ROTATION - %d ", param1);*/
1289 if (((camera_attr_supported_stream_rotation_cb)cb_info->user_cb[event])((camera_rotation_e)param1, cb_info->user_data[event]) == false) {
1290 cb_info->user_cb[event] = NULL;
1291 cb_info->user_data[event] = NULL;
1292 LOGW("stop foreach callback for SUPPORTED_STREAM_ROTATION");
1295 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE:
1296 muse_camera_msg_get(param1, recv_msg);
1298 /*LOGD("SUPPORTED_THEATER_MODE - %d ", param1);*/
1300 if (((camera_attr_supported_theater_mode_cb)cb_info->user_cb[event])((camera_attr_theater_mode_e)param1, cb_info->user_data[event]) == false) {
1301 cb_info->user_cb[event] = NULL;
1302 cb_info->user_data[event] = NULL;
1303 LOGW("stop foreach callback for SUPPORTED_THEATER_MODE");
1306 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PTZ_TYPE:
1307 muse_camera_msg_get(param1, recv_msg);
1309 /*LOGD("SUPPORTED_PTZ_TYPE - %d ", param1);*/
1311 if (((camera_attr_supported_ptz_type_cb)cb_info->user_cb[event])((camera_attr_ptz_type_e)param1, cb_info->user_data[event]) == false) {
1312 cb_info->user_cb[event] = NULL;
1313 cb_info->user_data[event] = NULL;
1314 LOGW("stop foreach callback for SUPPORTED_PTZ_TYPE");
1317 case MUSE_CAMERA_EVENT_TYPE_CAPTURE:
1319 camera_image_data_s *rImage = NULL;
1320 camera_image_data_s *rPostview = NULL;
1321 camera_image_data_s *rThumbnail = NULL;
1322 unsigned char *buf_pos = NULL;
1323 int tbm_key_main = 0;
1324 int tbm_key_post = 0;
1325 int tbm_key_thumb = 0;
1326 tbm_bo bo_main = NULL;
1327 tbm_bo bo_post = NULL;
1328 tbm_bo bo_thumb = NULL;
1329 tbm_bo_handle bo_main_handle = {NULL, };
1330 tbm_bo_handle bo_post_handle = {NULL, };
1331 tbm_bo_handle bo_thumb_handle = {NULL, };
1333 muse_camera_msg_get(tbm_key_main, recv_msg);
1334 muse_camera_msg_get(tbm_key_post, recv_msg);
1335 muse_camera_msg_get(tbm_key_thumb, recv_msg);
1338 LOGD("camera capture callback came in. tbm_key_main %d, tbm_key_post %d, tbm_key_thumb %d",
1339 tbm_key_main, tbm_key_post, tbm_key_thumb);
1342 if (tbm_key_main <= 0) {
1343 LOGE("invalid tbm_key_main %d", tbm_key_main);
1347 /* import tbm bo and get virtual address */
1348 if (!_import_tbm_key(cb_info->bufmgr, tbm_key_main, &bo_main, &bo_main_handle))
1351 buf_pos = (unsigned char *)bo_main_handle.ptr;
1352 rImage = (camera_image_data_s *)buf_pos;
1353 rImage->data = buf_pos + sizeof(camera_image_data_s);
1355 LOGD("image info %dx%d, size : %d", rImage->width, rImage->height, rImage->size);
1357 if (tbm_key_post > 0) {
1358 /* import tbm bo and get virtual address */
1359 if (!_import_tbm_key(cb_info->bufmgr, tbm_key_post, &bo_post, &bo_post_handle))
1362 buf_pos = (unsigned char *)bo_post_handle.ptr;
1363 rPostview = (camera_image_data_s *)buf_pos;
1364 LOGD("rPostview->size : %d", rPostview->size);
1365 rPostview->data = buf_pos + sizeof(camera_image_data_s);
1368 if (tbm_key_thumb > 0) {
1369 /* import tbm bo and get virtual address */
1370 if (!_import_tbm_key(cb_info->bufmgr, tbm_key_thumb, &bo_thumb, &bo_thumb_handle))
1373 buf_pos = (unsigned char *)bo_thumb_handle.ptr;
1375 rThumbnail = (camera_image_data_s *)buf_pos;
1376 LOGD("rThumbnail->size : %d", rThumbnail->size);
1377 rThumbnail->data = buf_pos + sizeof(camera_image_data_s);
1380 ((camera_capturing_cb)cb_info->user_cb[event])(rImage, rPostview, rThumbnail, cb_info->user_data[event]);
1382 /* unmap and unref tbm bo */
1383 _release_imported_bo(&bo_main);
1386 tbm_key = tbm_key_main;
1387 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
1388 cb_info->fd, cb_info, INT, tbm_key);
1390 if (tbm_key_post > 0) {
1391 /* unmap and unref tbm bo */
1392 _release_imported_bo(&bo_post);
1395 tbm_key = tbm_key_post;
1396 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
1397 cb_info->fd, cb_info, INT, tbm_key);
1400 if (tbm_key_thumb > 0) {
1401 /* unmap and unref tbm bo */
1402 _release_imported_bo(&bo_thumb);
1405 tbm_key = tbm_key_thumb;
1406 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
1407 cb_info->fd, cb_info, INT, tbm_key);
1410 LOGD("return buffer done");
1413 case MUSE_CAMERA_EVENT_TYPE_VIDEO_FRAME_RENDER_ERROR:
1416 LOGW("Unknown event : %d", event);
1423 static bool _camera_idle_event_callback(void *data)
1425 camera_cb_info_s *cb_info = NULL;
1426 camera_idle_event_s *cam_idle_event = (camera_idle_event_s *)data;
1428 if (cam_idle_event == NULL) {
1429 LOGE("cam_idle_event is NULL");
1434 g_mutex_lock(&cam_idle_event->event_mutex);
1436 cb_info = cam_idle_event->cb_info;
1437 if (cb_info == NULL) {
1438 LOGW("camera cb_info is NULL. event %d", cam_idle_event->event);
1439 goto IDLE_EVENT_CALLBACK_DONE;
1442 /* remove event from list */
1443 g_mutex_lock(&cb_info->idle_event_mutex);
1444 if (cb_info->idle_event_list)
1445 cb_info->idle_event_list = g_list_remove(cb_info->idle_event_list, (gpointer)cam_idle_event);
1447 /*LOGD("remove camera idle event %p, %p", cam_idle_event, cb_info->idle_event_list);*/
1448 g_mutex_unlock(&cb_info->idle_event_mutex);
1451 _client_user_callback(cam_idle_event->cb_info, cam_idle_event->recv_msg, cam_idle_event->event);
1453 /* send signal for waiting thread */
1454 g_cond_signal(&cb_info->idle_event_cond);
1456 IDLE_EVENT_CALLBACK_DONE:
1457 /* unlock and release event */
1458 g_mutex_unlock(&cam_idle_event->event_mutex);
1459 g_mutex_clear(&cam_idle_event->event_mutex);
1461 g_free(cam_idle_event);
1462 cam_idle_event = NULL;
1467 static void *_camera_msg_handler_func(gpointer data)
1471 camera_message_s *cam_msg = NULL;
1472 camera_idle_event_s *cam_idle_event = NULL;
1473 camera_msg_handler_info_s *handler_info = (camera_msg_handler_info_s *)data;
1474 camera_cb_info_s *cb_info = NULL;
1476 if (!handler_info || !handler_info->cb_info) {
1477 LOGE("t:%d NULL handler %p", type, handler_info);
1481 cb_info = (camera_cb_info_s *)handler_info->cb_info;
1482 type = handler_info->type;
1484 LOGD("t:%d start", type);
1486 g_mutex_lock(&handler_info->mutex);
1488 while (g_atomic_int_get(&handler_info->running)) {
1489 if (g_queue_is_empty(handler_info->queue)) {
1490 /*LOGD("t:%d signal wait...", type);*/
1491 g_cond_wait(&handler_info->cond, &handler_info->mutex);
1492 /*LOGD("t:%d signal received", type);*/
1494 if (g_atomic_int_get(&handler_info->running) == 0) {
1495 LOGD("t:%d stop event thread", type);
1500 cam_msg = (camera_message_s *)g_queue_pop_head(handler_info->queue);
1502 g_mutex_unlock(&handler_info->mutex);
1504 if (cam_msg == NULL) {
1505 LOGE("t:%d NULL message", type);
1506 g_mutex_lock(&handler_info->mutex);
1512 if (api < MUSE_CAMERA_API_MAX) {
1515 g_mutex_lock(&cb_info->api_mutex[api]);
1517 if (muse_camera_msg_get(ret, cam_msg->recv_msg)) {
1518 cb_info->api_ret[api] = ret;
1519 cb_info->api_activating[api] = 1;
1521 /*LOGD("t:%d camera api %d - return 0x%x", type, ret);*/
1523 g_cond_signal(&cb_info->api_cond[api]);
1525 LOGE("t:%d failed to get camera ret for api %d, msg %s", type, api, cam_msg->recv_msg);
1528 g_mutex_unlock(&cb_info->api_mutex[api]);
1529 } else if (api == MUSE_CAMERA_CB_EVENT) {
1530 switch (cam_msg->event_class) {
1531 case MUSE_CAMERA_EVENT_CLASS_THREAD_SUB:
1532 _client_user_callback(cb_info, cam_msg->recv_msg, cam_msg->event);
1534 case MUSE_CAMERA_EVENT_CLASS_THREAD_MAIN:
1535 cam_idle_event = g_new0(camera_idle_event_s, 1);
1536 if (cam_idle_event == NULL) {
1537 LOGE("t:%d cam_idle_event alloc failed", type);
1541 cam_idle_event->event = cam_msg->event;
1542 cam_idle_event->cb_info = cb_info;
1543 g_mutex_init(&cam_idle_event->event_mutex);
1544 memcpy(cam_idle_event->recv_msg, cam_msg->recv_msg, sizeof(cam_idle_event->recv_msg));
1546 /*LOGD("t:%d add camera event[%d, %p] to IDLE", type, event, cam_idle_event);*/
1548 g_mutex_lock(&cb_info->idle_event_mutex);
1549 cb_info->idle_event_list = g_list_append(cb_info->idle_event_list, (gpointer)cam_idle_event);
1550 g_mutex_unlock(&cb_info->idle_event_mutex);
1552 g_idle_add_full(G_PRIORITY_DEFAULT,
1553 (GSourceFunc)_camera_idle_event_callback,
1554 (gpointer)cam_idle_event,
1558 LOGE("t:%d not handled event class %d", type, cam_msg->event_class);
1562 LOGE("t:%d unknown camera api[%d] message[%s]", type, api, cam_msg->recv_msg);
1568 g_mutex_lock(&handler_info->mutex);
1571 /* remove remained event */
1572 while (!g_queue_is_empty(handler_info->queue)) {
1573 cam_msg = (camera_message_s *)g_queue_pop_head(handler_info->queue);
1575 LOGD("t:%d remove camera message %p", type, cam_msg);
1579 LOGW("t:%d NULL camera message", type);
1583 g_mutex_unlock(&handler_info->mutex);
1585 LOGD("t:%d return", type);
1591 static void _camera_remove_idle_event_all(camera_cb_info_s *cb_info)
1593 camera_idle_event_s *cam_idle_event = NULL;
1594 gboolean ret = TRUE;
1596 gint64 end_time = 0;
1598 if (cb_info == NULL) {
1599 LOGE("cb_info is NULL");
1603 g_mutex_lock(&cb_info->idle_event_mutex);
1605 if (cb_info->idle_event_list == NULL) {
1606 LOGD("No idle event is remained.");
1608 list = cb_info->idle_event_list;
1611 cam_idle_event = list->data;
1612 list = g_list_next(list);
1614 if (!cam_idle_event) {
1615 LOGW("Fail to remove idle event. The event is NULL");
1617 if (g_mutex_trylock(&cam_idle_event->event_mutex)) {
1618 ret = g_idle_remove_by_data(cam_idle_event);
1620 LOGD("remove idle event [%p], ret[%d]", cam_idle_event, ret);
1623 cam_idle_event->cb_info = NULL;
1624 LOGW("idle callback for event %p will be called later", cam_idle_event);
1627 cb_info->idle_event_list = g_list_remove(cb_info->idle_event_list, (gpointer)cam_idle_event);
1629 g_mutex_unlock(&cam_idle_event->event_mutex);
1632 g_mutex_clear(&cam_idle_event->event_mutex);
1634 g_free(cam_idle_event);
1635 cam_idle_event = NULL;
1637 LOGD("remove idle event done");
1640 LOGW("event lock failed. it's being called...");
1642 end_time = g_get_monotonic_time() + G_TIME_SPAN_MILLISECOND * 100;
1644 if (g_cond_wait_until(&cb_info->idle_event_cond, &cb_info->idle_event_mutex, end_time))
1645 LOGW("signal received");
1652 g_list_free(cb_info->idle_event_list);
1653 cb_info->idle_event_list = NULL;
1656 g_mutex_unlock(&cb_info->idle_event_mutex);
1661 static void *_camera_msg_recv_func(gpointer data)
1668 int event_class = 0;
1672 char *recv_msg = NULL;
1673 char **parse_str = NULL;
1674 camera_cb_info_s *cb_info = (camera_cb_info_s *)data;
1676 if (cb_info == NULL) {
1677 LOGE("cb_info NULL");
1683 parse_str = (char **)malloc(sizeof(char *) * CAMERA_PARSE_STRING_SIZE);
1684 if (parse_str == NULL) {
1685 LOGE("parse_str malloc failed");
1689 for (i = 0 ; i < CAMERA_PARSE_STRING_SIZE ; i++) {
1690 parse_str[i] = (char *)malloc(sizeof(char) * MUSE_CAMERA_MSG_MAX_LENGTH);
1691 if (parse_str[i] == NULL) {
1692 LOGE("parse_str[%d] malloc failed", i);
1693 goto CB_HANDLER_EXIT;
1697 recv_msg = cb_info->recv_msg;
1699 while (g_atomic_int_get(&cb_info->msg_recv_running)) {
1700 ret = muse_core_ipc_recv_msg(cb_info->fd, recv_msg);
1703 recv_msg[ret] = '\0';
1709 /*LOGD("recvMSg : %s, length : %d", recv_msg, ret);*/
1711 /* Need to split the combined entering msgs.
1712 This module supports up to 200 combined msgs. */
1713 for (str_pos = 0; str_pos < ret; str_pos++) {
1714 if (recv_msg[str_pos] == '}') {
1715 memset(parse_str[num_token], 0x0, sizeof(char) * MUSE_CAMERA_MSG_MAX_LENGTH);
1716 strncpy(parse_str[num_token], recv_msg + prev_pos, str_pos - prev_pos + 1);
1717 /*LOGD("splitted msg : [%s], Index : %d", parse_str[num_token], num_token);*/
1718 prev_pos = str_pos+1;
1723 /*LOGD("num_token : %d", num_token);*/
1725 /* Re-construct to the useful single msg. */
1726 for (i = 0; i < num_token; i++) {
1727 if (i >= CAMERA_PARSE_STRING_SIZE) {
1728 LOGE("invalid token index %d", i);
1737 if (!muse_camera_msg_get(api, parse_str[i])) {
1738 LOGE("failed to get camera api");
1742 if (api == MUSE_CAMERA_CB_EVENT) {
1743 if (!muse_camera_msg_get(event, parse_str[i]) ||
1744 !muse_camera_msg_get(event_class, parse_str[i])) {
1745 LOGE("failed to get camera event or event_class [%s]", parse_str[i]);
1749 if (!muse_camera_msg_get(api_class, parse_str[i])) {
1750 LOGE("failed to get camera api_class [%s]", parse_str[i]);
1755 if (api_class == MUSE_CAMERA_API_CLASS_IMMEDIATE) {
1756 if (api >= MUSE_CAMERA_API_MAX) {
1757 LOGE("invalid api %d", api);
1761 g_mutex_lock(&cb_info->api_mutex[api]);
1763 if (!muse_camera_msg_get(ret, parse_str[i])) {
1764 LOGE("failed to get camera ret");
1765 g_mutex_unlock(&cb_info->api_mutex[api]);
1769 cb_info->api_ret[api] = ret;
1770 cb_info->api_activating[api] = 1;
1772 if (api == MUSE_CAMERA_API_CREATE) {
1773 if (ret != CAMERA_ERROR_NONE) {
1774 g_atomic_int_set(&cb_info->msg_recv_running, 0);
1775 LOGE("camera create error 0x%x. close client cb handler", ret);
1777 } else if (api == MUSE_CAMERA_API_DESTROY) {
1778 if (ret == CAMERA_ERROR_NONE) {
1779 g_atomic_int_set(&cb_info->msg_recv_running, 0);
1780 LOGD("camera destroy done. close client cb handler");
1784 g_cond_signal(&cb_info->api_cond[api]);
1785 g_mutex_unlock(&cb_info->api_mutex[api]);
1786 } else if (api_class == MUSE_CAMERA_API_CLASS_THREAD_SUB || api == MUSE_CAMERA_CB_EVENT) {
1787 camera_message_s *cam_msg = g_new0(camera_message_s, 1);
1788 if (cam_msg == NULL) {
1789 LOGE("failed to alloc cam_msg");
1794 cam_msg->event = event;
1795 cam_msg->event_class = event_class;
1797 memcpy(cam_msg->recv_msg, parse_str[i], sizeof(cam_msg->recv_msg));
1799 /*LOGD("add camera message to queue : api %d, event %d, event_class %d", api, event, event_class);*/
1801 if (event == MUSE_CAMERA_EVENT_TYPE_PREVIEW) {
1802 g_mutex_lock(&cb_info->preview_cb_info.mutex);
1803 g_queue_push_tail(cb_info->preview_cb_info.queue, (gpointer)cam_msg);
1804 g_cond_signal(&cb_info->preview_cb_info.cond);
1805 g_mutex_unlock(&cb_info->preview_cb_info.mutex);
1806 } else if (event == MUSE_CAMERA_EVENT_TYPE_CAPTURE) {
1807 g_mutex_lock(&cb_info->capture_cb_info.mutex);
1808 g_queue_push_tail(cb_info->capture_cb_info.queue, (gpointer)cam_msg);
1809 g_cond_signal(&cb_info->capture_cb_info.cond);
1810 g_mutex_unlock(&cb_info->capture_cb_info.mutex);
1812 g_mutex_lock(&cb_info->msg_handler_info.mutex);
1813 g_queue_push_tail(cb_info->msg_handler_info.queue, (gpointer)cam_msg);
1814 g_cond_signal(&cb_info->msg_handler_info.cond);
1815 g_mutex_unlock(&cb_info->msg_handler_info.mutex);
1818 LOGW("unknown camera api %d and api_class %d", api, api_class);
1824 LOGD("client cb exit");
1828 for (i = 0 ; i < CAMERA_PARSE_STRING_SIZE ; i++) {
1831 parse_str[i] = NULL;
1843 static bool __create_msg_handler_thread(camera_msg_handler_info_s *handler_info,
1844 int type, const char *thread_name, camera_cb_info_s *cb_info)
1846 if (!handler_info || !thread_name || !cb_info) {
1847 LOGE("t:%d NULL %p %p %p",
1848 type, handler_info, thread_name, cb_info);
1854 handler_info->type = type;
1855 handler_info->queue = g_queue_new();
1856 if (handler_info->queue == NULL) {
1857 LOGE("t:%d queue failed", type);
1861 g_mutex_init(&handler_info->mutex);
1862 g_cond_init(&handler_info->cond);
1864 handler_info->cb_info = (void *)cb_info;
1865 g_atomic_int_set(&handler_info->running, 1);
1867 handler_info->thread = g_thread_try_new(thread_name,
1868 _camera_msg_handler_func, (gpointer)handler_info, NULL);
1869 if (handler_info->thread == NULL) {
1870 LOGE("t:%d thread failed", type);
1872 g_mutex_clear(&handler_info->mutex);
1873 g_cond_clear(&handler_info->cond);
1874 g_queue_free(handler_info->queue);
1875 handler_info->queue = NULL;
1880 LOGD("t:%d done", type);
1886 static void __destroy_msg_handler_thread(camera_msg_handler_info_s *handler_info)
1890 if (!handler_info) {
1891 LOGE("NULL handler");
1895 type = handler_info->type;
1897 LOGD("t:%d thread %p", type, handler_info->thread);
1899 if (handler_info->thread) {
1900 g_mutex_lock(&handler_info->mutex);
1901 g_atomic_int_set(&handler_info->running, 0);
1902 g_cond_signal(&handler_info->cond);
1903 g_mutex_unlock(&handler_info->mutex);
1905 g_thread_join(handler_info->thread);
1906 g_thread_unref(handler_info->thread);
1907 handler_info->thread = NULL;
1909 g_mutex_clear(&handler_info->mutex);
1910 g_cond_clear(&handler_info->cond);
1911 g_queue_free(handler_info->queue);
1912 handler_info->queue = NULL;
1915 LOGD("t:%d done", type);
1921 static camera_cb_info_s *_client_callback_new(gint sockfd)
1923 camera_cb_info_s *cb_info = NULL;
1926 g_return_val_if_fail(sockfd > 0, NULL);
1928 cb_info = g_new0(camera_cb_info_s, 1);
1929 if (cb_info == NULL) {
1930 LOGE("cb_info failed");
1934 g_mutex_init(&cb_info->idle_event_mutex);
1935 g_cond_init(&cb_info->idle_event_cond);
1936 g_mutex_init(&cb_info->mp_data_mutex);
1937 #ifdef TIZEN_FEATURE_EVAS_RENDERER
1938 g_mutex_init(&cb_info->evas_mutex);
1939 #endif /* TIZEN_FEATURE_EVAS_RENDERER */
1941 for (i = 0 ; i < MUSE_CAMERA_API_MAX ; i++) {
1942 g_mutex_init(&cb_info->api_mutex[i]);
1943 g_cond_init(&cb_info->api_cond[i]);
1946 /* message handler thread */
1947 if (!__create_msg_handler_thread(&cb_info->msg_handler_info,
1948 CAMERA_MESSAGE_HANDLER_TYPE_GENERAL, "camera_msg_handler", cb_info)) {
1949 LOGE("msg_handler_info failed");
1953 /* message handler thread for preview callback */
1954 if (!__create_msg_handler_thread(&cb_info->preview_cb_info,
1955 CAMERA_MESSAGE_HANDLER_TYPE_PREVIEW_CB, "camera_msg_handler:preview_cb", cb_info)) {
1956 LOGE("preview_cb_info failed");
1960 /* message handler thread for capture callback */
1961 if (!__create_msg_handler_thread(&cb_info->capture_cb_info,
1962 CAMERA_MESSAGE_HANDLER_TYPE_CAPTURE_CB, "camera_msg_handler:capture_cb", cb_info)) {
1963 LOGE("capture_cb_info failed");
1967 cb_info->fd = sockfd;
1968 cb_info->preview_cb_flag = 0;
1969 #ifdef TIZEN_FEATURE_EVAS_RENDERER
1970 cb_info->evas_info = NULL;
1971 #endif /* TIZEN_FEATURE_EVAS_RENDERER */
1973 /* message receive thread */
1974 g_atomic_int_set(&cb_info->msg_recv_running, 1);
1975 cb_info->msg_recv_thread = g_thread_try_new("camera_msg_recv",
1976 _camera_msg_recv_func, (gpointer)cb_info, NULL);
1977 if (cb_info->msg_recv_thread == NULL) {
1978 LOGE("message receive thread creation failed");
1986 __destroy_msg_handler_thread(&cb_info->msg_handler_info);
1987 __destroy_msg_handler_thread(&cb_info->preview_cb_info);
1988 __destroy_msg_handler_thread(&cb_info->capture_cb_info);
1990 for (i = 0 ; i < MUSE_CAMERA_API_MAX ; i++) {
1991 g_mutex_clear(&cb_info->api_mutex[i]);
1992 g_cond_clear(&cb_info->api_cond[i]);
1995 g_mutex_clear(&cb_info->idle_event_mutex);
1996 g_cond_clear(&cb_info->idle_event_cond);
1997 g_mutex_clear(&cb_info->mp_data_mutex);
1998 #ifdef TIZEN_FEATURE_EVAS_RENDERER
1999 g_mutex_clear(&cb_info->evas_mutex);
2000 #endif /* TIZEN_FEATURE_EVAS_RENDERER */
2009 static void _client_callback_destroy(camera_cb_info_s *cb_info)
2013 g_return_if_fail(cb_info != NULL);
2015 LOGD("MSG receive thread[%p] destroy", cb_info->msg_recv_thread);
2017 g_thread_join(cb_info->msg_recv_thread);
2018 g_thread_unref(cb_info->msg_recv_thread);
2019 cb_info->msg_recv_thread = NULL;
2021 LOGD("msg thread removed");
2023 /* destroy msg handler threads */
2024 __destroy_msg_handler_thread(&cb_info->msg_handler_info);
2025 __destroy_msg_handler_thread(&cb_info->preview_cb_info);
2026 __destroy_msg_handler_thread(&cb_info->capture_cb_info);
2028 for (i = 0 ; i < MUSE_CAMERA_API_MAX ; i++) {
2029 g_mutex_clear(&cb_info->api_mutex[i]);
2030 g_cond_clear(&cb_info->api_cond[i]);
2033 g_mutex_clear(&cb_info->idle_event_mutex);
2034 g_cond_clear(&cb_info->idle_event_cond);
2035 g_mutex_clear(&cb_info->mp_data_mutex);
2036 #ifdef TIZEN_FEATURE_EVAS_RENDERER
2037 g_mutex_clear(&cb_info->evas_mutex);
2038 #endif /* TIZEN_FEATURE_EVAS_RENDERER */
2040 LOGD("event thread removed");
2042 if (cb_info->fd > -1) {
2043 muse_core_connection_close(cb_info->fd);
2047 if (cb_info->bufmgr) {
2048 tbm_bufmgr_deinit(cb_info->bufmgr);
2049 cb_info->bufmgr = NULL;
2051 if (cb_info->pkt_fmt) {
2052 media_format_unref(cb_info->pkt_fmt);
2053 cb_info->pkt_fmt = NULL;
2056 #ifdef TIZEN_FEATURE_EVAS_RENDERER
2057 if (cb_info->evas_info)
2058 mm_evas_renderer_destroy(&cb_info->evas_info);
2059 #endif /* TIZEN_FEATURE_EVAS_RENDERER */
2061 cb_info->preview_cb_flag = 0;
2070 int _camera_start_evas_rendering(camera_h camera)
2072 int ret = CAMERA_ERROR_NONE;
2073 camera_cli_s *pc = (camera_cli_s *)camera;
2075 if (camera == NULL) {
2076 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2077 return CAMERA_ERROR_INVALID_PARAMETER;
2080 if (pc->cb_info == NULL) {
2081 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2082 return CAMERA_ERROR_INVALID_PARAMETER;
2087 if (!CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
2088 LOGE("EVAS surface is not set");
2089 return CAMERA_ERROR_NONE;
2092 #ifdef TIZEN_FEATURE_EVAS_RENDERER
2093 g_mutex_lock(&pc->cb_info->evas_mutex);
2095 /* set evas render flag as RUN */
2096 pc->cb_info->run_evas_render = true;
2097 ret = CAMERA_ERROR_NONE;
2099 g_mutex_unlock(&pc->cb_info->evas_mutex);
2100 #else /* TIZEN_FEATURE_EVAS_RENDERER */
2101 LOGW("evas renderer is not supported");
2102 ret = CAMERA_ERROR_NOT_SUPPORTED;
2103 #endif /* TIZEN_FEATURE_EVAS_RENDERER */
2109 int _camera_stop_evas_rendering(camera_h camera, bool keep_screen)
2111 int ret = CAMERA_ERROR_NONE;
2112 camera_cli_s *pc = (camera_cli_s *)camera;
2114 if (camera == NULL) {
2115 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2116 return CAMERA_ERROR_INVALID_PARAMETER;
2119 if (pc->cb_info == NULL) {
2120 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2121 return CAMERA_ERROR_INVALID_PARAMETER;
2124 LOGD("stop - keep screen %d", keep_screen);
2126 if (!CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
2127 LOGE("EVAS surface is not set");
2128 return CAMERA_ERROR_NONE;
2131 #ifdef TIZEN_FEATURE_EVAS_RENDERER
2132 g_mutex_lock(&pc->cb_info->evas_mutex);
2134 /* set evas render flag as STOP and release buffers */
2135 pc->cb_info->run_evas_render = false;
2137 ret = mm_evas_renderer_retrieve_all_packets(pc->cb_info->evas_info, keep_screen);
2138 if (ret != MM_ERROR_NONE) {
2139 LOGE("mm_evas_renderer_retrieve_all_packets failed 0x%x", ret);
2140 ret = CAMERA_ERROR_INVALID_OPERATION;
2143 g_mutex_unlock(&pc->cb_info->evas_mutex);
2144 #else /* TIZEN_FEATURE_EVAS_RENDERER */
2145 LOGW("evas renderer is not supported");
2146 ret = CAMERA_ERROR_NOT_SUPPORTED;
2147 #endif /* TIZEN_FEATURE_EVAS_RENDERER */
2153 int camera_create(camera_device_e device, camera_h *camera)
2157 int ret = CAMERA_ERROR_NONE;
2159 camera_cli_s *pc = NULL;
2160 tbm_bufmgr bufmgr = NULL;
2162 muse_camera_api_e api = MUSE_CAMERA_API_CREATE;
2163 muse_core_api_module_e muse_module = MUSE_CAMERA;
2164 int device_type = (int)device;
2166 if (camera == NULL) {
2167 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2168 return CAMERA_ERROR_INVALID_PARAMETER;
2171 bufmgr = tbm_bufmgr_init(-1);
2172 if (bufmgr == NULL) {
2173 LOGE("get tbm bufmgr failed");
2174 return CAMERA_ERROR_INVALID_OPERATION;
2177 sock_fd = muse_core_client_new();
2179 LOGE("muse_core_client_new failed - returned fd %d", sock_fd);
2180 ret = CAMERA_ERROR_INVALID_OPERATION;
2186 sndMsg = muse_core_msg_json_factory_new(api,
2187 MUSE_TYPE_INT, "module", muse_module,
2188 MUSE_TYPE_INT, PARAM_DEVICE_TYPE, device_type,
2189 MUSE_TYPE_INT, "pid", pid,
2192 muse_core_ipc_send_msg(sock_fd, sndMsg);
2193 muse_core_msg_json_factory_free(sndMsg);
2195 pc = g_new0(camera_cli_s, 1);
2197 LOGE("camera_cli_s alloc failed");
2198 ret = CAMERA_ERROR_OUT_OF_MEMORY;
2202 pc->cb_info = _client_callback_new(sock_fd);
2203 if (pc->cb_info == NULL) {
2204 LOGE("cb_info alloc failed");
2205 ret = CAMERA_ERROR_OUT_OF_MEMORY;
2209 LOGD("cb info : %d", pc->cb_info->fd);
2211 ret = _client_wait_for_cb_return(api, pc->cb_info, CALLBACK_TIME_OUT);
2212 if (ret == CAMERA_ERROR_NONE) {
2213 intptr_t handle = 0;
2214 muse_camera_msg_get_pointer(handle, pc->cb_info->recv_msg);
2216 LOGE("Receiving Handle Failed!!");
2217 ret = CAMERA_ERROR_INVALID_OPERATION;
2221 pc->remote_handle = handle;
2222 pc->cb_info->bufmgr = bufmgr;
2224 ret = camera_set_display((camera_h)pc, CAMERA_DISPLAY_TYPE_NONE, NULL);
2225 if (ret != CAMERA_ERROR_NONE) {
2226 LOGE("init display failed 0x%x", ret);
2230 LOGD("camera create 0x%x", pc->remote_handle);
2231 *camera = (camera_h)pc;
2239 tbm_bufmgr_deinit(bufmgr);
2243 _client_callback_destroy(pc->cb_info);
2249 LOGE("camera create error : 0x%x", ret);
2255 int camera_change_device(camera_h camera, camera_device_e device)
2257 int ret = CAMERA_ERROR_NONE;
2258 muse_camera_api_e api = MUSE_CAMERA_API_CHANGE_DEVICE;
2259 camera_cli_s *pc = (camera_cli_s *)camera;
2261 if (camera == NULL || pc->cb_info == NULL) {
2262 LOGE("NULL handle, INVALID_PARAMETER");
2263 return CAMERA_ERROR_INVALID_PARAMETER;
2266 muse_camera_msg_send1(api, pc->cb_info->fd, pc->cb_info, ret, INT, device);
2272 int camera_destroy(camera_h camera)
2274 if (camera == NULL) {
2275 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2276 return CAMERA_ERROR_INVALID_PARAMETER;
2279 int ret = CAMERA_ERROR_NONE;
2280 muse_camera_api_e api = MUSE_CAMERA_API_DESTROY;
2281 camera_cli_s *pc = (camera_cli_s *)camera;
2286 if (pc->cb_info == NULL) {
2287 LOGE("cb_info NULL, INVALID_PARAMETER");
2288 return CAMERA_ERROR_INVALID_PARAMETER;
2291 sock_fd = pc->cb_info->fd;
2293 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2294 if (ret == CAMERA_ERROR_NONE) {
2295 _camera_remove_idle_event_all(pc->cb_info);
2296 _client_callback_destroy(pc->cb_info);
2302 LOGE("camera destroy error : 0x%x", ret);
2308 int camera_start_preview(camera_h camera)
2310 int ret = CAMERA_ERROR_NONE;
2311 muse_camera_api_e api = MUSE_CAMERA_API_START_PREVIEW;
2312 camera_cli_s *pc = (camera_cli_s *)camera;
2315 if (camera == NULL) {
2316 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2317 return CAMERA_ERROR_INVALID_PARAMETER;
2320 if (pc->cb_info == NULL) {
2321 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2322 return CAMERA_ERROR_INVALID_PARAMETER;
2327 sock_fd = pc->cb_info->fd;
2329 muse_camera_msg_send_longtime(api, sock_fd, pc->cb_info, ret);
2331 if (ret != CAMERA_ERROR_NONE) {
2332 LOGE("start preview failed 0x%x", ret);
2333 } else if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
2334 ret = _camera_start_evas_rendering(camera);
2337 LOGD("ret : 0x%x", ret);
2342 int camera_stop_preview(camera_h camera)
2344 int ret = CAMERA_ERROR_NONE;
2346 camera_cli_s *pc = NULL;
2347 muse_camera_api_e api = MUSE_CAMERA_API_STOP_PREVIEW;
2349 if (camera == NULL) {
2350 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2351 return CAMERA_ERROR_INVALID_PARAMETER;
2354 pc = (camera_cli_s *)camera;
2356 if (pc->cb_info == NULL) {
2357 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2358 return CAMERA_ERROR_INVALID_PARAMETER;
2361 sock_fd = pc->cb_info->fd;
2365 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
2366 camera_state_e current_state = CAMERA_STATE_NONE;
2368 ret = camera_get_state(camera, ¤t_state);
2369 if (ret != CAMERA_ERROR_NONE) {
2370 LOGE("failed to get current state 0x%x", ret);
2374 if (current_state == CAMERA_STATE_PREVIEW) {
2375 ret = _camera_stop_evas_rendering(camera, false);
2376 if (ret != CAMERA_ERROR_NONE)
2381 /* send stop preview message */
2382 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2384 LOGD("ret : 0x%x", ret);
2389 int camera_start_capture(camera_h camera, camera_capturing_cb capturing_cb, camera_capture_completed_cb completed_cb, void *user_data)
2391 if (camera == NULL) {
2392 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2393 return CAMERA_ERROR_INVALID_PARAMETER;
2395 int ret = CAMERA_ERROR_NONE;
2397 camera_cli_s *pc = (camera_cli_s *)camera;
2398 muse_camera_api_e api = MUSE_CAMERA_API_START_CAPTURE;
2400 int is_capturing_cb = 0;
2401 int is_completed_cb = 0;
2402 LOGD("Enter, handle :%x", pc->remote_handle);
2404 if (pc->cb_info == NULL) {
2405 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2406 return CAMERA_ERROR_INVALID_PARAMETER;
2409 sock_fd = pc->cb_info->fd;
2411 if (capturing_cb != NULL) {
2412 is_capturing_cb = 1;
2413 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = capturing_cb;
2414 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = user_data;
2417 if (completed_cb != NULL) {
2418 is_completed_cb = 1;
2419 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = completed_cb;
2420 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = user_data;
2423 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, is_capturing_cb, INT, is_completed_cb);
2424 LOGD("is_capturing_cb :%d, is_completed_cb : %d", is_capturing_cb, is_completed_cb);
2425 LOGD("ret : 0x%x", ret);
2429 bool camera_is_supported_continuous_capture(camera_h camera)
2431 if (camera == NULL) {
2432 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2436 int ret = CAMERA_ERROR_NONE;
2437 camera_cli_s *pc = (camera_cli_s *)camera;
2438 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_CONTINUOUS_CAPTURE;
2441 if (pc->cb_info == NULL) {
2442 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2443 return CAMERA_ERROR_INVALID_PARAMETER;
2446 sock_fd = pc->cb_info->fd;
2448 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2449 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2450 LOGD("ret : 0x%x", ret);
2454 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)
2456 if (camera == NULL) {
2457 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2458 return CAMERA_ERROR_INVALID_PARAMETER;
2461 int ret = CAMERA_ERROR_NONE;
2463 camera_cli_s *pc = (camera_cli_s *)camera;
2464 muse_camera_api_e api = MUSE_CAMERA_API_START_CONTINUOUS_CAPTURE;
2466 LOGD("Enter, handle :%x", pc->remote_handle);
2469 if (pc->cb_info == NULL) {
2470 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2471 return CAMERA_ERROR_INVALID_PARAMETER;
2473 sock_fd = pc->cb_info->fd;
2475 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = capturing_cb;
2476 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = user_data;
2477 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = completed_cb;
2479 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, count, INT, interval);
2481 LOGD("ret : 0x%x", ret);
2486 int camera_stop_continuous_capture(camera_h camera)
2488 if (camera == NULL) {
2489 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2490 return CAMERA_ERROR_INVALID_PARAMETER;
2494 int ret = CAMERA_ERROR_NONE;
2496 camera_cli_s *pc = (camera_cli_s *)camera;
2497 muse_camera_api_e api = MUSE_CAMERA_API_STOP_CONTINUOUS_CAPTURE;
2498 LOGD("Enter, handle :%x", pc->remote_handle);
2500 if (pc->cb_info == NULL) {
2501 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2502 return CAMERA_ERROR_INVALID_PARAMETER;
2504 sock_fd = pc->cb_info->fd;
2505 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2506 LOGD("ret : 0x%x", ret);
2510 bool camera_is_supported_face_detection(camera_h camera)
2512 if (camera == NULL) {
2513 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2516 int ret = CAMERA_ERROR_NONE;
2518 camera_cli_s *pc = (camera_cli_s *)camera;
2519 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_FACE_DETECTION;
2521 if (pc->cb_info == NULL) {
2522 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2523 return CAMERA_ERROR_INVALID_PARAMETER;
2525 sock_fd = pc->cb_info->fd;
2527 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2528 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2529 LOGD("ret : 0x%x", ret);
2533 bool camera_is_supported_zero_shutter_lag(camera_h camera)
2535 if (camera == NULL) {
2536 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2539 int ret = CAMERA_ERROR_NONE;
2541 camera_cli_s *pc = (camera_cli_s *)camera;
2542 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_ZERO_SHUTTER_LAG;
2544 if (pc->cb_info == NULL) {
2545 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2546 return CAMERA_ERROR_INVALID_PARAMETER;
2548 sock_fd = pc->cb_info->fd;
2550 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2551 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2552 LOGD("ret : 0x%x", ret);
2556 bool camera_is_supported_media_packet_preview_cb(camera_h camera)
2558 if (camera == NULL) {
2559 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2563 int ret = CAMERA_ERROR_NONE;
2565 camera_cli_s *pc = (camera_cli_s *)camera;
2566 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_MEDIA_PACKET_PREVIEW_CB;
2568 if (pc->cb_info == NULL) {
2569 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2570 return CAMERA_ERROR_INVALID_PARAMETER;
2572 sock_fd = pc->cb_info->fd;
2574 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2575 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2576 LOGD("ret : 0x%x", ret);
2580 int camera_get_device_count(camera_h camera, int *device_count)
2582 if (camera == NULL || device_count == NULL) {
2583 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2584 return CAMERA_ERROR_INVALID_PARAMETER;
2586 int ret = CAMERA_ERROR_NONE;
2588 camera_cli_s *pc = (camera_cli_s *)camera;
2589 muse_camera_api_e api = MUSE_CAMERA_API_GET_DEVICE_COUNT;
2591 if (pc->cb_info == NULL) {
2592 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2593 return CAMERA_ERROR_INVALID_PARAMETER;
2595 sock_fd = pc->cb_info->fd;
2596 int get_device_count;
2598 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2599 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2601 if (ret == CAMERA_ERROR_NONE) {
2602 muse_camera_msg_get(get_device_count, pc->cb_info->recv_msg);
2603 *device_count = get_device_count;
2605 LOGD("ret : 0x%x", ret);
2609 int camera_start_face_detection(camera_h camera, camera_face_detected_cb callback, void *user_data)
2611 if (camera == NULL) {
2612 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2613 return CAMERA_ERROR_INVALID_PARAMETER;
2616 int ret = CAMERA_ERROR_NONE;
2618 camera_cli_s *pc = (camera_cli_s *)camera;
2619 muse_camera_api_e api = MUSE_CAMERA_API_START_FACE_DETECTION;
2621 LOGD("Enter, handle :%x", pc->remote_handle);
2623 if (pc->cb_info == NULL) {
2624 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2625 return CAMERA_ERROR_INVALID_PARAMETER;
2627 sock_fd = pc->cb_info->fd;
2628 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION] = callback;
2629 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION] = user_data;
2631 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2632 LOGD("ret : 0x%x", ret);
2636 int camera_stop_face_detection(camera_h camera)
2638 if (camera == NULL) {
2639 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2640 return CAMERA_ERROR_INVALID_PARAMETER;
2643 int ret = CAMERA_ERROR_NONE;
2645 camera_cli_s *pc = (camera_cli_s *)camera;
2646 muse_camera_api_e api = MUSE_CAMERA_API_STOP_FACE_DETECTION;
2647 LOGD("Enter, handle :%x", pc->remote_handle);
2649 if (pc->cb_info == NULL) {
2650 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2651 return CAMERA_ERROR_INVALID_PARAMETER;
2653 sock_fd = pc->cb_info->fd;
2654 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2655 LOGD("ret : 0x%x", ret);
2659 int camera_get_state(camera_h camera, camera_state_e *state)
2661 if (camera == NULL || state == NULL) {
2662 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2663 return CAMERA_ERROR_INVALID_PARAMETER;
2665 int ret = CAMERA_ERROR_NONE;
2667 camera_cli_s *pc = (camera_cli_s *)camera;
2668 muse_camera_api_e api = MUSE_CAMERA_API_GET_STATE;
2670 if (pc->cb_info == NULL) {
2671 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2672 return CAMERA_ERROR_INVALID_PARAMETER;
2674 sock_fd = pc->cb_info->fd;
2677 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2678 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2680 if (ret == CAMERA_ERROR_NONE) {
2681 muse_camera_msg_get(get_state, pc->cb_info->recv_msg);
2682 *state = (camera_state_e)get_state;
2684 LOGD("ret : 0x%x", ret);
2688 int camera_start_focusing(camera_h camera, bool continuous)
2690 if (camera == NULL) {
2691 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2692 return CAMERA_ERROR_INVALID_PARAMETER;
2695 int ret = CAMERA_ERROR_NONE;
2697 camera_cli_s *pc = (camera_cli_s *)camera;
2698 muse_camera_api_e api = MUSE_CAMERA_API_START_FOCUSING;
2700 if (pc->cb_info == NULL) {
2701 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2702 return CAMERA_ERROR_INVALID_PARAMETER;
2704 sock_fd = pc->cb_info->fd;
2705 int is_continuous = (int)continuous;
2707 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2708 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, is_continuous);
2709 LOGD("ret : 0x%x", ret);
2713 int camera_cancel_focusing(camera_h camera)
2715 if (camera == NULL) {
2716 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2717 return CAMERA_ERROR_INVALID_PARAMETER;
2720 int ret = CAMERA_ERROR_NONE;
2722 camera_cli_s *pc = (camera_cli_s *)camera;
2723 muse_camera_api_e api = MUSE_CAMERA_API_CANCEL_FOCUSING;
2725 if (pc->cb_info == NULL) {
2726 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2727 return CAMERA_ERROR_INVALID_PARAMETER;
2729 sock_fd = pc->cb_info->fd;
2731 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2732 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2733 LOGD("ret : 0x%x", ret);
2737 int camera_set_display(camera_h camera, camera_display_type_e type, camera_display_h display)
2739 int ret = CAMERA_ERROR_NONE;
2740 void *set_display_handle = NULL;
2741 Evas_Object *obj = NULL;
2742 const char *object_type = NULL;
2743 camera_wl_info_s *wl_info = NULL;
2744 camera_cli_s *pc = (camera_cli_s *)camera;
2745 camera_cb_info_s *cb_info = NULL;
2746 muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY;
2747 camera_state_e current_state = CAMERA_STATE_NONE;
2750 if (camera == NULL) {
2751 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2752 return CAMERA_ERROR_INVALID_PARAMETER;
2755 if (type < CAMERA_DISPLAY_TYPE_OVERLAY || type > CAMERA_DISPLAY_TYPE_NONE) {
2756 LOGE("invalid type %d", type);
2757 return CAMERA_ERROR_INVALID_PARAMETER;
2760 if (type != CAMERA_DISPLAY_TYPE_NONE && display == NULL) {
2761 LOGE("display type[%d] is not NONE, but display handle is NULL", type);
2762 return CAMERA_ERROR_INVALID_PARAMETER;
2765 if (pc->cb_info == NULL) {
2766 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2767 return CAMERA_ERROR_INVALID_PARAMETER;
2770 cb_info = (camera_cb_info_s *)pc->cb_info;
2771 sock_fd = cb_info->fd;
2773 ret = camera_get_state(camera, ¤t_state);
2774 if (ret != CAMERA_ERROR_NONE) {
2775 LOGE("failed to get current state 0x%x", ret);
2779 if (current_state != CAMERA_STATE_CREATED) {
2780 LOGE("INVALID_STATE : current %d", current_state);
2781 return CAMERA_ERROR_INVALID_STATE;
2784 LOGD("Enter, remote_handle : %x display : 0x%x", pc->remote_handle, display);
2786 if (type == CAMERA_DISPLAY_TYPE_NONE) {
2787 set_display_handle = 0;
2788 LOGD("display type NONE");
2790 obj = (Evas_Object *)display;
2791 object_type = evas_object_type_get(obj);
2793 if (type == CAMERA_DISPLAY_TYPE_OVERLAY && !strcmp(object_type, "elm_win")) {
2794 /* get wayland parent id */
2795 if (_get_wl_info(obj, &pc->wl_info) != CAMERA_ERROR_NONE) {
2796 LOGE("failed to get wayland info");
2797 return CAMERA_ERROR_INVALID_OPERATION;
2800 set_display_handle = (void *)&pc->wl_info;
2801 LOGD("display type OVERLAY : handle %p", set_display_handle);
2802 } else if (type == CAMERA_DISPLAY_TYPE_EVAS && !strcmp(object_type, "image")) {
2803 /* evas object surface */
2804 set_display_handle = (void *)display;
2805 LOGD("display type EVAS : handle %p", set_display_handle);
2807 #ifdef TIZEN_FEATURE_EVAS_RENDERER
2808 g_mutex_lock(&cb_info->evas_mutex);
2810 if (cb_info->evas_info) {
2811 LOGW("destroy existed evas renderer %p", cb_info->evas_info);
2812 ret = mm_evas_renderer_destroy(&cb_info->evas_info);
2813 if (ret != MM_ERROR_NONE) {
2814 LOGE("failed to destroy evas renderer %p", cb_info->evas_info);
2815 g_mutex_unlock(&cb_info->evas_mutex);
2816 return CAMERA_ERROR_INVALID_OPERATION;
2820 /* create evas renderer */
2821 ret = mm_evas_renderer_create(&cb_info->evas_info, (Evas_Object *)set_display_handle);
2822 if (ret == MM_ERROR_NONE) {
2823 camera_flip_e flip = CAMERA_FLIP_NONE;
2824 camera_display_mode_e mode = CAMERA_DISPLAY_MODE_LETTER_BOX;
2825 camera_rotation_e rotation = CAMERA_ROTATION_NONE;
2832 camera_get_display_flip(camera, &flip);
2833 camera_get_display_mode(camera, &mode);
2834 camera_get_display_rotation(camera, &rotation);
2835 camera_is_display_visible(camera, &visible);
2836 camera_attr_get_display_roi_area(camera, &x, &y, &width, &height);
2838 LOGD("current setting : flip %d, mode %d, rotation %d, visible %d, roi %d,%d,%dx%d",
2839 flip, mode, rotation, visible, x, y, width, height);
2841 ret = mm_evas_renderer_set_flip(cb_info->evas_info, flip);
2842 ret |= mm_evas_renderer_set_geometry(cb_info->evas_info, mode);
2843 ret |= mm_evas_renderer_set_rotation(cb_info->evas_info, rotation);
2844 ret |= mm_evas_renderer_set_visible(cb_info->evas_info, visible);
2846 if (mode == CAMERA_DISPLAY_MODE_CUSTOM_ROI)
2847 ret |= mm_evas_renderer_set_roi_area(cb_info->evas_info, x, y, width, height);
2850 g_mutex_unlock(&cb_info->evas_mutex);
2852 if (ret != MM_ERROR_NONE) {
2853 LOGE("mm_evas_renderer error 0x%x", ret);
2854 return CAMERA_ERROR_INVALID_OPERATION;
2856 #else /* TIZEN_FEATURE_EVAS_RENDERER */
2857 LOGE("EVAS surface is not supported");
2858 return CAMERA_ERROR_NOT_SUPPORTED;
2859 #endif /* TIZEN_FEATURE_EVAS_RENDERER */
2861 LOGE("unknown evas object [%p,%s] or type [%d] mismatch", obj, object_type, type);
2862 return CAMERA_ERROR_INVALID_PARAMETER;
2865 LOGE("failed to get evas object type from %p", obj);
2866 return CAMERA_ERROR_INVALID_PARAMETER;
2870 pc->display_handle = (intptr_t)set_display_handle;
2872 if (type == CAMERA_DISPLAY_TYPE_OVERLAY) {
2873 wl_info = &pc->wl_info;
2874 muse_camera_msg_send_array_and_value(api, sock_fd, cb_info, ret,
2875 wl_info, sizeof(camera_wl_info_s), sizeof(int), INT, type);
2877 LOGD("wayland parent id : %d, window %d,%d,%dx%d",
2878 wl_info->parent_id, wl_info->window_x, wl_info->window_y,
2879 wl_info->window_width, wl_info->window_height);
2881 muse_camera_msg_send1(api, sock_fd, cb_info, ret, INT, type);
2883 if (ret != CAMERA_ERROR_NONE)
2884 LOGE("set display error 0x%x", ret);
2885 else if (type == CAMERA_DISPLAY_TYPE_EVAS)
2886 SET_PREVIEW_CB_TYPE(cb_info, PREVIEW_CB_TYPE_EVAS);
2891 int camera_set_preview_resolution(camera_h camera, int width, int height)
2893 if (camera == NULL) {
2894 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2895 return CAMERA_ERROR_INVALID_PARAMETER;
2897 int ret = CAMERA_ERROR_NONE;
2899 camera_cli_s *pc = (camera_cli_s *)camera;
2900 muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_RESOLUTION;
2902 if (pc->cb_info == NULL) {
2903 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2904 return CAMERA_ERROR_INVALID_PARAMETER;
2906 sock_fd = pc->cb_info->fd;
2908 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2909 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, width, INT, height);
2910 LOGD("ret : 0x%x", ret);
2915 int camera_set_capture_resolution(camera_h camera, int width, int height)
2917 if (camera == NULL) {
2918 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2919 return CAMERA_ERROR_INVALID_PARAMETER;
2922 int ret = CAMERA_ERROR_NONE;
2924 camera_cli_s *pc = (camera_cli_s *)camera;
2925 muse_camera_api_e api = MUSE_CAMERA_API_SET_CAPTURE_RESOLUTION;
2927 if (pc->cb_info == NULL) {
2928 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2929 return CAMERA_ERROR_INVALID_PARAMETER;
2931 sock_fd = pc->cb_info->fd;
2933 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2934 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, width, INT, height);
2935 LOGD("ret : 0x%x", ret);
2939 int camera_set_capture_format(camera_h camera, camera_pixel_format_e format)
2941 if (camera == NULL) {
2942 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2943 return CAMERA_ERROR_INVALID_PARAMETER;
2946 int ret = CAMERA_ERROR_NONE;
2947 int set_format = (int)format;
2949 camera_cli_s *pc = (camera_cli_s *)camera;
2950 muse_camera_api_e api = MUSE_CAMERA_API_SET_CAPTURE_FORMAT;
2952 if (pc->cb_info == NULL) {
2953 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2954 return CAMERA_ERROR_INVALID_PARAMETER;
2956 sock_fd = pc->cb_info->fd;
2958 LOGD("Enter, remote_handle : %x, capture_format: %d", pc->remote_handle, set_format);
2959 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_format);
2960 LOGD("ret : 0x%x", ret);
2964 int camera_set_preview_format(camera_h camera, camera_pixel_format_e format)
2966 if (camera == NULL) {
2967 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2968 return CAMERA_ERROR_INVALID_PARAMETER;
2971 int ret = CAMERA_ERROR_NONE;
2972 int set_format = (int)format;
2974 camera_cli_s *pc = (camera_cli_s *)camera;
2975 muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_FORMAT;
2977 if (pc->cb_info == NULL) {
2978 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2979 return CAMERA_ERROR_INVALID_PARAMETER;
2981 sock_fd = pc->cb_info->fd;
2983 LOGD("Enter, remote_handle : %x, capture_format: %d", pc->remote_handle, set_format);
2984 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_format);
2985 LOGD("ret : 0x%x", ret);
2989 int camera_get_preview_resolution(camera_h camera, int *width, int *height)
2991 if (camera == NULL || width == NULL || height == NULL) {
2992 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2993 return CAMERA_ERROR_INVALID_PARAMETER;
2997 int ret = CAMERA_ERROR_NONE;
2999 camera_cli_s *pc = (camera_cli_s *)camera;
3000 muse_camera_api_e api = MUSE_CAMERA_API_GET_PREVIEW_RESOLUTION;
3002 if (pc->cb_info == NULL) {
3003 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3004 return CAMERA_ERROR_INVALID_PARAMETER;
3006 sock_fd = pc->cb_info->fd;
3010 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3011 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3013 if (ret == CAMERA_ERROR_NONE) {
3014 muse_camera_msg_get(get_width, pc->cb_info->recv_msg);
3015 muse_camera_msg_get(get_height, pc->cb_info->recv_msg);
3017 *height = get_height;
3019 LOGD("ret : 0x%x", ret);
3023 int camera_set_display_rotation(camera_h camera, camera_rotation_e rotation)
3025 int ret = CAMERA_ERROR_NONE;
3026 int set_rotation = (int)rotation;
3027 camera_cli_s *pc = NULL;
3029 if (camera == NULL) {
3030 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3031 return CAMERA_ERROR_INVALID_PARAMETER;
3034 if (rotation < CAMERA_ROTATION_NONE || rotation > CAMERA_ROTATION_270) {
3035 LOGE("Invalid rotation %d", rotation);
3036 return CAMERA_ERROR_INVALID_PARAMETER;
3039 pc = (camera_cli_s *)camera;
3041 if (pc->cb_info == NULL) {
3042 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3043 return CAMERA_ERROR_INVALID_PARAMETER;
3046 #ifdef TIZEN_FEATURE_EVAS_RENDERER
3047 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
3048 g_mutex_lock(&pc->cb_info->evas_mutex);
3050 ret = mm_evas_renderer_set_rotation(pc->cb_info->evas_info, rotation);
3052 g_mutex_unlock(&pc->cb_info->evas_mutex);
3054 if (ret != MM_ERROR_NONE) {
3055 LOGE("failed to set rotation for evas surface 0x%x", ret);
3056 return CAMERA_ERROR_INVALID_OPERATION;
3059 #endif /* TIZEN_FEATURE_EVAS_RENDERER */
3061 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_ROTATION,
3062 pc->cb_info->fd, pc->cb_info, ret, INT, set_rotation);
3067 int camera_get_display_rotation(camera_h camera, camera_rotation_e *rotation)
3069 int ret = CAMERA_ERROR_NONE;
3070 int get_rotation = CAMERA_ROTATION_NONE;
3071 camera_cli_s *pc = NULL;
3073 if (camera == NULL || rotation == NULL) {
3074 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3075 return CAMERA_ERROR_INVALID_PARAMETER;
3078 pc = (camera_cli_s *)camera;
3080 if (pc->cb_info == NULL) {
3081 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3082 return CAMERA_ERROR_INVALID_PARAMETER;
3085 muse_camera_msg_send(MUSE_CAMERA_API_GET_DISPLAY_ROTATION,
3086 pc->cb_info->fd, pc->cb_info, ret);
3088 if (ret == CAMERA_ERROR_NONE) {
3089 muse_camera_msg_get(get_rotation, pc->cb_info->recv_msg);
3090 *rotation = (camera_rotation_e)get_rotation;
3096 int camera_set_display_flip(camera_h camera, camera_flip_e flip)
3098 int ret = CAMERA_ERROR_NONE;
3099 int set_flip = (int)flip;
3100 camera_cli_s *pc = NULL;
3102 if (camera == NULL) {
3103 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3104 return CAMERA_ERROR_INVALID_PARAMETER;
3107 if (flip < CAMERA_FLIP_NONE || flip > CAMERA_FLIP_BOTH) {
3108 LOGE("Invalid flip %d", flip);
3109 return CAMERA_ERROR_INVALID_PARAMETER;
3112 pc = (camera_cli_s *)camera;
3114 if (pc->cb_info == NULL) {
3115 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3116 return CAMERA_ERROR_INVALID_PARAMETER;
3119 #ifdef TIZEN_FEATURE_EVAS_RENDERER
3120 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
3121 g_mutex_lock(&pc->cb_info->evas_mutex);
3123 ret = mm_evas_renderer_set_flip(pc->cb_info->evas_info, flip);
3125 g_mutex_unlock(&pc->cb_info->evas_mutex);
3127 if (ret != MM_ERROR_NONE) {
3128 LOGE("failed to set flip for evas surface 0x%x", ret);
3129 return CAMERA_ERROR_INVALID_OPERATION;
3132 #endif /* TIZEN_FEATURE_EVAS_RENDERER */
3134 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_FLIP,
3135 pc->cb_info->fd, pc->cb_info, ret, INT, set_flip);
3140 int camera_get_display_flip(camera_h camera, camera_flip_e *flip)
3142 int ret = CAMERA_ERROR_NONE;
3143 int get_flip = CAMERA_FLIP_NONE;
3144 camera_cli_s *pc = NULL;
3146 if (camera == NULL || flip == NULL) {
3147 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3148 return CAMERA_ERROR_INVALID_PARAMETER;
3151 pc = (camera_cli_s *)camera;
3153 if (pc->cb_info == NULL) {
3154 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3155 return CAMERA_ERROR_INVALID_PARAMETER;
3158 muse_camera_msg_send(MUSE_CAMERA_API_GET_DISPLAY_FLIP,
3159 pc->cb_info->fd, pc->cb_info, ret);
3161 if (ret == CAMERA_ERROR_NONE) {
3162 muse_camera_msg_get(get_flip, pc->cb_info->recv_msg);
3163 *flip = (camera_flip_e)get_flip;
3169 int camera_set_display_visible(camera_h camera, bool visible)
3171 int ret = CAMERA_ERROR_NONE;
3172 int set_visible = (int)visible;
3173 camera_cli_s *pc = NULL;
3175 if (camera == NULL) {
3176 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3177 return CAMERA_ERROR_INVALID_PARAMETER;
3180 pc = (camera_cli_s *)camera;
3182 if (pc->cb_info == NULL) {
3183 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3184 return CAMERA_ERROR_INVALID_PARAMETER;
3187 #ifdef TIZEN_FEATURE_EVAS_RENDERER
3188 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
3189 g_mutex_lock(&pc->cb_info->evas_mutex);
3191 ret = mm_evas_renderer_set_visible(pc->cb_info->evas_info, visible);
3193 g_mutex_unlock(&pc->cb_info->evas_mutex);
3195 if (ret != MM_ERROR_NONE) {
3196 LOGE("failed to set visible for evas surface 0x%x", ret);
3197 return CAMERA_ERROR_INVALID_OPERATION;
3200 #endif /* TIZEN_FEATURE_EVAS_RENDERER */
3202 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_VISIBLE,
3203 pc->cb_info->fd, pc->cb_info, ret, INT, set_visible);
3208 int camera_is_display_visible(camera_h camera, bool *visible)
3210 int ret = CAMERA_ERROR_NONE;
3211 int get_visible = true;
3212 camera_cli_s *pc = NULL;
3214 if (camera == NULL || visible == NULL) {
3215 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3216 return CAMERA_ERROR_INVALID_PARAMETER;
3219 pc = (camera_cli_s *)camera;
3221 if (pc->cb_info == NULL) {
3222 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3223 return CAMERA_ERROR_INVALID_PARAMETER;
3226 muse_camera_msg_send(MUSE_CAMERA_API_IS_DISPLAY_VISIBLE,
3227 pc->cb_info->fd, pc->cb_info, ret);
3229 if (ret == CAMERA_ERROR_NONE) {
3230 muse_camera_msg_get(get_visible, pc->cb_info->recv_msg);
3231 *visible = (bool)get_visible;
3237 int camera_set_display_mode(camera_h camera, camera_display_mode_e mode)
3239 int ret = CAMERA_ERROR_NONE;
3240 int set_mode = (int)mode;
3241 camera_cli_s *pc = NULL;
3243 if (camera == NULL) {
3244 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3245 return CAMERA_ERROR_INVALID_PARAMETER;
3248 if (mode < CAMERA_DISPLAY_MODE_LETTER_BOX || mode > CAMERA_DISPLAY_MODE_CUSTOM_ROI) {
3249 LOGE("Invalid mode %d", mode);
3250 return CAMERA_ERROR_INVALID_PARAMETER;
3253 pc = (camera_cli_s *)camera;
3255 if (pc->cb_info == NULL) {
3256 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3257 return CAMERA_ERROR_INVALID_PARAMETER;
3260 #ifdef TIZEN_FEATURE_EVAS_RENDERER
3261 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
3262 g_mutex_lock(&pc->cb_info->evas_mutex);
3264 ret = mm_evas_renderer_set_geometry(pc->cb_info->evas_info, mode);
3266 g_mutex_unlock(&pc->cb_info->evas_mutex);
3268 if (ret != MM_ERROR_NONE) {
3269 LOGE("failed to set geometry for evas surface 0x%x", ret);
3270 return CAMERA_ERROR_INVALID_OPERATION;
3273 #endif /* TIZEN_FEATURE_EVAS_RENDERER */
3275 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_MODE,
3276 pc->cb_info->fd, pc->cb_info, ret, INT, set_mode);
3281 int camera_get_display_mode(camera_h camera, camera_display_mode_e *mode)
3283 int ret = CAMERA_ERROR_NONE;
3284 int get_mode = CAMERA_DISPLAY_MODE_LETTER_BOX;
3285 camera_cli_s *pc = NULL;
3287 if (camera == NULL || mode == NULL) {
3288 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3289 return CAMERA_ERROR_INVALID_PARAMETER;
3292 pc = (camera_cli_s *)camera;
3294 if (pc->cb_info == NULL) {
3295 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3296 return CAMERA_ERROR_INVALID_PARAMETER;
3299 muse_camera_msg_send(MUSE_CAMERA_API_GET_DISPLAY_MODE,
3300 pc->cb_info->fd, pc->cb_info, ret);
3302 if (ret == CAMERA_ERROR_NONE) {
3303 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
3304 *mode = (camera_display_mode_e)get_mode;
3311 int camera_set_display_reuse_hint(camera_h camera, bool hint)
3313 int ret = CAMERA_ERROR_NONE;
3314 int set_hint = (int)hint;
3315 camera_cli_s *pc = (camera_cli_s *)camera;
3317 if (camera == NULL) {
3318 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3319 return CAMERA_ERROR_INVALID_PARAMETER;
3322 if (pc->cb_info == NULL) {
3323 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3324 return CAMERA_ERROR_INVALID_PARAMETER;
3327 LOGD("set display reuse hint %d", set_hint);
3329 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_REUSE_HINT,
3330 pc->cb_info->fd, pc->cb_info, ret, INT, set_hint);
3336 int camera_get_display_reuse_hint(camera_h camera, bool *hint)
3338 int ret = CAMERA_ERROR_NONE;
3340 camera_cli_s *pc = (camera_cli_s *)camera;
3341 muse_camera_api_e api = MUSE_CAMERA_API_GET_DISPLAY_REUSE_HINT;
3343 if (camera == NULL || hint == NULL) {
3344 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3345 return CAMERA_ERROR_INVALID_PARAMETER;
3348 if (pc->cb_info == NULL) {
3349 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3350 return CAMERA_ERROR_INVALID_PARAMETER;
3353 muse_camera_msg_send(api, pc->cb_info->fd, pc->cb_info, ret);
3355 if (ret == CAMERA_ERROR_NONE) {
3356 muse_camera_msg_get(get_hint, pc->cb_info->recv_msg);
3357 *hint = (bool)get_hint;
3359 LOGD("display reuse hint %d", *hint);
3361 LOGE("failed 0x%x", ret);
3368 int camera_get_capture_resolution(camera_h camera, int *width, int *height)
3370 if (camera == NULL || width == NULL || height == NULL) {
3371 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3372 return CAMERA_ERROR_INVALID_PARAMETER;
3374 int ret = CAMERA_ERROR_NONE;
3376 camera_cli_s *pc = (camera_cli_s *)camera;
3377 muse_camera_api_e api = MUSE_CAMERA_API_GET_CAPTURE_RESOLUTION;
3379 if (pc->cb_info == NULL) {
3380 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3381 return CAMERA_ERROR_INVALID_PARAMETER;
3383 sock_fd = pc->cb_info->fd;
3387 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3388 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3390 if (ret == CAMERA_ERROR_NONE) {
3391 muse_camera_msg_get(get_width, pc->cb_info->recv_msg);
3392 muse_camera_msg_get(get_height, pc->cb_info->recv_msg);
3394 *height = get_height;
3396 LOGD("ret : 0x%x", ret);
3400 int camera_get_capture_format(camera_h camera, camera_pixel_format_e *format)
3402 if (camera == NULL || format == NULL) {
3403 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3404 return CAMERA_ERROR_INVALID_PARAMETER;
3406 int ret = CAMERA_ERROR_NONE;
3408 camera_cli_s *pc = (camera_cli_s *)camera;
3409 muse_camera_api_e api = MUSE_CAMERA_API_GET_CAPTURE_FORMAT;
3412 if (pc->cb_info == NULL) {
3413 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3414 return CAMERA_ERROR_INVALID_PARAMETER;
3416 sock_fd = pc->cb_info->fd;
3418 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3419 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3421 if (ret == CAMERA_ERROR_NONE) {
3422 muse_camera_msg_get(get_format, pc->cb_info->recv_msg);
3423 *format = (camera_pixel_format_e)get_format;
3425 LOGD("ret : 0x%x", ret);
3429 int camera_get_preview_format(camera_h camera, camera_pixel_format_e *format)
3431 if (camera == NULL || format == NULL) {
3432 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3433 return CAMERA_ERROR_INVALID_PARAMETER;
3436 int ret = CAMERA_ERROR_NONE;
3438 camera_cli_s *pc = (camera_cli_s *)camera;
3439 muse_camera_api_e api = MUSE_CAMERA_API_GET_PREVIEW_FORMAT;
3442 if (pc->cb_info == NULL) {
3443 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3444 return CAMERA_ERROR_INVALID_PARAMETER;
3446 sock_fd = pc->cb_info->fd;
3448 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3449 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3451 if (ret == CAMERA_ERROR_NONE) {
3452 muse_camera_msg_get(get_format, pc->cb_info->recv_msg);
3453 *format = (camera_pixel_format_e)get_format;
3455 LOGD("ret : 0x%x", ret);
3459 int camera_get_facing_direction(camera_h camera, camera_facing_direction_e *facing_direciton)
3461 if (camera == NULL || facing_direciton == NULL) {
3462 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3463 return CAMERA_ERROR_INVALID_PARAMETER;
3466 int ret = CAMERA_ERROR_NONE;
3468 camera_cli_s *pc = (camera_cli_s *)camera;
3469 muse_camera_api_e api = MUSE_CAMERA_API_GET_FACING_DIRECTION;
3471 if (pc->cb_info == NULL) {
3472 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3473 return CAMERA_ERROR_INVALID_PARAMETER;
3475 sock_fd = pc->cb_info->fd;
3476 int get_facing_direction;
3478 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3479 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3481 if (ret == CAMERA_ERROR_NONE) {
3482 muse_camera_msg_get(get_facing_direction, pc->cb_info->recv_msg);
3483 *facing_direciton = (camera_facing_direction_e)get_facing_direction;
3485 LOGD("ret : 0x%x", ret);
3489 int camera_set_preview_cb(camera_h camera, camera_preview_cb callback, void *user_data)
3491 if (camera == NULL || callback == NULL) {
3492 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3493 return CAMERA_ERROR_INVALID_PARAMETER;
3495 int ret = CAMERA_ERROR_NONE;
3497 camera_cli_s *pc = (camera_cli_s *)camera;
3498 camera_cb_info_s *cb_info = (camera_cb_info_s *)pc->cb_info;
3500 if (pc->cb_info == NULL) {
3501 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3502 return CAMERA_ERROR_INVALID_PARAMETER;
3504 sock_fd = pc->cb_info->fd;
3505 muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_CB;
3507 LOGD("Enter, handle :%x", pc->remote_handle);
3509 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = callback;
3510 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = user_data;
3511 SET_PREVIEW_CB_TYPE(cb_info, PREVIEW_CB_TYPE_USER);
3513 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3514 LOGD("ret : 0x%x", ret);
3518 int camera_unset_preview_cb(camera_h camera)
3520 if (camera == NULL) {
3521 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3522 return CAMERA_ERROR_INVALID_PARAMETER;
3525 int ret = CAMERA_ERROR_NONE;
3527 camera_cli_s *pc = (camera_cli_s *)camera;
3528 camera_cb_info_s *cb_info = (camera_cb_info_s *)pc->cb_info;
3529 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_PREVIEW_CB;
3531 LOGD("Enter, handle :%x", pc->remote_handle);
3534 if (pc->cb_info == NULL) {
3535 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3536 return CAMERA_ERROR_INVALID_PARAMETER;
3538 sock_fd = pc->cb_info->fd;
3539 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = (void *)NULL;
3540 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = (void *)NULL;
3541 UNSET_PREVIEW_CB_TYPE(cb_info, PREVIEW_CB_TYPE_USER);
3543 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3544 LOGD("ret : 0x%x", ret);
3548 int camera_set_media_packet_preview_cb(camera_h camera, camera_media_packet_preview_cb callback, void *user_data)
3550 if (camera == NULL) {
3551 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
3552 return CAMERA_ERROR_INVALID_PARAMETER;
3555 if (camera_is_supported_media_packet_preview_cb(camera) == false) {
3556 LOGE("NOT SUPPORTED");
3557 return CAMERA_ERROR_NOT_SUPPORTED;
3560 if (callback == NULL) {
3561 LOGE("INVALID_PARAMETER(0x%08x) - callback", CAMERA_ERROR_INVALID_PARAMETER);
3562 return CAMERA_ERROR_INVALID_PARAMETER;
3565 int ret = CAMERA_ERROR_NONE;
3567 camera_cli_s *pc = (camera_cli_s *)camera;
3568 muse_camera_api_e api = MUSE_CAMERA_API_SET_MEDIA_PACKET_PREVIEW_CB;
3570 LOGD("Enter, handle :%x", pc->remote_handle);
3573 if (pc->cb_info == NULL) {
3574 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3575 return CAMERA_ERROR_INVALID_PARAMETER;
3577 sock_fd = pc->cb_info->fd;
3578 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = callback;
3579 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = user_data;
3581 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3582 LOGD("ret : 0x%x", ret);
3586 int camera_unset_media_packet_preview_cb(camera_h camera)
3588 if (camera == NULL) {
3589 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3590 return CAMERA_ERROR_INVALID_PARAMETER;
3593 int ret = CAMERA_ERROR_NONE;
3595 camera_cli_s *pc = (camera_cli_s *)camera;
3596 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_MEDIA_PACKET_PREVIEW_CB;
3598 LOGD("Enter, handle :%x", pc->remote_handle);
3601 if (pc->cb_info == NULL) {
3602 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3603 return CAMERA_ERROR_INVALID_PARAMETER;
3605 sock_fd = pc->cb_info->fd;
3606 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = (void *)NULL;
3607 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = (void *)NULL;
3609 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3610 LOGD("ret : 0x%x", ret);
3614 int camera_set_state_changed_cb(camera_h camera, camera_state_changed_cb callback, void *user_data)
3616 if (camera == NULL || callback == NULL) {
3617 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3618 return CAMERA_ERROR_INVALID_PARAMETER;
3620 int ret = CAMERA_ERROR_NONE;
3622 camera_cli_s *pc = (camera_cli_s *)camera;
3623 muse_camera_api_e api = MUSE_CAMERA_API_SET_STATE_CHANGED_CB;
3625 LOGD("Enter, handle :%x", pc->remote_handle);
3628 if (pc->cb_info == NULL) {
3629 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3630 return CAMERA_ERROR_INVALID_PARAMETER;
3632 sock_fd = pc->cb_info->fd;
3633 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = callback;
3634 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = user_data;
3636 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3637 LOGD("ret : 0x%x", ret);
3640 int camera_unset_state_changed_cb(camera_h camera)
3642 if (camera == NULL) {
3643 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3644 return CAMERA_ERROR_INVALID_PARAMETER;
3646 int ret = CAMERA_ERROR_NONE;
3648 camera_cli_s *pc = (camera_cli_s *)camera;
3649 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_STATE_CHANGED_CB;
3651 LOGD("Enter, handle :%x", pc->remote_handle);
3654 if (pc->cb_info == NULL) {
3655 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3656 return CAMERA_ERROR_INVALID_PARAMETER;
3658 sock_fd = pc->cb_info->fd;
3659 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = (void *)NULL;
3660 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = (void *)NULL;
3662 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3663 LOGD("ret : 0x%x", ret);
3667 int camera_set_interrupted_cb(camera_h camera, camera_interrupted_cb callback, void *user_data)
3669 if (camera == NULL || callback == NULL) {
3670 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3671 return CAMERA_ERROR_INVALID_PARAMETER;
3673 int ret = CAMERA_ERROR_NONE;
3675 camera_cli_s *pc = (camera_cli_s *)camera;
3676 muse_camera_api_e api = MUSE_CAMERA_API_SET_INTERRUPTED_CB;
3678 LOGD("Enter, handle :%x", pc->remote_handle);
3681 if (pc->cb_info == NULL) {
3682 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3683 return CAMERA_ERROR_INVALID_PARAMETER;
3685 sock_fd = pc->cb_info->fd;
3686 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = callback;
3687 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = user_data;
3689 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3690 LOGD("ret : 0x%x", ret);
3694 int camera_unset_interrupted_cb(camera_h camera)
3696 if (camera == NULL) {
3697 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3698 return CAMERA_ERROR_INVALID_PARAMETER;
3700 int ret = CAMERA_ERROR_NONE;
3702 camera_cli_s *pc = (camera_cli_s *)camera;
3703 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_INTERRUPTED_CB;
3705 LOGD("Enter, handle :%x", pc->remote_handle);
3708 if (pc->cb_info == NULL) {
3709 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3710 return CAMERA_ERROR_INVALID_PARAMETER;
3712 sock_fd = pc->cb_info->fd;
3713 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = (void *)NULL;
3714 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = (void *)NULL;
3716 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3717 LOGD("ret : 0x%x", ret);
3721 int camera_set_focus_changed_cb(camera_h camera, camera_focus_changed_cb callback, void *user_data)
3723 if (camera == NULL || callback == NULL) {
3724 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3725 return CAMERA_ERROR_INVALID_PARAMETER;
3727 int ret = CAMERA_ERROR_NONE;
3729 camera_cli_s *pc = (camera_cli_s *)camera;
3730 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOCUS_CHANGED_CB;
3732 LOGD("Enter, handle :%x", pc->remote_handle);
3735 if (pc->cb_info == NULL) {
3736 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3737 return CAMERA_ERROR_INVALID_PARAMETER;
3739 sock_fd = pc->cb_info->fd;
3740 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = callback;
3741 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = user_data;
3743 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3744 LOGD("ret : 0x%x", ret);
3748 int camera_unset_focus_changed_cb(camera_h camera)
3750 if (camera == NULL) {
3751 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3752 return CAMERA_ERROR_INVALID_PARAMETER;
3754 int ret = CAMERA_ERROR_NONE;
3756 camera_cli_s *pc = (camera_cli_s *)camera;
3757 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_FOCUS_CHANGED_CB;
3759 LOGD("Enter, handle :%x", pc->remote_handle);
3762 if (pc->cb_info == NULL) {
3763 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3764 return CAMERA_ERROR_INVALID_PARAMETER;
3766 sock_fd = pc->cb_info->fd;
3767 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = (void *)NULL;
3768 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = (void *)NULL;
3770 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3771 LOGD("ret : 0x%x", ret);
3775 int camera_set_error_cb(camera_h camera, camera_error_cb callback, void *user_data)
3777 if (camera == NULL || callback == NULL) {
3778 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3779 return CAMERA_ERROR_INVALID_PARAMETER;
3781 int ret = CAMERA_ERROR_NONE;
3783 camera_cli_s *pc = (camera_cli_s *)camera;
3784 muse_camera_api_e api = MUSE_CAMERA_API_SET_ERROR_CB;
3786 LOGD("Enter, handle :%x", pc->remote_handle);
3789 if (pc->cb_info == NULL) {
3790 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3791 return CAMERA_ERROR_INVALID_PARAMETER;
3793 sock_fd = pc->cb_info->fd;
3794 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_ERROR] = callback;
3795 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_ERROR] = user_data;
3797 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3798 LOGD("ret : 0x%x", ret);
3802 int camera_unset_error_cb(camera_h camera)
3804 if (camera == NULL) {
3805 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3806 return CAMERA_ERROR_INVALID_PARAMETER;
3808 int ret = CAMERA_ERROR_NONE;
3810 camera_cli_s *pc = (camera_cli_s *)camera;
3811 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_ERROR_CB;
3813 LOGD("Enter, handle :%x", pc->remote_handle);
3816 if (pc->cb_info == NULL) {
3817 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3818 return CAMERA_ERROR_INVALID_PARAMETER;
3820 sock_fd = pc->cb_info->fd;
3821 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_ERROR] = (void *)NULL;
3822 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_ERROR] = (void *)NULL;
3824 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3825 LOGD("ret : 0x%x", ret);
3829 int camera_foreach_supported_preview_resolution(camera_h camera, camera_supported_preview_resolution_cb foreach_cb , void *user_data)
3831 if (camera == NULL || foreach_cb == NULL) {
3832 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3833 return CAMERA_ERROR_INVALID_PARAMETER;
3835 int ret = CAMERA_ERROR_NONE;
3837 camera_cli_s *pc = (camera_cli_s *)camera;
3838 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_PREVIEW_RESOLUTION;
3840 LOGD("Enter, handle :%x", pc->remote_handle);
3843 if (pc->cb_info == NULL) {
3844 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3845 return CAMERA_ERROR_INVALID_PARAMETER;
3847 sock_fd = pc->cb_info->fd;
3848 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_RESOLUTION] = foreach_cb;
3849 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_RESOLUTION] = user_data;
3851 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3852 LOGD("ret : 0x%x", ret);
3856 int camera_foreach_supported_capture_resolution(camera_h camera, camera_supported_capture_resolution_cb foreach_cb , void *user_data)
3858 if (camera == NULL || foreach_cb == NULL) {
3859 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3860 return CAMERA_ERROR_INVALID_PARAMETER;
3862 int ret = CAMERA_ERROR_NONE;
3864 camera_cli_s *pc = (camera_cli_s *)camera;
3865 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_CAPTURE_RESOLUTION;
3867 LOGD("Enter, handle :%x", pc->remote_handle);
3870 if (pc->cb_info == NULL) {
3871 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3872 return CAMERA_ERROR_INVALID_PARAMETER;
3874 sock_fd = pc->cb_info->fd;
3875 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_RESOLUTION] = foreach_cb;
3876 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_RESOLUTION] = user_data;
3878 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3879 LOGD("ret : 0x%x", ret);
3883 int camera_foreach_supported_capture_format(camera_h camera, camera_supported_capture_format_cb foreach_cb , void *user_data)
3885 if (camera == NULL || foreach_cb == NULL) {
3886 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3887 return CAMERA_ERROR_INVALID_PARAMETER;
3889 int ret = CAMERA_ERROR_NONE;
3891 camera_cli_s *pc = (camera_cli_s *)camera;
3892 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_CAPTURE_FORMAT;
3894 LOGD("Enter, handle :%x", pc->remote_handle);
3897 if (pc->cb_info == NULL) {
3898 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3899 return CAMERA_ERROR_INVALID_PARAMETER;
3901 sock_fd = pc->cb_info->fd;
3902 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_FORMAT] = foreach_cb;
3903 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_FORMAT] = user_data;
3905 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3906 LOGD("ret : 0x%x", ret);
3911 int camera_foreach_supported_preview_format(camera_h camera, camera_supported_preview_format_cb foreach_cb , void *user_data)
3913 if (camera == NULL || foreach_cb == NULL) {
3914 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3915 return CAMERA_ERROR_INVALID_PARAMETER;
3917 int ret = CAMERA_ERROR_NONE;
3919 camera_cli_s *pc = (camera_cli_s *)camera;
3920 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_PREVIEW_FORMAT;
3922 LOGD("Enter, handle :%x", pc->remote_handle);
3925 if (pc->cb_info == NULL) {
3926 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3927 return CAMERA_ERROR_INVALID_PARAMETER;
3929 sock_fd = pc->cb_info->fd;
3930 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_FORMAT] = foreach_cb;
3931 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_FORMAT] = user_data;
3933 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3934 LOGD("ret : 0x%x", ret);
3939 int camera_get_recommended_preview_resolution(camera_h camera, int *width, int *height)
3941 if (camera == NULL || width == NULL || height == NULL) {
3942 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3943 return CAMERA_ERROR_INVALID_PARAMETER;
3945 int ret = CAMERA_ERROR_NONE;
3947 camera_cli_s *pc = (camera_cli_s *)camera;
3948 muse_camera_api_e api = MUSE_CAMERA_API_GET_RECOMMENDED_PREVIEW_RESOLUTION;
3950 if (pc->cb_info == NULL) {
3951 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3952 return CAMERA_ERROR_INVALID_PARAMETER;
3954 sock_fd = pc->cb_info->fd;
3958 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3959 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3961 if (ret == CAMERA_ERROR_NONE) {
3962 muse_camera_msg_get(get_width, pc->cb_info->recv_msg);
3963 muse_camera_msg_get(get_height, pc->cb_info->recv_msg);
3965 *height = get_height;
3967 LOGD("ret : 0x%x", ret);
3972 int camera_attr_get_lens_orientation(camera_h camera, int *angle)
3974 if (camera == NULL || angle == NULL) {
3975 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3976 return CAMERA_ERROR_INVALID_PARAMETER;
3978 int ret = CAMERA_ERROR_NONE;
3980 camera_cli_s *pc = (camera_cli_s *)camera;
3981 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_LENS_ORIENTATION;
3983 if (pc->cb_info == NULL) {
3984 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3985 return CAMERA_ERROR_INVALID_PARAMETER;
3987 sock_fd = pc->cb_info->fd;
3990 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3991 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3993 if (ret == CAMERA_ERROR_NONE) {
3994 muse_camera_msg_get(get_angle, pc->cb_info->recv_msg);
3997 LOGD("ret : 0x%x", ret);
4001 int camera_attr_set_theater_mode(camera_h camera, camera_attr_theater_mode_e mode)
4003 if (camera == NULL) {
4004 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4005 return CAMERA_ERROR_INVALID_PARAMETER;
4007 int ret = CAMERA_ERROR_NONE;
4008 camera_cli_s *pc = (camera_cli_s *)camera;
4009 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_THEATER_MODE;
4011 if (pc->cb_info == NULL) {
4012 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4013 return CAMERA_ERROR_INVALID_PARAMETER;
4015 sock_fd = pc->cb_info->fd;
4016 int set_mode = (int)mode;
4017 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4018 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
4019 LOGD("ret : 0x%x", ret);
4023 int camera_attr_get_theater_mode(camera_h camera, camera_attr_theater_mode_e *mode)
4025 if (camera == NULL || mode == NULL) {
4026 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4027 return CAMERA_ERROR_INVALID_PARAMETER;
4030 int ret = CAMERA_ERROR_NONE;
4031 camera_cli_s *pc = (camera_cli_s *)camera;
4032 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_THEATER_MODE;
4034 if (pc->cb_info == NULL) {
4035 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4036 return CAMERA_ERROR_INVALID_PARAMETER;
4038 sock_fd = pc->cb_info->fd;
4040 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4041 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4043 if (ret == CAMERA_ERROR_NONE) {
4044 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
4045 *mode = (camera_attr_theater_mode_e)get_mode;
4047 LOGD("ret : 0x%x", ret);
4051 int camera_attr_foreach_supported_theater_mode(camera_h camera, camera_attr_supported_theater_mode_cb foreach_cb, void *user_data)
4053 if (camera == NULL || foreach_cb == NULL) {
4054 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4055 return CAMERA_ERROR_INVALID_PARAMETER;
4057 int ret = CAMERA_ERROR_NONE;
4059 camera_cli_s *pc = (camera_cli_s *)camera;
4060 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_THEATER_MODE;
4062 LOGD("Enter, handle :%x", pc->remote_handle);
4065 if (pc->cb_info == NULL) {
4066 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4067 return CAMERA_ERROR_INVALID_PARAMETER;
4069 sock_fd = pc->cb_info->fd;
4070 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE] = foreach_cb;
4071 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE] = user_data;
4073 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4075 LOGD("Finish, return :%x", ret);
4080 int camera_attr_set_preview_fps(camera_h camera, camera_attr_fps_e fps)
4082 if (camera == NULL) {
4083 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4084 return CAMERA_ERROR_INVALID_PARAMETER;
4086 int ret = CAMERA_ERROR_NONE;
4087 camera_cli_s *pc = (camera_cli_s *)camera;
4088 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_PREVIEW_FPS;
4090 if (pc->cb_info == NULL) {
4091 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4092 return CAMERA_ERROR_INVALID_PARAMETER;
4094 sock_fd = pc->cb_info->fd;
4095 int set_fps = (int)fps;
4096 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4097 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_fps);
4098 LOGD("ret : 0x%x", ret);
4103 int camera_attr_set_image_quality(camera_h camera, int quality)
4105 if (camera == NULL) {
4106 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4107 return CAMERA_ERROR_INVALID_PARAMETER;
4109 int ret = CAMERA_ERROR_NONE;
4111 camera_cli_s *pc = (camera_cli_s *)camera;
4112 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_IMAGE_QUALITY;
4114 if (pc->cb_info == NULL) {
4115 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4116 return CAMERA_ERROR_INVALID_PARAMETER;
4118 sock_fd = pc->cb_info->fd;
4119 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4120 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, quality);
4121 LOGD("ret : 0x%x", ret);
4125 int camera_attr_get_preview_fps(camera_h camera, camera_attr_fps_e *fps)
4127 if (camera == NULL || fps == NULL) {
4128 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4129 return CAMERA_ERROR_INVALID_PARAMETER;
4131 int ret = CAMERA_ERROR_NONE;
4133 camera_cli_s *pc = (camera_cli_s *)camera;
4134 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_PREVIEW_FPS;
4137 if (pc->cb_info == NULL) {
4138 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4139 return CAMERA_ERROR_INVALID_PARAMETER;
4141 sock_fd = pc->cb_info->fd;
4143 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4144 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4146 if (ret == CAMERA_ERROR_NONE) {
4147 muse_camera_msg_get(get_fps, pc->cb_info->recv_msg);
4148 *fps = (camera_attr_fps_e)get_fps;
4150 LOGD("ret : 0x%x", ret);
4155 int camera_attr_get_image_quality(camera_h camera, int *quality)
4157 if (camera == NULL || quality == NULL) {
4158 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4159 return CAMERA_ERROR_INVALID_PARAMETER;
4161 int ret = CAMERA_ERROR_NONE;
4163 camera_cli_s *pc = (camera_cli_s *)camera;
4164 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_IMAGE_QUALITY;
4166 if (pc->cb_info == NULL) {
4167 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4168 return CAMERA_ERROR_INVALID_PARAMETER;
4170 sock_fd = pc->cb_info->fd;
4172 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4173 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4175 if (ret == CAMERA_ERROR_NONE) {
4176 muse_camera_msg_get(get_quality, pc->cb_info->recv_msg);
4177 *quality = get_quality;
4179 LOGD("ret : 0x%x", ret);
4184 int camera_attr_get_encoded_preview_bitrate(camera_h camera, int *bitrate)
4186 if (camera == NULL || bitrate == NULL) {
4187 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4188 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_GET_ENCODED_PREVIEW_BITRATE;
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;
4203 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4204 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4206 if (ret == CAMERA_ERROR_NONE) {
4207 muse_camera_msg_get(get_bitrate, pc->cb_info->recv_msg);
4208 *bitrate = get_bitrate;
4210 LOGD("ret : 0x%x", ret);
4215 int camera_attr_set_encoded_preview_bitrate(camera_h camera, int bitrate)
4217 if (camera == NULL) {
4218 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4219 return CAMERA_ERROR_INVALID_PARAMETER;
4222 int ret = CAMERA_ERROR_NONE;
4224 camera_cli_s *pc = (camera_cli_s *)camera;
4225 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ENCODED_PREVIEW_BITRATE;
4227 if (pc->cb_info == NULL) {
4228 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4229 return CAMERA_ERROR_INVALID_PARAMETER;
4231 sock_fd = pc->cb_info->fd;
4232 int set_bitrate = bitrate;
4233 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4234 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_bitrate);
4235 LOGD("ret : 0x%x", ret);
4240 int camera_attr_get_encoded_preview_gop_interval(camera_h camera, int *interval)
4242 if (camera == NULL || interval == NULL) {
4243 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4244 return CAMERA_ERROR_INVALID_PARAMETER;
4247 int ret = CAMERA_ERROR_NONE;
4249 camera_cli_s *pc = (camera_cli_s *)camera;
4250 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ENCODED_PREVIEW_GOP_INTERVAL;
4252 if (pc->cb_info == NULL) {
4253 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4254 return CAMERA_ERROR_INVALID_PARAMETER;
4256 sock_fd = pc->cb_info->fd;
4257 int get_gop_interval;
4259 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4260 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4262 if (ret == CAMERA_ERROR_NONE) {
4263 muse_camera_msg_get(get_gop_interval, pc->cb_info->recv_msg);
4264 *interval = get_gop_interval;
4266 LOGD("ret : 0x%x", ret);
4271 int camera_attr_set_encoded_preview_gop_interval(camera_h camera, int interval)
4273 if (camera == NULL) {
4274 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4275 return CAMERA_ERROR_INVALID_PARAMETER;
4278 int ret = CAMERA_ERROR_NONE;
4280 camera_cli_s *pc = (camera_cli_s *)camera;
4281 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ENCODED_PREVIEW_GOP_INTERVAL;
4283 if (pc->cb_info == NULL) {
4284 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4285 return CAMERA_ERROR_INVALID_PARAMETER;
4287 sock_fd = pc->cb_info->fd;
4288 int set_gop_interval = interval;
4289 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4290 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_gop_interval);
4291 LOGD("ret : 0x%x", ret);
4296 int camera_attr_set_zoom(camera_h camera, int zoom)
4298 if (camera == NULL) {
4299 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4300 return CAMERA_ERROR_INVALID_PARAMETER;
4302 int ret = CAMERA_ERROR_NONE;
4304 camera_cli_s *pc = (camera_cli_s *)camera;
4305 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ZOOM;
4307 if (pc->cb_info == NULL) {
4308 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4309 return CAMERA_ERROR_INVALID_PARAMETER;
4311 sock_fd = pc->cb_info->fd;
4313 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4314 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, zoom);
4315 LOGD("ret : 0x%x", ret);
4319 int camera_attr_set_af_mode(camera_h camera, camera_attr_af_mode_e mode)
4321 if (camera == NULL) {
4322 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4323 return CAMERA_ERROR_INVALID_PARAMETER;
4325 int ret = CAMERA_ERROR_NONE;
4327 camera_cli_s *pc = (camera_cli_s *)camera;
4328 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_AF_MODE;
4330 if (pc->cb_info == NULL) {
4331 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4332 return CAMERA_ERROR_INVALID_PARAMETER;
4334 sock_fd = pc->cb_info->fd;
4335 int set_mode = (int)mode;
4336 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4337 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
4338 LOGD("ret : 0x%x", ret);
4342 int camera_attr_set_af_area(camera_h camera, int x, int y)
4344 if (camera == NULL) {
4345 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4346 return CAMERA_ERROR_INVALID_PARAMETER;
4348 int ret = CAMERA_ERROR_NONE;
4349 camera_cli_s *pc = (camera_cli_s *)camera;
4350 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_AF_AREA;
4351 int sock_fd = pc->cb_info->fd;
4352 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4353 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, x, INT, y);
4354 LOGD("ret : 0x%x", ret);
4359 int camera_attr_clear_af_area(camera_h camera)
4361 if (camera == NULL) {
4362 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4363 return CAMERA_ERROR_INVALID_PARAMETER;
4365 int ret = CAMERA_ERROR_NONE;
4367 camera_cli_s *pc = (camera_cli_s *)camera;
4368 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_CLEAR_AF_AREA;
4370 if (pc->cb_info == NULL) {
4371 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4372 return CAMERA_ERROR_INVALID_PARAMETER;
4374 sock_fd = pc->cb_info->fd;
4375 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4376 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4377 LOGD("ret : 0x%x", ret);
4382 int camera_attr_set_exposure_mode(camera_h camera, camera_attr_exposure_mode_e mode)
4384 if (camera == NULL) {
4385 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4386 return CAMERA_ERROR_INVALID_PARAMETER;
4389 if (mode < CAMERA_ATTR_EXPOSURE_MODE_OFF || mode > CAMERA_ATTR_EXPOSURE_MODE_CUSTOM) {
4390 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4391 return CAMERA_ERROR_INVALID_PARAMETER;
4394 int ret = CAMERA_ERROR_NONE;
4395 camera_cli_s *pc = (camera_cli_s *)camera;
4396 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EXPOSURE_MODE;
4397 int set_mode = (int)mode;
4399 if (pc->cb_info == NULL) {
4400 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4401 return CAMERA_ERROR_INVALID_PARAMETER;
4403 sock_fd = pc->cb_info->fd;
4404 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4405 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
4406 LOGD("ret : 0x%x", ret);
4411 int camera_attr_set_exposure(camera_h camera, int value)
4413 if (camera == NULL) {
4414 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4415 return CAMERA_ERROR_INVALID_PARAMETER;
4417 int ret = CAMERA_ERROR_NONE;
4419 camera_cli_s *pc = (camera_cli_s *)camera;
4420 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EXPOSURE;
4422 if (pc->cb_info == NULL) {
4423 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4424 return CAMERA_ERROR_INVALID_PARAMETER;
4426 sock_fd = pc->cb_info->fd;
4428 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4429 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, value);
4430 LOGD("ret : 0x%x", ret);
4435 int camera_attr_set_iso(camera_h camera, camera_attr_iso_e iso)
4437 if (camera == NULL) {
4438 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4439 return CAMERA_ERROR_INVALID_PARAMETER;
4441 int ret = CAMERA_ERROR_NONE;
4443 camera_cli_s *pc = (camera_cli_s *)camera;
4444 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ISO;
4446 if (pc->cb_info == NULL) {
4447 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4448 return CAMERA_ERROR_INVALID_PARAMETER;
4450 sock_fd = pc->cb_info->fd;
4451 int set_iso = (int)iso;
4452 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4453 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_iso);
4454 LOGD("ret : 0x%x", ret);
4459 int camera_attr_set_brightness(camera_h camera, int level)
4461 if (camera == NULL) {
4462 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4463 return CAMERA_ERROR_INVALID_PARAMETER;
4465 int ret = CAMERA_ERROR_NONE;
4467 camera_cli_s *pc = (camera_cli_s *)camera;
4468 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_BRIGHTNESS;
4470 if (pc->cb_info == NULL) {
4471 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4472 return CAMERA_ERROR_INVALID_PARAMETER;
4474 sock_fd = pc->cb_info->fd;
4476 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4477 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, level);
4478 LOGD("ret : 0x%x", ret);
4483 int camera_attr_set_contrast(camera_h camera, int level)
4485 if (camera == NULL) {
4486 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4487 return CAMERA_ERROR_INVALID_PARAMETER;
4489 int ret = CAMERA_ERROR_NONE;
4491 camera_cli_s *pc = (camera_cli_s *)camera;
4492 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_CONTRAST;
4494 if (pc->cb_info == NULL) {
4495 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4496 return CAMERA_ERROR_INVALID_PARAMETER;
4498 sock_fd = pc->cb_info->fd;
4500 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4501 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, level);
4502 LOGD("ret : 0x%x", ret);
4507 int camera_attr_set_whitebalance(camera_h camera, camera_attr_whitebalance_e wb)
4509 if (camera == NULL) {
4510 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4511 return CAMERA_ERROR_INVALID_PARAMETER;
4514 if (wb < CAMERA_ATTR_WHITE_BALANCE_NONE || wb > CAMERA_ATTR_WHITE_BALANCE_CUSTOM) {
4515 LOGE("invalid white balance %d", wb);
4516 return CAMERA_ERROR_INVALID_PARAMETER;
4519 int ret = CAMERA_ERROR_NONE;
4521 camera_cli_s *pc = (camera_cli_s *)camera;
4522 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_WHITEBALANCE;
4524 if (pc->cb_info == NULL) {
4525 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4526 return CAMERA_ERROR_INVALID_PARAMETER;
4528 sock_fd = pc->cb_info->fd;
4529 int set_whitebalance = (int)wb;
4530 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4531 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_whitebalance);
4532 LOGD("ret : 0x%x", ret);
4537 int camera_attr_set_effect(camera_h camera, camera_attr_effect_mode_e effect)
4539 if (camera == NULL) {
4540 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4541 return CAMERA_ERROR_INVALID_PARAMETER;
4543 int ret = CAMERA_ERROR_NONE;
4545 camera_cli_s *pc = (camera_cli_s *)camera;
4546 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EFFECT;
4548 if (pc->cb_info == NULL) {
4549 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4550 return CAMERA_ERROR_INVALID_PARAMETER;
4552 sock_fd = pc->cb_info->fd;
4553 int set_effect = (int)effect;
4554 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4555 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_effect);
4556 LOGD("ret : 0x%x", ret);
4561 int camera_attr_set_scene_mode(camera_h camera, camera_attr_scene_mode_e mode)
4563 if (camera == NULL) {
4564 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4565 return CAMERA_ERROR_INVALID_PARAMETER;
4567 int ret = CAMERA_ERROR_NONE;
4569 camera_cli_s *pc = (camera_cli_s *)camera;
4570 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_SCENE_MODE;
4572 if (pc->cb_info == NULL) {
4573 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4574 return CAMERA_ERROR_INVALID_PARAMETER;
4576 sock_fd = pc->cb_info->fd;
4577 int set_mode = (int)mode;
4578 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4579 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
4580 LOGD("ret : 0x%x", ret);
4585 int camera_attr_enable_tag(camera_h camera, bool enable)
4587 if (camera == NULL) {
4588 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4589 return CAMERA_ERROR_INVALID_PARAMETER;
4591 int ret = CAMERA_ERROR_NONE;
4592 camera_cli_s *pc = (camera_cli_s *)camera;
4593 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_TAG;
4595 if (pc->cb_info == NULL) {
4596 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4597 return CAMERA_ERROR_INVALID_PARAMETER;
4599 sock_fd = pc->cb_info->fd;
4600 int set_enable = (int)enable;
4602 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4603 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
4604 LOGD("ret : 0x%x", ret);
4609 int camera_attr_set_tag_image_description(camera_h camera, const char *description)
4611 if (camera == NULL) {
4612 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4613 return CAMERA_ERROR_INVALID_PARAMETER;
4615 if (description == NULL) {
4616 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4617 return CAMERA_ERROR_INVALID_PARAMETER;
4619 int ret = CAMERA_ERROR_NONE;
4620 camera_cli_s *pc = (camera_cli_s *)camera;
4621 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_IMAGE_DESCRIPTION;
4623 if (pc->cb_info == NULL) {
4624 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4625 return CAMERA_ERROR_INVALID_PARAMETER;
4627 sock_fd = pc->cb_info->fd;
4628 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4629 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, STRING, description);
4630 LOGD("ret : 0x%x", ret);
4635 int camera_attr_set_tag_orientation(camera_h camera, camera_attr_tag_orientation_e orientation)
4637 if (camera == NULL) {
4638 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4639 return CAMERA_ERROR_INVALID_PARAMETER;
4641 int ret = CAMERA_ERROR_NONE;
4642 camera_cli_s *pc = (camera_cli_s *)camera;
4643 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_ORIENTATION;
4645 if (pc->cb_info == NULL) {
4646 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4647 return CAMERA_ERROR_INVALID_PARAMETER;
4649 sock_fd = pc->cb_info->fd;
4650 int set_orientation = (int)orientation;
4652 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4653 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_orientation);
4654 LOGD("ret : 0x%x", ret);
4659 int camera_attr_set_tag_software(camera_h camera, const char *software)
4661 if (camera == NULL) {
4662 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4663 return CAMERA_ERROR_INVALID_PARAMETER;
4665 if (software == NULL) {
4666 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4667 return CAMERA_ERROR_INVALID_PARAMETER;
4669 int ret = CAMERA_ERROR_NONE;
4670 camera_cli_s *pc = (camera_cli_s *)camera;
4671 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_SOFTWARE;
4673 if (pc->cb_info == NULL) {
4674 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4675 return CAMERA_ERROR_INVALID_PARAMETER;
4677 sock_fd = pc->cb_info->fd;
4678 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4679 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, STRING, software);
4680 LOGD("ret : 0x%x", ret);
4685 int camera_attr_set_geotag(camera_h camera, double latitude , double longitude, double altitude)
4687 if (camera == NULL) {
4688 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4689 return CAMERA_ERROR_INVALID_PARAMETER;
4691 int ret = CAMERA_ERROR_NONE;
4692 camera_cli_s *pc = (camera_cli_s *)camera;
4693 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_GEOTAG;
4695 if (pc->cb_info == NULL) {
4696 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4697 return CAMERA_ERROR_INVALID_PARAMETER;
4699 sock_fd = pc->cb_info->fd;
4700 double set_geotag[3] = { latitude, longitude, altitude };
4702 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4703 muse_camera_msg_send_array(api, sock_fd, pc->cb_info, ret,
4704 set_geotag, sizeof(set_geotag), sizeof(double));
4705 LOGD("ret : 0x%x", ret);
4710 int camera_attr_remove_geotag(camera_h camera)
4712 if (camera == NULL) {
4713 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4714 return CAMERA_ERROR_INVALID_PARAMETER;
4716 int ret = CAMERA_ERROR_NONE;
4717 camera_cli_s *pc = (camera_cli_s *)camera;
4718 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_REMOVE_GEOTAG;
4720 if (pc->cb_info == NULL) {
4721 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4722 return CAMERA_ERROR_INVALID_PARAMETER;
4724 sock_fd = pc->cb_info->fd;
4725 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4726 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4727 LOGD("ret : 0x%x", ret);
4732 int camera_attr_set_flash_mode(camera_h camera, camera_attr_flash_mode_e mode)
4734 if (camera == NULL) {
4735 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4736 return CAMERA_ERROR_INVALID_PARAMETER;
4738 int ret = CAMERA_ERROR_NONE;
4739 camera_cli_s *pc = (camera_cli_s *)camera;
4740 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_FLASH_MODE;
4742 if (pc->cb_info == NULL) {
4743 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4744 return CAMERA_ERROR_INVALID_PARAMETER;
4746 sock_fd = pc->cb_info->fd;
4747 int set_mode = (int)mode;
4749 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4750 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
4751 LOGD("ret : 0x%x", ret);
4756 int camera_attr_get_zoom(camera_h camera, int *zoom)
4758 if (camera == NULL || zoom == NULL) {
4759 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4760 return CAMERA_ERROR_INVALID_PARAMETER;
4762 int ret = CAMERA_ERROR_NONE;
4764 camera_cli_s *pc = (camera_cli_s *)camera;
4765 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ZOOM;
4768 if (pc->cb_info == NULL) {
4769 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4770 return CAMERA_ERROR_INVALID_PARAMETER;
4772 sock_fd = pc->cb_info->fd;
4774 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4775 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4777 if (ret == CAMERA_ERROR_NONE) {
4778 muse_camera_msg_get(get_zoom, pc->cb_info->recv_msg);
4781 LOGD("ret : 0x%x", ret);
4786 int camera_attr_get_zoom_range(camera_h camera, int *min, int *max)
4788 if (camera == NULL || min == NULL || max == NULL) {
4789 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4790 return CAMERA_ERROR_INVALID_PARAMETER;
4792 int ret = CAMERA_ERROR_NONE;
4793 camera_cli_s *pc = (camera_cli_s *)camera;
4795 if (pc->cb_info == NULL) {
4796 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4797 return CAMERA_ERROR_INVALID_PARAMETER;
4799 sock_fd = pc->cb_info->fd;
4800 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ZOOM_RANGE;
4804 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4805 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4807 if (ret == CAMERA_ERROR_NONE) {
4808 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
4809 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
4813 LOGD("ret : 0x%x", ret);
4818 int camera_attr_get_af_mode(camera_h camera, camera_attr_af_mode_e *mode)
4820 if (camera == NULL || mode == NULL) {
4821 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4822 return CAMERA_ERROR_INVALID_PARAMETER;
4824 int ret = CAMERA_ERROR_NONE;
4825 camera_cli_s *pc = (camera_cli_s *)camera;
4827 if (pc->cb_info == NULL) {
4828 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4829 return CAMERA_ERROR_INVALID_PARAMETER;
4831 sock_fd = pc->cb_info->fd;
4832 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_AF_MODE;
4835 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4836 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4838 if (ret == CAMERA_ERROR_NONE) {
4839 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
4840 *mode = (camera_attr_af_mode_e)get_mode;
4842 LOGD("ret : 0x%x", ret);
4847 int camera_attr_get_exposure_mode(camera_h camera, camera_attr_exposure_mode_e *mode)
4849 if (camera == NULL || mode == NULL) {
4850 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4851 return CAMERA_ERROR_INVALID_PARAMETER;
4853 int ret = CAMERA_ERROR_NONE;
4854 camera_cli_s *pc = (camera_cli_s *)camera;
4856 if (pc->cb_info == NULL) {
4857 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4858 return CAMERA_ERROR_INVALID_PARAMETER;
4860 sock_fd = pc->cb_info->fd;
4861 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE_MODE;
4864 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4865 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4867 if (ret == CAMERA_ERROR_NONE) {
4868 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
4869 *mode = (camera_attr_exposure_mode_e)get_mode;
4871 LOGD("ret : 0x%x", ret);
4875 int camera_attr_get_exposure(camera_h camera, int *value)
4877 if (camera == NULL || value == NULL) {
4878 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4879 return CAMERA_ERROR_INVALID_PARAMETER;
4881 int ret = CAMERA_ERROR_NONE;
4882 camera_cli_s *pc = (camera_cli_s *)camera;
4884 if (pc->cb_info == NULL) {
4885 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4886 return CAMERA_ERROR_INVALID_PARAMETER;
4888 sock_fd = pc->cb_info->fd;
4889 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE;
4892 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4893 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4895 if (ret == CAMERA_ERROR_NONE) {
4896 muse_camera_msg_get(get_value, pc->cb_info->recv_msg);
4899 LOGD("ret : 0x%x", ret);
4904 int camera_attr_get_exposure_range(camera_h camera, int *min, int *max)
4906 if (camera == NULL || min == NULL || max == NULL) {
4907 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4908 return CAMERA_ERROR_INVALID_PARAMETER;
4910 int ret = CAMERA_ERROR_NONE;
4911 camera_cli_s *pc = (camera_cli_s *)camera;
4913 if (pc->cb_info == NULL) {
4914 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4915 return CAMERA_ERROR_INVALID_PARAMETER;
4917 sock_fd = pc->cb_info->fd;
4918 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE_RANGE;
4922 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4923 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4925 if (ret == CAMERA_ERROR_NONE) {
4926 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
4927 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
4931 LOGD("ret : 0x%x", ret);
4936 int camera_attr_get_iso(camera_h camera, camera_attr_iso_e *iso)
4938 if (camera == NULL || iso == NULL) {
4939 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4940 return CAMERA_ERROR_INVALID_PARAMETER;
4942 int ret = CAMERA_ERROR_NONE;
4943 camera_cli_s *pc = (camera_cli_s *)camera;
4945 if (pc->cb_info == NULL) {
4946 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4947 return CAMERA_ERROR_INVALID_PARAMETER;
4949 sock_fd = pc->cb_info->fd;
4950 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ISO;
4953 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4954 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4956 if (ret == CAMERA_ERROR_NONE) {
4957 muse_camera_msg_get(get_iso, pc->cb_info->recv_msg);
4958 *iso = (camera_attr_iso_e)get_iso;
4960 LOGD("ret : 0x%x", ret);
4965 int camera_attr_get_brightness(camera_h camera, int *level)
4967 if (camera == NULL || level == NULL) {
4968 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4969 return CAMERA_ERROR_INVALID_PARAMETER;
4971 int ret = CAMERA_ERROR_NONE;
4972 camera_cli_s *pc = (camera_cli_s *)camera;
4974 if (pc->cb_info == NULL) {
4975 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4976 return CAMERA_ERROR_INVALID_PARAMETER;
4978 sock_fd = pc->cb_info->fd;
4979 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_BRIGHTNESS;
4982 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4983 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4985 if (ret == CAMERA_ERROR_NONE) {
4986 muse_camera_msg_get(get_level, pc->cb_info->recv_msg);
4989 LOGD("ret : 0x%x", ret);
4994 int camera_attr_get_brightness_range(camera_h camera, int *min, int *max)
4996 if (camera == NULL || min == NULL || max == NULL) {
4997 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4998 return CAMERA_ERROR_INVALID_PARAMETER;
5000 int ret = CAMERA_ERROR_NONE;
5001 camera_cli_s *pc = (camera_cli_s *)camera;
5003 if (pc->cb_info == NULL) {
5004 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5005 return CAMERA_ERROR_INVALID_PARAMETER;
5007 sock_fd = pc->cb_info->fd;
5008 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_BRIGHTNESS_RANGE;
5012 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5013 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5015 if (ret == CAMERA_ERROR_NONE) {
5016 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
5017 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
5021 LOGD("ret : 0x%x", ret);
5026 int camera_attr_get_contrast(camera_h camera, int *level)
5028 if (camera == NULL || level == NULL) {
5029 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5030 return CAMERA_ERROR_INVALID_PARAMETER;
5032 int ret = CAMERA_ERROR_NONE;
5033 camera_cli_s *pc = (camera_cli_s *)camera;
5034 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_CONTRAST;
5036 if (pc->cb_info == NULL) {
5037 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5038 return CAMERA_ERROR_INVALID_PARAMETER;
5040 sock_fd = pc->cb_info->fd;
5043 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5044 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5046 if (ret == CAMERA_ERROR_NONE) {
5047 muse_camera_msg_get(get_level, pc->cb_info->recv_msg);
5050 LOGD("ret : 0x%x", ret);
5055 int camera_attr_get_contrast_range(camera_h camera, int *min , int *max)
5057 if (camera == NULL || min == NULL || max == NULL) {
5058 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5059 return CAMERA_ERROR_INVALID_PARAMETER;
5061 int ret = CAMERA_ERROR_NONE;
5062 camera_cli_s *pc = (camera_cli_s *)camera;
5063 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_CONTRAST_RANGE;
5065 if (pc->cb_info == NULL) {
5066 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5067 return CAMERA_ERROR_INVALID_PARAMETER;
5069 sock_fd = pc->cb_info->fd;
5073 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5074 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5076 if (ret == CAMERA_ERROR_NONE) {
5077 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
5078 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
5082 LOGD("ret : 0x%x", ret);
5087 int camera_attr_get_whitebalance(camera_h camera, camera_attr_whitebalance_e *wb)
5089 if (camera == NULL || wb == NULL) {
5090 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5091 return CAMERA_ERROR_INVALID_PARAMETER;
5093 int ret = CAMERA_ERROR_NONE;
5094 camera_cli_s *pc = (camera_cli_s *)camera;
5095 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_WHITEBALANCE;
5097 if (pc->cb_info == NULL) {
5098 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5099 return CAMERA_ERROR_INVALID_PARAMETER;
5101 sock_fd = pc->cb_info->fd;
5104 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5105 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5107 if (ret == CAMERA_ERROR_NONE) {
5108 muse_camera_msg_get(get_wb, pc->cb_info->recv_msg);
5109 *wb = (camera_attr_whitebalance_e)get_wb;
5111 LOGD("ret : 0x%x", ret);
5116 int camera_attr_get_effect(camera_h camera, camera_attr_effect_mode_e *effect)
5118 if (camera == NULL || effect == NULL) {
5119 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5120 return CAMERA_ERROR_INVALID_PARAMETER;
5123 int ret = CAMERA_ERROR_NONE;
5124 camera_cli_s *pc = (camera_cli_s *)camera;
5125 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EFFECT;
5127 if (pc->cb_info == NULL) {
5128 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5129 return CAMERA_ERROR_INVALID_PARAMETER;
5131 sock_fd = pc->cb_info->fd;
5134 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5135 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5137 if (ret == CAMERA_ERROR_NONE) {
5138 muse_camera_msg_get(get_effect, pc->cb_info->recv_msg);
5139 *effect = (camera_attr_effect_mode_e)get_effect;
5141 LOGD("ret : 0x%x", ret);
5146 int camera_attr_get_scene_mode(camera_h camera, camera_attr_scene_mode_e *mode)
5148 if (camera == NULL || mode == NULL) {
5149 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5150 return CAMERA_ERROR_INVALID_PARAMETER;
5153 int ret = CAMERA_ERROR_NONE;
5154 camera_cli_s *pc = (camera_cli_s *)camera;
5155 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_SCENE_MODE;
5157 if (pc->cb_info == NULL) {
5158 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5159 return CAMERA_ERROR_INVALID_PARAMETER;
5161 sock_fd = pc->cb_info->fd;
5164 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5165 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5167 if (ret == CAMERA_ERROR_NONE) {
5168 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
5169 *mode = (camera_attr_scene_mode_e)get_mode;
5171 LOGD("ret : 0x%x", ret);
5176 int camera_attr_is_enabled_tag(camera_h camera, bool *enable)
5178 if (camera == NULL || enable == NULL) {
5179 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5180 return CAMERA_ERROR_INVALID_PARAMETER;
5183 int ret = CAMERA_ERROR_NONE;
5184 camera_cli_s *pc = (camera_cli_s *)camera;
5185 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_TAG;
5187 if (pc->cb_info == NULL) {
5188 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5189 return CAMERA_ERROR_INVALID_PARAMETER;
5191 sock_fd = pc->cb_info->fd;
5194 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5195 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5197 if (ret == CAMERA_ERROR_NONE) {
5198 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
5199 *enable = (bool)get_enabled;
5201 LOGD("ret : 0x%x", ret);
5206 int camera_attr_get_tag_image_description(camera_h camera, char **description)
5208 if (camera == NULL || description == NULL) {
5209 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5210 return CAMERA_ERROR_INVALID_PARAMETER;
5213 int ret = CAMERA_ERROR_NONE;
5214 camera_cli_s *pc = (camera_cli_s *)camera;
5215 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_IMAGE_DESCRIPTION;
5217 if (pc->cb_info == NULL) {
5218 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5219 return CAMERA_ERROR_INVALID_PARAMETER;
5221 sock_fd = pc->cb_info->fd;
5222 char get_description[MUSE_CAMERA_MSG_MAX_LENGTH] = {0,};
5224 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5225 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5227 if (ret == CAMERA_ERROR_NONE) {
5228 muse_camera_msg_get_string(get_description, pc->cb_info->recv_msg);
5229 *description = strdup(get_description);
5231 LOGD("ret : 0x%x", ret);
5236 int camera_attr_get_tag_orientation(camera_h camera, camera_attr_tag_orientation_e *orientation)
5238 if (camera == NULL || orientation == NULL) {
5239 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5240 return CAMERA_ERROR_INVALID_PARAMETER;
5243 int ret = CAMERA_ERROR_NONE;
5244 camera_cli_s *pc = (camera_cli_s *)camera;
5245 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_ORIENTATION;
5247 if (pc->cb_info == NULL) {
5248 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5249 return CAMERA_ERROR_INVALID_PARAMETER;
5251 sock_fd = pc->cb_info->fd;
5252 int get_orientation;
5254 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5255 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5257 if (ret == CAMERA_ERROR_NONE) {
5258 muse_camera_msg_get(get_orientation, pc->cb_info->recv_msg);
5259 *orientation = (camera_attr_tag_orientation_e)get_orientation;
5260 LOGD("success, orientation : %d", *orientation);
5262 LOGD("ret : 0x%x", ret);
5267 int camera_attr_get_tag_software(camera_h camera, char **software)
5269 if (camera == NULL || software == NULL) {
5270 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5271 return CAMERA_ERROR_INVALID_PARAMETER;
5274 int ret = CAMERA_ERROR_NONE;
5275 camera_cli_s *pc = (camera_cli_s *)camera;
5276 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_SOFTWARE;
5278 if (pc->cb_info == NULL) {
5279 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5280 return CAMERA_ERROR_INVALID_PARAMETER;
5282 sock_fd = pc->cb_info->fd;
5283 char get_software[MUSE_CAMERA_MSG_MAX_LENGTH] = {0,};
5285 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5286 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5288 if (ret == CAMERA_ERROR_NONE) {
5289 muse_camera_msg_get_string(get_software, pc->cb_info->recv_msg);
5290 *software = strdup(get_software);
5292 LOGD("ret : 0x%x", ret);
5297 int camera_attr_get_geotag(camera_h camera, double *latitude , double *longitude, double *altitude)
5299 if (camera == NULL || latitude == NULL || longitude == NULL || altitude == NULL) {
5300 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5301 return CAMERA_ERROR_INVALID_PARAMETER;
5304 int ret = CAMERA_ERROR_NONE;
5305 camera_cli_s *pc = (camera_cli_s *)camera;
5306 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_GEOTAG;
5307 double get_geotag[3] = {0,};
5309 if (pc->cb_info == NULL) {
5310 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5311 return CAMERA_ERROR_INVALID_PARAMETER;
5313 sock_fd = pc->cb_info->fd;
5315 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5317 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5319 if (ret == CAMERA_ERROR_NONE) {
5320 muse_camera_msg_get_array(get_geotag, pc->cb_info->recv_msg);
5321 *latitude = get_geotag[0];
5322 *longitude = get_geotag[1];
5323 *altitude = get_geotag[2];
5325 LOGD("ret : 0x%x", ret);
5327 LOGE("Returned value is not valid : 0x%x", ret);
5334 int camera_attr_get_flash_mode(camera_h camera, camera_attr_flash_mode_e *mode)
5336 if (camera == NULL || mode == NULL) {
5337 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5338 return CAMERA_ERROR_INVALID_PARAMETER;
5341 int ret = CAMERA_ERROR_NONE;
5342 camera_cli_s *pc = (camera_cli_s *)camera;
5343 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_FLASH_MODE;
5345 if (pc->cb_info == NULL) {
5346 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5347 return CAMERA_ERROR_INVALID_PARAMETER;
5349 sock_fd = pc->cb_info->fd;
5352 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5353 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5355 if (ret == CAMERA_ERROR_NONE) {
5356 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
5357 *mode = (camera_attr_flash_mode_e)get_mode;
5359 LOGD("ret : 0x%x", ret);
5364 int camera_get_flash_state(camera_device_e device, camera_flash_state_e *state)
5368 int ret = CAMERA_ERROR_NONE;
5369 camera_cli_s *pc = NULL;
5370 int get_flash_state = 0;
5372 /* create muse connection */
5373 muse_camera_api_e api = MUSE_CAMERA_API_GET_FLASH_STATE;
5374 muse_core_api_module_e muse_module = MUSE_CAMERA;
5375 int device_type = (int)device;
5377 if (state == NULL) {
5378 LOGE("invalid pointer for state");
5379 return CAMERA_ERROR_INVALID_PARAMETER;
5382 sock_fd = muse_core_client_new();
5384 LOGE("muse_core_client_new failed - returned fd %d", sock_fd);
5385 ret = CAMERA_ERROR_INVALID_OPERATION;
5389 sndMsg = muse_core_msg_json_factory_new(api,
5390 MUSE_TYPE_INT, "module", muse_module,
5391 MUSE_TYPE_INT, PARAM_DEVICE_TYPE, device_type,
5394 muse_core_ipc_send_msg(sock_fd, sndMsg);
5395 muse_core_msg_json_factory_free(sndMsg);
5397 pc = g_new0(camera_cli_s, 1);
5399 LOGE("camera_cli_s alloc failed");
5400 ret = CAMERA_ERROR_OUT_OF_MEMORY;
5404 pc->cb_info = _client_callback_new(sock_fd);
5405 if (pc->cb_info == NULL) {
5406 LOGE("cb_info alloc failed");
5407 ret = CAMERA_ERROR_OUT_OF_MEMORY;
5411 ret = _client_wait_for_cb_return(api, pc->cb_info, CALLBACK_TIME_OUT);
5413 if (ret == CAMERA_ERROR_NONE) {
5414 muse_camera_msg_get(get_flash_state, pc->cb_info->recv_msg);
5415 *state = (camera_flash_state_e)get_flash_state;
5418 LOGD("Flash state : %d\n", *state);
5421 /* release resources */
5423 g_atomic_int_set(&pc->cb_info->msg_recv_running, 0);
5424 _client_callback_destroy(pc->cb_info);
5434 int camera_attr_foreach_supported_af_mode(camera_h camera, camera_attr_supported_af_mode_cb foreach_cb, void *user_data)
5436 if (camera == NULL || foreach_cb == NULL) {
5437 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5438 return CAMERA_ERROR_INVALID_PARAMETER;
5440 int ret = CAMERA_ERROR_NONE;
5442 camera_cli_s *pc = (camera_cli_s *)camera;
5443 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_AF_MODE;
5445 LOGD("Enter, handle :%x", pc->remote_handle);
5448 if (pc->cb_info == NULL) {
5449 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5450 return CAMERA_ERROR_INVALID_PARAMETER;
5452 sock_fd = pc->cb_info->fd;
5453 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_AF_MODE] = foreach_cb;
5454 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_AF_MODE] = user_data;
5456 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5457 LOGD("ret : 0x%x", ret);
5462 int camera_attr_foreach_supported_exposure_mode(camera_h camera, camera_attr_supported_exposure_mode_cb foreach_cb , void *user_data)
5464 if (camera == NULL || foreach_cb == NULL) {
5465 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5466 return CAMERA_ERROR_INVALID_PARAMETER;
5468 int ret = CAMERA_ERROR_NONE;
5470 camera_cli_s *pc = (camera_cli_s *)camera;
5471 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_EXPOSURE_MODE;
5473 LOGD("Enter, handle :%x", pc->remote_handle);
5476 if (pc->cb_info == NULL) {
5477 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5478 return CAMERA_ERROR_INVALID_PARAMETER;
5480 sock_fd = pc->cb_info->fd;
5481 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EXPOSURE_MODE] = foreach_cb;
5482 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EXPOSURE_MODE] = user_data;
5484 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5485 LOGD("ret : 0x%x", ret);
5490 int camera_attr_foreach_supported_iso(camera_h camera, camera_attr_supported_iso_cb foreach_cb, void *user_data)
5492 if (camera == NULL || foreach_cb == NULL) {
5493 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5494 return CAMERA_ERROR_INVALID_PARAMETER;
5496 int ret = CAMERA_ERROR_NONE;
5498 camera_cli_s *pc = (camera_cli_s *)camera;
5499 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_ISO;
5501 LOGD("Enter, handle :%x", pc->remote_handle);
5504 if (pc->cb_info == NULL) {
5505 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5506 return CAMERA_ERROR_INVALID_PARAMETER;
5508 sock_fd = pc->cb_info->fd;
5509 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_ISO] = foreach_cb;
5510 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_ISO] = user_data;
5512 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5513 LOGD("ret : 0x%x", ret);
5518 int camera_attr_foreach_supported_whitebalance(camera_h camera, camera_attr_supported_whitebalance_cb foreach_cb , void *user_data)
5520 if (camera == NULL || foreach_cb == NULL) {
5521 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5522 return CAMERA_ERROR_INVALID_PARAMETER;
5524 int ret = CAMERA_ERROR_NONE;
5526 camera_cli_s *pc = (camera_cli_s *)camera;
5527 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_WHITEBALANCE;
5529 LOGD("Enter, handle :%x", pc->remote_handle);
5532 if (pc->cb_info == NULL) {
5533 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5534 return CAMERA_ERROR_INVALID_PARAMETER;
5536 sock_fd = pc->cb_info->fd;
5537 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_WHITEBALANCE] = foreach_cb;
5538 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_WHITEBALANCE] = user_data;
5540 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5541 LOGD("ret : 0x%x", ret);
5546 int camera_attr_foreach_supported_effect(camera_h camera, camera_attr_supported_effect_cb foreach_cb , void *user_data)
5548 if (camera == NULL || foreach_cb == NULL) {
5549 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5550 return CAMERA_ERROR_INVALID_PARAMETER;
5552 int ret = CAMERA_ERROR_NONE;
5554 camera_cli_s *pc = (camera_cli_s *)camera;
5555 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_EFFECT;
5557 LOGD("Enter, handle :%x", pc->remote_handle);
5560 if (pc->cb_info == NULL) {
5561 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5562 return CAMERA_ERROR_INVALID_PARAMETER;
5564 sock_fd = pc->cb_info->fd;
5565 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EFFECT] = foreach_cb;
5566 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EFFECT] = user_data;
5568 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5569 LOGD("ret : 0x%x", ret);
5574 int camera_attr_foreach_supported_scene_mode(camera_h camera, camera_attr_supported_scene_mode_cb foreach_cb , void *user_data)
5576 if (camera == NULL || foreach_cb == NULL) {
5577 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5578 return CAMERA_ERROR_INVALID_PARAMETER;
5580 int ret = CAMERA_ERROR_NONE;
5582 camera_cli_s *pc = (camera_cli_s *)camera;
5583 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_SCENE_MODE;
5585 LOGD("Enter, handle :%x", pc->remote_handle);
5588 if (pc->cb_info == NULL) {
5589 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5590 return CAMERA_ERROR_INVALID_PARAMETER;
5592 sock_fd = pc->cb_info->fd;
5593 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_SCENE_MODE] = foreach_cb;
5594 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_SCENE_MODE] = user_data;
5596 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5597 LOGD("ret : 0x%x", ret);
5602 int camera_attr_foreach_supported_flash_mode(camera_h camera, camera_attr_supported_flash_mode_cb foreach_cb , void *user_data)
5604 if (camera == NULL || foreach_cb == NULL) {
5605 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5606 return CAMERA_ERROR_INVALID_PARAMETER;
5608 int ret = CAMERA_ERROR_NONE;
5610 camera_cli_s *pc = (camera_cli_s *)camera;
5611 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FLASH_MODE;
5613 LOGD("Enter, handle :%x", pc->remote_handle);
5616 if (pc->cb_info == NULL) {
5617 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5618 return CAMERA_ERROR_INVALID_PARAMETER;
5620 sock_fd = pc->cb_info->fd;
5621 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FLASH_MODE] = foreach_cb;
5622 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FLASH_MODE] = user_data;
5624 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5625 LOGD("ret : 0x%x", ret);
5630 int camera_attr_foreach_supported_fps(camera_h camera, camera_attr_supported_fps_cb foreach_cb , void *user_data)
5632 if (camera == NULL || foreach_cb == NULL) {
5633 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5634 return CAMERA_ERROR_INVALID_PARAMETER;
5636 int ret = CAMERA_ERROR_NONE;
5638 camera_cli_s *pc = (camera_cli_s *)camera;
5639 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FPS;
5641 if (pc->cb_info == NULL) {
5642 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5643 return CAMERA_ERROR_INVALID_PARAMETER;
5645 sock_fd = pc->cb_info->fd;
5646 LOGD("Enter, handle :%x", pc->remote_handle);
5647 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS] = foreach_cb;
5648 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS] = user_data;
5650 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5651 LOGD("Enter, handle :%x", pc->remote_handle);
5655 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)
5657 if (camera == NULL || foreach_cb == NULL) {
5658 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5659 return CAMERA_ERROR_INVALID_PARAMETER;
5661 int ret = CAMERA_ERROR_NONE;
5663 camera_cli_s *pc = (camera_cli_s *)camera;
5664 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FPS_BY_RESOLUTION;
5666 if (pc->cb_info == NULL) {
5667 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5668 return CAMERA_ERROR_INVALID_PARAMETER;
5670 sock_fd = pc->cb_info->fd;
5671 LOGD("Enter, handle :%x", pc->remote_handle);
5672 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS_BY_RESOLUTION] = foreach_cb;
5673 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS_BY_RESOLUTION] = user_data;
5675 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, width, INT, height);
5676 LOGD("ret : 0x%x", ret);
5680 int camera_attr_foreach_supported_stream_flip(camera_h camera, camera_attr_supported_stream_flip_cb foreach_cb, void *user_data)
5682 if (camera == NULL || foreach_cb == NULL) {
5683 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5684 return CAMERA_ERROR_INVALID_PARAMETER;
5686 int ret = CAMERA_ERROR_NONE;
5688 camera_cli_s *pc = (camera_cli_s *)camera;
5689 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_STREAM_FLIP;
5691 if (pc->cb_info == NULL) {
5692 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5693 return CAMERA_ERROR_INVALID_PARAMETER;
5695 sock_fd = pc->cb_info->fd;
5696 LOGD("Enter, handle :%x", pc->remote_handle);
5697 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_FLIP] = foreach_cb;
5698 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_FLIP] = user_data;
5700 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5701 LOGD("ret : 0x%x", ret);
5706 int camera_attr_foreach_supported_stream_rotation(camera_h camera, camera_attr_supported_stream_rotation_cb foreach_cb, void *user_data)
5708 if (camera == NULL || foreach_cb == NULL) {
5709 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5710 return CAMERA_ERROR_INVALID_PARAMETER;
5712 int ret = CAMERA_ERROR_NONE;
5714 camera_cli_s *pc = (camera_cli_s *)camera;
5715 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_STREAM_ROTATION;
5717 if (pc->cb_info == NULL) {
5718 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5719 return CAMERA_ERROR_INVALID_PARAMETER;
5721 sock_fd = pc->cb_info->fd;
5722 LOGD("Enter, handle :%x", pc->remote_handle);
5723 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION] = foreach_cb;
5724 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION] = user_data;
5726 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5727 LOGD("ret : 0x%x", ret);
5732 int camera_attr_set_stream_rotation(camera_h camera , camera_rotation_e rotation)
5734 if (camera == NULL) {
5735 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5736 return CAMERA_ERROR_INVALID_PARAMETER;
5739 int ret = CAMERA_ERROR_NONE;
5740 camera_cli_s *pc = (camera_cli_s *)camera;
5741 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_STREAM_ROTATION;
5743 if (pc->cb_info == NULL) {
5744 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5745 return CAMERA_ERROR_INVALID_PARAMETER;
5747 sock_fd = pc->cb_info->fd;
5748 int set_rotation = (int)rotation;
5750 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5751 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_rotation);
5752 LOGD("ret : 0x%x", ret);
5757 int camera_attr_get_stream_rotation(camera_h camera , camera_rotation_e *rotation)
5759 if (camera == NULL || rotation == NULL) {
5760 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5761 return CAMERA_ERROR_INVALID_PARAMETER;
5764 int ret = CAMERA_ERROR_NONE;
5765 camera_cli_s *pc = (camera_cli_s *)camera;
5766 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_STREAM_ROTATION;
5768 if (pc->cb_info == NULL) {
5769 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5770 return CAMERA_ERROR_INVALID_PARAMETER;
5772 sock_fd = pc->cb_info->fd;
5775 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5776 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5778 if (ret == CAMERA_ERROR_NONE) {
5779 muse_camera_msg_get(get_rotation, pc->cb_info->recv_msg);
5780 *rotation = (camera_rotation_e)get_rotation;
5782 LOGD("ret : 0x%x", ret);
5787 int camera_attr_set_stream_flip(camera_h camera , camera_flip_e flip)
5789 if (camera == NULL) {
5790 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5791 return CAMERA_ERROR_INVALID_PARAMETER;
5794 int ret = CAMERA_ERROR_NONE;
5795 camera_cli_s *pc = (camera_cli_s *)camera;
5796 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_STREAM_FLIP;
5798 if (pc->cb_info == NULL) {
5799 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5800 return CAMERA_ERROR_INVALID_PARAMETER;
5802 sock_fd = pc->cb_info->fd;
5803 int set_flip = (int)flip;
5805 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5806 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_flip);
5807 LOGD("ret : 0x%x", ret);
5812 int camera_attr_get_stream_flip(camera_h camera , camera_flip_e *flip)
5814 if (camera == NULL || flip == NULL) {
5815 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5816 return CAMERA_ERROR_INVALID_PARAMETER;
5819 int ret = CAMERA_ERROR_NONE;
5820 camera_cli_s *pc = (camera_cli_s *)camera;
5821 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_STREAM_FLIP;
5823 if (pc->cb_info == NULL) {
5824 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5825 return CAMERA_ERROR_INVALID_PARAMETER;
5827 sock_fd = pc->cb_info->fd;
5830 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5831 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5833 if (ret == CAMERA_ERROR_NONE) {
5834 muse_camera_msg_get(get_flip, pc->cb_info->recv_msg);
5835 *flip = (camera_flip_e)get_flip;
5837 LOGD("ret : 0x%x", ret);
5841 int camera_attr_set_hdr_mode(camera_h camera, camera_attr_hdr_mode_e mode)
5843 if (camera == NULL) {
5844 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5845 return CAMERA_ERROR_INVALID_PARAMETER;
5848 int ret = CAMERA_ERROR_NONE;
5849 camera_cli_s *pc = (camera_cli_s *)camera;
5850 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_HDR_MODE;
5852 if (pc->cb_info == NULL) {
5853 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5854 return CAMERA_ERROR_INVALID_PARAMETER;
5856 sock_fd = pc->cb_info->fd;
5857 int set_mode = (int)mode;
5859 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5860 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
5861 LOGD("ret : 0x%x", ret);
5866 int camera_attr_get_hdr_mode(camera_h camera, camera_attr_hdr_mode_e *mode)
5868 if (camera == NULL) {
5869 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5870 return CAMERA_ERROR_INVALID_PARAMETER;
5873 LOGE("INVALID_PARAMETER(0x%08x) - mode", CAMERA_ERROR_INVALID_PARAMETER);
5874 return CAMERA_ERROR_INVALID_PARAMETER;
5876 int ret = CAMERA_ERROR_NONE;
5877 camera_cli_s *pc = (camera_cli_s *)camera;
5878 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_HDR_MODE;
5880 if (pc->cb_info == NULL) {
5881 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5882 return CAMERA_ERROR_INVALID_PARAMETER;
5884 sock_fd = pc->cb_info->fd;
5887 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5888 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5890 if (ret == CAMERA_ERROR_NONE) {
5891 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
5892 *mode = (camera_attr_hdr_mode_e)get_mode;
5894 LOGD("ret : 0x%x", ret);
5899 bool camera_attr_is_supported_hdr_capture(camera_h camera)
5901 if (camera == NULL) {
5902 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5906 int ret = CAMERA_ERROR_NONE;
5907 camera_cli_s *pc = (camera_cli_s *)camera;
5908 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_HDR_CAPTURE;
5910 if (pc->cb_info == NULL) {
5911 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5912 return CAMERA_ERROR_INVALID_PARAMETER;
5914 sock_fd = pc->cb_info->fd;
5915 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5916 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5917 LOGD("ret : 0x%x", ret);
5922 int camera_attr_set_hdr_capture_progress_cb(camera_h camera, camera_attr_hdr_progress_cb callback, void *user_data)
5924 int ret = CAMERA_ERROR_NONE;
5925 camera_cli_s *pc = (camera_cli_s *)camera;
5926 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_HDR_CAPTURE_PROGRESS_CB;
5929 if (camera == NULL) {
5930 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5931 return CAMERA_ERROR_INVALID_PARAMETER;
5934 if (pc->cb_info == NULL) {
5935 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5936 return CAMERA_ERROR_INVALID_PARAMETER;
5939 sock_fd = pc->cb_info->fd;
5941 LOGD("Enter, handle :%x", pc->remote_handle);
5943 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5945 if (ret == CAMERA_ERROR_NONE) {
5946 if (callback == NULL) {
5947 LOGE("INVALID_PARAMETER(0x%08x) - callback", CAMERA_ERROR_INVALID_PARAMETER);
5948 return CAMERA_ERROR_INVALID_PARAMETER;
5951 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = callback;
5952 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = user_data;
5955 LOGD("ret : 0x%x", ret);
5961 int camera_attr_unset_hdr_capture_progress_cb(camera_h camera)
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;
5970 camera_cli_s *pc = (camera_cli_s *)camera;
5971 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_UNSET_HDR_CAPTURE_PROGRESS_CB;
5973 if (pc->cb_info == NULL) {
5974 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5975 return CAMERA_ERROR_INVALID_PARAMETER;
5977 sock_fd = pc->cb_info->fd;
5978 LOGD("Enter, handle :%x", pc->remote_handle);
5980 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = (void *)NULL;
5981 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = (void *)NULL;
5983 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5984 LOGD("ret : 0x%x", ret);
5989 int camera_attr_enable_anti_shake(camera_h camera, bool enable)
5991 if (camera == NULL) {
5992 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5993 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_ENABLE_ANTI_SHAKE;
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;
6005 int set_enable = (int)enable;
6007 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6008 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
6009 LOGD("ret : 0x%x", ret);
6014 int camera_attr_is_enabled_anti_shake(camera_h camera , bool *enabled)
6016 if (camera == NULL) {
6017 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
6018 return CAMERA_ERROR_INVALID_PARAMETER;
6020 if (enabled == NULL) {
6021 LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER);
6022 return CAMERA_ERROR_INVALID_PARAMETER;
6024 int ret = CAMERA_ERROR_NONE;
6025 camera_cli_s *pc = (camera_cli_s *)camera;
6026 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_ANTI_SHAKE;
6028 if (pc->cb_info == NULL) {
6029 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6030 return CAMERA_ERROR_INVALID_PARAMETER;
6032 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);
6038 if (ret == CAMERA_ERROR_NONE) {
6039 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
6040 *enabled = (bool)get_enabled;
6042 LOGD("ret : 0x%x", ret);
6047 bool camera_attr_is_supported_anti_shake(camera_h camera)
6050 if (camera == NULL) {
6051 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6055 int ret = CAMERA_ERROR_NONE;
6056 camera_cli_s *pc = (camera_cli_s *)camera;
6057 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_ANTI_SHAKE;
6059 if (pc->cb_info == NULL) {
6060 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6061 return CAMERA_ERROR_INVALID_PARAMETER;
6063 sock_fd = pc->cb_info->fd;
6064 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6065 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6066 LOGD("ret : 0x%x", ret);
6071 int camera_attr_enable_video_stabilization(camera_h camera, bool enable)
6073 if (camera == NULL) {
6074 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6075 return CAMERA_ERROR_INVALID_PARAMETER;
6078 int ret = CAMERA_ERROR_NONE;
6079 camera_cli_s *pc = (camera_cli_s *)camera;
6080 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_VIDEO_STABILIZATION;
6082 if (pc->cb_info == NULL) {
6083 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6084 return CAMERA_ERROR_INVALID_PARAMETER;
6086 sock_fd = pc->cb_info->fd;
6087 int set_enable = (int)enable;
6089 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6090 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
6091 LOGD("ret : 0x%x", ret);
6096 int camera_attr_is_enabled_video_stabilization(camera_h camera, bool *enabled)
6098 if (camera == NULL) {
6099 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
6100 return CAMERA_ERROR_INVALID_PARAMETER;
6102 if (enabled == NULL) {
6103 LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER);
6104 return CAMERA_ERROR_INVALID_PARAMETER;
6106 int ret = CAMERA_ERROR_NONE;
6107 camera_cli_s *pc = (camera_cli_s *)camera;
6108 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_VIDEO_STABILIZATION;
6110 if (pc->cb_info == NULL) {
6111 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6112 return CAMERA_ERROR_INVALID_PARAMETER;
6114 sock_fd = pc->cb_info->fd;
6117 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6118 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6120 if (ret == CAMERA_ERROR_NONE) {
6121 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
6122 *enabled = (bool)get_enabled;
6124 LOGD("ret : 0x%x", ret);
6129 bool camera_attr_is_supported_video_stabilization(camera_h camera)
6131 if (camera == NULL) {
6132 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6136 int ret = CAMERA_ERROR_NONE;
6137 camera_cli_s *pc = (camera_cli_s *)camera;
6138 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_VIDEO_STABILIZATION;
6140 if (pc->cb_info == NULL) {
6141 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6142 return CAMERA_ERROR_INVALID_PARAMETER;
6144 sock_fd = pc->cb_info->fd;
6145 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6146 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6147 LOGD("ret : 0x%x", ret);
6152 int camera_attr_enable_auto_contrast(camera_h camera, bool enable)
6154 if (camera == NULL) {
6155 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6156 return CAMERA_ERROR_INVALID_PARAMETER;
6159 int ret = CAMERA_ERROR_NONE;
6160 camera_cli_s *pc = (camera_cli_s *)camera;
6161 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_AUTO_CONTRAST;
6163 if (pc->cb_info == NULL) {
6164 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6165 return CAMERA_ERROR_INVALID_PARAMETER;
6167 sock_fd = pc->cb_info->fd;
6168 int set_enable = (int)enable;
6170 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6171 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
6172 LOGD("ret : 0x%x", ret);
6177 int camera_attr_is_enabled_auto_contrast(camera_h camera, bool *enabled)
6179 if (camera == NULL) {
6180 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
6181 return CAMERA_ERROR_INVALID_PARAMETER;
6183 if (enabled == NULL) {
6184 LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER);
6185 return CAMERA_ERROR_INVALID_PARAMETER;
6187 int ret = CAMERA_ERROR_NONE;
6188 camera_cli_s *pc = (camera_cli_s *)camera;
6189 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_AUTO_CONTRAST;
6191 if (pc->cb_info == NULL) {
6192 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6193 return CAMERA_ERROR_INVALID_PARAMETER;
6195 sock_fd = pc->cb_info->fd;
6198 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6199 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6201 if (ret == CAMERA_ERROR_NONE) {
6202 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
6203 *enabled = (bool)get_enabled;
6205 LOGD("ret : 0x%x", ret);
6210 bool camera_attr_is_supported_auto_contrast(camera_h camera)
6212 if (camera == NULL) {
6213 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6217 int ret = CAMERA_ERROR_NONE;
6218 camera_cli_s *pc = (camera_cli_s *)camera;
6219 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_AUTO_CONTRAST;
6221 if (pc->cb_info == NULL) {
6222 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6223 return CAMERA_ERROR_INVALID_PARAMETER;
6225 sock_fd = pc->cb_info->fd;
6226 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6227 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6228 LOGD("ret : 0x%x", ret);
6233 int camera_attr_disable_shutter_sound(camera_h camera, bool disable)
6235 if (camera == NULL) {
6236 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6237 return CAMERA_ERROR_INVALID_PARAMETER;
6240 int ret = CAMERA_ERROR_NONE;
6241 camera_cli_s *pc = (camera_cli_s *)camera;
6242 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_DISABLE_SHUTTER_SOUND;
6244 if (pc->cb_info == NULL) {
6245 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6246 return CAMERA_ERROR_INVALID_PARAMETER;
6248 sock_fd = pc->cb_info->fd;
6249 int set_disable = (int)disable;
6251 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6252 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_disable);
6253 LOGD("ret : 0x%x", ret);
6258 int camera_attr_set_pan(camera_h camera, camera_attr_ptz_move_type_e move_type, int pan_step)
6260 if (camera == NULL) {
6261 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6262 return CAMERA_ERROR_INVALID_PARAMETER;
6265 camera_cli_s *pc = (camera_cli_s *)camera;
6266 if (pc->cb_info == NULL) {
6267 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6268 return CAMERA_ERROR_INVALID_PARAMETER;
6271 int ret = CAMERA_ERROR_NONE;
6272 int sock_fd = pc->cb_info->fd;
6273 int set_move_type = (int)move_type;
6274 int set_pan_step = pan_step;
6275 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_PAN;
6277 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6278 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, set_move_type, INT, set_pan_step);
6279 LOGD("ret : 0x%x", ret);
6284 int camera_attr_get_pan(camera_h camera, int *pan_step)
6286 if (camera == NULL || pan_step == NULL) {
6287 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6288 return CAMERA_ERROR_INVALID_PARAMETER;
6291 camera_cli_s *pc = (camera_cli_s *)camera;
6292 if (pc->cb_info == NULL) {
6293 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6294 return CAMERA_ERROR_INVALID_PARAMETER;
6297 int ret = CAMERA_ERROR_NONE;
6298 int sock_fd = pc->cb_info->fd;
6300 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_PAN;
6302 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6303 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6305 if (ret == CAMERA_ERROR_NONE) {
6306 muse_camera_msg_get(get_pan_step, pc->cb_info->recv_msg);
6307 *pan_step = get_pan_step;
6309 LOGD("ret : 0x%x", ret);
6314 int camera_attr_get_pan_range(camera_h camera, int *min, int *max)
6316 if (camera == NULL || min == NULL || max == NULL) {
6317 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6318 return CAMERA_ERROR_INVALID_PARAMETER;
6321 camera_cli_s *pc = (camera_cli_s *)camera;
6322 if (pc->cb_info == NULL) {
6323 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6324 return CAMERA_ERROR_INVALID_PARAMETER;
6327 int ret = CAMERA_ERROR_NONE;
6328 int sock_fd = pc->cb_info->fd;
6331 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_PAN_RANGE;
6333 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6334 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6336 if (ret == CAMERA_ERROR_NONE) {
6337 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
6338 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
6342 LOGD("ret : 0x%x", ret);
6347 int camera_attr_set_tilt(camera_h camera, camera_attr_ptz_move_type_e move_type, int tilt_step)
6349 if (camera == NULL) {
6350 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6351 return CAMERA_ERROR_INVALID_PARAMETER;
6354 camera_cli_s *pc = (camera_cli_s *)camera;
6355 if (pc->cb_info == NULL) {
6356 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6357 return CAMERA_ERROR_INVALID_PARAMETER;
6360 int ret = CAMERA_ERROR_NONE;
6361 int sock_fd = pc->cb_info->fd;
6362 int set_move_type = (int)move_type;
6363 int set_tilt_step = tilt_step;
6364 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TILT;
6366 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6367 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, set_move_type, INT, set_tilt_step);
6368 LOGD("ret : 0x%x", ret);
6373 int camera_attr_get_tilt(camera_h camera, int *tilt_step)
6375 if (camera == NULL || tilt_step == NULL) {
6376 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6377 return CAMERA_ERROR_INVALID_PARAMETER;
6380 camera_cli_s *pc = (camera_cli_s *)camera;
6381 if (pc->cb_info == NULL) {
6382 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6383 return CAMERA_ERROR_INVALID_PARAMETER;
6386 int ret = CAMERA_ERROR_NONE;
6387 int sock_fd = pc->cb_info->fd;
6389 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TILT;
6391 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6392 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6394 if (ret == CAMERA_ERROR_NONE) {
6395 muse_camera_msg_get(get_tilt_step, pc->cb_info->recv_msg);
6396 *tilt_step = get_tilt_step;
6398 LOGD("ret : 0x%x", ret);
6403 int camera_attr_get_tilt_range(camera_h camera, int *min, int *max)
6405 if (camera == NULL || min == NULL || max == NULL) {
6406 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6407 return CAMERA_ERROR_INVALID_PARAMETER;
6410 camera_cli_s *pc = (camera_cli_s *)camera;
6411 if (pc->cb_info == NULL) {
6412 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6413 return CAMERA_ERROR_INVALID_PARAMETER;
6416 int ret = CAMERA_ERROR_NONE;
6417 int sock_fd = pc->cb_info->fd;
6420 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TILT_RANGE;
6422 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6423 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6425 if (ret == CAMERA_ERROR_NONE) {
6426 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
6427 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
6431 LOGD("ret : 0x%x", ret);
6436 int camera_attr_set_ptz_type(camera_h camera, camera_attr_ptz_type_e ptz_type)
6438 if (camera == NULL) {
6439 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6440 return CAMERA_ERROR_INVALID_PARAMETER;
6443 camera_cli_s *pc = (camera_cli_s *)camera;
6444 if (pc->cb_info == NULL) {
6445 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6446 return CAMERA_ERROR_INVALID_PARAMETER;
6449 int ret = CAMERA_ERROR_NONE;
6450 int sock_fd = pc->cb_info->fd;
6451 int set_ptz_type = (int)ptz_type;
6452 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_PTZ_TYPE;
6454 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6455 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_ptz_type);
6456 LOGD("ret : 0x%x", ret);
6461 int camera_attr_foreach_supported_ptz_type(camera_h camera, camera_attr_supported_ptz_type_cb foreach_cb, void *user_data)
6463 if (camera == NULL || foreach_cb == NULL) {
6464 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6465 return CAMERA_ERROR_INVALID_PARAMETER;
6467 int ret = CAMERA_ERROR_NONE;
6469 camera_cli_s *pc = (camera_cli_s *)camera;
6470 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_PTZ_TYPE;
6472 if (pc->cb_info == NULL) {
6473 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6474 return CAMERA_ERROR_INVALID_PARAMETER;
6476 sock_fd = pc->cb_info->fd;
6477 LOGD("Enter, handle :%x", pc->remote_handle);
6478 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PTZ_TYPE] = foreach_cb;
6479 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PTZ_TYPE] = user_data;
6481 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6482 LOGD("ret : 0x%x", ret);
6487 int camera_attr_set_display_roi_area(camera_h camera, int x, int y, int width, int height)
6489 if (camera == NULL) {
6490 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6491 return CAMERA_ERROR_INVALID_PARAMETER;
6494 camera_cli_s *pc = (camera_cli_s *)camera;
6495 if (pc->cb_info == NULL) {
6496 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6497 return CAMERA_ERROR_INVALID_PARAMETER;
6500 int ret = CAMERA_ERROR_NONE;
6501 int sock_fd = pc->cb_info->fd;
6502 int set_display_roi_area[4] = {x, y, width, height};
6503 muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY_ROI_AREA;
6505 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6507 #ifdef TIZEN_FEATURE_EVAS_RENDERER
6508 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
6509 g_mutex_lock(&pc->cb_info->evas_mutex);
6511 ret = mm_evas_renderer_set_roi_area(pc->cb_info->evas_info, x, y, width, height);
6513 g_mutex_unlock(&pc->cb_info->evas_mutex);
6515 if (ret != MM_ERROR_NONE) {
6516 LOGE("mm_evas_renderer_set_roi_area error 0x%x", ret);
6517 return CAMERA_ERROR_INVALID_OPERATION;
6520 #endif /* TIZEN_FEATURE_EVAS_RENDERER */
6522 muse_camera_msg_send_array(api, sock_fd, pc->cb_info, ret,
6523 set_display_roi_area, sizeof(set_display_roi_area), sizeof(int));
6525 LOGD("ret : 0x%x", ret);
6531 int camera_attr_get_display_roi_area(camera_h camera, int *x, int *y, int *width, int *height)
6533 if (camera == NULL || x == NULL || y == NULL || width == NULL || height == NULL) {
6534 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6535 return CAMERA_ERROR_INVALID_PARAMETER;
6538 camera_cli_s *pc = (camera_cli_s *)camera;
6539 if (pc->cb_info == NULL) {
6540 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6541 return CAMERA_ERROR_INVALID_PARAMETER;
6544 int ret = CAMERA_ERROR_NONE;
6545 int sock_fd = pc->cb_info->fd;
6546 int get_display_roi_area[4] = {0,};
6547 muse_camera_api_e api = MUSE_CAMERA_API_GET_DISPLAY_ROI_AREA;
6549 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6551 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6553 if (ret == CAMERA_ERROR_NONE) {
6554 muse_camera_msg_get_array(get_display_roi_area, pc->cb_info->recv_msg);
6556 *x = get_display_roi_area[0];
6557 *y = get_display_roi_area[1];
6558 *width = get_display_roi_area[2];
6559 *height = get_display_roi_area[3];
6561 LOGD("ret : 0x%x", ret);
6563 LOGE("Returned value is not valid : 0x%x", ret);