2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
24 #include <muse_camera.h>
25 #include <muse_camera_msg.h>
26 #include <muse_core_ipc.h>
27 #include <muse_core_module.h>
28 #include <camera_private.h>
29 #include <muse_core.h>
31 #include <Elementary.h>
32 #include <tbm_surface_internal.h>
34 #include <Ecore_Wayland.h>
35 #include <wayland-client.h>
36 #include <tizen-extension-client-protocol.h>
37 #ifdef TIZEN_FEATURE_EVAS_RENDERER
38 #include <mm_evas_renderer.h>
39 #endif /* TIZEN_FEATURE_EVAS_RENDERER */
44 #define LOG_TAG "TIZEN_N_CAMERA"
47 static void __global(void *data, struct wl_registry *registry,
48 uint32_t name, const char *interface, uint32_t version)
50 struct tizen_surface **tz_surface = NULL;
57 tz_surface = (struct tizen_surface **)data;
60 LOGW("NULL interface");
64 /*LOGI("interface %s", interface);*/
66 if (strcmp(interface, "tizen_surface") == 0) {
67 LOGD("binding tizen surface for wayland");
69 *tz_surface = wl_registry_bind(registry, name, &tizen_surface_interface, version);
70 if (*tz_surface == NULL)
71 LOGE("failed to bind");
79 static void __global_remove(void *data, struct wl_registry *wl_registry, uint32_t name)
85 static const struct wl_registry_listener _camera_wl_registry_listener = {
90 void __parent_id_getter(void *data, struct tizen_resource *tizen_resource, uint32_t id)
97 *((unsigned int *)data) = id;
99 LOGD("[CLIENT] got parent_id [%u] from server", id);
104 static const struct tizen_resource_listener _camera_tz_resource_listener = {
108 int _get_wl_info(Evas_Object *obj, camera_wl_info_s *wl_info)
110 int ret = CAMERA_ERROR_NONE;
111 Ecore_Wl_Window *window = NULL;
112 struct wl_display *display = NULL;
113 struct wl_surface *surface = NULL;
114 struct wl_registry *registry = NULL;
115 struct tizen_surface *tz_surface = NULL;
116 struct tizen_resource *tz_resource = NULL;
118 if (!obj || !wl_info) {
119 LOGE("NULL parameter %p %p", obj, wl_info);
120 return CAMERA_ERROR_INVALID_OPERATION;
123 window = elm_win_wl_window_get(obj);
125 LOGE("failed to get wayland window");
126 ret = CAMERA_ERROR_INVALID_OPERATION;
130 surface = (struct wl_surface *)ecore_wl_window_surface_get(window);
132 LOGE("failed to get wayland surface");
133 ret = CAMERA_ERROR_INVALID_OPERATION;
137 display = (struct wl_display *)ecore_wl_display_get();
139 LOGE("failed to get wayland display");
140 ret = CAMERA_ERROR_INVALID_OPERATION;
144 registry = wl_display_get_registry(display);
146 LOGE("failed to get wayland registry");
147 ret = CAMERA_ERROR_INVALID_OPERATION;
151 wl_registry_add_listener(registry, &_camera_wl_registry_listener, &tz_surface);
153 wl_display_dispatch(display);
154 wl_display_roundtrip(display);
157 LOGE("failed to get tizen surface");
158 ret = CAMERA_ERROR_INVALID_OPERATION;
162 /* Get parent_id which is unique in a entire systemw. */
163 tz_resource = tizen_surface_get_tizen_resource(tz_surface, surface);
165 LOGE("failed to get tizen resurce");
166 ret = CAMERA_ERROR_INVALID_OPERATION;
170 wl_info->parent_id = 0;
172 tizen_resource_add_listener(tz_resource, &_camera_tz_resource_listener, &wl_info->parent_id);
174 wl_display_roundtrip(display);
176 if (wl_info->parent_id > 0) {
178 Ecore_Evas *ecore_evas = NULL;
179 ret = CAMERA_ERROR_NONE;
181 wl_info->evas_obj = obj;
183 evas_object_geometry_get(obj, &wl_info->window_x, &wl_info->window_y,
184 &wl_info->window_width, &wl_info->window_height);
186 ecore_evas = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
188 rotation = ecore_evas_rotation_get(ecore_evas);
189 if (rotation == 90 || rotation == 270) {
190 int temp = wl_info->window_width;
192 LOGD("swap width and height %d, %d", wl_info->window_width, wl_info->window_height);
194 wl_info->window_width = wl_info->window_height;
195 wl_info->window_height = temp;
198 LOGW("failed to get ecore_evas.. skip rotation check");
201 LOGD("evas object : %p, rotation : %d, parent id : %u, window : %d,%d,%dx%d",
202 wl_info->evas_obj, rotation, wl_info->parent_id,
203 wl_info->window_x, wl_info->window_y,
204 wl_info->window_width, wl_info->window_height);
206 ret = CAMERA_ERROR_INVALID_OPERATION;
207 LOGE("failed to get parent id");
212 tizen_surface_destroy(tz_surface);
217 tizen_resource_destroy(tz_resource);
222 wl_registry_destroy(registry);
229 static int _import_tbm_key(tbm_bufmgr bufmgr, unsigned int tbm_key, tbm_bo *bo, tbm_bo_handle *bo_handle)
231 tbm_bo tmp_bo = NULL;
232 tbm_bo_handle tmp_bo_handle = {NULL, };
234 if (bufmgr == NULL || bo == NULL || bo_handle == NULL || tbm_key == 0) {
235 LOGE("invalid parameter - bufmgr %p, bo %p, bo_handle %p, key %d",
236 bufmgr, bo, bo_handle, tbm_key);
240 tmp_bo = tbm_bo_import(bufmgr, tbm_key);
241 if (tmp_bo == NULL) {
242 LOGE("bo import failed - bufmgr %p, key %d", bufmgr, tbm_key);
246 tmp_bo_handle = tbm_bo_map(tmp_bo, TBM_DEVICE_CPU, TBM_OPTION_READ);
247 if (tmp_bo_handle.ptr == NULL) {
248 LOGE("bo map failed %p", tmp_bo);
249 tbm_bo_unref(tmp_bo);
254 tbm_bo_unmap(tmp_bo);
256 /* set bo and bo_handle */
258 *bo_handle = tmp_bo_handle;
263 static void _release_imported_bo(tbm_bo *bo)
265 if (bo == NULL || *bo == NULL) {
276 static int _client_wait_for_cb_return(muse_camera_api_e api, camera_cb_info_s *cb_info, int time_out)
278 int ret = CAMERA_ERROR_NONE;
281 /*LOGD("Enter api : %d", api);*/
283 g_mutex_lock(&(cb_info->api_mutex[api]));
285 if (cb_info->api_activating[api] == 0) {
286 end_time = g_get_monotonic_time() + time_out * G_TIME_SPAN_SECOND;
287 if (g_cond_wait_until(&(cb_info->api_cond[api]), &(cb_info->api_mutex[api]), end_time)) {
288 ret = cb_info->api_ret[api];
289 cb_info->api_activating[api] = 0;
291 /*LOGD("return value : 0x%x", ret);*/
293 ret = CAMERA_ERROR_INVALID_OPERATION;
295 LOGE("api %d was TIMED OUT!", api);
298 ret = cb_info->api_ret[api];
299 cb_info->api_activating[api] = 0;
301 /*LOGD("condition is already checked for the api[%d], return[0x%x]", api, ret);*/
304 g_mutex_unlock(&(cb_info->api_mutex[api]));
309 int _camera_get_tbm_surface_format(int in_format, uint32_t *out_format)
311 if (in_format <= MM_PIXEL_FORMAT_INVALID ||
312 in_format >= MM_PIXEL_FORMAT_NUM ||
313 out_format == NULL) {
314 LOGE("INVALID_PARAMETER : in_format %d, out_format ptr %p", in_format, out_format);
315 return CAMERA_ERROR_INVALID_PARAMETER;
319 case MM_PIXEL_FORMAT_NV12:
320 case MM_PIXEL_FORMAT_NV12T:
321 *out_format = TBM_FORMAT_NV12;
323 case MM_PIXEL_FORMAT_NV16:
324 *out_format = TBM_FORMAT_NV16;
326 case MM_PIXEL_FORMAT_NV21:
327 *out_format = TBM_FORMAT_NV21;
329 case MM_PIXEL_FORMAT_YUYV:
330 *out_format = TBM_FORMAT_YUYV;
332 case MM_PIXEL_FORMAT_UYVY:
333 case MM_PIXEL_FORMAT_ITLV_JPEG_UYVY:
334 *out_format = TBM_FORMAT_UYVY;
336 case MM_PIXEL_FORMAT_422P:
337 *out_format = TBM_FORMAT_YUV422;
339 case MM_PIXEL_FORMAT_I420:
340 *out_format = TBM_FORMAT_YUV420;
342 case MM_PIXEL_FORMAT_YV12:
343 *out_format = TBM_FORMAT_YVU420;
345 case MM_PIXEL_FORMAT_RGB565:
346 *out_format = TBM_FORMAT_RGB565;
348 case MM_PIXEL_FORMAT_RGB888:
349 *out_format = TBM_FORMAT_RGB888;
351 case MM_PIXEL_FORMAT_RGBA:
352 *out_format = TBM_FORMAT_RGBA8888;
354 case MM_PIXEL_FORMAT_ARGB:
355 *out_format = TBM_FORMAT_ARGB8888;
358 LOGE("invalid in_format %d", in_format);
359 return CAMERA_ERROR_INVALID_PARAMETER;
362 return CAMERA_ERROR_NONE;
366 int _camera_get_media_packet_mimetype(int in_format, media_format_mimetype_e *mimetype)
368 if (in_format <= MM_PIXEL_FORMAT_INVALID ||
369 in_format >= MM_PIXEL_FORMAT_NUM ||
371 LOGE("INVALID_PARAMETER : in_format %d, mimetype ptr %p", in_format, mimetype);
372 return CAMERA_ERROR_INVALID_PARAMETER;
376 case MM_PIXEL_FORMAT_NV12:
377 case MM_PIXEL_FORMAT_NV12T:
378 *mimetype = MEDIA_FORMAT_NV12;
380 case MM_PIXEL_FORMAT_NV16:
381 *mimetype = MEDIA_FORMAT_NV16;
383 case MM_PIXEL_FORMAT_NV21:
384 *mimetype = MEDIA_FORMAT_NV21;
386 case MM_PIXEL_FORMAT_YUYV:
387 *mimetype = MEDIA_FORMAT_YUYV;
389 case MM_PIXEL_FORMAT_UYVY:
390 case MM_PIXEL_FORMAT_ITLV_JPEG_UYVY:
391 *mimetype = MEDIA_FORMAT_UYVY;
393 case MM_PIXEL_FORMAT_422P:
394 *mimetype = MEDIA_FORMAT_422P;
396 case MM_PIXEL_FORMAT_I420:
397 *mimetype = MEDIA_FORMAT_I420;
399 case MM_PIXEL_FORMAT_YV12:
400 *mimetype = MEDIA_FORMAT_YV12;
402 case MM_PIXEL_FORMAT_RGB565:
403 *mimetype = MEDIA_FORMAT_RGB565;
405 case MM_PIXEL_FORMAT_RGB888:
406 *mimetype = MEDIA_FORMAT_RGB888;
408 case MM_PIXEL_FORMAT_RGBA:
409 *mimetype = MEDIA_FORMAT_RGBA;
411 case MM_PIXEL_FORMAT_ARGB:
412 *mimetype = MEDIA_FORMAT_ARGB;
415 LOGE("invalid in_format %d", in_format);
416 return CAMERA_ERROR_INVALID_PARAMETER;
419 return CAMERA_ERROR_NONE;
422 void _camera_preview_frame_create(camera_stream_data_s *stream, int num_buffer_key,
423 tbm_bo_handle *buffer_bo_handle, tbm_bo_handle *data_bo_handle, camera_preview_data_s *frame)
426 unsigned char *buf_pos = NULL;
428 if (stream == NULL || buffer_bo_handle == NULL || frame == NULL) {
429 LOGE("invalid parameter - stream:%p, buffer_bo_handle:%p", stream, buffer_bo_handle);
434 if (stream->format == MM_PIXEL_FORMAT_ITLV_JPEG_UYVY)
435 frame->format = MM_PIXEL_FORMAT_UYVY;
437 frame->format = stream->format;
439 frame->width = stream->width;
440 frame->height = stream->height;
441 frame->timestamp = stream->timestamp;
442 frame->num_of_planes = stream->num_planes;
444 if (num_buffer_key == 0) {
446 if (data_bo_handle == NULL || data_bo_handle->ptr == NULL) {
447 LOGE("no data pointer");
451 buf_pos = data_bo_handle->ptr;
453 if (stream->format == MM_PIXEL_FORMAT_ENCODED_H264) {
454 frame->data.encoded_plane.data = buf_pos;
455 frame->data.encoded_plane.size = stream->data.encoded.length_data;
456 total_size = stream->data.encoded.length_data;
458 switch (stream->num_planes) {
460 frame->data.single_plane.yuv = buf_pos;
461 frame->data.single_plane.size = stream->data.yuv420.length_yuv;
462 total_size = stream->data.yuv420.length_yuv;
465 frame->data.double_plane.y = buf_pos;
466 frame->data.double_plane.y_size = stream->data.yuv420sp.length_y;
467 buf_pos += stream->data.yuv420sp.length_y;
468 frame->data.double_plane.uv = buf_pos;
469 frame->data.double_plane.uv_size = stream->data.yuv420sp.length_uv;
470 total_size = stream->data.yuv420sp.length_y + \
471 stream->data.yuv420sp.length_uv;
474 frame->data.triple_plane.y = buf_pos;
475 frame->data.triple_plane.y_size = stream->data.yuv420p.length_y;
476 buf_pos += stream->data.yuv420p.length_y;
477 frame->data.triple_plane.u = buf_pos;
478 frame->data.triple_plane.u_size = stream->data.yuv420p.length_u;
479 buf_pos += stream->data.yuv420p.length_u;
480 frame->data.triple_plane.v = buf_pos;
481 frame->data.triple_plane.v_size = stream->data.yuv420p.length_v;
482 total_size = stream->data.yuv420p.length_y + \
483 stream->data.yuv420p.length_u + \
484 stream->data.yuv420p.length_v;
492 switch (stream->num_planes) {
494 frame->data.single_plane.yuv = buffer_bo_handle[0].ptr;
495 frame->data.single_plane.size = stream->data.yuv420.length_yuv;
496 total_size = stream->data.yuv420.length_yuv;
499 frame->data.double_plane.y = buffer_bo_handle[0].ptr;
500 if (stream->num_planes == (unsigned int)num_buffer_key)
501 frame->data.double_plane.uv = buffer_bo_handle[1].ptr;
503 frame->data.double_plane.uv = buffer_bo_handle[0].ptr + stream->data.yuv420sp.length_y;
504 frame->data.double_plane.y_size = stream->data.yuv420sp.length_y;
505 frame->data.double_plane.uv_size = stream->data.yuv420sp.length_uv;
506 total_size = stream->data.yuv420sp.length_y + \
507 stream->data.yuv420sp.length_uv;
510 frame->data.triple_plane.y = buffer_bo_handle[0].ptr;
511 if (stream->num_planes == (unsigned int)num_buffer_key) {
512 frame->data.triple_plane.u = buffer_bo_handle[1].ptr;
513 frame->data.triple_plane.v = buffer_bo_handle[2].ptr;
515 frame->data.triple_plane.u = buffer_bo_handle[0].ptr + stream->data.yuv420p.length_y;
516 frame->data.triple_plane.v = buffer_bo_handle[1].ptr + stream->data.yuv420p.length_u;
518 frame->data.triple_plane.y_size = stream->data.yuv420p.length_y;
519 frame->data.triple_plane.u_size = stream->data.yuv420p.length_u;
520 frame->data.triple_plane.v_size = stream->data.yuv420p.length_v;
521 total_size = stream->data.yuv420p.length_y + \
522 stream->data.yuv420p.length_u + \
523 stream->data.yuv420p.length_v;
531 LOGD("format %d, %dx%d, size %d plane num %d",
532 frame.format, frame.width, frame.height, total_size, frame.num_of_planes);
538 int _camera_media_packet_data_create(int tbm_key, int num_buffer_key, tbm_bo bo,
539 tbm_bo *buffer_bo, tbm_bo data_bo, camera_media_packet_data **mp_data)
542 int ret = CAMERA_ERROR_NONE;
543 camera_media_packet_data *tmp_mp_data = NULL;
545 if (*mp_data == NULL) {
546 tmp_mp_data = g_new0(camera_media_packet_data, 1);
548 tmp_mp_data->tbm_key = tbm_key;
549 tmp_mp_data->num_buffer_key = num_buffer_key;
550 tmp_mp_data->bo = bo;
551 tmp_mp_data->data_bo = data_bo;
552 tmp_mp_data->ref_cnt++;
554 for (i = 0 ; i < num_buffer_key ; i++)
555 tmp_mp_data->buffer_bo[i] = buffer_bo[i];
557 *mp_data = tmp_mp_data;
558 /*LOGD("mp_data %p", tmp_mp_data);*/
560 ret = CAMERA_ERROR_OUT_OF_MEMORY;
561 LOGE("failed to alloc media packet data");
564 ((camera_media_packet_data *)*mp_data)->ref_cnt++;
570 void _camera_media_packet_data_release(camera_media_packet_data *mp_data, camera_cb_info_s *cb_info)
575 if (mp_data == NULL || cb_info == NULL) {
576 LOGE("NULL data %p or cb_info %p", mp_data, cb_info);
580 if (mp_data->ref_cnt > 1) {
582 LOGD("mp_data is still referenced(current %d)", mp_data->ref_cnt);
584 /* release imported bo */
585 for (i = 0 ; i < mp_data->num_buffer_key ; i++) {
586 tbm_bo_unref(mp_data->buffer_bo[i]);
587 mp_data->buffer_bo[i] = NULL;
591 _release_imported_bo(&mp_data->bo);
592 _release_imported_bo(&mp_data->data_bo);
595 tbm_key = mp_data->tbm_key;
596 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
597 cb_info->fd, cb_info, INT, tbm_key);
606 int _camera_media_packet_create(camera_cb_info_s *cb_info, camera_stream_data_s *stream,
607 camera_media_packet_data *mp_data, media_packet_h *packet)
609 media_packet_h pkt = NULL;
610 bool make_pkt_fmt = false;
611 tbm_surface_h tsurf = NULL;
612 tbm_surface_info_s tsurf_info;
613 media_format_mimetype_e mimetype = MEDIA_FORMAT_NV12;
614 uint32_t bo_format = 0;
617 int num_buffer_key = 0;
618 tbm_bo *buffer_bo = NULL;
620 if (cb_info == NULL || stream == NULL || mp_data == NULL || packet == NULL) {
621 LOGE("invalid parameter - cb_info:%p, stream:%p, mp_data:%p, packet:%p",
622 cb_info, stream, mp_data, packet);
623 return CAMERA_ERROR_INVALID_PARAMETER;
626 memset(&tsurf_info, 0x0, sizeof(tbm_surface_info_s));
627 buffer_bo = mp_data->buffer_bo;
628 num_buffer_key = mp_data->num_buffer_key;
630 /* create tbm surface */
631 for (i = 0 ; i < BUFFER_MAX_PLANE_NUM ; i++)
632 tsurf_info.planes[i].stride = stream->stride[i];
634 /* get tbm surface format */
635 ret = _camera_get_tbm_surface_format(stream->format, &bo_format);
636 ret |= _camera_get_media_packet_mimetype(stream->format, &mimetype);
638 if (ret == CAMERA_ERROR_NONE) {
639 tsurf_info.width = stream->width;
640 tsurf_info.height = stream->height;
641 tsurf_info.format = bo_format;
642 tsurf_info.bpp = tbm_surface_internal_get_bpp(bo_format);
643 tsurf_info.num_planes = tbm_surface_internal_get_num_planes(bo_format);
645 if (num_buffer_key > 0) {
647 case TBM_FORMAT_NV12:
648 case TBM_FORMAT_NV21:
649 tsurf_info.planes[0].size = stream->stride[0] * stream->elevation[0];
650 tsurf_info.planes[1].size = stream->stride[1] * stream->elevation[1];
651 tsurf_info.planes[0].offset = 0;
652 if (num_buffer_key == 1)
653 tsurf_info.planes[1].offset = tsurf_info.planes[0].size;
654 tsurf_info.size = tsurf_info.planes[0].size + tsurf_info.planes[1].size;
656 case TBM_FORMAT_YUV420:
657 case TBM_FORMAT_YVU420:
658 tsurf_info.planes[0].size = stream->stride[0] * stream->elevation[0];
659 tsurf_info.planes[1].size = stream->stride[1] * stream->elevation[1];
660 tsurf_info.planes[2].size = stream->stride[2] * stream->elevation[2];
661 tsurf_info.planes[0].offset = 0;
662 if (num_buffer_key == 1) {
663 tsurf_info.planes[1].offset = tsurf_info.planes[0].size;
664 tsurf_info.planes[2].offset = tsurf_info.planes[0].size + tsurf_info.planes[1].size;
666 tsurf_info.size = tsurf_info.planes[0].size + tsurf_info.planes[1].size + tsurf_info.planes[2].size;
668 case TBM_FORMAT_UYVY:
669 case TBM_FORMAT_YUYV:
670 tsurf_info.planes[0].size = (stream->stride[0] * stream->elevation[0]) << 1;
671 tsurf_info.planes[0].offset = 0;
672 tsurf_info.size = tsurf_info.planes[0].size;
678 tsurf = tbm_surface_internal_create_with_bos(&tsurf_info, buffer_bo, num_buffer_key);
679 } else if (mp_data->data_bo) {
681 case TBM_FORMAT_NV12:
682 case TBM_FORMAT_NV21:
683 tsurf_info.planes[0].size = stream->width * stream->height;
684 tsurf_info.planes[1].size = (tsurf_info.planes[0].size) >> 1;
685 tsurf_info.planes[0].offset = 0;
686 tsurf_info.planes[1].offset = tsurf_info.planes[0].size;
687 tsurf_info.size = tsurf_info.planes[0].size + tsurf_info.planes[1].size;
689 case TBM_FORMAT_YUV420:
690 case TBM_FORMAT_YVU420:
691 tsurf_info.planes[0].size = stream->width * stream->height;
692 tsurf_info.planes[1].size = (stream->width >> 1) * (stream->height >> 1);
693 tsurf_info.planes[2].size = tsurf_info.planes[1].size;
694 tsurf_info.planes[0].offset = 0;
695 tsurf_info.planes[1].offset = tsurf_info.planes[0].size;
696 tsurf_info.planes[2].offset = tsurf_info.planes[0].size + tsurf_info.planes[1].size;
697 tsurf_info.size = tsurf_info.planes[0].size + tsurf_info.planes[1].size + tsurf_info.planes[2].size;
699 case TBM_FORMAT_UYVY:
700 case TBM_FORMAT_YUYV:
701 tsurf_info.planes[0].size = (stream->width * stream->height) << 1;
702 tsurf_info.planes[0].offset = 0;
703 tsurf_info.size = tsurf_info.planes[0].size;
709 tsurf = tbm_surface_internal_create_with_bos(&tsurf_info, &mp_data->data_bo, 1);
711 /*LOGD("tbm surface %p", tsurf);*/
715 /* check media packet format */
716 if (cb_info->pkt_fmt) {
717 int pkt_fmt_width = 0;
718 int pkt_fmt_height = 0;
719 media_format_mimetype_e pkt_fmt_mimetype = MEDIA_FORMAT_NV12;
721 media_format_get_video_info(cb_info->pkt_fmt, &pkt_fmt_mimetype, &pkt_fmt_width, &pkt_fmt_height, NULL, NULL);
722 if (pkt_fmt_mimetype != mimetype ||
723 pkt_fmt_width != stream->width ||
724 pkt_fmt_height != stream->height) {
725 LOGW("different format. current 0x%x, %dx%d, new 0x%x, %dx%d",
726 pkt_fmt_mimetype, pkt_fmt_width, pkt_fmt_height, mimetype, stream->width, stream->height);
727 media_format_unref(cb_info->pkt_fmt);
728 cb_info->pkt_fmt = NULL;
735 /* create packet format */
737 LOGW("make new pkt_fmt - mimetype 0x%x, %dx%d", mimetype, stream->width, stream->height);
738 ret = media_format_create(&cb_info->pkt_fmt);
739 if (ret == MEDIA_FORMAT_ERROR_NONE) {
740 ret = media_format_set_video_mime(cb_info->pkt_fmt, mimetype);
741 ret |= media_format_set_video_width(cb_info->pkt_fmt, stream->width);
742 ret |= media_format_set_video_height(cb_info->pkt_fmt, stream->height);
743 LOGW("media_format_set_video_mime,width,height ret : 0x%x", ret);
745 LOGW("media_format_create failed");
749 /* create media packet */
750 ret = media_packet_create_from_tbm_surface(cb_info->pkt_fmt,
751 tsurf, (media_packet_finalize_cb)_camera_media_packet_finalize,
752 (void *)cb_info, &pkt);
753 if (ret != MEDIA_PACKET_ERROR_NONE) {
754 LOGE("media_packet_create_from_tbm_surface failed");
756 tbm_surface_destroy(tsurf);
760 LOGE("failed to create tbm surface %dx%d, format %d, num_buffer_key %d, data_bo %p",
761 stream->width, stream->height, stream->format, num_buffer_key, mp_data->data_bo);
765 LOGD("media packet %p, internal buffer %p", pkt, stream->internal_buffer);
767 /* set media packet data */
768 ret = media_packet_set_extra(pkt, (void *)mp_data);
769 if (ret != MEDIA_PACKET_ERROR_NONE) {
770 LOGE("media_packet_set_extra failed");
772 _camera_media_packet_data_release(mp_data, cb_info);
775 media_packet_destroy(pkt);
778 /* set timestamp : msec -> nsec */
779 if (media_packet_set_pts(pkt, (uint64_t)(stream->timestamp) * 1000000) != MEDIA_PACKET_ERROR_NONE)
780 LOGW("media_packet_set_pts failed");
789 int _camera_media_packet_finalize(media_packet_h pkt, int error_code, void *user_data)
792 camera_cb_info_s *cb_info = (camera_cb_info_s *)user_data;
793 camera_media_packet_data *mp_data = NULL;
794 tbm_surface_h tsurf = NULL;
796 if (pkt == NULL || cb_info == NULL) {
797 LOGE("invalid parameter buffer %p, cb_info %p", pkt, cb_info);
798 return MEDIA_PACKET_FINALIZE;
801 ret = media_packet_get_extra(pkt, (void **)&mp_data);
802 if (ret != MEDIA_PACKET_ERROR_NONE) {
803 LOGE("media_packet_get_extra failed 0x%x", ret);
804 return MEDIA_PACKET_FINALIZE;
807 /*LOGD("mp_data %p", mp_data);*/
809 g_mutex_lock(&cb_info->mp_data_mutex);
811 _camera_media_packet_data_release(mp_data, cb_info);
814 g_mutex_unlock(&cb_info->mp_data_mutex);
816 ret = media_packet_get_tbm_surface(pkt, &tsurf);
817 if (ret != MEDIA_PACKET_ERROR_NONE) {
818 LOGE("media_packet_get_tbm_surface failed 0x%x", ret);
819 return MEDIA_PACKET_FINALIZE;
823 tbm_surface_destroy(tsurf);
827 return MEDIA_PACKET_FINALIZE;
830 static void _client_user_callback(camera_cb_info_s *cb_info, char *recv_msg, muse_camera_event_e event)
836 tbm_bo_handle bo_handle = {NULL, };
838 if (recv_msg == NULL || event >= MUSE_CAMERA_EVENT_TYPE_NUM) {
839 LOGE("invalid parameter - camera msg %p, event %d", recv_msg, event);
843 /*LOGD("get camera msg %s, event %d", recv_msg, event);*/
845 if (event == MUSE_CAMERA_EVENT_TYPE_PREVIEW) {
846 if (!(CHECK_PREVIEW_CB(cb_info, PREVIEW_CB_TYPE_EVAS)) &&
847 cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW] == NULL &&
848 cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] == NULL) {
849 LOGW("all preview callback from user are NULL");
852 } else if (cb_info->user_cb[event] == NULL) {
853 LOGW("user callback for event %d is not set", event);
858 case MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE:
864 muse_camera_msg_get(previous, recv_msg);
865 muse_camera_msg_get(current, recv_msg);
866 muse_camera_msg_get(by_policy, recv_msg);
868 LOGD("STATE CHANGE - previous %d, current %d, by_policy %d",
869 previous, current, by_policy);
871 ((camera_state_changed_cb)cb_info->user_cb[event])((camera_state_e)previous,
872 (camera_state_e)current, (bool)by_policy, cb_info->user_data[event]);
875 case MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE:
879 muse_camera_msg_get(state, recv_msg);
881 LOGD("FOCUS state - %d", state);
883 ((camera_focus_changed_cb)cb_info->user_cb[event])((camera_focus_state_e)state, cb_info->user_data[event]);
886 case MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE:
887 LOGD("CAPTURE_COMPLETED");
888 ((camera_capture_completed_cb)cb_info->user_cb[event])(cb_info->user_data[event]);
890 case MUSE_CAMERA_EVENT_TYPE_PREVIEW:
891 case MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW:
893 int e_type = MUSE_CAMERA_EVENT_TYPE_PREVIEW;
896 int num_buffer_key = 0;
897 int buffer_key[BUFFER_MAX_PLANE_NUM] = {0, };
899 unsigned char *buf_pos = NULL;
901 tbm_bo buffer_bo[BUFFER_MAX_PLANE_NUM] = {NULL, };
902 tbm_bo_handle buffer_bo_handle[BUFFER_MAX_PLANE_NUM] = {{.ptr = NULL}, };
903 tbm_bo data_bo = NULL;
904 tbm_bo_handle data_bo_handle = {.ptr = NULL};
906 camera_preview_data_s frame;
907 camera_stream_data_s *stream = NULL;
908 camera_media_packet_data *mp_data = NULL;
909 media_packet_h pkt = NULL;
911 muse_camera_msg_get(tbm_key, recv_msg);
912 muse_camera_msg_get(num_buffer_key, recv_msg);
913 muse_camera_msg_get_array(buffer_key, recv_msg);
914 muse_camera_msg_get(data_key, recv_msg);
916 memset(&frame, 0x0, sizeof(camera_preview_data_s));
919 LOGE("invalid key %d", tbm_key);
924 /* import tbm data_bo and get virtual address */
925 if (!_import_tbm_key(cb_info->bufmgr, data_key, &data_bo, &data_bo_handle)) {
926 LOGE("failed to import data key %d", data_key);
927 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
928 cb_info->fd, cb_info, INT, tbm_key);
933 /* import tbm bo and get virtual address */
934 if (!_import_tbm_key(cb_info->bufmgr, tbm_key, &bo, &bo_handle)) {
935 LOGE("failed to import key %d", tbm_key);
936 _release_imported_bo(&data_bo);
937 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
938 cb_info->fd, cb_info, INT, tbm_key);
942 buf_pos = (unsigned char *)bo_handle.ptr;
944 /* get stream info */
945 stream = (camera_stream_data_s *)buf_pos;
947 for (i = 0 ; i < num_buffer_key ; i++) {
948 /* import buffer bo and get virtual address */
949 if (!_import_tbm_key(cb_info->bufmgr, buffer_key[i], &buffer_bo[i], &buffer_bo_handle[i])) {
950 LOGE("failed to import buffer key %d", buffer_key[i]);
952 /* release imported bo */
953 _release_imported_bo(&data_bo);
954 _release_imported_bo(&bo);
956 for (i -= 1 ; i >= 0 ; i--)
957 _release_imported_bo(&buffer_bo[i]);
959 /* send return buffer */
960 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
961 cb_info->fd, cb_info, INT, tbm_key);
967 /* call preview callback */
968 if (cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW]) {
969 _camera_preview_frame_create(stream, num_buffer_key, buffer_bo_handle, &data_bo_handle, &frame);
971 e_type = MUSE_CAMERA_EVENT_TYPE_PREVIEW;
972 ((camera_preview_cb)cb_info->user_cb[e_type])(&frame, cb_info->user_data[e_type]);
975 /* call media packet callback */
976 if (cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW]) {
977 ret = _camera_media_packet_data_create(tbm_key, num_buffer_key, bo, buffer_bo, data_bo, &mp_data);
979 if (ret == CAMERA_ERROR_NONE) {
980 ret = _camera_media_packet_create(cb_info, stream, mp_data, &pkt);
982 e_type = MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW;
983 if (ret == CAMERA_ERROR_NONE) {
984 ((camera_media_packet_preview_cb)cb_info->user_cb[e_type])(pkt, cb_info->user_data[e_type]);
986 _camera_media_packet_data_release(mp_data, cb_info);
992 /* call evas renderer */
993 if (CHECK_PREVIEW_CB(cb_info, PREVIEW_CB_TYPE_EVAS)) {
994 #ifdef TIZEN_FEATURE_EVAS_RENDERER
995 ret = _camera_media_packet_data_create(tbm_key, num_buffer_key, bo, buffer_bo, data_bo, &mp_data);
997 if (ret == CAMERA_ERROR_NONE) {
998 ret = _camera_media_packet_create(cb_info, stream, mp_data, &pkt);
1000 if (ret == CAMERA_ERROR_NONE) {
1001 g_mutex_lock(&cb_info->evas_mutex);
1003 if (cb_info->run_evas_render)
1004 mm_evas_renderer_write(pkt, cb_info->evas_info);
1006 LOGW("evas renderer is stopped, skip this buffer...");
1007 media_packet_destroy(pkt);
1012 g_mutex_unlock(&cb_info->evas_mutex);
1014 _camera_media_packet_data_release(mp_data, cb_info);
1018 #else /* TIZEN_FEATURE_EVAS_RENDERER */
1019 LOGW("evas renderer is not supported");
1020 #endif /* TIZEN_FEATURE_EVAS_RENDERER */
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 LOGW("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 LOGW("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 LOGW("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 LOGW("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 LOGW("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 LOGW("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 LOGW("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 LOGW("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 LOGW("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 LOGW("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 LOGW("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 LOGW("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 LOGW("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 LOGW("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 LOGW("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 LOGW("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 LOGW("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);
1339 LOGD("camera capture callback came in. tbm_key_main %d, tbm_key_post %d, tbm_key_thumb %d",
1340 tbm_key_main, tbm_key_post, tbm_key_thumb);
1343 if (tbm_key_main <= 0) {
1344 LOGE("invalid tbm_key_main %d", tbm_key_main);
1348 /* import tbm bo and get virtual address */
1349 if (!_import_tbm_key(cb_info->bufmgr, tbm_key_main, &bo_main, &bo_main_handle))
1352 buf_pos = (unsigned char *)bo_main_handle.ptr;
1353 rImage = (camera_image_data_s *)buf_pos;
1354 rImage->data = buf_pos + sizeof(camera_image_data_s);
1356 LOGD("image info %dx%d, size : %d", rImage->width, rImage->height, rImage->size);
1358 if (tbm_key_post > 0) {
1359 /* import tbm bo and get virtual address */
1360 if (!_import_tbm_key(cb_info->bufmgr, tbm_key_post, &bo_post, &bo_post_handle))
1363 buf_pos = (unsigned char *)bo_post_handle.ptr;
1364 rPostview = (camera_image_data_s *)buf_pos;
1365 LOGD("rPostview->size : %d", rPostview->size);
1366 rPostview->data = buf_pos + sizeof(camera_image_data_s);
1369 if (tbm_key_thumb > 0) {
1370 /* import tbm bo and get virtual address */
1371 if (!_import_tbm_key(cb_info->bufmgr, tbm_key_thumb, &bo_thumb, &bo_thumb_handle))
1374 buf_pos = (unsigned char *)bo_thumb_handle.ptr;
1376 rThumbnail = (camera_image_data_s *)buf_pos;
1377 LOGD("rThumbnail->size : %d", rThumbnail->size);
1378 rThumbnail->data = buf_pos + sizeof(camera_image_data_s);
1381 ((camera_capturing_cb)cb_info->user_cb[event])(rImage, rPostview, rThumbnail, cb_info->user_data[event]);
1383 /* unmap and unref tbm bo */
1384 _release_imported_bo(&bo_main);
1387 tbm_key = tbm_key_main;
1388 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
1389 cb_info->fd, cb_info, INT, tbm_key);
1391 if (tbm_key_post > 0) {
1392 /* unmap and unref tbm bo */
1393 _release_imported_bo(&bo_post);
1396 tbm_key = tbm_key_post;
1397 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
1398 cb_info->fd, cb_info, INT, tbm_key);
1401 if (tbm_key_thumb > 0) {
1402 /* unmap and unref tbm bo */
1403 _release_imported_bo(&bo_thumb);
1406 tbm_key = tbm_key_thumb;
1407 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
1408 cb_info->fd, cb_info, INT, tbm_key);
1411 LOGD("return buffer done");
1414 case MUSE_CAMERA_EVENT_TYPE_VIDEO_FRAME_RENDER_ERROR:
1417 LOGW("Unknown event : %d", event);
1424 static bool _camera_idle_event_callback(void *data)
1426 camera_cb_info_s *cb_info = NULL;
1427 camera_idle_event_s *cam_idle_event = (camera_idle_event_s *)data;
1429 if (cam_idle_event == NULL) {
1430 LOGE("cam_idle_event is NULL");
1435 g_mutex_lock(&cam_idle_event->event_mutex);
1437 cb_info = cam_idle_event->cb_info;
1438 if (cb_info == NULL) {
1439 LOGW("camera cb_info is NULL. event %d", cam_idle_event->event);
1440 goto IDLE_EVENT_CALLBACK_DONE;
1443 /* remove event from list */
1444 g_mutex_lock(&cb_info->idle_event_mutex);
1445 if (cb_info->idle_event_list)
1446 cb_info->idle_event_list = g_list_remove(cb_info->idle_event_list, (gpointer)cam_idle_event);
1448 /*LOGD("remove camera idle event %p, %p", cam_idle_event, cb_info->idle_event_list);*/
1449 g_mutex_unlock(&cb_info->idle_event_mutex);
1452 _client_user_callback(cam_idle_event->cb_info, cam_idle_event->recv_msg, cam_idle_event->event);
1454 /* send signal for waiting thread */
1455 g_cond_signal(&cb_info->idle_event_cond);
1457 IDLE_EVENT_CALLBACK_DONE:
1458 /* unlock and release event */
1459 g_mutex_unlock(&cam_idle_event->event_mutex);
1460 g_mutex_clear(&cam_idle_event->event_mutex);
1462 g_free(cam_idle_event);
1463 cam_idle_event = NULL;
1468 static void *_camera_msg_handler_func(gpointer data)
1473 int event_class = 0;
1474 camera_message_s *cam_msg = NULL;
1475 camera_idle_event_s *cam_idle_event = NULL;
1476 camera_cb_info_s *cb_info = (camera_cb_info_s *)data;
1478 if (cb_info == NULL) {
1479 LOGE("cb_info NULL");
1485 g_mutex_lock(&cb_info->msg_handler_mutex);
1487 while (g_atomic_int_get(&cb_info->msg_handler_running)) {
1488 if (g_queue_is_empty(cb_info->msg_queue)) {
1489 /*LOGD("signal wait...");*/
1490 g_cond_wait(&cb_info->msg_handler_cond, &cb_info->msg_handler_mutex);
1491 /*LOGD("signal received");*/
1493 if (g_atomic_int_get(&cb_info->msg_handler_running) == 0) {
1494 LOGD("stop event thread");
1499 cam_msg = (camera_message_s *)g_queue_pop_head(cb_info->msg_queue);
1501 g_mutex_unlock(&cb_info->msg_handler_mutex);
1503 if (cam_msg == NULL) {
1504 LOGE("NULL message");
1505 g_mutex_lock(&cb_info->msg_handler_mutex);
1511 if (api < MUSE_CAMERA_API_MAX) {
1512 g_mutex_lock(&cb_info->api_mutex[api]);
1514 if (muse_camera_msg_get(ret, cam_msg->recv_msg)) {
1515 cb_info->api_ret[api] = ret;
1516 cb_info->api_activating[api] = 1;
1518 /*LOGD("camera api %d - return 0x%x", ret);*/
1520 g_cond_signal(&cb_info->api_cond[api]);
1522 LOGE("failed to get camera ret for api %d, msg %s", api, cam_msg->recv_msg);
1525 g_mutex_unlock(&cb_info->api_mutex[api]);
1526 } else if (api == MUSE_CAMERA_CB_EVENT) {
1530 if (!muse_camera_msg_get(event, cam_msg->recv_msg) ||
1531 !muse_camera_msg_get(event_class, cam_msg->recv_msg)) {
1532 LOGE("failed to get camera event %d, class %d", event, event_class);
1537 g_mutex_lock(&cb_info->msg_handler_mutex);
1541 switch (event_class) {
1542 case MUSE_CAMERA_EVENT_CLASS_THREAD_SUB:
1543 _client_user_callback(cb_info, cam_msg->recv_msg, event);
1545 case MUSE_CAMERA_EVENT_CLASS_THREAD_MAIN:
1546 cam_idle_event = g_new0(camera_idle_event_s, 1);
1547 if (cam_idle_event == NULL) {
1548 LOGE("cam_idle_event alloc failed");
1552 cam_idle_event->event = event;
1553 cam_idle_event->cb_info = cb_info;
1554 g_mutex_init(&cam_idle_event->event_mutex);
1555 memcpy(cam_idle_event->recv_msg, cam_msg->recv_msg, sizeof(cam_idle_event->recv_msg));
1557 /*LOGD("add camera event[%d, %p] to IDLE", event, cam_idle_event);*/
1559 g_mutex_lock(&cb_info->idle_event_mutex);
1560 cb_info->idle_event_list = g_list_append(cb_info->idle_event_list, (gpointer)cam_idle_event);
1561 g_mutex_unlock(&cb_info->idle_event_mutex);
1563 g_idle_add_full(G_PRIORITY_DEFAULT,
1564 (GSourceFunc)_camera_idle_event_callback,
1565 (gpointer)cam_idle_event,
1569 LOGE("unknown camera event class %d", event_class);
1573 LOGE("unknown camera api[%d] message[%s]", api, cam_msg->recv_msg);
1579 g_mutex_lock(&cb_info->msg_handler_mutex);
1582 /* remove remained event */
1583 while (!g_queue_is_empty(cb_info->msg_queue)) {
1584 cam_msg = (camera_message_s *)g_queue_pop_head(cb_info->msg_queue);
1586 LOGD("remove camera message %p", cam_msg);
1590 LOGW("NULL camera message");
1594 g_mutex_unlock(&cb_info->msg_handler_mutex);
1601 static void _camera_remove_idle_event_all(camera_cb_info_s *cb_info)
1603 camera_idle_event_s *cam_idle_event = NULL;
1604 gboolean ret = TRUE;
1606 gint64 end_time = 0;
1608 if (cb_info == NULL) {
1609 LOGE("cb_info is NULL");
1613 g_mutex_lock(&cb_info->idle_event_mutex);
1615 if (cb_info->idle_event_list == NULL) {
1616 LOGD("No idle event is remained.");
1618 list = cb_info->idle_event_list;
1621 cam_idle_event = list->data;
1622 list = g_list_next(list);
1624 if (!cam_idle_event) {
1625 LOGW("Fail to remove idle event. The event is NULL");
1627 if (g_mutex_trylock(&cam_idle_event->event_mutex)) {
1628 ret = g_idle_remove_by_data(cam_idle_event);
1630 LOGD("remove idle event [%p], ret[%d]", cam_idle_event, ret);
1633 cam_idle_event->cb_info = NULL;
1634 LOGW("idle callback for event %p will be called later", cam_idle_event);
1637 cb_info->idle_event_list = g_list_remove(cb_info->idle_event_list, (gpointer)cam_idle_event);
1639 g_mutex_unlock(&cam_idle_event->event_mutex);
1642 g_mutex_clear(&cam_idle_event->event_mutex);
1644 g_free(cam_idle_event);
1645 cam_idle_event = NULL;
1647 LOGD("remove idle event done");
1650 LOGW("event lock failed. it's being called...");
1652 end_time = g_get_monotonic_time() + G_TIME_SPAN_MILLISECOND * 100;
1654 if (g_cond_wait_until(&cb_info->idle_event_cond, &cb_info->idle_event_mutex, end_time))
1655 LOGW("signal received");
1662 g_list_free(cb_info->idle_event_list);
1663 cb_info->idle_event_list = NULL;
1666 g_mutex_unlock(&cb_info->idle_event_mutex);
1671 static void *_camera_msg_recv_func(gpointer data)
1680 char *recv_msg = NULL;
1681 char **parse_str = NULL;
1682 camera_cb_info_s *cb_info = (camera_cb_info_s *)data;
1684 if (cb_info == NULL) {
1685 LOGE("cb_info NULL");
1691 parse_str = (char **)malloc(sizeof(char *) * CAMERA_PARSE_STRING_SIZE);
1692 if (parse_str == NULL) {
1693 LOGE("parse_str malloc failed");
1697 for (i = 0 ; i < CAMERA_PARSE_STRING_SIZE ; i++) {
1698 parse_str[i] = (char *)malloc(sizeof(char) * MUSE_CAMERA_MSG_MAX_LENGTH);
1699 if (parse_str[i] == NULL) {
1700 LOGE("parse_str[%d] malloc failed", i);
1701 goto CB_HANDLER_EXIT;
1705 recv_msg = cb_info->recv_msg;
1707 while (g_atomic_int_get(&cb_info->msg_recv_running)) {
1708 ret = muse_core_ipc_recv_msg(cb_info->fd, recv_msg);
1711 recv_msg[ret] = '\0';
1717 /*LOGD("recvMSg : %s, length : %d", recv_msg, ret);*/
1719 /* Need to split the combined entering msgs.
1720 This module supports up to 200 combined msgs. */
1721 for (str_pos = 0; str_pos < ret; str_pos++) {
1722 if (recv_msg[str_pos] == '}') {
1723 memset(parse_str[num_token], 0x0, sizeof(char) * MUSE_CAMERA_MSG_MAX_LENGTH);
1724 strncpy(parse_str[num_token], recv_msg + prev_pos, str_pos - prev_pos + 1);
1725 /*LOGD("splitted msg : [%s], Index : %d", parse_str[num_token], num_token);*/
1726 prev_pos = str_pos+1;
1731 /*LOGD("num_token : %d", num_token);*/
1733 /* Re-construct to the useful single msg. */
1734 for (i = 0; i < num_token; i++) {
1735 if (i >= CAMERA_PARSE_STRING_SIZE) {
1736 LOGE("invalid token index %d", i);
1743 if (!muse_camera_msg_get(api, parse_str[i])) {
1744 LOGE("failed to get camera api");
1748 if (api != MUSE_CAMERA_CB_EVENT) {
1749 if (!muse_camera_msg_get(api_class, parse_str[i])) {
1750 LOGE("failed to get camera api_class");
1755 if (api_class == MUSE_CAMERA_API_CLASS_IMMEDIATE) {
1756 if (api >= MUSE_CAMERA_API_MAX) {
1757 LOGE("invalid api %d", api);
1761 g_mutex_lock(&cb_info->api_mutex[api]);
1763 if (!muse_camera_msg_get(ret, parse_str[i])) {
1764 LOGE("failed to get camera ret");
1765 g_mutex_unlock(&cb_info->api_mutex[api]);
1769 cb_info->api_ret[api] = ret;
1770 cb_info->api_activating[api] = 1;
1772 if (api == MUSE_CAMERA_API_CREATE) {
1773 if (ret != CAMERA_ERROR_NONE) {
1774 g_atomic_int_set(&cb_info->msg_recv_running, 0);
1775 LOGE("camera create error 0x%x. close client cb handler", ret);
1777 } else if (api == MUSE_CAMERA_API_DESTROY) {
1778 if (ret == CAMERA_ERROR_NONE) {
1779 g_atomic_int_set(&cb_info->msg_recv_running, 0);
1780 LOGD("camera destroy done. close client cb handler");
1784 g_cond_signal(&cb_info->api_cond[api]);
1785 g_mutex_unlock(&cb_info->api_mutex[api]);
1786 } else if (api_class == MUSE_CAMERA_API_CLASS_THREAD_SUB || api == MUSE_CAMERA_CB_EVENT) {
1787 camera_message_s *cam_msg = g_new0(camera_message_s, 1);
1788 if (cam_msg == NULL) {
1789 LOGE("failed to alloc cam_msg");
1794 memcpy(cam_msg->recv_msg, parse_str[i], sizeof(cam_msg->recv_msg));
1796 /*LOGD("add camera message to queue : api %d", api);*/
1798 g_mutex_lock(&cb_info->msg_handler_mutex);
1799 g_queue_push_tail(cb_info->msg_queue, (gpointer)cam_msg);
1800 g_cond_signal(&cb_info->msg_handler_cond);
1801 g_mutex_unlock(&cb_info->msg_handler_mutex);
1803 LOGW("unknown camera api %d and api_class %d", api, api_class);
1809 LOGD("client cb exit");
1813 for (i = 0 ; i < CAMERA_PARSE_STRING_SIZE ; i++) {
1816 parse_str[i] = NULL;
1827 static camera_cb_info_s *_client_callback_new(gint sockfd)
1829 camera_cb_info_s *cb_info = NULL;
1830 gint *tmp_activating = NULL;
1831 gint *tmp_ret = NULL;
1834 g_return_val_if_fail(sockfd > 0, NULL);
1836 cb_info = g_new0(camera_cb_info_s, 1);
1837 if (cb_info == NULL) {
1838 LOGE("cb_info failed");
1842 g_mutex_init(&cb_info->msg_handler_mutex);
1843 g_cond_init(&cb_info->msg_handler_cond);
1844 g_mutex_init(&cb_info->idle_event_mutex);
1845 g_cond_init(&cb_info->idle_event_cond);
1846 g_mutex_init(&cb_info->mp_data_mutex);
1847 #ifdef TIZEN_FEATURE_EVAS_RENDERER
1848 g_mutex_init(&cb_info->evas_mutex);
1849 #endif /* TIZEN_FEATURE_EVAS_RENDERER */
1851 for (i = 0 ; i < MUSE_CAMERA_API_MAX ; i++) {
1852 g_mutex_init(&cb_info->api_mutex[i]);
1853 g_cond_init(&cb_info->api_cond[i]);
1856 tmp_activating = g_new0(gint, MUSE_CAMERA_API_MAX);
1857 if (tmp_activating == NULL) {
1858 LOGE("tmp_activating failed");
1862 tmp_ret = g_new0(gint, MUSE_CAMERA_API_MAX);
1863 if (tmp_ret == NULL) {
1864 LOGE("tmp_ret failed");
1868 cb_info->msg_queue = g_queue_new();
1869 if (cb_info->msg_queue == NULL) {
1870 LOGE("msg_queue new failed");
1874 g_atomic_int_set(&cb_info->msg_handler_running, 1);
1875 cb_info->msg_handler_thread = g_thread_try_new("camera_msg_handler",
1876 _camera_msg_handler_func, (gpointer)cb_info, NULL);
1877 if (cb_info->msg_handler_thread == NULL) {
1878 LOGE("message handler thread creation failed");
1882 cb_info->fd = sockfd;
1883 cb_info->api_activating = tmp_activating;
1884 cb_info->api_ret = tmp_ret;
1885 cb_info->preview_cb_flag = 0;
1886 #ifdef TIZEN_FEATURE_EVAS_RENDERER
1887 cb_info->evas_info = NULL;
1888 #endif /* TIZEN_FEATURE_EVAS_RENDERER */
1890 g_atomic_int_set(&cb_info->msg_recv_running, 1);
1891 cb_info->msg_recv_thread = g_thread_try_new("camera_msg_recv",
1892 _camera_msg_recv_func, (gpointer)cb_info, NULL);
1893 if (cb_info->msg_recv_thread == NULL) {
1894 LOGE("message receive thread creation failed");
1902 if (cb_info->msg_handler_thread) {
1903 g_mutex_lock(&cb_info->msg_handler_mutex);
1904 g_atomic_int_set(&cb_info->msg_handler_running, 0);
1905 g_cond_signal(&cb_info->msg_handler_cond);
1906 g_mutex_unlock(&cb_info->msg_handler_mutex);
1908 g_thread_join(cb_info->msg_handler_thread);
1909 g_thread_unref(cb_info->msg_handler_thread);
1910 cb_info->msg_handler_thread = NULL;
1913 for (i = 0 ; i < MUSE_CAMERA_API_MAX ; i++) {
1914 g_mutex_clear(&cb_info->api_mutex[i]);
1915 g_cond_clear(&cb_info->api_cond[i]);
1918 g_mutex_clear(&cb_info->msg_handler_mutex);
1919 g_cond_clear(&cb_info->msg_handler_cond);
1920 g_mutex_clear(&cb_info->idle_event_mutex);
1921 g_cond_clear(&cb_info->idle_event_cond);
1922 g_mutex_clear(&cb_info->mp_data_mutex);
1923 #ifdef TIZEN_FEATURE_EVAS_RENDERER
1924 g_mutex_clear(&cb_info->evas_mutex);
1925 #endif /* TIZEN_FEATURE_EVAS_RENDERER */
1927 if (cb_info->msg_queue) {
1928 g_queue_free(cb_info->msg_queue);
1929 cb_info->msg_queue = NULL;
1936 if (tmp_activating) {
1937 g_free(tmp_activating);
1938 tmp_activating = NULL;
1948 static void _client_callback_destroy(camera_cb_info_s *cb_info)
1952 g_return_if_fail(cb_info != NULL);
1954 LOGD("MSG receive thread[%p] destroy", cb_info->msg_recv_thread);
1956 g_thread_join(cb_info->msg_recv_thread);
1957 g_thread_unref(cb_info->msg_recv_thread);
1958 cb_info->msg_recv_thread = NULL;
1960 LOGD("msg thread removed");
1962 g_mutex_lock(&cb_info->msg_handler_mutex);
1963 g_atomic_int_set(&cb_info->msg_handler_running, 0);
1964 g_cond_signal(&cb_info->msg_handler_cond);
1965 g_mutex_unlock(&cb_info->msg_handler_mutex);
1967 g_thread_join(cb_info->msg_handler_thread);
1968 g_thread_unref(cb_info->msg_handler_thread);
1969 cb_info->msg_handler_thread = NULL;
1971 g_queue_free(cb_info->msg_queue);
1972 cb_info->msg_queue = NULL;
1974 for (i = 0 ; i < MUSE_CAMERA_API_MAX ; i++) {
1975 g_mutex_clear(&cb_info->api_mutex[i]);
1976 g_cond_clear(&cb_info->api_cond[i]);
1979 g_mutex_clear(&cb_info->msg_handler_mutex);
1980 g_cond_clear(&cb_info->msg_handler_cond);
1981 g_mutex_clear(&cb_info->idle_event_mutex);
1982 g_cond_clear(&cb_info->idle_event_cond);
1983 g_mutex_clear(&cb_info->mp_data_mutex);
1984 #ifdef TIZEN_FEATURE_EVAS_RENDERER
1985 g_mutex_clear(&cb_info->evas_mutex);
1986 #endif /* TIZEN_FEATURE_EVAS_RENDERER */
1988 LOGD("event thread removed");
1990 if (cb_info->fd > -1) {
1991 muse_core_connection_close(cb_info->fd);
1995 if (cb_info->bufmgr) {
1996 tbm_bufmgr_deinit(cb_info->bufmgr);
1997 cb_info->bufmgr = NULL;
1999 if (cb_info->api_activating) {
2000 g_free(cb_info->api_activating);
2001 cb_info->api_activating = NULL;
2003 if (cb_info->api_ret) {
2004 g_free(cb_info->api_ret);
2005 cb_info->api_ret = NULL;
2007 if (cb_info->pkt_fmt) {
2008 media_format_unref(cb_info->pkt_fmt);
2009 cb_info->pkt_fmt = NULL;
2012 #ifdef TIZEN_FEATURE_EVAS_RENDERER
2013 if (cb_info->evas_info)
2014 mm_evas_renderer_destroy(&cb_info->evas_info);
2015 #endif /* TIZEN_FEATURE_EVAS_RENDERER */
2017 cb_info->preview_cb_flag = 0;
2026 int _camera_start_evas_rendering(camera_h camera)
2028 int ret = CAMERA_ERROR_NONE;
2029 camera_cli_s *pc = (camera_cli_s *)camera;
2031 if (camera == NULL) {
2032 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2033 return CAMERA_ERROR_INVALID_PARAMETER;
2036 if (pc->cb_info == NULL) {
2037 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2038 return CAMERA_ERROR_INVALID_PARAMETER;
2043 if (!CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
2044 LOGE("EVAS surface is not set");
2045 return CAMERA_ERROR_NONE;
2048 #ifdef TIZEN_FEATURE_EVAS_RENDERER
2049 g_mutex_lock(&pc->cb_info->evas_mutex);
2051 /* set evas render flag as RUN */
2052 pc->cb_info->run_evas_render = true;
2053 ret = CAMERA_ERROR_NONE;
2055 g_mutex_unlock(&pc->cb_info->evas_mutex);
2056 #else /* TIZEN_FEATURE_EVAS_RENDERER */
2057 LOGW("evas renderer is not supported");
2058 ret = CAMERA_ERROR_NOT_SUPPORTED;
2059 #endif /* TIZEN_FEATURE_EVAS_RENDERER */
2065 int _camera_stop_evas_rendering(camera_h camera, bool keep_screen)
2067 int ret = CAMERA_ERROR_NONE;
2068 camera_cli_s *pc = (camera_cli_s *)camera;
2070 if (camera == NULL) {
2071 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2072 return CAMERA_ERROR_INVALID_PARAMETER;
2075 if (pc->cb_info == NULL) {
2076 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2077 return CAMERA_ERROR_INVALID_PARAMETER;
2080 LOGD("stop - keep screen %d", keep_screen);
2082 if (!CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
2083 LOGE("EVAS surface is not set");
2084 return CAMERA_ERROR_NONE;
2087 #ifdef TIZEN_FEATURE_EVAS_RENDERER
2088 g_mutex_lock(&pc->cb_info->evas_mutex);
2090 /* set evas render flag as STOP and release buffers */
2091 pc->cb_info->run_evas_render = false;
2093 ret = mm_evas_renderer_retrieve_all_packets(pc->cb_info->evas_info, keep_screen);
2094 if (ret != MM_ERROR_NONE) {
2095 LOGE("mm_evas_renderer_retrieve_all_packets failed 0x%x", ret);
2096 ret = CAMERA_ERROR_INVALID_OPERATION;
2099 g_mutex_unlock(&pc->cb_info->evas_mutex);
2100 #else /* TIZEN_FEATURE_EVAS_RENDERER */
2101 LOGW("evas renderer is not supported");
2102 ret = CAMERA_ERROR_NOT_SUPPORTED;
2103 #endif /* TIZEN_FEATURE_EVAS_RENDERER */
2109 int camera_create(camera_device_e device, camera_h *camera)
2113 int ret = CAMERA_ERROR_NONE;
2115 camera_cli_s *pc = NULL;
2116 tbm_bufmgr bufmgr = NULL;
2118 muse_camera_api_e api = MUSE_CAMERA_API_CREATE;
2119 muse_core_api_module_e muse_module = MUSE_CAMERA;
2120 int device_type = (int)device;
2122 if (camera == NULL) {
2123 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2124 return CAMERA_ERROR_INVALID_PARAMETER;
2127 bufmgr = tbm_bufmgr_init(-1);
2128 if (bufmgr == NULL) {
2129 LOGE("get tbm bufmgr failed");
2130 return CAMERA_ERROR_INVALID_OPERATION;
2133 sock_fd = muse_core_client_new();
2135 LOGE("muse_core_client_new failed - returned fd %d", sock_fd);
2136 ret = CAMERA_ERROR_INVALID_OPERATION;
2142 sndMsg = muse_core_msg_json_factory_new(api,
2143 MUSE_TYPE_INT, "module", muse_module,
2144 MUSE_TYPE_INT, PARAM_DEVICE_TYPE, device_type,
2145 MUSE_TYPE_INT, "pid", pid,
2148 muse_core_ipc_send_msg(sock_fd, sndMsg);
2149 muse_core_msg_json_factory_free(sndMsg);
2151 pc = g_new0(camera_cli_s, 1);
2153 LOGE("camera_cli_s alloc failed");
2154 ret = CAMERA_ERROR_OUT_OF_MEMORY;
2158 pc->cb_info = _client_callback_new(sock_fd);
2159 if (pc->cb_info == NULL) {
2160 LOGE("cb_info alloc failed");
2161 ret = CAMERA_ERROR_OUT_OF_MEMORY;
2165 LOGD("cb info : %d", pc->cb_info->fd);
2167 ret = _client_wait_for_cb_return(api, pc->cb_info, CALLBACK_TIME_OUT);
2168 if (ret == CAMERA_ERROR_NONE) {
2169 intptr_t handle = 0;
2170 muse_camera_msg_get_pointer(handle, pc->cb_info->recv_msg);
2172 LOGE("Receiving Handle Failed!!");
2173 ret = CAMERA_ERROR_INVALID_OPERATION;
2177 pc->remote_handle = handle;
2178 pc->cb_info->bufmgr = bufmgr;
2180 ret = camera_set_display((camera_h)pc, CAMERA_DISPLAY_TYPE_NONE, NULL);
2181 if (ret != CAMERA_ERROR_NONE) {
2182 LOGE("init display failed 0x%x", ret);
2186 LOGD("camera create 0x%x", pc->remote_handle);
2187 *camera = (camera_h)pc;
2195 tbm_bufmgr_deinit(bufmgr);
2199 _client_callback_destroy(pc->cb_info);
2205 LOGE("camera create error : 0x%x", ret);
2210 int camera_destroy(camera_h camera)
2212 if (camera == NULL) {
2213 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2214 return CAMERA_ERROR_INVALID_PARAMETER;
2217 int ret = CAMERA_ERROR_NONE;
2218 muse_camera_api_e api = MUSE_CAMERA_API_DESTROY;
2219 camera_cli_s *pc = (camera_cli_s *)camera;
2224 if (pc->cb_info == NULL) {
2225 LOGE("cb_info NULL, INVALID_PARAMETER");
2226 return CAMERA_ERROR_INVALID_PARAMETER;
2229 sock_fd = pc->cb_info->fd;
2231 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2232 if (ret == CAMERA_ERROR_NONE) {
2233 _camera_remove_idle_event_all(pc->cb_info);
2234 _client_callback_destroy(pc->cb_info);
2240 LOGE("camera destroy error : 0x%x", ret);
2246 int camera_start_preview(camera_h camera)
2248 int ret = CAMERA_ERROR_NONE;
2249 muse_camera_api_e api = MUSE_CAMERA_API_START_PREVIEW;
2250 camera_cli_s *pc = (camera_cli_s *)camera;
2253 if (camera == NULL) {
2254 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2255 return CAMERA_ERROR_INVALID_PARAMETER;
2258 if (pc->cb_info == NULL) {
2259 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2260 return CAMERA_ERROR_INVALID_PARAMETER;
2265 sock_fd = pc->cb_info->fd;
2267 muse_camera_msg_send_longtime(api, sock_fd, pc->cb_info, ret);
2269 if (ret != CAMERA_ERROR_NONE) {
2270 LOGE("start preview failed 0x%x", ret);
2271 } else if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
2272 ret = _camera_start_evas_rendering(camera);
2275 LOGD("ret : 0x%x", ret);
2280 int camera_stop_preview(camera_h camera)
2282 int ret = CAMERA_ERROR_NONE;
2284 camera_cli_s *pc = NULL;
2285 muse_camera_api_e api = MUSE_CAMERA_API_STOP_PREVIEW;
2287 if (camera == NULL) {
2288 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2289 return CAMERA_ERROR_INVALID_PARAMETER;
2292 pc = (camera_cli_s *)camera;
2294 if (pc->cb_info == NULL) {
2295 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2296 return CAMERA_ERROR_INVALID_PARAMETER;
2299 sock_fd = pc->cb_info->fd;
2303 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
2304 camera_state_e current_state = CAMERA_STATE_NONE;
2306 ret = camera_get_state(camera, ¤t_state);
2307 if (ret != CAMERA_ERROR_NONE) {
2308 LOGE("failed to get current state 0x%x", ret);
2312 if (current_state == CAMERA_STATE_PREVIEW) {
2313 ret = _camera_stop_evas_rendering(camera, false);
2314 if (ret != CAMERA_ERROR_NONE)
2319 /* send stop preview message */
2320 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2322 LOGD("ret : 0x%x", ret);
2327 int camera_start_capture(camera_h camera, camera_capturing_cb capturing_cb, camera_capture_completed_cb completed_cb, void *user_data)
2329 if (camera == NULL) {
2330 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2331 return CAMERA_ERROR_INVALID_PARAMETER;
2333 int ret = CAMERA_ERROR_NONE;
2335 camera_cli_s *pc = (camera_cli_s *)camera;
2336 muse_camera_api_e api = MUSE_CAMERA_API_START_CAPTURE;
2338 int is_capturing_cb = 0;
2339 int is_completed_cb = 0;
2340 LOGD("Enter, handle :%x", pc->remote_handle);
2342 if (pc->cb_info == NULL) {
2343 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2344 return CAMERA_ERROR_INVALID_PARAMETER;
2347 sock_fd = pc->cb_info->fd;
2349 if (capturing_cb != NULL) {
2350 is_capturing_cb = 1;
2351 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = capturing_cb;
2352 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = user_data;
2355 if (completed_cb != NULL) {
2356 is_completed_cb = 1;
2357 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = completed_cb;
2358 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = user_data;
2361 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, is_capturing_cb, INT, is_completed_cb);
2362 LOGD("is_capturing_cb :%d, is_completed_cb : %d", is_capturing_cb, is_completed_cb);
2363 LOGD("ret : 0x%x", ret);
2367 bool camera_is_supported_continuous_capture(camera_h camera)
2369 if (camera == NULL) {
2370 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2374 int ret = CAMERA_ERROR_NONE;
2375 camera_cli_s *pc = (camera_cli_s *)camera;
2376 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_CONTINUOUS_CAPTURE;
2379 if (pc->cb_info == NULL) {
2380 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2381 return CAMERA_ERROR_INVALID_PARAMETER;
2384 sock_fd = pc->cb_info->fd;
2386 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2387 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2388 LOGD("ret : 0x%x", ret);
2392 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)
2394 if (camera == NULL) {
2395 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2396 return CAMERA_ERROR_INVALID_PARAMETER;
2399 int ret = CAMERA_ERROR_NONE;
2401 camera_cli_s *pc = (camera_cli_s *)camera;
2402 muse_camera_api_e api = MUSE_CAMERA_API_START_CONTINUOUS_CAPTURE;
2404 LOGD("Enter, handle :%x", pc->remote_handle);
2407 if (pc->cb_info == NULL) {
2408 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2409 return CAMERA_ERROR_INVALID_PARAMETER;
2411 sock_fd = pc->cb_info->fd;
2413 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = capturing_cb;
2414 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = user_data;
2415 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = completed_cb;
2417 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, count, INT, interval);
2419 LOGD("ret : 0x%x", ret);
2424 int camera_stop_continuous_capture(camera_h camera)
2426 if (camera == NULL) {
2427 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2428 return CAMERA_ERROR_INVALID_PARAMETER;
2432 int ret = CAMERA_ERROR_NONE;
2434 camera_cli_s *pc = (camera_cli_s *)camera;
2435 muse_camera_api_e api = MUSE_CAMERA_API_STOP_CONTINUOUS_CAPTURE;
2436 LOGD("Enter, handle :%x", pc->remote_handle);
2438 if (pc->cb_info == NULL) {
2439 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2440 return CAMERA_ERROR_INVALID_PARAMETER;
2442 sock_fd = pc->cb_info->fd;
2443 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2444 LOGD("ret : 0x%x", ret);
2448 bool camera_is_supported_face_detection(camera_h camera)
2450 if (camera == NULL) {
2451 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2454 int ret = CAMERA_ERROR_NONE;
2456 camera_cli_s *pc = (camera_cli_s *)camera;
2457 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_FACE_DETECTION;
2459 if (pc->cb_info == NULL) {
2460 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2461 return CAMERA_ERROR_INVALID_PARAMETER;
2463 sock_fd = pc->cb_info->fd;
2465 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2466 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2467 LOGD("ret : 0x%x", ret);
2471 bool camera_is_supported_zero_shutter_lag(camera_h camera)
2473 if (camera == NULL) {
2474 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2477 int ret = CAMERA_ERROR_NONE;
2479 camera_cli_s *pc = (camera_cli_s *)camera;
2480 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_ZERO_SHUTTER_LAG;
2482 if (pc->cb_info == NULL) {
2483 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2484 return CAMERA_ERROR_INVALID_PARAMETER;
2486 sock_fd = pc->cb_info->fd;
2488 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2489 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2490 LOGD("ret : 0x%x", ret);
2494 bool camera_is_supported_media_packet_preview_cb(camera_h camera)
2496 if (camera == NULL) {
2497 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2501 int ret = CAMERA_ERROR_NONE;
2503 camera_cli_s *pc = (camera_cli_s *)camera;
2504 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_MEDIA_PACKET_PREVIEW_CB;
2506 if (pc->cb_info == NULL) {
2507 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2508 return CAMERA_ERROR_INVALID_PARAMETER;
2510 sock_fd = pc->cb_info->fd;
2512 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2513 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2514 LOGD("ret : 0x%x", ret);
2518 int camera_get_device_count(camera_h camera, int *device_count)
2520 if (camera == NULL || device_count == NULL) {
2521 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2522 return CAMERA_ERROR_INVALID_PARAMETER;
2524 int ret = CAMERA_ERROR_NONE;
2526 camera_cli_s *pc = (camera_cli_s *)camera;
2527 muse_camera_api_e api = MUSE_CAMERA_API_GET_DEVICE_COUNT;
2529 if (pc->cb_info == NULL) {
2530 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2531 return CAMERA_ERROR_INVALID_PARAMETER;
2533 sock_fd = pc->cb_info->fd;
2534 int get_device_count;
2536 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2537 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2539 if (ret == CAMERA_ERROR_NONE) {
2540 muse_camera_msg_get(get_device_count, pc->cb_info->recv_msg);
2541 *device_count = get_device_count;
2543 LOGD("ret : 0x%x", ret);
2547 int camera_start_face_detection(camera_h camera, camera_face_detected_cb callback, void *user_data)
2549 if (camera == NULL) {
2550 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2551 return CAMERA_ERROR_INVALID_PARAMETER;
2554 int ret = CAMERA_ERROR_NONE;
2556 camera_cli_s *pc = (camera_cli_s *)camera;
2557 muse_camera_api_e api = MUSE_CAMERA_API_START_FACE_DETECTION;
2559 LOGD("Enter, handle :%x", pc->remote_handle);
2561 if (pc->cb_info == NULL) {
2562 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2563 return CAMERA_ERROR_INVALID_PARAMETER;
2565 sock_fd = pc->cb_info->fd;
2566 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION] = callback;
2567 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION] = user_data;
2569 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2570 LOGD("ret : 0x%x", ret);
2574 int camera_stop_face_detection(camera_h camera)
2576 if (camera == NULL) {
2577 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2578 return CAMERA_ERROR_INVALID_PARAMETER;
2581 int ret = CAMERA_ERROR_NONE;
2583 camera_cli_s *pc = (camera_cli_s *)camera;
2584 muse_camera_api_e api = MUSE_CAMERA_API_STOP_FACE_DETECTION;
2585 LOGD("Enter, handle :%x", pc->remote_handle);
2587 if (pc->cb_info == NULL) {
2588 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2589 return CAMERA_ERROR_INVALID_PARAMETER;
2591 sock_fd = pc->cb_info->fd;
2592 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2593 LOGD("ret : 0x%x", ret);
2597 int camera_get_state(camera_h camera, camera_state_e *state)
2599 if (camera == NULL || state == NULL) {
2600 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2601 return CAMERA_ERROR_INVALID_PARAMETER;
2603 int ret = CAMERA_ERROR_NONE;
2605 camera_cli_s *pc = (camera_cli_s *)camera;
2606 muse_camera_api_e api = MUSE_CAMERA_API_GET_STATE;
2608 if (pc->cb_info == NULL) {
2609 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2610 return CAMERA_ERROR_INVALID_PARAMETER;
2612 sock_fd = pc->cb_info->fd;
2615 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2616 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2618 if (ret == CAMERA_ERROR_NONE) {
2619 muse_camera_msg_get(get_state, pc->cb_info->recv_msg);
2620 *state = (camera_state_e)get_state;
2622 LOGD("ret : 0x%x", ret);
2626 int camera_start_focusing(camera_h camera, bool continuous)
2628 if (camera == NULL) {
2629 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2630 return CAMERA_ERROR_INVALID_PARAMETER;
2633 int ret = CAMERA_ERROR_NONE;
2635 camera_cli_s *pc = (camera_cli_s *)camera;
2636 muse_camera_api_e api = MUSE_CAMERA_API_START_FOCUSING;
2638 if (pc->cb_info == NULL) {
2639 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2640 return CAMERA_ERROR_INVALID_PARAMETER;
2642 sock_fd = pc->cb_info->fd;
2643 int is_continuous = (int)continuous;
2645 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2646 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, is_continuous);
2647 LOGD("ret : 0x%x", ret);
2651 int camera_cancel_focusing(camera_h camera)
2653 if (camera == NULL) {
2654 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2655 return CAMERA_ERROR_INVALID_PARAMETER;
2658 int ret = CAMERA_ERROR_NONE;
2660 camera_cli_s *pc = (camera_cli_s *)camera;
2661 muse_camera_api_e api = MUSE_CAMERA_API_CANCEL_FOCUSING;
2663 if (pc->cb_info == NULL) {
2664 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2665 return CAMERA_ERROR_INVALID_PARAMETER;
2667 sock_fd = pc->cb_info->fd;
2669 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2670 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2671 LOGD("ret : 0x%x", ret);
2675 int camera_set_display(camera_h camera, camera_display_type_e type, camera_display_h display)
2677 int ret = CAMERA_ERROR_NONE;
2678 void *set_display_handle = NULL;
2679 Evas_Object *obj = NULL;
2680 const char *object_type = NULL;
2681 camera_wl_info_s *wl_info = NULL;
2682 camera_cli_s *pc = (camera_cli_s *)camera;
2683 camera_cb_info_s *cb_info = NULL;
2684 muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY;
2685 camera_state_e current_state = CAMERA_STATE_NONE;
2688 if (camera == NULL) {
2689 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2690 return CAMERA_ERROR_INVALID_PARAMETER;
2693 if (type < CAMERA_DISPLAY_TYPE_OVERLAY || type > CAMERA_DISPLAY_TYPE_NONE) {
2694 LOGE("invalid type %d", type);
2695 return CAMERA_ERROR_INVALID_PARAMETER;
2698 if (type != CAMERA_DISPLAY_TYPE_NONE && display == NULL) {
2699 LOGE("display type[%d] is not NONE, but display handle is NULL", type);
2700 return CAMERA_ERROR_INVALID_PARAMETER;
2703 if (pc->cb_info == NULL) {
2704 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2705 return CAMERA_ERROR_INVALID_PARAMETER;
2708 cb_info = (camera_cb_info_s *)pc->cb_info;
2709 sock_fd = cb_info->fd;
2711 ret = camera_get_state(camera, ¤t_state);
2712 if (ret != CAMERA_ERROR_NONE) {
2713 LOGE("failed to get current state 0x%x", ret);
2717 if (current_state != CAMERA_STATE_CREATED) {
2718 LOGE("INVALID_STATE : current %d", current_state);
2719 return CAMERA_ERROR_INVALID_STATE;
2722 LOGD("Enter, remote_handle : %x display : 0x%x", pc->remote_handle, display);
2724 if (type == CAMERA_DISPLAY_TYPE_NONE) {
2725 set_display_handle = 0;
2726 LOGD("display type NONE");
2728 obj = (Evas_Object *)display;
2729 object_type = evas_object_type_get(obj);
2731 if (type == CAMERA_DISPLAY_TYPE_OVERLAY && !strcmp(object_type, "elm_win")) {
2732 /* get wayland parent id */
2733 if (_get_wl_info(obj, &pc->wl_info) != CAMERA_ERROR_NONE) {
2734 LOGE("failed to get wayland info");
2735 return CAMERA_ERROR_INVALID_OPERATION;
2738 set_display_handle = (void *)&pc->wl_info;
2739 LOGD("display type OVERLAY : handle %p", set_display_handle);
2740 } else if (type == CAMERA_DISPLAY_TYPE_EVAS && !strcmp(object_type, "image")) {
2741 /* evas object surface */
2742 set_display_handle = (void *)display;
2743 LOGD("display type EVAS : handle %p", set_display_handle);
2745 #ifdef TIZEN_FEATURE_EVAS_RENDERER
2746 g_mutex_lock(&cb_info->evas_mutex);
2748 if (cb_info->evas_info) {
2749 LOGW("destroy existed evas renderer %p", cb_info->evas_info);
2750 ret = mm_evas_renderer_destroy(&cb_info->evas_info);
2751 if (ret != MM_ERROR_NONE) {
2752 LOGE("failed to destroy evas renderer %p", cb_info->evas_info);
2753 g_mutex_unlock(&cb_info->evas_mutex);
2754 return CAMERA_ERROR_INVALID_OPERATION;
2758 /* create evas renderer */
2759 ret = mm_evas_renderer_create(&cb_info->evas_info, (Evas_Object *)set_display_handle);
2760 if (ret == MM_ERROR_NONE) {
2761 camera_flip_e flip = CAMERA_FLIP_NONE;
2762 camera_display_mode_e mode = CAMERA_DISPLAY_MODE_LETTER_BOX;
2763 camera_rotation_e rotation = CAMERA_ROTATION_NONE;
2770 camera_get_display_flip(camera, &flip);
2771 camera_get_display_mode(camera, &mode);
2772 camera_get_display_rotation(camera, &rotation);
2773 camera_is_display_visible(camera, &visible);
2774 camera_attr_get_display_roi_area(camera, &x, &y, &width, &height);
2776 LOGD("current setting : flip %d, mode %d, rotation %d, visible %d, roi %d,%d,%dx%d",
2777 flip, mode, rotation, visible, x, y, width, height);
2779 ret = mm_evas_renderer_set_flip(cb_info->evas_info, flip);
2780 ret |= mm_evas_renderer_set_geometry(cb_info->evas_info, mode);
2781 ret |= mm_evas_renderer_set_rotation(cb_info->evas_info, rotation);
2782 ret |= mm_evas_renderer_set_visible(cb_info->evas_info, visible);
2784 if (mode == CAMERA_DISPLAY_MODE_CUSTOM_ROI)
2785 ret |= mm_evas_renderer_set_roi_area(cb_info->evas_info, x, y, width, height);
2788 g_mutex_unlock(&cb_info->evas_mutex);
2790 if (ret != MM_ERROR_NONE) {
2791 LOGE("mm_evas_renderer error 0x%x", ret);
2792 return CAMERA_ERROR_INVALID_OPERATION;
2794 #else /* TIZEN_FEATURE_EVAS_RENDERER */
2795 LOGE("EVAS surface is not supported");
2796 return CAMERA_ERROR_NOT_SUPPORTED;
2797 #endif /* TIZEN_FEATURE_EVAS_RENDERER */
2799 LOGE("unknown evas object [%p,%s] or type [%d] mismatch", obj, object_type, type);
2800 return CAMERA_ERROR_INVALID_PARAMETER;
2803 LOGE("failed to get evas object type from %p", obj);
2804 return CAMERA_ERROR_INVALID_PARAMETER;
2808 pc->display_handle = (intptr_t)set_display_handle;
2810 if (type == CAMERA_DISPLAY_TYPE_OVERLAY) {
2811 wl_info = &pc->wl_info;
2812 muse_camera_msg_send_array_and_value(api, sock_fd, cb_info, ret,
2813 wl_info, sizeof(camera_wl_info_s), sizeof(int), INT, type);
2815 LOGD("wayland parent id : %d, window %d,%d,%dx%d",
2816 wl_info->parent_id, wl_info->window_x, wl_info->window_y,
2817 wl_info->window_width, wl_info->window_height);
2819 muse_camera_msg_send1(api, sock_fd, cb_info, ret, INT, type);
2821 if (ret != CAMERA_ERROR_NONE)
2822 LOGE("set display error 0x%x", ret);
2823 else if (type == CAMERA_DISPLAY_TYPE_EVAS)
2824 SET_PREVIEW_CB_TYPE(cb_info, PREVIEW_CB_TYPE_EVAS);
2829 int camera_set_preview_resolution(camera_h camera, int width, int height)
2831 if (camera == NULL) {
2832 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2833 return CAMERA_ERROR_INVALID_PARAMETER;
2835 int ret = CAMERA_ERROR_NONE;
2837 camera_cli_s *pc = (camera_cli_s *)camera;
2838 muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_RESOLUTION;
2840 if (pc->cb_info == NULL) {
2841 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2842 return CAMERA_ERROR_INVALID_PARAMETER;
2844 sock_fd = pc->cb_info->fd;
2846 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2847 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, width, INT, height);
2848 LOGD("ret : 0x%x", ret);
2853 int camera_set_capture_resolution(camera_h camera, int width, int height)
2855 if (camera == NULL) {
2856 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2857 return CAMERA_ERROR_INVALID_PARAMETER;
2860 int ret = CAMERA_ERROR_NONE;
2862 camera_cli_s *pc = (camera_cli_s *)camera;
2863 muse_camera_api_e api = MUSE_CAMERA_API_SET_CAPTURE_RESOLUTION;
2865 if (pc->cb_info == NULL) {
2866 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2867 return CAMERA_ERROR_INVALID_PARAMETER;
2869 sock_fd = pc->cb_info->fd;
2871 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2872 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, width, INT, height);
2873 LOGD("ret : 0x%x", ret);
2877 int camera_set_capture_format(camera_h camera, camera_pixel_format_e format)
2879 if (camera == NULL) {
2880 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2881 return CAMERA_ERROR_INVALID_PARAMETER;
2884 int ret = CAMERA_ERROR_NONE;
2885 int set_format = (int)format;
2887 camera_cli_s *pc = (camera_cli_s *)camera;
2888 muse_camera_api_e api = MUSE_CAMERA_API_SET_CAPTURE_FORMAT;
2890 if (pc->cb_info == NULL) {
2891 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2892 return CAMERA_ERROR_INVALID_PARAMETER;
2894 sock_fd = pc->cb_info->fd;
2896 LOGD("Enter, remote_handle : %x, capture_format: %d", pc->remote_handle, set_format);
2897 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_format);
2898 LOGD("ret : 0x%x", ret);
2902 int camera_set_preview_format(camera_h camera, camera_pixel_format_e format)
2904 if (camera == NULL) {
2905 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2906 return CAMERA_ERROR_INVALID_PARAMETER;
2909 int ret = CAMERA_ERROR_NONE;
2910 int set_format = (int)format;
2912 camera_cli_s *pc = (camera_cli_s *)camera;
2913 muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_FORMAT;
2915 if (pc->cb_info == NULL) {
2916 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2917 return CAMERA_ERROR_INVALID_PARAMETER;
2919 sock_fd = pc->cb_info->fd;
2921 LOGD("Enter, remote_handle : %x, capture_format: %d", pc->remote_handle, set_format);
2922 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_format);
2923 LOGD("ret : 0x%x", ret);
2927 int camera_get_preview_resolution(camera_h camera, int *width, int *height)
2929 if (camera == NULL || width == NULL || height == NULL) {
2930 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2931 return CAMERA_ERROR_INVALID_PARAMETER;
2935 int ret = CAMERA_ERROR_NONE;
2937 camera_cli_s *pc = (camera_cli_s *)camera;
2938 muse_camera_api_e api = MUSE_CAMERA_API_GET_PREVIEW_RESOLUTION;
2940 if (pc->cb_info == NULL) {
2941 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2942 return CAMERA_ERROR_INVALID_PARAMETER;
2944 sock_fd = pc->cb_info->fd;
2948 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2949 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2951 if (ret == CAMERA_ERROR_NONE) {
2952 muse_camera_msg_get(get_width, pc->cb_info->recv_msg);
2953 muse_camera_msg_get(get_height, pc->cb_info->recv_msg);
2955 *height = get_height;
2957 LOGD("ret : 0x%x", ret);
2961 int camera_set_display_rotation(camera_h camera, camera_rotation_e rotation)
2963 int ret = CAMERA_ERROR_NONE;
2964 int set_rotation = (int)rotation;
2965 camera_cli_s *pc = NULL;
2967 if (camera == NULL) {
2968 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2969 return CAMERA_ERROR_INVALID_PARAMETER;
2972 if (rotation < CAMERA_ROTATION_NONE || rotation > CAMERA_ROTATION_270) {
2973 LOGE("Invalid rotation %d", rotation);
2974 return CAMERA_ERROR_INVALID_PARAMETER;
2977 pc = (camera_cli_s *)camera;
2979 if (pc->cb_info == NULL) {
2980 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2981 return CAMERA_ERROR_INVALID_PARAMETER;
2984 #ifdef TIZEN_FEATURE_EVAS_RENDERER
2985 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
2986 g_mutex_lock(&pc->cb_info->evas_mutex);
2988 ret = mm_evas_renderer_set_rotation(pc->cb_info->evas_info, rotation);
2990 g_mutex_unlock(&pc->cb_info->evas_mutex);
2992 if (ret != MM_ERROR_NONE) {
2993 LOGE("failed to set rotation for evas surface 0x%x", ret);
2994 return CAMERA_ERROR_INVALID_OPERATION;
2997 #endif /* TIZEN_FEATURE_EVAS_RENDERER */
2999 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_ROTATION,
3000 pc->cb_info->fd, pc->cb_info, ret, INT, set_rotation);
3005 int camera_get_display_rotation(camera_h camera, camera_rotation_e *rotation)
3007 int ret = CAMERA_ERROR_NONE;
3008 int get_rotation = CAMERA_ROTATION_NONE;
3009 camera_cli_s *pc = NULL;
3011 if (camera == NULL || rotation == NULL) {
3012 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3013 return CAMERA_ERROR_INVALID_PARAMETER;
3016 pc = (camera_cli_s *)camera;
3018 if (pc->cb_info == NULL) {
3019 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3020 return CAMERA_ERROR_INVALID_PARAMETER;
3023 muse_camera_msg_send(MUSE_CAMERA_API_GET_DISPLAY_ROTATION,
3024 pc->cb_info->fd, pc->cb_info, ret);
3026 if (ret == CAMERA_ERROR_NONE) {
3027 muse_camera_msg_get(get_rotation, pc->cb_info->recv_msg);
3028 *rotation = (camera_rotation_e)get_rotation;
3034 int camera_set_display_flip(camera_h camera, camera_flip_e flip)
3036 int ret = CAMERA_ERROR_NONE;
3037 int set_flip = (int)flip;
3038 camera_cli_s *pc = NULL;
3040 if (camera == NULL) {
3041 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3042 return CAMERA_ERROR_INVALID_PARAMETER;
3045 if (flip < CAMERA_FLIP_NONE || flip > CAMERA_FLIP_BOTH) {
3046 LOGE("Invalid flip %d", flip);
3047 return CAMERA_ERROR_INVALID_PARAMETER;
3050 pc = (camera_cli_s *)camera;
3052 if (pc->cb_info == NULL) {
3053 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3054 return CAMERA_ERROR_INVALID_PARAMETER;
3057 #ifdef TIZEN_FEATURE_EVAS_RENDERER
3058 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
3059 g_mutex_lock(&pc->cb_info->evas_mutex);
3061 ret = mm_evas_renderer_set_flip(pc->cb_info->evas_info, flip);
3063 g_mutex_unlock(&pc->cb_info->evas_mutex);
3065 if (ret != MM_ERROR_NONE) {
3066 LOGE("failed to set flip for evas surface 0x%x", ret);
3067 return CAMERA_ERROR_INVALID_OPERATION;
3070 #endif /* TIZEN_FEATURE_EVAS_RENDERER */
3072 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_FLIP,
3073 pc->cb_info->fd, pc->cb_info, ret, INT, set_flip);
3078 int camera_get_display_flip(camera_h camera, camera_flip_e *flip)
3080 int ret = CAMERA_ERROR_NONE;
3081 int get_flip = CAMERA_FLIP_NONE;
3082 camera_cli_s *pc = NULL;
3084 if (camera == NULL || flip == NULL) {
3085 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3086 return CAMERA_ERROR_INVALID_PARAMETER;
3089 pc = (camera_cli_s *)camera;
3091 if (pc->cb_info == NULL) {
3092 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3093 return CAMERA_ERROR_INVALID_PARAMETER;
3096 muse_camera_msg_send(MUSE_CAMERA_API_GET_DISPLAY_FLIP,
3097 pc->cb_info->fd, pc->cb_info, ret);
3099 if (ret == CAMERA_ERROR_NONE) {
3100 muse_camera_msg_get(get_flip, pc->cb_info->recv_msg);
3101 *flip = (camera_flip_e)get_flip;
3107 int camera_set_display_visible(camera_h camera, bool visible)
3109 int ret = CAMERA_ERROR_NONE;
3110 int set_visible = (int)visible;
3111 camera_cli_s *pc = NULL;
3113 if (camera == NULL) {
3114 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3115 return CAMERA_ERROR_INVALID_PARAMETER;
3118 pc = (camera_cli_s *)camera;
3120 if (pc->cb_info == NULL) {
3121 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3122 return CAMERA_ERROR_INVALID_PARAMETER;
3125 #ifdef TIZEN_FEATURE_EVAS_RENDERER
3126 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
3127 g_mutex_lock(&pc->cb_info->evas_mutex);
3129 ret = mm_evas_renderer_set_visible(pc->cb_info->evas_info, visible);
3131 g_mutex_unlock(&pc->cb_info->evas_mutex);
3133 if (ret != MM_ERROR_NONE) {
3134 LOGE("failed to set visible for evas surface 0x%x", ret);
3135 return CAMERA_ERROR_INVALID_OPERATION;
3138 #endif /* TIZEN_FEATURE_EVAS_RENDERER */
3140 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_VISIBLE,
3141 pc->cb_info->fd, pc->cb_info, ret, INT, set_visible);
3146 int camera_is_display_visible(camera_h camera, bool *visible)
3148 int ret = CAMERA_ERROR_NONE;
3149 int get_visible = true;
3150 camera_cli_s *pc = NULL;
3152 if (camera == NULL || visible == NULL) {
3153 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3154 return CAMERA_ERROR_INVALID_PARAMETER;
3157 pc = (camera_cli_s *)camera;
3159 if (pc->cb_info == NULL) {
3160 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3161 return CAMERA_ERROR_INVALID_PARAMETER;
3164 muse_camera_msg_send(MUSE_CAMERA_API_IS_DISPLAY_VISIBLE,
3165 pc->cb_info->fd, pc->cb_info, ret);
3167 if (ret == CAMERA_ERROR_NONE) {
3168 muse_camera_msg_get(get_visible, pc->cb_info->recv_msg);
3169 *visible = (bool)get_visible;
3175 int camera_set_display_mode(camera_h camera, camera_display_mode_e mode)
3177 int ret = CAMERA_ERROR_NONE;
3178 int set_mode = (int)mode;
3179 camera_cli_s *pc = NULL;
3181 if (camera == NULL) {
3182 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3183 return CAMERA_ERROR_INVALID_PARAMETER;
3186 if (mode < CAMERA_DISPLAY_MODE_LETTER_BOX || mode > CAMERA_DISPLAY_MODE_CUSTOM_ROI) {
3187 LOGE("Invalid mode %d", mode);
3188 return CAMERA_ERROR_INVALID_PARAMETER;
3191 pc = (camera_cli_s *)camera;
3193 if (pc->cb_info == NULL) {
3194 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3195 return CAMERA_ERROR_INVALID_PARAMETER;
3198 #ifdef TIZEN_FEATURE_EVAS_RENDERER
3199 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
3200 g_mutex_lock(&pc->cb_info->evas_mutex);
3202 ret = mm_evas_renderer_set_geometry(pc->cb_info->evas_info, mode);
3204 g_mutex_unlock(&pc->cb_info->evas_mutex);
3206 if (ret != MM_ERROR_NONE) {
3207 LOGE("failed to set geometry for evas surface 0x%x", ret);
3208 return CAMERA_ERROR_INVALID_OPERATION;
3211 #endif /* TIZEN_FEATURE_EVAS_RENDERER */
3213 muse_camera_msg_send1(MUSE_CAMERA_API_SET_DISPLAY_MODE,
3214 pc->cb_info->fd, pc->cb_info, ret, INT, set_mode);
3219 int camera_get_display_mode(camera_h camera, camera_display_mode_e *mode)
3221 int ret = CAMERA_ERROR_NONE;
3222 int get_mode = CAMERA_DISPLAY_MODE_LETTER_BOX;
3223 camera_cli_s *pc = NULL;
3225 if (camera == NULL || mode == NULL) {
3226 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3227 return CAMERA_ERROR_INVALID_PARAMETER;
3230 pc = (camera_cli_s *)camera;
3232 if (pc->cb_info == NULL) {
3233 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3234 return CAMERA_ERROR_INVALID_PARAMETER;
3237 muse_camera_msg_send(MUSE_CAMERA_API_GET_DISPLAY_MODE,
3238 pc->cb_info->fd, pc->cb_info, ret);
3240 if (ret == CAMERA_ERROR_NONE) {
3241 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
3242 *mode = (camera_display_mode_e)get_mode;
3248 int camera_get_capture_resolution(camera_h camera, int *width, int *height)
3250 if (camera == NULL || width == NULL || height == NULL) {
3251 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3252 return CAMERA_ERROR_INVALID_PARAMETER;
3254 int ret = CAMERA_ERROR_NONE;
3256 camera_cli_s *pc = (camera_cli_s *)camera;
3257 muse_camera_api_e api = MUSE_CAMERA_API_GET_CAPTURE_RESOLUTION;
3259 if (pc->cb_info == NULL) {
3260 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3261 return CAMERA_ERROR_INVALID_PARAMETER;
3263 sock_fd = pc->cb_info->fd;
3267 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3268 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3270 if (ret == CAMERA_ERROR_NONE) {
3271 muse_camera_msg_get(get_width, pc->cb_info->recv_msg);
3272 muse_camera_msg_get(get_height, pc->cb_info->recv_msg);
3274 *height = get_height;
3276 LOGD("ret : 0x%x", ret);
3280 int camera_get_capture_format(camera_h camera, camera_pixel_format_e *format)
3282 if (camera == NULL || format == NULL) {
3283 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3284 return CAMERA_ERROR_INVALID_PARAMETER;
3286 int ret = CAMERA_ERROR_NONE;
3288 camera_cli_s *pc = (camera_cli_s *)camera;
3289 muse_camera_api_e api = MUSE_CAMERA_API_GET_CAPTURE_FORMAT;
3292 if (pc->cb_info == NULL) {
3293 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3294 return CAMERA_ERROR_INVALID_PARAMETER;
3296 sock_fd = pc->cb_info->fd;
3298 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3299 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3301 if (ret == CAMERA_ERROR_NONE) {
3302 muse_camera_msg_get(get_format, pc->cb_info->recv_msg);
3303 *format = (camera_pixel_format_e)get_format;
3305 LOGD("ret : 0x%x", ret);
3309 int camera_get_preview_format(camera_h camera, camera_pixel_format_e *format)
3311 if (camera == NULL || format == NULL) {
3312 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3313 return CAMERA_ERROR_INVALID_PARAMETER;
3316 int ret = CAMERA_ERROR_NONE;
3318 camera_cli_s *pc = (camera_cli_s *)camera;
3319 muse_camera_api_e api = MUSE_CAMERA_API_GET_PREVIEW_FORMAT;
3322 if (pc->cb_info == NULL) {
3323 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3324 return CAMERA_ERROR_INVALID_PARAMETER;
3326 sock_fd = pc->cb_info->fd;
3328 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3329 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3331 if (ret == CAMERA_ERROR_NONE) {
3332 muse_camera_msg_get(get_format, pc->cb_info->recv_msg);
3333 *format = (camera_pixel_format_e)get_format;
3335 LOGD("ret : 0x%x", ret);
3339 int camera_get_facing_direction(camera_h camera, camera_facing_direction_e *facing_direciton)
3341 if (camera == NULL || facing_direciton == NULL) {
3342 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3343 return CAMERA_ERROR_INVALID_PARAMETER;
3346 int ret = CAMERA_ERROR_NONE;
3348 camera_cli_s *pc = (camera_cli_s *)camera;
3349 muse_camera_api_e api = MUSE_CAMERA_API_GET_FACING_DIRECTION;
3351 if (pc->cb_info == NULL) {
3352 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3353 return CAMERA_ERROR_INVALID_PARAMETER;
3355 sock_fd = pc->cb_info->fd;
3356 int get_facing_direction;
3358 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3359 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3361 if (ret == CAMERA_ERROR_NONE) {
3362 muse_camera_msg_get(get_facing_direction, pc->cb_info->recv_msg);
3363 *facing_direciton = (camera_facing_direction_e)get_facing_direction;
3365 LOGD("ret : 0x%x", ret);
3369 int camera_set_preview_cb(camera_h camera, camera_preview_cb callback, void *user_data)
3371 if (camera == NULL || callback == NULL) {
3372 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3373 return CAMERA_ERROR_INVALID_PARAMETER;
3375 int ret = CAMERA_ERROR_NONE;
3377 camera_cli_s *pc = (camera_cli_s *)camera;
3378 camera_cb_info_s *cb_info = (camera_cb_info_s *)pc->cb_info;
3380 if (pc->cb_info == NULL) {
3381 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3382 return CAMERA_ERROR_INVALID_PARAMETER;
3384 sock_fd = pc->cb_info->fd;
3385 muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_CB;
3387 LOGD("Enter, handle :%x", pc->remote_handle);
3389 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = callback;
3390 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = user_data;
3391 SET_PREVIEW_CB_TYPE(cb_info, PREVIEW_CB_TYPE_USER);
3393 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3394 LOGD("ret : 0x%x", ret);
3398 int camera_unset_preview_cb(camera_h camera)
3400 if (camera == NULL) {
3401 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3402 return CAMERA_ERROR_INVALID_PARAMETER;
3405 int ret = CAMERA_ERROR_NONE;
3407 camera_cli_s *pc = (camera_cli_s *)camera;
3408 camera_cb_info_s *cb_info = (camera_cb_info_s *)pc->cb_info;
3409 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_PREVIEW_CB;
3411 LOGD("Enter, handle :%x", pc->remote_handle);
3414 if (pc->cb_info == NULL) {
3415 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3416 return CAMERA_ERROR_INVALID_PARAMETER;
3418 sock_fd = pc->cb_info->fd;
3419 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = (void *)NULL;
3420 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = (void *)NULL;
3421 UNSET_PREVIEW_CB_TYPE(cb_info, PREVIEW_CB_TYPE_USER);
3423 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3424 LOGD("ret : 0x%x", ret);
3428 int camera_set_media_packet_preview_cb(camera_h camera, camera_media_packet_preview_cb callback, void *user_data)
3430 if (camera == NULL) {
3431 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
3432 return CAMERA_ERROR_INVALID_PARAMETER;
3435 if (camera_is_supported_media_packet_preview_cb(camera) == false) {
3436 LOGE("NOT SUPPORTED");
3437 return CAMERA_ERROR_NOT_SUPPORTED;
3440 if (callback == NULL) {
3441 LOGE("INVALID_PARAMETER(0x%08x) - callback", CAMERA_ERROR_INVALID_PARAMETER);
3442 return CAMERA_ERROR_INVALID_PARAMETER;
3445 int ret = CAMERA_ERROR_NONE;
3447 camera_cli_s *pc = (camera_cli_s *)camera;
3448 muse_camera_api_e api = MUSE_CAMERA_API_SET_MEDIA_PACKET_PREVIEW_CB;
3450 LOGD("Enter, handle :%x", pc->remote_handle);
3453 if (pc->cb_info == NULL) {
3454 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3455 return CAMERA_ERROR_INVALID_PARAMETER;
3457 sock_fd = pc->cb_info->fd;
3458 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = callback;
3459 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = user_data;
3461 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3462 LOGD("ret : 0x%x", ret);
3466 int camera_unset_media_packet_preview_cb(camera_h camera)
3468 if (camera == NULL) {
3469 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3470 return CAMERA_ERROR_INVALID_PARAMETER;
3473 int ret = CAMERA_ERROR_NONE;
3475 camera_cli_s *pc = (camera_cli_s *)camera;
3476 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_MEDIA_PACKET_PREVIEW_CB;
3478 LOGD("Enter, handle :%x", pc->remote_handle);
3481 if (pc->cb_info == NULL) {
3482 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3483 return CAMERA_ERROR_INVALID_PARAMETER;
3485 sock_fd = pc->cb_info->fd;
3486 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = (void *)NULL;
3487 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = (void *)NULL;
3489 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3490 LOGD("ret : 0x%x", ret);
3494 int camera_set_state_changed_cb(camera_h camera, camera_state_changed_cb callback, void *user_data)
3496 if (camera == NULL || callback == NULL) {
3497 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3498 return CAMERA_ERROR_INVALID_PARAMETER;
3500 int ret = CAMERA_ERROR_NONE;
3502 camera_cli_s *pc = (camera_cli_s *)camera;
3503 muse_camera_api_e api = MUSE_CAMERA_API_SET_STATE_CHANGED_CB;
3505 LOGD("Enter, handle :%x", pc->remote_handle);
3508 if (pc->cb_info == NULL) {
3509 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3510 return CAMERA_ERROR_INVALID_PARAMETER;
3512 sock_fd = pc->cb_info->fd;
3513 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = callback;
3514 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = user_data;
3516 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3517 LOGD("ret : 0x%x", ret);
3520 int camera_unset_state_changed_cb(camera_h camera)
3522 if (camera == NULL) {
3523 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3524 return CAMERA_ERROR_INVALID_PARAMETER;
3526 int ret = CAMERA_ERROR_NONE;
3528 camera_cli_s *pc = (camera_cli_s *)camera;
3529 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_STATE_CHANGED_CB;
3531 LOGD("Enter, handle :%x", pc->remote_handle);
3534 if (pc->cb_info == NULL) {
3535 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3536 return CAMERA_ERROR_INVALID_PARAMETER;
3538 sock_fd = pc->cb_info->fd;
3539 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = (void *)NULL;
3540 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = (void *)NULL;
3542 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3543 LOGD("ret : 0x%x", ret);
3547 int camera_set_interrupted_cb(camera_h camera, camera_interrupted_cb callback, void *user_data)
3549 if (camera == NULL || callback == NULL) {
3550 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3551 return CAMERA_ERROR_INVALID_PARAMETER;
3553 int ret = CAMERA_ERROR_NONE;
3555 camera_cli_s *pc = (camera_cli_s *)camera;
3556 muse_camera_api_e api = MUSE_CAMERA_API_SET_INTERRUPTED_CB;
3558 LOGD("Enter, handle :%x", pc->remote_handle);
3561 if (pc->cb_info == NULL) {
3562 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3563 return CAMERA_ERROR_INVALID_PARAMETER;
3565 sock_fd = pc->cb_info->fd;
3566 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = callback;
3567 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = user_data;
3569 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3570 LOGD("ret : 0x%x", ret);
3574 int camera_unset_interrupted_cb(camera_h camera)
3576 if (camera == NULL) {
3577 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3578 return CAMERA_ERROR_INVALID_PARAMETER;
3580 int ret = CAMERA_ERROR_NONE;
3582 camera_cli_s *pc = (camera_cli_s *)camera;
3583 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_INTERRUPTED_CB;
3585 LOGD("Enter, handle :%x", pc->remote_handle);
3588 if (pc->cb_info == NULL) {
3589 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3590 return CAMERA_ERROR_INVALID_PARAMETER;
3592 sock_fd = pc->cb_info->fd;
3593 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = (void *)NULL;
3594 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = (void *)NULL;
3596 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3597 LOGD("ret : 0x%x", ret);
3601 int camera_set_focus_changed_cb(camera_h camera, camera_focus_changed_cb callback, void *user_data)
3603 if (camera == NULL || callback == NULL) {
3604 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3605 return CAMERA_ERROR_INVALID_PARAMETER;
3607 int ret = CAMERA_ERROR_NONE;
3609 camera_cli_s *pc = (camera_cli_s *)camera;
3610 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOCUS_CHANGED_CB;
3612 LOGD("Enter, handle :%x", pc->remote_handle);
3615 if (pc->cb_info == NULL) {
3616 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3617 return CAMERA_ERROR_INVALID_PARAMETER;
3619 sock_fd = pc->cb_info->fd;
3620 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = callback;
3621 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = user_data;
3623 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3624 LOGD("ret : 0x%x", ret);
3628 int camera_unset_focus_changed_cb(camera_h camera)
3630 if (camera == NULL) {
3631 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3632 return CAMERA_ERROR_INVALID_PARAMETER;
3634 int ret = CAMERA_ERROR_NONE;
3636 camera_cli_s *pc = (camera_cli_s *)camera;
3637 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_FOCUS_CHANGED_CB;
3639 LOGD("Enter, handle :%x", pc->remote_handle);
3642 if (pc->cb_info == NULL) {
3643 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3644 return CAMERA_ERROR_INVALID_PARAMETER;
3646 sock_fd = pc->cb_info->fd;
3647 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = (void *)NULL;
3648 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = (void *)NULL;
3650 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3651 LOGD("ret : 0x%x", ret);
3655 int camera_set_error_cb(camera_h camera, camera_error_cb callback, void *user_data)
3657 if (camera == NULL || callback == NULL) {
3658 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3659 return CAMERA_ERROR_INVALID_PARAMETER;
3661 int ret = CAMERA_ERROR_NONE;
3663 camera_cli_s *pc = (camera_cli_s *)camera;
3664 muse_camera_api_e api = MUSE_CAMERA_API_SET_ERROR_CB;
3666 LOGD("Enter, handle :%x", pc->remote_handle);
3669 if (pc->cb_info == NULL) {
3670 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3671 return CAMERA_ERROR_INVALID_PARAMETER;
3673 sock_fd = pc->cb_info->fd;
3674 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_ERROR] = callback;
3675 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_ERROR] = user_data;
3677 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3678 LOGD("ret : 0x%x", ret);
3682 int camera_unset_error_cb(camera_h camera)
3684 if (camera == NULL) {
3685 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3686 return CAMERA_ERROR_INVALID_PARAMETER;
3688 int ret = CAMERA_ERROR_NONE;
3690 camera_cli_s *pc = (camera_cli_s *)camera;
3691 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_ERROR_CB;
3693 LOGD("Enter, handle :%x", pc->remote_handle);
3696 if (pc->cb_info == NULL) {
3697 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3698 return CAMERA_ERROR_INVALID_PARAMETER;
3700 sock_fd = pc->cb_info->fd;
3701 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_ERROR] = (void *)NULL;
3702 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_ERROR] = (void *)NULL;
3704 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3705 LOGD("ret : 0x%x", ret);
3709 int camera_foreach_supported_preview_resolution(camera_h camera, camera_supported_preview_resolution_cb foreach_cb , void *user_data)
3711 if (camera == NULL || foreach_cb == NULL) {
3712 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3713 return CAMERA_ERROR_INVALID_PARAMETER;
3715 int ret = CAMERA_ERROR_NONE;
3717 camera_cli_s *pc = (camera_cli_s *)camera;
3718 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_PREVIEW_RESOLUTION;
3720 LOGD("Enter, handle :%x", pc->remote_handle);
3723 if (pc->cb_info == NULL) {
3724 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3725 return CAMERA_ERROR_INVALID_PARAMETER;
3727 sock_fd = pc->cb_info->fd;
3728 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_RESOLUTION] = foreach_cb;
3729 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_RESOLUTION] = user_data;
3731 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3732 LOGD("ret : 0x%x", ret);
3736 int camera_foreach_supported_capture_resolution(camera_h camera, camera_supported_capture_resolution_cb foreach_cb , void *user_data)
3738 if (camera == NULL || foreach_cb == NULL) {
3739 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3740 return CAMERA_ERROR_INVALID_PARAMETER;
3742 int ret = CAMERA_ERROR_NONE;
3744 camera_cli_s *pc = (camera_cli_s *)camera;
3745 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_CAPTURE_RESOLUTION;
3747 LOGD("Enter, handle :%x", pc->remote_handle);
3750 if (pc->cb_info == NULL) {
3751 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3752 return CAMERA_ERROR_INVALID_PARAMETER;
3754 sock_fd = pc->cb_info->fd;
3755 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_RESOLUTION] = foreach_cb;
3756 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_RESOLUTION] = user_data;
3758 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3759 LOGD("ret : 0x%x", ret);
3763 int camera_foreach_supported_capture_format(camera_h camera, camera_supported_capture_format_cb foreach_cb , void *user_data)
3765 if (camera == NULL || foreach_cb == NULL) {
3766 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3767 return CAMERA_ERROR_INVALID_PARAMETER;
3769 int ret = CAMERA_ERROR_NONE;
3771 camera_cli_s *pc = (camera_cli_s *)camera;
3772 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_CAPTURE_FORMAT;
3774 LOGD("Enter, handle :%x", pc->remote_handle);
3777 if (pc->cb_info == NULL) {
3778 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3779 return CAMERA_ERROR_INVALID_PARAMETER;
3781 sock_fd = pc->cb_info->fd;
3782 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_FORMAT] = foreach_cb;
3783 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_FORMAT] = user_data;
3785 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3786 LOGD("ret : 0x%x", ret);
3791 int camera_foreach_supported_preview_format(camera_h camera, camera_supported_preview_format_cb foreach_cb , void *user_data)
3793 if (camera == NULL || foreach_cb == NULL) {
3794 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3795 return CAMERA_ERROR_INVALID_PARAMETER;
3797 int ret = CAMERA_ERROR_NONE;
3799 camera_cli_s *pc = (camera_cli_s *)camera;
3800 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_PREVIEW_FORMAT;
3802 LOGD("Enter, handle :%x", pc->remote_handle);
3805 if (pc->cb_info == NULL) {
3806 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3807 return CAMERA_ERROR_INVALID_PARAMETER;
3809 sock_fd = pc->cb_info->fd;
3810 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_FORMAT] = foreach_cb;
3811 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_FORMAT] = user_data;
3813 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3814 LOGD("ret : 0x%x", ret);
3819 int camera_get_recommended_preview_resolution(camera_h camera, int *width, int *height)
3821 if (camera == NULL || width == NULL || height == NULL) {
3822 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3823 return CAMERA_ERROR_INVALID_PARAMETER;
3825 int ret = CAMERA_ERROR_NONE;
3827 camera_cli_s *pc = (camera_cli_s *)camera;
3828 muse_camera_api_e api = MUSE_CAMERA_API_GET_RECOMMENDED_PREVIEW_RESOLUTION;
3830 if (pc->cb_info == NULL) {
3831 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3832 return CAMERA_ERROR_INVALID_PARAMETER;
3834 sock_fd = pc->cb_info->fd;
3838 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3839 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3841 if (ret == CAMERA_ERROR_NONE) {
3842 muse_camera_msg_get(get_width, pc->cb_info->recv_msg);
3843 muse_camera_msg_get(get_height, pc->cb_info->recv_msg);
3845 *height = get_height;
3847 LOGD("ret : 0x%x", ret);
3852 int camera_attr_get_lens_orientation(camera_h camera, int *angle)
3854 if (camera == NULL || angle == NULL) {
3855 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3856 return CAMERA_ERROR_INVALID_PARAMETER;
3858 int ret = CAMERA_ERROR_NONE;
3860 camera_cli_s *pc = (camera_cli_s *)camera;
3861 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_LENS_ORIENTATION;
3863 if (pc->cb_info == NULL) {
3864 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3865 return CAMERA_ERROR_INVALID_PARAMETER;
3867 sock_fd = pc->cb_info->fd;
3870 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3871 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3873 if (ret == CAMERA_ERROR_NONE) {
3874 muse_camera_msg_get(get_angle, pc->cb_info->recv_msg);
3877 LOGD("ret : 0x%x", ret);
3881 int camera_attr_set_theater_mode(camera_h camera, camera_attr_theater_mode_e mode)
3883 if (camera == NULL) {
3884 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3885 return CAMERA_ERROR_INVALID_PARAMETER;
3887 int ret = CAMERA_ERROR_NONE;
3888 camera_cli_s *pc = (camera_cli_s *)camera;
3889 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_THEATER_MODE;
3891 if (pc->cb_info == NULL) {
3892 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3893 return CAMERA_ERROR_INVALID_PARAMETER;
3895 sock_fd = pc->cb_info->fd;
3896 int set_mode = (int)mode;
3897 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3898 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
3899 LOGD("ret : 0x%x", ret);
3903 int camera_attr_get_theater_mode(camera_h camera, camera_attr_theater_mode_e *mode)
3905 if (camera == NULL || mode == NULL) {
3906 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3907 return CAMERA_ERROR_INVALID_PARAMETER;
3910 int ret = CAMERA_ERROR_NONE;
3911 camera_cli_s *pc = (camera_cli_s *)camera;
3912 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_THEATER_MODE;
3914 if (pc->cb_info == NULL) {
3915 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3916 return CAMERA_ERROR_INVALID_PARAMETER;
3918 sock_fd = pc->cb_info->fd;
3920 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3921 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3923 if (ret == CAMERA_ERROR_NONE) {
3924 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
3925 *mode = (camera_attr_theater_mode_e)get_mode;
3927 LOGD("ret : 0x%x", ret);
3931 int camera_attr_foreach_supported_theater_mode(camera_h camera, camera_attr_supported_theater_mode_cb foreach_cb, void *user_data)
3933 if (camera == NULL || foreach_cb == NULL) {
3934 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3935 return CAMERA_ERROR_INVALID_PARAMETER;
3937 int ret = CAMERA_ERROR_NONE;
3939 camera_cli_s *pc = (camera_cli_s *)camera;
3940 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_THEATER_MODE;
3942 LOGD("Enter, handle :%x", pc->remote_handle);
3945 if (pc->cb_info == NULL) {
3946 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3947 return CAMERA_ERROR_INVALID_PARAMETER;
3949 sock_fd = pc->cb_info->fd;
3950 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE] = foreach_cb;
3951 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE] = user_data;
3953 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3955 LOGD("Finish, return :%x", ret);
3960 int camera_attr_set_preview_fps(camera_h camera, camera_attr_fps_e fps)
3962 if (camera == NULL) {
3963 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3964 return CAMERA_ERROR_INVALID_PARAMETER;
3966 int ret = CAMERA_ERROR_NONE;
3967 camera_cli_s *pc = (camera_cli_s *)camera;
3968 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_PREVIEW_FPS;
3970 if (pc->cb_info == NULL) {
3971 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3972 return CAMERA_ERROR_INVALID_PARAMETER;
3974 sock_fd = pc->cb_info->fd;
3975 int set_fps = (int)fps;
3976 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3977 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_fps);
3978 LOGD("ret : 0x%x", ret);
3983 int camera_attr_set_image_quality(camera_h camera, int quality)
3985 if (camera == NULL) {
3986 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3987 return CAMERA_ERROR_INVALID_PARAMETER;
3989 int ret = CAMERA_ERROR_NONE;
3991 camera_cli_s *pc = (camera_cli_s *)camera;
3992 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_IMAGE_QUALITY;
3994 if (pc->cb_info == NULL) {
3995 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3996 return CAMERA_ERROR_INVALID_PARAMETER;
3998 sock_fd = pc->cb_info->fd;
3999 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4000 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, quality);
4001 LOGD("ret : 0x%x", ret);
4005 int camera_attr_get_preview_fps(camera_h camera, camera_attr_fps_e *fps)
4007 if (camera == NULL || fps == NULL) {
4008 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4009 return CAMERA_ERROR_INVALID_PARAMETER;
4011 int ret = CAMERA_ERROR_NONE;
4013 camera_cli_s *pc = (camera_cli_s *)camera;
4014 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_PREVIEW_FPS;
4017 if (pc->cb_info == NULL) {
4018 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4019 return CAMERA_ERROR_INVALID_PARAMETER;
4021 sock_fd = pc->cb_info->fd;
4023 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4024 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4026 if (ret == CAMERA_ERROR_NONE) {
4027 muse_camera_msg_get(get_fps, pc->cb_info->recv_msg);
4028 *fps = (camera_attr_fps_e)get_fps;
4030 LOGD("ret : 0x%x", ret);
4035 int camera_attr_get_image_quality(camera_h camera, int *quality)
4037 if (camera == NULL || quality == NULL) {
4038 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4039 return CAMERA_ERROR_INVALID_PARAMETER;
4041 int ret = CAMERA_ERROR_NONE;
4043 camera_cli_s *pc = (camera_cli_s *)camera;
4044 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_IMAGE_QUALITY;
4046 if (pc->cb_info == NULL) {
4047 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4048 return CAMERA_ERROR_INVALID_PARAMETER;
4050 sock_fd = pc->cb_info->fd;
4052 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4053 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4055 if (ret == CAMERA_ERROR_NONE) {
4056 muse_camera_msg_get(get_quality, pc->cb_info->recv_msg);
4057 *quality = get_quality;
4059 LOGD("ret : 0x%x", ret);
4064 int camera_attr_get_encoded_preview_bitrate(camera_h camera, int *bitrate)
4066 if (camera == NULL || bitrate == NULL) {
4067 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4068 return CAMERA_ERROR_INVALID_PARAMETER;
4071 int ret = CAMERA_ERROR_NONE;
4073 camera_cli_s *pc = (camera_cli_s *)camera;
4074 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ENCODED_PREVIEW_BITRATE;
4076 if (pc->cb_info == NULL) {
4077 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4078 return CAMERA_ERROR_INVALID_PARAMETER;
4080 sock_fd = pc->cb_info->fd;
4083 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4084 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4086 if (ret == CAMERA_ERROR_NONE) {
4087 muse_camera_msg_get(get_bitrate, pc->cb_info->recv_msg);
4088 *bitrate = get_bitrate;
4090 LOGD("ret : 0x%x", ret);
4095 int camera_attr_set_encoded_preview_bitrate(camera_h camera, int bitrate)
4097 if (camera == NULL) {
4098 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4099 return CAMERA_ERROR_INVALID_PARAMETER;
4102 int ret = CAMERA_ERROR_NONE;
4104 camera_cli_s *pc = (camera_cli_s *)camera;
4105 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ENCODED_PREVIEW_BITRATE;
4107 if (pc->cb_info == NULL) {
4108 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4109 return CAMERA_ERROR_INVALID_PARAMETER;
4111 sock_fd = pc->cb_info->fd;
4112 int set_bitrate = bitrate;
4113 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4114 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_bitrate);
4115 LOGD("ret : 0x%x", ret);
4120 int camera_attr_get_encoded_preview_gop_interval(camera_h camera, int *interval)
4122 if (camera == NULL || interval == NULL) {
4123 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4124 return CAMERA_ERROR_INVALID_PARAMETER;
4127 int ret = CAMERA_ERROR_NONE;
4129 camera_cli_s *pc = (camera_cli_s *)camera;
4130 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ENCODED_PREVIEW_GOP_INTERVAL;
4132 if (pc->cb_info == NULL) {
4133 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4134 return CAMERA_ERROR_INVALID_PARAMETER;
4136 sock_fd = pc->cb_info->fd;
4137 int get_gop_interval;
4139 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4140 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4142 if (ret == CAMERA_ERROR_NONE) {
4143 muse_camera_msg_get(get_gop_interval, pc->cb_info->recv_msg);
4144 *interval = get_gop_interval;
4146 LOGD("ret : 0x%x", ret);
4151 int camera_attr_set_encoded_preview_gop_interval(camera_h camera, int interval)
4153 if (camera == NULL) {
4154 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4155 return CAMERA_ERROR_INVALID_PARAMETER;
4158 int ret = CAMERA_ERROR_NONE;
4160 camera_cli_s *pc = (camera_cli_s *)camera;
4161 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ENCODED_PREVIEW_GOP_INTERVAL;
4163 if (pc->cb_info == NULL) {
4164 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4165 return CAMERA_ERROR_INVALID_PARAMETER;
4167 sock_fd = pc->cb_info->fd;
4168 int set_gop_interval = interval;
4169 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4170 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_gop_interval);
4171 LOGD("ret : 0x%x", ret);
4176 int camera_attr_set_zoom(camera_h camera, int zoom)
4178 if (camera == NULL) {
4179 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4180 return CAMERA_ERROR_INVALID_PARAMETER;
4182 int ret = CAMERA_ERROR_NONE;
4184 camera_cli_s *pc = (camera_cli_s *)camera;
4185 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ZOOM;
4187 if (pc->cb_info == NULL) {
4188 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4189 return CAMERA_ERROR_INVALID_PARAMETER;
4191 sock_fd = pc->cb_info->fd;
4193 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4194 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, zoom);
4195 LOGD("ret : 0x%x", ret);
4199 int camera_attr_set_af_mode(camera_h camera, camera_attr_af_mode_e mode)
4201 if (camera == NULL) {
4202 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4203 return CAMERA_ERROR_INVALID_PARAMETER;
4205 int ret = CAMERA_ERROR_NONE;
4207 camera_cli_s *pc = (camera_cli_s *)camera;
4208 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_AF_MODE;
4210 if (pc->cb_info == NULL) {
4211 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4212 return CAMERA_ERROR_INVALID_PARAMETER;
4214 sock_fd = pc->cb_info->fd;
4215 int set_mode = (int)mode;
4216 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4217 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
4218 LOGD("ret : 0x%x", ret);
4222 int camera_attr_set_af_area(camera_h camera, int x, int y)
4224 if (camera == NULL) {
4225 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4226 return CAMERA_ERROR_INVALID_PARAMETER;
4228 int ret = CAMERA_ERROR_NONE;
4229 camera_cli_s *pc = (camera_cli_s *)camera;
4230 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_AF_AREA;
4231 int sock_fd = pc->cb_info->fd;
4232 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4233 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, x, INT, y);
4234 LOGD("ret : 0x%x", ret);
4239 int camera_attr_clear_af_area(camera_h camera)
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;
4247 camera_cli_s *pc = (camera_cli_s *)camera;
4248 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_CLEAR_AF_AREA;
4250 if (pc->cb_info == NULL) {
4251 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4252 return CAMERA_ERROR_INVALID_PARAMETER;
4254 sock_fd = pc->cb_info->fd;
4255 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4256 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4257 LOGD("ret : 0x%x", ret);
4262 int camera_attr_set_exposure_mode(camera_h camera, camera_attr_exposure_mode_e mode)
4264 if (camera == NULL) {
4265 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4266 return CAMERA_ERROR_INVALID_PARAMETER;
4269 if (mode < CAMERA_ATTR_EXPOSURE_MODE_OFF || mode > CAMERA_ATTR_EXPOSURE_MODE_CUSTOM) {
4270 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4271 return CAMERA_ERROR_INVALID_PARAMETER;
4274 int ret = CAMERA_ERROR_NONE;
4275 camera_cli_s *pc = (camera_cli_s *)camera;
4276 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EXPOSURE_MODE;
4277 int set_mode = (int)mode;
4279 if (pc->cb_info == NULL) {
4280 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4281 return CAMERA_ERROR_INVALID_PARAMETER;
4283 sock_fd = pc->cb_info->fd;
4284 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4285 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
4286 LOGD("ret : 0x%x", ret);
4291 int camera_attr_set_exposure(camera_h camera, int value)
4293 if (camera == NULL) {
4294 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4295 return CAMERA_ERROR_INVALID_PARAMETER;
4297 int ret = CAMERA_ERROR_NONE;
4299 camera_cli_s *pc = (camera_cli_s *)camera;
4300 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EXPOSURE;
4302 if (pc->cb_info == NULL) {
4303 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4304 return CAMERA_ERROR_INVALID_PARAMETER;
4306 sock_fd = pc->cb_info->fd;
4308 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4309 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, value);
4310 LOGD("ret : 0x%x", ret);
4315 int camera_attr_set_iso(camera_h camera, camera_attr_iso_e iso)
4317 if (camera == NULL) {
4318 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4319 return CAMERA_ERROR_INVALID_PARAMETER;
4321 int ret = CAMERA_ERROR_NONE;
4323 camera_cli_s *pc = (camera_cli_s *)camera;
4324 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ISO;
4326 if (pc->cb_info == NULL) {
4327 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4328 return CAMERA_ERROR_INVALID_PARAMETER;
4330 sock_fd = pc->cb_info->fd;
4331 int set_iso = (int)iso;
4332 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4333 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_iso);
4334 LOGD("ret : 0x%x", ret);
4339 int camera_attr_set_brightness(camera_h camera, int level)
4341 if (camera == NULL) {
4342 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4343 return CAMERA_ERROR_INVALID_PARAMETER;
4345 int ret = CAMERA_ERROR_NONE;
4347 camera_cli_s *pc = (camera_cli_s *)camera;
4348 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_BRIGHTNESS;
4350 if (pc->cb_info == NULL) {
4351 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4352 return CAMERA_ERROR_INVALID_PARAMETER;
4354 sock_fd = pc->cb_info->fd;
4356 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4357 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, level);
4358 LOGD("ret : 0x%x", ret);
4363 int camera_attr_set_contrast(camera_h camera, int level)
4365 if (camera == NULL) {
4366 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4367 return CAMERA_ERROR_INVALID_PARAMETER;
4369 int ret = CAMERA_ERROR_NONE;
4371 camera_cli_s *pc = (camera_cli_s *)camera;
4372 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_CONTRAST;
4374 if (pc->cb_info == NULL) {
4375 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4376 return CAMERA_ERROR_INVALID_PARAMETER;
4378 sock_fd = pc->cb_info->fd;
4380 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4381 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, level);
4382 LOGD("ret : 0x%x", ret);
4387 int camera_attr_set_whitebalance(camera_h camera, camera_attr_whitebalance_e wb)
4389 if (camera == NULL) {
4390 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4391 return CAMERA_ERROR_INVALID_PARAMETER;
4394 if (wb < CAMERA_ATTR_WHITE_BALANCE_NONE || wb > CAMERA_ATTR_WHITE_BALANCE_CUSTOM) {
4395 LOGE("invalid white balance %d", wb);
4396 return CAMERA_ERROR_INVALID_PARAMETER;
4399 int ret = CAMERA_ERROR_NONE;
4401 camera_cli_s *pc = (camera_cli_s *)camera;
4402 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_WHITEBALANCE;
4404 if (pc->cb_info == NULL) {
4405 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4406 return CAMERA_ERROR_INVALID_PARAMETER;
4408 sock_fd = pc->cb_info->fd;
4409 int set_whitebalance = (int)wb;
4410 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4411 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_whitebalance);
4412 LOGD("ret : 0x%x", ret);
4417 int camera_attr_set_effect(camera_h camera, camera_attr_effect_mode_e effect)
4419 if (camera == NULL) {
4420 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4421 return CAMERA_ERROR_INVALID_PARAMETER;
4423 int ret = CAMERA_ERROR_NONE;
4425 camera_cli_s *pc = (camera_cli_s *)camera;
4426 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EFFECT;
4428 if (pc->cb_info == NULL) {
4429 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4430 return CAMERA_ERROR_INVALID_PARAMETER;
4432 sock_fd = pc->cb_info->fd;
4433 int set_effect = (int)effect;
4434 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4435 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_effect);
4436 LOGD("ret : 0x%x", ret);
4441 int camera_attr_set_scene_mode(camera_h camera, camera_attr_scene_mode_e mode)
4443 if (camera == NULL) {
4444 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4445 return CAMERA_ERROR_INVALID_PARAMETER;
4447 int ret = CAMERA_ERROR_NONE;
4449 camera_cli_s *pc = (camera_cli_s *)camera;
4450 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_SCENE_MODE;
4452 if (pc->cb_info == NULL) {
4453 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4454 return CAMERA_ERROR_INVALID_PARAMETER;
4456 sock_fd = pc->cb_info->fd;
4457 int set_mode = (int)mode;
4458 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4459 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
4460 LOGD("ret : 0x%x", ret);
4465 int camera_attr_enable_tag(camera_h camera, bool enable)
4467 if (camera == NULL) {
4468 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4469 return CAMERA_ERROR_INVALID_PARAMETER;
4471 int ret = CAMERA_ERROR_NONE;
4472 camera_cli_s *pc = (camera_cli_s *)camera;
4473 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_TAG;
4475 if (pc->cb_info == NULL) {
4476 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4477 return CAMERA_ERROR_INVALID_PARAMETER;
4479 sock_fd = pc->cb_info->fd;
4480 int set_enable = (int)enable;
4482 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4483 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
4484 LOGD("ret : 0x%x", ret);
4489 int camera_attr_set_tag_image_description(camera_h camera, const char *description)
4491 if (camera == NULL) {
4492 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4493 return CAMERA_ERROR_INVALID_PARAMETER;
4495 if (description == NULL) {
4496 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4497 return CAMERA_ERROR_INVALID_PARAMETER;
4499 int ret = CAMERA_ERROR_NONE;
4500 camera_cli_s *pc = (camera_cli_s *)camera;
4501 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_IMAGE_DESCRIPTION;
4503 if (pc->cb_info == NULL) {
4504 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4505 return CAMERA_ERROR_INVALID_PARAMETER;
4507 sock_fd = pc->cb_info->fd;
4508 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4509 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, STRING, description);
4510 LOGD("ret : 0x%x", ret);
4515 int camera_attr_set_tag_orientation(camera_h camera, camera_attr_tag_orientation_e orientation)
4517 if (camera == NULL) {
4518 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4519 return CAMERA_ERROR_INVALID_PARAMETER;
4521 int ret = CAMERA_ERROR_NONE;
4522 camera_cli_s *pc = (camera_cli_s *)camera;
4523 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_ORIENTATION;
4525 if (pc->cb_info == NULL) {
4526 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4527 return CAMERA_ERROR_INVALID_PARAMETER;
4529 sock_fd = pc->cb_info->fd;
4530 int set_orientation = (int)orientation;
4532 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4533 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_orientation);
4534 LOGD("ret : 0x%x", ret);
4539 int camera_attr_set_tag_software(camera_h camera, const char *software)
4541 if (camera == NULL) {
4542 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4543 return CAMERA_ERROR_INVALID_PARAMETER;
4545 if (software == NULL) {
4546 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4547 return CAMERA_ERROR_INVALID_PARAMETER;
4549 int ret = CAMERA_ERROR_NONE;
4550 camera_cli_s *pc = (camera_cli_s *)camera;
4551 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_SOFTWARE;
4553 if (pc->cb_info == NULL) {
4554 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4555 return CAMERA_ERROR_INVALID_PARAMETER;
4557 sock_fd = pc->cb_info->fd;
4558 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4559 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, STRING, software);
4560 LOGD("ret : 0x%x", ret);
4565 int camera_attr_set_geotag(camera_h camera, double latitude , double longitude, double altitude)
4567 if (camera == NULL) {
4568 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4569 return CAMERA_ERROR_INVALID_PARAMETER;
4571 int ret = CAMERA_ERROR_NONE;
4572 camera_cli_s *pc = (camera_cli_s *)camera;
4573 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_GEOTAG;
4575 if (pc->cb_info == NULL) {
4576 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4577 return CAMERA_ERROR_INVALID_PARAMETER;
4579 sock_fd = pc->cb_info->fd;
4580 double set_geotag[3] = { latitude, longitude, altitude };
4582 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4583 muse_camera_msg_send_array(api, sock_fd, pc->cb_info, ret,
4584 set_geotag, sizeof(set_geotag), sizeof(double));
4585 LOGD("ret : 0x%x", ret);
4590 int camera_attr_remove_geotag(camera_h camera)
4592 if (camera == NULL) {
4593 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4594 return CAMERA_ERROR_INVALID_PARAMETER;
4596 int ret = CAMERA_ERROR_NONE;
4597 camera_cli_s *pc = (camera_cli_s *)camera;
4598 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_REMOVE_GEOTAG;
4600 if (pc->cb_info == NULL) {
4601 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4602 return CAMERA_ERROR_INVALID_PARAMETER;
4604 sock_fd = pc->cb_info->fd;
4605 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4606 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4607 LOGD("ret : 0x%x", ret);
4612 int camera_attr_set_flash_mode(camera_h camera, camera_attr_flash_mode_e mode)
4614 if (camera == NULL) {
4615 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4616 return CAMERA_ERROR_INVALID_PARAMETER;
4618 int ret = CAMERA_ERROR_NONE;
4619 camera_cli_s *pc = (camera_cli_s *)camera;
4620 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_FLASH_MODE;
4622 if (pc->cb_info == NULL) {
4623 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4624 return CAMERA_ERROR_INVALID_PARAMETER;
4626 sock_fd = pc->cb_info->fd;
4627 int set_mode = (int)mode;
4629 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4630 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
4631 LOGD("ret : 0x%x", ret);
4636 int camera_attr_get_zoom(camera_h camera, int *zoom)
4638 if (camera == NULL || zoom == NULL) {
4639 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4640 return CAMERA_ERROR_INVALID_PARAMETER;
4642 int ret = CAMERA_ERROR_NONE;
4644 camera_cli_s *pc = (camera_cli_s *)camera;
4645 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ZOOM;
4648 if (pc->cb_info == NULL) {
4649 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4650 return CAMERA_ERROR_INVALID_PARAMETER;
4652 sock_fd = pc->cb_info->fd;
4654 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4655 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4657 if (ret == CAMERA_ERROR_NONE) {
4658 muse_camera_msg_get(get_zoom, pc->cb_info->recv_msg);
4661 LOGD("ret : 0x%x", ret);
4666 int camera_attr_get_zoom_range(camera_h camera, int *min, int *max)
4668 if (camera == NULL || min == NULL || max == NULL) {
4669 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4670 return CAMERA_ERROR_INVALID_PARAMETER;
4672 int ret = CAMERA_ERROR_NONE;
4673 camera_cli_s *pc = (camera_cli_s *)camera;
4675 if (pc->cb_info == NULL) {
4676 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4677 return CAMERA_ERROR_INVALID_PARAMETER;
4679 sock_fd = pc->cb_info->fd;
4680 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ZOOM_RANGE;
4684 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4685 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4687 if (ret == CAMERA_ERROR_NONE) {
4688 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
4689 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
4693 LOGD("ret : 0x%x", ret);
4698 int camera_attr_get_af_mode(camera_h camera, camera_attr_af_mode_e *mode)
4700 if (camera == NULL || mode == NULL) {
4701 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4702 return CAMERA_ERROR_INVALID_PARAMETER;
4704 int ret = CAMERA_ERROR_NONE;
4705 camera_cli_s *pc = (camera_cli_s *)camera;
4707 if (pc->cb_info == NULL) {
4708 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4709 return CAMERA_ERROR_INVALID_PARAMETER;
4711 sock_fd = pc->cb_info->fd;
4712 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_AF_MODE;
4715 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4716 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4718 if (ret == CAMERA_ERROR_NONE) {
4719 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
4720 *mode = (camera_attr_af_mode_e)get_mode;
4722 LOGD("ret : 0x%x", ret);
4727 int camera_attr_get_exposure_mode(camera_h camera, camera_attr_exposure_mode_e *mode)
4729 if (camera == NULL || mode == NULL) {
4730 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4731 return CAMERA_ERROR_INVALID_PARAMETER;
4733 int ret = CAMERA_ERROR_NONE;
4734 camera_cli_s *pc = (camera_cli_s *)camera;
4736 if (pc->cb_info == NULL) {
4737 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4738 return CAMERA_ERROR_INVALID_PARAMETER;
4740 sock_fd = pc->cb_info->fd;
4741 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE_MODE;
4744 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4745 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4747 if (ret == CAMERA_ERROR_NONE) {
4748 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
4749 *mode = (camera_attr_exposure_mode_e)get_mode;
4751 LOGD("ret : 0x%x", ret);
4755 int camera_attr_get_exposure(camera_h camera, int *value)
4757 if (camera == NULL || value == NULL) {
4758 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4759 return CAMERA_ERROR_INVALID_PARAMETER;
4761 int ret = CAMERA_ERROR_NONE;
4762 camera_cli_s *pc = (camera_cli_s *)camera;
4764 if (pc->cb_info == NULL) {
4765 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4766 return CAMERA_ERROR_INVALID_PARAMETER;
4768 sock_fd = pc->cb_info->fd;
4769 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE;
4772 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4773 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4775 if (ret == CAMERA_ERROR_NONE) {
4776 muse_camera_msg_get(get_value, pc->cb_info->recv_msg);
4779 LOGD("ret : 0x%x", ret);
4784 int camera_attr_get_exposure_range(camera_h camera, int *min, int *max)
4786 if (camera == NULL || min == NULL || max == NULL) {
4787 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4788 return CAMERA_ERROR_INVALID_PARAMETER;
4790 int ret = CAMERA_ERROR_NONE;
4791 camera_cli_s *pc = (camera_cli_s *)camera;
4793 if (pc->cb_info == NULL) {
4794 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4795 return CAMERA_ERROR_INVALID_PARAMETER;
4797 sock_fd = pc->cb_info->fd;
4798 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE_RANGE;
4802 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4803 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4805 if (ret == CAMERA_ERROR_NONE) {
4806 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
4807 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
4811 LOGD("ret : 0x%x", ret);
4816 int camera_attr_get_iso(camera_h camera, camera_attr_iso_e *iso)
4818 if (camera == NULL || iso == NULL) {
4819 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4820 return CAMERA_ERROR_INVALID_PARAMETER;
4822 int ret = CAMERA_ERROR_NONE;
4823 camera_cli_s *pc = (camera_cli_s *)camera;
4825 if (pc->cb_info == NULL) {
4826 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4827 return CAMERA_ERROR_INVALID_PARAMETER;
4829 sock_fd = pc->cb_info->fd;
4830 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ISO;
4833 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4834 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4836 if (ret == CAMERA_ERROR_NONE) {
4837 muse_camera_msg_get(get_iso, pc->cb_info->recv_msg);
4838 *iso = (camera_attr_iso_e)get_iso;
4840 LOGD("ret : 0x%x", ret);
4845 int camera_attr_get_brightness(camera_h camera, int *level)
4847 if (camera == NULL || level == NULL) {
4848 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4849 return CAMERA_ERROR_INVALID_PARAMETER;
4851 int ret = CAMERA_ERROR_NONE;
4852 camera_cli_s *pc = (camera_cli_s *)camera;
4854 if (pc->cb_info == NULL) {
4855 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4856 return CAMERA_ERROR_INVALID_PARAMETER;
4858 sock_fd = pc->cb_info->fd;
4859 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_BRIGHTNESS;
4862 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4863 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4865 if (ret == CAMERA_ERROR_NONE) {
4866 muse_camera_msg_get(get_level, pc->cb_info->recv_msg);
4869 LOGD("ret : 0x%x", ret);
4874 int camera_attr_get_brightness_range(camera_h camera, int *min, int *max)
4876 if (camera == NULL || min == NULL || max == NULL) {
4877 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4878 return CAMERA_ERROR_INVALID_PARAMETER;
4880 int ret = CAMERA_ERROR_NONE;
4881 camera_cli_s *pc = (camera_cli_s *)camera;
4883 if (pc->cb_info == NULL) {
4884 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4885 return CAMERA_ERROR_INVALID_PARAMETER;
4887 sock_fd = pc->cb_info->fd;
4888 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_BRIGHTNESS_RANGE;
4892 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4893 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4895 if (ret == CAMERA_ERROR_NONE) {
4896 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
4897 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
4901 LOGD("ret : 0x%x", ret);
4906 int camera_attr_get_contrast(camera_h camera, int *level)
4908 if (camera == NULL || level == NULL) {
4909 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4910 return CAMERA_ERROR_INVALID_PARAMETER;
4912 int ret = CAMERA_ERROR_NONE;
4913 camera_cli_s *pc = (camera_cli_s *)camera;
4914 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_CONTRAST;
4916 if (pc->cb_info == NULL) {
4917 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4918 return CAMERA_ERROR_INVALID_PARAMETER;
4920 sock_fd = pc->cb_info->fd;
4923 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4924 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4926 if (ret == CAMERA_ERROR_NONE) {
4927 muse_camera_msg_get(get_level, pc->cb_info->recv_msg);
4930 LOGD("ret : 0x%x", ret);
4935 int camera_attr_get_contrast_range(camera_h camera, int *min , int *max)
4937 if (camera == NULL || min == NULL || max == NULL) {
4938 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4939 return CAMERA_ERROR_INVALID_PARAMETER;
4941 int ret = CAMERA_ERROR_NONE;
4942 camera_cli_s *pc = (camera_cli_s *)camera;
4943 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_CONTRAST_RANGE;
4945 if (pc->cb_info == NULL) {
4946 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4947 return CAMERA_ERROR_INVALID_PARAMETER;
4949 sock_fd = pc->cb_info->fd;
4953 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4954 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4956 if (ret == CAMERA_ERROR_NONE) {
4957 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
4958 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
4962 LOGD("ret : 0x%x", ret);
4967 int camera_attr_get_whitebalance(camera_h camera, camera_attr_whitebalance_e *wb)
4969 if (camera == NULL || wb == NULL) {
4970 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4971 return CAMERA_ERROR_INVALID_PARAMETER;
4973 int ret = CAMERA_ERROR_NONE;
4974 camera_cli_s *pc = (camera_cli_s *)camera;
4975 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_WHITEBALANCE;
4977 if (pc->cb_info == NULL) {
4978 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4979 return CAMERA_ERROR_INVALID_PARAMETER;
4981 sock_fd = pc->cb_info->fd;
4984 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4985 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4987 if (ret == CAMERA_ERROR_NONE) {
4988 muse_camera_msg_get(get_wb, pc->cb_info->recv_msg);
4989 *wb = (camera_attr_whitebalance_e)get_wb;
4991 LOGD("ret : 0x%x", ret);
4996 int camera_attr_get_effect(camera_h camera, camera_attr_effect_mode_e *effect)
4998 if (camera == NULL || effect == NULL) {
4999 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5000 return CAMERA_ERROR_INVALID_PARAMETER;
5003 int ret = CAMERA_ERROR_NONE;
5004 camera_cli_s *pc = (camera_cli_s *)camera;
5005 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EFFECT;
5007 if (pc->cb_info == NULL) {
5008 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5009 return CAMERA_ERROR_INVALID_PARAMETER;
5011 sock_fd = pc->cb_info->fd;
5014 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5015 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5017 if (ret == CAMERA_ERROR_NONE) {
5018 muse_camera_msg_get(get_effect, pc->cb_info->recv_msg);
5019 *effect = (camera_attr_effect_mode_e)get_effect;
5021 LOGD("ret : 0x%x", ret);
5026 int camera_attr_get_scene_mode(camera_h camera, camera_attr_scene_mode_e *mode)
5028 if (camera == NULL || mode == NULL) {
5029 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5030 return CAMERA_ERROR_INVALID_PARAMETER;
5033 int ret = CAMERA_ERROR_NONE;
5034 camera_cli_s *pc = (camera_cli_s *)camera;
5035 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_SCENE_MODE;
5037 if (pc->cb_info == NULL) {
5038 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5039 return CAMERA_ERROR_INVALID_PARAMETER;
5041 sock_fd = pc->cb_info->fd;
5044 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5045 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5047 if (ret == CAMERA_ERROR_NONE) {
5048 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
5049 *mode = (camera_attr_scene_mode_e)get_mode;
5051 LOGD("ret : 0x%x", ret);
5056 int camera_attr_is_enabled_tag(camera_h camera, bool *enable)
5058 if (camera == NULL || enable == NULL) {
5059 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5060 return CAMERA_ERROR_INVALID_PARAMETER;
5063 int ret = CAMERA_ERROR_NONE;
5064 camera_cli_s *pc = (camera_cli_s *)camera;
5065 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_TAG;
5067 if (pc->cb_info == NULL) {
5068 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5069 return CAMERA_ERROR_INVALID_PARAMETER;
5071 sock_fd = pc->cb_info->fd;
5074 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5075 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5077 if (ret == CAMERA_ERROR_NONE) {
5078 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
5079 *enable = (bool)get_enabled;
5081 LOGD("ret : 0x%x", ret);
5086 int camera_attr_get_tag_image_description(camera_h camera, char **description)
5088 if (camera == NULL || description == NULL) {
5089 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5090 return CAMERA_ERROR_INVALID_PARAMETER;
5093 int ret = CAMERA_ERROR_NONE;
5094 camera_cli_s *pc = (camera_cli_s *)camera;
5095 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_IMAGE_DESCRIPTION;
5097 if (pc->cb_info == NULL) {
5098 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5099 return CAMERA_ERROR_INVALID_PARAMETER;
5101 sock_fd = pc->cb_info->fd;
5102 char get_description[MUSE_CAMERA_MSG_MAX_LENGTH] = {0,};
5104 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5105 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5107 if (ret == CAMERA_ERROR_NONE) {
5108 muse_camera_msg_get_string(get_description, pc->cb_info->recv_msg);
5109 *description = strdup(get_description);
5111 LOGD("ret : 0x%x", ret);
5116 int camera_attr_get_tag_orientation(camera_h camera, camera_attr_tag_orientation_e *orientation)
5118 if (camera == NULL || orientation == NULL) {
5119 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5120 return CAMERA_ERROR_INVALID_PARAMETER;
5123 int ret = CAMERA_ERROR_NONE;
5124 camera_cli_s *pc = (camera_cli_s *)camera;
5125 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_ORIENTATION;
5127 if (pc->cb_info == NULL) {
5128 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5129 return CAMERA_ERROR_INVALID_PARAMETER;
5131 sock_fd = pc->cb_info->fd;
5132 int get_orientation;
5134 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5135 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5137 if (ret == CAMERA_ERROR_NONE) {
5138 muse_camera_msg_get(get_orientation, pc->cb_info->recv_msg);
5139 *orientation = (camera_attr_tag_orientation_e)get_orientation;
5140 LOGD("success, orientation : %d", *orientation);
5142 LOGD("ret : 0x%x", ret);
5147 int camera_attr_get_tag_software(camera_h camera, char **software)
5149 if (camera == NULL || software == NULL) {
5150 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5151 return CAMERA_ERROR_INVALID_PARAMETER;
5154 int ret = CAMERA_ERROR_NONE;
5155 camera_cli_s *pc = (camera_cli_s *)camera;
5156 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_SOFTWARE;
5158 if (pc->cb_info == NULL) {
5159 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5160 return CAMERA_ERROR_INVALID_PARAMETER;
5162 sock_fd = pc->cb_info->fd;
5163 char get_software[MUSE_CAMERA_MSG_MAX_LENGTH] = {0,};
5165 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5166 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5168 if (ret == CAMERA_ERROR_NONE) {
5169 muse_camera_msg_get_string(get_software, pc->cb_info->recv_msg);
5170 *software = strdup(get_software);
5172 LOGD("ret : 0x%x", ret);
5177 int camera_attr_get_geotag(camera_h camera, double *latitude , double *longitude, double *altitude)
5179 if (camera == NULL || latitude == NULL || longitude == NULL || altitude == NULL) {
5180 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5181 return CAMERA_ERROR_INVALID_PARAMETER;
5184 int ret = CAMERA_ERROR_NONE;
5185 camera_cli_s *pc = (camera_cli_s *)camera;
5186 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_GEOTAG;
5187 double get_geotag[3] = {0,};
5189 if (pc->cb_info == NULL) {
5190 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5191 return CAMERA_ERROR_INVALID_PARAMETER;
5193 sock_fd = pc->cb_info->fd;
5195 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5197 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5199 if (ret == CAMERA_ERROR_NONE) {
5200 muse_camera_msg_get_array(get_geotag, pc->cb_info->recv_msg);
5201 *latitude = get_geotag[0];
5202 *longitude = get_geotag[1];
5203 *altitude = get_geotag[2];
5205 LOGD("ret : 0x%x", ret);
5207 LOGE("Returned value is not valid : 0x%x", ret);
5214 int camera_attr_get_flash_mode(camera_h camera, camera_attr_flash_mode_e *mode)
5216 if (camera == NULL || mode == NULL) {
5217 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5218 return CAMERA_ERROR_INVALID_PARAMETER;
5221 int ret = CAMERA_ERROR_NONE;
5222 camera_cli_s *pc = (camera_cli_s *)camera;
5223 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_FLASH_MODE;
5225 if (pc->cb_info == NULL) {
5226 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5227 return CAMERA_ERROR_INVALID_PARAMETER;
5229 sock_fd = pc->cb_info->fd;
5232 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5233 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5235 if (ret == CAMERA_ERROR_NONE) {
5236 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
5237 *mode = (camera_attr_flash_mode_e)get_mode;
5239 LOGD("ret : 0x%x", ret);
5244 int camera_get_flash_state(camera_device_e device, camera_flash_state_e *state)
5248 int ret = CAMERA_ERROR_NONE;
5249 camera_cli_s *pc = NULL;
5250 int get_flash_state = 0;
5252 /* create muse connection */
5253 muse_camera_api_e api = MUSE_CAMERA_API_GET_FLASH_STATE;
5254 muse_core_api_module_e muse_module = MUSE_CAMERA;
5255 int device_type = (int)device;
5257 if (state == NULL) {
5258 LOGE("invalid pointer for state");
5259 return CAMERA_ERROR_INVALID_PARAMETER;
5262 sock_fd = muse_core_client_new();
5264 LOGE("muse_core_client_new failed - returned fd %d", sock_fd);
5265 ret = CAMERA_ERROR_INVALID_OPERATION;
5269 sndMsg = muse_core_msg_json_factory_new(api,
5270 MUSE_TYPE_INT, "module", muse_module,
5271 MUSE_TYPE_INT, PARAM_DEVICE_TYPE, device_type,
5274 muse_core_ipc_send_msg(sock_fd, sndMsg);
5275 muse_core_msg_json_factory_free(sndMsg);
5277 pc = g_new0(camera_cli_s, 1);
5279 LOGE("camera_cli_s alloc failed");
5280 ret = CAMERA_ERROR_OUT_OF_MEMORY;
5284 pc->cb_info = _client_callback_new(sock_fd);
5285 if (pc->cb_info == NULL) {
5286 LOGE("cb_info alloc failed");
5287 ret = CAMERA_ERROR_OUT_OF_MEMORY;
5291 ret = _client_wait_for_cb_return(api, pc->cb_info, CALLBACK_TIME_OUT);
5293 if (ret == CAMERA_ERROR_NONE) {
5294 muse_camera_msg_get(get_flash_state, pc->cb_info->recv_msg);
5295 *state = (camera_flash_state_e)get_flash_state;
5298 LOGD("Flash state : %d\n", *state);
5301 /* release resources */
5303 g_atomic_int_set(&pc->cb_info->msg_recv_running, 0);
5304 g_atomic_int_set(&pc->cb_info->msg_handler_running, 0);
5305 _client_callback_destroy(pc->cb_info);
5315 int camera_attr_foreach_supported_af_mode(camera_h camera, camera_attr_supported_af_mode_cb foreach_cb, void *user_data)
5317 if (camera == NULL || foreach_cb == NULL) {
5318 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5319 return CAMERA_ERROR_INVALID_PARAMETER;
5321 int ret = CAMERA_ERROR_NONE;
5323 camera_cli_s *pc = (camera_cli_s *)camera;
5324 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_AF_MODE;
5326 LOGD("Enter, handle :%x", pc->remote_handle);
5329 if (pc->cb_info == NULL) {
5330 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5331 return CAMERA_ERROR_INVALID_PARAMETER;
5333 sock_fd = pc->cb_info->fd;
5334 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_AF_MODE] = foreach_cb;
5335 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_AF_MODE] = user_data;
5337 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5338 LOGD("ret : 0x%x", ret);
5343 int camera_attr_foreach_supported_exposure_mode(camera_h camera, camera_attr_supported_exposure_mode_cb foreach_cb , void *user_data)
5345 if (camera == NULL || foreach_cb == NULL) {
5346 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5347 return CAMERA_ERROR_INVALID_PARAMETER;
5349 int ret = CAMERA_ERROR_NONE;
5351 camera_cli_s *pc = (camera_cli_s *)camera;
5352 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_EXPOSURE_MODE;
5354 LOGD("Enter, handle :%x", pc->remote_handle);
5357 if (pc->cb_info == NULL) {
5358 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5359 return CAMERA_ERROR_INVALID_PARAMETER;
5361 sock_fd = pc->cb_info->fd;
5362 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EXPOSURE_MODE] = foreach_cb;
5363 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EXPOSURE_MODE] = user_data;
5365 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5366 LOGD("ret : 0x%x", ret);
5371 int camera_attr_foreach_supported_iso(camera_h camera, camera_attr_supported_iso_cb foreach_cb, void *user_data)
5373 if (camera == NULL || foreach_cb == NULL) {
5374 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5375 return CAMERA_ERROR_INVALID_PARAMETER;
5377 int ret = CAMERA_ERROR_NONE;
5379 camera_cli_s *pc = (camera_cli_s *)camera;
5380 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_ISO;
5382 LOGD("Enter, handle :%x", pc->remote_handle);
5385 if (pc->cb_info == NULL) {
5386 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5387 return CAMERA_ERROR_INVALID_PARAMETER;
5389 sock_fd = pc->cb_info->fd;
5390 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_ISO] = foreach_cb;
5391 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_ISO] = user_data;
5393 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5394 LOGD("ret : 0x%x", ret);
5399 int camera_attr_foreach_supported_whitebalance(camera_h camera, camera_attr_supported_whitebalance_cb foreach_cb , void *user_data)
5401 if (camera == NULL || foreach_cb == NULL) {
5402 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5403 return CAMERA_ERROR_INVALID_PARAMETER;
5405 int ret = CAMERA_ERROR_NONE;
5407 camera_cli_s *pc = (camera_cli_s *)camera;
5408 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_WHITEBALANCE;
5410 LOGD("Enter, handle :%x", pc->remote_handle);
5413 if (pc->cb_info == NULL) {
5414 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5415 return CAMERA_ERROR_INVALID_PARAMETER;
5417 sock_fd = pc->cb_info->fd;
5418 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_WHITEBALANCE] = foreach_cb;
5419 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_WHITEBALANCE] = user_data;
5421 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5422 LOGD("ret : 0x%x", ret);
5427 int camera_attr_foreach_supported_effect(camera_h camera, camera_attr_supported_effect_cb foreach_cb , void *user_data)
5429 if (camera == NULL || foreach_cb == NULL) {
5430 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5431 return CAMERA_ERROR_INVALID_PARAMETER;
5433 int ret = CAMERA_ERROR_NONE;
5435 camera_cli_s *pc = (camera_cli_s *)camera;
5436 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_EFFECT;
5438 LOGD("Enter, handle :%x", pc->remote_handle);
5441 if (pc->cb_info == NULL) {
5442 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5443 return CAMERA_ERROR_INVALID_PARAMETER;
5445 sock_fd = pc->cb_info->fd;
5446 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EFFECT] = foreach_cb;
5447 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EFFECT] = user_data;
5449 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5450 LOGD("ret : 0x%x", ret);
5455 int camera_attr_foreach_supported_scene_mode(camera_h camera, camera_attr_supported_scene_mode_cb foreach_cb , void *user_data)
5457 if (camera == NULL || foreach_cb == NULL) {
5458 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5459 return CAMERA_ERROR_INVALID_PARAMETER;
5461 int ret = CAMERA_ERROR_NONE;
5463 camera_cli_s *pc = (camera_cli_s *)camera;
5464 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_SCENE_MODE;
5466 LOGD("Enter, handle :%x", pc->remote_handle);
5469 if (pc->cb_info == NULL) {
5470 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5471 return CAMERA_ERROR_INVALID_PARAMETER;
5473 sock_fd = pc->cb_info->fd;
5474 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_SCENE_MODE] = foreach_cb;
5475 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_SCENE_MODE] = user_data;
5477 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5478 LOGD("ret : 0x%x", ret);
5483 int camera_attr_foreach_supported_flash_mode(camera_h camera, camera_attr_supported_flash_mode_cb foreach_cb , void *user_data)
5485 if (camera == NULL || foreach_cb == NULL) {
5486 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5487 return CAMERA_ERROR_INVALID_PARAMETER;
5489 int ret = CAMERA_ERROR_NONE;
5491 camera_cli_s *pc = (camera_cli_s *)camera;
5492 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FLASH_MODE;
5494 LOGD("Enter, handle :%x", pc->remote_handle);
5497 if (pc->cb_info == NULL) {
5498 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5499 return CAMERA_ERROR_INVALID_PARAMETER;
5501 sock_fd = pc->cb_info->fd;
5502 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FLASH_MODE] = foreach_cb;
5503 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FLASH_MODE] = user_data;
5505 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5506 LOGD("ret : 0x%x", ret);
5511 int camera_attr_foreach_supported_fps(camera_h camera, camera_attr_supported_fps_cb foreach_cb , void *user_data)
5513 if (camera == NULL || foreach_cb == NULL) {
5514 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5515 return CAMERA_ERROR_INVALID_PARAMETER;
5517 int ret = CAMERA_ERROR_NONE;
5519 camera_cli_s *pc = (camera_cli_s *)camera;
5520 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FPS;
5522 if (pc->cb_info == NULL) {
5523 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5524 return CAMERA_ERROR_INVALID_PARAMETER;
5526 sock_fd = pc->cb_info->fd;
5527 LOGD("Enter, handle :%x", pc->remote_handle);
5528 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS] = foreach_cb;
5529 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS] = user_data;
5531 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5532 LOGD("Enter, handle :%x", pc->remote_handle);
5536 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)
5538 if (camera == NULL || foreach_cb == NULL) {
5539 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5540 return CAMERA_ERROR_INVALID_PARAMETER;
5542 int ret = CAMERA_ERROR_NONE;
5544 camera_cli_s *pc = (camera_cli_s *)camera;
5545 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FPS_BY_RESOLUTION;
5547 if (pc->cb_info == NULL) {
5548 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5549 return CAMERA_ERROR_INVALID_PARAMETER;
5551 sock_fd = pc->cb_info->fd;
5552 LOGD("Enter, handle :%x", pc->remote_handle);
5553 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS_BY_RESOLUTION] = foreach_cb;
5554 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS_BY_RESOLUTION] = user_data;
5556 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, width, INT, height);
5557 LOGD("ret : 0x%x", ret);
5561 int camera_attr_foreach_supported_stream_flip(camera_h camera, camera_attr_supported_stream_flip_cb foreach_cb, void *user_data)
5563 if (camera == NULL || foreach_cb == NULL) {
5564 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5565 return CAMERA_ERROR_INVALID_PARAMETER;
5567 int ret = CAMERA_ERROR_NONE;
5569 camera_cli_s *pc = (camera_cli_s *)camera;
5570 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_STREAM_FLIP;
5572 if (pc->cb_info == NULL) {
5573 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5574 return CAMERA_ERROR_INVALID_PARAMETER;
5576 sock_fd = pc->cb_info->fd;
5577 LOGD("Enter, handle :%x", pc->remote_handle);
5578 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_FLIP] = foreach_cb;
5579 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_FLIP] = user_data;
5581 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5582 LOGD("ret : 0x%x", ret);
5587 int camera_attr_foreach_supported_stream_rotation(camera_h camera, camera_attr_supported_stream_rotation_cb foreach_cb, void *user_data)
5589 if (camera == NULL || foreach_cb == NULL) {
5590 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5591 return CAMERA_ERROR_INVALID_PARAMETER;
5593 int ret = CAMERA_ERROR_NONE;
5595 camera_cli_s *pc = (camera_cli_s *)camera;
5596 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_STREAM_ROTATION;
5598 if (pc->cb_info == NULL) {
5599 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5600 return CAMERA_ERROR_INVALID_PARAMETER;
5602 sock_fd = pc->cb_info->fd;
5603 LOGD("Enter, handle :%x", pc->remote_handle);
5604 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION] = foreach_cb;
5605 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION] = user_data;
5607 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5608 LOGD("ret : 0x%x", ret);
5613 int camera_attr_set_stream_rotation(camera_h camera , camera_rotation_e rotation)
5615 if (camera == NULL) {
5616 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5617 return CAMERA_ERROR_INVALID_PARAMETER;
5620 int ret = CAMERA_ERROR_NONE;
5621 camera_cli_s *pc = (camera_cli_s *)camera;
5622 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_STREAM_ROTATION;
5624 if (pc->cb_info == NULL) {
5625 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5626 return CAMERA_ERROR_INVALID_PARAMETER;
5628 sock_fd = pc->cb_info->fd;
5629 int set_rotation = (int)rotation;
5631 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5632 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_rotation);
5633 LOGD("ret : 0x%x", ret);
5638 int camera_attr_get_stream_rotation(camera_h camera , camera_rotation_e *rotation)
5640 if (camera == NULL || rotation == NULL) {
5641 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5642 return CAMERA_ERROR_INVALID_PARAMETER;
5645 int ret = CAMERA_ERROR_NONE;
5646 camera_cli_s *pc = (camera_cli_s *)camera;
5647 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_STREAM_ROTATION;
5649 if (pc->cb_info == NULL) {
5650 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5651 return CAMERA_ERROR_INVALID_PARAMETER;
5653 sock_fd = pc->cb_info->fd;
5656 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5657 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5659 if (ret == CAMERA_ERROR_NONE) {
5660 muse_camera_msg_get(get_rotation, pc->cb_info->recv_msg);
5661 *rotation = (camera_rotation_e)get_rotation;
5663 LOGD("ret : 0x%x", ret);
5668 int camera_attr_set_stream_flip(camera_h camera , camera_flip_e flip)
5670 if (camera == NULL) {
5671 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5672 return CAMERA_ERROR_INVALID_PARAMETER;
5675 int ret = CAMERA_ERROR_NONE;
5676 camera_cli_s *pc = (camera_cli_s *)camera;
5677 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_STREAM_FLIP;
5679 if (pc->cb_info == NULL) {
5680 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5681 return CAMERA_ERROR_INVALID_PARAMETER;
5683 sock_fd = pc->cb_info->fd;
5684 int set_flip = (int)flip;
5686 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5687 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_flip);
5688 LOGD("ret : 0x%x", ret);
5693 int camera_attr_get_stream_flip(camera_h camera , camera_flip_e *flip)
5695 if (camera == NULL || flip == NULL) {
5696 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5697 return CAMERA_ERROR_INVALID_PARAMETER;
5700 int ret = CAMERA_ERROR_NONE;
5701 camera_cli_s *pc = (camera_cli_s *)camera;
5702 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_STREAM_FLIP;
5704 if (pc->cb_info == NULL) {
5705 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5706 return CAMERA_ERROR_INVALID_PARAMETER;
5708 sock_fd = pc->cb_info->fd;
5711 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5712 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5714 if (ret == CAMERA_ERROR_NONE) {
5715 muse_camera_msg_get(get_flip, pc->cb_info->recv_msg);
5716 *flip = (camera_flip_e)get_flip;
5718 LOGD("ret : 0x%x", ret);
5722 int camera_attr_set_hdr_mode(camera_h camera, camera_attr_hdr_mode_e mode)
5724 if (camera == NULL) {
5725 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5726 return CAMERA_ERROR_INVALID_PARAMETER;
5729 int ret = CAMERA_ERROR_NONE;
5730 camera_cli_s *pc = (camera_cli_s *)camera;
5731 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_HDR_MODE;
5733 if (pc->cb_info == NULL) {
5734 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5735 return CAMERA_ERROR_INVALID_PARAMETER;
5737 sock_fd = pc->cb_info->fd;
5738 int set_mode = (int)mode;
5740 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5741 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
5742 LOGD("ret : 0x%x", ret);
5747 int camera_attr_get_hdr_mode(camera_h camera, camera_attr_hdr_mode_e *mode)
5749 if (camera == NULL) {
5750 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5751 return CAMERA_ERROR_INVALID_PARAMETER;
5754 LOGE("INVALID_PARAMETER(0x%08x) - mode", CAMERA_ERROR_INVALID_PARAMETER);
5755 return CAMERA_ERROR_INVALID_PARAMETER;
5757 int ret = CAMERA_ERROR_NONE;
5758 camera_cli_s *pc = (camera_cli_s *)camera;
5759 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_HDR_MODE;
5761 if (pc->cb_info == NULL) {
5762 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5763 return CAMERA_ERROR_INVALID_PARAMETER;
5765 sock_fd = pc->cb_info->fd;
5768 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5769 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5771 if (ret == CAMERA_ERROR_NONE) {
5772 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
5773 *mode = (camera_attr_hdr_mode_e)get_mode;
5775 LOGD("ret : 0x%x", ret);
5780 bool camera_attr_is_supported_hdr_capture(camera_h camera)
5782 if (camera == NULL) {
5783 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5787 int ret = CAMERA_ERROR_NONE;
5788 camera_cli_s *pc = (camera_cli_s *)camera;
5789 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_HDR_CAPTURE;
5791 if (pc->cb_info == NULL) {
5792 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5793 return CAMERA_ERROR_INVALID_PARAMETER;
5795 sock_fd = pc->cb_info->fd;
5796 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5797 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5798 LOGD("ret : 0x%x", ret);
5803 int camera_attr_set_hdr_capture_progress_cb(camera_h camera, camera_attr_hdr_progress_cb callback, void *user_data)
5805 int ret = CAMERA_ERROR_NONE;
5806 camera_cli_s *pc = (camera_cli_s *)camera;
5807 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_HDR_CAPTURE_PROGRESS_CB;
5810 if (camera == NULL) {
5811 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5812 return CAMERA_ERROR_INVALID_PARAMETER;
5815 if (pc->cb_info == NULL) {
5816 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5817 return CAMERA_ERROR_INVALID_PARAMETER;
5820 sock_fd = pc->cb_info->fd;
5822 LOGD("Enter, handle :%x", pc->remote_handle);
5824 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5826 if (ret == CAMERA_ERROR_NONE) {
5827 if (callback == NULL) {
5828 LOGE("INVALID_PARAMETER(0x%08x) - callback", CAMERA_ERROR_INVALID_PARAMETER);
5829 return CAMERA_ERROR_INVALID_PARAMETER;
5832 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = callback;
5833 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = user_data;
5836 LOGD("ret : 0x%x", ret);
5842 int camera_attr_unset_hdr_capture_progress_cb(camera_h camera)
5844 if (camera == NULL) {
5845 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5846 return CAMERA_ERROR_INVALID_PARAMETER;
5849 int ret = CAMERA_ERROR_NONE;
5851 camera_cli_s *pc = (camera_cli_s *)camera;
5852 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_UNSET_HDR_CAPTURE_PROGRESS_CB;
5854 if (pc->cb_info == NULL) {
5855 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5856 return CAMERA_ERROR_INVALID_PARAMETER;
5858 sock_fd = pc->cb_info->fd;
5859 LOGD("Enter, handle :%x", pc->remote_handle);
5861 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = (void *)NULL;
5862 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = (void *)NULL;
5864 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5865 LOGD("ret : 0x%x", ret);
5870 int camera_attr_enable_anti_shake(camera_h camera, bool enable)
5872 if (camera == NULL) {
5873 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5874 return CAMERA_ERROR_INVALID_PARAMETER;
5877 int ret = CAMERA_ERROR_NONE;
5878 camera_cli_s *pc = (camera_cli_s *)camera;
5879 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_ANTI_SHAKE;
5881 if (pc->cb_info == NULL) {
5882 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5883 return CAMERA_ERROR_INVALID_PARAMETER;
5885 sock_fd = pc->cb_info->fd;
5886 int set_enable = (int)enable;
5888 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5889 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
5890 LOGD("ret : 0x%x", ret);
5895 int camera_attr_is_enabled_anti_shake(camera_h camera , bool *enabled)
5897 if (camera == NULL) {
5898 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5899 return CAMERA_ERROR_INVALID_PARAMETER;
5901 if (enabled == NULL) {
5902 LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER);
5903 return CAMERA_ERROR_INVALID_PARAMETER;
5905 int ret = CAMERA_ERROR_NONE;
5906 camera_cli_s *pc = (camera_cli_s *)camera;
5907 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_ANTI_SHAKE;
5909 if (pc->cb_info == NULL) {
5910 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5911 return CAMERA_ERROR_INVALID_PARAMETER;
5913 sock_fd = pc->cb_info->fd;
5916 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5917 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5919 if (ret == CAMERA_ERROR_NONE) {
5920 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
5921 *enabled = (bool)get_enabled;
5923 LOGD("ret : 0x%x", ret);
5928 bool camera_attr_is_supported_anti_shake(camera_h camera)
5931 if (camera == NULL) {
5932 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5936 int ret = CAMERA_ERROR_NONE;
5937 camera_cli_s *pc = (camera_cli_s *)camera;
5938 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_ANTI_SHAKE;
5940 if (pc->cb_info == NULL) {
5941 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5942 return CAMERA_ERROR_INVALID_PARAMETER;
5944 sock_fd = pc->cb_info->fd;
5945 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5946 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5947 LOGD("ret : 0x%x", ret);
5952 int camera_attr_enable_video_stabilization(camera_h camera, bool enable)
5954 if (camera == NULL) {
5955 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5956 return CAMERA_ERROR_INVALID_PARAMETER;
5959 int ret = CAMERA_ERROR_NONE;
5960 camera_cli_s *pc = (camera_cli_s *)camera;
5961 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_VIDEO_STABILIZATION;
5963 if (pc->cb_info == NULL) {
5964 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5965 return CAMERA_ERROR_INVALID_PARAMETER;
5967 sock_fd = pc->cb_info->fd;
5968 int set_enable = (int)enable;
5970 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5971 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
5972 LOGD("ret : 0x%x", ret);
5977 int camera_attr_is_enabled_video_stabilization(camera_h camera, bool *enabled)
5979 if (camera == NULL) {
5980 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5981 return CAMERA_ERROR_INVALID_PARAMETER;
5983 if (enabled == NULL) {
5984 LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER);
5985 return CAMERA_ERROR_INVALID_PARAMETER;
5987 int ret = CAMERA_ERROR_NONE;
5988 camera_cli_s *pc = (camera_cli_s *)camera;
5989 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_VIDEO_STABILIZATION;
5991 if (pc->cb_info == NULL) {
5992 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5993 return CAMERA_ERROR_INVALID_PARAMETER;
5995 sock_fd = pc->cb_info->fd;
5998 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5999 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6001 if (ret == CAMERA_ERROR_NONE) {
6002 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
6003 *enabled = (bool)get_enabled;
6005 LOGD("ret : 0x%x", ret);
6010 bool camera_attr_is_supported_video_stabilization(camera_h camera)
6012 if (camera == NULL) {
6013 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6017 int ret = CAMERA_ERROR_NONE;
6018 camera_cli_s *pc = (camera_cli_s *)camera;
6019 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_VIDEO_STABILIZATION;
6021 if (pc->cb_info == NULL) {
6022 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6023 return CAMERA_ERROR_INVALID_PARAMETER;
6025 sock_fd = pc->cb_info->fd;
6026 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6027 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6028 LOGD("ret : 0x%x", ret);
6033 int camera_attr_enable_auto_contrast(camera_h camera, bool enable)
6035 if (camera == NULL) {
6036 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6037 return CAMERA_ERROR_INVALID_PARAMETER;
6040 int ret = CAMERA_ERROR_NONE;
6041 camera_cli_s *pc = (camera_cli_s *)camera;
6042 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_AUTO_CONTRAST;
6044 if (pc->cb_info == NULL) {
6045 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6046 return CAMERA_ERROR_INVALID_PARAMETER;
6048 sock_fd = pc->cb_info->fd;
6049 int set_enable = (int)enable;
6051 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6052 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
6053 LOGD("ret : 0x%x", ret);
6058 int camera_attr_is_enabled_auto_contrast(camera_h camera, bool *enabled)
6060 if (camera == NULL) {
6061 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
6062 return CAMERA_ERROR_INVALID_PARAMETER;
6064 if (enabled == NULL) {
6065 LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER);
6066 return CAMERA_ERROR_INVALID_PARAMETER;
6068 int ret = CAMERA_ERROR_NONE;
6069 camera_cli_s *pc = (camera_cli_s *)camera;
6070 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_AUTO_CONTRAST;
6072 if (pc->cb_info == NULL) {
6073 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6074 return CAMERA_ERROR_INVALID_PARAMETER;
6076 sock_fd = pc->cb_info->fd;
6079 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6080 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6082 if (ret == CAMERA_ERROR_NONE) {
6083 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
6084 *enabled = (bool)get_enabled;
6086 LOGD("ret : 0x%x", ret);
6091 bool camera_attr_is_supported_auto_contrast(camera_h camera)
6093 if (camera == NULL) {
6094 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6098 int ret = CAMERA_ERROR_NONE;
6099 camera_cli_s *pc = (camera_cli_s *)camera;
6100 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_AUTO_CONTRAST;
6102 if (pc->cb_info == NULL) {
6103 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6104 return CAMERA_ERROR_INVALID_PARAMETER;
6106 sock_fd = pc->cb_info->fd;
6107 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6108 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6109 LOGD("ret : 0x%x", ret);
6114 int camera_attr_disable_shutter_sound(camera_h camera, bool disable)
6116 if (camera == NULL) {
6117 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6118 return CAMERA_ERROR_INVALID_PARAMETER;
6121 int ret = CAMERA_ERROR_NONE;
6122 camera_cli_s *pc = (camera_cli_s *)camera;
6123 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_DISABLE_SHUTTER_SOUND;
6125 if (pc->cb_info == NULL) {
6126 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6127 return CAMERA_ERROR_INVALID_PARAMETER;
6129 sock_fd = pc->cb_info->fd;
6130 int set_disable = (int)disable;
6132 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6133 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_disable);
6134 LOGD("ret : 0x%x", ret);
6139 int camera_attr_set_pan(camera_h camera, camera_attr_ptz_move_type_e move_type, int pan_step)
6141 if (camera == NULL) {
6142 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6143 return CAMERA_ERROR_INVALID_PARAMETER;
6146 camera_cli_s *pc = (camera_cli_s *)camera;
6147 if (pc->cb_info == NULL) {
6148 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6149 return CAMERA_ERROR_INVALID_PARAMETER;
6152 int ret = CAMERA_ERROR_NONE;
6153 int sock_fd = pc->cb_info->fd;
6154 int set_move_type = (int)move_type;
6155 int set_pan_step = pan_step;
6156 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_PAN;
6158 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6159 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, set_move_type, INT, set_pan_step);
6160 LOGD("ret : 0x%x", ret);
6165 int camera_attr_get_pan(camera_h camera, int *pan_step)
6167 if (camera == NULL || pan_step == NULL) {
6168 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6169 return CAMERA_ERROR_INVALID_PARAMETER;
6172 camera_cli_s *pc = (camera_cli_s *)camera;
6173 if (pc->cb_info == NULL) {
6174 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6175 return CAMERA_ERROR_INVALID_PARAMETER;
6178 int ret = CAMERA_ERROR_NONE;
6179 int sock_fd = pc->cb_info->fd;
6181 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_PAN;
6183 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6184 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6186 if (ret == CAMERA_ERROR_NONE) {
6187 muse_camera_msg_get(get_pan_step, pc->cb_info->recv_msg);
6188 *pan_step = get_pan_step;
6190 LOGD("ret : 0x%x", ret);
6195 int camera_attr_get_pan_range(camera_h camera, int *min, int *max)
6197 if (camera == NULL || min == NULL || max == NULL) {
6198 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6199 return CAMERA_ERROR_INVALID_PARAMETER;
6202 camera_cli_s *pc = (camera_cli_s *)camera;
6203 if (pc->cb_info == NULL) {
6204 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6205 return CAMERA_ERROR_INVALID_PARAMETER;
6208 int ret = CAMERA_ERROR_NONE;
6209 int sock_fd = pc->cb_info->fd;
6212 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_PAN_RANGE;
6214 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6215 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6217 if (ret == CAMERA_ERROR_NONE) {
6218 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
6219 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
6223 LOGD("ret : 0x%x", ret);
6228 int camera_attr_set_tilt(camera_h camera, camera_attr_ptz_move_type_e move_type, int tilt_step)
6230 if (camera == NULL) {
6231 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6232 return CAMERA_ERROR_INVALID_PARAMETER;
6235 camera_cli_s *pc = (camera_cli_s *)camera;
6236 if (pc->cb_info == NULL) {
6237 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6238 return CAMERA_ERROR_INVALID_PARAMETER;
6241 int ret = CAMERA_ERROR_NONE;
6242 int sock_fd = pc->cb_info->fd;
6243 int set_move_type = (int)move_type;
6244 int set_tilt_step = tilt_step;
6245 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TILT;
6247 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6248 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, set_move_type, INT, set_tilt_step);
6249 LOGD("ret : 0x%x", ret);
6254 int camera_attr_get_tilt(camera_h camera, int *tilt_step)
6256 if (camera == NULL || tilt_step == NULL) {
6257 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6258 return CAMERA_ERROR_INVALID_PARAMETER;
6261 camera_cli_s *pc = (camera_cli_s *)camera;
6262 if (pc->cb_info == NULL) {
6263 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6264 return CAMERA_ERROR_INVALID_PARAMETER;
6267 int ret = CAMERA_ERROR_NONE;
6268 int sock_fd = pc->cb_info->fd;
6270 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TILT;
6272 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6273 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6275 if (ret == CAMERA_ERROR_NONE) {
6276 muse_camera_msg_get(get_tilt_step, pc->cb_info->recv_msg);
6277 *tilt_step = get_tilt_step;
6279 LOGD("ret : 0x%x", ret);
6284 int camera_attr_get_tilt_range(camera_h camera, int *min, int *max)
6286 if (camera == NULL || min == NULL || max == NULL) {
6287 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6288 return CAMERA_ERROR_INVALID_PARAMETER;
6291 camera_cli_s *pc = (camera_cli_s *)camera;
6292 if (pc->cb_info == NULL) {
6293 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6294 return CAMERA_ERROR_INVALID_PARAMETER;
6297 int ret = CAMERA_ERROR_NONE;
6298 int sock_fd = pc->cb_info->fd;
6301 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TILT_RANGE;
6303 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6304 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6306 if (ret == CAMERA_ERROR_NONE) {
6307 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
6308 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
6312 LOGD("ret : 0x%x", ret);
6317 int camera_attr_set_ptz_type(camera_h camera, camera_attr_ptz_type_e ptz_type)
6319 if (camera == NULL) {
6320 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6321 return CAMERA_ERROR_INVALID_PARAMETER;
6324 camera_cli_s *pc = (camera_cli_s *)camera;
6325 if (pc->cb_info == NULL) {
6326 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6327 return CAMERA_ERROR_INVALID_PARAMETER;
6330 int ret = CAMERA_ERROR_NONE;
6331 int sock_fd = pc->cb_info->fd;
6332 int set_ptz_type = (int)ptz_type;
6333 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_PTZ_TYPE;
6335 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6336 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_ptz_type);
6337 LOGD("ret : 0x%x", ret);
6342 int camera_attr_foreach_supported_ptz_type(camera_h camera, camera_attr_supported_ptz_type_cb foreach_cb, void *user_data)
6344 if (camera == NULL || foreach_cb == NULL) {
6345 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6346 return CAMERA_ERROR_INVALID_PARAMETER;
6348 int ret = CAMERA_ERROR_NONE;
6350 camera_cli_s *pc = (camera_cli_s *)camera;
6351 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_PTZ_TYPE;
6353 if (pc->cb_info == NULL) {
6354 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6355 return CAMERA_ERROR_INVALID_PARAMETER;
6357 sock_fd = pc->cb_info->fd;
6358 LOGD("Enter, handle :%x", pc->remote_handle);
6359 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PTZ_TYPE] = foreach_cb;
6360 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PTZ_TYPE] = user_data;
6362 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6363 LOGD("ret : 0x%x", ret);
6368 int camera_attr_set_display_roi_area(camera_h camera, int x, int y, int width, int height)
6370 if (camera == NULL) {
6371 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6372 return CAMERA_ERROR_INVALID_PARAMETER;
6375 camera_cli_s *pc = (camera_cli_s *)camera;
6376 if (pc->cb_info == NULL) {
6377 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6378 return CAMERA_ERROR_INVALID_PARAMETER;
6381 int ret = CAMERA_ERROR_NONE;
6382 int sock_fd = pc->cb_info->fd;
6383 int set_display_roi_area[4] = {x, y, width, height};
6384 muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY_ROI_AREA;
6386 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6388 #ifdef TIZEN_FEATURE_EVAS_RENDERER
6389 if (CHECK_PREVIEW_CB(pc->cb_info, PREVIEW_CB_TYPE_EVAS)) {
6390 g_mutex_lock(&pc->cb_info->evas_mutex);
6392 ret = mm_evas_renderer_set_roi_area(pc->cb_info->evas_info, x, y, width, height);
6394 g_mutex_unlock(&pc->cb_info->evas_mutex);
6396 if (ret != MM_ERROR_NONE) {
6397 LOGE("mm_evas_renderer_set_roi_area error 0x%x", ret);
6398 return CAMERA_ERROR_INVALID_OPERATION;
6401 #endif /* TIZEN_FEATURE_EVAS_RENDERER */
6403 muse_camera_msg_send_array(api, sock_fd, pc->cb_info, ret,
6404 set_display_roi_area, sizeof(set_display_roi_area), sizeof(int));
6406 LOGD("ret : 0x%x", ret);
6412 int camera_attr_get_display_roi_area(camera_h camera, int *x, int *y, int *width, int *height)
6414 if (camera == NULL || x == NULL || y == NULL || width == NULL || height == NULL) {
6415 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6416 return CAMERA_ERROR_INVALID_PARAMETER;
6419 camera_cli_s *pc = (camera_cli_s *)camera;
6420 if (pc->cb_info == NULL) {
6421 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
6422 return CAMERA_ERROR_INVALID_PARAMETER;
6425 int ret = CAMERA_ERROR_NONE;
6426 int sock_fd = pc->cb_info->fd;
6427 int get_display_roi_area[4] = {0,};
6428 muse_camera_api_e api = MUSE_CAMERA_API_GET_DISPLAY_ROI_AREA;
6430 LOGD("Enter, remote_handle : %x", pc->remote_handle);
6432 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
6434 if (ret == CAMERA_ERROR_NONE) {
6435 muse_camera_msg_get_array(get_display_roi_area, pc->cb_info->recv_msg);
6437 *x = get_display_roi_area[0];
6438 *y = get_display_roi_area[1];
6439 *width = get_display_roi_area[2];
6440 *height = get_display_roi_area[3];
6442 LOGD("ret : 0x%x", ret);
6444 LOGE("Returned value is not valid : 0x%x", ret);