2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
24 #include <muse_camera.h>
25 #include <muse_camera_msg.h>
26 #include <muse_core_ipc.h>
27 #include <muse_core_module.h>
28 #include <camera_private.h>
29 #include <muse_core.h>
31 #include <Elementary.h>
32 #include <tbm_surface_internal.h>
35 #include <Ecore_Wayland.h>
36 #include <wayland-client.h>
37 #include <tizen-extension-client-protocol.h>
41 #include <mm_evas_renderer.h>
46 #define LOG_TAG "TIZEN_N_CAMERA"
50 static void __global(void *data, struct wl_registry *registry,
51 uint32_t name, const char *interface, uint32_t version)
53 struct tizen_surface **tz_surface = NULL;
60 tz_surface = (struct tizen_surface **)data;
63 LOGW("NULL interface");
67 LOGI("interface %s", interface);
69 if (strcmp(interface, "tizen_surface") == 0) {
70 LOGD("binding tizen surface for wayland");
72 *tz_surface = wl_registry_bind(registry, name, &tizen_surface_interface, version);
73 if (*tz_surface == NULL)
74 LOGE("failed to bind");
82 static void __global_remove(void *data, struct wl_registry *wl_registry, uint32_t name)
88 static const struct wl_registry_listener _camera_wl_registry_listener = {
93 void __parent_id_getter(void *data, struct tizen_resource *tizen_resource, uint32_t id)
100 *((unsigned int *)data) = id;
102 LOGD("[CLIENT] got parent_id [%u] from server", id);
107 static const struct tizen_resource_listener _camera_tz_resource_listener = {
111 int _get_wl_info(Evas_Object *obj, camera_wl_info_s *wl_info)
113 int ret = CAMERA_ERROR_NONE;
114 Ecore_Wl_Window *window = NULL;
115 struct wl_display *display = NULL;
116 struct wl_surface *surface = NULL;
117 struct wl_registry *registry = NULL;
118 struct tizen_surface *tz_surface = NULL;
119 struct tizen_resource *tz_resource = NULL;
121 if (!obj || !wl_info) {
122 LOGE("NULL parameter %p %p", obj, wl_info);
123 return CAMERA_ERROR_INVALID_OPERATION;
126 window = elm_win_wl_window_get(obj);
128 LOGE("failed to get wayland window");
129 ret = CAMERA_ERROR_INVALID_OPERATION;
133 surface = (struct wl_surface *)ecore_wl_window_surface_get(window);
135 LOGE("failed to get wayland surface");
136 ret = CAMERA_ERROR_INVALID_OPERATION;
140 display = (struct wl_display *)ecore_wl_display_get();
142 LOGE("failed to get wayland display");
143 ret = CAMERA_ERROR_INVALID_OPERATION;
147 registry = wl_display_get_registry(display);
149 LOGE("failed to get wayland registry");
150 ret = CAMERA_ERROR_INVALID_OPERATION;
154 wl_registry_add_listener(registry, &_camera_wl_registry_listener, &tz_surface);
156 wl_display_dispatch(display);
157 wl_display_roundtrip(display);
160 LOGE("failed to get tizen surface");
161 ret = CAMERA_ERROR_INVALID_OPERATION;
165 /* Get parent_id which is unique in a entire systemw. */
166 tz_resource = tizen_surface_get_tizen_resource(tz_surface, surface);
168 LOGE("failed to get tizen resurce");
169 ret = CAMERA_ERROR_INVALID_OPERATION;
173 wl_info->parent_id = 0;
175 tizen_resource_add_listener(tz_resource, &_camera_tz_resource_listener, &wl_info->parent_id);
177 wl_display_roundtrip(display);
179 if (wl_info->parent_id > 0) {
181 Ecore_Evas *ecore_evas = NULL;
182 ret = CAMERA_ERROR_NONE;
184 wl_info->evas_obj = obj;
186 evas_object_geometry_get(obj, &wl_info->window_x, &wl_info->window_y,
187 &wl_info->window_width, &wl_info->window_height);
189 ecore_evas = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
191 rotation = ecore_evas_rotation_get(ecore_evas);
192 if (rotation == 90 || rotation == 270) {
193 int temp = wl_info->window_width;
195 LOGD("swap width and height %d, %d", wl_info->window_width, wl_info->window_height);
197 wl_info->window_width = wl_info->window_height;
198 wl_info->window_height = temp;
201 LOGW("failed to get ecore_evas.. skip rotation check");
204 LOGD("evas object : %p, rotation : %d, parent id : %u, window : %d,%d,%dx%d",
205 wl_info->evas_obj, rotation, wl_info->parent_id,
206 wl_info->window_x, wl_info->window_y,
207 wl_info->window_width, wl_info->window_height);
209 ret = CAMERA_ERROR_INVALID_OPERATION;
210 LOGE("failed to get parent id");
215 tizen_surface_destroy(tz_surface);
220 tizen_resource_destroy(tz_resource);
225 wl_registry_destroy(registry);
231 #endif /* HAVE_WAYLAND */
233 static int _import_tbm_key(tbm_bufmgr bufmgr, unsigned int tbm_key, tbm_bo *bo, tbm_bo_handle *bo_handle)
235 tbm_bo tmp_bo = NULL;
236 tbm_bo_handle tmp_bo_handle = {NULL, };
238 if (bufmgr == NULL || bo == NULL || bo_handle == NULL || tbm_key == 0) {
239 LOGE("invalid parameter - bufmgr %p, bo %p, bo_handle %p, key %d",
240 bufmgr, bo, bo_handle, tbm_key);
244 tmp_bo = tbm_bo_import(bufmgr, tbm_key);
245 if (tmp_bo == NULL) {
246 LOGE("bo import failed - bufmgr %p, key %d", bufmgr, tbm_key);
250 tmp_bo_handle = tbm_bo_map(tmp_bo, TBM_DEVICE_CPU, TBM_OPTION_READ);
251 if (tmp_bo_handle.ptr == NULL) {
252 LOGE("bo map failed %p", tmp_bo);
253 tbm_bo_unref(tmp_bo);
258 /* set bo and bo_handle */
260 *bo_handle = tmp_bo_handle;
265 static void _release_imported_bo(tbm_bo *bo)
267 if (bo == NULL || *bo == NULL) {
279 static int _client_wait_for_cb_return(muse_camera_api_e api, camera_cb_info_s *cb_info, int time_out)
281 int ret = CAMERA_ERROR_NONE;
284 LOGD("Enter api : %d", api);
286 g_mutex_lock(&(cb_info->api_mutex[api]));
288 if (cb_info->api_activating[api] == 0) {
289 end_time = g_get_monotonic_time() + time_out * G_TIME_SPAN_SECOND;
290 if (g_cond_wait_until(&(cb_info->api_cond[api]), &(cb_info->api_mutex[api]), end_time)) {
291 ret = cb_info->api_ret[api];
292 cb_info->api_activating[api] = 0;
294 LOGD("return value : 0x%x", ret);
296 ret = CAMERA_ERROR_INVALID_OPERATION;
298 LOGE("api %d was TIMED OUT!", api);
301 ret = cb_info->api_ret[api];
302 cb_info->api_activating[api] = 0;
304 LOGD("condition is already checked for the api[%d], return[0x%x]", api, ret);
307 g_mutex_unlock(&(cb_info->api_mutex[api]));
312 int _camera_get_tbm_surface_format(int in_format, uint32_t *out_format)
314 if (in_format <= MM_PIXEL_FORMAT_INVALID ||
315 in_format >= MM_PIXEL_FORMAT_NUM ||
316 out_format == NULL) {
317 LOGE("INVALID_PARAMETER : in_format %d, out_format ptr %p", in_format, out_format);
318 return CAMERA_ERROR_INVALID_PARAMETER;
322 case MM_PIXEL_FORMAT_NV12:
323 case MM_PIXEL_FORMAT_NV12T:
324 *out_format = TBM_FORMAT_NV12;
326 case MM_PIXEL_FORMAT_NV16:
327 *out_format = TBM_FORMAT_NV16;
329 case MM_PIXEL_FORMAT_NV21:
330 *out_format = TBM_FORMAT_NV21;
332 case MM_PIXEL_FORMAT_YUYV:
333 *out_format = TBM_FORMAT_YUYV;
335 case MM_PIXEL_FORMAT_UYVY:
336 case MM_PIXEL_FORMAT_ITLV_JPEG_UYVY:
337 *out_format = TBM_FORMAT_UYVY;
339 case MM_PIXEL_FORMAT_422P:
340 *out_format = TBM_FORMAT_YUV422;
342 case MM_PIXEL_FORMAT_I420:
343 *out_format = TBM_FORMAT_YUV420;
345 case MM_PIXEL_FORMAT_YV12:
346 *out_format = TBM_FORMAT_YVU420;
348 case MM_PIXEL_FORMAT_RGB565:
349 *out_format = TBM_FORMAT_RGB565;
351 case MM_PIXEL_FORMAT_RGB888:
352 *out_format = TBM_FORMAT_RGB888;
354 case MM_PIXEL_FORMAT_RGBA:
355 *out_format = TBM_FORMAT_RGBA8888;
357 case MM_PIXEL_FORMAT_ARGB:
358 *out_format = TBM_FORMAT_ARGB8888;
361 LOGE("invalid in_format %d", in_format);
362 return CAMERA_ERROR_INVALID_PARAMETER;
365 return CAMERA_ERROR_NONE;
369 int _camera_get_media_packet_mimetype(int in_format, media_format_mimetype_e *mimetype)
371 if (in_format <= MM_PIXEL_FORMAT_INVALID ||
372 in_format >= MM_PIXEL_FORMAT_NUM ||
374 LOGE("INVALID_PARAMETER : in_format %d, mimetype ptr %p", in_format, mimetype);
375 return CAMERA_ERROR_INVALID_PARAMETER;
379 case MM_PIXEL_FORMAT_NV12:
380 case MM_PIXEL_FORMAT_NV12T:
381 *mimetype = MEDIA_FORMAT_NV12;
383 case MM_PIXEL_FORMAT_NV16:
384 *mimetype = MEDIA_FORMAT_NV16;
386 case MM_PIXEL_FORMAT_NV21:
387 *mimetype = MEDIA_FORMAT_NV21;
389 case MM_PIXEL_FORMAT_YUYV:
390 *mimetype = MEDIA_FORMAT_YUYV;
392 case MM_PIXEL_FORMAT_UYVY:
393 case MM_PIXEL_FORMAT_ITLV_JPEG_UYVY:
394 *mimetype = MEDIA_FORMAT_UYVY;
396 case MM_PIXEL_FORMAT_422P:
397 *mimetype = MEDIA_FORMAT_422P;
399 case MM_PIXEL_FORMAT_I420:
400 *mimetype = MEDIA_FORMAT_I420;
402 case MM_PIXEL_FORMAT_YV12:
403 *mimetype = MEDIA_FORMAT_YV12;
405 case MM_PIXEL_FORMAT_RGB565:
406 *mimetype = MEDIA_FORMAT_RGB565;
408 case MM_PIXEL_FORMAT_RGB888:
409 *mimetype = MEDIA_FORMAT_RGB888;
411 case MM_PIXEL_FORMAT_RGBA:
412 *mimetype = MEDIA_FORMAT_RGBA;
414 case MM_PIXEL_FORMAT_ARGB:
415 *mimetype = MEDIA_FORMAT_ARGB;
418 LOGE("invalid in_format %d", in_format);
419 return CAMERA_ERROR_INVALID_PARAMETER;
422 return CAMERA_ERROR_NONE;
425 void _camera_preview_frame_create(camera_stream_data_s *stream, int num_buffer_key, tbm_bo_handle *buffer_bo_handle, camera_preview_data_s *frame)
428 unsigned char * buf_pos = NULL;
430 if (stream == NULL || buffer_bo_handle == NULL || frame == NULL) {
431 LOGE("invalid parameter - stream:%p, buffer_bo_handle:%p", stream, buffer_bo_handle);
435 buf_pos = (unsigned char *)stream;
438 if (stream->format == MM_PIXEL_FORMAT_ITLV_JPEG_UYVY)
439 frame->format = MM_PIXEL_FORMAT_UYVY;
441 frame->format = stream->format;
443 frame->width = stream->width;
444 frame->height = stream->height;
445 frame->timestamp = stream->timestamp;
446 frame->num_of_planes = stream->num_planes;
448 if (num_buffer_key == 0) {
450 buf_pos += sizeof(camera_stream_data_s);
452 if (stream->format == MM_PIXEL_FORMAT_ENCODED_H264) {
453 frame->data.encoded_plane.data = buf_pos;
454 frame->data.encoded_plane.size = stream->data.encoded.length_data;
455 total_size = stream->data.encoded.length_data;
457 switch (stream->num_planes) {
459 frame->data.single_plane.yuv = buf_pos;
460 frame->data.single_plane.size = stream->data.yuv420.length_yuv;
461 total_size = stream->data.yuv420.length_yuv;
464 frame->data.double_plane.y = buf_pos;
465 frame->data.double_plane.y_size = stream->data.yuv420sp.length_y;
466 buf_pos += stream->data.yuv420sp.length_y;
467 frame->data.double_plane.uv = buf_pos;
468 frame->data.double_plane.uv_size = stream->data.yuv420sp.length_uv;
469 total_size = stream->data.yuv420sp.length_y + \
470 stream->data.yuv420sp.length_uv;
473 frame->data.triple_plane.y = buf_pos;
474 frame->data.triple_plane.y_size = stream->data.yuv420p.length_y;
475 buf_pos += stream->data.yuv420p.length_y;
476 frame->data.triple_plane.u = buf_pos;
477 frame->data.triple_plane.u_size = stream->data.yuv420p.length_u;
478 buf_pos += stream->data.yuv420p.length_u;
479 frame->data.triple_plane.v = buf_pos;
480 frame->data.triple_plane.v_size = stream->data.yuv420p.length_v;
481 total_size = stream->data.yuv420p.length_y + \
482 stream->data.yuv420p.length_u + \
483 stream->data.yuv420p.length_v;
491 switch (stream->num_planes) {
493 frame->data.single_plane.yuv = buffer_bo_handle[0].ptr;
494 frame->data.single_plane.size = stream->data.yuv420.length_yuv;
495 total_size = stream->data.yuv420.length_yuv;
498 frame->data.double_plane.y = buffer_bo_handle[0].ptr;
499 if (stream->num_planes == (unsigned int)num_buffer_key)
500 frame->data.double_plane.uv = buffer_bo_handle[1].ptr;
502 frame->data.double_plane.uv = buffer_bo_handle[0].ptr + stream->data.yuv420sp.length_y;
503 frame->data.double_plane.y_size = stream->data.yuv420sp.length_y;
504 frame->data.double_plane.uv_size = stream->data.yuv420sp.length_uv;
505 total_size = stream->data.yuv420sp.length_y + \
506 stream->data.yuv420sp.length_uv;
509 frame->data.triple_plane.y = buffer_bo_handle[0].ptr;
510 if (stream->num_planes == (unsigned int)num_buffer_key) {
511 frame->data.triple_plane.u = buffer_bo_handle[1].ptr;
512 frame->data.triple_plane.v = buffer_bo_handle[2].ptr;
514 frame->data.triple_plane.u = buffer_bo_handle[0].ptr + stream->data.yuv420p.length_y;
515 frame->data.triple_plane.v = buffer_bo_handle[1].ptr + stream->data.yuv420p.length_u;
517 frame->data.triple_plane.y_size = stream->data.yuv420p.length_y;
518 frame->data.triple_plane.u_size = stream->data.yuv420p.length_u;
519 frame->data.triple_plane.v_size = stream->data.yuv420p.length_v;
520 total_size = stream->data.yuv420p.length_y + \
521 stream->data.yuv420p.length_u + \
522 stream->data.yuv420p.length_v;
530 LOGD("format %d, %dx%d, size %d plane num %d",
531 frame.format, frame.width, frame.height, total_size, frame.num_of_planes);
535 int _camera_media_packet_data_create(int tbm_key, int num_buffer_key, tbm_bo bo, tbm_bo *buffer_bo, camera_media_packet_data **mp_data)
538 int ret = CAMERA_ERROR_NONE;
539 camera_media_packet_data *tmp_mp_data = NULL;
541 if (*mp_data == NULL) {
542 tmp_mp_data = g_new0(camera_media_packet_data, 1);
544 tmp_mp_data->tbm_key = tbm_key;
545 tmp_mp_data->num_buffer_key = num_buffer_key;
546 tmp_mp_data->bo = bo;
547 tmp_mp_data->ref_cnt++;
549 for (i = 0 ; i < num_buffer_key ; i++)
550 tmp_mp_data->buffer_bo[i] = buffer_bo[i];
552 *mp_data = tmp_mp_data;
553 /*LOGD("mp_data %p", tmp_mp_data);*/
555 ret = CAMERA_ERROR_OUT_OF_MEMORY;
556 LOGE("failed to alloc media packet data");
559 ((camera_media_packet_data *)*mp_data)->ref_cnt++;
565 int _camera_media_packet_create(camera_cb_info_s *cb_info, camera_stream_data_s *stream, camera_media_packet_data *mp_data, media_packet_h *packet)
567 media_packet_h pkt = NULL;
568 bool make_pkt_fmt = false;
569 tbm_surface_h tsurf = NULL;
570 tbm_surface_info_s tsurf_info;
571 media_format_mimetype_e mimetype = MEDIA_FORMAT_NV12;
572 uint32_t bo_format = 0;
575 int num_buffer_key = 0;
576 tbm_bo *buffer_bo = NULL;
578 if (cb_info == NULL || stream == NULL || mp_data == NULL || packet == NULL) {
579 LOGE("invalid parameter - cb_info:%p, stream:%p, mp_data:%p, packet:%p",
580 cb_info, stream, mp_data, packet);
581 return CAMERA_ERROR_INVALID_PARAMETER;
584 memset(&tsurf_info, 0x0, sizeof(tbm_surface_info_s));
585 buffer_bo = mp_data->buffer_bo;
586 num_buffer_key = mp_data->num_buffer_key;
588 /* unmap buffer bo */
589 for (i = 0 ; i < num_buffer_key ; i++) {
591 tbm_bo_unmap(buffer_bo[i]);
594 /* create tbm surface */
595 for (i = 0 ; i < BUFFER_MAX_PLANE_NUM ; i++)
596 tsurf_info.planes[i].stride = stream->stride[i];
598 /* get tbm surface format */
599 ret = _camera_get_tbm_surface_format(stream->format, &bo_format);
600 ret |= _camera_get_media_packet_mimetype(stream->format, &mimetype);
602 if (num_buffer_key > 0 && ret == CAMERA_ERROR_NONE) {
603 tsurf_info.width = stream->width;
604 tsurf_info.height = stream->height;
605 tsurf_info.format = bo_format;
606 tsurf_info.bpp = tbm_surface_internal_get_bpp(bo_format);
607 tsurf_info.num_planes = tbm_surface_internal_get_num_planes(bo_format);
610 case TBM_FORMAT_NV12:
611 case TBM_FORMAT_NV21:
612 tsurf_info.planes[0].size = stream->stride[0] * stream->elevation[0];
613 tsurf_info.planes[1].size = stream->stride[1] * stream->elevation[1];
614 tsurf_info.planes[0].offset = 0;
615 if (num_buffer_key == 1)
616 tsurf_info.planes[1].offset = tsurf_info.planes[0].size;
617 tsurf_info.size = tsurf_info.planes[0].size + tsurf_info.planes[1].size;
619 case TBM_FORMAT_YUV420:
620 case TBM_FORMAT_YVU420:
621 tsurf_info.planes[0].size = stream->stride[0] * stream->elevation[0];
622 tsurf_info.planes[1].size = stream->stride[1] * stream->elevation[1];
623 tsurf_info.planes[2].size = stream->stride[2] * stream->elevation[2];
624 tsurf_info.planes[0].offset = 0;
625 if (num_buffer_key == 1) {
626 tsurf_info.planes[1].offset = tsurf_info.planes[0].size;
627 tsurf_info.planes[2].offset = tsurf_info.planes[0].size + tsurf_info.planes[1].size;
629 tsurf_info.size = tsurf_info.planes[0].size + tsurf_info.planes[1].size + tsurf_info.planes[2].size;
631 case TBM_FORMAT_UYVY:
632 case TBM_FORMAT_YUYV:
633 tsurf_info.planes[0].size = (stream->stride[0] * stream->elevation[0]) << 1;
634 tsurf_info.planes[0].offset = 0;
635 tsurf_info.size = tsurf_info.planes[0].size;
641 tsurf = tbm_surface_internal_create_with_bos(&tsurf_info, buffer_bo, num_buffer_key);
642 /*LOGD("tbm surface %p", tsurf);*/
646 /* check media packet format */
647 if (cb_info->pkt_fmt) {
648 int pkt_fmt_width = 0;
649 int pkt_fmt_height = 0;
650 media_format_mimetype_e pkt_fmt_mimetype = MEDIA_FORMAT_NV12;
652 media_format_get_video_info(cb_info->pkt_fmt, &pkt_fmt_mimetype, &pkt_fmt_width, &pkt_fmt_height, NULL, NULL);
653 if (pkt_fmt_mimetype != mimetype ||
654 pkt_fmt_width != stream->width ||
655 pkt_fmt_height != stream->height) {
656 LOGW("different format. current 0x%x, %dx%d, new 0x%x, %dx%d",
657 pkt_fmt_mimetype, pkt_fmt_width, pkt_fmt_height, mimetype, stream->width, stream->height);
658 media_format_unref(cb_info->pkt_fmt);
659 cb_info->pkt_fmt = NULL;
666 /* create packet format */
668 LOGW("make new pkt_fmt - mimetype 0x%x, %dx%d", mimetype, stream->width, stream->height);
669 ret = media_format_create(&cb_info->pkt_fmt);
670 if (ret == MEDIA_FORMAT_ERROR_NONE) {
671 ret = media_format_set_video_mime(cb_info->pkt_fmt, mimetype);
672 ret |= media_format_set_video_width(cb_info->pkt_fmt, stream->width);
673 ret |= media_format_set_video_height(cb_info->pkt_fmt, stream->height);
674 LOGW("media_format_set_video_mime,width,height ret : 0x%x", ret);
676 LOGW("media_format_create failed");
680 /* create media packet */
681 ret = media_packet_create_from_tbm_surface(cb_info->pkt_fmt,
682 tsurf, (media_packet_finalize_cb)_camera_media_packet_finalize,
683 (void *)cb_info, &pkt);
684 if (ret != MEDIA_PACKET_ERROR_NONE) {
685 LOGE("media_packet_create_from_tbm_surface failed");
687 tbm_surface_destroy(tsurf);
691 LOGE("failed to create tbm surface %dx%d, format %d, num_buffer_key %d",
692 stream->width, stream->height, stream->format, num_buffer_key);
696 /*LOGD("media packet %p, internal buffer %p", pkt, stream->internal_buffer);*/
698 /* set media packet data */
699 ret = media_packet_set_extra(pkt, (void *)mp_data);
700 if (ret != MEDIA_PACKET_ERROR_NONE) {
701 LOGE("media_packet_set_extra failed");
708 media_packet_destroy(pkt);
711 /* set timestamp : msec -> nsec */
712 if (media_packet_set_pts(pkt, (uint64_t)(stream->timestamp) * 1000000) != MEDIA_PACKET_ERROR_NONE)
713 LOGW("media_packet_set_pts failed");
722 int _camera_media_packet_finalize(media_packet_h pkt, int error_code, void *user_data)
726 camera_cb_info_s *cb_info = (camera_cb_info_s *)user_data;
727 camera_media_packet_data *mp_data = NULL;
728 tbm_surface_h tsurf = NULL;
730 if (pkt == NULL || cb_info == NULL) {
731 LOGE("invalid parameter buffer %p, cb_info %p", pkt, cb_info);
732 return MEDIA_PACKET_FINALIZE;
735 ret = media_packet_get_extra(pkt, (void **)&mp_data);
736 if (ret != MEDIA_PACKET_ERROR_NONE) {
737 LOGE("media_packet_get_extra failed 0x%x", ret);
738 return MEDIA_PACKET_FINALIZE;
741 /*LOGD("mp_data %p", mp_data);*/
743 g_mutex_lock(&cb_info->mp_data_mutex);
746 if (mp_data->ref_cnt > 1) {
748 LOGD("Media packet is still referenced by %d client", mp_data->ref_cnt);
750 int tbm_key = mp_data->tbm_key;
752 /* release imported bo */
753 for (i = 0 ; i < mp_data->num_buffer_key ; i++) {
754 tbm_bo_unref(mp_data->buffer_bo[i]);
755 mp_data->buffer_bo[i] = NULL;
758 /* unmap and unref tbm bo */
759 _release_imported_bo(&mp_data->bo);
762 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
763 cb_info->fd, cb_info, INT, tbm_key);
769 g_mutex_unlock(&cb_info->mp_data_mutex);
771 ret = media_packet_get_tbm_surface(pkt, &tsurf);
772 if (ret != MEDIA_PACKET_ERROR_NONE) {
773 LOGE("media_packet_get_tbm_surface failed 0x%x", ret);
774 return MEDIA_PACKET_FINALIZE;
778 tbm_surface_destroy(tsurf);
782 return MEDIA_PACKET_FINALIZE;
785 static void _client_user_callback(camera_cb_info_s *cb_info, char *recv_msg, muse_camera_event_e event)
791 tbm_bo_handle bo_handle = {NULL, };
793 if (recv_msg == NULL || event >= MUSE_CAMERA_EVENT_TYPE_NUM) {
794 LOGE("invalid parameter - camera msg %p, event %d", recv_msg, event);
798 LOGD("get camera msg %s, event %d", recv_msg, event);
800 if (event == MUSE_CAMERA_EVENT_TYPE_PREVIEW) {
801 if (!(CHECK_PREVIEW_CB(cb_info, PREVIEW_CB_TYPE_EVAS)) &&
802 cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW] == NULL &&
803 cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] == NULL) {
804 LOGW("all preview callback from user are NULL");
807 } else if (cb_info->user_cb[event] == NULL) {
808 LOGW("user callback for event %d is not set", event);
813 case MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE:
819 muse_camera_msg_get(previous, recv_msg);
820 muse_camera_msg_get(current, recv_msg);
821 muse_camera_msg_get(by_policy, recv_msg);
823 LOGD("STATE CHANGE - previous %d, current %d, by_policy %d",
824 previous, current, by_policy);
826 ((camera_state_changed_cb)cb_info->user_cb[event])((camera_state_e)previous,
827 (camera_state_e)current, (bool)by_policy, cb_info->user_data[event]);
830 case MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE:
834 muse_camera_msg_get(state, recv_msg);
836 LOGD("FOCUS state - %d", state);
838 ((camera_focus_changed_cb)cb_info->user_cb[event])((camera_focus_state_e)state, cb_info->user_data[event]);
841 case MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE:
842 LOGD("CAPTURE_COMPLETED");
843 ((camera_capture_completed_cb)cb_info->user_cb[event])(cb_info->user_data[event]);
845 case MUSE_CAMERA_EVENT_TYPE_PREVIEW:
846 case MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW:
848 unsigned char *buf_pos = NULL;
849 camera_stream_data_s *stream = NULL;
852 int num_buffer_key = 0;
853 int buffer_key[BUFFER_MAX_PLANE_NUM] = {0, };
854 tbm_bo buffer_bo[BUFFER_MAX_PLANE_NUM] = {NULL, };
855 tbm_bo_handle buffer_bo_handle[BUFFER_MAX_PLANE_NUM] = {{.ptr = NULL}, };
856 camera_preview_data_s frame;
857 media_packet_h pkt = NULL;
858 camera_media_packet_data *mp_data = NULL;
860 muse_camera_msg_get(tbm_key, recv_msg);
861 muse_camera_msg_get(num_buffer_key, recv_msg);
862 muse_camera_msg_get_array(buffer_key, recv_msg);
864 memset(&frame, 0x0, sizeof(camera_preview_data_s));
867 LOGE("invalid key %d", tbm_key);
871 /* import tbm bo and get virtual address */
872 if (!_import_tbm_key(cb_info->bufmgr, tbm_key, &bo, &bo_handle)) {
873 LOGE("failed to import key %d", tbm_key);
875 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
876 cb_info->fd, cb_info, INT, tbm_key);
880 buf_pos = (unsigned char *)bo_handle.ptr;
882 /* get stream info */
883 stream = (camera_stream_data_s *)buf_pos;
885 for (i = 0 ; i < num_buffer_key ; i++) {
886 /* import buffer bo and get virtual address */
887 if (!_import_tbm_key(cb_info->bufmgr, buffer_key[i], &buffer_bo[i], &buffer_bo_handle[i])) {
888 LOGE("failed to import buffer key %d", buffer_key[i]);
890 /* release imported bo */
891 for (i -= 1 ; i >= 0 ; i--)
892 _release_imported_bo(&buffer_bo[i]);
894 _release_imported_bo(&bo);
896 /* send return buffer */
897 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
898 cb_info->fd, cb_info, INT, tbm_key);
903 /* call preview callback */
904 if (cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW]) {
905 _camera_preview_frame_create(stream, num_buffer_key, buffer_bo_handle, &frame);
907 int e_type = MUSE_CAMERA_EVENT_TYPE_PREVIEW;
908 ((camera_preview_cb)cb_info->user_cb[e_type])(&frame, cb_info->user_data[e_type]);
911 /* call media packet callback */
912 if (cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW]) {
913 ret = _camera_media_packet_data_create(tbm_key, num_buffer_key, bo, buffer_bo, &mp_data);
915 if (ret == CAMERA_ERROR_NONE) {
916 ret = _camera_media_packet_create(cb_info, stream, mp_data, &pkt);
918 int e_type = MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW;
919 if (ret == CAMERA_ERROR_NONE) {
920 ((camera_media_packet_preview_cb)cb_info->user_cb[e_type])(pkt, cb_info->user_data[e_type]);
928 /* call evas renderer */
929 if (CHECK_PREVIEW_CB(cb_info, PREVIEW_CB_TYPE_EVAS)) {
930 ret = _camera_media_packet_data_create(tbm_key, num_buffer_key, bo, buffer_bo, &mp_data);
932 if (ret == CAMERA_ERROR_NONE) {
933 ret = _camera_media_packet_create(cb_info, stream, mp_data, &pkt);
935 if (ret == CAMERA_ERROR_NONE) {
936 g_mutex_lock(&cb_info->evas_mutex);
938 if (cb_info->run_evas_render)
939 mm_evas_renderer_write(pkt, cb_info->evas_info);
941 LOGW("evas renderer is stopped, skip this buffer...");
942 media_packet_destroy(pkt);
947 g_mutex_unlock(&cb_info->evas_mutex);
955 /* send message for preview callback return */
956 if (!CHECK_PREVIEW_CB(cb_info, PREVIEW_CB_TYPE_EVAS))
957 muse_camera_msg_send_no_return(MUSE_CAMERA_API_PREVIEW_CB_RETURN, cb_info->fd, cb_info);
959 if (mp_data == NULL) {
960 /* release imported bo */
961 for (i = 0 ; i < num_buffer_key ; i++)
962 _release_imported_bo(&buffer_bo[i]);
964 /* unmap and unref tbm bo */
965 _release_imported_bo(&bo);
968 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
969 cb_info->fd, cb_info, INT, tbm_key);
971 /*LOGD("return buffer Done");*/
975 case MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS:
979 muse_camera_msg_get(percent, recv_msg);
981 LOGD("HDR progress - %d \%", percent);
983 ((camera_attr_hdr_progress_cb)cb_info->user_cb[event])(percent, cb_info->user_data[event]);
986 case MUSE_CAMERA_EVENT_TYPE_INTERRUPTED:
992 muse_camera_msg_get(policy, recv_msg);
993 muse_camera_msg_get(previous, recv_msg);
994 muse_camera_msg_get(current, recv_msg);
996 LOGD("INTERRUPTED - policy %d, state previous %d, current %d",
997 policy, previous, current);
999 ((camera_interrupted_cb)cb_info->user_cb[event])((camera_policy_e)policy,
1000 (camera_state_e)previous, (camera_state_e)current, cb_info->user_data[event]);
1003 case MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION:
1006 camera_detected_face_s *faces = NULL;
1008 muse_camera_msg_get(count, recv_msg);
1009 muse_camera_msg_get(tbm_key, recv_msg);
1011 if (count > 0 && tbm_key > 0) {
1012 LOGD("FACE_DETECTION - count %d, tbm_key %d", count, tbm_key);
1014 if (!_import_tbm_key(cb_info->bufmgr, tbm_key, &bo, &bo_handle))
1018 faces = bo_handle.ptr;
1020 ((camera_face_detected_cb)cb_info->user_cb[event])(faces, count, cb_info->user_data[event]);
1026 for (i = 0 ; i < count ; i++) {
1027 LOGD("id[%2d] - score %d, position (%d,%d,%dx%d)",
1028 i, faces[i].score, faces[i].x, faces[i].y, faces[i].width, faces[i].height);
1034 _release_imported_bo(&bo);
1037 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
1038 cb_info->fd, cb_info, INT, tbm_key);
1040 LOGD("return buffer done");
1042 LOGE("invalid message - count %d, key %d", count, tbm_key);
1046 case MUSE_CAMERA_EVENT_TYPE_ERROR:
1049 int current_state = 0;
1051 muse_camera_msg_get(error, recv_msg);
1052 muse_camera_msg_get(current_state, recv_msg);
1054 LOGE("ERROR - error 0x%x, current_state %d", error, current_state);
1056 ((camera_error_cb)cb_info->user_cb[event])((camera_error_e)error,
1057 (camera_state_e)current_state, cb_info->user_data[event]);
1060 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_RESOLUTION:
1061 muse_camera_msg_get(param1, recv_msg);
1062 muse_camera_msg_get(param2, recv_msg);
1064 LOGD("SUPPORTED_PREVIEW_RESOLUTION - %d x %d", param1, param2);
1066 if (((camera_supported_preview_resolution_cb)cb_info->user_cb[event])(param1, param2, cb_info->user_data[event]) == false) {
1067 cb_info->user_cb[event] = NULL;
1068 cb_info->user_data[event] = NULL;
1069 LOGD("stop foreach callback for SUPPORTED_PREVIEW_RESOLUTION");
1072 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_RESOLUTION:
1073 muse_camera_msg_get(param1, recv_msg);
1074 muse_camera_msg_get(param2, recv_msg);
1076 LOGD("SUPPORTED_CAPTURE_RESOLUTION - %d x %d", param1, param2);
1078 if (((camera_supported_capture_resolution_cb)cb_info->user_cb[event])(param1, param2, cb_info->user_data[event]) == false) {
1079 cb_info->user_cb[event] = NULL;
1080 cb_info->user_data[event] = NULL;
1081 LOGD("stop foreach callback for SUPPORTED_CAPTURE_RESOLUTION");
1084 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_FORMAT:
1085 muse_camera_msg_get(param1, recv_msg);
1087 LOGD("SUPPORTED_CAPTURE_FORMAT - %d ", param1);
1089 if (((camera_supported_capture_format_cb)cb_info->user_cb[event])((camera_pixel_format_e)param1, cb_info->user_data[event]) == false) {
1090 cb_info->user_cb[event] = NULL;
1091 cb_info->user_data[event] = NULL;
1092 LOGD("stop foreach callback for SUPPORTED_CAPTURE_FORMAT");
1095 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_FORMAT:
1096 muse_camera_msg_get(param1, recv_msg);
1098 LOGD("SUPPORTED_PREVIEW_FORMAT - %d ", param1);
1100 if (((camera_supported_preview_format_cb)cb_info->user_cb[event])((camera_pixel_format_e)param1, cb_info->user_data[event]) == false) {
1101 cb_info->user_cb[event] = NULL;
1102 cb_info->user_data[event] = NULL;
1103 LOGD("stop foreach callback for SUPPORTED_PREVIEW_FORMAT");
1106 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_AF_MODE:
1107 muse_camera_msg_get(param1, recv_msg);
1109 LOGD("SUPPORTED_AF_MODE - %d ", param1);
1111 if (((camera_attr_supported_af_mode_cb)cb_info->user_cb[event])((camera_attr_af_mode_e)param1, cb_info->user_data[event]) == false) {
1112 cb_info->user_cb[event] = NULL;
1113 cb_info->user_data[event] = NULL;
1114 LOGD("stop foreach callback for SUPPORTED_AF_MODE");
1117 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EXPOSURE_MODE:
1118 muse_camera_msg_get(param1, recv_msg);
1120 LOGD("SUPPORTED_EXPOSURE_MODE - %d ", param1);
1122 if (((camera_attr_supported_exposure_mode_cb)cb_info->user_cb[event])((camera_attr_exposure_mode_e)param1, cb_info->user_data[event]) == false) {
1123 cb_info->user_cb[event] = NULL;
1124 cb_info->user_data[event] = NULL;
1125 LOGD("stop foreach callback for SUPPORTED_EXPOSURE_MODE");
1128 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_ISO:
1129 muse_camera_msg_get(param1, recv_msg);
1131 LOGD("SUPPORTED_ISO - %d ", param1);
1133 if (((camera_attr_supported_iso_cb)cb_info->user_cb[event])((camera_attr_iso_e)param1, cb_info->user_data[event]) == false) {
1134 cb_info->user_cb[event] = NULL;
1135 cb_info->user_data[event] = NULL;
1136 LOGD("stop foreach callback for SUPPORTED_ISO");
1139 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_WHITEBALANCE:
1140 muse_camera_msg_get(param1, recv_msg);
1142 LOGD("SUPPORTED_WHITEBALANCE - %d ", param1);
1144 if (((camera_attr_supported_whitebalance_cb)cb_info->user_cb[event])((camera_attr_whitebalance_e)param1, cb_info->user_data[event]) == false) {
1145 cb_info->user_cb[event] = NULL;
1146 cb_info->user_data[event] = NULL;
1147 LOGD("stop foreach callback for SUPPORTED_WHITEBALANCE");
1150 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EFFECT:
1151 muse_camera_msg_get(param1, recv_msg);
1153 LOGD("SUPPORTED_EFFECT - %d ", param1);
1155 if (((camera_attr_supported_effect_cb)cb_info->user_cb[event])((camera_attr_effect_mode_e)param1, cb_info->user_data[event]) == false) {
1156 cb_info->user_cb[event] = NULL;
1157 cb_info->user_data[event] = NULL;
1158 LOGD("stop foreach callback for SUPPORTED_EFFECT");
1161 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_SCENE_MODE:
1162 muse_camera_msg_get(param1, recv_msg);
1164 LOGD("SUPPORTED_SCENE_MODE - %d ", param1);
1166 if (((camera_attr_supported_scene_mode_cb)cb_info->user_cb[event])((camera_attr_scene_mode_e)param1, cb_info->user_data[event]) == false) {
1167 cb_info->user_cb[event] = NULL;
1168 cb_info->user_data[event] = NULL;
1169 LOGD("stop foreach callback for SUPPORTED_SCENE_MODE");
1172 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FLASH_MODE:
1173 muse_camera_msg_get(param1, recv_msg);
1175 LOGD("SUPPORTED_FLASH_MODE - %d ", param1);
1177 if (((camera_attr_supported_flash_mode_cb)cb_info->user_cb[event])((camera_attr_flash_mode_e)param1, cb_info->user_data[event]) == false) {
1178 cb_info->user_cb[event] = NULL;
1179 cb_info->user_data[event] = NULL;
1180 LOGD("stop foreach callback for SUPPORTED_FLASH_MODE");
1183 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS:
1184 muse_camera_msg_get(param1, recv_msg);
1186 LOGD("SUPPORTED_FPS - %d ", param1);
1188 if (((camera_attr_supported_fps_cb)cb_info->user_cb[event])((camera_attr_fps_e)param1, cb_info->user_data[event]) == false) {
1189 cb_info->user_cb[event] = NULL;
1190 cb_info->user_data[event] = NULL;
1191 LOGD("stop foreach callback for SUPPORTED_FPS");
1194 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS_BY_RESOLUTION:
1195 muse_camera_msg_get(param1, recv_msg);
1197 LOGD("SUPPORTED_FPS_BY_RESOLUTION - %d ", param1);
1199 if (((camera_attr_supported_fps_cb)cb_info->user_cb[event])((camera_attr_fps_e)param1, cb_info->user_data[event]) == false) {
1200 cb_info->user_cb[event] = NULL;
1201 cb_info->user_data[event] = NULL;
1202 LOGD("stop foreach callback for SUPPORTED_FPS_BY_RESOLUTION");
1205 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_FLIP:
1206 muse_camera_msg_get(param1, recv_msg);
1208 LOGD("SUPPORTED_STREAM_FLIP - %d ", param1);
1210 if (((camera_attr_supported_stream_flip_cb)cb_info->user_cb[event])((camera_flip_e)param1, cb_info->user_data[event]) == false) {
1211 cb_info->user_cb[event] = NULL;
1212 cb_info->user_data[event] = NULL;
1213 LOGD("stop foreach callback for SUPPORTED_STREAM_FLIP");
1216 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION:
1217 muse_camera_msg_get(param1, recv_msg);
1219 LOGD("SUPPORTED_STREAM_ROTATION - %d ", param1);
1221 if (((camera_attr_supported_stream_rotation_cb)cb_info->user_cb[event])((camera_rotation_e)param1, cb_info->user_data[event]) == false) {
1222 cb_info->user_cb[event] = NULL;
1223 cb_info->user_data[event] = NULL;
1224 LOGD("stop foreach callback for SUPPORTED_STREAM_ROTATION");
1227 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE:
1228 muse_camera_msg_get(param1, recv_msg);
1230 LOGD("SUPPORTED_THEATER_MODE - %d ", param1);
1232 if (((camera_attr_supported_theater_mode_cb)cb_info->user_cb[event])((camera_attr_theater_mode_e)param1, cb_info->user_data[event]) == false) {
1233 cb_info->user_cb[event] = NULL;
1234 cb_info->user_data[event] = NULL;
1235 LOGD("stop foreach callback for SUPPORTED_THEATER_MODE");
1238 case MUSE_CAMERA_EVENT_TYPE_CAPTURE:
1240 camera_image_data_s *rImage = NULL;
1241 camera_image_data_s *rPostview = NULL;
1242 camera_image_data_s *rThumbnail = NULL;
1243 unsigned char *buf_pos = NULL;
1244 int tbm_key_main = 0;
1245 int tbm_key_post = 0;
1246 int tbm_key_thumb = 0;
1247 tbm_bo bo_main = NULL;
1248 tbm_bo bo_post = NULL;
1249 tbm_bo bo_thumb = NULL;
1250 tbm_bo_handle bo_main_handle = {NULL, };
1251 tbm_bo_handle bo_post_handle = {NULL, };
1252 tbm_bo_handle bo_thumb_handle = {NULL, };
1254 muse_camera_msg_get(tbm_key_main, recv_msg);
1255 muse_camera_msg_get(tbm_key_post, recv_msg);
1256 muse_camera_msg_get(tbm_key_thumb, recv_msg);
1258 LOGD("camera capture callback came in. tbm_key_main %d, tbm_key_post %d, tbm_key_thumb %d",
1259 tbm_key_main, tbm_key_post, tbm_key_thumb);
1261 if (tbm_key_main <= 0) {
1262 LOGE("invalid tbm_key_main %d", tbm_key_main);
1266 /* import tbm bo and get virtual address */
1267 if (!_import_tbm_key(cb_info->bufmgr, tbm_key_main, &bo_main, &bo_main_handle))
1270 buf_pos = (unsigned char *)bo_main_handle.ptr;
1271 rImage = (camera_image_data_s *)buf_pos;
1272 rImage->data = buf_pos + sizeof(camera_image_data_s);
1274 LOGD("image info %dx%d, size : %d", rImage->height, rImage->width, rImage->size);
1276 if (tbm_key_post > 0) {
1277 /* import tbm bo and get virtual address */
1278 if (!_import_tbm_key(cb_info->bufmgr, tbm_key_post, &bo_post, &bo_post_handle))
1281 buf_pos = (unsigned char *)bo_post_handle.ptr;
1282 rPostview = (camera_image_data_s *)buf_pos;
1283 LOGD("rPostview->size : %d", rPostview->size);
1284 rPostview->data = buf_pos + sizeof(camera_image_data_s);
1287 if (tbm_key_thumb > 0) {
1288 /* import tbm bo and get virtual address */
1289 if (!_import_tbm_key(cb_info->bufmgr, tbm_key_thumb, &bo_thumb, &bo_thumb_handle))
1292 buf_pos = (unsigned char *)bo_thumb_handle.ptr;
1294 rThumbnail = (camera_image_data_s *)buf_pos;
1295 LOGD("rThumbnail->size : %d", rThumbnail->size);
1296 rThumbnail->data = buf_pos + sizeof(camera_image_data_s);
1299 ((camera_capturing_cb)cb_info->user_cb[event])(rImage, rPostview, rThumbnail, cb_info->user_data[event]);
1301 /* unmap and unref tbm bo */
1302 _release_imported_bo(&bo_main);
1305 tbm_key = tbm_key_main;
1306 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
1307 cb_info->fd, cb_info, INT, tbm_key);
1309 if (tbm_key_post > 0) {
1310 /* unmap and unref tbm bo */
1311 _release_imported_bo(&bo_post);
1314 tbm_key = tbm_key_post;
1315 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
1316 cb_info->fd, cb_info, INT, tbm_key);
1319 if (tbm_key_thumb > 0) {
1320 /* unmap and unref tbm bo */
1321 _release_imported_bo(&bo_thumb);
1324 tbm_key = tbm_key_thumb;
1325 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
1326 cb_info->fd, cb_info, INT, tbm_key);
1329 LOGD("return buffer done");
1332 case MUSE_CAMERA_EVENT_TYPE_VIDEO_FRAME_RENDER_ERROR:
1335 LOGW("Unknown event : %d", event);
1342 static bool _camera_idle_event_callback(void *data)
1344 camera_cb_info_s *cb_info = NULL;
1345 camera_idle_event_s *cam_idle_event = (camera_idle_event_s *)data;
1347 if (cam_idle_event == NULL) {
1348 LOGE("cam_idle_event is NULL");
1353 g_mutex_lock(&cam_idle_event->event_mutex);
1355 cb_info = cam_idle_event->cb_info;
1356 if (cb_info == NULL) {
1357 LOGW("camera cb_info is NULL. event %d", cam_idle_event->event);
1358 goto IDLE_EVENT_CALLBACK_DONE;
1361 /* remove event from list */
1362 g_mutex_lock(&cb_info->idle_event_mutex);
1363 if (cb_info->idle_event_list)
1364 cb_info->idle_event_list = g_list_remove(cb_info->idle_event_list, (gpointer)cam_idle_event);
1366 /*LOGD("remove camera idle event %p, %p", cam_idle_event, cb_info->idle_event_list);*/
1367 g_mutex_unlock(&cb_info->idle_event_mutex);
1370 _client_user_callback(cam_idle_event->cb_info, cam_idle_event->recv_msg, cam_idle_event->event);
1372 /* send signal for waiting thread */
1373 g_cond_signal(&cb_info->idle_event_cond);
1375 IDLE_EVENT_CALLBACK_DONE:
1376 /* unlock and release event */
1377 g_mutex_unlock(&cam_idle_event->event_mutex);
1378 g_mutex_clear(&cam_idle_event->event_mutex);
1380 g_free(cam_idle_event);
1381 cam_idle_event = NULL;
1386 static void *_camera_msg_handler_func(gpointer data)
1391 int event_class = 0;
1392 camera_message_s *cam_msg = NULL;
1393 camera_idle_event_s *cam_idle_event = NULL;
1394 camera_cb_info_s *cb_info = (camera_cb_info_s *)data;
1396 if (cb_info == NULL) {
1397 LOGE("cb_info NULL");
1403 g_mutex_lock(&cb_info->msg_handler_mutex);
1405 while (g_atomic_int_get(&cb_info->msg_handler_running)) {
1406 if (g_queue_is_empty(cb_info->msg_queue)) {
1407 LOGD("signal wait...");
1408 g_cond_wait(&cb_info->msg_handler_cond, &cb_info->msg_handler_mutex);
1409 LOGD("signal received");
1411 if (g_atomic_int_get(&cb_info->msg_handler_running) == 0) {
1412 LOGD("stop event thread");
1417 cam_msg = (camera_message_s *)g_queue_pop_head(cb_info->msg_queue);
1419 g_mutex_unlock(&cb_info->msg_handler_mutex);
1421 if (cam_msg == NULL) {
1422 LOGE("NULL message");
1423 g_mutex_lock(&cb_info->msg_handler_mutex);
1429 if (api < MUSE_CAMERA_API_MAX) {
1430 g_mutex_lock(&cb_info->api_mutex[api]);
1432 if (muse_camera_msg_get(ret, cam_msg->recv_msg)) {
1433 cb_info->api_ret[api] = ret;
1434 cb_info->api_activating[api] = 1;
1436 LOGD("camera api %d - return 0x%x", ret);
1438 g_cond_signal(&cb_info->api_cond[api]);
1440 LOGE("failed to get camera ret for api %d, msg %s", api, cam_msg->recv_msg);
1443 g_mutex_unlock(&cb_info->api_mutex[api]);
1444 } else if (api == MUSE_CAMERA_CB_EVENT) {
1448 if (!muse_camera_msg_get(event, cam_msg->recv_msg) ||
1449 !muse_camera_msg_get(event_class, cam_msg->recv_msg)) {
1450 LOGE("failed to get camera event %d, class %d", event, event_class);
1455 g_mutex_lock(&cb_info->msg_handler_mutex);
1459 switch (event_class) {
1460 case MUSE_CAMERA_EVENT_CLASS_THREAD_SUB:
1461 _client_user_callback(cb_info, cam_msg->recv_msg, event);
1463 case MUSE_CAMERA_EVENT_CLASS_THREAD_MAIN:
1464 cam_idle_event = g_new0(camera_idle_event_s, 1);
1465 if (cam_idle_event == NULL) {
1466 LOGE("cam_idle_event alloc failed");
1470 cam_idle_event->event = event;
1471 cam_idle_event->cb_info = cb_info;
1472 g_mutex_init(&cam_idle_event->event_mutex);
1473 memcpy(cam_idle_event->recv_msg, cam_msg->recv_msg, sizeof(cam_idle_event->recv_msg));
1475 LOGD("add camera event[%d, %p] to IDLE", event, cam_idle_event);
1477 g_mutex_lock(&cb_info->idle_event_mutex);
1478 cb_info->idle_event_list = g_list_append(cb_info->idle_event_list, (gpointer)cam_idle_event);
1479 g_mutex_unlock(&cb_info->idle_event_mutex);
1481 g_idle_add_full(G_PRIORITY_DEFAULT,
1482 (GSourceFunc)_camera_idle_event_callback,
1483 (gpointer)cam_idle_event,
1487 LOGE("unknown camera event class %d", event_class);
1491 LOGE("unknown camera api[%d] message[%s]", api, cam_msg->recv_msg);
1497 g_mutex_lock(&cb_info->msg_handler_mutex);
1500 /* remove remained event */
1501 while (!g_queue_is_empty(cb_info->msg_queue)) {
1502 cam_msg = (camera_message_s *)g_queue_pop_head(cb_info->msg_queue);
1504 LOGD("remove camera message %p", cam_msg);
1508 LOGW("NULL camera message");
1512 g_mutex_unlock(&cb_info->msg_handler_mutex);
1519 static void _camera_remove_idle_event_all(camera_cb_info_s *cb_info)
1521 camera_idle_event_s *cam_idle_event = NULL;
1522 gboolean ret = TRUE;
1524 gint64 end_time = 0;
1526 if (cb_info == NULL) {
1527 LOGE("cb_info is NULL");
1531 g_mutex_lock(&cb_info->idle_event_mutex);
1533 if (cb_info->idle_event_list == NULL) {
1534 LOGD("No idle event is remained.");
1536 list = cb_info->idle_event_list;
1539 cam_idle_event = list->data;
1540 list = g_list_next(list);
1542 if (!cam_idle_event) {
1543 LOGW("Fail to remove idle event. The event is NULL");
1545 if (g_mutex_trylock(&cam_idle_event->event_mutex)) {
1546 ret = g_idle_remove_by_data(cam_idle_event);
1548 LOGD("remove idle event [%p], ret[%d]", cam_idle_event, ret);
1551 cam_idle_event->cb_info = NULL;
1552 LOGW("idle callback for event %p will be called later", cam_idle_event);
1555 cb_info->idle_event_list = g_list_remove(cb_info->idle_event_list, (gpointer)cam_idle_event);
1557 g_mutex_unlock(&cam_idle_event->event_mutex);
1560 g_mutex_clear(&cam_idle_event->event_mutex);
1562 g_free(cam_idle_event);
1563 cam_idle_event = NULL;
1565 LOGD("remove idle event done");
1568 LOGW("event lock failed. it's being called...");
1570 end_time = g_get_monotonic_time() + G_TIME_SPAN_MILLISECOND * 100;
1572 if (g_cond_wait_until(&cb_info->idle_event_cond, &cb_info->idle_event_mutex, end_time))
1573 LOGW("signal received");
1580 g_list_free(cb_info->idle_event_list);
1581 cb_info->idle_event_list = NULL;
1584 g_mutex_unlock(&cb_info->idle_event_mutex);
1589 static void *_camera_msg_recv_func(gpointer data)
1598 char *recv_msg = NULL;
1599 char **parse_str = NULL;
1600 camera_cb_info_s *cb_info = (camera_cb_info_s *)data;
1602 if (cb_info == NULL) {
1603 LOGE("cb_info NULL");
1609 parse_str = (char **)malloc(sizeof(char *) * CAMERA_PARSE_STRING_SIZE);
1610 if (parse_str == NULL) {
1611 LOGE("parse_str malloc failed");
1615 for (i = 0 ; i < CAMERA_PARSE_STRING_SIZE ; i++) {
1616 parse_str[i] = (char *)malloc(sizeof(char) * MUSE_CAMERA_MSG_MAX_LENGTH);
1617 if (parse_str[i] == NULL) {
1618 LOGE("parse_str[%d] malloc failed", i);
1619 goto CB_HANDLER_EXIT;
1623 recv_msg = cb_info->recv_msg;
1625 while (g_atomic_int_get(&cb_info->msg_recv_running)) {
1626 ret = muse_core_ipc_recv_msg(cb_info->fd, recv_msg);
1629 recv_msg[ret] = '\0';
1635 /*LOGD("recvMSg : %s, length : %d", recv_msg, ret);*/
1637 /* Need to split the combined entering msgs.
1638 This module supports up to 200 combined msgs. */
1639 for (str_pos = 0; str_pos < ret; str_pos++) {
1640 if (recv_msg[str_pos] == '}') {
1641 memset(parse_str[num_token], 0x0, sizeof(char) * MUSE_CAMERA_MSG_MAX_LENGTH);
1642 strncpy(parse_str[num_token], recv_msg + prev_pos, str_pos - prev_pos + 1);
1643 LOGD("splitted msg : [%s], Index : %d", parse_str[num_token], num_token);
1644 prev_pos = str_pos+1;
1649 /*LOGD("num_token : %d", num_token);*/
1651 /* Re-construct to the useful single msg. */
1652 for (i = 0; i < num_token; i++) {
1653 if (i >= CAMERA_PARSE_STRING_SIZE) {
1654 LOGE("invalid token index %d", i);
1661 if (!muse_camera_msg_get(api, parse_str[i])) {
1662 LOGE("failed to get camera api");
1666 if (api != MUSE_CAMERA_CB_EVENT) {
1667 LOGD("check api_class");
1668 if (muse_camera_msg_get(api_class, parse_str[i]))
1669 LOGD("camera api_class[%d]", api_class);
1672 if (api_class == MUSE_CAMERA_API_CLASS_IMMEDIATE) {
1673 g_mutex_lock(&cb_info->api_mutex[api]);
1675 if (!muse_camera_msg_get(ret, parse_str[i])) {
1676 LOGE("failed to get camera ret");
1677 g_mutex_unlock(&cb_info->api_mutex[api]);
1681 cb_info->api_ret[api] = ret;
1682 cb_info->api_activating[api] = 1;
1684 if (api == MUSE_CAMERA_API_CREATE) {
1685 if (ret != CAMERA_ERROR_NONE) {
1686 g_atomic_int_set(&cb_info->msg_recv_running, 0);
1687 LOGE("camera create error 0x%x. close client cb handler", ret);
1689 } else if (api == MUSE_CAMERA_API_DESTROY) {
1690 if (ret == CAMERA_ERROR_NONE) {
1691 g_atomic_int_set(&cb_info->msg_recv_running, 0);
1692 LOGD("camera destroy done. close client cb handler");
1696 g_cond_signal(&cb_info->api_cond[api]);
1697 g_mutex_unlock(&cb_info->api_mutex[api]);
1698 } else if (api_class == MUSE_CAMERA_API_CLASS_THREAD_SUB || api == MUSE_CAMERA_CB_EVENT) {
1699 camera_message_s *cam_msg = g_new0(camera_message_s, 1);
1700 if (cam_msg == NULL) {
1701 LOGE("failed to alloc cam_msg");
1706 memcpy(cam_msg->recv_msg, parse_str[i], sizeof(cam_msg->recv_msg));
1708 LOGD("add camera message to queue : api %d", api);
1710 g_mutex_lock(&cb_info->msg_handler_mutex);
1711 g_queue_push_tail(cb_info->msg_queue, (gpointer)cam_msg);
1712 g_cond_signal(&cb_info->msg_handler_cond);
1713 g_mutex_unlock(&cb_info->msg_handler_mutex);
1715 LOGW("unknown camera api %d and api_class %d", api, api_class);
1721 LOGD("client cb exit");
1725 for (i = 0 ; i < CAMERA_PARSE_STRING_SIZE ; i++) {
1728 parse_str[i] = NULL;
1739 static camera_cb_info_s *_client_callback_new(gint sockfd)
1741 camera_cb_info_s *cb_info = NULL;
1742 gint *tmp_activating = NULL;
1743 gint *tmp_ret = NULL;
1746 g_return_val_if_fail(sockfd > 0, NULL);
1748 cb_info = g_new0(camera_cb_info_s, 1);
1749 if (cb_info == NULL) {
1750 LOGE("cb_info failed");
1754 g_mutex_init(&cb_info->msg_handler_mutex);
1755 g_cond_init(&cb_info->msg_handler_cond);
1756 g_mutex_init(&cb_info->idle_event_mutex);
1757 g_cond_init(&cb_info->idle_event_cond);
1758 g_mutex_init(&cb_info->mp_data_mutex);
1759 g_mutex_init(&cb_info->evas_mutex);
1761 for (i = 0 ; i < MUSE_CAMERA_API_MAX ; i++) {
1762 g_mutex_init(&cb_info->api_mutex[i]);
1763 g_cond_init(&cb_info->api_cond[i]);
1766 tmp_activating = g_new0(gint, MUSE_CAMERA_API_MAX);
1767 if (tmp_activating == NULL) {
1768 LOGE("tmp_activating failed");
1772 tmp_ret = g_new0(gint, MUSE_CAMERA_API_MAX);
1773 if (tmp_ret == NULL) {
1774 LOGE("tmp_ret failed");
1778 cb_info->msg_queue = g_queue_new();
1779 if (cb_info->msg_queue == NULL) {
1780 LOGE("msg_queue new failed");
1784 g_atomic_int_set(&cb_info->msg_handler_running, 1);
1785 cb_info->msg_handler_thread = g_thread_try_new("camera_msg_handler",
1786 _camera_msg_handler_func, (gpointer)cb_info, NULL);
1787 if (cb_info->msg_handler_thread == NULL) {
1788 LOGE("message handler thread creation failed");
1792 cb_info->fd = sockfd;
1793 cb_info->api_activating = tmp_activating;
1794 cb_info->api_ret = tmp_ret;
1795 cb_info->preview_cb_flag = 0;
1796 cb_info->evas_info = NULL;
1798 g_atomic_int_set(&cb_info->msg_recv_running, 1);
1799 cb_info->msg_recv_thread = g_thread_try_new("camera_msg_recv",
1800 _camera_msg_recv_func, (gpointer)cb_info, NULL);
1801 if (cb_info->msg_recv_thread == NULL) {
1802 LOGE("message receive thread creation failed");
1810 if (cb_info->msg_handler_thread) {
1811 g_mutex_lock(&cb_info->msg_handler_mutex);
1812 g_atomic_int_set(&cb_info->msg_handler_running, 0);
1813 g_cond_signal(&cb_info->msg_handler_cond);
1814 g_mutex_unlock(&cb_info->msg_handler_mutex);
1816 g_thread_join(cb_info->msg_handler_thread);
1817 g_thread_unref(cb_info->msg_handler_thread);
1818 cb_info->msg_handler_thread = NULL;
1821 for (i = 0 ; i < MUSE_CAMERA_API_MAX ; i++) {
1822 g_mutex_clear(&cb_info->api_mutex[i]);
1823 g_cond_clear(&cb_info->api_cond[i]);
1826 g_mutex_clear(&cb_info->msg_handler_mutex);
1827 g_cond_clear(&cb_info->msg_handler_cond);
1828 g_mutex_clear(&cb_info->idle_event_mutex);
1829 g_cond_clear(&cb_info->idle_event_cond);
1830 g_mutex_clear(&cb_info->mp_data_mutex);
1831 g_mutex_clear(&cb_info->evas_mutex);
1833 if (cb_info->msg_queue) {
1834 g_queue_free(cb_info->msg_queue);
1835 cb_info->msg_queue = NULL;
1842 if (tmp_activating) {
1843 g_free(tmp_activating);
1844 tmp_activating = NULL;
1854 static void _client_callback_destroy(camera_cb_info_s *cb_info)
1858 g_return_if_fail(cb_info != NULL);
1860 LOGD("MSG receive thread[%p] destroy", cb_info->msg_recv_thread);
1862 g_thread_join(cb_info->msg_recv_thread);
1863 g_thread_unref(cb_info->msg_recv_thread);
1864 cb_info->msg_recv_thread = NULL;
1866 LOGD("msg thread removed");
1868 g_mutex_lock(&cb_info->msg_handler_mutex);
1869 g_atomic_int_set(&cb_info->msg_handler_running, 0);
1870 g_cond_signal(&cb_info->msg_handler_cond);
1871 g_mutex_unlock(&cb_info->msg_handler_mutex);
1873 g_thread_join(cb_info->msg_handler_thread);
1874 g_thread_unref(cb_info->msg_handler_thread);
1875 cb_info->msg_handler_thread = NULL;
1877 g_queue_free(cb_info->msg_queue);
1878 cb_info->msg_queue = NULL;
1880 for (i = 0 ; i < MUSE_CAMERA_API_MAX ; i++) {
1881 g_mutex_clear(&cb_info->api_mutex[i]);
1882 g_cond_clear(&cb_info->api_cond[i]);
1885 g_mutex_clear(&cb_info->msg_handler_mutex);
1886 g_cond_clear(&cb_info->msg_handler_cond);
1887 g_mutex_clear(&cb_info->idle_event_mutex);
1888 g_cond_clear(&cb_info->idle_event_cond);
1889 g_mutex_clear(&cb_info->mp_data_mutex);
1890 g_mutex_clear(&cb_info->evas_mutex);
1892 LOGD("event thread removed");
1894 if (cb_info->fd > -1) {
1895 muse_core_connection_close(cb_info->fd);
1899 if (cb_info->bufmgr) {
1900 tbm_bufmgr_deinit(cb_info->bufmgr);
1901 cb_info->bufmgr = NULL;
1903 if (cb_info->api_activating) {
1904 g_free(cb_info->api_activating);
1905 cb_info->api_activating = NULL;
1907 if (cb_info->api_ret) {
1908 g_free(cb_info->api_ret);
1909 cb_info->api_ret = NULL;
1911 if (cb_info->pkt_fmt) {
1912 media_format_unref(cb_info->pkt_fmt);
1913 cb_info->pkt_fmt = NULL;
1916 if (cb_info->evas_info)
1917 mm_evas_renderer_destroy(&cb_info->evas_info);
1919 cb_info->preview_cb_flag = 0;
1928 int _camera_start_evas_rendering(camera_h camera)
1930 int ret = CAMERA_ERROR_NONE;
1931 camera_cli_s *pc = (camera_cli_s *)camera;
1933 if (camera == NULL) {
1934 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
1935 return CAMERA_ERROR_INVALID_PARAMETER;
1938 if (pc->cb_info == NULL) {
1939 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
1940 return CAMERA_ERROR_INVALID_PARAMETER;
1945 if (!CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
1946 LOGE("EVAS surface is not set");
1947 return CAMERA_ERROR_NONE;
1950 g_mutex_lock(&pc->cb_info->evas_mutex);
1952 /* set evas render flag as RUN */
1953 pc->cb_info->run_evas_render = true;
1954 ret = CAMERA_ERROR_NONE;
1956 g_mutex_unlock(&pc->cb_info->evas_mutex);
1962 int _camera_stop_evas_rendering(camera_h camera, bool keep_screen)
1964 int ret = CAMERA_ERROR_NONE;
1965 camera_cli_s *pc = (camera_cli_s *)camera;
1967 if (camera == NULL) {
1968 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
1969 return CAMERA_ERROR_INVALID_PARAMETER;
1972 if (pc->cb_info == NULL) {
1973 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
1974 return CAMERA_ERROR_INVALID_PARAMETER;
1977 LOGD("stop - keep screen %d", keep_screen);
1979 if (!CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
1980 LOGE("EVAS surface is not set");
1981 return CAMERA_ERROR_NONE;
1984 g_mutex_lock(&pc->cb_info->evas_mutex);
1986 /* set evas render flag as STOP and release buffers */
1987 pc->cb_info->run_evas_render = false;
1988 ret = mm_evas_renderer_retrieve_all_packets(pc->cb_info->evas_info, keep_screen);
1989 if (ret != MM_ERROR_NONE) {
1990 LOGE("mm_evas_renderer_retrieve_all_packets failed 0x%x", ret);
1991 ret = CAMERA_ERROR_INVALID_OPERATION;
1994 g_mutex_unlock(&pc->cb_info->evas_mutex);
2000 int camera_create(camera_device_e device, camera_h *camera)
2004 int ret = CAMERA_ERROR_NONE;
2006 camera_cli_s *pc = NULL;
2007 tbm_bufmgr bufmgr = NULL;
2009 muse_camera_api_e api = MUSE_CAMERA_API_CREATE;
2010 muse_core_api_module_e muse_module = MUSE_CAMERA;
2011 int device_type = (int)device;
2013 if (camera == NULL) {
2014 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2015 return CAMERA_ERROR_INVALID_PARAMETER;
2018 bufmgr = tbm_bufmgr_init(-1);
2019 if (bufmgr == NULL) {
2020 LOGE("get tbm bufmgr failed");
2021 return CAMERA_ERROR_INVALID_OPERATION;
2024 sock_fd = muse_core_client_new();
2026 LOGE("muse_core_client_new failed - returned fd %d", sock_fd);
2027 ret = CAMERA_ERROR_INVALID_OPERATION;
2033 sndMsg = muse_core_msg_json_factory_new(api,
2034 MUSE_TYPE_INT, "module", muse_module,
2035 MUSE_TYPE_INT, PARAM_DEVICE_TYPE, device_type,
2036 MUSE_TYPE_INT, "pid", pid,
2039 muse_core_ipc_send_msg(sock_fd, sndMsg);
2040 muse_core_msg_json_factory_free(sndMsg);
2042 pc = g_new0(camera_cli_s, 1);
2044 LOGE("camera_cli_s alloc failed");
2045 ret = CAMERA_ERROR_OUT_OF_MEMORY;
2049 pc->cb_info = _client_callback_new(sock_fd);
2050 if (pc->cb_info == NULL) {
2051 LOGE("cb_info alloc failed");
2052 ret = CAMERA_ERROR_OUT_OF_MEMORY;
2056 LOGD("cb info : %d", pc->cb_info->fd);
2058 ret = _client_wait_for_cb_return(api, pc->cb_info, CALLBACK_TIME_OUT);
2059 if (ret == CAMERA_ERROR_NONE) {
2060 intptr_t handle = 0;
2061 muse_camera_msg_get_pointer(handle, pc->cb_info->recv_msg);
2063 LOGE("Receiving Handle Failed!!");
2064 ret = CAMERA_ERROR_INVALID_OPERATION;
2068 pc->remote_handle = handle;
2069 pc->cb_info->bufmgr = bufmgr;
2071 ret = camera_set_display((camera_h)pc, CAMERA_DISPLAY_TYPE_NONE, NULL);
2072 if (ret != CAMERA_ERROR_NONE) {
2073 LOGE("init display failed 0x%x", ret);
2077 LOGD("camera create 0x%x", pc->remote_handle);
2078 *camera = (camera_h)pc;
2086 tbm_bufmgr_deinit(bufmgr);
2090 _client_callback_destroy(pc->cb_info);
2096 LOGE("camera create error : 0x%x", ret);
2101 int camera_destroy(camera_h camera)
2103 if (camera == NULL) {
2104 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2105 return CAMERA_ERROR_INVALID_PARAMETER;
2108 int ret = CAMERA_ERROR_NONE;
2109 muse_camera_api_e api = MUSE_CAMERA_API_DESTROY;
2110 camera_cli_s *pc = (camera_cli_s *)camera;
2115 if (pc->cb_info == NULL) {
2116 LOGE("cb_info NULL, INVALID_PARAMETER");
2117 return CAMERA_ERROR_INVALID_PARAMETER;
2120 sock_fd = pc->cb_info->fd;
2122 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2123 if (ret == CAMERA_ERROR_NONE) {
2124 _camera_remove_idle_event_all(pc->cb_info);
2125 _client_callback_destroy(pc->cb_info);
2131 LOGE("camera destroy error : 0x%x", ret);
2137 int camera_start_preview(camera_h camera)
2139 int ret = CAMERA_ERROR_NONE;
2140 muse_camera_api_e api = MUSE_CAMERA_API_START_PREVIEW;
2141 camera_cli_s *pc = (camera_cli_s *)camera;
2144 if (camera == NULL) {
2145 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2146 return CAMERA_ERROR_INVALID_PARAMETER;
2149 if (pc->cb_info == NULL) {
2150 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2151 return CAMERA_ERROR_INVALID_PARAMETER;
2156 sock_fd = pc->cb_info->fd;
2158 muse_camera_msg_send_longtime(api, sock_fd, pc->cb_info, ret);
2160 if (ret != CAMERA_ERROR_NONE) {
2161 LOGE("start preview failed 0x%x", ret);
2163 } else if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
2164 ret = _camera_start_evas_rendering(camera);
2167 LOGD("ret : 0x%x", ret);
2169 return CAMERA_ERROR_NONE;
2172 int camera_stop_preview(camera_h camera)
2174 int ret = CAMERA_ERROR_NONE;
2176 camera_cli_s *pc = NULL;
2177 muse_camera_api_e api = MUSE_CAMERA_API_STOP_PREVIEW;
2179 if (camera == NULL) {
2180 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2181 return CAMERA_ERROR_INVALID_PARAMETER;
2184 pc = (camera_cli_s *)camera;
2186 if (pc->cb_info == NULL) {
2187 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2188 return CAMERA_ERROR_INVALID_PARAMETER;
2191 sock_fd = pc->cb_info->fd;
2195 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
2196 camera_state_e current_state = CAMERA_STATE_NONE;
2198 ret = camera_get_state(camera, ¤t_state);
2199 if (ret != CAMERA_ERROR_NONE) {
2200 LOGE("failed to get current state 0x%x", ret);
2204 if (current_state == CAMERA_STATE_PREVIEW) {
2205 ret = _camera_stop_evas_rendering(camera, false);
2206 if (ret != CAMERA_ERROR_NONE)
2211 /* send stop preview message */
2212 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2214 LOGD("ret : 0x%x", ret);
2219 int camera_start_capture(camera_h camera, camera_capturing_cb capturing_cb, camera_capture_completed_cb completed_cb, void *user_data)
2221 if (camera == NULL) {
2222 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2223 return CAMERA_ERROR_INVALID_PARAMETER;
2225 int ret = CAMERA_ERROR_NONE;
2227 camera_cli_s *pc = (camera_cli_s *)camera;
2228 muse_camera_api_e api = MUSE_CAMERA_API_START_CAPTURE;
2230 int is_capturing_cb = 0;
2231 int is_completed_cb = 0;
2232 LOGD("Enter, handle :%x", pc->remote_handle);
2234 if (pc->cb_info == NULL) {
2235 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2236 return CAMERA_ERROR_INVALID_PARAMETER;
2239 sock_fd = pc->cb_info->fd;
2241 if (capturing_cb != NULL) {
2242 is_capturing_cb = 1;
2243 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = capturing_cb;
2244 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = user_data;
2247 if (completed_cb != NULL) {
2248 is_completed_cb = 1;
2249 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = completed_cb;
2250 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = user_data;
2253 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, is_capturing_cb, INT, is_completed_cb);
2254 LOGD("is_capturing_cb :%d, is_completed_cb : %d", is_capturing_cb, is_completed_cb);
2255 LOGD("ret : 0x%x", ret);
2259 bool camera_is_supported_continuous_capture(camera_h camera)
2261 if (camera == NULL) {
2262 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2266 int ret = CAMERA_ERROR_NONE;
2267 camera_cli_s *pc = (camera_cli_s *)camera;
2268 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_CONTINUOUS_CAPTURE;
2271 if (pc->cb_info == NULL) {
2272 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2273 return CAMERA_ERROR_INVALID_PARAMETER;
2276 sock_fd = pc->cb_info->fd;
2278 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2279 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2280 LOGD("ret : 0x%x", ret);
2284 int camera_start_continuous_capture(camera_h camera, int count, int interval, camera_capturing_cb capturing_cb, camera_capture_completed_cb completed_cb , void *user_data)
2286 if (camera == NULL) {
2287 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2288 return CAMERA_ERROR_INVALID_PARAMETER;
2291 int ret = CAMERA_ERROR_NONE;
2293 camera_cli_s *pc = (camera_cli_s *)camera;
2294 muse_camera_api_e api = MUSE_CAMERA_API_START_CONTINUOUS_CAPTURE;
2296 LOGD("Enter, handle :%x", pc->remote_handle);
2299 if (pc->cb_info == NULL) {
2300 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2301 return CAMERA_ERROR_INVALID_PARAMETER;
2303 sock_fd = pc->cb_info->fd;
2305 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = capturing_cb;
2306 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = user_data;
2307 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = completed_cb;
2309 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, count, INT, interval);
2311 LOGD("ret : 0x%x", ret);
2316 int camera_stop_continuous_capture(camera_h camera)
2318 if (camera == NULL) {
2319 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2320 return CAMERA_ERROR_INVALID_PARAMETER;
2324 int ret = CAMERA_ERROR_NONE;
2326 camera_cli_s *pc = (camera_cli_s *)camera;
2327 muse_camera_api_e api = MUSE_CAMERA_API_STOP_CONTINUOUS_CAPTURE;
2328 LOGD("Enter, handle :%x", pc->remote_handle);
2330 if (pc->cb_info == NULL) {
2331 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2332 return CAMERA_ERROR_INVALID_PARAMETER;
2334 sock_fd = pc->cb_info->fd;
2335 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2336 LOGD("ret : 0x%x", ret);
2340 bool camera_is_supported_face_detection(camera_h camera)
2342 if (camera == NULL) {
2343 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2346 int ret = CAMERA_ERROR_NONE;
2348 camera_cli_s *pc = (camera_cli_s *)camera;
2349 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_FACE_DETECTION;
2351 if (pc->cb_info == NULL) {
2352 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2353 return CAMERA_ERROR_INVALID_PARAMETER;
2355 sock_fd = pc->cb_info->fd;
2357 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2358 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2359 LOGD("ret : 0x%x", ret);
2363 bool camera_is_supported_zero_shutter_lag(camera_h camera)
2365 if (camera == NULL) {
2366 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2369 int ret = CAMERA_ERROR_NONE;
2371 camera_cli_s *pc = (camera_cli_s *)camera;
2372 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_ZERO_SHUTTER_LAG;
2374 if (pc->cb_info == NULL) {
2375 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2376 return CAMERA_ERROR_INVALID_PARAMETER;
2378 sock_fd = pc->cb_info->fd;
2380 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2381 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2382 LOGD("ret : 0x%x", ret);
2386 bool camera_is_supported_media_packet_preview_cb(camera_h camera)
2388 if (camera == NULL) {
2389 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2393 int ret = CAMERA_ERROR_NONE;
2395 camera_cli_s *pc = (camera_cli_s *)camera;
2396 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_MEDIA_PACKET_PREVIEW_CB;
2398 if (pc->cb_info == NULL) {
2399 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2400 return CAMERA_ERROR_INVALID_PARAMETER;
2402 sock_fd = pc->cb_info->fd;
2404 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2405 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2406 LOGD("ret : 0x%x", ret);
2410 int camera_get_device_count(camera_h camera, int *device_count)
2412 if (camera == NULL || device_count == NULL) {
2413 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2414 return CAMERA_ERROR_INVALID_PARAMETER;
2416 int ret = CAMERA_ERROR_NONE;
2418 camera_cli_s *pc = (camera_cli_s *)camera;
2419 muse_camera_api_e api = MUSE_CAMERA_API_GET_DEVICE_COUNT;
2421 if (pc->cb_info == NULL) {
2422 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2423 return CAMERA_ERROR_INVALID_PARAMETER;
2425 sock_fd = pc->cb_info->fd;
2426 int get_device_count;
2428 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2429 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2431 if (ret == CAMERA_ERROR_NONE) {
2432 muse_camera_msg_get(get_device_count, pc->cb_info->recv_msg);
2433 *device_count = get_device_count;
2435 LOGD("ret : 0x%x", ret);
2439 int camera_start_face_detection(camera_h camera, camera_face_detected_cb callback, void *user_data)
2441 if (camera == NULL) {
2442 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2443 return CAMERA_ERROR_INVALID_PARAMETER;
2446 int ret = CAMERA_ERROR_NONE;
2448 camera_cli_s *pc = (camera_cli_s *)camera;
2449 muse_camera_api_e api = MUSE_CAMERA_API_START_FACE_DETECTION;
2451 LOGD("Enter, handle :%x", pc->remote_handle);
2453 if (pc->cb_info == NULL) {
2454 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2455 return CAMERA_ERROR_INVALID_PARAMETER;
2457 sock_fd = pc->cb_info->fd;
2458 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION] = callback;
2459 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION] = user_data;
2461 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2462 LOGD("ret : 0x%x", ret);
2466 int camera_stop_face_detection(camera_h camera)
2468 if (camera == NULL) {
2469 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2470 return CAMERA_ERROR_INVALID_PARAMETER;
2473 int ret = CAMERA_ERROR_NONE;
2475 camera_cli_s *pc = (camera_cli_s *)camera;
2476 muse_camera_api_e api = MUSE_CAMERA_API_STOP_FACE_DETECTION;
2477 LOGD("Enter, handle :%x", pc->remote_handle);
2479 if (pc->cb_info == NULL) {
2480 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2481 return CAMERA_ERROR_INVALID_PARAMETER;
2483 sock_fd = pc->cb_info->fd;
2484 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2485 LOGD("ret : 0x%x", ret);
2489 int camera_get_state(camera_h camera, camera_state_e *state)
2491 if (camera == NULL || state == NULL) {
2492 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2493 return CAMERA_ERROR_INVALID_PARAMETER;
2495 int ret = CAMERA_ERROR_NONE;
2497 camera_cli_s *pc = (camera_cli_s *)camera;
2498 muse_camera_api_e api = MUSE_CAMERA_API_GET_STATE;
2500 if (pc->cb_info == NULL) {
2501 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2502 return CAMERA_ERROR_INVALID_PARAMETER;
2504 sock_fd = pc->cb_info->fd;
2507 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2508 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2510 if (ret == CAMERA_ERROR_NONE) {
2511 muse_camera_msg_get(get_state, pc->cb_info->recv_msg);
2512 *state = (camera_state_e)get_state;
2514 LOGD("ret : 0x%x", ret);
2518 int camera_start_focusing(camera_h camera, bool continuous)
2520 if (camera == NULL) {
2521 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2522 return CAMERA_ERROR_INVALID_PARAMETER;
2525 int ret = CAMERA_ERROR_NONE;
2527 camera_cli_s *pc = (camera_cli_s *)camera;
2528 muse_camera_api_e api = MUSE_CAMERA_API_START_FOCUSING;
2530 if (pc->cb_info == NULL) {
2531 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2532 return CAMERA_ERROR_INVALID_PARAMETER;
2534 sock_fd = pc->cb_info->fd;
2535 int is_continuous = (int)continuous;
2537 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2538 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, is_continuous);
2539 LOGD("ret : 0x%x", ret);
2543 int camera_cancel_focusing(camera_h camera)
2545 if (camera == NULL) {
2546 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2547 return CAMERA_ERROR_INVALID_PARAMETER;
2550 int ret = CAMERA_ERROR_NONE;
2552 camera_cli_s *pc = (camera_cli_s *)camera;
2553 muse_camera_api_e api = MUSE_CAMERA_API_CANCEL_FOCUSING;
2555 if (pc->cb_info == NULL) {
2556 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2557 return CAMERA_ERROR_INVALID_PARAMETER;
2559 sock_fd = pc->cb_info->fd;
2561 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2562 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2563 LOGD("ret : 0x%x", ret);
2567 int camera_set_display(camera_h camera, camera_display_type_e type, camera_display_h display)
2569 int ret = CAMERA_ERROR_NONE;
2570 void *set_display_handle = NULL;
2571 Evas_Object *obj = NULL;
2572 const char *object_type = NULL;
2574 camera_wl_info_s *wl_info = NULL;
2575 #endif /* HAVE_WAYLAND */
2576 camera_cli_s *pc = (camera_cli_s *)camera;
2577 camera_cb_info_s *cb_info = NULL;
2578 muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY;
2579 camera_state_e current_state = CAMERA_STATE_NONE;
2582 if (camera == NULL) {
2583 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2584 return CAMERA_ERROR_INVALID_PARAMETER;
2587 if (type < CAMERA_DISPLAY_TYPE_OVERLAY || type > CAMERA_DISPLAY_TYPE_NONE) {
2588 LOGE("invalid type %d", type);
2589 return CAMERA_ERROR_INVALID_PARAMETER;
2592 if (type != CAMERA_DISPLAY_TYPE_NONE && display == NULL) {
2593 LOGE("display type[%d] is not NONE, but display handle is NULL", type);
2594 return CAMERA_ERROR_INVALID_PARAMETER;
2597 if (pc->cb_info == NULL) {
2598 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2599 return CAMERA_ERROR_INVALID_PARAMETER;
2602 cb_info = (camera_cb_info_s *)pc->cb_info;
2603 sock_fd = cb_info->fd;
2605 ret = camera_get_state(camera, ¤t_state);
2606 if (ret != CAMERA_ERROR_NONE) {
2607 LOGE("failed to get current state 0x%x", ret);
2611 if (current_state != CAMERA_STATE_CREATED) {
2612 LOGE("INVALID_STATE : current %d", current_state);
2613 return CAMERA_ERROR_INVALID_STATE;
2616 LOGD("Enter, remote_handle : %x display : 0x%x", pc->remote_handle, display);
2618 if (type == CAMERA_DISPLAY_TYPE_NONE) {
2619 set_display_handle = 0;
2620 LOGD("display type NONE");
2622 obj = (Evas_Object *)display;
2623 object_type = evas_object_type_get(obj);
2625 if (type == CAMERA_DISPLAY_TYPE_OVERLAY && !strcmp(object_type, "elm_win")) {
2627 /* get wayland parent id */
2628 if (_get_wl_info(obj, &pc->wl_info) != CAMERA_ERROR_NONE) {
2629 LOGE("failed to get wayland info");
2630 return CAMERA_ERROR_INVALID_OPERATION;
2633 set_display_handle = (void *)&pc->wl_info;
2634 #else /* HAVE_WAYLAND */
2635 /* x window overlay surface */
2636 set_display_handle = (void *)elm_win_xwindow_get(obj);
2637 #endif /* HAVE_WAYLAND */
2638 LOGD("display type OVERLAY : handle %p", set_display_handle);
2639 } else if (type == CAMERA_DISPLAY_TYPE_EVAS && !strcmp(object_type, "image")) {
2640 /* evas object surface */
2641 set_display_handle = (void *)display;
2642 LOGD("display type EVAS : handle %p", set_display_handle);
2644 g_mutex_lock(&cb_info->evas_mutex);
2646 if (cb_info->evas_info) {
2647 LOGW("destroy existed evas renderer %p", cb_info->evas_info);
2648 ret = mm_evas_renderer_destroy(&cb_info->evas_info);
2649 if (ret != MM_ERROR_NONE) {
2650 LOGE("failed to destroy evas renderer %p", cb_info->evas_info);
2651 g_mutex_unlock(&cb_info->evas_mutex);
2652 return CAMERA_ERROR_INVALID_OPERATION;
2656 /* create evas renderer */
2657 ret = mm_evas_renderer_create(&cb_info->evas_info, (Evas_Object *)set_display_handle);
2658 if (ret == MM_ERROR_NONE) {
2659 camera_flip_e flip = CAMERA_FLIP_NONE;
2660 camera_display_mode_e mode = CAMERA_DISPLAY_MODE_LETTER_BOX;
2661 camera_rotation_e rotation = CAMERA_ROTATION_NONE;
2664 camera_get_display_flip(camera, &flip);
2665 camera_get_display_mode(camera, &mode);
2666 camera_get_display_rotation(camera, &rotation);
2667 camera_is_display_visible(camera, &visible);
2669 LOGD("current setting : flip %d, mode %d, rotation %d, visible %d",
2670 flip, mode, rotation, visible);
2672 ret = mm_evas_renderer_set_flip(cb_info->evas_info, flip);
2673 ret |= mm_evas_renderer_set_geometry(cb_info->evas_info, mode);
2674 ret |= mm_evas_renderer_set_rotation(cb_info->evas_info, rotation);
2675 ret |= mm_evas_renderer_set_visible(cb_info->evas_info, visible);
2678 g_mutex_unlock(&cb_info->evas_mutex);
2680 if (ret != MM_ERROR_NONE) {
2681 LOGE("mm_evas_renderer error 0x%x", ret);
2682 return CAMERA_ERROR_INVALID_OPERATION;
2686 LOGE("unknown evas object [%p,%s] or type [%d] mismatch", obj, object_type, type);
2687 return CAMERA_ERROR_INVALID_PARAMETER;
2690 LOGE("failed to get evas object type from %p", obj);
2691 return CAMERA_ERROR_INVALID_PARAMETER;
2695 pc->display_handle = (intptr_t)set_display_handle;
2697 if (type == CAMERA_DISPLAY_TYPE_OVERLAY) {
2699 wl_info = &pc->wl_info;
2700 muse_camera_msg_send_array_and_value(api, sock_fd, cb_info, ret,
2701 wl_info, 5, sizeof(int), INT, type);
2703 LOGD("wayland parent id : %d, window %d,%d,%dx%d",
2704 wl_info->parent_id, wl_info->window_x, wl_info->window_y,
2705 wl_info->window_width, wl_info->window_height);
2706 #else /* HAVE_WAYLAND */
2707 muse_camera_msg_send2(api, sock_fd, cb_info, ret, INT, type, INT, set_display_handle);
2709 LOGD("x id : %d", (int)set_display_handle);
2710 #endif /* HAVE_WAYLAND */
2712 muse_camera_msg_send1(api, sock_fd, cb_info, ret, INT, type);
2714 if (ret != CAMERA_ERROR_NONE)
2715 LOGE("set display error 0x%x", ret);
2716 else if (type == CAMERA_DISPLAY_TYPE_EVAS)
2717 SET_PREVIEW_CB_TYPE(cb_info, PREVIEW_CB_TYPE_EVAS);
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 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
2962 g_mutex_lock(&pc->cb_info->evas_mutex);
2964 ret = mm_evas_renderer_set_flip(pc->cb_info->evas_info, flip);
2966 g_mutex_unlock(&pc->cb_info->evas_mutex);
2968 if (ret != MM_ERROR_NONE) {
2969 LOGE("failed to set flip for evas surface 0x%x", ret);
2970 return CAMERA_ERROR_INVALID_OPERATION;
2974 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_FLIP,
2975 pc->cb_info->fd, pc->cb_info, ret, INT, set_flip);
2980 int camera_get_display_flip(camera_h camera, camera_flip_e *flip)
2982 int ret = CAMERA_ERROR_NONE;
2983 int get_flip = CAMERA_FLIP_NONE;
2984 camera_cli_s *pc = NULL;
2986 if (camera == NULL || flip == NULL) {
2987 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2988 return CAMERA_ERROR_INVALID_PARAMETER;
2991 pc = (camera_cli_s *)camera;
2993 if (pc->cb_info == NULL) {
2994 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2995 return CAMERA_ERROR_INVALID_PARAMETER;
2998 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
2999 g_mutex_lock(&pc->cb_info->evas_mutex);
3001 ret = mm_evas_renderer_get_flip(pc->cb_info->evas_info, (int *)flip);
3003 g_mutex_unlock(&pc->cb_info->evas_mutex);
3005 if (ret != MM_ERROR_NONE) {
3006 LOGE("failed to get flip for evas surface 0x%x", ret);
3007 return CAMERA_ERROR_INVALID_OPERATION;
3010 muse_camera_msg_send(MUSE_CAMERA_API_GET_DISPLAY_FLIP,
3011 pc->cb_info->fd, pc->cb_info, ret);
3013 if (ret == CAMERA_ERROR_NONE) {
3014 muse_camera_msg_get(get_flip, pc->cb_info->recv_msg);
3015 *flip = (camera_flip_e)get_flip;
3022 int camera_set_display_visible(camera_h camera, bool visible)
3024 int ret = CAMERA_ERROR_NONE;
3025 int set_visible = (int)visible;
3026 camera_cli_s *pc = NULL;
3028 if (camera == NULL) {
3029 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3030 return CAMERA_ERROR_INVALID_PARAMETER;
3033 pc = (camera_cli_s *)camera;
3035 if (pc->cb_info == NULL) {
3036 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3037 return CAMERA_ERROR_INVALID_PARAMETER;
3040 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
3041 g_mutex_lock(&pc->cb_info->evas_mutex);
3043 ret = mm_evas_renderer_set_visible(pc->cb_info->evas_info, visible);
3045 g_mutex_unlock(&pc->cb_info->evas_mutex);
3047 if (ret != MM_ERROR_NONE) {
3048 LOGE("failed to set visible for evas surface 0x%x", ret);
3049 return CAMERA_ERROR_INVALID_OPERATION;
3053 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_VISIBLE,
3054 pc->cb_info->fd, pc->cb_info, ret, INT, set_visible);
3059 int camera_is_display_visible(camera_h camera, bool *visible)
3061 int ret = CAMERA_ERROR_NONE;
3062 int get_visible = true;
3063 camera_cli_s *pc = NULL;
3065 if (camera == NULL || visible == NULL) {
3066 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3067 return CAMERA_ERROR_INVALID_PARAMETER;
3070 pc = (camera_cli_s *)camera;
3072 if (pc->cb_info == NULL) {
3073 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3074 return CAMERA_ERROR_INVALID_PARAMETER;
3077 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
3078 g_mutex_lock(&pc->cb_info->evas_mutex);
3080 ret = mm_evas_renderer_get_visible(pc->cb_info->evas_info, visible);
3082 g_mutex_unlock(&pc->cb_info->evas_mutex);
3084 if (ret != MM_ERROR_NONE) {
3085 LOGE("failed to get visible for evas surface 0x%x", ret);
3086 return CAMERA_ERROR_INVALID_OPERATION;
3089 muse_camera_msg_send(MUSE_CAMERA_API_IS_DISPLAY_VISIBLE,
3090 pc->cb_info->fd, pc->cb_info, ret);
3092 if (ret == CAMERA_ERROR_NONE) {
3093 muse_camera_msg_get(get_visible, pc->cb_info->recv_msg);
3094 *visible = (bool)get_visible;
3101 int camera_set_display_mode(camera_h camera, camera_display_mode_e mode)
3103 int ret = CAMERA_ERROR_NONE;
3104 int set_mode = (int)mode;
3105 camera_cli_s *pc = NULL;
3107 if (camera == NULL) {
3108 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3109 return CAMERA_ERROR_INVALID_PARAMETER;
3112 if (mode < CAMERA_DISPLAY_MODE_LETTER_BOX || mode > CAMERA_DISPLAY_MODE_CROPPED_FULL) {
3113 LOGE("Invalid mode %d", mode);
3114 return CAMERA_ERROR_INVALID_PARAMETER;
3117 pc = (camera_cli_s *)camera;
3119 if (pc->cb_info == NULL) {
3120 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3121 return CAMERA_ERROR_INVALID_PARAMETER;
3124 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
3125 g_mutex_lock(&pc->cb_info->evas_mutex);
3127 ret = mm_evas_renderer_set_geometry(pc->cb_info->evas_info, mode);
3129 g_mutex_unlock(&pc->cb_info->evas_mutex);
3131 if (ret != MM_ERROR_NONE) {
3132 LOGE("failed to set geometry for evas surface 0x%x", ret);
3133 return CAMERA_ERROR_INVALID_OPERATION;
3137 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_MODE,
3138 pc->cb_info->fd, pc->cb_info, ret, INT, set_mode);
3143 int camera_get_display_mode(camera_h camera, camera_display_mode_e *mode)
3145 int ret = CAMERA_ERROR_NONE;
3146 int get_mode = CAMERA_DISPLAY_MODE_LETTER_BOX;
3147 camera_cli_s *pc = NULL;
3149 if (camera == NULL || mode == NULL) {
3150 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3151 return CAMERA_ERROR_INVALID_PARAMETER;
3154 pc = (camera_cli_s *)camera;
3156 if (pc->cb_info == NULL) {
3157 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3158 return CAMERA_ERROR_INVALID_PARAMETER;
3161 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
3162 g_mutex_lock(&pc->cb_info->evas_mutex);
3164 ret = mm_evas_renderer_get_geometry(pc->cb_info->evas_info, (int *)mode);
3166 g_mutex_unlock(&pc->cb_info->evas_mutex);
3168 if (ret != MM_ERROR_NONE) {
3169 LOGE("failed to get geometry for evas surface 0x%x", ret);
3170 return CAMERA_ERROR_INVALID_OPERATION;
3173 muse_camera_msg_send(MUSE_CAMERA_API_GET_DISPLAY_MODE,
3174 pc->cb_info->fd, pc->cb_info, ret);
3176 if (ret == CAMERA_ERROR_NONE) {
3177 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
3178 *mode = (camera_display_mode_e)get_mode;
3185 int camera_get_capture_resolution(camera_h camera, int *width, int *height)
3187 if (camera == NULL || width == NULL || height == NULL) {
3188 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3189 return CAMERA_ERROR_INVALID_PARAMETER;
3191 int ret = CAMERA_ERROR_NONE;
3193 camera_cli_s *pc = (camera_cli_s *)camera;
3194 muse_camera_api_e api = MUSE_CAMERA_API_GET_CAPTURE_RESOLUTION;
3196 if (pc->cb_info == NULL) {
3197 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3198 return CAMERA_ERROR_INVALID_PARAMETER;
3200 sock_fd = pc->cb_info->fd;
3204 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3205 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3207 if (ret == CAMERA_ERROR_NONE) {
3208 muse_camera_msg_get(get_width, pc->cb_info->recv_msg);
3209 muse_camera_msg_get(get_height, pc->cb_info->recv_msg);
3211 *height = get_height;
3213 LOGD("ret : 0x%x", ret);
3217 int camera_get_capture_format(camera_h camera, camera_pixel_format_e *format)
3219 if (camera == NULL || format == NULL) {
3220 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3221 return CAMERA_ERROR_INVALID_PARAMETER;
3223 int ret = CAMERA_ERROR_NONE;
3225 camera_cli_s *pc = (camera_cli_s *)camera;
3226 muse_camera_api_e api = MUSE_CAMERA_API_GET_CAPTURE_FORMAT;
3229 if (pc->cb_info == NULL) {
3230 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3231 return CAMERA_ERROR_INVALID_PARAMETER;
3233 sock_fd = pc->cb_info->fd;
3235 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3236 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3238 if (ret == CAMERA_ERROR_NONE) {
3239 muse_camera_msg_get(get_format, pc->cb_info->recv_msg);
3240 *format = (camera_pixel_format_e)get_format;
3242 LOGD("ret : 0x%x", ret);
3246 int camera_get_preview_format(camera_h camera, camera_pixel_format_e *format)
3248 if (camera == NULL || format == NULL) {
3249 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3250 return CAMERA_ERROR_INVALID_PARAMETER;
3253 int ret = CAMERA_ERROR_NONE;
3255 camera_cli_s *pc = (camera_cli_s *)camera;
3256 muse_camera_api_e api = MUSE_CAMERA_API_GET_PREVIEW_FORMAT;
3259 if (pc->cb_info == NULL) {
3260 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3261 return CAMERA_ERROR_INVALID_PARAMETER;
3263 sock_fd = pc->cb_info->fd;
3265 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3266 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3268 if (ret == CAMERA_ERROR_NONE) {
3269 muse_camera_msg_get(get_format, pc->cb_info->recv_msg);
3270 *format = (camera_pixel_format_e)get_format;
3272 LOGD("ret : 0x%x", ret);
3276 int camera_get_facing_direction(camera_h camera, camera_facing_direction_e *facing_direciton)
3278 if (camera == NULL || facing_direciton == NULL) {
3279 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3280 return CAMERA_ERROR_INVALID_PARAMETER;
3283 int ret = CAMERA_ERROR_NONE;
3285 camera_cli_s *pc = (camera_cli_s *)camera;
3286 muse_camera_api_e api = MUSE_CAMERA_API_GET_FACING_DIRECTION;
3288 if (pc->cb_info == NULL) {
3289 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3290 return CAMERA_ERROR_INVALID_PARAMETER;
3292 sock_fd = pc->cb_info->fd;
3293 int get_facing_direction;
3295 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3296 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3298 if (ret == CAMERA_ERROR_NONE) {
3299 muse_camera_msg_get(get_facing_direction, pc->cb_info->recv_msg);
3300 *facing_direciton = (camera_facing_direction_e)get_facing_direction;
3302 LOGD("ret : 0x%x", ret);
3306 int camera_set_preview_cb(camera_h camera, camera_preview_cb callback, void *user_data)
3308 if (camera == NULL || callback == NULL) {
3309 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3310 return CAMERA_ERROR_INVALID_PARAMETER;
3312 int ret = CAMERA_ERROR_NONE;
3314 camera_cli_s *pc = (camera_cli_s *)camera;
3315 camera_cb_info_s *cb_info = (camera_cb_info_s *)pc->cb_info;
3317 if (pc->cb_info == NULL) {
3318 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3319 return CAMERA_ERROR_INVALID_PARAMETER;
3321 sock_fd = pc->cb_info->fd;
3322 muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_CB;
3324 LOGD("Enter, handle :%x", pc->remote_handle);
3326 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = callback;
3327 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = user_data;
3328 SET_PREVIEW_CB_TYPE(cb_info, PREVIEW_CB_TYPE_USER);
3330 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3331 LOGD("ret : 0x%x", ret);
3335 int camera_unset_preview_cb(camera_h camera)
3337 if (camera == NULL) {
3338 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3339 return CAMERA_ERROR_INVALID_PARAMETER;
3342 int ret = CAMERA_ERROR_NONE;
3344 camera_cli_s *pc = (camera_cli_s *)camera;
3345 camera_cb_info_s *cb_info = (camera_cb_info_s *)pc->cb_info;
3346 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_PREVIEW_CB;
3348 LOGD("Enter, handle :%x", pc->remote_handle);
3351 if (pc->cb_info == NULL) {
3352 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3353 return CAMERA_ERROR_INVALID_PARAMETER;
3355 sock_fd = pc->cb_info->fd;
3356 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = (void *)NULL;
3357 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = (void *)NULL;
3358 UNSET_PREVIEW_CB_TYPE(cb_info, PREVIEW_CB_TYPE_USER);
3360 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3361 LOGD("ret : 0x%x", ret);
3365 int camera_set_media_packet_preview_cb(camera_h camera, camera_media_packet_preview_cb callback, void *user_data)
3367 if (camera == NULL) {
3368 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
3369 return CAMERA_ERROR_INVALID_PARAMETER;
3372 if (camera_is_supported_media_packet_preview_cb(camera) == false) {
3373 LOGE("NOT SUPPORTED");
3374 return CAMERA_ERROR_NOT_SUPPORTED;
3377 if (callback == NULL) {
3378 LOGE("INVALID_PARAMETER(0x%08x) - callback", CAMERA_ERROR_INVALID_PARAMETER);
3379 return CAMERA_ERROR_INVALID_PARAMETER;
3382 int ret = CAMERA_ERROR_NONE;
3384 camera_cli_s *pc = (camera_cli_s *)camera;
3385 muse_camera_api_e api = MUSE_CAMERA_API_SET_MEDIA_PACKET_PREVIEW_CB;
3387 LOGD("Enter, handle :%x", pc->remote_handle);
3390 if (pc->cb_info == NULL) {
3391 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3392 return CAMERA_ERROR_INVALID_PARAMETER;
3394 sock_fd = pc->cb_info->fd;
3395 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = callback;
3396 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = user_data;
3398 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3399 LOGD("ret : 0x%x", ret);
3403 int camera_unset_media_packet_preview_cb(camera_h camera)
3405 if (camera == NULL) {
3406 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3407 return CAMERA_ERROR_INVALID_PARAMETER;
3410 int ret = CAMERA_ERROR_NONE;
3412 camera_cli_s *pc = (camera_cli_s *)camera;
3413 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_MEDIA_PACKET_PREVIEW_CB;
3415 LOGD("Enter, handle :%x", pc->remote_handle);
3418 if (pc->cb_info == NULL) {
3419 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3420 return CAMERA_ERROR_INVALID_PARAMETER;
3422 sock_fd = pc->cb_info->fd;
3423 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = (void *)NULL;
3424 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = (void *)NULL;
3426 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3427 LOGD("ret : 0x%x", ret);
3431 int camera_set_state_changed_cb(camera_h camera, camera_state_changed_cb callback, void *user_data)
3433 if (camera == NULL || callback == 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_SET_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] = callback;
3451 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = user_data;
3453 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3454 LOGD("ret : 0x%x", ret);
3457 int camera_unset_state_changed_cb(camera_h camera)
3459 if (camera == NULL) {
3460 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3461 return CAMERA_ERROR_INVALID_PARAMETER;
3463 int ret = CAMERA_ERROR_NONE;
3465 camera_cli_s *pc = (camera_cli_s *)camera;
3466 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_STATE_CHANGED_CB;
3468 LOGD("Enter, handle :%x", pc->remote_handle);
3471 if (pc->cb_info == NULL) {
3472 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3473 return CAMERA_ERROR_INVALID_PARAMETER;
3475 sock_fd = pc->cb_info->fd;
3476 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = (void *)NULL;
3477 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = (void *)NULL;
3479 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3480 LOGD("ret : 0x%x", ret);
3484 int camera_set_interrupted_cb(camera_h camera, camera_interrupted_cb callback, void *user_data)
3486 if (camera == NULL || callback == NULL) {
3487 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3488 return CAMERA_ERROR_INVALID_PARAMETER;
3490 int ret = CAMERA_ERROR_NONE;
3492 camera_cli_s *pc = (camera_cli_s *)camera;
3493 muse_camera_api_e api = MUSE_CAMERA_API_SET_INTERRUPTED_CB;
3495 LOGD("Enter, handle :%x", pc->remote_handle);
3498 if (pc->cb_info == NULL) {
3499 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3500 return CAMERA_ERROR_INVALID_PARAMETER;
3502 sock_fd = pc->cb_info->fd;
3503 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = callback;
3504 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = user_data;
3506 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3507 LOGD("ret : 0x%x", ret);
3511 int camera_unset_interrupted_cb(camera_h camera)
3513 if (camera == NULL) {
3514 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3515 return CAMERA_ERROR_INVALID_PARAMETER;
3517 int ret = CAMERA_ERROR_NONE;
3519 camera_cli_s *pc = (camera_cli_s *)camera;
3520 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_INTERRUPTED_CB;
3522 LOGD("Enter, handle :%x", pc->remote_handle);
3525 if (pc->cb_info == NULL) {
3526 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3527 return CAMERA_ERROR_INVALID_PARAMETER;
3529 sock_fd = pc->cb_info->fd;
3530 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = (void *)NULL;
3531 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = (void *)NULL;
3533 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3534 LOGD("ret : 0x%x", ret);
3538 int camera_set_focus_changed_cb(camera_h camera, camera_focus_changed_cb callback, void *user_data)
3540 if (camera == NULL || callback == NULL) {
3541 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3542 return CAMERA_ERROR_INVALID_PARAMETER;
3544 int ret = CAMERA_ERROR_NONE;
3546 camera_cli_s *pc = (camera_cli_s *)camera;
3547 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOCUS_CHANGED_CB;
3549 LOGD("Enter, handle :%x", pc->remote_handle);
3552 if (pc->cb_info == NULL) {
3553 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3554 return CAMERA_ERROR_INVALID_PARAMETER;
3556 sock_fd = pc->cb_info->fd;
3557 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = callback;
3558 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = user_data;
3560 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3561 LOGD("ret : 0x%x", ret);
3565 int camera_unset_focus_changed_cb(camera_h camera)
3567 if (camera == NULL) {
3568 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3569 return CAMERA_ERROR_INVALID_PARAMETER;
3571 int ret = CAMERA_ERROR_NONE;
3573 camera_cli_s *pc = (camera_cli_s *)camera;
3574 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_FOCUS_CHANGED_CB;
3576 LOGD("Enter, handle :%x", pc->remote_handle);
3579 if (pc->cb_info == NULL) {
3580 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3581 return CAMERA_ERROR_INVALID_PARAMETER;
3583 sock_fd = pc->cb_info->fd;
3584 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = (void *)NULL;
3585 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = (void *)NULL;
3587 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3588 LOGD("ret : 0x%x", ret);
3592 int camera_set_error_cb(camera_h camera, camera_error_cb callback, void *user_data)
3594 if (camera == NULL || callback == NULL) {
3595 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3596 return CAMERA_ERROR_INVALID_PARAMETER;
3598 int ret = CAMERA_ERROR_NONE;
3600 camera_cli_s *pc = (camera_cli_s *)camera;
3601 muse_camera_api_e api = MUSE_CAMERA_API_SET_ERROR_CB;
3603 LOGD("Enter, handle :%x", pc->remote_handle);
3606 if (pc->cb_info == NULL) {
3607 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3608 return CAMERA_ERROR_INVALID_PARAMETER;
3610 sock_fd = pc->cb_info->fd;
3611 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_ERROR] = callback;
3612 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_ERROR] = user_data;
3614 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3615 LOGD("ret : 0x%x", ret);
3619 int camera_unset_error_cb(camera_h camera)
3621 if (camera == NULL) {
3622 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3623 return CAMERA_ERROR_INVALID_PARAMETER;
3625 int ret = CAMERA_ERROR_NONE;
3627 camera_cli_s *pc = (camera_cli_s *)camera;
3628 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_ERROR_CB;
3630 LOGD("Enter, handle :%x", pc->remote_handle);
3633 if (pc->cb_info == NULL) {
3634 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3635 return CAMERA_ERROR_INVALID_PARAMETER;
3637 sock_fd = pc->cb_info->fd;
3638 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_ERROR] = (void *)NULL;
3639 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_ERROR] = (void *)NULL;
3641 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3642 LOGD("ret : 0x%x", ret);
3646 int camera_foreach_supported_preview_resolution(camera_h camera, camera_supported_preview_resolution_cb foreach_cb , void *user_data)
3648 if (camera == NULL || foreach_cb == NULL) {
3649 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3650 return CAMERA_ERROR_INVALID_PARAMETER;
3652 int ret = CAMERA_ERROR_NONE;
3654 camera_cli_s *pc = (camera_cli_s *)camera;
3655 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_PREVIEW_RESOLUTION;
3657 LOGD("Enter, handle :%x", pc->remote_handle);
3660 if (pc->cb_info == NULL) {
3661 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3662 return CAMERA_ERROR_INVALID_PARAMETER;
3664 sock_fd = pc->cb_info->fd;
3665 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_RESOLUTION] = foreach_cb;
3666 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_RESOLUTION] = user_data;
3668 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3669 LOGD("ret : 0x%x", ret);
3673 int camera_foreach_supported_capture_resolution(camera_h camera, camera_supported_capture_resolution_cb foreach_cb , void *user_data)
3675 if (camera == NULL || foreach_cb == NULL) {
3676 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3677 return CAMERA_ERROR_INVALID_PARAMETER;
3679 int ret = CAMERA_ERROR_NONE;
3681 camera_cli_s *pc = (camera_cli_s *)camera;
3682 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_CAPTURE_RESOLUTION;
3684 LOGD("Enter, handle :%x", pc->remote_handle);
3687 if (pc->cb_info == NULL) {
3688 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3689 return CAMERA_ERROR_INVALID_PARAMETER;
3691 sock_fd = pc->cb_info->fd;
3692 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_RESOLUTION] = foreach_cb;
3693 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_RESOLUTION] = user_data;
3695 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3696 LOGD("ret : 0x%x", ret);
3700 int camera_foreach_supported_capture_format(camera_h camera, camera_supported_capture_format_cb foreach_cb , void *user_data)
3702 if (camera == NULL || foreach_cb == NULL) {
3703 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3704 return CAMERA_ERROR_INVALID_PARAMETER;
3706 int ret = CAMERA_ERROR_NONE;
3708 camera_cli_s *pc = (camera_cli_s *)camera;
3709 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_CAPTURE_FORMAT;
3711 LOGD("Enter, handle :%x", pc->remote_handle);
3714 if (pc->cb_info == NULL) {
3715 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3716 return CAMERA_ERROR_INVALID_PARAMETER;
3718 sock_fd = pc->cb_info->fd;
3719 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_FORMAT] = foreach_cb;
3720 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_FORMAT] = user_data;
3722 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3723 LOGD("ret : 0x%x", ret);
3728 int camera_foreach_supported_preview_format(camera_h camera, camera_supported_preview_format_cb foreach_cb , void *user_data)
3730 if (camera == NULL || foreach_cb == NULL) {
3731 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3732 return CAMERA_ERROR_INVALID_PARAMETER;
3734 int ret = CAMERA_ERROR_NONE;
3736 camera_cli_s *pc = (camera_cli_s *)camera;
3737 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_PREVIEW_FORMAT;
3739 LOGD("Enter, handle :%x", pc->remote_handle);
3742 if (pc->cb_info == NULL) {
3743 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3744 return CAMERA_ERROR_INVALID_PARAMETER;
3746 sock_fd = pc->cb_info->fd;
3747 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_FORMAT] = foreach_cb;
3748 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_FORMAT] = user_data;
3750 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3751 LOGD("ret : 0x%x", ret);
3756 int camera_get_recommended_preview_resolution(camera_h camera, int *width, int *height)
3758 if (camera == NULL || width == NULL || height == NULL) {
3759 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3760 return CAMERA_ERROR_INVALID_PARAMETER;
3762 int ret = CAMERA_ERROR_NONE;
3764 camera_cli_s *pc = (camera_cli_s *)camera;
3765 muse_camera_api_e api = MUSE_CAMERA_API_GET_RECOMMENDED_PREVIEW_RESOLUTION;
3767 if (pc->cb_info == NULL) {
3768 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3769 return CAMERA_ERROR_INVALID_PARAMETER;
3771 sock_fd = pc->cb_info->fd;
3775 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3776 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3778 if (ret == CAMERA_ERROR_NONE) {
3779 muse_camera_msg_get(get_width, pc->cb_info->recv_msg);
3780 muse_camera_msg_get(get_height, pc->cb_info->recv_msg);
3782 *height = get_height;
3784 LOGD("ret : 0x%x", ret);
3789 int camera_attr_get_lens_orientation(camera_h camera, int *angle)
3791 if (camera == NULL || angle == NULL) {
3792 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3793 return CAMERA_ERROR_INVALID_PARAMETER;
3795 int ret = CAMERA_ERROR_NONE;
3797 camera_cli_s *pc = (camera_cli_s *)camera;
3798 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_LENS_ORIENTATION;
3800 if (pc->cb_info == NULL) {
3801 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3802 return CAMERA_ERROR_INVALID_PARAMETER;
3804 sock_fd = pc->cb_info->fd;
3807 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3808 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3810 if (ret == CAMERA_ERROR_NONE) {
3811 muse_camera_msg_get(get_angle, pc->cb_info->recv_msg);
3814 LOGD("ret : 0x%x", ret);
3818 int camera_attr_set_theater_mode(camera_h camera, camera_attr_theater_mode_e mode)
3820 if (camera == NULL) {
3821 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3822 return CAMERA_ERROR_INVALID_PARAMETER;
3824 int ret = CAMERA_ERROR_NONE;
3825 camera_cli_s *pc = (camera_cli_s *)camera;
3826 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_THEATER_MODE;
3828 if (pc->cb_info == NULL) {
3829 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3830 return CAMERA_ERROR_INVALID_PARAMETER;
3832 sock_fd = pc->cb_info->fd;
3833 int set_mode = (int)mode;
3834 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3835 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
3836 LOGD("ret : 0x%x", ret);
3840 int camera_attr_get_theater_mode(camera_h camera, camera_attr_theater_mode_e *mode)
3842 if (camera == NULL || mode == NULL) {
3843 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3844 return CAMERA_ERROR_INVALID_PARAMETER;
3847 int ret = CAMERA_ERROR_NONE;
3848 camera_cli_s *pc = (camera_cli_s *)camera;
3849 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_THEATER_MODE;
3851 if (pc->cb_info == NULL) {
3852 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3853 return CAMERA_ERROR_INVALID_PARAMETER;
3855 sock_fd = pc->cb_info->fd;
3857 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3858 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3860 if (ret == CAMERA_ERROR_NONE) {
3861 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
3862 *mode = (camera_attr_theater_mode_e)get_mode;
3864 LOGD("ret : 0x%x", ret);
3868 int camera_attr_foreach_supported_theater_mode(camera_h camera, camera_attr_supported_theater_mode_cb foreach_cb, void *user_data)
3870 if (camera == NULL || foreach_cb == NULL) {
3871 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3872 return CAMERA_ERROR_INVALID_PARAMETER;
3874 int ret = CAMERA_ERROR_NONE;
3876 camera_cli_s *pc = (camera_cli_s *)camera;
3877 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_THEATER_MODE;
3879 LOGD("Enter, handle :%x", pc->remote_handle);
3882 if (pc->cb_info == NULL) {
3883 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3884 return CAMERA_ERROR_INVALID_PARAMETER;
3886 sock_fd = pc->cb_info->fd;
3887 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE] = foreach_cb;
3888 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE] = user_data;
3890 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3892 LOGD("Finish, return :%x", ret);
3897 int camera_attr_set_preview_fps(camera_h camera, camera_attr_fps_e fps)
3899 if (camera == NULL) {
3900 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3901 return CAMERA_ERROR_INVALID_PARAMETER;
3903 int ret = CAMERA_ERROR_NONE;
3904 camera_cli_s *pc = (camera_cli_s *)camera;
3905 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_PREVIEW_FPS;
3907 if (pc->cb_info == NULL) {
3908 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3909 return CAMERA_ERROR_INVALID_PARAMETER;
3911 sock_fd = pc->cb_info->fd;
3912 int set_fps = (int)fps;
3913 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3914 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_fps);
3915 LOGD("ret : 0x%x", ret);
3920 int camera_attr_set_image_quality(camera_h camera, int quality)
3922 if (camera == NULL) {
3923 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3924 return CAMERA_ERROR_INVALID_PARAMETER;
3926 int ret = CAMERA_ERROR_NONE;
3928 camera_cli_s *pc = (camera_cli_s *)camera;
3929 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_IMAGE_QUALITY;
3931 if (pc->cb_info == NULL) {
3932 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3933 return CAMERA_ERROR_INVALID_PARAMETER;
3935 sock_fd = pc->cb_info->fd;
3936 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3937 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, quality);
3938 LOGD("ret : 0x%x", ret);
3942 int camera_attr_get_preview_fps(camera_h camera, camera_attr_fps_e *fps)
3944 if (camera == NULL || fps == NULL) {
3945 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3946 return CAMERA_ERROR_INVALID_PARAMETER;
3948 int ret = CAMERA_ERROR_NONE;
3950 camera_cli_s *pc = (camera_cli_s *)camera;
3951 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_PREVIEW_FPS;
3954 if (pc->cb_info == NULL) {
3955 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3956 return CAMERA_ERROR_INVALID_PARAMETER;
3958 sock_fd = pc->cb_info->fd;
3960 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3961 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3963 if (ret == CAMERA_ERROR_NONE) {
3964 muse_camera_msg_get(get_fps, pc->cb_info->recv_msg);
3965 *fps = (camera_attr_fps_e)get_fps;
3967 LOGD("ret : 0x%x", ret);
3972 int camera_attr_get_image_quality(camera_h camera, int *quality)
3974 if (camera == NULL || quality == NULL) {
3975 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3976 return CAMERA_ERROR_INVALID_PARAMETER;
3978 int ret = CAMERA_ERROR_NONE;
3980 camera_cli_s *pc = (camera_cli_s *)camera;
3981 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_IMAGE_QUALITY;
3983 if (pc->cb_info == NULL) {
3984 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3985 return CAMERA_ERROR_INVALID_PARAMETER;
3987 sock_fd = pc->cb_info->fd;
3989 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3990 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3992 if (ret == CAMERA_ERROR_NONE) {
3993 muse_camera_msg_get(get_quality, pc->cb_info->recv_msg);
3994 *quality = get_quality;
3996 LOGD("ret : 0x%x", ret);
4001 int camera_attr_get_encoded_preview_bitrate(camera_h camera, int *bitrate)
4003 if (camera == NULL || bitrate == NULL) {
4004 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4005 return CAMERA_ERROR_INVALID_PARAMETER;
4008 int ret = CAMERA_ERROR_NONE;
4010 camera_cli_s *pc = (camera_cli_s *)camera;
4011 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ENCODED_PREVIEW_BITRATE;
4013 if (pc->cb_info == NULL) {
4014 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4015 return CAMERA_ERROR_INVALID_PARAMETER;
4017 sock_fd = pc->cb_info->fd;
4020 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4021 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4023 if (ret == CAMERA_ERROR_NONE) {
4024 muse_camera_msg_get(get_bitrate, pc->cb_info->recv_msg);
4025 *bitrate = get_bitrate;
4027 LOGD("ret : 0x%x", ret);
4032 int camera_attr_set_encoded_preview_bitrate(camera_h camera, int bitrate)
4034 if (camera == NULL) {
4035 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4036 return CAMERA_ERROR_INVALID_PARAMETER;
4039 int ret = CAMERA_ERROR_NONE;
4041 camera_cli_s *pc = (camera_cli_s *)camera;
4042 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ENCODED_PREVIEW_BITRATE;
4044 if (pc->cb_info == NULL) {
4045 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4046 return CAMERA_ERROR_INVALID_PARAMETER;
4048 sock_fd = pc->cb_info->fd;
4049 int set_bitrate = bitrate;
4050 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4051 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_bitrate);
4052 LOGD("ret : 0x%x", ret);
4057 int camera_attr_get_encoded_preview_gop_interval(camera_h camera, int *interval)
4059 if (camera == NULL || interval == NULL) {
4060 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4061 return CAMERA_ERROR_INVALID_PARAMETER;
4064 int ret = CAMERA_ERROR_NONE;
4066 camera_cli_s *pc = (camera_cli_s *)camera;
4067 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ENCODED_PREVIEW_GOP_INTERVAL;
4069 if (pc->cb_info == NULL) {
4070 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4071 return CAMERA_ERROR_INVALID_PARAMETER;
4073 sock_fd = pc->cb_info->fd;
4074 int get_gop_interval;
4076 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4077 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4079 if (ret == CAMERA_ERROR_NONE) {
4080 muse_camera_msg_get(get_gop_interval, pc->cb_info->recv_msg);
4081 *interval = get_gop_interval;
4083 LOGD("ret : 0x%x", ret);
4088 int camera_attr_set_encoded_preview_gop_interval(camera_h camera, int interval)
4090 if (camera == NULL) {
4091 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4092 return CAMERA_ERROR_INVALID_PARAMETER;
4095 int ret = CAMERA_ERROR_NONE;
4097 camera_cli_s *pc = (camera_cli_s *)camera;
4098 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ENCODED_PREVIEW_GOP_INTERVAL;
4100 if (pc->cb_info == NULL) {
4101 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4102 return CAMERA_ERROR_INVALID_PARAMETER;
4104 sock_fd = pc->cb_info->fd;
4105 int set_gop_interval = interval;
4106 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4107 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_gop_interval);
4108 LOGD("ret : 0x%x", ret);
4113 int camera_attr_set_zoom(camera_h camera, int zoom)
4115 if (camera == NULL) {
4116 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4117 return CAMERA_ERROR_INVALID_PARAMETER;
4119 int ret = CAMERA_ERROR_NONE;
4121 camera_cli_s *pc = (camera_cli_s *)camera;
4122 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ZOOM;
4124 if (pc->cb_info == NULL) {
4125 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4126 return CAMERA_ERROR_INVALID_PARAMETER;
4128 sock_fd = pc->cb_info->fd;
4130 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4131 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, zoom);
4132 LOGD("ret : 0x%x", ret);
4136 int camera_attr_set_af_mode(camera_h camera, camera_attr_af_mode_e mode)
4138 if (camera == NULL) {
4139 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4140 return CAMERA_ERROR_INVALID_PARAMETER;
4142 int ret = CAMERA_ERROR_NONE;
4144 camera_cli_s *pc = (camera_cli_s *)camera;
4145 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_AF_MODE;
4147 if (pc->cb_info == NULL) {
4148 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4149 return CAMERA_ERROR_INVALID_PARAMETER;
4151 sock_fd = pc->cb_info->fd;
4152 int set_mode = (int)mode;
4153 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4154 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
4155 LOGD("ret : 0x%x", ret);
4159 int camera_attr_set_af_area(camera_h camera, int x, int y)
4161 if (camera == NULL) {
4162 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4163 return CAMERA_ERROR_INVALID_PARAMETER;
4165 int ret = CAMERA_ERROR_NONE;
4166 camera_cli_s *pc = (camera_cli_s *)camera;
4167 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_AF_AREA;
4168 int sock_fd = pc->cb_info->fd;
4169 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4170 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, x, INT, y);
4171 LOGD("ret : 0x%x", ret);
4176 int camera_attr_clear_af_area(camera_h camera)
4178 if (camera == NULL) {
4179 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4180 return CAMERA_ERROR_INVALID_PARAMETER;
4182 int ret = CAMERA_ERROR_NONE;
4184 camera_cli_s *pc = (camera_cli_s *)camera;
4185 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_CLEAR_AF_AREA;
4187 if (pc->cb_info == NULL) {
4188 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4189 return CAMERA_ERROR_INVALID_PARAMETER;
4191 sock_fd = pc->cb_info->fd;
4192 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4193 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4194 LOGD("ret : 0x%x", ret);
4199 int camera_attr_set_exposure_mode(camera_h camera, camera_attr_exposure_mode_e mode)
4201 if (camera == NULL) {
4202 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4203 return CAMERA_ERROR_INVALID_PARAMETER;
4206 if (mode < CAMERA_ATTR_EXPOSURE_MODE_OFF || mode > CAMERA_ATTR_EXPOSURE_MODE_CUSTOM) {
4207 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4208 return CAMERA_ERROR_INVALID_PARAMETER;
4211 int ret = CAMERA_ERROR_NONE;
4212 camera_cli_s *pc = (camera_cli_s *)camera;
4213 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EXPOSURE_MODE;
4214 int set_mode = (int)mode;
4216 if (pc->cb_info == NULL) {
4217 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4218 return CAMERA_ERROR_INVALID_PARAMETER;
4220 sock_fd = pc->cb_info->fd;
4221 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4222 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
4223 LOGD("ret : 0x%x", ret);
4228 int camera_attr_set_exposure(camera_h camera, int value)
4230 if (camera == NULL) {
4231 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4232 return CAMERA_ERROR_INVALID_PARAMETER;
4234 int ret = CAMERA_ERROR_NONE;
4236 camera_cli_s *pc = (camera_cli_s *)camera;
4237 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EXPOSURE;
4239 if (pc->cb_info == NULL) {
4240 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4241 return CAMERA_ERROR_INVALID_PARAMETER;
4243 sock_fd = pc->cb_info->fd;
4245 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4246 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, value);
4247 LOGD("ret : 0x%x", ret);
4252 int camera_attr_set_iso(camera_h camera, camera_attr_iso_e iso)
4254 if (camera == NULL) {
4255 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4256 return CAMERA_ERROR_INVALID_PARAMETER;
4258 int ret = CAMERA_ERROR_NONE;
4260 camera_cli_s *pc = (camera_cli_s *)camera;
4261 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ISO;
4263 if (pc->cb_info == NULL) {
4264 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4265 return CAMERA_ERROR_INVALID_PARAMETER;
4267 sock_fd = pc->cb_info->fd;
4268 int set_iso = (int)iso;
4269 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4270 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_iso);
4271 LOGD("ret : 0x%x", ret);
4276 int camera_attr_set_brightness(camera_h camera, int level)
4278 if (camera == NULL) {
4279 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4280 return CAMERA_ERROR_INVALID_PARAMETER;
4282 int ret = CAMERA_ERROR_NONE;
4284 camera_cli_s *pc = (camera_cli_s *)camera;
4285 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_BRIGHTNESS;
4287 if (pc->cb_info == NULL) {
4288 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4289 return CAMERA_ERROR_INVALID_PARAMETER;
4291 sock_fd = pc->cb_info->fd;
4293 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4294 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, level);
4295 LOGD("ret : 0x%x", ret);
4300 int camera_attr_set_contrast(camera_h camera, int level)
4302 if (camera == NULL) {
4303 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4304 return CAMERA_ERROR_INVALID_PARAMETER;
4306 int ret = CAMERA_ERROR_NONE;
4308 camera_cli_s *pc = (camera_cli_s *)camera;
4309 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_CONTRAST;
4311 if (pc->cb_info == NULL) {
4312 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4313 return CAMERA_ERROR_INVALID_PARAMETER;
4315 sock_fd = pc->cb_info->fd;
4317 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4318 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, level);
4319 LOGD("ret : 0x%x", ret);
4324 int camera_attr_set_whitebalance(camera_h camera, camera_attr_whitebalance_e wb)
4326 if (camera == NULL) {
4327 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4328 return CAMERA_ERROR_INVALID_PARAMETER;
4331 if (wb < CAMERA_ATTR_WHITE_BALANCE_NONE || wb > CAMERA_ATTR_WHITE_BALANCE_CUSTOM) {
4332 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_NOT_SUPPORTED);
4333 return CAMERA_ERROR_NOT_SUPPORTED;
4336 int ret = CAMERA_ERROR_NONE;
4338 camera_cli_s *pc = (camera_cli_s *)camera;
4339 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_WHITEBALANCE;
4341 if (pc->cb_info == NULL) {
4342 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4343 return CAMERA_ERROR_INVALID_PARAMETER;
4345 sock_fd = pc->cb_info->fd;
4346 int set_whitebalance = (int)wb;
4347 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4348 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_whitebalance);
4349 LOGD("ret : 0x%x", ret);
4354 int camera_attr_set_effect(camera_h camera, camera_attr_effect_mode_e effect)
4356 if (camera == NULL) {
4357 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4358 return CAMERA_ERROR_INVALID_PARAMETER;
4360 int ret = CAMERA_ERROR_NONE;
4362 camera_cli_s *pc = (camera_cli_s *)camera;
4363 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EFFECT;
4365 if (pc->cb_info == NULL) {
4366 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4367 return CAMERA_ERROR_INVALID_PARAMETER;
4369 sock_fd = pc->cb_info->fd;
4370 int set_effect = (int)effect;
4371 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4372 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_effect);
4373 LOGD("ret : 0x%x", ret);
4378 int camera_attr_set_scene_mode(camera_h camera, camera_attr_scene_mode_e mode)
4380 if (camera == NULL) {
4381 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4382 return CAMERA_ERROR_INVALID_PARAMETER;
4384 int ret = CAMERA_ERROR_NONE;
4386 camera_cli_s *pc = (camera_cli_s *)camera;
4387 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_SCENE_MODE;
4389 if (pc->cb_info == NULL) {
4390 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4391 return CAMERA_ERROR_INVALID_PARAMETER;
4393 sock_fd = pc->cb_info->fd;
4394 int set_mode = (int)mode;
4395 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4396 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
4397 LOGD("ret : 0x%x", ret);
4402 int camera_attr_enable_tag(camera_h camera, bool enable)
4404 if (camera == NULL) {
4405 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4406 return CAMERA_ERROR_INVALID_PARAMETER;
4408 int ret = CAMERA_ERROR_NONE;
4409 camera_cli_s *pc = (camera_cli_s *)camera;
4410 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_TAG;
4412 if (pc->cb_info == NULL) {
4413 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4414 return CAMERA_ERROR_INVALID_PARAMETER;
4416 sock_fd = pc->cb_info->fd;
4417 int set_enable = (int)enable;
4419 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4420 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
4421 LOGD("ret : 0x%x", ret);
4426 int camera_attr_set_tag_image_description(camera_h camera, const char *description)
4428 if (camera == NULL) {
4429 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4430 return CAMERA_ERROR_INVALID_PARAMETER;
4432 if (description == NULL) {
4433 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4434 return CAMERA_ERROR_INVALID_PARAMETER;
4436 int ret = CAMERA_ERROR_NONE;
4437 camera_cli_s *pc = (camera_cli_s *)camera;
4438 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_IMAGE_DESCRIPTION;
4440 if (pc->cb_info == NULL) {
4441 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4442 return CAMERA_ERROR_INVALID_PARAMETER;
4444 sock_fd = pc->cb_info->fd;
4445 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4446 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, STRING, description);
4447 LOGD("ret : 0x%x", ret);
4452 int camera_attr_set_tag_orientation(camera_h camera, camera_attr_tag_orientation_e orientation)
4454 if (camera == NULL) {
4455 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4456 return CAMERA_ERROR_INVALID_PARAMETER;
4458 int ret = CAMERA_ERROR_NONE;
4459 camera_cli_s *pc = (camera_cli_s *)camera;
4460 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_ORIENTATION;
4462 if (pc->cb_info == NULL) {
4463 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4464 return CAMERA_ERROR_INVALID_PARAMETER;
4466 sock_fd = pc->cb_info->fd;
4467 int set_orientation = (int)orientation;
4469 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4470 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_orientation);
4471 LOGD("ret : 0x%x", ret);
4476 int camera_attr_set_tag_software(camera_h camera, const char *software)
4478 if (camera == NULL) {
4479 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4480 return CAMERA_ERROR_INVALID_PARAMETER;
4482 if (software == NULL) {
4483 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4484 return CAMERA_ERROR_INVALID_PARAMETER;
4486 int ret = CAMERA_ERROR_NONE;
4487 camera_cli_s *pc = (camera_cli_s *)camera;
4488 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_SOFTWARE;
4490 if (pc->cb_info == NULL) {
4491 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4492 return CAMERA_ERROR_INVALID_PARAMETER;
4494 sock_fd = pc->cb_info->fd;
4495 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4496 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, STRING, software);
4497 LOGD("ret : 0x%x", ret);
4502 int camera_attr_set_geotag(camera_h camera, double latitude , double longitude, double altitude)
4504 if (camera == NULL) {
4505 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4506 return CAMERA_ERROR_INVALID_PARAMETER;
4508 int ret = CAMERA_ERROR_NONE;
4509 camera_cli_s *pc = (camera_cli_s *)camera;
4510 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_GEOTAG;
4512 if (pc->cb_info == NULL) {
4513 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4514 return CAMERA_ERROR_INVALID_PARAMETER;
4516 sock_fd = pc->cb_info->fd;
4517 double set_geotag[3] = { latitude, longitude, altitude };
4519 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4520 muse_camera_msg_send_array(api, sock_fd, pc->cb_info, ret,
4521 set_geotag, sizeof(set_geotag), sizeof(double));
4522 LOGD("ret : 0x%x", ret);
4527 int camera_attr_remove_geotag(camera_h camera)
4529 if (camera == NULL) {
4530 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4531 return CAMERA_ERROR_INVALID_PARAMETER;
4533 int ret = CAMERA_ERROR_NONE;
4534 camera_cli_s *pc = (camera_cli_s *)camera;
4535 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_REMOVE_GEOTAG;
4537 if (pc->cb_info == NULL) {
4538 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4539 return CAMERA_ERROR_INVALID_PARAMETER;
4541 sock_fd = pc->cb_info->fd;
4542 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4543 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4544 LOGD("ret : 0x%x", ret);
4549 int camera_attr_set_flash_mode(camera_h camera, camera_attr_flash_mode_e mode)
4551 if (camera == NULL) {
4552 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4553 return CAMERA_ERROR_INVALID_PARAMETER;
4555 int ret = CAMERA_ERROR_NONE;
4556 camera_cli_s *pc = (camera_cli_s *)camera;
4557 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_FLASH_MODE;
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;
4564 int set_mode = (int)mode;
4566 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4567 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
4568 LOGD("ret : 0x%x", ret);
4573 int camera_attr_get_zoom(camera_h camera, int *zoom)
4575 if (camera == NULL || zoom == NULL) {
4576 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4577 return CAMERA_ERROR_INVALID_PARAMETER;
4579 int ret = CAMERA_ERROR_NONE;
4581 camera_cli_s *pc = (camera_cli_s *)camera;
4582 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ZOOM;
4585 if (pc->cb_info == NULL) {
4586 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4587 return CAMERA_ERROR_INVALID_PARAMETER;
4589 sock_fd = pc->cb_info->fd;
4591 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4592 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4594 if (ret == CAMERA_ERROR_NONE) {
4595 muse_camera_msg_get(get_zoom, pc->cb_info->recv_msg);
4598 LOGD("ret : 0x%x", ret);
4603 int camera_attr_get_zoom_range(camera_h camera, int *min, int *max)
4605 if (camera == NULL || min == NULL || max == NULL) {
4606 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4607 return CAMERA_ERROR_INVALID_PARAMETER;
4609 int ret = CAMERA_ERROR_NONE;
4610 camera_cli_s *pc = (camera_cli_s *)camera;
4612 if (pc->cb_info == NULL) {
4613 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4614 return CAMERA_ERROR_INVALID_PARAMETER;
4616 sock_fd = pc->cb_info->fd;
4617 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ZOOM_RANGE;
4621 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4622 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4624 if (ret == CAMERA_ERROR_NONE) {
4625 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
4626 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
4630 LOGD("ret : 0x%x", ret);
4635 int camera_attr_get_af_mode(camera_h camera, camera_attr_af_mode_e *mode)
4637 if (camera == NULL || mode == NULL) {
4638 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4639 return CAMERA_ERROR_INVALID_PARAMETER;
4641 int ret = CAMERA_ERROR_NONE;
4642 camera_cli_s *pc = (camera_cli_s *)camera;
4644 if (pc->cb_info == NULL) {
4645 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4646 return CAMERA_ERROR_INVALID_PARAMETER;
4648 sock_fd = pc->cb_info->fd;
4649 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_AF_MODE;
4652 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4653 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4655 if (ret == CAMERA_ERROR_NONE) {
4656 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
4657 *mode = (camera_attr_af_mode_e)get_mode;
4659 LOGD("ret : 0x%x", ret);
4664 int camera_attr_get_exposure_mode(camera_h camera, camera_attr_exposure_mode_e *mode)
4666 if (camera == NULL || mode == NULL) {
4667 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4668 return CAMERA_ERROR_INVALID_PARAMETER;
4670 int ret = CAMERA_ERROR_NONE;
4671 camera_cli_s *pc = (camera_cli_s *)camera;
4673 if (pc->cb_info == NULL) {
4674 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4675 return CAMERA_ERROR_INVALID_PARAMETER;
4677 sock_fd = pc->cb_info->fd;
4678 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE_MODE;
4681 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4682 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4684 if (ret == CAMERA_ERROR_NONE) {
4685 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
4686 *mode = (camera_attr_exposure_mode_e)get_mode;
4688 LOGD("ret : 0x%x", ret);
4692 int camera_attr_get_exposure(camera_h camera, int *value)
4694 if (camera == NULL || value == NULL) {
4695 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4696 return CAMERA_ERROR_INVALID_PARAMETER;
4698 int ret = CAMERA_ERROR_NONE;
4699 camera_cli_s *pc = (camera_cli_s *)camera;
4701 if (pc->cb_info == NULL) {
4702 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4703 return CAMERA_ERROR_INVALID_PARAMETER;
4705 sock_fd = pc->cb_info->fd;
4706 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE;
4709 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4710 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4712 if (ret == CAMERA_ERROR_NONE) {
4713 muse_camera_msg_get(get_value, pc->cb_info->recv_msg);
4716 LOGD("ret : 0x%x", ret);
4721 int camera_attr_get_exposure_range(camera_h camera, int *min, int *max)
4723 if (camera == NULL || min == NULL || max == NULL) {
4724 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4725 return CAMERA_ERROR_INVALID_PARAMETER;
4727 int ret = CAMERA_ERROR_NONE;
4728 camera_cli_s *pc = (camera_cli_s *)camera;
4730 if (pc->cb_info == NULL) {
4731 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4732 return CAMERA_ERROR_INVALID_PARAMETER;
4734 sock_fd = pc->cb_info->fd;
4735 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE_RANGE;
4739 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4740 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4742 if (ret == CAMERA_ERROR_NONE) {
4743 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
4744 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
4748 LOGD("ret : 0x%x", ret);
4753 int camera_attr_get_iso(camera_h camera, camera_attr_iso_e *iso)
4755 if (camera == NULL || iso == NULL) {
4756 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4757 return CAMERA_ERROR_INVALID_PARAMETER;
4759 int ret = CAMERA_ERROR_NONE;
4760 camera_cli_s *pc = (camera_cli_s *)camera;
4762 if (pc->cb_info == NULL) {
4763 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4764 return CAMERA_ERROR_INVALID_PARAMETER;
4766 sock_fd = pc->cb_info->fd;
4767 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ISO;
4770 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4771 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4773 if (ret == CAMERA_ERROR_NONE) {
4774 muse_camera_msg_get(get_iso, pc->cb_info->recv_msg);
4775 *iso = (camera_attr_iso_e)get_iso;
4777 LOGD("ret : 0x%x", ret);
4782 int camera_attr_get_brightness(camera_h camera, int *level)
4784 if (camera == NULL || level == NULL) {
4785 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4786 return CAMERA_ERROR_INVALID_PARAMETER;
4788 int ret = CAMERA_ERROR_NONE;
4789 camera_cli_s *pc = (camera_cli_s *)camera;
4791 if (pc->cb_info == NULL) {
4792 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4793 return CAMERA_ERROR_INVALID_PARAMETER;
4795 sock_fd = pc->cb_info->fd;
4796 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_BRIGHTNESS;
4799 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4800 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4802 if (ret == CAMERA_ERROR_NONE) {
4803 muse_camera_msg_get(get_level, pc->cb_info->recv_msg);
4806 LOGD("ret : 0x%x", ret);
4811 int camera_attr_get_brightness_range(camera_h camera, int *min, int *max)
4813 if (camera == NULL || min == NULL || max == NULL) {
4814 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4815 return CAMERA_ERROR_INVALID_PARAMETER;
4817 int ret = CAMERA_ERROR_NONE;
4818 camera_cli_s *pc = (camera_cli_s *)camera;
4820 if (pc->cb_info == NULL) {
4821 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4822 return CAMERA_ERROR_INVALID_PARAMETER;
4824 sock_fd = pc->cb_info->fd;
4825 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_BRIGHTNESS_RANGE;
4829 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4830 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4832 if (ret == CAMERA_ERROR_NONE) {
4833 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
4834 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
4838 LOGD("ret : 0x%x", ret);
4843 int camera_attr_get_contrast(camera_h camera, int *level)
4845 if (camera == NULL || level == NULL) {
4846 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4847 return CAMERA_ERROR_INVALID_PARAMETER;
4849 int ret = CAMERA_ERROR_NONE;
4850 camera_cli_s *pc = (camera_cli_s *)camera;
4851 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_CONTRAST;
4853 if (pc->cb_info == NULL) {
4854 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4855 return CAMERA_ERROR_INVALID_PARAMETER;
4857 sock_fd = pc->cb_info->fd;
4860 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4861 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4863 if (ret == CAMERA_ERROR_NONE) {
4864 muse_camera_msg_get(get_level, pc->cb_info->recv_msg);
4867 LOGD("ret : 0x%x", ret);
4872 int camera_attr_get_contrast_range(camera_h camera, int *min , int *max)
4874 if (camera == NULL || min == NULL || max == NULL) {
4875 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4876 return CAMERA_ERROR_INVALID_PARAMETER;
4878 int ret = CAMERA_ERROR_NONE;
4879 camera_cli_s *pc = (camera_cli_s *)camera;
4880 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_CONTRAST_RANGE;
4882 if (pc->cb_info == NULL) {
4883 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4884 return CAMERA_ERROR_INVALID_PARAMETER;
4886 sock_fd = pc->cb_info->fd;
4890 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4891 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4893 if (ret == CAMERA_ERROR_NONE) {
4894 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
4895 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
4899 LOGD("ret : 0x%x", ret);
4904 int camera_attr_get_whitebalance(camera_h camera, camera_attr_whitebalance_e *wb)
4906 if (camera == NULL || wb == NULL) {
4907 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4908 return CAMERA_ERROR_INVALID_PARAMETER;
4910 int ret = CAMERA_ERROR_NONE;
4911 camera_cli_s *pc = (camera_cli_s *)camera;
4912 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_WHITEBALANCE;
4914 if (pc->cb_info == NULL) {
4915 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4916 return CAMERA_ERROR_INVALID_PARAMETER;
4918 sock_fd = pc->cb_info->fd;
4921 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4922 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4924 if (ret == CAMERA_ERROR_NONE) {
4925 muse_camera_msg_get(get_wb, pc->cb_info->recv_msg);
4926 *wb = (camera_attr_whitebalance_e)get_wb;
4928 LOGD("ret : 0x%x", ret);
4933 int camera_attr_get_effect(camera_h camera, camera_attr_effect_mode_e *effect)
4935 if (camera == NULL || effect == NULL) {
4936 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4937 return CAMERA_ERROR_INVALID_PARAMETER;
4940 int ret = CAMERA_ERROR_NONE;
4941 camera_cli_s *pc = (camera_cli_s *)camera;
4942 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EFFECT;
4944 if (pc->cb_info == NULL) {
4945 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4946 return CAMERA_ERROR_INVALID_PARAMETER;
4948 sock_fd = pc->cb_info->fd;
4951 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4952 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4954 if (ret == CAMERA_ERROR_NONE) {
4955 muse_camera_msg_get(get_effect, pc->cb_info->recv_msg);
4956 *effect = (camera_attr_effect_mode_e)get_effect;
4958 LOGD("ret : 0x%x", ret);
4963 int camera_attr_get_scene_mode(camera_h camera, camera_attr_scene_mode_e *mode)
4965 if (camera == NULL || mode == NULL) {
4966 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4967 return CAMERA_ERROR_INVALID_PARAMETER;
4970 int ret = CAMERA_ERROR_NONE;
4971 camera_cli_s *pc = (camera_cli_s *)camera;
4972 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_SCENE_MODE;
4974 if (pc->cb_info == NULL) {
4975 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4976 return CAMERA_ERROR_INVALID_PARAMETER;
4978 sock_fd = pc->cb_info->fd;
4981 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4982 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4984 if (ret == CAMERA_ERROR_NONE) {
4985 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
4986 *mode = (camera_attr_scene_mode_e)get_mode;
4988 LOGD("ret : 0x%x", ret);
4993 int camera_attr_is_enabled_tag(camera_h camera, bool *enable)
4995 if (camera == NULL || enable == NULL) {
4996 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4997 return CAMERA_ERROR_INVALID_PARAMETER;
5000 int ret = CAMERA_ERROR_NONE;
5001 camera_cli_s *pc = (camera_cli_s *)camera;
5002 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_TAG;
5004 if (pc->cb_info == NULL) {
5005 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5006 return CAMERA_ERROR_INVALID_PARAMETER;
5008 sock_fd = pc->cb_info->fd;
5011 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5012 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5014 if (ret == CAMERA_ERROR_NONE) {
5015 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
5016 *enable = (bool)get_enabled;
5018 LOGD("ret : 0x%x", ret);
5023 int camera_attr_get_tag_image_description(camera_h camera, char **description)
5025 if (camera == NULL || description == NULL) {
5026 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5027 return CAMERA_ERROR_INVALID_PARAMETER;
5030 int ret = CAMERA_ERROR_NONE;
5031 camera_cli_s *pc = (camera_cli_s *)camera;
5032 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_IMAGE_DESCRIPTION;
5034 if (pc->cb_info == NULL) {
5035 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5036 return CAMERA_ERROR_INVALID_PARAMETER;
5038 sock_fd = pc->cb_info->fd;
5039 char get_description[MUSE_CAMERA_MSG_MAX_LENGTH] = {0,};
5041 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5042 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5044 if (ret == CAMERA_ERROR_NONE) {
5045 muse_camera_msg_get_string(get_description, pc->cb_info->recv_msg);
5046 *description = strdup(get_description);
5048 LOGD("ret : 0x%x", ret);
5053 int camera_attr_get_tag_orientation(camera_h camera, camera_attr_tag_orientation_e *orientation)
5055 if (camera == NULL || orientation == NULL) {
5056 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5057 return CAMERA_ERROR_INVALID_PARAMETER;
5060 int ret = CAMERA_ERROR_NONE;
5061 camera_cli_s *pc = (camera_cli_s *)camera;
5062 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_ORIENTATION;
5064 if (pc->cb_info == NULL) {
5065 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5066 return CAMERA_ERROR_INVALID_PARAMETER;
5068 sock_fd = pc->cb_info->fd;
5069 int get_orientation;
5071 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5072 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5074 if (ret == CAMERA_ERROR_NONE) {
5075 muse_camera_msg_get(get_orientation, pc->cb_info->recv_msg);
5076 *orientation = (camera_attr_tag_orientation_e)get_orientation;
5077 LOGD("success, orientation : %d", *orientation);
5079 LOGD("ret : 0x%x", ret);
5084 int camera_attr_get_tag_software(camera_h camera, char **software)
5086 if (camera == NULL || software == NULL) {
5087 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5088 return CAMERA_ERROR_INVALID_PARAMETER;
5091 int ret = CAMERA_ERROR_NONE;
5092 camera_cli_s *pc = (camera_cli_s *)camera;
5093 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_SOFTWARE;
5095 if (pc->cb_info == NULL) {
5096 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5097 return CAMERA_ERROR_INVALID_PARAMETER;
5099 sock_fd = pc->cb_info->fd;
5100 char get_software[MUSE_CAMERA_MSG_MAX_LENGTH] = {0,};
5102 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5103 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5105 if (ret == CAMERA_ERROR_NONE) {
5106 muse_camera_msg_get_string(get_software, pc->cb_info->recv_msg);
5107 *software = strdup(get_software);
5109 LOGD("ret : 0x%x", ret);
5114 int camera_attr_get_geotag(camera_h camera, double *latitude , double *longitude, double *altitude)
5116 if (camera == NULL || latitude == NULL || longitude == NULL || altitude == NULL) {
5117 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5118 return CAMERA_ERROR_INVALID_PARAMETER;
5121 int ret = CAMERA_ERROR_NONE;
5122 camera_cli_s *pc = (camera_cli_s *)camera;
5123 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_GEOTAG;
5124 double get_geotag[3] = {0,};
5126 if (pc->cb_info == NULL) {
5127 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5128 return CAMERA_ERROR_INVALID_PARAMETER;
5130 sock_fd = pc->cb_info->fd;
5132 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5134 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5136 if (ret == CAMERA_ERROR_NONE) {
5137 muse_camera_msg_get_array(get_geotag, pc->cb_info->recv_msg);
5138 *latitude = get_geotag[0];
5139 *longitude = get_geotag[1];
5140 *altitude = get_geotag[2];
5142 LOGD("ret : 0x%x", ret);
5144 LOGE("Returned value is not valid : 0x%x", ret);
5151 int camera_attr_get_flash_mode(camera_h camera, camera_attr_flash_mode_e *mode)
5153 if (camera == NULL || mode == NULL) {
5154 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5155 return CAMERA_ERROR_INVALID_PARAMETER;
5158 int ret = CAMERA_ERROR_NONE;
5159 camera_cli_s *pc = (camera_cli_s *)camera;
5160 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_FLASH_MODE;
5162 if (pc->cb_info == NULL) {
5163 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5164 return CAMERA_ERROR_INVALID_PARAMETER;
5166 sock_fd = pc->cb_info->fd;
5169 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5170 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5172 if (ret == CAMERA_ERROR_NONE) {
5173 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
5174 *mode = (camera_attr_flash_mode_e)get_mode;
5176 LOGD("ret : 0x%x", ret);
5180 int camera_get_flash_state(camera_device_e device, camera_flash_state_e *state)
5184 int ret = CAMERA_ERROR_NONE;
5185 camera_cli_s *pc = NULL;
5186 int get_flash_state = 0;
5188 /* create muse connection */
5189 muse_camera_api_e api = MUSE_CAMERA_API_GET_FLASH_STATE;
5190 muse_core_api_module_e muse_module = MUSE_CAMERA;
5191 int device_type = (int)device;
5193 sock_fd = muse_core_client_new();
5195 LOGE("muse_core_client_new failed - returned fd %d", sock_fd);
5196 ret = CAMERA_ERROR_INVALID_OPERATION;
5200 sndMsg = muse_core_msg_json_factory_new(api,
5201 MUSE_TYPE_INT, "module", muse_module,
5202 MUSE_TYPE_INT, PARAM_DEVICE_TYPE, device_type,
5205 muse_core_ipc_send_msg(sock_fd, sndMsg);
5206 muse_core_msg_json_factory_free(sndMsg);
5208 pc = g_new0(camera_cli_s, 1);
5210 LOGE("camera_cli_s alloc failed");
5211 ret = CAMERA_ERROR_OUT_OF_MEMORY;
5215 pc->cb_info = _client_callback_new(sock_fd);
5216 if (pc->cb_info == NULL) {
5217 LOGE("cb_info alloc failed");
5218 ret = CAMERA_ERROR_OUT_OF_MEMORY;
5222 ret = _client_wait_for_cb_return(api, pc->cb_info, CALLBACK_TIME_OUT);
5224 if (ret == CAMERA_ERROR_NONE) {
5225 muse_camera_msg_get(get_flash_state, pc->cb_info->recv_msg);
5226 *state = (camera_flash_state_e)get_flash_state;
5229 LOGD("Flash state : %d\n", *state);
5232 /* release resources */
5234 g_atomic_int_set(&pc->cb_info->msg_recv_running, 0);
5235 g_atomic_int_set(&pc->cb_info->msg_handler_running, 0);
5236 _client_callback_destroy(pc->cb_info);
5245 int camera_attr_foreach_supported_af_mode(camera_h camera, camera_attr_supported_af_mode_cb foreach_cb, void *user_data)
5247 if (camera == NULL || foreach_cb == NULL) {
5248 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5249 return CAMERA_ERROR_INVALID_PARAMETER;
5251 int ret = CAMERA_ERROR_NONE;
5253 camera_cli_s *pc = (camera_cli_s *)camera;
5254 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_AF_MODE;
5256 LOGD("Enter, handle :%x", pc->remote_handle);
5259 if (pc->cb_info == NULL) {
5260 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5261 return CAMERA_ERROR_INVALID_PARAMETER;
5263 sock_fd = pc->cb_info->fd;
5264 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_AF_MODE] = foreach_cb;
5265 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_AF_MODE] = user_data;
5267 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5268 LOGD("ret : 0x%x", ret);
5273 int camera_attr_foreach_supported_exposure_mode(camera_h camera, camera_attr_supported_exposure_mode_cb foreach_cb , void *user_data)
5275 if (camera == NULL || foreach_cb == NULL) {
5276 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5277 return CAMERA_ERROR_INVALID_PARAMETER;
5279 int ret = CAMERA_ERROR_NONE;
5281 camera_cli_s *pc = (camera_cli_s *)camera;
5282 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_EXPOSURE_MODE;
5284 LOGD("Enter, handle :%x", pc->remote_handle);
5287 if (pc->cb_info == NULL) {
5288 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5289 return CAMERA_ERROR_INVALID_PARAMETER;
5291 sock_fd = pc->cb_info->fd;
5292 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EXPOSURE_MODE] = foreach_cb;
5293 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EXPOSURE_MODE] = user_data;
5295 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5296 LOGD("ret : 0x%x", ret);
5301 int camera_attr_foreach_supported_iso(camera_h camera, camera_attr_supported_iso_cb foreach_cb, void *user_data)
5303 if (camera == NULL || foreach_cb == NULL) {
5304 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5305 return CAMERA_ERROR_INVALID_PARAMETER;
5307 int ret = CAMERA_ERROR_NONE;
5309 camera_cli_s *pc = (camera_cli_s *)camera;
5310 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_ISO;
5312 LOGD("Enter, handle :%x", pc->remote_handle);
5315 if (pc->cb_info == NULL) {
5316 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5317 return CAMERA_ERROR_INVALID_PARAMETER;
5319 sock_fd = pc->cb_info->fd;
5320 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_ISO] = foreach_cb;
5321 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_ISO] = user_data;
5323 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5324 LOGD("ret : 0x%x", ret);
5329 int camera_attr_foreach_supported_whitebalance(camera_h camera, camera_attr_supported_whitebalance_cb foreach_cb , void *user_data)
5331 if (camera == NULL || foreach_cb == NULL) {
5332 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5333 return CAMERA_ERROR_INVALID_PARAMETER;
5335 int ret = CAMERA_ERROR_NONE;
5337 camera_cli_s *pc = (camera_cli_s *)camera;
5338 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_WHITEBALANCE;
5340 LOGD("Enter, handle :%x", pc->remote_handle);
5343 if (pc->cb_info == NULL) {
5344 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5345 return CAMERA_ERROR_INVALID_PARAMETER;
5347 sock_fd = pc->cb_info->fd;
5348 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_WHITEBALANCE] = foreach_cb;
5349 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_WHITEBALANCE] = user_data;
5351 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5352 LOGD("ret : 0x%x", ret);
5357 int camera_attr_foreach_supported_effect(camera_h camera, camera_attr_supported_effect_cb foreach_cb , void *user_data)
5359 if (camera == NULL || foreach_cb == NULL) {
5360 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5361 return CAMERA_ERROR_INVALID_PARAMETER;
5363 int ret = CAMERA_ERROR_NONE;
5365 camera_cli_s *pc = (camera_cli_s *)camera;
5366 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_EFFECT;
5368 LOGD("Enter, handle :%x", pc->remote_handle);
5371 if (pc->cb_info == NULL) {
5372 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5373 return CAMERA_ERROR_INVALID_PARAMETER;
5375 sock_fd = pc->cb_info->fd;
5376 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EFFECT] = foreach_cb;
5377 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EFFECT] = user_data;
5379 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5380 LOGD("ret : 0x%x", ret);
5385 int camera_attr_foreach_supported_scene_mode(camera_h camera, camera_attr_supported_scene_mode_cb foreach_cb , void *user_data)
5387 if (camera == NULL || foreach_cb == NULL) {
5388 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5389 return CAMERA_ERROR_INVALID_PARAMETER;
5391 int ret = CAMERA_ERROR_NONE;
5393 camera_cli_s *pc = (camera_cli_s *)camera;
5394 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_SCENE_MODE;
5396 LOGD("Enter, handle :%x", pc->remote_handle);
5399 if (pc->cb_info == NULL) {
5400 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5401 return CAMERA_ERROR_INVALID_PARAMETER;
5403 sock_fd = pc->cb_info->fd;
5404 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_SCENE_MODE] = foreach_cb;
5405 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_SCENE_MODE] = user_data;
5407 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5408 LOGD("ret : 0x%x", ret);
5413 int camera_attr_foreach_supported_flash_mode(camera_h camera, camera_attr_supported_flash_mode_cb foreach_cb , void *user_data)
5415 if (camera == NULL || foreach_cb == NULL) {
5416 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5417 return CAMERA_ERROR_INVALID_PARAMETER;
5419 int ret = CAMERA_ERROR_NONE;
5421 camera_cli_s *pc = (camera_cli_s *)camera;
5422 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FLASH_MODE;
5424 LOGD("Enter, handle :%x", pc->remote_handle);
5427 if (pc->cb_info == NULL) {
5428 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5429 return CAMERA_ERROR_INVALID_PARAMETER;
5431 sock_fd = pc->cb_info->fd;
5432 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FLASH_MODE] = foreach_cb;
5433 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FLASH_MODE] = user_data;
5435 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5436 LOGD("ret : 0x%x", ret);
5441 int camera_attr_foreach_supported_fps(camera_h camera, camera_attr_supported_fps_cb foreach_cb , void *user_data)
5443 if (camera == NULL || foreach_cb == NULL) {
5444 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5445 return CAMERA_ERROR_INVALID_PARAMETER;
5447 int ret = CAMERA_ERROR_NONE;
5449 camera_cli_s *pc = (camera_cli_s *)camera;
5450 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FPS;
5452 if (pc->cb_info == NULL) {
5453 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5454 return CAMERA_ERROR_INVALID_PARAMETER;
5456 sock_fd = pc->cb_info->fd;
5457 LOGD("Enter, handle :%x", pc->remote_handle);
5458 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS] = foreach_cb;
5459 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS] = user_data;
5461 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5462 LOGD("Enter, handle :%x", pc->remote_handle);
5466 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)
5468 if (camera == NULL || foreach_cb == NULL) {
5469 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5470 return CAMERA_ERROR_INVALID_PARAMETER;
5472 int ret = CAMERA_ERROR_NONE;
5474 camera_cli_s *pc = (camera_cli_s *)camera;
5475 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FPS_BY_RESOLUTION;
5477 if (pc->cb_info == NULL) {
5478 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5479 return CAMERA_ERROR_INVALID_PARAMETER;
5481 sock_fd = pc->cb_info->fd;
5482 LOGD("Enter, handle :%x", pc->remote_handle);
5483 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS_BY_RESOLUTION] = foreach_cb;
5484 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS_BY_RESOLUTION] = user_data;
5486 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, width, INT, height);
5487 LOGD("ret : 0x%x", ret);
5491 int camera_attr_foreach_supported_stream_flip(camera_h camera, camera_attr_supported_stream_flip_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_FLIP;
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_FLIP] = foreach_cb;
5509 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_FLIP] = user_data;
5511 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5512 LOGD("ret : 0x%x", ret);
5517 int camera_attr_foreach_supported_stream_rotation(camera_h camera, camera_attr_supported_stream_rotation_cb foreach_cb, void *user_data)
5519 if (camera == NULL || foreach_cb == NULL) {
5520 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5521 return CAMERA_ERROR_INVALID_PARAMETER;
5523 int ret = CAMERA_ERROR_NONE;
5525 camera_cli_s *pc = (camera_cli_s *)camera;
5526 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_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 LOGD("Enter, handle :%x", pc->remote_handle);
5534 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION] = foreach_cb;
5535 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION] = user_data;
5537 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5538 LOGD("ret : 0x%x", ret);
5543 int camera_attr_set_stream_rotation(camera_h camera , camera_rotation_e rotation)
5545 if (camera == NULL) {
5546 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5547 return CAMERA_ERROR_INVALID_PARAMETER;
5550 int ret = CAMERA_ERROR_NONE;
5551 camera_cli_s *pc = (camera_cli_s *)camera;
5552 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_STREAM_ROTATION;
5554 if (pc->cb_info == NULL) {
5555 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5556 return CAMERA_ERROR_INVALID_PARAMETER;
5558 sock_fd = pc->cb_info->fd;
5559 int set_rotation = (int)rotation;
5561 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5562 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_rotation);
5563 LOGD("ret : 0x%x", ret);
5568 int camera_attr_get_stream_rotation(camera_h camera , camera_rotation_e *rotation)
5570 if (camera == NULL || rotation == NULL) {
5571 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5572 return CAMERA_ERROR_INVALID_PARAMETER;
5575 int ret = CAMERA_ERROR_NONE;
5576 camera_cli_s *pc = (camera_cli_s *)camera;
5577 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_STREAM_ROTATION;
5579 if (pc->cb_info == NULL) {
5580 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5581 return CAMERA_ERROR_INVALID_PARAMETER;
5583 sock_fd = pc->cb_info->fd;
5586 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5587 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5589 if (ret == CAMERA_ERROR_NONE) {
5590 muse_camera_msg_get(get_rotation, pc->cb_info->recv_msg);
5591 *rotation = (camera_rotation_e)get_rotation;
5593 LOGD("ret : 0x%x", ret);
5598 int camera_attr_set_stream_flip(camera_h camera , camera_flip_e flip)
5600 if (camera == NULL) {
5601 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5602 return CAMERA_ERROR_INVALID_PARAMETER;
5605 int ret = CAMERA_ERROR_NONE;
5606 camera_cli_s *pc = (camera_cli_s *)camera;
5607 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_STREAM_FLIP;
5609 if (pc->cb_info == NULL) {
5610 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5611 return CAMERA_ERROR_INVALID_PARAMETER;
5613 sock_fd = pc->cb_info->fd;
5614 int set_flip = (int)flip;
5616 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5617 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_flip);
5618 LOGD("ret : 0x%x", ret);
5623 int camera_attr_get_stream_flip(camera_h camera , camera_flip_e *flip)
5625 if (camera == NULL || flip == NULL) {
5626 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5627 return CAMERA_ERROR_INVALID_PARAMETER;
5630 int ret = CAMERA_ERROR_NONE;
5631 camera_cli_s *pc = (camera_cli_s *)camera;
5632 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_STREAM_FLIP;
5634 if (pc->cb_info == NULL) {
5635 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5636 return CAMERA_ERROR_INVALID_PARAMETER;
5638 sock_fd = pc->cb_info->fd;
5641 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5642 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5644 if (ret == CAMERA_ERROR_NONE) {
5645 muse_camera_msg_get(get_flip, pc->cb_info->recv_msg);
5646 *flip = (camera_flip_e)get_flip;
5648 LOGD("ret : 0x%x", ret);
5652 int camera_attr_set_hdr_mode(camera_h camera, camera_attr_hdr_mode_e mode)
5654 if (camera == NULL) {
5655 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5656 return CAMERA_ERROR_INVALID_PARAMETER;
5659 int ret = CAMERA_ERROR_NONE;
5660 camera_cli_s *pc = (camera_cli_s *)camera;
5661 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_HDR_MODE;
5663 if (pc->cb_info == NULL) {
5664 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5665 return CAMERA_ERROR_INVALID_PARAMETER;
5667 sock_fd = pc->cb_info->fd;
5668 int set_mode = (int)mode;
5670 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5671 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
5672 LOGD("ret : 0x%x", ret);
5677 int camera_attr_get_hdr_mode(camera_h camera, camera_attr_hdr_mode_e *mode)
5679 if (camera == NULL) {
5680 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5681 return CAMERA_ERROR_INVALID_PARAMETER;
5684 LOGE("CAMERA_ERROR_NOT_SUPPORTED(0x%08x) - mode", CAMERA_ERROR_NOT_SUPPORTED);
5685 return CAMERA_ERROR_NOT_SUPPORTED;
5687 int ret = CAMERA_ERROR_NONE;
5688 camera_cli_s *pc = (camera_cli_s *)camera;
5689 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_HDR_MODE;
5691 if (pc->cb_info == NULL) {
5692 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5693 return CAMERA_ERROR_INVALID_PARAMETER;
5695 sock_fd = pc->cb_info->fd;
5698 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5699 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5701 if (ret == CAMERA_ERROR_NONE) {
5702 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
5703 *mode = (camera_attr_hdr_mode_e)get_mode;
5705 LOGD("ret : 0x%x", ret);
5710 bool camera_attr_is_supported_hdr_capture(camera_h camera)
5712 if (camera == NULL) {
5713 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5717 int ret = CAMERA_ERROR_NONE;
5718 camera_cli_s *pc = (camera_cli_s *)camera;
5719 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_HDR_CAPTURE;
5721 if (pc->cb_info == NULL) {
5722 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5723 return CAMERA_ERROR_INVALID_PARAMETER;
5725 sock_fd = pc->cb_info->fd;
5726 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5727 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5728 LOGD("ret : 0x%x", ret);
5733 int camera_attr_set_hdr_capture_progress_cb(camera_h camera, camera_attr_hdr_progress_cb callback, void *user_data)
5735 if (camera == NULL) {
5736 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5737 return CAMERA_ERROR_INVALID_PARAMETER;
5739 if (callback == NULL) {
5740 LOGE("CAMERA_ERROR_NOT_SUPPORTED(0x%08x) - callback", CAMERA_ERROR_NOT_SUPPORTED);
5741 return CAMERA_ERROR_NOT_SUPPORTED;
5743 int ret = CAMERA_ERROR_NONE;
5745 camera_cli_s *pc = (camera_cli_s *)camera;
5746 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_HDR_CAPTURE_PROGRESS_CB;
5748 if (pc->cb_info == NULL) {
5749 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5750 return CAMERA_ERROR_INVALID_PARAMETER;
5752 sock_fd = pc->cb_info->fd;
5753 LOGD("Enter, handle :%x", pc->remote_handle);
5755 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = callback;
5756 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = user_data;
5758 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5759 LOGD("ret : 0x%x", ret);
5764 int camera_attr_unset_hdr_capture_progress_cb(camera_h camera)
5766 if (camera == NULL) {
5767 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5768 return CAMERA_ERROR_INVALID_PARAMETER;
5771 int ret = CAMERA_ERROR_NONE;
5773 camera_cli_s *pc = (camera_cli_s *)camera;
5774 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_UNSET_HDR_CAPTURE_PROGRESS_CB;
5776 if (pc->cb_info == NULL) {
5777 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5778 return CAMERA_ERROR_INVALID_PARAMETER;
5780 sock_fd = pc->cb_info->fd;
5781 LOGD("Enter, handle :%x", pc->remote_handle);
5783 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = (void *)NULL;
5784 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = (void *)NULL;
5786 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5787 LOGD("ret : 0x%x", ret);
5792 int camera_attr_enable_anti_shake(camera_h camera, bool enable)
5794 if (camera == NULL) {
5795 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5796 return CAMERA_ERROR_INVALID_PARAMETER;
5799 int ret = CAMERA_ERROR_NONE;
5800 camera_cli_s *pc = (camera_cli_s *)camera;
5801 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_ANTI_SHAKE;
5803 if (pc->cb_info == NULL) {
5804 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5805 return CAMERA_ERROR_INVALID_PARAMETER;
5807 sock_fd = pc->cb_info->fd;
5808 int set_enable = (int)enable;
5810 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5811 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
5812 LOGD("ret : 0x%x", ret);
5817 int camera_attr_is_enabled_anti_shake(camera_h camera , bool *enabled)
5819 if (camera == NULL) {
5820 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5821 return CAMERA_ERROR_INVALID_PARAMETER;
5823 if (enabled == NULL) {
5824 LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER);
5825 return CAMERA_ERROR_NOT_SUPPORTED;
5827 int ret = CAMERA_ERROR_NONE;
5828 camera_cli_s *pc = (camera_cli_s *)camera;
5829 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_ANTI_SHAKE;
5831 if (pc->cb_info == NULL) {
5832 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5833 return CAMERA_ERROR_INVALID_PARAMETER;
5835 sock_fd = pc->cb_info->fd;
5838 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5839 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5841 if (ret == CAMERA_ERROR_NONE) {
5842 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
5843 *enabled = (bool)get_enabled;
5845 LOGD("ret : 0x%x", ret);
5850 bool camera_attr_is_supported_anti_shake(camera_h camera)
5853 if (camera == NULL) {
5854 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5858 int ret = CAMERA_ERROR_NONE;
5859 camera_cli_s *pc = (camera_cli_s *)camera;
5860 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_ANTI_SHAKE;
5862 if (pc->cb_info == NULL) {
5863 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5864 return CAMERA_ERROR_INVALID_PARAMETER;
5866 sock_fd = pc->cb_info->fd;
5867 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5868 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5869 LOGD("ret : 0x%x", ret);
5874 int camera_attr_enable_video_stabilization(camera_h camera, bool enable)
5876 if (camera == NULL) {
5877 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5878 return CAMERA_ERROR_INVALID_PARAMETER;
5881 int ret = CAMERA_ERROR_NONE;
5882 camera_cli_s *pc = (camera_cli_s *)camera;
5883 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_VIDEO_STABILIZATION;
5885 if (pc->cb_info == NULL) {
5886 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5887 return CAMERA_ERROR_INVALID_PARAMETER;
5889 sock_fd = pc->cb_info->fd;
5890 int set_enable = (int)enable;
5892 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5893 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
5894 LOGD("ret : 0x%x", ret);
5899 int camera_attr_is_enabled_video_stabilization(camera_h camera, bool *enabled)
5901 if (camera == NULL) {
5902 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5903 return CAMERA_ERROR_INVALID_PARAMETER;
5905 if (enabled == NULL) {
5906 LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER);
5907 return CAMERA_ERROR_NOT_SUPPORTED;
5909 int ret = CAMERA_ERROR_NONE;
5910 camera_cli_s *pc = (camera_cli_s *)camera;
5911 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_VIDEO_STABILIZATION;
5913 if (pc->cb_info == NULL) {
5914 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5915 return CAMERA_ERROR_INVALID_PARAMETER;
5917 sock_fd = pc->cb_info->fd;
5920 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5921 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5923 if (ret == CAMERA_ERROR_NONE) {
5924 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
5925 *enabled = (bool)get_enabled;
5927 LOGD("ret : 0x%x", ret);
5932 bool camera_attr_is_supported_video_stabilization(camera_h camera)
5934 if (camera == NULL) {
5935 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5939 int ret = CAMERA_ERROR_NONE;
5940 camera_cli_s *pc = (camera_cli_s *)camera;
5941 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_VIDEO_STABILIZATION;
5943 if (pc->cb_info == NULL) {
5944 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5945 return CAMERA_ERROR_INVALID_PARAMETER;
5947 sock_fd = pc->cb_info->fd;
5948 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5949 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5950 LOGD("ret : 0x%x", ret);
5955 int camera_attr_enable_auto_contrast(camera_h camera, bool enable)
5957 if (camera == NULL) {
5958 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5959 return CAMERA_ERROR_INVALID_PARAMETER;
5962 int ret = CAMERA_ERROR_NONE;
5963 camera_cli_s *pc = (camera_cli_s *)camera;
5964 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_AUTO_CONTRAST;
5966 if (pc->cb_info == NULL) {
5967 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5968 return CAMERA_ERROR_INVALID_PARAMETER;
5970 sock_fd = pc->cb_info->fd;
5971 int set_enable = (int)enable;
5973 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5974 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
5975 LOGD("ret : 0x%x", ret);
5980 int camera_attr_is_enabled_auto_contrast(camera_h camera, bool *enabled)
5982 if (camera == NULL) {
5983 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5984 return CAMERA_ERROR_INVALID_PARAMETER;
5986 if (enabled == NULL) {
5987 LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER);
5988 return CAMERA_ERROR_INVALID_PARAMETER;
5990 int ret = CAMERA_ERROR_NONE;
5991 camera_cli_s *pc = (camera_cli_s *)camera;
5992 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_AUTO_CONTRAST;
5994 if (pc->cb_info == NULL) {
5995 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5996 return CAMERA_ERROR_INVALID_PARAMETER;
5998 sock_fd = pc->cb_info->fd;
6001 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6002 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6004 if (ret == CAMERA_ERROR_NONE) {
6005 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
6006 *enabled = (bool)get_enabled;
6008 LOGD("ret : 0x%x", ret);
6013 bool camera_attr_is_supported_auto_contrast(camera_h camera)
6015 if (camera == NULL) {
6016 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6020 int ret = CAMERA_ERROR_NONE;
6021 camera_cli_s *pc = (camera_cli_s *)camera;
6022 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_AUTO_CONTRAST;
6024 if (pc->cb_info == NULL) {
6025 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6026 return CAMERA_ERROR_INVALID_PARAMETER;
6028 sock_fd = pc->cb_info->fd;
6029 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6030 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6031 LOGD("ret : 0x%x", ret);
6036 int camera_attr_disable_shutter_sound(camera_h camera, bool disable)
6038 if (camera == NULL) {
6039 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6040 return CAMERA_ERROR_INVALID_PARAMETER;
6043 int ret = CAMERA_ERROR_NONE;
6044 camera_cli_s *pc = (camera_cli_s *)camera;
6045 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_DISABLE_SHUTTER_SOUND;
6047 if (pc->cb_info == NULL) {
6048 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6049 return CAMERA_ERROR_INVALID_PARAMETER;
6051 sock_fd = pc->cb_info->fd;
6052 int set_disable = (int)disable;
6054 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6055 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_disable);
6056 LOGD("ret : 0x%x", ret);