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 LOGD("check api_class");
1754 if (muse_camera_msg_get(api_class, parse_str[i]))
1755 LOGD("camera api_class[%d]", api_class);
1758 if (api_class == MUSE_CAMERA_API_CLASS_IMMEDIATE) {
1759 g_mutex_lock(&cb_info->api_mutex[api]);
1761 if (!muse_camera_msg_get(ret, parse_str[i])) {
1762 LOGE("failed to get camera ret");
1763 g_mutex_unlock(&cb_info->api_mutex[api]);
1767 cb_info->api_ret[api] = ret;
1768 cb_info->api_activating[api] = 1;
1770 if (api == MUSE_CAMERA_API_CREATE) {
1771 if (ret != CAMERA_ERROR_NONE) {
1772 g_atomic_int_set(&cb_info->msg_recv_running, 0);
1773 LOGE("camera create error 0x%x. close client cb handler", ret);
1775 } else if (api == MUSE_CAMERA_API_DESTROY) {
1776 if (ret == CAMERA_ERROR_NONE) {
1777 g_atomic_int_set(&cb_info->msg_recv_running, 0);
1778 LOGD("camera destroy done. close client cb handler");
1782 g_cond_signal(&cb_info->api_cond[api]);
1783 g_mutex_unlock(&cb_info->api_mutex[api]);
1784 } else if (api_class == MUSE_CAMERA_API_CLASS_THREAD_SUB || api == MUSE_CAMERA_CB_EVENT) {
1785 camera_message_s *cam_msg = g_new0(camera_message_s, 1);
1786 if (cam_msg == NULL) {
1787 LOGE("failed to alloc cam_msg");
1792 memcpy(cam_msg->recv_msg, parse_str[i], sizeof(cam_msg->recv_msg));
1794 LOGD("add camera message to queue : api %d", api);
1796 g_mutex_lock(&cb_info->msg_handler_mutex);
1797 g_queue_push_tail(cb_info->msg_queue, (gpointer)cam_msg);
1798 g_cond_signal(&cb_info->msg_handler_cond);
1799 g_mutex_unlock(&cb_info->msg_handler_mutex);
1801 LOGW("unknown camera api %d and api_class %d", api, api_class);
1807 LOGD("client cb exit");
1811 for (i = 0 ; i < CAMERA_PARSE_STRING_SIZE ; i++) {
1814 parse_str[i] = NULL;
1825 static camera_cb_info_s *_client_callback_new(gint sockfd)
1827 camera_cb_info_s *cb_info = NULL;
1828 gint *tmp_activating = NULL;
1829 gint *tmp_ret = NULL;
1832 g_return_val_if_fail(sockfd > 0, NULL);
1834 cb_info = g_new0(camera_cb_info_s, 1);
1835 if (cb_info == NULL) {
1836 LOGE("cb_info failed");
1840 g_mutex_init(&cb_info->msg_handler_mutex);
1841 g_cond_init(&cb_info->msg_handler_cond);
1842 g_mutex_init(&cb_info->idle_event_mutex);
1843 g_cond_init(&cb_info->idle_event_cond);
1844 g_mutex_init(&cb_info->mp_data_mutex);
1845 #ifdef EVAS_RENDERER_SUPPORT
1846 g_mutex_init(&cb_info->evas_mutex);
1847 #endif /* EVAS_RENDERER_SUPPORT */
1849 for (i = 0 ; i < MUSE_CAMERA_API_MAX ; i++) {
1850 g_mutex_init(&cb_info->api_mutex[i]);
1851 g_cond_init(&cb_info->api_cond[i]);
1854 tmp_activating = g_new0(gint, MUSE_CAMERA_API_MAX);
1855 if (tmp_activating == NULL) {
1856 LOGE("tmp_activating failed");
1860 tmp_ret = g_new0(gint, MUSE_CAMERA_API_MAX);
1861 if (tmp_ret == NULL) {
1862 LOGE("tmp_ret failed");
1866 cb_info->msg_queue = g_queue_new();
1867 if (cb_info->msg_queue == NULL) {
1868 LOGE("msg_queue new failed");
1872 g_atomic_int_set(&cb_info->msg_handler_running, 1);
1873 cb_info->msg_handler_thread = g_thread_try_new("camera_msg_handler",
1874 _camera_msg_handler_func, (gpointer)cb_info, NULL);
1875 if (cb_info->msg_handler_thread == NULL) {
1876 LOGE("message handler thread creation failed");
1880 cb_info->fd = sockfd;
1881 cb_info->api_activating = tmp_activating;
1882 cb_info->api_ret = tmp_ret;
1883 cb_info->preview_cb_flag = 0;
1884 #ifdef EVAS_RENDERER_SUPPORT
1885 cb_info->evas_info = NULL;
1886 #endif /* EVAS_RENDERER_SUPPORT */
1888 g_atomic_int_set(&cb_info->msg_recv_running, 1);
1889 cb_info->msg_recv_thread = g_thread_try_new("camera_msg_recv",
1890 _camera_msg_recv_func, (gpointer)cb_info, NULL);
1891 if (cb_info->msg_recv_thread == NULL) {
1892 LOGE("message receive thread creation failed");
1900 if (cb_info->msg_handler_thread) {
1901 g_mutex_lock(&cb_info->msg_handler_mutex);
1902 g_atomic_int_set(&cb_info->msg_handler_running, 0);
1903 g_cond_signal(&cb_info->msg_handler_cond);
1904 g_mutex_unlock(&cb_info->msg_handler_mutex);
1906 g_thread_join(cb_info->msg_handler_thread);
1907 g_thread_unref(cb_info->msg_handler_thread);
1908 cb_info->msg_handler_thread = NULL;
1911 for (i = 0 ; i < MUSE_CAMERA_API_MAX ; i++) {
1912 g_mutex_clear(&cb_info->api_mutex[i]);
1913 g_cond_clear(&cb_info->api_cond[i]);
1916 g_mutex_clear(&cb_info->msg_handler_mutex);
1917 g_cond_clear(&cb_info->msg_handler_cond);
1918 g_mutex_clear(&cb_info->idle_event_mutex);
1919 g_cond_clear(&cb_info->idle_event_cond);
1920 g_mutex_clear(&cb_info->mp_data_mutex);
1921 #ifdef EVAS_RENDERER_SUPPORT
1922 g_mutex_clear(&cb_info->evas_mutex);
1923 #endif /* EVAS_RENDERER_SUPPORT */
1925 if (cb_info->msg_queue) {
1926 g_queue_free(cb_info->msg_queue);
1927 cb_info->msg_queue = NULL;
1934 if (tmp_activating) {
1935 g_free(tmp_activating);
1936 tmp_activating = NULL;
1946 static void _client_callback_destroy(camera_cb_info_s *cb_info)
1950 g_return_if_fail(cb_info != NULL);
1952 LOGD("MSG receive thread[%p] destroy", cb_info->msg_recv_thread);
1954 g_thread_join(cb_info->msg_recv_thread);
1955 g_thread_unref(cb_info->msg_recv_thread);
1956 cb_info->msg_recv_thread = NULL;
1958 LOGD("msg thread removed");
1960 g_mutex_lock(&cb_info->msg_handler_mutex);
1961 g_atomic_int_set(&cb_info->msg_handler_running, 0);
1962 g_cond_signal(&cb_info->msg_handler_cond);
1963 g_mutex_unlock(&cb_info->msg_handler_mutex);
1965 g_thread_join(cb_info->msg_handler_thread);
1966 g_thread_unref(cb_info->msg_handler_thread);
1967 cb_info->msg_handler_thread = NULL;
1969 g_queue_free(cb_info->msg_queue);
1970 cb_info->msg_queue = NULL;
1972 for (i = 0 ; i < MUSE_CAMERA_API_MAX ; i++) {
1973 g_mutex_clear(&cb_info->api_mutex[i]);
1974 g_cond_clear(&cb_info->api_cond[i]);
1977 g_mutex_clear(&cb_info->msg_handler_mutex);
1978 g_cond_clear(&cb_info->msg_handler_cond);
1979 g_mutex_clear(&cb_info->idle_event_mutex);
1980 g_cond_clear(&cb_info->idle_event_cond);
1981 g_mutex_clear(&cb_info->mp_data_mutex);
1982 #ifdef EVAS_RENDERER_SUPPORT
1983 g_mutex_clear(&cb_info->evas_mutex);
1984 #endif /* EVAS_RENDERER_SUPPORT */
1986 LOGD("event thread removed");
1988 if (cb_info->fd > -1) {
1989 muse_core_connection_close(cb_info->fd);
1993 if (cb_info->bufmgr) {
1994 tbm_bufmgr_deinit(cb_info->bufmgr);
1995 cb_info->bufmgr = NULL;
1997 if (cb_info->api_activating) {
1998 g_free(cb_info->api_activating);
1999 cb_info->api_activating = NULL;
2001 if (cb_info->api_ret) {
2002 g_free(cb_info->api_ret);
2003 cb_info->api_ret = NULL;
2005 if (cb_info->pkt_fmt) {
2006 media_format_unref(cb_info->pkt_fmt);
2007 cb_info->pkt_fmt = NULL;
2010 #ifdef EVAS_RENDERER_SUPPORT
2011 if (cb_info->evas_info)
2012 mm_evas_renderer_destroy(&cb_info->evas_info);
2013 #endif /* EVAS_RENDERER_SUPPORT */
2015 cb_info->preview_cb_flag = 0;
2024 int _camera_start_evas_rendering(camera_h camera)
2026 int ret = CAMERA_ERROR_NONE;
2027 camera_cli_s *pc = (camera_cli_s *)camera;
2029 if (camera == NULL) {
2030 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2031 return CAMERA_ERROR_INVALID_PARAMETER;
2034 if (pc->cb_info == NULL) {
2035 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2036 return CAMERA_ERROR_INVALID_PARAMETER;
2041 if (!CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
2042 LOGE("EVAS surface is not set");
2043 return CAMERA_ERROR_NONE;
2046 #ifdef EVAS_RENDERER_SUPPORT
2047 g_mutex_lock(&pc->cb_info->evas_mutex);
2049 /* set evas render flag as RUN */
2050 pc->cb_info->run_evas_render = true;
2051 ret = CAMERA_ERROR_NONE;
2053 g_mutex_unlock(&pc->cb_info->evas_mutex);
2054 #else /* EVAS_RENDERER_SUPPORT */
2055 LOGW("evas renderer is not supported");
2056 ret = CAMERA_ERROR_NOT_SUPPORTED;
2057 #endif /* EVAS_RENDERER_SUPPORT */
2063 int _camera_stop_evas_rendering(camera_h camera, bool keep_screen)
2065 int ret = CAMERA_ERROR_NONE;
2066 camera_cli_s *pc = (camera_cli_s *)camera;
2068 if (camera == NULL) {
2069 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2070 return CAMERA_ERROR_INVALID_PARAMETER;
2073 if (pc->cb_info == NULL) {
2074 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2075 return CAMERA_ERROR_INVALID_PARAMETER;
2078 LOGD("stop - keep screen %d", keep_screen);
2080 if (!CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
2081 LOGE("EVAS surface is not set");
2082 return CAMERA_ERROR_NONE;
2085 #ifdef EVAS_RENDERER_SUPPORT
2086 g_mutex_lock(&pc->cb_info->evas_mutex);
2088 /* set evas render flag as STOP and release buffers */
2089 pc->cb_info->run_evas_render = false;
2091 ret = mm_evas_renderer_retrieve_all_packets(pc->cb_info->evas_info, keep_screen);
2092 if (ret != MM_ERROR_NONE) {
2093 LOGE("mm_evas_renderer_retrieve_all_packets failed 0x%x", ret);
2094 ret = CAMERA_ERROR_INVALID_OPERATION;
2097 g_mutex_unlock(&pc->cb_info->evas_mutex);
2098 #else /* EVAS_RENDERER_SUPPORT */
2099 LOGW("evas renderer is not supported");
2100 ret = CAMERA_ERROR_NOT_SUPPORTED;
2101 #endif /* EVAS_RENDERER_SUPPORT */
2107 int camera_create(camera_device_e device, camera_h *camera)
2111 int ret = CAMERA_ERROR_NONE;
2113 camera_cli_s *pc = NULL;
2114 tbm_bufmgr bufmgr = NULL;
2116 muse_camera_api_e api = MUSE_CAMERA_API_CREATE;
2117 muse_core_api_module_e muse_module = MUSE_CAMERA;
2118 int device_type = (int)device;
2120 if (camera == NULL) {
2121 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2122 return CAMERA_ERROR_INVALID_PARAMETER;
2125 bufmgr = tbm_bufmgr_init(-1);
2126 if (bufmgr == NULL) {
2127 LOGE("get tbm bufmgr failed");
2128 return CAMERA_ERROR_INVALID_OPERATION;
2131 sock_fd = muse_core_client_new();
2133 LOGE("muse_core_client_new failed - returned fd %d", sock_fd);
2134 ret = CAMERA_ERROR_INVALID_OPERATION;
2140 sndMsg = muse_core_msg_json_factory_new(api,
2141 MUSE_TYPE_INT, "module", muse_module,
2142 MUSE_TYPE_INT, PARAM_DEVICE_TYPE, device_type,
2143 MUSE_TYPE_INT, "pid", pid,
2146 muse_core_ipc_send_msg(sock_fd, sndMsg);
2147 muse_core_msg_json_factory_free(sndMsg);
2149 pc = g_new0(camera_cli_s, 1);
2151 LOGE("camera_cli_s alloc failed");
2152 ret = CAMERA_ERROR_OUT_OF_MEMORY;
2156 pc->cb_info = _client_callback_new(sock_fd);
2157 if (pc->cb_info == NULL) {
2158 LOGE("cb_info alloc failed");
2159 ret = CAMERA_ERROR_OUT_OF_MEMORY;
2163 LOGD("cb info : %d", pc->cb_info->fd);
2165 ret = _client_wait_for_cb_return(api, pc->cb_info, CALLBACK_TIME_OUT);
2166 if (ret == CAMERA_ERROR_NONE) {
2167 intptr_t handle = 0;
2168 muse_camera_msg_get_pointer(handle, pc->cb_info->recv_msg);
2170 LOGE("Receiving Handle Failed!!");
2171 ret = CAMERA_ERROR_INVALID_OPERATION;
2175 pc->remote_handle = handle;
2176 pc->cb_info->bufmgr = bufmgr;
2178 ret = camera_set_display((camera_h)pc, CAMERA_DISPLAY_TYPE_NONE, NULL);
2179 if (ret != CAMERA_ERROR_NONE) {
2180 LOGE("init display failed 0x%x", ret);
2184 LOGD("camera create 0x%x", pc->remote_handle);
2185 *camera = (camera_h)pc;
2193 tbm_bufmgr_deinit(bufmgr);
2197 _client_callback_destroy(pc->cb_info);
2203 LOGE("camera create error : 0x%x", ret);
2208 int camera_destroy(camera_h camera)
2210 if (camera == NULL) {
2211 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2212 return CAMERA_ERROR_INVALID_PARAMETER;
2215 int ret = CAMERA_ERROR_NONE;
2216 muse_camera_api_e api = MUSE_CAMERA_API_DESTROY;
2217 camera_cli_s *pc = (camera_cli_s *)camera;
2222 if (pc->cb_info == NULL) {
2223 LOGE("cb_info NULL, INVALID_PARAMETER");
2224 return CAMERA_ERROR_INVALID_PARAMETER;
2227 sock_fd = pc->cb_info->fd;
2229 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2230 if (ret == CAMERA_ERROR_NONE) {
2231 _camera_remove_idle_event_all(pc->cb_info);
2232 _client_callback_destroy(pc->cb_info);
2238 LOGE("camera destroy error : 0x%x", ret);
2244 int camera_start_preview(camera_h camera)
2246 int ret = CAMERA_ERROR_NONE;
2247 muse_camera_api_e api = MUSE_CAMERA_API_START_PREVIEW;
2248 camera_cli_s *pc = (camera_cli_s *)camera;
2251 if (camera == NULL) {
2252 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2253 return CAMERA_ERROR_INVALID_PARAMETER;
2256 if (pc->cb_info == NULL) {
2257 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2258 return CAMERA_ERROR_INVALID_PARAMETER;
2263 sock_fd = pc->cb_info->fd;
2265 muse_camera_msg_send_longtime(api, sock_fd, pc->cb_info, ret);
2267 if (ret != CAMERA_ERROR_NONE) {
2268 LOGE("start preview failed 0x%x", ret);
2269 } else if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
2270 ret = _camera_start_evas_rendering(camera);
2273 LOGD("ret : 0x%x", ret);
2278 int camera_stop_preview(camera_h camera)
2280 int ret = CAMERA_ERROR_NONE;
2282 camera_cli_s *pc = NULL;
2283 muse_camera_api_e api = MUSE_CAMERA_API_STOP_PREVIEW;
2285 if (camera == NULL) {
2286 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2287 return CAMERA_ERROR_INVALID_PARAMETER;
2290 pc = (camera_cli_s *)camera;
2292 if (pc->cb_info == NULL) {
2293 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2294 return CAMERA_ERROR_INVALID_PARAMETER;
2297 sock_fd = pc->cb_info->fd;
2301 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
2302 camera_state_e current_state = CAMERA_STATE_NONE;
2304 ret = camera_get_state(camera, ¤t_state);
2305 if (ret != CAMERA_ERROR_NONE) {
2306 LOGE("failed to get current state 0x%x", ret);
2310 if (current_state == CAMERA_STATE_PREVIEW) {
2311 ret = _camera_stop_evas_rendering(camera, false);
2312 if (ret != CAMERA_ERROR_NONE)
2317 /* send stop preview message */
2318 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2320 LOGD("ret : 0x%x", ret);
2325 int camera_start_capture(camera_h camera, camera_capturing_cb capturing_cb, camera_capture_completed_cb completed_cb, void *user_data)
2327 if (camera == NULL) {
2328 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2329 return CAMERA_ERROR_INVALID_PARAMETER;
2331 int ret = CAMERA_ERROR_NONE;
2333 camera_cli_s *pc = (camera_cli_s *)camera;
2334 muse_camera_api_e api = MUSE_CAMERA_API_START_CAPTURE;
2336 int is_capturing_cb = 0;
2337 int is_completed_cb = 0;
2338 LOGD("Enter, handle :%x", pc->remote_handle);
2340 if (pc->cb_info == NULL) {
2341 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2342 return CAMERA_ERROR_INVALID_PARAMETER;
2345 sock_fd = pc->cb_info->fd;
2347 if (capturing_cb != NULL) {
2348 is_capturing_cb = 1;
2349 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = capturing_cb;
2350 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = user_data;
2353 if (completed_cb != NULL) {
2354 is_completed_cb = 1;
2355 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = completed_cb;
2356 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = user_data;
2359 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, is_capturing_cb, INT, is_completed_cb);
2360 LOGD("is_capturing_cb :%d, is_completed_cb : %d", is_capturing_cb, is_completed_cb);
2361 LOGD("ret : 0x%x", ret);
2365 bool camera_is_supported_continuous_capture(camera_h camera)
2367 if (camera == NULL) {
2368 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2372 int ret = CAMERA_ERROR_NONE;
2373 camera_cli_s *pc = (camera_cli_s *)camera;
2374 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_CONTINUOUS_CAPTURE;
2377 if (pc->cb_info == NULL) {
2378 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2379 return CAMERA_ERROR_INVALID_PARAMETER;
2382 sock_fd = pc->cb_info->fd;
2384 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2385 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2386 LOGD("ret : 0x%x", ret);
2390 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)
2392 if (camera == NULL) {
2393 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2394 return CAMERA_ERROR_INVALID_PARAMETER;
2397 int ret = CAMERA_ERROR_NONE;
2399 camera_cli_s *pc = (camera_cli_s *)camera;
2400 muse_camera_api_e api = MUSE_CAMERA_API_START_CONTINUOUS_CAPTURE;
2402 LOGD("Enter, handle :%x", pc->remote_handle);
2405 if (pc->cb_info == NULL) {
2406 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2407 return CAMERA_ERROR_INVALID_PARAMETER;
2409 sock_fd = pc->cb_info->fd;
2411 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = capturing_cb;
2412 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = user_data;
2413 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = completed_cb;
2415 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, count, INT, interval);
2417 LOGD("ret : 0x%x", ret);
2422 int camera_stop_continuous_capture(camera_h camera)
2424 if (camera == NULL) {
2425 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2426 return CAMERA_ERROR_INVALID_PARAMETER;
2430 int ret = CAMERA_ERROR_NONE;
2432 camera_cli_s *pc = (camera_cli_s *)camera;
2433 muse_camera_api_e api = MUSE_CAMERA_API_STOP_CONTINUOUS_CAPTURE;
2434 LOGD("Enter, handle :%x", pc->remote_handle);
2436 if (pc->cb_info == NULL) {
2437 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2438 return CAMERA_ERROR_INVALID_PARAMETER;
2440 sock_fd = pc->cb_info->fd;
2441 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2442 LOGD("ret : 0x%x", ret);
2446 bool camera_is_supported_face_detection(camera_h camera)
2448 if (camera == NULL) {
2449 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2452 int ret = CAMERA_ERROR_NONE;
2454 camera_cli_s *pc = (camera_cli_s *)camera;
2455 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_FACE_DETECTION;
2457 if (pc->cb_info == NULL) {
2458 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2459 return CAMERA_ERROR_INVALID_PARAMETER;
2461 sock_fd = pc->cb_info->fd;
2463 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2464 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2465 LOGD("ret : 0x%x", ret);
2469 bool camera_is_supported_zero_shutter_lag(camera_h camera)
2471 if (camera == NULL) {
2472 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2475 int ret = CAMERA_ERROR_NONE;
2477 camera_cli_s *pc = (camera_cli_s *)camera;
2478 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_ZERO_SHUTTER_LAG;
2480 if (pc->cb_info == NULL) {
2481 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2482 return CAMERA_ERROR_INVALID_PARAMETER;
2484 sock_fd = pc->cb_info->fd;
2486 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2487 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2488 LOGD("ret : 0x%x", ret);
2492 bool camera_is_supported_media_packet_preview_cb(camera_h camera)
2494 if (camera == NULL) {
2495 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2499 int ret = CAMERA_ERROR_NONE;
2501 camera_cli_s *pc = (camera_cli_s *)camera;
2502 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_MEDIA_PACKET_PREVIEW_CB;
2504 if (pc->cb_info == NULL) {
2505 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2506 return CAMERA_ERROR_INVALID_PARAMETER;
2508 sock_fd = pc->cb_info->fd;
2510 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2511 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2512 LOGD("ret : 0x%x", ret);
2516 int camera_get_device_count(camera_h camera, int *device_count)
2518 if (camera == NULL || device_count == NULL) {
2519 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2520 return CAMERA_ERROR_INVALID_PARAMETER;
2522 int ret = CAMERA_ERROR_NONE;
2524 camera_cli_s *pc = (camera_cli_s *)camera;
2525 muse_camera_api_e api = MUSE_CAMERA_API_GET_DEVICE_COUNT;
2527 if (pc->cb_info == NULL) {
2528 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2529 return CAMERA_ERROR_INVALID_PARAMETER;
2531 sock_fd = pc->cb_info->fd;
2532 int get_device_count;
2534 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2535 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2537 if (ret == CAMERA_ERROR_NONE) {
2538 muse_camera_msg_get(get_device_count, pc->cb_info->recv_msg);
2539 *device_count = get_device_count;
2541 LOGD("ret : 0x%x", ret);
2545 int camera_start_face_detection(camera_h camera, camera_face_detected_cb callback, void *user_data)
2547 if (camera == NULL) {
2548 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2549 return CAMERA_ERROR_INVALID_PARAMETER;
2552 int ret = CAMERA_ERROR_NONE;
2554 camera_cli_s *pc = (camera_cli_s *)camera;
2555 muse_camera_api_e api = MUSE_CAMERA_API_START_FACE_DETECTION;
2557 LOGD("Enter, handle :%x", pc->remote_handle);
2559 if (pc->cb_info == NULL) {
2560 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2561 return CAMERA_ERROR_INVALID_PARAMETER;
2563 sock_fd = pc->cb_info->fd;
2564 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION] = callback;
2565 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION] = user_data;
2567 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2568 LOGD("ret : 0x%x", ret);
2572 int camera_stop_face_detection(camera_h camera)
2574 if (camera == NULL) {
2575 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2576 return CAMERA_ERROR_INVALID_PARAMETER;
2579 int ret = CAMERA_ERROR_NONE;
2581 camera_cli_s *pc = (camera_cli_s *)camera;
2582 muse_camera_api_e api = MUSE_CAMERA_API_STOP_FACE_DETECTION;
2583 LOGD("Enter, handle :%x", pc->remote_handle);
2585 if (pc->cb_info == NULL) {
2586 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2587 return CAMERA_ERROR_INVALID_PARAMETER;
2589 sock_fd = pc->cb_info->fd;
2590 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2591 LOGD("ret : 0x%x", ret);
2595 int camera_get_state(camera_h camera, camera_state_e *state)
2597 if (camera == NULL || state == NULL) {
2598 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2599 return CAMERA_ERROR_INVALID_PARAMETER;
2601 int ret = CAMERA_ERROR_NONE;
2603 camera_cli_s *pc = (camera_cli_s *)camera;
2604 muse_camera_api_e api = MUSE_CAMERA_API_GET_STATE;
2606 if (pc->cb_info == NULL) {
2607 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2608 return CAMERA_ERROR_INVALID_PARAMETER;
2610 sock_fd = pc->cb_info->fd;
2613 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2614 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2616 if (ret == CAMERA_ERROR_NONE) {
2617 muse_camera_msg_get(get_state, pc->cb_info->recv_msg);
2618 *state = (camera_state_e)get_state;
2620 LOGD("ret : 0x%x", ret);
2624 int camera_start_focusing(camera_h camera, bool continuous)
2626 if (camera == NULL) {
2627 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2628 return CAMERA_ERROR_INVALID_PARAMETER;
2631 int ret = CAMERA_ERROR_NONE;
2633 camera_cli_s *pc = (camera_cli_s *)camera;
2634 muse_camera_api_e api = MUSE_CAMERA_API_START_FOCUSING;
2636 if (pc->cb_info == NULL) {
2637 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2638 return CAMERA_ERROR_INVALID_PARAMETER;
2640 sock_fd = pc->cb_info->fd;
2641 int is_continuous = (int)continuous;
2643 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2644 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, is_continuous);
2645 LOGD("ret : 0x%x", ret);
2649 int camera_cancel_focusing(camera_h camera)
2651 if (camera == NULL) {
2652 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2653 return CAMERA_ERROR_INVALID_PARAMETER;
2656 int ret = CAMERA_ERROR_NONE;
2658 camera_cli_s *pc = (camera_cli_s *)camera;
2659 muse_camera_api_e api = MUSE_CAMERA_API_CANCEL_FOCUSING;
2661 if (pc->cb_info == NULL) {
2662 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2663 return CAMERA_ERROR_INVALID_PARAMETER;
2665 sock_fd = pc->cb_info->fd;
2667 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2668 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2669 LOGD("ret : 0x%x", ret);
2673 int camera_set_display(camera_h camera, camera_display_type_e type, camera_display_h display)
2675 int ret = CAMERA_ERROR_NONE;
2676 void *set_display_handle = NULL;
2677 Evas_Object *obj = NULL;
2678 const char *object_type = NULL;
2680 camera_wl_info_s *wl_info = NULL;
2681 #endif /* HAVE_WAYLAND */
2682 camera_cli_s *pc = (camera_cli_s *)camera;
2683 camera_cb_info_s *cb_info = NULL;
2684 muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY;
2685 camera_state_e current_state = CAMERA_STATE_NONE;
2688 if (camera == NULL) {
2689 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2690 return CAMERA_ERROR_INVALID_PARAMETER;
2693 if (type < CAMERA_DISPLAY_TYPE_OVERLAY || type > CAMERA_DISPLAY_TYPE_NONE) {
2694 LOGE("invalid type %d", type);
2695 return CAMERA_ERROR_INVALID_PARAMETER;
2698 if (type != CAMERA_DISPLAY_TYPE_NONE && display == NULL) {
2699 LOGE("display type[%d] is not NONE, but display handle is NULL", type);
2700 return CAMERA_ERROR_INVALID_PARAMETER;
2703 if (pc->cb_info == NULL) {
2704 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2705 return CAMERA_ERROR_INVALID_PARAMETER;
2708 cb_info = (camera_cb_info_s *)pc->cb_info;
2709 sock_fd = cb_info->fd;
2711 ret = camera_get_state(camera, ¤t_state);
2712 if (ret != CAMERA_ERROR_NONE) {
2713 LOGE("failed to get current state 0x%x", ret);
2717 if (current_state != CAMERA_STATE_CREATED) {
2718 LOGE("INVALID_STATE : current %d", current_state);
2719 return CAMERA_ERROR_INVALID_STATE;
2722 LOGD("Enter, remote_handle : %x display : 0x%x", pc->remote_handle, display);
2724 if (type == CAMERA_DISPLAY_TYPE_NONE) {
2725 set_display_handle = 0;
2726 LOGD("display type NONE");
2728 obj = (Evas_Object *)display;
2729 object_type = evas_object_type_get(obj);
2731 if (type == CAMERA_DISPLAY_TYPE_OVERLAY && !strcmp(object_type, "elm_win")) {
2733 /* get wayland parent id */
2734 if (_get_wl_info(obj, &pc->wl_info) != CAMERA_ERROR_NONE) {
2735 LOGE("failed to get wayland info");
2736 return CAMERA_ERROR_INVALID_OPERATION;
2739 set_display_handle = (void *)&pc->wl_info;
2740 #else /* HAVE_WAYLAND */
2741 /* x window overlay surface */
2742 set_display_handle = (void *)elm_win_xwindow_get(obj);
2743 #endif /* HAVE_WAYLAND */
2744 LOGD("display type OVERLAY : handle %p", set_display_handle);
2745 } else if (type == CAMERA_DISPLAY_TYPE_EVAS && !strcmp(object_type, "image")) {
2746 /* evas object surface */
2747 set_display_handle = (void *)display;
2748 LOGD("display type EVAS : handle %p", set_display_handle);
2750 #ifdef EVAS_RENDERER_SUPPORT
2751 g_mutex_lock(&cb_info->evas_mutex);
2753 if (cb_info->evas_info) {
2754 LOGW("destroy existed evas renderer %p", cb_info->evas_info);
2755 ret = mm_evas_renderer_destroy(&cb_info->evas_info);
2756 if (ret != MM_ERROR_NONE) {
2757 LOGE("failed to destroy evas renderer %p", cb_info->evas_info);
2758 g_mutex_unlock(&cb_info->evas_mutex);
2759 return CAMERA_ERROR_INVALID_OPERATION;
2763 /* create evas renderer */
2764 ret = mm_evas_renderer_create(&cb_info->evas_info, (Evas_Object *)set_display_handle);
2765 if (ret == MM_ERROR_NONE) {
2766 camera_flip_e flip = CAMERA_FLIP_NONE;
2767 camera_display_mode_e mode = CAMERA_DISPLAY_MODE_LETTER_BOX;
2768 camera_rotation_e rotation = CAMERA_ROTATION_NONE;
2775 camera_get_display_flip(camera, &flip);
2776 camera_get_display_mode(camera, &mode);
2777 camera_get_display_rotation(camera, &rotation);
2778 camera_is_display_visible(camera, &visible);
2779 camera_attr_get_display_roi_area(camera, &x, &y, &width, &height);
2781 LOGD("current setting : flip %d, mode %d, rotation %d, visible %d, roi %d,%d,%dx%d",
2782 flip, mode, rotation, visible, x, y, width, height);
2784 ret = mm_evas_renderer_set_flip(cb_info->evas_info, flip);
2785 ret |= mm_evas_renderer_set_geometry(cb_info->evas_info, mode);
2786 ret |= mm_evas_renderer_set_rotation(cb_info->evas_info, rotation);
2787 ret |= mm_evas_renderer_set_visible(cb_info->evas_info, visible);
2789 if (mode == CAMERA_DISPLAY_MODE_CUSTOM_ROI)
2790 ret |= mm_evas_renderer_set_roi_area(cb_info->evas_info, x, y, width, height);
2793 g_mutex_unlock(&cb_info->evas_mutex);
2795 if (ret != MM_ERROR_NONE) {
2796 LOGE("mm_evas_renderer error 0x%x", ret);
2797 return CAMERA_ERROR_INVALID_OPERATION;
2799 #else /* EVAS_RENDERER_SUPPORT */
2800 LOGE("EVAS surface is not supported");
2801 return CAMERA_ERROR_NOT_SUPPORTED;
2802 #endif /* EVAS_RENDERER_SUPPORT */
2804 LOGE("unknown evas object [%p,%s] or type [%d] mismatch", obj, object_type, type);
2805 return CAMERA_ERROR_INVALID_PARAMETER;
2808 LOGE("failed to get evas object type from %p", obj);
2809 return CAMERA_ERROR_INVALID_PARAMETER;
2813 pc->display_handle = (intptr_t)set_display_handle;
2815 if (type == CAMERA_DISPLAY_TYPE_OVERLAY) {
2817 wl_info = &pc->wl_info;
2818 muse_camera_msg_send_array_and_value(api, sock_fd, cb_info, ret,
2819 wl_info, sizeof(camera_wl_info_s), sizeof(int), INT, type);
2821 LOGD("wayland parent id : %d, window %d,%d,%dx%d",
2822 wl_info->parent_id, wl_info->window_x, wl_info->window_y,
2823 wl_info->window_width, wl_info->window_height);
2824 #else /* HAVE_WAYLAND */
2825 muse_camera_msg_send2(api, sock_fd, cb_info, ret, INT, type, INT, set_display_handle);
2827 LOGD("x id : %d", (int)set_display_handle);
2828 #endif /* HAVE_WAYLAND */
2830 muse_camera_msg_send1(api, sock_fd, cb_info, ret, INT, type);
2832 if (ret != CAMERA_ERROR_NONE)
2833 LOGE("set display error 0x%x", ret);
2834 else if (type == CAMERA_DISPLAY_TYPE_EVAS)
2835 SET_PREVIEW_CB_TYPE(cb_info, PREVIEW_CB_TYPE_EVAS);
2840 int camera_set_preview_resolution(camera_h camera, int width, int height)
2842 if (camera == NULL) {
2843 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2844 return CAMERA_ERROR_INVALID_PARAMETER;
2846 int ret = CAMERA_ERROR_NONE;
2848 camera_cli_s *pc = (camera_cli_s *)camera;
2849 muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_RESOLUTION;
2851 if (pc->cb_info == NULL) {
2852 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2853 return CAMERA_ERROR_INVALID_PARAMETER;
2855 sock_fd = pc->cb_info->fd;
2857 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2858 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, width, INT, height);
2859 LOGD("ret : 0x%x", ret);
2864 int camera_set_capture_resolution(camera_h camera, int width, int height)
2866 if (camera == NULL) {
2867 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2868 return CAMERA_ERROR_INVALID_PARAMETER;
2871 int ret = CAMERA_ERROR_NONE;
2873 camera_cli_s *pc = (camera_cli_s *)camera;
2874 muse_camera_api_e api = MUSE_CAMERA_API_SET_CAPTURE_RESOLUTION;
2876 if (pc->cb_info == NULL) {
2877 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2878 return CAMERA_ERROR_INVALID_PARAMETER;
2880 sock_fd = pc->cb_info->fd;
2882 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2883 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, width, INT, height);
2884 LOGD("ret : 0x%x", ret);
2888 int camera_set_capture_format(camera_h camera, camera_pixel_format_e format)
2890 if (camera == NULL) {
2891 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2892 return CAMERA_ERROR_INVALID_PARAMETER;
2895 int ret = CAMERA_ERROR_NONE;
2896 int set_format = (int)format;
2898 camera_cli_s *pc = (camera_cli_s *)camera;
2899 muse_camera_api_e api = MUSE_CAMERA_API_SET_CAPTURE_FORMAT;
2901 if (pc->cb_info == NULL) {
2902 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2903 return CAMERA_ERROR_INVALID_PARAMETER;
2905 sock_fd = pc->cb_info->fd;
2907 LOGD("Enter, remote_handle : %x, capture_format: %d", pc->remote_handle, set_format);
2908 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_format);
2909 LOGD("ret : 0x%x", ret);
2913 int camera_set_preview_format(camera_h camera, camera_pixel_format_e format)
2915 if (camera == NULL) {
2916 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2917 return CAMERA_ERROR_INVALID_PARAMETER;
2920 int ret = CAMERA_ERROR_NONE;
2921 int set_format = (int)format;
2923 camera_cli_s *pc = (camera_cli_s *)camera;
2924 muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_FORMAT;
2926 if (pc->cb_info == NULL) {
2927 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2928 return CAMERA_ERROR_INVALID_PARAMETER;
2930 sock_fd = pc->cb_info->fd;
2932 LOGD("Enter, remote_handle : %x, capture_format: %d", pc->remote_handle, set_format);
2933 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_format);
2934 LOGD("ret : 0x%x", ret);
2938 int camera_get_preview_resolution(camera_h camera, int *width, int *height)
2940 if (camera == NULL || width == NULL || height == NULL) {
2941 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2942 return CAMERA_ERROR_INVALID_PARAMETER;
2946 int ret = CAMERA_ERROR_NONE;
2948 camera_cli_s *pc = (camera_cli_s *)camera;
2949 muse_camera_api_e api = MUSE_CAMERA_API_GET_PREVIEW_RESOLUTION;
2951 if (pc->cb_info == NULL) {
2952 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2953 return CAMERA_ERROR_INVALID_PARAMETER;
2955 sock_fd = pc->cb_info->fd;
2959 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2960 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2962 if (ret == CAMERA_ERROR_NONE) {
2963 muse_camera_msg_get(get_width, pc->cb_info->recv_msg);
2964 muse_camera_msg_get(get_height, pc->cb_info->recv_msg);
2966 *height = get_height;
2968 LOGD("ret : 0x%x", ret);
2972 int camera_set_display_rotation(camera_h camera, camera_rotation_e rotation)
2974 int ret = CAMERA_ERROR_NONE;
2975 int set_rotation = (int)rotation;
2976 camera_cli_s *pc = NULL;
2978 if (camera == NULL) {
2979 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2980 return CAMERA_ERROR_INVALID_PARAMETER;
2983 if (rotation < CAMERA_ROTATION_NONE || rotation > CAMERA_ROTATION_270) {
2984 LOGE("Invalid rotation %d", rotation);
2985 return CAMERA_ERROR_INVALID_PARAMETER;
2988 pc = (camera_cli_s *)camera;
2990 if (pc->cb_info == NULL) {
2991 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2992 return CAMERA_ERROR_INVALID_PARAMETER;
2995 #ifdef EVAS_RENDERER_SUPPORT
2996 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
2997 g_mutex_lock(&pc->cb_info->evas_mutex);
2999 ret = mm_evas_renderer_set_rotation(pc->cb_info->evas_info, rotation);
3001 g_mutex_unlock(&pc->cb_info->evas_mutex);
3003 if (ret != MM_ERROR_NONE) {
3004 LOGE("failed to set rotation for evas surface 0x%x", ret);
3005 return CAMERA_ERROR_INVALID_OPERATION;
3008 #endif /* EVAS_RENDERER_SUPPORT */
3010 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_ROTATION,
3011 pc->cb_info->fd, pc->cb_info, ret, INT, set_rotation);
3016 int camera_get_display_rotation(camera_h camera, camera_rotation_e *rotation)
3018 int ret = CAMERA_ERROR_NONE;
3019 int get_rotation = CAMERA_ROTATION_NONE;
3020 camera_cli_s *pc = NULL;
3022 if (camera == NULL || rotation == NULL) {
3023 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3024 return CAMERA_ERROR_INVALID_PARAMETER;
3027 pc = (camera_cli_s *)camera;
3029 if (pc->cb_info == NULL) {
3030 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3031 return CAMERA_ERROR_INVALID_PARAMETER;
3034 muse_camera_msg_send(MUSE_CAMERA_API_GET_DISPLAY_ROTATION,
3035 pc->cb_info->fd, pc->cb_info, ret);
3037 if (ret == CAMERA_ERROR_NONE) {
3038 muse_camera_msg_get(get_rotation, pc->cb_info->recv_msg);
3039 *rotation = (camera_rotation_e)get_rotation;
3045 int camera_set_display_flip(camera_h camera, camera_flip_e flip)
3047 int ret = CAMERA_ERROR_NONE;
3048 int set_flip = (int)flip;
3049 camera_cli_s *pc = NULL;
3051 if (camera == NULL) {
3052 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3053 return CAMERA_ERROR_INVALID_PARAMETER;
3056 if (flip < CAMERA_FLIP_NONE || flip > CAMERA_FLIP_BOTH) {
3057 LOGE("Invalid flip %d", flip);
3058 return CAMERA_ERROR_INVALID_PARAMETER;
3061 pc = (camera_cli_s *)camera;
3063 if (pc->cb_info == NULL) {
3064 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3065 return CAMERA_ERROR_INVALID_PARAMETER;
3068 #ifdef EVAS_RENDERER_SUPPORT
3069 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
3070 g_mutex_lock(&pc->cb_info->evas_mutex);
3072 ret = mm_evas_renderer_set_flip(pc->cb_info->evas_info, flip);
3074 g_mutex_unlock(&pc->cb_info->evas_mutex);
3076 if (ret != MM_ERROR_NONE) {
3077 LOGE("failed to set flip for evas surface 0x%x", ret);
3078 return CAMERA_ERROR_INVALID_OPERATION;
3081 #endif /* EVAS_RENDERER_SUPPORT */
3083 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_FLIP,
3084 pc->cb_info->fd, pc->cb_info, ret, INT, set_flip);
3089 int camera_get_display_flip(camera_h camera, camera_flip_e *flip)
3091 int ret = CAMERA_ERROR_NONE;
3092 int get_flip = CAMERA_FLIP_NONE;
3093 camera_cli_s *pc = NULL;
3095 if (camera == NULL || flip == NULL) {
3096 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3097 return CAMERA_ERROR_INVALID_PARAMETER;
3100 pc = (camera_cli_s *)camera;
3102 if (pc->cb_info == NULL) {
3103 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3104 return CAMERA_ERROR_INVALID_PARAMETER;
3107 muse_camera_msg_send(MUSE_CAMERA_API_GET_DISPLAY_FLIP,
3108 pc->cb_info->fd, pc->cb_info, ret);
3110 if (ret == CAMERA_ERROR_NONE) {
3111 muse_camera_msg_get(get_flip, pc->cb_info->recv_msg);
3112 *flip = (camera_flip_e)get_flip;
3118 int camera_set_display_visible(camera_h camera, bool visible)
3120 int ret = CAMERA_ERROR_NONE;
3121 int set_visible = (int)visible;
3122 camera_cli_s *pc = NULL;
3124 if (camera == NULL) {
3125 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3126 return CAMERA_ERROR_INVALID_PARAMETER;
3129 pc = (camera_cli_s *)camera;
3131 if (pc->cb_info == NULL) {
3132 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3133 return CAMERA_ERROR_INVALID_PARAMETER;
3136 #ifdef EVAS_RENDERER_SUPPORT
3137 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
3138 g_mutex_lock(&pc->cb_info->evas_mutex);
3140 ret = mm_evas_renderer_set_visible(pc->cb_info->evas_info, visible);
3142 g_mutex_unlock(&pc->cb_info->evas_mutex);
3144 if (ret != MM_ERROR_NONE) {
3145 LOGE("failed to set visible for evas surface 0x%x", ret);
3146 return CAMERA_ERROR_INVALID_OPERATION;
3149 #endif /* EVAS_RENDERER_SUPPORT */
3151 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_VISIBLE,
3152 pc->cb_info->fd, pc->cb_info, ret, INT, set_visible);
3157 int camera_is_display_visible(camera_h camera, bool *visible)
3159 int ret = CAMERA_ERROR_NONE;
3160 int get_visible = true;
3161 camera_cli_s *pc = NULL;
3163 if (camera == NULL || visible == NULL) {
3164 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3165 return CAMERA_ERROR_INVALID_PARAMETER;
3168 pc = (camera_cli_s *)camera;
3170 if (pc->cb_info == NULL) {
3171 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3172 return CAMERA_ERROR_INVALID_PARAMETER;
3175 muse_camera_msg_send(MUSE_CAMERA_API_IS_DISPLAY_VISIBLE,
3176 pc->cb_info->fd, pc->cb_info, ret);
3178 if (ret == CAMERA_ERROR_NONE) {
3179 muse_camera_msg_get(get_visible, pc->cb_info->recv_msg);
3180 *visible = (bool)get_visible;
3186 int camera_set_display_mode(camera_h camera, camera_display_mode_e mode)
3188 int ret = CAMERA_ERROR_NONE;
3189 int set_mode = (int)mode;
3190 camera_cli_s *pc = NULL;
3192 if (camera == NULL) {
3193 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3194 return CAMERA_ERROR_INVALID_PARAMETER;
3197 if (mode < CAMERA_DISPLAY_MODE_LETTER_BOX || mode > CAMERA_DISPLAY_MODE_CUSTOM_ROI) {
3198 LOGE("Invalid mode %d", mode);
3199 return CAMERA_ERROR_INVALID_PARAMETER;
3202 pc = (camera_cli_s *)camera;
3204 if (pc->cb_info == NULL) {
3205 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3206 return CAMERA_ERROR_INVALID_PARAMETER;
3209 #ifdef EVAS_RENDERER_SUPPORT
3210 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
3211 g_mutex_lock(&pc->cb_info->evas_mutex);
3213 ret = mm_evas_renderer_set_geometry(pc->cb_info->evas_info, mode);
3215 g_mutex_unlock(&pc->cb_info->evas_mutex);
3217 if (ret != MM_ERROR_NONE) {
3218 LOGE("failed to set geometry for evas surface 0x%x", ret);
3219 return CAMERA_ERROR_INVALID_OPERATION;
3222 #endif /* EVAS_RENDERER_SUPPORT */
3224 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_MODE,
3225 pc->cb_info->fd, pc->cb_info, ret, INT, set_mode);
3230 int camera_get_display_mode(camera_h camera, camera_display_mode_e *mode)
3232 int ret = CAMERA_ERROR_NONE;
3233 int get_mode = CAMERA_DISPLAY_MODE_LETTER_BOX;
3234 camera_cli_s *pc = NULL;
3236 if (camera == NULL || mode == NULL) {
3237 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3238 return CAMERA_ERROR_INVALID_PARAMETER;
3241 pc = (camera_cli_s *)camera;
3243 if (pc->cb_info == NULL) {
3244 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3245 return CAMERA_ERROR_INVALID_PARAMETER;
3248 muse_camera_msg_send(MUSE_CAMERA_API_GET_DISPLAY_MODE,
3249 pc->cb_info->fd, pc->cb_info, ret);
3251 if (ret == CAMERA_ERROR_NONE) {
3252 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
3253 *mode = (camera_display_mode_e)get_mode;
3259 int camera_get_capture_resolution(camera_h camera, int *width, int *height)
3261 if (camera == NULL || width == NULL || height == NULL) {
3262 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3263 return CAMERA_ERROR_INVALID_PARAMETER;
3265 int ret = CAMERA_ERROR_NONE;
3267 camera_cli_s *pc = (camera_cli_s *)camera;
3268 muse_camera_api_e api = MUSE_CAMERA_API_GET_CAPTURE_RESOLUTION;
3270 if (pc->cb_info == NULL) {
3271 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3272 return CAMERA_ERROR_INVALID_PARAMETER;
3274 sock_fd = pc->cb_info->fd;
3278 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3279 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3281 if (ret == CAMERA_ERROR_NONE) {
3282 muse_camera_msg_get(get_width, pc->cb_info->recv_msg);
3283 muse_camera_msg_get(get_height, pc->cb_info->recv_msg);
3285 *height = get_height;
3287 LOGD("ret : 0x%x", ret);
3291 int camera_get_capture_format(camera_h camera, camera_pixel_format_e *format)
3293 if (camera == NULL || format == NULL) {
3294 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3295 return CAMERA_ERROR_INVALID_PARAMETER;
3297 int ret = CAMERA_ERROR_NONE;
3299 camera_cli_s *pc = (camera_cli_s *)camera;
3300 muse_camera_api_e api = MUSE_CAMERA_API_GET_CAPTURE_FORMAT;
3303 if (pc->cb_info == NULL) {
3304 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3305 return CAMERA_ERROR_INVALID_PARAMETER;
3307 sock_fd = pc->cb_info->fd;
3309 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3310 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3312 if (ret == CAMERA_ERROR_NONE) {
3313 muse_camera_msg_get(get_format, pc->cb_info->recv_msg);
3314 *format = (camera_pixel_format_e)get_format;
3316 LOGD("ret : 0x%x", ret);
3320 int camera_get_preview_format(camera_h camera, camera_pixel_format_e *format)
3322 if (camera == NULL || format == NULL) {
3323 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3324 return CAMERA_ERROR_INVALID_PARAMETER;
3327 int ret = CAMERA_ERROR_NONE;
3329 camera_cli_s *pc = (camera_cli_s *)camera;
3330 muse_camera_api_e api = MUSE_CAMERA_API_GET_PREVIEW_FORMAT;
3333 if (pc->cb_info == NULL) {
3334 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3335 return CAMERA_ERROR_INVALID_PARAMETER;
3337 sock_fd = pc->cb_info->fd;
3339 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3340 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3342 if (ret == CAMERA_ERROR_NONE) {
3343 muse_camera_msg_get(get_format, pc->cb_info->recv_msg);
3344 *format = (camera_pixel_format_e)get_format;
3346 LOGD("ret : 0x%x", ret);
3350 int camera_get_facing_direction(camera_h camera, camera_facing_direction_e *facing_direciton)
3352 if (camera == NULL || facing_direciton == NULL) {
3353 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3354 return CAMERA_ERROR_INVALID_PARAMETER;
3357 int ret = CAMERA_ERROR_NONE;
3359 camera_cli_s *pc = (camera_cli_s *)camera;
3360 muse_camera_api_e api = MUSE_CAMERA_API_GET_FACING_DIRECTION;
3362 if (pc->cb_info == NULL) {
3363 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3364 return CAMERA_ERROR_INVALID_PARAMETER;
3366 sock_fd = pc->cb_info->fd;
3367 int get_facing_direction;
3369 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3370 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3372 if (ret == CAMERA_ERROR_NONE) {
3373 muse_camera_msg_get(get_facing_direction, pc->cb_info->recv_msg);
3374 *facing_direciton = (camera_facing_direction_e)get_facing_direction;
3376 LOGD("ret : 0x%x", ret);
3380 int camera_set_preview_cb(camera_h camera, camera_preview_cb callback, void *user_data)
3382 if (camera == NULL || callback == NULL) {
3383 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3384 return CAMERA_ERROR_INVALID_PARAMETER;
3386 int ret = CAMERA_ERROR_NONE;
3388 camera_cli_s *pc = (camera_cli_s *)camera;
3389 camera_cb_info_s *cb_info = (camera_cb_info_s *)pc->cb_info;
3391 if (pc->cb_info == NULL) {
3392 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3393 return CAMERA_ERROR_INVALID_PARAMETER;
3395 sock_fd = pc->cb_info->fd;
3396 muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_CB;
3398 LOGD("Enter, handle :%x", pc->remote_handle);
3400 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = callback;
3401 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = user_data;
3402 SET_PREVIEW_CB_TYPE(cb_info, PREVIEW_CB_TYPE_USER);
3404 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3405 LOGD("ret : 0x%x", ret);
3409 int camera_unset_preview_cb(camera_h camera)
3411 if (camera == NULL) {
3412 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3413 return CAMERA_ERROR_INVALID_PARAMETER;
3416 int ret = CAMERA_ERROR_NONE;
3418 camera_cli_s *pc = (camera_cli_s *)camera;
3419 camera_cb_info_s *cb_info = (camera_cb_info_s *)pc->cb_info;
3420 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_PREVIEW_CB;
3422 LOGD("Enter, handle :%x", pc->remote_handle);
3425 if (pc->cb_info == NULL) {
3426 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3427 return CAMERA_ERROR_INVALID_PARAMETER;
3429 sock_fd = pc->cb_info->fd;
3430 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = (void *)NULL;
3431 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = (void *)NULL;
3432 UNSET_PREVIEW_CB_TYPE(cb_info, PREVIEW_CB_TYPE_USER);
3434 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3435 LOGD("ret : 0x%x", ret);
3439 int camera_set_media_packet_preview_cb(camera_h camera, camera_media_packet_preview_cb callback, void *user_data)
3441 if (camera == NULL) {
3442 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
3443 return CAMERA_ERROR_INVALID_PARAMETER;
3446 if (camera_is_supported_media_packet_preview_cb(camera) == false) {
3447 LOGE("NOT SUPPORTED");
3448 return CAMERA_ERROR_NOT_SUPPORTED;
3451 if (callback == NULL) {
3452 LOGE("INVALID_PARAMETER(0x%08x) - callback", CAMERA_ERROR_INVALID_PARAMETER);
3453 return CAMERA_ERROR_INVALID_PARAMETER;
3456 int ret = CAMERA_ERROR_NONE;
3458 camera_cli_s *pc = (camera_cli_s *)camera;
3459 muse_camera_api_e api = MUSE_CAMERA_API_SET_MEDIA_PACKET_PREVIEW_CB;
3461 LOGD("Enter, handle :%x", pc->remote_handle);
3464 if (pc->cb_info == NULL) {
3465 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3466 return CAMERA_ERROR_INVALID_PARAMETER;
3468 sock_fd = pc->cb_info->fd;
3469 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = callback;
3470 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = user_data;
3472 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3473 LOGD("ret : 0x%x", ret);
3477 int camera_unset_media_packet_preview_cb(camera_h camera)
3479 if (camera == NULL) {
3480 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3481 return CAMERA_ERROR_INVALID_PARAMETER;
3484 int ret = CAMERA_ERROR_NONE;
3486 camera_cli_s *pc = (camera_cli_s *)camera;
3487 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_MEDIA_PACKET_PREVIEW_CB;
3489 LOGD("Enter, handle :%x", pc->remote_handle);
3492 if (pc->cb_info == NULL) {
3493 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3494 return CAMERA_ERROR_INVALID_PARAMETER;
3496 sock_fd = pc->cb_info->fd;
3497 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = (void *)NULL;
3498 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = (void *)NULL;
3500 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3501 LOGD("ret : 0x%x", ret);
3505 int camera_set_state_changed_cb(camera_h camera, camera_state_changed_cb callback, void *user_data)
3507 if (camera == NULL || callback == NULL) {
3508 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3509 return CAMERA_ERROR_INVALID_PARAMETER;
3511 int ret = CAMERA_ERROR_NONE;
3513 camera_cli_s *pc = (camera_cli_s *)camera;
3514 muse_camera_api_e api = MUSE_CAMERA_API_SET_STATE_CHANGED_CB;
3516 LOGD("Enter, handle :%x", pc->remote_handle);
3519 if (pc->cb_info == NULL) {
3520 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3521 return CAMERA_ERROR_INVALID_PARAMETER;
3523 sock_fd = pc->cb_info->fd;
3524 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = callback;
3525 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = user_data;
3527 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3528 LOGD("ret : 0x%x", ret);
3531 int camera_unset_state_changed_cb(camera_h camera)
3533 if (camera == NULL) {
3534 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3535 return CAMERA_ERROR_INVALID_PARAMETER;
3537 int ret = CAMERA_ERROR_NONE;
3539 camera_cli_s *pc = (camera_cli_s *)camera;
3540 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_STATE_CHANGED_CB;
3542 LOGD("Enter, handle :%x", pc->remote_handle);
3545 if (pc->cb_info == NULL) {
3546 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3547 return CAMERA_ERROR_INVALID_PARAMETER;
3549 sock_fd = pc->cb_info->fd;
3550 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = (void *)NULL;
3551 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = (void *)NULL;
3553 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3554 LOGD("ret : 0x%x", ret);
3558 int camera_set_interrupted_cb(camera_h camera, camera_interrupted_cb callback, void *user_data)
3560 if (camera == NULL || callback == NULL) {
3561 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3562 return CAMERA_ERROR_INVALID_PARAMETER;
3564 int ret = CAMERA_ERROR_NONE;
3566 camera_cli_s *pc = (camera_cli_s *)camera;
3567 muse_camera_api_e api = MUSE_CAMERA_API_SET_INTERRUPTED_CB;
3569 LOGD("Enter, handle :%x", pc->remote_handle);
3572 if (pc->cb_info == NULL) {
3573 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3574 return CAMERA_ERROR_INVALID_PARAMETER;
3576 sock_fd = pc->cb_info->fd;
3577 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = callback;
3578 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = user_data;
3580 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3581 LOGD("ret : 0x%x", ret);
3585 int camera_unset_interrupted_cb(camera_h camera)
3587 if (camera == NULL) {
3588 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3589 return CAMERA_ERROR_INVALID_PARAMETER;
3591 int ret = CAMERA_ERROR_NONE;
3593 camera_cli_s *pc = (camera_cli_s *)camera;
3594 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_INTERRUPTED_CB;
3596 LOGD("Enter, handle :%x", pc->remote_handle);
3599 if (pc->cb_info == NULL) {
3600 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3601 return CAMERA_ERROR_INVALID_PARAMETER;
3603 sock_fd = pc->cb_info->fd;
3604 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = (void *)NULL;
3605 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = (void *)NULL;
3607 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3608 LOGD("ret : 0x%x", ret);
3612 int camera_set_focus_changed_cb(camera_h camera, camera_focus_changed_cb callback, void *user_data)
3614 if (camera == NULL || callback == NULL) {
3615 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3616 return CAMERA_ERROR_INVALID_PARAMETER;
3618 int ret = CAMERA_ERROR_NONE;
3620 camera_cli_s *pc = (camera_cli_s *)camera;
3621 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOCUS_CHANGED_CB;
3623 LOGD("Enter, handle :%x", pc->remote_handle);
3626 if (pc->cb_info == NULL) {
3627 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3628 return CAMERA_ERROR_INVALID_PARAMETER;
3630 sock_fd = pc->cb_info->fd;
3631 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = callback;
3632 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = user_data;
3634 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3635 LOGD("ret : 0x%x", ret);
3639 int camera_unset_focus_changed_cb(camera_h camera)
3641 if (camera == NULL) {
3642 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3643 return CAMERA_ERROR_INVALID_PARAMETER;
3645 int ret = CAMERA_ERROR_NONE;
3647 camera_cli_s *pc = (camera_cli_s *)camera;
3648 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_FOCUS_CHANGED_CB;
3650 LOGD("Enter, handle :%x", pc->remote_handle);
3653 if (pc->cb_info == NULL) {
3654 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3655 return CAMERA_ERROR_INVALID_PARAMETER;
3657 sock_fd = pc->cb_info->fd;
3658 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = (void *)NULL;
3659 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = (void *)NULL;
3661 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3662 LOGD("ret : 0x%x", ret);
3666 int camera_set_error_cb(camera_h camera, camera_error_cb callback, void *user_data)
3668 if (camera == NULL || callback == NULL) {
3669 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3670 return CAMERA_ERROR_INVALID_PARAMETER;
3672 int ret = CAMERA_ERROR_NONE;
3674 camera_cli_s *pc = (camera_cli_s *)camera;
3675 muse_camera_api_e api = MUSE_CAMERA_API_SET_ERROR_CB;
3677 LOGD("Enter, handle :%x", pc->remote_handle);
3680 if (pc->cb_info == NULL) {
3681 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3682 return CAMERA_ERROR_INVALID_PARAMETER;
3684 sock_fd = pc->cb_info->fd;
3685 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_ERROR] = callback;
3686 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_ERROR] = user_data;
3688 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3689 LOGD("ret : 0x%x", ret);
3693 int camera_unset_error_cb(camera_h camera)
3695 if (camera == NULL) {
3696 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3697 return CAMERA_ERROR_INVALID_PARAMETER;
3699 int ret = CAMERA_ERROR_NONE;
3701 camera_cli_s *pc = (camera_cli_s *)camera;
3702 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_ERROR_CB;
3704 LOGD("Enter, handle :%x", pc->remote_handle);
3707 if (pc->cb_info == NULL) {
3708 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3709 return CAMERA_ERROR_INVALID_PARAMETER;
3711 sock_fd = pc->cb_info->fd;
3712 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_ERROR] = (void *)NULL;
3713 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_ERROR] = (void *)NULL;
3715 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3716 LOGD("ret : 0x%x", ret);
3720 int camera_foreach_supported_preview_resolution(camera_h camera, camera_supported_preview_resolution_cb foreach_cb , void *user_data)
3722 if (camera == NULL || foreach_cb == NULL) {
3723 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3724 return CAMERA_ERROR_INVALID_PARAMETER;
3726 int ret = CAMERA_ERROR_NONE;
3728 camera_cli_s *pc = (camera_cli_s *)camera;
3729 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_PREVIEW_RESOLUTION;
3731 LOGD("Enter, handle :%x", pc->remote_handle);
3734 if (pc->cb_info == NULL) {
3735 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3736 return CAMERA_ERROR_INVALID_PARAMETER;
3738 sock_fd = pc->cb_info->fd;
3739 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_RESOLUTION] = foreach_cb;
3740 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_RESOLUTION] = user_data;
3742 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3743 LOGD("ret : 0x%x", ret);
3747 int camera_foreach_supported_capture_resolution(camera_h camera, camera_supported_capture_resolution_cb foreach_cb , void *user_data)
3749 if (camera == NULL || foreach_cb == NULL) {
3750 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3751 return CAMERA_ERROR_INVALID_PARAMETER;
3753 int ret = CAMERA_ERROR_NONE;
3755 camera_cli_s *pc = (camera_cli_s *)camera;
3756 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_CAPTURE_RESOLUTION;
3758 LOGD("Enter, handle :%x", pc->remote_handle);
3761 if (pc->cb_info == NULL) {
3762 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3763 return CAMERA_ERROR_INVALID_PARAMETER;
3765 sock_fd = pc->cb_info->fd;
3766 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_RESOLUTION] = foreach_cb;
3767 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_RESOLUTION] = user_data;
3769 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3770 LOGD("ret : 0x%x", ret);
3774 int camera_foreach_supported_capture_format(camera_h camera, camera_supported_capture_format_cb foreach_cb , void *user_data)
3776 if (camera == NULL || foreach_cb == NULL) {
3777 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3778 return CAMERA_ERROR_INVALID_PARAMETER;
3780 int ret = CAMERA_ERROR_NONE;
3782 camera_cli_s *pc = (camera_cli_s *)camera;
3783 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_CAPTURE_FORMAT;
3785 LOGD("Enter, handle :%x", pc->remote_handle);
3788 if (pc->cb_info == NULL) {
3789 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3790 return CAMERA_ERROR_INVALID_PARAMETER;
3792 sock_fd = pc->cb_info->fd;
3793 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_FORMAT] = foreach_cb;
3794 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_FORMAT] = user_data;
3796 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3797 LOGD("ret : 0x%x", ret);
3802 int camera_foreach_supported_preview_format(camera_h camera, camera_supported_preview_format_cb foreach_cb , void *user_data)
3804 if (camera == NULL || foreach_cb == NULL) {
3805 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3806 return CAMERA_ERROR_INVALID_PARAMETER;
3808 int ret = CAMERA_ERROR_NONE;
3810 camera_cli_s *pc = (camera_cli_s *)camera;
3811 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_PREVIEW_FORMAT;
3813 LOGD("Enter, handle :%x", pc->remote_handle);
3816 if (pc->cb_info == NULL) {
3817 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3818 return CAMERA_ERROR_INVALID_PARAMETER;
3820 sock_fd = pc->cb_info->fd;
3821 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_FORMAT] = foreach_cb;
3822 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_FORMAT] = user_data;
3824 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3825 LOGD("ret : 0x%x", ret);
3830 int camera_get_recommended_preview_resolution(camera_h camera, int *width, int *height)
3832 if (camera == NULL || width == NULL || height == NULL) {
3833 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3834 return CAMERA_ERROR_INVALID_PARAMETER;
3836 int ret = CAMERA_ERROR_NONE;
3838 camera_cli_s *pc = (camera_cli_s *)camera;
3839 muse_camera_api_e api = MUSE_CAMERA_API_GET_RECOMMENDED_PREVIEW_RESOLUTION;
3841 if (pc->cb_info == NULL) {
3842 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3843 return CAMERA_ERROR_INVALID_PARAMETER;
3845 sock_fd = pc->cb_info->fd;
3849 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3850 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3852 if (ret == CAMERA_ERROR_NONE) {
3853 muse_camera_msg_get(get_width, pc->cb_info->recv_msg);
3854 muse_camera_msg_get(get_height, pc->cb_info->recv_msg);
3856 *height = get_height;
3858 LOGD("ret : 0x%x", ret);
3863 int camera_attr_get_lens_orientation(camera_h camera, int *angle)
3865 if (camera == NULL || angle == NULL) {
3866 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3867 return CAMERA_ERROR_INVALID_PARAMETER;
3869 int ret = CAMERA_ERROR_NONE;
3871 camera_cli_s *pc = (camera_cli_s *)camera;
3872 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_LENS_ORIENTATION;
3874 if (pc->cb_info == NULL) {
3875 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3876 return CAMERA_ERROR_INVALID_PARAMETER;
3878 sock_fd = pc->cb_info->fd;
3881 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3882 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3884 if (ret == CAMERA_ERROR_NONE) {
3885 muse_camera_msg_get(get_angle, pc->cb_info->recv_msg);
3888 LOGD("ret : 0x%x", ret);
3892 int camera_attr_set_theater_mode(camera_h camera, camera_attr_theater_mode_e mode)
3894 if (camera == NULL) {
3895 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3896 return CAMERA_ERROR_INVALID_PARAMETER;
3898 int ret = CAMERA_ERROR_NONE;
3899 camera_cli_s *pc = (camera_cli_s *)camera;
3900 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_THEATER_MODE;
3902 if (pc->cb_info == NULL) {
3903 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3904 return CAMERA_ERROR_INVALID_PARAMETER;
3906 sock_fd = pc->cb_info->fd;
3907 int set_mode = (int)mode;
3908 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3909 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
3910 LOGD("ret : 0x%x", ret);
3914 int camera_attr_get_theater_mode(camera_h camera, camera_attr_theater_mode_e *mode)
3916 if (camera == NULL || mode == NULL) {
3917 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3918 return CAMERA_ERROR_INVALID_PARAMETER;
3921 int ret = CAMERA_ERROR_NONE;
3922 camera_cli_s *pc = (camera_cli_s *)camera;
3923 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_THEATER_MODE;
3925 if (pc->cb_info == NULL) {
3926 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3927 return CAMERA_ERROR_INVALID_PARAMETER;
3929 sock_fd = pc->cb_info->fd;
3931 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3932 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3934 if (ret == CAMERA_ERROR_NONE) {
3935 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
3936 *mode = (camera_attr_theater_mode_e)get_mode;
3938 LOGD("ret : 0x%x", ret);
3942 int camera_attr_foreach_supported_theater_mode(camera_h camera, camera_attr_supported_theater_mode_cb foreach_cb, void *user_data)
3944 if (camera == NULL || foreach_cb == NULL) {
3945 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3946 return CAMERA_ERROR_INVALID_PARAMETER;
3948 int ret = CAMERA_ERROR_NONE;
3950 camera_cli_s *pc = (camera_cli_s *)camera;
3951 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_THEATER_MODE;
3953 LOGD("Enter, handle :%x", pc->remote_handle);
3956 if (pc->cb_info == NULL) {
3957 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3958 return CAMERA_ERROR_INVALID_PARAMETER;
3960 sock_fd = pc->cb_info->fd;
3961 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE] = foreach_cb;
3962 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE] = user_data;
3964 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3966 LOGD("Finish, return :%x", ret);
3971 int camera_attr_set_preview_fps(camera_h camera, camera_attr_fps_e fps)
3973 if (camera == NULL) {
3974 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3975 return CAMERA_ERROR_INVALID_PARAMETER;
3977 int ret = CAMERA_ERROR_NONE;
3978 camera_cli_s *pc = (camera_cli_s *)camera;
3979 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_PREVIEW_FPS;
3981 if (pc->cb_info == NULL) {
3982 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3983 return CAMERA_ERROR_INVALID_PARAMETER;
3985 sock_fd = pc->cb_info->fd;
3986 int set_fps = (int)fps;
3987 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3988 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_fps);
3989 LOGD("ret : 0x%x", ret);
3994 int camera_attr_set_image_quality(camera_h camera, int quality)
3996 if (camera == NULL) {
3997 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3998 return CAMERA_ERROR_INVALID_PARAMETER;
4000 int ret = CAMERA_ERROR_NONE;
4002 camera_cli_s *pc = (camera_cli_s *)camera;
4003 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_IMAGE_QUALITY;
4005 if (pc->cb_info == NULL) {
4006 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4007 return CAMERA_ERROR_INVALID_PARAMETER;
4009 sock_fd = pc->cb_info->fd;
4010 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4011 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, quality);
4012 LOGD("ret : 0x%x", ret);
4016 int camera_attr_get_preview_fps(camera_h camera, camera_attr_fps_e *fps)
4018 if (camera == NULL || fps == NULL) {
4019 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4020 return CAMERA_ERROR_INVALID_PARAMETER;
4022 int ret = CAMERA_ERROR_NONE;
4024 camera_cli_s *pc = (camera_cli_s *)camera;
4025 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_PREVIEW_FPS;
4028 if (pc->cb_info == NULL) {
4029 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4030 return CAMERA_ERROR_INVALID_PARAMETER;
4032 sock_fd = pc->cb_info->fd;
4034 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4035 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4037 if (ret == CAMERA_ERROR_NONE) {
4038 muse_camera_msg_get(get_fps, pc->cb_info->recv_msg);
4039 *fps = (camera_attr_fps_e)get_fps;
4041 LOGD("ret : 0x%x", ret);
4046 int camera_attr_get_image_quality(camera_h camera, int *quality)
4048 if (camera == NULL || quality == NULL) {
4049 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4050 return CAMERA_ERROR_INVALID_PARAMETER;
4052 int ret = CAMERA_ERROR_NONE;
4054 camera_cli_s *pc = (camera_cli_s *)camera;
4055 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_IMAGE_QUALITY;
4057 if (pc->cb_info == NULL) {
4058 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4059 return CAMERA_ERROR_INVALID_PARAMETER;
4061 sock_fd = pc->cb_info->fd;
4063 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4064 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4066 if (ret == CAMERA_ERROR_NONE) {
4067 muse_camera_msg_get(get_quality, pc->cb_info->recv_msg);
4068 *quality = get_quality;
4070 LOGD("ret : 0x%x", ret);
4075 int camera_attr_get_encoded_preview_bitrate(camera_h camera, int *bitrate)
4077 if (camera == NULL || bitrate == NULL) {
4078 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4079 return CAMERA_ERROR_INVALID_PARAMETER;
4082 int ret = CAMERA_ERROR_NONE;
4084 camera_cli_s *pc = (camera_cli_s *)camera;
4085 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ENCODED_PREVIEW_BITRATE;
4087 if (pc->cb_info == NULL) {
4088 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4089 return CAMERA_ERROR_INVALID_PARAMETER;
4091 sock_fd = pc->cb_info->fd;
4094 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4095 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4097 if (ret == CAMERA_ERROR_NONE) {
4098 muse_camera_msg_get(get_bitrate, pc->cb_info->recv_msg);
4099 *bitrate = get_bitrate;
4101 LOGD("ret : 0x%x", ret);
4106 int camera_attr_set_encoded_preview_bitrate(camera_h camera, int bitrate)
4108 if (camera == NULL) {
4109 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4110 return CAMERA_ERROR_INVALID_PARAMETER;
4113 int ret = CAMERA_ERROR_NONE;
4115 camera_cli_s *pc = (camera_cli_s *)camera;
4116 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ENCODED_PREVIEW_BITRATE;
4118 if (pc->cb_info == NULL) {
4119 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4120 return CAMERA_ERROR_INVALID_PARAMETER;
4122 sock_fd = pc->cb_info->fd;
4123 int set_bitrate = bitrate;
4124 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4125 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_bitrate);
4126 LOGD("ret : 0x%x", ret);
4131 int camera_attr_get_encoded_preview_gop_interval(camera_h camera, int *interval)
4133 if (camera == NULL || interval == NULL) {
4134 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4135 return CAMERA_ERROR_INVALID_PARAMETER;
4138 int ret = CAMERA_ERROR_NONE;
4140 camera_cli_s *pc = (camera_cli_s *)camera;
4141 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ENCODED_PREVIEW_GOP_INTERVAL;
4143 if (pc->cb_info == NULL) {
4144 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4145 return CAMERA_ERROR_INVALID_PARAMETER;
4147 sock_fd = pc->cb_info->fd;
4148 int get_gop_interval;
4150 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4151 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4153 if (ret == CAMERA_ERROR_NONE) {
4154 muse_camera_msg_get(get_gop_interval, pc->cb_info->recv_msg);
4155 *interval = get_gop_interval;
4157 LOGD("ret : 0x%x", ret);
4162 int camera_attr_set_encoded_preview_gop_interval(camera_h camera, int interval)
4164 if (camera == NULL) {
4165 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4166 return CAMERA_ERROR_INVALID_PARAMETER;
4169 int ret = CAMERA_ERROR_NONE;
4171 camera_cli_s *pc = (camera_cli_s *)camera;
4172 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ENCODED_PREVIEW_GOP_INTERVAL;
4174 if (pc->cb_info == NULL) {
4175 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4176 return CAMERA_ERROR_INVALID_PARAMETER;
4178 sock_fd = pc->cb_info->fd;
4179 int set_gop_interval = interval;
4180 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4181 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_gop_interval);
4182 LOGD("ret : 0x%x", ret);
4187 int camera_attr_set_zoom(camera_h camera, int zoom)
4189 if (camera == NULL) {
4190 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4191 return CAMERA_ERROR_INVALID_PARAMETER;
4193 int ret = CAMERA_ERROR_NONE;
4195 camera_cli_s *pc = (camera_cli_s *)camera;
4196 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ZOOM;
4198 if (pc->cb_info == NULL) {
4199 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4200 return CAMERA_ERROR_INVALID_PARAMETER;
4202 sock_fd = pc->cb_info->fd;
4204 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4205 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, zoom);
4206 LOGD("ret : 0x%x", ret);
4210 int camera_attr_set_af_mode(camera_h camera, camera_attr_af_mode_e mode)
4212 if (camera == NULL) {
4213 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4214 return CAMERA_ERROR_INVALID_PARAMETER;
4216 int ret = CAMERA_ERROR_NONE;
4218 camera_cli_s *pc = (camera_cli_s *)camera;
4219 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_AF_MODE;
4221 if (pc->cb_info == NULL) {
4222 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4223 return CAMERA_ERROR_INVALID_PARAMETER;
4225 sock_fd = pc->cb_info->fd;
4226 int set_mode = (int)mode;
4227 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4228 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
4229 LOGD("ret : 0x%x", ret);
4233 int camera_attr_set_af_area(camera_h camera, int x, int y)
4235 if (camera == NULL) {
4236 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4237 return CAMERA_ERROR_INVALID_PARAMETER;
4239 int ret = CAMERA_ERROR_NONE;
4240 camera_cli_s *pc = (camera_cli_s *)camera;
4241 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_AF_AREA;
4242 int sock_fd = pc->cb_info->fd;
4243 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4244 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, x, INT, y);
4245 LOGD("ret : 0x%x", ret);
4250 int camera_attr_clear_af_area(camera_h camera)
4252 if (camera == NULL) {
4253 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4254 return CAMERA_ERROR_INVALID_PARAMETER;
4256 int ret = CAMERA_ERROR_NONE;
4258 camera_cli_s *pc = (camera_cli_s *)camera;
4259 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_CLEAR_AF_AREA;
4261 if (pc->cb_info == NULL) {
4262 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4263 return CAMERA_ERROR_INVALID_PARAMETER;
4265 sock_fd = pc->cb_info->fd;
4266 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4267 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4268 LOGD("ret : 0x%x", ret);
4273 int camera_attr_set_exposure_mode(camera_h camera, camera_attr_exposure_mode_e mode)
4275 if (camera == NULL) {
4276 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4277 return CAMERA_ERROR_INVALID_PARAMETER;
4280 if (mode < CAMERA_ATTR_EXPOSURE_MODE_OFF || mode > CAMERA_ATTR_EXPOSURE_MODE_CUSTOM) {
4281 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4282 return CAMERA_ERROR_INVALID_PARAMETER;
4285 int ret = CAMERA_ERROR_NONE;
4286 camera_cli_s *pc = (camera_cli_s *)camera;
4287 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EXPOSURE_MODE;
4288 int set_mode = (int)mode;
4290 if (pc->cb_info == NULL) {
4291 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4292 return CAMERA_ERROR_INVALID_PARAMETER;
4294 sock_fd = pc->cb_info->fd;
4295 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4296 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
4297 LOGD("ret : 0x%x", ret);
4302 int camera_attr_set_exposure(camera_h camera, int value)
4304 if (camera == NULL) {
4305 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4306 return CAMERA_ERROR_INVALID_PARAMETER;
4308 int ret = CAMERA_ERROR_NONE;
4310 camera_cli_s *pc = (camera_cli_s *)camera;
4311 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EXPOSURE;
4313 if (pc->cb_info == NULL) {
4314 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4315 return CAMERA_ERROR_INVALID_PARAMETER;
4317 sock_fd = pc->cb_info->fd;
4319 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4320 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, value);
4321 LOGD("ret : 0x%x", ret);
4326 int camera_attr_set_iso(camera_h camera, camera_attr_iso_e iso)
4328 if (camera == NULL) {
4329 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4330 return CAMERA_ERROR_INVALID_PARAMETER;
4332 int ret = CAMERA_ERROR_NONE;
4334 camera_cli_s *pc = (camera_cli_s *)camera;
4335 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ISO;
4337 if (pc->cb_info == NULL) {
4338 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4339 return CAMERA_ERROR_INVALID_PARAMETER;
4341 sock_fd = pc->cb_info->fd;
4342 int set_iso = (int)iso;
4343 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4344 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_iso);
4345 LOGD("ret : 0x%x", ret);
4350 int camera_attr_set_brightness(camera_h camera, int level)
4352 if (camera == NULL) {
4353 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4354 return CAMERA_ERROR_INVALID_PARAMETER;
4356 int ret = CAMERA_ERROR_NONE;
4358 camera_cli_s *pc = (camera_cli_s *)camera;
4359 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_BRIGHTNESS;
4361 if (pc->cb_info == NULL) {
4362 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4363 return CAMERA_ERROR_INVALID_PARAMETER;
4365 sock_fd = pc->cb_info->fd;
4367 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4368 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, level);
4369 LOGD("ret : 0x%x", ret);
4374 int camera_attr_set_contrast(camera_h camera, int level)
4376 if (camera == NULL) {
4377 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4378 return CAMERA_ERROR_INVALID_PARAMETER;
4380 int ret = CAMERA_ERROR_NONE;
4382 camera_cli_s *pc = (camera_cli_s *)camera;
4383 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_CONTRAST;
4385 if (pc->cb_info == NULL) {
4386 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4387 return CAMERA_ERROR_INVALID_PARAMETER;
4389 sock_fd = pc->cb_info->fd;
4391 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4392 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, level);
4393 LOGD("ret : 0x%x", ret);
4398 int camera_attr_set_whitebalance(camera_h camera, camera_attr_whitebalance_e wb)
4400 if (camera == NULL) {
4401 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4402 return CAMERA_ERROR_INVALID_PARAMETER;
4405 if (wb < CAMERA_ATTR_WHITE_BALANCE_NONE || wb > CAMERA_ATTR_WHITE_BALANCE_CUSTOM) {
4406 LOGE("invalid white balance %d", wb);
4407 return CAMERA_ERROR_INVALID_PARAMETER;
4410 int ret = CAMERA_ERROR_NONE;
4412 camera_cli_s *pc = (camera_cli_s *)camera;
4413 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_WHITEBALANCE;
4415 if (pc->cb_info == NULL) {
4416 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4417 return CAMERA_ERROR_INVALID_PARAMETER;
4419 sock_fd = pc->cb_info->fd;
4420 int set_whitebalance = (int)wb;
4421 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4422 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_whitebalance);
4423 LOGD("ret : 0x%x", ret);
4428 int camera_attr_set_effect(camera_h camera, camera_attr_effect_mode_e effect)
4430 if (camera == NULL) {
4431 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4432 return CAMERA_ERROR_INVALID_PARAMETER;
4434 int ret = CAMERA_ERROR_NONE;
4436 camera_cli_s *pc = (camera_cli_s *)camera;
4437 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EFFECT;
4439 if (pc->cb_info == NULL) {
4440 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4441 return CAMERA_ERROR_INVALID_PARAMETER;
4443 sock_fd = pc->cb_info->fd;
4444 int set_effect = (int)effect;
4445 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4446 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_effect);
4447 LOGD("ret : 0x%x", ret);
4452 int camera_attr_set_scene_mode(camera_h camera, camera_attr_scene_mode_e mode)
4454 if (camera == NULL) {
4455 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4456 return CAMERA_ERROR_INVALID_PARAMETER;
4458 int ret = CAMERA_ERROR_NONE;
4460 camera_cli_s *pc = (camera_cli_s *)camera;
4461 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_SCENE_MODE;
4463 if (pc->cb_info == NULL) {
4464 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4465 return CAMERA_ERROR_INVALID_PARAMETER;
4467 sock_fd = pc->cb_info->fd;
4468 int set_mode = (int)mode;
4469 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4470 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
4471 LOGD("ret : 0x%x", ret);
4476 int camera_attr_enable_tag(camera_h camera, bool enable)
4478 if (camera == NULL) {
4479 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4480 return CAMERA_ERROR_INVALID_PARAMETER;
4482 int ret = CAMERA_ERROR_NONE;
4483 camera_cli_s *pc = (camera_cli_s *)camera;
4484 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_TAG;
4486 if (pc->cb_info == NULL) {
4487 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4488 return CAMERA_ERROR_INVALID_PARAMETER;
4490 sock_fd = pc->cb_info->fd;
4491 int set_enable = (int)enable;
4493 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4494 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
4495 LOGD("ret : 0x%x", ret);
4500 int camera_attr_set_tag_image_description(camera_h camera, const char *description)
4502 if (camera == NULL) {
4503 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4504 return CAMERA_ERROR_INVALID_PARAMETER;
4506 if (description == NULL) {
4507 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4508 return CAMERA_ERROR_INVALID_PARAMETER;
4510 int ret = CAMERA_ERROR_NONE;
4511 camera_cli_s *pc = (camera_cli_s *)camera;
4512 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_IMAGE_DESCRIPTION;
4514 if (pc->cb_info == NULL) {
4515 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4516 return CAMERA_ERROR_INVALID_PARAMETER;
4518 sock_fd = pc->cb_info->fd;
4519 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4520 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, STRING, description);
4521 LOGD("ret : 0x%x", ret);
4526 int camera_attr_set_tag_orientation(camera_h camera, camera_attr_tag_orientation_e orientation)
4528 if (camera == NULL) {
4529 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4530 return CAMERA_ERROR_INVALID_PARAMETER;
4532 int ret = CAMERA_ERROR_NONE;
4533 camera_cli_s *pc = (camera_cli_s *)camera;
4534 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_ORIENTATION;
4536 if (pc->cb_info == NULL) {
4537 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4538 return CAMERA_ERROR_INVALID_PARAMETER;
4540 sock_fd = pc->cb_info->fd;
4541 int set_orientation = (int)orientation;
4543 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4544 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_orientation);
4545 LOGD("ret : 0x%x", ret);
4550 int camera_attr_set_tag_software(camera_h camera, const char *software)
4552 if (camera == NULL) {
4553 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4554 return CAMERA_ERROR_INVALID_PARAMETER;
4556 if (software == NULL) {
4557 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4558 return CAMERA_ERROR_INVALID_PARAMETER;
4560 int ret = CAMERA_ERROR_NONE;
4561 camera_cli_s *pc = (camera_cli_s *)camera;
4562 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_SOFTWARE;
4564 if (pc->cb_info == NULL) {
4565 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4566 return CAMERA_ERROR_INVALID_PARAMETER;
4568 sock_fd = pc->cb_info->fd;
4569 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4570 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, STRING, software);
4571 LOGD("ret : 0x%x", ret);
4576 int camera_attr_set_geotag(camera_h camera, double latitude , double longitude, double altitude)
4578 if (camera == NULL) {
4579 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4580 return CAMERA_ERROR_INVALID_PARAMETER;
4582 int ret = CAMERA_ERROR_NONE;
4583 camera_cli_s *pc = (camera_cli_s *)camera;
4584 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_GEOTAG;
4586 if (pc->cb_info == NULL) {
4587 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4588 return CAMERA_ERROR_INVALID_PARAMETER;
4590 sock_fd = pc->cb_info->fd;
4591 double set_geotag[3] = { latitude, longitude, altitude };
4593 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4594 muse_camera_msg_send_array(api, sock_fd, pc->cb_info, ret,
4595 set_geotag, sizeof(set_geotag), sizeof(double));
4596 LOGD("ret : 0x%x", ret);
4601 int camera_attr_remove_geotag(camera_h camera)
4603 if (camera == NULL) {
4604 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4605 return CAMERA_ERROR_INVALID_PARAMETER;
4607 int ret = CAMERA_ERROR_NONE;
4608 camera_cli_s *pc = (camera_cli_s *)camera;
4609 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_REMOVE_GEOTAG;
4611 if (pc->cb_info == NULL) {
4612 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4613 return CAMERA_ERROR_INVALID_PARAMETER;
4615 sock_fd = pc->cb_info->fd;
4616 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4617 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4618 LOGD("ret : 0x%x", ret);
4623 int camera_attr_set_flash_mode(camera_h camera, camera_attr_flash_mode_e mode)
4625 if (camera == NULL) {
4626 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4627 return CAMERA_ERROR_INVALID_PARAMETER;
4629 int ret = CAMERA_ERROR_NONE;
4630 camera_cli_s *pc = (camera_cli_s *)camera;
4631 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_FLASH_MODE;
4633 if (pc->cb_info == NULL) {
4634 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4635 return CAMERA_ERROR_INVALID_PARAMETER;
4637 sock_fd = pc->cb_info->fd;
4638 int set_mode = (int)mode;
4640 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4641 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
4642 LOGD("ret : 0x%x", ret);
4647 int camera_attr_get_zoom(camera_h camera, int *zoom)
4649 if (camera == NULL || zoom == NULL) {
4650 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4651 return CAMERA_ERROR_INVALID_PARAMETER;
4653 int ret = CAMERA_ERROR_NONE;
4655 camera_cli_s *pc = (camera_cli_s *)camera;
4656 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ZOOM;
4659 if (pc->cb_info == NULL) {
4660 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4661 return CAMERA_ERROR_INVALID_PARAMETER;
4663 sock_fd = pc->cb_info->fd;
4665 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4666 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4668 if (ret == CAMERA_ERROR_NONE) {
4669 muse_camera_msg_get(get_zoom, pc->cb_info->recv_msg);
4672 LOGD("ret : 0x%x", ret);
4677 int camera_attr_get_zoom_range(camera_h camera, int *min, int *max)
4679 if (camera == NULL || min == NULL || max == NULL) {
4680 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4681 return CAMERA_ERROR_INVALID_PARAMETER;
4683 int ret = CAMERA_ERROR_NONE;
4684 camera_cli_s *pc = (camera_cli_s *)camera;
4686 if (pc->cb_info == NULL) {
4687 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4688 return CAMERA_ERROR_INVALID_PARAMETER;
4690 sock_fd = pc->cb_info->fd;
4691 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ZOOM_RANGE;
4695 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4696 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4698 if (ret == CAMERA_ERROR_NONE) {
4699 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
4700 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
4704 LOGD("ret : 0x%x", ret);
4709 int camera_attr_get_af_mode(camera_h camera, camera_attr_af_mode_e *mode)
4711 if (camera == NULL || mode == NULL) {
4712 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4713 return CAMERA_ERROR_INVALID_PARAMETER;
4715 int ret = CAMERA_ERROR_NONE;
4716 camera_cli_s *pc = (camera_cli_s *)camera;
4718 if (pc->cb_info == NULL) {
4719 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4720 return CAMERA_ERROR_INVALID_PARAMETER;
4722 sock_fd = pc->cb_info->fd;
4723 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_AF_MODE;
4726 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4727 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4729 if (ret == CAMERA_ERROR_NONE) {
4730 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
4731 *mode = (camera_attr_af_mode_e)get_mode;
4733 LOGD("ret : 0x%x", ret);
4738 int camera_attr_get_exposure_mode(camera_h camera, camera_attr_exposure_mode_e *mode)
4740 if (camera == NULL || mode == NULL) {
4741 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4742 return CAMERA_ERROR_INVALID_PARAMETER;
4744 int ret = CAMERA_ERROR_NONE;
4745 camera_cli_s *pc = (camera_cli_s *)camera;
4747 if (pc->cb_info == NULL) {
4748 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4749 return CAMERA_ERROR_INVALID_PARAMETER;
4751 sock_fd = pc->cb_info->fd;
4752 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE_MODE;
4755 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4756 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4758 if (ret == CAMERA_ERROR_NONE) {
4759 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
4760 *mode = (camera_attr_exposure_mode_e)get_mode;
4762 LOGD("ret : 0x%x", ret);
4766 int camera_attr_get_exposure(camera_h camera, int *value)
4768 if (camera == NULL || value == NULL) {
4769 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4770 return CAMERA_ERROR_INVALID_PARAMETER;
4772 int ret = CAMERA_ERROR_NONE;
4773 camera_cli_s *pc = (camera_cli_s *)camera;
4775 if (pc->cb_info == NULL) {
4776 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4777 return CAMERA_ERROR_INVALID_PARAMETER;
4779 sock_fd = pc->cb_info->fd;
4780 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE;
4783 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4784 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4786 if (ret == CAMERA_ERROR_NONE) {
4787 muse_camera_msg_get(get_value, pc->cb_info->recv_msg);
4790 LOGD("ret : 0x%x", ret);
4795 int camera_attr_get_exposure_range(camera_h camera, int *min, int *max)
4797 if (camera == NULL || min == NULL || max == NULL) {
4798 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4799 return CAMERA_ERROR_INVALID_PARAMETER;
4801 int ret = CAMERA_ERROR_NONE;
4802 camera_cli_s *pc = (camera_cli_s *)camera;
4804 if (pc->cb_info == NULL) {
4805 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4806 return CAMERA_ERROR_INVALID_PARAMETER;
4808 sock_fd = pc->cb_info->fd;
4809 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE_RANGE;
4813 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4814 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4816 if (ret == CAMERA_ERROR_NONE) {
4817 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
4818 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
4822 LOGD("ret : 0x%x", ret);
4827 int camera_attr_get_iso(camera_h camera, camera_attr_iso_e *iso)
4829 if (camera == NULL || iso == NULL) {
4830 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4831 return CAMERA_ERROR_INVALID_PARAMETER;
4833 int ret = CAMERA_ERROR_NONE;
4834 camera_cli_s *pc = (camera_cli_s *)camera;
4836 if (pc->cb_info == NULL) {
4837 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4838 return CAMERA_ERROR_INVALID_PARAMETER;
4840 sock_fd = pc->cb_info->fd;
4841 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ISO;
4844 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4845 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4847 if (ret == CAMERA_ERROR_NONE) {
4848 muse_camera_msg_get(get_iso, pc->cb_info->recv_msg);
4849 *iso = (camera_attr_iso_e)get_iso;
4851 LOGD("ret : 0x%x", ret);
4856 int camera_attr_get_brightness(camera_h camera, int *level)
4858 if (camera == NULL || level == NULL) {
4859 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4860 return CAMERA_ERROR_INVALID_PARAMETER;
4862 int ret = CAMERA_ERROR_NONE;
4863 camera_cli_s *pc = (camera_cli_s *)camera;
4865 if (pc->cb_info == NULL) {
4866 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4867 return CAMERA_ERROR_INVALID_PARAMETER;
4869 sock_fd = pc->cb_info->fd;
4870 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_BRIGHTNESS;
4873 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4874 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4876 if (ret == CAMERA_ERROR_NONE) {
4877 muse_camera_msg_get(get_level, pc->cb_info->recv_msg);
4880 LOGD("ret : 0x%x", ret);
4885 int camera_attr_get_brightness_range(camera_h camera, int *min, int *max)
4887 if (camera == NULL || min == NULL || max == NULL) {
4888 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4889 return CAMERA_ERROR_INVALID_PARAMETER;
4891 int ret = CAMERA_ERROR_NONE;
4892 camera_cli_s *pc = (camera_cli_s *)camera;
4894 if (pc->cb_info == NULL) {
4895 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4896 return CAMERA_ERROR_INVALID_PARAMETER;
4898 sock_fd = pc->cb_info->fd;
4899 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_BRIGHTNESS_RANGE;
4903 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4904 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4906 if (ret == CAMERA_ERROR_NONE) {
4907 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
4908 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
4912 LOGD("ret : 0x%x", ret);
4917 int camera_attr_get_contrast(camera_h camera, int *level)
4919 if (camera == NULL || level == NULL) {
4920 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4921 return CAMERA_ERROR_INVALID_PARAMETER;
4923 int ret = CAMERA_ERROR_NONE;
4924 camera_cli_s *pc = (camera_cli_s *)camera;
4925 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_CONTRAST;
4927 if (pc->cb_info == NULL) {
4928 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4929 return CAMERA_ERROR_INVALID_PARAMETER;
4931 sock_fd = pc->cb_info->fd;
4934 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4935 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4937 if (ret == CAMERA_ERROR_NONE) {
4938 muse_camera_msg_get(get_level, pc->cb_info->recv_msg);
4941 LOGD("ret : 0x%x", ret);
4946 int camera_attr_get_contrast_range(camera_h camera, int *min , int *max)
4948 if (camera == NULL || min == NULL || max == NULL) {
4949 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4950 return CAMERA_ERROR_INVALID_PARAMETER;
4952 int ret = CAMERA_ERROR_NONE;
4953 camera_cli_s *pc = (camera_cli_s *)camera;
4954 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_CONTRAST_RANGE;
4956 if (pc->cb_info == NULL) {
4957 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4958 return CAMERA_ERROR_INVALID_PARAMETER;
4960 sock_fd = pc->cb_info->fd;
4964 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4965 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4967 if (ret == CAMERA_ERROR_NONE) {
4968 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
4969 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
4973 LOGD("ret : 0x%x", ret);
4978 int camera_attr_get_whitebalance(camera_h camera, camera_attr_whitebalance_e *wb)
4980 if (camera == NULL || wb == NULL) {
4981 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4982 return CAMERA_ERROR_INVALID_PARAMETER;
4984 int ret = CAMERA_ERROR_NONE;
4985 camera_cli_s *pc = (camera_cli_s *)camera;
4986 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_WHITEBALANCE;
4988 if (pc->cb_info == NULL) {
4989 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4990 return CAMERA_ERROR_INVALID_PARAMETER;
4992 sock_fd = pc->cb_info->fd;
4995 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4996 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4998 if (ret == CAMERA_ERROR_NONE) {
4999 muse_camera_msg_get(get_wb, pc->cb_info->recv_msg);
5000 *wb = (camera_attr_whitebalance_e)get_wb;
5002 LOGD("ret : 0x%x", ret);
5007 int camera_attr_get_effect(camera_h camera, camera_attr_effect_mode_e *effect)
5009 if (camera == NULL || effect == NULL) {
5010 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5011 return CAMERA_ERROR_INVALID_PARAMETER;
5014 int ret = CAMERA_ERROR_NONE;
5015 camera_cli_s *pc = (camera_cli_s *)camera;
5016 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EFFECT;
5018 if (pc->cb_info == NULL) {
5019 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5020 return CAMERA_ERROR_INVALID_PARAMETER;
5022 sock_fd = pc->cb_info->fd;
5025 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5026 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5028 if (ret == CAMERA_ERROR_NONE) {
5029 muse_camera_msg_get(get_effect, pc->cb_info->recv_msg);
5030 *effect = (camera_attr_effect_mode_e)get_effect;
5032 LOGD("ret : 0x%x", ret);
5037 int camera_attr_get_scene_mode(camera_h camera, camera_attr_scene_mode_e *mode)
5039 if (camera == NULL || mode == NULL) {
5040 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5041 return CAMERA_ERROR_INVALID_PARAMETER;
5044 int ret = CAMERA_ERROR_NONE;
5045 camera_cli_s *pc = (camera_cli_s *)camera;
5046 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_SCENE_MODE;
5048 if (pc->cb_info == NULL) {
5049 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5050 return CAMERA_ERROR_INVALID_PARAMETER;
5052 sock_fd = pc->cb_info->fd;
5055 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5056 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5058 if (ret == CAMERA_ERROR_NONE) {
5059 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
5060 *mode = (camera_attr_scene_mode_e)get_mode;
5062 LOGD("ret : 0x%x", ret);
5067 int camera_attr_is_enabled_tag(camera_h camera, bool *enable)
5069 if (camera == NULL || enable == NULL) {
5070 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5071 return CAMERA_ERROR_INVALID_PARAMETER;
5074 int ret = CAMERA_ERROR_NONE;
5075 camera_cli_s *pc = (camera_cli_s *)camera;
5076 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_TAG;
5078 if (pc->cb_info == NULL) {
5079 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5080 return CAMERA_ERROR_INVALID_PARAMETER;
5082 sock_fd = pc->cb_info->fd;
5085 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5086 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5088 if (ret == CAMERA_ERROR_NONE) {
5089 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
5090 *enable = (bool)get_enabled;
5092 LOGD("ret : 0x%x", ret);
5097 int camera_attr_get_tag_image_description(camera_h camera, char **description)
5099 if (camera == NULL || description == NULL) {
5100 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5101 return CAMERA_ERROR_INVALID_PARAMETER;
5104 int ret = CAMERA_ERROR_NONE;
5105 camera_cli_s *pc = (camera_cli_s *)camera;
5106 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_IMAGE_DESCRIPTION;
5108 if (pc->cb_info == NULL) {
5109 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5110 return CAMERA_ERROR_INVALID_PARAMETER;
5112 sock_fd = pc->cb_info->fd;
5113 char get_description[MUSE_CAMERA_MSG_MAX_LENGTH] = {0,};
5115 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5116 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5118 if (ret == CAMERA_ERROR_NONE) {
5119 muse_camera_msg_get_string(get_description, pc->cb_info->recv_msg);
5120 *description = strdup(get_description);
5122 LOGD("ret : 0x%x", ret);
5127 int camera_attr_get_tag_orientation(camera_h camera, camera_attr_tag_orientation_e *orientation)
5129 if (camera == NULL || orientation == NULL) {
5130 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5131 return CAMERA_ERROR_INVALID_PARAMETER;
5134 int ret = CAMERA_ERROR_NONE;
5135 camera_cli_s *pc = (camera_cli_s *)camera;
5136 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_ORIENTATION;
5138 if (pc->cb_info == NULL) {
5139 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5140 return CAMERA_ERROR_INVALID_PARAMETER;
5142 sock_fd = pc->cb_info->fd;
5143 int get_orientation;
5145 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5146 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5148 if (ret == CAMERA_ERROR_NONE) {
5149 muse_camera_msg_get(get_orientation, pc->cb_info->recv_msg);
5150 *orientation = (camera_attr_tag_orientation_e)get_orientation;
5151 LOGD("success, orientation : %d", *orientation);
5153 LOGD("ret : 0x%x", ret);
5158 int camera_attr_get_tag_software(camera_h camera, char **software)
5160 if (camera == NULL || software == NULL) {
5161 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5162 return CAMERA_ERROR_INVALID_PARAMETER;
5165 int ret = CAMERA_ERROR_NONE;
5166 camera_cli_s *pc = (camera_cli_s *)camera;
5167 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_SOFTWARE;
5169 if (pc->cb_info == NULL) {
5170 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5171 return CAMERA_ERROR_INVALID_PARAMETER;
5173 sock_fd = pc->cb_info->fd;
5174 char get_software[MUSE_CAMERA_MSG_MAX_LENGTH] = {0,};
5176 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5177 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5179 if (ret == CAMERA_ERROR_NONE) {
5180 muse_camera_msg_get_string(get_software, pc->cb_info->recv_msg);
5181 *software = strdup(get_software);
5183 LOGD("ret : 0x%x", ret);
5188 int camera_attr_get_geotag(camera_h camera, double *latitude , double *longitude, double *altitude)
5190 if (camera == NULL || latitude == NULL || longitude == NULL || altitude == NULL) {
5191 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5192 return CAMERA_ERROR_INVALID_PARAMETER;
5195 int ret = CAMERA_ERROR_NONE;
5196 camera_cli_s *pc = (camera_cli_s *)camera;
5197 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_GEOTAG;
5198 double get_geotag[3] = {0,};
5200 if (pc->cb_info == NULL) {
5201 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5202 return CAMERA_ERROR_INVALID_PARAMETER;
5204 sock_fd = pc->cb_info->fd;
5206 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5208 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5210 if (ret == CAMERA_ERROR_NONE) {
5211 muse_camera_msg_get_array(get_geotag, pc->cb_info->recv_msg);
5212 *latitude = get_geotag[0];
5213 *longitude = get_geotag[1];
5214 *altitude = get_geotag[2];
5216 LOGD("ret : 0x%x", ret);
5218 LOGE("Returned value is not valid : 0x%x", ret);
5225 int camera_attr_get_flash_mode(camera_h camera, camera_attr_flash_mode_e *mode)
5227 if (camera == NULL || mode == NULL) {
5228 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5229 return CAMERA_ERROR_INVALID_PARAMETER;
5232 int ret = CAMERA_ERROR_NONE;
5233 camera_cli_s *pc = (camera_cli_s *)camera;
5234 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_FLASH_MODE;
5236 if (pc->cb_info == NULL) {
5237 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5238 return CAMERA_ERROR_INVALID_PARAMETER;
5240 sock_fd = pc->cb_info->fd;
5243 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5244 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5246 if (ret == CAMERA_ERROR_NONE) {
5247 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
5248 *mode = (camera_attr_flash_mode_e)get_mode;
5250 LOGD("ret : 0x%x", ret);
5255 int camera_get_flash_state(camera_device_e device, camera_flash_state_e *state)
5259 int ret = CAMERA_ERROR_NONE;
5260 camera_cli_s *pc = NULL;
5261 int get_flash_state = 0;
5263 /* create muse connection */
5264 muse_camera_api_e api = MUSE_CAMERA_API_GET_FLASH_STATE;
5265 muse_core_api_module_e muse_module = MUSE_CAMERA;
5266 int device_type = (int)device;
5268 if (state == NULL) {
5269 LOGE("invalid pointer for state");
5270 return CAMERA_ERROR_INVALID_PARAMETER;
5273 sock_fd = muse_core_client_new();
5275 LOGE("muse_core_client_new failed - returned fd %d", sock_fd);
5276 ret = CAMERA_ERROR_INVALID_OPERATION;
5280 sndMsg = muse_core_msg_json_factory_new(api,
5281 MUSE_TYPE_INT, "module", muse_module,
5282 MUSE_TYPE_INT, PARAM_DEVICE_TYPE, device_type,
5285 muse_core_ipc_send_msg(sock_fd, sndMsg);
5286 muse_core_msg_json_factory_free(sndMsg);
5288 pc = g_new0(camera_cli_s, 1);
5290 LOGE("camera_cli_s alloc failed");
5291 ret = CAMERA_ERROR_OUT_OF_MEMORY;
5295 pc->cb_info = _client_callback_new(sock_fd);
5296 if (pc->cb_info == NULL) {
5297 LOGE("cb_info alloc failed");
5298 ret = CAMERA_ERROR_OUT_OF_MEMORY;
5302 ret = _client_wait_for_cb_return(api, pc->cb_info, CALLBACK_TIME_OUT);
5304 if (ret == CAMERA_ERROR_NONE) {
5305 muse_camera_msg_get(get_flash_state, pc->cb_info->recv_msg);
5306 *state = (camera_flash_state_e)get_flash_state;
5309 LOGD("Flash state : %d\n", *state);
5312 /* release resources */
5314 g_atomic_int_set(&pc->cb_info->msg_recv_running, 0);
5315 g_atomic_int_set(&pc->cb_info->msg_handler_running, 0);
5316 _client_callback_destroy(pc->cb_info);
5326 int camera_attr_foreach_supported_af_mode(camera_h camera, camera_attr_supported_af_mode_cb foreach_cb, void *user_data)
5328 if (camera == NULL || foreach_cb == NULL) {
5329 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5330 return CAMERA_ERROR_INVALID_PARAMETER;
5332 int ret = CAMERA_ERROR_NONE;
5334 camera_cli_s *pc = (camera_cli_s *)camera;
5335 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_AF_MODE;
5337 LOGD("Enter, handle :%x", pc->remote_handle);
5340 if (pc->cb_info == NULL) {
5341 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5342 return CAMERA_ERROR_INVALID_PARAMETER;
5344 sock_fd = pc->cb_info->fd;
5345 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_AF_MODE] = foreach_cb;
5346 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_AF_MODE] = user_data;
5348 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5349 LOGD("ret : 0x%x", ret);
5354 int camera_attr_foreach_supported_exposure_mode(camera_h camera, camera_attr_supported_exposure_mode_cb foreach_cb , void *user_data)
5356 if (camera == NULL || foreach_cb == NULL) {
5357 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5358 return CAMERA_ERROR_INVALID_PARAMETER;
5360 int ret = CAMERA_ERROR_NONE;
5362 camera_cli_s *pc = (camera_cli_s *)camera;
5363 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_EXPOSURE_MODE;
5365 LOGD("Enter, handle :%x", pc->remote_handle);
5368 if (pc->cb_info == NULL) {
5369 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5370 return CAMERA_ERROR_INVALID_PARAMETER;
5372 sock_fd = pc->cb_info->fd;
5373 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EXPOSURE_MODE] = foreach_cb;
5374 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EXPOSURE_MODE] = user_data;
5376 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5377 LOGD("ret : 0x%x", ret);
5382 int camera_attr_foreach_supported_iso(camera_h camera, camera_attr_supported_iso_cb foreach_cb, void *user_data)
5384 if (camera == NULL || foreach_cb == NULL) {
5385 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5386 return CAMERA_ERROR_INVALID_PARAMETER;
5388 int ret = CAMERA_ERROR_NONE;
5390 camera_cli_s *pc = (camera_cli_s *)camera;
5391 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_ISO;
5393 LOGD("Enter, handle :%x", pc->remote_handle);
5396 if (pc->cb_info == NULL) {
5397 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5398 return CAMERA_ERROR_INVALID_PARAMETER;
5400 sock_fd = pc->cb_info->fd;
5401 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_ISO] = foreach_cb;
5402 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_ISO] = user_data;
5404 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5405 LOGD("ret : 0x%x", ret);
5410 int camera_attr_foreach_supported_whitebalance(camera_h camera, camera_attr_supported_whitebalance_cb foreach_cb , void *user_data)
5412 if (camera == NULL || foreach_cb == NULL) {
5413 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5414 return CAMERA_ERROR_INVALID_PARAMETER;
5416 int ret = CAMERA_ERROR_NONE;
5418 camera_cli_s *pc = (camera_cli_s *)camera;
5419 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_WHITEBALANCE;
5421 LOGD("Enter, handle :%x", pc->remote_handle);
5424 if (pc->cb_info == NULL) {
5425 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5426 return CAMERA_ERROR_INVALID_PARAMETER;
5428 sock_fd = pc->cb_info->fd;
5429 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_WHITEBALANCE] = foreach_cb;
5430 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_WHITEBALANCE] = user_data;
5432 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5433 LOGD("ret : 0x%x", ret);
5438 int camera_attr_foreach_supported_effect(camera_h camera, camera_attr_supported_effect_cb foreach_cb , void *user_data)
5440 if (camera == NULL || foreach_cb == NULL) {
5441 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5442 return CAMERA_ERROR_INVALID_PARAMETER;
5444 int ret = CAMERA_ERROR_NONE;
5446 camera_cli_s *pc = (camera_cli_s *)camera;
5447 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_EFFECT;
5449 LOGD("Enter, handle :%x", pc->remote_handle);
5452 if (pc->cb_info == NULL) {
5453 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5454 return CAMERA_ERROR_INVALID_PARAMETER;
5456 sock_fd = pc->cb_info->fd;
5457 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EFFECT] = foreach_cb;
5458 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EFFECT] = user_data;
5460 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5461 LOGD("ret : 0x%x", ret);
5466 int camera_attr_foreach_supported_scene_mode(camera_h camera, camera_attr_supported_scene_mode_cb foreach_cb , void *user_data)
5468 if (camera == NULL || foreach_cb == NULL) {
5469 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5470 return CAMERA_ERROR_INVALID_PARAMETER;
5472 int ret = CAMERA_ERROR_NONE;
5474 camera_cli_s *pc = (camera_cli_s *)camera;
5475 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_SCENE_MODE;
5477 LOGD("Enter, handle :%x", pc->remote_handle);
5480 if (pc->cb_info == NULL) {
5481 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5482 return CAMERA_ERROR_INVALID_PARAMETER;
5484 sock_fd = pc->cb_info->fd;
5485 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_SCENE_MODE] = foreach_cb;
5486 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_SCENE_MODE] = user_data;
5488 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5489 LOGD("ret : 0x%x", ret);
5494 int camera_attr_foreach_supported_flash_mode(camera_h camera, camera_attr_supported_flash_mode_cb foreach_cb , void *user_data)
5496 if (camera == NULL || foreach_cb == NULL) {
5497 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5498 return CAMERA_ERROR_INVALID_PARAMETER;
5500 int ret = CAMERA_ERROR_NONE;
5502 camera_cli_s *pc = (camera_cli_s *)camera;
5503 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FLASH_MODE;
5505 LOGD("Enter, handle :%x", pc->remote_handle);
5508 if (pc->cb_info == NULL) {
5509 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5510 return CAMERA_ERROR_INVALID_PARAMETER;
5512 sock_fd = pc->cb_info->fd;
5513 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FLASH_MODE] = foreach_cb;
5514 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FLASH_MODE] = user_data;
5516 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5517 LOGD("ret : 0x%x", ret);
5522 int camera_attr_foreach_supported_fps(camera_h camera, camera_attr_supported_fps_cb foreach_cb , void *user_data)
5524 if (camera == NULL || foreach_cb == NULL) {
5525 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5526 return CAMERA_ERROR_INVALID_PARAMETER;
5528 int ret = CAMERA_ERROR_NONE;
5530 camera_cli_s *pc = (camera_cli_s *)camera;
5531 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FPS;
5533 if (pc->cb_info == NULL) {
5534 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5535 return CAMERA_ERROR_INVALID_PARAMETER;
5537 sock_fd = pc->cb_info->fd;
5538 LOGD("Enter, handle :%x", pc->remote_handle);
5539 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS] = foreach_cb;
5540 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS] = user_data;
5542 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5543 LOGD("Enter, handle :%x", pc->remote_handle);
5547 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)
5549 if (camera == NULL || foreach_cb == NULL) {
5550 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5551 return CAMERA_ERROR_INVALID_PARAMETER;
5553 int ret = CAMERA_ERROR_NONE;
5555 camera_cli_s *pc = (camera_cli_s *)camera;
5556 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FPS_BY_RESOLUTION;
5558 if (pc->cb_info == NULL) {
5559 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5560 return CAMERA_ERROR_INVALID_PARAMETER;
5562 sock_fd = pc->cb_info->fd;
5563 LOGD("Enter, handle :%x", pc->remote_handle);
5564 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS_BY_RESOLUTION] = foreach_cb;
5565 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS_BY_RESOLUTION] = user_data;
5567 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, width, INT, height);
5568 LOGD("ret : 0x%x", ret);
5572 int camera_attr_foreach_supported_stream_flip(camera_h camera, camera_attr_supported_stream_flip_cb foreach_cb, void *user_data)
5574 if (camera == NULL || foreach_cb == NULL) {
5575 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5576 return CAMERA_ERROR_INVALID_PARAMETER;
5578 int ret = CAMERA_ERROR_NONE;
5580 camera_cli_s *pc = (camera_cli_s *)camera;
5581 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_STREAM_FLIP;
5583 if (pc->cb_info == NULL) {
5584 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5585 return CAMERA_ERROR_INVALID_PARAMETER;
5587 sock_fd = pc->cb_info->fd;
5588 LOGD("Enter, handle :%x", pc->remote_handle);
5589 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_FLIP] = foreach_cb;
5590 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_FLIP] = user_data;
5592 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5593 LOGD("ret : 0x%x", ret);
5598 int camera_attr_foreach_supported_stream_rotation(camera_h camera, camera_attr_supported_stream_rotation_cb foreach_cb, void *user_data)
5600 if (camera == NULL || foreach_cb == NULL) {
5601 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5602 return CAMERA_ERROR_INVALID_PARAMETER;
5604 int ret = CAMERA_ERROR_NONE;
5606 camera_cli_s *pc = (camera_cli_s *)camera;
5607 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_STREAM_ROTATION;
5609 if (pc->cb_info == NULL) {
5610 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5611 return CAMERA_ERROR_INVALID_PARAMETER;
5613 sock_fd = pc->cb_info->fd;
5614 LOGD("Enter, handle :%x", pc->remote_handle);
5615 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION] = foreach_cb;
5616 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION] = user_data;
5618 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5619 LOGD("ret : 0x%x", ret);
5624 int camera_attr_set_stream_rotation(camera_h camera , camera_rotation_e rotation)
5626 if (camera == NULL) {
5627 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5628 return CAMERA_ERROR_INVALID_PARAMETER;
5631 int ret = CAMERA_ERROR_NONE;
5632 camera_cli_s *pc = (camera_cli_s *)camera;
5633 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_STREAM_ROTATION;
5635 if (pc->cb_info == NULL) {
5636 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5637 return CAMERA_ERROR_INVALID_PARAMETER;
5639 sock_fd = pc->cb_info->fd;
5640 int set_rotation = (int)rotation;
5642 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5643 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_rotation);
5644 LOGD("ret : 0x%x", ret);
5649 int camera_attr_get_stream_rotation(camera_h camera , camera_rotation_e *rotation)
5651 if (camera == NULL || rotation == NULL) {
5652 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5653 return CAMERA_ERROR_INVALID_PARAMETER;
5656 int ret = CAMERA_ERROR_NONE;
5657 camera_cli_s *pc = (camera_cli_s *)camera;
5658 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_STREAM_ROTATION;
5660 if (pc->cb_info == NULL) {
5661 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5662 return CAMERA_ERROR_INVALID_PARAMETER;
5664 sock_fd = pc->cb_info->fd;
5667 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5668 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5670 if (ret == CAMERA_ERROR_NONE) {
5671 muse_camera_msg_get(get_rotation, pc->cb_info->recv_msg);
5672 *rotation = (camera_rotation_e)get_rotation;
5674 LOGD("ret : 0x%x", ret);
5679 int camera_attr_set_stream_flip(camera_h camera , camera_flip_e flip)
5681 if (camera == NULL) {
5682 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5683 return CAMERA_ERROR_INVALID_PARAMETER;
5686 int ret = CAMERA_ERROR_NONE;
5687 camera_cli_s *pc = (camera_cli_s *)camera;
5688 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_STREAM_FLIP;
5690 if (pc->cb_info == NULL) {
5691 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5692 return CAMERA_ERROR_INVALID_PARAMETER;
5694 sock_fd = pc->cb_info->fd;
5695 int set_flip = (int)flip;
5697 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5698 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_flip);
5699 LOGD("ret : 0x%x", ret);
5704 int camera_attr_get_stream_flip(camera_h camera , camera_flip_e *flip)
5706 if (camera == NULL || flip == NULL) {
5707 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5708 return CAMERA_ERROR_INVALID_PARAMETER;
5711 int ret = CAMERA_ERROR_NONE;
5712 camera_cli_s *pc = (camera_cli_s *)camera;
5713 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_STREAM_FLIP;
5715 if (pc->cb_info == NULL) {
5716 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5717 return CAMERA_ERROR_INVALID_PARAMETER;
5719 sock_fd = pc->cb_info->fd;
5722 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5723 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5725 if (ret == CAMERA_ERROR_NONE) {
5726 muse_camera_msg_get(get_flip, pc->cb_info->recv_msg);
5727 *flip = (camera_flip_e)get_flip;
5729 LOGD("ret : 0x%x", ret);
5733 int camera_attr_set_hdr_mode(camera_h camera, camera_attr_hdr_mode_e mode)
5735 if (camera == NULL) {
5736 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5737 return CAMERA_ERROR_INVALID_PARAMETER;
5740 int ret = CAMERA_ERROR_NONE;
5741 camera_cli_s *pc = (camera_cli_s *)camera;
5742 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_HDR_MODE;
5744 if (pc->cb_info == NULL) {
5745 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5746 return CAMERA_ERROR_INVALID_PARAMETER;
5748 sock_fd = pc->cb_info->fd;
5749 int set_mode = (int)mode;
5751 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5752 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
5753 LOGD("ret : 0x%x", ret);
5758 int camera_attr_get_hdr_mode(camera_h camera, camera_attr_hdr_mode_e *mode)
5760 if (camera == NULL) {
5761 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5762 return CAMERA_ERROR_INVALID_PARAMETER;
5765 LOGE("INVALID_PARAMETER(0x%08x) - mode", CAMERA_ERROR_INVALID_PARAMETER);
5766 return CAMERA_ERROR_INVALID_PARAMETER;
5768 int ret = CAMERA_ERROR_NONE;
5769 camera_cli_s *pc = (camera_cli_s *)camera;
5770 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_HDR_MODE;
5772 if (pc->cb_info == NULL) {
5773 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5774 return CAMERA_ERROR_INVALID_PARAMETER;
5776 sock_fd = pc->cb_info->fd;
5779 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5780 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5782 if (ret == CAMERA_ERROR_NONE) {
5783 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
5784 *mode = (camera_attr_hdr_mode_e)get_mode;
5786 LOGD("ret : 0x%x", ret);
5791 bool camera_attr_is_supported_hdr_capture(camera_h camera)
5793 if (camera == NULL) {
5794 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5798 int ret = CAMERA_ERROR_NONE;
5799 camera_cli_s *pc = (camera_cli_s *)camera;
5800 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_HDR_CAPTURE;
5802 if (pc->cb_info == NULL) {
5803 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5804 return CAMERA_ERROR_INVALID_PARAMETER;
5806 sock_fd = pc->cb_info->fd;
5807 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5808 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5809 LOGD("ret : 0x%x", ret);
5814 int camera_attr_set_hdr_capture_progress_cb(camera_h camera, camera_attr_hdr_progress_cb callback, void *user_data)
5816 int ret = CAMERA_ERROR_NONE;
5817 camera_cli_s *pc = (camera_cli_s *)camera;
5818 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_HDR_CAPTURE_PROGRESS_CB;
5821 if (camera == NULL) {
5822 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5823 return CAMERA_ERROR_INVALID_PARAMETER;
5826 if (pc->cb_info == NULL) {
5827 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5828 return CAMERA_ERROR_INVALID_PARAMETER;
5831 sock_fd = pc->cb_info->fd;
5833 LOGD("Enter, handle :%x", pc->remote_handle);
5835 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5837 if (ret == CAMERA_ERROR_NONE) {
5838 if (callback == NULL) {
5839 LOGE("INVALID_PARAMETER(0x%08x) - callback", CAMERA_ERROR_INVALID_PARAMETER);
5840 return CAMERA_ERROR_INVALID_PARAMETER;
5843 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = callback;
5844 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = user_data;
5847 LOGD("ret : 0x%x", ret);
5853 int camera_attr_unset_hdr_capture_progress_cb(camera_h camera)
5855 if (camera == NULL) {
5856 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5857 return CAMERA_ERROR_INVALID_PARAMETER;
5860 int ret = CAMERA_ERROR_NONE;
5862 camera_cli_s *pc = (camera_cli_s *)camera;
5863 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_UNSET_HDR_CAPTURE_PROGRESS_CB;
5865 if (pc->cb_info == NULL) {
5866 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5867 return CAMERA_ERROR_INVALID_PARAMETER;
5869 sock_fd = pc->cb_info->fd;
5870 LOGD("Enter, handle :%x", pc->remote_handle);
5872 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = (void *)NULL;
5873 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = (void *)NULL;
5875 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5876 LOGD("ret : 0x%x", ret);
5881 int camera_attr_enable_anti_shake(camera_h camera, bool enable)
5883 if (camera == NULL) {
5884 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5885 return CAMERA_ERROR_INVALID_PARAMETER;
5888 int ret = CAMERA_ERROR_NONE;
5889 camera_cli_s *pc = (camera_cli_s *)camera;
5890 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_ANTI_SHAKE;
5892 if (pc->cb_info == NULL) {
5893 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5894 return CAMERA_ERROR_INVALID_PARAMETER;
5896 sock_fd = pc->cb_info->fd;
5897 int set_enable = (int)enable;
5899 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5900 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
5901 LOGD("ret : 0x%x", ret);
5906 int camera_attr_is_enabled_anti_shake(camera_h camera , bool *enabled)
5908 if (camera == NULL) {
5909 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5910 return CAMERA_ERROR_INVALID_PARAMETER;
5912 if (enabled == NULL) {
5913 LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER);
5914 return CAMERA_ERROR_INVALID_PARAMETER;
5916 int ret = CAMERA_ERROR_NONE;
5917 camera_cli_s *pc = (camera_cli_s *)camera;
5918 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_ANTI_SHAKE;
5920 if (pc->cb_info == NULL) {
5921 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5922 return CAMERA_ERROR_INVALID_PARAMETER;
5924 sock_fd = pc->cb_info->fd;
5927 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5928 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5930 if (ret == CAMERA_ERROR_NONE) {
5931 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
5932 *enabled = (bool)get_enabled;
5934 LOGD("ret : 0x%x", ret);
5939 bool camera_attr_is_supported_anti_shake(camera_h camera)
5942 if (camera == NULL) {
5943 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5947 int ret = CAMERA_ERROR_NONE;
5948 camera_cli_s *pc = (camera_cli_s *)camera;
5949 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_ANTI_SHAKE;
5951 if (pc->cb_info == NULL) {
5952 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5953 return CAMERA_ERROR_INVALID_PARAMETER;
5955 sock_fd = pc->cb_info->fd;
5956 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5957 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5958 LOGD("ret : 0x%x", ret);
5963 int camera_attr_enable_video_stabilization(camera_h camera, bool enable)
5965 if (camera == NULL) {
5966 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5967 return CAMERA_ERROR_INVALID_PARAMETER;
5970 int ret = CAMERA_ERROR_NONE;
5971 camera_cli_s *pc = (camera_cli_s *)camera;
5972 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_VIDEO_STABILIZATION;
5974 if (pc->cb_info == NULL) {
5975 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5976 return CAMERA_ERROR_INVALID_PARAMETER;
5978 sock_fd = pc->cb_info->fd;
5979 int set_enable = (int)enable;
5981 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5982 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
5983 LOGD("ret : 0x%x", ret);
5988 int camera_attr_is_enabled_video_stabilization(camera_h camera, bool *enabled)
5990 if (camera == NULL) {
5991 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5992 return CAMERA_ERROR_INVALID_PARAMETER;
5994 if (enabled == NULL) {
5995 LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER);
5996 return CAMERA_ERROR_INVALID_PARAMETER;
5998 int ret = CAMERA_ERROR_NONE;
5999 camera_cli_s *pc = (camera_cli_s *)camera;
6000 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_VIDEO_STABILIZATION;
6002 if (pc->cb_info == NULL) {
6003 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6004 return CAMERA_ERROR_INVALID_PARAMETER;
6006 sock_fd = pc->cb_info->fd;
6009 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6010 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6012 if (ret == CAMERA_ERROR_NONE) {
6013 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
6014 *enabled = (bool)get_enabled;
6016 LOGD("ret : 0x%x", ret);
6021 bool camera_attr_is_supported_video_stabilization(camera_h camera)
6023 if (camera == NULL) {
6024 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6028 int ret = CAMERA_ERROR_NONE;
6029 camera_cli_s *pc = (camera_cli_s *)camera;
6030 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_VIDEO_STABILIZATION;
6032 if (pc->cb_info == NULL) {
6033 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6034 return CAMERA_ERROR_INVALID_PARAMETER;
6036 sock_fd = pc->cb_info->fd;
6037 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6038 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6039 LOGD("ret : 0x%x", ret);
6044 int camera_attr_enable_auto_contrast(camera_h camera, bool enable)
6046 if (camera == NULL) {
6047 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6048 return CAMERA_ERROR_INVALID_PARAMETER;
6051 int ret = CAMERA_ERROR_NONE;
6052 camera_cli_s *pc = (camera_cli_s *)camera;
6053 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_AUTO_CONTRAST;
6055 if (pc->cb_info == NULL) {
6056 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6057 return CAMERA_ERROR_INVALID_PARAMETER;
6059 sock_fd = pc->cb_info->fd;
6060 int set_enable = (int)enable;
6062 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6063 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
6064 LOGD("ret : 0x%x", ret);
6069 int camera_attr_is_enabled_auto_contrast(camera_h camera, bool *enabled)
6071 if (camera == NULL) {
6072 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
6073 return CAMERA_ERROR_INVALID_PARAMETER;
6075 if (enabled == NULL) {
6076 LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER);
6077 return CAMERA_ERROR_INVALID_PARAMETER;
6079 int ret = CAMERA_ERROR_NONE;
6080 camera_cli_s *pc = (camera_cli_s *)camera;
6081 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_AUTO_CONTRAST;
6083 if (pc->cb_info == NULL) {
6084 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6085 return CAMERA_ERROR_INVALID_PARAMETER;
6087 sock_fd = pc->cb_info->fd;
6090 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6091 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6093 if (ret == CAMERA_ERROR_NONE) {
6094 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
6095 *enabled = (bool)get_enabled;
6097 LOGD("ret : 0x%x", ret);
6102 bool camera_attr_is_supported_auto_contrast(camera_h camera)
6104 if (camera == NULL) {
6105 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6109 int ret = CAMERA_ERROR_NONE;
6110 camera_cli_s *pc = (camera_cli_s *)camera;
6111 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_AUTO_CONTRAST;
6113 if (pc->cb_info == NULL) {
6114 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6115 return CAMERA_ERROR_INVALID_PARAMETER;
6117 sock_fd = pc->cb_info->fd;
6118 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6119 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6120 LOGD("ret : 0x%x", ret);
6125 int camera_attr_disable_shutter_sound(camera_h camera, bool disable)
6127 if (camera == NULL) {
6128 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6129 return CAMERA_ERROR_INVALID_PARAMETER;
6132 int ret = CAMERA_ERROR_NONE;
6133 camera_cli_s *pc = (camera_cli_s *)camera;
6134 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_DISABLE_SHUTTER_SOUND;
6136 if (pc->cb_info == NULL) {
6137 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6138 return CAMERA_ERROR_INVALID_PARAMETER;
6140 sock_fd = pc->cb_info->fd;
6141 int set_disable = (int)disable;
6143 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6144 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_disable);
6145 LOGD("ret : 0x%x", ret);
6150 int camera_attr_set_pan(camera_h camera, camera_attr_ptz_move_type_e move_type, int pan_step)
6152 if (camera == NULL) {
6153 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6154 return CAMERA_ERROR_INVALID_PARAMETER;
6157 camera_cli_s *pc = (camera_cli_s *)camera;
6158 if (pc->cb_info == NULL) {
6159 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6160 return CAMERA_ERROR_INVALID_PARAMETER;
6163 int ret = CAMERA_ERROR_NONE;
6164 int sock_fd = pc->cb_info->fd;
6165 int set_move_type = (int)move_type;
6166 int set_pan_step = pan_step;
6167 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_PAN;
6169 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6170 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, set_move_type, INT, set_pan_step);
6171 LOGD("ret : 0x%x", ret);
6176 int camera_attr_get_pan(camera_h camera, int *pan_step)
6178 if (camera == NULL || pan_step == NULL) {
6179 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6180 return CAMERA_ERROR_INVALID_PARAMETER;
6183 camera_cli_s *pc = (camera_cli_s *)camera;
6184 if (pc->cb_info == NULL) {
6185 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6186 return CAMERA_ERROR_INVALID_PARAMETER;
6189 int ret = CAMERA_ERROR_NONE;
6190 int sock_fd = pc->cb_info->fd;
6192 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_PAN;
6194 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6195 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6197 if (ret == CAMERA_ERROR_NONE) {
6198 muse_camera_msg_get(get_pan_step, pc->cb_info->recv_msg);
6199 *pan_step = get_pan_step;
6201 LOGD("ret : 0x%x", ret);
6206 int camera_attr_get_pan_range(camera_h camera, int *min, int *max)
6208 if (camera == NULL || min == NULL || max == NULL) {
6209 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6210 return CAMERA_ERROR_INVALID_PARAMETER;
6213 camera_cli_s *pc = (camera_cli_s *)camera;
6214 if (pc->cb_info == NULL) {
6215 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6216 return CAMERA_ERROR_INVALID_PARAMETER;
6219 int ret = CAMERA_ERROR_NONE;
6220 int sock_fd = pc->cb_info->fd;
6223 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_PAN_RANGE;
6225 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6226 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6228 if (ret == CAMERA_ERROR_NONE) {
6229 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
6230 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
6234 LOGD("ret : 0x%x", ret);
6239 int camera_attr_set_tilt(camera_h camera, camera_attr_ptz_move_type_e move_type, int tilt_step)
6241 if (camera == NULL) {
6242 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6243 return CAMERA_ERROR_INVALID_PARAMETER;
6246 camera_cli_s *pc = (camera_cli_s *)camera;
6247 if (pc->cb_info == NULL) {
6248 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6249 return CAMERA_ERROR_INVALID_PARAMETER;
6252 int ret = CAMERA_ERROR_NONE;
6253 int sock_fd = pc->cb_info->fd;
6254 int set_move_type = (int)move_type;
6255 int set_tilt_step = tilt_step;
6256 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TILT;
6258 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6259 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, set_move_type, INT, set_tilt_step);
6260 LOGD("ret : 0x%x", ret);
6265 int camera_attr_get_tilt(camera_h camera, int *tilt_step)
6267 if (camera == NULL || tilt_step == NULL) {
6268 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6269 return CAMERA_ERROR_INVALID_PARAMETER;
6272 camera_cli_s *pc = (camera_cli_s *)camera;
6273 if (pc->cb_info == NULL) {
6274 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6275 return CAMERA_ERROR_INVALID_PARAMETER;
6278 int ret = CAMERA_ERROR_NONE;
6279 int sock_fd = pc->cb_info->fd;
6281 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TILT;
6283 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6284 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6286 if (ret == CAMERA_ERROR_NONE) {
6287 muse_camera_msg_get(get_tilt_step, pc->cb_info->recv_msg);
6288 *tilt_step = get_tilt_step;
6290 LOGD("ret : 0x%x", ret);
6295 int camera_attr_get_tilt_range(camera_h camera, int *min, int *max)
6297 if (camera == NULL || min == NULL || max == NULL) {
6298 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6299 return CAMERA_ERROR_INVALID_PARAMETER;
6302 camera_cli_s *pc = (camera_cli_s *)camera;
6303 if (pc->cb_info == NULL) {
6304 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6305 return CAMERA_ERROR_INVALID_PARAMETER;
6308 int ret = CAMERA_ERROR_NONE;
6309 int sock_fd = pc->cb_info->fd;
6312 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TILT_RANGE;
6314 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6315 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6317 if (ret == CAMERA_ERROR_NONE) {
6318 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
6319 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
6323 LOGD("ret : 0x%x", ret);
6328 int camera_attr_set_ptz_type(camera_h camera, camera_attr_ptz_type_e ptz_type)
6330 if (camera == NULL) {
6331 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6332 return CAMERA_ERROR_INVALID_PARAMETER;
6335 camera_cli_s *pc = (camera_cli_s *)camera;
6336 if (pc->cb_info == NULL) {
6337 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6338 return CAMERA_ERROR_INVALID_PARAMETER;
6341 int ret = CAMERA_ERROR_NONE;
6342 int sock_fd = pc->cb_info->fd;
6343 int set_ptz_type = (int)ptz_type;
6344 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_PTZ_TYPE;
6346 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6347 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_ptz_type);
6348 LOGD("ret : 0x%x", ret);
6353 int camera_attr_foreach_supported_ptz_type(camera_h camera, camera_attr_supported_ptz_type_cb foreach_cb, void *user_data)
6355 if (camera == NULL || foreach_cb == NULL) {
6356 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6357 return CAMERA_ERROR_INVALID_PARAMETER;
6359 int ret = CAMERA_ERROR_NONE;
6361 camera_cli_s *pc = (camera_cli_s *)camera;
6362 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_PTZ_TYPE;
6364 if (pc->cb_info == NULL) {
6365 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6366 return CAMERA_ERROR_INVALID_PARAMETER;
6368 sock_fd = pc->cb_info->fd;
6369 LOGD("Enter, handle :%x", pc->remote_handle);
6370 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PTZ_TYPE] = foreach_cb;
6371 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PTZ_TYPE] = user_data;
6373 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6374 LOGD("ret : 0x%x", ret);
6379 int camera_attr_set_display_roi_area(camera_h camera, int x, int y, int width, int height)
6381 if (camera == NULL) {
6382 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6383 return CAMERA_ERROR_INVALID_PARAMETER;
6386 camera_cli_s *pc = (camera_cli_s *)camera;
6387 if (pc->cb_info == NULL) {
6388 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6389 return CAMERA_ERROR_INVALID_PARAMETER;
6392 int ret = CAMERA_ERROR_NONE;
6393 int sock_fd = pc->cb_info->fd;
6394 int set_display_roi_area[4] = {x, y, width, height};
6395 muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY_ROI_AREA;
6397 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6399 #ifdef EVAS_RENDERER_SUPPORT
6400 if(CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
6401 g_mutex_lock(&pc->cb_info->evas_mutex);
6403 ret = mm_evas_renderer_set_roi_area(pc->cb_info->evas_info, x, y, width, height);
6405 g_mutex_unlock(&pc->cb_info->evas_mutex);
6407 if (ret != MM_ERROR_NONE) {
6408 LOGE("mm_evas_renderer_set_roi_area error 0x%x", ret);
6409 return CAMERA_ERROR_INVALID_OPERATION;
6412 #endif /* EVAS_RENDERER_SUPPORT */
6414 muse_camera_msg_send_array(api, sock_fd, pc->cb_info, ret,
6415 set_display_roi_area, sizeof(set_display_roi_area), sizeof(int));
6417 LOGD("ret : 0x%x", ret);
6423 int camera_attr_get_display_roi_area(camera_h camera, int *x, int *y, int *width, int *height)
6425 if (camera == NULL || x == NULL || y == NULL || width == NULL || height == NULL) {
6426 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6427 return CAMERA_ERROR_INVALID_PARAMETER;
6430 camera_cli_s *pc = (camera_cli_s *)camera;
6431 if (pc->cb_info == NULL) {
6432 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6433 return CAMERA_ERROR_INVALID_PARAMETER;
6436 int ret = CAMERA_ERROR_NONE;
6437 int sock_fd = pc->cb_info->fd;
6438 int get_display_roi_area[4] = {0,};
6439 muse_camera_api_e api = MUSE_CAMERA_API_GET_DISPLAY_ROI_AREA;
6441 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6443 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6445 if (ret == CAMERA_ERROR_NONE) {
6446 muse_camera_msg_get_array(get_display_roi_area, pc->cb_info->recv_msg);
6448 *x = get_display_roi_area[0];
6449 *y = get_display_roi_area[1];
6450 *width = get_display_roi_area[2];
6451 *height = get_display_roi_area[3];
6453 LOGD("ret : 0x%x", ret);
6455 LOGE("Returned value is not valid : 0x%x", ret);