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>
34 #include <Ecore_Wayland.h>
35 #include <wayland-client.h>
36 #include <tizen-extension-client-protocol.h>
37 #ifdef TIZEN_FEATURE_EVAS_RENDERER
38 #include <mm_evas_renderer.h>
39 #endif /* TIZEN_FEATURE_EVAS_RENDERER */
44 #define LOG_TAG "TIZEN_N_CAMERA"
47 static void __global(void *data, struct wl_registry *registry,
48 uint32_t name, const char *interface, uint32_t version)
50 struct tizen_surface **tz_surface = NULL;
57 tz_surface = (struct tizen_surface **)data;
60 LOGW("NULL interface");
64 /*LOGI("interface %s", interface);*/
66 if (strcmp(interface, "tizen_surface") == 0) {
67 LOGD("binding tizen surface for wayland");
69 *tz_surface = wl_registry_bind(registry, name, &tizen_surface_interface, version);
70 if (*tz_surface == NULL)
71 LOGE("failed to bind");
79 static void __global_remove(void *data, struct wl_registry *wl_registry, uint32_t name)
85 static const struct wl_registry_listener _camera_wl_registry_listener = {
90 void __parent_id_getter(void *data, struct tizen_resource *tizen_resource, uint32_t id)
97 *((unsigned int *)data) = id;
99 LOGD("[CLIENT] got parent_id [%u] from server", id);
104 static const struct tizen_resource_listener _camera_tz_resource_listener = {
108 int _get_wl_info(Evas_Object *obj, camera_wl_info_s *wl_info)
110 int ret = CAMERA_ERROR_NONE;
111 Ecore_Wl_Window *window = NULL;
112 struct wl_display *display = NULL;
113 struct wl_surface *surface = NULL;
114 struct wl_registry *registry = NULL;
115 struct tizen_surface *tz_surface = NULL;
116 struct tizen_resource *tz_resource = NULL;
118 if (!obj || !wl_info) {
119 LOGE("NULL parameter %p %p", obj, wl_info);
120 return CAMERA_ERROR_INVALID_OPERATION;
123 window = elm_win_wl_window_get(obj);
125 LOGE("failed to get wayland window");
126 ret = CAMERA_ERROR_INVALID_OPERATION;
130 surface = (struct wl_surface *)ecore_wl_window_surface_get(window);
132 LOGE("failed to get wayland surface");
133 ret = CAMERA_ERROR_INVALID_OPERATION;
137 display = (struct wl_display *)ecore_wl_display_get();
139 LOGE("failed to get wayland display");
140 ret = CAMERA_ERROR_INVALID_OPERATION;
144 registry = wl_display_get_registry(display);
146 LOGE("failed to get wayland registry");
147 ret = CAMERA_ERROR_INVALID_OPERATION;
151 wl_registry_add_listener(registry, &_camera_wl_registry_listener, &tz_surface);
153 wl_display_dispatch(display);
154 wl_display_roundtrip(display);
157 LOGE("failed to get tizen surface");
158 ret = CAMERA_ERROR_INVALID_OPERATION;
162 /* Get parent_id which is unique in a entire systemw. */
163 tz_resource = tizen_surface_get_tizen_resource(tz_surface, surface);
165 LOGE("failed to get tizen resurce");
166 ret = CAMERA_ERROR_INVALID_OPERATION;
170 wl_info->parent_id = 0;
172 tizen_resource_add_listener(tz_resource, &_camera_tz_resource_listener, &wl_info->parent_id);
174 wl_display_roundtrip(display);
176 if (wl_info->parent_id > 0) {
178 Ecore_Evas *ecore_evas = NULL;
179 ret = CAMERA_ERROR_NONE;
181 wl_info->evas_obj = obj;
183 evas_object_geometry_get(obj, &wl_info->window_x, &wl_info->window_y,
184 &wl_info->window_width, &wl_info->window_height);
186 ecore_evas = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
188 rotation = ecore_evas_rotation_get(ecore_evas);
189 if (rotation == 90 || rotation == 270) {
190 int temp = wl_info->window_width;
192 LOGD("swap width and height %d, %d", wl_info->window_width, wl_info->window_height);
194 wl_info->window_width = wl_info->window_height;
195 wl_info->window_height = temp;
198 LOGW("failed to get ecore_evas.. skip rotation check");
201 LOGD("evas object : %p, rotation : %d, parent id : %u, window : %d,%d,%dx%d",
202 wl_info->evas_obj, rotation, wl_info->parent_id,
203 wl_info->window_x, wl_info->window_y,
204 wl_info->window_width, wl_info->window_height);
206 ret = CAMERA_ERROR_INVALID_OPERATION;
207 LOGE("failed to get parent id");
212 tizen_surface_destroy(tz_surface);
217 tizen_resource_destroy(tz_resource);
222 wl_registry_destroy(registry);
229 static int _import_tbm_key(tbm_bufmgr bufmgr, unsigned int tbm_key, tbm_bo *bo, tbm_bo_handle *bo_handle)
231 tbm_bo tmp_bo = NULL;
232 tbm_bo_handle tmp_bo_handle = {NULL, };
234 if (bufmgr == NULL || bo == NULL || bo_handle == NULL || tbm_key == 0) {
235 LOGE("invalid parameter - bufmgr %p, bo %p, bo_handle %p, key %d",
236 bufmgr, bo, bo_handle, tbm_key);
240 tmp_bo = tbm_bo_import(bufmgr, tbm_key);
241 if (tmp_bo == NULL) {
242 LOGE("bo import failed - bufmgr %p, key %d", bufmgr, tbm_key);
246 tmp_bo_handle = tbm_bo_map(tmp_bo, TBM_DEVICE_CPU, TBM_OPTION_READ);
247 if (tmp_bo_handle.ptr == NULL) {
248 LOGE("bo map failed %p", tmp_bo);
249 tbm_bo_unref(tmp_bo);
254 tbm_bo_unmap(tmp_bo);
256 /* set bo and bo_handle */
258 *bo_handle = tmp_bo_handle;
263 static void _release_imported_bo(tbm_bo *bo)
265 if (bo == NULL || *bo == NULL) {
276 static int _client_wait_for_cb_return(muse_camera_api_e api, camera_cb_info_s *cb_info, int time_out)
278 int ret = CAMERA_ERROR_NONE;
281 /*LOGD("Enter api : %d", api);*/
283 g_mutex_lock(&(cb_info->api_mutex[api]));
285 if (cb_info->api_activating[api] == 0) {
286 end_time = g_get_monotonic_time() + time_out * G_TIME_SPAN_SECOND;
287 if (g_cond_wait_until(&(cb_info->api_cond[api]), &(cb_info->api_mutex[api]), end_time)) {
288 ret = cb_info->api_ret[api];
289 cb_info->api_activating[api] = 0;
291 /*LOGD("return value : 0x%x", ret);*/
293 ret = CAMERA_ERROR_INVALID_OPERATION;
294 LOGE("api %d was TIMED OUT!", api);
297 ret = cb_info->api_ret[api];
298 cb_info->api_activating[api] = 0;
300 /*LOGD("condition is already checked for the api[%d], return[0x%x]", api, ret);*/
303 g_mutex_unlock(&(cb_info->api_mutex[api]));
305 if (ret == CAMERA_ERROR_SOUND_POLICY)
306 LOGW("DEPRECATION WARNING: CAMERA_ERROR_SOUND_POLICY is deprecated and will be removed from next release.");
307 else if (ret == CAMERA_ERROR_SOUND_POLICY_BY_CALL)
308 LOGW("DEPRECATION WARNING: CAMERA_ERROR_SOUND_POLICY_BY_CALL is deprecated and will be removed from next release.");
309 else if (ret == CAMERA_ERROR_SOUND_POLICY_BY_ALARM)
310 LOGW("DEPRECATION WARNING: CAMERA_ERROR_SOUND_POLICY_BY_ALARM is deprecated and will be removed from next release.");
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 TIZEN_FEATURE_EVAS_RENDERER
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 /* TIZEN_FEATURE_EVAS_RENDERER */
1025 LOGW("evas renderer is not supported");
1026 #endif /* TIZEN_FEATURE_EVAS_RENDERER */
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 if (policy == CAMERA_POLICY_SOUND)
1075 LOGW("DEPRECATION WARNING: CAMERA_POLICY_SOUND is deprecated and will be removed from next release.");
1076 else if (policy == CAMERA_POLICY_SOUND_BY_CALL)
1077 LOGW("DEPRECATION WARNING: CAMERA_POLICY_SOUND_BY_CALL is deprecated and will be removed from next release.");
1078 else if (policy == CAMERA_POLICY_SOUND_BY_ALARM)
1079 LOGW("DEPRECATION WARNING: CAMERA_POLICY_SOUND_BY_ALARM is deprecated and will be removed from next release.");
1081 ((camera_interrupted_cb)cb_info->user_cb[event])((camera_policy_e)policy,
1082 (camera_state_e)previous, (camera_state_e)current, cb_info->user_data[event]);
1085 case MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION:
1088 camera_detected_face_s *faces = NULL;
1090 muse_camera_msg_get(count, recv_msg);
1091 muse_camera_msg_get(tbm_key, recv_msg);
1093 if (count > 0 && tbm_key > 0) {
1094 LOGD("FACE_DETECTION - count %d, tbm_key %d", count, tbm_key);
1096 if (!_import_tbm_key(cb_info->bufmgr, tbm_key, &bo, &bo_handle))
1100 faces = bo_handle.ptr;
1102 ((camera_face_detected_cb)cb_info->user_cb[event])(faces, count, cb_info->user_data[event]);
1108 for (i = 0 ; i < count ; i++) {
1109 LOGD("id[%2d] - score %d, position (%d,%d,%dx%d)",
1110 i, faces[i].score, faces[i].x, faces[i].y, faces[i].width, faces[i].height);
1116 _release_imported_bo(&bo);
1119 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
1120 cb_info->fd, cb_info, INT, tbm_key);
1122 /*LOGD("return buffer done");*/
1124 LOGE("invalid message - count %d, key %d", count, tbm_key);
1128 case MUSE_CAMERA_EVENT_TYPE_ERROR:
1131 int current_state = 0;
1133 muse_camera_msg_get(error, recv_msg);
1134 muse_camera_msg_get(current_state, recv_msg);
1136 LOGE("ERROR - error 0x%x, current_state %d", error, current_state);
1138 if (error == CAMERA_ERROR_SOUND_POLICY)
1139 LOGW("DEPRECATION WARNING: CAMERA_ERROR_SOUND_POLICY is deprecated and will be removed from next release.");
1140 else if (error == CAMERA_ERROR_SOUND_POLICY_BY_CALL)
1141 LOGW("DEPRECATION WARNING: CAMERA_ERROR_SOUND_POLICY_BY_CALL is deprecated and will be removed from next release.");
1142 else if (error == CAMERA_ERROR_SOUND_POLICY_BY_ALARM)
1143 LOGW("DEPRECATION WARNING: CAMERA_ERROR_SOUND_POLICY_BY_ALARM is deprecated and will be removed from next release.");
1145 ((camera_error_cb)cb_info->user_cb[event])((camera_error_e)error,
1146 (camera_state_e)current_state, cb_info->user_data[event]);
1149 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_RESOLUTION:
1150 muse_camera_msg_get(param1, recv_msg);
1151 muse_camera_msg_get(param2, recv_msg);
1153 /*LOGD("SUPPORTED_PREVIEW_RESOLUTION - %d x %d", param1, param2);*/
1155 if (((camera_supported_preview_resolution_cb)cb_info->user_cb[event])(param1, param2, cb_info->user_data[event]) == false) {
1156 cb_info->user_cb[event] = NULL;
1157 cb_info->user_data[event] = NULL;
1158 LOGW("stop foreach callback for SUPPORTED_PREVIEW_RESOLUTION");
1161 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_RESOLUTION:
1162 muse_camera_msg_get(param1, recv_msg);
1163 muse_camera_msg_get(param2, recv_msg);
1165 /*LOGD("SUPPORTED_CAPTURE_RESOLUTION - %d x %d", param1, param2);*/
1167 if (((camera_supported_capture_resolution_cb)cb_info->user_cb[event])(param1, param2, cb_info->user_data[event]) == false) {
1168 cb_info->user_cb[event] = NULL;
1169 cb_info->user_data[event] = NULL;
1170 LOGW("stop foreach callback for SUPPORTED_CAPTURE_RESOLUTION");
1173 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_FORMAT:
1174 muse_camera_msg_get(param1, recv_msg);
1176 /*LOGD("SUPPORTED_CAPTURE_FORMAT - %d ", param1);*/
1178 if (((camera_supported_capture_format_cb)cb_info->user_cb[event])((camera_pixel_format_e)param1, cb_info->user_data[event]) == false) {
1179 cb_info->user_cb[event] = NULL;
1180 cb_info->user_data[event] = NULL;
1181 LOGW("stop foreach callback for SUPPORTED_CAPTURE_FORMAT");
1184 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_FORMAT:
1185 muse_camera_msg_get(param1, recv_msg);
1187 /*LOGD("SUPPORTED_PREVIEW_FORMAT - %d ", param1);*/
1189 if (((camera_supported_preview_format_cb)cb_info->user_cb[event])((camera_pixel_format_e)param1, cb_info->user_data[event]) == false) {
1190 cb_info->user_cb[event] = NULL;
1191 cb_info->user_data[event] = NULL;
1192 LOGW("stop foreach callback for SUPPORTED_PREVIEW_FORMAT");
1195 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_AF_MODE:
1196 muse_camera_msg_get(param1, recv_msg);
1198 /*LOGD("SUPPORTED_AF_MODE - %d ", param1);*/
1200 if (((camera_attr_supported_af_mode_cb)cb_info->user_cb[event])((camera_attr_af_mode_e)param1, cb_info->user_data[event]) == false) {
1201 cb_info->user_cb[event] = NULL;
1202 cb_info->user_data[event] = NULL;
1203 LOGW("stop foreach callback for SUPPORTED_AF_MODE");
1206 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EXPOSURE_MODE:
1207 muse_camera_msg_get(param1, recv_msg);
1209 /*LOGD("SUPPORTED_EXPOSURE_MODE - %d ", param1);*/
1211 if (((camera_attr_supported_exposure_mode_cb)cb_info->user_cb[event])((camera_attr_exposure_mode_e)param1, cb_info->user_data[event]) == false) {
1212 cb_info->user_cb[event] = NULL;
1213 cb_info->user_data[event] = NULL;
1214 LOGW("stop foreach callback for SUPPORTED_EXPOSURE_MODE");
1217 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_ISO:
1218 muse_camera_msg_get(param1, recv_msg);
1220 /*LOGD("SUPPORTED_ISO - %d ", param1);*/
1222 if (((camera_attr_supported_iso_cb)cb_info->user_cb[event])((camera_attr_iso_e)param1, cb_info->user_data[event]) == false) {
1223 cb_info->user_cb[event] = NULL;
1224 cb_info->user_data[event] = NULL;
1225 LOGW("stop foreach callback for SUPPORTED_ISO");
1228 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_WHITEBALANCE:
1229 muse_camera_msg_get(param1, recv_msg);
1231 /*LOGD("SUPPORTED_WHITEBALANCE - %d ", param1);*/
1233 if (((camera_attr_supported_whitebalance_cb)cb_info->user_cb[event])((camera_attr_whitebalance_e)param1, cb_info->user_data[event]) == false) {
1234 cb_info->user_cb[event] = NULL;
1235 cb_info->user_data[event] = NULL;
1236 LOGW("stop foreach callback for SUPPORTED_WHITEBALANCE");
1239 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EFFECT:
1240 muse_camera_msg_get(param1, recv_msg);
1242 /*LOGD("SUPPORTED_EFFECT - %d ", param1);*/
1244 if (((camera_attr_supported_effect_cb)cb_info->user_cb[event])((camera_attr_effect_mode_e)param1, cb_info->user_data[event]) == false) {
1245 cb_info->user_cb[event] = NULL;
1246 cb_info->user_data[event] = NULL;
1247 LOGW("stop foreach callback for SUPPORTED_EFFECT");
1250 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_SCENE_MODE:
1251 muse_camera_msg_get(param1, recv_msg);
1253 /*LOGD("SUPPORTED_SCENE_MODE - %d ", param1);*/
1255 if (((camera_attr_supported_scene_mode_cb)cb_info->user_cb[event])((camera_attr_scene_mode_e)param1, cb_info->user_data[event]) == false) {
1256 cb_info->user_cb[event] = NULL;
1257 cb_info->user_data[event] = NULL;
1258 LOGW("stop foreach callback for SUPPORTED_SCENE_MODE");
1261 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FLASH_MODE:
1262 muse_camera_msg_get(param1, recv_msg);
1264 /*LOGD("SUPPORTED_FLASH_MODE - %d ", param1);*/
1266 if (((camera_attr_supported_flash_mode_cb)cb_info->user_cb[event])((camera_attr_flash_mode_e)param1, cb_info->user_data[event]) == false) {
1267 cb_info->user_cb[event] = NULL;
1268 cb_info->user_data[event] = NULL;
1269 LOGW("stop foreach callback for SUPPORTED_FLASH_MODE");
1272 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS:
1273 muse_camera_msg_get(param1, recv_msg);
1275 /*LOGD("SUPPORTED_FPS - %d ", param1);*/
1277 if (((camera_attr_supported_fps_cb)cb_info->user_cb[event])((camera_attr_fps_e)param1, cb_info->user_data[event]) == false) {
1278 cb_info->user_cb[event] = NULL;
1279 cb_info->user_data[event] = NULL;
1280 LOGW("stop foreach callback for SUPPORTED_FPS");
1283 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS_BY_RESOLUTION:
1284 muse_camera_msg_get(param1, recv_msg);
1286 /*LOGD("SUPPORTED_FPS_BY_RESOLUTION - %d ", param1);*/
1288 if (((camera_attr_supported_fps_cb)cb_info->user_cb[event])((camera_attr_fps_e)param1, cb_info->user_data[event]) == false) {
1289 cb_info->user_cb[event] = NULL;
1290 cb_info->user_data[event] = NULL;
1291 LOGW("stop foreach callback for SUPPORTED_FPS_BY_RESOLUTION");
1294 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_FLIP:
1295 muse_camera_msg_get(param1, recv_msg);
1297 /*LOGD("SUPPORTED_STREAM_FLIP - %d ", param1);*/
1299 if (((camera_attr_supported_stream_flip_cb)cb_info->user_cb[event])((camera_flip_e)param1, cb_info->user_data[event]) == false) {
1300 cb_info->user_cb[event] = NULL;
1301 cb_info->user_data[event] = NULL;
1302 LOGW("stop foreach callback for SUPPORTED_STREAM_FLIP");
1305 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION:
1306 muse_camera_msg_get(param1, recv_msg);
1308 /*LOGD("SUPPORTED_STREAM_ROTATION - %d ", param1);*/
1310 if (((camera_attr_supported_stream_rotation_cb)cb_info->user_cb[event])((camera_rotation_e)param1, cb_info->user_data[event]) == false) {
1311 cb_info->user_cb[event] = NULL;
1312 cb_info->user_data[event] = NULL;
1313 LOGW("stop foreach callback for SUPPORTED_STREAM_ROTATION");
1316 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE:
1317 muse_camera_msg_get(param1, recv_msg);
1319 /*LOGD("SUPPORTED_THEATER_MODE - %d ", param1);*/
1321 if (((camera_attr_supported_theater_mode_cb)cb_info->user_cb[event])((camera_attr_theater_mode_e)param1, cb_info->user_data[event]) == false) {
1322 cb_info->user_cb[event] = NULL;
1323 cb_info->user_data[event] = NULL;
1324 LOGW("stop foreach callback for SUPPORTED_THEATER_MODE");
1327 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PTZ_TYPE:
1328 muse_camera_msg_get(param1, recv_msg);
1330 /*LOGD("SUPPORTED_PTZ_TYPE - %d ", param1);*/
1332 if (((camera_attr_supported_ptz_type_cb)cb_info->user_cb[event])((camera_attr_ptz_type_e)param1, cb_info->user_data[event]) == false) {
1333 cb_info->user_cb[event] = NULL;
1334 cb_info->user_data[event] = NULL;
1335 LOGW("stop foreach callback for SUPPORTED_PTZ_TYPE");
1338 case MUSE_CAMERA_EVENT_TYPE_CAPTURE:
1340 camera_image_data_s *rImage = NULL;
1341 camera_image_data_s *rPostview = NULL;
1342 camera_image_data_s *rThumbnail = NULL;
1343 unsigned char *buf_pos = NULL;
1344 int tbm_key_main = 0;
1345 int tbm_key_post = 0;
1346 int tbm_key_thumb = 0;
1347 tbm_bo bo_main = NULL;
1348 tbm_bo bo_post = NULL;
1349 tbm_bo bo_thumb = NULL;
1350 tbm_bo_handle bo_main_handle = {NULL, };
1351 tbm_bo_handle bo_post_handle = {NULL, };
1352 tbm_bo_handle bo_thumb_handle = {NULL, };
1354 muse_camera_msg_get(tbm_key_main, recv_msg);
1355 muse_camera_msg_get(tbm_key_post, recv_msg);
1356 muse_camera_msg_get(tbm_key_thumb, recv_msg);
1359 LOGD("camera capture callback came in. tbm_key_main %d, tbm_key_post %d, tbm_key_thumb %d",
1360 tbm_key_main, tbm_key_post, tbm_key_thumb);
1363 if (tbm_key_main <= 0) {
1364 LOGE("invalid tbm_key_main %d", tbm_key_main);
1368 /* import tbm bo and get virtual address */
1369 if (!_import_tbm_key(cb_info->bufmgr, tbm_key_main, &bo_main, &bo_main_handle))
1372 buf_pos = (unsigned char *)bo_main_handle.ptr;
1373 rImage = (camera_image_data_s *)buf_pos;
1374 rImage->data = buf_pos + sizeof(camera_image_data_s);
1376 LOGD("image info %dx%d, size : %d", rImage->width, rImage->height, rImage->size);
1378 if (tbm_key_post > 0) {
1379 /* import tbm bo and get virtual address */
1380 if (!_import_tbm_key(cb_info->bufmgr, tbm_key_post, &bo_post, &bo_post_handle))
1383 buf_pos = (unsigned char *)bo_post_handle.ptr;
1384 rPostview = (camera_image_data_s *)buf_pos;
1385 LOGD("rPostview->size : %d", rPostview->size);
1386 rPostview->data = buf_pos + sizeof(camera_image_data_s);
1389 if (tbm_key_thumb > 0) {
1390 /* import tbm bo and get virtual address */
1391 if (!_import_tbm_key(cb_info->bufmgr, tbm_key_thumb, &bo_thumb, &bo_thumb_handle))
1394 buf_pos = (unsigned char *)bo_thumb_handle.ptr;
1396 rThumbnail = (camera_image_data_s *)buf_pos;
1397 LOGD("rThumbnail->size : %d", rThumbnail->size);
1398 rThumbnail->data = buf_pos + sizeof(camera_image_data_s);
1401 ((camera_capturing_cb)cb_info->user_cb[event])(rImage, rPostview, rThumbnail, cb_info->user_data[event]);
1403 /* unmap and unref tbm bo */
1404 _release_imported_bo(&bo_main);
1407 tbm_key = tbm_key_main;
1408 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
1409 cb_info->fd, cb_info, INT, tbm_key);
1411 if (tbm_key_post > 0) {
1412 /* unmap and unref tbm bo */
1413 _release_imported_bo(&bo_post);
1416 tbm_key = tbm_key_post;
1417 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
1418 cb_info->fd, cb_info, INT, tbm_key);
1421 if (tbm_key_thumb > 0) {
1422 /* unmap and unref tbm bo */
1423 _release_imported_bo(&bo_thumb);
1426 tbm_key = tbm_key_thumb;
1427 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
1428 cb_info->fd, cb_info, INT, tbm_key);
1431 LOGD("return buffer done");
1434 case MUSE_CAMERA_EVENT_TYPE_VIDEO_FRAME_RENDER_ERROR:
1437 LOGW("Unknown event : %d", event);
1444 static bool _camera_idle_event_callback(void *data)
1446 camera_cb_info_s *cb_info = NULL;
1447 camera_idle_event_s *cam_idle_event = (camera_idle_event_s *)data;
1449 if (cam_idle_event == NULL) {
1450 LOGE("cam_idle_event is NULL");
1455 g_mutex_lock(&cam_idle_event->event_mutex);
1457 cb_info = cam_idle_event->cb_info;
1458 if (cb_info == NULL) {
1459 LOGW("camera cb_info is NULL. event %d", cam_idle_event->event);
1460 goto IDLE_EVENT_CALLBACK_DONE;
1463 /* remove event from list */
1464 g_mutex_lock(&cb_info->idle_event_mutex);
1465 if (cb_info->idle_event_list)
1466 cb_info->idle_event_list = g_list_remove(cb_info->idle_event_list, (gpointer)cam_idle_event);
1468 /*LOGD("remove camera idle event %p, %p", cam_idle_event, cb_info->idle_event_list);*/
1469 g_mutex_unlock(&cb_info->idle_event_mutex);
1472 _client_user_callback(cam_idle_event->cb_info, cam_idle_event->recv_msg, cam_idle_event->event);
1474 /* send signal for waiting thread */
1475 g_cond_signal(&cb_info->idle_event_cond);
1477 IDLE_EVENT_CALLBACK_DONE:
1478 /* unlock and release event */
1479 g_mutex_unlock(&cam_idle_event->event_mutex);
1480 g_mutex_clear(&cam_idle_event->event_mutex);
1482 g_free(cam_idle_event);
1483 cam_idle_event = NULL;
1488 static void *_camera_msg_handler_func(gpointer data)
1492 camera_message_s *cam_msg = NULL;
1493 camera_idle_event_s *cam_idle_event = NULL;
1494 camera_msg_handler_info_s *handler_info = (camera_msg_handler_info_s *)data;
1495 camera_cb_info_s *cb_info = NULL;
1497 if (!handler_info || !handler_info->cb_info) {
1498 LOGE("t:%d NULL handler %p", type, handler_info);
1502 cb_info = (camera_cb_info_s *)handler_info->cb_info;
1503 type = handler_info->type;
1505 LOGD("t:%d start", type);
1507 g_mutex_lock(&handler_info->mutex);
1509 while (g_atomic_int_get(&handler_info->running)) {
1510 if (g_queue_is_empty(handler_info->queue)) {
1511 /*LOGD("t:%d signal wait...", type);*/
1512 g_cond_wait(&handler_info->cond, &handler_info->mutex);
1513 /*LOGD("t:%d signal received", type);*/
1515 if (g_atomic_int_get(&handler_info->running) == 0) {
1516 LOGD("t:%d stop event thread", type);
1521 cam_msg = (camera_message_s *)g_queue_pop_head(handler_info->queue);
1523 g_mutex_unlock(&handler_info->mutex);
1525 if (cam_msg == NULL) {
1526 LOGE("t:%d NULL message", type);
1527 g_mutex_lock(&handler_info->mutex);
1533 if (api < MUSE_CAMERA_API_MAX) {
1536 g_mutex_lock(&cb_info->api_mutex[api]);
1538 if (muse_camera_msg_get(ret, cam_msg->recv_msg)) {
1539 cb_info->api_ret[api] = ret;
1540 cb_info->api_activating[api] = 1;
1542 /*LOGD("t:%d camera api %d - return 0x%x", type, ret);*/
1544 g_cond_signal(&cb_info->api_cond[api]);
1546 LOGE("t:%d failed to get camera ret for api %d, msg %s", type, api, cam_msg->recv_msg);
1549 g_mutex_unlock(&cb_info->api_mutex[api]);
1550 } else if (api == MUSE_CAMERA_CB_EVENT) {
1551 switch (cam_msg->event_class) {
1552 case MUSE_CAMERA_EVENT_CLASS_THREAD_SUB:
1553 _client_user_callback(cb_info, cam_msg->recv_msg, cam_msg->event);
1555 case MUSE_CAMERA_EVENT_CLASS_THREAD_MAIN:
1556 cam_idle_event = g_new0(camera_idle_event_s, 1);
1557 if (cam_idle_event == NULL) {
1558 LOGE("t:%d cam_idle_event alloc failed", type);
1562 cam_idle_event->event = cam_msg->event;
1563 cam_idle_event->cb_info = cb_info;
1564 g_mutex_init(&cam_idle_event->event_mutex);
1565 memcpy(cam_idle_event->recv_msg, cam_msg->recv_msg, sizeof(cam_idle_event->recv_msg));
1567 /*LOGD("t:%d add camera event[%d, %p] to IDLE", type, event, cam_idle_event);*/
1569 g_mutex_lock(&cb_info->idle_event_mutex);
1570 cb_info->idle_event_list = g_list_append(cb_info->idle_event_list, (gpointer)cam_idle_event);
1571 g_mutex_unlock(&cb_info->idle_event_mutex);
1573 g_idle_add_full(G_PRIORITY_DEFAULT,
1574 (GSourceFunc)_camera_idle_event_callback,
1575 (gpointer)cam_idle_event,
1579 LOGE("t:%d not handled event class %d", type, cam_msg->event_class);
1583 LOGE("t:%d unknown camera api[%d] message[%s]", type, api, cam_msg->recv_msg);
1589 g_mutex_lock(&handler_info->mutex);
1592 /* remove remained event */
1593 while (!g_queue_is_empty(handler_info->queue)) {
1594 cam_msg = (camera_message_s *)g_queue_pop_head(handler_info->queue);
1596 LOGD("t:%d remove camera message %p", type, cam_msg);
1600 LOGW("t:%d NULL camera message", type);
1604 g_mutex_unlock(&handler_info->mutex);
1606 LOGD("t:%d return", type);
1612 static void _camera_remove_idle_event_all(camera_cb_info_s *cb_info)
1614 camera_idle_event_s *cam_idle_event = NULL;
1615 gboolean ret = TRUE;
1617 gint64 end_time = 0;
1619 if (cb_info == NULL) {
1620 LOGE("cb_info is NULL");
1624 g_mutex_lock(&cb_info->idle_event_mutex);
1626 if (cb_info->idle_event_list == NULL) {
1627 LOGD("No idle event is remained.");
1629 list = cb_info->idle_event_list;
1632 cam_idle_event = list->data;
1633 list = g_list_next(list);
1635 if (!cam_idle_event) {
1636 LOGW("Fail to remove idle event. The event is NULL");
1638 if (g_mutex_trylock(&cam_idle_event->event_mutex)) {
1639 ret = g_idle_remove_by_data(cam_idle_event);
1641 LOGD("remove idle event [%p], ret[%d]", cam_idle_event, ret);
1644 cam_idle_event->cb_info = NULL;
1645 LOGW("idle callback for event %p will be called later", cam_idle_event);
1648 cb_info->idle_event_list = g_list_remove(cb_info->idle_event_list, (gpointer)cam_idle_event);
1650 g_mutex_unlock(&cam_idle_event->event_mutex);
1653 g_mutex_clear(&cam_idle_event->event_mutex);
1655 g_free(cam_idle_event);
1656 cam_idle_event = NULL;
1658 LOGD("remove idle event done");
1661 LOGW("event lock failed. it's being called...");
1663 end_time = g_get_monotonic_time() + G_TIME_SPAN_MILLISECOND * 100;
1665 if (g_cond_wait_until(&cb_info->idle_event_cond, &cb_info->idle_event_mutex, end_time))
1666 LOGW("signal received");
1673 g_list_free(cb_info->idle_event_list);
1674 cb_info->idle_event_list = NULL;
1677 g_mutex_unlock(&cb_info->idle_event_mutex);
1682 static void *_camera_msg_recv_func(gpointer data)
1689 int event_class = 0;
1693 char *recv_msg = NULL;
1694 char **parse_str = NULL;
1695 camera_cb_info_s *cb_info = (camera_cb_info_s *)data;
1697 if (cb_info == NULL) {
1698 LOGE("cb_info NULL");
1704 parse_str = (char **)malloc(sizeof(char *) * CAMERA_PARSE_STRING_SIZE);
1705 if (parse_str == NULL) {
1706 LOGE("parse_str malloc failed");
1710 for (i = 0 ; i < CAMERA_PARSE_STRING_SIZE ; i++) {
1711 parse_str[i] = (char *)malloc(sizeof(char) * MUSE_CAMERA_MSG_MAX_LENGTH);
1712 if (parse_str[i] == NULL) {
1713 LOGE("parse_str[%d] malloc failed", i);
1714 goto CB_HANDLER_EXIT;
1718 recv_msg = cb_info->recv_msg;
1720 while (g_atomic_int_get(&cb_info->msg_recv_running)) {
1721 ret = muse_core_ipc_recv_msg(cb_info->fd, recv_msg);
1724 recv_msg[ret] = '\0';
1730 /*LOGD("recvMSg : %s, length : %d", recv_msg, ret);*/
1732 /* Need to split the combined entering msgs.
1733 This module supports up to 200 combined msgs. */
1734 for (str_pos = 0; str_pos < ret; str_pos++) {
1735 if (recv_msg[str_pos] == '}') {
1736 memset(parse_str[num_token], 0x0, sizeof(char) * MUSE_CAMERA_MSG_MAX_LENGTH);
1737 strncpy(parse_str[num_token], recv_msg + prev_pos, str_pos - prev_pos + 1);
1738 /*LOGD("splitted msg : [%s], Index : %d", parse_str[num_token], num_token);*/
1739 prev_pos = str_pos+1;
1744 /*LOGD("num_token : %d", num_token);*/
1746 /* Re-construct to the useful single msg. */
1747 for (i = 0; i < num_token; i++) {
1748 if (i >= CAMERA_PARSE_STRING_SIZE) {
1749 LOGE("invalid token index %d", i);
1758 if (!muse_camera_msg_get(api, parse_str[i])) {
1759 LOGE("failed to get camera api");
1763 if (api == MUSE_CAMERA_CB_EVENT) {
1764 if (!muse_camera_msg_get(event, parse_str[i]) ||
1765 !muse_camera_msg_get(event_class, parse_str[i])) {
1766 LOGE("failed to get camera event or event_class [%s]", parse_str[i]);
1770 if (!muse_camera_msg_get(api_class, parse_str[i])) {
1771 LOGE("failed to get camera api_class [%s]", parse_str[i]);
1776 if (api_class == MUSE_CAMERA_API_CLASS_IMMEDIATE) {
1777 if (api >= MUSE_CAMERA_API_MAX) {
1778 LOGE("invalid api %d", api);
1782 g_mutex_lock(&cb_info->api_mutex[api]);
1784 if (!muse_camera_msg_get(ret, parse_str[i])) {
1785 LOGE("failed to get camera ret");
1786 g_mutex_unlock(&cb_info->api_mutex[api]);
1790 cb_info->api_ret[api] = ret;
1791 cb_info->api_activating[api] = 1;
1793 if (api == MUSE_CAMERA_API_CREATE) {
1794 if (ret != CAMERA_ERROR_NONE) {
1795 g_atomic_int_set(&cb_info->msg_recv_running, 0);
1796 LOGE("camera create error 0x%x. close client cb handler", ret);
1798 } else if (api == MUSE_CAMERA_API_DESTROY) {
1799 if (ret == CAMERA_ERROR_NONE) {
1800 g_atomic_int_set(&cb_info->msg_recv_running, 0);
1801 LOGD("camera destroy done. close client cb handler");
1805 g_cond_signal(&cb_info->api_cond[api]);
1806 g_mutex_unlock(&cb_info->api_mutex[api]);
1807 } else if (api_class == MUSE_CAMERA_API_CLASS_THREAD_SUB || api == MUSE_CAMERA_CB_EVENT) {
1808 camera_message_s *cam_msg = g_new0(camera_message_s, 1);
1809 if (cam_msg == NULL) {
1810 LOGE("failed to alloc cam_msg");
1815 cam_msg->event = event;
1816 cam_msg->event_class = event_class;
1818 memcpy(cam_msg->recv_msg, parse_str[i], sizeof(cam_msg->recv_msg));
1820 /*LOGD("add camera message to queue : api %d, event %d, event_class %d", api, event, event_class);*/
1822 if (event == MUSE_CAMERA_EVENT_TYPE_PREVIEW) {
1823 g_mutex_lock(&cb_info->preview_cb_info.mutex);
1824 g_queue_push_tail(cb_info->preview_cb_info.queue, (gpointer)cam_msg);
1825 g_cond_signal(&cb_info->preview_cb_info.cond);
1826 g_mutex_unlock(&cb_info->preview_cb_info.mutex);
1827 } else if (event == MUSE_CAMERA_EVENT_TYPE_CAPTURE) {
1828 g_mutex_lock(&cb_info->capture_cb_info.mutex);
1829 g_queue_push_tail(cb_info->capture_cb_info.queue, (gpointer)cam_msg);
1830 g_cond_signal(&cb_info->capture_cb_info.cond);
1831 g_mutex_unlock(&cb_info->capture_cb_info.mutex);
1833 g_mutex_lock(&cb_info->msg_handler_info.mutex);
1834 g_queue_push_tail(cb_info->msg_handler_info.queue, (gpointer)cam_msg);
1835 g_cond_signal(&cb_info->msg_handler_info.cond);
1836 g_mutex_unlock(&cb_info->msg_handler_info.mutex);
1839 LOGW("unknown camera api %d and api_class %d", api, api_class);
1845 LOGD("client cb exit");
1849 for (i = 0 ; i < CAMERA_PARSE_STRING_SIZE ; i++) {
1852 parse_str[i] = NULL;
1864 static bool __create_msg_handler_thread(camera_msg_handler_info_s *handler_info,
1865 int type, const char *thread_name, camera_cb_info_s *cb_info)
1867 if (!handler_info || !thread_name || !cb_info) {
1868 LOGE("t:%d NULL %p %p %p",
1869 type, handler_info, thread_name, cb_info);
1875 handler_info->type = type;
1876 handler_info->queue = g_queue_new();
1877 if (handler_info->queue == NULL) {
1878 LOGE("t:%d queue failed", type);
1882 g_mutex_init(&handler_info->mutex);
1883 g_cond_init(&handler_info->cond);
1885 handler_info->cb_info = (void *)cb_info;
1886 g_atomic_int_set(&handler_info->running, 1);
1888 handler_info->thread = g_thread_try_new(thread_name,
1889 _camera_msg_handler_func, (gpointer)handler_info, NULL);
1890 if (handler_info->thread == NULL) {
1891 LOGE("t:%d thread failed", type);
1893 g_mutex_clear(&handler_info->mutex);
1894 g_cond_clear(&handler_info->cond);
1895 g_queue_free(handler_info->queue);
1896 handler_info->queue = NULL;
1901 LOGD("t:%d done", type);
1907 static void __destroy_msg_handler_thread(camera_msg_handler_info_s *handler_info)
1911 if (!handler_info) {
1912 LOGE("NULL handler");
1916 type = handler_info->type;
1918 LOGD("t:%d thread %p", type, handler_info->thread);
1920 if (handler_info->thread) {
1921 g_mutex_lock(&handler_info->mutex);
1922 g_atomic_int_set(&handler_info->running, 0);
1923 g_cond_signal(&handler_info->cond);
1924 g_mutex_unlock(&handler_info->mutex);
1926 g_thread_join(handler_info->thread);
1927 g_thread_unref(handler_info->thread);
1928 handler_info->thread = NULL;
1930 g_mutex_clear(&handler_info->mutex);
1931 g_cond_clear(&handler_info->cond);
1932 g_queue_free(handler_info->queue);
1933 handler_info->queue = NULL;
1936 LOGD("t:%d done", type);
1942 static camera_cb_info_s *_client_callback_new(gint sockfd)
1944 camera_cb_info_s *cb_info = NULL;
1947 g_return_val_if_fail(sockfd > 0, NULL);
1949 cb_info = g_new0(camera_cb_info_s, 1);
1950 if (cb_info == NULL) {
1951 LOGE("cb_info failed");
1955 g_mutex_init(&cb_info->idle_event_mutex);
1956 g_cond_init(&cb_info->idle_event_cond);
1957 g_mutex_init(&cb_info->mp_data_mutex);
1958 #ifdef TIZEN_FEATURE_EVAS_RENDERER
1959 g_mutex_init(&cb_info->evas_mutex);
1960 #endif /* TIZEN_FEATURE_EVAS_RENDERER */
1962 for (i = 0 ; i < MUSE_CAMERA_API_MAX ; i++) {
1963 g_mutex_init(&cb_info->api_mutex[i]);
1964 g_cond_init(&cb_info->api_cond[i]);
1967 /* message handler thread */
1968 if (!__create_msg_handler_thread(&cb_info->msg_handler_info,
1969 CAMERA_MESSAGE_HANDLER_TYPE_GENERAL, "camera_msg_handler", cb_info)) {
1970 LOGE("msg_handler_info failed");
1974 /* message handler thread for preview callback */
1975 if (!__create_msg_handler_thread(&cb_info->preview_cb_info,
1976 CAMERA_MESSAGE_HANDLER_TYPE_PREVIEW_CB, "camera_msg_handler:preview_cb", cb_info)) {
1977 LOGE("preview_cb_info failed");
1981 /* message handler thread for capture callback */
1982 if (!__create_msg_handler_thread(&cb_info->capture_cb_info,
1983 CAMERA_MESSAGE_HANDLER_TYPE_CAPTURE_CB, "camera_msg_handler:capture_cb", cb_info)) {
1984 LOGE("capture_cb_info failed");
1988 cb_info->fd = sockfd;
1989 cb_info->preview_cb_flag = 0;
1990 #ifdef TIZEN_FEATURE_EVAS_RENDERER
1991 cb_info->evas_info = NULL;
1992 #endif /* TIZEN_FEATURE_EVAS_RENDERER */
1994 /* message receive thread */
1995 g_atomic_int_set(&cb_info->msg_recv_running, 1);
1996 cb_info->msg_recv_thread = g_thread_try_new("camera_msg_recv",
1997 _camera_msg_recv_func, (gpointer)cb_info, NULL);
1998 if (cb_info->msg_recv_thread == NULL) {
1999 LOGE("message receive thread creation failed");
2007 __destroy_msg_handler_thread(&cb_info->msg_handler_info);
2008 __destroy_msg_handler_thread(&cb_info->preview_cb_info);
2009 __destroy_msg_handler_thread(&cb_info->capture_cb_info);
2011 for (i = 0 ; i < MUSE_CAMERA_API_MAX ; i++) {
2012 g_mutex_clear(&cb_info->api_mutex[i]);
2013 g_cond_clear(&cb_info->api_cond[i]);
2016 g_mutex_clear(&cb_info->idle_event_mutex);
2017 g_cond_clear(&cb_info->idle_event_cond);
2018 g_mutex_clear(&cb_info->mp_data_mutex);
2019 #ifdef TIZEN_FEATURE_EVAS_RENDERER
2020 g_mutex_clear(&cb_info->evas_mutex);
2021 #endif /* TIZEN_FEATURE_EVAS_RENDERER */
2030 static void _client_callback_destroy(camera_cb_info_s *cb_info)
2034 g_return_if_fail(cb_info != NULL);
2036 LOGD("MSG receive thread[%p] destroy", cb_info->msg_recv_thread);
2038 g_thread_join(cb_info->msg_recv_thread);
2039 g_thread_unref(cb_info->msg_recv_thread);
2040 cb_info->msg_recv_thread = NULL;
2042 LOGD("msg thread removed");
2044 /* destroy msg handler threads */
2045 __destroy_msg_handler_thread(&cb_info->msg_handler_info);
2046 __destroy_msg_handler_thread(&cb_info->preview_cb_info);
2047 __destroy_msg_handler_thread(&cb_info->capture_cb_info);
2049 for (i = 0 ; i < MUSE_CAMERA_API_MAX ; i++) {
2050 g_mutex_clear(&cb_info->api_mutex[i]);
2051 g_cond_clear(&cb_info->api_cond[i]);
2054 g_mutex_clear(&cb_info->idle_event_mutex);
2055 g_cond_clear(&cb_info->idle_event_cond);
2056 g_mutex_clear(&cb_info->mp_data_mutex);
2057 #ifdef TIZEN_FEATURE_EVAS_RENDERER
2058 g_mutex_clear(&cb_info->evas_mutex);
2059 #endif /* TIZEN_FEATURE_EVAS_RENDERER */
2061 LOGD("event thread removed");
2063 if (cb_info->fd > -1) {
2064 muse_core_connection_close(cb_info->fd);
2068 if (cb_info->bufmgr) {
2069 tbm_bufmgr_deinit(cb_info->bufmgr);
2070 cb_info->bufmgr = NULL;
2072 if (cb_info->pkt_fmt) {
2073 media_format_unref(cb_info->pkt_fmt);
2074 cb_info->pkt_fmt = NULL;
2077 #ifdef TIZEN_FEATURE_EVAS_RENDERER
2078 if (cb_info->evas_info)
2079 mm_evas_renderer_destroy(&cb_info->evas_info);
2080 #endif /* TIZEN_FEATURE_EVAS_RENDERER */
2082 cb_info->preview_cb_flag = 0;
2091 int _camera_start_evas_rendering(camera_h camera)
2093 int ret = CAMERA_ERROR_NONE;
2094 camera_cli_s *pc = (camera_cli_s *)camera;
2096 if (camera == NULL) {
2097 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2098 return CAMERA_ERROR_INVALID_PARAMETER;
2101 if (pc->cb_info == NULL) {
2102 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2103 return CAMERA_ERROR_INVALID_PARAMETER;
2108 if (!CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
2109 LOGE("EVAS surface is not set");
2110 return CAMERA_ERROR_NONE;
2113 #ifdef TIZEN_FEATURE_EVAS_RENDERER
2114 g_mutex_lock(&pc->cb_info->evas_mutex);
2116 /* set evas render flag as RUN */
2117 pc->cb_info->run_evas_render = true;
2118 ret = CAMERA_ERROR_NONE;
2120 g_mutex_unlock(&pc->cb_info->evas_mutex);
2121 #else /* TIZEN_FEATURE_EVAS_RENDERER */
2122 LOGW("evas renderer is not supported");
2123 ret = CAMERA_ERROR_NOT_SUPPORTED;
2124 #endif /* TIZEN_FEATURE_EVAS_RENDERER */
2130 int _camera_stop_evas_rendering(camera_h camera, bool keep_screen)
2132 int ret = CAMERA_ERROR_NONE;
2133 camera_cli_s *pc = (camera_cli_s *)camera;
2135 if (camera == NULL) {
2136 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2137 return CAMERA_ERROR_INVALID_PARAMETER;
2140 if (pc->cb_info == NULL) {
2141 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2142 return CAMERA_ERROR_INVALID_PARAMETER;
2145 LOGD("stop - keep screen %d", keep_screen);
2147 if (!CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
2148 LOGE("EVAS surface is not set");
2149 return CAMERA_ERROR_NONE;
2152 #ifdef TIZEN_FEATURE_EVAS_RENDERER
2153 g_mutex_lock(&pc->cb_info->evas_mutex);
2155 /* set evas render flag as STOP and release buffers */
2156 pc->cb_info->run_evas_render = false;
2158 ret = mm_evas_renderer_retrieve_all_packets(pc->cb_info->evas_info, keep_screen);
2159 if (ret != MM_ERROR_NONE) {
2160 LOGE("mm_evas_renderer_retrieve_all_packets failed 0x%x", ret);
2161 ret = CAMERA_ERROR_INVALID_OPERATION;
2164 g_mutex_unlock(&pc->cb_info->evas_mutex);
2165 #else /* TIZEN_FEATURE_EVAS_RENDERER */
2166 LOGW("evas renderer is not supported");
2167 ret = CAMERA_ERROR_NOT_SUPPORTED;
2168 #endif /* TIZEN_FEATURE_EVAS_RENDERER */
2174 int camera_create(camera_device_e device, camera_h *camera)
2177 char *send_msg = NULL;
2179 int ret = CAMERA_ERROR_NONE;
2181 camera_cli_s *pc = NULL;
2182 tbm_bufmgr bufmgr = NULL;
2184 muse_camera_api_e api = MUSE_CAMERA_API_CREATE;
2185 muse_core_api_module_e muse_module = MUSE_CAMERA;
2186 int device_type = (int)device;
2188 if (camera == NULL) {
2189 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2190 return CAMERA_ERROR_INVALID_PARAMETER;
2193 bufmgr = tbm_bufmgr_init(-1);
2194 if (bufmgr == NULL) {
2195 LOGE("get tbm bufmgr failed");
2196 return CAMERA_ERROR_INVALID_OPERATION;
2199 sock_fd = muse_core_client_new();
2201 LOGE("muse_core_client_new failed - returned fd %d", sock_fd);
2202 ret = CAMERA_ERROR_INVALID_OPERATION;
2208 send_msg = muse_core_msg_json_factory_new(api,
2209 MUSE_TYPE_INT, "module", muse_module,
2210 MUSE_TYPE_INT, PARAM_DEVICE_TYPE, device_type,
2211 MUSE_TYPE_INT, "pid", pid,
2216 ret = CAMERA_ERROR_OUT_OF_MEMORY;
2220 send_ret = muse_core_ipc_send_msg(sock_fd, send_msg);
2222 muse_core_msg_json_factory_free(send_msg);
2226 LOGE("send msg failed %d", errno);
2227 ret = CAMERA_ERROR_INVALID_OPERATION;
2231 pc = g_new0(camera_cli_s, 1);
2233 LOGE("camera_cli_s alloc failed");
2234 ret = CAMERA_ERROR_OUT_OF_MEMORY;
2238 pc->cb_info = _client_callback_new(sock_fd);
2239 if (pc->cb_info == NULL) {
2240 LOGE("cb_info alloc failed");
2241 ret = CAMERA_ERROR_OUT_OF_MEMORY;
2247 LOGD("cb info : %d", pc->cb_info->fd);
2249 ret = _client_wait_for_cb_return(api, pc->cb_info, CALLBACK_TIME_OUT);
2250 if (ret == CAMERA_ERROR_NONE) {
2251 intptr_t handle = 0;
2252 muse_camera_msg_get_pointer(handle, pc->cb_info->recv_msg);
2254 LOGE("Receiving Handle Failed!!");
2255 ret = CAMERA_ERROR_INVALID_OPERATION;
2259 pc->remote_handle = handle;
2260 pc->cb_info->bufmgr = bufmgr;
2262 ret = camera_set_display((camera_h)pc, CAMERA_DISPLAY_TYPE_NONE, NULL);
2263 if (ret != CAMERA_ERROR_NONE) {
2264 LOGE("init display failed 0x%x", ret);
2268 LOGD("camera create 0x%x", pc->remote_handle);
2269 *camera = (camera_h)pc;
2277 tbm_bufmgr_deinit(bufmgr);
2281 muse_core_connection_close(sock_fd);
2287 _client_callback_destroy(pc->cb_info);
2294 LOGE("camera create error : 0x%x", ret);
2300 int camera_change_device(camera_h camera, camera_device_e device)
2302 int ret = CAMERA_ERROR_NONE;
2303 muse_camera_api_e api = MUSE_CAMERA_API_CHANGE_DEVICE;
2304 camera_cli_s *pc = (camera_cli_s *)camera;
2306 if (camera == NULL || pc->cb_info == NULL) {
2307 LOGE("NULL handle, INVALID_PARAMETER");
2308 return CAMERA_ERROR_INVALID_PARAMETER;
2311 muse_camera_msg_send1(api, pc->cb_info->fd, pc->cb_info, ret, INT, device);
2317 int camera_destroy(camera_h camera)
2319 if (camera == NULL) {
2320 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2321 return CAMERA_ERROR_INVALID_PARAMETER;
2324 int ret = CAMERA_ERROR_NONE;
2325 muse_camera_api_e api = MUSE_CAMERA_API_DESTROY;
2326 camera_cli_s *pc = (camera_cli_s *)camera;
2331 if (pc->cb_info == NULL) {
2332 LOGE("cb_info NULL, INVALID_PARAMETER");
2333 return CAMERA_ERROR_INVALID_PARAMETER;
2336 sock_fd = pc->cb_info->fd;
2338 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2339 if (ret == CAMERA_ERROR_NONE) {
2340 _camera_remove_idle_event_all(pc->cb_info);
2341 _client_callback_destroy(pc->cb_info);
2347 LOGE("camera destroy error : 0x%x", ret);
2353 int camera_start_preview(camera_h camera)
2355 int ret = CAMERA_ERROR_NONE;
2356 muse_camera_api_e api = MUSE_CAMERA_API_START_PREVIEW;
2357 camera_cli_s *pc = (camera_cli_s *)camera;
2360 if (camera == NULL) {
2361 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2362 return CAMERA_ERROR_INVALID_PARAMETER;
2365 if (pc->cb_info == NULL) {
2366 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2367 return CAMERA_ERROR_INVALID_PARAMETER;
2372 sock_fd = pc->cb_info->fd;
2374 muse_camera_msg_send_longtime(api, sock_fd, pc->cb_info, ret);
2376 if (ret != CAMERA_ERROR_NONE) {
2377 LOGE("start preview failed 0x%x", ret);
2378 } else if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
2379 ret = _camera_start_evas_rendering(camera);
2382 LOGD("ret : 0x%x", ret);
2387 int camera_stop_preview(camera_h camera)
2389 int ret = CAMERA_ERROR_NONE;
2391 camera_cli_s *pc = NULL;
2392 muse_camera_api_e api = MUSE_CAMERA_API_STOP_PREVIEW;
2394 if (camera == NULL) {
2395 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2396 return CAMERA_ERROR_INVALID_PARAMETER;
2399 pc = (camera_cli_s *)camera;
2401 if (pc->cb_info == NULL) {
2402 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2403 return CAMERA_ERROR_INVALID_PARAMETER;
2406 sock_fd = pc->cb_info->fd;
2410 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
2411 camera_state_e current_state = CAMERA_STATE_NONE;
2413 ret = camera_get_state(camera, ¤t_state);
2414 if (ret != CAMERA_ERROR_NONE) {
2415 LOGE("failed to get current state 0x%x", ret);
2419 if (current_state == CAMERA_STATE_PREVIEW) {
2420 ret = _camera_stop_evas_rendering(camera, false);
2421 if (ret != CAMERA_ERROR_NONE)
2426 /* send stop preview message */
2427 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2429 LOGD("ret : 0x%x", ret);
2434 int camera_start_capture(camera_h camera, camera_capturing_cb capturing_cb, camera_capture_completed_cb completed_cb, void *user_data)
2436 if (camera == NULL) {
2437 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2438 return CAMERA_ERROR_INVALID_PARAMETER;
2440 int ret = CAMERA_ERROR_NONE;
2442 camera_cli_s *pc = (camera_cli_s *)camera;
2443 muse_camera_api_e api = MUSE_CAMERA_API_START_CAPTURE;
2445 int is_capturing_cb = 0;
2446 int is_completed_cb = 0;
2447 LOGD("Enter, handle :%x", pc->remote_handle);
2449 if (pc->cb_info == NULL) {
2450 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2451 return CAMERA_ERROR_INVALID_PARAMETER;
2454 sock_fd = pc->cb_info->fd;
2456 if (capturing_cb != NULL) {
2457 is_capturing_cb = 1;
2458 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = capturing_cb;
2459 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = user_data;
2462 if (completed_cb != NULL) {
2463 is_completed_cb = 1;
2464 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = completed_cb;
2465 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = user_data;
2468 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, is_capturing_cb, INT, is_completed_cb);
2469 LOGD("is_capturing_cb :%d, is_completed_cb : %d", is_capturing_cb, is_completed_cb);
2470 LOGD("ret : 0x%x", ret);
2474 bool camera_is_supported_continuous_capture(camera_h camera)
2476 if (camera == NULL) {
2477 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2481 int ret = CAMERA_ERROR_NONE;
2482 camera_cli_s *pc = (camera_cli_s *)camera;
2483 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_CONTINUOUS_CAPTURE;
2486 if (pc->cb_info == NULL) {
2487 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2488 return CAMERA_ERROR_INVALID_PARAMETER;
2491 sock_fd = pc->cb_info->fd;
2493 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2494 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2495 LOGD("ret : 0x%x", ret);
2499 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)
2501 if (camera == NULL) {
2502 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2503 return CAMERA_ERROR_INVALID_PARAMETER;
2506 int ret = CAMERA_ERROR_NONE;
2508 camera_cli_s *pc = (camera_cli_s *)camera;
2509 muse_camera_api_e api = MUSE_CAMERA_API_START_CONTINUOUS_CAPTURE;
2511 LOGD("Enter, handle :%x", pc->remote_handle);
2514 if (pc->cb_info == NULL) {
2515 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2516 return CAMERA_ERROR_INVALID_PARAMETER;
2518 sock_fd = pc->cb_info->fd;
2520 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = capturing_cb;
2521 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = user_data;
2522 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = completed_cb;
2524 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, count, INT, interval);
2526 LOGD("ret : 0x%x", ret);
2531 int camera_stop_continuous_capture(camera_h camera)
2533 if (camera == NULL) {
2534 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2535 return CAMERA_ERROR_INVALID_PARAMETER;
2539 int ret = CAMERA_ERROR_NONE;
2541 camera_cli_s *pc = (camera_cli_s *)camera;
2542 muse_camera_api_e api = MUSE_CAMERA_API_STOP_CONTINUOUS_CAPTURE;
2543 LOGD("Enter, handle :%x", pc->remote_handle);
2545 if (pc->cb_info == NULL) {
2546 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2547 return CAMERA_ERROR_INVALID_PARAMETER;
2549 sock_fd = pc->cb_info->fd;
2550 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2551 LOGD("ret : 0x%x", ret);
2555 bool camera_is_supported_face_detection(camera_h camera)
2557 if (camera == NULL) {
2558 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2561 int ret = CAMERA_ERROR_NONE;
2563 camera_cli_s *pc = (camera_cli_s *)camera;
2564 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_FACE_DETECTION;
2566 if (pc->cb_info == NULL) {
2567 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2568 return CAMERA_ERROR_INVALID_PARAMETER;
2570 sock_fd = pc->cb_info->fd;
2572 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2573 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2574 LOGD("ret : 0x%x", ret);
2578 bool camera_is_supported_zero_shutter_lag(camera_h camera)
2580 if (camera == NULL) {
2581 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2584 int ret = CAMERA_ERROR_NONE;
2586 camera_cli_s *pc = (camera_cli_s *)camera;
2587 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_ZERO_SHUTTER_LAG;
2589 if (pc->cb_info == NULL) {
2590 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2591 return CAMERA_ERROR_INVALID_PARAMETER;
2593 sock_fd = pc->cb_info->fd;
2595 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2596 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2597 LOGD("ret : 0x%x", ret);
2601 bool camera_is_supported_media_packet_preview_cb(camera_h camera)
2603 if (camera == NULL) {
2604 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2608 int ret = CAMERA_ERROR_NONE;
2610 camera_cli_s *pc = (camera_cli_s *)camera;
2611 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_MEDIA_PACKET_PREVIEW_CB;
2613 if (pc->cb_info == NULL) {
2614 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2615 return CAMERA_ERROR_INVALID_PARAMETER;
2617 sock_fd = pc->cb_info->fd;
2619 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2620 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2621 LOGD("ret : 0x%x", ret);
2625 int camera_get_device_count(camera_h camera, int *device_count)
2627 if (camera == NULL || device_count == NULL) {
2628 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2629 return CAMERA_ERROR_INVALID_PARAMETER;
2631 int ret = CAMERA_ERROR_NONE;
2633 camera_cli_s *pc = (camera_cli_s *)camera;
2634 muse_camera_api_e api = MUSE_CAMERA_API_GET_DEVICE_COUNT;
2636 if (pc->cb_info == NULL) {
2637 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2638 return CAMERA_ERROR_INVALID_PARAMETER;
2640 sock_fd = pc->cb_info->fd;
2641 int get_device_count;
2643 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2644 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2646 if (ret == CAMERA_ERROR_NONE) {
2647 muse_camera_msg_get(get_device_count, pc->cb_info->recv_msg);
2648 *device_count = get_device_count;
2650 LOGD("ret : 0x%x", ret);
2654 int camera_start_face_detection(camera_h camera, camera_face_detected_cb callback, void *user_data)
2656 if (camera == NULL) {
2657 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2658 return CAMERA_ERROR_INVALID_PARAMETER;
2661 int ret = CAMERA_ERROR_NONE;
2663 camera_cli_s *pc = (camera_cli_s *)camera;
2664 muse_camera_api_e api = MUSE_CAMERA_API_START_FACE_DETECTION;
2666 LOGD("Enter, handle :%x", pc->remote_handle);
2668 if (pc->cb_info == NULL) {
2669 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2670 return CAMERA_ERROR_INVALID_PARAMETER;
2672 sock_fd = pc->cb_info->fd;
2673 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION] = callback;
2674 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION] = user_data;
2676 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2677 LOGD("ret : 0x%x", ret);
2681 int camera_stop_face_detection(camera_h camera)
2683 if (camera == NULL) {
2684 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2685 return CAMERA_ERROR_INVALID_PARAMETER;
2688 int ret = CAMERA_ERROR_NONE;
2690 camera_cli_s *pc = (camera_cli_s *)camera;
2691 muse_camera_api_e api = MUSE_CAMERA_API_STOP_FACE_DETECTION;
2692 LOGD("Enter, handle :%x", pc->remote_handle);
2694 if (pc->cb_info == NULL) {
2695 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2696 return CAMERA_ERROR_INVALID_PARAMETER;
2698 sock_fd = pc->cb_info->fd;
2699 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2700 LOGD("ret : 0x%x", ret);
2704 int camera_get_state(camera_h camera, camera_state_e *state)
2706 if (camera == NULL || state == NULL) {
2707 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2708 return CAMERA_ERROR_INVALID_PARAMETER;
2710 int ret = CAMERA_ERROR_NONE;
2712 camera_cli_s *pc = (camera_cli_s *)camera;
2713 muse_camera_api_e api = MUSE_CAMERA_API_GET_STATE;
2715 if (pc->cb_info == NULL) {
2716 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2717 return CAMERA_ERROR_INVALID_PARAMETER;
2719 sock_fd = pc->cb_info->fd;
2722 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2723 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2725 if (ret == CAMERA_ERROR_NONE) {
2726 muse_camera_msg_get(get_state, pc->cb_info->recv_msg);
2727 *state = (camera_state_e)get_state;
2729 LOGD("ret : 0x%x", ret);
2733 int camera_start_focusing(camera_h camera, bool continuous)
2735 if (camera == NULL) {
2736 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2737 return CAMERA_ERROR_INVALID_PARAMETER;
2740 int ret = CAMERA_ERROR_NONE;
2742 camera_cli_s *pc = (camera_cli_s *)camera;
2743 muse_camera_api_e api = MUSE_CAMERA_API_START_FOCUSING;
2745 if (pc->cb_info == NULL) {
2746 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2747 return CAMERA_ERROR_INVALID_PARAMETER;
2749 sock_fd = pc->cb_info->fd;
2750 int is_continuous = (int)continuous;
2752 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2753 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, is_continuous);
2754 LOGD("ret : 0x%x", ret);
2758 int camera_cancel_focusing(camera_h camera)
2760 if (camera == NULL) {
2761 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2762 return CAMERA_ERROR_INVALID_PARAMETER;
2765 int ret = CAMERA_ERROR_NONE;
2767 camera_cli_s *pc = (camera_cli_s *)camera;
2768 muse_camera_api_e api = MUSE_CAMERA_API_CANCEL_FOCUSING;
2770 if (pc->cb_info == NULL) {
2771 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2772 return CAMERA_ERROR_INVALID_PARAMETER;
2774 sock_fd = pc->cb_info->fd;
2776 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2777 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2778 LOGD("ret : 0x%x", ret);
2782 int camera_set_display(camera_h camera, camera_display_type_e type, camera_display_h display)
2784 int ret = CAMERA_ERROR_NONE;
2785 void *set_display_handle = NULL;
2786 Evas_Object *obj = NULL;
2787 const char *object_type = NULL;
2788 camera_wl_info_s *wl_info = NULL;
2789 camera_cli_s *pc = (camera_cli_s *)camera;
2790 camera_cb_info_s *cb_info = NULL;
2791 muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY;
2792 camera_state_e current_state = CAMERA_STATE_NONE;
2795 if (camera == NULL) {
2796 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2797 return CAMERA_ERROR_INVALID_PARAMETER;
2800 if (type < CAMERA_DISPLAY_TYPE_OVERLAY || type > CAMERA_DISPLAY_TYPE_NONE) {
2801 LOGE("invalid type %d", type);
2802 return CAMERA_ERROR_INVALID_PARAMETER;
2805 if (type != CAMERA_DISPLAY_TYPE_NONE && display == NULL) {
2806 LOGE("display type[%d] is not NONE, but display handle is NULL", type);
2807 return CAMERA_ERROR_INVALID_PARAMETER;
2810 if (pc->cb_info == NULL) {
2811 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2812 return CAMERA_ERROR_INVALID_PARAMETER;
2815 cb_info = (camera_cb_info_s *)pc->cb_info;
2816 sock_fd = cb_info->fd;
2818 ret = camera_get_state(camera, ¤t_state);
2819 if (ret != CAMERA_ERROR_NONE) {
2820 LOGE("failed to get current state 0x%x", ret);
2824 if (current_state != CAMERA_STATE_CREATED) {
2825 LOGE("INVALID_STATE : current %d", current_state);
2826 return CAMERA_ERROR_INVALID_STATE;
2829 LOGD("Enter, remote_handle : %x display : 0x%x", pc->remote_handle, display);
2831 if (type == CAMERA_DISPLAY_TYPE_NONE) {
2832 set_display_handle = 0;
2833 LOGD("display type NONE");
2835 obj = (Evas_Object *)display;
2836 object_type = evas_object_type_get(obj);
2838 if (type == CAMERA_DISPLAY_TYPE_OVERLAY && !strcmp(object_type, "elm_win")) {
2839 /* get wayland parent id */
2840 if (_get_wl_info(obj, &pc->wl_info) != CAMERA_ERROR_NONE) {
2841 LOGE("failed to get wayland info");
2842 return CAMERA_ERROR_INVALID_OPERATION;
2845 set_display_handle = (void *)&pc->wl_info;
2846 LOGD("display type OVERLAY : handle %p", set_display_handle);
2847 } else if (type == CAMERA_DISPLAY_TYPE_EVAS && !strcmp(object_type, "image")) {
2848 /* evas object surface */
2849 set_display_handle = (void *)display;
2850 LOGD("display type EVAS : handle %p", set_display_handle);
2852 #ifdef TIZEN_FEATURE_EVAS_RENDERER
2853 g_mutex_lock(&cb_info->evas_mutex);
2855 if (cb_info->evas_info) {
2856 LOGW("destroy existed evas renderer %p", cb_info->evas_info);
2857 ret = mm_evas_renderer_destroy(&cb_info->evas_info);
2858 if (ret != MM_ERROR_NONE) {
2859 LOGE("failed to destroy evas renderer %p", cb_info->evas_info);
2860 g_mutex_unlock(&cb_info->evas_mutex);
2861 return CAMERA_ERROR_INVALID_OPERATION;
2865 /* create evas renderer */
2866 ret = mm_evas_renderer_create(&cb_info->evas_info, (Evas_Object *)set_display_handle);
2867 if (ret == MM_ERROR_NONE) {
2868 camera_flip_e flip = CAMERA_FLIP_NONE;
2869 camera_display_mode_e mode = CAMERA_DISPLAY_MODE_LETTER_BOX;
2870 camera_rotation_e rotation = CAMERA_ROTATION_NONE;
2877 camera_get_display_flip(camera, &flip);
2878 camera_get_display_mode(camera, &mode);
2879 camera_get_display_rotation(camera, &rotation);
2880 camera_is_display_visible(camera, &visible);
2881 camera_attr_get_display_roi_area(camera, &x, &y, &width, &height);
2883 LOGD("current setting : flip %d, mode %d, rotation %d, visible %d, roi %d,%d,%dx%d",
2884 flip, mode, rotation, visible, x, y, width, height);
2886 ret = mm_evas_renderer_set_flip(cb_info->evas_info, flip);
2887 ret |= mm_evas_renderer_set_geometry(cb_info->evas_info, mode);
2888 ret |= mm_evas_renderer_set_rotation(cb_info->evas_info, rotation);
2889 ret |= mm_evas_renderer_set_visible(cb_info->evas_info, visible);
2891 if (mode == CAMERA_DISPLAY_MODE_CUSTOM_ROI)
2892 ret |= mm_evas_renderer_set_roi_area(cb_info->evas_info, x, y, width, height);
2895 g_mutex_unlock(&cb_info->evas_mutex);
2897 if (ret != MM_ERROR_NONE) {
2898 LOGE("mm_evas_renderer error 0x%x", ret);
2899 return CAMERA_ERROR_INVALID_OPERATION;
2901 #else /* TIZEN_FEATURE_EVAS_RENDERER */
2902 LOGE("EVAS surface is not supported");
2903 return CAMERA_ERROR_NOT_SUPPORTED;
2904 #endif /* TIZEN_FEATURE_EVAS_RENDERER */
2906 LOGE("unknown evas object [%p,%s] or type [%d] mismatch", obj, object_type, type);
2907 return CAMERA_ERROR_INVALID_PARAMETER;
2910 LOGE("failed to get evas object type from %p", obj);
2911 return CAMERA_ERROR_INVALID_PARAMETER;
2915 pc->display_handle = (intptr_t)set_display_handle;
2917 if (type == CAMERA_DISPLAY_TYPE_OVERLAY) {
2918 wl_info = &pc->wl_info;
2919 muse_camera_msg_send_array_and_value(api, sock_fd, cb_info, ret,
2920 wl_info, sizeof(camera_wl_info_s), sizeof(int), INT, type);
2922 LOGD("wayland parent id : %d, window %d,%d,%dx%d",
2923 wl_info->parent_id, wl_info->window_x, wl_info->window_y,
2924 wl_info->window_width, wl_info->window_height);
2926 muse_camera_msg_send1(api, sock_fd, cb_info, ret, INT, type);
2928 if (ret != CAMERA_ERROR_NONE)
2929 LOGE("set display error 0x%x", ret);
2930 else if (type == CAMERA_DISPLAY_TYPE_EVAS)
2931 SET_PREVIEW_CB_TYPE(cb_info, PREVIEW_CB_TYPE_EVAS);
2936 int camera_set_preview_resolution(camera_h camera, int width, int height)
2938 if (camera == NULL) {
2939 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2940 return CAMERA_ERROR_INVALID_PARAMETER;
2942 int ret = CAMERA_ERROR_NONE;
2944 camera_cli_s *pc = (camera_cli_s *)camera;
2945 muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_RESOLUTION;
2947 if (pc->cb_info == NULL) {
2948 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2949 return CAMERA_ERROR_INVALID_PARAMETER;
2951 sock_fd = pc->cb_info->fd;
2953 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2954 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, width, INT, height);
2955 LOGD("ret : 0x%x", ret);
2960 int camera_set_capture_resolution(camera_h camera, int width, int height)
2962 if (camera == NULL) {
2963 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2964 return CAMERA_ERROR_INVALID_PARAMETER;
2967 int ret = CAMERA_ERROR_NONE;
2969 camera_cli_s *pc = (camera_cli_s *)camera;
2970 muse_camera_api_e api = MUSE_CAMERA_API_SET_CAPTURE_RESOLUTION;
2972 if (pc->cb_info == NULL) {
2973 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2974 return CAMERA_ERROR_INVALID_PARAMETER;
2976 sock_fd = pc->cb_info->fd;
2978 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2979 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, width, INT, height);
2980 LOGD("ret : 0x%x", ret);
2984 int camera_set_capture_format(camera_h camera, camera_pixel_format_e format)
2986 if (camera == NULL) {
2987 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2988 return CAMERA_ERROR_INVALID_PARAMETER;
2991 int ret = CAMERA_ERROR_NONE;
2992 int set_format = (int)format;
2994 camera_cli_s *pc = (camera_cli_s *)camera;
2995 muse_camera_api_e api = MUSE_CAMERA_API_SET_CAPTURE_FORMAT;
2997 if (pc->cb_info == NULL) {
2998 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2999 return CAMERA_ERROR_INVALID_PARAMETER;
3001 sock_fd = pc->cb_info->fd;
3003 LOGD("Enter, remote_handle : %x, capture_format: %d", pc->remote_handle, set_format);
3004 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_format);
3005 LOGD("ret : 0x%x", ret);
3009 int camera_set_preview_format(camera_h camera, camera_pixel_format_e format)
3011 if (camera == NULL) {
3012 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3013 return CAMERA_ERROR_INVALID_PARAMETER;
3016 int ret = CAMERA_ERROR_NONE;
3017 int set_format = (int)format;
3019 camera_cli_s *pc = (camera_cli_s *)camera;
3020 muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_FORMAT;
3022 if (pc->cb_info == NULL) {
3023 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3024 return CAMERA_ERROR_INVALID_PARAMETER;
3026 sock_fd = pc->cb_info->fd;
3028 LOGD("Enter, remote_handle : %x, capture_format: %d", pc->remote_handle, set_format);
3029 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_format);
3030 LOGD("ret : 0x%x", ret);
3034 int camera_get_preview_resolution(camera_h camera, int *width, int *height)
3036 if (camera == NULL || width == NULL || height == NULL) {
3037 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3038 return CAMERA_ERROR_INVALID_PARAMETER;
3042 int ret = CAMERA_ERROR_NONE;
3044 camera_cli_s *pc = (camera_cli_s *)camera;
3045 muse_camera_api_e api = MUSE_CAMERA_API_GET_PREVIEW_RESOLUTION;
3047 if (pc->cb_info == NULL) {
3048 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3049 return CAMERA_ERROR_INVALID_PARAMETER;
3051 sock_fd = pc->cb_info->fd;
3055 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3056 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3058 if (ret == CAMERA_ERROR_NONE) {
3059 muse_camera_msg_get(get_width, pc->cb_info->recv_msg);
3060 muse_camera_msg_get(get_height, pc->cb_info->recv_msg);
3062 *height = get_height;
3064 LOGD("ret : 0x%x", ret);
3068 int camera_set_display_rotation(camera_h camera, camera_rotation_e rotation)
3070 int ret = CAMERA_ERROR_NONE;
3071 int set_rotation = (int)rotation;
3072 camera_cli_s *pc = NULL;
3074 if (camera == NULL) {
3075 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3076 return CAMERA_ERROR_INVALID_PARAMETER;
3079 if (rotation < CAMERA_ROTATION_NONE || rotation > CAMERA_ROTATION_270) {
3080 LOGE("Invalid rotation %d", rotation);
3081 return CAMERA_ERROR_INVALID_PARAMETER;
3084 pc = (camera_cli_s *)camera;
3086 if (pc->cb_info == NULL) {
3087 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3088 return CAMERA_ERROR_INVALID_PARAMETER;
3091 #ifdef TIZEN_FEATURE_EVAS_RENDERER
3092 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
3093 g_mutex_lock(&pc->cb_info->evas_mutex);
3095 ret = mm_evas_renderer_set_rotation(pc->cb_info->evas_info, rotation);
3097 g_mutex_unlock(&pc->cb_info->evas_mutex);
3099 if (ret != MM_ERROR_NONE) {
3100 LOGE("failed to set rotation for evas surface 0x%x", ret);
3101 return CAMERA_ERROR_INVALID_OPERATION;
3104 #endif /* TIZEN_FEATURE_EVAS_RENDERER */
3106 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_ROTATION,
3107 pc->cb_info->fd, pc->cb_info, ret, INT, set_rotation);
3112 int camera_get_display_rotation(camera_h camera, camera_rotation_e *rotation)
3114 int ret = CAMERA_ERROR_NONE;
3115 int get_rotation = CAMERA_ROTATION_NONE;
3116 camera_cli_s *pc = NULL;
3118 if (camera == NULL || rotation == NULL) {
3119 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3120 return CAMERA_ERROR_INVALID_PARAMETER;
3123 pc = (camera_cli_s *)camera;
3125 if (pc->cb_info == NULL) {
3126 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3127 return CAMERA_ERROR_INVALID_PARAMETER;
3130 muse_camera_msg_send(MUSE_CAMERA_API_GET_DISPLAY_ROTATION,
3131 pc->cb_info->fd, pc->cb_info, ret);
3133 if (ret == CAMERA_ERROR_NONE) {
3134 muse_camera_msg_get(get_rotation, pc->cb_info->recv_msg);
3135 *rotation = (camera_rotation_e)get_rotation;
3141 int camera_set_display_flip(camera_h camera, camera_flip_e flip)
3143 int ret = CAMERA_ERROR_NONE;
3144 int set_flip = (int)flip;
3145 camera_cli_s *pc = NULL;
3147 if (camera == NULL) {
3148 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3149 return CAMERA_ERROR_INVALID_PARAMETER;
3152 if (flip < CAMERA_FLIP_NONE || flip > CAMERA_FLIP_BOTH) {
3153 LOGE("Invalid flip %d", flip);
3154 return CAMERA_ERROR_INVALID_PARAMETER;
3157 pc = (camera_cli_s *)camera;
3159 if (pc->cb_info == NULL) {
3160 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3161 return CAMERA_ERROR_INVALID_PARAMETER;
3164 #ifdef TIZEN_FEATURE_EVAS_RENDERER
3165 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
3166 g_mutex_lock(&pc->cb_info->evas_mutex);
3168 ret = mm_evas_renderer_set_flip(pc->cb_info->evas_info, flip);
3170 g_mutex_unlock(&pc->cb_info->evas_mutex);
3172 if (ret != MM_ERROR_NONE) {
3173 LOGE("failed to set flip for evas surface 0x%x", ret);
3174 return CAMERA_ERROR_INVALID_OPERATION;
3177 #endif /* TIZEN_FEATURE_EVAS_RENDERER */
3179 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_FLIP,
3180 pc->cb_info->fd, pc->cb_info, ret, INT, set_flip);
3185 int camera_get_display_flip(camera_h camera, camera_flip_e *flip)
3187 int ret = CAMERA_ERROR_NONE;
3188 int get_flip = CAMERA_FLIP_NONE;
3189 camera_cli_s *pc = NULL;
3191 if (camera == NULL || flip == NULL) {
3192 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3193 return CAMERA_ERROR_INVALID_PARAMETER;
3196 pc = (camera_cli_s *)camera;
3198 if (pc->cb_info == NULL) {
3199 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3200 return CAMERA_ERROR_INVALID_PARAMETER;
3203 muse_camera_msg_send(MUSE_CAMERA_API_GET_DISPLAY_FLIP,
3204 pc->cb_info->fd, pc->cb_info, ret);
3206 if (ret == CAMERA_ERROR_NONE) {
3207 muse_camera_msg_get(get_flip, pc->cb_info->recv_msg);
3208 *flip = (camera_flip_e)get_flip;
3214 int camera_set_display_visible(camera_h camera, bool visible)
3216 int ret = CAMERA_ERROR_NONE;
3217 int set_visible = (int)visible;
3218 camera_cli_s *pc = NULL;
3220 if (camera == NULL) {
3221 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3222 return CAMERA_ERROR_INVALID_PARAMETER;
3225 pc = (camera_cli_s *)camera;
3227 if (pc->cb_info == NULL) {
3228 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3229 return CAMERA_ERROR_INVALID_PARAMETER;
3232 #ifdef TIZEN_FEATURE_EVAS_RENDERER
3233 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
3234 g_mutex_lock(&pc->cb_info->evas_mutex);
3236 ret = mm_evas_renderer_set_visible(pc->cb_info->evas_info, visible);
3238 g_mutex_unlock(&pc->cb_info->evas_mutex);
3240 if (ret != MM_ERROR_NONE) {
3241 LOGE("failed to set visible for evas surface 0x%x", ret);
3242 return CAMERA_ERROR_INVALID_OPERATION;
3245 #endif /* TIZEN_FEATURE_EVAS_RENDERER */
3247 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_VISIBLE,
3248 pc->cb_info->fd, pc->cb_info, ret, INT, set_visible);
3253 int camera_is_display_visible(camera_h camera, bool *visible)
3255 int ret = CAMERA_ERROR_NONE;
3256 int get_visible = true;
3257 camera_cli_s *pc = NULL;
3259 if (camera == NULL || visible == NULL) {
3260 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3261 return CAMERA_ERROR_INVALID_PARAMETER;
3264 pc = (camera_cli_s *)camera;
3266 if (pc->cb_info == NULL) {
3267 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3268 return CAMERA_ERROR_INVALID_PARAMETER;
3271 muse_camera_msg_send(MUSE_CAMERA_API_IS_DISPLAY_VISIBLE,
3272 pc->cb_info->fd, pc->cb_info, ret);
3274 if (ret == CAMERA_ERROR_NONE) {
3275 muse_camera_msg_get(get_visible, pc->cb_info->recv_msg);
3276 *visible = (bool)get_visible;
3282 int camera_set_display_mode(camera_h camera, camera_display_mode_e mode)
3284 int ret = CAMERA_ERROR_NONE;
3285 int set_mode = (int)mode;
3286 camera_cli_s *pc = NULL;
3288 if (camera == NULL) {
3289 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3290 return CAMERA_ERROR_INVALID_PARAMETER;
3293 if (mode < CAMERA_DISPLAY_MODE_LETTER_BOX || mode > CAMERA_DISPLAY_MODE_CUSTOM_ROI) {
3294 LOGE("Invalid mode %d", mode);
3295 return CAMERA_ERROR_INVALID_PARAMETER;
3298 pc = (camera_cli_s *)camera;
3300 if (pc->cb_info == NULL) {
3301 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3302 return CAMERA_ERROR_INVALID_PARAMETER;
3305 #ifdef TIZEN_FEATURE_EVAS_RENDERER
3306 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
3307 g_mutex_lock(&pc->cb_info->evas_mutex);
3309 ret = mm_evas_renderer_set_geometry(pc->cb_info->evas_info, mode);
3311 g_mutex_unlock(&pc->cb_info->evas_mutex);
3313 if (ret != MM_ERROR_NONE) {
3314 LOGE("failed to set geometry for evas surface 0x%x", ret);
3315 return CAMERA_ERROR_INVALID_OPERATION;
3318 #endif /* TIZEN_FEATURE_EVAS_RENDERER */
3320 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_MODE,
3321 pc->cb_info->fd, pc->cb_info, ret, INT, set_mode);
3326 int camera_get_display_mode(camera_h camera, camera_display_mode_e *mode)
3328 int ret = CAMERA_ERROR_NONE;
3329 int get_mode = CAMERA_DISPLAY_MODE_LETTER_BOX;
3330 camera_cli_s *pc = NULL;
3332 if (camera == NULL || mode == NULL) {
3333 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3334 return CAMERA_ERROR_INVALID_PARAMETER;
3337 pc = (camera_cli_s *)camera;
3339 if (pc->cb_info == NULL) {
3340 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3341 return CAMERA_ERROR_INVALID_PARAMETER;
3344 muse_camera_msg_send(MUSE_CAMERA_API_GET_DISPLAY_MODE,
3345 pc->cb_info->fd, pc->cb_info, ret);
3347 if (ret == CAMERA_ERROR_NONE) {
3348 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
3349 *mode = (camera_display_mode_e)get_mode;
3356 int camera_set_display_reuse_hint(camera_h camera, bool hint)
3358 int ret = CAMERA_ERROR_NONE;
3359 int set_hint = (int)hint;
3360 camera_cli_s *pc = (camera_cli_s *)camera;
3362 if (camera == NULL) {
3363 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3364 return CAMERA_ERROR_INVALID_PARAMETER;
3367 if (pc->cb_info == NULL) {
3368 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3369 return CAMERA_ERROR_INVALID_PARAMETER;
3372 LOGD("set display reuse hint %d", set_hint);
3374 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_REUSE_HINT,
3375 pc->cb_info->fd, pc->cb_info, ret, INT, set_hint);
3381 int camera_get_display_reuse_hint(camera_h camera, bool *hint)
3383 int ret = CAMERA_ERROR_NONE;
3385 camera_cli_s *pc = (camera_cli_s *)camera;
3386 muse_camera_api_e api = MUSE_CAMERA_API_GET_DISPLAY_REUSE_HINT;
3388 if (camera == NULL || hint == NULL) {
3389 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3390 return CAMERA_ERROR_INVALID_PARAMETER;
3393 if (pc->cb_info == NULL) {
3394 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3395 return CAMERA_ERROR_INVALID_PARAMETER;
3398 muse_camera_msg_send(api, pc->cb_info->fd, pc->cb_info, ret);
3400 if (ret == CAMERA_ERROR_NONE) {
3401 muse_camera_msg_get(get_hint, pc->cb_info->recv_msg);
3402 *hint = (bool)get_hint;
3404 LOGD("display reuse hint %d", *hint);
3406 LOGE("failed 0x%x", ret);
3413 int camera_get_capture_resolution(camera_h camera, int *width, int *height)
3415 if (camera == NULL || width == NULL || height == NULL) {
3416 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3417 return CAMERA_ERROR_INVALID_PARAMETER;
3419 int ret = CAMERA_ERROR_NONE;
3421 camera_cli_s *pc = (camera_cli_s *)camera;
3422 muse_camera_api_e api = MUSE_CAMERA_API_GET_CAPTURE_RESOLUTION;
3424 if (pc->cb_info == NULL) {
3425 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3426 return CAMERA_ERROR_INVALID_PARAMETER;
3428 sock_fd = pc->cb_info->fd;
3432 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3433 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3435 if (ret == CAMERA_ERROR_NONE) {
3436 muse_camera_msg_get(get_width, pc->cb_info->recv_msg);
3437 muse_camera_msg_get(get_height, pc->cb_info->recv_msg);
3439 *height = get_height;
3441 LOGD("ret : 0x%x", ret);
3445 int camera_get_capture_format(camera_h camera, camera_pixel_format_e *format)
3447 if (camera == NULL || format == NULL) {
3448 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3449 return CAMERA_ERROR_INVALID_PARAMETER;
3451 int ret = CAMERA_ERROR_NONE;
3453 camera_cli_s *pc = (camera_cli_s *)camera;
3454 muse_camera_api_e api = MUSE_CAMERA_API_GET_CAPTURE_FORMAT;
3457 if (pc->cb_info == NULL) {
3458 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3459 return CAMERA_ERROR_INVALID_PARAMETER;
3461 sock_fd = pc->cb_info->fd;
3463 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3464 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3466 if (ret == CAMERA_ERROR_NONE) {
3467 muse_camera_msg_get(get_format, pc->cb_info->recv_msg);
3468 *format = (camera_pixel_format_e)get_format;
3470 LOGD("ret : 0x%x", ret);
3474 int camera_get_preview_format(camera_h camera, camera_pixel_format_e *format)
3476 if (camera == NULL || format == NULL) {
3477 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3478 return CAMERA_ERROR_INVALID_PARAMETER;
3481 int ret = CAMERA_ERROR_NONE;
3483 camera_cli_s *pc = (camera_cli_s *)camera;
3484 muse_camera_api_e api = MUSE_CAMERA_API_GET_PREVIEW_FORMAT;
3487 if (pc->cb_info == NULL) {
3488 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3489 return CAMERA_ERROR_INVALID_PARAMETER;
3491 sock_fd = pc->cb_info->fd;
3493 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3494 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3496 if (ret == CAMERA_ERROR_NONE) {
3497 muse_camera_msg_get(get_format, pc->cb_info->recv_msg);
3498 *format = (camera_pixel_format_e)get_format;
3500 LOGD("ret : 0x%x", ret);
3504 int camera_get_facing_direction(camera_h camera, camera_facing_direction_e *facing_direciton)
3506 if (camera == NULL || facing_direciton == NULL) {
3507 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3508 return CAMERA_ERROR_INVALID_PARAMETER;
3511 int ret = CAMERA_ERROR_NONE;
3513 camera_cli_s *pc = (camera_cli_s *)camera;
3514 muse_camera_api_e api = MUSE_CAMERA_API_GET_FACING_DIRECTION;
3516 if (pc->cb_info == NULL) {
3517 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3518 return CAMERA_ERROR_INVALID_PARAMETER;
3520 sock_fd = pc->cb_info->fd;
3521 int get_facing_direction;
3523 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3524 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3526 if (ret == CAMERA_ERROR_NONE) {
3527 muse_camera_msg_get(get_facing_direction, pc->cb_info->recv_msg);
3528 *facing_direciton = (camera_facing_direction_e)get_facing_direction;
3530 LOGD("ret : 0x%x", ret);
3534 int camera_set_preview_cb(camera_h camera, camera_preview_cb callback, void *user_data)
3536 if (camera == NULL || callback == NULL) {
3537 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3538 return CAMERA_ERROR_INVALID_PARAMETER;
3540 int ret = CAMERA_ERROR_NONE;
3542 camera_cli_s *pc = (camera_cli_s *)camera;
3543 camera_cb_info_s *cb_info = (camera_cb_info_s *)pc->cb_info;
3545 if (pc->cb_info == NULL) {
3546 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3547 return CAMERA_ERROR_INVALID_PARAMETER;
3549 sock_fd = pc->cb_info->fd;
3550 muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_CB;
3552 LOGD("Enter, handle :%x", pc->remote_handle);
3554 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = callback;
3555 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = user_data;
3556 SET_PREVIEW_CB_TYPE(cb_info, PREVIEW_CB_TYPE_USER);
3558 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3559 LOGD("ret : 0x%x", ret);
3563 int camera_unset_preview_cb(camera_h camera)
3565 if (camera == NULL) {
3566 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3567 return CAMERA_ERROR_INVALID_PARAMETER;
3570 int ret = CAMERA_ERROR_NONE;
3572 camera_cli_s *pc = (camera_cli_s *)camera;
3573 camera_cb_info_s *cb_info = (camera_cb_info_s *)pc->cb_info;
3574 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_PREVIEW_CB;
3576 LOGD("Enter, handle :%x", pc->remote_handle);
3579 if (pc->cb_info == NULL) {
3580 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3581 return CAMERA_ERROR_INVALID_PARAMETER;
3583 sock_fd = pc->cb_info->fd;
3584 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = (void *)NULL;
3585 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = (void *)NULL;
3586 UNSET_PREVIEW_CB_TYPE(cb_info, PREVIEW_CB_TYPE_USER);
3588 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3589 LOGD("ret : 0x%x", ret);
3593 int camera_set_media_packet_preview_cb(camera_h camera, camera_media_packet_preview_cb callback, void *user_data)
3595 if (camera == NULL) {
3596 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
3597 return CAMERA_ERROR_INVALID_PARAMETER;
3600 if (camera_is_supported_media_packet_preview_cb(camera) == false) {
3601 LOGE("NOT SUPPORTED");
3602 return CAMERA_ERROR_NOT_SUPPORTED;
3605 if (callback == NULL) {
3606 LOGE("INVALID_PARAMETER(0x%08x) - callback", CAMERA_ERROR_INVALID_PARAMETER);
3607 return CAMERA_ERROR_INVALID_PARAMETER;
3610 int ret = CAMERA_ERROR_NONE;
3612 camera_cli_s *pc = (camera_cli_s *)camera;
3613 muse_camera_api_e api = MUSE_CAMERA_API_SET_MEDIA_PACKET_PREVIEW_CB;
3615 LOGD("Enter, handle :%x", pc->remote_handle);
3618 if (pc->cb_info == NULL) {
3619 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3620 return CAMERA_ERROR_INVALID_PARAMETER;
3622 sock_fd = pc->cb_info->fd;
3623 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = callback;
3624 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = user_data;
3626 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3627 LOGD("ret : 0x%x", ret);
3631 int camera_unset_media_packet_preview_cb(camera_h camera)
3633 if (camera == NULL) {
3634 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3635 return CAMERA_ERROR_INVALID_PARAMETER;
3638 int ret = CAMERA_ERROR_NONE;
3640 camera_cli_s *pc = (camera_cli_s *)camera;
3641 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_MEDIA_PACKET_PREVIEW_CB;
3643 LOGD("Enter, handle :%x", pc->remote_handle);
3646 if (pc->cb_info == NULL) {
3647 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3648 return CAMERA_ERROR_INVALID_PARAMETER;
3650 sock_fd = pc->cb_info->fd;
3651 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = (void *)NULL;
3652 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = (void *)NULL;
3654 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3655 LOGD("ret : 0x%x", ret);
3659 int camera_set_state_changed_cb(camera_h camera, camera_state_changed_cb callback, void *user_data)
3661 if (camera == NULL || callback == NULL) {
3662 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3663 return CAMERA_ERROR_INVALID_PARAMETER;
3665 int ret = CAMERA_ERROR_NONE;
3667 camera_cli_s *pc = (camera_cli_s *)camera;
3668 muse_camera_api_e api = MUSE_CAMERA_API_SET_STATE_CHANGED_CB;
3670 LOGD("Enter, handle :%x", pc->remote_handle);
3673 if (pc->cb_info == NULL) {
3674 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3675 return CAMERA_ERROR_INVALID_PARAMETER;
3677 sock_fd = pc->cb_info->fd;
3678 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = callback;
3679 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = user_data;
3681 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3682 LOGD("ret : 0x%x", ret);
3685 int camera_unset_state_changed_cb(camera_h camera)
3687 if (camera == NULL) {
3688 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3689 return CAMERA_ERROR_INVALID_PARAMETER;
3691 int ret = CAMERA_ERROR_NONE;
3693 camera_cli_s *pc = (camera_cli_s *)camera;
3694 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_STATE_CHANGED_CB;
3696 LOGD("Enter, handle :%x", pc->remote_handle);
3699 if (pc->cb_info == NULL) {
3700 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3701 return CAMERA_ERROR_INVALID_PARAMETER;
3703 sock_fd = pc->cb_info->fd;
3704 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = (void *)NULL;
3705 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = (void *)NULL;
3707 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3708 LOGD("ret : 0x%x", ret);
3712 int camera_set_interrupted_cb(camera_h camera, camera_interrupted_cb callback, void *user_data)
3714 if (camera == NULL || callback == NULL) {
3715 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3716 return CAMERA_ERROR_INVALID_PARAMETER;
3718 int ret = CAMERA_ERROR_NONE;
3720 camera_cli_s *pc = (camera_cli_s *)camera;
3721 muse_camera_api_e api = MUSE_CAMERA_API_SET_INTERRUPTED_CB;
3723 LOGD("Enter, handle :%x", pc->remote_handle);
3726 if (pc->cb_info == NULL) {
3727 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3728 return CAMERA_ERROR_INVALID_PARAMETER;
3730 sock_fd = pc->cb_info->fd;
3731 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = callback;
3732 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = user_data;
3734 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3735 LOGD("ret : 0x%x", ret);
3739 int camera_unset_interrupted_cb(camera_h camera)
3741 if (camera == NULL) {
3742 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3743 return CAMERA_ERROR_INVALID_PARAMETER;
3745 int ret = CAMERA_ERROR_NONE;
3747 camera_cli_s *pc = (camera_cli_s *)camera;
3748 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_INTERRUPTED_CB;
3750 LOGD("Enter, handle :%x", pc->remote_handle);
3753 if (pc->cb_info == NULL) {
3754 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3755 return CAMERA_ERROR_INVALID_PARAMETER;
3757 sock_fd = pc->cb_info->fd;
3758 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = (void *)NULL;
3759 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = (void *)NULL;
3761 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3762 LOGD("ret : 0x%x", ret);
3766 int camera_set_focus_changed_cb(camera_h camera, camera_focus_changed_cb callback, void *user_data)
3768 if (camera == NULL || callback == NULL) {
3769 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3770 return CAMERA_ERROR_INVALID_PARAMETER;
3772 int ret = CAMERA_ERROR_NONE;
3774 camera_cli_s *pc = (camera_cli_s *)camera;
3775 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOCUS_CHANGED_CB;
3777 LOGD("Enter, handle :%x", pc->remote_handle);
3780 if (pc->cb_info == NULL) {
3781 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3782 return CAMERA_ERROR_INVALID_PARAMETER;
3784 sock_fd = pc->cb_info->fd;
3785 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = callback;
3786 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = user_data;
3788 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3789 LOGD("ret : 0x%x", ret);
3793 int camera_unset_focus_changed_cb(camera_h camera)
3795 if (camera == NULL) {
3796 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3797 return CAMERA_ERROR_INVALID_PARAMETER;
3799 int ret = CAMERA_ERROR_NONE;
3801 camera_cli_s *pc = (camera_cli_s *)camera;
3802 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_FOCUS_CHANGED_CB;
3804 LOGD("Enter, handle :%x", pc->remote_handle);
3807 if (pc->cb_info == NULL) {
3808 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3809 return CAMERA_ERROR_INVALID_PARAMETER;
3811 sock_fd = pc->cb_info->fd;
3812 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = (void *)NULL;
3813 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = (void *)NULL;
3815 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3816 LOGD("ret : 0x%x", ret);
3820 int camera_set_error_cb(camera_h camera, camera_error_cb callback, void *user_data)
3822 if (camera == NULL || callback == NULL) {
3823 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3824 return CAMERA_ERROR_INVALID_PARAMETER;
3826 int ret = CAMERA_ERROR_NONE;
3828 camera_cli_s *pc = (camera_cli_s *)camera;
3829 muse_camera_api_e api = MUSE_CAMERA_API_SET_ERROR_CB;
3831 LOGD("Enter, handle :%x", pc->remote_handle);
3834 if (pc->cb_info == NULL) {
3835 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3836 return CAMERA_ERROR_INVALID_PARAMETER;
3838 sock_fd = pc->cb_info->fd;
3839 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_ERROR] = callback;
3840 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_ERROR] = user_data;
3842 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3843 LOGD("ret : 0x%x", ret);
3847 int camera_unset_error_cb(camera_h camera)
3849 if (camera == NULL) {
3850 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3851 return CAMERA_ERROR_INVALID_PARAMETER;
3853 int ret = CAMERA_ERROR_NONE;
3855 camera_cli_s *pc = (camera_cli_s *)camera;
3856 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_ERROR_CB;
3858 LOGD("Enter, handle :%x", pc->remote_handle);
3861 if (pc->cb_info == NULL) {
3862 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3863 return CAMERA_ERROR_INVALID_PARAMETER;
3865 sock_fd = pc->cb_info->fd;
3866 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_ERROR] = (void *)NULL;
3867 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_ERROR] = (void *)NULL;
3869 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3870 LOGD("ret : 0x%x", ret);
3874 int camera_foreach_supported_preview_resolution(camera_h camera, camera_supported_preview_resolution_cb foreach_cb , void *user_data)
3876 if (camera == NULL || foreach_cb == NULL) {
3877 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3878 return CAMERA_ERROR_INVALID_PARAMETER;
3880 int ret = CAMERA_ERROR_NONE;
3882 camera_cli_s *pc = (camera_cli_s *)camera;
3883 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_PREVIEW_RESOLUTION;
3885 LOGD("Enter, handle :%x", pc->remote_handle);
3888 if (pc->cb_info == NULL) {
3889 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3890 return CAMERA_ERROR_INVALID_PARAMETER;
3892 sock_fd = pc->cb_info->fd;
3893 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_RESOLUTION] = foreach_cb;
3894 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_RESOLUTION] = user_data;
3896 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3897 LOGD("ret : 0x%x", ret);
3901 int camera_foreach_supported_capture_resolution(camera_h camera, camera_supported_capture_resolution_cb foreach_cb , void *user_data)
3903 if (camera == NULL || foreach_cb == NULL) {
3904 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3905 return CAMERA_ERROR_INVALID_PARAMETER;
3907 int ret = CAMERA_ERROR_NONE;
3909 camera_cli_s *pc = (camera_cli_s *)camera;
3910 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_CAPTURE_RESOLUTION;
3912 LOGD("Enter, handle :%x", pc->remote_handle);
3915 if (pc->cb_info == NULL) {
3916 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3917 return CAMERA_ERROR_INVALID_PARAMETER;
3919 sock_fd = pc->cb_info->fd;
3920 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_RESOLUTION] = foreach_cb;
3921 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_RESOLUTION] = user_data;
3923 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3924 LOGD("ret : 0x%x", ret);
3928 int camera_foreach_supported_capture_format(camera_h camera, camera_supported_capture_format_cb foreach_cb , void *user_data)
3930 if (camera == NULL || foreach_cb == NULL) {
3931 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3932 return CAMERA_ERROR_INVALID_PARAMETER;
3934 int ret = CAMERA_ERROR_NONE;
3936 camera_cli_s *pc = (camera_cli_s *)camera;
3937 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_CAPTURE_FORMAT;
3939 LOGD("Enter, handle :%x", pc->remote_handle);
3942 if (pc->cb_info == NULL) {
3943 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3944 return CAMERA_ERROR_INVALID_PARAMETER;
3946 sock_fd = pc->cb_info->fd;
3947 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_FORMAT] = foreach_cb;
3948 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_FORMAT] = user_data;
3950 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3951 LOGD("ret : 0x%x", ret);
3956 int camera_foreach_supported_preview_format(camera_h camera, camera_supported_preview_format_cb foreach_cb , void *user_data)
3958 if (camera == NULL || foreach_cb == NULL) {
3959 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3960 return CAMERA_ERROR_INVALID_PARAMETER;
3962 int ret = CAMERA_ERROR_NONE;
3964 camera_cli_s *pc = (camera_cli_s *)camera;
3965 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_PREVIEW_FORMAT;
3967 LOGD("Enter, handle :%x", pc->remote_handle);
3970 if (pc->cb_info == NULL) {
3971 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3972 return CAMERA_ERROR_INVALID_PARAMETER;
3974 sock_fd = pc->cb_info->fd;
3975 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_FORMAT] = foreach_cb;
3976 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_FORMAT] = user_data;
3978 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3979 LOGD("ret : 0x%x", ret);
3984 int camera_get_recommended_preview_resolution(camera_h camera, int *width, int *height)
3986 if (camera == NULL || width == NULL || height == NULL) {
3987 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3988 return CAMERA_ERROR_INVALID_PARAMETER;
3990 int ret = CAMERA_ERROR_NONE;
3992 camera_cli_s *pc = (camera_cli_s *)camera;
3993 muse_camera_api_e api = MUSE_CAMERA_API_GET_RECOMMENDED_PREVIEW_RESOLUTION;
3995 if (pc->cb_info == NULL) {
3996 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3997 return CAMERA_ERROR_INVALID_PARAMETER;
3999 sock_fd = pc->cb_info->fd;
4003 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4004 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4006 if (ret == CAMERA_ERROR_NONE) {
4007 muse_camera_msg_get(get_width, pc->cb_info->recv_msg);
4008 muse_camera_msg_get(get_height, pc->cb_info->recv_msg);
4010 *height = get_height;
4012 LOGD("ret : 0x%x", ret);
4017 int camera_attr_get_lens_orientation(camera_h camera, int *angle)
4019 if (camera == NULL || angle == NULL) {
4020 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4021 return CAMERA_ERROR_INVALID_PARAMETER;
4023 int ret = CAMERA_ERROR_NONE;
4025 camera_cli_s *pc = (camera_cli_s *)camera;
4026 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_LENS_ORIENTATION;
4028 if (pc->cb_info == NULL) {
4029 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4030 return CAMERA_ERROR_INVALID_PARAMETER;
4032 sock_fd = pc->cb_info->fd;
4035 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4036 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4038 if (ret == CAMERA_ERROR_NONE) {
4039 muse_camera_msg_get(get_angle, pc->cb_info->recv_msg);
4042 LOGD("ret : 0x%x", ret);
4046 int camera_attr_set_theater_mode(camera_h camera, camera_attr_theater_mode_e mode)
4048 if (camera == NULL) {
4049 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4050 return CAMERA_ERROR_INVALID_PARAMETER;
4052 int ret = CAMERA_ERROR_NONE;
4053 camera_cli_s *pc = (camera_cli_s *)camera;
4054 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_THEATER_MODE;
4056 if (pc->cb_info == NULL) {
4057 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4058 return CAMERA_ERROR_INVALID_PARAMETER;
4060 sock_fd = pc->cb_info->fd;
4061 int set_mode = (int)mode;
4062 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4063 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
4064 LOGD("ret : 0x%x", ret);
4068 int camera_attr_get_theater_mode(camera_h camera, camera_attr_theater_mode_e *mode)
4070 if (camera == NULL || mode == NULL) {
4071 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4072 return CAMERA_ERROR_INVALID_PARAMETER;
4075 int ret = CAMERA_ERROR_NONE;
4076 camera_cli_s *pc = (camera_cli_s *)camera;
4077 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_THEATER_MODE;
4079 if (pc->cb_info == NULL) {
4080 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4081 return CAMERA_ERROR_INVALID_PARAMETER;
4083 sock_fd = pc->cb_info->fd;
4085 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4086 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4088 if (ret == CAMERA_ERROR_NONE) {
4089 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
4090 *mode = (camera_attr_theater_mode_e)get_mode;
4092 LOGD("ret : 0x%x", ret);
4096 int camera_attr_foreach_supported_theater_mode(camera_h camera, camera_attr_supported_theater_mode_cb foreach_cb, void *user_data)
4098 if (camera == NULL || foreach_cb == NULL) {
4099 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4100 return CAMERA_ERROR_INVALID_PARAMETER;
4102 int ret = CAMERA_ERROR_NONE;
4104 camera_cli_s *pc = (camera_cli_s *)camera;
4105 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_THEATER_MODE;
4107 LOGD("Enter, handle :%x", pc->remote_handle);
4110 if (pc->cb_info == NULL) {
4111 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4112 return CAMERA_ERROR_INVALID_PARAMETER;
4114 sock_fd = pc->cb_info->fd;
4115 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE] = foreach_cb;
4116 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE] = user_data;
4118 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4120 LOGD("Finish, return :%x", ret);
4125 int camera_attr_set_preview_fps(camera_h camera, camera_attr_fps_e fps)
4127 if (camera == NULL) {
4128 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4129 return CAMERA_ERROR_INVALID_PARAMETER;
4131 int ret = CAMERA_ERROR_NONE;
4132 camera_cli_s *pc = (camera_cli_s *)camera;
4133 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_PREVIEW_FPS;
4135 if (pc->cb_info == NULL) {
4136 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4137 return CAMERA_ERROR_INVALID_PARAMETER;
4139 sock_fd = pc->cb_info->fd;
4140 int set_fps = (int)fps;
4141 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4142 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_fps);
4143 LOGD("ret : 0x%x", ret);
4148 int camera_attr_set_image_quality(camera_h camera, int quality)
4150 if (camera == NULL) {
4151 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4152 return CAMERA_ERROR_INVALID_PARAMETER;
4154 int ret = CAMERA_ERROR_NONE;
4156 camera_cli_s *pc = (camera_cli_s *)camera;
4157 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_IMAGE_QUALITY;
4159 if (pc->cb_info == NULL) {
4160 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4161 return CAMERA_ERROR_INVALID_PARAMETER;
4163 sock_fd = pc->cb_info->fd;
4164 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4165 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, quality);
4166 LOGD("ret : 0x%x", ret);
4170 int camera_attr_get_preview_fps(camera_h camera, camera_attr_fps_e *fps)
4172 if (camera == NULL || fps == NULL) {
4173 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4174 return CAMERA_ERROR_INVALID_PARAMETER;
4176 int ret = CAMERA_ERROR_NONE;
4178 camera_cli_s *pc = (camera_cli_s *)camera;
4179 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_PREVIEW_FPS;
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;
4188 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4189 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4191 if (ret == CAMERA_ERROR_NONE) {
4192 muse_camera_msg_get(get_fps, pc->cb_info->recv_msg);
4193 *fps = (camera_attr_fps_e)get_fps;
4195 LOGD("ret : 0x%x", ret);
4200 int camera_attr_get_image_quality(camera_h camera, int *quality)
4202 if (camera == NULL || quality == NULL) {
4203 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4204 return CAMERA_ERROR_INVALID_PARAMETER;
4206 int ret = CAMERA_ERROR_NONE;
4208 camera_cli_s *pc = (camera_cli_s *)camera;
4209 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_IMAGE_QUALITY;
4211 if (pc->cb_info == NULL) {
4212 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4213 return CAMERA_ERROR_INVALID_PARAMETER;
4215 sock_fd = pc->cb_info->fd;
4217 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4218 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4220 if (ret == CAMERA_ERROR_NONE) {
4221 muse_camera_msg_get(get_quality, pc->cb_info->recv_msg);
4222 *quality = get_quality;
4224 LOGD("ret : 0x%x", ret);
4229 int camera_attr_get_encoded_preview_bitrate(camera_h camera, int *bitrate)
4231 if (camera == NULL || bitrate == NULL) {
4232 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4233 return CAMERA_ERROR_INVALID_PARAMETER;
4236 int ret = CAMERA_ERROR_NONE;
4238 camera_cli_s *pc = (camera_cli_s *)camera;
4239 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ENCODED_PREVIEW_BITRATE;
4241 if (pc->cb_info == NULL) {
4242 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4243 return CAMERA_ERROR_INVALID_PARAMETER;
4245 sock_fd = pc->cb_info->fd;
4248 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4249 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4251 if (ret == CAMERA_ERROR_NONE) {
4252 muse_camera_msg_get(get_bitrate, pc->cb_info->recv_msg);
4253 *bitrate = get_bitrate;
4255 LOGD("ret : 0x%x", ret);
4260 int camera_attr_set_encoded_preview_bitrate(camera_h camera, int bitrate)
4262 if (camera == NULL) {
4263 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4264 return CAMERA_ERROR_INVALID_PARAMETER;
4267 int ret = CAMERA_ERROR_NONE;
4269 camera_cli_s *pc = (camera_cli_s *)camera;
4270 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ENCODED_PREVIEW_BITRATE;
4272 if (pc->cb_info == NULL) {
4273 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4274 return CAMERA_ERROR_INVALID_PARAMETER;
4276 sock_fd = pc->cb_info->fd;
4277 int set_bitrate = bitrate;
4278 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4279 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_bitrate);
4280 LOGD("ret : 0x%x", ret);
4285 int camera_attr_get_encoded_preview_gop_interval(camera_h camera, int *interval)
4287 if (camera == NULL || interval == NULL) {
4288 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4289 return CAMERA_ERROR_INVALID_PARAMETER;
4292 int ret = CAMERA_ERROR_NONE;
4294 camera_cli_s *pc = (camera_cli_s *)camera;
4295 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ENCODED_PREVIEW_GOP_INTERVAL;
4297 if (pc->cb_info == NULL) {
4298 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4299 return CAMERA_ERROR_INVALID_PARAMETER;
4301 sock_fd = pc->cb_info->fd;
4302 int get_gop_interval;
4304 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4305 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4307 if (ret == CAMERA_ERROR_NONE) {
4308 muse_camera_msg_get(get_gop_interval, pc->cb_info->recv_msg);
4309 *interval = get_gop_interval;
4311 LOGD("ret : 0x%x", ret);
4316 int camera_attr_set_encoded_preview_gop_interval(camera_h camera, int interval)
4318 if (camera == NULL) {
4319 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4320 return CAMERA_ERROR_INVALID_PARAMETER;
4323 int ret = CAMERA_ERROR_NONE;
4325 camera_cli_s *pc = (camera_cli_s *)camera;
4326 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ENCODED_PREVIEW_GOP_INTERVAL;
4328 if (pc->cb_info == NULL) {
4329 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4330 return CAMERA_ERROR_INVALID_PARAMETER;
4332 sock_fd = pc->cb_info->fd;
4333 int set_gop_interval = interval;
4334 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4335 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_gop_interval);
4336 LOGD("ret : 0x%x", ret);
4341 int camera_attr_set_zoom(camera_h camera, int zoom)
4343 if (camera == NULL) {
4344 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4345 return CAMERA_ERROR_INVALID_PARAMETER;
4347 int ret = CAMERA_ERROR_NONE;
4349 camera_cli_s *pc = (camera_cli_s *)camera;
4350 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ZOOM;
4352 if (pc->cb_info == NULL) {
4353 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4354 return CAMERA_ERROR_INVALID_PARAMETER;
4356 sock_fd = pc->cb_info->fd;
4358 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4359 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, zoom);
4360 LOGD("ret : 0x%x", ret);
4364 int camera_attr_set_af_mode(camera_h camera, camera_attr_af_mode_e mode)
4366 if (camera == NULL) {
4367 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4368 return CAMERA_ERROR_INVALID_PARAMETER;
4370 int ret = CAMERA_ERROR_NONE;
4372 camera_cli_s *pc = (camera_cli_s *)camera;
4373 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_AF_MODE;
4375 if (pc->cb_info == NULL) {
4376 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4377 return CAMERA_ERROR_INVALID_PARAMETER;
4379 sock_fd = pc->cb_info->fd;
4380 int set_mode = (int)mode;
4381 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4382 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
4383 LOGD("ret : 0x%x", ret);
4387 int camera_attr_set_af_area(camera_h camera, int x, int y)
4389 if (camera == NULL) {
4390 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4391 return CAMERA_ERROR_INVALID_PARAMETER;
4393 int ret = CAMERA_ERROR_NONE;
4394 camera_cli_s *pc = (camera_cli_s *)camera;
4395 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_AF_AREA;
4396 int sock_fd = pc->cb_info->fd;
4397 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4398 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, x, INT, y);
4399 LOGD("ret : 0x%x", ret);
4404 int camera_attr_clear_af_area(camera_h camera)
4406 if (camera == NULL) {
4407 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4408 return CAMERA_ERROR_INVALID_PARAMETER;
4410 int ret = CAMERA_ERROR_NONE;
4412 camera_cli_s *pc = (camera_cli_s *)camera;
4413 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_CLEAR_AF_AREA;
4415 if (pc->cb_info == NULL) {
4416 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4417 return CAMERA_ERROR_INVALID_PARAMETER;
4419 sock_fd = pc->cb_info->fd;
4420 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4421 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4422 LOGD("ret : 0x%x", ret);
4427 int camera_attr_set_exposure_mode(camera_h camera, camera_attr_exposure_mode_e mode)
4429 if (camera == NULL) {
4430 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4431 return CAMERA_ERROR_INVALID_PARAMETER;
4434 if (mode < CAMERA_ATTR_EXPOSURE_MODE_OFF || mode > CAMERA_ATTR_EXPOSURE_MODE_CUSTOM) {
4435 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4436 return CAMERA_ERROR_INVALID_PARAMETER;
4439 int ret = CAMERA_ERROR_NONE;
4440 camera_cli_s *pc = (camera_cli_s *)camera;
4441 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EXPOSURE_MODE;
4442 int set_mode = (int)mode;
4444 if (pc->cb_info == NULL) {
4445 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4446 return CAMERA_ERROR_INVALID_PARAMETER;
4448 sock_fd = pc->cb_info->fd;
4449 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4450 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
4451 LOGD("ret : 0x%x", ret);
4456 int camera_attr_set_exposure(camera_h camera, int value)
4458 if (camera == NULL) {
4459 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4460 return CAMERA_ERROR_INVALID_PARAMETER;
4462 int ret = CAMERA_ERROR_NONE;
4464 camera_cli_s *pc = (camera_cli_s *)camera;
4465 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EXPOSURE;
4467 if (pc->cb_info == NULL) {
4468 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4469 return CAMERA_ERROR_INVALID_PARAMETER;
4471 sock_fd = pc->cb_info->fd;
4473 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4474 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, value);
4475 LOGD("ret : 0x%x", ret);
4480 int camera_attr_set_iso(camera_h camera, camera_attr_iso_e iso)
4482 if (camera == NULL) {
4483 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4484 return CAMERA_ERROR_INVALID_PARAMETER;
4486 int ret = CAMERA_ERROR_NONE;
4488 camera_cli_s *pc = (camera_cli_s *)camera;
4489 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ISO;
4491 if (pc->cb_info == NULL) {
4492 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4493 return CAMERA_ERROR_INVALID_PARAMETER;
4495 sock_fd = pc->cb_info->fd;
4496 int set_iso = (int)iso;
4497 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4498 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_iso);
4499 LOGD("ret : 0x%x", ret);
4504 int camera_attr_set_brightness(camera_h camera, int level)
4506 if (camera == NULL) {
4507 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4508 return CAMERA_ERROR_INVALID_PARAMETER;
4510 int ret = CAMERA_ERROR_NONE;
4512 camera_cli_s *pc = (camera_cli_s *)camera;
4513 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_BRIGHTNESS;
4515 if (pc->cb_info == NULL) {
4516 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4517 return CAMERA_ERROR_INVALID_PARAMETER;
4519 sock_fd = pc->cb_info->fd;
4521 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4522 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, level);
4523 LOGD("ret : 0x%x", ret);
4528 int camera_attr_set_contrast(camera_h camera, int level)
4530 if (camera == NULL) {
4531 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4532 return CAMERA_ERROR_INVALID_PARAMETER;
4534 int ret = CAMERA_ERROR_NONE;
4536 camera_cli_s *pc = (camera_cli_s *)camera;
4537 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_CONTRAST;
4539 if (pc->cb_info == NULL) {
4540 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4541 return CAMERA_ERROR_INVALID_PARAMETER;
4543 sock_fd = pc->cb_info->fd;
4545 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4546 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, level);
4547 LOGD("ret : 0x%x", ret);
4552 int camera_attr_set_whitebalance(camera_h camera, camera_attr_whitebalance_e wb)
4554 if (camera == NULL) {
4555 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4556 return CAMERA_ERROR_INVALID_PARAMETER;
4559 if (wb < CAMERA_ATTR_WHITE_BALANCE_NONE || wb > CAMERA_ATTR_WHITE_BALANCE_CUSTOM) {
4560 LOGE("invalid white balance %d", wb);
4561 return CAMERA_ERROR_INVALID_PARAMETER;
4564 int ret = CAMERA_ERROR_NONE;
4566 camera_cli_s *pc = (camera_cli_s *)camera;
4567 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_WHITEBALANCE;
4569 if (pc->cb_info == NULL) {
4570 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4571 return CAMERA_ERROR_INVALID_PARAMETER;
4573 sock_fd = pc->cb_info->fd;
4574 int set_whitebalance = (int)wb;
4575 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4576 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_whitebalance);
4577 LOGD("ret : 0x%x", ret);
4582 int camera_attr_set_effect(camera_h camera, camera_attr_effect_mode_e effect)
4584 if (camera == NULL) {
4585 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4586 return CAMERA_ERROR_INVALID_PARAMETER;
4588 int ret = CAMERA_ERROR_NONE;
4590 camera_cli_s *pc = (camera_cli_s *)camera;
4591 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EFFECT;
4593 if (pc->cb_info == NULL) {
4594 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4595 return CAMERA_ERROR_INVALID_PARAMETER;
4597 sock_fd = pc->cb_info->fd;
4598 int set_effect = (int)effect;
4599 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4600 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_effect);
4601 LOGD("ret : 0x%x", ret);
4606 int camera_attr_set_scene_mode(camera_h camera, camera_attr_scene_mode_e mode)
4608 if (camera == NULL) {
4609 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4610 return CAMERA_ERROR_INVALID_PARAMETER;
4612 int ret = CAMERA_ERROR_NONE;
4614 camera_cli_s *pc = (camera_cli_s *)camera;
4615 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_SCENE_MODE;
4617 if (pc->cb_info == NULL) {
4618 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4619 return CAMERA_ERROR_INVALID_PARAMETER;
4621 sock_fd = pc->cb_info->fd;
4622 int set_mode = (int)mode;
4623 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4624 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
4625 LOGD("ret : 0x%x", ret);
4630 int camera_attr_enable_tag(camera_h camera, bool enable)
4632 if (camera == NULL) {
4633 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4634 return CAMERA_ERROR_INVALID_PARAMETER;
4636 int ret = CAMERA_ERROR_NONE;
4637 camera_cli_s *pc = (camera_cli_s *)camera;
4638 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_TAG;
4640 if (pc->cb_info == NULL) {
4641 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4642 return CAMERA_ERROR_INVALID_PARAMETER;
4644 sock_fd = pc->cb_info->fd;
4645 int set_enable = (int)enable;
4647 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4648 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
4649 LOGD("ret : 0x%x", ret);
4654 int camera_attr_set_tag_image_description(camera_h camera, const char *description)
4656 if (camera == NULL) {
4657 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4658 return CAMERA_ERROR_INVALID_PARAMETER;
4660 if (description == NULL) {
4661 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4662 return CAMERA_ERROR_INVALID_PARAMETER;
4664 int ret = CAMERA_ERROR_NONE;
4665 camera_cli_s *pc = (camera_cli_s *)camera;
4666 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_IMAGE_DESCRIPTION;
4668 if (pc->cb_info == NULL) {
4669 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4670 return CAMERA_ERROR_INVALID_PARAMETER;
4672 sock_fd = pc->cb_info->fd;
4673 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4674 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, STRING, description);
4675 LOGD("ret : 0x%x", ret);
4680 int camera_attr_set_tag_orientation(camera_h camera, camera_attr_tag_orientation_e orientation)
4682 if (camera == NULL) {
4683 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4684 return CAMERA_ERROR_INVALID_PARAMETER;
4686 int ret = CAMERA_ERROR_NONE;
4687 camera_cli_s *pc = (camera_cli_s *)camera;
4688 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_ORIENTATION;
4690 if (pc->cb_info == NULL) {
4691 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4692 return CAMERA_ERROR_INVALID_PARAMETER;
4694 sock_fd = pc->cb_info->fd;
4695 int set_orientation = (int)orientation;
4697 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4698 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_orientation);
4699 LOGD("ret : 0x%x", ret);
4704 int camera_attr_set_tag_software(camera_h camera, const char *software)
4706 if (camera == NULL) {
4707 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4708 return CAMERA_ERROR_INVALID_PARAMETER;
4710 if (software == NULL) {
4711 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4712 return CAMERA_ERROR_INVALID_PARAMETER;
4714 int ret = CAMERA_ERROR_NONE;
4715 camera_cli_s *pc = (camera_cli_s *)camera;
4716 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_SOFTWARE;
4718 if (pc->cb_info == NULL) {
4719 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4720 return CAMERA_ERROR_INVALID_PARAMETER;
4722 sock_fd = pc->cb_info->fd;
4723 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4724 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, STRING, software);
4725 LOGD("ret : 0x%x", ret);
4730 int camera_attr_set_geotag(camera_h camera, double latitude , double longitude, double altitude)
4732 if (camera == NULL) {
4733 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4734 return CAMERA_ERROR_INVALID_PARAMETER;
4736 int ret = CAMERA_ERROR_NONE;
4737 camera_cli_s *pc = (camera_cli_s *)camera;
4738 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_GEOTAG;
4740 if (pc->cb_info == NULL) {
4741 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4742 return CAMERA_ERROR_INVALID_PARAMETER;
4744 sock_fd = pc->cb_info->fd;
4745 double set_geotag[3] = { latitude, longitude, altitude };
4747 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4748 muse_camera_msg_send_array(api, sock_fd, pc->cb_info, ret,
4749 set_geotag, sizeof(set_geotag), sizeof(double));
4750 LOGD("ret : 0x%x", ret);
4755 int camera_attr_remove_geotag(camera_h camera)
4757 if (camera == NULL) {
4758 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4759 return CAMERA_ERROR_INVALID_PARAMETER;
4761 int ret = CAMERA_ERROR_NONE;
4762 camera_cli_s *pc = (camera_cli_s *)camera;
4763 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_REMOVE_GEOTAG;
4765 if (pc->cb_info == NULL) {
4766 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4767 return CAMERA_ERROR_INVALID_PARAMETER;
4769 sock_fd = pc->cb_info->fd;
4770 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4771 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4772 LOGD("ret : 0x%x", ret);
4777 int camera_attr_set_flash_mode(camera_h camera, camera_attr_flash_mode_e mode)
4779 if (camera == NULL) {
4780 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4781 return CAMERA_ERROR_INVALID_PARAMETER;
4783 int ret = CAMERA_ERROR_NONE;
4784 camera_cli_s *pc = (camera_cli_s *)camera;
4785 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_FLASH_MODE;
4787 if (pc->cb_info == NULL) {
4788 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4789 return CAMERA_ERROR_INVALID_PARAMETER;
4791 sock_fd = pc->cb_info->fd;
4792 int set_mode = (int)mode;
4794 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4795 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
4796 LOGD("ret : 0x%x", ret);
4801 int camera_attr_get_zoom(camera_h camera, int *zoom)
4803 if (camera == NULL || zoom == NULL) {
4804 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4805 return CAMERA_ERROR_INVALID_PARAMETER;
4807 int ret = CAMERA_ERROR_NONE;
4809 camera_cli_s *pc = (camera_cli_s *)camera;
4810 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ZOOM;
4813 if (pc->cb_info == NULL) {
4814 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4815 return CAMERA_ERROR_INVALID_PARAMETER;
4817 sock_fd = pc->cb_info->fd;
4819 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4820 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4822 if (ret == CAMERA_ERROR_NONE) {
4823 muse_camera_msg_get(get_zoom, pc->cb_info->recv_msg);
4826 LOGD("ret : 0x%x", ret);
4831 int camera_attr_get_zoom_range(camera_h camera, int *min, int *max)
4833 if (camera == NULL || min == NULL || max == NULL) {
4834 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4835 return CAMERA_ERROR_INVALID_PARAMETER;
4837 int ret = CAMERA_ERROR_NONE;
4838 camera_cli_s *pc = (camera_cli_s *)camera;
4840 if (pc->cb_info == NULL) {
4841 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4842 return CAMERA_ERROR_INVALID_PARAMETER;
4844 sock_fd = pc->cb_info->fd;
4845 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ZOOM_RANGE;
4849 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4850 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4852 if (ret == CAMERA_ERROR_NONE) {
4853 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
4854 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
4858 LOGD("ret : 0x%x", ret);
4863 int camera_attr_get_af_mode(camera_h camera, camera_attr_af_mode_e *mode)
4865 if (camera == NULL || mode == NULL) {
4866 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4867 return CAMERA_ERROR_INVALID_PARAMETER;
4869 int ret = CAMERA_ERROR_NONE;
4870 camera_cli_s *pc = (camera_cli_s *)camera;
4872 if (pc->cb_info == NULL) {
4873 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4874 return CAMERA_ERROR_INVALID_PARAMETER;
4876 sock_fd = pc->cb_info->fd;
4877 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_AF_MODE;
4880 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4881 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4883 if (ret == CAMERA_ERROR_NONE) {
4884 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
4885 *mode = (camera_attr_af_mode_e)get_mode;
4887 LOGD("ret : 0x%x", ret);
4892 int camera_attr_get_exposure_mode(camera_h camera, camera_attr_exposure_mode_e *mode)
4894 if (camera == NULL || mode == NULL) {
4895 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4896 return CAMERA_ERROR_INVALID_PARAMETER;
4898 int ret = CAMERA_ERROR_NONE;
4899 camera_cli_s *pc = (camera_cli_s *)camera;
4901 if (pc->cb_info == NULL) {
4902 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4903 return CAMERA_ERROR_INVALID_PARAMETER;
4905 sock_fd = pc->cb_info->fd;
4906 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE_MODE;
4909 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4910 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4912 if (ret == CAMERA_ERROR_NONE) {
4913 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
4914 *mode = (camera_attr_exposure_mode_e)get_mode;
4916 LOGD("ret : 0x%x", ret);
4920 int camera_attr_get_exposure(camera_h camera, int *value)
4922 if (camera == NULL || value == NULL) {
4923 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4924 return CAMERA_ERROR_INVALID_PARAMETER;
4926 int ret = CAMERA_ERROR_NONE;
4927 camera_cli_s *pc = (camera_cli_s *)camera;
4929 if (pc->cb_info == NULL) {
4930 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4931 return CAMERA_ERROR_INVALID_PARAMETER;
4933 sock_fd = pc->cb_info->fd;
4934 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE;
4937 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4938 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4940 if (ret == CAMERA_ERROR_NONE) {
4941 muse_camera_msg_get(get_value, pc->cb_info->recv_msg);
4944 LOGD("ret : 0x%x", ret);
4949 int camera_attr_get_exposure_range(camera_h camera, int *min, int *max)
4951 if (camera == NULL || min == NULL || max == NULL) {
4952 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4953 return CAMERA_ERROR_INVALID_PARAMETER;
4955 int ret = CAMERA_ERROR_NONE;
4956 camera_cli_s *pc = (camera_cli_s *)camera;
4958 if (pc->cb_info == NULL) {
4959 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4960 return CAMERA_ERROR_INVALID_PARAMETER;
4962 sock_fd = pc->cb_info->fd;
4963 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE_RANGE;
4967 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4968 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4970 if (ret == CAMERA_ERROR_NONE) {
4971 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
4972 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
4976 LOGD("ret : 0x%x", ret);
4981 int camera_attr_get_iso(camera_h camera, camera_attr_iso_e *iso)
4983 if (camera == NULL || iso == NULL) {
4984 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4985 return CAMERA_ERROR_INVALID_PARAMETER;
4987 int ret = CAMERA_ERROR_NONE;
4988 camera_cli_s *pc = (camera_cli_s *)camera;
4990 if (pc->cb_info == NULL) {
4991 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4992 return CAMERA_ERROR_INVALID_PARAMETER;
4994 sock_fd = pc->cb_info->fd;
4995 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ISO;
4998 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4999 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5001 if (ret == CAMERA_ERROR_NONE) {
5002 muse_camera_msg_get(get_iso, pc->cb_info->recv_msg);
5003 *iso = (camera_attr_iso_e)get_iso;
5005 LOGD("ret : 0x%x", ret);
5010 int camera_attr_get_brightness(camera_h camera, int *level)
5012 if (camera == NULL || level == NULL) {
5013 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5014 return CAMERA_ERROR_INVALID_PARAMETER;
5016 int ret = CAMERA_ERROR_NONE;
5017 camera_cli_s *pc = (camera_cli_s *)camera;
5019 if (pc->cb_info == NULL) {
5020 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5021 return CAMERA_ERROR_INVALID_PARAMETER;
5023 sock_fd = pc->cb_info->fd;
5024 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_BRIGHTNESS;
5027 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5028 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5030 if (ret == CAMERA_ERROR_NONE) {
5031 muse_camera_msg_get(get_level, pc->cb_info->recv_msg);
5034 LOGD("ret : 0x%x", ret);
5039 int camera_attr_get_brightness_range(camera_h camera, int *min, int *max)
5041 if (camera == NULL || min == NULL || max == NULL) {
5042 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5043 return CAMERA_ERROR_INVALID_PARAMETER;
5045 int ret = CAMERA_ERROR_NONE;
5046 camera_cli_s *pc = (camera_cli_s *)camera;
5048 if (pc->cb_info == NULL) {
5049 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5050 return CAMERA_ERROR_INVALID_PARAMETER;
5052 sock_fd = pc->cb_info->fd;
5053 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_BRIGHTNESS_RANGE;
5057 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5058 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5060 if (ret == CAMERA_ERROR_NONE) {
5061 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
5062 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
5066 LOGD("ret : 0x%x", ret);
5071 int camera_attr_get_contrast(camera_h camera, int *level)
5073 if (camera == NULL || level == NULL) {
5074 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5075 return CAMERA_ERROR_INVALID_PARAMETER;
5077 int ret = CAMERA_ERROR_NONE;
5078 camera_cli_s *pc = (camera_cli_s *)camera;
5079 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_CONTRAST;
5081 if (pc->cb_info == NULL) {
5082 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5083 return CAMERA_ERROR_INVALID_PARAMETER;
5085 sock_fd = pc->cb_info->fd;
5088 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5089 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5091 if (ret == CAMERA_ERROR_NONE) {
5092 muse_camera_msg_get(get_level, pc->cb_info->recv_msg);
5095 LOGD("ret : 0x%x", ret);
5100 int camera_attr_get_contrast_range(camera_h camera, int *min , int *max)
5102 if (camera == NULL || min == NULL || max == NULL) {
5103 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5104 return CAMERA_ERROR_INVALID_PARAMETER;
5106 int ret = CAMERA_ERROR_NONE;
5107 camera_cli_s *pc = (camera_cli_s *)camera;
5108 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_CONTRAST_RANGE;
5110 if (pc->cb_info == NULL) {
5111 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5112 return CAMERA_ERROR_INVALID_PARAMETER;
5114 sock_fd = pc->cb_info->fd;
5118 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5119 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5121 if (ret == CAMERA_ERROR_NONE) {
5122 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
5123 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
5127 LOGD("ret : 0x%x", ret);
5132 int camera_attr_get_whitebalance(camera_h camera, camera_attr_whitebalance_e *wb)
5134 if (camera == NULL || wb == NULL) {
5135 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5136 return CAMERA_ERROR_INVALID_PARAMETER;
5138 int ret = CAMERA_ERROR_NONE;
5139 camera_cli_s *pc = (camera_cli_s *)camera;
5140 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_WHITEBALANCE;
5142 if (pc->cb_info == NULL) {
5143 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5144 return CAMERA_ERROR_INVALID_PARAMETER;
5146 sock_fd = pc->cb_info->fd;
5149 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5150 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5152 if (ret == CAMERA_ERROR_NONE) {
5153 muse_camera_msg_get(get_wb, pc->cb_info->recv_msg);
5154 *wb = (camera_attr_whitebalance_e)get_wb;
5156 LOGD("ret : 0x%x", ret);
5161 int camera_attr_get_effect(camera_h camera, camera_attr_effect_mode_e *effect)
5163 if (camera == NULL || effect == NULL) {
5164 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5165 return CAMERA_ERROR_INVALID_PARAMETER;
5168 int ret = CAMERA_ERROR_NONE;
5169 camera_cli_s *pc = (camera_cli_s *)camera;
5170 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EFFECT;
5172 if (pc->cb_info == NULL) {
5173 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5174 return CAMERA_ERROR_INVALID_PARAMETER;
5176 sock_fd = pc->cb_info->fd;
5179 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5180 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5182 if (ret == CAMERA_ERROR_NONE) {
5183 muse_camera_msg_get(get_effect, pc->cb_info->recv_msg);
5184 *effect = (camera_attr_effect_mode_e)get_effect;
5186 LOGD("ret : 0x%x", ret);
5191 int camera_attr_get_scene_mode(camera_h camera, camera_attr_scene_mode_e *mode)
5193 if (camera == NULL || mode == NULL) {
5194 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5195 return CAMERA_ERROR_INVALID_PARAMETER;
5198 int ret = CAMERA_ERROR_NONE;
5199 camera_cli_s *pc = (camera_cli_s *)camera;
5200 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_SCENE_MODE;
5202 if (pc->cb_info == NULL) {
5203 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5204 return CAMERA_ERROR_INVALID_PARAMETER;
5206 sock_fd = pc->cb_info->fd;
5209 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5210 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5212 if (ret == CAMERA_ERROR_NONE) {
5213 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
5214 *mode = (camera_attr_scene_mode_e)get_mode;
5216 LOGD("ret : 0x%x", ret);
5221 int camera_attr_is_enabled_tag(camera_h camera, bool *enable)
5223 if (camera == NULL || enable == NULL) {
5224 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5225 return CAMERA_ERROR_INVALID_PARAMETER;
5228 int ret = CAMERA_ERROR_NONE;
5229 camera_cli_s *pc = (camera_cli_s *)camera;
5230 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_TAG;
5232 if (pc->cb_info == NULL) {
5233 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5234 return CAMERA_ERROR_INVALID_PARAMETER;
5236 sock_fd = pc->cb_info->fd;
5239 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5240 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5242 if (ret == CAMERA_ERROR_NONE) {
5243 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
5244 *enable = (bool)get_enabled;
5246 LOGD("ret : 0x%x", ret);
5251 int camera_attr_get_tag_image_description(camera_h camera, char **description)
5253 if (camera == NULL || description == NULL) {
5254 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5255 return CAMERA_ERROR_INVALID_PARAMETER;
5258 int ret = CAMERA_ERROR_NONE;
5259 camera_cli_s *pc = (camera_cli_s *)camera;
5260 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_IMAGE_DESCRIPTION;
5262 if (pc->cb_info == NULL) {
5263 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5264 return CAMERA_ERROR_INVALID_PARAMETER;
5266 sock_fd = pc->cb_info->fd;
5267 char get_description[MUSE_CAMERA_MSG_MAX_LENGTH] = {0,};
5269 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5270 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5272 if (ret == CAMERA_ERROR_NONE) {
5273 muse_camera_msg_get_string(get_description, pc->cb_info->recv_msg);
5274 *description = strdup(get_description);
5276 LOGD("ret : 0x%x", ret);
5281 int camera_attr_get_tag_orientation(camera_h camera, camera_attr_tag_orientation_e *orientation)
5283 if (camera == NULL || orientation == NULL) {
5284 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5285 return CAMERA_ERROR_INVALID_PARAMETER;
5288 int ret = CAMERA_ERROR_NONE;
5289 camera_cli_s *pc = (camera_cli_s *)camera;
5290 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_ORIENTATION;
5292 if (pc->cb_info == NULL) {
5293 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5294 return CAMERA_ERROR_INVALID_PARAMETER;
5296 sock_fd = pc->cb_info->fd;
5297 int get_orientation;
5299 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5300 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5302 if (ret == CAMERA_ERROR_NONE) {
5303 muse_camera_msg_get(get_orientation, pc->cb_info->recv_msg);
5304 *orientation = (camera_attr_tag_orientation_e)get_orientation;
5305 LOGD("success, orientation : %d", *orientation);
5307 LOGD("ret : 0x%x", ret);
5312 int camera_attr_get_tag_software(camera_h camera, char **software)
5314 if (camera == NULL || software == NULL) {
5315 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5316 return CAMERA_ERROR_INVALID_PARAMETER;
5319 int ret = CAMERA_ERROR_NONE;
5320 camera_cli_s *pc = (camera_cli_s *)camera;
5321 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_SOFTWARE;
5323 if (pc->cb_info == NULL) {
5324 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5325 return CAMERA_ERROR_INVALID_PARAMETER;
5327 sock_fd = pc->cb_info->fd;
5328 char get_software[MUSE_CAMERA_MSG_MAX_LENGTH] = {0,};
5330 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5331 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5333 if (ret == CAMERA_ERROR_NONE) {
5334 muse_camera_msg_get_string(get_software, pc->cb_info->recv_msg);
5335 *software = strdup(get_software);
5337 LOGD("ret : 0x%x", ret);
5342 int camera_attr_get_geotag(camera_h camera, double *latitude , double *longitude, double *altitude)
5344 if (camera == NULL || latitude == NULL || longitude == NULL || altitude == NULL) {
5345 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5346 return CAMERA_ERROR_INVALID_PARAMETER;
5349 int ret = CAMERA_ERROR_NONE;
5350 camera_cli_s *pc = (camera_cli_s *)camera;
5351 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_GEOTAG;
5352 double get_geotag[3] = {0,};
5354 if (pc->cb_info == NULL) {
5355 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5356 return CAMERA_ERROR_INVALID_PARAMETER;
5358 sock_fd = pc->cb_info->fd;
5360 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5362 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5364 if (ret == CAMERA_ERROR_NONE) {
5365 muse_camera_msg_get_array(get_geotag, pc->cb_info->recv_msg);
5366 *latitude = get_geotag[0];
5367 *longitude = get_geotag[1];
5368 *altitude = get_geotag[2];
5370 LOGD("ret : 0x%x", ret);
5372 LOGE("Returned value is not valid : 0x%x", ret);
5379 int camera_attr_get_flash_mode(camera_h camera, camera_attr_flash_mode_e *mode)
5381 if (camera == NULL || mode == NULL) {
5382 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5383 return CAMERA_ERROR_INVALID_PARAMETER;
5386 int ret = CAMERA_ERROR_NONE;
5387 camera_cli_s *pc = (camera_cli_s *)camera;
5388 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_FLASH_MODE;
5390 if (pc->cb_info == NULL) {
5391 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5392 return CAMERA_ERROR_INVALID_PARAMETER;
5394 sock_fd = pc->cb_info->fd;
5397 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5398 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5400 if (ret == CAMERA_ERROR_NONE) {
5401 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
5402 *mode = (camera_attr_flash_mode_e)get_mode;
5404 LOGD("ret : 0x%x", ret);
5409 int camera_get_flash_state(camera_device_e device, camera_flash_state_e *state)
5413 int ret = CAMERA_ERROR_NONE;
5414 camera_cli_s *pc = NULL;
5415 int get_flash_state = 0;
5417 /* create muse connection */
5418 muse_camera_api_e api = MUSE_CAMERA_API_GET_FLASH_STATE;
5419 muse_core_api_module_e muse_module = MUSE_CAMERA;
5420 int device_type = (int)device;
5422 if (state == NULL) {
5423 LOGE("invalid pointer for state");
5424 return CAMERA_ERROR_INVALID_PARAMETER;
5427 sock_fd = muse_core_client_new();
5429 LOGE("muse_core_client_new failed - returned fd %d", sock_fd);
5430 ret = CAMERA_ERROR_INVALID_OPERATION;
5434 sndMsg = muse_core_msg_json_factory_new(api,
5435 MUSE_TYPE_INT, "module", muse_module,
5436 MUSE_TYPE_INT, PARAM_DEVICE_TYPE, device_type,
5439 muse_core_ipc_send_msg(sock_fd, sndMsg);
5440 muse_core_msg_json_factory_free(sndMsg);
5442 pc = g_new0(camera_cli_s, 1);
5444 LOGE("camera_cli_s alloc failed");
5445 ret = CAMERA_ERROR_OUT_OF_MEMORY;
5449 pc->cb_info = _client_callback_new(sock_fd);
5450 if (pc->cb_info == NULL) {
5451 LOGE("cb_info alloc failed");
5452 ret = CAMERA_ERROR_OUT_OF_MEMORY;
5456 ret = _client_wait_for_cb_return(api, pc->cb_info, CALLBACK_TIME_OUT);
5458 if (ret == CAMERA_ERROR_NONE) {
5459 muse_camera_msg_get(get_flash_state, pc->cb_info->recv_msg);
5460 *state = (camera_flash_state_e)get_flash_state;
5463 LOGD("Flash state : %d\n", *state);
5466 /* release resources */
5468 g_atomic_int_set(&pc->cb_info->msg_recv_running, 0);
5469 _client_callback_destroy(pc->cb_info);
5479 int camera_attr_foreach_supported_af_mode(camera_h camera, camera_attr_supported_af_mode_cb foreach_cb, void *user_data)
5481 if (camera == NULL || foreach_cb == NULL) {
5482 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5483 return CAMERA_ERROR_INVALID_PARAMETER;
5485 int ret = CAMERA_ERROR_NONE;
5487 camera_cli_s *pc = (camera_cli_s *)camera;
5488 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_AF_MODE;
5490 LOGD("Enter, handle :%x", pc->remote_handle);
5493 if (pc->cb_info == NULL) {
5494 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5495 return CAMERA_ERROR_INVALID_PARAMETER;
5497 sock_fd = pc->cb_info->fd;
5498 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_AF_MODE] = foreach_cb;
5499 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_AF_MODE] = user_data;
5501 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5502 LOGD("ret : 0x%x", ret);
5507 int camera_attr_foreach_supported_exposure_mode(camera_h camera, camera_attr_supported_exposure_mode_cb foreach_cb , void *user_data)
5509 if (camera == NULL || foreach_cb == NULL) {
5510 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5511 return CAMERA_ERROR_INVALID_PARAMETER;
5513 int ret = CAMERA_ERROR_NONE;
5515 camera_cli_s *pc = (camera_cli_s *)camera;
5516 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_EXPOSURE_MODE;
5518 LOGD("Enter, handle :%x", pc->remote_handle);
5521 if (pc->cb_info == NULL) {
5522 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5523 return CAMERA_ERROR_INVALID_PARAMETER;
5525 sock_fd = pc->cb_info->fd;
5526 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EXPOSURE_MODE] = foreach_cb;
5527 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EXPOSURE_MODE] = user_data;
5529 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5530 LOGD("ret : 0x%x", ret);
5535 int camera_attr_foreach_supported_iso(camera_h camera, camera_attr_supported_iso_cb foreach_cb, void *user_data)
5537 if (camera == NULL || foreach_cb == NULL) {
5538 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5539 return CAMERA_ERROR_INVALID_PARAMETER;
5541 int ret = CAMERA_ERROR_NONE;
5543 camera_cli_s *pc = (camera_cli_s *)camera;
5544 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_ISO;
5546 LOGD("Enter, handle :%x", pc->remote_handle);
5549 if (pc->cb_info == NULL) {
5550 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5551 return CAMERA_ERROR_INVALID_PARAMETER;
5553 sock_fd = pc->cb_info->fd;
5554 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_ISO] = foreach_cb;
5555 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_ISO] = user_data;
5557 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5558 LOGD("ret : 0x%x", ret);
5563 int camera_attr_foreach_supported_whitebalance(camera_h camera, camera_attr_supported_whitebalance_cb foreach_cb , void *user_data)
5565 if (camera == NULL || foreach_cb == NULL) {
5566 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5567 return CAMERA_ERROR_INVALID_PARAMETER;
5569 int ret = CAMERA_ERROR_NONE;
5571 camera_cli_s *pc = (camera_cli_s *)camera;
5572 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_WHITEBALANCE;
5574 LOGD("Enter, handle :%x", pc->remote_handle);
5577 if (pc->cb_info == NULL) {
5578 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5579 return CAMERA_ERROR_INVALID_PARAMETER;
5581 sock_fd = pc->cb_info->fd;
5582 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_WHITEBALANCE] = foreach_cb;
5583 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_WHITEBALANCE] = user_data;
5585 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5586 LOGD("ret : 0x%x", ret);
5591 int camera_attr_foreach_supported_effect(camera_h camera, camera_attr_supported_effect_cb foreach_cb , void *user_data)
5593 if (camera == NULL || foreach_cb == NULL) {
5594 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5595 return CAMERA_ERROR_INVALID_PARAMETER;
5597 int ret = CAMERA_ERROR_NONE;
5599 camera_cli_s *pc = (camera_cli_s *)camera;
5600 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_EFFECT;
5602 LOGD("Enter, handle :%x", pc->remote_handle);
5605 if (pc->cb_info == NULL) {
5606 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5607 return CAMERA_ERROR_INVALID_PARAMETER;
5609 sock_fd = pc->cb_info->fd;
5610 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EFFECT] = foreach_cb;
5611 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EFFECT] = user_data;
5613 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5614 LOGD("ret : 0x%x", ret);
5619 int camera_attr_foreach_supported_scene_mode(camera_h camera, camera_attr_supported_scene_mode_cb foreach_cb , void *user_data)
5621 if (camera == NULL || foreach_cb == NULL) {
5622 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5623 return CAMERA_ERROR_INVALID_PARAMETER;
5625 int ret = CAMERA_ERROR_NONE;
5627 camera_cli_s *pc = (camera_cli_s *)camera;
5628 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_SCENE_MODE;
5630 LOGD("Enter, handle :%x", pc->remote_handle);
5633 if (pc->cb_info == NULL) {
5634 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5635 return CAMERA_ERROR_INVALID_PARAMETER;
5637 sock_fd = pc->cb_info->fd;
5638 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_SCENE_MODE] = foreach_cb;
5639 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_SCENE_MODE] = user_data;
5641 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5642 LOGD("ret : 0x%x", ret);
5647 int camera_attr_foreach_supported_flash_mode(camera_h camera, camera_attr_supported_flash_mode_cb foreach_cb , void *user_data)
5649 if (camera == NULL || foreach_cb == NULL) {
5650 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5651 return CAMERA_ERROR_INVALID_PARAMETER;
5653 int ret = CAMERA_ERROR_NONE;
5655 camera_cli_s *pc = (camera_cli_s *)camera;
5656 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FLASH_MODE;
5658 LOGD("Enter, handle :%x", pc->remote_handle);
5661 if (pc->cb_info == NULL) {
5662 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5663 return CAMERA_ERROR_INVALID_PARAMETER;
5665 sock_fd = pc->cb_info->fd;
5666 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FLASH_MODE] = foreach_cb;
5667 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FLASH_MODE] = user_data;
5669 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5670 LOGD("ret : 0x%x", ret);
5675 int camera_attr_foreach_supported_fps(camera_h camera, camera_attr_supported_fps_cb foreach_cb , void *user_data)
5677 if (camera == NULL || foreach_cb == NULL) {
5678 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5679 return CAMERA_ERROR_INVALID_PARAMETER;
5681 int ret = CAMERA_ERROR_NONE;
5683 camera_cli_s *pc = (camera_cli_s *)camera;
5684 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FPS;
5686 if (pc->cb_info == NULL) {
5687 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5688 return CAMERA_ERROR_INVALID_PARAMETER;
5690 sock_fd = pc->cb_info->fd;
5691 LOGD("Enter, handle :%x", pc->remote_handle);
5692 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS] = foreach_cb;
5693 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS] = user_data;
5695 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5696 LOGD("Enter, handle :%x", pc->remote_handle);
5700 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)
5702 if (camera == NULL || foreach_cb == NULL) {
5703 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5704 return CAMERA_ERROR_INVALID_PARAMETER;
5706 int ret = CAMERA_ERROR_NONE;
5708 camera_cli_s *pc = (camera_cli_s *)camera;
5709 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FPS_BY_RESOLUTION;
5711 if (pc->cb_info == NULL) {
5712 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5713 return CAMERA_ERROR_INVALID_PARAMETER;
5715 sock_fd = pc->cb_info->fd;
5716 LOGD("Enter, handle :%x", pc->remote_handle);
5717 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS_BY_RESOLUTION] = foreach_cb;
5718 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS_BY_RESOLUTION] = user_data;
5720 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, width, INT, height);
5721 LOGD("ret : 0x%x", ret);
5725 int camera_attr_foreach_supported_stream_flip(camera_h camera, camera_attr_supported_stream_flip_cb foreach_cb, void *user_data)
5727 if (camera == NULL || foreach_cb == NULL) {
5728 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5729 return CAMERA_ERROR_INVALID_PARAMETER;
5731 int ret = CAMERA_ERROR_NONE;
5733 camera_cli_s *pc = (camera_cli_s *)camera;
5734 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_STREAM_FLIP;
5736 if (pc->cb_info == NULL) {
5737 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5738 return CAMERA_ERROR_INVALID_PARAMETER;
5740 sock_fd = pc->cb_info->fd;
5741 LOGD("Enter, handle :%x", pc->remote_handle);
5742 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_FLIP] = foreach_cb;
5743 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_FLIP] = user_data;
5745 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5746 LOGD("ret : 0x%x", ret);
5751 int camera_attr_foreach_supported_stream_rotation(camera_h camera, camera_attr_supported_stream_rotation_cb foreach_cb, void *user_data)
5753 if (camera == NULL || foreach_cb == NULL) {
5754 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5755 return CAMERA_ERROR_INVALID_PARAMETER;
5757 int ret = CAMERA_ERROR_NONE;
5759 camera_cli_s *pc = (camera_cli_s *)camera;
5760 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_STREAM_ROTATION;
5762 if (pc->cb_info == NULL) {
5763 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5764 return CAMERA_ERROR_INVALID_PARAMETER;
5766 sock_fd = pc->cb_info->fd;
5767 LOGD("Enter, handle :%x", pc->remote_handle);
5768 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION] = foreach_cb;
5769 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION] = user_data;
5771 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5772 LOGD("ret : 0x%x", ret);
5777 int camera_attr_set_stream_rotation(camera_h camera , camera_rotation_e rotation)
5779 if (camera == NULL) {
5780 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5781 return CAMERA_ERROR_INVALID_PARAMETER;
5784 int ret = CAMERA_ERROR_NONE;
5785 camera_cli_s *pc = (camera_cli_s *)camera;
5786 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_STREAM_ROTATION;
5788 if (pc->cb_info == NULL) {
5789 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5790 return CAMERA_ERROR_INVALID_PARAMETER;
5792 sock_fd = pc->cb_info->fd;
5793 int set_rotation = (int)rotation;
5795 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5796 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_rotation);
5797 LOGD("ret : 0x%x", ret);
5802 int camera_attr_get_stream_rotation(camera_h camera , camera_rotation_e *rotation)
5804 if (camera == NULL || rotation == NULL) {
5805 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5806 return CAMERA_ERROR_INVALID_PARAMETER;
5809 int ret = CAMERA_ERROR_NONE;
5810 camera_cli_s *pc = (camera_cli_s *)camera;
5811 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_STREAM_ROTATION;
5813 if (pc->cb_info == NULL) {
5814 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5815 return CAMERA_ERROR_INVALID_PARAMETER;
5817 sock_fd = pc->cb_info->fd;
5820 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5821 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5823 if (ret == CAMERA_ERROR_NONE) {
5824 muse_camera_msg_get(get_rotation, pc->cb_info->recv_msg);
5825 *rotation = (camera_rotation_e)get_rotation;
5827 LOGD("ret : 0x%x", ret);
5832 int camera_attr_set_stream_flip(camera_h camera , camera_flip_e flip)
5834 if (camera == NULL) {
5835 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5836 return CAMERA_ERROR_INVALID_PARAMETER;
5839 int ret = CAMERA_ERROR_NONE;
5840 camera_cli_s *pc = (camera_cli_s *)camera;
5841 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_STREAM_FLIP;
5843 if (pc->cb_info == NULL) {
5844 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5845 return CAMERA_ERROR_INVALID_PARAMETER;
5847 sock_fd = pc->cb_info->fd;
5848 int set_flip = (int)flip;
5850 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5851 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_flip);
5852 LOGD("ret : 0x%x", ret);
5857 int camera_attr_get_stream_flip(camera_h camera , camera_flip_e *flip)
5859 if (camera == NULL || flip == NULL) {
5860 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5861 return CAMERA_ERROR_INVALID_PARAMETER;
5864 int ret = CAMERA_ERROR_NONE;
5865 camera_cli_s *pc = (camera_cli_s *)camera;
5866 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_STREAM_FLIP;
5868 if (pc->cb_info == NULL) {
5869 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5870 return CAMERA_ERROR_INVALID_PARAMETER;
5872 sock_fd = pc->cb_info->fd;
5875 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5876 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5878 if (ret == CAMERA_ERROR_NONE) {
5879 muse_camera_msg_get(get_flip, pc->cb_info->recv_msg);
5880 *flip = (camera_flip_e)get_flip;
5882 LOGD("ret : 0x%x", ret);
5886 int camera_attr_set_hdr_mode(camera_h camera, camera_attr_hdr_mode_e mode)
5888 if (camera == NULL) {
5889 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5890 return CAMERA_ERROR_INVALID_PARAMETER;
5893 int ret = CAMERA_ERROR_NONE;
5894 camera_cli_s *pc = (camera_cli_s *)camera;
5895 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_HDR_MODE;
5897 if (pc->cb_info == NULL) {
5898 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5899 return CAMERA_ERROR_INVALID_PARAMETER;
5901 sock_fd = pc->cb_info->fd;
5902 int set_mode = (int)mode;
5904 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5905 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
5906 LOGD("ret : 0x%x", ret);
5911 int camera_attr_get_hdr_mode(camera_h camera, camera_attr_hdr_mode_e *mode)
5913 if (camera == NULL) {
5914 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5915 return CAMERA_ERROR_INVALID_PARAMETER;
5918 LOGE("INVALID_PARAMETER(0x%08x) - mode", CAMERA_ERROR_INVALID_PARAMETER);
5919 return CAMERA_ERROR_INVALID_PARAMETER;
5921 int ret = CAMERA_ERROR_NONE;
5922 camera_cli_s *pc = (camera_cli_s *)camera;
5923 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_HDR_MODE;
5925 if (pc->cb_info == NULL) {
5926 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5927 return CAMERA_ERROR_INVALID_PARAMETER;
5929 sock_fd = pc->cb_info->fd;
5932 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5933 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5935 if (ret == CAMERA_ERROR_NONE) {
5936 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
5937 *mode = (camera_attr_hdr_mode_e)get_mode;
5939 LOGD("ret : 0x%x", ret);
5944 bool camera_attr_is_supported_hdr_capture(camera_h camera)
5946 if (camera == NULL) {
5947 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5951 int ret = CAMERA_ERROR_NONE;
5952 camera_cli_s *pc = (camera_cli_s *)camera;
5953 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_HDR_CAPTURE;
5955 if (pc->cb_info == NULL) {
5956 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5957 return CAMERA_ERROR_INVALID_PARAMETER;
5959 sock_fd = pc->cb_info->fd;
5960 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5961 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5962 LOGD("ret : 0x%x", ret);
5967 int camera_attr_set_hdr_capture_progress_cb(camera_h camera, camera_attr_hdr_progress_cb callback, void *user_data)
5969 int ret = CAMERA_ERROR_NONE;
5970 camera_cli_s *pc = (camera_cli_s *)camera;
5971 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_HDR_CAPTURE_PROGRESS_CB;
5974 if (camera == NULL) {
5975 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5976 return CAMERA_ERROR_INVALID_PARAMETER;
5979 if (pc->cb_info == NULL) {
5980 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5981 return CAMERA_ERROR_INVALID_PARAMETER;
5984 sock_fd = pc->cb_info->fd;
5986 LOGD("Enter, handle :%x", pc->remote_handle);
5988 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5990 if (ret == CAMERA_ERROR_NONE) {
5991 if (callback == NULL) {
5992 LOGE("INVALID_PARAMETER(0x%08x) - callback", CAMERA_ERROR_INVALID_PARAMETER);
5993 return CAMERA_ERROR_INVALID_PARAMETER;
5996 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = callback;
5997 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = user_data;
6000 LOGD("ret : 0x%x", ret);
6006 int camera_attr_unset_hdr_capture_progress_cb(camera_h camera)
6008 if (camera == NULL) {
6009 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6010 return CAMERA_ERROR_INVALID_PARAMETER;
6013 int ret = CAMERA_ERROR_NONE;
6015 camera_cli_s *pc = (camera_cli_s *)camera;
6016 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_UNSET_HDR_CAPTURE_PROGRESS_CB;
6018 if (pc->cb_info == NULL) {
6019 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6020 return CAMERA_ERROR_INVALID_PARAMETER;
6022 sock_fd = pc->cb_info->fd;
6023 LOGD("Enter, handle :%x", pc->remote_handle);
6025 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = (void *)NULL;
6026 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = (void *)NULL;
6028 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6029 LOGD("ret : 0x%x", ret);
6034 int camera_attr_enable_anti_shake(camera_h camera, bool enable)
6036 if (camera == NULL) {
6037 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6038 return CAMERA_ERROR_INVALID_PARAMETER;
6041 int ret = CAMERA_ERROR_NONE;
6042 camera_cli_s *pc = (camera_cli_s *)camera;
6043 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_ANTI_SHAKE;
6045 if (pc->cb_info == NULL) {
6046 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6047 return CAMERA_ERROR_INVALID_PARAMETER;
6049 sock_fd = pc->cb_info->fd;
6050 int set_enable = (int)enable;
6052 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6053 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
6054 LOGD("ret : 0x%x", ret);
6059 int camera_attr_is_enabled_anti_shake(camera_h camera , bool *enabled)
6061 if (camera == NULL) {
6062 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
6063 return CAMERA_ERROR_INVALID_PARAMETER;
6065 if (enabled == NULL) {
6066 LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER);
6067 return CAMERA_ERROR_INVALID_PARAMETER;
6069 int ret = CAMERA_ERROR_NONE;
6070 camera_cli_s *pc = (camera_cli_s *)camera;
6071 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_ANTI_SHAKE;
6073 if (pc->cb_info == NULL) {
6074 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6075 return CAMERA_ERROR_INVALID_PARAMETER;
6077 sock_fd = pc->cb_info->fd;
6080 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6081 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6083 if (ret == CAMERA_ERROR_NONE) {
6084 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
6085 *enabled = (bool)get_enabled;
6087 LOGD("ret : 0x%x", ret);
6092 bool camera_attr_is_supported_anti_shake(camera_h camera)
6095 if (camera == NULL) {
6096 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6100 int ret = CAMERA_ERROR_NONE;
6101 camera_cli_s *pc = (camera_cli_s *)camera;
6102 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_ANTI_SHAKE;
6104 if (pc->cb_info == NULL) {
6105 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6106 return CAMERA_ERROR_INVALID_PARAMETER;
6108 sock_fd = pc->cb_info->fd;
6109 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6110 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6111 LOGD("ret : 0x%x", ret);
6116 int camera_attr_enable_video_stabilization(camera_h camera, bool enable)
6118 if (camera == NULL) {
6119 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6120 return CAMERA_ERROR_INVALID_PARAMETER;
6123 int ret = CAMERA_ERROR_NONE;
6124 camera_cli_s *pc = (camera_cli_s *)camera;
6125 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_VIDEO_STABILIZATION;
6127 if (pc->cb_info == NULL) {
6128 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6129 return CAMERA_ERROR_INVALID_PARAMETER;
6131 sock_fd = pc->cb_info->fd;
6132 int set_enable = (int)enable;
6134 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6135 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
6136 LOGD("ret : 0x%x", ret);
6141 int camera_attr_is_enabled_video_stabilization(camera_h camera, bool *enabled)
6143 if (camera == NULL) {
6144 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
6145 return CAMERA_ERROR_INVALID_PARAMETER;
6147 if (enabled == NULL) {
6148 LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER);
6149 return CAMERA_ERROR_INVALID_PARAMETER;
6151 int ret = CAMERA_ERROR_NONE;
6152 camera_cli_s *pc = (camera_cli_s *)camera;
6153 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_VIDEO_STABILIZATION;
6155 if (pc->cb_info == NULL) {
6156 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6157 return CAMERA_ERROR_INVALID_PARAMETER;
6159 sock_fd = pc->cb_info->fd;
6162 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6163 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6165 if (ret == CAMERA_ERROR_NONE) {
6166 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
6167 *enabled = (bool)get_enabled;
6169 LOGD("ret : 0x%x", ret);
6174 bool camera_attr_is_supported_video_stabilization(camera_h camera)
6176 if (camera == NULL) {
6177 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6181 int ret = CAMERA_ERROR_NONE;
6182 camera_cli_s *pc = (camera_cli_s *)camera;
6183 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_VIDEO_STABILIZATION;
6185 if (pc->cb_info == NULL) {
6186 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6187 return CAMERA_ERROR_INVALID_PARAMETER;
6189 sock_fd = pc->cb_info->fd;
6190 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6191 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6192 LOGD("ret : 0x%x", ret);
6197 int camera_attr_enable_auto_contrast(camera_h camera, bool enable)
6199 if (camera == NULL) {
6200 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6201 return CAMERA_ERROR_INVALID_PARAMETER;
6204 int ret = CAMERA_ERROR_NONE;
6205 camera_cli_s *pc = (camera_cli_s *)camera;
6206 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_AUTO_CONTRAST;
6208 if (pc->cb_info == NULL) {
6209 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6210 return CAMERA_ERROR_INVALID_PARAMETER;
6212 sock_fd = pc->cb_info->fd;
6213 int set_enable = (int)enable;
6215 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6216 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
6217 LOGD("ret : 0x%x", ret);
6222 int camera_attr_is_enabled_auto_contrast(camera_h camera, bool *enabled)
6224 if (camera == NULL) {
6225 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
6226 return CAMERA_ERROR_INVALID_PARAMETER;
6228 if (enabled == NULL) {
6229 LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER);
6230 return CAMERA_ERROR_INVALID_PARAMETER;
6232 int ret = CAMERA_ERROR_NONE;
6233 camera_cli_s *pc = (camera_cli_s *)camera;
6234 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_AUTO_CONTRAST;
6236 if (pc->cb_info == NULL) {
6237 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6238 return CAMERA_ERROR_INVALID_PARAMETER;
6240 sock_fd = pc->cb_info->fd;
6243 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6244 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6246 if (ret == CAMERA_ERROR_NONE) {
6247 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
6248 *enabled = (bool)get_enabled;
6250 LOGD("ret : 0x%x", ret);
6255 bool camera_attr_is_supported_auto_contrast(camera_h camera)
6257 if (camera == NULL) {
6258 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6262 int ret = CAMERA_ERROR_NONE;
6263 camera_cli_s *pc = (camera_cli_s *)camera;
6264 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_AUTO_CONTRAST;
6266 if (pc->cb_info == NULL) {
6267 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6268 return CAMERA_ERROR_INVALID_PARAMETER;
6270 sock_fd = pc->cb_info->fd;
6271 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6272 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6273 LOGD("ret : 0x%x", ret);
6278 int camera_attr_disable_shutter_sound(camera_h camera, bool disable)
6280 if (camera == NULL) {
6281 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6282 return CAMERA_ERROR_INVALID_PARAMETER;
6285 int ret = CAMERA_ERROR_NONE;
6286 camera_cli_s *pc = (camera_cli_s *)camera;
6287 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_DISABLE_SHUTTER_SOUND;
6289 if (pc->cb_info == NULL) {
6290 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6291 return CAMERA_ERROR_INVALID_PARAMETER;
6293 sock_fd = pc->cb_info->fd;
6294 int set_disable = (int)disable;
6296 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6297 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_disable);
6298 LOGD("ret : 0x%x", ret);
6303 int camera_attr_set_pan(camera_h camera, camera_attr_ptz_move_type_e move_type, int pan_step)
6305 if (camera == 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;
6318 int set_move_type = (int)move_type;
6319 int set_pan_step = pan_step;
6320 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_PAN;
6322 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6323 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, set_move_type, INT, set_pan_step);
6324 LOGD("ret : 0x%x", ret);
6329 int camera_attr_get_pan(camera_h camera, int *pan_step)
6331 if (camera == NULL || pan_step == NULL) {
6332 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6333 return CAMERA_ERROR_INVALID_PARAMETER;
6336 camera_cli_s *pc = (camera_cli_s *)camera;
6337 if (pc->cb_info == NULL) {
6338 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6339 return CAMERA_ERROR_INVALID_PARAMETER;
6342 int ret = CAMERA_ERROR_NONE;
6343 int sock_fd = pc->cb_info->fd;
6345 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_PAN;
6347 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6348 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6350 if (ret == CAMERA_ERROR_NONE) {
6351 muse_camera_msg_get(get_pan_step, pc->cb_info->recv_msg);
6352 *pan_step = get_pan_step;
6354 LOGD("ret : 0x%x", ret);
6359 int camera_attr_get_pan_range(camera_h camera, int *min, int *max)
6361 if (camera == NULL || min == NULL || max == NULL) {
6362 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6363 return CAMERA_ERROR_INVALID_PARAMETER;
6366 camera_cli_s *pc = (camera_cli_s *)camera;
6367 if (pc->cb_info == NULL) {
6368 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6369 return CAMERA_ERROR_INVALID_PARAMETER;
6372 int ret = CAMERA_ERROR_NONE;
6373 int sock_fd = pc->cb_info->fd;
6376 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_PAN_RANGE;
6378 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6379 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6381 if (ret == CAMERA_ERROR_NONE) {
6382 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
6383 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
6387 LOGD("ret : 0x%x", ret);
6392 int camera_attr_set_tilt(camera_h camera, camera_attr_ptz_move_type_e move_type, int tilt_step)
6394 if (camera == NULL) {
6395 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6396 return CAMERA_ERROR_INVALID_PARAMETER;
6399 camera_cli_s *pc = (camera_cli_s *)camera;
6400 if (pc->cb_info == NULL) {
6401 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6402 return CAMERA_ERROR_INVALID_PARAMETER;
6405 int ret = CAMERA_ERROR_NONE;
6406 int sock_fd = pc->cb_info->fd;
6407 int set_move_type = (int)move_type;
6408 int set_tilt_step = tilt_step;
6409 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TILT;
6411 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6412 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, set_move_type, INT, set_tilt_step);
6413 LOGD("ret : 0x%x", ret);
6418 int camera_attr_get_tilt(camera_h camera, int *tilt_step)
6420 if (camera == NULL || tilt_step == NULL) {
6421 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6422 return CAMERA_ERROR_INVALID_PARAMETER;
6425 camera_cli_s *pc = (camera_cli_s *)camera;
6426 if (pc->cb_info == NULL) {
6427 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6428 return CAMERA_ERROR_INVALID_PARAMETER;
6431 int ret = CAMERA_ERROR_NONE;
6432 int sock_fd = pc->cb_info->fd;
6434 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TILT;
6436 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6437 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6439 if (ret == CAMERA_ERROR_NONE) {
6440 muse_camera_msg_get(get_tilt_step, pc->cb_info->recv_msg);
6441 *tilt_step = get_tilt_step;
6443 LOGD("ret : 0x%x", ret);
6448 int camera_attr_get_tilt_range(camera_h camera, int *min, int *max)
6450 if (camera == NULL || min == NULL || max == NULL) {
6451 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6452 return CAMERA_ERROR_INVALID_PARAMETER;
6455 camera_cli_s *pc = (camera_cli_s *)camera;
6456 if (pc->cb_info == NULL) {
6457 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6458 return CAMERA_ERROR_INVALID_PARAMETER;
6461 int ret = CAMERA_ERROR_NONE;
6462 int sock_fd = pc->cb_info->fd;
6465 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TILT_RANGE;
6467 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6468 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6470 if (ret == CAMERA_ERROR_NONE) {
6471 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
6472 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
6476 LOGD("ret : 0x%x", ret);
6481 int camera_attr_set_ptz_type(camera_h camera, camera_attr_ptz_type_e ptz_type)
6483 if (camera == NULL) {
6484 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6485 return CAMERA_ERROR_INVALID_PARAMETER;
6488 camera_cli_s *pc = (camera_cli_s *)camera;
6489 if (pc->cb_info == NULL) {
6490 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6491 return CAMERA_ERROR_INVALID_PARAMETER;
6494 int ret = CAMERA_ERROR_NONE;
6495 int sock_fd = pc->cb_info->fd;
6496 int set_ptz_type = (int)ptz_type;
6497 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_PTZ_TYPE;
6499 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6500 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_ptz_type);
6501 LOGD("ret : 0x%x", ret);
6506 int camera_attr_foreach_supported_ptz_type(camera_h camera, camera_attr_supported_ptz_type_cb foreach_cb, void *user_data)
6508 if (camera == NULL || foreach_cb == NULL) {
6509 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6510 return CAMERA_ERROR_INVALID_PARAMETER;
6512 int ret = CAMERA_ERROR_NONE;
6514 camera_cli_s *pc = (camera_cli_s *)camera;
6515 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_PTZ_TYPE;
6517 if (pc->cb_info == NULL) {
6518 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6519 return CAMERA_ERROR_INVALID_PARAMETER;
6521 sock_fd = pc->cb_info->fd;
6522 LOGD("Enter, handle :%x", pc->remote_handle);
6523 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PTZ_TYPE] = foreach_cb;
6524 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PTZ_TYPE] = user_data;
6526 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6527 LOGD("ret : 0x%x", ret);
6532 int camera_attr_set_display_roi_area(camera_h camera, int x, int y, int width, int height)
6534 if (camera == NULL) {
6535 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6536 return CAMERA_ERROR_INVALID_PARAMETER;
6539 camera_cli_s *pc = (camera_cli_s *)camera;
6540 if (pc->cb_info == NULL) {
6541 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6542 return CAMERA_ERROR_INVALID_PARAMETER;
6545 int ret = CAMERA_ERROR_NONE;
6546 int sock_fd = pc->cb_info->fd;
6547 int set_display_roi_area[4] = {x, y, width, height};
6548 muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY_ROI_AREA;
6550 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6552 #ifdef TIZEN_FEATURE_EVAS_RENDERER
6553 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
6554 g_mutex_lock(&pc->cb_info->evas_mutex);
6556 ret = mm_evas_renderer_set_roi_area(pc->cb_info->evas_info, x, y, width, height);
6558 g_mutex_unlock(&pc->cb_info->evas_mutex);
6560 if (ret != MM_ERROR_NONE) {
6561 LOGE("mm_evas_renderer_set_roi_area error 0x%x", ret);
6562 return CAMERA_ERROR_INVALID_OPERATION;
6565 #endif /* TIZEN_FEATURE_EVAS_RENDERER */
6567 muse_camera_msg_send_array(api, sock_fd, pc->cb_info, ret,
6568 set_display_roi_area, sizeof(set_display_roi_area), sizeof(int));
6570 LOGD("ret : 0x%x", ret);
6576 int camera_attr_get_display_roi_area(camera_h camera, int *x, int *y, int *width, int *height)
6578 if (camera == NULL || x == NULL || y == NULL || width == NULL || height == NULL) {
6579 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6580 return CAMERA_ERROR_INVALID_PARAMETER;
6583 camera_cli_s *pc = (camera_cli_s *)camera;
6584 if (pc->cb_info == NULL) {
6585 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6586 return CAMERA_ERROR_INVALID_PARAMETER;
6589 int ret = CAMERA_ERROR_NONE;
6590 int sock_fd = pc->cb_info->fd;
6591 int get_display_roi_area[4] = {0,};
6592 muse_camera_api_e api = MUSE_CAMERA_API_GET_DISPLAY_ROI_AREA;
6594 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6596 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6598 if (ret == CAMERA_ERROR_NONE) {
6599 muse_camera_msg_get_array(get_display_roi_area, pc->cb_info->recv_msg);
6601 *x = get_display_roi_area[0];
6602 *y = get_display_roi_area[1];
6603 *width = get_display_roi_area[2];
6604 *height = get_display_roi_area[3];
6606 LOGD("ret : 0x%x", ret);
6608 LOGE("Returned value is not valid : 0x%x", ret);