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 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 = (camera_idle_event_s *)malloc(sizeof(camera_idle_event_s));
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 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 (muse_camera_msg_get(api_class, parse_str[i]))
1531 LOGD("camera api_class[%d]", api_class);
1533 if (api_class == MUSE_CAMERA_API_CLASS_IMMEDIATE) {
1534 g_mutex_lock(&cb_info->api_mutex[api]);
1536 if (!muse_camera_msg_get(ret, parse_str[i])) {
1537 LOGE("failed to get camera ret");
1538 g_mutex_unlock(&cb_info->api_mutex[api]);
1542 cb_info->api_ret[api] = ret;
1543 cb_info->api_activating[api] = 1;
1545 if (api == MUSE_CAMERA_API_CREATE) {
1546 if (ret != CAMERA_ERROR_NONE) {
1547 g_atomic_int_set(&cb_info->msg_recv_running, 0);
1548 LOGE("camera create error 0x%x. close client cb handler", ret);
1550 } else if (api == MUSE_CAMERA_API_DESTROY) {
1551 if (ret == CAMERA_ERROR_NONE) {
1552 g_atomic_int_set(&cb_info->msg_recv_running, 0);
1553 LOGD("camera destroy done. close client cb handler");
1557 g_cond_signal(&cb_info->api_cond[api]);
1558 g_mutex_unlock(&cb_info->api_mutex[api]);
1559 } else if (api_class == MUSE_CAMERA_API_CLASS_THREAD_SUB || api == MUSE_CAMERA_CB_EVENT) {
1560 camera_message_s *cam_msg = g_new0(camera_message_s, 1);
1561 if (cam_msg == NULL) {
1562 LOGE("failed to alloc cam_msg");
1567 memcpy(cam_msg->recv_msg, parse_str[i], sizeof(cam_msg->recv_msg));
1569 LOGD("add camera message to queue : api %d", api);
1571 g_mutex_lock(&cb_info->msg_handler_mutex);
1572 g_queue_push_tail(cb_info->msg_queue, (gpointer)cam_msg);
1573 g_cond_signal(&cb_info->msg_handler_cond);
1574 g_mutex_unlock(&cb_info->msg_handler_mutex);
1576 LOGW("unknown camera api %d and api_class %d", api, api_class);
1582 LOGD("client cb exit");
1586 for (i = 0 ; i < CAMERA_PARSE_STRING_SIZE ; i++) {
1589 parse_str[i] = NULL;
1600 static camera_cb_info_s *_client_callback_new(gint sockfd)
1602 camera_cb_info_s *cb_info = NULL;
1603 gint *tmp_activating = NULL;
1604 gint *tmp_ret = NULL;
1607 g_return_val_if_fail(sockfd > 0, NULL);
1609 cb_info = g_new0(camera_cb_info_s, 1);
1610 if (cb_info == NULL) {
1611 LOGE("cb_info failed");
1615 g_mutex_init(&cb_info->msg_handler_mutex);
1616 g_cond_init(&cb_info->msg_handler_cond);
1617 g_mutex_init(&cb_info->idle_event_mutex);
1618 g_cond_init(&cb_info->idle_event_cond);
1620 for (i = 0 ; i < MUSE_CAMERA_API_MAX ; i++) {
1621 g_mutex_init(&cb_info->api_mutex[i]);
1622 g_cond_init(&cb_info->api_cond[i]);
1625 tmp_activating = g_new0(gint, MUSE_CAMERA_API_MAX);
1626 if (tmp_activating == NULL) {
1627 LOGE("tmp_activating failed");
1631 tmp_ret = g_new0(gint, MUSE_CAMERA_API_MAX);
1632 if (tmp_ret == NULL) {
1633 LOGE("tmp_ret failed");
1637 cb_info->msg_queue = g_queue_new();
1638 if (cb_info->msg_queue == NULL) {
1639 LOGE("msg_queue new failed");
1643 g_atomic_int_set(&cb_info->msg_handler_running, 1);
1644 cb_info->msg_handler_thread = g_thread_try_new("camera_msg_handler",
1645 _camera_msg_handler_func, (gpointer)cb_info, NULL);
1646 if (cb_info->msg_handler_thread == NULL) {
1647 LOGE("message handler thread creation failed");
1651 cb_info->fd = sockfd;
1652 cb_info->api_activating = tmp_activating;
1653 cb_info->api_ret = tmp_ret;
1655 g_atomic_int_set(&cb_info->msg_recv_running, 1);
1656 cb_info->msg_recv_thread = g_thread_try_new("camera_msg_recv",
1657 _camera_msg_recv_func, (gpointer)cb_info, NULL);
1658 if (cb_info->msg_recv_thread == NULL) {
1659 LOGE("message receive thread creation failed");
1667 if (cb_info->msg_handler_thread) {
1668 g_mutex_lock(&cb_info->msg_handler_mutex);
1669 g_atomic_int_set(&cb_info->msg_handler_running, 0);
1670 g_cond_signal(&cb_info->msg_handler_cond);
1671 g_mutex_unlock(&cb_info->msg_handler_mutex);
1673 g_thread_join(cb_info->msg_handler_thread);
1674 g_thread_unref(cb_info->msg_handler_thread);
1675 cb_info->msg_handler_thread = NULL;
1678 for (i = 0 ; i < MUSE_CAMERA_API_MAX ; i++) {
1679 g_mutex_clear(&cb_info->api_mutex[i]);
1680 g_cond_clear(&cb_info->api_cond[i]);
1683 g_mutex_clear(&cb_info->msg_handler_mutex);
1684 g_cond_clear(&cb_info->msg_handler_cond);
1685 g_mutex_clear(&cb_info->idle_event_mutex);
1686 g_cond_clear(&cb_info->idle_event_cond);
1688 if (cb_info->msg_queue) {
1689 g_queue_free(cb_info->msg_queue);
1690 cb_info->msg_queue = NULL;
1697 if (tmp_activating) {
1698 g_free(tmp_activating);
1699 tmp_activating = NULL;
1709 static void _client_callback_destroy(camera_cb_info_s *cb_info)
1713 g_return_if_fail(cb_info != NULL);
1715 LOGD("MSG receive thread[%p] destroy", cb_info->msg_recv_thread);
1717 g_thread_join(cb_info->msg_recv_thread);
1718 g_thread_unref(cb_info->msg_recv_thread);
1719 cb_info->msg_recv_thread = NULL;
1721 LOGD("msg thread removed");
1723 g_mutex_lock(&cb_info->msg_handler_mutex);
1724 g_atomic_int_set(&cb_info->msg_handler_running, 0);
1725 g_cond_signal(&cb_info->msg_handler_cond);
1726 g_mutex_unlock(&cb_info->msg_handler_mutex);
1728 g_thread_join(cb_info->msg_handler_thread);
1729 g_thread_unref(cb_info->msg_handler_thread);
1730 cb_info->msg_handler_thread = NULL;
1732 g_queue_free(cb_info->msg_queue);
1733 cb_info->msg_queue = NULL;
1735 for (i = 0 ; i < MUSE_CAMERA_API_MAX ; i++) {
1736 g_mutex_clear(&cb_info->api_mutex[i]);
1737 g_cond_clear(&cb_info->api_cond[i]);
1740 g_mutex_clear(&cb_info->msg_handler_mutex);
1741 g_cond_clear(&cb_info->msg_handler_cond);
1742 g_mutex_clear(&cb_info->idle_event_mutex);
1743 g_cond_clear(&cb_info->idle_event_cond);
1745 LOGD("event thread removed");
1747 if (cb_info->fd > -1) {
1748 muse_core_connection_close(cb_info->fd);
1752 if (cb_info->bufmgr) {
1753 tbm_bufmgr_deinit(cb_info->bufmgr);
1754 cb_info->bufmgr = NULL;
1756 if (cb_info->api_activating) {
1757 g_free(cb_info->api_activating);
1758 cb_info->api_activating = NULL;
1760 if (cb_info->api_ret) {
1761 g_free(cb_info->api_ret);
1762 cb_info->api_ret = NULL;
1764 if (cb_info->pkt_fmt) {
1765 media_format_unref(cb_info->pkt_fmt);
1766 cb_info->pkt_fmt = NULL;
1775 int camera_create(camera_device_e device, camera_h *camera)
1779 int ret = CAMERA_ERROR_NONE;
1781 camera_cli_s *pc = NULL;
1782 tbm_bufmgr bufmgr = NULL;
1784 muse_camera_api_e api = MUSE_CAMERA_API_CREATE;
1785 muse_core_api_module_e muse_module = MUSE_CAMERA;
1786 int device_type = (int)device;
1788 if (camera == NULL) {
1789 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
1790 return CAMERA_ERROR_INVALID_PARAMETER;
1793 bufmgr = tbm_bufmgr_init(-1);
1794 if (bufmgr == NULL) {
1795 LOGE("get tbm bufmgr failed");
1796 return CAMERA_ERROR_INVALID_OPERATION;
1799 sock_fd = muse_core_client_new();
1801 LOGE("muse_core_client_new failed - returned fd %d", sock_fd);
1802 ret = CAMERA_ERROR_INVALID_OPERATION;
1808 sndMsg = muse_core_msg_json_factory_new(api,
1809 MUSE_TYPE_INT, "module", muse_module,
1810 MUSE_TYPE_INT, PARAM_DEVICE_TYPE, device_type,
1811 MUSE_TYPE_INT, "pid", pid,
1814 muse_core_ipc_send_msg(sock_fd, sndMsg);
1815 muse_core_msg_json_factory_free(sndMsg);
1817 pc = g_new0(camera_cli_s, 1);
1819 LOGE("camera_cli_s alloc failed");
1820 ret = CAMERA_ERROR_OUT_OF_MEMORY;
1824 pc->cb_info = _client_callback_new(sock_fd);
1825 if (pc->cb_info == NULL) {
1826 LOGE("cb_info alloc failed");
1827 ret = CAMERA_ERROR_OUT_OF_MEMORY;
1831 LOGD("cb info : %d", pc->cb_info->fd);
1833 ret = _client_wait_for_cb_return(api, pc->cb_info, CALLBACK_TIME_OUT);
1834 if (ret == CAMERA_ERROR_NONE) {
1835 intptr_t handle = 0;
1836 muse_camera_msg_get_pointer(handle, pc->cb_info->recv_msg);
1838 LOGE("Receiving Handle Failed!!");
1839 ret = CAMERA_ERROR_INVALID_OPERATION;
1843 pc->remote_handle = handle;
1844 pc->cb_info->bufmgr = bufmgr;
1846 ret = camera_set_display((camera_h)pc, CAMERA_DISPLAY_TYPE_NONE, NULL);
1847 if (ret != CAMERA_ERROR_NONE) {
1848 LOGE("init display failed 0x%x", ret);
1852 LOGD("camera create 0x%x", pc->remote_handle);
1853 *camera = (camera_h)pc;
1861 tbm_bufmgr_deinit(bufmgr);
1865 _client_callback_destroy(pc->cb_info);
1871 LOGE("camera create error : 0x%x", ret);
1876 int camera_destroy(camera_h camera)
1878 if (camera == NULL) {
1879 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
1880 return CAMERA_ERROR_INVALID_PARAMETER;
1883 int ret = CAMERA_ERROR_NONE;
1884 muse_camera_api_e api = MUSE_CAMERA_API_DESTROY;
1885 camera_cli_s *pc = (camera_cli_s *)camera;
1890 if (pc->cb_info == NULL) {
1891 LOGE("cb_info NULL, INVALID_PARAMETER");
1892 return CAMERA_ERROR_INVALID_PARAMETER;
1895 sock_fd = pc->cb_info->fd;
1897 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
1898 if (ret == CAMERA_ERROR_NONE) {
1899 _camera_remove_idle_event_all(pc->cb_info);
1900 _client_callback_destroy(pc->cb_info);
1906 LOGE("camera destroy error : 0x%x", ret);
1912 int camera_start_preview(camera_h camera)
1914 int ret = CAMERA_ERROR_NONE;
1915 muse_camera_api_e api = MUSE_CAMERA_API_START_PREVIEW;
1916 camera_cli_s *pc = (camera_cli_s *)camera;
1919 if (camera == NULL) {
1920 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
1921 return CAMERA_ERROR_INVALID_PARAMETER;
1924 if (pc->cb_info == NULL) {
1925 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
1926 return CAMERA_ERROR_INVALID_PARAMETER;
1931 sock_fd = pc->cb_info->fd;
1933 muse_camera_msg_send_longtime(api, sock_fd, pc->cb_info, ret);
1935 if (ret != CAMERA_ERROR_NONE) {
1936 LOGE("start preview failed 0x%x", ret);
1940 LOGD("ret : 0x%x", ret);
1942 return CAMERA_ERROR_NONE;
1945 int camera_stop_preview(camera_h camera)
1947 int ret = CAMERA_ERROR_NONE;
1949 camera_cli_s *pc = NULL;
1950 muse_camera_api_e api = MUSE_CAMERA_API_STOP_PREVIEW;
1952 if (camera == NULL) {
1953 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
1954 return CAMERA_ERROR_INVALID_PARAMETER;
1957 pc = (camera_cli_s *)camera;
1959 if (pc->cb_info == NULL) {
1960 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
1961 return CAMERA_ERROR_INVALID_PARAMETER;
1964 sock_fd = pc->cb_info->fd;
1968 /* send stop preview message */
1969 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
1971 LOGD("ret : 0x%x", ret);
1976 int camera_start_capture(camera_h camera, camera_capturing_cb capturing_cb, camera_capture_completed_cb completed_cb, void *user_data)
1978 if (camera == NULL) {
1979 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
1980 return CAMERA_ERROR_INVALID_PARAMETER;
1982 int ret = CAMERA_ERROR_NONE;
1984 camera_cli_s *pc = (camera_cli_s *)camera;
1985 muse_camera_api_e api = MUSE_CAMERA_API_START_CAPTURE;
1987 int is_capturing_cb = 0;
1988 int is_completed_cb = 0;
1989 LOGD("Enter, handle :%x", pc->remote_handle);
1991 if (pc->cb_info == NULL) {
1992 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
1993 return CAMERA_ERROR_INVALID_PARAMETER;
1996 sock_fd = pc->cb_info->fd;
1998 if (capturing_cb != NULL) {
1999 is_capturing_cb = 1;
2000 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = capturing_cb;
2001 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = user_data;
2004 if (completed_cb != NULL) {
2005 is_completed_cb = 1;
2006 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = completed_cb;
2007 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = user_data;
2010 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, is_capturing_cb, INT, is_completed_cb);
2011 LOGD("is_capturing_cb :%d, is_completed_cb : %d", is_capturing_cb, is_completed_cb);
2012 LOGD("ret : 0x%x", ret);
2016 bool camera_is_supported_continuous_capture(camera_h camera)
2018 if (camera == NULL) {
2019 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2023 int ret = CAMERA_ERROR_NONE;
2024 camera_cli_s *pc = (camera_cli_s *)camera;
2025 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_CONTINUOUS_CAPTURE;
2028 if (pc->cb_info == NULL) {
2029 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2030 return CAMERA_ERROR_INVALID_PARAMETER;
2033 sock_fd = pc->cb_info->fd;
2035 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2036 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2037 LOGD("ret : 0x%x", ret);
2041 int camera_start_continuous_capture(camera_h camera, int count, int interval, camera_capturing_cb capturing_cb, camera_capture_completed_cb completed_cb , void *user_data)
2043 if (camera == NULL) {
2044 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2045 return CAMERA_ERROR_INVALID_PARAMETER;
2048 int ret = CAMERA_ERROR_NONE;
2050 camera_cli_s *pc = (camera_cli_s *)camera;
2051 muse_camera_api_e api = MUSE_CAMERA_API_START_CONTINUOUS_CAPTURE;
2053 LOGD("Enter, handle :%x", pc->remote_handle);
2056 if (pc->cb_info == NULL) {
2057 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2058 return CAMERA_ERROR_INVALID_PARAMETER;
2060 sock_fd = pc->cb_info->fd;
2062 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = capturing_cb;
2063 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = user_data;
2064 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = completed_cb;
2066 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, count, INT, interval);
2068 LOGD("ret : 0x%x", ret);
2073 int camera_stop_continuous_capture(camera_h camera)
2075 if (camera == NULL) {
2076 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2077 return CAMERA_ERROR_INVALID_PARAMETER;
2081 int ret = CAMERA_ERROR_NONE;
2083 camera_cli_s *pc = (camera_cli_s *)camera;
2084 muse_camera_api_e api = MUSE_CAMERA_API_STOP_CONTINUOUS_CAPTURE;
2085 LOGD("Enter, handle :%x", pc->remote_handle);
2087 if (pc->cb_info == NULL) {
2088 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2089 return CAMERA_ERROR_INVALID_PARAMETER;
2091 sock_fd = pc->cb_info->fd;
2092 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2093 LOGD("ret : 0x%x", ret);
2097 bool camera_is_supported_face_detection(camera_h camera)
2099 if (camera == NULL) {
2100 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2103 int ret = CAMERA_ERROR_NONE;
2105 camera_cli_s *pc = (camera_cli_s *)camera;
2106 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_FACE_DETECTION;
2108 if (pc->cb_info == NULL) {
2109 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2110 return CAMERA_ERROR_INVALID_PARAMETER;
2112 sock_fd = pc->cb_info->fd;
2114 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2115 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2116 LOGD("ret : 0x%x", ret);
2120 bool camera_is_supported_zero_shutter_lag(camera_h camera)
2122 if (camera == NULL) {
2123 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2126 int ret = CAMERA_ERROR_NONE;
2128 camera_cli_s *pc = (camera_cli_s *)camera;
2129 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_ZERO_SHUTTER_LAG;
2131 if (pc->cb_info == NULL) {
2132 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2133 return CAMERA_ERROR_INVALID_PARAMETER;
2135 sock_fd = pc->cb_info->fd;
2137 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2138 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2139 LOGD("ret : 0x%x", ret);
2143 bool camera_is_supported_media_packet_preview_cb(camera_h camera)
2145 if (camera == NULL) {
2146 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2150 int ret = CAMERA_ERROR_NONE;
2152 camera_cli_s *pc = (camera_cli_s *)camera;
2153 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_MEDIA_PACKET_PREVIEW_CB;
2155 if (pc->cb_info == NULL) {
2156 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2157 return CAMERA_ERROR_INVALID_PARAMETER;
2159 sock_fd = pc->cb_info->fd;
2161 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2162 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2163 LOGD("ret : 0x%x", ret);
2167 int camera_get_device_count(camera_h camera, int *device_count)
2169 if (camera == NULL || device_count == NULL) {
2170 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2171 return CAMERA_ERROR_INVALID_PARAMETER;
2173 int ret = CAMERA_ERROR_NONE;
2175 camera_cli_s *pc = (camera_cli_s *)camera;
2176 muse_camera_api_e api = MUSE_CAMERA_API_GET_DEVICE_COUNT;
2178 if (pc->cb_info == NULL) {
2179 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2180 return CAMERA_ERROR_INVALID_PARAMETER;
2182 sock_fd = pc->cb_info->fd;
2183 int get_device_count;
2185 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2186 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2188 if (ret == CAMERA_ERROR_NONE) {
2189 muse_camera_msg_get(get_device_count, pc->cb_info->recv_msg);
2190 *device_count = get_device_count;
2192 LOGD("ret : 0x%x", ret);
2196 int camera_start_face_detection(camera_h camera, camera_face_detected_cb callback, void *user_data)
2198 if (camera == NULL) {
2199 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2200 return CAMERA_ERROR_INVALID_PARAMETER;
2203 int ret = CAMERA_ERROR_NONE;
2205 camera_cli_s *pc = (camera_cli_s *)camera;
2206 muse_camera_api_e api = MUSE_CAMERA_API_START_FACE_DETECTION;
2208 LOGD("Enter, handle :%x", pc->remote_handle);
2210 if (pc->cb_info == NULL) {
2211 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2212 return CAMERA_ERROR_INVALID_PARAMETER;
2214 sock_fd = pc->cb_info->fd;
2215 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION] = callback;
2216 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION] = user_data;
2218 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2219 LOGD("ret : 0x%x", ret);
2223 int camera_stop_face_detection(camera_h camera)
2225 if (camera == NULL) {
2226 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2227 return CAMERA_ERROR_INVALID_PARAMETER;
2230 int ret = CAMERA_ERROR_NONE;
2232 camera_cli_s *pc = (camera_cli_s *)camera;
2233 muse_camera_api_e api = MUSE_CAMERA_API_STOP_FACE_DETECTION;
2234 LOGD("Enter, handle :%x", pc->remote_handle);
2236 if (pc->cb_info == NULL) {
2237 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2238 return CAMERA_ERROR_INVALID_PARAMETER;
2240 sock_fd = pc->cb_info->fd;
2241 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2242 LOGD("ret : 0x%x", ret);
2246 int camera_get_state(camera_h camera, camera_state_e * state)
2248 if (camera == NULL || state == NULL) {
2249 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2250 return CAMERA_ERROR_INVALID_PARAMETER;
2252 int ret = CAMERA_ERROR_NONE;
2254 camera_cli_s *pc = (camera_cli_s *)camera;
2255 muse_camera_api_e api = MUSE_CAMERA_API_GET_STATE;
2257 if (pc->cb_info == NULL) {
2258 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2259 return CAMERA_ERROR_INVALID_PARAMETER;
2261 sock_fd = pc->cb_info->fd;
2264 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2265 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2267 if (ret == CAMERA_ERROR_NONE) {
2268 muse_camera_msg_get(get_state, pc->cb_info->recv_msg);
2269 *state = (camera_state_e)get_state;
2271 LOGD("ret : 0x%x", ret);
2275 int camera_start_focusing(camera_h camera, bool continuous)
2277 if (camera == NULL) {
2278 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2279 return CAMERA_ERROR_INVALID_PARAMETER;
2282 int ret = CAMERA_ERROR_NONE;
2284 camera_cli_s *pc = (camera_cli_s *)camera;
2285 muse_camera_api_e api = MUSE_CAMERA_API_START_FOCUSING;
2287 if (pc->cb_info == NULL) {
2288 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2289 return CAMERA_ERROR_INVALID_PARAMETER;
2291 sock_fd = pc->cb_info->fd;
2292 int is_continuous = (int)continuous;
2294 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2295 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, is_continuous);
2296 LOGD("ret : 0x%x", ret);
2300 int camera_cancel_focusing(camera_h camera)
2302 if (camera == NULL) {
2303 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2304 return CAMERA_ERROR_INVALID_PARAMETER;
2307 int ret = CAMERA_ERROR_NONE;
2309 camera_cli_s *pc = (camera_cli_s *)camera;
2310 muse_camera_api_e api = MUSE_CAMERA_API_CANCEL_FOCUSING;
2312 if (pc->cb_info == NULL) {
2313 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2314 return CAMERA_ERROR_INVALID_PARAMETER;
2316 sock_fd = pc->cb_info->fd;
2318 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2319 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2320 LOGD("ret : 0x%x", ret);
2324 int camera_set_display(camera_h camera, camera_display_type_e type, camera_display_h display)
2326 int ret = CAMERA_ERROR_NONE;
2327 void *set_display_handle = NULL;
2328 Evas_Object *obj = NULL;
2329 const char *object_type = NULL;
2331 camera_wl_info_s *wl_info = NULL;
2332 #endif /* HAVE_WAYLAND */
2334 if (camera == NULL) {
2335 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2336 return CAMERA_ERROR_INVALID_PARAMETER;
2339 if (type < CAMERA_DISPLAY_TYPE_OVERLAY || type > CAMERA_DISPLAY_TYPE_NONE) {
2340 LOGE("invalid type %d", type);
2341 return CAMERA_ERROR_INVALID_PARAMETER;
2344 if (type != CAMERA_DISPLAY_TYPE_NONE && display == NULL) {
2345 LOGE("display type[%d] is not NONE, but display handle is NULL", type);
2346 return CAMERA_ERROR_INVALID_PARAMETER;
2349 camera_cli_s *pc = (camera_cli_s *)camera;
2350 muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY;
2352 if (pc->cb_info == NULL) {
2353 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2354 return CAMERA_ERROR_INVALID_PARAMETER;
2356 sock_fd = pc->cb_info->fd;
2358 LOGD("Enter, remote_handle : %x display : 0x%x", pc->remote_handle, display);
2360 if (type == CAMERA_DISPLAY_TYPE_NONE) {
2361 set_display_handle = 0;
2362 LOGD("display type NONE");
2364 obj = (Evas_Object *)display;
2365 object_type = evas_object_type_get(obj);
2367 if (type == CAMERA_DISPLAY_TYPE_OVERLAY && !strcmp(object_type, "elm_win")) {
2369 /* get wayland parent id */
2370 if (_get_wl_info(obj, &pc->wl_info) != CAMERA_ERROR_NONE) {
2371 LOGE("failed to get wayland info");
2372 return CAMERA_ERROR_INVALID_OPERATION;
2375 set_display_handle = (void *)&pc->wl_info;
2376 #else /* HAVE_WAYLAND */
2377 /* x window overlay surface */
2378 set_display_handle = (void *)elm_win_xwindow_get(obj);
2379 #endif /* HAVE_WAYLAND */
2380 LOGD("display type OVERLAY : handle %p", set_display_handle);
2381 } else if (type == CAMERA_DISPLAY_TYPE_EVAS && !strcmp(object_type, "image")) {
2382 /* evas object surface */
2383 set_display_handle = (void *)display;
2384 LOGD("display type EVAS : handle %p", set_display_handle);
2386 LOGE("unknown evas object [%p,%s] or type [%d] mismatch", obj, object_type, type);
2387 return CAMERA_ERROR_INVALID_PARAMETER;
2390 LOGE("failed to get evas object type from %p", obj);
2391 return CAMERA_ERROR_INVALID_PARAMETER;
2395 pc->display_handle = (intptr_t)set_display_handle;
2397 if (type == CAMERA_DISPLAY_TYPE_OVERLAY) {
2399 wl_info = &pc->wl_info;
2400 muse_camera_msg_send_array_and_value(api, sock_fd, pc->cb_info, ret,
2401 wl_info, 5, sizeof(int), INT, type);
2403 LOGD("wayland parent id : %d, window %d,%d,%dx%d",
2404 wl_info->parent_id, wl_info->window_x, wl_info->window_y,
2405 wl_info->window_width, wl_info->window_height);
2406 #else /* HAVE_WAYLAND */
2407 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, type, INT, set_display_handle);
2409 LOGD("x id : %d", (int)set_display_handle);
2410 #endif /* HAVE_WAYLAND */
2412 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, type);
2414 if (ret != CAMERA_ERROR_NONE)
2415 LOGE("set display error 0x%x", ret);
2420 int camera_set_preview_resolution(camera_h camera, int width, int height)
2422 if (camera == NULL) {
2423 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2424 return CAMERA_ERROR_INVALID_PARAMETER;
2426 int ret = CAMERA_ERROR_NONE;
2428 camera_cli_s *pc = (camera_cli_s *)camera;
2429 muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_RESOLUTION;
2431 if (pc->cb_info == NULL) {
2432 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2433 return CAMERA_ERROR_INVALID_PARAMETER;
2435 sock_fd = pc->cb_info->fd;
2437 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2438 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, width, INT, height);
2439 LOGD("ret : 0x%x", ret);
2444 int camera_set_capture_resolution(camera_h camera, int width, int height)
2446 if (camera == NULL) {
2447 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2448 return CAMERA_ERROR_INVALID_PARAMETER;
2451 int ret = CAMERA_ERROR_NONE;
2453 camera_cli_s *pc = (camera_cli_s *)camera;
2454 muse_camera_api_e api = MUSE_CAMERA_API_SET_CAPTURE_RESOLUTION;
2456 if (pc->cb_info == NULL) {
2457 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2458 return CAMERA_ERROR_INVALID_PARAMETER;
2460 sock_fd = pc->cb_info->fd;
2462 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2463 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, width, INT, height);
2464 LOGD("ret : 0x%x", ret);
2468 int camera_set_capture_format(camera_h camera, camera_pixel_format_e format)
2470 if (camera == NULL) {
2471 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2472 return CAMERA_ERROR_INVALID_PARAMETER;
2475 int ret = CAMERA_ERROR_NONE;
2476 int set_format = (int)format;
2478 camera_cli_s *pc = (camera_cli_s *)camera;
2479 muse_camera_api_e api = MUSE_CAMERA_API_SET_CAPTURE_FORMAT;
2481 if (pc->cb_info == NULL) {
2482 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2483 return CAMERA_ERROR_INVALID_PARAMETER;
2485 sock_fd = pc->cb_info->fd;
2487 LOGD("Enter, remote_handle : %x, capture_format: %d", pc->remote_handle, set_format);
2488 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_format);
2489 LOGD("ret : 0x%x", ret);
2493 int camera_set_preview_format(camera_h camera, camera_pixel_format_e format)
2495 if (camera == NULL) {
2496 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2497 return CAMERA_ERROR_INVALID_PARAMETER;
2500 int ret = CAMERA_ERROR_NONE;
2501 int set_format = (int)format;
2503 camera_cli_s *pc = (camera_cli_s *)camera;
2504 muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_FORMAT;
2506 if (pc->cb_info == NULL) {
2507 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2508 return CAMERA_ERROR_INVALID_PARAMETER;
2510 sock_fd = pc->cb_info->fd;
2512 LOGD("Enter, remote_handle : %x, capture_format: %d", pc->remote_handle, set_format);
2513 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_format);
2514 LOGD("ret : 0x%x", ret);
2518 int camera_get_preview_resolution(camera_h camera, int *width, int *height)
2520 if (camera == NULL || width == NULL || height == NULL) {
2521 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2522 return CAMERA_ERROR_INVALID_PARAMETER;
2526 int ret = CAMERA_ERROR_NONE;
2528 camera_cli_s *pc = (camera_cli_s *)camera;
2529 muse_camera_api_e api = MUSE_CAMERA_API_GET_PREVIEW_RESOLUTION;
2531 if (pc->cb_info == NULL) {
2532 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2533 return CAMERA_ERROR_INVALID_PARAMETER;
2535 sock_fd = pc->cb_info->fd;
2539 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2540 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2542 if (ret == CAMERA_ERROR_NONE) {
2543 muse_camera_msg_get(get_width, pc->cb_info->recv_msg);
2544 muse_camera_msg_get(get_height, pc->cb_info->recv_msg);
2546 *height = get_height;
2548 LOGD("ret : 0x%x", ret);
2552 int camera_set_display_rotation(camera_h camera, camera_rotation_e rotation)
2554 int ret = CAMERA_ERROR_NONE;
2555 int set_rotation = (int)rotation;
2556 camera_cli_s *pc = NULL;
2558 if (camera == NULL) {
2559 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2560 return CAMERA_ERROR_INVALID_PARAMETER;
2563 if (rotation < CAMERA_ROTATION_NONE || rotation > CAMERA_ROTATION_270) {
2564 LOGE("Invalid rotation %d", rotation);
2565 return CAMERA_ERROR_INVALID_PARAMETER;
2568 pc = (camera_cli_s *)camera;
2570 if (pc->cb_info == NULL) {
2571 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2572 return CAMERA_ERROR_INVALID_PARAMETER;
2575 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_ROTATION,
2576 pc->cb_info->fd, pc->cb_info, ret, INT, set_rotation);
2581 int camera_get_display_rotation(camera_h camera, camera_rotation_e *rotation)
2583 int ret = CAMERA_ERROR_NONE;
2584 int get_rotation = CAMERA_ROTATION_NONE;
2585 camera_cli_s *pc = NULL;
2587 if (camera == NULL || rotation == NULL) {
2588 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2589 return CAMERA_ERROR_INVALID_PARAMETER;
2592 pc = (camera_cli_s *)camera;
2594 if (pc->cb_info == NULL) {
2595 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2596 return CAMERA_ERROR_INVALID_PARAMETER;
2599 muse_camera_msg_send(MUSE_CAMERA_API_GET_DISPLAY_ROTATION,
2600 pc->cb_info->fd, pc->cb_info, ret);
2602 if (ret == CAMERA_ERROR_NONE) {
2603 muse_camera_msg_get(get_rotation, pc->cb_info->recv_msg);
2604 *rotation = (camera_rotation_e)get_rotation;
2610 int camera_set_display_flip(camera_h camera, camera_flip_e flip)
2612 int ret = CAMERA_ERROR_NONE;
2613 int set_flip = (int)flip;
2614 camera_cli_s *pc = NULL;
2616 if (camera == NULL) {
2617 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2618 return CAMERA_ERROR_INVALID_PARAMETER;
2621 if (flip < CAMERA_FLIP_NONE || flip > CAMERA_FLIP_BOTH) {
2622 LOGE("Invalid flip %d", flip);
2623 return CAMERA_ERROR_INVALID_PARAMETER;
2626 pc = (camera_cli_s *)camera;
2628 if (pc->cb_info == NULL) {
2629 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2630 return CAMERA_ERROR_INVALID_PARAMETER;
2633 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_FLIP,
2634 pc->cb_info->fd, pc->cb_info, ret, INT, set_flip);
2639 int camera_get_display_flip(camera_h camera, camera_flip_e *flip)
2641 int ret = CAMERA_ERROR_NONE;
2642 int get_flip = CAMERA_FLIP_NONE;
2643 camera_cli_s *pc = NULL;
2645 if (camera == NULL || flip == NULL) {
2646 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2647 return CAMERA_ERROR_INVALID_PARAMETER;
2650 pc = (camera_cli_s *)camera;
2652 if (pc->cb_info == NULL) {
2653 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2654 return CAMERA_ERROR_INVALID_PARAMETER;
2657 muse_camera_msg_send(MUSE_CAMERA_API_GET_DISPLAY_FLIP,
2658 pc->cb_info->fd, pc->cb_info, ret);
2660 if (ret == CAMERA_ERROR_NONE) {
2661 muse_camera_msg_get(get_flip, pc->cb_info->recv_msg);
2662 *flip = (camera_flip_e)get_flip;
2668 int camera_set_display_visible(camera_h camera, bool visible)
2670 int ret = CAMERA_ERROR_NONE;
2671 int set_visible = (int)visible;
2672 camera_cli_s *pc = NULL;
2674 if (camera == NULL) {
2675 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2676 return CAMERA_ERROR_INVALID_PARAMETER;
2679 pc = (camera_cli_s *)camera;
2681 if (pc->cb_info == NULL) {
2682 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2683 return CAMERA_ERROR_INVALID_PARAMETER;
2686 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_VISIBLE,
2687 pc->cb_info->fd, pc->cb_info, ret, INT, set_visible);
2692 int camera_is_display_visible(camera_h camera, bool *visible)
2694 int ret = CAMERA_ERROR_NONE;
2695 int get_visible = true;
2696 camera_cli_s *pc = NULL;
2698 if (camera == NULL || visible == NULL) {
2699 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2700 return CAMERA_ERROR_INVALID_PARAMETER;
2703 pc = (camera_cli_s *)camera;
2705 if (pc->cb_info == NULL) {
2706 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2707 return CAMERA_ERROR_INVALID_PARAMETER;
2710 muse_camera_msg_send(MUSE_CAMERA_API_IS_DISPLAY_VISIBLE,
2711 pc->cb_info->fd, pc->cb_info, ret);
2713 if (ret == CAMERA_ERROR_NONE) {
2714 muse_camera_msg_get(get_visible, pc->cb_info->recv_msg);
2715 *visible = (bool)get_visible;
2721 int camera_set_display_mode(camera_h camera, camera_display_mode_e mode)
2723 int ret = CAMERA_ERROR_NONE;
2724 int set_mode = (int)mode;
2725 camera_cli_s *pc = NULL;
2727 if (camera == NULL) {
2728 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2729 return CAMERA_ERROR_INVALID_PARAMETER;
2732 if (mode < CAMERA_DISPLAY_MODE_LETTER_BOX || mode > CAMERA_DISPLAY_MODE_CROPPED_FULL) {
2733 LOGE("Invalid mode %d", mode);
2734 return CAMERA_ERROR_INVALID_PARAMETER;
2737 pc = (camera_cli_s *)camera;
2739 if (pc->cb_info == NULL) {
2740 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2741 return CAMERA_ERROR_INVALID_PARAMETER;
2744 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_MODE,
2745 pc->cb_info->fd, pc->cb_info, ret, INT, set_mode);
2750 int camera_get_display_mode(camera_h camera, camera_display_mode_e *mode)
2752 int ret = CAMERA_ERROR_NONE;
2753 int get_mode = CAMERA_DISPLAY_MODE_LETTER_BOX;
2754 camera_cli_s *pc = NULL;
2756 if (camera == NULL || mode == NULL) {
2757 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2758 return CAMERA_ERROR_INVALID_PARAMETER;
2761 pc = (camera_cli_s *)camera;
2763 if (pc->cb_info == NULL) {
2764 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2765 return CAMERA_ERROR_INVALID_PARAMETER;
2768 muse_camera_msg_send(MUSE_CAMERA_API_GET_DISPLAY_MODE,
2769 pc->cb_info->fd, pc->cb_info, ret);
2771 if (ret == CAMERA_ERROR_NONE) {
2772 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
2773 *mode = (camera_display_mode_e)get_mode;
2779 int camera_get_capture_resolution(camera_h camera, int *width, int *height)
2781 if (camera == NULL || width == NULL || height == NULL) {
2782 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2783 return CAMERA_ERROR_INVALID_PARAMETER;
2785 int ret = CAMERA_ERROR_NONE;
2787 camera_cli_s *pc = (camera_cli_s *)camera;
2788 muse_camera_api_e api = MUSE_CAMERA_API_GET_CAPTURE_RESOLUTION;
2790 if (pc->cb_info == NULL) {
2791 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2792 return CAMERA_ERROR_INVALID_PARAMETER;
2794 sock_fd = pc->cb_info->fd;
2798 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2799 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2801 if (ret == CAMERA_ERROR_NONE) {
2802 muse_camera_msg_get(get_width, pc->cb_info->recv_msg);
2803 muse_camera_msg_get(get_height, pc->cb_info->recv_msg);
2805 *height = get_height;
2807 LOGD("ret : 0x%x", ret);
2811 int camera_get_capture_format(camera_h camera, camera_pixel_format_e *format)
2813 if (camera == NULL || format == NULL) {
2814 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2815 return CAMERA_ERROR_INVALID_PARAMETER;
2817 int ret = CAMERA_ERROR_NONE;
2819 camera_cli_s *pc = (camera_cli_s *)camera;
2820 muse_camera_api_e api = MUSE_CAMERA_API_GET_CAPTURE_FORMAT;
2823 if (pc->cb_info == NULL) {
2824 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2825 return CAMERA_ERROR_INVALID_PARAMETER;
2827 sock_fd = pc->cb_info->fd;
2829 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2830 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2832 if (ret == CAMERA_ERROR_NONE) {
2833 muse_camera_msg_get(get_format, pc->cb_info->recv_msg);
2834 *format = (camera_pixel_format_e)get_format;
2836 LOGD("ret : 0x%x", ret);
2840 int camera_get_preview_format(camera_h camera, camera_pixel_format_e *format)
2842 if (camera == NULL || format == NULL) {
2843 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2844 return CAMERA_ERROR_INVALID_PARAMETER;
2847 int ret = CAMERA_ERROR_NONE;
2849 camera_cli_s *pc = (camera_cli_s *)camera;
2850 muse_camera_api_e api = MUSE_CAMERA_API_GET_PREVIEW_FORMAT;
2853 if (pc->cb_info == NULL) {
2854 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2855 return CAMERA_ERROR_INVALID_PARAMETER;
2857 sock_fd = pc->cb_info->fd;
2859 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2860 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2862 if (ret == CAMERA_ERROR_NONE) {
2863 muse_camera_msg_get(get_format, pc->cb_info->recv_msg);
2864 *format = (camera_pixel_format_e)get_format;
2866 LOGD("ret : 0x%x", ret);
2870 int camera_get_facing_direction(camera_h camera, camera_facing_direction_e *facing_direciton)
2872 if (camera == NULL || facing_direciton == NULL) {
2873 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2874 return CAMERA_ERROR_INVALID_PARAMETER;
2877 int ret = CAMERA_ERROR_NONE;
2879 camera_cli_s *pc = (camera_cli_s *)camera;
2880 muse_camera_api_e api = MUSE_CAMERA_API_GET_FACING_DIRECTION;
2882 if (pc->cb_info == NULL) {
2883 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2884 return CAMERA_ERROR_INVALID_PARAMETER;
2886 sock_fd = pc->cb_info->fd;
2887 int get_facing_direction;
2889 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2890 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2892 if (ret == CAMERA_ERROR_NONE) {
2893 muse_camera_msg_get(get_facing_direction, pc->cb_info->recv_msg);
2894 *facing_direciton = (camera_facing_direction_e)get_facing_direction;
2896 LOGD("ret : 0x%x", ret);
2900 int camera_set_preview_cb(camera_h camera, camera_preview_cb callback, void *user_data)
2902 if (camera == NULL || callback == NULL) {
2903 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2904 return CAMERA_ERROR_INVALID_PARAMETER;
2906 int ret = CAMERA_ERROR_NONE;
2908 camera_cli_s *pc = (camera_cli_s *)camera;
2910 if (pc->cb_info == NULL) {
2911 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2912 return CAMERA_ERROR_INVALID_PARAMETER;
2914 sock_fd = pc->cb_info->fd;
2915 muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_CB;
2917 LOGD("Enter, handle :%x", pc->remote_handle);
2919 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = callback;
2920 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = user_data;
2922 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2923 LOGD("ret : 0x%x", ret);
2927 int camera_unset_preview_cb(camera_h camera)
2929 if (camera == NULL) {
2930 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2931 return CAMERA_ERROR_INVALID_PARAMETER;
2934 int ret = CAMERA_ERROR_NONE;
2936 camera_cli_s *pc = (camera_cli_s *)camera;
2937 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_PREVIEW_CB;
2939 LOGD("Enter, handle :%x", pc->remote_handle);
2942 if (pc->cb_info == NULL) {
2943 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2944 return CAMERA_ERROR_INVALID_PARAMETER;
2946 sock_fd = pc->cb_info->fd;
2947 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = (void *)NULL;
2948 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = (void *)NULL;
2950 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2951 LOGD("ret : 0x%x", ret);
2955 int camera_set_media_packet_preview_cb(camera_h camera, camera_media_packet_preview_cb callback, void *user_data)
2957 if (camera == NULL) {
2958 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
2959 return CAMERA_ERROR_INVALID_PARAMETER;
2962 if (camera_is_supported_media_packet_preview_cb(camera) == false) {
2963 LOGE("NOT SUPPORTED");
2964 return CAMERA_ERROR_NOT_SUPPORTED;
2967 if (callback == NULL) {
2968 LOGE("INVALID_PARAMETER(0x%08x) - callback", CAMERA_ERROR_INVALID_PARAMETER);
2969 return CAMERA_ERROR_INVALID_PARAMETER;
2972 int ret = CAMERA_ERROR_NONE;
2974 camera_cli_s *pc = (camera_cli_s *)camera;
2975 muse_camera_api_e api = MUSE_CAMERA_API_SET_MEDIA_PACKET_PREVIEW_CB;
2977 LOGD("Enter, handle :%x", pc->remote_handle);
2980 if (pc->cb_info == NULL) {
2981 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2982 return CAMERA_ERROR_INVALID_PARAMETER;
2984 sock_fd = pc->cb_info->fd;
2985 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = callback;
2986 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = user_data;
2988 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2989 LOGD("ret : 0x%x", ret);
2993 int camera_unset_media_packet_preview_cb(camera_h camera)
2995 if (camera == NULL) {
2996 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2997 return CAMERA_ERROR_INVALID_PARAMETER;
3000 int ret = CAMERA_ERROR_NONE;
3002 camera_cli_s *pc = (camera_cli_s *)camera;
3003 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_MEDIA_PACKET_PREVIEW_CB;
3005 LOGD("Enter, handle :%x", pc->remote_handle);
3008 if (pc->cb_info == NULL) {
3009 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3010 return CAMERA_ERROR_INVALID_PARAMETER;
3012 sock_fd = pc->cb_info->fd;
3013 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = (void *)NULL;
3014 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = (void *)NULL;
3016 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3017 LOGD("ret : 0x%x", ret);
3021 int camera_set_state_changed_cb(camera_h camera, camera_state_changed_cb callback, void *user_data)
3023 if (camera == NULL || callback == NULL) {
3024 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3025 return CAMERA_ERROR_INVALID_PARAMETER;
3027 int ret = CAMERA_ERROR_NONE;
3029 camera_cli_s *pc = (camera_cli_s *)camera;
3030 muse_camera_api_e api = MUSE_CAMERA_API_SET_STATE_CHANGED_CB;
3032 LOGD("Enter, handle :%x", pc->remote_handle);
3035 if (pc->cb_info == NULL) {
3036 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3037 return CAMERA_ERROR_INVALID_PARAMETER;
3039 sock_fd = pc->cb_info->fd;
3040 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = callback;
3041 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = user_data;
3043 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3044 LOGD("ret : 0x%x", ret);
3047 int camera_unset_state_changed_cb(camera_h camera)
3049 if (camera == NULL) {
3050 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3051 return CAMERA_ERROR_INVALID_PARAMETER;
3053 int ret = CAMERA_ERROR_NONE;
3055 camera_cli_s *pc = (camera_cli_s *)camera;
3056 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_STATE_CHANGED_CB;
3058 LOGD("Enter, handle :%x", pc->remote_handle);
3061 if (pc->cb_info == NULL) {
3062 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3063 return CAMERA_ERROR_INVALID_PARAMETER;
3065 sock_fd = pc->cb_info->fd;
3066 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = (void *)NULL;
3067 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = (void *)NULL;
3069 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3070 LOGD("ret : 0x%x", ret);
3074 int camera_set_interrupted_cb(camera_h camera, camera_interrupted_cb callback, void *user_data)
3076 if (camera == NULL || callback == NULL) {
3077 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3078 return CAMERA_ERROR_INVALID_PARAMETER;
3080 int ret = CAMERA_ERROR_NONE;
3082 camera_cli_s *pc = (camera_cli_s *)camera;
3083 muse_camera_api_e api = MUSE_CAMERA_API_SET_INTERRUPTED_CB;
3085 LOGD("Enter, handle :%x", pc->remote_handle);
3088 if (pc->cb_info == NULL) {
3089 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3090 return CAMERA_ERROR_INVALID_PARAMETER;
3092 sock_fd = pc->cb_info->fd;
3093 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = callback;
3094 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = user_data;
3096 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3097 LOGD("ret : 0x%x", ret);
3101 int camera_unset_interrupted_cb(camera_h camera)
3103 if (camera == NULL) {
3104 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3105 return CAMERA_ERROR_INVALID_PARAMETER;
3107 int ret = CAMERA_ERROR_NONE;
3109 camera_cli_s *pc = (camera_cli_s *)camera;
3110 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_INTERRUPTED_CB;
3112 LOGD("Enter, handle :%x", pc->remote_handle);
3115 if (pc->cb_info == NULL) {
3116 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3117 return CAMERA_ERROR_INVALID_PARAMETER;
3119 sock_fd = pc->cb_info->fd;
3120 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = (void *)NULL;
3121 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = (void *)NULL;
3123 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3124 LOGD("ret : 0x%x", ret);
3128 int camera_set_focus_changed_cb(camera_h camera, camera_focus_changed_cb callback, void *user_data)
3130 if (camera == NULL || callback == NULL) {
3131 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3132 return CAMERA_ERROR_INVALID_PARAMETER;
3134 int ret = CAMERA_ERROR_NONE;
3136 camera_cli_s *pc = (camera_cli_s *)camera;
3137 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOCUS_CHANGED_CB;
3139 LOGD("Enter, handle :%x", pc->remote_handle);
3142 if (pc->cb_info == NULL) {
3143 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3144 return CAMERA_ERROR_INVALID_PARAMETER;
3146 sock_fd = pc->cb_info->fd;
3147 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = callback;
3148 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = user_data;
3150 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3151 LOGD("ret : 0x%x", ret);
3155 int camera_unset_focus_changed_cb(camera_h camera)
3157 if (camera == NULL) {
3158 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3159 return CAMERA_ERROR_INVALID_PARAMETER;
3161 int ret = CAMERA_ERROR_NONE;
3163 camera_cli_s *pc = (camera_cli_s *)camera;
3164 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_FOCUS_CHANGED_CB;
3166 LOGD("Enter, handle :%x", pc->remote_handle);
3169 if (pc->cb_info == NULL) {
3170 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3171 return CAMERA_ERROR_INVALID_PARAMETER;
3173 sock_fd = pc->cb_info->fd;
3174 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = (void *)NULL;
3175 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = (void *)NULL;
3177 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3178 LOGD("ret : 0x%x", ret);
3182 int camera_set_error_cb(camera_h camera, camera_error_cb callback, void *user_data)
3184 if (camera == NULL || callback == NULL) {
3185 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3186 return CAMERA_ERROR_INVALID_PARAMETER;
3188 int ret = CAMERA_ERROR_NONE;
3190 camera_cli_s *pc = (camera_cli_s *)camera;
3191 muse_camera_api_e api = MUSE_CAMERA_API_SET_ERROR_CB;
3193 LOGD("Enter, handle :%x", pc->remote_handle);
3196 if (pc->cb_info == NULL) {
3197 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3198 return CAMERA_ERROR_INVALID_PARAMETER;
3200 sock_fd = pc->cb_info->fd;
3201 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_ERROR] = callback;
3202 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_ERROR] = user_data;
3204 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3205 LOGD("ret : 0x%x", ret);
3209 int camera_unset_error_cb(camera_h camera)
3211 if (camera == NULL) {
3212 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3213 return CAMERA_ERROR_INVALID_PARAMETER;
3215 int ret = CAMERA_ERROR_NONE;
3217 camera_cli_s *pc = (camera_cli_s *)camera;
3218 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_ERROR_CB;
3220 LOGD("Enter, handle :%x", pc->remote_handle);
3223 if (pc->cb_info == NULL) {
3224 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3225 return CAMERA_ERROR_INVALID_PARAMETER;
3227 sock_fd = pc->cb_info->fd;
3228 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_ERROR] = (void *)NULL;
3229 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_ERROR] = (void *)NULL;
3231 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3232 LOGD("ret : 0x%x", ret);
3236 int camera_foreach_supported_preview_resolution(camera_h camera, camera_supported_preview_resolution_cb foreach_cb , void *user_data)
3238 if (camera == NULL || foreach_cb == NULL) {
3239 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3240 return CAMERA_ERROR_INVALID_PARAMETER;
3242 int ret = CAMERA_ERROR_NONE;
3244 camera_cli_s *pc = (camera_cli_s *)camera;
3245 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_PREVIEW_RESOLUTION;
3247 LOGD("Enter, handle :%x", pc->remote_handle);
3250 if (pc->cb_info == NULL) {
3251 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3252 return CAMERA_ERROR_INVALID_PARAMETER;
3254 sock_fd = pc->cb_info->fd;
3255 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_RESOLUTION] = foreach_cb;
3256 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_RESOLUTION] = user_data;
3258 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3259 LOGD("ret : 0x%x", ret);
3263 int camera_foreach_supported_capture_resolution(camera_h camera, camera_supported_capture_resolution_cb foreach_cb , void *user_data)
3265 if (camera == NULL || foreach_cb == NULL) {
3266 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3267 return CAMERA_ERROR_INVALID_PARAMETER;
3269 int ret = CAMERA_ERROR_NONE;
3271 camera_cli_s *pc = (camera_cli_s *)camera;
3272 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_CAPTURE_RESOLUTION;
3274 LOGD("Enter, handle :%x", pc->remote_handle);
3277 if (pc->cb_info == NULL) {
3278 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3279 return CAMERA_ERROR_INVALID_PARAMETER;
3281 sock_fd = pc->cb_info->fd;
3282 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_RESOLUTION] = foreach_cb;
3283 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_RESOLUTION] = user_data;
3285 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3286 LOGD("ret : 0x%x", ret);
3290 int camera_foreach_supported_capture_format(camera_h camera, camera_supported_capture_format_cb foreach_cb , void *user_data)
3292 if (camera == NULL || foreach_cb == NULL) {
3293 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3294 return CAMERA_ERROR_INVALID_PARAMETER;
3296 int ret = CAMERA_ERROR_NONE;
3298 camera_cli_s *pc = (camera_cli_s *)camera;
3299 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_CAPTURE_FORMAT;
3301 LOGD("Enter, handle :%x", pc->remote_handle);
3304 if (pc->cb_info == NULL) {
3305 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3306 return CAMERA_ERROR_INVALID_PARAMETER;
3308 sock_fd = pc->cb_info->fd;
3309 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_FORMAT] = foreach_cb;
3310 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_FORMAT] = user_data;
3312 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3313 LOGD("ret : 0x%x", ret);
3318 int camera_foreach_supported_preview_format(camera_h camera, camera_supported_preview_format_cb foreach_cb , void *user_data)
3320 if (camera == NULL || foreach_cb == NULL) {
3321 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3322 return CAMERA_ERROR_INVALID_PARAMETER;
3324 int ret = CAMERA_ERROR_NONE;
3326 camera_cli_s *pc = (camera_cli_s *)camera;
3327 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_PREVIEW_FORMAT;
3329 LOGD("Enter, handle :%x", pc->remote_handle);
3332 if (pc->cb_info == NULL) {
3333 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3334 return CAMERA_ERROR_INVALID_PARAMETER;
3336 sock_fd = pc->cb_info->fd;
3337 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_FORMAT] = foreach_cb;
3338 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_FORMAT] = user_data;
3340 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3341 LOGD("ret : 0x%x", ret);
3346 int camera_get_recommended_preview_resolution(camera_h camera, int *width, int *height)
3348 if (camera == NULL || width == NULL || height == NULL) {
3349 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3350 return CAMERA_ERROR_INVALID_PARAMETER;
3352 int ret = CAMERA_ERROR_NONE;
3354 camera_cli_s *pc = (camera_cli_s *)camera;
3355 muse_camera_api_e api = MUSE_CAMERA_API_GET_RECOMMENDED_PREVIEW_RESOLUTION;
3357 if (pc->cb_info == NULL) {
3358 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3359 return CAMERA_ERROR_INVALID_PARAMETER;
3361 sock_fd = pc->cb_info->fd;
3365 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3366 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3368 if (ret == CAMERA_ERROR_NONE) {
3369 muse_camera_msg_get(get_width, pc->cb_info->recv_msg);
3370 muse_camera_msg_get(get_height, pc->cb_info->recv_msg);
3372 *height = get_height;
3374 LOGD("ret : 0x%x", ret);
3379 int camera_attr_get_lens_orientation(camera_h camera, int *angle)
3381 if (camera == NULL || angle == NULL) {
3382 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3383 return CAMERA_ERROR_INVALID_PARAMETER;
3385 int ret = CAMERA_ERROR_NONE;
3387 camera_cli_s *pc = (camera_cli_s *)camera;
3388 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_LENS_ORIENTATION;
3390 if (pc->cb_info == NULL) {
3391 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3392 return CAMERA_ERROR_INVALID_PARAMETER;
3394 sock_fd = pc->cb_info->fd;
3397 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3398 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3400 if (ret == CAMERA_ERROR_NONE) {
3401 muse_camera_msg_get(get_angle, pc->cb_info->recv_msg);
3404 LOGD("ret : 0x%x", ret);
3408 int camera_attr_set_theater_mode(camera_h camera, camera_attr_theater_mode_e mode)
3410 if (camera == NULL) {
3411 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3412 return CAMERA_ERROR_INVALID_PARAMETER;
3414 int ret = CAMERA_ERROR_NONE;
3415 camera_cli_s *pc = (camera_cli_s *)camera;
3416 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_THEATER_MODE;
3418 if (pc->cb_info == NULL) {
3419 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3420 return CAMERA_ERROR_INVALID_PARAMETER;
3422 sock_fd = pc->cb_info->fd;
3423 int set_mode = (int)mode;
3424 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3425 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
3426 LOGD("ret : 0x%x", ret);
3430 int camera_attr_get_theater_mode(camera_h camera, camera_attr_theater_mode_e *mode)
3432 if (camera == NULL || mode == NULL) {
3433 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3434 return CAMERA_ERROR_INVALID_PARAMETER;
3437 int ret = CAMERA_ERROR_NONE;
3438 camera_cli_s *pc = (camera_cli_s *)camera;
3439 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_THEATER_MODE;
3441 if (pc->cb_info == NULL) {
3442 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3443 return CAMERA_ERROR_INVALID_PARAMETER;
3445 sock_fd = pc->cb_info->fd;
3447 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3448 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3450 if (ret == CAMERA_ERROR_NONE) {
3451 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
3452 *mode = (camera_attr_theater_mode_e)get_mode;
3454 LOGD("ret : 0x%x", ret);
3458 int camera_attr_foreach_supported_theater_mode(camera_h camera, camera_attr_supported_theater_mode_cb foreach_cb, void *user_data)
3460 if (camera == NULL || foreach_cb == NULL) {
3461 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3462 return CAMERA_ERROR_INVALID_PARAMETER;
3464 int ret = CAMERA_ERROR_NONE;
3466 camera_cli_s *pc = (camera_cli_s *)camera;
3467 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_THEATER_MODE;
3469 LOGD("Enter, handle :%x", pc->remote_handle);
3472 if (pc->cb_info == NULL) {
3473 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3474 return CAMERA_ERROR_INVALID_PARAMETER;
3476 sock_fd = pc->cb_info->fd;
3477 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE] = foreach_cb;
3478 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE] = user_data;
3480 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3482 LOGD("Finish, return :%x", ret);
3487 int camera_attr_set_preview_fps(camera_h camera, camera_attr_fps_e fps)
3489 if (camera == NULL) {
3490 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3491 return CAMERA_ERROR_INVALID_PARAMETER;
3493 int ret = CAMERA_ERROR_NONE;
3494 camera_cli_s *pc = (camera_cli_s *)camera;
3495 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_PREVIEW_FPS;
3497 if (pc->cb_info == NULL) {
3498 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3499 return CAMERA_ERROR_INVALID_PARAMETER;
3501 sock_fd = pc->cb_info->fd;
3502 int set_fps = (int)fps;
3503 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3504 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_fps);
3505 LOGD("ret : 0x%x", ret);
3510 int camera_attr_set_image_quality(camera_h camera, int quality)
3512 if (camera == NULL) {
3513 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3514 return CAMERA_ERROR_INVALID_PARAMETER;
3516 int ret = CAMERA_ERROR_NONE;
3518 camera_cli_s *pc = (camera_cli_s *)camera;
3519 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_IMAGE_QUALITY;
3521 if (pc->cb_info == NULL) {
3522 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3523 return CAMERA_ERROR_INVALID_PARAMETER;
3525 sock_fd = pc->cb_info->fd;
3526 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3527 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, quality);
3528 LOGD("ret : 0x%x", ret);
3532 int camera_attr_get_preview_fps(camera_h camera, camera_attr_fps_e *fps)
3534 if (camera == NULL || fps == NULL) {
3535 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3536 return CAMERA_ERROR_INVALID_PARAMETER;
3538 int ret = CAMERA_ERROR_NONE;
3540 camera_cli_s *pc = (camera_cli_s *)camera;
3541 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_PREVIEW_FPS;
3544 if (pc->cb_info == NULL) {
3545 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3546 return CAMERA_ERROR_INVALID_PARAMETER;
3548 sock_fd = pc->cb_info->fd;
3550 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3551 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3553 if (ret == CAMERA_ERROR_NONE) {
3554 muse_camera_msg_get(get_fps, pc->cb_info->recv_msg);
3555 *fps = (camera_attr_fps_e)get_fps;
3557 LOGD("ret : 0x%x", ret);
3562 int camera_attr_get_image_quality(camera_h camera, int *quality)
3564 if (camera == NULL || quality == NULL) {
3565 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3566 return CAMERA_ERROR_INVALID_PARAMETER;
3568 int ret = CAMERA_ERROR_NONE;
3570 camera_cli_s *pc = (camera_cli_s *)camera;
3571 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_IMAGE_QUALITY;
3573 if (pc->cb_info == NULL) {
3574 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3575 return CAMERA_ERROR_INVALID_PARAMETER;
3577 sock_fd = pc->cb_info->fd;
3579 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3580 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3582 if (ret == CAMERA_ERROR_NONE) {
3583 muse_camera_msg_get(get_quality, pc->cb_info->recv_msg);
3584 *quality = get_quality;
3586 LOGD("ret : 0x%x", ret);
3591 int camera_attr_get_encoded_preview_bitrate(camera_h camera, int *bitrate)
3593 if (camera == NULL || bitrate == NULL) {
3594 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3595 return CAMERA_ERROR_INVALID_PARAMETER;
3598 int ret = CAMERA_ERROR_NONE;
3600 camera_cli_s *pc = (camera_cli_s *)camera;
3601 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ENCODED_PREVIEW_BITRATE;
3603 if (pc->cb_info == NULL) {
3604 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3605 return CAMERA_ERROR_INVALID_PARAMETER;
3607 sock_fd = pc->cb_info->fd;
3610 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3611 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3613 if (ret == CAMERA_ERROR_NONE) {
3614 muse_camera_msg_get(get_bitrate, pc->cb_info->recv_msg);
3615 *bitrate = get_bitrate;
3617 LOGD("ret : 0x%x", ret);
3622 int camera_attr_set_encoded_preview_bitrate(camera_h camera, int bitrate)
3624 if (camera == NULL) {
3625 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3626 return CAMERA_ERROR_INVALID_PARAMETER;
3629 int ret = CAMERA_ERROR_NONE;
3631 camera_cli_s *pc = (camera_cli_s *)camera;
3632 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ENCODED_PREVIEW_BITRATE;
3634 if (pc->cb_info == NULL) {
3635 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3636 return CAMERA_ERROR_INVALID_PARAMETER;
3638 sock_fd = pc->cb_info->fd;
3639 int set_bitrate = bitrate;
3640 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3641 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_bitrate);
3642 LOGD("ret : 0x%x", ret);
3647 int camera_attr_get_encoded_preview_gop_interval(camera_h camera, int *interval)
3649 if (camera == NULL || interval == NULL) {
3650 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3651 return CAMERA_ERROR_INVALID_PARAMETER;
3654 int ret = CAMERA_ERROR_NONE;
3656 camera_cli_s *pc = (camera_cli_s *)camera;
3657 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ENCODED_PREVIEW_GOP_INTERVAL;
3659 if (pc->cb_info == NULL) {
3660 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3661 return CAMERA_ERROR_INVALID_PARAMETER;
3663 sock_fd = pc->cb_info->fd;
3664 int get_gop_interval;
3666 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3667 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3669 if (ret == CAMERA_ERROR_NONE) {
3670 muse_camera_msg_get(get_gop_interval, pc->cb_info->recv_msg);
3671 *interval = get_gop_interval;
3673 LOGD("ret : 0x%x", ret);
3678 int camera_attr_set_encoded_preview_gop_interval(camera_h camera, int interval)
3680 if (camera == NULL) {
3681 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3682 return CAMERA_ERROR_INVALID_PARAMETER;
3685 int ret = CAMERA_ERROR_NONE;
3687 camera_cli_s *pc = (camera_cli_s *)camera;
3688 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ENCODED_PREVIEW_GOP_INTERVAL;
3690 if (pc->cb_info == NULL) {
3691 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3692 return CAMERA_ERROR_INVALID_PARAMETER;
3694 sock_fd = pc->cb_info->fd;
3695 int set_gop_interval = interval;
3696 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3697 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_gop_interval);
3698 LOGD("ret : 0x%x", ret);
3703 int camera_attr_set_zoom(camera_h camera, int zoom)
3705 if (camera == NULL) {
3706 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3707 return CAMERA_ERROR_INVALID_PARAMETER;
3709 int ret = CAMERA_ERROR_NONE;
3711 camera_cli_s *pc = (camera_cli_s *)camera;
3712 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ZOOM;
3714 if (pc->cb_info == NULL) {
3715 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3716 return CAMERA_ERROR_INVALID_PARAMETER;
3718 sock_fd = pc->cb_info->fd;
3720 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3721 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, zoom);
3722 LOGD("ret : 0x%x", ret);
3726 int camera_attr_set_af_mode(camera_h camera, camera_attr_af_mode_e mode)
3728 if (camera == NULL) {
3729 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3730 return CAMERA_ERROR_INVALID_PARAMETER;
3732 int ret = CAMERA_ERROR_NONE;
3734 camera_cli_s *pc = (camera_cli_s *)camera;
3735 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_AF_MODE;
3737 if (pc->cb_info == NULL) {
3738 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3739 return CAMERA_ERROR_INVALID_PARAMETER;
3741 sock_fd = pc->cb_info->fd;
3742 int set_mode = (int)mode;
3743 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3744 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
3745 LOGD("ret : 0x%x", ret);
3749 int camera_attr_set_af_area(camera_h camera, int x, int y)
3751 if (camera == NULL) {
3752 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3753 return CAMERA_ERROR_INVALID_PARAMETER;
3755 int ret = CAMERA_ERROR_NONE;
3756 camera_cli_s *pc = (camera_cli_s *)camera;
3757 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_AF_AREA;
3758 int sock_fd = pc->cb_info->fd;
3759 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3760 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, x, INT, y);
3761 LOGD("ret : 0x%x", ret);
3766 int camera_attr_clear_af_area(camera_h camera)
3768 if (camera == NULL) {
3769 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3770 return CAMERA_ERROR_INVALID_PARAMETER;
3772 int ret = CAMERA_ERROR_NONE;
3774 camera_cli_s *pc = (camera_cli_s *)camera;
3775 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_CLEAR_AF_AREA;
3777 if (pc->cb_info == NULL) {
3778 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3779 return CAMERA_ERROR_INVALID_PARAMETER;
3781 sock_fd = pc->cb_info->fd;
3782 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3783 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3784 LOGD("ret : 0x%x", ret);
3789 int camera_attr_set_exposure_mode(camera_h camera, camera_attr_exposure_mode_e mode)
3791 if (camera == NULL) {
3792 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3793 return CAMERA_ERROR_INVALID_PARAMETER;
3796 if (mode < CAMERA_ATTR_EXPOSURE_MODE_OFF || mode > CAMERA_ATTR_EXPOSURE_MODE_CUSTOM) {
3797 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3798 return CAMERA_ERROR_INVALID_PARAMETER;
3801 int ret = CAMERA_ERROR_NONE;
3802 camera_cli_s *pc = (camera_cli_s *)camera;
3803 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EXPOSURE_MODE;
3804 int set_mode = (int)mode;
3806 if (pc->cb_info == NULL) {
3807 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3808 return CAMERA_ERROR_INVALID_PARAMETER;
3810 sock_fd = pc->cb_info->fd;
3811 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3812 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
3813 LOGD("ret : 0x%x", ret);
3818 int camera_attr_set_exposure(camera_h camera, int value)
3820 if (camera == NULL) {
3821 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3822 return CAMERA_ERROR_INVALID_PARAMETER;
3824 int ret = CAMERA_ERROR_NONE;
3826 camera_cli_s *pc = (camera_cli_s *)camera;
3827 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EXPOSURE;
3829 if (pc->cb_info == NULL) {
3830 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3831 return CAMERA_ERROR_INVALID_PARAMETER;
3833 sock_fd = pc->cb_info->fd;
3835 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3836 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, value);
3837 LOGD("ret : 0x%x", ret);
3842 int camera_attr_set_iso(camera_h camera, camera_attr_iso_e iso)
3844 if (camera == NULL) {
3845 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3846 return CAMERA_ERROR_INVALID_PARAMETER;
3848 int ret = CAMERA_ERROR_NONE;
3850 camera_cli_s *pc = (camera_cli_s *)camera;
3851 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ISO;
3853 if (pc->cb_info == NULL) {
3854 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3855 return CAMERA_ERROR_INVALID_PARAMETER;
3857 sock_fd = pc->cb_info->fd;
3858 int set_iso = (int)iso;
3859 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3860 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_iso);
3861 LOGD("ret : 0x%x", ret);
3866 int camera_attr_set_brightness(camera_h camera, int level)
3868 if (camera == NULL) {
3869 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3870 return CAMERA_ERROR_INVALID_PARAMETER;
3872 int ret = CAMERA_ERROR_NONE;
3874 camera_cli_s *pc = (camera_cli_s *)camera;
3875 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_BRIGHTNESS;
3877 if (pc->cb_info == NULL) {
3878 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3879 return CAMERA_ERROR_INVALID_PARAMETER;
3881 sock_fd = pc->cb_info->fd;
3883 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3884 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, level);
3885 LOGD("ret : 0x%x", ret);
3890 int camera_attr_set_contrast(camera_h camera, int level)
3892 if (camera == NULL) {
3893 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3894 return CAMERA_ERROR_INVALID_PARAMETER;
3896 int ret = CAMERA_ERROR_NONE;
3898 camera_cli_s *pc = (camera_cli_s *)camera;
3899 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_CONTRAST;
3901 if (pc->cb_info == NULL) {
3902 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3903 return CAMERA_ERROR_INVALID_PARAMETER;
3905 sock_fd = pc->cb_info->fd;
3907 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3908 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, level);
3909 LOGD("ret : 0x%x", ret);
3914 int camera_attr_set_whitebalance(camera_h camera, camera_attr_whitebalance_e wb)
3916 if (camera == NULL) {
3917 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3918 return CAMERA_ERROR_INVALID_PARAMETER;
3921 if (wb < CAMERA_ATTR_WHITE_BALANCE_NONE || wb > CAMERA_ATTR_WHITE_BALANCE_CUSTOM) {
3922 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_NOT_SUPPORTED);
3923 return CAMERA_ERROR_NOT_SUPPORTED;
3926 int ret = CAMERA_ERROR_NONE;
3928 camera_cli_s *pc = (camera_cli_s *)camera;
3929 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_WHITEBALANCE;
3931 if (pc->cb_info == NULL) {
3932 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3933 return CAMERA_ERROR_INVALID_PARAMETER;
3935 sock_fd = pc->cb_info->fd;
3936 int set_whitebalance = (int)wb;
3937 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3938 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_whitebalance);
3939 LOGD("ret : 0x%x", ret);
3944 int camera_attr_set_effect(camera_h camera, camera_attr_effect_mode_e effect)
3946 if (camera == NULL) {
3947 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3948 return CAMERA_ERROR_INVALID_PARAMETER;
3950 int ret = CAMERA_ERROR_NONE;
3952 camera_cli_s *pc = (camera_cli_s *)camera;
3953 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EFFECT;
3955 if (pc->cb_info == NULL) {
3956 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3957 return CAMERA_ERROR_INVALID_PARAMETER;
3959 sock_fd = pc->cb_info->fd;
3960 int set_effect = (int)effect;
3961 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3962 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_effect);
3963 LOGD("ret : 0x%x", ret);
3968 int camera_attr_set_scene_mode(camera_h camera, camera_attr_scene_mode_e mode)
3970 if (camera == NULL) {
3971 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3972 return CAMERA_ERROR_INVALID_PARAMETER;
3974 int ret = CAMERA_ERROR_NONE;
3976 camera_cli_s *pc = (camera_cli_s *)camera;
3977 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_SCENE_MODE;
3979 if (pc->cb_info == NULL) {
3980 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3981 return CAMERA_ERROR_INVALID_PARAMETER;
3983 sock_fd = pc->cb_info->fd;
3984 int set_mode = (int)mode;
3985 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3986 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
3987 LOGD("ret : 0x%x", ret);
3992 int camera_attr_enable_tag(camera_h camera, bool enable)
3994 if (camera == NULL) {
3995 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3996 return CAMERA_ERROR_INVALID_PARAMETER;
3998 int ret = CAMERA_ERROR_NONE;
3999 camera_cli_s *pc = (camera_cli_s *)camera;
4000 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_TAG;
4002 if (pc->cb_info == NULL) {
4003 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4004 return CAMERA_ERROR_INVALID_PARAMETER;
4006 sock_fd = pc->cb_info->fd;
4007 int set_enable = (int)enable;
4009 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4010 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
4011 LOGD("ret : 0x%x", ret);
4016 int camera_attr_set_tag_image_description(camera_h camera, const char *description)
4018 if (camera == NULL) {
4019 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4020 return CAMERA_ERROR_INVALID_PARAMETER;
4022 if (description == NULL) {
4023 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4024 return CAMERA_ERROR_INVALID_PARAMETER;
4026 int ret = CAMERA_ERROR_NONE;
4027 camera_cli_s *pc = (camera_cli_s *)camera;
4028 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_IMAGE_DESCRIPTION;
4030 if (pc->cb_info == NULL) {
4031 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4032 return CAMERA_ERROR_INVALID_PARAMETER;
4034 sock_fd = pc->cb_info->fd;
4035 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4036 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, STRING, description);
4037 LOGD("ret : 0x%x", ret);
4042 int camera_attr_set_tag_orientation(camera_h camera, camera_attr_tag_orientation_e orientation)
4044 if (camera == NULL) {
4045 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4046 return CAMERA_ERROR_INVALID_PARAMETER;
4048 int ret = CAMERA_ERROR_NONE;
4049 camera_cli_s *pc = (camera_cli_s *)camera;
4050 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_ORIENTATION;
4052 if (pc->cb_info == NULL) {
4053 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4054 return CAMERA_ERROR_INVALID_PARAMETER;
4056 sock_fd = pc->cb_info->fd;
4057 int set_orientation = (int)orientation;
4059 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4060 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_orientation);
4061 LOGD("ret : 0x%x", ret);
4066 int camera_attr_set_tag_software(camera_h camera, const char *software)
4068 if (camera == NULL) {
4069 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4070 return CAMERA_ERROR_INVALID_PARAMETER;
4072 if (software == NULL) {
4073 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4074 return CAMERA_ERROR_INVALID_PARAMETER;
4076 int ret = CAMERA_ERROR_NONE;
4077 camera_cli_s *pc = (camera_cli_s *)camera;
4078 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_SOFTWARE;
4080 if (pc->cb_info == NULL) {
4081 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4082 return CAMERA_ERROR_INVALID_PARAMETER;
4084 sock_fd = pc->cb_info->fd;
4085 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4086 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, STRING, software);
4087 LOGD("ret : 0x%x", ret);
4092 int camera_attr_set_geotag(camera_h camera, double latitude , double longitude, double altitude)
4094 if (camera == NULL) {
4095 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4096 return CAMERA_ERROR_INVALID_PARAMETER;
4098 int ret = CAMERA_ERROR_NONE;
4099 camera_cli_s *pc = (camera_cli_s *)camera;
4100 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_GEOTAG;
4102 if (pc->cb_info == NULL) {
4103 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4104 return CAMERA_ERROR_INVALID_PARAMETER;
4106 sock_fd = pc->cb_info->fd;
4107 double set_geotag[3] = { latitude, longitude, altitude };
4109 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4110 muse_camera_msg_send_array(api, sock_fd, pc->cb_info, ret,
4111 set_geotag, sizeof(set_geotag), sizeof(double));
4112 LOGD("ret : 0x%x", ret);
4117 int camera_attr_remove_geotag(camera_h camera)
4119 if (camera == NULL) {
4120 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4121 return CAMERA_ERROR_INVALID_PARAMETER;
4123 int ret = CAMERA_ERROR_NONE;
4124 camera_cli_s *pc = (camera_cli_s *)camera;
4125 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_REMOVE_GEOTAG;
4127 if (pc->cb_info == NULL) {
4128 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4129 return CAMERA_ERROR_INVALID_PARAMETER;
4131 sock_fd = pc->cb_info->fd;
4132 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4133 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4134 LOGD("ret : 0x%x", ret);
4139 int camera_attr_set_flash_mode(camera_h camera, camera_attr_flash_mode_e mode)
4141 if (camera == NULL) {
4142 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4143 return CAMERA_ERROR_INVALID_PARAMETER;
4145 int ret = CAMERA_ERROR_NONE;
4146 camera_cli_s *pc = (camera_cli_s *)camera;
4147 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_FLASH_MODE;
4149 if (pc->cb_info == NULL) {
4150 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4151 return CAMERA_ERROR_INVALID_PARAMETER;
4153 sock_fd = pc->cb_info->fd;
4154 int set_mode = (int)mode;
4156 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4157 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
4158 LOGD("ret : 0x%x", ret);
4163 int camera_attr_get_zoom(camera_h camera, int *zoom)
4165 if (camera == NULL || zoom == NULL) {
4166 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4167 return CAMERA_ERROR_INVALID_PARAMETER;
4169 int ret = CAMERA_ERROR_NONE;
4171 camera_cli_s *pc = (camera_cli_s *)camera;
4172 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ZOOM;
4175 if (pc->cb_info == NULL) {
4176 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4177 return CAMERA_ERROR_INVALID_PARAMETER;
4179 sock_fd = pc->cb_info->fd;
4181 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4182 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4184 if (ret == CAMERA_ERROR_NONE) {
4185 muse_camera_msg_get(get_zoom, pc->cb_info->recv_msg);
4188 LOGD("ret : 0x%x", ret);
4193 int camera_attr_get_zoom_range(camera_h camera, int *min, int *max)
4195 if (camera == NULL || min == NULL || max == NULL) {
4196 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4197 return CAMERA_ERROR_INVALID_PARAMETER;
4199 int ret = CAMERA_ERROR_NONE;
4200 camera_cli_s *pc = (camera_cli_s *)camera;
4202 if (pc->cb_info == NULL) {
4203 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4204 return CAMERA_ERROR_INVALID_PARAMETER;
4206 sock_fd = pc->cb_info->fd;
4207 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ZOOM_RANGE;
4211 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4212 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4214 if (ret == CAMERA_ERROR_NONE) {
4215 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
4216 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
4220 LOGD("ret : 0x%x", ret);
4225 int camera_attr_get_af_mode(camera_h camera, camera_attr_af_mode_e *mode)
4227 if (camera == NULL || mode == NULL) {
4228 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4229 return CAMERA_ERROR_INVALID_PARAMETER;
4231 int ret = CAMERA_ERROR_NONE;
4232 camera_cli_s *pc = (camera_cli_s *)camera;
4234 if (pc->cb_info == NULL) {
4235 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4236 return CAMERA_ERROR_INVALID_PARAMETER;
4238 sock_fd = pc->cb_info->fd;
4239 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_AF_MODE;
4242 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4243 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4245 if (ret == CAMERA_ERROR_NONE) {
4246 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
4247 *mode = (camera_attr_af_mode_e)get_mode;
4249 LOGD("ret : 0x%x", ret);
4254 int camera_attr_get_exposure_mode(camera_h camera, camera_attr_exposure_mode_e *mode)
4256 if (camera == NULL || mode == NULL) {
4257 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4258 return CAMERA_ERROR_INVALID_PARAMETER;
4260 int ret = CAMERA_ERROR_NONE;
4261 camera_cli_s *pc = (camera_cli_s *)camera;
4263 if (pc->cb_info == NULL) {
4264 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4265 return CAMERA_ERROR_INVALID_PARAMETER;
4267 sock_fd = pc->cb_info->fd;
4268 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE_MODE;
4271 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4272 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4274 if (ret == CAMERA_ERROR_NONE) {
4275 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
4276 *mode = (camera_attr_exposure_mode_e)get_mode;
4278 LOGD("ret : 0x%x", ret);
4282 int camera_attr_get_exposure(camera_h camera, int *value)
4284 if (camera == NULL || value == NULL) {
4285 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4286 return CAMERA_ERROR_INVALID_PARAMETER;
4288 int ret = CAMERA_ERROR_NONE;
4289 camera_cli_s *pc = (camera_cli_s *)camera;
4291 if (pc->cb_info == NULL) {
4292 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4293 return CAMERA_ERROR_INVALID_PARAMETER;
4295 sock_fd = pc->cb_info->fd;
4296 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE;
4299 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4300 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4302 if (ret == CAMERA_ERROR_NONE) {
4303 muse_camera_msg_get(get_value, pc->cb_info->recv_msg);
4306 LOGD("ret : 0x%x", ret);
4311 int camera_attr_get_exposure_range(camera_h camera, int *min, int *max)
4313 if (camera == NULL || min == NULL || max == NULL) {
4314 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4315 return CAMERA_ERROR_INVALID_PARAMETER;
4317 int ret = CAMERA_ERROR_NONE;
4318 camera_cli_s *pc = (camera_cli_s *)camera;
4320 if (pc->cb_info == NULL) {
4321 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4322 return CAMERA_ERROR_INVALID_PARAMETER;
4324 sock_fd = pc->cb_info->fd;
4325 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE_RANGE;
4329 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4330 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4332 if (ret == CAMERA_ERROR_NONE) {
4333 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
4334 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
4338 LOGD("ret : 0x%x", ret);
4343 int camera_attr_get_iso(camera_h camera, camera_attr_iso_e *iso)
4345 if (camera == NULL || iso == NULL) {
4346 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4347 return CAMERA_ERROR_INVALID_PARAMETER;
4349 int ret = CAMERA_ERROR_NONE;
4350 camera_cli_s *pc = (camera_cli_s *)camera;
4352 if (pc->cb_info == NULL) {
4353 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4354 return CAMERA_ERROR_INVALID_PARAMETER;
4356 sock_fd = pc->cb_info->fd;
4357 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ISO;
4360 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4361 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4363 if (ret == CAMERA_ERROR_NONE) {
4364 muse_camera_msg_get(get_iso, pc->cb_info->recv_msg);
4365 *iso = (camera_attr_iso_e)get_iso;
4367 LOGD("ret : 0x%x", ret);
4372 int camera_attr_get_brightness(camera_h camera, int *level)
4374 if (camera == NULL || level == NULL) {
4375 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4376 return CAMERA_ERROR_INVALID_PARAMETER;
4378 int ret = CAMERA_ERROR_NONE;
4379 camera_cli_s *pc = (camera_cli_s *)camera;
4381 if (pc->cb_info == NULL) {
4382 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4383 return CAMERA_ERROR_INVALID_PARAMETER;
4385 sock_fd = pc->cb_info->fd;
4386 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_BRIGHTNESS;
4389 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4390 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4392 if (ret == CAMERA_ERROR_NONE) {
4393 muse_camera_msg_get(get_level, pc->cb_info->recv_msg);
4396 LOGD("ret : 0x%x", ret);
4401 int camera_attr_get_brightness_range(camera_h camera, int *min, int *max)
4403 if (camera == NULL || min == NULL || max == NULL) {
4404 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4405 return CAMERA_ERROR_INVALID_PARAMETER;
4407 int ret = CAMERA_ERROR_NONE;
4408 camera_cli_s *pc = (camera_cli_s *)camera;
4410 if (pc->cb_info == NULL) {
4411 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4412 return CAMERA_ERROR_INVALID_PARAMETER;
4414 sock_fd = pc->cb_info->fd;
4415 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_BRIGHTNESS_RANGE;
4419 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4420 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4422 if (ret == CAMERA_ERROR_NONE) {
4423 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
4424 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
4428 LOGD("ret : 0x%x", ret);
4433 int camera_attr_get_contrast(camera_h camera, int *level)
4435 if (camera == NULL || level == NULL) {
4436 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4437 return CAMERA_ERROR_INVALID_PARAMETER;
4439 int ret = CAMERA_ERROR_NONE;
4440 camera_cli_s *pc = (camera_cli_s *)camera;
4441 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_CONTRAST;
4443 if (pc->cb_info == NULL) {
4444 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4445 return CAMERA_ERROR_INVALID_PARAMETER;
4447 sock_fd = pc->cb_info->fd;
4450 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4451 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4453 if (ret == CAMERA_ERROR_NONE) {
4454 muse_camera_msg_get(get_level, pc->cb_info->recv_msg);
4457 LOGD("ret : 0x%x", ret);
4462 int camera_attr_get_contrast_range(camera_h camera, int *min , int *max)
4464 if (camera == NULL || min == NULL || max == NULL) {
4465 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4466 return CAMERA_ERROR_INVALID_PARAMETER;
4468 int ret = CAMERA_ERROR_NONE;
4469 camera_cli_s *pc = (camera_cli_s *)camera;
4470 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_CONTRAST_RANGE;
4472 if (pc->cb_info == NULL) {
4473 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4474 return CAMERA_ERROR_INVALID_PARAMETER;
4476 sock_fd = pc->cb_info->fd;
4480 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4481 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4483 if (ret == CAMERA_ERROR_NONE) {
4484 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
4485 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
4489 LOGD("ret : 0x%x", ret);
4494 int camera_attr_get_whitebalance(camera_h camera, camera_attr_whitebalance_e *wb)
4496 if (camera == NULL || wb == NULL) {
4497 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4498 return CAMERA_ERROR_INVALID_PARAMETER;
4500 int ret = CAMERA_ERROR_NONE;
4501 camera_cli_s *pc = (camera_cli_s *)camera;
4502 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_WHITEBALANCE;
4504 if (pc->cb_info == NULL) {
4505 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4506 return CAMERA_ERROR_INVALID_PARAMETER;
4508 sock_fd = pc->cb_info->fd;
4511 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4512 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4514 if (ret == CAMERA_ERROR_NONE) {
4515 muse_camera_msg_get(get_wb, pc->cb_info->recv_msg);
4516 *wb = (camera_attr_whitebalance_e)get_wb;
4518 LOGD("ret : 0x%x", ret);
4523 int camera_attr_get_effect(camera_h camera, camera_attr_effect_mode_e *effect)
4525 if (camera == NULL || effect == NULL) {
4526 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4527 return CAMERA_ERROR_INVALID_PARAMETER;
4530 int ret = CAMERA_ERROR_NONE;
4531 camera_cli_s *pc = (camera_cli_s *)camera;
4532 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EFFECT;
4534 if (pc->cb_info == NULL) {
4535 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4536 return CAMERA_ERROR_INVALID_PARAMETER;
4538 sock_fd = pc->cb_info->fd;
4541 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4542 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4544 if (ret == CAMERA_ERROR_NONE) {
4545 muse_camera_msg_get(get_effect, pc->cb_info->recv_msg);
4546 *effect = (camera_attr_effect_mode_e)get_effect;
4548 LOGD("ret : 0x%x", ret);
4553 int camera_attr_get_scene_mode(camera_h camera, camera_attr_scene_mode_e *mode)
4555 if (camera == NULL || mode == NULL) {
4556 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4557 return CAMERA_ERROR_INVALID_PARAMETER;
4560 int ret = CAMERA_ERROR_NONE;
4561 camera_cli_s *pc = (camera_cli_s *)camera;
4562 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_SCENE_MODE;
4564 if (pc->cb_info == NULL) {
4565 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4566 return CAMERA_ERROR_INVALID_PARAMETER;
4568 sock_fd = pc->cb_info->fd;
4571 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4572 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4574 if (ret == CAMERA_ERROR_NONE) {
4575 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
4576 *mode = (camera_attr_scene_mode_e)get_mode;
4578 LOGD("ret : 0x%x", ret);
4583 int camera_attr_is_enabled_tag(camera_h camera, bool *enable)
4585 if (camera == NULL || enable == NULL) {
4586 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4587 return CAMERA_ERROR_INVALID_PARAMETER;
4590 int ret = CAMERA_ERROR_NONE;
4591 camera_cli_s *pc = (camera_cli_s *)camera;
4592 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_TAG;
4594 if (pc->cb_info == NULL) {
4595 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4596 return CAMERA_ERROR_INVALID_PARAMETER;
4598 sock_fd = pc->cb_info->fd;
4601 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4602 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4604 if (ret == CAMERA_ERROR_NONE) {
4605 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
4606 *enable = (bool)get_enabled;
4608 LOGD("ret : 0x%x", ret);
4613 int camera_attr_get_tag_image_description(camera_h camera, char **description)
4615 if (camera == NULL || description == NULL) {
4616 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4617 return CAMERA_ERROR_INVALID_PARAMETER;
4620 int ret = CAMERA_ERROR_NONE;
4621 camera_cli_s *pc = (camera_cli_s *)camera;
4622 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_IMAGE_DESCRIPTION;
4624 if (pc->cb_info == NULL) {
4625 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4626 return CAMERA_ERROR_INVALID_PARAMETER;
4628 sock_fd = pc->cb_info->fd;
4629 char get_description[MUSE_CAMERA_MSG_MAX_LENGTH] = {0,};
4631 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4632 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4634 if (ret == CAMERA_ERROR_NONE) {
4635 muse_camera_msg_get_string(get_description, pc->cb_info->recv_msg);
4636 *description = strdup(get_description);
4638 LOGD("ret : 0x%x", ret);
4643 int camera_attr_get_tag_orientation(camera_h camera, camera_attr_tag_orientation_e *orientation)
4645 if (camera == NULL || orientation == NULL) {
4646 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4647 return CAMERA_ERROR_INVALID_PARAMETER;
4650 int ret = CAMERA_ERROR_NONE;
4651 camera_cli_s *pc = (camera_cli_s *)camera;
4652 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_ORIENTATION;
4654 if (pc->cb_info == NULL) {
4655 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4656 return CAMERA_ERROR_INVALID_PARAMETER;
4658 sock_fd = pc->cb_info->fd;
4659 int get_orientation;
4661 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4662 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4664 if (ret == CAMERA_ERROR_NONE) {
4665 muse_camera_msg_get(get_orientation, pc->cb_info->recv_msg);
4666 *orientation = (camera_attr_tag_orientation_e)get_orientation;
4667 LOGD("success, orientation : %d", *orientation);
4669 LOGD("ret : 0x%x", ret);
4674 int camera_attr_get_tag_software(camera_h camera, char **software)
4676 if (camera == NULL || software == NULL) {
4677 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4678 return CAMERA_ERROR_INVALID_PARAMETER;
4681 int ret = CAMERA_ERROR_NONE;
4682 camera_cli_s *pc = (camera_cli_s *)camera;
4683 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_SOFTWARE;
4685 if (pc->cb_info == NULL) {
4686 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4687 return CAMERA_ERROR_INVALID_PARAMETER;
4689 sock_fd = pc->cb_info->fd;
4690 char get_software[MUSE_CAMERA_MSG_MAX_LENGTH] = {0,};
4692 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4693 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4695 if (ret == CAMERA_ERROR_NONE) {
4696 muse_camera_msg_get_string(get_software, pc->cb_info->recv_msg);
4697 *software = strdup(get_software);
4699 LOGD("ret : 0x%x", ret);
4704 int camera_attr_get_geotag(camera_h camera, double *latitude , double *longitude, double *altitude)
4706 if (camera == NULL || latitude == NULL || longitude == NULL || altitude == NULL) {
4707 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4708 return CAMERA_ERROR_INVALID_PARAMETER;
4711 int ret = CAMERA_ERROR_NONE;
4712 camera_cli_s *pc = (camera_cli_s *)camera;
4713 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_GEOTAG;
4714 double get_geotag[3] = {0,};
4716 if (pc->cb_info == NULL) {
4717 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4718 return CAMERA_ERROR_INVALID_PARAMETER;
4720 sock_fd = pc->cb_info->fd;
4722 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4723 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4725 if (ret == CAMERA_ERROR_NONE) {
4726 muse_camera_msg_get_array(get_geotag, pc->cb_info->recv_msg);
4727 *latitude = get_geotag[0];
4728 *longitude = get_geotag[1];
4729 *altitude = get_geotag[2];
4731 LOGE("Returned value is not valid : 0x%x", valid);
4734 LOGD("ret : 0x%x", ret);
4740 int camera_attr_get_flash_mode(camera_h camera, camera_attr_flash_mode_e *mode)
4742 if (camera == NULL || mode == NULL) {
4743 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4744 return CAMERA_ERROR_INVALID_PARAMETER;
4747 int ret = CAMERA_ERROR_NONE;
4748 camera_cli_s *pc = (camera_cli_s *)camera;
4749 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_FLASH_MODE;
4751 if (pc->cb_info == NULL) {
4752 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4753 return CAMERA_ERROR_INVALID_PARAMETER;
4755 sock_fd = pc->cb_info->fd;
4758 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4759 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4761 if (ret == CAMERA_ERROR_NONE) {
4762 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
4763 *mode = (camera_attr_flash_mode_e)get_mode;
4765 LOGD("ret : 0x%x", ret);
4769 int camera_get_flash_state(camera_device_e device, camera_flash_state_e *state)
4773 int ret = CAMERA_ERROR_NONE;
4774 camera_cli_s *pc = NULL;
4775 int get_flash_state = 0;
4777 /* create muse connection */
4778 muse_camera_api_e api = MUSE_CAMERA_API_GET_FLASH_STATE;
4779 muse_core_api_module_e muse_module = MUSE_CAMERA;
4780 int device_type = (int)device;
4782 sock_fd = muse_core_client_new();
4784 LOGE("muse_core_client_new failed - returned fd %d", sock_fd);
4785 ret = CAMERA_ERROR_INVALID_OPERATION;
4789 sndMsg = muse_core_msg_json_factory_new(api,
4790 MUSE_TYPE_INT, "module", muse_module,
4791 MUSE_TYPE_INT, PARAM_DEVICE_TYPE, device_type,
4794 muse_core_ipc_send_msg(sock_fd, sndMsg);
4795 muse_core_msg_json_factory_free(sndMsg);
4797 pc = g_new0(camera_cli_s, 1);
4799 LOGE("camera_cli_s alloc failed");
4800 ret = CAMERA_ERROR_OUT_OF_MEMORY;
4804 pc->cb_info = _client_callback_new(sock_fd);
4805 if (pc->cb_info == NULL) {
4806 LOGE("cb_info alloc failed");
4807 ret = CAMERA_ERROR_OUT_OF_MEMORY;
4811 ret = _client_wait_for_cb_return(api, pc->cb_info, CALLBACK_TIME_OUT);
4813 if (ret == CAMERA_ERROR_NONE) {
4814 muse_camera_msg_get(get_flash_state, pc->cb_info->recv_msg);
4815 *state = (camera_flash_state_e)get_flash_state;
4818 LOGD("Flash state : %d\n", *state);
4821 /* release resources */
4823 g_atomic_int_set(&pc->cb_info->msg_recv_running, 0);
4824 g_atomic_int_set(&pc->cb_info->msg_handler_running, 0);
4825 _client_callback_destroy(pc->cb_info);
4834 int camera_attr_foreach_supported_af_mode(camera_h camera, camera_attr_supported_af_mode_cb foreach_cb, void *user_data)
4836 if (camera == NULL || foreach_cb == NULL) {
4837 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4838 return CAMERA_ERROR_INVALID_PARAMETER;
4840 int ret = CAMERA_ERROR_NONE;
4842 camera_cli_s *pc = (camera_cli_s *)camera;
4843 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_AF_MODE;
4845 LOGD("Enter, handle :%x", pc->remote_handle);
4848 if (pc->cb_info == NULL) {
4849 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4850 return CAMERA_ERROR_INVALID_PARAMETER;
4852 sock_fd = pc->cb_info->fd;
4853 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_AF_MODE] = foreach_cb;
4854 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_AF_MODE] = user_data;
4856 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4857 LOGD("ret : 0x%x", ret);
4862 int camera_attr_foreach_supported_exposure_mode(camera_h camera, camera_attr_supported_exposure_mode_cb foreach_cb , void *user_data)
4864 if (camera == NULL || foreach_cb == NULL) {
4865 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4866 return CAMERA_ERROR_INVALID_PARAMETER;
4868 int ret = CAMERA_ERROR_NONE;
4870 camera_cli_s *pc = (camera_cli_s *)camera;
4871 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_EXPOSURE_MODE;
4873 LOGD("Enter, handle :%x", pc->remote_handle);
4876 if (pc->cb_info == NULL) {
4877 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4878 return CAMERA_ERROR_INVALID_PARAMETER;
4880 sock_fd = pc->cb_info->fd;
4881 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EXPOSURE_MODE] = foreach_cb;
4882 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EXPOSURE_MODE] = user_data;
4884 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4885 LOGD("ret : 0x%x", ret);
4890 int camera_attr_foreach_supported_iso(camera_h camera, camera_attr_supported_iso_cb foreach_cb, void *user_data)
4892 if (camera == NULL || foreach_cb == NULL) {
4893 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4894 return CAMERA_ERROR_INVALID_PARAMETER;
4896 int ret = CAMERA_ERROR_NONE;
4898 camera_cli_s *pc = (camera_cli_s *)camera;
4899 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_ISO;
4901 LOGD("Enter, handle :%x", pc->remote_handle);
4904 if (pc->cb_info == NULL) {
4905 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4906 return CAMERA_ERROR_INVALID_PARAMETER;
4908 sock_fd = pc->cb_info->fd;
4909 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_ISO] = foreach_cb;
4910 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_ISO] = user_data;
4912 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4913 LOGD("ret : 0x%x", ret);
4918 int camera_attr_foreach_supported_whitebalance(camera_h camera, camera_attr_supported_whitebalance_cb foreach_cb , void *user_data)
4920 if (camera == NULL || foreach_cb == NULL) {
4921 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4922 return CAMERA_ERROR_INVALID_PARAMETER;
4924 int ret = CAMERA_ERROR_NONE;
4926 camera_cli_s *pc = (camera_cli_s *)camera;
4927 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_WHITEBALANCE;
4929 LOGD("Enter, handle :%x", pc->remote_handle);
4932 if (pc->cb_info == NULL) {
4933 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4934 return CAMERA_ERROR_INVALID_PARAMETER;
4936 sock_fd = pc->cb_info->fd;
4937 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_WHITEBALANCE] = foreach_cb;
4938 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_WHITEBALANCE] = user_data;
4940 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4941 LOGD("ret : 0x%x", ret);
4946 int camera_attr_foreach_supported_effect(camera_h camera, camera_attr_supported_effect_cb foreach_cb , void *user_data)
4948 if (camera == NULL || foreach_cb == NULL) {
4949 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4950 return CAMERA_ERROR_INVALID_PARAMETER;
4952 int ret = CAMERA_ERROR_NONE;
4954 camera_cli_s *pc = (camera_cli_s *)camera;
4955 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_EFFECT;
4957 LOGD("Enter, handle :%x", pc->remote_handle);
4960 if (pc->cb_info == NULL) {
4961 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4962 return CAMERA_ERROR_INVALID_PARAMETER;
4964 sock_fd = pc->cb_info->fd;
4965 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EFFECT] = foreach_cb;
4966 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EFFECT] = user_data;
4968 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4969 LOGD("ret : 0x%x", ret);
4974 int camera_attr_foreach_supported_scene_mode(camera_h camera, camera_attr_supported_scene_mode_cb foreach_cb , void *user_data)
4976 if (camera == NULL || foreach_cb == NULL) {
4977 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4978 return CAMERA_ERROR_INVALID_PARAMETER;
4980 int ret = CAMERA_ERROR_NONE;
4982 camera_cli_s *pc = (camera_cli_s *)camera;
4983 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_SCENE_MODE;
4985 LOGD("Enter, handle :%x", pc->remote_handle);
4988 if (pc->cb_info == NULL) {
4989 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4990 return CAMERA_ERROR_INVALID_PARAMETER;
4992 sock_fd = pc->cb_info->fd;
4993 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_SCENE_MODE] = foreach_cb;
4994 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_SCENE_MODE] = user_data;
4996 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4997 LOGD("ret : 0x%x", ret);
5002 int camera_attr_foreach_supported_flash_mode(camera_h camera, camera_attr_supported_flash_mode_cb foreach_cb , void *user_data)
5004 if (camera == NULL || foreach_cb == NULL) {
5005 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5006 return CAMERA_ERROR_INVALID_PARAMETER;
5008 int ret = CAMERA_ERROR_NONE;
5010 camera_cli_s *pc = (camera_cli_s *)camera;
5011 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FLASH_MODE;
5013 LOGD("Enter, handle :%x", pc->remote_handle);
5016 if (pc->cb_info == NULL) {
5017 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5018 return CAMERA_ERROR_INVALID_PARAMETER;
5020 sock_fd = pc->cb_info->fd;
5021 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FLASH_MODE] = foreach_cb;
5022 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FLASH_MODE] = user_data;
5024 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5025 LOGD("ret : 0x%x", ret);
5030 int camera_attr_foreach_supported_fps(camera_h camera, camera_attr_supported_fps_cb foreach_cb , void *user_data)
5032 if (camera == NULL || foreach_cb == NULL) {
5033 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5034 return CAMERA_ERROR_INVALID_PARAMETER;
5036 int ret = CAMERA_ERROR_NONE;
5038 camera_cli_s *pc = (camera_cli_s *)camera;
5039 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FPS;
5041 if (pc->cb_info == NULL) {
5042 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5043 return CAMERA_ERROR_INVALID_PARAMETER;
5045 sock_fd = pc->cb_info->fd;
5046 LOGD("Enter, handle :%x", pc->remote_handle);
5047 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS] = foreach_cb;
5048 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS] = user_data;
5050 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5051 LOGD("Enter, handle :%x", pc->remote_handle);
5055 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)
5057 if (camera == NULL || foreach_cb == NULL) {
5058 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5059 return CAMERA_ERROR_INVALID_PARAMETER;
5061 int ret = CAMERA_ERROR_NONE;
5063 camera_cli_s *pc = (camera_cli_s *)camera;
5064 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FPS_BY_RESOLUTION;
5066 if (pc->cb_info == NULL) {
5067 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5068 return CAMERA_ERROR_INVALID_PARAMETER;
5070 sock_fd = pc->cb_info->fd;
5071 LOGD("Enter, handle :%x", pc->remote_handle);
5072 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS_BY_RESOLUTION] = foreach_cb;
5073 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS_BY_RESOLUTION] = user_data;
5075 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, width, INT, height);
5076 LOGD("ret : 0x%x", ret);
5080 int camera_attr_foreach_supported_stream_flip(camera_h camera, camera_attr_supported_stream_flip_cb foreach_cb, void *user_data)
5082 if (camera == NULL || foreach_cb == NULL) {
5083 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5084 return CAMERA_ERROR_INVALID_PARAMETER;
5086 int ret = CAMERA_ERROR_NONE;
5088 camera_cli_s *pc = (camera_cli_s *)camera;
5089 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_STREAM_FLIP;
5091 if (pc->cb_info == NULL) {
5092 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5093 return CAMERA_ERROR_INVALID_PARAMETER;
5095 sock_fd = pc->cb_info->fd;
5096 LOGD("Enter, handle :%x", pc->remote_handle);
5097 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_FLIP] = foreach_cb;
5098 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_FLIP] = user_data;
5100 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5101 LOGD("ret : 0x%x", ret);
5106 int camera_attr_foreach_supported_stream_rotation(camera_h camera, camera_attr_supported_stream_rotation_cb foreach_cb, void *user_data)
5108 if (camera == NULL || foreach_cb == NULL) {
5109 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5110 return CAMERA_ERROR_INVALID_PARAMETER;
5112 int ret = CAMERA_ERROR_NONE;
5114 camera_cli_s *pc = (camera_cli_s *)camera;
5115 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_STREAM_ROTATION;
5117 if (pc->cb_info == NULL) {
5118 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5119 return CAMERA_ERROR_INVALID_PARAMETER;
5121 sock_fd = pc->cb_info->fd;
5122 LOGD("Enter, handle :%x", pc->remote_handle);
5123 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION] = foreach_cb;
5124 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION] = user_data;
5126 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5127 LOGD("ret : 0x%x", ret);
5132 int camera_attr_set_stream_rotation(camera_h camera , camera_rotation_e rotation)
5134 if (camera == NULL) {
5135 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5136 return CAMERA_ERROR_INVALID_PARAMETER;
5139 int ret = CAMERA_ERROR_NONE;
5140 camera_cli_s *pc = (camera_cli_s *)camera;
5141 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_STREAM_ROTATION;
5143 if (pc->cb_info == NULL) {
5144 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5145 return CAMERA_ERROR_INVALID_PARAMETER;
5147 sock_fd = pc->cb_info->fd;
5148 int set_rotation = (int)rotation;
5150 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5151 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_rotation);
5152 LOGD("ret : 0x%x", ret);
5157 int camera_attr_get_stream_rotation(camera_h camera , camera_rotation_e *rotation)
5159 if (camera == NULL || rotation == NULL) {
5160 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5161 return CAMERA_ERROR_INVALID_PARAMETER;
5164 int ret = CAMERA_ERROR_NONE;
5165 camera_cli_s *pc = (camera_cli_s *)camera;
5166 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_STREAM_ROTATION;
5168 if (pc->cb_info == NULL) {
5169 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5170 return CAMERA_ERROR_INVALID_PARAMETER;
5172 sock_fd = pc->cb_info->fd;
5175 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5176 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5178 if (ret == CAMERA_ERROR_NONE) {
5179 muse_camera_msg_get(get_rotation, pc->cb_info->recv_msg);
5180 *rotation = (camera_rotation_e)get_rotation;
5182 LOGD("ret : 0x%x", ret);
5187 int camera_attr_set_stream_flip(camera_h camera , camera_flip_e flip)
5189 if (camera == NULL) {
5190 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5191 return CAMERA_ERROR_INVALID_PARAMETER;
5194 int ret = CAMERA_ERROR_NONE;
5195 camera_cli_s *pc = (camera_cli_s *)camera;
5196 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_STREAM_FLIP;
5198 if (pc->cb_info == NULL) {
5199 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5200 return CAMERA_ERROR_INVALID_PARAMETER;
5202 sock_fd = pc->cb_info->fd;
5203 int set_flip = (int)flip;
5205 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5206 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_flip);
5207 LOGD("ret : 0x%x", ret);
5212 int camera_attr_get_stream_flip(camera_h camera , camera_flip_e *flip)
5214 if (camera == NULL || flip == NULL) {
5215 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5216 return CAMERA_ERROR_INVALID_PARAMETER;
5219 int ret = CAMERA_ERROR_NONE;
5220 camera_cli_s *pc = (camera_cli_s *)camera;
5221 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_STREAM_FLIP;
5223 if (pc->cb_info == NULL) {
5224 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5225 return CAMERA_ERROR_INVALID_PARAMETER;
5227 sock_fd = pc->cb_info->fd;
5230 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5231 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5233 if (ret == CAMERA_ERROR_NONE) {
5234 muse_camera_msg_get(get_flip, pc->cb_info->recv_msg);
5235 *flip = (camera_flip_e)get_flip;
5237 LOGD("ret : 0x%x", ret);
5241 int camera_attr_set_hdr_mode(camera_h camera, camera_attr_hdr_mode_e mode)
5243 if (camera == NULL) {
5244 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5245 return CAMERA_ERROR_INVALID_PARAMETER;
5248 int ret = CAMERA_ERROR_NONE;
5249 camera_cli_s *pc = (camera_cli_s *)camera;
5250 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_HDR_MODE;
5252 if (pc->cb_info == NULL) {
5253 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5254 return CAMERA_ERROR_INVALID_PARAMETER;
5256 sock_fd = pc->cb_info->fd;
5257 int set_mode = (int)mode;
5259 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5260 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
5261 LOGD("ret : 0x%x", ret);
5266 int camera_attr_get_hdr_mode(camera_h camera, camera_attr_hdr_mode_e *mode)
5268 if (camera == NULL) {
5269 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5270 return CAMERA_ERROR_INVALID_PARAMETER;
5273 LOGE("CAMERA_ERROR_NOT_SUPPORTED(0x%08x) - mode", CAMERA_ERROR_NOT_SUPPORTED);
5274 return CAMERA_ERROR_NOT_SUPPORTED;
5276 int ret = CAMERA_ERROR_NONE;
5277 camera_cli_s *pc = (camera_cli_s *)camera;
5278 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_HDR_MODE;
5280 if (pc->cb_info == NULL) {
5281 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5282 return CAMERA_ERROR_INVALID_PARAMETER;
5284 sock_fd = pc->cb_info->fd;
5287 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5288 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5290 if (ret == CAMERA_ERROR_NONE) {
5291 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
5292 *mode = (camera_attr_hdr_mode_e)get_mode;
5294 LOGD("ret : 0x%x", ret);
5299 bool camera_attr_is_supported_hdr_capture(camera_h camera)
5301 if (camera == NULL) {
5302 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5306 int ret = CAMERA_ERROR_NONE;
5307 camera_cli_s *pc = (camera_cli_s *)camera;
5308 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_HDR_CAPTURE;
5310 if (pc->cb_info == NULL) {
5311 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5312 return CAMERA_ERROR_INVALID_PARAMETER;
5314 sock_fd = pc->cb_info->fd;
5315 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5316 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5317 LOGD("ret : 0x%x", ret);
5322 int camera_attr_set_hdr_capture_progress_cb(camera_h camera, camera_attr_hdr_progress_cb callback, void *user_data)
5324 if (camera == NULL) {
5325 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5326 return CAMERA_ERROR_INVALID_PARAMETER;
5328 if (callback == NULL) {
5329 LOGE("CAMERA_ERROR_NOT_SUPPORTED(0x%08x) - callback", CAMERA_ERROR_NOT_SUPPORTED);
5330 return CAMERA_ERROR_NOT_SUPPORTED;
5332 int ret = CAMERA_ERROR_NONE;
5334 camera_cli_s *pc = (camera_cli_s *)camera;
5335 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_HDR_CAPTURE_PROGRESS_CB;
5337 if (pc->cb_info == NULL) {
5338 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5339 return CAMERA_ERROR_INVALID_PARAMETER;
5341 sock_fd = pc->cb_info->fd;
5342 LOGD("Enter, handle :%x", pc->remote_handle);
5344 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = callback;
5345 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = user_data;
5347 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5348 LOGD("ret : 0x%x", ret);
5353 int camera_attr_unset_hdr_capture_progress_cb(camera_h camera)
5355 if (camera == NULL) {
5356 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5357 return CAMERA_ERROR_INVALID_PARAMETER;
5360 int ret = CAMERA_ERROR_NONE;
5362 camera_cli_s *pc = (camera_cli_s *)camera;
5363 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_UNSET_HDR_CAPTURE_PROGRESS_CB;
5365 if (pc->cb_info == NULL) {
5366 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5367 return CAMERA_ERROR_INVALID_PARAMETER;
5369 sock_fd = pc->cb_info->fd;
5370 LOGD("Enter, handle :%x", pc->remote_handle);
5372 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = (void *)NULL;
5373 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = (void *)NULL;
5375 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5376 LOGD("ret : 0x%x", ret);
5381 int camera_attr_enable_anti_shake(camera_h camera, bool enable)
5383 if (camera == NULL) {
5384 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5385 return CAMERA_ERROR_INVALID_PARAMETER;
5388 int ret = CAMERA_ERROR_NONE;
5389 camera_cli_s *pc = (camera_cli_s *)camera;
5390 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_ANTI_SHAKE;
5392 if (pc->cb_info == NULL) {
5393 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5394 return CAMERA_ERROR_INVALID_PARAMETER;
5396 sock_fd = pc->cb_info->fd;
5397 int set_enable = (int)enable;
5399 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5400 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
5401 LOGD("ret : 0x%x", ret);
5406 int camera_attr_is_enabled_anti_shake(camera_h camera , bool *enabled)
5408 if (camera == NULL) {
5409 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5410 return CAMERA_ERROR_INVALID_PARAMETER;
5412 if (enabled == NULL) {
5413 LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER);
5414 return CAMERA_ERROR_NOT_SUPPORTED;
5416 int ret = CAMERA_ERROR_NONE;
5417 camera_cli_s *pc = (camera_cli_s *)camera;
5418 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_ANTI_SHAKE;
5420 if (pc->cb_info == NULL) {
5421 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5422 return CAMERA_ERROR_INVALID_PARAMETER;
5424 sock_fd = pc->cb_info->fd;
5427 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5428 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5430 if (ret == CAMERA_ERROR_NONE) {
5431 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
5432 *enabled = (bool)get_enabled;
5434 LOGD("ret : 0x%x", ret);
5439 bool camera_attr_is_supported_anti_shake(camera_h camera)
5442 if (camera == NULL) {
5443 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5447 int ret = CAMERA_ERROR_NONE;
5448 camera_cli_s *pc = (camera_cli_s *)camera;
5449 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_ANTI_SHAKE;
5451 if (pc->cb_info == NULL) {
5452 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5453 return CAMERA_ERROR_INVALID_PARAMETER;
5455 sock_fd = pc->cb_info->fd;
5456 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5457 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5458 LOGD("ret : 0x%x", ret);
5463 int camera_attr_enable_video_stabilization(camera_h camera, bool enable)
5465 if (camera == NULL) {
5466 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5467 return CAMERA_ERROR_INVALID_PARAMETER;
5470 int ret = CAMERA_ERROR_NONE;
5471 camera_cli_s *pc = (camera_cli_s *)camera;
5472 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_VIDEO_STABILIZATION;
5474 if (pc->cb_info == NULL) {
5475 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5476 return CAMERA_ERROR_INVALID_PARAMETER;
5478 sock_fd = pc->cb_info->fd;
5479 int set_enable = (int)enable;
5481 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5482 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
5483 LOGD("ret : 0x%x", ret);
5488 int camera_attr_is_enabled_video_stabilization(camera_h camera, bool *enabled)
5490 if (camera == NULL) {
5491 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5492 return CAMERA_ERROR_INVALID_PARAMETER;
5494 if (enabled == NULL) {
5495 LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER);
5496 return CAMERA_ERROR_NOT_SUPPORTED;
5498 int ret = CAMERA_ERROR_NONE;
5499 camera_cli_s *pc = (camera_cli_s *)camera;
5500 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_VIDEO_STABILIZATION;
5502 if (pc->cb_info == NULL) {
5503 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5504 return CAMERA_ERROR_INVALID_PARAMETER;
5506 sock_fd = pc->cb_info->fd;
5509 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5510 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5512 if (ret == CAMERA_ERROR_NONE) {
5513 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
5514 *enabled = (bool)get_enabled;
5516 LOGD("ret : 0x%x", ret);
5521 bool camera_attr_is_supported_video_stabilization(camera_h camera)
5523 if (camera == NULL) {
5524 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5528 int ret = CAMERA_ERROR_NONE;
5529 camera_cli_s *pc = (camera_cli_s *)camera;
5530 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_VIDEO_STABILIZATION;
5532 if (pc->cb_info == NULL) {
5533 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5534 return CAMERA_ERROR_INVALID_PARAMETER;
5536 sock_fd = pc->cb_info->fd;
5537 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5538 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5539 LOGD("ret : 0x%x", ret);
5544 int camera_attr_enable_auto_contrast(camera_h camera, bool enable)
5546 if (camera == NULL) {
5547 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5548 return CAMERA_ERROR_INVALID_PARAMETER;
5551 int ret = CAMERA_ERROR_NONE;
5552 camera_cli_s *pc = (camera_cli_s *)camera;
5553 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_AUTO_CONTRAST;
5555 if (pc->cb_info == NULL) {
5556 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5557 return CAMERA_ERROR_INVALID_PARAMETER;
5559 sock_fd = pc->cb_info->fd;
5560 int set_enable = (int)enable;
5562 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5563 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
5564 LOGD("ret : 0x%x", ret);
5569 int camera_attr_is_enabled_auto_contrast(camera_h camera, bool *enabled)
5571 if (camera == NULL) {
5572 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5573 return CAMERA_ERROR_INVALID_PARAMETER;
5575 if (enabled == NULL) {
5576 LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER);
5577 return CAMERA_ERROR_INVALID_PARAMETER;
5579 int ret = CAMERA_ERROR_NONE;
5580 camera_cli_s *pc = (camera_cli_s *)camera;
5581 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_AUTO_CONTRAST;
5583 if (pc->cb_info == NULL) {
5584 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5585 return CAMERA_ERROR_INVALID_PARAMETER;
5587 sock_fd = pc->cb_info->fd;
5590 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5591 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5593 if (ret == CAMERA_ERROR_NONE) {
5594 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
5595 *enabled = (bool)get_enabled;
5597 LOGD("ret : 0x%x", ret);
5602 bool camera_attr_is_supported_auto_contrast(camera_h camera)
5604 if (camera == NULL) {
5605 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5609 int ret = CAMERA_ERROR_NONE;
5610 camera_cli_s *pc = (camera_cli_s *)camera;
5611 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_AUTO_CONTRAST;
5613 if (pc->cb_info == NULL) {
5614 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5615 return CAMERA_ERROR_INVALID_PARAMETER;
5617 sock_fd = pc->cb_info->fd;
5618 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5619 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5620 LOGD("ret : 0x%x", ret);
5625 int camera_attr_disable_shutter_sound(camera_h camera, bool disable)
5627 if (camera == NULL) {
5628 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5629 return CAMERA_ERROR_INVALID_PARAMETER;
5632 int ret = CAMERA_ERROR_NONE;
5633 camera_cli_s *pc = (camera_cli_s *)camera;
5634 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_DISABLE_SHUTTER_SOUND;
5636 if (pc->cb_info == NULL) {
5637 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5638 return CAMERA_ERROR_INVALID_PARAMETER;
5640 sock_fd = pc->cb_info->fd;
5641 int set_disable = (int)disable;
5643 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5644 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_disable);
5645 LOGD("ret : 0x%x", ret);