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>
38 #else /* HAVE_WAYLAND */
40 #endif /* HAVE_WAYLAND */
41 #ifdef EVAS_RENDERER_SUPPORT
42 #include <mm_evas_renderer.h>
43 #endif /* EVAS_RENDERER_SUPPORT */
48 #define LOG_TAG "TIZEN_N_CAMERA"
52 static void __global(void *data, struct wl_registry *registry,
53 uint32_t name, const char *interface, uint32_t version)
55 struct tizen_surface **tz_surface = NULL;
62 tz_surface = (struct tizen_surface **)data;
65 LOGW("NULL interface");
69 LOGI("interface %s", interface);
71 if (strcmp(interface, "tizen_surface") == 0) {
72 LOGD("binding tizen surface for wayland");
74 *tz_surface = wl_registry_bind(registry, name, &tizen_surface_interface, version);
75 if (*tz_surface == NULL)
76 LOGE("failed to bind");
84 static void __global_remove(void *data, struct wl_registry *wl_registry, uint32_t name)
90 static const struct wl_registry_listener _camera_wl_registry_listener = {
95 void __parent_id_getter(void *data, struct tizen_resource *tizen_resource, uint32_t id)
102 *((unsigned int *)data) = id;
104 LOGD("[CLIENT] got parent_id [%u] from server", id);
109 static const struct tizen_resource_listener _camera_tz_resource_listener = {
113 int _get_wl_info(Evas_Object *obj, camera_wl_info_s *wl_info)
115 int ret = CAMERA_ERROR_NONE;
116 Ecore_Wl_Window *window = NULL;
117 struct wl_display *display = NULL;
118 struct wl_surface *surface = NULL;
119 struct wl_registry *registry = NULL;
120 struct tizen_surface *tz_surface = NULL;
121 struct tizen_resource *tz_resource = NULL;
123 if (!obj || !wl_info) {
124 LOGE("NULL parameter %p %p", obj, wl_info);
125 return CAMERA_ERROR_INVALID_OPERATION;
128 window = elm_win_wl_window_get(obj);
130 LOGE("failed to get wayland window");
131 ret = CAMERA_ERROR_INVALID_OPERATION;
135 surface = (struct wl_surface *)ecore_wl_window_surface_get(window);
137 LOGE("failed to get wayland surface");
138 ret = CAMERA_ERROR_INVALID_OPERATION;
142 display = (struct wl_display *)ecore_wl_display_get();
144 LOGE("failed to get wayland display");
145 ret = CAMERA_ERROR_INVALID_OPERATION;
149 registry = wl_display_get_registry(display);
151 LOGE("failed to get wayland registry");
152 ret = CAMERA_ERROR_INVALID_OPERATION;
156 wl_registry_add_listener(registry, &_camera_wl_registry_listener, &tz_surface);
158 wl_display_dispatch(display);
159 wl_display_roundtrip(display);
162 LOGE("failed to get tizen surface");
163 ret = CAMERA_ERROR_INVALID_OPERATION;
167 /* Get parent_id which is unique in a entire systemw. */
168 tz_resource = tizen_surface_get_tizen_resource(tz_surface, surface);
170 LOGE("failed to get tizen resurce");
171 ret = CAMERA_ERROR_INVALID_OPERATION;
175 wl_info->parent_id = 0;
177 tizen_resource_add_listener(tz_resource, &_camera_tz_resource_listener, &wl_info->parent_id);
179 wl_display_roundtrip(display);
181 if (wl_info->parent_id > 0) {
183 Ecore_Evas *ecore_evas = NULL;
184 ret = CAMERA_ERROR_NONE;
186 wl_info->evas_obj = obj;
188 evas_object_geometry_get(obj, &wl_info->window_x, &wl_info->window_y,
189 &wl_info->window_width, &wl_info->window_height);
191 ecore_evas = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
193 rotation = ecore_evas_rotation_get(ecore_evas);
194 if (rotation == 90 || rotation == 270) {
195 int temp = wl_info->window_width;
197 LOGD("swap width and height %d, %d", wl_info->window_width, wl_info->window_height);
199 wl_info->window_width = wl_info->window_height;
200 wl_info->window_height = temp;
203 LOGW("failed to get ecore_evas.. skip rotation check");
206 LOGD("evas object : %p, rotation : %d, parent id : %u, window : %d,%d,%dx%d",
207 wl_info->evas_obj, rotation, wl_info->parent_id,
208 wl_info->window_x, wl_info->window_y,
209 wl_info->window_width, wl_info->window_height);
211 ret = CAMERA_ERROR_INVALID_OPERATION;
212 LOGE("failed to get parent id");
217 tizen_surface_destroy(tz_surface);
222 tizen_resource_destroy(tz_resource);
227 wl_registry_destroy(registry);
233 #endif /* HAVE_WAYLAND */
235 static int _import_tbm_key(tbm_bufmgr bufmgr, unsigned int tbm_key, tbm_bo *bo, tbm_bo_handle *bo_handle)
237 tbm_bo tmp_bo = NULL;
238 tbm_bo_handle tmp_bo_handle = {NULL, };
240 if (bufmgr == NULL || bo == NULL || bo_handle == NULL || tbm_key == 0) {
241 LOGE("invalid parameter - bufmgr %p, bo %p, bo_handle %p, key %d",
242 bufmgr, bo, bo_handle, tbm_key);
246 tmp_bo = tbm_bo_import(bufmgr, tbm_key);
247 if (tmp_bo == NULL) {
248 LOGE("bo import failed - bufmgr %p, key %d", bufmgr, tbm_key);
252 tmp_bo_handle = tbm_bo_map(tmp_bo, TBM_DEVICE_CPU, TBM_OPTION_READ);
253 if (tmp_bo_handle.ptr == NULL) {
254 LOGE("bo map failed %p", tmp_bo);
255 tbm_bo_unref(tmp_bo);
260 tbm_bo_unmap(tmp_bo);
262 /* set bo and bo_handle */
264 *bo_handle = tmp_bo_handle;
269 static void _release_imported_bo(tbm_bo *bo)
271 if (bo == NULL || *bo == NULL) {
282 static int _client_wait_for_cb_return(muse_camera_api_e api, camera_cb_info_s *cb_info, int time_out)
284 int ret = CAMERA_ERROR_NONE;
287 /*LOGD("Enter api : %d", api);*/
289 g_mutex_lock(&(cb_info->api_mutex[api]));
291 if (cb_info->api_activating[api] == 0) {
292 end_time = g_get_monotonic_time() + time_out * G_TIME_SPAN_SECOND;
293 if (g_cond_wait_until(&(cb_info->api_cond[api]), &(cb_info->api_mutex[api]), end_time)) {
294 ret = cb_info->api_ret[api];
295 cb_info->api_activating[api] = 0;
297 /*LOGD("return value : 0x%x", ret);*/
299 ret = CAMERA_ERROR_INVALID_OPERATION;
301 LOGE("api %d was TIMED OUT!", api);
304 ret = cb_info->api_ret[api];
305 cb_info->api_activating[api] = 0;
307 /*LOGD("condition is already checked for the api[%d], return[0x%x]", api, ret);*/
310 g_mutex_unlock(&(cb_info->api_mutex[api]));
315 int _camera_get_tbm_surface_format(int in_format, uint32_t *out_format)
317 if (in_format <= MM_PIXEL_FORMAT_INVALID ||
318 in_format >= MM_PIXEL_FORMAT_NUM ||
319 out_format == NULL) {
320 LOGE("INVALID_PARAMETER : in_format %d, out_format ptr %p", in_format, out_format);
321 return CAMERA_ERROR_INVALID_PARAMETER;
325 case MM_PIXEL_FORMAT_NV12:
326 case MM_PIXEL_FORMAT_NV12T:
327 *out_format = TBM_FORMAT_NV12;
329 case MM_PIXEL_FORMAT_NV16:
330 *out_format = TBM_FORMAT_NV16;
332 case MM_PIXEL_FORMAT_NV21:
333 *out_format = TBM_FORMAT_NV21;
335 case MM_PIXEL_FORMAT_YUYV:
336 *out_format = TBM_FORMAT_YUYV;
338 case MM_PIXEL_FORMAT_UYVY:
339 case MM_PIXEL_FORMAT_ITLV_JPEG_UYVY:
340 *out_format = TBM_FORMAT_UYVY;
342 case MM_PIXEL_FORMAT_422P:
343 *out_format = TBM_FORMAT_YUV422;
345 case MM_PIXEL_FORMAT_I420:
346 *out_format = TBM_FORMAT_YUV420;
348 case MM_PIXEL_FORMAT_YV12:
349 *out_format = TBM_FORMAT_YVU420;
351 case MM_PIXEL_FORMAT_RGB565:
352 *out_format = TBM_FORMAT_RGB565;
354 case MM_PIXEL_FORMAT_RGB888:
355 *out_format = TBM_FORMAT_RGB888;
357 case MM_PIXEL_FORMAT_RGBA:
358 *out_format = TBM_FORMAT_RGBA8888;
360 case MM_PIXEL_FORMAT_ARGB:
361 *out_format = TBM_FORMAT_ARGB8888;
364 LOGE("invalid in_format %d", in_format);
365 return CAMERA_ERROR_INVALID_PARAMETER;
368 return CAMERA_ERROR_NONE;
372 int _camera_get_media_packet_mimetype(int in_format, media_format_mimetype_e *mimetype)
374 if (in_format <= MM_PIXEL_FORMAT_INVALID ||
375 in_format >= MM_PIXEL_FORMAT_NUM ||
377 LOGE("INVALID_PARAMETER : in_format %d, mimetype ptr %p", in_format, mimetype);
378 return CAMERA_ERROR_INVALID_PARAMETER;
382 case MM_PIXEL_FORMAT_NV12:
383 case MM_PIXEL_FORMAT_NV12T:
384 *mimetype = MEDIA_FORMAT_NV12;
386 case MM_PIXEL_FORMAT_NV16:
387 *mimetype = MEDIA_FORMAT_NV16;
389 case MM_PIXEL_FORMAT_NV21:
390 *mimetype = MEDIA_FORMAT_NV21;
392 case MM_PIXEL_FORMAT_YUYV:
393 *mimetype = MEDIA_FORMAT_YUYV;
395 case MM_PIXEL_FORMAT_UYVY:
396 case MM_PIXEL_FORMAT_ITLV_JPEG_UYVY:
397 *mimetype = MEDIA_FORMAT_UYVY;
399 case MM_PIXEL_FORMAT_422P:
400 *mimetype = MEDIA_FORMAT_422P;
402 case MM_PIXEL_FORMAT_I420:
403 *mimetype = MEDIA_FORMAT_I420;
405 case MM_PIXEL_FORMAT_YV12:
406 *mimetype = MEDIA_FORMAT_YV12;
408 case MM_PIXEL_FORMAT_RGB565:
409 *mimetype = MEDIA_FORMAT_RGB565;
411 case MM_PIXEL_FORMAT_RGB888:
412 *mimetype = MEDIA_FORMAT_RGB888;
414 case MM_PIXEL_FORMAT_RGBA:
415 *mimetype = MEDIA_FORMAT_RGBA;
417 case MM_PIXEL_FORMAT_ARGB:
418 *mimetype = MEDIA_FORMAT_ARGB;
421 LOGE("invalid in_format %d", in_format);
422 return CAMERA_ERROR_INVALID_PARAMETER;
425 return CAMERA_ERROR_NONE;
428 void _camera_preview_frame_create(camera_stream_data_s *stream, int num_buffer_key,
429 tbm_bo_handle *buffer_bo_handle, tbm_bo_handle *data_bo_handle, camera_preview_data_s *frame)
432 unsigned char *buf_pos = NULL;
434 if (stream == NULL || buffer_bo_handle == NULL || frame == NULL) {
435 LOGE("invalid parameter - stream:%p, buffer_bo_handle:%p", stream, buffer_bo_handle);
440 if (stream->format == MM_PIXEL_FORMAT_ITLV_JPEG_UYVY)
441 frame->format = MM_PIXEL_FORMAT_UYVY;
443 frame->format = stream->format;
445 frame->width = stream->width;
446 frame->height = stream->height;
447 frame->timestamp = stream->timestamp;
448 frame->num_of_planes = stream->num_planes;
450 if (num_buffer_key == 0) {
452 if (data_bo_handle == NULL || data_bo_handle->ptr == NULL) {
453 LOGE("no data pointer");
457 buf_pos = data_bo_handle->ptr;
459 if (stream->format == MM_PIXEL_FORMAT_ENCODED_H264) {
460 frame->data.encoded_plane.data = buf_pos;
461 frame->data.encoded_plane.size = stream->data.encoded.length_data;
462 total_size = stream->data.encoded.length_data;
464 switch (stream->num_planes) {
466 frame->data.single_plane.yuv = buf_pos;
467 frame->data.single_plane.size = stream->data.yuv420.length_yuv;
468 total_size = stream->data.yuv420.length_yuv;
471 frame->data.double_plane.y = buf_pos;
472 frame->data.double_plane.y_size = stream->data.yuv420sp.length_y;
473 buf_pos += stream->data.yuv420sp.length_y;
474 frame->data.double_plane.uv = buf_pos;
475 frame->data.double_plane.uv_size = stream->data.yuv420sp.length_uv;
476 total_size = stream->data.yuv420sp.length_y + \
477 stream->data.yuv420sp.length_uv;
480 frame->data.triple_plane.y = buf_pos;
481 frame->data.triple_plane.y_size = stream->data.yuv420p.length_y;
482 buf_pos += stream->data.yuv420p.length_y;
483 frame->data.triple_plane.u = buf_pos;
484 frame->data.triple_plane.u_size = stream->data.yuv420p.length_u;
485 buf_pos += stream->data.yuv420p.length_u;
486 frame->data.triple_plane.v = buf_pos;
487 frame->data.triple_plane.v_size = stream->data.yuv420p.length_v;
488 total_size = stream->data.yuv420p.length_y + \
489 stream->data.yuv420p.length_u + \
490 stream->data.yuv420p.length_v;
498 switch (stream->num_planes) {
500 frame->data.single_plane.yuv = buffer_bo_handle[0].ptr;
501 frame->data.single_plane.size = stream->data.yuv420.length_yuv;
502 total_size = stream->data.yuv420.length_yuv;
505 frame->data.double_plane.y = buffer_bo_handle[0].ptr;
506 if (stream->num_planes == (unsigned int)num_buffer_key)
507 frame->data.double_plane.uv = buffer_bo_handle[1].ptr;
509 frame->data.double_plane.uv = buffer_bo_handle[0].ptr + stream->data.yuv420sp.length_y;
510 frame->data.double_plane.y_size = stream->data.yuv420sp.length_y;
511 frame->data.double_plane.uv_size = stream->data.yuv420sp.length_uv;
512 total_size = stream->data.yuv420sp.length_y + \
513 stream->data.yuv420sp.length_uv;
516 frame->data.triple_plane.y = buffer_bo_handle[0].ptr;
517 if (stream->num_planes == (unsigned int)num_buffer_key) {
518 frame->data.triple_plane.u = buffer_bo_handle[1].ptr;
519 frame->data.triple_plane.v = buffer_bo_handle[2].ptr;
521 frame->data.triple_plane.u = buffer_bo_handle[0].ptr + stream->data.yuv420p.length_y;
522 frame->data.triple_plane.v = buffer_bo_handle[1].ptr + stream->data.yuv420p.length_u;
524 frame->data.triple_plane.y_size = stream->data.yuv420p.length_y;
525 frame->data.triple_plane.u_size = stream->data.yuv420p.length_u;
526 frame->data.triple_plane.v_size = stream->data.yuv420p.length_v;
527 total_size = stream->data.yuv420p.length_y + \
528 stream->data.yuv420p.length_u + \
529 stream->data.yuv420p.length_v;
537 LOGD("format %d, %dx%d, size %d plane num %d",
538 frame.format, frame.width, frame.height, total_size, frame.num_of_planes);
544 int _camera_media_packet_data_create(int tbm_key, int num_buffer_key, tbm_bo bo,
545 tbm_bo *buffer_bo, tbm_bo data_bo, camera_media_packet_data **mp_data)
548 int ret = CAMERA_ERROR_NONE;
549 camera_media_packet_data *tmp_mp_data = NULL;
551 if (*mp_data == NULL) {
552 tmp_mp_data = g_new0(camera_media_packet_data, 1);
554 tmp_mp_data->tbm_key = tbm_key;
555 tmp_mp_data->num_buffer_key = num_buffer_key;
556 tmp_mp_data->bo = bo;
557 tmp_mp_data->data_bo = data_bo;
558 tmp_mp_data->ref_cnt++;
560 for (i = 0 ; i < num_buffer_key ; i++)
561 tmp_mp_data->buffer_bo[i] = buffer_bo[i];
563 *mp_data = tmp_mp_data;
564 /*LOGD("mp_data %p", tmp_mp_data);*/
566 ret = CAMERA_ERROR_OUT_OF_MEMORY;
567 LOGE("failed to alloc media packet data");
570 ((camera_media_packet_data *)*mp_data)->ref_cnt++;
576 void _camera_media_packet_data_release(camera_media_packet_data *mp_data, camera_cb_info_s *cb_info)
581 if (mp_data == NULL || cb_info == NULL) {
582 LOGE("NULL data %p or cb_info %p", mp_data, cb_info);
586 if (mp_data->ref_cnt > 1) {
588 LOGD("mp_data is still referenced(current %d)", mp_data->ref_cnt);
590 /* release imported bo */
591 for (i = 0 ; i < mp_data->num_buffer_key ; i++) {
592 tbm_bo_unref(mp_data->buffer_bo[i]);
593 mp_data->buffer_bo[i] = NULL;
597 _release_imported_bo(&mp_data->bo);
598 _release_imported_bo(&mp_data->data_bo);
601 tbm_key = mp_data->tbm_key;
602 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
603 cb_info->fd, cb_info, INT, tbm_key);
612 int _camera_media_packet_create(camera_cb_info_s *cb_info, camera_stream_data_s *stream,
613 camera_media_packet_data *mp_data, media_packet_h *packet)
615 media_packet_h pkt = NULL;
616 bool make_pkt_fmt = false;
617 tbm_surface_h tsurf = NULL;
618 tbm_surface_info_s tsurf_info;
619 media_format_mimetype_e mimetype = MEDIA_FORMAT_NV12;
620 uint32_t bo_format = 0;
623 int num_buffer_key = 0;
624 tbm_bo *buffer_bo = NULL;
626 if (cb_info == NULL || stream == NULL || mp_data == NULL || packet == NULL) {
627 LOGE("invalid parameter - cb_info:%p, stream:%p, mp_data:%p, packet:%p",
628 cb_info, stream, mp_data, packet);
629 return CAMERA_ERROR_INVALID_PARAMETER;
632 memset(&tsurf_info, 0x0, sizeof(tbm_surface_info_s));
633 buffer_bo = mp_data->buffer_bo;
634 num_buffer_key = mp_data->num_buffer_key;
636 /* create tbm surface */
637 for (i = 0 ; i < BUFFER_MAX_PLANE_NUM ; i++)
638 tsurf_info.planes[i].stride = stream->stride[i];
640 /* get tbm surface format */
641 ret = _camera_get_tbm_surface_format(stream->format, &bo_format);
642 ret |= _camera_get_media_packet_mimetype(stream->format, &mimetype);
644 if (ret == CAMERA_ERROR_NONE) {
645 tsurf_info.width = stream->width;
646 tsurf_info.height = stream->height;
647 tsurf_info.format = bo_format;
648 tsurf_info.bpp = tbm_surface_internal_get_bpp(bo_format);
649 tsurf_info.num_planes = tbm_surface_internal_get_num_planes(bo_format);
651 if (num_buffer_key > 0) {
653 case TBM_FORMAT_NV12:
654 case TBM_FORMAT_NV21:
655 tsurf_info.planes[0].size = stream->stride[0] * stream->elevation[0];
656 tsurf_info.planes[1].size = stream->stride[1] * stream->elevation[1];
657 tsurf_info.planes[0].offset = 0;
658 if (num_buffer_key == 1)
659 tsurf_info.planes[1].offset = tsurf_info.planes[0].size;
660 tsurf_info.size = tsurf_info.planes[0].size + tsurf_info.planes[1].size;
662 case TBM_FORMAT_YUV420:
663 case TBM_FORMAT_YVU420:
664 tsurf_info.planes[0].size = stream->stride[0] * stream->elevation[0];
665 tsurf_info.planes[1].size = stream->stride[1] * stream->elevation[1];
666 tsurf_info.planes[2].size = stream->stride[2] * stream->elevation[2];
667 tsurf_info.planes[0].offset = 0;
668 if (num_buffer_key == 1) {
669 tsurf_info.planes[1].offset = tsurf_info.planes[0].size;
670 tsurf_info.planes[2].offset = tsurf_info.planes[0].size + tsurf_info.planes[1].size;
672 tsurf_info.size = tsurf_info.planes[0].size + tsurf_info.planes[1].size + tsurf_info.planes[2].size;
674 case TBM_FORMAT_UYVY:
675 case TBM_FORMAT_YUYV:
676 tsurf_info.planes[0].size = (stream->stride[0] * stream->elevation[0]) << 1;
677 tsurf_info.planes[0].offset = 0;
678 tsurf_info.size = tsurf_info.planes[0].size;
684 tsurf = tbm_surface_internal_create_with_bos(&tsurf_info, buffer_bo, num_buffer_key);
685 } else if (mp_data->data_bo) {
687 case TBM_FORMAT_NV12:
688 case TBM_FORMAT_NV21:
689 tsurf_info.planes[0].size = stream->width * stream->height;
690 tsurf_info.planes[1].size = (tsurf_info.planes[0].size) >> 1;
691 tsurf_info.planes[0].offset = 0;
692 tsurf_info.planes[1].offset = tsurf_info.planes[0].size;
693 tsurf_info.size = tsurf_info.planes[0].size + tsurf_info.planes[1].size;
695 case TBM_FORMAT_YUV420:
696 case TBM_FORMAT_YVU420:
697 tsurf_info.planes[0].size = stream->width * stream->height;
698 tsurf_info.planes[1].size = (stream->width >> 1) * (stream->height >> 1);
699 tsurf_info.planes[2].size = tsurf_info.planes[1].size;
700 tsurf_info.planes[0].offset = 0;
701 tsurf_info.planes[1].offset = tsurf_info.planes[0].size;
702 tsurf_info.planes[2].offset = tsurf_info.planes[0].size + tsurf_info.planes[1].size;
703 tsurf_info.size = tsurf_info.planes[0].size + tsurf_info.planes[1].size + tsurf_info.planes[2].size;
705 case TBM_FORMAT_UYVY:
706 case TBM_FORMAT_YUYV:
707 tsurf_info.planes[0].size = (stream->width * stream->height) << 1;
708 tsurf_info.planes[0].offset = 0;
709 tsurf_info.size = tsurf_info.planes[0].size;
715 tsurf = tbm_surface_internal_create_with_bos(&tsurf_info, &mp_data->data_bo, 1);
717 /*LOGD("tbm surface %p", tsurf);*/
721 /* check media packet format */
722 if (cb_info->pkt_fmt) {
723 int pkt_fmt_width = 0;
724 int pkt_fmt_height = 0;
725 media_format_mimetype_e pkt_fmt_mimetype = MEDIA_FORMAT_NV12;
727 media_format_get_video_info(cb_info->pkt_fmt, &pkt_fmt_mimetype, &pkt_fmt_width, &pkt_fmt_height, NULL, NULL);
728 if (pkt_fmt_mimetype != mimetype ||
729 pkt_fmt_width != stream->width ||
730 pkt_fmt_height != stream->height) {
731 LOGW("different format. current 0x%x, %dx%d, new 0x%x, %dx%d",
732 pkt_fmt_mimetype, pkt_fmt_width, pkt_fmt_height, mimetype, stream->width, stream->height);
733 media_format_unref(cb_info->pkt_fmt);
734 cb_info->pkt_fmt = NULL;
741 /* create packet format */
743 LOGW("make new pkt_fmt - mimetype 0x%x, %dx%d", mimetype, stream->width, stream->height);
744 ret = media_format_create(&cb_info->pkt_fmt);
745 if (ret == MEDIA_FORMAT_ERROR_NONE) {
746 ret = media_format_set_video_mime(cb_info->pkt_fmt, mimetype);
747 ret |= media_format_set_video_width(cb_info->pkt_fmt, stream->width);
748 ret |= media_format_set_video_height(cb_info->pkt_fmt, stream->height);
749 LOGW("media_format_set_video_mime,width,height ret : 0x%x", ret);
751 LOGW("media_format_create failed");
755 /* create media packet */
756 ret = media_packet_create_from_tbm_surface(cb_info->pkt_fmt,
757 tsurf, (media_packet_finalize_cb)_camera_media_packet_finalize,
758 (void *)cb_info, &pkt);
759 if (ret != MEDIA_PACKET_ERROR_NONE) {
760 LOGE("media_packet_create_from_tbm_surface failed");
762 tbm_surface_destroy(tsurf);
766 LOGE("failed to create tbm surface %dx%d, format %d, num_buffer_key %d, data_bo %p",
767 stream->width, stream->height, stream->format, num_buffer_key, mp_data->data_bo);
771 LOGD("media packet %p, internal buffer %p", pkt, stream->internal_buffer);
773 /* set media packet data */
774 ret = media_packet_set_extra(pkt, (void *)mp_data);
775 if (ret != MEDIA_PACKET_ERROR_NONE) {
776 LOGE("media_packet_set_extra failed");
778 _camera_media_packet_data_release(mp_data, cb_info);
781 media_packet_destroy(pkt);
784 /* set timestamp : msec -> nsec */
785 if (media_packet_set_pts(pkt, (uint64_t)(stream->timestamp) * 1000000) != MEDIA_PACKET_ERROR_NONE)
786 LOGW("media_packet_set_pts failed");
795 int _camera_media_packet_finalize(media_packet_h pkt, int error_code, void *user_data)
798 camera_cb_info_s *cb_info = (camera_cb_info_s *)user_data;
799 camera_media_packet_data *mp_data = NULL;
800 tbm_surface_h tsurf = NULL;
802 if (pkt == NULL || cb_info == NULL) {
803 LOGE("invalid parameter buffer %p, cb_info %p", pkt, cb_info);
804 return MEDIA_PACKET_FINALIZE;
807 ret = media_packet_get_extra(pkt, (void **)&mp_data);
808 if (ret != MEDIA_PACKET_ERROR_NONE) {
809 LOGE("media_packet_get_extra failed 0x%x", ret);
810 return MEDIA_PACKET_FINALIZE;
813 /*LOGD("mp_data %p", mp_data);*/
815 g_mutex_lock(&cb_info->mp_data_mutex);
817 _camera_media_packet_data_release(mp_data, cb_info);
820 g_mutex_unlock(&cb_info->mp_data_mutex);
822 ret = media_packet_get_tbm_surface(pkt, &tsurf);
823 if (ret != MEDIA_PACKET_ERROR_NONE) {
824 LOGE("media_packet_get_tbm_surface failed 0x%x", ret);
825 return MEDIA_PACKET_FINALIZE;
829 tbm_surface_destroy(tsurf);
833 return MEDIA_PACKET_FINALIZE;
836 static void _client_user_callback(camera_cb_info_s *cb_info, char *recv_msg, muse_camera_event_e event)
842 tbm_bo_handle bo_handle = {NULL, };
844 if (recv_msg == NULL || event >= MUSE_CAMERA_EVENT_TYPE_NUM) {
845 LOGE("invalid parameter - camera msg %p, event %d", recv_msg, event);
849 LOGD("get camera msg %s, event %d", recv_msg, event);
851 if (event == MUSE_CAMERA_EVENT_TYPE_PREVIEW) {
852 if (!(CHECK_PREVIEW_CB(cb_info, PREVIEW_CB_TYPE_EVAS)) &&
853 cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW] == NULL &&
854 cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] == NULL) {
855 LOGW("all preview callback from user are NULL");
858 } else if (cb_info->user_cb[event] == NULL) {
859 LOGW("user callback for event %d is not set", event);
864 case MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE:
870 muse_camera_msg_get(previous, recv_msg);
871 muse_camera_msg_get(current, recv_msg);
872 muse_camera_msg_get(by_policy, recv_msg);
874 LOGD("STATE CHANGE - previous %d, current %d, by_policy %d",
875 previous, current, by_policy);
877 ((camera_state_changed_cb)cb_info->user_cb[event])((camera_state_e)previous,
878 (camera_state_e)current, (bool)by_policy, cb_info->user_data[event]);
881 case MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE:
885 muse_camera_msg_get(state, recv_msg);
887 LOGD("FOCUS state - %d", state);
889 ((camera_focus_changed_cb)cb_info->user_cb[event])((camera_focus_state_e)state, cb_info->user_data[event]);
892 case MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE:
893 LOGD("CAPTURE_COMPLETED");
894 ((camera_capture_completed_cb)cb_info->user_cb[event])(cb_info->user_data[event]);
896 case MUSE_CAMERA_EVENT_TYPE_PREVIEW:
897 case MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW:
899 int e_type = MUSE_CAMERA_EVENT_TYPE_PREVIEW;
902 int num_buffer_key = 0;
903 int buffer_key[BUFFER_MAX_PLANE_NUM] = {0, };
905 unsigned char *buf_pos = NULL;
907 tbm_bo buffer_bo[BUFFER_MAX_PLANE_NUM] = {NULL, };
908 tbm_bo_handle buffer_bo_handle[BUFFER_MAX_PLANE_NUM] = {{.ptr = NULL}, };
909 tbm_bo data_bo = NULL;
910 tbm_bo_handle data_bo_handle = {.ptr = NULL};
912 camera_preview_data_s frame;
913 camera_stream_data_s *stream = NULL;
914 camera_media_packet_data *mp_data = NULL;
915 media_packet_h pkt = NULL;
917 muse_camera_msg_get(tbm_key, recv_msg);
918 muse_camera_msg_get(num_buffer_key, recv_msg);
919 muse_camera_msg_get_array(buffer_key, recv_msg);
920 muse_camera_msg_get(data_key, recv_msg);
922 memset(&frame, 0x0, sizeof(camera_preview_data_s));
925 LOGE("invalid key %d", tbm_key);
930 /* import tbm data_bo and get virtual address */
931 if (!_import_tbm_key(cb_info->bufmgr, data_key, &data_bo, &data_bo_handle)) {
932 LOGE("failed to import data key %d", data_key);
933 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
934 cb_info->fd, cb_info, INT, tbm_key);
939 /* import tbm bo and get virtual address */
940 if (!_import_tbm_key(cb_info->bufmgr, tbm_key, &bo, &bo_handle)) {
941 LOGE("failed to import key %d", tbm_key);
942 _release_imported_bo(&data_bo);
943 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
944 cb_info->fd, cb_info, INT, tbm_key);
948 buf_pos = (unsigned char *)bo_handle.ptr;
950 /* get stream info */
951 stream = (camera_stream_data_s *)buf_pos;
953 for (i = 0 ; i < num_buffer_key ; i++) {
954 /* import buffer bo and get virtual address */
955 if (!_import_tbm_key(cb_info->bufmgr, buffer_key[i], &buffer_bo[i], &buffer_bo_handle[i])) {
956 LOGE("failed to import buffer key %d", buffer_key[i]);
958 /* release imported bo */
959 _release_imported_bo(&data_bo);
960 _release_imported_bo(&bo);
962 for (i -= 1 ; i >= 0 ; i--)
963 _release_imported_bo(&buffer_bo[i]);
965 /* send return buffer */
966 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
967 cb_info->fd, cb_info, INT, tbm_key);
973 /* call preview callback */
974 if (cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW]) {
975 _camera_preview_frame_create(stream, num_buffer_key, buffer_bo_handle, &data_bo_handle, &frame);
977 e_type = MUSE_CAMERA_EVENT_TYPE_PREVIEW;
978 ((camera_preview_cb)cb_info->user_cb[e_type])(&frame, cb_info->user_data[e_type]);
981 /* call media packet callback */
982 if (cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW]) {
983 ret = _camera_media_packet_data_create(tbm_key, num_buffer_key, bo, buffer_bo, data_bo, &mp_data);
985 if (ret == CAMERA_ERROR_NONE) {
986 ret = _camera_media_packet_create(cb_info, stream, mp_data, &pkt);
988 e_type = MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW;
989 if (ret == CAMERA_ERROR_NONE) {
990 ((camera_media_packet_preview_cb)cb_info->user_cb[e_type])(pkt, cb_info->user_data[e_type]);
992 _camera_media_packet_data_release(mp_data, cb_info);
998 /* call evas renderer */
999 if (CHECK_PREVIEW_CB(cb_info, PREVIEW_CB_TYPE_EVAS)) {
1000 #ifdef EVAS_RENDERER_SUPPORT
1001 ret = _camera_media_packet_data_create(tbm_key, num_buffer_key, bo, buffer_bo, data_bo, &mp_data);
1003 if (ret == CAMERA_ERROR_NONE) {
1004 ret = _camera_media_packet_create(cb_info, stream, mp_data, &pkt);
1006 if (ret == CAMERA_ERROR_NONE) {
1007 g_mutex_lock(&cb_info->evas_mutex);
1009 if (cb_info->run_evas_render)
1010 mm_evas_renderer_write(pkt, cb_info->evas_info);
1012 LOGW("evas renderer is stopped, skip this buffer...");
1013 media_packet_destroy(pkt);
1018 g_mutex_unlock(&cb_info->evas_mutex);
1020 _camera_media_packet_data_release(mp_data, cb_info);
1024 #else /* EVAS_RENDERER_SUPPORT */
1025 LOGW("evas renderer is not supported");
1026 #endif /* EVAS_RENDERER_SUPPORT */
1029 /* send message for preview callback return */
1030 if (!CHECK_PREVIEW_CB(cb_info, PREVIEW_CB_TYPE_EVAS))
1031 muse_camera_msg_send_no_return(MUSE_CAMERA_API_PREVIEW_CB_RETURN, cb_info->fd, cb_info);
1033 if (mp_data == NULL) {
1034 /* release imported bo */
1035 for (i = 0 ; i < num_buffer_key ; i++)
1036 _release_imported_bo(&buffer_bo[i]);
1038 /* unmap and unref tbm bo */
1039 _release_imported_bo(&data_bo);
1040 _release_imported_bo(&bo);
1043 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
1044 cb_info->fd, cb_info, INT, tbm_key);
1046 /*LOGD("return buffer Done");*/
1050 case MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS:
1054 muse_camera_msg_get(percent, recv_msg);
1056 LOGD("HDR progress - %d \%", percent);
1058 ((camera_attr_hdr_progress_cb)cb_info->user_cb[event])(percent, cb_info->user_data[event]);
1061 case MUSE_CAMERA_EVENT_TYPE_INTERRUPTED:
1067 muse_camera_msg_get(policy, recv_msg);
1068 muse_camera_msg_get(previous, recv_msg);
1069 muse_camera_msg_get(current, recv_msg);
1071 LOGD("INTERRUPTED - policy %d, state previous %d, current %d",
1072 policy, previous, current);
1074 ((camera_interrupted_cb)cb_info->user_cb[event])((camera_policy_e)policy,
1075 (camera_state_e)previous, (camera_state_e)current, cb_info->user_data[event]);
1078 case MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION:
1081 camera_detected_face_s *faces = NULL;
1083 muse_camera_msg_get(count, recv_msg);
1084 muse_camera_msg_get(tbm_key, recv_msg);
1086 if (count > 0 && tbm_key > 0) {
1087 LOGD("FACE_DETECTION - count %d, tbm_key %d", count, tbm_key);
1089 if (!_import_tbm_key(cb_info->bufmgr, tbm_key, &bo, &bo_handle))
1093 faces = bo_handle.ptr;
1095 ((camera_face_detected_cb)cb_info->user_cb[event])(faces, count, cb_info->user_data[event]);
1101 for (i = 0 ; i < count ; i++) {
1102 LOGD("id[%2d] - score %d, position (%d,%d,%dx%d)",
1103 i, faces[i].score, faces[i].x, faces[i].y, faces[i].width, faces[i].height);
1109 _release_imported_bo(&bo);
1112 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
1113 cb_info->fd, cb_info, INT, tbm_key);
1115 LOGD("return buffer done");
1117 LOGE("invalid message - count %d, key %d", count, tbm_key);
1121 case MUSE_CAMERA_EVENT_TYPE_ERROR:
1124 int current_state = 0;
1126 muse_camera_msg_get(error, recv_msg);
1127 muse_camera_msg_get(current_state, recv_msg);
1129 LOGE("ERROR - error 0x%x, current_state %d", error, current_state);
1131 ((camera_error_cb)cb_info->user_cb[event])((camera_error_e)error,
1132 (camera_state_e)current_state, cb_info->user_data[event]);
1135 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_RESOLUTION:
1136 muse_camera_msg_get(param1, recv_msg);
1137 muse_camera_msg_get(param2, recv_msg);
1139 LOGD("SUPPORTED_PREVIEW_RESOLUTION - %d x %d", param1, param2);
1141 if (((camera_supported_preview_resolution_cb)cb_info->user_cb[event])(param1, param2, cb_info->user_data[event]) == false) {
1142 cb_info->user_cb[event] = NULL;
1143 cb_info->user_data[event] = NULL;
1144 LOGD("stop foreach callback for SUPPORTED_PREVIEW_RESOLUTION");
1147 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_RESOLUTION:
1148 muse_camera_msg_get(param1, recv_msg);
1149 muse_camera_msg_get(param2, recv_msg);
1151 LOGD("SUPPORTED_CAPTURE_RESOLUTION - %d x %d", param1, param2);
1153 if (((camera_supported_capture_resolution_cb)cb_info->user_cb[event])(param1, param2, 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_CAPTURE_RESOLUTION");
1159 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_FORMAT:
1160 muse_camera_msg_get(param1, recv_msg);
1162 LOGD("SUPPORTED_CAPTURE_FORMAT - %d ", param1);
1164 if (((camera_supported_capture_format_cb)cb_info->user_cb[event])((camera_pixel_format_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_CAPTURE_FORMAT");
1170 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_FORMAT:
1171 muse_camera_msg_get(param1, recv_msg);
1173 LOGD("SUPPORTED_PREVIEW_FORMAT - %d ", param1);
1175 if (((camera_supported_preview_format_cb)cb_info->user_cb[event])((camera_pixel_format_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_PREVIEW_FORMAT");
1181 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_AF_MODE:
1182 muse_camera_msg_get(param1, recv_msg);
1184 LOGD("SUPPORTED_AF_MODE - %d ", param1);
1186 if (((camera_attr_supported_af_mode_cb)cb_info->user_cb[event])((camera_attr_af_mode_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_AF_MODE");
1192 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EXPOSURE_MODE:
1193 muse_camera_msg_get(param1, recv_msg);
1195 LOGD("SUPPORTED_EXPOSURE_MODE - %d ", param1);
1197 if (((camera_attr_supported_exposure_mode_cb)cb_info->user_cb[event])((camera_attr_exposure_mode_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_EXPOSURE_MODE");
1203 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_ISO:
1204 muse_camera_msg_get(param1, recv_msg);
1206 LOGD("SUPPORTED_ISO - %d ", param1);
1208 if (((camera_attr_supported_iso_cb)cb_info->user_cb[event])((camera_attr_iso_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_ISO");
1214 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_WHITEBALANCE:
1215 muse_camera_msg_get(param1, recv_msg);
1217 LOGD("SUPPORTED_WHITEBALANCE - %d ", param1);
1219 if (((camera_attr_supported_whitebalance_cb)cb_info->user_cb[event])((camera_attr_whitebalance_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_WHITEBALANCE");
1225 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EFFECT:
1226 muse_camera_msg_get(param1, recv_msg);
1228 LOGD("SUPPORTED_EFFECT - %d ", param1);
1230 if (((camera_attr_supported_effect_cb)cb_info->user_cb[event])((camera_attr_effect_mode_e)param1, cb_info->user_data[event]) == false) {
1231 cb_info->user_cb[event] = NULL;
1232 cb_info->user_data[event] = NULL;
1233 LOGD("stop foreach callback for SUPPORTED_EFFECT");
1236 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_SCENE_MODE:
1237 muse_camera_msg_get(param1, recv_msg);
1239 LOGD("SUPPORTED_SCENE_MODE - %d ", param1);
1241 if (((camera_attr_supported_scene_mode_cb)cb_info->user_cb[event])((camera_attr_scene_mode_e)param1, cb_info->user_data[event]) == false) {
1242 cb_info->user_cb[event] = NULL;
1243 cb_info->user_data[event] = NULL;
1244 LOGD("stop foreach callback for SUPPORTED_SCENE_MODE");
1247 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FLASH_MODE:
1248 muse_camera_msg_get(param1, recv_msg);
1250 LOGD("SUPPORTED_FLASH_MODE - %d ", param1);
1252 if (((camera_attr_supported_flash_mode_cb)cb_info->user_cb[event])((camera_attr_flash_mode_e)param1, cb_info->user_data[event]) == false) {
1253 cb_info->user_cb[event] = NULL;
1254 cb_info->user_data[event] = NULL;
1255 LOGD("stop foreach callback for SUPPORTED_FLASH_MODE");
1258 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS:
1259 muse_camera_msg_get(param1, recv_msg);
1261 LOGD("SUPPORTED_FPS - %d ", param1);
1263 if (((camera_attr_supported_fps_cb)cb_info->user_cb[event])((camera_attr_fps_e)param1, cb_info->user_data[event]) == false) {
1264 cb_info->user_cb[event] = NULL;
1265 cb_info->user_data[event] = NULL;
1266 LOGD("stop foreach callback for SUPPORTED_FPS");
1269 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS_BY_RESOLUTION:
1270 muse_camera_msg_get(param1, recv_msg);
1272 LOGD("SUPPORTED_FPS_BY_RESOLUTION - %d ", param1);
1274 if (((camera_attr_supported_fps_cb)cb_info->user_cb[event])((camera_attr_fps_e)param1, cb_info->user_data[event]) == false) {
1275 cb_info->user_cb[event] = NULL;
1276 cb_info->user_data[event] = NULL;
1277 LOGD("stop foreach callback for SUPPORTED_FPS_BY_RESOLUTION");
1280 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_FLIP:
1281 muse_camera_msg_get(param1, recv_msg);
1283 LOGD("SUPPORTED_STREAM_FLIP - %d ", param1);
1285 if (((camera_attr_supported_stream_flip_cb)cb_info->user_cb[event])((camera_flip_e)param1, cb_info->user_data[event]) == false) {
1286 cb_info->user_cb[event] = NULL;
1287 cb_info->user_data[event] = NULL;
1288 LOGD("stop foreach callback for SUPPORTED_STREAM_FLIP");
1291 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION:
1292 muse_camera_msg_get(param1, recv_msg);
1294 LOGD("SUPPORTED_STREAM_ROTATION - %d ", param1);
1296 if (((camera_attr_supported_stream_rotation_cb)cb_info->user_cb[event])((camera_rotation_e)param1, cb_info->user_data[event]) == false) {
1297 cb_info->user_cb[event] = NULL;
1298 cb_info->user_data[event] = NULL;
1299 LOGD("stop foreach callback for SUPPORTED_STREAM_ROTATION");
1302 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE:
1303 muse_camera_msg_get(param1, recv_msg);
1305 LOGD("SUPPORTED_THEATER_MODE - %d ", param1);
1307 if (((camera_attr_supported_theater_mode_cb)cb_info->user_cb[event])((camera_attr_theater_mode_e)param1, cb_info->user_data[event]) == false) {
1308 cb_info->user_cb[event] = NULL;
1309 cb_info->user_data[event] = NULL;
1310 LOGD("stop foreach callback for SUPPORTED_THEATER_MODE");
1313 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PTZ_TYPE:
1314 muse_camera_msg_get(param1, recv_msg);
1316 LOGD("SUPPORTED_PTZ_TYPE - %d ", param1);
1318 if (((camera_attr_supported_ptz_type_cb)cb_info->user_cb[event])((camera_attr_ptz_type_e)param1, cb_info->user_data[event]) == false) {
1319 cb_info->user_cb[event] = NULL;
1320 cb_info->user_data[event] = NULL;
1321 LOGD("stop foreach callback for SUPPORTED_PTZ_TYPE");
1324 case MUSE_CAMERA_EVENT_TYPE_CAPTURE:
1326 camera_image_data_s *rImage = NULL;
1327 camera_image_data_s *rPostview = NULL;
1328 camera_image_data_s *rThumbnail = NULL;
1329 unsigned char *buf_pos = NULL;
1330 int tbm_key_main = 0;
1331 int tbm_key_post = 0;
1332 int tbm_key_thumb = 0;
1333 tbm_bo bo_main = NULL;
1334 tbm_bo bo_post = NULL;
1335 tbm_bo bo_thumb = NULL;
1336 tbm_bo_handle bo_main_handle = {NULL, };
1337 tbm_bo_handle bo_post_handle = {NULL, };
1338 tbm_bo_handle bo_thumb_handle = {NULL, };
1340 muse_camera_msg_get(tbm_key_main, recv_msg);
1341 muse_camera_msg_get(tbm_key_post, recv_msg);
1342 muse_camera_msg_get(tbm_key_thumb, recv_msg);
1344 LOGD("camera capture callback came in. tbm_key_main %d, tbm_key_post %d, tbm_key_thumb %d",
1345 tbm_key_main, tbm_key_post, tbm_key_thumb);
1347 if (tbm_key_main <= 0) {
1348 LOGE("invalid tbm_key_main %d", tbm_key_main);
1352 /* import tbm bo and get virtual address */
1353 if (!_import_tbm_key(cb_info->bufmgr, tbm_key_main, &bo_main, &bo_main_handle))
1356 buf_pos = (unsigned char *)bo_main_handle.ptr;
1357 rImage = (camera_image_data_s *)buf_pos;
1358 rImage->data = buf_pos + sizeof(camera_image_data_s);
1360 LOGD("image info %dx%d, size : %d", rImage->height, rImage->width, rImage->size);
1362 if (tbm_key_post > 0) {
1363 /* import tbm bo and get virtual address */
1364 if (!_import_tbm_key(cb_info->bufmgr, tbm_key_post, &bo_post, &bo_post_handle))
1367 buf_pos = (unsigned char *)bo_post_handle.ptr;
1368 rPostview = (camera_image_data_s *)buf_pos;
1369 LOGD("rPostview->size : %d", rPostview->size);
1370 rPostview->data = buf_pos + sizeof(camera_image_data_s);
1373 if (tbm_key_thumb > 0) {
1374 /* import tbm bo and get virtual address */
1375 if (!_import_tbm_key(cb_info->bufmgr, tbm_key_thumb, &bo_thumb, &bo_thumb_handle))
1378 buf_pos = (unsigned char *)bo_thumb_handle.ptr;
1380 rThumbnail = (camera_image_data_s *)buf_pos;
1381 LOGD("rThumbnail->size : %d", rThumbnail->size);
1382 rThumbnail->data = buf_pos + sizeof(camera_image_data_s);
1385 ((camera_capturing_cb)cb_info->user_cb[event])(rImage, rPostview, rThumbnail, cb_info->user_data[event]);
1387 /* unmap and unref tbm bo */
1388 _release_imported_bo(&bo_main);
1391 tbm_key = tbm_key_main;
1392 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
1393 cb_info->fd, cb_info, INT, tbm_key);
1395 if (tbm_key_post > 0) {
1396 /* unmap and unref tbm bo */
1397 _release_imported_bo(&bo_post);
1400 tbm_key = tbm_key_post;
1401 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
1402 cb_info->fd, cb_info, INT, tbm_key);
1405 if (tbm_key_thumb > 0) {
1406 /* unmap and unref tbm bo */
1407 _release_imported_bo(&bo_thumb);
1410 tbm_key = tbm_key_thumb;
1411 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
1412 cb_info->fd, cb_info, INT, tbm_key);
1415 LOGD("return buffer done");
1418 case MUSE_CAMERA_EVENT_TYPE_VIDEO_FRAME_RENDER_ERROR:
1421 LOGW("Unknown event : %d", event);
1428 static bool _camera_idle_event_callback(void *data)
1430 camera_cb_info_s *cb_info = NULL;
1431 camera_idle_event_s *cam_idle_event = (camera_idle_event_s *)data;
1433 if (cam_idle_event == NULL) {
1434 LOGE("cam_idle_event is NULL");
1439 g_mutex_lock(&cam_idle_event->event_mutex);
1441 cb_info = cam_idle_event->cb_info;
1442 if (cb_info == NULL) {
1443 LOGW("camera cb_info is NULL. event %d", cam_idle_event->event);
1444 goto IDLE_EVENT_CALLBACK_DONE;
1447 /* remove event from list */
1448 g_mutex_lock(&cb_info->idle_event_mutex);
1449 if (cb_info->idle_event_list)
1450 cb_info->idle_event_list = g_list_remove(cb_info->idle_event_list, (gpointer)cam_idle_event);
1452 /*LOGD("remove camera idle event %p, %p", cam_idle_event, cb_info->idle_event_list);*/
1453 g_mutex_unlock(&cb_info->idle_event_mutex);
1456 _client_user_callback(cam_idle_event->cb_info, cam_idle_event->recv_msg, cam_idle_event->event);
1458 /* send signal for waiting thread */
1459 g_cond_signal(&cb_info->idle_event_cond);
1461 IDLE_EVENT_CALLBACK_DONE:
1462 /* unlock and release event */
1463 g_mutex_unlock(&cam_idle_event->event_mutex);
1464 g_mutex_clear(&cam_idle_event->event_mutex);
1466 g_free(cam_idle_event);
1467 cam_idle_event = NULL;
1472 static void *_camera_msg_handler_func(gpointer data)
1477 int event_class = 0;
1478 camera_message_s *cam_msg = NULL;
1479 camera_idle_event_s *cam_idle_event = NULL;
1480 camera_cb_info_s *cb_info = (camera_cb_info_s *)data;
1482 if (cb_info == NULL) {
1483 LOGE("cb_info NULL");
1489 g_mutex_lock(&cb_info->msg_handler_mutex);
1491 while (g_atomic_int_get(&cb_info->msg_handler_running)) {
1492 if (g_queue_is_empty(cb_info->msg_queue)) {
1493 /*LOGD("signal wait...");*/
1494 g_cond_wait(&cb_info->msg_handler_cond, &cb_info->msg_handler_mutex);
1495 /*LOGD("signal received");*/
1497 if (g_atomic_int_get(&cb_info->msg_handler_running) == 0) {
1498 LOGD("stop event thread");
1503 cam_msg = (camera_message_s *)g_queue_pop_head(cb_info->msg_queue);
1505 g_mutex_unlock(&cb_info->msg_handler_mutex);
1507 if (cam_msg == NULL) {
1508 LOGE("NULL message");
1509 g_mutex_lock(&cb_info->msg_handler_mutex);
1515 if (api < MUSE_CAMERA_API_MAX) {
1516 g_mutex_lock(&cb_info->api_mutex[api]);
1518 if (muse_camera_msg_get(ret, cam_msg->recv_msg)) {
1519 cb_info->api_ret[api] = ret;
1520 cb_info->api_activating[api] = 1;
1522 /*LOGD("camera api %d - return 0x%x", ret);*/
1524 g_cond_signal(&cb_info->api_cond[api]);
1526 LOGE("failed to get camera ret for api %d, msg %s", api, cam_msg->recv_msg);
1529 g_mutex_unlock(&cb_info->api_mutex[api]);
1530 } else if (api == MUSE_CAMERA_CB_EVENT) {
1534 if (!muse_camera_msg_get(event, cam_msg->recv_msg) ||
1535 !muse_camera_msg_get(event_class, cam_msg->recv_msg)) {
1536 LOGE("failed to get camera event %d, class %d", event, event_class);
1541 g_mutex_lock(&cb_info->msg_handler_mutex);
1545 switch (event_class) {
1546 case MUSE_CAMERA_EVENT_CLASS_THREAD_SUB:
1547 _client_user_callback(cb_info, cam_msg->recv_msg, event);
1549 case MUSE_CAMERA_EVENT_CLASS_THREAD_MAIN:
1550 cam_idle_event = g_new0(camera_idle_event_s, 1);
1551 if (cam_idle_event == NULL) {
1552 LOGE("cam_idle_event alloc failed");
1556 cam_idle_event->event = event;
1557 cam_idle_event->cb_info = cb_info;
1558 g_mutex_init(&cam_idle_event->event_mutex);
1559 memcpy(cam_idle_event->recv_msg, cam_msg->recv_msg, sizeof(cam_idle_event->recv_msg));
1561 /*LOGD("add camera event[%d, %p] to IDLE", event, cam_idle_event);*/
1563 g_mutex_lock(&cb_info->idle_event_mutex);
1564 cb_info->idle_event_list = g_list_append(cb_info->idle_event_list, (gpointer)cam_idle_event);
1565 g_mutex_unlock(&cb_info->idle_event_mutex);
1567 g_idle_add_full(G_PRIORITY_DEFAULT,
1568 (GSourceFunc)_camera_idle_event_callback,
1569 (gpointer)cam_idle_event,
1573 LOGE("unknown camera event class %d", event_class);
1577 LOGE("unknown camera api[%d] message[%s]", api, cam_msg->recv_msg);
1583 g_mutex_lock(&cb_info->msg_handler_mutex);
1586 /* remove remained event */
1587 while (!g_queue_is_empty(cb_info->msg_queue)) {
1588 cam_msg = (camera_message_s *)g_queue_pop_head(cb_info->msg_queue);
1590 LOGD("remove camera message %p", cam_msg);
1594 LOGW("NULL camera message");
1598 g_mutex_unlock(&cb_info->msg_handler_mutex);
1605 static void _camera_remove_idle_event_all(camera_cb_info_s *cb_info)
1607 camera_idle_event_s *cam_idle_event = NULL;
1608 gboolean ret = TRUE;
1610 gint64 end_time = 0;
1612 if (cb_info == NULL) {
1613 LOGE("cb_info is NULL");
1617 g_mutex_lock(&cb_info->idle_event_mutex);
1619 if (cb_info->idle_event_list == NULL) {
1620 LOGD("No idle event is remained.");
1622 list = cb_info->idle_event_list;
1625 cam_idle_event = list->data;
1626 list = g_list_next(list);
1628 if (!cam_idle_event) {
1629 LOGW("Fail to remove idle event. The event is NULL");
1631 if (g_mutex_trylock(&cam_idle_event->event_mutex)) {
1632 ret = g_idle_remove_by_data(cam_idle_event);
1634 LOGD("remove idle event [%p], ret[%d]", cam_idle_event, ret);
1637 cam_idle_event->cb_info = NULL;
1638 LOGW("idle callback for event %p will be called later", cam_idle_event);
1641 cb_info->idle_event_list = g_list_remove(cb_info->idle_event_list, (gpointer)cam_idle_event);
1643 g_mutex_unlock(&cam_idle_event->event_mutex);
1646 g_mutex_clear(&cam_idle_event->event_mutex);
1648 g_free(cam_idle_event);
1649 cam_idle_event = NULL;
1651 LOGD("remove idle event done");
1654 LOGW("event lock failed. it's being called...");
1656 end_time = g_get_monotonic_time() + G_TIME_SPAN_MILLISECOND * 100;
1658 if (g_cond_wait_until(&cb_info->idle_event_cond, &cb_info->idle_event_mutex, end_time))
1659 LOGW("signal received");
1666 g_list_free(cb_info->idle_event_list);
1667 cb_info->idle_event_list = NULL;
1670 g_mutex_unlock(&cb_info->idle_event_mutex);
1675 static void *_camera_msg_recv_func(gpointer data)
1684 char *recv_msg = NULL;
1685 char **parse_str = NULL;
1686 camera_cb_info_s *cb_info = (camera_cb_info_s *)data;
1688 if (cb_info == NULL) {
1689 LOGE("cb_info NULL");
1695 parse_str = (char **)malloc(sizeof(char *) * CAMERA_PARSE_STRING_SIZE);
1696 if (parse_str == NULL) {
1697 LOGE("parse_str malloc failed");
1701 for (i = 0 ; i < CAMERA_PARSE_STRING_SIZE ; i++) {
1702 parse_str[i] = (char *)malloc(sizeof(char) * MUSE_CAMERA_MSG_MAX_LENGTH);
1703 if (parse_str[i] == NULL) {
1704 LOGE("parse_str[%d] malloc failed", i);
1705 goto CB_HANDLER_EXIT;
1709 recv_msg = cb_info->recv_msg;
1711 while (g_atomic_int_get(&cb_info->msg_recv_running)) {
1712 ret = muse_core_ipc_recv_msg(cb_info->fd, recv_msg);
1715 recv_msg[ret] = '\0';
1721 /*LOGD("recvMSg : %s, length : %d", recv_msg, ret);*/
1723 /* Need to split the combined entering msgs.
1724 This module supports up to 200 combined msgs. */
1725 for (str_pos = 0; str_pos < ret; str_pos++) {
1726 if (recv_msg[str_pos] == '}') {
1727 memset(parse_str[num_token], 0x0, sizeof(char) * MUSE_CAMERA_MSG_MAX_LENGTH);
1728 strncpy(parse_str[num_token], recv_msg + prev_pos, str_pos - prev_pos + 1);
1729 /*LOGD("splitted msg : [%s], Index : %d", parse_str[num_token], num_token);*/
1730 prev_pos = str_pos+1;
1735 /*LOGD("num_token : %d", num_token);*/
1737 /* Re-construct to the useful single msg. */
1738 for (i = 0; i < num_token; i++) {
1739 if (i >= CAMERA_PARSE_STRING_SIZE) {
1740 LOGE("invalid token index %d", i);
1747 if (!muse_camera_msg_get(api, parse_str[i])) {
1748 LOGE("failed to get camera api");
1752 if (api != MUSE_CAMERA_CB_EVENT) {
1753 if (!muse_camera_msg_get(api_class, parse_str[i])) {
1754 LOGE("failed to get camera api_class");
1759 if (api_class == MUSE_CAMERA_API_CLASS_IMMEDIATE) {
1760 if (api >= MUSE_CAMERA_API_MAX) {
1761 LOGE("invalid api %d", api);
1765 g_mutex_lock(&cb_info->api_mutex[api]);
1767 if (!muse_camera_msg_get(ret, parse_str[i])) {
1768 LOGE("failed to get camera ret");
1769 g_mutex_unlock(&cb_info->api_mutex[api]);
1773 cb_info->api_ret[api] = ret;
1774 cb_info->api_activating[api] = 1;
1776 if (api == MUSE_CAMERA_API_CREATE) {
1777 if (ret != CAMERA_ERROR_NONE) {
1778 g_atomic_int_set(&cb_info->msg_recv_running, 0);
1779 LOGE("camera create error 0x%x. close client cb handler", ret);
1781 } else if (api == MUSE_CAMERA_API_DESTROY) {
1782 if (ret == CAMERA_ERROR_NONE) {
1783 g_atomic_int_set(&cb_info->msg_recv_running, 0);
1784 LOGD("camera destroy done. close client cb handler");
1788 g_cond_signal(&cb_info->api_cond[api]);
1789 g_mutex_unlock(&cb_info->api_mutex[api]);
1790 } else if (api_class == MUSE_CAMERA_API_CLASS_THREAD_SUB || api == MUSE_CAMERA_CB_EVENT) {
1791 camera_message_s *cam_msg = g_new0(camera_message_s, 1);
1792 if (cam_msg == NULL) {
1793 LOGE("failed to alloc cam_msg");
1798 memcpy(cam_msg->recv_msg, parse_str[i], sizeof(cam_msg->recv_msg));
1800 /*LOGD("add camera message to queue : api %d", api);*/
1802 g_mutex_lock(&cb_info->msg_handler_mutex);
1803 g_queue_push_tail(cb_info->msg_queue, (gpointer)cam_msg);
1804 g_cond_signal(&cb_info->msg_handler_cond);
1805 g_mutex_unlock(&cb_info->msg_handler_mutex);
1807 LOGW("unknown camera api %d and api_class %d", api, api_class);
1813 LOGD("client cb exit");
1817 for (i = 0 ; i < CAMERA_PARSE_STRING_SIZE ; i++) {
1820 parse_str[i] = NULL;
1831 static camera_cb_info_s *_client_callback_new(gint sockfd)
1833 camera_cb_info_s *cb_info = NULL;
1834 gint *tmp_activating = NULL;
1835 gint *tmp_ret = NULL;
1838 g_return_val_if_fail(sockfd > 0, NULL);
1840 cb_info = g_new0(camera_cb_info_s, 1);
1841 if (cb_info == NULL) {
1842 LOGE("cb_info failed");
1846 g_mutex_init(&cb_info->msg_handler_mutex);
1847 g_cond_init(&cb_info->msg_handler_cond);
1848 g_mutex_init(&cb_info->idle_event_mutex);
1849 g_cond_init(&cb_info->idle_event_cond);
1850 g_mutex_init(&cb_info->mp_data_mutex);
1851 #ifdef EVAS_RENDERER_SUPPORT
1852 g_mutex_init(&cb_info->evas_mutex);
1853 #endif /* EVAS_RENDERER_SUPPORT */
1855 for (i = 0 ; i < MUSE_CAMERA_API_MAX ; i++) {
1856 g_mutex_init(&cb_info->api_mutex[i]);
1857 g_cond_init(&cb_info->api_cond[i]);
1860 tmp_activating = g_new0(gint, MUSE_CAMERA_API_MAX);
1861 if (tmp_activating == NULL) {
1862 LOGE("tmp_activating failed");
1866 tmp_ret = g_new0(gint, MUSE_CAMERA_API_MAX);
1867 if (tmp_ret == NULL) {
1868 LOGE("tmp_ret failed");
1872 cb_info->msg_queue = g_queue_new();
1873 if (cb_info->msg_queue == NULL) {
1874 LOGE("msg_queue new failed");
1878 g_atomic_int_set(&cb_info->msg_handler_running, 1);
1879 cb_info->msg_handler_thread = g_thread_try_new("camera_msg_handler",
1880 _camera_msg_handler_func, (gpointer)cb_info, NULL);
1881 if (cb_info->msg_handler_thread == NULL) {
1882 LOGE("message handler thread creation failed");
1886 cb_info->fd = sockfd;
1887 cb_info->api_activating = tmp_activating;
1888 cb_info->api_ret = tmp_ret;
1889 cb_info->preview_cb_flag = 0;
1890 #ifdef EVAS_RENDERER_SUPPORT
1891 cb_info->evas_info = NULL;
1892 #endif /* EVAS_RENDERER_SUPPORT */
1894 g_atomic_int_set(&cb_info->msg_recv_running, 1);
1895 cb_info->msg_recv_thread = g_thread_try_new("camera_msg_recv",
1896 _camera_msg_recv_func, (gpointer)cb_info, NULL);
1897 if (cb_info->msg_recv_thread == NULL) {
1898 LOGE("message receive thread creation failed");
1906 if (cb_info->msg_handler_thread) {
1907 g_mutex_lock(&cb_info->msg_handler_mutex);
1908 g_atomic_int_set(&cb_info->msg_handler_running, 0);
1909 g_cond_signal(&cb_info->msg_handler_cond);
1910 g_mutex_unlock(&cb_info->msg_handler_mutex);
1912 g_thread_join(cb_info->msg_handler_thread);
1913 g_thread_unref(cb_info->msg_handler_thread);
1914 cb_info->msg_handler_thread = NULL;
1917 for (i = 0 ; i < MUSE_CAMERA_API_MAX ; i++) {
1918 g_mutex_clear(&cb_info->api_mutex[i]);
1919 g_cond_clear(&cb_info->api_cond[i]);
1922 g_mutex_clear(&cb_info->msg_handler_mutex);
1923 g_cond_clear(&cb_info->msg_handler_cond);
1924 g_mutex_clear(&cb_info->idle_event_mutex);
1925 g_cond_clear(&cb_info->idle_event_cond);
1926 g_mutex_clear(&cb_info->mp_data_mutex);
1927 #ifdef EVAS_RENDERER_SUPPORT
1928 g_mutex_clear(&cb_info->evas_mutex);
1929 #endif /* EVAS_RENDERER_SUPPORT */
1931 if (cb_info->msg_queue) {
1932 g_queue_free(cb_info->msg_queue);
1933 cb_info->msg_queue = NULL;
1940 if (tmp_activating) {
1941 g_free(tmp_activating);
1942 tmp_activating = NULL;
1952 static void _client_callback_destroy(camera_cb_info_s *cb_info)
1956 g_return_if_fail(cb_info != NULL);
1958 LOGD("MSG receive thread[%p] destroy", cb_info->msg_recv_thread);
1960 g_thread_join(cb_info->msg_recv_thread);
1961 g_thread_unref(cb_info->msg_recv_thread);
1962 cb_info->msg_recv_thread = NULL;
1964 LOGD("msg thread removed");
1966 g_mutex_lock(&cb_info->msg_handler_mutex);
1967 g_atomic_int_set(&cb_info->msg_handler_running, 0);
1968 g_cond_signal(&cb_info->msg_handler_cond);
1969 g_mutex_unlock(&cb_info->msg_handler_mutex);
1971 g_thread_join(cb_info->msg_handler_thread);
1972 g_thread_unref(cb_info->msg_handler_thread);
1973 cb_info->msg_handler_thread = NULL;
1975 g_queue_free(cb_info->msg_queue);
1976 cb_info->msg_queue = NULL;
1978 for (i = 0 ; i < MUSE_CAMERA_API_MAX ; i++) {
1979 g_mutex_clear(&cb_info->api_mutex[i]);
1980 g_cond_clear(&cb_info->api_cond[i]);
1983 g_mutex_clear(&cb_info->msg_handler_mutex);
1984 g_cond_clear(&cb_info->msg_handler_cond);
1985 g_mutex_clear(&cb_info->idle_event_mutex);
1986 g_cond_clear(&cb_info->idle_event_cond);
1987 g_mutex_clear(&cb_info->mp_data_mutex);
1988 #ifdef EVAS_RENDERER_SUPPORT
1989 g_mutex_clear(&cb_info->evas_mutex);
1990 #endif /* EVAS_RENDERER_SUPPORT */
1992 LOGD("event thread removed");
1994 if (cb_info->fd > -1) {
1995 muse_core_connection_close(cb_info->fd);
1999 if (cb_info->bufmgr) {
2000 tbm_bufmgr_deinit(cb_info->bufmgr);
2001 cb_info->bufmgr = NULL;
2003 if (cb_info->api_activating) {
2004 g_free(cb_info->api_activating);
2005 cb_info->api_activating = NULL;
2007 if (cb_info->api_ret) {
2008 g_free(cb_info->api_ret);
2009 cb_info->api_ret = NULL;
2011 if (cb_info->pkt_fmt) {
2012 media_format_unref(cb_info->pkt_fmt);
2013 cb_info->pkt_fmt = NULL;
2016 #ifdef EVAS_RENDERER_SUPPORT
2017 if (cb_info->evas_info)
2018 mm_evas_renderer_destroy(&cb_info->evas_info);
2019 #endif /* EVAS_RENDERER_SUPPORT */
2021 cb_info->preview_cb_flag = 0;
2030 int _camera_start_evas_rendering(camera_h camera)
2032 int ret = CAMERA_ERROR_NONE;
2033 camera_cli_s *pc = (camera_cli_s *)camera;
2035 if (camera == NULL) {
2036 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2037 return CAMERA_ERROR_INVALID_PARAMETER;
2040 if (pc->cb_info == NULL) {
2041 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2042 return CAMERA_ERROR_INVALID_PARAMETER;
2047 if (!CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
2048 LOGE("EVAS surface is not set");
2049 return CAMERA_ERROR_NONE;
2052 #ifdef EVAS_RENDERER_SUPPORT
2053 g_mutex_lock(&pc->cb_info->evas_mutex);
2055 /* set evas render flag as RUN */
2056 pc->cb_info->run_evas_render = true;
2057 ret = CAMERA_ERROR_NONE;
2059 g_mutex_unlock(&pc->cb_info->evas_mutex);
2060 #else /* EVAS_RENDERER_SUPPORT */
2061 LOGW("evas renderer is not supported");
2062 ret = CAMERA_ERROR_NOT_SUPPORTED;
2063 #endif /* EVAS_RENDERER_SUPPORT */
2069 int _camera_stop_evas_rendering(camera_h camera, bool keep_screen)
2071 int ret = CAMERA_ERROR_NONE;
2072 camera_cli_s *pc = (camera_cli_s *)camera;
2074 if (camera == NULL) {
2075 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2076 return CAMERA_ERROR_INVALID_PARAMETER;
2079 if (pc->cb_info == NULL) {
2080 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2081 return CAMERA_ERROR_INVALID_PARAMETER;
2084 LOGD("stop - keep screen %d", keep_screen);
2086 if (!CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
2087 LOGE("EVAS surface is not set");
2088 return CAMERA_ERROR_NONE;
2091 #ifdef EVAS_RENDERER_SUPPORT
2092 g_mutex_lock(&pc->cb_info->evas_mutex);
2094 /* set evas render flag as STOP and release buffers */
2095 pc->cb_info->run_evas_render = false;
2097 ret = mm_evas_renderer_retrieve_all_packets(pc->cb_info->evas_info, keep_screen);
2098 if (ret != MM_ERROR_NONE) {
2099 LOGE("mm_evas_renderer_retrieve_all_packets failed 0x%x", ret);
2100 ret = CAMERA_ERROR_INVALID_OPERATION;
2103 g_mutex_unlock(&pc->cb_info->evas_mutex);
2104 #else /* EVAS_RENDERER_SUPPORT */
2105 LOGW("evas renderer is not supported");
2106 ret = CAMERA_ERROR_NOT_SUPPORTED;
2107 #endif /* EVAS_RENDERER_SUPPORT */
2113 int camera_create(camera_device_e device, camera_h *camera)
2117 int ret = CAMERA_ERROR_NONE;
2119 camera_cli_s *pc = NULL;
2120 tbm_bufmgr bufmgr = NULL;
2122 muse_camera_api_e api = MUSE_CAMERA_API_CREATE;
2123 muse_core_api_module_e muse_module = MUSE_CAMERA;
2124 int device_type = (int)device;
2126 if (camera == NULL) {
2127 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2128 return CAMERA_ERROR_INVALID_PARAMETER;
2131 bufmgr = tbm_bufmgr_init(-1);
2132 if (bufmgr == NULL) {
2133 LOGE("get tbm bufmgr failed");
2134 return CAMERA_ERROR_INVALID_OPERATION;
2137 sock_fd = muse_core_client_new();
2139 LOGE("muse_core_client_new failed - returned fd %d", sock_fd);
2140 ret = CAMERA_ERROR_INVALID_OPERATION;
2146 sndMsg = muse_core_msg_json_factory_new(api,
2147 MUSE_TYPE_INT, "module", muse_module,
2148 MUSE_TYPE_INT, PARAM_DEVICE_TYPE, device_type,
2149 MUSE_TYPE_INT, "pid", pid,
2152 muse_core_ipc_send_msg(sock_fd, sndMsg);
2153 muse_core_msg_json_factory_free(sndMsg);
2155 pc = g_new0(camera_cli_s, 1);
2157 LOGE("camera_cli_s alloc failed");
2158 ret = CAMERA_ERROR_OUT_OF_MEMORY;
2162 pc->cb_info = _client_callback_new(sock_fd);
2163 if (pc->cb_info == NULL) {
2164 LOGE("cb_info alloc failed");
2165 ret = CAMERA_ERROR_OUT_OF_MEMORY;
2169 LOGD("cb info : %d", pc->cb_info->fd);
2171 ret = _client_wait_for_cb_return(api, pc->cb_info, CALLBACK_TIME_OUT);
2172 if (ret == CAMERA_ERROR_NONE) {
2173 intptr_t handle = 0;
2174 muse_camera_msg_get_pointer(handle, pc->cb_info->recv_msg);
2176 LOGE("Receiving Handle Failed!!");
2177 ret = CAMERA_ERROR_INVALID_OPERATION;
2181 pc->remote_handle = handle;
2182 pc->cb_info->bufmgr = bufmgr;
2184 ret = camera_set_display((camera_h)pc, CAMERA_DISPLAY_TYPE_NONE, NULL);
2185 if (ret != CAMERA_ERROR_NONE) {
2186 LOGE("init display failed 0x%x", ret);
2190 LOGD("camera create 0x%x", pc->remote_handle);
2191 *camera = (camera_h)pc;
2199 tbm_bufmgr_deinit(bufmgr);
2203 _client_callback_destroy(pc->cb_info);
2209 LOGE("camera create error : 0x%x", ret);
2214 int camera_destroy(camera_h camera)
2216 if (camera == NULL) {
2217 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2218 return CAMERA_ERROR_INVALID_PARAMETER;
2221 int ret = CAMERA_ERROR_NONE;
2222 muse_camera_api_e api = MUSE_CAMERA_API_DESTROY;
2223 camera_cli_s *pc = (camera_cli_s *)camera;
2228 if (pc->cb_info == NULL) {
2229 LOGE("cb_info NULL, INVALID_PARAMETER");
2230 return CAMERA_ERROR_INVALID_PARAMETER;
2233 sock_fd = pc->cb_info->fd;
2235 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2236 if (ret == CAMERA_ERROR_NONE) {
2237 _camera_remove_idle_event_all(pc->cb_info);
2238 _client_callback_destroy(pc->cb_info);
2244 LOGE("camera destroy error : 0x%x", ret);
2250 int camera_start_preview(camera_h camera)
2252 int ret = CAMERA_ERROR_NONE;
2253 muse_camera_api_e api = MUSE_CAMERA_API_START_PREVIEW;
2254 camera_cli_s *pc = (camera_cli_s *)camera;
2257 if (camera == NULL) {
2258 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2259 return CAMERA_ERROR_INVALID_PARAMETER;
2262 if (pc->cb_info == NULL) {
2263 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2264 return CAMERA_ERROR_INVALID_PARAMETER;
2269 sock_fd = pc->cb_info->fd;
2271 muse_camera_msg_send_longtime(api, sock_fd, pc->cb_info, ret);
2273 if (ret != CAMERA_ERROR_NONE) {
2274 LOGE("start preview failed 0x%x", ret);
2275 } else if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
2276 ret = _camera_start_evas_rendering(camera);
2279 LOGD("ret : 0x%x", ret);
2284 int camera_stop_preview(camera_h camera)
2286 int ret = CAMERA_ERROR_NONE;
2288 camera_cli_s *pc = NULL;
2289 muse_camera_api_e api = MUSE_CAMERA_API_STOP_PREVIEW;
2291 if (camera == NULL) {
2292 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2293 return CAMERA_ERROR_INVALID_PARAMETER;
2296 pc = (camera_cli_s *)camera;
2298 if (pc->cb_info == NULL) {
2299 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2300 return CAMERA_ERROR_INVALID_PARAMETER;
2303 sock_fd = pc->cb_info->fd;
2307 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
2308 camera_state_e current_state = CAMERA_STATE_NONE;
2310 ret = camera_get_state(camera, ¤t_state);
2311 if (ret != CAMERA_ERROR_NONE) {
2312 LOGE("failed to get current state 0x%x", ret);
2316 if (current_state == CAMERA_STATE_PREVIEW) {
2317 ret = _camera_stop_evas_rendering(camera, false);
2318 if (ret != CAMERA_ERROR_NONE)
2323 /* send stop preview message */
2324 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2326 LOGD("ret : 0x%x", ret);
2331 int camera_start_capture(camera_h camera, camera_capturing_cb capturing_cb, camera_capture_completed_cb completed_cb, void *user_data)
2333 if (camera == NULL) {
2334 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2335 return CAMERA_ERROR_INVALID_PARAMETER;
2337 int ret = CAMERA_ERROR_NONE;
2339 camera_cli_s *pc = (camera_cli_s *)camera;
2340 muse_camera_api_e api = MUSE_CAMERA_API_START_CAPTURE;
2342 int is_capturing_cb = 0;
2343 int is_completed_cb = 0;
2344 LOGD("Enter, handle :%x", pc->remote_handle);
2346 if (pc->cb_info == NULL) {
2347 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2348 return CAMERA_ERROR_INVALID_PARAMETER;
2351 sock_fd = pc->cb_info->fd;
2353 if (capturing_cb != NULL) {
2354 is_capturing_cb = 1;
2355 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = capturing_cb;
2356 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = user_data;
2359 if (completed_cb != NULL) {
2360 is_completed_cb = 1;
2361 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = completed_cb;
2362 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = user_data;
2365 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, is_capturing_cb, INT, is_completed_cb);
2366 LOGD("is_capturing_cb :%d, is_completed_cb : %d", is_capturing_cb, is_completed_cb);
2367 LOGD("ret : 0x%x", ret);
2371 bool camera_is_supported_continuous_capture(camera_h camera)
2373 if (camera == NULL) {
2374 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2378 int ret = CAMERA_ERROR_NONE;
2379 camera_cli_s *pc = (camera_cli_s *)camera;
2380 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_CONTINUOUS_CAPTURE;
2383 if (pc->cb_info == NULL) {
2384 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2385 return CAMERA_ERROR_INVALID_PARAMETER;
2388 sock_fd = pc->cb_info->fd;
2390 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2391 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2392 LOGD("ret : 0x%x", ret);
2396 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)
2398 if (camera == NULL) {
2399 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2400 return CAMERA_ERROR_INVALID_PARAMETER;
2403 int ret = CAMERA_ERROR_NONE;
2405 camera_cli_s *pc = (camera_cli_s *)camera;
2406 muse_camera_api_e api = MUSE_CAMERA_API_START_CONTINUOUS_CAPTURE;
2408 LOGD("Enter, handle :%x", pc->remote_handle);
2411 if (pc->cb_info == NULL) {
2412 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2413 return CAMERA_ERROR_INVALID_PARAMETER;
2415 sock_fd = pc->cb_info->fd;
2417 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = capturing_cb;
2418 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = user_data;
2419 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = completed_cb;
2421 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, count, INT, interval);
2423 LOGD("ret : 0x%x", ret);
2428 int camera_stop_continuous_capture(camera_h camera)
2430 if (camera == NULL) {
2431 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2432 return CAMERA_ERROR_INVALID_PARAMETER;
2436 int ret = CAMERA_ERROR_NONE;
2438 camera_cli_s *pc = (camera_cli_s *)camera;
2439 muse_camera_api_e api = MUSE_CAMERA_API_STOP_CONTINUOUS_CAPTURE;
2440 LOGD("Enter, handle :%x", pc->remote_handle);
2442 if (pc->cb_info == NULL) {
2443 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2444 return CAMERA_ERROR_INVALID_PARAMETER;
2446 sock_fd = pc->cb_info->fd;
2447 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2448 LOGD("ret : 0x%x", ret);
2452 bool camera_is_supported_face_detection(camera_h camera)
2454 if (camera == NULL) {
2455 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2458 int ret = CAMERA_ERROR_NONE;
2460 camera_cli_s *pc = (camera_cli_s *)camera;
2461 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_FACE_DETECTION;
2463 if (pc->cb_info == NULL) {
2464 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2465 return CAMERA_ERROR_INVALID_PARAMETER;
2467 sock_fd = pc->cb_info->fd;
2469 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2470 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2471 LOGD("ret : 0x%x", ret);
2475 bool camera_is_supported_zero_shutter_lag(camera_h camera)
2477 if (camera == NULL) {
2478 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2481 int ret = CAMERA_ERROR_NONE;
2483 camera_cli_s *pc = (camera_cli_s *)camera;
2484 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_ZERO_SHUTTER_LAG;
2486 if (pc->cb_info == NULL) {
2487 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2488 return CAMERA_ERROR_INVALID_PARAMETER;
2490 sock_fd = pc->cb_info->fd;
2492 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2493 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2494 LOGD("ret : 0x%x", ret);
2498 bool camera_is_supported_media_packet_preview_cb(camera_h camera)
2500 if (camera == NULL) {
2501 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2505 int ret = CAMERA_ERROR_NONE;
2507 camera_cli_s *pc = (camera_cli_s *)camera;
2508 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_MEDIA_PACKET_PREVIEW_CB;
2510 if (pc->cb_info == NULL) {
2511 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2512 return CAMERA_ERROR_INVALID_PARAMETER;
2514 sock_fd = pc->cb_info->fd;
2516 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2517 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2518 LOGD("ret : 0x%x", ret);
2522 int camera_get_device_count(camera_h camera, int *device_count)
2524 if (camera == NULL || device_count == NULL) {
2525 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2526 return CAMERA_ERROR_INVALID_PARAMETER;
2528 int ret = CAMERA_ERROR_NONE;
2530 camera_cli_s *pc = (camera_cli_s *)camera;
2531 muse_camera_api_e api = MUSE_CAMERA_API_GET_DEVICE_COUNT;
2533 if (pc->cb_info == NULL) {
2534 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2535 return CAMERA_ERROR_INVALID_PARAMETER;
2537 sock_fd = pc->cb_info->fd;
2538 int get_device_count;
2540 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2541 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2543 if (ret == CAMERA_ERROR_NONE) {
2544 muse_camera_msg_get(get_device_count, pc->cb_info->recv_msg);
2545 *device_count = get_device_count;
2547 LOGD("ret : 0x%x", ret);
2551 int camera_start_face_detection(camera_h camera, camera_face_detected_cb callback, void *user_data)
2553 if (camera == NULL) {
2554 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2555 return CAMERA_ERROR_INVALID_PARAMETER;
2558 int ret = CAMERA_ERROR_NONE;
2560 camera_cli_s *pc = (camera_cli_s *)camera;
2561 muse_camera_api_e api = MUSE_CAMERA_API_START_FACE_DETECTION;
2563 LOGD("Enter, handle :%x", pc->remote_handle);
2565 if (pc->cb_info == NULL) {
2566 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2567 return CAMERA_ERROR_INVALID_PARAMETER;
2569 sock_fd = pc->cb_info->fd;
2570 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION] = callback;
2571 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION] = user_data;
2573 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2574 LOGD("ret : 0x%x", ret);
2578 int camera_stop_face_detection(camera_h camera)
2580 if (camera == NULL) {
2581 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2582 return CAMERA_ERROR_INVALID_PARAMETER;
2585 int ret = CAMERA_ERROR_NONE;
2587 camera_cli_s *pc = (camera_cli_s *)camera;
2588 muse_camera_api_e api = MUSE_CAMERA_API_STOP_FACE_DETECTION;
2589 LOGD("Enter, handle :%x", pc->remote_handle);
2591 if (pc->cb_info == NULL) {
2592 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2593 return CAMERA_ERROR_INVALID_PARAMETER;
2595 sock_fd = pc->cb_info->fd;
2596 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2597 LOGD("ret : 0x%x", ret);
2601 int camera_get_state(camera_h camera, camera_state_e *state)
2603 if (camera == NULL || state == NULL) {
2604 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2605 return CAMERA_ERROR_INVALID_PARAMETER;
2607 int ret = CAMERA_ERROR_NONE;
2609 camera_cli_s *pc = (camera_cli_s *)camera;
2610 muse_camera_api_e api = MUSE_CAMERA_API_GET_STATE;
2612 if (pc->cb_info == NULL) {
2613 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2614 return CAMERA_ERROR_INVALID_PARAMETER;
2616 sock_fd = pc->cb_info->fd;
2619 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2620 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2622 if (ret == CAMERA_ERROR_NONE) {
2623 muse_camera_msg_get(get_state, pc->cb_info->recv_msg);
2624 *state = (camera_state_e)get_state;
2626 LOGD("ret : 0x%x", ret);
2630 int camera_start_focusing(camera_h camera, bool continuous)
2632 if (camera == NULL) {
2633 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2634 return CAMERA_ERROR_INVALID_PARAMETER;
2637 int ret = CAMERA_ERROR_NONE;
2639 camera_cli_s *pc = (camera_cli_s *)camera;
2640 muse_camera_api_e api = MUSE_CAMERA_API_START_FOCUSING;
2642 if (pc->cb_info == NULL) {
2643 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2644 return CAMERA_ERROR_INVALID_PARAMETER;
2646 sock_fd = pc->cb_info->fd;
2647 int is_continuous = (int)continuous;
2649 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2650 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, is_continuous);
2651 LOGD("ret : 0x%x", ret);
2655 int camera_cancel_focusing(camera_h camera)
2657 if (camera == NULL) {
2658 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2659 return CAMERA_ERROR_INVALID_PARAMETER;
2662 int ret = CAMERA_ERROR_NONE;
2664 camera_cli_s *pc = (camera_cli_s *)camera;
2665 muse_camera_api_e api = MUSE_CAMERA_API_CANCEL_FOCUSING;
2667 if (pc->cb_info == NULL) {
2668 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2669 return CAMERA_ERROR_INVALID_PARAMETER;
2671 sock_fd = pc->cb_info->fd;
2673 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2674 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2675 LOGD("ret : 0x%x", ret);
2679 int camera_set_display(camera_h camera, camera_display_type_e type, camera_display_h display)
2681 int ret = CAMERA_ERROR_NONE;
2682 void *set_display_handle = NULL;
2683 Evas_Object *obj = NULL;
2684 const char *object_type = NULL;
2686 camera_wl_info_s *wl_info = NULL;
2687 #endif /* HAVE_WAYLAND */
2688 camera_cli_s *pc = (camera_cli_s *)camera;
2689 camera_cb_info_s *cb_info = NULL;
2690 muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY;
2691 camera_state_e current_state = CAMERA_STATE_NONE;
2694 if (camera == NULL) {
2695 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2696 return CAMERA_ERROR_INVALID_PARAMETER;
2699 if (type < CAMERA_DISPLAY_TYPE_OVERLAY || type > CAMERA_DISPLAY_TYPE_NONE) {
2700 LOGE("invalid type %d", type);
2701 return CAMERA_ERROR_INVALID_PARAMETER;
2704 if (type != CAMERA_DISPLAY_TYPE_NONE && display == NULL) {
2705 LOGE("display type[%d] is not NONE, but display handle is NULL", type);
2706 return CAMERA_ERROR_INVALID_PARAMETER;
2709 if (pc->cb_info == NULL) {
2710 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2711 return CAMERA_ERROR_INVALID_PARAMETER;
2714 cb_info = (camera_cb_info_s *)pc->cb_info;
2715 sock_fd = cb_info->fd;
2717 ret = camera_get_state(camera, ¤t_state);
2718 if (ret != CAMERA_ERROR_NONE) {
2719 LOGE("failed to get current state 0x%x", ret);
2723 if (current_state != CAMERA_STATE_CREATED) {
2724 LOGE("INVALID_STATE : current %d", current_state);
2725 return CAMERA_ERROR_INVALID_STATE;
2728 LOGD("Enter, remote_handle : %x display : 0x%x", pc->remote_handle, display);
2730 if (type == CAMERA_DISPLAY_TYPE_NONE) {
2731 set_display_handle = 0;
2732 LOGD("display type NONE");
2734 obj = (Evas_Object *)display;
2735 object_type = evas_object_type_get(obj);
2737 if (type == CAMERA_DISPLAY_TYPE_OVERLAY && !strcmp(object_type, "elm_win")) {
2739 /* get wayland parent id */
2740 if (_get_wl_info(obj, &pc->wl_info) != CAMERA_ERROR_NONE) {
2741 LOGE("failed to get wayland info");
2742 return CAMERA_ERROR_INVALID_OPERATION;
2745 set_display_handle = (void *)&pc->wl_info;
2746 #else /* HAVE_WAYLAND */
2747 /* x window overlay surface */
2748 set_display_handle = (void *)elm_win_xwindow_get(obj);
2749 #endif /* HAVE_WAYLAND */
2750 LOGD("display type OVERLAY : handle %p", set_display_handle);
2751 } else if (type == CAMERA_DISPLAY_TYPE_EVAS && !strcmp(object_type, "image")) {
2752 /* evas object surface */
2753 set_display_handle = (void *)display;
2754 LOGD("display type EVAS : handle %p", set_display_handle);
2756 #ifdef EVAS_RENDERER_SUPPORT
2757 g_mutex_lock(&cb_info->evas_mutex);
2759 if (cb_info->evas_info) {
2760 LOGW("destroy existed evas renderer %p", cb_info->evas_info);
2761 ret = mm_evas_renderer_destroy(&cb_info->evas_info);
2762 if (ret != MM_ERROR_NONE) {
2763 LOGE("failed to destroy evas renderer %p", cb_info->evas_info);
2764 g_mutex_unlock(&cb_info->evas_mutex);
2765 return CAMERA_ERROR_INVALID_OPERATION;
2769 /* create evas renderer */
2770 ret = mm_evas_renderer_create(&cb_info->evas_info, (Evas_Object *)set_display_handle);
2771 if (ret == MM_ERROR_NONE) {
2772 camera_flip_e flip = CAMERA_FLIP_NONE;
2773 camera_display_mode_e mode = CAMERA_DISPLAY_MODE_LETTER_BOX;
2774 camera_rotation_e rotation = CAMERA_ROTATION_NONE;
2781 camera_get_display_flip(camera, &flip);
2782 camera_get_display_mode(camera, &mode);
2783 camera_get_display_rotation(camera, &rotation);
2784 camera_is_display_visible(camera, &visible);
2785 camera_attr_get_display_roi_area(camera, &x, &y, &width, &height);
2787 LOGD("current setting : flip %d, mode %d, rotation %d, visible %d, roi %d,%d,%dx%d",
2788 flip, mode, rotation, visible, x, y, width, height);
2790 ret = mm_evas_renderer_set_flip(cb_info->evas_info, flip);
2791 ret |= mm_evas_renderer_set_geometry(cb_info->evas_info, mode);
2792 ret |= mm_evas_renderer_set_rotation(cb_info->evas_info, rotation);
2793 ret |= mm_evas_renderer_set_visible(cb_info->evas_info, visible);
2795 if (mode == CAMERA_DISPLAY_MODE_CUSTOM_ROI)
2796 ret |= mm_evas_renderer_set_roi_area(cb_info->evas_info, x, y, width, height);
2799 g_mutex_unlock(&cb_info->evas_mutex);
2801 if (ret != MM_ERROR_NONE) {
2802 LOGE("mm_evas_renderer error 0x%x", ret);
2803 return CAMERA_ERROR_INVALID_OPERATION;
2805 #else /* EVAS_RENDERER_SUPPORT */
2806 LOGE("EVAS surface is not supported");
2807 return CAMERA_ERROR_NOT_SUPPORTED;
2808 #endif /* EVAS_RENDERER_SUPPORT */
2810 LOGE("unknown evas object [%p,%s] or type [%d] mismatch", obj, object_type, type);
2811 return CAMERA_ERROR_INVALID_PARAMETER;
2814 LOGE("failed to get evas object type from %p", obj);
2815 return CAMERA_ERROR_INVALID_PARAMETER;
2819 pc->display_handle = (intptr_t)set_display_handle;
2821 if (type == CAMERA_DISPLAY_TYPE_OVERLAY) {
2823 wl_info = &pc->wl_info;
2824 muse_camera_msg_send_array_and_value(api, sock_fd, cb_info, ret,
2825 wl_info, sizeof(camera_wl_info_s), sizeof(int), INT, type);
2827 LOGD("wayland parent id : %d, window %d,%d,%dx%d",
2828 wl_info->parent_id, wl_info->window_x, wl_info->window_y,
2829 wl_info->window_width, wl_info->window_height);
2830 #else /* HAVE_WAYLAND */
2831 muse_camera_msg_send2(api, sock_fd, cb_info, ret, INT, type, INT, set_display_handle);
2833 LOGD("x id : %d", (int)set_display_handle);
2834 #endif /* HAVE_WAYLAND */
2836 muse_camera_msg_send1(api, sock_fd, cb_info, ret, INT, type);
2838 if (ret != CAMERA_ERROR_NONE)
2839 LOGE("set display error 0x%x", ret);
2840 else if (type == CAMERA_DISPLAY_TYPE_EVAS)
2841 SET_PREVIEW_CB_TYPE(cb_info, PREVIEW_CB_TYPE_EVAS);
2846 int camera_set_preview_resolution(camera_h camera, int width, int height)
2848 if (camera == NULL) {
2849 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2850 return CAMERA_ERROR_INVALID_PARAMETER;
2852 int ret = CAMERA_ERROR_NONE;
2854 camera_cli_s *pc = (camera_cli_s *)camera;
2855 muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_RESOLUTION;
2857 if (pc->cb_info == NULL) {
2858 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2859 return CAMERA_ERROR_INVALID_PARAMETER;
2861 sock_fd = pc->cb_info->fd;
2863 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2864 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, width, INT, height);
2865 LOGD("ret : 0x%x", ret);
2870 int camera_set_capture_resolution(camera_h camera, int width, int height)
2872 if (camera == NULL) {
2873 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2874 return CAMERA_ERROR_INVALID_PARAMETER;
2877 int ret = CAMERA_ERROR_NONE;
2879 camera_cli_s *pc = (camera_cli_s *)camera;
2880 muse_camera_api_e api = MUSE_CAMERA_API_SET_CAPTURE_RESOLUTION;
2882 if (pc->cb_info == NULL) {
2883 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2884 return CAMERA_ERROR_INVALID_PARAMETER;
2886 sock_fd = pc->cb_info->fd;
2888 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2889 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, width, INT, height);
2890 LOGD("ret : 0x%x", ret);
2894 int camera_set_capture_format(camera_h camera, camera_pixel_format_e format)
2896 if (camera == NULL) {
2897 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2898 return CAMERA_ERROR_INVALID_PARAMETER;
2901 int ret = CAMERA_ERROR_NONE;
2902 int set_format = (int)format;
2904 camera_cli_s *pc = (camera_cli_s *)camera;
2905 muse_camera_api_e api = MUSE_CAMERA_API_SET_CAPTURE_FORMAT;
2907 if (pc->cb_info == NULL) {
2908 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2909 return CAMERA_ERROR_INVALID_PARAMETER;
2911 sock_fd = pc->cb_info->fd;
2913 LOGD("Enter, remote_handle : %x, capture_format: %d", pc->remote_handle, set_format);
2914 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_format);
2915 LOGD("ret : 0x%x", ret);
2919 int camera_set_preview_format(camera_h camera, camera_pixel_format_e format)
2921 if (camera == NULL) {
2922 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2923 return CAMERA_ERROR_INVALID_PARAMETER;
2926 int ret = CAMERA_ERROR_NONE;
2927 int set_format = (int)format;
2929 camera_cli_s *pc = (camera_cli_s *)camera;
2930 muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_FORMAT;
2932 if (pc->cb_info == NULL) {
2933 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2934 return CAMERA_ERROR_INVALID_PARAMETER;
2936 sock_fd = pc->cb_info->fd;
2938 LOGD("Enter, remote_handle : %x, capture_format: %d", pc->remote_handle, set_format);
2939 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_format);
2940 LOGD("ret : 0x%x", ret);
2944 int camera_get_preview_resolution(camera_h camera, int *width, int *height)
2946 if (camera == NULL || width == NULL || height == NULL) {
2947 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2948 return CAMERA_ERROR_INVALID_PARAMETER;
2952 int ret = CAMERA_ERROR_NONE;
2954 camera_cli_s *pc = (camera_cli_s *)camera;
2955 muse_camera_api_e api = MUSE_CAMERA_API_GET_PREVIEW_RESOLUTION;
2957 if (pc->cb_info == NULL) {
2958 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2959 return CAMERA_ERROR_INVALID_PARAMETER;
2961 sock_fd = pc->cb_info->fd;
2965 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2966 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2968 if (ret == CAMERA_ERROR_NONE) {
2969 muse_camera_msg_get(get_width, pc->cb_info->recv_msg);
2970 muse_camera_msg_get(get_height, pc->cb_info->recv_msg);
2972 *height = get_height;
2974 LOGD("ret : 0x%x", ret);
2978 int camera_set_display_rotation(camera_h camera, camera_rotation_e rotation)
2980 int ret = CAMERA_ERROR_NONE;
2981 int set_rotation = (int)rotation;
2982 camera_cli_s *pc = NULL;
2984 if (camera == NULL) {
2985 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2986 return CAMERA_ERROR_INVALID_PARAMETER;
2989 if (rotation < CAMERA_ROTATION_NONE || rotation > CAMERA_ROTATION_270) {
2990 LOGE("Invalid rotation %d", rotation);
2991 return CAMERA_ERROR_INVALID_PARAMETER;
2994 pc = (camera_cli_s *)camera;
2996 if (pc->cb_info == NULL) {
2997 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2998 return CAMERA_ERROR_INVALID_PARAMETER;
3001 #ifdef EVAS_RENDERER_SUPPORT
3002 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
3003 g_mutex_lock(&pc->cb_info->evas_mutex);
3005 ret = mm_evas_renderer_set_rotation(pc->cb_info->evas_info, rotation);
3007 g_mutex_unlock(&pc->cb_info->evas_mutex);
3009 if (ret != MM_ERROR_NONE) {
3010 LOGE("failed to set rotation for evas surface 0x%x", ret);
3011 return CAMERA_ERROR_INVALID_OPERATION;
3014 #endif /* EVAS_RENDERER_SUPPORT */
3016 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_ROTATION,
3017 pc->cb_info->fd, pc->cb_info, ret, INT, set_rotation);
3022 int camera_get_display_rotation(camera_h camera, camera_rotation_e *rotation)
3024 int ret = CAMERA_ERROR_NONE;
3025 int get_rotation = CAMERA_ROTATION_NONE;
3026 camera_cli_s *pc = NULL;
3028 if (camera == NULL || rotation == NULL) {
3029 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3030 return CAMERA_ERROR_INVALID_PARAMETER;
3033 pc = (camera_cli_s *)camera;
3035 if (pc->cb_info == NULL) {
3036 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3037 return CAMERA_ERROR_INVALID_PARAMETER;
3040 muse_camera_msg_send(MUSE_CAMERA_API_GET_DISPLAY_ROTATION,
3041 pc->cb_info->fd, pc->cb_info, ret);
3043 if (ret == CAMERA_ERROR_NONE) {
3044 muse_camera_msg_get(get_rotation, pc->cb_info->recv_msg);
3045 *rotation = (camera_rotation_e)get_rotation;
3051 int camera_set_display_flip(camera_h camera, camera_flip_e flip)
3053 int ret = CAMERA_ERROR_NONE;
3054 int set_flip = (int)flip;
3055 camera_cli_s *pc = NULL;
3057 if (camera == NULL) {
3058 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3059 return CAMERA_ERROR_INVALID_PARAMETER;
3062 if (flip < CAMERA_FLIP_NONE || flip > CAMERA_FLIP_BOTH) {
3063 LOGE("Invalid flip %d", flip);
3064 return CAMERA_ERROR_INVALID_PARAMETER;
3067 pc = (camera_cli_s *)camera;
3069 if (pc->cb_info == NULL) {
3070 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3071 return CAMERA_ERROR_INVALID_PARAMETER;
3074 #ifdef EVAS_RENDERER_SUPPORT
3075 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
3076 g_mutex_lock(&pc->cb_info->evas_mutex);
3078 ret = mm_evas_renderer_set_flip(pc->cb_info->evas_info, flip);
3080 g_mutex_unlock(&pc->cb_info->evas_mutex);
3082 if (ret != MM_ERROR_NONE) {
3083 LOGE("failed to set flip for evas surface 0x%x", ret);
3084 return CAMERA_ERROR_INVALID_OPERATION;
3087 #endif /* EVAS_RENDERER_SUPPORT */
3089 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_FLIP,
3090 pc->cb_info->fd, pc->cb_info, ret, INT, set_flip);
3095 int camera_get_display_flip(camera_h camera, camera_flip_e *flip)
3097 int ret = CAMERA_ERROR_NONE;
3098 int get_flip = CAMERA_FLIP_NONE;
3099 camera_cli_s *pc = NULL;
3101 if (camera == NULL || flip == NULL) {
3102 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3103 return CAMERA_ERROR_INVALID_PARAMETER;
3106 pc = (camera_cli_s *)camera;
3108 if (pc->cb_info == NULL) {
3109 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3110 return CAMERA_ERROR_INVALID_PARAMETER;
3113 muse_camera_msg_send(MUSE_CAMERA_API_GET_DISPLAY_FLIP,
3114 pc->cb_info->fd, pc->cb_info, ret);
3116 if (ret == CAMERA_ERROR_NONE) {
3117 muse_camera_msg_get(get_flip, pc->cb_info->recv_msg);
3118 *flip = (camera_flip_e)get_flip;
3124 int camera_set_display_visible(camera_h camera, bool visible)
3126 int ret = CAMERA_ERROR_NONE;
3127 int set_visible = (int)visible;
3128 camera_cli_s *pc = NULL;
3130 if (camera == NULL) {
3131 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3132 return CAMERA_ERROR_INVALID_PARAMETER;
3135 pc = (camera_cli_s *)camera;
3137 if (pc->cb_info == NULL) {
3138 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3139 return CAMERA_ERROR_INVALID_PARAMETER;
3142 #ifdef EVAS_RENDERER_SUPPORT
3143 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
3144 g_mutex_lock(&pc->cb_info->evas_mutex);
3146 ret = mm_evas_renderer_set_visible(pc->cb_info->evas_info, visible);
3148 g_mutex_unlock(&pc->cb_info->evas_mutex);
3150 if (ret != MM_ERROR_NONE) {
3151 LOGE("failed to set visible for evas surface 0x%x", ret);
3152 return CAMERA_ERROR_INVALID_OPERATION;
3155 #endif /* EVAS_RENDERER_SUPPORT */
3157 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_VISIBLE,
3158 pc->cb_info->fd, pc->cb_info, ret, INT, set_visible);
3163 int camera_is_display_visible(camera_h camera, bool *visible)
3165 int ret = CAMERA_ERROR_NONE;
3166 int get_visible = true;
3167 camera_cli_s *pc = NULL;
3169 if (camera == NULL || visible == NULL) {
3170 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3171 return CAMERA_ERROR_INVALID_PARAMETER;
3174 pc = (camera_cli_s *)camera;
3176 if (pc->cb_info == NULL) {
3177 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3178 return CAMERA_ERROR_INVALID_PARAMETER;
3181 muse_camera_msg_send(MUSE_CAMERA_API_IS_DISPLAY_VISIBLE,
3182 pc->cb_info->fd, pc->cb_info, ret);
3184 if (ret == CAMERA_ERROR_NONE) {
3185 muse_camera_msg_get(get_visible, pc->cb_info->recv_msg);
3186 *visible = (bool)get_visible;
3192 int camera_set_display_mode(camera_h camera, camera_display_mode_e mode)
3194 int ret = CAMERA_ERROR_NONE;
3195 int set_mode = (int)mode;
3196 camera_cli_s *pc = NULL;
3198 if (camera == NULL) {
3199 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3200 return CAMERA_ERROR_INVALID_PARAMETER;
3203 if (mode < CAMERA_DISPLAY_MODE_LETTER_BOX || mode > CAMERA_DISPLAY_MODE_CUSTOM_ROI) {
3204 LOGE("Invalid mode %d", mode);
3205 return CAMERA_ERROR_INVALID_PARAMETER;
3208 pc = (camera_cli_s *)camera;
3210 if (pc->cb_info == NULL) {
3211 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3212 return CAMERA_ERROR_INVALID_PARAMETER;
3215 #ifdef EVAS_RENDERER_SUPPORT
3216 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
3217 g_mutex_lock(&pc->cb_info->evas_mutex);
3219 ret = mm_evas_renderer_set_geometry(pc->cb_info->evas_info, mode);
3221 g_mutex_unlock(&pc->cb_info->evas_mutex);
3223 if (ret != MM_ERROR_NONE) {
3224 LOGE("failed to set geometry for evas surface 0x%x", ret);
3225 return CAMERA_ERROR_INVALID_OPERATION;
3228 #endif /* EVAS_RENDERER_SUPPORT */
3230 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_MODE,
3231 pc->cb_info->fd, pc->cb_info, ret, INT, set_mode);
3236 int camera_get_display_mode(camera_h camera, camera_display_mode_e *mode)
3238 int ret = CAMERA_ERROR_NONE;
3239 int get_mode = CAMERA_DISPLAY_MODE_LETTER_BOX;
3240 camera_cli_s *pc = NULL;
3242 if (camera == NULL || mode == NULL) {
3243 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3244 return CAMERA_ERROR_INVALID_PARAMETER;
3247 pc = (camera_cli_s *)camera;
3249 if (pc->cb_info == NULL) {
3250 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3251 return CAMERA_ERROR_INVALID_PARAMETER;
3254 muse_camera_msg_send(MUSE_CAMERA_API_GET_DISPLAY_MODE,
3255 pc->cb_info->fd, pc->cb_info, ret);
3257 if (ret == CAMERA_ERROR_NONE) {
3258 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
3259 *mode = (camera_display_mode_e)get_mode;
3265 int camera_get_capture_resolution(camera_h camera, int *width, int *height)
3267 if (camera == NULL || width == NULL || height == NULL) {
3268 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3269 return CAMERA_ERROR_INVALID_PARAMETER;
3271 int ret = CAMERA_ERROR_NONE;
3273 camera_cli_s *pc = (camera_cli_s *)camera;
3274 muse_camera_api_e api = MUSE_CAMERA_API_GET_CAPTURE_RESOLUTION;
3276 if (pc->cb_info == NULL) {
3277 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3278 return CAMERA_ERROR_INVALID_PARAMETER;
3280 sock_fd = pc->cb_info->fd;
3284 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3285 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3287 if (ret == CAMERA_ERROR_NONE) {
3288 muse_camera_msg_get(get_width, pc->cb_info->recv_msg);
3289 muse_camera_msg_get(get_height, pc->cb_info->recv_msg);
3291 *height = get_height;
3293 LOGD("ret : 0x%x", ret);
3297 int camera_get_capture_format(camera_h camera, camera_pixel_format_e *format)
3299 if (camera == NULL || format == NULL) {
3300 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3301 return CAMERA_ERROR_INVALID_PARAMETER;
3303 int ret = CAMERA_ERROR_NONE;
3305 camera_cli_s *pc = (camera_cli_s *)camera;
3306 muse_camera_api_e api = MUSE_CAMERA_API_GET_CAPTURE_FORMAT;
3309 if (pc->cb_info == NULL) {
3310 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3311 return CAMERA_ERROR_INVALID_PARAMETER;
3313 sock_fd = pc->cb_info->fd;
3315 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3316 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3318 if (ret == CAMERA_ERROR_NONE) {
3319 muse_camera_msg_get(get_format, pc->cb_info->recv_msg);
3320 *format = (camera_pixel_format_e)get_format;
3322 LOGD("ret : 0x%x", ret);
3326 int camera_get_preview_format(camera_h camera, camera_pixel_format_e *format)
3328 if (camera == NULL || format == NULL) {
3329 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3330 return CAMERA_ERROR_INVALID_PARAMETER;
3333 int ret = CAMERA_ERROR_NONE;
3335 camera_cli_s *pc = (camera_cli_s *)camera;
3336 muse_camera_api_e api = MUSE_CAMERA_API_GET_PREVIEW_FORMAT;
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;
3345 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3346 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3348 if (ret == CAMERA_ERROR_NONE) {
3349 muse_camera_msg_get(get_format, pc->cb_info->recv_msg);
3350 *format = (camera_pixel_format_e)get_format;
3352 LOGD("ret : 0x%x", ret);
3356 int camera_get_facing_direction(camera_h camera, camera_facing_direction_e *facing_direciton)
3358 if (camera == NULL || facing_direciton == NULL) {
3359 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3360 return CAMERA_ERROR_INVALID_PARAMETER;
3363 int ret = CAMERA_ERROR_NONE;
3365 camera_cli_s *pc = (camera_cli_s *)camera;
3366 muse_camera_api_e api = MUSE_CAMERA_API_GET_FACING_DIRECTION;
3368 if (pc->cb_info == NULL) {
3369 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3370 return CAMERA_ERROR_INVALID_PARAMETER;
3372 sock_fd = pc->cb_info->fd;
3373 int get_facing_direction;
3375 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3376 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3378 if (ret == CAMERA_ERROR_NONE) {
3379 muse_camera_msg_get(get_facing_direction, pc->cb_info->recv_msg);
3380 *facing_direciton = (camera_facing_direction_e)get_facing_direction;
3382 LOGD("ret : 0x%x", ret);
3386 int camera_set_preview_cb(camera_h camera, camera_preview_cb callback, void *user_data)
3388 if (camera == NULL || callback == NULL) {
3389 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3390 return CAMERA_ERROR_INVALID_PARAMETER;
3392 int ret = CAMERA_ERROR_NONE;
3394 camera_cli_s *pc = (camera_cli_s *)camera;
3395 camera_cb_info_s *cb_info = (camera_cb_info_s *)pc->cb_info;
3397 if (pc->cb_info == NULL) {
3398 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3399 return CAMERA_ERROR_INVALID_PARAMETER;
3401 sock_fd = pc->cb_info->fd;
3402 muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_CB;
3404 LOGD("Enter, handle :%x", pc->remote_handle);
3406 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = callback;
3407 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = user_data;
3408 SET_PREVIEW_CB_TYPE(cb_info, PREVIEW_CB_TYPE_USER);
3410 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3411 LOGD("ret : 0x%x", ret);
3415 int camera_unset_preview_cb(camera_h camera)
3417 if (camera == NULL) {
3418 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3419 return CAMERA_ERROR_INVALID_PARAMETER;
3422 int ret = CAMERA_ERROR_NONE;
3424 camera_cli_s *pc = (camera_cli_s *)camera;
3425 camera_cb_info_s *cb_info = (camera_cb_info_s *)pc->cb_info;
3426 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_PREVIEW_CB;
3428 LOGD("Enter, handle :%x", pc->remote_handle);
3431 if (pc->cb_info == NULL) {
3432 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3433 return CAMERA_ERROR_INVALID_PARAMETER;
3435 sock_fd = pc->cb_info->fd;
3436 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = (void *)NULL;
3437 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = (void *)NULL;
3438 UNSET_PREVIEW_CB_TYPE(cb_info, PREVIEW_CB_TYPE_USER);
3440 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3441 LOGD("ret : 0x%x", ret);
3445 int camera_set_media_packet_preview_cb(camera_h camera, camera_media_packet_preview_cb callback, void *user_data)
3447 if (camera == NULL) {
3448 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
3449 return CAMERA_ERROR_INVALID_PARAMETER;
3452 if (camera_is_supported_media_packet_preview_cb(camera) == false) {
3453 LOGE("NOT SUPPORTED");
3454 return CAMERA_ERROR_NOT_SUPPORTED;
3457 if (callback == NULL) {
3458 LOGE("INVALID_PARAMETER(0x%08x) - callback", CAMERA_ERROR_INVALID_PARAMETER);
3459 return CAMERA_ERROR_INVALID_PARAMETER;
3462 int ret = CAMERA_ERROR_NONE;
3464 camera_cli_s *pc = (camera_cli_s *)camera;
3465 muse_camera_api_e api = MUSE_CAMERA_API_SET_MEDIA_PACKET_PREVIEW_CB;
3467 LOGD("Enter, handle :%x", pc->remote_handle);
3470 if (pc->cb_info == NULL) {
3471 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3472 return CAMERA_ERROR_INVALID_PARAMETER;
3474 sock_fd = pc->cb_info->fd;
3475 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = callback;
3476 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = user_data;
3478 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3479 LOGD("ret : 0x%x", ret);
3483 int camera_unset_media_packet_preview_cb(camera_h camera)
3485 if (camera == NULL) {
3486 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3487 return CAMERA_ERROR_INVALID_PARAMETER;
3490 int ret = CAMERA_ERROR_NONE;
3492 camera_cli_s *pc = (camera_cli_s *)camera;
3493 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_MEDIA_PACKET_PREVIEW_CB;
3495 LOGD("Enter, handle :%x", pc->remote_handle);
3498 if (pc->cb_info == NULL) {
3499 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3500 return CAMERA_ERROR_INVALID_PARAMETER;
3502 sock_fd = pc->cb_info->fd;
3503 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = (void *)NULL;
3504 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = (void *)NULL;
3506 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3507 LOGD("ret : 0x%x", ret);
3511 int camera_set_state_changed_cb(camera_h camera, camera_state_changed_cb callback, void *user_data)
3513 if (camera == NULL || callback == NULL) {
3514 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3515 return CAMERA_ERROR_INVALID_PARAMETER;
3517 int ret = CAMERA_ERROR_NONE;
3519 camera_cli_s *pc = (camera_cli_s *)camera;
3520 muse_camera_api_e api = MUSE_CAMERA_API_SET_STATE_CHANGED_CB;
3522 LOGD("Enter, handle :%x", pc->remote_handle);
3525 if (pc->cb_info == NULL) {
3526 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3527 return CAMERA_ERROR_INVALID_PARAMETER;
3529 sock_fd = pc->cb_info->fd;
3530 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = callback;
3531 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = user_data;
3533 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3534 LOGD("ret : 0x%x", ret);
3537 int camera_unset_state_changed_cb(camera_h camera)
3539 if (camera == NULL) {
3540 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3541 return CAMERA_ERROR_INVALID_PARAMETER;
3543 int ret = CAMERA_ERROR_NONE;
3545 camera_cli_s *pc = (camera_cli_s *)camera;
3546 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_STATE_CHANGED_CB;
3548 LOGD("Enter, handle :%x", pc->remote_handle);
3551 if (pc->cb_info == NULL) {
3552 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3553 return CAMERA_ERROR_INVALID_PARAMETER;
3555 sock_fd = pc->cb_info->fd;
3556 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = (void *)NULL;
3557 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = (void *)NULL;
3559 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3560 LOGD("ret : 0x%x", ret);
3564 int camera_set_interrupted_cb(camera_h camera, camera_interrupted_cb callback, void *user_data)
3566 if (camera == NULL || callback == NULL) {
3567 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3568 return CAMERA_ERROR_INVALID_PARAMETER;
3570 int ret = CAMERA_ERROR_NONE;
3572 camera_cli_s *pc = (camera_cli_s *)camera;
3573 muse_camera_api_e api = MUSE_CAMERA_API_SET_INTERRUPTED_CB;
3575 LOGD("Enter, handle :%x", pc->remote_handle);
3578 if (pc->cb_info == NULL) {
3579 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3580 return CAMERA_ERROR_INVALID_PARAMETER;
3582 sock_fd = pc->cb_info->fd;
3583 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = callback;
3584 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = user_data;
3586 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3587 LOGD("ret : 0x%x", ret);
3591 int camera_unset_interrupted_cb(camera_h camera)
3593 if (camera == NULL) {
3594 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3595 return CAMERA_ERROR_INVALID_PARAMETER;
3597 int ret = CAMERA_ERROR_NONE;
3599 camera_cli_s *pc = (camera_cli_s *)camera;
3600 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_INTERRUPTED_CB;
3602 LOGD("Enter, handle :%x", pc->remote_handle);
3605 if (pc->cb_info == NULL) {
3606 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3607 return CAMERA_ERROR_INVALID_PARAMETER;
3609 sock_fd = pc->cb_info->fd;
3610 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = (void *)NULL;
3611 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = (void *)NULL;
3613 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3614 LOGD("ret : 0x%x", ret);
3618 int camera_set_focus_changed_cb(camera_h camera, camera_focus_changed_cb callback, void *user_data)
3620 if (camera == NULL || callback == NULL) {
3621 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3622 return CAMERA_ERROR_INVALID_PARAMETER;
3624 int ret = CAMERA_ERROR_NONE;
3626 camera_cli_s *pc = (camera_cli_s *)camera;
3627 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOCUS_CHANGED_CB;
3629 LOGD("Enter, handle :%x", pc->remote_handle);
3632 if (pc->cb_info == NULL) {
3633 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3634 return CAMERA_ERROR_INVALID_PARAMETER;
3636 sock_fd = pc->cb_info->fd;
3637 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = callback;
3638 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = user_data;
3640 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3641 LOGD("ret : 0x%x", ret);
3645 int camera_unset_focus_changed_cb(camera_h camera)
3647 if (camera == NULL) {
3648 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3649 return CAMERA_ERROR_INVALID_PARAMETER;
3651 int ret = CAMERA_ERROR_NONE;
3653 camera_cli_s *pc = (camera_cli_s *)camera;
3654 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_FOCUS_CHANGED_CB;
3656 LOGD("Enter, handle :%x", pc->remote_handle);
3659 if (pc->cb_info == NULL) {
3660 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3661 return CAMERA_ERROR_INVALID_PARAMETER;
3663 sock_fd = pc->cb_info->fd;
3664 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = (void *)NULL;
3665 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = (void *)NULL;
3667 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3668 LOGD("ret : 0x%x", ret);
3672 int camera_set_error_cb(camera_h camera, camera_error_cb callback, void *user_data)
3674 if (camera == NULL || callback == NULL) {
3675 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3676 return CAMERA_ERROR_INVALID_PARAMETER;
3678 int ret = CAMERA_ERROR_NONE;
3680 camera_cli_s *pc = (camera_cli_s *)camera;
3681 muse_camera_api_e api = MUSE_CAMERA_API_SET_ERROR_CB;
3683 LOGD("Enter, handle :%x", pc->remote_handle);
3686 if (pc->cb_info == NULL) {
3687 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3688 return CAMERA_ERROR_INVALID_PARAMETER;
3690 sock_fd = pc->cb_info->fd;
3691 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_ERROR] = callback;
3692 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_ERROR] = user_data;
3694 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3695 LOGD("ret : 0x%x", ret);
3699 int camera_unset_error_cb(camera_h camera)
3701 if (camera == NULL) {
3702 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3703 return CAMERA_ERROR_INVALID_PARAMETER;
3705 int ret = CAMERA_ERROR_NONE;
3707 camera_cli_s *pc = (camera_cli_s *)camera;
3708 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_ERROR_CB;
3710 LOGD("Enter, handle :%x", pc->remote_handle);
3713 if (pc->cb_info == NULL) {
3714 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3715 return CAMERA_ERROR_INVALID_PARAMETER;
3717 sock_fd = pc->cb_info->fd;
3718 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_ERROR] = (void *)NULL;
3719 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_ERROR] = (void *)NULL;
3721 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3722 LOGD("ret : 0x%x", ret);
3726 int camera_foreach_supported_preview_resolution(camera_h camera, camera_supported_preview_resolution_cb foreach_cb , void *user_data)
3728 if (camera == NULL || foreach_cb == NULL) {
3729 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3730 return CAMERA_ERROR_INVALID_PARAMETER;
3732 int ret = CAMERA_ERROR_NONE;
3734 camera_cli_s *pc = (camera_cli_s *)camera;
3735 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_PREVIEW_RESOLUTION;
3737 LOGD("Enter, handle :%x", pc->remote_handle);
3740 if (pc->cb_info == NULL) {
3741 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3742 return CAMERA_ERROR_INVALID_PARAMETER;
3744 sock_fd = pc->cb_info->fd;
3745 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_RESOLUTION] = foreach_cb;
3746 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_RESOLUTION] = user_data;
3748 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3749 LOGD("ret : 0x%x", ret);
3753 int camera_foreach_supported_capture_resolution(camera_h camera, camera_supported_capture_resolution_cb foreach_cb , void *user_data)
3755 if (camera == NULL || foreach_cb == NULL) {
3756 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3757 return CAMERA_ERROR_INVALID_PARAMETER;
3759 int ret = CAMERA_ERROR_NONE;
3761 camera_cli_s *pc = (camera_cli_s *)camera;
3762 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_CAPTURE_RESOLUTION;
3764 LOGD("Enter, handle :%x", pc->remote_handle);
3767 if (pc->cb_info == NULL) {
3768 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3769 return CAMERA_ERROR_INVALID_PARAMETER;
3771 sock_fd = pc->cb_info->fd;
3772 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_RESOLUTION] = foreach_cb;
3773 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_RESOLUTION] = user_data;
3775 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3776 LOGD("ret : 0x%x", ret);
3780 int camera_foreach_supported_capture_format(camera_h camera, camera_supported_capture_format_cb foreach_cb , void *user_data)
3782 if (camera == NULL || foreach_cb == NULL) {
3783 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3784 return CAMERA_ERROR_INVALID_PARAMETER;
3786 int ret = CAMERA_ERROR_NONE;
3788 camera_cli_s *pc = (camera_cli_s *)camera;
3789 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_CAPTURE_FORMAT;
3791 LOGD("Enter, handle :%x", pc->remote_handle);
3794 if (pc->cb_info == NULL) {
3795 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3796 return CAMERA_ERROR_INVALID_PARAMETER;
3798 sock_fd = pc->cb_info->fd;
3799 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_FORMAT] = foreach_cb;
3800 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_FORMAT] = user_data;
3802 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3803 LOGD("ret : 0x%x", ret);
3808 int camera_foreach_supported_preview_format(camera_h camera, camera_supported_preview_format_cb foreach_cb , void *user_data)
3810 if (camera == NULL || foreach_cb == NULL) {
3811 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3812 return CAMERA_ERROR_INVALID_PARAMETER;
3814 int ret = CAMERA_ERROR_NONE;
3816 camera_cli_s *pc = (camera_cli_s *)camera;
3817 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_PREVIEW_FORMAT;
3819 LOGD("Enter, handle :%x", pc->remote_handle);
3822 if (pc->cb_info == NULL) {
3823 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3824 return CAMERA_ERROR_INVALID_PARAMETER;
3826 sock_fd = pc->cb_info->fd;
3827 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_FORMAT] = foreach_cb;
3828 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_FORMAT] = user_data;
3830 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3831 LOGD("ret : 0x%x", ret);
3836 int camera_get_recommended_preview_resolution(camera_h camera, int *width, int *height)
3838 if (camera == NULL || width == NULL || height == NULL) {
3839 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3840 return CAMERA_ERROR_INVALID_PARAMETER;
3842 int ret = CAMERA_ERROR_NONE;
3844 camera_cli_s *pc = (camera_cli_s *)camera;
3845 muse_camera_api_e api = MUSE_CAMERA_API_GET_RECOMMENDED_PREVIEW_RESOLUTION;
3847 if (pc->cb_info == NULL) {
3848 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3849 return CAMERA_ERROR_INVALID_PARAMETER;
3851 sock_fd = pc->cb_info->fd;
3855 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3856 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3858 if (ret == CAMERA_ERROR_NONE) {
3859 muse_camera_msg_get(get_width, pc->cb_info->recv_msg);
3860 muse_camera_msg_get(get_height, pc->cb_info->recv_msg);
3862 *height = get_height;
3864 LOGD("ret : 0x%x", ret);
3869 int camera_attr_get_lens_orientation(camera_h camera, int *angle)
3871 if (camera == NULL || angle == NULL) {
3872 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3873 return CAMERA_ERROR_INVALID_PARAMETER;
3875 int ret = CAMERA_ERROR_NONE;
3877 camera_cli_s *pc = (camera_cli_s *)camera;
3878 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_LENS_ORIENTATION;
3880 if (pc->cb_info == NULL) {
3881 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3882 return CAMERA_ERROR_INVALID_PARAMETER;
3884 sock_fd = pc->cb_info->fd;
3887 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3888 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3890 if (ret == CAMERA_ERROR_NONE) {
3891 muse_camera_msg_get(get_angle, pc->cb_info->recv_msg);
3894 LOGD("ret : 0x%x", ret);
3898 int camera_attr_set_theater_mode(camera_h camera, camera_attr_theater_mode_e mode)
3900 if (camera == NULL) {
3901 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3902 return CAMERA_ERROR_INVALID_PARAMETER;
3904 int ret = CAMERA_ERROR_NONE;
3905 camera_cli_s *pc = (camera_cli_s *)camera;
3906 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_THEATER_MODE;
3908 if (pc->cb_info == NULL) {
3909 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3910 return CAMERA_ERROR_INVALID_PARAMETER;
3912 sock_fd = pc->cb_info->fd;
3913 int set_mode = (int)mode;
3914 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3915 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
3916 LOGD("ret : 0x%x", ret);
3920 int camera_attr_get_theater_mode(camera_h camera, camera_attr_theater_mode_e *mode)
3922 if (camera == NULL || mode == NULL) {
3923 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3924 return CAMERA_ERROR_INVALID_PARAMETER;
3927 int ret = CAMERA_ERROR_NONE;
3928 camera_cli_s *pc = (camera_cli_s *)camera;
3929 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_THEATER_MODE;
3931 if (pc->cb_info == NULL) {
3932 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3933 return CAMERA_ERROR_INVALID_PARAMETER;
3935 sock_fd = pc->cb_info->fd;
3937 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3938 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3940 if (ret == CAMERA_ERROR_NONE) {
3941 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
3942 *mode = (camera_attr_theater_mode_e)get_mode;
3944 LOGD("ret : 0x%x", ret);
3948 int camera_attr_foreach_supported_theater_mode(camera_h camera, camera_attr_supported_theater_mode_cb foreach_cb, void *user_data)
3950 if (camera == NULL || foreach_cb == NULL) {
3951 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3952 return CAMERA_ERROR_INVALID_PARAMETER;
3954 int ret = CAMERA_ERROR_NONE;
3956 camera_cli_s *pc = (camera_cli_s *)camera;
3957 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_THEATER_MODE;
3959 LOGD("Enter, handle :%x", pc->remote_handle);
3962 if (pc->cb_info == NULL) {
3963 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3964 return CAMERA_ERROR_INVALID_PARAMETER;
3966 sock_fd = pc->cb_info->fd;
3967 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE] = foreach_cb;
3968 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE] = user_data;
3970 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3972 LOGD("Finish, return :%x", ret);
3977 int camera_attr_set_preview_fps(camera_h camera, camera_attr_fps_e fps)
3979 if (camera == NULL) {
3980 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3981 return CAMERA_ERROR_INVALID_PARAMETER;
3983 int ret = CAMERA_ERROR_NONE;
3984 camera_cli_s *pc = (camera_cli_s *)camera;
3985 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_PREVIEW_FPS;
3987 if (pc->cb_info == NULL) {
3988 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3989 return CAMERA_ERROR_INVALID_PARAMETER;
3991 sock_fd = pc->cb_info->fd;
3992 int set_fps = (int)fps;
3993 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3994 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_fps);
3995 LOGD("ret : 0x%x", ret);
4000 int camera_attr_set_image_quality(camera_h camera, int quality)
4002 if (camera == NULL) {
4003 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4004 return CAMERA_ERROR_INVALID_PARAMETER;
4006 int ret = CAMERA_ERROR_NONE;
4008 camera_cli_s *pc = (camera_cli_s *)camera;
4009 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_IMAGE_QUALITY;
4011 if (pc->cb_info == NULL) {
4012 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4013 return CAMERA_ERROR_INVALID_PARAMETER;
4015 sock_fd = pc->cb_info->fd;
4016 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4017 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, quality);
4018 LOGD("ret : 0x%x", ret);
4022 int camera_attr_get_preview_fps(camera_h camera, camera_attr_fps_e *fps)
4024 if (camera == NULL || fps == NULL) {
4025 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4026 return CAMERA_ERROR_INVALID_PARAMETER;
4028 int ret = CAMERA_ERROR_NONE;
4030 camera_cli_s *pc = (camera_cli_s *)camera;
4031 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_PREVIEW_FPS;
4034 if (pc->cb_info == NULL) {
4035 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4036 return CAMERA_ERROR_INVALID_PARAMETER;
4038 sock_fd = pc->cb_info->fd;
4040 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4041 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4043 if (ret == CAMERA_ERROR_NONE) {
4044 muse_camera_msg_get(get_fps, pc->cb_info->recv_msg);
4045 *fps = (camera_attr_fps_e)get_fps;
4047 LOGD("ret : 0x%x", ret);
4052 int camera_attr_get_image_quality(camera_h camera, int *quality)
4054 if (camera == NULL || quality == NULL) {
4055 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4056 return CAMERA_ERROR_INVALID_PARAMETER;
4058 int ret = CAMERA_ERROR_NONE;
4060 camera_cli_s *pc = (camera_cli_s *)camera;
4061 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_IMAGE_QUALITY;
4063 if (pc->cb_info == NULL) {
4064 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4065 return CAMERA_ERROR_INVALID_PARAMETER;
4067 sock_fd = pc->cb_info->fd;
4069 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4070 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4072 if (ret == CAMERA_ERROR_NONE) {
4073 muse_camera_msg_get(get_quality, pc->cb_info->recv_msg);
4074 *quality = get_quality;
4076 LOGD("ret : 0x%x", ret);
4081 int camera_attr_get_encoded_preview_bitrate(camera_h camera, int *bitrate)
4083 if (camera == NULL || bitrate == NULL) {
4084 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4085 return CAMERA_ERROR_INVALID_PARAMETER;
4088 int ret = CAMERA_ERROR_NONE;
4090 camera_cli_s *pc = (camera_cli_s *)camera;
4091 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ENCODED_PREVIEW_BITRATE;
4093 if (pc->cb_info == NULL) {
4094 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4095 return CAMERA_ERROR_INVALID_PARAMETER;
4097 sock_fd = pc->cb_info->fd;
4100 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4101 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4103 if (ret == CAMERA_ERROR_NONE) {
4104 muse_camera_msg_get(get_bitrate, pc->cb_info->recv_msg);
4105 *bitrate = get_bitrate;
4107 LOGD("ret : 0x%x", ret);
4112 int camera_attr_set_encoded_preview_bitrate(camera_h camera, int bitrate)
4114 if (camera == NULL) {
4115 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4116 return CAMERA_ERROR_INVALID_PARAMETER;
4119 int ret = CAMERA_ERROR_NONE;
4121 camera_cli_s *pc = (camera_cli_s *)camera;
4122 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ENCODED_PREVIEW_BITRATE;
4124 if (pc->cb_info == NULL) {
4125 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4126 return CAMERA_ERROR_INVALID_PARAMETER;
4128 sock_fd = pc->cb_info->fd;
4129 int set_bitrate = bitrate;
4130 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4131 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_bitrate);
4132 LOGD("ret : 0x%x", ret);
4137 int camera_attr_get_encoded_preview_gop_interval(camera_h camera, int *interval)
4139 if (camera == NULL || interval == NULL) {
4140 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4141 return CAMERA_ERROR_INVALID_PARAMETER;
4144 int ret = CAMERA_ERROR_NONE;
4146 camera_cli_s *pc = (camera_cli_s *)camera;
4147 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ENCODED_PREVIEW_GOP_INTERVAL;
4149 if (pc->cb_info == NULL) {
4150 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4151 return CAMERA_ERROR_INVALID_PARAMETER;
4153 sock_fd = pc->cb_info->fd;
4154 int get_gop_interval;
4156 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4157 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4159 if (ret == CAMERA_ERROR_NONE) {
4160 muse_camera_msg_get(get_gop_interval, pc->cb_info->recv_msg);
4161 *interval = get_gop_interval;
4163 LOGD("ret : 0x%x", ret);
4168 int camera_attr_set_encoded_preview_gop_interval(camera_h camera, int interval)
4170 if (camera == NULL) {
4171 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4172 return CAMERA_ERROR_INVALID_PARAMETER;
4175 int ret = CAMERA_ERROR_NONE;
4177 camera_cli_s *pc = (camera_cli_s *)camera;
4178 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ENCODED_PREVIEW_GOP_INTERVAL;
4180 if (pc->cb_info == NULL) {
4181 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4182 return CAMERA_ERROR_INVALID_PARAMETER;
4184 sock_fd = pc->cb_info->fd;
4185 int set_gop_interval = interval;
4186 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4187 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_gop_interval);
4188 LOGD("ret : 0x%x", ret);
4193 int camera_attr_set_zoom(camera_h camera, int zoom)
4195 if (camera == NULL) {
4196 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4197 return CAMERA_ERROR_INVALID_PARAMETER;
4199 int ret = CAMERA_ERROR_NONE;
4201 camera_cli_s *pc = (camera_cli_s *)camera;
4202 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ZOOM;
4204 if (pc->cb_info == NULL) {
4205 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4206 return CAMERA_ERROR_INVALID_PARAMETER;
4208 sock_fd = pc->cb_info->fd;
4210 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4211 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, zoom);
4212 LOGD("ret : 0x%x", ret);
4216 int camera_attr_set_af_mode(camera_h camera, camera_attr_af_mode_e mode)
4218 if (camera == NULL) {
4219 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4220 return CAMERA_ERROR_INVALID_PARAMETER;
4222 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_AF_MODE;
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 int set_mode = (int)mode;
4233 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4234 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
4235 LOGD("ret : 0x%x", ret);
4239 int camera_attr_set_af_area(camera_h camera, int x, int y)
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_AF_AREA;
4248 int sock_fd = pc->cb_info->fd;
4249 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4250 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, x, INT, y);
4251 LOGD("ret : 0x%x", ret);
4256 int camera_attr_clear_af_area(camera_h camera)
4258 if (camera == NULL) {
4259 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4260 return CAMERA_ERROR_INVALID_PARAMETER;
4262 int ret = CAMERA_ERROR_NONE;
4264 camera_cli_s *pc = (camera_cli_s *)camera;
4265 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_CLEAR_AF_AREA;
4267 if (pc->cb_info == NULL) {
4268 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4269 return CAMERA_ERROR_INVALID_PARAMETER;
4271 sock_fd = pc->cb_info->fd;
4272 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4273 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4274 LOGD("ret : 0x%x", ret);
4279 int camera_attr_set_exposure_mode(camera_h camera, camera_attr_exposure_mode_e mode)
4281 if (camera == NULL) {
4282 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4283 return CAMERA_ERROR_INVALID_PARAMETER;
4286 if (mode < CAMERA_ATTR_EXPOSURE_MODE_OFF || mode > CAMERA_ATTR_EXPOSURE_MODE_CUSTOM) {
4287 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4288 return CAMERA_ERROR_INVALID_PARAMETER;
4291 int ret = CAMERA_ERROR_NONE;
4292 camera_cli_s *pc = (camera_cli_s *)camera;
4293 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EXPOSURE_MODE;
4294 int set_mode = (int)mode;
4296 if (pc->cb_info == NULL) {
4297 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4298 return CAMERA_ERROR_INVALID_PARAMETER;
4300 sock_fd = pc->cb_info->fd;
4301 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4302 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
4303 LOGD("ret : 0x%x", ret);
4308 int camera_attr_set_exposure(camera_h camera, int value)
4310 if (camera == NULL) {
4311 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4312 return CAMERA_ERROR_INVALID_PARAMETER;
4314 int ret = CAMERA_ERROR_NONE;
4316 camera_cli_s *pc = (camera_cli_s *)camera;
4317 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EXPOSURE;
4319 if (pc->cb_info == NULL) {
4320 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4321 return CAMERA_ERROR_INVALID_PARAMETER;
4323 sock_fd = pc->cb_info->fd;
4325 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4326 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, value);
4327 LOGD("ret : 0x%x", ret);
4332 int camera_attr_set_iso(camera_h camera, camera_attr_iso_e iso)
4334 if (camera == NULL) {
4335 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4336 return CAMERA_ERROR_INVALID_PARAMETER;
4338 int ret = CAMERA_ERROR_NONE;
4340 camera_cli_s *pc = (camera_cli_s *)camera;
4341 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ISO;
4343 if (pc->cb_info == NULL) {
4344 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4345 return CAMERA_ERROR_INVALID_PARAMETER;
4347 sock_fd = pc->cb_info->fd;
4348 int set_iso = (int)iso;
4349 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4350 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_iso);
4351 LOGD("ret : 0x%x", ret);
4356 int camera_attr_set_brightness(camera_h camera, int level)
4358 if (camera == NULL) {
4359 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4360 return CAMERA_ERROR_INVALID_PARAMETER;
4362 int ret = CAMERA_ERROR_NONE;
4364 camera_cli_s *pc = (camera_cli_s *)camera;
4365 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_BRIGHTNESS;
4367 if (pc->cb_info == NULL) {
4368 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4369 return CAMERA_ERROR_INVALID_PARAMETER;
4371 sock_fd = pc->cb_info->fd;
4373 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4374 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, level);
4375 LOGD("ret : 0x%x", ret);
4380 int camera_attr_set_contrast(camera_h camera, int level)
4382 if (camera == NULL) {
4383 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4384 return CAMERA_ERROR_INVALID_PARAMETER;
4386 int ret = CAMERA_ERROR_NONE;
4388 camera_cli_s *pc = (camera_cli_s *)camera;
4389 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_CONTRAST;
4391 if (pc->cb_info == NULL) {
4392 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4393 return CAMERA_ERROR_INVALID_PARAMETER;
4395 sock_fd = pc->cb_info->fd;
4397 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4398 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, level);
4399 LOGD("ret : 0x%x", ret);
4404 int camera_attr_set_whitebalance(camera_h camera, camera_attr_whitebalance_e wb)
4406 if (camera == NULL) {
4407 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4408 return CAMERA_ERROR_INVALID_PARAMETER;
4411 if (wb < CAMERA_ATTR_WHITE_BALANCE_NONE || wb > CAMERA_ATTR_WHITE_BALANCE_CUSTOM) {
4412 LOGE("invalid white balance %d", wb);
4413 return CAMERA_ERROR_INVALID_PARAMETER;
4416 int ret = CAMERA_ERROR_NONE;
4418 camera_cli_s *pc = (camera_cli_s *)camera;
4419 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_WHITEBALANCE;
4421 if (pc->cb_info == NULL) {
4422 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4423 return CAMERA_ERROR_INVALID_PARAMETER;
4425 sock_fd = pc->cb_info->fd;
4426 int set_whitebalance = (int)wb;
4427 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4428 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_whitebalance);
4429 LOGD("ret : 0x%x", ret);
4434 int camera_attr_set_effect(camera_h camera, camera_attr_effect_mode_e effect)
4436 if (camera == NULL) {
4437 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4438 return CAMERA_ERROR_INVALID_PARAMETER;
4440 int ret = CAMERA_ERROR_NONE;
4442 camera_cli_s *pc = (camera_cli_s *)camera;
4443 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EFFECT;
4445 if (pc->cb_info == NULL) {
4446 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4447 return CAMERA_ERROR_INVALID_PARAMETER;
4449 sock_fd = pc->cb_info->fd;
4450 int set_effect = (int)effect;
4451 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4452 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_effect);
4453 LOGD("ret : 0x%x", ret);
4458 int camera_attr_set_scene_mode(camera_h camera, camera_attr_scene_mode_e mode)
4460 if (camera == NULL) {
4461 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4462 return CAMERA_ERROR_INVALID_PARAMETER;
4464 int ret = CAMERA_ERROR_NONE;
4466 camera_cli_s *pc = (camera_cli_s *)camera;
4467 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_SCENE_MODE;
4469 if (pc->cb_info == NULL) {
4470 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4471 return CAMERA_ERROR_INVALID_PARAMETER;
4473 sock_fd = pc->cb_info->fd;
4474 int set_mode = (int)mode;
4475 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4476 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
4477 LOGD("ret : 0x%x", ret);
4482 int camera_attr_enable_tag(camera_h camera, bool enable)
4484 if (camera == NULL) {
4485 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4486 return CAMERA_ERROR_INVALID_PARAMETER;
4488 int ret = CAMERA_ERROR_NONE;
4489 camera_cli_s *pc = (camera_cli_s *)camera;
4490 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_TAG;
4492 if (pc->cb_info == NULL) {
4493 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4494 return CAMERA_ERROR_INVALID_PARAMETER;
4496 sock_fd = pc->cb_info->fd;
4497 int set_enable = (int)enable;
4499 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4500 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
4501 LOGD("ret : 0x%x", ret);
4506 int camera_attr_set_tag_image_description(camera_h camera, const char *description)
4508 if (camera == NULL) {
4509 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4510 return CAMERA_ERROR_INVALID_PARAMETER;
4512 if (description == NULL) {
4513 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4514 return CAMERA_ERROR_INVALID_PARAMETER;
4516 int ret = CAMERA_ERROR_NONE;
4517 camera_cli_s *pc = (camera_cli_s *)camera;
4518 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_IMAGE_DESCRIPTION;
4520 if (pc->cb_info == NULL) {
4521 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4522 return CAMERA_ERROR_INVALID_PARAMETER;
4524 sock_fd = pc->cb_info->fd;
4525 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4526 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, STRING, description);
4527 LOGD("ret : 0x%x", ret);
4532 int camera_attr_set_tag_orientation(camera_h camera, camera_attr_tag_orientation_e orientation)
4534 if (camera == NULL) {
4535 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4536 return CAMERA_ERROR_INVALID_PARAMETER;
4538 int ret = CAMERA_ERROR_NONE;
4539 camera_cli_s *pc = (camera_cli_s *)camera;
4540 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_ORIENTATION;
4542 if (pc->cb_info == NULL) {
4543 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4544 return CAMERA_ERROR_INVALID_PARAMETER;
4546 sock_fd = pc->cb_info->fd;
4547 int set_orientation = (int)orientation;
4549 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4550 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_orientation);
4551 LOGD("ret : 0x%x", ret);
4556 int camera_attr_set_tag_software(camera_h camera, const char *software)
4558 if (camera == NULL) {
4559 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4560 return CAMERA_ERROR_INVALID_PARAMETER;
4562 if (software == NULL) {
4563 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4564 return CAMERA_ERROR_INVALID_PARAMETER;
4566 int ret = CAMERA_ERROR_NONE;
4567 camera_cli_s *pc = (camera_cli_s *)camera;
4568 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_SOFTWARE;
4570 if (pc->cb_info == NULL) {
4571 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4572 return CAMERA_ERROR_INVALID_PARAMETER;
4574 sock_fd = pc->cb_info->fd;
4575 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4576 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, STRING, software);
4577 LOGD("ret : 0x%x", ret);
4582 int camera_attr_set_geotag(camera_h camera, double latitude , double longitude, double altitude)
4584 if (camera == NULL) {
4585 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4586 return CAMERA_ERROR_INVALID_PARAMETER;
4588 int ret = CAMERA_ERROR_NONE;
4589 camera_cli_s *pc = (camera_cli_s *)camera;
4590 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_GEOTAG;
4592 if (pc->cb_info == NULL) {
4593 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4594 return CAMERA_ERROR_INVALID_PARAMETER;
4596 sock_fd = pc->cb_info->fd;
4597 double set_geotag[3] = { latitude, longitude, altitude };
4599 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4600 muse_camera_msg_send_array(api, sock_fd, pc->cb_info, ret,
4601 set_geotag, sizeof(set_geotag), sizeof(double));
4602 LOGD("ret : 0x%x", ret);
4607 int camera_attr_remove_geotag(camera_h camera)
4609 if (camera == NULL) {
4610 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4611 return CAMERA_ERROR_INVALID_PARAMETER;
4613 int ret = CAMERA_ERROR_NONE;
4614 camera_cli_s *pc = (camera_cli_s *)camera;
4615 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_REMOVE_GEOTAG;
4617 if (pc->cb_info == NULL) {
4618 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4619 return CAMERA_ERROR_INVALID_PARAMETER;
4621 sock_fd = pc->cb_info->fd;
4622 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4623 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4624 LOGD("ret : 0x%x", ret);
4629 int camera_attr_set_flash_mode(camera_h camera, camera_attr_flash_mode_e mode)
4631 if (camera == NULL) {
4632 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4633 return CAMERA_ERROR_INVALID_PARAMETER;
4635 int ret = CAMERA_ERROR_NONE;
4636 camera_cli_s *pc = (camera_cli_s *)camera;
4637 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_FLASH_MODE;
4639 if (pc->cb_info == NULL) {
4640 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4641 return CAMERA_ERROR_INVALID_PARAMETER;
4643 sock_fd = pc->cb_info->fd;
4644 int set_mode = (int)mode;
4646 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4647 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
4648 LOGD("ret : 0x%x", ret);
4653 int camera_attr_get_zoom(camera_h camera, int *zoom)
4655 if (camera == NULL || zoom == NULL) {
4656 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4657 return CAMERA_ERROR_INVALID_PARAMETER;
4659 int ret = CAMERA_ERROR_NONE;
4661 camera_cli_s *pc = (camera_cli_s *)camera;
4662 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ZOOM;
4665 if (pc->cb_info == NULL) {
4666 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4667 return CAMERA_ERROR_INVALID_PARAMETER;
4669 sock_fd = pc->cb_info->fd;
4671 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4672 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4674 if (ret == CAMERA_ERROR_NONE) {
4675 muse_camera_msg_get(get_zoom, pc->cb_info->recv_msg);
4678 LOGD("ret : 0x%x", ret);
4683 int camera_attr_get_zoom_range(camera_h camera, int *min, int *max)
4685 if (camera == NULL || min == NULL || max == NULL) {
4686 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4687 return CAMERA_ERROR_INVALID_PARAMETER;
4689 int ret = CAMERA_ERROR_NONE;
4690 camera_cli_s *pc = (camera_cli_s *)camera;
4692 if (pc->cb_info == NULL) {
4693 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4694 return CAMERA_ERROR_INVALID_PARAMETER;
4696 sock_fd = pc->cb_info->fd;
4697 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ZOOM_RANGE;
4701 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4702 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4704 if (ret == CAMERA_ERROR_NONE) {
4705 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
4706 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
4710 LOGD("ret : 0x%x", ret);
4715 int camera_attr_get_af_mode(camera_h camera, camera_attr_af_mode_e *mode)
4717 if (camera == NULL || mode == NULL) {
4718 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4719 return CAMERA_ERROR_INVALID_PARAMETER;
4721 int ret = CAMERA_ERROR_NONE;
4722 camera_cli_s *pc = (camera_cli_s *)camera;
4724 if (pc->cb_info == NULL) {
4725 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4726 return CAMERA_ERROR_INVALID_PARAMETER;
4728 sock_fd = pc->cb_info->fd;
4729 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_AF_MODE;
4732 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4733 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4735 if (ret == CAMERA_ERROR_NONE) {
4736 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
4737 *mode = (camera_attr_af_mode_e)get_mode;
4739 LOGD("ret : 0x%x", ret);
4744 int camera_attr_get_exposure_mode(camera_h camera, camera_attr_exposure_mode_e *mode)
4746 if (camera == NULL || mode == NULL) {
4747 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4748 return CAMERA_ERROR_INVALID_PARAMETER;
4750 int ret = CAMERA_ERROR_NONE;
4751 camera_cli_s *pc = (camera_cli_s *)camera;
4753 if (pc->cb_info == NULL) {
4754 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4755 return CAMERA_ERROR_INVALID_PARAMETER;
4757 sock_fd = pc->cb_info->fd;
4758 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE_MODE;
4761 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4762 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4764 if (ret == CAMERA_ERROR_NONE) {
4765 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
4766 *mode = (camera_attr_exposure_mode_e)get_mode;
4768 LOGD("ret : 0x%x", ret);
4772 int camera_attr_get_exposure(camera_h camera, int *value)
4774 if (camera == NULL || value == NULL) {
4775 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4776 return CAMERA_ERROR_INVALID_PARAMETER;
4778 int ret = CAMERA_ERROR_NONE;
4779 camera_cli_s *pc = (camera_cli_s *)camera;
4781 if (pc->cb_info == NULL) {
4782 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4783 return CAMERA_ERROR_INVALID_PARAMETER;
4785 sock_fd = pc->cb_info->fd;
4786 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE;
4789 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4790 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4792 if (ret == CAMERA_ERROR_NONE) {
4793 muse_camera_msg_get(get_value, pc->cb_info->recv_msg);
4796 LOGD("ret : 0x%x", ret);
4801 int camera_attr_get_exposure_range(camera_h camera, int *min, int *max)
4803 if (camera == NULL || min == NULL || max == NULL) {
4804 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4805 return CAMERA_ERROR_INVALID_PARAMETER;
4807 int ret = CAMERA_ERROR_NONE;
4808 camera_cli_s *pc = (camera_cli_s *)camera;
4810 if (pc->cb_info == NULL) {
4811 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4812 return CAMERA_ERROR_INVALID_PARAMETER;
4814 sock_fd = pc->cb_info->fd;
4815 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE_RANGE;
4819 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4820 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4822 if (ret == CAMERA_ERROR_NONE) {
4823 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
4824 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
4828 LOGD("ret : 0x%x", ret);
4833 int camera_attr_get_iso(camera_h camera, camera_attr_iso_e *iso)
4835 if (camera == NULL || iso == NULL) {
4836 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4837 return CAMERA_ERROR_INVALID_PARAMETER;
4839 int ret = CAMERA_ERROR_NONE;
4840 camera_cli_s *pc = (camera_cli_s *)camera;
4842 if (pc->cb_info == NULL) {
4843 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4844 return CAMERA_ERROR_INVALID_PARAMETER;
4846 sock_fd = pc->cb_info->fd;
4847 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ISO;
4850 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4851 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4853 if (ret == CAMERA_ERROR_NONE) {
4854 muse_camera_msg_get(get_iso, pc->cb_info->recv_msg);
4855 *iso = (camera_attr_iso_e)get_iso;
4857 LOGD("ret : 0x%x", ret);
4862 int camera_attr_get_brightness(camera_h camera, int *level)
4864 if (camera == NULL || level == NULL) {
4865 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4866 return CAMERA_ERROR_INVALID_PARAMETER;
4868 int ret = CAMERA_ERROR_NONE;
4869 camera_cli_s *pc = (camera_cli_s *)camera;
4871 if (pc->cb_info == NULL) {
4872 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4873 return CAMERA_ERROR_INVALID_PARAMETER;
4875 sock_fd = pc->cb_info->fd;
4876 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_BRIGHTNESS;
4879 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4880 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4882 if (ret == CAMERA_ERROR_NONE) {
4883 muse_camera_msg_get(get_level, pc->cb_info->recv_msg);
4886 LOGD("ret : 0x%x", ret);
4891 int camera_attr_get_brightness_range(camera_h camera, int *min, int *max)
4893 if (camera == NULL || min == NULL || max == NULL) {
4894 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4895 return CAMERA_ERROR_INVALID_PARAMETER;
4897 int ret = CAMERA_ERROR_NONE;
4898 camera_cli_s *pc = (camera_cli_s *)camera;
4900 if (pc->cb_info == NULL) {
4901 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4902 return CAMERA_ERROR_INVALID_PARAMETER;
4904 sock_fd = pc->cb_info->fd;
4905 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_BRIGHTNESS_RANGE;
4909 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4910 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4912 if (ret == CAMERA_ERROR_NONE) {
4913 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
4914 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
4918 LOGD("ret : 0x%x", ret);
4923 int camera_attr_get_contrast(camera_h camera, int *level)
4925 if (camera == NULL || level == NULL) {
4926 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4927 return CAMERA_ERROR_INVALID_PARAMETER;
4929 int ret = CAMERA_ERROR_NONE;
4930 camera_cli_s *pc = (camera_cli_s *)camera;
4931 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_CONTRAST;
4933 if (pc->cb_info == NULL) {
4934 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4935 return CAMERA_ERROR_INVALID_PARAMETER;
4937 sock_fd = pc->cb_info->fd;
4940 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4941 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4943 if (ret == CAMERA_ERROR_NONE) {
4944 muse_camera_msg_get(get_level, pc->cb_info->recv_msg);
4947 LOGD("ret : 0x%x", ret);
4952 int camera_attr_get_contrast_range(camera_h camera, int *min , int *max)
4954 if (camera == NULL || min == NULL || max == NULL) {
4955 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4956 return CAMERA_ERROR_INVALID_PARAMETER;
4958 int ret = CAMERA_ERROR_NONE;
4959 camera_cli_s *pc = (camera_cli_s *)camera;
4960 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_CONTRAST_RANGE;
4962 if (pc->cb_info == NULL) {
4963 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4964 return CAMERA_ERROR_INVALID_PARAMETER;
4966 sock_fd = pc->cb_info->fd;
4970 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4971 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4973 if (ret == CAMERA_ERROR_NONE) {
4974 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
4975 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
4979 LOGD("ret : 0x%x", ret);
4984 int camera_attr_get_whitebalance(camera_h camera, camera_attr_whitebalance_e *wb)
4986 if (camera == NULL || wb == NULL) {
4987 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4988 return CAMERA_ERROR_INVALID_PARAMETER;
4990 int ret = CAMERA_ERROR_NONE;
4991 camera_cli_s *pc = (camera_cli_s *)camera;
4992 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_WHITEBALANCE;
4994 if (pc->cb_info == NULL) {
4995 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4996 return CAMERA_ERROR_INVALID_PARAMETER;
4998 sock_fd = pc->cb_info->fd;
5001 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5002 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5004 if (ret == CAMERA_ERROR_NONE) {
5005 muse_camera_msg_get(get_wb, pc->cb_info->recv_msg);
5006 *wb = (camera_attr_whitebalance_e)get_wb;
5008 LOGD("ret : 0x%x", ret);
5013 int camera_attr_get_effect(camera_h camera, camera_attr_effect_mode_e *effect)
5015 if (camera == NULL || effect == NULL) {
5016 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5017 return CAMERA_ERROR_INVALID_PARAMETER;
5020 int ret = CAMERA_ERROR_NONE;
5021 camera_cli_s *pc = (camera_cli_s *)camera;
5022 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EFFECT;
5024 if (pc->cb_info == NULL) {
5025 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5026 return CAMERA_ERROR_INVALID_PARAMETER;
5028 sock_fd = pc->cb_info->fd;
5031 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5032 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5034 if (ret == CAMERA_ERROR_NONE) {
5035 muse_camera_msg_get(get_effect, pc->cb_info->recv_msg);
5036 *effect = (camera_attr_effect_mode_e)get_effect;
5038 LOGD("ret : 0x%x", ret);
5043 int camera_attr_get_scene_mode(camera_h camera, camera_attr_scene_mode_e *mode)
5045 if (camera == NULL || mode == NULL) {
5046 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5047 return CAMERA_ERROR_INVALID_PARAMETER;
5050 int ret = CAMERA_ERROR_NONE;
5051 camera_cli_s *pc = (camera_cli_s *)camera;
5052 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_SCENE_MODE;
5054 if (pc->cb_info == NULL) {
5055 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5056 return CAMERA_ERROR_INVALID_PARAMETER;
5058 sock_fd = pc->cb_info->fd;
5061 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5062 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5064 if (ret == CAMERA_ERROR_NONE) {
5065 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
5066 *mode = (camera_attr_scene_mode_e)get_mode;
5068 LOGD("ret : 0x%x", ret);
5073 int camera_attr_is_enabled_tag(camera_h camera, bool *enable)
5075 if (camera == NULL || enable == NULL) {
5076 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5077 return CAMERA_ERROR_INVALID_PARAMETER;
5080 int ret = CAMERA_ERROR_NONE;
5081 camera_cli_s *pc = (camera_cli_s *)camera;
5082 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_TAG;
5084 if (pc->cb_info == NULL) {
5085 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5086 return CAMERA_ERROR_INVALID_PARAMETER;
5088 sock_fd = pc->cb_info->fd;
5091 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5092 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5094 if (ret == CAMERA_ERROR_NONE) {
5095 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
5096 *enable = (bool)get_enabled;
5098 LOGD("ret : 0x%x", ret);
5103 int camera_attr_get_tag_image_description(camera_h camera, char **description)
5105 if (camera == NULL || description == NULL) {
5106 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5107 return CAMERA_ERROR_INVALID_PARAMETER;
5110 int ret = CAMERA_ERROR_NONE;
5111 camera_cli_s *pc = (camera_cli_s *)camera;
5112 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_IMAGE_DESCRIPTION;
5114 if (pc->cb_info == NULL) {
5115 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5116 return CAMERA_ERROR_INVALID_PARAMETER;
5118 sock_fd = pc->cb_info->fd;
5119 char get_description[MUSE_CAMERA_MSG_MAX_LENGTH] = {0,};
5121 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5122 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5124 if (ret == CAMERA_ERROR_NONE) {
5125 muse_camera_msg_get_string(get_description, pc->cb_info->recv_msg);
5126 *description = strdup(get_description);
5128 LOGD("ret : 0x%x", ret);
5133 int camera_attr_get_tag_orientation(camera_h camera, camera_attr_tag_orientation_e *orientation)
5135 if (camera == NULL || orientation == NULL) {
5136 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5137 return CAMERA_ERROR_INVALID_PARAMETER;
5140 int ret = CAMERA_ERROR_NONE;
5141 camera_cli_s *pc = (camera_cli_s *)camera;
5142 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_ORIENTATION;
5144 if (pc->cb_info == NULL) {
5145 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5146 return CAMERA_ERROR_INVALID_PARAMETER;
5148 sock_fd = pc->cb_info->fd;
5149 int get_orientation;
5151 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5152 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5154 if (ret == CAMERA_ERROR_NONE) {
5155 muse_camera_msg_get(get_orientation, pc->cb_info->recv_msg);
5156 *orientation = (camera_attr_tag_orientation_e)get_orientation;
5157 LOGD("success, orientation : %d", *orientation);
5159 LOGD("ret : 0x%x", ret);
5164 int camera_attr_get_tag_software(camera_h camera, char **software)
5166 if (camera == NULL || software == NULL) {
5167 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5168 return CAMERA_ERROR_INVALID_PARAMETER;
5171 int ret = CAMERA_ERROR_NONE;
5172 camera_cli_s *pc = (camera_cli_s *)camera;
5173 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_SOFTWARE;
5175 if (pc->cb_info == NULL) {
5176 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5177 return CAMERA_ERROR_INVALID_PARAMETER;
5179 sock_fd = pc->cb_info->fd;
5180 char get_software[MUSE_CAMERA_MSG_MAX_LENGTH] = {0,};
5182 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5183 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5185 if (ret == CAMERA_ERROR_NONE) {
5186 muse_camera_msg_get_string(get_software, pc->cb_info->recv_msg);
5187 *software = strdup(get_software);
5189 LOGD("ret : 0x%x", ret);
5194 int camera_attr_get_geotag(camera_h camera, double *latitude , double *longitude, double *altitude)
5196 if (camera == NULL || latitude == NULL || longitude == NULL || altitude == NULL) {
5197 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5198 return CAMERA_ERROR_INVALID_PARAMETER;
5201 int ret = CAMERA_ERROR_NONE;
5202 camera_cli_s *pc = (camera_cli_s *)camera;
5203 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_GEOTAG;
5204 double get_geotag[3] = {0,};
5206 if (pc->cb_info == NULL) {
5207 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5208 return CAMERA_ERROR_INVALID_PARAMETER;
5210 sock_fd = pc->cb_info->fd;
5212 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5214 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5216 if (ret == CAMERA_ERROR_NONE) {
5217 muse_camera_msg_get_array(get_geotag, pc->cb_info->recv_msg);
5218 *latitude = get_geotag[0];
5219 *longitude = get_geotag[1];
5220 *altitude = get_geotag[2];
5222 LOGD("ret : 0x%x", ret);
5224 LOGE("Returned value is not valid : 0x%x", ret);
5231 int camera_attr_get_flash_mode(camera_h camera, camera_attr_flash_mode_e *mode)
5233 if (camera == NULL || mode == NULL) {
5234 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5235 return CAMERA_ERROR_INVALID_PARAMETER;
5238 int ret = CAMERA_ERROR_NONE;
5239 camera_cli_s *pc = (camera_cli_s *)camera;
5240 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_FLASH_MODE;
5242 if (pc->cb_info == NULL) {
5243 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5244 return CAMERA_ERROR_INVALID_PARAMETER;
5246 sock_fd = pc->cb_info->fd;
5249 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5250 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5252 if (ret == CAMERA_ERROR_NONE) {
5253 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
5254 *mode = (camera_attr_flash_mode_e)get_mode;
5256 LOGD("ret : 0x%x", ret);
5261 int camera_get_flash_state(camera_device_e device, camera_flash_state_e *state)
5265 int ret = CAMERA_ERROR_NONE;
5266 camera_cli_s *pc = NULL;
5267 int get_flash_state = 0;
5269 /* create muse connection */
5270 muse_camera_api_e api = MUSE_CAMERA_API_GET_FLASH_STATE;
5271 muse_core_api_module_e muse_module = MUSE_CAMERA;
5272 int device_type = (int)device;
5274 if (state == NULL) {
5275 LOGE("invalid pointer for state");
5276 return CAMERA_ERROR_INVALID_PARAMETER;
5279 sock_fd = muse_core_client_new();
5281 LOGE("muse_core_client_new failed - returned fd %d", sock_fd);
5282 ret = CAMERA_ERROR_INVALID_OPERATION;
5286 sndMsg = muse_core_msg_json_factory_new(api,
5287 MUSE_TYPE_INT, "module", muse_module,
5288 MUSE_TYPE_INT, PARAM_DEVICE_TYPE, device_type,
5291 muse_core_ipc_send_msg(sock_fd, sndMsg);
5292 muse_core_msg_json_factory_free(sndMsg);
5294 pc = g_new0(camera_cli_s, 1);
5296 LOGE("camera_cli_s alloc failed");
5297 ret = CAMERA_ERROR_OUT_OF_MEMORY;
5301 pc->cb_info = _client_callback_new(sock_fd);
5302 if (pc->cb_info == NULL) {
5303 LOGE("cb_info alloc failed");
5304 ret = CAMERA_ERROR_OUT_OF_MEMORY;
5308 ret = _client_wait_for_cb_return(api, pc->cb_info, CALLBACK_TIME_OUT);
5310 if (ret == CAMERA_ERROR_NONE) {
5311 muse_camera_msg_get(get_flash_state, pc->cb_info->recv_msg);
5312 *state = (camera_flash_state_e)get_flash_state;
5315 LOGD("Flash state : %d\n", *state);
5318 /* release resources */
5320 g_atomic_int_set(&pc->cb_info->msg_recv_running, 0);
5321 g_atomic_int_set(&pc->cb_info->msg_handler_running, 0);
5322 _client_callback_destroy(pc->cb_info);
5332 int camera_attr_foreach_supported_af_mode(camera_h camera, camera_attr_supported_af_mode_cb foreach_cb, void *user_data)
5334 if (camera == NULL || foreach_cb == NULL) {
5335 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5336 return CAMERA_ERROR_INVALID_PARAMETER;
5338 int ret = CAMERA_ERROR_NONE;
5340 camera_cli_s *pc = (camera_cli_s *)camera;
5341 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_AF_MODE;
5343 LOGD("Enter, handle :%x", pc->remote_handle);
5346 if (pc->cb_info == NULL) {
5347 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5348 return CAMERA_ERROR_INVALID_PARAMETER;
5350 sock_fd = pc->cb_info->fd;
5351 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_AF_MODE] = foreach_cb;
5352 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_AF_MODE] = user_data;
5354 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5355 LOGD("ret : 0x%x", ret);
5360 int camera_attr_foreach_supported_exposure_mode(camera_h camera, camera_attr_supported_exposure_mode_cb foreach_cb , void *user_data)
5362 if (camera == NULL || foreach_cb == NULL) {
5363 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5364 return CAMERA_ERROR_INVALID_PARAMETER;
5366 int ret = CAMERA_ERROR_NONE;
5368 camera_cli_s *pc = (camera_cli_s *)camera;
5369 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_EXPOSURE_MODE;
5371 LOGD("Enter, handle :%x", pc->remote_handle);
5374 if (pc->cb_info == NULL) {
5375 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5376 return CAMERA_ERROR_INVALID_PARAMETER;
5378 sock_fd = pc->cb_info->fd;
5379 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EXPOSURE_MODE] = foreach_cb;
5380 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EXPOSURE_MODE] = user_data;
5382 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5383 LOGD("ret : 0x%x", ret);
5388 int camera_attr_foreach_supported_iso(camera_h camera, camera_attr_supported_iso_cb foreach_cb, void *user_data)
5390 if (camera == NULL || foreach_cb == NULL) {
5391 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5392 return CAMERA_ERROR_INVALID_PARAMETER;
5394 int ret = CAMERA_ERROR_NONE;
5396 camera_cli_s *pc = (camera_cli_s *)camera;
5397 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_ISO;
5399 LOGD("Enter, handle :%x", pc->remote_handle);
5402 if (pc->cb_info == NULL) {
5403 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5404 return CAMERA_ERROR_INVALID_PARAMETER;
5406 sock_fd = pc->cb_info->fd;
5407 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_ISO] = foreach_cb;
5408 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_ISO] = user_data;
5410 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5411 LOGD("ret : 0x%x", ret);
5416 int camera_attr_foreach_supported_whitebalance(camera_h camera, camera_attr_supported_whitebalance_cb foreach_cb , void *user_data)
5418 if (camera == NULL || foreach_cb == NULL) {
5419 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5420 return CAMERA_ERROR_INVALID_PARAMETER;
5422 int ret = CAMERA_ERROR_NONE;
5424 camera_cli_s *pc = (camera_cli_s *)camera;
5425 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_WHITEBALANCE;
5427 LOGD("Enter, handle :%x", pc->remote_handle);
5430 if (pc->cb_info == NULL) {
5431 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5432 return CAMERA_ERROR_INVALID_PARAMETER;
5434 sock_fd = pc->cb_info->fd;
5435 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_WHITEBALANCE] = foreach_cb;
5436 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_WHITEBALANCE] = user_data;
5438 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5439 LOGD("ret : 0x%x", ret);
5444 int camera_attr_foreach_supported_effect(camera_h camera, camera_attr_supported_effect_cb foreach_cb , void *user_data)
5446 if (camera == NULL || foreach_cb == NULL) {
5447 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5448 return CAMERA_ERROR_INVALID_PARAMETER;
5450 int ret = CAMERA_ERROR_NONE;
5452 camera_cli_s *pc = (camera_cli_s *)camera;
5453 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_EFFECT;
5455 LOGD("Enter, handle :%x", pc->remote_handle);
5458 if (pc->cb_info == NULL) {
5459 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5460 return CAMERA_ERROR_INVALID_PARAMETER;
5462 sock_fd = pc->cb_info->fd;
5463 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EFFECT] = foreach_cb;
5464 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EFFECT] = user_data;
5466 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5467 LOGD("ret : 0x%x", ret);
5472 int camera_attr_foreach_supported_scene_mode(camera_h camera, camera_attr_supported_scene_mode_cb foreach_cb , void *user_data)
5474 if (camera == NULL || foreach_cb == NULL) {
5475 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5476 return CAMERA_ERROR_INVALID_PARAMETER;
5478 int ret = CAMERA_ERROR_NONE;
5480 camera_cli_s *pc = (camera_cli_s *)camera;
5481 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_SCENE_MODE;
5483 LOGD("Enter, handle :%x", pc->remote_handle);
5486 if (pc->cb_info == NULL) {
5487 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5488 return CAMERA_ERROR_INVALID_PARAMETER;
5490 sock_fd = pc->cb_info->fd;
5491 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_SCENE_MODE] = foreach_cb;
5492 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_SCENE_MODE] = user_data;
5494 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5495 LOGD("ret : 0x%x", ret);
5500 int camera_attr_foreach_supported_flash_mode(camera_h camera, camera_attr_supported_flash_mode_cb foreach_cb , void *user_data)
5502 if (camera == NULL || foreach_cb == NULL) {
5503 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5504 return CAMERA_ERROR_INVALID_PARAMETER;
5506 int ret = CAMERA_ERROR_NONE;
5508 camera_cli_s *pc = (camera_cli_s *)camera;
5509 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FLASH_MODE;
5511 LOGD("Enter, handle :%x", pc->remote_handle);
5514 if (pc->cb_info == NULL) {
5515 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5516 return CAMERA_ERROR_INVALID_PARAMETER;
5518 sock_fd = pc->cb_info->fd;
5519 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FLASH_MODE] = foreach_cb;
5520 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FLASH_MODE] = user_data;
5522 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5523 LOGD("ret : 0x%x", ret);
5528 int camera_attr_foreach_supported_fps(camera_h camera, camera_attr_supported_fps_cb foreach_cb , void *user_data)
5530 if (camera == NULL || foreach_cb == NULL) {
5531 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5532 return CAMERA_ERROR_INVALID_PARAMETER;
5534 int ret = CAMERA_ERROR_NONE;
5536 camera_cli_s *pc = (camera_cli_s *)camera;
5537 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FPS;
5539 if (pc->cb_info == NULL) {
5540 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5541 return CAMERA_ERROR_INVALID_PARAMETER;
5543 sock_fd = pc->cb_info->fd;
5544 LOGD("Enter, handle :%x", pc->remote_handle);
5545 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS] = foreach_cb;
5546 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS] = user_data;
5548 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5549 LOGD("Enter, handle :%x", pc->remote_handle);
5553 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)
5555 if (camera == NULL || foreach_cb == NULL) {
5556 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5557 return CAMERA_ERROR_INVALID_PARAMETER;
5559 int ret = CAMERA_ERROR_NONE;
5561 camera_cli_s *pc = (camera_cli_s *)camera;
5562 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FPS_BY_RESOLUTION;
5564 if (pc->cb_info == NULL) {
5565 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5566 return CAMERA_ERROR_INVALID_PARAMETER;
5568 sock_fd = pc->cb_info->fd;
5569 LOGD("Enter, handle :%x", pc->remote_handle);
5570 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS_BY_RESOLUTION] = foreach_cb;
5571 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS_BY_RESOLUTION] = user_data;
5573 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, width, INT, height);
5574 LOGD("ret : 0x%x", ret);
5578 int camera_attr_foreach_supported_stream_flip(camera_h camera, camera_attr_supported_stream_flip_cb foreach_cb, void *user_data)
5580 if (camera == NULL || foreach_cb == NULL) {
5581 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5582 return CAMERA_ERROR_INVALID_PARAMETER;
5584 int ret = CAMERA_ERROR_NONE;
5586 camera_cli_s *pc = (camera_cli_s *)camera;
5587 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_STREAM_FLIP;
5589 if (pc->cb_info == NULL) {
5590 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5591 return CAMERA_ERROR_INVALID_PARAMETER;
5593 sock_fd = pc->cb_info->fd;
5594 LOGD("Enter, handle :%x", pc->remote_handle);
5595 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_FLIP] = foreach_cb;
5596 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_FLIP] = user_data;
5598 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5599 LOGD("ret : 0x%x", ret);
5604 int camera_attr_foreach_supported_stream_rotation(camera_h camera, camera_attr_supported_stream_rotation_cb foreach_cb, void *user_data)
5606 if (camera == NULL || foreach_cb == NULL) {
5607 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5608 return CAMERA_ERROR_INVALID_PARAMETER;
5610 int ret = CAMERA_ERROR_NONE;
5612 camera_cli_s *pc = (camera_cli_s *)camera;
5613 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_STREAM_ROTATION;
5615 if (pc->cb_info == NULL) {
5616 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5617 return CAMERA_ERROR_INVALID_PARAMETER;
5619 sock_fd = pc->cb_info->fd;
5620 LOGD("Enter, handle :%x", pc->remote_handle);
5621 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION] = foreach_cb;
5622 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION] = user_data;
5624 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5625 LOGD("ret : 0x%x", ret);
5630 int camera_attr_set_stream_rotation(camera_h camera , camera_rotation_e rotation)
5632 if (camera == NULL) {
5633 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5634 return CAMERA_ERROR_INVALID_PARAMETER;
5637 int ret = CAMERA_ERROR_NONE;
5638 camera_cli_s *pc = (camera_cli_s *)camera;
5639 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_STREAM_ROTATION;
5641 if (pc->cb_info == NULL) {
5642 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5643 return CAMERA_ERROR_INVALID_PARAMETER;
5645 sock_fd = pc->cb_info->fd;
5646 int set_rotation = (int)rotation;
5648 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5649 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_rotation);
5650 LOGD("ret : 0x%x", ret);
5655 int camera_attr_get_stream_rotation(camera_h camera , camera_rotation_e *rotation)
5657 if (camera == NULL || rotation == NULL) {
5658 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5659 return CAMERA_ERROR_INVALID_PARAMETER;
5662 int ret = CAMERA_ERROR_NONE;
5663 camera_cli_s *pc = (camera_cli_s *)camera;
5664 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_STREAM_ROTATION;
5666 if (pc->cb_info == NULL) {
5667 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5668 return CAMERA_ERROR_INVALID_PARAMETER;
5670 sock_fd = pc->cb_info->fd;
5673 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5674 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5676 if (ret == CAMERA_ERROR_NONE) {
5677 muse_camera_msg_get(get_rotation, pc->cb_info->recv_msg);
5678 *rotation = (camera_rotation_e)get_rotation;
5680 LOGD("ret : 0x%x", ret);
5685 int camera_attr_set_stream_flip(camera_h camera , camera_flip_e flip)
5687 if (camera == NULL) {
5688 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5689 return CAMERA_ERROR_INVALID_PARAMETER;
5692 int ret = CAMERA_ERROR_NONE;
5693 camera_cli_s *pc = (camera_cli_s *)camera;
5694 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_STREAM_FLIP;
5696 if (pc->cb_info == NULL) {
5697 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5698 return CAMERA_ERROR_INVALID_PARAMETER;
5700 sock_fd = pc->cb_info->fd;
5701 int set_flip = (int)flip;
5703 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5704 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_flip);
5705 LOGD("ret : 0x%x", ret);
5710 int camera_attr_get_stream_flip(camera_h camera , camera_flip_e *flip)
5712 if (camera == NULL || flip == NULL) {
5713 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5714 return CAMERA_ERROR_INVALID_PARAMETER;
5717 int ret = CAMERA_ERROR_NONE;
5718 camera_cli_s *pc = (camera_cli_s *)camera;
5719 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_STREAM_FLIP;
5721 if (pc->cb_info == NULL) {
5722 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5723 return CAMERA_ERROR_INVALID_PARAMETER;
5725 sock_fd = pc->cb_info->fd;
5728 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5729 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5731 if (ret == CAMERA_ERROR_NONE) {
5732 muse_camera_msg_get(get_flip, pc->cb_info->recv_msg);
5733 *flip = (camera_flip_e)get_flip;
5735 LOGD("ret : 0x%x", ret);
5739 int camera_attr_set_hdr_mode(camera_h camera, camera_attr_hdr_mode_e mode)
5741 if (camera == NULL) {
5742 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5743 return CAMERA_ERROR_INVALID_PARAMETER;
5746 int ret = CAMERA_ERROR_NONE;
5747 camera_cli_s *pc = (camera_cli_s *)camera;
5748 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_HDR_MODE;
5750 if (pc->cb_info == NULL) {
5751 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5752 return CAMERA_ERROR_INVALID_PARAMETER;
5754 sock_fd = pc->cb_info->fd;
5755 int set_mode = (int)mode;
5757 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5758 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
5759 LOGD("ret : 0x%x", ret);
5764 int camera_attr_get_hdr_mode(camera_h camera, camera_attr_hdr_mode_e *mode)
5766 if (camera == NULL) {
5767 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5768 return CAMERA_ERROR_INVALID_PARAMETER;
5771 LOGE("INVALID_PARAMETER(0x%08x) - mode", CAMERA_ERROR_INVALID_PARAMETER);
5772 return CAMERA_ERROR_INVALID_PARAMETER;
5774 int ret = CAMERA_ERROR_NONE;
5775 camera_cli_s *pc = (camera_cli_s *)camera;
5776 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_HDR_MODE;
5778 if (pc->cb_info == NULL) {
5779 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5780 return CAMERA_ERROR_INVALID_PARAMETER;
5782 sock_fd = pc->cb_info->fd;
5785 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5786 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5788 if (ret == CAMERA_ERROR_NONE) {
5789 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
5790 *mode = (camera_attr_hdr_mode_e)get_mode;
5792 LOGD("ret : 0x%x", ret);
5797 bool camera_attr_is_supported_hdr_capture(camera_h camera)
5799 if (camera == NULL) {
5800 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5804 int ret = CAMERA_ERROR_NONE;
5805 camera_cli_s *pc = (camera_cli_s *)camera;
5806 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_HDR_CAPTURE;
5808 if (pc->cb_info == NULL) {
5809 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5810 return CAMERA_ERROR_INVALID_PARAMETER;
5812 sock_fd = pc->cb_info->fd;
5813 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5814 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5815 LOGD("ret : 0x%x", ret);
5820 int camera_attr_set_hdr_capture_progress_cb(camera_h camera, camera_attr_hdr_progress_cb callback, void *user_data)
5822 int ret = CAMERA_ERROR_NONE;
5823 camera_cli_s *pc = (camera_cli_s *)camera;
5824 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_HDR_CAPTURE_PROGRESS_CB;
5827 if (camera == NULL) {
5828 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5829 return CAMERA_ERROR_INVALID_PARAMETER;
5832 if (pc->cb_info == NULL) {
5833 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5834 return CAMERA_ERROR_INVALID_PARAMETER;
5837 sock_fd = pc->cb_info->fd;
5839 LOGD("Enter, handle :%x", pc->remote_handle);
5841 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5843 if (ret == CAMERA_ERROR_NONE) {
5844 if (callback == NULL) {
5845 LOGE("INVALID_PARAMETER(0x%08x) - callback", CAMERA_ERROR_INVALID_PARAMETER);
5846 return CAMERA_ERROR_INVALID_PARAMETER;
5849 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = callback;
5850 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = user_data;
5853 LOGD("ret : 0x%x", ret);
5859 int camera_attr_unset_hdr_capture_progress_cb(camera_h camera)
5861 if (camera == NULL) {
5862 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5863 return CAMERA_ERROR_INVALID_PARAMETER;
5866 int ret = CAMERA_ERROR_NONE;
5868 camera_cli_s *pc = (camera_cli_s *)camera;
5869 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_UNSET_HDR_CAPTURE_PROGRESS_CB;
5871 if (pc->cb_info == NULL) {
5872 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5873 return CAMERA_ERROR_INVALID_PARAMETER;
5875 sock_fd = pc->cb_info->fd;
5876 LOGD("Enter, handle :%x", pc->remote_handle);
5878 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = (void *)NULL;
5879 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = (void *)NULL;
5881 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5882 LOGD("ret : 0x%x", ret);
5887 int camera_attr_enable_anti_shake(camera_h camera, bool enable)
5889 if (camera == NULL) {
5890 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5891 return CAMERA_ERROR_INVALID_PARAMETER;
5894 int ret = CAMERA_ERROR_NONE;
5895 camera_cli_s *pc = (camera_cli_s *)camera;
5896 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_ANTI_SHAKE;
5898 if (pc->cb_info == NULL) {
5899 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5900 return CAMERA_ERROR_INVALID_PARAMETER;
5902 sock_fd = pc->cb_info->fd;
5903 int set_enable = (int)enable;
5905 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5906 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
5907 LOGD("ret : 0x%x", ret);
5912 int camera_attr_is_enabled_anti_shake(camera_h camera , bool *enabled)
5914 if (camera == NULL) {
5915 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5916 return CAMERA_ERROR_INVALID_PARAMETER;
5918 if (enabled == NULL) {
5919 LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER);
5920 return CAMERA_ERROR_INVALID_PARAMETER;
5922 int ret = CAMERA_ERROR_NONE;
5923 camera_cli_s *pc = (camera_cli_s *)camera;
5924 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_ANTI_SHAKE;
5926 if (pc->cb_info == NULL) {
5927 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5928 return CAMERA_ERROR_INVALID_PARAMETER;
5930 sock_fd = pc->cb_info->fd;
5933 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5934 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5936 if (ret == CAMERA_ERROR_NONE) {
5937 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
5938 *enabled = (bool)get_enabled;
5940 LOGD("ret : 0x%x", ret);
5945 bool camera_attr_is_supported_anti_shake(camera_h camera)
5948 if (camera == NULL) {
5949 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5953 int ret = CAMERA_ERROR_NONE;
5954 camera_cli_s *pc = (camera_cli_s *)camera;
5955 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_ANTI_SHAKE;
5957 if (pc->cb_info == NULL) {
5958 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5959 return CAMERA_ERROR_INVALID_PARAMETER;
5961 sock_fd = pc->cb_info->fd;
5962 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5963 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5964 LOGD("ret : 0x%x", ret);
5969 int camera_attr_enable_video_stabilization(camera_h camera, bool enable)
5971 if (camera == NULL) {
5972 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5973 return CAMERA_ERROR_INVALID_PARAMETER;
5976 int ret = CAMERA_ERROR_NONE;
5977 camera_cli_s *pc = (camera_cli_s *)camera;
5978 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_VIDEO_STABILIZATION;
5980 if (pc->cb_info == NULL) {
5981 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5982 return CAMERA_ERROR_INVALID_PARAMETER;
5984 sock_fd = pc->cb_info->fd;
5985 int set_enable = (int)enable;
5987 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5988 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
5989 LOGD("ret : 0x%x", ret);
5994 int camera_attr_is_enabled_video_stabilization(camera_h camera, bool *enabled)
5996 if (camera == NULL) {
5997 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5998 return CAMERA_ERROR_INVALID_PARAMETER;
6000 if (enabled == NULL) {
6001 LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER);
6002 return CAMERA_ERROR_INVALID_PARAMETER;
6004 int ret = CAMERA_ERROR_NONE;
6005 camera_cli_s *pc = (camera_cli_s *)camera;
6006 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_VIDEO_STABILIZATION;
6008 if (pc->cb_info == NULL) {
6009 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6010 return CAMERA_ERROR_INVALID_PARAMETER;
6012 sock_fd = pc->cb_info->fd;
6015 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6016 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6018 if (ret == CAMERA_ERROR_NONE) {
6019 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
6020 *enabled = (bool)get_enabled;
6022 LOGD("ret : 0x%x", ret);
6027 bool camera_attr_is_supported_video_stabilization(camera_h camera)
6029 if (camera == NULL) {
6030 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6034 int ret = CAMERA_ERROR_NONE;
6035 camera_cli_s *pc = (camera_cli_s *)camera;
6036 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_VIDEO_STABILIZATION;
6038 if (pc->cb_info == NULL) {
6039 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6040 return CAMERA_ERROR_INVALID_PARAMETER;
6042 sock_fd = pc->cb_info->fd;
6043 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6044 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6045 LOGD("ret : 0x%x", ret);
6050 int camera_attr_enable_auto_contrast(camera_h camera, bool enable)
6052 if (camera == NULL) {
6053 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6054 return CAMERA_ERROR_INVALID_PARAMETER;
6057 int ret = CAMERA_ERROR_NONE;
6058 camera_cli_s *pc = (camera_cli_s *)camera;
6059 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_AUTO_CONTRAST;
6061 if (pc->cb_info == NULL) {
6062 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6063 return CAMERA_ERROR_INVALID_PARAMETER;
6065 sock_fd = pc->cb_info->fd;
6066 int set_enable = (int)enable;
6068 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6069 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
6070 LOGD("ret : 0x%x", ret);
6075 int camera_attr_is_enabled_auto_contrast(camera_h camera, bool *enabled)
6077 if (camera == NULL) {
6078 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
6079 return CAMERA_ERROR_INVALID_PARAMETER;
6081 if (enabled == NULL) {
6082 LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER);
6083 return CAMERA_ERROR_INVALID_PARAMETER;
6085 int ret = CAMERA_ERROR_NONE;
6086 camera_cli_s *pc = (camera_cli_s *)camera;
6087 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_AUTO_CONTRAST;
6089 if (pc->cb_info == NULL) {
6090 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6091 return CAMERA_ERROR_INVALID_PARAMETER;
6093 sock_fd = pc->cb_info->fd;
6096 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6097 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6099 if (ret == CAMERA_ERROR_NONE) {
6100 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
6101 *enabled = (bool)get_enabled;
6103 LOGD("ret : 0x%x", ret);
6108 bool camera_attr_is_supported_auto_contrast(camera_h camera)
6110 if (camera == NULL) {
6111 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6115 int ret = CAMERA_ERROR_NONE;
6116 camera_cli_s *pc = (camera_cli_s *)camera;
6117 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_AUTO_CONTRAST;
6119 if (pc->cb_info == NULL) {
6120 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6121 return CAMERA_ERROR_INVALID_PARAMETER;
6123 sock_fd = pc->cb_info->fd;
6124 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6125 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6126 LOGD("ret : 0x%x", ret);
6131 int camera_attr_disable_shutter_sound(camera_h camera, bool disable)
6133 if (camera == NULL) {
6134 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6135 return CAMERA_ERROR_INVALID_PARAMETER;
6138 int ret = CAMERA_ERROR_NONE;
6139 camera_cli_s *pc = (camera_cli_s *)camera;
6140 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_DISABLE_SHUTTER_SOUND;
6142 if (pc->cb_info == NULL) {
6143 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6144 return CAMERA_ERROR_INVALID_PARAMETER;
6146 sock_fd = pc->cb_info->fd;
6147 int set_disable = (int)disable;
6149 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6150 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_disable);
6151 LOGD("ret : 0x%x", ret);
6156 int camera_attr_set_pan(camera_h camera, camera_attr_ptz_move_type_e move_type, int pan_step)
6158 if (camera == NULL) {
6159 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6160 return CAMERA_ERROR_INVALID_PARAMETER;
6163 camera_cli_s *pc = (camera_cli_s *)camera;
6164 if (pc->cb_info == NULL) {
6165 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6166 return CAMERA_ERROR_INVALID_PARAMETER;
6169 int ret = CAMERA_ERROR_NONE;
6170 int sock_fd = pc->cb_info->fd;
6171 int set_move_type = (int)move_type;
6172 int set_pan_step = pan_step;
6173 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_PAN;
6175 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6176 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, set_move_type, INT, set_pan_step);
6177 LOGD("ret : 0x%x", ret);
6182 int camera_attr_get_pan(camera_h camera, int *pan_step)
6184 if (camera == NULL || pan_step == NULL) {
6185 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6186 return CAMERA_ERROR_INVALID_PARAMETER;
6189 camera_cli_s *pc = (camera_cli_s *)camera;
6190 if (pc->cb_info == NULL) {
6191 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6192 return CAMERA_ERROR_INVALID_PARAMETER;
6195 int ret = CAMERA_ERROR_NONE;
6196 int sock_fd = pc->cb_info->fd;
6198 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_PAN;
6200 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6201 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6203 if (ret == CAMERA_ERROR_NONE) {
6204 muse_camera_msg_get(get_pan_step, pc->cb_info->recv_msg);
6205 *pan_step = get_pan_step;
6207 LOGD("ret : 0x%x", ret);
6212 int camera_attr_get_pan_range(camera_h camera, int *min, int *max)
6214 if (camera == NULL || min == NULL || max == NULL) {
6215 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6216 return CAMERA_ERROR_INVALID_PARAMETER;
6219 camera_cli_s *pc = (camera_cli_s *)camera;
6220 if (pc->cb_info == NULL) {
6221 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6222 return CAMERA_ERROR_INVALID_PARAMETER;
6225 int ret = CAMERA_ERROR_NONE;
6226 int sock_fd = pc->cb_info->fd;
6229 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_PAN_RANGE;
6231 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6232 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6234 if (ret == CAMERA_ERROR_NONE) {
6235 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
6236 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
6240 LOGD("ret : 0x%x", ret);
6245 int camera_attr_set_tilt(camera_h camera, camera_attr_ptz_move_type_e move_type, int tilt_step)
6247 if (camera == NULL) {
6248 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6249 return CAMERA_ERROR_INVALID_PARAMETER;
6252 camera_cli_s *pc = (camera_cli_s *)camera;
6253 if (pc->cb_info == NULL) {
6254 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6255 return CAMERA_ERROR_INVALID_PARAMETER;
6258 int ret = CAMERA_ERROR_NONE;
6259 int sock_fd = pc->cb_info->fd;
6260 int set_move_type = (int)move_type;
6261 int set_tilt_step = tilt_step;
6262 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TILT;
6264 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6265 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, set_move_type, INT, set_tilt_step);
6266 LOGD("ret : 0x%x", ret);
6271 int camera_attr_get_tilt(camera_h camera, int *tilt_step)
6273 if (camera == NULL || tilt_step == NULL) {
6274 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6275 return CAMERA_ERROR_INVALID_PARAMETER;
6278 camera_cli_s *pc = (camera_cli_s *)camera;
6279 if (pc->cb_info == NULL) {
6280 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6281 return CAMERA_ERROR_INVALID_PARAMETER;
6284 int ret = CAMERA_ERROR_NONE;
6285 int sock_fd = pc->cb_info->fd;
6287 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TILT;
6289 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6290 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6292 if (ret == CAMERA_ERROR_NONE) {
6293 muse_camera_msg_get(get_tilt_step, pc->cb_info->recv_msg);
6294 *tilt_step = get_tilt_step;
6296 LOGD("ret : 0x%x", ret);
6301 int camera_attr_get_tilt_range(camera_h camera, int *min, int *max)
6303 if (camera == NULL || min == NULL || max == NULL) {
6304 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6305 return CAMERA_ERROR_INVALID_PARAMETER;
6308 camera_cli_s *pc = (camera_cli_s *)camera;
6309 if (pc->cb_info == NULL) {
6310 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6311 return CAMERA_ERROR_INVALID_PARAMETER;
6314 int ret = CAMERA_ERROR_NONE;
6315 int sock_fd = pc->cb_info->fd;
6318 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TILT_RANGE;
6320 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6321 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6323 if (ret == CAMERA_ERROR_NONE) {
6324 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
6325 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
6329 LOGD("ret : 0x%x", ret);
6334 int camera_attr_set_ptz_type(camera_h camera, camera_attr_ptz_type_e ptz_type)
6336 if (camera == NULL) {
6337 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6338 return CAMERA_ERROR_INVALID_PARAMETER;
6341 camera_cli_s *pc = (camera_cli_s *)camera;
6342 if (pc->cb_info == NULL) {
6343 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6344 return CAMERA_ERROR_INVALID_PARAMETER;
6347 int ret = CAMERA_ERROR_NONE;
6348 int sock_fd = pc->cb_info->fd;
6349 int set_ptz_type = (int)ptz_type;
6350 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_PTZ_TYPE;
6352 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6353 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_ptz_type);
6354 LOGD("ret : 0x%x", ret);
6359 int camera_attr_foreach_supported_ptz_type(camera_h camera, camera_attr_supported_ptz_type_cb foreach_cb, void *user_data)
6361 if (camera == NULL || foreach_cb == NULL) {
6362 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6363 return CAMERA_ERROR_INVALID_PARAMETER;
6365 int ret = CAMERA_ERROR_NONE;
6367 camera_cli_s *pc = (camera_cli_s *)camera;
6368 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_PTZ_TYPE;
6370 if (pc->cb_info == NULL) {
6371 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6372 return CAMERA_ERROR_INVALID_PARAMETER;
6374 sock_fd = pc->cb_info->fd;
6375 LOGD("Enter, handle :%x", pc->remote_handle);
6376 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PTZ_TYPE] = foreach_cb;
6377 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PTZ_TYPE] = user_data;
6379 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6380 LOGD("ret : 0x%x", ret);
6385 int camera_attr_set_display_roi_area(camera_h camera, int x, int y, int width, int height)
6387 if (camera == NULL) {
6388 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6389 return CAMERA_ERROR_INVALID_PARAMETER;
6392 camera_cli_s *pc = (camera_cli_s *)camera;
6393 if (pc->cb_info == NULL) {
6394 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6395 return CAMERA_ERROR_INVALID_PARAMETER;
6398 int ret = CAMERA_ERROR_NONE;
6399 int sock_fd = pc->cb_info->fd;
6400 int set_display_roi_area[4] = {x, y, width, height};
6401 muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY_ROI_AREA;
6403 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6405 #ifdef EVAS_RENDERER_SUPPORT
6406 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
6407 g_mutex_lock(&pc->cb_info->evas_mutex);
6409 ret = mm_evas_renderer_set_roi_area(pc->cb_info->evas_info, x, y, width, height);
6411 g_mutex_unlock(&pc->cb_info->evas_mutex);
6413 if (ret != MM_ERROR_NONE) {
6414 LOGE("mm_evas_renderer_set_roi_area error 0x%x", ret);
6415 return CAMERA_ERROR_INVALID_OPERATION;
6418 #endif /* EVAS_RENDERER_SUPPORT */
6420 muse_camera_msg_send_array(api, sock_fd, pc->cb_info, ret,
6421 set_display_roi_area, sizeof(set_display_roi_area), sizeof(int));
6423 LOGD("ret : 0x%x", ret);
6429 int camera_attr_get_display_roi_area(camera_h camera, int *x, int *y, int *width, int *height)
6431 if (camera == NULL || x == NULL || y == NULL || width == NULL || height == NULL) {
6432 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6433 return CAMERA_ERROR_INVALID_PARAMETER;
6436 camera_cli_s *pc = (camera_cli_s *)camera;
6437 if (pc->cb_info == NULL) {
6438 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6439 return CAMERA_ERROR_INVALID_PARAMETER;
6442 int ret = CAMERA_ERROR_NONE;
6443 int sock_fd = pc->cb_info->fd;
6444 int get_display_roi_area[4] = {0,};
6445 muse_camera_api_e api = MUSE_CAMERA_API_GET_DISPLAY_ROI_AREA;
6447 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6449 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6451 if (ret == CAMERA_ERROR_NONE) {
6452 muse_camera_msg_get_array(get_display_roi_area, pc->cb_info->recv_msg);
6454 *x = get_display_roi_area[0];
6455 *y = get_display_roi_area[1];
6456 *width = get_display_roi_area[2];
6457 *height = get_display_roi_area[3];
6459 LOGD("ret : 0x%x", ret);
6461 LOGE("Returned value is not valid : 0x%x", ret);