2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
24 #include <muse_camera.h>
25 #include <muse_camera_msg.h>
26 #include <muse_core_ipc.h>
27 #include <muse_core_module.h>
28 #include <camera_private.h>
29 #include <muse_core.h>
31 #include <Elementary.h>
32 #include <tbm_surface_internal.h>
35 #include <Ecore_Wayland.h>
36 #include <wayland-client.h>
37 #include <tizen-extension-client-protocol.h>
45 #define LOG_TAG "TIZEN_N_CAMERA"
49 static void __global(void *data, struct wl_registry *registry,
50 uint32_t name, const char *interface, uint32_t version)
52 struct tizen_surface **tz_surface = NULL;
59 tz_surface = (struct tizen_surface **)data;
62 LOGW("NULL interface");
66 LOGI("interface %s", interface);
68 if (strcmp(interface, "tizen_surface") == 0) {
69 LOGD("binding tizen surface for wayland");
71 *tz_surface = wl_registry_bind(registry, name, &tizen_surface_interface, version);
72 if (*tz_surface == NULL)
73 LOGE("failed to bind");
81 static void __global_remove(void *data, struct wl_registry *wl_registry, uint32_t name)
87 static const struct wl_registry_listener _camera_wl_registry_listener = {
92 void __parent_id_getter(void *data, struct tizen_resource *tizen_resource, uint32_t id)
99 *((unsigned int *)data) = id;
101 LOGD("[CLIENT] got parent_id [%u] from server", id);
106 static const struct tizen_resource_listener _camera_tz_resource_listener = {
110 int _get_wl_info(Evas_Object *obj, camera_wl_info_s *wl_info)
112 int ret = CAMERA_ERROR_NONE;
113 Ecore_Wl_Window *window = NULL;
114 struct wl_display *display = NULL;
115 struct wl_surface *surface = NULL;
116 struct wl_registry *registry = NULL;
117 struct tizen_surface *tz_surface = NULL;
118 struct tizen_resource *tz_resource = NULL;
120 if (!obj || !wl_info) {
121 LOGE("NULL parameter %p %p", obj, wl_info);
122 return CAMERA_ERROR_INVALID_OPERATION;
125 window = elm_win_wl_window_get(obj);
127 LOGE("failed to get wayland window");
128 ret = CAMERA_ERROR_INVALID_OPERATION;
132 surface = (struct wl_surface *)ecore_wl_window_surface_get(window);
134 LOGE("failed to get wayland surface");
135 ret = CAMERA_ERROR_INVALID_OPERATION;
139 display = (struct wl_display *)ecore_wl_display_get();
141 LOGE("failed to get wayland display");
142 ret = CAMERA_ERROR_INVALID_OPERATION;
146 registry = wl_display_get_registry(display);
148 LOGE("failed to get wayland registry");
149 ret = CAMERA_ERROR_INVALID_OPERATION;
153 wl_registry_add_listener(registry, &_camera_wl_registry_listener, &tz_surface);
155 wl_display_dispatch(display);
156 wl_display_roundtrip(display);
159 LOGE("failed to get tizen surface");
160 ret = CAMERA_ERROR_INVALID_OPERATION;
164 /* Get parent_id which is unique in a entire systemw. */
165 tz_resource = tizen_surface_get_tizen_resource(tz_surface, surface);
167 LOGE("failed to get tizen resurce");
168 ret = CAMERA_ERROR_INVALID_OPERATION;
172 wl_info->parent_id = 0;
174 tizen_resource_add_listener(tz_resource, &_camera_tz_resource_listener, &wl_info->parent_id);
176 wl_display_roundtrip(display);
178 if (wl_info->parent_id > 0) {
180 Ecore_Evas *ecore_evas = NULL;
181 ret = CAMERA_ERROR_NONE;
183 wl_info->evas_obj = obj;
185 evas_object_geometry_get(obj, &wl_info->window_x, &wl_info->window_y,
186 &wl_info->window_width, &wl_info->window_height);
188 ecore_evas = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
190 rotation = ecore_evas_rotation_get(ecore_evas);
191 if (rotation == 90 || rotation == 270) {
192 int temp = wl_info->window_width;
194 LOGD("swap width and height %d, %d", wl_info->window_width, wl_info->window_height);
196 wl_info->window_width = wl_info->window_height;
197 wl_info->window_height = temp;
200 LOGW("failed to get ecore_evas.. skip rotation check");
203 LOGD("evas object : %p, rotation : %d, parent id : %u, window : %d,%d,%dx%d",
204 wl_info->evas_obj, rotation, wl_info->parent_id,
205 wl_info->window_x, wl_info->window_y,
206 wl_info->window_width, wl_info->window_height);
208 ret = CAMERA_ERROR_INVALID_OPERATION;
209 LOGE("failed to get parent id");
214 tizen_surface_destroy(tz_surface);
219 tizen_resource_destroy(tz_resource);
224 wl_registry_destroy(registry);
230 #endif /* HAVE_WAYLAND */
232 static int _import_tbm_key(tbm_bufmgr bufmgr, unsigned int tbm_key, tbm_bo *bo, tbm_bo_handle *bo_handle)
234 tbm_bo tmp_bo = NULL;
235 tbm_bo_handle tmp_bo_handle = {NULL, };
237 if (bufmgr == NULL || bo == NULL || bo_handle == NULL || tbm_key == 0) {
238 LOGE("invalid parameter - bufmgr %p, bo %p, bo_handle %p, key %d",
239 bufmgr, bo, bo_handle, tbm_key);
243 tmp_bo = tbm_bo_import(bufmgr, tbm_key);
244 if (tmp_bo == NULL) {
245 LOGE("bo import failed - bufmgr %p, key %d", bufmgr, tbm_key);
249 tmp_bo_handle = tbm_bo_map(tmp_bo, TBM_DEVICE_CPU, TBM_OPTION_READ);
250 if (tmp_bo_handle.ptr == NULL) {
251 LOGE("bo map failed %p", tmp_bo);
252 tbm_bo_unref(tmp_bo);
257 /* set bo and bo_handle */
259 *bo_handle = tmp_bo_handle;
264 static void _release_imported_bo(tbm_bo *bo)
266 if (bo == NULL || *bo == NULL) {
278 static int _client_wait_for_cb_return(muse_camera_api_e api, camera_cb_info_s *cb_info, int time_out)
280 int ret = CAMERA_ERROR_NONE;
283 LOGD("Enter api : %d", api);
285 g_mutex_lock(&(cb_info->api_mutex[api]));
287 if (cb_info->api_activating[api] == 0) {
288 end_time = g_get_monotonic_time() + time_out * G_TIME_SPAN_SECOND;
289 if (g_cond_wait_until(&(cb_info->api_cond[api]), &(cb_info->api_mutex[api]), end_time)) {
290 ret = cb_info->api_ret[api];
291 cb_info->api_activating[api] = 0;
293 LOGD("return value : 0x%x", ret);
295 ret = CAMERA_ERROR_INVALID_OPERATION;
297 LOGE("api %d was TIMED OUT!", api);
300 ret = cb_info->api_ret[api];
301 cb_info->api_activating[api] = 0;
303 LOGD("condition is already checked for the api[%d], return[0x%x]", api, ret);
306 g_mutex_unlock(&(cb_info->api_mutex[api]));
311 int _camera_get_tbm_surface_format(int in_format, uint32_t *out_format)
313 if (in_format <= MM_PIXEL_FORMAT_INVALID ||
314 in_format >= MM_PIXEL_FORMAT_NUM ||
315 out_format == NULL) {
316 LOGE("INVALID_PARAMETER : in_format %d, out_format ptr %p", in_format, out_format);
317 return CAMERA_ERROR_INVALID_PARAMETER;
321 case MM_PIXEL_FORMAT_NV12:
322 case MM_PIXEL_FORMAT_NV12T:
323 *out_format = TBM_FORMAT_NV12;
325 case MM_PIXEL_FORMAT_NV16:
326 *out_format = TBM_FORMAT_NV16;
328 case MM_PIXEL_FORMAT_NV21:
329 *out_format = TBM_FORMAT_NV21;
331 case MM_PIXEL_FORMAT_YUYV:
332 *out_format = TBM_FORMAT_YUYV;
334 case MM_PIXEL_FORMAT_UYVY:
335 case MM_PIXEL_FORMAT_ITLV_JPEG_UYVY:
336 *out_format = TBM_FORMAT_UYVY;
338 case MM_PIXEL_FORMAT_422P:
339 *out_format = TBM_FORMAT_YUV422;
341 case MM_PIXEL_FORMAT_I420:
342 *out_format = TBM_FORMAT_YUV420;
344 case MM_PIXEL_FORMAT_YV12:
345 *out_format = TBM_FORMAT_YVU420;
347 case MM_PIXEL_FORMAT_RGB565:
348 *out_format = TBM_FORMAT_RGB565;
350 case MM_PIXEL_FORMAT_RGB888:
351 *out_format = TBM_FORMAT_RGB888;
353 case MM_PIXEL_FORMAT_RGBA:
354 *out_format = TBM_FORMAT_RGBA8888;
356 case MM_PIXEL_FORMAT_ARGB:
357 *out_format = TBM_FORMAT_ARGB8888;
360 LOGE("invalid in_format %d", in_format);
361 return CAMERA_ERROR_INVALID_PARAMETER;
364 return CAMERA_ERROR_NONE;
368 int _camera_get_media_packet_mimetype(int in_format, media_format_mimetype_e *mimetype)
370 if (in_format <= MM_PIXEL_FORMAT_INVALID ||
371 in_format >= MM_PIXEL_FORMAT_NUM ||
373 LOGE("INVALID_PARAMETER : in_format %d, mimetype ptr %p", in_format, mimetype);
374 return CAMERA_ERROR_INVALID_PARAMETER;
378 case MM_PIXEL_FORMAT_NV12:
379 case MM_PIXEL_FORMAT_NV12T:
380 *mimetype = MEDIA_FORMAT_NV12;
382 case MM_PIXEL_FORMAT_NV16:
383 *mimetype = MEDIA_FORMAT_NV16;
385 case MM_PIXEL_FORMAT_NV21:
386 *mimetype = MEDIA_FORMAT_NV21;
388 case MM_PIXEL_FORMAT_YUYV:
389 *mimetype = MEDIA_FORMAT_YUYV;
391 case MM_PIXEL_FORMAT_UYVY:
392 case MM_PIXEL_FORMAT_ITLV_JPEG_UYVY:
393 *mimetype = MEDIA_FORMAT_UYVY;
395 case MM_PIXEL_FORMAT_422P:
396 *mimetype = MEDIA_FORMAT_422P;
398 case MM_PIXEL_FORMAT_I420:
399 *mimetype = MEDIA_FORMAT_I420;
401 case MM_PIXEL_FORMAT_YV12:
402 *mimetype = MEDIA_FORMAT_YV12;
404 case MM_PIXEL_FORMAT_RGB565:
405 *mimetype = MEDIA_FORMAT_RGB565;
407 case MM_PIXEL_FORMAT_RGB888:
408 *mimetype = MEDIA_FORMAT_RGB888;
410 case MM_PIXEL_FORMAT_RGBA:
411 *mimetype = MEDIA_FORMAT_RGBA;
413 case MM_PIXEL_FORMAT_ARGB:
414 *mimetype = MEDIA_FORMAT_ARGB;
417 LOGE("invalid in_format %d", in_format);
418 return CAMERA_ERROR_INVALID_PARAMETER;
421 return CAMERA_ERROR_NONE;
424 int _camera_media_packet_finalize(media_packet_h pkt, int error_code, void *user_data)
428 camera_cb_info_s *cb_info = (camera_cb_info_s *)user_data;
429 camera_media_packet_data *mp_data = NULL;
430 tbm_surface_h tsurf = NULL;
432 if (pkt == NULL || cb_info == NULL) {
433 LOGE("invalid parameter buffer %p, cb_info %p", pkt, cb_info);
434 return MEDIA_PACKET_FINALIZE;
437 ret = media_packet_get_extra(pkt, (void **)&mp_data);
438 if (ret != MEDIA_PACKET_ERROR_NONE) {
439 LOGE("media_packet_get_extra failed 0x%x", ret);
440 return MEDIA_PACKET_FINALIZE;
443 /*LOGD("mp_data %p", mp_data);*/
446 int tbm_key = mp_data->tbm_key;
448 /* release imported bo */
449 for (i = 0 ; i < mp_data->num_buffer_key ; i++) {
450 tbm_bo_unref(mp_data->buffer_bo[i]);
451 mp_data->buffer_bo[i] = NULL;
454 /* unmap and unref tbm bo */
455 _release_imported_bo(&mp_data->bo);
458 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
459 cb_info->fd, cb_info, INT, tbm_key);
464 ret = media_packet_get_tbm_surface(pkt, &tsurf);
465 if (ret != MEDIA_PACKET_ERROR_NONE) {
466 LOGE("media_packet_get_tbm_surface failed 0x%x", ret);
467 return MEDIA_PACKET_FINALIZE;
471 tbm_surface_destroy(tsurf);
475 return MEDIA_PACKET_FINALIZE;
478 static void _client_user_callback(camera_cb_info_s *cb_info, char *recv_msg, muse_camera_event_e event)
484 tbm_bo_handle bo_handle = {NULL, };
486 if (recv_msg == NULL || event >= MUSE_CAMERA_EVENT_TYPE_NUM) {
487 LOGE("invalid parameter - camera msg %p, event %d", recv_msg, event);
491 LOGD("get camera msg %s, event %d", recv_msg, event);
493 if (event == MUSE_CAMERA_EVENT_TYPE_PREVIEW) {
494 if (cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW] == NULL &&
495 cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] == NULL) {
496 LOGW("all preview callback from user are NULL");
499 } else if (cb_info->user_cb[event] == NULL) {
500 LOGW("user callback for event %d is not set", event);
505 case MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE:
511 muse_camera_msg_get(previous, recv_msg);
512 muse_camera_msg_get(current, recv_msg);
513 muse_camera_msg_get(by_policy, recv_msg);
515 LOGD("STATE CHANGE - previous %d, current %d, by_policy %d",
516 previous, current, by_policy);
518 ((camera_state_changed_cb)cb_info->user_cb[event])((camera_state_e)previous,
519 (camera_state_e)current, (bool)by_policy, cb_info->user_data[event]);
522 case MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE:
526 muse_camera_msg_get(state, recv_msg);
528 LOGD("FOCUS state - %d", state);
530 ((camera_focus_changed_cb)cb_info->user_cb[event])((camera_focus_state_e)state, cb_info->user_data[event]);
533 case MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE:
534 LOGD("CAPTURE_COMPLETED");
535 ((camera_capture_completed_cb)cb_info->user_cb[event])(cb_info->user_data[event]);
537 case MUSE_CAMERA_EVENT_TYPE_PREVIEW:
538 case MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW:
540 camera_preview_data_s frame;
541 unsigned char *buf_pos = NULL;
542 camera_stream_data_s *stream = NULL;
545 int num_buffer_key = 0;
546 int buffer_key[BUFFER_MAX_PLANE_NUM] = {0, };
547 tbm_bo buffer_bo[BUFFER_MAX_PLANE_NUM] = {NULL, };
548 tbm_bo_handle buffer_bo_handle[BUFFER_MAX_PLANE_NUM] = {{.ptr = NULL}, };
549 camera_media_packet_data *mp_data = NULL;
551 muse_camera_msg_get(tbm_key, recv_msg);
552 muse_camera_msg_get(num_buffer_key, recv_msg);
553 muse_camera_msg_get_array(buffer_key, recv_msg);
555 memset(&frame, 0x0, sizeof(camera_preview_data_s));
558 LOGE("invalid key %d", tbm_key);
562 /* import tbm bo and get virtual address */
563 if (!_import_tbm_key(cb_info->bufmgr, tbm_key, &bo, &bo_handle)) {
564 LOGE("failed to import key %d", tbm_key);
566 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
567 cb_info->fd, cb_info, INT, tbm_key);
571 buf_pos = (unsigned char *)bo_handle.ptr;
573 /* get stream info */
574 stream = (camera_stream_data_s *)buf_pos;
576 for (i = 0 ; i < num_buffer_key ; i++) {
577 /* import buffer bo and get virtual address */
578 if (!_import_tbm_key(cb_info->bufmgr, buffer_key[i], &buffer_bo[i], &buffer_bo_handle[i])) {
579 LOGE("failed to import buffer key %d", buffer_key[i]);
581 /* release imported bo */
582 for (i -= 1 ; i >= 0 ; i--)
583 _release_imported_bo(&buffer_bo[i]);
585 _release_imported_bo(&bo);
587 /* send return buffer */
588 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
589 cb_info->fd, cb_info, INT, tbm_key);
594 if (cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW]) {
596 if (stream->format == MM_PIXEL_FORMAT_ITLV_JPEG_UYVY)
597 frame.format = MM_PIXEL_FORMAT_UYVY;
599 frame.format = stream->format;
600 frame.width = stream->width;
601 frame.height = stream->height;
602 frame.timestamp = stream->timestamp;
603 frame.num_of_planes = stream->num_planes;
605 if (num_buffer_key == 0) {
607 buf_pos += sizeof(camera_stream_data_s);
609 if (stream->format == MM_PIXEL_FORMAT_ENCODED_H264) {
610 frame.data.encoded_plane.data = buf_pos;
611 frame.data.encoded_plane.size = stream->data.encoded.length_data;
612 total_size = stream->data.encoded.length_data;
614 switch (stream->num_planes) {
616 frame.data.single_plane.yuv = buf_pos;
617 frame.data.single_plane.size = stream->data.yuv420.length_yuv;
618 total_size = stream->data.yuv420.length_yuv;
621 frame.data.double_plane.y = buf_pos;
622 frame.data.double_plane.y_size = stream->data.yuv420sp.length_y;
623 buf_pos += stream->data.yuv420sp.length_y;
624 frame.data.double_plane.uv = buf_pos;
625 frame.data.double_plane.uv_size = stream->data.yuv420sp.length_uv;
626 total_size = stream->data.yuv420sp.length_y + \
627 stream->data.yuv420sp.length_uv;
630 frame.data.triple_plane.y = buf_pos;
631 frame.data.triple_plane.y_size = stream->data.yuv420p.length_y;
632 buf_pos += stream->data.yuv420p.length_y;
633 frame.data.triple_plane.u = buf_pos;
634 frame.data.triple_plane.u_size = stream->data.yuv420p.length_u;
635 buf_pos += stream->data.yuv420p.length_u;
636 frame.data.triple_plane.v = buf_pos;
637 frame.data.triple_plane.v_size = stream->data.yuv420p.length_v;
638 total_size = stream->data.yuv420p.length_y + \
639 stream->data.yuv420p.length_u + \
640 stream->data.yuv420p.length_v;
648 switch (stream->num_planes) {
650 frame.data.single_plane.yuv = buffer_bo_handle[0].ptr;
651 frame.data.single_plane.size = stream->data.yuv420.length_yuv;
652 total_size = stream->data.yuv420.length_yuv;
655 frame.data.double_plane.y = buffer_bo_handle[0].ptr;
656 if (stream->num_planes == (unsigned int)num_buffer_key)
657 frame.data.double_plane.uv = buffer_bo_handle[1].ptr;
659 frame.data.double_plane.uv = buffer_bo_handle[0].ptr + stream->data.yuv420sp.length_y;
660 frame.data.double_plane.y_size = stream->data.yuv420sp.length_y;
661 frame.data.double_plane.uv_size = stream->data.yuv420sp.length_uv;
662 total_size = stream->data.yuv420sp.length_y + \
663 stream->data.yuv420sp.length_uv;
666 frame.data.triple_plane.y = buffer_bo_handle[0].ptr;
667 if (stream->num_planes == (unsigned int)num_buffer_key) {
668 frame.data.triple_plane.u = buffer_bo_handle[1].ptr;
669 frame.data.triple_plane.v = buffer_bo_handle[2].ptr;
671 frame.data.triple_plane.u = buffer_bo_handle[0].ptr + stream->data.yuv420p.length_y;
672 frame.data.triple_plane.v = buffer_bo_handle[1].ptr + stream->data.yuv420p.length_u;
674 frame.data.triple_plane.y_size = stream->data.yuv420p.length_y;
675 frame.data.triple_plane.u_size = stream->data.yuv420p.length_u;
676 frame.data.triple_plane.v_size = stream->data.yuv420p.length_v;
677 total_size = stream->data.yuv420p.length_y + \
678 stream->data.yuv420p.length_u + \
679 stream->data.yuv420p.length_v;
687 LOGD("PREVIEW_CB - format %d, %dx%d, size %d plane num %d",
688 frame.format, frame.width, frame.height, total_size, frame.num_of_planes);
691 ((camera_preview_cb)cb_info->user_cb[event])(&frame, cb_info->user_data[event]);
693 /*LOGD("PREVIEW_CB retuned");*/
696 if (cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW]) {
697 media_packet_h pkt = NULL;
698 tbm_surface_h tsurf = NULL;
699 uint32_t bo_format = 0;
701 media_format_mimetype_e mimetype = MEDIA_FORMAT_NV12;
702 bool make_pkt_fmt = false;
703 tbm_surface_info_s tsurf_info;
705 memset(&tsurf_info, 0x0, sizeof(tbm_surface_info_s));
707 /* unmap buffer bo */
708 for (i = 0 ; i < num_buffer_key ; i++) {
710 tbm_bo_unmap(buffer_bo[i]);
713 /* create tbm surface */
714 for (i = 0 ; i < BUFFER_MAX_PLANE_NUM ; i++)
715 tsurf_info.planes[i].stride = stream->stride[i];
717 /* get tbm surface format */
718 ret = _camera_get_tbm_surface_format(stream->format, &bo_format);
719 ret |= _camera_get_media_packet_mimetype(stream->format, &mimetype);
721 if (num_buffer_key > 0 && ret == CAMERA_ERROR_NONE) {
722 tsurf_info.width = stream->width;
723 tsurf_info.height = stream->height;
724 tsurf_info.format = bo_format;
725 tsurf_info.bpp = tbm_surface_internal_get_bpp(bo_format);
726 tsurf_info.num_planes = tbm_surface_internal_get_num_planes(bo_format);
729 case TBM_FORMAT_NV12:
730 case TBM_FORMAT_NV21:
731 tsurf_info.planes[0].size = stream->stride[0] * stream->elevation[0];
732 tsurf_info.planes[1].size = stream->stride[1] * stream->elevation[1];
733 tsurf_info.planes[0].offset = 0;
734 if (num_buffer_key == 1)
735 tsurf_info.planes[1].offset = tsurf_info.planes[0].size;
736 tsurf_info.size = tsurf_info.planes[0].size + tsurf_info.planes[1].size;
738 case TBM_FORMAT_YUV420:
739 case TBM_FORMAT_YVU420:
740 tsurf_info.planes[0].size = stream->stride[0] * stream->elevation[0];
741 tsurf_info.planes[1].size = stream->stride[1] * stream->elevation[1];
742 tsurf_info.planes[2].size = stream->stride[2] * stream->elevation[2];
743 tsurf_info.planes[0].offset = 0;
744 if (num_buffer_key == 1) {
745 tsurf_info.planes[1].offset = tsurf_info.planes[0].size;
746 tsurf_info.planes[2].offset = tsurf_info.planes[0].size + tsurf_info.planes[1].size;
748 tsurf_info.size = tsurf_info.planes[0].size + tsurf_info.planes[1].size + tsurf_info.planes[2].size;
750 case TBM_FORMAT_UYVY:
751 case TBM_FORMAT_YUYV:
752 tsurf_info.planes[0].size = (stream->stride[0] * stream->elevation[0]) << 1;
753 tsurf_info.planes[0].offset = 0;
754 tsurf_info.size = tsurf_info.planes[0].size;
760 tsurf = tbm_surface_internal_create_with_bos(&tsurf_info, buffer_bo, num_buffer_key);
761 /*LOGD("tbm surface %p", tsurf);*/
765 /* check media packet format */
766 if (cb_info->pkt_fmt) {
767 int pkt_fmt_width = 0;
768 int pkt_fmt_height = 0;
769 media_format_mimetype_e pkt_fmt_mimetype = MEDIA_FORMAT_NV12;
771 media_format_get_video_info(cb_info->pkt_fmt, &pkt_fmt_mimetype, &pkt_fmt_width, &pkt_fmt_height, NULL, NULL);
772 if (pkt_fmt_mimetype != mimetype ||
773 pkt_fmt_width != stream->width ||
774 pkt_fmt_height != stream->height) {
775 LOGW("different format. current 0x%x, %dx%d, new 0x%x, %dx%d",
776 pkt_fmt_mimetype, pkt_fmt_width, pkt_fmt_height, mimetype, stream->width, stream->height);
777 media_format_unref(cb_info->pkt_fmt);
778 cb_info->pkt_fmt = NULL;
785 /* create packet format */
787 LOGW("make new pkt_fmt - mimetype 0x%x, %dx%d", mimetype, stream->width, stream->height);
788 ret = media_format_create(&cb_info->pkt_fmt);
789 if (ret == MEDIA_FORMAT_ERROR_NONE) {
790 ret = media_format_set_video_mime(cb_info->pkt_fmt, mimetype);
791 ret |= media_format_set_video_width(cb_info->pkt_fmt, stream->width);
792 ret |= media_format_set_video_height(cb_info->pkt_fmt, stream->height);
793 LOGW("media_format_set_video_mime,width,height ret : 0x%x", ret);
795 LOGW("media_format_create failed");
799 /* create media packet */
800 ret = media_packet_create_from_tbm_surface(cb_info->pkt_fmt,
801 tsurf, (media_packet_finalize_cb)_camera_media_packet_finalize,
802 (void *)cb_info, &pkt);
803 if (ret != MEDIA_PACKET_ERROR_NONE) {
804 LOGE("media_packet_create_from_tbm_surface failed");
806 tbm_surface_destroy(tsurf);
810 LOGE("failed to create tbm surface %dx%d, format %d, num_buffer_key %d",
811 stream->width, stream->height, stream->format, num_buffer_key);
815 /*LOGD("media packet %p, internal buffer %p", pkt, stream->internal_buffer);*/
817 mp_data = g_new0(camera_media_packet_data, 1);
819 mp_data->tbm_key = tbm_key;
820 mp_data->num_buffer_key = num_buffer_key;
822 for (i = 0 ; i < num_buffer_key ; i++)
823 mp_data->buffer_bo[i] = buffer_bo[i];
825 /* set media packet data */
826 ret = media_packet_set_extra(pkt, (void *)mp_data);
827 if (ret != MEDIA_PACKET_ERROR_NONE) {
828 LOGE("media_packet_set_extra failed");
835 media_packet_destroy(pkt);
838 int e_type = MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW;
840 /* set timestamp : msec -> nsec */
841 if (media_packet_set_pts(pkt, (uint64_t)(stream->timestamp) * 1000000) != MEDIA_PACKET_ERROR_NONE)
842 LOGW("media_packet_set_pts failed");
844 /* call media packet callback */
845 ((camera_media_packet_preview_cb)cb_info->user_cb[e_type])(pkt, cb_info->user_data[e_type]);
848 LOGE("failed to alloc media packet data");
853 /* send message for preview callback return */
854 muse_camera_msg_send_no_return(MUSE_CAMERA_API_PREVIEW_CB_RETURN, cb_info->fd, cb_info);
856 if (mp_data == NULL) {
857 /* release imported bo */
858 for (i = 0 ; i < num_buffer_key ; i++)
859 _release_imported_bo(&buffer_bo[i]);
861 /* unmap and unref tbm bo */
862 _release_imported_bo(&bo);
865 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
866 cb_info->fd, cb_info, INT, tbm_key);
868 /*LOGD("return buffer Done");*/
872 case MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS:
876 muse_camera_msg_get(percent, recv_msg);
878 LOGD("HDR progress - %d \%", percent);
880 ((camera_attr_hdr_progress_cb)cb_info->user_cb[event])(percent, cb_info->user_data[event]);
883 case MUSE_CAMERA_EVENT_TYPE_INTERRUPTED:
889 muse_camera_msg_get(policy, recv_msg);
890 muse_camera_msg_get(previous, recv_msg);
891 muse_camera_msg_get(current, recv_msg);
893 LOGD("INTERRUPTED - policy %d, state previous %d, current %d",
894 policy, previous, current);
896 ((camera_interrupted_cb)cb_info->user_cb[event])((camera_policy_e)policy,
897 (camera_state_e)previous, (camera_state_e)current, cb_info->user_data[event]);
900 case MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION:
903 camera_detected_face_s *faces = NULL;
905 muse_camera_msg_get(count, recv_msg);
906 muse_camera_msg_get(tbm_key, recv_msg);
908 if (count > 0 && tbm_key > 0) {
909 LOGD("FACE_DETECTION - count %d, tbm_key %d", count, tbm_key);
911 if (!_import_tbm_key(cb_info->bufmgr, tbm_key, &bo, &bo_handle))
915 faces = bo_handle.ptr;
917 ((camera_face_detected_cb)cb_info->user_cb[event])(faces, count, cb_info->user_data[event]);
923 for (i = 0 ; i < count ; i++) {
924 LOGD("id[%2d] - score %d, position (%d,%d,%dx%d)",
925 i, faces[i].score, faces[i].x, faces[i].y, faces[i].width, faces[i].height);
931 _release_imported_bo(&bo);
934 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
935 cb_info->fd, cb_info, INT, tbm_key);
937 LOGD("return buffer done");
939 LOGE("invalid message - count %d, key %d", count, tbm_key);
943 case MUSE_CAMERA_EVENT_TYPE_ERROR:
946 int current_state = 0;
948 muse_camera_msg_get(error, recv_msg);
949 muse_camera_msg_get(current_state, recv_msg);
951 LOGE("ERROR - error 0x%x, current_state %d", error, current_state);
953 ((camera_error_cb)cb_info->user_cb[event])((camera_error_e)error,
954 (camera_state_e)current_state, cb_info->user_data[event]);
957 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_RESOLUTION:
958 muse_camera_msg_get(param1, recv_msg);
959 muse_camera_msg_get(param2, recv_msg);
961 LOGD("SUPPORTED_PREVIEW_RESOLUTION - %d x %d", param1, param2);
963 if (((camera_supported_preview_resolution_cb)cb_info->user_cb[event])(param1, param2, cb_info->user_data[event]) == false) {
964 cb_info->user_cb[event] = NULL;
965 cb_info->user_data[event] = NULL;
966 LOGD("stop foreach callback for SUPPORTED_PREVIEW_RESOLUTION");
969 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_RESOLUTION:
970 muse_camera_msg_get(param1, recv_msg);
971 muse_camera_msg_get(param2, recv_msg);
973 LOGD("SUPPORTED_CAPTURE_RESOLUTION - %d x %d", param1, param2);
975 if (((camera_supported_capture_resolution_cb)cb_info->user_cb[event])(param1, param2, cb_info->user_data[event]) == false) {
976 cb_info->user_cb[event] = NULL;
977 cb_info->user_data[event] = NULL;
978 LOGD("stop foreach callback for SUPPORTED_CAPTURE_RESOLUTION");
981 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_FORMAT:
982 muse_camera_msg_get(param1, recv_msg);
984 LOGD("SUPPORTED_CAPTURE_FORMAT - %d ", param1);
986 if (((camera_supported_capture_format_cb)cb_info->user_cb[event])((camera_pixel_format_e)param1, cb_info->user_data[event]) == false) {
987 cb_info->user_cb[event] = NULL;
988 cb_info->user_data[event] = NULL;
989 LOGD("stop foreach callback for SUPPORTED_CAPTURE_FORMAT");
992 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_FORMAT:
993 muse_camera_msg_get(param1, recv_msg);
995 LOGD("SUPPORTED_PREVIEW_FORMAT - %d ", param1);
997 if (((camera_supported_preview_format_cb)cb_info->user_cb[event])((camera_pixel_format_e)param1, cb_info->user_data[event]) == false) {
998 cb_info->user_cb[event] = NULL;
999 cb_info->user_data[event] = NULL;
1000 LOGD("stop foreach callback for SUPPORTED_PREVIEW_FORMAT");
1003 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_AF_MODE:
1004 muse_camera_msg_get(param1, recv_msg);
1006 LOGD("SUPPORTED_AF_MODE - %d ", param1);
1008 if (((camera_attr_supported_af_mode_cb)cb_info->user_cb[event])((camera_attr_af_mode_e)param1, cb_info->user_data[event]) == false) {
1009 cb_info->user_cb[event] = NULL;
1010 cb_info->user_data[event] = NULL;
1011 LOGD("stop foreach callback for SUPPORTED_AF_MODE");
1014 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EXPOSURE_MODE:
1015 muse_camera_msg_get(param1, recv_msg);
1017 LOGD("SUPPORTED_EXPOSURE_MODE - %d ", param1);
1019 if (((camera_attr_supported_exposure_mode_cb)cb_info->user_cb[event])((camera_attr_exposure_mode_e)param1, cb_info->user_data[event]) == false) {
1020 cb_info->user_cb[event] = NULL;
1021 cb_info->user_data[event] = NULL;
1022 LOGD("stop foreach callback for SUPPORTED_EXPOSURE_MODE");
1025 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_ISO:
1026 muse_camera_msg_get(param1, recv_msg);
1028 LOGD("SUPPORTED_ISO - %d ", param1);
1030 if (((camera_attr_supported_iso_cb)cb_info->user_cb[event])((camera_attr_iso_e)param1, cb_info->user_data[event]) == false) {
1031 cb_info->user_cb[event] = NULL;
1032 cb_info->user_data[event] = NULL;
1033 LOGD("stop foreach callback for SUPPORTED_ISO");
1036 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_WHITEBALANCE:
1037 muse_camera_msg_get(param1, recv_msg);
1039 LOGD("SUPPORTED_WHITEBALANCE - %d ", param1);
1041 if (((camera_attr_supported_whitebalance_cb)cb_info->user_cb[event])((camera_attr_whitebalance_e)param1, cb_info->user_data[event]) == false) {
1042 cb_info->user_cb[event] = NULL;
1043 cb_info->user_data[event] = NULL;
1044 LOGD("stop foreach callback for SUPPORTED_WHITEBALANCE");
1047 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EFFECT:
1048 muse_camera_msg_get(param1, recv_msg);
1050 LOGD("SUPPORTED_EFFECT - %d ", param1);
1052 if (((camera_attr_supported_effect_cb)cb_info->user_cb[event])((camera_attr_effect_mode_e)param1, cb_info->user_data[event]) == false) {
1053 cb_info->user_cb[event] = NULL;
1054 cb_info->user_data[event] = NULL;
1055 LOGD("stop foreach callback for SUPPORTED_EFFECT");
1058 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_SCENE_MODE:
1059 muse_camera_msg_get(param1, recv_msg);
1061 LOGD("SUPPORTED_SCENE_MODE - %d ", param1);
1063 if (((camera_attr_supported_scene_mode_cb)cb_info->user_cb[event])((camera_attr_scene_mode_e)param1, cb_info->user_data[event]) == false) {
1064 cb_info->user_cb[event] = NULL;
1065 cb_info->user_data[event] = NULL;
1066 LOGD("stop foreach callback for SUPPORTED_SCENE_MODE");
1069 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FLASH_MODE:
1070 muse_camera_msg_get(param1, recv_msg);
1072 LOGD("SUPPORTED_FLASH_MODE - %d ", param1);
1074 if (((camera_attr_supported_flash_mode_cb)cb_info->user_cb[event])((camera_attr_flash_mode_e)param1, cb_info->user_data[event]) == false) {
1075 cb_info->user_cb[event] = NULL;
1076 cb_info->user_data[event] = NULL;
1077 LOGD("stop foreach callback for SUPPORTED_FLASH_MODE");
1080 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS:
1081 muse_camera_msg_get(param1, recv_msg);
1083 LOGD("SUPPORTED_FPS - %d ", param1);
1085 if (((camera_attr_supported_fps_cb)cb_info->user_cb[event])((camera_attr_fps_e)param1, cb_info->user_data[event]) == false) {
1086 cb_info->user_cb[event] = NULL;
1087 cb_info->user_data[event] = NULL;
1088 LOGD("stop foreach callback for SUPPORTED_FPS");
1091 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS_BY_RESOLUTION:
1092 muse_camera_msg_get(param1, recv_msg);
1094 LOGD("SUPPORTED_FPS_BY_RESOLUTION - %d ", param1);
1096 if (((camera_attr_supported_fps_cb)cb_info->user_cb[event])((camera_attr_fps_e)param1, cb_info->user_data[event]) == false) {
1097 cb_info->user_cb[event] = NULL;
1098 cb_info->user_data[event] = NULL;
1099 LOGD("stop foreach callback for SUPPORTED_FPS_BY_RESOLUTION");
1102 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_FLIP:
1103 muse_camera_msg_get(param1, recv_msg);
1105 LOGD("SUPPORTED_STREAM_FLIP - %d ", param1);
1107 if (((camera_attr_supported_stream_flip_cb)cb_info->user_cb[event])((camera_flip_e)param1, cb_info->user_data[event]) == false) {
1108 cb_info->user_cb[event] = NULL;
1109 cb_info->user_data[event] = NULL;
1110 LOGD("stop foreach callback for SUPPORTED_STREAM_FLIP");
1113 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION:
1114 muse_camera_msg_get(param1, recv_msg);
1116 LOGD("SUPPORTED_STREAM_ROTATION - %d ", param1);
1118 if (((camera_attr_supported_stream_rotation_cb)cb_info->user_cb[event])((camera_rotation_e)param1, cb_info->user_data[event]) == false) {
1119 cb_info->user_cb[event] = NULL;
1120 cb_info->user_data[event] = NULL;
1121 LOGD("stop foreach callback for SUPPORTED_STREAM_ROTATION");
1124 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE:
1125 muse_camera_msg_get(param1, recv_msg);
1127 LOGD("SUPPORTED_THEATER_MODE - %d ", param1);
1129 if (((camera_attr_supported_theater_mode_cb)cb_info->user_cb[event])((camera_attr_theater_mode_e)param1, cb_info->user_data[event]) == false) {
1130 cb_info->user_cb[event] = NULL;
1131 cb_info->user_data[event] = NULL;
1132 LOGD("stop foreach callback for SUPPORTED_THEATER_MODE");
1135 case MUSE_CAMERA_EVENT_TYPE_CAPTURE:
1137 camera_image_data_s *rImage = NULL;
1138 camera_image_data_s *rPostview = NULL;
1139 camera_image_data_s *rThumbnail = NULL;
1140 unsigned char *buf_pos = NULL;
1141 int is_postview = 0;
1142 int is_thumbnail = 0;
1144 muse_camera_msg_get(tbm_key, recv_msg);
1145 muse_camera_msg_get(is_postview, recv_msg);
1146 muse_camera_msg_get(is_thumbnail, recv_msg);
1148 LOGD("camera capture callback came in. key %d, postview %d, thumbnail %d",
1149 tbm_key, is_postview, is_thumbnail);
1152 LOGE("invalid key %d", tbm_key);
1156 /* import tbm bo and get virtual address */
1157 if (!_import_tbm_key(cb_info->bufmgr, tbm_key, &bo, &bo_handle))
1160 buf_pos = (unsigned char *)bo_handle.ptr;
1161 rImage = (camera_image_data_s *)buf_pos;
1162 rImage->data = buf_pos + sizeof(camera_image_data_s);
1163 buf_pos += sizeof(camera_image_data_s) + rImage->size;
1166 rPostview = (camera_image_data_s *)buf_pos;
1167 LOGD("rPostview->size : %d", rPostview->size);
1168 rPostview->data = buf_pos + sizeof(camera_image_data_s);
1169 buf_pos += sizeof(camera_image_data_s) + rPostview->size;
1173 rThumbnail = (camera_image_data_s *)buf_pos;
1174 LOGD("rThumbnail->size : %d", rThumbnail->size);
1175 rThumbnail->data = buf_pos + sizeof(camera_image_data_s);
1176 buf_pos += sizeof(camera_image_data_s) + rThumbnail->size;
1179 LOGD("image info %dx%d, size : %d", rImage->height, rImage->width, rImage->size);
1181 ((camera_capturing_cb)cb_info->user_cb[event])(rImage, rPostview, rThumbnail, cb_info->user_data[event]);
1183 /* unmap and unref tbm bo */
1184 _release_imported_bo(&bo);
1187 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
1188 cb_info->fd, cb_info, INT, tbm_key);
1190 LOGD("return buffer done");
1193 case MUSE_CAMERA_EVENT_TYPE_VIDEO_FRAME_RENDER_ERROR:
1196 LOGW("Unknown event : %d", event);
1203 static bool _camera_idle_event_callback(void *data)
1205 camera_cb_info_s *cb_info = NULL;
1206 camera_idle_event_s *cam_idle_event = (camera_idle_event_s *)data;
1208 if (cam_idle_event == NULL) {
1209 LOGE("cam_idle_event is NULL");
1214 g_mutex_lock(&cam_idle_event->event_mutex);
1216 cb_info = cam_idle_event->cb_info;
1217 if (cb_info == NULL) {
1218 LOGW("camera cb_info is NULL. event %d", cam_idle_event->event);
1219 goto IDLE_EVENT_CALLBACK_DONE;
1222 /* remove event from list */
1223 g_mutex_lock(&cb_info->idle_event_mutex);
1224 if (cb_info->idle_event_list)
1225 cb_info->idle_event_list = g_list_remove(cb_info->idle_event_list, (gpointer)cam_idle_event);
1227 /*LOGD("remove camera idle event %p, %p", cam_idle_event, cb_info->idle_event_list);*/
1228 g_mutex_unlock(&cb_info->idle_event_mutex);
1231 _client_user_callback(cam_idle_event->cb_info, cam_idle_event->recv_msg, cam_idle_event->event);
1233 /* send signal for waiting thread */
1234 g_cond_signal(&cb_info->idle_event_cond);
1236 IDLE_EVENT_CALLBACK_DONE:
1237 /* unlock and release event */
1238 g_mutex_unlock(&cam_idle_event->event_mutex);
1239 g_mutex_clear(&cam_idle_event->event_mutex);
1241 g_free(cam_idle_event);
1242 cam_idle_event = NULL;
1247 static void *_camera_msg_handler_func(gpointer data)
1252 int event_class = 0;
1253 camera_message_s *cam_msg = NULL;
1254 camera_idle_event_s *cam_idle_event = NULL;
1255 camera_cb_info_s *cb_info = (camera_cb_info_s *)data;
1257 if (cb_info == NULL) {
1258 LOGE("cb_info NULL");
1264 g_mutex_lock(&cb_info->msg_handler_mutex);
1266 while (g_atomic_int_get(&cb_info->msg_handler_running)) {
1267 if (g_queue_is_empty(cb_info->msg_queue)) {
1268 LOGD("signal wait...");
1269 g_cond_wait(&cb_info->msg_handler_cond, &cb_info->msg_handler_mutex);
1270 LOGD("signal received");
1272 if (g_atomic_int_get(&cb_info->msg_handler_running) == 0) {
1273 LOGD("stop event thread");
1278 cam_msg = (camera_message_s *)g_queue_pop_head(cb_info->msg_queue);
1280 g_mutex_unlock(&cb_info->msg_handler_mutex);
1282 if (cam_msg == NULL) {
1283 LOGE("NULL message");
1284 g_mutex_lock(&cb_info->msg_handler_mutex);
1290 if (api < MUSE_CAMERA_API_MAX) {
1291 g_mutex_lock(&cb_info->api_mutex[api]);
1293 if (muse_camera_msg_get(ret, cam_msg->recv_msg)) {
1294 cb_info->api_ret[api] = ret;
1295 cb_info->api_activating[api] = 1;
1297 LOGD("camera api %d - return 0x%x", ret);
1299 g_cond_signal(&cb_info->api_cond[api]);
1301 LOGE("failed to get camera ret for api %d, msg %s", api, cam_msg->recv_msg);
1304 g_mutex_unlock(&cb_info->api_mutex[api]);
1305 } else if (api == MUSE_CAMERA_CB_EVENT) {
1309 if (!muse_camera_msg_get(event, cam_msg->recv_msg) ||
1310 !muse_camera_msg_get(event_class, cam_msg->recv_msg)) {
1311 LOGE("failed to get camera event %d, class %d", event, event_class);
1316 g_mutex_lock(&cb_info->msg_handler_mutex);
1320 switch (event_class) {
1321 case MUSE_CAMERA_EVENT_CLASS_THREAD_SUB:
1322 _client_user_callback(cb_info, cam_msg->recv_msg, event);
1324 case MUSE_CAMERA_EVENT_CLASS_THREAD_MAIN:
1325 cam_idle_event = g_new0(camera_idle_event_s, 1);
1326 if (cam_idle_event == NULL) {
1327 LOGE("cam_idle_event alloc failed");
1331 cam_idle_event->event = event;
1332 cam_idle_event->cb_info = cb_info;
1333 g_mutex_init(&cam_idle_event->event_mutex);
1334 memcpy(cam_idle_event->recv_msg, cam_msg->recv_msg, sizeof(cam_idle_event->recv_msg));
1336 LOGD("add camera event[%d, %p] to IDLE", event, cam_idle_event);
1338 g_mutex_lock(&cb_info->idle_event_mutex);
1339 cb_info->idle_event_list = g_list_append(cb_info->idle_event_list, (gpointer)cam_idle_event);
1340 g_mutex_unlock(&cb_info->idle_event_mutex);
1342 g_idle_add_full(G_PRIORITY_DEFAULT,
1343 (GSourceFunc)_camera_idle_event_callback,
1344 (gpointer)cam_idle_event,
1348 LOGE("unknown camera event class %d", event_class);
1352 LOGE("unknown camera api[%d] message[%s]", api, cam_msg->recv_msg);
1358 g_mutex_lock(&cb_info->msg_handler_mutex);
1361 /* remove remained event */
1362 while (!g_queue_is_empty(cb_info->msg_queue)) {
1363 cam_msg = (camera_message_s *)g_queue_pop_head(cb_info->msg_queue);
1365 LOGD("remove camera message %p", cam_msg);
1369 LOGW("NULL camera message");
1373 g_mutex_unlock(&cb_info->msg_handler_mutex);
1380 static void _camera_remove_idle_event_all(camera_cb_info_s *cb_info)
1382 camera_idle_event_s *cam_idle_event = NULL;
1383 gboolean ret = TRUE;
1385 gint64 end_time = 0;
1387 if (cb_info == NULL) {
1388 LOGE("cb_info is NULL");
1392 g_mutex_lock(&cb_info->idle_event_mutex);
1394 if (cb_info->idle_event_list == NULL) {
1395 LOGD("No idle event is remained.");
1397 list = cb_info->idle_event_list;
1400 cam_idle_event = list->data;
1401 list = g_list_next(list);
1403 if (!cam_idle_event) {
1404 LOGW("Fail to remove idle event. The event is NULL");
1406 if (g_mutex_trylock(&cam_idle_event->event_mutex)) {
1407 ret = g_idle_remove_by_data(cam_idle_event);
1409 LOGD("remove idle event [%p], ret[%d]", cam_idle_event, ret);
1412 cam_idle_event->cb_info = NULL;
1413 LOGW("idle callback for event %p will be called later", cam_idle_event);
1416 cb_info->idle_event_list = g_list_remove(cb_info->idle_event_list, (gpointer)cam_idle_event);
1418 g_mutex_unlock(&cam_idle_event->event_mutex);
1421 g_mutex_clear(&cam_idle_event->event_mutex);
1423 g_free(cam_idle_event);
1424 cam_idle_event = NULL;
1426 LOGD("remove idle event done");
1429 LOGW("event lock failed. it's being called...");
1431 end_time = g_get_monotonic_time() + G_TIME_SPAN_MILLISECOND * 100;
1433 if (g_cond_wait_until(&cb_info->idle_event_cond, &cb_info->idle_event_mutex, end_time))
1434 LOGW("signal received");
1441 g_list_free(cb_info->idle_event_list);
1442 cb_info->idle_event_list = NULL;
1445 g_mutex_unlock(&cb_info->idle_event_mutex);
1450 static void *_camera_msg_recv_func(gpointer data)
1459 char *recv_msg = NULL;
1460 char **parse_str = NULL;
1461 camera_cb_info_s *cb_info = (camera_cb_info_s *)data;
1463 if (cb_info == NULL) {
1464 LOGE("cb_info NULL");
1470 parse_str = (char **)malloc(sizeof(char *) * CAMERA_PARSE_STRING_SIZE);
1471 if (parse_str == NULL) {
1472 LOGE("parse_str malloc failed");
1476 for (i = 0 ; i < CAMERA_PARSE_STRING_SIZE ; i++) {
1477 parse_str[i] = (char *)malloc(sizeof(char) * MUSE_CAMERA_MSG_MAX_LENGTH);
1478 if (parse_str[i] == NULL) {
1479 LOGE("parse_str[%d] malloc failed", i);
1480 goto CB_HANDLER_EXIT;
1484 recv_msg = cb_info->recv_msg;
1486 while (g_atomic_int_get(&cb_info->msg_recv_running)) {
1487 ret = muse_core_ipc_recv_msg(cb_info->fd, recv_msg);
1490 recv_msg[ret] = '\0';
1496 /*LOGD("recvMSg : %s, length : %d", recv_msg, ret);*/
1498 /* Need to split the combined entering msgs.
1499 This module supports up to 200 combined msgs. */
1500 for (str_pos = 0; str_pos < ret; str_pos++) {
1501 if (recv_msg[str_pos] == '}') {
1502 memset(parse_str[num_token], 0x0, sizeof(char) * MUSE_CAMERA_MSG_MAX_LENGTH);
1503 strncpy(parse_str[num_token], recv_msg + prev_pos, str_pos - prev_pos + 1);
1504 LOGD("splitted msg : [%s], Index : %d", parse_str[num_token], num_token);
1505 prev_pos = str_pos+1;
1510 /*LOGD("num_token : %d", num_token);*/
1512 /* Re-construct to the useful single msg. */
1513 for (i = 0; i < num_token; i++) {
1514 if (i >= CAMERA_PARSE_STRING_SIZE) {
1515 LOGE("invalid token index %d", i);
1522 if (!muse_camera_msg_get(api, parse_str[i])) {
1523 LOGE("failed to get camera api");
1527 if (api != MUSE_CAMERA_CB_EVENT) {
1528 LOGD("check api_class");
1529 if (muse_camera_msg_get(api_class, parse_str[i]))
1530 LOGD("camera api_class[%d]", api_class);
1533 if (api_class == MUSE_CAMERA_API_CLASS_IMMEDIATE) {
1534 g_mutex_lock(&cb_info->api_mutex[api]);
1536 if (!muse_camera_msg_get(ret, parse_str[i])) {
1537 LOGE("failed to get camera ret");
1538 g_mutex_unlock(&cb_info->api_mutex[api]);
1542 cb_info->api_ret[api] = ret;
1543 cb_info->api_activating[api] = 1;
1545 if (api == MUSE_CAMERA_API_CREATE) {
1546 if (ret != CAMERA_ERROR_NONE) {
1547 g_atomic_int_set(&cb_info->msg_recv_running, 0);
1548 LOGE("camera create error 0x%x. close client cb handler", ret);
1550 } else if (api == MUSE_CAMERA_API_DESTROY) {
1551 if (ret == CAMERA_ERROR_NONE) {
1552 g_atomic_int_set(&cb_info->msg_recv_running, 0);
1553 LOGD("camera destroy done. close client cb handler");
1557 g_cond_signal(&cb_info->api_cond[api]);
1558 g_mutex_unlock(&cb_info->api_mutex[api]);
1559 } else if (api_class == MUSE_CAMERA_API_CLASS_THREAD_SUB || api == MUSE_CAMERA_CB_EVENT) {
1560 camera_message_s *cam_msg = g_new0(camera_message_s, 1);
1561 if (cam_msg == NULL) {
1562 LOGE("failed to alloc cam_msg");
1567 memcpy(cam_msg->recv_msg, parse_str[i], sizeof(cam_msg->recv_msg));
1569 LOGD("add camera message to queue : api %d", api);
1571 g_mutex_lock(&cb_info->msg_handler_mutex);
1572 g_queue_push_tail(cb_info->msg_queue, (gpointer)cam_msg);
1573 g_cond_signal(&cb_info->msg_handler_cond);
1574 g_mutex_unlock(&cb_info->msg_handler_mutex);
1576 LOGW("unknown camera api %d and api_class %d", api, api_class);
1582 LOGD("client cb exit");
1586 for (i = 0 ; i < CAMERA_PARSE_STRING_SIZE ; i++) {
1589 parse_str[i] = NULL;
1600 static camera_cb_info_s *_client_callback_new(gint sockfd)
1602 camera_cb_info_s *cb_info = NULL;
1603 gint *tmp_activating = NULL;
1604 gint *tmp_ret = NULL;
1607 g_return_val_if_fail(sockfd > 0, NULL);
1609 cb_info = g_new0(camera_cb_info_s, 1);
1610 if (cb_info == NULL) {
1611 LOGE("cb_info failed");
1615 g_mutex_init(&cb_info->msg_handler_mutex);
1616 g_cond_init(&cb_info->msg_handler_cond);
1617 g_mutex_init(&cb_info->idle_event_mutex);
1618 g_cond_init(&cb_info->idle_event_cond);
1620 for (i = 0 ; i < MUSE_CAMERA_API_MAX ; i++) {
1621 g_mutex_init(&cb_info->api_mutex[i]);
1622 g_cond_init(&cb_info->api_cond[i]);
1625 tmp_activating = g_new0(gint, MUSE_CAMERA_API_MAX);
1626 if (tmp_activating == NULL) {
1627 LOGE("tmp_activating failed");
1631 tmp_ret = g_new0(gint, MUSE_CAMERA_API_MAX);
1632 if (tmp_ret == NULL) {
1633 LOGE("tmp_ret failed");
1637 cb_info->msg_queue = g_queue_new();
1638 if (cb_info->msg_queue == NULL) {
1639 LOGE("msg_queue new failed");
1643 g_atomic_int_set(&cb_info->msg_handler_running, 1);
1644 cb_info->msg_handler_thread = g_thread_try_new("camera_msg_handler",
1645 _camera_msg_handler_func, (gpointer)cb_info, NULL);
1646 if (cb_info->msg_handler_thread == NULL) {
1647 LOGE("message handler thread creation failed");
1651 cb_info->fd = sockfd;
1652 cb_info->api_activating = tmp_activating;
1653 cb_info->api_ret = tmp_ret;
1655 g_atomic_int_set(&cb_info->msg_recv_running, 1);
1656 cb_info->msg_recv_thread = g_thread_try_new("camera_msg_recv",
1657 _camera_msg_recv_func, (gpointer)cb_info, NULL);
1658 if (cb_info->msg_recv_thread == NULL) {
1659 LOGE("message receive thread creation failed");
1667 if (cb_info->msg_handler_thread) {
1668 g_mutex_lock(&cb_info->msg_handler_mutex);
1669 g_atomic_int_set(&cb_info->msg_handler_running, 0);
1670 g_cond_signal(&cb_info->msg_handler_cond);
1671 g_mutex_unlock(&cb_info->msg_handler_mutex);
1673 g_thread_join(cb_info->msg_handler_thread);
1674 g_thread_unref(cb_info->msg_handler_thread);
1675 cb_info->msg_handler_thread = NULL;
1678 for (i = 0 ; i < MUSE_CAMERA_API_MAX ; i++) {
1679 g_mutex_clear(&cb_info->api_mutex[i]);
1680 g_cond_clear(&cb_info->api_cond[i]);
1683 g_mutex_clear(&cb_info->msg_handler_mutex);
1684 g_cond_clear(&cb_info->msg_handler_cond);
1685 g_mutex_clear(&cb_info->idle_event_mutex);
1686 g_cond_clear(&cb_info->idle_event_cond);
1688 if (cb_info->msg_queue) {
1689 g_queue_free(cb_info->msg_queue);
1690 cb_info->msg_queue = NULL;
1697 if (tmp_activating) {
1698 g_free(tmp_activating);
1699 tmp_activating = NULL;
1709 static void _client_callback_destroy(camera_cb_info_s *cb_info)
1713 g_return_if_fail(cb_info != NULL);
1715 LOGD("MSG receive thread[%p] destroy", cb_info->msg_recv_thread);
1717 g_thread_join(cb_info->msg_recv_thread);
1718 g_thread_unref(cb_info->msg_recv_thread);
1719 cb_info->msg_recv_thread = NULL;
1721 LOGD("msg thread removed");
1723 g_mutex_lock(&cb_info->msg_handler_mutex);
1724 g_atomic_int_set(&cb_info->msg_handler_running, 0);
1725 g_cond_signal(&cb_info->msg_handler_cond);
1726 g_mutex_unlock(&cb_info->msg_handler_mutex);
1728 g_thread_join(cb_info->msg_handler_thread);
1729 g_thread_unref(cb_info->msg_handler_thread);
1730 cb_info->msg_handler_thread = NULL;
1732 g_queue_free(cb_info->msg_queue);
1733 cb_info->msg_queue = NULL;
1735 for (i = 0 ; i < MUSE_CAMERA_API_MAX ; i++) {
1736 g_mutex_clear(&cb_info->api_mutex[i]);
1737 g_cond_clear(&cb_info->api_cond[i]);
1740 g_mutex_clear(&cb_info->msg_handler_mutex);
1741 g_cond_clear(&cb_info->msg_handler_cond);
1742 g_mutex_clear(&cb_info->idle_event_mutex);
1743 g_cond_clear(&cb_info->idle_event_cond);
1745 LOGD("event thread removed");
1747 if (cb_info->fd > -1) {
1748 muse_core_connection_close(cb_info->fd);
1752 if (cb_info->bufmgr) {
1753 tbm_bufmgr_deinit(cb_info->bufmgr);
1754 cb_info->bufmgr = NULL;
1756 if (cb_info->api_activating) {
1757 g_free(cb_info->api_activating);
1758 cb_info->api_activating = NULL;
1760 if (cb_info->api_ret) {
1761 g_free(cb_info->api_ret);
1762 cb_info->api_ret = NULL;
1764 if (cb_info->pkt_fmt) {
1765 media_format_unref(cb_info->pkt_fmt);
1766 cb_info->pkt_fmt = NULL;
1775 int camera_create(camera_device_e device, camera_h *camera)
1779 int ret = CAMERA_ERROR_NONE;
1781 camera_cli_s *pc = NULL;
1782 tbm_bufmgr bufmgr = NULL;
1784 muse_camera_api_e api = MUSE_CAMERA_API_CREATE;
1785 muse_core_api_module_e muse_module = MUSE_CAMERA;
1786 int device_type = (int)device;
1788 if (camera == NULL) {
1789 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
1790 return CAMERA_ERROR_INVALID_PARAMETER;
1793 bufmgr = tbm_bufmgr_init(-1);
1794 if (bufmgr == NULL) {
1795 LOGE("get tbm bufmgr failed");
1796 return CAMERA_ERROR_INVALID_OPERATION;
1799 sock_fd = muse_core_client_new();
1801 LOGE("muse_core_client_new failed - returned fd %d", sock_fd);
1802 ret = CAMERA_ERROR_INVALID_OPERATION;
1808 sndMsg = muse_core_msg_json_factory_new(api,
1809 MUSE_TYPE_INT, "module", muse_module,
1810 MUSE_TYPE_INT, PARAM_DEVICE_TYPE, device_type,
1811 MUSE_TYPE_INT, "pid", pid,
1814 muse_core_ipc_send_msg(sock_fd, sndMsg);
1815 muse_core_msg_json_factory_free(sndMsg);
1817 pc = g_new0(camera_cli_s, 1);
1819 LOGE("camera_cli_s alloc failed");
1820 ret = CAMERA_ERROR_OUT_OF_MEMORY;
1824 pc->cb_info = _client_callback_new(sock_fd);
1825 if (pc->cb_info == NULL) {
1826 LOGE("cb_info alloc failed");
1827 ret = CAMERA_ERROR_OUT_OF_MEMORY;
1831 LOGD("cb info : %d", pc->cb_info->fd);
1833 ret = _client_wait_for_cb_return(api, pc->cb_info, CALLBACK_TIME_OUT);
1834 if (ret == CAMERA_ERROR_NONE) {
1835 intptr_t handle = 0;
1836 muse_camera_msg_get_pointer(handle, pc->cb_info->recv_msg);
1838 LOGE("Receiving Handle Failed!!");
1839 ret = CAMERA_ERROR_INVALID_OPERATION;
1843 pc->remote_handle = handle;
1844 pc->cb_info->bufmgr = bufmgr;
1846 ret = camera_set_display((camera_h)pc, CAMERA_DISPLAY_TYPE_NONE, NULL);
1847 if (ret != CAMERA_ERROR_NONE) {
1848 LOGE("init display failed 0x%x", ret);
1852 LOGD("camera create 0x%x", pc->remote_handle);
1853 *camera = (camera_h)pc;
1861 tbm_bufmgr_deinit(bufmgr);
1865 _client_callback_destroy(pc->cb_info);
1871 LOGE("camera create error : 0x%x", ret);
1876 int camera_destroy(camera_h camera)
1878 if (camera == NULL) {
1879 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
1880 return CAMERA_ERROR_INVALID_PARAMETER;
1883 int ret = CAMERA_ERROR_NONE;
1884 muse_camera_api_e api = MUSE_CAMERA_API_DESTROY;
1885 camera_cli_s *pc = (camera_cli_s *)camera;
1890 if (pc->cb_info == NULL) {
1891 LOGE("cb_info NULL, INVALID_PARAMETER");
1892 return CAMERA_ERROR_INVALID_PARAMETER;
1895 sock_fd = pc->cb_info->fd;
1897 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
1898 if (ret == CAMERA_ERROR_NONE) {
1899 _camera_remove_idle_event_all(pc->cb_info);
1900 _client_callback_destroy(pc->cb_info);
1906 LOGE("camera destroy error : 0x%x", ret);
1912 int camera_start_preview(camera_h camera)
1914 int ret = CAMERA_ERROR_NONE;
1915 muse_camera_api_e api = MUSE_CAMERA_API_START_PREVIEW;
1916 camera_cli_s *pc = (camera_cli_s *)camera;
1919 if (camera == NULL) {
1920 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
1921 return CAMERA_ERROR_INVALID_PARAMETER;
1924 if (pc->cb_info == NULL) {
1925 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
1926 return CAMERA_ERROR_INVALID_PARAMETER;
1931 sock_fd = pc->cb_info->fd;
1933 muse_camera_msg_send_longtime(api, sock_fd, pc->cb_info, ret);
1935 if (ret != CAMERA_ERROR_NONE) {
1936 LOGE("start preview failed 0x%x", ret);
1940 LOGD("ret : 0x%x", ret);
1942 return CAMERA_ERROR_NONE;
1945 int camera_stop_preview(camera_h camera)
1947 int ret = CAMERA_ERROR_NONE;
1949 camera_cli_s *pc = NULL;
1950 muse_camera_api_e api = MUSE_CAMERA_API_STOP_PREVIEW;
1952 if (camera == NULL) {
1953 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
1954 return CAMERA_ERROR_INVALID_PARAMETER;
1957 pc = (camera_cli_s *)camera;
1959 if (pc->cb_info == NULL) {
1960 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
1961 return CAMERA_ERROR_INVALID_PARAMETER;
1964 sock_fd = pc->cb_info->fd;
1968 /* send stop preview message */
1969 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
1971 LOGD("ret : 0x%x", ret);
1976 int camera_start_capture(camera_h camera, camera_capturing_cb capturing_cb, camera_capture_completed_cb completed_cb, void *user_data)
1978 if (camera == NULL) {
1979 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
1980 return CAMERA_ERROR_INVALID_PARAMETER;
1982 int ret = CAMERA_ERROR_NONE;
1984 camera_cli_s *pc = (camera_cli_s *)camera;
1985 muse_camera_api_e api = MUSE_CAMERA_API_START_CAPTURE;
1987 int is_capturing_cb = 0;
1988 int is_completed_cb = 0;
1989 LOGD("Enter, handle :%x", pc->remote_handle);
1991 if (pc->cb_info == NULL) {
1992 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
1993 return CAMERA_ERROR_INVALID_PARAMETER;
1996 sock_fd = pc->cb_info->fd;
1998 if (capturing_cb != NULL) {
1999 is_capturing_cb = 1;
2000 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = capturing_cb;
2001 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = user_data;
2004 if (completed_cb != NULL) {
2005 is_completed_cb = 1;
2006 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = completed_cb;
2007 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = user_data;
2010 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, is_capturing_cb, INT, is_completed_cb);
2011 LOGD("is_capturing_cb :%d, is_completed_cb : %d", is_capturing_cb, is_completed_cb);
2012 LOGD("ret : 0x%x", ret);
2016 bool camera_is_supported_continuous_capture(camera_h camera)
2018 if (camera == NULL) {
2019 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2023 int ret = CAMERA_ERROR_NONE;
2024 camera_cli_s *pc = (camera_cli_s *)camera;
2025 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_CONTINUOUS_CAPTURE;
2028 if (pc->cb_info == NULL) {
2029 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2030 return CAMERA_ERROR_INVALID_PARAMETER;
2033 sock_fd = pc->cb_info->fd;
2035 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2036 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2037 LOGD("ret : 0x%x", ret);
2041 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)
2043 if (camera == NULL) {
2044 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2045 return CAMERA_ERROR_INVALID_PARAMETER;
2048 int ret = CAMERA_ERROR_NONE;
2050 camera_cli_s *pc = (camera_cli_s *)camera;
2051 muse_camera_api_e api = MUSE_CAMERA_API_START_CONTINUOUS_CAPTURE;
2053 LOGD("Enter, handle :%x", pc->remote_handle);
2056 if (pc->cb_info == NULL) {
2057 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2058 return CAMERA_ERROR_INVALID_PARAMETER;
2060 sock_fd = pc->cb_info->fd;
2062 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = capturing_cb;
2063 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = user_data;
2064 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = completed_cb;
2066 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, count, INT, interval);
2068 LOGD("ret : 0x%x", ret);
2073 int camera_stop_continuous_capture(camera_h camera)
2075 if (camera == NULL) {
2076 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2077 return CAMERA_ERROR_INVALID_PARAMETER;
2081 int ret = CAMERA_ERROR_NONE;
2083 camera_cli_s *pc = (camera_cli_s *)camera;
2084 muse_camera_api_e api = MUSE_CAMERA_API_STOP_CONTINUOUS_CAPTURE;
2085 LOGD("Enter, handle :%x", pc->remote_handle);
2087 if (pc->cb_info == NULL) {
2088 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2089 return CAMERA_ERROR_INVALID_PARAMETER;
2091 sock_fd = pc->cb_info->fd;
2092 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2093 LOGD("ret : 0x%x", ret);
2097 bool camera_is_supported_face_detection(camera_h camera)
2099 if (camera == NULL) {
2100 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2103 int ret = CAMERA_ERROR_NONE;
2105 camera_cli_s *pc = (camera_cli_s *)camera;
2106 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_FACE_DETECTION;
2108 if (pc->cb_info == NULL) {
2109 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2110 return CAMERA_ERROR_INVALID_PARAMETER;
2112 sock_fd = pc->cb_info->fd;
2114 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2115 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2116 LOGD("ret : 0x%x", ret);
2120 bool camera_is_supported_zero_shutter_lag(camera_h camera)
2122 if (camera == NULL) {
2123 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2126 int ret = CAMERA_ERROR_NONE;
2128 camera_cli_s *pc = (camera_cli_s *)camera;
2129 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_ZERO_SHUTTER_LAG;
2131 if (pc->cb_info == NULL) {
2132 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2133 return CAMERA_ERROR_INVALID_PARAMETER;
2135 sock_fd = pc->cb_info->fd;
2137 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2138 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2139 LOGD("ret : 0x%x", ret);
2143 bool camera_is_supported_media_packet_preview_cb(camera_h camera)
2145 if (camera == NULL) {
2146 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2150 int ret = CAMERA_ERROR_NONE;
2152 camera_cli_s *pc = (camera_cli_s *)camera;
2153 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_MEDIA_PACKET_PREVIEW_CB;
2155 if (pc->cb_info == NULL) {
2156 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2157 return CAMERA_ERROR_INVALID_PARAMETER;
2159 sock_fd = pc->cb_info->fd;
2161 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2162 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2163 LOGD("ret : 0x%x", ret);
2167 int camera_get_device_count(camera_h camera, int *device_count)
2169 if (camera == NULL || device_count == NULL) {
2170 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2171 return CAMERA_ERROR_INVALID_PARAMETER;
2173 int ret = CAMERA_ERROR_NONE;
2175 camera_cli_s *pc = (camera_cli_s *)camera;
2176 muse_camera_api_e api = MUSE_CAMERA_API_GET_DEVICE_COUNT;
2178 if (pc->cb_info == NULL) {
2179 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2180 return CAMERA_ERROR_INVALID_PARAMETER;
2182 sock_fd = pc->cb_info->fd;
2183 int get_device_count;
2185 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2186 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2188 if (ret == CAMERA_ERROR_NONE) {
2189 muse_camera_msg_get(get_device_count, pc->cb_info->recv_msg);
2190 *device_count = get_device_count;
2192 LOGD("ret : 0x%x", ret);
2196 int camera_start_face_detection(camera_h camera, camera_face_detected_cb callback, void *user_data)
2198 if (camera == NULL) {
2199 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2200 return CAMERA_ERROR_INVALID_PARAMETER;
2203 int ret = CAMERA_ERROR_NONE;
2205 camera_cli_s *pc = (camera_cli_s *)camera;
2206 muse_camera_api_e api = MUSE_CAMERA_API_START_FACE_DETECTION;
2208 LOGD("Enter, handle :%x", pc->remote_handle);
2210 if (pc->cb_info == NULL) {
2211 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2212 return CAMERA_ERROR_INVALID_PARAMETER;
2214 sock_fd = pc->cb_info->fd;
2215 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION] = callback;
2216 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION] = user_data;
2218 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2219 LOGD("ret : 0x%x", ret);
2223 int camera_stop_face_detection(camera_h camera)
2225 if (camera == NULL) {
2226 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2227 return CAMERA_ERROR_INVALID_PARAMETER;
2230 int ret = CAMERA_ERROR_NONE;
2232 camera_cli_s *pc = (camera_cli_s *)camera;
2233 muse_camera_api_e api = MUSE_CAMERA_API_STOP_FACE_DETECTION;
2234 LOGD("Enter, handle :%x", pc->remote_handle);
2236 if (pc->cb_info == NULL) {
2237 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2238 return CAMERA_ERROR_INVALID_PARAMETER;
2240 sock_fd = pc->cb_info->fd;
2241 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2242 LOGD("ret : 0x%x", ret);
2246 int camera_get_state(camera_h camera, camera_state_e * state)
2248 if (camera == NULL || state == NULL) {
2249 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2250 return CAMERA_ERROR_INVALID_PARAMETER;
2252 int ret = CAMERA_ERROR_NONE;
2254 camera_cli_s *pc = (camera_cli_s *)camera;
2255 muse_camera_api_e api = MUSE_CAMERA_API_GET_STATE;
2257 if (pc->cb_info == NULL) {
2258 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2259 return CAMERA_ERROR_INVALID_PARAMETER;
2261 sock_fd = pc->cb_info->fd;
2264 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2265 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2267 if (ret == CAMERA_ERROR_NONE) {
2268 muse_camera_msg_get(get_state, pc->cb_info->recv_msg);
2269 *state = (camera_state_e)get_state;
2271 LOGD("ret : 0x%x", ret);
2275 int camera_start_focusing(camera_h camera, bool continuous)
2277 if (camera == NULL) {
2278 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2279 return CAMERA_ERROR_INVALID_PARAMETER;
2282 int ret = CAMERA_ERROR_NONE;
2284 camera_cli_s *pc = (camera_cli_s *)camera;
2285 muse_camera_api_e api = MUSE_CAMERA_API_START_FOCUSING;
2287 if (pc->cb_info == NULL) {
2288 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2289 return CAMERA_ERROR_INVALID_PARAMETER;
2291 sock_fd = pc->cb_info->fd;
2292 int is_continuous = (int)continuous;
2294 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2295 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, is_continuous);
2296 LOGD("ret : 0x%x", ret);
2300 int camera_cancel_focusing(camera_h camera)
2302 if (camera == NULL) {
2303 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2304 return CAMERA_ERROR_INVALID_PARAMETER;
2307 int ret = CAMERA_ERROR_NONE;
2309 camera_cli_s *pc = (camera_cli_s *)camera;
2310 muse_camera_api_e api = MUSE_CAMERA_API_CANCEL_FOCUSING;
2312 if (pc->cb_info == NULL) {
2313 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2314 return CAMERA_ERROR_INVALID_PARAMETER;
2316 sock_fd = pc->cb_info->fd;
2318 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2319 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2320 LOGD("ret : 0x%x", ret);
2324 int camera_set_display(camera_h camera, camera_display_type_e type, camera_display_h display)
2326 int ret = CAMERA_ERROR_NONE;
2327 void *set_display_handle = NULL;
2328 Evas_Object *obj = NULL;
2329 const char *object_type = NULL;
2331 camera_wl_info_s *wl_info = NULL;
2332 #endif /* HAVE_WAYLAND */
2334 if (camera == NULL) {
2335 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2336 return CAMERA_ERROR_INVALID_PARAMETER;
2339 if (type < CAMERA_DISPLAY_TYPE_OVERLAY || type > CAMERA_DISPLAY_TYPE_NONE) {
2340 LOGE("invalid type %d", type);
2341 return CAMERA_ERROR_INVALID_PARAMETER;
2344 if (type != CAMERA_DISPLAY_TYPE_NONE && display == NULL) {
2345 LOGE("display type[%d] is not NONE, but display handle is NULL", type);
2346 return CAMERA_ERROR_INVALID_PARAMETER;
2349 camera_cli_s *pc = (camera_cli_s *)camera;
2350 muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY;
2352 if (pc->cb_info == NULL) {
2353 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2354 return CAMERA_ERROR_INVALID_PARAMETER;
2356 sock_fd = pc->cb_info->fd;
2358 LOGD("Enter, remote_handle : %x display : 0x%x", pc->remote_handle, display);
2360 if (type == CAMERA_DISPLAY_TYPE_NONE) {
2361 set_display_handle = 0;
2362 LOGD("display type NONE");
2364 obj = (Evas_Object *)display;
2365 object_type = evas_object_type_get(obj);
2367 if (type == CAMERA_DISPLAY_TYPE_OVERLAY && !strcmp(object_type, "elm_win")) {
2369 /* get wayland parent id */
2370 if (_get_wl_info(obj, &pc->wl_info) != CAMERA_ERROR_NONE) {
2371 LOGE("failed to get wayland info");
2372 return CAMERA_ERROR_INVALID_OPERATION;
2375 set_display_handle = (void *)&pc->wl_info;
2376 #else /* HAVE_WAYLAND */
2377 /* x window overlay surface */
2378 set_display_handle = (void *)elm_win_xwindow_get(obj);
2379 #endif /* HAVE_WAYLAND */
2380 LOGD("display type OVERLAY : handle %p", set_display_handle);
2381 } else if (type == CAMERA_DISPLAY_TYPE_EVAS && !strcmp(object_type, "image")) {
2382 /* evas object surface */
2383 set_display_handle = (void *)display;
2384 LOGD("display type EVAS : handle %p", set_display_handle);
2386 LOGE("unknown evas object [%p,%s] or type [%d] mismatch", obj, object_type, type);
2387 return CAMERA_ERROR_INVALID_PARAMETER;
2390 LOGE("failed to get evas object type from %p", obj);
2391 return CAMERA_ERROR_INVALID_PARAMETER;
2395 pc->display_handle = (intptr_t)set_display_handle;
2397 if (type == CAMERA_DISPLAY_TYPE_OVERLAY) {
2399 wl_info = &pc->wl_info;
2400 muse_camera_msg_send_array_and_value(api, sock_fd, pc->cb_info, ret,
2401 wl_info, 5, sizeof(int), INT, type);
2403 LOGD("wayland parent id : %d, window %d,%d,%dx%d",
2404 wl_info->parent_id, wl_info->window_x, wl_info->window_y,
2405 wl_info->window_width, wl_info->window_height);
2406 #else /* HAVE_WAYLAND */
2407 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, type, INT, set_display_handle);
2409 LOGD("x id : %d", (int)set_display_handle);
2410 #endif /* HAVE_WAYLAND */
2412 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, type);
2414 if (ret != CAMERA_ERROR_NONE)
2415 LOGE("set display error 0x%x", ret);
2420 int camera_set_preview_resolution(camera_h camera, int width, int height)
2422 if (camera == NULL) {
2423 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2424 return CAMERA_ERROR_INVALID_PARAMETER;
2426 int ret = CAMERA_ERROR_NONE;
2428 camera_cli_s *pc = (camera_cli_s *)camera;
2429 muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_RESOLUTION;
2431 if (pc->cb_info == NULL) {
2432 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2433 return CAMERA_ERROR_INVALID_PARAMETER;
2435 sock_fd = pc->cb_info->fd;
2437 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2438 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, width, INT, height);
2439 LOGD("ret : 0x%x", ret);
2444 int camera_set_capture_resolution(camera_h camera, int width, int height)
2446 if (camera == NULL) {
2447 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2448 return CAMERA_ERROR_INVALID_PARAMETER;
2451 int ret = CAMERA_ERROR_NONE;
2453 camera_cli_s *pc = (camera_cli_s *)camera;
2454 muse_camera_api_e api = MUSE_CAMERA_API_SET_CAPTURE_RESOLUTION;
2456 if (pc->cb_info == NULL) {
2457 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2458 return CAMERA_ERROR_INVALID_PARAMETER;
2460 sock_fd = pc->cb_info->fd;
2462 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2463 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, width, INT, height);
2464 LOGD("ret : 0x%x", ret);
2468 int camera_set_capture_format(camera_h camera, camera_pixel_format_e format)
2470 if (camera == NULL) {
2471 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2472 return CAMERA_ERROR_INVALID_PARAMETER;
2475 int ret = CAMERA_ERROR_NONE;
2476 int set_format = (int)format;
2478 camera_cli_s *pc = (camera_cli_s *)camera;
2479 muse_camera_api_e api = MUSE_CAMERA_API_SET_CAPTURE_FORMAT;
2481 if (pc->cb_info == NULL) {
2482 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2483 return CAMERA_ERROR_INVALID_PARAMETER;
2485 sock_fd = pc->cb_info->fd;
2487 LOGD("Enter, remote_handle : %x, capture_format: %d", pc->remote_handle, set_format);
2488 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_format);
2489 LOGD("ret : 0x%x", ret);
2493 int camera_set_preview_format(camera_h camera, camera_pixel_format_e format)
2495 if (camera == NULL) {
2496 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2497 return CAMERA_ERROR_INVALID_PARAMETER;
2500 int ret = CAMERA_ERROR_NONE;
2501 int set_format = (int)format;
2503 camera_cli_s *pc = (camera_cli_s *)camera;
2504 muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_FORMAT;
2506 if (pc->cb_info == NULL) {
2507 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2508 return CAMERA_ERROR_INVALID_PARAMETER;
2510 sock_fd = pc->cb_info->fd;
2512 LOGD("Enter, remote_handle : %x, capture_format: %d", pc->remote_handle, set_format);
2513 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_format);
2514 LOGD("ret : 0x%x", ret);
2518 int camera_get_preview_resolution(camera_h camera, int *width, int *height)
2520 if (camera == NULL || width == NULL || height == NULL) {
2521 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2522 return CAMERA_ERROR_INVALID_PARAMETER;
2526 int ret = CAMERA_ERROR_NONE;
2528 camera_cli_s *pc = (camera_cli_s *)camera;
2529 muse_camera_api_e api = MUSE_CAMERA_API_GET_PREVIEW_RESOLUTION;
2531 if (pc->cb_info == NULL) {
2532 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2533 return CAMERA_ERROR_INVALID_PARAMETER;
2535 sock_fd = pc->cb_info->fd;
2539 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2540 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2542 if (ret == CAMERA_ERROR_NONE) {
2543 muse_camera_msg_get(get_width, pc->cb_info->recv_msg);
2544 muse_camera_msg_get(get_height, pc->cb_info->recv_msg);
2546 *height = get_height;
2548 LOGD("ret : 0x%x", ret);
2552 int camera_set_display_rotation(camera_h camera, camera_rotation_e rotation)
2554 int ret = CAMERA_ERROR_NONE;
2555 int set_rotation = (int)rotation;
2556 camera_cli_s *pc = NULL;
2558 if (camera == NULL) {
2559 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2560 return CAMERA_ERROR_INVALID_PARAMETER;
2563 if (rotation < CAMERA_ROTATION_NONE || rotation > CAMERA_ROTATION_270) {
2564 LOGE("Invalid rotation %d", rotation);
2565 return CAMERA_ERROR_INVALID_PARAMETER;
2568 pc = (camera_cli_s *)camera;
2570 if (pc->cb_info == NULL) {
2571 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2572 return CAMERA_ERROR_INVALID_PARAMETER;
2575 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_ROTATION,
2576 pc->cb_info->fd, pc->cb_info, ret, INT, set_rotation);
2581 int camera_get_display_rotation(camera_h camera, camera_rotation_e *rotation)
2583 int ret = CAMERA_ERROR_NONE;
2584 int get_rotation = CAMERA_ROTATION_NONE;
2585 camera_cli_s *pc = NULL;
2587 if (camera == NULL || rotation == NULL) {
2588 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2589 return CAMERA_ERROR_INVALID_PARAMETER;
2592 pc = (camera_cli_s *)camera;
2594 if (pc->cb_info == NULL) {
2595 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2596 return CAMERA_ERROR_INVALID_PARAMETER;
2599 muse_camera_msg_send(MUSE_CAMERA_API_GET_DISPLAY_ROTATION,
2600 pc->cb_info->fd, pc->cb_info, ret);
2602 if (ret == CAMERA_ERROR_NONE) {
2603 muse_camera_msg_get(get_rotation, pc->cb_info->recv_msg);
2604 *rotation = (camera_rotation_e)get_rotation;
2610 int camera_set_display_flip(camera_h camera, camera_flip_e flip)
2612 int ret = CAMERA_ERROR_NONE;
2613 int set_flip = (int)flip;
2614 camera_cli_s *pc = NULL;
2616 if (camera == NULL) {
2617 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2618 return CAMERA_ERROR_INVALID_PARAMETER;
2621 if (flip < CAMERA_FLIP_NONE || flip > CAMERA_FLIP_BOTH) {
2622 LOGE("Invalid flip %d", flip);
2623 return CAMERA_ERROR_INVALID_PARAMETER;
2626 pc = (camera_cli_s *)camera;
2628 if (pc->cb_info == NULL) {
2629 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2630 return CAMERA_ERROR_INVALID_PARAMETER;
2633 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_FLIP,
2634 pc->cb_info->fd, pc->cb_info, ret, INT, set_flip);
2639 int camera_get_display_flip(camera_h camera, camera_flip_e *flip)
2641 int ret = CAMERA_ERROR_NONE;
2642 int get_flip = CAMERA_FLIP_NONE;
2643 camera_cli_s *pc = NULL;
2645 if (camera == NULL || flip == NULL) {
2646 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2647 return CAMERA_ERROR_INVALID_PARAMETER;
2650 pc = (camera_cli_s *)camera;
2652 if (pc->cb_info == NULL) {
2653 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2654 return CAMERA_ERROR_INVALID_PARAMETER;
2657 muse_camera_msg_send(MUSE_CAMERA_API_GET_DISPLAY_FLIP,
2658 pc->cb_info->fd, pc->cb_info, ret);
2660 if (ret == CAMERA_ERROR_NONE) {
2661 muse_camera_msg_get(get_flip, pc->cb_info->recv_msg);
2662 *flip = (camera_flip_e)get_flip;
2668 int camera_set_display_visible(camera_h camera, bool visible)
2670 int ret = CAMERA_ERROR_NONE;
2671 int set_visible = (int)visible;
2672 camera_cli_s *pc = NULL;
2674 if (camera == NULL) {
2675 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2676 return CAMERA_ERROR_INVALID_PARAMETER;
2679 pc = (camera_cli_s *)camera;
2681 if (pc->cb_info == NULL) {
2682 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2683 return CAMERA_ERROR_INVALID_PARAMETER;
2686 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_VISIBLE,
2687 pc->cb_info->fd, pc->cb_info, ret, INT, set_visible);
2692 int camera_is_display_visible(camera_h camera, bool *visible)
2694 int ret = CAMERA_ERROR_NONE;
2695 int get_visible = true;
2696 camera_cli_s *pc = NULL;
2698 if (camera == NULL || visible == NULL) {
2699 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2700 return CAMERA_ERROR_INVALID_PARAMETER;
2703 pc = (camera_cli_s *)camera;
2705 if (pc->cb_info == NULL) {
2706 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2707 return CAMERA_ERROR_INVALID_PARAMETER;
2710 muse_camera_msg_send(MUSE_CAMERA_API_IS_DISPLAY_VISIBLE,
2711 pc->cb_info->fd, pc->cb_info, ret);
2713 if (ret == CAMERA_ERROR_NONE) {
2714 muse_camera_msg_get(get_visible, pc->cb_info->recv_msg);
2715 *visible = (bool)get_visible;
2721 int camera_set_display_mode(camera_h camera, camera_display_mode_e mode)
2723 int ret = CAMERA_ERROR_NONE;
2724 int set_mode = (int)mode;
2725 camera_cli_s *pc = NULL;
2727 if (camera == NULL) {
2728 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2729 return CAMERA_ERROR_INVALID_PARAMETER;
2732 if (mode < CAMERA_DISPLAY_MODE_LETTER_BOX || mode > CAMERA_DISPLAY_MODE_CROPPED_FULL) {
2733 LOGE("Invalid mode %d", mode);
2734 return CAMERA_ERROR_INVALID_PARAMETER;
2737 pc = (camera_cli_s *)camera;
2739 if (pc->cb_info == NULL) {
2740 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2741 return CAMERA_ERROR_INVALID_PARAMETER;
2744 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_MODE,
2745 pc->cb_info->fd, pc->cb_info, ret, INT, set_mode);
2750 int camera_get_display_mode(camera_h camera, camera_display_mode_e *mode)
2752 int ret = CAMERA_ERROR_NONE;
2753 int get_mode = CAMERA_DISPLAY_MODE_LETTER_BOX;
2754 camera_cli_s *pc = NULL;
2756 if (camera == NULL || mode == NULL) {
2757 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2758 return CAMERA_ERROR_INVALID_PARAMETER;
2761 pc = (camera_cli_s *)camera;
2763 if (pc->cb_info == NULL) {
2764 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2765 return CAMERA_ERROR_INVALID_PARAMETER;
2768 muse_camera_msg_send(MUSE_CAMERA_API_GET_DISPLAY_MODE,
2769 pc->cb_info->fd, pc->cb_info, ret);
2771 if (ret == CAMERA_ERROR_NONE) {
2772 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
2773 *mode = (camera_display_mode_e)get_mode;
2779 int camera_get_capture_resolution(camera_h camera, int *width, int *height)
2781 if (camera == NULL || width == NULL || height == NULL) {
2782 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2783 return CAMERA_ERROR_INVALID_PARAMETER;
2785 int ret = CAMERA_ERROR_NONE;
2787 camera_cli_s *pc = (camera_cli_s *)camera;
2788 muse_camera_api_e api = MUSE_CAMERA_API_GET_CAPTURE_RESOLUTION;
2790 if (pc->cb_info == NULL) {
2791 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2792 return CAMERA_ERROR_INVALID_PARAMETER;
2794 sock_fd = pc->cb_info->fd;
2798 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2799 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2801 if (ret == CAMERA_ERROR_NONE) {
2802 muse_camera_msg_get(get_width, pc->cb_info->recv_msg);
2803 muse_camera_msg_get(get_height, pc->cb_info->recv_msg);
2805 *height = get_height;
2807 LOGD("ret : 0x%x", ret);
2811 int camera_get_capture_format(camera_h camera, camera_pixel_format_e *format)
2813 if (camera == NULL || format == NULL) {
2814 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2815 return CAMERA_ERROR_INVALID_PARAMETER;
2817 int ret = CAMERA_ERROR_NONE;
2819 camera_cli_s *pc = (camera_cli_s *)camera;
2820 muse_camera_api_e api = MUSE_CAMERA_API_GET_CAPTURE_FORMAT;
2823 if (pc->cb_info == NULL) {
2824 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2825 return CAMERA_ERROR_INVALID_PARAMETER;
2827 sock_fd = pc->cb_info->fd;
2829 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2830 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2832 if (ret == CAMERA_ERROR_NONE) {
2833 muse_camera_msg_get(get_format, pc->cb_info->recv_msg);
2834 *format = (camera_pixel_format_e)get_format;
2836 LOGD("ret : 0x%x", ret);
2840 int camera_get_preview_format(camera_h camera, camera_pixel_format_e *format)
2842 if (camera == NULL || format == NULL) {
2843 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2844 return CAMERA_ERROR_INVALID_PARAMETER;
2847 int ret = CAMERA_ERROR_NONE;
2849 camera_cli_s *pc = (camera_cli_s *)camera;
2850 muse_camera_api_e api = MUSE_CAMERA_API_GET_PREVIEW_FORMAT;
2853 if (pc->cb_info == NULL) {
2854 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2855 return CAMERA_ERROR_INVALID_PARAMETER;
2857 sock_fd = pc->cb_info->fd;
2859 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2860 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2862 if (ret == CAMERA_ERROR_NONE) {
2863 muse_camera_msg_get(get_format, pc->cb_info->recv_msg);
2864 *format = (camera_pixel_format_e)get_format;
2866 LOGD("ret : 0x%x", ret);
2870 int camera_get_facing_direction(camera_h camera, camera_facing_direction_e *facing_direciton)
2872 if (camera == NULL || facing_direciton == NULL) {
2873 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2874 return CAMERA_ERROR_INVALID_PARAMETER;
2877 int ret = CAMERA_ERROR_NONE;
2879 camera_cli_s *pc = (camera_cli_s *)camera;
2880 muse_camera_api_e api = MUSE_CAMERA_API_GET_FACING_DIRECTION;
2882 if (pc->cb_info == NULL) {
2883 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2884 return CAMERA_ERROR_INVALID_PARAMETER;
2886 sock_fd = pc->cb_info->fd;
2887 int get_facing_direction;
2889 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2890 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2892 if (ret == CAMERA_ERROR_NONE) {
2893 muse_camera_msg_get(get_facing_direction, pc->cb_info->recv_msg);
2894 *facing_direciton = (camera_facing_direction_e)get_facing_direction;
2896 LOGD("ret : 0x%x", ret);
2900 int camera_set_preview_cb(camera_h camera, camera_preview_cb callback, void *user_data)
2902 if (camera == NULL || callback == NULL) {
2903 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2904 return CAMERA_ERROR_INVALID_PARAMETER;
2906 int ret = CAMERA_ERROR_NONE;
2908 camera_cli_s *pc = (camera_cli_s *)camera;
2910 if (pc->cb_info == NULL) {
2911 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2912 return CAMERA_ERROR_INVALID_PARAMETER;
2914 sock_fd = pc->cb_info->fd;
2915 muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_CB;
2917 LOGD("Enter, handle :%x", pc->remote_handle);
2919 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = callback;
2920 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = user_data;
2922 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2923 LOGD("ret : 0x%x", ret);
2927 int camera_unset_preview_cb(camera_h camera)
2929 if (camera == NULL) {
2930 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2931 return CAMERA_ERROR_INVALID_PARAMETER;
2934 int ret = CAMERA_ERROR_NONE;
2936 camera_cli_s *pc = (camera_cli_s *)camera;
2937 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_PREVIEW_CB;
2939 LOGD("Enter, handle :%x", pc->remote_handle);
2942 if (pc->cb_info == NULL) {
2943 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2944 return CAMERA_ERROR_INVALID_PARAMETER;
2946 sock_fd = pc->cb_info->fd;
2947 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = (void *)NULL;
2948 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = (void *)NULL;
2950 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2951 LOGD("ret : 0x%x", ret);
2955 int camera_set_media_packet_preview_cb(camera_h camera, camera_media_packet_preview_cb callback, void *user_data)
2957 if (camera == NULL) {
2958 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
2959 return CAMERA_ERROR_INVALID_PARAMETER;
2962 if (camera_is_supported_media_packet_preview_cb(camera) == false) {
2963 LOGE("NOT SUPPORTED");
2964 return CAMERA_ERROR_NOT_SUPPORTED;
2967 if (callback == NULL) {
2968 LOGE("INVALID_PARAMETER(0x%08x) - callback", CAMERA_ERROR_INVALID_PARAMETER);
2969 return CAMERA_ERROR_INVALID_PARAMETER;
2972 int ret = CAMERA_ERROR_NONE;
2974 camera_cli_s *pc = (camera_cli_s *)camera;
2975 muse_camera_api_e api = MUSE_CAMERA_API_SET_MEDIA_PACKET_PREVIEW_CB;
2977 LOGD("Enter, handle :%x", pc->remote_handle);
2980 if (pc->cb_info == NULL) {
2981 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2982 return CAMERA_ERROR_INVALID_PARAMETER;
2984 sock_fd = pc->cb_info->fd;
2985 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = callback;
2986 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = user_data;
2988 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2989 LOGD("ret : 0x%x", ret);
2993 int camera_unset_media_packet_preview_cb(camera_h camera)
2995 if (camera == NULL) {
2996 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2997 return CAMERA_ERROR_INVALID_PARAMETER;
3000 int ret = CAMERA_ERROR_NONE;
3002 camera_cli_s *pc = (camera_cli_s *)camera;
3003 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_MEDIA_PACKET_PREVIEW_CB;
3005 LOGD("Enter, handle :%x", pc->remote_handle);
3008 if (pc->cb_info == NULL) {
3009 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3010 return CAMERA_ERROR_INVALID_PARAMETER;
3012 sock_fd = pc->cb_info->fd;
3013 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = (void *)NULL;
3014 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = (void *)NULL;
3016 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3017 LOGD("ret : 0x%x", ret);
3021 int camera_set_state_changed_cb(camera_h camera, camera_state_changed_cb callback, void *user_data)
3023 if (camera == NULL || callback == NULL) {
3024 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3025 return CAMERA_ERROR_INVALID_PARAMETER;
3027 int ret = CAMERA_ERROR_NONE;
3029 camera_cli_s *pc = (camera_cli_s *)camera;
3030 muse_camera_api_e api = MUSE_CAMERA_API_SET_STATE_CHANGED_CB;
3032 LOGD("Enter, handle :%x", pc->remote_handle);
3035 if (pc->cb_info == NULL) {
3036 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3037 return CAMERA_ERROR_INVALID_PARAMETER;
3039 sock_fd = pc->cb_info->fd;
3040 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = callback;
3041 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = user_data;
3043 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3044 LOGD("ret : 0x%x", ret);
3047 int camera_unset_state_changed_cb(camera_h camera)
3049 if (camera == NULL) {
3050 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3051 return CAMERA_ERROR_INVALID_PARAMETER;
3053 int ret = CAMERA_ERROR_NONE;
3055 camera_cli_s *pc = (camera_cli_s *)camera;
3056 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_STATE_CHANGED_CB;
3058 LOGD("Enter, handle :%x", pc->remote_handle);
3061 if (pc->cb_info == NULL) {
3062 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3063 return CAMERA_ERROR_INVALID_PARAMETER;
3065 sock_fd = pc->cb_info->fd;
3066 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = (void *)NULL;
3067 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = (void *)NULL;
3069 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3070 LOGD("ret : 0x%x", ret);
3074 int camera_set_interrupted_cb(camera_h camera, camera_interrupted_cb callback, void *user_data)
3076 if (camera == NULL || callback == NULL) {
3077 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3078 return CAMERA_ERROR_INVALID_PARAMETER;
3080 int ret = CAMERA_ERROR_NONE;
3082 camera_cli_s *pc = (camera_cli_s *)camera;
3083 muse_camera_api_e api = MUSE_CAMERA_API_SET_INTERRUPTED_CB;
3085 LOGD("Enter, handle :%x", pc->remote_handle);
3088 if (pc->cb_info == NULL) {
3089 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3090 return CAMERA_ERROR_INVALID_PARAMETER;
3092 sock_fd = pc->cb_info->fd;
3093 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = callback;
3094 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = user_data;
3096 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3097 LOGD("ret : 0x%x", ret);
3101 int camera_unset_interrupted_cb(camera_h camera)
3103 if (camera == NULL) {
3104 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3105 return CAMERA_ERROR_INVALID_PARAMETER;
3107 int ret = CAMERA_ERROR_NONE;
3109 camera_cli_s *pc = (camera_cli_s *)camera;
3110 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_INTERRUPTED_CB;
3112 LOGD("Enter, handle :%x", pc->remote_handle);
3115 if (pc->cb_info == NULL) {
3116 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3117 return CAMERA_ERROR_INVALID_PARAMETER;
3119 sock_fd = pc->cb_info->fd;
3120 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = (void *)NULL;
3121 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = (void *)NULL;
3123 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3124 LOGD("ret : 0x%x", ret);
3128 int camera_set_focus_changed_cb(camera_h camera, camera_focus_changed_cb callback, void *user_data)
3130 if (camera == NULL || callback == NULL) {
3131 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3132 return CAMERA_ERROR_INVALID_PARAMETER;
3134 int ret = CAMERA_ERROR_NONE;
3136 camera_cli_s *pc = (camera_cli_s *)camera;
3137 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOCUS_CHANGED_CB;
3139 LOGD("Enter, handle :%x", pc->remote_handle);
3142 if (pc->cb_info == NULL) {
3143 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3144 return CAMERA_ERROR_INVALID_PARAMETER;
3146 sock_fd = pc->cb_info->fd;
3147 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = callback;
3148 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = user_data;
3150 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3151 LOGD("ret : 0x%x", ret);
3155 int camera_unset_focus_changed_cb(camera_h camera)
3157 if (camera == NULL) {
3158 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3159 return CAMERA_ERROR_INVALID_PARAMETER;
3161 int ret = CAMERA_ERROR_NONE;
3163 camera_cli_s *pc = (camera_cli_s *)camera;
3164 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_FOCUS_CHANGED_CB;
3166 LOGD("Enter, handle :%x", pc->remote_handle);
3169 if (pc->cb_info == NULL) {
3170 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3171 return CAMERA_ERROR_INVALID_PARAMETER;
3173 sock_fd = pc->cb_info->fd;
3174 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = (void *)NULL;
3175 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = (void *)NULL;
3177 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3178 LOGD("ret : 0x%x", ret);
3182 int camera_set_error_cb(camera_h camera, camera_error_cb callback, void *user_data)
3184 if (camera == NULL || callback == NULL) {
3185 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3186 return CAMERA_ERROR_INVALID_PARAMETER;
3188 int ret = CAMERA_ERROR_NONE;
3190 camera_cli_s *pc = (camera_cli_s *)camera;
3191 muse_camera_api_e api = MUSE_CAMERA_API_SET_ERROR_CB;
3193 LOGD("Enter, handle :%x", pc->remote_handle);
3196 if (pc->cb_info == NULL) {
3197 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3198 return CAMERA_ERROR_INVALID_PARAMETER;
3200 sock_fd = pc->cb_info->fd;
3201 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_ERROR] = callback;
3202 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_ERROR] = user_data;
3204 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3205 LOGD("ret : 0x%x", ret);
3209 int camera_unset_error_cb(camera_h camera)
3211 if (camera == NULL) {
3212 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3213 return CAMERA_ERROR_INVALID_PARAMETER;
3215 int ret = CAMERA_ERROR_NONE;
3217 camera_cli_s *pc = (camera_cli_s *)camera;
3218 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_ERROR_CB;
3220 LOGD("Enter, handle :%x", pc->remote_handle);
3223 if (pc->cb_info == NULL) {
3224 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3225 return CAMERA_ERROR_INVALID_PARAMETER;
3227 sock_fd = pc->cb_info->fd;
3228 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_ERROR] = (void *)NULL;
3229 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_ERROR] = (void *)NULL;
3231 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3232 LOGD("ret : 0x%x", ret);
3236 int camera_foreach_supported_preview_resolution(camera_h camera, camera_supported_preview_resolution_cb foreach_cb , void *user_data)
3238 if (camera == NULL || foreach_cb == NULL) {
3239 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3240 return CAMERA_ERROR_INVALID_PARAMETER;
3242 int ret = CAMERA_ERROR_NONE;
3244 camera_cli_s *pc = (camera_cli_s *)camera;
3245 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_PREVIEW_RESOLUTION;
3247 LOGD("Enter, handle :%x", pc->remote_handle);
3250 if (pc->cb_info == NULL) {
3251 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3252 return CAMERA_ERROR_INVALID_PARAMETER;
3254 sock_fd = pc->cb_info->fd;
3255 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_RESOLUTION] = foreach_cb;
3256 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_RESOLUTION] = user_data;
3258 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3259 LOGD("ret : 0x%x", ret);
3263 int camera_foreach_supported_capture_resolution(camera_h camera, camera_supported_capture_resolution_cb foreach_cb , void *user_data)
3265 if (camera == NULL || foreach_cb == NULL) {
3266 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3267 return CAMERA_ERROR_INVALID_PARAMETER;
3269 int ret = CAMERA_ERROR_NONE;
3271 camera_cli_s *pc = (camera_cli_s *)camera;
3272 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_CAPTURE_RESOLUTION;
3274 LOGD("Enter, handle :%x", pc->remote_handle);
3277 if (pc->cb_info == NULL) {
3278 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3279 return CAMERA_ERROR_INVALID_PARAMETER;
3281 sock_fd = pc->cb_info->fd;
3282 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_RESOLUTION] = foreach_cb;
3283 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_RESOLUTION] = user_data;
3285 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3286 LOGD("ret : 0x%x", ret);
3290 int camera_foreach_supported_capture_format(camera_h camera, camera_supported_capture_format_cb foreach_cb , void *user_data)
3292 if (camera == NULL || foreach_cb == NULL) {
3293 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3294 return CAMERA_ERROR_INVALID_PARAMETER;
3296 int ret = CAMERA_ERROR_NONE;
3298 camera_cli_s *pc = (camera_cli_s *)camera;
3299 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_CAPTURE_FORMAT;
3301 LOGD("Enter, handle :%x", pc->remote_handle);
3304 if (pc->cb_info == NULL) {
3305 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3306 return CAMERA_ERROR_INVALID_PARAMETER;
3308 sock_fd = pc->cb_info->fd;
3309 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_FORMAT] = foreach_cb;
3310 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_FORMAT] = user_data;
3312 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3313 LOGD("ret : 0x%x", ret);
3318 int camera_foreach_supported_preview_format(camera_h camera, camera_supported_preview_format_cb foreach_cb , void *user_data)
3320 if (camera == NULL || foreach_cb == NULL) {
3321 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3322 return CAMERA_ERROR_INVALID_PARAMETER;
3324 int ret = CAMERA_ERROR_NONE;
3326 camera_cli_s *pc = (camera_cli_s *)camera;
3327 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_PREVIEW_FORMAT;
3329 LOGD("Enter, handle :%x", pc->remote_handle);
3332 if (pc->cb_info == NULL) {
3333 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3334 return CAMERA_ERROR_INVALID_PARAMETER;
3336 sock_fd = pc->cb_info->fd;
3337 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_FORMAT] = foreach_cb;
3338 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_FORMAT] = user_data;
3340 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3341 LOGD("ret : 0x%x", ret);
3346 int camera_get_recommended_preview_resolution(camera_h camera, int *width, int *height)
3348 if (camera == NULL || width == NULL || height == NULL) {
3349 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3350 return CAMERA_ERROR_INVALID_PARAMETER;
3352 int ret = CAMERA_ERROR_NONE;
3354 camera_cli_s *pc = (camera_cli_s *)camera;
3355 muse_camera_api_e api = MUSE_CAMERA_API_GET_RECOMMENDED_PREVIEW_RESOLUTION;
3357 if (pc->cb_info == NULL) {
3358 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3359 return CAMERA_ERROR_INVALID_PARAMETER;
3361 sock_fd = pc->cb_info->fd;
3365 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3366 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3368 if (ret == CAMERA_ERROR_NONE) {
3369 muse_camera_msg_get(get_width, pc->cb_info->recv_msg);
3370 muse_camera_msg_get(get_height, pc->cb_info->recv_msg);
3372 *height = get_height;
3374 LOGD("ret : 0x%x", ret);
3379 int camera_attr_get_lens_orientation(camera_h camera, int *angle)
3381 if (camera == NULL || angle == NULL) {
3382 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3383 return CAMERA_ERROR_INVALID_PARAMETER;
3385 int ret = CAMERA_ERROR_NONE;
3387 camera_cli_s *pc = (camera_cli_s *)camera;
3388 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_LENS_ORIENTATION;
3390 if (pc->cb_info == NULL) {
3391 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3392 return CAMERA_ERROR_INVALID_PARAMETER;
3394 sock_fd = pc->cb_info->fd;
3397 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3398 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3400 if (ret == CAMERA_ERROR_NONE) {
3401 muse_camera_msg_get(get_angle, pc->cb_info->recv_msg);
3404 LOGD("ret : 0x%x", ret);
3408 int camera_attr_set_theater_mode(camera_h camera, camera_attr_theater_mode_e mode)
3410 if (camera == NULL) {
3411 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3412 return CAMERA_ERROR_INVALID_PARAMETER;
3414 int ret = CAMERA_ERROR_NONE;
3415 camera_cli_s *pc = (camera_cli_s *)camera;
3416 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_THEATER_MODE;
3418 if (pc->cb_info == NULL) {
3419 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3420 return CAMERA_ERROR_INVALID_PARAMETER;
3422 sock_fd = pc->cb_info->fd;
3423 int set_mode = (int)mode;
3424 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3425 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
3426 LOGD("ret : 0x%x", ret);
3430 int camera_attr_get_theater_mode(camera_h camera, camera_attr_theater_mode_e *mode)
3432 if (camera == NULL || mode == NULL) {
3433 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3434 return CAMERA_ERROR_INVALID_PARAMETER;
3437 int ret = CAMERA_ERROR_NONE;
3438 camera_cli_s *pc = (camera_cli_s *)camera;
3439 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_THEATER_MODE;
3441 if (pc->cb_info == NULL) {
3442 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3443 return CAMERA_ERROR_INVALID_PARAMETER;
3445 sock_fd = pc->cb_info->fd;
3447 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3448 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3450 if (ret == CAMERA_ERROR_NONE) {
3451 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
3452 *mode = (camera_attr_theater_mode_e)get_mode;
3454 LOGD("ret : 0x%x", ret);
3458 int camera_attr_foreach_supported_theater_mode(camera_h camera, camera_attr_supported_theater_mode_cb foreach_cb, void *user_data)
3460 if (camera == NULL || foreach_cb == NULL) {
3461 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3462 return CAMERA_ERROR_INVALID_PARAMETER;
3464 int ret = CAMERA_ERROR_NONE;
3466 camera_cli_s *pc = (camera_cli_s *)camera;
3467 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_THEATER_MODE;
3469 LOGD("Enter, handle :%x", pc->remote_handle);
3472 if (pc->cb_info == NULL) {
3473 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3474 return CAMERA_ERROR_INVALID_PARAMETER;
3476 sock_fd = pc->cb_info->fd;
3477 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE] = foreach_cb;
3478 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE] = user_data;
3480 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3482 LOGD("Finish, return :%x", ret);
3487 int camera_attr_set_preview_fps(camera_h camera, camera_attr_fps_e fps)
3489 if (camera == NULL) {
3490 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3491 return CAMERA_ERROR_INVALID_PARAMETER;
3493 int ret = CAMERA_ERROR_NONE;
3494 camera_cli_s *pc = (camera_cli_s *)camera;
3495 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_PREVIEW_FPS;
3497 if (pc->cb_info == NULL) {
3498 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3499 return CAMERA_ERROR_INVALID_PARAMETER;
3501 sock_fd = pc->cb_info->fd;
3502 int set_fps = (int)fps;
3503 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3504 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_fps);
3505 LOGD("ret : 0x%x", ret);
3510 int camera_attr_set_image_quality(camera_h camera, int quality)
3512 if (camera == NULL) {
3513 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3514 return CAMERA_ERROR_INVALID_PARAMETER;
3516 int ret = CAMERA_ERROR_NONE;
3518 camera_cli_s *pc = (camera_cli_s *)camera;
3519 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_IMAGE_QUALITY;
3521 if (pc->cb_info == NULL) {
3522 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3523 return CAMERA_ERROR_INVALID_PARAMETER;
3525 sock_fd = pc->cb_info->fd;
3526 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3527 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, quality);
3528 LOGD("ret : 0x%x", ret);
3532 int camera_attr_get_preview_fps(camera_h camera, camera_attr_fps_e *fps)
3534 if (camera == NULL || fps == NULL) {
3535 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3536 return CAMERA_ERROR_INVALID_PARAMETER;
3538 int ret = CAMERA_ERROR_NONE;
3540 camera_cli_s *pc = (camera_cli_s *)camera;
3541 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_PREVIEW_FPS;
3544 if (pc->cb_info == NULL) {
3545 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3546 return CAMERA_ERROR_INVALID_PARAMETER;
3548 sock_fd = pc->cb_info->fd;
3550 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3551 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3553 if (ret == CAMERA_ERROR_NONE) {
3554 muse_camera_msg_get(get_fps, pc->cb_info->recv_msg);
3555 *fps = (camera_attr_fps_e)get_fps;
3557 LOGD("ret : 0x%x", ret);
3562 int camera_attr_get_image_quality(camera_h camera, int *quality)
3564 if (camera == NULL || quality == NULL) {
3565 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3566 return CAMERA_ERROR_INVALID_PARAMETER;
3568 int ret = CAMERA_ERROR_NONE;
3570 camera_cli_s *pc = (camera_cli_s *)camera;
3571 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_IMAGE_QUALITY;
3573 if (pc->cb_info == NULL) {
3574 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3575 return CAMERA_ERROR_INVALID_PARAMETER;
3577 sock_fd = pc->cb_info->fd;
3579 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3580 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3582 if (ret == CAMERA_ERROR_NONE) {
3583 muse_camera_msg_get(get_quality, pc->cb_info->recv_msg);
3584 *quality = get_quality;
3586 LOGD("ret : 0x%x", ret);
3591 int camera_attr_get_encoded_preview_bitrate(camera_h camera, int *bitrate)
3593 if (camera == NULL || bitrate == NULL) {
3594 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3595 return CAMERA_ERROR_INVALID_PARAMETER;
3598 int ret = CAMERA_ERROR_NONE;
3600 camera_cli_s *pc = (camera_cli_s *)camera;
3601 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ENCODED_PREVIEW_BITRATE;
3603 if (pc->cb_info == NULL) {
3604 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3605 return CAMERA_ERROR_INVALID_PARAMETER;
3607 sock_fd = pc->cb_info->fd;
3610 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3611 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3613 if (ret == CAMERA_ERROR_NONE) {
3614 muse_camera_msg_get(get_bitrate, pc->cb_info->recv_msg);
3615 *bitrate = get_bitrate;
3617 LOGD("ret : 0x%x", ret);
3622 int camera_attr_set_encoded_preview_bitrate(camera_h camera, int bitrate)
3624 if (camera == NULL) {
3625 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3626 return CAMERA_ERROR_INVALID_PARAMETER;
3629 int ret = CAMERA_ERROR_NONE;
3631 camera_cli_s *pc = (camera_cli_s *)camera;
3632 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ENCODED_PREVIEW_BITRATE;
3634 if (pc->cb_info == NULL) {
3635 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3636 return CAMERA_ERROR_INVALID_PARAMETER;
3638 sock_fd = pc->cb_info->fd;
3639 int set_bitrate = bitrate;
3640 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3641 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_bitrate);
3642 LOGD("ret : 0x%x", ret);
3647 int camera_attr_get_encoded_preview_gop_interval(camera_h camera, int *interval)
3649 if (camera == NULL || interval == NULL) {
3650 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3651 return CAMERA_ERROR_INVALID_PARAMETER;
3654 int ret = CAMERA_ERROR_NONE;
3656 camera_cli_s *pc = (camera_cli_s *)camera;
3657 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ENCODED_PREVIEW_GOP_INTERVAL;
3659 if (pc->cb_info == NULL) {
3660 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3661 return CAMERA_ERROR_INVALID_PARAMETER;
3663 sock_fd = pc->cb_info->fd;
3664 int get_gop_interval;
3666 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3667 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3669 if (ret == CAMERA_ERROR_NONE) {
3670 muse_camera_msg_get(get_gop_interval, pc->cb_info->recv_msg);
3671 *interval = get_gop_interval;
3673 LOGD("ret : 0x%x", ret);
3678 int camera_attr_set_encoded_preview_gop_interval(camera_h camera, int interval)
3680 if (camera == NULL) {
3681 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3682 return CAMERA_ERROR_INVALID_PARAMETER;
3685 int ret = CAMERA_ERROR_NONE;
3687 camera_cli_s *pc = (camera_cli_s *)camera;
3688 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ENCODED_PREVIEW_GOP_INTERVAL;
3690 if (pc->cb_info == NULL) {
3691 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3692 return CAMERA_ERROR_INVALID_PARAMETER;
3694 sock_fd = pc->cb_info->fd;
3695 int set_gop_interval = interval;
3696 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3697 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_gop_interval);
3698 LOGD("ret : 0x%x", ret);
3703 int camera_attr_set_zoom(camera_h camera, int zoom)
3705 if (camera == NULL) {
3706 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3707 return CAMERA_ERROR_INVALID_PARAMETER;
3709 int ret = CAMERA_ERROR_NONE;
3711 camera_cli_s *pc = (camera_cli_s *)camera;
3712 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ZOOM;
3714 if (pc->cb_info == NULL) {
3715 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3716 return CAMERA_ERROR_INVALID_PARAMETER;
3718 sock_fd = pc->cb_info->fd;
3720 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3721 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, zoom);
3722 LOGD("ret : 0x%x", ret);
3726 int camera_attr_set_af_mode(camera_h camera, camera_attr_af_mode_e mode)
3728 if (camera == NULL) {
3729 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3730 return CAMERA_ERROR_INVALID_PARAMETER;
3732 int ret = CAMERA_ERROR_NONE;
3734 camera_cli_s *pc = (camera_cli_s *)camera;
3735 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_AF_MODE;
3737 if (pc->cb_info == NULL) {
3738 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3739 return CAMERA_ERROR_INVALID_PARAMETER;
3741 sock_fd = pc->cb_info->fd;
3742 int set_mode = (int)mode;
3743 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3744 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
3745 LOGD("ret : 0x%x", ret);
3749 int camera_attr_set_af_area(camera_h camera, int x, int y)
3751 if (camera == NULL) {
3752 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3753 return CAMERA_ERROR_INVALID_PARAMETER;
3755 int ret = CAMERA_ERROR_NONE;
3756 camera_cli_s *pc = (camera_cli_s *)camera;
3757 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_AF_AREA;
3758 int sock_fd = pc->cb_info->fd;
3759 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3760 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, x, INT, y);
3761 LOGD("ret : 0x%x", ret);
3766 int camera_attr_clear_af_area(camera_h camera)
3768 if (camera == NULL) {
3769 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3770 return CAMERA_ERROR_INVALID_PARAMETER;
3772 int ret = CAMERA_ERROR_NONE;
3774 camera_cli_s *pc = (camera_cli_s *)camera;
3775 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_CLEAR_AF_AREA;
3777 if (pc->cb_info == NULL) {
3778 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3779 return CAMERA_ERROR_INVALID_PARAMETER;
3781 sock_fd = pc->cb_info->fd;
3782 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3783 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3784 LOGD("ret : 0x%x", ret);
3789 int camera_attr_set_exposure_mode(camera_h camera, camera_attr_exposure_mode_e mode)
3791 if (camera == NULL) {
3792 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3793 return CAMERA_ERROR_INVALID_PARAMETER;
3796 if (mode < CAMERA_ATTR_EXPOSURE_MODE_OFF || mode > CAMERA_ATTR_EXPOSURE_MODE_CUSTOM) {
3797 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3798 return CAMERA_ERROR_INVALID_PARAMETER;
3801 int ret = CAMERA_ERROR_NONE;
3802 camera_cli_s *pc = (camera_cli_s *)camera;
3803 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EXPOSURE_MODE;
3804 int set_mode = (int)mode;
3806 if (pc->cb_info == NULL) {
3807 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3808 return CAMERA_ERROR_INVALID_PARAMETER;
3810 sock_fd = pc->cb_info->fd;
3811 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3812 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
3813 LOGD("ret : 0x%x", ret);
3818 int camera_attr_set_exposure(camera_h camera, int value)
3820 if (camera == NULL) {
3821 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3822 return CAMERA_ERROR_INVALID_PARAMETER;
3824 int ret = CAMERA_ERROR_NONE;
3826 camera_cli_s *pc = (camera_cli_s *)camera;
3827 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EXPOSURE;
3829 if (pc->cb_info == NULL) {
3830 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3831 return CAMERA_ERROR_INVALID_PARAMETER;
3833 sock_fd = pc->cb_info->fd;
3835 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3836 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, value);
3837 LOGD("ret : 0x%x", ret);
3842 int camera_attr_set_iso(camera_h camera, camera_attr_iso_e iso)
3844 if (camera == NULL) {
3845 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3846 return CAMERA_ERROR_INVALID_PARAMETER;
3848 int ret = CAMERA_ERROR_NONE;
3850 camera_cli_s *pc = (camera_cli_s *)camera;
3851 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ISO;
3853 if (pc->cb_info == NULL) {
3854 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3855 return CAMERA_ERROR_INVALID_PARAMETER;
3857 sock_fd = pc->cb_info->fd;
3858 int set_iso = (int)iso;
3859 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3860 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_iso);
3861 LOGD("ret : 0x%x", ret);
3866 int camera_attr_set_brightness(camera_h camera, int level)
3868 if (camera == NULL) {
3869 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3870 return CAMERA_ERROR_INVALID_PARAMETER;
3872 int ret = CAMERA_ERROR_NONE;
3874 camera_cli_s *pc = (camera_cli_s *)camera;
3875 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_BRIGHTNESS;
3877 if (pc->cb_info == NULL) {
3878 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3879 return CAMERA_ERROR_INVALID_PARAMETER;
3881 sock_fd = pc->cb_info->fd;
3883 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3884 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, level);
3885 LOGD("ret : 0x%x", ret);
3890 int camera_attr_set_contrast(camera_h camera, int level)
3892 if (camera == NULL) {
3893 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3894 return CAMERA_ERROR_INVALID_PARAMETER;
3896 int ret = CAMERA_ERROR_NONE;
3898 camera_cli_s *pc = (camera_cli_s *)camera;
3899 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_CONTRAST;
3901 if (pc->cb_info == NULL) {
3902 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3903 return CAMERA_ERROR_INVALID_PARAMETER;
3905 sock_fd = pc->cb_info->fd;
3907 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3908 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, level);
3909 LOGD("ret : 0x%x", ret);
3914 int camera_attr_set_whitebalance(camera_h camera, camera_attr_whitebalance_e wb)
3916 if (camera == NULL) {
3917 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3918 return CAMERA_ERROR_INVALID_PARAMETER;
3921 if (wb < CAMERA_ATTR_WHITE_BALANCE_NONE || wb > CAMERA_ATTR_WHITE_BALANCE_CUSTOM) {
3922 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_NOT_SUPPORTED);
3923 return CAMERA_ERROR_NOT_SUPPORTED;
3926 int ret = CAMERA_ERROR_NONE;
3928 camera_cli_s *pc = (camera_cli_s *)camera;
3929 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_WHITEBALANCE;
3931 if (pc->cb_info == NULL) {
3932 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3933 return CAMERA_ERROR_INVALID_PARAMETER;
3935 sock_fd = pc->cb_info->fd;
3936 int set_whitebalance = (int)wb;
3937 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3938 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_whitebalance);
3939 LOGD("ret : 0x%x", ret);
3944 int camera_attr_set_effect(camera_h camera, camera_attr_effect_mode_e effect)
3946 if (camera == NULL) {
3947 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3948 return CAMERA_ERROR_INVALID_PARAMETER;
3950 int ret = CAMERA_ERROR_NONE;
3952 camera_cli_s *pc = (camera_cli_s *)camera;
3953 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EFFECT;
3955 if (pc->cb_info == NULL) {
3956 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3957 return CAMERA_ERROR_INVALID_PARAMETER;
3959 sock_fd = pc->cb_info->fd;
3960 int set_effect = (int)effect;
3961 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3962 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_effect);
3963 LOGD("ret : 0x%x", ret);
3968 int camera_attr_set_scene_mode(camera_h camera, camera_attr_scene_mode_e mode)
3970 if (camera == NULL) {
3971 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3972 return CAMERA_ERROR_INVALID_PARAMETER;
3974 int ret = CAMERA_ERROR_NONE;
3976 camera_cli_s *pc = (camera_cli_s *)camera;
3977 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_SCENE_MODE;
3979 if (pc->cb_info == NULL) {
3980 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3981 return CAMERA_ERROR_INVALID_PARAMETER;
3983 sock_fd = pc->cb_info->fd;
3984 int set_mode = (int)mode;
3985 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3986 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
3987 LOGD("ret : 0x%x", ret);
3992 int camera_attr_enable_tag(camera_h camera, bool enable)
3994 if (camera == NULL) {
3995 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3996 return CAMERA_ERROR_INVALID_PARAMETER;
3998 int ret = CAMERA_ERROR_NONE;
3999 camera_cli_s *pc = (camera_cli_s *)camera;
4000 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_TAG;
4002 if (pc->cb_info == NULL) {
4003 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4004 return CAMERA_ERROR_INVALID_PARAMETER;
4006 sock_fd = pc->cb_info->fd;
4007 int set_enable = (int)enable;
4009 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4010 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
4011 LOGD("ret : 0x%x", ret);
4016 int camera_attr_set_tag_image_description(camera_h camera, const char *description)
4018 if (camera == NULL) {
4019 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4020 return CAMERA_ERROR_INVALID_PARAMETER;
4022 if (description == NULL) {
4023 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4024 return CAMERA_ERROR_INVALID_PARAMETER;
4026 int ret = CAMERA_ERROR_NONE;
4027 camera_cli_s *pc = (camera_cli_s *)camera;
4028 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_IMAGE_DESCRIPTION;
4030 if (pc->cb_info == NULL) {
4031 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4032 return CAMERA_ERROR_INVALID_PARAMETER;
4034 sock_fd = pc->cb_info->fd;
4035 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4036 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, STRING, description);
4037 LOGD("ret : 0x%x", ret);
4042 int camera_attr_set_tag_orientation(camera_h camera, camera_attr_tag_orientation_e orientation)
4044 if (camera == NULL) {
4045 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4046 return CAMERA_ERROR_INVALID_PARAMETER;
4048 int ret = CAMERA_ERROR_NONE;
4049 camera_cli_s *pc = (camera_cli_s *)camera;
4050 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_ORIENTATION;
4052 if (pc->cb_info == NULL) {
4053 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4054 return CAMERA_ERROR_INVALID_PARAMETER;
4056 sock_fd = pc->cb_info->fd;
4057 int set_orientation = (int)orientation;
4059 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4060 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_orientation);
4061 LOGD("ret : 0x%x", ret);
4066 int camera_attr_set_tag_software(camera_h camera, const char *software)
4068 if (camera == NULL) {
4069 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4070 return CAMERA_ERROR_INVALID_PARAMETER;
4072 if (software == NULL) {
4073 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4074 return CAMERA_ERROR_INVALID_PARAMETER;
4076 int ret = CAMERA_ERROR_NONE;
4077 camera_cli_s *pc = (camera_cli_s *)camera;
4078 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_SOFTWARE;
4080 if (pc->cb_info == NULL) {
4081 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4082 return CAMERA_ERROR_INVALID_PARAMETER;
4084 sock_fd = pc->cb_info->fd;
4085 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4086 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, STRING, software);
4087 LOGD("ret : 0x%x", ret);
4092 int camera_attr_set_geotag(camera_h camera, double latitude , double longitude, double altitude)
4094 if (camera == NULL) {
4095 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4096 return CAMERA_ERROR_INVALID_PARAMETER;
4098 int ret = CAMERA_ERROR_NONE;
4099 camera_cli_s *pc = (camera_cli_s *)camera;
4100 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_GEOTAG;
4102 if (pc->cb_info == NULL) {
4103 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4104 return CAMERA_ERROR_INVALID_PARAMETER;
4106 sock_fd = pc->cb_info->fd;
4107 double set_geotag[3] = { latitude, longitude, altitude };
4109 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4110 muse_camera_msg_send_array(api, sock_fd, pc->cb_info, ret,
4111 set_geotag, sizeof(set_geotag), sizeof(double));
4112 LOGD("ret : 0x%x", ret);
4117 int camera_attr_remove_geotag(camera_h camera)
4119 if (camera == NULL) {
4120 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4121 return CAMERA_ERROR_INVALID_PARAMETER;
4123 int ret = CAMERA_ERROR_NONE;
4124 camera_cli_s *pc = (camera_cli_s *)camera;
4125 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_REMOVE_GEOTAG;
4127 if (pc->cb_info == NULL) {
4128 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4129 return CAMERA_ERROR_INVALID_PARAMETER;
4131 sock_fd = pc->cb_info->fd;
4132 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4133 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4134 LOGD("ret : 0x%x", ret);
4139 int camera_attr_set_flash_mode(camera_h camera, camera_attr_flash_mode_e mode)
4141 if (camera == NULL) {
4142 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4143 return CAMERA_ERROR_INVALID_PARAMETER;
4145 int ret = CAMERA_ERROR_NONE;
4146 camera_cli_s *pc = (camera_cli_s *)camera;
4147 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_FLASH_MODE;
4149 if (pc->cb_info == NULL) {
4150 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4151 return CAMERA_ERROR_INVALID_PARAMETER;
4153 sock_fd = pc->cb_info->fd;
4154 int set_mode = (int)mode;
4156 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4157 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
4158 LOGD("ret : 0x%x", ret);
4163 int camera_attr_get_zoom(camera_h camera, int *zoom)
4165 if (camera == NULL || zoom == NULL) {
4166 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4167 return CAMERA_ERROR_INVALID_PARAMETER;
4169 int ret = CAMERA_ERROR_NONE;
4171 camera_cli_s *pc = (camera_cli_s *)camera;
4172 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ZOOM;
4175 if (pc->cb_info == NULL) {
4176 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4177 return CAMERA_ERROR_INVALID_PARAMETER;
4179 sock_fd = pc->cb_info->fd;
4181 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4182 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4184 if (ret == CAMERA_ERROR_NONE) {
4185 muse_camera_msg_get(get_zoom, pc->cb_info->recv_msg);
4188 LOGD("ret : 0x%x", ret);
4193 int camera_attr_get_zoom_range(camera_h camera, int *min, int *max)
4195 if (camera == NULL || min == NULL || max == NULL) {
4196 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4197 return CAMERA_ERROR_INVALID_PARAMETER;
4199 int ret = CAMERA_ERROR_NONE;
4200 camera_cli_s *pc = (camera_cli_s *)camera;
4202 if (pc->cb_info == NULL) {
4203 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4204 return CAMERA_ERROR_INVALID_PARAMETER;
4206 sock_fd = pc->cb_info->fd;
4207 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ZOOM_RANGE;
4211 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4212 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4214 if (ret == CAMERA_ERROR_NONE) {
4215 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
4216 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
4220 LOGD("ret : 0x%x", ret);
4225 int camera_attr_get_af_mode(camera_h camera, camera_attr_af_mode_e *mode)
4227 if (camera == NULL || mode == NULL) {
4228 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4229 return CAMERA_ERROR_INVALID_PARAMETER;
4231 int ret = CAMERA_ERROR_NONE;
4232 camera_cli_s *pc = (camera_cli_s *)camera;
4234 if (pc->cb_info == NULL) {
4235 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4236 return CAMERA_ERROR_INVALID_PARAMETER;
4238 sock_fd = pc->cb_info->fd;
4239 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_AF_MODE;
4242 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4243 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4245 if (ret == CAMERA_ERROR_NONE) {
4246 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
4247 *mode = (camera_attr_af_mode_e)get_mode;
4249 LOGD("ret : 0x%x", ret);
4254 int camera_attr_get_exposure_mode(camera_h camera, camera_attr_exposure_mode_e *mode)
4256 if (camera == NULL || mode == NULL) {
4257 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4258 return CAMERA_ERROR_INVALID_PARAMETER;
4260 int ret = CAMERA_ERROR_NONE;
4261 camera_cli_s *pc = (camera_cli_s *)camera;
4263 if (pc->cb_info == NULL) {
4264 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4265 return CAMERA_ERROR_INVALID_PARAMETER;
4267 sock_fd = pc->cb_info->fd;
4268 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE_MODE;
4271 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4272 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4274 if (ret == CAMERA_ERROR_NONE) {
4275 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
4276 *mode = (camera_attr_exposure_mode_e)get_mode;
4278 LOGD("ret : 0x%x", ret);
4282 int camera_attr_get_exposure(camera_h camera, int *value)
4284 if (camera == NULL || value == NULL) {
4285 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4286 return CAMERA_ERROR_INVALID_PARAMETER;
4288 int ret = CAMERA_ERROR_NONE;
4289 camera_cli_s *pc = (camera_cli_s *)camera;
4291 if (pc->cb_info == NULL) {
4292 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4293 return CAMERA_ERROR_INVALID_PARAMETER;
4295 sock_fd = pc->cb_info->fd;
4296 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE;
4299 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4300 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4302 if (ret == CAMERA_ERROR_NONE) {
4303 muse_camera_msg_get(get_value, pc->cb_info->recv_msg);
4306 LOGD("ret : 0x%x", ret);
4311 int camera_attr_get_exposure_range(camera_h camera, int *min, int *max)
4313 if (camera == NULL || min == NULL || max == NULL) {
4314 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4315 return CAMERA_ERROR_INVALID_PARAMETER;
4317 int ret = CAMERA_ERROR_NONE;
4318 camera_cli_s *pc = (camera_cli_s *)camera;
4320 if (pc->cb_info == NULL) {
4321 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4322 return CAMERA_ERROR_INVALID_PARAMETER;
4324 sock_fd = pc->cb_info->fd;
4325 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE_RANGE;
4329 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4330 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4332 if (ret == CAMERA_ERROR_NONE) {
4333 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
4334 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
4338 LOGD("ret : 0x%x", ret);
4343 int camera_attr_get_iso(camera_h camera, camera_attr_iso_e *iso)
4345 if (camera == NULL || iso == NULL) {
4346 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4347 return CAMERA_ERROR_INVALID_PARAMETER;
4349 int ret = CAMERA_ERROR_NONE;
4350 camera_cli_s *pc = (camera_cli_s *)camera;
4352 if (pc->cb_info == NULL) {
4353 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4354 return CAMERA_ERROR_INVALID_PARAMETER;
4356 sock_fd = pc->cb_info->fd;
4357 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ISO;
4360 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4361 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4363 if (ret == CAMERA_ERROR_NONE) {
4364 muse_camera_msg_get(get_iso, pc->cb_info->recv_msg);
4365 *iso = (camera_attr_iso_e)get_iso;
4367 LOGD("ret : 0x%x", ret);
4372 int camera_attr_get_brightness(camera_h camera, int *level)
4374 if (camera == NULL || level == NULL) {
4375 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4376 return CAMERA_ERROR_INVALID_PARAMETER;
4378 int ret = CAMERA_ERROR_NONE;
4379 camera_cli_s *pc = (camera_cli_s *)camera;
4381 if (pc->cb_info == NULL) {
4382 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4383 return CAMERA_ERROR_INVALID_PARAMETER;
4385 sock_fd = pc->cb_info->fd;
4386 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_BRIGHTNESS;
4389 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4390 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4392 if (ret == CAMERA_ERROR_NONE) {
4393 muse_camera_msg_get(get_level, pc->cb_info->recv_msg);
4396 LOGD("ret : 0x%x", ret);
4401 int camera_attr_get_brightness_range(camera_h camera, int *min, int *max)
4403 if (camera == NULL || min == NULL || max == NULL) {
4404 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4405 return CAMERA_ERROR_INVALID_PARAMETER;
4407 int ret = CAMERA_ERROR_NONE;
4408 camera_cli_s *pc = (camera_cli_s *)camera;
4410 if (pc->cb_info == NULL) {
4411 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4412 return CAMERA_ERROR_INVALID_PARAMETER;
4414 sock_fd = pc->cb_info->fd;
4415 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_BRIGHTNESS_RANGE;
4419 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4420 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4422 if (ret == CAMERA_ERROR_NONE) {
4423 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
4424 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
4428 LOGD("ret : 0x%x", ret);
4433 int camera_attr_get_contrast(camera_h camera, int *level)
4435 if (camera == NULL || level == NULL) {
4436 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4437 return CAMERA_ERROR_INVALID_PARAMETER;
4439 int ret = CAMERA_ERROR_NONE;
4440 camera_cli_s *pc = (camera_cli_s *)camera;
4441 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_CONTRAST;
4443 if (pc->cb_info == NULL) {
4444 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4445 return CAMERA_ERROR_INVALID_PARAMETER;
4447 sock_fd = pc->cb_info->fd;
4450 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4451 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4453 if (ret == CAMERA_ERROR_NONE) {
4454 muse_camera_msg_get(get_level, pc->cb_info->recv_msg);
4457 LOGD("ret : 0x%x", ret);
4462 int camera_attr_get_contrast_range(camera_h camera, int *min , int *max)
4464 if (camera == NULL || min == NULL || max == NULL) {
4465 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4466 return CAMERA_ERROR_INVALID_PARAMETER;
4468 int ret = CAMERA_ERROR_NONE;
4469 camera_cli_s *pc = (camera_cli_s *)camera;
4470 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_CONTRAST_RANGE;
4472 if (pc->cb_info == NULL) {
4473 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4474 return CAMERA_ERROR_INVALID_PARAMETER;
4476 sock_fd = pc->cb_info->fd;
4480 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4481 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4483 if (ret == CAMERA_ERROR_NONE) {
4484 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
4485 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
4489 LOGD("ret : 0x%x", ret);
4494 int camera_attr_get_whitebalance(camera_h camera, camera_attr_whitebalance_e *wb)
4496 if (camera == NULL || wb == NULL) {
4497 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4498 return CAMERA_ERROR_INVALID_PARAMETER;
4500 int ret = CAMERA_ERROR_NONE;
4501 camera_cli_s *pc = (camera_cli_s *)camera;
4502 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_WHITEBALANCE;
4504 if (pc->cb_info == NULL) {
4505 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4506 return CAMERA_ERROR_INVALID_PARAMETER;
4508 sock_fd = pc->cb_info->fd;
4511 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4512 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4514 if (ret == CAMERA_ERROR_NONE) {
4515 muse_camera_msg_get(get_wb, pc->cb_info->recv_msg);
4516 *wb = (camera_attr_whitebalance_e)get_wb;
4518 LOGD("ret : 0x%x", ret);
4523 int camera_attr_get_effect(camera_h camera, camera_attr_effect_mode_e *effect)
4525 if (camera == NULL || effect == NULL) {
4526 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4527 return CAMERA_ERROR_INVALID_PARAMETER;
4530 int ret = CAMERA_ERROR_NONE;
4531 camera_cli_s *pc = (camera_cli_s *)camera;
4532 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EFFECT;
4534 if (pc->cb_info == NULL) {
4535 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4536 return CAMERA_ERROR_INVALID_PARAMETER;
4538 sock_fd = pc->cb_info->fd;
4541 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4542 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4544 if (ret == CAMERA_ERROR_NONE) {
4545 muse_camera_msg_get(get_effect, pc->cb_info->recv_msg);
4546 *effect = (camera_attr_effect_mode_e)get_effect;
4548 LOGD("ret : 0x%x", ret);
4553 int camera_attr_get_scene_mode(camera_h camera, camera_attr_scene_mode_e *mode)
4555 if (camera == NULL || mode == NULL) {
4556 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4557 return CAMERA_ERROR_INVALID_PARAMETER;
4560 int ret = CAMERA_ERROR_NONE;
4561 camera_cli_s *pc = (camera_cli_s *)camera;
4562 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_SCENE_MODE;
4564 if (pc->cb_info == NULL) {
4565 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4566 return CAMERA_ERROR_INVALID_PARAMETER;
4568 sock_fd = pc->cb_info->fd;
4571 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4572 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4574 if (ret == CAMERA_ERROR_NONE) {
4575 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
4576 *mode = (camera_attr_scene_mode_e)get_mode;
4578 LOGD("ret : 0x%x", ret);
4583 int camera_attr_is_enabled_tag(camera_h camera, bool *enable)
4585 if (camera == NULL || enable == NULL) {
4586 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4587 return CAMERA_ERROR_INVALID_PARAMETER;
4590 int ret = CAMERA_ERROR_NONE;
4591 camera_cli_s *pc = (camera_cli_s *)camera;
4592 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_TAG;
4594 if (pc->cb_info == NULL) {
4595 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4596 return CAMERA_ERROR_INVALID_PARAMETER;
4598 sock_fd = pc->cb_info->fd;
4601 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4602 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4604 if (ret == CAMERA_ERROR_NONE) {
4605 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
4606 *enable = (bool)get_enabled;
4608 LOGD("ret : 0x%x", ret);
4613 int camera_attr_get_tag_image_description(camera_h camera, char **description)
4615 if (camera == NULL || description == NULL) {
4616 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4617 return CAMERA_ERROR_INVALID_PARAMETER;
4620 int ret = CAMERA_ERROR_NONE;
4621 camera_cli_s *pc = (camera_cli_s *)camera;
4622 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_IMAGE_DESCRIPTION;
4624 if (pc->cb_info == NULL) {
4625 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4626 return CAMERA_ERROR_INVALID_PARAMETER;
4628 sock_fd = pc->cb_info->fd;
4629 char get_description[MUSE_CAMERA_MSG_MAX_LENGTH] = {0,};
4631 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4632 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4634 if (ret == CAMERA_ERROR_NONE) {
4635 muse_camera_msg_get_string(get_description, pc->cb_info->recv_msg);
4636 *description = strdup(get_description);
4638 LOGD("ret : 0x%x", ret);
4643 int camera_attr_get_tag_orientation(camera_h camera, camera_attr_tag_orientation_e *orientation)
4645 if (camera == NULL || orientation == NULL) {
4646 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4647 return CAMERA_ERROR_INVALID_PARAMETER;
4650 int ret = CAMERA_ERROR_NONE;
4651 camera_cli_s *pc = (camera_cli_s *)camera;
4652 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_ORIENTATION;
4654 if (pc->cb_info == NULL) {
4655 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4656 return CAMERA_ERROR_INVALID_PARAMETER;
4658 sock_fd = pc->cb_info->fd;
4659 int get_orientation;
4661 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4662 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4664 if (ret == CAMERA_ERROR_NONE) {
4665 muse_camera_msg_get(get_orientation, pc->cb_info->recv_msg);
4666 *orientation = (camera_attr_tag_orientation_e)get_orientation;
4667 LOGD("success, orientation : %d", *orientation);
4669 LOGD("ret : 0x%x", ret);
4674 int camera_attr_get_tag_software(camera_h camera, char **software)
4676 if (camera == NULL || software == NULL) {
4677 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4678 return CAMERA_ERROR_INVALID_PARAMETER;
4681 int ret = CAMERA_ERROR_NONE;
4682 camera_cli_s *pc = (camera_cli_s *)camera;
4683 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_SOFTWARE;
4685 if (pc->cb_info == NULL) {
4686 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4687 return CAMERA_ERROR_INVALID_PARAMETER;
4689 sock_fd = pc->cb_info->fd;
4690 char get_software[MUSE_CAMERA_MSG_MAX_LENGTH] = {0,};
4692 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4693 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4695 if (ret == CAMERA_ERROR_NONE) {
4696 muse_camera_msg_get_string(get_software, pc->cb_info->recv_msg);
4697 *software = strdup(get_software);
4699 LOGD("ret : 0x%x", ret);
4704 int camera_attr_get_geotag(camera_h camera, double *latitude , double *longitude, double *altitude)
4706 if (camera == NULL || latitude == NULL || longitude == NULL || altitude == NULL) {
4707 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4708 return CAMERA_ERROR_INVALID_PARAMETER;
4711 int ret = CAMERA_ERROR_NONE;
4712 camera_cli_s *pc = (camera_cli_s *)camera;
4713 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_GEOTAG;
4714 double get_geotag[3] = {0,};
4716 if (pc->cb_info == NULL) {
4717 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4718 return CAMERA_ERROR_INVALID_PARAMETER;
4720 sock_fd = pc->cb_info->fd;
4722 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4724 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4726 if (ret == CAMERA_ERROR_NONE) {
4727 muse_camera_msg_get_array(get_geotag, pc->cb_info->recv_msg);
4728 *latitude = get_geotag[0];
4729 *longitude = get_geotag[1];
4730 *altitude = get_geotag[2];
4732 LOGD("ret : 0x%x", ret);
4734 LOGE("Returned value is not valid : 0x%x", ret);
4741 int camera_attr_get_flash_mode(camera_h camera, camera_attr_flash_mode_e *mode)
4743 if (camera == NULL || mode == NULL) {
4744 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4745 return CAMERA_ERROR_INVALID_PARAMETER;
4748 int ret = CAMERA_ERROR_NONE;
4749 camera_cli_s *pc = (camera_cli_s *)camera;
4750 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_FLASH_MODE;
4752 if (pc->cb_info == NULL) {
4753 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4754 return CAMERA_ERROR_INVALID_PARAMETER;
4756 sock_fd = pc->cb_info->fd;
4759 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4760 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4762 if (ret == CAMERA_ERROR_NONE) {
4763 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
4764 *mode = (camera_attr_flash_mode_e)get_mode;
4766 LOGD("ret : 0x%x", ret);
4770 int camera_get_flash_state(camera_device_e device, camera_flash_state_e *state)
4774 int ret = CAMERA_ERROR_NONE;
4775 camera_cli_s *pc = NULL;
4776 int get_flash_state = 0;
4778 /* create muse connection */
4779 muse_camera_api_e api = MUSE_CAMERA_API_GET_FLASH_STATE;
4780 muse_core_api_module_e muse_module = MUSE_CAMERA;
4781 int device_type = (int)device;
4783 sock_fd = muse_core_client_new();
4785 LOGE("muse_core_client_new failed - returned fd %d", sock_fd);
4786 ret = CAMERA_ERROR_INVALID_OPERATION;
4790 sndMsg = muse_core_msg_json_factory_new(api,
4791 MUSE_TYPE_INT, "module", muse_module,
4792 MUSE_TYPE_INT, PARAM_DEVICE_TYPE, device_type,
4795 muse_core_ipc_send_msg(sock_fd, sndMsg);
4796 muse_core_msg_json_factory_free(sndMsg);
4798 pc = g_new0(camera_cli_s, 1);
4800 LOGE("camera_cli_s alloc failed");
4801 ret = CAMERA_ERROR_OUT_OF_MEMORY;
4805 pc->cb_info = _client_callback_new(sock_fd);
4806 if (pc->cb_info == NULL) {
4807 LOGE("cb_info alloc failed");
4808 ret = CAMERA_ERROR_OUT_OF_MEMORY;
4812 ret = _client_wait_for_cb_return(api, pc->cb_info, CALLBACK_TIME_OUT);
4814 if (ret == CAMERA_ERROR_NONE) {
4815 muse_camera_msg_get(get_flash_state, pc->cb_info->recv_msg);
4816 *state = (camera_flash_state_e)get_flash_state;
4819 LOGD("Flash state : %d\n", *state);
4822 /* release resources */
4824 g_atomic_int_set(&pc->cb_info->msg_recv_running, 0);
4825 g_atomic_int_set(&pc->cb_info->msg_handler_running, 0);
4826 _client_callback_destroy(pc->cb_info);
4835 int camera_attr_foreach_supported_af_mode(camera_h camera, camera_attr_supported_af_mode_cb foreach_cb, void *user_data)
4837 if (camera == NULL || foreach_cb == NULL) {
4838 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4839 return CAMERA_ERROR_INVALID_PARAMETER;
4841 int ret = CAMERA_ERROR_NONE;
4843 camera_cli_s *pc = (camera_cli_s *)camera;
4844 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_AF_MODE;
4846 LOGD("Enter, handle :%x", pc->remote_handle);
4849 if (pc->cb_info == NULL) {
4850 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4851 return CAMERA_ERROR_INVALID_PARAMETER;
4853 sock_fd = pc->cb_info->fd;
4854 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_AF_MODE] = foreach_cb;
4855 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_AF_MODE] = user_data;
4857 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4858 LOGD("ret : 0x%x", ret);
4863 int camera_attr_foreach_supported_exposure_mode(camera_h camera, camera_attr_supported_exposure_mode_cb foreach_cb , void *user_data)
4865 if (camera == NULL || foreach_cb == NULL) {
4866 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4867 return CAMERA_ERROR_INVALID_PARAMETER;
4869 int ret = CAMERA_ERROR_NONE;
4871 camera_cli_s *pc = (camera_cli_s *)camera;
4872 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_EXPOSURE_MODE;
4874 LOGD("Enter, handle :%x", pc->remote_handle);
4877 if (pc->cb_info == NULL) {
4878 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4879 return CAMERA_ERROR_INVALID_PARAMETER;
4881 sock_fd = pc->cb_info->fd;
4882 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EXPOSURE_MODE] = foreach_cb;
4883 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EXPOSURE_MODE] = user_data;
4885 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4886 LOGD("ret : 0x%x", ret);
4891 int camera_attr_foreach_supported_iso(camera_h camera, camera_attr_supported_iso_cb foreach_cb, void *user_data)
4893 if (camera == NULL || foreach_cb == NULL) {
4894 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4895 return CAMERA_ERROR_INVALID_PARAMETER;
4897 int ret = CAMERA_ERROR_NONE;
4899 camera_cli_s *pc = (camera_cli_s *)camera;
4900 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_ISO;
4902 LOGD("Enter, handle :%x", pc->remote_handle);
4905 if (pc->cb_info == NULL) {
4906 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4907 return CAMERA_ERROR_INVALID_PARAMETER;
4909 sock_fd = pc->cb_info->fd;
4910 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_ISO] = foreach_cb;
4911 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_ISO] = user_data;
4913 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4914 LOGD("ret : 0x%x", ret);
4919 int camera_attr_foreach_supported_whitebalance(camera_h camera, camera_attr_supported_whitebalance_cb foreach_cb , void *user_data)
4921 if (camera == NULL || foreach_cb == NULL) {
4922 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4923 return CAMERA_ERROR_INVALID_PARAMETER;
4925 int ret = CAMERA_ERROR_NONE;
4927 camera_cli_s *pc = (camera_cli_s *)camera;
4928 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_WHITEBALANCE;
4930 LOGD("Enter, handle :%x", pc->remote_handle);
4933 if (pc->cb_info == NULL) {
4934 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4935 return CAMERA_ERROR_INVALID_PARAMETER;
4937 sock_fd = pc->cb_info->fd;
4938 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_WHITEBALANCE] = foreach_cb;
4939 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_WHITEBALANCE] = user_data;
4941 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4942 LOGD("ret : 0x%x", ret);
4947 int camera_attr_foreach_supported_effect(camera_h camera, camera_attr_supported_effect_cb foreach_cb , void *user_data)
4949 if (camera == NULL || foreach_cb == NULL) {
4950 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4951 return CAMERA_ERROR_INVALID_PARAMETER;
4953 int ret = CAMERA_ERROR_NONE;
4955 camera_cli_s *pc = (camera_cli_s *)camera;
4956 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_EFFECT;
4958 LOGD("Enter, handle :%x", pc->remote_handle);
4961 if (pc->cb_info == NULL) {
4962 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4963 return CAMERA_ERROR_INVALID_PARAMETER;
4965 sock_fd = pc->cb_info->fd;
4966 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EFFECT] = foreach_cb;
4967 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EFFECT] = user_data;
4969 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4970 LOGD("ret : 0x%x", ret);
4975 int camera_attr_foreach_supported_scene_mode(camera_h camera, camera_attr_supported_scene_mode_cb foreach_cb , void *user_data)
4977 if (camera == NULL || foreach_cb == NULL) {
4978 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4979 return CAMERA_ERROR_INVALID_PARAMETER;
4981 int ret = CAMERA_ERROR_NONE;
4983 camera_cli_s *pc = (camera_cli_s *)camera;
4984 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_SCENE_MODE;
4986 LOGD("Enter, handle :%x", pc->remote_handle);
4989 if (pc->cb_info == NULL) {
4990 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4991 return CAMERA_ERROR_INVALID_PARAMETER;
4993 sock_fd = pc->cb_info->fd;
4994 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_SCENE_MODE] = foreach_cb;
4995 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_SCENE_MODE] = user_data;
4997 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4998 LOGD("ret : 0x%x", ret);
5003 int camera_attr_foreach_supported_flash_mode(camera_h camera, camera_attr_supported_flash_mode_cb foreach_cb , void *user_data)
5005 if (camera == NULL || foreach_cb == NULL) {
5006 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5007 return CAMERA_ERROR_INVALID_PARAMETER;
5009 int ret = CAMERA_ERROR_NONE;
5011 camera_cli_s *pc = (camera_cli_s *)camera;
5012 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FLASH_MODE;
5014 LOGD("Enter, handle :%x", pc->remote_handle);
5017 if (pc->cb_info == NULL) {
5018 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5019 return CAMERA_ERROR_INVALID_PARAMETER;
5021 sock_fd = pc->cb_info->fd;
5022 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FLASH_MODE] = foreach_cb;
5023 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FLASH_MODE] = user_data;
5025 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5026 LOGD("ret : 0x%x", ret);
5031 int camera_attr_foreach_supported_fps(camera_h camera, camera_attr_supported_fps_cb foreach_cb , void *user_data)
5033 if (camera == NULL || foreach_cb == NULL) {
5034 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5035 return CAMERA_ERROR_INVALID_PARAMETER;
5037 int ret = CAMERA_ERROR_NONE;
5039 camera_cli_s *pc = (camera_cli_s *)camera;
5040 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FPS;
5042 if (pc->cb_info == NULL) {
5043 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5044 return CAMERA_ERROR_INVALID_PARAMETER;
5046 sock_fd = pc->cb_info->fd;
5047 LOGD("Enter, handle :%x", pc->remote_handle);
5048 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS] = foreach_cb;
5049 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS] = user_data;
5051 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5052 LOGD("Enter, handle :%x", pc->remote_handle);
5056 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)
5058 if (camera == NULL || foreach_cb == NULL) {
5059 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5060 return CAMERA_ERROR_INVALID_PARAMETER;
5062 int ret = CAMERA_ERROR_NONE;
5064 camera_cli_s *pc = (camera_cli_s *)camera;
5065 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FPS_BY_RESOLUTION;
5067 if (pc->cb_info == NULL) {
5068 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5069 return CAMERA_ERROR_INVALID_PARAMETER;
5071 sock_fd = pc->cb_info->fd;
5072 LOGD("Enter, handle :%x", pc->remote_handle);
5073 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS_BY_RESOLUTION] = foreach_cb;
5074 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS_BY_RESOLUTION] = user_data;
5076 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, width, INT, height);
5077 LOGD("ret : 0x%x", ret);
5081 int camera_attr_foreach_supported_stream_flip(camera_h camera, camera_attr_supported_stream_flip_cb foreach_cb, void *user_data)
5083 if (camera == NULL || foreach_cb == NULL) {
5084 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5085 return CAMERA_ERROR_INVALID_PARAMETER;
5087 int ret = CAMERA_ERROR_NONE;
5089 camera_cli_s *pc = (camera_cli_s *)camera;
5090 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_STREAM_FLIP;
5092 if (pc->cb_info == NULL) {
5093 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5094 return CAMERA_ERROR_INVALID_PARAMETER;
5096 sock_fd = pc->cb_info->fd;
5097 LOGD("Enter, handle :%x", pc->remote_handle);
5098 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_FLIP] = foreach_cb;
5099 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_FLIP] = user_data;
5101 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5102 LOGD("ret : 0x%x", ret);
5107 int camera_attr_foreach_supported_stream_rotation(camera_h camera, camera_attr_supported_stream_rotation_cb foreach_cb, void *user_data)
5109 if (camera == NULL || foreach_cb == NULL) {
5110 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5111 return CAMERA_ERROR_INVALID_PARAMETER;
5113 int ret = CAMERA_ERROR_NONE;
5115 camera_cli_s *pc = (camera_cli_s *)camera;
5116 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_STREAM_ROTATION;
5118 if (pc->cb_info == NULL) {
5119 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5120 return CAMERA_ERROR_INVALID_PARAMETER;
5122 sock_fd = pc->cb_info->fd;
5123 LOGD("Enter, handle :%x", pc->remote_handle);
5124 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION] = foreach_cb;
5125 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION] = user_data;
5127 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5128 LOGD("ret : 0x%x", ret);
5133 int camera_attr_set_stream_rotation(camera_h camera , camera_rotation_e rotation)
5135 if (camera == NULL) {
5136 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5137 return CAMERA_ERROR_INVALID_PARAMETER;
5140 int ret = CAMERA_ERROR_NONE;
5141 camera_cli_s *pc = (camera_cli_s *)camera;
5142 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_STREAM_ROTATION;
5144 if (pc->cb_info == NULL) {
5145 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5146 return CAMERA_ERROR_INVALID_PARAMETER;
5148 sock_fd = pc->cb_info->fd;
5149 int set_rotation = (int)rotation;
5151 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5152 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_rotation);
5153 LOGD("ret : 0x%x", ret);
5158 int camera_attr_get_stream_rotation(camera_h camera , camera_rotation_e *rotation)
5160 if (camera == NULL || rotation == NULL) {
5161 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5162 return CAMERA_ERROR_INVALID_PARAMETER;
5165 int ret = CAMERA_ERROR_NONE;
5166 camera_cli_s *pc = (camera_cli_s *)camera;
5167 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_STREAM_ROTATION;
5169 if (pc->cb_info == NULL) {
5170 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5171 return CAMERA_ERROR_INVALID_PARAMETER;
5173 sock_fd = pc->cb_info->fd;
5176 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5177 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5179 if (ret == CAMERA_ERROR_NONE) {
5180 muse_camera_msg_get(get_rotation, pc->cb_info->recv_msg);
5181 *rotation = (camera_rotation_e)get_rotation;
5183 LOGD("ret : 0x%x", ret);
5188 int camera_attr_set_stream_flip(camera_h camera , camera_flip_e flip)
5190 if (camera == NULL) {
5191 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5192 return CAMERA_ERROR_INVALID_PARAMETER;
5195 int ret = CAMERA_ERROR_NONE;
5196 camera_cli_s *pc = (camera_cli_s *)camera;
5197 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_STREAM_FLIP;
5199 if (pc->cb_info == NULL) {
5200 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5201 return CAMERA_ERROR_INVALID_PARAMETER;
5203 sock_fd = pc->cb_info->fd;
5204 int set_flip = (int)flip;
5206 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5207 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_flip);
5208 LOGD("ret : 0x%x", ret);
5213 int camera_attr_get_stream_flip(camera_h camera , camera_flip_e *flip)
5215 if (camera == NULL || flip == NULL) {
5216 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5217 return CAMERA_ERROR_INVALID_PARAMETER;
5220 int ret = CAMERA_ERROR_NONE;
5221 camera_cli_s *pc = (camera_cli_s *)camera;
5222 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_STREAM_FLIP;
5224 if (pc->cb_info == NULL) {
5225 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5226 return CAMERA_ERROR_INVALID_PARAMETER;
5228 sock_fd = pc->cb_info->fd;
5231 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5232 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5234 if (ret == CAMERA_ERROR_NONE) {
5235 muse_camera_msg_get(get_flip, pc->cb_info->recv_msg);
5236 *flip = (camera_flip_e)get_flip;
5238 LOGD("ret : 0x%x", ret);
5242 int camera_attr_set_hdr_mode(camera_h camera, camera_attr_hdr_mode_e mode)
5244 if (camera == NULL) {
5245 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5246 return CAMERA_ERROR_INVALID_PARAMETER;
5249 int ret = CAMERA_ERROR_NONE;
5250 camera_cli_s *pc = (camera_cli_s *)camera;
5251 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_HDR_MODE;
5253 if (pc->cb_info == NULL) {
5254 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5255 return CAMERA_ERROR_INVALID_PARAMETER;
5257 sock_fd = pc->cb_info->fd;
5258 int set_mode = (int)mode;
5260 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5261 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
5262 LOGD("ret : 0x%x", ret);
5267 int camera_attr_get_hdr_mode(camera_h camera, camera_attr_hdr_mode_e *mode)
5269 if (camera == NULL) {
5270 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5271 return CAMERA_ERROR_INVALID_PARAMETER;
5274 LOGE("CAMERA_ERROR_NOT_SUPPORTED(0x%08x) - mode", CAMERA_ERROR_NOT_SUPPORTED);
5275 return CAMERA_ERROR_NOT_SUPPORTED;
5277 int ret = CAMERA_ERROR_NONE;
5278 camera_cli_s *pc = (camera_cli_s *)camera;
5279 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_HDR_MODE;
5281 if (pc->cb_info == NULL) {
5282 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5283 return CAMERA_ERROR_INVALID_PARAMETER;
5285 sock_fd = pc->cb_info->fd;
5288 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5289 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5291 if (ret == CAMERA_ERROR_NONE) {
5292 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
5293 *mode = (camera_attr_hdr_mode_e)get_mode;
5295 LOGD("ret : 0x%x", ret);
5300 bool camera_attr_is_supported_hdr_capture(camera_h camera)
5302 if (camera == NULL) {
5303 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5307 int ret = CAMERA_ERROR_NONE;
5308 camera_cli_s *pc = (camera_cli_s *)camera;
5309 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_HDR_CAPTURE;
5311 if (pc->cb_info == NULL) {
5312 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5313 return CAMERA_ERROR_INVALID_PARAMETER;
5315 sock_fd = pc->cb_info->fd;
5316 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5317 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5318 LOGD("ret : 0x%x", ret);
5323 int camera_attr_set_hdr_capture_progress_cb(camera_h camera, camera_attr_hdr_progress_cb callback, void *user_data)
5325 if (camera == NULL) {
5326 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5327 return CAMERA_ERROR_INVALID_PARAMETER;
5329 if (callback == NULL) {
5330 LOGE("CAMERA_ERROR_NOT_SUPPORTED(0x%08x) - callback", CAMERA_ERROR_NOT_SUPPORTED);
5331 return CAMERA_ERROR_NOT_SUPPORTED;
5333 int ret = CAMERA_ERROR_NONE;
5335 camera_cli_s *pc = (camera_cli_s *)camera;
5336 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_HDR_CAPTURE_PROGRESS_CB;
5338 if (pc->cb_info == NULL) {
5339 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5340 return CAMERA_ERROR_INVALID_PARAMETER;
5342 sock_fd = pc->cb_info->fd;
5343 LOGD("Enter, handle :%x", pc->remote_handle);
5345 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = callback;
5346 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = user_data;
5348 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5349 LOGD("ret : 0x%x", ret);
5354 int camera_attr_unset_hdr_capture_progress_cb(camera_h camera)
5356 if (camera == NULL) {
5357 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5358 return CAMERA_ERROR_INVALID_PARAMETER;
5361 int ret = CAMERA_ERROR_NONE;
5363 camera_cli_s *pc = (camera_cli_s *)camera;
5364 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_UNSET_HDR_CAPTURE_PROGRESS_CB;
5366 if (pc->cb_info == NULL) {
5367 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5368 return CAMERA_ERROR_INVALID_PARAMETER;
5370 sock_fd = pc->cb_info->fd;
5371 LOGD("Enter, handle :%x", pc->remote_handle);
5373 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = (void *)NULL;
5374 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = (void *)NULL;
5376 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5377 LOGD("ret : 0x%x", ret);
5382 int camera_attr_enable_anti_shake(camera_h camera, bool enable)
5384 if (camera == NULL) {
5385 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5386 return CAMERA_ERROR_INVALID_PARAMETER;
5389 int ret = CAMERA_ERROR_NONE;
5390 camera_cli_s *pc = (camera_cli_s *)camera;
5391 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_ANTI_SHAKE;
5393 if (pc->cb_info == NULL) {
5394 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5395 return CAMERA_ERROR_INVALID_PARAMETER;
5397 sock_fd = pc->cb_info->fd;
5398 int set_enable = (int)enable;
5400 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5401 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
5402 LOGD("ret : 0x%x", ret);
5407 int camera_attr_is_enabled_anti_shake(camera_h camera , bool *enabled)
5409 if (camera == NULL) {
5410 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5411 return CAMERA_ERROR_INVALID_PARAMETER;
5413 if (enabled == NULL) {
5414 LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER);
5415 return CAMERA_ERROR_NOT_SUPPORTED;
5417 int ret = CAMERA_ERROR_NONE;
5418 camera_cli_s *pc = (camera_cli_s *)camera;
5419 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_ANTI_SHAKE;
5421 if (pc->cb_info == NULL) {
5422 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5423 return CAMERA_ERROR_INVALID_PARAMETER;
5425 sock_fd = pc->cb_info->fd;
5428 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5429 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5431 if (ret == CAMERA_ERROR_NONE) {
5432 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
5433 *enabled = (bool)get_enabled;
5435 LOGD("ret : 0x%x", ret);
5440 bool camera_attr_is_supported_anti_shake(camera_h camera)
5443 if (camera == NULL) {
5444 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5448 int ret = CAMERA_ERROR_NONE;
5449 camera_cli_s *pc = (camera_cli_s *)camera;
5450 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_ANTI_SHAKE;
5452 if (pc->cb_info == NULL) {
5453 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5454 return CAMERA_ERROR_INVALID_PARAMETER;
5456 sock_fd = pc->cb_info->fd;
5457 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5458 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5459 LOGD("ret : 0x%x", ret);
5464 int camera_attr_enable_video_stabilization(camera_h camera, bool enable)
5466 if (camera == NULL) {
5467 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5468 return CAMERA_ERROR_INVALID_PARAMETER;
5471 int ret = CAMERA_ERROR_NONE;
5472 camera_cli_s *pc = (camera_cli_s *)camera;
5473 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_VIDEO_STABILIZATION;
5475 if (pc->cb_info == NULL) {
5476 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5477 return CAMERA_ERROR_INVALID_PARAMETER;
5479 sock_fd = pc->cb_info->fd;
5480 int set_enable = (int)enable;
5482 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5483 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
5484 LOGD("ret : 0x%x", ret);
5489 int camera_attr_is_enabled_video_stabilization(camera_h camera, bool *enabled)
5491 if (camera == NULL) {
5492 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5493 return CAMERA_ERROR_INVALID_PARAMETER;
5495 if (enabled == NULL) {
5496 LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER);
5497 return CAMERA_ERROR_NOT_SUPPORTED;
5499 int ret = CAMERA_ERROR_NONE;
5500 camera_cli_s *pc = (camera_cli_s *)camera;
5501 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_VIDEO_STABILIZATION;
5503 if (pc->cb_info == NULL) {
5504 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5505 return CAMERA_ERROR_INVALID_PARAMETER;
5507 sock_fd = pc->cb_info->fd;
5510 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5511 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5513 if (ret == CAMERA_ERROR_NONE) {
5514 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
5515 *enabled = (bool)get_enabled;
5517 LOGD("ret : 0x%x", ret);
5522 bool camera_attr_is_supported_video_stabilization(camera_h camera)
5524 if (camera == NULL) {
5525 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5529 int ret = CAMERA_ERROR_NONE;
5530 camera_cli_s *pc = (camera_cli_s *)camera;
5531 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_VIDEO_STABILIZATION;
5533 if (pc->cb_info == NULL) {
5534 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5535 return CAMERA_ERROR_INVALID_PARAMETER;
5537 sock_fd = pc->cb_info->fd;
5538 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5539 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5540 LOGD("ret : 0x%x", ret);
5545 int camera_attr_enable_auto_contrast(camera_h camera, bool enable)
5547 if (camera == NULL) {
5548 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5549 return CAMERA_ERROR_INVALID_PARAMETER;
5552 int ret = CAMERA_ERROR_NONE;
5553 camera_cli_s *pc = (camera_cli_s *)camera;
5554 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_AUTO_CONTRAST;
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 int set_enable = (int)enable;
5563 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5564 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
5565 LOGD("ret : 0x%x", ret);
5570 int camera_attr_is_enabled_auto_contrast(camera_h camera, bool *enabled)
5572 if (camera == NULL) {
5573 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5574 return CAMERA_ERROR_INVALID_PARAMETER;
5576 if (enabled == NULL) {
5577 LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER);
5578 return CAMERA_ERROR_INVALID_PARAMETER;
5580 int ret = CAMERA_ERROR_NONE;
5581 camera_cli_s *pc = (camera_cli_s *)camera;
5582 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_AUTO_CONTRAST;
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;
5591 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5592 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5594 if (ret == CAMERA_ERROR_NONE) {
5595 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
5596 *enabled = (bool)get_enabled;
5598 LOGD("ret : 0x%x", ret);
5603 bool camera_attr_is_supported_auto_contrast(camera_h camera)
5605 if (camera == NULL) {
5606 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5610 int ret = CAMERA_ERROR_NONE;
5611 camera_cli_s *pc = (camera_cli_s *)camera;
5612 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_AUTO_CONTRAST;
5614 if (pc->cb_info == NULL) {
5615 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5616 return CAMERA_ERROR_INVALID_PARAMETER;
5618 sock_fd = pc->cb_info->fd;
5619 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5620 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5621 LOGD("ret : 0x%x", ret);
5626 int camera_attr_disable_shutter_sound(camera_h camera, bool disable)
5628 if (camera == NULL) {
5629 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5630 return CAMERA_ERROR_INVALID_PARAMETER;
5633 int ret = CAMERA_ERROR_NONE;
5634 camera_cli_s *pc = (camera_cli_s *)camera;
5635 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_DISABLE_SHUTTER_SOUND;
5637 if (pc->cb_info == NULL) {
5638 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5639 return CAMERA_ERROR_INVALID_PARAMETER;
5641 sock_fd = pc->cb_info->fd;
5642 int set_disable = (int)disable;
5644 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5645 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_disable);
5646 LOGD("ret : 0x%x", ret);