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);
745 if (mp_data->ref_cnt > 1) {
747 LOGD("Media packet is still referenced by %d client", mp_data->ref_cnt);
749 int tbm_key = mp_data->tbm_key;
751 /* release imported bo */
752 for (i = 0 ; i < mp_data->num_buffer_key ; i++) {
753 tbm_bo_unref(mp_data->buffer_bo[i]);
754 mp_data->buffer_bo[i] = NULL;
757 /* unmap and unref tbm bo */
758 _release_imported_bo(&mp_data->bo);
761 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
762 cb_info->fd, cb_info, INT, tbm_key);
767 g_mutex_unlock(&cb_info->mp_data_mutex);
769 ret = media_packet_get_tbm_surface(pkt, &tsurf);
770 if (ret != MEDIA_PACKET_ERROR_NONE) {
771 LOGE("media_packet_get_tbm_surface failed 0x%x", ret);
772 return MEDIA_PACKET_FINALIZE;
776 tbm_surface_destroy(tsurf);
780 return MEDIA_PACKET_FINALIZE;
783 static void _client_user_callback(camera_cb_info_s *cb_info, char *recv_msg, muse_camera_event_e event)
789 tbm_bo_handle bo_handle = {NULL, };
791 if (recv_msg == NULL || event >= MUSE_CAMERA_EVENT_TYPE_NUM) {
792 LOGE("invalid parameter - camera msg %p, event %d", recv_msg, event);
796 LOGD("get camera msg %s, event %d", recv_msg, event);
798 if (event == MUSE_CAMERA_EVENT_TYPE_PREVIEW) {
799 if (!(CHECK_PREVIEW_CB(cb_info, PREVIEW_CB_TYPE_EVAS)) &&
800 cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW] == NULL &&
801 cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] == NULL) {
802 LOGW("all preview callback from user are NULL");
805 } else if (cb_info->user_cb[event] == NULL) {
806 LOGW("user callback for event %d is not set", event);
811 case MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE:
817 muse_camera_msg_get(previous, recv_msg);
818 muse_camera_msg_get(current, recv_msg);
819 muse_camera_msg_get(by_policy, recv_msg);
821 LOGD("STATE CHANGE - previous %d, current %d, by_policy %d",
822 previous, current, by_policy);
824 ((camera_state_changed_cb)cb_info->user_cb[event])((camera_state_e)previous,
825 (camera_state_e)current, (bool)by_policy, cb_info->user_data[event]);
828 case MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE:
832 muse_camera_msg_get(state, recv_msg);
834 LOGD("FOCUS state - %d", state);
836 ((camera_focus_changed_cb)cb_info->user_cb[event])((camera_focus_state_e)state, cb_info->user_data[event]);
839 case MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE:
840 LOGD("CAPTURE_COMPLETED");
841 ((camera_capture_completed_cb)cb_info->user_cb[event])(cb_info->user_data[event]);
843 case MUSE_CAMERA_EVENT_TYPE_PREVIEW:
844 case MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW:
846 unsigned char *buf_pos = NULL;
847 camera_stream_data_s *stream = NULL;
850 int num_buffer_key = 0;
851 int buffer_key[BUFFER_MAX_PLANE_NUM] = {0, };
852 tbm_bo buffer_bo[BUFFER_MAX_PLANE_NUM] = {NULL, };
853 tbm_bo_handle buffer_bo_handle[BUFFER_MAX_PLANE_NUM] = {{.ptr = NULL}, };
854 camera_preview_data_s frame;
855 media_packet_h pkt = NULL;
856 camera_media_packet_data *mp_data = NULL;
858 muse_camera_msg_get(tbm_key, recv_msg);
859 muse_camera_msg_get(num_buffer_key, recv_msg);
860 muse_camera_msg_get_array(buffer_key, recv_msg);
862 memset(&frame, 0x0, sizeof(camera_preview_data_s));
865 LOGE("invalid key %d", tbm_key);
869 /* import tbm bo and get virtual address */
870 if (!_import_tbm_key(cb_info->bufmgr, tbm_key, &bo, &bo_handle)) {
871 LOGE("failed to import key %d", tbm_key);
873 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
874 cb_info->fd, cb_info, INT, tbm_key);
878 buf_pos = (unsigned char *)bo_handle.ptr;
880 /* get stream info */
881 stream = (camera_stream_data_s *)buf_pos;
883 for (i = 0 ; i < num_buffer_key ; i++) {
884 /* import buffer bo and get virtual address */
885 if (!_import_tbm_key(cb_info->bufmgr, buffer_key[i], &buffer_bo[i], &buffer_bo_handle[i])) {
886 LOGE("failed to import buffer key %d", buffer_key[i]);
888 /* release imported bo */
889 for (i -= 1 ; i >= 0 ; i--)
890 _release_imported_bo(&buffer_bo[i]);
892 _release_imported_bo(&bo);
894 /* send return buffer */
895 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
896 cb_info->fd, cb_info, INT, tbm_key);
901 /* call preview callback */
902 if (cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW]) {
903 _camera_preview_frame_create(stream, num_buffer_key, buffer_bo_handle, &frame);
905 int e_type = MUSE_CAMERA_EVENT_TYPE_PREVIEW;
906 ((camera_preview_cb)cb_info->user_cb[e_type])(&frame, cb_info->user_data[e_type]);
909 /* call media packet callback */
910 if (cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW]) {
911 ret = _camera_media_packet_data_create(tbm_key, num_buffer_key, bo, buffer_bo, &mp_data);
913 if (ret == CAMERA_ERROR_NONE) {
914 ret = _camera_media_packet_create(cb_info, stream, mp_data, &pkt);
916 int e_type = MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW;
917 if (ret == CAMERA_ERROR_NONE) {
918 ((camera_media_packet_preview_cb)cb_info->user_cb[e_type])(pkt, cb_info->user_data[e_type]);
926 /* call evas renderer */
927 if (CHECK_PREVIEW_CB(cb_info, PREVIEW_CB_TYPE_EVAS)) {
928 ret = _camera_media_packet_data_create(tbm_key, num_buffer_key, bo, buffer_bo, &mp_data);
930 if (ret == CAMERA_ERROR_NONE) {
931 ret = _camera_media_packet_create(cb_info, stream, mp_data, &pkt);
933 if (ret == CAMERA_ERROR_NONE) {
934 mm_evas_renderer_write(pkt, cb_info->evas_info);
942 /* send message for preview callback return */
943 if (!CHECK_PREVIEW_CB(cb_info, PREVIEW_CB_TYPE_EVAS))
944 muse_camera_msg_send_no_return(MUSE_CAMERA_API_PREVIEW_CB_RETURN, cb_info->fd, cb_info);
946 if (mp_data == NULL) {
947 /* release imported bo */
948 for (i = 0 ; i < num_buffer_key ; i++)
949 _release_imported_bo(&buffer_bo[i]);
951 /* unmap and unref tbm bo */
952 _release_imported_bo(&bo);
955 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
956 cb_info->fd, cb_info, INT, tbm_key);
958 /*LOGD("return buffer Done");*/
962 case MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS:
966 muse_camera_msg_get(percent, recv_msg);
968 LOGD("HDR progress - %d \%", percent);
970 ((camera_attr_hdr_progress_cb)cb_info->user_cb[event])(percent, cb_info->user_data[event]);
973 case MUSE_CAMERA_EVENT_TYPE_INTERRUPTED:
979 muse_camera_msg_get(policy, recv_msg);
980 muse_camera_msg_get(previous, recv_msg);
981 muse_camera_msg_get(current, recv_msg);
983 LOGD("INTERRUPTED - policy %d, state previous %d, current %d",
984 policy, previous, current);
986 ((camera_interrupted_cb)cb_info->user_cb[event])((camera_policy_e)policy,
987 (camera_state_e)previous, (camera_state_e)current, cb_info->user_data[event]);
990 case MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION:
993 camera_detected_face_s *faces = NULL;
995 muse_camera_msg_get(count, recv_msg);
996 muse_camera_msg_get(tbm_key, recv_msg);
998 if (count > 0 && tbm_key > 0) {
999 LOGD("FACE_DETECTION - count %d, tbm_key %d", count, tbm_key);
1001 if (!_import_tbm_key(cb_info->bufmgr, tbm_key, &bo, &bo_handle))
1005 faces = bo_handle.ptr;
1007 ((camera_face_detected_cb)cb_info->user_cb[event])(faces, count, cb_info->user_data[event]);
1013 for (i = 0 ; i < count ; i++) {
1014 LOGD("id[%2d] - score %d, position (%d,%d,%dx%d)",
1015 i, faces[i].score, faces[i].x, faces[i].y, faces[i].width, faces[i].height);
1021 _release_imported_bo(&bo);
1024 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
1025 cb_info->fd, cb_info, INT, tbm_key);
1027 LOGD("return buffer done");
1029 LOGE("invalid message - count %d, key %d", count, tbm_key);
1033 case MUSE_CAMERA_EVENT_TYPE_ERROR:
1036 int current_state = 0;
1038 muse_camera_msg_get(error, recv_msg);
1039 muse_camera_msg_get(current_state, recv_msg);
1041 LOGE("ERROR - error 0x%x, current_state %d", error, current_state);
1043 ((camera_error_cb)cb_info->user_cb[event])((camera_error_e)error,
1044 (camera_state_e)current_state, cb_info->user_data[event]);
1047 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_RESOLUTION:
1048 muse_camera_msg_get(param1, recv_msg);
1049 muse_camera_msg_get(param2, recv_msg);
1051 LOGD("SUPPORTED_PREVIEW_RESOLUTION - %d x %d", param1, param2);
1053 if (((camera_supported_preview_resolution_cb)cb_info->user_cb[event])(param1, param2, cb_info->user_data[event]) == false) {
1054 cb_info->user_cb[event] = NULL;
1055 cb_info->user_data[event] = NULL;
1056 LOGD("stop foreach callback for SUPPORTED_PREVIEW_RESOLUTION");
1059 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_RESOLUTION:
1060 muse_camera_msg_get(param1, recv_msg);
1061 muse_camera_msg_get(param2, recv_msg);
1063 LOGD("SUPPORTED_CAPTURE_RESOLUTION - %d x %d", param1, param2);
1065 if (((camera_supported_capture_resolution_cb)cb_info->user_cb[event])(param1, param2, cb_info->user_data[event]) == false) {
1066 cb_info->user_cb[event] = NULL;
1067 cb_info->user_data[event] = NULL;
1068 LOGD("stop foreach callback for SUPPORTED_CAPTURE_RESOLUTION");
1071 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_FORMAT:
1072 muse_camera_msg_get(param1, recv_msg);
1074 LOGD("SUPPORTED_CAPTURE_FORMAT - %d ", param1);
1076 if (((camera_supported_capture_format_cb)cb_info->user_cb[event])((camera_pixel_format_e)param1, cb_info->user_data[event]) == false) {
1077 cb_info->user_cb[event] = NULL;
1078 cb_info->user_data[event] = NULL;
1079 LOGD("stop foreach callback for SUPPORTED_CAPTURE_FORMAT");
1082 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_FORMAT:
1083 muse_camera_msg_get(param1, recv_msg);
1085 LOGD("SUPPORTED_PREVIEW_FORMAT - %d ", param1);
1087 if (((camera_supported_preview_format_cb)cb_info->user_cb[event])((camera_pixel_format_e)param1, cb_info->user_data[event]) == false) {
1088 cb_info->user_cb[event] = NULL;
1089 cb_info->user_data[event] = NULL;
1090 LOGD("stop foreach callback for SUPPORTED_PREVIEW_FORMAT");
1093 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_AF_MODE:
1094 muse_camera_msg_get(param1, recv_msg);
1096 LOGD("SUPPORTED_AF_MODE - %d ", param1);
1098 if (((camera_attr_supported_af_mode_cb)cb_info->user_cb[event])((camera_attr_af_mode_e)param1, cb_info->user_data[event]) == false) {
1099 cb_info->user_cb[event] = NULL;
1100 cb_info->user_data[event] = NULL;
1101 LOGD("stop foreach callback for SUPPORTED_AF_MODE");
1104 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EXPOSURE_MODE:
1105 muse_camera_msg_get(param1, recv_msg);
1107 LOGD("SUPPORTED_EXPOSURE_MODE - %d ", param1);
1109 if (((camera_attr_supported_exposure_mode_cb)cb_info->user_cb[event])((camera_attr_exposure_mode_e)param1, cb_info->user_data[event]) == false) {
1110 cb_info->user_cb[event] = NULL;
1111 cb_info->user_data[event] = NULL;
1112 LOGD("stop foreach callback for SUPPORTED_EXPOSURE_MODE");
1115 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_ISO:
1116 muse_camera_msg_get(param1, recv_msg);
1118 LOGD("SUPPORTED_ISO - %d ", param1);
1120 if (((camera_attr_supported_iso_cb)cb_info->user_cb[event])((camera_attr_iso_e)param1, cb_info->user_data[event]) == false) {
1121 cb_info->user_cb[event] = NULL;
1122 cb_info->user_data[event] = NULL;
1123 LOGD("stop foreach callback for SUPPORTED_ISO");
1126 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_WHITEBALANCE:
1127 muse_camera_msg_get(param1, recv_msg);
1129 LOGD("SUPPORTED_WHITEBALANCE - %d ", param1);
1131 if (((camera_attr_supported_whitebalance_cb)cb_info->user_cb[event])((camera_attr_whitebalance_e)param1, cb_info->user_data[event]) == false) {
1132 cb_info->user_cb[event] = NULL;
1133 cb_info->user_data[event] = NULL;
1134 LOGD("stop foreach callback for SUPPORTED_WHITEBALANCE");
1137 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EFFECT:
1138 muse_camera_msg_get(param1, recv_msg);
1140 LOGD("SUPPORTED_EFFECT - %d ", param1);
1142 if (((camera_attr_supported_effect_cb)cb_info->user_cb[event])((camera_attr_effect_mode_e)param1, cb_info->user_data[event]) == false) {
1143 cb_info->user_cb[event] = NULL;
1144 cb_info->user_data[event] = NULL;
1145 LOGD("stop foreach callback for SUPPORTED_EFFECT");
1148 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_SCENE_MODE:
1149 muse_camera_msg_get(param1, recv_msg);
1151 LOGD("SUPPORTED_SCENE_MODE - %d ", param1);
1153 if (((camera_attr_supported_scene_mode_cb)cb_info->user_cb[event])((camera_attr_scene_mode_e)param1, cb_info->user_data[event]) == false) {
1154 cb_info->user_cb[event] = NULL;
1155 cb_info->user_data[event] = NULL;
1156 LOGD("stop foreach callback for SUPPORTED_SCENE_MODE");
1159 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FLASH_MODE:
1160 muse_camera_msg_get(param1, recv_msg);
1162 LOGD("SUPPORTED_FLASH_MODE - %d ", param1);
1164 if (((camera_attr_supported_flash_mode_cb)cb_info->user_cb[event])((camera_attr_flash_mode_e)param1, cb_info->user_data[event]) == false) {
1165 cb_info->user_cb[event] = NULL;
1166 cb_info->user_data[event] = NULL;
1167 LOGD("stop foreach callback for SUPPORTED_FLASH_MODE");
1170 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS:
1171 muse_camera_msg_get(param1, recv_msg);
1173 LOGD("SUPPORTED_FPS - %d ", param1);
1175 if (((camera_attr_supported_fps_cb)cb_info->user_cb[event])((camera_attr_fps_e)param1, cb_info->user_data[event]) == false) {
1176 cb_info->user_cb[event] = NULL;
1177 cb_info->user_data[event] = NULL;
1178 LOGD("stop foreach callback for SUPPORTED_FPS");
1181 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS_BY_RESOLUTION:
1182 muse_camera_msg_get(param1, recv_msg);
1184 LOGD("SUPPORTED_FPS_BY_RESOLUTION - %d ", param1);
1186 if (((camera_attr_supported_fps_cb)cb_info->user_cb[event])((camera_attr_fps_e)param1, cb_info->user_data[event]) == false) {
1187 cb_info->user_cb[event] = NULL;
1188 cb_info->user_data[event] = NULL;
1189 LOGD("stop foreach callback for SUPPORTED_FPS_BY_RESOLUTION");
1192 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_FLIP:
1193 muse_camera_msg_get(param1, recv_msg);
1195 LOGD("SUPPORTED_STREAM_FLIP - %d ", param1);
1197 if (((camera_attr_supported_stream_flip_cb)cb_info->user_cb[event])((camera_flip_e)param1, cb_info->user_data[event]) == false) {
1198 cb_info->user_cb[event] = NULL;
1199 cb_info->user_data[event] = NULL;
1200 LOGD("stop foreach callback for SUPPORTED_STREAM_FLIP");
1203 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION:
1204 muse_camera_msg_get(param1, recv_msg);
1206 LOGD("SUPPORTED_STREAM_ROTATION - %d ", param1);
1208 if (((camera_attr_supported_stream_rotation_cb)cb_info->user_cb[event])((camera_rotation_e)param1, cb_info->user_data[event]) == false) {
1209 cb_info->user_cb[event] = NULL;
1210 cb_info->user_data[event] = NULL;
1211 LOGD("stop foreach callback for SUPPORTED_STREAM_ROTATION");
1214 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE:
1215 muse_camera_msg_get(param1, recv_msg);
1217 LOGD("SUPPORTED_THEATER_MODE - %d ", param1);
1219 if (((camera_attr_supported_theater_mode_cb)cb_info->user_cb[event])((camera_attr_theater_mode_e)param1, cb_info->user_data[event]) == false) {
1220 cb_info->user_cb[event] = NULL;
1221 cb_info->user_data[event] = NULL;
1222 LOGD("stop foreach callback for SUPPORTED_THEATER_MODE");
1225 case MUSE_CAMERA_EVENT_TYPE_CAPTURE:
1227 camera_image_data_s *rImage = NULL;
1228 camera_image_data_s *rPostview = NULL;
1229 camera_image_data_s *rThumbnail = NULL;
1230 unsigned char *buf_pos = NULL;
1231 int tbm_key_main = 0;
1232 int tbm_key_post = 0;
1233 int tbm_key_thumb = 0;
1234 tbm_bo bo_main = NULL;
1235 tbm_bo bo_post = NULL;
1236 tbm_bo bo_thumb = NULL;
1237 tbm_bo_handle bo_main_handle = {NULL, };
1238 tbm_bo_handle bo_post_handle = {NULL, };
1239 tbm_bo_handle bo_thumb_handle = {NULL, };
1241 muse_camera_msg_get(tbm_key_main, recv_msg);
1242 muse_camera_msg_get(tbm_key_post, recv_msg);
1243 muse_camera_msg_get(tbm_key_thumb, recv_msg);
1245 LOGD("camera capture callback came in. tbm_key_main %d, tbm_key_post %d, tbm_key_thumb %d",
1246 tbm_key_main, tbm_key_post, tbm_key_thumb);
1248 if (tbm_key_main <= 0) {
1249 LOGE("invalid tbm_key_main %d", tbm_key_main);
1253 /* import tbm bo and get virtual address */
1254 if (!_import_tbm_key(cb_info->bufmgr, tbm_key_main, &bo_main, &bo_main_handle))
1257 buf_pos = (unsigned char *)bo_main_handle.ptr;
1258 rImage = (camera_image_data_s *)buf_pos;
1259 rImage->data = buf_pos + sizeof(camera_image_data_s);
1261 LOGD("image info %dx%d, size : %d", rImage->height, rImage->width, rImage->size);
1263 if (tbm_key_post > 0) {
1264 /* import tbm bo and get virtual address */
1265 if (!_import_tbm_key(cb_info->bufmgr, tbm_key_post, &bo_post, &bo_post_handle))
1268 buf_pos = (unsigned char *)bo_post_handle.ptr;
1269 rPostview = (camera_image_data_s *)buf_pos;
1270 LOGD("rPostview->size : %d", rPostview->size);
1271 rPostview->data = buf_pos + sizeof(camera_image_data_s);
1274 if (tbm_key_thumb > 0) {
1275 /* import tbm bo and get virtual address */
1276 if (!_import_tbm_key(cb_info->bufmgr, tbm_key_thumb, &bo_thumb, &bo_thumb_handle))
1279 buf_pos = (unsigned char *)bo_thumb_handle.ptr;
1281 rThumbnail = (camera_image_data_s *)buf_pos;
1282 LOGD("rThumbnail->size : %d", rThumbnail->size);
1283 rThumbnail->data = buf_pos + sizeof(camera_image_data_s);
1286 ((camera_capturing_cb)cb_info->user_cb[event])(rImage, rPostview, rThumbnail, cb_info->user_data[event]);
1288 /* unmap and unref tbm bo */
1289 _release_imported_bo(&bo_main);
1292 tbm_key = tbm_key_main;
1293 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
1294 cb_info->fd, cb_info, INT, tbm_key);
1296 if (tbm_key_post > 0) {
1297 /* unmap and unref tbm bo */
1298 _release_imported_bo(&bo_post);
1301 tbm_key = tbm_key_post;
1302 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
1303 cb_info->fd, cb_info, INT, tbm_key);
1306 if (tbm_key_thumb > 0) {
1307 /* unmap and unref tbm bo */
1308 _release_imported_bo(&bo_thumb);
1311 tbm_key = tbm_key_thumb;
1312 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
1313 cb_info->fd, cb_info, INT, tbm_key);
1316 LOGD("return buffer done");
1319 case MUSE_CAMERA_EVENT_TYPE_VIDEO_FRAME_RENDER_ERROR:
1322 LOGW("Unknown event : %d", event);
1329 static bool _camera_idle_event_callback(void *data)
1331 camera_cb_info_s *cb_info = NULL;
1332 camera_idle_event_s *cam_idle_event = (camera_idle_event_s *)data;
1334 if (cam_idle_event == NULL) {
1335 LOGE("cam_idle_event is NULL");
1340 g_mutex_lock(&cam_idle_event->event_mutex);
1342 cb_info = cam_idle_event->cb_info;
1343 if (cb_info == NULL) {
1344 LOGW("camera cb_info is NULL. event %d", cam_idle_event->event);
1345 goto IDLE_EVENT_CALLBACK_DONE;
1348 /* remove event from list */
1349 g_mutex_lock(&cb_info->idle_event_mutex);
1350 if (cb_info->idle_event_list)
1351 cb_info->idle_event_list = g_list_remove(cb_info->idle_event_list, (gpointer)cam_idle_event);
1353 /*LOGD("remove camera idle event %p, %p", cam_idle_event, cb_info->idle_event_list);*/
1354 g_mutex_unlock(&cb_info->idle_event_mutex);
1357 _client_user_callback(cam_idle_event->cb_info, cam_idle_event->recv_msg, cam_idle_event->event);
1359 /* send signal for waiting thread */
1360 g_cond_signal(&cb_info->idle_event_cond);
1362 IDLE_EVENT_CALLBACK_DONE:
1363 /* unlock and release event */
1364 g_mutex_unlock(&cam_idle_event->event_mutex);
1365 g_mutex_clear(&cam_idle_event->event_mutex);
1367 g_free(cam_idle_event);
1368 cam_idle_event = NULL;
1373 static void *_camera_msg_handler_func(gpointer data)
1378 int event_class = 0;
1379 camera_message_s *cam_msg = NULL;
1380 camera_idle_event_s *cam_idle_event = NULL;
1381 camera_cb_info_s *cb_info = (camera_cb_info_s *)data;
1383 if (cb_info == NULL) {
1384 LOGE("cb_info NULL");
1390 g_mutex_lock(&cb_info->msg_handler_mutex);
1392 while (g_atomic_int_get(&cb_info->msg_handler_running)) {
1393 if (g_queue_is_empty(cb_info->msg_queue)) {
1394 LOGD("signal wait...");
1395 g_cond_wait(&cb_info->msg_handler_cond, &cb_info->msg_handler_mutex);
1396 LOGD("signal received");
1398 if (g_atomic_int_get(&cb_info->msg_handler_running) == 0) {
1399 LOGD("stop event thread");
1404 cam_msg = (camera_message_s *)g_queue_pop_head(cb_info->msg_queue);
1406 g_mutex_unlock(&cb_info->msg_handler_mutex);
1408 if (cam_msg == NULL) {
1409 LOGE("NULL message");
1410 g_mutex_lock(&cb_info->msg_handler_mutex);
1416 if (api < MUSE_CAMERA_API_MAX) {
1417 g_mutex_lock(&cb_info->api_mutex[api]);
1419 if (muse_camera_msg_get(ret, cam_msg->recv_msg)) {
1420 cb_info->api_ret[api] = ret;
1421 cb_info->api_activating[api] = 1;
1423 LOGD("camera api %d - return 0x%x", ret);
1425 g_cond_signal(&cb_info->api_cond[api]);
1427 LOGE("failed to get camera ret for api %d, msg %s", api, cam_msg->recv_msg);
1430 g_mutex_unlock(&cb_info->api_mutex[api]);
1431 } else if (api == MUSE_CAMERA_CB_EVENT) {
1435 if (!muse_camera_msg_get(event, cam_msg->recv_msg) ||
1436 !muse_camera_msg_get(event_class, cam_msg->recv_msg)) {
1437 LOGE("failed to get camera event %d, class %d", event, event_class);
1442 g_mutex_lock(&cb_info->msg_handler_mutex);
1446 switch (event_class) {
1447 case MUSE_CAMERA_EVENT_CLASS_THREAD_SUB:
1448 _client_user_callback(cb_info, cam_msg->recv_msg, event);
1450 case MUSE_CAMERA_EVENT_CLASS_THREAD_MAIN:
1451 cam_idle_event = g_new0(camera_idle_event_s, 1);
1452 if (cam_idle_event == NULL) {
1453 LOGE("cam_idle_event alloc failed");
1457 cam_idle_event->event = event;
1458 cam_idle_event->cb_info = cb_info;
1459 g_mutex_init(&cam_idle_event->event_mutex);
1460 memcpy(cam_idle_event->recv_msg, cam_msg->recv_msg, sizeof(cam_idle_event->recv_msg));
1462 LOGD("add camera event[%d, %p] to IDLE", event, cam_idle_event);
1464 g_mutex_lock(&cb_info->idle_event_mutex);
1465 cb_info->idle_event_list = g_list_append(cb_info->idle_event_list, (gpointer)cam_idle_event);
1466 g_mutex_unlock(&cb_info->idle_event_mutex);
1468 g_idle_add_full(G_PRIORITY_DEFAULT,
1469 (GSourceFunc)_camera_idle_event_callback,
1470 (gpointer)cam_idle_event,
1474 LOGE("unknown camera event class %d", event_class);
1478 LOGE("unknown camera api[%d] message[%s]", api, cam_msg->recv_msg);
1484 g_mutex_lock(&cb_info->msg_handler_mutex);
1487 /* remove remained event */
1488 while (!g_queue_is_empty(cb_info->msg_queue)) {
1489 cam_msg = (camera_message_s *)g_queue_pop_head(cb_info->msg_queue);
1491 LOGD("remove camera message %p", cam_msg);
1495 LOGW("NULL camera message");
1499 g_mutex_unlock(&cb_info->msg_handler_mutex);
1506 static void _camera_remove_idle_event_all(camera_cb_info_s *cb_info)
1508 camera_idle_event_s *cam_idle_event = NULL;
1509 gboolean ret = TRUE;
1511 gint64 end_time = 0;
1513 if (cb_info == NULL) {
1514 LOGE("cb_info is NULL");
1518 g_mutex_lock(&cb_info->idle_event_mutex);
1520 if (cb_info->idle_event_list == NULL) {
1521 LOGD("No idle event is remained.");
1523 list = cb_info->idle_event_list;
1526 cam_idle_event = list->data;
1527 list = g_list_next(list);
1529 if (!cam_idle_event) {
1530 LOGW("Fail to remove idle event. The event is NULL");
1532 if (g_mutex_trylock(&cam_idle_event->event_mutex)) {
1533 ret = g_idle_remove_by_data(cam_idle_event);
1535 LOGD("remove idle event [%p], ret[%d]", cam_idle_event, ret);
1538 cam_idle_event->cb_info = NULL;
1539 LOGW("idle callback for event %p will be called later", cam_idle_event);
1542 cb_info->idle_event_list = g_list_remove(cb_info->idle_event_list, (gpointer)cam_idle_event);
1544 g_mutex_unlock(&cam_idle_event->event_mutex);
1547 g_mutex_clear(&cam_idle_event->event_mutex);
1549 g_free(cam_idle_event);
1550 cam_idle_event = NULL;
1552 LOGD("remove idle event done");
1555 LOGW("event lock failed. it's being called...");
1557 end_time = g_get_monotonic_time() + G_TIME_SPAN_MILLISECOND * 100;
1559 if (g_cond_wait_until(&cb_info->idle_event_cond, &cb_info->idle_event_mutex, end_time))
1560 LOGW("signal received");
1567 g_list_free(cb_info->idle_event_list);
1568 cb_info->idle_event_list = NULL;
1571 g_mutex_unlock(&cb_info->idle_event_mutex);
1576 static void *_camera_msg_recv_func(gpointer data)
1585 char *recv_msg = NULL;
1586 char **parse_str = NULL;
1587 camera_cb_info_s *cb_info = (camera_cb_info_s *)data;
1589 if (cb_info == NULL) {
1590 LOGE("cb_info NULL");
1596 parse_str = (char **)malloc(sizeof(char *) * CAMERA_PARSE_STRING_SIZE);
1597 if (parse_str == NULL) {
1598 LOGE("parse_str malloc failed");
1602 for (i = 0 ; i < CAMERA_PARSE_STRING_SIZE ; i++) {
1603 parse_str[i] = (char *)malloc(sizeof(char) * MUSE_CAMERA_MSG_MAX_LENGTH);
1604 if (parse_str[i] == NULL) {
1605 LOGE("parse_str[%d] malloc failed", i);
1606 goto CB_HANDLER_EXIT;
1610 recv_msg = cb_info->recv_msg;
1612 while (g_atomic_int_get(&cb_info->msg_recv_running)) {
1613 ret = muse_core_ipc_recv_msg(cb_info->fd, recv_msg);
1616 recv_msg[ret] = '\0';
1622 /*LOGD("recvMSg : %s, length : %d", recv_msg, ret);*/
1624 /* Need to split the combined entering msgs.
1625 This module supports up to 200 combined msgs. */
1626 for (str_pos = 0; str_pos < ret; str_pos++) {
1627 if (recv_msg[str_pos] == '}') {
1628 memset(parse_str[num_token], 0x0, sizeof(char) * MUSE_CAMERA_MSG_MAX_LENGTH);
1629 strncpy(parse_str[num_token], recv_msg + prev_pos, str_pos - prev_pos + 1);
1630 LOGD("splitted msg : [%s], Index : %d", parse_str[num_token], num_token);
1631 prev_pos = str_pos+1;
1636 /*LOGD("num_token : %d", num_token);*/
1638 /* Re-construct to the useful single msg. */
1639 for (i = 0; i < num_token; i++) {
1640 if (i >= CAMERA_PARSE_STRING_SIZE) {
1641 LOGE("invalid token index %d", i);
1648 if (!muse_camera_msg_get(api, parse_str[i])) {
1649 LOGE("failed to get camera api");
1653 if (api != MUSE_CAMERA_CB_EVENT) {
1654 LOGD("check api_class");
1655 if (muse_camera_msg_get(api_class, parse_str[i]))
1656 LOGD("camera api_class[%d]", api_class);
1659 if (api_class == MUSE_CAMERA_API_CLASS_IMMEDIATE) {
1660 g_mutex_lock(&cb_info->api_mutex[api]);
1662 if (!muse_camera_msg_get(ret, parse_str[i])) {
1663 LOGE("failed to get camera ret");
1664 g_mutex_unlock(&cb_info->api_mutex[api]);
1668 cb_info->api_ret[api] = ret;
1669 cb_info->api_activating[api] = 1;
1671 if (api == MUSE_CAMERA_API_CREATE) {
1672 if (ret != CAMERA_ERROR_NONE) {
1673 g_atomic_int_set(&cb_info->msg_recv_running, 0);
1674 LOGE("camera create error 0x%x. close client cb handler", ret);
1676 } else if (api == MUSE_CAMERA_API_DESTROY) {
1677 if (ret == CAMERA_ERROR_NONE) {
1678 g_atomic_int_set(&cb_info->msg_recv_running, 0);
1679 LOGD("camera destroy done. close client cb handler");
1683 g_cond_signal(&cb_info->api_cond[api]);
1684 g_mutex_unlock(&cb_info->api_mutex[api]);
1685 } else if (api_class == MUSE_CAMERA_API_CLASS_THREAD_SUB || api == MUSE_CAMERA_CB_EVENT) {
1686 camera_message_s *cam_msg = g_new0(camera_message_s, 1);
1687 if (cam_msg == NULL) {
1688 LOGE("failed to alloc cam_msg");
1693 memcpy(cam_msg->recv_msg, parse_str[i], sizeof(cam_msg->recv_msg));
1695 LOGD("add camera message to queue : api %d", api);
1697 g_mutex_lock(&cb_info->msg_handler_mutex);
1698 g_queue_push_tail(cb_info->msg_queue, (gpointer)cam_msg);
1699 g_cond_signal(&cb_info->msg_handler_cond);
1700 g_mutex_unlock(&cb_info->msg_handler_mutex);
1702 LOGW("unknown camera api %d and api_class %d", api, api_class);
1708 LOGD("client cb exit");
1712 for (i = 0 ; i < CAMERA_PARSE_STRING_SIZE ; i++) {
1715 parse_str[i] = NULL;
1726 static camera_cb_info_s *_client_callback_new(gint sockfd)
1728 camera_cb_info_s *cb_info = NULL;
1729 gint *tmp_activating = NULL;
1730 gint *tmp_ret = NULL;
1733 g_return_val_if_fail(sockfd > 0, NULL);
1735 cb_info = g_new0(camera_cb_info_s, 1);
1736 if (cb_info == NULL) {
1737 LOGE("cb_info failed");
1741 g_mutex_init(&cb_info->msg_handler_mutex);
1742 g_cond_init(&cb_info->msg_handler_cond);
1743 g_mutex_init(&cb_info->idle_event_mutex);
1744 g_cond_init(&cb_info->idle_event_cond);
1745 g_mutex_init(&cb_info->mp_data_mutex);
1747 for (i = 0 ; i < MUSE_CAMERA_API_MAX ; i++) {
1748 g_mutex_init(&cb_info->api_mutex[i]);
1749 g_cond_init(&cb_info->api_cond[i]);
1752 tmp_activating = g_new0(gint, MUSE_CAMERA_API_MAX);
1753 if (tmp_activating == NULL) {
1754 LOGE("tmp_activating failed");
1758 tmp_ret = g_new0(gint, MUSE_CAMERA_API_MAX);
1759 if (tmp_ret == NULL) {
1760 LOGE("tmp_ret failed");
1764 cb_info->msg_queue = g_queue_new();
1765 if (cb_info->msg_queue == NULL) {
1766 LOGE("msg_queue new failed");
1770 g_atomic_int_set(&cb_info->msg_handler_running, 1);
1771 cb_info->msg_handler_thread = g_thread_try_new("camera_msg_handler",
1772 _camera_msg_handler_func, (gpointer)cb_info, NULL);
1773 if (cb_info->msg_handler_thread == NULL) {
1774 LOGE("message handler thread creation failed");
1778 cb_info->fd = sockfd;
1779 cb_info->api_activating = tmp_activating;
1780 cb_info->api_ret = tmp_ret;
1781 cb_info->preview_cb_flag = 0;
1782 cb_info->evas_info = g_new0(mm_evas_info, 1);
1784 g_atomic_int_set(&cb_info->msg_recv_running, 1);
1785 cb_info->msg_recv_thread = g_thread_try_new("camera_msg_recv",
1786 _camera_msg_recv_func, (gpointer)cb_info, NULL);
1787 if (cb_info->msg_recv_thread == NULL) {
1788 LOGE("message receive thread creation failed");
1796 if (cb_info->msg_handler_thread) {
1797 g_mutex_lock(&cb_info->msg_handler_mutex);
1798 g_atomic_int_set(&cb_info->msg_handler_running, 0);
1799 g_cond_signal(&cb_info->msg_handler_cond);
1800 g_mutex_unlock(&cb_info->msg_handler_mutex);
1802 g_thread_join(cb_info->msg_handler_thread);
1803 g_thread_unref(cb_info->msg_handler_thread);
1804 cb_info->msg_handler_thread = NULL;
1807 for (i = 0 ; i < MUSE_CAMERA_API_MAX ; i++) {
1808 g_mutex_clear(&cb_info->api_mutex[i]);
1809 g_cond_clear(&cb_info->api_cond[i]);
1812 g_mutex_clear(&cb_info->msg_handler_mutex);
1813 g_cond_clear(&cb_info->msg_handler_cond);
1814 g_mutex_clear(&cb_info->idle_event_mutex);
1815 g_cond_clear(&cb_info->idle_event_cond);
1816 g_mutex_clear(&cb_info->mp_data_mutex);
1818 if (cb_info->msg_queue) {
1819 g_queue_free(cb_info->msg_queue);
1820 cb_info->msg_queue = NULL;
1827 if (tmp_activating) {
1828 g_free(tmp_activating);
1829 tmp_activating = NULL;
1839 static void _client_callback_destroy(camera_cb_info_s *cb_info)
1843 g_return_if_fail(cb_info != NULL);
1845 LOGD("MSG receive thread[%p] destroy", cb_info->msg_recv_thread);
1847 g_thread_join(cb_info->msg_recv_thread);
1848 g_thread_unref(cb_info->msg_recv_thread);
1849 cb_info->msg_recv_thread = NULL;
1851 LOGD("msg thread removed");
1853 g_mutex_lock(&cb_info->msg_handler_mutex);
1854 g_atomic_int_set(&cb_info->msg_handler_running, 0);
1855 g_cond_signal(&cb_info->msg_handler_cond);
1856 g_mutex_unlock(&cb_info->msg_handler_mutex);
1858 g_thread_join(cb_info->msg_handler_thread);
1859 g_thread_unref(cb_info->msg_handler_thread);
1860 cb_info->msg_handler_thread = NULL;
1862 g_queue_free(cb_info->msg_queue);
1863 cb_info->msg_queue = NULL;
1865 for (i = 0 ; i < MUSE_CAMERA_API_MAX ; i++) {
1866 g_mutex_clear(&cb_info->api_mutex[i]);
1867 g_cond_clear(&cb_info->api_cond[i]);
1870 g_mutex_clear(&cb_info->msg_handler_mutex);
1871 g_cond_clear(&cb_info->msg_handler_cond);
1872 g_mutex_clear(&cb_info->idle_event_mutex);
1873 g_cond_clear(&cb_info->idle_event_cond);
1874 g_mutex_clear(&cb_info->mp_data_mutex);
1876 LOGD("event thread removed");
1878 if (cb_info->fd > -1) {
1879 muse_core_connection_close(cb_info->fd);
1883 if (cb_info->bufmgr) {
1884 tbm_bufmgr_deinit(cb_info->bufmgr);
1885 cb_info->bufmgr = NULL;
1887 if (cb_info->api_activating) {
1888 g_free(cb_info->api_activating);
1889 cb_info->api_activating = NULL;
1891 if (cb_info->api_ret) {
1892 g_free(cb_info->api_ret);
1893 cb_info->api_ret = NULL;
1895 if (cb_info->pkt_fmt) {
1896 media_format_unref(cb_info->pkt_fmt);
1897 cb_info->pkt_fmt = NULL;
1900 if (cb_info->evas_info) {
1901 g_free(cb_info->evas_info);
1902 cb_info->evas_info = NULL;
1905 cb_info->preview_cb_flag = 0;
1913 int camera_create(camera_device_e device, camera_h *camera)
1917 int ret = CAMERA_ERROR_NONE;
1919 camera_cli_s *pc = NULL;
1920 tbm_bufmgr bufmgr = NULL;
1922 muse_camera_api_e api = MUSE_CAMERA_API_CREATE;
1923 muse_core_api_module_e muse_module = MUSE_CAMERA;
1924 int device_type = (int)device;
1926 if (camera == NULL) {
1927 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
1928 return CAMERA_ERROR_INVALID_PARAMETER;
1931 bufmgr = tbm_bufmgr_init(-1);
1932 if (bufmgr == NULL) {
1933 LOGE("get tbm bufmgr failed");
1934 return CAMERA_ERROR_INVALID_OPERATION;
1937 sock_fd = muse_core_client_new();
1939 LOGE("muse_core_client_new failed - returned fd %d", sock_fd);
1940 ret = CAMERA_ERROR_INVALID_OPERATION;
1946 sndMsg = muse_core_msg_json_factory_new(api,
1947 MUSE_TYPE_INT, "module", muse_module,
1948 MUSE_TYPE_INT, PARAM_DEVICE_TYPE, device_type,
1949 MUSE_TYPE_INT, "pid", pid,
1952 muse_core_ipc_send_msg(sock_fd, sndMsg);
1953 muse_core_msg_json_factory_free(sndMsg);
1955 pc = g_new0(camera_cli_s, 1);
1957 LOGE("camera_cli_s alloc failed");
1958 ret = CAMERA_ERROR_OUT_OF_MEMORY;
1962 pc->cb_info = _client_callback_new(sock_fd);
1963 if (pc->cb_info == NULL) {
1964 LOGE("cb_info alloc failed");
1965 ret = CAMERA_ERROR_OUT_OF_MEMORY;
1969 LOGD("cb info : %d", pc->cb_info->fd);
1971 ret = _client_wait_for_cb_return(api, pc->cb_info, CALLBACK_TIME_OUT);
1972 if (ret == CAMERA_ERROR_NONE) {
1973 intptr_t handle = 0;
1974 muse_camera_msg_get_pointer(handle, pc->cb_info->recv_msg);
1976 LOGE("Receiving Handle Failed!!");
1977 ret = CAMERA_ERROR_INVALID_OPERATION;
1981 pc->remote_handle = handle;
1982 pc->cb_info->bufmgr = bufmgr;
1984 ret = camera_set_display((camera_h)pc, CAMERA_DISPLAY_TYPE_NONE, NULL);
1985 if (ret != CAMERA_ERROR_NONE) {
1986 LOGE("init display failed 0x%x", ret);
1990 LOGD("camera create 0x%x", pc->remote_handle);
1991 *camera = (camera_h)pc;
1999 tbm_bufmgr_deinit(bufmgr);
2003 _client_callback_destroy(pc->cb_info);
2009 LOGE("camera create error : 0x%x", ret);
2014 int camera_destroy(camera_h camera)
2016 if (camera == NULL) {
2017 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2018 return CAMERA_ERROR_INVALID_PARAMETER;
2021 int ret = CAMERA_ERROR_NONE;
2022 muse_camera_api_e api = MUSE_CAMERA_API_DESTROY;
2023 camera_cli_s *pc = (camera_cli_s *)camera;
2028 if (pc->cb_info == NULL) {
2029 LOGE("cb_info NULL, INVALID_PARAMETER");
2030 return CAMERA_ERROR_INVALID_PARAMETER;
2033 sock_fd = pc->cb_info->fd;
2035 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2036 if (ret == CAMERA_ERROR_NONE) {
2037 _camera_remove_idle_event_all(pc->cb_info);
2038 _client_callback_destroy(pc->cb_info);
2044 LOGE("camera destroy error : 0x%x", ret);
2050 int camera_start_preview(camera_h camera)
2052 int ret = CAMERA_ERROR_NONE;
2053 muse_camera_api_e api = MUSE_CAMERA_API_START_PREVIEW;
2054 camera_cli_s *pc = (camera_cli_s *)camera;
2057 if (camera == NULL) {
2058 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2059 return CAMERA_ERROR_INVALID_PARAMETER;
2062 if (pc->cb_info == NULL) {
2063 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2064 return CAMERA_ERROR_INVALID_PARAMETER;
2069 sock_fd = pc->cb_info->fd;
2071 muse_camera_msg_send_longtime(api, sock_fd, pc->cb_info, ret);
2073 if (ret != CAMERA_ERROR_NONE) {
2074 LOGE("start preview failed 0x%x", ret);
2078 LOGD("ret : 0x%x", ret);
2080 return CAMERA_ERROR_NONE;
2083 int camera_stop_preview(camera_h camera)
2085 int ret = CAMERA_ERROR_NONE;
2087 camera_cli_s *pc = NULL;
2088 muse_camera_api_e api = MUSE_CAMERA_API_STOP_PREVIEW;
2090 if (camera == NULL) {
2091 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2092 return CAMERA_ERROR_INVALID_PARAMETER;
2095 pc = (camera_cli_s *)camera;
2097 if (pc->cb_info == NULL) {
2098 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2099 return CAMERA_ERROR_INVALID_PARAMETER;
2102 sock_fd = pc->cb_info->fd;
2106 /* send stop preview message */
2107 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2109 LOGD("ret : 0x%x", ret);
2114 int camera_start_capture(camera_h camera, camera_capturing_cb capturing_cb, camera_capture_completed_cb completed_cb, void *user_data)
2116 if (camera == NULL) {
2117 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2118 return CAMERA_ERROR_INVALID_PARAMETER;
2120 int ret = CAMERA_ERROR_NONE;
2122 camera_cli_s *pc = (camera_cli_s *)camera;
2123 muse_camera_api_e api = MUSE_CAMERA_API_START_CAPTURE;
2125 int is_capturing_cb = 0;
2126 int is_completed_cb = 0;
2127 LOGD("Enter, handle :%x", pc->remote_handle);
2129 if (pc->cb_info == NULL) {
2130 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2131 return CAMERA_ERROR_INVALID_PARAMETER;
2134 sock_fd = pc->cb_info->fd;
2136 if (capturing_cb != NULL) {
2137 is_capturing_cb = 1;
2138 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = capturing_cb;
2139 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = user_data;
2142 if (completed_cb != NULL) {
2143 is_completed_cb = 1;
2144 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = completed_cb;
2145 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = user_data;
2148 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, is_capturing_cb, INT, is_completed_cb);
2149 LOGD("is_capturing_cb :%d, is_completed_cb : %d", is_capturing_cb, is_completed_cb);
2150 LOGD("ret : 0x%x", ret);
2154 bool camera_is_supported_continuous_capture(camera_h camera)
2156 if (camera == NULL) {
2157 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2161 int ret = CAMERA_ERROR_NONE;
2162 camera_cli_s *pc = (camera_cli_s *)camera;
2163 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_CONTINUOUS_CAPTURE;
2166 if (pc->cb_info == NULL) {
2167 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2168 return CAMERA_ERROR_INVALID_PARAMETER;
2171 sock_fd = pc->cb_info->fd;
2173 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2174 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2175 LOGD("ret : 0x%x", ret);
2179 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)
2181 if (camera == NULL) {
2182 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2183 return CAMERA_ERROR_INVALID_PARAMETER;
2186 int ret = CAMERA_ERROR_NONE;
2188 camera_cli_s *pc = (camera_cli_s *)camera;
2189 muse_camera_api_e api = MUSE_CAMERA_API_START_CONTINUOUS_CAPTURE;
2191 LOGD("Enter, handle :%x", pc->remote_handle);
2194 if (pc->cb_info == NULL) {
2195 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2196 return CAMERA_ERROR_INVALID_PARAMETER;
2198 sock_fd = pc->cb_info->fd;
2200 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = capturing_cb;
2201 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = user_data;
2202 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = completed_cb;
2204 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, count, INT, interval);
2206 LOGD("ret : 0x%x", ret);
2211 int camera_stop_continuous_capture(camera_h camera)
2213 if (camera == NULL) {
2214 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2215 return CAMERA_ERROR_INVALID_PARAMETER;
2219 int ret = CAMERA_ERROR_NONE;
2221 camera_cli_s *pc = (camera_cli_s *)camera;
2222 muse_camera_api_e api = MUSE_CAMERA_API_STOP_CONTINUOUS_CAPTURE;
2223 LOGD("Enter, handle :%x", pc->remote_handle);
2225 if (pc->cb_info == NULL) {
2226 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2227 return CAMERA_ERROR_INVALID_PARAMETER;
2229 sock_fd = pc->cb_info->fd;
2230 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2231 LOGD("ret : 0x%x", ret);
2235 bool camera_is_supported_face_detection(camera_h camera)
2237 if (camera == NULL) {
2238 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2241 int ret = CAMERA_ERROR_NONE;
2243 camera_cli_s *pc = (camera_cli_s *)camera;
2244 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_FACE_DETECTION;
2246 if (pc->cb_info == NULL) {
2247 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2248 return CAMERA_ERROR_INVALID_PARAMETER;
2250 sock_fd = pc->cb_info->fd;
2252 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2253 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2254 LOGD("ret : 0x%x", ret);
2258 bool camera_is_supported_zero_shutter_lag(camera_h camera)
2260 if (camera == NULL) {
2261 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2264 int ret = CAMERA_ERROR_NONE;
2266 camera_cli_s *pc = (camera_cli_s *)camera;
2267 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_ZERO_SHUTTER_LAG;
2269 if (pc->cb_info == NULL) {
2270 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2271 return CAMERA_ERROR_INVALID_PARAMETER;
2273 sock_fd = pc->cb_info->fd;
2275 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2276 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2277 LOGD("ret : 0x%x", ret);
2281 bool camera_is_supported_media_packet_preview_cb(camera_h camera)
2283 if (camera == NULL) {
2284 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2288 int ret = CAMERA_ERROR_NONE;
2290 camera_cli_s *pc = (camera_cli_s *)camera;
2291 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_MEDIA_PACKET_PREVIEW_CB;
2293 if (pc->cb_info == NULL) {
2294 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2295 return CAMERA_ERROR_INVALID_PARAMETER;
2297 sock_fd = pc->cb_info->fd;
2299 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2300 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2301 LOGD("ret : 0x%x", ret);
2305 int camera_get_device_count(camera_h camera, int *device_count)
2307 if (camera == NULL || device_count == NULL) {
2308 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2309 return CAMERA_ERROR_INVALID_PARAMETER;
2311 int ret = CAMERA_ERROR_NONE;
2313 camera_cli_s *pc = (camera_cli_s *)camera;
2314 muse_camera_api_e api = MUSE_CAMERA_API_GET_DEVICE_COUNT;
2316 if (pc->cb_info == NULL) {
2317 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2318 return CAMERA_ERROR_INVALID_PARAMETER;
2320 sock_fd = pc->cb_info->fd;
2321 int get_device_count;
2323 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2324 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2326 if (ret == CAMERA_ERROR_NONE) {
2327 muse_camera_msg_get(get_device_count, pc->cb_info->recv_msg);
2328 *device_count = get_device_count;
2330 LOGD("ret : 0x%x", ret);
2334 int camera_start_face_detection(camera_h camera, camera_face_detected_cb callback, void *user_data)
2336 if (camera == NULL) {
2337 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2338 return CAMERA_ERROR_INVALID_PARAMETER;
2341 int ret = CAMERA_ERROR_NONE;
2343 camera_cli_s *pc = (camera_cli_s *)camera;
2344 muse_camera_api_e api = MUSE_CAMERA_API_START_FACE_DETECTION;
2346 LOGD("Enter, handle :%x", pc->remote_handle);
2348 if (pc->cb_info == NULL) {
2349 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2350 return CAMERA_ERROR_INVALID_PARAMETER;
2352 sock_fd = pc->cb_info->fd;
2353 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION] = callback;
2354 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION] = user_data;
2356 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2357 LOGD("ret : 0x%x", ret);
2361 int camera_stop_face_detection(camera_h camera)
2363 if (camera == NULL) {
2364 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2365 return CAMERA_ERROR_INVALID_PARAMETER;
2368 int ret = CAMERA_ERROR_NONE;
2370 camera_cli_s *pc = (camera_cli_s *)camera;
2371 muse_camera_api_e api = MUSE_CAMERA_API_STOP_FACE_DETECTION;
2372 LOGD("Enter, handle :%x", pc->remote_handle);
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;
2379 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2380 LOGD("ret : 0x%x", ret);
2384 int camera_get_state(camera_h camera, camera_state_e * state)
2386 if (camera == NULL || state == NULL) {
2387 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2388 return CAMERA_ERROR_INVALID_PARAMETER;
2390 int ret = CAMERA_ERROR_NONE;
2392 camera_cli_s *pc = (camera_cli_s *)camera;
2393 muse_camera_api_e api = MUSE_CAMERA_API_GET_STATE;
2395 if (pc->cb_info == NULL) {
2396 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2397 return CAMERA_ERROR_INVALID_PARAMETER;
2399 sock_fd = pc->cb_info->fd;
2402 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2403 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2405 if (ret == CAMERA_ERROR_NONE) {
2406 muse_camera_msg_get(get_state, pc->cb_info->recv_msg);
2407 *state = (camera_state_e)get_state;
2409 LOGD("ret : 0x%x", ret);
2413 int camera_start_focusing(camera_h camera, bool continuous)
2415 if (camera == NULL) {
2416 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2417 return CAMERA_ERROR_INVALID_PARAMETER;
2420 int ret = CAMERA_ERROR_NONE;
2422 camera_cli_s *pc = (camera_cli_s *)camera;
2423 muse_camera_api_e api = MUSE_CAMERA_API_START_FOCUSING;
2425 if (pc->cb_info == NULL) {
2426 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2427 return CAMERA_ERROR_INVALID_PARAMETER;
2429 sock_fd = pc->cb_info->fd;
2430 int is_continuous = (int)continuous;
2432 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2433 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, is_continuous);
2434 LOGD("ret : 0x%x", ret);
2438 int camera_cancel_focusing(camera_h camera)
2440 if (camera == NULL) {
2441 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2442 return CAMERA_ERROR_INVALID_PARAMETER;
2445 int ret = CAMERA_ERROR_NONE;
2447 camera_cli_s *pc = (camera_cli_s *)camera;
2448 muse_camera_api_e api = MUSE_CAMERA_API_CANCEL_FOCUSING;
2450 if (pc->cb_info == NULL) {
2451 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2452 return CAMERA_ERROR_INVALID_PARAMETER;
2454 sock_fd = pc->cb_info->fd;
2456 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2457 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2458 LOGD("ret : 0x%x", ret);
2462 int camera_set_display(camera_h camera, camera_display_type_e type, camera_display_h display)
2464 int ret = CAMERA_ERROR_NONE;
2465 void *set_display_handle = NULL;
2466 Evas_Object *obj = NULL;
2467 const char *object_type = NULL;
2469 camera_wl_info_s *wl_info = NULL;
2470 #endif /* HAVE_WAYLAND */
2472 if (camera == NULL) {
2473 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2474 return CAMERA_ERROR_INVALID_PARAMETER;
2477 if (type < CAMERA_DISPLAY_TYPE_OVERLAY || type > CAMERA_DISPLAY_TYPE_NONE) {
2478 LOGE("invalid type %d", type);
2479 return CAMERA_ERROR_INVALID_PARAMETER;
2482 if (type != CAMERA_DISPLAY_TYPE_NONE && display == NULL) {
2483 LOGE("display type[%d] is not NONE, but display handle is NULL", type);
2484 return CAMERA_ERROR_INVALID_PARAMETER;
2487 camera_cli_s *pc = (camera_cli_s *)camera;
2488 camera_cb_info_s *cb_info = (camera_cb_info_s *)pc->cb_info;
2489 muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY;
2491 if (pc->cb_info == NULL) {
2492 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2493 return CAMERA_ERROR_INVALID_PARAMETER;
2495 sock_fd = pc->cb_info->fd;
2497 LOGD("Enter, remote_handle : %x display : 0x%x", pc->remote_handle, display);
2499 if (type == CAMERA_DISPLAY_TYPE_NONE) {
2500 set_display_handle = 0;
2501 LOGD("display type NONE");
2503 obj = (Evas_Object *)display;
2504 object_type = evas_object_type_get(obj);
2506 if (type == CAMERA_DISPLAY_TYPE_OVERLAY && !strcmp(object_type, "elm_win")) {
2508 /* get wayland parent id */
2509 if (_get_wl_info(obj, &pc->wl_info) != CAMERA_ERROR_NONE) {
2510 LOGE("failed to get wayland info");
2511 return CAMERA_ERROR_INVALID_OPERATION;
2514 set_display_handle = (void *)&pc->wl_info;
2515 #else /* HAVE_WAYLAND */
2516 /* x window overlay surface */
2517 set_display_handle = (void *)elm_win_xwindow_get(obj);
2518 #endif /* HAVE_WAYLAND */
2519 LOGD("display type OVERLAY : handle %p", set_display_handle);
2520 } else if (type == CAMERA_DISPLAY_TYPE_EVAS && !strcmp(object_type, "image")) {
2521 /* evas object surface */
2522 set_display_handle = (void *)display;
2523 SET_PREVIEW_CB_TYPE(cb_info, PREVIEW_CB_TYPE_EVAS);
2525 if (mm_evas_renderer_create(&cb_info->evas_info, obj) != MM_ERROR_NONE) {
2526 UNSET_PREVIEW_CB_TYPE(cb_info, PREVIEW_CB_TYPE_EVAS);
2527 LOGE("failed to create mm evas renderer");
2528 return CAMERA_ERROR_INVALID_OPERATION;
2531 LOGD("display type EVAS : handle %p", set_display_handle);
2533 LOGE("unknown evas object [%p,%s] or type [%d] mismatch", obj, object_type, type);
2534 return CAMERA_ERROR_INVALID_PARAMETER;
2537 LOGE("failed to get evas object type from %p", obj);
2538 return CAMERA_ERROR_INVALID_PARAMETER;
2542 pc->display_handle = (intptr_t)set_display_handle;
2544 if (type == CAMERA_DISPLAY_TYPE_OVERLAY) {
2546 wl_info = &pc->wl_info;
2547 muse_camera_msg_send_array_and_value(api, sock_fd, pc->cb_info, ret,
2548 wl_info, 5, sizeof(int), INT, type);
2550 LOGD("wayland parent id : %d, window %d,%d,%dx%d",
2551 wl_info->parent_id, wl_info->window_x, wl_info->window_y,
2552 wl_info->window_width, wl_info->window_height);
2553 #else /* HAVE_WAYLAND */
2554 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, type, INT, set_display_handle);
2556 LOGD("x id : %d", (int)set_display_handle);
2557 #endif /* HAVE_WAYLAND */
2559 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, type);
2561 if (ret != CAMERA_ERROR_NONE) {
2562 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS))
2563 UNSET_PREVIEW_CB_TYPE(cb_info, PREVIEW_CB_TYPE_EVAS);
2565 LOGE("set display error 0x%x", ret);
2571 int camera_set_preview_resolution(camera_h camera, int width, int height)
2573 if (camera == NULL) {
2574 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2575 return CAMERA_ERROR_INVALID_PARAMETER;
2577 int ret = CAMERA_ERROR_NONE;
2579 camera_cli_s *pc = (camera_cli_s *)camera;
2580 muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_RESOLUTION;
2582 if (pc->cb_info == NULL) {
2583 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2584 return CAMERA_ERROR_INVALID_PARAMETER;
2586 sock_fd = pc->cb_info->fd;
2588 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2589 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, width, INT, height);
2590 LOGD("ret : 0x%x", ret);
2595 int camera_set_capture_resolution(camera_h camera, int width, int height)
2597 if (camera == NULL) {
2598 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2599 return CAMERA_ERROR_INVALID_PARAMETER;
2602 int ret = CAMERA_ERROR_NONE;
2604 camera_cli_s *pc = (camera_cli_s *)camera;
2605 muse_camera_api_e api = MUSE_CAMERA_API_SET_CAPTURE_RESOLUTION;
2607 if (pc->cb_info == NULL) {
2608 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2609 return CAMERA_ERROR_INVALID_PARAMETER;
2611 sock_fd = pc->cb_info->fd;
2613 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2614 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, width, INT, height);
2615 LOGD("ret : 0x%x", ret);
2619 int camera_set_capture_format(camera_h camera, camera_pixel_format_e format)
2621 if (camera == NULL) {
2622 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2623 return CAMERA_ERROR_INVALID_PARAMETER;
2626 int ret = CAMERA_ERROR_NONE;
2627 int set_format = (int)format;
2629 camera_cli_s *pc = (camera_cli_s *)camera;
2630 muse_camera_api_e api = MUSE_CAMERA_API_SET_CAPTURE_FORMAT;
2632 if (pc->cb_info == NULL) {
2633 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2634 return CAMERA_ERROR_INVALID_PARAMETER;
2636 sock_fd = pc->cb_info->fd;
2638 LOGD("Enter, remote_handle : %x, capture_format: %d", pc->remote_handle, set_format);
2639 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_format);
2640 LOGD("ret : 0x%x", ret);
2644 int camera_set_preview_format(camera_h camera, camera_pixel_format_e format)
2646 if (camera == NULL) {
2647 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2648 return CAMERA_ERROR_INVALID_PARAMETER;
2651 int ret = CAMERA_ERROR_NONE;
2652 int set_format = (int)format;
2654 camera_cli_s *pc = (camera_cli_s *)camera;
2655 muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_FORMAT;
2657 if (pc->cb_info == NULL) {
2658 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2659 return CAMERA_ERROR_INVALID_PARAMETER;
2661 sock_fd = pc->cb_info->fd;
2663 LOGD("Enter, remote_handle : %x, capture_format: %d", pc->remote_handle, set_format);
2664 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_format);
2665 LOGD("ret : 0x%x", ret);
2669 int camera_get_preview_resolution(camera_h camera, int *width, int *height)
2671 if (camera == NULL || width == NULL || height == NULL) {
2672 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2673 return CAMERA_ERROR_INVALID_PARAMETER;
2677 int ret = CAMERA_ERROR_NONE;
2679 camera_cli_s *pc = (camera_cli_s *)camera;
2680 muse_camera_api_e api = MUSE_CAMERA_API_GET_PREVIEW_RESOLUTION;
2682 if (pc->cb_info == NULL) {
2683 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2684 return CAMERA_ERROR_INVALID_PARAMETER;
2686 sock_fd = pc->cb_info->fd;
2690 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2691 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2693 if (ret == CAMERA_ERROR_NONE) {
2694 muse_camera_msg_get(get_width, pc->cb_info->recv_msg);
2695 muse_camera_msg_get(get_height, pc->cb_info->recv_msg);
2697 *height = get_height;
2699 LOGD("ret : 0x%x", ret);
2703 int camera_set_display_rotation(camera_h camera, camera_rotation_e rotation)
2705 int ret = CAMERA_ERROR_NONE;
2706 int set_rotation = (int)rotation;
2707 camera_cli_s *pc = NULL;
2709 if (camera == NULL) {
2710 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2711 return CAMERA_ERROR_INVALID_PARAMETER;
2714 if (rotation < CAMERA_ROTATION_NONE || rotation > CAMERA_ROTATION_270) {
2715 LOGE("Invalid rotation %d", rotation);
2716 return CAMERA_ERROR_INVALID_PARAMETER;
2719 pc = (camera_cli_s *)camera;
2721 if (pc->cb_info == NULL) {
2722 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2723 return CAMERA_ERROR_INVALID_PARAMETER;
2726 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
2727 if (mm_evas_renderer_set_rotation(pc->cb_info->evas_info, rotation) != MM_ERROR_NONE) {
2728 LOGE("failed to set rotation for evas surface.");
2729 return CAMERA_ERROR_INVALID_OPERATION;
2732 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_ROTATION,
2733 pc->cb_info->fd, pc->cb_info, ret, INT, set_rotation);
2739 int camera_get_display_rotation(camera_h camera, camera_rotation_e *rotation)
2741 int ret = CAMERA_ERROR_NONE;
2742 int get_rotation = CAMERA_ROTATION_NONE;
2743 camera_cli_s *pc = NULL;
2745 if (camera == NULL || rotation == NULL) {
2746 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2747 return CAMERA_ERROR_INVALID_PARAMETER;
2750 pc = (camera_cli_s *)camera;
2752 if (pc->cb_info == NULL) {
2753 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2754 return CAMERA_ERROR_INVALID_PARAMETER;
2757 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
2758 if (mm_evas_renderer_get_rotation(pc->cb_info->evas_info, (int *)rotation) != MM_ERROR_NONE) {
2759 LOGE("failed to get rotation for evas surface.");
2760 return CAMERA_ERROR_INVALID_OPERATION;
2763 muse_camera_msg_send(MUSE_CAMERA_API_GET_DISPLAY_ROTATION,
2764 pc->cb_info->fd, pc->cb_info, ret);
2766 if (ret == CAMERA_ERROR_NONE) {
2767 muse_camera_msg_get(get_rotation, pc->cb_info->recv_msg);
2768 *rotation = (camera_rotation_e)get_rotation;
2775 int camera_set_display_flip(camera_h camera, camera_flip_e flip)
2777 int ret = CAMERA_ERROR_NONE;
2778 int set_flip = (int)flip;
2779 camera_cli_s *pc = NULL;
2781 if (camera == NULL) {
2782 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2783 return CAMERA_ERROR_INVALID_PARAMETER;
2786 if (flip < CAMERA_FLIP_NONE || flip > CAMERA_FLIP_BOTH) {
2787 LOGE("Invalid flip %d", flip);
2788 return CAMERA_ERROR_INVALID_PARAMETER;
2791 pc = (camera_cli_s *)camera;
2793 if (pc->cb_info == NULL) {
2794 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2795 return CAMERA_ERROR_INVALID_PARAMETER;
2798 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_FLIP,
2799 pc->cb_info->fd, pc->cb_info, ret, INT, set_flip);
2804 int camera_get_display_flip(camera_h camera, camera_flip_e *flip)
2806 int ret = CAMERA_ERROR_NONE;
2807 int get_flip = CAMERA_FLIP_NONE;
2808 camera_cli_s *pc = NULL;
2810 if (camera == NULL || flip == NULL) {
2811 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2812 return CAMERA_ERROR_INVALID_PARAMETER;
2815 pc = (camera_cli_s *)camera;
2817 if (pc->cb_info == NULL) {
2818 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2819 return CAMERA_ERROR_INVALID_PARAMETER;
2822 muse_camera_msg_send(MUSE_CAMERA_API_GET_DISPLAY_FLIP,
2823 pc->cb_info->fd, pc->cb_info, ret);
2825 if (ret == CAMERA_ERROR_NONE) {
2826 muse_camera_msg_get(get_flip, pc->cb_info->recv_msg);
2827 *flip = (camera_flip_e)get_flip;
2833 int camera_set_display_visible(camera_h camera, bool visible)
2835 int ret = CAMERA_ERROR_NONE;
2836 int set_visible = (int)visible;
2837 camera_cli_s *pc = NULL;
2839 if (camera == NULL) {
2840 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2841 return CAMERA_ERROR_INVALID_PARAMETER;
2844 pc = (camera_cli_s *)camera;
2846 if (pc->cb_info == NULL) {
2847 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2848 return CAMERA_ERROR_INVALID_PARAMETER;
2851 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
2852 if (mm_evas_renderer_set_visible(pc->cb_info->evas_info, visible) != MM_ERROR_NONE) {
2853 LOGE("failed to set visible for evas surface.");
2854 return CAMERA_ERROR_INVALID_OPERATION;
2857 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_VISIBLE,
2858 pc->cb_info->fd, pc->cb_info, ret, INT, set_visible);
2864 int camera_is_display_visible(camera_h camera, bool *visible)
2866 int ret = CAMERA_ERROR_NONE;
2867 int get_visible = true;
2868 camera_cli_s *pc = NULL;
2870 if (camera == NULL || visible == NULL) {
2871 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2872 return CAMERA_ERROR_INVALID_PARAMETER;
2875 pc = (camera_cli_s *)camera;
2877 if (pc->cb_info == NULL) {
2878 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2879 return CAMERA_ERROR_INVALID_PARAMETER;
2882 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
2883 if (mm_evas_renderer_get_visible(pc->cb_info->evas_info, visible) != MM_ERROR_NONE) {
2884 LOGE("failed to get visible for evas surface.");
2885 return CAMERA_ERROR_INVALID_OPERATION;
2888 muse_camera_msg_send(MUSE_CAMERA_API_IS_DISPLAY_VISIBLE,
2889 pc->cb_info->fd, pc->cb_info, ret);
2891 if (ret == CAMERA_ERROR_NONE) {
2892 muse_camera_msg_get(get_visible, pc->cb_info->recv_msg);
2893 *visible = (bool)get_visible;
2900 int camera_set_display_mode(camera_h camera, camera_display_mode_e mode)
2902 int ret = CAMERA_ERROR_NONE;
2903 int set_mode = (int)mode;
2904 camera_cli_s *pc = NULL;
2906 if (camera == NULL) {
2907 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2908 return CAMERA_ERROR_INVALID_PARAMETER;
2911 if (mode < CAMERA_DISPLAY_MODE_LETTER_BOX || mode > CAMERA_DISPLAY_MODE_CROPPED_FULL) {
2912 LOGE("Invalid mode %d", mode);
2913 return CAMERA_ERROR_INVALID_PARAMETER;
2916 pc = (camera_cli_s *)camera;
2918 if (pc->cb_info == NULL) {
2919 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2920 return CAMERA_ERROR_INVALID_PARAMETER;
2923 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
2924 if (mm_evas_renderer_set_geometry(pc->cb_info->evas_info, mode) != MM_ERROR_NONE) {
2925 LOGE("failed to set geometry for evas surface.");
2926 return CAMERA_ERROR_INVALID_OPERATION;
2929 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_MODE,
2930 pc->cb_info->fd, pc->cb_info, ret, INT, set_mode);
2936 int camera_get_display_mode(camera_h camera, camera_display_mode_e *mode)
2938 int ret = CAMERA_ERROR_NONE;
2939 int get_mode = CAMERA_DISPLAY_MODE_LETTER_BOX;
2940 camera_cli_s *pc = NULL;
2942 if (camera == NULL || mode == NULL) {
2943 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2944 return CAMERA_ERROR_INVALID_PARAMETER;
2947 pc = (camera_cli_s *)camera;
2949 if (pc->cb_info == NULL) {
2950 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2951 return CAMERA_ERROR_INVALID_PARAMETER;
2954 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
2955 if (mm_evas_renderer_get_geometry(pc->cb_info->evas_info, (int *)mode) != MM_ERROR_NONE) {
2956 LOGE("failed to get geometry for evas surface.");
2957 return CAMERA_ERROR_INVALID_OPERATION;
2960 muse_camera_msg_send(MUSE_CAMERA_API_GET_DISPLAY_MODE,
2961 pc->cb_info->fd, pc->cb_info, ret);
2963 if (ret == CAMERA_ERROR_NONE) {
2964 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
2965 *mode = (camera_display_mode_e)get_mode;
2972 int camera_get_capture_resolution(camera_h camera, int *width, int *height)
2974 if (camera == NULL || width == NULL || height == NULL) {
2975 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2976 return CAMERA_ERROR_INVALID_PARAMETER;
2978 int ret = CAMERA_ERROR_NONE;
2980 camera_cli_s *pc = (camera_cli_s *)camera;
2981 muse_camera_api_e api = MUSE_CAMERA_API_GET_CAPTURE_RESOLUTION;
2983 if (pc->cb_info == NULL) {
2984 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2985 return CAMERA_ERROR_INVALID_PARAMETER;
2987 sock_fd = pc->cb_info->fd;
2991 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2992 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2994 if (ret == CAMERA_ERROR_NONE) {
2995 muse_camera_msg_get(get_width, pc->cb_info->recv_msg);
2996 muse_camera_msg_get(get_height, pc->cb_info->recv_msg);
2998 *height = get_height;
3000 LOGD("ret : 0x%x", ret);
3004 int camera_get_capture_format(camera_h camera, camera_pixel_format_e *format)
3006 if (camera == NULL || format == NULL) {
3007 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3008 return CAMERA_ERROR_INVALID_PARAMETER;
3010 int ret = CAMERA_ERROR_NONE;
3012 camera_cli_s *pc = (camera_cli_s *)camera;
3013 muse_camera_api_e api = MUSE_CAMERA_API_GET_CAPTURE_FORMAT;
3016 if (pc->cb_info == NULL) {
3017 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3018 return CAMERA_ERROR_INVALID_PARAMETER;
3020 sock_fd = pc->cb_info->fd;
3022 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3023 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3025 if (ret == CAMERA_ERROR_NONE) {
3026 muse_camera_msg_get(get_format, pc->cb_info->recv_msg);
3027 *format = (camera_pixel_format_e)get_format;
3029 LOGD("ret : 0x%x", ret);
3033 int camera_get_preview_format(camera_h camera, camera_pixel_format_e *format)
3035 if (camera == NULL || format == NULL) {
3036 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3037 return CAMERA_ERROR_INVALID_PARAMETER;
3040 int ret = CAMERA_ERROR_NONE;
3042 camera_cli_s *pc = (camera_cli_s *)camera;
3043 muse_camera_api_e api = MUSE_CAMERA_API_GET_PREVIEW_FORMAT;
3046 if (pc->cb_info == NULL) {
3047 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3048 return CAMERA_ERROR_INVALID_PARAMETER;
3050 sock_fd = pc->cb_info->fd;
3052 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3053 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3055 if (ret == CAMERA_ERROR_NONE) {
3056 muse_camera_msg_get(get_format, pc->cb_info->recv_msg);
3057 *format = (camera_pixel_format_e)get_format;
3059 LOGD("ret : 0x%x", ret);
3063 int camera_get_facing_direction(camera_h camera, camera_facing_direction_e *facing_direciton)
3065 if (camera == NULL || facing_direciton == NULL) {
3066 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3067 return CAMERA_ERROR_INVALID_PARAMETER;
3070 int ret = CAMERA_ERROR_NONE;
3072 camera_cli_s *pc = (camera_cli_s *)camera;
3073 muse_camera_api_e api = MUSE_CAMERA_API_GET_FACING_DIRECTION;
3075 if (pc->cb_info == NULL) {
3076 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3077 return CAMERA_ERROR_INVALID_PARAMETER;
3079 sock_fd = pc->cb_info->fd;
3080 int get_facing_direction;
3082 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3083 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3085 if (ret == CAMERA_ERROR_NONE) {
3086 muse_camera_msg_get(get_facing_direction, pc->cb_info->recv_msg);
3087 *facing_direciton = (camera_facing_direction_e)get_facing_direction;
3089 LOGD("ret : 0x%x", ret);
3093 int camera_set_preview_cb(camera_h camera, camera_preview_cb callback, void *user_data)
3095 if (camera == NULL || callback == NULL) {
3096 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3097 return CAMERA_ERROR_INVALID_PARAMETER;
3099 int ret = CAMERA_ERROR_NONE;
3101 camera_cli_s *pc = (camera_cli_s *)camera;
3102 camera_cb_info_s *cb_info = (camera_cb_info_s *)pc->cb_info;
3104 if (pc->cb_info == NULL) {
3105 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3106 return CAMERA_ERROR_INVALID_PARAMETER;
3108 sock_fd = pc->cb_info->fd;
3109 muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_CB;
3111 LOGD("Enter, handle :%x", pc->remote_handle);
3113 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = callback;
3114 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = user_data;
3115 SET_PREVIEW_CB_TYPE(cb_info, PREVIEW_CB_TYPE_USER);
3117 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3118 LOGD("ret : 0x%x", ret);
3122 int camera_unset_preview_cb(camera_h camera)
3124 if (camera == NULL) {
3125 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3126 return CAMERA_ERROR_INVALID_PARAMETER;
3129 int ret = CAMERA_ERROR_NONE;
3131 camera_cli_s *pc = (camera_cli_s *)camera;
3132 camera_cb_info_s *cb_info = (camera_cb_info_s *)pc->cb_info;
3133 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_PREVIEW_CB;
3135 LOGD("Enter, handle :%x", pc->remote_handle);
3138 if (pc->cb_info == NULL) {
3139 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3140 return CAMERA_ERROR_INVALID_PARAMETER;
3142 sock_fd = pc->cb_info->fd;
3143 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = (void *)NULL;
3144 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = (void *)NULL;
3145 UNSET_PREVIEW_CB_TYPE(cb_info, PREVIEW_CB_TYPE_USER);
3147 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3148 LOGD("ret : 0x%x", ret);
3152 int camera_set_media_packet_preview_cb(camera_h camera, camera_media_packet_preview_cb callback, void *user_data)
3154 if (camera == NULL) {
3155 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
3156 return CAMERA_ERROR_INVALID_PARAMETER;
3159 if (camera_is_supported_media_packet_preview_cb(camera) == false) {
3160 LOGE("NOT SUPPORTED");
3161 return CAMERA_ERROR_NOT_SUPPORTED;
3164 if (callback == NULL) {
3165 LOGE("INVALID_PARAMETER(0x%08x) - callback", CAMERA_ERROR_INVALID_PARAMETER);
3166 return CAMERA_ERROR_INVALID_PARAMETER;
3169 int ret = CAMERA_ERROR_NONE;
3171 camera_cli_s *pc = (camera_cli_s *)camera;
3172 muse_camera_api_e api = MUSE_CAMERA_API_SET_MEDIA_PACKET_PREVIEW_CB;
3174 LOGD("Enter, handle :%x", pc->remote_handle);
3177 if (pc->cb_info == NULL) {
3178 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3179 return CAMERA_ERROR_INVALID_PARAMETER;
3181 sock_fd = pc->cb_info->fd;
3182 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = callback;
3183 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = user_data;
3185 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3186 LOGD("ret : 0x%x", ret);
3190 int camera_unset_media_packet_preview_cb(camera_h camera)
3192 if (camera == NULL) {
3193 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3194 return CAMERA_ERROR_INVALID_PARAMETER;
3197 int ret = CAMERA_ERROR_NONE;
3199 camera_cli_s *pc = (camera_cli_s *)camera;
3200 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_MEDIA_PACKET_PREVIEW_CB;
3202 LOGD("Enter, handle :%x", pc->remote_handle);
3205 if (pc->cb_info == NULL) {
3206 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3207 return CAMERA_ERROR_INVALID_PARAMETER;
3209 sock_fd = pc->cb_info->fd;
3210 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = (void *)NULL;
3211 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = (void *)NULL;
3213 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3214 LOGD("ret : 0x%x", ret);
3218 int camera_set_state_changed_cb(camera_h camera, camera_state_changed_cb callback, void *user_data)
3220 if (camera == NULL || callback == NULL) {
3221 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3222 return CAMERA_ERROR_INVALID_PARAMETER;
3224 int ret = CAMERA_ERROR_NONE;
3226 camera_cli_s *pc = (camera_cli_s *)camera;
3227 muse_camera_api_e api = MUSE_CAMERA_API_SET_STATE_CHANGED_CB;
3229 LOGD("Enter, handle :%x", pc->remote_handle);
3232 if (pc->cb_info == NULL) {
3233 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3234 return CAMERA_ERROR_INVALID_PARAMETER;
3236 sock_fd = pc->cb_info->fd;
3237 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = callback;
3238 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = user_data;
3240 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3241 LOGD("ret : 0x%x", ret);
3244 int camera_unset_state_changed_cb(camera_h camera)
3246 if (camera == NULL) {
3247 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3248 return CAMERA_ERROR_INVALID_PARAMETER;
3250 int ret = CAMERA_ERROR_NONE;
3252 camera_cli_s *pc = (camera_cli_s *)camera;
3253 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_STATE_CHANGED_CB;
3255 LOGD("Enter, handle :%x", pc->remote_handle);
3258 if (pc->cb_info == NULL) {
3259 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3260 return CAMERA_ERROR_INVALID_PARAMETER;
3262 sock_fd = pc->cb_info->fd;
3263 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = (void *)NULL;
3264 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = (void *)NULL;
3266 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3267 LOGD("ret : 0x%x", ret);
3271 int camera_set_interrupted_cb(camera_h camera, camera_interrupted_cb callback, void *user_data)
3273 if (camera == NULL || callback == NULL) {
3274 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3275 return CAMERA_ERROR_INVALID_PARAMETER;
3277 int ret = CAMERA_ERROR_NONE;
3279 camera_cli_s *pc = (camera_cli_s *)camera;
3280 muse_camera_api_e api = MUSE_CAMERA_API_SET_INTERRUPTED_CB;
3282 LOGD("Enter, handle :%x", pc->remote_handle);
3285 if (pc->cb_info == NULL) {
3286 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3287 return CAMERA_ERROR_INVALID_PARAMETER;
3289 sock_fd = pc->cb_info->fd;
3290 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = callback;
3291 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = user_data;
3293 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3294 LOGD("ret : 0x%x", ret);
3298 int camera_unset_interrupted_cb(camera_h camera)
3300 if (camera == NULL) {
3301 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3302 return CAMERA_ERROR_INVALID_PARAMETER;
3304 int ret = CAMERA_ERROR_NONE;
3306 camera_cli_s *pc = (camera_cli_s *)camera;
3307 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_INTERRUPTED_CB;
3309 LOGD("Enter, handle :%x", pc->remote_handle);
3312 if (pc->cb_info == NULL) {
3313 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3314 return CAMERA_ERROR_INVALID_PARAMETER;
3316 sock_fd = pc->cb_info->fd;
3317 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = (void *)NULL;
3318 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = (void *)NULL;
3320 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3321 LOGD("ret : 0x%x", ret);
3325 int camera_set_focus_changed_cb(camera_h camera, camera_focus_changed_cb callback, void *user_data)
3327 if (camera == NULL || callback == NULL) {
3328 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3329 return CAMERA_ERROR_INVALID_PARAMETER;
3331 int ret = CAMERA_ERROR_NONE;
3333 camera_cli_s *pc = (camera_cli_s *)camera;
3334 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOCUS_CHANGED_CB;
3336 LOGD("Enter, handle :%x", pc->remote_handle);
3339 if (pc->cb_info == NULL) {
3340 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3341 return CAMERA_ERROR_INVALID_PARAMETER;
3343 sock_fd = pc->cb_info->fd;
3344 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = callback;
3345 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = user_data;
3347 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3348 LOGD("ret : 0x%x", ret);
3352 int camera_unset_focus_changed_cb(camera_h camera)
3354 if (camera == NULL) {
3355 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3356 return CAMERA_ERROR_INVALID_PARAMETER;
3358 int ret = CAMERA_ERROR_NONE;
3360 camera_cli_s *pc = (camera_cli_s *)camera;
3361 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_FOCUS_CHANGED_CB;
3363 LOGD("Enter, handle :%x", pc->remote_handle);
3366 if (pc->cb_info == NULL) {
3367 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3368 return CAMERA_ERROR_INVALID_PARAMETER;
3370 sock_fd = pc->cb_info->fd;
3371 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = (void *)NULL;
3372 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = (void *)NULL;
3374 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3375 LOGD("ret : 0x%x", ret);
3379 int camera_set_error_cb(camera_h camera, camera_error_cb callback, void *user_data)
3381 if (camera == NULL || callback == NULL) {
3382 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3383 return CAMERA_ERROR_INVALID_PARAMETER;
3385 int ret = CAMERA_ERROR_NONE;
3387 camera_cli_s *pc = (camera_cli_s *)camera;
3388 muse_camera_api_e api = MUSE_CAMERA_API_SET_ERROR_CB;
3390 LOGD("Enter, handle :%x", pc->remote_handle);
3393 if (pc->cb_info == NULL) {
3394 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3395 return CAMERA_ERROR_INVALID_PARAMETER;
3397 sock_fd = pc->cb_info->fd;
3398 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_ERROR] = callback;
3399 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_ERROR] = user_data;
3401 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3402 LOGD("ret : 0x%x", ret);
3406 int camera_unset_error_cb(camera_h camera)
3408 if (camera == NULL) {
3409 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3410 return CAMERA_ERROR_INVALID_PARAMETER;
3412 int ret = CAMERA_ERROR_NONE;
3414 camera_cli_s *pc = (camera_cli_s *)camera;
3415 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_ERROR_CB;
3417 LOGD("Enter, handle :%x", pc->remote_handle);
3420 if (pc->cb_info == NULL) {
3421 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3422 return CAMERA_ERROR_INVALID_PARAMETER;
3424 sock_fd = pc->cb_info->fd;
3425 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_ERROR] = (void *)NULL;
3426 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_ERROR] = (void *)NULL;
3428 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3429 LOGD("ret : 0x%x", ret);
3433 int camera_foreach_supported_preview_resolution(camera_h camera, camera_supported_preview_resolution_cb foreach_cb , void *user_data)
3435 if (camera == NULL || foreach_cb == NULL) {
3436 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3437 return CAMERA_ERROR_INVALID_PARAMETER;
3439 int ret = CAMERA_ERROR_NONE;
3441 camera_cli_s *pc = (camera_cli_s *)camera;
3442 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_PREVIEW_RESOLUTION;
3444 LOGD("Enter, handle :%x", pc->remote_handle);
3447 if (pc->cb_info == NULL) {
3448 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3449 return CAMERA_ERROR_INVALID_PARAMETER;
3451 sock_fd = pc->cb_info->fd;
3452 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_RESOLUTION] = foreach_cb;
3453 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_RESOLUTION] = user_data;
3455 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3456 LOGD("ret : 0x%x", ret);
3460 int camera_foreach_supported_capture_resolution(camera_h camera, camera_supported_capture_resolution_cb foreach_cb , void *user_data)
3462 if (camera == NULL || foreach_cb == NULL) {
3463 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3464 return CAMERA_ERROR_INVALID_PARAMETER;
3466 int ret = CAMERA_ERROR_NONE;
3468 camera_cli_s *pc = (camera_cli_s *)camera;
3469 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_CAPTURE_RESOLUTION;
3471 LOGD("Enter, handle :%x", pc->remote_handle);
3474 if (pc->cb_info == NULL) {
3475 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3476 return CAMERA_ERROR_INVALID_PARAMETER;
3478 sock_fd = pc->cb_info->fd;
3479 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_RESOLUTION] = foreach_cb;
3480 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_RESOLUTION] = user_data;
3482 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3483 LOGD("ret : 0x%x", ret);
3487 int camera_foreach_supported_capture_format(camera_h camera, camera_supported_capture_format_cb foreach_cb , void *user_data)
3489 if (camera == NULL || foreach_cb == NULL) {
3490 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3491 return CAMERA_ERROR_INVALID_PARAMETER;
3493 int ret = CAMERA_ERROR_NONE;
3495 camera_cli_s *pc = (camera_cli_s *)camera;
3496 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_CAPTURE_FORMAT;
3498 LOGD("Enter, handle :%x", pc->remote_handle);
3501 if (pc->cb_info == NULL) {
3502 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3503 return CAMERA_ERROR_INVALID_PARAMETER;
3505 sock_fd = pc->cb_info->fd;
3506 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_FORMAT] = foreach_cb;
3507 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_FORMAT] = user_data;
3509 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3510 LOGD("ret : 0x%x", ret);
3515 int camera_foreach_supported_preview_format(camera_h camera, camera_supported_preview_format_cb foreach_cb , void *user_data)
3517 if (camera == NULL || foreach_cb == NULL) {
3518 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3519 return CAMERA_ERROR_INVALID_PARAMETER;
3521 int ret = CAMERA_ERROR_NONE;
3523 camera_cli_s *pc = (camera_cli_s *)camera;
3524 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_PREVIEW_FORMAT;
3526 LOGD("Enter, handle :%x", pc->remote_handle);
3529 if (pc->cb_info == NULL) {
3530 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3531 return CAMERA_ERROR_INVALID_PARAMETER;
3533 sock_fd = pc->cb_info->fd;
3534 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_FORMAT] = foreach_cb;
3535 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_FORMAT] = user_data;
3537 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3538 LOGD("ret : 0x%x", ret);
3543 int camera_get_recommended_preview_resolution(camera_h camera, int *width, int *height)
3545 if (camera == NULL || width == NULL || height == NULL) {
3546 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3547 return CAMERA_ERROR_INVALID_PARAMETER;
3549 int ret = CAMERA_ERROR_NONE;
3551 camera_cli_s *pc = (camera_cli_s *)camera;
3552 muse_camera_api_e api = MUSE_CAMERA_API_GET_RECOMMENDED_PREVIEW_RESOLUTION;
3554 if (pc->cb_info == NULL) {
3555 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3556 return CAMERA_ERROR_INVALID_PARAMETER;
3558 sock_fd = pc->cb_info->fd;
3562 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3563 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3565 if (ret == CAMERA_ERROR_NONE) {
3566 muse_camera_msg_get(get_width, pc->cb_info->recv_msg);
3567 muse_camera_msg_get(get_height, pc->cb_info->recv_msg);
3569 *height = get_height;
3571 LOGD("ret : 0x%x", ret);
3576 int camera_attr_get_lens_orientation(camera_h camera, int *angle)
3578 if (camera == NULL || angle == NULL) {
3579 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3580 return CAMERA_ERROR_INVALID_PARAMETER;
3582 int ret = CAMERA_ERROR_NONE;
3584 camera_cli_s *pc = (camera_cli_s *)camera;
3585 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_LENS_ORIENTATION;
3587 if (pc->cb_info == NULL) {
3588 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3589 return CAMERA_ERROR_INVALID_PARAMETER;
3591 sock_fd = pc->cb_info->fd;
3594 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3595 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3597 if (ret == CAMERA_ERROR_NONE) {
3598 muse_camera_msg_get(get_angle, pc->cb_info->recv_msg);
3601 LOGD("ret : 0x%x", ret);
3605 int camera_attr_set_theater_mode(camera_h camera, camera_attr_theater_mode_e mode)
3607 if (camera == NULL) {
3608 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3609 return CAMERA_ERROR_INVALID_PARAMETER;
3611 int ret = CAMERA_ERROR_NONE;
3612 camera_cli_s *pc = (camera_cli_s *)camera;
3613 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_THEATER_MODE;
3615 if (pc->cb_info == NULL) {
3616 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3617 return CAMERA_ERROR_INVALID_PARAMETER;
3619 sock_fd = pc->cb_info->fd;
3620 int set_mode = (int)mode;
3621 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3622 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
3623 LOGD("ret : 0x%x", ret);
3627 int camera_attr_get_theater_mode(camera_h camera, camera_attr_theater_mode_e *mode)
3629 if (camera == NULL || mode == NULL) {
3630 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3631 return CAMERA_ERROR_INVALID_PARAMETER;
3634 int ret = CAMERA_ERROR_NONE;
3635 camera_cli_s *pc = (camera_cli_s *)camera;
3636 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_THEATER_MODE;
3638 if (pc->cb_info == NULL) {
3639 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3640 return CAMERA_ERROR_INVALID_PARAMETER;
3642 sock_fd = pc->cb_info->fd;
3644 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3645 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3647 if (ret == CAMERA_ERROR_NONE) {
3648 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
3649 *mode = (camera_attr_theater_mode_e)get_mode;
3651 LOGD("ret : 0x%x", ret);
3655 int camera_attr_foreach_supported_theater_mode(camera_h camera, camera_attr_supported_theater_mode_cb foreach_cb, void *user_data)
3657 if (camera == NULL || foreach_cb == NULL) {
3658 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3659 return CAMERA_ERROR_INVALID_PARAMETER;
3661 int ret = CAMERA_ERROR_NONE;
3663 camera_cli_s *pc = (camera_cli_s *)camera;
3664 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_THEATER_MODE;
3666 LOGD("Enter, handle :%x", pc->remote_handle);
3669 if (pc->cb_info == NULL) {
3670 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3671 return CAMERA_ERROR_INVALID_PARAMETER;
3673 sock_fd = pc->cb_info->fd;
3674 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE] = foreach_cb;
3675 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE] = user_data;
3677 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3679 LOGD("Finish, return :%x", ret);
3684 int camera_attr_set_preview_fps(camera_h camera, camera_attr_fps_e fps)
3686 if (camera == NULL) {
3687 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3688 return CAMERA_ERROR_INVALID_PARAMETER;
3690 int ret = CAMERA_ERROR_NONE;
3691 camera_cli_s *pc = (camera_cli_s *)camera;
3692 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_PREVIEW_FPS;
3694 if (pc->cb_info == NULL) {
3695 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3696 return CAMERA_ERROR_INVALID_PARAMETER;
3698 sock_fd = pc->cb_info->fd;
3699 int set_fps = (int)fps;
3700 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3701 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_fps);
3702 LOGD("ret : 0x%x", ret);
3707 int camera_attr_set_image_quality(camera_h camera, int quality)
3709 if (camera == NULL) {
3710 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3711 return CAMERA_ERROR_INVALID_PARAMETER;
3713 int ret = CAMERA_ERROR_NONE;
3715 camera_cli_s *pc = (camera_cli_s *)camera;
3716 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_IMAGE_QUALITY;
3718 if (pc->cb_info == NULL) {
3719 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3720 return CAMERA_ERROR_INVALID_PARAMETER;
3722 sock_fd = pc->cb_info->fd;
3723 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3724 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, quality);
3725 LOGD("ret : 0x%x", ret);
3729 int camera_attr_get_preview_fps(camera_h camera, camera_attr_fps_e *fps)
3731 if (camera == NULL || fps == NULL) {
3732 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3733 return CAMERA_ERROR_INVALID_PARAMETER;
3735 int ret = CAMERA_ERROR_NONE;
3737 camera_cli_s *pc = (camera_cli_s *)camera;
3738 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_PREVIEW_FPS;
3741 if (pc->cb_info == NULL) {
3742 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3743 return CAMERA_ERROR_INVALID_PARAMETER;
3745 sock_fd = pc->cb_info->fd;
3747 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3748 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3750 if (ret == CAMERA_ERROR_NONE) {
3751 muse_camera_msg_get(get_fps, pc->cb_info->recv_msg);
3752 *fps = (camera_attr_fps_e)get_fps;
3754 LOGD("ret : 0x%x", ret);
3759 int camera_attr_get_image_quality(camera_h camera, int *quality)
3761 if (camera == NULL || quality == NULL) {
3762 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3763 return CAMERA_ERROR_INVALID_PARAMETER;
3765 int ret = CAMERA_ERROR_NONE;
3767 camera_cli_s *pc = (camera_cli_s *)camera;
3768 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_IMAGE_QUALITY;
3770 if (pc->cb_info == NULL) {
3771 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3772 return CAMERA_ERROR_INVALID_PARAMETER;
3774 sock_fd = pc->cb_info->fd;
3776 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3777 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3779 if (ret == CAMERA_ERROR_NONE) {
3780 muse_camera_msg_get(get_quality, pc->cb_info->recv_msg);
3781 *quality = get_quality;
3783 LOGD("ret : 0x%x", ret);
3788 int camera_attr_get_encoded_preview_bitrate(camera_h camera, int *bitrate)
3790 if (camera == NULL || bitrate == NULL) {
3791 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3792 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_ENCODED_PREVIEW_BITRATE;
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_bitrate, pc->cb_info->recv_msg);
3812 *bitrate = get_bitrate;
3814 LOGD("ret : 0x%x", ret);
3819 int camera_attr_set_encoded_preview_bitrate(camera_h camera, int bitrate)
3821 if (camera == NULL) {
3822 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3823 return CAMERA_ERROR_INVALID_PARAMETER;
3826 int ret = CAMERA_ERROR_NONE;
3828 camera_cli_s *pc = (camera_cli_s *)camera;
3829 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ENCODED_PREVIEW_BITRATE;
3831 if (pc->cb_info == NULL) {
3832 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3833 return CAMERA_ERROR_INVALID_PARAMETER;
3835 sock_fd = pc->cb_info->fd;
3836 int set_bitrate = bitrate;
3837 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3838 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_bitrate);
3839 LOGD("ret : 0x%x", ret);
3844 int camera_attr_get_encoded_preview_gop_interval(camera_h camera, int *interval)
3846 if (camera == NULL || interval == NULL) {
3847 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3848 return CAMERA_ERROR_INVALID_PARAMETER;
3851 int ret = CAMERA_ERROR_NONE;
3853 camera_cli_s *pc = (camera_cli_s *)camera;
3854 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ENCODED_PREVIEW_GOP_INTERVAL;
3856 if (pc->cb_info == NULL) {
3857 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3858 return CAMERA_ERROR_INVALID_PARAMETER;
3860 sock_fd = pc->cb_info->fd;
3861 int get_gop_interval;
3863 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3864 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3866 if (ret == CAMERA_ERROR_NONE) {
3867 muse_camera_msg_get(get_gop_interval, pc->cb_info->recv_msg);
3868 *interval = get_gop_interval;
3870 LOGD("ret : 0x%x", ret);
3875 int camera_attr_set_encoded_preview_gop_interval(camera_h camera, int interval)
3877 if (camera == NULL) {
3878 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3879 return CAMERA_ERROR_INVALID_PARAMETER;
3882 int ret = CAMERA_ERROR_NONE;
3884 camera_cli_s *pc = (camera_cli_s *)camera;
3885 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ENCODED_PREVIEW_GOP_INTERVAL;
3887 if (pc->cb_info == NULL) {
3888 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3889 return CAMERA_ERROR_INVALID_PARAMETER;
3891 sock_fd = pc->cb_info->fd;
3892 int set_gop_interval = interval;
3893 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3894 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_gop_interval);
3895 LOGD("ret : 0x%x", ret);
3900 int camera_attr_set_zoom(camera_h camera, int zoom)
3902 if (camera == NULL) {
3903 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3904 return CAMERA_ERROR_INVALID_PARAMETER;
3906 int ret = CAMERA_ERROR_NONE;
3908 camera_cli_s *pc = (camera_cli_s *)camera;
3909 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ZOOM;
3911 if (pc->cb_info == NULL) {
3912 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3913 return CAMERA_ERROR_INVALID_PARAMETER;
3915 sock_fd = pc->cb_info->fd;
3917 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3918 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, zoom);
3919 LOGD("ret : 0x%x", ret);
3923 int camera_attr_set_af_mode(camera_h camera, camera_attr_af_mode_e mode)
3925 if (camera == NULL) {
3926 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3927 return CAMERA_ERROR_INVALID_PARAMETER;
3929 int ret = CAMERA_ERROR_NONE;
3931 camera_cli_s *pc = (camera_cli_s *)camera;
3932 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_AF_MODE;
3934 if (pc->cb_info == NULL) {
3935 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3936 return CAMERA_ERROR_INVALID_PARAMETER;
3938 sock_fd = pc->cb_info->fd;
3939 int set_mode = (int)mode;
3940 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3941 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
3942 LOGD("ret : 0x%x", ret);
3946 int camera_attr_set_af_area(camera_h camera, int x, int y)
3948 if (camera == NULL) {
3949 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3950 return CAMERA_ERROR_INVALID_PARAMETER;
3952 int ret = CAMERA_ERROR_NONE;
3953 camera_cli_s *pc = (camera_cli_s *)camera;
3954 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_AF_AREA;
3955 int sock_fd = pc->cb_info->fd;
3956 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3957 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, x, INT, y);
3958 LOGD("ret : 0x%x", ret);
3963 int camera_attr_clear_af_area(camera_h camera)
3965 if (camera == NULL) {
3966 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3967 return CAMERA_ERROR_INVALID_PARAMETER;
3969 int ret = CAMERA_ERROR_NONE;
3971 camera_cli_s *pc = (camera_cli_s *)camera;
3972 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_CLEAR_AF_AREA;
3974 if (pc->cb_info == NULL) {
3975 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3976 return CAMERA_ERROR_INVALID_PARAMETER;
3978 sock_fd = pc->cb_info->fd;
3979 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3980 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3981 LOGD("ret : 0x%x", ret);
3986 int camera_attr_set_exposure_mode(camera_h camera, camera_attr_exposure_mode_e mode)
3988 if (camera == NULL) {
3989 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3990 return CAMERA_ERROR_INVALID_PARAMETER;
3993 if (mode < CAMERA_ATTR_EXPOSURE_MODE_OFF || mode > CAMERA_ATTR_EXPOSURE_MODE_CUSTOM) {
3994 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3995 return CAMERA_ERROR_INVALID_PARAMETER;
3998 int ret = CAMERA_ERROR_NONE;
3999 camera_cli_s *pc = (camera_cli_s *)camera;
4000 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EXPOSURE_MODE;
4001 int set_mode = (int)mode;
4003 if (pc->cb_info == NULL) {
4004 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4005 return CAMERA_ERROR_INVALID_PARAMETER;
4007 sock_fd = pc->cb_info->fd;
4008 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4009 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
4010 LOGD("ret : 0x%x", ret);
4015 int camera_attr_set_exposure(camera_h camera, int value)
4017 if (camera == NULL) {
4018 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4019 return CAMERA_ERROR_INVALID_PARAMETER;
4021 int ret = CAMERA_ERROR_NONE;
4023 camera_cli_s *pc = (camera_cli_s *)camera;
4024 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EXPOSURE;
4026 if (pc->cb_info == NULL) {
4027 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4028 return CAMERA_ERROR_INVALID_PARAMETER;
4030 sock_fd = pc->cb_info->fd;
4032 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4033 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, value);
4034 LOGD("ret : 0x%x", ret);
4039 int camera_attr_set_iso(camera_h camera, camera_attr_iso_e iso)
4041 if (camera == NULL) {
4042 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4043 return CAMERA_ERROR_INVALID_PARAMETER;
4045 int ret = CAMERA_ERROR_NONE;
4047 camera_cli_s *pc = (camera_cli_s *)camera;
4048 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ISO;
4050 if (pc->cb_info == NULL) {
4051 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4052 return CAMERA_ERROR_INVALID_PARAMETER;
4054 sock_fd = pc->cb_info->fd;
4055 int set_iso = (int)iso;
4056 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4057 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_iso);
4058 LOGD("ret : 0x%x", ret);
4063 int camera_attr_set_brightness(camera_h camera, int level)
4065 if (camera == NULL) {
4066 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4067 return CAMERA_ERROR_INVALID_PARAMETER;
4069 int ret = CAMERA_ERROR_NONE;
4071 camera_cli_s *pc = (camera_cli_s *)camera;
4072 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_BRIGHTNESS;
4074 if (pc->cb_info == NULL) {
4075 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4076 return CAMERA_ERROR_INVALID_PARAMETER;
4078 sock_fd = pc->cb_info->fd;
4080 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4081 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, level);
4082 LOGD("ret : 0x%x", ret);
4087 int camera_attr_set_contrast(camera_h camera, int level)
4089 if (camera == NULL) {
4090 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4091 return CAMERA_ERROR_INVALID_PARAMETER;
4093 int ret = CAMERA_ERROR_NONE;
4095 camera_cli_s *pc = (camera_cli_s *)camera;
4096 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_CONTRAST;
4098 if (pc->cb_info == NULL) {
4099 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4100 return CAMERA_ERROR_INVALID_PARAMETER;
4102 sock_fd = pc->cb_info->fd;
4104 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4105 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, level);
4106 LOGD("ret : 0x%x", ret);
4111 int camera_attr_set_whitebalance(camera_h camera, camera_attr_whitebalance_e wb)
4113 if (camera == NULL) {
4114 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4115 return CAMERA_ERROR_INVALID_PARAMETER;
4118 if (wb < CAMERA_ATTR_WHITE_BALANCE_NONE || wb > CAMERA_ATTR_WHITE_BALANCE_CUSTOM) {
4119 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_NOT_SUPPORTED);
4120 return CAMERA_ERROR_NOT_SUPPORTED;
4123 int ret = CAMERA_ERROR_NONE;
4125 camera_cli_s *pc = (camera_cli_s *)camera;
4126 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_WHITEBALANCE;
4128 if (pc->cb_info == NULL) {
4129 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4130 return CAMERA_ERROR_INVALID_PARAMETER;
4132 sock_fd = pc->cb_info->fd;
4133 int set_whitebalance = (int)wb;
4134 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4135 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_whitebalance);
4136 LOGD("ret : 0x%x", ret);
4141 int camera_attr_set_effect(camera_h camera, camera_attr_effect_mode_e effect)
4143 if (camera == NULL) {
4144 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4145 return CAMERA_ERROR_INVALID_PARAMETER;
4147 int ret = CAMERA_ERROR_NONE;
4149 camera_cli_s *pc = (camera_cli_s *)camera;
4150 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EFFECT;
4152 if (pc->cb_info == NULL) {
4153 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4154 return CAMERA_ERROR_INVALID_PARAMETER;
4156 sock_fd = pc->cb_info->fd;
4157 int set_effect = (int)effect;
4158 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4159 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_effect);
4160 LOGD("ret : 0x%x", ret);
4165 int camera_attr_set_scene_mode(camera_h camera, camera_attr_scene_mode_e mode)
4167 if (camera == NULL) {
4168 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4169 return CAMERA_ERROR_INVALID_PARAMETER;
4171 int ret = CAMERA_ERROR_NONE;
4173 camera_cli_s *pc = (camera_cli_s *)camera;
4174 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_SCENE_MODE;
4176 if (pc->cb_info == NULL) {
4177 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4178 return CAMERA_ERROR_INVALID_PARAMETER;
4180 sock_fd = pc->cb_info->fd;
4181 int set_mode = (int)mode;
4182 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4183 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
4184 LOGD("ret : 0x%x", ret);
4189 int camera_attr_enable_tag(camera_h camera, bool enable)
4191 if (camera == NULL) {
4192 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4193 return CAMERA_ERROR_INVALID_PARAMETER;
4195 int ret = CAMERA_ERROR_NONE;
4196 camera_cli_s *pc = (camera_cli_s *)camera;
4197 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_TAG;
4199 if (pc->cb_info == NULL) {
4200 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4201 return CAMERA_ERROR_INVALID_PARAMETER;
4203 sock_fd = pc->cb_info->fd;
4204 int set_enable = (int)enable;
4206 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4207 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
4208 LOGD("ret : 0x%x", ret);
4213 int camera_attr_set_tag_image_description(camera_h camera, const char *description)
4215 if (camera == NULL) {
4216 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4217 return CAMERA_ERROR_INVALID_PARAMETER;
4219 if (description == NULL) {
4220 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4221 return CAMERA_ERROR_INVALID_PARAMETER;
4223 int ret = CAMERA_ERROR_NONE;
4224 camera_cli_s *pc = (camera_cli_s *)camera;
4225 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_IMAGE_DESCRIPTION;
4227 if (pc->cb_info == NULL) {
4228 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4229 return CAMERA_ERROR_INVALID_PARAMETER;
4231 sock_fd = pc->cb_info->fd;
4232 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4233 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, STRING, description);
4234 LOGD("ret : 0x%x", ret);
4239 int camera_attr_set_tag_orientation(camera_h camera, camera_attr_tag_orientation_e orientation)
4241 if (camera == NULL) {
4242 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4243 return CAMERA_ERROR_INVALID_PARAMETER;
4245 int ret = CAMERA_ERROR_NONE;
4246 camera_cli_s *pc = (camera_cli_s *)camera;
4247 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_ORIENTATION;
4249 if (pc->cb_info == NULL) {
4250 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4251 return CAMERA_ERROR_INVALID_PARAMETER;
4253 sock_fd = pc->cb_info->fd;
4254 int set_orientation = (int)orientation;
4256 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4257 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_orientation);
4258 LOGD("ret : 0x%x", ret);
4263 int camera_attr_set_tag_software(camera_h camera, const char *software)
4265 if (camera == NULL) {
4266 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4267 return CAMERA_ERROR_INVALID_PARAMETER;
4269 if (software == NULL) {
4270 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4271 return CAMERA_ERROR_INVALID_PARAMETER;
4273 int ret = CAMERA_ERROR_NONE;
4274 camera_cli_s *pc = (camera_cli_s *)camera;
4275 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_SOFTWARE;
4277 if (pc->cb_info == NULL) {
4278 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4279 return CAMERA_ERROR_INVALID_PARAMETER;
4281 sock_fd = pc->cb_info->fd;
4282 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4283 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, STRING, software);
4284 LOGD("ret : 0x%x", ret);
4289 int camera_attr_set_geotag(camera_h camera, double latitude , double longitude, double altitude)
4291 if (camera == NULL) {
4292 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4293 return CAMERA_ERROR_INVALID_PARAMETER;
4295 int ret = CAMERA_ERROR_NONE;
4296 camera_cli_s *pc = (camera_cli_s *)camera;
4297 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_GEOTAG;
4299 if (pc->cb_info == NULL) {
4300 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4301 return CAMERA_ERROR_INVALID_PARAMETER;
4303 sock_fd = pc->cb_info->fd;
4304 double set_geotag[3] = { latitude, longitude, altitude };
4306 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4307 muse_camera_msg_send_array(api, sock_fd, pc->cb_info, ret,
4308 set_geotag, sizeof(set_geotag), sizeof(double));
4309 LOGD("ret : 0x%x", ret);
4314 int camera_attr_remove_geotag(camera_h camera)
4316 if (camera == NULL) {
4317 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4318 return CAMERA_ERROR_INVALID_PARAMETER;
4320 int ret = CAMERA_ERROR_NONE;
4321 camera_cli_s *pc = (camera_cli_s *)camera;
4322 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_REMOVE_GEOTAG;
4324 if (pc->cb_info == NULL) {
4325 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4326 return CAMERA_ERROR_INVALID_PARAMETER;
4328 sock_fd = pc->cb_info->fd;
4329 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4330 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4331 LOGD("ret : 0x%x", ret);
4336 int camera_attr_set_flash_mode(camera_h camera, camera_attr_flash_mode_e mode)
4338 if (camera == NULL) {
4339 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4340 return CAMERA_ERROR_INVALID_PARAMETER;
4342 int ret = CAMERA_ERROR_NONE;
4343 camera_cli_s *pc = (camera_cli_s *)camera;
4344 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_FLASH_MODE;
4346 if (pc->cb_info == NULL) {
4347 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4348 return CAMERA_ERROR_INVALID_PARAMETER;
4350 sock_fd = pc->cb_info->fd;
4351 int set_mode = (int)mode;
4353 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4354 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
4355 LOGD("ret : 0x%x", ret);
4360 int camera_attr_get_zoom(camera_h camera, int *zoom)
4362 if (camera == NULL || zoom == NULL) {
4363 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4364 return CAMERA_ERROR_INVALID_PARAMETER;
4366 int ret = CAMERA_ERROR_NONE;
4368 camera_cli_s *pc = (camera_cli_s *)camera;
4369 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ZOOM;
4372 if (pc->cb_info == NULL) {
4373 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4374 return CAMERA_ERROR_INVALID_PARAMETER;
4376 sock_fd = pc->cb_info->fd;
4378 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4379 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4381 if (ret == CAMERA_ERROR_NONE) {
4382 muse_camera_msg_get(get_zoom, pc->cb_info->recv_msg);
4385 LOGD("ret : 0x%x", ret);
4390 int camera_attr_get_zoom_range(camera_h camera, int *min, int *max)
4392 if (camera == NULL || min == NULL || max == NULL) {
4393 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4394 return CAMERA_ERROR_INVALID_PARAMETER;
4396 int ret = CAMERA_ERROR_NONE;
4397 camera_cli_s *pc = (camera_cli_s *)camera;
4399 if (pc->cb_info == NULL) {
4400 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4401 return CAMERA_ERROR_INVALID_PARAMETER;
4403 sock_fd = pc->cb_info->fd;
4404 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ZOOM_RANGE;
4408 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4409 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4411 if (ret == CAMERA_ERROR_NONE) {
4412 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
4413 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
4417 LOGD("ret : 0x%x", ret);
4422 int camera_attr_get_af_mode(camera_h camera, camera_attr_af_mode_e *mode)
4424 if (camera == NULL || mode == NULL) {
4425 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4426 return CAMERA_ERROR_INVALID_PARAMETER;
4428 int ret = CAMERA_ERROR_NONE;
4429 camera_cli_s *pc = (camera_cli_s *)camera;
4431 if (pc->cb_info == NULL) {
4432 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4433 return CAMERA_ERROR_INVALID_PARAMETER;
4435 sock_fd = pc->cb_info->fd;
4436 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_AF_MODE;
4439 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4440 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4442 if (ret == CAMERA_ERROR_NONE) {
4443 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
4444 *mode = (camera_attr_af_mode_e)get_mode;
4446 LOGD("ret : 0x%x", ret);
4451 int camera_attr_get_exposure_mode(camera_h camera, camera_attr_exposure_mode_e *mode)
4453 if (camera == NULL || mode == NULL) {
4454 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4455 return CAMERA_ERROR_INVALID_PARAMETER;
4457 int ret = CAMERA_ERROR_NONE;
4458 camera_cli_s *pc = (camera_cli_s *)camera;
4460 if (pc->cb_info == NULL) {
4461 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4462 return CAMERA_ERROR_INVALID_PARAMETER;
4464 sock_fd = pc->cb_info->fd;
4465 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE_MODE;
4468 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4469 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4471 if (ret == CAMERA_ERROR_NONE) {
4472 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
4473 *mode = (camera_attr_exposure_mode_e)get_mode;
4475 LOGD("ret : 0x%x", ret);
4479 int camera_attr_get_exposure(camera_h camera, int *value)
4481 if (camera == NULL || value == NULL) {
4482 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4483 return CAMERA_ERROR_INVALID_PARAMETER;
4485 int ret = CAMERA_ERROR_NONE;
4486 camera_cli_s *pc = (camera_cli_s *)camera;
4488 if (pc->cb_info == NULL) {
4489 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4490 return CAMERA_ERROR_INVALID_PARAMETER;
4492 sock_fd = pc->cb_info->fd;
4493 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE;
4496 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4497 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4499 if (ret == CAMERA_ERROR_NONE) {
4500 muse_camera_msg_get(get_value, pc->cb_info->recv_msg);
4503 LOGD("ret : 0x%x", ret);
4508 int camera_attr_get_exposure_range(camera_h camera, int *min, int *max)
4510 if (camera == NULL || min == NULL || max == NULL) {
4511 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4512 return CAMERA_ERROR_INVALID_PARAMETER;
4514 int ret = CAMERA_ERROR_NONE;
4515 camera_cli_s *pc = (camera_cli_s *)camera;
4517 if (pc->cb_info == NULL) {
4518 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4519 return CAMERA_ERROR_INVALID_PARAMETER;
4521 sock_fd = pc->cb_info->fd;
4522 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE_RANGE;
4526 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4527 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4529 if (ret == CAMERA_ERROR_NONE) {
4530 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
4531 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
4535 LOGD("ret : 0x%x", ret);
4540 int camera_attr_get_iso(camera_h camera, camera_attr_iso_e *iso)
4542 if (camera == NULL || iso == NULL) {
4543 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4544 return CAMERA_ERROR_INVALID_PARAMETER;
4546 int ret = CAMERA_ERROR_NONE;
4547 camera_cli_s *pc = (camera_cli_s *)camera;
4549 if (pc->cb_info == NULL) {
4550 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4551 return CAMERA_ERROR_INVALID_PARAMETER;
4553 sock_fd = pc->cb_info->fd;
4554 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ISO;
4557 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4558 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4560 if (ret == CAMERA_ERROR_NONE) {
4561 muse_camera_msg_get(get_iso, pc->cb_info->recv_msg);
4562 *iso = (camera_attr_iso_e)get_iso;
4564 LOGD("ret : 0x%x", ret);
4569 int camera_attr_get_brightness(camera_h camera, int *level)
4571 if (camera == NULL || level == NULL) {
4572 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4573 return CAMERA_ERROR_INVALID_PARAMETER;
4575 int ret = CAMERA_ERROR_NONE;
4576 camera_cli_s *pc = (camera_cli_s *)camera;
4578 if (pc->cb_info == NULL) {
4579 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4580 return CAMERA_ERROR_INVALID_PARAMETER;
4582 sock_fd = pc->cb_info->fd;
4583 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_BRIGHTNESS;
4586 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4587 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4589 if (ret == CAMERA_ERROR_NONE) {
4590 muse_camera_msg_get(get_level, pc->cb_info->recv_msg);
4593 LOGD("ret : 0x%x", ret);
4598 int camera_attr_get_brightness_range(camera_h camera, int *min, int *max)
4600 if (camera == NULL || min == NULL || max == NULL) {
4601 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4602 return CAMERA_ERROR_INVALID_PARAMETER;
4604 int ret = CAMERA_ERROR_NONE;
4605 camera_cli_s *pc = (camera_cli_s *)camera;
4607 if (pc->cb_info == NULL) {
4608 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4609 return CAMERA_ERROR_INVALID_PARAMETER;
4611 sock_fd = pc->cb_info->fd;
4612 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_BRIGHTNESS_RANGE;
4616 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4617 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4619 if (ret == CAMERA_ERROR_NONE) {
4620 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
4621 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
4625 LOGD("ret : 0x%x", ret);
4630 int camera_attr_get_contrast(camera_h camera, int *level)
4632 if (camera == NULL || level == NULL) {
4633 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4634 return CAMERA_ERROR_INVALID_PARAMETER;
4636 int ret = CAMERA_ERROR_NONE;
4637 camera_cli_s *pc = (camera_cli_s *)camera;
4638 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_CONTRAST;
4640 if (pc->cb_info == NULL) {
4641 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4642 return CAMERA_ERROR_INVALID_PARAMETER;
4644 sock_fd = pc->cb_info->fd;
4647 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4648 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4650 if (ret == CAMERA_ERROR_NONE) {
4651 muse_camera_msg_get(get_level, pc->cb_info->recv_msg);
4654 LOGD("ret : 0x%x", ret);
4659 int camera_attr_get_contrast_range(camera_h camera, int *min , int *max)
4661 if (camera == NULL || min == NULL || max == NULL) {
4662 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4663 return CAMERA_ERROR_INVALID_PARAMETER;
4665 int ret = CAMERA_ERROR_NONE;
4666 camera_cli_s *pc = (camera_cli_s *)camera;
4667 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_CONTRAST_RANGE;
4669 if (pc->cb_info == NULL) {
4670 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4671 return CAMERA_ERROR_INVALID_PARAMETER;
4673 sock_fd = pc->cb_info->fd;
4677 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4678 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4680 if (ret == CAMERA_ERROR_NONE) {
4681 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
4682 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
4686 LOGD("ret : 0x%x", ret);
4691 int camera_attr_get_whitebalance(camera_h camera, camera_attr_whitebalance_e *wb)
4693 if (camera == NULL || wb == NULL) {
4694 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4695 return CAMERA_ERROR_INVALID_PARAMETER;
4697 int ret = CAMERA_ERROR_NONE;
4698 camera_cli_s *pc = (camera_cli_s *)camera;
4699 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_WHITEBALANCE;
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;
4708 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4709 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4711 if (ret == CAMERA_ERROR_NONE) {
4712 muse_camera_msg_get(get_wb, pc->cb_info->recv_msg);
4713 *wb = (camera_attr_whitebalance_e)get_wb;
4715 LOGD("ret : 0x%x", ret);
4720 int camera_attr_get_effect(camera_h camera, camera_attr_effect_mode_e *effect)
4722 if (camera == NULL || effect == NULL) {
4723 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4724 return CAMERA_ERROR_INVALID_PARAMETER;
4727 int ret = CAMERA_ERROR_NONE;
4728 camera_cli_s *pc = (camera_cli_s *)camera;
4729 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EFFECT;
4731 if (pc->cb_info == NULL) {
4732 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4733 return CAMERA_ERROR_INVALID_PARAMETER;
4735 sock_fd = pc->cb_info->fd;
4738 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4739 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4741 if (ret == CAMERA_ERROR_NONE) {
4742 muse_camera_msg_get(get_effect, pc->cb_info->recv_msg);
4743 *effect = (camera_attr_effect_mode_e)get_effect;
4745 LOGD("ret : 0x%x", ret);
4750 int camera_attr_get_scene_mode(camera_h camera, camera_attr_scene_mode_e *mode)
4752 if (camera == NULL || mode == NULL) {
4753 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4754 return CAMERA_ERROR_INVALID_PARAMETER;
4757 int ret = CAMERA_ERROR_NONE;
4758 camera_cli_s *pc = (camera_cli_s *)camera;
4759 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_SCENE_MODE;
4761 if (pc->cb_info == NULL) {
4762 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4763 return CAMERA_ERROR_INVALID_PARAMETER;
4765 sock_fd = pc->cb_info->fd;
4768 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4769 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4771 if (ret == CAMERA_ERROR_NONE) {
4772 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
4773 *mode = (camera_attr_scene_mode_e)get_mode;
4775 LOGD("ret : 0x%x", ret);
4780 int camera_attr_is_enabled_tag(camera_h camera, bool *enable)
4782 if (camera == NULL || enable == NULL) {
4783 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4784 return CAMERA_ERROR_INVALID_PARAMETER;
4787 int ret = CAMERA_ERROR_NONE;
4788 camera_cli_s *pc = (camera_cli_s *)camera;
4789 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_TAG;
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;
4798 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4799 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4801 if (ret == CAMERA_ERROR_NONE) {
4802 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
4803 *enable = (bool)get_enabled;
4805 LOGD("ret : 0x%x", ret);
4810 int camera_attr_get_tag_image_description(camera_h camera, char **description)
4812 if (camera == NULL || description == NULL) {
4813 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4814 return CAMERA_ERROR_INVALID_PARAMETER;
4817 int ret = CAMERA_ERROR_NONE;
4818 camera_cli_s *pc = (camera_cli_s *)camera;
4819 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_IMAGE_DESCRIPTION;
4821 if (pc->cb_info == NULL) {
4822 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4823 return CAMERA_ERROR_INVALID_PARAMETER;
4825 sock_fd = pc->cb_info->fd;
4826 char get_description[MUSE_CAMERA_MSG_MAX_LENGTH] = {0,};
4828 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4829 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4831 if (ret == CAMERA_ERROR_NONE) {
4832 muse_camera_msg_get_string(get_description, pc->cb_info->recv_msg);
4833 *description = strdup(get_description);
4835 LOGD("ret : 0x%x", ret);
4840 int camera_attr_get_tag_orientation(camera_h camera, camera_attr_tag_orientation_e *orientation)
4842 if (camera == NULL || orientation == NULL) {
4843 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4844 return CAMERA_ERROR_INVALID_PARAMETER;
4847 int ret = CAMERA_ERROR_NONE;
4848 camera_cli_s *pc = (camera_cli_s *)camera;
4849 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_ORIENTATION;
4851 if (pc->cb_info == NULL) {
4852 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4853 return CAMERA_ERROR_INVALID_PARAMETER;
4855 sock_fd = pc->cb_info->fd;
4856 int get_orientation;
4858 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4859 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4861 if (ret == CAMERA_ERROR_NONE) {
4862 muse_camera_msg_get(get_orientation, pc->cb_info->recv_msg);
4863 *orientation = (camera_attr_tag_orientation_e)get_orientation;
4864 LOGD("success, orientation : %d", *orientation);
4866 LOGD("ret : 0x%x", ret);
4871 int camera_attr_get_tag_software(camera_h camera, char **software)
4873 if (camera == NULL || software == NULL) {
4874 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4875 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_TAG_SOFTWARE;
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;
4887 char get_software[MUSE_CAMERA_MSG_MAX_LENGTH] = {0,};
4889 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4890 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4892 if (ret == CAMERA_ERROR_NONE) {
4893 muse_camera_msg_get_string(get_software, pc->cb_info->recv_msg);
4894 *software = strdup(get_software);
4896 LOGD("ret : 0x%x", ret);
4901 int camera_attr_get_geotag(camera_h camera, double *latitude , double *longitude, double *altitude)
4903 if (camera == NULL || latitude == NULL || longitude == NULL || altitude == NULL) {
4904 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4905 return CAMERA_ERROR_INVALID_PARAMETER;
4908 int ret = CAMERA_ERROR_NONE;
4909 camera_cli_s *pc = (camera_cli_s *)camera;
4910 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_GEOTAG;
4911 double get_geotag[3] = {0,};
4913 if (pc->cb_info == NULL) {
4914 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4915 return CAMERA_ERROR_INVALID_PARAMETER;
4917 sock_fd = pc->cb_info->fd;
4919 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4921 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4923 if (ret == CAMERA_ERROR_NONE) {
4924 muse_camera_msg_get_array(get_geotag, pc->cb_info->recv_msg);
4925 *latitude = get_geotag[0];
4926 *longitude = get_geotag[1];
4927 *altitude = get_geotag[2];
4929 LOGD("ret : 0x%x", ret);
4931 LOGE("Returned value is not valid : 0x%x", ret);
4938 int camera_attr_get_flash_mode(camera_h camera, camera_attr_flash_mode_e *mode)
4940 if (camera == NULL || mode == NULL) {
4941 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4942 return CAMERA_ERROR_INVALID_PARAMETER;
4945 int ret = CAMERA_ERROR_NONE;
4946 camera_cli_s *pc = (camera_cli_s *)camera;
4947 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_FLASH_MODE;
4949 if (pc->cb_info == NULL) {
4950 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4951 return CAMERA_ERROR_INVALID_PARAMETER;
4953 sock_fd = pc->cb_info->fd;
4956 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4957 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4959 if (ret == CAMERA_ERROR_NONE) {
4960 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
4961 *mode = (camera_attr_flash_mode_e)get_mode;
4963 LOGD("ret : 0x%x", ret);
4967 int camera_get_flash_state(camera_device_e device, camera_flash_state_e *state)
4971 int ret = CAMERA_ERROR_NONE;
4972 camera_cli_s *pc = NULL;
4973 int get_flash_state = 0;
4975 /* create muse connection */
4976 muse_camera_api_e api = MUSE_CAMERA_API_GET_FLASH_STATE;
4977 muse_core_api_module_e muse_module = MUSE_CAMERA;
4978 int device_type = (int)device;
4980 sock_fd = muse_core_client_new();
4982 LOGE("muse_core_client_new failed - returned fd %d", sock_fd);
4983 ret = CAMERA_ERROR_INVALID_OPERATION;
4987 sndMsg = muse_core_msg_json_factory_new(api,
4988 MUSE_TYPE_INT, "module", muse_module,
4989 MUSE_TYPE_INT, PARAM_DEVICE_TYPE, device_type,
4992 muse_core_ipc_send_msg(sock_fd, sndMsg);
4993 muse_core_msg_json_factory_free(sndMsg);
4995 pc = g_new0(camera_cli_s, 1);
4997 LOGE("camera_cli_s alloc failed");
4998 ret = CAMERA_ERROR_OUT_OF_MEMORY;
5002 pc->cb_info = _client_callback_new(sock_fd);
5003 if (pc->cb_info == NULL) {
5004 LOGE("cb_info alloc failed");
5005 ret = CAMERA_ERROR_OUT_OF_MEMORY;
5009 ret = _client_wait_for_cb_return(api, pc->cb_info, CALLBACK_TIME_OUT);
5011 if (ret == CAMERA_ERROR_NONE) {
5012 muse_camera_msg_get(get_flash_state, pc->cb_info->recv_msg);
5013 *state = (camera_flash_state_e)get_flash_state;
5016 LOGD("Flash state : %d\n", *state);
5019 /* release resources */
5021 g_atomic_int_set(&pc->cb_info->msg_recv_running, 0);
5022 g_atomic_int_set(&pc->cb_info->msg_handler_running, 0);
5023 _client_callback_destroy(pc->cb_info);
5032 int camera_attr_foreach_supported_af_mode(camera_h camera, camera_attr_supported_af_mode_cb foreach_cb, void *user_data)
5034 if (camera == NULL || foreach_cb == NULL) {
5035 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5036 return CAMERA_ERROR_INVALID_PARAMETER;
5038 int ret = CAMERA_ERROR_NONE;
5040 camera_cli_s *pc = (camera_cli_s *)camera;
5041 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_AF_MODE;
5043 LOGD("Enter, handle :%x", pc->remote_handle);
5046 if (pc->cb_info == NULL) {
5047 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5048 return CAMERA_ERROR_INVALID_PARAMETER;
5050 sock_fd = pc->cb_info->fd;
5051 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_AF_MODE] = foreach_cb;
5052 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_AF_MODE] = user_data;
5054 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5055 LOGD("ret : 0x%x", ret);
5060 int camera_attr_foreach_supported_exposure_mode(camera_h camera, camera_attr_supported_exposure_mode_cb foreach_cb , void *user_data)
5062 if (camera == NULL || foreach_cb == NULL) {
5063 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5064 return CAMERA_ERROR_INVALID_PARAMETER;
5066 int ret = CAMERA_ERROR_NONE;
5068 camera_cli_s *pc = (camera_cli_s *)camera;
5069 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_EXPOSURE_MODE;
5071 LOGD("Enter, handle :%x", pc->remote_handle);
5074 if (pc->cb_info == NULL) {
5075 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5076 return CAMERA_ERROR_INVALID_PARAMETER;
5078 sock_fd = pc->cb_info->fd;
5079 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EXPOSURE_MODE] = foreach_cb;
5080 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EXPOSURE_MODE] = user_data;
5082 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5083 LOGD("ret : 0x%x", ret);
5088 int camera_attr_foreach_supported_iso(camera_h camera, camera_attr_supported_iso_cb foreach_cb, void *user_data)
5090 if (camera == NULL || foreach_cb == NULL) {
5091 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5092 return CAMERA_ERROR_INVALID_PARAMETER;
5094 int ret = CAMERA_ERROR_NONE;
5096 camera_cli_s *pc = (camera_cli_s *)camera;
5097 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_ISO;
5099 LOGD("Enter, handle :%x", pc->remote_handle);
5102 if (pc->cb_info == NULL) {
5103 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5104 return CAMERA_ERROR_INVALID_PARAMETER;
5106 sock_fd = pc->cb_info->fd;
5107 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_ISO] = foreach_cb;
5108 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_ISO] = user_data;
5110 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5111 LOGD("ret : 0x%x", ret);
5116 int camera_attr_foreach_supported_whitebalance(camera_h camera, camera_attr_supported_whitebalance_cb foreach_cb , void *user_data)
5118 if (camera == NULL || foreach_cb == NULL) {
5119 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5120 return CAMERA_ERROR_INVALID_PARAMETER;
5122 int ret = CAMERA_ERROR_NONE;
5124 camera_cli_s *pc = (camera_cli_s *)camera;
5125 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_WHITEBALANCE;
5127 LOGD("Enter, handle :%x", pc->remote_handle);
5130 if (pc->cb_info == NULL) {
5131 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5132 return CAMERA_ERROR_INVALID_PARAMETER;
5134 sock_fd = pc->cb_info->fd;
5135 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_WHITEBALANCE] = foreach_cb;
5136 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_WHITEBALANCE] = user_data;
5138 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5139 LOGD("ret : 0x%x", ret);
5144 int camera_attr_foreach_supported_effect(camera_h camera, camera_attr_supported_effect_cb foreach_cb , void *user_data)
5146 if (camera == NULL || foreach_cb == NULL) {
5147 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5148 return CAMERA_ERROR_INVALID_PARAMETER;
5150 int ret = CAMERA_ERROR_NONE;
5152 camera_cli_s *pc = (camera_cli_s *)camera;
5153 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_EFFECT;
5155 LOGD("Enter, handle :%x", pc->remote_handle);
5158 if (pc->cb_info == NULL) {
5159 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5160 return CAMERA_ERROR_INVALID_PARAMETER;
5162 sock_fd = pc->cb_info->fd;
5163 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EFFECT] = foreach_cb;
5164 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EFFECT] = user_data;
5166 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5167 LOGD("ret : 0x%x", ret);
5172 int camera_attr_foreach_supported_scene_mode(camera_h camera, camera_attr_supported_scene_mode_cb foreach_cb , void *user_data)
5174 if (camera == NULL || foreach_cb == NULL) {
5175 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5176 return CAMERA_ERROR_INVALID_PARAMETER;
5178 int ret = CAMERA_ERROR_NONE;
5180 camera_cli_s *pc = (camera_cli_s *)camera;
5181 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_SCENE_MODE;
5183 LOGD("Enter, handle :%x", pc->remote_handle);
5186 if (pc->cb_info == NULL) {
5187 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5188 return CAMERA_ERROR_INVALID_PARAMETER;
5190 sock_fd = pc->cb_info->fd;
5191 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_SCENE_MODE] = foreach_cb;
5192 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_SCENE_MODE] = user_data;
5194 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5195 LOGD("ret : 0x%x", ret);
5200 int camera_attr_foreach_supported_flash_mode(camera_h camera, camera_attr_supported_flash_mode_cb foreach_cb , void *user_data)
5202 if (camera == NULL || foreach_cb == NULL) {
5203 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5204 return CAMERA_ERROR_INVALID_PARAMETER;
5206 int ret = CAMERA_ERROR_NONE;
5208 camera_cli_s *pc = (camera_cli_s *)camera;
5209 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FLASH_MODE;
5211 LOGD("Enter, handle :%x", pc->remote_handle);
5214 if (pc->cb_info == NULL) {
5215 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5216 return CAMERA_ERROR_INVALID_PARAMETER;
5218 sock_fd = pc->cb_info->fd;
5219 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FLASH_MODE] = foreach_cb;
5220 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FLASH_MODE] = user_data;
5222 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5223 LOGD("ret : 0x%x", ret);
5228 int camera_attr_foreach_supported_fps(camera_h camera, camera_attr_supported_fps_cb foreach_cb , void *user_data)
5230 if (camera == NULL || foreach_cb == NULL) {
5231 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5232 return CAMERA_ERROR_INVALID_PARAMETER;
5234 int ret = CAMERA_ERROR_NONE;
5236 camera_cli_s *pc = (camera_cli_s *)camera;
5237 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FPS;
5239 if (pc->cb_info == NULL) {
5240 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5241 return CAMERA_ERROR_INVALID_PARAMETER;
5243 sock_fd = pc->cb_info->fd;
5244 LOGD("Enter, handle :%x", pc->remote_handle);
5245 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS] = foreach_cb;
5246 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS] = user_data;
5248 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5249 LOGD("Enter, handle :%x", pc->remote_handle);
5253 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)
5255 if (camera == NULL || foreach_cb == NULL) {
5256 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5257 return CAMERA_ERROR_INVALID_PARAMETER;
5259 int ret = CAMERA_ERROR_NONE;
5261 camera_cli_s *pc = (camera_cli_s *)camera;
5262 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FPS_BY_RESOLUTION;
5264 if (pc->cb_info == NULL) {
5265 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5266 return CAMERA_ERROR_INVALID_PARAMETER;
5268 sock_fd = pc->cb_info->fd;
5269 LOGD("Enter, handle :%x", pc->remote_handle);
5270 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS_BY_RESOLUTION] = foreach_cb;
5271 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS_BY_RESOLUTION] = user_data;
5273 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, width, INT, height);
5274 LOGD("ret : 0x%x", ret);
5278 int camera_attr_foreach_supported_stream_flip(camera_h camera, camera_attr_supported_stream_flip_cb foreach_cb, void *user_data)
5280 if (camera == NULL || foreach_cb == NULL) {
5281 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5282 return CAMERA_ERROR_INVALID_PARAMETER;
5284 int ret = CAMERA_ERROR_NONE;
5286 camera_cli_s *pc = (camera_cli_s *)camera;
5287 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_STREAM_FLIP;
5289 if (pc->cb_info == NULL) {
5290 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5291 return CAMERA_ERROR_INVALID_PARAMETER;
5293 sock_fd = pc->cb_info->fd;
5294 LOGD("Enter, handle :%x", pc->remote_handle);
5295 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_FLIP] = foreach_cb;
5296 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_FLIP] = user_data;
5298 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5299 LOGD("ret : 0x%x", ret);
5304 int camera_attr_foreach_supported_stream_rotation(camera_h camera, camera_attr_supported_stream_rotation_cb foreach_cb, void *user_data)
5306 if (camera == NULL || foreach_cb == NULL) {
5307 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5308 return CAMERA_ERROR_INVALID_PARAMETER;
5310 int ret = CAMERA_ERROR_NONE;
5312 camera_cli_s *pc = (camera_cli_s *)camera;
5313 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_STREAM_ROTATION;
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 LOGD("Enter, handle :%x", pc->remote_handle);
5321 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION] = foreach_cb;
5322 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION] = user_data;
5324 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5325 LOGD("ret : 0x%x", ret);
5330 int camera_attr_set_stream_rotation(camera_h camera , camera_rotation_e rotation)
5332 if (camera == NULL) {
5333 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5334 return CAMERA_ERROR_INVALID_PARAMETER;
5337 int ret = CAMERA_ERROR_NONE;
5338 camera_cli_s *pc = (camera_cli_s *)camera;
5339 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_STREAM_ROTATION;
5341 if (pc->cb_info == NULL) {
5342 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5343 return CAMERA_ERROR_INVALID_PARAMETER;
5345 sock_fd = pc->cb_info->fd;
5346 int set_rotation = (int)rotation;
5348 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5349 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_rotation);
5350 LOGD("ret : 0x%x", ret);
5355 int camera_attr_get_stream_rotation(camera_h camera , camera_rotation_e *rotation)
5357 if (camera == NULL || rotation == NULL) {
5358 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5359 return CAMERA_ERROR_INVALID_PARAMETER;
5362 int ret = CAMERA_ERROR_NONE;
5363 camera_cli_s *pc = (camera_cli_s *)camera;
5364 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_STREAM_ROTATION;
5366 if (pc->cb_info == NULL) {
5367 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5368 return CAMERA_ERROR_INVALID_PARAMETER;
5370 sock_fd = pc->cb_info->fd;
5373 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5374 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5376 if (ret == CAMERA_ERROR_NONE) {
5377 muse_camera_msg_get(get_rotation, pc->cb_info->recv_msg);
5378 *rotation = (camera_rotation_e)get_rotation;
5380 LOGD("ret : 0x%x", ret);
5385 int camera_attr_set_stream_flip(camera_h camera , camera_flip_e flip)
5387 if (camera == NULL) {
5388 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5389 return CAMERA_ERROR_INVALID_PARAMETER;
5392 int ret = CAMERA_ERROR_NONE;
5393 camera_cli_s *pc = (camera_cli_s *)camera;
5394 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_STREAM_FLIP;
5396 if (pc->cb_info == NULL) {
5397 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5398 return CAMERA_ERROR_INVALID_PARAMETER;
5400 sock_fd = pc->cb_info->fd;
5401 int set_flip = (int)flip;
5403 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5404 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_flip);
5405 LOGD("ret : 0x%x", ret);
5410 int camera_attr_get_stream_flip(camera_h camera , camera_flip_e *flip)
5412 if (camera == NULL || flip == NULL) {
5413 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5414 return CAMERA_ERROR_INVALID_PARAMETER;
5417 int ret = CAMERA_ERROR_NONE;
5418 camera_cli_s *pc = (camera_cli_s *)camera;
5419 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_STREAM_FLIP;
5421 if (pc->cb_info == NULL) {
5422 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5423 return CAMERA_ERROR_INVALID_PARAMETER;
5425 sock_fd = pc->cb_info->fd;
5428 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5429 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5431 if (ret == CAMERA_ERROR_NONE) {
5432 muse_camera_msg_get(get_flip, pc->cb_info->recv_msg);
5433 *flip = (camera_flip_e)get_flip;
5435 LOGD("ret : 0x%x", ret);
5439 int camera_attr_set_hdr_mode(camera_h camera, camera_attr_hdr_mode_e mode)
5441 if (camera == NULL) {
5442 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5443 return CAMERA_ERROR_INVALID_PARAMETER;
5446 int ret = CAMERA_ERROR_NONE;
5447 camera_cli_s *pc = (camera_cli_s *)camera;
5448 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_HDR_MODE;
5450 if (pc->cb_info == NULL) {
5451 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5452 return CAMERA_ERROR_INVALID_PARAMETER;
5454 sock_fd = pc->cb_info->fd;
5455 int set_mode = (int)mode;
5457 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5458 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
5459 LOGD("ret : 0x%x", ret);
5464 int camera_attr_get_hdr_mode(camera_h camera, camera_attr_hdr_mode_e *mode)
5466 if (camera == NULL) {
5467 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5468 return CAMERA_ERROR_INVALID_PARAMETER;
5471 LOGE("CAMERA_ERROR_NOT_SUPPORTED(0x%08x) - mode", CAMERA_ERROR_NOT_SUPPORTED);
5472 return CAMERA_ERROR_NOT_SUPPORTED;
5474 int ret = CAMERA_ERROR_NONE;
5475 camera_cli_s *pc = (camera_cli_s *)camera;
5476 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_HDR_MODE;
5478 if (pc->cb_info == NULL) {
5479 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5480 return CAMERA_ERROR_INVALID_PARAMETER;
5482 sock_fd = pc->cb_info->fd;
5485 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5486 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5488 if (ret == CAMERA_ERROR_NONE) {
5489 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
5490 *mode = (camera_attr_hdr_mode_e)get_mode;
5492 LOGD("ret : 0x%x", ret);
5497 bool camera_attr_is_supported_hdr_capture(camera_h camera)
5499 if (camera == NULL) {
5500 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5504 int ret = CAMERA_ERROR_NONE;
5505 camera_cli_s *pc = (camera_cli_s *)camera;
5506 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_HDR_CAPTURE;
5508 if (pc->cb_info == NULL) {
5509 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5510 return CAMERA_ERROR_INVALID_PARAMETER;
5512 sock_fd = pc->cb_info->fd;
5513 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5514 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5515 LOGD("ret : 0x%x", ret);
5520 int camera_attr_set_hdr_capture_progress_cb(camera_h camera, camera_attr_hdr_progress_cb callback, void *user_data)
5522 if (camera == NULL) {
5523 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5524 return CAMERA_ERROR_INVALID_PARAMETER;
5526 if (callback == NULL) {
5527 LOGE("CAMERA_ERROR_NOT_SUPPORTED(0x%08x) - callback", CAMERA_ERROR_NOT_SUPPORTED);
5528 return CAMERA_ERROR_NOT_SUPPORTED;
5530 int ret = CAMERA_ERROR_NONE;
5532 camera_cli_s *pc = (camera_cli_s *)camera;
5533 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_HDR_CAPTURE_PROGRESS_CB;
5535 if (pc->cb_info == NULL) {
5536 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5537 return CAMERA_ERROR_INVALID_PARAMETER;
5539 sock_fd = pc->cb_info->fd;
5540 LOGD("Enter, handle :%x", pc->remote_handle);
5542 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = callback;
5543 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = user_data;
5545 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5546 LOGD("ret : 0x%x", ret);
5551 int camera_attr_unset_hdr_capture_progress_cb(camera_h camera)
5553 if (camera == NULL) {
5554 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5555 return CAMERA_ERROR_INVALID_PARAMETER;
5558 int ret = CAMERA_ERROR_NONE;
5560 camera_cli_s *pc = (camera_cli_s *)camera;
5561 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_UNSET_HDR_CAPTURE_PROGRESS_CB;
5563 if (pc->cb_info == NULL) {
5564 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5565 return CAMERA_ERROR_INVALID_PARAMETER;
5567 sock_fd = pc->cb_info->fd;
5568 LOGD("Enter, handle :%x", pc->remote_handle);
5570 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = (void *)NULL;
5571 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = (void *)NULL;
5573 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5574 LOGD("ret : 0x%x", ret);
5579 int camera_attr_enable_anti_shake(camera_h camera, bool enable)
5581 if (camera == NULL) {
5582 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5583 return CAMERA_ERROR_INVALID_PARAMETER;
5586 int ret = CAMERA_ERROR_NONE;
5587 camera_cli_s *pc = (camera_cli_s *)camera;
5588 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_ANTI_SHAKE;
5590 if (pc->cb_info == NULL) {
5591 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5592 return CAMERA_ERROR_INVALID_PARAMETER;
5594 sock_fd = pc->cb_info->fd;
5595 int set_enable = (int)enable;
5597 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5598 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
5599 LOGD("ret : 0x%x", ret);
5604 int camera_attr_is_enabled_anti_shake(camera_h camera , bool *enabled)
5606 if (camera == NULL) {
5607 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5608 return CAMERA_ERROR_INVALID_PARAMETER;
5610 if (enabled == NULL) {
5611 LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER);
5612 return CAMERA_ERROR_NOT_SUPPORTED;
5614 int ret = CAMERA_ERROR_NONE;
5615 camera_cli_s *pc = (camera_cli_s *)camera;
5616 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_ANTI_SHAKE;
5618 if (pc->cb_info == NULL) {
5619 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5620 return CAMERA_ERROR_INVALID_PARAMETER;
5622 sock_fd = pc->cb_info->fd;
5625 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5626 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5628 if (ret == CAMERA_ERROR_NONE) {
5629 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
5630 *enabled = (bool)get_enabled;
5632 LOGD("ret : 0x%x", ret);
5637 bool camera_attr_is_supported_anti_shake(camera_h camera)
5640 if (camera == NULL) {
5641 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5645 int ret = CAMERA_ERROR_NONE;
5646 camera_cli_s *pc = (camera_cli_s *)camera;
5647 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_ANTI_SHAKE;
5649 if (pc->cb_info == NULL) {
5650 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5651 return CAMERA_ERROR_INVALID_PARAMETER;
5653 sock_fd = pc->cb_info->fd;
5654 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5655 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5656 LOGD("ret : 0x%x", ret);
5661 int camera_attr_enable_video_stabilization(camera_h camera, bool enable)
5663 if (camera == NULL) {
5664 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5665 return CAMERA_ERROR_INVALID_PARAMETER;
5668 int ret = CAMERA_ERROR_NONE;
5669 camera_cli_s *pc = (camera_cli_s *)camera;
5670 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_VIDEO_STABILIZATION;
5672 if (pc->cb_info == NULL) {
5673 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5674 return CAMERA_ERROR_INVALID_PARAMETER;
5676 sock_fd = pc->cb_info->fd;
5677 int set_enable = (int)enable;
5679 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5680 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
5681 LOGD("ret : 0x%x", ret);
5686 int camera_attr_is_enabled_video_stabilization(camera_h camera, bool *enabled)
5688 if (camera == NULL) {
5689 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5690 return CAMERA_ERROR_INVALID_PARAMETER;
5692 if (enabled == NULL) {
5693 LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER);
5694 return CAMERA_ERROR_NOT_SUPPORTED;
5696 int ret = CAMERA_ERROR_NONE;
5697 camera_cli_s *pc = (camera_cli_s *)camera;
5698 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_VIDEO_STABILIZATION;
5700 if (pc->cb_info == NULL) {
5701 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5702 return CAMERA_ERROR_INVALID_PARAMETER;
5704 sock_fd = pc->cb_info->fd;
5707 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5708 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5710 if (ret == CAMERA_ERROR_NONE) {
5711 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
5712 *enabled = (bool)get_enabled;
5714 LOGD("ret : 0x%x", ret);
5719 bool camera_attr_is_supported_video_stabilization(camera_h camera)
5721 if (camera == NULL) {
5722 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5726 int ret = CAMERA_ERROR_NONE;
5727 camera_cli_s *pc = (camera_cli_s *)camera;
5728 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_VIDEO_STABILIZATION;
5730 if (pc->cb_info == NULL) {
5731 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5732 return CAMERA_ERROR_INVALID_PARAMETER;
5734 sock_fd = pc->cb_info->fd;
5735 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5736 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5737 LOGD("ret : 0x%x", ret);
5742 int camera_attr_enable_auto_contrast(camera_h camera, bool enable)
5744 if (camera == NULL) {
5745 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5746 return CAMERA_ERROR_INVALID_PARAMETER;
5749 int ret = CAMERA_ERROR_NONE;
5750 camera_cli_s *pc = (camera_cli_s *)camera;
5751 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_AUTO_CONTRAST;
5753 if (pc->cb_info == NULL) {
5754 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5755 return CAMERA_ERROR_INVALID_PARAMETER;
5757 sock_fd = pc->cb_info->fd;
5758 int set_enable = (int)enable;
5760 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5761 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
5762 LOGD("ret : 0x%x", ret);
5767 int camera_attr_is_enabled_auto_contrast(camera_h camera, bool *enabled)
5769 if (camera == NULL) {
5770 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5771 return CAMERA_ERROR_INVALID_PARAMETER;
5773 if (enabled == NULL) {
5774 LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER);
5775 return CAMERA_ERROR_INVALID_PARAMETER;
5777 int ret = CAMERA_ERROR_NONE;
5778 camera_cli_s *pc = (camera_cli_s *)camera;
5779 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_AUTO_CONTRAST;
5781 if (pc->cb_info == NULL) {
5782 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5783 return CAMERA_ERROR_INVALID_PARAMETER;
5785 sock_fd = pc->cb_info->fd;
5788 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5789 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5791 if (ret == CAMERA_ERROR_NONE) {
5792 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
5793 *enabled = (bool)get_enabled;
5795 LOGD("ret : 0x%x", ret);
5800 bool camera_attr_is_supported_auto_contrast(camera_h camera)
5802 if (camera == NULL) {
5803 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5807 int ret = CAMERA_ERROR_NONE;
5808 camera_cli_s *pc = (camera_cli_s *)camera;
5809 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_AUTO_CONTRAST;
5811 if (pc->cb_info == NULL) {
5812 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5813 return CAMERA_ERROR_INVALID_PARAMETER;
5815 sock_fd = pc->cb_info->fd;
5816 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5817 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5818 LOGD("ret : 0x%x", ret);
5823 int camera_attr_disable_shutter_sound(camera_h camera, bool disable)
5825 if (camera == NULL) {
5826 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5827 return CAMERA_ERROR_INVALID_PARAMETER;
5830 int ret = CAMERA_ERROR_NONE;
5831 camera_cli_s *pc = (camera_cli_s *)camera;
5832 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_DISABLE_SHUTTER_SOUND;
5834 if (pc->cb_info == NULL) {
5835 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5836 return CAMERA_ERROR_INVALID_PARAMETER;
5838 sock_fd = pc->cb_info->fd;
5839 int set_disable = (int)disable;
5841 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5842 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_disable);
5843 LOGD("ret : 0x%x", ret);