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");
82 static void __global_remove(void *data, struct wl_registry *wl_registry, uint32_t name)
88 static const struct wl_registry_listener _camera_wl_registry_listener =
94 void __parent_id_getter(void *data, struct tizen_resource *tizen_resource, uint32_t id)
101 *((unsigned int *)data) = id;
103 LOGD("[CLIENT] got parent_id [%u] from server", id);
108 static const struct tizen_resource_listener _camera_tz_resource_listener =
113 int _get_wl_info(Evas_Object *obj, camera_wl_info_s *wl_info)
115 int ret = CAMERA_ERROR_NONE;
116 Ecore_Wl_Window *window = NULL;
117 struct wl_display *display = NULL;
118 struct wl_surface *surface = NULL;
119 struct wl_registry *registry = NULL;
120 struct tizen_surface *tz_surface = NULL;
121 struct tizen_resource *tz_resource = NULL;
123 if (!obj || !wl_info) {
124 LOGE("NULL parameter %p %p", obj, wl_info);
125 return CAMERA_ERROR_INVALID_OPERATION;
128 window = elm_win_wl_window_get(obj);
130 LOGE("failed to get wayland window");
131 ret = CAMERA_ERROR_INVALID_OPERATION;
135 surface = (struct wl_surface *)ecore_wl_window_surface_get(window);
137 LOGE("failed to get wayland surface");
138 ret = CAMERA_ERROR_INVALID_OPERATION;
142 display = (struct wl_display *)ecore_wl_display_get();
144 LOGE("failed to get wayland display");
145 ret = CAMERA_ERROR_INVALID_OPERATION;
149 registry = wl_display_get_registry(display);
151 LOGE("failed to get wayland registry");
152 ret = CAMERA_ERROR_INVALID_OPERATION;
156 wl_registry_add_listener(registry, &_camera_wl_registry_listener, &tz_surface);
158 wl_display_dispatch(display);
159 wl_display_roundtrip(display);
162 LOGE("failed to get tizen surface");
163 ret = CAMERA_ERROR_INVALID_OPERATION;
167 /* Get parent_id which is unique in a entire systemw. */
168 tz_resource = tizen_surface_get_tizen_resource(tz_surface, surface);
170 LOGE("failed to get tizen resurce");
171 ret = CAMERA_ERROR_INVALID_OPERATION;
175 wl_info->parent_id = 0;
177 tizen_resource_add_listener(tz_resource, &_camera_tz_resource_listener, &wl_info->parent_id);
179 wl_display_roundtrip(display);
181 if (wl_info->parent_id > 0) {
183 Ecore_Evas *ecore_evas = NULL;
184 ret = CAMERA_ERROR_NONE;
186 wl_info->evas_obj = obj;
188 evas_object_geometry_get(obj, &wl_info->window_x, &wl_info->window_y,
189 &wl_info->window_width, &wl_info->window_height);
191 ecore_evas = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
193 rotation = ecore_evas_rotation_get(ecore_evas);
194 if (rotation == 90 || rotation == 270) {
195 int temp = wl_info->window_width;
197 LOGD("swap width and height %d, %d", wl_info->window_width, wl_info->window_height);
199 wl_info->window_width = wl_info->window_height;
200 wl_info->window_height = temp;
203 LOGW("failed to get ecore_evas.. skip rotation check");
206 LOGD("evas object : %p, rotation : %d, parent id : %u, window : %d,%d,%dx%d",
207 wl_info->evas_obj, rotation, wl_info->parent_id,
208 wl_info->window_x, wl_info->window_y,
209 wl_info->window_width, wl_info->window_height);
211 ret = CAMERA_ERROR_INVALID_OPERATION;
212 LOGE("failed to get parent id");
217 tizen_surface_destroy(tz_surface);
222 tizen_resource_destroy(tz_resource);
227 wl_registry_destroy(registry);
233 #endif /* HAVE_WAYLAND */
235 static int _import_tbm_key(tbm_bufmgr bufmgr, unsigned int tbm_key, tbm_bo *bo, tbm_bo_handle *bo_handle)
237 tbm_bo tmp_bo = NULL;
238 tbm_bo_handle tmp_bo_handle = {NULL, };
240 if (bufmgr == NULL || bo == NULL || bo_handle == NULL || tbm_key == 0) {
241 LOGE("invalid parameter - bufmgr %p, bo %p, bo_handle %p, key %d",
242 bufmgr, bo, bo_handle, tbm_key);
246 tmp_bo = tbm_bo_import(bufmgr, tbm_key);
247 if (tmp_bo == NULL) {
248 LOGE("bo import failed - bufmgr %p, key %d", bufmgr, tbm_key);
252 tmp_bo_handle = tbm_bo_map(tmp_bo, TBM_DEVICE_CPU, TBM_OPTION_READ);
253 if (tmp_bo_handle.ptr == NULL) {
254 LOGE("bo map failed %p", tmp_bo);
255 tbm_bo_unref(tmp_bo);
260 /* set bo and bo_handle */
262 *bo_handle = tmp_bo_handle;
267 static void _release_imported_bo(tbm_bo *bo)
269 if (bo == NULL || *bo == NULL) {
281 static int _client_wait_for_cb_return(muse_camera_api_e api, camera_cb_info_s *cb_info, int time_out)
283 int ret = CAMERA_ERROR_NONE;
286 LOGD("Enter api : %d", api);
288 g_mutex_lock(&(cb_info->api_mutex[api]));
290 if (cb_info->api_activating[api] == 0) {
291 end_time = g_get_monotonic_time() + time_out * G_TIME_SPAN_SECOND;
292 if (g_cond_wait_until(&(cb_info->api_cond[api]), &(cb_info->api_mutex[api]), end_time)) {
293 ret = cb_info->api_ret[api];
294 cb_info->api_activating[api] = 0;
296 LOGD("return value : 0x%x", ret);
298 ret = CAMERA_ERROR_INVALID_OPERATION;
300 LOGE("api %d was TIMED OUT!", api);
303 ret = cb_info->api_ret[api];
304 cb_info->api_activating[api] = 0;
306 LOGD("condition is already checked for the api[%d], return[0x%x]", api, ret);
309 g_mutex_unlock(&(cb_info->api_mutex[api]));
314 int _camera_get_tbm_surface_format(int in_format, uint32_t *out_format)
316 if (in_format <= MM_PIXEL_FORMAT_INVALID ||
317 in_format >= MM_PIXEL_FORMAT_NUM ||
318 out_format == NULL) {
319 LOGE("INVALID_PARAMETER : in_format %d, out_format ptr %p", in_format, out_format);
320 return CAMERA_ERROR_INVALID_PARAMETER;
324 case MM_PIXEL_FORMAT_NV12:
325 case MM_PIXEL_FORMAT_NV12T:
326 *out_format = TBM_FORMAT_NV12;
328 case MM_PIXEL_FORMAT_NV16:
329 *out_format = TBM_FORMAT_NV16;
331 case MM_PIXEL_FORMAT_NV21:
332 *out_format = TBM_FORMAT_NV21;
334 case MM_PIXEL_FORMAT_YUYV:
335 *out_format = TBM_FORMAT_YUYV;
337 case MM_PIXEL_FORMAT_UYVY:
338 case MM_PIXEL_FORMAT_ITLV_JPEG_UYVY:
339 *out_format = TBM_FORMAT_UYVY;
341 case MM_PIXEL_FORMAT_422P:
342 *out_format = TBM_FORMAT_YUV422;
344 case MM_PIXEL_FORMAT_I420:
345 *out_format = TBM_FORMAT_YUV420;
347 case MM_PIXEL_FORMAT_YV12:
348 *out_format = TBM_FORMAT_YVU420;
350 case MM_PIXEL_FORMAT_RGB565:
351 *out_format = TBM_FORMAT_RGB565;
353 case MM_PIXEL_FORMAT_RGB888:
354 *out_format = TBM_FORMAT_RGB888;
356 case MM_PIXEL_FORMAT_RGBA:
357 *out_format = TBM_FORMAT_RGBA8888;
359 case MM_PIXEL_FORMAT_ARGB:
360 *out_format = TBM_FORMAT_ARGB8888;
363 LOGE("invalid in_format %d", in_format);
364 return CAMERA_ERROR_INVALID_PARAMETER;
367 return CAMERA_ERROR_NONE;
371 int _camera_get_media_packet_mimetype(int in_format, media_format_mimetype_e *mimetype)
373 if (in_format <= MM_PIXEL_FORMAT_INVALID ||
374 in_format >= MM_PIXEL_FORMAT_NUM ||
376 LOGE("INVALID_PARAMETER : in_format %d, mimetype ptr %p", in_format, mimetype);
377 return CAMERA_ERROR_INVALID_PARAMETER;
381 case MM_PIXEL_FORMAT_NV12:
382 case MM_PIXEL_FORMAT_NV12T:
383 *mimetype = MEDIA_FORMAT_NV12;
385 case MM_PIXEL_FORMAT_NV16:
386 *mimetype = MEDIA_FORMAT_NV16;
388 case MM_PIXEL_FORMAT_NV21:
389 *mimetype = MEDIA_FORMAT_NV21;
391 case MM_PIXEL_FORMAT_YUYV:
392 *mimetype = MEDIA_FORMAT_YUYV;
394 case MM_PIXEL_FORMAT_UYVY:
395 case MM_PIXEL_FORMAT_ITLV_JPEG_UYVY:
396 *mimetype = MEDIA_FORMAT_UYVY;
398 case MM_PIXEL_FORMAT_422P:
399 *mimetype = MEDIA_FORMAT_422P;
401 case MM_PIXEL_FORMAT_I420:
402 *mimetype = MEDIA_FORMAT_I420;
404 case MM_PIXEL_FORMAT_YV12:
405 *mimetype = MEDIA_FORMAT_YV12;
407 case MM_PIXEL_FORMAT_RGB565:
408 *mimetype = MEDIA_FORMAT_RGB565;
410 case MM_PIXEL_FORMAT_RGB888:
411 *mimetype = MEDIA_FORMAT_RGB888;
413 case MM_PIXEL_FORMAT_RGBA:
414 *mimetype = MEDIA_FORMAT_RGBA;
416 case MM_PIXEL_FORMAT_ARGB:
417 *mimetype = MEDIA_FORMAT_ARGB;
420 LOGE("invalid in_format %d", in_format);
421 return CAMERA_ERROR_INVALID_PARAMETER;
424 return CAMERA_ERROR_NONE;
427 int _camera_media_packet_finalize(media_packet_h pkt, int error_code, void *user_data)
431 camera_cb_info_s *cb_info = (camera_cb_info_s *)user_data;
432 camera_media_packet_data *mp_data = NULL;
433 tbm_surface_h tsurf = NULL;
435 if (pkt == NULL || cb_info == NULL) {
436 LOGE("invalid parameter buffer %p, cb_info %p", pkt, cb_info);
437 return MEDIA_PACKET_FINALIZE;
440 ret = media_packet_get_extra(pkt, (void **)&mp_data);
441 if (ret != MEDIA_PACKET_ERROR_NONE) {
442 LOGE("media_packet_get_extra failed 0x%x", ret);
443 return MEDIA_PACKET_FINALIZE;
446 /*LOGD("mp_data %p", mp_data);*/
449 int tbm_key = mp_data->tbm_key;
451 /* release imported bo */
452 for (i = 0 ; i < mp_data->num_buffer_key ; i++) {
453 tbm_bo_unref(mp_data->buffer_bo[i]);
454 mp_data->buffer_bo[i] = NULL;
457 /* unmap and unref tbm bo */
458 _release_imported_bo(&mp_data->bo);
461 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
462 cb_info->fd, cb_info, INT, tbm_key);
467 ret = media_packet_get_tbm_surface(pkt, &tsurf);
468 if (ret != MEDIA_PACKET_ERROR_NONE) {
469 LOGE("media_packet_get_tbm_surface failed 0x%x", ret);
470 return MEDIA_PACKET_FINALIZE;
474 tbm_surface_destroy(tsurf);
478 return MEDIA_PACKET_FINALIZE;
481 static void _client_user_callback(camera_cb_info_s *cb_info, char *recv_msg, muse_camera_event_e event)
487 tbm_bo_handle bo_handle = {NULL, };
489 if (recv_msg == NULL || event >= MUSE_CAMERA_EVENT_TYPE_NUM) {
490 LOGE("invalid parameter - camera msg %p, event %d", recv_msg, event);
494 LOGD("get camera msg %s, event %d", recv_msg, event);
496 if (event == MUSE_CAMERA_EVENT_TYPE_PREVIEW) {
497 if (cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW] == NULL &&
498 cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] == NULL) {
499 LOGW("all preview callback from user are NULL");
502 } else if (cb_info->user_cb[event] == NULL) {
503 LOGW("user callback for event %d is not set", event);
508 case MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE:
514 muse_camera_msg_get(previous, recv_msg);
515 muse_camera_msg_get(current, recv_msg);
516 muse_camera_msg_get(by_policy, recv_msg);
518 LOGD("STATE CHANGE - previous %d, current %d, by_policy %d",
519 previous, current, by_policy);
521 ((camera_state_changed_cb)cb_info->user_cb[event])((camera_state_e)previous,
522 (camera_state_e)current, (bool)by_policy, cb_info->user_data[event]);
525 case MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE:
529 muse_camera_msg_get(state, recv_msg);
531 LOGD("FOCUS state - %d", state);
533 ((camera_focus_changed_cb)cb_info->user_cb[event])((camera_focus_state_e)state, cb_info->user_data[event]);
536 case MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE:
537 LOGD("CAPTURE_COMPLETED");
538 ((camera_capture_completed_cb)cb_info->user_cb[event])(cb_info->user_data[event]);
540 case MUSE_CAMERA_EVENT_TYPE_PREVIEW:
541 case MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW:
543 camera_preview_data_s frame;
544 unsigned char *buf_pos = NULL;
545 camera_stream_data_s *stream = NULL;
548 int num_buffer_key = 0;
549 int buffer_key[BUFFER_MAX_PLANE_NUM] = {0, };
550 tbm_bo buffer_bo[BUFFER_MAX_PLANE_NUM] = {NULL, };
551 tbm_bo_handle buffer_bo_handle[BUFFER_MAX_PLANE_NUM] = {{.ptr = NULL}, };
552 camera_media_packet_data *mp_data = NULL;
554 muse_camera_msg_get(tbm_key, recv_msg);
555 muse_camera_msg_get(num_buffer_key, recv_msg);
556 muse_camera_msg_get_array(buffer_key, recv_msg);
558 memset(&frame, 0x0, sizeof(camera_preview_data_s));
561 LOGE("invalid key %d", tbm_key);
565 /* import tbm bo and get virtual address */
566 if (!_import_tbm_key(cb_info->bufmgr, tbm_key, &bo, &bo_handle)) {
567 LOGE("failed to import key %d", tbm_key);
569 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
570 cb_info->fd, cb_info, INT, tbm_key);
574 buf_pos = (unsigned char *)bo_handle.ptr;
576 /* get stream info */
577 stream = (camera_stream_data_s *)buf_pos;
579 for (i = 0 ; i < num_buffer_key ; i++) {
580 /* import buffer bo and get virtual address */
581 if (!_import_tbm_key(cb_info->bufmgr, buffer_key[i], &buffer_bo[i], &buffer_bo_handle[i])) {
582 LOGE("failed to import buffer key %d", buffer_key[i]);
584 /* release imported bo */
585 for (i -= 1 ; i >= 0 ; i--)
586 _release_imported_bo(&buffer_bo[i]);
588 _release_imported_bo(&bo);
590 /* send return buffer */
591 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
592 cb_info->fd, cb_info, INT, tbm_key);
597 if (cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW]) {
599 if (stream->format == MM_PIXEL_FORMAT_ITLV_JPEG_UYVY)
600 frame.format = MM_PIXEL_FORMAT_UYVY;
602 frame.format = stream->format;
603 frame.width = stream->width;
604 frame.height = stream->height;
605 frame.timestamp = stream->timestamp;
606 frame.num_of_planes = stream->num_planes;
608 if (num_buffer_key == 0) {
610 buf_pos += sizeof(camera_stream_data_s);
612 if (stream->format == MM_PIXEL_FORMAT_ENCODED_H264) {
613 frame.data.encoded_plane.data = buf_pos;
614 frame.data.encoded_plane.size = stream->data.encoded.length_data;
615 total_size = stream->data.encoded.length_data;
617 switch (stream->num_planes) {
619 frame.data.single_plane.yuv = buf_pos;
620 frame.data.single_plane.size = stream->data.yuv420.length_yuv;
621 total_size = stream->data.yuv420.length_yuv;
624 frame.data.double_plane.y = buf_pos;
625 frame.data.double_plane.y_size = stream->data.yuv420sp.length_y;
626 buf_pos += stream->data.yuv420sp.length_y;
627 frame.data.double_plane.uv = buf_pos;
628 frame.data.double_plane.uv_size = stream->data.yuv420sp.length_uv;
629 total_size = stream->data.yuv420sp.length_y + \
630 stream->data.yuv420sp.length_uv;
633 frame.data.triple_plane.y = buf_pos;
634 frame.data.triple_plane.y_size = stream->data.yuv420p.length_y;
635 buf_pos += stream->data.yuv420p.length_y;
636 frame.data.triple_plane.u = buf_pos;
637 frame.data.triple_plane.u_size = stream->data.yuv420p.length_u;
638 buf_pos += stream->data.yuv420p.length_u;
639 frame.data.triple_plane.v = buf_pos;
640 frame.data.triple_plane.v_size = stream->data.yuv420p.length_v;
641 total_size = stream->data.yuv420p.length_y + \
642 stream->data.yuv420p.length_u + \
643 stream->data.yuv420p.length_v;
651 switch (stream->num_planes) {
653 frame.data.single_plane.yuv = buffer_bo_handle[0].ptr;
654 frame.data.single_plane.size = stream->data.yuv420.length_yuv;
655 total_size = stream->data.yuv420.length_yuv;
658 frame.data.double_plane.y = buffer_bo_handle[0].ptr;
659 if (stream->num_planes == (unsigned int)num_buffer_key)
660 frame.data.double_plane.uv = buffer_bo_handle[1].ptr;
662 frame.data.double_plane.uv = buffer_bo_handle[0].ptr + stream->data.yuv420sp.length_y;
663 frame.data.double_plane.y_size = stream->data.yuv420sp.length_y;
664 frame.data.double_plane.uv_size = stream->data.yuv420sp.length_uv;
665 total_size = stream->data.yuv420sp.length_y + \
666 stream->data.yuv420sp.length_uv;
669 frame.data.triple_plane.y = buffer_bo_handle[0].ptr;
670 if (stream->num_planes == (unsigned int)num_buffer_key) {
671 frame.data.triple_plane.u = buffer_bo_handle[1].ptr;
672 frame.data.triple_plane.v = buffer_bo_handle[2].ptr;
674 frame.data.triple_plane.u = buffer_bo_handle[0].ptr + stream->data.yuv420p.length_y;
675 frame.data.triple_plane.v = buffer_bo_handle[1].ptr + stream->data.yuv420p.length_u;
677 frame.data.triple_plane.y_size = stream->data.yuv420p.length_y;
678 frame.data.triple_plane.u_size = stream->data.yuv420p.length_u;
679 frame.data.triple_plane.v_size = stream->data.yuv420p.length_v;
680 total_size = stream->data.yuv420p.length_y + \
681 stream->data.yuv420p.length_u + \
682 stream->data.yuv420p.length_v;
690 LOGD("PREVIEW_CB - format %d, %dx%d, size %d plane num %d",
691 frame.format, frame.width, frame.height, total_size, frame.num_of_planes);
694 ((camera_preview_cb)cb_info->user_cb[event])(&frame, cb_info->user_data[event]);
696 /*LOGD("PREVIEW_CB retuned");*/
699 if (cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW]) {
700 media_packet_h pkt = NULL;
701 tbm_surface_h tsurf = NULL;
702 uint32_t bo_format = 0;
704 media_format_mimetype_e mimetype = MEDIA_FORMAT_NV12;
705 bool make_pkt_fmt = false;
706 tbm_surface_info_s tsurf_info;
708 memset(&tsurf_info, 0x0, sizeof(tbm_surface_info_s));
710 /* unmap buffer bo */
711 for (i = 0 ; i < num_buffer_key ; i++) {
713 tbm_bo_unmap(buffer_bo[i]);
716 /* create tbm surface */
717 for (i = 0 ; i < BUFFER_MAX_PLANE_NUM ; i++)
718 tsurf_info.planes[i].stride = stream->stride[i];
720 /* get tbm surface format */
721 ret = _camera_get_tbm_surface_format(stream->format, &bo_format);
722 ret |= _camera_get_media_packet_mimetype(stream->format, &mimetype);
724 if (num_buffer_key > 0 && ret == CAMERA_ERROR_NONE) {
725 tsurf_info.width = stream->width;
726 tsurf_info.height = stream->height;
727 tsurf_info.format = bo_format;
728 tsurf_info.bpp = tbm_surface_internal_get_bpp(bo_format);
729 tsurf_info.num_planes = tbm_surface_internal_get_num_planes(bo_format);
732 case TBM_FORMAT_NV12:
733 case TBM_FORMAT_NV21:
734 tsurf_info.planes[0].size = stream->stride[0] * stream->elevation[0];
735 tsurf_info.planes[1].size = stream->stride[1] * stream->elevation[1];
736 tsurf_info.planes[0].offset = 0;
737 if (num_buffer_key == 1)
738 tsurf_info.planes[1].offset = tsurf_info.planes[0].size;
739 tsurf_info.size = tsurf_info.planes[0].size + tsurf_info.planes[1].size;
741 case TBM_FORMAT_YUV420:
742 case TBM_FORMAT_YVU420:
743 tsurf_info.planes[0].size = stream->stride[0] * stream->elevation[0];
744 tsurf_info.planes[1].size = stream->stride[1] * stream->elevation[1];
745 tsurf_info.planes[2].size = stream->stride[2] * stream->elevation[2];
746 tsurf_info.planes[0].offset = 0;
747 if (num_buffer_key == 1) {
748 tsurf_info.planes[1].offset = tsurf_info.planes[0].size;
749 tsurf_info.planes[2].offset = tsurf_info.planes[0].size + tsurf_info.planes[1].size;
751 tsurf_info.size = tsurf_info.planes[0].size + tsurf_info.planes[1].size + tsurf_info.planes[2].size;
753 case TBM_FORMAT_UYVY:
754 case TBM_FORMAT_YUYV:
755 tsurf_info.planes[0].size = (stream->stride[0] * stream->elevation[0]) << 1;
756 tsurf_info.planes[0].offset = 0;
757 tsurf_info.size = tsurf_info.planes[0].size;
763 tsurf = tbm_surface_internal_create_with_bos(&tsurf_info, buffer_bo, num_buffer_key);
764 /*LOGD("tbm surface %p", tsurf);*/
768 /* check media packet format */
769 if (cb_info->pkt_fmt) {
770 int pkt_fmt_width = 0;
771 int pkt_fmt_height = 0;
772 media_format_mimetype_e pkt_fmt_mimetype = MEDIA_FORMAT_NV12;
774 media_format_get_video_info(cb_info->pkt_fmt, &pkt_fmt_mimetype, &pkt_fmt_width, &pkt_fmt_height, NULL, NULL);
775 if (pkt_fmt_mimetype != mimetype ||
776 pkt_fmt_width != stream->width ||
777 pkt_fmt_height != stream->height) {
778 LOGW("different format. current 0x%x, %dx%d, new 0x%x, %dx%d",
779 pkt_fmt_mimetype, pkt_fmt_width, pkt_fmt_height, mimetype, stream->width, stream->height);
780 media_format_unref(cb_info->pkt_fmt);
781 cb_info->pkt_fmt = NULL;
788 /* create packet format */
790 LOGW("make new pkt_fmt - mimetype 0x%x, %dx%d", mimetype, stream->width, stream->height);
791 ret = media_format_create(&cb_info->pkt_fmt);
792 if (ret == MEDIA_FORMAT_ERROR_NONE) {
793 ret = media_format_set_video_mime(cb_info->pkt_fmt, mimetype);
794 ret |= media_format_set_video_width(cb_info->pkt_fmt, stream->width);
795 ret |= media_format_set_video_height(cb_info->pkt_fmt, stream->height);
796 LOGW("media_format_set_video_mime,width,height ret : 0x%x", ret);
798 LOGW("media_format_create failed");
802 /* create media packet */
803 ret = media_packet_create_from_tbm_surface(cb_info->pkt_fmt,
804 tsurf, (media_packet_finalize_cb)_camera_media_packet_finalize,
805 (void *)cb_info, &pkt);
806 if (ret != MEDIA_PACKET_ERROR_NONE) {
807 LOGE("media_packet_create_from_tbm_surface failed");
809 tbm_surface_destroy(tsurf);
813 LOGE("failed to create tbm surface %dx%d, format %d, num_buffer_key %d",
814 stream->width, stream->height, stream->format, num_buffer_key);
818 /*LOGD("media packet %p, internal buffer %p", pkt, stream->internal_buffer);*/
820 mp_data = g_new0(camera_media_packet_data, 1);
822 mp_data->tbm_key = tbm_key;
823 mp_data->num_buffer_key = num_buffer_key;
825 for (i = 0 ; i < num_buffer_key ; i++)
826 mp_data->buffer_bo[i] = buffer_bo[i];
828 /* set media packet data */
829 ret = media_packet_set_extra(pkt, (void *)mp_data);
830 if (ret != MEDIA_PACKET_ERROR_NONE) {
831 LOGE("media_packet_set_extra failed");
838 media_packet_destroy(pkt);
841 int e_type = MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW;
843 /* set timestamp : msec -> nsec */
844 if (media_packet_set_pts(pkt, (uint64_t)(stream->timestamp) * 1000000) != MEDIA_PACKET_ERROR_NONE)
845 LOGW("media_packet_set_pts failed");
847 /* call media packet callback */
848 ((camera_media_packet_preview_cb)cb_info->user_cb[e_type])(pkt, cb_info->user_data[e_type]);
851 LOGE("failed to alloc media packet data");
856 /* send message for preview callback return */
857 muse_camera_msg_send_no_return(MUSE_CAMERA_API_PREVIEW_CB_RETURN, cb_info->fd, cb_info);
859 if (mp_data == NULL) {
860 /* release imported bo */
861 for (i = 0 ; i < num_buffer_key ; i++)
862 _release_imported_bo(&buffer_bo[i]);
864 /* unmap and unref tbm bo */
865 _release_imported_bo(&bo);
868 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
869 cb_info->fd, cb_info, INT, tbm_key);
871 /*LOGD("return buffer Done");*/
875 case MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS:
879 muse_camera_msg_get(percent, recv_msg);
881 LOGD("HDR progress - %d \%", percent);
883 ((camera_attr_hdr_progress_cb)cb_info->user_cb[event])(percent, cb_info->user_data[event]);
886 case MUSE_CAMERA_EVENT_TYPE_INTERRUPTED:
892 muse_camera_msg_get(policy, recv_msg);
893 muse_camera_msg_get(previous, recv_msg);
894 muse_camera_msg_get(current, recv_msg);
896 LOGD("INTERRUPTED - policy %d, state previous %d, current %d",
897 policy, previous, current);
899 ((camera_interrupted_cb)cb_info->user_cb[event])((camera_policy_e)policy,
900 (camera_state_e)previous, (camera_state_e)current, cb_info->user_data[event]);
903 case MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION:
906 camera_detected_face_s *faces = NULL;
908 muse_camera_msg_get(count, recv_msg);
909 muse_camera_msg_get(tbm_key, recv_msg);
911 if (count > 0 && tbm_key > 0) {
912 LOGD("FACE_DETECTION - count %d, tbm_key %d", count, tbm_key);
914 if (!_import_tbm_key(cb_info->bufmgr, tbm_key, &bo, &bo_handle))
918 faces = bo_handle.ptr;
920 ((camera_face_detected_cb)cb_info->user_cb[event])(faces, count, cb_info->user_data[event]);
926 for (i = 0 ; i < count ; i++) {
927 LOGD("id[%2d] - score %d, position (%d,%d,%dx%d)",
928 i, faces[i].score, faces[i].x, faces[i].y, faces[i].width, faces[i].height);
934 _release_imported_bo(&bo);
937 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
938 cb_info->fd, cb_info, INT, tbm_key);
940 LOGD("return buffer done");
942 LOGE("invalid message - count %d, key %d", count, tbm_key);
946 case MUSE_CAMERA_EVENT_TYPE_ERROR:
949 int current_state = 0;
951 muse_camera_msg_get(error, recv_msg);
952 muse_camera_msg_get(current_state, recv_msg);
954 LOGE("ERROR - error 0x%x, current_state %d", error, current_state);
956 ((camera_error_cb)cb_info->user_cb[event])((camera_error_e)error,
957 (camera_state_e)current_state, cb_info->user_data[event]);
960 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_RESOLUTION:
961 muse_camera_msg_get(param1, recv_msg);
962 muse_camera_msg_get(param2, recv_msg);
964 LOGD("SUPPORTED_PREVIEW_RESOLUTION - %d x %d", param1, param2);
966 if (((camera_supported_preview_resolution_cb)cb_info->user_cb[event])(param1, param2, cb_info->user_data[event]) == false) {
967 cb_info->user_cb[event] = NULL;
968 cb_info->user_data[event] = NULL;
969 LOGD("stop foreach callback for SUPPORTED_PREVIEW_RESOLUTION");
972 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_RESOLUTION:
973 muse_camera_msg_get(param1, recv_msg);
974 muse_camera_msg_get(param2, recv_msg);
976 LOGD("SUPPORTED_CAPTURE_RESOLUTION - %d x %d", param1, param2);
978 if (((camera_supported_capture_resolution_cb)cb_info->user_cb[event])(param1, param2, cb_info->user_data[event]) == false) {
979 cb_info->user_cb[event] = NULL;
980 cb_info->user_data[event] = NULL;
981 LOGD("stop foreach callback for SUPPORTED_CAPTURE_RESOLUTION");
984 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_FORMAT:
985 muse_camera_msg_get(param1, recv_msg);
987 LOGD("SUPPORTED_CAPTURE_FORMAT - %d ", param1);
989 if (((camera_supported_capture_format_cb)cb_info->user_cb[event])((camera_pixel_format_e)param1, cb_info->user_data[event]) == false) {
990 cb_info->user_cb[event] = NULL;
991 cb_info->user_data[event] = NULL;
992 LOGD("stop foreach callback for SUPPORTED_CAPTURE_FORMAT");
995 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_FORMAT:
996 muse_camera_msg_get(param1, recv_msg);
998 LOGD("SUPPORTED_PREVIEW_FORMAT - %d ", param1);
1000 if (((camera_supported_preview_format_cb)cb_info->user_cb[event])((camera_pixel_format_e)param1, cb_info->user_data[event]) == false) {
1001 cb_info->user_cb[event] = NULL;
1002 cb_info->user_data[event] = NULL;
1003 LOGD("stop foreach callback for SUPPORTED_PREVIEW_FORMAT");
1006 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_AF_MODE:
1007 muse_camera_msg_get(param1, recv_msg);
1009 LOGD("SUPPORTED_AF_MODE - %d ", param1);
1011 if (((camera_attr_supported_af_mode_cb)cb_info->user_cb[event])((camera_attr_af_mode_e)param1, cb_info->user_data[event]) == false) {
1012 cb_info->user_cb[event] = NULL;
1013 cb_info->user_data[event] = NULL;
1014 LOGD("stop foreach callback for SUPPORTED_AF_MODE");
1017 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EXPOSURE_MODE:
1018 muse_camera_msg_get(param1, recv_msg);
1020 LOGD("SUPPORTED_EXPOSURE_MODE - %d ", param1);
1022 if (((camera_attr_supported_exposure_mode_cb)cb_info->user_cb[event])((camera_attr_exposure_mode_e)param1, cb_info->user_data[event]) == false) {
1023 cb_info->user_cb[event] = NULL;
1024 cb_info->user_data[event] = NULL;
1025 LOGD("stop foreach callback for SUPPORTED_EXPOSURE_MODE");
1028 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_ISO:
1029 muse_camera_msg_get(param1, recv_msg);
1031 LOGD("SUPPORTED_ISO - %d ", param1);
1033 if (((camera_attr_supported_iso_cb)cb_info->user_cb[event])((camera_attr_iso_e)param1, cb_info->user_data[event]) == false) {
1034 cb_info->user_cb[event] = NULL;
1035 cb_info->user_data[event] = NULL;
1036 LOGD("stop foreach callback for SUPPORTED_ISO");
1039 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_WHITEBALANCE:
1040 muse_camera_msg_get(param1, recv_msg);
1042 LOGD("SUPPORTED_WHITEBALANCE - %d ", param1);
1044 if (((camera_attr_supported_whitebalance_cb)cb_info->user_cb[event])((camera_attr_whitebalance_e)param1, cb_info->user_data[event]) == false) {
1045 cb_info->user_cb[event] = NULL;
1046 cb_info->user_data[event] = NULL;
1047 LOGD("stop foreach callback for SUPPORTED_WHITEBALANCE");
1050 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EFFECT:
1051 muse_camera_msg_get(param1, recv_msg);
1053 LOGD("SUPPORTED_EFFECT - %d ", param1);
1055 if (((camera_attr_supported_effect_cb)cb_info->user_cb[event])((camera_attr_effect_mode_e)param1, cb_info->user_data[event]) == false) {
1056 cb_info->user_cb[event] = NULL;
1057 cb_info->user_data[event] = NULL;
1058 LOGD("stop foreach callback for SUPPORTED_EFFECT");
1061 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_SCENE_MODE:
1062 muse_camera_msg_get(param1, recv_msg);
1064 LOGD("SUPPORTED_SCENE_MODE - %d ", param1);
1066 if (((camera_attr_supported_scene_mode_cb)cb_info->user_cb[event])((camera_attr_scene_mode_e)param1, cb_info->user_data[event]) == false) {
1067 cb_info->user_cb[event] = NULL;
1068 cb_info->user_data[event] = NULL;
1069 LOGD("stop foreach callback for SUPPORTED_SCENE_MODE");
1072 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FLASH_MODE:
1073 muse_camera_msg_get(param1, recv_msg);
1075 LOGD("SUPPORTED_FLASH_MODE - %d ", param1);
1077 if (((camera_attr_supported_flash_mode_cb)cb_info->user_cb[event])((camera_attr_flash_mode_e)param1, cb_info->user_data[event]) == false) {
1078 cb_info->user_cb[event] = NULL;
1079 cb_info->user_data[event] = NULL;
1080 LOGD("stop foreach callback for SUPPORTED_FLASH_MODE");
1083 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS:
1084 muse_camera_msg_get(param1, recv_msg);
1086 LOGD("SUPPORTED_FPS - %d ", param1);
1088 if (((camera_attr_supported_fps_cb)cb_info->user_cb[event])((camera_attr_fps_e)param1, cb_info->user_data[event]) == false) {
1089 cb_info->user_cb[event] = NULL;
1090 cb_info->user_data[event] = NULL;
1091 LOGD("stop foreach callback for SUPPORTED_FPS");
1094 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS_BY_RESOLUTION:
1095 muse_camera_msg_get(param1, recv_msg);
1097 LOGD("SUPPORTED_FPS_BY_RESOLUTION - %d ", param1);
1099 if (((camera_attr_supported_fps_cb)cb_info->user_cb[event])((camera_attr_fps_e)param1, cb_info->user_data[event]) == false) {
1100 cb_info->user_cb[event] = NULL;
1101 cb_info->user_data[event] = NULL;
1102 LOGD("stop foreach callback for SUPPORTED_FPS_BY_RESOLUTION");
1105 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_FLIP:
1106 muse_camera_msg_get(param1, recv_msg);
1108 LOGD("SUPPORTED_STREAM_FLIP - %d ", param1);
1110 if (((camera_attr_supported_stream_flip_cb)cb_info->user_cb[event])((camera_flip_e)param1, cb_info->user_data[event]) == false) {
1111 cb_info->user_cb[event] = NULL;
1112 cb_info->user_data[event] = NULL;
1113 LOGD("stop foreach callback for SUPPORTED_STREAM_FLIP");
1116 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION:
1117 muse_camera_msg_get(param1, recv_msg);
1119 LOGD("SUPPORTED_STREAM_ROTATION - %d ", param1);
1121 if (((camera_attr_supported_stream_rotation_cb)cb_info->user_cb[event])((camera_rotation_e)param1, cb_info->user_data[event]) == false) {
1122 cb_info->user_cb[event] = NULL;
1123 cb_info->user_data[event] = NULL;
1124 LOGD("stop foreach callback for SUPPORTED_STREAM_ROTATION");
1127 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE:
1128 muse_camera_msg_get(param1, recv_msg);
1130 LOGD("SUPPORTED_THEATER_MODE - %d ", param1);
1132 if (((camera_attr_supported_theater_mode_cb)cb_info->user_cb[event])((camera_attr_theater_mode_e)param1, cb_info->user_data[event]) == false) {
1133 cb_info->user_cb[event] = NULL;
1134 cb_info->user_data[event] = NULL;
1135 LOGD("stop foreach callback for SUPPORTED_THEATER_MODE");
1138 case MUSE_CAMERA_EVENT_TYPE_CAPTURE:
1140 camera_image_data_s *rImage = NULL;
1141 camera_image_data_s *rPostview = NULL;
1142 camera_image_data_s *rThumbnail = NULL;
1143 unsigned char *buf_pos = NULL;
1144 int is_postview = 0;
1145 int is_thumbnail = 0;
1147 muse_camera_msg_get(tbm_key, recv_msg);
1148 muse_camera_msg_get(is_postview, recv_msg);
1149 muse_camera_msg_get(is_thumbnail, recv_msg);
1151 LOGD("camera capture callback came in. key %d, postview %d, thumbnail %d",
1152 tbm_key, is_postview, is_thumbnail);
1155 LOGE("invalid key %d", tbm_key);
1159 /* import tbm bo and get virtual address */
1160 if (!_import_tbm_key(cb_info->bufmgr, tbm_key, &bo, &bo_handle))
1163 buf_pos = (unsigned char *)bo_handle.ptr;
1164 rImage = (camera_image_data_s *)buf_pos;
1165 rImage->data = buf_pos + sizeof(camera_image_data_s);
1166 buf_pos += sizeof(camera_image_data_s) + rImage->size;
1169 rPostview = (camera_image_data_s *)buf_pos;
1170 LOGD("rPostview->size : %d", rPostview->size);
1171 rPostview->data = buf_pos + sizeof(camera_image_data_s);
1172 buf_pos += sizeof(camera_image_data_s) + rPostview->size;
1176 rThumbnail = (camera_image_data_s *)buf_pos;
1177 LOGD("rThumbnail->size : %d", rThumbnail->size);
1178 rThumbnail->data = buf_pos + sizeof(camera_image_data_s);
1179 buf_pos += sizeof(camera_image_data_s) + rThumbnail->size;
1182 LOGD("image info %dx%d, size : %d", rImage->height, rImage->width, rImage->size);
1184 ((camera_capturing_cb)cb_info->user_cb[event])(rImage, rPostview, rThumbnail, cb_info->user_data[event]);
1186 /* unmap and unref tbm bo */
1187 _release_imported_bo(&bo);
1190 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
1191 cb_info->fd, cb_info, INT, tbm_key);
1193 LOGD("return buffer done");
1196 case MUSE_CAMERA_EVENT_TYPE_VIDEO_FRAME_RENDER_ERROR:
1199 LOGW("Unknown event : %d", event);
1206 static bool _camera_idle_event_callback(void *data)
1208 camera_cb_info_s *cb_info = NULL;
1209 camera_idle_event_s *cam_idle_event = (camera_idle_event_s *)data;
1211 if (cam_idle_event == NULL) {
1212 LOGE("cam_idle_event is NULL");
1217 g_mutex_lock(&cam_idle_event->event_mutex);
1219 cb_info = cam_idle_event->cb_info;
1220 if (cb_info == NULL) {
1221 LOGW("camera cb_info is NULL. event %d", cam_idle_event->event);
1222 goto IDLE_EVENT_CALLBACK_DONE;
1225 /* remove event from list */
1226 g_mutex_lock(&cb_info->idle_event_mutex);
1227 if (cb_info->idle_event_list)
1228 cb_info->idle_event_list = g_list_remove(cb_info->idle_event_list, (gpointer)cam_idle_event);
1230 /*LOGD("remove camera idle event %p, %p", cam_idle_event, cb_info->idle_event_list);*/
1231 g_mutex_unlock(&cb_info->idle_event_mutex);
1234 _client_user_callback(cam_idle_event->cb_info, cam_idle_event->recv_msg, cam_idle_event->event);
1236 /* send signal for waiting thread */
1237 g_cond_signal(&cb_info->idle_event_cond);
1239 IDLE_EVENT_CALLBACK_DONE:
1240 /* unlock and release event */
1241 g_mutex_unlock(&cam_idle_event->event_mutex);
1242 g_mutex_clear(&cam_idle_event->event_mutex);
1244 g_free(cam_idle_event);
1245 cam_idle_event = NULL;
1250 static void *_camera_msg_handler_func(gpointer data)
1255 int event_class = 0;
1256 camera_message_s *cam_msg = NULL;
1257 camera_idle_event_s *cam_idle_event = NULL;
1258 camera_cb_info_s *cb_info = (camera_cb_info_s *)data;
1260 if (cb_info == NULL) {
1261 LOGE("cb_info NULL");
1267 g_mutex_lock(&cb_info->msg_handler_mutex);
1269 while (g_atomic_int_get(&cb_info->msg_handler_running)) {
1270 if (g_queue_is_empty(cb_info->msg_queue)) {
1271 LOGD("signal wait...");
1272 g_cond_wait(&cb_info->msg_handler_cond, &cb_info->msg_handler_mutex);
1273 LOGD("signal received");
1275 if (g_atomic_int_get(&cb_info->msg_handler_running) == 0) {
1276 LOGD("stop event thread");
1281 cam_msg = (camera_message_s *)g_queue_pop_head(cb_info->msg_queue);
1283 g_mutex_unlock(&cb_info->msg_handler_mutex);
1285 if (cam_msg == NULL) {
1286 LOGE("NULL message");
1287 g_mutex_lock(&cb_info->msg_handler_mutex);
1293 if (api < MUSE_CAMERA_API_MAX) {
1294 g_mutex_lock(&cb_info->api_mutex[api]);
1296 if (muse_camera_msg_get(ret, cam_msg->recv_msg)) {
1297 cb_info->api_ret[api] = ret;
1298 cb_info->api_activating[api] = 1;
1300 LOGD("camera api %d - return 0x%x", ret);
1302 g_cond_signal(&cb_info->api_cond[api]);
1304 LOGE("failed to get camera ret for api %d, msg %s", api, cam_msg->recv_msg);
1307 g_mutex_unlock(&cb_info->api_mutex[api]);
1308 } else if (api == MUSE_CAMERA_CB_EVENT) {
1312 if (!muse_camera_msg_get(event, cam_msg->recv_msg) ||
1313 !muse_camera_msg_get(event_class, cam_msg->recv_msg)) {
1314 LOGE("failed to get camera event %d, class %d", event, event_class);
1319 g_mutex_lock(&cb_info->msg_handler_mutex);
1323 switch (event_class) {
1324 case MUSE_CAMERA_EVENT_CLASS_THREAD_SUB:
1325 _client_user_callback(cb_info, cam_msg->recv_msg, event);
1327 case MUSE_CAMERA_EVENT_CLASS_THREAD_MAIN:
1328 cam_idle_event = g_new0(camera_idle_event_s, 1);
1329 if (cam_idle_event == NULL) {
1330 LOGE("cam_idle_event alloc failed");
1334 cam_idle_event->event = event;
1335 cam_idle_event->cb_info = cb_info;
1336 g_mutex_init(&cam_idle_event->event_mutex);
1337 memcpy(cam_idle_event->recv_msg, cam_msg->recv_msg, sizeof(cam_idle_event->recv_msg));
1339 LOGD("add camera event[%d, %p] to IDLE", event, cam_idle_event);
1341 g_mutex_lock(&cb_info->idle_event_mutex);
1342 cb_info->idle_event_list = g_list_append(cb_info->idle_event_list, (gpointer)cam_idle_event);
1343 g_mutex_unlock(&cb_info->idle_event_mutex);
1345 g_idle_add_full(G_PRIORITY_DEFAULT,
1346 (GSourceFunc)_camera_idle_event_callback,
1347 (gpointer)cam_idle_event,
1351 LOGE("unknown camera event class %d", event_class);
1355 LOGE("unknown camera api[%d] message[%s]", api, cam_msg->recv_msg);
1361 g_mutex_lock(&cb_info->msg_handler_mutex);
1364 /* remove remained event */
1365 while (!g_queue_is_empty(cb_info->msg_queue)) {
1366 cam_msg = (camera_message_s *)g_queue_pop_head(cb_info->msg_queue);
1368 LOGD("remove camera message %p", cam_msg);
1372 LOGW("NULL camera message");
1376 g_mutex_unlock(&cb_info->msg_handler_mutex);
1383 static void _camera_remove_idle_event_all(camera_cb_info_s *cb_info)
1385 camera_idle_event_s *cam_idle_event = NULL;
1386 gboolean ret = TRUE;
1388 gint64 end_time = 0;
1390 if (cb_info == NULL) {
1391 LOGE("cb_info is NULL");
1395 g_mutex_lock(&cb_info->idle_event_mutex);
1397 if (cb_info->idle_event_list == NULL) {
1398 LOGD("No idle event is remained.");
1400 list = cb_info->idle_event_list;
1403 cam_idle_event = list->data;
1404 list = g_list_next(list);
1406 if (!cam_idle_event) {
1407 LOGW("Fail to remove idle event. The event is NULL");
1409 if (g_mutex_trylock(&cam_idle_event->event_mutex)) {
1410 ret = g_idle_remove_by_data(cam_idle_event);
1412 LOGD("remove idle event [%p], ret[%d]", cam_idle_event, ret);
1415 cam_idle_event->cb_info = NULL;
1416 LOGW("idle callback for event %p will be called later", cam_idle_event);
1419 cb_info->idle_event_list = g_list_remove(cb_info->idle_event_list, (gpointer)cam_idle_event);
1421 g_mutex_unlock(&cam_idle_event->event_mutex);
1424 g_mutex_clear(&cam_idle_event->event_mutex);
1426 g_free(cam_idle_event);
1427 cam_idle_event = NULL;
1429 LOGD("remove idle event done");
1432 LOGW("event lock failed. it's being called...");
1434 end_time = g_get_monotonic_time() + G_TIME_SPAN_MILLISECOND * 100;
1436 if (g_cond_wait_until(&cb_info->idle_event_cond, &cb_info->idle_event_mutex, end_time))
1437 LOGW("signal received");
1444 g_list_free(cb_info->idle_event_list);
1445 cb_info->idle_event_list = NULL;
1448 g_mutex_unlock(&cb_info->idle_event_mutex);
1453 static void *_camera_msg_recv_func(gpointer data)
1462 char *recv_msg = NULL;
1463 char **parse_str = NULL;
1464 camera_cb_info_s *cb_info = (camera_cb_info_s *)data;
1466 if (cb_info == NULL) {
1467 LOGE("cb_info NULL");
1473 parse_str = (char **)malloc(sizeof(char *) * CAMERA_PARSE_STRING_SIZE);
1474 if (parse_str == NULL) {
1475 LOGE("parse_str malloc failed");
1479 for (i = 0 ; i < CAMERA_PARSE_STRING_SIZE ; i++) {
1480 parse_str[i] = (char *)malloc(sizeof(char) * MUSE_CAMERA_MSG_MAX_LENGTH);
1481 if (parse_str[i] == NULL) {
1482 LOGE("parse_str[%d] malloc failed", i);
1483 goto CB_HANDLER_EXIT;
1487 recv_msg = cb_info->recv_msg;
1489 while (g_atomic_int_get(&cb_info->msg_recv_running)) {
1490 ret = muse_core_ipc_recv_msg(cb_info->fd, recv_msg);
1493 recv_msg[ret] = '\0';
1499 /*LOGD("recvMSg : %s, length : %d", recv_msg, ret);*/
1501 /* Need to split the combined entering msgs.
1502 This module supports up to 200 combined msgs. */
1503 for (str_pos = 0; str_pos < ret; str_pos++) {
1504 if (recv_msg[str_pos] == '}') {
1505 memset(parse_str[num_token], 0x0, sizeof(char) * MUSE_CAMERA_MSG_MAX_LENGTH);
1506 strncpy(parse_str[num_token], recv_msg + prev_pos, str_pos - prev_pos + 1);
1507 LOGD("splitted msg : [%s], Index : %d", parse_str[num_token], num_token);
1508 prev_pos = str_pos+1;
1513 /*LOGD("num_token : %d", num_token);*/
1515 /* Re-construct to the useful single msg. */
1516 for (i = 0; i < num_token; i++) {
1517 if (i >= CAMERA_PARSE_STRING_SIZE) {
1518 LOGE("invalid token index %d", i);
1525 if (!muse_camera_msg_get(api, parse_str[i])) {
1526 LOGE("failed to get camera api");
1530 if (api != MUSE_CAMERA_CB_EVENT) {
1531 LOGD("check api_class");
1532 if (muse_camera_msg_get(api_class, parse_str[i]))
1533 LOGD("camera api_class[%d]", api_class);
1536 if (api_class == MUSE_CAMERA_API_CLASS_IMMEDIATE) {
1537 g_mutex_lock(&cb_info->api_mutex[api]);
1539 if (!muse_camera_msg_get(ret, parse_str[i])) {
1540 LOGE("failed to get camera ret");
1541 g_mutex_unlock(&cb_info->api_mutex[api]);
1545 cb_info->api_ret[api] = ret;
1546 cb_info->api_activating[api] = 1;
1548 if (api == MUSE_CAMERA_API_CREATE) {
1549 if (ret != CAMERA_ERROR_NONE) {
1550 g_atomic_int_set(&cb_info->msg_recv_running, 0);
1551 LOGE("camera create error 0x%x. close client cb handler", ret);
1553 } else if (api == MUSE_CAMERA_API_DESTROY) {
1554 if (ret == CAMERA_ERROR_NONE) {
1555 g_atomic_int_set(&cb_info->msg_recv_running, 0);
1556 LOGD("camera destroy done. close client cb handler");
1560 g_cond_signal(&cb_info->api_cond[api]);
1561 g_mutex_unlock(&cb_info->api_mutex[api]);
1562 } else if (api_class == MUSE_CAMERA_API_CLASS_THREAD_SUB || api == MUSE_CAMERA_CB_EVENT) {
1563 camera_message_s *cam_msg = g_new0(camera_message_s, 1);
1564 if (cam_msg == NULL) {
1565 LOGE("failed to alloc cam_msg");
1570 memcpy(cam_msg->recv_msg, parse_str[i], sizeof(cam_msg->recv_msg));
1572 LOGD("add camera message to queue : api %d", api);
1574 g_mutex_lock(&cb_info->msg_handler_mutex);
1575 g_queue_push_tail(cb_info->msg_queue, (gpointer)cam_msg);
1576 g_cond_signal(&cb_info->msg_handler_cond);
1577 g_mutex_unlock(&cb_info->msg_handler_mutex);
1579 LOGW("unknown camera api %d and api_class %d", api, api_class);
1585 LOGD("client cb exit");
1589 for (i = 0 ; i < CAMERA_PARSE_STRING_SIZE ; i++) {
1592 parse_str[i] = NULL;
1603 static camera_cb_info_s *_client_callback_new(gint sockfd)
1605 camera_cb_info_s *cb_info = NULL;
1606 gint *tmp_activating = NULL;
1607 gint *tmp_ret = NULL;
1610 g_return_val_if_fail(sockfd > 0, NULL);
1612 cb_info = g_new0(camera_cb_info_s, 1);
1613 if (cb_info == NULL) {
1614 LOGE("cb_info failed");
1618 g_mutex_init(&cb_info->msg_handler_mutex);
1619 g_cond_init(&cb_info->msg_handler_cond);
1620 g_mutex_init(&cb_info->idle_event_mutex);
1621 g_cond_init(&cb_info->idle_event_cond);
1623 for (i = 0 ; i < MUSE_CAMERA_API_MAX ; i++) {
1624 g_mutex_init(&cb_info->api_mutex[i]);
1625 g_cond_init(&cb_info->api_cond[i]);
1628 tmp_activating = g_new0(gint, MUSE_CAMERA_API_MAX);
1629 if (tmp_activating == NULL) {
1630 LOGE("tmp_activating failed");
1634 tmp_ret = g_new0(gint, MUSE_CAMERA_API_MAX);
1635 if (tmp_ret == NULL) {
1636 LOGE("tmp_ret failed");
1640 cb_info->msg_queue = g_queue_new();
1641 if (cb_info->msg_queue == NULL) {
1642 LOGE("msg_queue new failed");
1646 g_atomic_int_set(&cb_info->msg_handler_running, 1);
1647 cb_info->msg_handler_thread = g_thread_try_new("camera_msg_handler",
1648 _camera_msg_handler_func, (gpointer)cb_info, NULL);
1649 if (cb_info->msg_handler_thread == NULL) {
1650 LOGE("message handler thread creation failed");
1654 cb_info->fd = sockfd;
1655 cb_info->api_activating = tmp_activating;
1656 cb_info->api_ret = tmp_ret;
1658 g_atomic_int_set(&cb_info->msg_recv_running, 1);
1659 cb_info->msg_recv_thread = g_thread_try_new("camera_msg_recv",
1660 _camera_msg_recv_func, (gpointer)cb_info, NULL);
1661 if (cb_info->msg_recv_thread == NULL) {
1662 LOGE("message receive thread creation failed");
1670 if (cb_info->msg_handler_thread) {
1671 g_mutex_lock(&cb_info->msg_handler_mutex);
1672 g_atomic_int_set(&cb_info->msg_handler_running, 0);
1673 g_cond_signal(&cb_info->msg_handler_cond);
1674 g_mutex_unlock(&cb_info->msg_handler_mutex);
1676 g_thread_join(cb_info->msg_handler_thread);
1677 g_thread_unref(cb_info->msg_handler_thread);
1678 cb_info->msg_handler_thread = NULL;
1681 for (i = 0 ; i < MUSE_CAMERA_API_MAX ; i++) {
1682 g_mutex_clear(&cb_info->api_mutex[i]);
1683 g_cond_clear(&cb_info->api_cond[i]);
1686 g_mutex_clear(&cb_info->msg_handler_mutex);
1687 g_cond_clear(&cb_info->msg_handler_cond);
1688 g_mutex_clear(&cb_info->idle_event_mutex);
1689 g_cond_clear(&cb_info->idle_event_cond);
1691 if (cb_info->msg_queue) {
1692 g_queue_free(cb_info->msg_queue);
1693 cb_info->msg_queue = NULL;
1700 if (tmp_activating) {
1701 g_free(tmp_activating);
1702 tmp_activating = NULL;
1712 static void _client_callback_destroy(camera_cb_info_s *cb_info)
1716 g_return_if_fail(cb_info != NULL);
1718 LOGD("MSG receive thread[%p] destroy", cb_info->msg_recv_thread);
1720 g_thread_join(cb_info->msg_recv_thread);
1721 g_thread_unref(cb_info->msg_recv_thread);
1722 cb_info->msg_recv_thread = NULL;
1724 LOGD("msg thread removed");
1726 g_mutex_lock(&cb_info->msg_handler_mutex);
1727 g_atomic_int_set(&cb_info->msg_handler_running, 0);
1728 g_cond_signal(&cb_info->msg_handler_cond);
1729 g_mutex_unlock(&cb_info->msg_handler_mutex);
1731 g_thread_join(cb_info->msg_handler_thread);
1732 g_thread_unref(cb_info->msg_handler_thread);
1733 cb_info->msg_handler_thread = NULL;
1735 g_queue_free(cb_info->msg_queue);
1736 cb_info->msg_queue = NULL;
1738 for (i = 0 ; i < MUSE_CAMERA_API_MAX ; i++) {
1739 g_mutex_clear(&cb_info->api_mutex[i]);
1740 g_cond_clear(&cb_info->api_cond[i]);
1743 g_mutex_clear(&cb_info->msg_handler_mutex);
1744 g_cond_clear(&cb_info->msg_handler_cond);
1745 g_mutex_clear(&cb_info->idle_event_mutex);
1746 g_cond_clear(&cb_info->idle_event_cond);
1748 LOGD("event thread removed");
1750 if (cb_info->fd > -1) {
1751 muse_core_connection_close(cb_info->fd);
1755 if (cb_info->bufmgr) {
1756 tbm_bufmgr_deinit(cb_info->bufmgr);
1757 cb_info->bufmgr = NULL;
1759 if (cb_info->api_activating) {
1760 g_free(cb_info->api_activating);
1761 cb_info->api_activating = NULL;
1763 if (cb_info->api_ret) {
1764 g_free(cb_info->api_ret);
1765 cb_info->api_ret = NULL;
1767 if (cb_info->pkt_fmt) {
1768 media_format_unref(cb_info->pkt_fmt);
1769 cb_info->pkt_fmt = NULL;
1778 int camera_create(camera_device_e device, camera_h *camera)
1782 int ret = CAMERA_ERROR_NONE;
1784 camera_cli_s *pc = NULL;
1785 tbm_bufmgr bufmgr = NULL;
1787 muse_camera_api_e api = MUSE_CAMERA_API_CREATE;
1788 muse_core_api_module_e muse_module = MUSE_CAMERA;
1789 int device_type = (int)device;
1791 if (camera == NULL) {
1792 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
1793 return CAMERA_ERROR_INVALID_PARAMETER;
1796 bufmgr = tbm_bufmgr_init(-1);
1797 if (bufmgr == NULL) {
1798 LOGE("get tbm bufmgr failed");
1799 return CAMERA_ERROR_INVALID_OPERATION;
1802 sock_fd = muse_core_client_new();
1804 LOGE("muse_core_client_new failed - returned fd %d", sock_fd);
1805 ret = CAMERA_ERROR_INVALID_OPERATION;
1811 sndMsg = muse_core_msg_json_factory_new(api,
1812 MUSE_TYPE_INT, "module", muse_module,
1813 MUSE_TYPE_INT, PARAM_DEVICE_TYPE, device_type,
1814 MUSE_TYPE_INT, "pid", pid,
1817 muse_core_ipc_send_msg(sock_fd, sndMsg);
1818 muse_core_msg_json_factory_free(sndMsg);
1820 pc = g_new0(camera_cli_s, 1);
1822 LOGE("camera_cli_s alloc failed");
1823 ret = CAMERA_ERROR_OUT_OF_MEMORY;
1827 pc->cb_info = _client_callback_new(sock_fd);
1828 if (pc->cb_info == NULL) {
1829 LOGE("cb_info alloc failed");
1830 ret = CAMERA_ERROR_OUT_OF_MEMORY;
1834 LOGD("cb info : %d", pc->cb_info->fd);
1836 ret = _client_wait_for_cb_return(api, pc->cb_info, CALLBACK_TIME_OUT);
1837 if (ret == CAMERA_ERROR_NONE) {
1838 intptr_t handle = 0;
1839 muse_camera_msg_get_pointer(handle, pc->cb_info->recv_msg);
1841 LOGE("Receiving Handle Failed!!");
1842 ret = CAMERA_ERROR_INVALID_OPERATION;
1846 pc->remote_handle = handle;
1847 pc->cb_info->bufmgr = bufmgr;
1849 ret = camera_set_display((camera_h)pc, CAMERA_DISPLAY_TYPE_NONE, NULL);
1850 if (ret != CAMERA_ERROR_NONE) {
1851 LOGE("init display failed 0x%x", ret);
1855 LOGD("camera create 0x%x", pc->remote_handle);
1856 *camera = (camera_h)pc;
1864 tbm_bufmgr_deinit(bufmgr);
1868 _client_callback_destroy(pc->cb_info);
1874 LOGE("camera create error : 0x%x", ret);
1879 int camera_destroy(camera_h camera)
1881 if (camera == NULL) {
1882 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
1883 return CAMERA_ERROR_INVALID_PARAMETER;
1886 int ret = CAMERA_ERROR_NONE;
1887 muse_camera_api_e api = MUSE_CAMERA_API_DESTROY;
1888 camera_cli_s *pc = (camera_cli_s *)camera;
1893 if (pc->cb_info == NULL) {
1894 LOGE("cb_info NULL, INVALID_PARAMETER");
1895 return CAMERA_ERROR_INVALID_PARAMETER;
1898 sock_fd = pc->cb_info->fd;
1900 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
1901 if (ret == CAMERA_ERROR_NONE) {
1902 _camera_remove_idle_event_all(pc->cb_info);
1903 _client_callback_destroy(pc->cb_info);
1909 LOGE("camera destroy error : 0x%x", ret);
1915 int camera_start_preview(camera_h camera)
1917 int ret = CAMERA_ERROR_NONE;
1918 muse_camera_api_e api = MUSE_CAMERA_API_START_PREVIEW;
1919 camera_cli_s *pc = (camera_cli_s *)camera;
1922 if (camera == NULL) {
1923 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
1924 return CAMERA_ERROR_INVALID_PARAMETER;
1927 if (pc->cb_info == NULL) {
1928 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
1929 return CAMERA_ERROR_INVALID_PARAMETER;
1934 sock_fd = pc->cb_info->fd;
1936 muse_camera_msg_send_longtime(api, sock_fd, pc->cb_info, ret);
1938 if (ret != CAMERA_ERROR_NONE) {
1939 LOGE("start preview failed 0x%x", ret);
1943 LOGD("ret : 0x%x", ret);
1945 return CAMERA_ERROR_NONE;
1948 int camera_stop_preview(camera_h camera)
1950 int ret = CAMERA_ERROR_NONE;
1952 camera_cli_s *pc = NULL;
1953 muse_camera_api_e api = MUSE_CAMERA_API_STOP_PREVIEW;
1955 if (camera == NULL) {
1956 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
1957 return CAMERA_ERROR_INVALID_PARAMETER;
1960 pc = (camera_cli_s *)camera;
1962 if (pc->cb_info == NULL) {
1963 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
1964 return CAMERA_ERROR_INVALID_PARAMETER;
1967 sock_fd = pc->cb_info->fd;
1971 /* send stop preview message */
1972 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
1974 LOGD("ret : 0x%x", ret);
1979 int camera_start_capture(camera_h camera, camera_capturing_cb capturing_cb, camera_capture_completed_cb completed_cb, void *user_data)
1981 if (camera == NULL) {
1982 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
1983 return CAMERA_ERROR_INVALID_PARAMETER;
1985 int ret = CAMERA_ERROR_NONE;
1987 camera_cli_s *pc = (camera_cli_s *)camera;
1988 muse_camera_api_e api = MUSE_CAMERA_API_START_CAPTURE;
1990 int is_capturing_cb = 0;
1991 int is_completed_cb = 0;
1992 LOGD("Enter, handle :%x", pc->remote_handle);
1994 if (pc->cb_info == NULL) {
1995 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
1996 return CAMERA_ERROR_INVALID_PARAMETER;
1999 sock_fd = pc->cb_info->fd;
2001 if (capturing_cb != NULL) {
2002 is_capturing_cb = 1;
2003 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = capturing_cb;
2004 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = user_data;
2007 if (completed_cb != NULL) {
2008 is_completed_cb = 1;
2009 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = completed_cb;
2010 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = user_data;
2013 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, is_capturing_cb, INT, is_completed_cb);
2014 LOGD("is_capturing_cb :%d, is_completed_cb : %d", is_capturing_cb, is_completed_cb);
2015 LOGD("ret : 0x%x", ret);
2019 bool camera_is_supported_continuous_capture(camera_h camera)
2021 if (camera == NULL) {
2022 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2026 int ret = CAMERA_ERROR_NONE;
2027 camera_cli_s *pc = (camera_cli_s *)camera;
2028 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_CONTINUOUS_CAPTURE;
2031 if (pc->cb_info == NULL) {
2032 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2033 return CAMERA_ERROR_INVALID_PARAMETER;
2036 sock_fd = pc->cb_info->fd;
2038 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2039 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2040 LOGD("ret : 0x%x", ret);
2044 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)
2046 if (camera == NULL) {
2047 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2048 return CAMERA_ERROR_INVALID_PARAMETER;
2051 int ret = CAMERA_ERROR_NONE;
2053 camera_cli_s *pc = (camera_cli_s *)camera;
2054 muse_camera_api_e api = MUSE_CAMERA_API_START_CONTINUOUS_CAPTURE;
2056 LOGD("Enter, handle :%x", pc->remote_handle);
2059 if (pc->cb_info == NULL) {
2060 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2061 return CAMERA_ERROR_INVALID_PARAMETER;
2063 sock_fd = pc->cb_info->fd;
2065 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = capturing_cb;
2066 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = user_data;
2067 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = completed_cb;
2069 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, count, INT, interval);
2071 LOGD("ret : 0x%x", ret);
2076 int camera_stop_continuous_capture(camera_h camera)
2078 if (camera == NULL) {
2079 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2080 return CAMERA_ERROR_INVALID_PARAMETER;
2084 int ret = CAMERA_ERROR_NONE;
2086 camera_cli_s *pc = (camera_cli_s *)camera;
2087 muse_camera_api_e api = MUSE_CAMERA_API_STOP_CONTINUOUS_CAPTURE;
2088 LOGD("Enter, handle :%x", pc->remote_handle);
2090 if (pc->cb_info == NULL) {
2091 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2092 return CAMERA_ERROR_INVALID_PARAMETER;
2094 sock_fd = pc->cb_info->fd;
2095 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2096 LOGD("ret : 0x%x", ret);
2100 bool camera_is_supported_face_detection(camera_h camera)
2102 if (camera == NULL) {
2103 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2106 int ret = CAMERA_ERROR_NONE;
2108 camera_cli_s *pc = (camera_cli_s *)camera;
2109 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_FACE_DETECTION;
2111 if (pc->cb_info == NULL) {
2112 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2113 return CAMERA_ERROR_INVALID_PARAMETER;
2115 sock_fd = pc->cb_info->fd;
2117 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2118 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2119 LOGD("ret : 0x%x", ret);
2123 bool camera_is_supported_zero_shutter_lag(camera_h camera)
2125 if (camera == NULL) {
2126 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2129 int ret = CAMERA_ERROR_NONE;
2131 camera_cli_s *pc = (camera_cli_s *)camera;
2132 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_ZERO_SHUTTER_LAG;
2134 if (pc->cb_info == NULL) {
2135 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2136 return CAMERA_ERROR_INVALID_PARAMETER;
2138 sock_fd = pc->cb_info->fd;
2140 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2141 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2142 LOGD("ret : 0x%x", ret);
2146 bool camera_is_supported_media_packet_preview_cb(camera_h camera)
2148 if (camera == NULL) {
2149 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2153 int ret = CAMERA_ERROR_NONE;
2155 camera_cli_s *pc = (camera_cli_s *)camera;
2156 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_MEDIA_PACKET_PREVIEW_CB;
2158 if (pc->cb_info == NULL) {
2159 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2160 return CAMERA_ERROR_INVALID_PARAMETER;
2162 sock_fd = pc->cb_info->fd;
2164 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2165 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2166 LOGD("ret : 0x%x", ret);
2170 int camera_get_device_count(camera_h camera, int *device_count)
2172 if (camera == NULL || device_count == NULL) {
2173 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2174 return CAMERA_ERROR_INVALID_PARAMETER;
2176 int ret = CAMERA_ERROR_NONE;
2178 camera_cli_s *pc = (camera_cli_s *)camera;
2179 muse_camera_api_e api = MUSE_CAMERA_API_GET_DEVICE_COUNT;
2181 if (pc->cb_info == NULL) {
2182 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2183 return CAMERA_ERROR_INVALID_PARAMETER;
2185 sock_fd = pc->cb_info->fd;
2186 int get_device_count;
2188 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2189 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2191 if (ret == CAMERA_ERROR_NONE) {
2192 muse_camera_msg_get(get_device_count, pc->cb_info->recv_msg);
2193 *device_count = get_device_count;
2195 LOGD("ret : 0x%x", ret);
2199 int camera_start_face_detection(camera_h camera, camera_face_detected_cb callback, void *user_data)
2201 if (camera == NULL) {
2202 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2203 return CAMERA_ERROR_INVALID_PARAMETER;
2206 int ret = CAMERA_ERROR_NONE;
2208 camera_cli_s *pc = (camera_cli_s *)camera;
2209 muse_camera_api_e api = MUSE_CAMERA_API_START_FACE_DETECTION;
2211 LOGD("Enter, handle :%x", pc->remote_handle);
2213 if (pc->cb_info == NULL) {
2214 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2215 return CAMERA_ERROR_INVALID_PARAMETER;
2217 sock_fd = pc->cb_info->fd;
2218 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION] = callback;
2219 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION] = user_data;
2221 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2222 LOGD("ret : 0x%x", ret);
2226 int camera_stop_face_detection(camera_h camera)
2228 if (camera == NULL) {
2229 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2230 return CAMERA_ERROR_INVALID_PARAMETER;
2233 int ret = CAMERA_ERROR_NONE;
2235 camera_cli_s *pc = (camera_cli_s *)camera;
2236 muse_camera_api_e api = MUSE_CAMERA_API_STOP_FACE_DETECTION;
2237 LOGD("Enter, handle :%x", pc->remote_handle);
2239 if (pc->cb_info == NULL) {
2240 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2241 return CAMERA_ERROR_INVALID_PARAMETER;
2243 sock_fd = pc->cb_info->fd;
2244 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2245 LOGD("ret : 0x%x", ret);
2249 int camera_get_state(camera_h camera, camera_state_e * state)
2251 if (camera == NULL || state == NULL) {
2252 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2253 return CAMERA_ERROR_INVALID_PARAMETER;
2255 int ret = CAMERA_ERROR_NONE;
2257 camera_cli_s *pc = (camera_cli_s *)camera;
2258 muse_camera_api_e api = MUSE_CAMERA_API_GET_STATE;
2260 if (pc->cb_info == NULL) {
2261 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2262 return CAMERA_ERROR_INVALID_PARAMETER;
2264 sock_fd = pc->cb_info->fd;
2267 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2268 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2270 if (ret == CAMERA_ERROR_NONE) {
2271 muse_camera_msg_get(get_state, pc->cb_info->recv_msg);
2272 *state = (camera_state_e)get_state;
2274 LOGD("ret : 0x%x", ret);
2278 int camera_start_focusing(camera_h camera, bool continuous)
2280 if (camera == NULL) {
2281 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2282 return CAMERA_ERROR_INVALID_PARAMETER;
2285 int ret = CAMERA_ERROR_NONE;
2287 camera_cli_s *pc = (camera_cli_s *)camera;
2288 muse_camera_api_e api = MUSE_CAMERA_API_START_FOCUSING;
2290 if (pc->cb_info == NULL) {
2291 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2292 return CAMERA_ERROR_INVALID_PARAMETER;
2294 sock_fd = pc->cb_info->fd;
2295 int is_continuous = (int)continuous;
2297 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2298 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, is_continuous);
2299 LOGD("ret : 0x%x", ret);
2303 int camera_cancel_focusing(camera_h camera)
2305 if (camera == NULL) {
2306 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2307 return CAMERA_ERROR_INVALID_PARAMETER;
2310 int ret = CAMERA_ERROR_NONE;
2312 camera_cli_s *pc = (camera_cli_s *)camera;
2313 muse_camera_api_e api = MUSE_CAMERA_API_CANCEL_FOCUSING;
2315 if (pc->cb_info == NULL) {
2316 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2317 return CAMERA_ERROR_INVALID_PARAMETER;
2319 sock_fd = pc->cb_info->fd;
2321 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2322 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2323 LOGD("ret : 0x%x", ret);
2327 int camera_set_display(camera_h camera, camera_display_type_e type, camera_display_h display)
2329 int ret = CAMERA_ERROR_NONE;
2330 void *set_display_handle = NULL;
2331 Evas_Object *obj = NULL;
2332 const char *object_type = NULL;
2334 camera_wl_info_s *wl_info = NULL;
2335 #endif /* HAVE_WAYLAND */
2337 if (camera == NULL) {
2338 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2339 return CAMERA_ERROR_INVALID_PARAMETER;
2342 if (type < CAMERA_DISPLAY_TYPE_OVERLAY || type > CAMERA_DISPLAY_TYPE_NONE) {
2343 LOGE("invalid type %d", type);
2344 return CAMERA_ERROR_INVALID_PARAMETER;
2347 if (type != CAMERA_DISPLAY_TYPE_NONE && display == NULL) {
2348 LOGE("display type[%d] is not NONE, but display handle is NULL", type);
2349 return CAMERA_ERROR_INVALID_PARAMETER;
2352 camera_cli_s *pc = (camera_cli_s *)camera;
2353 muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY;
2355 if (pc->cb_info == NULL) {
2356 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2357 return CAMERA_ERROR_INVALID_PARAMETER;
2359 sock_fd = pc->cb_info->fd;
2361 LOGD("Enter, remote_handle : %x display : 0x%x", pc->remote_handle, display);
2363 if (type == CAMERA_DISPLAY_TYPE_NONE) {
2364 set_display_handle = 0;
2365 LOGD("display type NONE");
2367 obj = (Evas_Object *)display;
2368 object_type = evas_object_type_get(obj);
2370 if (type == CAMERA_DISPLAY_TYPE_OVERLAY && !strcmp(object_type, "elm_win")) {
2372 /* get wayland parent id */
2373 if (_get_wl_info(obj, &pc->wl_info) != CAMERA_ERROR_NONE) {
2374 LOGE("failed to get wayland info");
2375 return CAMERA_ERROR_INVALID_OPERATION;
2378 set_display_handle = (void *)&pc->wl_info;
2379 #else /* HAVE_WAYLAND */
2380 /* x window overlay surface */
2381 set_display_handle = (void *)elm_win_xwindow_get(obj);
2382 #endif /* HAVE_WAYLAND */
2383 LOGD("display type OVERLAY : handle %p", set_display_handle);
2384 } else if (type == CAMERA_DISPLAY_TYPE_EVAS && !strcmp(object_type, "image")) {
2385 /* evas object surface */
2386 set_display_handle = (void *)display;
2387 LOGD("display type EVAS : handle %p", set_display_handle);
2389 LOGE("unknown evas object [%p,%s] or type [%d] mismatch", obj, object_type, type);
2390 return CAMERA_ERROR_INVALID_PARAMETER;
2393 LOGE("failed to get evas object type from %p", obj);
2394 return CAMERA_ERROR_INVALID_PARAMETER;
2398 pc->display_handle = (intptr_t)set_display_handle;
2400 if (type == CAMERA_DISPLAY_TYPE_OVERLAY) {
2402 wl_info = &pc->wl_info;
2403 muse_camera_msg_send_array_and_value(api, sock_fd, pc->cb_info, ret,
2404 wl_info, 5, sizeof(int), INT, type);
2406 LOGD("wayland parent id : %d, window %d,%d,%dx%d",
2407 wl_info->parent_id, wl_info->window_x, wl_info->window_y,
2408 wl_info->window_width, wl_info->window_height);
2409 #else /* HAVE_WAYLAND */
2410 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, type, INT, set_display_handle);
2412 LOGD("x id : %d", (int)set_display_handle);
2413 #endif /* HAVE_WAYLAND */
2415 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, type);
2417 if (ret != CAMERA_ERROR_NONE)
2418 LOGE("set display error 0x%x", ret);
2423 int camera_set_preview_resolution(camera_h camera, int width, int height)
2425 if (camera == NULL) {
2426 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2427 return CAMERA_ERROR_INVALID_PARAMETER;
2429 int ret = CAMERA_ERROR_NONE;
2431 camera_cli_s *pc = (camera_cli_s *)camera;
2432 muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_RESOLUTION;
2434 if (pc->cb_info == NULL) {
2435 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2436 return CAMERA_ERROR_INVALID_PARAMETER;
2438 sock_fd = pc->cb_info->fd;
2440 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2441 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, width, INT, height);
2442 LOGD("ret : 0x%x", ret);
2447 int camera_set_capture_resolution(camera_h camera, int width, int height)
2449 if (camera == NULL) {
2450 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2451 return CAMERA_ERROR_INVALID_PARAMETER;
2454 int ret = CAMERA_ERROR_NONE;
2456 camera_cli_s *pc = (camera_cli_s *)camera;
2457 muse_camera_api_e api = MUSE_CAMERA_API_SET_CAPTURE_RESOLUTION;
2459 if (pc->cb_info == NULL) {
2460 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2461 return CAMERA_ERROR_INVALID_PARAMETER;
2463 sock_fd = pc->cb_info->fd;
2465 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2466 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, width, INT, height);
2467 LOGD("ret : 0x%x", ret);
2471 int camera_set_capture_format(camera_h camera, camera_pixel_format_e format)
2473 if (camera == NULL) {
2474 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2475 return CAMERA_ERROR_INVALID_PARAMETER;
2478 int ret = CAMERA_ERROR_NONE;
2479 int set_format = (int)format;
2481 camera_cli_s *pc = (camera_cli_s *)camera;
2482 muse_camera_api_e api = MUSE_CAMERA_API_SET_CAPTURE_FORMAT;
2484 if (pc->cb_info == NULL) {
2485 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2486 return CAMERA_ERROR_INVALID_PARAMETER;
2488 sock_fd = pc->cb_info->fd;
2490 LOGD("Enter, remote_handle : %x, capture_format: %d", pc->remote_handle, set_format);
2491 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_format);
2492 LOGD("ret : 0x%x", ret);
2496 int camera_set_preview_format(camera_h camera, camera_pixel_format_e format)
2498 if (camera == NULL) {
2499 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2500 return CAMERA_ERROR_INVALID_PARAMETER;
2503 int ret = CAMERA_ERROR_NONE;
2504 int set_format = (int)format;
2506 camera_cli_s *pc = (camera_cli_s *)camera;
2507 muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_FORMAT;
2509 if (pc->cb_info == NULL) {
2510 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2511 return CAMERA_ERROR_INVALID_PARAMETER;
2513 sock_fd = pc->cb_info->fd;
2515 LOGD("Enter, remote_handle : %x, capture_format: %d", pc->remote_handle, set_format);
2516 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_format);
2517 LOGD("ret : 0x%x", ret);
2521 int camera_get_preview_resolution(camera_h camera, int *width, int *height)
2523 if (camera == NULL || width == NULL || height == NULL) {
2524 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2525 return CAMERA_ERROR_INVALID_PARAMETER;
2529 int ret = CAMERA_ERROR_NONE;
2531 camera_cli_s *pc = (camera_cli_s *)camera;
2532 muse_camera_api_e api = MUSE_CAMERA_API_GET_PREVIEW_RESOLUTION;
2534 if (pc->cb_info == NULL) {
2535 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2536 return CAMERA_ERROR_INVALID_PARAMETER;
2538 sock_fd = pc->cb_info->fd;
2542 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2543 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2545 if (ret == CAMERA_ERROR_NONE) {
2546 muse_camera_msg_get(get_width, pc->cb_info->recv_msg);
2547 muse_camera_msg_get(get_height, pc->cb_info->recv_msg);
2549 *height = get_height;
2551 LOGD("ret : 0x%x", ret);
2555 int camera_set_display_rotation(camera_h camera, camera_rotation_e rotation)
2557 int ret = CAMERA_ERROR_NONE;
2558 int set_rotation = (int)rotation;
2559 camera_cli_s *pc = NULL;
2561 if (camera == NULL) {
2562 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2563 return CAMERA_ERROR_INVALID_PARAMETER;
2566 if (rotation < CAMERA_ROTATION_NONE || rotation > CAMERA_ROTATION_270) {
2567 LOGE("Invalid rotation %d", rotation);
2568 return CAMERA_ERROR_INVALID_PARAMETER;
2571 pc = (camera_cli_s *)camera;
2573 if (pc->cb_info == NULL) {
2574 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2575 return CAMERA_ERROR_INVALID_PARAMETER;
2578 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_ROTATION,
2579 pc->cb_info->fd, pc->cb_info, ret, INT, set_rotation);
2584 int camera_get_display_rotation(camera_h camera, camera_rotation_e *rotation)
2586 int ret = CAMERA_ERROR_NONE;
2587 int get_rotation = CAMERA_ROTATION_NONE;
2588 camera_cli_s *pc = NULL;
2590 if (camera == NULL || rotation == NULL) {
2591 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2592 return CAMERA_ERROR_INVALID_PARAMETER;
2595 pc = (camera_cli_s *)camera;
2597 if (pc->cb_info == NULL) {
2598 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2599 return CAMERA_ERROR_INVALID_PARAMETER;
2602 muse_camera_msg_send(MUSE_CAMERA_API_GET_DISPLAY_ROTATION,
2603 pc->cb_info->fd, pc->cb_info, ret);
2605 if (ret == CAMERA_ERROR_NONE) {
2606 muse_camera_msg_get(get_rotation, pc->cb_info->recv_msg);
2607 *rotation = (camera_rotation_e)get_rotation;
2613 int camera_set_display_flip(camera_h camera, camera_flip_e flip)
2615 int ret = CAMERA_ERROR_NONE;
2616 int set_flip = (int)flip;
2617 camera_cli_s *pc = NULL;
2619 if (camera == NULL) {
2620 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2621 return CAMERA_ERROR_INVALID_PARAMETER;
2624 if (flip < CAMERA_FLIP_NONE || flip > CAMERA_FLIP_BOTH) {
2625 LOGE("Invalid flip %d", flip);
2626 return CAMERA_ERROR_INVALID_PARAMETER;
2629 pc = (camera_cli_s *)camera;
2631 if (pc->cb_info == NULL) {
2632 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2633 return CAMERA_ERROR_INVALID_PARAMETER;
2636 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_FLIP,
2637 pc->cb_info->fd, pc->cb_info, ret, INT, set_flip);
2642 int camera_get_display_flip(camera_h camera, camera_flip_e *flip)
2644 int ret = CAMERA_ERROR_NONE;
2645 int get_flip = CAMERA_FLIP_NONE;
2646 camera_cli_s *pc = NULL;
2648 if (camera == NULL || flip == NULL) {
2649 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2650 return CAMERA_ERROR_INVALID_PARAMETER;
2653 pc = (camera_cli_s *)camera;
2655 if (pc->cb_info == NULL) {
2656 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2657 return CAMERA_ERROR_INVALID_PARAMETER;
2660 muse_camera_msg_send(MUSE_CAMERA_API_GET_DISPLAY_FLIP,
2661 pc->cb_info->fd, pc->cb_info, ret);
2663 if (ret == CAMERA_ERROR_NONE) {
2664 muse_camera_msg_get(get_flip, pc->cb_info->recv_msg);
2665 *flip = (camera_flip_e)get_flip;
2671 int camera_set_display_visible(camera_h camera, bool visible)
2673 int ret = CAMERA_ERROR_NONE;
2674 int set_visible = (int)visible;
2675 camera_cli_s *pc = NULL;
2677 if (camera == NULL) {
2678 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2679 return CAMERA_ERROR_INVALID_PARAMETER;
2682 pc = (camera_cli_s *)camera;
2684 if (pc->cb_info == NULL) {
2685 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2686 return CAMERA_ERROR_INVALID_PARAMETER;
2689 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_VISIBLE,
2690 pc->cb_info->fd, pc->cb_info, ret, INT, set_visible);
2695 int camera_is_display_visible(camera_h camera, bool *visible)
2697 int ret = CAMERA_ERROR_NONE;
2698 int get_visible = true;
2699 camera_cli_s *pc = NULL;
2701 if (camera == NULL || visible == NULL) {
2702 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2703 return CAMERA_ERROR_INVALID_PARAMETER;
2706 pc = (camera_cli_s *)camera;
2708 if (pc->cb_info == NULL) {
2709 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2710 return CAMERA_ERROR_INVALID_PARAMETER;
2713 muse_camera_msg_send(MUSE_CAMERA_API_IS_DISPLAY_VISIBLE,
2714 pc->cb_info->fd, pc->cb_info, ret);
2716 if (ret == CAMERA_ERROR_NONE) {
2717 muse_camera_msg_get(get_visible, pc->cb_info->recv_msg);
2718 *visible = (bool)get_visible;
2724 int camera_set_display_mode(camera_h camera, camera_display_mode_e mode)
2726 int ret = CAMERA_ERROR_NONE;
2727 int set_mode = (int)mode;
2728 camera_cli_s *pc = NULL;
2730 if (camera == NULL) {
2731 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2732 return CAMERA_ERROR_INVALID_PARAMETER;
2735 if (mode < CAMERA_DISPLAY_MODE_LETTER_BOX || mode > CAMERA_DISPLAY_MODE_CROPPED_FULL) {
2736 LOGE("Invalid mode %d", mode);
2737 return CAMERA_ERROR_INVALID_PARAMETER;
2740 pc = (camera_cli_s *)camera;
2742 if (pc->cb_info == NULL) {
2743 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2744 return CAMERA_ERROR_INVALID_PARAMETER;
2747 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_MODE,
2748 pc->cb_info->fd, pc->cb_info, ret, INT, set_mode);
2753 int camera_get_display_mode(camera_h camera, camera_display_mode_e *mode)
2755 int ret = CAMERA_ERROR_NONE;
2756 int get_mode = CAMERA_DISPLAY_MODE_LETTER_BOX;
2757 camera_cli_s *pc = NULL;
2759 if (camera == NULL || mode == NULL) {
2760 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2761 return CAMERA_ERROR_INVALID_PARAMETER;
2764 pc = (camera_cli_s *)camera;
2766 if (pc->cb_info == NULL) {
2767 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2768 return CAMERA_ERROR_INVALID_PARAMETER;
2771 muse_camera_msg_send(MUSE_CAMERA_API_GET_DISPLAY_MODE,
2772 pc->cb_info->fd, pc->cb_info, ret);
2774 if (ret == CAMERA_ERROR_NONE) {
2775 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
2776 *mode = (camera_display_mode_e)get_mode;
2782 int camera_get_capture_resolution(camera_h camera, int *width, int *height)
2784 if (camera == NULL || width == NULL || height == NULL) {
2785 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2786 return CAMERA_ERROR_INVALID_PARAMETER;
2788 int ret = CAMERA_ERROR_NONE;
2790 camera_cli_s *pc = (camera_cli_s *)camera;
2791 muse_camera_api_e api = MUSE_CAMERA_API_GET_CAPTURE_RESOLUTION;
2793 if (pc->cb_info == NULL) {
2794 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2795 return CAMERA_ERROR_INVALID_PARAMETER;
2797 sock_fd = pc->cb_info->fd;
2801 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2802 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2804 if (ret == CAMERA_ERROR_NONE) {
2805 muse_camera_msg_get(get_width, pc->cb_info->recv_msg);
2806 muse_camera_msg_get(get_height, pc->cb_info->recv_msg);
2808 *height = get_height;
2810 LOGD("ret : 0x%x", ret);
2814 int camera_get_capture_format(camera_h camera, camera_pixel_format_e *format)
2816 if (camera == NULL || format == NULL) {
2817 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2818 return CAMERA_ERROR_INVALID_PARAMETER;
2820 int ret = CAMERA_ERROR_NONE;
2822 camera_cli_s *pc = (camera_cli_s *)camera;
2823 muse_camera_api_e api = MUSE_CAMERA_API_GET_CAPTURE_FORMAT;
2826 if (pc->cb_info == NULL) {
2827 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2828 return CAMERA_ERROR_INVALID_PARAMETER;
2830 sock_fd = pc->cb_info->fd;
2832 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2833 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2835 if (ret == CAMERA_ERROR_NONE) {
2836 muse_camera_msg_get(get_format, pc->cb_info->recv_msg);
2837 *format = (camera_pixel_format_e)get_format;
2839 LOGD("ret : 0x%x", ret);
2843 int camera_get_preview_format(camera_h camera, camera_pixel_format_e *format)
2845 if (camera == NULL || format == NULL) {
2846 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2847 return CAMERA_ERROR_INVALID_PARAMETER;
2850 int ret = CAMERA_ERROR_NONE;
2852 camera_cli_s *pc = (camera_cli_s *)camera;
2853 muse_camera_api_e api = MUSE_CAMERA_API_GET_PREVIEW_FORMAT;
2856 if (pc->cb_info == NULL) {
2857 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2858 return CAMERA_ERROR_INVALID_PARAMETER;
2860 sock_fd = pc->cb_info->fd;
2862 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2863 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2865 if (ret == CAMERA_ERROR_NONE) {
2866 muse_camera_msg_get(get_format, pc->cb_info->recv_msg);
2867 *format = (camera_pixel_format_e)get_format;
2869 LOGD("ret : 0x%x", ret);
2873 int camera_get_facing_direction(camera_h camera, camera_facing_direction_e *facing_direciton)
2875 if (camera == NULL || facing_direciton == NULL) {
2876 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2877 return CAMERA_ERROR_INVALID_PARAMETER;
2880 int ret = CAMERA_ERROR_NONE;
2882 camera_cli_s *pc = (camera_cli_s *)camera;
2883 muse_camera_api_e api = MUSE_CAMERA_API_GET_FACING_DIRECTION;
2885 if (pc->cb_info == NULL) {
2886 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2887 return CAMERA_ERROR_INVALID_PARAMETER;
2889 sock_fd = pc->cb_info->fd;
2890 int get_facing_direction;
2892 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2893 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2895 if (ret == CAMERA_ERROR_NONE) {
2896 muse_camera_msg_get(get_facing_direction, pc->cb_info->recv_msg);
2897 *facing_direciton = (camera_facing_direction_e)get_facing_direction;
2899 LOGD("ret : 0x%x", ret);
2903 int camera_set_preview_cb(camera_h camera, camera_preview_cb callback, void *user_data)
2905 if (camera == NULL || callback == NULL) {
2906 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2907 return CAMERA_ERROR_INVALID_PARAMETER;
2909 int ret = CAMERA_ERROR_NONE;
2911 camera_cli_s *pc = (camera_cli_s *)camera;
2913 if (pc->cb_info == NULL) {
2914 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2915 return CAMERA_ERROR_INVALID_PARAMETER;
2917 sock_fd = pc->cb_info->fd;
2918 muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_CB;
2920 LOGD("Enter, handle :%x", pc->remote_handle);
2922 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = callback;
2923 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = user_data;
2925 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2926 LOGD("ret : 0x%x", ret);
2930 int camera_unset_preview_cb(camera_h camera)
2932 if (camera == NULL) {
2933 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2934 return CAMERA_ERROR_INVALID_PARAMETER;
2937 int ret = CAMERA_ERROR_NONE;
2939 camera_cli_s *pc = (camera_cli_s *)camera;
2940 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_PREVIEW_CB;
2942 LOGD("Enter, handle :%x", pc->remote_handle);
2945 if (pc->cb_info == NULL) {
2946 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2947 return CAMERA_ERROR_INVALID_PARAMETER;
2949 sock_fd = pc->cb_info->fd;
2950 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = (void *)NULL;
2951 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = (void *)NULL;
2953 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2954 LOGD("ret : 0x%x", ret);
2958 int camera_set_media_packet_preview_cb(camera_h camera, camera_media_packet_preview_cb callback, void *user_data)
2960 if (camera == NULL) {
2961 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
2962 return CAMERA_ERROR_INVALID_PARAMETER;
2965 if (camera_is_supported_media_packet_preview_cb(camera) == false) {
2966 LOGE("NOT SUPPORTED");
2967 return CAMERA_ERROR_NOT_SUPPORTED;
2970 if (callback == NULL) {
2971 LOGE("INVALID_PARAMETER(0x%08x) - callback", CAMERA_ERROR_INVALID_PARAMETER);
2972 return CAMERA_ERROR_INVALID_PARAMETER;
2975 int ret = CAMERA_ERROR_NONE;
2977 camera_cli_s *pc = (camera_cli_s *)camera;
2978 muse_camera_api_e api = MUSE_CAMERA_API_SET_MEDIA_PACKET_PREVIEW_CB;
2980 LOGD("Enter, handle :%x", pc->remote_handle);
2983 if (pc->cb_info == NULL) {
2984 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2985 return CAMERA_ERROR_INVALID_PARAMETER;
2987 sock_fd = pc->cb_info->fd;
2988 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = callback;
2989 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = user_data;
2991 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2992 LOGD("ret : 0x%x", ret);
2996 int camera_unset_media_packet_preview_cb(camera_h camera)
2998 if (camera == NULL) {
2999 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3000 return CAMERA_ERROR_INVALID_PARAMETER;
3003 int ret = CAMERA_ERROR_NONE;
3005 camera_cli_s *pc = (camera_cli_s *)camera;
3006 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_MEDIA_PACKET_PREVIEW_CB;
3008 LOGD("Enter, handle :%x", pc->remote_handle);
3011 if (pc->cb_info == NULL) {
3012 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3013 return CAMERA_ERROR_INVALID_PARAMETER;
3015 sock_fd = pc->cb_info->fd;
3016 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = (void *)NULL;
3017 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = (void *)NULL;
3019 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3020 LOGD("ret : 0x%x", ret);
3024 int camera_set_state_changed_cb(camera_h camera, camera_state_changed_cb callback, void *user_data)
3026 if (camera == NULL || callback == NULL) {
3027 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3028 return CAMERA_ERROR_INVALID_PARAMETER;
3030 int ret = CAMERA_ERROR_NONE;
3032 camera_cli_s *pc = (camera_cli_s *)camera;
3033 muse_camera_api_e api = MUSE_CAMERA_API_SET_STATE_CHANGED_CB;
3035 LOGD("Enter, handle :%x", pc->remote_handle);
3038 if (pc->cb_info == NULL) {
3039 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3040 return CAMERA_ERROR_INVALID_PARAMETER;
3042 sock_fd = pc->cb_info->fd;
3043 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = callback;
3044 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = user_data;
3046 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3047 LOGD("ret : 0x%x", ret);
3050 int camera_unset_state_changed_cb(camera_h camera)
3052 if (camera == NULL) {
3053 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3054 return CAMERA_ERROR_INVALID_PARAMETER;
3056 int ret = CAMERA_ERROR_NONE;
3058 camera_cli_s *pc = (camera_cli_s *)camera;
3059 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_STATE_CHANGED_CB;
3061 LOGD("Enter, handle :%x", pc->remote_handle);
3064 if (pc->cb_info == NULL) {
3065 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3066 return CAMERA_ERROR_INVALID_PARAMETER;
3068 sock_fd = pc->cb_info->fd;
3069 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = (void *)NULL;
3070 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = (void *)NULL;
3072 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3073 LOGD("ret : 0x%x", ret);
3077 int camera_set_interrupted_cb(camera_h camera, camera_interrupted_cb callback, void *user_data)
3079 if (camera == NULL || callback == NULL) {
3080 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3081 return CAMERA_ERROR_INVALID_PARAMETER;
3083 int ret = CAMERA_ERROR_NONE;
3085 camera_cli_s *pc = (camera_cli_s *)camera;
3086 muse_camera_api_e api = MUSE_CAMERA_API_SET_INTERRUPTED_CB;
3088 LOGD("Enter, handle :%x", pc->remote_handle);
3091 if (pc->cb_info == NULL) {
3092 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3093 return CAMERA_ERROR_INVALID_PARAMETER;
3095 sock_fd = pc->cb_info->fd;
3096 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = callback;
3097 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = user_data;
3099 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3100 LOGD("ret : 0x%x", ret);
3104 int camera_unset_interrupted_cb(camera_h camera)
3106 if (camera == NULL) {
3107 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3108 return CAMERA_ERROR_INVALID_PARAMETER;
3110 int ret = CAMERA_ERROR_NONE;
3112 camera_cli_s *pc = (camera_cli_s *)camera;
3113 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_INTERRUPTED_CB;
3115 LOGD("Enter, handle :%x", pc->remote_handle);
3118 if (pc->cb_info == NULL) {
3119 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3120 return CAMERA_ERROR_INVALID_PARAMETER;
3122 sock_fd = pc->cb_info->fd;
3123 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = (void *)NULL;
3124 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = (void *)NULL;
3126 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3127 LOGD("ret : 0x%x", ret);
3131 int camera_set_focus_changed_cb(camera_h camera, camera_focus_changed_cb callback, void *user_data)
3133 if (camera == NULL || callback == NULL) {
3134 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3135 return CAMERA_ERROR_INVALID_PARAMETER;
3137 int ret = CAMERA_ERROR_NONE;
3139 camera_cli_s *pc = (camera_cli_s *)camera;
3140 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOCUS_CHANGED_CB;
3142 LOGD("Enter, handle :%x", pc->remote_handle);
3145 if (pc->cb_info == NULL) {
3146 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3147 return CAMERA_ERROR_INVALID_PARAMETER;
3149 sock_fd = pc->cb_info->fd;
3150 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = callback;
3151 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = user_data;
3153 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3154 LOGD("ret : 0x%x", ret);
3158 int camera_unset_focus_changed_cb(camera_h camera)
3160 if (camera == NULL) {
3161 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3162 return CAMERA_ERROR_INVALID_PARAMETER;
3164 int ret = CAMERA_ERROR_NONE;
3166 camera_cli_s *pc = (camera_cli_s *)camera;
3167 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_FOCUS_CHANGED_CB;
3169 LOGD("Enter, handle :%x", pc->remote_handle);
3172 if (pc->cb_info == NULL) {
3173 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3174 return CAMERA_ERROR_INVALID_PARAMETER;
3176 sock_fd = pc->cb_info->fd;
3177 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = (void *)NULL;
3178 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = (void *)NULL;
3180 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3181 LOGD("ret : 0x%x", ret);
3185 int camera_set_error_cb(camera_h camera, camera_error_cb callback, void *user_data)
3187 if (camera == NULL || callback == NULL) {
3188 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3189 return CAMERA_ERROR_INVALID_PARAMETER;
3191 int ret = CAMERA_ERROR_NONE;
3193 camera_cli_s *pc = (camera_cli_s *)camera;
3194 muse_camera_api_e api = MUSE_CAMERA_API_SET_ERROR_CB;
3196 LOGD("Enter, handle :%x", pc->remote_handle);
3199 if (pc->cb_info == NULL) {
3200 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3201 return CAMERA_ERROR_INVALID_PARAMETER;
3203 sock_fd = pc->cb_info->fd;
3204 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_ERROR] = callback;
3205 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_ERROR] = user_data;
3207 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3208 LOGD("ret : 0x%x", ret);
3212 int camera_unset_error_cb(camera_h camera)
3214 if (camera == NULL) {
3215 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3216 return CAMERA_ERROR_INVALID_PARAMETER;
3218 int ret = CAMERA_ERROR_NONE;
3220 camera_cli_s *pc = (camera_cli_s *)camera;
3221 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_ERROR_CB;
3223 LOGD("Enter, handle :%x", pc->remote_handle);
3226 if (pc->cb_info == NULL) {
3227 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3228 return CAMERA_ERROR_INVALID_PARAMETER;
3230 sock_fd = pc->cb_info->fd;
3231 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_ERROR] = (void *)NULL;
3232 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_ERROR] = (void *)NULL;
3234 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3235 LOGD("ret : 0x%x", ret);
3239 int camera_foreach_supported_preview_resolution(camera_h camera, camera_supported_preview_resolution_cb foreach_cb , void *user_data)
3241 if (camera == NULL || foreach_cb == NULL) {
3242 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3243 return CAMERA_ERROR_INVALID_PARAMETER;
3245 int ret = CAMERA_ERROR_NONE;
3247 camera_cli_s *pc = (camera_cli_s *)camera;
3248 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_PREVIEW_RESOLUTION;
3250 LOGD("Enter, handle :%x", pc->remote_handle);
3253 if (pc->cb_info == NULL) {
3254 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3255 return CAMERA_ERROR_INVALID_PARAMETER;
3257 sock_fd = pc->cb_info->fd;
3258 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_RESOLUTION] = foreach_cb;
3259 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_RESOLUTION] = user_data;
3261 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3262 LOGD("ret : 0x%x", ret);
3266 int camera_foreach_supported_capture_resolution(camera_h camera, camera_supported_capture_resolution_cb foreach_cb , void *user_data)
3268 if (camera == NULL || foreach_cb == NULL) {
3269 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3270 return CAMERA_ERROR_INVALID_PARAMETER;
3272 int ret = CAMERA_ERROR_NONE;
3274 camera_cli_s *pc = (camera_cli_s *)camera;
3275 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_CAPTURE_RESOLUTION;
3277 LOGD("Enter, handle :%x", pc->remote_handle);
3280 if (pc->cb_info == NULL) {
3281 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3282 return CAMERA_ERROR_INVALID_PARAMETER;
3284 sock_fd = pc->cb_info->fd;
3285 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_RESOLUTION] = foreach_cb;
3286 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_RESOLUTION] = user_data;
3288 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3289 LOGD("ret : 0x%x", ret);
3293 int camera_foreach_supported_capture_format(camera_h camera, camera_supported_capture_format_cb foreach_cb , void *user_data)
3295 if (camera == NULL || foreach_cb == NULL) {
3296 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3297 return CAMERA_ERROR_INVALID_PARAMETER;
3299 int ret = CAMERA_ERROR_NONE;
3301 camera_cli_s *pc = (camera_cli_s *)camera;
3302 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_CAPTURE_FORMAT;
3304 LOGD("Enter, handle :%x", pc->remote_handle);
3307 if (pc->cb_info == NULL) {
3308 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3309 return CAMERA_ERROR_INVALID_PARAMETER;
3311 sock_fd = pc->cb_info->fd;
3312 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_FORMAT] = foreach_cb;
3313 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_FORMAT] = user_data;
3315 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3316 LOGD("ret : 0x%x", ret);
3321 int camera_foreach_supported_preview_format(camera_h camera, camera_supported_preview_format_cb foreach_cb , void *user_data)
3323 if (camera == NULL || foreach_cb == NULL) {
3324 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3325 return CAMERA_ERROR_INVALID_PARAMETER;
3327 int ret = CAMERA_ERROR_NONE;
3329 camera_cli_s *pc = (camera_cli_s *)camera;
3330 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_PREVIEW_FORMAT;
3332 LOGD("Enter, handle :%x", pc->remote_handle);
3335 if (pc->cb_info == NULL) {
3336 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3337 return CAMERA_ERROR_INVALID_PARAMETER;
3339 sock_fd = pc->cb_info->fd;
3340 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_FORMAT] = foreach_cb;
3341 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_FORMAT] = user_data;
3343 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3344 LOGD("ret : 0x%x", ret);
3349 int camera_get_recommended_preview_resolution(camera_h camera, int *width, int *height)
3351 if (camera == NULL || width == NULL || height == NULL) {
3352 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3353 return CAMERA_ERROR_INVALID_PARAMETER;
3355 int ret = CAMERA_ERROR_NONE;
3357 camera_cli_s *pc = (camera_cli_s *)camera;
3358 muse_camera_api_e api = MUSE_CAMERA_API_GET_RECOMMENDED_PREVIEW_RESOLUTION;
3360 if (pc->cb_info == NULL) {
3361 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3362 return CAMERA_ERROR_INVALID_PARAMETER;
3364 sock_fd = pc->cb_info->fd;
3368 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3369 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3371 if (ret == CAMERA_ERROR_NONE) {
3372 muse_camera_msg_get(get_width, pc->cb_info->recv_msg);
3373 muse_camera_msg_get(get_height, pc->cb_info->recv_msg);
3375 *height = get_height;
3377 LOGD("ret : 0x%x", ret);
3382 int camera_attr_get_lens_orientation(camera_h camera, int *angle)
3384 if (camera == NULL || angle == NULL) {
3385 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3386 return CAMERA_ERROR_INVALID_PARAMETER;
3388 int ret = CAMERA_ERROR_NONE;
3390 camera_cli_s *pc = (camera_cli_s *)camera;
3391 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_LENS_ORIENTATION;
3393 if (pc->cb_info == NULL) {
3394 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3395 return CAMERA_ERROR_INVALID_PARAMETER;
3397 sock_fd = pc->cb_info->fd;
3400 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3401 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3403 if (ret == CAMERA_ERROR_NONE) {
3404 muse_camera_msg_get(get_angle, pc->cb_info->recv_msg);
3407 LOGD("ret : 0x%x", ret);
3411 int camera_attr_set_theater_mode(camera_h camera, camera_attr_theater_mode_e mode)
3413 if (camera == NULL) {
3414 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3415 return CAMERA_ERROR_INVALID_PARAMETER;
3417 int ret = CAMERA_ERROR_NONE;
3418 camera_cli_s *pc = (camera_cli_s *)camera;
3419 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_THEATER_MODE;
3421 if (pc->cb_info == NULL) {
3422 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3423 return CAMERA_ERROR_INVALID_PARAMETER;
3425 sock_fd = pc->cb_info->fd;
3426 int set_mode = (int)mode;
3427 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3428 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
3429 LOGD("ret : 0x%x", ret);
3433 int camera_attr_get_theater_mode(camera_h camera, camera_attr_theater_mode_e *mode)
3435 if (camera == NULL || mode == NULL) {
3436 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3437 return CAMERA_ERROR_INVALID_PARAMETER;
3440 int ret = CAMERA_ERROR_NONE;
3441 camera_cli_s *pc = (camera_cli_s *)camera;
3442 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_THEATER_MODE;
3444 if (pc->cb_info == NULL) {
3445 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3446 return CAMERA_ERROR_INVALID_PARAMETER;
3448 sock_fd = pc->cb_info->fd;
3450 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3451 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3453 if (ret == CAMERA_ERROR_NONE) {
3454 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
3455 *mode = (camera_attr_theater_mode_e)get_mode;
3457 LOGD("ret : 0x%x", ret);
3461 int camera_attr_foreach_supported_theater_mode(camera_h camera, camera_attr_supported_theater_mode_cb foreach_cb, void *user_data)
3463 if (camera == NULL || foreach_cb == NULL) {
3464 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3465 return CAMERA_ERROR_INVALID_PARAMETER;
3467 int ret = CAMERA_ERROR_NONE;
3469 camera_cli_s *pc = (camera_cli_s *)camera;
3470 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_THEATER_MODE;
3472 LOGD("Enter, handle :%x", pc->remote_handle);
3475 if (pc->cb_info == NULL) {
3476 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3477 return CAMERA_ERROR_INVALID_PARAMETER;
3479 sock_fd = pc->cb_info->fd;
3480 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE] = foreach_cb;
3481 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE] = user_data;
3483 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3485 LOGD("Finish, return :%x", ret);
3490 int camera_attr_set_preview_fps(camera_h camera, camera_attr_fps_e fps)
3492 if (camera == NULL) {
3493 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3494 return CAMERA_ERROR_INVALID_PARAMETER;
3496 int ret = CAMERA_ERROR_NONE;
3497 camera_cli_s *pc = (camera_cli_s *)camera;
3498 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_PREVIEW_FPS;
3500 if (pc->cb_info == NULL) {
3501 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3502 return CAMERA_ERROR_INVALID_PARAMETER;
3504 sock_fd = pc->cb_info->fd;
3505 int set_fps = (int)fps;
3506 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3507 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_fps);
3508 LOGD("ret : 0x%x", ret);
3513 int camera_attr_set_image_quality(camera_h camera, int quality)
3515 if (camera == NULL) {
3516 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3517 return CAMERA_ERROR_INVALID_PARAMETER;
3519 int ret = CAMERA_ERROR_NONE;
3521 camera_cli_s *pc = (camera_cli_s *)camera;
3522 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_IMAGE_QUALITY;
3524 if (pc->cb_info == NULL) {
3525 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3526 return CAMERA_ERROR_INVALID_PARAMETER;
3528 sock_fd = pc->cb_info->fd;
3529 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3530 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, quality);
3531 LOGD("ret : 0x%x", ret);
3535 int camera_attr_get_preview_fps(camera_h camera, camera_attr_fps_e *fps)
3537 if (camera == NULL || fps == NULL) {
3538 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3539 return CAMERA_ERROR_INVALID_PARAMETER;
3541 int ret = CAMERA_ERROR_NONE;
3543 camera_cli_s *pc = (camera_cli_s *)camera;
3544 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_PREVIEW_FPS;
3547 if (pc->cb_info == NULL) {
3548 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3549 return CAMERA_ERROR_INVALID_PARAMETER;
3551 sock_fd = pc->cb_info->fd;
3553 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3554 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3556 if (ret == CAMERA_ERROR_NONE) {
3557 muse_camera_msg_get(get_fps, pc->cb_info->recv_msg);
3558 *fps = (camera_attr_fps_e)get_fps;
3560 LOGD("ret : 0x%x", ret);
3565 int camera_attr_get_image_quality(camera_h camera, int *quality)
3567 if (camera == NULL || quality == NULL) {
3568 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3569 return CAMERA_ERROR_INVALID_PARAMETER;
3571 int ret = CAMERA_ERROR_NONE;
3573 camera_cli_s *pc = (camera_cli_s *)camera;
3574 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_IMAGE_QUALITY;
3576 if (pc->cb_info == NULL) {
3577 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3578 return CAMERA_ERROR_INVALID_PARAMETER;
3580 sock_fd = pc->cb_info->fd;
3582 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3583 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3585 if (ret == CAMERA_ERROR_NONE) {
3586 muse_camera_msg_get(get_quality, pc->cb_info->recv_msg);
3587 *quality = get_quality;
3589 LOGD("ret : 0x%x", ret);
3594 int camera_attr_get_encoded_preview_bitrate(camera_h camera, int *bitrate)
3596 if (camera == NULL || bitrate == NULL) {
3597 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3598 return CAMERA_ERROR_INVALID_PARAMETER;
3601 int ret = CAMERA_ERROR_NONE;
3603 camera_cli_s *pc = (camera_cli_s *)camera;
3604 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ENCODED_PREVIEW_BITRATE;
3606 if (pc->cb_info == NULL) {
3607 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3608 return CAMERA_ERROR_INVALID_PARAMETER;
3610 sock_fd = pc->cb_info->fd;
3613 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3614 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3616 if (ret == CAMERA_ERROR_NONE) {
3617 muse_camera_msg_get(get_bitrate, pc->cb_info->recv_msg);
3618 *bitrate = get_bitrate;
3620 LOGD("ret : 0x%x", ret);
3625 int camera_attr_set_encoded_preview_bitrate(camera_h camera, int bitrate)
3627 if (camera == NULL) {
3628 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3629 return CAMERA_ERROR_INVALID_PARAMETER;
3632 int ret = CAMERA_ERROR_NONE;
3634 camera_cli_s *pc = (camera_cli_s *)camera;
3635 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ENCODED_PREVIEW_BITRATE;
3637 if (pc->cb_info == NULL) {
3638 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3639 return CAMERA_ERROR_INVALID_PARAMETER;
3641 sock_fd = pc->cb_info->fd;
3642 int set_bitrate = bitrate;
3643 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3644 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_bitrate);
3645 LOGD("ret : 0x%x", ret);
3650 int camera_attr_get_encoded_preview_gop_interval(camera_h camera, int *interval)
3652 if (camera == NULL || interval == NULL) {
3653 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3654 return CAMERA_ERROR_INVALID_PARAMETER;
3657 int ret = CAMERA_ERROR_NONE;
3659 camera_cli_s *pc = (camera_cli_s *)camera;
3660 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ENCODED_PREVIEW_GOP_INTERVAL;
3662 if (pc->cb_info == NULL) {
3663 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3664 return CAMERA_ERROR_INVALID_PARAMETER;
3666 sock_fd = pc->cb_info->fd;
3667 int get_gop_interval;
3669 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3670 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3672 if (ret == CAMERA_ERROR_NONE) {
3673 muse_camera_msg_get(get_gop_interval, pc->cb_info->recv_msg);
3674 *interval = get_gop_interval;
3676 LOGD("ret : 0x%x", ret);
3681 int camera_attr_set_encoded_preview_gop_interval(camera_h camera, int interval)
3683 if (camera == NULL) {
3684 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3685 return CAMERA_ERROR_INVALID_PARAMETER;
3688 int ret = CAMERA_ERROR_NONE;
3690 camera_cli_s *pc = (camera_cli_s *)camera;
3691 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ENCODED_PREVIEW_GOP_INTERVAL;
3693 if (pc->cb_info == NULL) {
3694 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3695 return CAMERA_ERROR_INVALID_PARAMETER;
3697 sock_fd = pc->cb_info->fd;
3698 int set_gop_interval = interval;
3699 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3700 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_gop_interval);
3701 LOGD("ret : 0x%x", ret);
3706 int camera_attr_set_zoom(camera_h camera, int zoom)
3708 if (camera == NULL) {
3709 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3710 return CAMERA_ERROR_INVALID_PARAMETER;
3712 int ret = CAMERA_ERROR_NONE;
3714 camera_cli_s *pc = (camera_cli_s *)camera;
3715 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ZOOM;
3717 if (pc->cb_info == NULL) {
3718 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3719 return CAMERA_ERROR_INVALID_PARAMETER;
3721 sock_fd = pc->cb_info->fd;
3723 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3724 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, zoom);
3725 LOGD("ret : 0x%x", ret);
3729 int camera_attr_set_af_mode(camera_h camera, camera_attr_af_mode_e mode)
3731 if (camera == NULL) {
3732 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3733 return CAMERA_ERROR_INVALID_PARAMETER;
3735 int ret = CAMERA_ERROR_NONE;
3737 camera_cli_s *pc = (camera_cli_s *)camera;
3738 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_AF_MODE;
3740 if (pc->cb_info == NULL) {
3741 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3742 return CAMERA_ERROR_INVALID_PARAMETER;
3744 sock_fd = pc->cb_info->fd;
3745 int set_mode = (int)mode;
3746 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3747 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
3748 LOGD("ret : 0x%x", ret);
3752 int camera_attr_set_af_area(camera_h camera, int x, int y)
3754 if (camera == NULL) {
3755 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3756 return CAMERA_ERROR_INVALID_PARAMETER;
3758 int ret = CAMERA_ERROR_NONE;
3759 camera_cli_s *pc = (camera_cli_s *)camera;
3760 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_AF_AREA;
3761 int sock_fd = pc->cb_info->fd;
3762 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3763 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, x, INT, y);
3764 LOGD("ret : 0x%x", ret);
3769 int camera_attr_clear_af_area(camera_h camera)
3771 if (camera == NULL) {
3772 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3773 return CAMERA_ERROR_INVALID_PARAMETER;
3775 int ret = CAMERA_ERROR_NONE;
3777 camera_cli_s *pc = (camera_cli_s *)camera;
3778 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_CLEAR_AF_AREA;
3780 if (pc->cb_info == NULL) {
3781 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3782 return CAMERA_ERROR_INVALID_PARAMETER;
3784 sock_fd = pc->cb_info->fd;
3785 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3786 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3787 LOGD("ret : 0x%x", ret);
3792 int camera_attr_set_exposure_mode(camera_h camera, camera_attr_exposure_mode_e mode)
3794 if (camera == NULL) {
3795 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3796 return CAMERA_ERROR_INVALID_PARAMETER;
3799 if (mode < CAMERA_ATTR_EXPOSURE_MODE_OFF || mode > CAMERA_ATTR_EXPOSURE_MODE_CUSTOM) {
3800 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3801 return CAMERA_ERROR_INVALID_PARAMETER;
3804 int ret = CAMERA_ERROR_NONE;
3805 camera_cli_s *pc = (camera_cli_s *)camera;
3806 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EXPOSURE_MODE;
3807 int set_mode = (int)mode;
3809 if (pc->cb_info == NULL) {
3810 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3811 return CAMERA_ERROR_INVALID_PARAMETER;
3813 sock_fd = pc->cb_info->fd;
3814 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3815 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
3816 LOGD("ret : 0x%x", ret);
3821 int camera_attr_set_exposure(camera_h camera, int value)
3823 if (camera == NULL) {
3824 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3825 return CAMERA_ERROR_INVALID_PARAMETER;
3827 int ret = CAMERA_ERROR_NONE;
3829 camera_cli_s *pc = (camera_cli_s *)camera;
3830 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EXPOSURE;
3832 if (pc->cb_info == NULL) {
3833 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3834 return CAMERA_ERROR_INVALID_PARAMETER;
3836 sock_fd = pc->cb_info->fd;
3838 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3839 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, value);
3840 LOGD("ret : 0x%x", ret);
3845 int camera_attr_set_iso(camera_h camera, camera_attr_iso_e iso)
3847 if (camera == NULL) {
3848 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3849 return CAMERA_ERROR_INVALID_PARAMETER;
3851 int ret = CAMERA_ERROR_NONE;
3853 camera_cli_s *pc = (camera_cli_s *)camera;
3854 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ISO;
3856 if (pc->cb_info == NULL) {
3857 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3858 return CAMERA_ERROR_INVALID_PARAMETER;
3860 sock_fd = pc->cb_info->fd;
3861 int set_iso = (int)iso;
3862 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3863 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_iso);
3864 LOGD("ret : 0x%x", ret);
3869 int camera_attr_set_brightness(camera_h camera, int level)
3871 if (camera == NULL) {
3872 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3873 return CAMERA_ERROR_INVALID_PARAMETER;
3875 int ret = CAMERA_ERROR_NONE;
3877 camera_cli_s *pc = (camera_cli_s *)camera;
3878 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_BRIGHTNESS;
3880 if (pc->cb_info == NULL) {
3881 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3882 return CAMERA_ERROR_INVALID_PARAMETER;
3884 sock_fd = pc->cb_info->fd;
3886 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3887 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, level);
3888 LOGD("ret : 0x%x", ret);
3893 int camera_attr_set_contrast(camera_h camera, int level)
3895 if (camera == NULL) {
3896 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3897 return CAMERA_ERROR_INVALID_PARAMETER;
3899 int ret = CAMERA_ERROR_NONE;
3901 camera_cli_s *pc = (camera_cli_s *)camera;
3902 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_CONTRAST;
3904 if (pc->cb_info == NULL) {
3905 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3906 return CAMERA_ERROR_INVALID_PARAMETER;
3908 sock_fd = pc->cb_info->fd;
3910 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3911 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, level);
3912 LOGD("ret : 0x%x", ret);
3917 int camera_attr_set_whitebalance(camera_h camera, camera_attr_whitebalance_e wb)
3919 if (camera == NULL) {
3920 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3921 return CAMERA_ERROR_INVALID_PARAMETER;
3924 if (wb < CAMERA_ATTR_WHITE_BALANCE_NONE || wb > CAMERA_ATTR_WHITE_BALANCE_CUSTOM) {
3925 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_NOT_SUPPORTED);
3926 return CAMERA_ERROR_NOT_SUPPORTED;
3929 int ret = CAMERA_ERROR_NONE;
3931 camera_cli_s *pc = (camera_cli_s *)camera;
3932 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_WHITEBALANCE;
3934 if (pc->cb_info == NULL) {
3935 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3936 return CAMERA_ERROR_INVALID_PARAMETER;
3938 sock_fd = pc->cb_info->fd;
3939 int set_whitebalance = (int)wb;
3940 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3941 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_whitebalance);
3942 LOGD("ret : 0x%x", ret);
3947 int camera_attr_set_effect(camera_h camera, camera_attr_effect_mode_e effect)
3949 if (camera == NULL) {
3950 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3951 return CAMERA_ERROR_INVALID_PARAMETER;
3953 int ret = CAMERA_ERROR_NONE;
3955 camera_cli_s *pc = (camera_cli_s *)camera;
3956 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EFFECT;
3958 if (pc->cb_info == NULL) {
3959 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3960 return CAMERA_ERROR_INVALID_PARAMETER;
3962 sock_fd = pc->cb_info->fd;
3963 int set_effect = (int)effect;
3964 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3965 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_effect);
3966 LOGD("ret : 0x%x", ret);
3971 int camera_attr_set_scene_mode(camera_h camera, camera_attr_scene_mode_e mode)
3973 if (camera == NULL) {
3974 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3975 return CAMERA_ERROR_INVALID_PARAMETER;
3977 int ret = CAMERA_ERROR_NONE;
3979 camera_cli_s *pc = (camera_cli_s *)camera;
3980 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_SCENE_MODE;
3982 if (pc->cb_info == NULL) {
3983 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3984 return CAMERA_ERROR_INVALID_PARAMETER;
3986 sock_fd = pc->cb_info->fd;
3987 int set_mode = (int)mode;
3988 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3989 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
3990 LOGD("ret : 0x%x", ret);
3995 int camera_attr_enable_tag(camera_h camera, bool enable)
3997 if (camera == NULL) {
3998 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3999 return CAMERA_ERROR_INVALID_PARAMETER;
4001 int ret = CAMERA_ERROR_NONE;
4002 camera_cli_s *pc = (camera_cli_s *)camera;
4003 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_TAG;
4005 if (pc->cb_info == NULL) {
4006 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4007 return CAMERA_ERROR_INVALID_PARAMETER;
4009 sock_fd = pc->cb_info->fd;
4010 int set_enable = (int)enable;
4012 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4013 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
4014 LOGD("ret : 0x%x", ret);
4019 int camera_attr_set_tag_image_description(camera_h camera, const char *description)
4021 if (camera == NULL) {
4022 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4023 return CAMERA_ERROR_INVALID_PARAMETER;
4025 if (description == NULL) {
4026 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4027 return CAMERA_ERROR_INVALID_PARAMETER;
4029 int ret = CAMERA_ERROR_NONE;
4030 camera_cli_s *pc = (camera_cli_s *)camera;
4031 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_IMAGE_DESCRIPTION;
4033 if (pc->cb_info == NULL) {
4034 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4035 return CAMERA_ERROR_INVALID_PARAMETER;
4037 sock_fd = pc->cb_info->fd;
4038 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4039 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, STRING, description);
4040 LOGD("ret : 0x%x", ret);
4045 int camera_attr_set_tag_orientation(camera_h camera, camera_attr_tag_orientation_e orientation)
4047 if (camera == NULL) {
4048 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4049 return CAMERA_ERROR_INVALID_PARAMETER;
4051 int ret = CAMERA_ERROR_NONE;
4052 camera_cli_s *pc = (camera_cli_s *)camera;
4053 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_ORIENTATION;
4055 if (pc->cb_info == NULL) {
4056 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4057 return CAMERA_ERROR_INVALID_PARAMETER;
4059 sock_fd = pc->cb_info->fd;
4060 int set_orientation = (int)orientation;
4062 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4063 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_orientation);
4064 LOGD("ret : 0x%x", ret);
4069 int camera_attr_set_tag_software(camera_h camera, const char *software)
4071 if (camera == NULL) {
4072 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4073 return CAMERA_ERROR_INVALID_PARAMETER;
4075 if (software == NULL) {
4076 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4077 return CAMERA_ERROR_INVALID_PARAMETER;
4079 int ret = CAMERA_ERROR_NONE;
4080 camera_cli_s *pc = (camera_cli_s *)camera;
4081 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_SOFTWARE;
4083 if (pc->cb_info == NULL) {
4084 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4085 return CAMERA_ERROR_INVALID_PARAMETER;
4087 sock_fd = pc->cb_info->fd;
4088 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4089 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, STRING, software);
4090 LOGD("ret : 0x%x", ret);
4095 int camera_attr_set_geotag(camera_h camera, double latitude , double longitude, double altitude)
4097 if (camera == NULL) {
4098 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4099 return CAMERA_ERROR_INVALID_PARAMETER;
4101 int ret = CAMERA_ERROR_NONE;
4102 camera_cli_s *pc = (camera_cli_s *)camera;
4103 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_GEOTAG;
4105 if (pc->cb_info == NULL) {
4106 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4107 return CAMERA_ERROR_INVALID_PARAMETER;
4109 sock_fd = pc->cb_info->fd;
4110 double set_geotag[3] = { latitude, longitude, altitude };
4112 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4113 muse_camera_msg_send_array(api, sock_fd, pc->cb_info, ret,
4114 set_geotag, sizeof(set_geotag), sizeof(double));
4115 LOGD("ret : 0x%x", ret);
4120 int camera_attr_remove_geotag(camera_h camera)
4122 if (camera == NULL) {
4123 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4124 return CAMERA_ERROR_INVALID_PARAMETER;
4126 int ret = CAMERA_ERROR_NONE;
4127 camera_cli_s *pc = (camera_cli_s *)camera;
4128 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_REMOVE_GEOTAG;
4130 if (pc->cb_info == NULL) {
4131 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4132 return CAMERA_ERROR_INVALID_PARAMETER;
4134 sock_fd = pc->cb_info->fd;
4135 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4136 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4137 LOGD("ret : 0x%x", ret);
4142 int camera_attr_set_flash_mode(camera_h camera, camera_attr_flash_mode_e mode)
4144 if (camera == NULL) {
4145 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4146 return CAMERA_ERROR_INVALID_PARAMETER;
4148 int ret = CAMERA_ERROR_NONE;
4149 camera_cli_s *pc = (camera_cli_s *)camera;
4150 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_FLASH_MODE;
4152 if (pc->cb_info == NULL) {
4153 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4154 return CAMERA_ERROR_INVALID_PARAMETER;
4156 sock_fd = pc->cb_info->fd;
4157 int set_mode = (int)mode;
4159 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4160 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
4161 LOGD("ret : 0x%x", ret);
4166 int camera_attr_get_zoom(camera_h camera, int *zoom)
4168 if (camera == NULL || zoom == NULL) {
4169 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4170 return CAMERA_ERROR_INVALID_PARAMETER;
4172 int ret = CAMERA_ERROR_NONE;
4174 camera_cli_s *pc = (camera_cli_s *)camera;
4175 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ZOOM;
4178 if (pc->cb_info == NULL) {
4179 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4180 return CAMERA_ERROR_INVALID_PARAMETER;
4182 sock_fd = pc->cb_info->fd;
4184 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4185 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4187 if (ret == CAMERA_ERROR_NONE) {
4188 muse_camera_msg_get(get_zoom, pc->cb_info->recv_msg);
4191 LOGD("ret : 0x%x", ret);
4196 int camera_attr_get_zoom_range(camera_h camera, int *min, int *max)
4198 if (camera == NULL || min == NULL || max == NULL) {
4199 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4200 return CAMERA_ERROR_INVALID_PARAMETER;
4202 int ret = CAMERA_ERROR_NONE;
4203 camera_cli_s *pc = (camera_cli_s *)camera;
4205 if (pc->cb_info == NULL) {
4206 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4207 return CAMERA_ERROR_INVALID_PARAMETER;
4209 sock_fd = pc->cb_info->fd;
4210 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ZOOM_RANGE;
4214 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4215 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4217 if (ret == CAMERA_ERROR_NONE) {
4218 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
4219 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
4223 LOGD("ret : 0x%x", ret);
4228 int camera_attr_get_af_mode(camera_h camera, camera_attr_af_mode_e *mode)
4230 if (camera == NULL || mode == NULL) {
4231 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4232 return CAMERA_ERROR_INVALID_PARAMETER;
4234 int ret = CAMERA_ERROR_NONE;
4235 camera_cli_s *pc = (camera_cli_s *)camera;
4237 if (pc->cb_info == NULL) {
4238 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4239 return CAMERA_ERROR_INVALID_PARAMETER;
4241 sock_fd = pc->cb_info->fd;
4242 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_AF_MODE;
4245 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4246 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4248 if (ret == CAMERA_ERROR_NONE) {
4249 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
4250 *mode = (camera_attr_af_mode_e)get_mode;
4252 LOGD("ret : 0x%x", ret);
4257 int camera_attr_get_exposure_mode(camera_h camera, camera_attr_exposure_mode_e *mode)
4259 if (camera == NULL || mode == NULL) {
4260 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4261 return CAMERA_ERROR_INVALID_PARAMETER;
4263 int ret = CAMERA_ERROR_NONE;
4264 camera_cli_s *pc = (camera_cli_s *)camera;
4266 if (pc->cb_info == NULL) {
4267 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4268 return CAMERA_ERROR_INVALID_PARAMETER;
4270 sock_fd = pc->cb_info->fd;
4271 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE_MODE;
4274 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4275 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4277 if (ret == CAMERA_ERROR_NONE) {
4278 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
4279 *mode = (camera_attr_exposure_mode_e)get_mode;
4281 LOGD("ret : 0x%x", ret);
4285 int camera_attr_get_exposure(camera_h camera, int *value)
4287 if (camera == NULL || value == NULL) {
4288 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4289 return CAMERA_ERROR_INVALID_PARAMETER;
4291 int ret = CAMERA_ERROR_NONE;
4292 camera_cli_s *pc = (camera_cli_s *)camera;
4294 if (pc->cb_info == NULL) {
4295 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4296 return CAMERA_ERROR_INVALID_PARAMETER;
4298 sock_fd = pc->cb_info->fd;
4299 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE;
4302 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4303 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4305 if (ret == CAMERA_ERROR_NONE) {
4306 muse_camera_msg_get(get_value, pc->cb_info->recv_msg);
4309 LOGD("ret : 0x%x", ret);
4314 int camera_attr_get_exposure_range(camera_h camera, int *min, int *max)
4316 if (camera == NULL || min == NULL || max == NULL) {
4317 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4318 return CAMERA_ERROR_INVALID_PARAMETER;
4320 int ret = CAMERA_ERROR_NONE;
4321 camera_cli_s *pc = (camera_cli_s *)camera;
4323 if (pc->cb_info == NULL) {
4324 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4325 return CAMERA_ERROR_INVALID_PARAMETER;
4327 sock_fd = pc->cb_info->fd;
4328 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE_RANGE;
4332 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4333 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4335 if (ret == CAMERA_ERROR_NONE) {
4336 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
4337 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
4341 LOGD("ret : 0x%x", ret);
4346 int camera_attr_get_iso(camera_h camera, camera_attr_iso_e *iso)
4348 if (camera == NULL || iso == NULL) {
4349 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4350 return CAMERA_ERROR_INVALID_PARAMETER;
4352 int ret = CAMERA_ERROR_NONE;
4353 camera_cli_s *pc = (camera_cli_s *)camera;
4355 if (pc->cb_info == NULL) {
4356 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4357 return CAMERA_ERROR_INVALID_PARAMETER;
4359 sock_fd = pc->cb_info->fd;
4360 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ISO;
4363 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4364 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4366 if (ret == CAMERA_ERROR_NONE) {
4367 muse_camera_msg_get(get_iso, pc->cb_info->recv_msg);
4368 *iso = (camera_attr_iso_e)get_iso;
4370 LOGD("ret : 0x%x", ret);
4375 int camera_attr_get_brightness(camera_h camera, int *level)
4377 if (camera == NULL || level == NULL) {
4378 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4379 return CAMERA_ERROR_INVALID_PARAMETER;
4381 int ret = CAMERA_ERROR_NONE;
4382 camera_cli_s *pc = (camera_cli_s *)camera;
4384 if (pc->cb_info == NULL) {
4385 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4386 return CAMERA_ERROR_INVALID_PARAMETER;
4388 sock_fd = pc->cb_info->fd;
4389 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_BRIGHTNESS;
4392 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4393 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4395 if (ret == CAMERA_ERROR_NONE) {
4396 muse_camera_msg_get(get_level, pc->cb_info->recv_msg);
4399 LOGD("ret : 0x%x", ret);
4404 int camera_attr_get_brightness_range(camera_h camera, int *min, int *max)
4406 if (camera == NULL || min == NULL || max == NULL) {
4407 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4408 return CAMERA_ERROR_INVALID_PARAMETER;
4410 int ret = CAMERA_ERROR_NONE;
4411 camera_cli_s *pc = (camera_cli_s *)camera;
4413 if (pc->cb_info == NULL) {
4414 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4415 return CAMERA_ERROR_INVALID_PARAMETER;
4417 sock_fd = pc->cb_info->fd;
4418 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_BRIGHTNESS_RANGE;
4422 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4423 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4425 if (ret == CAMERA_ERROR_NONE) {
4426 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
4427 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
4431 LOGD("ret : 0x%x", ret);
4436 int camera_attr_get_contrast(camera_h camera, int *level)
4438 if (camera == NULL || level == NULL) {
4439 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4440 return CAMERA_ERROR_INVALID_PARAMETER;
4442 int ret = CAMERA_ERROR_NONE;
4443 camera_cli_s *pc = (camera_cli_s *)camera;
4444 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_CONTRAST;
4446 if (pc->cb_info == NULL) {
4447 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4448 return CAMERA_ERROR_INVALID_PARAMETER;
4450 sock_fd = pc->cb_info->fd;
4453 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4454 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4456 if (ret == CAMERA_ERROR_NONE) {
4457 muse_camera_msg_get(get_level, pc->cb_info->recv_msg);
4460 LOGD("ret : 0x%x", ret);
4465 int camera_attr_get_contrast_range(camera_h camera, int *min , int *max)
4467 if (camera == NULL || min == NULL || max == NULL) {
4468 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4469 return CAMERA_ERROR_INVALID_PARAMETER;
4471 int ret = CAMERA_ERROR_NONE;
4472 camera_cli_s *pc = (camera_cli_s *)camera;
4473 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_CONTRAST_RANGE;
4475 if (pc->cb_info == NULL) {
4476 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4477 return CAMERA_ERROR_INVALID_PARAMETER;
4479 sock_fd = pc->cb_info->fd;
4483 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4484 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4486 if (ret == CAMERA_ERROR_NONE) {
4487 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
4488 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
4492 LOGD("ret : 0x%x", ret);
4497 int camera_attr_get_whitebalance(camera_h camera, camera_attr_whitebalance_e *wb)
4499 if (camera == NULL || wb == NULL) {
4500 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4501 return CAMERA_ERROR_INVALID_PARAMETER;
4503 int ret = CAMERA_ERROR_NONE;
4504 camera_cli_s *pc = (camera_cli_s *)camera;
4505 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_WHITEBALANCE;
4507 if (pc->cb_info == NULL) {
4508 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4509 return CAMERA_ERROR_INVALID_PARAMETER;
4511 sock_fd = pc->cb_info->fd;
4514 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4515 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4517 if (ret == CAMERA_ERROR_NONE) {
4518 muse_camera_msg_get(get_wb, pc->cb_info->recv_msg);
4519 *wb = (camera_attr_whitebalance_e)get_wb;
4521 LOGD("ret : 0x%x", ret);
4526 int camera_attr_get_effect(camera_h camera, camera_attr_effect_mode_e *effect)
4528 if (camera == NULL || effect == NULL) {
4529 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4530 return CAMERA_ERROR_INVALID_PARAMETER;
4533 int ret = CAMERA_ERROR_NONE;
4534 camera_cli_s *pc = (camera_cli_s *)camera;
4535 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EFFECT;
4537 if (pc->cb_info == NULL) {
4538 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4539 return CAMERA_ERROR_INVALID_PARAMETER;
4541 sock_fd = pc->cb_info->fd;
4544 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4545 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4547 if (ret == CAMERA_ERROR_NONE) {
4548 muse_camera_msg_get(get_effect, pc->cb_info->recv_msg);
4549 *effect = (camera_attr_effect_mode_e)get_effect;
4551 LOGD("ret : 0x%x", ret);
4556 int camera_attr_get_scene_mode(camera_h camera, camera_attr_scene_mode_e *mode)
4558 if (camera == NULL || mode == NULL) {
4559 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4560 return CAMERA_ERROR_INVALID_PARAMETER;
4563 int ret = CAMERA_ERROR_NONE;
4564 camera_cli_s *pc = (camera_cli_s *)camera;
4565 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_SCENE_MODE;
4567 if (pc->cb_info == NULL) {
4568 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4569 return CAMERA_ERROR_INVALID_PARAMETER;
4571 sock_fd = pc->cb_info->fd;
4574 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4575 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4577 if (ret == CAMERA_ERROR_NONE) {
4578 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
4579 *mode = (camera_attr_scene_mode_e)get_mode;
4581 LOGD("ret : 0x%x", ret);
4586 int camera_attr_is_enabled_tag(camera_h camera, bool *enable)
4588 if (camera == NULL || enable == NULL) {
4589 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4590 return CAMERA_ERROR_INVALID_PARAMETER;
4593 int ret = CAMERA_ERROR_NONE;
4594 camera_cli_s *pc = (camera_cli_s *)camera;
4595 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_TAG;
4597 if (pc->cb_info == NULL) {
4598 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4599 return CAMERA_ERROR_INVALID_PARAMETER;
4601 sock_fd = pc->cb_info->fd;
4604 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4605 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4607 if (ret == CAMERA_ERROR_NONE) {
4608 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
4609 *enable = (bool)get_enabled;
4611 LOGD("ret : 0x%x", ret);
4616 int camera_attr_get_tag_image_description(camera_h camera, char **description)
4618 if (camera == NULL || description == NULL) {
4619 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4620 return CAMERA_ERROR_INVALID_PARAMETER;
4623 int ret = CAMERA_ERROR_NONE;
4624 camera_cli_s *pc = (camera_cli_s *)camera;
4625 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_IMAGE_DESCRIPTION;
4627 if (pc->cb_info == NULL) {
4628 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4629 return CAMERA_ERROR_INVALID_PARAMETER;
4631 sock_fd = pc->cb_info->fd;
4632 char get_description[MUSE_CAMERA_MSG_MAX_LENGTH] = {0,};
4634 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4635 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4637 if (ret == CAMERA_ERROR_NONE) {
4638 muse_camera_msg_get_string(get_description, pc->cb_info->recv_msg);
4639 *description = strdup(get_description);
4641 LOGD("ret : 0x%x", ret);
4646 int camera_attr_get_tag_orientation(camera_h camera, camera_attr_tag_orientation_e *orientation)
4648 if (camera == NULL || orientation == NULL) {
4649 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4650 return CAMERA_ERROR_INVALID_PARAMETER;
4653 int ret = CAMERA_ERROR_NONE;
4654 camera_cli_s *pc = (camera_cli_s *)camera;
4655 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_ORIENTATION;
4657 if (pc->cb_info == NULL) {
4658 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4659 return CAMERA_ERROR_INVALID_PARAMETER;
4661 sock_fd = pc->cb_info->fd;
4662 int get_orientation;
4664 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4665 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4667 if (ret == CAMERA_ERROR_NONE) {
4668 muse_camera_msg_get(get_orientation, pc->cb_info->recv_msg);
4669 *orientation = (camera_attr_tag_orientation_e)get_orientation;
4670 LOGD("success, orientation : %d", *orientation);
4672 LOGD("ret : 0x%x", ret);
4677 int camera_attr_get_tag_software(camera_h camera, char **software)
4679 if (camera == NULL || software == NULL) {
4680 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4681 return CAMERA_ERROR_INVALID_PARAMETER;
4684 int ret = CAMERA_ERROR_NONE;
4685 camera_cli_s *pc = (camera_cli_s *)camera;
4686 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_SOFTWARE;
4688 if (pc->cb_info == NULL) {
4689 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4690 return CAMERA_ERROR_INVALID_PARAMETER;
4692 sock_fd = pc->cb_info->fd;
4693 char get_software[MUSE_CAMERA_MSG_MAX_LENGTH] = {0,};
4695 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4696 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4698 if (ret == CAMERA_ERROR_NONE) {
4699 muse_camera_msg_get_string(get_software, pc->cb_info->recv_msg);
4700 *software = strdup(get_software);
4702 LOGD("ret : 0x%x", ret);
4707 int camera_attr_get_geotag(camera_h camera, double *latitude , double *longitude, double *altitude)
4709 if (camera == NULL || latitude == NULL || longitude == NULL || altitude == NULL) {
4710 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4711 return CAMERA_ERROR_INVALID_PARAMETER;
4714 int ret = CAMERA_ERROR_NONE;
4715 camera_cli_s *pc = (camera_cli_s *)camera;
4716 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_GEOTAG;
4717 double get_geotag[3] = {0,};
4719 if (pc->cb_info == NULL) {
4720 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4721 return CAMERA_ERROR_INVALID_PARAMETER;
4723 sock_fd = pc->cb_info->fd;
4725 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4727 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4729 if (ret == CAMERA_ERROR_NONE) {
4730 muse_camera_msg_get_array(get_geotag, pc->cb_info->recv_msg);
4731 *latitude = get_geotag[0];
4732 *longitude = get_geotag[1];
4733 *altitude = get_geotag[2];
4735 LOGD("ret : 0x%x", ret);
4737 LOGE("Returned value is not valid : 0x%x", ret);
4744 int camera_attr_get_flash_mode(camera_h camera, camera_attr_flash_mode_e *mode)
4746 if (camera == NULL || mode == NULL) {
4747 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4748 return CAMERA_ERROR_INVALID_PARAMETER;
4751 int ret = CAMERA_ERROR_NONE;
4752 camera_cli_s *pc = (camera_cli_s *)camera;
4753 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_FLASH_MODE;
4755 if (pc->cb_info == NULL) {
4756 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4757 return CAMERA_ERROR_INVALID_PARAMETER;
4759 sock_fd = pc->cb_info->fd;
4762 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4763 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4765 if (ret == CAMERA_ERROR_NONE) {
4766 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
4767 *mode = (camera_attr_flash_mode_e)get_mode;
4769 LOGD("ret : 0x%x", ret);
4773 int camera_get_flash_state(camera_device_e device, camera_flash_state_e *state)
4777 int ret = CAMERA_ERROR_NONE;
4778 camera_cli_s *pc = NULL;
4779 int get_flash_state = 0;
4781 /* create muse connection */
4782 muse_camera_api_e api = MUSE_CAMERA_API_GET_FLASH_STATE;
4783 muse_core_api_module_e muse_module = MUSE_CAMERA;
4784 int device_type = (int)device;
4786 sock_fd = muse_core_client_new();
4788 LOGE("muse_core_client_new failed - returned fd %d", sock_fd);
4789 ret = CAMERA_ERROR_INVALID_OPERATION;
4793 sndMsg = muse_core_msg_json_factory_new(api,
4794 MUSE_TYPE_INT, "module", muse_module,
4795 MUSE_TYPE_INT, PARAM_DEVICE_TYPE, device_type,
4798 muse_core_ipc_send_msg(sock_fd, sndMsg);
4799 muse_core_msg_json_factory_free(sndMsg);
4801 pc = g_new0(camera_cli_s, 1);
4803 LOGE("camera_cli_s alloc failed");
4804 ret = CAMERA_ERROR_OUT_OF_MEMORY;
4808 pc->cb_info = _client_callback_new(sock_fd);
4809 if (pc->cb_info == NULL) {
4810 LOGE("cb_info alloc failed");
4811 ret = CAMERA_ERROR_OUT_OF_MEMORY;
4815 ret = _client_wait_for_cb_return(api, pc->cb_info, CALLBACK_TIME_OUT);
4817 if (ret == CAMERA_ERROR_NONE) {
4818 muse_camera_msg_get(get_flash_state, pc->cb_info->recv_msg);
4819 *state = (camera_flash_state_e)get_flash_state;
4822 LOGD("Flash state : %d\n", *state);
4825 /* release resources */
4827 g_atomic_int_set(&pc->cb_info->msg_recv_running, 0);
4828 g_atomic_int_set(&pc->cb_info->msg_handler_running, 0);
4829 _client_callback_destroy(pc->cb_info);
4838 int camera_attr_foreach_supported_af_mode(camera_h camera, camera_attr_supported_af_mode_cb foreach_cb, void *user_data)
4840 if (camera == NULL || foreach_cb == NULL) {
4841 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4842 return CAMERA_ERROR_INVALID_PARAMETER;
4844 int ret = CAMERA_ERROR_NONE;
4846 camera_cli_s *pc = (camera_cli_s *)camera;
4847 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_AF_MODE;
4849 LOGD("Enter, handle :%x", pc->remote_handle);
4852 if (pc->cb_info == NULL) {
4853 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4854 return CAMERA_ERROR_INVALID_PARAMETER;
4856 sock_fd = pc->cb_info->fd;
4857 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_AF_MODE] = foreach_cb;
4858 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_AF_MODE] = user_data;
4860 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4861 LOGD("ret : 0x%x", ret);
4866 int camera_attr_foreach_supported_exposure_mode(camera_h camera, camera_attr_supported_exposure_mode_cb foreach_cb , void *user_data)
4868 if (camera == NULL || foreach_cb == NULL) {
4869 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4870 return CAMERA_ERROR_INVALID_PARAMETER;
4872 int ret = CAMERA_ERROR_NONE;
4874 camera_cli_s *pc = (camera_cli_s *)camera;
4875 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_EXPOSURE_MODE;
4877 LOGD("Enter, handle :%x", pc->remote_handle);
4880 if (pc->cb_info == NULL) {
4881 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4882 return CAMERA_ERROR_INVALID_PARAMETER;
4884 sock_fd = pc->cb_info->fd;
4885 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EXPOSURE_MODE] = foreach_cb;
4886 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EXPOSURE_MODE] = user_data;
4888 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4889 LOGD("ret : 0x%x", ret);
4894 int camera_attr_foreach_supported_iso(camera_h camera, camera_attr_supported_iso_cb foreach_cb, void *user_data)
4896 if (camera == NULL || foreach_cb == NULL) {
4897 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4898 return CAMERA_ERROR_INVALID_PARAMETER;
4900 int ret = CAMERA_ERROR_NONE;
4902 camera_cli_s *pc = (camera_cli_s *)camera;
4903 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_ISO;
4905 LOGD("Enter, handle :%x", pc->remote_handle);
4908 if (pc->cb_info == NULL) {
4909 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4910 return CAMERA_ERROR_INVALID_PARAMETER;
4912 sock_fd = pc->cb_info->fd;
4913 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_ISO] = foreach_cb;
4914 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_ISO] = user_data;
4916 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4917 LOGD("ret : 0x%x", ret);
4922 int camera_attr_foreach_supported_whitebalance(camera_h camera, camera_attr_supported_whitebalance_cb foreach_cb , void *user_data)
4924 if (camera == NULL || foreach_cb == NULL) {
4925 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4926 return CAMERA_ERROR_INVALID_PARAMETER;
4928 int ret = CAMERA_ERROR_NONE;
4930 camera_cli_s *pc = (camera_cli_s *)camera;
4931 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_WHITEBALANCE;
4933 LOGD("Enter, handle :%x", pc->remote_handle);
4936 if (pc->cb_info == NULL) {
4937 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4938 return CAMERA_ERROR_INVALID_PARAMETER;
4940 sock_fd = pc->cb_info->fd;
4941 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_WHITEBALANCE] = foreach_cb;
4942 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_WHITEBALANCE] = user_data;
4944 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4945 LOGD("ret : 0x%x", ret);
4950 int camera_attr_foreach_supported_effect(camera_h camera, camera_attr_supported_effect_cb foreach_cb , void *user_data)
4952 if (camera == NULL || foreach_cb == NULL) {
4953 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4954 return CAMERA_ERROR_INVALID_PARAMETER;
4956 int ret = CAMERA_ERROR_NONE;
4958 camera_cli_s *pc = (camera_cli_s *)camera;
4959 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_EFFECT;
4961 LOGD("Enter, handle :%x", pc->remote_handle);
4964 if (pc->cb_info == NULL) {
4965 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4966 return CAMERA_ERROR_INVALID_PARAMETER;
4968 sock_fd = pc->cb_info->fd;
4969 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EFFECT] = foreach_cb;
4970 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EFFECT] = user_data;
4972 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4973 LOGD("ret : 0x%x", ret);
4978 int camera_attr_foreach_supported_scene_mode(camera_h camera, camera_attr_supported_scene_mode_cb foreach_cb , void *user_data)
4980 if (camera == NULL || foreach_cb == NULL) {
4981 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4982 return CAMERA_ERROR_INVALID_PARAMETER;
4984 int ret = CAMERA_ERROR_NONE;
4986 camera_cli_s *pc = (camera_cli_s *)camera;
4987 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_SCENE_MODE;
4989 LOGD("Enter, handle :%x", pc->remote_handle);
4992 if (pc->cb_info == NULL) {
4993 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4994 return CAMERA_ERROR_INVALID_PARAMETER;
4996 sock_fd = pc->cb_info->fd;
4997 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_SCENE_MODE] = foreach_cb;
4998 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_SCENE_MODE] = user_data;
5000 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5001 LOGD("ret : 0x%x", ret);
5006 int camera_attr_foreach_supported_flash_mode(camera_h camera, camera_attr_supported_flash_mode_cb foreach_cb , void *user_data)
5008 if (camera == NULL || foreach_cb == NULL) {
5009 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5010 return CAMERA_ERROR_INVALID_PARAMETER;
5012 int ret = CAMERA_ERROR_NONE;
5014 camera_cli_s *pc = (camera_cli_s *)camera;
5015 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FLASH_MODE;
5017 LOGD("Enter, handle :%x", pc->remote_handle);
5020 if (pc->cb_info == NULL) {
5021 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5022 return CAMERA_ERROR_INVALID_PARAMETER;
5024 sock_fd = pc->cb_info->fd;
5025 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FLASH_MODE] = foreach_cb;
5026 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FLASH_MODE] = user_data;
5028 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5029 LOGD("ret : 0x%x", ret);
5034 int camera_attr_foreach_supported_fps(camera_h camera, camera_attr_supported_fps_cb foreach_cb , void *user_data)
5036 if (camera == NULL || foreach_cb == NULL) {
5037 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5038 return CAMERA_ERROR_INVALID_PARAMETER;
5040 int ret = CAMERA_ERROR_NONE;
5042 camera_cli_s *pc = (camera_cli_s *)camera;
5043 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FPS;
5045 if (pc->cb_info == NULL) {
5046 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5047 return CAMERA_ERROR_INVALID_PARAMETER;
5049 sock_fd = pc->cb_info->fd;
5050 LOGD("Enter, handle :%x", pc->remote_handle);
5051 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS] = foreach_cb;
5052 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS] = user_data;
5054 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5055 LOGD("Enter, handle :%x", pc->remote_handle);
5059 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)
5061 if (camera == NULL || foreach_cb == NULL) {
5062 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5063 return CAMERA_ERROR_INVALID_PARAMETER;
5065 int ret = CAMERA_ERROR_NONE;
5067 camera_cli_s *pc = (camera_cli_s *)camera;
5068 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FPS_BY_RESOLUTION;
5070 if (pc->cb_info == NULL) {
5071 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5072 return CAMERA_ERROR_INVALID_PARAMETER;
5074 sock_fd = pc->cb_info->fd;
5075 LOGD("Enter, handle :%x", pc->remote_handle);
5076 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS_BY_RESOLUTION] = foreach_cb;
5077 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS_BY_RESOLUTION] = user_data;
5079 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, width, INT, height);
5080 LOGD("ret : 0x%x", ret);
5084 int camera_attr_foreach_supported_stream_flip(camera_h camera, camera_attr_supported_stream_flip_cb foreach_cb, void *user_data)
5086 if (camera == NULL || foreach_cb == NULL) {
5087 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5088 return CAMERA_ERROR_INVALID_PARAMETER;
5090 int ret = CAMERA_ERROR_NONE;
5092 camera_cli_s *pc = (camera_cli_s *)camera;
5093 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_STREAM_FLIP;
5095 if (pc->cb_info == NULL) {
5096 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5097 return CAMERA_ERROR_INVALID_PARAMETER;
5099 sock_fd = pc->cb_info->fd;
5100 LOGD("Enter, handle :%x", pc->remote_handle);
5101 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_FLIP] = foreach_cb;
5102 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_FLIP] = user_data;
5104 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5105 LOGD("ret : 0x%x", ret);
5110 int camera_attr_foreach_supported_stream_rotation(camera_h camera, camera_attr_supported_stream_rotation_cb foreach_cb, void *user_data)
5112 if (camera == NULL || foreach_cb == NULL) {
5113 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5114 return CAMERA_ERROR_INVALID_PARAMETER;
5116 int ret = CAMERA_ERROR_NONE;
5118 camera_cli_s *pc = (camera_cli_s *)camera;
5119 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_STREAM_ROTATION;
5121 if (pc->cb_info == NULL) {
5122 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5123 return CAMERA_ERROR_INVALID_PARAMETER;
5125 sock_fd = pc->cb_info->fd;
5126 LOGD("Enter, handle :%x", pc->remote_handle);
5127 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION] = foreach_cb;
5128 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION] = user_data;
5130 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5131 LOGD("ret : 0x%x", ret);
5136 int camera_attr_set_stream_rotation(camera_h camera , camera_rotation_e rotation)
5138 if (camera == NULL) {
5139 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5140 return CAMERA_ERROR_INVALID_PARAMETER;
5143 int ret = CAMERA_ERROR_NONE;
5144 camera_cli_s *pc = (camera_cli_s *)camera;
5145 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_STREAM_ROTATION;
5147 if (pc->cb_info == NULL) {
5148 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5149 return CAMERA_ERROR_INVALID_PARAMETER;
5151 sock_fd = pc->cb_info->fd;
5152 int set_rotation = (int)rotation;
5154 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5155 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_rotation);
5156 LOGD("ret : 0x%x", ret);
5161 int camera_attr_get_stream_rotation(camera_h camera , camera_rotation_e *rotation)
5163 if (camera == NULL || rotation == NULL) {
5164 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5165 return CAMERA_ERROR_INVALID_PARAMETER;
5168 int ret = CAMERA_ERROR_NONE;
5169 camera_cli_s *pc = (camera_cli_s *)camera;
5170 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_STREAM_ROTATION;
5172 if (pc->cb_info == NULL) {
5173 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5174 return CAMERA_ERROR_INVALID_PARAMETER;
5176 sock_fd = pc->cb_info->fd;
5179 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5180 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5182 if (ret == CAMERA_ERROR_NONE) {
5183 muse_camera_msg_get(get_rotation, pc->cb_info->recv_msg);
5184 *rotation = (camera_rotation_e)get_rotation;
5186 LOGD("ret : 0x%x", ret);
5191 int camera_attr_set_stream_flip(camera_h camera , camera_flip_e flip)
5193 if (camera == NULL) {
5194 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5195 return CAMERA_ERROR_INVALID_PARAMETER;
5198 int ret = CAMERA_ERROR_NONE;
5199 camera_cli_s *pc = (camera_cli_s *)camera;
5200 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_STREAM_FLIP;
5202 if (pc->cb_info == NULL) {
5203 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5204 return CAMERA_ERROR_INVALID_PARAMETER;
5206 sock_fd = pc->cb_info->fd;
5207 int set_flip = (int)flip;
5209 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5210 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_flip);
5211 LOGD("ret : 0x%x", ret);
5216 int camera_attr_get_stream_flip(camera_h camera , camera_flip_e *flip)
5218 if (camera == NULL || flip == NULL) {
5219 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5220 return CAMERA_ERROR_INVALID_PARAMETER;
5223 int ret = CAMERA_ERROR_NONE;
5224 camera_cli_s *pc = (camera_cli_s *)camera;
5225 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_STREAM_FLIP;
5227 if (pc->cb_info == NULL) {
5228 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5229 return CAMERA_ERROR_INVALID_PARAMETER;
5231 sock_fd = pc->cb_info->fd;
5234 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5235 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5237 if (ret == CAMERA_ERROR_NONE) {
5238 muse_camera_msg_get(get_flip, pc->cb_info->recv_msg);
5239 *flip = (camera_flip_e)get_flip;
5241 LOGD("ret : 0x%x", ret);
5245 int camera_attr_set_hdr_mode(camera_h camera, camera_attr_hdr_mode_e mode)
5247 if (camera == NULL) {
5248 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5249 return CAMERA_ERROR_INVALID_PARAMETER;
5252 int ret = CAMERA_ERROR_NONE;
5253 camera_cli_s *pc = (camera_cli_s *)camera;
5254 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_HDR_MODE;
5256 if (pc->cb_info == NULL) {
5257 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5258 return CAMERA_ERROR_INVALID_PARAMETER;
5260 sock_fd = pc->cb_info->fd;
5261 int set_mode = (int)mode;
5263 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5264 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
5265 LOGD("ret : 0x%x", ret);
5270 int camera_attr_get_hdr_mode(camera_h camera, camera_attr_hdr_mode_e *mode)
5272 if (camera == NULL) {
5273 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5274 return CAMERA_ERROR_INVALID_PARAMETER;
5277 LOGE("CAMERA_ERROR_NOT_SUPPORTED(0x%08x) - mode", CAMERA_ERROR_NOT_SUPPORTED);
5278 return CAMERA_ERROR_NOT_SUPPORTED;
5280 int ret = CAMERA_ERROR_NONE;
5281 camera_cli_s *pc = (camera_cli_s *)camera;
5282 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_HDR_MODE;
5284 if (pc->cb_info == NULL) {
5285 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5286 return CAMERA_ERROR_INVALID_PARAMETER;
5288 sock_fd = pc->cb_info->fd;
5291 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5292 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5294 if (ret == CAMERA_ERROR_NONE) {
5295 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
5296 *mode = (camera_attr_hdr_mode_e)get_mode;
5298 LOGD("ret : 0x%x", ret);
5303 bool camera_attr_is_supported_hdr_capture(camera_h camera)
5305 if (camera == NULL) {
5306 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5310 int ret = CAMERA_ERROR_NONE;
5311 camera_cli_s *pc = (camera_cli_s *)camera;
5312 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_HDR_CAPTURE;
5314 if (pc->cb_info == NULL) {
5315 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5316 return CAMERA_ERROR_INVALID_PARAMETER;
5318 sock_fd = pc->cb_info->fd;
5319 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5320 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5321 LOGD("ret : 0x%x", ret);
5326 int camera_attr_set_hdr_capture_progress_cb(camera_h camera, camera_attr_hdr_progress_cb callback, void *user_data)
5328 if (camera == NULL) {
5329 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5330 return CAMERA_ERROR_INVALID_PARAMETER;
5332 if (callback == NULL) {
5333 LOGE("CAMERA_ERROR_NOT_SUPPORTED(0x%08x) - callback", CAMERA_ERROR_NOT_SUPPORTED);
5334 return CAMERA_ERROR_NOT_SUPPORTED;
5336 int ret = CAMERA_ERROR_NONE;
5338 camera_cli_s *pc = (camera_cli_s *)camera;
5339 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_HDR_CAPTURE_PROGRESS_CB;
5341 if (pc->cb_info == NULL) {
5342 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5343 return CAMERA_ERROR_INVALID_PARAMETER;
5345 sock_fd = pc->cb_info->fd;
5346 LOGD("Enter, handle :%x", pc->remote_handle);
5348 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = callback;
5349 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = user_data;
5351 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5352 LOGD("ret : 0x%x", ret);
5357 int camera_attr_unset_hdr_capture_progress_cb(camera_h camera)
5359 if (camera == NULL) {
5360 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5361 return CAMERA_ERROR_INVALID_PARAMETER;
5364 int ret = CAMERA_ERROR_NONE;
5366 camera_cli_s *pc = (camera_cli_s *)camera;
5367 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_UNSET_HDR_CAPTURE_PROGRESS_CB;
5369 if (pc->cb_info == NULL) {
5370 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5371 return CAMERA_ERROR_INVALID_PARAMETER;
5373 sock_fd = pc->cb_info->fd;
5374 LOGD("Enter, handle :%x", pc->remote_handle);
5376 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = (void *)NULL;
5377 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = (void *)NULL;
5379 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5380 LOGD("ret : 0x%x", ret);
5385 int camera_attr_enable_anti_shake(camera_h camera, bool enable)
5387 if (camera == NULL) {
5388 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5389 return CAMERA_ERROR_INVALID_PARAMETER;
5392 int ret = CAMERA_ERROR_NONE;
5393 camera_cli_s *pc = (camera_cli_s *)camera;
5394 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_ANTI_SHAKE;
5396 if (pc->cb_info == NULL) {
5397 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5398 return CAMERA_ERROR_INVALID_PARAMETER;
5400 sock_fd = pc->cb_info->fd;
5401 int set_enable = (int)enable;
5403 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5404 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
5405 LOGD("ret : 0x%x", ret);
5410 int camera_attr_is_enabled_anti_shake(camera_h camera , bool *enabled)
5412 if (camera == NULL) {
5413 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5414 return CAMERA_ERROR_INVALID_PARAMETER;
5416 if (enabled == NULL) {
5417 LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER);
5418 return CAMERA_ERROR_NOT_SUPPORTED;
5420 int ret = CAMERA_ERROR_NONE;
5421 camera_cli_s *pc = (camera_cli_s *)camera;
5422 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_ANTI_SHAKE;
5424 if (pc->cb_info == NULL) {
5425 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5426 return CAMERA_ERROR_INVALID_PARAMETER;
5428 sock_fd = pc->cb_info->fd;
5431 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5432 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5434 if (ret == CAMERA_ERROR_NONE) {
5435 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
5436 *enabled = (bool)get_enabled;
5438 LOGD("ret : 0x%x", ret);
5443 bool camera_attr_is_supported_anti_shake(camera_h camera)
5446 if (camera == NULL) {
5447 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5451 int ret = CAMERA_ERROR_NONE;
5452 camera_cli_s *pc = (camera_cli_s *)camera;
5453 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_ANTI_SHAKE;
5455 if (pc->cb_info == NULL) {
5456 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5457 return CAMERA_ERROR_INVALID_PARAMETER;
5459 sock_fd = pc->cb_info->fd;
5460 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5461 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5462 LOGD("ret : 0x%x", ret);
5467 int camera_attr_enable_video_stabilization(camera_h camera, bool enable)
5469 if (camera == NULL) {
5470 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5471 return CAMERA_ERROR_INVALID_PARAMETER;
5474 int ret = CAMERA_ERROR_NONE;
5475 camera_cli_s *pc = (camera_cli_s *)camera;
5476 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_VIDEO_STABILIZATION;
5478 if (pc->cb_info == NULL) {
5479 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5480 return CAMERA_ERROR_INVALID_PARAMETER;
5482 sock_fd = pc->cb_info->fd;
5483 int set_enable = (int)enable;
5485 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5486 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
5487 LOGD("ret : 0x%x", ret);
5492 int camera_attr_is_enabled_video_stabilization(camera_h camera, bool *enabled)
5494 if (camera == NULL) {
5495 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5496 return CAMERA_ERROR_INVALID_PARAMETER;
5498 if (enabled == NULL) {
5499 LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER);
5500 return CAMERA_ERROR_NOT_SUPPORTED;
5502 int ret = CAMERA_ERROR_NONE;
5503 camera_cli_s *pc = (camera_cli_s *)camera;
5504 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_VIDEO_STABILIZATION;
5506 if (pc->cb_info == NULL) {
5507 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5508 return CAMERA_ERROR_INVALID_PARAMETER;
5510 sock_fd = pc->cb_info->fd;
5513 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5514 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5516 if (ret == CAMERA_ERROR_NONE) {
5517 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
5518 *enabled = (bool)get_enabled;
5520 LOGD("ret : 0x%x", ret);
5525 bool camera_attr_is_supported_video_stabilization(camera_h camera)
5527 if (camera == NULL) {
5528 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5532 int ret = CAMERA_ERROR_NONE;
5533 camera_cli_s *pc = (camera_cli_s *)camera;
5534 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_VIDEO_STABILIZATION;
5536 if (pc->cb_info == NULL) {
5537 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5538 return CAMERA_ERROR_INVALID_PARAMETER;
5540 sock_fd = pc->cb_info->fd;
5541 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5542 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5543 LOGD("ret : 0x%x", ret);
5548 int camera_attr_enable_auto_contrast(camera_h camera, bool enable)
5550 if (camera == NULL) {
5551 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5552 return CAMERA_ERROR_INVALID_PARAMETER;
5555 int ret = CAMERA_ERROR_NONE;
5556 camera_cli_s *pc = (camera_cli_s *)camera;
5557 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_AUTO_CONTRAST;
5559 if (pc->cb_info == NULL) {
5560 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5561 return CAMERA_ERROR_INVALID_PARAMETER;
5563 sock_fd = pc->cb_info->fd;
5564 int set_enable = (int)enable;
5566 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5567 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
5568 LOGD("ret : 0x%x", ret);
5573 int camera_attr_is_enabled_auto_contrast(camera_h camera, bool *enabled)
5575 if (camera == NULL) {
5576 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5577 return CAMERA_ERROR_INVALID_PARAMETER;
5579 if (enabled == NULL) {
5580 LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER);
5581 return CAMERA_ERROR_INVALID_PARAMETER;
5583 int ret = CAMERA_ERROR_NONE;
5584 camera_cli_s *pc = (camera_cli_s *)camera;
5585 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_AUTO_CONTRAST;
5587 if (pc->cb_info == NULL) {
5588 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5589 return CAMERA_ERROR_INVALID_PARAMETER;
5591 sock_fd = pc->cb_info->fd;
5594 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5595 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5597 if (ret == CAMERA_ERROR_NONE) {
5598 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
5599 *enabled = (bool)get_enabled;
5601 LOGD("ret : 0x%x", ret);
5606 bool camera_attr_is_supported_auto_contrast(camera_h camera)
5608 if (camera == NULL) {
5609 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5613 int ret = CAMERA_ERROR_NONE;
5614 camera_cli_s *pc = (camera_cli_s *)camera;
5615 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_AUTO_CONTRAST;
5617 if (pc->cb_info == NULL) {
5618 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5619 return CAMERA_ERROR_INVALID_PARAMETER;
5621 sock_fd = pc->cb_info->fd;
5622 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5623 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5624 LOGD("ret : 0x%x", ret);
5629 int camera_attr_disable_shutter_sound(camera_h camera, bool disable)
5631 if (camera == NULL) {
5632 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5633 return CAMERA_ERROR_INVALID_PARAMETER;
5636 int ret = CAMERA_ERROR_NONE;
5637 camera_cli_s *pc = (camera_cli_s *)camera;
5638 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_DISABLE_SHUTTER_SOUND;
5640 if (pc->cb_info == NULL) {
5641 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5642 return CAMERA_ERROR_INVALID_PARAMETER;
5644 sock_fd = pc->cb_info->fd;
5645 int set_disable = (int)disable;
5647 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5648 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_disable);
5649 LOGD("ret : 0x%x", ret);