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_geometry(cb_info->evas_info, mode);
2673 ret |= mm_evas_renderer_set_rotation(cb_info->evas_info, rotation);
2674 ret |= mm_evas_renderer_set_visible(cb_info->evas_info, visible);
2677 g_mutex_unlock(&cb_info->evas_mutex);
2679 if (ret != MM_ERROR_NONE) {
2680 LOGE("mm_evas_renderer error 0x%x", ret);
2681 return CAMERA_ERROR_INVALID_OPERATION;
2685 LOGE("unknown evas object [%p,%s] or type [%d] mismatch", obj, object_type, type);
2686 return CAMERA_ERROR_INVALID_PARAMETER;
2689 LOGE("failed to get evas object type from %p", obj);
2690 return CAMERA_ERROR_INVALID_PARAMETER;
2694 pc->display_handle = (intptr_t)set_display_handle;
2696 if (type == CAMERA_DISPLAY_TYPE_OVERLAY) {
2698 wl_info = &pc->wl_info;
2699 muse_camera_msg_send_array_and_value(api, sock_fd, cb_info, ret,
2700 wl_info, 5, sizeof(int), INT, type);
2702 LOGD("wayland parent id : %d, window %d,%d,%dx%d",
2703 wl_info->parent_id, wl_info->window_x, wl_info->window_y,
2704 wl_info->window_width, wl_info->window_height);
2705 #else /* HAVE_WAYLAND */
2706 muse_camera_msg_send2(api, sock_fd, cb_info, ret, INT, type, INT, set_display_handle);
2708 LOGD("x id : %d", (int)set_display_handle);
2709 #endif /* HAVE_WAYLAND */
2711 muse_camera_msg_send1(api, sock_fd, cb_info, ret, INT, type);
2713 if (ret != CAMERA_ERROR_NONE) {
2714 LOGE("set display error 0x%x", ret);
2715 } else if (type == CAMERA_DISPLAY_TYPE_EVAS) {
2716 SET_PREVIEW_CB_TYPE(cb_info, PREVIEW_CB_TYPE_EVAS);
2722 int camera_set_preview_resolution(camera_h camera, int width, int height)
2724 if (camera == NULL) {
2725 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2726 return CAMERA_ERROR_INVALID_PARAMETER;
2728 int ret = CAMERA_ERROR_NONE;
2730 camera_cli_s *pc = (camera_cli_s *)camera;
2731 muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_RESOLUTION;
2733 if (pc->cb_info == NULL) {
2734 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2735 return CAMERA_ERROR_INVALID_PARAMETER;
2737 sock_fd = pc->cb_info->fd;
2739 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2740 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, width, INT, height);
2741 LOGD("ret : 0x%x", ret);
2746 int camera_set_capture_resolution(camera_h camera, int width, int height)
2748 if (camera == NULL) {
2749 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2750 return CAMERA_ERROR_INVALID_PARAMETER;
2753 int ret = CAMERA_ERROR_NONE;
2755 camera_cli_s *pc = (camera_cli_s *)camera;
2756 muse_camera_api_e api = MUSE_CAMERA_API_SET_CAPTURE_RESOLUTION;
2758 if (pc->cb_info == NULL) {
2759 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2760 return CAMERA_ERROR_INVALID_PARAMETER;
2762 sock_fd = pc->cb_info->fd;
2764 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2765 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, width, INT, height);
2766 LOGD("ret : 0x%x", ret);
2770 int camera_set_capture_format(camera_h camera, camera_pixel_format_e format)
2772 if (camera == NULL) {
2773 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2774 return CAMERA_ERROR_INVALID_PARAMETER;
2777 int ret = CAMERA_ERROR_NONE;
2778 int set_format = (int)format;
2780 camera_cli_s *pc = (camera_cli_s *)camera;
2781 muse_camera_api_e api = MUSE_CAMERA_API_SET_CAPTURE_FORMAT;
2783 if (pc->cb_info == NULL) {
2784 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2785 return CAMERA_ERROR_INVALID_PARAMETER;
2787 sock_fd = pc->cb_info->fd;
2789 LOGD("Enter, remote_handle : %x, capture_format: %d", pc->remote_handle, set_format);
2790 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_format);
2791 LOGD("ret : 0x%x", ret);
2795 int camera_set_preview_format(camera_h camera, camera_pixel_format_e format)
2797 if (camera == NULL) {
2798 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2799 return CAMERA_ERROR_INVALID_PARAMETER;
2802 int ret = CAMERA_ERROR_NONE;
2803 int set_format = (int)format;
2805 camera_cli_s *pc = (camera_cli_s *)camera;
2806 muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_FORMAT;
2808 if (pc->cb_info == NULL) {
2809 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2810 return CAMERA_ERROR_INVALID_PARAMETER;
2812 sock_fd = pc->cb_info->fd;
2814 LOGD("Enter, remote_handle : %x, capture_format: %d", pc->remote_handle, set_format);
2815 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_format);
2816 LOGD("ret : 0x%x", ret);
2820 int camera_get_preview_resolution(camera_h camera, int *width, int *height)
2822 if (camera == NULL || width == NULL || height == NULL) {
2823 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2824 return CAMERA_ERROR_INVALID_PARAMETER;
2828 int ret = CAMERA_ERROR_NONE;
2830 camera_cli_s *pc = (camera_cli_s *)camera;
2831 muse_camera_api_e api = MUSE_CAMERA_API_GET_PREVIEW_RESOLUTION;
2833 if (pc->cb_info == NULL) {
2834 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2835 return CAMERA_ERROR_INVALID_PARAMETER;
2837 sock_fd = pc->cb_info->fd;
2841 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2842 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2844 if (ret == CAMERA_ERROR_NONE) {
2845 muse_camera_msg_get(get_width, pc->cb_info->recv_msg);
2846 muse_camera_msg_get(get_height, pc->cb_info->recv_msg);
2848 *height = get_height;
2850 LOGD("ret : 0x%x", ret);
2854 int camera_set_display_rotation(camera_h camera, camera_rotation_e rotation)
2856 int ret = CAMERA_ERROR_NONE;
2857 int set_rotation = (int)rotation;
2858 camera_cli_s *pc = NULL;
2860 if (camera == NULL) {
2861 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2862 return CAMERA_ERROR_INVALID_PARAMETER;
2865 if (rotation < CAMERA_ROTATION_NONE || rotation > CAMERA_ROTATION_270) {
2866 LOGE("Invalid rotation %d", rotation);
2867 return CAMERA_ERROR_INVALID_PARAMETER;
2870 pc = (camera_cli_s *)camera;
2872 if (pc->cb_info == NULL) {
2873 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2874 return CAMERA_ERROR_INVALID_PARAMETER;
2877 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
2878 g_mutex_lock(&pc->cb_info->evas_mutex);
2880 ret = mm_evas_renderer_set_rotation(pc->cb_info->evas_info, rotation);
2882 g_mutex_unlock(&pc->cb_info->evas_mutex);
2884 if (ret!= MM_ERROR_NONE) {
2885 LOGE("failed to set rotation for evas surface 0x%x", ret);
2886 return CAMERA_ERROR_INVALID_OPERATION;
2890 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_ROTATION,
2891 pc->cb_info->fd, pc->cb_info, ret, INT, set_rotation);
2896 int camera_get_display_rotation(camera_h camera, camera_rotation_e *rotation)
2898 int ret = CAMERA_ERROR_NONE;
2899 int get_rotation = CAMERA_ROTATION_NONE;
2900 camera_cli_s *pc = NULL;
2902 if (camera == NULL || rotation == NULL) {
2903 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2904 return CAMERA_ERROR_INVALID_PARAMETER;
2907 pc = (camera_cli_s *)camera;
2909 if (pc->cb_info == NULL) {
2910 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2911 return CAMERA_ERROR_INVALID_PARAMETER;
2914 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
2915 g_mutex_lock(&pc->cb_info->evas_mutex);
2917 ret = mm_evas_renderer_get_rotation(pc->cb_info->evas_info, (int *)rotation);
2919 g_mutex_unlock(&pc->cb_info->evas_mutex);
2921 if (ret != MM_ERROR_NONE) {
2922 LOGE("failed to get rotation for evas surface 0x%x", ret);
2923 return CAMERA_ERROR_INVALID_OPERATION;
2926 muse_camera_msg_send(MUSE_CAMERA_API_GET_DISPLAY_ROTATION,
2927 pc->cb_info->fd, pc->cb_info, ret);
2929 if (ret == CAMERA_ERROR_NONE) {
2930 muse_camera_msg_get(get_rotation, pc->cb_info->recv_msg);
2931 *rotation = (camera_rotation_e)get_rotation;
2938 int camera_set_display_flip(camera_h camera, camera_flip_e flip)
2940 int ret = CAMERA_ERROR_NONE;
2941 int set_flip = (int)flip;
2942 camera_cli_s *pc = NULL;
2944 if (camera == NULL) {
2945 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2946 return CAMERA_ERROR_INVALID_PARAMETER;
2949 if (flip < CAMERA_FLIP_NONE || flip > CAMERA_FLIP_BOTH) {
2950 LOGE("Invalid flip %d", flip);
2951 return CAMERA_ERROR_INVALID_PARAMETER;
2954 pc = (camera_cli_s *)camera;
2956 if (pc->cb_info == NULL) {
2957 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2958 return CAMERA_ERROR_INVALID_PARAMETER;
2961 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_FLIP,
2962 pc->cb_info->fd, pc->cb_info, ret, INT, set_flip);
2967 int camera_get_display_flip(camera_h camera, camera_flip_e *flip)
2969 int ret = CAMERA_ERROR_NONE;
2970 int get_flip = CAMERA_FLIP_NONE;
2971 camera_cli_s *pc = NULL;
2973 if (camera == NULL || flip == NULL) {
2974 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2975 return CAMERA_ERROR_INVALID_PARAMETER;
2978 pc = (camera_cli_s *)camera;
2980 if (pc->cb_info == NULL) {
2981 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2982 return CAMERA_ERROR_INVALID_PARAMETER;
2985 muse_camera_msg_send(MUSE_CAMERA_API_GET_DISPLAY_FLIP,
2986 pc->cb_info->fd, pc->cb_info, ret);
2988 if (ret == CAMERA_ERROR_NONE) {
2989 muse_camera_msg_get(get_flip, pc->cb_info->recv_msg);
2990 *flip = (camera_flip_e)get_flip;
2996 int camera_set_display_visible(camera_h camera, bool visible)
2998 int ret = CAMERA_ERROR_NONE;
2999 int set_visible = (int)visible;
3000 camera_cli_s *pc = NULL;
3002 if (camera == NULL) {
3003 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3004 return CAMERA_ERROR_INVALID_PARAMETER;
3007 pc = (camera_cli_s *)camera;
3009 if (pc->cb_info == NULL) {
3010 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3011 return CAMERA_ERROR_INVALID_PARAMETER;
3014 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
3015 g_mutex_lock(&pc->cb_info->evas_mutex);
3017 ret = mm_evas_renderer_set_visible(pc->cb_info->evas_info, visible);
3019 g_mutex_unlock(&pc->cb_info->evas_mutex);
3021 if (ret != MM_ERROR_NONE) {
3022 LOGE("failed to set visible for evas surface 0x%x", ret);
3023 return CAMERA_ERROR_INVALID_OPERATION;
3027 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_VISIBLE,
3028 pc->cb_info->fd, pc->cb_info, ret, INT, set_visible);
3033 int camera_is_display_visible(camera_h camera, bool *visible)
3035 int ret = CAMERA_ERROR_NONE;
3036 int get_visible = true;
3037 camera_cli_s *pc = NULL;
3039 if (camera == NULL || visible == NULL) {
3040 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3041 return CAMERA_ERROR_INVALID_PARAMETER;
3044 pc = (camera_cli_s *)camera;
3046 if (pc->cb_info == NULL) {
3047 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3048 return CAMERA_ERROR_INVALID_PARAMETER;
3051 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
3052 g_mutex_lock(&pc->cb_info->evas_mutex);
3054 ret = mm_evas_renderer_get_visible(pc->cb_info->evas_info, visible);
3056 g_mutex_unlock(&pc->cb_info->evas_mutex);
3058 if (ret != MM_ERROR_NONE) {
3059 LOGE("failed to get visible for evas surface 0x%x", ret);
3060 return CAMERA_ERROR_INVALID_OPERATION;
3063 muse_camera_msg_send(MUSE_CAMERA_API_IS_DISPLAY_VISIBLE,
3064 pc->cb_info->fd, pc->cb_info, ret);
3066 if (ret == CAMERA_ERROR_NONE) {
3067 muse_camera_msg_get(get_visible, pc->cb_info->recv_msg);
3068 *visible = (bool)get_visible;
3075 int camera_set_display_mode(camera_h camera, camera_display_mode_e mode)
3077 int ret = CAMERA_ERROR_NONE;
3078 int set_mode = (int)mode;
3079 camera_cli_s *pc = NULL;
3081 if (camera == NULL) {
3082 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3083 return CAMERA_ERROR_INVALID_PARAMETER;
3086 if (mode < CAMERA_DISPLAY_MODE_LETTER_BOX || mode > CAMERA_DISPLAY_MODE_CROPPED_FULL) {
3087 LOGE("Invalid mode %d", mode);
3088 return CAMERA_ERROR_INVALID_PARAMETER;
3091 pc = (camera_cli_s *)camera;
3093 if (pc->cb_info == NULL) {
3094 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3095 return CAMERA_ERROR_INVALID_PARAMETER;
3098 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
3099 g_mutex_lock(&pc->cb_info->evas_mutex);
3101 ret = mm_evas_renderer_set_geometry(pc->cb_info->evas_info, mode);
3103 g_mutex_unlock(&pc->cb_info->evas_mutex);
3105 if (ret != MM_ERROR_NONE) {
3106 LOGE("failed to set geometry for evas surface 0x%x", ret);
3107 return CAMERA_ERROR_INVALID_OPERATION;
3111 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_MODE,
3112 pc->cb_info->fd, pc->cb_info, ret, INT, set_mode);
3117 int camera_get_display_mode(camera_h camera, camera_display_mode_e *mode)
3119 int ret = CAMERA_ERROR_NONE;
3120 int get_mode = CAMERA_DISPLAY_MODE_LETTER_BOX;
3121 camera_cli_s *pc = NULL;
3123 if (camera == NULL || mode == NULL) {
3124 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3125 return CAMERA_ERROR_INVALID_PARAMETER;
3128 pc = (camera_cli_s *)camera;
3130 if (pc->cb_info == NULL) {
3131 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3132 return CAMERA_ERROR_INVALID_PARAMETER;
3135 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
3136 g_mutex_lock(&pc->cb_info->evas_mutex);
3138 ret = mm_evas_renderer_get_geometry(pc->cb_info->evas_info, (int *)mode);
3140 g_mutex_unlock(&pc->cb_info->evas_mutex);
3142 if (ret != MM_ERROR_NONE) {
3143 LOGE("failed to get geometry for evas surface 0x%x", ret);
3144 return CAMERA_ERROR_INVALID_OPERATION;
3147 muse_camera_msg_send(MUSE_CAMERA_API_GET_DISPLAY_MODE,
3148 pc->cb_info->fd, pc->cb_info, ret);
3150 if (ret == CAMERA_ERROR_NONE) {
3151 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
3152 *mode = (camera_display_mode_e)get_mode;
3159 int camera_get_capture_resolution(camera_h camera, int *width, int *height)
3161 if (camera == NULL || width == NULL || height == NULL) {
3162 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3163 return CAMERA_ERROR_INVALID_PARAMETER;
3165 int ret = CAMERA_ERROR_NONE;
3167 camera_cli_s *pc = (camera_cli_s *)camera;
3168 muse_camera_api_e api = MUSE_CAMERA_API_GET_CAPTURE_RESOLUTION;
3170 if (pc->cb_info == NULL) {
3171 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3172 return CAMERA_ERROR_INVALID_PARAMETER;
3174 sock_fd = pc->cb_info->fd;
3178 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3179 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3181 if (ret == CAMERA_ERROR_NONE) {
3182 muse_camera_msg_get(get_width, pc->cb_info->recv_msg);
3183 muse_camera_msg_get(get_height, pc->cb_info->recv_msg);
3185 *height = get_height;
3187 LOGD("ret : 0x%x", ret);
3191 int camera_get_capture_format(camera_h camera, camera_pixel_format_e *format)
3193 if (camera == NULL || format == NULL) {
3194 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3195 return CAMERA_ERROR_INVALID_PARAMETER;
3197 int ret = CAMERA_ERROR_NONE;
3199 camera_cli_s *pc = (camera_cli_s *)camera;
3200 muse_camera_api_e api = MUSE_CAMERA_API_GET_CAPTURE_FORMAT;
3203 if (pc->cb_info == NULL) {
3204 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3205 return CAMERA_ERROR_INVALID_PARAMETER;
3207 sock_fd = pc->cb_info->fd;
3209 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3210 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3212 if (ret == CAMERA_ERROR_NONE) {
3213 muse_camera_msg_get(get_format, pc->cb_info->recv_msg);
3214 *format = (camera_pixel_format_e)get_format;
3216 LOGD("ret : 0x%x", ret);
3220 int camera_get_preview_format(camera_h camera, camera_pixel_format_e *format)
3222 if (camera == NULL || format == NULL) {
3223 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3224 return CAMERA_ERROR_INVALID_PARAMETER;
3227 int ret = CAMERA_ERROR_NONE;
3229 camera_cli_s *pc = (camera_cli_s *)camera;
3230 muse_camera_api_e api = MUSE_CAMERA_API_GET_PREVIEW_FORMAT;
3233 if (pc->cb_info == NULL) {
3234 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3235 return CAMERA_ERROR_INVALID_PARAMETER;
3237 sock_fd = pc->cb_info->fd;
3239 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3240 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3242 if (ret == CAMERA_ERROR_NONE) {
3243 muse_camera_msg_get(get_format, pc->cb_info->recv_msg);
3244 *format = (camera_pixel_format_e)get_format;
3246 LOGD("ret : 0x%x", ret);
3250 int camera_get_facing_direction(camera_h camera, camera_facing_direction_e *facing_direciton)
3252 if (camera == NULL || facing_direciton == NULL) {
3253 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3254 return CAMERA_ERROR_INVALID_PARAMETER;
3257 int ret = CAMERA_ERROR_NONE;
3259 camera_cli_s *pc = (camera_cli_s *)camera;
3260 muse_camera_api_e api = MUSE_CAMERA_API_GET_FACING_DIRECTION;
3262 if (pc->cb_info == NULL) {
3263 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3264 return CAMERA_ERROR_INVALID_PARAMETER;
3266 sock_fd = pc->cb_info->fd;
3267 int get_facing_direction;
3269 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3270 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3272 if (ret == CAMERA_ERROR_NONE) {
3273 muse_camera_msg_get(get_facing_direction, pc->cb_info->recv_msg);
3274 *facing_direciton = (camera_facing_direction_e)get_facing_direction;
3276 LOGD("ret : 0x%x", ret);
3280 int camera_set_preview_cb(camera_h camera, camera_preview_cb callback, void *user_data)
3282 if (camera == NULL || callback == NULL) {
3283 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3284 return CAMERA_ERROR_INVALID_PARAMETER;
3286 int ret = CAMERA_ERROR_NONE;
3288 camera_cli_s *pc = (camera_cli_s *)camera;
3289 camera_cb_info_s *cb_info = (camera_cb_info_s *)pc->cb_info;
3291 if (pc->cb_info == NULL) {
3292 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3293 return CAMERA_ERROR_INVALID_PARAMETER;
3295 sock_fd = pc->cb_info->fd;
3296 muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_CB;
3298 LOGD("Enter, handle :%x", pc->remote_handle);
3300 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = callback;
3301 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = user_data;
3302 SET_PREVIEW_CB_TYPE(cb_info, PREVIEW_CB_TYPE_USER);
3304 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3305 LOGD("ret : 0x%x", ret);
3309 int camera_unset_preview_cb(camera_h camera)
3311 if (camera == NULL) {
3312 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3313 return CAMERA_ERROR_INVALID_PARAMETER;
3316 int ret = CAMERA_ERROR_NONE;
3318 camera_cli_s *pc = (camera_cli_s *)camera;
3319 camera_cb_info_s *cb_info = (camera_cb_info_s *)pc->cb_info;
3320 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_PREVIEW_CB;
3322 LOGD("Enter, handle :%x", pc->remote_handle);
3325 if (pc->cb_info == NULL) {
3326 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3327 return CAMERA_ERROR_INVALID_PARAMETER;
3329 sock_fd = pc->cb_info->fd;
3330 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = (void *)NULL;
3331 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = (void *)NULL;
3332 UNSET_PREVIEW_CB_TYPE(cb_info, PREVIEW_CB_TYPE_USER);
3334 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3335 LOGD("ret : 0x%x", ret);
3339 int camera_set_media_packet_preview_cb(camera_h camera, camera_media_packet_preview_cb callback, void *user_data)
3341 if (camera == NULL) {
3342 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
3343 return CAMERA_ERROR_INVALID_PARAMETER;
3346 if (camera_is_supported_media_packet_preview_cb(camera) == false) {
3347 LOGE("NOT SUPPORTED");
3348 return CAMERA_ERROR_NOT_SUPPORTED;
3351 if (callback == NULL) {
3352 LOGE("INVALID_PARAMETER(0x%08x) - callback", CAMERA_ERROR_INVALID_PARAMETER);
3353 return CAMERA_ERROR_INVALID_PARAMETER;
3356 int ret = CAMERA_ERROR_NONE;
3358 camera_cli_s *pc = (camera_cli_s *)camera;
3359 muse_camera_api_e api = MUSE_CAMERA_API_SET_MEDIA_PACKET_PREVIEW_CB;
3361 LOGD("Enter, handle :%x", pc->remote_handle);
3364 if (pc->cb_info == NULL) {
3365 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3366 return CAMERA_ERROR_INVALID_PARAMETER;
3368 sock_fd = pc->cb_info->fd;
3369 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = callback;
3370 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = user_data;
3372 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3373 LOGD("ret : 0x%x", ret);
3377 int camera_unset_media_packet_preview_cb(camera_h camera)
3379 if (camera == NULL) {
3380 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3381 return CAMERA_ERROR_INVALID_PARAMETER;
3384 int ret = CAMERA_ERROR_NONE;
3386 camera_cli_s *pc = (camera_cli_s *)camera;
3387 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_MEDIA_PACKET_PREVIEW_CB;
3389 LOGD("Enter, handle :%x", pc->remote_handle);
3392 if (pc->cb_info == NULL) {
3393 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3394 return CAMERA_ERROR_INVALID_PARAMETER;
3396 sock_fd = pc->cb_info->fd;
3397 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = (void *)NULL;
3398 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = (void *)NULL;
3400 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3401 LOGD("ret : 0x%x", ret);
3405 int camera_set_state_changed_cb(camera_h camera, camera_state_changed_cb callback, void *user_data)
3407 if (camera == NULL || callback == NULL) {
3408 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3409 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_SET_STATE_CHANGED_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_STATE_CHANGE] = callback;
3425 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = user_data;
3427 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3428 LOGD("ret : 0x%x", ret);
3431 int camera_unset_state_changed_cb(camera_h camera)
3433 if (camera == NULL) {
3434 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3435 return CAMERA_ERROR_INVALID_PARAMETER;
3437 int ret = CAMERA_ERROR_NONE;
3439 camera_cli_s *pc = (camera_cli_s *)camera;
3440 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_STATE_CHANGED_CB;
3442 LOGD("Enter, handle :%x", pc->remote_handle);
3445 if (pc->cb_info == NULL) {
3446 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3447 return CAMERA_ERROR_INVALID_PARAMETER;
3449 sock_fd = pc->cb_info->fd;
3450 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = (void *)NULL;
3451 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = (void *)NULL;
3453 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3454 LOGD("ret : 0x%x", ret);
3458 int camera_set_interrupted_cb(camera_h camera, camera_interrupted_cb callback, void *user_data)
3460 if (camera == NULL || callback == 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_SET_INTERRUPTED_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_INTERRUPTED] = callback;
3478 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = user_data;
3480 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3481 LOGD("ret : 0x%x", ret);
3485 int camera_unset_interrupted_cb(camera_h camera)
3487 if (camera == 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_UNSET_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] = (void *)NULL;
3505 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = (void *)NULL;
3507 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3508 LOGD("ret : 0x%x", ret);
3512 int camera_set_focus_changed_cb(camera_h camera, camera_focus_changed_cb callback, void *user_data)
3514 if (camera == NULL || callback == 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_SET_FOCUS_CHANGED_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_FOCUS_CHANGE] = callback;
3532 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = user_data;
3534 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3535 LOGD("ret : 0x%x", ret);
3539 int camera_unset_focus_changed_cb(camera_h camera)
3541 if (camera == 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_UNSET_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] = (void *)NULL;
3559 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = (void *)NULL;
3561 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3562 LOGD("ret : 0x%x", ret);
3566 int camera_set_error_cb(camera_h camera, camera_error_cb callback, void *user_data)
3568 if (camera == NULL || callback == 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_SET_ERROR_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_ERROR] = callback;
3586 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_ERROR] = user_data;
3588 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3589 LOGD("ret : 0x%x", ret);
3593 int camera_unset_error_cb(camera_h camera)
3595 if (camera == 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_UNSET_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] = (void *)NULL;
3613 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_ERROR] = (void *)NULL;
3615 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3616 LOGD("ret : 0x%x", ret);
3620 int camera_foreach_supported_preview_resolution(camera_h camera, camera_supported_preview_resolution_cb foreach_cb , void *user_data)
3622 if (camera == NULL || foreach_cb == 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_SET_FOREACH_SUPPORTED_PREVIEW_RESOLUTION;
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_FOREACH_SUPPORTED_PREVIEW_RESOLUTION] = foreach_cb;
3640 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_RESOLUTION] = user_data;
3642 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3643 LOGD("ret : 0x%x", ret);
3647 int camera_foreach_supported_capture_resolution(camera_h camera, camera_supported_capture_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_CAPTURE_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_CAPTURE_RESOLUTION] = foreach_cb;
3667 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_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_format(camera_h camera, camera_supported_capture_format_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_FORMAT;
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_FORMAT] = foreach_cb;
3694 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_FORMAT] = user_data;
3696 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3697 LOGD("ret : 0x%x", ret);
3702 int camera_foreach_supported_preview_format(camera_h camera, camera_supported_preview_format_cb foreach_cb , void *user_data)
3704 if (camera == NULL || foreach_cb == NULL) {
3705 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3706 return CAMERA_ERROR_INVALID_PARAMETER;
3708 int ret = CAMERA_ERROR_NONE;
3710 camera_cli_s *pc = (camera_cli_s *)camera;
3711 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_PREVIEW_FORMAT;
3713 LOGD("Enter, handle :%x", pc->remote_handle);
3716 if (pc->cb_info == NULL) {
3717 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3718 return CAMERA_ERROR_INVALID_PARAMETER;
3720 sock_fd = pc->cb_info->fd;
3721 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_FORMAT] = foreach_cb;
3722 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_FORMAT] = user_data;
3724 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3725 LOGD("ret : 0x%x", ret);
3730 int camera_get_recommended_preview_resolution(camera_h camera, int *width, int *height)
3732 if (camera == NULL || width == NULL || height == NULL) {
3733 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3734 return CAMERA_ERROR_INVALID_PARAMETER;
3736 int ret = CAMERA_ERROR_NONE;
3738 camera_cli_s *pc = (camera_cli_s *)camera;
3739 muse_camera_api_e api = MUSE_CAMERA_API_GET_RECOMMENDED_PREVIEW_RESOLUTION;
3741 if (pc->cb_info == NULL) {
3742 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3743 return CAMERA_ERROR_INVALID_PARAMETER;
3745 sock_fd = pc->cb_info->fd;
3749 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3750 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3752 if (ret == CAMERA_ERROR_NONE) {
3753 muse_camera_msg_get(get_width, pc->cb_info->recv_msg);
3754 muse_camera_msg_get(get_height, pc->cb_info->recv_msg);
3756 *height = get_height;
3758 LOGD("ret : 0x%x", ret);
3763 int camera_attr_get_lens_orientation(camera_h camera, int *angle)
3765 if (camera == NULL || angle == NULL) {
3766 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3767 return CAMERA_ERROR_INVALID_PARAMETER;
3769 int ret = CAMERA_ERROR_NONE;
3771 camera_cli_s *pc = (camera_cli_s *)camera;
3772 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_LENS_ORIENTATION;
3774 if (pc->cb_info == NULL) {
3775 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3776 return CAMERA_ERROR_INVALID_PARAMETER;
3778 sock_fd = pc->cb_info->fd;
3781 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3782 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3784 if (ret == CAMERA_ERROR_NONE) {
3785 muse_camera_msg_get(get_angle, pc->cb_info->recv_msg);
3788 LOGD("ret : 0x%x", ret);
3792 int camera_attr_set_theater_mode(camera_h camera, camera_attr_theater_mode_e mode)
3794 if (camera == NULL) {
3795 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3796 return CAMERA_ERROR_INVALID_PARAMETER;
3798 int ret = CAMERA_ERROR_NONE;
3799 camera_cli_s *pc = (camera_cli_s *)camera;
3800 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_THEATER_MODE;
3802 if (pc->cb_info == NULL) {
3803 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3804 return CAMERA_ERROR_INVALID_PARAMETER;
3806 sock_fd = pc->cb_info->fd;
3807 int set_mode = (int)mode;
3808 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3809 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
3810 LOGD("ret : 0x%x", ret);
3814 int camera_attr_get_theater_mode(camera_h camera, camera_attr_theater_mode_e *mode)
3816 if (camera == NULL || mode == NULL) {
3817 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3818 return CAMERA_ERROR_INVALID_PARAMETER;
3821 int ret = CAMERA_ERROR_NONE;
3822 camera_cli_s *pc = (camera_cli_s *)camera;
3823 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_THEATER_MODE;
3825 if (pc->cb_info == NULL) {
3826 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3827 return CAMERA_ERROR_INVALID_PARAMETER;
3829 sock_fd = pc->cb_info->fd;
3831 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3832 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3834 if (ret == CAMERA_ERROR_NONE) {
3835 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
3836 *mode = (camera_attr_theater_mode_e)get_mode;
3838 LOGD("ret : 0x%x", ret);
3842 int camera_attr_foreach_supported_theater_mode(camera_h camera, camera_attr_supported_theater_mode_cb foreach_cb, void *user_data)
3844 if (camera == NULL || foreach_cb == NULL) {
3845 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3846 return CAMERA_ERROR_INVALID_PARAMETER;
3848 int ret = CAMERA_ERROR_NONE;
3850 camera_cli_s *pc = (camera_cli_s *)camera;
3851 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_THEATER_MODE;
3853 LOGD("Enter, handle :%x", pc->remote_handle);
3856 if (pc->cb_info == NULL) {
3857 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3858 return CAMERA_ERROR_INVALID_PARAMETER;
3860 sock_fd = pc->cb_info->fd;
3861 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE] = foreach_cb;
3862 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE] = user_data;
3864 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3866 LOGD("Finish, return :%x", ret);
3871 int camera_attr_set_preview_fps(camera_h camera, camera_attr_fps_e fps)
3873 if (camera == NULL) {
3874 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3875 return CAMERA_ERROR_INVALID_PARAMETER;
3877 int ret = CAMERA_ERROR_NONE;
3878 camera_cli_s *pc = (camera_cli_s *)camera;
3879 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_PREVIEW_FPS;
3881 if (pc->cb_info == NULL) {
3882 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3883 return CAMERA_ERROR_INVALID_PARAMETER;
3885 sock_fd = pc->cb_info->fd;
3886 int set_fps = (int)fps;
3887 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3888 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_fps);
3889 LOGD("ret : 0x%x", ret);
3894 int camera_attr_set_image_quality(camera_h camera, int quality)
3896 if (camera == NULL) {
3897 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3898 return CAMERA_ERROR_INVALID_PARAMETER;
3900 int ret = CAMERA_ERROR_NONE;
3902 camera_cli_s *pc = (camera_cli_s *)camera;
3903 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_IMAGE_QUALITY;
3905 if (pc->cb_info == NULL) {
3906 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3907 return CAMERA_ERROR_INVALID_PARAMETER;
3909 sock_fd = pc->cb_info->fd;
3910 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3911 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, quality);
3912 LOGD("ret : 0x%x", ret);
3916 int camera_attr_get_preview_fps(camera_h camera, camera_attr_fps_e *fps)
3918 if (camera == NULL || fps == NULL) {
3919 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3920 return CAMERA_ERROR_INVALID_PARAMETER;
3922 int ret = CAMERA_ERROR_NONE;
3924 camera_cli_s *pc = (camera_cli_s *)camera;
3925 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_PREVIEW_FPS;
3928 if (pc->cb_info == NULL) {
3929 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3930 return CAMERA_ERROR_INVALID_PARAMETER;
3932 sock_fd = pc->cb_info->fd;
3934 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3935 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3937 if (ret == CAMERA_ERROR_NONE) {
3938 muse_camera_msg_get(get_fps, pc->cb_info->recv_msg);
3939 *fps = (camera_attr_fps_e)get_fps;
3941 LOGD("ret : 0x%x", ret);
3946 int camera_attr_get_image_quality(camera_h camera, int *quality)
3948 if (camera == NULL || quality == NULL) {
3949 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3950 return CAMERA_ERROR_INVALID_PARAMETER;
3952 int ret = CAMERA_ERROR_NONE;
3954 camera_cli_s *pc = (camera_cli_s *)camera;
3955 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_IMAGE_QUALITY;
3957 if (pc->cb_info == NULL) {
3958 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3959 return CAMERA_ERROR_INVALID_PARAMETER;
3961 sock_fd = pc->cb_info->fd;
3963 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3964 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3966 if (ret == CAMERA_ERROR_NONE) {
3967 muse_camera_msg_get(get_quality, pc->cb_info->recv_msg);
3968 *quality = get_quality;
3970 LOGD("ret : 0x%x", ret);
3975 int camera_attr_get_encoded_preview_bitrate(camera_h camera, int *bitrate)
3977 if (camera == NULL || bitrate == NULL) {
3978 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3979 return CAMERA_ERROR_INVALID_PARAMETER;
3982 int ret = CAMERA_ERROR_NONE;
3984 camera_cli_s *pc = (camera_cli_s *)camera;
3985 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ENCODED_PREVIEW_BITRATE;
3987 if (pc->cb_info == NULL) {
3988 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3989 return CAMERA_ERROR_INVALID_PARAMETER;
3991 sock_fd = pc->cb_info->fd;
3994 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3995 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3997 if (ret == CAMERA_ERROR_NONE) {
3998 muse_camera_msg_get(get_bitrate, pc->cb_info->recv_msg);
3999 *bitrate = get_bitrate;
4001 LOGD("ret : 0x%x", ret);
4006 int camera_attr_set_encoded_preview_bitrate(camera_h camera, int bitrate)
4008 if (camera == NULL) {
4009 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4010 return CAMERA_ERROR_INVALID_PARAMETER;
4013 int ret = CAMERA_ERROR_NONE;
4015 camera_cli_s *pc = (camera_cli_s *)camera;
4016 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ENCODED_PREVIEW_BITRATE;
4018 if (pc->cb_info == NULL) {
4019 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4020 return CAMERA_ERROR_INVALID_PARAMETER;
4022 sock_fd = pc->cb_info->fd;
4023 int set_bitrate = bitrate;
4024 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4025 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_bitrate);
4026 LOGD("ret : 0x%x", ret);
4031 int camera_attr_get_encoded_preview_gop_interval(camera_h camera, int *interval)
4033 if (camera == NULL || interval == NULL) {
4034 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4035 return CAMERA_ERROR_INVALID_PARAMETER;
4038 int ret = CAMERA_ERROR_NONE;
4040 camera_cli_s *pc = (camera_cli_s *)camera;
4041 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ENCODED_PREVIEW_GOP_INTERVAL;
4043 if (pc->cb_info == NULL) {
4044 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4045 return CAMERA_ERROR_INVALID_PARAMETER;
4047 sock_fd = pc->cb_info->fd;
4048 int get_gop_interval;
4050 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4051 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4053 if (ret == CAMERA_ERROR_NONE) {
4054 muse_camera_msg_get(get_gop_interval, pc->cb_info->recv_msg);
4055 *interval = get_gop_interval;
4057 LOGD("ret : 0x%x", ret);
4062 int camera_attr_set_encoded_preview_gop_interval(camera_h camera, int interval)
4064 if (camera == NULL) {
4065 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4066 return CAMERA_ERROR_INVALID_PARAMETER;
4069 int ret = CAMERA_ERROR_NONE;
4071 camera_cli_s *pc = (camera_cli_s *)camera;
4072 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ENCODED_PREVIEW_GOP_INTERVAL;
4074 if (pc->cb_info == NULL) {
4075 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4076 return CAMERA_ERROR_INVALID_PARAMETER;
4078 sock_fd = pc->cb_info->fd;
4079 int set_gop_interval = interval;
4080 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4081 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_gop_interval);
4082 LOGD("ret : 0x%x", ret);
4087 int camera_attr_set_zoom(camera_h camera, int zoom)
4089 if (camera == NULL) {
4090 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4091 return CAMERA_ERROR_INVALID_PARAMETER;
4093 int ret = CAMERA_ERROR_NONE;
4095 camera_cli_s *pc = (camera_cli_s *)camera;
4096 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ZOOM;
4098 if (pc->cb_info == NULL) {
4099 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4100 return CAMERA_ERROR_INVALID_PARAMETER;
4102 sock_fd = pc->cb_info->fd;
4104 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4105 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, zoom);
4106 LOGD("ret : 0x%x", ret);
4110 int camera_attr_set_af_mode(camera_h camera, camera_attr_af_mode_e mode)
4112 if (camera == NULL) {
4113 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4114 return CAMERA_ERROR_INVALID_PARAMETER;
4116 int ret = CAMERA_ERROR_NONE;
4118 camera_cli_s *pc = (camera_cli_s *)camera;
4119 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_AF_MODE;
4121 if (pc->cb_info == NULL) {
4122 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4123 return CAMERA_ERROR_INVALID_PARAMETER;
4125 sock_fd = pc->cb_info->fd;
4126 int set_mode = (int)mode;
4127 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4128 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
4129 LOGD("ret : 0x%x", ret);
4133 int camera_attr_set_af_area(camera_h camera, int x, int y)
4135 if (camera == NULL) {
4136 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4137 return CAMERA_ERROR_INVALID_PARAMETER;
4139 int ret = CAMERA_ERROR_NONE;
4140 camera_cli_s *pc = (camera_cli_s *)camera;
4141 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_AF_AREA;
4142 int sock_fd = pc->cb_info->fd;
4143 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4144 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, x, INT, y);
4145 LOGD("ret : 0x%x", ret);
4150 int camera_attr_clear_af_area(camera_h camera)
4152 if (camera == NULL) {
4153 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4154 return CAMERA_ERROR_INVALID_PARAMETER;
4156 int ret = CAMERA_ERROR_NONE;
4158 camera_cli_s *pc = (camera_cli_s *)camera;
4159 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_CLEAR_AF_AREA;
4161 if (pc->cb_info == NULL) {
4162 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4163 return CAMERA_ERROR_INVALID_PARAMETER;
4165 sock_fd = pc->cb_info->fd;
4166 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4167 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4168 LOGD("ret : 0x%x", ret);
4173 int camera_attr_set_exposure_mode(camera_h camera, camera_attr_exposure_mode_e mode)
4175 if (camera == NULL) {
4176 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4177 return CAMERA_ERROR_INVALID_PARAMETER;
4180 if (mode < CAMERA_ATTR_EXPOSURE_MODE_OFF || mode > CAMERA_ATTR_EXPOSURE_MODE_CUSTOM) {
4181 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4182 return CAMERA_ERROR_INVALID_PARAMETER;
4185 int ret = CAMERA_ERROR_NONE;
4186 camera_cli_s *pc = (camera_cli_s *)camera;
4187 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EXPOSURE_MODE;
4188 int set_mode = (int)mode;
4190 if (pc->cb_info == NULL) {
4191 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4192 return CAMERA_ERROR_INVALID_PARAMETER;
4194 sock_fd = pc->cb_info->fd;
4195 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4196 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
4197 LOGD("ret : 0x%x", ret);
4202 int camera_attr_set_exposure(camera_h camera, int value)
4204 if (camera == NULL) {
4205 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4206 return CAMERA_ERROR_INVALID_PARAMETER;
4208 int ret = CAMERA_ERROR_NONE;
4210 camera_cli_s *pc = (camera_cli_s *)camera;
4211 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EXPOSURE;
4213 if (pc->cb_info == NULL) {
4214 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4215 return CAMERA_ERROR_INVALID_PARAMETER;
4217 sock_fd = pc->cb_info->fd;
4219 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4220 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, value);
4221 LOGD("ret : 0x%x", ret);
4226 int camera_attr_set_iso(camera_h camera, camera_attr_iso_e iso)
4228 if (camera == NULL) {
4229 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4230 return CAMERA_ERROR_INVALID_PARAMETER;
4232 int ret = CAMERA_ERROR_NONE;
4234 camera_cli_s *pc = (camera_cli_s *)camera;
4235 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ISO;
4237 if (pc->cb_info == NULL) {
4238 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4239 return CAMERA_ERROR_INVALID_PARAMETER;
4241 sock_fd = pc->cb_info->fd;
4242 int set_iso = (int)iso;
4243 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4244 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_iso);
4245 LOGD("ret : 0x%x", ret);
4250 int camera_attr_set_brightness(camera_h camera, int level)
4252 if (camera == NULL) {
4253 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4254 return CAMERA_ERROR_INVALID_PARAMETER;
4256 int ret = CAMERA_ERROR_NONE;
4258 camera_cli_s *pc = (camera_cli_s *)camera;
4259 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_BRIGHTNESS;
4261 if (pc->cb_info == NULL) {
4262 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4263 return CAMERA_ERROR_INVALID_PARAMETER;
4265 sock_fd = pc->cb_info->fd;
4267 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4268 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, level);
4269 LOGD("ret : 0x%x", ret);
4274 int camera_attr_set_contrast(camera_h camera, int level)
4276 if (camera == NULL) {
4277 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4278 return CAMERA_ERROR_INVALID_PARAMETER;
4280 int ret = CAMERA_ERROR_NONE;
4282 camera_cli_s *pc = (camera_cli_s *)camera;
4283 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_CONTRAST;
4285 if (pc->cb_info == NULL) {
4286 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4287 return CAMERA_ERROR_INVALID_PARAMETER;
4289 sock_fd = pc->cb_info->fd;
4291 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4292 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, level);
4293 LOGD("ret : 0x%x", ret);
4298 int camera_attr_set_whitebalance(camera_h camera, camera_attr_whitebalance_e wb)
4300 if (camera == NULL) {
4301 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4302 return CAMERA_ERROR_INVALID_PARAMETER;
4305 if (wb < CAMERA_ATTR_WHITE_BALANCE_NONE || wb > CAMERA_ATTR_WHITE_BALANCE_CUSTOM) {
4306 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_NOT_SUPPORTED);
4307 return CAMERA_ERROR_NOT_SUPPORTED;
4310 int ret = CAMERA_ERROR_NONE;
4312 camera_cli_s *pc = (camera_cli_s *)camera;
4313 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_WHITEBALANCE;
4315 if (pc->cb_info == NULL) {
4316 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4317 return CAMERA_ERROR_INVALID_PARAMETER;
4319 sock_fd = pc->cb_info->fd;
4320 int set_whitebalance = (int)wb;
4321 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4322 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_whitebalance);
4323 LOGD("ret : 0x%x", ret);
4328 int camera_attr_set_effect(camera_h camera, camera_attr_effect_mode_e effect)
4330 if (camera == NULL) {
4331 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4332 return CAMERA_ERROR_INVALID_PARAMETER;
4334 int ret = CAMERA_ERROR_NONE;
4336 camera_cli_s *pc = (camera_cli_s *)camera;
4337 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EFFECT;
4339 if (pc->cb_info == NULL) {
4340 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4341 return CAMERA_ERROR_INVALID_PARAMETER;
4343 sock_fd = pc->cb_info->fd;
4344 int set_effect = (int)effect;
4345 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4346 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_effect);
4347 LOGD("ret : 0x%x", ret);
4352 int camera_attr_set_scene_mode(camera_h camera, camera_attr_scene_mode_e mode)
4354 if (camera == NULL) {
4355 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4356 return CAMERA_ERROR_INVALID_PARAMETER;
4358 int ret = CAMERA_ERROR_NONE;
4360 camera_cli_s *pc = (camera_cli_s *)camera;
4361 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_SCENE_MODE;
4363 if (pc->cb_info == NULL) {
4364 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4365 return CAMERA_ERROR_INVALID_PARAMETER;
4367 sock_fd = pc->cb_info->fd;
4368 int set_mode = (int)mode;
4369 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4370 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
4371 LOGD("ret : 0x%x", ret);
4376 int camera_attr_enable_tag(camera_h camera, bool enable)
4378 if (camera == NULL) {
4379 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4380 return CAMERA_ERROR_INVALID_PARAMETER;
4382 int ret = CAMERA_ERROR_NONE;
4383 camera_cli_s *pc = (camera_cli_s *)camera;
4384 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_TAG;
4386 if (pc->cb_info == NULL) {
4387 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4388 return CAMERA_ERROR_INVALID_PARAMETER;
4390 sock_fd = pc->cb_info->fd;
4391 int set_enable = (int)enable;
4393 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4394 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
4395 LOGD("ret : 0x%x", ret);
4400 int camera_attr_set_tag_image_description(camera_h camera, const char *description)
4402 if (camera == NULL) {
4403 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4404 return CAMERA_ERROR_INVALID_PARAMETER;
4406 if (description == NULL) {
4407 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4408 return CAMERA_ERROR_INVALID_PARAMETER;
4410 int ret = CAMERA_ERROR_NONE;
4411 camera_cli_s *pc = (camera_cli_s *)camera;
4412 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_IMAGE_DESCRIPTION;
4414 if (pc->cb_info == NULL) {
4415 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4416 return CAMERA_ERROR_INVALID_PARAMETER;
4418 sock_fd = pc->cb_info->fd;
4419 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4420 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, STRING, description);
4421 LOGD("ret : 0x%x", ret);
4426 int camera_attr_set_tag_orientation(camera_h camera, camera_attr_tag_orientation_e orientation)
4428 if (camera == NULL) {
4429 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4430 return CAMERA_ERROR_INVALID_PARAMETER;
4432 int ret = CAMERA_ERROR_NONE;
4433 camera_cli_s *pc = (camera_cli_s *)camera;
4434 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_ORIENTATION;
4436 if (pc->cb_info == NULL) {
4437 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4438 return CAMERA_ERROR_INVALID_PARAMETER;
4440 sock_fd = pc->cb_info->fd;
4441 int set_orientation = (int)orientation;
4443 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4444 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_orientation);
4445 LOGD("ret : 0x%x", ret);
4450 int camera_attr_set_tag_software(camera_h camera, const char *software)
4452 if (camera == NULL) {
4453 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4454 return CAMERA_ERROR_INVALID_PARAMETER;
4456 if (software == NULL) {
4457 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4458 return CAMERA_ERROR_INVALID_PARAMETER;
4460 int ret = CAMERA_ERROR_NONE;
4461 camera_cli_s *pc = (camera_cli_s *)camera;
4462 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_SOFTWARE;
4464 if (pc->cb_info == NULL) {
4465 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4466 return CAMERA_ERROR_INVALID_PARAMETER;
4468 sock_fd = pc->cb_info->fd;
4469 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4470 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, STRING, software);
4471 LOGD("ret : 0x%x", ret);
4476 int camera_attr_set_geotag(camera_h camera, double latitude , double longitude, double altitude)
4478 if (camera == NULL) {
4479 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4480 return CAMERA_ERROR_INVALID_PARAMETER;
4482 int ret = CAMERA_ERROR_NONE;
4483 camera_cli_s *pc = (camera_cli_s *)camera;
4484 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_GEOTAG;
4486 if (pc->cb_info == NULL) {
4487 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4488 return CAMERA_ERROR_INVALID_PARAMETER;
4490 sock_fd = pc->cb_info->fd;
4491 double set_geotag[3] = { latitude, longitude, altitude };
4493 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4494 muse_camera_msg_send_array(api, sock_fd, pc->cb_info, ret,
4495 set_geotag, sizeof(set_geotag), sizeof(double));
4496 LOGD("ret : 0x%x", ret);
4501 int camera_attr_remove_geotag(camera_h camera)
4503 if (camera == NULL) {
4504 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4505 return CAMERA_ERROR_INVALID_PARAMETER;
4507 int ret = CAMERA_ERROR_NONE;
4508 camera_cli_s *pc = (camera_cli_s *)camera;
4509 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_REMOVE_GEOTAG;
4511 if (pc->cb_info == NULL) {
4512 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4513 return CAMERA_ERROR_INVALID_PARAMETER;
4515 sock_fd = pc->cb_info->fd;
4516 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4517 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4518 LOGD("ret : 0x%x", ret);
4523 int camera_attr_set_flash_mode(camera_h camera, camera_attr_flash_mode_e mode)
4525 if (camera == NULL) {
4526 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4527 return CAMERA_ERROR_INVALID_PARAMETER;
4529 int ret = CAMERA_ERROR_NONE;
4530 camera_cli_s *pc = (camera_cli_s *)camera;
4531 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_FLASH_MODE;
4533 if (pc->cb_info == NULL) {
4534 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4535 return CAMERA_ERROR_INVALID_PARAMETER;
4537 sock_fd = pc->cb_info->fd;
4538 int set_mode = (int)mode;
4540 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4541 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
4542 LOGD("ret : 0x%x", ret);
4547 int camera_attr_get_zoom(camera_h camera, int *zoom)
4549 if (camera == NULL || zoom == NULL) {
4550 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4551 return CAMERA_ERROR_INVALID_PARAMETER;
4553 int ret = CAMERA_ERROR_NONE;
4555 camera_cli_s *pc = (camera_cli_s *)camera;
4556 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ZOOM;
4559 if (pc->cb_info == NULL) {
4560 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4561 return CAMERA_ERROR_INVALID_PARAMETER;
4563 sock_fd = pc->cb_info->fd;
4565 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4566 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4568 if (ret == CAMERA_ERROR_NONE) {
4569 muse_camera_msg_get(get_zoom, pc->cb_info->recv_msg);
4572 LOGD("ret : 0x%x", ret);
4577 int camera_attr_get_zoom_range(camera_h camera, int *min, int *max)
4579 if (camera == NULL || min == NULL || max == NULL) {
4580 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4581 return CAMERA_ERROR_INVALID_PARAMETER;
4583 int ret = CAMERA_ERROR_NONE;
4584 camera_cli_s *pc = (camera_cli_s *)camera;
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;
4591 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ZOOM_RANGE;
4595 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4596 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4598 if (ret == CAMERA_ERROR_NONE) {
4599 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
4600 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
4604 LOGD("ret : 0x%x", ret);
4609 int camera_attr_get_af_mode(camera_h camera, camera_attr_af_mode_e *mode)
4611 if (camera == NULL || mode == NULL) {
4612 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4613 return CAMERA_ERROR_INVALID_PARAMETER;
4615 int ret = CAMERA_ERROR_NONE;
4616 camera_cli_s *pc = (camera_cli_s *)camera;
4618 if (pc->cb_info == NULL) {
4619 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4620 return CAMERA_ERROR_INVALID_PARAMETER;
4622 sock_fd = pc->cb_info->fd;
4623 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_AF_MODE;
4626 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4627 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4629 if (ret == CAMERA_ERROR_NONE) {
4630 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
4631 *mode = (camera_attr_af_mode_e)get_mode;
4633 LOGD("ret : 0x%x", ret);
4638 int camera_attr_get_exposure_mode(camera_h camera, camera_attr_exposure_mode_e *mode)
4640 if (camera == NULL || mode == NULL) {
4641 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4642 return CAMERA_ERROR_INVALID_PARAMETER;
4644 int ret = CAMERA_ERROR_NONE;
4645 camera_cli_s *pc = (camera_cli_s *)camera;
4647 if (pc->cb_info == NULL) {
4648 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4649 return CAMERA_ERROR_INVALID_PARAMETER;
4651 sock_fd = pc->cb_info->fd;
4652 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE_MODE;
4655 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4656 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4658 if (ret == CAMERA_ERROR_NONE) {
4659 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
4660 *mode = (camera_attr_exposure_mode_e)get_mode;
4662 LOGD("ret : 0x%x", ret);
4666 int camera_attr_get_exposure(camera_h camera, int *value)
4668 if (camera == NULL || value == NULL) {
4669 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4670 return CAMERA_ERROR_INVALID_PARAMETER;
4672 int ret = CAMERA_ERROR_NONE;
4673 camera_cli_s *pc = (camera_cli_s *)camera;
4675 if (pc->cb_info == NULL) {
4676 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4677 return CAMERA_ERROR_INVALID_PARAMETER;
4679 sock_fd = pc->cb_info->fd;
4680 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE;
4683 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4684 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4686 if (ret == CAMERA_ERROR_NONE) {
4687 muse_camera_msg_get(get_value, pc->cb_info->recv_msg);
4690 LOGD("ret : 0x%x", ret);
4695 int camera_attr_get_exposure_range(camera_h camera, int *min, int *max)
4697 if (camera == NULL || min == NULL || max == NULL) {
4698 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4699 return CAMERA_ERROR_INVALID_PARAMETER;
4701 int ret = CAMERA_ERROR_NONE;
4702 camera_cli_s *pc = (camera_cli_s *)camera;
4704 if (pc->cb_info == NULL) {
4705 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4706 return CAMERA_ERROR_INVALID_PARAMETER;
4708 sock_fd = pc->cb_info->fd;
4709 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE_RANGE;
4713 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4714 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4716 if (ret == CAMERA_ERROR_NONE) {
4717 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
4718 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
4722 LOGD("ret : 0x%x", ret);
4727 int camera_attr_get_iso(camera_h camera, camera_attr_iso_e *iso)
4729 if (camera == NULL || iso == NULL) {
4730 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4731 return CAMERA_ERROR_INVALID_PARAMETER;
4733 int ret = CAMERA_ERROR_NONE;
4734 camera_cli_s *pc = (camera_cli_s *)camera;
4736 if (pc->cb_info == NULL) {
4737 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4738 return CAMERA_ERROR_INVALID_PARAMETER;
4740 sock_fd = pc->cb_info->fd;
4741 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ISO;
4744 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4745 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4747 if (ret == CAMERA_ERROR_NONE) {
4748 muse_camera_msg_get(get_iso, pc->cb_info->recv_msg);
4749 *iso = (camera_attr_iso_e)get_iso;
4751 LOGD("ret : 0x%x", ret);
4756 int camera_attr_get_brightness(camera_h camera, int *level)
4758 if (camera == NULL || level == NULL) {
4759 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4760 return CAMERA_ERROR_INVALID_PARAMETER;
4762 int ret = CAMERA_ERROR_NONE;
4763 camera_cli_s *pc = (camera_cli_s *)camera;
4765 if (pc->cb_info == NULL) {
4766 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4767 return CAMERA_ERROR_INVALID_PARAMETER;
4769 sock_fd = pc->cb_info->fd;
4770 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_BRIGHTNESS;
4773 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4774 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4776 if (ret == CAMERA_ERROR_NONE) {
4777 muse_camera_msg_get(get_level, pc->cb_info->recv_msg);
4780 LOGD("ret : 0x%x", ret);
4785 int camera_attr_get_brightness_range(camera_h camera, int *min, int *max)
4787 if (camera == NULL || min == NULL || max == NULL) {
4788 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4789 return CAMERA_ERROR_INVALID_PARAMETER;
4791 int ret = CAMERA_ERROR_NONE;
4792 camera_cli_s *pc = (camera_cli_s *)camera;
4794 if (pc->cb_info == NULL) {
4795 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4796 return CAMERA_ERROR_INVALID_PARAMETER;
4798 sock_fd = pc->cb_info->fd;
4799 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_BRIGHTNESS_RANGE;
4803 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4804 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4806 if (ret == CAMERA_ERROR_NONE) {
4807 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
4808 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
4812 LOGD("ret : 0x%x", ret);
4817 int camera_attr_get_contrast(camera_h camera, int *level)
4819 if (camera == NULL || level == NULL) {
4820 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4821 return CAMERA_ERROR_INVALID_PARAMETER;
4823 int ret = CAMERA_ERROR_NONE;
4824 camera_cli_s *pc = (camera_cli_s *)camera;
4825 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_CONTRAST;
4827 if (pc->cb_info == NULL) {
4828 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4829 return CAMERA_ERROR_INVALID_PARAMETER;
4831 sock_fd = pc->cb_info->fd;
4834 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4835 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4837 if (ret == CAMERA_ERROR_NONE) {
4838 muse_camera_msg_get(get_level, pc->cb_info->recv_msg);
4841 LOGD("ret : 0x%x", ret);
4846 int camera_attr_get_contrast_range(camera_h camera, int *min , int *max)
4848 if (camera == NULL || min == NULL || max == NULL) {
4849 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4850 return CAMERA_ERROR_INVALID_PARAMETER;
4852 int ret = CAMERA_ERROR_NONE;
4853 camera_cli_s *pc = (camera_cli_s *)camera;
4854 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_CONTRAST_RANGE;
4856 if (pc->cb_info == NULL) {
4857 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4858 return CAMERA_ERROR_INVALID_PARAMETER;
4860 sock_fd = pc->cb_info->fd;
4864 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4865 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4867 if (ret == CAMERA_ERROR_NONE) {
4868 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
4869 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
4873 LOGD("ret : 0x%x", ret);
4878 int camera_attr_get_whitebalance(camera_h camera, camera_attr_whitebalance_e *wb)
4880 if (camera == NULL || wb == NULL) {
4881 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4882 return CAMERA_ERROR_INVALID_PARAMETER;
4884 int ret = CAMERA_ERROR_NONE;
4885 camera_cli_s *pc = (camera_cli_s *)camera;
4886 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_WHITEBALANCE;
4888 if (pc->cb_info == NULL) {
4889 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4890 return CAMERA_ERROR_INVALID_PARAMETER;
4892 sock_fd = pc->cb_info->fd;
4895 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4896 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4898 if (ret == CAMERA_ERROR_NONE) {
4899 muse_camera_msg_get(get_wb, pc->cb_info->recv_msg);
4900 *wb = (camera_attr_whitebalance_e)get_wb;
4902 LOGD("ret : 0x%x", ret);
4907 int camera_attr_get_effect(camera_h camera, camera_attr_effect_mode_e *effect)
4909 if (camera == NULL || effect == NULL) {
4910 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4911 return CAMERA_ERROR_INVALID_PARAMETER;
4914 int ret = CAMERA_ERROR_NONE;
4915 camera_cli_s *pc = (camera_cli_s *)camera;
4916 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EFFECT;
4918 if (pc->cb_info == NULL) {
4919 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4920 return CAMERA_ERROR_INVALID_PARAMETER;
4922 sock_fd = pc->cb_info->fd;
4925 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4926 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4928 if (ret == CAMERA_ERROR_NONE) {
4929 muse_camera_msg_get(get_effect, pc->cb_info->recv_msg);
4930 *effect = (camera_attr_effect_mode_e)get_effect;
4932 LOGD("ret : 0x%x", ret);
4937 int camera_attr_get_scene_mode(camera_h camera, camera_attr_scene_mode_e *mode)
4939 if (camera == NULL || mode == NULL) {
4940 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4941 return CAMERA_ERROR_INVALID_PARAMETER;
4944 int ret = CAMERA_ERROR_NONE;
4945 camera_cli_s *pc = (camera_cli_s *)camera;
4946 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_SCENE_MODE;
4948 if (pc->cb_info == NULL) {
4949 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4950 return CAMERA_ERROR_INVALID_PARAMETER;
4952 sock_fd = pc->cb_info->fd;
4955 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4956 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4958 if (ret == CAMERA_ERROR_NONE) {
4959 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
4960 *mode = (camera_attr_scene_mode_e)get_mode;
4962 LOGD("ret : 0x%x", ret);
4967 int camera_attr_is_enabled_tag(camera_h camera, bool *enable)
4969 if (camera == NULL || enable == NULL) {
4970 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4971 return CAMERA_ERROR_INVALID_PARAMETER;
4974 int ret = CAMERA_ERROR_NONE;
4975 camera_cli_s *pc = (camera_cli_s *)camera;
4976 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_TAG;
4978 if (pc->cb_info == NULL) {
4979 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4980 return CAMERA_ERROR_INVALID_PARAMETER;
4982 sock_fd = pc->cb_info->fd;
4985 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4986 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4988 if (ret == CAMERA_ERROR_NONE) {
4989 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
4990 *enable = (bool)get_enabled;
4992 LOGD("ret : 0x%x", ret);
4997 int camera_attr_get_tag_image_description(camera_h camera, char **description)
4999 if (camera == NULL || description == NULL) {
5000 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5001 return CAMERA_ERROR_INVALID_PARAMETER;
5004 int ret = CAMERA_ERROR_NONE;
5005 camera_cli_s *pc = (camera_cli_s *)camera;
5006 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_IMAGE_DESCRIPTION;
5008 if (pc->cb_info == NULL) {
5009 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5010 return CAMERA_ERROR_INVALID_PARAMETER;
5012 sock_fd = pc->cb_info->fd;
5013 char get_description[MUSE_CAMERA_MSG_MAX_LENGTH] = {0,};
5015 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5016 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5018 if (ret == CAMERA_ERROR_NONE) {
5019 muse_camera_msg_get_string(get_description, pc->cb_info->recv_msg);
5020 *description = strdup(get_description);
5022 LOGD("ret : 0x%x", ret);
5027 int camera_attr_get_tag_orientation(camera_h camera, camera_attr_tag_orientation_e *orientation)
5029 if (camera == NULL || orientation == NULL) {
5030 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5031 return CAMERA_ERROR_INVALID_PARAMETER;
5034 int ret = CAMERA_ERROR_NONE;
5035 camera_cli_s *pc = (camera_cli_s *)camera;
5036 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_ORIENTATION;
5038 if (pc->cb_info == NULL) {
5039 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5040 return CAMERA_ERROR_INVALID_PARAMETER;
5042 sock_fd = pc->cb_info->fd;
5043 int get_orientation;
5045 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5046 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5048 if (ret == CAMERA_ERROR_NONE) {
5049 muse_camera_msg_get(get_orientation, pc->cb_info->recv_msg);
5050 *orientation = (camera_attr_tag_orientation_e)get_orientation;
5051 LOGD("success, orientation : %d", *orientation);
5053 LOGD("ret : 0x%x", ret);
5058 int camera_attr_get_tag_software(camera_h camera, char **software)
5060 if (camera == NULL || software == NULL) {
5061 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5062 return CAMERA_ERROR_INVALID_PARAMETER;
5065 int ret = CAMERA_ERROR_NONE;
5066 camera_cli_s *pc = (camera_cli_s *)camera;
5067 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_SOFTWARE;
5069 if (pc->cb_info == NULL) {
5070 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5071 return CAMERA_ERROR_INVALID_PARAMETER;
5073 sock_fd = pc->cb_info->fd;
5074 char get_software[MUSE_CAMERA_MSG_MAX_LENGTH] = {0,};
5076 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5077 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5079 if (ret == CAMERA_ERROR_NONE) {
5080 muse_camera_msg_get_string(get_software, pc->cb_info->recv_msg);
5081 *software = strdup(get_software);
5083 LOGD("ret : 0x%x", ret);
5088 int camera_attr_get_geotag(camera_h camera, double *latitude , double *longitude, double *altitude)
5090 if (camera == NULL || latitude == NULL || longitude == NULL || altitude == NULL) {
5091 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5092 return CAMERA_ERROR_INVALID_PARAMETER;
5095 int ret = CAMERA_ERROR_NONE;
5096 camera_cli_s *pc = (camera_cli_s *)camera;
5097 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_GEOTAG;
5098 double get_geotag[3] = {0,};
5100 if (pc->cb_info == NULL) {
5101 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5102 return CAMERA_ERROR_INVALID_PARAMETER;
5104 sock_fd = pc->cb_info->fd;
5106 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5108 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5110 if (ret == CAMERA_ERROR_NONE) {
5111 muse_camera_msg_get_array(get_geotag, pc->cb_info->recv_msg);
5112 *latitude = get_geotag[0];
5113 *longitude = get_geotag[1];
5114 *altitude = get_geotag[2];
5116 LOGD("ret : 0x%x", ret);
5118 LOGE("Returned value is not valid : 0x%x", ret);
5125 int camera_attr_get_flash_mode(camera_h camera, camera_attr_flash_mode_e *mode)
5127 if (camera == NULL || mode == NULL) {
5128 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5129 return CAMERA_ERROR_INVALID_PARAMETER;
5132 int ret = CAMERA_ERROR_NONE;
5133 camera_cli_s *pc = (camera_cli_s *)camera;
5134 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_FLASH_MODE;
5136 if (pc->cb_info == NULL) {
5137 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5138 return CAMERA_ERROR_INVALID_PARAMETER;
5140 sock_fd = pc->cb_info->fd;
5143 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5144 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5146 if (ret == CAMERA_ERROR_NONE) {
5147 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
5148 *mode = (camera_attr_flash_mode_e)get_mode;
5150 LOGD("ret : 0x%x", ret);
5154 int camera_get_flash_state(camera_device_e device, camera_flash_state_e *state)
5158 int ret = CAMERA_ERROR_NONE;
5159 camera_cli_s *pc = NULL;
5160 int get_flash_state = 0;
5162 /* create muse connection */
5163 muse_camera_api_e api = MUSE_CAMERA_API_GET_FLASH_STATE;
5164 muse_core_api_module_e muse_module = MUSE_CAMERA;
5165 int device_type = (int)device;
5167 sock_fd = muse_core_client_new();
5169 LOGE("muse_core_client_new failed - returned fd %d", sock_fd);
5170 ret = CAMERA_ERROR_INVALID_OPERATION;
5174 sndMsg = muse_core_msg_json_factory_new(api,
5175 MUSE_TYPE_INT, "module", muse_module,
5176 MUSE_TYPE_INT, PARAM_DEVICE_TYPE, device_type,
5179 muse_core_ipc_send_msg(sock_fd, sndMsg);
5180 muse_core_msg_json_factory_free(sndMsg);
5182 pc = g_new0(camera_cli_s, 1);
5184 LOGE("camera_cli_s alloc failed");
5185 ret = CAMERA_ERROR_OUT_OF_MEMORY;
5189 pc->cb_info = _client_callback_new(sock_fd);
5190 if (pc->cb_info == NULL) {
5191 LOGE("cb_info alloc failed");
5192 ret = CAMERA_ERROR_OUT_OF_MEMORY;
5196 ret = _client_wait_for_cb_return(api, pc->cb_info, CALLBACK_TIME_OUT);
5198 if (ret == CAMERA_ERROR_NONE) {
5199 muse_camera_msg_get(get_flash_state, pc->cb_info->recv_msg);
5200 *state = (camera_flash_state_e)get_flash_state;
5203 LOGD("Flash state : %d\n", *state);
5206 /* release resources */
5208 g_atomic_int_set(&pc->cb_info->msg_recv_running, 0);
5209 g_atomic_int_set(&pc->cb_info->msg_handler_running, 0);
5210 _client_callback_destroy(pc->cb_info);
5219 int camera_attr_foreach_supported_af_mode(camera_h camera, camera_attr_supported_af_mode_cb foreach_cb, void *user_data)
5221 if (camera == NULL || foreach_cb == NULL) {
5222 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5223 return CAMERA_ERROR_INVALID_PARAMETER;
5225 int ret = CAMERA_ERROR_NONE;
5227 camera_cli_s *pc = (camera_cli_s *)camera;
5228 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_AF_MODE;
5230 LOGD("Enter, handle :%x", pc->remote_handle);
5233 if (pc->cb_info == NULL) {
5234 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5235 return CAMERA_ERROR_INVALID_PARAMETER;
5237 sock_fd = pc->cb_info->fd;
5238 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_AF_MODE] = foreach_cb;
5239 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_AF_MODE] = user_data;
5241 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5242 LOGD("ret : 0x%x", ret);
5247 int camera_attr_foreach_supported_exposure_mode(camera_h camera, camera_attr_supported_exposure_mode_cb foreach_cb , void *user_data)
5249 if (camera == NULL || foreach_cb == NULL) {
5250 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5251 return CAMERA_ERROR_INVALID_PARAMETER;
5253 int ret = CAMERA_ERROR_NONE;
5255 camera_cli_s *pc = (camera_cli_s *)camera;
5256 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_EXPOSURE_MODE;
5258 LOGD("Enter, handle :%x", pc->remote_handle);
5261 if (pc->cb_info == NULL) {
5262 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5263 return CAMERA_ERROR_INVALID_PARAMETER;
5265 sock_fd = pc->cb_info->fd;
5266 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EXPOSURE_MODE] = foreach_cb;
5267 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EXPOSURE_MODE] = user_data;
5269 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5270 LOGD("ret : 0x%x", ret);
5275 int camera_attr_foreach_supported_iso(camera_h camera, camera_attr_supported_iso_cb foreach_cb, void *user_data)
5277 if (camera == NULL || foreach_cb == NULL) {
5278 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5279 return CAMERA_ERROR_INVALID_PARAMETER;
5281 int ret = CAMERA_ERROR_NONE;
5283 camera_cli_s *pc = (camera_cli_s *)camera;
5284 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_ISO;
5286 LOGD("Enter, handle :%x", pc->remote_handle);
5289 if (pc->cb_info == NULL) {
5290 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5291 return CAMERA_ERROR_INVALID_PARAMETER;
5293 sock_fd = pc->cb_info->fd;
5294 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_ISO] = foreach_cb;
5295 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_ISO] = user_data;
5297 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5298 LOGD("ret : 0x%x", ret);
5303 int camera_attr_foreach_supported_whitebalance(camera_h camera, camera_attr_supported_whitebalance_cb foreach_cb , void *user_data)
5305 if (camera == NULL || foreach_cb == NULL) {
5306 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5307 return CAMERA_ERROR_INVALID_PARAMETER;
5309 int ret = CAMERA_ERROR_NONE;
5311 camera_cli_s *pc = (camera_cli_s *)camera;
5312 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_WHITEBALANCE;
5314 LOGD("Enter, handle :%x", pc->remote_handle);
5317 if (pc->cb_info == NULL) {
5318 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5319 return CAMERA_ERROR_INVALID_PARAMETER;
5321 sock_fd = pc->cb_info->fd;
5322 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_WHITEBALANCE] = foreach_cb;
5323 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_WHITEBALANCE] = user_data;
5325 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5326 LOGD("ret : 0x%x", ret);
5331 int camera_attr_foreach_supported_effect(camera_h camera, camera_attr_supported_effect_cb foreach_cb , void *user_data)
5333 if (camera == NULL || foreach_cb == NULL) {
5334 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5335 return CAMERA_ERROR_INVALID_PARAMETER;
5337 int ret = CAMERA_ERROR_NONE;
5339 camera_cli_s *pc = (camera_cli_s *)camera;
5340 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_EFFECT;
5342 LOGD("Enter, handle :%x", pc->remote_handle);
5345 if (pc->cb_info == NULL) {
5346 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5347 return CAMERA_ERROR_INVALID_PARAMETER;
5349 sock_fd = pc->cb_info->fd;
5350 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EFFECT] = foreach_cb;
5351 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EFFECT] = user_data;
5353 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5354 LOGD("ret : 0x%x", ret);
5359 int camera_attr_foreach_supported_scene_mode(camera_h camera, camera_attr_supported_scene_mode_cb foreach_cb , void *user_data)
5361 if (camera == NULL || foreach_cb == NULL) {
5362 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5363 return CAMERA_ERROR_INVALID_PARAMETER;
5365 int ret = CAMERA_ERROR_NONE;
5367 camera_cli_s *pc = (camera_cli_s *)camera;
5368 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_SCENE_MODE;
5370 LOGD("Enter, handle :%x", pc->remote_handle);
5373 if (pc->cb_info == NULL) {
5374 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5375 return CAMERA_ERROR_INVALID_PARAMETER;
5377 sock_fd = pc->cb_info->fd;
5378 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_SCENE_MODE] = foreach_cb;
5379 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_SCENE_MODE] = user_data;
5381 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5382 LOGD("ret : 0x%x", ret);
5387 int camera_attr_foreach_supported_flash_mode(camera_h camera, camera_attr_supported_flash_mode_cb foreach_cb , void *user_data)
5389 if (camera == NULL || foreach_cb == NULL) {
5390 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5391 return CAMERA_ERROR_INVALID_PARAMETER;
5393 int ret = CAMERA_ERROR_NONE;
5395 camera_cli_s *pc = (camera_cli_s *)camera;
5396 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FLASH_MODE;
5398 LOGD("Enter, handle :%x", pc->remote_handle);
5401 if (pc->cb_info == NULL) {
5402 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5403 return CAMERA_ERROR_INVALID_PARAMETER;
5405 sock_fd = pc->cb_info->fd;
5406 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FLASH_MODE] = foreach_cb;
5407 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FLASH_MODE] = user_data;
5409 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5410 LOGD("ret : 0x%x", ret);
5415 int camera_attr_foreach_supported_fps(camera_h camera, camera_attr_supported_fps_cb foreach_cb , void *user_data)
5417 if (camera == NULL || foreach_cb == NULL) {
5418 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5419 return CAMERA_ERROR_INVALID_PARAMETER;
5421 int ret = CAMERA_ERROR_NONE;
5423 camera_cli_s *pc = (camera_cli_s *)camera;
5424 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FPS;
5426 if (pc->cb_info == NULL) {
5427 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5428 return CAMERA_ERROR_INVALID_PARAMETER;
5430 sock_fd = pc->cb_info->fd;
5431 LOGD("Enter, handle :%x", pc->remote_handle);
5432 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS] = foreach_cb;
5433 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS] = user_data;
5435 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5436 LOGD("Enter, handle :%x", pc->remote_handle);
5440 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)
5442 if (camera == NULL || foreach_cb == NULL) {
5443 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5444 return CAMERA_ERROR_INVALID_PARAMETER;
5446 int ret = CAMERA_ERROR_NONE;
5448 camera_cli_s *pc = (camera_cli_s *)camera;
5449 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FPS_BY_RESOLUTION;
5451 if (pc->cb_info == NULL) {
5452 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5453 return CAMERA_ERROR_INVALID_PARAMETER;
5455 sock_fd = pc->cb_info->fd;
5456 LOGD("Enter, handle :%x", pc->remote_handle);
5457 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS_BY_RESOLUTION] = foreach_cb;
5458 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS_BY_RESOLUTION] = user_data;
5460 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, width, INT, height);
5461 LOGD("ret : 0x%x", ret);
5465 int camera_attr_foreach_supported_stream_flip(camera_h camera, camera_attr_supported_stream_flip_cb foreach_cb, void *user_data)
5467 if (camera == NULL || foreach_cb == NULL) {
5468 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5469 return CAMERA_ERROR_INVALID_PARAMETER;
5471 int ret = CAMERA_ERROR_NONE;
5473 camera_cli_s *pc = (camera_cli_s *)camera;
5474 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_STREAM_FLIP;
5476 if (pc->cb_info == NULL) {
5477 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5478 return CAMERA_ERROR_INVALID_PARAMETER;
5480 sock_fd = pc->cb_info->fd;
5481 LOGD("Enter, handle :%x", pc->remote_handle);
5482 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_FLIP] = foreach_cb;
5483 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_FLIP] = user_data;
5485 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5486 LOGD("ret : 0x%x", ret);
5491 int camera_attr_foreach_supported_stream_rotation(camera_h camera, camera_attr_supported_stream_rotation_cb foreach_cb, void *user_data)
5493 if (camera == NULL || foreach_cb == NULL) {
5494 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5495 return CAMERA_ERROR_INVALID_PARAMETER;
5497 int ret = CAMERA_ERROR_NONE;
5499 camera_cli_s *pc = (camera_cli_s *)camera;
5500 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_STREAM_ROTATION;
5502 if (pc->cb_info == NULL) {
5503 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5504 return CAMERA_ERROR_INVALID_PARAMETER;
5506 sock_fd = pc->cb_info->fd;
5507 LOGD("Enter, handle :%x", pc->remote_handle);
5508 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION] = foreach_cb;
5509 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION] = user_data;
5511 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5512 LOGD("ret : 0x%x", ret);
5517 int camera_attr_set_stream_rotation(camera_h camera , camera_rotation_e rotation)
5519 if (camera == NULL) {
5520 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5521 return CAMERA_ERROR_INVALID_PARAMETER;
5524 int ret = CAMERA_ERROR_NONE;
5525 camera_cli_s *pc = (camera_cli_s *)camera;
5526 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_STREAM_ROTATION;
5528 if (pc->cb_info == NULL) {
5529 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5530 return CAMERA_ERROR_INVALID_PARAMETER;
5532 sock_fd = pc->cb_info->fd;
5533 int set_rotation = (int)rotation;
5535 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5536 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_rotation);
5537 LOGD("ret : 0x%x", ret);
5542 int camera_attr_get_stream_rotation(camera_h camera , camera_rotation_e *rotation)
5544 if (camera == NULL || rotation == NULL) {
5545 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5546 return CAMERA_ERROR_INVALID_PARAMETER;
5549 int ret = CAMERA_ERROR_NONE;
5550 camera_cli_s *pc = (camera_cli_s *)camera;
5551 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_STREAM_ROTATION;
5553 if (pc->cb_info == NULL) {
5554 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5555 return CAMERA_ERROR_INVALID_PARAMETER;
5557 sock_fd = pc->cb_info->fd;
5560 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5561 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5563 if (ret == CAMERA_ERROR_NONE) {
5564 muse_camera_msg_get(get_rotation, pc->cb_info->recv_msg);
5565 *rotation = (camera_rotation_e)get_rotation;
5567 LOGD("ret : 0x%x", ret);
5572 int camera_attr_set_stream_flip(camera_h camera , camera_flip_e flip)
5574 if (camera == NULL) {
5575 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5576 return CAMERA_ERROR_INVALID_PARAMETER;
5579 int ret = CAMERA_ERROR_NONE;
5580 camera_cli_s *pc = (camera_cli_s *)camera;
5581 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_STREAM_FLIP;
5583 if (pc->cb_info == NULL) {
5584 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5585 return CAMERA_ERROR_INVALID_PARAMETER;
5587 sock_fd = pc->cb_info->fd;
5588 int set_flip = (int)flip;
5590 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5591 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_flip);
5592 LOGD("ret : 0x%x", ret);
5597 int camera_attr_get_stream_flip(camera_h camera , camera_flip_e *flip)
5599 if (camera == NULL || flip == NULL) {
5600 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5601 return CAMERA_ERROR_INVALID_PARAMETER;
5604 int ret = CAMERA_ERROR_NONE;
5605 camera_cli_s *pc = (camera_cli_s *)camera;
5606 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_STREAM_FLIP;
5608 if (pc->cb_info == NULL) {
5609 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5610 return CAMERA_ERROR_INVALID_PARAMETER;
5612 sock_fd = pc->cb_info->fd;
5615 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5616 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5618 if (ret == CAMERA_ERROR_NONE) {
5619 muse_camera_msg_get(get_flip, pc->cb_info->recv_msg);
5620 *flip = (camera_flip_e)get_flip;
5622 LOGD("ret : 0x%x", ret);
5626 int camera_attr_set_hdr_mode(camera_h camera, camera_attr_hdr_mode_e mode)
5628 if (camera == NULL) {
5629 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5630 return CAMERA_ERROR_INVALID_PARAMETER;
5633 int ret = CAMERA_ERROR_NONE;
5634 camera_cli_s *pc = (camera_cli_s *)camera;
5635 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_HDR_MODE;
5637 if (pc->cb_info == NULL) {
5638 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5639 return CAMERA_ERROR_INVALID_PARAMETER;
5641 sock_fd = pc->cb_info->fd;
5642 int set_mode = (int)mode;
5644 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5645 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
5646 LOGD("ret : 0x%x", ret);
5651 int camera_attr_get_hdr_mode(camera_h camera, camera_attr_hdr_mode_e *mode)
5653 if (camera == NULL) {
5654 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5655 return CAMERA_ERROR_INVALID_PARAMETER;
5658 LOGE("CAMERA_ERROR_NOT_SUPPORTED(0x%08x) - mode", CAMERA_ERROR_NOT_SUPPORTED);
5659 return CAMERA_ERROR_NOT_SUPPORTED;
5661 int ret = CAMERA_ERROR_NONE;
5662 camera_cli_s *pc = (camera_cli_s *)camera;
5663 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_HDR_MODE;
5665 if (pc->cb_info == NULL) {
5666 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5667 return CAMERA_ERROR_INVALID_PARAMETER;
5669 sock_fd = pc->cb_info->fd;
5672 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5673 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5675 if (ret == CAMERA_ERROR_NONE) {
5676 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
5677 *mode = (camera_attr_hdr_mode_e)get_mode;
5679 LOGD("ret : 0x%x", ret);
5684 bool camera_attr_is_supported_hdr_capture(camera_h camera)
5686 if (camera == NULL) {
5687 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5691 int ret = CAMERA_ERROR_NONE;
5692 camera_cli_s *pc = (camera_cli_s *)camera;
5693 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_HDR_CAPTURE;
5695 if (pc->cb_info == NULL) {
5696 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5697 return CAMERA_ERROR_INVALID_PARAMETER;
5699 sock_fd = pc->cb_info->fd;
5700 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5701 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5702 LOGD("ret : 0x%x", ret);
5707 int camera_attr_set_hdr_capture_progress_cb(camera_h camera, camera_attr_hdr_progress_cb callback, void *user_data)
5709 if (camera == NULL) {
5710 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5711 return CAMERA_ERROR_INVALID_PARAMETER;
5713 if (callback == NULL) {
5714 LOGE("CAMERA_ERROR_NOT_SUPPORTED(0x%08x) - callback", CAMERA_ERROR_NOT_SUPPORTED);
5715 return CAMERA_ERROR_NOT_SUPPORTED;
5717 int ret = CAMERA_ERROR_NONE;
5719 camera_cli_s *pc = (camera_cli_s *)camera;
5720 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_HDR_CAPTURE_PROGRESS_CB;
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, handle :%x", pc->remote_handle);
5729 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = callback;
5730 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = user_data;
5732 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5733 LOGD("ret : 0x%x", ret);
5738 int camera_attr_unset_hdr_capture_progress_cb(camera_h camera)
5740 if (camera == NULL) {
5741 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5742 return CAMERA_ERROR_INVALID_PARAMETER;
5745 int ret = CAMERA_ERROR_NONE;
5747 camera_cli_s *pc = (camera_cli_s *)camera;
5748 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_UNSET_HDR_CAPTURE_PROGRESS_CB;
5750 if (pc->cb_info == NULL) {
5751 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5752 return CAMERA_ERROR_INVALID_PARAMETER;
5754 sock_fd = pc->cb_info->fd;
5755 LOGD("Enter, handle :%x", pc->remote_handle);
5757 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = (void *)NULL;
5758 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = (void *)NULL;
5760 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5761 LOGD("ret : 0x%x", ret);
5766 int camera_attr_enable_anti_shake(camera_h camera, bool enable)
5768 if (camera == NULL) {
5769 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5770 return CAMERA_ERROR_INVALID_PARAMETER;
5773 int ret = CAMERA_ERROR_NONE;
5774 camera_cli_s *pc = (camera_cli_s *)camera;
5775 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_ANTI_SHAKE;
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 int set_enable = (int)enable;
5784 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5785 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
5786 LOGD("ret : 0x%x", ret);
5791 int camera_attr_is_enabled_anti_shake(camera_h camera , bool *enabled)
5793 if (camera == NULL) {
5794 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5795 return CAMERA_ERROR_INVALID_PARAMETER;
5797 if (enabled == NULL) {
5798 LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER);
5799 return CAMERA_ERROR_NOT_SUPPORTED;
5801 int ret = CAMERA_ERROR_NONE;
5802 camera_cli_s *pc = (camera_cli_s *)camera;
5803 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_ANTI_SHAKE;
5805 if (pc->cb_info == NULL) {
5806 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5807 return CAMERA_ERROR_INVALID_PARAMETER;
5809 sock_fd = pc->cb_info->fd;
5812 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5813 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5815 if (ret == CAMERA_ERROR_NONE) {
5816 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
5817 *enabled = (bool)get_enabled;
5819 LOGD("ret : 0x%x", ret);
5824 bool camera_attr_is_supported_anti_shake(camera_h camera)
5827 if (camera == NULL) {
5828 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5832 int ret = CAMERA_ERROR_NONE;
5833 camera_cli_s *pc = (camera_cli_s *)camera;
5834 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_ANTI_SHAKE;
5836 if (pc->cb_info == NULL) {
5837 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5838 return CAMERA_ERROR_INVALID_PARAMETER;
5840 sock_fd = pc->cb_info->fd;
5841 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5842 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5843 LOGD("ret : 0x%x", ret);
5848 int camera_attr_enable_video_stabilization(camera_h camera, bool enable)
5850 if (camera == NULL) {
5851 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5852 return CAMERA_ERROR_INVALID_PARAMETER;
5855 int ret = CAMERA_ERROR_NONE;
5856 camera_cli_s *pc = (camera_cli_s *)camera;
5857 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_VIDEO_STABILIZATION;
5859 if (pc->cb_info == NULL) {
5860 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5861 return CAMERA_ERROR_INVALID_PARAMETER;
5863 sock_fd = pc->cb_info->fd;
5864 int set_enable = (int)enable;
5866 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5867 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
5868 LOGD("ret : 0x%x", ret);
5873 int camera_attr_is_enabled_video_stabilization(camera_h camera, bool *enabled)
5875 if (camera == NULL) {
5876 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5877 return CAMERA_ERROR_INVALID_PARAMETER;
5879 if (enabled == NULL) {
5880 LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER);
5881 return CAMERA_ERROR_NOT_SUPPORTED;
5883 int ret = CAMERA_ERROR_NONE;
5884 camera_cli_s *pc = (camera_cli_s *)camera;
5885 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_VIDEO_STABILIZATION;
5887 if (pc->cb_info == NULL) {
5888 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5889 return CAMERA_ERROR_INVALID_PARAMETER;
5891 sock_fd = pc->cb_info->fd;
5894 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5895 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5897 if (ret == CAMERA_ERROR_NONE) {
5898 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
5899 *enabled = (bool)get_enabled;
5901 LOGD("ret : 0x%x", ret);
5906 bool camera_attr_is_supported_video_stabilization(camera_h camera)
5908 if (camera == NULL) {
5909 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5913 int ret = CAMERA_ERROR_NONE;
5914 camera_cli_s *pc = (camera_cli_s *)camera;
5915 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_VIDEO_STABILIZATION;
5917 if (pc->cb_info == NULL) {
5918 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5919 return CAMERA_ERROR_INVALID_PARAMETER;
5921 sock_fd = pc->cb_info->fd;
5922 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5923 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5924 LOGD("ret : 0x%x", ret);
5929 int camera_attr_enable_auto_contrast(camera_h camera, bool enable)
5931 if (camera == NULL) {
5932 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5933 return CAMERA_ERROR_INVALID_PARAMETER;
5936 int ret = CAMERA_ERROR_NONE;
5937 camera_cli_s *pc = (camera_cli_s *)camera;
5938 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_AUTO_CONTRAST;
5940 if (pc->cb_info == NULL) {
5941 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5942 return CAMERA_ERROR_INVALID_PARAMETER;
5944 sock_fd = pc->cb_info->fd;
5945 int set_enable = (int)enable;
5947 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5948 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
5949 LOGD("ret : 0x%x", ret);
5954 int camera_attr_is_enabled_auto_contrast(camera_h camera, bool *enabled)
5956 if (camera == NULL) {
5957 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5958 return CAMERA_ERROR_INVALID_PARAMETER;
5960 if (enabled == NULL) {
5961 LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER);
5962 return CAMERA_ERROR_INVALID_PARAMETER;
5964 int ret = CAMERA_ERROR_NONE;
5965 camera_cli_s *pc = (camera_cli_s *)camera;
5966 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_AUTO_CONTRAST;
5968 if (pc->cb_info == NULL) {
5969 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5970 return CAMERA_ERROR_INVALID_PARAMETER;
5972 sock_fd = pc->cb_info->fd;
5975 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5976 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5978 if (ret == CAMERA_ERROR_NONE) {
5979 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
5980 *enabled = (bool)get_enabled;
5982 LOGD("ret : 0x%x", ret);
5987 bool camera_attr_is_supported_auto_contrast(camera_h camera)
5989 if (camera == NULL) {
5990 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5994 int ret = CAMERA_ERROR_NONE;
5995 camera_cli_s *pc = (camera_cli_s *)camera;
5996 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_AUTO_CONTRAST;
5998 if (pc->cb_info == NULL) {
5999 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6000 return CAMERA_ERROR_INVALID_PARAMETER;
6002 sock_fd = pc->cb_info->fd;
6003 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6004 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6005 LOGD("ret : 0x%x", ret);
6010 int camera_attr_disable_shutter_sound(camera_h camera, bool disable)
6012 if (camera == NULL) {
6013 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6014 return CAMERA_ERROR_INVALID_PARAMETER;
6017 int ret = CAMERA_ERROR_NONE;
6018 camera_cli_s *pc = (camera_cli_s *)camera;
6019 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_DISABLE_SHUTTER_SOUND;
6021 if (pc->cb_info == NULL) {
6022 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6023 return CAMERA_ERROR_INVALID_PARAMETER;
6025 sock_fd = pc->cb_info->fd;
6026 int set_disable = (int)disable;
6028 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6029 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_disable);
6030 LOGD("ret : 0x%x", ret);