2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
24 #include <muse_camera.h>
25 #include <muse_camera_msg.h>
26 #include <muse_core_ipc.h>
27 #include <muse_core_module.h>
28 #include <camera_private.h>
29 #include <muse_core.h>
31 #include <Elementary.h>
32 #include <tbm_surface_internal.h>
35 #include <Ecore_Wayland.h>
36 #include <wayland-client.h>
37 #include <tizen-extension-client-protocol.h>
41 #include <mm_evas_renderer.h>
46 #define LOG_TAG "TIZEN_N_CAMERA"
50 static void __global(void *data, struct wl_registry *registry,
51 uint32_t name, const char *interface, uint32_t version)
53 struct tizen_surface **tz_surface = NULL;
60 tz_surface = (struct tizen_surface **)data;
63 LOGW("NULL interface");
67 LOGI("interface %s", interface);
69 if (strcmp(interface, "tizen_surface") == 0) {
70 LOGD("binding tizen surface for wayland");
72 *tz_surface = wl_registry_bind(registry, name, &tizen_surface_interface, version);
73 if (*tz_surface == NULL)
74 LOGE("failed to bind");
82 static void __global_remove(void *data, struct wl_registry *wl_registry, uint32_t name)
88 static const struct wl_registry_listener _camera_wl_registry_listener = {
93 void __parent_id_getter(void *data, struct tizen_resource *tizen_resource, uint32_t id)
100 *((unsigned int *)data) = id;
102 LOGD("[CLIENT] got parent_id [%u] from server", id);
107 static const struct tizen_resource_listener _camera_tz_resource_listener = {
111 int _get_wl_info(Evas_Object *obj, camera_wl_info_s *wl_info)
113 int ret = CAMERA_ERROR_NONE;
114 Ecore_Wl_Window *window = NULL;
115 struct wl_display *display = NULL;
116 struct wl_surface *surface = NULL;
117 struct wl_registry *registry = NULL;
118 struct tizen_surface *tz_surface = NULL;
119 struct tizen_resource *tz_resource = NULL;
121 if (!obj || !wl_info) {
122 LOGE("NULL parameter %p %p", obj, wl_info);
123 return CAMERA_ERROR_INVALID_OPERATION;
126 window = elm_win_wl_window_get(obj);
128 LOGE("failed to get wayland window");
129 ret = CAMERA_ERROR_INVALID_OPERATION;
133 surface = (struct wl_surface *)ecore_wl_window_surface_get(window);
135 LOGE("failed to get wayland surface");
136 ret = CAMERA_ERROR_INVALID_OPERATION;
140 display = (struct wl_display *)ecore_wl_display_get();
142 LOGE("failed to get wayland display");
143 ret = CAMERA_ERROR_INVALID_OPERATION;
147 registry = wl_display_get_registry(display);
149 LOGE("failed to get wayland registry");
150 ret = CAMERA_ERROR_INVALID_OPERATION;
154 wl_registry_add_listener(registry, &_camera_wl_registry_listener, &tz_surface);
156 wl_display_dispatch(display);
157 wl_display_roundtrip(display);
160 LOGE("failed to get tizen surface");
161 ret = CAMERA_ERROR_INVALID_OPERATION;
165 /* Get parent_id which is unique in a entire systemw. */
166 tz_resource = tizen_surface_get_tizen_resource(tz_surface, surface);
168 LOGE("failed to get tizen resurce");
169 ret = CAMERA_ERROR_INVALID_OPERATION;
173 wl_info->parent_id = 0;
175 tizen_resource_add_listener(tz_resource, &_camera_tz_resource_listener, &wl_info->parent_id);
177 wl_display_roundtrip(display);
179 if (wl_info->parent_id > 0) {
181 Ecore_Evas *ecore_evas = NULL;
182 ret = CAMERA_ERROR_NONE;
184 wl_info->evas_obj = obj;
186 evas_object_geometry_get(obj, &wl_info->window_x, &wl_info->window_y,
187 &wl_info->window_width, &wl_info->window_height);
189 ecore_evas = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
191 rotation = ecore_evas_rotation_get(ecore_evas);
192 if (rotation == 90 || rotation == 270) {
193 int temp = wl_info->window_width;
195 LOGD("swap width and height %d, %d", wl_info->window_width, wl_info->window_height);
197 wl_info->window_width = wl_info->window_height;
198 wl_info->window_height = temp;
201 LOGW("failed to get ecore_evas.. skip rotation check");
204 LOGD("evas object : %p, rotation : %d, parent id : %u, window : %d,%d,%dx%d",
205 wl_info->evas_obj, rotation, wl_info->parent_id,
206 wl_info->window_x, wl_info->window_y,
207 wl_info->window_width, wl_info->window_height);
209 ret = CAMERA_ERROR_INVALID_OPERATION;
210 LOGE("failed to get parent id");
215 tizen_surface_destroy(tz_surface);
220 tizen_resource_destroy(tz_resource);
225 wl_registry_destroy(registry);
231 #endif /* HAVE_WAYLAND */
233 static int _import_tbm_key(tbm_bufmgr bufmgr, unsigned int tbm_key, tbm_bo *bo, tbm_bo_handle *bo_handle)
235 tbm_bo tmp_bo = NULL;
236 tbm_bo_handle tmp_bo_handle = {NULL, };
238 if (bufmgr == NULL || bo == NULL || bo_handle == NULL || tbm_key == 0) {
239 LOGE("invalid parameter - bufmgr %p, bo %p, bo_handle %p, key %d",
240 bufmgr, bo, bo_handle, tbm_key);
244 tmp_bo = tbm_bo_import(bufmgr, tbm_key);
245 if (tmp_bo == NULL) {
246 LOGE("bo import failed - bufmgr %p, key %d", bufmgr, tbm_key);
250 tmp_bo_handle = tbm_bo_map(tmp_bo, TBM_DEVICE_CPU, TBM_OPTION_READ);
251 if (tmp_bo_handle.ptr == NULL) {
252 LOGE("bo map failed %p", tmp_bo);
253 tbm_bo_unref(tmp_bo);
258 tbm_bo_unmap(tmp_bo);
260 /* set bo and bo_handle */
262 *bo_handle = tmp_bo_handle;
267 static void _release_imported_bo(tbm_bo *bo)
269 if (bo == NULL || *bo == NULL) {
280 static int _client_wait_for_cb_return(muse_camera_api_e api, camera_cb_info_s *cb_info, int time_out)
282 int ret = CAMERA_ERROR_NONE;
285 LOGD("Enter api : %d", api);
287 g_mutex_lock(&(cb_info->api_mutex[api]));
289 if (cb_info->api_activating[api] == 0) {
290 end_time = g_get_monotonic_time() + time_out * G_TIME_SPAN_SECOND;
291 if (g_cond_wait_until(&(cb_info->api_cond[api]), &(cb_info->api_mutex[api]), end_time)) {
292 ret = cb_info->api_ret[api];
293 cb_info->api_activating[api] = 0;
295 LOGD("return value : 0x%x", ret);
297 ret = CAMERA_ERROR_INVALID_OPERATION;
299 LOGE("api %d was TIMED OUT!", api);
302 ret = cb_info->api_ret[api];
303 cb_info->api_activating[api] = 0;
305 LOGD("condition is already checked for the api[%d], return[0x%x]", api, ret);
308 g_mutex_unlock(&(cb_info->api_mutex[api]));
313 int _camera_get_tbm_surface_format(int in_format, uint32_t *out_format)
315 if (in_format <= MM_PIXEL_FORMAT_INVALID ||
316 in_format >= MM_PIXEL_FORMAT_NUM ||
317 out_format == NULL) {
318 LOGE("INVALID_PARAMETER : in_format %d, out_format ptr %p", in_format, out_format);
319 return CAMERA_ERROR_INVALID_PARAMETER;
323 case MM_PIXEL_FORMAT_NV12:
324 case MM_PIXEL_FORMAT_NV12T:
325 *out_format = TBM_FORMAT_NV12;
327 case MM_PIXEL_FORMAT_NV16:
328 *out_format = TBM_FORMAT_NV16;
330 case MM_PIXEL_FORMAT_NV21:
331 *out_format = TBM_FORMAT_NV21;
333 case MM_PIXEL_FORMAT_YUYV:
334 *out_format = TBM_FORMAT_YUYV;
336 case MM_PIXEL_FORMAT_UYVY:
337 case MM_PIXEL_FORMAT_ITLV_JPEG_UYVY:
338 *out_format = TBM_FORMAT_UYVY;
340 case MM_PIXEL_FORMAT_422P:
341 *out_format = TBM_FORMAT_YUV422;
343 case MM_PIXEL_FORMAT_I420:
344 *out_format = TBM_FORMAT_YUV420;
346 case MM_PIXEL_FORMAT_YV12:
347 *out_format = TBM_FORMAT_YVU420;
349 case MM_PIXEL_FORMAT_RGB565:
350 *out_format = TBM_FORMAT_RGB565;
352 case MM_PIXEL_FORMAT_RGB888:
353 *out_format = TBM_FORMAT_RGB888;
355 case MM_PIXEL_FORMAT_RGBA:
356 *out_format = TBM_FORMAT_RGBA8888;
358 case MM_PIXEL_FORMAT_ARGB:
359 *out_format = TBM_FORMAT_ARGB8888;
362 LOGE("invalid in_format %d", in_format);
363 return CAMERA_ERROR_INVALID_PARAMETER;
366 return CAMERA_ERROR_NONE;
370 int _camera_get_media_packet_mimetype(int in_format, media_format_mimetype_e *mimetype)
372 if (in_format <= MM_PIXEL_FORMAT_INVALID ||
373 in_format >= MM_PIXEL_FORMAT_NUM ||
375 LOGE("INVALID_PARAMETER : in_format %d, mimetype ptr %p", in_format, mimetype);
376 return CAMERA_ERROR_INVALID_PARAMETER;
380 case MM_PIXEL_FORMAT_NV12:
381 case MM_PIXEL_FORMAT_NV12T:
382 *mimetype = MEDIA_FORMAT_NV12;
384 case MM_PIXEL_FORMAT_NV16:
385 *mimetype = MEDIA_FORMAT_NV16;
387 case MM_PIXEL_FORMAT_NV21:
388 *mimetype = MEDIA_FORMAT_NV21;
390 case MM_PIXEL_FORMAT_YUYV:
391 *mimetype = MEDIA_FORMAT_YUYV;
393 case MM_PIXEL_FORMAT_UYVY:
394 case MM_PIXEL_FORMAT_ITLV_JPEG_UYVY:
395 *mimetype = MEDIA_FORMAT_UYVY;
397 case MM_PIXEL_FORMAT_422P:
398 *mimetype = MEDIA_FORMAT_422P;
400 case MM_PIXEL_FORMAT_I420:
401 *mimetype = MEDIA_FORMAT_I420;
403 case MM_PIXEL_FORMAT_YV12:
404 *mimetype = MEDIA_FORMAT_YV12;
406 case MM_PIXEL_FORMAT_RGB565:
407 *mimetype = MEDIA_FORMAT_RGB565;
409 case MM_PIXEL_FORMAT_RGB888:
410 *mimetype = MEDIA_FORMAT_RGB888;
412 case MM_PIXEL_FORMAT_RGBA:
413 *mimetype = MEDIA_FORMAT_RGBA;
415 case MM_PIXEL_FORMAT_ARGB:
416 *mimetype = MEDIA_FORMAT_ARGB;
419 LOGE("invalid in_format %d", in_format);
420 return CAMERA_ERROR_INVALID_PARAMETER;
423 return CAMERA_ERROR_NONE;
426 void _camera_preview_frame_create(camera_stream_data_s *stream, int num_buffer_key,
427 tbm_bo_handle *buffer_bo_handle, tbm_bo_handle *data_bo_handle, camera_preview_data_s *frame)
430 unsigned char *buf_pos = NULL;
432 if (stream == NULL || buffer_bo_handle == NULL || frame == NULL) {
433 LOGE("invalid parameter - stream:%p, buffer_bo_handle:%p", stream, buffer_bo_handle);
438 if (stream->format == MM_PIXEL_FORMAT_ITLV_JPEG_UYVY)
439 frame->format = MM_PIXEL_FORMAT_UYVY;
441 frame->format = stream->format;
443 frame->width = stream->width;
444 frame->height = stream->height;
445 frame->timestamp = stream->timestamp;
446 frame->num_of_planes = stream->num_planes;
448 if (num_buffer_key == 0) {
450 if (data_bo_handle == NULL || data_bo_handle->ptr == NULL) {
451 LOGE("no data pointer");
455 buf_pos = data_bo_handle->ptr;
457 if (stream->format == MM_PIXEL_FORMAT_ENCODED_H264) {
458 frame->data.encoded_plane.data = buf_pos;
459 frame->data.encoded_plane.size = stream->data.encoded.length_data;
460 total_size = stream->data.encoded.length_data;
462 switch (stream->num_planes) {
464 frame->data.single_plane.yuv = buf_pos;
465 frame->data.single_plane.size = stream->data.yuv420.length_yuv;
466 total_size = stream->data.yuv420.length_yuv;
469 frame->data.double_plane.y = buf_pos;
470 frame->data.double_plane.y_size = stream->data.yuv420sp.length_y;
471 buf_pos += stream->data.yuv420sp.length_y;
472 frame->data.double_plane.uv = buf_pos;
473 frame->data.double_plane.uv_size = stream->data.yuv420sp.length_uv;
474 total_size = stream->data.yuv420sp.length_y + \
475 stream->data.yuv420sp.length_uv;
478 frame->data.triple_plane.y = buf_pos;
479 frame->data.triple_plane.y_size = stream->data.yuv420p.length_y;
480 buf_pos += stream->data.yuv420p.length_y;
481 frame->data.triple_plane.u = buf_pos;
482 frame->data.triple_plane.u_size = stream->data.yuv420p.length_u;
483 buf_pos += stream->data.yuv420p.length_u;
484 frame->data.triple_plane.v = buf_pos;
485 frame->data.triple_plane.v_size = stream->data.yuv420p.length_v;
486 total_size = stream->data.yuv420p.length_y + \
487 stream->data.yuv420p.length_u + \
488 stream->data.yuv420p.length_v;
496 switch (stream->num_planes) {
498 frame->data.single_plane.yuv = buffer_bo_handle[0].ptr;
499 frame->data.single_plane.size = stream->data.yuv420.length_yuv;
500 total_size = stream->data.yuv420.length_yuv;
503 frame->data.double_plane.y = buffer_bo_handle[0].ptr;
504 if (stream->num_planes == (unsigned int)num_buffer_key)
505 frame->data.double_plane.uv = buffer_bo_handle[1].ptr;
507 frame->data.double_plane.uv = buffer_bo_handle[0].ptr + stream->data.yuv420sp.length_y;
508 frame->data.double_plane.y_size = stream->data.yuv420sp.length_y;
509 frame->data.double_plane.uv_size = stream->data.yuv420sp.length_uv;
510 total_size = stream->data.yuv420sp.length_y + \
511 stream->data.yuv420sp.length_uv;
514 frame->data.triple_plane.y = buffer_bo_handle[0].ptr;
515 if (stream->num_planes == (unsigned int)num_buffer_key) {
516 frame->data.triple_plane.u = buffer_bo_handle[1].ptr;
517 frame->data.triple_plane.v = buffer_bo_handle[2].ptr;
519 frame->data.triple_plane.u = buffer_bo_handle[0].ptr + stream->data.yuv420p.length_y;
520 frame->data.triple_plane.v = buffer_bo_handle[1].ptr + stream->data.yuv420p.length_u;
522 frame->data.triple_plane.y_size = stream->data.yuv420p.length_y;
523 frame->data.triple_plane.u_size = stream->data.yuv420p.length_u;
524 frame->data.triple_plane.v_size = stream->data.yuv420p.length_v;
525 total_size = stream->data.yuv420p.length_y + \
526 stream->data.yuv420p.length_u + \
527 stream->data.yuv420p.length_v;
535 LOGD("format %d, %dx%d, size %d plane num %d",
536 frame.format, frame.width, frame.height, total_size, frame.num_of_planes);
542 int _camera_media_packet_data_create(int tbm_key, int num_buffer_key, tbm_bo bo,
543 tbm_bo *buffer_bo, tbm_bo data_bo, camera_media_packet_data **mp_data)
546 int ret = CAMERA_ERROR_NONE;
547 camera_media_packet_data *tmp_mp_data = NULL;
549 if (*mp_data == NULL) {
550 tmp_mp_data = g_new0(camera_media_packet_data, 1);
552 tmp_mp_data->tbm_key = tbm_key;
553 tmp_mp_data->num_buffer_key = num_buffer_key;
554 tmp_mp_data->bo = bo;
555 tmp_mp_data->data_bo = data_bo;
556 tmp_mp_data->ref_cnt++;
558 for (i = 0 ; i < num_buffer_key ; i++)
559 tmp_mp_data->buffer_bo[i] = buffer_bo[i];
561 *mp_data = tmp_mp_data;
562 /*LOGD("mp_data %p", tmp_mp_data);*/
564 ret = CAMERA_ERROR_OUT_OF_MEMORY;
565 LOGE("failed to alloc media packet data");
568 ((camera_media_packet_data *)*mp_data)->ref_cnt++;
574 void _camera_media_packet_data_release(camera_media_packet_data *mp_data, camera_cb_info_s *cb_info)
579 if (mp_data == NULL || cb_info == NULL) {
580 LOGE("NULL data %p or cb_info %p", mp_data, cb_info);
584 if (mp_data->ref_cnt > 1) {
586 LOGD("mp_data is still referenced(current %d)", mp_data->ref_cnt);
588 /* release imported bo */
589 for (i = 0 ; i < mp_data->num_buffer_key ; i++) {
590 tbm_bo_unref(mp_data->buffer_bo[i]);
591 mp_data->buffer_bo[i] = NULL;
595 _release_imported_bo(&mp_data->bo);
596 _release_imported_bo(&mp_data->data_bo);
599 tbm_key = mp_data->tbm_key;
600 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
601 cb_info->fd, cb_info, INT, tbm_key);
610 int _camera_media_packet_create(camera_cb_info_s *cb_info, camera_stream_data_s *stream,
611 camera_media_packet_data *mp_data, media_packet_h *packet)
613 media_packet_h pkt = NULL;
614 bool make_pkt_fmt = false;
615 tbm_surface_h tsurf = NULL;
616 tbm_surface_info_s tsurf_info;
617 media_format_mimetype_e mimetype = MEDIA_FORMAT_NV12;
618 uint32_t bo_format = 0;
621 int num_buffer_key = 0;
622 tbm_bo *buffer_bo = NULL;
624 if (cb_info == NULL || stream == NULL || mp_data == NULL || packet == NULL) {
625 LOGE("invalid parameter - cb_info:%p, stream:%p, mp_data:%p, packet:%p",
626 cb_info, stream, mp_data, packet);
627 return CAMERA_ERROR_INVALID_PARAMETER;
630 memset(&tsurf_info, 0x0, sizeof(tbm_surface_info_s));
631 buffer_bo = mp_data->buffer_bo;
632 num_buffer_key = mp_data->num_buffer_key;
634 /* create tbm surface */
635 for (i = 0 ; i < BUFFER_MAX_PLANE_NUM ; i++)
636 tsurf_info.planes[i].stride = stream->stride[i];
638 /* get tbm surface format */
639 ret = _camera_get_tbm_surface_format(stream->format, &bo_format);
640 ret |= _camera_get_media_packet_mimetype(stream->format, &mimetype);
642 if (ret == CAMERA_ERROR_NONE) {
643 tsurf_info.width = stream->width;
644 tsurf_info.height = stream->height;
645 tsurf_info.format = bo_format;
646 tsurf_info.bpp = tbm_surface_internal_get_bpp(bo_format);
647 tsurf_info.num_planes = tbm_surface_internal_get_num_planes(bo_format);
649 if (num_buffer_key > 0) {
651 case TBM_FORMAT_NV12:
652 case TBM_FORMAT_NV21:
653 tsurf_info.planes[0].size = stream->stride[0] * stream->elevation[0];
654 tsurf_info.planes[1].size = stream->stride[1] * stream->elevation[1];
655 tsurf_info.planes[0].offset = 0;
656 if (num_buffer_key == 1)
657 tsurf_info.planes[1].offset = tsurf_info.planes[0].size;
658 tsurf_info.size = tsurf_info.planes[0].size + tsurf_info.planes[1].size;
660 case TBM_FORMAT_YUV420:
661 case TBM_FORMAT_YVU420:
662 tsurf_info.planes[0].size = stream->stride[0] * stream->elevation[0];
663 tsurf_info.planes[1].size = stream->stride[1] * stream->elevation[1];
664 tsurf_info.planes[2].size = stream->stride[2] * stream->elevation[2];
665 tsurf_info.planes[0].offset = 0;
666 if (num_buffer_key == 1) {
667 tsurf_info.planes[1].offset = tsurf_info.planes[0].size;
668 tsurf_info.planes[2].offset = tsurf_info.planes[0].size + tsurf_info.planes[1].size;
670 tsurf_info.size = tsurf_info.planes[0].size + tsurf_info.planes[1].size + tsurf_info.planes[2].size;
672 case TBM_FORMAT_UYVY:
673 case TBM_FORMAT_YUYV:
674 tsurf_info.planes[0].size = (stream->stride[0] * stream->elevation[0]) << 1;
675 tsurf_info.planes[0].offset = 0;
676 tsurf_info.size = tsurf_info.planes[0].size;
682 tsurf = tbm_surface_internal_create_with_bos(&tsurf_info, buffer_bo, num_buffer_key);
683 } else if (mp_data->data_bo) {
685 case TBM_FORMAT_NV12:
686 case TBM_FORMAT_NV21:
687 tsurf_info.planes[0].size = stream->width * stream->height;
688 tsurf_info.planes[1].size = (tsurf_info.planes[0].size) >> 1;
689 tsurf_info.planes[0].offset = 0;
690 tsurf_info.planes[1].offset = tsurf_info.planes[0].size;
691 tsurf_info.size = tsurf_info.planes[0].size + tsurf_info.planes[1].size;
693 case TBM_FORMAT_YUV420:
694 case TBM_FORMAT_YVU420:
695 tsurf_info.planes[0].size = stream->width * stream->height;
696 tsurf_info.planes[1].size = (stream->width >> 1) * (stream->height >> 1);
697 tsurf_info.planes[2].size = tsurf_info.planes[1].size;
698 tsurf_info.planes[0].offset = 0;
699 tsurf_info.planes[1].offset = tsurf_info.planes[0].size;
700 tsurf_info.planes[2].offset = tsurf_info.planes[0].size + tsurf_info.planes[1].size;
701 tsurf_info.size = tsurf_info.planes[0].size + tsurf_info.planes[1].size + tsurf_info.planes[2].size;
703 case TBM_FORMAT_UYVY:
704 case TBM_FORMAT_YUYV:
705 tsurf_info.planes[0].size = (stream->width * stream->height) << 1;
706 tsurf_info.planes[0].offset = 0;
707 tsurf_info.size = tsurf_info.planes[0].size;
713 tsurf = tbm_surface_internal_create_with_bos(&tsurf_info, &mp_data->data_bo, 1);
715 /*LOGD("tbm surface %p", tsurf);*/
719 /* check media packet format */
720 if (cb_info->pkt_fmt) {
721 int pkt_fmt_width = 0;
722 int pkt_fmt_height = 0;
723 media_format_mimetype_e pkt_fmt_mimetype = MEDIA_FORMAT_NV12;
725 media_format_get_video_info(cb_info->pkt_fmt, &pkt_fmt_mimetype, &pkt_fmt_width, &pkt_fmt_height, NULL, NULL);
726 if (pkt_fmt_mimetype != mimetype ||
727 pkt_fmt_width != stream->width ||
728 pkt_fmt_height != stream->height) {
729 LOGW("different format. current 0x%x, %dx%d, new 0x%x, %dx%d",
730 pkt_fmt_mimetype, pkt_fmt_width, pkt_fmt_height, mimetype, stream->width, stream->height);
731 media_format_unref(cb_info->pkt_fmt);
732 cb_info->pkt_fmt = NULL;
739 /* create packet format */
741 LOGW("make new pkt_fmt - mimetype 0x%x, %dx%d", mimetype, stream->width, stream->height);
742 ret = media_format_create(&cb_info->pkt_fmt);
743 if (ret == MEDIA_FORMAT_ERROR_NONE) {
744 ret = media_format_set_video_mime(cb_info->pkt_fmt, mimetype);
745 ret |= media_format_set_video_width(cb_info->pkt_fmt, stream->width);
746 ret |= media_format_set_video_height(cb_info->pkt_fmt, stream->height);
747 LOGW("media_format_set_video_mime,width,height ret : 0x%x", ret);
749 LOGW("media_format_create failed");
753 /* create media packet */
754 ret = media_packet_create_from_tbm_surface(cb_info->pkt_fmt,
755 tsurf, (media_packet_finalize_cb)_camera_media_packet_finalize,
756 (void *)cb_info, &pkt);
757 if (ret != MEDIA_PACKET_ERROR_NONE) {
758 LOGE("media_packet_create_from_tbm_surface failed");
760 tbm_surface_destroy(tsurf);
764 LOGE("failed to create tbm surface %dx%d, format %d, num_buffer_key %d, data_bo %p",
765 stream->width, stream->height, stream->format, num_buffer_key, mp_data->data_bo);
769 LOGD("media packet %p, internal buffer %p", pkt, stream->internal_buffer);
771 /* set media packet data */
772 ret = media_packet_set_extra(pkt, (void *)mp_data);
773 if (ret != MEDIA_PACKET_ERROR_NONE) {
774 LOGE("media_packet_set_extra failed");
776 _camera_media_packet_data_release(mp_data, cb_info);
779 media_packet_destroy(pkt);
782 /* set timestamp : msec -> nsec */
783 if (media_packet_set_pts(pkt, (uint64_t)(stream->timestamp) * 1000000) != MEDIA_PACKET_ERROR_NONE)
784 LOGW("media_packet_set_pts failed");
793 int _camera_media_packet_finalize(media_packet_h pkt, int error_code, void *user_data)
796 camera_cb_info_s *cb_info = (camera_cb_info_s *)user_data;
797 camera_media_packet_data *mp_data = NULL;
798 tbm_surface_h tsurf = NULL;
800 if (pkt == NULL || cb_info == NULL) {
801 LOGE("invalid parameter buffer %p, cb_info %p", pkt, cb_info);
802 return MEDIA_PACKET_FINALIZE;
805 ret = media_packet_get_extra(pkt, (void **)&mp_data);
806 if (ret != MEDIA_PACKET_ERROR_NONE) {
807 LOGE("media_packet_get_extra failed 0x%x", ret);
808 return MEDIA_PACKET_FINALIZE;
811 /*LOGD("mp_data %p", mp_data);*/
813 g_mutex_lock(&cb_info->mp_data_mutex);
815 _camera_media_packet_data_release(mp_data, cb_info);
818 g_mutex_unlock(&cb_info->mp_data_mutex);
820 ret = media_packet_get_tbm_surface(pkt, &tsurf);
821 if (ret != MEDIA_PACKET_ERROR_NONE) {
822 LOGE("media_packet_get_tbm_surface failed 0x%x", ret);
823 return MEDIA_PACKET_FINALIZE;
827 tbm_surface_destroy(tsurf);
831 return MEDIA_PACKET_FINALIZE;
834 static void _client_user_callback(camera_cb_info_s *cb_info, char *recv_msg, muse_camera_event_e event)
840 tbm_bo_handle bo_handle = {NULL, };
842 if (recv_msg == NULL || event >= MUSE_CAMERA_EVENT_TYPE_NUM) {
843 LOGE("invalid parameter - camera msg %p, event %d", recv_msg, event);
847 LOGD("get camera msg %s, event %d", recv_msg, event);
849 if (event == MUSE_CAMERA_EVENT_TYPE_PREVIEW) {
850 if (!(CHECK_PREVIEW_CB(cb_info, PREVIEW_CB_TYPE_EVAS)) &&
851 cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW] == NULL &&
852 cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] == NULL) {
853 LOGW("all preview callback from user are NULL");
856 } else if (cb_info->user_cb[event] == NULL) {
857 LOGW("user callback for event %d is not set", event);
862 case MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE:
868 muse_camera_msg_get(previous, recv_msg);
869 muse_camera_msg_get(current, recv_msg);
870 muse_camera_msg_get(by_policy, recv_msg);
872 LOGD("STATE CHANGE - previous %d, current %d, by_policy %d",
873 previous, current, by_policy);
875 ((camera_state_changed_cb)cb_info->user_cb[event])((camera_state_e)previous,
876 (camera_state_e)current, (bool)by_policy, cb_info->user_data[event]);
879 case MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE:
883 muse_camera_msg_get(state, recv_msg);
885 LOGD("FOCUS state - %d", state);
887 ((camera_focus_changed_cb)cb_info->user_cb[event])((camera_focus_state_e)state, cb_info->user_data[event]);
890 case MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE:
891 LOGD("CAPTURE_COMPLETED");
892 ((camera_capture_completed_cb)cb_info->user_cb[event])(cb_info->user_data[event]);
894 case MUSE_CAMERA_EVENT_TYPE_PREVIEW:
895 case MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW:
897 int e_type = MUSE_CAMERA_EVENT_TYPE_PREVIEW;
900 int num_buffer_key = 0;
901 int buffer_key[BUFFER_MAX_PLANE_NUM] = {0, };
903 unsigned char *buf_pos = NULL;
905 tbm_bo buffer_bo[BUFFER_MAX_PLANE_NUM] = {NULL, };
906 tbm_bo_handle buffer_bo_handle[BUFFER_MAX_PLANE_NUM] = {{.ptr = NULL}, };
907 tbm_bo data_bo = NULL;
908 tbm_bo_handle data_bo_handle = {.ptr = NULL};
910 camera_preview_data_s frame;
911 camera_stream_data_s *stream = NULL;
912 camera_media_packet_data *mp_data = NULL;
913 media_packet_h pkt = NULL;
915 muse_camera_msg_get(tbm_key, recv_msg);
916 muse_camera_msg_get(num_buffer_key, recv_msg);
917 muse_camera_msg_get_array(buffer_key, recv_msg);
918 muse_camera_msg_get(data_key, recv_msg);
920 memset(&frame, 0x0, sizeof(camera_preview_data_s));
923 LOGE("invalid key %d", tbm_key);
928 /* import tbm data_bo and get virtual address */
929 if (!_import_tbm_key(cb_info->bufmgr, data_key, &data_bo, &data_bo_handle)) {
930 LOGE("failed to import data key %d", data_key);
931 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
932 cb_info->fd, cb_info, INT, tbm_key);
937 /* import tbm bo and get virtual address */
938 if (!_import_tbm_key(cb_info->bufmgr, tbm_key, &bo, &bo_handle)) {
939 LOGE("failed to import key %d", tbm_key);
940 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
941 cb_info->fd, cb_info, INT, tbm_key);
945 buf_pos = (unsigned char *)bo_handle.ptr;
947 /* get stream info */
948 stream = (camera_stream_data_s *)buf_pos;
950 for (i = 0 ; i < num_buffer_key ; i++) {
951 /* import buffer bo and get virtual address */
952 if (!_import_tbm_key(cb_info->bufmgr, buffer_key[i], &buffer_bo[i], &buffer_bo_handle[i])) {
953 LOGE("failed to import buffer key %d", buffer_key[i]);
955 /* release imported bo */
956 _release_imported_bo(&data_bo);
957 _release_imported_bo(&bo);
959 for (i -= 1 ; i >= 0 ; i--)
960 _release_imported_bo(&buffer_bo[i]);
962 /* send return buffer */
963 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
964 cb_info->fd, cb_info, INT, tbm_key);
970 /* call preview callback */
971 if (cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW]) {
972 _camera_preview_frame_create(stream, num_buffer_key, buffer_bo_handle, &data_bo_handle, &frame);
974 e_type = MUSE_CAMERA_EVENT_TYPE_PREVIEW;
975 ((camera_preview_cb)cb_info->user_cb[e_type])(&frame, cb_info->user_data[e_type]);
978 /* call media packet callback */
979 if (cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW]) {
980 ret = _camera_media_packet_data_create(tbm_key, num_buffer_key, bo, buffer_bo, data_bo, &mp_data);
982 if (ret == CAMERA_ERROR_NONE) {
983 ret = _camera_media_packet_create(cb_info, stream, mp_data, &pkt);
985 e_type = MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW;
986 if (ret == CAMERA_ERROR_NONE) {
987 ((camera_media_packet_preview_cb)cb_info->user_cb[e_type])(pkt, cb_info->user_data[e_type]);
989 _camera_media_packet_data_release(mp_data, cb_info);
995 /* call evas renderer */
996 if (CHECK_PREVIEW_CB(cb_info, PREVIEW_CB_TYPE_EVAS)) {
997 ret = _camera_media_packet_data_create(tbm_key, num_buffer_key, bo, buffer_bo, data_bo, &mp_data);
999 if (ret == CAMERA_ERROR_NONE) {
1000 ret = _camera_media_packet_create(cb_info, stream, mp_data, &pkt);
1002 if (ret == CAMERA_ERROR_NONE) {
1003 g_mutex_lock(&cb_info->evas_mutex);
1005 if (cb_info->run_evas_render)
1006 mm_evas_renderer_write(pkt, cb_info->evas_info);
1008 LOGW("evas renderer is stopped, skip this buffer...");
1009 media_packet_destroy(pkt);
1014 g_mutex_unlock(&cb_info->evas_mutex);
1016 _camera_media_packet_data_release(mp_data, cb_info);
1022 /* send message for preview callback return */
1023 if (!CHECK_PREVIEW_CB(cb_info, PREVIEW_CB_TYPE_EVAS))
1024 muse_camera_msg_send_no_return(MUSE_CAMERA_API_PREVIEW_CB_RETURN, cb_info->fd, cb_info);
1026 if (mp_data == NULL) {
1027 /* release imported bo */
1028 for (i = 0 ; i < num_buffer_key ; i++)
1029 _release_imported_bo(&buffer_bo[i]);
1031 /* unmap and unref tbm bo */
1032 _release_imported_bo(&bo);
1035 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
1036 cb_info->fd, cb_info, INT, tbm_key);
1038 /*LOGD("return buffer Done");*/
1042 case MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS:
1046 muse_camera_msg_get(percent, recv_msg);
1048 LOGD("HDR progress - %d \%", percent);
1050 ((camera_attr_hdr_progress_cb)cb_info->user_cb[event])(percent, cb_info->user_data[event]);
1053 case MUSE_CAMERA_EVENT_TYPE_INTERRUPTED:
1059 muse_camera_msg_get(policy, recv_msg);
1060 muse_camera_msg_get(previous, recv_msg);
1061 muse_camera_msg_get(current, recv_msg);
1063 LOGD("INTERRUPTED - policy %d, state previous %d, current %d",
1064 policy, previous, current);
1066 ((camera_interrupted_cb)cb_info->user_cb[event])((camera_policy_e)policy,
1067 (camera_state_e)previous, (camera_state_e)current, cb_info->user_data[event]);
1070 case MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION:
1073 camera_detected_face_s *faces = NULL;
1075 muse_camera_msg_get(count, recv_msg);
1076 muse_camera_msg_get(tbm_key, recv_msg);
1078 if (count > 0 && tbm_key > 0) {
1079 LOGD("FACE_DETECTION - count %d, tbm_key %d", count, tbm_key);
1081 if (!_import_tbm_key(cb_info->bufmgr, tbm_key, &bo, &bo_handle))
1085 faces = bo_handle.ptr;
1087 ((camera_face_detected_cb)cb_info->user_cb[event])(faces, count, cb_info->user_data[event]);
1093 for (i = 0 ; i < count ; i++) {
1094 LOGD("id[%2d] - score %d, position (%d,%d,%dx%d)",
1095 i, faces[i].score, faces[i].x, faces[i].y, faces[i].width, faces[i].height);
1101 _release_imported_bo(&bo);
1104 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
1105 cb_info->fd, cb_info, INT, tbm_key);
1107 LOGD("return buffer done");
1109 LOGE("invalid message - count %d, key %d", count, tbm_key);
1113 case MUSE_CAMERA_EVENT_TYPE_ERROR:
1116 int current_state = 0;
1118 muse_camera_msg_get(error, recv_msg);
1119 muse_camera_msg_get(current_state, recv_msg);
1121 LOGE("ERROR - error 0x%x, current_state %d", error, current_state);
1123 ((camera_error_cb)cb_info->user_cb[event])((camera_error_e)error,
1124 (camera_state_e)current_state, cb_info->user_data[event]);
1127 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_RESOLUTION:
1128 muse_camera_msg_get(param1, recv_msg);
1129 muse_camera_msg_get(param2, recv_msg);
1131 LOGD("SUPPORTED_PREVIEW_RESOLUTION - %d x %d", param1, param2);
1133 if (((camera_supported_preview_resolution_cb)cb_info->user_cb[event])(param1, param2, cb_info->user_data[event]) == false) {
1134 cb_info->user_cb[event] = NULL;
1135 cb_info->user_data[event] = NULL;
1136 LOGD("stop foreach callback for SUPPORTED_PREVIEW_RESOLUTION");
1139 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_RESOLUTION:
1140 muse_camera_msg_get(param1, recv_msg);
1141 muse_camera_msg_get(param2, recv_msg);
1143 LOGD("SUPPORTED_CAPTURE_RESOLUTION - %d x %d", param1, param2);
1145 if (((camera_supported_capture_resolution_cb)cb_info->user_cb[event])(param1, param2, cb_info->user_data[event]) == false) {
1146 cb_info->user_cb[event] = NULL;
1147 cb_info->user_data[event] = NULL;
1148 LOGD("stop foreach callback for SUPPORTED_CAPTURE_RESOLUTION");
1151 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_FORMAT:
1152 muse_camera_msg_get(param1, recv_msg);
1154 LOGD("SUPPORTED_CAPTURE_FORMAT - %d ", param1);
1156 if (((camera_supported_capture_format_cb)cb_info->user_cb[event])((camera_pixel_format_e)param1, cb_info->user_data[event]) == false) {
1157 cb_info->user_cb[event] = NULL;
1158 cb_info->user_data[event] = NULL;
1159 LOGD("stop foreach callback for SUPPORTED_CAPTURE_FORMAT");
1162 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_FORMAT:
1163 muse_camera_msg_get(param1, recv_msg);
1165 LOGD("SUPPORTED_PREVIEW_FORMAT - %d ", param1);
1167 if (((camera_supported_preview_format_cb)cb_info->user_cb[event])((camera_pixel_format_e)param1, cb_info->user_data[event]) == false) {
1168 cb_info->user_cb[event] = NULL;
1169 cb_info->user_data[event] = NULL;
1170 LOGD("stop foreach callback for SUPPORTED_PREVIEW_FORMAT");
1173 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_AF_MODE:
1174 muse_camera_msg_get(param1, recv_msg);
1176 LOGD("SUPPORTED_AF_MODE - %d ", param1);
1178 if (((camera_attr_supported_af_mode_cb)cb_info->user_cb[event])((camera_attr_af_mode_e)param1, cb_info->user_data[event]) == false) {
1179 cb_info->user_cb[event] = NULL;
1180 cb_info->user_data[event] = NULL;
1181 LOGD("stop foreach callback for SUPPORTED_AF_MODE");
1184 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EXPOSURE_MODE:
1185 muse_camera_msg_get(param1, recv_msg);
1187 LOGD("SUPPORTED_EXPOSURE_MODE - %d ", param1);
1189 if (((camera_attr_supported_exposure_mode_cb)cb_info->user_cb[event])((camera_attr_exposure_mode_e)param1, cb_info->user_data[event]) == false) {
1190 cb_info->user_cb[event] = NULL;
1191 cb_info->user_data[event] = NULL;
1192 LOGD("stop foreach callback for SUPPORTED_EXPOSURE_MODE");
1195 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_ISO:
1196 muse_camera_msg_get(param1, recv_msg);
1198 LOGD("SUPPORTED_ISO - %d ", param1);
1200 if (((camera_attr_supported_iso_cb)cb_info->user_cb[event])((camera_attr_iso_e)param1, cb_info->user_data[event]) == false) {
1201 cb_info->user_cb[event] = NULL;
1202 cb_info->user_data[event] = NULL;
1203 LOGD("stop foreach callback for SUPPORTED_ISO");
1206 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_WHITEBALANCE:
1207 muse_camera_msg_get(param1, recv_msg);
1209 LOGD("SUPPORTED_WHITEBALANCE - %d ", param1);
1211 if (((camera_attr_supported_whitebalance_cb)cb_info->user_cb[event])((camera_attr_whitebalance_e)param1, cb_info->user_data[event]) == false) {
1212 cb_info->user_cb[event] = NULL;
1213 cb_info->user_data[event] = NULL;
1214 LOGD("stop foreach callback for SUPPORTED_WHITEBALANCE");
1217 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EFFECT:
1218 muse_camera_msg_get(param1, recv_msg);
1220 LOGD("SUPPORTED_EFFECT - %d ", param1);
1222 if (((camera_attr_supported_effect_cb)cb_info->user_cb[event])((camera_attr_effect_mode_e)param1, cb_info->user_data[event]) == false) {
1223 cb_info->user_cb[event] = NULL;
1224 cb_info->user_data[event] = NULL;
1225 LOGD("stop foreach callback for SUPPORTED_EFFECT");
1228 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_SCENE_MODE:
1229 muse_camera_msg_get(param1, recv_msg);
1231 LOGD("SUPPORTED_SCENE_MODE - %d ", param1);
1233 if (((camera_attr_supported_scene_mode_cb)cb_info->user_cb[event])((camera_attr_scene_mode_e)param1, cb_info->user_data[event]) == false) {
1234 cb_info->user_cb[event] = NULL;
1235 cb_info->user_data[event] = NULL;
1236 LOGD("stop foreach callback for SUPPORTED_SCENE_MODE");
1239 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FLASH_MODE:
1240 muse_camera_msg_get(param1, recv_msg);
1242 LOGD("SUPPORTED_FLASH_MODE - %d ", param1);
1244 if (((camera_attr_supported_flash_mode_cb)cb_info->user_cb[event])((camera_attr_flash_mode_e)param1, cb_info->user_data[event]) == false) {
1245 cb_info->user_cb[event] = NULL;
1246 cb_info->user_data[event] = NULL;
1247 LOGD("stop foreach callback for SUPPORTED_FLASH_MODE");
1250 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS:
1251 muse_camera_msg_get(param1, recv_msg);
1253 LOGD("SUPPORTED_FPS - %d ", param1);
1255 if (((camera_attr_supported_fps_cb)cb_info->user_cb[event])((camera_attr_fps_e)param1, cb_info->user_data[event]) == false) {
1256 cb_info->user_cb[event] = NULL;
1257 cb_info->user_data[event] = NULL;
1258 LOGD("stop foreach callback for SUPPORTED_FPS");
1261 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS_BY_RESOLUTION:
1262 muse_camera_msg_get(param1, recv_msg);
1264 LOGD("SUPPORTED_FPS_BY_RESOLUTION - %d ", param1);
1266 if (((camera_attr_supported_fps_cb)cb_info->user_cb[event])((camera_attr_fps_e)param1, cb_info->user_data[event]) == false) {
1267 cb_info->user_cb[event] = NULL;
1268 cb_info->user_data[event] = NULL;
1269 LOGD("stop foreach callback for SUPPORTED_FPS_BY_RESOLUTION");
1272 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_FLIP:
1273 muse_camera_msg_get(param1, recv_msg);
1275 LOGD("SUPPORTED_STREAM_FLIP - %d ", param1);
1277 if (((camera_attr_supported_stream_flip_cb)cb_info->user_cb[event])((camera_flip_e)param1, cb_info->user_data[event]) == false) {
1278 cb_info->user_cb[event] = NULL;
1279 cb_info->user_data[event] = NULL;
1280 LOGD("stop foreach callback for SUPPORTED_STREAM_FLIP");
1283 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION:
1284 muse_camera_msg_get(param1, recv_msg);
1286 LOGD("SUPPORTED_STREAM_ROTATION - %d ", param1);
1288 if (((camera_attr_supported_stream_rotation_cb)cb_info->user_cb[event])((camera_rotation_e)param1, cb_info->user_data[event]) == false) {
1289 cb_info->user_cb[event] = NULL;
1290 cb_info->user_data[event] = NULL;
1291 LOGD("stop foreach callback for SUPPORTED_STREAM_ROTATION");
1294 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE:
1295 muse_camera_msg_get(param1, recv_msg);
1297 LOGD("SUPPORTED_THEATER_MODE - %d ", param1);
1299 if (((camera_attr_supported_theater_mode_cb)cb_info->user_cb[event])((camera_attr_theater_mode_e)param1, cb_info->user_data[event]) == false) {
1300 cb_info->user_cb[event] = NULL;
1301 cb_info->user_data[event] = NULL;
1302 LOGD("stop foreach callback for SUPPORTED_THEATER_MODE");
1305 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PTZ_TYPE:
1306 muse_camera_msg_get(param1, recv_msg);
1308 LOGD("SUPPORTED_PTZ_TYPE - %d ", param1);
1310 if (((camera_attr_supported_ptz_type_cb)cb_info->user_cb[event])((camera_attr_ptz_type_e)param1, cb_info->user_data[event]) == false) {
1311 cb_info->user_cb[event] = NULL;
1312 cb_info->user_data[event] = NULL;
1313 LOGD("stop foreach callback for SUPPORTED_PTZ_TYPE");
1316 case MUSE_CAMERA_EVENT_TYPE_CAPTURE:
1318 camera_image_data_s *rImage = NULL;
1319 camera_image_data_s *rPostview = NULL;
1320 camera_image_data_s *rThumbnail = NULL;
1321 unsigned char *buf_pos = NULL;
1322 int tbm_key_main = 0;
1323 int tbm_key_post = 0;
1324 int tbm_key_thumb = 0;
1325 tbm_bo bo_main = NULL;
1326 tbm_bo bo_post = NULL;
1327 tbm_bo bo_thumb = NULL;
1328 tbm_bo_handle bo_main_handle = {NULL, };
1329 tbm_bo_handle bo_post_handle = {NULL, };
1330 tbm_bo_handle bo_thumb_handle = {NULL, };
1332 muse_camera_msg_get(tbm_key_main, recv_msg);
1333 muse_camera_msg_get(tbm_key_post, recv_msg);
1334 muse_camera_msg_get(tbm_key_thumb, recv_msg);
1336 LOGD("camera capture callback came in. tbm_key_main %d, tbm_key_post %d, tbm_key_thumb %d",
1337 tbm_key_main, tbm_key_post, tbm_key_thumb);
1339 if (tbm_key_main <= 0) {
1340 LOGE("invalid tbm_key_main %d", tbm_key_main);
1344 /* import tbm bo and get virtual address */
1345 if (!_import_tbm_key(cb_info->bufmgr, tbm_key_main, &bo_main, &bo_main_handle))
1348 buf_pos = (unsigned char *)bo_main_handle.ptr;
1349 rImage = (camera_image_data_s *)buf_pos;
1350 rImage->data = buf_pos + sizeof(camera_image_data_s);
1352 LOGD("image info %dx%d, size : %d", rImage->height, rImage->width, rImage->size);
1354 if (tbm_key_post > 0) {
1355 /* import tbm bo and get virtual address */
1356 if (!_import_tbm_key(cb_info->bufmgr, tbm_key_post, &bo_post, &bo_post_handle))
1359 buf_pos = (unsigned char *)bo_post_handle.ptr;
1360 rPostview = (camera_image_data_s *)buf_pos;
1361 LOGD("rPostview->size : %d", rPostview->size);
1362 rPostview->data = buf_pos + sizeof(camera_image_data_s);
1365 if (tbm_key_thumb > 0) {
1366 /* import tbm bo and get virtual address */
1367 if (!_import_tbm_key(cb_info->bufmgr, tbm_key_thumb, &bo_thumb, &bo_thumb_handle))
1370 buf_pos = (unsigned char *)bo_thumb_handle.ptr;
1372 rThumbnail = (camera_image_data_s *)buf_pos;
1373 LOGD("rThumbnail->size : %d", rThumbnail->size);
1374 rThumbnail->data = buf_pos + sizeof(camera_image_data_s);
1377 ((camera_capturing_cb)cb_info->user_cb[event])(rImage, rPostview, rThumbnail, cb_info->user_data[event]);
1379 /* unmap and unref tbm bo */
1380 _release_imported_bo(&bo_main);
1383 tbm_key = tbm_key_main;
1384 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
1385 cb_info->fd, cb_info, INT, tbm_key);
1387 if (tbm_key_post > 0) {
1388 /* unmap and unref tbm bo */
1389 _release_imported_bo(&bo_post);
1392 tbm_key = tbm_key_post;
1393 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
1394 cb_info->fd, cb_info, INT, tbm_key);
1397 if (tbm_key_thumb > 0) {
1398 /* unmap and unref tbm bo */
1399 _release_imported_bo(&bo_thumb);
1402 tbm_key = tbm_key_thumb;
1403 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
1404 cb_info->fd, cb_info, INT, tbm_key);
1407 LOGD("return buffer done");
1410 case MUSE_CAMERA_EVENT_TYPE_VIDEO_FRAME_RENDER_ERROR:
1413 LOGW("Unknown event : %d", event);
1420 static bool _camera_idle_event_callback(void *data)
1422 camera_cb_info_s *cb_info = NULL;
1423 camera_idle_event_s *cam_idle_event = (camera_idle_event_s *)data;
1425 if (cam_idle_event == NULL) {
1426 LOGE("cam_idle_event is NULL");
1431 g_mutex_lock(&cam_idle_event->event_mutex);
1433 cb_info = cam_idle_event->cb_info;
1434 if (cb_info == NULL) {
1435 LOGW("camera cb_info is NULL. event %d", cam_idle_event->event);
1436 goto IDLE_EVENT_CALLBACK_DONE;
1439 /* remove event from list */
1440 g_mutex_lock(&cb_info->idle_event_mutex);
1441 if (cb_info->idle_event_list)
1442 cb_info->idle_event_list = g_list_remove(cb_info->idle_event_list, (gpointer)cam_idle_event);
1444 /*LOGD("remove camera idle event %p, %p", cam_idle_event, cb_info->idle_event_list);*/
1445 g_mutex_unlock(&cb_info->idle_event_mutex);
1448 _client_user_callback(cam_idle_event->cb_info, cam_idle_event->recv_msg, cam_idle_event->event);
1450 /* send signal for waiting thread */
1451 g_cond_signal(&cb_info->idle_event_cond);
1453 IDLE_EVENT_CALLBACK_DONE:
1454 /* unlock and release event */
1455 g_mutex_unlock(&cam_idle_event->event_mutex);
1456 g_mutex_clear(&cam_idle_event->event_mutex);
1458 g_free(cam_idle_event);
1459 cam_idle_event = NULL;
1464 static void *_camera_msg_handler_func(gpointer data)
1469 int event_class = 0;
1470 camera_message_s *cam_msg = NULL;
1471 camera_idle_event_s *cam_idle_event = NULL;
1472 camera_cb_info_s *cb_info = (camera_cb_info_s *)data;
1474 if (cb_info == NULL) {
1475 LOGE("cb_info NULL");
1481 g_mutex_lock(&cb_info->msg_handler_mutex);
1483 while (g_atomic_int_get(&cb_info->msg_handler_running)) {
1484 if (g_queue_is_empty(cb_info->msg_queue)) {
1485 LOGD("signal wait...");
1486 g_cond_wait(&cb_info->msg_handler_cond, &cb_info->msg_handler_mutex);
1487 LOGD("signal received");
1489 if (g_atomic_int_get(&cb_info->msg_handler_running) == 0) {
1490 LOGD("stop event thread");
1495 cam_msg = (camera_message_s *)g_queue_pop_head(cb_info->msg_queue);
1497 g_mutex_unlock(&cb_info->msg_handler_mutex);
1499 if (cam_msg == NULL) {
1500 LOGE("NULL message");
1501 g_mutex_lock(&cb_info->msg_handler_mutex);
1507 if (api < MUSE_CAMERA_API_MAX) {
1508 g_mutex_lock(&cb_info->api_mutex[api]);
1510 if (muse_camera_msg_get(ret, cam_msg->recv_msg)) {
1511 cb_info->api_ret[api] = ret;
1512 cb_info->api_activating[api] = 1;
1514 LOGD("camera api %d - return 0x%x", ret);
1516 g_cond_signal(&cb_info->api_cond[api]);
1518 LOGE("failed to get camera ret for api %d, msg %s", api, cam_msg->recv_msg);
1521 g_mutex_unlock(&cb_info->api_mutex[api]);
1522 } else if (api == MUSE_CAMERA_CB_EVENT) {
1526 if (!muse_camera_msg_get(event, cam_msg->recv_msg) ||
1527 !muse_camera_msg_get(event_class, cam_msg->recv_msg)) {
1528 LOGE("failed to get camera event %d, class %d", event, event_class);
1533 g_mutex_lock(&cb_info->msg_handler_mutex);
1537 switch (event_class) {
1538 case MUSE_CAMERA_EVENT_CLASS_THREAD_SUB:
1539 _client_user_callback(cb_info, cam_msg->recv_msg, event);
1541 case MUSE_CAMERA_EVENT_CLASS_THREAD_MAIN:
1542 cam_idle_event = g_new0(camera_idle_event_s, 1);
1543 if (cam_idle_event == NULL) {
1544 LOGE("cam_idle_event alloc failed");
1548 cam_idle_event->event = event;
1549 cam_idle_event->cb_info = cb_info;
1550 g_mutex_init(&cam_idle_event->event_mutex);
1551 memcpy(cam_idle_event->recv_msg, cam_msg->recv_msg, sizeof(cam_idle_event->recv_msg));
1553 LOGD("add camera event[%d, %p] to IDLE", event, cam_idle_event);
1555 g_mutex_lock(&cb_info->idle_event_mutex);
1556 cb_info->idle_event_list = g_list_append(cb_info->idle_event_list, (gpointer)cam_idle_event);
1557 g_mutex_unlock(&cb_info->idle_event_mutex);
1559 g_idle_add_full(G_PRIORITY_DEFAULT,
1560 (GSourceFunc)_camera_idle_event_callback,
1561 (gpointer)cam_idle_event,
1565 LOGE("unknown camera event class %d", event_class);
1569 LOGE("unknown camera api[%d] message[%s]", api, cam_msg->recv_msg);
1575 g_mutex_lock(&cb_info->msg_handler_mutex);
1578 /* remove remained event */
1579 while (!g_queue_is_empty(cb_info->msg_queue)) {
1580 cam_msg = (camera_message_s *)g_queue_pop_head(cb_info->msg_queue);
1582 LOGD("remove camera message %p", cam_msg);
1586 LOGW("NULL camera message");
1590 g_mutex_unlock(&cb_info->msg_handler_mutex);
1597 static void _camera_remove_idle_event_all(camera_cb_info_s *cb_info)
1599 camera_idle_event_s *cam_idle_event = NULL;
1600 gboolean ret = TRUE;
1602 gint64 end_time = 0;
1604 if (cb_info == NULL) {
1605 LOGE("cb_info is NULL");
1609 g_mutex_lock(&cb_info->idle_event_mutex);
1611 if (cb_info->idle_event_list == NULL) {
1612 LOGD("No idle event is remained.");
1614 list = cb_info->idle_event_list;
1617 cam_idle_event = list->data;
1618 list = g_list_next(list);
1620 if (!cam_idle_event) {
1621 LOGW("Fail to remove idle event. The event is NULL");
1623 if (g_mutex_trylock(&cam_idle_event->event_mutex)) {
1624 ret = g_idle_remove_by_data(cam_idle_event);
1626 LOGD("remove idle event [%p], ret[%d]", cam_idle_event, ret);
1629 cam_idle_event->cb_info = NULL;
1630 LOGW("idle callback for event %p will be called later", cam_idle_event);
1633 cb_info->idle_event_list = g_list_remove(cb_info->idle_event_list, (gpointer)cam_idle_event);
1635 g_mutex_unlock(&cam_idle_event->event_mutex);
1638 g_mutex_clear(&cam_idle_event->event_mutex);
1640 g_free(cam_idle_event);
1641 cam_idle_event = NULL;
1643 LOGD("remove idle event done");
1646 LOGW("event lock failed. it's being called...");
1648 end_time = g_get_monotonic_time() + G_TIME_SPAN_MILLISECOND * 100;
1650 if (g_cond_wait_until(&cb_info->idle_event_cond, &cb_info->idle_event_mutex, end_time))
1651 LOGW("signal received");
1658 g_list_free(cb_info->idle_event_list);
1659 cb_info->idle_event_list = NULL;
1662 g_mutex_unlock(&cb_info->idle_event_mutex);
1667 static void *_camera_msg_recv_func(gpointer data)
1676 char *recv_msg = NULL;
1677 char **parse_str = NULL;
1678 camera_cb_info_s *cb_info = (camera_cb_info_s *)data;
1680 if (cb_info == NULL) {
1681 LOGE("cb_info NULL");
1687 parse_str = (char **)malloc(sizeof(char *) * CAMERA_PARSE_STRING_SIZE);
1688 if (parse_str == NULL) {
1689 LOGE("parse_str malloc failed");
1693 for (i = 0 ; i < CAMERA_PARSE_STRING_SIZE ; i++) {
1694 parse_str[i] = (char *)malloc(sizeof(char) * MUSE_CAMERA_MSG_MAX_LENGTH);
1695 if (parse_str[i] == NULL) {
1696 LOGE("parse_str[%d] malloc failed", i);
1697 goto CB_HANDLER_EXIT;
1701 recv_msg = cb_info->recv_msg;
1703 while (g_atomic_int_get(&cb_info->msg_recv_running)) {
1704 ret = muse_core_ipc_recv_msg(cb_info->fd, recv_msg);
1707 recv_msg[ret] = '\0';
1713 /*LOGD("recvMSg : %s, length : %d", recv_msg, ret);*/
1715 /* Need to split the combined entering msgs.
1716 This module supports up to 200 combined msgs. */
1717 for (str_pos = 0; str_pos < ret; str_pos++) {
1718 if (recv_msg[str_pos] == '}') {
1719 memset(parse_str[num_token], 0x0, sizeof(char) * MUSE_CAMERA_MSG_MAX_LENGTH);
1720 strncpy(parse_str[num_token], recv_msg + prev_pos, str_pos - prev_pos + 1);
1721 LOGD("splitted msg : [%s], Index : %d", parse_str[num_token], num_token);
1722 prev_pos = str_pos+1;
1727 /*LOGD("num_token : %d", num_token);*/
1729 /* Re-construct to the useful single msg. */
1730 for (i = 0; i < num_token; i++) {
1731 if (i >= CAMERA_PARSE_STRING_SIZE) {
1732 LOGE("invalid token index %d", i);
1739 if (!muse_camera_msg_get(api, parse_str[i])) {
1740 LOGE("failed to get camera api");
1744 if (api != MUSE_CAMERA_CB_EVENT) {
1745 LOGD("check api_class");
1746 if (muse_camera_msg_get(api_class, parse_str[i]))
1747 LOGD("camera api_class[%d]", api_class);
1750 if (api_class == MUSE_CAMERA_API_CLASS_IMMEDIATE) {
1751 g_mutex_lock(&cb_info->api_mutex[api]);
1753 if (!muse_camera_msg_get(ret, parse_str[i])) {
1754 LOGE("failed to get camera ret");
1755 g_mutex_unlock(&cb_info->api_mutex[api]);
1759 cb_info->api_ret[api] = ret;
1760 cb_info->api_activating[api] = 1;
1762 if (api == MUSE_CAMERA_API_CREATE) {
1763 if (ret != CAMERA_ERROR_NONE) {
1764 g_atomic_int_set(&cb_info->msg_recv_running, 0);
1765 LOGE("camera create error 0x%x. close client cb handler", ret);
1767 } else if (api == MUSE_CAMERA_API_DESTROY) {
1768 if (ret == CAMERA_ERROR_NONE) {
1769 g_atomic_int_set(&cb_info->msg_recv_running, 0);
1770 LOGD("camera destroy done. close client cb handler");
1774 g_cond_signal(&cb_info->api_cond[api]);
1775 g_mutex_unlock(&cb_info->api_mutex[api]);
1776 } else if (api_class == MUSE_CAMERA_API_CLASS_THREAD_SUB || api == MUSE_CAMERA_CB_EVENT) {
1777 camera_message_s *cam_msg = g_new0(camera_message_s, 1);
1778 if (cam_msg == NULL) {
1779 LOGE("failed to alloc cam_msg");
1784 memcpy(cam_msg->recv_msg, parse_str[i], sizeof(cam_msg->recv_msg));
1786 LOGD("add camera message to queue : api %d", api);
1788 g_mutex_lock(&cb_info->msg_handler_mutex);
1789 g_queue_push_tail(cb_info->msg_queue, (gpointer)cam_msg);
1790 g_cond_signal(&cb_info->msg_handler_cond);
1791 g_mutex_unlock(&cb_info->msg_handler_mutex);
1793 LOGW("unknown camera api %d and api_class %d", api, api_class);
1799 LOGD("client cb exit");
1803 for (i = 0 ; i < CAMERA_PARSE_STRING_SIZE ; i++) {
1806 parse_str[i] = NULL;
1817 static camera_cb_info_s *_client_callback_new(gint sockfd)
1819 camera_cb_info_s *cb_info = NULL;
1820 gint *tmp_activating = NULL;
1821 gint *tmp_ret = NULL;
1824 g_return_val_if_fail(sockfd > 0, NULL);
1826 cb_info = g_new0(camera_cb_info_s, 1);
1827 if (cb_info == NULL) {
1828 LOGE("cb_info failed");
1832 g_mutex_init(&cb_info->msg_handler_mutex);
1833 g_cond_init(&cb_info->msg_handler_cond);
1834 g_mutex_init(&cb_info->idle_event_mutex);
1835 g_cond_init(&cb_info->idle_event_cond);
1836 g_mutex_init(&cb_info->mp_data_mutex);
1837 g_mutex_init(&cb_info->evas_mutex);
1839 for (i = 0 ; i < MUSE_CAMERA_API_MAX ; i++) {
1840 g_mutex_init(&cb_info->api_mutex[i]);
1841 g_cond_init(&cb_info->api_cond[i]);
1844 tmp_activating = g_new0(gint, MUSE_CAMERA_API_MAX);
1845 if (tmp_activating == NULL) {
1846 LOGE("tmp_activating failed");
1850 tmp_ret = g_new0(gint, MUSE_CAMERA_API_MAX);
1851 if (tmp_ret == NULL) {
1852 LOGE("tmp_ret failed");
1856 cb_info->msg_queue = g_queue_new();
1857 if (cb_info->msg_queue == NULL) {
1858 LOGE("msg_queue new failed");
1862 g_atomic_int_set(&cb_info->msg_handler_running, 1);
1863 cb_info->msg_handler_thread = g_thread_try_new("camera_msg_handler",
1864 _camera_msg_handler_func, (gpointer)cb_info, NULL);
1865 if (cb_info->msg_handler_thread == NULL) {
1866 LOGE("message handler thread creation failed");
1870 cb_info->fd = sockfd;
1871 cb_info->api_activating = tmp_activating;
1872 cb_info->api_ret = tmp_ret;
1873 cb_info->preview_cb_flag = 0;
1874 cb_info->evas_info = NULL;
1876 g_atomic_int_set(&cb_info->msg_recv_running, 1);
1877 cb_info->msg_recv_thread = g_thread_try_new("camera_msg_recv",
1878 _camera_msg_recv_func, (gpointer)cb_info, NULL);
1879 if (cb_info->msg_recv_thread == NULL) {
1880 LOGE("message receive thread creation failed");
1888 if (cb_info->msg_handler_thread) {
1889 g_mutex_lock(&cb_info->msg_handler_mutex);
1890 g_atomic_int_set(&cb_info->msg_handler_running, 0);
1891 g_cond_signal(&cb_info->msg_handler_cond);
1892 g_mutex_unlock(&cb_info->msg_handler_mutex);
1894 g_thread_join(cb_info->msg_handler_thread);
1895 g_thread_unref(cb_info->msg_handler_thread);
1896 cb_info->msg_handler_thread = NULL;
1899 for (i = 0 ; i < MUSE_CAMERA_API_MAX ; i++) {
1900 g_mutex_clear(&cb_info->api_mutex[i]);
1901 g_cond_clear(&cb_info->api_cond[i]);
1904 g_mutex_clear(&cb_info->msg_handler_mutex);
1905 g_cond_clear(&cb_info->msg_handler_cond);
1906 g_mutex_clear(&cb_info->idle_event_mutex);
1907 g_cond_clear(&cb_info->idle_event_cond);
1908 g_mutex_clear(&cb_info->mp_data_mutex);
1909 g_mutex_clear(&cb_info->evas_mutex);
1911 if (cb_info->msg_queue) {
1912 g_queue_free(cb_info->msg_queue);
1913 cb_info->msg_queue = NULL;
1920 if (tmp_activating) {
1921 g_free(tmp_activating);
1922 tmp_activating = NULL;
1932 static void _client_callback_destroy(camera_cb_info_s *cb_info)
1936 g_return_if_fail(cb_info != NULL);
1938 LOGD("MSG receive thread[%p] destroy", cb_info->msg_recv_thread);
1940 g_thread_join(cb_info->msg_recv_thread);
1941 g_thread_unref(cb_info->msg_recv_thread);
1942 cb_info->msg_recv_thread = NULL;
1944 LOGD("msg thread removed");
1946 g_mutex_lock(&cb_info->msg_handler_mutex);
1947 g_atomic_int_set(&cb_info->msg_handler_running, 0);
1948 g_cond_signal(&cb_info->msg_handler_cond);
1949 g_mutex_unlock(&cb_info->msg_handler_mutex);
1951 g_thread_join(cb_info->msg_handler_thread);
1952 g_thread_unref(cb_info->msg_handler_thread);
1953 cb_info->msg_handler_thread = NULL;
1955 g_queue_free(cb_info->msg_queue);
1956 cb_info->msg_queue = NULL;
1958 for (i = 0 ; i < MUSE_CAMERA_API_MAX ; i++) {
1959 g_mutex_clear(&cb_info->api_mutex[i]);
1960 g_cond_clear(&cb_info->api_cond[i]);
1963 g_mutex_clear(&cb_info->msg_handler_mutex);
1964 g_cond_clear(&cb_info->msg_handler_cond);
1965 g_mutex_clear(&cb_info->idle_event_mutex);
1966 g_cond_clear(&cb_info->idle_event_cond);
1967 g_mutex_clear(&cb_info->mp_data_mutex);
1968 g_mutex_clear(&cb_info->evas_mutex);
1970 LOGD("event thread removed");
1972 if (cb_info->fd > -1) {
1973 muse_core_connection_close(cb_info->fd);
1977 if (cb_info->bufmgr) {
1978 tbm_bufmgr_deinit(cb_info->bufmgr);
1979 cb_info->bufmgr = NULL;
1981 if (cb_info->api_activating) {
1982 g_free(cb_info->api_activating);
1983 cb_info->api_activating = NULL;
1985 if (cb_info->api_ret) {
1986 g_free(cb_info->api_ret);
1987 cb_info->api_ret = NULL;
1989 if (cb_info->pkt_fmt) {
1990 media_format_unref(cb_info->pkt_fmt);
1991 cb_info->pkt_fmt = NULL;
1994 if (cb_info->evas_info)
1995 mm_evas_renderer_destroy(&cb_info->evas_info);
1997 cb_info->preview_cb_flag = 0;
2006 int _camera_start_evas_rendering(camera_h camera)
2008 int ret = CAMERA_ERROR_NONE;
2009 camera_cli_s *pc = (camera_cli_s *)camera;
2011 if (camera == NULL) {
2012 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2013 return CAMERA_ERROR_INVALID_PARAMETER;
2016 if (pc->cb_info == NULL) {
2017 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2018 return CAMERA_ERROR_INVALID_PARAMETER;
2023 if (!CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
2024 LOGE("EVAS surface is not set");
2025 return CAMERA_ERROR_NONE;
2028 g_mutex_lock(&pc->cb_info->evas_mutex);
2030 /* set evas render flag as RUN */
2031 pc->cb_info->run_evas_render = true;
2032 ret = CAMERA_ERROR_NONE;
2034 g_mutex_unlock(&pc->cb_info->evas_mutex);
2040 int _camera_stop_evas_rendering(camera_h camera, bool keep_screen)
2042 int ret = CAMERA_ERROR_NONE;
2043 camera_cli_s *pc = (camera_cli_s *)camera;
2045 if (camera == NULL) {
2046 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2047 return CAMERA_ERROR_INVALID_PARAMETER;
2050 if (pc->cb_info == NULL) {
2051 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2052 return CAMERA_ERROR_INVALID_PARAMETER;
2055 LOGD("stop - keep screen %d", keep_screen);
2057 if (!CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
2058 LOGE("EVAS surface is not set");
2059 return CAMERA_ERROR_NONE;
2062 g_mutex_lock(&pc->cb_info->evas_mutex);
2064 /* set evas render flag as STOP and release buffers */
2065 pc->cb_info->run_evas_render = false;
2066 ret = mm_evas_renderer_retrieve_all_packets(pc->cb_info->evas_info, keep_screen);
2067 if (ret != MM_ERROR_NONE) {
2068 LOGE("mm_evas_renderer_retrieve_all_packets failed 0x%x", ret);
2069 ret = CAMERA_ERROR_INVALID_OPERATION;
2072 g_mutex_unlock(&pc->cb_info->evas_mutex);
2078 int camera_create(camera_device_e device, camera_h *camera)
2082 int ret = CAMERA_ERROR_NONE;
2084 camera_cli_s *pc = NULL;
2085 tbm_bufmgr bufmgr = NULL;
2087 muse_camera_api_e api = MUSE_CAMERA_API_CREATE;
2088 muse_core_api_module_e muse_module = MUSE_CAMERA;
2089 int device_type = (int)device;
2091 if (camera == NULL) {
2092 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2093 return CAMERA_ERROR_INVALID_PARAMETER;
2096 bufmgr = tbm_bufmgr_init(-1);
2097 if (bufmgr == NULL) {
2098 LOGE("get tbm bufmgr failed");
2099 return CAMERA_ERROR_INVALID_OPERATION;
2102 sock_fd = muse_core_client_new();
2104 LOGE("muse_core_client_new failed - returned fd %d", sock_fd);
2105 ret = CAMERA_ERROR_INVALID_OPERATION;
2111 sndMsg = muse_core_msg_json_factory_new(api,
2112 MUSE_TYPE_INT, "module", muse_module,
2113 MUSE_TYPE_INT, PARAM_DEVICE_TYPE, device_type,
2114 MUSE_TYPE_INT, "pid", pid,
2117 muse_core_ipc_send_msg(sock_fd, sndMsg);
2118 muse_core_msg_json_factory_free(sndMsg);
2120 pc = g_new0(camera_cli_s, 1);
2122 LOGE("camera_cli_s alloc failed");
2123 ret = CAMERA_ERROR_OUT_OF_MEMORY;
2127 pc->cb_info = _client_callback_new(sock_fd);
2128 if (pc->cb_info == NULL) {
2129 LOGE("cb_info alloc failed");
2130 ret = CAMERA_ERROR_OUT_OF_MEMORY;
2134 LOGD("cb info : %d", pc->cb_info->fd);
2136 ret = _client_wait_for_cb_return(api, pc->cb_info, CALLBACK_TIME_OUT);
2137 if (ret == CAMERA_ERROR_NONE) {
2138 intptr_t handle = 0;
2139 muse_camera_msg_get_pointer(handle, pc->cb_info->recv_msg);
2141 LOGE("Receiving Handle Failed!!");
2142 ret = CAMERA_ERROR_INVALID_OPERATION;
2146 pc->remote_handle = handle;
2147 pc->cb_info->bufmgr = bufmgr;
2149 ret = camera_set_display((camera_h)pc, CAMERA_DISPLAY_TYPE_NONE, NULL);
2150 if (ret != CAMERA_ERROR_NONE) {
2151 LOGE("init display failed 0x%x", ret);
2155 LOGD("camera create 0x%x", pc->remote_handle);
2156 *camera = (camera_h)pc;
2164 tbm_bufmgr_deinit(bufmgr);
2168 _client_callback_destroy(pc->cb_info);
2174 LOGE("camera create error : 0x%x", ret);
2179 int camera_destroy(camera_h camera)
2181 if (camera == NULL) {
2182 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2183 return CAMERA_ERROR_INVALID_PARAMETER;
2186 int ret = CAMERA_ERROR_NONE;
2187 muse_camera_api_e api = MUSE_CAMERA_API_DESTROY;
2188 camera_cli_s *pc = (camera_cli_s *)camera;
2193 if (pc->cb_info == NULL) {
2194 LOGE("cb_info NULL, INVALID_PARAMETER");
2195 return CAMERA_ERROR_INVALID_PARAMETER;
2198 sock_fd = pc->cb_info->fd;
2200 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2201 if (ret == CAMERA_ERROR_NONE) {
2202 _camera_remove_idle_event_all(pc->cb_info);
2203 _client_callback_destroy(pc->cb_info);
2209 LOGE("camera destroy error : 0x%x", ret);
2215 int camera_start_preview(camera_h camera)
2217 int ret = CAMERA_ERROR_NONE;
2218 muse_camera_api_e api = MUSE_CAMERA_API_START_PREVIEW;
2219 camera_cli_s *pc = (camera_cli_s *)camera;
2222 if (camera == NULL) {
2223 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2224 return CAMERA_ERROR_INVALID_PARAMETER;
2227 if (pc->cb_info == NULL) {
2228 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2229 return CAMERA_ERROR_INVALID_PARAMETER;
2234 sock_fd = pc->cb_info->fd;
2236 muse_camera_msg_send_longtime(api, sock_fd, pc->cb_info, ret);
2238 if (ret != CAMERA_ERROR_NONE) {
2239 LOGE("start preview failed 0x%x", ret);
2241 } else if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
2242 ret = _camera_start_evas_rendering(camera);
2245 LOGD("ret : 0x%x", ret);
2247 return CAMERA_ERROR_NONE;
2250 int camera_stop_preview(camera_h camera)
2252 int ret = CAMERA_ERROR_NONE;
2254 camera_cli_s *pc = NULL;
2255 muse_camera_api_e api = MUSE_CAMERA_API_STOP_PREVIEW;
2257 if (camera == NULL) {
2258 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2259 return CAMERA_ERROR_INVALID_PARAMETER;
2262 pc = (camera_cli_s *)camera;
2264 if (pc->cb_info == NULL) {
2265 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2266 return CAMERA_ERROR_INVALID_PARAMETER;
2269 sock_fd = pc->cb_info->fd;
2273 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
2274 camera_state_e current_state = CAMERA_STATE_NONE;
2276 ret = camera_get_state(camera, ¤t_state);
2277 if (ret != CAMERA_ERROR_NONE) {
2278 LOGE("failed to get current state 0x%x", ret);
2282 if (current_state == CAMERA_STATE_PREVIEW) {
2283 ret = _camera_stop_evas_rendering(camera, false);
2284 if (ret != CAMERA_ERROR_NONE)
2289 /* send stop preview message */
2290 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2292 LOGD("ret : 0x%x", ret);
2297 int camera_start_capture(camera_h camera, camera_capturing_cb capturing_cb, camera_capture_completed_cb completed_cb, void *user_data)
2299 if (camera == NULL) {
2300 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2301 return CAMERA_ERROR_INVALID_PARAMETER;
2303 int ret = CAMERA_ERROR_NONE;
2305 camera_cli_s *pc = (camera_cli_s *)camera;
2306 muse_camera_api_e api = MUSE_CAMERA_API_START_CAPTURE;
2308 int is_capturing_cb = 0;
2309 int is_completed_cb = 0;
2310 LOGD("Enter, handle :%x", pc->remote_handle);
2312 if (pc->cb_info == NULL) {
2313 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2314 return CAMERA_ERROR_INVALID_PARAMETER;
2317 sock_fd = pc->cb_info->fd;
2319 if (capturing_cb != NULL) {
2320 is_capturing_cb = 1;
2321 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = capturing_cb;
2322 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = user_data;
2325 if (completed_cb != NULL) {
2326 is_completed_cb = 1;
2327 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = completed_cb;
2328 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = user_data;
2331 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, is_capturing_cb, INT, is_completed_cb);
2332 LOGD("is_capturing_cb :%d, is_completed_cb : %d", is_capturing_cb, is_completed_cb);
2333 LOGD("ret : 0x%x", ret);
2337 bool camera_is_supported_continuous_capture(camera_h camera)
2339 if (camera == NULL) {
2340 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2344 int ret = CAMERA_ERROR_NONE;
2345 camera_cli_s *pc = (camera_cli_s *)camera;
2346 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_CONTINUOUS_CAPTURE;
2349 if (pc->cb_info == NULL) {
2350 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2351 return CAMERA_ERROR_INVALID_PARAMETER;
2354 sock_fd = pc->cb_info->fd;
2356 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2357 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2358 LOGD("ret : 0x%x", ret);
2362 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)
2364 if (camera == NULL) {
2365 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2366 return CAMERA_ERROR_INVALID_PARAMETER;
2369 int ret = CAMERA_ERROR_NONE;
2371 camera_cli_s *pc = (camera_cli_s *)camera;
2372 muse_camera_api_e api = MUSE_CAMERA_API_START_CONTINUOUS_CAPTURE;
2374 LOGD("Enter, handle :%x", pc->remote_handle);
2377 if (pc->cb_info == NULL) {
2378 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2379 return CAMERA_ERROR_INVALID_PARAMETER;
2381 sock_fd = pc->cb_info->fd;
2383 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = capturing_cb;
2384 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = user_data;
2385 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = completed_cb;
2387 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, count, INT, interval);
2389 LOGD("ret : 0x%x", ret);
2394 int camera_stop_continuous_capture(camera_h camera)
2396 if (camera == NULL) {
2397 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2398 return CAMERA_ERROR_INVALID_PARAMETER;
2402 int ret = CAMERA_ERROR_NONE;
2404 camera_cli_s *pc = (camera_cli_s *)camera;
2405 muse_camera_api_e api = MUSE_CAMERA_API_STOP_CONTINUOUS_CAPTURE;
2406 LOGD("Enter, handle :%x", pc->remote_handle);
2408 if (pc->cb_info == NULL) {
2409 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2410 return CAMERA_ERROR_INVALID_PARAMETER;
2412 sock_fd = pc->cb_info->fd;
2413 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2414 LOGD("ret : 0x%x", ret);
2418 bool camera_is_supported_face_detection(camera_h camera)
2420 if (camera == NULL) {
2421 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2424 int ret = CAMERA_ERROR_NONE;
2426 camera_cli_s *pc = (camera_cli_s *)camera;
2427 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_FACE_DETECTION;
2429 if (pc->cb_info == NULL) {
2430 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2431 return CAMERA_ERROR_INVALID_PARAMETER;
2433 sock_fd = pc->cb_info->fd;
2435 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2436 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2437 LOGD("ret : 0x%x", ret);
2441 bool camera_is_supported_zero_shutter_lag(camera_h camera)
2443 if (camera == NULL) {
2444 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2447 int ret = CAMERA_ERROR_NONE;
2449 camera_cli_s *pc = (camera_cli_s *)camera;
2450 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_ZERO_SHUTTER_LAG;
2452 if (pc->cb_info == NULL) {
2453 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2454 return CAMERA_ERROR_INVALID_PARAMETER;
2456 sock_fd = pc->cb_info->fd;
2458 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2459 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2460 LOGD("ret : 0x%x", ret);
2464 bool camera_is_supported_media_packet_preview_cb(camera_h camera)
2466 if (camera == NULL) {
2467 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2471 int ret = CAMERA_ERROR_NONE;
2473 camera_cli_s *pc = (camera_cli_s *)camera;
2474 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_MEDIA_PACKET_PREVIEW_CB;
2476 if (pc->cb_info == NULL) {
2477 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2478 return CAMERA_ERROR_INVALID_PARAMETER;
2480 sock_fd = pc->cb_info->fd;
2482 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2483 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2484 LOGD("ret : 0x%x", ret);
2488 int camera_get_device_count(camera_h camera, int *device_count)
2490 if (camera == NULL || device_count == NULL) {
2491 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2492 return CAMERA_ERROR_INVALID_PARAMETER;
2494 int ret = CAMERA_ERROR_NONE;
2496 camera_cli_s *pc = (camera_cli_s *)camera;
2497 muse_camera_api_e api = MUSE_CAMERA_API_GET_DEVICE_COUNT;
2499 if (pc->cb_info == NULL) {
2500 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2501 return CAMERA_ERROR_INVALID_PARAMETER;
2503 sock_fd = pc->cb_info->fd;
2504 int get_device_count;
2506 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2507 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2509 if (ret == CAMERA_ERROR_NONE) {
2510 muse_camera_msg_get(get_device_count, pc->cb_info->recv_msg);
2511 *device_count = get_device_count;
2513 LOGD("ret : 0x%x", ret);
2517 int camera_start_face_detection(camera_h camera, camera_face_detected_cb callback, void *user_data)
2519 if (camera == NULL) {
2520 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2521 return CAMERA_ERROR_INVALID_PARAMETER;
2524 int ret = CAMERA_ERROR_NONE;
2526 camera_cli_s *pc = (camera_cli_s *)camera;
2527 muse_camera_api_e api = MUSE_CAMERA_API_START_FACE_DETECTION;
2529 LOGD("Enter, handle :%x", pc->remote_handle);
2531 if (pc->cb_info == NULL) {
2532 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2533 return CAMERA_ERROR_INVALID_PARAMETER;
2535 sock_fd = pc->cb_info->fd;
2536 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION] = callback;
2537 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION] = user_data;
2539 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2540 LOGD("ret : 0x%x", ret);
2544 int camera_stop_face_detection(camera_h camera)
2546 if (camera == NULL) {
2547 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2548 return CAMERA_ERROR_INVALID_PARAMETER;
2551 int ret = CAMERA_ERROR_NONE;
2553 camera_cli_s *pc = (camera_cli_s *)camera;
2554 muse_camera_api_e api = MUSE_CAMERA_API_STOP_FACE_DETECTION;
2555 LOGD("Enter, handle :%x", pc->remote_handle);
2557 if (pc->cb_info == NULL) {
2558 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2559 return CAMERA_ERROR_INVALID_PARAMETER;
2561 sock_fd = pc->cb_info->fd;
2562 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2563 LOGD("ret : 0x%x", ret);
2567 int camera_get_state(camera_h camera, camera_state_e *state)
2569 if (camera == NULL || state == NULL) {
2570 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2571 return CAMERA_ERROR_INVALID_PARAMETER;
2573 int ret = CAMERA_ERROR_NONE;
2575 camera_cli_s *pc = (camera_cli_s *)camera;
2576 muse_camera_api_e api = MUSE_CAMERA_API_GET_STATE;
2578 if (pc->cb_info == NULL) {
2579 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2580 return CAMERA_ERROR_INVALID_PARAMETER;
2582 sock_fd = pc->cb_info->fd;
2585 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2586 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2588 if (ret == CAMERA_ERROR_NONE) {
2589 muse_camera_msg_get(get_state, pc->cb_info->recv_msg);
2590 *state = (camera_state_e)get_state;
2592 LOGD("ret : 0x%x", ret);
2596 int camera_start_focusing(camera_h camera, bool continuous)
2598 if (camera == NULL) {
2599 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2600 return CAMERA_ERROR_INVALID_PARAMETER;
2603 int ret = CAMERA_ERROR_NONE;
2605 camera_cli_s *pc = (camera_cli_s *)camera;
2606 muse_camera_api_e api = MUSE_CAMERA_API_START_FOCUSING;
2608 if (pc->cb_info == NULL) {
2609 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2610 return CAMERA_ERROR_INVALID_PARAMETER;
2612 sock_fd = pc->cb_info->fd;
2613 int is_continuous = (int)continuous;
2615 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2616 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, is_continuous);
2617 LOGD("ret : 0x%x", ret);
2621 int camera_cancel_focusing(camera_h camera)
2623 if (camera == NULL) {
2624 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2625 return CAMERA_ERROR_INVALID_PARAMETER;
2628 int ret = CAMERA_ERROR_NONE;
2630 camera_cli_s *pc = (camera_cli_s *)camera;
2631 muse_camera_api_e api = MUSE_CAMERA_API_CANCEL_FOCUSING;
2633 if (pc->cb_info == NULL) {
2634 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2635 return CAMERA_ERROR_INVALID_PARAMETER;
2637 sock_fd = pc->cb_info->fd;
2639 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2640 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2641 LOGD("ret : 0x%x", ret);
2645 int camera_set_display(camera_h camera, camera_display_type_e type, camera_display_h display)
2647 int ret = CAMERA_ERROR_NONE;
2648 void *set_display_handle = NULL;
2649 Evas_Object *obj = NULL;
2650 const char *object_type = NULL;
2652 camera_wl_info_s *wl_info = NULL;
2653 #endif /* HAVE_WAYLAND */
2654 camera_cli_s *pc = (camera_cli_s *)camera;
2655 camera_cb_info_s *cb_info = NULL;
2656 muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY;
2657 camera_state_e current_state = CAMERA_STATE_NONE;
2660 if (camera == NULL) {
2661 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2662 return CAMERA_ERROR_INVALID_PARAMETER;
2665 if (type < CAMERA_DISPLAY_TYPE_OVERLAY || type > CAMERA_DISPLAY_TYPE_NONE) {
2666 LOGE("invalid type %d", type);
2667 return CAMERA_ERROR_INVALID_PARAMETER;
2670 if (type != CAMERA_DISPLAY_TYPE_NONE && display == NULL) {
2671 LOGE("display type[%d] is not NONE, but display handle is NULL", type);
2672 return CAMERA_ERROR_INVALID_PARAMETER;
2675 if (pc->cb_info == NULL) {
2676 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2677 return CAMERA_ERROR_INVALID_PARAMETER;
2680 cb_info = (camera_cb_info_s *)pc->cb_info;
2681 sock_fd = cb_info->fd;
2683 ret = camera_get_state(camera, ¤t_state);
2684 if (ret != CAMERA_ERROR_NONE) {
2685 LOGE("failed to get current state 0x%x", ret);
2689 if (current_state != CAMERA_STATE_CREATED) {
2690 LOGE("INVALID_STATE : current %d", current_state);
2691 return CAMERA_ERROR_INVALID_STATE;
2694 LOGD("Enter, remote_handle : %x display : 0x%x", pc->remote_handle, display);
2696 if (type == CAMERA_DISPLAY_TYPE_NONE) {
2697 set_display_handle = 0;
2698 LOGD("display type NONE");
2700 obj = (Evas_Object *)display;
2701 object_type = evas_object_type_get(obj);
2703 if (type == CAMERA_DISPLAY_TYPE_OVERLAY && !strcmp(object_type, "elm_win")) {
2705 /* get wayland parent id */
2706 if (_get_wl_info(obj, &pc->wl_info) != CAMERA_ERROR_NONE) {
2707 LOGE("failed to get wayland info");
2708 return CAMERA_ERROR_INVALID_OPERATION;
2711 set_display_handle = (void *)&pc->wl_info;
2712 #else /* HAVE_WAYLAND */
2713 /* x window overlay surface */
2714 set_display_handle = (void *)elm_win_xwindow_get(obj);
2715 #endif /* HAVE_WAYLAND */
2716 LOGD("display type OVERLAY : handle %p", set_display_handle);
2717 } else if (type == CAMERA_DISPLAY_TYPE_EVAS && !strcmp(object_type, "image")) {
2718 /* evas object surface */
2719 set_display_handle = (void *)display;
2720 LOGD("display type EVAS : handle %p", set_display_handle);
2722 g_mutex_lock(&cb_info->evas_mutex);
2724 if (cb_info->evas_info) {
2725 LOGW("destroy existed evas renderer %p", cb_info->evas_info);
2726 ret = mm_evas_renderer_destroy(&cb_info->evas_info);
2727 if (ret != MM_ERROR_NONE) {
2728 LOGE("failed to destroy evas renderer %p", cb_info->evas_info);
2729 g_mutex_unlock(&cb_info->evas_mutex);
2730 return CAMERA_ERROR_INVALID_OPERATION;
2734 /* create evas renderer */
2735 ret = mm_evas_renderer_create(&cb_info->evas_info, (Evas_Object *)set_display_handle);
2736 if (ret == MM_ERROR_NONE) {
2737 camera_flip_e flip = CAMERA_FLIP_NONE;
2738 camera_display_mode_e mode = CAMERA_DISPLAY_MODE_LETTER_BOX;
2739 camera_rotation_e rotation = CAMERA_ROTATION_NONE;
2742 camera_get_display_flip(camera, &flip);
2743 camera_get_display_mode(camera, &mode);
2744 camera_get_display_rotation(camera, &rotation);
2745 camera_is_display_visible(camera, &visible);
2747 LOGD("current setting : flip %d, mode %d, rotation %d, visible %d",
2748 flip, mode, rotation, visible);
2750 ret = mm_evas_renderer_set_flip(cb_info->evas_info, flip);
2751 ret |= mm_evas_renderer_set_geometry(cb_info->evas_info, mode);
2752 ret |= mm_evas_renderer_set_rotation(cb_info->evas_info, rotation);
2753 ret |= mm_evas_renderer_set_visible(cb_info->evas_info, visible);
2756 g_mutex_unlock(&cb_info->evas_mutex);
2758 if (ret != MM_ERROR_NONE) {
2759 LOGE("mm_evas_renderer error 0x%x", ret);
2760 return CAMERA_ERROR_INVALID_OPERATION;
2764 LOGE("unknown evas object [%p,%s] or type [%d] mismatch", obj, object_type, type);
2765 return CAMERA_ERROR_INVALID_PARAMETER;
2768 LOGE("failed to get evas object type from %p", obj);
2769 return CAMERA_ERROR_INVALID_PARAMETER;
2773 pc->display_handle = (intptr_t)set_display_handle;
2775 if (type == CAMERA_DISPLAY_TYPE_OVERLAY) {
2777 wl_info = &pc->wl_info;
2778 muse_camera_msg_send_array_and_value(api, sock_fd, cb_info, ret,
2779 wl_info, 5, sizeof(int), INT, type);
2781 LOGD("wayland parent id : %d, window %d,%d,%dx%d",
2782 wl_info->parent_id, wl_info->window_x, wl_info->window_y,
2783 wl_info->window_width, wl_info->window_height);
2784 #else /* HAVE_WAYLAND */
2785 muse_camera_msg_send2(api, sock_fd, cb_info, ret, INT, type, INT, set_display_handle);
2787 LOGD("x id : %d", (int)set_display_handle);
2788 #endif /* HAVE_WAYLAND */
2790 muse_camera_msg_send1(api, sock_fd, cb_info, ret, INT, type);
2792 if (ret != CAMERA_ERROR_NONE)
2793 LOGE("set display error 0x%x", ret);
2794 else if (type == CAMERA_DISPLAY_TYPE_EVAS)
2795 SET_PREVIEW_CB_TYPE(cb_info, PREVIEW_CB_TYPE_EVAS);
2800 int camera_set_preview_resolution(camera_h camera, int width, int height)
2802 if (camera == NULL) {
2803 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2804 return CAMERA_ERROR_INVALID_PARAMETER;
2806 int ret = CAMERA_ERROR_NONE;
2808 camera_cli_s *pc = (camera_cli_s *)camera;
2809 muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_RESOLUTION;
2811 if (pc->cb_info == NULL) {
2812 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2813 return CAMERA_ERROR_INVALID_PARAMETER;
2815 sock_fd = pc->cb_info->fd;
2817 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2818 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, width, INT, height);
2819 LOGD("ret : 0x%x", ret);
2824 int camera_set_capture_resolution(camera_h camera, int width, int height)
2826 if (camera == NULL) {
2827 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2828 return CAMERA_ERROR_INVALID_PARAMETER;
2831 int ret = CAMERA_ERROR_NONE;
2833 camera_cli_s *pc = (camera_cli_s *)camera;
2834 muse_camera_api_e api = MUSE_CAMERA_API_SET_CAPTURE_RESOLUTION;
2836 if (pc->cb_info == NULL) {
2837 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2838 return CAMERA_ERROR_INVALID_PARAMETER;
2840 sock_fd = pc->cb_info->fd;
2842 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2843 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, width, INT, height);
2844 LOGD("ret : 0x%x", ret);
2848 int camera_set_capture_format(camera_h camera, camera_pixel_format_e format)
2850 if (camera == NULL) {
2851 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2852 return CAMERA_ERROR_INVALID_PARAMETER;
2855 int ret = CAMERA_ERROR_NONE;
2856 int set_format = (int)format;
2858 camera_cli_s *pc = (camera_cli_s *)camera;
2859 muse_camera_api_e api = MUSE_CAMERA_API_SET_CAPTURE_FORMAT;
2861 if (pc->cb_info == NULL) {
2862 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2863 return CAMERA_ERROR_INVALID_PARAMETER;
2865 sock_fd = pc->cb_info->fd;
2867 LOGD("Enter, remote_handle : %x, capture_format: %d", pc->remote_handle, set_format);
2868 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_format);
2869 LOGD("ret : 0x%x", ret);
2873 int camera_set_preview_format(camera_h camera, camera_pixel_format_e format)
2875 if (camera == NULL) {
2876 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2877 return CAMERA_ERROR_INVALID_PARAMETER;
2880 int ret = CAMERA_ERROR_NONE;
2881 int set_format = (int)format;
2883 camera_cli_s *pc = (camera_cli_s *)camera;
2884 muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_FORMAT;
2886 if (pc->cb_info == NULL) {
2887 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2888 return CAMERA_ERROR_INVALID_PARAMETER;
2890 sock_fd = pc->cb_info->fd;
2892 LOGD("Enter, remote_handle : %x, capture_format: %d", pc->remote_handle, set_format);
2893 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_format);
2894 LOGD("ret : 0x%x", ret);
2898 int camera_get_preview_resolution(camera_h camera, int *width, int *height)
2900 if (camera == NULL || width == NULL || height == NULL) {
2901 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2902 return CAMERA_ERROR_INVALID_PARAMETER;
2906 int ret = CAMERA_ERROR_NONE;
2908 camera_cli_s *pc = (camera_cli_s *)camera;
2909 muse_camera_api_e api = MUSE_CAMERA_API_GET_PREVIEW_RESOLUTION;
2911 if (pc->cb_info == NULL) {
2912 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2913 return CAMERA_ERROR_INVALID_PARAMETER;
2915 sock_fd = pc->cb_info->fd;
2919 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2920 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2922 if (ret == CAMERA_ERROR_NONE) {
2923 muse_camera_msg_get(get_width, pc->cb_info->recv_msg);
2924 muse_camera_msg_get(get_height, pc->cb_info->recv_msg);
2926 *height = get_height;
2928 LOGD("ret : 0x%x", ret);
2932 int camera_set_display_rotation(camera_h camera, camera_rotation_e rotation)
2934 int ret = CAMERA_ERROR_NONE;
2935 int set_rotation = (int)rotation;
2936 camera_cli_s *pc = NULL;
2938 if (camera == NULL) {
2939 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2940 return CAMERA_ERROR_INVALID_PARAMETER;
2943 if (rotation < CAMERA_ROTATION_NONE || rotation > CAMERA_ROTATION_270) {
2944 LOGE("Invalid rotation %d", rotation);
2945 return CAMERA_ERROR_INVALID_PARAMETER;
2948 pc = (camera_cli_s *)camera;
2950 if (pc->cb_info == NULL) {
2951 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2952 return CAMERA_ERROR_INVALID_PARAMETER;
2955 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
2956 g_mutex_lock(&pc->cb_info->evas_mutex);
2958 ret = mm_evas_renderer_set_rotation(pc->cb_info->evas_info, rotation);
2960 g_mutex_unlock(&pc->cb_info->evas_mutex);
2962 if (ret != MM_ERROR_NONE) {
2963 LOGE("failed to set rotation for evas surface 0x%x", ret);
2964 return CAMERA_ERROR_INVALID_OPERATION;
2968 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_ROTATION,
2969 pc->cb_info->fd, pc->cb_info, ret, INT, set_rotation);
2974 int camera_get_display_rotation(camera_h camera, camera_rotation_e *rotation)
2976 int ret = CAMERA_ERROR_NONE;
2977 int get_rotation = CAMERA_ROTATION_NONE;
2978 camera_cli_s *pc = NULL;
2980 if (camera == NULL || rotation == NULL) {
2981 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2982 return CAMERA_ERROR_INVALID_PARAMETER;
2985 pc = (camera_cli_s *)camera;
2987 if (pc->cb_info == NULL) {
2988 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2989 return CAMERA_ERROR_INVALID_PARAMETER;
2992 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
2993 g_mutex_lock(&pc->cb_info->evas_mutex);
2995 ret = mm_evas_renderer_get_rotation(pc->cb_info->evas_info, (int *)rotation);
2997 g_mutex_unlock(&pc->cb_info->evas_mutex);
2999 if (ret != MM_ERROR_NONE) {
3000 LOGE("failed to get rotation for evas surface 0x%x", ret);
3001 return CAMERA_ERROR_INVALID_OPERATION;
3004 muse_camera_msg_send(MUSE_CAMERA_API_GET_DISPLAY_ROTATION,
3005 pc->cb_info->fd, pc->cb_info, ret);
3007 if (ret == CAMERA_ERROR_NONE) {
3008 muse_camera_msg_get(get_rotation, pc->cb_info->recv_msg);
3009 *rotation = (camera_rotation_e)get_rotation;
3016 int camera_set_display_flip(camera_h camera, camera_flip_e flip)
3018 int ret = CAMERA_ERROR_NONE;
3019 int set_flip = (int)flip;
3020 camera_cli_s *pc = NULL;
3022 if (camera == NULL) {
3023 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3024 return CAMERA_ERROR_INVALID_PARAMETER;
3027 if (flip < CAMERA_FLIP_NONE || flip > CAMERA_FLIP_BOTH) {
3028 LOGE("Invalid flip %d", flip);
3029 return CAMERA_ERROR_INVALID_PARAMETER;
3032 pc = (camera_cli_s *)camera;
3034 if (pc->cb_info == NULL) {
3035 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3036 return CAMERA_ERROR_INVALID_PARAMETER;
3039 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
3040 g_mutex_lock(&pc->cb_info->evas_mutex);
3042 ret = mm_evas_renderer_set_flip(pc->cb_info->evas_info, flip);
3044 g_mutex_unlock(&pc->cb_info->evas_mutex);
3046 if (ret != MM_ERROR_NONE) {
3047 LOGE("failed to set flip for evas surface 0x%x", ret);
3048 return CAMERA_ERROR_INVALID_OPERATION;
3052 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_FLIP,
3053 pc->cb_info->fd, pc->cb_info, ret, INT, set_flip);
3058 int camera_get_display_flip(camera_h camera, camera_flip_e *flip)
3060 int ret = CAMERA_ERROR_NONE;
3061 int get_flip = CAMERA_FLIP_NONE;
3062 camera_cli_s *pc = NULL;
3064 if (camera == NULL || flip == NULL) {
3065 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3066 return CAMERA_ERROR_INVALID_PARAMETER;
3069 pc = (camera_cli_s *)camera;
3071 if (pc->cb_info == NULL) {
3072 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3073 return CAMERA_ERROR_INVALID_PARAMETER;
3076 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
3077 g_mutex_lock(&pc->cb_info->evas_mutex);
3079 ret = mm_evas_renderer_get_flip(pc->cb_info->evas_info, (int *)flip);
3081 g_mutex_unlock(&pc->cb_info->evas_mutex);
3083 if (ret != MM_ERROR_NONE) {
3084 LOGE("failed to get flip for evas surface 0x%x", ret);
3085 return CAMERA_ERROR_INVALID_OPERATION;
3088 muse_camera_msg_send(MUSE_CAMERA_API_GET_DISPLAY_FLIP,
3089 pc->cb_info->fd, pc->cb_info, ret);
3091 if (ret == CAMERA_ERROR_NONE) {
3092 muse_camera_msg_get(get_flip, pc->cb_info->recv_msg);
3093 *flip = (camera_flip_e)get_flip;
3100 int camera_set_display_visible(camera_h camera, bool visible)
3102 int ret = CAMERA_ERROR_NONE;
3103 int set_visible = (int)visible;
3104 camera_cli_s *pc = NULL;
3106 if (camera == NULL) {
3107 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3108 return CAMERA_ERROR_INVALID_PARAMETER;
3111 pc = (camera_cli_s *)camera;
3113 if (pc->cb_info == NULL) {
3114 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3115 return CAMERA_ERROR_INVALID_PARAMETER;
3118 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
3119 g_mutex_lock(&pc->cb_info->evas_mutex);
3121 ret = mm_evas_renderer_set_visible(pc->cb_info->evas_info, visible);
3123 g_mutex_unlock(&pc->cb_info->evas_mutex);
3125 if (ret != MM_ERROR_NONE) {
3126 LOGE("failed to set visible for evas surface 0x%x", ret);
3127 return CAMERA_ERROR_INVALID_OPERATION;
3131 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_VISIBLE,
3132 pc->cb_info->fd, pc->cb_info, ret, INT, set_visible);
3137 int camera_is_display_visible(camera_h camera, bool *visible)
3139 int ret = CAMERA_ERROR_NONE;
3140 int get_visible = true;
3141 camera_cli_s *pc = NULL;
3143 if (camera == NULL || visible == NULL) {
3144 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3145 return CAMERA_ERROR_INVALID_PARAMETER;
3148 pc = (camera_cli_s *)camera;
3150 if (pc->cb_info == NULL) {
3151 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3152 return CAMERA_ERROR_INVALID_PARAMETER;
3155 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
3156 g_mutex_lock(&pc->cb_info->evas_mutex);
3158 ret = mm_evas_renderer_get_visible(pc->cb_info->evas_info, visible);
3160 g_mutex_unlock(&pc->cb_info->evas_mutex);
3162 if (ret != MM_ERROR_NONE) {
3163 LOGE("failed to get visible for evas surface 0x%x", ret);
3164 return CAMERA_ERROR_INVALID_OPERATION;
3167 muse_camera_msg_send(MUSE_CAMERA_API_IS_DISPLAY_VISIBLE,
3168 pc->cb_info->fd, pc->cb_info, ret);
3170 if (ret == CAMERA_ERROR_NONE) {
3171 muse_camera_msg_get(get_visible, pc->cb_info->recv_msg);
3172 *visible = (bool)get_visible;
3179 int camera_set_display_mode(camera_h camera, camera_display_mode_e mode)
3181 int ret = CAMERA_ERROR_NONE;
3182 int set_mode = (int)mode;
3183 camera_cli_s *pc = NULL;
3185 if (camera == NULL) {
3186 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3187 return CAMERA_ERROR_INVALID_PARAMETER;
3190 if (mode < CAMERA_DISPLAY_MODE_LETTER_BOX || mode > CAMERA_DISPLAY_MODE_CUSTOM_ROI) {
3191 LOGE("Invalid mode %d", mode);
3192 return CAMERA_ERROR_INVALID_PARAMETER;
3195 pc = (camera_cli_s *)camera;
3197 if (pc->cb_info == NULL) {
3198 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3199 return CAMERA_ERROR_INVALID_PARAMETER;
3202 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
3203 g_mutex_lock(&pc->cb_info->evas_mutex);
3205 ret = mm_evas_renderer_set_geometry(pc->cb_info->evas_info, mode);
3207 g_mutex_unlock(&pc->cb_info->evas_mutex);
3209 if (ret != MM_ERROR_NONE) {
3210 LOGE("failed to set geometry for evas surface 0x%x", ret);
3211 return CAMERA_ERROR_INVALID_OPERATION;
3215 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_MODE,
3216 pc->cb_info->fd, pc->cb_info, ret, INT, set_mode);
3221 int camera_get_display_mode(camera_h camera, camera_display_mode_e *mode)
3223 int ret = CAMERA_ERROR_NONE;
3224 int get_mode = CAMERA_DISPLAY_MODE_LETTER_BOX;
3225 camera_cli_s *pc = NULL;
3227 if (camera == NULL || mode == NULL) {
3228 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3229 return CAMERA_ERROR_INVALID_PARAMETER;
3232 pc = (camera_cli_s *)camera;
3234 if (pc->cb_info == NULL) {
3235 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3236 return CAMERA_ERROR_INVALID_PARAMETER;
3239 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
3240 g_mutex_lock(&pc->cb_info->evas_mutex);
3242 ret = mm_evas_renderer_get_geometry(pc->cb_info->evas_info, (int *)mode);
3244 g_mutex_unlock(&pc->cb_info->evas_mutex);
3246 if (ret != MM_ERROR_NONE) {
3247 LOGE("failed to get geometry for evas surface 0x%x", ret);
3248 return CAMERA_ERROR_INVALID_OPERATION;
3251 muse_camera_msg_send(MUSE_CAMERA_API_GET_DISPLAY_MODE,
3252 pc->cb_info->fd, pc->cb_info, ret);
3254 if (ret == CAMERA_ERROR_NONE) {
3255 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
3256 *mode = (camera_display_mode_e)get_mode;
3263 int camera_get_capture_resolution(camera_h camera, int *width, int *height)
3265 if (camera == NULL || width == NULL || height == NULL) {
3266 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3267 return CAMERA_ERROR_INVALID_PARAMETER;
3269 int ret = CAMERA_ERROR_NONE;
3271 camera_cli_s *pc = (camera_cli_s *)camera;
3272 muse_camera_api_e api = MUSE_CAMERA_API_GET_CAPTURE_RESOLUTION;
3274 if (pc->cb_info == NULL) {
3275 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3276 return CAMERA_ERROR_INVALID_PARAMETER;
3278 sock_fd = pc->cb_info->fd;
3282 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3283 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3285 if (ret == CAMERA_ERROR_NONE) {
3286 muse_camera_msg_get(get_width, pc->cb_info->recv_msg);
3287 muse_camera_msg_get(get_height, pc->cb_info->recv_msg);
3289 *height = get_height;
3291 LOGD("ret : 0x%x", ret);
3295 int camera_get_capture_format(camera_h camera, camera_pixel_format_e *format)
3297 if (camera == NULL || format == NULL) {
3298 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3299 return CAMERA_ERROR_INVALID_PARAMETER;
3301 int ret = CAMERA_ERROR_NONE;
3303 camera_cli_s *pc = (camera_cli_s *)camera;
3304 muse_camera_api_e api = MUSE_CAMERA_API_GET_CAPTURE_FORMAT;
3307 if (pc->cb_info == NULL) {
3308 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3309 return CAMERA_ERROR_INVALID_PARAMETER;
3311 sock_fd = pc->cb_info->fd;
3313 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3314 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3316 if (ret == CAMERA_ERROR_NONE) {
3317 muse_camera_msg_get(get_format, pc->cb_info->recv_msg);
3318 *format = (camera_pixel_format_e)get_format;
3320 LOGD("ret : 0x%x", ret);
3324 int camera_get_preview_format(camera_h camera, camera_pixel_format_e *format)
3326 if (camera == NULL || format == NULL) {
3327 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3328 return CAMERA_ERROR_INVALID_PARAMETER;
3331 int ret = CAMERA_ERROR_NONE;
3333 camera_cli_s *pc = (camera_cli_s *)camera;
3334 muse_camera_api_e api = MUSE_CAMERA_API_GET_PREVIEW_FORMAT;
3337 if (pc->cb_info == NULL) {
3338 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3339 return CAMERA_ERROR_INVALID_PARAMETER;
3341 sock_fd = pc->cb_info->fd;
3343 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3344 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3346 if (ret == CAMERA_ERROR_NONE) {
3347 muse_camera_msg_get(get_format, pc->cb_info->recv_msg);
3348 *format = (camera_pixel_format_e)get_format;
3350 LOGD("ret : 0x%x", ret);
3354 int camera_get_facing_direction(camera_h camera, camera_facing_direction_e *facing_direciton)
3356 if (camera == NULL || facing_direciton == NULL) {
3357 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3358 return CAMERA_ERROR_INVALID_PARAMETER;
3361 int ret = CAMERA_ERROR_NONE;
3363 camera_cli_s *pc = (camera_cli_s *)camera;
3364 muse_camera_api_e api = MUSE_CAMERA_API_GET_FACING_DIRECTION;
3366 if (pc->cb_info == NULL) {
3367 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3368 return CAMERA_ERROR_INVALID_PARAMETER;
3370 sock_fd = pc->cb_info->fd;
3371 int get_facing_direction;
3373 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3374 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3376 if (ret == CAMERA_ERROR_NONE) {
3377 muse_camera_msg_get(get_facing_direction, pc->cb_info->recv_msg);
3378 *facing_direciton = (camera_facing_direction_e)get_facing_direction;
3380 LOGD("ret : 0x%x", ret);
3384 int camera_set_preview_cb(camera_h camera, camera_preview_cb callback, void *user_data)
3386 if (camera == NULL || callback == NULL) {
3387 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3388 return CAMERA_ERROR_INVALID_PARAMETER;
3390 int ret = CAMERA_ERROR_NONE;
3392 camera_cli_s *pc = (camera_cli_s *)camera;
3393 camera_cb_info_s *cb_info = (camera_cb_info_s *)pc->cb_info;
3395 if (pc->cb_info == NULL) {
3396 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3397 return CAMERA_ERROR_INVALID_PARAMETER;
3399 sock_fd = pc->cb_info->fd;
3400 muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_CB;
3402 LOGD("Enter, handle :%x", pc->remote_handle);
3404 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = callback;
3405 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = user_data;
3406 SET_PREVIEW_CB_TYPE(cb_info, PREVIEW_CB_TYPE_USER);
3408 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3409 LOGD("ret : 0x%x", ret);
3413 int camera_unset_preview_cb(camera_h camera)
3415 if (camera == NULL) {
3416 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3417 return CAMERA_ERROR_INVALID_PARAMETER;
3420 int ret = CAMERA_ERROR_NONE;
3422 camera_cli_s *pc = (camera_cli_s *)camera;
3423 camera_cb_info_s *cb_info = (camera_cb_info_s *)pc->cb_info;
3424 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_PREVIEW_CB;
3426 LOGD("Enter, handle :%x", pc->remote_handle);
3429 if (pc->cb_info == NULL) {
3430 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3431 return CAMERA_ERROR_INVALID_PARAMETER;
3433 sock_fd = pc->cb_info->fd;
3434 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = (void *)NULL;
3435 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = (void *)NULL;
3436 UNSET_PREVIEW_CB_TYPE(cb_info, PREVIEW_CB_TYPE_USER);
3438 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3439 LOGD("ret : 0x%x", ret);
3443 int camera_set_media_packet_preview_cb(camera_h camera, camera_media_packet_preview_cb callback, void *user_data)
3445 if (camera == NULL) {
3446 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
3447 return CAMERA_ERROR_INVALID_PARAMETER;
3450 if (camera_is_supported_media_packet_preview_cb(camera) == false) {
3451 LOGE("NOT SUPPORTED");
3452 return CAMERA_ERROR_NOT_SUPPORTED;
3455 if (callback == NULL) {
3456 LOGE("INVALID_PARAMETER(0x%08x) - callback", CAMERA_ERROR_INVALID_PARAMETER);
3457 return CAMERA_ERROR_INVALID_PARAMETER;
3460 int ret = CAMERA_ERROR_NONE;
3462 camera_cli_s *pc = (camera_cli_s *)camera;
3463 muse_camera_api_e api = MUSE_CAMERA_API_SET_MEDIA_PACKET_PREVIEW_CB;
3465 LOGD("Enter, handle :%x", pc->remote_handle);
3468 if (pc->cb_info == NULL) {
3469 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3470 return CAMERA_ERROR_INVALID_PARAMETER;
3472 sock_fd = pc->cb_info->fd;
3473 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = callback;
3474 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = user_data;
3476 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3477 LOGD("ret : 0x%x", ret);
3481 int camera_unset_media_packet_preview_cb(camera_h camera)
3483 if (camera == NULL) {
3484 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3485 return CAMERA_ERROR_INVALID_PARAMETER;
3488 int ret = CAMERA_ERROR_NONE;
3490 camera_cli_s *pc = (camera_cli_s *)camera;
3491 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_MEDIA_PACKET_PREVIEW_CB;
3493 LOGD("Enter, handle :%x", pc->remote_handle);
3496 if (pc->cb_info == NULL) {
3497 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3498 return CAMERA_ERROR_INVALID_PARAMETER;
3500 sock_fd = pc->cb_info->fd;
3501 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = (void *)NULL;
3502 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = (void *)NULL;
3504 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3505 LOGD("ret : 0x%x", ret);
3509 int camera_set_state_changed_cb(camera_h camera, camera_state_changed_cb callback, void *user_data)
3511 if (camera == NULL || callback == NULL) {
3512 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3513 return CAMERA_ERROR_INVALID_PARAMETER;
3515 int ret = CAMERA_ERROR_NONE;
3517 camera_cli_s *pc = (camera_cli_s *)camera;
3518 muse_camera_api_e api = MUSE_CAMERA_API_SET_STATE_CHANGED_CB;
3520 LOGD("Enter, handle :%x", pc->remote_handle);
3523 if (pc->cb_info == NULL) {
3524 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3525 return CAMERA_ERROR_INVALID_PARAMETER;
3527 sock_fd = pc->cb_info->fd;
3528 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = callback;
3529 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = user_data;
3531 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3532 LOGD("ret : 0x%x", ret);
3535 int camera_unset_state_changed_cb(camera_h camera)
3537 if (camera == NULL) {
3538 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3539 return CAMERA_ERROR_INVALID_PARAMETER;
3541 int ret = CAMERA_ERROR_NONE;
3543 camera_cli_s *pc = (camera_cli_s *)camera;
3544 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_STATE_CHANGED_CB;
3546 LOGD("Enter, handle :%x", pc->remote_handle);
3549 if (pc->cb_info == NULL) {
3550 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3551 return CAMERA_ERROR_INVALID_PARAMETER;
3553 sock_fd = pc->cb_info->fd;
3554 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = (void *)NULL;
3555 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = (void *)NULL;
3557 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3558 LOGD("ret : 0x%x", ret);
3562 int camera_set_interrupted_cb(camera_h camera, camera_interrupted_cb callback, void *user_data)
3564 if (camera == NULL || callback == NULL) {
3565 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3566 return CAMERA_ERROR_INVALID_PARAMETER;
3568 int ret = CAMERA_ERROR_NONE;
3570 camera_cli_s *pc = (camera_cli_s *)camera;
3571 muse_camera_api_e api = MUSE_CAMERA_API_SET_INTERRUPTED_CB;
3573 LOGD("Enter, handle :%x", pc->remote_handle);
3576 if (pc->cb_info == NULL) {
3577 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3578 return CAMERA_ERROR_INVALID_PARAMETER;
3580 sock_fd = pc->cb_info->fd;
3581 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = callback;
3582 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = user_data;
3584 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3585 LOGD("ret : 0x%x", ret);
3589 int camera_unset_interrupted_cb(camera_h camera)
3591 if (camera == NULL) {
3592 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3593 return CAMERA_ERROR_INVALID_PARAMETER;
3595 int ret = CAMERA_ERROR_NONE;
3597 camera_cli_s *pc = (camera_cli_s *)camera;
3598 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_INTERRUPTED_CB;
3600 LOGD("Enter, handle :%x", pc->remote_handle);
3603 if (pc->cb_info == NULL) {
3604 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3605 return CAMERA_ERROR_INVALID_PARAMETER;
3607 sock_fd = pc->cb_info->fd;
3608 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = (void *)NULL;
3609 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = (void *)NULL;
3611 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3612 LOGD("ret : 0x%x", ret);
3616 int camera_set_focus_changed_cb(camera_h camera, camera_focus_changed_cb callback, void *user_data)
3618 if (camera == NULL || callback == NULL) {
3619 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3620 return CAMERA_ERROR_INVALID_PARAMETER;
3622 int ret = CAMERA_ERROR_NONE;
3624 camera_cli_s *pc = (camera_cli_s *)camera;
3625 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOCUS_CHANGED_CB;
3627 LOGD("Enter, handle :%x", pc->remote_handle);
3630 if (pc->cb_info == NULL) {
3631 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3632 return CAMERA_ERROR_INVALID_PARAMETER;
3634 sock_fd = pc->cb_info->fd;
3635 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = callback;
3636 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = user_data;
3638 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3639 LOGD("ret : 0x%x", ret);
3643 int camera_unset_focus_changed_cb(camera_h camera)
3645 if (camera == NULL) {
3646 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3647 return CAMERA_ERROR_INVALID_PARAMETER;
3649 int ret = CAMERA_ERROR_NONE;
3651 camera_cli_s *pc = (camera_cli_s *)camera;
3652 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_FOCUS_CHANGED_CB;
3654 LOGD("Enter, handle :%x", pc->remote_handle);
3657 if (pc->cb_info == NULL) {
3658 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3659 return CAMERA_ERROR_INVALID_PARAMETER;
3661 sock_fd = pc->cb_info->fd;
3662 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = (void *)NULL;
3663 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = (void *)NULL;
3665 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3666 LOGD("ret : 0x%x", ret);
3670 int camera_set_error_cb(camera_h camera, camera_error_cb callback, void *user_data)
3672 if (camera == NULL || callback == NULL) {
3673 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3674 return CAMERA_ERROR_INVALID_PARAMETER;
3676 int ret = CAMERA_ERROR_NONE;
3678 camera_cli_s *pc = (camera_cli_s *)camera;
3679 muse_camera_api_e api = MUSE_CAMERA_API_SET_ERROR_CB;
3681 LOGD("Enter, handle :%x", pc->remote_handle);
3684 if (pc->cb_info == NULL) {
3685 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3686 return CAMERA_ERROR_INVALID_PARAMETER;
3688 sock_fd = pc->cb_info->fd;
3689 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_ERROR] = callback;
3690 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_ERROR] = user_data;
3692 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3693 LOGD("ret : 0x%x", ret);
3697 int camera_unset_error_cb(camera_h camera)
3699 if (camera == NULL) {
3700 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3701 return CAMERA_ERROR_INVALID_PARAMETER;
3703 int ret = CAMERA_ERROR_NONE;
3705 camera_cli_s *pc = (camera_cli_s *)camera;
3706 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_ERROR_CB;
3708 LOGD("Enter, handle :%x", pc->remote_handle);
3711 if (pc->cb_info == NULL) {
3712 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3713 return CAMERA_ERROR_INVALID_PARAMETER;
3715 sock_fd = pc->cb_info->fd;
3716 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_ERROR] = (void *)NULL;
3717 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_ERROR] = (void *)NULL;
3719 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3720 LOGD("ret : 0x%x", ret);
3724 int camera_foreach_supported_preview_resolution(camera_h camera, camera_supported_preview_resolution_cb foreach_cb , void *user_data)
3726 if (camera == NULL || foreach_cb == NULL) {
3727 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3728 return CAMERA_ERROR_INVALID_PARAMETER;
3730 int ret = CAMERA_ERROR_NONE;
3732 camera_cli_s *pc = (camera_cli_s *)camera;
3733 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_PREVIEW_RESOLUTION;
3735 LOGD("Enter, handle :%x", pc->remote_handle);
3738 if (pc->cb_info == NULL) {
3739 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3740 return CAMERA_ERROR_INVALID_PARAMETER;
3742 sock_fd = pc->cb_info->fd;
3743 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_RESOLUTION] = foreach_cb;
3744 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_RESOLUTION] = user_data;
3746 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3747 LOGD("ret : 0x%x", ret);
3751 int camera_foreach_supported_capture_resolution(camera_h camera, camera_supported_capture_resolution_cb foreach_cb , void *user_data)
3753 if (camera == NULL || foreach_cb == NULL) {
3754 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3755 return CAMERA_ERROR_INVALID_PARAMETER;
3757 int ret = CAMERA_ERROR_NONE;
3759 camera_cli_s *pc = (camera_cli_s *)camera;
3760 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_CAPTURE_RESOLUTION;
3762 LOGD("Enter, handle :%x", pc->remote_handle);
3765 if (pc->cb_info == NULL) {
3766 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3767 return CAMERA_ERROR_INVALID_PARAMETER;
3769 sock_fd = pc->cb_info->fd;
3770 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_RESOLUTION] = foreach_cb;
3771 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_RESOLUTION] = user_data;
3773 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3774 LOGD("ret : 0x%x", ret);
3778 int camera_foreach_supported_capture_format(camera_h camera, camera_supported_capture_format_cb foreach_cb , void *user_data)
3780 if (camera == NULL || foreach_cb == NULL) {
3781 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3782 return CAMERA_ERROR_INVALID_PARAMETER;
3784 int ret = CAMERA_ERROR_NONE;
3786 camera_cli_s *pc = (camera_cli_s *)camera;
3787 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_CAPTURE_FORMAT;
3789 LOGD("Enter, handle :%x", pc->remote_handle);
3792 if (pc->cb_info == NULL) {
3793 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3794 return CAMERA_ERROR_INVALID_PARAMETER;
3796 sock_fd = pc->cb_info->fd;
3797 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_FORMAT] = foreach_cb;
3798 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_FORMAT] = user_data;
3800 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3801 LOGD("ret : 0x%x", ret);
3806 int camera_foreach_supported_preview_format(camera_h camera, camera_supported_preview_format_cb foreach_cb , void *user_data)
3808 if (camera == NULL || foreach_cb == NULL) {
3809 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3810 return CAMERA_ERROR_INVALID_PARAMETER;
3812 int ret = CAMERA_ERROR_NONE;
3814 camera_cli_s *pc = (camera_cli_s *)camera;
3815 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_PREVIEW_FORMAT;
3817 LOGD("Enter, handle :%x", pc->remote_handle);
3820 if (pc->cb_info == NULL) {
3821 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3822 return CAMERA_ERROR_INVALID_PARAMETER;
3824 sock_fd = pc->cb_info->fd;
3825 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_FORMAT] = foreach_cb;
3826 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_FORMAT] = user_data;
3828 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3829 LOGD("ret : 0x%x", ret);
3834 int camera_get_recommended_preview_resolution(camera_h camera, int *width, int *height)
3836 if (camera == NULL || width == NULL || height == NULL) {
3837 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3838 return CAMERA_ERROR_INVALID_PARAMETER;
3840 int ret = CAMERA_ERROR_NONE;
3842 camera_cli_s *pc = (camera_cli_s *)camera;
3843 muse_camera_api_e api = MUSE_CAMERA_API_GET_RECOMMENDED_PREVIEW_RESOLUTION;
3845 if (pc->cb_info == NULL) {
3846 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3847 return CAMERA_ERROR_INVALID_PARAMETER;
3849 sock_fd = pc->cb_info->fd;
3853 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3854 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3856 if (ret == CAMERA_ERROR_NONE) {
3857 muse_camera_msg_get(get_width, pc->cb_info->recv_msg);
3858 muse_camera_msg_get(get_height, pc->cb_info->recv_msg);
3860 *height = get_height;
3862 LOGD("ret : 0x%x", ret);
3867 int camera_attr_get_lens_orientation(camera_h camera, int *angle)
3869 if (camera == NULL || angle == NULL) {
3870 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3871 return CAMERA_ERROR_INVALID_PARAMETER;
3873 int ret = CAMERA_ERROR_NONE;
3875 camera_cli_s *pc = (camera_cli_s *)camera;
3876 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_LENS_ORIENTATION;
3878 if (pc->cb_info == NULL) {
3879 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3880 return CAMERA_ERROR_INVALID_PARAMETER;
3882 sock_fd = pc->cb_info->fd;
3885 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3886 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3888 if (ret == CAMERA_ERROR_NONE) {
3889 muse_camera_msg_get(get_angle, pc->cb_info->recv_msg);
3892 LOGD("ret : 0x%x", ret);
3896 int camera_attr_set_theater_mode(camera_h camera, camera_attr_theater_mode_e mode)
3898 if (camera == NULL) {
3899 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3900 return CAMERA_ERROR_INVALID_PARAMETER;
3902 int ret = CAMERA_ERROR_NONE;
3903 camera_cli_s *pc = (camera_cli_s *)camera;
3904 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_THEATER_MODE;
3906 if (pc->cb_info == NULL) {
3907 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3908 return CAMERA_ERROR_INVALID_PARAMETER;
3910 sock_fd = pc->cb_info->fd;
3911 int set_mode = (int)mode;
3912 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3913 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
3914 LOGD("ret : 0x%x", ret);
3918 int camera_attr_get_theater_mode(camera_h camera, camera_attr_theater_mode_e *mode)
3920 if (camera == NULL || mode == NULL) {
3921 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3922 return CAMERA_ERROR_INVALID_PARAMETER;
3925 int ret = CAMERA_ERROR_NONE;
3926 camera_cli_s *pc = (camera_cli_s *)camera;
3927 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_THEATER_MODE;
3929 if (pc->cb_info == NULL) {
3930 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3931 return CAMERA_ERROR_INVALID_PARAMETER;
3933 sock_fd = pc->cb_info->fd;
3935 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3936 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3938 if (ret == CAMERA_ERROR_NONE) {
3939 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
3940 *mode = (camera_attr_theater_mode_e)get_mode;
3942 LOGD("ret : 0x%x", ret);
3946 int camera_attr_foreach_supported_theater_mode(camera_h camera, camera_attr_supported_theater_mode_cb foreach_cb, void *user_data)
3948 if (camera == NULL || foreach_cb == NULL) {
3949 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3950 return CAMERA_ERROR_INVALID_PARAMETER;
3952 int ret = CAMERA_ERROR_NONE;
3954 camera_cli_s *pc = (camera_cli_s *)camera;
3955 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_THEATER_MODE;
3957 LOGD("Enter, handle :%x", pc->remote_handle);
3960 if (pc->cb_info == NULL) {
3961 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3962 return CAMERA_ERROR_INVALID_PARAMETER;
3964 sock_fd = pc->cb_info->fd;
3965 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE] = foreach_cb;
3966 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE] = user_data;
3968 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3970 LOGD("Finish, return :%x", ret);
3975 int camera_attr_set_preview_fps(camera_h camera, camera_attr_fps_e fps)
3977 if (camera == NULL) {
3978 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3979 return CAMERA_ERROR_INVALID_PARAMETER;
3981 int ret = CAMERA_ERROR_NONE;
3982 camera_cli_s *pc = (camera_cli_s *)camera;
3983 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_PREVIEW_FPS;
3985 if (pc->cb_info == NULL) {
3986 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3987 return CAMERA_ERROR_INVALID_PARAMETER;
3989 sock_fd = pc->cb_info->fd;
3990 int set_fps = (int)fps;
3991 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3992 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_fps);
3993 LOGD("ret : 0x%x", ret);
3998 int camera_attr_set_image_quality(camera_h camera, int quality)
4000 if (camera == NULL) {
4001 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4002 return CAMERA_ERROR_INVALID_PARAMETER;
4004 int ret = CAMERA_ERROR_NONE;
4006 camera_cli_s *pc = (camera_cli_s *)camera;
4007 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_IMAGE_QUALITY;
4009 if (pc->cb_info == NULL) {
4010 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4011 return CAMERA_ERROR_INVALID_PARAMETER;
4013 sock_fd = pc->cb_info->fd;
4014 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4015 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, quality);
4016 LOGD("ret : 0x%x", ret);
4020 int camera_attr_get_preview_fps(camera_h camera, camera_attr_fps_e *fps)
4022 if (camera == NULL || fps == NULL) {
4023 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4024 return CAMERA_ERROR_INVALID_PARAMETER;
4026 int ret = CAMERA_ERROR_NONE;
4028 camera_cli_s *pc = (camera_cli_s *)camera;
4029 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_PREVIEW_FPS;
4032 if (pc->cb_info == NULL) {
4033 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4034 return CAMERA_ERROR_INVALID_PARAMETER;
4036 sock_fd = pc->cb_info->fd;
4038 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4039 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4041 if (ret == CAMERA_ERROR_NONE) {
4042 muse_camera_msg_get(get_fps, pc->cb_info->recv_msg);
4043 *fps = (camera_attr_fps_e)get_fps;
4045 LOGD("ret : 0x%x", ret);
4050 int camera_attr_get_image_quality(camera_h camera, int *quality)
4052 if (camera == NULL || quality == NULL) {
4053 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4054 return CAMERA_ERROR_INVALID_PARAMETER;
4056 int ret = CAMERA_ERROR_NONE;
4058 camera_cli_s *pc = (camera_cli_s *)camera;
4059 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_IMAGE_QUALITY;
4061 if (pc->cb_info == NULL) {
4062 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4063 return CAMERA_ERROR_INVALID_PARAMETER;
4065 sock_fd = pc->cb_info->fd;
4067 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4068 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4070 if (ret == CAMERA_ERROR_NONE) {
4071 muse_camera_msg_get(get_quality, pc->cb_info->recv_msg);
4072 *quality = get_quality;
4074 LOGD("ret : 0x%x", ret);
4079 int camera_attr_get_encoded_preview_bitrate(camera_h camera, int *bitrate)
4081 if (camera == NULL || bitrate == NULL) {
4082 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4083 return CAMERA_ERROR_INVALID_PARAMETER;
4086 int ret = CAMERA_ERROR_NONE;
4088 camera_cli_s *pc = (camera_cli_s *)camera;
4089 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ENCODED_PREVIEW_BITRATE;
4091 if (pc->cb_info == NULL) {
4092 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4093 return CAMERA_ERROR_INVALID_PARAMETER;
4095 sock_fd = pc->cb_info->fd;
4098 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4099 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4101 if (ret == CAMERA_ERROR_NONE) {
4102 muse_camera_msg_get(get_bitrate, pc->cb_info->recv_msg);
4103 *bitrate = get_bitrate;
4105 LOGD("ret : 0x%x", ret);
4110 int camera_attr_set_encoded_preview_bitrate(camera_h camera, int bitrate)
4112 if (camera == NULL) {
4113 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4114 return CAMERA_ERROR_INVALID_PARAMETER;
4117 int ret = CAMERA_ERROR_NONE;
4119 camera_cli_s *pc = (camera_cli_s *)camera;
4120 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ENCODED_PREVIEW_BITRATE;
4122 if (pc->cb_info == NULL) {
4123 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4124 return CAMERA_ERROR_INVALID_PARAMETER;
4126 sock_fd = pc->cb_info->fd;
4127 int set_bitrate = bitrate;
4128 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4129 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_bitrate);
4130 LOGD("ret : 0x%x", ret);
4135 int camera_attr_get_encoded_preview_gop_interval(camera_h camera, int *interval)
4137 if (camera == NULL || interval == NULL) {
4138 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4139 return CAMERA_ERROR_INVALID_PARAMETER;
4142 int ret = CAMERA_ERROR_NONE;
4144 camera_cli_s *pc = (camera_cli_s *)camera;
4145 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ENCODED_PREVIEW_GOP_INTERVAL;
4147 if (pc->cb_info == NULL) {
4148 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4149 return CAMERA_ERROR_INVALID_PARAMETER;
4151 sock_fd = pc->cb_info->fd;
4152 int get_gop_interval;
4154 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4155 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4157 if (ret == CAMERA_ERROR_NONE) {
4158 muse_camera_msg_get(get_gop_interval, pc->cb_info->recv_msg);
4159 *interval = get_gop_interval;
4161 LOGD("ret : 0x%x", ret);
4166 int camera_attr_set_encoded_preview_gop_interval(camera_h camera, int interval)
4168 if (camera == NULL) {
4169 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4170 return CAMERA_ERROR_INVALID_PARAMETER;
4173 int ret = CAMERA_ERROR_NONE;
4175 camera_cli_s *pc = (camera_cli_s *)camera;
4176 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ENCODED_PREVIEW_GOP_INTERVAL;
4178 if (pc->cb_info == NULL) {
4179 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4180 return CAMERA_ERROR_INVALID_PARAMETER;
4182 sock_fd = pc->cb_info->fd;
4183 int set_gop_interval = interval;
4184 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4185 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_gop_interval);
4186 LOGD("ret : 0x%x", ret);
4191 int camera_attr_set_zoom(camera_h camera, int zoom)
4193 if (camera == NULL) {
4194 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4195 return CAMERA_ERROR_INVALID_PARAMETER;
4197 int ret = CAMERA_ERROR_NONE;
4199 camera_cli_s *pc = (camera_cli_s *)camera;
4200 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ZOOM;
4202 if (pc->cb_info == NULL) {
4203 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4204 return CAMERA_ERROR_INVALID_PARAMETER;
4206 sock_fd = pc->cb_info->fd;
4208 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4209 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, zoom);
4210 LOGD("ret : 0x%x", ret);
4214 int camera_attr_set_af_mode(camera_h camera, camera_attr_af_mode_e mode)
4216 if (camera == NULL) {
4217 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4218 return CAMERA_ERROR_INVALID_PARAMETER;
4220 int ret = CAMERA_ERROR_NONE;
4222 camera_cli_s *pc = (camera_cli_s *)camera;
4223 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_AF_MODE;
4225 if (pc->cb_info == NULL) {
4226 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4227 return CAMERA_ERROR_INVALID_PARAMETER;
4229 sock_fd = pc->cb_info->fd;
4230 int set_mode = (int)mode;
4231 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4232 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
4233 LOGD("ret : 0x%x", ret);
4237 int camera_attr_set_af_area(camera_h camera, int x, int y)
4239 if (camera == NULL) {
4240 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4241 return CAMERA_ERROR_INVALID_PARAMETER;
4243 int ret = CAMERA_ERROR_NONE;
4244 camera_cli_s *pc = (camera_cli_s *)camera;
4245 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_AF_AREA;
4246 int sock_fd = pc->cb_info->fd;
4247 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4248 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, x, INT, y);
4249 LOGD("ret : 0x%x", ret);
4254 int camera_attr_clear_af_area(camera_h camera)
4256 if (camera == NULL) {
4257 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4258 return CAMERA_ERROR_INVALID_PARAMETER;
4260 int ret = CAMERA_ERROR_NONE;
4262 camera_cli_s *pc = (camera_cli_s *)camera;
4263 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_CLEAR_AF_AREA;
4265 if (pc->cb_info == NULL) {
4266 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4267 return CAMERA_ERROR_INVALID_PARAMETER;
4269 sock_fd = pc->cb_info->fd;
4270 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4271 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4272 LOGD("ret : 0x%x", ret);
4277 int camera_attr_set_exposure_mode(camera_h camera, camera_attr_exposure_mode_e mode)
4279 if (camera == NULL) {
4280 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4281 return CAMERA_ERROR_INVALID_PARAMETER;
4284 if (mode < CAMERA_ATTR_EXPOSURE_MODE_OFF || mode > CAMERA_ATTR_EXPOSURE_MODE_CUSTOM) {
4285 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4286 return CAMERA_ERROR_INVALID_PARAMETER;
4289 int ret = CAMERA_ERROR_NONE;
4290 camera_cli_s *pc = (camera_cli_s *)camera;
4291 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EXPOSURE_MODE;
4292 int set_mode = (int)mode;
4294 if (pc->cb_info == NULL) {
4295 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4296 return CAMERA_ERROR_INVALID_PARAMETER;
4298 sock_fd = pc->cb_info->fd;
4299 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4300 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
4301 LOGD("ret : 0x%x", ret);
4306 int camera_attr_set_exposure(camera_h camera, int value)
4308 if (camera == NULL) {
4309 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4310 return CAMERA_ERROR_INVALID_PARAMETER;
4312 int ret = CAMERA_ERROR_NONE;
4314 camera_cli_s *pc = (camera_cli_s *)camera;
4315 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EXPOSURE;
4317 if (pc->cb_info == NULL) {
4318 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4319 return CAMERA_ERROR_INVALID_PARAMETER;
4321 sock_fd = pc->cb_info->fd;
4323 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4324 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, value);
4325 LOGD("ret : 0x%x", ret);
4330 int camera_attr_set_iso(camera_h camera, camera_attr_iso_e iso)
4332 if (camera == NULL) {
4333 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4334 return CAMERA_ERROR_INVALID_PARAMETER;
4336 int ret = CAMERA_ERROR_NONE;
4338 camera_cli_s *pc = (camera_cli_s *)camera;
4339 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ISO;
4341 if (pc->cb_info == NULL) {
4342 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4343 return CAMERA_ERROR_INVALID_PARAMETER;
4345 sock_fd = pc->cb_info->fd;
4346 int set_iso = (int)iso;
4347 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4348 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_iso);
4349 LOGD("ret : 0x%x", ret);
4354 int camera_attr_set_brightness(camera_h camera, int level)
4356 if (camera == NULL) {
4357 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4358 return CAMERA_ERROR_INVALID_PARAMETER;
4360 int ret = CAMERA_ERROR_NONE;
4362 camera_cli_s *pc = (camera_cli_s *)camera;
4363 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_BRIGHTNESS;
4365 if (pc->cb_info == NULL) {
4366 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4367 return CAMERA_ERROR_INVALID_PARAMETER;
4369 sock_fd = pc->cb_info->fd;
4371 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4372 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, level);
4373 LOGD("ret : 0x%x", ret);
4378 int camera_attr_set_contrast(camera_h camera, int level)
4380 if (camera == NULL) {
4381 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4382 return CAMERA_ERROR_INVALID_PARAMETER;
4384 int ret = CAMERA_ERROR_NONE;
4386 camera_cli_s *pc = (camera_cli_s *)camera;
4387 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_CONTRAST;
4389 if (pc->cb_info == NULL) {
4390 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4391 return CAMERA_ERROR_INVALID_PARAMETER;
4393 sock_fd = pc->cb_info->fd;
4395 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4396 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, level);
4397 LOGD("ret : 0x%x", ret);
4402 int camera_attr_set_whitebalance(camera_h camera, camera_attr_whitebalance_e wb)
4404 if (camera == NULL) {
4405 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4406 return CAMERA_ERROR_INVALID_PARAMETER;
4409 if (wb < CAMERA_ATTR_WHITE_BALANCE_NONE || wb > CAMERA_ATTR_WHITE_BALANCE_CUSTOM) {
4410 LOGE("invalid white balance %d", wb);
4411 return CAMERA_ERROR_INVALID_PARAMETER;
4414 int ret = CAMERA_ERROR_NONE;
4416 camera_cli_s *pc = (camera_cli_s *)camera;
4417 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_WHITEBALANCE;
4419 if (pc->cb_info == NULL) {
4420 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4421 return CAMERA_ERROR_INVALID_PARAMETER;
4423 sock_fd = pc->cb_info->fd;
4424 int set_whitebalance = (int)wb;
4425 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4426 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_whitebalance);
4427 LOGD("ret : 0x%x", ret);
4432 int camera_attr_set_effect(camera_h camera, camera_attr_effect_mode_e effect)
4434 if (camera == NULL) {
4435 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4436 return CAMERA_ERROR_INVALID_PARAMETER;
4438 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_EFFECT;
4443 if (pc->cb_info == NULL) {
4444 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4445 return CAMERA_ERROR_INVALID_PARAMETER;
4447 sock_fd = pc->cb_info->fd;
4448 int set_effect = (int)effect;
4449 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4450 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_effect);
4451 LOGD("ret : 0x%x", ret);
4456 int camera_attr_set_scene_mode(camera_h camera, camera_attr_scene_mode_e mode)
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_SCENE_MODE;
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;
4472 int set_mode = (int)mode;
4473 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4474 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
4475 LOGD("ret : 0x%x", ret);
4480 int camera_attr_enable_tag(camera_h camera, bool enable)
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;
4487 camera_cli_s *pc = (camera_cli_s *)camera;
4488 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_TAG;
4490 if (pc->cb_info == NULL) {
4491 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4492 return CAMERA_ERROR_INVALID_PARAMETER;
4494 sock_fd = pc->cb_info->fd;
4495 int set_enable = (int)enable;
4497 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4498 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
4499 LOGD("ret : 0x%x", ret);
4504 int camera_attr_set_tag_image_description(camera_h camera, const char *description)
4506 if (camera == NULL) {
4507 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4508 return CAMERA_ERROR_INVALID_PARAMETER;
4510 if (description == NULL) {
4511 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4512 return CAMERA_ERROR_INVALID_PARAMETER;
4514 int ret = CAMERA_ERROR_NONE;
4515 camera_cli_s *pc = (camera_cli_s *)camera;
4516 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_IMAGE_DESCRIPTION;
4518 if (pc->cb_info == NULL) {
4519 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4520 return CAMERA_ERROR_INVALID_PARAMETER;
4522 sock_fd = pc->cb_info->fd;
4523 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4524 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, STRING, description);
4525 LOGD("ret : 0x%x", ret);
4530 int camera_attr_set_tag_orientation(camera_h camera, camera_attr_tag_orientation_e orientation)
4532 if (camera == NULL) {
4533 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4534 return CAMERA_ERROR_INVALID_PARAMETER;
4536 int ret = CAMERA_ERROR_NONE;
4537 camera_cli_s *pc = (camera_cli_s *)camera;
4538 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_ORIENTATION;
4540 if (pc->cb_info == NULL) {
4541 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4542 return CAMERA_ERROR_INVALID_PARAMETER;
4544 sock_fd = pc->cb_info->fd;
4545 int set_orientation = (int)orientation;
4547 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4548 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_orientation);
4549 LOGD("ret : 0x%x", ret);
4554 int camera_attr_set_tag_software(camera_h camera, const char *software)
4556 if (camera == NULL) {
4557 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4558 return CAMERA_ERROR_INVALID_PARAMETER;
4560 if (software == NULL) {
4561 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4562 return CAMERA_ERROR_INVALID_PARAMETER;
4564 int ret = CAMERA_ERROR_NONE;
4565 camera_cli_s *pc = (camera_cli_s *)camera;
4566 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_SOFTWARE;
4568 if (pc->cb_info == NULL) {
4569 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4570 return CAMERA_ERROR_INVALID_PARAMETER;
4572 sock_fd = pc->cb_info->fd;
4573 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4574 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, STRING, software);
4575 LOGD("ret : 0x%x", ret);
4580 int camera_attr_set_geotag(camera_h camera, double latitude , double longitude, double altitude)
4582 if (camera == NULL) {
4583 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4584 return CAMERA_ERROR_INVALID_PARAMETER;
4586 int ret = CAMERA_ERROR_NONE;
4587 camera_cli_s *pc = (camera_cli_s *)camera;
4588 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_GEOTAG;
4590 if (pc->cb_info == NULL) {
4591 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4592 return CAMERA_ERROR_INVALID_PARAMETER;
4594 sock_fd = pc->cb_info->fd;
4595 double set_geotag[3] = { latitude, longitude, altitude };
4597 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4598 muse_camera_msg_send_array(api, sock_fd, pc->cb_info, ret,
4599 set_geotag, sizeof(set_geotag), sizeof(double));
4600 LOGD("ret : 0x%x", ret);
4605 int camera_attr_remove_geotag(camera_h camera)
4607 if (camera == NULL) {
4608 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4609 return CAMERA_ERROR_INVALID_PARAMETER;
4611 int ret = CAMERA_ERROR_NONE;
4612 camera_cli_s *pc = (camera_cli_s *)camera;
4613 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_REMOVE_GEOTAG;
4615 if (pc->cb_info == NULL) {
4616 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4617 return CAMERA_ERROR_INVALID_PARAMETER;
4619 sock_fd = pc->cb_info->fd;
4620 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4621 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4622 LOGD("ret : 0x%x", ret);
4627 int camera_attr_set_flash_mode(camera_h camera, camera_attr_flash_mode_e mode)
4629 if (camera == NULL) {
4630 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4631 return CAMERA_ERROR_INVALID_PARAMETER;
4633 int ret = CAMERA_ERROR_NONE;
4634 camera_cli_s *pc = (camera_cli_s *)camera;
4635 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_FLASH_MODE;
4637 if (pc->cb_info == NULL) {
4638 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4639 return CAMERA_ERROR_INVALID_PARAMETER;
4641 sock_fd = pc->cb_info->fd;
4642 int set_mode = (int)mode;
4644 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4645 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
4646 LOGD("ret : 0x%x", ret);
4651 int camera_attr_get_zoom(camera_h camera, int *zoom)
4653 if (camera == NULL || zoom == NULL) {
4654 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4655 return CAMERA_ERROR_INVALID_PARAMETER;
4657 int ret = CAMERA_ERROR_NONE;
4659 camera_cli_s *pc = (camera_cli_s *)camera;
4660 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ZOOM;
4663 if (pc->cb_info == NULL) {
4664 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4665 return CAMERA_ERROR_INVALID_PARAMETER;
4667 sock_fd = pc->cb_info->fd;
4669 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4670 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4672 if (ret == CAMERA_ERROR_NONE) {
4673 muse_camera_msg_get(get_zoom, pc->cb_info->recv_msg);
4676 LOGD("ret : 0x%x", ret);
4681 int camera_attr_get_zoom_range(camera_h camera, int *min, int *max)
4683 if (camera == NULL || min == NULL || max == NULL) {
4684 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4685 return CAMERA_ERROR_INVALID_PARAMETER;
4687 int ret = CAMERA_ERROR_NONE;
4688 camera_cli_s *pc = (camera_cli_s *)camera;
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 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ZOOM_RANGE;
4699 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4700 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4702 if (ret == CAMERA_ERROR_NONE) {
4703 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
4704 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
4708 LOGD("ret : 0x%x", ret);
4713 int camera_attr_get_af_mode(camera_h camera, camera_attr_af_mode_e *mode)
4715 if (camera == NULL || mode == NULL) {
4716 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4717 return CAMERA_ERROR_INVALID_PARAMETER;
4719 int ret = CAMERA_ERROR_NONE;
4720 camera_cli_s *pc = (camera_cli_s *)camera;
4722 if (pc->cb_info == NULL) {
4723 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4724 return CAMERA_ERROR_INVALID_PARAMETER;
4726 sock_fd = pc->cb_info->fd;
4727 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_AF_MODE;
4730 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4731 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4733 if (ret == CAMERA_ERROR_NONE) {
4734 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
4735 *mode = (camera_attr_af_mode_e)get_mode;
4737 LOGD("ret : 0x%x", ret);
4742 int camera_attr_get_exposure_mode(camera_h camera, camera_attr_exposure_mode_e *mode)
4744 if (camera == NULL || mode == NULL) {
4745 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4746 return CAMERA_ERROR_INVALID_PARAMETER;
4748 int ret = CAMERA_ERROR_NONE;
4749 camera_cli_s *pc = (camera_cli_s *)camera;
4751 if (pc->cb_info == NULL) {
4752 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4753 return CAMERA_ERROR_INVALID_PARAMETER;
4755 sock_fd = pc->cb_info->fd;
4756 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE_MODE;
4759 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4760 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4762 if (ret == CAMERA_ERROR_NONE) {
4763 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
4764 *mode = (camera_attr_exposure_mode_e)get_mode;
4766 LOGD("ret : 0x%x", ret);
4770 int camera_attr_get_exposure(camera_h camera, int *value)
4772 if (camera == NULL || value == NULL) {
4773 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4774 return CAMERA_ERROR_INVALID_PARAMETER;
4776 int ret = CAMERA_ERROR_NONE;
4777 camera_cli_s *pc = (camera_cli_s *)camera;
4779 if (pc->cb_info == NULL) {
4780 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4781 return CAMERA_ERROR_INVALID_PARAMETER;
4783 sock_fd = pc->cb_info->fd;
4784 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE;
4787 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4788 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4790 if (ret == CAMERA_ERROR_NONE) {
4791 muse_camera_msg_get(get_value, pc->cb_info->recv_msg);
4794 LOGD("ret : 0x%x", ret);
4799 int camera_attr_get_exposure_range(camera_h camera, int *min, int *max)
4801 if (camera == NULL || min == NULL || max == NULL) {
4802 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4803 return CAMERA_ERROR_INVALID_PARAMETER;
4805 int ret = CAMERA_ERROR_NONE;
4806 camera_cli_s *pc = (camera_cli_s *)camera;
4808 if (pc->cb_info == NULL) {
4809 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4810 return CAMERA_ERROR_INVALID_PARAMETER;
4812 sock_fd = pc->cb_info->fd;
4813 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE_RANGE;
4817 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4818 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4820 if (ret == CAMERA_ERROR_NONE) {
4821 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
4822 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
4826 LOGD("ret : 0x%x", ret);
4831 int camera_attr_get_iso(camera_h camera, camera_attr_iso_e *iso)
4833 if (camera == NULL || iso == 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_ISO;
4848 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4849 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4851 if (ret == CAMERA_ERROR_NONE) {
4852 muse_camera_msg_get(get_iso, pc->cb_info->recv_msg);
4853 *iso = (camera_attr_iso_e)get_iso;
4855 LOGD("ret : 0x%x", ret);
4860 int camera_attr_get_brightness(camera_h camera, int *level)
4862 if (camera == NULL || level == NULL) {
4863 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4864 return CAMERA_ERROR_INVALID_PARAMETER;
4866 int ret = CAMERA_ERROR_NONE;
4867 camera_cli_s *pc = (camera_cli_s *)camera;
4869 if (pc->cb_info == NULL) {
4870 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4871 return CAMERA_ERROR_INVALID_PARAMETER;
4873 sock_fd = pc->cb_info->fd;
4874 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_BRIGHTNESS;
4877 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4878 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4880 if (ret == CAMERA_ERROR_NONE) {
4881 muse_camera_msg_get(get_level, pc->cb_info->recv_msg);
4884 LOGD("ret : 0x%x", ret);
4889 int camera_attr_get_brightness_range(camera_h camera, int *min, int *max)
4891 if (camera == NULL || min == NULL || max == NULL) {
4892 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4893 return CAMERA_ERROR_INVALID_PARAMETER;
4895 int ret = CAMERA_ERROR_NONE;
4896 camera_cli_s *pc = (camera_cli_s *)camera;
4898 if (pc->cb_info == NULL) {
4899 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4900 return CAMERA_ERROR_INVALID_PARAMETER;
4902 sock_fd = pc->cb_info->fd;
4903 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_BRIGHTNESS_RANGE;
4907 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4908 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4910 if (ret == CAMERA_ERROR_NONE) {
4911 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
4912 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
4916 LOGD("ret : 0x%x", ret);
4921 int camera_attr_get_contrast(camera_h camera, int *level)
4923 if (camera == NULL || level == NULL) {
4924 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4925 return CAMERA_ERROR_INVALID_PARAMETER;
4927 int ret = CAMERA_ERROR_NONE;
4928 camera_cli_s *pc = (camera_cli_s *)camera;
4929 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_CONTRAST;
4931 if (pc->cb_info == NULL) {
4932 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4933 return CAMERA_ERROR_INVALID_PARAMETER;
4935 sock_fd = pc->cb_info->fd;
4938 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4939 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4941 if (ret == CAMERA_ERROR_NONE) {
4942 muse_camera_msg_get(get_level, pc->cb_info->recv_msg);
4945 LOGD("ret : 0x%x", ret);
4950 int camera_attr_get_contrast_range(camera_h camera, int *min , int *max)
4952 if (camera == NULL || min == NULL || max == NULL) {
4953 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4954 return CAMERA_ERROR_INVALID_PARAMETER;
4956 int ret = CAMERA_ERROR_NONE;
4957 camera_cli_s *pc = (camera_cli_s *)camera;
4958 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_CONTRAST_RANGE;
4960 if (pc->cb_info == NULL) {
4961 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4962 return CAMERA_ERROR_INVALID_PARAMETER;
4964 sock_fd = pc->cb_info->fd;
4968 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4969 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4971 if (ret == CAMERA_ERROR_NONE) {
4972 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
4973 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
4977 LOGD("ret : 0x%x", ret);
4982 int camera_attr_get_whitebalance(camera_h camera, camera_attr_whitebalance_e *wb)
4984 if (camera == NULL || wb == NULL) {
4985 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4986 return CAMERA_ERROR_INVALID_PARAMETER;
4988 int ret = CAMERA_ERROR_NONE;
4989 camera_cli_s *pc = (camera_cli_s *)camera;
4990 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_WHITEBALANCE;
4992 if (pc->cb_info == NULL) {
4993 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4994 return CAMERA_ERROR_INVALID_PARAMETER;
4996 sock_fd = pc->cb_info->fd;
4999 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5000 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5002 if (ret == CAMERA_ERROR_NONE) {
5003 muse_camera_msg_get(get_wb, pc->cb_info->recv_msg);
5004 *wb = (camera_attr_whitebalance_e)get_wb;
5006 LOGD("ret : 0x%x", ret);
5011 int camera_attr_get_effect(camera_h camera, camera_attr_effect_mode_e *effect)
5013 if (camera == NULL || effect == NULL) {
5014 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5015 return CAMERA_ERROR_INVALID_PARAMETER;
5018 int ret = CAMERA_ERROR_NONE;
5019 camera_cli_s *pc = (camera_cli_s *)camera;
5020 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EFFECT;
5022 if (pc->cb_info == NULL) {
5023 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5024 return CAMERA_ERROR_INVALID_PARAMETER;
5026 sock_fd = pc->cb_info->fd;
5029 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5030 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5032 if (ret == CAMERA_ERROR_NONE) {
5033 muse_camera_msg_get(get_effect, pc->cb_info->recv_msg);
5034 *effect = (camera_attr_effect_mode_e)get_effect;
5036 LOGD("ret : 0x%x", ret);
5041 int camera_attr_get_scene_mode(camera_h camera, camera_attr_scene_mode_e *mode)
5043 if (camera == NULL || mode == NULL) {
5044 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5045 return CAMERA_ERROR_INVALID_PARAMETER;
5048 int ret = CAMERA_ERROR_NONE;
5049 camera_cli_s *pc = (camera_cli_s *)camera;
5050 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_SCENE_MODE;
5052 if (pc->cb_info == NULL) {
5053 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5054 return CAMERA_ERROR_INVALID_PARAMETER;
5056 sock_fd = pc->cb_info->fd;
5059 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5060 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5062 if (ret == CAMERA_ERROR_NONE) {
5063 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
5064 *mode = (camera_attr_scene_mode_e)get_mode;
5066 LOGD("ret : 0x%x", ret);
5071 int camera_attr_is_enabled_tag(camera_h camera, bool *enable)
5073 if (camera == NULL || enable == NULL) {
5074 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5075 return CAMERA_ERROR_INVALID_PARAMETER;
5078 int ret = CAMERA_ERROR_NONE;
5079 camera_cli_s *pc = (camera_cli_s *)camera;
5080 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_TAG;
5082 if (pc->cb_info == NULL) {
5083 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5084 return CAMERA_ERROR_INVALID_PARAMETER;
5086 sock_fd = pc->cb_info->fd;
5089 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5090 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5092 if (ret == CAMERA_ERROR_NONE) {
5093 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
5094 *enable = (bool)get_enabled;
5096 LOGD("ret : 0x%x", ret);
5101 int camera_attr_get_tag_image_description(camera_h camera, char **description)
5103 if (camera == NULL || description == NULL) {
5104 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5105 return CAMERA_ERROR_INVALID_PARAMETER;
5108 int ret = CAMERA_ERROR_NONE;
5109 camera_cli_s *pc = (camera_cli_s *)camera;
5110 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_IMAGE_DESCRIPTION;
5112 if (pc->cb_info == NULL) {
5113 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5114 return CAMERA_ERROR_INVALID_PARAMETER;
5116 sock_fd = pc->cb_info->fd;
5117 char get_description[MUSE_CAMERA_MSG_MAX_LENGTH] = {0,};
5119 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5120 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5122 if (ret == CAMERA_ERROR_NONE) {
5123 muse_camera_msg_get_string(get_description, pc->cb_info->recv_msg);
5124 *description = strdup(get_description);
5126 LOGD("ret : 0x%x", ret);
5131 int camera_attr_get_tag_orientation(camera_h camera, camera_attr_tag_orientation_e *orientation)
5133 if (camera == NULL || orientation == NULL) {
5134 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5135 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_TAG_ORIENTATION;
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;
5147 int get_orientation;
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_orientation, pc->cb_info->recv_msg);
5154 *orientation = (camera_attr_tag_orientation_e)get_orientation;
5155 LOGD("success, orientation : %d", *orientation);
5157 LOGD("ret : 0x%x", ret);
5162 int camera_attr_get_tag_software(camera_h camera, char **software)
5164 if (camera == NULL || software == NULL) {
5165 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5166 return CAMERA_ERROR_INVALID_PARAMETER;
5169 int ret = CAMERA_ERROR_NONE;
5170 camera_cli_s *pc = (camera_cli_s *)camera;
5171 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_SOFTWARE;
5173 if (pc->cb_info == NULL) {
5174 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5175 return CAMERA_ERROR_INVALID_PARAMETER;
5177 sock_fd = pc->cb_info->fd;
5178 char get_software[MUSE_CAMERA_MSG_MAX_LENGTH] = {0,};
5180 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5181 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5183 if (ret == CAMERA_ERROR_NONE) {
5184 muse_camera_msg_get_string(get_software, pc->cb_info->recv_msg);
5185 *software = strdup(get_software);
5187 LOGD("ret : 0x%x", ret);
5192 int camera_attr_get_geotag(camera_h camera, double *latitude , double *longitude, double *altitude)
5194 if (camera == NULL || latitude == NULL || longitude == NULL || altitude == NULL) {
5195 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5196 return CAMERA_ERROR_INVALID_PARAMETER;
5199 int ret = CAMERA_ERROR_NONE;
5200 camera_cli_s *pc = (camera_cli_s *)camera;
5201 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_GEOTAG;
5202 double get_geotag[3] = {0,};
5204 if (pc->cb_info == NULL) {
5205 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5206 return CAMERA_ERROR_INVALID_PARAMETER;
5208 sock_fd = pc->cb_info->fd;
5210 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5212 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5214 if (ret == CAMERA_ERROR_NONE) {
5215 muse_camera_msg_get_array(get_geotag, pc->cb_info->recv_msg);
5216 *latitude = get_geotag[0];
5217 *longitude = get_geotag[1];
5218 *altitude = get_geotag[2];
5220 LOGD("ret : 0x%x", ret);
5222 LOGE("Returned value is not valid : 0x%x", ret);
5229 int camera_attr_get_flash_mode(camera_h camera, camera_attr_flash_mode_e *mode)
5231 if (camera == NULL || mode == NULL) {
5232 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5233 return CAMERA_ERROR_INVALID_PARAMETER;
5236 int ret = CAMERA_ERROR_NONE;
5237 camera_cli_s *pc = (camera_cli_s *)camera;
5238 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_FLASH_MODE;
5240 if (pc->cb_info == NULL) {
5241 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5242 return CAMERA_ERROR_INVALID_PARAMETER;
5244 sock_fd = pc->cb_info->fd;
5247 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5248 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5250 if (ret == CAMERA_ERROR_NONE) {
5251 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
5252 *mode = (camera_attr_flash_mode_e)get_mode;
5254 LOGD("ret : 0x%x", ret);
5259 int camera_get_flash_state(camera_device_e device, camera_flash_state_e *state)
5263 int ret = CAMERA_ERROR_NONE;
5264 camera_cli_s *pc = NULL;
5265 int get_flash_state = 0;
5267 /* create muse connection */
5268 muse_camera_api_e api = MUSE_CAMERA_API_GET_FLASH_STATE;
5269 muse_core_api_module_e muse_module = MUSE_CAMERA;
5270 int device_type = (int)device;
5272 if (state == NULL) {
5273 LOGE("invalid pointer for state");
5274 return CAMERA_ERROR_INVALID_PARAMETER;
5277 sock_fd = muse_core_client_new();
5279 LOGE("muse_core_client_new failed - returned fd %d", sock_fd);
5280 ret = CAMERA_ERROR_INVALID_OPERATION;
5284 sndMsg = muse_core_msg_json_factory_new(api,
5285 MUSE_TYPE_INT, "module", muse_module,
5286 MUSE_TYPE_INT, PARAM_DEVICE_TYPE, device_type,
5289 muse_core_ipc_send_msg(sock_fd, sndMsg);
5290 muse_core_msg_json_factory_free(sndMsg);
5292 pc = g_new0(camera_cli_s, 1);
5294 LOGE("camera_cli_s alloc failed");
5295 ret = CAMERA_ERROR_OUT_OF_MEMORY;
5299 pc->cb_info = _client_callback_new(sock_fd);
5300 if (pc->cb_info == NULL) {
5301 LOGE("cb_info alloc failed");
5302 ret = CAMERA_ERROR_OUT_OF_MEMORY;
5306 ret = _client_wait_for_cb_return(api, pc->cb_info, CALLBACK_TIME_OUT);
5308 if (ret == CAMERA_ERROR_NONE) {
5309 muse_camera_msg_get(get_flash_state, pc->cb_info->recv_msg);
5310 *state = (camera_flash_state_e)get_flash_state;
5313 LOGD("Flash state : %d\n", *state);
5316 /* release resources */
5318 g_atomic_int_set(&pc->cb_info->msg_recv_running, 0);
5319 g_atomic_int_set(&pc->cb_info->msg_handler_running, 0);
5320 _client_callback_destroy(pc->cb_info);
5330 int camera_attr_foreach_supported_af_mode(camera_h camera, camera_attr_supported_af_mode_cb foreach_cb, void *user_data)
5332 if (camera == NULL || foreach_cb == NULL) {
5333 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5334 return CAMERA_ERROR_INVALID_PARAMETER;
5336 int ret = CAMERA_ERROR_NONE;
5338 camera_cli_s *pc = (camera_cli_s *)camera;
5339 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_AF_MODE;
5341 LOGD("Enter, handle :%x", pc->remote_handle);
5344 if (pc->cb_info == NULL) {
5345 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5346 return CAMERA_ERROR_INVALID_PARAMETER;
5348 sock_fd = pc->cb_info->fd;
5349 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_AF_MODE] = foreach_cb;
5350 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_AF_MODE] = user_data;
5352 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5353 LOGD("ret : 0x%x", ret);
5358 int camera_attr_foreach_supported_exposure_mode(camera_h camera, camera_attr_supported_exposure_mode_cb foreach_cb , void *user_data)
5360 if (camera == NULL || foreach_cb == NULL) {
5361 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5362 return CAMERA_ERROR_INVALID_PARAMETER;
5364 int ret = CAMERA_ERROR_NONE;
5366 camera_cli_s *pc = (camera_cli_s *)camera;
5367 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_EXPOSURE_MODE;
5369 LOGD("Enter, handle :%x", pc->remote_handle);
5372 if (pc->cb_info == NULL) {
5373 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5374 return CAMERA_ERROR_INVALID_PARAMETER;
5376 sock_fd = pc->cb_info->fd;
5377 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EXPOSURE_MODE] = foreach_cb;
5378 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EXPOSURE_MODE] = user_data;
5380 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5381 LOGD("ret : 0x%x", ret);
5386 int camera_attr_foreach_supported_iso(camera_h camera, camera_attr_supported_iso_cb foreach_cb, void *user_data)
5388 if (camera == NULL || foreach_cb == NULL) {
5389 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5390 return CAMERA_ERROR_INVALID_PARAMETER;
5392 int ret = CAMERA_ERROR_NONE;
5394 camera_cli_s *pc = (camera_cli_s *)camera;
5395 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_ISO;
5397 LOGD("Enter, handle :%x", pc->remote_handle);
5400 if (pc->cb_info == NULL) {
5401 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5402 return CAMERA_ERROR_INVALID_PARAMETER;
5404 sock_fd = pc->cb_info->fd;
5405 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_ISO] = foreach_cb;
5406 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_ISO] = user_data;
5408 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5409 LOGD("ret : 0x%x", ret);
5414 int camera_attr_foreach_supported_whitebalance(camera_h camera, camera_attr_supported_whitebalance_cb foreach_cb , void *user_data)
5416 if (camera == NULL || foreach_cb == NULL) {
5417 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5418 return CAMERA_ERROR_INVALID_PARAMETER;
5420 int ret = CAMERA_ERROR_NONE;
5422 camera_cli_s *pc = (camera_cli_s *)camera;
5423 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_WHITEBALANCE;
5425 LOGD("Enter, handle :%x", pc->remote_handle);
5428 if (pc->cb_info == NULL) {
5429 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5430 return CAMERA_ERROR_INVALID_PARAMETER;
5432 sock_fd = pc->cb_info->fd;
5433 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_WHITEBALANCE] = foreach_cb;
5434 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_WHITEBALANCE] = user_data;
5436 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5437 LOGD("ret : 0x%x", ret);
5442 int camera_attr_foreach_supported_effect(camera_h camera, camera_attr_supported_effect_cb foreach_cb , void *user_data)
5444 if (camera == NULL || foreach_cb == NULL) {
5445 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5446 return CAMERA_ERROR_INVALID_PARAMETER;
5448 int ret = CAMERA_ERROR_NONE;
5450 camera_cli_s *pc = (camera_cli_s *)camera;
5451 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_EFFECT;
5453 LOGD("Enter, handle :%x", pc->remote_handle);
5456 if (pc->cb_info == NULL) {
5457 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5458 return CAMERA_ERROR_INVALID_PARAMETER;
5460 sock_fd = pc->cb_info->fd;
5461 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EFFECT] = foreach_cb;
5462 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EFFECT] = user_data;
5464 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5465 LOGD("ret : 0x%x", ret);
5470 int camera_attr_foreach_supported_scene_mode(camera_h camera, camera_attr_supported_scene_mode_cb foreach_cb , void *user_data)
5472 if (camera == NULL || foreach_cb == NULL) {
5473 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5474 return CAMERA_ERROR_INVALID_PARAMETER;
5476 int ret = CAMERA_ERROR_NONE;
5478 camera_cli_s *pc = (camera_cli_s *)camera;
5479 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_SCENE_MODE;
5481 LOGD("Enter, handle :%x", pc->remote_handle);
5484 if (pc->cb_info == NULL) {
5485 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5486 return CAMERA_ERROR_INVALID_PARAMETER;
5488 sock_fd = pc->cb_info->fd;
5489 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_SCENE_MODE] = foreach_cb;
5490 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_SCENE_MODE] = user_data;
5492 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5493 LOGD("ret : 0x%x", ret);
5498 int camera_attr_foreach_supported_flash_mode(camera_h camera, camera_attr_supported_flash_mode_cb foreach_cb , void *user_data)
5500 if (camera == NULL || foreach_cb == NULL) {
5501 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5502 return CAMERA_ERROR_INVALID_PARAMETER;
5504 int ret = CAMERA_ERROR_NONE;
5506 camera_cli_s *pc = (camera_cli_s *)camera;
5507 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FLASH_MODE;
5509 LOGD("Enter, handle :%x", pc->remote_handle);
5512 if (pc->cb_info == NULL) {
5513 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5514 return CAMERA_ERROR_INVALID_PARAMETER;
5516 sock_fd = pc->cb_info->fd;
5517 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FLASH_MODE] = foreach_cb;
5518 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FLASH_MODE] = user_data;
5520 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5521 LOGD("ret : 0x%x", ret);
5526 int camera_attr_foreach_supported_fps(camera_h camera, camera_attr_supported_fps_cb foreach_cb , void *user_data)
5528 if (camera == NULL || foreach_cb == NULL) {
5529 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5530 return CAMERA_ERROR_INVALID_PARAMETER;
5532 int ret = CAMERA_ERROR_NONE;
5534 camera_cli_s *pc = (camera_cli_s *)camera;
5535 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FPS;
5537 if (pc->cb_info == NULL) {
5538 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5539 return CAMERA_ERROR_INVALID_PARAMETER;
5541 sock_fd = pc->cb_info->fd;
5542 LOGD("Enter, handle :%x", pc->remote_handle);
5543 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS] = foreach_cb;
5544 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS] = user_data;
5546 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5547 LOGD("Enter, handle :%x", pc->remote_handle);
5551 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)
5553 if (camera == NULL || foreach_cb == NULL) {
5554 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5555 return CAMERA_ERROR_INVALID_PARAMETER;
5557 int ret = CAMERA_ERROR_NONE;
5559 camera_cli_s *pc = (camera_cli_s *)camera;
5560 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FPS_BY_RESOLUTION;
5562 if (pc->cb_info == NULL) {
5563 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5564 return CAMERA_ERROR_INVALID_PARAMETER;
5566 sock_fd = pc->cb_info->fd;
5567 LOGD("Enter, handle :%x", pc->remote_handle);
5568 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS_BY_RESOLUTION] = foreach_cb;
5569 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS_BY_RESOLUTION] = user_data;
5571 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, width, INT, height);
5572 LOGD("ret : 0x%x", ret);
5576 int camera_attr_foreach_supported_stream_flip(camera_h camera, camera_attr_supported_stream_flip_cb foreach_cb, void *user_data)
5578 if (camera == NULL || foreach_cb == NULL) {
5579 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5580 return CAMERA_ERROR_INVALID_PARAMETER;
5582 int ret = CAMERA_ERROR_NONE;
5584 camera_cli_s *pc = (camera_cli_s *)camera;
5585 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_STREAM_FLIP;
5587 if (pc->cb_info == NULL) {
5588 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5589 return CAMERA_ERROR_INVALID_PARAMETER;
5591 sock_fd = pc->cb_info->fd;
5592 LOGD("Enter, handle :%x", pc->remote_handle);
5593 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_FLIP] = foreach_cb;
5594 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_FLIP] = user_data;
5596 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5597 LOGD("ret : 0x%x", ret);
5602 int camera_attr_foreach_supported_stream_rotation(camera_h camera, camera_attr_supported_stream_rotation_cb foreach_cb, void *user_data)
5604 if (camera == NULL || foreach_cb == NULL) {
5605 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5606 return CAMERA_ERROR_INVALID_PARAMETER;
5608 int ret = CAMERA_ERROR_NONE;
5610 camera_cli_s *pc = (camera_cli_s *)camera;
5611 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_STREAM_ROTATION;
5613 if (pc->cb_info == NULL) {
5614 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5615 return CAMERA_ERROR_INVALID_PARAMETER;
5617 sock_fd = pc->cb_info->fd;
5618 LOGD("Enter, handle :%x", pc->remote_handle);
5619 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION] = foreach_cb;
5620 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION] = user_data;
5622 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5623 LOGD("ret : 0x%x", ret);
5628 int camera_attr_set_stream_rotation(camera_h camera , camera_rotation_e rotation)
5630 if (camera == NULL) {
5631 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5632 return CAMERA_ERROR_INVALID_PARAMETER;
5635 int ret = CAMERA_ERROR_NONE;
5636 camera_cli_s *pc = (camera_cli_s *)camera;
5637 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_STREAM_ROTATION;
5639 if (pc->cb_info == NULL) {
5640 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5641 return CAMERA_ERROR_INVALID_PARAMETER;
5643 sock_fd = pc->cb_info->fd;
5644 int set_rotation = (int)rotation;
5646 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5647 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_rotation);
5648 LOGD("ret : 0x%x", ret);
5653 int camera_attr_get_stream_rotation(camera_h camera , camera_rotation_e *rotation)
5655 if (camera == NULL || rotation == NULL) {
5656 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5657 return CAMERA_ERROR_INVALID_PARAMETER;
5660 int ret = CAMERA_ERROR_NONE;
5661 camera_cli_s *pc = (camera_cli_s *)camera;
5662 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_STREAM_ROTATION;
5664 if (pc->cb_info == NULL) {
5665 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5666 return CAMERA_ERROR_INVALID_PARAMETER;
5668 sock_fd = pc->cb_info->fd;
5671 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5672 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5674 if (ret == CAMERA_ERROR_NONE) {
5675 muse_camera_msg_get(get_rotation, pc->cb_info->recv_msg);
5676 *rotation = (camera_rotation_e)get_rotation;
5678 LOGD("ret : 0x%x", ret);
5683 int camera_attr_set_stream_flip(camera_h camera , camera_flip_e flip)
5685 if (camera == NULL) {
5686 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5687 return CAMERA_ERROR_INVALID_PARAMETER;
5690 int ret = CAMERA_ERROR_NONE;
5691 camera_cli_s *pc = (camera_cli_s *)camera;
5692 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_STREAM_FLIP;
5694 if (pc->cb_info == NULL) {
5695 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5696 return CAMERA_ERROR_INVALID_PARAMETER;
5698 sock_fd = pc->cb_info->fd;
5699 int set_flip = (int)flip;
5701 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5702 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_flip);
5703 LOGD("ret : 0x%x", ret);
5708 int camera_attr_get_stream_flip(camera_h camera , camera_flip_e *flip)
5710 if (camera == NULL || flip == NULL) {
5711 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5712 return CAMERA_ERROR_INVALID_PARAMETER;
5715 int ret = CAMERA_ERROR_NONE;
5716 camera_cli_s *pc = (camera_cli_s *)camera;
5717 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_STREAM_FLIP;
5719 if (pc->cb_info == NULL) {
5720 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5721 return CAMERA_ERROR_INVALID_PARAMETER;
5723 sock_fd = pc->cb_info->fd;
5726 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5727 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5729 if (ret == CAMERA_ERROR_NONE) {
5730 muse_camera_msg_get(get_flip, pc->cb_info->recv_msg);
5731 *flip = (camera_flip_e)get_flip;
5733 LOGD("ret : 0x%x", ret);
5737 int camera_attr_set_hdr_mode(camera_h camera, camera_attr_hdr_mode_e mode)
5739 if (camera == NULL) {
5740 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5741 return CAMERA_ERROR_INVALID_PARAMETER;
5744 int ret = CAMERA_ERROR_NONE;
5745 camera_cli_s *pc = (camera_cli_s *)camera;
5746 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_HDR_MODE;
5748 if (pc->cb_info == NULL) {
5749 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5750 return CAMERA_ERROR_INVALID_PARAMETER;
5752 sock_fd = pc->cb_info->fd;
5753 int set_mode = (int)mode;
5755 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5756 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
5757 LOGD("ret : 0x%x", ret);
5762 int camera_attr_get_hdr_mode(camera_h camera, camera_attr_hdr_mode_e *mode)
5764 if (camera == NULL) {
5765 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5766 return CAMERA_ERROR_INVALID_PARAMETER;
5769 LOGE("INVALID_PARAMETER(0x%08x) - mode", CAMERA_ERROR_INVALID_PARAMETER);
5770 return CAMERA_ERROR_INVALID_PARAMETER;
5772 int ret = CAMERA_ERROR_NONE;
5773 camera_cli_s *pc = (camera_cli_s *)camera;
5774 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_HDR_MODE;
5776 if (pc->cb_info == NULL) {
5777 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5778 return CAMERA_ERROR_INVALID_PARAMETER;
5780 sock_fd = pc->cb_info->fd;
5783 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5784 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5786 if (ret == CAMERA_ERROR_NONE) {
5787 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
5788 *mode = (camera_attr_hdr_mode_e)get_mode;
5790 LOGD("ret : 0x%x", ret);
5795 bool camera_attr_is_supported_hdr_capture(camera_h camera)
5797 if (camera == NULL) {
5798 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5802 int ret = CAMERA_ERROR_NONE;
5803 camera_cli_s *pc = (camera_cli_s *)camera;
5804 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_HDR_CAPTURE;
5806 if (pc->cb_info == NULL) {
5807 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5808 return CAMERA_ERROR_INVALID_PARAMETER;
5810 sock_fd = pc->cb_info->fd;
5811 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5812 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5813 LOGD("ret : 0x%x", ret);
5818 int camera_attr_set_hdr_capture_progress_cb(camera_h camera, camera_attr_hdr_progress_cb callback, void *user_data)
5820 int ret = CAMERA_ERROR_NONE;
5821 camera_cli_s *pc = (camera_cli_s *)camera;
5822 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_HDR_CAPTURE_PROGRESS_CB;
5825 if (camera == NULL) {
5826 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5827 return CAMERA_ERROR_INVALID_PARAMETER;
5830 if (pc->cb_info == NULL) {
5831 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5832 return CAMERA_ERROR_INVALID_PARAMETER;
5835 sock_fd = pc->cb_info->fd;
5837 LOGD("Enter, handle :%x", pc->remote_handle);
5839 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5841 if (ret == CAMERA_ERROR_NONE) {
5842 if (callback == NULL) {
5843 LOGE("INVALID_PARAMETER(0x%08x) - callback", CAMERA_ERROR_INVALID_PARAMETER);
5844 return CAMERA_ERROR_INVALID_PARAMETER;
5847 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = callback;
5848 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = user_data;
5851 LOGD("ret : 0x%x", ret);
5857 int camera_attr_unset_hdr_capture_progress_cb(camera_h camera)
5859 if (camera == NULL) {
5860 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5861 return CAMERA_ERROR_INVALID_PARAMETER;
5864 int ret = CAMERA_ERROR_NONE;
5866 camera_cli_s *pc = (camera_cli_s *)camera;
5867 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_UNSET_HDR_CAPTURE_PROGRESS_CB;
5869 if (pc->cb_info == NULL) {
5870 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5871 return CAMERA_ERROR_INVALID_PARAMETER;
5873 sock_fd = pc->cb_info->fd;
5874 LOGD("Enter, handle :%x", pc->remote_handle);
5876 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = (void *)NULL;
5877 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = (void *)NULL;
5879 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5880 LOGD("ret : 0x%x", ret);
5885 int camera_attr_enable_anti_shake(camera_h camera, bool enable)
5887 if (camera == NULL) {
5888 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5889 return CAMERA_ERROR_INVALID_PARAMETER;
5892 int ret = CAMERA_ERROR_NONE;
5893 camera_cli_s *pc = (camera_cli_s *)camera;
5894 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_ANTI_SHAKE;
5896 if (pc->cb_info == NULL) {
5897 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5898 return CAMERA_ERROR_INVALID_PARAMETER;
5900 sock_fd = pc->cb_info->fd;
5901 int set_enable = (int)enable;
5903 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5904 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
5905 LOGD("ret : 0x%x", ret);
5910 int camera_attr_is_enabled_anti_shake(camera_h camera , bool *enabled)
5912 if (camera == NULL) {
5913 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5914 return CAMERA_ERROR_INVALID_PARAMETER;
5916 if (enabled == NULL) {
5917 LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER);
5918 return CAMERA_ERROR_INVALID_PARAMETER;
5920 int ret = CAMERA_ERROR_NONE;
5921 camera_cli_s *pc = (camera_cli_s *)camera;
5922 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_ANTI_SHAKE;
5924 if (pc->cb_info == NULL) {
5925 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5926 return CAMERA_ERROR_INVALID_PARAMETER;
5928 sock_fd = pc->cb_info->fd;
5931 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5932 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5934 if (ret == CAMERA_ERROR_NONE) {
5935 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
5936 *enabled = (bool)get_enabled;
5938 LOGD("ret : 0x%x", ret);
5943 bool camera_attr_is_supported_anti_shake(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_ANTI_SHAKE;
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_enable_video_stabilization(camera_h camera, bool enable)
5969 if (camera == NULL) {
5970 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5971 return CAMERA_ERROR_INVALID_PARAMETER;
5974 int ret = CAMERA_ERROR_NONE;
5975 camera_cli_s *pc = (camera_cli_s *)camera;
5976 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_VIDEO_STABILIZATION;
5978 if (pc->cb_info == NULL) {
5979 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5980 return CAMERA_ERROR_INVALID_PARAMETER;
5982 sock_fd = pc->cb_info->fd;
5983 int set_enable = (int)enable;
5985 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5986 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
5987 LOGD("ret : 0x%x", ret);
5992 int camera_attr_is_enabled_video_stabilization(camera_h camera, bool *enabled)
5994 if (camera == NULL) {
5995 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5996 return CAMERA_ERROR_INVALID_PARAMETER;
5998 if (enabled == NULL) {
5999 LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER);
6000 return CAMERA_ERROR_INVALID_PARAMETER;
6002 int ret = CAMERA_ERROR_NONE;
6003 camera_cli_s *pc = (camera_cli_s *)camera;
6004 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_VIDEO_STABILIZATION;
6006 if (pc->cb_info == NULL) {
6007 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6008 return CAMERA_ERROR_INVALID_PARAMETER;
6010 sock_fd = pc->cb_info->fd;
6013 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6014 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6016 if (ret == CAMERA_ERROR_NONE) {
6017 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
6018 *enabled = (bool)get_enabled;
6020 LOGD("ret : 0x%x", ret);
6025 bool camera_attr_is_supported_video_stabilization(camera_h camera)
6027 if (camera == NULL) {
6028 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6032 int ret = CAMERA_ERROR_NONE;
6033 camera_cli_s *pc = (camera_cli_s *)camera;
6034 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_VIDEO_STABILIZATION;
6036 if (pc->cb_info == NULL) {
6037 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6038 return CAMERA_ERROR_INVALID_PARAMETER;
6040 sock_fd = pc->cb_info->fd;
6041 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6042 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6043 LOGD("ret : 0x%x", ret);
6048 int camera_attr_enable_auto_contrast(camera_h camera, bool enable)
6050 if (camera == NULL) {
6051 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6052 return CAMERA_ERROR_INVALID_PARAMETER;
6055 int ret = CAMERA_ERROR_NONE;
6056 camera_cli_s *pc = (camera_cli_s *)camera;
6057 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_AUTO_CONTRAST;
6059 if (pc->cb_info == NULL) {
6060 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6061 return CAMERA_ERROR_INVALID_PARAMETER;
6063 sock_fd = pc->cb_info->fd;
6064 int set_enable = (int)enable;
6066 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6067 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
6068 LOGD("ret : 0x%x", ret);
6073 int camera_attr_is_enabled_auto_contrast(camera_h camera, bool *enabled)
6075 if (camera == NULL) {
6076 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
6077 return CAMERA_ERROR_INVALID_PARAMETER;
6079 if (enabled == NULL) {
6080 LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER);
6081 return CAMERA_ERROR_INVALID_PARAMETER;
6083 int ret = CAMERA_ERROR_NONE;
6084 camera_cli_s *pc = (camera_cli_s *)camera;
6085 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_AUTO_CONTRAST;
6087 if (pc->cb_info == NULL) {
6088 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6089 return CAMERA_ERROR_INVALID_PARAMETER;
6091 sock_fd = pc->cb_info->fd;
6094 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6095 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6097 if (ret == CAMERA_ERROR_NONE) {
6098 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
6099 *enabled = (bool)get_enabled;
6101 LOGD("ret : 0x%x", ret);
6106 bool camera_attr_is_supported_auto_contrast(camera_h camera)
6108 if (camera == NULL) {
6109 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6113 int ret = CAMERA_ERROR_NONE;
6114 camera_cli_s *pc = (camera_cli_s *)camera;
6115 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_AUTO_CONTRAST;
6117 if (pc->cb_info == NULL) {
6118 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6119 return CAMERA_ERROR_INVALID_PARAMETER;
6121 sock_fd = pc->cb_info->fd;
6122 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6123 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6124 LOGD("ret : 0x%x", ret);
6129 int camera_attr_disable_shutter_sound(camera_h camera, bool disable)
6131 if (camera == NULL) {
6132 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6133 return CAMERA_ERROR_INVALID_PARAMETER;
6136 int ret = CAMERA_ERROR_NONE;
6137 camera_cli_s *pc = (camera_cli_s *)camera;
6138 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_DISABLE_SHUTTER_SOUND;
6140 if (pc->cb_info == NULL) {
6141 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6142 return CAMERA_ERROR_INVALID_PARAMETER;
6144 sock_fd = pc->cb_info->fd;
6145 int set_disable = (int)disable;
6147 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6148 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_disable);
6149 LOGD("ret : 0x%x", ret);
6154 int camera_attr_set_pan(camera_h camera, camera_attr_ptz_move_type_e move_type, int pan_step)
6156 if (camera == NULL) {
6157 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6158 return CAMERA_ERROR_INVALID_PARAMETER;
6161 camera_cli_s *pc = (camera_cli_s *)camera;
6162 if (pc->cb_info == NULL) {
6163 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6164 return CAMERA_ERROR_INVALID_PARAMETER;
6167 int ret = CAMERA_ERROR_NONE;
6168 int sock_fd = pc->cb_info->fd;
6169 int set_move_type = (int)move_type;
6170 int set_pan_step = pan_step;
6171 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_PAN;
6173 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6174 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, set_move_type, INT, set_pan_step);
6175 LOGD("ret : 0x%x", ret);
6180 int camera_attr_get_pan(camera_h camera, int *pan_step)
6182 if (camera == NULL || pan_step == NULL) {
6183 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6184 return CAMERA_ERROR_INVALID_PARAMETER;
6187 camera_cli_s *pc = (camera_cli_s *)camera;
6188 if (pc->cb_info == NULL) {
6189 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6190 return CAMERA_ERROR_INVALID_PARAMETER;
6193 int ret = CAMERA_ERROR_NONE;
6194 int sock_fd = pc->cb_info->fd;
6196 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_PAN;
6198 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6199 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6201 if (ret == CAMERA_ERROR_NONE) {
6202 muse_camera_msg_get(get_pan_step, pc->cb_info->recv_msg);
6203 *pan_step = get_pan_step;
6205 LOGD("ret : 0x%x", ret);
6210 int camera_attr_get_pan_range(camera_h camera, int *min, int *max)
6212 if (camera == NULL || min == NULL || max == NULL) {
6213 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6214 return CAMERA_ERROR_INVALID_PARAMETER;
6217 camera_cli_s *pc = (camera_cli_s *)camera;
6218 if (pc->cb_info == NULL) {
6219 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6220 return CAMERA_ERROR_INVALID_PARAMETER;
6223 int ret = CAMERA_ERROR_NONE;
6224 int sock_fd = pc->cb_info->fd;
6227 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_PAN_RANGE;
6229 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6230 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6232 if (ret == CAMERA_ERROR_NONE) {
6233 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
6234 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
6238 LOGD("ret : 0x%x", ret);
6243 int camera_attr_set_tilt(camera_h camera, camera_attr_ptz_move_type_e move_type, int tilt_step)
6245 if (camera == NULL) {
6246 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6247 return CAMERA_ERROR_INVALID_PARAMETER;
6250 camera_cli_s *pc = (camera_cli_s *)camera;
6251 if (pc->cb_info == NULL) {
6252 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6253 return CAMERA_ERROR_INVALID_PARAMETER;
6256 int ret = CAMERA_ERROR_NONE;
6257 int sock_fd = pc->cb_info->fd;
6258 int set_move_type = (int)move_type;
6259 int set_tilt_step = tilt_step;
6260 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TILT;
6262 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6263 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, set_move_type, INT, set_tilt_step);
6264 LOGD("ret : 0x%x", ret);
6269 int camera_attr_get_tilt(camera_h camera, int *tilt_step)
6271 if (camera == NULL || tilt_step == NULL) {
6272 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6273 return CAMERA_ERROR_INVALID_PARAMETER;
6276 camera_cli_s *pc = (camera_cli_s *)camera;
6277 if (pc->cb_info == NULL) {
6278 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6279 return CAMERA_ERROR_INVALID_PARAMETER;
6282 int ret = CAMERA_ERROR_NONE;
6283 int sock_fd = pc->cb_info->fd;
6285 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TILT;
6287 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6288 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6290 if (ret == CAMERA_ERROR_NONE) {
6291 muse_camera_msg_get(get_tilt_step, pc->cb_info->recv_msg);
6292 *tilt_step = get_tilt_step;
6294 LOGD("ret : 0x%x", ret);
6299 int camera_attr_get_tilt_range(camera_h camera, int *min, int *max)
6301 if (camera == NULL || min == NULL || max == NULL) {
6302 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6303 return CAMERA_ERROR_INVALID_PARAMETER;
6306 camera_cli_s *pc = (camera_cli_s *)camera;
6307 if (pc->cb_info == NULL) {
6308 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6309 return CAMERA_ERROR_INVALID_PARAMETER;
6312 int ret = CAMERA_ERROR_NONE;
6313 int sock_fd = pc->cb_info->fd;
6316 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TILT_RANGE;
6318 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6319 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6321 if (ret == CAMERA_ERROR_NONE) {
6322 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
6323 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
6327 LOGD("ret : 0x%x", ret);
6332 int camera_attr_set_ptz_type(camera_h camera, camera_attr_ptz_type_e ptz_type)
6334 if (camera == NULL) {
6335 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6336 return CAMERA_ERROR_INVALID_PARAMETER;
6339 camera_cli_s *pc = (camera_cli_s *)camera;
6340 if (pc->cb_info == NULL) {
6341 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6342 return CAMERA_ERROR_INVALID_PARAMETER;
6345 int ret = CAMERA_ERROR_NONE;
6346 int sock_fd = pc->cb_info->fd;
6347 int set_ptz_type = (int)ptz_type;
6348 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_PTZ_TYPE;
6350 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6351 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_ptz_type);
6352 LOGD("ret : 0x%x", ret);
6357 int camera_attr_foreach_supported_ptz_type(camera_h camera, camera_attr_supported_ptz_type_cb foreach_cb, void *user_data)
6359 if (camera == NULL || foreach_cb == NULL) {
6360 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6361 return CAMERA_ERROR_INVALID_PARAMETER;
6363 int ret = CAMERA_ERROR_NONE;
6365 camera_cli_s *pc = (camera_cli_s *)camera;
6366 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_PTZ_TYPE;
6368 if (pc->cb_info == NULL) {
6369 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6370 return CAMERA_ERROR_INVALID_PARAMETER;
6372 sock_fd = pc->cb_info->fd;
6373 LOGD("Enter, handle :%x", pc->remote_handle);
6374 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PTZ_TYPE] = foreach_cb;
6375 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PTZ_TYPE] = user_data;
6377 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6378 LOGD("ret : 0x%x", ret);
6383 int camera_attr_set_display_roi_area(camera_h camera, int x, int y, int width, int height)
6385 if (camera == NULL) {
6386 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6387 return CAMERA_ERROR_INVALID_PARAMETER;
6390 camera_cli_s *pc = (camera_cli_s *)camera;
6391 if (pc->cb_info == NULL) {
6392 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6393 return CAMERA_ERROR_INVALID_PARAMETER;
6396 int ret = CAMERA_ERROR_NONE;
6397 int sock_fd = pc->cb_info->fd;
6398 int set_display_roi_area[4] = {x, y, width, height};
6399 muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY_ROI_AREA;
6401 if(CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
6402 g_mutex_lock(&pc->cb_info->evas_mutex);
6404 ret = mm_evas_renderer_set_roi_area(pc->cb_info->evas_info, x, y, width, height);
6406 g_mutex_unlock(&pc->cb_info->evas_mutex);
6408 if (ret != MM_ERROR_NONE) {
6409 LOGE("mm_evas_renderer_set_roi_area error 0x%x", ret);
6410 return CAMERA_ERROR_INVALID_OPERATION;
6413 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6414 muse_camera_msg_send_array(api, sock_fd, pc->cb_info, ret,
6415 set_display_roi_area, sizeof(set_display_roi_area), sizeof(int));
6416 LOGD("ret : 0x%x", ret);
6423 int camera_attr_get_display_roi_area(camera_h camera, int *x, int *y, int *width, int *height)
6425 if (camera == NULL || x == NULL || y == NULL || width == NULL || height == NULL) {
6426 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6427 return CAMERA_ERROR_INVALID_PARAMETER;
6430 camera_cli_s *pc = (camera_cli_s *)camera;
6431 if (pc->cb_info == NULL) {
6432 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6433 return CAMERA_ERROR_INVALID_PARAMETER;
6436 int ret = CAMERA_ERROR_NONE;
6437 int sock_fd = pc->cb_info->fd;
6438 int get_display_roi_area[4] = {0,};
6439 muse_camera_api_e api = MUSE_CAMERA_API_GET_DISPLAY_ROI_AREA;
6441 if(CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
6442 g_mutex_lock(&pc->cb_info->evas_mutex);
6444 ret = mm_evas_renderer_get_roi_area(pc->cb_info->evas_info, x, y, width, height);
6446 g_mutex_unlock(&pc->cb_info->evas_mutex);
6448 if (ret != MM_ERROR_NONE) {
6449 LOGE("mm_evas_renderer_get_roi_area error 0x%x", ret);
6450 return CAMERA_ERROR_INVALID_OPERATION;
6453 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6454 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6456 if (ret == CAMERA_ERROR_NONE) {
6457 muse_camera_msg_get_array(get_display_roi_area, pc->cb_info->recv_msg);
6458 *x = get_display_roi_area[0];
6459 *y = get_display_roi_area[1];
6460 *width = get_display_roi_area[2];
6461 *height = get_display_roi_area[3];
6463 LOGD("ret : 0x%x", ret);
6465 LOGE("Returned value is not valid : 0x%x", ret);