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 LOGW("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 LOGW("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 LOGW("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 LOGW("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 LOGW("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 LOGW("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 LOGW("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 LOGW("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 LOGW("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 LOGW("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 LOGW("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 LOGW("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 LOGW("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 LOGW("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 LOGW("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 LOGW("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 LOGW("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);
1345 LOGD("camera capture callback came in. tbm_key_main %d, tbm_key_post %d, tbm_key_thumb %d",
1346 tbm_key_main, tbm_key_post, tbm_key_thumb);
1349 if (tbm_key_main <= 0) {
1350 LOGE("invalid tbm_key_main %d", tbm_key_main);
1354 /* import tbm bo and get virtual address */
1355 if (!_import_tbm_key(cb_info->bufmgr, tbm_key_main, &bo_main, &bo_main_handle))
1358 buf_pos = (unsigned char *)bo_main_handle.ptr;
1359 rImage = (camera_image_data_s *)buf_pos;
1360 rImage->data = buf_pos + sizeof(camera_image_data_s);
1362 LOGD("image info %dx%d, size : %d", rImage->width, rImage->height, rImage->size);
1364 if (tbm_key_post > 0) {
1365 /* import tbm bo and get virtual address */
1366 if (!_import_tbm_key(cb_info->bufmgr, tbm_key_post, &bo_post, &bo_post_handle))
1369 buf_pos = (unsigned char *)bo_post_handle.ptr;
1370 rPostview = (camera_image_data_s *)buf_pos;
1371 LOGD("rPostview->size : %d", rPostview->size);
1372 rPostview->data = buf_pos + sizeof(camera_image_data_s);
1375 if (tbm_key_thumb > 0) {
1376 /* import tbm bo and get virtual address */
1377 if (!_import_tbm_key(cb_info->bufmgr, tbm_key_thumb, &bo_thumb, &bo_thumb_handle))
1380 buf_pos = (unsigned char *)bo_thumb_handle.ptr;
1382 rThumbnail = (camera_image_data_s *)buf_pos;
1383 LOGD("rThumbnail->size : %d", rThumbnail->size);
1384 rThumbnail->data = buf_pos + sizeof(camera_image_data_s);
1387 ((camera_capturing_cb)cb_info->user_cb[event])(rImage, rPostview, rThumbnail, cb_info->user_data[event]);
1389 /* unmap and unref tbm bo */
1390 _release_imported_bo(&bo_main);
1393 tbm_key = tbm_key_main;
1394 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
1395 cb_info->fd, cb_info, INT, tbm_key);
1397 if (tbm_key_post > 0) {
1398 /* unmap and unref tbm bo */
1399 _release_imported_bo(&bo_post);
1402 tbm_key = tbm_key_post;
1403 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
1404 cb_info->fd, cb_info, INT, tbm_key);
1407 if (tbm_key_thumb > 0) {
1408 /* unmap and unref tbm bo */
1409 _release_imported_bo(&bo_thumb);
1412 tbm_key = tbm_key_thumb;
1413 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
1414 cb_info->fd, cb_info, INT, tbm_key);
1417 LOGD("return buffer done");
1420 case MUSE_CAMERA_EVENT_TYPE_VIDEO_FRAME_RENDER_ERROR:
1423 LOGW("Unknown event : %d", event);
1430 static bool _camera_idle_event_callback(void *data)
1432 camera_cb_info_s *cb_info = NULL;
1433 camera_idle_event_s *cam_idle_event = (camera_idle_event_s *)data;
1435 if (cam_idle_event == NULL) {
1436 LOGE("cam_idle_event is NULL");
1441 g_mutex_lock(&cam_idle_event->event_mutex);
1443 cb_info = cam_idle_event->cb_info;
1444 if (cb_info == NULL) {
1445 LOGW("camera cb_info is NULL. event %d", cam_idle_event->event);
1446 goto IDLE_EVENT_CALLBACK_DONE;
1449 /* remove event from list */
1450 g_mutex_lock(&cb_info->idle_event_mutex);
1451 if (cb_info->idle_event_list)
1452 cb_info->idle_event_list = g_list_remove(cb_info->idle_event_list, (gpointer)cam_idle_event);
1454 /*LOGD("remove camera idle event %p, %p", cam_idle_event, cb_info->idle_event_list);*/
1455 g_mutex_unlock(&cb_info->idle_event_mutex);
1458 _client_user_callback(cam_idle_event->cb_info, cam_idle_event->recv_msg, cam_idle_event->event);
1460 /* send signal for waiting thread */
1461 g_cond_signal(&cb_info->idle_event_cond);
1463 IDLE_EVENT_CALLBACK_DONE:
1464 /* unlock and release event */
1465 g_mutex_unlock(&cam_idle_event->event_mutex);
1466 g_mutex_clear(&cam_idle_event->event_mutex);
1468 g_free(cam_idle_event);
1469 cam_idle_event = NULL;
1474 static void *_camera_msg_handler_func(gpointer data)
1479 int event_class = 0;
1480 camera_message_s *cam_msg = NULL;
1481 camera_idle_event_s *cam_idle_event = NULL;
1482 camera_cb_info_s *cb_info = (camera_cb_info_s *)data;
1484 if (cb_info == NULL) {
1485 LOGE("cb_info NULL");
1491 g_mutex_lock(&cb_info->msg_handler_mutex);
1493 while (g_atomic_int_get(&cb_info->msg_handler_running)) {
1494 if (g_queue_is_empty(cb_info->msg_queue)) {
1495 /*LOGD("signal wait...");*/
1496 g_cond_wait(&cb_info->msg_handler_cond, &cb_info->msg_handler_mutex);
1497 /*LOGD("signal received");*/
1499 if (g_atomic_int_get(&cb_info->msg_handler_running) == 0) {
1500 LOGD("stop event thread");
1505 cam_msg = (camera_message_s *)g_queue_pop_head(cb_info->msg_queue);
1507 g_mutex_unlock(&cb_info->msg_handler_mutex);
1509 if (cam_msg == NULL) {
1510 LOGE("NULL message");
1511 g_mutex_lock(&cb_info->msg_handler_mutex);
1517 if (api < MUSE_CAMERA_API_MAX) {
1518 g_mutex_lock(&cb_info->api_mutex[api]);
1520 if (muse_camera_msg_get(ret, cam_msg->recv_msg)) {
1521 cb_info->api_ret[api] = ret;
1522 cb_info->api_activating[api] = 1;
1524 /*LOGD("camera api %d - return 0x%x", ret);*/
1526 g_cond_signal(&cb_info->api_cond[api]);
1528 LOGE("failed to get camera ret for api %d, msg %s", api, cam_msg->recv_msg);
1531 g_mutex_unlock(&cb_info->api_mutex[api]);
1532 } else if (api == MUSE_CAMERA_CB_EVENT) {
1536 if (!muse_camera_msg_get(event, cam_msg->recv_msg) ||
1537 !muse_camera_msg_get(event_class, cam_msg->recv_msg)) {
1538 LOGE("failed to get camera event %d, class %d", event, event_class);
1543 g_mutex_lock(&cb_info->msg_handler_mutex);
1547 switch (event_class) {
1548 case MUSE_CAMERA_EVENT_CLASS_THREAD_SUB:
1549 _client_user_callback(cb_info, cam_msg->recv_msg, event);
1551 case MUSE_CAMERA_EVENT_CLASS_THREAD_MAIN:
1552 cam_idle_event = g_new0(camera_idle_event_s, 1);
1553 if (cam_idle_event == NULL) {
1554 LOGE("cam_idle_event alloc failed");
1558 cam_idle_event->event = event;
1559 cam_idle_event->cb_info = cb_info;
1560 g_mutex_init(&cam_idle_event->event_mutex);
1561 memcpy(cam_idle_event->recv_msg, cam_msg->recv_msg, sizeof(cam_idle_event->recv_msg));
1563 /*LOGD("add camera event[%d, %p] to IDLE", event, cam_idle_event);*/
1565 g_mutex_lock(&cb_info->idle_event_mutex);
1566 cb_info->idle_event_list = g_list_append(cb_info->idle_event_list, (gpointer)cam_idle_event);
1567 g_mutex_unlock(&cb_info->idle_event_mutex);
1569 g_idle_add_full(G_PRIORITY_DEFAULT,
1570 (GSourceFunc)_camera_idle_event_callback,
1571 (gpointer)cam_idle_event,
1575 LOGE("unknown camera event class %d", event_class);
1579 LOGE("unknown camera api[%d] message[%s]", api, cam_msg->recv_msg);
1585 g_mutex_lock(&cb_info->msg_handler_mutex);
1588 /* remove remained event */
1589 while (!g_queue_is_empty(cb_info->msg_queue)) {
1590 cam_msg = (camera_message_s *)g_queue_pop_head(cb_info->msg_queue);
1592 LOGD("remove camera message %p", cam_msg);
1596 LOGW("NULL camera message");
1600 g_mutex_unlock(&cb_info->msg_handler_mutex);
1607 static void _camera_remove_idle_event_all(camera_cb_info_s *cb_info)
1609 camera_idle_event_s *cam_idle_event = NULL;
1610 gboolean ret = TRUE;
1612 gint64 end_time = 0;
1614 if (cb_info == NULL) {
1615 LOGE("cb_info is NULL");
1619 g_mutex_lock(&cb_info->idle_event_mutex);
1621 if (cb_info->idle_event_list == NULL) {
1622 LOGD("No idle event is remained.");
1624 list = cb_info->idle_event_list;
1627 cam_idle_event = list->data;
1628 list = g_list_next(list);
1630 if (!cam_idle_event) {
1631 LOGW("Fail to remove idle event. The event is NULL");
1633 if (g_mutex_trylock(&cam_idle_event->event_mutex)) {
1634 ret = g_idle_remove_by_data(cam_idle_event);
1636 LOGD("remove idle event [%p], ret[%d]", cam_idle_event, ret);
1639 cam_idle_event->cb_info = NULL;
1640 LOGW("idle callback for event %p will be called later", cam_idle_event);
1643 cb_info->idle_event_list = g_list_remove(cb_info->idle_event_list, (gpointer)cam_idle_event);
1645 g_mutex_unlock(&cam_idle_event->event_mutex);
1648 g_mutex_clear(&cam_idle_event->event_mutex);
1650 g_free(cam_idle_event);
1651 cam_idle_event = NULL;
1653 LOGD("remove idle event done");
1656 LOGW("event lock failed. it's being called...");
1658 end_time = g_get_monotonic_time() + G_TIME_SPAN_MILLISECOND * 100;
1660 if (g_cond_wait_until(&cb_info->idle_event_cond, &cb_info->idle_event_mutex, end_time))
1661 LOGW("signal received");
1668 g_list_free(cb_info->idle_event_list);
1669 cb_info->idle_event_list = NULL;
1672 g_mutex_unlock(&cb_info->idle_event_mutex);
1677 static void *_camera_msg_recv_func(gpointer data)
1686 char *recv_msg = NULL;
1687 char **parse_str = NULL;
1688 camera_cb_info_s *cb_info = (camera_cb_info_s *)data;
1690 if (cb_info == NULL) {
1691 LOGE("cb_info NULL");
1697 parse_str = (char **)malloc(sizeof(char *) * CAMERA_PARSE_STRING_SIZE);
1698 if (parse_str == NULL) {
1699 LOGE("parse_str malloc failed");
1703 for (i = 0 ; i < CAMERA_PARSE_STRING_SIZE ; i++) {
1704 parse_str[i] = (char *)malloc(sizeof(char) * MUSE_CAMERA_MSG_MAX_LENGTH);
1705 if (parse_str[i] == NULL) {
1706 LOGE("parse_str[%d] malloc failed", i);
1707 goto CB_HANDLER_EXIT;
1711 recv_msg = cb_info->recv_msg;
1713 while (g_atomic_int_get(&cb_info->msg_recv_running)) {
1714 ret = muse_core_ipc_recv_msg(cb_info->fd, recv_msg);
1717 recv_msg[ret] = '\0';
1723 /*LOGD("recvMSg : %s, length : %d", recv_msg, ret);*/
1725 /* Need to split the combined entering msgs.
1726 This module supports up to 200 combined msgs. */
1727 for (str_pos = 0; str_pos < ret; str_pos++) {
1728 if (recv_msg[str_pos] == '}') {
1729 memset(parse_str[num_token], 0x0, sizeof(char) * MUSE_CAMERA_MSG_MAX_LENGTH);
1730 strncpy(parse_str[num_token], recv_msg + prev_pos, str_pos - prev_pos + 1);
1731 /*LOGD("splitted msg : [%s], Index : %d", parse_str[num_token], num_token);*/
1732 prev_pos = str_pos+1;
1737 /*LOGD("num_token : %d", num_token);*/
1739 /* Re-construct to the useful single msg. */
1740 for (i = 0; i < num_token; i++) {
1741 if (i >= CAMERA_PARSE_STRING_SIZE) {
1742 LOGE("invalid token index %d", i);
1749 if (!muse_camera_msg_get(api, parse_str[i])) {
1750 LOGE("failed to get camera api");
1754 if (api != MUSE_CAMERA_CB_EVENT) {
1755 if (!muse_camera_msg_get(api_class, parse_str[i])) {
1756 LOGE("failed to get camera api_class");
1761 if (api_class == MUSE_CAMERA_API_CLASS_IMMEDIATE) {
1762 if (api >= MUSE_CAMERA_API_MAX) {
1763 LOGE("invalid api %d", api);
1767 g_mutex_lock(&cb_info->api_mutex[api]);
1769 if (!muse_camera_msg_get(ret, parse_str[i])) {
1770 LOGE("failed to get camera ret");
1771 g_mutex_unlock(&cb_info->api_mutex[api]);
1775 cb_info->api_ret[api] = ret;
1776 cb_info->api_activating[api] = 1;
1778 if (api == MUSE_CAMERA_API_CREATE) {
1779 if (ret != CAMERA_ERROR_NONE) {
1780 g_atomic_int_set(&cb_info->msg_recv_running, 0);
1781 LOGE("camera create error 0x%x. close client cb handler", ret);
1783 } else if (api == MUSE_CAMERA_API_DESTROY) {
1784 if (ret == CAMERA_ERROR_NONE) {
1785 g_atomic_int_set(&cb_info->msg_recv_running, 0);
1786 LOGD("camera destroy done. close client cb handler");
1790 g_cond_signal(&cb_info->api_cond[api]);
1791 g_mutex_unlock(&cb_info->api_mutex[api]);
1792 } else if (api_class == MUSE_CAMERA_API_CLASS_THREAD_SUB || api == MUSE_CAMERA_CB_EVENT) {
1793 camera_message_s *cam_msg = g_new0(camera_message_s, 1);
1794 if (cam_msg == NULL) {
1795 LOGE("failed to alloc cam_msg");
1800 memcpy(cam_msg->recv_msg, parse_str[i], sizeof(cam_msg->recv_msg));
1802 /*LOGD("add camera message to queue : api %d", api);*/
1804 g_mutex_lock(&cb_info->msg_handler_mutex);
1805 g_queue_push_tail(cb_info->msg_queue, (gpointer)cam_msg);
1806 g_cond_signal(&cb_info->msg_handler_cond);
1807 g_mutex_unlock(&cb_info->msg_handler_mutex);
1809 LOGW("unknown camera api %d and api_class %d", api, api_class);
1815 LOGD("client cb exit");
1819 for (i = 0 ; i < CAMERA_PARSE_STRING_SIZE ; i++) {
1822 parse_str[i] = NULL;
1833 static camera_cb_info_s *_client_callback_new(gint sockfd)
1835 camera_cb_info_s *cb_info = NULL;
1836 gint *tmp_activating = NULL;
1837 gint *tmp_ret = NULL;
1840 g_return_val_if_fail(sockfd > 0, NULL);
1842 cb_info = g_new0(camera_cb_info_s, 1);
1843 if (cb_info == NULL) {
1844 LOGE("cb_info failed");
1848 g_mutex_init(&cb_info->msg_handler_mutex);
1849 g_cond_init(&cb_info->msg_handler_cond);
1850 g_mutex_init(&cb_info->idle_event_mutex);
1851 g_cond_init(&cb_info->idle_event_cond);
1852 g_mutex_init(&cb_info->mp_data_mutex);
1853 #ifdef EVAS_RENDERER_SUPPORT
1854 g_mutex_init(&cb_info->evas_mutex);
1855 #endif /* EVAS_RENDERER_SUPPORT */
1857 for (i = 0 ; i < MUSE_CAMERA_API_MAX ; i++) {
1858 g_mutex_init(&cb_info->api_mutex[i]);
1859 g_cond_init(&cb_info->api_cond[i]);
1862 tmp_activating = g_new0(gint, MUSE_CAMERA_API_MAX);
1863 if (tmp_activating == NULL) {
1864 LOGE("tmp_activating failed");
1868 tmp_ret = g_new0(gint, MUSE_CAMERA_API_MAX);
1869 if (tmp_ret == NULL) {
1870 LOGE("tmp_ret failed");
1874 cb_info->msg_queue = g_queue_new();
1875 if (cb_info->msg_queue == NULL) {
1876 LOGE("msg_queue new failed");
1880 g_atomic_int_set(&cb_info->msg_handler_running, 1);
1881 cb_info->msg_handler_thread = g_thread_try_new("camera_msg_handler",
1882 _camera_msg_handler_func, (gpointer)cb_info, NULL);
1883 if (cb_info->msg_handler_thread == NULL) {
1884 LOGE("message handler thread creation failed");
1888 cb_info->fd = sockfd;
1889 cb_info->api_activating = tmp_activating;
1890 cb_info->api_ret = tmp_ret;
1891 cb_info->preview_cb_flag = 0;
1892 #ifdef EVAS_RENDERER_SUPPORT
1893 cb_info->evas_info = NULL;
1894 #endif /* EVAS_RENDERER_SUPPORT */
1896 g_atomic_int_set(&cb_info->msg_recv_running, 1);
1897 cb_info->msg_recv_thread = g_thread_try_new("camera_msg_recv",
1898 _camera_msg_recv_func, (gpointer)cb_info, NULL);
1899 if (cb_info->msg_recv_thread == NULL) {
1900 LOGE("message receive thread creation failed");
1908 if (cb_info->msg_handler_thread) {
1909 g_mutex_lock(&cb_info->msg_handler_mutex);
1910 g_atomic_int_set(&cb_info->msg_handler_running, 0);
1911 g_cond_signal(&cb_info->msg_handler_cond);
1912 g_mutex_unlock(&cb_info->msg_handler_mutex);
1914 g_thread_join(cb_info->msg_handler_thread);
1915 g_thread_unref(cb_info->msg_handler_thread);
1916 cb_info->msg_handler_thread = NULL;
1919 for (i = 0 ; i < MUSE_CAMERA_API_MAX ; i++) {
1920 g_mutex_clear(&cb_info->api_mutex[i]);
1921 g_cond_clear(&cb_info->api_cond[i]);
1924 g_mutex_clear(&cb_info->msg_handler_mutex);
1925 g_cond_clear(&cb_info->msg_handler_cond);
1926 g_mutex_clear(&cb_info->idle_event_mutex);
1927 g_cond_clear(&cb_info->idle_event_cond);
1928 g_mutex_clear(&cb_info->mp_data_mutex);
1929 #ifdef EVAS_RENDERER_SUPPORT
1930 g_mutex_clear(&cb_info->evas_mutex);
1931 #endif /* EVAS_RENDERER_SUPPORT */
1933 if (cb_info->msg_queue) {
1934 g_queue_free(cb_info->msg_queue);
1935 cb_info->msg_queue = NULL;
1942 if (tmp_activating) {
1943 g_free(tmp_activating);
1944 tmp_activating = NULL;
1954 static void _client_callback_destroy(camera_cb_info_s *cb_info)
1958 g_return_if_fail(cb_info != NULL);
1960 LOGD("MSG receive thread[%p] destroy", cb_info->msg_recv_thread);
1962 g_thread_join(cb_info->msg_recv_thread);
1963 g_thread_unref(cb_info->msg_recv_thread);
1964 cb_info->msg_recv_thread = NULL;
1966 LOGD("msg thread removed");
1968 g_mutex_lock(&cb_info->msg_handler_mutex);
1969 g_atomic_int_set(&cb_info->msg_handler_running, 0);
1970 g_cond_signal(&cb_info->msg_handler_cond);
1971 g_mutex_unlock(&cb_info->msg_handler_mutex);
1973 g_thread_join(cb_info->msg_handler_thread);
1974 g_thread_unref(cb_info->msg_handler_thread);
1975 cb_info->msg_handler_thread = NULL;
1977 g_queue_free(cb_info->msg_queue);
1978 cb_info->msg_queue = NULL;
1980 for (i = 0 ; i < MUSE_CAMERA_API_MAX ; i++) {
1981 g_mutex_clear(&cb_info->api_mutex[i]);
1982 g_cond_clear(&cb_info->api_cond[i]);
1985 g_mutex_clear(&cb_info->msg_handler_mutex);
1986 g_cond_clear(&cb_info->msg_handler_cond);
1987 g_mutex_clear(&cb_info->idle_event_mutex);
1988 g_cond_clear(&cb_info->idle_event_cond);
1989 g_mutex_clear(&cb_info->mp_data_mutex);
1990 #ifdef EVAS_RENDERER_SUPPORT
1991 g_mutex_clear(&cb_info->evas_mutex);
1992 #endif /* EVAS_RENDERER_SUPPORT */
1994 LOGD("event thread removed");
1996 if (cb_info->fd > -1) {
1997 muse_core_connection_close(cb_info->fd);
2001 if (cb_info->bufmgr) {
2002 tbm_bufmgr_deinit(cb_info->bufmgr);
2003 cb_info->bufmgr = NULL;
2005 if (cb_info->api_activating) {
2006 g_free(cb_info->api_activating);
2007 cb_info->api_activating = NULL;
2009 if (cb_info->api_ret) {
2010 g_free(cb_info->api_ret);
2011 cb_info->api_ret = NULL;
2013 if (cb_info->pkt_fmt) {
2014 media_format_unref(cb_info->pkt_fmt);
2015 cb_info->pkt_fmt = NULL;
2018 #ifdef EVAS_RENDERER_SUPPORT
2019 if (cb_info->evas_info)
2020 mm_evas_renderer_destroy(&cb_info->evas_info);
2021 #endif /* EVAS_RENDERER_SUPPORT */
2023 cb_info->preview_cb_flag = 0;
2032 int _camera_start_evas_rendering(camera_h camera)
2034 int ret = CAMERA_ERROR_NONE;
2035 camera_cli_s *pc = (camera_cli_s *)camera;
2037 if (camera == NULL) {
2038 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2039 return CAMERA_ERROR_INVALID_PARAMETER;
2042 if (pc->cb_info == NULL) {
2043 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2044 return CAMERA_ERROR_INVALID_PARAMETER;
2049 if (!CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
2050 LOGE("EVAS surface is not set");
2051 return CAMERA_ERROR_NONE;
2054 #ifdef EVAS_RENDERER_SUPPORT
2055 g_mutex_lock(&pc->cb_info->evas_mutex);
2057 /* set evas render flag as RUN */
2058 pc->cb_info->run_evas_render = true;
2059 ret = CAMERA_ERROR_NONE;
2061 g_mutex_unlock(&pc->cb_info->evas_mutex);
2062 #else /* EVAS_RENDERER_SUPPORT */
2063 LOGW("evas renderer is not supported");
2064 ret = CAMERA_ERROR_NOT_SUPPORTED;
2065 #endif /* EVAS_RENDERER_SUPPORT */
2071 int _camera_stop_evas_rendering(camera_h camera, bool keep_screen)
2073 int ret = CAMERA_ERROR_NONE;
2074 camera_cli_s *pc = (camera_cli_s *)camera;
2076 if (camera == NULL) {
2077 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2078 return CAMERA_ERROR_INVALID_PARAMETER;
2081 if (pc->cb_info == NULL) {
2082 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2083 return CAMERA_ERROR_INVALID_PARAMETER;
2086 LOGD("stop - keep screen %d", keep_screen);
2088 if (!CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
2089 LOGE("EVAS surface is not set");
2090 return CAMERA_ERROR_NONE;
2093 #ifdef EVAS_RENDERER_SUPPORT
2094 g_mutex_lock(&pc->cb_info->evas_mutex);
2096 /* set evas render flag as STOP and release buffers */
2097 pc->cb_info->run_evas_render = false;
2099 ret = mm_evas_renderer_retrieve_all_packets(pc->cb_info->evas_info, keep_screen);
2100 if (ret != MM_ERROR_NONE) {
2101 LOGE("mm_evas_renderer_retrieve_all_packets failed 0x%x", ret);
2102 ret = CAMERA_ERROR_INVALID_OPERATION;
2105 g_mutex_unlock(&pc->cb_info->evas_mutex);
2106 #else /* EVAS_RENDERER_SUPPORT */
2107 LOGW("evas renderer is not supported");
2108 ret = CAMERA_ERROR_NOT_SUPPORTED;
2109 #endif /* EVAS_RENDERER_SUPPORT */
2115 int camera_create(camera_device_e device, camera_h *camera)
2119 int ret = CAMERA_ERROR_NONE;
2121 camera_cli_s *pc = NULL;
2122 tbm_bufmgr bufmgr = NULL;
2124 muse_camera_api_e api = MUSE_CAMERA_API_CREATE;
2125 muse_core_api_module_e muse_module = MUSE_CAMERA;
2126 int device_type = (int)device;
2128 if (camera == NULL) {
2129 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2130 return CAMERA_ERROR_INVALID_PARAMETER;
2133 bufmgr = tbm_bufmgr_init(-1);
2134 if (bufmgr == NULL) {
2135 LOGE("get tbm bufmgr failed");
2136 return CAMERA_ERROR_INVALID_OPERATION;
2139 sock_fd = muse_core_client_new();
2141 LOGE("muse_core_client_new failed - returned fd %d", sock_fd);
2142 ret = CAMERA_ERROR_INVALID_OPERATION;
2148 sndMsg = muse_core_msg_json_factory_new(api,
2149 MUSE_TYPE_INT, "module", muse_module,
2150 MUSE_TYPE_INT, PARAM_DEVICE_TYPE, device_type,
2151 MUSE_TYPE_INT, "pid", pid,
2154 muse_core_ipc_send_msg(sock_fd, sndMsg);
2155 muse_core_msg_json_factory_free(sndMsg);
2157 pc = g_new0(camera_cli_s, 1);
2159 LOGE("camera_cli_s alloc failed");
2160 ret = CAMERA_ERROR_OUT_OF_MEMORY;
2164 pc->cb_info = _client_callback_new(sock_fd);
2165 if (pc->cb_info == NULL) {
2166 LOGE("cb_info alloc failed");
2167 ret = CAMERA_ERROR_OUT_OF_MEMORY;
2171 LOGD("cb info : %d", pc->cb_info->fd);
2173 ret = _client_wait_for_cb_return(api, pc->cb_info, CALLBACK_TIME_OUT);
2174 if (ret == CAMERA_ERROR_NONE) {
2175 intptr_t handle = 0;
2176 muse_camera_msg_get_pointer(handle, pc->cb_info->recv_msg);
2178 LOGE("Receiving Handle Failed!!");
2179 ret = CAMERA_ERROR_INVALID_OPERATION;
2183 pc->remote_handle = handle;
2184 pc->cb_info->bufmgr = bufmgr;
2186 ret = camera_set_display((camera_h)pc, CAMERA_DISPLAY_TYPE_NONE, NULL);
2187 if (ret != CAMERA_ERROR_NONE) {
2188 LOGE("init display failed 0x%x", ret);
2192 LOGD("camera create 0x%x", pc->remote_handle);
2193 *camera = (camera_h)pc;
2201 tbm_bufmgr_deinit(bufmgr);
2205 _client_callback_destroy(pc->cb_info);
2211 LOGE("camera create error : 0x%x", ret);
2216 int camera_destroy(camera_h camera)
2218 if (camera == NULL) {
2219 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2220 return CAMERA_ERROR_INVALID_PARAMETER;
2223 int ret = CAMERA_ERROR_NONE;
2224 muse_camera_api_e api = MUSE_CAMERA_API_DESTROY;
2225 camera_cli_s *pc = (camera_cli_s *)camera;
2230 if (pc->cb_info == NULL) {
2231 LOGE("cb_info NULL, INVALID_PARAMETER");
2232 return CAMERA_ERROR_INVALID_PARAMETER;
2235 sock_fd = pc->cb_info->fd;
2237 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2238 if (ret == CAMERA_ERROR_NONE) {
2239 _camera_remove_idle_event_all(pc->cb_info);
2240 _client_callback_destroy(pc->cb_info);
2246 LOGE("camera destroy error : 0x%x", ret);
2252 int camera_start_preview(camera_h camera)
2254 int ret = CAMERA_ERROR_NONE;
2255 muse_camera_api_e api = MUSE_CAMERA_API_START_PREVIEW;
2256 camera_cli_s *pc = (camera_cli_s *)camera;
2259 if (camera == NULL) {
2260 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2261 return CAMERA_ERROR_INVALID_PARAMETER;
2264 if (pc->cb_info == NULL) {
2265 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2266 return CAMERA_ERROR_INVALID_PARAMETER;
2271 sock_fd = pc->cb_info->fd;
2273 muse_camera_msg_send_longtime(api, sock_fd, pc->cb_info, ret);
2275 if (ret != CAMERA_ERROR_NONE) {
2276 LOGE("start preview failed 0x%x", ret);
2277 } else if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
2278 ret = _camera_start_evas_rendering(camera);
2281 LOGD("ret : 0x%x", ret);
2286 int camera_stop_preview(camera_h camera)
2288 int ret = CAMERA_ERROR_NONE;
2290 camera_cli_s *pc = NULL;
2291 muse_camera_api_e api = MUSE_CAMERA_API_STOP_PREVIEW;
2293 if (camera == NULL) {
2294 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2295 return CAMERA_ERROR_INVALID_PARAMETER;
2298 pc = (camera_cli_s *)camera;
2300 if (pc->cb_info == NULL) {
2301 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2302 return CAMERA_ERROR_INVALID_PARAMETER;
2305 sock_fd = pc->cb_info->fd;
2309 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
2310 camera_state_e current_state = CAMERA_STATE_NONE;
2312 ret = camera_get_state(camera, ¤t_state);
2313 if (ret != CAMERA_ERROR_NONE) {
2314 LOGE("failed to get current state 0x%x", ret);
2318 if (current_state == CAMERA_STATE_PREVIEW) {
2319 ret = _camera_stop_evas_rendering(camera, false);
2320 if (ret != CAMERA_ERROR_NONE)
2325 /* send stop preview message */
2326 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2328 LOGD("ret : 0x%x", ret);
2333 int camera_start_capture(camera_h camera, camera_capturing_cb capturing_cb, camera_capture_completed_cb completed_cb, void *user_data)
2335 if (camera == NULL) {
2336 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2337 return CAMERA_ERROR_INVALID_PARAMETER;
2339 int ret = CAMERA_ERROR_NONE;
2341 camera_cli_s *pc = (camera_cli_s *)camera;
2342 muse_camera_api_e api = MUSE_CAMERA_API_START_CAPTURE;
2344 int is_capturing_cb = 0;
2345 int is_completed_cb = 0;
2346 LOGD("Enter, handle :%x", pc->remote_handle);
2348 if (pc->cb_info == NULL) {
2349 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2350 return CAMERA_ERROR_INVALID_PARAMETER;
2353 sock_fd = pc->cb_info->fd;
2355 if (capturing_cb != NULL) {
2356 is_capturing_cb = 1;
2357 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = capturing_cb;
2358 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = user_data;
2361 if (completed_cb != NULL) {
2362 is_completed_cb = 1;
2363 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = completed_cb;
2364 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = user_data;
2367 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, is_capturing_cb, INT, is_completed_cb);
2368 LOGD("is_capturing_cb :%d, is_completed_cb : %d", is_capturing_cb, is_completed_cb);
2369 LOGD("ret : 0x%x", ret);
2373 bool camera_is_supported_continuous_capture(camera_h camera)
2375 if (camera == NULL) {
2376 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2380 int ret = CAMERA_ERROR_NONE;
2381 camera_cli_s *pc = (camera_cli_s *)camera;
2382 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_CONTINUOUS_CAPTURE;
2385 if (pc->cb_info == NULL) {
2386 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2387 return CAMERA_ERROR_INVALID_PARAMETER;
2390 sock_fd = pc->cb_info->fd;
2392 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2393 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2394 LOGD("ret : 0x%x", ret);
2398 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)
2400 if (camera == NULL) {
2401 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2402 return CAMERA_ERROR_INVALID_PARAMETER;
2405 int ret = CAMERA_ERROR_NONE;
2407 camera_cli_s *pc = (camera_cli_s *)camera;
2408 muse_camera_api_e api = MUSE_CAMERA_API_START_CONTINUOUS_CAPTURE;
2410 LOGD("Enter, handle :%x", pc->remote_handle);
2413 if (pc->cb_info == NULL) {
2414 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2415 return CAMERA_ERROR_INVALID_PARAMETER;
2417 sock_fd = pc->cb_info->fd;
2419 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = capturing_cb;
2420 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = user_data;
2421 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = completed_cb;
2423 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, count, INT, interval);
2425 LOGD("ret : 0x%x", ret);
2430 int camera_stop_continuous_capture(camera_h camera)
2432 if (camera == NULL) {
2433 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2434 return CAMERA_ERROR_INVALID_PARAMETER;
2438 int ret = CAMERA_ERROR_NONE;
2440 camera_cli_s *pc = (camera_cli_s *)camera;
2441 muse_camera_api_e api = MUSE_CAMERA_API_STOP_CONTINUOUS_CAPTURE;
2442 LOGD("Enter, handle :%x", pc->remote_handle);
2444 if (pc->cb_info == NULL) {
2445 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2446 return CAMERA_ERROR_INVALID_PARAMETER;
2448 sock_fd = pc->cb_info->fd;
2449 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2450 LOGD("ret : 0x%x", ret);
2454 bool camera_is_supported_face_detection(camera_h camera)
2456 if (camera == NULL) {
2457 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2460 int ret = CAMERA_ERROR_NONE;
2462 camera_cli_s *pc = (camera_cli_s *)camera;
2463 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_FACE_DETECTION;
2465 if (pc->cb_info == NULL) {
2466 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2467 return CAMERA_ERROR_INVALID_PARAMETER;
2469 sock_fd = pc->cb_info->fd;
2471 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2472 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2473 LOGD("ret : 0x%x", ret);
2477 bool camera_is_supported_zero_shutter_lag(camera_h camera)
2479 if (camera == NULL) {
2480 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2483 int ret = CAMERA_ERROR_NONE;
2485 camera_cli_s *pc = (camera_cli_s *)camera;
2486 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_ZERO_SHUTTER_LAG;
2488 if (pc->cb_info == NULL) {
2489 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2490 return CAMERA_ERROR_INVALID_PARAMETER;
2492 sock_fd = pc->cb_info->fd;
2494 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2495 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2496 LOGD("ret : 0x%x", ret);
2500 bool camera_is_supported_media_packet_preview_cb(camera_h camera)
2502 if (camera == NULL) {
2503 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2507 int ret = CAMERA_ERROR_NONE;
2509 camera_cli_s *pc = (camera_cli_s *)camera;
2510 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_MEDIA_PACKET_PREVIEW_CB;
2512 if (pc->cb_info == NULL) {
2513 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2514 return CAMERA_ERROR_INVALID_PARAMETER;
2516 sock_fd = pc->cb_info->fd;
2518 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2519 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2520 LOGD("ret : 0x%x", ret);
2524 int camera_get_device_count(camera_h camera, int *device_count)
2526 if (camera == NULL || device_count == NULL) {
2527 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2528 return CAMERA_ERROR_INVALID_PARAMETER;
2530 int ret = CAMERA_ERROR_NONE;
2532 camera_cli_s *pc = (camera_cli_s *)camera;
2533 muse_camera_api_e api = MUSE_CAMERA_API_GET_DEVICE_COUNT;
2535 if (pc->cb_info == NULL) {
2536 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2537 return CAMERA_ERROR_INVALID_PARAMETER;
2539 sock_fd = pc->cb_info->fd;
2540 int get_device_count;
2542 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2543 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2545 if (ret == CAMERA_ERROR_NONE) {
2546 muse_camera_msg_get(get_device_count, pc->cb_info->recv_msg);
2547 *device_count = get_device_count;
2549 LOGD("ret : 0x%x", ret);
2553 int camera_start_face_detection(camera_h camera, camera_face_detected_cb callback, void *user_data)
2555 if (camera == NULL) {
2556 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2557 return CAMERA_ERROR_INVALID_PARAMETER;
2560 int ret = CAMERA_ERROR_NONE;
2562 camera_cli_s *pc = (camera_cli_s *)camera;
2563 muse_camera_api_e api = MUSE_CAMERA_API_START_FACE_DETECTION;
2565 LOGD("Enter, handle :%x", pc->remote_handle);
2567 if (pc->cb_info == NULL) {
2568 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2569 return CAMERA_ERROR_INVALID_PARAMETER;
2571 sock_fd = pc->cb_info->fd;
2572 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION] = callback;
2573 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION] = user_data;
2575 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2576 LOGD("ret : 0x%x", ret);
2580 int camera_stop_face_detection(camera_h camera)
2582 if (camera == NULL) {
2583 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2584 return CAMERA_ERROR_INVALID_PARAMETER;
2587 int ret = CAMERA_ERROR_NONE;
2589 camera_cli_s *pc = (camera_cli_s *)camera;
2590 muse_camera_api_e api = MUSE_CAMERA_API_STOP_FACE_DETECTION;
2591 LOGD("Enter, handle :%x", pc->remote_handle);
2593 if (pc->cb_info == NULL) {
2594 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2595 return CAMERA_ERROR_INVALID_PARAMETER;
2597 sock_fd = pc->cb_info->fd;
2598 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2599 LOGD("ret : 0x%x", ret);
2603 int camera_get_state(camera_h camera, camera_state_e *state)
2605 if (camera == NULL || state == NULL) {
2606 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2607 return CAMERA_ERROR_INVALID_PARAMETER;
2609 int ret = CAMERA_ERROR_NONE;
2611 camera_cli_s *pc = (camera_cli_s *)camera;
2612 muse_camera_api_e api = MUSE_CAMERA_API_GET_STATE;
2614 if (pc->cb_info == NULL) {
2615 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2616 return CAMERA_ERROR_INVALID_PARAMETER;
2618 sock_fd = pc->cb_info->fd;
2621 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2622 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2624 if (ret == CAMERA_ERROR_NONE) {
2625 muse_camera_msg_get(get_state, pc->cb_info->recv_msg);
2626 *state = (camera_state_e)get_state;
2628 LOGD("ret : 0x%x", ret);
2632 int camera_start_focusing(camera_h camera, bool continuous)
2634 if (camera == NULL) {
2635 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2636 return CAMERA_ERROR_INVALID_PARAMETER;
2639 int ret = CAMERA_ERROR_NONE;
2641 camera_cli_s *pc = (camera_cli_s *)camera;
2642 muse_camera_api_e api = MUSE_CAMERA_API_START_FOCUSING;
2644 if (pc->cb_info == NULL) {
2645 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2646 return CAMERA_ERROR_INVALID_PARAMETER;
2648 sock_fd = pc->cb_info->fd;
2649 int is_continuous = (int)continuous;
2651 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2652 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, is_continuous);
2653 LOGD("ret : 0x%x", ret);
2657 int camera_cancel_focusing(camera_h camera)
2659 if (camera == NULL) {
2660 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2661 return CAMERA_ERROR_INVALID_PARAMETER;
2664 int ret = CAMERA_ERROR_NONE;
2666 camera_cli_s *pc = (camera_cli_s *)camera;
2667 muse_camera_api_e api = MUSE_CAMERA_API_CANCEL_FOCUSING;
2669 if (pc->cb_info == NULL) {
2670 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2671 return CAMERA_ERROR_INVALID_PARAMETER;
2673 sock_fd = pc->cb_info->fd;
2675 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2676 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2677 LOGD("ret : 0x%x", ret);
2681 int camera_set_display(camera_h camera, camera_display_type_e type, camera_display_h display)
2683 int ret = CAMERA_ERROR_NONE;
2684 void *set_display_handle = NULL;
2685 Evas_Object *obj = NULL;
2686 const char *object_type = NULL;
2688 camera_wl_info_s *wl_info = NULL;
2689 #endif /* HAVE_WAYLAND */
2690 camera_cli_s *pc = (camera_cli_s *)camera;
2691 camera_cb_info_s *cb_info = NULL;
2692 muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY;
2693 camera_state_e current_state = CAMERA_STATE_NONE;
2696 if (camera == NULL) {
2697 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2698 return CAMERA_ERROR_INVALID_PARAMETER;
2701 if (type < CAMERA_DISPLAY_TYPE_OVERLAY || type > CAMERA_DISPLAY_TYPE_NONE) {
2702 LOGE("invalid type %d", type);
2703 return CAMERA_ERROR_INVALID_PARAMETER;
2706 if (type != CAMERA_DISPLAY_TYPE_NONE && display == NULL) {
2707 LOGE("display type[%d] is not NONE, but display handle is NULL", type);
2708 return CAMERA_ERROR_INVALID_PARAMETER;
2711 if (pc->cb_info == NULL) {
2712 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2713 return CAMERA_ERROR_INVALID_PARAMETER;
2716 cb_info = (camera_cb_info_s *)pc->cb_info;
2717 sock_fd = cb_info->fd;
2719 ret = camera_get_state(camera, ¤t_state);
2720 if (ret != CAMERA_ERROR_NONE) {
2721 LOGE("failed to get current state 0x%x", ret);
2725 if (current_state != CAMERA_STATE_CREATED) {
2726 LOGE("INVALID_STATE : current %d", current_state);
2727 return CAMERA_ERROR_INVALID_STATE;
2730 LOGD("Enter, remote_handle : %x display : 0x%x", pc->remote_handle, display);
2732 if (type == CAMERA_DISPLAY_TYPE_NONE) {
2733 set_display_handle = 0;
2734 LOGD("display type NONE");
2736 obj = (Evas_Object *)display;
2737 object_type = evas_object_type_get(obj);
2739 if (type == CAMERA_DISPLAY_TYPE_OVERLAY && !strcmp(object_type, "elm_win")) {
2741 /* get wayland parent id */
2742 if (_get_wl_info(obj, &pc->wl_info) != CAMERA_ERROR_NONE) {
2743 LOGE("failed to get wayland info");
2744 return CAMERA_ERROR_INVALID_OPERATION;
2747 set_display_handle = (void *)&pc->wl_info;
2748 #else /* HAVE_WAYLAND */
2749 /* x window overlay surface */
2750 set_display_handle = (void *)elm_win_xwindow_get(obj);
2751 #endif /* HAVE_WAYLAND */
2752 LOGD("display type OVERLAY : handle %p", set_display_handle);
2753 } else if (type == CAMERA_DISPLAY_TYPE_EVAS && !strcmp(object_type, "image")) {
2754 /* evas object surface */
2755 set_display_handle = (void *)display;
2756 LOGD("display type EVAS : handle %p", set_display_handle);
2758 #ifdef EVAS_RENDERER_SUPPORT
2759 g_mutex_lock(&cb_info->evas_mutex);
2761 if (cb_info->evas_info) {
2762 LOGW("destroy existed evas renderer %p", cb_info->evas_info);
2763 ret = mm_evas_renderer_destroy(&cb_info->evas_info);
2764 if (ret != MM_ERROR_NONE) {
2765 LOGE("failed to destroy evas renderer %p", cb_info->evas_info);
2766 g_mutex_unlock(&cb_info->evas_mutex);
2767 return CAMERA_ERROR_INVALID_OPERATION;
2771 /* create evas renderer */
2772 ret = mm_evas_renderer_create(&cb_info->evas_info, (Evas_Object *)set_display_handle);
2773 if (ret == MM_ERROR_NONE) {
2774 camera_flip_e flip = CAMERA_FLIP_NONE;
2775 camera_display_mode_e mode = CAMERA_DISPLAY_MODE_LETTER_BOX;
2776 camera_rotation_e rotation = CAMERA_ROTATION_NONE;
2783 camera_get_display_flip(camera, &flip);
2784 camera_get_display_mode(camera, &mode);
2785 camera_get_display_rotation(camera, &rotation);
2786 camera_is_display_visible(camera, &visible);
2787 camera_attr_get_display_roi_area(camera, &x, &y, &width, &height);
2789 LOGD("current setting : flip %d, mode %d, rotation %d, visible %d, roi %d,%d,%dx%d",
2790 flip, mode, rotation, visible, x, y, width, height);
2792 ret = mm_evas_renderer_set_flip(cb_info->evas_info, flip);
2793 ret |= mm_evas_renderer_set_geometry(cb_info->evas_info, mode);
2794 ret |= mm_evas_renderer_set_rotation(cb_info->evas_info, rotation);
2795 ret |= mm_evas_renderer_set_visible(cb_info->evas_info, visible);
2797 if (mode == CAMERA_DISPLAY_MODE_CUSTOM_ROI)
2798 ret |= mm_evas_renderer_set_roi_area(cb_info->evas_info, x, y, width, height);
2801 g_mutex_unlock(&cb_info->evas_mutex);
2803 if (ret != MM_ERROR_NONE) {
2804 LOGE("mm_evas_renderer error 0x%x", ret);
2805 return CAMERA_ERROR_INVALID_OPERATION;
2807 #else /* EVAS_RENDERER_SUPPORT */
2808 LOGE("EVAS surface is not supported");
2809 return CAMERA_ERROR_NOT_SUPPORTED;
2810 #endif /* EVAS_RENDERER_SUPPORT */
2812 LOGE("unknown evas object [%p,%s] or type [%d] mismatch", obj, object_type, type);
2813 return CAMERA_ERROR_INVALID_PARAMETER;
2816 LOGE("failed to get evas object type from %p", obj);
2817 return CAMERA_ERROR_INVALID_PARAMETER;
2821 pc->display_handle = (intptr_t)set_display_handle;
2823 if (type == CAMERA_DISPLAY_TYPE_OVERLAY) {
2825 wl_info = &pc->wl_info;
2826 muse_camera_msg_send_array_and_value(api, sock_fd, cb_info, ret,
2827 wl_info, sizeof(camera_wl_info_s), sizeof(int), INT, type);
2829 LOGD("wayland parent id : %d, window %d,%d,%dx%d",
2830 wl_info->parent_id, wl_info->window_x, wl_info->window_y,
2831 wl_info->window_width, wl_info->window_height);
2832 #else /* HAVE_WAYLAND */
2833 muse_camera_msg_send2(api, sock_fd, cb_info, ret, INT, type, INT, set_display_handle);
2835 LOGD("x id : %d", (int)set_display_handle);
2836 #endif /* HAVE_WAYLAND */
2838 muse_camera_msg_send1(api, sock_fd, cb_info, ret, INT, type);
2840 if (ret != CAMERA_ERROR_NONE)
2841 LOGE("set display error 0x%x", ret);
2842 else if (type == CAMERA_DISPLAY_TYPE_EVAS)
2843 SET_PREVIEW_CB_TYPE(cb_info, PREVIEW_CB_TYPE_EVAS);
2848 int camera_set_preview_resolution(camera_h camera, int width, int height)
2850 if (camera == NULL) {
2851 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2852 return CAMERA_ERROR_INVALID_PARAMETER;
2854 int ret = CAMERA_ERROR_NONE;
2856 camera_cli_s *pc = (camera_cli_s *)camera;
2857 muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_RESOLUTION;
2859 if (pc->cb_info == NULL) {
2860 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2861 return CAMERA_ERROR_INVALID_PARAMETER;
2863 sock_fd = pc->cb_info->fd;
2865 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2866 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, width, INT, height);
2867 LOGD("ret : 0x%x", ret);
2872 int camera_set_capture_resolution(camera_h camera, int width, int height)
2874 if (camera == NULL) {
2875 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2876 return CAMERA_ERROR_INVALID_PARAMETER;
2879 int ret = CAMERA_ERROR_NONE;
2881 camera_cli_s *pc = (camera_cli_s *)camera;
2882 muse_camera_api_e api = MUSE_CAMERA_API_SET_CAPTURE_RESOLUTION;
2884 if (pc->cb_info == NULL) {
2885 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2886 return CAMERA_ERROR_INVALID_PARAMETER;
2888 sock_fd = pc->cb_info->fd;
2890 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2891 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, width, INT, height);
2892 LOGD("ret : 0x%x", ret);
2896 int camera_set_capture_format(camera_h camera, camera_pixel_format_e format)
2898 if (camera == NULL) {
2899 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2900 return CAMERA_ERROR_INVALID_PARAMETER;
2903 int ret = CAMERA_ERROR_NONE;
2904 int set_format = (int)format;
2906 camera_cli_s *pc = (camera_cli_s *)camera;
2907 muse_camera_api_e api = MUSE_CAMERA_API_SET_CAPTURE_FORMAT;
2909 if (pc->cb_info == NULL) {
2910 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2911 return CAMERA_ERROR_INVALID_PARAMETER;
2913 sock_fd = pc->cb_info->fd;
2915 LOGD("Enter, remote_handle : %x, capture_format: %d", pc->remote_handle, set_format);
2916 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_format);
2917 LOGD("ret : 0x%x", ret);
2921 int camera_set_preview_format(camera_h camera, camera_pixel_format_e format)
2923 if (camera == NULL) {
2924 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2925 return CAMERA_ERROR_INVALID_PARAMETER;
2928 int ret = CAMERA_ERROR_NONE;
2929 int set_format = (int)format;
2931 camera_cli_s *pc = (camera_cli_s *)camera;
2932 muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_FORMAT;
2934 if (pc->cb_info == NULL) {
2935 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2936 return CAMERA_ERROR_INVALID_PARAMETER;
2938 sock_fd = pc->cb_info->fd;
2940 LOGD("Enter, remote_handle : %x, capture_format: %d", pc->remote_handle, set_format);
2941 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_format);
2942 LOGD("ret : 0x%x", ret);
2946 int camera_get_preview_resolution(camera_h camera, int *width, int *height)
2948 if (camera == NULL || width == NULL || height == NULL) {
2949 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2950 return CAMERA_ERROR_INVALID_PARAMETER;
2954 int ret = CAMERA_ERROR_NONE;
2956 camera_cli_s *pc = (camera_cli_s *)camera;
2957 muse_camera_api_e api = MUSE_CAMERA_API_GET_PREVIEW_RESOLUTION;
2959 if (pc->cb_info == NULL) {
2960 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2961 return CAMERA_ERROR_INVALID_PARAMETER;
2963 sock_fd = pc->cb_info->fd;
2967 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2968 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2970 if (ret == CAMERA_ERROR_NONE) {
2971 muse_camera_msg_get(get_width, pc->cb_info->recv_msg);
2972 muse_camera_msg_get(get_height, pc->cb_info->recv_msg);
2974 *height = get_height;
2976 LOGD("ret : 0x%x", ret);
2980 int camera_set_display_rotation(camera_h camera, camera_rotation_e rotation)
2982 int ret = CAMERA_ERROR_NONE;
2983 int set_rotation = (int)rotation;
2984 camera_cli_s *pc = NULL;
2986 if (camera == NULL) {
2987 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2988 return CAMERA_ERROR_INVALID_PARAMETER;
2991 if (rotation < CAMERA_ROTATION_NONE || rotation > CAMERA_ROTATION_270) {
2992 LOGE("Invalid rotation %d", rotation);
2993 return CAMERA_ERROR_INVALID_PARAMETER;
2996 pc = (camera_cli_s *)camera;
2998 if (pc->cb_info == NULL) {
2999 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3000 return CAMERA_ERROR_INVALID_PARAMETER;
3003 #ifdef EVAS_RENDERER_SUPPORT
3004 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
3005 g_mutex_lock(&pc->cb_info->evas_mutex);
3007 ret = mm_evas_renderer_set_rotation(pc->cb_info->evas_info, rotation);
3009 g_mutex_unlock(&pc->cb_info->evas_mutex);
3011 if (ret != MM_ERROR_NONE) {
3012 LOGE("failed to set rotation for evas surface 0x%x", ret);
3013 return CAMERA_ERROR_INVALID_OPERATION;
3016 #endif /* EVAS_RENDERER_SUPPORT */
3018 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_ROTATION,
3019 pc->cb_info->fd, pc->cb_info, ret, INT, set_rotation);
3024 int camera_get_display_rotation(camera_h camera, camera_rotation_e *rotation)
3026 int ret = CAMERA_ERROR_NONE;
3027 int get_rotation = CAMERA_ROTATION_NONE;
3028 camera_cli_s *pc = NULL;
3030 if (camera == NULL || rotation == NULL) {
3031 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3032 return CAMERA_ERROR_INVALID_PARAMETER;
3035 pc = (camera_cli_s *)camera;
3037 if (pc->cb_info == NULL) {
3038 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3039 return CAMERA_ERROR_INVALID_PARAMETER;
3042 muse_camera_msg_send(MUSE_CAMERA_API_GET_DISPLAY_ROTATION,
3043 pc->cb_info->fd, pc->cb_info, ret);
3045 if (ret == CAMERA_ERROR_NONE) {
3046 muse_camera_msg_get(get_rotation, pc->cb_info->recv_msg);
3047 *rotation = (camera_rotation_e)get_rotation;
3053 int camera_set_display_flip(camera_h camera, camera_flip_e flip)
3055 int ret = CAMERA_ERROR_NONE;
3056 int set_flip = (int)flip;
3057 camera_cli_s *pc = NULL;
3059 if (camera == NULL) {
3060 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3061 return CAMERA_ERROR_INVALID_PARAMETER;
3064 if (flip < CAMERA_FLIP_NONE || flip > CAMERA_FLIP_BOTH) {
3065 LOGE("Invalid flip %d", flip);
3066 return CAMERA_ERROR_INVALID_PARAMETER;
3069 pc = (camera_cli_s *)camera;
3071 if (pc->cb_info == NULL) {
3072 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3073 return CAMERA_ERROR_INVALID_PARAMETER;
3076 #ifdef EVAS_RENDERER_SUPPORT
3077 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
3078 g_mutex_lock(&pc->cb_info->evas_mutex);
3080 ret = mm_evas_renderer_set_flip(pc->cb_info->evas_info, flip);
3082 g_mutex_unlock(&pc->cb_info->evas_mutex);
3084 if (ret != MM_ERROR_NONE) {
3085 LOGE("failed to set flip for evas surface 0x%x", ret);
3086 return CAMERA_ERROR_INVALID_OPERATION;
3089 #endif /* EVAS_RENDERER_SUPPORT */
3091 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_FLIP,
3092 pc->cb_info->fd, pc->cb_info, ret, INT, set_flip);
3097 int camera_get_display_flip(camera_h camera, camera_flip_e *flip)
3099 int ret = CAMERA_ERROR_NONE;
3100 int get_flip = CAMERA_FLIP_NONE;
3101 camera_cli_s *pc = NULL;
3103 if (camera == NULL || flip == NULL) {
3104 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3105 return CAMERA_ERROR_INVALID_PARAMETER;
3108 pc = (camera_cli_s *)camera;
3110 if (pc->cb_info == NULL) {
3111 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3112 return CAMERA_ERROR_INVALID_PARAMETER;
3115 muse_camera_msg_send(MUSE_CAMERA_API_GET_DISPLAY_FLIP,
3116 pc->cb_info->fd, pc->cb_info, ret);
3118 if (ret == CAMERA_ERROR_NONE) {
3119 muse_camera_msg_get(get_flip, pc->cb_info->recv_msg);
3120 *flip = (camera_flip_e)get_flip;
3126 int camera_set_display_visible(camera_h camera, bool visible)
3128 int ret = CAMERA_ERROR_NONE;
3129 int set_visible = (int)visible;
3130 camera_cli_s *pc = NULL;
3132 if (camera == NULL) {
3133 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3134 return CAMERA_ERROR_INVALID_PARAMETER;
3137 pc = (camera_cli_s *)camera;
3139 if (pc->cb_info == NULL) {
3140 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3141 return CAMERA_ERROR_INVALID_PARAMETER;
3144 #ifdef EVAS_RENDERER_SUPPORT
3145 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
3146 g_mutex_lock(&pc->cb_info->evas_mutex);
3148 ret = mm_evas_renderer_set_visible(pc->cb_info->evas_info, visible);
3150 g_mutex_unlock(&pc->cb_info->evas_mutex);
3152 if (ret != MM_ERROR_NONE) {
3153 LOGE("failed to set visible for evas surface 0x%x", ret);
3154 return CAMERA_ERROR_INVALID_OPERATION;
3157 #endif /* EVAS_RENDERER_SUPPORT */
3159 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_VISIBLE,
3160 pc->cb_info->fd, pc->cb_info, ret, INT, set_visible);
3165 int camera_is_display_visible(camera_h camera, bool *visible)
3167 int ret = CAMERA_ERROR_NONE;
3168 int get_visible = true;
3169 camera_cli_s *pc = NULL;
3171 if (camera == NULL || visible == NULL) {
3172 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3173 return CAMERA_ERROR_INVALID_PARAMETER;
3176 pc = (camera_cli_s *)camera;
3178 if (pc->cb_info == NULL) {
3179 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3180 return CAMERA_ERROR_INVALID_PARAMETER;
3183 muse_camera_msg_send(MUSE_CAMERA_API_IS_DISPLAY_VISIBLE,
3184 pc->cb_info->fd, pc->cb_info, ret);
3186 if (ret == CAMERA_ERROR_NONE) {
3187 muse_camera_msg_get(get_visible, pc->cb_info->recv_msg);
3188 *visible = (bool)get_visible;
3194 int camera_set_display_mode(camera_h camera, camera_display_mode_e mode)
3196 int ret = CAMERA_ERROR_NONE;
3197 int set_mode = (int)mode;
3198 camera_cli_s *pc = NULL;
3200 if (camera == NULL) {
3201 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3202 return CAMERA_ERROR_INVALID_PARAMETER;
3205 if (mode < CAMERA_DISPLAY_MODE_LETTER_BOX || mode > CAMERA_DISPLAY_MODE_CUSTOM_ROI) {
3206 LOGE("Invalid mode %d", mode);
3207 return CAMERA_ERROR_INVALID_PARAMETER;
3210 pc = (camera_cli_s *)camera;
3212 if (pc->cb_info == NULL) {
3213 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3214 return CAMERA_ERROR_INVALID_PARAMETER;
3217 #ifdef EVAS_RENDERER_SUPPORT
3218 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
3219 g_mutex_lock(&pc->cb_info->evas_mutex);
3221 ret = mm_evas_renderer_set_geometry(pc->cb_info->evas_info, mode);
3223 g_mutex_unlock(&pc->cb_info->evas_mutex);
3225 if (ret != MM_ERROR_NONE) {
3226 LOGE("failed to set geometry for evas surface 0x%x", ret);
3227 return CAMERA_ERROR_INVALID_OPERATION;
3230 #endif /* EVAS_RENDERER_SUPPORT */
3232 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_MODE,
3233 pc->cb_info->fd, pc->cb_info, ret, INT, set_mode);
3238 int camera_get_display_mode(camera_h camera, camera_display_mode_e *mode)
3240 int ret = CAMERA_ERROR_NONE;
3241 int get_mode = CAMERA_DISPLAY_MODE_LETTER_BOX;
3242 camera_cli_s *pc = NULL;
3244 if (camera == NULL || mode == NULL) {
3245 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3246 return CAMERA_ERROR_INVALID_PARAMETER;
3249 pc = (camera_cli_s *)camera;
3251 if (pc->cb_info == NULL) {
3252 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3253 return CAMERA_ERROR_INVALID_PARAMETER;
3256 muse_camera_msg_send(MUSE_CAMERA_API_GET_DISPLAY_MODE,
3257 pc->cb_info->fd, pc->cb_info, ret);
3259 if (ret == CAMERA_ERROR_NONE) {
3260 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
3261 *mode = (camera_display_mode_e)get_mode;
3267 int camera_get_capture_resolution(camera_h camera, int *width, int *height)
3269 if (camera == NULL || width == NULL || height == NULL) {
3270 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3271 return CAMERA_ERROR_INVALID_PARAMETER;
3273 int ret = CAMERA_ERROR_NONE;
3275 camera_cli_s *pc = (camera_cli_s *)camera;
3276 muse_camera_api_e api = MUSE_CAMERA_API_GET_CAPTURE_RESOLUTION;
3278 if (pc->cb_info == NULL) {
3279 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3280 return CAMERA_ERROR_INVALID_PARAMETER;
3282 sock_fd = pc->cb_info->fd;
3286 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3287 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3289 if (ret == CAMERA_ERROR_NONE) {
3290 muse_camera_msg_get(get_width, pc->cb_info->recv_msg);
3291 muse_camera_msg_get(get_height, pc->cb_info->recv_msg);
3293 *height = get_height;
3295 LOGD("ret : 0x%x", ret);
3299 int camera_get_capture_format(camera_h camera, camera_pixel_format_e *format)
3301 if (camera == NULL || format == NULL) {
3302 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3303 return CAMERA_ERROR_INVALID_PARAMETER;
3305 int ret = CAMERA_ERROR_NONE;
3307 camera_cli_s *pc = (camera_cli_s *)camera;
3308 muse_camera_api_e api = MUSE_CAMERA_API_GET_CAPTURE_FORMAT;
3311 if (pc->cb_info == NULL) {
3312 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3313 return CAMERA_ERROR_INVALID_PARAMETER;
3315 sock_fd = pc->cb_info->fd;
3317 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3318 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3320 if (ret == CAMERA_ERROR_NONE) {
3321 muse_camera_msg_get(get_format, pc->cb_info->recv_msg);
3322 *format = (camera_pixel_format_e)get_format;
3324 LOGD("ret : 0x%x", ret);
3328 int camera_get_preview_format(camera_h camera, camera_pixel_format_e *format)
3330 if (camera == NULL || format == NULL) {
3331 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3332 return CAMERA_ERROR_INVALID_PARAMETER;
3335 int ret = CAMERA_ERROR_NONE;
3337 camera_cli_s *pc = (camera_cli_s *)camera;
3338 muse_camera_api_e api = MUSE_CAMERA_API_GET_PREVIEW_FORMAT;
3341 if (pc->cb_info == NULL) {
3342 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3343 return CAMERA_ERROR_INVALID_PARAMETER;
3345 sock_fd = pc->cb_info->fd;
3347 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3348 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3350 if (ret == CAMERA_ERROR_NONE) {
3351 muse_camera_msg_get(get_format, pc->cb_info->recv_msg);
3352 *format = (camera_pixel_format_e)get_format;
3354 LOGD("ret : 0x%x", ret);
3358 int camera_get_facing_direction(camera_h camera, camera_facing_direction_e *facing_direciton)
3360 if (camera == NULL || facing_direciton == NULL) {
3361 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3362 return CAMERA_ERROR_INVALID_PARAMETER;
3365 int ret = CAMERA_ERROR_NONE;
3367 camera_cli_s *pc = (camera_cli_s *)camera;
3368 muse_camera_api_e api = MUSE_CAMERA_API_GET_FACING_DIRECTION;
3370 if (pc->cb_info == NULL) {
3371 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3372 return CAMERA_ERROR_INVALID_PARAMETER;
3374 sock_fd = pc->cb_info->fd;
3375 int get_facing_direction;
3377 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3378 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3380 if (ret == CAMERA_ERROR_NONE) {
3381 muse_camera_msg_get(get_facing_direction, pc->cb_info->recv_msg);
3382 *facing_direciton = (camera_facing_direction_e)get_facing_direction;
3384 LOGD("ret : 0x%x", ret);
3388 int camera_set_preview_cb(camera_h camera, camera_preview_cb callback, void *user_data)
3390 if (camera == NULL || callback == NULL) {
3391 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3392 return CAMERA_ERROR_INVALID_PARAMETER;
3394 int ret = CAMERA_ERROR_NONE;
3396 camera_cli_s *pc = (camera_cli_s *)camera;
3397 camera_cb_info_s *cb_info = (camera_cb_info_s *)pc->cb_info;
3399 if (pc->cb_info == NULL) {
3400 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3401 return CAMERA_ERROR_INVALID_PARAMETER;
3403 sock_fd = pc->cb_info->fd;
3404 muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_CB;
3406 LOGD("Enter, handle :%x", pc->remote_handle);
3408 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = callback;
3409 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = user_data;
3410 SET_PREVIEW_CB_TYPE(cb_info, PREVIEW_CB_TYPE_USER);
3412 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3413 LOGD("ret : 0x%x", ret);
3417 int camera_unset_preview_cb(camera_h camera)
3419 if (camera == NULL) {
3420 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3421 return CAMERA_ERROR_INVALID_PARAMETER;
3424 int ret = CAMERA_ERROR_NONE;
3426 camera_cli_s *pc = (camera_cli_s *)camera;
3427 camera_cb_info_s *cb_info = (camera_cb_info_s *)pc->cb_info;
3428 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_PREVIEW_CB;
3430 LOGD("Enter, handle :%x", pc->remote_handle);
3433 if (pc->cb_info == NULL) {
3434 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3435 return CAMERA_ERROR_INVALID_PARAMETER;
3437 sock_fd = pc->cb_info->fd;
3438 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = (void *)NULL;
3439 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = (void *)NULL;
3440 UNSET_PREVIEW_CB_TYPE(cb_info, PREVIEW_CB_TYPE_USER);
3442 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3443 LOGD("ret : 0x%x", ret);
3447 int camera_set_media_packet_preview_cb(camera_h camera, camera_media_packet_preview_cb callback, void *user_data)
3449 if (camera == NULL) {
3450 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
3451 return CAMERA_ERROR_INVALID_PARAMETER;
3454 if (camera_is_supported_media_packet_preview_cb(camera) == false) {
3455 LOGE("NOT SUPPORTED");
3456 return CAMERA_ERROR_NOT_SUPPORTED;
3459 if (callback == NULL) {
3460 LOGE("INVALID_PARAMETER(0x%08x) - callback", CAMERA_ERROR_INVALID_PARAMETER);
3461 return CAMERA_ERROR_INVALID_PARAMETER;
3464 int ret = CAMERA_ERROR_NONE;
3466 camera_cli_s *pc = (camera_cli_s *)camera;
3467 muse_camera_api_e api = MUSE_CAMERA_API_SET_MEDIA_PACKET_PREVIEW_CB;
3469 LOGD("Enter, handle :%x", pc->remote_handle);
3472 if (pc->cb_info == NULL) {
3473 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3474 return CAMERA_ERROR_INVALID_PARAMETER;
3476 sock_fd = pc->cb_info->fd;
3477 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = callback;
3478 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = user_data;
3480 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3481 LOGD("ret : 0x%x", ret);
3485 int camera_unset_media_packet_preview_cb(camera_h camera)
3487 if (camera == NULL) {
3488 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3489 return CAMERA_ERROR_INVALID_PARAMETER;
3492 int ret = CAMERA_ERROR_NONE;
3494 camera_cli_s *pc = (camera_cli_s *)camera;
3495 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_MEDIA_PACKET_PREVIEW_CB;
3497 LOGD("Enter, handle :%x", pc->remote_handle);
3500 if (pc->cb_info == NULL) {
3501 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3502 return CAMERA_ERROR_INVALID_PARAMETER;
3504 sock_fd = pc->cb_info->fd;
3505 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = (void *)NULL;
3506 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = (void *)NULL;
3508 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3509 LOGD("ret : 0x%x", ret);
3513 int camera_set_state_changed_cb(camera_h camera, camera_state_changed_cb callback, void *user_data)
3515 if (camera == NULL || callback == NULL) {
3516 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3517 return CAMERA_ERROR_INVALID_PARAMETER;
3519 int ret = CAMERA_ERROR_NONE;
3521 camera_cli_s *pc = (camera_cli_s *)camera;
3522 muse_camera_api_e api = MUSE_CAMERA_API_SET_STATE_CHANGED_CB;
3524 LOGD("Enter, handle :%x", pc->remote_handle);
3527 if (pc->cb_info == NULL) {
3528 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3529 return CAMERA_ERROR_INVALID_PARAMETER;
3531 sock_fd = pc->cb_info->fd;
3532 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = callback;
3533 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = user_data;
3535 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3536 LOGD("ret : 0x%x", ret);
3539 int camera_unset_state_changed_cb(camera_h camera)
3541 if (camera == NULL) {
3542 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3543 return CAMERA_ERROR_INVALID_PARAMETER;
3545 int ret = CAMERA_ERROR_NONE;
3547 camera_cli_s *pc = (camera_cli_s *)camera;
3548 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_STATE_CHANGED_CB;
3550 LOGD("Enter, handle :%x", pc->remote_handle);
3553 if (pc->cb_info == NULL) {
3554 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3555 return CAMERA_ERROR_INVALID_PARAMETER;
3557 sock_fd = pc->cb_info->fd;
3558 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = (void *)NULL;
3559 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = (void *)NULL;
3561 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3562 LOGD("ret : 0x%x", ret);
3566 int camera_set_interrupted_cb(camera_h camera, camera_interrupted_cb callback, void *user_data)
3568 if (camera == NULL || callback == NULL) {
3569 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3570 return CAMERA_ERROR_INVALID_PARAMETER;
3572 int ret = CAMERA_ERROR_NONE;
3574 camera_cli_s *pc = (camera_cli_s *)camera;
3575 muse_camera_api_e api = MUSE_CAMERA_API_SET_INTERRUPTED_CB;
3577 LOGD("Enter, handle :%x", pc->remote_handle);
3580 if (pc->cb_info == NULL) {
3581 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3582 return CAMERA_ERROR_INVALID_PARAMETER;
3584 sock_fd = pc->cb_info->fd;
3585 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = callback;
3586 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = user_data;
3588 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3589 LOGD("ret : 0x%x", ret);
3593 int camera_unset_interrupted_cb(camera_h camera)
3595 if (camera == NULL) {
3596 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3597 return CAMERA_ERROR_INVALID_PARAMETER;
3599 int ret = CAMERA_ERROR_NONE;
3601 camera_cli_s *pc = (camera_cli_s *)camera;
3602 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_INTERRUPTED_CB;
3604 LOGD("Enter, handle :%x", pc->remote_handle);
3607 if (pc->cb_info == NULL) {
3608 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3609 return CAMERA_ERROR_INVALID_PARAMETER;
3611 sock_fd = pc->cb_info->fd;
3612 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = (void *)NULL;
3613 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = (void *)NULL;
3615 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3616 LOGD("ret : 0x%x", ret);
3620 int camera_set_focus_changed_cb(camera_h camera, camera_focus_changed_cb callback, void *user_data)
3622 if (camera == NULL || callback == NULL) {
3623 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3624 return CAMERA_ERROR_INVALID_PARAMETER;
3626 int ret = CAMERA_ERROR_NONE;
3628 camera_cli_s *pc = (camera_cli_s *)camera;
3629 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOCUS_CHANGED_CB;
3631 LOGD("Enter, handle :%x", pc->remote_handle);
3634 if (pc->cb_info == NULL) {
3635 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3636 return CAMERA_ERROR_INVALID_PARAMETER;
3638 sock_fd = pc->cb_info->fd;
3639 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = callback;
3640 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = user_data;
3642 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3643 LOGD("ret : 0x%x", ret);
3647 int camera_unset_focus_changed_cb(camera_h camera)
3649 if (camera == NULL) {
3650 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3651 return CAMERA_ERROR_INVALID_PARAMETER;
3653 int ret = CAMERA_ERROR_NONE;
3655 camera_cli_s *pc = (camera_cli_s *)camera;
3656 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_FOCUS_CHANGED_CB;
3658 LOGD("Enter, handle :%x", pc->remote_handle);
3661 if (pc->cb_info == NULL) {
3662 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3663 return CAMERA_ERROR_INVALID_PARAMETER;
3665 sock_fd = pc->cb_info->fd;
3666 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = (void *)NULL;
3667 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = (void *)NULL;
3669 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3670 LOGD("ret : 0x%x", ret);
3674 int camera_set_error_cb(camera_h camera, camera_error_cb callback, void *user_data)
3676 if (camera == NULL || callback == NULL) {
3677 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3678 return CAMERA_ERROR_INVALID_PARAMETER;
3680 int ret = CAMERA_ERROR_NONE;
3682 camera_cli_s *pc = (camera_cli_s *)camera;
3683 muse_camera_api_e api = MUSE_CAMERA_API_SET_ERROR_CB;
3685 LOGD("Enter, handle :%x", pc->remote_handle);
3688 if (pc->cb_info == NULL) {
3689 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3690 return CAMERA_ERROR_INVALID_PARAMETER;
3692 sock_fd = pc->cb_info->fd;
3693 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_ERROR] = callback;
3694 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_ERROR] = user_data;
3696 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3697 LOGD("ret : 0x%x", ret);
3701 int camera_unset_error_cb(camera_h camera)
3703 if (camera == NULL) {
3704 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3705 return CAMERA_ERROR_INVALID_PARAMETER;
3707 int ret = CAMERA_ERROR_NONE;
3709 camera_cli_s *pc = (camera_cli_s *)camera;
3710 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_ERROR_CB;
3712 LOGD("Enter, handle :%x", pc->remote_handle);
3715 if (pc->cb_info == NULL) {
3716 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3717 return CAMERA_ERROR_INVALID_PARAMETER;
3719 sock_fd = pc->cb_info->fd;
3720 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_ERROR] = (void *)NULL;
3721 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_ERROR] = (void *)NULL;
3723 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3724 LOGD("ret : 0x%x", ret);
3728 int camera_foreach_supported_preview_resolution(camera_h camera, camera_supported_preview_resolution_cb foreach_cb , void *user_data)
3730 if (camera == NULL || foreach_cb == NULL) {
3731 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3732 return CAMERA_ERROR_INVALID_PARAMETER;
3734 int ret = CAMERA_ERROR_NONE;
3736 camera_cli_s *pc = (camera_cli_s *)camera;
3737 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_PREVIEW_RESOLUTION;
3739 LOGD("Enter, handle :%x", pc->remote_handle);
3742 if (pc->cb_info == NULL) {
3743 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3744 return CAMERA_ERROR_INVALID_PARAMETER;
3746 sock_fd = pc->cb_info->fd;
3747 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_RESOLUTION] = foreach_cb;
3748 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_RESOLUTION] = user_data;
3750 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3751 LOGD("ret : 0x%x", ret);
3755 int camera_foreach_supported_capture_resolution(camera_h camera, camera_supported_capture_resolution_cb foreach_cb , void *user_data)
3757 if (camera == NULL || foreach_cb == NULL) {
3758 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3759 return CAMERA_ERROR_INVALID_PARAMETER;
3761 int ret = CAMERA_ERROR_NONE;
3763 camera_cli_s *pc = (camera_cli_s *)camera;
3764 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_CAPTURE_RESOLUTION;
3766 LOGD("Enter, handle :%x", pc->remote_handle);
3769 if (pc->cb_info == NULL) {
3770 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3771 return CAMERA_ERROR_INVALID_PARAMETER;
3773 sock_fd = pc->cb_info->fd;
3774 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_RESOLUTION] = foreach_cb;
3775 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_RESOLUTION] = user_data;
3777 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3778 LOGD("ret : 0x%x", ret);
3782 int camera_foreach_supported_capture_format(camera_h camera, camera_supported_capture_format_cb foreach_cb , void *user_data)
3784 if (camera == NULL || foreach_cb == NULL) {
3785 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3786 return CAMERA_ERROR_INVALID_PARAMETER;
3788 int ret = CAMERA_ERROR_NONE;
3790 camera_cli_s *pc = (camera_cli_s *)camera;
3791 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_CAPTURE_FORMAT;
3793 LOGD("Enter, handle :%x", pc->remote_handle);
3796 if (pc->cb_info == NULL) {
3797 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3798 return CAMERA_ERROR_INVALID_PARAMETER;
3800 sock_fd = pc->cb_info->fd;
3801 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_FORMAT] = foreach_cb;
3802 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_FORMAT] = user_data;
3804 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3805 LOGD("ret : 0x%x", ret);
3810 int camera_foreach_supported_preview_format(camera_h camera, camera_supported_preview_format_cb foreach_cb , void *user_data)
3812 if (camera == NULL || foreach_cb == NULL) {
3813 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3814 return CAMERA_ERROR_INVALID_PARAMETER;
3816 int ret = CAMERA_ERROR_NONE;
3818 camera_cli_s *pc = (camera_cli_s *)camera;
3819 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_PREVIEW_FORMAT;
3821 LOGD("Enter, handle :%x", pc->remote_handle);
3824 if (pc->cb_info == NULL) {
3825 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3826 return CAMERA_ERROR_INVALID_PARAMETER;
3828 sock_fd = pc->cb_info->fd;
3829 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_FORMAT] = foreach_cb;
3830 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_FORMAT] = user_data;
3832 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3833 LOGD("ret : 0x%x", ret);
3838 int camera_get_recommended_preview_resolution(camera_h camera, int *width, int *height)
3840 if (camera == NULL || width == NULL || height == NULL) {
3841 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3842 return CAMERA_ERROR_INVALID_PARAMETER;
3844 int ret = CAMERA_ERROR_NONE;
3846 camera_cli_s *pc = (camera_cli_s *)camera;
3847 muse_camera_api_e api = MUSE_CAMERA_API_GET_RECOMMENDED_PREVIEW_RESOLUTION;
3849 if (pc->cb_info == NULL) {
3850 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3851 return CAMERA_ERROR_INVALID_PARAMETER;
3853 sock_fd = pc->cb_info->fd;
3857 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3858 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3860 if (ret == CAMERA_ERROR_NONE) {
3861 muse_camera_msg_get(get_width, pc->cb_info->recv_msg);
3862 muse_camera_msg_get(get_height, pc->cb_info->recv_msg);
3864 *height = get_height;
3866 LOGD("ret : 0x%x", ret);
3871 int camera_attr_get_lens_orientation(camera_h camera, int *angle)
3873 if (camera == NULL || angle == NULL) {
3874 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3875 return CAMERA_ERROR_INVALID_PARAMETER;
3877 int ret = CAMERA_ERROR_NONE;
3879 camera_cli_s *pc = (camera_cli_s *)camera;
3880 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_LENS_ORIENTATION;
3882 if (pc->cb_info == NULL) {
3883 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3884 return CAMERA_ERROR_INVALID_PARAMETER;
3886 sock_fd = pc->cb_info->fd;
3889 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3890 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3892 if (ret == CAMERA_ERROR_NONE) {
3893 muse_camera_msg_get(get_angle, pc->cb_info->recv_msg);
3896 LOGD("ret : 0x%x", ret);
3900 int camera_attr_set_theater_mode(camera_h camera, camera_attr_theater_mode_e mode)
3902 if (camera == NULL) {
3903 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3904 return CAMERA_ERROR_INVALID_PARAMETER;
3906 int ret = CAMERA_ERROR_NONE;
3907 camera_cli_s *pc = (camera_cli_s *)camera;
3908 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_THEATER_MODE;
3910 if (pc->cb_info == NULL) {
3911 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3912 return CAMERA_ERROR_INVALID_PARAMETER;
3914 sock_fd = pc->cb_info->fd;
3915 int set_mode = (int)mode;
3916 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3917 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
3918 LOGD("ret : 0x%x", ret);
3922 int camera_attr_get_theater_mode(camera_h camera, camera_attr_theater_mode_e *mode)
3924 if (camera == NULL || mode == NULL) {
3925 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3926 return CAMERA_ERROR_INVALID_PARAMETER;
3929 int ret = CAMERA_ERROR_NONE;
3930 camera_cli_s *pc = (camera_cli_s *)camera;
3931 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_THEATER_MODE;
3933 if (pc->cb_info == NULL) {
3934 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3935 return CAMERA_ERROR_INVALID_PARAMETER;
3937 sock_fd = pc->cb_info->fd;
3939 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3940 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3942 if (ret == CAMERA_ERROR_NONE) {
3943 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
3944 *mode = (camera_attr_theater_mode_e)get_mode;
3946 LOGD("ret : 0x%x", ret);
3950 int camera_attr_foreach_supported_theater_mode(camera_h camera, camera_attr_supported_theater_mode_cb foreach_cb, void *user_data)
3952 if (camera == NULL || foreach_cb == NULL) {
3953 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3954 return CAMERA_ERROR_INVALID_PARAMETER;
3956 int ret = CAMERA_ERROR_NONE;
3958 camera_cli_s *pc = (camera_cli_s *)camera;
3959 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_THEATER_MODE;
3961 LOGD("Enter, handle :%x", pc->remote_handle);
3964 if (pc->cb_info == NULL) {
3965 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3966 return CAMERA_ERROR_INVALID_PARAMETER;
3968 sock_fd = pc->cb_info->fd;
3969 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE] = foreach_cb;
3970 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE] = user_data;
3972 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3974 LOGD("Finish, return :%x", ret);
3979 int camera_attr_set_preview_fps(camera_h camera, camera_attr_fps_e fps)
3981 if (camera == NULL) {
3982 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3983 return CAMERA_ERROR_INVALID_PARAMETER;
3985 int ret = CAMERA_ERROR_NONE;
3986 camera_cli_s *pc = (camera_cli_s *)camera;
3987 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_PREVIEW_FPS;
3989 if (pc->cb_info == NULL) {
3990 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3991 return CAMERA_ERROR_INVALID_PARAMETER;
3993 sock_fd = pc->cb_info->fd;
3994 int set_fps = (int)fps;
3995 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3996 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_fps);
3997 LOGD("ret : 0x%x", ret);
4002 int camera_attr_set_image_quality(camera_h camera, int quality)
4004 if (camera == NULL) {
4005 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4006 return CAMERA_ERROR_INVALID_PARAMETER;
4008 int ret = CAMERA_ERROR_NONE;
4010 camera_cli_s *pc = (camera_cli_s *)camera;
4011 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_IMAGE_QUALITY;
4013 if (pc->cb_info == NULL) {
4014 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4015 return CAMERA_ERROR_INVALID_PARAMETER;
4017 sock_fd = pc->cb_info->fd;
4018 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4019 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, quality);
4020 LOGD("ret : 0x%x", ret);
4024 int camera_attr_get_preview_fps(camera_h camera, camera_attr_fps_e *fps)
4026 if (camera == NULL || fps == NULL) {
4027 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4028 return CAMERA_ERROR_INVALID_PARAMETER;
4030 int ret = CAMERA_ERROR_NONE;
4032 camera_cli_s *pc = (camera_cli_s *)camera;
4033 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_PREVIEW_FPS;
4036 if (pc->cb_info == NULL) {
4037 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4038 return CAMERA_ERROR_INVALID_PARAMETER;
4040 sock_fd = pc->cb_info->fd;
4042 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4043 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4045 if (ret == CAMERA_ERROR_NONE) {
4046 muse_camera_msg_get(get_fps, pc->cb_info->recv_msg);
4047 *fps = (camera_attr_fps_e)get_fps;
4049 LOGD("ret : 0x%x", ret);
4054 int camera_attr_get_image_quality(camera_h camera, int *quality)
4056 if (camera == NULL || quality == NULL) {
4057 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4058 return CAMERA_ERROR_INVALID_PARAMETER;
4060 int ret = CAMERA_ERROR_NONE;
4062 camera_cli_s *pc = (camera_cli_s *)camera;
4063 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_IMAGE_QUALITY;
4065 if (pc->cb_info == NULL) {
4066 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4067 return CAMERA_ERROR_INVALID_PARAMETER;
4069 sock_fd = pc->cb_info->fd;
4071 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4072 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4074 if (ret == CAMERA_ERROR_NONE) {
4075 muse_camera_msg_get(get_quality, pc->cb_info->recv_msg);
4076 *quality = get_quality;
4078 LOGD("ret : 0x%x", ret);
4083 int camera_attr_get_encoded_preview_bitrate(camera_h camera, int *bitrate)
4085 if (camera == NULL || bitrate == NULL) {
4086 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4087 return CAMERA_ERROR_INVALID_PARAMETER;
4090 int ret = CAMERA_ERROR_NONE;
4092 camera_cli_s *pc = (camera_cli_s *)camera;
4093 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ENCODED_PREVIEW_BITRATE;
4095 if (pc->cb_info == NULL) {
4096 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4097 return CAMERA_ERROR_INVALID_PARAMETER;
4099 sock_fd = pc->cb_info->fd;
4102 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4103 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4105 if (ret == CAMERA_ERROR_NONE) {
4106 muse_camera_msg_get(get_bitrate, pc->cb_info->recv_msg);
4107 *bitrate = get_bitrate;
4109 LOGD("ret : 0x%x", ret);
4114 int camera_attr_set_encoded_preview_bitrate(camera_h camera, int bitrate)
4116 if (camera == NULL) {
4117 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4118 return CAMERA_ERROR_INVALID_PARAMETER;
4121 int ret = CAMERA_ERROR_NONE;
4123 camera_cli_s *pc = (camera_cli_s *)camera;
4124 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ENCODED_PREVIEW_BITRATE;
4126 if (pc->cb_info == NULL) {
4127 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4128 return CAMERA_ERROR_INVALID_PARAMETER;
4130 sock_fd = pc->cb_info->fd;
4131 int set_bitrate = bitrate;
4132 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4133 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_bitrate);
4134 LOGD("ret : 0x%x", ret);
4139 int camera_attr_get_encoded_preview_gop_interval(camera_h camera, int *interval)
4141 if (camera == NULL || interval == NULL) {
4142 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4143 return CAMERA_ERROR_INVALID_PARAMETER;
4146 int ret = CAMERA_ERROR_NONE;
4148 camera_cli_s *pc = (camera_cli_s *)camera;
4149 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ENCODED_PREVIEW_GOP_INTERVAL;
4151 if (pc->cb_info == NULL) {
4152 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4153 return CAMERA_ERROR_INVALID_PARAMETER;
4155 sock_fd = pc->cb_info->fd;
4156 int get_gop_interval;
4158 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4159 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4161 if (ret == CAMERA_ERROR_NONE) {
4162 muse_camera_msg_get(get_gop_interval, pc->cb_info->recv_msg);
4163 *interval = get_gop_interval;
4165 LOGD("ret : 0x%x", ret);
4170 int camera_attr_set_encoded_preview_gop_interval(camera_h camera, int interval)
4172 if (camera == NULL) {
4173 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4174 return CAMERA_ERROR_INVALID_PARAMETER;
4177 int ret = CAMERA_ERROR_NONE;
4179 camera_cli_s *pc = (camera_cli_s *)camera;
4180 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ENCODED_PREVIEW_GOP_INTERVAL;
4182 if (pc->cb_info == NULL) {
4183 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4184 return CAMERA_ERROR_INVALID_PARAMETER;
4186 sock_fd = pc->cb_info->fd;
4187 int set_gop_interval = interval;
4188 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4189 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_gop_interval);
4190 LOGD("ret : 0x%x", ret);
4195 int camera_attr_set_zoom(camera_h camera, int zoom)
4197 if (camera == NULL) {
4198 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4199 return CAMERA_ERROR_INVALID_PARAMETER;
4201 int ret = CAMERA_ERROR_NONE;
4203 camera_cli_s *pc = (camera_cli_s *)camera;
4204 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ZOOM;
4206 if (pc->cb_info == NULL) {
4207 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4208 return CAMERA_ERROR_INVALID_PARAMETER;
4210 sock_fd = pc->cb_info->fd;
4212 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4213 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, zoom);
4214 LOGD("ret : 0x%x", ret);
4218 int camera_attr_set_af_mode(camera_h camera, camera_attr_af_mode_e mode)
4220 if (camera == NULL) {
4221 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4222 return CAMERA_ERROR_INVALID_PARAMETER;
4224 int ret = CAMERA_ERROR_NONE;
4226 camera_cli_s *pc = (camera_cli_s *)camera;
4227 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_AF_MODE;
4229 if (pc->cb_info == NULL) {
4230 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4231 return CAMERA_ERROR_INVALID_PARAMETER;
4233 sock_fd = pc->cb_info->fd;
4234 int set_mode = (int)mode;
4235 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4236 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
4237 LOGD("ret : 0x%x", ret);
4241 int camera_attr_set_af_area(camera_h camera, int x, int y)
4243 if (camera == NULL) {
4244 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4245 return CAMERA_ERROR_INVALID_PARAMETER;
4247 int ret = CAMERA_ERROR_NONE;
4248 camera_cli_s *pc = (camera_cli_s *)camera;
4249 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_AF_AREA;
4250 int sock_fd = pc->cb_info->fd;
4251 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4252 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, x, INT, y);
4253 LOGD("ret : 0x%x", ret);
4258 int camera_attr_clear_af_area(camera_h camera)
4260 if (camera == NULL) {
4261 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4262 return CAMERA_ERROR_INVALID_PARAMETER;
4264 int ret = CAMERA_ERROR_NONE;
4266 camera_cli_s *pc = (camera_cli_s *)camera;
4267 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_CLEAR_AF_AREA;
4269 if (pc->cb_info == NULL) {
4270 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4271 return CAMERA_ERROR_INVALID_PARAMETER;
4273 sock_fd = pc->cb_info->fd;
4274 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4275 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4276 LOGD("ret : 0x%x", ret);
4281 int camera_attr_set_exposure_mode(camera_h camera, camera_attr_exposure_mode_e mode)
4283 if (camera == NULL) {
4284 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4285 return CAMERA_ERROR_INVALID_PARAMETER;
4288 if (mode < CAMERA_ATTR_EXPOSURE_MODE_OFF || mode > CAMERA_ATTR_EXPOSURE_MODE_CUSTOM) {
4289 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4290 return CAMERA_ERROR_INVALID_PARAMETER;
4293 int ret = CAMERA_ERROR_NONE;
4294 camera_cli_s *pc = (camera_cli_s *)camera;
4295 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EXPOSURE_MODE;
4296 int set_mode = (int)mode;
4298 if (pc->cb_info == NULL) {
4299 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4300 return CAMERA_ERROR_INVALID_PARAMETER;
4302 sock_fd = pc->cb_info->fd;
4303 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4304 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
4305 LOGD("ret : 0x%x", ret);
4310 int camera_attr_set_exposure(camera_h camera, int value)
4312 if (camera == NULL) {
4313 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4314 return CAMERA_ERROR_INVALID_PARAMETER;
4316 int ret = CAMERA_ERROR_NONE;
4318 camera_cli_s *pc = (camera_cli_s *)camera;
4319 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EXPOSURE;
4321 if (pc->cb_info == NULL) {
4322 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4323 return CAMERA_ERROR_INVALID_PARAMETER;
4325 sock_fd = pc->cb_info->fd;
4327 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4328 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, value);
4329 LOGD("ret : 0x%x", ret);
4334 int camera_attr_set_iso(camera_h camera, camera_attr_iso_e iso)
4336 if (camera == NULL) {
4337 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4338 return CAMERA_ERROR_INVALID_PARAMETER;
4340 int ret = CAMERA_ERROR_NONE;
4342 camera_cli_s *pc = (camera_cli_s *)camera;
4343 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ISO;
4345 if (pc->cb_info == NULL) {
4346 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4347 return CAMERA_ERROR_INVALID_PARAMETER;
4349 sock_fd = pc->cb_info->fd;
4350 int set_iso = (int)iso;
4351 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4352 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_iso);
4353 LOGD("ret : 0x%x", ret);
4358 int camera_attr_set_brightness(camera_h camera, int level)
4360 if (camera == NULL) {
4361 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4362 return CAMERA_ERROR_INVALID_PARAMETER;
4364 int ret = CAMERA_ERROR_NONE;
4366 camera_cli_s *pc = (camera_cli_s *)camera;
4367 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_BRIGHTNESS;
4369 if (pc->cb_info == NULL) {
4370 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4371 return CAMERA_ERROR_INVALID_PARAMETER;
4373 sock_fd = pc->cb_info->fd;
4375 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4376 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, level);
4377 LOGD("ret : 0x%x", ret);
4382 int camera_attr_set_contrast(camera_h camera, int level)
4384 if (camera == NULL) {
4385 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4386 return CAMERA_ERROR_INVALID_PARAMETER;
4388 int ret = CAMERA_ERROR_NONE;
4390 camera_cli_s *pc = (camera_cli_s *)camera;
4391 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_CONTRAST;
4393 if (pc->cb_info == NULL) {
4394 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4395 return CAMERA_ERROR_INVALID_PARAMETER;
4397 sock_fd = pc->cb_info->fd;
4399 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4400 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, level);
4401 LOGD("ret : 0x%x", ret);
4406 int camera_attr_set_whitebalance(camera_h camera, camera_attr_whitebalance_e wb)
4408 if (camera == NULL) {
4409 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4410 return CAMERA_ERROR_INVALID_PARAMETER;
4413 if (wb < CAMERA_ATTR_WHITE_BALANCE_NONE || wb > CAMERA_ATTR_WHITE_BALANCE_CUSTOM) {
4414 LOGE("invalid white balance %d", wb);
4415 return CAMERA_ERROR_INVALID_PARAMETER;
4418 int ret = CAMERA_ERROR_NONE;
4420 camera_cli_s *pc = (camera_cli_s *)camera;
4421 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_WHITEBALANCE;
4423 if (pc->cb_info == NULL) {
4424 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4425 return CAMERA_ERROR_INVALID_PARAMETER;
4427 sock_fd = pc->cb_info->fd;
4428 int set_whitebalance = (int)wb;
4429 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4430 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_whitebalance);
4431 LOGD("ret : 0x%x", ret);
4436 int camera_attr_set_effect(camera_h camera, camera_attr_effect_mode_e effect)
4438 if (camera == NULL) {
4439 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4440 return CAMERA_ERROR_INVALID_PARAMETER;
4442 int ret = CAMERA_ERROR_NONE;
4444 camera_cli_s *pc = (camera_cli_s *)camera;
4445 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EFFECT;
4447 if (pc->cb_info == NULL) {
4448 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4449 return CAMERA_ERROR_INVALID_PARAMETER;
4451 sock_fd = pc->cb_info->fd;
4452 int set_effect = (int)effect;
4453 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4454 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_effect);
4455 LOGD("ret : 0x%x", ret);
4460 int camera_attr_set_scene_mode(camera_h camera, camera_attr_scene_mode_e mode)
4462 if (camera == NULL) {
4463 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4464 return CAMERA_ERROR_INVALID_PARAMETER;
4466 int ret = CAMERA_ERROR_NONE;
4468 camera_cli_s *pc = (camera_cli_s *)camera;
4469 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_SCENE_MODE;
4471 if (pc->cb_info == NULL) {
4472 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4473 return CAMERA_ERROR_INVALID_PARAMETER;
4475 sock_fd = pc->cb_info->fd;
4476 int set_mode = (int)mode;
4477 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4478 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
4479 LOGD("ret : 0x%x", ret);
4484 int camera_attr_enable_tag(camera_h camera, bool enable)
4486 if (camera == NULL) {
4487 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4488 return CAMERA_ERROR_INVALID_PARAMETER;
4490 int ret = CAMERA_ERROR_NONE;
4491 camera_cli_s *pc = (camera_cli_s *)camera;
4492 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_TAG;
4494 if (pc->cb_info == NULL) {
4495 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4496 return CAMERA_ERROR_INVALID_PARAMETER;
4498 sock_fd = pc->cb_info->fd;
4499 int set_enable = (int)enable;
4501 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4502 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
4503 LOGD("ret : 0x%x", ret);
4508 int camera_attr_set_tag_image_description(camera_h camera, const char *description)
4510 if (camera == NULL) {
4511 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4512 return CAMERA_ERROR_INVALID_PARAMETER;
4514 if (description == NULL) {
4515 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4516 return CAMERA_ERROR_INVALID_PARAMETER;
4518 int ret = CAMERA_ERROR_NONE;
4519 camera_cli_s *pc = (camera_cli_s *)camera;
4520 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_IMAGE_DESCRIPTION;
4522 if (pc->cb_info == NULL) {
4523 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4524 return CAMERA_ERROR_INVALID_PARAMETER;
4526 sock_fd = pc->cb_info->fd;
4527 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4528 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, STRING, description);
4529 LOGD("ret : 0x%x", ret);
4534 int camera_attr_set_tag_orientation(camera_h camera, camera_attr_tag_orientation_e orientation)
4536 if (camera == NULL) {
4537 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4538 return CAMERA_ERROR_INVALID_PARAMETER;
4540 int ret = CAMERA_ERROR_NONE;
4541 camera_cli_s *pc = (camera_cli_s *)camera;
4542 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_ORIENTATION;
4544 if (pc->cb_info == NULL) {
4545 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4546 return CAMERA_ERROR_INVALID_PARAMETER;
4548 sock_fd = pc->cb_info->fd;
4549 int set_orientation = (int)orientation;
4551 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4552 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_orientation);
4553 LOGD("ret : 0x%x", ret);
4558 int camera_attr_set_tag_software(camera_h camera, const char *software)
4560 if (camera == NULL) {
4561 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4562 return CAMERA_ERROR_INVALID_PARAMETER;
4564 if (software == NULL) {
4565 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4566 return CAMERA_ERROR_INVALID_PARAMETER;
4568 int ret = CAMERA_ERROR_NONE;
4569 camera_cli_s *pc = (camera_cli_s *)camera;
4570 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_SOFTWARE;
4572 if (pc->cb_info == NULL) {
4573 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4574 return CAMERA_ERROR_INVALID_PARAMETER;
4576 sock_fd = pc->cb_info->fd;
4577 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4578 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, STRING, software);
4579 LOGD("ret : 0x%x", ret);
4584 int camera_attr_set_geotag(camera_h camera, double latitude , double longitude, double altitude)
4586 if (camera == NULL) {
4587 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4588 return CAMERA_ERROR_INVALID_PARAMETER;
4590 int ret = CAMERA_ERROR_NONE;
4591 camera_cli_s *pc = (camera_cli_s *)camera;
4592 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_GEOTAG;
4594 if (pc->cb_info == NULL) {
4595 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4596 return CAMERA_ERROR_INVALID_PARAMETER;
4598 sock_fd = pc->cb_info->fd;
4599 double set_geotag[3] = { latitude, longitude, altitude };
4601 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4602 muse_camera_msg_send_array(api, sock_fd, pc->cb_info, ret,
4603 set_geotag, sizeof(set_geotag), sizeof(double));
4604 LOGD("ret : 0x%x", ret);
4609 int camera_attr_remove_geotag(camera_h camera)
4611 if (camera == NULL) {
4612 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4613 return CAMERA_ERROR_INVALID_PARAMETER;
4615 int ret = CAMERA_ERROR_NONE;
4616 camera_cli_s *pc = (camera_cli_s *)camera;
4617 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_REMOVE_GEOTAG;
4619 if (pc->cb_info == NULL) {
4620 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4621 return CAMERA_ERROR_INVALID_PARAMETER;
4623 sock_fd = pc->cb_info->fd;
4624 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4625 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4626 LOGD("ret : 0x%x", ret);
4631 int camera_attr_set_flash_mode(camera_h camera, camera_attr_flash_mode_e mode)
4633 if (camera == NULL) {
4634 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4635 return CAMERA_ERROR_INVALID_PARAMETER;
4637 int ret = CAMERA_ERROR_NONE;
4638 camera_cli_s *pc = (camera_cli_s *)camera;
4639 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_FLASH_MODE;
4641 if (pc->cb_info == NULL) {
4642 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4643 return CAMERA_ERROR_INVALID_PARAMETER;
4645 sock_fd = pc->cb_info->fd;
4646 int set_mode = (int)mode;
4648 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4649 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
4650 LOGD("ret : 0x%x", ret);
4655 int camera_attr_get_zoom(camera_h camera, int *zoom)
4657 if (camera == NULL || zoom == NULL) {
4658 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4659 return CAMERA_ERROR_INVALID_PARAMETER;
4661 int ret = CAMERA_ERROR_NONE;
4663 camera_cli_s *pc = (camera_cli_s *)camera;
4664 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ZOOM;
4667 if (pc->cb_info == NULL) {
4668 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4669 return CAMERA_ERROR_INVALID_PARAMETER;
4671 sock_fd = pc->cb_info->fd;
4673 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4674 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4676 if (ret == CAMERA_ERROR_NONE) {
4677 muse_camera_msg_get(get_zoom, pc->cb_info->recv_msg);
4680 LOGD("ret : 0x%x", ret);
4685 int camera_attr_get_zoom_range(camera_h camera, int *min, int *max)
4687 if (camera == NULL || min == NULL || max == NULL) {
4688 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4689 return CAMERA_ERROR_INVALID_PARAMETER;
4691 int ret = CAMERA_ERROR_NONE;
4692 camera_cli_s *pc = (camera_cli_s *)camera;
4694 if (pc->cb_info == NULL) {
4695 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4696 return CAMERA_ERROR_INVALID_PARAMETER;
4698 sock_fd = pc->cb_info->fd;
4699 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ZOOM_RANGE;
4703 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4704 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4706 if (ret == CAMERA_ERROR_NONE) {
4707 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
4708 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
4712 LOGD("ret : 0x%x", ret);
4717 int camera_attr_get_af_mode(camera_h camera, camera_attr_af_mode_e *mode)
4719 if (camera == NULL || mode == NULL) {
4720 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4721 return CAMERA_ERROR_INVALID_PARAMETER;
4723 int ret = CAMERA_ERROR_NONE;
4724 camera_cli_s *pc = (camera_cli_s *)camera;
4726 if (pc->cb_info == NULL) {
4727 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4728 return CAMERA_ERROR_INVALID_PARAMETER;
4730 sock_fd = pc->cb_info->fd;
4731 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_AF_MODE;
4734 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4735 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4737 if (ret == CAMERA_ERROR_NONE) {
4738 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
4739 *mode = (camera_attr_af_mode_e)get_mode;
4741 LOGD("ret : 0x%x", ret);
4746 int camera_attr_get_exposure_mode(camera_h camera, camera_attr_exposure_mode_e *mode)
4748 if (camera == NULL || mode == NULL) {
4749 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4750 return CAMERA_ERROR_INVALID_PARAMETER;
4752 int ret = CAMERA_ERROR_NONE;
4753 camera_cli_s *pc = (camera_cli_s *)camera;
4755 if (pc->cb_info == NULL) {
4756 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4757 return CAMERA_ERROR_INVALID_PARAMETER;
4759 sock_fd = pc->cb_info->fd;
4760 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE_MODE;
4763 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4764 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4766 if (ret == CAMERA_ERROR_NONE) {
4767 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
4768 *mode = (camera_attr_exposure_mode_e)get_mode;
4770 LOGD("ret : 0x%x", ret);
4774 int camera_attr_get_exposure(camera_h camera, int *value)
4776 if (camera == NULL || value == NULL) {
4777 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4778 return CAMERA_ERROR_INVALID_PARAMETER;
4780 int ret = CAMERA_ERROR_NONE;
4781 camera_cli_s *pc = (camera_cli_s *)camera;
4783 if (pc->cb_info == NULL) {
4784 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4785 return CAMERA_ERROR_INVALID_PARAMETER;
4787 sock_fd = pc->cb_info->fd;
4788 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE;
4791 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4792 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4794 if (ret == CAMERA_ERROR_NONE) {
4795 muse_camera_msg_get(get_value, pc->cb_info->recv_msg);
4798 LOGD("ret : 0x%x", ret);
4803 int camera_attr_get_exposure_range(camera_h camera, int *min, int *max)
4805 if (camera == NULL || min == NULL || max == NULL) {
4806 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4807 return CAMERA_ERROR_INVALID_PARAMETER;
4809 int ret = CAMERA_ERROR_NONE;
4810 camera_cli_s *pc = (camera_cli_s *)camera;
4812 if (pc->cb_info == NULL) {
4813 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4814 return CAMERA_ERROR_INVALID_PARAMETER;
4816 sock_fd = pc->cb_info->fd;
4817 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE_RANGE;
4821 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4822 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4824 if (ret == CAMERA_ERROR_NONE) {
4825 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
4826 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
4830 LOGD("ret : 0x%x", ret);
4835 int camera_attr_get_iso(camera_h camera, camera_attr_iso_e *iso)
4837 if (camera == NULL || iso == NULL) {
4838 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4839 return CAMERA_ERROR_INVALID_PARAMETER;
4841 int ret = CAMERA_ERROR_NONE;
4842 camera_cli_s *pc = (camera_cli_s *)camera;
4844 if (pc->cb_info == NULL) {
4845 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4846 return CAMERA_ERROR_INVALID_PARAMETER;
4848 sock_fd = pc->cb_info->fd;
4849 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ISO;
4852 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4853 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4855 if (ret == CAMERA_ERROR_NONE) {
4856 muse_camera_msg_get(get_iso, pc->cb_info->recv_msg);
4857 *iso = (camera_attr_iso_e)get_iso;
4859 LOGD("ret : 0x%x", ret);
4864 int camera_attr_get_brightness(camera_h camera, int *level)
4866 if (camera == NULL || level == NULL) {
4867 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4868 return CAMERA_ERROR_INVALID_PARAMETER;
4870 int ret = CAMERA_ERROR_NONE;
4871 camera_cli_s *pc = (camera_cli_s *)camera;
4873 if (pc->cb_info == NULL) {
4874 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4875 return CAMERA_ERROR_INVALID_PARAMETER;
4877 sock_fd = pc->cb_info->fd;
4878 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_BRIGHTNESS;
4881 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4882 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4884 if (ret == CAMERA_ERROR_NONE) {
4885 muse_camera_msg_get(get_level, pc->cb_info->recv_msg);
4888 LOGD("ret : 0x%x", ret);
4893 int camera_attr_get_brightness_range(camera_h camera, int *min, int *max)
4895 if (camera == NULL || min == NULL || max == NULL) {
4896 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4897 return CAMERA_ERROR_INVALID_PARAMETER;
4899 int ret = CAMERA_ERROR_NONE;
4900 camera_cli_s *pc = (camera_cli_s *)camera;
4902 if (pc->cb_info == NULL) {
4903 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4904 return CAMERA_ERROR_INVALID_PARAMETER;
4906 sock_fd = pc->cb_info->fd;
4907 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_BRIGHTNESS_RANGE;
4911 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4912 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4914 if (ret == CAMERA_ERROR_NONE) {
4915 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
4916 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
4920 LOGD("ret : 0x%x", ret);
4925 int camera_attr_get_contrast(camera_h camera, int *level)
4927 if (camera == NULL || level == NULL) {
4928 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4929 return CAMERA_ERROR_INVALID_PARAMETER;
4931 int ret = CAMERA_ERROR_NONE;
4932 camera_cli_s *pc = (camera_cli_s *)camera;
4933 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_CONTRAST;
4935 if (pc->cb_info == NULL) {
4936 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4937 return CAMERA_ERROR_INVALID_PARAMETER;
4939 sock_fd = pc->cb_info->fd;
4942 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4943 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4945 if (ret == CAMERA_ERROR_NONE) {
4946 muse_camera_msg_get(get_level, pc->cb_info->recv_msg);
4949 LOGD("ret : 0x%x", ret);
4954 int camera_attr_get_contrast_range(camera_h camera, int *min , int *max)
4956 if (camera == NULL || min == NULL || max == NULL) {
4957 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4958 return CAMERA_ERROR_INVALID_PARAMETER;
4960 int ret = CAMERA_ERROR_NONE;
4961 camera_cli_s *pc = (camera_cli_s *)camera;
4962 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_CONTRAST_RANGE;
4964 if (pc->cb_info == NULL) {
4965 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4966 return CAMERA_ERROR_INVALID_PARAMETER;
4968 sock_fd = pc->cb_info->fd;
4972 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4973 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4975 if (ret == CAMERA_ERROR_NONE) {
4976 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
4977 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
4981 LOGD("ret : 0x%x", ret);
4986 int camera_attr_get_whitebalance(camera_h camera, camera_attr_whitebalance_e *wb)
4988 if (camera == NULL || wb == NULL) {
4989 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4990 return CAMERA_ERROR_INVALID_PARAMETER;
4992 int ret = CAMERA_ERROR_NONE;
4993 camera_cli_s *pc = (camera_cli_s *)camera;
4994 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_WHITEBALANCE;
4996 if (pc->cb_info == NULL) {
4997 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4998 return CAMERA_ERROR_INVALID_PARAMETER;
5000 sock_fd = pc->cb_info->fd;
5003 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5004 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5006 if (ret == CAMERA_ERROR_NONE) {
5007 muse_camera_msg_get(get_wb, pc->cb_info->recv_msg);
5008 *wb = (camera_attr_whitebalance_e)get_wb;
5010 LOGD("ret : 0x%x", ret);
5015 int camera_attr_get_effect(camera_h camera, camera_attr_effect_mode_e *effect)
5017 if (camera == NULL || effect == NULL) {
5018 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5019 return CAMERA_ERROR_INVALID_PARAMETER;
5022 int ret = CAMERA_ERROR_NONE;
5023 camera_cli_s *pc = (camera_cli_s *)camera;
5024 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EFFECT;
5026 if (pc->cb_info == NULL) {
5027 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5028 return CAMERA_ERROR_INVALID_PARAMETER;
5030 sock_fd = pc->cb_info->fd;
5033 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5034 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5036 if (ret == CAMERA_ERROR_NONE) {
5037 muse_camera_msg_get(get_effect, pc->cb_info->recv_msg);
5038 *effect = (camera_attr_effect_mode_e)get_effect;
5040 LOGD("ret : 0x%x", ret);
5045 int camera_attr_get_scene_mode(camera_h camera, camera_attr_scene_mode_e *mode)
5047 if (camera == NULL || mode == NULL) {
5048 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5049 return CAMERA_ERROR_INVALID_PARAMETER;
5052 int ret = CAMERA_ERROR_NONE;
5053 camera_cli_s *pc = (camera_cli_s *)camera;
5054 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_SCENE_MODE;
5056 if (pc->cb_info == NULL) {
5057 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5058 return CAMERA_ERROR_INVALID_PARAMETER;
5060 sock_fd = pc->cb_info->fd;
5063 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5064 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5066 if (ret == CAMERA_ERROR_NONE) {
5067 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
5068 *mode = (camera_attr_scene_mode_e)get_mode;
5070 LOGD("ret : 0x%x", ret);
5075 int camera_attr_is_enabled_tag(camera_h camera, bool *enable)
5077 if (camera == NULL || enable == NULL) {
5078 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5079 return CAMERA_ERROR_INVALID_PARAMETER;
5082 int ret = CAMERA_ERROR_NONE;
5083 camera_cli_s *pc = (camera_cli_s *)camera;
5084 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_TAG;
5086 if (pc->cb_info == NULL) {
5087 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5088 return CAMERA_ERROR_INVALID_PARAMETER;
5090 sock_fd = pc->cb_info->fd;
5093 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5094 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5096 if (ret == CAMERA_ERROR_NONE) {
5097 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
5098 *enable = (bool)get_enabled;
5100 LOGD("ret : 0x%x", ret);
5105 int camera_attr_get_tag_image_description(camera_h camera, char **description)
5107 if (camera == NULL || description == NULL) {
5108 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5109 return CAMERA_ERROR_INVALID_PARAMETER;
5112 int ret = CAMERA_ERROR_NONE;
5113 camera_cli_s *pc = (camera_cli_s *)camera;
5114 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_IMAGE_DESCRIPTION;
5116 if (pc->cb_info == NULL) {
5117 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5118 return CAMERA_ERROR_INVALID_PARAMETER;
5120 sock_fd = pc->cb_info->fd;
5121 char get_description[MUSE_CAMERA_MSG_MAX_LENGTH] = {0,};
5123 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5124 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5126 if (ret == CAMERA_ERROR_NONE) {
5127 muse_camera_msg_get_string(get_description, pc->cb_info->recv_msg);
5128 *description = strdup(get_description);
5130 LOGD("ret : 0x%x", ret);
5135 int camera_attr_get_tag_orientation(camera_h camera, camera_attr_tag_orientation_e *orientation)
5137 if (camera == NULL || orientation == NULL) {
5138 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5139 return CAMERA_ERROR_INVALID_PARAMETER;
5142 int ret = CAMERA_ERROR_NONE;
5143 camera_cli_s *pc = (camera_cli_s *)camera;
5144 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_ORIENTATION;
5146 if (pc->cb_info == NULL) {
5147 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5148 return CAMERA_ERROR_INVALID_PARAMETER;
5150 sock_fd = pc->cb_info->fd;
5151 int get_orientation;
5153 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5154 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5156 if (ret == CAMERA_ERROR_NONE) {
5157 muse_camera_msg_get(get_orientation, pc->cb_info->recv_msg);
5158 *orientation = (camera_attr_tag_orientation_e)get_orientation;
5159 LOGD("success, orientation : %d", *orientation);
5161 LOGD("ret : 0x%x", ret);
5166 int camera_attr_get_tag_software(camera_h camera, char **software)
5168 if (camera == NULL || software == NULL) {
5169 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5170 return CAMERA_ERROR_INVALID_PARAMETER;
5173 int ret = CAMERA_ERROR_NONE;
5174 camera_cli_s *pc = (camera_cli_s *)camera;
5175 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_SOFTWARE;
5177 if (pc->cb_info == NULL) {
5178 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5179 return CAMERA_ERROR_INVALID_PARAMETER;
5181 sock_fd = pc->cb_info->fd;
5182 char get_software[MUSE_CAMERA_MSG_MAX_LENGTH] = {0,};
5184 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5185 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5187 if (ret == CAMERA_ERROR_NONE) {
5188 muse_camera_msg_get_string(get_software, pc->cb_info->recv_msg);
5189 *software = strdup(get_software);
5191 LOGD("ret : 0x%x", ret);
5196 int camera_attr_get_geotag(camera_h camera, double *latitude , double *longitude, double *altitude)
5198 if (camera == NULL || latitude == NULL || longitude == NULL || altitude == NULL) {
5199 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5200 return CAMERA_ERROR_INVALID_PARAMETER;
5203 int ret = CAMERA_ERROR_NONE;
5204 camera_cli_s *pc = (camera_cli_s *)camera;
5205 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_GEOTAG;
5206 double get_geotag[3] = {0,};
5208 if (pc->cb_info == NULL) {
5209 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5210 return CAMERA_ERROR_INVALID_PARAMETER;
5212 sock_fd = pc->cb_info->fd;
5214 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5216 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5218 if (ret == CAMERA_ERROR_NONE) {
5219 muse_camera_msg_get_array(get_geotag, pc->cb_info->recv_msg);
5220 *latitude = get_geotag[0];
5221 *longitude = get_geotag[1];
5222 *altitude = get_geotag[2];
5224 LOGD("ret : 0x%x", ret);
5226 LOGE("Returned value is not valid : 0x%x", ret);
5233 int camera_attr_get_flash_mode(camera_h camera, camera_attr_flash_mode_e *mode)
5235 if (camera == NULL || mode == NULL) {
5236 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5237 return CAMERA_ERROR_INVALID_PARAMETER;
5240 int ret = CAMERA_ERROR_NONE;
5241 camera_cli_s *pc = (camera_cli_s *)camera;
5242 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_FLASH_MODE;
5244 if (pc->cb_info == NULL) {
5245 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5246 return CAMERA_ERROR_INVALID_PARAMETER;
5248 sock_fd = pc->cb_info->fd;
5251 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5252 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5254 if (ret == CAMERA_ERROR_NONE) {
5255 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
5256 *mode = (camera_attr_flash_mode_e)get_mode;
5258 LOGD("ret : 0x%x", ret);
5263 int camera_get_flash_state(camera_device_e device, camera_flash_state_e *state)
5267 int ret = CAMERA_ERROR_NONE;
5268 camera_cli_s *pc = NULL;
5269 int get_flash_state = 0;
5271 /* create muse connection */
5272 muse_camera_api_e api = MUSE_CAMERA_API_GET_FLASH_STATE;
5273 muse_core_api_module_e muse_module = MUSE_CAMERA;
5274 int device_type = (int)device;
5276 if (state == NULL) {
5277 LOGE("invalid pointer for state");
5278 return CAMERA_ERROR_INVALID_PARAMETER;
5281 sock_fd = muse_core_client_new();
5283 LOGE("muse_core_client_new failed - returned fd %d", sock_fd);
5284 ret = CAMERA_ERROR_INVALID_OPERATION;
5288 sndMsg = muse_core_msg_json_factory_new(api,
5289 MUSE_TYPE_INT, "module", muse_module,
5290 MUSE_TYPE_INT, PARAM_DEVICE_TYPE, device_type,
5293 muse_core_ipc_send_msg(sock_fd, sndMsg);
5294 muse_core_msg_json_factory_free(sndMsg);
5296 pc = g_new0(camera_cli_s, 1);
5298 LOGE("camera_cli_s alloc failed");
5299 ret = CAMERA_ERROR_OUT_OF_MEMORY;
5303 pc->cb_info = _client_callback_new(sock_fd);
5304 if (pc->cb_info == NULL) {
5305 LOGE("cb_info alloc failed");
5306 ret = CAMERA_ERROR_OUT_OF_MEMORY;
5310 ret = _client_wait_for_cb_return(api, pc->cb_info, CALLBACK_TIME_OUT);
5312 if (ret == CAMERA_ERROR_NONE) {
5313 muse_camera_msg_get(get_flash_state, pc->cb_info->recv_msg);
5314 *state = (camera_flash_state_e)get_flash_state;
5317 LOGD("Flash state : %d\n", *state);
5320 /* release resources */
5322 g_atomic_int_set(&pc->cb_info->msg_recv_running, 0);
5323 g_atomic_int_set(&pc->cb_info->msg_handler_running, 0);
5324 _client_callback_destroy(pc->cb_info);
5334 int camera_attr_foreach_supported_af_mode(camera_h camera, camera_attr_supported_af_mode_cb foreach_cb, void *user_data)
5336 if (camera == NULL || foreach_cb == NULL) {
5337 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5338 return CAMERA_ERROR_INVALID_PARAMETER;
5340 int ret = CAMERA_ERROR_NONE;
5342 camera_cli_s *pc = (camera_cli_s *)camera;
5343 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_AF_MODE;
5345 LOGD("Enter, handle :%x", pc->remote_handle);
5348 if (pc->cb_info == NULL) {
5349 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5350 return CAMERA_ERROR_INVALID_PARAMETER;
5352 sock_fd = pc->cb_info->fd;
5353 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_AF_MODE] = foreach_cb;
5354 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_AF_MODE] = user_data;
5356 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5357 LOGD("ret : 0x%x", ret);
5362 int camera_attr_foreach_supported_exposure_mode(camera_h camera, camera_attr_supported_exposure_mode_cb foreach_cb , void *user_data)
5364 if (camera == NULL || foreach_cb == NULL) {
5365 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5366 return CAMERA_ERROR_INVALID_PARAMETER;
5368 int ret = CAMERA_ERROR_NONE;
5370 camera_cli_s *pc = (camera_cli_s *)camera;
5371 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_EXPOSURE_MODE;
5373 LOGD("Enter, handle :%x", pc->remote_handle);
5376 if (pc->cb_info == NULL) {
5377 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5378 return CAMERA_ERROR_INVALID_PARAMETER;
5380 sock_fd = pc->cb_info->fd;
5381 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EXPOSURE_MODE] = foreach_cb;
5382 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EXPOSURE_MODE] = user_data;
5384 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5385 LOGD("ret : 0x%x", ret);
5390 int camera_attr_foreach_supported_iso(camera_h camera, camera_attr_supported_iso_cb foreach_cb, void *user_data)
5392 if (camera == NULL || foreach_cb == NULL) {
5393 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5394 return CAMERA_ERROR_INVALID_PARAMETER;
5396 int ret = CAMERA_ERROR_NONE;
5398 camera_cli_s *pc = (camera_cli_s *)camera;
5399 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_ISO;
5401 LOGD("Enter, handle :%x", pc->remote_handle);
5404 if (pc->cb_info == NULL) {
5405 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5406 return CAMERA_ERROR_INVALID_PARAMETER;
5408 sock_fd = pc->cb_info->fd;
5409 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_ISO] = foreach_cb;
5410 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_ISO] = user_data;
5412 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5413 LOGD("ret : 0x%x", ret);
5418 int camera_attr_foreach_supported_whitebalance(camera_h camera, camera_attr_supported_whitebalance_cb foreach_cb , void *user_data)
5420 if (camera == NULL || foreach_cb == NULL) {
5421 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5422 return CAMERA_ERROR_INVALID_PARAMETER;
5424 int ret = CAMERA_ERROR_NONE;
5426 camera_cli_s *pc = (camera_cli_s *)camera;
5427 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_WHITEBALANCE;
5429 LOGD("Enter, handle :%x", pc->remote_handle);
5432 if (pc->cb_info == NULL) {
5433 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5434 return CAMERA_ERROR_INVALID_PARAMETER;
5436 sock_fd = pc->cb_info->fd;
5437 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_WHITEBALANCE] = foreach_cb;
5438 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_WHITEBALANCE] = user_data;
5440 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5441 LOGD("ret : 0x%x", ret);
5446 int camera_attr_foreach_supported_effect(camera_h camera, camera_attr_supported_effect_cb foreach_cb , void *user_data)
5448 if (camera == NULL || foreach_cb == NULL) {
5449 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5450 return CAMERA_ERROR_INVALID_PARAMETER;
5452 int ret = CAMERA_ERROR_NONE;
5454 camera_cli_s *pc = (camera_cli_s *)camera;
5455 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_EFFECT;
5457 LOGD("Enter, handle :%x", pc->remote_handle);
5460 if (pc->cb_info == NULL) {
5461 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5462 return CAMERA_ERROR_INVALID_PARAMETER;
5464 sock_fd = pc->cb_info->fd;
5465 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EFFECT] = foreach_cb;
5466 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EFFECT] = user_data;
5468 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5469 LOGD("ret : 0x%x", ret);
5474 int camera_attr_foreach_supported_scene_mode(camera_h camera, camera_attr_supported_scene_mode_cb foreach_cb , void *user_data)
5476 if (camera == NULL || foreach_cb == NULL) {
5477 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5478 return CAMERA_ERROR_INVALID_PARAMETER;
5480 int ret = CAMERA_ERROR_NONE;
5482 camera_cli_s *pc = (camera_cli_s *)camera;
5483 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_SCENE_MODE;
5485 LOGD("Enter, handle :%x", pc->remote_handle);
5488 if (pc->cb_info == NULL) {
5489 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5490 return CAMERA_ERROR_INVALID_PARAMETER;
5492 sock_fd = pc->cb_info->fd;
5493 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_SCENE_MODE] = foreach_cb;
5494 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_SCENE_MODE] = user_data;
5496 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5497 LOGD("ret : 0x%x", ret);
5502 int camera_attr_foreach_supported_flash_mode(camera_h camera, camera_attr_supported_flash_mode_cb foreach_cb , void *user_data)
5504 if (camera == NULL || foreach_cb == NULL) {
5505 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5506 return CAMERA_ERROR_INVALID_PARAMETER;
5508 int ret = CAMERA_ERROR_NONE;
5510 camera_cli_s *pc = (camera_cli_s *)camera;
5511 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FLASH_MODE;
5513 LOGD("Enter, handle :%x", pc->remote_handle);
5516 if (pc->cb_info == NULL) {
5517 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5518 return CAMERA_ERROR_INVALID_PARAMETER;
5520 sock_fd = pc->cb_info->fd;
5521 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FLASH_MODE] = foreach_cb;
5522 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FLASH_MODE] = user_data;
5524 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5525 LOGD("ret : 0x%x", ret);
5530 int camera_attr_foreach_supported_fps(camera_h camera, camera_attr_supported_fps_cb foreach_cb , void *user_data)
5532 if (camera == NULL || foreach_cb == NULL) {
5533 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5534 return CAMERA_ERROR_INVALID_PARAMETER;
5536 int ret = CAMERA_ERROR_NONE;
5538 camera_cli_s *pc = (camera_cli_s *)camera;
5539 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FPS;
5541 if (pc->cb_info == NULL) {
5542 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5543 return CAMERA_ERROR_INVALID_PARAMETER;
5545 sock_fd = pc->cb_info->fd;
5546 LOGD("Enter, handle :%x", pc->remote_handle);
5547 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS] = foreach_cb;
5548 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS] = user_data;
5550 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5551 LOGD("Enter, handle :%x", pc->remote_handle);
5555 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)
5557 if (camera == NULL || foreach_cb == NULL) {
5558 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5559 return CAMERA_ERROR_INVALID_PARAMETER;
5561 int ret = CAMERA_ERROR_NONE;
5563 camera_cli_s *pc = (camera_cli_s *)camera;
5564 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FPS_BY_RESOLUTION;
5566 if (pc->cb_info == NULL) {
5567 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5568 return CAMERA_ERROR_INVALID_PARAMETER;
5570 sock_fd = pc->cb_info->fd;
5571 LOGD("Enter, handle :%x", pc->remote_handle);
5572 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS_BY_RESOLUTION] = foreach_cb;
5573 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS_BY_RESOLUTION] = user_data;
5575 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, width, INT, height);
5576 LOGD("ret : 0x%x", ret);
5580 int camera_attr_foreach_supported_stream_flip(camera_h camera, camera_attr_supported_stream_flip_cb foreach_cb, void *user_data)
5582 if (camera == NULL || foreach_cb == NULL) {
5583 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5584 return CAMERA_ERROR_INVALID_PARAMETER;
5586 int ret = CAMERA_ERROR_NONE;
5588 camera_cli_s *pc = (camera_cli_s *)camera;
5589 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_STREAM_FLIP;
5591 if (pc->cb_info == NULL) {
5592 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5593 return CAMERA_ERROR_INVALID_PARAMETER;
5595 sock_fd = pc->cb_info->fd;
5596 LOGD("Enter, handle :%x", pc->remote_handle);
5597 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_FLIP] = foreach_cb;
5598 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_FLIP] = user_data;
5600 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5601 LOGD("ret : 0x%x", ret);
5606 int camera_attr_foreach_supported_stream_rotation(camera_h camera, camera_attr_supported_stream_rotation_cb foreach_cb, void *user_data)
5608 if (camera == NULL || foreach_cb == NULL) {
5609 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5610 return CAMERA_ERROR_INVALID_PARAMETER;
5612 int ret = CAMERA_ERROR_NONE;
5614 camera_cli_s *pc = (camera_cli_s *)camera;
5615 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_STREAM_ROTATION;
5617 if (pc->cb_info == NULL) {
5618 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5619 return CAMERA_ERROR_INVALID_PARAMETER;
5621 sock_fd = pc->cb_info->fd;
5622 LOGD("Enter, handle :%x", pc->remote_handle);
5623 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION] = foreach_cb;
5624 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION] = user_data;
5626 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5627 LOGD("ret : 0x%x", ret);
5632 int camera_attr_set_stream_rotation(camera_h camera , camera_rotation_e rotation)
5634 if (camera == NULL) {
5635 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5636 return CAMERA_ERROR_INVALID_PARAMETER;
5639 int ret = CAMERA_ERROR_NONE;
5640 camera_cli_s *pc = (camera_cli_s *)camera;
5641 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_STREAM_ROTATION;
5643 if (pc->cb_info == NULL) {
5644 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5645 return CAMERA_ERROR_INVALID_PARAMETER;
5647 sock_fd = pc->cb_info->fd;
5648 int set_rotation = (int)rotation;
5650 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5651 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_rotation);
5652 LOGD("ret : 0x%x", ret);
5657 int camera_attr_get_stream_rotation(camera_h camera , camera_rotation_e *rotation)
5659 if (camera == NULL || rotation == NULL) {
5660 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5661 return CAMERA_ERROR_INVALID_PARAMETER;
5664 int ret = CAMERA_ERROR_NONE;
5665 camera_cli_s *pc = (camera_cli_s *)camera;
5666 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_STREAM_ROTATION;
5668 if (pc->cb_info == NULL) {
5669 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5670 return CAMERA_ERROR_INVALID_PARAMETER;
5672 sock_fd = pc->cb_info->fd;
5675 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5676 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5678 if (ret == CAMERA_ERROR_NONE) {
5679 muse_camera_msg_get(get_rotation, pc->cb_info->recv_msg);
5680 *rotation = (camera_rotation_e)get_rotation;
5682 LOGD("ret : 0x%x", ret);
5687 int camera_attr_set_stream_flip(camera_h camera , camera_flip_e flip)
5689 if (camera == NULL) {
5690 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5691 return CAMERA_ERROR_INVALID_PARAMETER;
5694 int ret = CAMERA_ERROR_NONE;
5695 camera_cli_s *pc = (camera_cli_s *)camera;
5696 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_STREAM_FLIP;
5698 if (pc->cb_info == NULL) {
5699 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5700 return CAMERA_ERROR_INVALID_PARAMETER;
5702 sock_fd = pc->cb_info->fd;
5703 int set_flip = (int)flip;
5705 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5706 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_flip);
5707 LOGD("ret : 0x%x", ret);
5712 int camera_attr_get_stream_flip(camera_h camera , camera_flip_e *flip)
5714 if (camera == NULL || flip == NULL) {
5715 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5716 return CAMERA_ERROR_INVALID_PARAMETER;
5719 int ret = CAMERA_ERROR_NONE;
5720 camera_cli_s *pc = (camera_cli_s *)camera;
5721 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_STREAM_FLIP;
5723 if (pc->cb_info == NULL) {
5724 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5725 return CAMERA_ERROR_INVALID_PARAMETER;
5727 sock_fd = pc->cb_info->fd;
5730 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5731 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5733 if (ret == CAMERA_ERROR_NONE) {
5734 muse_camera_msg_get(get_flip, pc->cb_info->recv_msg);
5735 *flip = (camera_flip_e)get_flip;
5737 LOGD("ret : 0x%x", ret);
5741 int camera_attr_set_hdr_mode(camera_h camera, camera_attr_hdr_mode_e mode)
5743 if (camera == NULL) {
5744 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5745 return CAMERA_ERROR_INVALID_PARAMETER;
5748 int ret = CAMERA_ERROR_NONE;
5749 camera_cli_s *pc = (camera_cli_s *)camera;
5750 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_HDR_MODE;
5752 if (pc->cb_info == NULL) {
5753 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5754 return CAMERA_ERROR_INVALID_PARAMETER;
5756 sock_fd = pc->cb_info->fd;
5757 int set_mode = (int)mode;
5759 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5760 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
5761 LOGD("ret : 0x%x", ret);
5766 int camera_attr_get_hdr_mode(camera_h camera, camera_attr_hdr_mode_e *mode)
5768 if (camera == NULL) {
5769 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5770 return CAMERA_ERROR_INVALID_PARAMETER;
5773 LOGE("INVALID_PARAMETER(0x%08x) - mode", CAMERA_ERROR_INVALID_PARAMETER);
5774 return CAMERA_ERROR_INVALID_PARAMETER;
5776 int ret = CAMERA_ERROR_NONE;
5777 camera_cli_s *pc = (camera_cli_s *)camera;
5778 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_HDR_MODE;
5780 if (pc->cb_info == NULL) {
5781 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5782 return CAMERA_ERROR_INVALID_PARAMETER;
5784 sock_fd = pc->cb_info->fd;
5787 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5788 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5790 if (ret == CAMERA_ERROR_NONE) {
5791 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
5792 *mode = (camera_attr_hdr_mode_e)get_mode;
5794 LOGD("ret : 0x%x", ret);
5799 bool camera_attr_is_supported_hdr_capture(camera_h camera)
5801 if (camera == NULL) {
5802 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5806 int ret = CAMERA_ERROR_NONE;
5807 camera_cli_s *pc = (camera_cli_s *)camera;
5808 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_HDR_CAPTURE;
5810 if (pc->cb_info == NULL) {
5811 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5812 return CAMERA_ERROR_INVALID_PARAMETER;
5814 sock_fd = pc->cb_info->fd;
5815 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5816 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5817 LOGD("ret : 0x%x", ret);
5822 int camera_attr_set_hdr_capture_progress_cb(camera_h camera, camera_attr_hdr_progress_cb callback, void *user_data)
5824 int ret = CAMERA_ERROR_NONE;
5825 camera_cli_s *pc = (camera_cli_s *)camera;
5826 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_HDR_CAPTURE_PROGRESS_CB;
5829 if (camera == NULL) {
5830 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5831 return CAMERA_ERROR_INVALID_PARAMETER;
5834 if (pc->cb_info == NULL) {
5835 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5836 return CAMERA_ERROR_INVALID_PARAMETER;
5839 sock_fd = pc->cb_info->fd;
5841 LOGD("Enter, handle :%x", pc->remote_handle);
5843 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5845 if (ret == CAMERA_ERROR_NONE) {
5846 if (callback == NULL) {
5847 LOGE("INVALID_PARAMETER(0x%08x) - callback", CAMERA_ERROR_INVALID_PARAMETER);
5848 return CAMERA_ERROR_INVALID_PARAMETER;
5851 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = callback;
5852 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = user_data;
5855 LOGD("ret : 0x%x", ret);
5861 int camera_attr_unset_hdr_capture_progress_cb(camera_h camera)
5863 if (camera == NULL) {
5864 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5865 return CAMERA_ERROR_INVALID_PARAMETER;
5868 int ret = CAMERA_ERROR_NONE;
5870 camera_cli_s *pc = (camera_cli_s *)camera;
5871 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_UNSET_HDR_CAPTURE_PROGRESS_CB;
5873 if (pc->cb_info == NULL) {
5874 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5875 return CAMERA_ERROR_INVALID_PARAMETER;
5877 sock_fd = pc->cb_info->fd;
5878 LOGD("Enter, handle :%x", pc->remote_handle);
5880 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = (void *)NULL;
5881 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = (void *)NULL;
5883 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5884 LOGD("ret : 0x%x", ret);
5889 int camera_attr_enable_anti_shake(camera_h camera, bool enable)
5891 if (camera == NULL) {
5892 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5893 return CAMERA_ERROR_INVALID_PARAMETER;
5896 int ret = CAMERA_ERROR_NONE;
5897 camera_cli_s *pc = (camera_cli_s *)camera;
5898 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_ANTI_SHAKE;
5900 if (pc->cb_info == NULL) {
5901 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5902 return CAMERA_ERROR_INVALID_PARAMETER;
5904 sock_fd = pc->cb_info->fd;
5905 int set_enable = (int)enable;
5907 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5908 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
5909 LOGD("ret : 0x%x", ret);
5914 int camera_attr_is_enabled_anti_shake(camera_h camera , bool *enabled)
5916 if (camera == NULL) {
5917 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5918 return CAMERA_ERROR_INVALID_PARAMETER;
5920 if (enabled == NULL) {
5921 LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER);
5922 return CAMERA_ERROR_INVALID_PARAMETER;
5924 int ret = CAMERA_ERROR_NONE;
5925 camera_cli_s *pc = (camera_cli_s *)camera;
5926 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_ANTI_SHAKE;
5928 if (pc->cb_info == NULL) {
5929 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5930 return CAMERA_ERROR_INVALID_PARAMETER;
5932 sock_fd = pc->cb_info->fd;
5935 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5936 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5938 if (ret == CAMERA_ERROR_NONE) {
5939 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
5940 *enabled = (bool)get_enabled;
5942 LOGD("ret : 0x%x", ret);
5947 bool camera_attr_is_supported_anti_shake(camera_h camera)
5950 if (camera == NULL) {
5951 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5955 int ret = CAMERA_ERROR_NONE;
5956 camera_cli_s *pc = (camera_cli_s *)camera;
5957 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_ANTI_SHAKE;
5959 if (pc->cb_info == NULL) {
5960 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5961 return CAMERA_ERROR_INVALID_PARAMETER;
5963 sock_fd = pc->cb_info->fd;
5964 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5965 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5966 LOGD("ret : 0x%x", ret);
5971 int camera_attr_enable_video_stabilization(camera_h camera, bool enable)
5973 if (camera == NULL) {
5974 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5975 return CAMERA_ERROR_INVALID_PARAMETER;
5978 int ret = CAMERA_ERROR_NONE;
5979 camera_cli_s *pc = (camera_cli_s *)camera;
5980 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_VIDEO_STABILIZATION;
5982 if (pc->cb_info == NULL) {
5983 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5984 return CAMERA_ERROR_INVALID_PARAMETER;
5986 sock_fd = pc->cb_info->fd;
5987 int set_enable = (int)enable;
5989 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5990 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
5991 LOGD("ret : 0x%x", ret);
5996 int camera_attr_is_enabled_video_stabilization(camera_h camera, bool *enabled)
5998 if (camera == NULL) {
5999 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
6000 return CAMERA_ERROR_INVALID_PARAMETER;
6002 if (enabled == NULL) {
6003 LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER);
6004 return CAMERA_ERROR_INVALID_PARAMETER;
6006 int ret = CAMERA_ERROR_NONE;
6007 camera_cli_s *pc = (camera_cli_s *)camera;
6008 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_VIDEO_STABILIZATION;
6010 if (pc->cb_info == NULL) {
6011 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6012 return CAMERA_ERROR_INVALID_PARAMETER;
6014 sock_fd = pc->cb_info->fd;
6017 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6018 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6020 if (ret == CAMERA_ERROR_NONE) {
6021 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
6022 *enabled = (bool)get_enabled;
6024 LOGD("ret : 0x%x", ret);
6029 bool camera_attr_is_supported_video_stabilization(camera_h camera)
6031 if (camera == NULL) {
6032 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6036 int ret = CAMERA_ERROR_NONE;
6037 camera_cli_s *pc = (camera_cli_s *)camera;
6038 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_VIDEO_STABILIZATION;
6040 if (pc->cb_info == NULL) {
6041 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6042 return CAMERA_ERROR_INVALID_PARAMETER;
6044 sock_fd = pc->cb_info->fd;
6045 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6046 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6047 LOGD("ret : 0x%x", ret);
6052 int camera_attr_enable_auto_contrast(camera_h camera, bool enable)
6054 if (camera == NULL) {
6055 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6056 return CAMERA_ERROR_INVALID_PARAMETER;
6059 int ret = CAMERA_ERROR_NONE;
6060 camera_cli_s *pc = (camera_cli_s *)camera;
6061 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_AUTO_CONTRAST;
6063 if (pc->cb_info == NULL) {
6064 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6065 return CAMERA_ERROR_INVALID_PARAMETER;
6067 sock_fd = pc->cb_info->fd;
6068 int set_enable = (int)enable;
6070 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6071 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
6072 LOGD("ret : 0x%x", ret);
6077 int camera_attr_is_enabled_auto_contrast(camera_h camera, bool *enabled)
6079 if (camera == NULL) {
6080 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
6081 return CAMERA_ERROR_INVALID_PARAMETER;
6083 if (enabled == NULL) {
6084 LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER);
6085 return CAMERA_ERROR_INVALID_PARAMETER;
6087 int ret = CAMERA_ERROR_NONE;
6088 camera_cli_s *pc = (camera_cli_s *)camera;
6089 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_AUTO_CONTRAST;
6091 if (pc->cb_info == NULL) {
6092 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6093 return CAMERA_ERROR_INVALID_PARAMETER;
6095 sock_fd = pc->cb_info->fd;
6098 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6099 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6101 if (ret == CAMERA_ERROR_NONE) {
6102 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
6103 *enabled = (bool)get_enabled;
6105 LOGD("ret : 0x%x", ret);
6110 bool camera_attr_is_supported_auto_contrast(camera_h camera)
6112 if (camera == NULL) {
6113 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6117 int ret = CAMERA_ERROR_NONE;
6118 camera_cli_s *pc = (camera_cli_s *)camera;
6119 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_AUTO_CONTRAST;
6121 if (pc->cb_info == NULL) {
6122 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6123 return CAMERA_ERROR_INVALID_PARAMETER;
6125 sock_fd = pc->cb_info->fd;
6126 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6127 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6128 LOGD("ret : 0x%x", ret);
6133 int camera_attr_disable_shutter_sound(camera_h camera, bool disable)
6135 if (camera == NULL) {
6136 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6137 return CAMERA_ERROR_INVALID_PARAMETER;
6140 int ret = CAMERA_ERROR_NONE;
6141 camera_cli_s *pc = (camera_cli_s *)camera;
6142 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_DISABLE_SHUTTER_SOUND;
6144 if (pc->cb_info == NULL) {
6145 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6146 return CAMERA_ERROR_INVALID_PARAMETER;
6148 sock_fd = pc->cb_info->fd;
6149 int set_disable = (int)disable;
6151 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6152 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_disable);
6153 LOGD("ret : 0x%x", ret);
6158 int camera_attr_set_pan(camera_h camera, camera_attr_ptz_move_type_e move_type, int pan_step)
6160 if (camera == NULL) {
6161 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6162 return CAMERA_ERROR_INVALID_PARAMETER;
6165 camera_cli_s *pc = (camera_cli_s *)camera;
6166 if (pc->cb_info == NULL) {
6167 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6168 return CAMERA_ERROR_INVALID_PARAMETER;
6171 int ret = CAMERA_ERROR_NONE;
6172 int sock_fd = pc->cb_info->fd;
6173 int set_move_type = (int)move_type;
6174 int set_pan_step = pan_step;
6175 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_PAN;
6177 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6178 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, set_move_type, INT, set_pan_step);
6179 LOGD("ret : 0x%x", ret);
6184 int camera_attr_get_pan(camera_h camera, int *pan_step)
6186 if (camera == NULL || pan_step == NULL) {
6187 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6188 return CAMERA_ERROR_INVALID_PARAMETER;
6191 camera_cli_s *pc = (camera_cli_s *)camera;
6192 if (pc->cb_info == NULL) {
6193 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6194 return CAMERA_ERROR_INVALID_PARAMETER;
6197 int ret = CAMERA_ERROR_NONE;
6198 int sock_fd = pc->cb_info->fd;
6200 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_PAN;
6202 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6203 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6205 if (ret == CAMERA_ERROR_NONE) {
6206 muse_camera_msg_get(get_pan_step, pc->cb_info->recv_msg);
6207 *pan_step = get_pan_step;
6209 LOGD("ret : 0x%x", ret);
6214 int camera_attr_get_pan_range(camera_h camera, int *min, int *max)
6216 if (camera == NULL || min == NULL || max == NULL) {
6217 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6218 return CAMERA_ERROR_INVALID_PARAMETER;
6221 camera_cli_s *pc = (camera_cli_s *)camera;
6222 if (pc->cb_info == NULL) {
6223 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6224 return CAMERA_ERROR_INVALID_PARAMETER;
6227 int ret = CAMERA_ERROR_NONE;
6228 int sock_fd = pc->cb_info->fd;
6231 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_PAN_RANGE;
6233 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6234 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6236 if (ret == CAMERA_ERROR_NONE) {
6237 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
6238 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
6242 LOGD("ret : 0x%x", ret);
6247 int camera_attr_set_tilt(camera_h camera, camera_attr_ptz_move_type_e move_type, int tilt_step)
6249 if (camera == NULL) {
6250 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6251 return CAMERA_ERROR_INVALID_PARAMETER;
6254 camera_cli_s *pc = (camera_cli_s *)camera;
6255 if (pc->cb_info == NULL) {
6256 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6257 return CAMERA_ERROR_INVALID_PARAMETER;
6260 int ret = CAMERA_ERROR_NONE;
6261 int sock_fd = pc->cb_info->fd;
6262 int set_move_type = (int)move_type;
6263 int set_tilt_step = tilt_step;
6264 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TILT;
6266 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6267 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, set_move_type, INT, set_tilt_step);
6268 LOGD("ret : 0x%x", ret);
6273 int camera_attr_get_tilt(camera_h camera, int *tilt_step)
6275 if (camera == NULL || tilt_step == NULL) {
6276 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6277 return CAMERA_ERROR_INVALID_PARAMETER;
6280 camera_cli_s *pc = (camera_cli_s *)camera;
6281 if (pc->cb_info == NULL) {
6282 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6283 return CAMERA_ERROR_INVALID_PARAMETER;
6286 int ret = CAMERA_ERROR_NONE;
6287 int sock_fd = pc->cb_info->fd;
6289 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TILT;
6291 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6292 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6294 if (ret == CAMERA_ERROR_NONE) {
6295 muse_camera_msg_get(get_tilt_step, pc->cb_info->recv_msg);
6296 *tilt_step = get_tilt_step;
6298 LOGD("ret : 0x%x", ret);
6303 int camera_attr_get_tilt_range(camera_h camera, int *min, int *max)
6305 if (camera == NULL || min == NULL || max == NULL) {
6306 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6307 return CAMERA_ERROR_INVALID_PARAMETER;
6310 camera_cli_s *pc = (camera_cli_s *)camera;
6311 if (pc->cb_info == NULL) {
6312 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6313 return CAMERA_ERROR_INVALID_PARAMETER;
6316 int ret = CAMERA_ERROR_NONE;
6317 int sock_fd = pc->cb_info->fd;
6320 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TILT_RANGE;
6322 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6323 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6325 if (ret == CAMERA_ERROR_NONE) {
6326 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
6327 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
6331 LOGD("ret : 0x%x", ret);
6336 int camera_attr_set_ptz_type(camera_h camera, camera_attr_ptz_type_e ptz_type)
6338 if (camera == NULL) {
6339 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6340 return CAMERA_ERROR_INVALID_PARAMETER;
6343 camera_cli_s *pc = (camera_cli_s *)camera;
6344 if (pc->cb_info == NULL) {
6345 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6346 return CAMERA_ERROR_INVALID_PARAMETER;
6349 int ret = CAMERA_ERROR_NONE;
6350 int sock_fd = pc->cb_info->fd;
6351 int set_ptz_type = (int)ptz_type;
6352 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_PTZ_TYPE;
6354 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6355 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_ptz_type);
6356 LOGD("ret : 0x%x", ret);
6361 int camera_attr_foreach_supported_ptz_type(camera_h camera, camera_attr_supported_ptz_type_cb foreach_cb, void *user_data)
6363 if (camera == NULL || foreach_cb == NULL) {
6364 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6365 return CAMERA_ERROR_INVALID_PARAMETER;
6367 int ret = CAMERA_ERROR_NONE;
6369 camera_cli_s *pc = (camera_cli_s *)camera;
6370 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_PTZ_TYPE;
6372 if (pc->cb_info == NULL) {
6373 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6374 return CAMERA_ERROR_INVALID_PARAMETER;
6376 sock_fd = pc->cb_info->fd;
6377 LOGD("Enter, handle :%x", pc->remote_handle);
6378 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PTZ_TYPE] = foreach_cb;
6379 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PTZ_TYPE] = user_data;
6381 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6382 LOGD("ret : 0x%x", ret);
6387 int camera_attr_set_display_roi_area(camera_h camera, int x, int y, int width, int height)
6389 if (camera == NULL) {
6390 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6391 return CAMERA_ERROR_INVALID_PARAMETER;
6394 camera_cli_s *pc = (camera_cli_s *)camera;
6395 if (pc->cb_info == NULL) {
6396 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6397 return CAMERA_ERROR_INVALID_PARAMETER;
6400 int ret = CAMERA_ERROR_NONE;
6401 int sock_fd = pc->cb_info->fd;
6402 int set_display_roi_area[4] = {x, y, width, height};
6403 muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY_ROI_AREA;
6405 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6407 #ifdef EVAS_RENDERER_SUPPORT
6408 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
6409 g_mutex_lock(&pc->cb_info->evas_mutex);
6411 ret = mm_evas_renderer_set_roi_area(pc->cb_info->evas_info, x, y, width, height);
6413 g_mutex_unlock(&pc->cb_info->evas_mutex);
6415 if (ret != MM_ERROR_NONE) {
6416 LOGE("mm_evas_renderer_set_roi_area error 0x%x", ret);
6417 return CAMERA_ERROR_INVALID_OPERATION;
6420 #endif /* EVAS_RENDERER_SUPPORT */
6422 muse_camera_msg_send_array(api, sock_fd, pc->cb_info, ret,
6423 set_display_roi_area, sizeof(set_display_roi_area), sizeof(int));
6425 LOGD("ret : 0x%x", ret);
6431 int camera_attr_get_display_roi_area(camera_h camera, int *x, int *y, int *width, int *height)
6433 if (camera == NULL || x == NULL || y == NULL || width == NULL || height == NULL) {
6434 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6435 return CAMERA_ERROR_INVALID_PARAMETER;
6438 camera_cli_s *pc = (camera_cli_s *)camera;
6439 if (pc->cb_info == NULL) {
6440 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6441 return CAMERA_ERROR_INVALID_PARAMETER;
6444 int ret = CAMERA_ERROR_NONE;
6445 int sock_fd = pc->cb_info->fd;
6446 int get_display_roi_area[4] = {0,};
6447 muse_camera_api_e api = MUSE_CAMERA_API_GET_DISPLAY_ROI_AREA;
6449 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6451 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6453 if (ret == CAMERA_ERROR_NONE) {
6454 muse_camera_msg_get_array(get_display_roi_area, pc->cb_info->recv_msg);
6456 *x = get_display_roi_area[0];
6457 *y = get_display_roi_area[1];
6458 *width = get_display_roi_area[2];
6459 *height = get_display_roi_area[3];
6461 LOGD("ret : 0x%x", ret);
6463 LOGE("Returned value is not valid : 0x%x", ret);