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>
41 #include <mm_evas_renderer.h>
46 #define LOG_TAG "TIZEN_N_CAMERA"
50 static void __global(void *data, struct wl_registry *registry,
51 uint32_t name, const char *interface, uint32_t version)
53 struct tizen_surface **tz_surface = NULL;
60 tz_surface = (struct tizen_surface **)data;
63 LOGW("NULL interface");
67 LOGI("interface %s", interface);
69 if (strcmp(interface, "tizen_surface") == 0) {
70 LOGD("binding tizen surface for wayland");
72 *tz_surface = wl_registry_bind(registry, name, &tizen_surface_interface, version);
73 if (*tz_surface == NULL)
74 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 = {
93 void __parent_id_getter(void *data, struct tizen_resource *tizen_resource, uint32_t id)
100 *((unsigned int *)data) = id;
102 LOGD("[CLIENT] got parent_id [%u] from server", id);
107 static const struct tizen_resource_listener _camera_tz_resource_listener = {
111 int _get_wl_info(Evas_Object *obj, camera_wl_info_s *wl_info)
113 int ret = CAMERA_ERROR_NONE;
114 Ecore_Wl_Window *window = NULL;
115 struct wl_display *display = NULL;
116 struct wl_surface *surface = NULL;
117 struct wl_registry *registry = NULL;
118 struct tizen_surface *tz_surface = NULL;
119 struct tizen_resource *tz_resource = NULL;
121 if (!obj || !wl_info) {
122 LOGE("NULL parameter %p %p", obj, wl_info);
123 return CAMERA_ERROR_INVALID_OPERATION;
126 window = elm_win_wl_window_get(obj);
128 LOGE("failed to get wayland window");
129 ret = CAMERA_ERROR_INVALID_OPERATION;
133 surface = (struct wl_surface *)ecore_wl_window_surface_get(window);
135 LOGE("failed to get wayland surface");
136 ret = CAMERA_ERROR_INVALID_OPERATION;
140 display = (struct wl_display *)ecore_wl_display_get();
142 LOGE("failed to get wayland display");
143 ret = CAMERA_ERROR_INVALID_OPERATION;
147 registry = wl_display_get_registry(display);
149 LOGE("failed to get wayland registry");
150 ret = CAMERA_ERROR_INVALID_OPERATION;
154 wl_registry_add_listener(registry, &_camera_wl_registry_listener, &tz_surface);
156 wl_display_dispatch(display);
157 wl_display_roundtrip(display);
160 LOGE("failed to get tizen surface");
161 ret = CAMERA_ERROR_INVALID_OPERATION;
165 /* Get parent_id which is unique in a entire systemw. */
166 tz_resource = tizen_surface_get_tizen_resource(tz_surface, surface);
168 LOGE("failed to get tizen resurce");
169 ret = CAMERA_ERROR_INVALID_OPERATION;
173 wl_info->parent_id = 0;
175 tizen_resource_add_listener(tz_resource, &_camera_tz_resource_listener, &wl_info->parent_id);
177 wl_display_roundtrip(display);
179 if (wl_info->parent_id > 0) {
181 Ecore_Evas *ecore_evas = NULL;
182 ret = CAMERA_ERROR_NONE;
184 wl_info->evas_obj = obj;
186 evas_object_geometry_get(obj, &wl_info->window_x, &wl_info->window_y,
187 &wl_info->window_width, &wl_info->window_height);
189 ecore_evas = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
191 rotation = ecore_evas_rotation_get(ecore_evas);
192 if (rotation == 90 || rotation == 270) {
193 int temp = wl_info->window_width;
195 LOGD("swap width and height %d, %d", wl_info->window_width, wl_info->window_height);
197 wl_info->window_width = wl_info->window_height;
198 wl_info->window_height = temp;
201 LOGW("failed to get ecore_evas.. skip rotation check");
204 LOGD("evas object : %p, rotation : %d, parent id : %u, window : %d,%d,%dx%d",
205 wl_info->evas_obj, rotation, wl_info->parent_id,
206 wl_info->window_x, wl_info->window_y,
207 wl_info->window_width, wl_info->window_height);
209 ret = CAMERA_ERROR_INVALID_OPERATION;
210 LOGE("failed to get parent id");
215 tizen_surface_destroy(tz_surface);
220 tizen_resource_destroy(tz_resource);
225 wl_registry_destroy(registry);
231 #endif /* HAVE_WAYLAND */
233 static int _import_tbm_key(tbm_bufmgr bufmgr, unsigned int tbm_key, tbm_bo *bo, tbm_bo_handle *bo_handle)
235 tbm_bo tmp_bo = NULL;
236 tbm_bo_handle tmp_bo_handle = {NULL, };
238 if (bufmgr == NULL || bo == NULL || bo_handle == NULL || tbm_key == 0) {
239 LOGE("invalid parameter - bufmgr %p, bo %p, bo_handle %p, key %d",
240 bufmgr, bo, bo_handle, tbm_key);
244 tmp_bo = tbm_bo_import(bufmgr, tbm_key);
245 if (tmp_bo == NULL) {
246 LOGE("bo import failed - bufmgr %p, key %d", bufmgr, tbm_key);
250 tmp_bo_handle = tbm_bo_map(tmp_bo, TBM_DEVICE_CPU, TBM_OPTION_READ);
251 if (tmp_bo_handle.ptr == NULL) {
252 LOGE("bo map failed %p", tmp_bo);
253 tbm_bo_unref(tmp_bo);
258 /* set bo and bo_handle */
260 *bo_handle = tmp_bo_handle;
265 static void _release_imported_bo(tbm_bo *bo)
267 if (bo == NULL || *bo == NULL) {
279 static int _client_wait_for_cb_return(muse_camera_api_e api, camera_cb_info_s *cb_info, int time_out)
281 int ret = CAMERA_ERROR_NONE;
284 LOGD("Enter api : %d", api);
286 g_mutex_lock(&(cb_info->api_mutex[api]));
288 if (cb_info->api_activating[api] == 0) {
289 end_time = g_get_monotonic_time() + time_out * G_TIME_SPAN_SECOND;
290 if (g_cond_wait_until(&(cb_info->api_cond[api]), &(cb_info->api_mutex[api]), end_time)) {
291 ret = cb_info->api_ret[api];
292 cb_info->api_activating[api] = 0;
294 LOGD("return value : 0x%x", ret);
296 ret = CAMERA_ERROR_INVALID_OPERATION;
298 LOGE("api %d was TIMED OUT!", api);
301 ret = cb_info->api_ret[api];
302 cb_info->api_activating[api] = 0;
304 LOGD("condition is already checked for the api[%d], return[0x%x]", api, ret);
307 g_mutex_unlock(&(cb_info->api_mutex[api]));
312 int _camera_get_tbm_surface_format(int in_format, uint32_t *out_format)
314 if (in_format <= MM_PIXEL_FORMAT_INVALID ||
315 in_format >= MM_PIXEL_FORMAT_NUM ||
316 out_format == NULL) {
317 LOGE("INVALID_PARAMETER : in_format %d, out_format ptr %p", in_format, out_format);
318 return CAMERA_ERROR_INVALID_PARAMETER;
322 case MM_PIXEL_FORMAT_NV12:
323 case MM_PIXEL_FORMAT_NV12T:
324 *out_format = TBM_FORMAT_NV12;
326 case MM_PIXEL_FORMAT_NV16:
327 *out_format = TBM_FORMAT_NV16;
329 case MM_PIXEL_FORMAT_NV21:
330 *out_format = TBM_FORMAT_NV21;
332 case MM_PIXEL_FORMAT_YUYV:
333 *out_format = TBM_FORMAT_YUYV;
335 case MM_PIXEL_FORMAT_UYVY:
336 case MM_PIXEL_FORMAT_ITLV_JPEG_UYVY:
337 *out_format = TBM_FORMAT_UYVY;
339 case MM_PIXEL_FORMAT_422P:
340 *out_format = TBM_FORMAT_YUV422;
342 case MM_PIXEL_FORMAT_I420:
343 *out_format = TBM_FORMAT_YUV420;
345 case MM_PIXEL_FORMAT_YV12:
346 *out_format = TBM_FORMAT_YVU420;
348 case MM_PIXEL_FORMAT_RGB565:
349 *out_format = TBM_FORMAT_RGB565;
351 case MM_PIXEL_FORMAT_RGB888:
352 *out_format = TBM_FORMAT_RGB888;
354 case MM_PIXEL_FORMAT_RGBA:
355 *out_format = TBM_FORMAT_RGBA8888;
357 case MM_PIXEL_FORMAT_ARGB:
358 *out_format = TBM_FORMAT_ARGB8888;
361 LOGE("invalid in_format %d", in_format);
362 return CAMERA_ERROR_INVALID_PARAMETER;
365 return CAMERA_ERROR_NONE;
369 int _camera_get_media_packet_mimetype(int in_format, media_format_mimetype_e *mimetype)
371 if (in_format <= MM_PIXEL_FORMAT_INVALID ||
372 in_format >= MM_PIXEL_FORMAT_NUM ||
374 LOGE("INVALID_PARAMETER : in_format %d, mimetype ptr %p", in_format, mimetype);
375 return CAMERA_ERROR_INVALID_PARAMETER;
379 case MM_PIXEL_FORMAT_NV12:
380 case MM_PIXEL_FORMAT_NV12T:
381 *mimetype = MEDIA_FORMAT_NV12;
383 case MM_PIXEL_FORMAT_NV16:
384 *mimetype = MEDIA_FORMAT_NV16;
386 case MM_PIXEL_FORMAT_NV21:
387 *mimetype = MEDIA_FORMAT_NV21;
389 case MM_PIXEL_FORMAT_YUYV:
390 *mimetype = MEDIA_FORMAT_YUYV;
392 case MM_PIXEL_FORMAT_UYVY:
393 case MM_PIXEL_FORMAT_ITLV_JPEG_UYVY:
394 *mimetype = MEDIA_FORMAT_UYVY;
396 case MM_PIXEL_FORMAT_422P:
397 *mimetype = MEDIA_FORMAT_422P;
399 case MM_PIXEL_FORMAT_I420:
400 *mimetype = MEDIA_FORMAT_I420;
402 case MM_PIXEL_FORMAT_YV12:
403 *mimetype = MEDIA_FORMAT_YV12;
405 case MM_PIXEL_FORMAT_RGB565:
406 *mimetype = MEDIA_FORMAT_RGB565;
408 case MM_PIXEL_FORMAT_RGB888:
409 *mimetype = MEDIA_FORMAT_RGB888;
411 case MM_PIXEL_FORMAT_RGBA:
412 *mimetype = MEDIA_FORMAT_RGBA;
414 case MM_PIXEL_FORMAT_ARGB:
415 *mimetype = MEDIA_FORMAT_ARGB;
418 LOGE("invalid in_format %d", in_format);
419 return CAMERA_ERROR_INVALID_PARAMETER;
422 return CAMERA_ERROR_NONE;
425 void _camera_preview_frame_create(camera_stream_data_s *stream, int num_buffer_key, tbm_bo_handle *buffer_bo_handle, camera_preview_data_s *frame)
428 unsigned char * buf_pos = NULL;
430 if (stream == NULL || buffer_bo_handle == NULL || frame == NULL) {
431 LOGE("invalid parameter - stream:%p, buffer_bo_handle:%p", stream, buffer_bo_handle);
435 buf_pos = (unsigned char *)stream;
438 if (stream->format == MM_PIXEL_FORMAT_ITLV_JPEG_UYVY)
439 frame->format = MM_PIXEL_FORMAT_UYVY;
441 frame->format = stream->format;
443 frame->width = stream->width;
444 frame->height = stream->height;
445 frame->timestamp = stream->timestamp;
446 frame->num_of_planes = stream->num_planes;
448 if (num_buffer_key == 0) {
450 buf_pos += sizeof(camera_stream_data_s);
452 if (stream->format == MM_PIXEL_FORMAT_ENCODED_H264) {
453 frame->data.encoded_plane.data = buf_pos;
454 frame->data.encoded_plane.size = stream->data.encoded.length_data;
455 total_size = stream->data.encoded.length_data;
457 switch (stream->num_planes) {
459 frame->data.single_plane.yuv = buf_pos;
460 frame->data.single_plane.size = stream->data.yuv420.length_yuv;
461 total_size = stream->data.yuv420.length_yuv;
464 frame->data.double_plane.y = buf_pos;
465 frame->data.double_plane.y_size = stream->data.yuv420sp.length_y;
466 buf_pos += stream->data.yuv420sp.length_y;
467 frame->data.double_plane.uv = buf_pos;
468 frame->data.double_plane.uv_size = stream->data.yuv420sp.length_uv;
469 total_size = stream->data.yuv420sp.length_y + \
470 stream->data.yuv420sp.length_uv;
473 frame->data.triple_plane.y = buf_pos;
474 frame->data.triple_plane.y_size = stream->data.yuv420p.length_y;
475 buf_pos += stream->data.yuv420p.length_y;
476 frame->data.triple_plane.u = buf_pos;
477 frame->data.triple_plane.u_size = stream->data.yuv420p.length_u;
478 buf_pos += stream->data.yuv420p.length_u;
479 frame->data.triple_plane.v = buf_pos;
480 frame->data.triple_plane.v_size = stream->data.yuv420p.length_v;
481 total_size = stream->data.yuv420p.length_y + \
482 stream->data.yuv420p.length_u + \
483 stream->data.yuv420p.length_v;
491 switch (stream->num_planes) {
493 frame->data.single_plane.yuv = buffer_bo_handle[0].ptr;
494 frame->data.single_plane.size = stream->data.yuv420.length_yuv;
495 total_size = stream->data.yuv420.length_yuv;
498 frame->data.double_plane.y = buffer_bo_handle[0].ptr;
499 if (stream->num_planes == (unsigned int)num_buffer_key)
500 frame->data.double_plane.uv = buffer_bo_handle[1].ptr;
502 frame->data.double_plane.uv = buffer_bo_handle[0].ptr + stream->data.yuv420sp.length_y;
503 frame->data.double_plane.y_size = stream->data.yuv420sp.length_y;
504 frame->data.double_plane.uv_size = stream->data.yuv420sp.length_uv;
505 total_size = stream->data.yuv420sp.length_y + \
506 stream->data.yuv420sp.length_uv;
509 frame->data.triple_plane.y = buffer_bo_handle[0].ptr;
510 if (stream->num_planes == (unsigned int)num_buffer_key) {
511 frame->data.triple_plane.u = buffer_bo_handle[1].ptr;
512 frame->data.triple_plane.v = buffer_bo_handle[2].ptr;
514 frame->data.triple_plane.u = buffer_bo_handle[0].ptr + stream->data.yuv420p.length_y;
515 frame->data.triple_plane.v = buffer_bo_handle[1].ptr + stream->data.yuv420p.length_u;
517 frame->data.triple_plane.y_size = stream->data.yuv420p.length_y;
518 frame->data.triple_plane.u_size = stream->data.yuv420p.length_u;
519 frame->data.triple_plane.v_size = stream->data.yuv420p.length_v;
520 total_size = stream->data.yuv420p.length_y + \
521 stream->data.yuv420p.length_u + \
522 stream->data.yuv420p.length_v;
530 LOGD("format %d, %dx%d, size %d plane num %d",
531 frame.format, frame.width, frame.height, total_size, frame.num_of_planes);
535 int _camera_media_packet_data_create(int tbm_key, int num_buffer_key, tbm_bo bo, tbm_bo *buffer_bo, camera_media_packet_data **mp_data)
538 int ret = CAMERA_ERROR_NONE;
539 camera_media_packet_data *tmp_mp_data = NULL;
541 if (*mp_data == NULL) {
542 tmp_mp_data = g_new0(camera_media_packet_data, 1);
544 tmp_mp_data->tbm_key = tbm_key;
545 tmp_mp_data->num_buffer_key = num_buffer_key;
546 tmp_mp_data->bo = bo;
547 tmp_mp_data->ref_cnt++;
549 for (i = 0 ; i < num_buffer_key ; i++)
550 tmp_mp_data->buffer_bo[i] = buffer_bo[i];
552 *mp_data = tmp_mp_data;
553 /*LOGD("mp_data %p", tmp_mp_data);*/
555 ret = CAMERA_ERROR_OUT_OF_MEMORY;
556 LOGE("failed to alloc media packet data");
559 ((camera_media_packet_data *)*mp_data)->ref_cnt++;
565 int _camera_media_packet_create(camera_cb_info_s *cb_info, camera_stream_data_s *stream, camera_media_packet_data *mp_data, media_packet_h *packet)
567 media_packet_h pkt = NULL;
568 bool make_pkt_fmt = false;
569 tbm_surface_h tsurf = NULL;
570 tbm_surface_info_s tsurf_info;
571 media_format_mimetype_e mimetype = MEDIA_FORMAT_NV12;
572 uint32_t bo_format = 0;
575 int num_buffer_key = 0;
576 tbm_bo *buffer_bo = NULL;
578 if (cb_info == NULL || stream == NULL || mp_data == NULL || packet == NULL) {
579 LOGE("invalid parameter - cb_info:%p, stream:%p, mp_data:%p, packet:%p",
580 cb_info, stream, mp_data, packet);
581 return CAMERA_ERROR_INVALID_PARAMETER;
584 memset(&tsurf_info, 0x0, sizeof(tbm_surface_info_s));
585 buffer_bo = mp_data->buffer_bo;
586 num_buffer_key = mp_data->num_buffer_key;
588 /* unmap buffer bo */
589 for (i = 0 ; i < num_buffer_key ; i++) {
591 tbm_bo_unmap(buffer_bo[i]);
594 /* create tbm surface */
595 for (i = 0 ; i < BUFFER_MAX_PLANE_NUM ; i++)
596 tsurf_info.planes[i].stride = stream->stride[i];
598 /* get tbm surface format */
599 ret = _camera_get_tbm_surface_format(stream->format, &bo_format);
600 ret |= _camera_get_media_packet_mimetype(stream->format, &mimetype);
602 if (num_buffer_key > 0 && ret == CAMERA_ERROR_NONE) {
603 tsurf_info.width = stream->width;
604 tsurf_info.height = stream->height;
605 tsurf_info.format = bo_format;
606 tsurf_info.bpp = tbm_surface_internal_get_bpp(bo_format);
607 tsurf_info.num_planes = tbm_surface_internal_get_num_planes(bo_format);
610 case TBM_FORMAT_NV12:
611 case TBM_FORMAT_NV21:
612 tsurf_info.planes[0].size = stream->stride[0] * stream->elevation[0];
613 tsurf_info.planes[1].size = stream->stride[1] * stream->elevation[1];
614 tsurf_info.planes[0].offset = 0;
615 if (num_buffer_key == 1)
616 tsurf_info.planes[1].offset = tsurf_info.planes[0].size;
617 tsurf_info.size = tsurf_info.planes[0].size + tsurf_info.planes[1].size;
619 case TBM_FORMAT_YUV420:
620 case TBM_FORMAT_YVU420:
621 tsurf_info.planes[0].size = stream->stride[0] * stream->elevation[0];
622 tsurf_info.planes[1].size = stream->stride[1] * stream->elevation[1];
623 tsurf_info.planes[2].size = stream->stride[2] * stream->elevation[2];
624 tsurf_info.planes[0].offset = 0;
625 if (num_buffer_key == 1) {
626 tsurf_info.planes[1].offset = tsurf_info.planes[0].size;
627 tsurf_info.planes[2].offset = tsurf_info.planes[0].size + tsurf_info.planes[1].size;
629 tsurf_info.size = tsurf_info.planes[0].size + tsurf_info.planes[1].size + tsurf_info.planes[2].size;
631 case TBM_FORMAT_UYVY:
632 case TBM_FORMAT_YUYV:
633 tsurf_info.planes[0].size = (stream->stride[0] * stream->elevation[0]) << 1;
634 tsurf_info.planes[0].offset = 0;
635 tsurf_info.size = tsurf_info.planes[0].size;
641 tsurf = tbm_surface_internal_create_with_bos(&tsurf_info, buffer_bo, num_buffer_key);
642 /*LOGD("tbm surface %p", tsurf);*/
646 /* check media packet format */
647 if (cb_info->pkt_fmt) {
648 int pkt_fmt_width = 0;
649 int pkt_fmt_height = 0;
650 media_format_mimetype_e pkt_fmt_mimetype = MEDIA_FORMAT_NV12;
652 media_format_get_video_info(cb_info->pkt_fmt, &pkt_fmt_mimetype, &pkt_fmt_width, &pkt_fmt_height, NULL, NULL);
653 if (pkt_fmt_mimetype != mimetype ||
654 pkt_fmt_width != stream->width ||
655 pkt_fmt_height != stream->height) {
656 LOGW("different format. current 0x%x, %dx%d, new 0x%x, %dx%d",
657 pkt_fmt_mimetype, pkt_fmt_width, pkt_fmt_height, mimetype, stream->width, stream->height);
658 media_format_unref(cb_info->pkt_fmt);
659 cb_info->pkt_fmt = NULL;
666 /* create packet format */
668 LOGW("make new pkt_fmt - mimetype 0x%x, %dx%d", mimetype, stream->width, stream->height);
669 ret = media_format_create(&cb_info->pkt_fmt);
670 if (ret == MEDIA_FORMAT_ERROR_NONE) {
671 ret = media_format_set_video_mime(cb_info->pkt_fmt, mimetype);
672 ret |= media_format_set_video_width(cb_info->pkt_fmt, stream->width);
673 ret |= media_format_set_video_height(cb_info->pkt_fmt, stream->height);
674 LOGW("media_format_set_video_mime,width,height ret : 0x%x", ret);
676 LOGW("media_format_create failed");
680 /* create media packet */
681 ret = media_packet_create_from_tbm_surface(cb_info->pkt_fmt,
682 tsurf, (media_packet_finalize_cb)_camera_media_packet_finalize,
683 (void *)cb_info, &pkt);
684 if (ret != MEDIA_PACKET_ERROR_NONE) {
685 LOGE("media_packet_create_from_tbm_surface failed");
687 tbm_surface_destroy(tsurf);
691 LOGE("failed to create tbm surface %dx%d, format %d, num_buffer_key %d",
692 stream->width, stream->height, stream->format, num_buffer_key);
696 /*LOGD("media packet %p, internal buffer %p", pkt, stream->internal_buffer);*/
698 /* set media packet data */
699 ret = media_packet_set_extra(pkt, (void *)mp_data);
700 if (ret != MEDIA_PACKET_ERROR_NONE) {
701 LOGE("media_packet_set_extra failed");
708 media_packet_destroy(pkt);
711 /* set timestamp : msec -> nsec */
712 if (media_packet_set_pts(pkt, (uint64_t)(stream->timestamp) * 1000000) != MEDIA_PACKET_ERROR_NONE)
713 LOGW("media_packet_set_pts failed");
722 int _camera_media_packet_finalize(media_packet_h pkt, int error_code, void *user_data)
726 camera_cb_info_s *cb_info = (camera_cb_info_s *)user_data;
727 camera_media_packet_data *mp_data = NULL;
728 tbm_surface_h tsurf = NULL;
730 if (pkt == NULL || cb_info == NULL) {
731 LOGE("invalid parameter buffer %p, cb_info %p", pkt, cb_info);
732 return MEDIA_PACKET_FINALIZE;
735 ret = media_packet_get_extra(pkt, (void **)&mp_data);
736 if (ret != MEDIA_PACKET_ERROR_NONE) {
737 LOGE("media_packet_get_extra failed 0x%x", ret);
738 return MEDIA_PACKET_FINALIZE;
741 /*LOGD("mp_data %p", mp_data);*/
743 g_mutex_lock(&cb_info->mp_data_mutex);
746 if (mp_data->ref_cnt > 1) {
748 LOGD("Media packet is still referenced by %d client", mp_data->ref_cnt);
750 int tbm_key = mp_data->tbm_key;
752 /* release imported bo */
753 for (i = 0 ; i < mp_data->num_buffer_key ; i++) {
754 tbm_bo_unref(mp_data->buffer_bo[i]);
755 mp_data->buffer_bo[i] = NULL;
758 /* unmap and unref tbm bo */
759 _release_imported_bo(&mp_data->bo);
762 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
763 cb_info->fd, cb_info, INT, tbm_key);
769 g_mutex_unlock(&cb_info->mp_data_mutex);
771 ret = media_packet_get_tbm_surface(pkt, &tsurf);
772 if (ret != MEDIA_PACKET_ERROR_NONE) {
773 LOGE("media_packet_get_tbm_surface failed 0x%x", ret);
774 return MEDIA_PACKET_FINALIZE;
778 tbm_surface_destroy(tsurf);
782 return MEDIA_PACKET_FINALIZE;
785 static void _client_user_callback(camera_cb_info_s *cb_info, char *recv_msg, muse_camera_event_e event)
791 tbm_bo_handle bo_handle = {NULL, };
793 if (recv_msg == NULL || event >= MUSE_CAMERA_EVENT_TYPE_NUM) {
794 LOGE("invalid parameter - camera msg %p, event %d", recv_msg, event);
798 LOGD("get camera msg %s, event %d", recv_msg, event);
800 if (event == MUSE_CAMERA_EVENT_TYPE_PREVIEW) {
801 if (!(CHECK_PREVIEW_CB(cb_info, PREVIEW_CB_TYPE_EVAS)) &&
802 cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW] == NULL &&
803 cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] == NULL) {
804 LOGW("all preview callback from user are NULL");
807 } else if (cb_info->user_cb[event] == NULL) {
808 LOGW("user callback for event %d is not set", event);
813 case MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE:
819 muse_camera_msg_get(previous, recv_msg);
820 muse_camera_msg_get(current, recv_msg);
821 muse_camera_msg_get(by_policy, recv_msg);
823 LOGD("STATE CHANGE - previous %d, current %d, by_policy %d",
824 previous, current, by_policy);
826 ((camera_state_changed_cb)cb_info->user_cb[event])((camera_state_e)previous,
827 (camera_state_e)current, (bool)by_policy, cb_info->user_data[event]);
830 case MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE:
834 muse_camera_msg_get(state, recv_msg);
836 LOGD("FOCUS state - %d", state);
838 ((camera_focus_changed_cb)cb_info->user_cb[event])((camera_focus_state_e)state, cb_info->user_data[event]);
841 case MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE:
842 LOGD("CAPTURE_COMPLETED");
843 ((camera_capture_completed_cb)cb_info->user_cb[event])(cb_info->user_data[event]);
845 case MUSE_CAMERA_EVENT_TYPE_PREVIEW:
846 case MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW:
848 unsigned char *buf_pos = NULL;
849 camera_stream_data_s *stream = NULL;
852 int num_buffer_key = 0;
853 int buffer_key[BUFFER_MAX_PLANE_NUM] = {0, };
854 tbm_bo buffer_bo[BUFFER_MAX_PLANE_NUM] = {NULL, };
855 tbm_bo_handle buffer_bo_handle[BUFFER_MAX_PLANE_NUM] = {{.ptr = NULL}, };
856 camera_preview_data_s frame;
857 media_packet_h pkt = NULL;
858 camera_media_packet_data *mp_data = NULL;
860 muse_camera_msg_get(tbm_key, recv_msg);
861 muse_camera_msg_get(num_buffer_key, recv_msg);
862 muse_camera_msg_get_array(buffer_key, recv_msg);
864 memset(&frame, 0x0, sizeof(camera_preview_data_s));
867 LOGE("invalid key %d", tbm_key);
871 /* import tbm bo and get virtual address */
872 if (!_import_tbm_key(cb_info->bufmgr, tbm_key, &bo, &bo_handle)) {
873 LOGE("failed to import key %d", tbm_key);
875 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
876 cb_info->fd, cb_info, INT, tbm_key);
880 buf_pos = (unsigned char *)bo_handle.ptr;
882 /* get stream info */
883 stream = (camera_stream_data_s *)buf_pos;
885 for (i = 0 ; i < num_buffer_key ; i++) {
886 /* import buffer bo and get virtual address */
887 if (!_import_tbm_key(cb_info->bufmgr, buffer_key[i], &buffer_bo[i], &buffer_bo_handle[i])) {
888 LOGE("failed to import buffer key %d", buffer_key[i]);
890 /* release imported bo */
891 for (i -= 1 ; i >= 0 ; i--)
892 _release_imported_bo(&buffer_bo[i]);
894 _release_imported_bo(&bo);
896 /* send return buffer */
897 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
898 cb_info->fd, cb_info, INT, tbm_key);
903 /* call preview callback */
904 if (cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW]) {
905 _camera_preview_frame_create(stream, num_buffer_key, buffer_bo_handle, &frame);
907 int e_type = MUSE_CAMERA_EVENT_TYPE_PREVIEW;
908 ((camera_preview_cb)cb_info->user_cb[e_type])(&frame, cb_info->user_data[e_type]);
911 /* call media packet callback */
912 if (cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW]) {
913 ret = _camera_media_packet_data_create(tbm_key, num_buffer_key, bo, buffer_bo, &mp_data);
915 if (ret == CAMERA_ERROR_NONE) {
916 ret = _camera_media_packet_create(cb_info, stream, mp_data, &pkt);
918 int e_type = MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW;
919 if (ret == CAMERA_ERROR_NONE) {
920 ((camera_media_packet_preview_cb)cb_info->user_cb[e_type])(pkt, cb_info->user_data[e_type]);
928 /* call evas renderer */
929 if (CHECK_PREVIEW_CB(cb_info, PREVIEW_CB_TYPE_EVAS)) {
930 ret = _camera_media_packet_data_create(tbm_key, num_buffer_key, bo, buffer_bo, &mp_data);
932 if (ret == CAMERA_ERROR_NONE) {
933 ret = _camera_media_packet_create(cb_info, stream, mp_data, &pkt);
935 if (ret == CAMERA_ERROR_NONE) {
936 g_mutex_lock(&cb_info->evas_mutex);
938 if (cb_info->run_evas_render)
939 mm_evas_renderer_write(pkt, cb_info->evas_info);
941 LOGW("evas renderer is stopped, skip this buffer...");
942 media_packet_destroy(pkt);
947 g_mutex_unlock(&cb_info->evas_mutex);
955 /* send message for preview callback return */
956 if (!CHECK_PREVIEW_CB(cb_info, PREVIEW_CB_TYPE_EVAS))
957 muse_camera_msg_send_no_return(MUSE_CAMERA_API_PREVIEW_CB_RETURN, cb_info->fd, cb_info);
959 if (mp_data == NULL) {
960 /* release imported bo */
961 for (i = 0 ; i < num_buffer_key ; i++)
962 _release_imported_bo(&buffer_bo[i]);
964 /* unmap and unref tbm bo */
965 _release_imported_bo(&bo);
968 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
969 cb_info->fd, cb_info, INT, tbm_key);
971 /*LOGD("return buffer Done");*/
975 case MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS:
979 muse_camera_msg_get(percent, recv_msg);
981 LOGD("HDR progress - %d \%", percent);
983 ((camera_attr_hdr_progress_cb)cb_info->user_cb[event])(percent, cb_info->user_data[event]);
986 case MUSE_CAMERA_EVENT_TYPE_INTERRUPTED:
992 muse_camera_msg_get(policy, recv_msg);
993 muse_camera_msg_get(previous, recv_msg);
994 muse_camera_msg_get(current, recv_msg);
996 LOGD("INTERRUPTED - policy %d, state previous %d, current %d",
997 policy, previous, current);
999 ((camera_interrupted_cb)cb_info->user_cb[event])((camera_policy_e)policy,
1000 (camera_state_e)previous, (camera_state_e)current, cb_info->user_data[event]);
1003 case MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION:
1006 camera_detected_face_s *faces = NULL;
1008 muse_camera_msg_get(count, recv_msg);
1009 muse_camera_msg_get(tbm_key, recv_msg);
1011 if (count > 0 && tbm_key > 0) {
1012 LOGD("FACE_DETECTION - count %d, tbm_key %d", count, tbm_key);
1014 if (!_import_tbm_key(cb_info->bufmgr, tbm_key, &bo, &bo_handle))
1018 faces = bo_handle.ptr;
1020 ((camera_face_detected_cb)cb_info->user_cb[event])(faces, count, cb_info->user_data[event]);
1026 for (i = 0 ; i < count ; i++) {
1027 LOGD("id[%2d] - score %d, position (%d,%d,%dx%d)",
1028 i, faces[i].score, faces[i].x, faces[i].y, faces[i].width, faces[i].height);
1034 _release_imported_bo(&bo);
1037 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
1038 cb_info->fd, cb_info, INT, tbm_key);
1040 LOGD("return buffer done");
1042 LOGE("invalid message - count %d, key %d", count, tbm_key);
1046 case MUSE_CAMERA_EVENT_TYPE_ERROR:
1049 int current_state = 0;
1051 muse_camera_msg_get(error, recv_msg);
1052 muse_camera_msg_get(current_state, recv_msg);
1054 LOGE("ERROR - error 0x%x, current_state %d", error, current_state);
1056 ((camera_error_cb)cb_info->user_cb[event])((camera_error_e)error,
1057 (camera_state_e)current_state, cb_info->user_data[event]);
1060 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_RESOLUTION:
1061 muse_camera_msg_get(param1, recv_msg);
1062 muse_camera_msg_get(param2, recv_msg);
1064 LOGD("SUPPORTED_PREVIEW_RESOLUTION - %d x %d", param1, param2);
1066 if (((camera_supported_preview_resolution_cb)cb_info->user_cb[event])(param1, param2, 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_PREVIEW_RESOLUTION");
1072 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_RESOLUTION:
1073 muse_camera_msg_get(param1, recv_msg);
1074 muse_camera_msg_get(param2, recv_msg);
1076 LOGD("SUPPORTED_CAPTURE_RESOLUTION - %d x %d", param1, param2);
1078 if (((camera_supported_capture_resolution_cb)cb_info->user_cb[event])(param1, param2, cb_info->user_data[event]) == false) {
1079 cb_info->user_cb[event] = NULL;
1080 cb_info->user_data[event] = NULL;
1081 LOGD("stop foreach callback for SUPPORTED_CAPTURE_RESOLUTION");
1084 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_FORMAT:
1085 muse_camera_msg_get(param1, recv_msg);
1087 LOGD("SUPPORTED_CAPTURE_FORMAT - %d ", param1);
1089 if (((camera_supported_capture_format_cb)cb_info->user_cb[event])((camera_pixel_format_e)param1, cb_info->user_data[event]) == false) {
1090 cb_info->user_cb[event] = NULL;
1091 cb_info->user_data[event] = NULL;
1092 LOGD("stop foreach callback for SUPPORTED_CAPTURE_FORMAT");
1095 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_FORMAT:
1096 muse_camera_msg_get(param1, recv_msg);
1098 LOGD("SUPPORTED_PREVIEW_FORMAT - %d ", param1);
1100 if (((camera_supported_preview_format_cb)cb_info->user_cb[event])((camera_pixel_format_e)param1, cb_info->user_data[event]) == false) {
1101 cb_info->user_cb[event] = NULL;
1102 cb_info->user_data[event] = NULL;
1103 LOGD("stop foreach callback for SUPPORTED_PREVIEW_FORMAT");
1106 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_AF_MODE:
1107 muse_camera_msg_get(param1, recv_msg);
1109 LOGD("SUPPORTED_AF_MODE - %d ", param1);
1111 if (((camera_attr_supported_af_mode_cb)cb_info->user_cb[event])((camera_attr_af_mode_e)param1, cb_info->user_data[event]) == false) {
1112 cb_info->user_cb[event] = NULL;
1113 cb_info->user_data[event] = NULL;
1114 LOGD("stop foreach callback for SUPPORTED_AF_MODE");
1117 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EXPOSURE_MODE:
1118 muse_camera_msg_get(param1, recv_msg);
1120 LOGD("SUPPORTED_EXPOSURE_MODE - %d ", param1);
1122 if (((camera_attr_supported_exposure_mode_cb)cb_info->user_cb[event])((camera_attr_exposure_mode_e)param1, cb_info->user_data[event]) == false) {
1123 cb_info->user_cb[event] = NULL;
1124 cb_info->user_data[event] = NULL;
1125 LOGD("stop foreach callback for SUPPORTED_EXPOSURE_MODE");
1128 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_ISO:
1129 muse_camera_msg_get(param1, recv_msg);
1131 LOGD("SUPPORTED_ISO - %d ", param1);
1133 if (((camera_attr_supported_iso_cb)cb_info->user_cb[event])((camera_attr_iso_e)param1, cb_info->user_data[event]) == false) {
1134 cb_info->user_cb[event] = NULL;
1135 cb_info->user_data[event] = NULL;
1136 LOGD("stop foreach callback for SUPPORTED_ISO");
1139 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_WHITEBALANCE:
1140 muse_camera_msg_get(param1, recv_msg);
1142 LOGD("SUPPORTED_WHITEBALANCE - %d ", param1);
1144 if (((camera_attr_supported_whitebalance_cb)cb_info->user_cb[event])((camera_attr_whitebalance_e)param1, cb_info->user_data[event]) == false) {
1145 cb_info->user_cb[event] = NULL;
1146 cb_info->user_data[event] = NULL;
1147 LOGD("stop foreach callback for SUPPORTED_WHITEBALANCE");
1150 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EFFECT:
1151 muse_camera_msg_get(param1, recv_msg);
1153 LOGD("SUPPORTED_EFFECT - %d ", param1);
1155 if (((camera_attr_supported_effect_cb)cb_info->user_cb[event])((camera_attr_effect_mode_e)param1, cb_info->user_data[event]) == false) {
1156 cb_info->user_cb[event] = NULL;
1157 cb_info->user_data[event] = NULL;
1158 LOGD("stop foreach callback for SUPPORTED_EFFECT");
1161 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_SCENE_MODE:
1162 muse_camera_msg_get(param1, recv_msg);
1164 LOGD("SUPPORTED_SCENE_MODE - %d ", param1);
1166 if (((camera_attr_supported_scene_mode_cb)cb_info->user_cb[event])((camera_attr_scene_mode_e)param1, cb_info->user_data[event]) == false) {
1167 cb_info->user_cb[event] = NULL;
1168 cb_info->user_data[event] = NULL;
1169 LOGD("stop foreach callback for SUPPORTED_SCENE_MODE");
1172 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FLASH_MODE:
1173 muse_camera_msg_get(param1, recv_msg);
1175 LOGD("SUPPORTED_FLASH_MODE - %d ", param1);
1177 if (((camera_attr_supported_flash_mode_cb)cb_info->user_cb[event])((camera_attr_flash_mode_e)param1, cb_info->user_data[event]) == false) {
1178 cb_info->user_cb[event] = NULL;
1179 cb_info->user_data[event] = NULL;
1180 LOGD("stop foreach callback for SUPPORTED_FLASH_MODE");
1183 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS:
1184 muse_camera_msg_get(param1, recv_msg);
1186 LOGD("SUPPORTED_FPS - %d ", param1);
1188 if (((camera_attr_supported_fps_cb)cb_info->user_cb[event])((camera_attr_fps_e)param1, cb_info->user_data[event]) == false) {
1189 cb_info->user_cb[event] = NULL;
1190 cb_info->user_data[event] = NULL;
1191 LOGD("stop foreach callback for SUPPORTED_FPS");
1194 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS_BY_RESOLUTION:
1195 muse_camera_msg_get(param1, recv_msg);
1197 LOGD("SUPPORTED_FPS_BY_RESOLUTION - %d ", param1);
1199 if (((camera_attr_supported_fps_cb)cb_info->user_cb[event])((camera_attr_fps_e)param1, cb_info->user_data[event]) == false) {
1200 cb_info->user_cb[event] = NULL;
1201 cb_info->user_data[event] = NULL;
1202 LOGD("stop foreach callback for SUPPORTED_FPS_BY_RESOLUTION");
1205 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_FLIP:
1206 muse_camera_msg_get(param1, recv_msg);
1208 LOGD("SUPPORTED_STREAM_FLIP - %d ", param1);
1210 if (((camera_attr_supported_stream_flip_cb)cb_info->user_cb[event])((camera_flip_e)param1, cb_info->user_data[event]) == false) {
1211 cb_info->user_cb[event] = NULL;
1212 cb_info->user_data[event] = NULL;
1213 LOGD("stop foreach callback for SUPPORTED_STREAM_FLIP");
1216 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION:
1217 muse_camera_msg_get(param1, recv_msg);
1219 LOGD("SUPPORTED_STREAM_ROTATION - %d ", param1);
1221 if (((camera_attr_supported_stream_rotation_cb)cb_info->user_cb[event])((camera_rotation_e)param1, cb_info->user_data[event]) == false) {
1222 cb_info->user_cb[event] = NULL;
1223 cb_info->user_data[event] = NULL;
1224 LOGD("stop foreach callback for SUPPORTED_STREAM_ROTATION");
1227 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE:
1228 muse_camera_msg_get(param1, recv_msg);
1230 LOGD("SUPPORTED_THEATER_MODE - %d ", param1);
1232 if (((camera_attr_supported_theater_mode_cb)cb_info->user_cb[event])((camera_attr_theater_mode_e)param1, cb_info->user_data[event]) == false) {
1233 cb_info->user_cb[event] = NULL;
1234 cb_info->user_data[event] = NULL;
1235 LOGD("stop foreach callback for SUPPORTED_THEATER_MODE");
1238 case MUSE_CAMERA_EVENT_TYPE_CAPTURE:
1240 camera_image_data_s *rImage = NULL;
1241 camera_image_data_s *rPostview = NULL;
1242 camera_image_data_s *rThumbnail = NULL;
1243 unsigned char *buf_pos = NULL;
1244 int tbm_key_main = 0;
1245 int tbm_key_post = 0;
1246 int tbm_key_thumb = 0;
1247 tbm_bo bo_main = NULL;
1248 tbm_bo bo_post = NULL;
1249 tbm_bo bo_thumb = NULL;
1250 tbm_bo_handle bo_main_handle = {NULL, };
1251 tbm_bo_handle bo_post_handle = {NULL, };
1252 tbm_bo_handle bo_thumb_handle = {NULL, };
1254 muse_camera_msg_get(tbm_key_main, recv_msg);
1255 muse_camera_msg_get(tbm_key_post, recv_msg);
1256 muse_camera_msg_get(tbm_key_thumb, recv_msg);
1258 LOGD("camera capture callback came in. tbm_key_main %d, tbm_key_post %d, tbm_key_thumb %d",
1259 tbm_key_main, tbm_key_post, tbm_key_thumb);
1261 if (tbm_key_main <= 0) {
1262 LOGE("invalid tbm_key_main %d", tbm_key_main);
1266 /* import tbm bo and get virtual address */
1267 if (!_import_tbm_key(cb_info->bufmgr, tbm_key_main, &bo_main, &bo_main_handle))
1270 buf_pos = (unsigned char *)bo_main_handle.ptr;
1271 rImage = (camera_image_data_s *)buf_pos;
1272 rImage->data = buf_pos + sizeof(camera_image_data_s);
1274 LOGD("image info %dx%d, size : %d", rImage->height, rImage->width, rImage->size);
1276 if (tbm_key_post > 0) {
1277 /* import tbm bo and get virtual address */
1278 if (!_import_tbm_key(cb_info->bufmgr, tbm_key_post, &bo_post, &bo_post_handle))
1281 buf_pos = (unsigned char *)bo_post_handle.ptr;
1282 rPostview = (camera_image_data_s *)buf_pos;
1283 LOGD("rPostview->size : %d", rPostview->size);
1284 rPostview->data = buf_pos + sizeof(camera_image_data_s);
1287 if (tbm_key_thumb > 0) {
1288 /* import tbm bo and get virtual address */
1289 if (!_import_tbm_key(cb_info->bufmgr, tbm_key_thumb, &bo_thumb, &bo_thumb_handle))
1292 buf_pos = (unsigned char *)bo_thumb_handle.ptr;
1294 rThumbnail = (camera_image_data_s *)buf_pos;
1295 LOGD("rThumbnail->size : %d", rThumbnail->size);
1296 rThumbnail->data = buf_pos + sizeof(camera_image_data_s);
1299 ((camera_capturing_cb)cb_info->user_cb[event])(rImage, rPostview, rThumbnail, cb_info->user_data[event]);
1301 /* unmap and unref tbm bo */
1302 _release_imported_bo(&bo_main);
1305 tbm_key = tbm_key_main;
1306 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
1307 cb_info->fd, cb_info, INT, tbm_key);
1309 if (tbm_key_post > 0) {
1310 /* unmap and unref tbm bo */
1311 _release_imported_bo(&bo_post);
1314 tbm_key = tbm_key_post;
1315 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
1316 cb_info->fd, cb_info, INT, tbm_key);
1319 if (tbm_key_thumb > 0) {
1320 /* unmap and unref tbm bo */
1321 _release_imported_bo(&bo_thumb);
1324 tbm_key = tbm_key_thumb;
1325 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
1326 cb_info->fd, cb_info, INT, tbm_key);
1329 LOGD("return buffer done");
1332 case MUSE_CAMERA_EVENT_TYPE_VIDEO_FRAME_RENDER_ERROR:
1335 LOGW("Unknown event : %d", event);
1342 static bool _camera_idle_event_callback(void *data)
1344 camera_cb_info_s *cb_info = NULL;
1345 camera_idle_event_s *cam_idle_event = (camera_idle_event_s *)data;
1347 if (cam_idle_event == NULL) {
1348 LOGE("cam_idle_event is NULL");
1353 g_mutex_lock(&cam_idle_event->event_mutex);
1355 cb_info = cam_idle_event->cb_info;
1356 if (cb_info == NULL) {
1357 LOGW("camera cb_info is NULL. event %d", cam_idle_event->event);
1358 goto IDLE_EVENT_CALLBACK_DONE;
1361 /* remove event from list */
1362 g_mutex_lock(&cb_info->idle_event_mutex);
1363 if (cb_info->idle_event_list)
1364 cb_info->idle_event_list = g_list_remove(cb_info->idle_event_list, (gpointer)cam_idle_event);
1366 /*LOGD("remove camera idle event %p, %p", cam_idle_event, cb_info->idle_event_list);*/
1367 g_mutex_unlock(&cb_info->idle_event_mutex);
1370 _client_user_callback(cam_idle_event->cb_info, cam_idle_event->recv_msg, cam_idle_event->event);
1372 /* send signal for waiting thread */
1373 g_cond_signal(&cb_info->idle_event_cond);
1375 IDLE_EVENT_CALLBACK_DONE:
1376 /* unlock and release event */
1377 g_mutex_unlock(&cam_idle_event->event_mutex);
1378 g_mutex_clear(&cam_idle_event->event_mutex);
1380 g_free(cam_idle_event);
1381 cam_idle_event = NULL;
1386 static void *_camera_msg_handler_func(gpointer data)
1391 int event_class = 0;
1392 camera_message_s *cam_msg = NULL;
1393 camera_idle_event_s *cam_idle_event = NULL;
1394 camera_cb_info_s *cb_info = (camera_cb_info_s *)data;
1396 if (cb_info == NULL) {
1397 LOGE("cb_info NULL");
1403 g_mutex_lock(&cb_info->msg_handler_mutex);
1405 while (g_atomic_int_get(&cb_info->msg_handler_running)) {
1406 if (g_queue_is_empty(cb_info->msg_queue)) {
1407 LOGD("signal wait...");
1408 g_cond_wait(&cb_info->msg_handler_cond, &cb_info->msg_handler_mutex);
1409 LOGD("signal received");
1411 if (g_atomic_int_get(&cb_info->msg_handler_running) == 0) {
1412 LOGD("stop event thread");
1417 cam_msg = (camera_message_s *)g_queue_pop_head(cb_info->msg_queue);
1419 g_mutex_unlock(&cb_info->msg_handler_mutex);
1421 if (cam_msg == NULL) {
1422 LOGE("NULL message");
1423 g_mutex_lock(&cb_info->msg_handler_mutex);
1429 if (api < MUSE_CAMERA_API_MAX) {
1430 g_mutex_lock(&cb_info->api_mutex[api]);
1432 if (muse_camera_msg_get(ret, cam_msg->recv_msg)) {
1433 cb_info->api_ret[api] = ret;
1434 cb_info->api_activating[api] = 1;
1436 LOGD("camera api %d - return 0x%x", ret);
1438 g_cond_signal(&cb_info->api_cond[api]);
1440 LOGE("failed to get camera ret for api %d, msg %s", api, cam_msg->recv_msg);
1443 g_mutex_unlock(&cb_info->api_mutex[api]);
1444 } else if (api == MUSE_CAMERA_CB_EVENT) {
1448 if (!muse_camera_msg_get(event, cam_msg->recv_msg) ||
1449 !muse_camera_msg_get(event_class, cam_msg->recv_msg)) {
1450 LOGE("failed to get camera event %d, class %d", event, event_class);
1455 g_mutex_lock(&cb_info->msg_handler_mutex);
1459 switch (event_class) {
1460 case MUSE_CAMERA_EVENT_CLASS_THREAD_SUB:
1461 _client_user_callback(cb_info, cam_msg->recv_msg, event);
1463 case MUSE_CAMERA_EVENT_CLASS_THREAD_MAIN:
1464 cam_idle_event = g_new0(camera_idle_event_s, 1);
1465 if (cam_idle_event == NULL) {
1466 LOGE("cam_idle_event alloc failed");
1470 cam_idle_event->event = event;
1471 cam_idle_event->cb_info = cb_info;
1472 g_mutex_init(&cam_idle_event->event_mutex);
1473 memcpy(cam_idle_event->recv_msg, cam_msg->recv_msg, sizeof(cam_idle_event->recv_msg));
1475 LOGD("add camera event[%d, %p] to IDLE", event, cam_idle_event);
1477 g_mutex_lock(&cb_info->idle_event_mutex);
1478 cb_info->idle_event_list = g_list_append(cb_info->idle_event_list, (gpointer)cam_idle_event);
1479 g_mutex_unlock(&cb_info->idle_event_mutex);
1481 g_idle_add_full(G_PRIORITY_DEFAULT,
1482 (GSourceFunc)_camera_idle_event_callback,
1483 (gpointer)cam_idle_event,
1487 LOGE("unknown camera event class %d", event_class);
1491 LOGE("unknown camera api[%d] message[%s]", api, cam_msg->recv_msg);
1497 g_mutex_lock(&cb_info->msg_handler_mutex);
1500 /* remove remained event */
1501 while (!g_queue_is_empty(cb_info->msg_queue)) {
1502 cam_msg = (camera_message_s *)g_queue_pop_head(cb_info->msg_queue);
1504 LOGD("remove camera message %p", cam_msg);
1508 LOGW("NULL camera message");
1512 g_mutex_unlock(&cb_info->msg_handler_mutex);
1519 static void _camera_remove_idle_event_all(camera_cb_info_s *cb_info)
1521 camera_idle_event_s *cam_idle_event = NULL;
1522 gboolean ret = TRUE;
1524 gint64 end_time = 0;
1526 if (cb_info == NULL) {
1527 LOGE("cb_info is NULL");
1531 g_mutex_lock(&cb_info->idle_event_mutex);
1533 if (cb_info->idle_event_list == NULL) {
1534 LOGD("No idle event is remained.");
1536 list = cb_info->idle_event_list;
1539 cam_idle_event = list->data;
1540 list = g_list_next(list);
1542 if (!cam_idle_event) {
1543 LOGW("Fail to remove idle event. The event is NULL");
1545 if (g_mutex_trylock(&cam_idle_event->event_mutex)) {
1546 ret = g_idle_remove_by_data(cam_idle_event);
1548 LOGD("remove idle event [%p], ret[%d]", cam_idle_event, ret);
1551 cam_idle_event->cb_info = NULL;
1552 LOGW("idle callback for event %p will be called later", cam_idle_event);
1555 cb_info->idle_event_list = g_list_remove(cb_info->idle_event_list, (gpointer)cam_idle_event);
1557 g_mutex_unlock(&cam_idle_event->event_mutex);
1560 g_mutex_clear(&cam_idle_event->event_mutex);
1562 g_free(cam_idle_event);
1563 cam_idle_event = NULL;
1565 LOGD("remove idle event done");
1568 LOGW("event lock failed. it's being called...");
1570 end_time = g_get_monotonic_time() + G_TIME_SPAN_MILLISECOND * 100;
1572 if (g_cond_wait_until(&cb_info->idle_event_cond, &cb_info->idle_event_mutex, end_time))
1573 LOGW("signal received");
1580 g_list_free(cb_info->idle_event_list);
1581 cb_info->idle_event_list = NULL;
1584 g_mutex_unlock(&cb_info->idle_event_mutex);
1589 static void *_camera_msg_recv_func(gpointer data)
1598 char *recv_msg = NULL;
1599 char **parse_str = NULL;
1600 camera_cb_info_s *cb_info = (camera_cb_info_s *)data;
1602 if (cb_info == NULL) {
1603 LOGE("cb_info NULL");
1609 parse_str = (char **)malloc(sizeof(char *) * CAMERA_PARSE_STRING_SIZE);
1610 if (parse_str == NULL) {
1611 LOGE("parse_str malloc failed");
1615 for (i = 0 ; i < CAMERA_PARSE_STRING_SIZE ; i++) {
1616 parse_str[i] = (char *)malloc(sizeof(char) * MUSE_CAMERA_MSG_MAX_LENGTH);
1617 if (parse_str[i] == NULL) {
1618 LOGE("parse_str[%d] malloc failed", i);
1619 goto CB_HANDLER_EXIT;
1623 recv_msg = cb_info->recv_msg;
1625 while (g_atomic_int_get(&cb_info->msg_recv_running)) {
1626 ret = muse_core_ipc_recv_msg(cb_info->fd, recv_msg);
1629 recv_msg[ret] = '\0';
1635 /*LOGD("recvMSg : %s, length : %d", recv_msg, ret);*/
1637 /* Need to split the combined entering msgs.
1638 This module supports up to 200 combined msgs. */
1639 for (str_pos = 0; str_pos < ret; str_pos++) {
1640 if (recv_msg[str_pos] == '}') {
1641 memset(parse_str[num_token], 0x0, sizeof(char) * MUSE_CAMERA_MSG_MAX_LENGTH);
1642 strncpy(parse_str[num_token], recv_msg + prev_pos, str_pos - prev_pos + 1);
1643 LOGD("splitted msg : [%s], Index : %d", parse_str[num_token], num_token);
1644 prev_pos = str_pos+1;
1649 /*LOGD("num_token : %d", num_token);*/
1651 /* Re-construct to the useful single msg. */
1652 for (i = 0; i < num_token; i++) {
1653 if (i >= CAMERA_PARSE_STRING_SIZE) {
1654 LOGE("invalid token index %d", i);
1661 if (!muse_camera_msg_get(api, parse_str[i])) {
1662 LOGE("failed to get camera api");
1666 if (api != MUSE_CAMERA_CB_EVENT) {
1667 LOGD("check api_class");
1668 if (muse_camera_msg_get(api_class, parse_str[i]))
1669 LOGD("camera api_class[%d]", api_class);
1672 if (api_class == MUSE_CAMERA_API_CLASS_IMMEDIATE) {
1673 g_mutex_lock(&cb_info->api_mutex[api]);
1675 if (!muse_camera_msg_get(ret, parse_str[i])) {
1676 LOGE("failed to get camera ret");
1677 g_mutex_unlock(&cb_info->api_mutex[api]);
1681 cb_info->api_ret[api] = ret;
1682 cb_info->api_activating[api] = 1;
1684 if (api == MUSE_CAMERA_API_CREATE) {
1685 if (ret != CAMERA_ERROR_NONE) {
1686 g_atomic_int_set(&cb_info->msg_recv_running, 0);
1687 LOGE("camera create error 0x%x. close client cb handler", ret);
1689 } else if (api == MUSE_CAMERA_API_DESTROY) {
1690 if (ret == CAMERA_ERROR_NONE) {
1691 g_atomic_int_set(&cb_info->msg_recv_running, 0);
1692 LOGD("camera destroy done. close client cb handler");
1696 g_cond_signal(&cb_info->api_cond[api]);
1697 g_mutex_unlock(&cb_info->api_mutex[api]);
1698 } else if (api_class == MUSE_CAMERA_API_CLASS_THREAD_SUB || api == MUSE_CAMERA_CB_EVENT) {
1699 camera_message_s *cam_msg = g_new0(camera_message_s, 1);
1700 if (cam_msg == NULL) {
1701 LOGE("failed to alloc cam_msg");
1706 memcpy(cam_msg->recv_msg, parse_str[i], sizeof(cam_msg->recv_msg));
1708 LOGD("add camera message to queue : api %d", api);
1710 g_mutex_lock(&cb_info->msg_handler_mutex);
1711 g_queue_push_tail(cb_info->msg_queue, (gpointer)cam_msg);
1712 g_cond_signal(&cb_info->msg_handler_cond);
1713 g_mutex_unlock(&cb_info->msg_handler_mutex);
1715 LOGW("unknown camera api %d and api_class %d", api, api_class);
1721 LOGD("client cb exit");
1725 for (i = 0 ; i < CAMERA_PARSE_STRING_SIZE ; i++) {
1728 parse_str[i] = NULL;
1739 static camera_cb_info_s *_client_callback_new(gint sockfd)
1741 camera_cb_info_s *cb_info = NULL;
1742 gint *tmp_activating = NULL;
1743 gint *tmp_ret = NULL;
1746 g_return_val_if_fail(sockfd > 0, NULL);
1748 cb_info = g_new0(camera_cb_info_s, 1);
1749 if (cb_info == NULL) {
1750 LOGE("cb_info failed");
1754 g_mutex_init(&cb_info->msg_handler_mutex);
1755 g_cond_init(&cb_info->msg_handler_cond);
1756 g_mutex_init(&cb_info->idle_event_mutex);
1757 g_cond_init(&cb_info->idle_event_cond);
1758 g_mutex_init(&cb_info->mp_data_mutex);
1759 g_mutex_init(&cb_info->evas_mutex);
1761 for (i = 0 ; i < MUSE_CAMERA_API_MAX ; i++) {
1762 g_mutex_init(&cb_info->api_mutex[i]);
1763 g_cond_init(&cb_info->api_cond[i]);
1766 tmp_activating = g_new0(gint, MUSE_CAMERA_API_MAX);
1767 if (tmp_activating == NULL) {
1768 LOGE("tmp_activating failed");
1772 tmp_ret = g_new0(gint, MUSE_CAMERA_API_MAX);
1773 if (tmp_ret == NULL) {
1774 LOGE("tmp_ret failed");
1778 cb_info->msg_queue = g_queue_new();
1779 if (cb_info->msg_queue == NULL) {
1780 LOGE("msg_queue new failed");
1784 g_atomic_int_set(&cb_info->msg_handler_running, 1);
1785 cb_info->msg_handler_thread = g_thread_try_new("camera_msg_handler",
1786 _camera_msg_handler_func, (gpointer)cb_info, NULL);
1787 if (cb_info->msg_handler_thread == NULL) {
1788 LOGE("message handler thread creation failed");
1792 cb_info->fd = sockfd;
1793 cb_info->api_activating = tmp_activating;
1794 cb_info->api_ret = tmp_ret;
1795 cb_info->preview_cb_flag = 0;
1796 cb_info->evas_info = NULL;
1798 g_atomic_int_set(&cb_info->msg_recv_running, 1);
1799 cb_info->msg_recv_thread = g_thread_try_new("camera_msg_recv",
1800 _camera_msg_recv_func, (gpointer)cb_info, NULL);
1801 if (cb_info->msg_recv_thread == NULL) {
1802 LOGE("message receive thread creation failed");
1810 if (cb_info->msg_handler_thread) {
1811 g_mutex_lock(&cb_info->msg_handler_mutex);
1812 g_atomic_int_set(&cb_info->msg_handler_running, 0);
1813 g_cond_signal(&cb_info->msg_handler_cond);
1814 g_mutex_unlock(&cb_info->msg_handler_mutex);
1816 g_thread_join(cb_info->msg_handler_thread);
1817 g_thread_unref(cb_info->msg_handler_thread);
1818 cb_info->msg_handler_thread = NULL;
1821 for (i = 0 ; i < MUSE_CAMERA_API_MAX ; i++) {
1822 g_mutex_clear(&cb_info->api_mutex[i]);
1823 g_cond_clear(&cb_info->api_cond[i]);
1826 g_mutex_clear(&cb_info->msg_handler_mutex);
1827 g_cond_clear(&cb_info->msg_handler_cond);
1828 g_mutex_clear(&cb_info->idle_event_mutex);
1829 g_cond_clear(&cb_info->idle_event_cond);
1830 g_mutex_clear(&cb_info->mp_data_mutex);
1831 g_mutex_clear(&cb_info->evas_mutex);
1833 if (cb_info->msg_queue) {
1834 g_queue_free(cb_info->msg_queue);
1835 cb_info->msg_queue = NULL;
1842 if (tmp_activating) {
1843 g_free(tmp_activating);
1844 tmp_activating = NULL;
1854 static void _client_callback_destroy(camera_cb_info_s *cb_info)
1858 g_return_if_fail(cb_info != NULL);
1860 LOGD("MSG receive thread[%p] destroy", cb_info->msg_recv_thread);
1862 g_thread_join(cb_info->msg_recv_thread);
1863 g_thread_unref(cb_info->msg_recv_thread);
1864 cb_info->msg_recv_thread = NULL;
1866 LOGD("msg thread removed");
1868 g_mutex_lock(&cb_info->msg_handler_mutex);
1869 g_atomic_int_set(&cb_info->msg_handler_running, 0);
1870 g_cond_signal(&cb_info->msg_handler_cond);
1871 g_mutex_unlock(&cb_info->msg_handler_mutex);
1873 g_thread_join(cb_info->msg_handler_thread);
1874 g_thread_unref(cb_info->msg_handler_thread);
1875 cb_info->msg_handler_thread = NULL;
1877 g_queue_free(cb_info->msg_queue);
1878 cb_info->msg_queue = NULL;
1880 for (i = 0 ; i < MUSE_CAMERA_API_MAX ; i++) {
1881 g_mutex_clear(&cb_info->api_mutex[i]);
1882 g_cond_clear(&cb_info->api_cond[i]);
1885 g_mutex_clear(&cb_info->msg_handler_mutex);
1886 g_cond_clear(&cb_info->msg_handler_cond);
1887 g_mutex_clear(&cb_info->idle_event_mutex);
1888 g_cond_clear(&cb_info->idle_event_cond);
1889 g_mutex_clear(&cb_info->mp_data_mutex);
1890 g_mutex_clear(&cb_info->evas_mutex);
1892 LOGD("event thread removed");
1894 if (cb_info->fd > -1) {
1895 muse_core_connection_close(cb_info->fd);
1899 if (cb_info->bufmgr) {
1900 tbm_bufmgr_deinit(cb_info->bufmgr);
1901 cb_info->bufmgr = NULL;
1903 if (cb_info->api_activating) {
1904 g_free(cb_info->api_activating);
1905 cb_info->api_activating = NULL;
1907 if (cb_info->api_ret) {
1908 g_free(cb_info->api_ret);
1909 cb_info->api_ret = NULL;
1911 if (cb_info->pkt_fmt) {
1912 media_format_unref(cb_info->pkt_fmt);
1913 cb_info->pkt_fmt = NULL;
1916 if (cb_info->evas_info)
1917 mm_evas_renderer_destroy(&cb_info->evas_info);
1919 cb_info->preview_cb_flag = 0;
1928 int _camera_start_evas_rendering(camera_h camera)
1930 int ret = CAMERA_ERROR_NONE;
1931 camera_cli_s *pc = (camera_cli_s *)camera;
1933 if (camera == NULL) {
1934 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
1935 return CAMERA_ERROR_INVALID_PARAMETER;
1938 if (pc->cb_info == NULL) {
1939 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
1940 return CAMERA_ERROR_INVALID_PARAMETER;
1945 if (!CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
1946 LOGE("EVAS surface is not set");
1947 return CAMERA_ERROR_NONE;
1950 g_mutex_lock(&pc->cb_info->evas_mutex);
1952 /* set evas render flag as RUN */
1953 pc->cb_info->run_evas_render = true;
1954 ret = CAMERA_ERROR_NONE;
1956 g_mutex_unlock(&pc->cb_info->evas_mutex);
1962 int _camera_stop_evas_rendering(camera_h camera, bool keep_screen)
1964 int ret = CAMERA_ERROR_NONE;
1965 camera_cli_s *pc = (camera_cli_s *)camera;
1967 if (camera == NULL) {
1968 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
1969 return CAMERA_ERROR_INVALID_PARAMETER;
1972 if (pc->cb_info == NULL) {
1973 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
1974 return CAMERA_ERROR_INVALID_PARAMETER;
1977 LOGD("stop - keep screen %d", keep_screen);
1979 if (!CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
1980 LOGE("EVAS surface is not set");
1981 return CAMERA_ERROR_NONE;
1984 g_mutex_lock(&pc->cb_info->evas_mutex);
1986 /* set evas render flag as STOP and release buffers */
1987 pc->cb_info->run_evas_render = false;
1988 ret = mm_evas_renderer_retrieve_all_packets(pc->cb_info->evas_info, keep_screen);
1989 if (ret != MM_ERROR_NONE) {
1990 LOGE("mm_evas_renderer_retrieve_all_packets failed 0x%x", ret);
1991 ret = CAMERA_ERROR_INVALID_OPERATION;
1994 g_mutex_unlock(&pc->cb_info->evas_mutex);
2000 int camera_create(camera_device_e device, camera_h *camera)
2004 int ret = CAMERA_ERROR_NONE;
2006 camera_cli_s *pc = NULL;
2007 tbm_bufmgr bufmgr = NULL;
2009 muse_camera_api_e api = MUSE_CAMERA_API_CREATE;
2010 muse_core_api_module_e muse_module = MUSE_CAMERA;
2011 int device_type = (int)device;
2013 if (camera == NULL) {
2014 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2015 return CAMERA_ERROR_INVALID_PARAMETER;
2018 bufmgr = tbm_bufmgr_init(-1);
2019 if (bufmgr == NULL) {
2020 LOGE("get tbm bufmgr failed");
2021 return CAMERA_ERROR_INVALID_OPERATION;
2024 sock_fd = muse_core_client_new();
2026 LOGE("muse_core_client_new failed - returned fd %d", sock_fd);
2027 ret = CAMERA_ERROR_INVALID_OPERATION;
2033 sndMsg = muse_core_msg_json_factory_new(api,
2034 MUSE_TYPE_INT, "module", muse_module,
2035 MUSE_TYPE_INT, PARAM_DEVICE_TYPE, device_type,
2036 MUSE_TYPE_INT, "pid", pid,
2039 muse_core_ipc_send_msg(sock_fd, sndMsg);
2040 muse_core_msg_json_factory_free(sndMsg);
2042 pc = g_new0(camera_cli_s, 1);
2044 LOGE("camera_cli_s alloc failed");
2045 ret = CAMERA_ERROR_OUT_OF_MEMORY;
2049 pc->cb_info = _client_callback_new(sock_fd);
2050 if (pc->cb_info == NULL) {
2051 LOGE("cb_info alloc failed");
2052 ret = CAMERA_ERROR_OUT_OF_MEMORY;
2056 LOGD("cb info : %d", pc->cb_info->fd);
2058 ret = _client_wait_for_cb_return(api, pc->cb_info, CALLBACK_TIME_OUT);
2059 if (ret == CAMERA_ERROR_NONE) {
2060 intptr_t handle = 0;
2061 muse_camera_msg_get_pointer(handle, pc->cb_info->recv_msg);
2063 LOGE("Receiving Handle Failed!!");
2064 ret = CAMERA_ERROR_INVALID_OPERATION;
2068 pc->remote_handle = handle;
2069 pc->cb_info->bufmgr = bufmgr;
2071 ret = camera_set_display((camera_h)pc, CAMERA_DISPLAY_TYPE_NONE, NULL);
2072 if (ret != CAMERA_ERROR_NONE) {
2073 LOGE("init display failed 0x%x", ret);
2077 LOGD("camera create 0x%x", pc->remote_handle);
2078 *camera = (camera_h)pc;
2086 tbm_bufmgr_deinit(bufmgr);
2090 _client_callback_destroy(pc->cb_info);
2096 LOGE("camera create error : 0x%x", ret);
2101 int camera_destroy(camera_h camera)
2103 if (camera == NULL) {
2104 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2105 return CAMERA_ERROR_INVALID_PARAMETER;
2108 int ret = CAMERA_ERROR_NONE;
2109 muse_camera_api_e api = MUSE_CAMERA_API_DESTROY;
2110 camera_cli_s *pc = (camera_cli_s *)camera;
2115 if (pc->cb_info == NULL) {
2116 LOGE("cb_info NULL, INVALID_PARAMETER");
2117 return CAMERA_ERROR_INVALID_PARAMETER;
2120 sock_fd = pc->cb_info->fd;
2122 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2123 if (ret == CAMERA_ERROR_NONE) {
2124 _camera_remove_idle_event_all(pc->cb_info);
2125 _client_callback_destroy(pc->cb_info);
2131 LOGE("camera destroy error : 0x%x", ret);
2137 int camera_start_preview(camera_h camera)
2139 int ret = CAMERA_ERROR_NONE;
2140 muse_camera_api_e api = MUSE_CAMERA_API_START_PREVIEW;
2141 camera_cli_s *pc = (camera_cli_s *)camera;
2144 if (camera == NULL) {
2145 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2146 return CAMERA_ERROR_INVALID_PARAMETER;
2149 if (pc->cb_info == NULL) {
2150 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2151 return CAMERA_ERROR_INVALID_PARAMETER;
2156 sock_fd = pc->cb_info->fd;
2158 muse_camera_msg_send_longtime(api, sock_fd, pc->cb_info, ret);
2160 if (ret != CAMERA_ERROR_NONE) {
2161 LOGE("start preview failed 0x%x", ret);
2163 } else if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
2164 ret = _camera_start_evas_rendering(camera);
2167 LOGD("ret : 0x%x", ret);
2169 return CAMERA_ERROR_NONE;
2172 int camera_stop_preview(camera_h camera)
2174 int ret = CAMERA_ERROR_NONE;
2176 camera_cli_s *pc = NULL;
2177 muse_camera_api_e api = MUSE_CAMERA_API_STOP_PREVIEW;
2179 if (camera == NULL) {
2180 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2181 return CAMERA_ERROR_INVALID_PARAMETER;
2184 pc = (camera_cli_s *)camera;
2186 if (pc->cb_info == NULL) {
2187 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2188 return CAMERA_ERROR_INVALID_PARAMETER;
2191 sock_fd = pc->cb_info->fd;
2195 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
2196 camera_state_e current_state = CAMERA_STATE_NONE;
2198 ret = camera_get_state(camera, ¤t_state);
2199 if (ret != CAMERA_ERROR_NONE) {
2200 LOGE("failed to get current state 0x%x", ret);
2204 if (current_state == CAMERA_STATE_PREVIEW) {
2205 ret = _camera_stop_evas_rendering(camera, false);
2206 if (ret != CAMERA_ERROR_NONE)
2211 /* send stop preview message */
2212 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2214 LOGD("ret : 0x%x", ret);
2219 int camera_start_capture(camera_h camera, camera_capturing_cb capturing_cb, camera_capture_completed_cb completed_cb, void *user_data)
2221 if (camera == NULL) {
2222 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2223 return CAMERA_ERROR_INVALID_PARAMETER;
2225 int ret = CAMERA_ERROR_NONE;
2227 camera_cli_s *pc = (camera_cli_s *)camera;
2228 muse_camera_api_e api = MUSE_CAMERA_API_START_CAPTURE;
2230 int is_capturing_cb = 0;
2231 int is_completed_cb = 0;
2232 LOGD("Enter, handle :%x", pc->remote_handle);
2234 if (pc->cb_info == NULL) {
2235 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2236 return CAMERA_ERROR_INVALID_PARAMETER;
2239 sock_fd = pc->cb_info->fd;
2241 if (capturing_cb != NULL) {
2242 is_capturing_cb = 1;
2243 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = capturing_cb;
2244 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = user_data;
2247 if (completed_cb != NULL) {
2248 is_completed_cb = 1;
2249 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = completed_cb;
2250 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = user_data;
2253 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, is_capturing_cb, INT, is_completed_cb);
2254 LOGD("is_capturing_cb :%d, is_completed_cb : %d", is_capturing_cb, is_completed_cb);
2255 LOGD("ret : 0x%x", ret);
2259 bool camera_is_supported_continuous_capture(camera_h camera)
2261 if (camera == NULL) {
2262 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2266 int ret = CAMERA_ERROR_NONE;
2267 camera_cli_s *pc = (camera_cli_s *)camera;
2268 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_CONTINUOUS_CAPTURE;
2271 if (pc->cb_info == NULL) {
2272 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2273 return CAMERA_ERROR_INVALID_PARAMETER;
2276 sock_fd = pc->cb_info->fd;
2278 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2279 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2280 LOGD("ret : 0x%x", ret);
2284 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)
2286 if (camera == NULL) {
2287 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2288 return CAMERA_ERROR_INVALID_PARAMETER;
2291 int ret = CAMERA_ERROR_NONE;
2293 camera_cli_s *pc = (camera_cli_s *)camera;
2294 muse_camera_api_e api = MUSE_CAMERA_API_START_CONTINUOUS_CAPTURE;
2296 LOGD("Enter, handle :%x", pc->remote_handle);
2299 if (pc->cb_info == NULL) {
2300 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2301 return CAMERA_ERROR_INVALID_PARAMETER;
2303 sock_fd = pc->cb_info->fd;
2305 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = capturing_cb;
2306 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = user_data;
2307 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = completed_cb;
2309 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, count, INT, interval);
2311 LOGD("ret : 0x%x", ret);
2316 int camera_stop_continuous_capture(camera_h camera)
2318 if (camera == NULL) {
2319 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2320 return CAMERA_ERROR_INVALID_PARAMETER;
2324 int ret = CAMERA_ERROR_NONE;
2326 camera_cli_s *pc = (camera_cli_s *)camera;
2327 muse_camera_api_e api = MUSE_CAMERA_API_STOP_CONTINUOUS_CAPTURE;
2328 LOGD("Enter, handle :%x", pc->remote_handle);
2330 if (pc->cb_info == NULL) {
2331 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2332 return CAMERA_ERROR_INVALID_PARAMETER;
2334 sock_fd = pc->cb_info->fd;
2335 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2336 LOGD("ret : 0x%x", ret);
2340 bool camera_is_supported_face_detection(camera_h camera)
2342 if (camera == NULL) {
2343 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2346 int ret = CAMERA_ERROR_NONE;
2348 camera_cli_s *pc = (camera_cli_s *)camera;
2349 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_FACE_DETECTION;
2351 if (pc->cb_info == NULL) {
2352 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2353 return CAMERA_ERROR_INVALID_PARAMETER;
2355 sock_fd = pc->cb_info->fd;
2357 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2358 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2359 LOGD("ret : 0x%x", ret);
2363 bool camera_is_supported_zero_shutter_lag(camera_h camera)
2365 if (camera == NULL) {
2366 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2369 int ret = CAMERA_ERROR_NONE;
2371 camera_cli_s *pc = (camera_cli_s *)camera;
2372 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_ZERO_SHUTTER_LAG;
2374 if (pc->cb_info == NULL) {
2375 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2376 return CAMERA_ERROR_INVALID_PARAMETER;
2378 sock_fd = pc->cb_info->fd;
2380 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2381 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2382 LOGD("ret : 0x%x", ret);
2386 bool camera_is_supported_media_packet_preview_cb(camera_h camera)
2388 if (camera == NULL) {
2389 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2393 int ret = CAMERA_ERROR_NONE;
2395 camera_cli_s *pc = (camera_cli_s *)camera;
2396 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_MEDIA_PACKET_PREVIEW_CB;
2398 if (pc->cb_info == NULL) {
2399 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2400 return CAMERA_ERROR_INVALID_PARAMETER;
2402 sock_fd = pc->cb_info->fd;
2404 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2405 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2406 LOGD("ret : 0x%x", ret);
2410 int camera_get_device_count(camera_h camera, int *device_count)
2412 if (camera == NULL || device_count == NULL) {
2413 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2414 return CAMERA_ERROR_INVALID_PARAMETER;
2416 int ret = CAMERA_ERROR_NONE;
2418 camera_cli_s *pc = (camera_cli_s *)camera;
2419 muse_camera_api_e api = MUSE_CAMERA_API_GET_DEVICE_COUNT;
2421 if (pc->cb_info == NULL) {
2422 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2423 return CAMERA_ERROR_INVALID_PARAMETER;
2425 sock_fd = pc->cb_info->fd;
2426 int get_device_count;
2428 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2429 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2431 if (ret == CAMERA_ERROR_NONE) {
2432 muse_camera_msg_get(get_device_count, pc->cb_info->recv_msg);
2433 *device_count = get_device_count;
2435 LOGD("ret : 0x%x", ret);
2439 int camera_start_face_detection(camera_h camera, camera_face_detected_cb callback, void *user_data)
2441 if (camera == NULL) {
2442 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2443 return CAMERA_ERROR_INVALID_PARAMETER;
2446 int ret = CAMERA_ERROR_NONE;
2448 camera_cli_s *pc = (camera_cli_s *)camera;
2449 muse_camera_api_e api = MUSE_CAMERA_API_START_FACE_DETECTION;
2451 LOGD("Enter, handle :%x", pc->remote_handle);
2453 if (pc->cb_info == NULL) {
2454 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2455 return CAMERA_ERROR_INVALID_PARAMETER;
2457 sock_fd = pc->cb_info->fd;
2458 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION] = callback;
2459 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION] = user_data;
2461 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2462 LOGD("ret : 0x%x", ret);
2466 int camera_stop_face_detection(camera_h camera)
2468 if (camera == NULL) {
2469 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2470 return CAMERA_ERROR_INVALID_PARAMETER;
2473 int ret = CAMERA_ERROR_NONE;
2475 camera_cli_s *pc = (camera_cli_s *)camera;
2476 muse_camera_api_e api = MUSE_CAMERA_API_STOP_FACE_DETECTION;
2477 LOGD("Enter, handle :%x", pc->remote_handle);
2479 if (pc->cb_info == NULL) {
2480 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2481 return CAMERA_ERROR_INVALID_PARAMETER;
2483 sock_fd = pc->cb_info->fd;
2484 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2485 LOGD("ret : 0x%x", ret);
2489 int camera_get_state(camera_h camera, camera_state_e *state)
2491 if (camera == NULL || state == NULL) {
2492 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2493 return CAMERA_ERROR_INVALID_PARAMETER;
2495 int ret = CAMERA_ERROR_NONE;
2497 camera_cli_s *pc = (camera_cli_s *)camera;
2498 muse_camera_api_e api = MUSE_CAMERA_API_GET_STATE;
2500 if (pc->cb_info == NULL) {
2501 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2502 return CAMERA_ERROR_INVALID_PARAMETER;
2504 sock_fd = pc->cb_info->fd;
2507 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2508 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2510 if (ret == CAMERA_ERROR_NONE) {
2511 muse_camera_msg_get(get_state, pc->cb_info->recv_msg);
2512 *state = (camera_state_e)get_state;
2514 LOGD("ret : 0x%x", ret);
2518 int camera_start_focusing(camera_h camera, bool continuous)
2520 if (camera == NULL) {
2521 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2522 return CAMERA_ERROR_INVALID_PARAMETER;
2525 int ret = CAMERA_ERROR_NONE;
2527 camera_cli_s *pc = (camera_cli_s *)camera;
2528 muse_camera_api_e api = MUSE_CAMERA_API_START_FOCUSING;
2530 if (pc->cb_info == NULL) {
2531 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2532 return CAMERA_ERROR_INVALID_PARAMETER;
2534 sock_fd = pc->cb_info->fd;
2535 int is_continuous = (int)continuous;
2537 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2538 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, is_continuous);
2539 LOGD("ret : 0x%x", ret);
2543 int camera_cancel_focusing(camera_h camera)
2545 if (camera == NULL) {
2546 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2547 return CAMERA_ERROR_INVALID_PARAMETER;
2550 int ret = CAMERA_ERROR_NONE;
2552 camera_cli_s *pc = (camera_cli_s *)camera;
2553 muse_camera_api_e api = MUSE_CAMERA_API_CANCEL_FOCUSING;
2555 if (pc->cb_info == NULL) {
2556 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2557 return CAMERA_ERROR_INVALID_PARAMETER;
2559 sock_fd = pc->cb_info->fd;
2561 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2562 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2563 LOGD("ret : 0x%x", ret);
2567 int camera_set_display(camera_h camera, camera_display_type_e type, camera_display_h display)
2569 int ret = CAMERA_ERROR_NONE;
2570 void *set_display_handle = NULL;
2571 Evas_Object *obj = NULL;
2572 const char *object_type = NULL;
2574 camera_wl_info_s *wl_info = NULL;
2575 #endif /* HAVE_WAYLAND */
2576 camera_cli_s *pc = (camera_cli_s *)camera;
2577 camera_cb_info_s *cb_info = NULL;
2578 muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY;
2579 camera_state_e current_state = CAMERA_STATE_NONE;
2582 if (camera == NULL) {
2583 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2584 return CAMERA_ERROR_INVALID_PARAMETER;
2587 if (type < CAMERA_DISPLAY_TYPE_OVERLAY || type > CAMERA_DISPLAY_TYPE_NONE) {
2588 LOGE("invalid type %d", type);
2589 return CAMERA_ERROR_INVALID_PARAMETER;
2592 if (type != CAMERA_DISPLAY_TYPE_NONE && display == NULL) {
2593 LOGE("display type[%d] is not NONE, but display handle is NULL", type);
2594 return CAMERA_ERROR_INVALID_PARAMETER;
2597 if (pc->cb_info == NULL) {
2598 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2599 return CAMERA_ERROR_INVALID_PARAMETER;
2602 cb_info = (camera_cb_info_s *)pc->cb_info;
2603 sock_fd = cb_info->fd;
2605 ret = camera_get_state(camera, ¤t_state);
2606 if (ret != CAMERA_ERROR_NONE) {
2607 LOGE("failed to get current state 0x%x", ret);
2611 if (current_state != CAMERA_STATE_CREATED) {
2612 LOGE("INVALID_STATE : current %d", current_state);
2613 return CAMERA_ERROR_INVALID_STATE;
2616 LOGD("Enter, remote_handle : %x display : 0x%x", pc->remote_handle, display);
2618 if (type == CAMERA_DISPLAY_TYPE_NONE) {
2619 set_display_handle = 0;
2620 LOGD("display type NONE");
2622 obj = (Evas_Object *)display;
2623 object_type = evas_object_type_get(obj);
2625 if (type == CAMERA_DISPLAY_TYPE_OVERLAY && !strcmp(object_type, "elm_win")) {
2627 /* get wayland parent id */
2628 if (_get_wl_info(obj, &pc->wl_info) != CAMERA_ERROR_NONE) {
2629 LOGE("failed to get wayland info");
2630 return CAMERA_ERROR_INVALID_OPERATION;
2633 set_display_handle = (void *)&pc->wl_info;
2634 #else /* HAVE_WAYLAND */
2635 /* x window overlay surface */
2636 set_display_handle = (void *)elm_win_xwindow_get(obj);
2637 #endif /* HAVE_WAYLAND */
2638 LOGD("display type OVERLAY : handle %p", set_display_handle);
2639 } else if (type == CAMERA_DISPLAY_TYPE_EVAS && !strcmp(object_type, "image")) {
2640 /* evas object surface */
2641 set_display_handle = (void *)display;
2642 LOGD("display type EVAS : handle %p", set_display_handle);
2644 g_mutex_lock(&cb_info->evas_mutex);
2646 if (cb_info->evas_info) {
2647 LOGW("destroy existed evas renderer %p", cb_info->evas_info);
2648 ret = mm_evas_renderer_destroy(&cb_info->evas_info);
2649 if (ret != MM_ERROR_NONE) {
2650 LOGE("failed to destroy evas renderer %p", cb_info->evas_info);
2651 g_mutex_unlock(&cb_info->evas_mutex);
2652 return CAMERA_ERROR_INVALID_OPERATION;
2656 /* create evas renderer */
2657 ret = mm_evas_renderer_create(&cb_info->evas_info, (Evas_Object *)set_display_handle);
2658 if (ret == MM_ERROR_NONE) {
2659 camera_flip_e flip = CAMERA_FLIP_NONE;
2660 camera_display_mode_e mode = CAMERA_DISPLAY_MODE_LETTER_BOX;
2661 camera_rotation_e rotation = CAMERA_ROTATION_NONE;
2664 camera_get_display_flip(camera, &flip);
2665 camera_get_display_mode(camera, &mode);
2666 camera_get_display_rotation(camera, &rotation);
2667 camera_is_display_visible(camera, &visible);
2669 LOGD("current setting : flip %d, mode %d, rotation %d, visible %d",
2670 flip, mode, rotation, visible);
2672 ret = mm_evas_renderer_set_flip(cb_info->evas_info, flip);
2673 ret |= mm_evas_renderer_set_geometry(cb_info->evas_info, mode);
2674 ret |= mm_evas_renderer_set_rotation(cb_info->evas_info, rotation);
2675 ret |= mm_evas_renderer_set_visible(cb_info->evas_info, visible);
2678 g_mutex_unlock(&cb_info->evas_mutex);
2680 if (ret != MM_ERROR_NONE) {
2681 LOGE("mm_evas_renderer error 0x%x", ret);
2682 return CAMERA_ERROR_INVALID_OPERATION;
2686 LOGE("unknown evas object [%p,%s] or type [%d] mismatch", obj, object_type, type);
2687 return CAMERA_ERROR_INVALID_PARAMETER;
2690 LOGE("failed to get evas object type from %p", obj);
2691 return CAMERA_ERROR_INVALID_PARAMETER;
2695 pc->display_handle = (intptr_t)set_display_handle;
2697 if (type == CAMERA_DISPLAY_TYPE_OVERLAY) {
2699 wl_info = &pc->wl_info;
2700 muse_camera_msg_send_array_and_value(api, sock_fd, cb_info, ret,
2701 wl_info, 5, sizeof(int), INT, type);
2703 LOGD("wayland parent id : %d, window %d,%d,%dx%d",
2704 wl_info->parent_id, wl_info->window_x, wl_info->window_y,
2705 wl_info->window_width, wl_info->window_height);
2706 #else /* HAVE_WAYLAND */
2707 muse_camera_msg_send2(api, sock_fd, cb_info, ret, INT, type, INT, set_display_handle);
2709 LOGD("x id : %d", (int)set_display_handle);
2710 #endif /* HAVE_WAYLAND */
2712 muse_camera_msg_send1(api, sock_fd, cb_info, ret, INT, type);
2714 if (ret != CAMERA_ERROR_NONE) {
2715 LOGE("set display error 0x%x", ret);
2716 } else if (type == CAMERA_DISPLAY_TYPE_EVAS) {
2717 SET_PREVIEW_CB_TYPE(cb_info, PREVIEW_CB_TYPE_EVAS);
2723 int camera_set_preview_resolution(camera_h camera, int width, int height)
2725 if (camera == NULL) {
2726 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2727 return CAMERA_ERROR_INVALID_PARAMETER;
2729 int ret = CAMERA_ERROR_NONE;
2731 camera_cli_s *pc = (camera_cli_s *)camera;
2732 muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_RESOLUTION;
2734 if (pc->cb_info == NULL) {
2735 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2736 return CAMERA_ERROR_INVALID_PARAMETER;
2738 sock_fd = pc->cb_info->fd;
2740 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2741 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, width, INT, height);
2742 LOGD("ret : 0x%x", ret);
2747 int camera_set_capture_resolution(camera_h camera, int width, int height)
2749 if (camera == NULL) {
2750 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2751 return CAMERA_ERROR_INVALID_PARAMETER;
2754 int ret = CAMERA_ERROR_NONE;
2756 camera_cli_s *pc = (camera_cli_s *)camera;
2757 muse_camera_api_e api = MUSE_CAMERA_API_SET_CAPTURE_RESOLUTION;
2759 if (pc->cb_info == NULL) {
2760 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2761 return CAMERA_ERROR_INVALID_PARAMETER;
2763 sock_fd = pc->cb_info->fd;
2765 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2766 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, width, INT, height);
2767 LOGD("ret : 0x%x", ret);
2771 int camera_set_capture_format(camera_h camera, camera_pixel_format_e format)
2773 if (camera == NULL) {
2774 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2775 return CAMERA_ERROR_INVALID_PARAMETER;
2778 int ret = CAMERA_ERROR_NONE;
2779 int set_format = (int)format;
2781 camera_cli_s *pc = (camera_cli_s *)camera;
2782 muse_camera_api_e api = MUSE_CAMERA_API_SET_CAPTURE_FORMAT;
2784 if (pc->cb_info == NULL) {
2785 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2786 return CAMERA_ERROR_INVALID_PARAMETER;
2788 sock_fd = pc->cb_info->fd;
2790 LOGD("Enter, remote_handle : %x, capture_format: %d", pc->remote_handle, set_format);
2791 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_format);
2792 LOGD("ret : 0x%x", ret);
2796 int camera_set_preview_format(camera_h camera, camera_pixel_format_e format)
2798 if (camera == NULL) {
2799 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2800 return CAMERA_ERROR_INVALID_PARAMETER;
2803 int ret = CAMERA_ERROR_NONE;
2804 int set_format = (int)format;
2806 camera_cli_s *pc = (camera_cli_s *)camera;
2807 muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_FORMAT;
2809 if (pc->cb_info == NULL) {
2810 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2811 return CAMERA_ERROR_INVALID_PARAMETER;
2813 sock_fd = pc->cb_info->fd;
2815 LOGD("Enter, remote_handle : %x, capture_format: %d", pc->remote_handle, set_format);
2816 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_format);
2817 LOGD("ret : 0x%x", ret);
2821 int camera_get_preview_resolution(camera_h camera, int *width, int *height)
2823 if (camera == NULL || width == NULL || height == NULL) {
2824 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2825 return CAMERA_ERROR_INVALID_PARAMETER;
2829 int ret = CAMERA_ERROR_NONE;
2831 camera_cli_s *pc = (camera_cli_s *)camera;
2832 muse_camera_api_e api = MUSE_CAMERA_API_GET_PREVIEW_RESOLUTION;
2834 if (pc->cb_info == NULL) {
2835 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2836 return CAMERA_ERROR_INVALID_PARAMETER;
2838 sock_fd = pc->cb_info->fd;
2842 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2843 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2845 if (ret == CAMERA_ERROR_NONE) {
2846 muse_camera_msg_get(get_width, pc->cb_info->recv_msg);
2847 muse_camera_msg_get(get_height, pc->cb_info->recv_msg);
2849 *height = get_height;
2851 LOGD("ret : 0x%x", ret);
2855 int camera_set_display_rotation(camera_h camera, camera_rotation_e rotation)
2857 int ret = CAMERA_ERROR_NONE;
2858 int set_rotation = (int)rotation;
2859 camera_cli_s *pc = NULL;
2861 if (camera == NULL) {
2862 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2863 return CAMERA_ERROR_INVALID_PARAMETER;
2866 if (rotation < CAMERA_ROTATION_NONE || rotation > CAMERA_ROTATION_270) {
2867 LOGE("Invalid rotation %d", rotation);
2868 return CAMERA_ERROR_INVALID_PARAMETER;
2871 pc = (camera_cli_s *)camera;
2873 if (pc->cb_info == NULL) {
2874 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2875 return CAMERA_ERROR_INVALID_PARAMETER;
2878 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
2879 g_mutex_lock(&pc->cb_info->evas_mutex);
2881 ret = mm_evas_renderer_set_rotation(pc->cb_info->evas_info, rotation);
2883 g_mutex_unlock(&pc->cb_info->evas_mutex);
2885 if (ret!= MM_ERROR_NONE) {
2886 LOGE("failed to set rotation for evas surface 0x%x", ret);
2887 return CAMERA_ERROR_INVALID_OPERATION;
2891 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_ROTATION,
2892 pc->cb_info->fd, pc->cb_info, ret, INT, set_rotation);
2897 int camera_get_display_rotation(camera_h camera, camera_rotation_e *rotation)
2899 int ret = CAMERA_ERROR_NONE;
2900 int get_rotation = CAMERA_ROTATION_NONE;
2901 camera_cli_s *pc = NULL;
2903 if (camera == NULL || rotation == NULL) {
2904 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2905 return CAMERA_ERROR_INVALID_PARAMETER;
2908 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;
2915 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
2916 g_mutex_lock(&pc->cb_info->evas_mutex);
2918 ret = mm_evas_renderer_get_rotation(pc->cb_info->evas_info, (int *)rotation);
2920 g_mutex_unlock(&pc->cb_info->evas_mutex);
2922 if (ret != MM_ERROR_NONE) {
2923 LOGE("failed to get rotation for evas surface 0x%x", ret);
2924 return CAMERA_ERROR_INVALID_OPERATION;
2927 muse_camera_msg_send(MUSE_CAMERA_API_GET_DISPLAY_ROTATION,
2928 pc->cb_info->fd, pc->cb_info, ret);
2930 if (ret == CAMERA_ERROR_NONE) {
2931 muse_camera_msg_get(get_rotation, pc->cb_info->recv_msg);
2932 *rotation = (camera_rotation_e)get_rotation;
2939 int camera_set_display_flip(camera_h camera, camera_flip_e flip)
2941 int ret = CAMERA_ERROR_NONE;
2942 int set_flip = (int)flip;
2943 camera_cli_s *pc = NULL;
2945 if (camera == NULL) {
2946 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2947 return CAMERA_ERROR_INVALID_PARAMETER;
2950 if (flip < CAMERA_FLIP_NONE || flip > CAMERA_FLIP_BOTH) {
2951 LOGE("Invalid flip %d", flip);
2952 return CAMERA_ERROR_INVALID_PARAMETER;
2955 pc = (camera_cli_s *)camera;
2957 if (pc->cb_info == NULL) {
2958 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2959 return CAMERA_ERROR_INVALID_PARAMETER;
2962 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
2963 g_mutex_lock(&pc->cb_info->evas_mutex);
2965 ret = mm_evas_renderer_set_flip(pc->cb_info->evas_info, flip);
2967 g_mutex_unlock(&pc->cb_info->evas_mutex);
2969 if (ret!= MM_ERROR_NONE) {
2970 LOGE("failed to set flip for evas surface 0x%x", ret);
2971 return CAMERA_ERROR_INVALID_OPERATION;
2975 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_FLIP,
2976 pc->cb_info->fd, pc->cb_info, ret, INT, set_flip);
2981 int camera_get_display_flip(camera_h camera, camera_flip_e *flip)
2983 int ret = CAMERA_ERROR_NONE;
2984 int get_flip = CAMERA_FLIP_NONE;
2985 camera_cli_s *pc = NULL;
2987 if (camera == NULL || flip == NULL) {
2988 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2989 return CAMERA_ERROR_INVALID_PARAMETER;
2992 pc = (camera_cli_s *)camera;
2994 if (pc->cb_info == NULL) {
2995 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2996 return CAMERA_ERROR_INVALID_PARAMETER;
2999 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
3000 g_mutex_lock(&pc->cb_info->evas_mutex);
3002 ret = mm_evas_renderer_get_flip(pc->cb_info->evas_info, (int *)flip);
3004 g_mutex_unlock(&pc->cb_info->evas_mutex);
3006 if (ret != MM_ERROR_NONE) {
3007 LOGE("failed to get flip for evas surface 0x%x", ret);
3008 return CAMERA_ERROR_INVALID_OPERATION;
3011 muse_camera_msg_send(MUSE_CAMERA_API_GET_DISPLAY_FLIP,
3012 pc->cb_info->fd, pc->cb_info, ret);
3014 if (ret == CAMERA_ERROR_NONE) {
3015 muse_camera_msg_get(get_flip, pc->cb_info->recv_msg);
3016 *flip = (camera_flip_e)get_flip;
3023 int camera_set_display_visible(camera_h camera, bool visible)
3025 int ret = CAMERA_ERROR_NONE;
3026 int set_visible = (int)visible;
3027 camera_cli_s *pc = NULL;
3029 if (camera == NULL) {
3030 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3031 return CAMERA_ERROR_INVALID_PARAMETER;
3034 pc = (camera_cli_s *)camera;
3036 if (pc->cb_info == NULL) {
3037 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3038 return CAMERA_ERROR_INVALID_PARAMETER;
3041 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
3042 g_mutex_lock(&pc->cb_info->evas_mutex);
3044 ret = mm_evas_renderer_set_visible(pc->cb_info->evas_info, visible);
3046 g_mutex_unlock(&pc->cb_info->evas_mutex);
3048 if (ret != MM_ERROR_NONE) {
3049 LOGE("failed to set visible for evas surface 0x%x", ret);
3050 return CAMERA_ERROR_INVALID_OPERATION;
3054 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_VISIBLE,
3055 pc->cb_info->fd, pc->cb_info, ret, INT, set_visible);
3060 int camera_is_display_visible(camera_h camera, bool *visible)
3062 int ret = CAMERA_ERROR_NONE;
3063 int get_visible = true;
3064 camera_cli_s *pc = NULL;
3066 if (camera == NULL || visible == NULL) {
3067 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3068 return CAMERA_ERROR_INVALID_PARAMETER;
3071 pc = (camera_cli_s *)camera;
3073 if (pc->cb_info == NULL) {
3074 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3075 return CAMERA_ERROR_INVALID_PARAMETER;
3078 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
3079 g_mutex_lock(&pc->cb_info->evas_mutex);
3081 ret = mm_evas_renderer_get_visible(pc->cb_info->evas_info, visible);
3083 g_mutex_unlock(&pc->cb_info->evas_mutex);
3085 if (ret != MM_ERROR_NONE) {
3086 LOGE("failed to get visible for evas surface 0x%x", ret);
3087 return CAMERA_ERROR_INVALID_OPERATION;
3090 muse_camera_msg_send(MUSE_CAMERA_API_IS_DISPLAY_VISIBLE,
3091 pc->cb_info->fd, pc->cb_info, ret);
3093 if (ret == CAMERA_ERROR_NONE) {
3094 muse_camera_msg_get(get_visible, pc->cb_info->recv_msg);
3095 *visible = (bool)get_visible;
3102 int camera_set_display_mode(camera_h camera, camera_display_mode_e mode)
3104 int ret = CAMERA_ERROR_NONE;
3105 int set_mode = (int)mode;
3106 camera_cli_s *pc = NULL;
3108 if (camera == NULL) {
3109 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3110 return CAMERA_ERROR_INVALID_PARAMETER;
3113 if (mode < CAMERA_DISPLAY_MODE_LETTER_BOX || mode > CAMERA_DISPLAY_MODE_CROPPED_FULL) {
3114 LOGE("Invalid mode %d", mode);
3115 return CAMERA_ERROR_INVALID_PARAMETER;
3118 pc = (camera_cli_s *)camera;
3120 if (pc->cb_info == NULL) {
3121 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3122 return CAMERA_ERROR_INVALID_PARAMETER;
3125 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
3126 g_mutex_lock(&pc->cb_info->evas_mutex);
3128 ret = mm_evas_renderer_set_geometry(pc->cb_info->evas_info, mode);
3130 g_mutex_unlock(&pc->cb_info->evas_mutex);
3132 if (ret != MM_ERROR_NONE) {
3133 LOGE("failed to set geometry for evas surface 0x%x", ret);
3134 return CAMERA_ERROR_INVALID_OPERATION;
3138 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_MODE,
3139 pc->cb_info->fd, pc->cb_info, ret, INT, set_mode);
3144 int camera_get_display_mode(camera_h camera, camera_display_mode_e *mode)
3146 int ret = CAMERA_ERROR_NONE;
3147 int get_mode = CAMERA_DISPLAY_MODE_LETTER_BOX;
3148 camera_cli_s *pc = NULL;
3150 if (camera == NULL || mode == NULL) {
3151 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3152 return CAMERA_ERROR_INVALID_PARAMETER;
3155 pc = (camera_cli_s *)camera;
3157 if (pc->cb_info == NULL) {
3158 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3159 return CAMERA_ERROR_INVALID_PARAMETER;
3162 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
3163 g_mutex_lock(&pc->cb_info->evas_mutex);
3165 ret = mm_evas_renderer_get_geometry(pc->cb_info->evas_info, (int *)mode);
3167 g_mutex_unlock(&pc->cb_info->evas_mutex);
3169 if (ret != MM_ERROR_NONE) {
3170 LOGE("failed to get geometry for evas surface 0x%x", ret);
3171 return CAMERA_ERROR_INVALID_OPERATION;
3174 muse_camera_msg_send(MUSE_CAMERA_API_GET_DISPLAY_MODE,
3175 pc->cb_info->fd, pc->cb_info, ret);
3177 if (ret == CAMERA_ERROR_NONE) {
3178 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
3179 *mode = (camera_display_mode_e)get_mode;
3186 int camera_get_capture_resolution(camera_h camera, int *width, int *height)
3188 if (camera == NULL || width == NULL || height == NULL) {
3189 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3190 return CAMERA_ERROR_INVALID_PARAMETER;
3192 int ret = CAMERA_ERROR_NONE;
3194 camera_cli_s *pc = (camera_cli_s *)camera;
3195 muse_camera_api_e api = MUSE_CAMERA_API_GET_CAPTURE_RESOLUTION;
3197 if (pc->cb_info == NULL) {
3198 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3199 return CAMERA_ERROR_INVALID_PARAMETER;
3201 sock_fd = pc->cb_info->fd;
3205 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3206 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3208 if (ret == CAMERA_ERROR_NONE) {
3209 muse_camera_msg_get(get_width, pc->cb_info->recv_msg);
3210 muse_camera_msg_get(get_height, pc->cb_info->recv_msg);
3212 *height = get_height;
3214 LOGD("ret : 0x%x", ret);
3218 int camera_get_capture_format(camera_h camera, camera_pixel_format_e *format)
3220 if (camera == NULL || format == NULL) {
3221 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3222 return CAMERA_ERROR_INVALID_PARAMETER;
3224 int ret = CAMERA_ERROR_NONE;
3226 camera_cli_s *pc = (camera_cli_s *)camera;
3227 muse_camera_api_e api = MUSE_CAMERA_API_GET_CAPTURE_FORMAT;
3230 if (pc->cb_info == NULL) {
3231 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3232 return CAMERA_ERROR_INVALID_PARAMETER;
3234 sock_fd = pc->cb_info->fd;
3236 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3237 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3239 if (ret == CAMERA_ERROR_NONE) {
3240 muse_camera_msg_get(get_format, pc->cb_info->recv_msg);
3241 *format = (camera_pixel_format_e)get_format;
3243 LOGD("ret : 0x%x", ret);
3247 int camera_get_preview_format(camera_h camera, camera_pixel_format_e *format)
3249 if (camera == NULL || format == NULL) {
3250 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3251 return CAMERA_ERROR_INVALID_PARAMETER;
3254 int ret = CAMERA_ERROR_NONE;
3256 camera_cli_s *pc = (camera_cli_s *)camera;
3257 muse_camera_api_e api = MUSE_CAMERA_API_GET_PREVIEW_FORMAT;
3260 if (pc->cb_info == NULL) {
3261 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3262 return CAMERA_ERROR_INVALID_PARAMETER;
3264 sock_fd = pc->cb_info->fd;
3266 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3267 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3269 if (ret == CAMERA_ERROR_NONE) {
3270 muse_camera_msg_get(get_format, pc->cb_info->recv_msg);
3271 *format = (camera_pixel_format_e)get_format;
3273 LOGD("ret : 0x%x", ret);
3277 int camera_get_facing_direction(camera_h camera, camera_facing_direction_e *facing_direciton)
3279 if (camera == NULL || facing_direciton == NULL) {
3280 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3281 return CAMERA_ERROR_INVALID_PARAMETER;
3284 int ret = CAMERA_ERROR_NONE;
3286 camera_cli_s *pc = (camera_cli_s *)camera;
3287 muse_camera_api_e api = MUSE_CAMERA_API_GET_FACING_DIRECTION;
3289 if (pc->cb_info == NULL) {
3290 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3291 return CAMERA_ERROR_INVALID_PARAMETER;
3293 sock_fd = pc->cb_info->fd;
3294 int get_facing_direction;
3296 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3297 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3299 if (ret == CAMERA_ERROR_NONE) {
3300 muse_camera_msg_get(get_facing_direction, pc->cb_info->recv_msg);
3301 *facing_direciton = (camera_facing_direction_e)get_facing_direction;
3303 LOGD("ret : 0x%x", ret);
3307 int camera_set_preview_cb(camera_h camera, camera_preview_cb callback, void *user_data)
3309 if (camera == NULL || callback == NULL) {
3310 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3311 return CAMERA_ERROR_INVALID_PARAMETER;
3313 int ret = CAMERA_ERROR_NONE;
3315 camera_cli_s *pc = (camera_cli_s *)camera;
3316 camera_cb_info_s *cb_info = (camera_cb_info_s *)pc->cb_info;
3318 if (pc->cb_info == NULL) {
3319 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3320 return CAMERA_ERROR_INVALID_PARAMETER;
3322 sock_fd = pc->cb_info->fd;
3323 muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_CB;
3325 LOGD("Enter, handle :%x", pc->remote_handle);
3327 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = callback;
3328 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = user_data;
3329 SET_PREVIEW_CB_TYPE(cb_info, PREVIEW_CB_TYPE_USER);
3331 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3332 LOGD("ret : 0x%x", ret);
3336 int camera_unset_preview_cb(camera_h camera)
3338 if (camera == NULL) {
3339 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3340 return CAMERA_ERROR_INVALID_PARAMETER;
3343 int ret = CAMERA_ERROR_NONE;
3345 camera_cli_s *pc = (camera_cli_s *)camera;
3346 camera_cb_info_s *cb_info = (camera_cb_info_s *)pc->cb_info;
3347 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_PREVIEW_CB;
3349 LOGD("Enter, handle :%x", pc->remote_handle);
3352 if (pc->cb_info == NULL) {
3353 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3354 return CAMERA_ERROR_INVALID_PARAMETER;
3356 sock_fd = pc->cb_info->fd;
3357 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = (void *)NULL;
3358 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = (void *)NULL;
3359 UNSET_PREVIEW_CB_TYPE(cb_info, PREVIEW_CB_TYPE_USER);
3361 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3362 LOGD("ret : 0x%x", ret);
3366 int camera_set_media_packet_preview_cb(camera_h camera, camera_media_packet_preview_cb callback, void *user_data)
3368 if (camera == NULL) {
3369 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
3370 return CAMERA_ERROR_INVALID_PARAMETER;
3373 if (camera_is_supported_media_packet_preview_cb(camera) == false) {
3374 LOGE("NOT SUPPORTED");
3375 return CAMERA_ERROR_NOT_SUPPORTED;
3378 if (callback == NULL) {
3379 LOGE("INVALID_PARAMETER(0x%08x) - callback", CAMERA_ERROR_INVALID_PARAMETER);
3380 return CAMERA_ERROR_INVALID_PARAMETER;
3383 int ret = CAMERA_ERROR_NONE;
3385 camera_cli_s *pc = (camera_cli_s *)camera;
3386 muse_camera_api_e api = MUSE_CAMERA_API_SET_MEDIA_PACKET_PREVIEW_CB;
3388 LOGD("Enter, handle :%x", pc->remote_handle);
3391 if (pc->cb_info == NULL) {
3392 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3393 return CAMERA_ERROR_INVALID_PARAMETER;
3395 sock_fd = pc->cb_info->fd;
3396 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = callback;
3397 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = user_data;
3399 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3400 LOGD("ret : 0x%x", ret);
3404 int camera_unset_media_packet_preview_cb(camera_h camera)
3406 if (camera == NULL) {
3407 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3408 return CAMERA_ERROR_INVALID_PARAMETER;
3411 int ret = CAMERA_ERROR_NONE;
3413 camera_cli_s *pc = (camera_cli_s *)camera;
3414 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_MEDIA_PACKET_PREVIEW_CB;
3416 LOGD("Enter, handle :%x", pc->remote_handle);
3419 if (pc->cb_info == NULL) {
3420 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3421 return CAMERA_ERROR_INVALID_PARAMETER;
3423 sock_fd = pc->cb_info->fd;
3424 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = (void *)NULL;
3425 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = (void *)NULL;
3427 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3428 LOGD("ret : 0x%x", ret);
3432 int camera_set_state_changed_cb(camera_h camera, camera_state_changed_cb callback, void *user_data)
3434 if (camera == NULL || callback == NULL) {
3435 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3436 return CAMERA_ERROR_INVALID_PARAMETER;
3438 int ret = CAMERA_ERROR_NONE;
3440 camera_cli_s *pc = (camera_cli_s *)camera;
3441 muse_camera_api_e api = MUSE_CAMERA_API_SET_STATE_CHANGED_CB;
3443 LOGD("Enter, handle :%x", pc->remote_handle);
3446 if (pc->cb_info == NULL) {
3447 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3448 return CAMERA_ERROR_INVALID_PARAMETER;
3450 sock_fd = pc->cb_info->fd;
3451 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = callback;
3452 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = user_data;
3454 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3455 LOGD("ret : 0x%x", ret);
3458 int camera_unset_state_changed_cb(camera_h camera)
3460 if (camera == 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_UNSET_STATE_CHANGED_CB;
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_STATE_CHANGE] = (void *)NULL;
3478 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = (void *)NULL;
3480 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3481 LOGD("ret : 0x%x", ret);
3485 int camera_set_interrupted_cb(camera_h camera, camera_interrupted_cb callback, void *user_data)
3487 if (camera == NULL || callback == NULL) {
3488 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3489 return CAMERA_ERROR_INVALID_PARAMETER;
3491 int ret = CAMERA_ERROR_NONE;
3493 camera_cli_s *pc = (camera_cli_s *)camera;
3494 muse_camera_api_e api = MUSE_CAMERA_API_SET_INTERRUPTED_CB;
3496 LOGD("Enter, handle :%x", pc->remote_handle);
3499 if (pc->cb_info == NULL) {
3500 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3501 return CAMERA_ERROR_INVALID_PARAMETER;
3503 sock_fd = pc->cb_info->fd;
3504 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = callback;
3505 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = user_data;
3507 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3508 LOGD("ret : 0x%x", ret);
3512 int camera_unset_interrupted_cb(camera_h camera)
3514 if (camera == NULL) {
3515 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3516 return CAMERA_ERROR_INVALID_PARAMETER;
3518 int ret = CAMERA_ERROR_NONE;
3520 camera_cli_s *pc = (camera_cli_s *)camera;
3521 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_INTERRUPTED_CB;
3523 LOGD("Enter, handle :%x", pc->remote_handle);
3526 if (pc->cb_info == NULL) {
3527 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3528 return CAMERA_ERROR_INVALID_PARAMETER;
3530 sock_fd = pc->cb_info->fd;
3531 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = (void *)NULL;
3532 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = (void *)NULL;
3534 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3535 LOGD("ret : 0x%x", ret);
3539 int camera_set_focus_changed_cb(camera_h camera, camera_focus_changed_cb callback, void *user_data)
3541 if (camera == NULL || callback == NULL) {
3542 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3543 return CAMERA_ERROR_INVALID_PARAMETER;
3545 int ret = CAMERA_ERROR_NONE;
3547 camera_cli_s *pc = (camera_cli_s *)camera;
3548 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOCUS_CHANGED_CB;
3550 LOGD("Enter, handle :%x", pc->remote_handle);
3553 if (pc->cb_info == NULL) {
3554 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3555 return CAMERA_ERROR_INVALID_PARAMETER;
3557 sock_fd = pc->cb_info->fd;
3558 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = callback;
3559 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = user_data;
3561 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3562 LOGD("ret : 0x%x", ret);
3566 int camera_unset_focus_changed_cb(camera_h camera)
3568 if (camera == NULL) {
3569 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3570 return CAMERA_ERROR_INVALID_PARAMETER;
3572 int ret = CAMERA_ERROR_NONE;
3574 camera_cli_s *pc = (camera_cli_s *)camera;
3575 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_FOCUS_CHANGED_CB;
3577 LOGD("Enter, handle :%x", pc->remote_handle);
3580 if (pc->cb_info == NULL) {
3581 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3582 return CAMERA_ERROR_INVALID_PARAMETER;
3584 sock_fd = pc->cb_info->fd;
3585 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = (void *)NULL;
3586 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = (void *)NULL;
3588 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3589 LOGD("ret : 0x%x", ret);
3593 int camera_set_error_cb(camera_h camera, camera_error_cb callback, void *user_data)
3595 if (camera == NULL || callback == NULL) {
3596 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3597 return CAMERA_ERROR_INVALID_PARAMETER;
3599 int ret = CAMERA_ERROR_NONE;
3601 camera_cli_s *pc = (camera_cli_s *)camera;
3602 muse_camera_api_e api = MUSE_CAMERA_API_SET_ERROR_CB;
3604 LOGD("Enter, handle :%x", pc->remote_handle);
3607 if (pc->cb_info == NULL) {
3608 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3609 return CAMERA_ERROR_INVALID_PARAMETER;
3611 sock_fd = pc->cb_info->fd;
3612 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_ERROR] = callback;
3613 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_ERROR] = user_data;
3615 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3616 LOGD("ret : 0x%x", ret);
3620 int camera_unset_error_cb(camera_h camera)
3622 if (camera == NULL) {
3623 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3624 return CAMERA_ERROR_INVALID_PARAMETER;
3626 int ret = CAMERA_ERROR_NONE;
3628 camera_cli_s *pc = (camera_cli_s *)camera;
3629 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_ERROR_CB;
3631 LOGD("Enter, handle :%x", pc->remote_handle);
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 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_ERROR] = (void *)NULL;
3640 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_ERROR] = (void *)NULL;
3642 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3643 LOGD("ret : 0x%x", ret);
3647 int camera_foreach_supported_preview_resolution(camera_h camera, camera_supported_preview_resolution_cb foreach_cb , void *user_data)
3649 if (camera == NULL || foreach_cb == NULL) {
3650 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3651 return CAMERA_ERROR_INVALID_PARAMETER;
3653 int ret = CAMERA_ERROR_NONE;
3655 camera_cli_s *pc = (camera_cli_s *)camera;
3656 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_PREVIEW_RESOLUTION;
3658 LOGD("Enter, handle :%x", pc->remote_handle);
3661 if (pc->cb_info == NULL) {
3662 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3663 return CAMERA_ERROR_INVALID_PARAMETER;
3665 sock_fd = pc->cb_info->fd;
3666 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_RESOLUTION] = foreach_cb;
3667 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_RESOLUTION] = user_data;
3669 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3670 LOGD("ret : 0x%x", ret);
3674 int camera_foreach_supported_capture_resolution(camera_h camera, camera_supported_capture_resolution_cb foreach_cb , void *user_data)
3676 if (camera == NULL || foreach_cb == NULL) {
3677 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3678 return CAMERA_ERROR_INVALID_PARAMETER;
3680 int ret = CAMERA_ERROR_NONE;
3682 camera_cli_s *pc = (camera_cli_s *)camera;
3683 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_CAPTURE_RESOLUTION;
3685 LOGD("Enter, handle :%x", pc->remote_handle);
3688 if (pc->cb_info == NULL) {
3689 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3690 return CAMERA_ERROR_INVALID_PARAMETER;
3692 sock_fd = pc->cb_info->fd;
3693 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_RESOLUTION] = foreach_cb;
3694 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_RESOLUTION] = user_data;
3696 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3697 LOGD("ret : 0x%x", ret);
3701 int camera_foreach_supported_capture_format(camera_h camera, camera_supported_capture_format_cb foreach_cb , void *user_data)
3703 if (camera == NULL || foreach_cb == NULL) {
3704 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3705 return CAMERA_ERROR_INVALID_PARAMETER;
3707 int ret = CAMERA_ERROR_NONE;
3709 camera_cli_s *pc = (camera_cli_s *)camera;
3710 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_CAPTURE_FORMAT;
3712 LOGD("Enter, handle :%x", pc->remote_handle);
3715 if (pc->cb_info == NULL) {
3716 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3717 return CAMERA_ERROR_INVALID_PARAMETER;
3719 sock_fd = pc->cb_info->fd;
3720 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_FORMAT] = foreach_cb;
3721 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_FORMAT] = user_data;
3723 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3724 LOGD("ret : 0x%x", ret);
3729 int camera_foreach_supported_preview_format(camera_h camera, camera_supported_preview_format_cb foreach_cb , void *user_data)
3731 if (camera == NULL || foreach_cb == NULL) {
3732 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3733 return CAMERA_ERROR_INVALID_PARAMETER;
3735 int ret = CAMERA_ERROR_NONE;
3737 camera_cli_s *pc = (camera_cli_s *)camera;
3738 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_PREVIEW_FORMAT;
3740 LOGD("Enter, handle :%x", pc->remote_handle);
3743 if (pc->cb_info == NULL) {
3744 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3745 return CAMERA_ERROR_INVALID_PARAMETER;
3747 sock_fd = pc->cb_info->fd;
3748 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_FORMAT] = foreach_cb;
3749 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_FORMAT] = user_data;
3751 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3752 LOGD("ret : 0x%x", ret);
3757 int camera_get_recommended_preview_resolution(camera_h camera, int *width, int *height)
3759 if (camera == NULL || width == NULL || height == NULL) {
3760 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3761 return CAMERA_ERROR_INVALID_PARAMETER;
3763 int ret = CAMERA_ERROR_NONE;
3765 camera_cli_s *pc = (camera_cli_s *)camera;
3766 muse_camera_api_e api = MUSE_CAMERA_API_GET_RECOMMENDED_PREVIEW_RESOLUTION;
3768 if (pc->cb_info == NULL) {
3769 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3770 return CAMERA_ERROR_INVALID_PARAMETER;
3772 sock_fd = pc->cb_info->fd;
3776 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3777 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3779 if (ret == CAMERA_ERROR_NONE) {
3780 muse_camera_msg_get(get_width, pc->cb_info->recv_msg);
3781 muse_camera_msg_get(get_height, pc->cb_info->recv_msg);
3783 *height = get_height;
3785 LOGD("ret : 0x%x", ret);
3790 int camera_attr_get_lens_orientation(camera_h camera, int *angle)
3792 if (camera == NULL || angle == NULL) {
3793 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3794 return CAMERA_ERROR_INVALID_PARAMETER;
3796 int ret = CAMERA_ERROR_NONE;
3798 camera_cli_s *pc = (camera_cli_s *)camera;
3799 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_LENS_ORIENTATION;
3801 if (pc->cb_info == NULL) {
3802 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3803 return CAMERA_ERROR_INVALID_PARAMETER;
3805 sock_fd = pc->cb_info->fd;
3808 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3809 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3811 if (ret == CAMERA_ERROR_NONE) {
3812 muse_camera_msg_get(get_angle, pc->cb_info->recv_msg);
3815 LOGD("ret : 0x%x", ret);
3819 int camera_attr_set_theater_mode(camera_h camera, camera_attr_theater_mode_e mode)
3821 if (camera == NULL) {
3822 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3823 return CAMERA_ERROR_INVALID_PARAMETER;
3825 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_THEATER_MODE;
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;
3834 int set_mode = (int)mode;
3835 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3836 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
3837 LOGD("ret : 0x%x", ret);
3841 int camera_attr_get_theater_mode(camera_h camera, camera_attr_theater_mode_e *mode)
3843 if (camera == NULL || mode == NULL) {
3844 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3845 return CAMERA_ERROR_INVALID_PARAMETER;
3848 int ret = CAMERA_ERROR_NONE;
3849 camera_cli_s *pc = (camera_cli_s *)camera;
3850 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_THEATER_MODE;
3852 if (pc->cb_info == NULL) {
3853 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3854 return CAMERA_ERROR_INVALID_PARAMETER;
3856 sock_fd = pc->cb_info->fd;
3858 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3859 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3861 if (ret == CAMERA_ERROR_NONE) {
3862 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
3863 *mode = (camera_attr_theater_mode_e)get_mode;
3865 LOGD("ret : 0x%x", ret);
3869 int camera_attr_foreach_supported_theater_mode(camera_h camera, camera_attr_supported_theater_mode_cb foreach_cb, void *user_data)
3871 if (camera == NULL || foreach_cb == NULL) {
3872 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3873 return CAMERA_ERROR_INVALID_PARAMETER;
3875 int ret = CAMERA_ERROR_NONE;
3877 camera_cli_s *pc = (camera_cli_s *)camera;
3878 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_THEATER_MODE;
3880 LOGD("Enter, handle :%x", pc->remote_handle);
3883 if (pc->cb_info == NULL) {
3884 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3885 return CAMERA_ERROR_INVALID_PARAMETER;
3887 sock_fd = pc->cb_info->fd;
3888 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE] = foreach_cb;
3889 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE] = user_data;
3891 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3893 LOGD("Finish, return :%x", ret);
3898 int camera_attr_set_preview_fps(camera_h camera, camera_attr_fps_e fps)
3900 if (camera == NULL) {
3901 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3902 return CAMERA_ERROR_INVALID_PARAMETER;
3904 int ret = CAMERA_ERROR_NONE;
3905 camera_cli_s *pc = (camera_cli_s *)camera;
3906 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_PREVIEW_FPS;
3908 if (pc->cb_info == NULL) {
3909 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3910 return CAMERA_ERROR_INVALID_PARAMETER;
3912 sock_fd = pc->cb_info->fd;
3913 int set_fps = (int)fps;
3914 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3915 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_fps);
3916 LOGD("ret : 0x%x", ret);
3921 int camera_attr_set_image_quality(camera_h camera, int quality)
3923 if (camera == NULL) {
3924 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3925 return CAMERA_ERROR_INVALID_PARAMETER;
3927 int ret = CAMERA_ERROR_NONE;
3929 camera_cli_s *pc = (camera_cli_s *)camera;
3930 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_IMAGE_QUALITY;
3932 if (pc->cb_info == NULL) {
3933 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3934 return CAMERA_ERROR_INVALID_PARAMETER;
3936 sock_fd = pc->cb_info->fd;
3937 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3938 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, quality);
3939 LOGD("ret : 0x%x", ret);
3943 int camera_attr_get_preview_fps(camera_h camera, camera_attr_fps_e *fps)
3945 if (camera == NULL || fps == NULL) {
3946 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3947 return CAMERA_ERROR_INVALID_PARAMETER;
3949 int ret = CAMERA_ERROR_NONE;
3951 camera_cli_s *pc = (camera_cli_s *)camera;
3952 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_PREVIEW_FPS;
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;
3961 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3962 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3964 if (ret == CAMERA_ERROR_NONE) {
3965 muse_camera_msg_get(get_fps, pc->cb_info->recv_msg);
3966 *fps = (camera_attr_fps_e)get_fps;
3968 LOGD("ret : 0x%x", ret);
3973 int camera_attr_get_image_quality(camera_h camera, int *quality)
3975 if (camera == NULL || quality == NULL) {
3976 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3977 return CAMERA_ERROR_INVALID_PARAMETER;
3979 int ret = CAMERA_ERROR_NONE;
3981 camera_cli_s *pc = (camera_cli_s *)camera;
3982 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_IMAGE_QUALITY;
3984 if (pc->cb_info == NULL) {
3985 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3986 return CAMERA_ERROR_INVALID_PARAMETER;
3988 sock_fd = pc->cb_info->fd;
3990 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3991 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3993 if (ret == CAMERA_ERROR_NONE) {
3994 muse_camera_msg_get(get_quality, pc->cb_info->recv_msg);
3995 *quality = get_quality;
3997 LOGD("ret : 0x%x", ret);
4002 int camera_attr_get_encoded_preview_bitrate(camera_h camera, int *bitrate)
4004 if (camera == NULL || bitrate == NULL) {
4005 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4006 return CAMERA_ERROR_INVALID_PARAMETER;
4009 int ret = CAMERA_ERROR_NONE;
4011 camera_cli_s *pc = (camera_cli_s *)camera;
4012 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ENCODED_PREVIEW_BITRATE;
4014 if (pc->cb_info == NULL) {
4015 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4016 return CAMERA_ERROR_INVALID_PARAMETER;
4018 sock_fd = pc->cb_info->fd;
4021 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4022 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4024 if (ret == CAMERA_ERROR_NONE) {
4025 muse_camera_msg_get(get_bitrate, pc->cb_info->recv_msg);
4026 *bitrate = get_bitrate;
4028 LOGD("ret : 0x%x", ret);
4033 int camera_attr_set_encoded_preview_bitrate(camera_h camera, int bitrate)
4035 if (camera == NULL) {
4036 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4037 return CAMERA_ERROR_INVALID_PARAMETER;
4040 int ret = CAMERA_ERROR_NONE;
4042 camera_cli_s *pc = (camera_cli_s *)camera;
4043 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ENCODED_PREVIEW_BITRATE;
4045 if (pc->cb_info == NULL) {
4046 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4047 return CAMERA_ERROR_INVALID_PARAMETER;
4049 sock_fd = pc->cb_info->fd;
4050 int set_bitrate = bitrate;
4051 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4052 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_bitrate);
4053 LOGD("ret : 0x%x", ret);
4058 int camera_attr_get_encoded_preview_gop_interval(camera_h camera, int *interval)
4060 if (camera == NULL || interval == NULL) {
4061 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4062 return CAMERA_ERROR_INVALID_PARAMETER;
4065 int ret = CAMERA_ERROR_NONE;
4067 camera_cli_s *pc = (camera_cli_s *)camera;
4068 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ENCODED_PREVIEW_GOP_INTERVAL;
4070 if (pc->cb_info == NULL) {
4071 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4072 return CAMERA_ERROR_INVALID_PARAMETER;
4074 sock_fd = pc->cb_info->fd;
4075 int get_gop_interval;
4077 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4078 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4080 if (ret == CAMERA_ERROR_NONE) {
4081 muse_camera_msg_get(get_gop_interval, pc->cb_info->recv_msg);
4082 *interval = get_gop_interval;
4084 LOGD("ret : 0x%x", ret);
4089 int camera_attr_set_encoded_preview_gop_interval(camera_h camera, int interval)
4091 if (camera == NULL) {
4092 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4093 return CAMERA_ERROR_INVALID_PARAMETER;
4096 int ret = CAMERA_ERROR_NONE;
4098 camera_cli_s *pc = (camera_cli_s *)camera;
4099 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ENCODED_PREVIEW_GOP_INTERVAL;
4101 if (pc->cb_info == NULL) {
4102 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4103 return CAMERA_ERROR_INVALID_PARAMETER;
4105 sock_fd = pc->cb_info->fd;
4106 int set_gop_interval = interval;
4107 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4108 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_gop_interval);
4109 LOGD("ret : 0x%x", ret);
4114 int camera_attr_set_zoom(camera_h camera, int zoom)
4116 if (camera == NULL) {
4117 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4118 return CAMERA_ERROR_INVALID_PARAMETER;
4120 int ret = CAMERA_ERROR_NONE;
4122 camera_cli_s *pc = (camera_cli_s *)camera;
4123 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ZOOM;
4125 if (pc->cb_info == NULL) {
4126 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4127 return CAMERA_ERROR_INVALID_PARAMETER;
4129 sock_fd = pc->cb_info->fd;
4131 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4132 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, zoom);
4133 LOGD("ret : 0x%x", ret);
4137 int camera_attr_set_af_mode(camera_h camera, camera_attr_af_mode_e mode)
4139 if (camera == NULL) {
4140 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4141 return CAMERA_ERROR_INVALID_PARAMETER;
4143 int ret = CAMERA_ERROR_NONE;
4145 camera_cli_s *pc = (camera_cli_s *)camera;
4146 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_AF_MODE;
4148 if (pc->cb_info == NULL) {
4149 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4150 return CAMERA_ERROR_INVALID_PARAMETER;
4152 sock_fd = pc->cb_info->fd;
4153 int set_mode = (int)mode;
4154 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4155 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
4156 LOGD("ret : 0x%x", ret);
4160 int camera_attr_set_af_area(camera_h camera, int x, int y)
4162 if (camera == NULL) {
4163 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4164 return CAMERA_ERROR_INVALID_PARAMETER;
4166 int ret = CAMERA_ERROR_NONE;
4167 camera_cli_s *pc = (camera_cli_s *)camera;
4168 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_AF_AREA;
4169 int sock_fd = pc->cb_info->fd;
4170 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4171 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, x, INT, y);
4172 LOGD("ret : 0x%x", ret);
4177 int camera_attr_clear_af_area(camera_h camera)
4179 if (camera == NULL) {
4180 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4181 return CAMERA_ERROR_INVALID_PARAMETER;
4183 int ret = CAMERA_ERROR_NONE;
4185 camera_cli_s *pc = (camera_cli_s *)camera;
4186 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_CLEAR_AF_AREA;
4188 if (pc->cb_info == NULL) {
4189 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4190 return CAMERA_ERROR_INVALID_PARAMETER;
4192 sock_fd = pc->cb_info->fd;
4193 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4194 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4195 LOGD("ret : 0x%x", ret);
4200 int camera_attr_set_exposure_mode(camera_h camera, camera_attr_exposure_mode_e mode)
4202 if (camera == NULL) {
4203 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4204 return CAMERA_ERROR_INVALID_PARAMETER;
4207 if (mode < CAMERA_ATTR_EXPOSURE_MODE_OFF || mode > CAMERA_ATTR_EXPOSURE_MODE_CUSTOM) {
4208 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4209 return CAMERA_ERROR_INVALID_PARAMETER;
4212 int ret = CAMERA_ERROR_NONE;
4213 camera_cli_s *pc = (camera_cli_s *)camera;
4214 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EXPOSURE_MODE;
4215 int set_mode = (int)mode;
4217 if (pc->cb_info == NULL) {
4218 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4219 return CAMERA_ERROR_INVALID_PARAMETER;
4221 sock_fd = pc->cb_info->fd;
4222 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4223 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
4224 LOGD("ret : 0x%x", ret);
4229 int camera_attr_set_exposure(camera_h camera, int value)
4231 if (camera == NULL) {
4232 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4233 return CAMERA_ERROR_INVALID_PARAMETER;
4235 int ret = CAMERA_ERROR_NONE;
4237 camera_cli_s *pc = (camera_cli_s *)camera;
4238 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EXPOSURE;
4240 if (pc->cb_info == NULL) {
4241 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4242 return CAMERA_ERROR_INVALID_PARAMETER;
4244 sock_fd = pc->cb_info->fd;
4246 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4247 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, value);
4248 LOGD("ret : 0x%x", ret);
4253 int camera_attr_set_iso(camera_h camera, camera_attr_iso_e iso)
4255 if (camera == NULL) {
4256 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4257 return CAMERA_ERROR_INVALID_PARAMETER;
4259 int ret = CAMERA_ERROR_NONE;
4261 camera_cli_s *pc = (camera_cli_s *)camera;
4262 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ISO;
4264 if (pc->cb_info == NULL) {
4265 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4266 return CAMERA_ERROR_INVALID_PARAMETER;
4268 sock_fd = pc->cb_info->fd;
4269 int set_iso = (int)iso;
4270 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4271 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_iso);
4272 LOGD("ret : 0x%x", ret);
4277 int camera_attr_set_brightness(camera_h camera, int level)
4279 if (camera == NULL) {
4280 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4281 return CAMERA_ERROR_INVALID_PARAMETER;
4283 int ret = CAMERA_ERROR_NONE;
4285 camera_cli_s *pc = (camera_cli_s *)camera;
4286 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_BRIGHTNESS;
4288 if (pc->cb_info == NULL) {
4289 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4290 return CAMERA_ERROR_INVALID_PARAMETER;
4292 sock_fd = pc->cb_info->fd;
4294 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4295 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, level);
4296 LOGD("ret : 0x%x", ret);
4301 int camera_attr_set_contrast(camera_h camera, int level)
4303 if (camera == NULL) {
4304 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4305 return CAMERA_ERROR_INVALID_PARAMETER;
4307 int ret = CAMERA_ERROR_NONE;
4309 camera_cli_s *pc = (camera_cli_s *)camera;
4310 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_CONTRAST;
4312 if (pc->cb_info == NULL) {
4313 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4314 return CAMERA_ERROR_INVALID_PARAMETER;
4316 sock_fd = pc->cb_info->fd;
4318 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4319 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, level);
4320 LOGD("ret : 0x%x", ret);
4325 int camera_attr_set_whitebalance(camera_h camera, camera_attr_whitebalance_e wb)
4327 if (camera == NULL) {
4328 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4329 return CAMERA_ERROR_INVALID_PARAMETER;
4332 if (wb < CAMERA_ATTR_WHITE_BALANCE_NONE || wb > CAMERA_ATTR_WHITE_BALANCE_CUSTOM) {
4333 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_NOT_SUPPORTED);
4334 return CAMERA_ERROR_NOT_SUPPORTED;
4337 int ret = CAMERA_ERROR_NONE;
4339 camera_cli_s *pc = (camera_cli_s *)camera;
4340 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_WHITEBALANCE;
4342 if (pc->cb_info == NULL) {
4343 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4344 return CAMERA_ERROR_INVALID_PARAMETER;
4346 sock_fd = pc->cb_info->fd;
4347 int set_whitebalance = (int)wb;
4348 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4349 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_whitebalance);
4350 LOGD("ret : 0x%x", ret);
4355 int camera_attr_set_effect(camera_h camera, camera_attr_effect_mode_e effect)
4357 if (camera == NULL) {
4358 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4359 return CAMERA_ERROR_INVALID_PARAMETER;
4361 int ret = CAMERA_ERROR_NONE;
4363 camera_cli_s *pc = (camera_cli_s *)camera;
4364 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EFFECT;
4366 if (pc->cb_info == NULL) {
4367 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4368 return CAMERA_ERROR_INVALID_PARAMETER;
4370 sock_fd = pc->cb_info->fd;
4371 int set_effect = (int)effect;
4372 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4373 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_effect);
4374 LOGD("ret : 0x%x", ret);
4379 int camera_attr_set_scene_mode(camera_h camera, camera_attr_scene_mode_e mode)
4381 if (camera == NULL) {
4382 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4383 return CAMERA_ERROR_INVALID_PARAMETER;
4385 int ret = CAMERA_ERROR_NONE;
4387 camera_cli_s *pc = (camera_cli_s *)camera;
4388 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_SCENE_MODE;
4390 if (pc->cb_info == NULL) {
4391 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4392 return CAMERA_ERROR_INVALID_PARAMETER;
4394 sock_fd = pc->cb_info->fd;
4395 int set_mode = (int)mode;
4396 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4397 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
4398 LOGD("ret : 0x%x", ret);
4403 int camera_attr_enable_tag(camera_h camera, bool enable)
4405 if (camera == NULL) {
4406 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4407 return CAMERA_ERROR_INVALID_PARAMETER;
4409 int ret = CAMERA_ERROR_NONE;
4410 camera_cli_s *pc = (camera_cli_s *)camera;
4411 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_TAG;
4413 if (pc->cb_info == NULL) {
4414 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4415 return CAMERA_ERROR_INVALID_PARAMETER;
4417 sock_fd = pc->cb_info->fd;
4418 int set_enable = (int)enable;
4420 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4421 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
4422 LOGD("ret : 0x%x", ret);
4427 int camera_attr_set_tag_image_description(camera_h camera, const char *description)
4429 if (camera == NULL) {
4430 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4431 return CAMERA_ERROR_INVALID_PARAMETER;
4433 if (description == NULL) {
4434 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4435 return CAMERA_ERROR_INVALID_PARAMETER;
4437 int ret = CAMERA_ERROR_NONE;
4438 camera_cli_s *pc = (camera_cli_s *)camera;
4439 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_IMAGE_DESCRIPTION;
4441 if (pc->cb_info == NULL) {
4442 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4443 return CAMERA_ERROR_INVALID_PARAMETER;
4445 sock_fd = pc->cb_info->fd;
4446 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4447 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, STRING, description);
4448 LOGD("ret : 0x%x", ret);
4453 int camera_attr_set_tag_orientation(camera_h camera, camera_attr_tag_orientation_e orientation)
4455 if (camera == NULL) {
4456 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4457 return CAMERA_ERROR_INVALID_PARAMETER;
4459 int ret = CAMERA_ERROR_NONE;
4460 camera_cli_s *pc = (camera_cli_s *)camera;
4461 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_ORIENTATION;
4463 if (pc->cb_info == NULL) {
4464 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4465 return CAMERA_ERROR_INVALID_PARAMETER;
4467 sock_fd = pc->cb_info->fd;
4468 int set_orientation = (int)orientation;
4470 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4471 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_orientation);
4472 LOGD("ret : 0x%x", ret);
4477 int camera_attr_set_tag_software(camera_h camera, const char *software)
4479 if (camera == NULL) {
4480 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4481 return CAMERA_ERROR_INVALID_PARAMETER;
4483 if (software == NULL) {
4484 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4485 return CAMERA_ERROR_INVALID_PARAMETER;
4487 int ret = CAMERA_ERROR_NONE;
4488 camera_cli_s *pc = (camera_cli_s *)camera;
4489 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_SOFTWARE;
4491 if (pc->cb_info == NULL) {
4492 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4493 return CAMERA_ERROR_INVALID_PARAMETER;
4495 sock_fd = pc->cb_info->fd;
4496 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4497 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, STRING, software);
4498 LOGD("ret : 0x%x", ret);
4503 int camera_attr_set_geotag(camera_h camera, double latitude , double longitude, double altitude)
4505 if (camera == NULL) {
4506 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4507 return CAMERA_ERROR_INVALID_PARAMETER;
4509 int ret = CAMERA_ERROR_NONE;
4510 camera_cli_s *pc = (camera_cli_s *)camera;
4511 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_GEOTAG;
4513 if (pc->cb_info == NULL) {
4514 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4515 return CAMERA_ERROR_INVALID_PARAMETER;
4517 sock_fd = pc->cb_info->fd;
4518 double set_geotag[3] = { latitude, longitude, altitude };
4520 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4521 muse_camera_msg_send_array(api, sock_fd, pc->cb_info, ret,
4522 set_geotag, sizeof(set_geotag), sizeof(double));
4523 LOGD("ret : 0x%x", ret);
4528 int camera_attr_remove_geotag(camera_h camera)
4530 if (camera == NULL) {
4531 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4532 return CAMERA_ERROR_INVALID_PARAMETER;
4534 int ret = CAMERA_ERROR_NONE;
4535 camera_cli_s *pc = (camera_cli_s *)camera;
4536 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_REMOVE_GEOTAG;
4538 if (pc->cb_info == NULL) {
4539 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4540 return CAMERA_ERROR_INVALID_PARAMETER;
4542 sock_fd = pc->cb_info->fd;
4543 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4544 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4545 LOGD("ret : 0x%x", ret);
4550 int camera_attr_set_flash_mode(camera_h camera, camera_attr_flash_mode_e mode)
4552 if (camera == NULL) {
4553 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4554 return CAMERA_ERROR_INVALID_PARAMETER;
4556 int ret = CAMERA_ERROR_NONE;
4557 camera_cli_s *pc = (camera_cli_s *)camera;
4558 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_FLASH_MODE;
4560 if (pc->cb_info == NULL) {
4561 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4562 return CAMERA_ERROR_INVALID_PARAMETER;
4564 sock_fd = pc->cb_info->fd;
4565 int set_mode = (int)mode;
4567 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4568 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
4569 LOGD("ret : 0x%x", ret);
4574 int camera_attr_get_zoom(camera_h camera, int *zoom)
4576 if (camera == NULL || zoom == NULL) {
4577 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4578 return CAMERA_ERROR_INVALID_PARAMETER;
4580 int ret = CAMERA_ERROR_NONE;
4582 camera_cli_s *pc = (camera_cli_s *)camera;
4583 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ZOOM;
4586 if (pc->cb_info == NULL) {
4587 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4588 return CAMERA_ERROR_INVALID_PARAMETER;
4590 sock_fd = pc->cb_info->fd;
4592 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4593 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4595 if (ret == CAMERA_ERROR_NONE) {
4596 muse_camera_msg_get(get_zoom, pc->cb_info->recv_msg);
4599 LOGD("ret : 0x%x", ret);
4604 int camera_attr_get_zoom_range(camera_h camera, int *min, int *max)
4606 if (camera == NULL || min == NULL || max == NULL) {
4607 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4608 return CAMERA_ERROR_INVALID_PARAMETER;
4610 int ret = CAMERA_ERROR_NONE;
4611 camera_cli_s *pc = (camera_cli_s *)camera;
4613 if (pc->cb_info == NULL) {
4614 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4615 return CAMERA_ERROR_INVALID_PARAMETER;
4617 sock_fd = pc->cb_info->fd;
4618 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ZOOM_RANGE;
4622 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4623 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4625 if (ret == CAMERA_ERROR_NONE) {
4626 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
4627 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
4631 LOGD("ret : 0x%x", ret);
4636 int camera_attr_get_af_mode(camera_h camera, camera_attr_af_mode_e *mode)
4638 if (camera == NULL || mode == NULL) {
4639 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4640 return CAMERA_ERROR_INVALID_PARAMETER;
4642 int ret = CAMERA_ERROR_NONE;
4643 camera_cli_s *pc = (camera_cli_s *)camera;
4645 if (pc->cb_info == NULL) {
4646 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4647 return CAMERA_ERROR_INVALID_PARAMETER;
4649 sock_fd = pc->cb_info->fd;
4650 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_AF_MODE;
4653 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4654 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4656 if (ret == CAMERA_ERROR_NONE) {
4657 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
4658 *mode = (camera_attr_af_mode_e)get_mode;
4660 LOGD("ret : 0x%x", ret);
4665 int camera_attr_get_exposure_mode(camera_h camera, camera_attr_exposure_mode_e *mode)
4667 if (camera == NULL || mode == NULL) {
4668 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4669 return CAMERA_ERROR_INVALID_PARAMETER;
4671 int ret = CAMERA_ERROR_NONE;
4672 camera_cli_s *pc = (camera_cli_s *)camera;
4674 if (pc->cb_info == NULL) {
4675 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4676 return CAMERA_ERROR_INVALID_PARAMETER;
4678 sock_fd = pc->cb_info->fd;
4679 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE_MODE;
4682 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4683 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4685 if (ret == CAMERA_ERROR_NONE) {
4686 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
4687 *mode = (camera_attr_exposure_mode_e)get_mode;
4689 LOGD("ret : 0x%x", ret);
4693 int camera_attr_get_exposure(camera_h camera, int *value)
4695 if (camera == NULL || value == NULL) {
4696 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4697 return CAMERA_ERROR_INVALID_PARAMETER;
4699 int ret = CAMERA_ERROR_NONE;
4700 camera_cli_s *pc = (camera_cli_s *)camera;
4702 if (pc->cb_info == NULL) {
4703 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4704 return CAMERA_ERROR_INVALID_PARAMETER;
4706 sock_fd = pc->cb_info->fd;
4707 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE;
4710 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4711 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4713 if (ret == CAMERA_ERROR_NONE) {
4714 muse_camera_msg_get(get_value, pc->cb_info->recv_msg);
4717 LOGD("ret : 0x%x", ret);
4722 int camera_attr_get_exposure_range(camera_h camera, int *min, int *max)
4724 if (camera == NULL || min == NULL || max == NULL) {
4725 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4726 return CAMERA_ERROR_INVALID_PARAMETER;
4728 int ret = CAMERA_ERROR_NONE;
4729 camera_cli_s *pc = (camera_cli_s *)camera;
4731 if (pc->cb_info == NULL) {
4732 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4733 return CAMERA_ERROR_INVALID_PARAMETER;
4735 sock_fd = pc->cb_info->fd;
4736 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE_RANGE;
4740 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4741 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4743 if (ret == CAMERA_ERROR_NONE) {
4744 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
4745 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
4749 LOGD("ret : 0x%x", ret);
4754 int camera_attr_get_iso(camera_h camera, camera_attr_iso_e *iso)
4756 if (camera == NULL || iso == NULL) {
4757 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4758 return CAMERA_ERROR_INVALID_PARAMETER;
4760 int ret = CAMERA_ERROR_NONE;
4761 camera_cli_s *pc = (camera_cli_s *)camera;
4763 if (pc->cb_info == NULL) {
4764 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4765 return CAMERA_ERROR_INVALID_PARAMETER;
4767 sock_fd = pc->cb_info->fd;
4768 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ISO;
4771 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4772 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4774 if (ret == CAMERA_ERROR_NONE) {
4775 muse_camera_msg_get(get_iso, pc->cb_info->recv_msg);
4776 *iso = (camera_attr_iso_e)get_iso;
4778 LOGD("ret : 0x%x", ret);
4783 int camera_attr_get_brightness(camera_h camera, int *level)
4785 if (camera == NULL || level == NULL) {
4786 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4787 return CAMERA_ERROR_INVALID_PARAMETER;
4789 int ret = CAMERA_ERROR_NONE;
4790 camera_cli_s *pc = (camera_cli_s *)camera;
4792 if (pc->cb_info == NULL) {
4793 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4794 return CAMERA_ERROR_INVALID_PARAMETER;
4796 sock_fd = pc->cb_info->fd;
4797 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_BRIGHTNESS;
4800 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4801 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4803 if (ret == CAMERA_ERROR_NONE) {
4804 muse_camera_msg_get(get_level, pc->cb_info->recv_msg);
4807 LOGD("ret : 0x%x", ret);
4812 int camera_attr_get_brightness_range(camera_h camera, int *min, int *max)
4814 if (camera == NULL || min == NULL || max == NULL) {
4815 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4816 return CAMERA_ERROR_INVALID_PARAMETER;
4818 int ret = CAMERA_ERROR_NONE;
4819 camera_cli_s *pc = (camera_cli_s *)camera;
4821 if (pc->cb_info == NULL) {
4822 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4823 return CAMERA_ERROR_INVALID_PARAMETER;
4825 sock_fd = pc->cb_info->fd;
4826 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_BRIGHTNESS_RANGE;
4830 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4831 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4833 if (ret == CAMERA_ERROR_NONE) {
4834 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
4835 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
4839 LOGD("ret : 0x%x", ret);
4844 int camera_attr_get_contrast(camera_h camera, int *level)
4846 if (camera == NULL || level == NULL) {
4847 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4848 return CAMERA_ERROR_INVALID_PARAMETER;
4850 int ret = CAMERA_ERROR_NONE;
4851 camera_cli_s *pc = (camera_cli_s *)camera;
4852 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_CONTRAST;
4854 if (pc->cb_info == NULL) {
4855 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4856 return CAMERA_ERROR_INVALID_PARAMETER;
4858 sock_fd = pc->cb_info->fd;
4861 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4862 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4864 if (ret == CAMERA_ERROR_NONE) {
4865 muse_camera_msg_get(get_level, pc->cb_info->recv_msg);
4868 LOGD("ret : 0x%x", ret);
4873 int camera_attr_get_contrast_range(camera_h camera, int *min , int *max)
4875 if (camera == NULL || min == NULL || max == NULL) {
4876 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4877 return CAMERA_ERROR_INVALID_PARAMETER;
4879 int ret = CAMERA_ERROR_NONE;
4880 camera_cli_s *pc = (camera_cli_s *)camera;
4881 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_CONTRAST_RANGE;
4883 if (pc->cb_info == NULL) {
4884 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4885 return CAMERA_ERROR_INVALID_PARAMETER;
4887 sock_fd = pc->cb_info->fd;
4891 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4892 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4894 if (ret == CAMERA_ERROR_NONE) {
4895 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
4896 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
4900 LOGD("ret : 0x%x", ret);
4905 int camera_attr_get_whitebalance(camera_h camera, camera_attr_whitebalance_e *wb)
4907 if (camera == NULL || wb == NULL) {
4908 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4909 return CAMERA_ERROR_INVALID_PARAMETER;
4911 int ret = CAMERA_ERROR_NONE;
4912 camera_cli_s *pc = (camera_cli_s *)camera;
4913 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_WHITEBALANCE;
4915 if (pc->cb_info == NULL) {
4916 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4917 return CAMERA_ERROR_INVALID_PARAMETER;
4919 sock_fd = pc->cb_info->fd;
4922 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4923 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4925 if (ret == CAMERA_ERROR_NONE) {
4926 muse_camera_msg_get(get_wb, pc->cb_info->recv_msg);
4927 *wb = (camera_attr_whitebalance_e)get_wb;
4929 LOGD("ret : 0x%x", ret);
4934 int camera_attr_get_effect(camera_h camera, camera_attr_effect_mode_e *effect)
4936 if (camera == NULL || effect == NULL) {
4937 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4938 return CAMERA_ERROR_INVALID_PARAMETER;
4941 int ret = CAMERA_ERROR_NONE;
4942 camera_cli_s *pc = (camera_cli_s *)camera;
4943 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EFFECT;
4945 if (pc->cb_info == NULL) {
4946 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4947 return CAMERA_ERROR_INVALID_PARAMETER;
4949 sock_fd = pc->cb_info->fd;
4952 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4953 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4955 if (ret == CAMERA_ERROR_NONE) {
4956 muse_camera_msg_get(get_effect, pc->cb_info->recv_msg);
4957 *effect = (camera_attr_effect_mode_e)get_effect;
4959 LOGD("ret : 0x%x", ret);
4964 int camera_attr_get_scene_mode(camera_h camera, camera_attr_scene_mode_e *mode)
4966 if (camera == NULL || mode == NULL) {
4967 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4968 return CAMERA_ERROR_INVALID_PARAMETER;
4971 int ret = CAMERA_ERROR_NONE;
4972 camera_cli_s *pc = (camera_cli_s *)camera;
4973 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_SCENE_MODE;
4975 if (pc->cb_info == NULL) {
4976 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4977 return CAMERA_ERROR_INVALID_PARAMETER;
4979 sock_fd = pc->cb_info->fd;
4982 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4983 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4985 if (ret == CAMERA_ERROR_NONE) {
4986 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
4987 *mode = (camera_attr_scene_mode_e)get_mode;
4989 LOGD("ret : 0x%x", ret);
4994 int camera_attr_is_enabled_tag(camera_h camera, bool *enable)
4996 if (camera == NULL || enable == NULL) {
4997 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4998 return CAMERA_ERROR_INVALID_PARAMETER;
5001 int ret = CAMERA_ERROR_NONE;
5002 camera_cli_s *pc = (camera_cli_s *)camera;
5003 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_TAG;
5005 if (pc->cb_info == NULL) {
5006 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5007 return CAMERA_ERROR_INVALID_PARAMETER;
5009 sock_fd = pc->cb_info->fd;
5012 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5013 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5015 if (ret == CAMERA_ERROR_NONE) {
5016 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
5017 *enable = (bool)get_enabled;
5019 LOGD("ret : 0x%x", ret);
5024 int camera_attr_get_tag_image_description(camera_h camera, char **description)
5026 if (camera == NULL || description == NULL) {
5027 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5028 return CAMERA_ERROR_INVALID_PARAMETER;
5031 int ret = CAMERA_ERROR_NONE;
5032 camera_cli_s *pc = (camera_cli_s *)camera;
5033 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_IMAGE_DESCRIPTION;
5035 if (pc->cb_info == NULL) {
5036 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5037 return CAMERA_ERROR_INVALID_PARAMETER;
5039 sock_fd = pc->cb_info->fd;
5040 char get_description[MUSE_CAMERA_MSG_MAX_LENGTH] = {0,};
5042 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5043 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5045 if (ret == CAMERA_ERROR_NONE) {
5046 muse_camera_msg_get_string(get_description, pc->cb_info->recv_msg);
5047 *description = strdup(get_description);
5049 LOGD("ret : 0x%x", ret);
5054 int camera_attr_get_tag_orientation(camera_h camera, camera_attr_tag_orientation_e *orientation)
5056 if (camera == NULL || orientation == NULL) {
5057 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5058 return CAMERA_ERROR_INVALID_PARAMETER;
5061 int ret = CAMERA_ERROR_NONE;
5062 camera_cli_s *pc = (camera_cli_s *)camera;
5063 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_ORIENTATION;
5065 if (pc->cb_info == NULL) {
5066 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5067 return CAMERA_ERROR_INVALID_PARAMETER;
5069 sock_fd = pc->cb_info->fd;
5070 int get_orientation;
5072 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5073 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5075 if (ret == CAMERA_ERROR_NONE) {
5076 muse_camera_msg_get(get_orientation, pc->cb_info->recv_msg);
5077 *orientation = (camera_attr_tag_orientation_e)get_orientation;
5078 LOGD("success, orientation : %d", *orientation);
5080 LOGD("ret : 0x%x", ret);
5085 int camera_attr_get_tag_software(camera_h camera, char **software)
5087 if (camera == NULL || software == NULL) {
5088 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5089 return CAMERA_ERROR_INVALID_PARAMETER;
5092 int ret = CAMERA_ERROR_NONE;
5093 camera_cli_s *pc = (camera_cli_s *)camera;
5094 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_SOFTWARE;
5096 if (pc->cb_info == NULL) {
5097 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5098 return CAMERA_ERROR_INVALID_PARAMETER;
5100 sock_fd = pc->cb_info->fd;
5101 char get_software[MUSE_CAMERA_MSG_MAX_LENGTH] = {0,};
5103 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5104 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5106 if (ret == CAMERA_ERROR_NONE) {
5107 muse_camera_msg_get_string(get_software, pc->cb_info->recv_msg);
5108 *software = strdup(get_software);
5110 LOGD("ret : 0x%x", ret);
5115 int camera_attr_get_geotag(camera_h camera, double *latitude , double *longitude, double *altitude)
5117 if (camera == NULL || latitude == NULL || longitude == NULL || altitude == NULL) {
5118 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5119 return CAMERA_ERROR_INVALID_PARAMETER;
5122 int ret = CAMERA_ERROR_NONE;
5123 camera_cli_s *pc = (camera_cli_s *)camera;
5124 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_GEOTAG;
5125 double get_geotag[3] = {0,};
5127 if (pc->cb_info == NULL) {
5128 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5129 return CAMERA_ERROR_INVALID_PARAMETER;
5131 sock_fd = pc->cb_info->fd;
5133 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5135 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5137 if (ret == CAMERA_ERROR_NONE) {
5138 muse_camera_msg_get_array(get_geotag, pc->cb_info->recv_msg);
5139 *latitude = get_geotag[0];
5140 *longitude = get_geotag[1];
5141 *altitude = get_geotag[2];
5143 LOGD("ret : 0x%x", ret);
5145 LOGE("Returned value is not valid : 0x%x", ret);
5152 int camera_attr_get_flash_mode(camera_h camera, camera_attr_flash_mode_e *mode)
5154 if (camera == NULL || mode == NULL) {
5155 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5156 return CAMERA_ERROR_INVALID_PARAMETER;
5159 int ret = CAMERA_ERROR_NONE;
5160 camera_cli_s *pc = (camera_cli_s *)camera;
5161 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_FLASH_MODE;
5163 if (pc->cb_info == NULL) {
5164 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5165 return CAMERA_ERROR_INVALID_PARAMETER;
5167 sock_fd = pc->cb_info->fd;
5170 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5171 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5173 if (ret == CAMERA_ERROR_NONE) {
5174 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
5175 *mode = (camera_attr_flash_mode_e)get_mode;
5177 LOGD("ret : 0x%x", ret);
5181 int camera_get_flash_state(camera_device_e device, camera_flash_state_e *state)
5185 int ret = CAMERA_ERROR_NONE;
5186 camera_cli_s *pc = NULL;
5187 int get_flash_state = 0;
5189 /* create muse connection */
5190 muse_camera_api_e api = MUSE_CAMERA_API_GET_FLASH_STATE;
5191 muse_core_api_module_e muse_module = MUSE_CAMERA;
5192 int device_type = (int)device;
5194 sock_fd = muse_core_client_new();
5196 LOGE("muse_core_client_new failed - returned fd %d", sock_fd);
5197 ret = CAMERA_ERROR_INVALID_OPERATION;
5201 sndMsg = muse_core_msg_json_factory_new(api,
5202 MUSE_TYPE_INT, "module", muse_module,
5203 MUSE_TYPE_INT, PARAM_DEVICE_TYPE, device_type,
5206 muse_core_ipc_send_msg(sock_fd, sndMsg);
5207 muse_core_msg_json_factory_free(sndMsg);
5209 pc = g_new0(camera_cli_s, 1);
5211 LOGE("camera_cli_s alloc failed");
5212 ret = CAMERA_ERROR_OUT_OF_MEMORY;
5216 pc->cb_info = _client_callback_new(sock_fd);
5217 if (pc->cb_info == NULL) {
5218 LOGE("cb_info alloc failed");
5219 ret = CAMERA_ERROR_OUT_OF_MEMORY;
5223 ret = _client_wait_for_cb_return(api, pc->cb_info, CALLBACK_TIME_OUT);
5225 if (ret == CAMERA_ERROR_NONE) {
5226 muse_camera_msg_get(get_flash_state, pc->cb_info->recv_msg);
5227 *state = (camera_flash_state_e)get_flash_state;
5230 LOGD("Flash state : %d\n", *state);
5233 /* release resources */
5235 g_atomic_int_set(&pc->cb_info->msg_recv_running, 0);
5236 g_atomic_int_set(&pc->cb_info->msg_handler_running, 0);
5237 _client_callback_destroy(pc->cb_info);
5246 int camera_attr_foreach_supported_af_mode(camera_h camera, camera_attr_supported_af_mode_cb foreach_cb, void *user_data)
5248 if (camera == NULL || foreach_cb == NULL) {
5249 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5250 return CAMERA_ERROR_INVALID_PARAMETER;
5252 int ret = CAMERA_ERROR_NONE;
5254 camera_cli_s *pc = (camera_cli_s *)camera;
5255 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_AF_MODE;
5257 LOGD("Enter, handle :%x", pc->remote_handle);
5260 if (pc->cb_info == NULL) {
5261 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5262 return CAMERA_ERROR_INVALID_PARAMETER;
5264 sock_fd = pc->cb_info->fd;
5265 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_AF_MODE] = foreach_cb;
5266 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_AF_MODE] = user_data;
5268 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5269 LOGD("ret : 0x%x", ret);
5274 int camera_attr_foreach_supported_exposure_mode(camera_h camera, camera_attr_supported_exposure_mode_cb foreach_cb , void *user_data)
5276 if (camera == NULL || foreach_cb == NULL) {
5277 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5278 return CAMERA_ERROR_INVALID_PARAMETER;
5280 int ret = CAMERA_ERROR_NONE;
5282 camera_cli_s *pc = (camera_cli_s *)camera;
5283 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_EXPOSURE_MODE;
5285 LOGD("Enter, handle :%x", pc->remote_handle);
5288 if (pc->cb_info == NULL) {
5289 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5290 return CAMERA_ERROR_INVALID_PARAMETER;
5292 sock_fd = pc->cb_info->fd;
5293 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EXPOSURE_MODE] = foreach_cb;
5294 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EXPOSURE_MODE] = user_data;
5296 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5297 LOGD("ret : 0x%x", ret);
5302 int camera_attr_foreach_supported_iso(camera_h camera, camera_attr_supported_iso_cb foreach_cb, void *user_data)
5304 if (camera == NULL || foreach_cb == NULL) {
5305 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5306 return CAMERA_ERROR_INVALID_PARAMETER;
5308 int ret = CAMERA_ERROR_NONE;
5310 camera_cli_s *pc = (camera_cli_s *)camera;
5311 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_ISO;
5313 LOGD("Enter, handle :%x", pc->remote_handle);
5316 if (pc->cb_info == NULL) {
5317 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5318 return CAMERA_ERROR_INVALID_PARAMETER;
5320 sock_fd = pc->cb_info->fd;
5321 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_ISO] = foreach_cb;
5322 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_ISO] = user_data;
5324 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5325 LOGD("ret : 0x%x", ret);
5330 int camera_attr_foreach_supported_whitebalance(camera_h camera, camera_attr_supported_whitebalance_cb foreach_cb , void *user_data)
5332 if (camera == NULL || foreach_cb == NULL) {
5333 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5334 return CAMERA_ERROR_INVALID_PARAMETER;
5336 int ret = CAMERA_ERROR_NONE;
5338 camera_cli_s *pc = (camera_cli_s *)camera;
5339 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_WHITEBALANCE;
5341 LOGD("Enter, handle :%x", pc->remote_handle);
5344 if (pc->cb_info == NULL) {
5345 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5346 return CAMERA_ERROR_INVALID_PARAMETER;
5348 sock_fd = pc->cb_info->fd;
5349 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_WHITEBALANCE] = foreach_cb;
5350 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_WHITEBALANCE] = user_data;
5352 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5353 LOGD("ret : 0x%x", ret);
5358 int camera_attr_foreach_supported_effect(camera_h camera, camera_attr_supported_effect_cb foreach_cb , void *user_data)
5360 if (camera == NULL || foreach_cb == NULL) {
5361 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5362 return CAMERA_ERROR_INVALID_PARAMETER;
5364 int ret = CAMERA_ERROR_NONE;
5366 camera_cli_s *pc = (camera_cli_s *)camera;
5367 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_EFFECT;
5369 LOGD("Enter, handle :%x", pc->remote_handle);
5372 if (pc->cb_info == NULL) {
5373 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5374 return CAMERA_ERROR_INVALID_PARAMETER;
5376 sock_fd = pc->cb_info->fd;
5377 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EFFECT] = foreach_cb;
5378 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EFFECT] = user_data;
5380 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5381 LOGD("ret : 0x%x", ret);
5386 int camera_attr_foreach_supported_scene_mode(camera_h camera, camera_attr_supported_scene_mode_cb foreach_cb , void *user_data)
5388 if (camera == NULL || foreach_cb == NULL) {
5389 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5390 return CAMERA_ERROR_INVALID_PARAMETER;
5392 int ret = CAMERA_ERROR_NONE;
5394 camera_cli_s *pc = (camera_cli_s *)camera;
5395 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_SCENE_MODE;
5397 LOGD("Enter, handle :%x", pc->remote_handle);
5400 if (pc->cb_info == NULL) {
5401 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5402 return CAMERA_ERROR_INVALID_PARAMETER;
5404 sock_fd = pc->cb_info->fd;
5405 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_SCENE_MODE] = foreach_cb;
5406 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_SCENE_MODE] = user_data;
5408 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5409 LOGD("ret : 0x%x", ret);
5414 int camera_attr_foreach_supported_flash_mode(camera_h camera, camera_attr_supported_flash_mode_cb foreach_cb , void *user_data)
5416 if (camera == NULL || foreach_cb == NULL) {
5417 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5418 return CAMERA_ERROR_INVALID_PARAMETER;
5420 int ret = CAMERA_ERROR_NONE;
5422 camera_cli_s *pc = (camera_cli_s *)camera;
5423 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FLASH_MODE;
5425 LOGD("Enter, handle :%x", pc->remote_handle);
5428 if (pc->cb_info == NULL) {
5429 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5430 return CAMERA_ERROR_INVALID_PARAMETER;
5432 sock_fd = pc->cb_info->fd;
5433 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FLASH_MODE] = foreach_cb;
5434 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FLASH_MODE] = user_data;
5436 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5437 LOGD("ret : 0x%x", ret);
5442 int camera_attr_foreach_supported_fps(camera_h camera, camera_attr_supported_fps_cb foreach_cb , void *user_data)
5444 if (camera == NULL || foreach_cb == NULL) {
5445 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5446 return CAMERA_ERROR_INVALID_PARAMETER;
5448 int ret = CAMERA_ERROR_NONE;
5450 camera_cli_s *pc = (camera_cli_s *)camera;
5451 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FPS;
5453 if (pc->cb_info == NULL) {
5454 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5455 return CAMERA_ERROR_INVALID_PARAMETER;
5457 sock_fd = pc->cb_info->fd;
5458 LOGD("Enter, handle :%x", pc->remote_handle);
5459 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS] = foreach_cb;
5460 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS] = user_data;
5462 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5463 LOGD("Enter, handle :%x", pc->remote_handle);
5467 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)
5469 if (camera == NULL || foreach_cb == NULL) {
5470 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5471 return CAMERA_ERROR_INVALID_PARAMETER;
5473 int ret = CAMERA_ERROR_NONE;
5475 camera_cli_s *pc = (camera_cli_s *)camera;
5476 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FPS_BY_RESOLUTION;
5478 if (pc->cb_info == NULL) {
5479 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5480 return CAMERA_ERROR_INVALID_PARAMETER;
5482 sock_fd = pc->cb_info->fd;
5483 LOGD("Enter, handle :%x", pc->remote_handle);
5484 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS_BY_RESOLUTION] = foreach_cb;
5485 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS_BY_RESOLUTION] = user_data;
5487 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, width, INT, height);
5488 LOGD("ret : 0x%x", ret);
5492 int camera_attr_foreach_supported_stream_flip(camera_h camera, camera_attr_supported_stream_flip_cb foreach_cb, void *user_data)
5494 if (camera == NULL || foreach_cb == NULL) {
5495 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5496 return CAMERA_ERROR_INVALID_PARAMETER;
5498 int ret = CAMERA_ERROR_NONE;
5500 camera_cli_s *pc = (camera_cli_s *)camera;
5501 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_STREAM_FLIP;
5503 if (pc->cb_info == NULL) {
5504 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5505 return CAMERA_ERROR_INVALID_PARAMETER;
5507 sock_fd = pc->cb_info->fd;
5508 LOGD("Enter, handle :%x", pc->remote_handle);
5509 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_FLIP] = foreach_cb;
5510 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_FLIP] = user_data;
5512 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5513 LOGD("ret : 0x%x", ret);
5518 int camera_attr_foreach_supported_stream_rotation(camera_h camera, camera_attr_supported_stream_rotation_cb foreach_cb, void *user_data)
5520 if (camera == NULL || foreach_cb == NULL) {
5521 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5522 return CAMERA_ERROR_INVALID_PARAMETER;
5524 int ret = CAMERA_ERROR_NONE;
5526 camera_cli_s *pc = (camera_cli_s *)camera;
5527 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_STREAM_ROTATION;
5529 if (pc->cb_info == NULL) {
5530 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5531 return CAMERA_ERROR_INVALID_PARAMETER;
5533 sock_fd = pc->cb_info->fd;
5534 LOGD("Enter, handle :%x", pc->remote_handle);
5535 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION] = foreach_cb;
5536 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION] = user_data;
5538 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5539 LOGD("ret : 0x%x", ret);
5544 int camera_attr_set_stream_rotation(camera_h camera , camera_rotation_e rotation)
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_SET_STREAM_ROTATION;
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_rotation = (int)rotation;
5562 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5563 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_rotation);
5564 LOGD("ret : 0x%x", ret);
5569 int camera_attr_get_stream_rotation(camera_h camera , camera_rotation_e *rotation)
5571 if (camera == NULL || rotation == NULL) {
5572 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5573 return CAMERA_ERROR_INVALID_PARAMETER;
5576 int ret = CAMERA_ERROR_NONE;
5577 camera_cli_s *pc = (camera_cli_s *)camera;
5578 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_STREAM_ROTATION;
5580 if (pc->cb_info == NULL) {
5581 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5582 return CAMERA_ERROR_INVALID_PARAMETER;
5584 sock_fd = pc->cb_info->fd;
5587 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5588 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5590 if (ret == CAMERA_ERROR_NONE) {
5591 muse_camera_msg_get(get_rotation, pc->cb_info->recv_msg);
5592 *rotation = (camera_rotation_e)get_rotation;
5594 LOGD("ret : 0x%x", ret);
5599 int camera_attr_set_stream_flip(camera_h camera , camera_flip_e flip)
5601 if (camera == NULL) {
5602 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5603 return CAMERA_ERROR_INVALID_PARAMETER;
5606 int ret = CAMERA_ERROR_NONE;
5607 camera_cli_s *pc = (camera_cli_s *)camera;
5608 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_STREAM_FLIP;
5610 if (pc->cb_info == NULL) {
5611 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5612 return CAMERA_ERROR_INVALID_PARAMETER;
5614 sock_fd = pc->cb_info->fd;
5615 int set_flip = (int)flip;
5617 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5618 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_flip);
5619 LOGD("ret : 0x%x", ret);
5624 int camera_attr_get_stream_flip(camera_h camera , camera_flip_e *flip)
5626 if (camera == NULL || flip == NULL) {
5627 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5628 return CAMERA_ERROR_INVALID_PARAMETER;
5631 int ret = CAMERA_ERROR_NONE;
5632 camera_cli_s *pc = (camera_cli_s *)camera;
5633 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_STREAM_FLIP;
5635 if (pc->cb_info == NULL) {
5636 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5637 return CAMERA_ERROR_INVALID_PARAMETER;
5639 sock_fd = pc->cb_info->fd;
5642 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5643 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5645 if (ret == CAMERA_ERROR_NONE) {
5646 muse_camera_msg_get(get_flip, pc->cb_info->recv_msg);
5647 *flip = (camera_flip_e)get_flip;
5649 LOGD("ret : 0x%x", ret);
5653 int camera_attr_set_hdr_mode(camera_h camera, camera_attr_hdr_mode_e mode)
5655 if (camera == NULL) {
5656 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5657 return CAMERA_ERROR_INVALID_PARAMETER;
5660 int ret = CAMERA_ERROR_NONE;
5661 camera_cli_s *pc = (camera_cli_s *)camera;
5662 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_HDR_MODE;
5664 if (pc->cb_info == NULL) {
5665 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5666 return CAMERA_ERROR_INVALID_PARAMETER;
5668 sock_fd = pc->cb_info->fd;
5669 int set_mode = (int)mode;
5671 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5672 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
5673 LOGD("ret : 0x%x", ret);
5678 int camera_attr_get_hdr_mode(camera_h camera, camera_attr_hdr_mode_e *mode)
5680 if (camera == NULL) {
5681 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5682 return CAMERA_ERROR_INVALID_PARAMETER;
5685 LOGE("CAMERA_ERROR_NOT_SUPPORTED(0x%08x) - mode", CAMERA_ERROR_NOT_SUPPORTED);
5686 return CAMERA_ERROR_NOT_SUPPORTED;
5688 int ret = CAMERA_ERROR_NONE;
5689 camera_cli_s *pc = (camera_cli_s *)camera;
5690 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_HDR_MODE;
5692 if (pc->cb_info == NULL) {
5693 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5694 return CAMERA_ERROR_INVALID_PARAMETER;
5696 sock_fd = pc->cb_info->fd;
5699 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5700 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5702 if (ret == CAMERA_ERROR_NONE) {
5703 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
5704 *mode = (camera_attr_hdr_mode_e)get_mode;
5706 LOGD("ret : 0x%x", ret);
5711 bool camera_attr_is_supported_hdr_capture(camera_h camera)
5713 if (camera == NULL) {
5714 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5718 int ret = CAMERA_ERROR_NONE;
5719 camera_cli_s *pc = (camera_cli_s *)camera;
5720 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_HDR_CAPTURE;
5722 if (pc->cb_info == NULL) {
5723 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5724 return CAMERA_ERROR_INVALID_PARAMETER;
5726 sock_fd = pc->cb_info->fd;
5727 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5728 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5729 LOGD("ret : 0x%x", ret);
5734 int camera_attr_set_hdr_capture_progress_cb(camera_h camera, camera_attr_hdr_progress_cb callback, void *user_data)
5736 if (camera == NULL) {
5737 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5738 return CAMERA_ERROR_INVALID_PARAMETER;
5740 if (callback == NULL) {
5741 LOGE("CAMERA_ERROR_NOT_SUPPORTED(0x%08x) - callback", CAMERA_ERROR_NOT_SUPPORTED);
5742 return CAMERA_ERROR_NOT_SUPPORTED;
5744 int ret = CAMERA_ERROR_NONE;
5746 camera_cli_s *pc = (camera_cli_s *)camera;
5747 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_HDR_CAPTURE_PROGRESS_CB;
5749 if (pc->cb_info == NULL) {
5750 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5751 return CAMERA_ERROR_INVALID_PARAMETER;
5753 sock_fd = pc->cb_info->fd;
5754 LOGD("Enter, handle :%x", pc->remote_handle);
5756 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = callback;
5757 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = user_data;
5759 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5760 LOGD("ret : 0x%x", ret);
5765 int camera_attr_unset_hdr_capture_progress_cb(camera_h camera)
5767 if (camera == NULL) {
5768 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5769 return CAMERA_ERROR_INVALID_PARAMETER;
5772 int ret = CAMERA_ERROR_NONE;
5774 camera_cli_s *pc = (camera_cli_s *)camera;
5775 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_UNSET_HDR_CAPTURE_PROGRESS_CB;
5777 if (pc->cb_info == NULL) {
5778 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5779 return CAMERA_ERROR_INVALID_PARAMETER;
5781 sock_fd = pc->cb_info->fd;
5782 LOGD("Enter, handle :%x", pc->remote_handle);
5784 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = (void *)NULL;
5785 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = (void *)NULL;
5787 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5788 LOGD("ret : 0x%x", ret);
5793 int camera_attr_enable_anti_shake(camera_h camera, bool enable)
5795 if (camera == NULL) {
5796 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5797 return CAMERA_ERROR_INVALID_PARAMETER;
5800 int ret = CAMERA_ERROR_NONE;
5801 camera_cli_s *pc = (camera_cli_s *)camera;
5802 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_ANTI_SHAKE;
5804 if (pc->cb_info == NULL) {
5805 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5806 return CAMERA_ERROR_INVALID_PARAMETER;
5808 sock_fd = pc->cb_info->fd;
5809 int set_enable = (int)enable;
5811 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5812 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
5813 LOGD("ret : 0x%x", ret);
5818 int camera_attr_is_enabled_anti_shake(camera_h camera , bool *enabled)
5820 if (camera == NULL) {
5821 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5822 return CAMERA_ERROR_INVALID_PARAMETER;
5824 if (enabled == NULL) {
5825 LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER);
5826 return CAMERA_ERROR_NOT_SUPPORTED;
5828 int ret = CAMERA_ERROR_NONE;
5829 camera_cli_s *pc = (camera_cli_s *)camera;
5830 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_ANTI_SHAKE;
5832 if (pc->cb_info == NULL) {
5833 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5834 return CAMERA_ERROR_INVALID_PARAMETER;
5836 sock_fd = pc->cb_info->fd;
5839 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5840 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5842 if (ret == CAMERA_ERROR_NONE) {
5843 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
5844 *enabled = (bool)get_enabled;
5846 LOGD("ret : 0x%x", ret);
5851 bool camera_attr_is_supported_anti_shake(camera_h camera)
5854 if (camera == NULL) {
5855 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5859 int ret = CAMERA_ERROR_NONE;
5860 camera_cli_s *pc = (camera_cli_s *)camera;
5861 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_ANTI_SHAKE;
5863 if (pc->cb_info == NULL) {
5864 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5865 return CAMERA_ERROR_INVALID_PARAMETER;
5867 sock_fd = pc->cb_info->fd;
5868 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5869 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5870 LOGD("ret : 0x%x", ret);
5875 int camera_attr_enable_video_stabilization(camera_h camera, bool enable)
5877 if (camera == NULL) {
5878 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5879 return CAMERA_ERROR_INVALID_PARAMETER;
5882 int ret = CAMERA_ERROR_NONE;
5883 camera_cli_s *pc = (camera_cli_s *)camera;
5884 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_VIDEO_STABILIZATION;
5886 if (pc->cb_info == NULL) {
5887 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5888 return CAMERA_ERROR_INVALID_PARAMETER;
5890 sock_fd = pc->cb_info->fd;
5891 int set_enable = (int)enable;
5893 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5894 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
5895 LOGD("ret : 0x%x", ret);
5900 int camera_attr_is_enabled_video_stabilization(camera_h camera, bool *enabled)
5902 if (camera == NULL) {
5903 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5904 return CAMERA_ERROR_INVALID_PARAMETER;
5906 if (enabled == NULL) {
5907 LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER);
5908 return CAMERA_ERROR_NOT_SUPPORTED;
5910 int ret = CAMERA_ERROR_NONE;
5911 camera_cli_s *pc = (camera_cli_s *)camera;
5912 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_VIDEO_STABILIZATION;
5914 if (pc->cb_info == NULL) {
5915 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5916 return CAMERA_ERROR_INVALID_PARAMETER;
5918 sock_fd = pc->cb_info->fd;
5921 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5922 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5924 if (ret == CAMERA_ERROR_NONE) {
5925 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
5926 *enabled = (bool)get_enabled;
5928 LOGD("ret : 0x%x", ret);
5933 bool camera_attr_is_supported_video_stabilization(camera_h camera)
5935 if (camera == NULL) {
5936 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5940 int ret = CAMERA_ERROR_NONE;
5941 camera_cli_s *pc = (camera_cli_s *)camera;
5942 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_VIDEO_STABILIZATION;
5944 if (pc->cb_info == NULL) {
5945 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5946 return CAMERA_ERROR_INVALID_PARAMETER;
5948 sock_fd = pc->cb_info->fd;
5949 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5950 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5951 LOGD("ret : 0x%x", ret);
5956 int camera_attr_enable_auto_contrast(camera_h camera, bool enable)
5958 if (camera == NULL) {
5959 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5960 return CAMERA_ERROR_INVALID_PARAMETER;
5963 int ret = CAMERA_ERROR_NONE;
5964 camera_cli_s *pc = (camera_cli_s *)camera;
5965 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_AUTO_CONTRAST;
5967 if (pc->cb_info == NULL) {
5968 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5969 return CAMERA_ERROR_INVALID_PARAMETER;
5971 sock_fd = pc->cb_info->fd;
5972 int set_enable = (int)enable;
5974 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5975 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
5976 LOGD("ret : 0x%x", ret);
5981 int camera_attr_is_enabled_auto_contrast(camera_h camera, bool *enabled)
5983 if (camera == NULL) {
5984 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5985 return CAMERA_ERROR_INVALID_PARAMETER;
5987 if (enabled == NULL) {
5988 LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER);
5989 return CAMERA_ERROR_INVALID_PARAMETER;
5991 int ret = CAMERA_ERROR_NONE;
5992 camera_cli_s *pc = (camera_cli_s *)camera;
5993 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_AUTO_CONTRAST;
5995 if (pc->cb_info == NULL) {
5996 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5997 return CAMERA_ERROR_INVALID_PARAMETER;
5999 sock_fd = pc->cb_info->fd;
6002 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6003 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6005 if (ret == CAMERA_ERROR_NONE) {
6006 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
6007 *enabled = (bool)get_enabled;
6009 LOGD("ret : 0x%x", ret);
6014 bool camera_attr_is_supported_auto_contrast(camera_h camera)
6016 if (camera == NULL) {
6017 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6021 int ret = CAMERA_ERROR_NONE;
6022 camera_cli_s *pc = (camera_cli_s *)camera;
6023 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_AUTO_CONTRAST;
6025 if (pc->cb_info == NULL) {
6026 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6027 return CAMERA_ERROR_INVALID_PARAMETER;
6029 sock_fd = pc->cb_info->fd;
6030 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6031 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6032 LOGD("ret : 0x%x", ret);
6037 int camera_attr_disable_shutter_sound(camera_h camera, bool disable)
6039 if (camera == NULL) {
6040 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6041 return CAMERA_ERROR_INVALID_PARAMETER;
6044 int ret = CAMERA_ERROR_NONE;
6045 camera_cli_s *pc = (camera_cli_s *)camera;
6046 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_DISABLE_SHUTTER_SOUND;
6048 if (pc->cb_info == NULL) {
6049 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6050 return CAMERA_ERROR_INVALID_PARAMETER;
6052 sock_fd = pc->cb_info->fd;
6053 int set_disable = (int)disable;
6055 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6056 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_disable);
6057 LOGD("ret : 0x%x", ret);