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 _release_imported_bo(&data_bo);
941 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
942 cb_info->fd, cb_info, INT, tbm_key);
946 buf_pos = (unsigned char *)bo_handle.ptr;
948 /* get stream info */
949 stream = (camera_stream_data_s *)buf_pos;
951 for (i = 0 ; i < num_buffer_key ; i++) {
952 /* import buffer bo and get virtual address */
953 if (!_import_tbm_key(cb_info->bufmgr, buffer_key[i], &buffer_bo[i], &buffer_bo_handle[i])) {
954 LOGE("failed to import buffer key %d", buffer_key[i]);
956 /* release imported bo */
957 _release_imported_bo(&data_bo);
958 _release_imported_bo(&bo);
960 for (i -= 1 ; i >= 0 ; i--)
961 _release_imported_bo(&buffer_bo[i]);
963 /* send return buffer */
964 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
965 cb_info->fd, cb_info, INT, tbm_key);
971 /* call preview callback */
972 if (cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW]) {
973 _camera_preview_frame_create(stream, num_buffer_key, buffer_bo_handle, &data_bo_handle, &frame);
975 e_type = MUSE_CAMERA_EVENT_TYPE_PREVIEW;
976 ((camera_preview_cb)cb_info->user_cb[e_type])(&frame, cb_info->user_data[e_type]);
979 /* call media packet callback */
980 if (cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW]) {
981 ret = _camera_media_packet_data_create(tbm_key, num_buffer_key, bo, buffer_bo, data_bo, &mp_data);
983 if (ret == CAMERA_ERROR_NONE) {
984 ret = _camera_media_packet_create(cb_info, stream, mp_data, &pkt);
986 e_type = MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW;
987 if (ret == CAMERA_ERROR_NONE) {
988 ((camera_media_packet_preview_cb)cb_info->user_cb[e_type])(pkt, cb_info->user_data[e_type]);
990 _camera_media_packet_data_release(mp_data, cb_info);
996 /* call evas renderer */
997 if (CHECK_PREVIEW_CB(cb_info, PREVIEW_CB_TYPE_EVAS)) {
998 ret = _camera_media_packet_data_create(tbm_key, num_buffer_key, bo, buffer_bo, data_bo, &mp_data);
1000 if (ret == CAMERA_ERROR_NONE) {
1001 ret = _camera_media_packet_create(cb_info, stream, mp_data, &pkt);
1003 if (ret == CAMERA_ERROR_NONE) {
1004 g_mutex_lock(&cb_info->evas_mutex);
1006 if (cb_info->run_evas_render)
1007 mm_evas_renderer_write(pkt, cb_info->evas_info);
1009 LOGW("evas renderer is stopped, skip this buffer...");
1010 media_packet_destroy(pkt);
1015 g_mutex_unlock(&cb_info->evas_mutex);
1017 _camera_media_packet_data_release(mp_data, cb_info);
1023 /* send message for preview callback return */
1024 if (!CHECK_PREVIEW_CB(cb_info, PREVIEW_CB_TYPE_EVAS))
1025 muse_camera_msg_send_no_return(MUSE_CAMERA_API_PREVIEW_CB_RETURN, cb_info->fd, cb_info);
1027 if (mp_data == NULL) {
1028 /* release imported bo */
1029 for (i = 0 ; i < num_buffer_key ; i++)
1030 _release_imported_bo(&buffer_bo[i]);
1032 /* unmap and unref tbm bo */
1033 _release_imported_bo(&data_bo);
1034 _release_imported_bo(&bo);
1037 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
1038 cb_info->fd, cb_info, INT, tbm_key);
1040 /*LOGD("return buffer Done");*/
1044 case MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS:
1048 muse_camera_msg_get(percent, recv_msg);
1050 LOGD("HDR progress - %d \%", percent);
1052 ((camera_attr_hdr_progress_cb)cb_info->user_cb[event])(percent, cb_info->user_data[event]);
1055 case MUSE_CAMERA_EVENT_TYPE_INTERRUPTED:
1061 muse_camera_msg_get(policy, recv_msg);
1062 muse_camera_msg_get(previous, recv_msg);
1063 muse_camera_msg_get(current, recv_msg);
1065 LOGD("INTERRUPTED - policy %d, state previous %d, current %d",
1066 policy, previous, current);
1068 ((camera_interrupted_cb)cb_info->user_cb[event])((camera_policy_e)policy,
1069 (camera_state_e)previous, (camera_state_e)current, cb_info->user_data[event]);
1072 case MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION:
1075 camera_detected_face_s *faces = NULL;
1077 muse_camera_msg_get(count, recv_msg);
1078 muse_camera_msg_get(tbm_key, recv_msg);
1080 if (count > 0 && tbm_key > 0) {
1081 LOGD("FACE_DETECTION - count %d, tbm_key %d", count, tbm_key);
1083 if (!_import_tbm_key(cb_info->bufmgr, tbm_key, &bo, &bo_handle))
1087 faces = bo_handle.ptr;
1089 ((camera_face_detected_cb)cb_info->user_cb[event])(faces, count, cb_info->user_data[event]);
1095 for (i = 0 ; i < count ; i++) {
1096 LOGD("id[%2d] - score %d, position (%d,%d,%dx%d)",
1097 i, faces[i].score, faces[i].x, faces[i].y, faces[i].width, faces[i].height);
1103 _release_imported_bo(&bo);
1106 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
1107 cb_info->fd, cb_info, INT, tbm_key);
1109 LOGD("return buffer done");
1111 LOGE("invalid message - count %d, key %d", count, tbm_key);
1115 case MUSE_CAMERA_EVENT_TYPE_ERROR:
1118 int current_state = 0;
1120 muse_camera_msg_get(error, recv_msg);
1121 muse_camera_msg_get(current_state, recv_msg);
1123 LOGE("ERROR - error 0x%x, current_state %d", error, current_state);
1125 ((camera_error_cb)cb_info->user_cb[event])((camera_error_e)error,
1126 (camera_state_e)current_state, cb_info->user_data[event]);
1129 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_RESOLUTION:
1130 muse_camera_msg_get(param1, recv_msg);
1131 muse_camera_msg_get(param2, recv_msg);
1133 LOGD("SUPPORTED_PREVIEW_RESOLUTION - %d x %d", param1, param2);
1135 if (((camera_supported_preview_resolution_cb)cb_info->user_cb[event])(param1, param2, cb_info->user_data[event]) == false) {
1136 cb_info->user_cb[event] = NULL;
1137 cb_info->user_data[event] = NULL;
1138 LOGD("stop foreach callback for SUPPORTED_PREVIEW_RESOLUTION");
1141 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_RESOLUTION:
1142 muse_camera_msg_get(param1, recv_msg);
1143 muse_camera_msg_get(param2, recv_msg);
1145 LOGD("SUPPORTED_CAPTURE_RESOLUTION - %d x %d", param1, param2);
1147 if (((camera_supported_capture_resolution_cb)cb_info->user_cb[event])(param1, param2, cb_info->user_data[event]) == false) {
1148 cb_info->user_cb[event] = NULL;
1149 cb_info->user_data[event] = NULL;
1150 LOGD("stop foreach callback for SUPPORTED_CAPTURE_RESOLUTION");
1153 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_FORMAT:
1154 muse_camera_msg_get(param1, recv_msg);
1156 LOGD("SUPPORTED_CAPTURE_FORMAT - %d ", param1);
1158 if (((camera_supported_capture_format_cb)cb_info->user_cb[event])((camera_pixel_format_e)param1, cb_info->user_data[event]) == false) {
1159 cb_info->user_cb[event] = NULL;
1160 cb_info->user_data[event] = NULL;
1161 LOGD("stop foreach callback for SUPPORTED_CAPTURE_FORMAT");
1164 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_FORMAT:
1165 muse_camera_msg_get(param1, recv_msg);
1167 LOGD("SUPPORTED_PREVIEW_FORMAT - %d ", param1);
1169 if (((camera_supported_preview_format_cb)cb_info->user_cb[event])((camera_pixel_format_e)param1, cb_info->user_data[event]) == false) {
1170 cb_info->user_cb[event] = NULL;
1171 cb_info->user_data[event] = NULL;
1172 LOGD("stop foreach callback for SUPPORTED_PREVIEW_FORMAT");
1175 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_AF_MODE:
1176 muse_camera_msg_get(param1, recv_msg);
1178 LOGD("SUPPORTED_AF_MODE - %d ", param1);
1180 if (((camera_attr_supported_af_mode_cb)cb_info->user_cb[event])((camera_attr_af_mode_e)param1, cb_info->user_data[event]) == false) {
1181 cb_info->user_cb[event] = NULL;
1182 cb_info->user_data[event] = NULL;
1183 LOGD("stop foreach callback for SUPPORTED_AF_MODE");
1186 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EXPOSURE_MODE:
1187 muse_camera_msg_get(param1, recv_msg);
1189 LOGD("SUPPORTED_EXPOSURE_MODE - %d ", param1);
1191 if (((camera_attr_supported_exposure_mode_cb)cb_info->user_cb[event])((camera_attr_exposure_mode_e)param1, cb_info->user_data[event]) == false) {
1192 cb_info->user_cb[event] = NULL;
1193 cb_info->user_data[event] = NULL;
1194 LOGD("stop foreach callback for SUPPORTED_EXPOSURE_MODE");
1197 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_ISO:
1198 muse_camera_msg_get(param1, recv_msg);
1200 LOGD("SUPPORTED_ISO - %d ", param1);
1202 if (((camera_attr_supported_iso_cb)cb_info->user_cb[event])((camera_attr_iso_e)param1, cb_info->user_data[event]) == false) {
1203 cb_info->user_cb[event] = NULL;
1204 cb_info->user_data[event] = NULL;
1205 LOGD("stop foreach callback for SUPPORTED_ISO");
1208 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_WHITEBALANCE:
1209 muse_camera_msg_get(param1, recv_msg);
1211 LOGD("SUPPORTED_WHITEBALANCE - %d ", param1);
1213 if (((camera_attr_supported_whitebalance_cb)cb_info->user_cb[event])((camera_attr_whitebalance_e)param1, cb_info->user_data[event]) == false) {
1214 cb_info->user_cb[event] = NULL;
1215 cb_info->user_data[event] = NULL;
1216 LOGD("stop foreach callback for SUPPORTED_WHITEBALANCE");
1219 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EFFECT:
1220 muse_camera_msg_get(param1, recv_msg);
1222 LOGD("SUPPORTED_EFFECT - %d ", param1);
1224 if (((camera_attr_supported_effect_cb)cb_info->user_cb[event])((camera_attr_effect_mode_e)param1, cb_info->user_data[event]) == false) {
1225 cb_info->user_cb[event] = NULL;
1226 cb_info->user_data[event] = NULL;
1227 LOGD("stop foreach callback for SUPPORTED_EFFECT");
1230 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_SCENE_MODE:
1231 muse_camera_msg_get(param1, recv_msg);
1233 LOGD("SUPPORTED_SCENE_MODE - %d ", param1);
1235 if (((camera_attr_supported_scene_mode_cb)cb_info->user_cb[event])((camera_attr_scene_mode_e)param1, cb_info->user_data[event]) == false) {
1236 cb_info->user_cb[event] = NULL;
1237 cb_info->user_data[event] = NULL;
1238 LOGD("stop foreach callback for SUPPORTED_SCENE_MODE");
1241 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FLASH_MODE:
1242 muse_camera_msg_get(param1, recv_msg);
1244 LOGD("SUPPORTED_FLASH_MODE - %d ", param1);
1246 if (((camera_attr_supported_flash_mode_cb)cb_info->user_cb[event])((camera_attr_flash_mode_e)param1, cb_info->user_data[event]) == false) {
1247 cb_info->user_cb[event] = NULL;
1248 cb_info->user_data[event] = NULL;
1249 LOGD("stop foreach callback for SUPPORTED_FLASH_MODE");
1252 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS:
1253 muse_camera_msg_get(param1, recv_msg);
1255 LOGD("SUPPORTED_FPS - %d ", param1);
1257 if (((camera_attr_supported_fps_cb)cb_info->user_cb[event])((camera_attr_fps_e)param1, cb_info->user_data[event]) == false) {
1258 cb_info->user_cb[event] = NULL;
1259 cb_info->user_data[event] = NULL;
1260 LOGD("stop foreach callback for SUPPORTED_FPS");
1263 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS_BY_RESOLUTION:
1264 muse_camera_msg_get(param1, recv_msg);
1266 LOGD("SUPPORTED_FPS_BY_RESOLUTION - %d ", param1);
1268 if (((camera_attr_supported_fps_cb)cb_info->user_cb[event])((camera_attr_fps_e)param1, cb_info->user_data[event]) == false) {
1269 cb_info->user_cb[event] = NULL;
1270 cb_info->user_data[event] = NULL;
1271 LOGD("stop foreach callback for SUPPORTED_FPS_BY_RESOLUTION");
1274 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_FLIP:
1275 muse_camera_msg_get(param1, recv_msg);
1277 LOGD("SUPPORTED_STREAM_FLIP - %d ", param1);
1279 if (((camera_attr_supported_stream_flip_cb)cb_info->user_cb[event])((camera_flip_e)param1, cb_info->user_data[event]) == false) {
1280 cb_info->user_cb[event] = NULL;
1281 cb_info->user_data[event] = NULL;
1282 LOGD("stop foreach callback for SUPPORTED_STREAM_FLIP");
1285 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION:
1286 muse_camera_msg_get(param1, recv_msg);
1288 LOGD("SUPPORTED_STREAM_ROTATION - %d ", param1);
1290 if (((camera_attr_supported_stream_rotation_cb)cb_info->user_cb[event])((camera_rotation_e)param1, cb_info->user_data[event]) == false) {
1291 cb_info->user_cb[event] = NULL;
1292 cb_info->user_data[event] = NULL;
1293 LOGD("stop foreach callback for SUPPORTED_STREAM_ROTATION");
1296 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE:
1297 muse_camera_msg_get(param1, recv_msg);
1299 LOGD("SUPPORTED_THEATER_MODE - %d ", param1);
1301 if (((camera_attr_supported_theater_mode_cb)cb_info->user_cb[event])((camera_attr_theater_mode_e)param1, cb_info->user_data[event]) == false) {
1302 cb_info->user_cb[event] = NULL;
1303 cb_info->user_data[event] = NULL;
1304 LOGD("stop foreach callback for SUPPORTED_THEATER_MODE");
1307 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PTZ_TYPE:
1308 muse_camera_msg_get(param1, recv_msg);
1310 LOGD("SUPPORTED_PTZ_TYPE - %d ", param1);
1312 if (((camera_attr_supported_ptz_type_cb)cb_info->user_cb[event])((camera_attr_ptz_type_e)param1, cb_info->user_data[event]) == false) {
1313 cb_info->user_cb[event] = NULL;
1314 cb_info->user_data[event] = NULL;
1315 LOGD("stop foreach callback for SUPPORTED_PTZ_TYPE");
1318 case MUSE_CAMERA_EVENT_TYPE_CAPTURE:
1320 camera_image_data_s *rImage = NULL;
1321 camera_image_data_s *rPostview = NULL;
1322 camera_image_data_s *rThumbnail = NULL;
1323 unsigned char *buf_pos = NULL;
1324 int tbm_key_main = 0;
1325 int tbm_key_post = 0;
1326 int tbm_key_thumb = 0;
1327 tbm_bo bo_main = NULL;
1328 tbm_bo bo_post = NULL;
1329 tbm_bo bo_thumb = NULL;
1330 tbm_bo_handle bo_main_handle = {NULL, };
1331 tbm_bo_handle bo_post_handle = {NULL, };
1332 tbm_bo_handle bo_thumb_handle = {NULL, };
1334 muse_camera_msg_get(tbm_key_main, recv_msg);
1335 muse_camera_msg_get(tbm_key_post, recv_msg);
1336 muse_camera_msg_get(tbm_key_thumb, recv_msg);
1338 LOGD("camera capture callback came in. tbm_key_main %d, tbm_key_post %d, tbm_key_thumb %d",
1339 tbm_key_main, tbm_key_post, tbm_key_thumb);
1341 if (tbm_key_main <= 0) {
1342 LOGE("invalid tbm_key_main %d", tbm_key_main);
1346 /* import tbm bo and get virtual address */
1347 if (!_import_tbm_key(cb_info->bufmgr, tbm_key_main, &bo_main, &bo_main_handle))
1350 buf_pos = (unsigned char *)bo_main_handle.ptr;
1351 rImage = (camera_image_data_s *)buf_pos;
1352 rImage->data = buf_pos + sizeof(camera_image_data_s);
1354 LOGD("image info %dx%d, size : %d", rImage->height, rImage->width, rImage->size);
1356 if (tbm_key_post > 0) {
1357 /* import tbm bo and get virtual address */
1358 if (!_import_tbm_key(cb_info->bufmgr, tbm_key_post, &bo_post, &bo_post_handle))
1361 buf_pos = (unsigned char *)bo_post_handle.ptr;
1362 rPostview = (camera_image_data_s *)buf_pos;
1363 LOGD("rPostview->size : %d", rPostview->size);
1364 rPostview->data = buf_pos + sizeof(camera_image_data_s);
1367 if (tbm_key_thumb > 0) {
1368 /* import tbm bo and get virtual address */
1369 if (!_import_tbm_key(cb_info->bufmgr, tbm_key_thumb, &bo_thumb, &bo_thumb_handle))
1372 buf_pos = (unsigned char *)bo_thumb_handle.ptr;
1374 rThumbnail = (camera_image_data_s *)buf_pos;
1375 LOGD("rThumbnail->size : %d", rThumbnail->size);
1376 rThumbnail->data = buf_pos + sizeof(camera_image_data_s);
1379 ((camera_capturing_cb)cb_info->user_cb[event])(rImage, rPostview, rThumbnail, cb_info->user_data[event]);
1381 /* unmap and unref tbm bo */
1382 _release_imported_bo(&bo_main);
1385 tbm_key = tbm_key_main;
1386 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
1387 cb_info->fd, cb_info, INT, tbm_key);
1389 if (tbm_key_post > 0) {
1390 /* unmap and unref tbm bo */
1391 _release_imported_bo(&bo_post);
1394 tbm_key = tbm_key_post;
1395 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
1396 cb_info->fd, cb_info, INT, tbm_key);
1399 if (tbm_key_thumb > 0) {
1400 /* unmap and unref tbm bo */
1401 _release_imported_bo(&bo_thumb);
1404 tbm_key = tbm_key_thumb;
1405 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
1406 cb_info->fd, cb_info, INT, tbm_key);
1409 LOGD("return buffer done");
1412 case MUSE_CAMERA_EVENT_TYPE_VIDEO_FRAME_RENDER_ERROR:
1415 LOGW("Unknown event : %d", event);
1422 static bool _camera_idle_event_callback(void *data)
1424 camera_cb_info_s *cb_info = NULL;
1425 camera_idle_event_s *cam_idle_event = (camera_idle_event_s *)data;
1427 if (cam_idle_event == NULL) {
1428 LOGE("cam_idle_event is NULL");
1433 g_mutex_lock(&cam_idle_event->event_mutex);
1435 cb_info = cam_idle_event->cb_info;
1436 if (cb_info == NULL) {
1437 LOGW("camera cb_info is NULL. event %d", cam_idle_event->event);
1438 goto IDLE_EVENT_CALLBACK_DONE;
1441 /* remove event from list */
1442 g_mutex_lock(&cb_info->idle_event_mutex);
1443 if (cb_info->idle_event_list)
1444 cb_info->idle_event_list = g_list_remove(cb_info->idle_event_list, (gpointer)cam_idle_event);
1446 /*LOGD("remove camera idle event %p, %p", cam_idle_event, cb_info->idle_event_list);*/
1447 g_mutex_unlock(&cb_info->idle_event_mutex);
1450 _client_user_callback(cam_idle_event->cb_info, cam_idle_event->recv_msg, cam_idle_event->event);
1452 /* send signal for waiting thread */
1453 g_cond_signal(&cb_info->idle_event_cond);
1455 IDLE_EVENT_CALLBACK_DONE:
1456 /* unlock and release event */
1457 g_mutex_unlock(&cam_idle_event->event_mutex);
1458 g_mutex_clear(&cam_idle_event->event_mutex);
1460 g_free(cam_idle_event);
1461 cam_idle_event = NULL;
1466 static void *_camera_msg_handler_func(gpointer data)
1471 int event_class = 0;
1472 camera_message_s *cam_msg = NULL;
1473 camera_idle_event_s *cam_idle_event = NULL;
1474 camera_cb_info_s *cb_info = (camera_cb_info_s *)data;
1476 if (cb_info == NULL) {
1477 LOGE("cb_info NULL");
1483 g_mutex_lock(&cb_info->msg_handler_mutex);
1485 while (g_atomic_int_get(&cb_info->msg_handler_running)) {
1486 if (g_queue_is_empty(cb_info->msg_queue)) {
1487 LOGD("signal wait...");
1488 g_cond_wait(&cb_info->msg_handler_cond, &cb_info->msg_handler_mutex);
1489 LOGD("signal received");
1491 if (g_atomic_int_get(&cb_info->msg_handler_running) == 0) {
1492 LOGD("stop event thread");
1497 cam_msg = (camera_message_s *)g_queue_pop_head(cb_info->msg_queue);
1499 g_mutex_unlock(&cb_info->msg_handler_mutex);
1501 if (cam_msg == NULL) {
1502 LOGE("NULL message");
1503 g_mutex_lock(&cb_info->msg_handler_mutex);
1509 if (api < MUSE_CAMERA_API_MAX) {
1510 g_mutex_lock(&cb_info->api_mutex[api]);
1512 if (muse_camera_msg_get(ret, cam_msg->recv_msg)) {
1513 cb_info->api_ret[api] = ret;
1514 cb_info->api_activating[api] = 1;
1516 LOGD("camera api %d - return 0x%x", ret);
1518 g_cond_signal(&cb_info->api_cond[api]);
1520 LOGE("failed to get camera ret for api %d, msg %s", api, cam_msg->recv_msg);
1523 g_mutex_unlock(&cb_info->api_mutex[api]);
1524 } else if (api == MUSE_CAMERA_CB_EVENT) {
1528 if (!muse_camera_msg_get(event, cam_msg->recv_msg) ||
1529 !muse_camera_msg_get(event_class, cam_msg->recv_msg)) {
1530 LOGE("failed to get camera event %d, class %d", event, event_class);
1535 g_mutex_lock(&cb_info->msg_handler_mutex);
1539 switch (event_class) {
1540 case MUSE_CAMERA_EVENT_CLASS_THREAD_SUB:
1541 _client_user_callback(cb_info, cam_msg->recv_msg, event);
1543 case MUSE_CAMERA_EVENT_CLASS_THREAD_MAIN:
1544 cam_idle_event = g_new0(camera_idle_event_s, 1);
1545 if (cam_idle_event == NULL) {
1546 LOGE("cam_idle_event alloc failed");
1550 cam_idle_event->event = event;
1551 cam_idle_event->cb_info = cb_info;
1552 g_mutex_init(&cam_idle_event->event_mutex);
1553 memcpy(cam_idle_event->recv_msg, cam_msg->recv_msg, sizeof(cam_idle_event->recv_msg));
1555 LOGD("add camera event[%d, %p] to IDLE", event, cam_idle_event);
1557 g_mutex_lock(&cb_info->idle_event_mutex);
1558 cb_info->idle_event_list = g_list_append(cb_info->idle_event_list, (gpointer)cam_idle_event);
1559 g_mutex_unlock(&cb_info->idle_event_mutex);
1561 g_idle_add_full(G_PRIORITY_DEFAULT,
1562 (GSourceFunc)_camera_idle_event_callback,
1563 (gpointer)cam_idle_event,
1567 LOGE("unknown camera event class %d", event_class);
1571 LOGE("unknown camera api[%d] message[%s]", api, cam_msg->recv_msg);
1577 g_mutex_lock(&cb_info->msg_handler_mutex);
1580 /* remove remained event */
1581 while (!g_queue_is_empty(cb_info->msg_queue)) {
1582 cam_msg = (camera_message_s *)g_queue_pop_head(cb_info->msg_queue);
1584 LOGD("remove camera message %p", cam_msg);
1588 LOGW("NULL camera message");
1592 g_mutex_unlock(&cb_info->msg_handler_mutex);
1599 static void _camera_remove_idle_event_all(camera_cb_info_s *cb_info)
1601 camera_idle_event_s *cam_idle_event = NULL;
1602 gboolean ret = TRUE;
1604 gint64 end_time = 0;
1606 if (cb_info == NULL) {
1607 LOGE("cb_info is NULL");
1611 g_mutex_lock(&cb_info->idle_event_mutex);
1613 if (cb_info->idle_event_list == NULL) {
1614 LOGD("No idle event is remained.");
1616 list = cb_info->idle_event_list;
1619 cam_idle_event = list->data;
1620 list = g_list_next(list);
1622 if (!cam_idle_event) {
1623 LOGW("Fail to remove idle event. The event is NULL");
1625 if (g_mutex_trylock(&cam_idle_event->event_mutex)) {
1626 ret = g_idle_remove_by_data(cam_idle_event);
1628 LOGD("remove idle event [%p], ret[%d]", cam_idle_event, ret);
1631 cam_idle_event->cb_info = NULL;
1632 LOGW("idle callback for event %p will be called later", cam_idle_event);
1635 cb_info->idle_event_list = g_list_remove(cb_info->idle_event_list, (gpointer)cam_idle_event);
1637 g_mutex_unlock(&cam_idle_event->event_mutex);
1640 g_mutex_clear(&cam_idle_event->event_mutex);
1642 g_free(cam_idle_event);
1643 cam_idle_event = NULL;
1645 LOGD("remove idle event done");
1648 LOGW("event lock failed. it's being called...");
1650 end_time = g_get_monotonic_time() + G_TIME_SPAN_MILLISECOND * 100;
1652 if (g_cond_wait_until(&cb_info->idle_event_cond, &cb_info->idle_event_mutex, end_time))
1653 LOGW("signal received");
1660 g_list_free(cb_info->idle_event_list);
1661 cb_info->idle_event_list = NULL;
1664 g_mutex_unlock(&cb_info->idle_event_mutex);
1669 static void *_camera_msg_recv_func(gpointer data)
1678 char *recv_msg = NULL;
1679 char **parse_str = NULL;
1680 camera_cb_info_s *cb_info = (camera_cb_info_s *)data;
1682 if (cb_info == NULL) {
1683 LOGE("cb_info NULL");
1689 parse_str = (char **)malloc(sizeof(char *) * CAMERA_PARSE_STRING_SIZE);
1690 if (parse_str == NULL) {
1691 LOGE("parse_str malloc failed");
1695 for (i = 0 ; i < CAMERA_PARSE_STRING_SIZE ; i++) {
1696 parse_str[i] = (char *)malloc(sizeof(char) * MUSE_CAMERA_MSG_MAX_LENGTH);
1697 if (parse_str[i] == NULL) {
1698 LOGE("parse_str[%d] malloc failed", i);
1699 goto CB_HANDLER_EXIT;
1703 recv_msg = cb_info->recv_msg;
1705 while (g_atomic_int_get(&cb_info->msg_recv_running)) {
1706 ret = muse_core_ipc_recv_msg(cb_info->fd, recv_msg);
1709 recv_msg[ret] = '\0';
1715 /*LOGD("recvMSg : %s, length : %d", recv_msg, ret);*/
1717 /* Need to split the combined entering msgs.
1718 This module supports up to 200 combined msgs. */
1719 for (str_pos = 0; str_pos < ret; str_pos++) {
1720 if (recv_msg[str_pos] == '}') {
1721 memset(parse_str[num_token], 0x0, sizeof(char) * MUSE_CAMERA_MSG_MAX_LENGTH);
1722 strncpy(parse_str[num_token], recv_msg + prev_pos, str_pos - prev_pos + 1);
1723 LOGD("splitted msg : [%s], Index : %d", parse_str[num_token], num_token);
1724 prev_pos = str_pos+1;
1729 /*LOGD("num_token : %d", num_token);*/
1731 /* Re-construct to the useful single msg. */
1732 for (i = 0; i < num_token; i++) {
1733 if (i >= CAMERA_PARSE_STRING_SIZE) {
1734 LOGE("invalid token index %d", i);
1741 if (!muse_camera_msg_get(api, parse_str[i])) {
1742 LOGE("failed to get camera api");
1746 if (api != MUSE_CAMERA_CB_EVENT) {
1747 LOGD("check api_class");
1748 if (muse_camera_msg_get(api_class, parse_str[i]))
1749 LOGD("camera api_class[%d]", api_class);
1752 if (api_class == MUSE_CAMERA_API_CLASS_IMMEDIATE) {
1753 g_mutex_lock(&cb_info->api_mutex[api]);
1755 if (!muse_camera_msg_get(ret, parse_str[i])) {
1756 LOGE("failed to get camera ret");
1757 g_mutex_unlock(&cb_info->api_mutex[api]);
1761 cb_info->api_ret[api] = ret;
1762 cb_info->api_activating[api] = 1;
1764 if (api == MUSE_CAMERA_API_CREATE) {
1765 if (ret != CAMERA_ERROR_NONE) {
1766 g_atomic_int_set(&cb_info->msg_recv_running, 0);
1767 LOGE("camera create error 0x%x. close client cb handler", ret);
1769 } else if (api == MUSE_CAMERA_API_DESTROY) {
1770 if (ret == CAMERA_ERROR_NONE) {
1771 g_atomic_int_set(&cb_info->msg_recv_running, 0);
1772 LOGD("camera destroy done. close client cb handler");
1776 g_cond_signal(&cb_info->api_cond[api]);
1777 g_mutex_unlock(&cb_info->api_mutex[api]);
1778 } else if (api_class == MUSE_CAMERA_API_CLASS_THREAD_SUB || api == MUSE_CAMERA_CB_EVENT) {
1779 camera_message_s *cam_msg = g_new0(camera_message_s, 1);
1780 if (cam_msg == NULL) {
1781 LOGE("failed to alloc cam_msg");
1786 memcpy(cam_msg->recv_msg, parse_str[i], sizeof(cam_msg->recv_msg));
1788 LOGD("add camera message to queue : api %d", api);
1790 g_mutex_lock(&cb_info->msg_handler_mutex);
1791 g_queue_push_tail(cb_info->msg_queue, (gpointer)cam_msg);
1792 g_cond_signal(&cb_info->msg_handler_cond);
1793 g_mutex_unlock(&cb_info->msg_handler_mutex);
1795 LOGW("unknown camera api %d and api_class %d", api, api_class);
1801 LOGD("client cb exit");
1805 for (i = 0 ; i < CAMERA_PARSE_STRING_SIZE ; i++) {
1808 parse_str[i] = NULL;
1819 static camera_cb_info_s *_client_callback_new(gint sockfd)
1821 camera_cb_info_s *cb_info = NULL;
1822 gint *tmp_activating = NULL;
1823 gint *tmp_ret = NULL;
1826 g_return_val_if_fail(sockfd > 0, NULL);
1828 cb_info = g_new0(camera_cb_info_s, 1);
1829 if (cb_info == NULL) {
1830 LOGE("cb_info failed");
1834 g_mutex_init(&cb_info->msg_handler_mutex);
1835 g_cond_init(&cb_info->msg_handler_cond);
1836 g_mutex_init(&cb_info->idle_event_mutex);
1837 g_cond_init(&cb_info->idle_event_cond);
1838 g_mutex_init(&cb_info->mp_data_mutex);
1839 g_mutex_init(&cb_info->evas_mutex);
1841 for (i = 0 ; i < MUSE_CAMERA_API_MAX ; i++) {
1842 g_mutex_init(&cb_info->api_mutex[i]);
1843 g_cond_init(&cb_info->api_cond[i]);
1846 tmp_activating = g_new0(gint, MUSE_CAMERA_API_MAX);
1847 if (tmp_activating == NULL) {
1848 LOGE("tmp_activating failed");
1852 tmp_ret = g_new0(gint, MUSE_CAMERA_API_MAX);
1853 if (tmp_ret == NULL) {
1854 LOGE("tmp_ret failed");
1858 cb_info->msg_queue = g_queue_new();
1859 if (cb_info->msg_queue == NULL) {
1860 LOGE("msg_queue new failed");
1864 g_atomic_int_set(&cb_info->msg_handler_running, 1);
1865 cb_info->msg_handler_thread = g_thread_try_new("camera_msg_handler",
1866 _camera_msg_handler_func, (gpointer)cb_info, NULL);
1867 if (cb_info->msg_handler_thread == NULL) {
1868 LOGE("message handler thread creation failed");
1872 cb_info->fd = sockfd;
1873 cb_info->api_activating = tmp_activating;
1874 cb_info->api_ret = tmp_ret;
1875 cb_info->preview_cb_flag = 0;
1876 cb_info->evas_info = NULL;
1878 g_atomic_int_set(&cb_info->msg_recv_running, 1);
1879 cb_info->msg_recv_thread = g_thread_try_new("camera_msg_recv",
1880 _camera_msg_recv_func, (gpointer)cb_info, NULL);
1881 if (cb_info->msg_recv_thread == NULL) {
1882 LOGE("message receive thread creation failed");
1890 if (cb_info->msg_handler_thread) {
1891 g_mutex_lock(&cb_info->msg_handler_mutex);
1892 g_atomic_int_set(&cb_info->msg_handler_running, 0);
1893 g_cond_signal(&cb_info->msg_handler_cond);
1894 g_mutex_unlock(&cb_info->msg_handler_mutex);
1896 g_thread_join(cb_info->msg_handler_thread);
1897 g_thread_unref(cb_info->msg_handler_thread);
1898 cb_info->msg_handler_thread = NULL;
1901 for (i = 0 ; i < MUSE_CAMERA_API_MAX ; i++) {
1902 g_mutex_clear(&cb_info->api_mutex[i]);
1903 g_cond_clear(&cb_info->api_cond[i]);
1906 g_mutex_clear(&cb_info->msg_handler_mutex);
1907 g_cond_clear(&cb_info->msg_handler_cond);
1908 g_mutex_clear(&cb_info->idle_event_mutex);
1909 g_cond_clear(&cb_info->idle_event_cond);
1910 g_mutex_clear(&cb_info->mp_data_mutex);
1911 g_mutex_clear(&cb_info->evas_mutex);
1913 if (cb_info->msg_queue) {
1914 g_queue_free(cb_info->msg_queue);
1915 cb_info->msg_queue = NULL;
1922 if (tmp_activating) {
1923 g_free(tmp_activating);
1924 tmp_activating = NULL;
1934 static void _client_callback_destroy(camera_cb_info_s *cb_info)
1938 g_return_if_fail(cb_info != NULL);
1940 LOGD("MSG receive thread[%p] destroy", cb_info->msg_recv_thread);
1942 g_thread_join(cb_info->msg_recv_thread);
1943 g_thread_unref(cb_info->msg_recv_thread);
1944 cb_info->msg_recv_thread = NULL;
1946 LOGD("msg thread removed");
1948 g_mutex_lock(&cb_info->msg_handler_mutex);
1949 g_atomic_int_set(&cb_info->msg_handler_running, 0);
1950 g_cond_signal(&cb_info->msg_handler_cond);
1951 g_mutex_unlock(&cb_info->msg_handler_mutex);
1953 g_thread_join(cb_info->msg_handler_thread);
1954 g_thread_unref(cb_info->msg_handler_thread);
1955 cb_info->msg_handler_thread = NULL;
1957 g_queue_free(cb_info->msg_queue);
1958 cb_info->msg_queue = NULL;
1960 for (i = 0 ; i < MUSE_CAMERA_API_MAX ; i++) {
1961 g_mutex_clear(&cb_info->api_mutex[i]);
1962 g_cond_clear(&cb_info->api_cond[i]);
1965 g_mutex_clear(&cb_info->msg_handler_mutex);
1966 g_cond_clear(&cb_info->msg_handler_cond);
1967 g_mutex_clear(&cb_info->idle_event_mutex);
1968 g_cond_clear(&cb_info->idle_event_cond);
1969 g_mutex_clear(&cb_info->mp_data_mutex);
1970 g_mutex_clear(&cb_info->evas_mutex);
1972 LOGD("event thread removed");
1974 if (cb_info->fd > -1) {
1975 muse_core_connection_close(cb_info->fd);
1979 if (cb_info->bufmgr) {
1980 tbm_bufmgr_deinit(cb_info->bufmgr);
1981 cb_info->bufmgr = NULL;
1983 if (cb_info->api_activating) {
1984 g_free(cb_info->api_activating);
1985 cb_info->api_activating = NULL;
1987 if (cb_info->api_ret) {
1988 g_free(cb_info->api_ret);
1989 cb_info->api_ret = NULL;
1991 if (cb_info->pkt_fmt) {
1992 media_format_unref(cb_info->pkt_fmt);
1993 cb_info->pkt_fmt = NULL;
1996 if (cb_info->evas_info)
1997 mm_evas_renderer_destroy(&cb_info->evas_info);
1999 cb_info->preview_cb_flag = 0;
2008 int _camera_start_evas_rendering(camera_h camera)
2010 int ret = CAMERA_ERROR_NONE;
2011 camera_cli_s *pc = (camera_cli_s *)camera;
2013 if (camera == NULL) {
2014 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2015 return CAMERA_ERROR_INVALID_PARAMETER;
2018 if (pc->cb_info == NULL) {
2019 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2020 return CAMERA_ERROR_INVALID_PARAMETER;
2025 if (!CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
2026 LOGE("EVAS surface is not set");
2027 return CAMERA_ERROR_NONE;
2030 g_mutex_lock(&pc->cb_info->evas_mutex);
2032 /* set evas render flag as RUN */
2033 pc->cb_info->run_evas_render = true;
2034 ret = CAMERA_ERROR_NONE;
2036 g_mutex_unlock(&pc->cb_info->evas_mutex);
2042 int _camera_stop_evas_rendering(camera_h camera, bool keep_screen)
2044 int ret = CAMERA_ERROR_NONE;
2045 camera_cli_s *pc = (camera_cli_s *)camera;
2047 if (camera == NULL) {
2048 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2049 return CAMERA_ERROR_INVALID_PARAMETER;
2052 if (pc->cb_info == NULL) {
2053 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2054 return CAMERA_ERROR_INVALID_PARAMETER;
2057 LOGD("stop - keep screen %d", keep_screen);
2059 if (!CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
2060 LOGE("EVAS surface is not set");
2061 return CAMERA_ERROR_NONE;
2064 g_mutex_lock(&pc->cb_info->evas_mutex);
2066 /* set evas render flag as STOP and release buffers */
2067 pc->cb_info->run_evas_render = false;
2068 ret = mm_evas_renderer_retrieve_all_packets(pc->cb_info->evas_info, keep_screen);
2069 if (ret != MM_ERROR_NONE) {
2070 LOGE("mm_evas_renderer_retrieve_all_packets failed 0x%x", ret);
2071 ret = CAMERA_ERROR_INVALID_OPERATION;
2074 g_mutex_unlock(&pc->cb_info->evas_mutex);
2080 int camera_create(camera_device_e device, camera_h *camera)
2084 int ret = CAMERA_ERROR_NONE;
2086 camera_cli_s *pc = NULL;
2087 tbm_bufmgr bufmgr = NULL;
2089 muse_camera_api_e api = MUSE_CAMERA_API_CREATE;
2090 muse_core_api_module_e muse_module = MUSE_CAMERA;
2091 int device_type = (int)device;
2093 if (camera == NULL) {
2094 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2095 return CAMERA_ERROR_INVALID_PARAMETER;
2098 bufmgr = tbm_bufmgr_init(-1);
2099 if (bufmgr == NULL) {
2100 LOGE("get tbm bufmgr failed");
2101 return CAMERA_ERROR_INVALID_OPERATION;
2104 sock_fd = muse_core_client_new();
2106 LOGE("muse_core_client_new failed - returned fd %d", sock_fd);
2107 ret = CAMERA_ERROR_INVALID_OPERATION;
2113 sndMsg = muse_core_msg_json_factory_new(api,
2114 MUSE_TYPE_INT, "module", muse_module,
2115 MUSE_TYPE_INT, PARAM_DEVICE_TYPE, device_type,
2116 MUSE_TYPE_INT, "pid", pid,
2119 muse_core_ipc_send_msg(sock_fd, sndMsg);
2120 muse_core_msg_json_factory_free(sndMsg);
2122 pc = g_new0(camera_cli_s, 1);
2124 LOGE("camera_cli_s alloc failed");
2125 ret = CAMERA_ERROR_OUT_OF_MEMORY;
2129 pc->cb_info = _client_callback_new(sock_fd);
2130 if (pc->cb_info == NULL) {
2131 LOGE("cb_info alloc failed");
2132 ret = CAMERA_ERROR_OUT_OF_MEMORY;
2136 LOGD("cb info : %d", pc->cb_info->fd);
2138 ret = _client_wait_for_cb_return(api, pc->cb_info, CALLBACK_TIME_OUT);
2139 if (ret == CAMERA_ERROR_NONE) {
2140 intptr_t handle = 0;
2141 muse_camera_msg_get_pointer(handle, pc->cb_info->recv_msg);
2143 LOGE("Receiving Handle Failed!!");
2144 ret = CAMERA_ERROR_INVALID_OPERATION;
2148 pc->remote_handle = handle;
2149 pc->cb_info->bufmgr = bufmgr;
2151 ret = camera_set_display((camera_h)pc, CAMERA_DISPLAY_TYPE_NONE, NULL);
2152 if (ret != CAMERA_ERROR_NONE) {
2153 LOGE("init display failed 0x%x", ret);
2157 LOGD("camera create 0x%x", pc->remote_handle);
2158 *camera = (camera_h)pc;
2166 tbm_bufmgr_deinit(bufmgr);
2170 _client_callback_destroy(pc->cb_info);
2176 LOGE("camera create error : 0x%x", ret);
2181 int camera_destroy(camera_h camera)
2183 if (camera == NULL) {
2184 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2185 return CAMERA_ERROR_INVALID_PARAMETER;
2188 int ret = CAMERA_ERROR_NONE;
2189 muse_camera_api_e api = MUSE_CAMERA_API_DESTROY;
2190 camera_cli_s *pc = (camera_cli_s *)camera;
2195 if (pc->cb_info == NULL) {
2196 LOGE("cb_info NULL, INVALID_PARAMETER");
2197 return CAMERA_ERROR_INVALID_PARAMETER;
2200 sock_fd = pc->cb_info->fd;
2202 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2203 if (ret == CAMERA_ERROR_NONE) {
2204 _camera_remove_idle_event_all(pc->cb_info);
2205 _client_callback_destroy(pc->cb_info);
2211 LOGE("camera destroy error : 0x%x", ret);
2217 int camera_start_preview(camera_h camera)
2219 int ret = CAMERA_ERROR_NONE;
2220 muse_camera_api_e api = MUSE_CAMERA_API_START_PREVIEW;
2221 camera_cli_s *pc = (camera_cli_s *)camera;
2224 if (camera == NULL) {
2225 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2226 return CAMERA_ERROR_INVALID_PARAMETER;
2229 if (pc->cb_info == NULL) {
2230 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2231 return CAMERA_ERROR_INVALID_PARAMETER;
2236 sock_fd = pc->cb_info->fd;
2238 muse_camera_msg_send_longtime(api, sock_fd, pc->cb_info, ret);
2240 if (ret != CAMERA_ERROR_NONE) {
2241 LOGE("start preview failed 0x%x", ret);
2243 } else if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
2244 ret = _camera_start_evas_rendering(camera);
2247 LOGD("ret : 0x%x", ret);
2249 return CAMERA_ERROR_NONE;
2252 int camera_stop_preview(camera_h camera)
2254 int ret = CAMERA_ERROR_NONE;
2256 camera_cli_s *pc = NULL;
2257 muse_camera_api_e api = MUSE_CAMERA_API_STOP_PREVIEW;
2259 if (camera == NULL) {
2260 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2261 return CAMERA_ERROR_INVALID_PARAMETER;
2264 pc = (camera_cli_s *)camera;
2266 if (pc->cb_info == NULL) {
2267 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2268 return CAMERA_ERROR_INVALID_PARAMETER;
2271 sock_fd = pc->cb_info->fd;
2275 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
2276 camera_state_e current_state = CAMERA_STATE_NONE;
2278 ret = camera_get_state(camera, ¤t_state);
2279 if (ret != CAMERA_ERROR_NONE) {
2280 LOGE("failed to get current state 0x%x", ret);
2284 if (current_state == CAMERA_STATE_PREVIEW) {
2285 ret = _camera_stop_evas_rendering(camera, false);
2286 if (ret != CAMERA_ERROR_NONE)
2291 /* send stop preview message */
2292 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2294 LOGD("ret : 0x%x", ret);
2299 int camera_start_capture(camera_h camera, camera_capturing_cb capturing_cb, camera_capture_completed_cb completed_cb, void *user_data)
2301 if (camera == NULL) {
2302 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2303 return CAMERA_ERROR_INVALID_PARAMETER;
2305 int ret = CAMERA_ERROR_NONE;
2307 camera_cli_s *pc = (camera_cli_s *)camera;
2308 muse_camera_api_e api = MUSE_CAMERA_API_START_CAPTURE;
2310 int is_capturing_cb = 0;
2311 int is_completed_cb = 0;
2312 LOGD("Enter, handle :%x", pc->remote_handle);
2314 if (pc->cb_info == NULL) {
2315 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2316 return CAMERA_ERROR_INVALID_PARAMETER;
2319 sock_fd = pc->cb_info->fd;
2321 if (capturing_cb != NULL) {
2322 is_capturing_cb = 1;
2323 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = capturing_cb;
2324 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = user_data;
2327 if (completed_cb != NULL) {
2328 is_completed_cb = 1;
2329 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = completed_cb;
2330 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = user_data;
2333 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, is_capturing_cb, INT, is_completed_cb);
2334 LOGD("is_capturing_cb :%d, is_completed_cb : %d", is_capturing_cb, is_completed_cb);
2335 LOGD("ret : 0x%x", ret);
2339 bool camera_is_supported_continuous_capture(camera_h camera)
2341 if (camera == NULL) {
2342 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2346 int ret = CAMERA_ERROR_NONE;
2347 camera_cli_s *pc = (camera_cli_s *)camera;
2348 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_CONTINUOUS_CAPTURE;
2351 if (pc->cb_info == NULL) {
2352 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2353 return CAMERA_ERROR_INVALID_PARAMETER;
2356 sock_fd = pc->cb_info->fd;
2358 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2359 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2360 LOGD("ret : 0x%x", ret);
2364 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)
2366 if (camera == NULL) {
2367 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2368 return CAMERA_ERROR_INVALID_PARAMETER;
2371 int ret = CAMERA_ERROR_NONE;
2373 camera_cli_s *pc = (camera_cli_s *)camera;
2374 muse_camera_api_e api = MUSE_CAMERA_API_START_CONTINUOUS_CAPTURE;
2376 LOGD("Enter, handle :%x", pc->remote_handle);
2379 if (pc->cb_info == NULL) {
2380 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2381 return CAMERA_ERROR_INVALID_PARAMETER;
2383 sock_fd = pc->cb_info->fd;
2385 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = capturing_cb;
2386 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = user_data;
2387 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = completed_cb;
2389 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, count, INT, interval);
2391 LOGD("ret : 0x%x", ret);
2396 int camera_stop_continuous_capture(camera_h camera)
2398 if (camera == NULL) {
2399 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2400 return CAMERA_ERROR_INVALID_PARAMETER;
2404 int ret = CAMERA_ERROR_NONE;
2406 camera_cli_s *pc = (camera_cli_s *)camera;
2407 muse_camera_api_e api = MUSE_CAMERA_API_STOP_CONTINUOUS_CAPTURE;
2408 LOGD("Enter, handle :%x", pc->remote_handle);
2410 if (pc->cb_info == NULL) {
2411 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2412 return CAMERA_ERROR_INVALID_PARAMETER;
2414 sock_fd = pc->cb_info->fd;
2415 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2416 LOGD("ret : 0x%x", ret);
2420 bool camera_is_supported_face_detection(camera_h camera)
2422 if (camera == NULL) {
2423 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2426 int ret = CAMERA_ERROR_NONE;
2428 camera_cli_s *pc = (camera_cli_s *)camera;
2429 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_FACE_DETECTION;
2431 if (pc->cb_info == NULL) {
2432 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2433 return CAMERA_ERROR_INVALID_PARAMETER;
2435 sock_fd = pc->cb_info->fd;
2437 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2438 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2439 LOGD("ret : 0x%x", ret);
2443 bool camera_is_supported_zero_shutter_lag(camera_h camera)
2445 if (camera == NULL) {
2446 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2449 int ret = CAMERA_ERROR_NONE;
2451 camera_cli_s *pc = (camera_cli_s *)camera;
2452 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_ZERO_SHUTTER_LAG;
2454 if (pc->cb_info == NULL) {
2455 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2456 return CAMERA_ERROR_INVALID_PARAMETER;
2458 sock_fd = pc->cb_info->fd;
2460 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2461 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2462 LOGD("ret : 0x%x", ret);
2466 bool camera_is_supported_media_packet_preview_cb(camera_h camera)
2468 if (camera == NULL) {
2469 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2473 int ret = CAMERA_ERROR_NONE;
2475 camera_cli_s *pc = (camera_cli_s *)camera;
2476 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_MEDIA_PACKET_PREVIEW_CB;
2478 if (pc->cb_info == NULL) {
2479 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2480 return CAMERA_ERROR_INVALID_PARAMETER;
2482 sock_fd = pc->cb_info->fd;
2484 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2485 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2486 LOGD("ret : 0x%x", ret);
2490 int camera_get_device_count(camera_h camera, int *device_count)
2492 if (camera == NULL || device_count == NULL) {
2493 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2494 return CAMERA_ERROR_INVALID_PARAMETER;
2496 int ret = CAMERA_ERROR_NONE;
2498 camera_cli_s *pc = (camera_cli_s *)camera;
2499 muse_camera_api_e api = MUSE_CAMERA_API_GET_DEVICE_COUNT;
2501 if (pc->cb_info == NULL) {
2502 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2503 return CAMERA_ERROR_INVALID_PARAMETER;
2505 sock_fd = pc->cb_info->fd;
2506 int get_device_count;
2508 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2509 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2511 if (ret == CAMERA_ERROR_NONE) {
2512 muse_camera_msg_get(get_device_count, pc->cb_info->recv_msg);
2513 *device_count = get_device_count;
2515 LOGD("ret : 0x%x", ret);
2519 int camera_start_face_detection(camera_h camera, camera_face_detected_cb callback, void *user_data)
2521 if (camera == NULL) {
2522 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2523 return CAMERA_ERROR_INVALID_PARAMETER;
2526 int ret = CAMERA_ERROR_NONE;
2528 camera_cli_s *pc = (camera_cli_s *)camera;
2529 muse_camera_api_e api = MUSE_CAMERA_API_START_FACE_DETECTION;
2531 LOGD("Enter, handle :%x", pc->remote_handle);
2533 if (pc->cb_info == NULL) {
2534 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2535 return CAMERA_ERROR_INVALID_PARAMETER;
2537 sock_fd = pc->cb_info->fd;
2538 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION] = callback;
2539 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION] = user_data;
2541 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2542 LOGD("ret : 0x%x", ret);
2546 int camera_stop_face_detection(camera_h camera)
2548 if (camera == NULL) {
2549 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2550 return CAMERA_ERROR_INVALID_PARAMETER;
2553 int ret = CAMERA_ERROR_NONE;
2555 camera_cli_s *pc = (camera_cli_s *)camera;
2556 muse_camera_api_e api = MUSE_CAMERA_API_STOP_FACE_DETECTION;
2557 LOGD("Enter, handle :%x", pc->remote_handle);
2559 if (pc->cb_info == NULL) {
2560 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2561 return CAMERA_ERROR_INVALID_PARAMETER;
2563 sock_fd = pc->cb_info->fd;
2564 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2565 LOGD("ret : 0x%x", ret);
2569 int camera_get_state(camera_h camera, camera_state_e *state)
2571 if (camera == NULL || state == NULL) {
2572 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2573 return CAMERA_ERROR_INVALID_PARAMETER;
2575 int ret = CAMERA_ERROR_NONE;
2577 camera_cli_s *pc = (camera_cli_s *)camera;
2578 muse_camera_api_e api = MUSE_CAMERA_API_GET_STATE;
2580 if (pc->cb_info == NULL) {
2581 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2582 return CAMERA_ERROR_INVALID_PARAMETER;
2584 sock_fd = pc->cb_info->fd;
2587 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2588 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2590 if (ret == CAMERA_ERROR_NONE) {
2591 muse_camera_msg_get(get_state, pc->cb_info->recv_msg);
2592 *state = (camera_state_e)get_state;
2594 LOGD("ret : 0x%x", ret);
2598 int camera_start_focusing(camera_h camera, bool continuous)
2600 if (camera == NULL) {
2601 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2602 return CAMERA_ERROR_INVALID_PARAMETER;
2605 int ret = CAMERA_ERROR_NONE;
2607 camera_cli_s *pc = (camera_cli_s *)camera;
2608 muse_camera_api_e api = MUSE_CAMERA_API_START_FOCUSING;
2610 if (pc->cb_info == NULL) {
2611 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2612 return CAMERA_ERROR_INVALID_PARAMETER;
2614 sock_fd = pc->cb_info->fd;
2615 int is_continuous = (int)continuous;
2617 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2618 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, is_continuous);
2619 LOGD("ret : 0x%x", ret);
2623 int camera_cancel_focusing(camera_h camera)
2625 if (camera == NULL) {
2626 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2627 return CAMERA_ERROR_INVALID_PARAMETER;
2630 int ret = CAMERA_ERROR_NONE;
2632 camera_cli_s *pc = (camera_cli_s *)camera;
2633 muse_camera_api_e api = MUSE_CAMERA_API_CANCEL_FOCUSING;
2635 if (pc->cb_info == NULL) {
2636 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2637 return CAMERA_ERROR_INVALID_PARAMETER;
2639 sock_fd = pc->cb_info->fd;
2641 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2642 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2643 LOGD("ret : 0x%x", ret);
2647 int camera_set_display(camera_h camera, camera_display_type_e type, camera_display_h display)
2649 int ret = CAMERA_ERROR_NONE;
2650 void *set_display_handle = NULL;
2651 Evas_Object *obj = NULL;
2652 const char *object_type = NULL;
2654 camera_wl_info_s *wl_info = NULL;
2655 #endif /* HAVE_WAYLAND */
2656 camera_cli_s *pc = (camera_cli_s *)camera;
2657 camera_cb_info_s *cb_info = NULL;
2658 muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY;
2659 camera_state_e current_state = CAMERA_STATE_NONE;
2662 if (camera == NULL) {
2663 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2664 return CAMERA_ERROR_INVALID_PARAMETER;
2667 if (type < CAMERA_DISPLAY_TYPE_OVERLAY || type > CAMERA_DISPLAY_TYPE_NONE) {
2668 LOGE("invalid type %d", type);
2669 return CAMERA_ERROR_INVALID_PARAMETER;
2672 if (type != CAMERA_DISPLAY_TYPE_NONE && display == NULL) {
2673 LOGE("display type[%d] is not NONE, but display handle is NULL", type);
2674 return CAMERA_ERROR_INVALID_PARAMETER;
2677 if (pc->cb_info == NULL) {
2678 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2679 return CAMERA_ERROR_INVALID_PARAMETER;
2682 cb_info = (camera_cb_info_s *)pc->cb_info;
2683 sock_fd = cb_info->fd;
2685 ret = camera_get_state(camera, ¤t_state);
2686 if (ret != CAMERA_ERROR_NONE) {
2687 LOGE("failed to get current state 0x%x", ret);
2691 if (current_state != CAMERA_STATE_CREATED) {
2692 LOGE("INVALID_STATE : current %d", current_state);
2693 return CAMERA_ERROR_INVALID_STATE;
2696 LOGD("Enter, remote_handle : %x display : 0x%x", pc->remote_handle, display);
2698 if (type == CAMERA_DISPLAY_TYPE_NONE) {
2699 set_display_handle = 0;
2700 LOGD("display type NONE");
2702 obj = (Evas_Object *)display;
2703 object_type = evas_object_type_get(obj);
2705 if (type == CAMERA_DISPLAY_TYPE_OVERLAY && !strcmp(object_type, "elm_win")) {
2707 /* get wayland parent id */
2708 if (_get_wl_info(obj, &pc->wl_info) != CAMERA_ERROR_NONE) {
2709 LOGE("failed to get wayland info");
2710 return CAMERA_ERROR_INVALID_OPERATION;
2713 set_display_handle = (void *)&pc->wl_info;
2714 #else /* HAVE_WAYLAND */
2715 /* x window overlay surface */
2716 set_display_handle = (void *)elm_win_xwindow_get(obj);
2717 #endif /* HAVE_WAYLAND */
2718 LOGD("display type OVERLAY : handle %p", set_display_handle);
2719 } else if (type == CAMERA_DISPLAY_TYPE_EVAS && !strcmp(object_type, "image")) {
2720 /* evas object surface */
2721 set_display_handle = (void *)display;
2722 LOGD("display type EVAS : handle %p", set_display_handle);
2724 g_mutex_lock(&cb_info->evas_mutex);
2726 if (cb_info->evas_info) {
2727 LOGW("destroy existed evas renderer %p", cb_info->evas_info);
2728 ret = mm_evas_renderer_destroy(&cb_info->evas_info);
2729 if (ret != MM_ERROR_NONE) {
2730 LOGE("failed to destroy evas renderer %p", cb_info->evas_info);
2731 g_mutex_unlock(&cb_info->evas_mutex);
2732 return CAMERA_ERROR_INVALID_OPERATION;
2736 /* create evas renderer */
2737 ret = mm_evas_renderer_create(&cb_info->evas_info, (Evas_Object *)set_display_handle);
2738 if (ret == MM_ERROR_NONE) {
2739 camera_flip_e flip = CAMERA_FLIP_NONE;
2740 camera_display_mode_e mode = CAMERA_DISPLAY_MODE_LETTER_BOX;
2741 camera_rotation_e rotation = CAMERA_ROTATION_NONE;
2744 camera_get_display_flip(camera, &flip);
2745 camera_get_display_mode(camera, &mode);
2746 camera_get_display_rotation(camera, &rotation);
2747 camera_is_display_visible(camera, &visible);
2749 LOGD("current setting : flip %d, mode %d, rotation %d, visible %d",
2750 flip, mode, rotation, visible);
2752 ret = mm_evas_renderer_set_flip(cb_info->evas_info, flip);
2753 ret |= mm_evas_renderer_set_geometry(cb_info->evas_info, mode);
2754 ret |= mm_evas_renderer_set_rotation(cb_info->evas_info, rotation);
2755 ret |= mm_evas_renderer_set_visible(cb_info->evas_info, visible);
2758 g_mutex_unlock(&cb_info->evas_mutex);
2760 if (ret != MM_ERROR_NONE) {
2761 LOGE("mm_evas_renderer error 0x%x", ret);
2762 return CAMERA_ERROR_INVALID_OPERATION;
2766 LOGE("unknown evas object [%p,%s] or type [%d] mismatch", obj, object_type, type);
2767 return CAMERA_ERROR_INVALID_PARAMETER;
2770 LOGE("failed to get evas object type from %p", obj);
2771 return CAMERA_ERROR_INVALID_PARAMETER;
2775 pc->display_handle = (intptr_t)set_display_handle;
2777 if (type == CAMERA_DISPLAY_TYPE_OVERLAY) {
2779 wl_info = &pc->wl_info;
2780 muse_camera_msg_send_array_and_value(api, sock_fd, cb_info, ret,
2781 wl_info, 5, sizeof(int), INT, type);
2783 LOGD("wayland parent id : %d, window %d,%d,%dx%d",
2784 wl_info->parent_id, wl_info->window_x, wl_info->window_y,
2785 wl_info->window_width, wl_info->window_height);
2786 #else /* HAVE_WAYLAND */
2787 muse_camera_msg_send2(api, sock_fd, cb_info, ret, INT, type, INT, set_display_handle);
2789 LOGD("x id : %d", (int)set_display_handle);
2790 #endif /* HAVE_WAYLAND */
2792 muse_camera_msg_send1(api, sock_fd, cb_info, ret, INT, type);
2794 if (ret != CAMERA_ERROR_NONE)
2795 LOGE("set display error 0x%x", ret);
2796 else if (type == CAMERA_DISPLAY_TYPE_EVAS)
2797 SET_PREVIEW_CB_TYPE(cb_info, PREVIEW_CB_TYPE_EVAS);
2802 int camera_set_preview_resolution(camera_h camera, int width, int height)
2804 if (camera == NULL) {
2805 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2806 return CAMERA_ERROR_INVALID_PARAMETER;
2808 int ret = CAMERA_ERROR_NONE;
2810 camera_cli_s *pc = (camera_cli_s *)camera;
2811 muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_RESOLUTION;
2813 if (pc->cb_info == NULL) {
2814 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2815 return CAMERA_ERROR_INVALID_PARAMETER;
2817 sock_fd = pc->cb_info->fd;
2819 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2820 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, width, INT, height);
2821 LOGD("ret : 0x%x", ret);
2826 int camera_set_capture_resolution(camera_h camera, int width, int height)
2828 if (camera == NULL) {
2829 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2830 return CAMERA_ERROR_INVALID_PARAMETER;
2833 int ret = CAMERA_ERROR_NONE;
2835 camera_cli_s *pc = (camera_cli_s *)camera;
2836 muse_camera_api_e api = MUSE_CAMERA_API_SET_CAPTURE_RESOLUTION;
2838 if (pc->cb_info == NULL) {
2839 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2840 return CAMERA_ERROR_INVALID_PARAMETER;
2842 sock_fd = pc->cb_info->fd;
2844 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2845 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, width, INT, height);
2846 LOGD("ret : 0x%x", ret);
2850 int camera_set_capture_format(camera_h camera, camera_pixel_format_e format)
2852 if (camera == NULL) {
2853 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2854 return CAMERA_ERROR_INVALID_PARAMETER;
2857 int ret = CAMERA_ERROR_NONE;
2858 int set_format = (int)format;
2860 camera_cli_s *pc = (camera_cli_s *)camera;
2861 muse_camera_api_e api = MUSE_CAMERA_API_SET_CAPTURE_FORMAT;
2863 if (pc->cb_info == NULL) {
2864 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2865 return CAMERA_ERROR_INVALID_PARAMETER;
2867 sock_fd = pc->cb_info->fd;
2869 LOGD("Enter, remote_handle : %x, capture_format: %d", pc->remote_handle, set_format);
2870 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_format);
2871 LOGD("ret : 0x%x", ret);
2875 int camera_set_preview_format(camera_h camera, camera_pixel_format_e format)
2877 if (camera == NULL) {
2878 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2879 return CAMERA_ERROR_INVALID_PARAMETER;
2882 int ret = CAMERA_ERROR_NONE;
2883 int set_format = (int)format;
2885 camera_cli_s *pc = (camera_cli_s *)camera;
2886 muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_FORMAT;
2888 if (pc->cb_info == NULL) {
2889 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2890 return CAMERA_ERROR_INVALID_PARAMETER;
2892 sock_fd = pc->cb_info->fd;
2894 LOGD("Enter, remote_handle : %x, capture_format: %d", pc->remote_handle, set_format);
2895 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_format);
2896 LOGD("ret : 0x%x", ret);
2900 int camera_get_preview_resolution(camera_h camera, int *width, int *height)
2902 if (camera == NULL || width == NULL || height == NULL) {
2903 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2904 return CAMERA_ERROR_INVALID_PARAMETER;
2908 int ret = CAMERA_ERROR_NONE;
2910 camera_cli_s *pc = (camera_cli_s *)camera;
2911 muse_camera_api_e api = MUSE_CAMERA_API_GET_PREVIEW_RESOLUTION;
2913 if (pc->cb_info == NULL) {
2914 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2915 return CAMERA_ERROR_INVALID_PARAMETER;
2917 sock_fd = pc->cb_info->fd;
2921 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2922 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2924 if (ret == CAMERA_ERROR_NONE) {
2925 muse_camera_msg_get(get_width, pc->cb_info->recv_msg);
2926 muse_camera_msg_get(get_height, pc->cb_info->recv_msg);
2928 *height = get_height;
2930 LOGD("ret : 0x%x", ret);
2934 int camera_set_display_rotation(camera_h camera, camera_rotation_e rotation)
2936 int ret = CAMERA_ERROR_NONE;
2937 int set_rotation = (int)rotation;
2938 camera_cli_s *pc = NULL;
2940 if (camera == NULL) {
2941 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2942 return CAMERA_ERROR_INVALID_PARAMETER;
2945 if (rotation < CAMERA_ROTATION_NONE || rotation > CAMERA_ROTATION_270) {
2946 LOGE("Invalid rotation %d", rotation);
2947 return CAMERA_ERROR_INVALID_PARAMETER;
2950 pc = (camera_cli_s *)camera;
2952 if (pc->cb_info == NULL) {
2953 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2954 return CAMERA_ERROR_INVALID_PARAMETER;
2957 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
2958 g_mutex_lock(&pc->cb_info->evas_mutex);
2960 ret = mm_evas_renderer_set_rotation(pc->cb_info->evas_info, rotation);
2962 g_mutex_unlock(&pc->cb_info->evas_mutex);
2964 if (ret != MM_ERROR_NONE) {
2965 LOGE("failed to set rotation for evas surface 0x%x", ret);
2966 return CAMERA_ERROR_INVALID_OPERATION;
2970 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_ROTATION,
2971 pc->cb_info->fd, pc->cb_info, ret, INT, set_rotation);
2976 int camera_get_display_rotation(camera_h camera, camera_rotation_e *rotation)
2978 int ret = CAMERA_ERROR_NONE;
2979 int get_rotation = CAMERA_ROTATION_NONE;
2980 camera_cli_s *pc = NULL;
2982 if (camera == NULL || rotation == NULL) {
2983 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2984 return CAMERA_ERROR_INVALID_PARAMETER;
2987 pc = (camera_cli_s *)camera;
2989 if (pc->cb_info == NULL) {
2990 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2991 return CAMERA_ERROR_INVALID_PARAMETER;
2994 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
2995 g_mutex_lock(&pc->cb_info->evas_mutex);
2997 ret = mm_evas_renderer_get_rotation(pc->cb_info->evas_info, (int *)rotation);
2999 g_mutex_unlock(&pc->cb_info->evas_mutex);
3001 if (ret != MM_ERROR_NONE) {
3002 LOGE("failed to get rotation for evas surface 0x%x", ret);
3003 return CAMERA_ERROR_INVALID_OPERATION;
3006 muse_camera_msg_send(MUSE_CAMERA_API_GET_DISPLAY_ROTATION,
3007 pc->cb_info->fd, pc->cb_info, ret);
3009 if (ret == CAMERA_ERROR_NONE) {
3010 muse_camera_msg_get(get_rotation, pc->cb_info->recv_msg);
3011 *rotation = (camera_rotation_e)get_rotation;
3018 int camera_set_display_flip(camera_h camera, camera_flip_e flip)
3020 int ret = CAMERA_ERROR_NONE;
3021 int set_flip = (int)flip;
3022 camera_cli_s *pc = NULL;
3024 if (camera == NULL) {
3025 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3026 return CAMERA_ERROR_INVALID_PARAMETER;
3029 if (flip < CAMERA_FLIP_NONE || flip > CAMERA_FLIP_BOTH) {
3030 LOGE("Invalid flip %d", flip);
3031 return CAMERA_ERROR_INVALID_PARAMETER;
3034 pc = (camera_cli_s *)camera;
3036 if (pc->cb_info == NULL) {
3037 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3038 return CAMERA_ERROR_INVALID_PARAMETER;
3041 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
3042 g_mutex_lock(&pc->cb_info->evas_mutex);
3044 ret = mm_evas_renderer_set_flip(pc->cb_info->evas_info, flip);
3046 g_mutex_unlock(&pc->cb_info->evas_mutex);
3048 if (ret != MM_ERROR_NONE) {
3049 LOGE("failed to set flip for evas surface 0x%x", ret);
3050 return CAMERA_ERROR_INVALID_OPERATION;
3054 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_FLIP,
3055 pc->cb_info->fd, pc->cb_info, ret, INT, set_flip);
3060 int camera_get_display_flip(camera_h camera, camera_flip_e *flip)
3062 int ret = CAMERA_ERROR_NONE;
3063 int get_flip = CAMERA_FLIP_NONE;
3064 camera_cli_s *pc = NULL;
3066 if (camera == NULL || flip == NULL) {
3067 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3068 return CAMERA_ERROR_INVALID_PARAMETER;
3071 pc = (camera_cli_s *)camera;
3073 if (pc->cb_info == NULL) {
3074 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3075 return CAMERA_ERROR_INVALID_PARAMETER;
3078 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
3079 g_mutex_lock(&pc->cb_info->evas_mutex);
3081 ret = mm_evas_renderer_get_flip(pc->cb_info->evas_info, (int *)flip);
3083 g_mutex_unlock(&pc->cb_info->evas_mutex);
3085 if (ret != MM_ERROR_NONE) {
3086 LOGE("failed to get flip for evas surface 0x%x", ret);
3087 return CAMERA_ERROR_INVALID_OPERATION;
3090 muse_camera_msg_send(MUSE_CAMERA_API_GET_DISPLAY_FLIP,
3091 pc->cb_info->fd, pc->cb_info, ret);
3093 if (ret == CAMERA_ERROR_NONE) {
3094 muse_camera_msg_get(get_flip, pc->cb_info->recv_msg);
3095 *flip = (camera_flip_e)get_flip;
3102 int camera_set_display_visible(camera_h camera, bool visible)
3104 int ret = CAMERA_ERROR_NONE;
3105 int set_visible = (int)visible;
3106 camera_cli_s *pc = NULL;
3108 if (camera == NULL) {
3109 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3110 return CAMERA_ERROR_INVALID_PARAMETER;
3113 pc = (camera_cli_s *)camera;
3115 if (pc->cb_info == NULL) {
3116 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3117 return CAMERA_ERROR_INVALID_PARAMETER;
3120 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
3121 g_mutex_lock(&pc->cb_info->evas_mutex);
3123 ret = mm_evas_renderer_set_visible(pc->cb_info->evas_info, visible);
3125 g_mutex_unlock(&pc->cb_info->evas_mutex);
3127 if (ret != MM_ERROR_NONE) {
3128 LOGE("failed to set visible for evas surface 0x%x", ret);
3129 return CAMERA_ERROR_INVALID_OPERATION;
3133 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_VISIBLE,
3134 pc->cb_info->fd, pc->cb_info, ret, INT, set_visible);
3139 int camera_is_display_visible(camera_h camera, bool *visible)
3141 int ret = CAMERA_ERROR_NONE;
3142 int get_visible = true;
3143 camera_cli_s *pc = NULL;
3145 if (camera == NULL || visible == NULL) {
3146 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3147 return CAMERA_ERROR_INVALID_PARAMETER;
3150 pc = (camera_cli_s *)camera;
3152 if (pc->cb_info == NULL) {
3153 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3154 return CAMERA_ERROR_INVALID_PARAMETER;
3157 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
3158 g_mutex_lock(&pc->cb_info->evas_mutex);
3160 ret = mm_evas_renderer_get_visible(pc->cb_info->evas_info, visible);
3162 g_mutex_unlock(&pc->cb_info->evas_mutex);
3164 if (ret != MM_ERROR_NONE) {
3165 LOGE("failed to get visible for evas surface 0x%x", ret);
3166 return CAMERA_ERROR_INVALID_OPERATION;
3169 muse_camera_msg_send(MUSE_CAMERA_API_IS_DISPLAY_VISIBLE,
3170 pc->cb_info->fd, pc->cb_info, ret);
3172 if (ret == CAMERA_ERROR_NONE) {
3173 muse_camera_msg_get(get_visible, pc->cb_info->recv_msg);
3174 *visible = (bool)get_visible;
3181 int camera_set_display_mode(camera_h camera, camera_display_mode_e mode)
3183 int ret = CAMERA_ERROR_NONE;
3184 int set_mode = (int)mode;
3185 camera_cli_s *pc = NULL;
3187 if (camera == NULL) {
3188 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3189 return CAMERA_ERROR_INVALID_PARAMETER;
3192 if (mode < CAMERA_DISPLAY_MODE_LETTER_BOX || mode > CAMERA_DISPLAY_MODE_CUSTOM_ROI) {
3193 LOGE("Invalid mode %d", mode);
3194 return CAMERA_ERROR_INVALID_PARAMETER;
3197 pc = (camera_cli_s *)camera;
3199 if (pc->cb_info == NULL) {
3200 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3201 return CAMERA_ERROR_INVALID_PARAMETER;
3204 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
3205 g_mutex_lock(&pc->cb_info->evas_mutex);
3207 ret = mm_evas_renderer_set_geometry(pc->cb_info->evas_info, mode);
3209 g_mutex_unlock(&pc->cb_info->evas_mutex);
3211 if (ret != MM_ERROR_NONE) {
3212 LOGE("failed to set geometry for evas surface 0x%x", ret);
3213 return CAMERA_ERROR_INVALID_OPERATION;
3217 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_MODE,
3218 pc->cb_info->fd, pc->cb_info, ret, INT, set_mode);
3223 int camera_get_display_mode(camera_h camera, camera_display_mode_e *mode)
3225 int ret = CAMERA_ERROR_NONE;
3226 int get_mode = CAMERA_DISPLAY_MODE_LETTER_BOX;
3227 camera_cli_s *pc = NULL;
3229 if (camera == NULL || mode == NULL) {
3230 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3231 return CAMERA_ERROR_INVALID_PARAMETER;
3234 pc = (camera_cli_s *)camera;
3236 if (pc->cb_info == NULL) {
3237 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3238 return CAMERA_ERROR_INVALID_PARAMETER;
3241 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
3242 g_mutex_lock(&pc->cb_info->evas_mutex);
3244 ret = mm_evas_renderer_get_geometry(pc->cb_info->evas_info, (int *)mode);
3246 g_mutex_unlock(&pc->cb_info->evas_mutex);
3248 if (ret != MM_ERROR_NONE) {
3249 LOGE("failed to get geometry for evas surface 0x%x", ret);
3250 return CAMERA_ERROR_INVALID_OPERATION;
3253 muse_camera_msg_send(MUSE_CAMERA_API_GET_DISPLAY_MODE,
3254 pc->cb_info->fd, pc->cb_info, ret);
3256 if (ret == CAMERA_ERROR_NONE) {
3257 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
3258 *mode = (camera_display_mode_e)get_mode;
3265 int camera_get_capture_resolution(camera_h camera, int *width, int *height)
3267 if (camera == NULL || width == NULL || height == NULL) {
3268 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3269 return CAMERA_ERROR_INVALID_PARAMETER;
3271 int ret = CAMERA_ERROR_NONE;
3273 camera_cli_s *pc = (camera_cli_s *)camera;
3274 muse_camera_api_e api = MUSE_CAMERA_API_GET_CAPTURE_RESOLUTION;
3276 if (pc->cb_info == NULL) {
3277 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3278 return CAMERA_ERROR_INVALID_PARAMETER;
3280 sock_fd = pc->cb_info->fd;
3284 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3285 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3287 if (ret == CAMERA_ERROR_NONE) {
3288 muse_camera_msg_get(get_width, pc->cb_info->recv_msg);
3289 muse_camera_msg_get(get_height, pc->cb_info->recv_msg);
3291 *height = get_height;
3293 LOGD("ret : 0x%x", ret);
3297 int camera_get_capture_format(camera_h camera, camera_pixel_format_e *format)
3299 if (camera == NULL || format == NULL) {
3300 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3301 return CAMERA_ERROR_INVALID_PARAMETER;
3303 int ret = CAMERA_ERROR_NONE;
3305 camera_cli_s *pc = (camera_cli_s *)camera;
3306 muse_camera_api_e api = MUSE_CAMERA_API_GET_CAPTURE_FORMAT;
3309 if (pc->cb_info == NULL) {
3310 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3311 return CAMERA_ERROR_INVALID_PARAMETER;
3313 sock_fd = pc->cb_info->fd;
3315 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3316 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3318 if (ret == CAMERA_ERROR_NONE) {
3319 muse_camera_msg_get(get_format, pc->cb_info->recv_msg);
3320 *format = (camera_pixel_format_e)get_format;
3322 LOGD("ret : 0x%x", ret);
3326 int camera_get_preview_format(camera_h camera, camera_pixel_format_e *format)
3328 if (camera == NULL || format == NULL) {
3329 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3330 return CAMERA_ERROR_INVALID_PARAMETER;
3333 int ret = CAMERA_ERROR_NONE;
3335 camera_cli_s *pc = (camera_cli_s *)camera;
3336 muse_camera_api_e api = MUSE_CAMERA_API_GET_PREVIEW_FORMAT;
3339 if (pc->cb_info == NULL) {
3340 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3341 return CAMERA_ERROR_INVALID_PARAMETER;
3343 sock_fd = pc->cb_info->fd;
3345 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3346 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3348 if (ret == CAMERA_ERROR_NONE) {
3349 muse_camera_msg_get(get_format, pc->cb_info->recv_msg);
3350 *format = (camera_pixel_format_e)get_format;
3352 LOGD("ret : 0x%x", ret);
3356 int camera_get_facing_direction(camera_h camera, camera_facing_direction_e *facing_direciton)
3358 if (camera == NULL || facing_direciton == NULL) {
3359 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3360 return CAMERA_ERROR_INVALID_PARAMETER;
3363 int ret = CAMERA_ERROR_NONE;
3365 camera_cli_s *pc = (camera_cli_s *)camera;
3366 muse_camera_api_e api = MUSE_CAMERA_API_GET_FACING_DIRECTION;
3368 if (pc->cb_info == NULL) {
3369 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3370 return CAMERA_ERROR_INVALID_PARAMETER;
3372 sock_fd = pc->cb_info->fd;
3373 int get_facing_direction;
3375 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3376 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3378 if (ret == CAMERA_ERROR_NONE) {
3379 muse_camera_msg_get(get_facing_direction, pc->cb_info->recv_msg);
3380 *facing_direciton = (camera_facing_direction_e)get_facing_direction;
3382 LOGD("ret : 0x%x", ret);
3386 int camera_set_preview_cb(camera_h camera, camera_preview_cb callback, void *user_data)
3388 if (camera == NULL || callback == NULL) {
3389 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3390 return CAMERA_ERROR_INVALID_PARAMETER;
3392 int ret = CAMERA_ERROR_NONE;
3394 camera_cli_s *pc = (camera_cli_s *)camera;
3395 camera_cb_info_s *cb_info = (camera_cb_info_s *)pc->cb_info;
3397 if (pc->cb_info == NULL) {
3398 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3399 return CAMERA_ERROR_INVALID_PARAMETER;
3401 sock_fd = pc->cb_info->fd;
3402 muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_CB;
3404 LOGD("Enter, handle :%x", pc->remote_handle);
3406 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = callback;
3407 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = user_data;
3408 SET_PREVIEW_CB_TYPE(cb_info, PREVIEW_CB_TYPE_USER);
3410 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3411 LOGD("ret : 0x%x", ret);
3415 int camera_unset_preview_cb(camera_h camera)
3417 if (camera == NULL) {
3418 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3419 return CAMERA_ERROR_INVALID_PARAMETER;
3422 int ret = CAMERA_ERROR_NONE;
3424 camera_cli_s *pc = (camera_cli_s *)camera;
3425 camera_cb_info_s *cb_info = (camera_cb_info_s *)pc->cb_info;
3426 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_PREVIEW_CB;
3428 LOGD("Enter, handle :%x", pc->remote_handle);
3431 if (pc->cb_info == NULL) {
3432 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3433 return CAMERA_ERROR_INVALID_PARAMETER;
3435 sock_fd = pc->cb_info->fd;
3436 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = (void *)NULL;
3437 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = (void *)NULL;
3438 UNSET_PREVIEW_CB_TYPE(cb_info, PREVIEW_CB_TYPE_USER);
3440 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3441 LOGD("ret : 0x%x", ret);
3445 int camera_set_media_packet_preview_cb(camera_h camera, camera_media_packet_preview_cb callback, void *user_data)
3447 if (camera == NULL) {
3448 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
3449 return CAMERA_ERROR_INVALID_PARAMETER;
3452 if (camera_is_supported_media_packet_preview_cb(camera) == false) {
3453 LOGE("NOT SUPPORTED");
3454 return CAMERA_ERROR_NOT_SUPPORTED;
3457 if (callback == NULL) {
3458 LOGE("INVALID_PARAMETER(0x%08x) - callback", CAMERA_ERROR_INVALID_PARAMETER);
3459 return CAMERA_ERROR_INVALID_PARAMETER;
3462 int ret = CAMERA_ERROR_NONE;
3464 camera_cli_s *pc = (camera_cli_s *)camera;
3465 muse_camera_api_e api = MUSE_CAMERA_API_SET_MEDIA_PACKET_PREVIEW_CB;
3467 LOGD("Enter, handle :%x", pc->remote_handle);
3470 if (pc->cb_info == NULL) {
3471 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3472 return CAMERA_ERROR_INVALID_PARAMETER;
3474 sock_fd = pc->cb_info->fd;
3475 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = callback;
3476 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = user_data;
3478 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3479 LOGD("ret : 0x%x", ret);
3483 int camera_unset_media_packet_preview_cb(camera_h camera)
3485 if (camera == NULL) {
3486 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3487 return CAMERA_ERROR_INVALID_PARAMETER;
3490 int ret = CAMERA_ERROR_NONE;
3492 camera_cli_s *pc = (camera_cli_s *)camera;
3493 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_MEDIA_PACKET_PREVIEW_CB;
3495 LOGD("Enter, handle :%x", pc->remote_handle);
3498 if (pc->cb_info == NULL) {
3499 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3500 return CAMERA_ERROR_INVALID_PARAMETER;
3502 sock_fd = pc->cb_info->fd;
3503 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = (void *)NULL;
3504 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = (void *)NULL;
3506 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3507 LOGD("ret : 0x%x", ret);
3511 int camera_set_state_changed_cb(camera_h camera, camera_state_changed_cb callback, void *user_data)
3513 if (camera == NULL || callback == NULL) {
3514 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3515 return CAMERA_ERROR_INVALID_PARAMETER;
3517 int ret = CAMERA_ERROR_NONE;
3519 camera_cli_s *pc = (camera_cli_s *)camera;
3520 muse_camera_api_e api = MUSE_CAMERA_API_SET_STATE_CHANGED_CB;
3522 LOGD("Enter, handle :%x", pc->remote_handle);
3525 if (pc->cb_info == NULL) {
3526 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3527 return CAMERA_ERROR_INVALID_PARAMETER;
3529 sock_fd = pc->cb_info->fd;
3530 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = callback;
3531 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = user_data;
3533 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3534 LOGD("ret : 0x%x", ret);
3537 int camera_unset_state_changed_cb(camera_h camera)
3539 if (camera == NULL) {
3540 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3541 return CAMERA_ERROR_INVALID_PARAMETER;
3543 int ret = CAMERA_ERROR_NONE;
3545 camera_cli_s *pc = (camera_cli_s *)camera;
3546 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_STATE_CHANGED_CB;
3548 LOGD("Enter, handle :%x", pc->remote_handle);
3551 if (pc->cb_info == NULL) {
3552 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3553 return CAMERA_ERROR_INVALID_PARAMETER;
3555 sock_fd = pc->cb_info->fd;
3556 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = (void *)NULL;
3557 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = (void *)NULL;
3559 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3560 LOGD("ret : 0x%x", ret);
3564 int camera_set_interrupted_cb(camera_h camera, camera_interrupted_cb callback, void *user_data)
3566 if (camera == NULL || callback == NULL) {
3567 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3568 return CAMERA_ERROR_INVALID_PARAMETER;
3570 int ret = CAMERA_ERROR_NONE;
3572 camera_cli_s *pc = (camera_cli_s *)camera;
3573 muse_camera_api_e api = MUSE_CAMERA_API_SET_INTERRUPTED_CB;
3575 LOGD("Enter, handle :%x", pc->remote_handle);
3578 if (pc->cb_info == NULL) {
3579 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3580 return CAMERA_ERROR_INVALID_PARAMETER;
3582 sock_fd = pc->cb_info->fd;
3583 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = callback;
3584 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = user_data;
3586 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3587 LOGD("ret : 0x%x", ret);
3591 int camera_unset_interrupted_cb(camera_h camera)
3593 if (camera == NULL) {
3594 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3595 return CAMERA_ERROR_INVALID_PARAMETER;
3597 int ret = CAMERA_ERROR_NONE;
3599 camera_cli_s *pc = (camera_cli_s *)camera;
3600 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_INTERRUPTED_CB;
3602 LOGD("Enter, handle :%x", pc->remote_handle);
3605 if (pc->cb_info == NULL) {
3606 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3607 return CAMERA_ERROR_INVALID_PARAMETER;
3609 sock_fd = pc->cb_info->fd;
3610 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = (void *)NULL;
3611 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = (void *)NULL;
3613 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3614 LOGD("ret : 0x%x", ret);
3618 int camera_set_focus_changed_cb(camera_h camera, camera_focus_changed_cb callback, void *user_data)
3620 if (camera == NULL || callback == NULL) {
3621 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3622 return CAMERA_ERROR_INVALID_PARAMETER;
3624 int ret = CAMERA_ERROR_NONE;
3626 camera_cli_s *pc = (camera_cli_s *)camera;
3627 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOCUS_CHANGED_CB;
3629 LOGD("Enter, handle :%x", pc->remote_handle);
3632 if (pc->cb_info == NULL) {
3633 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3634 return CAMERA_ERROR_INVALID_PARAMETER;
3636 sock_fd = pc->cb_info->fd;
3637 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = callback;
3638 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = user_data;
3640 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3641 LOGD("ret : 0x%x", ret);
3645 int camera_unset_focus_changed_cb(camera_h camera)
3647 if (camera == NULL) {
3648 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3649 return CAMERA_ERROR_INVALID_PARAMETER;
3651 int ret = CAMERA_ERROR_NONE;
3653 camera_cli_s *pc = (camera_cli_s *)camera;
3654 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_FOCUS_CHANGED_CB;
3656 LOGD("Enter, handle :%x", pc->remote_handle);
3659 if (pc->cb_info == NULL) {
3660 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3661 return CAMERA_ERROR_INVALID_PARAMETER;
3663 sock_fd = pc->cb_info->fd;
3664 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = (void *)NULL;
3665 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = (void *)NULL;
3667 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3668 LOGD("ret : 0x%x", ret);
3672 int camera_set_error_cb(camera_h camera, camera_error_cb callback, void *user_data)
3674 if (camera == NULL || callback == NULL) {
3675 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3676 return CAMERA_ERROR_INVALID_PARAMETER;
3678 int ret = CAMERA_ERROR_NONE;
3680 camera_cli_s *pc = (camera_cli_s *)camera;
3681 muse_camera_api_e api = MUSE_CAMERA_API_SET_ERROR_CB;
3683 LOGD("Enter, handle :%x", pc->remote_handle);
3686 if (pc->cb_info == NULL) {
3687 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3688 return CAMERA_ERROR_INVALID_PARAMETER;
3690 sock_fd = pc->cb_info->fd;
3691 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_ERROR] = callback;
3692 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_ERROR] = user_data;
3694 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3695 LOGD("ret : 0x%x", ret);
3699 int camera_unset_error_cb(camera_h camera)
3701 if (camera == NULL) {
3702 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3703 return CAMERA_ERROR_INVALID_PARAMETER;
3705 int ret = CAMERA_ERROR_NONE;
3707 camera_cli_s *pc = (camera_cli_s *)camera;
3708 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_ERROR_CB;
3710 LOGD("Enter, handle :%x", pc->remote_handle);
3713 if (pc->cb_info == NULL) {
3714 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3715 return CAMERA_ERROR_INVALID_PARAMETER;
3717 sock_fd = pc->cb_info->fd;
3718 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_ERROR] = (void *)NULL;
3719 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_ERROR] = (void *)NULL;
3721 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3722 LOGD("ret : 0x%x", ret);
3726 int camera_foreach_supported_preview_resolution(camera_h camera, camera_supported_preview_resolution_cb foreach_cb , void *user_data)
3728 if (camera == NULL || foreach_cb == NULL) {
3729 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3730 return CAMERA_ERROR_INVALID_PARAMETER;
3732 int ret = CAMERA_ERROR_NONE;
3734 camera_cli_s *pc = (camera_cli_s *)camera;
3735 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_PREVIEW_RESOLUTION;
3737 LOGD("Enter, handle :%x", pc->remote_handle);
3740 if (pc->cb_info == NULL) {
3741 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3742 return CAMERA_ERROR_INVALID_PARAMETER;
3744 sock_fd = pc->cb_info->fd;
3745 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_RESOLUTION] = foreach_cb;
3746 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_RESOLUTION] = user_data;
3748 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3749 LOGD("ret : 0x%x", ret);
3753 int camera_foreach_supported_capture_resolution(camera_h camera, camera_supported_capture_resolution_cb foreach_cb , void *user_data)
3755 if (camera == NULL || foreach_cb == NULL) {
3756 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3757 return CAMERA_ERROR_INVALID_PARAMETER;
3759 int ret = CAMERA_ERROR_NONE;
3761 camera_cli_s *pc = (camera_cli_s *)camera;
3762 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_CAPTURE_RESOLUTION;
3764 LOGD("Enter, handle :%x", pc->remote_handle);
3767 if (pc->cb_info == NULL) {
3768 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3769 return CAMERA_ERROR_INVALID_PARAMETER;
3771 sock_fd = pc->cb_info->fd;
3772 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_RESOLUTION] = foreach_cb;
3773 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_RESOLUTION] = user_data;
3775 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3776 LOGD("ret : 0x%x", ret);
3780 int camera_foreach_supported_capture_format(camera_h camera, camera_supported_capture_format_cb foreach_cb , void *user_data)
3782 if (camera == NULL || foreach_cb == NULL) {
3783 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3784 return CAMERA_ERROR_INVALID_PARAMETER;
3786 int ret = CAMERA_ERROR_NONE;
3788 camera_cli_s *pc = (camera_cli_s *)camera;
3789 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_CAPTURE_FORMAT;
3791 LOGD("Enter, handle :%x", pc->remote_handle);
3794 if (pc->cb_info == NULL) {
3795 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3796 return CAMERA_ERROR_INVALID_PARAMETER;
3798 sock_fd = pc->cb_info->fd;
3799 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_FORMAT] = foreach_cb;
3800 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_FORMAT] = user_data;
3802 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3803 LOGD("ret : 0x%x", ret);
3808 int camera_foreach_supported_preview_format(camera_h camera, camera_supported_preview_format_cb foreach_cb , void *user_data)
3810 if (camera == NULL || foreach_cb == NULL) {
3811 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3812 return CAMERA_ERROR_INVALID_PARAMETER;
3814 int ret = CAMERA_ERROR_NONE;
3816 camera_cli_s *pc = (camera_cli_s *)camera;
3817 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_PREVIEW_FORMAT;
3819 LOGD("Enter, handle :%x", pc->remote_handle);
3822 if (pc->cb_info == NULL) {
3823 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3824 return CAMERA_ERROR_INVALID_PARAMETER;
3826 sock_fd = pc->cb_info->fd;
3827 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_FORMAT] = foreach_cb;
3828 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_FORMAT] = user_data;
3830 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3831 LOGD("ret : 0x%x", ret);
3836 int camera_get_recommended_preview_resolution(camera_h camera, int *width, int *height)
3838 if (camera == NULL || width == NULL || height == NULL) {
3839 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3840 return CAMERA_ERROR_INVALID_PARAMETER;
3842 int ret = CAMERA_ERROR_NONE;
3844 camera_cli_s *pc = (camera_cli_s *)camera;
3845 muse_camera_api_e api = MUSE_CAMERA_API_GET_RECOMMENDED_PREVIEW_RESOLUTION;
3847 if (pc->cb_info == NULL) {
3848 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3849 return CAMERA_ERROR_INVALID_PARAMETER;
3851 sock_fd = pc->cb_info->fd;
3855 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3856 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3858 if (ret == CAMERA_ERROR_NONE) {
3859 muse_camera_msg_get(get_width, pc->cb_info->recv_msg);
3860 muse_camera_msg_get(get_height, pc->cb_info->recv_msg);
3862 *height = get_height;
3864 LOGD("ret : 0x%x", ret);
3869 int camera_attr_get_lens_orientation(camera_h camera, int *angle)
3871 if (camera == NULL || angle == NULL) {
3872 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3873 return CAMERA_ERROR_INVALID_PARAMETER;
3875 int ret = CAMERA_ERROR_NONE;
3877 camera_cli_s *pc = (camera_cli_s *)camera;
3878 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_LENS_ORIENTATION;
3880 if (pc->cb_info == NULL) {
3881 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3882 return CAMERA_ERROR_INVALID_PARAMETER;
3884 sock_fd = pc->cb_info->fd;
3887 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3888 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3890 if (ret == CAMERA_ERROR_NONE) {
3891 muse_camera_msg_get(get_angle, pc->cb_info->recv_msg);
3894 LOGD("ret : 0x%x", ret);
3898 int camera_attr_set_theater_mode(camera_h camera, camera_attr_theater_mode_e mode)
3900 if (camera == NULL) {
3901 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3902 return CAMERA_ERROR_INVALID_PARAMETER;
3904 int ret = CAMERA_ERROR_NONE;
3905 camera_cli_s *pc = (camera_cli_s *)camera;
3906 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_THEATER_MODE;
3908 if (pc->cb_info == NULL) {
3909 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3910 return CAMERA_ERROR_INVALID_PARAMETER;
3912 sock_fd = pc->cb_info->fd;
3913 int set_mode = (int)mode;
3914 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3915 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
3916 LOGD("ret : 0x%x", ret);
3920 int camera_attr_get_theater_mode(camera_h camera, camera_attr_theater_mode_e *mode)
3922 if (camera == NULL || mode == NULL) {
3923 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3924 return CAMERA_ERROR_INVALID_PARAMETER;
3927 int ret = CAMERA_ERROR_NONE;
3928 camera_cli_s *pc = (camera_cli_s *)camera;
3929 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_THEATER_MODE;
3931 if (pc->cb_info == NULL) {
3932 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3933 return CAMERA_ERROR_INVALID_PARAMETER;
3935 sock_fd = pc->cb_info->fd;
3937 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3938 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3940 if (ret == CAMERA_ERROR_NONE) {
3941 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
3942 *mode = (camera_attr_theater_mode_e)get_mode;
3944 LOGD("ret : 0x%x", ret);
3948 int camera_attr_foreach_supported_theater_mode(camera_h camera, camera_attr_supported_theater_mode_cb foreach_cb, void *user_data)
3950 if (camera == NULL || foreach_cb == NULL) {
3951 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3952 return CAMERA_ERROR_INVALID_PARAMETER;
3954 int ret = CAMERA_ERROR_NONE;
3956 camera_cli_s *pc = (camera_cli_s *)camera;
3957 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_THEATER_MODE;
3959 LOGD("Enter, handle :%x", pc->remote_handle);
3962 if (pc->cb_info == NULL) {
3963 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3964 return CAMERA_ERROR_INVALID_PARAMETER;
3966 sock_fd = pc->cb_info->fd;
3967 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE] = foreach_cb;
3968 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE] = user_data;
3970 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3972 LOGD("Finish, return :%x", ret);
3977 int camera_attr_set_preview_fps(camera_h camera, camera_attr_fps_e fps)
3979 if (camera == NULL) {
3980 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3981 return CAMERA_ERROR_INVALID_PARAMETER;
3983 int ret = CAMERA_ERROR_NONE;
3984 camera_cli_s *pc = (camera_cli_s *)camera;
3985 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_PREVIEW_FPS;
3987 if (pc->cb_info == NULL) {
3988 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3989 return CAMERA_ERROR_INVALID_PARAMETER;
3991 sock_fd = pc->cb_info->fd;
3992 int set_fps = (int)fps;
3993 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3994 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_fps);
3995 LOGD("ret : 0x%x", ret);
4000 int camera_attr_set_image_quality(camera_h camera, int quality)
4002 if (camera == NULL) {
4003 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4004 return CAMERA_ERROR_INVALID_PARAMETER;
4006 int ret = CAMERA_ERROR_NONE;
4008 camera_cli_s *pc = (camera_cli_s *)camera;
4009 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_IMAGE_QUALITY;
4011 if (pc->cb_info == NULL) {
4012 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4013 return CAMERA_ERROR_INVALID_PARAMETER;
4015 sock_fd = pc->cb_info->fd;
4016 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4017 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, quality);
4018 LOGD("ret : 0x%x", ret);
4022 int camera_attr_get_preview_fps(camera_h camera, camera_attr_fps_e *fps)
4024 if (camera == NULL || fps == NULL) {
4025 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4026 return CAMERA_ERROR_INVALID_PARAMETER;
4028 int ret = CAMERA_ERROR_NONE;
4030 camera_cli_s *pc = (camera_cli_s *)camera;
4031 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_PREVIEW_FPS;
4034 if (pc->cb_info == NULL) {
4035 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4036 return CAMERA_ERROR_INVALID_PARAMETER;
4038 sock_fd = pc->cb_info->fd;
4040 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4041 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4043 if (ret == CAMERA_ERROR_NONE) {
4044 muse_camera_msg_get(get_fps, pc->cb_info->recv_msg);
4045 *fps = (camera_attr_fps_e)get_fps;
4047 LOGD("ret : 0x%x", ret);
4052 int camera_attr_get_image_quality(camera_h camera, int *quality)
4054 if (camera == NULL || quality == NULL) {
4055 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4056 return CAMERA_ERROR_INVALID_PARAMETER;
4058 int ret = CAMERA_ERROR_NONE;
4060 camera_cli_s *pc = (camera_cli_s *)camera;
4061 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_IMAGE_QUALITY;
4063 if (pc->cb_info == NULL) {
4064 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4065 return CAMERA_ERROR_INVALID_PARAMETER;
4067 sock_fd = pc->cb_info->fd;
4069 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4070 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4072 if (ret == CAMERA_ERROR_NONE) {
4073 muse_camera_msg_get(get_quality, pc->cb_info->recv_msg);
4074 *quality = get_quality;
4076 LOGD("ret : 0x%x", ret);
4081 int camera_attr_get_encoded_preview_bitrate(camera_h camera, int *bitrate)
4083 if (camera == NULL || bitrate == NULL) {
4084 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4085 return CAMERA_ERROR_INVALID_PARAMETER;
4088 int ret = CAMERA_ERROR_NONE;
4090 camera_cli_s *pc = (camera_cli_s *)camera;
4091 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ENCODED_PREVIEW_BITRATE;
4093 if (pc->cb_info == NULL) {
4094 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4095 return CAMERA_ERROR_INVALID_PARAMETER;
4097 sock_fd = pc->cb_info->fd;
4100 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4101 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4103 if (ret == CAMERA_ERROR_NONE) {
4104 muse_camera_msg_get(get_bitrate, pc->cb_info->recv_msg);
4105 *bitrate = get_bitrate;
4107 LOGD("ret : 0x%x", ret);
4112 int camera_attr_set_encoded_preview_bitrate(camera_h camera, int bitrate)
4114 if (camera == NULL) {
4115 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4116 return CAMERA_ERROR_INVALID_PARAMETER;
4119 int ret = CAMERA_ERROR_NONE;
4121 camera_cli_s *pc = (camera_cli_s *)camera;
4122 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ENCODED_PREVIEW_BITRATE;
4124 if (pc->cb_info == NULL) {
4125 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4126 return CAMERA_ERROR_INVALID_PARAMETER;
4128 sock_fd = pc->cb_info->fd;
4129 int set_bitrate = bitrate;
4130 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4131 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_bitrate);
4132 LOGD("ret : 0x%x", ret);
4137 int camera_attr_get_encoded_preview_gop_interval(camera_h camera, int *interval)
4139 if (camera == NULL || interval == NULL) {
4140 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4141 return CAMERA_ERROR_INVALID_PARAMETER;
4144 int ret = CAMERA_ERROR_NONE;
4146 camera_cli_s *pc = (camera_cli_s *)camera;
4147 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ENCODED_PREVIEW_GOP_INTERVAL;
4149 if (pc->cb_info == NULL) {
4150 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4151 return CAMERA_ERROR_INVALID_PARAMETER;
4153 sock_fd = pc->cb_info->fd;
4154 int get_gop_interval;
4156 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4157 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4159 if (ret == CAMERA_ERROR_NONE) {
4160 muse_camera_msg_get(get_gop_interval, pc->cb_info->recv_msg);
4161 *interval = get_gop_interval;
4163 LOGD("ret : 0x%x", ret);
4168 int camera_attr_set_encoded_preview_gop_interval(camera_h camera, int interval)
4170 if (camera == NULL) {
4171 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4172 return CAMERA_ERROR_INVALID_PARAMETER;
4175 int ret = CAMERA_ERROR_NONE;
4177 camera_cli_s *pc = (camera_cli_s *)camera;
4178 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ENCODED_PREVIEW_GOP_INTERVAL;
4180 if (pc->cb_info == NULL) {
4181 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4182 return CAMERA_ERROR_INVALID_PARAMETER;
4184 sock_fd = pc->cb_info->fd;
4185 int set_gop_interval = interval;
4186 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4187 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_gop_interval);
4188 LOGD("ret : 0x%x", ret);
4193 int camera_attr_set_zoom(camera_h camera, int zoom)
4195 if (camera == NULL) {
4196 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4197 return CAMERA_ERROR_INVALID_PARAMETER;
4199 int ret = CAMERA_ERROR_NONE;
4201 camera_cli_s *pc = (camera_cli_s *)camera;
4202 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ZOOM;
4204 if (pc->cb_info == NULL) {
4205 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4206 return CAMERA_ERROR_INVALID_PARAMETER;
4208 sock_fd = pc->cb_info->fd;
4210 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4211 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, zoom);
4212 LOGD("ret : 0x%x", ret);
4216 int camera_attr_set_af_mode(camera_h camera, camera_attr_af_mode_e mode)
4218 if (camera == NULL) {
4219 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4220 return CAMERA_ERROR_INVALID_PARAMETER;
4222 int ret = CAMERA_ERROR_NONE;
4224 camera_cli_s *pc = (camera_cli_s *)camera;
4225 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_AF_MODE;
4227 if (pc->cb_info == NULL) {
4228 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4229 return CAMERA_ERROR_INVALID_PARAMETER;
4231 sock_fd = pc->cb_info->fd;
4232 int set_mode = (int)mode;
4233 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4234 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
4235 LOGD("ret : 0x%x", ret);
4239 int camera_attr_set_af_area(camera_h camera, int x, int y)
4241 if (camera == NULL) {
4242 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4243 return CAMERA_ERROR_INVALID_PARAMETER;
4245 int ret = CAMERA_ERROR_NONE;
4246 camera_cli_s *pc = (camera_cli_s *)camera;
4247 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_AF_AREA;
4248 int sock_fd = pc->cb_info->fd;
4249 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4250 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, x, INT, y);
4251 LOGD("ret : 0x%x", ret);
4256 int camera_attr_clear_af_area(camera_h camera)
4258 if (camera == NULL) {
4259 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4260 return CAMERA_ERROR_INVALID_PARAMETER;
4262 int ret = CAMERA_ERROR_NONE;
4264 camera_cli_s *pc = (camera_cli_s *)camera;
4265 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_CLEAR_AF_AREA;
4267 if (pc->cb_info == NULL) {
4268 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4269 return CAMERA_ERROR_INVALID_PARAMETER;
4271 sock_fd = pc->cb_info->fd;
4272 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4273 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4274 LOGD("ret : 0x%x", ret);
4279 int camera_attr_set_exposure_mode(camera_h camera, camera_attr_exposure_mode_e mode)
4281 if (camera == NULL) {
4282 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4283 return CAMERA_ERROR_INVALID_PARAMETER;
4286 if (mode < CAMERA_ATTR_EXPOSURE_MODE_OFF || mode > CAMERA_ATTR_EXPOSURE_MODE_CUSTOM) {
4287 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4288 return CAMERA_ERROR_INVALID_PARAMETER;
4291 int ret = CAMERA_ERROR_NONE;
4292 camera_cli_s *pc = (camera_cli_s *)camera;
4293 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EXPOSURE_MODE;
4294 int set_mode = (int)mode;
4296 if (pc->cb_info == NULL) {
4297 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4298 return CAMERA_ERROR_INVALID_PARAMETER;
4300 sock_fd = pc->cb_info->fd;
4301 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4302 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
4303 LOGD("ret : 0x%x", ret);
4308 int camera_attr_set_exposure(camera_h camera, int value)
4310 if (camera == NULL) {
4311 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4312 return CAMERA_ERROR_INVALID_PARAMETER;
4314 int ret = CAMERA_ERROR_NONE;
4316 camera_cli_s *pc = (camera_cli_s *)camera;
4317 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EXPOSURE;
4319 if (pc->cb_info == NULL) {
4320 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4321 return CAMERA_ERROR_INVALID_PARAMETER;
4323 sock_fd = pc->cb_info->fd;
4325 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4326 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, value);
4327 LOGD("ret : 0x%x", ret);
4332 int camera_attr_set_iso(camera_h camera, camera_attr_iso_e iso)
4334 if (camera == NULL) {
4335 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4336 return CAMERA_ERROR_INVALID_PARAMETER;
4338 int ret = CAMERA_ERROR_NONE;
4340 camera_cli_s *pc = (camera_cli_s *)camera;
4341 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ISO;
4343 if (pc->cb_info == NULL) {
4344 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4345 return CAMERA_ERROR_INVALID_PARAMETER;
4347 sock_fd = pc->cb_info->fd;
4348 int set_iso = (int)iso;
4349 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4350 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_iso);
4351 LOGD("ret : 0x%x", ret);
4356 int camera_attr_set_brightness(camera_h camera, int level)
4358 if (camera == NULL) {
4359 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4360 return CAMERA_ERROR_INVALID_PARAMETER;
4362 int ret = CAMERA_ERROR_NONE;
4364 camera_cli_s *pc = (camera_cli_s *)camera;
4365 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_BRIGHTNESS;
4367 if (pc->cb_info == NULL) {
4368 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4369 return CAMERA_ERROR_INVALID_PARAMETER;
4371 sock_fd = pc->cb_info->fd;
4373 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4374 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, level);
4375 LOGD("ret : 0x%x", ret);
4380 int camera_attr_set_contrast(camera_h camera, int level)
4382 if (camera == NULL) {
4383 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4384 return CAMERA_ERROR_INVALID_PARAMETER;
4386 int ret = CAMERA_ERROR_NONE;
4388 camera_cli_s *pc = (camera_cli_s *)camera;
4389 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_CONTRAST;
4391 if (pc->cb_info == NULL) {
4392 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4393 return CAMERA_ERROR_INVALID_PARAMETER;
4395 sock_fd = pc->cb_info->fd;
4397 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4398 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, level);
4399 LOGD("ret : 0x%x", ret);
4404 int camera_attr_set_whitebalance(camera_h camera, camera_attr_whitebalance_e wb)
4406 if (camera == NULL) {
4407 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4408 return CAMERA_ERROR_INVALID_PARAMETER;
4411 if (wb < CAMERA_ATTR_WHITE_BALANCE_NONE || wb > CAMERA_ATTR_WHITE_BALANCE_CUSTOM) {
4412 LOGE("invalid white balance %d", wb);
4413 return CAMERA_ERROR_INVALID_PARAMETER;
4416 int ret = CAMERA_ERROR_NONE;
4418 camera_cli_s *pc = (camera_cli_s *)camera;
4419 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_WHITEBALANCE;
4421 if (pc->cb_info == NULL) {
4422 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4423 return CAMERA_ERROR_INVALID_PARAMETER;
4425 sock_fd = pc->cb_info->fd;
4426 int set_whitebalance = (int)wb;
4427 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4428 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_whitebalance);
4429 LOGD("ret : 0x%x", ret);
4434 int camera_attr_set_effect(camera_h camera, camera_attr_effect_mode_e effect)
4436 if (camera == NULL) {
4437 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4438 return CAMERA_ERROR_INVALID_PARAMETER;
4440 int ret = CAMERA_ERROR_NONE;
4442 camera_cli_s *pc = (camera_cli_s *)camera;
4443 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EFFECT;
4445 if (pc->cb_info == NULL) {
4446 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4447 return CAMERA_ERROR_INVALID_PARAMETER;
4449 sock_fd = pc->cb_info->fd;
4450 int set_effect = (int)effect;
4451 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4452 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_effect);
4453 LOGD("ret : 0x%x", ret);
4458 int camera_attr_set_scene_mode(camera_h camera, camera_attr_scene_mode_e mode)
4460 if (camera == NULL) {
4461 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4462 return CAMERA_ERROR_INVALID_PARAMETER;
4464 int ret = CAMERA_ERROR_NONE;
4466 camera_cli_s *pc = (camera_cli_s *)camera;
4467 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_SCENE_MODE;
4469 if (pc->cb_info == NULL) {
4470 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4471 return CAMERA_ERROR_INVALID_PARAMETER;
4473 sock_fd = pc->cb_info->fd;
4474 int set_mode = (int)mode;
4475 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4476 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
4477 LOGD("ret : 0x%x", ret);
4482 int camera_attr_enable_tag(camera_h camera, bool enable)
4484 if (camera == NULL) {
4485 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4486 return CAMERA_ERROR_INVALID_PARAMETER;
4488 int ret = CAMERA_ERROR_NONE;
4489 camera_cli_s *pc = (camera_cli_s *)camera;
4490 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_TAG;
4492 if (pc->cb_info == NULL) {
4493 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4494 return CAMERA_ERROR_INVALID_PARAMETER;
4496 sock_fd = pc->cb_info->fd;
4497 int set_enable = (int)enable;
4499 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4500 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
4501 LOGD("ret : 0x%x", ret);
4506 int camera_attr_set_tag_image_description(camera_h camera, const char *description)
4508 if (camera == NULL) {
4509 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4510 return CAMERA_ERROR_INVALID_PARAMETER;
4512 if (description == NULL) {
4513 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4514 return CAMERA_ERROR_INVALID_PARAMETER;
4516 int ret = CAMERA_ERROR_NONE;
4517 camera_cli_s *pc = (camera_cli_s *)camera;
4518 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_IMAGE_DESCRIPTION;
4520 if (pc->cb_info == NULL) {
4521 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4522 return CAMERA_ERROR_INVALID_PARAMETER;
4524 sock_fd = pc->cb_info->fd;
4525 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4526 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, STRING, description);
4527 LOGD("ret : 0x%x", ret);
4532 int camera_attr_set_tag_orientation(camera_h camera, camera_attr_tag_orientation_e orientation)
4534 if (camera == NULL) {
4535 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4536 return CAMERA_ERROR_INVALID_PARAMETER;
4538 int ret = CAMERA_ERROR_NONE;
4539 camera_cli_s *pc = (camera_cli_s *)camera;
4540 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_ORIENTATION;
4542 if (pc->cb_info == NULL) {
4543 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4544 return CAMERA_ERROR_INVALID_PARAMETER;
4546 sock_fd = pc->cb_info->fd;
4547 int set_orientation = (int)orientation;
4549 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4550 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_orientation);
4551 LOGD("ret : 0x%x", ret);
4556 int camera_attr_set_tag_software(camera_h camera, const char *software)
4558 if (camera == NULL) {
4559 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4560 return CAMERA_ERROR_INVALID_PARAMETER;
4562 if (software == NULL) {
4563 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4564 return CAMERA_ERROR_INVALID_PARAMETER;
4566 int ret = CAMERA_ERROR_NONE;
4567 camera_cli_s *pc = (camera_cli_s *)camera;
4568 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_SOFTWARE;
4570 if (pc->cb_info == NULL) {
4571 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4572 return CAMERA_ERROR_INVALID_PARAMETER;
4574 sock_fd = pc->cb_info->fd;
4575 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4576 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, STRING, software);
4577 LOGD("ret : 0x%x", ret);
4582 int camera_attr_set_geotag(camera_h camera, double latitude , double longitude, double altitude)
4584 if (camera == NULL) {
4585 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4586 return CAMERA_ERROR_INVALID_PARAMETER;
4588 int ret = CAMERA_ERROR_NONE;
4589 camera_cli_s *pc = (camera_cli_s *)camera;
4590 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_GEOTAG;
4592 if (pc->cb_info == NULL) {
4593 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4594 return CAMERA_ERROR_INVALID_PARAMETER;
4596 sock_fd = pc->cb_info->fd;
4597 double set_geotag[3] = { latitude, longitude, altitude };
4599 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4600 muse_camera_msg_send_array(api, sock_fd, pc->cb_info, ret,
4601 set_geotag, sizeof(set_geotag), sizeof(double));
4602 LOGD("ret : 0x%x", ret);
4607 int camera_attr_remove_geotag(camera_h camera)
4609 if (camera == NULL) {
4610 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4611 return CAMERA_ERROR_INVALID_PARAMETER;
4613 int ret = CAMERA_ERROR_NONE;
4614 camera_cli_s *pc = (camera_cli_s *)camera;
4615 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_REMOVE_GEOTAG;
4617 if (pc->cb_info == NULL) {
4618 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4619 return CAMERA_ERROR_INVALID_PARAMETER;
4621 sock_fd = pc->cb_info->fd;
4622 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4623 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4624 LOGD("ret : 0x%x", ret);
4629 int camera_attr_set_flash_mode(camera_h camera, camera_attr_flash_mode_e mode)
4631 if (camera == NULL) {
4632 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4633 return CAMERA_ERROR_INVALID_PARAMETER;
4635 int ret = CAMERA_ERROR_NONE;
4636 camera_cli_s *pc = (camera_cli_s *)camera;
4637 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_FLASH_MODE;
4639 if (pc->cb_info == NULL) {
4640 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4641 return CAMERA_ERROR_INVALID_PARAMETER;
4643 sock_fd = pc->cb_info->fd;
4644 int set_mode = (int)mode;
4646 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4647 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
4648 LOGD("ret : 0x%x", ret);
4653 int camera_attr_get_zoom(camera_h camera, int *zoom)
4655 if (camera == NULL || zoom == NULL) {
4656 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4657 return CAMERA_ERROR_INVALID_PARAMETER;
4659 int ret = CAMERA_ERROR_NONE;
4661 camera_cli_s *pc = (camera_cli_s *)camera;
4662 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ZOOM;
4665 if (pc->cb_info == NULL) {
4666 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4667 return CAMERA_ERROR_INVALID_PARAMETER;
4669 sock_fd = pc->cb_info->fd;
4671 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4672 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4674 if (ret == CAMERA_ERROR_NONE) {
4675 muse_camera_msg_get(get_zoom, pc->cb_info->recv_msg);
4678 LOGD("ret : 0x%x", ret);
4683 int camera_attr_get_zoom_range(camera_h camera, int *min, int *max)
4685 if (camera == NULL || min == NULL || max == NULL) {
4686 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4687 return CAMERA_ERROR_INVALID_PARAMETER;
4689 int ret = CAMERA_ERROR_NONE;
4690 camera_cli_s *pc = (camera_cli_s *)camera;
4692 if (pc->cb_info == NULL) {
4693 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4694 return CAMERA_ERROR_INVALID_PARAMETER;
4696 sock_fd = pc->cb_info->fd;
4697 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ZOOM_RANGE;
4701 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4702 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4704 if (ret == CAMERA_ERROR_NONE) {
4705 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
4706 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
4710 LOGD("ret : 0x%x", ret);
4715 int camera_attr_get_af_mode(camera_h camera, camera_attr_af_mode_e *mode)
4717 if (camera == NULL || mode == NULL) {
4718 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4719 return CAMERA_ERROR_INVALID_PARAMETER;
4721 int ret = CAMERA_ERROR_NONE;
4722 camera_cli_s *pc = (camera_cli_s *)camera;
4724 if (pc->cb_info == NULL) {
4725 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4726 return CAMERA_ERROR_INVALID_PARAMETER;
4728 sock_fd = pc->cb_info->fd;
4729 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_AF_MODE;
4732 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4733 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4735 if (ret == CAMERA_ERROR_NONE) {
4736 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
4737 *mode = (camera_attr_af_mode_e)get_mode;
4739 LOGD("ret : 0x%x", ret);
4744 int camera_attr_get_exposure_mode(camera_h camera, camera_attr_exposure_mode_e *mode)
4746 if (camera == NULL || mode == NULL) {
4747 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4748 return CAMERA_ERROR_INVALID_PARAMETER;
4750 int ret = CAMERA_ERROR_NONE;
4751 camera_cli_s *pc = (camera_cli_s *)camera;
4753 if (pc->cb_info == NULL) {
4754 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4755 return CAMERA_ERROR_INVALID_PARAMETER;
4757 sock_fd = pc->cb_info->fd;
4758 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE_MODE;
4761 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4762 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4764 if (ret == CAMERA_ERROR_NONE) {
4765 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
4766 *mode = (camera_attr_exposure_mode_e)get_mode;
4768 LOGD("ret : 0x%x", ret);
4772 int camera_attr_get_exposure(camera_h camera, int *value)
4774 if (camera == NULL || value == NULL) {
4775 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4776 return CAMERA_ERROR_INVALID_PARAMETER;
4778 int ret = CAMERA_ERROR_NONE;
4779 camera_cli_s *pc = (camera_cli_s *)camera;
4781 if (pc->cb_info == NULL) {
4782 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4783 return CAMERA_ERROR_INVALID_PARAMETER;
4785 sock_fd = pc->cb_info->fd;
4786 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE;
4789 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4790 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4792 if (ret == CAMERA_ERROR_NONE) {
4793 muse_camera_msg_get(get_value, pc->cb_info->recv_msg);
4796 LOGD("ret : 0x%x", ret);
4801 int camera_attr_get_exposure_range(camera_h camera, int *min, int *max)
4803 if (camera == NULL || min == NULL || max == NULL) {
4804 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4805 return CAMERA_ERROR_INVALID_PARAMETER;
4807 int ret = CAMERA_ERROR_NONE;
4808 camera_cli_s *pc = (camera_cli_s *)camera;
4810 if (pc->cb_info == NULL) {
4811 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4812 return CAMERA_ERROR_INVALID_PARAMETER;
4814 sock_fd = pc->cb_info->fd;
4815 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE_RANGE;
4819 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4820 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4822 if (ret == CAMERA_ERROR_NONE) {
4823 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
4824 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
4828 LOGD("ret : 0x%x", ret);
4833 int camera_attr_get_iso(camera_h camera, camera_attr_iso_e *iso)
4835 if (camera == NULL || iso == NULL) {
4836 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4837 return CAMERA_ERROR_INVALID_PARAMETER;
4839 int ret = CAMERA_ERROR_NONE;
4840 camera_cli_s *pc = (camera_cli_s *)camera;
4842 if (pc->cb_info == NULL) {
4843 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4844 return CAMERA_ERROR_INVALID_PARAMETER;
4846 sock_fd = pc->cb_info->fd;
4847 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ISO;
4850 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4851 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4853 if (ret == CAMERA_ERROR_NONE) {
4854 muse_camera_msg_get(get_iso, pc->cb_info->recv_msg);
4855 *iso = (camera_attr_iso_e)get_iso;
4857 LOGD("ret : 0x%x", ret);
4862 int camera_attr_get_brightness(camera_h camera, int *level)
4864 if (camera == NULL || level == NULL) {
4865 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4866 return CAMERA_ERROR_INVALID_PARAMETER;
4868 int ret = CAMERA_ERROR_NONE;
4869 camera_cli_s *pc = (camera_cli_s *)camera;
4871 if (pc->cb_info == NULL) {
4872 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4873 return CAMERA_ERROR_INVALID_PARAMETER;
4875 sock_fd = pc->cb_info->fd;
4876 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_BRIGHTNESS;
4879 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4880 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4882 if (ret == CAMERA_ERROR_NONE) {
4883 muse_camera_msg_get(get_level, pc->cb_info->recv_msg);
4886 LOGD("ret : 0x%x", ret);
4891 int camera_attr_get_brightness_range(camera_h camera, int *min, int *max)
4893 if (camera == NULL || min == NULL || max == NULL) {
4894 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4895 return CAMERA_ERROR_INVALID_PARAMETER;
4897 int ret = CAMERA_ERROR_NONE;
4898 camera_cli_s *pc = (camera_cli_s *)camera;
4900 if (pc->cb_info == NULL) {
4901 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4902 return CAMERA_ERROR_INVALID_PARAMETER;
4904 sock_fd = pc->cb_info->fd;
4905 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_BRIGHTNESS_RANGE;
4909 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4910 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4912 if (ret == CAMERA_ERROR_NONE) {
4913 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
4914 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
4918 LOGD("ret : 0x%x", ret);
4923 int camera_attr_get_contrast(camera_h camera, int *level)
4925 if (camera == NULL || level == NULL) {
4926 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4927 return CAMERA_ERROR_INVALID_PARAMETER;
4929 int ret = CAMERA_ERROR_NONE;
4930 camera_cli_s *pc = (camera_cli_s *)camera;
4931 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_CONTRAST;
4933 if (pc->cb_info == NULL) {
4934 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4935 return CAMERA_ERROR_INVALID_PARAMETER;
4937 sock_fd = pc->cb_info->fd;
4940 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4941 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4943 if (ret == CAMERA_ERROR_NONE) {
4944 muse_camera_msg_get(get_level, pc->cb_info->recv_msg);
4947 LOGD("ret : 0x%x", ret);
4952 int camera_attr_get_contrast_range(camera_h camera, int *min , int *max)
4954 if (camera == NULL || min == NULL || max == NULL) {
4955 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4956 return CAMERA_ERROR_INVALID_PARAMETER;
4958 int ret = CAMERA_ERROR_NONE;
4959 camera_cli_s *pc = (camera_cli_s *)camera;
4960 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_CONTRAST_RANGE;
4962 if (pc->cb_info == NULL) {
4963 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4964 return CAMERA_ERROR_INVALID_PARAMETER;
4966 sock_fd = pc->cb_info->fd;
4970 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4971 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4973 if (ret == CAMERA_ERROR_NONE) {
4974 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
4975 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
4979 LOGD("ret : 0x%x", ret);
4984 int camera_attr_get_whitebalance(camera_h camera, camera_attr_whitebalance_e *wb)
4986 if (camera == NULL || wb == NULL) {
4987 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4988 return CAMERA_ERROR_INVALID_PARAMETER;
4990 int ret = CAMERA_ERROR_NONE;
4991 camera_cli_s *pc = (camera_cli_s *)camera;
4992 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_WHITEBALANCE;
4994 if (pc->cb_info == NULL) {
4995 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4996 return CAMERA_ERROR_INVALID_PARAMETER;
4998 sock_fd = pc->cb_info->fd;
5001 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5002 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5004 if (ret == CAMERA_ERROR_NONE) {
5005 muse_camera_msg_get(get_wb, pc->cb_info->recv_msg);
5006 *wb = (camera_attr_whitebalance_e)get_wb;
5008 LOGD("ret : 0x%x", ret);
5013 int camera_attr_get_effect(camera_h camera, camera_attr_effect_mode_e *effect)
5015 if (camera == NULL || effect == NULL) {
5016 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5017 return CAMERA_ERROR_INVALID_PARAMETER;
5020 int ret = CAMERA_ERROR_NONE;
5021 camera_cli_s *pc = (camera_cli_s *)camera;
5022 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EFFECT;
5024 if (pc->cb_info == NULL) {
5025 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5026 return CAMERA_ERROR_INVALID_PARAMETER;
5028 sock_fd = pc->cb_info->fd;
5031 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5032 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5034 if (ret == CAMERA_ERROR_NONE) {
5035 muse_camera_msg_get(get_effect, pc->cb_info->recv_msg);
5036 *effect = (camera_attr_effect_mode_e)get_effect;
5038 LOGD("ret : 0x%x", ret);
5043 int camera_attr_get_scene_mode(camera_h camera, camera_attr_scene_mode_e *mode)
5045 if (camera == NULL || mode == NULL) {
5046 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5047 return CAMERA_ERROR_INVALID_PARAMETER;
5050 int ret = CAMERA_ERROR_NONE;
5051 camera_cli_s *pc = (camera_cli_s *)camera;
5052 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_SCENE_MODE;
5054 if (pc->cb_info == NULL) {
5055 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5056 return CAMERA_ERROR_INVALID_PARAMETER;
5058 sock_fd = pc->cb_info->fd;
5061 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5062 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5064 if (ret == CAMERA_ERROR_NONE) {
5065 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
5066 *mode = (camera_attr_scene_mode_e)get_mode;
5068 LOGD("ret : 0x%x", ret);
5073 int camera_attr_is_enabled_tag(camera_h camera, bool *enable)
5075 if (camera == NULL || enable == NULL) {
5076 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5077 return CAMERA_ERROR_INVALID_PARAMETER;
5080 int ret = CAMERA_ERROR_NONE;
5081 camera_cli_s *pc = (camera_cli_s *)camera;
5082 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_TAG;
5084 if (pc->cb_info == NULL) {
5085 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5086 return CAMERA_ERROR_INVALID_PARAMETER;
5088 sock_fd = pc->cb_info->fd;
5091 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5092 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5094 if (ret == CAMERA_ERROR_NONE) {
5095 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
5096 *enable = (bool)get_enabled;
5098 LOGD("ret : 0x%x", ret);
5103 int camera_attr_get_tag_image_description(camera_h camera, char **description)
5105 if (camera == NULL || description == NULL) {
5106 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5107 return CAMERA_ERROR_INVALID_PARAMETER;
5110 int ret = CAMERA_ERROR_NONE;
5111 camera_cli_s *pc = (camera_cli_s *)camera;
5112 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_IMAGE_DESCRIPTION;
5114 if (pc->cb_info == NULL) {
5115 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5116 return CAMERA_ERROR_INVALID_PARAMETER;
5118 sock_fd = pc->cb_info->fd;
5119 char get_description[MUSE_CAMERA_MSG_MAX_LENGTH] = {0,};
5121 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5122 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5124 if (ret == CAMERA_ERROR_NONE) {
5125 muse_camera_msg_get_string(get_description, pc->cb_info->recv_msg);
5126 *description = strdup(get_description);
5128 LOGD("ret : 0x%x", ret);
5133 int camera_attr_get_tag_orientation(camera_h camera, camera_attr_tag_orientation_e *orientation)
5135 if (camera == NULL || orientation == NULL) {
5136 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5137 return CAMERA_ERROR_INVALID_PARAMETER;
5140 int ret = CAMERA_ERROR_NONE;
5141 camera_cli_s *pc = (camera_cli_s *)camera;
5142 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_ORIENTATION;
5144 if (pc->cb_info == NULL) {
5145 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5146 return CAMERA_ERROR_INVALID_PARAMETER;
5148 sock_fd = pc->cb_info->fd;
5149 int get_orientation;
5151 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5152 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5154 if (ret == CAMERA_ERROR_NONE) {
5155 muse_camera_msg_get(get_orientation, pc->cb_info->recv_msg);
5156 *orientation = (camera_attr_tag_orientation_e)get_orientation;
5157 LOGD("success, orientation : %d", *orientation);
5159 LOGD("ret : 0x%x", ret);
5164 int camera_attr_get_tag_software(camera_h camera, char **software)
5166 if (camera == NULL || software == NULL) {
5167 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5168 return CAMERA_ERROR_INVALID_PARAMETER;
5171 int ret = CAMERA_ERROR_NONE;
5172 camera_cli_s *pc = (camera_cli_s *)camera;
5173 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_SOFTWARE;
5175 if (pc->cb_info == NULL) {
5176 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5177 return CAMERA_ERROR_INVALID_PARAMETER;
5179 sock_fd = pc->cb_info->fd;
5180 char get_software[MUSE_CAMERA_MSG_MAX_LENGTH] = {0,};
5182 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5183 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5185 if (ret == CAMERA_ERROR_NONE) {
5186 muse_camera_msg_get_string(get_software, pc->cb_info->recv_msg);
5187 *software = strdup(get_software);
5189 LOGD("ret : 0x%x", ret);
5194 int camera_attr_get_geotag(camera_h camera, double *latitude , double *longitude, double *altitude)
5196 if (camera == NULL || latitude == NULL || longitude == NULL || altitude == NULL) {
5197 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5198 return CAMERA_ERROR_INVALID_PARAMETER;
5201 int ret = CAMERA_ERROR_NONE;
5202 camera_cli_s *pc = (camera_cli_s *)camera;
5203 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_GEOTAG;
5204 double get_geotag[3] = {0,};
5206 if (pc->cb_info == NULL) {
5207 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5208 return CAMERA_ERROR_INVALID_PARAMETER;
5210 sock_fd = pc->cb_info->fd;
5212 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5214 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5216 if (ret == CAMERA_ERROR_NONE) {
5217 muse_camera_msg_get_array(get_geotag, pc->cb_info->recv_msg);
5218 *latitude = get_geotag[0];
5219 *longitude = get_geotag[1];
5220 *altitude = get_geotag[2];
5222 LOGD("ret : 0x%x", ret);
5224 LOGE("Returned value is not valid : 0x%x", ret);
5231 int camera_attr_get_flash_mode(camera_h camera, camera_attr_flash_mode_e *mode)
5233 if (camera == NULL || mode == NULL) {
5234 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5235 return CAMERA_ERROR_INVALID_PARAMETER;
5238 int ret = CAMERA_ERROR_NONE;
5239 camera_cli_s *pc = (camera_cli_s *)camera;
5240 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_FLASH_MODE;
5242 if (pc->cb_info == NULL) {
5243 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5244 return CAMERA_ERROR_INVALID_PARAMETER;
5246 sock_fd = pc->cb_info->fd;
5249 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5250 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5252 if (ret == CAMERA_ERROR_NONE) {
5253 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
5254 *mode = (camera_attr_flash_mode_e)get_mode;
5256 LOGD("ret : 0x%x", ret);
5261 int camera_get_flash_state(camera_device_e device, camera_flash_state_e *state)
5265 int ret = CAMERA_ERROR_NONE;
5266 camera_cli_s *pc = NULL;
5267 int get_flash_state = 0;
5269 /* create muse connection */
5270 muse_camera_api_e api = MUSE_CAMERA_API_GET_FLASH_STATE;
5271 muse_core_api_module_e muse_module = MUSE_CAMERA;
5272 int device_type = (int)device;
5274 if (state == NULL) {
5275 LOGE("invalid pointer for state");
5276 return CAMERA_ERROR_INVALID_PARAMETER;
5279 sock_fd = muse_core_client_new();
5281 LOGE("muse_core_client_new failed - returned fd %d", sock_fd);
5282 ret = CAMERA_ERROR_INVALID_OPERATION;
5286 sndMsg = muse_core_msg_json_factory_new(api,
5287 MUSE_TYPE_INT, "module", muse_module,
5288 MUSE_TYPE_INT, PARAM_DEVICE_TYPE, device_type,
5291 muse_core_ipc_send_msg(sock_fd, sndMsg);
5292 muse_core_msg_json_factory_free(sndMsg);
5294 pc = g_new0(camera_cli_s, 1);
5296 LOGE("camera_cli_s alloc failed");
5297 ret = CAMERA_ERROR_OUT_OF_MEMORY;
5301 pc->cb_info = _client_callback_new(sock_fd);
5302 if (pc->cb_info == NULL) {
5303 LOGE("cb_info alloc failed");
5304 ret = CAMERA_ERROR_OUT_OF_MEMORY;
5308 ret = _client_wait_for_cb_return(api, pc->cb_info, CALLBACK_TIME_OUT);
5310 if (ret == CAMERA_ERROR_NONE) {
5311 muse_camera_msg_get(get_flash_state, pc->cb_info->recv_msg);
5312 *state = (camera_flash_state_e)get_flash_state;
5315 LOGD("Flash state : %d\n", *state);
5318 /* release resources */
5320 g_atomic_int_set(&pc->cb_info->msg_recv_running, 0);
5321 g_atomic_int_set(&pc->cb_info->msg_handler_running, 0);
5322 _client_callback_destroy(pc->cb_info);
5332 int camera_attr_foreach_supported_af_mode(camera_h camera, camera_attr_supported_af_mode_cb foreach_cb, void *user_data)
5334 if (camera == NULL || foreach_cb == NULL) {
5335 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5336 return CAMERA_ERROR_INVALID_PARAMETER;
5338 int ret = CAMERA_ERROR_NONE;
5340 camera_cli_s *pc = (camera_cli_s *)camera;
5341 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_AF_MODE;
5343 LOGD("Enter, handle :%x", pc->remote_handle);
5346 if (pc->cb_info == NULL) {
5347 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5348 return CAMERA_ERROR_INVALID_PARAMETER;
5350 sock_fd = pc->cb_info->fd;
5351 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_AF_MODE] = foreach_cb;
5352 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_AF_MODE] = user_data;
5354 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5355 LOGD("ret : 0x%x", ret);
5360 int camera_attr_foreach_supported_exposure_mode(camera_h camera, camera_attr_supported_exposure_mode_cb foreach_cb , void *user_data)
5362 if (camera == NULL || foreach_cb == NULL) {
5363 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5364 return CAMERA_ERROR_INVALID_PARAMETER;
5366 int ret = CAMERA_ERROR_NONE;
5368 camera_cli_s *pc = (camera_cli_s *)camera;
5369 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_EXPOSURE_MODE;
5371 LOGD("Enter, handle :%x", pc->remote_handle);
5374 if (pc->cb_info == NULL) {
5375 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5376 return CAMERA_ERROR_INVALID_PARAMETER;
5378 sock_fd = pc->cb_info->fd;
5379 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EXPOSURE_MODE] = foreach_cb;
5380 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EXPOSURE_MODE] = user_data;
5382 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5383 LOGD("ret : 0x%x", ret);
5388 int camera_attr_foreach_supported_iso(camera_h camera, camera_attr_supported_iso_cb foreach_cb, void *user_data)
5390 if (camera == NULL || foreach_cb == NULL) {
5391 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5392 return CAMERA_ERROR_INVALID_PARAMETER;
5394 int ret = CAMERA_ERROR_NONE;
5396 camera_cli_s *pc = (camera_cli_s *)camera;
5397 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_ISO;
5399 LOGD("Enter, handle :%x", pc->remote_handle);
5402 if (pc->cb_info == NULL) {
5403 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5404 return CAMERA_ERROR_INVALID_PARAMETER;
5406 sock_fd = pc->cb_info->fd;
5407 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_ISO] = foreach_cb;
5408 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_ISO] = user_data;
5410 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5411 LOGD("ret : 0x%x", ret);
5416 int camera_attr_foreach_supported_whitebalance(camera_h camera, camera_attr_supported_whitebalance_cb foreach_cb , void *user_data)
5418 if (camera == NULL || foreach_cb == NULL) {
5419 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5420 return CAMERA_ERROR_INVALID_PARAMETER;
5422 int ret = CAMERA_ERROR_NONE;
5424 camera_cli_s *pc = (camera_cli_s *)camera;
5425 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_WHITEBALANCE;
5427 LOGD("Enter, handle :%x", pc->remote_handle);
5430 if (pc->cb_info == NULL) {
5431 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5432 return CAMERA_ERROR_INVALID_PARAMETER;
5434 sock_fd = pc->cb_info->fd;
5435 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_WHITEBALANCE] = foreach_cb;
5436 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_WHITEBALANCE] = user_data;
5438 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5439 LOGD("ret : 0x%x", ret);
5444 int camera_attr_foreach_supported_effect(camera_h camera, camera_attr_supported_effect_cb foreach_cb , void *user_data)
5446 if (camera == NULL || foreach_cb == NULL) {
5447 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5448 return CAMERA_ERROR_INVALID_PARAMETER;
5450 int ret = CAMERA_ERROR_NONE;
5452 camera_cli_s *pc = (camera_cli_s *)camera;
5453 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_EFFECT;
5455 LOGD("Enter, handle :%x", pc->remote_handle);
5458 if (pc->cb_info == NULL) {
5459 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5460 return CAMERA_ERROR_INVALID_PARAMETER;
5462 sock_fd = pc->cb_info->fd;
5463 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EFFECT] = foreach_cb;
5464 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EFFECT] = user_data;
5466 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5467 LOGD("ret : 0x%x", ret);
5472 int camera_attr_foreach_supported_scene_mode(camera_h camera, camera_attr_supported_scene_mode_cb foreach_cb , void *user_data)
5474 if (camera == NULL || foreach_cb == NULL) {
5475 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5476 return CAMERA_ERROR_INVALID_PARAMETER;
5478 int ret = CAMERA_ERROR_NONE;
5480 camera_cli_s *pc = (camera_cli_s *)camera;
5481 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_SCENE_MODE;
5483 LOGD("Enter, handle :%x", pc->remote_handle);
5486 if (pc->cb_info == NULL) {
5487 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5488 return CAMERA_ERROR_INVALID_PARAMETER;
5490 sock_fd = pc->cb_info->fd;
5491 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_SCENE_MODE] = foreach_cb;
5492 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_SCENE_MODE] = user_data;
5494 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5495 LOGD("ret : 0x%x", ret);
5500 int camera_attr_foreach_supported_flash_mode(camera_h camera, camera_attr_supported_flash_mode_cb foreach_cb , void *user_data)
5502 if (camera == NULL || foreach_cb == NULL) {
5503 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5504 return CAMERA_ERROR_INVALID_PARAMETER;
5506 int ret = CAMERA_ERROR_NONE;
5508 camera_cli_s *pc = (camera_cli_s *)camera;
5509 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FLASH_MODE;
5511 LOGD("Enter, handle :%x", pc->remote_handle);
5514 if (pc->cb_info == NULL) {
5515 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5516 return CAMERA_ERROR_INVALID_PARAMETER;
5518 sock_fd = pc->cb_info->fd;
5519 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FLASH_MODE] = foreach_cb;
5520 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FLASH_MODE] = user_data;
5522 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5523 LOGD("ret : 0x%x", ret);
5528 int camera_attr_foreach_supported_fps(camera_h camera, camera_attr_supported_fps_cb foreach_cb , void *user_data)
5530 if (camera == NULL || foreach_cb == NULL) {
5531 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5532 return CAMERA_ERROR_INVALID_PARAMETER;
5534 int ret = CAMERA_ERROR_NONE;
5536 camera_cli_s *pc = (camera_cli_s *)camera;
5537 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FPS;
5539 if (pc->cb_info == NULL) {
5540 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5541 return CAMERA_ERROR_INVALID_PARAMETER;
5543 sock_fd = pc->cb_info->fd;
5544 LOGD("Enter, handle :%x", pc->remote_handle);
5545 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS] = foreach_cb;
5546 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS] = user_data;
5548 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5549 LOGD("Enter, handle :%x", pc->remote_handle);
5553 int camera_attr_foreach_supported_fps_by_resolution(camera_h camera, int width, int height, camera_attr_supported_fps_cb foreach_cb, void *user_data)
5555 if (camera == NULL || foreach_cb == NULL) {
5556 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5557 return CAMERA_ERROR_INVALID_PARAMETER;
5559 int ret = CAMERA_ERROR_NONE;
5561 camera_cli_s *pc = (camera_cli_s *)camera;
5562 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FPS_BY_RESOLUTION;
5564 if (pc->cb_info == NULL) {
5565 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5566 return CAMERA_ERROR_INVALID_PARAMETER;
5568 sock_fd = pc->cb_info->fd;
5569 LOGD("Enter, handle :%x", pc->remote_handle);
5570 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS_BY_RESOLUTION] = foreach_cb;
5571 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS_BY_RESOLUTION] = user_data;
5573 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, width, INT, height);
5574 LOGD("ret : 0x%x", ret);
5578 int camera_attr_foreach_supported_stream_flip(camera_h camera, camera_attr_supported_stream_flip_cb foreach_cb, void *user_data)
5580 if (camera == NULL || foreach_cb == NULL) {
5581 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5582 return CAMERA_ERROR_INVALID_PARAMETER;
5584 int ret = CAMERA_ERROR_NONE;
5586 camera_cli_s *pc = (camera_cli_s *)camera;
5587 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_STREAM_FLIP;
5589 if (pc->cb_info == NULL) {
5590 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5591 return CAMERA_ERROR_INVALID_PARAMETER;
5593 sock_fd = pc->cb_info->fd;
5594 LOGD("Enter, handle :%x", pc->remote_handle);
5595 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_FLIP] = foreach_cb;
5596 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_FLIP] = user_data;
5598 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5599 LOGD("ret : 0x%x", ret);
5604 int camera_attr_foreach_supported_stream_rotation(camera_h camera, camera_attr_supported_stream_rotation_cb foreach_cb, void *user_data)
5606 if (camera == NULL || foreach_cb == NULL) {
5607 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5608 return CAMERA_ERROR_INVALID_PARAMETER;
5610 int ret = CAMERA_ERROR_NONE;
5612 camera_cli_s *pc = (camera_cli_s *)camera;
5613 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_STREAM_ROTATION;
5615 if (pc->cb_info == NULL) {
5616 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5617 return CAMERA_ERROR_INVALID_PARAMETER;
5619 sock_fd = pc->cb_info->fd;
5620 LOGD("Enter, handle :%x", pc->remote_handle);
5621 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION] = foreach_cb;
5622 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION] = user_data;
5624 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5625 LOGD("ret : 0x%x", ret);
5630 int camera_attr_set_stream_rotation(camera_h camera , camera_rotation_e rotation)
5632 if (camera == NULL) {
5633 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5634 return CAMERA_ERROR_INVALID_PARAMETER;
5637 int ret = CAMERA_ERROR_NONE;
5638 camera_cli_s *pc = (camera_cli_s *)camera;
5639 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_STREAM_ROTATION;
5641 if (pc->cb_info == NULL) {
5642 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5643 return CAMERA_ERROR_INVALID_PARAMETER;
5645 sock_fd = pc->cb_info->fd;
5646 int set_rotation = (int)rotation;
5648 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5649 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_rotation);
5650 LOGD("ret : 0x%x", ret);
5655 int camera_attr_get_stream_rotation(camera_h camera , camera_rotation_e *rotation)
5657 if (camera == NULL || rotation == NULL) {
5658 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5659 return CAMERA_ERROR_INVALID_PARAMETER;
5662 int ret = CAMERA_ERROR_NONE;
5663 camera_cli_s *pc = (camera_cli_s *)camera;
5664 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_STREAM_ROTATION;
5666 if (pc->cb_info == NULL) {
5667 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5668 return CAMERA_ERROR_INVALID_PARAMETER;
5670 sock_fd = pc->cb_info->fd;
5673 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5674 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5676 if (ret == CAMERA_ERROR_NONE) {
5677 muse_camera_msg_get(get_rotation, pc->cb_info->recv_msg);
5678 *rotation = (camera_rotation_e)get_rotation;
5680 LOGD("ret : 0x%x", ret);
5685 int camera_attr_set_stream_flip(camera_h camera , camera_flip_e flip)
5687 if (camera == NULL) {
5688 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5689 return CAMERA_ERROR_INVALID_PARAMETER;
5692 int ret = CAMERA_ERROR_NONE;
5693 camera_cli_s *pc = (camera_cli_s *)camera;
5694 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_STREAM_FLIP;
5696 if (pc->cb_info == NULL) {
5697 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5698 return CAMERA_ERROR_INVALID_PARAMETER;
5700 sock_fd = pc->cb_info->fd;
5701 int set_flip = (int)flip;
5703 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5704 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_flip);
5705 LOGD("ret : 0x%x", ret);
5710 int camera_attr_get_stream_flip(camera_h camera , camera_flip_e *flip)
5712 if (camera == NULL || flip == NULL) {
5713 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5714 return CAMERA_ERROR_INVALID_PARAMETER;
5717 int ret = CAMERA_ERROR_NONE;
5718 camera_cli_s *pc = (camera_cli_s *)camera;
5719 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_STREAM_FLIP;
5721 if (pc->cb_info == NULL) {
5722 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5723 return CAMERA_ERROR_INVALID_PARAMETER;
5725 sock_fd = pc->cb_info->fd;
5728 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5729 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5731 if (ret == CAMERA_ERROR_NONE) {
5732 muse_camera_msg_get(get_flip, pc->cb_info->recv_msg);
5733 *flip = (camera_flip_e)get_flip;
5735 LOGD("ret : 0x%x", ret);
5739 int camera_attr_set_hdr_mode(camera_h camera, camera_attr_hdr_mode_e mode)
5741 if (camera == NULL) {
5742 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5743 return CAMERA_ERROR_INVALID_PARAMETER;
5746 int ret = CAMERA_ERROR_NONE;
5747 camera_cli_s *pc = (camera_cli_s *)camera;
5748 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_HDR_MODE;
5750 if (pc->cb_info == NULL) {
5751 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5752 return CAMERA_ERROR_INVALID_PARAMETER;
5754 sock_fd = pc->cb_info->fd;
5755 int set_mode = (int)mode;
5757 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5758 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
5759 LOGD("ret : 0x%x", ret);
5764 int camera_attr_get_hdr_mode(camera_h camera, camera_attr_hdr_mode_e *mode)
5766 if (camera == NULL) {
5767 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5768 return CAMERA_ERROR_INVALID_PARAMETER;
5771 LOGE("INVALID_PARAMETER(0x%08x) - mode", CAMERA_ERROR_INVALID_PARAMETER);
5772 return CAMERA_ERROR_INVALID_PARAMETER;
5774 int ret = CAMERA_ERROR_NONE;
5775 camera_cli_s *pc = (camera_cli_s *)camera;
5776 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_HDR_MODE;
5778 if (pc->cb_info == NULL) {
5779 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5780 return CAMERA_ERROR_INVALID_PARAMETER;
5782 sock_fd = pc->cb_info->fd;
5785 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5786 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5788 if (ret == CAMERA_ERROR_NONE) {
5789 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
5790 *mode = (camera_attr_hdr_mode_e)get_mode;
5792 LOGD("ret : 0x%x", ret);
5797 bool camera_attr_is_supported_hdr_capture(camera_h camera)
5799 if (camera == NULL) {
5800 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5804 int ret = CAMERA_ERROR_NONE;
5805 camera_cli_s *pc = (camera_cli_s *)camera;
5806 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_HDR_CAPTURE;
5808 if (pc->cb_info == NULL) {
5809 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5810 return CAMERA_ERROR_INVALID_PARAMETER;
5812 sock_fd = pc->cb_info->fd;
5813 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5814 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5815 LOGD("ret : 0x%x", ret);
5820 int camera_attr_set_hdr_capture_progress_cb(camera_h camera, camera_attr_hdr_progress_cb callback, void *user_data)
5822 int ret = CAMERA_ERROR_NONE;
5823 camera_cli_s *pc = (camera_cli_s *)camera;
5824 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_HDR_CAPTURE_PROGRESS_CB;
5827 if (camera == NULL) {
5828 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5829 return CAMERA_ERROR_INVALID_PARAMETER;
5832 if (pc->cb_info == NULL) {
5833 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5834 return CAMERA_ERROR_INVALID_PARAMETER;
5837 sock_fd = pc->cb_info->fd;
5839 LOGD("Enter, handle :%x", pc->remote_handle);
5841 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5843 if (ret == CAMERA_ERROR_NONE) {
5844 if (callback == NULL) {
5845 LOGE("INVALID_PARAMETER(0x%08x) - callback", CAMERA_ERROR_INVALID_PARAMETER);
5846 return CAMERA_ERROR_INVALID_PARAMETER;
5849 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = callback;
5850 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = user_data;
5853 LOGD("ret : 0x%x", ret);
5859 int camera_attr_unset_hdr_capture_progress_cb(camera_h camera)
5861 if (camera == NULL) {
5862 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5863 return CAMERA_ERROR_INVALID_PARAMETER;
5866 int ret = CAMERA_ERROR_NONE;
5868 camera_cli_s *pc = (camera_cli_s *)camera;
5869 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_UNSET_HDR_CAPTURE_PROGRESS_CB;
5871 if (pc->cb_info == NULL) {
5872 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5873 return CAMERA_ERROR_INVALID_PARAMETER;
5875 sock_fd = pc->cb_info->fd;
5876 LOGD("Enter, handle :%x", pc->remote_handle);
5878 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = (void *)NULL;
5879 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = (void *)NULL;
5881 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5882 LOGD("ret : 0x%x", ret);
5887 int camera_attr_enable_anti_shake(camera_h camera, bool enable)
5889 if (camera == NULL) {
5890 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5891 return CAMERA_ERROR_INVALID_PARAMETER;
5894 int ret = CAMERA_ERROR_NONE;
5895 camera_cli_s *pc = (camera_cli_s *)camera;
5896 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_ANTI_SHAKE;
5898 if (pc->cb_info == NULL) {
5899 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5900 return CAMERA_ERROR_INVALID_PARAMETER;
5902 sock_fd = pc->cb_info->fd;
5903 int set_enable = (int)enable;
5905 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5906 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
5907 LOGD("ret : 0x%x", ret);
5912 int camera_attr_is_enabled_anti_shake(camera_h camera , bool *enabled)
5914 if (camera == NULL) {
5915 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5916 return CAMERA_ERROR_INVALID_PARAMETER;
5918 if (enabled == NULL) {
5919 LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER);
5920 return CAMERA_ERROR_INVALID_PARAMETER;
5922 int ret = CAMERA_ERROR_NONE;
5923 camera_cli_s *pc = (camera_cli_s *)camera;
5924 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_ANTI_SHAKE;
5926 if (pc->cb_info == NULL) {
5927 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5928 return CAMERA_ERROR_INVALID_PARAMETER;
5930 sock_fd = pc->cb_info->fd;
5933 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5934 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5936 if (ret == CAMERA_ERROR_NONE) {
5937 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
5938 *enabled = (bool)get_enabled;
5940 LOGD("ret : 0x%x", ret);
5945 bool camera_attr_is_supported_anti_shake(camera_h camera)
5948 if (camera == NULL) {
5949 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5953 int ret = CAMERA_ERROR_NONE;
5954 camera_cli_s *pc = (camera_cli_s *)camera;
5955 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_ANTI_SHAKE;
5957 if (pc->cb_info == NULL) {
5958 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5959 return CAMERA_ERROR_INVALID_PARAMETER;
5961 sock_fd = pc->cb_info->fd;
5962 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5963 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5964 LOGD("ret : 0x%x", ret);
5969 int camera_attr_enable_video_stabilization(camera_h camera, bool enable)
5971 if (camera == NULL) {
5972 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5973 return CAMERA_ERROR_INVALID_PARAMETER;
5976 int ret = CAMERA_ERROR_NONE;
5977 camera_cli_s *pc = (camera_cli_s *)camera;
5978 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_VIDEO_STABILIZATION;
5980 if (pc->cb_info == NULL) {
5981 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5982 return CAMERA_ERROR_INVALID_PARAMETER;
5984 sock_fd = pc->cb_info->fd;
5985 int set_enable = (int)enable;
5987 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5988 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
5989 LOGD("ret : 0x%x", ret);
5994 int camera_attr_is_enabled_video_stabilization(camera_h camera, bool *enabled)
5996 if (camera == NULL) {
5997 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5998 return CAMERA_ERROR_INVALID_PARAMETER;
6000 if (enabled == NULL) {
6001 LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER);
6002 return CAMERA_ERROR_INVALID_PARAMETER;
6004 int ret = CAMERA_ERROR_NONE;
6005 camera_cli_s *pc = (camera_cli_s *)camera;
6006 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_VIDEO_STABILIZATION;
6008 if (pc->cb_info == NULL) {
6009 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6010 return CAMERA_ERROR_INVALID_PARAMETER;
6012 sock_fd = pc->cb_info->fd;
6015 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6016 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6018 if (ret == CAMERA_ERROR_NONE) {
6019 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
6020 *enabled = (bool)get_enabled;
6022 LOGD("ret : 0x%x", ret);
6027 bool camera_attr_is_supported_video_stabilization(camera_h camera)
6029 if (camera == NULL) {
6030 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6034 int ret = CAMERA_ERROR_NONE;
6035 camera_cli_s *pc = (camera_cli_s *)camera;
6036 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_VIDEO_STABILIZATION;
6038 if (pc->cb_info == NULL) {
6039 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6040 return CAMERA_ERROR_INVALID_PARAMETER;
6042 sock_fd = pc->cb_info->fd;
6043 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6044 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6045 LOGD("ret : 0x%x", ret);
6050 int camera_attr_enable_auto_contrast(camera_h camera, bool enable)
6052 if (camera == NULL) {
6053 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6054 return CAMERA_ERROR_INVALID_PARAMETER;
6057 int ret = CAMERA_ERROR_NONE;
6058 camera_cli_s *pc = (camera_cli_s *)camera;
6059 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_AUTO_CONTRAST;
6061 if (pc->cb_info == NULL) {
6062 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6063 return CAMERA_ERROR_INVALID_PARAMETER;
6065 sock_fd = pc->cb_info->fd;
6066 int set_enable = (int)enable;
6068 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6069 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
6070 LOGD("ret : 0x%x", ret);
6075 int camera_attr_is_enabled_auto_contrast(camera_h camera, bool *enabled)
6077 if (camera == NULL) {
6078 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
6079 return CAMERA_ERROR_INVALID_PARAMETER;
6081 if (enabled == NULL) {
6082 LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER);
6083 return CAMERA_ERROR_INVALID_PARAMETER;
6085 int ret = CAMERA_ERROR_NONE;
6086 camera_cli_s *pc = (camera_cli_s *)camera;
6087 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_AUTO_CONTRAST;
6089 if (pc->cb_info == NULL) {
6090 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6091 return CAMERA_ERROR_INVALID_PARAMETER;
6093 sock_fd = pc->cb_info->fd;
6096 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6097 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6099 if (ret == CAMERA_ERROR_NONE) {
6100 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
6101 *enabled = (bool)get_enabled;
6103 LOGD("ret : 0x%x", ret);
6108 bool camera_attr_is_supported_auto_contrast(camera_h camera)
6110 if (camera == NULL) {
6111 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6115 int ret = CAMERA_ERROR_NONE;
6116 camera_cli_s *pc = (camera_cli_s *)camera;
6117 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_AUTO_CONTRAST;
6119 if (pc->cb_info == NULL) {
6120 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6121 return CAMERA_ERROR_INVALID_PARAMETER;
6123 sock_fd = pc->cb_info->fd;
6124 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6125 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6126 LOGD("ret : 0x%x", ret);
6131 int camera_attr_disable_shutter_sound(camera_h camera, bool disable)
6133 if (camera == NULL) {
6134 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6135 return CAMERA_ERROR_INVALID_PARAMETER;
6138 int ret = CAMERA_ERROR_NONE;
6139 camera_cli_s *pc = (camera_cli_s *)camera;
6140 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_DISABLE_SHUTTER_SOUND;
6142 if (pc->cb_info == NULL) {
6143 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6144 return CAMERA_ERROR_INVALID_PARAMETER;
6146 sock_fd = pc->cb_info->fd;
6147 int set_disable = (int)disable;
6149 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6150 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_disable);
6151 LOGD("ret : 0x%x", ret);
6156 int camera_attr_set_pan(camera_h camera, camera_attr_ptz_move_type_e move_type, int pan_step)
6158 if (camera == NULL) {
6159 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6160 return CAMERA_ERROR_INVALID_PARAMETER;
6163 camera_cli_s *pc = (camera_cli_s *)camera;
6164 if (pc->cb_info == NULL) {
6165 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6166 return CAMERA_ERROR_INVALID_PARAMETER;
6169 int ret = CAMERA_ERROR_NONE;
6170 int sock_fd = pc->cb_info->fd;
6171 int set_move_type = (int)move_type;
6172 int set_pan_step = pan_step;
6173 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_PAN;
6175 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6176 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, set_move_type, INT, set_pan_step);
6177 LOGD("ret : 0x%x", ret);
6182 int camera_attr_get_pan(camera_h camera, int *pan_step)
6184 if (camera == NULL || pan_step == NULL) {
6185 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6186 return CAMERA_ERROR_INVALID_PARAMETER;
6189 camera_cli_s *pc = (camera_cli_s *)camera;
6190 if (pc->cb_info == NULL) {
6191 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6192 return CAMERA_ERROR_INVALID_PARAMETER;
6195 int ret = CAMERA_ERROR_NONE;
6196 int sock_fd = pc->cb_info->fd;
6198 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_PAN;
6200 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6201 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6203 if (ret == CAMERA_ERROR_NONE) {
6204 muse_camera_msg_get(get_pan_step, pc->cb_info->recv_msg);
6205 *pan_step = get_pan_step;
6207 LOGD("ret : 0x%x", ret);
6212 int camera_attr_get_pan_range(camera_h camera, int *min, int *max)
6214 if (camera == NULL || min == NULL || max == NULL) {
6215 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6216 return CAMERA_ERROR_INVALID_PARAMETER;
6219 camera_cli_s *pc = (camera_cli_s *)camera;
6220 if (pc->cb_info == NULL) {
6221 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6222 return CAMERA_ERROR_INVALID_PARAMETER;
6225 int ret = CAMERA_ERROR_NONE;
6226 int sock_fd = pc->cb_info->fd;
6229 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_PAN_RANGE;
6231 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6232 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6234 if (ret == CAMERA_ERROR_NONE) {
6235 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
6236 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
6240 LOGD("ret : 0x%x", ret);
6245 int camera_attr_set_tilt(camera_h camera, camera_attr_ptz_move_type_e move_type, int tilt_step)
6247 if (camera == NULL) {
6248 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6249 return CAMERA_ERROR_INVALID_PARAMETER;
6252 camera_cli_s *pc = (camera_cli_s *)camera;
6253 if (pc->cb_info == NULL) {
6254 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6255 return CAMERA_ERROR_INVALID_PARAMETER;
6258 int ret = CAMERA_ERROR_NONE;
6259 int sock_fd = pc->cb_info->fd;
6260 int set_move_type = (int)move_type;
6261 int set_tilt_step = tilt_step;
6262 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TILT;
6264 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6265 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, set_move_type, INT, set_tilt_step);
6266 LOGD("ret : 0x%x", ret);
6271 int camera_attr_get_tilt(camera_h camera, int *tilt_step)
6273 if (camera == NULL || tilt_step == NULL) {
6274 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6275 return CAMERA_ERROR_INVALID_PARAMETER;
6278 camera_cli_s *pc = (camera_cli_s *)camera;
6279 if (pc->cb_info == NULL) {
6280 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6281 return CAMERA_ERROR_INVALID_PARAMETER;
6284 int ret = CAMERA_ERROR_NONE;
6285 int sock_fd = pc->cb_info->fd;
6287 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TILT;
6289 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6290 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6292 if (ret == CAMERA_ERROR_NONE) {
6293 muse_camera_msg_get(get_tilt_step, pc->cb_info->recv_msg);
6294 *tilt_step = get_tilt_step;
6296 LOGD("ret : 0x%x", ret);
6301 int camera_attr_get_tilt_range(camera_h camera, int *min, int *max)
6303 if (camera == NULL || min == NULL || max == NULL) {
6304 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6305 return CAMERA_ERROR_INVALID_PARAMETER;
6308 camera_cli_s *pc = (camera_cli_s *)camera;
6309 if (pc->cb_info == NULL) {
6310 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6311 return CAMERA_ERROR_INVALID_PARAMETER;
6314 int ret = CAMERA_ERROR_NONE;
6315 int sock_fd = pc->cb_info->fd;
6318 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TILT_RANGE;
6320 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6321 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6323 if (ret == CAMERA_ERROR_NONE) {
6324 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
6325 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
6329 LOGD("ret : 0x%x", ret);
6334 int camera_attr_set_ptz_type(camera_h camera, camera_attr_ptz_type_e ptz_type)
6336 if (camera == NULL) {
6337 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6338 return CAMERA_ERROR_INVALID_PARAMETER;
6341 camera_cli_s *pc = (camera_cli_s *)camera;
6342 if (pc->cb_info == NULL) {
6343 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6344 return CAMERA_ERROR_INVALID_PARAMETER;
6347 int ret = CAMERA_ERROR_NONE;
6348 int sock_fd = pc->cb_info->fd;
6349 int set_ptz_type = (int)ptz_type;
6350 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_PTZ_TYPE;
6352 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6353 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_ptz_type);
6354 LOGD("ret : 0x%x", ret);
6359 int camera_attr_foreach_supported_ptz_type(camera_h camera, camera_attr_supported_ptz_type_cb foreach_cb, void *user_data)
6361 if (camera == NULL || foreach_cb == NULL) {
6362 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6363 return CAMERA_ERROR_INVALID_PARAMETER;
6365 int ret = CAMERA_ERROR_NONE;
6367 camera_cli_s *pc = (camera_cli_s *)camera;
6368 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_PTZ_TYPE;
6370 if (pc->cb_info == NULL) {
6371 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6372 return CAMERA_ERROR_INVALID_PARAMETER;
6374 sock_fd = pc->cb_info->fd;
6375 LOGD("Enter, handle :%x", pc->remote_handle);
6376 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PTZ_TYPE] = foreach_cb;
6377 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PTZ_TYPE] = user_data;
6379 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6380 LOGD("ret : 0x%x", ret);
6385 int camera_attr_set_display_roi_area(camera_h camera, int x, int y, int width, int height)
6387 if (camera == NULL) {
6388 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6389 return CAMERA_ERROR_INVALID_PARAMETER;
6392 camera_cli_s *pc = (camera_cli_s *)camera;
6393 if (pc->cb_info == NULL) {
6394 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6395 return CAMERA_ERROR_INVALID_PARAMETER;
6398 int ret = CAMERA_ERROR_NONE;
6399 int sock_fd = pc->cb_info->fd;
6400 int set_display_roi_area[4] = {x, y, width, height};
6401 muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY_ROI_AREA;
6403 if(CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
6404 g_mutex_lock(&pc->cb_info->evas_mutex);
6406 ret = mm_evas_renderer_set_roi_area(pc->cb_info->evas_info, x, y, width, height);
6408 g_mutex_unlock(&pc->cb_info->evas_mutex);
6410 if (ret != MM_ERROR_NONE) {
6411 LOGE("mm_evas_renderer_set_roi_area error 0x%x", ret);
6412 return CAMERA_ERROR_INVALID_OPERATION;
6415 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6416 muse_camera_msg_send_array(api, sock_fd, pc->cb_info, ret,
6417 set_display_roi_area, sizeof(set_display_roi_area), sizeof(int));
6418 LOGD("ret : 0x%x", ret);
6425 int camera_attr_get_display_roi_area(camera_h camera, int *x, int *y, int *width, int *height)
6427 if (camera == NULL || x == NULL || y == NULL || width == NULL || height == NULL) {
6428 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6429 return CAMERA_ERROR_INVALID_PARAMETER;
6432 camera_cli_s *pc = (camera_cli_s *)camera;
6433 if (pc->cb_info == NULL) {
6434 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6435 return CAMERA_ERROR_INVALID_PARAMETER;
6438 int ret = CAMERA_ERROR_NONE;
6439 int sock_fd = pc->cb_info->fd;
6440 int get_display_roi_area[4] = {0,};
6441 muse_camera_api_e api = MUSE_CAMERA_API_GET_DISPLAY_ROI_AREA;
6443 if(CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
6444 g_mutex_lock(&pc->cb_info->evas_mutex);
6446 ret = mm_evas_renderer_get_roi_area(pc->cb_info->evas_info, x, y, width, height);
6448 g_mutex_unlock(&pc->cb_info->evas_mutex);
6450 if (ret != MM_ERROR_NONE) {
6451 LOGE("mm_evas_renderer_get_roi_area error 0x%x", ret);
6452 return CAMERA_ERROR_INVALID_OPERATION;
6455 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6456 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6458 if (ret == CAMERA_ERROR_NONE) {
6459 muse_camera_msg_get_array(get_display_roi_area, pc->cb_info->recv_msg);
6460 *x = get_display_roi_area[0];
6461 *y = get_display_roi_area[1];
6462 *width = get_display_roi_area[2];
6463 *height = get_display_roi_area[3];
6465 LOGD("ret : 0x%x", ret);
6467 LOGE("Returned value is not valid : 0x%x", ret);