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 <camera_private.h>
28 #include <muse_core.h>
30 #include <Elementary.h>
31 #include <tbm_surface_internal.h>
33 #include <mm_camcorder.h>
34 #include <mm_camcorder_client.h>
37 #include <Ecore_Wayland.h>
45 #define LOG_TAG "TIZEN_N_CAMERA"
48 int __convert_camera_error_code(const char *func, int code)
50 int ret = CAMERA_ERROR_NONE;
51 const char *errorstr = NULL;
55 ret = CAMERA_ERROR_NONE;
56 errorstr = "ERROR_NONE";
58 case MM_ERROR_CAMCORDER_INVALID_ARGUMENT:
59 case MM_ERROR_COMMON_INVALID_ATTRTYPE:
60 ret = CAMERA_ERROR_INVALID_PARAMETER;
61 errorstr = "INVALID_PARAMETER";
63 case MM_ERROR_CAMCORDER_NOT_INITIALIZED:
64 case MM_ERROR_CAMCORDER_INVALID_STATE:
65 ret = CAMERA_ERROR_INVALID_STATE;
66 errorstr = "INVALID_STATE";
68 case MM_ERROR_CAMCORDER_DEVICE_NOT_FOUND:
69 ret = CAMERA_ERROR_DEVICE_NOT_FOUND;
70 errorstr = "DEVICE_NOT_FOUND";
72 case MM_ERROR_CAMCORDER_DEVICE_BUSY:
73 case MM_ERROR_CAMCORDER_DEVICE_OPEN:
74 case MM_ERROR_CAMCORDER_CMD_IS_RUNNING:
75 ret = CAMERA_ERROR_DEVICE_BUSY;
76 errorstr = "DEVICE_BUSY";
78 case MM_ERROR_CAMCORDER_DEVICE:
79 case MM_ERROR_CAMCORDER_DEVICE_IO:
80 case MM_ERROR_CAMCORDER_DEVICE_TIMEOUT:
81 case MM_ERROR_CAMCORDER_DEVICE_WRONG_JPEG:
82 case MM_ERROR_CAMCORDER_DEVICE_LACK_BUFFER:
83 ret = CAMERA_ERROR_DEVICE;
84 errorstr = "ERROR_DEVICE";
86 case MM_ERROR_CAMCORDER_GST_CORE:
87 case MM_ERROR_CAMCORDER_GST_LIBRARY:
88 case MM_ERROR_CAMCORDER_GST_RESOURCE:
89 case MM_ERROR_CAMCORDER_GST_STREAM:
90 case MM_ERROR_CAMCORDER_GST_STATECHANGE:
91 case MM_ERROR_CAMCORDER_GST_NEGOTIATION:
92 case MM_ERROR_CAMCORDER_GST_LINK:
93 case MM_ERROR_CAMCORDER_GST_FLOW_ERROR:
94 case MM_ERROR_CAMCORDER_ENCODER:
95 case MM_ERROR_CAMCORDER_ENCODER_BUFFER:
96 case MM_ERROR_CAMCORDER_ENCODER_WRONG_TYPE:
97 case MM_ERROR_CAMCORDER_ENCODER_WORKING:
98 case MM_ERROR_CAMCORDER_INTERNAL:
99 case MM_ERROR_CAMCORDER_RESPONSE_TIMEOUT:
100 case MM_ERROR_CAMCORDER_DSP_FAIL:
101 case MM_ERROR_CAMCORDER_AUDIO_EMPTY:
102 case MM_ERROR_CAMCORDER_CREATE_CONFIGURE:
103 case MM_ERROR_CAMCORDER_FILE_SIZE_OVER:
104 case MM_ERROR_CAMCORDER_DISPLAY_DEVICE_OFF:
105 case MM_ERROR_CAMCORDER_INVALID_CONDITION:
106 ret = CAMERA_ERROR_INVALID_OPERATION;
107 errorstr = "INVALID_OPERATION";
109 case MM_ERROR_CAMCORDER_RESOURCE_CREATION:
110 case MM_ERROR_COMMON_OUT_OF_MEMORY:
111 ret = CAMERA_ERROR_OUT_OF_MEMORY;
112 errorstr = "OUT_OF_MEMORY";
114 case MM_ERROR_POLICY_BLOCKED:
115 ret = CAMERA_ERROR_SOUND_POLICY;
116 errorstr = "ERROR_SOUND_POLICY";
118 case MM_ERROR_POLICY_BLOCKED_BY_CALL:
119 ret = CAMERA_ERROR_SOUND_POLICY_BY_CALL;
120 errorstr = "ERROR_SOUND_POLICY_BY_CALL";
122 case MM_ERROR_POLICY_BLOCKED_BY_ALARM:
123 ret = CAMERA_ERROR_SOUND_POLICY_BY_ALARM;
124 errorstr = "ERROR_SOUND_POLICY_BY_ALARM";
126 case MM_ERROR_POLICY_RESTRICTED:
127 ret = CAMERA_ERROR_SECURITY_RESTRICTED;
128 errorstr = "ERROR_RESTRICTED";
130 case MM_ERROR_CAMCORDER_DEVICE_REG_TROUBLE:
131 ret = CAMERA_ERROR_ESD;
132 errorstr = "ERROR_ESD";
134 case MM_ERROR_COMMON_INVALID_PERMISSION:
135 ret = CAMERA_ERROR_PERMISSION_DENIED;
136 errorstr = "ERROR_PERMISSION_DENIED";
138 case MM_ERROR_COMMON_OUT_OF_ARRAY:
139 case MM_ERROR_COMMON_OUT_OF_RANGE:
140 case MM_ERROR_COMMON_ATTR_NOT_EXIST:
141 case MM_ERROR_CAMCORDER_NOT_SUPPORTED:
142 ret = CAMERA_ERROR_NOT_SUPPORTED;
143 errorstr = "ERROR_NOT_SUPPORTED";
146 ret = CAMERA_ERROR_INVALID_OPERATION;
147 errorstr = "INVALID_OPERATION";
150 if (code != MM_ERROR_NONE)
151 LOGE("[%s] %s(0x%08x) : core frameworks error code(0x%08x)", func ? func : "NULL_FUNC", errorstr, ret, code);
157 static MMCamWaylandInfo *_get_wl_info(Evas_Object *obj)
159 MMCamWaylandInfo *wl_info = NULL;
162 LOGE("evas object is NULL");
166 wl_info = g_new0(MMCamWaylandInfo, 1);
167 if (wl_info == NULL) {
168 LOGE("wl_info alloc failed : %d", sizeof(MMCamWaylandInfo));
172 wl_info->evas_obj = (void *)obj;
173 wl_info->window = (void *)elm_win_wl_window_get(obj);
174 wl_info->surface = (void *)ecore_wl_window_surface_get(wl_info->window);
175 wl_info->display = (void *)ecore_wl_display_get();
177 if (wl_info->window == NULL || wl_info->surface == NULL || wl_info->display == NULL) {
178 LOGE("something is NULL %p, %p, %p", wl_info->window, wl_info->surface, wl_info->display);
183 evas_object_geometry_get(obj, &wl_info->window_x, &wl_info->window_y,
184 &wl_info->window_width, &wl_info->window_height);
186 LOGD("wayland obj %p, window %p, surface %p, display %p, size %d,%d,%dx%d",
187 wl_info->evas_obj, wl_info->window, wl_info->surface, wl_info->display,
188 wl_info->window_x, wl_info->window_y, wl_info->window_width, wl_info->window_height);
192 #endif /* HAVE_WAYLAND */
194 static int _import_tbm_key(tbm_bufmgr bufmgr, unsigned int tbm_key, tbm_bo *bo, tbm_bo_handle *bo_handle)
196 tbm_bo tmp_bo = NULL;
197 tbm_bo_handle tmp_bo_handle = {NULL, };
199 if (bufmgr == NULL || bo == NULL || bo_handle == NULL || tbm_key == 0) {
200 LOGE("invalid parameter - bufmgr %p, bo %p, bo_handle %p, key %d",
201 bufmgr, bo, bo_handle, tbm_key);
205 tmp_bo = tbm_bo_import(bufmgr, tbm_key);
206 if (tmp_bo == NULL) {
207 LOGE("bo import failed - bufmgr %p, key %d", bufmgr, tbm_key);
211 tmp_bo_handle = tbm_bo_map(tmp_bo, TBM_DEVICE_CPU, TBM_OPTION_READ);
212 if (tmp_bo_handle.ptr == NULL) {
213 LOGE("bo map failed %p", tmp_bo);
214 tbm_bo_unref(tmp_bo);
219 /* set bo and bo_handle */
221 *bo_handle = tmp_bo_handle;
226 static void _release_imported_bo(tbm_bo *bo)
228 if (bo == NULL || *bo == NULL) {
240 static int _client_wait_for_cb_return(muse_camera_api_e api, camera_cb_info_s *cb_info, int time_out)
242 int ret = CAMERA_ERROR_NONE;
245 LOGD("Enter api : %d", api);
247 g_mutex_lock(&(cb_info->api_mutex[api]));
249 if (cb_info->api_activating[api] == 0) {
250 end_time = g_get_monotonic_time() + time_out * G_TIME_SPAN_SECOND;
251 if (g_cond_wait_until(&(cb_info->api_cond[api]), &(cb_info->api_mutex[api]), end_time)) {
252 ret = cb_info->api_ret[api];
253 cb_info->api_activating[api] = 0;
255 LOGD("return value : 0x%x", ret);
257 ret = CAMERA_ERROR_INVALID_OPERATION;
259 LOGE("api %d was TIMED OUT!", api);
262 ret = cb_info->api_ret[api];
263 cb_info->api_activating[api] = 0;
265 LOGD("condition is already checked for the api[%d], return[0x%x]", api, ret);
268 g_mutex_unlock(&(cb_info->api_mutex[api]));
273 int _camera_get_tbm_surface_format(int in_format, uint32_t *out_format)
275 if (in_format <= MM_PIXEL_FORMAT_INVALID ||
276 in_format >= MM_PIXEL_FORMAT_NUM ||
277 out_format == NULL) {
278 LOGE("INVALID_PARAMETER : in_format %d, out_format ptr %p", in_format, out_format);
279 return CAMERA_ERROR_INVALID_PARAMETER;
283 case MM_PIXEL_FORMAT_NV12:
284 case MM_PIXEL_FORMAT_NV12T:
285 *out_format = TBM_FORMAT_NV12;
287 case MM_PIXEL_FORMAT_NV16:
288 *out_format = TBM_FORMAT_NV16;
290 case MM_PIXEL_FORMAT_NV21:
291 *out_format = TBM_FORMAT_NV21;
293 case MM_PIXEL_FORMAT_YUYV:
294 *out_format = TBM_FORMAT_YUYV;
296 case MM_PIXEL_FORMAT_UYVY:
297 case MM_PIXEL_FORMAT_ITLV_JPEG_UYVY:
298 *out_format = TBM_FORMAT_UYVY;
300 case MM_PIXEL_FORMAT_422P:
301 *out_format = TBM_FORMAT_YUV422;
303 case MM_PIXEL_FORMAT_I420:
304 *out_format = TBM_FORMAT_YUV420;
306 case MM_PIXEL_FORMAT_YV12:
307 *out_format = TBM_FORMAT_YVU420;
309 case MM_PIXEL_FORMAT_RGB565:
310 *out_format = TBM_FORMAT_RGB565;
312 case MM_PIXEL_FORMAT_RGB888:
313 *out_format = TBM_FORMAT_RGB888;
315 case MM_PIXEL_FORMAT_RGBA:
316 *out_format = TBM_FORMAT_RGBA8888;
318 case MM_PIXEL_FORMAT_ARGB:
319 *out_format = TBM_FORMAT_ARGB8888;
322 LOGE("invalid in_format %d", in_format);
323 return CAMERA_ERROR_INVALID_PARAMETER;
326 return CAMERA_ERROR_NONE;
330 int _camera_get_media_packet_mimetype(int in_format, media_format_mimetype_e *mimetype)
332 if (in_format <= MM_PIXEL_FORMAT_INVALID ||
333 in_format >= MM_PIXEL_FORMAT_NUM ||
335 LOGE("INVALID_PARAMETER : in_format %d, mimetype ptr %p", in_format, mimetype);
336 return CAMERA_ERROR_INVALID_PARAMETER;
340 case MM_PIXEL_FORMAT_NV12:
341 case MM_PIXEL_FORMAT_NV12T:
342 *mimetype = MEDIA_FORMAT_NV12;
344 case MM_PIXEL_FORMAT_NV16:
345 *mimetype = MEDIA_FORMAT_NV16;
347 case MM_PIXEL_FORMAT_NV21:
348 *mimetype = MEDIA_FORMAT_NV21;
350 case MM_PIXEL_FORMAT_YUYV:
351 *mimetype = MEDIA_FORMAT_YUYV;
353 case MM_PIXEL_FORMAT_UYVY:
354 case MM_PIXEL_FORMAT_ITLV_JPEG_UYVY:
355 *mimetype = MEDIA_FORMAT_UYVY;
357 case MM_PIXEL_FORMAT_422P:
358 *mimetype = MEDIA_FORMAT_422P;
360 case MM_PIXEL_FORMAT_I420:
361 *mimetype = MEDIA_FORMAT_I420;
363 case MM_PIXEL_FORMAT_YV12:
364 *mimetype = MEDIA_FORMAT_YV12;
366 case MM_PIXEL_FORMAT_RGB565:
367 *mimetype = MEDIA_FORMAT_RGB565;
369 case MM_PIXEL_FORMAT_RGB888:
370 *mimetype = MEDIA_FORMAT_RGB888;
372 case MM_PIXEL_FORMAT_RGBA:
373 *mimetype = MEDIA_FORMAT_RGBA;
375 case MM_PIXEL_FORMAT_ARGB:
376 *mimetype = MEDIA_FORMAT_ARGB;
379 LOGE("invalid in_format %d", in_format);
380 return CAMERA_ERROR_INVALID_PARAMETER;
383 return CAMERA_ERROR_NONE;
386 int _camera_media_packet_finalize(media_packet_h pkt, int error_code, void *user_data)
390 camera_cb_info_s *cb_info = (camera_cb_info_s *)user_data;
391 camera_media_packet_data *mp_data = NULL;
392 tbm_surface_h tsurf = NULL;
394 if (pkt == NULL || cb_info == NULL) {
395 LOGE("invalid parameter buffer %p, cb_info %p", pkt, cb_info);
396 return MEDIA_PACKET_FINALIZE;
399 ret = media_packet_get_extra(pkt, (void **)&mp_data);
400 if (ret != MEDIA_PACKET_ERROR_NONE) {
401 LOGE("media_packet_get_extra failed 0x%x", ret);
402 return MEDIA_PACKET_FINALIZE;
405 /*LOGD("mp_data %p", mp_data);*/
408 int tbm_key = mp_data->tbm_key;
410 /* release imported bo */
411 for (i = 0 ; i < mp_data->num_buffer_key ; i++) {
412 tbm_bo_unref(mp_data->buffer_bo[i]);
413 mp_data->buffer_bo[i] = NULL;
416 /* unmap and unref tbm bo */
417 _release_imported_bo(&mp_data->bo);
420 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
421 cb_info->fd, cb_info, INT, tbm_key);
426 ret = media_packet_get_tbm_surface(pkt, &tsurf);
427 if (ret != MEDIA_PACKET_ERROR_NONE) {
428 LOGE("media_packet_get_tbm_surface failed 0x%x", ret);
429 return MEDIA_PACKET_FINALIZE;
433 tbm_surface_destroy(tsurf);
437 return MEDIA_PACKET_FINALIZE;
440 static void _client_user_callback(camera_cb_info_s *cb_info, char *recv_msg, muse_camera_event_e event)
446 tbm_bo_handle bo_handle = {NULL, };
448 if (recv_msg == NULL || event >= MUSE_CAMERA_EVENT_TYPE_NUM) {
449 LOGE("invalid parameter - camera msg %p, event %d", recv_msg, event);
453 LOGD("get camera msg %s, event %d", recv_msg, event);
455 if (cb_info->user_cb[event] == NULL) {
456 LOGW("user callback for event %d is not set", event);
461 case MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE:
467 muse_camera_msg_get(previous, recv_msg);
468 muse_camera_msg_get(current, recv_msg);
469 muse_camera_msg_get(by_policy, recv_msg);
471 LOGD("STATE CHANGE - previous %d, current %d, by_policy %d",
472 previous, current, by_policy);
474 ((camera_state_changed_cb)cb_info->user_cb[event])((camera_state_e)previous,
475 (camera_state_e)current, (bool)by_policy, cb_info->user_data[event]);
478 case MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE:
482 muse_camera_msg_get(state, recv_msg);
484 LOGD("FOCUS state - %d", state);
486 ((camera_focus_changed_cb)cb_info->user_cb[event])((camera_focus_state_e)state, cb_info->user_data[event]);
489 case MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE:
490 LOGD("CAPTURE_COMPLETED");
491 ((camera_capture_completed_cb)cb_info->user_cb[event])(cb_info->user_data[event]);
493 case MUSE_CAMERA_EVENT_TYPE_PREVIEW:
494 case MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW:
496 camera_preview_data_s frame;
497 unsigned char *buf_pos = NULL;
498 MMCamcorderVideoStreamDataType *stream = NULL;
501 int num_buffer_key = 0;
502 int buffer_key[BUFFER_MAX_PLANE_NUM] = {0, };
503 tbm_bo buffer_bo[BUFFER_MAX_PLANE_NUM] = {NULL, };
504 tbm_bo_handle buffer_bo_handle[BUFFER_MAX_PLANE_NUM] = {{.ptr = NULL}, };
505 camera_media_packet_data *mp_data = NULL;
507 muse_camera_msg_get(tbm_key, recv_msg);
508 muse_camera_msg_get(num_buffer_key, recv_msg);
509 muse_camera_msg_get_array(buffer_key, recv_msg);
511 memset(&frame, 0x0, sizeof(camera_preview_data_s));
514 LOGE("invalid key %d", tbm_key);
518 /* import tbm bo and get virtual address */
519 if (!_import_tbm_key(cb_info->bufmgr, tbm_key, &bo, &bo_handle)) {
520 LOGE("failed to import key %d", tbm_key);
522 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
523 cb_info->fd, cb_info, INT, tbm_key);
527 buf_pos = (unsigned char *)bo_handle.ptr;
529 /* get stream info */
530 stream = (MMCamcorderVideoStreamDataType *)buf_pos;
532 for (i = 0 ; i < num_buffer_key ; i++) {
533 /* import buffer bo and get virtual address */
534 if (!_import_tbm_key(cb_info->bufmgr, buffer_key[i], &buffer_bo[i], &buffer_bo_handle[i])) {
535 LOGE("failed to import buffer key %d", buffer_key[i]);
537 /* release imported bo */
538 for (i -= 1 ; i >= 0 ; i--)
539 _release_imported_bo(&buffer_bo[i]);
541 _release_imported_bo(&bo);
543 /* send return buffer */
544 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
545 cb_info->fd, cb_info, INT, tbm_key);
550 if (cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW]) {
552 if (stream->format == MM_PIXEL_FORMAT_ITLV_JPEG_UYVY)
553 frame.format = MM_PIXEL_FORMAT_UYVY;
555 frame.format = stream->format;
556 frame.width = stream->width;
557 frame.height = stream->height;
558 frame.timestamp = stream->timestamp;
559 frame.num_of_planes = stream->num_planes;
561 if (num_buffer_key == 0) {
563 buf_pos += sizeof(MMCamcorderVideoStreamDataType);
565 if (stream->format == MM_PIXEL_FORMAT_ENCODED_H264) {
566 frame.data.encoded_plane.data = buf_pos;
567 frame.data.encoded_plane.size = stream->data.encoded.length_data;
568 total_size = stream->data.encoded.length_data;
570 switch (stream->num_planes) {
572 frame.data.single_plane.yuv = buf_pos;
573 frame.data.single_plane.size = stream->data.yuv420.length_yuv;
574 total_size = stream->data.yuv420.length_yuv;
577 frame.data.double_plane.y = buf_pos;
578 frame.data.double_plane.y_size = stream->data.yuv420sp.length_y;
579 buf_pos += stream->data.yuv420sp.length_y;
580 frame.data.double_plane.uv = buf_pos;
581 frame.data.double_plane.uv_size = stream->data.yuv420sp.length_uv;
582 total_size = stream->data.yuv420sp.length_y + \
583 stream->data.yuv420sp.length_uv;
586 frame.data.triple_plane.y = buf_pos;
587 frame.data.triple_plane.y_size = stream->data.yuv420p.length_y;
588 buf_pos += stream->data.yuv420p.length_y;
589 frame.data.triple_plane.u = buf_pos;
590 frame.data.triple_plane.u_size = stream->data.yuv420p.length_u;
591 buf_pos += stream->data.yuv420p.length_u;
592 frame.data.triple_plane.v = buf_pos;
593 frame.data.triple_plane.v_size = stream->data.yuv420p.length_v;
594 total_size = stream->data.yuv420p.length_y + \
595 stream->data.yuv420p.length_u + \
596 stream->data.yuv420p.length_v;
604 switch (stream->num_planes) {
606 frame.data.single_plane.yuv = buffer_bo_handle[0].ptr;
607 frame.data.single_plane.size = stream->data.yuv420.length_yuv;
608 total_size = stream->data.yuv420.length_yuv;
611 frame.data.double_plane.y = buffer_bo_handle[0].ptr;
612 if (stream->num_planes == (unsigned int)num_buffer_key)
613 frame.data.double_plane.uv = buffer_bo_handle[1].ptr;
615 frame.data.double_plane.uv = buffer_bo_handle[0].ptr + stream->data.yuv420sp.length_y;
616 frame.data.double_plane.y_size = stream->data.yuv420sp.length_y;
617 frame.data.double_plane.uv_size = stream->data.yuv420sp.length_uv;
618 total_size = stream->data.yuv420sp.length_y + \
619 stream->data.yuv420sp.length_uv;
622 frame.data.triple_plane.y = buffer_bo_handle[0].ptr;
623 if (stream->num_planes == (unsigned int)num_buffer_key) {
624 frame.data.triple_plane.u = buffer_bo_handle[1].ptr;
625 frame.data.triple_plane.v = buffer_bo_handle[2].ptr;
627 frame.data.triple_plane.u = buffer_bo_handle[0].ptr + stream->data.yuv420p.length_y;
628 frame.data.triple_plane.v = buffer_bo_handle[1].ptr + stream->data.yuv420p.length_u;
630 frame.data.triple_plane.y_size = stream->data.yuv420p.length_y;
631 frame.data.triple_plane.u_size = stream->data.yuv420p.length_u;
632 frame.data.triple_plane.v_size = stream->data.yuv420p.length_v;
633 total_size = stream->data.yuv420p.length_y + \
634 stream->data.yuv420p.length_u + \
635 stream->data.yuv420p.length_v;
643 LOGD("PREVIEW_CB - format %d, %dx%d, size %d plane num %d",
644 frame.format, frame.width, frame.height, total_size, frame.num_of_planes);
647 ((camera_preview_cb)cb_info->user_cb[event])(&frame, cb_info->user_data[event]);
649 /*LOGD("PREVIEW_CB retuned");*/
652 if (cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW]) {
653 media_packet_h pkt = NULL;
654 tbm_surface_h tsurf = NULL;
655 uint32_t bo_format = 0;
657 media_format_mimetype_e mimetype = MEDIA_FORMAT_NV12;
658 bool make_pkt_fmt = false;
659 tbm_surface_info_s tsurf_info;
661 memset(&tsurf_info, 0x0, sizeof(tbm_surface_info_s));
663 /* unmap buffer bo */
664 for (i = 0 ; i < num_buffer_key ; i++) {
666 tbm_bo_unmap(buffer_bo[i]);
669 /* create tbm surface */
670 for (i = 0 ; i < BUFFER_MAX_PLANE_NUM ; i++)
671 tsurf_info.planes[i].stride = stream->stride[i];
673 /* get tbm surface format */
674 ret = _camera_get_tbm_surface_format(stream->format, &bo_format);
675 ret |= _camera_get_media_packet_mimetype(stream->format, &mimetype);
677 if (num_buffer_key > 0 && ret == CAMERA_ERROR_NONE) {
678 tsurf_info.width = stream->width;
679 tsurf_info.height = stream->height;
680 tsurf_info.format = bo_format;
681 tsurf_info.bpp = tbm_surface_internal_get_bpp(bo_format);
682 tsurf_info.num_planes = tbm_surface_internal_get_num_planes(bo_format);
685 case TBM_FORMAT_NV12:
686 case TBM_FORMAT_NV21:
687 tsurf_info.planes[0].size = stream->stride[0] * stream->elevation[0];
688 tsurf_info.planes[1].size = stream->stride[1] * stream->elevation[1];
689 tsurf_info.planes[0].offset = 0;
690 if (num_buffer_key == 1)
691 tsurf_info.planes[1].offset = tsurf_info.planes[0].size;
692 tsurf_info.size = tsurf_info.planes[0].size + tsurf_info.planes[1].size;
694 case TBM_FORMAT_YUV420:
695 case TBM_FORMAT_YVU420:
696 tsurf_info.planes[0].size = stream->stride[0] * stream->elevation[0];
697 tsurf_info.planes[1].size = stream->stride[1] * stream->elevation[1];
698 tsurf_info.planes[2].size = stream->stride[2] * stream->elevation[2];
699 tsurf_info.planes[0].offset = 0;
700 if (num_buffer_key == 1) {
701 tsurf_info.planes[1].offset = tsurf_info.planes[0].size;
702 tsurf_info.planes[2].offset = tsurf_info.planes[0].size + tsurf_info.planes[1].size;
704 tsurf_info.size = tsurf_info.planes[0].size + tsurf_info.planes[1].size + tsurf_info.planes[2].size;
706 case TBM_FORMAT_UYVY:
707 case TBM_FORMAT_YUYV:
708 tsurf_info.planes[0].size = (stream->stride[0] * stream->elevation[0]) << 1;
709 tsurf_info.planes[0].offset = 0;
710 tsurf_info.size = tsurf_info.planes[0].size;
716 tsurf = tbm_surface_internal_create_with_bos(&tsurf_info, buffer_bo, num_buffer_key);
717 /*LOGD("tbm surface %p", tsurf);*/
721 /* check media packet format */
722 if (cb_info->pkt_fmt) {
723 int pkt_fmt_width = 0;
724 int pkt_fmt_height = 0;
725 media_format_mimetype_e pkt_fmt_mimetype = MEDIA_FORMAT_NV12;
727 media_format_get_video_info(cb_info->pkt_fmt, &pkt_fmt_mimetype, &pkt_fmt_width, &pkt_fmt_height, NULL, NULL);
728 if (pkt_fmt_mimetype != mimetype ||
729 pkt_fmt_width != stream->width ||
730 pkt_fmt_height != stream->height) {
731 LOGW("different format. current 0x%x, %dx%d, new 0x%x, %dx%d",
732 pkt_fmt_mimetype, pkt_fmt_width, pkt_fmt_height, mimetype, stream->width, stream->height);
733 media_format_unref(cb_info->pkt_fmt);
734 cb_info->pkt_fmt = NULL;
741 /* create packet format */
743 LOGW("make new pkt_fmt - mimetype 0x%x, %dx%d", mimetype, stream->width, stream->height);
744 ret = media_format_create(&cb_info->pkt_fmt);
745 if (ret == MEDIA_FORMAT_ERROR_NONE) {
746 ret = media_format_set_video_mime(cb_info->pkt_fmt, mimetype);
747 ret |= media_format_set_video_width(cb_info->pkt_fmt, stream->width);
748 ret |= media_format_set_video_height(cb_info->pkt_fmt, stream->height);
749 LOGW("media_format_set_video_mime,width,height ret : 0x%x", ret);
751 LOGW("media_format_create failed");
755 /* create media packet */
756 ret = media_packet_create_from_tbm_surface(cb_info->pkt_fmt,
757 tsurf, (media_packet_finalize_cb)_camera_media_packet_finalize,
758 (void *)cb_info, &pkt);
759 if (ret != MEDIA_PACKET_ERROR_NONE) {
760 LOGE("media_packet_create_from_tbm_surface failed");
762 tbm_surface_destroy(tsurf);
766 LOGE("failed to create tbm surface %dx%d, format %d, num_buffer_key %d",
767 stream->width, stream->height, stream->format, num_buffer_key);
771 /*LOGD("media packet %p, internal buffer %p", pkt, stream->internal_buffer);*/
773 mp_data = g_new0(camera_media_packet_data, 1);
775 mp_data->tbm_key = tbm_key;
776 mp_data->num_buffer_key = num_buffer_key;
778 for (i = 0 ; i < num_buffer_key ; i++)
779 mp_data->buffer_bo[i] = buffer_bo[i];
781 /* set media packet data */
782 ret = media_packet_set_extra(pkt, (void *)mp_data);
783 if (ret != MEDIA_PACKET_ERROR_NONE) {
784 LOGE("media_packet_set_extra failed");
791 media_packet_destroy(pkt);
794 int e_type = MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW;
796 /* set timestamp : msec -> nsec */
797 if (media_packet_set_pts(pkt, (uint64_t)(stream->timestamp) * 1000000) != MEDIA_PACKET_ERROR_NONE)
798 LOGW("media_packet_set_pts failed");
800 /* call media packet callback */
801 ((camera_media_packet_preview_cb)cb_info->user_cb[e_type])(pkt, cb_info->user_data[e_type]);
804 LOGE("failed to alloc media packet data");
809 /* send message for preview callback return */
810 muse_camera_msg_send_no_return(MUSE_CAMERA_API_PREVIEW_CB_RETURN, cb_info->fd, cb_info);
812 if (mp_data == NULL) {
813 /* release imported bo */
814 for (i = 0 ; i < num_buffer_key ; i++)
815 _release_imported_bo(&buffer_bo[i]);
817 /* unmap and unref tbm bo */
818 _release_imported_bo(&bo);
821 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
822 cb_info->fd, cb_info, INT, tbm_key);
824 /*LOGD("return buffer Done");*/
828 case MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS:
832 muse_camera_msg_get(percent, recv_msg);
834 LOGD("HDR progress - %d \%", percent);
836 ((camera_attr_hdr_progress_cb)cb_info->user_cb[event])(percent, cb_info->user_data[event]);
839 case MUSE_CAMERA_EVENT_TYPE_INTERRUPTED:
845 muse_camera_msg_get(policy, recv_msg);
846 muse_camera_msg_get(previous, recv_msg);
847 muse_camera_msg_get(current, recv_msg);
849 LOGD("INTERRUPTED - policy %d, state previous %d, current %d",
850 policy, previous, current);
852 ((camera_interrupted_cb)cb_info->user_cb[event])((camera_policy_e)policy,
853 (camera_state_e)previous, (camera_state_e)current, cb_info->user_data[event]);
856 case MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION:
859 camera_detected_face_s *faces = NULL;
861 muse_camera_msg_get(count, recv_msg);
862 muse_camera_msg_get(tbm_key, recv_msg);
864 if (count > 0 && tbm_key > 0) {
865 LOGD("FACE_DETECTION - count %d, tbm_key %d", count, tbm_key);
867 if (!_import_tbm_key(cb_info->bufmgr, tbm_key, &bo, &bo_handle))
871 faces = bo_handle.ptr;
873 ((camera_face_detected_cb)cb_info->user_cb[event])(faces, count, cb_info->user_data[event]);
879 for (i = 0 ; i < count ; i++) {
880 LOGD("id[%2d] - score %d, position (%d,%d,%dx%d)",
881 i, faces[i].score, faces[i].x, faces[i].y, faces[i].width, faces[i].height);
887 _release_imported_bo(&bo);
890 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
891 cb_info->fd, cb_info, INT, tbm_key);
893 LOGD("return buffer done");
895 LOGE("invalid message - count %d, key %d", count, tbm_key);
899 case MUSE_CAMERA_EVENT_TYPE_ERROR:
902 int current_state = 0;
904 muse_camera_msg_get(error, recv_msg);
905 muse_camera_msg_get(current_state, recv_msg);
907 LOGE("ERROR - error 0x%x, current_state %d", error, current_state);
909 ((camera_error_cb)cb_info->user_cb[event])((camera_error_e)error,
910 (camera_state_e)current_state, cb_info->user_data[event]);
913 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_RESOLUTION:
914 muse_camera_msg_get(param1, recv_msg);
915 muse_camera_msg_get(param2, recv_msg);
917 LOGD("SUPPORTED_PREVIEW_RESOLUTION - %d x %d", param1, param2);
919 ((camera_supported_preview_resolution_cb)cb_info->user_cb[event])(param1, param2, cb_info->user_data[event]);
921 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_RESOLUTION:
922 muse_camera_msg_get(param1, recv_msg);
923 muse_camera_msg_get(param2, recv_msg);
925 LOGD("SUPPORTED_CAPTURE_RESOLUTION - %d x %d", param1, param2);
927 ((camera_supported_capture_resolution_cb)cb_info->user_cb[event])(param1, param2, cb_info->user_data[event]);
929 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_FORMAT:
930 muse_camera_msg_get(param1, recv_msg);
932 LOGD("SUPPORTED_CAPTURE_FORMAT - %d ", param1);
934 ((camera_supported_capture_format_cb)cb_info->user_cb[event])((camera_pixel_format_e)param1, cb_info->user_data[event]);
936 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_FORMAT:
937 muse_camera_msg_get(param1, recv_msg);
939 LOGD("SUPPORTED_PREVIEW_FORMAT - %d ", param1);
941 ((camera_supported_preview_format_cb)cb_info->user_cb[event])((camera_pixel_format_e)param1, cb_info->user_data[event]);
943 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_AF_MODE:
944 muse_camera_msg_get(param1, recv_msg);
946 LOGD("SUPPORTED_AF_MODE - %d ", param1);
948 ((camera_attr_supported_af_mode_cb)cb_info->user_cb[event])((camera_attr_af_mode_e)param1, cb_info->user_data[event]);
950 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EXPOSURE_MODE:
951 muse_camera_msg_get(param1, recv_msg);
953 LOGD("SUPPORTED_EXPOSURE_MODE - %d ", param1);
955 ((camera_attr_supported_exposure_mode_cb)cb_info->user_cb[event])((camera_attr_exposure_mode_e)param1, cb_info->user_data[event]);
957 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_ISO:
958 muse_camera_msg_get(param1, recv_msg);
960 LOGD("SUPPORTED_ISO - %d ", param1);
962 ((camera_attr_supported_iso_cb)cb_info->user_cb[event])((camera_attr_iso_e)param1, cb_info->user_data[event]);
964 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_WHITEBALANCE:
965 muse_camera_msg_get(param1, recv_msg);
967 LOGD("SUPPORTED_WHITEBALANCE - %d ", param1);
969 ((camera_attr_supported_whitebalance_cb)cb_info->user_cb[event])((camera_attr_whitebalance_e)param1, cb_info->user_data[event]);
971 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EFFECT:
972 muse_camera_msg_get(param1, recv_msg);
974 LOGD("SUPPORTED_EFFECT - %d ", param1);
976 ((camera_attr_supported_effect_cb)cb_info->user_cb[event])((camera_attr_effect_mode_e)param1, cb_info->user_data[event]);
978 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_SCENE_MODE:
979 muse_camera_msg_get(param1, recv_msg);
981 LOGD("SUPPORTED_SCENE_MODE - %d ", param1);
983 ((camera_attr_supported_scene_mode_cb)cb_info->user_cb[event])((camera_attr_scene_mode_e)param1, cb_info->user_data[event]);
985 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FLASH_MODE:
986 muse_camera_msg_get(param1, recv_msg);
988 LOGD("SUPPORTED_FLASH_MODE - %d ", param1);
990 ((camera_attr_supported_flash_mode_cb)cb_info->user_cb[event])((camera_attr_flash_mode_e)param1, cb_info->user_data[event]);
992 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS:
993 muse_camera_msg_get(param1, recv_msg);
995 LOGD("SUPPORTED_FPS - %d ", param1);
997 ((camera_attr_supported_fps_cb)cb_info->user_cb[event])((camera_attr_fps_e)param1, cb_info->user_data[event]);
999 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS_BY_RESOLUTION:
1000 muse_camera_msg_get(param1, recv_msg);
1002 LOGD("SUPPORTED_FPS_BY_RESOLUTION - %d ", param1);
1004 ((camera_attr_supported_fps_cb)cb_info->user_cb[event])((camera_attr_fps_e)param1, cb_info->user_data[event]);
1006 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_FLIP:
1007 muse_camera_msg_get(param1, recv_msg);
1009 LOGD("SUPPORTED_STREAM_FLIP - %d ", param1);
1011 ((camera_attr_supported_stream_flip_cb)cb_info->user_cb[event])((camera_flip_e)param1, cb_info->user_data[event]);
1013 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION:
1014 muse_camera_msg_get(param1, recv_msg);
1016 LOGD("SUPPORTED_STREAM_ROTATION - %d ", param1);
1018 ((camera_attr_supported_stream_rotation_cb)cb_info->user_cb[event])((camera_rotation_e)param1, cb_info->user_data[event]);
1020 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE:
1021 muse_camera_msg_get(param1, recv_msg);
1023 LOGD("SUPPORTED_THEATER_MODE - %d ", param1);
1025 ((camera_attr_supported_theater_mode_cb)cb_info->user_cb[event])((camera_attr_theater_mode_e)param1, cb_info->user_data[event]);
1027 case MUSE_CAMERA_EVENT_TYPE_CAPTURE:
1029 camera_image_data_s *rImage = NULL;
1030 camera_image_data_s *rPostview = NULL;
1031 camera_image_data_s *rThumbnail = NULL;
1032 unsigned char *buf_pos = NULL;
1033 int is_postview = 0;
1034 int is_thumbnail = 0;
1036 muse_camera_msg_get(tbm_key, recv_msg);
1037 muse_camera_msg_get(is_postview, recv_msg);
1038 muse_camera_msg_get(is_thumbnail, recv_msg);
1040 LOGD("camera capture callback came in. key %d, postview %d, thumbnail %d",
1041 tbm_key, is_postview, is_thumbnail);
1044 LOGE("invalid key %d", tbm_key);
1048 /* import tbm bo and get virtual address */
1049 if (!_import_tbm_key(cb_info->bufmgr, tbm_key, &bo, &bo_handle))
1052 buf_pos = (unsigned char *)bo_handle.ptr;
1053 rImage = (camera_image_data_s *)buf_pos;
1054 rImage->data = buf_pos + sizeof(camera_image_data_s);
1055 buf_pos += sizeof(camera_image_data_s) + rImage->size;
1058 rPostview = (camera_image_data_s *)buf_pos;
1059 LOGD("rPostview->size : %d", rPostview->size);
1060 rPostview->data = buf_pos + sizeof(camera_image_data_s);
1061 buf_pos += sizeof(camera_image_data_s) + rPostview->size;
1065 rThumbnail = (camera_image_data_s *)buf_pos;
1066 LOGD("rThumbnail->size : %d", rThumbnail->size);
1067 rThumbnail->data = buf_pos + sizeof(camera_image_data_s);
1068 buf_pos += sizeof(camera_image_data_s) + rThumbnail->size;
1071 LOGD("image info %dx%d, size : %d", rImage->height, rImage->width, rImage->size);
1073 ((camera_capturing_cb)cb_info->user_cb[event])(rImage, rPostview, rThumbnail, cb_info->user_data[event]);
1075 /* unmap and unref tbm bo */
1076 _release_imported_bo(&bo);
1079 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
1080 cb_info->fd, cb_info, INT, tbm_key);
1082 LOGD("return buffer done");
1085 case MUSE_CAMERA_EVENT_TYPE_VIDEO_FRAME_RENDER_ERROR:
1088 LOGW("Unknown event : %d", event);
1095 static bool _camera_idle_event_callback(void *data)
1097 camera_cb_info_s *cb_info = NULL;
1098 camera_idle_event_s *cam_idle_event = (camera_idle_event_s *)data;
1100 if (cam_idle_event == NULL) {
1101 LOGE("cam_idle_event is NULL");
1106 g_mutex_lock(&cam_idle_event->event_mutex);
1108 cb_info = cam_idle_event->cb_info;
1109 if (cb_info == NULL) {
1110 LOGW("camera cb_info is NULL. event %d", cam_idle_event->event);
1111 goto IDLE_EVENT_CALLBACK_DONE;
1114 /* remove event from list */
1115 g_mutex_lock(&cb_info->idle_event_mutex);
1116 if (cb_info->idle_event_list)
1117 cb_info->idle_event_list = g_list_remove(cb_info->idle_event_list, (gpointer)cam_idle_event);
1119 /*LOGD("remove camera idle event %p, %p", cam_idle_event, cb_info->idle_event_list);*/
1120 g_mutex_unlock(&cb_info->idle_event_mutex);
1123 _client_user_callback(cam_idle_event->cb_info, cam_idle_event->recv_msg, cam_idle_event->event);
1125 /* send signal for waiting thread */
1126 g_cond_signal(&cb_info->idle_event_cond);
1128 IDLE_EVENT_CALLBACK_DONE:
1129 /* unlock and release event */
1130 g_mutex_unlock(&cam_idle_event->event_mutex);
1131 g_mutex_clear(&cam_idle_event->event_mutex);
1133 free(cam_idle_event);
1134 cam_idle_event = NULL;
1139 static void *_camera_msg_handler_func(gpointer data)
1144 int event_class = 0;
1145 camera_message_s *cam_msg = NULL;
1146 camera_idle_event_s *cam_idle_event = NULL;
1147 camera_cb_info_s *cb_info = (camera_cb_info_s *)data;
1149 if (cb_info == NULL) {
1150 LOGE("cb_info NULL");
1156 g_mutex_lock(&cb_info->msg_handler_mutex);
1158 while (g_atomic_int_get(&cb_info->msg_handler_running)) {
1159 if (g_queue_is_empty(cb_info->msg_queue)) {
1160 LOGD("signal wait...");
1161 g_cond_wait(&cb_info->msg_handler_cond, &cb_info->msg_handler_mutex);
1162 LOGD("signal received");
1164 if (g_atomic_int_get(&cb_info->msg_handler_running) == 0) {
1165 LOGD("stop event thread");
1170 cam_msg = (camera_message_s *)g_queue_pop_head(cb_info->msg_queue);
1172 g_mutex_unlock(&cb_info->msg_handler_mutex);
1174 if (cam_msg == NULL) {
1175 LOGE("NULL message");
1176 g_mutex_lock(&cb_info->msg_handler_mutex);
1182 if (api < MUSE_CAMERA_API_MAX) {
1183 g_mutex_lock(&cb_info->api_mutex[api]);
1185 if (muse_camera_msg_get(ret, cam_msg->recv_msg)) {
1186 cb_info->api_ret[api] = ret;
1187 cb_info->api_activating[api] = 1;
1189 LOGD("camera api %d - return 0x%x", ret);
1191 g_cond_signal(&cb_info->api_cond[api]);
1193 LOGE("failed to get camera ret for api %d, msg %s", api, cam_msg->recv_msg);
1196 g_mutex_unlock(&cb_info->api_mutex[api]);
1197 } else if (api == MUSE_CAMERA_CB_EVENT) {
1201 if (!muse_camera_msg_get(event, cam_msg->recv_msg) ||
1202 !muse_camera_msg_get(event_class, cam_msg->recv_msg)) {
1203 LOGE("failed to get camera event %d, class %d", event, event_class);
1208 g_mutex_lock(&cb_info->msg_handler_mutex);
1212 switch (event_class) {
1213 case MUSE_CAMERA_EVENT_CLASS_THREAD_SUB:
1214 _client_user_callback(cb_info, cam_msg->recv_msg, event);
1216 case MUSE_CAMERA_EVENT_CLASS_THREAD_MAIN:
1217 cam_idle_event = (camera_idle_event_s *)malloc(sizeof(camera_idle_event_s));
1218 if (cam_idle_event == NULL) {
1219 LOGE("cam_idle_event alloc failed");
1223 cam_idle_event->event = event;
1224 cam_idle_event->cb_info = cb_info;
1225 g_mutex_init(&cam_idle_event->event_mutex);
1226 memcpy(cam_idle_event->recv_msg, cam_msg->recv_msg, sizeof(cam_idle_event->recv_msg));
1228 LOGD("add camera event[%d, %p] to IDLE", event, cam_idle_event);
1230 g_mutex_lock(&cb_info->idle_event_mutex);
1231 cb_info->idle_event_list = g_list_append(cb_info->idle_event_list, (gpointer)cam_idle_event);
1232 g_mutex_unlock(&cb_info->idle_event_mutex);
1234 g_idle_add_full(G_PRIORITY_DEFAULT,
1235 (GSourceFunc)_camera_idle_event_callback,
1236 (gpointer)cam_idle_event,
1240 LOGE("unknown camera event class %d", event_class);
1244 LOGE("unknown camera api[%d] message[%s]", api, cam_msg->recv_msg);
1250 g_mutex_lock(&cb_info->msg_handler_mutex);
1253 /* remove remained event */
1254 while (!g_queue_is_empty(cb_info->msg_queue)) {
1255 cam_msg = (camera_message_s *)g_queue_pop_head(cb_info->msg_queue);
1257 LOGD("remove camera message %p", cam_msg);
1261 LOGW("NULL camera message");
1265 g_mutex_unlock(&cb_info->msg_handler_mutex);
1272 static void _camera_remove_idle_event_all(camera_cb_info_s *cb_info)
1274 camera_idle_event_s *cam_idle_event = NULL;
1275 gboolean ret = TRUE;
1277 gint64 end_time = 0;
1279 if (cb_info == NULL) {
1280 LOGE("cb_info is NULL");
1284 g_mutex_lock(&cb_info->idle_event_mutex);
1286 if (cb_info->idle_event_list == NULL) {
1287 LOGD("No idle event is remained.");
1289 list = cb_info->idle_event_list;
1292 cam_idle_event = list->data;
1293 list = g_list_next(list);
1295 if (!cam_idle_event) {
1296 LOGW("Fail to remove idle event. The event is NULL");
1298 if (g_mutex_trylock(&cam_idle_event->event_mutex)) {
1299 ret = g_idle_remove_by_data(cam_idle_event);
1301 LOGD("remove idle event [%p], ret[%d]", cam_idle_event, ret);
1304 cam_idle_event->cb_info = NULL;
1305 LOGW("idle callback for event %p will be called later", cam_idle_event);
1308 cb_info->idle_event_list = g_list_remove(cb_info->idle_event_list, (gpointer)cam_idle_event);
1310 g_mutex_unlock(&cam_idle_event->event_mutex);
1313 g_mutex_clear(&cam_idle_event->event_mutex);
1315 free(cam_idle_event);
1316 cam_idle_event = NULL;
1318 LOGD("remove idle event done");
1321 LOGW("event lock failed. it's being called...");
1323 end_time = g_get_monotonic_time() + G_TIME_SPAN_MILLISECOND * 100;
1325 if (g_cond_wait_until(&cb_info->idle_event_cond, &cb_info->idle_event_mutex, end_time))
1326 LOGW("signal received");
1333 g_list_free(cb_info->idle_event_list);
1334 cb_info->idle_event_list = NULL;
1337 g_mutex_unlock(&cb_info->idle_event_mutex);
1342 static void *_camera_msg_recv_func(gpointer data)
1351 int prev_state = CAMERA_STATE_NONE;
1352 char *recv_msg = NULL;
1353 char **parse_str = NULL;
1354 camera_cb_info_s *cb_info = (camera_cb_info_s *)data;
1356 if (cb_info == NULL) {
1357 LOGE("cb_info NULL");
1363 parse_str = (char **)malloc(sizeof(char *) * CAMERA_PARSE_STRING_SIZE);
1364 if (parse_str == NULL) {
1365 LOGE("parse_str malloc failed");
1369 for (i = 0 ; i < CAMERA_PARSE_STRING_SIZE ; i++) {
1370 parse_str[i] = (char *)malloc(sizeof(char) * MUSE_CAMERA_MSG_MAX_LENGTH);
1371 if (parse_str[i] == NULL) {
1372 LOGE("parse_str[%d] malloc failed", i);
1373 goto CB_HANDLER_EXIT;
1377 recv_msg = cb_info->recv_msg;
1379 while (g_atomic_int_get(&cb_info->msg_recv_running)) {
1380 ret = muse_core_ipc_recv_msg(cb_info->fd, recv_msg);
1383 recv_msg[ret] = '\0';
1389 /*LOGD("recvMSg : %s, length : %d", recv_msg, ret);*/
1391 /* Need to split the combined entering msgs.
1392 This module supports up to 200 combined msgs. */
1393 for (str_pos = 0; str_pos < ret; str_pos++) {
1394 if (recv_msg[str_pos] == '}') {
1395 memset(parse_str[num_token], 0x0, sizeof(char) * MUSE_CAMERA_MSG_MAX_LENGTH);
1396 strncpy(parse_str[num_token], recv_msg + prev_pos, str_pos - prev_pos + 1);
1397 LOGD("splitted msg : [%s], Index : %d", parse_str[num_token], num_token);
1398 prev_pos = str_pos+1;
1403 /*LOGD("num_token : %d", num_token);*/
1405 /* Re-construct to the useful single msg. */
1406 for (i = 0; i < num_token; i++) {
1407 if (i >= CAMERA_PARSE_STRING_SIZE) {
1408 LOGE("invalid token index %d", i);
1415 if (!muse_camera_msg_get(api, parse_str[i])) {
1416 LOGE("failed to get camera api");
1420 if (muse_camera_msg_get(api_class, parse_str[i]))
1421 LOGD("camera api_class[%d]", api_class);
1423 if (api_class == MUSE_CAMERA_API_CLASS_IMMEDIATE) {
1424 g_mutex_lock(&cb_info->api_mutex[api]);
1426 if (!muse_camera_msg_get(ret, parse_str[i])) {
1427 LOGE("failed to get camera ret");
1428 g_mutex_unlock(&cb_info->api_mutex[api]);
1432 cb_info->api_ret[api] = ret;
1433 cb_info->api_activating[api] = 1;
1435 if (api == MUSE_CAMERA_API_CREATE) {
1436 if (ret != CAMERA_ERROR_NONE) {
1437 g_atomic_int_set(&cb_info->msg_recv_running, 0);
1438 LOGE("camera create error 0x%x. close client cb handler", ret);
1440 } else if (api == MUSE_CAMERA_API_DESTROY) {
1441 if (ret == CAMERA_ERROR_NONE) {
1442 g_atomic_int_set(&cb_info->msg_recv_running, 0);
1443 LOGD("camera destroy done. close client cb handler");
1445 } else if (api == MUSE_CAMERA_API_START_PREVIEW) {
1446 muse_camera_msg_get(prev_state, parse_str[i]);
1447 cb_info->prev_state = prev_state;
1450 g_cond_signal(&cb_info->api_cond[api]);
1451 g_mutex_unlock(&cb_info->api_mutex[api]);
1452 } else if (api_class == MUSE_CAMERA_API_CLASS_THREAD_SUB || api == MUSE_CAMERA_CB_EVENT) {
1453 camera_message_s *cam_msg = g_new0(camera_message_s, 1);
1454 if (cam_msg == NULL) {
1455 LOGE("failed to alloc cam_msg");
1460 memcpy(cam_msg->recv_msg, parse_str[i], sizeof(cam_msg->recv_msg));
1462 LOGD("add camera message to queue : api %d", api);
1464 g_mutex_lock(&cb_info->msg_handler_mutex);
1465 g_queue_push_tail(cb_info->msg_queue, (gpointer)cam_msg);
1466 g_cond_signal(&cb_info->msg_handler_cond);
1467 g_mutex_unlock(&cb_info->msg_handler_mutex);
1469 LOGW("unknown camera api %d and api_class %d", api, api_class);
1475 LOGD("client cb exit");
1479 for (i = 0 ; i < CAMERA_PARSE_STRING_SIZE ; i++) {
1482 parse_str[i] = NULL;
1493 static camera_cb_info_s *_client_callback_new(gint sockfd)
1495 camera_cb_info_s *cb_info = NULL;
1496 gint *tmp_activating = NULL;
1497 gint *tmp_ret = NULL;
1500 g_return_val_if_fail(sockfd > 0, NULL);
1502 cb_info = g_new0(camera_cb_info_s, 1);
1503 if (cb_info == NULL) {
1504 LOGE("cb_info failed");
1508 g_mutex_init(&cb_info->msg_handler_mutex);
1509 g_cond_init(&cb_info->msg_handler_cond);
1510 g_mutex_init(&cb_info->idle_event_mutex);
1511 g_cond_init(&cb_info->idle_event_cond);
1513 for (i = 0 ; i < MUSE_CAMERA_API_MAX ; i++) {
1514 g_mutex_init(&cb_info->api_mutex[i]);
1515 g_cond_init(&cb_info->api_cond[i]);
1518 tmp_activating = g_new0(gint, MUSE_CAMERA_API_MAX);
1519 if (tmp_activating == NULL) {
1520 LOGE("tmp_activating failed");
1524 tmp_ret = g_new0(gint, MUSE_CAMERA_API_MAX);
1525 if (tmp_ret == NULL) {
1526 LOGE("tmp_ret failed");
1530 cb_info->msg_queue = g_queue_new();
1531 if (cb_info->msg_queue == NULL) {
1532 LOGE("msg_queue new failed");
1536 g_atomic_int_set(&cb_info->msg_handler_running, 1);
1537 cb_info->msg_handler_thread = g_thread_try_new("camera_msg_handler",
1538 _camera_msg_handler_func, (gpointer)cb_info, NULL);
1539 if (cb_info->msg_handler_thread == NULL) {
1540 LOGE("message handler thread creation failed");
1544 cb_info->fd = sockfd;
1545 cb_info->api_activating = tmp_activating;
1546 cb_info->api_ret = tmp_ret;
1548 g_atomic_int_set(&cb_info->msg_recv_running, 1);
1549 cb_info->msg_recv_thread = g_thread_try_new("camera_msg_recv",
1550 _camera_msg_recv_func, (gpointer)cb_info, NULL);
1551 if (cb_info->msg_recv_thread == NULL) {
1552 LOGE("message receive thread creation failed");
1560 if (cb_info->msg_handler_thread) {
1561 g_mutex_lock(&cb_info->msg_handler_mutex);
1562 g_atomic_int_set(&cb_info->msg_handler_running, 0);
1563 g_cond_signal(&cb_info->msg_handler_cond);
1564 g_mutex_unlock(&cb_info->msg_handler_mutex);
1566 g_thread_join(cb_info->msg_handler_thread);
1567 g_thread_unref(cb_info->msg_handler_thread);
1568 cb_info->msg_handler_thread = NULL;
1571 for (i = 0 ; i < MUSE_CAMERA_API_MAX ; i++) {
1572 g_mutex_clear(&cb_info->api_mutex[i]);
1573 g_cond_clear(&cb_info->api_cond[i]);
1576 g_mutex_clear(&cb_info->msg_handler_mutex);
1577 g_cond_clear(&cb_info->msg_handler_cond);
1578 g_mutex_clear(&cb_info->idle_event_mutex);
1579 g_cond_clear(&cb_info->idle_event_cond);
1581 if (cb_info->msg_queue) {
1582 g_queue_free(cb_info->msg_queue);
1583 cb_info->msg_queue = NULL;
1590 if (tmp_activating) {
1591 g_free(tmp_activating);
1592 tmp_activating = NULL;
1602 static void _client_callback_destroy(camera_cb_info_s *cb_info)
1606 g_return_if_fail(cb_info != NULL);
1608 LOGD("MSG receive thread[%p] destroy", cb_info->msg_recv_thread);
1610 g_thread_join(cb_info->msg_recv_thread);
1611 g_thread_unref(cb_info->msg_recv_thread);
1612 cb_info->msg_recv_thread = NULL;
1614 LOGD("msg thread removed");
1616 g_mutex_lock(&cb_info->msg_handler_mutex);
1617 g_atomic_int_set(&cb_info->msg_handler_running, 0);
1618 g_cond_signal(&cb_info->msg_handler_cond);
1619 g_mutex_unlock(&cb_info->msg_handler_mutex);
1621 g_thread_join(cb_info->msg_handler_thread);
1622 g_thread_unref(cb_info->msg_handler_thread);
1623 cb_info->msg_handler_thread = NULL;
1625 g_queue_free(cb_info->msg_queue);
1626 cb_info->msg_queue = NULL;
1628 for (i = 0 ; i < MUSE_CAMERA_API_MAX ; i++) {
1629 g_mutex_clear(&cb_info->api_mutex[i]);
1630 g_cond_clear(&cb_info->api_cond[i]);
1633 g_mutex_clear(&cb_info->msg_handler_mutex);
1634 g_cond_clear(&cb_info->msg_handler_cond);
1635 g_mutex_clear(&cb_info->idle_event_mutex);
1636 g_cond_clear(&cb_info->idle_event_cond);
1638 LOGD("event thread removed");
1640 if (cb_info->bufmgr) {
1641 tbm_bufmgr_deinit(cb_info->bufmgr);
1642 cb_info->bufmgr = NULL;
1644 if (cb_info->api_activating) {
1645 g_free(cb_info->api_activating);
1646 cb_info->api_activating = NULL;
1648 if (cb_info->api_ret) {
1649 g_free(cb_info->api_ret);
1650 cb_info->api_ret = NULL;
1652 if (cb_info->pkt_fmt) {
1653 media_format_unref(cb_info->pkt_fmt);
1654 cb_info->pkt_fmt = NULL;
1663 int camera_create(camera_device_e device, camera_h* camera)
1667 int ret = CAMERA_ERROR_NONE;
1669 camera_cli_s *pc = NULL;
1670 tbm_bufmgr bufmgr = NULL;
1672 muse_camera_api_e api = MUSE_CAMERA_API_CREATE;
1673 muse_core_api_module_e muse_module = MUSE_CAMERA;
1674 int device_type = (int)device;
1676 if (camera == NULL) {
1677 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
1678 return CAMERA_ERROR_INVALID_PARAMETER;
1681 bufmgr = tbm_bufmgr_init(-1);
1682 if (bufmgr == NULL) {
1683 LOGE("get tbm bufmgr failed");
1684 return CAMERA_ERROR_INVALID_OPERATION;
1687 sock_fd = muse_core_client_new();
1689 LOGE("muse_core_client_new failed - returned fd %d", sock_fd);
1690 ret = CAMERA_ERROR_INVALID_OPERATION;
1696 sndMsg = muse_core_msg_json_factory_new(api,
1697 MUSE_TYPE_INT, "module", muse_module,
1698 MUSE_TYPE_INT, PARAM_DEVICE_TYPE, device_type,
1699 MUSE_TYPE_INT, "pid", pid,
1702 muse_core_ipc_send_msg(sock_fd, sndMsg);
1703 muse_core_msg_json_factory_free(sndMsg);
1705 pc = g_new0(camera_cli_s, 1);
1707 LOGE("camera_cli_s alloc failed");
1708 ret = CAMERA_ERROR_OUT_OF_MEMORY;
1712 pc->cb_info = _client_callback_new(sock_fd);
1713 if (pc->cb_info == NULL) {
1714 LOGE("cb_info alloc failed");
1715 ret = CAMERA_ERROR_OUT_OF_MEMORY;
1719 LOGD("cb info : %d", pc->cb_info->fd);
1721 ret = _client_wait_for_cb_return(api, pc->cb_info, CALLBACK_TIME_OUT);
1722 if (ret == CAMERA_ERROR_NONE) {
1723 intptr_t handle = 0;
1724 muse_camera_msg_get_pointer(handle, pc->cb_info->recv_msg);
1726 LOGE("Receiving Handle Failed!!");
1727 ret = CAMERA_ERROR_INVALID_OPERATION;
1731 pc->remote_handle = handle;
1732 pc->cb_info->bufmgr = bufmgr;
1734 LOGD("camera create 0x%x", pc->remote_handle);
1735 *camera = (camera_h) pc;
1743 tbm_bufmgr_deinit(bufmgr);
1747 _client_callback_destroy(pc->cb_info);
1753 LOGE("camera create error : 0x%x", ret);
1758 int camera_destroy(camera_h camera)
1760 if (camera == NULL) {
1761 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
1762 return CAMERA_ERROR_INVALID_PARAMETER;
1765 int ret = CAMERA_ERROR_NONE;
1766 muse_camera_api_e api = MUSE_CAMERA_API_DESTROY;
1767 camera_cli_s *pc = (camera_cli_s *)camera;
1772 if (pc->cb_info == NULL) {
1773 LOGE("cb_info NULL, INVALID_PARAMETER");
1774 return CAMERA_ERROR_INVALID_PARAMETER;
1777 sock_fd = pc->cb_info->fd;
1779 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
1780 if (ret == CAMERA_ERROR_NONE) {
1781 if (pc->client_handle) {
1782 mm_camcorder_client_destroy(pc->client_handle);
1783 pc->client_handle = NULL;
1785 _camera_remove_idle_event_all(pc->cb_info);
1786 _client_callback_destroy(pc->cb_info);
1791 g_free(pc->wl_info);
1794 #endif /* HAVE_WAYLAND */
1799 LOGE("camera destroy error : 0x%x", ret);
1805 int camera_start_preview(camera_h camera)
1807 int ret = CAMERA_ERROR_NONE;
1808 muse_camera_api_e api = MUSE_CAMERA_API_START_PREVIEW;
1809 camera_cli_s *pc = (camera_cli_s *)camera;
1811 char caps[MUSE_CAMERA_MSG_MAX_LENGTH] = {0};
1813 if (camera == NULL) {
1814 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
1815 return CAMERA_ERROR_INVALID_PARAMETER;
1818 if (pc->cb_info == NULL) {
1819 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
1820 return CAMERA_ERROR_INVALID_PARAMETER;
1825 sock_fd = pc->cb_info->fd;
1827 if (pc->client_handle == NULL) {
1828 LOGW("set display is not called by application. set NONE type internally");
1829 ret = camera_set_display(camera, CAMERA_DISPLAY_TYPE_NONE, NULL);
1830 if (ret != CAMERA_ERROR_NONE) {
1831 LOGE("Internal camera_set_display failed 0x%x", ret);
1836 muse_camera_msg_send_longtime(api, sock_fd, pc->cb_info, ret);
1838 if (ret != CAMERA_ERROR_NONE) {
1839 LOGE("start preview failed 0x%x", ret);
1843 if (pc->cb_info->prev_state == CAMERA_STATE_CREATED) {
1844 if (muse_camera_msg_get_string(caps, pc->cb_info->recv_msg) == FALSE) {
1845 LOGE("failed to get caps string");
1846 goto _START_PREVIEW_ERROR;
1849 LOGD("caps : %s", caps);
1851 ret = mm_camcorder_client_realize(pc->client_handle, caps);
1852 if (ret != MM_ERROR_NONE) {
1853 LOGE("client realize failed 0x%x", ret);
1854 goto _START_PREVIEW_ERROR;
1858 LOGD("ret : 0x%x", ret);
1860 return CAMERA_ERROR_NONE;
1862 _START_PREVIEW_ERROR:
1863 muse_camera_msg_send_longtime(MUSE_CAMERA_API_STOP_PREVIEW, sock_fd, pc->cb_info, ret);
1865 return CAMERA_ERROR_INVALID_OPERATION;
1868 int camera_stop_preview(camera_h camera)
1870 if (camera == NULL) {
1871 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
1872 return CAMERA_ERROR_INVALID_PARAMETER;
1874 int ret = CAMERA_ERROR_NONE;
1875 camera_cli_s *pc = (camera_cli_s *)camera;
1877 muse_camera_api_e api = MUSE_CAMERA_API_STOP_PREVIEW;
1879 if (pc->cb_info == NULL) {
1880 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
1881 return CAMERA_ERROR_INVALID_PARAMETER;
1884 sock_fd = pc->cb_info->fd;
1886 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
1888 if (ret != CAMERA_ERROR_NONE) {
1889 LOGE("stop preview failed 0x%x", ret);
1893 if (pc->client_handle != NULL) {
1894 if (mm_camcorder_client_unrealize(pc->client_handle) == MM_ERROR_NONE) {
1895 LOGD("client unrealize done");
1897 LOGE("client unrealize failed. restart preview...");
1898 muse_camera_msg_send_longtime(MUSE_CAMERA_API_START_PREVIEW, sock_fd, pc->cb_info, ret);
1899 return CAMERA_ERROR_INVALID_OPERATION;
1902 LOGW("client handle is NULL");
1905 LOGD("ret : 0x%x", ret);
1910 int camera_start_capture(camera_h camera, camera_capturing_cb capturing_cb, camera_capture_completed_cb completed_cb, void *user_data)
1912 if (camera == NULL) {
1913 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
1914 return CAMERA_ERROR_INVALID_PARAMETER;
1916 int ret = CAMERA_ERROR_NONE;
1918 camera_cli_s *pc = (camera_cli_s *)camera;
1919 muse_camera_api_e api = MUSE_CAMERA_API_START_CAPTURE;
1921 int is_capturing_cb = 0;
1922 int is_completed_cb = 0;
1923 LOGD("Enter, handle :%x", pc->remote_handle);
1925 if (pc->cb_info == NULL) {
1926 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
1927 return CAMERA_ERROR_INVALID_PARAMETER;
1930 sock_fd = pc->cb_info->fd;
1932 if (capturing_cb != NULL) {
1933 is_capturing_cb = 1;
1934 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = capturing_cb;
1935 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = user_data;
1938 if (completed_cb != NULL) {
1939 is_completed_cb = 1;
1940 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = completed_cb;
1941 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = user_data;
1944 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, is_capturing_cb, INT, is_completed_cb);
1945 LOGD("is_capturing_cb :%d, is_completed_cb : %d", is_capturing_cb, is_completed_cb);
1946 LOGD("ret : 0x%x", ret);
1950 bool camera_is_supported_continuous_capture(camera_h camera)
1952 if (camera == NULL) {
1953 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
1957 int ret = CAMERA_ERROR_NONE;
1958 camera_cli_s *pc = (camera_cli_s *)camera;
1959 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_CONTINUOUS_CAPTURE;
1962 if (pc->cb_info == NULL) {
1963 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
1964 return CAMERA_ERROR_INVALID_PARAMETER;
1967 sock_fd = pc->cb_info->fd;
1969 LOGD("Enter, remote_handle : %x", pc->remote_handle);
1970 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
1971 LOGD("ret : 0x%x", ret);
1975 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)
1977 if (camera == NULL) {
1978 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
1979 return CAMERA_ERROR_INVALID_PARAMETER;
1982 int ret = CAMERA_ERROR_NONE;
1984 camera_cli_s *pc = (camera_cli_s *)camera;
1985 muse_camera_api_e api = MUSE_CAMERA_API_START_CONTINUOUS_CAPTURE;
1987 LOGD("Enter, handle :%x", pc->remote_handle);
1990 if (pc->cb_info == NULL) {
1991 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
1992 return CAMERA_ERROR_INVALID_PARAMETER;
1994 sock_fd = pc->cb_info->fd;
1996 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = capturing_cb;
1997 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = user_data;
1998 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = completed_cb;
2000 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, count, INT, interval);
2002 LOGD("ret : 0x%x", ret);
2007 int camera_stop_continuous_capture(camera_h camera)
2009 if (camera == NULL) {
2010 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2011 return CAMERA_ERROR_INVALID_PARAMETER;
2015 int ret = CAMERA_ERROR_NONE;
2017 camera_cli_s *pc = (camera_cli_s *)camera;
2018 muse_camera_api_e api = MUSE_CAMERA_API_STOP_CONTINUOUS_CAPTURE;
2019 LOGD("Enter, handle :%x", pc->remote_handle);
2021 if (pc->cb_info == NULL) {
2022 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2023 return CAMERA_ERROR_INVALID_PARAMETER;
2025 sock_fd = pc->cb_info->fd;
2026 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2027 LOGD("ret : 0x%x", ret);
2031 bool camera_is_supported_face_detection(camera_h camera)
2033 if (camera == NULL) {
2034 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2037 int ret = CAMERA_ERROR_NONE;
2039 camera_cli_s *pc = (camera_cli_s *)camera;
2040 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_FACE_DETECTION;
2042 if (pc->cb_info == NULL) {
2043 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2044 return CAMERA_ERROR_INVALID_PARAMETER;
2046 sock_fd = pc->cb_info->fd;
2048 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2049 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2050 LOGD("ret : 0x%x", ret);
2054 bool camera_is_supported_zero_shutter_lag(camera_h camera)
2056 if (camera == NULL) {
2057 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2060 int ret = CAMERA_ERROR_NONE;
2062 camera_cli_s *pc = (camera_cli_s *)camera;
2063 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_ZERO_SHUTTER_LAG;
2065 if (pc->cb_info == NULL) {
2066 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2067 return CAMERA_ERROR_INVALID_PARAMETER;
2069 sock_fd = pc->cb_info->fd;
2071 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2072 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2073 LOGD("ret : 0x%x", ret);
2077 bool camera_is_supported_media_packet_preview_cb(camera_h camera)
2079 if (camera == NULL) {
2080 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2084 int ret = CAMERA_ERROR_NONE;
2086 camera_cli_s *pc = (camera_cli_s *)camera;
2087 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_MEDIA_PACKET_PREVIEW_CB;
2089 if (pc->cb_info == NULL) {
2090 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2091 return CAMERA_ERROR_INVALID_PARAMETER;
2093 sock_fd = pc->cb_info->fd;
2095 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2096 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2097 LOGD("ret : 0x%x", ret);
2101 int camera_get_device_count(camera_h camera, int *device_count)
2103 if (camera == NULL || device_count == NULL) {
2104 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2105 return CAMERA_ERROR_INVALID_PARAMETER;
2107 int ret = CAMERA_ERROR_NONE;
2109 camera_cli_s *pc = (camera_cli_s *)camera;
2110 muse_camera_api_e api = MUSE_CAMERA_API_GET_DEVICE_COUNT;
2112 if (pc->cb_info == NULL) {
2113 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2114 return CAMERA_ERROR_INVALID_PARAMETER;
2116 sock_fd = pc->cb_info->fd;
2117 int get_device_count;
2119 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2120 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2122 if (ret == CAMERA_ERROR_NONE) {
2123 muse_camera_msg_get(get_device_count, pc->cb_info->recv_msg);
2124 *device_count = get_device_count;
2126 LOGD("ret : 0x%x", ret);
2130 int camera_start_face_detection(camera_h camera, camera_face_detected_cb callback, void * user_data)
2132 if (camera == NULL) {
2133 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2134 return CAMERA_ERROR_INVALID_PARAMETER;
2137 int ret = CAMERA_ERROR_NONE;
2139 camera_cli_s *pc = (camera_cli_s *)camera;
2140 muse_camera_api_e api = MUSE_CAMERA_API_START_FACE_DETECTION;
2142 LOGD("Enter, handle :%x", pc->remote_handle);
2144 if (pc->cb_info == NULL) {
2145 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2146 return CAMERA_ERROR_INVALID_PARAMETER;
2148 sock_fd = pc->cb_info->fd;
2149 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION] = callback;
2150 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION] = user_data;
2152 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2153 LOGD("ret : 0x%x", ret);
2157 int camera_stop_face_detection(camera_h camera)
2159 if (camera == NULL) {
2160 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2161 return CAMERA_ERROR_INVALID_PARAMETER;
2164 int ret = CAMERA_ERROR_NONE;
2166 camera_cli_s *pc = (camera_cli_s *)camera;
2167 muse_camera_api_e api = MUSE_CAMERA_API_STOP_FACE_DETECTION;
2168 LOGD("Enter, handle :%x", pc->remote_handle);
2170 if (pc->cb_info == NULL) {
2171 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2172 return CAMERA_ERROR_INVALID_PARAMETER;
2174 sock_fd = pc->cb_info->fd;
2175 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2176 LOGD("ret : 0x%x", ret);
2180 int camera_get_state(camera_h camera, camera_state_e * state)
2182 if (camera == NULL || state == NULL) {
2183 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2184 return CAMERA_ERROR_INVALID_PARAMETER;
2186 int ret = CAMERA_ERROR_NONE;
2188 camera_cli_s *pc = (camera_cli_s *)camera;
2189 muse_camera_api_e api = MUSE_CAMERA_API_GET_STATE;
2191 if (pc->cb_info == NULL) {
2192 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2193 return CAMERA_ERROR_INVALID_PARAMETER;
2195 sock_fd = pc->cb_info->fd;
2198 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2199 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2201 if (ret == CAMERA_ERROR_NONE) {
2202 muse_camera_msg_get(get_state, pc->cb_info->recv_msg);
2203 *state = (camera_state_e)get_state;
2205 LOGD("ret : 0x%x", ret);
2209 int camera_start_focusing(camera_h camera, bool continuous)
2211 if (camera == NULL) {
2212 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2213 return CAMERA_ERROR_INVALID_PARAMETER;
2216 int ret = CAMERA_ERROR_NONE;
2218 camera_cli_s *pc = (camera_cli_s *)camera;
2219 muse_camera_api_e api = MUSE_CAMERA_API_START_FOCUSING;
2221 if (pc->cb_info == NULL) {
2222 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2223 return CAMERA_ERROR_INVALID_PARAMETER;
2225 sock_fd = pc->cb_info->fd;
2226 int is_continuous = (int)continuous;
2228 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2229 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, is_continuous);
2230 LOGD("ret : 0x%x", ret);
2234 int camera_cancel_focusing(camera_h camera)
2236 if (camera == NULL) {
2237 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2238 return CAMERA_ERROR_INVALID_PARAMETER;
2241 int ret = CAMERA_ERROR_NONE;
2243 camera_cli_s *pc = (camera_cli_s *)camera;
2244 muse_camera_api_e api = MUSE_CAMERA_API_CANCEL_FOCUSING;
2246 if (pc->cb_info == NULL) {
2247 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2248 return CAMERA_ERROR_INVALID_PARAMETER;
2250 sock_fd = pc->cb_info->fd;
2252 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2253 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2254 LOGD("ret : 0x%x", ret);
2258 int camera_set_display(camera_h camera, camera_display_type_e type, camera_display_h display)
2260 int ret = CAMERA_ERROR_NONE;
2261 void *set_display_handle = NULL;
2262 int set_surface = MM_DISPLAY_SURFACE_X;
2263 Evas_Object *obj = NULL;
2264 const char *object_type = NULL;
2265 char socket_path[MUSE_CAMERA_MSG_MAX_LENGTH] = {0,};
2267 MMCamWaylandInfo *wl_info = NULL;
2268 #endif /* HAVE_WAYLAND */
2270 if (camera == NULL) {
2271 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2272 return CAMERA_ERROR_INVALID_PARAMETER;
2275 if (type != CAMERA_DISPLAY_TYPE_NONE && display == NULL) {
2276 LOGE("display type[%d] is not NONE, but display handle is NULL", type);
2277 return CAMERA_ERROR_INVALID_PARAMETER;
2280 camera_cli_s *pc = (camera_cli_s *)camera;
2281 muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY;
2283 if (pc->cb_info == NULL) {
2284 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2285 return CAMERA_ERROR_INVALID_PARAMETER;
2287 sock_fd = pc->cb_info->fd;
2289 LOGD("Enter, remote_handle : %x display : 0x%x", pc->remote_handle, display);
2291 if (type == CAMERA_DISPLAY_TYPE_NONE) {
2292 set_display_handle = 0;
2293 set_surface = MM_DISPLAY_SURFACE_NULL;
2294 LOGD("display type NONE");
2296 obj = (Evas_Object *)display;
2297 object_type = evas_object_type_get(obj);
2299 if (type == CAMERA_DISPLAY_TYPE_OVERLAY && !strcmp(object_type, "elm_win")) {
2301 /* set wayland info */
2302 wl_info = _get_wl_info(obj);
2303 if (wl_info == NULL) {
2304 LOGE("failed to get wl_info");
2305 return CAMERA_ERROR_INVALID_OPERATION;
2308 set_display_handle = (void *)wl_info;
2309 #else /* HAVE_WAYLAND */
2310 /* x window overlay surface */
2311 set_display_handle = (void *)elm_win_xwindow_get(obj);
2313 set_surface = MM_DISPLAY_SURFACE_X;
2314 LOGD("display type OVERLAY : handle %p", set_display_handle);
2315 } else if (type == CAMERA_DISPLAY_TYPE_EVAS && !strcmp(object_type, "image")) {
2316 /* evas object surface */
2317 set_display_handle = (void *)display;
2318 set_surface = MM_DISPLAY_SURFACE_EVAS;
2319 LOGD("display type EVAS : handle %p", set_display_handle);
2321 LOGE("unknown evas object [%p,%s] or type [%d] mismatch", obj, object_type, type);
2322 return CAMERA_ERROR_INVALID_PARAMETER;
2325 LOGE("failed to get evas object type from %p", obj);
2326 return CAMERA_ERROR_INVALID_PARAMETER;
2330 pc->display_handle = (intptr_t)set_display_handle;
2332 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2334 if (ret == CAMERA_ERROR_NONE) {
2335 if (pc->client_handle == NULL) {
2336 ret = mm_camcorder_client_create(&pc->client_handle);
2337 if (ret != MM_ERROR_NONE) {
2338 LOGE("camera client create Failed 0x%x", ret);
2339 goto _SET_DISPLAY_ERROR;
2343 if (muse_camera_msg_get_string(socket_path, pc->cb_info->recv_msg) == FALSE) {
2344 LOGE("failed to get socket path");
2345 goto _SET_DISPLAY_ERROR;
2348 LOGD("socket path : %s", socket_path);
2350 ret = mm_camcorder_client_set_socket_path(pc->client_handle, socket_path);
2351 if (ret != MM_ERROR_NONE) {
2352 LOGE("failed to set socket path 0x%x", ret);
2353 goto _SET_DISPLAY_ERROR;
2356 ret = mm_camcorder_set_attributes(pc->client_handle, NULL,
2357 MMCAM_DISPLAY_SURFACE, set_surface,
2359 if (ret != MM_ERROR_NONE) {
2360 LOGE("set display surface failed 0x%x", ret);
2361 goto _SET_DISPLAY_ERROR;
2364 if (type != CAMERA_DISPLAY_TYPE_NONE) {
2365 ret = mm_camcorder_set_attributes(pc->client_handle, NULL,
2366 MMCAM_DISPLAY_HANDLE, set_display_handle, sizeof(void *),
2368 if (ret != MM_ERROR_NONE) {
2369 LOGE("set display handle failed 0x%x", ret);
2370 goto _SET_DISPLAY_ERROR;
2376 g_free(pc->wl_info);
2380 pc->wl_info = wl_info;
2381 #endif /* HAVE_WAYLAND */
2383 return CAMERA_ERROR_NONE;;
2385 LOGE("set display error - 0x%x");
2395 #endif /* HAVE_WAYLAND */
2397 return __convert_camera_error_code(__func__, ret);
2400 int camera_set_preview_resolution(camera_h camera, int width, int height)
2402 if (camera == NULL) {
2403 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2404 return CAMERA_ERROR_INVALID_PARAMETER;
2406 int ret = CAMERA_ERROR_NONE;
2408 camera_cli_s *pc = (camera_cli_s *)camera;
2409 muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_RESOLUTION;
2411 if (pc->cb_info == NULL) {
2412 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2413 return CAMERA_ERROR_INVALID_PARAMETER;
2415 sock_fd = pc->cb_info->fd;
2417 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2418 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, width, INT, height);
2419 LOGD("ret : 0x%x", ret);
2424 int camera_set_capture_resolution(camera_h camera, int width, int height)
2426 if (camera == NULL) {
2427 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2428 return CAMERA_ERROR_INVALID_PARAMETER;
2431 int ret = CAMERA_ERROR_NONE;
2433 camera_cli_s *pc = (camera_cli_s *)camera;
2434 muse_camera_api_e api = MUSE_CAMERA_API_SET_CAPTURE_RESOLUTION;
2436 if (pc->cb_info == NULL) {
2437 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2438 return CAMERA_ERROR_INVALID_PARAMETER;
2440 sock_fd = pc->cb_info->fd;
2442 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2443 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, width, INT, height);
2444 LOGD("ret : 0x%x", ret);
2448 int camera_set_capture_format(camera_h camera, camera_pixel_format_e format)
2450 if (camera == NULL) {
2451 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2452 return CAMERA_ERROR_INVALID_PARAMETER;
2455 int ret = CAMERA_ERROR_NONE;
2456 int set_format = (int)format;
2458 camera_cli_s *pc = (camera_cli_s *)camera;
2459 muse_camera_api_e api = MUSE_CAMERA_API_SET_CAPTURE_FORMAT;
2461 if (pc->cb_info == NULL) {
2462 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2463 return CAMERA_ERROR_INVALID_PARAMETER;
2465 sock_fd = pc->cb_info->fd;
2467 LOGD("Enter, remote_handle : %x, capture_format: %d", pc->remote_handle, set_format);
2468 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_format);
2469 LOGD("ret : 0x%x", ret);
2473 int camera_set_preview_format(camera_h camera, camera_pixel_format_e format)
2475 if (camera == NULL) {
2476 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2477 return CAMERA_ERROR_INVALID_PARAMETER;
2480 int ret = CAMERA_ERROR_NONE;
2481 int set_format = (int)format;
2483 camera_cli_s *pc = (camera_cli_s *)camera;
2484 muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_FORMAT;
2486 if (pc->cb_info == NULL) {
2487 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2488 return CAMERA_ERROR_INVALID_PARAMETER;
2490 sock_fd = pc->cb_info->fd;
2492 LOGD("Enter, remote_handle : %x, capture_format: %d", pc->remote_handle, set_format);
2493 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_format);
2494 LOGD("ret : 0x%x", ret);
2498 int camera_get_preview_resolution(camera_h camera, int *width, int *height)
2500 if (camera == NULL || width == NULL || height == NULL) {
2501 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2502 return CAMERA_ERROR_INVALID_PARAMETER;
2506 int ret = CAMERA_ERROR_NONE;
2508 camera_cli_s *pc = (camera_cli_s *)camera;
2509 muse_camera_api_e api = MUSE_CAMERA_API_GET_PREVIEW_RESOLUTION;
2511 if (pc->cb_info == NULL) {
2512 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2513 return CAMERA_ERROR_INVALID_PARAMETER;
2515 sock_fd = pc->cb_info->fd;
2519 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2520 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2522 if (ret == CAMERA_ERROR_NONE) {
2523 muse_camera_msg_get(get_width, pc->cb_info->recv_msg);
2524 muse_camera_msg_get(get_height, pc->cb_info->recv_msg);
2526 *height = get_height;
2528 LOGD("ret : 0x%x", ret);
2532 int camera_set_display_rotation(camera_h camera, camera_rotation_e rotation)
2534 if (camera == NULL) {
2535 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2536 return CAMERA_ERROR_INVALID_PARAMETER;
2539 int ret = CAMERA_ERROR_NONE;
2540 camera_cli_s *pc = (camera_cli_s *)camera;
2541 muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY_ROTATION;
2543 if (pc->cb_info == NULL) {
2544 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2545 return CAMERA_ERROR_INVALID_PARAMETER;
2547 sock_fd = pc->cb_info->fd;
2548 int set_rotation = (int)rotation;
2550 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2551 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_rotation);
2552 LOGD("ret : 0x%x", ret);
2556 int camera_get_display_rotation(camera_h camera, camera_rotation_e *rotation)
2558 if (camera == NULL || rotation == NULL) {
2559 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2560 return CAMERA_ERROR_INVALID_PARAMETER;
2563 int ret = CAMERA_ERROR_NONE;
2565 camera_cli_s *pc = (camera_cli_s *)camera;
2566 muse_camera_api_e api = MUSE_CAMERA_API_GET_DISPLAY_ROTATION;
2568 if (pc->cb_info == NULL) {
2569 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2570 return CAMERA_ERROR_INVALID_PARAMETER;
2572 sock_fd = pc->cb_info->fd;
2575 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2576 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2578 if (ret == CAMERA_ERROR_NONE) {
2579 muse_camera_msg_get(get_rotation, pc->cb_info->recv_msg);
2580 *rotation = (camera_rotation_e)get_rotation;
2582 LOGD("ret : 0x%x", ret);
2586 int camera_set_display_flip(camera_h camera, camera_flip_e flip)
2588 if (camera == NULL) {
2589 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2590 return CAMERA_ERROR_INVALID_PARAMETER;
2593 int ret = CAMERA_ERROR_NONE;
2595 camera_cli_s *pc = (camera_cli_s *)camera;
2596 muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY_FLIP;
2598 if (pc->cb_info == NULL) {
2599 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2600 return CAMERA_ERROR_INVALID_PARAMETER;
2602 sock_fd = pc->cb_info->fd;
2603 int set_flip = (int)flip;
2605 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2606 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_flip);
2607 LOGD("ret : 0x%x", ret);
2611 int camera_get_display_flip(camera_h camera, camera_flip_e *flip)
2613 if (camera == NULL || flip == NULL) {
2614 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2615 return CAMERA_ERROR_INVALID_PARAMETER;
2618 int ret = CAMERA_ERROR_NONE;
2620 camera_cli_s *pc = (camera_cli_s *)camera;
2621 muse_camera_api_e api = MUSE_CAMERA_API_GET_DISPLAY_FLIP;
2623 if (pc->cb_info == NULL) {
2624 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2625 return CAMERA_ERROR_INVALID_PARAMETER;
2627 sock_fd = pc->cb_info->fd;
2630 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2631 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2633 if (ret == CAMERA_ERROR_NONE) {
2634 muse_camera_msg_get(get_flip, pc->cb_info->recv_msg);
2635 *flip = (camera_flip_e)get_flip;
2637 LOGD("ret : 0x%x", ret);
2641 int camera_set_display_visible(camera_h camera, bool visible)
2643 if (camera == NULL) {
2644 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2645 return CAMERA_ERROR_INVALID_PARAMETER;
2648 int ret = CAMERA_ERROR_NONE;
2650 camera_cli_s *pc = (camera_cli_s *)camera;
2651 muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY_VISIBLE;
2652 int set_visible = (int)visible;
2654 if (pc->cb_info == NULL) {
2655 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2656 return CAMERA_ERROR_INVALID_PARAMETER;
2658 sock_fd = pc->cb_info->fd;
2660 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2661 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_visible);
2662 LOGD("ret : 0x%x", ret);
2666 int camera_is_display_visible(camera_h camera, bool* visible)
2668 if (camera == NULL || visible == NULL) {
2669 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2670 return CAMERA_ERROR_INVALID_PARAMETER;
2673 int ret = CAMERA_ERROR_NONE;
2675 camera_cli_s *pc = (camera_cli_s *)camera;
2676 muse_camera_api_e api = MUSE_CAMERA_API_IS_DISPLAY_VISIBLE;
2678 if (pc->cb_info == NULL) {
2679 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2680 return CAMERA_ERROR_INVALID_PARAMETER;
2682 sock_fd = pc->cb_info->fd;
2685 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2686 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2688 if (ret == CAMERA_ERROR_NONE) {
2689 muse_camera_msg_get(get_visible, pc->cb_info->recv_msg);
2690 *visible = (bool)get_visible;
2692 LOGD("ret : 0x%x", ret);
2696 int camera_set_display_mode(camera_h camera, camera_display_mode_e mode)
2698 if (camera == NULL) {
2699 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2700 return CAMERA_ERROR_INVALID_PARAMETER;
2703 int ret = CAMERA_ERROR_NONE;
2704 int set_mode = (int)mode;
2706 camera_cli_s *pc = (camera_cli_s *)camera;
2707 muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY_MODE;
2709 if (pc->cb_info == NULL) {
2710 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2711 return CAMERA_ERROR_INVALID_PARAMETER;
2713 sock_fd = pc->cb_info->fd;
2715 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2716 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
2717 LOGD("ret : 0x%x", ret);
2721 int camera_get_display_mode(camera_h camera, camera_display_mode_e* mode)
2723 if (camera == NULL || mode == NULL) {
2724 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2725 return CAMERA_ERROR_INVALID_PARAMETER;
2728 int ret = CAMERA_ERROR_NONE;
2730 camera_cli_s *pc = (camera_cli_s *)camera;
2731 muse_camera_api_e api = MUSE_CAMERA_API_GET_DISPLAY_MODE;
2733 if (pc->cb_info == NULL) {
2734 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2735 return CAMERA_ERROR_INVALID_PARAMETER;
2737 sock_fd = pc->cb_info->fd;
2740 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2741 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2743 if (ret == CAMERA_ERROR_NONE) {
2744 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
2745 *mode = (camera_display_mode_e)get_mode;
2747 LOGD("ret : 0x%x", ret);
2751 int camera_get_capture_resolution(camera_h camera, int *width, int *height)
2753 if (camera == NULL || width == NULL || height == NULL) {
2754 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2755 return CAMERA_ERROR_INVALID_PARAMETER;
2757 int ret = CAMERA_ERROR_NONE;
2759 camera_cli_s *pc = (camera_cli_s *)camera;
2760 muse_camera_api_e api = MUSE_CAMERA_API_GET_CAPTURE_RESOLUTION;
2762 if (pc->cb_info == NULL) {
2763 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2764 return CAMERA_ERROR_INVALID_PARAMETER;
2766 sock_fd = pc->cb_info->fd;
2770 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2771 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2773 if (ret == CAMERA_ERROR_NONE) {
2774 muse_camera_msg_get(get_width, pc->cb_info->recv_msg);
2775 muse_camera_msg_get(get_height, pc->cb_info->recv_msg);
2777 *height = get_height;
2779 LOGD("ret : 0x%x", ret);
2783 int camera_get_capture_format(camera_h camera, camera_pixel_format_e *format)
2785 if (camera == NULL || format == NULL) {
2786 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2787 return CAMERA_ERROR_INVALID_PARAMETER;
2789 int ret = CAMERA_ERROR_NONE;
2791 camera_cli_s *pc = (camera_cli_s *)camera;
2792 muse_camera_api_e api = MUSE_CAMERA_API_GET_CAPTURE_FORMAT;
2795 if (pc->cb_info == NULL) {
2796 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2797 return CAMERA_ERROR_INVALID_PARAMETER;
2799 sock_fd = pc->cb_info->fd;
2801 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2802 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2804 if (ret == CAMERA_ERROR_NONE) {
2805 muse_camera_msg_get(get_format, pc->cb_info->recv_msg);
2806 *format = (camera_pixel_format_e)get_format;
2808 LOGD("ret : 0x%x", ret);
2812 int camera_get_preview_format(camera_h camera, camera_pixel_format_e *format)
2814 if (camera == NULL || format == NULL) {
2815 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2816 return CAMERA_ERROR_INVALID_PARAMETER;
2819 int ret = CAMERA_ERROR_NONE;
2821 camera_cli_s *pc = (camera_cli_s *)camera;
2822 muse_camera_api_e api = MUSE_CAMERA_API_GET_PREVIEW_FORMAT;
2825 if (pc->cb_info == NULL) {
2826 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2827 return CAMERA_ERROR_INVALID_PARAMETER;
2829 sock_fd = pc->cb_info->fd;
2831 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2832 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2834 if (ret == CAMERA_ERROR_NONE) {
2835 muse_camera_msg_get(get_format, pc->cb_info->recv_msg);
2836 *format = (camera_pixel_format_e)get_format;
2838 LOGD("ret : 0x%x", ret);
2842 int camera_get_facing_direction(camera_h camera, camera_facing_direction_e *facing_direciton)
2844 if (camera == NULL || facing_direciton == NULL) {
2845 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2846 return CAMERA_ERROR_INVALID_PARAMETER;
2849 int ret = CAMERA_ERROR_NONE;
2851 camera_cli_s *pc = (camera_cli_s *)camera;
2852 muse_camera_api_e api = MUSE_CAMERA_API_GET_FACING_DIRECTION;
2854 if (pc->cb_info == NULL) {
2855 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2856 return CAMERA_ERROR_INVALID_PARAMETER;
2858 sock_fd = pc->cb_info->fd;
2859 int get_facing_direction;
2861 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2862 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2864 if (ret == CAMERA_ERROR_NONE) {
2865 muse_camera_msg_get(get_facing_direction, pc->cb_info->recv_msg);
2866 *facing_direciton = (camera_facing_direction_e)get_facing_direction;
2868 LOGD("ret : 0x%x", ret);
2872 int camera_set_preview_cb(camera_h camera, camera_preview_cb callback, void* user_data)
2874 if (camera == NULL || callback == NULL) {
2875 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2876 return CAMERA_ERROR_INVALID_PARAMETER;
2878 int ret = CAMERA_ERROR_NONE;
2880 camera_cli_s *pc = (camera_cli_s *)camera;
2882 if (pc->cb_info == NULL) {
2883 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2884 return CAMERA_ERROR_INVALID_PARAMETER;
2886 sock_fd = pc->cb_info->fd;
2887 muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_CB;
2889 LOGD("Enter, handle :%x", pc->remote_handle);
2891 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = callback;
2892 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = user_data;
2894 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2895 LOGD("ret : 0x%x", ret);
2899 int camera_unset_preview_cb(camera_h camera)
2901 if (camera == NULL) {
2902 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2903 return CAMERA_ERROR_INVALID_PARAMETER;
2906 int ret = CAMERA_ERROR_NONE;
2908 camera_cli_s *pc = (camera_cli_s *)camera;
2909 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_PREVIEW_CB;
2911 LOGD("Enter, handle :%x", pc->remote_handle);
2914 if (pc->cb_info == NULL) {
2915 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2916 return CAMERA_ERROR_INVALID_PARAMETER;
2918 sock_fd = pc->cb_info->fd;
2919 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = (void *)NULL;
2920 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = (void *)NULL;
2922 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2923 LOGD("ret : 0x%x", ret);
2927 int camera_set_media_packet_preview_cb(camera_h camera, camera_media_packet_preview_cb callback, void* user_data)
2929 if (camera == NULL) {
2930 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
2931 return CAMERA_ERROR_INVALID_PARAMETER;
2934 if (camera_is_supported_media_packet_preview_cb(camera) == false) {
2935 LOGE("NOT SUPPORTED");
2936 return CAMERA_ERROR_NOT_SUPPORTED;
2939 if (callback == NULL) {
2940 LOGE("INVALID_PARAMETER(0x%08x) - callback", CAMERA_ERROR_INVALID_PARAMETER);
2941 return CAMERA_ERROR_INVALID_PARAMETER;
2944 int ret = CAMERA_ERROR_NONE;
2946 camera_cli_s *pc = (camera_cli_s *)camera;
2947 muse_camera_api_e api = MUSE_CAMERA_API_SET_MEDIA_PACKET_PREVIEW_CB;
2949 LOGD("Enter, handle :%x", pc->remote_handle);
2952 if (pc->cb_info == NULL) {
2953 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2954 return CAMERA_ERROR_INVALID_PARAMETER;
2956 sock_fd = pc->cb_info->fd;
2957 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = callback;
2958 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = user_data;
2960 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2961 LOGD("ret : 0x%x", ret);
2965 int camera_unset_media_packet_preview_cb(camera_h camera)
2967 if (camera == NULL) {
2968 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2969 return CAMERA_ERROR_INVALID_PARAMETER;
2972 int ret = CAMERA_ERROR_NONE;
2974 camera_cli_s *pc = (camera_cli_s *)camera;
2975 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_MEDIA_PACKET_PREVIEW_CB;
2977 LOGD("Enter, handle :%x", pc->remote_handle);
2980 if (pc->cb_info == NULL) {
2981 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2982 return CAMERA_ERROR_INVALID_PARAMETER;
2984 sock_fd = pc->cb_info->fd;
2985 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = (void *)NULL;
2986 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = (void *)NULL;
2988 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2989 LOGD("ret : 0x%x", ret);
2993 int camera_set_state_changed_cb(camera_h camera, camera_state_changed_cb callback, void* user_data)
2995 if (camera == NULL || callback == NULL) {
2996 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2997 return CAMERA_ERROR_INVALID_PARAMETER;
2999 int ret = CAMERA_ERROR_NONE;
3001 camera_cli_s *pc = (camera_cli_s *)camera;
3002 muse_camera_api_e api = MUSE_CAMERA_API_SET_STATE_CHANGED_CB;
3004 LOGD("Enter, handle :%x", pc->remote_handle);
3007 if (pc->cb_info == NULL) {
3008 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3009 return CAMERA_ERROR_INVALID_PARAMETER;
3011 sock_fd = pc->cb_info->fd;
3012 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = callback;
3013 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = user_data;
3015 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3016 LOGD("ret : 0x%x", ret);
3019 int camera_unset_state_changed_cb(camera_h camera)
3021 if (camera == NULL) {
3022 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3023 return CAMERA_ERROR_INVALID_PARAMETER;
3025 int ret = CAMERA_ERROR_NONE;
3027 camera_cli_s *pc = (camera_cli_s *)camera;
3028 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_STATE_CHANGED_CB;
3030 LOGD("Enter, handle :%x", pc->remote_handle);
3033 if (pc->cb_info == NULL) {
3034 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3035 return CAMERA_ERROR_INVALID_PARAMETER;
3037 sock_fd = pc->cb_info->fd;
3038 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = (void *)NULL;
3039 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = (void *)NULL;
3041 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3042 LOGD("ret : 0x%x", ret);
3046 int camera_set_interrupted_cb(camera_h camera, camera_interrupted_cb callback, void *user_data)
3048 if (camera == NULL || callback == NULL) {
3049 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3050 return CAMERA_ERROR_INVALID_PARAMETER;
3052 int ret = CAMERA_ERROR_NONE;
3054 camera_cli_s *pc = (camera_cli_s *)camera;
3055 muse_camera_api_e api = MUSE_CAMERA_API_SET_INTERRUPTED_CB;
3057 LOGD("Enter, handle :%x", pc->remote_handle);
3060 if (pc->cb_info == NULL) {
3061 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3062 return CAMERA_ERROR_INVALID_PARAMETER;
3064 sock_fd = pc->cb_info->fd;
3065 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = callback;
3066 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = user_data;
3068 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3069 LOGD("ret : 0x%x", ret);
3073 int camera_unset_interrupted_cb(camera_h camera)
3075 if (camera == NULL) {
3076 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3077 return CAMERA_ERROR_INVALID_PARAMETER;
3079 int ret = CAMERA_ERROR_NONE;
3081 camera_cli_s *pc = (camera_cli_s *)camera;
3082 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_INTERRUPTED_CB;
3084 LOGD("Enter, handle :%x", pc->remote_handle);
3087 if (pc->cb_info == NULL) {
3088 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3089 return CAMERA_ERROR_INVALID_PARAMETER;
3091 sock_fd = pc->cb_info->fd;
3092 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = (void *)NULL;
3093 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = (void *)NULL;
3095 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3096 LOGD("ret : 0x%x", ret);
3100 int camera_set_focus_changed_cb(camera_h camera, camera_focus_changed_cb callback, void* user_data)
3102 if (camera == NULL || callback == NULL) {
3103 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3104 return CAMERA_ERROR_INVALID_PARAMETER;
3106 int ret = CAMERA_ERROR_NONE;
3108 camera_cli_s *pc = (camera_cli_s *)camera;
3109 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOCUS_CHANGED_CB;
3111 LOGD("Enter, handle :%x", pc->remote_handle);
3114 if (pc->cb_info == NULL) {
3115 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3116 return CAMERA_ERROR_INVALID_PARAMETER;
3118 sock_fd = pc->cb_info->fd;
3119 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = callback;
3120 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = user_data;
3122 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3123 LOGD("ret : 0x%x", ret);
3127 int camera_unset_focus_changed_cb(camera_h camera)
3129 if (camera == NULL) {
3130 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3131 return CAMERA_ERROR_INVALID_PARAMETER;
3133 int ret = CAMERA_ERROR_NONE;
3135 camera_cli_s *pc = (camera_cli_s *)camera;
3136 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_FOCUS_CHANGED_CB;
3138 LOGD("Enter, handle :%x", pc->remote_handle);
3141 if (pc->cb_info == NULL) {
3142 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3143 return CAMERA_ERROR_INVALID_PARAMETER;
3145 sock_fd = pc->cb_info->fd;
3146 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = (void *)NULL;
3147 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = (void *)NULL;
3149 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3150 LOGD("ret : 0x%x", ret);
3154 int camera_set_error_cb(camera_h camera, camera_error_cb callback, void *user_data)
3156 if (camera == NULL || callback == NULL) {
3157 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3158 return CAMERA_ERROR_INVALID_PARAMETER;
3160 int ret = CAMERA_ERROR_NONE;
3162 camera_cli_s *pc = (camera_cli_s *)camera;
3163 muse_camera_api_e api = MUSE_CAMERA_API_SET_ERROR_CB;
3165 LOGD("Enter, handle :%x", pc->remote_handle);
3168 if (pc->cb_info == NULL) {
3169 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3170 return CAMERA_ERROR_INVALID_PARAMETER;
3172 sock_fd = pc->cb_info->fd;
3173 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_ERROR] = callback;
3174 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_ERROR] = user_data;
3176 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3177 LOGD("ret : 0x%x", ret);
3181 int camera_unset_error_cb(camera_h camera)
3183 if (camera == NULL) {
3184 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3185 return CAMERA_ERROR_INVALID_PARAMETER;
3187 int ret = CAMERA_ERROR_NONE;
3189 camera_cli_s *pc = (camera_cli_s *)camera;
3190 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_ERROR_CB;
3192 LOGD("Enter, handle :%x", pc->remote_handle);
3195 if (pc->cb_info == NULL) {
3196 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3197 return CAMERA_ERROR_INVALID_PARAMETER;
3199 sock_fd = pc->cb_info->fd;
3200 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_ERROR] = (void *)NULL;
3201 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_ERROR] = (void *)NULL;
3203 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3204 LOGD("ret : 0x%x", ret);
3208 int camera_foreach_supported_preview_resolution(camera_h camera, camera_supported_preview_resolution_cb foreach_cb , void *user_data)
3210 if (camera == NULL || foreach_cb == NULL) {
3211 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3212 return CAMERA_ERROR_INVALID_PARAMETER;
3214 int ret = CAMERA_ERROR_NONE;
3216 camera_cli_s *pc = (camera_cli_s *)camera;
3217 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_PREVIEW_RESOLUTION;
3219 LOGD("Enter, handle :%x", pc->remote_handle);
3222 if (pc->cb_info == NULL) {
3223 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3224 return CAMERA_ERROR_INVALID_PARAMETER;
3226 sock_fd = pc->cb_info->fd;
3227 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_RESOLUTION] = foreach_cb;
3228 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_RESOLUTION] = user_data;
3230 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3231 LOGD("ret : 0x%x", ret);
3235 int camera_foreach_supported_capture_resolution(camera_h camera, camera_supported_capture_resolution_cb foreach_cb , void *user_data)
3237 if (camera == NULL || foreach_cb == NULL) {
3238 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3239 return CAMERA_ERROR_INVALID_PARAMETER;
3241 int ret = CAMERA_ERROR_NONE;
3243 camera_cli_s *pc = (camera_cli_s *)camera;
3244 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_CAPTURE_RESOLUTION;
3246 LOGD("Enter, handle :%x", pc->remote_handle);
3249 if (pc->cb_info == NULL) {
3250 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3251 return CAMERA_ERROR_INVALID_PARAMETER;
3253 sock_fd = pc->cb_info->fd;
3254 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_RESOLUTION] = foreach_cb;
3255 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_RESOLUTION] = user_data;
3257 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3258 LOGD("ret : 0x%x", ret);
3262 int camera_foreach_supported_capture_format(camera_h camera, camera_supported_capture_format_cb foreach_cb , void *user_data)
3264 if (camera == NULL || foreach_cb == NULL) {
3265 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3266 return CAMERA_ERROR_INVALID_PARAMETER;
3268 int ret = CAMERA_ERROR_NONE;
3270 camera_cli_s *pc = (camera_cli_s *)camera;
3271 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_CAPTURE_FORMAT;
3273 LOGD("Enter, handle :%x", pc->remote_handle);
3276 if (pc->cb_info == NULL) {
3277 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3278 return CAMERA_ERROR_INVALID_PARAMETER;
3280 sock_fd = pc->cb_info->fd;
3281 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_FORMAT] = foreach_cb;
3282 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_FORMAT] = user_data;
3284 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3285 LOGD("ret : 0x%x", ret);
3290 int camera_foreach_supported_preview_format(camera_h camera, camera_supported_preview_format_cb foreach_cb , void *user_data)
3292 if (camera == NULL || foreach_cb == NULL) {
3293 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3294 return CAMERA_ERROR_INVALID_PARAMETER;
3296 int ret = CAMERA_ERROR_NONE;
3298 camera_cli_s *pc = (camera_cli_s *)camera;
3299 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_PREVIEW_FORMAT;
3301 LOGD("Enter, handle :%x", pc->remote_handle);
3304 if (pc->cb_info == NULL) {
3305 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3306 return CAMERA_ERROR_INVALID_PARAMETER;
3308 sock_fd = pc->cb_info->fd;
3309 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_FORMAT] = foreach_cb;
3310 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_FORMAT] = user_data;
3312 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3313 LOGD("ret : 0x%x", ret);
3318 int camera_get_recommended_preview_resolution(camera_h camera, int *width, int *height)
3320 if (camera == NULL || width == NULL || height == NULL) {
3321 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3322 return CAMERA_ERROR_INVALID_PARAMETER;
3324 int ret = CAMERA_ERROR_NONE;
3326 camera_cli_s *pc = (camera_cli_s *)camera;
3327 muse_camera_api_e api = MUSE_CAMERA_API_GET_RECOMMENDED_PREVIEW_RESOLUTION;
3329 if (pc->cb_info == NULL) {
3330 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3331 return CAMERA_ERROR_INVALID_PARAMETER;
3333 sock_fd = pc->cb_info->fd;
3337 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3338 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3340 if (ret == CAMERA_ERROR_NONE) {
3341 muse_camera_msg_get(get_width, pc->cb_info->recv_msg);
3342 muse_camera_msg_get(get_height, pc->cb_info->recv_msg);
3344 *height = get_height;
3346 LOGD("ret : 0x%x", ret);
3351 int camera_attr_get_lens_orientation(camera_h camera, int *angle)
3353 if (camera == NULL || angle == NULL) {
3354 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3355 return CAMERA_ERROR_INVALID_PARAMETER;
3357 int ret = CAMERA_ERROR_NONE;
3359 camera_cli_s *pc = (camera_cli_s *)camera;
3360 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_LENS_ORIENTATION;
3362 if (pc->cb_info == NULL) {
3363 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3364 return CAMERA_ERROR_INVALID_PARAMETER;
3366 sock_fd = pc->cb_info->fd;
3369 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3370 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3372 if (ret == CAMERA_ERROR_NONE) {
3373 muse_camera_msg_get(get_angle, pc->cb_info->recv_msg);
3376 LOGD("ret : 0x%x", ret);
3380 int camera_attr_set_theater_mode(camera_h camera, camera_attr_theater_mode_e mode)
3382 if (camera == NULL) {
3383 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3384 return CAMERA_ERROR_INVALID_PARAMETER;
3386 int ret = CAMERA_ERROR_NONE;
3387 camera_cli_s *pc = (camera_cli_s *)camera;
3388 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_THEATER_MODE;
3390 if (pc->cb_info == NULL) {
3391 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3392 return CAMERA_ERROR_INVALID_PARAMETER;
3394 sock_fd = pc->cb_info->fd;
3395 int set_mode = (int)mode;
3396 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3397 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
3398 LOGD("ret : 0x%x", ret);
3402 int camera_attr_get_theater_mode(camera_h camera, camera_attr_theater_mode_e *mode)
3404 if (camera == NULL || mode == NULL) {
3405 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3406 return CAMERA_ERROR_INVALID_PARAMETER;
3409 int ret = CAMERA_ERROR_NONE;
3410 camera_cli_s *pc = (camera_cli_s *)camera;
3411 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_THEATER_MODE;
3413 if (pc->cb_info == NULL) {
3414 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3415 return CAMERA_ERROR_INVALID_PARAMETER;
3417 sock_fd = pc->cb_info->fd;
3419 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3420 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3422 if (ret == CAMERA_ERROR_NONE) {
3423 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
3424 *mode = (camera_attr_theater_mode_e)get_mode;
3426 LOGD("ret : 0x%x", ret);
3430 int camera_attr_foreach_supported_theater_mode(camera_h camera, camera_attr_supported_theater_mode_cb foreach_cb, void *user_data)
3432 if (camera == NULL || foreach_cb == NULL) {
3433 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3434 return CAMERA_ERROR_INVALID_PARAMETER;
3436 int ret = CAMERA_ERROR_NONE;
3438 camera_cli_s *pc = (camera_cli_s *)camera;
3439 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_THEATER_MODE;
3441 LOGD("Enter, handle :%x", pc->remote_handle);
3444 if (pc->cb_info == NULL) {
3445 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3446 return CAMERA_ERROR_INVALID_PARAMETER;
3448 sock_fd = pc->cb_info->fd;
3449 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE] = foreach_cb;
3450 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE] = user_data;
3452 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3454 LOGD("Finish, return :%x", ret);
3459 int camera_attr_set_preview_fps(camera_h camera, camera_attr_fps_e fps)
3461 if (camera == NULL) {
3462 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3463 return CAMERA_ERROR_INVALID_PARAMETER;
3465 int ret = CAMERA_ERROR_NONE;
3466 camera_cli_s *pc = (camera_cli_s *)camera;
3467 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_PREVIEW_FPS;
3469 if (pc->cb_info == NULL) {
3470 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3471 return CAMERA_ERROR_INVALID_PARAMETER;
3473 sock_fd = pc->cb_info->fd;
3474 int set_fps = (int)fps;
3475 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3476 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_fps);
3477 LOGD("ret : 0x%x", ret);
3482 int camera_attr_set_image_quality(camera_h camera, int quality)
3484 if (camera == NULL) {
3485 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3486 return CAMERA_ERROR_INVALID_PARAMETER;
3488 int ret = CAMERA_ERROR_NONE;
3490 camera_cli_s *pc = (camera_cli_s *)camera;
3491 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_IMAGE_QUALITY;
3493 if (pc->cb_info == NULL) {
3494 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3495 return CAMERA_ERROR_INVALID_PARAMETER;
3497 sock_fd = pc->cb_info->fd;
3498 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3499 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, quality);
3500 LOGD("ret : 0x%x", ret);
3504 int camera_attr_get_preview_fps(camera_h camera, camera_attr_fps_e *fps)
3506 if (camera == NULL || fps == NULL) {
3507 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3508 return CAMERA_ERROR_INVALID_PARAMETER;
3510 int ret = CAMERA_ERROR_NONE;
3512 camera_cli_s *pc = (camera_cli_s *)camera;
3513 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_PREVIEW_FPS;
3516 if (pc->cb_info == NULL) {
3517 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3518 return CAMERA_ERROR_INVALID_PARAMETER;
3520 sock_fd = pc->cb_info->fd;
3522 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3523 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3525 if (ret == CAMERA_ERROR_NONE) {
3526 muse_camera_msg_get(get_fps, pc->cb_info->recv_msg);
3527 *fps = (camera_attr_fps_e)get_fps;
3529 LOGD("ret : 0x%x", ret);
3534 int camera_attr_get_image_quality(camera_h camera, int *quality)
3536 if (camera == NULL || quality == NULL) {
3537 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3538 return CAMERA_ERROR_INVALID_PARAMETER;
3540 int ret = CAMERA_ERROR_NONE;
3542 camera_cli_s *pc = (camera_cli_s *)camera;
3543 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_IMAGE_QUALITY;
3545 if (pc->cb_info == NULL) {
3546 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3547 return CAMERA_ERROR_INVALID_PARAMETER;
3549 sock_fd = pc->cb_info->fd;
3551 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3552 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3554 if (ret == CAMERA_ERROR_NONE) {
3555 muse_camera_msg_get(get_quality, pc->cb_info->recv_msg);
3556 *quality = get_quality;
3558 LOGD("ret : 0x%x", ret);
3563 int camera_attr_set_zoom(camera_h camera, int zoom)
3565 if (camera == NULL) {
3566 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3567 return CAMERA_ERROR_INVALID_PARAMETER;
3569 int ret = CAMERA_ERROR_NONE;
3571 camera_cli_s *pc = (camera_cli_s *)camera;
3572 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ZOOM;
3574 if (pc->cb_info == NULL) {
3575 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3576 return CAMERA_ERROR_INVALID_PARAMETER;
3578 sock_fd = pc->cb_info->fd;
3580 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3581 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, zoom);
3582 LOGD("ret : 0x%x", ret);
3586 int camera_attr_set_af_mode(camera_h camera, camera_attr_af_mode_e mode)
3588 if (camera == NULL) {
3589 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3590 return CAMERA_ERROR_INVALID_PARAMETER;
3592 int ret = CAMERA_ERROR_NONE;
3594 camera_cli_s *pc = (camera_cli_s *)camera;
3595 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_AF_MODE;
3597 if (pc->cb_info == NULL) {
3598 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3599 return CAMERA_ERROR_INVALID_PARAMETER;
3601 sock_fd = pc->cb_info->fd;
3602 int set_mode = (int)mode;
3603 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3604 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
3605 LOGD("ret : 0x%x", ret);
3609 int camera_attr_set_af_area(camera_h camera, int x, int y)
3611 if (camera == NULL) {
3612 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3613 return CAMERA_ERROR_INVALID_PARAMETER;
3615 int ret = CAMERA_ERROR_NONE;
3616 camera_cli_s *pc = (camera_cli_s *)camera;
3617 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_AF_AREA;
3618 int sock_fd = pc->cb_info->fd;
3619 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3620 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, x, INT, y);
3621 LOGD("ret : 0x%x", ret);
3626 int camera_attr_clear_af_area(camera_h camera)
3628 if (camera == NULL) {
3629 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3630 return CAMERA_ERROR_INVALID_PARAMETER;
3632 int ret = CAMERA_ERROR_NONE;
3634 camera_cli_s *pc = (camera_cli_s *)camera;
3635 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_CLEAR_AF_AREA;
3637 if (pc->cb_info == NULL) {
3638 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3639 return CAMERA_ERROR_INVALID_PARAMETER;
3641 sock_fd = pc->cb_info->fd;
3642 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3643 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3644 LOGD("ret : 0x%x", ret);
3649 int camera_attr_set_exposure_mode(camera_h camera, camera_attr_exposure_mode_e mode)
3651 if (camera == NULL) {
3652 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3653 return CAMERA_ERROR_INVALID_PARAMETER;
3656 if (mode < CAMERA_ATTR_EXPOSURE_MODE_OFF || mode > CAMERA_ATTR_EXPOSURE_MODE_CUSTOM) {
3657 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3658 return CAMERA_ERROR_INVALID_PARAMETER;
3661 int ret = CAMERA_ERROR_NONE;
3662 camera_cli_s *pc = (camera_cli_s *)camera;
3663 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EXPOSURE_MODE;
3664 int set_mode = (int)mode;
3666 if (pc->cb_info == NULL) {
3667 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3668 return CAMERA_ERROR_INVALID_PARAMETER;
3670 sock_fd = pc->cb_info->fd;
3671 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3672 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
3673 LOGD("ret : 0x%x", ret);
3678 int camera_attr_set_exposure(camera_h camera, int value)
3680 if (camera == NULL) {
3681 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3682 return CAMERA_ERROR_INVALID_PARAMETER;
3684 int ret = CAMERA_ERROR_NONE;
3686 camera_cli_s *pc = (camera_cli_s *)camera;
3687 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EXPOSURE;
3689 if (pc->cb_info == NULL) {
3690 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3691 return CAMERA_ERROR_INVALID_PARAMETER;
3693 sock_fd = pc->cb_info->fd;
3695 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3696 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, value);
3697 LOGD("ret : 0x%x", ret);
3702 int camera_attr_set_iso(camera_h camera, camera_attr_iso_e iso)
3704 if (camera == NULL) {
3705 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3706 return CAMERA_ERROR_INVALID_PARAMETER;
3708 int ret = CAMERA_ERROR_NONE;
3710 camera_cli_s *pc = (camera_cli_s *)camera;
3711 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ISO;
3713 if (pc->cb_info == NULL) {
3714 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3715 return CAMERA_ERROR_INVALID_PARAMETER;
3717 sock_fd = pc->cb_info->fd;
3718 int set_iso = (int)iso;
3719 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3720 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_iso);
3721 LOGD("ret : 0x%x", ret);
3726 int camera_attr_set_brightness(camera_h camera, int level)
3728 if (camera == NULL) {
3729 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3730 return CAMERA_ERROR_INVALID_PARAMETER;
3732 int ret = CAMERA_ERROR_NONE;
3734 camera_cli_s *pc = (camera_cli_s *)camera;
3735 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_BRIGHTNESS;
3737 if (pc->cb_info == NULL) {
3738 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3739 return CAMERA_ERROR_INVALID_PARAMETER;
3741 sock_fd = pc->cb_info->fd;
3743 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3744 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, level);
3745 LOGD("ret : 0x%x", ret);
3750 int camera_attr_set_contrast(camera_h camera, int level)
3752 if (camera == NULL) {
3753 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3754 return CAMERA_ERROR_INVALID_PARAMETER;
3756 int ret = CAMERA_ERROR_NONE;
3758 camera_cli_s *pc = (camera_cli_s *)camera;
3759 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_CONTRAST;
3761 if (pc->cb_info == NULL) {
3762 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3763 return CAMERA_ERROR_INVALID_PARAMETER;
3765 sock_fd = pc->cb_info->fd;
3767 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3768 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, level);
3769 LOGD("ret : 0x%x", ret);
3774 int camera_attr_set_whitebalance(camera_h camera, camera_attr_whitebalance_e wb)
3776 if (camera == NULL) {
3777 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3778 return CAMERA_ERROR_INVALID_PARAMETER;
3781 if (wb < CAMERA_ATTR_WHITE_BALANCE_NONE || wb > CAMERA_ATTR_WHITE_BALANCE_CUSTOM) {
3782 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_NOT_SUPPORTED);
3783 return CAMERA_ERROR_NOT_SUPPORTED;
3786 int ret = CAMERA_ERROR_NONE;
3788 camera_cli_s *pc = (camera_cli_s *)camera;
3789 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_WHITEBALANCE;
3791 if (pc->cb_info == NULL) {
3792 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3793 return CAMERA_ERROR_INVALID_PARAMETER;
3795 sock_fd = pc->cb_info->fd;
3796 int set_whitebalance = (int)wb;
3797 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3798 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_whitebalance);
3799 LOGD("ret : 0x%x", ret);
3804 int camera_attr_set_effect(camera_h camera, camera_attr_effect_mode_e effect)
3806 if (camera == NULL) {
3807 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3808 return CAMERA_ERROR_INVALID_PARAMETER;
3810 int ret = CAMERA_ERROR_NONE;
3812 camera_cli_s *pc = (camera_cli_s *)camera;
3813 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EFFECT;
3815 if (pc->cb_info == NULL) {
3816 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3817 return CAMERA_ERROR_INVALID_PARAMETER;
3819 sock_fd = pc->cb_info->fd;
3820 int set_effect = (int)effect;
3821 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3822 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_effect);
3823 LOGD("ret : 0x%x", ret);
3828 int camera_attr_set_scene_mode(camera_h camera, camera_attr_scene_mode_e mode)
3830 if (camera == NULL) {
3831 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3832 return CAMERA_ERROR_INVALID_PARAMETER;
3834 int ret = CAMERA_ERROR_NONE;
3836 camera_cli_s *pc = (camera_cli_s *)camera;
3837 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_SCENE_MODE;
3839 if (pc->cb_info == NULL) {
3840 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3841 return CAMERA_ERROR_INVALID_PARAMETER;
3843 sock_fd = pc->cb_info->fd;
3844 int set_mode = (int)mode;
3845 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3846 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
3847 LOGD("ret : 0x%x", ret);
3852 int camera_attr_enable_tag(camera_h camera, bool enable)
3854 if (camera == NULL) {
3855 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3856 return CAMERA_ERROR_INVALID_PARAMETER;
3858 int ret = CAMERA_ERROR_NONE;
3859 camera_cli_s *pc = (camera_cli_s *)camera;
3860 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_TAG;
3862 if (pc->cb_info == NULL) {
3863 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3864 return CAMERA_ERROR_INVALID_PARAMETER;
3866 sock_fd = pc->cb_info->fd;
3867 int set_enable = (int)enable;
3869 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3870 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
3871 LOGD("ret : 0x%x", ret);
3876 int camera_attr_set_tag_image_description(camera_h camera, const char *description)
3878 if (camera == NULL) {
3879 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3880 return CAMERA_ERROR_INVALID_PARAMETER;
3882 if (description == NULL) {
3883 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3884 return CAMERA_ERROR_INVALID_PARAMETER;
3886 int ret = CAMERA_ERROR_NONE;
3887 camera_cli_s *pc = (camera_cli_s *)camera;
3888 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_IMAGE_DESCRIPTION;
3890 if (pc->cb_info == NULL) {
3891 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3892 return CAMERA_ERROR_INVALID_PARAMETER;
3894 sock_fd = pc->cb_info->fd;
3895 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3896 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, STRING, description);
3897 LOGD("ret : 0x%x", ret);
3902 int camera_attr_set_tag_orientation(camera_h camera, camera_attr_tag_orientation_e orientation)
3904 if (camera == NULL) {
3905 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3906 return CAMERA_ERROR_INVALID_PARAMETER;
3908 int ret = CAMERA_ERROR_NONE;
3909 camera_cli_s *pc = (camera_cli_s *)camera;
3910 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_ORIENTATION;
3912 if (pc->cb_info == NULL) {
3913 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3914 return CAMERA_ERROR_INVALID_PARAMETER;
3916 sock_fd = pc->cb_info->fd;
3917 int set_orientation = (int)orientation;
3919 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3920 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_orientation);
3921 LOGD("ret : 0x%x", ret);
3926 int camera_attr_set_tag_software(camera_h camera, const char *software)
3928 if (camera == NULL) {
3929 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3930 return CAMERA_ERROR_INVALID_PARAMETER;
3932 if (software == NULL) {
3933 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3934 return CAMERA_ERROR_INVALID_PARAMETER;
3936 int ret = CAMERA_ERROR_NONE;
3937 camera_cli_s *pc = (camera_cli_s *)camera;
3938 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_SOFTWARE;
3940 if (pc->cb_info == NULL) {
3941 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3942 return CAMERA_ERROR_INVALID_PARAMETER;
3944 sock_fd = pc->cb_info->fd;
3945 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3946 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, STRING, software);
3947 LOGD("ret : 0x%x", ret);
3952 int camera_attr_set_geotag(camera_h camera, double latitude , double longitude, double altitude)
3954 if (camera == NULL) {
3955 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3956 return CAMERA_ERROR_INVALID_PARAMETER;
3958 int ret = CAMERA_ERROR_NONE;
3959 camera_cli_s *pc = (camera_cli_s *)camera;
3960 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_GEOTAG;
3962 if (pc->cb_info == NULL) {
3963 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3964 return CAMERA_ERROR_INVALID_PARAMETER;
3966 sock_fd = pc->cb_info->fd;
3967 double set_geotag[3] = { latitude, longitude, altitude };
3969 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3970 muse_camera_msg_send_array(api, sock_fd, pc->cb_info, ret,
3971 set_geotag, sizeof(set_geotag), sizeof(double));
3972 LOGD("ret : 0x%x", ret);
3977 int camera_attr_remove_geotag(camera_h camera)
3979 if (camera == NULL) {
3980 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3981 return CAMERA_ERROR_INVALID_PARAMETER;
3983 int ret = CAMERA_ERROR_NONE;
3984 camera_cli_s *pc = (camera_cli_s *)camera;
3985 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_REMOVE_GEOTAG;
3987 if (pc->cb_info == NULL) {
3988 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
3989 return CAMERA_ERROR_INVALID_PARAMETER;
3991 sock_fd = pc->cb_info->fd;
3992 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3993 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3994 LOGD("ret : 0x%x", ret);
3999 int camera_attr_set_flash_mode(camera_h camera, camera_attr_flash_mode_e mode)
4001 if (camera == NULL) {
4002 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4003 return CAMERA_ERROR_INVALID_PARAMETER;
4005 int ret = CAMERA_ERROR_NONE;
4006 camera_cli_s *pc = (camera_cli_s *)camera;
4007 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_FLASH_MODE;
4009 if (pc->cb_info == NULL) {
4010 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4011 return CAMERA_ERROR_INVALID_PARAMETER;
4013 sock_fd = pc->cb_info->fd;
4014 int set_mode = (int)mode;
4016 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4017 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
4018 LOGD("ret : 0x%x", ret);
4023 int camera_attr_get_zoom(camera_h camera, int *zoom)
4025 if (camera == NULL || zoom == NULL) {
4026 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4027 return CAMERA_ERROR_INVALID_PARAMETER;
4029 int ret = CAMERA_ERROR_NONE;
4031 camera_cli_s *pc = (camera_cli_s *)camera;
4032 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ZOOM;
4035 if (pc->cb_info == NULL) {
4036 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4037 return CAMERA_ERROR_INVALID_PARAMETER;
4039 sock_fd = pc->cb_info->fd;
4041 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4042 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4044 if (ret == CAMERA_ERROR_NONE) {
4045 muse_camera_msg_get(get_zoom, pc->cb_info->recv_msg);
4048 LOGD("ret : 0x%x", ret);
4053 int camera_attr_get_zoom_range(camera_h camera, int *min, int *max)
4055 if (camera == NULL || min == NULL || max == NULL) {
4056 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4057 return CAMERA_ERROR_INVALID_PARAMETER;
4059 int ret = CAMERA_ERROR_NONE;
4060 camera_cli_s *pc = (camera_cli_s *)camera;
4062 if (pc->cb_info == NULL) {
4063 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4064 return CAMERA_ERROR_INVALID_PARAMETER;
4066 sock_fd = pc->cb_info->fd;
4067 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ZOOM_RANGE;
4071 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4072 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4074 if (ret == CAMERA_ERROR_NONE) {
4075 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
4076 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
4080 LOGD("ret : 0x%x", ret);
4085 int camera_attr_get_af_mode(camera_h camera, camera_attr_af_mode_e *mode)
4087 if (camera == NULL || mode == NULL) {
4088 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4089 return CAMERA_ERROR_INVALID_PARAMETER;
4091 int ret = CAMERA_ERROR_NONE;
4092 camera_cli_s *pc = (camera_cli_s *)camera;
4094 if (pc->cb_info == NULL) {
4095 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4096 return CAMERA_ERROR_INVALID_PARAMETER;
4098 sock_fd = pc->cb_info->fd;
4099 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_AF_MODE;
4102 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4103 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4105 if (ret == CAMERA_ERROR_NONE) {
4106 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
4107 *mode = (camera_attr_af_mode_e)get_mode;
4109 LOGD("ret : 0x%x", ret);
4114 int camera_attr_get_exposure_mode(camera_h camera, camera_attr_exposure_mode_e *mode)
4116 if (camera == NULL || mode == NULL) {
4117 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4118 return CAMERA_ERROR_INVALID_PARAMETER;
4120 int ret = CAMERA_ERROR_NONE;
4121 camera_cli_s *pc = (camera_cli_s *)camera;
4123 if (pc->cb_info == NULL) {
4124 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4125 return CAMERA_ERROR_INVALID_PARAMETER;
4127 sock_fd = pc->cb_info->fd;
4128 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE_MODE;
4131 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4132 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4134 if (ret == CAMERA_ERROR_NONE) {
4135 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
4136 *mode = (camera_attr_exposure_mode_e)get_mode;
4138 LOGD("ret : 0x%x", ret);
4142 int camera_attr_get_exposure(camera_h camera, int *value)
4144 if (camera == NULL || value == NULL) {
4145 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4146 return CAMERA_ERROR_INVALID_PARAMETER;
4148 int ret = CAMERA_ERROR_NONE;
4149 camera_cli_s *pc = (camera_cli_s *)camera;
4151 if (pc->cb_info == NULL) {
4152 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4153 return CAMERA_ERROR_INVALID_PARAMETER;
4155 sock_fd = pc->cb_info->fd;
4156 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE;
4159 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4160 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4162 if (ret == CAMERA_ERROR_NONE) {
4163 muse_camera_msg_get(get_value, pc->cb_info->recv_msg);
4166 LOGD("ret : 0x%x", ret);
4171 int camera_attr_get_exposure_range(camera_h camera, int *min, int *max)
4173 if (camera == NULL || min == NULL || max == NULL) {
4174 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4175 return CAMERA_ERROR_INVALID_PARAMETER;
4177 int ret = CAMERA_ERROR_NONE;
4178 camera_cli_s *pc = (camera_cli_s *)camera;
4180 if (pc->cb_info == NULL) {
4181 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4182 return CAMERA_ERROR_INVALID_PARAMETER;
4184 sock_fd = pc->cb_info->fd;
4185 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE_RANGE;
4189 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4190 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4192 if (ret == CAMERA_ERROR_NONE) {
4193 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
4194 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
4198 LOGD("ret : 0x%x", ret);
4203 int camera_attr_get_iso(camera_h camera, camera_attr_iso_e *iso)
4205 if (camera == NULL || iso == NULL) {
4206 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4207 return CAMERA_ERROR_INVALID_PARAMETER;
4209 int ret = CAMERA_ERROR_NONE;
4210 camera_cli_s *pc = (camera_cli_s *)camera;
4212 if (pc->cb_info == NULL) {
4213 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4214 return CAMERA_ERROR_INVALID_PARAMETER;
4216 sock_fd = pc->cb_info->fd;
4217 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ISO;
4220 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4221 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4223 if (ret == CAMERA_ERROR_NONE) {
4224 muse_camera_msg_get(get_iso, pc->cb_info->recv_msg);
4225 *iso = (camera_attr_iso_e)get_iso;
4227 LOGD("ret : 0x%x", ret);
4232 int camera_attr_get_brightness(camera_h camera, int *level)
4234 if (camera == NULL || level == NULL) {
4235 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4236 return CAMERA_ERROR_INVALID_PARAMETER;
4238 int ret = CAMERA_ERROR_NONE;
4239 camera_cli_s *pc = (camera_cli_s *)camera;
4241 if (pc->cb_info == NULL) {
4242 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4243 return CAMERA_ERROR_INVALID_PARAMETER;
4245 sock_fd = pc->cb_info->fd;
4246 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_BRIGHTNESS;
4249 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4250 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4252 if (ret == CAMERA_ERROR_NONE) {
4253 muse_camera_msg_get(get_level, pc->cb_info->recv_msg);
4256 LOGD("ret : 0x%x", ret);
4261 int camera_attr_get_brightness_range(camera_h camera, int *min, int *max)
4263 if (camera == NULL || min == NULL || max == NULL) {
4264 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4265 return CAMERA_ERROR_INVALID_PARAMETER;
4267 int ret = CAMERA_ERROR_NONE;
4268 camera_cli_s *pc = (camera_cli_s *)camera;
4270 if (pc->cb_info == NULL) {
4271 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4272 return CAMERA_ERROR_INVALID_PARAMETER;
4274 sock_fd = pc->cb_info->fd;
4275 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_BRIGHTNESS_RANGE;
4279 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4280 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4282 if (ret == CAMERA_ERROR_NONE) {
4283 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
4284 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
4288 LOGD("ret : 0x%x", ret);
4293 int camera_attr_get_contrast(camera_h camera, int *level)
4295 if (camera == NULL || level == NULL) {
4296 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4297 return CAMERA_ERROR_INVALID_PARAMETER;
4299 int ret = CAMERA_ERROR_NONE;
4300 camera_cli_s *pc = (camera_cli_s *)camera;
4301 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_CONTRAST;
4303 if (pc->cb_info == NULL) {
4304 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4305 return CAMERA_ERROR_INVALID_PARAMETER;
4307 sock_fd = pc->cb_info->fd;
4310 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4311 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4313 if (ret == CAMERA_ERROR_NONE) {
4314 muse_camera_msg_get(get_level, pc->cb_info->recv_msg);
4317 LOGD("ret : 0x%x", ret);
4322 int camera_attr_get_contrast_range(camera_h camera, int *min , int *max)
4324 if (camera == NULL || min == NULL || max == NULL) {
4325 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4326 return CAMERA_ERROR_INVALID_PARAMETER;
4328 int ret = CAMERA_ERROR_NONE;
4329 camera_cli_s *pc = (camera_cli_s *)camera;
4330 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_CONTRAST_RANGE;
4332 if (pc->cb_info == NULL) {
4333 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4334 return CAMERA_ERROR_INVALID_PARAMETER;
4336 sock_fd = pc->cb_info->fd;
4340 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4341 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4343 if (ret == CAMERA_ERROR_NONE) {
4344 muse_camera_msg_get(get_min, pc->cb_info->recv_msg);
4345 muse_camera_msg_get(get_max, pc->cb_info->recv_msg);
4349 LOGD("ret : 0x%x", ret);
4354 int camera_attr_get_whitebalance(camera_h camera, camera_attr_whitebalance_e *wb)
4356 if (camera == NULL || wb == NULL) {
4357 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4358 return CAMERA_ERROR_INVALID_PARAMETER;
4360 int ret = CAMERA_ERROR_NONE;
4361 camera_cli_s *pc = (camera_cli_s *)camera;
4362 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_WHITEBALANCE;
4364 if (pc->cb_info == NULL) {
4365 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4366 return CAMERA_ERROR_INVALID_PARAMETER;
4368 sock_fd = pc->cb_info->fd;
4371 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4372 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4374 if (ret == CAMERA_ERROR_NONE) {
4375 muse_camera_msg_get(get_wb, pc->cb_info->recv_msg);
4376 *wb = (camera_attr_whitebalance_e)get_wb;
4378 LOGD("ret : 0x%x", ret);
4383 int camera_attr_get_effect(camera_h camera, camera_attr_effect_mode_e *effect)
4385 if (camera == NULL || effect == NULL) {
4386 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4387 return CAMERA_ERROR_INVALID_PARAMETER;
4390 int ret = CAMERA_ERROR_NONE;
4391 camera_cli_s *pc = (camera_cli_s *)camera;
4392 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EFFECT;
4394 if (pc->cb_info == NULL) {
4395 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4396 return CAMERA_ERROR_INVALID_PARAMETER;
4398 sock_fd = pc->cb_info->fd;
4401 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4402 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4404 if (ret == CAMERA_ERROR_NONE) {
4405 muse_camera_msg_get(get_effect, pc->cb_info->recv_msg);
4406 *effect = (camera_attr_effect_mode_e)get_effect;
4408 LOGD("ret : 0x%x", ret);
4413 int camera_attr_get_scene_mode(camera_h camera, camera_attr_scene_mode_e *mode)
4415 if (camera == NULL || mode == NULL) {
4416 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4417 return CAMERA_ERROR_INVALID_PARAMETER;
4420 int ret = CAMERA_ERROR_NONE;
4421 camera_cli_s *pc = (camera_cli_s *)camera;
4422 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_SCENE_MODE;
4424 if (pc->cb_info == NULL) {
4425 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4426 return CAMERA_ERROR_INVALID_PARAMETER;
4428 sock_fd = pc->cb_info->fd;
4431 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4432 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4434 if (ret == CAMERA_ERROR_NONE) {
4435 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
4436 *mode = (camera_attr_scene_mode_e)get_mode;
4438 LOGD("ret : 0x%x", ret);
4443 int camera_attr_is_enabled_tag(camera_h camera, bool *enable)
4445 if (camera == NULL || enable == NULL) {
4446 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4447 return CAMERA_ERROR_INVALID_PARAMETER;
4450 int ret = CAMERA_ERROR_NONE;
4451 camera_cli_s *pc = (camera_cli_s *)camera;
4452 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_TAG;
4454 if (pc->cb_info == NULL) {
4455 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4456 return CAMERA_ERROR_INVALID_PARAMETER;
4458 sock_fd = pc->cb_info->fd;
4461 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4462 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4464 if (ret == CAMERA_ERROR_NONE) {
4465 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
4466 *enable = (bool)get_enabled;
4468 LOGD("ret : 0x%x", ret);
4473 int camera_attr_get_tag_image_description(camera_h camera, char **description)
4475 if (camera == NULL || description == NULL) {
4476 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4477 return CAMERA_ERROR_INVALID_PARAMETER;
4480 int ret = CAMERA_ERROR_NONE;
4481 camera_cli_s *pc = (camera_cli_s *)camera;
4482 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_IMAGE_DESCRIPTION;
4484 if (pc->cb_info == NULL) {
4485 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4486 return CAMERA_ERROR_INVALID_PARAMETER;
4488 sock_fd = pc->cb_info->fd;
4489 char get_description[MUSE_CAMERA_MSG_MAX_LENGTH] = {0,};
4491 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4492 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4494 if (ret == CAMERA_ERROR_NONE) {
4495 muse_camera_msg_get_string(get_description, pc->cb_info->recv_msg);
4496 *description = strdup(get_description);
4498 LOGD("ret : 0x%x", ret);
4503 int camera_attr_get_tag_orientation(camera_h camera, camera_attr_tag_orientation_e *orientation)
4505 if (camera == NULL || orientation == NULL) {
4506 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4507 return CAMERA_ERROR_INVALID_PARAMETER;
4510 int ret = CAMERA_ERROR_NONE;
4511 camera_cli_s *pc = (camera_cli_s *)camera;
4512 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_ORIENTATION;
4514 if (pc->cb_info == NULL) {
4515 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4516 return CAMERA_ERROR_INVALID_PARAMETER;
4518 sock_fd = pc->cb_info->fd;
4519 int get_orientation;
4521 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4522 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4524 if (ret == CAMERA_ERROR_NONE) {
4525 muse_camera_msg_get(get_orientation, pc->cb_info->recv_msg);
4526 *orientation = (camera_attr_tag_orientation_e)get_orientation;
4527 LOGD("success, orientation : %d", *orientation);
4529 LOGD("ret : 0x%x", ret);
4534 int camera_attr_get_tag_software(camera_h camera, char **software)
4536 if (camera == NULL || software == NULL) {
4537 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4538 return CAMERA_ERROR_INVALID_PARAMETER;
4541 int ret = CAMERA_ERROR_NONE;
4542 camera_cli_s *pc = (camera_cli_s *)camera;
4543 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_SOFTWARE;
4545 if (pc->cb_info == NULL) {
4546 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4547 return CAMERA_ERROR_INVALID_PARAMETER;
4549 sock_fd = pc->cb_info->fd;
4550 char get_software[MUSE_CAMERA_MSG_MAX_LENGTH] = {0,};
4552 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4553 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4555 if (ret == CAMERA_ERROR_NONE) {
4556 muse_camera_msg_get_string(get_software, pc->cb_info->recv_msg);
4557 *software = strdup(get_software);
4559 LOGD("ret : 0x%x", ret);
4564 int camera_attr_get_geotag(camera_h camera, double *latitude , double *longitude, double *altitude)
4566 if (camera == NULL || latitude == NULL || longitude == NULL || altitude == NULL) {
4567 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4568 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_GET_GEOTAG;
4574 double get_geotag[3] = {0,};
4576 if (pc->cb_info == NULL) {
4577 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4578 return CAMERA_ERROR_INVALID_PARAMETER;
4580 sock_fd = pc->cb_info->fd;
4582 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4583 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4585 if (ret == CAMERA_ERROR_NONE) {
4586 muse_camera_msg_get_array(get_geotag, pc->cb_info->recv_msg);
4587 *latitude = get_geotag[0];
4588 *longitude = get_geotag[1];
4589 *altitude = get_geotag[2];
4591 LOGE("Returned value is not valid : 0x%x", valid);
4594 LOGD("ret : 0x%x", ret);
4600 int camera_attr_get_flash_mode(camera_h camera, camera_attr_flash_mode_e *mode)
4602 if (camera == NULL || mode == NULL) {
4603 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4604 return CAMERA_ERROR_INVALID_PARAMETER;
4607 int ret = CAMERA_ERROR_NONE;
4608 camera_cli_s *pc = (camera_cli_s *)camera;
4609 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_FLASH_MODE;
4611 if (pc->cb_info == NULL) {
4612 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4613 return CAMERA_ERROR_INVALID_PARAMETER;
4615 sock_fd = pc->cb_info->fd;
4618 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4619 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4621 if (ret == CAMERA_ERROR_NONE) {
4622 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
4623 *mode = (camera_attr_flash_mode_e)get_mode;
4625 LOGD("ret : 0x%x", ret);
4630 int camera_attr_foreach_supported_af_mode(camera_h camera, camera_attr_supported_af_mode_cb foreach_cb, void *user_data)
4632 if (camera == NULL || foreach_cb == NULL) {
4633 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4634 return CAMERA_ERROR_INVALID_PARAMETER;
4636 int ret = CAMERA_ERROR_NONE;
4638 camera_cli_s *pc = (camera_cli_s *)camera;
4639 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_AF_MODE;
4641 LOGD("Enter, handle :%x", pc->remote_handle);
4644 if (pc->cb_info == NULL) {
4645 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4646 return CAMERA_ERROR_INVALID_PARAMETER;
4648 sock_fd = pc->cb_info->fd;
4649 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_AF_MODE] = foreach_cb;
4650 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_AF_MODE] = user_data;
4652 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4653 LOGD("ret : 0x%x", ret);
4658 int camera_attr_foreach_supported_exposure_mode(camera_h camera, camera_attr_supported_exposure_mode_cb foreach_cb , void *user_data)
4660 if (camera == NULL || foreach_cb == NULL) {
4661 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4662 return CAMERA_ERROR_INVALID_PARAMETER;
4664 int ret = CAMERA_ERROR_NONE;
4666 camera_cli_s *pc = (camera_cli_s *)camera;
4667 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_EXPOSURE_MODE;
4669 LOGD("Enter, handle :%x", pc->remote_handle);
4672 if (pc->cb_info == NULL) {
4673 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4674 return CAMERA_ERROR_INVALID_PARAMETER;
4676 sock_fd = pc->cb_info->fd;
4677 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EXPOSURE_MODE] = foreach_cb;
4678 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EXPOSURE_MODE] = user_data;
4680 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4681 LOGD("ret : 0x%x", ret);
4686 int camera_attr_foreach_supported_iso(camera_h camera, camera_attr_supported_iso_cb foreach_cb, void *user_data)
4688 if (camera == NULL || foreach_cb == NULL) {
4689 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4690 return CAMERA_ERROR_INVALID_PARAMETER;
4692 int ret = CAMERA_ERROR_NONE;
4694 camera_cli_s *pc = (camera_cli_s *)camera;
4695 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_ISO;
4697 LOGD("Enter, handle :%x", pc->remote_handle);
4700 if (pc->cb_info == NULL) {
4701 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4702 return CAMERA_ERROR_INVALID_PARAMETER;
4704 sock_fd = pc->cb_info->fd;
4705 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_ISO] = foreach_cb;
4706 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_ISO] = user_data;
4708 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4709 LOGD("ret : 0x%x", ret);
4714 int camera_attr_foreach_supported_whitebalance(camera_h camera, camera_attr_supported_whitebalance_cb foreach_cb , void *user_data)
4716 if (camera == NULL || foreach_cb == NULL) {
4717 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4718 return CAMERA_ERROR_INVALID_PARAMETER;
4720 int ret = CAMERA_ERROR_NONE;
4722 camera_cli_s *pc = (camera_cli_s *)camera;
4723 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_WHITEBALANCE;
4725 LOGD("Enter, handle :%x", pc->remote_handle);
4728 if (pc->cb_info == NULL) {
4729 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4730 return CAMERA_ERROR_INVALID_PARAMETER;
4732 sock_fd = pc->cb_info->fd;
4733 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_WHITEBALANCE] = foreach_cb;
4734 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_WHITEBALANCE] = user_data;
4736 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4737 LOGD("ret : 0x%x", ret);
4742 int camera_attr_foreach_supported_effect(camera_h camera, camera_attr_supported_effect_cb foreach_cb , void *user_data)
4744 if (camera == NULL || foreach_cb == NULL) {
4745 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4746 return CAMERA_ERROR_INVALID_PARAMETER;
4748 int ret = CAMERA_ERROR_NONE;
4750 camera_cli_s *pc = (camera_cli_s *)camera;
4751 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_EFFECT;
4753 LOGD("Enter, handle :%x", pc->remote_handle);
4756 if (pc->cb_info == NULL) {
4757 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4758 return CAMERA_ERROR_INVALID_PARAMETER;
4760 sock_fd = pc->cb_info->fd;
4761 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EFFECT] = foreach_cb;
4762 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EFFECT] = user_data;
4764 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4765 LOGD("ret : 0x%x", ret);
4770 int camera_attr_foreach_supported_scene_mode(camera_h camera, camera_attr_supported_scene_mode_cb foreach_cb , void *user_data)
4772 if (camera == NULL || foreach_cb == NULL) {
4773 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4774 return CAMERA_ERROR_INVALID_PARAMETER;
4776 int ret = CAMERA_ERROR_NONE;
4778 camera_cli_s *pc = (camera_cli_s *)camera;
4779 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_SCENE_MODE;
4781 LOGD("Enter, handle :%x", pc->remote_handle);
4784 if (pc->cb_info == NULL) {
4785 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4786 return CAMERA_ERROR_INVALID_PARAMETER;
4788 sock_fd = pc->cb_info->fd;
4789 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_SCENE_MODE] = foreach_cb;
4790 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_SCENE_MODE] = user_data;
4792 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4793 LOGD("ret : 0x%x", ret);
4798 int camera_attr_foreach_supported_flash_mode(camera_h camera, camera_attr_supported_flash_mode_cb foreach_cb , void *user_data)
4800 if (camera == NULL || foreach_cb == NULL) {
4801 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4802 return CAMERA_ERROR_INVALID_PARAMETER;
4804 int ret = CAMERA_ERROR_NONE;
4806 camera_cli_s *pc = (camera_cli_s *)camera;
4807 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FLASH_MODE;
4809 LOGD("Enter, handle :%x", pc->remote_handle);
4812 if (pc->cb_info == NULL) {
4813 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4814 return CAMERA_ERROR_INVALID_PARAMETER;
4816 sock_fd = pc->cb_info->fd;
4817 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FLASH_MODE] = foreach_cb;
4818 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FLASH_MODE] = user_data;
4820 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4821 LOGD("ret : 0x%x", ret);
4826 int camera_attr_foreach_supported_fps(camera_h camera, camera_attr_supported_fps_cb foreach_cb , void *user_data)
4828 if (camera == NULL || foreach_cb == NULL) {
4829 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4830 return CAMERA_ERROR_INVALID_PARAMETER;
4832 int ret = CAMERA_ERROR_NONE;
4834 camera_cli_s *pc = (camera_cli_s *)camera;
4835 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FPS;
4837 if (pc->cb_info == NULL) {
4838 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4839 return CAMERA_ERROR_INVALID_PARAMETER;
4841 sock_fd = pc->cb_info->fd;
4842 LOGD("Enter, handle :%x", pc->remote_handle);
4843 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS] = foreach_cb;
4844 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS] = user_data;
4846 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4847 LOGD("Enter, handle :%x", pc->remote_handle);
4851 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)
4853 if (camera == NULL || foreach_cb == NULL) {
4854 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4855 return CAMERA_ERROR_INVALID_PARAMETER;
4857 int ret = CAMERA_ERROR_NONE;
4859 camera_cli_s *pc = (camera_cli_s *)camera;
4860 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FPS_BY_RESOLUTION;
4862 if (pc->cb_info == NULL) {
4863 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4864 return CAMERA_ERROR_INVALID_PARAMETER;
4866 sock_fd = pc->cb_info->fd;
4867 LOGD("Enter, handle :%x", pc->remote_handle);
4868 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS_BY_RESOLUTION] = foreach_cb;
4869 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS_BY_RESOLUTION] = user_data;
4871 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, width, INT, height);
4872 LOGD("ret : 0x%x", ret);
4876 int camera_attr_foreach_supported_stream_flip(camera_h camera, camera_attr_supported_stream_flip_cb foreach_cb, void *user_data)
4878 if (camera == NULL || foreach_cb == NULL) {
4879 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4880 return CAMERA_ERROR_INVALID_PARAMETER;
4882 int ret = CAMERA_ERROR_NONE;
4884 camera_cli_s *pc = (camera_cli_s *)camera;
4885 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_STREAM_FLIP;
4887 if (pc->cb_info == NULL) {
4888 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4889 return CAMERA_ERROR_INVALID_PARAMETER;
4891 sock_fd = pc->cb_info->fd;
4892 LOGD("Enter, handle :%x", pc->remote_handle);
4893 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_FLIP] = foreach_cb;
4894 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_FLIP] = user_data;
4896 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4897 LOGD("ret : 0x%x", ret);
4902 int camera_attr_foreach_supported_stream_rotation(camera_h camera, camera_attr_supported_stream_rotation_cb foreach_cb, void *user_data)
4904 if (camera == NULL || foreach_cb == NULL) {
4905 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4906 return CAMERA_ERROR_INVALID_PARAMETER;
4908 int ret = CAMERA_ERROR_NONE;
4910 camera_cli_s *pc = (camera_cli_s *)camera;
4911 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_STREAM_ROTATION;
4913 if (pc->cb_info == NULL) {
4914 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4915 return CAMERA_ERROR_INVALID_PARAMETER;
4917 sock_fd = pc->cb_info->fd;
4918 LOGD("Enter, handle :%x", pc->remote_handle);
4919 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION] = foreach_cb;
4920 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION] = user_data;
4922 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4923 LOGD("ret : 0x%x", ret);
4928 int camera_attr_set_stream_rotation(camera_h camera , camera_rotation_e rotation)
4930 if (camera == NULL) {
4931 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4932 return CAMERA_ERROR_INVALID_PARAMETER;
4935 int ret = CAMERA_ERROR_NONE;
4936 camera_cli_s *pc = (camera_cli_s *)camera;
4937 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_STREAM_ROTATION;
4939 if (pc->cb_info == NULL) {
4940 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4941 return CAMERA_ERROR_INVALID_PARAMETER;
4943 sock_fd = pc->cb_info->fd;
4944 int set_rotation = (int)rotation;
4946 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4947 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_rotation);
4948 LOGD("ret : 0x%x", ret);
4953 int camera_attr_get_stream_rotation(camera_h camera , camera_rotation_e *rotation)
4955 if (camera == NULL || rotation == NULL) {
4956 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4957 return CAMERA_ERROR_INVALID_PARAMETER;
4960 int ret = CAMERA_ERROR_NONE;
4961 camera_cli_s *pc = (camera_cli_s *)camera;
4962 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_STREAM_ROTATION;
4964 if (pc->cb_info == NULL) {
4965 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4966 return CAMERA_ERROR_INVALID_PARAMETER;
4968 sock_fd = pc->cb_info->fd;
4971 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4972 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4974 if (ret == CAMERA_ERROR_NONE) {
4975 muse_camera_msg_get(get_rotation, pc->cb_info->recv_msg);
4976 *rotation = (camera_rotation_e)get_rotation;
4978 LOGD("ret : 0x%x", ret);
4983 int camera_attr_set_stream_flip(camera_h camera , camera_flip_e flip)
4985 if (camera == NULL) {
4986 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4987 return CAMERA_ERROR_INVALID_PARAMETER;
4990 int ret = CAMERA_ERROR_NONE;
4991 camera_cli_s *pc = (camera_cli_s *)camera;
4992 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_STREAM_FLIP;
4994 if (pc->cb_info == NULL) {
4995 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4996 return CAMERA_ERROR_INVALID_PARAMETER;
4998 sock_fd = pc->cb_info->fd;
4999 int set_flip = (int)flip;
5001 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5002 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_flip);
5003 LOGD("ret : 0x%x", ret);
5008 int camera_attr_get_stream_flip(camera_h camera , camera_flip_e *flip)
5010 if (camera == NULL || flip == NULL) {
5011 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5012 return CAMERA_ERROR_INVALID_PARAMETER;
5015 int ret = CAMERA_ERROR_NONE;
5016 camera_cli_s *pc = (camera_cli_s *)camera;
5017 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_STREAM_FLIP;
5019 if (pc->cb_info == NULL) {
5020 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5021 return CAMERA_ERROR_INVALID_PARAMETER;
5023 sock_fd = pc->cb_info->fd;
5026 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5027 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5029 if (ret == CAMERA_ERROR_NONE) {
5030 muse_camera_msg_get(get_flip, pc->cb_info->recv_msg);
5031 *flip = (camera_flip_e)get_flip;
5033 LOGD("ret : 0x%x", ret);
5037 int camera_attr_set_hdr_mode(camera_h camera, camera_attr_hdr_mode_e mode)
5039 if (camera == NULL) {
5040 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5041 return CAMERA_ERROR_INVALID_PARAMETER;
5044 int ret = CAMERA_ERROR_NONE;
5045 camera_cli_s *pc = (camera_cli_s *)camera;
5046 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_HDR_MODE;
5048 if (pc->cb_info == NULL) {
5049 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5050 return CAMERA_ERROR_INVALID_PARAMETER;
5052 sock_fd = pc->cb_info->fd;
5053 int set_mode = (int)mode;
5055 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5056 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
5057 LOGD("ret : 0x%x", ret);
5062 int camera_attr_get_hdr_mode(camera_h camera, camera_attr_hdr_mode_e *mode)
5064 if (camera == NULL) {
5065 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5066 return CAMERA_ERROR_INVALID_PARAMETER;
5069 LOGE("CAMERA_ERROR_NOT_SUPPORTED(0x%08x) - mode", CAMERA_ERROR_NOT_SUPPORTED);
5070 return CAMERA_ERROR_NOT_SUPPORTED;
5072 int ret = CAMERA_ERROR_NONE;
5073 camera_cli_s *pc = (camera_cli_s *)camera;
5074 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_HDR_MODE;
5076 if (pc->cb_info == NULL) {
5077 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5078 return CAMERA_ERROR_INVALID_PARAMETER;
5080 sock_fd = pc->cb_info->fd;
5083 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5084 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5086 if (ret == CAMERA_ERROR_NONE) {
5087 muse_camera_msg_get(get_mode, pc->cb_info->recv_msg);
5088 *mode = (camera_attr_hdr_mode_e)get_mode;
5090 LOGD("ret : 0x%x", ret);
5095 bool camera_attr_is_supported_hdr_capture(camera_h camera)
5097 if (camera == NULL) {
5098 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5102 int ret = CAMERA_ERROR_NONE;
5103 camera_cli_s *pc = (camera_cli_s *)camera;
5104 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_HDR_CAPTURE;
5106 if (pc->cb_info == NULL) {
5107 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5108 return CAMERA_ERROR_INVALID_PARAMETER;
5110 sock_fd = pc->cb_info->fd;
5111 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5112 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5113 LOGD("ret : 0x%x", ret);
5118 int camera_attr_set_hdr_capture_progress_cb(camera_h camera, camera_attr_hdr_progress_cb callback, void* user_data)
5120 if (camera == NULL) {
5121 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5122 return CAMERA_ERROR_INVALID_PARAMETER;
5124 if (callback == NULL) {
5125 LOGE("CAMERA_ERROR_NOT_SUPPORTED(0x%08x) - callback", CAMERA_ERROR_NOT_SUPPORTED);
5126 return CAMERA_ERROR_NOT_SUPPORTED;
5128 int ret = CAMERA_ERROR_NONE;
5130 camera_cli_s *pc = (camera_cli_s *)camera;
5131 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_HDR_CAPTURE_PROGRESS_CB;
5133 if (pc->cb_info == NULL) {
5134 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5135 return CAMERA_ERROR_INVALID_PARAMETER;
5137 sock_fd = pc->cb_info->fd;
5138 LOGD("Enter, handle :%x", pc->remote_handle);
5140 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = callback;
5141 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = user_data;
5143 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5144 LOGD("ret : 0x%x", ret);
5149 int camera_attr_unset_hdr_capture_progress_cb(camera_h camera)
5151 if (camera == NULL) {
5152 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5153 return CAMERA_ERROR_INVALID_PARAMETER;
5156 int ret = CAMERA_ERROR_NONE;
5158 camera_cli_s *pc = (camera_cli_s *)camera;
5159 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_UNSET_HDR_CAPTURE_PROGRESS_CB;
5161 if (pc->cb_info == NULL) {
5162 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5163 return CAMERA_ERROR_INVALID_PARAMETER;
5165 sock_fd = pc->cb_info->fd;
5166 LOGD("Enter, handle :%x", pc->remote_handle);
5168 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = (void *)NULL;
5169 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = (void *)NULL;
5171 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5172 LOGD("ret : 0x%x", ret);
5177 int camera_attr_enable_anti_shake(camera_h camera, bool enable)
5179 if (camera == 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_ENABLE_ANTI_SHAKE;
5188 if (pc->cb_info == NULL) {
5189 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5190 return CAMERA_ERROR_INVALID_PARAMETER;
5192 sock_fd = pc->cb_info->fd;
5193 int set_enable = (int)enable;
5195 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5196 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
5197 LOGD("ret : 0x%x", ret);
5202 int camera_attr_is_enabled_anti_shake(camera_h camera , bool *enabled)
5204 if (camera == NULL) {
5205 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5206 return CAMERA_ERROR_INVALID_PARAMETER;
5208 if (enabled == NULL) {
5209 LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER);
5210 return CAMERA_ERROR_NOT_SUPPORTED;
5212 int ret = CAMERA_ERROR_NONE;
5213 camera_cli_s *pc = (camera_cli_s *)camera;
5214 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_ANTI_SHAKE;
5216 if (pc->cb_info == NULL) {
5217 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5218 return CAMERA_ERROR_INVALID_PARAMETER;
5220 sock_fd = pc->cb_info->fd;
5223 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5224 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5226 if (ret == CAMERA_ERROR_NONE) {
5227 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
5228 *enabled = (bool)get_enabled;
5230 LOGD("ret : 0x%x", ret);
5235 bool camera_attr_is_supported_anti_shake(camera_h camera)
5238 if (camera == NULL) {
5239 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5243 int ret = CAMERA_ERROR_NONE;
5244 camera_cli_s *pc = (camera_cli_s *)camera;
5245 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_ANTI_SHAKE;
5247 if (pc->cb_info == NULL) {
5248 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5249 return CAMERA_ERROR_INVALID_PARAMETER;
5251 sock_fd = pc->cb_info->fd;
5252 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5253 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5254 LOGD("ret : 0x%x", ret);
5259 int camera_attr_enable_video_stabilization(camera_h camera, bool enable)
5261 if (camera == NULL) {
5262 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5263 return CAMERA_ERROR_INVALID_PARAMETER;
5266 int ret = CAMERA_ERROR_NONE;
5267 camera_cli_s *pc = (camera_cli_s *)camera;
5268 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_VIDEO_STABILIZATION;
5270 if (pc->cb_info == NULL) {
5271 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5272 return CAMERA_ERROR_INVALID_PARAMETER;
5274 sock_fd = pc->cb_info->fd;
5275 int set_enable = (int)enable;
5277 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5278 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
5279 LOGD("ret : 0x%x", ret);
5284 int camera_attr_is_enabled_video_stabilization(camera_h camera, bool *enabled)
5286 if (camera == NULL) {
5287 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5288 return CAMERA_ERROR_INVALID_PARAMETER;
5290 if (enabled == NULL) {
5291 LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER);
5292 return CAMERA_ERROR_NOT_SUPPORTED;
5294 int ret = CAMERA_ERROR_NONE;
5295 camera_cli_s *pc = (camera_cli_s *)camera;
5296 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_VIDEO_STABILIZATION;
5298 if (pc->cb_info == NULL) {
5299 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5300 return CAMERA_ERROR_INVALID_PARAMETER;
5302 sock_fd = pc->cb_info->fd;
5305 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5306 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5308 if (ret == CAMERA_ERROR_NONE) {
5309 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
5310 *enabled = (bool)get_enabled;
5312 LOGD("ret : 0x%x", ret);
5317 bool camera_attr_is_supported_video_stabilization(camera_h camera)
5319 if (camera == NULL) {
5320 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5324 int ret = CAMERA_ERROR_NONE;
5325 camera_cli_s *pc = (camera_cli_s *)camera;
5326 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_VIDEO_STABILIZATION;
5328 if (pc->cb_info == NULL) {
5329 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5330 return CAMERA_ERROR_INVALID_PARAMETER;
5332 sock_fd = pc->cb_info->fd;
5333 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5334 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5335 LOGD("ret : 0x%x", ret);
5340 int camera_attr_enable_auto_contrast(camera_h camera, bool enable)
5342 if (camera == NULL) {
5343 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5344 return CAMERA_ERROR_INVALID_PARAMETER;
5347 int ret = CAMERA_ERROR_NONE;
5348 camera_cli_s *pc = (camera_cli_s *)camera;
5349 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_AUTO_CONTRAST;
5351 if (pc->cb_info == NULL) {
5352 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5353 return CAMERA_ERROR_INVALID_PARAMETER;
5355 sock_fd = pc->cb_info->fd;
5356 int set_enable = (int)enable;
5358 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5359 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
5360 LOGD("ret : 0x%x", ret);
5365 int camera_attr_is_enabled_auto_contrast(camera_h camera, bool *enabled)
5367 if (camera == NULL) {
5368 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
5369 return CAMERA_ERROR_INVALID_PARAMETER;
5371 if (enabled == NULL) {
5372 LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER);
5373 return CAMERA_ERROR_INVALID_PARAMETER;
5375 int ret = CAMERA_ERROR_NONE;
5376 camera_cli_s *pc = (camera_cli_s *)camera;
5377 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_AUTO_CONTRAST;
5379 if (pc->cb_info == NULL) {
5380 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5381 return CAMERA_ERROR_INVALID_PARAMETER;
5383 sock_fd = pc->cb_info->fd;
5386 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5387 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5389 if (ret == CAMERA_ERROR_NONE) {
5390 muse_camera_msg_get(get_enabled, pc->cb_info->recv_msg);
5391 *enabled = (bool)get_enabled;
5393 LOGD("ret : 0x%x", ret);
5398 bool camera_attr_is_supported_auto_contrast(camera_h camera)
5400 if (camera == NULL) {
5401 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5405 int ret = CAMERA_ERROR_NONE;
5406 camera_cli_s *pc = (camera_cli_s *)camera;
5407 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_AUTO_CONTRAST;
5409 if (pc->cb_info == NULL) {
5410 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5411 return CAMERA_ERROR_INVALID_PARAMETER;
5413 sock_fd = pc->cb_info->fd;
5414 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5415 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
5416 LOGD("ret : 0x%x", ret);
5421 int camera_attr_disable_shutter_sound(camera_h camera, bool disable)
5423 if (camera == NULL) {
5424 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5425 return CAMERA_ERROR_INVALID_PARAMETER;
5428 int ret = CAMERA_ERROR_NONE;
5429 camera_cli_s *pc = (camera_cli_s *)camera;
5430 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_DISABLE_SHUTTER_SOUND;
5432 if (pc->cb_info == NULL) {
5433 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
5434 return CAMERA_ERROR_INVALID_PARAMETER;
5436 sock_fd = pc->cb_info->fd;
5437 int set_disable = (int)disable;
5439 LOGD("Enter, remote_handle : %x", pc->remote_handle);
5440 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_disable);
5441 LOGD("ret : 0x%x", ret);