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)
2156 char *send_msg = NULL;
2158 int ret = CAMERA_ERROR_NONE;
2160 camera_cli_s *pc = NULL;
2161 tbm_bufmgr bufmgr = NULL;
2163 muse_camera_api_e api = MUSE_CAMERA_API_CREATE;
2164 muse_core_api_module_e muse_module = MUSE_CAMERA;
2165 int device_type = (int)device;
2167 if (camera == NULL) {
2168 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2169 return CAMERA_ERROR_INVALID_PARAMETER;
2172 bufmgr = tbm_bufmgr_init(-1);
2173 if (bufmgr == NULL) {
2174 LOGE("get tbm bufmgr failed");
2175 return CAMERA_ERROR_INVALID_OPERATION;
2178 sock_fd = muse_core_client_new();
2180 LOGE("muse_core_client_new failed - returned fd %d", sock_fd);
2181 ret = CAMERA_ERROR_INVALID_OPERATION;
2187 send_msg = muse_core_msg_json_factory_new(api,
2188 MUSE_TYPE_INT, "module", muse_module,
2189 MUSE_TYPE_INT, PARAM_DEVICE_TYPE, device_type,
2190 MUSE_TYPE_INT, "pid", pid,
2195 ret = CAMERA_ERROR_OUT_OF_MEMORY;
2199 send_ret = muse_core_ipc_send_msg(sock_fd, send_msg);
2201 muse_core_msg_json_factory_free(send_msg);
2205 LOGE("send msg failed %d", errno);
2206 ret = CAMERA_ERROR_INVALID_OPERATION;
2210 pc = g_new0(camera_cli_s, 1);
2212 LOGE("camera_cli_s alloc failed");
2213 ret = CAMERA_ERROR_OUT_OF_MEMORY;
2217 pc->cb_info = _client_callback_new(sock_fd);
2218 if (pc->cb_info == NULL) {
2219 LOGE("cb_info alloc failed");
2220 ret = CAMERA_ERROR_OUT_OF_MEMORY;
2226 LOGD("cb info : %d", pc->cb_info->fd);
2228 ret = _client_wait_for_cb_return(api, pc->cb_info, CALLBACK_TIME_OUT);
2229 if (ret == CAMERA_ERROR_NONE) {
2230 intptr_t handle = 0;
2231 muse_camera_msg_get_pointer(handle, pc->cb_info->recv_msg);
2233 LOGE("Receiving Handle Failed!!");
2234 ret = CAMERA_ERROR_INVALID_OPERATION;
2238 pc->remote_handle = handle;
2239 pc->cb_info->bufmgr = bufmgr;
2241 ret = camera_set_display((camera_h)pc, CAMERA_DISPLAY_TYPE_NONE, NULL);
2242 if (ret != CAMERA_ERROR_NONE) {
2243 LOGE("init display failed 0x%x", ret);
2247 LOGD("camera create 0x%x", pc->remote_handle);
2248 *camera = (camera_h)pc;
2256 tbm_bufmgr_deinit(bufmgr);
2260 muse_core_connection_close(sock_fd);
2266 _client_callback_destroy(pc->cb_info);
2273 LOGE("camera create error : 0x%x", ret);
2279 int camera_change_device(camera_h camera, camera_device_e device)
2281 int ret = CAMERA_ERROR_NONE;
2282 muse_camera_api_e api = MUSE_CAMERA_API_CHANGE_DEVICE;
2283 camera_cli_s *pc = (camera_cli_s *)camera;
2285 if (camera == NULL || pc->cb_info == NULL) {
2286 LOGE("NULL handle, INVALID_PARAMETER");
2287 return CAMERA_ERROR_INVALID_PARAMETER;
2290 muse_camera_msg_send1(api, pc->cb_info->fd, pc->cb_info, ret, INT, device);
2296 int camera_destroy(camera_h camera)
2298 if (camera == NULL) {
2299 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2300 return CAMERA_ERROR_INVALID_PARAMETER;
2303 int ret = CAMERA_ERROR_NONE;
2304 muse_camera_api_e api = MUSE_CAMERA_API_DESTROY;
2305 camera_cli_s *pc = (camera_cli_s *)camera;
2310 if (pc->cb_info == NULL) {
2311 LOGE("cb_info NULL, INVALID_PARAMETER");
2312 return CAMERA_ERROR_INVALID_PARAMETER;
2315 sock_fd = pc->cb_info->fd;
2317 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2318 if (ret == CAMERA_ERROR_NONE) {
2319 _camera_remove_idle_event_all(pc->cb_info);
2320 _client_callback_destroy(pc->cb_info);
2326 LOGE("camera destroy error : 0x%x", ret);
2332 int camera_start_preview(camera_h camera)
2334 int ret = CAMERA_ERROR_NONE;
2335 muse_camera_api_e api = MUSE_CAMERA_API_START_PREVIEW;
2336 camera_cli_s *pc = (camera_cli_s *)camera;
2339 if (camera == NULL) {
2340 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2341 return CAMERA_ERROR_INVALID_PARAMETER;
2344 if (pc->cb_info == NULL) {
2345 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2346 return CAMERA_ERROR_INVALID_PARAMETER;
2351 sock_fd = pc->cb_info->fd;
2353 muse_camera_msg_send_longtime(api, sock_fd, pc->cb_info, ret);
2355 if (ret != CAMERA_ERROR_NONE) {
2356 LOGE("start preview failed 0x%x", ret);
2357 } else if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
2358 ret = _camera_start_evas_rendering(camera);
2361 LOGD("ret : 0x%x", ret);
2366 int camera_stop_preview(camera_h camera)
2368 int ret = CAMERA_ERROR_NONE;
2370 camera_cli_s *pc = NULL;
2371 muse_camera_api_e api = MUSE_CAMERA_API_STOP_PREVIEW;
2373 if (camera == NULL) {
2374 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2375 return CAMERA_ERROR_INVALID_PARAMETER;
2378 pc = (camera_cli_s *)camera;
2380 if (pc->cb_info == NULL) {
2381 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2382 return CAMERA_ERROR_INVALID_PARAMETER;
2385 sock_fd = pc->cb_info->fd;
2389 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
2390 camera_state_e current_state = CAMERA_STATE_NONE;
2392 ret = camera_get_state(camera, ¤t_state);
2393 if (ret != CAMERA_ERROR_NONE) {
2394 LOGE("failed to get current state 0x%x", ret);
2398 if (current_state == CAMERA_STATE_PREVIEW) {
2399 ret = _camera_stop_evas_rendering(camera, false);
2400 if (ret != CAMERA_ERROR_NONE)
2405 /* send stop preview message */
2406 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2408 LOGD("ret : 0x%x", ret);
2413 int camera_start_capture(camera_h camera, camera_capturing_cb capturing_cb, camera_capture_completed_cb completed_cb, void *user_data)
2415 if (camera == NULL) {
2416 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2417 return CAMERA_ERROR_INVALID_PARAMETER;
2419 int ret = CAMERA_ERROR_NONE;
2421 camera_cli_s *pc = (camera_cli_s *)camera;
2422 muse_camera_api_e api = MUSE_CAMERA_API_START_CAPTURE;
2424 int is_capturing_cb = 0;
2425 int is_completed_cb = 0;
2426 LOGD("Enter, handle :%x", pc->remote_handle);
2428 if (pc->cb_info == NULL) {
2429 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2430 return CAMERA_ERROR_INVALID_PARAMETER;
2433 sock_fd = pc->cb_info->fd;
2435 if (capturing_cb != NULL) {
2436 is_capturing_cb = 1;
2437 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = capturing_cb;
2438 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = user_data;
2441 if (completed_cb != NULL) {
2442 is_completed_cb = 1;
2443 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = completed_cb;
2444 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = user_data;
2447 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, is_capturing_cb, INT, is_completed_cb);
2448 LOGD("is_capturing_cb :%d, is_completed_cb : %d", is_capturing_cb, is_completed_cb);
2449 LOGD("ret : 0x%x", ret);
2453 bool camera_is_supported_continuous_capture(camera_h camera)
2455 if (camera == NULL) {
2456 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2460 int ret = CAMERA_ERROR_NONE;
2461 camera_cli_s *pc = (camera_cli_s *)camera;
2462 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_CONTINUOUS_CAPTURE;
2465 if (pc->cb_info == NULL) {
2466 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2467 return CAMERA_ERROR_INVALID_PARAMETER;
2470 sock_fd = pc->cb_info->fd;
2472 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2473 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2474 LOGD("ret : 0x%x", ret);
2478 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)
2480 if (camera == NULL) {
2481 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2482 return CAMERA_ERROR_INVALID_PARAMETER;
2485 int ret = CAMERA_ERROR_NONE;
2487 camera_cli_s *pc = (camera_cli_s *)camera;
2488 muse_camera_api_e api = MUSE_CAMERA_API_START_CONTINUOUS_CAPTURE;
2490 LOGD("Enter, handle :%x", pc->remote_handle);
2493 if (pc->cb_info == NULL) {
2494 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2495 return CAMERA_ERROR_INVALID_PARAMETER;
2497 sock_fd = pc->cb_info->fd;
2499 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = capturing_cb;
2500 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = user_data;
2501 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = completed_cb;
2503 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, count, INT, interval);
2505 LOGD("ret : 0x%x", ret);
2510 int camera_stop_continuous_capture(camera_h camera)
2512 if (camera == NULL) {
2513 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2514 return CAMERA_ERROR_INVALID_PARAMETER;
2518 int ret = CAMERA_ERROR_NONE;
2520 camera_cli_s *pc = (camera_cli_s *)camera;
2521 muse_camera_api_e api = MUSE_CAMERA_API_STOP_CONTINUOUS_CAPTURE;
2522 LOGD("Enter, handle :%x", pc->remote_handle);
2524 if (pc->cb_info == NULL) {
2525 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2526 return CAMERA_ERROR_INVALID_PARAMETER;
2528 sock_fd = pc->cb_info->fd;
2529 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2530 LOGD("ret : 0x%x", ret);
2534 bool camera_is_supported_face_detection(camera_h camera)
2536 if (camera == NULL) {
2537 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2540 int ret = CAMERA_ERROR_NONE;
2542 camera_cli_s *pc = (camera_cli_s *)camera;
2543 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_FACE_DETECTION;
2545 if (pc->cb_info == NULL) {
2546 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2547 return CAMERA_ERROR_INVALID_PARAMETER;
2549 sock_fd = pc->cb_info->fd;
2551 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2552 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2553 LOGD("ret : 0x%x", ret);
2557 bool camera_is_supported_zero_shutter_lag(camera_h camera)
2559 if (camera == NULL) {
2560 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_ZERO_SHUTTER_LAG;
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 bool camera_is_supported_media_packet_preview_cb(camera_h camera)
2582 if (camera == NULL) {
2583 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2587 int ret = CAMERA_ERROR_NONE;
2589 camera_cli_s *pc = (camera_cli_s *)camera;
2590 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_MEDIA_PACKET_PREVIEW_CB;
2592 if (pc->cb_info == NULL) {
2593 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2594 return CAMERA_ERROR_INVALID_PARAMETER;
2596 sock_fd = pc->cb_info->fd;
2598 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2599 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2600 LOGD("ret : 0x%x", ret);
2604 int camera_get_device_count(camera_h camera, int *device_count)
2606 if (camera == NULL || device_count == NULL) {
2607 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2608 return CAMERA_ERROR_INVALID_PARAMETER;
2610 int ret = CAMERA_ERROR_NONE;
2612 camera_cli_s *pc = (camera_cli_s *)camera;
2613 muse_camera_api_e api = MUSE_CAMERA_API_GET_DEVICE_COUNT;
2615 if (pc->cb_info == NULL) {
2616 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2617 return CAMERA_ERROR_INVALID_PARAMETER;
2619 sock_fd = pc->cb_info->fd;
2620 int get_device_count;
2622 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2623 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2625 if (ret == CAMERA_ERROR_NONE) {
2626 muse_camera_msg_get(get_device_count, pc->cb_info->recv_msg);
2627 *device_count = get_device_count;
2629 LOGD("ret : 0x%x", ret);
2633 int camera_start_face_detection(camera_h camera, camera_face_detected_cb callback, void *user_data)
2635 if (camera == NULL) {
2636 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2637 return CAMERA_ERROR_INVALID_PARAMETER;
2640 int ret = CAMERA_ERROR_NONE;
2642 camera_cli_s *pc = (camera_cli_s *)camera;
2643 muse_camera_api_e api = MUSE_CAMERA_API_START_FACE_DETECTION;
2645 LOGD("Enter, handle :%x", pc->remote_handle);
2647 if (pc->cb_info == NULL) {
2648 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2649 return CAMERA_ERROR_INVALID_PARAMETER;
2651 sock_fd = pc->cb_info->fd;
2652 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION] = callback;
2653 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION] = user_data;
2655 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2656 LOGD("ret : 0x%x", ret);
2660 int camera_stop_face_detection(camera_h camera)
2662 if (camera == NULL) {
2663 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2664 return CAMERA_ERROR_INVALID_PARAMETER;
2667 int ret = CAMERA_ERROR_NONE;
2669 camera_cli_s *pc = (camera_cli_s *)camera;
2670 muse_camera_api_e api = MUSE_CAMERA_API_STOP_FACE_DETECTION;
2671 LOGD("Enter, handle :%x", pc->remote_handle);
2673 if (pc->cb_info == NULL) {
2674 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2675 return CAMERA_ERROR_INVALID_PARAMETER;
2677 sock_fd = pc->cb_info->fd;
2678 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2679 LOGD("ret : 0x%x", ret);
2683 int camera_get_state(camera_h camera, camera_state_e *state)
2685 if (camera == NULL || state == NULL) {
2686 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2687 return CAMERA_ERROR_INVALID_PARAMETER;
2689 int ret = CAMERA_ERROR_NONE;
2691 camera_cli_s *pc = (camera_cli_s *)camera;
2692 muse_camera_api_e api = MUSE_CAMERA_API_GET_STATE;
2694 if (pc->cb_info == NULL) {
2695 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2696 return CAMERA_ERROR_INVALID_PARAMETER;
2698 sock_fd = pc->cb_info->fd;
2701 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2702 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2704 if (ret == CAMERA_ERROR_NONE) {
2705 muse_camera_msg_get(get_state, pc->cb_info->recv_msg);
2706 *state = (camera_state_e)get_state;
2708 LOGD("ret : 0x%x", ret);
2712 int camera_start_focusing(camera_h camera, bool continuous)
2714 if (camera == NULL) {
2715 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2716 return CAMERA_ERROR_INVALID_PARAMETER;
2719 int ret = CAMERA_ERROR_NONE;
2721 camera_cli_s *pc = (camera_cli_s *)camera;
2722 muse_camera_api_e api = MUSE_CAMERA_API_START_FOCUSING;
2724 if (pc->cb_info == NULL) {
2725 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2726 return CAMERA_ERROR_INVALID_PARAMETER;
2728 sock_fd = pc->cb_info->fd;
2729 int is_continuous = (int)continuous;
2731 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2732 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, is_continuous);
2733 LOGD("ret : 0x%x", ret);
2737 int camera_cancel_focusing(camera_h camera)
2739 if (camera == NULL) {
2740 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2741 return CAMERA_ERROR_INVALID_PARAMETER;
2744 int ret = CAMERA_ERROR_NONE;
2746 camera_cli_s *pc = (camera_cli_s *)camera;
2747 muse_camera_api_e api = MUSE_CAMERA_API_CANCEL_FOCUSING;
2749 if (pc->cb_info == NULL) {
2750 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2751 return CAMERA_ERROR_INVALID_PARAMETER;
2753 sock_fd = pc->cb_info->fd;
2755 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2756 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2757 LOGD("ret : 0x%x", ret);
2761 int camera_set_display(camera_h camera, camera_display_type_e type, camera_display_h display)
2763 int ret = CAMERA_ERROR_NONE;
2764 void *set_display_handle = NULL;
2765 Evas_Object *obj = NULL;
2766 const char *object_type = NULL;
2767 camera_wl_info_s *wl_info = NULL;
2768 camera_cli_s *pc = (camera_cli_s *)camera;
2769 camera_cb_info_s *cb_info = NULL;
2770 muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY;
2771 camera_state_e current_state = CAMERA_STATE_NONE;
2774 if (camera == NULL) {
2775 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2776 return CAMERA_ERROR_INVALID_PARAMETER;
2779 if (type < CAMERA_DISPLAY_TYPE_OVERLAY || type > CAMERA_DISPLAY_TYPE_NONE) {
2780 LOGE("invalid type %d", type);
2781 return CAMERA_ERROR_INVALID_PARAMETER;
2784 if (type != CAMERA_DISPLAY_TYPE_NONE && display == NULL) {
2785 LOGE("display type[%d] is not NONE, but display handle is NULL", type);
2786 return CAMERA_ERROR_INVALID_PARAMETER;
2789 if (pc->cb_info == NULL) {
2790 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2791 return CAMERA_ERROR_INVALID_PARAMETER;
2794 cb_info = (camera_cb_info_s *)pc->cb_info;
2795 sock_fd = cb_info->fd;
2797 ret = camera_get_state(camera, ¤t_state);
2798 if (ret != CAMERA_ERROR_NONE) {
2799 LOGE("failed to get current state 0x%x", ret);
2803 if (current_state != CAMERA_STATE_CREATED) {
2804 LOGE("INVALID_STATE : current %d", current_state);
2805 return CAMERA_ERROR_INVALID_STATE;
2808 LOGD("Enter, remote_handle : %x display : 0x%x", pc->remote_handle, display);
2810 if (type == CAMERA_DISPLAY_TYPE_NONE) {
2811 set_display_handle = 0;
2812 LOGD("display type NONE");
2814 obj = (Evas_Object *)display;
2815 object_type = evas_object_type_get(obj);
2817 if (type == CAMERA_DISPLAY_TYPE_OVERLAY && !strcmp(object_type, "elm_win")) {
2818 /* get wayland parent id */
2819 if (_get_wl_info(obj, &pc->wl_info) != CAMERA_ERROR_NONE) {
2820 LOGE("failed to get wayland info");
2821 return CAMERA_ERROR_INVALID_OPERATION;
2824 set_display_handle = (void *)&pc->wl_info;
2825 LOGD("display type OVERLAY : handle %p", set_display_handle);
2826 } else if (type == CAMERA_DISPLAY_TYPE_EVAS && !strcmp(object_type, "image")) {
2827 /* evas object surface */
2828 set_display_handle = (void *)display;
2829 LOGD("display type EVAS : handle %p", set_display_handle);
2831 #ifdef TIZEN_FEATURE_EVAS_RENDERER
2832 g_mutex_lock(&cb_info->evas_mutex);
2834 if (cb_info->evas_info) {
2835 LOGW("destroy existed evas renderer %p", cb_info->evas_info);
2836 ret = mm_evas_renderer_destroy(&cb_info->evas_info);
2837 if (ret != MM_ERROR_NONE) {
2838 LOGE("failed to destroy evas renderer %p", cb_info->evas_info);
2839 g_mutex_unlock(&cb_info->evas_mutex);
2840 return CAMERA_ERROR_INVALID_OPERATION;
2844 /* create evas renderer */
2845 ret = mm_evas_renderer_create(&cb_info->evas_info, (Evas_Object *)set_display_handle);
2846 if (ret == MM_ERROR_NONE) {
2847 camera_flip_e flip = CAMERA_FLIP_NONE;
2848 camera_display_mode_e mode = CAMERA_DISPLAY_MODE_LETTER_BOX;
2849 camera_rotation_e rotation = CAMERA_ROTATION_NONE;
2856 camera_get_display_flip(camera, &flip);
2857 camera_get_display_mode(camera, &mode);
2858 camera_get_display_rotation(camera, &rotation);
2859 camera_is_display_visible(camera, &visible);
2860 camera_attr_get_display_roi_area(camera, &x, &y, &width, &height);
2862 LOGD("current setting : flip %d, mode %d, rotation %d, visible %d, roi %d,%d,%dx%d",
2863 flip, mode, rotation, visible, x, y, width, height);
2865 ret = mm_evas_renderer_set_flip(cb_info->evas_info, flip);
2866 ret |= mm_evas_renderer_set_geometry(cb_info->evas_info, mode);
2867 ret |= mm_evas_renderer_set_rotation(cb_info->evas_info, rotation);
2868 ret |= mm_evas_renderer_set_visible(cb_info->evas_info, visible);
2870 if (mode == CAMERA_DISPLAY_MODE_CUSTOM_ROI)
2871 ret |= mm_evas_renderer_set_roi_area(cb_info->evas_info, x, y, width, height);
2874 g_mutex_unlock(&cb_info->evas_mutex);
2876 if (ret != MM_ERROR_NONE) {
2877 LOGE("mm_evas_renderer error 0x%x", ret);
2878 return CAMERA_ERROR_INVALID_OPERATION;
2880 #else /* TIZEN_FEATURE_EVAS_RENDERER */
2881 LOGE("EVAS surface is not supported");
2882 return CAMERA_ERROR_NOT_SUPPORTED;
2883 #endif /* TIZEN_FEATURE_EVAS_RENDERER */
2885 LOGE("unknown evas object [%p,%s] or type [%d] mismatch", obj, object_type, type);
2886 return CAMERA_ERROR_INVALID_PARAMETER;
2889 LOGE("failed to get evas object type from %p", obj);
2890 return CAMERA_ERROR_INVALID_PARAMETER;
2894 pc->display_handle = (intptr_t)set_display_handle;
2896 if (type == CAMERA_DISPLAY_TYPE_OVERLAY) {
2897 wl_info = &pc->wl_info;
2898 muse_camera_msg_send_array_and_value(api, sock_fd, cb_info, ret,
2899 wl_info, sizeof(camera_wl_info_s), sizeof(int), INT, type);
2901 LOGD("wayland parent id : %d, window %d,%d,%dx%d",
2902 wl_info->parent_id, wl_info->window_x, wl_info->window_y,
2903 wl_info->window_width, wl_info->window_height);
2905 muse_camera_msg_send1(api, sock_fd, cb_info, ret, INT, type);
2907 if (ret != CAMERA_ERROR_NONE)
2908 LOGE("set display error 0x%x", ret);
2909 else if (type == CAMERA_DISPLAY_TYPE_EVAS)
2910 SET_PREVIEW_CB_TYPE(cb_info, PREVIEW_CB_TYPE_EVAS);
2915 int camera_set_preview_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;
2921 int ret = CAMERA_ERROR_NONE;
2923 camera_cli_s *pc = (camera_cli_s *)camera;
2924 muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_RESOLUTION;
2926 if (pc->cb_info == NULL) {
2927 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2928 return CAMERA_ERROR_INVALID_PARAMETER;
2930 sock_fd = pc->cb_info->fd;
2932 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2933 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, width, INT, height);
2934 LOGD("ret : 0x%x", ret);
2939 int camera_set_capture_resolution(camera_h camera, int width, int height)
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;
2948 camera_cli_s *pc = (camera_cli_s *)camera;
2949 muse_camera_api_e api = MUSE_CAMERA_API_SET_CAPTURE_RESOLUTION;
2951 if (pc->cb_info == NULL) {
2952 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2953 return CAMERA_ERROR_INVALID_PARAMETER;
2955 sock_fd = pc->cb_info->fd;
2957 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2958 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, width, INT, height);
2959 LOGD("ret : 0x%x", ret);
2963 int camera_set_capture_format(camera_h camera, camera_pixel_format_e format)
2965 if (camera == NULL) {
2966 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2967 return CAMERA_ERROR_INVALID_PARAMETER;
2970 int ret = CAMERA_ERROR_NONE;
2971 int set_format = (int)format;
2973 camera_cli_s *pc = (camera_cli_s *)camera;
2974 muse_camera_api_e api = MUSE_CAMERA_API_SET_CAPTURE_FORMAT;
2976 if (pc->cb_info == NULL) {
2977 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2978 return CAMERA_ERROR_INVALID_PARAMETER;
2980 sock_fd = pc->cb_info->fd;
2982 LOGD("Enter, remote_handle : %x, capture_format: %d", pc->remote_handle, set_format);
2983 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_format);
2984 LOGD("ret : 0x%x", ret);
2988 int camera_set_preview_format(camera_h camera, camera_pixel_format_e format)
2990 if (camera == NULL) {
2991 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2992 return CAMERA_ERROR_INVALID_PARAMETER;
2995 int ret = CAMERA_ERROR_NONE;
2996 int set_format = (int)format;
2998 camera_cli_s *pc = (camera_cli_s *)camera;
2999 muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_FORMAT;
3001 if (pc->cb_info == NULL) {
3002 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3003 return CAMERA_ERROR_INVALID_PARAMETER;
3005 sock_fd = pc->cb_info->fd;
3007 LOGD("Enter, remote_handle : %x, capture_format: %d", pc->remote_handle, set_format);
3008 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_format);
3009 LOGD("ret : 0x%x", ret);
3013 int camera_get_preview_resolution(camera_h camera, int *width, int *height)
3015 if (camera == NULL || width == NULL || height == NULL) {
3016 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3017 return CAMERA_ERROR_INVALID_PARAMETER;
3021 int ret = CAMERA_ERROR_NONE;
3023 camera_cli_s *pc = (camera_cli_s *)camera;
3024 muse_camera_api_e api = MUSE_CAMERA_API_GET_PREVIEW_RESOLUTION;
3026 if (pc->cb_info == NULL) {
3027 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3028 return CAMERA_ERROR_INVALID_PARAMETER;
3030 sock_fd = pc->cb_info->fd;
3034 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3035 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3037 if (ret == CAMERA_ERROR_NONE) {
3038 muse_camera_msg_get(get_width, pc->cb_info->recv_msg);
3039 muse_camera_msg_get(get_height, pc->cb_info->recv_msg);
3041 *height = get_height;
3043 LOGD("ret : 0x%x", ret);
3047 int camera_set_display_rotation(camera_h camera, camera_rotation_e rotation)
3049 int ret = CAMERA_ERROR_NONE;
3050 int set_rotation = (int)rotation;
3051 camera_cli_s *pc = NULL;
3053 if (camera == NULL) {
3054 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3055 return CAMERA_ERROR_INVALID_PARAMETER;
3058 if (rotation < CAMERA_ROTATION_NONE || rotation > CAMERA_ROTATION_270) {
3059 LOGE("Invalid rotation %d", rotation);
3060 return CAMERA_ERROR_INVALID_PARAMETER;
3063 pc = (camera_cli_s *)camera;
3065 if (pc->cb_info == NULL) {
3066 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3067 return CAMERA_ERROR_INVALID_PARAMETER;
3070 #ifdef TIZEN_FEATURE_EVAS_RENDERER
3071 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
3072 g_mutex_lock(&pc->cb_info->evas_mutex);
3074 ret = mm_evas_renderer_set_rotation(pc->cb_info->evas_info, rotation);
3076 g_mutex_unlock(&pc->cb_info->evas_mutex);
3078 if (ret != MM_ERROR_NONE) {
3079 LOGE("failed to set rotation for evas surface 0x%x", ret);
3080 return CAMERA_ERROR_INVALID_OPERATION;
3083 #endif /* TIZEN_FEATURE_EVAS_RENDERER */
3085 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_ROTATION,
3086 pc->cb_info->fd, pc->cb_info, ret, INT, set_rotation);
3091 int camera_get_display_rotation(camera_h camera, camera_rotation_e *rotation)
3093 int ret = CAMERA_ERROR_NONE;
3094 int get_rotation = CAMERA_ROTATION_NONE;
3095 camera_cli_s *pc = NULL;
3097 if (camera == NULL || rotation == NULL) {
3098 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3099 return CAMERA_ERROR_INVALID_PARAMETER;
3102 pc = (camera_cli_s *)camera;
3104 if (pc->cb_info == NULL) {
3105 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3106 return CAMERA_ERROR_INVALID_PARAMETER;
3109 muse_camera_msg_send(MUSE_CAMERA_API_GET_DISPLAY_ROTATION,
3110 pc->cb_info->fd, pc->cb_info, ret);
3112 if (ret == CAMERA_ERROR_NONE) {
3113 muse_camera_msg_get(get_rotation, pc->cb_info->recv_msg);
3114 *rotation = (camera_rotation_e)get_rotation;
3120 int camera_set_display_flip(camera_h camera, camera_flip_e flip)
3122 int ret = CAMERA_ERROR_NONE;
3123 int set_flip = (int)flip;
3124 camera_cli_s *pc = NULL;
3126 if (camera == NULL) {
3127 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3128 return CAMERA_ERROR_INVALID_PARAMETER;
3131 if (flip < CAMERA_FLIP_NONE || flip > CAMERA_FLIP_BOTH) {
3132 LOGE("Invalid flip %d", flip);
3133 return CAMERA_ERROR_INVALID_PARAMETER;
3136 pc = (camera_cli_s *)camera;
3138 if (pc->cb_info == NULL) {
3139 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3140 return CAMERA_ERROR_INVALID_PARAMETER;
3143 #ifdef TIZEN_FEATURE_EVAS_RENDERER
3144 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
3145 g_mutex_lock(&pc->cb_info->evas_mutex);
3147 ret = mm_evas_renderer_set_flip(pc->cb_info->evas_info, flip);
3149 g_mutex_unlock(&pc->cb_info->evas_mutex);
3151 if (ret != MM_ERROR_NONE) {
3152 LOGE("failed to set flip for evas surface 0x%x", ret);
3153 return CAMERA_ERROR_INVALID_OPERATION;
3156 #endif /* TIZEN_FEATURE_EVAS_RENDERER */
3158 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_FLIP,
3159 pc->cb_info->fd, pc->cb_info, ret, INT, set_flip);
3164 int camera_get_display_flip(camera_h camera, camera_flip_e *flip)
3166 int ret = CAMERA_ERROR_NONE;
3167 int get_flip = CAMERA_FLIP_NONE;
3168 camera_cli_s *pc = NULL;
3170 if (camera == NULL || flip == NULL) {
3171 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3172 return CAMERA_ERROR_INVALID_PARAMETER;
3175 pc = (camera_cli_s *)camera;
3177 if (pc->cb_info == NULL) {
3178 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3179 return CAMERA_ERROR_INVALID_PARAMETER;
3182 muse_camera_msg_send(MUSE_CAMERA_API_GET_DISPLAY_FLIP,
3183 pc->cb_info->fd, pc->cb_info, ret);
3185 if (ret == CAMERA_ERROR_NONE) {
3186 muse_camera_msg_get(get_flip, pc->cb_info->recv_msg);
3187 *flip = (camera_flip_e)get_flip;
3193 int camera_set_display_visible(camera_h camera, bool visible)
3195 int ret = CAMERA_ERROR_NONE;
3196 int set_visible = (int)visible;
3197 camera_cli_s *pc = NULL;
3199 if (camera == NULL) {
3200 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3201 return CAMERA_ERROR_INVALID_PARAMETER;
3204 pc = (camera_cli_s *)camera;
3206 if (pc->cb_info == NULL) {
3207 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3208 return CAMERA_ERROR_INVALID_PARAMETER;
3211 #ifdef TIZEN_FEATURE_EVAS_RENDERER
3212 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
3213 g_mutex_lock(&pc->cb_info->evas_mutex);
3215 ret = mm_evas_renderer_set_visible(pc->cb_info->evas_info, visible);
3217 g_mutex_unlock(&pc->cb_info->evas_mutex);
3219 if (ret != MM_ERROR_NONE) {
3220 LOGE("failed to set visible for evas surface 0x%x", ret);
3221 return CAMERA_ERROR_INVALID_OPERATION;
3224 #endif /* TIZEN_FEATURE_EVAS_RENDERER */
3226 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_VISIBLE,
3227 pc->cb_info->fd, pc->cb_info, ret, INT, set_visible);
3232 int camera_is_display_visible(camera_h camera, bool *visible)
3234 int ret = CAMERA_ERROR_NONE;
3235 int get_visible = true;
3236 camera_cli_s *pc = NULL;
3238 if (camera == NULL || visible == NULL) {
3239 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3240 return CAMERA_ERROR_INVALID_PARAMETER;
3243 pc = (camera_cli_s *)camera;
3245 if (pc->cb_info == NULL) {
3246 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3247 return CAMERA_ERROR_INVALID_PARAMETER;
3250 muse_camera_msg_send(MUSE_CAMERA_API_IS_DISPLAY_VISIBLE,
3251 pc->cb_info->fd, pc->cb_info, ret);
3253 if (ret == CAMERA_ERROR_NONE) {
3254 muse_camera_msg_get(get_visible, pc->cb_info->recv_msg);
3255 *visible = (bool)get_visible;
3261 int camera_set_display_mode(camera_h camera, camera_display_mode_e mode)
3263 int ret = CAMERA_ERROR_NONE;
3264 int set_mode = (int)mode;
3265 camera_cli_s *pc = NULL;
3267 if (camera == NULL) {
3268 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3269 return CAMERA_ERROR_INVALID_PARAMETER;
3272 if (mode < CAMERA_DISPLAY_MODE_LETTER_BOX || mode > CAMERA_DISPLAY_MODE_CUSTOM_ROI) {
3273 LOGE("Invalid mode %d", mode);
3274 return CAMERA_ERROR_INVALID_PARAMETER;
3277 pc = (camera_cli_s *)camera;
3279 if (pc->cb_info == NULL) {
3280 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3281 return CAMERA_ERROR_INVALID_PARAMETER;
3284 #ifdef TIZEN_FEATURE_EVAS_RENDERER
3285 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
3286 g_mutex_lock(&pc->cb_info->evas_mutex);
3288 ret = mm_evas_renderer_set_geometry(pc->cb_info->evas_info, mode);
3290 g_mutex_unlock(&pc->cb_info->evas_mutex);
3292 if (ret != MM_ERROR_NONE) {
3293 LOGE("failed to set geometry for evas surface 0x%x", ret);
3294 return CAMERA_ERROR_INVALID_OPERATION;
3297 #endif /* TIZEN_FEATURE_EVAS_RENDERER */
3299 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_MODE,
3300 pc->cb_info->fd, pc->cb_info, ret, INT, set_mode);
3305 int camera_get_display_mode(camera_h camera, camera_display_mode_e *mode)
3307 int ret = CAMERA_ERROR_NONE;
3308 int get_mode = CAMERA_DISPLAY_MODE_LETTER_BOX;
3309 camera_cli_s *pc = NULL;
3311 if (camera == NULL || mode == NULL) {
3312 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3313 return CAMERA_ERROR_INVALID_PARAMETER;
3316 pc = (camera_cli_s *)camera;
3318 if (pc->cb_info == NULL) {
3319 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3320 return CAMERA_ERROR_INVALID_PARAMETER;
3323 muse_camera_msg_send(MUSE_CAMERA_API_GET_DISPLAY_MODE,
3324 pc->cb_info->fd, pc->cb_info, ret);
3326 if (ret == CAMERA_ERROR_NONE) {
3327 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
3328 *mode = (camera_display_mode_e)get_mode;
3335 int camera_set_display_reuse_hint(camera_h camera, bool hint)
3337 int ret = CAMERA_ERROR_NONE;
3338 int set_hint = (int)hint;
3339 camera_cli_s *pc = (camera_cli_s *)camera;
3341 if (camera == NULL) {
3342 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3343 return CAMERA_ERROR_INVALID_PARAMETER;
3346 if (pc->cb_info == NULL) {
3347 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3348 return CAMERA_ERROR_INVALID_PARAMETER;
3351 LOGD("set display reuse hint %d", set_hint);
3353 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_REUSE_HINT,
3354 pc->cb_info->fd, pc->cb_info, ret, INT, set_hint);
3360 int camera_get_display_reuse_hint(camera_h camera, bool *hint)
3362 int ret = CAMERA_ERROR_NONE;
3364 camera_cli_s *pc = (camera_cli_s *)camera;
3365 muse_camera_api_e api = MUSE_CAMERA_API_GET_DISPLAY_REUSE_HINT;
3367 if (camera == NULL || hint == NULL) {
3368 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3369 return CAMERA_ERROR_INVALID_PARAMETER;
3372 if (pc->cb_info == NULL) {
3373 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3374 return CAMERA_ERROR_INVALID_PARAMETER;
3377 muse_camera_msg_send(api, pc->cb_info->fd, pc->cb_info, ret);
3379 if (ret == CAMERA_ERROR_NONE) {
3380 muse_camera_msg_get(get_hint, pc->cb_info->recv_msg);
3381 *hint = (bool)get_hint;
3383 LOGD("display reuse hint %d", *hint);
3385 LOGE("failed 0x%x", ret);
3392 int camera_get_capture_resolution(camera_h camera, int *width, int *height)
3394 if (camera == NULL || width == NULL || height == NULL) {
3395 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3396 return CAMERA_ERROR_INVALID_PARAMETER;
3398 int ret = CAMERA_ERROR_NONE;
3400 camera_cli_s *pc = (camera_cli_s *)camera;
3401 muse_camera_api_e api = MUSE_CAMERA_API_GET_CAPTURE_RESOLUTION;
3403 if (pc->cb_info == NULL) {
3404 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3405 return CAMERA_ERROR_INVALID_PARAMETER;
3407 sock_fd = pc->cb_info->fd;
3411 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3412 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3414 if (ret == CAMERA_ERROR_NONE) {
3415 muse_camera_msg_get(get_width, pc->cb_info->recv_msg);
3416 muse_camera_msg_get(get_height, pc->cb_info->recv_msg);
3418 *height = get_height;
3420 LOGD("ret : 0x%x", ret);
3424 int camera_get_capture_format(camera_h camera, camera_pixel_format_e *format)
3426 if (camera == NULL || format == NULL) {
3427 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3428 return CAMERA_ERROR_INVALID_PARAMETER;
3430 int ret = CAMERA_ERROR_NONE;
3432 camera_cli_s *pc = (camera_cli_s *)camera;
3433 muse_camera_api_e api = MUSE_CAMERA_API_GET_CAPTURE_FORMAT;
3436 if (pc->cb_info == NULL) {
3437 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3438 return CAMERA_ERROR_INVALID_PARAMETER;
3440 sock_fd = pc->cb_info->fd;
3442 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3443 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3445 if (ret == CAMERA_ERROR_NONE) {
3446 muse_camera_msg_get(get_format, pc->cb_info->recv_msg);
3447 *format = (camera_pixel_format_e)get_format;
3449 LOGD("ret : 0x%x", ret);
3453 int camera_get_preview_format(camera_h camera, camera_pixel_format_e *format)
3455 if (camera == NULL || format == NULL) {
3456 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3457 return CAMERA_ERROR_INVALID_PARAMETER;
3460 int ret = CAMERA_ERROR_NONE;
3462 camera_cli_s *pc = (camera_cli_s *)camera;
3463 muse_camera_api_e api = MUSE_CAMERA_API_GET_PREVIEW_FORMAT;
3466 if (pc->cb_info == NULL) {
3467 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3468 return CAMERA_ERROR_INVALID_PARAMETER;
3470 sock_fd = pc->cb_info->fd;
3472 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3473 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3475 if (ret == CAMERA_ERROR_NONE) {
3476 muse_camera_msg_get(get_format, pc->cb_info->recv_msg);
3477 *format = (camera_pixel_format_e)get_format;
3479 LOGD("ret : 0x%x", ret);
3483 int camera_get_facing_direction(camera_h camera, camera_facing_direction_e *facing_direciton)
3485 if (camera == NULL || facing_direciton == NULL) {
3486 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3487 return CAMERA_ERROR_INVALID_PARAMETER;
3490 int ret = CAMERA_ERROR_NONE;
3492 camera_cli_s *pc = (camera_cli_s *)camera;
3493 muse_camera_api_e api = MUSE_CAMERA_API_GET_FACING_DIRECTION;
3495 if (pc->cb_info == NULL) {
3496 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3497 return CAMERA_ERROR_INVALID_PARAMETER;
3499 sock_fd = pc->cb_info->fd;
3500 int get_facing_direction;
3502 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3503 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3505 if (ret == CAMERA_ERROR_NONE) {
3506 muse_camera_msg_get(get_facing_direction, pc->cb_info->recv_msg);
3507 *facing_direciton = (camera_facing_direction_e)get_facing_direction;
3509 LOGD("ret : 0x%x", ret);
3513 int camera_set_preview_cb(camera_h camera, camera_preview_cb callback, void *user_data)
3515 if (camera == NULL || callback == NULL) {
3516 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3517 return CAMERA_ERROR_INVALID_PARAMETER;
3519 int ret = CAMERA_ERROR_NONE;
3521 camera_cli_s *pc = (camera_cli_s *)camera;
3522 camera_cb_info_s *cb_info = (camera_cb_info_s *)pc->cb_info;
3524 if (pc->cb_info == NULL) {
3525 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3526 return CAMERA_ERROR_INVALID_PARAMETER;
3528 sock_fd = pc->cb_info->fd;
3529 muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_CB;
3531 LOGD("Enter, handle :%x", pc->remote_handle);
3533 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = callback;
3534 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = user_data;
3535 SET_PREVIEW_CB_TYPE(cb_info, PREVIEW_CB_TYPE_USER);
3537 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3538 LOGD("ret : 0x%x", ret);
3542 int camera_unset_preview_cb(camera_h camera)
3544 if (camera == NULL) {
3545 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3546 return CAMERA_ERROR_INVALID_PARAMETER;
3549 int ret = CAMERA_ERROR_NONE;
3551 camera_cli_s *pc = (camera_cli_s *)camera;
3552 camera_cb_info_s *cb_info = (camera_cb_info_s *)pc->cb_info;
3553 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_PREVIEW_CB;
3555 LOGD("Enter, handle :%x", pc->remote_handle);
3558 if (pc->cb_info == NULL) {
3559 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3560 return CAMERA_ERROR_INVALID_PARAMETER;
3562 sock_fd = pc->cb_info->fd;
3563 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = (void *)NULL;
3564 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = (void *)NULL;
3565 UNSET_PREVIEW_CB_TYPE(cb_info, PREVIEW_CB_TYPE_USER);
3567 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3568 LOGD("ret : 0x%x", ret);
3572 int camera_set_media_packet_preview_cb(camera_h camera, camera_media_packet_preview_cb callback, void *user_data)
3574 if (camera == NULL) {
3575 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
3576 return CAMERA_ERROR_INVALID_PARAMETER;
3579 if (camera_is_supported_media_packet_preview_cb(camera) == false) {
3580 LOGE("NOT SUPPORTED");
3581 return CAMERA_ERROR_NOT_SUPPORTED;
3584 if (callback == NULL) {
3585 LOGE("INVALID_PARAMETER(0x%08x) - callback", CAMERA_ERROR_INVALID_PARAMETER);
3586 return CAMERA_ERROR_INVALID_PARAMETER;
3589 int ret = CAMERA_ERROR_NONE;
3591 camera_cli_s *pc = (camera_cli_s *)camera;
3592 muse_camera_api_e api = MUSE_CAMERA_API_SET_MEDIA_PACKET_PREVIEW_CB;
3594 LOGD("Enter, handle :%x", pc->remote_handle);
3597 if (pc->cb_info == NULL) {
3598 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3599 return CAMERA_ERROR_INVALID_PARAMETER;
3601 sock_fd = pc->cb_info->fd;
3602 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = callback;
3603 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = user_data;
3605 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3606 LOGD("ret : 0x%x", ret);
3610 int camera_unset_media_packet_preview_cb(camera_h camera)
3612 if (camera == NULL) {
3613 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3614 return CAMERA_ERROR_INVALID_PARAMETER;
3617 int ret = CAMERA_ERROR_NONE;
3619 camera_cli_s *pc = (camera_cli_s *)camera;
3620 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_MEDIA_PACKET_PREVIEW_CB;
3622 LOGD("Enter, handle :%x", pc->remote_handle);
3625 if (pc->cb_info == NULL) {
3626 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3627 return CAMERA_ERROR_INVALID_PARAMETER;
3629 sock_fd = pc->cb_info->fd;
3630 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = (void *)NULL;
3631 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = (void *)NULL;
3633 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3634 LOGD("ret : 0x%x", ret);
3638 int camera_set_state_changed_cb(camera_h camera, camera_state_changed_cb callback, void *user_data)
3640 if (camera == NULL || callback == NULL) {
3641 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3642 return CAMERA_ERROR_INVALID_PARAMETER;
3644 int ret = CAMERA_ERROR_NONE;
3646 camera_cli_s *pc = (camera_cli_s *)camera;
3647 muse_camera_api_e api = MUSE_CAMERA_API_SET_STATE_CHANGED_CB;
3649 LOGD("Enter, handle :%x", pc->remote_handle);
3652 if (pc->cb_info == NULL) {
3653 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3654 return CAMERA_ERROR_INVALID_PARAMETER;
3656 sock_fd = pc->cb_info->fd;
3657 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = callback;
3658 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = user_data;
3660 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3661 LOGD("ret : 0x%x", ret);
3664 int camera_unset_state_changed_cb(camera_h camera)
3666 if (camera == NULL) {
3667 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3668 return CAMERA_ERROR_INVALID_PARAMETER;
3670 int ret = CAMERA_ERROR_NONE;
3672 camera_cli_s *pc = (camera_cli_s *)camera;
3673 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_STATE_CHANGED_CB;
3675 LOGD("Enter, handle :%x", pc->remote_handle);
3678 if (pc->cb_info == NULL) {
3679 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3680 return CAMERA_ERROR_INVALID_PARAMETER;
3682 sock_fd = pc->cb_info->fd;
3683 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = (void *)NULL;
3684 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = (void *)NULL;
3686 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3687 LOGD("ret : 0x%x", ret);
3691 int camera_set_interrupted_cb(camera_h camera, camera_interrupted_cb callback, void *user_data)
3693 if (camera == NULL || callback == NULL) {
3694 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3695 return CAMERA_ERROR_INVALID_PARAMETER;
3697 int ret = CAMERA_ERROR_NONE;
3699 camera_cli_s *pc = (camera_cli_s *)camera;
3700 muse_camera_api_e api = MUSE_CAMERA_API_SET_INTERRUPTED_CB;
3702 LOGD("Enter, handle :%x", pc->remote_handle);
3705 if (pc->cb_info == NULL) {
3706 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3707 return CAMERA_ERROR_INVALID_PARAMETER;
3709 sock_fd = pc->cb_info->fd;
3710 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = callback;
3711 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = user_data;
3713 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3714 LOGD("ret : 0x%x", ret);
3718 int camera_unset_interrupted_cb(camera_h camera)
3720 if (camera == NULL) {
3721 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3722 return CAMERA_ERROR_INVALID_PARAMETER;
3724 int ret = CAMERA_ERROR_NONE;
3726 camera_cli_s *pc = (camera_cli_s *)camera;
3727 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_INTERRUPTED_CB;
3729 LOGD("Enter, handle :%x", pc->remote_handle);
3732 if (pc->cb_info == NULL) {
3733 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3734 return CAMERA_ERROR_INVALID_PARAMETER;
3736 sock_fd = pc->cb_info->fd;
3737 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = (void *)NULL;
3738 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = (void *)NULL;
3740 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3741 LOGD("ret : 0x%x", ret);
3745 int camera_set_focus_changed_cb(camera_h camera, camera_focus_changed_cb callback, void *user_data)
3747 if (camera == NULL || callback == NULL) {
3748 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3749 return CAMERA_ERROR_INVALID_PARAMETER;
3751 int ret = CAMERA_ERROR_NONE;
3753 camera_cli_s *pc = (camera_cli_s *)camera;
3754 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOCUS_CHANGED_CB;
3756 LOGD("Enter, handle :%x", pc->remote_handle);
3759 if (pc->cb_info == NULL) {
3760 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3761 return CAMERA_ERROR_INVALID_PARAMETER;
3763 sock_fd = pc->cb_info->fd;
3764 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = callback;
3765 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = user_data;
3767 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3768 LOGD("ret : 0x%x", ret);
3772 int camera_unset_focus_changed_cb(camera_h camera)
3774 if (camera == NULL) {
3775 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3776 return CAMERA_ERROR_INVALID_PARAMETER;
3778 int ret = CAMERA_ERROR_NONE;
3780 camera_cli_s *pc = (camera_cli_s *)camera;
3781 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_FOCUS_CHANGED_CB;
3783 LOGD("Enter, handle :%x", pc->remote_handle);
3786 if (pc->cb_info == NULL) {
3787 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3788 return CAMERA_ERROR_INVALID_PARAMETER;
3790 sock_fd = pc->cb_info->fd;
3791 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = (void *)NULL;
3792 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = (void *)NULL;
3794 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3795 LOGD("ret : 0x%x", ret);
3799 int camera_set_error_cb(camera_h camera, camera_error_cb callback, void *user_data)
3801 if (camera == NULL || callback == NULL) {
3802 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3803 return CAMERA_ERROR_INVALID_PARAMETER;
3805 int ret = CAMERA_ERROR_NONE;
3807 camera_cli_s *pc = (camera_cli_s *)camera;
3808 muse_camera_api_e api = MUSE_CAMERA_API_SET_ERROR_CB;
3810 LOGD("Enter, handle :%x", pc->remote_handle);
3813 if (pc->cb_info == NULL) {
3814 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3815 return CAMERA_ERROR_INVALID_PARAMETER;
3817 sock_fd = pc->cb_info->fd;
3818 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_ERROR] = callback;
3819 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_ERROR] = user_data;
3821 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3822 LOGD("ret : 0x%x", ret);
3826 int camera_unset_error_cb(camera_h camera)
3828 if (camera == NULL) {
3829 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3830 return CAMERA_ERROR_INVALID_PARAMETER;
3832 int ret = CAMERA_ERROR_NONE;
3834 camera_cli_s *pc = (camera_cli_s *)camera;
3835 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_ERROR_CB;
3837 LOGD("Enter, handle :%x", pc->remote_handle);
3840 if (pc->cb_info == NULL) {
3841 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3842 return CAMERA_ERROR_INVALID_PARAMETER;
3844 sock_fd = pc->cb_info->fd;
3845 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_ERROR] = (void *)NULL;
3846 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_ERROR] = (void *)NULL;
3848 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3849 LOGD("ret : 0x%x", ret);
3853 int camera_foreach_supported_preview_resolution(camera_h camera, camera_supported_preview_resolution_cb foreach_cb , void *user_data)
3855 if (camera == NULL || foreach_cb == NULL) {
3856 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3857 return CAMERA_ERROR_INVALID_PARAMETER;
3859 int ret = CAMERA_ERROR_NONE;
3861 camera_cli_s *pc = (camera_cli_s *)camera;
3862 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_PREVIEW_RESOLUTION;
3864 LOGD("Enter, handle :%x", pc->remote_handle);
3867 if (pc->cb_info == NULL) {
3868 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3869 return CAMERA_ERROR_INVALID_PARAMETER;
3871 sock_fd = pc->cb_info->fd;
3872 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_RESOLUTION] = foreach_cb;
3873 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_RESOLUTION] = user_data;
3875 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3876 LOGD("ret : 0x%x", ret);
3880 int camera_foreach_supported_capture_resolution(camera_h camera, camera_supported_capture_resolution_cb foreach_cb , void *user_data)
3882 if (camera == NULL || foreach_cb == NULL) {
3883 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3884 return CAMERA_ERROR_INVALID_PARAMETER;
3886 int ret = CAMERA_ERROR_NONE;
3888 camera_cli_s *pc = (camera_cli_s *)camera;
3889 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_CAPTURE_RESOLUTION;
3891 LOGD("Enter, handle :%x", pc->remote_handle);
3894 if (pc->cb_info == NULL) {
3895 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3896 return CAMERA_ERROR_INVALID_PARAMETER;
3898 sock_fd = pc->cb_info->fd;
3899 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_RESOLUTION] = foreach_cb;
3900 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_RESOLUTION] = user_data;
3902 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3903 LOGD("ret : 0x%x", ret);
3907 int camera_foreach_supported_capture_format(camera_h camera, camera_supported_capture_format_cb foreach_cb , void *user_data)
3909 if (camera == NULL || foreach_cb == NULL) {
3910 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3911 return CAMERA_ERROR_INVALID_PARAMETER;
3913 int ret = CAMERA_ERROR_NONE;
3915 camera_cli_s *pc = (camera_cli_s *)camera;
3916 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_CAPTURE_FORMAT;
3918 LOGD("Enter, handle :%x", pc->remote_handle);
3921 if (pc->cb_info == NULL) {
3922 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3923 return CAMERA_ERROR_INVALID_PARAMETER;
3925 sock_fd = pc->cb_info->fd;
3926 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_FORMAT] = foreach_cb;
3927 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_FORMAT] = user_data;
3929 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3930 LOGD("ret : 0x%x", ret);
3935 int camera_foreach_supported_preview_format(camera_h camera, camera_supported_preview_format_cb foreach_cb , void *user_data)
3937 if (camera == NULL || foreach_cb == NULL) {
3938 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3939 return CAMERA_ERROR_INVALID_PARAMETER;
3941 int ret = CAMERA_ERROR_NONE;
3943 camera_cli_s *pc = (camera_cli_s *)camera;
3944 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_PREVIEW_FORMAT;
3946 LOGD("Enter, handle :%x", pc->remote_handle);
3949 if (pc->cb_info == NULL) {
3950 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3951 return CAMERA_ERROR_INVALID_PARAMETER;
3953 sock_fd = pc->cb_info->fd;
3954 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_FORMAT] = foreach_cb;
3955 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_FORMAT] = user_data;
3957 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3958 LOGD("ret : 0x%x", ret);
3963 int camera_get_recommended_preview_resolution(camera_h camera, int *width, int *height)
3965 if (camera == NULL || width == NULL || height == NULL) {
3966 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3967 return CAMERA_ERROR_INVALID_PARAMETER;
3969 int ret = CAMERA_ERROR_NONE;
3971 camera_cli_s *pc = (camera_cli_s *)camera;
3972 muse_camera_api_e api = MUSE_CAMERA_API_GET_RECOMMENDED_PREVIEW_RESOLUTION;
3974 if (pc->cb_info == NULL) {
3975 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3976 return CAMERA_ERROR_INVALID_PARAMETER;
3978 sock_fd = pc->cb_info->fd;
3982 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3983 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3985 if (ret == CAMERA_ERROR_NONE) {
3986 muse_camera_msg_get(get_width, pc->cb_info->recv_msg);
3987 muse_camera_msg_get(get_height, pc->cb_info->recv_msg);
3989 *height = get_height;
3991 LOGD("ret : 0x%x", ret);
3996 int camera_attr_get_lens_orientation(camera_h camera, int *angle)
3998 if (camera == NULL || angle == NULL) {
3999 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4000 return CAMERA_ERROR_INVALID_PARAMETER;
4002 int ret = CAMERA_ERROR_NONE;
4004 camera_cli_s *pc = (camera_cli_s *)camera;
4005 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_LENS_ORIENTATION;
4007 if (pc->cb_info == NULL) {
4008 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4009 return CAMERA_ERROR_INVALID_PARAMETER;
4011 sock_fd = pc->cb_info->fd;
4014 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4015 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4017 if (ret == CAMERA_ERROR_NONE) {
4018 muse_camera_msg_get(get_angle, pc->cb_info->recv_msg);
4021 LOGD("ret : 0x%x", ret);
4025 int camera_attr_set_theater_mode(camera_h camera, camera_attr_theater_mode_e mode)
4027 if (camera == NULL) {
4028 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4029 return CAMERA_ERROR_INVALID_PARAMETER;
4031 int ret = CAMERA_ERROR_NONE;
4032 camera_cli_s *pc = (camera_cli_s *)camera;
4033 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_THEATER_MODE;
4035 if (pc->cb_info == NULL) {
4036 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4037 return CAMERA_ERROR_INVALID_PARAMETER;
4039 sock_fd = pc->cb_info->fd;
4040 int set_mode = (int)mode;
4041 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4042 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
4043 LOGD("ret : 0x%x", ret);
4047 int camera_attr_get_theater_mode(camera_h camera, camera_attr_theater_mode_e *mode)
4049 if (camera == NULL || mode == NULL) {
4050 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4051 return CAMERA_ERROR_INVALID_PARAMETER;
4054 int ret = CAMERA_ERROR_NONE;
4055 camera_cli_s *pc = (camera_cli_s *)camera;
4056 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_THEATER_MODE;
4058 if (pc->cb_info == NULL) {
4059 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4060 return CAMERA_ERROR_INVALID_PARAMETER;
4062 sock_fd = pc->cb_info->fd;
4064 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4065 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4067 if (ret == CAMERA_ERROR_NONE) {
4068 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
4069 *mode = (camera_attr_theater_mode_e)get_mode;
4071 LOGD("ret : 0x%x", ret);
4075 int camera_attr_foreach_supported_theater_mode(camera_h camera, camera_attr_supported_theater_mode_cb foreach_cb, void *user_data)
4077 if (camera == NULL || foreach_cb == NULL) {
4078 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4079 return CAMERA_ERROR_INVALID_PARAMETER;
4081 int ret = CAMERA_ERROR_NONE;
4083 camera_cli_s *pc = (camera_cli_s *)camera;
4084 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_THEATER_MODE;
4086 LOGD("Enter, handle :%x", pc->remote_handle);
4089 if (pc->cb_info == NULL) {
4090 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4091 return CAMERA_ERROR_INVALID_PARAMETER;
4093 sock_fd = pc->cb_info->fd;
4094 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE] = foreach_cb;
4095 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE] = user_data;
4097 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4099 LOGD("Finish, return :%x", ret);
4104 int camera_attr_set_preview_fps(camera_h camera, camera_attr_fps_e fps)
4106 if (camera == NULL) {
4107 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4108 return CAMERA_ERROR_INVALID_PARAMETER;
4110 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_PREVIEW_FPS;
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 int set_fps = (int)fps;
4120 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4121 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_fps);
4122 LOGD("ret : 0x%x", ret);
4127 int camera_attr_set_image_quality(camera_h camera, int quality)
4129 if (camera == NULL) {
4130 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4131 return CAMERA_ERROR_INVALID_PARAMETER;
4133 int ret = CAMERA_ERROR_NONE;
4135 camera_cli_s *pc = (camera_cli_s *)camera;
4136 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_IMAGE_QUALITY;
4138 if (pc->cb_info == NULL) {
4139 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4140 return CAMERA_ERROR_INVALID_PARAMETER;
4142 sock_fd = pc->cb_info->fd;
4143 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4144 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, quality);
4145 LOGD("ret : 0x%x", ret);
4149 int camera_attr_get_preview_fps(camera_h camera, camera_attr_fps_e *fps)
4151 if (camera == NULL || fps == NULL) {
4152 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4153 return CAMERA_ERROR_INVALID_PARAMETER;
4155 int ret = CAMERA_ERROR_NONE;
4157 camera_cli_s *pc = (camera_cli_s *)camera;
4158 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_PREVIEW_FPS;
4161 if (pc->cb_info == NULL) {
4162 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4163 return CAMERA_ERROR_INVALID_PARAMETER;
4165 sock_fd = pc->cb_info->fd;
4167 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4168 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4170 if (ret == CAMERA_ERROR_NONE) {
4171 muse_camera_msg_get(get_fps, pc->cb_info->recv_msg);
4172 *fps = (camera_attr_fps_e)get_fps;
4174 LOGD("ret : 0x%x", ret);
4179 int camera_attr_get_image_quality(camera_h camera, int *quality)
4181 if (camera == NULL || quality == NULL) {
4182 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4183 return CAMERA_ERROR_INVALID_PARAMETER;
4185 int ret = CAMERA_ERROR_NONE;
4187 camera_cli_s *pc = (camera_cli_s *)camera;
4188 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_IMAGE_QUALITY;
4190 if (pc->cb_info == NULL) {
4191 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4192 return CAMERA_ERROR_INVALID_PARAMETER;
4194 sock_fd = pc->cb_info->fd;
4196 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4197 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4199 if (ret == CAMERA_ERROR_NONE) {
4200 muse_camera_msg_get(get_quality, pc->cb_info->recv_msg);
4201 *quality = get_quality;
4203 LOGD("ret : 0x%x", ret);
4208 int camera_attr_get_encoded_preview_bitrate(camera_h camera, int *bitrate)
4210 if (camera == NULL || bitrate == NULL) {
4211 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4212 return CAMERA_ERROR_INVALID_PARAMETER;
4215 int ret = CAMERA_ERROR_NONE;
4217 camera_cli_s *pc = (camera_cli_s *)camera;
4218 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ENCODED_PREVIEW_BITRATE;
4220 if (pc->cb_info == NULL) {
4221 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4222 return CAMERA_ERROR_INVALID_PARAMETER;
4224 sock_fd = pc->cb_info->fd;
4227 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4228 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4230 if (ret == CAMERA_ERROR_NONE) {
4231 muse_camera_msg_get(get_bitrate, pc->cb_info->recv_msg);
4232 *bitrate = get_bitrate;
4234 LOGD("ret : 0x%x", ret);
4239 int camera_attr_set_encoded_preview_bitrate(camera_h camera, int bitrate)
4241 if (camera == NULL) {
4242 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4243 return CAMERA_ERROR_INVALID_PARAMETER;
4246 int ret = CAMERA_ERROR_NONE;
4248 camera_cli_s *pc = (camera_cli_s *)camera;
4249 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ENCODED_PREVIEW_BITRATE;
4251 if (pc->cb_info == NULL) {
4252 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4253 return CAMERA_ERROR_INVALID_PARAMETER;
4255 sock_fd = pc->cb_info->fd;
4256 int set_bitrate = bitrate;
4257 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4258 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_bitrate);
4259 LOGD("ret : 0x%x", ret);
4264 int camera_attr_get_encoded_preview_gop_interval(camera_h camera, int *interval)
4266 if (camera == NULL || interval == NULL) {
4267 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4268 return CAMERA_ERROR_INVALID_PARAMETER;
4271 int ret = CAMERA_ERROR_NONE;
4273 camera_cli_s *pc = (camera_cli_s *)camera;
4274 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ENCODED_PREVIEW_GOP_INTERVAL;
4276 if (pc->cb_info == NULL) {
4277 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4278 return CAMERA_ERROR_INVALID_PARAMETER;
4280 sock_fd = pc->cb_info->fd;
4281 int get_gop_interval;
4283 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4284 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4286 if (ret == CAMERA_ERROR_NONE) {
4287 muse_camera_msg_get(get_gop_interval, pc->cb_info->recv_msg);
4288 *interval = get_gop_interval;
4290 LOGD("ret : 0x%x", ret);
4295 int camera_attr_set_encoded_preview_gop_interval(camera_h camera, int interval)
4297 if (camera == NULL) {
4298 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4299 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_ENCODED_PREVIEW_GOP_INTERVAL;
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;
4312 int set_gop_interval = interval;
4313 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4314 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_gop_interval);
4315 LOGD("ret : 0x%x", ret);
4320 int camera_attr_set_zoom(camera_h camera, int zoom)
4322 if (camera == NULL) {
4323 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4324 return CAMERA_ERROR_INVALID_PARAMETER;
4326 int ret = CAMERA_ERROR_NONE;
4328 camera_cli_s *pc = (camera_cli_s *)camera;
4329 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ZOOM;
4331 if (pc->cb_info == NULL) {
4332 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4333 return CAMERA_ERROR_INVALID_PARAMETER;
4335 sock_fd = pc->cb_info->fd;
4337 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4338 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, zoom);
4339 LOGD("ret : 0x%x", ret);
4343 int camera_attr_set_af_mode(camera_h camera, camera_attr_af_mode_e mode)
4345 if (camera == NULL) {
4346 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4347 return CAMERA_ERROR_INVALID_PARAMETER;
4349 int ret = CAMERA_ERROR_NONE;
4351 camera_cli_s *pc = (camera_cli_s *)camera;
4352 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_AF_MODE;
4354 if (pc->cb_info == NULL) {
4355 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4356 return CAMERA_ERROR_INVALID_PARAMETER;
4358 sock_fd = pc->cb_info->fd;
4359 int set_mode = (int)mode;
4360 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4361 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
4362 LOGD("ret : 0x%x", ret);
4366 int camera_attr_set_af_area(camera_h camera, int x, int y)
4368 if (camera == NULL) {
4369 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4370 return CAMERA_ERROR_INVALID_PARAMETER;
4372 int ret = CAMERA_ERROR_NONE;
4373 camera_cli_s *pc = (camera_cli_s *)camera;
4374 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_AF_AREA;
4375 int sock_fd = pc->cb_info->fd;
4376 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4377 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, x, INT, y);
4378 LOGD("ret : 0x%x", ret);
4383 int camera_attr_clear_af_area(camera_h camera)
4385 if (camera == NULL) {
4386 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4387 return CAMERA_ERROR_INVALID_PARAMETER;
4389 int ret = CAMERA_ERROR_NONE;
4391 camera_cli_s *pc = (camera_cli_s *)camera;
4392 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_CLEAR_AF_AREA;
4394 if (pc->cb_info == NULL) {
4395 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4396 return CAMERA_ERROR_INVALID_PARAMETER;
4398 sock_fd = pc->cb_info->fd;
4399 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4400 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4401 LOGD("ret : 0x%x", ret);
4406 int camera_attr_set_exposure_mode(camera_h camera, camera_attr_exposure_mode_e mode)
4408 if (camera == NULL) {
4409 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4410 return CAMERA_ERROR_INVALID_PARAMETER;
4413 if (mode < CAMERA_ATTR_EXPOSURE_MODE_OFF || mode > CAMERA_ATTR_EXPOSURE_MODE_CUSTOM) {
4414 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4415 return CAMERA_ERROR_INVALID_PARAMETER;
4418 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_MODE;
4421 int set_mode = (int)mode;
4423 if (pc->cb_info == NULL) {
4424 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4425 return CAMERA_ERROR_INVALID_PARAMETER;
4427 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, set_mode);
4430 LOGD("ret : 0x%x", ret);
4435 int camera_attr_set_exposure(camera_h camera, int value)
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_EXPOSURE;
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;
4452 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4453 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, value);
4454 LOGD("ret : 0x%x", ret);
4459 int camera_attr_set_iso(camera_h camera, camera_attr_iso_e iso)
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_ISO;
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;
4475 int set_iso = (int)iso;
4476 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4477 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_iso);
4478 LOGD("ret : 0x%x", ret);
4483 int camera_attr_set_brightness(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_BRIGHTNESS;
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_contrast(camera_h camera, int level)
4509 if (camera == NULL) {
4510 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4511 return CAMERA_ERROR_INVALID_PARAMETER;
4513 int ret = CAMERA_ERROR_NONE;
4515 camera_cli_s *pc = (camera_cli_s *)camera;
4516 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_CONTRAST;
4518 if (pc->cb_info == NULL) {
4519 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4520 return CAMERA_ERROR_INVALID_PARAMETER;
4522 sock_fd = pc->cb_info->fd;
4524 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4525 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, level);
4526 LOGD("ret : 0x%x", ret);
4531 int camera_attr_set_whitebalance(camera_h camera, camera_attr_whitebalance_e wb)
4533 if (camera == NULL) {
4534 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4535 return CAMERA_ERROR_INVALID_PARAMETER;
4538 if (wb < CAMERA_ATTR_WHITE_BALANCE_NONE || wb > CAMERA_ATTR_WHITE_BALANCE_CUSTOM) {
4539 LOGE("invalid white balance %d", wb);
4540 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_WHITEBALANCE;
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_whitebalance = (int)wb;
4554 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4555 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_whitebalance);
4556 LOGD("ret : 0x%x", ret);
4561 int camera_attr_set_effect(camera_h camera, camera_attr_effect_mode_e effect)
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_EFFECT;
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_effect = (int)effect;
4578 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4579 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_effect);
4580 LOGD("ret : 0x%x", ret);
4585 int camera_attr_set_scene_mode(camera_h camera, camera_attr_scene_mode_e mode)
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;
4593 camera_cli_s *pc = (camera_cli_s *)camera;
4594 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_SCENE_MODE;
4596 if (pc->cb_info == NULL) {
4597 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4598 return CAMERA_ERROR_INVALID_PARAMETER;
4600 sock_fd = pc->cb_info->fd;
4601 int set_mode = (int)mode;
4602 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4603 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
4604 LOGD("ret : 0x%x", ret);
4609 int camera_attr_enable_tag(camera_h camera, bool enable)
4611 if (camera == NULL) {
4612 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4613 return CAMERA_ERROR_INVALID_PARAMETER;
4615 int ret = CAMERA_ERROR_NONE;
4616 camera_cli_s *pc = (camera_cli_s *)camera;
4617 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_TAG;
4619 if (pc->cb_info == NULL) {
4620 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4621 return CAMERA_ERROR_INVALID_PARAMETER;
4623 sock_fd = pc->cb_info->fd;
4624 int set_enable = (int)enable;
4626 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4627 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
4628 LOGD("ret : 0x%x", ret);
4633 int camera_attr_set_tag_image_description(camera_h camera, const char *description)
4635 if (camera == NULL) {
4636 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4637 return CAMERA_ERROR_INVALID_PARAMETER;
4639 if (description == NULL) {
4640 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4641 return CAMERA_ERROR_INVALID_PARAMETER;
4643 int ret = CAMERA_ERROR_NONE;
4644 camera_cli_s *pc = (camera_cli_s *)camera;
4645 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_IMAGE_DESCRIPTION;
4647 if (pc->cb_info == NULL) {
4648 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4649 return CAMERA_ERROR_INVALID_PARAMETER;
4651 sock_fd = pc->cb_info->fd;
4652 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4653 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, STRING, description);
4654 LOGD("ret : 0x%x", ret);
4659 int camera_attr_set_tag_orientation(camera_h camera, camera_attr_tag_orientation_e orientation)
4661 if (camera == NULL) {
4662 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4663 return CAMERA_ERROR_INVALID_PARAMETER;
4665 int ret = CAMERA_ERROR_NONE;
4666 camera_cli_s *pc = (camera_cli_s *)camera;
4667 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_ORIENTATION;
4669 if (pc->cb_info == NULL) {
4670 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4671 return CAMERA_ERROR_INVALID_PARAMETER;
4673 sock_fd = pc->cb_info->fd;
4674 int set_orientation = (int)orientation;
4676 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4677 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_orientation);
4678 LOGD("ret : 0x%x", ret);
4683 int camera_attr_set_tag_software(camera_h camera, const char *software)
4685 if (camera == NULL) {
4686 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4687 return CAMERA_ERROR_INVALID_PARAMETER;
4689 if (software == NULL) {
4690 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4691 return CAMERA_ERROR_INVALID_PARAMETER;
4693 int ret = CAMERA_ERROR_NONE;
4694 camera_cli_s *pc = (camera_cli_s *)camera;
4695 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_SOFTWARE;
4697 if (pc->cb_info == NULL) {
4698 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4699 return CAMERA_ERROR_INVALID_PARAMETER;
4701 sock_fd = pc->cb_info->fd;
4702 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4703 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, STRING, software);
4704 LOGD("ret : 0x%x", ret);
4709 int camera_attr_set_geotag(camera_h camera, double latitude , double longitude, double altitude)
4711 if (camera == NULL) {
4712 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4713 return CAMERA_ERROR_INVALID_PARAMETER;
4715 int ret = CAMERA_ERROR_NONE;
4716 camera_cli_s *pc = (camera_cli_s *)camera;
4717 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_GEOTAG;
4719 if (pc->cb_info == NULL) {
4720 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4721 return CAMERA_ERROR_INVALID_PARAMETER;
4723 sock_fd = pc->cb_info->fd;
4724 double set_geotag[3] = { latitude, longitude, altitude };
4726 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4727 muse_camera_msg_send_array(api, sock_fd, pc->cb_info, ret,
4728 set_geotag, sizeof(set_geotag), sizeof(double));
4729 LOGD("ret : 0x%x", ret);
4734 int camera_attr_remove_geotag(camera_h camera)
4736 if (camera == NULL) {
4737 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4738 return CAMERA_ERROR_INVALID_PARAMETER;
4740 int ret = CAMERA_ERROR_NONE;
4741 camera_cli_s *pc = (camera_cli_s *)camera;
4742 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_REMOVE_GEOTAG;
4744 if (pc->cb_info == NULL) {
4745 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4746 return CAMERA_ERROR_INVALID_PARAMETER;
4748 sock_fd = pc->cb_info->fd;
4749 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4750 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4751 LOGD("ret : 0x%x", ret);
4756 int camera_attr_set_flash_mode(camera_h camera, camera_attr_flash_mode_e mode)
4758 if (camera == NULL) {
4759 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4760 return CAMERA_ERROR_INVALID_PARAMETER;
4762 int ret = CAMERA_ERROR_NONE;
4763 camera_cli_s *pc = (camera_cli_s *)camera;
4764 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_FLASH_MODE;
4766 if (pc->cb_info == NULL) {
4767 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4768 return CAMERA_ERROR_INVALID_PARAMETER;
4770 sock_fd = pc->cb_info->fd;
4771 int set_mode = (int)mode;
4773 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4774 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
4775 LOGD("ret : 0x%x", ret);
4780 int camera_attr_get_zoom(camera_h camera, int *zoom)
4782 if (camera == NULL || zoom == NULL) {
4783 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4784 return CAMERA_ERROR_INVALID_PARAMETER;
4786 int ret = CAMERA_ERROR_NONE;
4788 camera_cli_s *pc = (camera_cli_s *)camera;
4789 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ZOOM;
4792 if (pc->cb_info == NULL) {
4793 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4794 return CAMERA_ERROR_INVALID_PARAMETER;
4796 sock_fd = pc->cb_info->fd;
4798 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4799 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4801 if (ret == CAMERA_ERROR_NONE) {
4802 muse_camera_msg_get(get_zoom, pc->cb_info->recv_msg);
4805 LOGD("ret : 0x%x", ret);
4810 int camera_attr_get_zoom_range(camera_h camera, int *min, int *max)
4812 if (camera == NULL || min == NULL || max == NULL) {
4813 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4814 return CAMERA_ERROR_INVALID_PARAMETER;
4816 int ret = CAMERA_ERROR_NONE;
4817 camera_cli_s *pc = (camera_cli_s *)camera;
4819 if (pc->cb_info == NULL) {
4820 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4821 return CAMERA_ERROR_INVALID_PARAMETER;
4823 sock_fd = pc->cb_info->fd;
4824 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ZOOM_RANGE;
4828 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4829 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4831 if (ret == CAMERA_ERROR_NONE) {
4832 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
4833 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
4837 LOGD("ret : 0x%x", ret);
4842 int camera_attr_get_af_mode(camera_h camera, camera_attr_af_mode_e *mode)
4844 if (camera == NULL || mode == NULL) {
4845 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4846 return CAMERA_ERROR_INVALID_PARAMETER;
4848 int ret = CAMERA_ERROR_NONE;
4849 camera_cli_s *pc = (camera_cli_s *)camera;
4851 if (pc->cb_info == NULL) {
4852 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4853 return CAMERA_ERROR_INVALID_PARAMETER;
4855 sock_fd = pc->cb_info->fd;
4856 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_AF_MODE;
4859 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4860 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4862 if (ret == CAMERA_ERROR_NONE) {
4863 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
4864 *mode = (camera_attr_af_mode_e)get_mode;
4866 LOGD("ret : 0x%x", ret);
4871 int camera_attr_get_exposure_mode(camera_h camera, camera_attr_exposure_mode_e *mode)
4873 if (camera == NULL || mode == NULL) {
4874 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4875 return CAMERA_ERROR_INVALID_PARAMETER;
4877 int ret = CAMERA_ERROR_NONE;
4878 camera_cli_s *pc = (camera_cli_s *)camera;
4880 if (pc->cb_info == NULL) {
4881 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4882 return CAMERA_ERROR_INVALID_PARAMETER;
4884 sock_fd = pc->cb_info->fd;
4885 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE_MODE;
4888 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4889 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4891 if (ret == CAMERA_ERROR_NONE) {
4892 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
4893 *mode = (camera_attr_exposure_mode_e)get_mode;
4895 LOGD("ret : 0x%x", ret);
4899 int camera_attr_get_exposure(camera_h camera, int *value)
4901 if (camera == NULL || value == NULL) {
4902 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4903 return CAMERA_ERROR_INVALID_PARAMETER;
4905 int ret = CAMERA_ERROR_NONE;
4906 camera_cli_s *pc = (camera_cli_s *)camera;
4908 if (pc->cb_info == NULL) {
4909 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4910 return CAMERA_ERROR_INVALID_PARAMETER;
4912 sock_fd = pc->cb_info->fd;
4913 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE;
4916 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4917 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4919 if (ret == CAMERA_ERROR_NONE) {
4920 muse_camera_msg_get(get_value, pc->cb_info->recv_msg);
4923 LOGD("ret : 0x%x", ret);
4928 int camera_attr_get_exposure_range(camera_h camera, int *min, int *max)
4930 if (camera == NULL || min == NULL || max == NULL) {
4931 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4932 return CAMERA_ERROR_INVALID_PARAMETER;
4934 int ret = CAMERA_ERROR_NONE;
4935 camera_cli_s *pc = (camera_cli_s *)camera;
4937 if (pc->cb_info == NULL) {
4938 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4939 return CAMERA_ERROR_INVALID_PARAMETER;
4941 sock_fd = pc->cb_info->fd;
4942 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE_RANGE;
4946 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4947 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4949 if (ret == CAMERA_ERROR_NONE) {
4950 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
4951 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
4955 LOGD("ret : 0x%x", ret);
4960 int camera_attr_get_iso(camera_h camera, camera_attr_iso_e *iso)
4962 if (camera == NULL || iso == NULL) {
4963 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4964 return CAMERA_ERROR_INVALID_PARAMETER;
4966 int ret = CAMERA_ERROR_NONE;
4967 camera_cli_s *pc = (camera_cli_s *)camera;
4969 if (pc->cb_info == NULL) {
4970 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4971 return CAMERA_ERROR_INVALID_PARAMETER;
4973 sock_fd = pc->cb_info->fd;
4974 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ISO;
4977 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4978 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4980 if (ret == CAMERA_ERROR_NONE) {
4981 muse_camera_msg_get(get_iso, pc->cb_info->recv_msg);
4982 *iso = (camera_attr_iso_e)get_iso;
4984 LOGD("ret : 0x%x", ret);
4989 int camera_attr_get_brightness(camera_h camera, int *level)
4991 if (camera == NULL || level == NULL) {
4992 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4993 return CAMERA_ERROR_INVALID_PARAMETER;
4995 int ret = CAMERA_ERROR_NONE;
4996 camera_cli_s *pc = (camera_cli_s *)camera;
4998 if (pc->cb_info == NULL) {
4999 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5000 return CAMERA_ERROR_INVALID_PARAMETER;
5002 sock_fd = pc->cb_info->fd;
5003 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_BRIGHTNESS;
5006 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5007 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5009 if (ret == CAMERA_ERROR_NONE) {
5010 muse_camera_msg_get(get_level, pc->cb_info->recv_msg);
5013 LOGD("ret : 0x%x", ret);
5018 int camera_attr_get_brightness_range(camera_h camera, int *min, int *max)
5020 if (camera == NULL || min == NULL || max == NULL) {
5021 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5022 return CAMERA_ERROR_INVALID_PARAMETER;
5024 int ret = CAMERA_ERROR_NONE;
5025 camera_cli_s *pc = (camera_cli_s *)camera;
5027 if (pc->cb_info == NULL) {
5028 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5029 return CAMERA_ERROR_INVALID_PARAMETER;
5031 sock_fd = pc->cb_info->fd;
5032 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_BRIGHTNESS_RANGE;
5036 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5037 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5039 if (ret == CAMERA_ERROR_NONE) {
5040 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
5041 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
5045 LOGD("ret : 0x%x", ret);
5050 int camera_attr_get_contrast(camera_h camera, int *level)
5052 if (camera == NULL || level == NULL) {
5053 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5054 return CAMERA_ERROR_INVALID_PARAMETER;
5056 int ret = CAMERA_ERROR_NONE;
5057 camera_cli_s *pc = (camera_cli_s *)camera;
5058 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_CONTRAST;
5060 if (pc->cb_info == NULL) {
5061 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5062 return CAMERA_ERROR_INVALID_PARAMETER;
5064 sock_fd = pc->cb_info->fd;
5067 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5068 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5070 if (ret == CAMERA_ERROR_NONE) {
5071 muse_camera_msg_get(get_level, pc->cb_info->recv_msg);
5074 LOGD("ret : 0x%x", ret);
5079 int camera_attr_get_contrast_range(camera_h camera, int *min , int *max)
5081 if (camera == NULL || min == NULL || max == NULL) {
5082 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5083 return CAMERA_ERROR_INVALID_PARAMETER;
5085 int ret = CAMERA_ERROR_NONE;
5086 camera_cli_s *pc = (camera_cli_s *)camera;
5087 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_CONTRAST_RANGE;
5089 if (pc->cb_info == NULL) {
5090 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5091 return CAMERA_ERROR_INVALID_PARAMETER;
5093 sock_fd = pc->cb_info->fd;
5097 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5098 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5100 if (ret == CAMERA_ERROR_NONE) {
5101 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
5102 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
5106 LOGD("ret : 0x%x", ret);
5111 int camera_attr_get_whitebalance(camera_h camera, camera_attr_whitebalance_e *wb)
5113 if (camera == NULL || wb == NULL) {
5114 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5115 return CAMERA_ERROR_INVALID_PARAMETER;
5117 int ret = CAMERA_ERROR_NONE;
5118 camera_cli_s *pc = (camera_cli_s *)camera;
5119 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_WHITEBALANCE;
5121 if (pc->cb_info == NULL) {
5122 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5123 return CAMERA_ERROR_INVALID_PARAMETER;
5125 sock_fd = pc->cb_info->fd;
5128 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5129 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5131 if (ret == CAMERA_ERROR_NONE) {
5132 muse_camera_msg_get(get_wb, pc->cb_info->recv_msg);
5133 *wb = (camera_attr_whitebalance_e)get_wb;
5135 LOGD("ret : 0x%x", ret);
5140 int camera_attr_get_effect(camera_h camera, camera_attr_effect_mode_e *effect)
5142 if (camera == NULL || effect == NULL) {
5143 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5144 return CAMERA_ERROR_INVALID_PARAMETER;
5147 int ret = CAMERA_ERROR_NONE;
5148 camera_cli_s *pc = (camera_cli_s *)camera;
5149 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EFFECT;
5151 if (pc->cb_info == NULL) {
5152 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5153 return CAMERA_ERROR_INVALID_PARAMETER;
5155 sock_fd = pc->cb_info->fd;
5158 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5159 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5161 if (ret == CAMERA_ERROR_NONE) {
5162 muse_camera_msg_get(get_effect, pc->cb_info->recv_msg);
5163 *effect = (camera_attr_effect_mode_e)get_effect;
5165 LOGD("ret : 0x%x", ret);
5170 int camera_attr_get_scene_mode(camera_h camera, camera_attr_scene_mode_e *mode)
5172 if (camera == NULL || mode == NULL) {
5173 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5174 return CAMERA_ERROR_INVALID_PARAMETER;
5177 int ret = CAMERA_ERROR_NONE;
5178 camera_cli_s *pc = (camera_cli_s *)camera;
5179 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_SCENE_MODE;
5181 if (pc->cb_info == NULL) {
5182 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5183 return CAMERA_ERROR_INVALID_PARAMETER;
5185 sock_fd = pc->cb_info->fd;
5188 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5189 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5191 if (ret == CAMERA_ERROR_NONE) {
5192 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
5193 *mode = (camera_attr_scene_mode_e)get_mode;
5195 LOGD("ret : 0x%x", ret);
5200 int camera_attr_is_enabled_tag(camera_h camera, bool *enable)
5202 if (camera == NULL || enable == NULL) {
5203 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5204 return CAMERA_ERROR_INVALID_PARAMETER;
5207 int ret = CAMERA_ERROR_NONE;
5208 camera_cli_s *pc = (camera_cli_s *)camera;
5209 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_TAG;
5211 if (pc->cb_info == NULL) {
5212 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5213 return CAMERA_ERROR_INVALID_PARAMETER;
5215 sock_fd = pc->cb_info->fd;
5218 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5219 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5221 if (ret == CAMERA_ERROR_NONE) {
5222 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
5223 *enable = (bool)get_enabled;
5225 LOGD("ret : 0x%x", ret);
5230 int camera_attr_get_tag_image_description(camera_h camera, char **description)
5232 if (camera == NULL || description == NULL) {
5233 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5234 return CAMERA_ERROR_INVALID_PARAMETER;
5237 int ret = CAMERA_ERROR_NONE;
5238 camera_cli_s *pc = (camera_cli_s *)camera;
5239 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_IMAGE_DESCRIPTION;
5241 if (pc->cb_info == NULL) {
5242 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5243 return CAMERA_ERROR_INVALID_PARAMETER;
5245 sock_fd = pc->cb_info->fd;
5246 char get_description[MUSE_CAMERA_MSG_MAX_LENGTH] = {0,};
5248 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5249 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5251 if (ret == CAMERA_ERROR_NONE) {
5252 muse_camera_msg_get_string(get_description, pc->cb_info->recv_msg);
5253 *description = strdup(get_description);
5255 LOGD("ret : 0x%x", ret);
5260 int camera_attr_get_tag_orientation(camera_h camera, camera_attr_tag_orientation_e *orientation)
5262 if (camera == NULL || orientation == NULL) {
5263 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5264 return CAMERA_ERROR_INVALID_PARAMETER;
5267 int ret = CAMERA_ERROR_NONE;
5268 camera_cli_s *pc = (camera_cli_s *)camera;
5269 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_ORIENTATION;
5271 if (pc->cb_info == NULL) {
5272 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5273 return CAMERA_ERROR_INVALID_PARAMETER;
5275 sock_fd = pc->cb_info->fd;
5276 int get_orientation;
5278 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5279 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5281 if (ret == CAMERA_ERROR_NONE) {
5282 muse_camera_msg_get(get_orientation, pc->cb_info->recv_msg);
5283 *orientation = (camera_attr_tag_orientation_e)get_orientation;
5284 LOGD("success, orientation : %d", *orientation);
5286 LOGD("ret : 0x%x", ret);
5291 int camera_attr_get_tag_software(camera_h camera, char **software)
5293 if (camera == NULL || software == NULL) {
5294 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5295 return CAMERA_ERROR_INVALID_PARAMETER;
5298 int ret = CAMERA_ERROR_NONE;
5299 camera_cli_s *pc = (camera_cli_s *)camera;
5300 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_SOFTWARE;
5302 if (pc->cb_info == NULL) {
5303 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5304 return CAMERA_ERROR_INVALID_PARAMETER;
5306 sock_fd = pc->cb_info->fd;
5307 char get_software[MUSE_CAMERA_MSG_MAX_LENGTH] = {0,};
5309 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5310 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5312 if (ret == CAMERA_ERROR_NONE) {
5313 muse_camera_msg_get_string(get_software, pc->cb_info->recv_msg);
5314 *software = strdup(get_software);
5316 LOGD("ret : 0x%x", ret);
5321 int camera_attr_get_geotag(camera_h camera, double *latitude , double *longitude, double *altitude)
5323 if (camera == NULL || latitude == NULL || longitude == NULL || altitude == NULL) {
5324 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5325 return CAMERA_ERROR_INVALID_PARAMETER;
5328 int ret = CAMERA_ERROR_NONE;
5329 camera_cli_s *pc = (camera_cli_s *)camera;
5330 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_GEOTAG;
5331 double get_geotag[3] = {0,};
5333 if (pc->cb_info == NULL) {
5334 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5335 return CAMERA_ERROR_INVALID_PARAMETER;
5337 sock_fd = pc->cb_info->fd;
5339 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5341 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5343 if (ret == CAMERA_ERROR_NONE) {
5344 muse_camera_msg_get_array(get_geotag, pc->cb_info->recv_msg);
5345 *latitude = get_geotag[0];
5346 *longitude = get_geotag[1];
5347 *altitude = get_geotag[2];
5349 LOGD("ret : 0x%x", ret);
5351 LOGE("Returned value is not valid : 0x%x", ret);
5358 int camera_attr_get_flash_mode(camera_h camera, camera_attr_flash_mode_e *mode)
5360 if (camera == NULL || mode == NULL) {
5361 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5362 return CAMERA_ERROR_INVALID_PARAMETER;
5365 int ret = CAMERA_ERROR_NONE;
5366 camera_cli_s *pc = (camera_cli_s *)camera;
5367 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_FLASH_MODE;
5369 if (pc->cb_info == NULL) {
5370 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5371 return CAMERA_ERROR_INVALID_PARAMETER;
5373 sock_fd = pc->cb_info->fd;
5376 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5377 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5379 if (ret == CAMERA_ERROR_NONE) {
5380 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
5381 *mode = (camera_attr_flash_mode_e)get_mode;
5383 LOGD("ret : 0x%x", ret);
5388 int camera_get_flash_state(camera_device_e device, camera_flash_state_e *state)
5392 int ret = CAMERA_ERROR_NONE;
5393 camera_cli_s *pc = NULL;
5394 int get_flash_state = 0;
5396 /* create muse connection */
5397 muse_camera_api_e api = MUSE_CAMERA_API_GET_FLASH_STATE;
5398 muse_core_api_module_e muse_module = MUSE_CAMERA;
5399 int device_type = (int)device;
5401 if (state == NULL) {
5402 LOGE("invalid pointer for state");
5403 return CAMERA_ERROR_INVALID_PARAMETER;
5406 sock_fd = muse_core_client_new();
5408 LOGE("muse_core_client_new failed - returned fd %d", sock_fd);
5409 ret = CAMERA_ERROR_INVALID_OPERATION;
5413 sndMsg = muse_core_msg_json_factory_new(api,
5414 MUSE_TYPE_INT, "module", muse_module,
5415 MUSE_TYPE_INT, PARAM_DEVICE_TYPE, device_type,
5418 muse_core_ipc_send_msg(sock_fd, sndMsg);
5419 muse_core_msg_json_factory_free(sndMsg);
5421 pc = g_new0(camera_cli_s, 1);
5423 LOGE("camera_cli_s alloc failed");
5424 ret = CAMERA_ERROR_OUT_OF_MEMORY;
5428 pc->cb_info = _client_callback_new(sock_fd);
5429 if (pc->cb_info == NULL) {
5430 LOGE("cb_info alloc failed");
5431 ret = CAMERA_ERROR_OUT_OF_MEMORY;
5435 ret = _client_wait_for_cb_return(api, pc->cb_info, CALLBACK_TIME_OUT);
5437 if (ret == CAMERA_ERROR_NONE) {
5438 muse_camera_msg_get(get_flash_state, pc->cb_info->recv_msg);
5439 *state = (camera_flash_state_e)get_flash_state;
5442 LOGD("Flash state : %d\n", *state);
5445 /* release resources */
5447 g_atomic_int_set(&pc->cb_info->msg_recv_running, 0);
5448 _client_callback_destroy(pc->cb_info);
5458 int camera_attr_foreach_supported_af_mode(camera_h camera, camera_attr_supported_af_mode_cb foreach_cb, void *user_data)
5460 if (camera == NULL || foreach_cb == NULL) {
5461 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5462 return CAMERA_ERROR_INVALID_PARAMETER;
5464 int ret = CAMERA_ERROR_NONE;
5466 camera_cli_s *pc = (camera_cli_s *)camera;
5467 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_AF_MODE;
5469 LOGD("Enter, handle :%x", pc->remote_handle);
5472 if (pc->cb_info == NULL) {
5473 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5474 return CAMERA_ERROR_INVALID_PARAMETER;
5476 sock_fd = pc->cb_info->fd;
5477 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_AF_MODE] = foreach_cb;
5478 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_AF_MODE] = user_data;
5480 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5481 LOGD("ret : 0x%x", ret);
5486 int camera_attr_foreach_supported_exposure_mode(camera_h camera, camera_attr_supported_exposure_mode_cb foreach_cb , void *user_data)
5488 if (camera == NULL || foreach_cb == NULL) {
5489 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5490 return CAMERA_ERROR_INVALID_PARAMETER;
5492 int ret = CAMERA_ERROR_NONE;
5494 camera_cli_s *pc = (camera_cli_s *)camera;
5495 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_EXPOSURE_MODE;
5497 LOGD("Enter, handle :%x", pc->remote_handle);
5500 if (pc->cb_info == NULL) {
5501 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5502 return CAMERA_ERROR_INVALID_PARAMETER;
5504 sock_fd = pc->cb_info->fd;
5505 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EXPOSURE_MODE] = foreach_cb;
5506 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EXPOSURE_MODE] = user_data;
5508 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5509 LOGD("ret : 0x%x", ret);
5514 int camera_attr_foreach_supported_iso(camera_h camera, camera_attr_supported_iso_cb foreach_cb, void *user_data)
5516 if (camera == NULL || foreach_cb == NULL) {
5517 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5518 return CAMERA_ERROR_INVALID_PARAMETER;
5520 int ret = CAMERA_ERROR_NONE;
5522 camera_cli_s *pc = (camera_cli_s *)camera;
5523 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_ISO;
5525 LOGD("Enter, handle :%x", pc->remote_handle);
5528 if (pc->cb_info == NULL) {
5529 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5530 return CAMERA_ERROR_INVALID_PARAMETER;
5532 sock_fd = pc->cb_info->fd;
5533 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_ISO] = foreach_cb;
5534 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_ISO] = user_data;
5536 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5537 LOGD("ret : 0x%x", ret);
5542 int camera_attr_foreach_supported_whitebalance(camera_h camera, camera_attr_supported_whitebalance_cb foreach_cb , void *user_data)
5544 if (camera == NULL || foreach_cb == NULL) {
5545 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5546 return CAMERA_ERROR_INVALID_PARAMETER;
5548 int ret = CAMERA_ERROR_NONE;
5550 camera_cli_s *pc = (camera_cli_s *)camera;
5551 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_WHITEBALANCE;
5553 LOGD("Enter, handle :%x", pc->remote_handle);
5556 if (pc->cb_info == NULL) {
5557 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5558 return CAMERA_ERROR_INVALID_PARAMETER;
5560 sock_fd = pc->cb_info->fd;
5561 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_WHITEBALANCE] = foreach_cb;
5562 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_WHITEBALANCE] = user_data;
5564 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5565 LOGD("ret : 0x%x", ret);
5570 int camera_attr_foreach_supported_effect(camera_h camera, camera_attr_supported_effect_cb foreach_cb , void *user_data)
5572 if (camera == NULL || foreach_cb == NULL) {
5573 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5574 return CAMERA_ERROR_INVALID_PARAMETER;
5576 int ret = CAMERA_ERROR_NONE;
5578 camera_cli_s *pc = (camera_cli_s *)camera;
5579 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_EFFECT;
5581 LOGD("Enter, handle :%x", pc->remote_handle);
5584 if (pc->cb_info == NULL) {
5585 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5586 return CAMERA_ERROR_INVALID_PARAMETER;
5588 sock_fd = pc->cb_info->fd;
5589 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EFFECT] = foreach_cb;
5590 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EFFECT] = user_data;
5592 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5593 LOGD("ret : 0x%x", ret);
5598 int camera_attr_foreach_supported_scene_mode(camera_h camera, camera_attr_supported_scene_mode_cb foreach_cb , void *user_data)
5600 if (camera == NULL || foreach_cb == NULL) {
5601 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5602 return CAMERA_ERROR_INVALID_PARAMETER;
5604 int ret = CAMERA_ERROR_NONE;
5606 camera_cli_s *pc = (camera_cli_s *)camera;
5607 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_SCENE_MODE;
5609 LOGD("Enter, handle :%x", pc->remote_handle);
5612 if (pc->cb_info == NULL) {
5613 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5614 return CAMERA_ERROR_INVALID_PARAMETER;
5616 sock_fd = pc->cb_info->fd;
5617 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_SCENE_MODE] = foreach_cb;
5618 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_SCENE_MODE] = user_data;
5620 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5621 LOGD("ret : 0x%x", ret);
5626 int camera_attr_foreach_supported_flash_mode(camera_h camera, camera_attr_supported_flash_mode_cb foreach_cb , void *user_data)
5628 if (camera == NULL || foreach_cb == NULL) {
5629 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5630 return CAMERA_ERROR_INVALID_PARAMETER;
5632 int ret = CAMERA_ERROR_NONE;
5634 camera_cli_s *pc = (camera_cli_s *)camera;
5635 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FLASH_MODE;
5637 LOGD("Enter, handle :%x", pc->remote_handle);
5640 if (pc->cb_info == NULL) {
5641 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5642 return CAMERA_ERROR_INVALID_PARAMETER;
5644 sock_fd = pc->cb_info->fd;
5645 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FLASH_MODE] = foreach_cb;
5646 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FLASH_MODE] = user_data;
5648 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5649 LOGD("ret : 0x%x", ret);
5654 int camera_attr_foreach_supported_fps(camera_h camera, camera_attr_supported_fps_cb foreach_cb , void *user_data)
5656 if (camera == NULL || foreach_cb == NULL) {
5657 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5658 return CAMERA_ERROR_INVALID_PARAMETER;
5660 int ret = CAMERA_ERROR_NONE;
5662 camera_cli_s *pc = (camera_cli_s *)camera;
5663 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FPS;
5665 if (pc->cb_info == NULL) {
5666 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5667 return CAMERA_ERROR_INVALID_PARAMETER;
5669 sock_fd = pc->cb_info->fd;
5670 LOGD("Enter, handle :%x", pc->remote_handle);
5671 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS] = foreach_cb;
5672 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS] = user_data;
5674 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5675 LOGD("Enter, handle :%x", pc->remote_handle);
5679 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)
5681 if (camera == NULL || foreach_cb == NULL) {
5682 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5683 return CAMERA_ERROR_INVALID_PARAMETER;
5685 int ret = CAMERA_ERROR_NONE;
5687 camera_cli_s *pc = (camera_cli_s *)camera;
5688 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FPS_BY_RESOLUTION;
5690 if (pc->cb_info == NULL) {
5691 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5692 return CAMERA_ERROR_INVALID_PARAMETER;
5694 sock_fd = pc->cb_info->fd;
5695 LOGD("Enter, handle :%x", pc->remote_handle);
5696 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS_BY_RESOLUTION] = foreach_cb;
5697 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS_BY_RESOLUTION] = user_data;
5699 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, width, INT, height);
5700 LOGD("ret : 0x%x", ret);
5704 int camera_attr_foreach_supported_stream_flip(camera_h camera, camera_attr_supported_stream_flip_cb foreach_cb, void *user_data)
5706 if (camera == NULL || foreach_cb == NULL) {
5707 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5708 return CAMERA_ERROR_INVALID_PARAMETER;
5710 int ret = CAMERA_ERROR_NONE;
5712 camera_cli_s *pc = (camera_cli_s *)camera;
5713 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_STREAM_FLIP;
5715 if (pc->cb_info == NULL) {
5716 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5717 return CAMERA_ERROR_INVALID_PARAMETER;
5719 sock_fd = pc->cb_info->fd;
5720 LOGD("Enter, handle :%x", pc->remote_handle);
5721 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_FLIP] = foreach_cb;
5722 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_FLIP] = user_data;
5724 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5725 LOGD("ret : 0x%x", ret);
5730 int camera_attr_foreach_supported_stream_rotation(camera_h camera, camera_attr_supported_stream_rotation_cb foreach_cb, void *user_data)
5732 if (camera == NULL || foreach_cb == NULL) {
5733 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5734 return CAMERA_ERROR_INVALID_PARAMETER;
5736 int ret = CAMERA_ERROR_NONE;
5738 camera_cli_s *pc = (camera_cli_s *)camera;
5739 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_STREAM_ROTATION;
5741 if (pc->cb_info == NULL) {
5742 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5743 return CAMERA_ERROR_INVALID_PARAMETER;
5745 sock_fd = pc->cb_info->fd;
5746 LOGD("Enter, handle :%x", pc->remote_handle);
5747 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION] = foreach_cb;
5748 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION] = user_data;
5750 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5751 LOGD("ret : 0x%x", ret);
5756 int camera_attr_set_stream_rotation(camera_h camera , camera_rotation_e rotation)
5758 if (camera == NULL) {
5759 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5760 return CAMERA_ERROR_INVALID_PARAMETER;
5763 int ret = CAMERA_ERROR_NONE;
5764 camera_cli_s *pc = (camera_cli_s *)camera;
5765 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_STREAM_ROTATION;
5767 if (pc->cb_info == NULL) {
5768 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5769 return CAMERA_ERROR_INVALID_PARAMETER;
5771 sock_fd = pc->cb_info->fd;
5772 int set_rotation = (int)rotation;
5774 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5775 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_rotation);
5776 LOGD("ret : 0x%x", ret);
5781 int camera_attr_get_stream_rotation(camera_h camera , camera_rotation_e *rotation)
5783 if (camera == NULL || rotation == NULL) {
5784 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5785 return CAMERA_ERROR_INVALID_PARAMETER;
5788 int ret = CAMERA_ERROR_NONE;
5789 camera_cli_s *pc = (camera_cli_s *)camera;
5790 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_STREAM_ROTATION;
5792 if (pc->cb_info == NULL) {
5793 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5794 return CAMERA_ERROR_INVALID_PARAMETER;
5796 sock_fd = pc->cb_info->fd;
5799 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5800 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5802 if (ret == CAMERA_ERROR_NONE) {
5803 muse_camera_msg_get(get_rotation, pc->cb_info->recv_msg);
5804 *rotation = (camera_rotation_e)get_rotation;
5806 LOGD("ret : 0x%x", ret);
5811 int camera_attr_set_stream_flip(camera_h camera , camera_flip_e flip)
5813 if (camera == NULL) {
5814 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5815 return CAMERA_ERROR_INVALID_PARAMETER;
5818 int ret = CAMERA_ERROR_NONE;
5819 camera_cli_s *pc = (camera_cli_s *)camera;
5820 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_STREAM_FLIP;
5822 if (pc->cb_info == NULL) {
5823 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5824 return CAMERA_ERROR_INVALID_PARAMETER;
5826 sock_fd = pc->cb_info->fd;
5827 int set_flip = (int)flip;
5829 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5830 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_flip);
5831 LOGD("ret : 0x%x", ret);
5836 int camera_attr_get_stream_flip(camera_h camera , camera_flip_e *flip)
5838 if (camera == NULL || flip == NULL) {
5839 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5840 return CAMERA_ERROR_INVALID_PARAMETER;
5843 int ret = CAMERA_ERROR_NONE;
5844 camera_cli_s *pc = (camera_cli_s *)camera;
5845 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_STREAM_FLIP;
5847 if (pc->cb_info == NULL) {
5848 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5849 return CAMERA_ERROR_INVALID_PARAMETER;
5851 sock_fd = pc->cb_info->fd;
5854 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5855 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5857 if (ret == CAMERA_ERROR_NONE) {
5858 muse_camera_msg_get(get_flip, pc->cb_info->recv_msg);
5859 *flip = (camera_flip_e)get_flip;
5861 LOGD("ret : 0x%x", ret);
5865 int camera_attr_set_hdr_mode(camera_h camera, camera_attr_hdr_mode_e mode)
5867 if (camera == NULL) {
5868 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5869 return CAMERA_ERROR_INVALID_PARAMETER;
5872 int ret = CAMERA_ERROR_NONE;
5873 camera_cli_s *pc = (camera_cli_s *)camera;
5874 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_HDR_MODE;
5876 if (pc->cb_info == NULL) {
5877 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5878 return CAMERA_ERROR_INVALID_PARAMETER;
5880 sock_fd = pc->cb_info->fd;
5881 int set_mode = (int)mode;
5883 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5884 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
5885 LOGD("ret : 0x%x", ret);
5890 int camera_attr_get_hdr_mode(camera_h camera, camera_attr_hdr_mode_e *mode)
5892 if (camera == NULL) {
5893 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5894 return CAMERA_ERROR_INVALID_PARAMETER;
5897 LOGE("INVALID_PARAMETER(0x%08x) - mode", CAMERA_ERROR_INVALID_PARAMETER);
5898 return CAMERA_ERROR_INVALID_PARAMETER;
5900 int ret = CAMERA_ERROR_NONE;
5901 camera_cli_s *pc = (camera_cli_s *)camera;
5902 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_HDR_MODE;
5904 if (pc->cb_info == NULL) {
5905 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5906 return CAMERA_ERROR_INVALID_PARAMETER;
5908 sock_fd = pc->cb_info->fd;
5911 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5912 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5914 if (ret == CAMERA_ERROR_NONE) {
5915 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
5916 *mode = (camera_attr_hdr_mode_e)get_mode;
5918 LOGD("ret : 0x%x", ret);
5923 bool camera_attr_is_supported_hdr_capture(camera_h camera)
5925 if (camera == NULL) {
5926 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5930 int ret = CAMERA_ERROR_NONE;
5931 camera_cli_s *pc = (camera_cli_s *)camera;
5932 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_HDR_CAPTURE;
5934 if (pc->cb_info == NULL) {
5935 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5936 return CAMERA_ERROR_INVALID_PARAMETER;
5938 sock_fd = pc->cb_info->fd;
5939 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5940 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5941 LOGD("ret : 0x%x", ret);
5946 int camera_attr_set_hdr_capture_progress_cb(camera_h camera, camera_attr_hdr_progress_cb callback, void *user_data)
5948 int ret = CAMERA_ERROR_NONE;
5949 camera_cli_s *pc = (camera_cli_s *)camera;
5950 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_HDR_CAPTURE_PROGRESS_CB;
5953 if (camera == NULL) {
5954 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5955 return CAMERA_ERROR_INVALID_PARAMETER;
5958 if (pc->cb_info == NULL) {
5959 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5960 return CAMERA_ERROR_INVALID_PARAMETER;
5963 sock_fd = pc->cb_info->fd;
5965 LOGD("Enter, handle :%x", pc->remote_handle);
5967 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5969 if (ret == CAMERA_ERROR_NONE) {
5970 if (callback == NULL) {
5971 LOGE("INVALID_PARAMETER(0x%08x) - callback", CAMERA_ERROR_INVALID_PARAMETER);
5972 return CAMERA_ERROR_INVALID_PARAMETER;
5975 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = callback;
5976 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = user_data;
5979 LOGD("ret : 0x%x", ret);
5985 int camera_attr_unset_hdr_capture_progress_cb(camera_h camera)
5987 if (camera == NULL) {
5988 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5989 return CAMERA_ERROR_INVALID_PARAMETER;
5992 int ret = CAMERA_ERROR_NONE;
5994 camera_cli_s *pc = (camera_cli_s *)camera;
5995 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_UNSET_HDR_CAPTURE_PROGRESS_CB;
5997 if (pc->cb_info == NULL) {
5998 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5999 return CAMERA_ERROR_INVALID_PARAMETER;
6001 sock_fd = pc->cb_info->fd;
6002 LOGD("Enter, handle :%x", pc->remote_handle);
6004 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = (void *)NULL;
6005 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = (void *)NULL;
6007 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6008 LOGD("ret : 0x%x", ret);
6013 int camera_attr_enable_anti_shake(camera_h camera, bool enable)
6015 if (camera == NULL) {
6016 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6017 return CAMERA_ERROR_INVALID_PARAMETER;
6020 int ret = CAMERA_ERROR_NONE;
6021 camera_cli_s *pc = (camera_cli_s *)camera;
6022 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_ANTI_SHAKE;
6024 if (pc->cb_info == NULL) {
6025 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6026 return CAMERA_ERROR_INVALID_PARAMETER;
6028 sock_fd = pc->cb_info->fd;
6029 int set_enable = (int)enable;
6031 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6032 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
6033 LOGD("ret : 0x%x", ret);
6038 int camera_attr_is_enabled_anti_shake(camera_h camera , bool *enabled)
6040 if (camera == NULL) {
6041 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
6042 return CAMERA_ERROR_INVALID_PARAMETER;
6044 if (enabled == NULL) {
6045 LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER);
6046 return CAMERA_ERROR_INVALID_PARAMETER;
6048 int ret = CAMERA_ERROR_NONE;
6049 camera_cli_s *pc = (camera_cli_s *)camera;
6050 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_ANTI_SHAKE;
6052 if (pc->cb_info == NULL) {
6053 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6054 return CAMERA_ERROR_INVALID_PARAMETER;
6056 sock_fd = pc->cb_info->fd;
6059 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6060 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6062 if (ret == CAMERA_ERROR_NONE) {
6063 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
6064 *enabled = (bool)get_enabled;
6066 LOGD("ret : 0x%x", ret);
6071 bool camera_attr_is_supported_anti_shake(camera_h camera)
6074 if (camera == NULL) {
6075 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6079 int ret = CAMERA_ERROR_NONE;
6080 camera_cli_s *pc = (camera_cli_s *)camera;
6081 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_ANTI_SHAKE;
6083 if (pc->cb_info == NULL) {
6084 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6085 return CAMERA_ERROR_INVALID_PARAMETER;
6087 sock_fd = pc->cb_info->fd;
6088 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6089 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6090 LOGD("ret : 0x%x", ret);
6095 int camera_attr_enable_video_stabilization(camera_h camera, bool enable)
6097 if (camera == NULL) {
6098 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6099 return CAMERA_ERROR_INVALID_PARAMETER;
6102 int ret = CAMERA_ERROR_NONE;
6103 camera_cli_s *pc = (camera_cli_s *)camera;
6104 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_VIDEO_STABILIZATION;
6106 if (pc->cb_info == NULL) {
6107 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6108 return CAMERA_ERROR_INVALID_PARAMETER;
6110 sock_fd = pc->cb_info->fd;
6111 int set_enable = (int)enable;
6113 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6114 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
6115 LOGD("ret : 0x%x", ret);
6120 int camera_attr_is_enabled_video_stabilization(camera_h camera, bool *enabled)
6122 if (camera == NULL) {
6123 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
6124 return CAMERA_ERROR_INVALID_PARAMETER;
6126 if (enabled == NULL) {
6127 LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER);
6128 return CAMERA_ERROR_INVALID_PARAMETER;
6130 int ret = CAMERA_ERROR_NONE;
6131 camera_cli_s *pc = (camera_cli_s *)camera;
6132 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_VIDEO_STABILIZATION;
6134 if (pc->cb_info == NULL) {
6135 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6136 return CAMERA_ERROR_INVALID_PARAMETER;
6138 sock_fd = pc->cb_info->fd;
6141 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6142 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6144 if (ret == CAMERA_ERROR_NONE) {
6145 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
6146 *enabled = (bool)get_enabled;
6148 LOGD("ret : 0x%x", ret);
6153 bool camera_attr_is_supported_video_stabilization(camera_h camera)
6155 if (camera == NULL) {
6156 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6160 int ret = CAMERA_ERROR_NONE;
6161 camera_cli_s *pc = (camera_cli_s *)camera;
6162 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_VIDEO_STABILIZATION;
6164 if (pc->cb_info == NULL) {
6165 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6166 return CAMERA_ERROR_INVALID_PARAMETER;
6168 sock_fd = pc->cb_info->fd;
6169 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6170 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6171 LOGD("ret : 0x%x", ret);
6176 int camera_attr_enable_auto_contrast(camera_h camera, bool enable)
6178 if (camera == NULL) {
6179 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6180 return CAMERA_ERROR_INVALID_PARAMETER;
6183 int ret = CAMERA_ERROR_NONE;
6184 camera_cli_s *pc = (camera_cli_s *)camera;
6185 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_AUTO_CONTRAST;
6187 if (pc->cb_info == NULL) {
6188 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6189 return CAMERA_ERROR_INVALID_PARAMETER;
6191 sock_fd = pc->cb_info->fd;
6192 int set_enable = (int)enable;
6194 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6195 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
6196 LOGD("ret : 0x%x", ret);
6201 int camera_attr_is_enabled_auto_contrast(camera_h camera, bool *enabled)
6203 if (camera == NULL) {
6204 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
6205 return CAMERA_ERROR_INVALID_PARAMETER;
6207 if (enabled == NULL) {
6208 LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER);
6209 return CAMERA_ERROR_INVALID_PARAMETER;
6211 int ret = CAMERA_ERROR_NONE;
6212 camera_cli_s *pc = (camera_cli_s *)camera;
6213 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_AUTO_CONTRAST;
6215 if (pc->cb_info == NULL) {
6216 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6217 return CAMERA_ERROR_INVALID_PARAMETER;
6219 sock_fd = pc->cb_info->fd;
6222 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6223 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6225 if (ret == CAMERA_ERROR_NONE) {
6226 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
6227 *enabled = (bool)get_enabled;
6229 LOGD("ret : 0x%x", ret);
6234 bool camera_attr_is_supported_auto_contrast(camera_h camera)
6236 if (camera == NULL) {
6237 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6241 int ret = CAMERA_ERROR_NONE;
6242 camera_cli_s *pc = (camera_cli_s *)camera;
6243 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_AUTO_CONTRAST;
6245 if (pc->cb_info == NULL) {
6246 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6247 return CAMERA_ERROR_INVALID_PARAMETER;
6249 sock_fd = pc->cb_info->fd;
6250 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6251 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6252 LOGD("ret : 0x%x", ret);
6257 int camera_attr_disable_shutter_sound(camera_h camera, bool disable)
6259 if (camera == NULL) {
6260 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6261 return CAMERA_ERROR_INVALID_PARAMETER;
6264 int ret = CAMERA_ERROR_NONE;
6265 camera_cli_s *pc = (camera_cli_s *)camera;
6266 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_DISABLE_SHUTTER_SOUND;
6268 if (pc->cb_info == NULL) {
6269 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6270 return CAMERA_ERROR_INVALID_PARAMETER;
6272 sock_fd = pc->cb_info->fd;
6273 int set_disable = (int)disable;
6275 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6276 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_disable);
6277 LOGD("ret : 0x%x", ret);
6282 int camera_attr_set_pan(camera_h camera, camera_attr_ptz_move_type_e move_type, int pan_step)
6284 if (camera == NULL) {
6285 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6286 return CAMERA_ERROR_INVALID_PARAMETER;
6289 camera_cli_s *pc = (camera_cli_s *)camera;
6290 if (pc->cb_info == NULL) {
6291 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6292 return CAMERA_ERROR_INVALID_PARAMETER;
6295 int ret = CAMERA_ERROR_NONE;
6296 int sock_fd = pc->cb_info->fd;
6297 int set_move_type = (int)move_type;
6298 int set_pan_step = pan_step;
6299 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_PAN;
6301 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6302 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, set_move_type, INT, set_pan_step);
6303 LOGD("ret : 0x%x", ret);
6308 int camera_attr_get_pan(camera_h camera, int *pan_step)
6310 if (camera == NULL || pan_step == NULL) {
6311 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6312 return CAMERA_ERROR_INVALID_PARAMETER;
6315 camera_cli_s *pc = (camera_cli_s *)camera;
6316 if (pc->cb_info == NULL) {
6317 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6318 return CAMERA_ERROR_INVALID_PARAMETER;
6321 int ret = CAMERA_ERROR_NONE;
6322 int sock_fd = pc->cb_info->fd;
6324 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_PAN;
6326 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6327 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6329 if (ret == CAMERA_ERROR_NONE) {
6330 muse_camera_msg_get(get_pan_step, pc->cb_info->recv_msg);
6331 *pan_step = get_pan_step;
6333 LOGD("ret : 0x%x", ret);
6338 int camera_attr_get_pan_range(camera_h camera, int *min, int *max)
6340 if (camera == NULL || min == NULL || max == NULL) {
6341 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6342 return CAMERA_ERROR_INVALID_PARAMETER;
6345 camera_cli_s *pc = (camera_cli_s *)camera;
6346 if (pc->cb_info == NULL) {
6347 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6348 return CAMERA_ERROR_INVALID_PARAMETER;
6351 int ret = CAMERA_ERROR_NONE;
6352 int sock_fd = pc->cb_info->fd;
6355 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_PAN_RANGE;
6357 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6358 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6360 if (ret == CAMERA_ERROR_NONE) {
6361 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
6362 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
6366 LOGD("ret : 0x%x", ret);
6371 int camera_attr_set_tilt(camera_h camera, camera_attr_ptz_move_type_e move_type, int tilt_step)
6373 if (camera == NULL) {
6374 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6375 return CAMERA_ERROR_INVALID_PARAMETER;
6378 camera_cli_s *pc = (camera_cli_s *)camera;
6379 if (pc->cb_info == NULL) {
6380 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6381 return CAMERA_ERROR_INVALID_PARAMETER;
6384 int ret = CAMERA_ERROR_NONE;
6385 int sock_fd = pc->cb_info->fd;
6386 int set_move_type = (int)move_type;
6387 int set_tilt_step = tilt_step;
6388 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TILT;
6390 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6391 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, set_move_type, INT, set_tilt_step);
6392 LOGD("ret : 0x%x", ret);
6397 int camera_attr_get_tilt(camera_h camera, int *tilt_step)
6399 if (camera == NULL || tilt_step == NULL) {
6400 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6401 return CAMERA_ERROR_INVALID_PARAMETER;
6404 camera_cli_s *pc = (camera_cli_s *)camera;
6405 if (pc->cb_info == NULL) {
6406 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6407 return CAMERA_ERROR_INVALID_PARAMETER;
6410 int ret = CAMERA_ERROR_NONE;
6411 int sock_fd = pc->cb_info->fd;
6413 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TILT;
6415 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6416 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6418 if (ret == CAMERA_ERROR_NONE) {
6419 muse_camera_msg_get(get_tilt_step, pc->cb_info->recv_msg);
6420 *tilt_step = get_tilt_step;
6422 LOGD("ret : 0x%x", ret);
6427 int camera_attr_get_tilt_range(camera_h camera, int *min, int *max)
6429 if (camera == NULL || min == NULL || max == NULL) {
6430 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6431 return CAMERA_ERROR_INVALID_PARAMETER;
6434 camera_cli_s *pc = (camera_cli_s *)camera;
6435 if (pc->cb_info == NULL) {
6436 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6437 return CAMERA_ERROR_INVALID_PARAMETER;
6440 int ret = CAMERA_ERROR_NONE;
6441 int sock_fd = pc->cb_info->fd;
6444 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TILT_RANGE;
6446 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6447 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6449 if (ret == CAMERA_ERROR_NONE) {
6450 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
6451 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
6455 LOGD("ret : 0x%x", ret);
6460 int camera_attr_set_ptz_type(camera_h camera, camera_attr_ptz_type_e ptz_type)
6462 if (camera == NULL) {
6463 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6464 return CAMERA_ERROR_INVALID_PARAMETER;
6467 camera_cli_s *pc = (camera_cli_s *)camera;
6468 if (pc->cb_info == NULL) {
6469 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6470 return CAMERA_ERROR_INVALID_PARAMETER;
6473 int ret = CAMERA_ERROR_NONE;
6474 int sock_fd = pc->cb_info->fd;
6475 int set_ptz_type = (int)ptz_type;
6476 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_PTZ_TYPE;
6478 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6479 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_ptz_type);
6480 LOGD("ret : 0x%x", ret);
6485 int camera_attr_foreach_supported_ptz_type(camera_h camera, camera_attr_supported_ptz_type_cb foreach_cb, void *user_data)
6487 if (camera == NULL || foreach_cb == NULL) {
6488 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6489 return CAMERA_ERROR_INVALID_PARAMETER;
6491 int ret = CAMERA_ERROR_NONE;
6493 camera_cli_s *pc = (camera_cli_s *)camera;
6494 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_PTZ_TYPE;
6496 if (pc->cb_info == NULL) {
6497 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6498 return CAMERA_ERROR_INVALID_PARAMETER;
6500 sock_fd = pc->cb_info->fd;
6501 LOGD("Enter, handle :%x", pc->remote_handle);
6502 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PTZ_TYPE] = foreach_cb;
6503 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PTZ_TYPE] = user_data;
6505 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6506 LOGD("ret : 0x%x", ret);
6511 int camera_attr_set_display_roi_area(camera_h camera, int x, int y, int width, int height)
6513 if (camera == NULL) {
6514 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6515 return CAMERA_ERROR_INVALID_PARAMETER;
6518 camera_cli_s *pc = (camera_cli_s *)camera;
6519 if (pc->cb_info == NULL) {
6520 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6521 return CAMERA_ERROR_INVALID_PARAMETER;
6524 int ret = CAMERA_ERROR_NONE;
6525 int sock_fd = pc->cb_info->fd;
6526 int set_display_roi_area[4] = {x, y, width, height};
6527 muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY_ROI_AREA;
6529 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6531 #ifdef TIZEN_FEATURE_EVAS_RENDERER
6532 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
6533 g_mutex_lock(&pc->cb_info->evas_mutex);
6535 ret = mm_evas_renderer_set_roi_area(pc->cb_info->evas_info, x, y, width, height);
6537 g_mutex_unlock(&pc->cb_info->evas_mutex);
6539 if (ret != MM_ERROR_NONE) {
6540 LOGE("mm_evas_renderer_set_roi_area error 0x%x", ret);
6541 return CAMERA_ERROR_INVALID_OPERATION;
6544 #endif /* TIZEN_FEATURE_EVAS_RENDERER */
6546 muse_camera_msg_send_array(api, sock_fd, pc->cb_info, ret,
6547 set_display_roi_area, sizeof(set_display_roi_area), sizeof(int));
6549 LOGD("ret : 0x%x", ret);
6555 int camera_attr_get_display_roi_area(camera_h camera, int *x, int *y, int *width, int *height)
6557 if (camera == NULL || x == NULL || y == NULL || width == NULL || height == NULL) {
6558 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6559 return CAMERA_ERROR_INVALID_PARAMETER;
6562 camera_cli_s *pc = (camera_cli_s *)camera;
6563 if (pc->cb_info == NULL) {
6564 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6565 return CAMERA_ERROR_INVALID_PARAMETER;
6568 int ret = CAMERA_ERROR_NONE;
6569 int sock_fd = pc->cb_info->fd;
6570 int get_display_roi_area[4] = {0,};
6571 muse_camera_api_e api = MUSE_CAMERA_API_GET_DISPLAY_ROI_AREA;
6573 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6575 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6577 if (ret == CAMERA_ERROR_NONE) {
6578 muse_camera_msg_get_array(get_display_roi_area, pc->cb_info->recv_msg);
6580 *x = get_display_roi_area[0];
6581 *y = get_display_roi_area[1];
6582 *width = get_display_roi_area[2];
6583 *height = get_display_roi_area[3];
6585 LOGD("ret : 0x%x", ret);
6587 LOGE("Returned value is not valid : 0x%x", ret);