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>
31 #include <Elementary.h>
32 #include <mm_camcorder_client.h>
35 #include <Ecore_Wayland.h>
43 #define LOG_TAG "TIZEN_N_CAMERA_CLIENT"
46 static int _import_tbm_key(tbm_bufmgr bufmgr, unsigned int tbm_key, tbm_bo *bo, tbm_bo_handle *bo_handle)
49 tbm_bo_handle tmp_bo_handle = {NULL, };
51 if (bufmgr == NULL || bo == NULL || bo_handle == NULL || tbm_key == 0) {
52 LOGE("invalid parameter - bufmgr %p, bo %p, bo_handle %p, key %d",
53 bufmgr, bo, bo_handle, tbm_key);
57 tmp_bo = tbm_bo_import(bufmgr, tbm_key);
59 LOGE("bo import failed - bufmgr %p, key %d", bufmgr, tbm_key);
63 tmp_bo_handle = tbm_bo_map(tmp_bo, TBM_DEVICE_CPU, TBM_OPTION_READ);
64 if (tmp_bo_handle.ptr == NULL) {
65 LOGE("bo map failed %p", tmp_bo);
71 /* set bo and bo_handle */
73 *bo_handle = tmp_bo_handle;
78 static void _release_imported_bo(tbm_bo *bo)
80 if (bo == NULL || *bo == NULL) {
92 static int client_wait_for_cb_return(muse_camera_api_e api, callback_cb_info_s *cb_info, int time_out)
94 int ret = CAMERA_ERROR_NONE;
97 LOGD("Enter api : %d", api);
98 g_mutex_lock(&(cb_info->pMutex[api]));
100 if (cb_info->activating[api] == 0) {
101 end_time = g_get_monotonic_time() + time_out * G_TIME_SPAN_SECOND;
102 if (g_cond_wait_until(&(cb_info->pCond[api]), &(cb_info->pMutex[api]), end_time)) {
103 LOGD("cb_info->recvApiMsg : %s", cb_info->recvApiMsg);
104 if (!muse_camera_msg_get(ret, cb_info->recvApiMsg)) {
105 LOGE("Get cb msg failed.");
106 ret = CAMERA_ERROR_INVALID_OPERATION;
108 LOGD("Wait passed, ret : 0x%x", ret);
110 if (cb_info->activating[api])
111 cb_info->activating[api] = 0;
113 LOGD("api %d was TIMED OUT!", api);
114 ret = CAMERA_ERROR_INVALID_OPERATION;
117 LOGE("condition is already checked for the api : %d.", api);
118 if (!muse_camera_msg_get(ret, cb_info->recvApiMsg)) {
119 LOGE("Get cb msg failed.");
120 ret = CAMERA_ERROR_INVALID_OPERATION;
122 LOGD("Already checked condition, Wait passed, ret : 0x%x", ret);
125 g_mutex_unlock(&(cb_info->pMutex[api]));
126 LOGD("ret : 0x%x", ret);
130 static void _client_user_callback(callback_cb_info_s *cb_info, char *recvMsg, muse_camera_event_e event)
136 tbm_bo_handle bo_handle = {NULL, };
138 if (recvMsg == NULL || event >= MUSE_CAMERA_EVENT_TYPE_NUM) {
139 LOGE("invalid parameter - msg %p, event %d", recvMsg, event);
143 LOGD("get msg %s, event %d", recvMsg, event);
145 if (cb_info->user_cb[event] == NULL) {
146 LOGW("user callback for event %d is not set", event);
151 case MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE:
157 muse_camera_msg_get(previous, recvMsg);
158 muse_camera_msg_get(current, recvMsg);
159 muse_camera_msg_get(by_policy, recvMsg);
161 LOGD("STATE CHANGE - previous %d, current %d, by_policy %d",
162 previous, current, by_policy);
164 ((camera_state_changed_cb)cb_info->user_cb[event])((camera_state_e)previous,
165 (camera_state_e)current,
167 cb_info->user_data[event]);
170 case MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE:
174 muse_camera_msg_get(state, recvMsg);
176 LOGD("FOCUS state - %d", state);
178 ((camera_focus_changed_cb)cb_info->user_cb[event])((camera_focus_state_e)state,
179 cb_info->user_data[event]);
182 case MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE:
183 LOGD("CAPTURE_COMPLETED");
184 ((camera_capture_completed_cb)cb_info->user_cb[event])(cb_info->user_data[event]);
186 case MUSE_CAMERA_EVENT_TYPE_PREVIEW:
188 unsigned char *buf_pos = NULL;
189 camera_preview_data_s *frame = NULL;
192 muse_camera_msg_get(tbm_key, recvMsg);
195 LOGE("invalid key %d", tbm_key);
199 /* import tbm bo and get virtual address */
200 if (!_import_tbm_key(cb_info->bufmgr, tbm_key, &bo, &bo_handle)) {
204 buf_pos = (unsigned char *)bo_handle.ptr;
206 frame = (camera_preview_data_s *)buf_pos;
207 buf_pos += sizeof(camera_preview_data_s);
209 switch (frame->num_of_planes) {
211 frame->data.single_plane.yuv = buf_pos;
212 total_size = frame->data.single_plane.size;
214 frame->data.double_plane.y = buf_pos;
215 buf_pos += frame->data.double_plane.y_size;
216 frame->data.double_plane.uv = buf_pos;
217 total_size = frame->data.double_plane.y_size + \
218 frame->data.double_plane.uv_size;
220 frame->data.triple_plane.y = buf_pos;
221 buf_pos += frame->data.triple_plane.y_size;
222 frame->data.triple_plane.u = buf_pos;
223 buf_pos += frame->data.triple_plane.u_size;
224 frame->data.triple_plane.v = buf_pos;
225 total_size = frame->data.triple_plane.y_size + \
226 frame->data.triple_plane.u_size + \
227 frame->data.triple_plane.v_size;
232 LOGD("PREVIEW_CB - format %d, %dx%d, size %d plane num %d",
233 frame->format, frame->width, frame->height, total_size, frame->num_of_planes);
235 ((camera_preview_cb)cb_info->user_cb[event])(frame, cb_info->user_data[event]);
237 LOGD("PREVIEW_CB retuned");
239 /* unmap and unref tbm bo */
240 _release_imported_bo(&bo);
243 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
244 cb_info->fd, cb_info,
247 LOGD("return buffer Done");
250 case MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW:
251 ((camera_media_packet_preview_cb)cb_info->user_cb[event])(NULL, cb_info->user_data[event]);
253 case MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS:
257 muse_camera_msg_get(percent, recvMsg);
259 LOGD("HDR progress - %d \%", percent);
261 ((camera_attr_hdr_progress_cb)cb_info->user_cb[event])(percent, cb_info->user_data[event]);
264 case MUSE_CAMERA_EVENT_TYPE_INTERRUPTED:
270 muse_camera_msg_get(policy, recvMsg);
271 muse_camera_msg_get(previous, recvMsg);
272 muse_camera_msg_get(current, recvMsg);
274 LOGD("INTERRUPTED - policy %d, state previous %d, current %d",
275 policy, previous, current);
277 ((camera_interrupted_cb)cb_info->user_cb[event])((camera_policy_e)policy,
278 (camera_state_e)previous,
279 (camera_state_e)current,
280 cb_info->user_data[event]);
283 case MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION:
286 camera_detected_face_s *faces = NULL;
288 muse_camera_msg_get(count, recvMsg);
289 muse_camera_msg_get(tbm_key, recvMsg);
291 if (count > 0 && tbm_key > 0) {
292 LOGD("FACE_DETECTION - count %d, tbm_key %d", count, tbm_key);
294 if (!_import_tbm_key(cb_info->bufmgr, tbm_key, &bo, &bo_handle)) {
299 faces = bo_handle.ptr;
301 ((camera_face_detected_cb)cb_info->user_cb[event])(faces, count, cb_info->user_data[event]);
307 for (i = 0 ; i < count ; i++) {
308 LOGD("id[%2d] - score %d, position (%d,%d,%dx%d)",
309 i, faces[i].score, faces[i].x, faces[i].y, faces[i].width, faces[i].height);
315 _release_imported_bo(&bo);
318 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
319 cb_info->fd, cb_info,
322 LOGD("return buffer done");
324 LOGE("invalid message - count %d, key %d", count, tbm_key);
328 case MUSE_CAMERA_EVENT_TYPE_ERROR:
331 int current_state = 0;
333 muse_camera_msg_get(error, recvMsg);
334 muse_camera_msg_get(current_state, recvMsg);
336 LOGE("ERROR - error 0x%x, current_state %d", error, current_state);
338 ((camera_error_cb)cb_info->user_cb[event])((camera_error_e)error,
339 (camera_state_e)current_state,
340 cb_info->user_data[event]);
343 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_RESOLUTION:
344 muse_camera_msg_get(param1, recvMsg);
345 muse_camera_msg_get(param2, recvMsg);
347 LOGD("SUPPORTED_PREVIEW_RESOLUTION - %d x %d", param1, param2);
349 ((camera_supported_preview_resolution_cb)cb_info->user_cb[event])(param1, param2, cb_info->user_data[event]);
351 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_RESOLUTION:
352 muse_camera_msg_get(param1, recvMsg);
353 muse_camera_msg_get(param2, recvMsg);
355 LOGD("SUPPORTED_CAPTURE_RESOLUTION - %d x %d", param1, param2);
357 ((camera_supported_capture_resolution_cb)cb_info->user_cb[event])(param1, param2, cb_info->user_data[event]);
359 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_FORMAT:
360 muse_camera_msg_get(param1, recvMsg);
362 LOGD("SUPPORTED_CAPTURE_FORMAT - %d ", param1);
364 ((camera_supported_capture_format_cb)cb_info->user_cb[event])((camera_pixel_format_e)param1, cb_info->user_data[event]);
366 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_FORMAT:
367 muse_camera_msg_get(param1, recvMsg);
369 LOGD("SUPPORTED_PREVIEW_FORMAT - %d ", param1);
371 ((camera_supported_preview_format_cb)cb_info->user_cb[event])((camera_pixel_format_e)param1, cb_info->user_data[event]);
373 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_AF_MODE:
374 muse_camera_msg_get(param1, recvMsg);
376 LOGD("SUPPORTED_AF_MODE - %d ", param1);
378 ((camera_attr_supported_af_mode_cb)cb_info->user_cb[event])((camera_attr_af_mode_e)param1, cb_info->user_data[event]);
380 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EXPOSURE_MODE:
381 muse_camera_msg_get(param1, recvMsg);
383 LOGD("SUPPORTED_EXPOSURE_MODE - %d ", param1);
385 ((camera_attr_supported_exposure_mode_cb)cb_info->user_cb[event])((camera_attr_exposure_mode_e)param1, cb_info->user_data[event]);
387 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_ISO:
388 muse_camera_msg_get(param1, recvMsg);
390 LOGD("SUPPORTED_ISO - %d ", param1);
392 ((camera_attr_supported_iso_cb)cb_info->user_cb[event])((camera_attr_iso_e)param1, cb_info->user_data[event]);
394 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_WHITEBALANCE:
395 muse_camera_msg_get(param1, recvMsg);
397 LOGD("SUPPORTED_WHITEBALANCE - %d ", param1);
399 ((camera_attr_supported_whitebalance_cb)cb_info->user_cb[event])((camera_attr_whitebalance_e)param1, cb_info->user_data[event]);
401 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EFFECT:
402 muse_camera_msg_get(param1, recvMsg);
404 LOGD("SUPPORTED_EFFECT - %d ", param1);
406 ((camera_attr_supported_effect_cb)cb_info->user_cb[event])((camera_attr_effect_mode_e)param1, cb_info->user_data[event]);
408 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_SCENE_MODE:
409 muse_camera_msg_get(param1, recvMsg);
411 LOGD("SUPPORTED_SCENE_MODE - %d ", param1);
413 ((camera_attr_supported_scene_mode_cb)cb_info->user_cb[event])((camera_attr_scene_mode_e)param1, cb_info->user_data[event]);
415 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FLASH_MODE:
416 muse_camera_msg_get(param1, recvMsg);
418 LOGD("SUPPORTED_FLASH_MODE - %d ", param1);
420 ((camera_attr_supported_flash_mode_cb)cb_info->user_cb[event])((camera_attr_flash_mode_e)param1, cb_info->user_data[event]);
422 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS:
423 muse_camera_msg_get(param1, recvMsg);
425 LOGD("SUPPORTED_FPS - %d ", param1);
427 ((camera_attr_supported_fps_cb)cb_info->user_cb[event])((camera_attr_fps_e)param1, cb_info->user_data[event]);
429 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS_BY_RESOLUTION:
430 muse_camera_msg_get(param1, recvMsg);
432 LOGD("SUPPORTED_FPS_BY_RESOLUTION - %d ", param1);
434 ((camera_attr_supported_fps_cb)cb_info->user_cb[event])((camera_attr_fps_e)param1, cb_info->user_data[event]);
436 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_FLIP:
437 muse_camera_msg_get(param1, recvMsg);
439 LOGD("SUPPORTED_STREAM_FLIP - %d ", param1);
441 ((camera_attr_supported_stream_flip_cb)cb_info->user_cb[event])((camera_flip_e)param1, cb_info->user_data[event]);
443 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION:
444 muse_camera_msg_get(param1, recvMsg);
446 LOGD("SUPPORTED_STREAM_ROTATION - %d ", param1);
448 ((camera_attr_supported_stream_rotation_cb)cb_info->user_cb[event])((camera_rotation_e)param1, cb_info->user_data[event]);
450 case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE:
451 muse_camera_msg_get(param1, recvMsg);
453 LOGD("SUPPORTED_THEATER_MODE - %d ", param1);
455 ((camera_attr_supported_theater_mode_cb)cb_info->user_cb[event])((camera_attr_theater_mode_e)param1, cb_info->user_data[event]);
457 case MUSE_CAMERA_EVENT_TYPE_CAPTURE:
459 camera_image_data_s *rImage = NULL;
460 camera_image_data_s *rPostview = NULL;
461 camera_image_data_s *rThumbnail = NULL;
462 unsigned char *buf_pos = NULL;
464 int is_thumbnail = 0;
466 muse_camera_msg_get(tbm_key, recvMsg);
467 muse_camera_msg_get(is_postview, recvMsg);
468 muse_camera_msg_get(is_thumbnail, recvMsg);
470 LOGD("camera capture callback came in. key %d, postview %d, thumbnail %d",
471 tbm_key, is_postview, is_thumbnail);
474 LOGE("invalid key %d", tbm_key);
478 /* import tbm bo and get virtual address */
479 if (!_import_tbm_key(cb_info->bufmgr, tbm_key, &bo, &bo_handle)) {
483 buf_pos = (unsigned char *)bo_handle.ptr;
484 rImage = (camera_image_data_s *)buf_pos;
485 rImage->data = buf_pos + sizeof(camera_image_data_s);
486 buf_pos += sizeof(camera_image_data_s) + rImage->size;
489 rPostview = (camera_image_data_s *)buf_pos;
490 LOGD("rPostview->size : %d", rPostview->size);
491 rPostview->data = buf_pos + sizeof(camera_image_data_s);
492 buf_pos += sizeof(camera_image_data_s) + rPostview->size;
496 rThumbnail = (camera_image_data_s *)buf_pos;
497 LOGD("rThumbnail->size : %d", rThumbnail->size);
498 rThumbnail->data = buf_pos + sizeof(camera_image_data_s);
499 buf_pos += sizeof(camera_image_data_s) + rThumbnail->size;
502 LOGD("image info %dx%d, size : %d", rImage->height, rImage->width, rImage->size);
504 ((camera_capturing_cb)cb_info->user_cb[event])(rImage, rPostview, rThumbnail, cb_info->user_data[event]);
506 /* unmap and unref tbm bo */
507 _release_imported_bo(&bo);
510 muse_camera_msg_send1_no_return(MUSE_CAMERA_API_RETURN_BUFFER,
515 LOGD("return buffer done");
518 case MUSE_CAMERA_EVENT_TYPE_VIDEO_FRAME_RENDER_ERROR:
521 LOGW("Unknown event : %d", event);
528 static void *_event_handler(gpointer data)
530 event_info_s *e_info = NULL;
531 callback_cb_info_s *cb_info = (callback_cb_info_s *)data;
533 if (cb_info == NULL) {
534 LOGE("cb_info NULL");
540 g_mutex_lock(&cb_info->event_mutex);
542 while (g_atomic_int_get(&cb_info->event_thread_running)) {
543 if (g_queue_is_empty(cb_info->event_queue)) {
544 LOGD("signal wait...");
545 g_cond_wait(&cb_info->event_cond, &cb_info->event_mutex);
546 LOGD("signal received");
548 if (g_atomic_int_get(&cb_info->event_thread_running) == 0) {
549 LOGD("stop event thread");
554 e_info = (event_info_s *)g_queue_pop_head(cb_info->event_queue);
556 g_mutex_unlock(&cb_info->event_mutex);
559 _client_user_callback(e_info->cb_info, e_info->recvMsg, e_info->event);
563 LOGW("NULL event info");
566 g_mutex_lock(&cb_info->event_mutex);
569 /* remove remained event */
570 while (!g_queue_is_empty(cb_info->event_queue)) {
571 e_info = (event_info_s *)g_queue_pop_head(cb_info->event_queue);
573 LOGD("remove event info %p", e_info);
577 LOGW("NULL event info");
581 g_mutex_unlock(&cb_info->event_mutex);
588 static bool _camera_idle_event_callback(void *data)
590 event_info_s *e_info = (event_info_s *)data;
592 if (e_info == NULL) {
593 LOGE("event info is NULL");
597 _client_user_callback(e_info->cb_info, e_info->recvMsg, e_info->event);
604 static void *client_cb_handler(gpointer data)
612 callback_cb_info_s *cb_info = (callback_cb_info_s *)data;
613 char *recvMsg = NULL;
614 char **parseStr = NULL;
616 if (cb_info == NULL) {
617 LOGE("cb_info NULL");
623 parseStr = (char **)malloc(sizeof(char *) * CAMERA_PARSE_STRING_SIZE);
624 if (parseStr == NULL) {
625 LOGE("parseStr malloc failed");
629 for (i = 0 ; i < CAMERA_PARSE_STRING_SIZE ; i++) {
630 parseStr[i] = (char *)malloc(sizeof(char) * MUSE_CAMERA_MSG_MAX_LENGTH);
631 if (parseStr[i] == NULL) {
632 LOGE("parseStr[%d] malloc failed", i);
633 goto CB_HANDLER_EXIT;
637 recvMsg = cb_info->recvMsg;
639 while (g_atomic_int_get(&cb_info->rcv_thread_running)) {
640 ret = muse_core_ipc_recv_msg(cb_info->fd, recvMsg);
649 LOGD("recvMSg : %s, length : %d", recvMsg, ret);
651 /* Need to split the combined entering msgs.
652 This module supports up to 200 combined msgs. */
653 for (str_pos = 0; str_pos < ret; str_pos++) {
654 if(recvMsg[str_pos] == '}') {
655 memset(parseStr[num_token], 0x0, sizeof(char) * MUSE_CAMERA_MSG_MAX_LENGTH);
656 strncpy(parseStr[num_token], recvMsg + prev_pos, str_pos - prev_pos + 1);
657 LOGD("splitted msg : [%s], Index : %d", parseStr[num_token], num_token);
658 prev_pos = str_pos+1;
663 LOGD("num_token : %d", num_token);
665 /* Re-construct to the useful single msg. */
666 for (i = 0; i < num_token; i++) {
668 if (i >= CAMERA_PARSE_STRING_SIZE)
671 if (muse_camera_msg_get(api, parseStr[i])) {
672 if(api < MUSE_CAMERA_API_MAX){
673 LOGD("Set Condition - api %d", api);
674 g_mutex_lock(&(cb_info->pMutex[api]));
676 /* The api msgs should be distinguished from the event msg. */
677 memset(cb_info->recvApiMsg, 0, strlen(cb_info->recvApiMsg));
678 strcpy(cb_info->recvApiMsg, parseStr[i]);
679 LOGD("cb_info->recvApiMsg : [%s]", cb_info->recvApiMsg);
680 cb_info->activating[api] = 1;
681 g_cond_signal(&(cb_info->pCond[api]));
682 g_mutex_unlock(&(cb_info->pMutex[api]));
684 if (api == MUSE_CAMERA_API_CREATE) {
685 if (muse_camera_msg_get(ret, cb_info->recvApiMsg)) {
686 if (ret != CAMERA_ERROR_NONE) {
687 g_atomic_int_set(&cb_info->rcv_thread_running, 0);
688 LOGE("camera create error 0x%x. close client cb handler", ret);
691 LOGE("failed to get api return");
693 } else if (api == MUSE_CAMERA_API_DESTROY) {
694 if (muse_camera_msg_get(ret, cb_info->recvApiMsg)) {
695 if (ret == CAMERA_ERROR_NONE) {
696 g_atomic_int_set(&cb_info->rcv_thread_running, 0);
697 LOGD("camera destroy done. close client cb handler");
700 LOGE("failed to get api return");
703 } else if(api == MUSE_CAMERA_CB_EVENT) {
707 if (muse_camera_msg_get(event, parseStr[i]) &&
708 muse_camera_msg_get(class, parseStr[i])) {
709 event_info_s *e_info = NULL;
711 if (class == MUSE_CAMERA_EVENT_CLASS_NORMAL ||
712 class == MUSE_CAMERA_EVENT_CLASS_IDLE) {
713 e_info = (event_info_s *)malloc(sizeof(event_info_s));
715 e_info->event = event;
716 e_info->cb_info = cb_info;
717 memcpy(e_info->recvMsg, recvMsg, sizeof(e_info->recvMsg));
719 if (class == MUSE_CAMERA_EVENT_CLASS_NORMAL) {
720 LOGD("add event to EVENT QUEUE : %d", event);
721 g_mutex_lock(&cb_info->event_mutex);
722 g_queue_push_tail(cb_info->event_queue, (gpointer)e_info);
723 g_cond_signal(&cb_info->event_cond);
724 g_mutex_unlock(&cb_info->event_mutex);
726 LOGD("add event to IDLE : %d", event);
727 g_idle_add_full(G_PRIORITY_DEFAULT, (GSourceFunc)_camera_idle_event_callback, (gpointer)e_info, NULL);
730 LOGE("e_info alloc failed");
732 } else if (class == MUSE_CAMERA_EVENT_CLASS_IMMEDIATE) {
733 _client_user_callback(cb_info, recvMsg, event);
735 LOGE("unknown class %d", class);
739 LOGW("unknown api : %d", api);
742 LOGE("Get Msg Failed");
748 LOGD("client cb exit");
752 for (i = 0 ; i < CAMERA_PARSE_STRING_SIZE ; i++) {
766 static callback_cb_info_s *client_callback_new(gint sockfd)
768 callback_cb_info_s *cb_info;
770 GMutex *camera_mutex;
772 g_return_val_if_fail(sockfd > 0, NULL);
774 cb_info = g_new0(callback_cb_info_s, 1);
775 camera_cond = g_new0(GCond, MUSE_CAMERA_API_MAX);
776 camera_mutex = g_new0(GMutex, MUSE_CAMERA_API_MAX);
777 camera_activ = g_new0(gint, MUSE_CAMERA_API_MAX);
779 g_atomic_int_set(&cb_info->rcv_thread_running, 1);
780 cb_info->fd = sockfd;
781 cb_info->pCond = camera_cond;
782 cb_info->pMutex = camera_mutex;
783 cb_info->activating = camera_activ;
784 cb_info->msg_rcv_thread = g_thread_new("msg_rcv_thread", client_cb_handler, (gpointer)cb_info);
786 g_atomic_int_set(&cb_info->event_thread_running, 1);
787 g_mutex_init(&cb_info->event_mutex);
788 g_cond_init(&cb_info->event_cond);
789 cb_info->event_queue = g_queue_new();
790 cb_info->event_thread = g_thread_new("event_thread", _event_handler, (gpointer)cb_info);
795 static void client_callback_destroy(callback_cb_info_s * cb_info)
797 g_return_if_fail(cb_info != NULL);
799 LOGI("MSG receive thread[%p] destroy", cb_info->msg_rcv_thread);
801 g_thread_join(cb_info->msg_rcv_thread);
802 g_thread_unref(cb_info->msg_rcv_thread);
803 cb_info->msg_rcv_thread = NULL;
805 LOGD("msg thread removed");
807 g_mutex_lock(&cb_info->event_mutex);
808 g_atomic_int_set(&cb_info->event_thread_running, 0);
809 g_cond_signal(&cb_info->event_cond);
810 g_mutex_unlock(&cb_info->event_mutex);
812 g_thread_join(cb_info->event_thread);
813 g_thread_unref(cb_info->event_thread);
814 cb_info->event_thread = NULL;
816 g_queue_free(cb_info->event_queue);
817 cb_info->event_queue = NULL;
818 g_mutex_clear(&cb_info->event_mutex);
819 g_cond_clear(&cb_info->event_cond);
821 LOGD("event thread removed");
823 if (cb_info->bufmgr) {
824 tbm_bufmgr_deinit(cb_info->bufmgr);
825 cb_info->bufmgr = NULL;
828 if (cb_info->pCond) {
829 g_free(cb_info->pCond);
831 if (cb_info->pMutex) {
832 g_free(cb_info->pMutex);
834 if (cb_info->activating) {
835 g_free(cb_info->activating);
843 int camera_create(camera_device_e device, camera_h* camera)
847 int ret = CAMERA_ERROR_NONE;
849 camera_cli_s *pc = NULL;
850 tbm_bufmgr bufmgr = NULL;
852 muse_camera_api_e api = MUSE_CAMERA_API_CREATE;
853 muse_core_api_module_e muse_module = MUSE_CAMERA;
854 int device_type = (int)device;
857 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
858 return CAMERA_ERROR_INVALID_PARAMETER;
861 bufmgr = tbm_bufmgr_init(-1);
862 if (bufmgr == NULL) {
863 LOGE("get tbm bufmgr failed");
864 return CAMERA_ERROR_INVALID_OPERATION;
867 sock_fd = muse_core_client_new();
869 LOGE("muse_core_client_new failed - returned fd %d", sock_fd);
870 ret = CAMERA_ERROR_INVALID_OPERATION;
876 sndMsg = muse_core_msg_json_factory_new(api,
877 MUSE_TYPE_INT, "module", muse_module,
878 MUSE_TYPE_INT, PARAM_DEVICE_TYPE, device_type,
879 MUSE_TYPE_INT, "pid", pid,
882 muse_core_ipc_send_msg(sock_fd, sndMsg);
883 muse_core_msg_json_factory_free(sndMsg);
885 pc = g_new0(camera_cli_s, 1);
887 ret = CAMERA_ERROR_OUT_OF_MEMORY;
891 pc->cb_info = client_callback_new(sock_fd);
893 LOGD("cb info : %d", pc->cb_info->fd);
895 ret = client_wait_for_cb_return(api, pc->cb_info, CALLBACK_TIME_OUT);
896 if (ret == CAMERA_ERROR_NONE) {
898 muse_camera_msg_get_pointer(handle, pc->cb_info->recvMsg);
900 LOGE("Receiving Handle Failed!!");
901 ret = CAMERA_ERROR_INVALID_OPERATION;
905 pc->remote_handle = handle;
906 pc->cb_info->bufmgr = bufmgr;
908 LOGD("camera create 0x%x", pc->remote_handle);
909 *camera = (camera_h) pc;
917 tbm_bufmgr_deinit(bufmgr);
921 client_callback_destroy(pc->cb_info);
927 LOGE("camera create error : 0x%x", ret);
932 int camera_destroy(camera_h camera)
934 if (camera == NULL) {
935 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
936 return CAMERA_ERROR_INVALID_PARAMETER;
939 int ret = CAMERA_ERROR_NONE;
940 muse_camera_api_e api = MUSE_CAMERA_API_DESTROY;
941 camera_cli_s *pc = (camera_cli_s *)camera;
942 int sock_fd = pc->cb_info->fd;
946 LOGE("pc is already nul!!");
947 return CAMERA_ERROR_INVALID_PARAMETER;
948 } else if (pc->cb_info == NULL) {
949 return CAMERA_ERROR_INVALID_PARAMETER;
952 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
953 if (ret == CAMERA_ERROR_NONE) {
954 client_callback_destroy(pc->cb_info);
958 LOGE("camera destroy error : 0x%x", ret);
964 int camera_start_preview(camera_h camera)
967 if (camera == NULL) {
968 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
969 return CAMERA_ERROR_INVALID_PARAMETER;
972 int ret = CAMERA_ERROR_NONE;
973 muse_camera_api_e api = MUSE_CAMERA_API_START_PREVIEW;
974 camera_cli_s *pc = (camera_cli_s *)camera;
976 char caps[MUSE_CAMERA_MSG_MAX_LENGTH] = {0};
978 if (pc->cb_info == NULL) {
979 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
980 return CAMERA_ERROR_INVALID_PARAMETER;
983 sock_fd = pc->cb_info->fd;
985 muse_camera_msg_send_longtime(api, sock_fd, pc->cb_info, ret);
986 LOGD("Enter, ret :0x%x", ret);
987 if(ret == CAMERA_ERROR_NONE) {
988 muse_camera_msg_get_string(caps, pc->cb_info->recvMsg);
989 LOGD("caps : %s", caps);
990 if (pc->cli_display_handle != 0) {
991 LOGD("client's display handle is : 0x%x", pc->cli_display_handle);
992 if(strlen(caps) > 0 &&
993 mm_camcorder_client_realize(pc->client_handle, caps) != MM_ERROR_NONE)
994 ret = CAMERA_ERROR_INVALID_OPERATION;
996 LOGD("display handle is NULL");
999 LOGD("ret : 0x%x", ret);
1003 int camera_stop_preview(camera_h camera)
1005 if (camera == NULL) {
1006 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1007 return CAMERA_ERROR_INVALID_PARAMETER;
1009 int ret = CAMERA_ERROR_NONE;
1010 camera_cli_s *pc = (camera_cli_s *)camera;
1012 muse_camera_api_e api = MUSE_CAMERA_API_STOP_PREVIEW;
1014 if (pc->cb_info == NULL) {
1015 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1016 return CAMERA_ERROR_INVALID_PARAMETER;
1019 sock_fd = pc->cb_info->fd;
1021 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
1023 if(ret == CAMERA_ERROR_NONE) {
1024 if (pc->cli_display_handle != 0) {
1025 LOGD("Unrealize client");
1026 if (pc->client_handle != NULL) {
1027 ret = mm_camcorder_client_unrealize(pc->client_handle);
1028 mm_camcorder_client_destroy(pc->client_handle);
1031 LOGD("Client did not realized : Display handle is NULL");
1034 LOGD("ret : 0x%x", ret);
1038 int camera_start_capture(camera_h camera, camera_capturing_cb capturing_cb , camera_capture_completed_cb completed_cb , void *user_data)
1040 if (camera == NULL) {
1041 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1042 return CAMERA_ERROR_INVALID_PARAMETER;
1044 int ret = CAMERA_ERROR_NONE;
1046 camera_cli_s *pc = (camera_cli_s *)camera;
1047 muse_camera_api_e api = MUSE_CAMERA_API_START_CAPTURE;
1049 int is_capturing_cb = 0;
1050 int is_completed_cb = 0;
1051 LOGD("Enter, handle :%x", pc->remote_handle);
1053 if (pc->cb_info == NULL) {
1054 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1055 return CAMERA_ERROR_INVALID_PARAMETER;
1058 sock_fd = pc->cb_info->fd;
1060 if (capturing_cb != NULL) {
1061 is_capturing_cb = 1;
1062 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = capturing_cb;
1063 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = user_data;
1066 if(completed_cb != NULL) {
1067 is_completed_cb = 1;
1068 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = completed_cb;
1069 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = user_data;
1072 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, is_capturing_cb, INT, is_completed_cb);
1073 LOGD("is_capturing_cb :%d, is_completed_cb : %d", is_capturing_cb, is_completed_cb);
1074 LOGD("ret : 0x%x", ret);
1078 bool camera_is_supported_continuous_capture(camera_h camera)
1080 if (camera == NULL) {
1081 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1085 int ret = CAMERA_ERROR_NONE;
1086 camera_cli_s *pc = (camera_cli_s *)camera;
1087 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_CONTINUOUS_CAPTURE;
1090 if (pc->cb_info == NULL) {
1091 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1092 return CAMERA_ERROR_INVALID_PARAMETER;
1095 sock_fd = pc->cb_info->fd;
1097 LOGD("Enter, remote_handle : %x", pc->remote_handle);
1098 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
1099 LOGD("ret : 0x%x", ret);
1103 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)
1105 if (camera == NULL) {
1106 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
1107 return CAMERA_ERROR_INVALID_PARAMETER;
1110 int ret = CAMERA_ERROR_NONE;
1112 camera_cli_s *pc = (camera_cli_s *)camera;
1113 muse_camera_api_e api = MUSE_CAMERA_API_START_CONTINUOUS_CAPTURE;
1115 LOGD("Enter, handle :%x", pc->remote_handle);
1118 if (pc->cb_info == NULL) {
1119 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1120 return CAMERA_ERROR_INVALID_PARAMETER;
1122 sock_fd = pc->cb_info->fd;
1124 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = capturing_cb;
1125 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = user_data;
1126 pc->cb_info->user_cb_completed[MUSE_CAMERA_EVENT_TYPE_CAPTURE] = completed_cb;
1128 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, count, INT, interval);
1129 LOGD("ret : 0x%x", ret);
1133 int camera_stop_continuous_capture(camera_h camera)
1135 if (camera == NULL) {
1136 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1137 return CAMERA_ERROR_INVALID_PARAMETER;
1141 int ret = CAMERA_ERROR_NONE;
1143 camera_cli_s *pc = (camera_cli_s *)camera;
1144 muse_camera_api_e api = MUSE_CAMERA_API_STOP_CONTINUOUS_CAPTURE;
1145 LOGD("Enter, handle :%x", pc->remote_handle);
1147 if (pc->cb_info == NULL) {
1148 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1149 return CAMERA_ERROR_INVALID_PARAMETER;
1151 sock_fd = pc->cb_info->fd;
1152 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
1153 LOGD("ret : 0x%x", ret);
1157 bool camera_is_supported_face_detection(camera_h camera)
1159 if (camera == NULL) {
1160 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1163 int ret = CAMERA_ERROR_NONE;
1165 camera_cli_s *pc = (camera_cli_s *)camera;
1166 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_FACE_DETECTION;
1168 if (pc->cb_info == NULL) {
1169 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1170 return CAMERA_ERROR_INVALID_PARAMETER;
1172 sock_fd = pc->cb_info->fd;
1174 LOGD("Enter, remote_handle : %x", pc->remote_handle);
1175 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
1176 LOGD("ret : 0x%x", ret);
1180 bool camera_is_supported_zero_shutter_lag(camera_h camera)
1182 if (camera == NULL) {
1183 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1186 int ret = CAMERA_ERROR_NONE;
1188 camera_cli_s *pc = (camera_cli_s *)camera;
1189 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_ZERO_SHUTTER_LAG;
1191 if (pc->cb_info == NULL) {
1192 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1193 return CAMERA_ERROR_INVALID_PARAMETER;
1195 sock_fd = pc->cb_info->fd;
1197 LOGD("Enter, remote_handle : %x", pc->remote_handle);
1198 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
1199 LOGD("ret : 0x%x", ret);
1203 bool camera_is_supported_media_packet_preview_cb(camera_h camera)
1205 if (camera == NULL) {
1206 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1210 int ret = CAMERA_ERROR_NONE;
1212 camera_cli_s *pc = (camera_cli_s *)camera;
1213 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_MEDIA_PACKET_PREVIEW_CB;
1215 if (pc->cb_info == NULL) {
1216 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1217 return CAMERA_ERROR_INVALID_PARAMETER;
1219 sock_fd = pc->cb_info->fd;
1221 LOGD("Enter, remote_handle : %x", pc->remote_handle);
1222 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
1223 LOGD("ret : 0x%x", ret);
1227 int camera_get_device_count(camera_h camera, int *device_count)
1229 if (camera == NULL || device_count == NULL) {
1230 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
1231 return CAMERA_ERROR_INVALID_PARAMETER;
1233 int ret = CAMERA_ERROR_NONE;
1235 camera_cli_s *pc = (camera_cli_s *)camera;
1236 muse_camera_api_e api = MUSE_CAMERA_API_GET_DEVICE_COUNT;
1238 if (pc->cb_info == NULL) {
1239 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1240 return CAMERA_ERROR_INVALID_PARAMETER;
1242 sock_fd = pc->cb_info->fd;
1243 int get_device_count;
1245 LOGD("Enter, remote_handle : %x", pc->remote_handle);
1246 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
1248 if (ret == CAMERA_ERROR_NONE) {
1249 muse_camera_msg_get(get_device_count, pc->cb_info->recvMsg);
1250 *device_count = get_device_count;
1252 LOGD("ret : 0x%x", ret);
1256 int camera_start_face_detection(camera_h camera, camera_face_detected_cb callback, void * user_data)
1258 if (camera == NULL) {
1259 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
1260 return CAMERA_ERROR_INVALID_PARAMETER;
1263 int ret = CAMERA_ERROR_NONE;
1265 camera_cli_s *pc = (camera_cli_s *)camera;
1266 muse_camera_api_e api = MUSE_CAMERA_API_START_FACE_DETECTION;
1268 LOGD("Enter, handle :%x", pc->remote_handle);
1270 if (pc->cb_info == NULL) {
1271 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1272 return CAMERA_ERROR_INVALID_PARAMETER;
1274 sock_fd = pc->cb_info->fd;
1275 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION] = callback;
1276 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION] = user_data;
1278 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
1279 LOGD("ret : 0x%x", ret);
1283 int camera_stop_face_detection(camera_h camera)
1285 if (camera == NULL) {
1286 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1287 return CAMERA_ERROR_INVALID_PARAMETER;
1290 int ret = CAMERA_ERROR_NONE;
1292 camera_cli_s *pc = (camera_cli_s *)camera;
1293 muse_camera_api_e api = MUSE_CAMERA_API_STOP_FACE_DETECTION;
1294 LOGD("Enter, handle :%x", pc->remote_handle);
1296 if (pc->cb_info == NULL) {
1297 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1298 return CAMERA_ERROR_INVALID_PARAMETER;
1300 sock_fd = pc->cb_info->fd;
1301 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
1302 LOGD("ret : 0x%x", ret);
1306 int camera_get_state(camera_h camera, camera_state_e * state)
1308 if (camera == NULL || state == NULL) {
1309 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1310 return CAMERA_ERROR_INVALID_PARAMETER;
1312 int ret = CAMERA_ERROR_NONE;
1314 camera_cli_s *pc = (camera_cli_s *)camera;
1315 muse_camera_api_e api = MUSE_CAMERA_API_GET_STATE;
1317 if (pc->cb_info == NULL) {
1318 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1319 return CAMERA_ERROR_INVALID_PARAMETER;
1321 sock_fd = pc->cb_info->fd;
1324 LOGD("Enter, remote_handle : %x", pc->remote_handle);
1325 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
1327 if (ret == CAMERA_ERROR_NONE) {
1328 muse_camera_msg_get(get_state, pc->cb_info->recvMsg);
1329 *state = (camera_state_e)get_state;
1331 LOGD("ret : 0x%x", ret);
1335 int camera_start_focusing(camera_h camera, bool continuous)
1337 if( camera == NULL){
1338 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1339 return CAMERA_ERROR_INVALID_PARAMETER;
1342 int ret = CAMERA_ERROR_NONE;
1344 camera_cli_s *pc = (camera_cli_s *)camera;
1345 muse_camera_api_e api = MUSE_CAMERA_API_START_FOCUSING;
1347 if (pc->cb_info == NULL) {
1348 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1349 return CAMERA_ERROR_INVALID_PARAMETER;
1351 sock_fd = pc->cb_info->fd;
1352 int is_continuous = (int)continuous;
1354 LOGD("Enter, remote_handle : %x", pc->remote_handle);
1355 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, is_continuous);
1356 LOGD("ret : 0x%x", ret);
1360 int camera_cancel_focusing(camera_h camera)
1362 if (camera == NULL) {
1363 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1364 return CAMERA_ERROR_INVALID_PARAMETER;
1367 int ret = CAMERA_ERROR_NONE;
1369 camera_cli_s *pc = (camera_cli_s *)camera;
1370 muse_camera_api_e api = MUSE_CAMERA_API_CANCEL_FOCUSING;
1372 if (pc->cb_info == NULL) {
1373 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1374 return CAMERA_ERROR_INVALID_PARAMETER;
1376 sock_fd = pc->cb_info->fd;
1378 LOGD("Enter, remote_handle : %x", pc->remote_handle);
1379 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
1380 LOGD("ret : 0x%x", ret);
1384 int camera_set_display(camera_h camera, camera_display_type_e type, camera_display_h display)
1386 int ret = CAMERA_ERROR_NONE;
1387 int display_surface;
1388 void *set_display_handle = NULL;
1389 int set_surface = MM_DISPLAY_SURFACE_X;
1390 Evas_Object *obj = NULL;
1391 const char *object_type = NULL;
1392 char socket_path[MUSE_CAMERA_MSG_MAX_LENGTH] = {0,};
1394 if (camera == NULL) {
1395 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
1396 return CAMERA_ERROR_INVALID_PARAMETER;
1399 if (type != CAMERA_DISPLAY_TYPE_NONE && display == NULL) {
1400 LOGE("display type[%d] is not NONE, but display handle is NULL", type);
1401 return CAMERA_ERROR_INVALID_PARAMETER;
1404 int display_type = (int)type;
1405 camera_cli_s *pc = (camera_cli_s *)camera;
1406 muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY;
1408 if (pc->cb_info == NULL) {
1409 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1410 return CAMERA_ERROR_INVALID_PARAMETER;
1412 sock_fd = pc->cb_info->fd;
1414 LOGD("Enter, remote_handle : %x display : 0x%x", pc->remote_handle, display);
1416 if (type == CAMERA_DISPLAY_TYPE_NONE) {
1417 set_display_handle = 0;
1418 set_surface = MM_DISPLAY_SURFACE_NULL;
1419 LOGD("display type NONE");
1421 obj = (Evas_Object *)display;
1422 object_type = evas_object_type_get(obj);
1424 if (type == CAMERA_DISPLAY_TYPE_OVERLAY && !strcmp(object_type, "elm_win")) {
1426 MMCamWaylandInfo *wl_info = g_new0(MMCamWaylandInfo, 1);
1428 if (wl_info == NULL) {
1429 LOGE("wl_info alloc failed : %d", sizeof(MMCamWaylandInfo));
1430 return CAMERA_ERROR_OUT_OF_MEMORY;
1433 wl_info->evas_obj = (void *)obj;
1434 wl_info->window = (void *)elm_win_wl_window_get(obj);
1435 wl_info->surface = (void *)ecore_wl_window_surface_get(wl_info->window);
1436 wl_info->display = (void *)ecore_wl_display_get();
1438 if (wl_info->window == NULL || wl_info->surface == NULL || wl_info->display == NULL) {
1439 LOGE("something is NULL %p, %p, %p", wl_info->window, wl_info->surface, wl_info->display);
1440 return CAMERA_ERROR_INVALID_OPERATION;
1443 evas_object_geometry_get(obj, &wl_info->window_x, &wl_info->window_y,
1444 &wl_info->window_width, &wl_info->window_height);
1446 /* set wayland info */
1447 pc->wl_info = wl_info;
1448 set_surface = MM_DISPLAY_SURFACE_X;
1449 set_display_handle = (void *)wl_info;
1451 LOGD("wayland obj %p, window %p, surface %p, display %p, size %d,%d,%dx%d",
1452 wl_info->evas_obj, wl_info->window, wl_info->surface, wl_info->display,
1453 wl_info->window_x, wl_info->window_y, wl_info->window_width, wl_info->window_height);
1454 #else /* HAVE_WAYLAND */
1455 /* x window overlay surface */
1456 set_display_handle = (void *)elm_win_xwindow_get(obj);
1457 set_surface = MM_DISPLAY_SURFACE_X;
1458 LOGD("display type OVERLAY : handle %p", set_display_handle);
1460 } else if (type == CAMERA_DISPLAY_TYPE_EVAS && !strcmp(object_type, "image")) {
1461 /* evas object surface */
1462 set_display_handle = (void *)display;
1463 set_surface = MM_DISPLAY_SURFACE_EVAS;
1464 LOGD("display type EVAS : handle %p", set_display_handle);
1466 LOGE("unknown evas object [%p,%s] or type [%d] mismatch", obj, object_type, type);
1467 return CAMERA_ERROR_INVALID_PARAMETER;
1470 LOGE("failed to get evas object type from %p", obj);
1471 return CAMERA_ERROR_INVALID_PARAMETER;
1475 pc->cli_display_handle = (intptr_t)set_display_handle;
1476 display_surface = (int)set_surface;
1477 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret,
1479 INT, display_surface);
1481 if (ret == CAMERA_ERROR_NONE && type == CAMERA_DISPLAY_TYPE_OVERLAY && !strcmp(object_type, "elm_win")) {
1482 if (mm_camcorder_client_create(&(pc->client_handle))) {
1483 LOGE("camera client create Failed");
1484 return CAMERA_ERROR_INVALID_OPERATION;
1486 muse_camera_msg_get_string(socket_path, pc->cb_info->recvMsg);
1487 LOGD("shmsrc stream path : %s", socket_path);
1488 if(mm_camcorder_client_set_shm_socket_path(pc->client_handle, socket_path)
1490 return CAMERA_ERROR_INVALID_OPERATION;
1491 ret = mm_camcorder_set_attributes(pc->client_handle, NULL,
1492 MMCAM_DISPLAY_SURFACE, set_surface,
1494 if (ret == MM_ERROR_NONE && type != CAMERA_DISPLAY_TYPE_NONE) {
1495 ret = mm_camcorder_set_attributes(pc->client_handle, NULL,
1496 MMCAM_DISPLAY_HANDLE, pc->cli_display_handle, sizeof(void *),
1498 LOGD("ret : 0x%x", ret);
1501 LOGD("ret : 0x%x", ret);
1505 int camera_set_preview_resolution(camera_h camera, int width, int height)
1507 if( camera == NULL){
1508 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1509 return CAMERA_ERROR_INVALID_PARAMETER;
1511 int ret = CAMERA_ERROR_NONE;
1513 camera_cli_s *pc = (camera_cli_s *)camera;
1514 muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_RESOLUTION;
1516 if (pc->cb_info == NULL) {
1517 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1518 return CAMERA_ERROR_INVALID_PARAMETER;
1520 sock_fd = pc->cb_info->fd;
1522 LOGD("Enter, remote_handle : %x", pc->remote_handle);
1523 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, width, INT, height);
1524 LOGD("ret : 0x%x", ret);
1529 int camera_set_capture_resolution(camera_h camera, int width, int height)
1531 if (camera == NULL) {
1532 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1533 return CAMERA_ERROR_INVALID_PARAMETER;
1536 int ret = CAMERA_ERROR_NONE;
1538 camera_cli_s *pc = (camera_cli_s *)camera;
1539 muse_camera_api_e api = MUSE_CAMERA_API_SET_CAPTURE_RESOLUTION;
1541 if (pc->cb_info == NULL) {
1542 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1543 return CAMERA_ERROR_INVALID_PARAMETER;
1545 sock_fd = pc->cb_info->fd;
1547 LOGD("Enter, remote_handle : %x", pc->remote_handle);
1548 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, width, INT, height);
1549 LOGD("ret : 0x%x", ret);
1553 int camera_set_capture_format(camera_h camera, camera_pixel_format_e format)
1555 if (camera == NULL) {
1556 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1557 return CAMERA_ERROR_INVALID_PARAMETER;
1560 int ret = CAMERA_ERROR_NONE;
1561 int set_format = (int)format;
1563 camera_cli_s *pc = (camera_cli_s *)camera;
1564 muse_camera_api_e api = MUSE_CAMERA_API_SET_CAPTURE_FORMAT;
1566 if (pc->cb_info == NULL) {
1567 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1568 return CAMERA_ERROR_INVALID_PARAMETER;
1570 sock_fd = pc->cb_info->fd;
1572 LOGD("Enter, remote_handle : %x, capture_format: %d", pc->remote_handle, set_format);
1573 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_format);
1574 LOGD("ret : 0x%x", ret);
1578 int camera_set_preview_format(camera_h camera, camera_pixel_format_e format)
1580 if (camera == NULL) {
1581 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1582 return CAMERA_ERROR_INVALID_PARAMETER;
1585 int ret = CAMERA_ERROR_NONE;
1586 int set_format = (int)format;
1588 camera_cli_s *pc = (camera_cli_s *)camera;
1589 muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_FORMAT;
1591 if (pc->cb_info == NULL) {
1592 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1593 return CAMERA_ERROR_INVALID_PARAMETER;
1595 sock_fd = pc->cb_info->fd;
1597 LOGD("Enter, remote_handle : %x, capture_format: %d", pc->remote_handle, set_format);
1598 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_format);
1599 LOGD("ret : 0x%x", ret);
1603 int camera_get_preview_resolution(camera_h camera, int *width, int *height)
1605 if (camera == NULL || width == NULL || height == NULL) {
1606 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1607 return CAMERA_ERROR_INVALID_PARAMETER;
1611 int ret = CAMERA_ERROR_NONE;
1613 camera_cli_s *pc = (camera_cli_s *)camera;
1614 muse_camera_api_e api = MUSE_CAMERA_API_GET_PREVIEW_RESOLUTION;
1616 if (pc->cb_info == NULL) {
1617 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1618 return CAMERA_ERROR_INVALID_PARAMETER;
1620 sock_fd = pc->cb_info->fd;
1624 LOGD("Enter, remote_handle : %x", pc->remote_handle);
1625 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
1627 if (ret == CAMERA_ERROR_NONE) {
1628 muse_camera_msg_get(get_width, pc->cb_info->recvMsg);
1629 muse_camera_msg_get(get_height, pc->cb_info->recvMsg);
1631 *height = get_height;
1633 LOGD("ret : 0x%x", ret);
1637 int camera_set_display_rotation(camera_h camera, camera_rotation_e rotation)
1639 if( camera == NULL){
1640 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1641 return CAMERA_ERROR_INVALID_PARAMETER;
1644 int ret = CAMERA_ERROR_NONE;
1645 camera_cli_s *pc = (camera_cli_s *)camera;
1646 muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY_ROTATION;
1648 if (pc->cb_info == NULL) {
1649 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1650 return CAMERA_ERROR_INVALID_PARAMETER;
1652 sock_fd = pc->cb_info->fd;
1653 int set_rotation = (int)rotation;
1655 LOGD("Enter, remote_handle : %x", pc->remote_handle);
1656 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_rotation);
1657 LOGD("ret : 0x%x", ret);
1661 int camera_get_display_rotation(camera_h camera, camera_rotation_e *rotation)
1663 if( camera == NULL || rotation == NULL ){
1664 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1665 return CAMERA_ERROR_INVALID_PARAMETER;
1668 int ret = CAMERA_ERROR_NONE;
1670 camera_cli_s *pc = (camera_cli_s *)camera;
1671 muse_camera_api_e api = MUSE_CAMERA_API_GET_DISPLAY_ROTATION;
1673 if (pc->cb_info == NULL) {
1674 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1675 return CAMERA_ERROR_INVALID_PARAMETER;
1677 sock_fd = pc->cb_info->fd;
1680 LOGD("Enter, remote_handle : %x", pc->remote_handle);
1681 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
1683 if (ret == CAMERA_ERROR_NONE) {
1684 muse_camera_msg_get(get_rotation, pc->cb_info->recvMsg);
1685 *rotation = (camera_rotation_e)get_rotation;
1687 LOGD("ret : 0x%x", ret);
1691 int camera_set_display_flip(camera_h camera, camera_flip_e flip)
1693 if( camera == NULL){
1694 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1695 return CAMERA_ERROR_INVALID_PARAMETER;
1698 int ret = CAMERA_ERROR_NONE;
1700 camera_cli_s *pc = (camera_cli_s *)camera;
1701 muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY_FLIP;
1703 if (pc->cb_info == NULL) {
1704 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1705 return CAMERA_ERROR_INVALID_PARAMETER;
1707 sock_fd = pc->cb_info->fd;
1708 int set_flip = (int)flip;
1710 LOGD("Enter, remote_handle : %x", pc->remote_handle);
1711 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_flip);
1712 LOGD("ret : 0x%x", ret);
1716 int camera_get_display_flip(camera_h camera, camera_flip_e *flip)
1718 if( camera == NULL || flip == NULL ){
1719 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1720 return CAMERA_ERROR_INVALID_PARAMETER;
1723 int ret = CAMERA_ERROR_NONE;
1725 camera_cli_s *pc = (camera_cli_s *)camera;
1726 muse_camera_api_e api = MUSE_CAMERA_API_GET_DISPLAY_FLIP;
1728 if (pc->cb_info == NULL) {
1729 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1730 return CAMERA_ERROR_INVALID_PARAMETER;
1732 sock_fd = pc->cb_info->fd;
1735 LOGD("Enter, remote_handle : %x", pc->remote_handle);
1736 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
1738 if (ret == CAMERA_ERROR_NONE) {
1739 muse_camera_msg_get(get_flip, pc->cb_info->recvMsg);
1740 *flip = (camera_flip_e)get_flip;
1742 LOGD("ret : 0x%x", ret);
1746 int camera_set_display_visible(camera_h camera, bool visible)
1748 if( camera == NULL){
1749 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1750 return CAMERA_ERROR_INVALID_PARAMETER;
1753 int ret = CAMERA_ERROR_NONE;
1755 camera_cli_s *pc = (camera_cli_s *)camera;
1756 muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY_VISIBLE;
1757 int set_visible = (int)visible;
1759 if (pc->cb_info == NULL) {
1760 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1761 return CAMERA_ERROR_INVALID_PARAMETER;
1763 sock_fd = pc->cb_info->fd;
1765 LOGD("Enter, remote_handle : %x", pc->remote_handle);
1766 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_visible);
1767 LOGD("ret : 0x%x", ret);
1771 int camera_is_display_visible(camera_h camera, bool* visible)
1773 if( camera == NULL || visible == NULL){
1774 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1775 return CAMERA_ERROR_INVALID_PARAMETER;
1778 int ret = CAMERA_ERROR_NONE;
1780 camera_cli_s *pc = (camera_cli_s *)camera;
1781 muse_camera_api_e api = MUSE_CAMERA_API_IS_DISPLAY_VISIBLE;
1783 if (pc->cb_info == NULL) {
1784 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1785 return CAMERA_ERROR_INVALID_PARAMETER;
1787 sock_fd = pc->cb_info->fd;
1790 LOGD("Enter, remote_handle : %x", pc->remote_handle);
1791 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
1793 if (ret == CAMERA_ERROR_NONE) {
1794 muse_camera_msg_get(get_visible, pc->cb_info->recvMsg);
1795 *visible = (bool)get_visible;
1797 LOGD("ret : 0x%x", ret);
1801 int camera_set_display_mode(camera_h camera, camera_display_mode_e mode)
1803 if (camera == NULL) {
1804 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1805 return CAMERA_ERROR_INVALID_PARAMETER;
1808 int ret = CAMERA_ERROR_NONE;
1809 int set_mode = (int)mode;
1811 camera_cli_s *pc = (camera_cli_s *)camera;
1812 muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY_MODE;
1814 if (pc->cb_info == NULL) {
1815 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1816 return CAMERA_ERROR_INVALID_PARAMETER;
1818 sock_fd = pc->cb_info->fd;
1820 LOGD("Enter, remote_handle : %x", pc->remote_handle);
1821 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
1822 LOGD("ret : 0x%x", ret);
1826 int camera_get_display_mode(camera_h camera, camera_display_mode_e* mode)
1828 if( camera == NULL || mode == NULL){
1829 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1830 return CAMERA_ERROR_INVALID_PARAMETER;
1833 int ret = CAMERA_ERROR_NONE;
1835 camera_cli_s *pc = (camera_cli_s *)camera;
1836 muse_camera_api_e api = MUSE_CAMERA_API_GET_DISPLAY_MODE;
1838 if (pc->cb_info == NULL) {
1839 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1840 return CAMERA_ERROR_INVALID_PARAMETER;
1842 sock_fd = pc->cb_info->fd;
1845 LOGD("Enter, remote_handle : %x", pc->remote_handle);
1846 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
1848 if (ret == CAMERA_ERROR_NONE) {
1849 muse_camera_msg_get(get_mode, pc->cb_info->recvMsg);
1850 *mode = (camera_display_mode_e)get_mode;
1852 LOGD("ret : 0x%x", ret);
1856 int camera_get_capture_resolution(camera_h camera, int *width, int *height)
1858 if( camera == NULL || width== NULL || height == NULL){
1859 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1860 return CAMERA_ERROR_INVALID_PARAMETER;
1862 int ret = CAMERA_ERROR_NONE;
1864 camera_cli_s *pc = (camera_cli_s *)camera;
1865 muse_camera_api_e api = MUSE_CAMERA_API_GET_CAPTURE_RESOLUTION;
1867 if (pc->cb_info == NULL) {
1868 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1869 return CAMERA_ERROR_INVALID_PARAMETER;
1871 sock_fd = pc->cb_info->fd;
1875 LOGD("Enter, remote_handle : %x", pc->remote_handle);
1876 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
1878 if (ret == CAMERA_ERROR_NONE) {
1879 muse_camera_msg_get(get_width, pc->cb_info->recvMsg);
1880 muse_camera_msg_get(get_height, pc->cb_info->recvMsg);
1882 *height = get_height;
1884 LOGD("ret : 0x%x", ret);
1888 int camera_get_capture_format(camera_h camera, camera_pixel_format_e *format)
1890 if( camera == NULL || format == NULL){
1891 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1892 return CAMERA_ERROR_INVALID_PARAMETER;
1894 int ret = CAMERA_ERROR_NONE;
1896 camera_cli_s *pc = (camera_cli_s *)camera;
1897 muse_camera_api_e api = MUSE_CAMERA_API_GET_CAPTURE_FORMAT;
1900 if (pc->cb_info == NULL) {
1901 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1902 return CAMERA_ERROR_INVALID_PARAMETER;
1904 sock_fd = pc->cb_info->fd;
1906 LOGD("Enter, remote_handle : %x", pc->remote_handle);
1907 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
1909 if (ret == CAMERA_ERROR_NONE) {
1910 muse_camera_msg_get(get_format, pc->cb_info->recvMsg);
1911 *format = (camera_pixel_format_e)get_format;
1913 LOGD("ret : 0x%x", ret);
1917 int camera_get_preview_format(camera_h camera, camera_pixel_format_e *format)
1919 if( camera == NULL || format == NULL){
1920 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1921 return CAMERA_ERROR_INVALID_PARAMETER;
1924 int ret = CAMERA_ERROR_NONE;
1926 camera_cli_s *pc = (camera_cli_s *)camera;
1927 muse_camera_api_e api = MUSE_CAMERA_API_GET_PREVIEW_FORMAT;
1930 if (pc->cb_info == NULL) {
1931 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1932 return CAMERA_ERROR_INVALID_PARAMETER;
1934 sock_fd = pc->cb_info->fd;
1936 LOGD("Enter, remote_handle : %x", pc->remote_handle);
1937 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
1939 if (ret == CAMERA_ERROR_NONE) {
1940 muse_camera_msg_get(get_format, pc->cb_info->recvMsg);
1941 *format = (camera_pixel_format_e)get_format;
1943 LOGD("ret : 0x%x", ret);
1947 int camera_set_preview_cb(camera_h camera, camera_preview_cb callback, void* user_data)
1949 if (camera == NULL || callback == NULL) {
1950 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1951 return CAMERA_ERROR_INVALID_PARAMETER;
1953 int ret = CAMERA_ERROR_NONE;
1955 camera_cli_s *pc = (camera_cli_s *)camera;
1957 if (pc->cb_info == NULL) {
1958 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1959 return CAMERA_ERROR_INVALID_PARAMETER;
1961 sock_fd = pc->cb_info->fd;
1962 muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_CB;
1964 LOGD("Enter, handle :%x", pc->remote_handle);
1966 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = callback;
1967 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = user_data;
1969 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
1970 LOGD("ret : 0x%x", ret);
1974 int camera_unset_preview_cb(camera_h camera)
1976 if (camera == NULL) {
1977 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1978 return CAMERA_ERROR_INVALID_PARAMETER;
1981 int ret = CAMERA_ERROR_NONE;
1983 camera_cli_s *pc = (camera_cli_s *)camera;
1984 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_PREVIEW_CB;
1986 LOGD("Enter, handle :%x", pc->remote_handle);
1989 if (pc->cb_info == NULL) {
1990 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
1991 return CAMERA_ERROR_INVALID_PARAMETER;
1993 sock_fd = pc->cb_info->fd;
1994 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = (void *)NULL;
1995 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = (void *)NULL;
1997 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
1998 LOGD("ret : 0x%x", ret);
2002 int camera_set_media_packet_preview_cb(camera_h camera, camera_media_packet_preview_cb callback, void* user_data)
2004 if (camera == NULL) {
2005 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
2006 return CAMERA_ERROR_INVALID_PARAMETER;
2009 if (callback == NULL) {
2010 LOGE("INVALID_PARAMETER(0x%08x) - callback", CAMERA_ERROR_INVALID_PARAMETER);
2011 return CAMERA_ERROR_NOT_SUPPORTED;
2014 int ret = CAMERA_ERROR_NONE;
2016 camera_cli_s *pc = (camera_cli_s *)camera;
2017 muse_camera_api_e api = MUSE_CAMERA_API_SET_MEDIA_PACKET_PREVIEW_CB;
2019 LOGD("Enter, handle :%x", pc->remote_handle);
2022 if (pc->cb_info == NULL) {
2023 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2024 return CAMERA_ERROR_INVALID_PARAMETER;
2026 sock_fd = pc->cb_info->fd;
2027 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = callback;
2028 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = user_data;
2030 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2031 LOGD("ret : 0x%x", ret);
2035 int camera_unset_media_packet_preview_cb(camera_h camera)
2037 if (camera == NULL) {
2038 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2039 return CAMERA_ERROR_INVALID_PARAMETER;
2042 int ret = CAMERA_ERROR_NONE;
2044 camera_cli_s *pc = (camera_cli_s *)camera;
2045 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_MEDIA_PACKET_PREVIEW_CB;
2047 LOGD("Enter, handle :%x", pc->remote_handle);
2050 if (pc->cb_info == NULL) {
2051 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2052 return CAMERA_ERROR_INVALID_PARAMETER;
2054 sock_fd = pc->cb_info->fd;
2055 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = (void *)NULL;
2056 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = (void *)NULL;
2058 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2059 LOGD("ret : 0x%x", ret);
2063 int camera_set_state_changed_cb(camera_h camera, camera_state_changed_cb callback, void* user_data)
2065 if( camera == NULL || callback == NULL){
2066 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2067 return CAMERA_ERROR_INVALID_PARAMETER;
2069 int ret = CAMERA_ERROR_NONE;
2071 camera_cli_s *pc = (camera_cli_s *)camera;
2072 muse_camera_api_e api = MUSE_CAMERA_API_SET_STATE_CHANGED_CB;
2074 LOGD("Enter, handle :%x", pc->remote_handle);
2077 if (pc->cb_info == NULL) {
2078 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2079 return CAMERA_ERROR_INVALID_PARAMETER;
2081 sock_fd = pc->cb_info->fd;
2082 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = callback;
2083 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = user_data;
2085 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2086 LOGD("ret : 0x%x", ret);
2089 int camera_unset_state_changed_cb(camera_h camera)
2091 if( camera == NULL){
2092 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2093 return CAMERA_ERROR_INVALID_PARAMETER;
2095 int ret = CAMERA_ERROR_NONE;
2097 camera_cli_s *pc = (camera_cli_s *)camera;
2098 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_STATE_CHANGED_CB;
2100 LOGD("Enter, handle :%x", pc->remote_handle);
2103 if (pc->cb_info == NULL) {
2104 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2105 return CAMERA_ERROR_INVALID_PARAMETER;
2107 sock_fd = pc->cb_info->fd;
2108 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = (void *)NULL;
2109 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = (void *)NULL;
2111 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2112 LOGD("ret : 0x%x", ret);
2116 int camera_set_interrupted_cb(camera_h camera, camera_interrupted_cb callback, void *user_data)
2118 if( camera == NULL || callback == NULL){
2119 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2120 return CAMERA_ERROR_INVALID_PARAMETER;
2122 int ret = CAMERA_ERROR_NONE;
2124 camera_cli_s *pc = (camera_cli_s *)camera;
2125 muse_camera_api_e api = MUSE_CAMERA_API_SET_INTERRUPTED_CB;
2127 LOGD("Enter, handle :%x", pc->remote_handle);
2130 if (pc->cb_info == NULL) {
2131 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2132 return CAMERA_ERROR_INVALID_PARAMETER;
2134 sock_fd = pc->cb_info->fd;
2135 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = callback;
2136 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = user_data;
2138 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2139 LOGD("ret : 0x%x", ret);
2143 int camera_unset_interrupted_cb(camera_h camera)
2145 if( camera == NULL){
2146 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2147 return CAMERA_ERROR_INVALID_PARAMETER;
2149 int ret = CAMERA_ERROR_NONE;
2151 camera_cli_s *pc = (camera_cli_s *)camera;
2152 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_INTERRUPTED_CB;
2154 LOGD("Enter, handle :%x", pc->remote_handle);
2157 if (pc->cb_info == NULL) {
2158 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2159 return CAMERA_ERROR_INVALID_PARAMETER;
2161 sock_fd = pc->cb_info->fd;
2162 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = (void *)NULL;
2163 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = (void *)NULL;
2165 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2166 LOGD("ret : 0x%x", ret);
2170 int camera_set_focus_changed_cb(camera_h camera, camera_focus_changed_cb callback, void* user_data)
2172 if( camera == NULL || callback == NULL){
2173 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2174 return CAMERA_ERROR_INVALID_PARAMETER;
2176 int ret = CAMERA_ERROR_NONE;
2178 camera_cli_s *pc = (camera_cli_s *)camera;
2179 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOCUS_CHANGED_CB;
2181 LOGD("Enter, handle :%x", pc->remote_handle);
2184 if (pc->cb_info == NULL) {
2185 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2186 return CAMERA_ERROR_INVALID_PARAMETER;
2188 sock_fd = pc->cb_info->fd;
2189 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = callback;
2190 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = user_data;
2192 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2193 LOGD("ret : 0x%x", ret);
2197 int camera_unset_focus_changed_cb(camera_h camera)
2199 if( camera == NULL){
2200 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2201 return CAMERA_ERROR_INVALID_PARAMETER;
2203 int ret = CAMERA_ERROR_NONE;
2205 camera_cli_s *pc = (camera_cli_s *)camera;
2206 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_FOCUS_CHANGED_CB;
2208 LOGD("Enter, handle :%x", pc->remote_handle);
2211 if (pc->cb_info == NULL) {
2212 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2213 return CAMERA_ERROR_INVALID_PARAMETER;
2215 sock_fd = pc->cb_info->fd;
2216 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = (void *)NULL;
2217 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = (void *)NULL;
2219 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2220 LOGD("ret : 0x%x", ret);
2224 int camera_set_error_cb(camera_h camera, camera_error_cb callback, void *user_data)
2226 if( camera == NULL || callback == NULL){
2227 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2228 return CAMERA_ERROR_INVALID_PARAMETER;
2230 int ret = CAMERA_ERROR_NONE;
2232 camera_cli_s *pc = (camera_cli_s *)camera;
2233 muse_camera_api_e api = MUSE_CAMERA_API_SET_ERROR_CB;
2235 LOGD("Enter, handle :%x", pc->remote_handle);
2238 if (pc->cb_info == NULL) {
2239 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2240 return CAMERA_ERROR_INVALID_PARAMETER;
2242 sock_fd = pc->cb_info->fd;
2243 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_ERROR] = callback;
2244 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_ERROR] = user_data;
2246 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2247 LOGD("ret : 0x%x", ret);
2251 int camera_unset_error_cb(camera_h camera)
2253 if( camera == NULL){
2254 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2255 return CAMERA_ERROR_INVALID_PARAMETER;
2257 int ret = CAMERA_ERROR_NONE;
2259 camera_cli_s *pc = (camera_cli_s *)camera;
2260 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_ERROR_CB;
2262 LOGD("Enter, handle :%x", pc->remote_handle);
2265 if (pc->cb_info == NULL) {
2266 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2267 return CAMERA_ERROR_INVALID_PARAMETER;
2269 sock_fd = pc->cb_info->fd;
2270 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_ERROR] = (void *)NULL;
2271 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_ERROR] = (void *)NULL;
2273 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2274 LOGD("ret : 0x%x", ret);
2278 int camera_foreach_supported_preview_resolution(camera_h camera, camera_supported_preview_resolution_cb foreach_cb , void *user_data)
2280 if( camera == NULL || foreach_cb == NULL){
2281 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2282 return CAMERA_ERROR_INVALID_PARAMETER;
2284 int ret = CAMERA_ERROR_NONE;
2286 camera_cli_s *pc = (camera_cli_s *)camera;
2287 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_PREVIEW_RESOLUTION;
2289 LOGD("Enter, handle :%x", pc->remote_handle);
2292 if (pc->cb_info == NULL) {
2293 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2294 return CAMERA_ERROR_INVALID_PARAMETER;
2296 sock_fd = pc->cb_info->fd;
2297 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_RESOLUTION] = foreach_cb;
2298 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_RESOLUTION] = user_data;
2300 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2301 LOGD("ret : 0x%x", ret);
2305 int camera_foreach_supported_capture_resolution(camera_h camera, camera_supported_capture_resolution_cb foreach_cb , void *user_data)
2307 if( camera == NULL || foreach_cb == NULL){
2308 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2309 return CAMERA_ERROR_INVALID_PARAMETER;
2311 int ret = CAMERA_ERROR_NONE;
2313 camera_cli_s *pc = (camera_cli_s *)camera;
2314 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_CAPTURE_RESOLUTION;
2316 LOGD("Enter, handle :%x", pc->remote_handle);
2319 if (pc->cb_info == NULL) {
2320 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2321 return CAMERA_ERROR_INVALID_PARAMETER;
2323 sock_fd = pc->cb_info->fd;
2324 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_RESOLUTION] = foreach_cb;
2325 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_RESOLUTION] = user_data;
2327 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2328 LOGD("ret : 0x%x", ret);
2332 int camera_foreach_supported_capture_format(camera_h camera, camera_supported_capture_format_cb foreach_cb , void *user_data)
2334 if( camera == NULL || foreach_cb == NULL){
2335 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2336 return CAMERA_ERROR_INVALID_PARAMETER;
2338 int ret = CAMERA_ERROR_NONE;
2340 camera_cli_s *pc = (camera_cli_s *)camera;
2341 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_CAPTURE_FORMAT;
2343 LOGD("Enter, handle :%x", pc->remote_handle);
2346 if (pc->cb_info == NULL) {
2347 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2348 return CAMERA_ERROR_INVALID_PARAMETER;
2350 sock_fd = pc->cb_info->fd;
2351 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_FORMAT] = foreach_cb;
2352 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_FORMAT] = user_data;
2354 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2355 LOGD("ret : 0x%x", ret);
2360 int camera_foreach_supported_preview_format(camera_h camera, camera_supported_preview_format_cb foreach_cb , void *user_data)
2362 if( camera == NULL || foreach_cb == NULL){
2363 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2364 return CAMERA_ERROR_INVALID_PARAMETER;
2366 int ret = CAMERA_ERROR_NONE;
2368 camera_cli_s *pc = (camera_cli_s *)camera;
2369 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_PREVIEW_FORMAT;
2371 LOGD("Enter, handle :%x", pc->remote_handle);
2374 if (pc->cb_info == NULL) {
2375 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2376 return CAMERA_ERROR_INVALID_PARAMETER;
2378 sock_fd = pc->cb_info->fd;
2379 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_FORMAT] = foreach_cb;
2380 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_FORMAT] = user_data;
2382 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2383 LOGD("ret : 0x%x", ret);
2388 int camera_get_recommended_preview_resolution(camera_h camera, int *width, int *height)
2390 if (camera == NULL || width == NULL || height == NULL) {
2391 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2392 return CAMERA_ERROR_INVALID_PARAMETER;
2394 int ret = CAMERA_ERROR_NONE;
2396 camera_cli_s *pc = (camera_cli_s *)camera;
2397 muse_camera_api_e api = MUSE_CAMERA_API_GET_RECOMMENDED_PREVIEW_RESOLUTION;
2399 if (pc->cb_info == NULL) {
2400 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2401 return CAMERA_ERROR_INVALID_PARAMETER;
2403 sock_fd = pc->cb_info->fd;
2407 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2408 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2410 if (ret == CAMERA_ERROR_NONE) {
2411 muse_camera_msg_get(get_width, pc->cb_info->recvMsg);
2412 muse_camera_msg_get(get_height, pc->cb_info->recvMsg);
2414 *height = get_height;
2416 LOGD("ret : 0x%x", ret);
2421 int camera_attr_get_lens_orientation(camera_h camera, int *angle)
2423 if( camera == NULL || angle == NULL){
2424 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2425 return CAMERA_ERROR_INVALID_PARAMETER;
2427 int ret = CAMERA_ERROR_NONE;
2429 camera_cli_s *pc = (camera_cli_s *)camera;
2430 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_LENS_ORIENTATION;
2432 if (pc->cb_info == NULL) {
2433 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2434 return CAMERA_ERROR_INVALID_PARAMETER;
2436 sock_fd = pc->cb_info->fd;
2439 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2440 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2442 if (ret == CAMERA_ERROR_NONE) {
2443 muse_camera_msg_get(get_angle, pc->cb_info->recvMsg);
2446 LOGD("ret : 0x%x", ret);
2450 int camera_attr_set_theater_mode(camera_h camera, camera_attr_theater_mode_e mode)
2452 if (camera == NULL) {
2453 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2454 return CAMERA_ERROR_INVALID_PARAMETER;
2456 int ret = CAMERA_ERROR_NONE;
2457 camera_cli_s *pc = (camera_cli_s *)camera;
2458 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_THEATER_MODE;
2460 if (pc->cb_info == NULL) {
2461 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2462 return CAMERA_ERROR_INVALID_PARAMETER;
2464 sock_fd = pc->cb_info->fd;
2465 int set_mode = (int)mode;
2466 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2467 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
2468 LOGD("ret : 0x%x", ret);
2472 int camera_attr_get_theater_mode(camera_h camera, camera_attr_theater_mode_e *mode)
2474 if (camera == NULL || mode == NULL) {
2475 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2476 return CAMERA_ERROR_INVALID_PARAMETER;
2479 int ret = CAMERA_ERROR_NONE;
2480 camera_cli_s *pc = (camera_cli_s *)camera;
2481 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_THEATER_MODE;
2483 if (pc->cb_info == NULL) {
2484 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2485 return CAMERA_ERROR_INVALID_PARAMETER;
2487 sock_fd = pc->cb_info->fd;
2489 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2490 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2492 if (ret == CAMERA_ERROR_NONE) {
2493 muse_camera_msg_get(get_mode, pc->cb_info->recvMsg);
2494 *mode = (camera_attr_theater_mode_e)get_mode;
2496 LOGD("ret : 0x%x", ret);
2500 int camera_attr_foreach_supported_theater_mode(camera_h camera, camera_attr_supported_theater_mode_cb foreach_cb, void *user_data)
2502 if (camera == NULL || foreach_cb == NULL) {
2503 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2504 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_ATTR_FOREACH_SUPPORTED_THEATER_MODE;
2511 LOGD("Enter, handle :%x", pc->remote_handle);
2514 if (pc->cb_info == NULL) {
2515 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2516 return CAMERA_ERROR_INVALID_PARAMETER;
2518 sock_fd = pc->cb_info->fd;
2519 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE] = foreach_cb;
2520 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE] = user_data;
2522 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2524 LOGD("Finish, return :%x", ret);
2529 int camera_attr_set_preview_fps(camera_h camera, camera_attr_fps_e fps)
2531 if( camera == NULL){
2532 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2533 return CAMERA_ERROR_INVALID_PARAMETER;
2535 int ret = CAMERA_ERROR_NONE;
2536 camera_cli_s *pc = (camera_cli_s *)camera;
2537 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_PREVIEW_FPS;
2539 if (pc->cb_info == NULL) {
2540 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2541 return CAMERA_ERROR_INVALID_PARAMETER;
2543 sock_fd = pc->cb_info->fd;
2544 int set_fps = (int)fps;
2545 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2546 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_fps);
2547 LOGD("ret : 0x%x", ret);
2552 int camera_attr_set_image_quality(camera_h camera, int quality)
2554 if( camera == NULL){
2555 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2556 return CAMERA_ERROR_INVALID_PARAMETER;
2558 int ret = CAMERA_ERROR_NONE;
2560 camera_cli_s *pc = (camera_cli_s *)camera;
2561 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_IMAGE_QUALITY;
2563 if (pc->cb_info == NULL) {
2564 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2565 return CAMERA_ERROR_INVALID_PARAMETER;
2567 sock_fd = pc->cb_info->fd;
2568 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2569 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, quality);
2570 LOGD("ret : 0x%x", ret);
2574 int camera_attr_get_preview_fps(camera_h camera, camera_attr_fps_e *fps)
2576 if( camera == NULL || fps == NULL){
2577 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2578 return CAMERA_ERROR_INVALID_PARAMETER;
2580 int ret = CAMERA_ERROR_NONE;
2582 camera_cli_s *pc = (camera_cli_s *)camera;
2583 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_PREVIEW_FPS;
2586 if (pc->cb_info == NULL) {
2587 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2588 return CAMERA_ERROR_INVALID_PARAMETER;
2590 sock_fd = pc->cb_info->fd;
2592 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2593 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2595 if (ret == CAMERA_ERROR_NONE) {
2596 muse_camera_msg_get(get_fps, pc->cb_info->recvMsg);
2597 *fps = (camera_attr_fps_e)get_fps;
2599 LOGD("ret : 0x%x", ret);
2604 int camera_attr_get_image_quality(camera_h camera, int *quality)
2606 if( camera == NULL || quality == NULL){
2607 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2608 return CAMERA_ERROR_INVALID_PARAMETER;
2610 int ret = CAMERA_ERROR_NONE;
2612 camera_cli_s *pc = (camera_cli_s *)camera;
2613 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_IMAGE_QUALITY;
2615 if (pc->cb_info == NULL) {
2616 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2617 return CAMERA_ERROR_INVALID_PARAMETER;
2619 sock_fd = pc->cb_info->fd;
2621 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2622 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2624 if (ret == CAMERA_ERROR_NONE) {
2625 muse_camera_msg_get(get_quality, pc->cb_info->recvMsg);
2626 *quality = get_quality;
2628 LOGD("ret : 0x%x", ret);
2633 int camera_attr_set_zoom(camera_h camera, int zoom)
2635 if( camera == NULL){
2636 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2637 return CAMERA_ERROR_INVALID_PARAMETER;
2639 int ret = CAMERA_ERROR_NONE;
2641 camera_cli_s *pc = (camera_cli_s *)camera;
2642 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ZOOM;
2644 if (pc->cb_info == NULL) {
2645 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2646 return CAMERA_ERROR_INVALID_PARAMETER;
2648 sock_fd = pc->cb_info->fd;
2650 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2651 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, zoom);
2652 LOGD("ret : 0x%x", ret);
2656 int camera_attr_set_af_mode(camera_h camera, camera_attr_af_mode_e mode)
2658 if( camera == NULL){
2659 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2660 return CAMERA_ERROR_INVALID_PARAMETER;
2662 int ret = CAMERA_ERROR_NONE;
2664 camera_cli_s *pc = (camera_cli_s *)camera;
2665 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_AF_MODE;
2667 if (pc->cb_info == NULL) {
2668 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2669 return CAMERA_ERROR_INVALID_PARAMETER;
2671 sock_fd = pc->cb_info->fd;
2672 int set_mode = (int)mode;
2673 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2674 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
2675 LOGD("ret : 0x%x", ret);
2679 int camera_attr_set_af_area(camera_h camera, int x, int y)
2681 if( camera == NULL){
2682 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2683 return CAMERA_ERROR_INVALID_PARAMETER;
2685 int ret = CAMERA_ERROR_NONE;
2686 camera_cli_s *pc = (camera_cli_s *)camera;
2687 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_AF_AREA;
2688 int sock_fd = pc->cb_info->fd;
2689 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2690 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, x, INT, y);
2691 LOGD("ret : 0x%x", ret);
2696 int camera_attr_clear_af_area(camera_h camera)
2698 if( camera == NULL){
2699 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
2700 return CAMERA_ERROR_INVALID_PARAMETER;
2702 int ret = CAMERA_ERROR_NONE;
2704 camera_cli_s *pc = (camera_cli_s *)camera;
2705 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_CLEAR_AF_AREA;
2707 if (pc->cb_info == NULL) {
2708 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2709 return CAMERA_ERROR_INVALID_PARAMETER;
2711 sock_fd = pc->cb_info->fd;
2712 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2713 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
2714 LOGD("ret : 0x%x", ret);
2719 int camera_attr_set_exposure_mode(camera_h camera, camera_attr_exposure_mode_e mode)
2721 if( camera == NULL){
2722 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2723 return CAMERA_ERROR_INVALID_PARAMETER;
2726 if (mode < CAMERA_ATTR_EXPOSURE_MODE_OFF || mode > CAMERA_ATTR_EXPOSURE_MODE_CUSTOM) {
2727 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_NOT_SUPPORTED);
2728 return CAMERA_ERROR_NOT_SUPPORTED;
2731 int ret = CAMERA_ERROR_NONE;
2732 camera_cli_s *pc = (camera_cli_s *)camera;
2733 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EXPOSURE_MODE;
2734 int set_mode = (int)mode;
2736 if (pc->cb_info == NULL) {
2737 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2738 return CAMERA_ERROR_INVALID_PARAMETER;
2740 sock_fd = pc->cb_info->fd;
2741 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2742 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
2743 LOGD("ret : 0x%x", ret);
2748 int camera_attr_set_exposure(camera_h camera, int value)
2750 if( camera == NULL){
2751 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2752 return CAMERA_ERROR_INVALID_PARAMETER;
2754 int ret = CAMERA_ERROR_NONE;
2756 camera_cli_s *pc = (camera_cli_s *)camera;
2757 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EXPOSURE;
2759 if (pc->cb_info == NULL) {
2760 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2761 return CAMERA_ERROR_INVALID_PARAMETER;
2763 sock_fd = pc->cb_info->fd;
2765 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2766 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, value);
2767 LOGD("ret : 0x%x", ret);
2772 int camera_attr_set_iso(camera_h camera, camera_attr_iso_e iso)
2774 if( camera == NULL){
2775 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2776 return CAMERA_ERROR_INVALID_PARAMETER;
2778 int ret = CAMERA_ERROR_NONE;
2780 camera_cli_s *pc = (camera_cli_s *)camera;
2781 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ISO;
2783 if (pc->cb_info == NULL) {
2784 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2785 return CAMERA_ERROR_INVALID_PARAMETER;
2787 sock_fd = pc->cb_info->fd;
2788 int set_iso = (int)iso;
2789 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2790 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_iso);
2791 LOGD("ret : 0x%x", ret);
2796 int camera_attr_set_brightness(camera_h camera, int level)
2798 if( camera == NULL){
2799 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2800 return CAMERA_ERROR_INVALID_PARAMETER;
2802 int ret = CAMERA_ERROR_NONE;
2804 camera_cli_s *pc = (camera_cli_s *)camera;
2805 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_BRIGHTNESS;
2807 if (pc->cb_info == NULL) {
2808 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2809 return CAMERA_ERROR_INVALID_PARAMETER;
2811 sock_fd = pc->cb_info->fd;
2813 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2814 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, level);
2815 LOGD("ret : 0x%x", ret);
2820 int camera_attr_set_contrast(camera_h camera, int level)
2822 if( camera == NULL){
2823 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2824 return CAMERA_ERROR_INVALID_PARAMETER;
2826 int ret = CAMERA_ERROR_NONE;
2828 camera_cli_s *pc = (camera_cli_s *)camera;
2829 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_CONTRAST;
2831 if (pc->cb_info == NULL) {
2832 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2833 return CAMERA_ERROR_INVALID_PARAMETER;
2835 sock_fd = pc->cb_info->fd;
2837 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2838 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, level);
2839 LOGD("ret : 0x%x", ret);
2844 int camera_attr_set_whitebalance(camera_h camera, camera_attr_whitebalance_e wb)
2846 if (camera == NULL) {
2847 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2848 return CAMERA_ERROR_INVALID_PARAMETER;
2851 if (wb < CAMERA_ATTR_WHITE_BALANCE_NONE || wb > CAMERA_ATTR_WHITE_BALANCE_CUSTOM) {
2852 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_NOT_SUPPORTED);
2853 return CAMERA_ERROR_NOT_SUPPORTED;
2856 int ret = CAMERA_ERROR_NONE;
2858 camera_cli_s *pc = (camera_cli_s *)camera;
2859 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_WHITEBALANCE;
2861 if (pc->cb_info == NULL) {
2862 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2863 return CAMERA_ERROR_INVALID_PARAMETER;
2865 sock_fd = pc->cb_info->fd;
2866 int set_whitebalance = (int)wb;
2867 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2868 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_whitebalance);
2869 LOGD("ret : 0x%x", ret);
2874 int camera_attr_set_effect(camera_h camera, camera_attr_effect_mode_e effect)
2876 if( camera == NULL){
2877 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2878 return CAMERA_ERROR_INVALID_PARAMETER;
2880 int ret = CAMERA_ERROR_NONE;
2882 camera_cli_s *pc = (camera_cli_s *)camera;
2883 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EFFECT;
2885 if (pc->cb_info == NULL) {
2886 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2887 return CAMERA_ERROR_INVALID_PARAMETER;
2889 sock_fd = pc->cb_info->fd;
2890 int set_effect = (int)effect;
2891 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2892 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_effect);
2893 LOGD("ret : 0x%x", ret);
2898 int camera_attr_set_scene_mode(camera_h camera, camera_attr_scene_mode_e mode)
2900 if( camera == NULL){
2901 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2902 return CAMERA_ERROR_INVALID_PARAMETER;
2904 int ret = CAMERA_ERROR_NONE;
2906 camera_cli_s *pc = (camera_cli_s *)camera;
2907 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_SCENE_MODE;
2909 if (pc->cb_info == NULL) {
2910 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2911 return CAMERA_ERROR_INVALID_PARAMETER;
2913 sock_fd = pc->cb_info->fd;
2914 int set_mode = (int)mode;
2915 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2916 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
2917 LOGD("ret : 0x%x", ret);
2922 int camera_attr_enable_tag(camera_h camera, bool enable)
2924 if( camera == NULL){
2925 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2926 return CAMERA_ERROR_INVALID_PARAMETER;
2928 int ret = CAMERA_ERROR_NONE;
2929 camera_cli_s *pc = (camera_cli_s *)camera;
2930 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_TAG;
2932 if (pc->cb_info == NULL) {
2933 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2934 return CAMERA_ERROR_INVALID_PARAMETER;
2936 sock_fd = pc->cb_info->fd;
2937 int set_enable = (int)enable;
2939 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2940 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
2941 LOGD("ret : 0x%x", ret);
2946 int camera_attr_set_tag_image_description(camera_h camera, const char *description)
2948 if( camera == NULL){
2949 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2950 return CAMERA_ERROR_INVALID_PARAMETER;
2952 if( description == NULL){
2953 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2954 return CAMERA_ERROR_INVALID_PARAMETER;
2956 int ret = CAMERA_ERROR_NONE;
2957 camera_cli_s *pc = (camera_cli_s *)camera;
2958 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_IMAGE_DESCRIPTION;
2960 if (pc->cb_info == NULL) {
2961 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2962 return CAMERA_ERROR_INVALID_PARAMETER;
2964 sock_fd = pc->cb_info->fd;
2965 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2966 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, STRING, description);
2967 LOGD("ret : 0x%x", ret);
2972 int camera_attr_set_tag_orientation(camera_h camera, camera_attr_tag_orientation_e orientation)
2974 if( camera == NULL){
2975 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2976 return CAMERA_ERROR_INVALID_PARAMETER;
2978 int ret = CAMERA_ERROR_NONE;
2979 camera_cli_s *pc = (camera_cli_s *)camera;
2980 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_ORIENTATION;
2982 if (pc->cb_info == NULL) {
2983 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
2984 return CAMERA_ERROR_INVALID_PARAMETER;
2986 sock_fd = pc->cb_info->fd;
2987 int set_orientation = (int)orientation;
2989 LOGD("Enter, remote_handle : %x", pc->remote_handle);
2990 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_orientation);
2991 LOGD("ret : 0x%x", ret);
2996 int camera_attr_set_tag_software(camera_h camera, const char *software)
2998 if( camera == NULL){
2999 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3000 return CAMERA_ERROR_INVALID_PARAMETER;
3002 if( software == NULL){
3003 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3004 return CAMERA_ERROR_INVALID_PARAMETER;
3006 int ret = CAMERA_ERROR_NONE;
3007 camera_cli_s *pc = (camera_cli_s *)camera;
3008 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_SOFTWARE;
3010 if (pc->cb_info == NULL) {
3011 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3012 return CAMERA_ERROR_INVALID_PARAMETER;
3014 sock_fd = pc->cb_info->fd;
3015 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3016 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, STRING, software);
3017 LOGD("ret : 0x%x", ret);
3022 int camera_attr_set_geotag(camera_h camera, double latitude , double longitude, double altitude)
3024 if( camera == NULL){
3025 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3026 return CAMERA_ERROR_INVALID_PARAMETER;
3028 int ret = CAMERA_ERROR_NONE;
3029 camera_cli_s *pc = (camera_cli_s *)camera;
3030 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_GEOTAG;
3032 if (pc->cb_info == NULL) {
3033 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3034 return CAMERA_ERROR_INVALID_PARAMETER;
3036 sock_fd = pc->cb_info->fd;
3037 double set_geotag[3] = { latitude, longitude, altitude };
3039 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3040 muse_camera_msg_send_array(api, sock_fd, pc->cb_info, ret,
3041 set_geotag, sizeof(set_geotag), sizeof(double));
3042 LOGD("ret : 0x%x", ret);
3047 int camera_attr_remove_geotag(camera_h camera)
3049 if( camera == NULL){
3050 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3051 return CAMERA_ERROR_INVALID_PARAMETER;
3053 int ret = CAMERA_ERROR_NONE;
3054 camera_cli_s *pc = (camera_cli_s *)camera;
3055 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_REMOVE_GEOTAG;
3057 if (pc->cb_info == NULL) {
3058 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3059 return CAMERA_ERROR_INVALID_PARAMETER;
3061 sock_fd = pc->cb_info->fd;
3062 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3063 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3064 LOGD("ret : 0x%x", ret);
3069 int camera_attr_set_flash_mode(camera_h camera, camera_attr_flash_mode_e mode)
3071 if( camera == NULL){
3072 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3073 return CAMERA_ERROR_INVALID_PARAMETER;
3075 int ret = CAMERA_ERROR_NONE;
3076 camera_cli_s *pc = (camera_cli_s *)camera;
3077 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_FLASH_MODE;
3079 if (pc->cb_info == NULL) {
3080 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3081 return CAMERA_ERROR_INVALID_PARAMETER;
3083 sock_fd = pc->cb_info->fd;
3084 int set_mode = (int)mode;
3086 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3087 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
3088 LOGD("ret : 0x%x", ret);
3093 int camera_attr_get_zoom(camera_h camera, int *zoom)
3095 if( camera == NULL || zoom == NULL){
3096 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3097 return CAMERA_ERROR_INVALID_PARAMETER;
3099 int ret = CAMERA_ERROR_NONE;
3101 camera_cli_s *pc = (camera_cli_s *)camera;
3102 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ZOOM;
3105 if (pc->cb_info == NULL) {
3106 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3107 return CAMERA_ERROR_INVALID_PARAMETER;
3109 sock_fd = pc->cb_info->fd;
3111 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3112 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3114 if (ret == CAMERA_ERROR_NONE) {
3115 muse_camera_msg_get(get_zoom, pc->cb_info->recvMsg);
3118 LOGD("ret : 0x%x", ret);
3123 int camera_attr_get_zoom_range(camera_h camera, int *min, int *max)
3125 if( camera == NULL || min == NULL || max == NULL ){
3126 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3127 return CAMERA_ERROR_INVALID_PARAMETER;
3129 int ret = CAMERA_ERROR_NONE;
3130 camera_cli_s *pc = (camera_cli_s *)camera;
3132 if (pc->cb_info == NULL) {
3133 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3134 return CAMERA_ERROR_INVALID_PARAMETER;
3136 sock_fd = pc->cb_info->fd;
3137 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ZOOM_RANGE;
3141 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3142 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3144 if (ret == CAMERA_ERROR_NONE) {
3145 muse_camera_msg_get(get_min, pc->cb_info->recvMsg);
3146 muse_camera_msg_get(get_max, pc->cb_info->recvMsg);
3150 LOGD("ret : 0x%x", ret);
3155 int camera_attr_get_af_mode( camera_h camera, camera_attr_af_mode_e *mode)
3157 if( camera == NULL || mode == NULL){
3158 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3159 return CAMERA_ERROR_INVALID_PARAMETER;
3161 int ret = CAMERA_ERROR_NONE;
3162 camera_cli_s *pc = (camera_cli_s *)camera;
3164 if (pc->cb_info == NULL) {
3165 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3166 return CAMERA_ERROR_INVALID_PARAMETER;
3168 sock_fd = pc->cb_info->fd;
3169 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_AF_MODE;
3172 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3173 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3175 if (ret == CAMERA_ERROR_NONE) {
3176 muse_camera_msg_get(get_mode, pc->cb_info->recvMsg);
3177 *mode = (camera_attr_af_mode_e)get_mode;
3179 LOGD("ret : 0x%x", ret);
3184 int camera_attr_get_exposure_mode( camera_h camera, camera_attr_exposure_mode_e *mode)
3186 if( camera == NULL|| mode == NULL){
3187 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3188 return CAMERA_ERROR_INVALID_PARAMETER;
3190 int ret = CAMERA_ERROR_NONE;
3191 camera_cli_s *pc = (camera_cli_s *)camera;
3193 if (pc->cb_info == NULL) {
3194 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3195 return CAMERA_ERROR_INVALID_PARAMETER;
3197 sock_fd = pc->cb_info->fd;
3198 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE_MODE;
3201 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3202 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3204 if (ret == CAMERA_ERROR_NONE) {
3205 muse_camera_msg_get(get_mode, pc->cb_info->recvMsg);
3206 *mode = (camera_attr_exposure_mode_e)get_mode;
3208 LOGD("ret : 0x%x", ret);
3212 int camera_attr_get_exposure(camera_h camera, int *value)
3214 if( camera == NULL || value == NULL){
3215 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3216 return CAMERA_ERROR_INVALID_PARAMETER;
3218 int ret = CAMERA_ERROR_NONE;
3219 camera_cli_s *pc = (camera_cli_s *)camera;
3221 if (pc->cb_info == NULL) {
3222 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3223 return CAMERA_ERROR_INVALID_PARAMETER;
3225 sock_fd = pc->cb_info->fd;
3226 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE;
3229 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3230 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3232 if (ret == CAMERA_ERROR_NONE) {
3233 muse_camera_msg_get(get_value, pc->cb_info->recvMsg);
3236 LOGD("ret : 0x%x", ret);
3241 int camera_attr_get_exposure_range(camera_h camera, int *min, int *max)
3243 if( camera == NULL || min == NULL || max == NULL ){
3244 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3245 return CAMERA_ERROR_INVALID_PARAMETER;
3247 int ret = CAMERA_ERROR_NONE;
3248 camera_cli_s *pc = (camera_cli_s *)camera;
3250 if (pc->cb_info == NULL) {
3251 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3252 return CAMERA_ERROR_INVALID_PARAMETER;
3254 sock_fd = pc->cb_info->fd;
3255 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE_RANGE;
3259 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3260 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3262 if (ret == CAMERA_ERROR_NONE) {
3263 muse_camera_msg_get(get_min, pc->cb_info->recvMsg);
3264 muse_camera_msg_get(get_max, pc->cb_info->recvMsg);
3268 LOGD("ret : 0x%x", ret);
3273 int camera_attr_get_iso( camera_h camera, camera_attr_iso_e *iso)
3275 if( camera == NULL || iso == NULL){
3276 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3277 return CAMERA_ERROR_INVALID_PARAMETER;
3279 int ret = CAMERA_ERROR_NONE;
3280 camera_cli_s *pc = (camera_cli_s *)camera;
3282 if (pc->cb_info == NULL) {
3283 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3284 return CAMERA_ERROR_INVALID_PARAMETER;
3286 sock_fd = pc->cb_info->fd;
3287 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ISO;
3290 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3291 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3293 if (ret == CAMERA_ERROR_NONE) {
3294 muse_camera_msg_get(get_iso, pc->cb_info->recvMsg);
3295 *iso = (camera_attr_iso_e)get_iso;
3297 LOGD("ret : 0x%x", ret);
3302 int camera_attr_get_brightness(camera_h camera, int *level)
3304 if( camera == NULL || level == NULL){
3305 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3306 return CAMERA_ERROR_INVALID_PARAMETER;
3308 int ret = CAMERA_ERROR_NONE;
3309 camera_cli_s *pc = (camera_cli_s *)camera;
3311 if (pc->cb_info == NULL) {
3312 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3313 return CAMERA_ERROR_INVALID_PARAMETER;
3315 sock_fd = pc->cb_info->fd;
3316 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_BRIGHTNESS;
3319 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3320 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3322 if (ret == CAMERA_ERROR_NONE) {
3323 muse_camera_msg_get(get_level, pc->cb_info->recvMsg);
3326 LOGD("ret : 0x%x", ret);
3331 int camera_attr_get_brightness_range(camera_h camera, int *min, int *max)
3333 if( camera == NULL || min == NULL || max == NULL ){
3334 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3335 return CAMERA_ERROR_INVALID_PARAMETER;
3337 int ret = CAMERA_ERROR_NONE;
3338 camera_cli_s *pc = (camera_cli_s *)camera;
3340 if (pc->cb_info == NULL) {
3341 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3342 return CAMERA_ERROR_INVALID_PARAMETER;
3344 sock_fd = pc->cb_info->fd;
3345 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_BRIGHTNESS_RANGE;
3349 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3350 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3352 if (ret == CAMERA_ERROR_NONE) {
3353 muse_camera_msg_get(get_min, pc->cb_info->recvMsg);
3354 muse_camera_msg_get(get_max, pc->cb_info->recvMsg);
3358 LOGD("ret : 0x%x", ret);
3363 int camera_attr_get_contrast(camera_h camera, int *level)
3365 if( camera == NULL || level == NULL){
3366 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3367 return CAMERA_ERROR_INVALID_PARAMETER;
3369 int ret = CAMERA_ERROR_NONE;
3370 camera_cli_s *pc = (camera_cli_s *)camera;
3371 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_CONTRAST;
3373 if (pc->cb_info == NULL) {
3374 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3375 return CAMERA_ERROR_INVALID_PARAMETER;
3377 sock_fd = pc->cb_info->fd;
3380 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3381 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3383 if (ret == CAMERA_ERROR_NONE) {
3384 muse_camera_msg_get(get_level, pc->cb_info->recvMsg);
3387 LOGD("ret : 0x%x", ret);
3392 int camera_attr_get_contrast_range(camera_h camera, int *min , int *max)
3394 if( camera == NULL || min == NULL || max == NULL ){
3395 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3396 return CAMERA_ERROR_INVALID_PARAMETER;
3398 int ret = CAMERA_ERROR_NONE;
3399 camera_cli_s *pc = (camera_cli_s *)camera;
3400 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_CONTRAST_RANGE;
3402 if (pc->cb_info == NULL) {
3403 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3404 return CAMERA_ERROR_INVALID_PARAMETER;
3406 sock_fd = pc->cb_info->fd;
3410 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3411 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3413 if (ret == CAMERA_ERROR_NONE) {
3414 muse_camera_msg_get(get_min, pc->cb_info->recvMsg);
3415 muse_camera_msg_get(get_max, pc->cb_info->recvMsg);
3419 LOGD("ret : 0x%x", ret);
3424 int camera_attr_get_whitebalance(camera_h camera, camera_attr_whitebalance_e *wb)
3426 if( camera == NULL || wb == NULL){
3427 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3428 return CAMERA_ERROR_INVALID_PARAMETER;
3430 int ret = CAMERA_ERROR_NONE;
3431 camera_cli_s *pc = (camera_cli_s *)camera;
3432 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_WHITEBALANCE;
3434 if (pc->cb_info == NULL) {
3435 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3436 return CAMERA_ERROR_INVALID_PARAMETER;
3438 sock_fd = pc->cb_info->fd;
3441 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3442 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3444 if (ret == CAMERA_ERROR_NONE) {
3445 muse_camera_msg_get(get_wb, pc->cb_info->recvMsg);
3446 *wb = (camera_attr_whitebalance_e)get_wb;
3448 LOGD("ret : 0x%x", ret);
3453 int camera_attr_get_effect(camera_h camera, camera_attr_effect_mode_e *effect)
3455 if( camera == NULL || effect == NULL ){
3456 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3457 return CAMERA_ERROR_INVALID_PARAMETER;
3460 int ret = CAMERA_ERROR_NONE;
3461 camera_cli_s *pc = (camera_cli_s *)camera;
3462 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EFFECT;
3464 if (pc->cb_info == NULL) {
3465 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3466 return CAMERA_ERROR_INVALID_PARAMETER;
3468 sock_fd = pc->cb_info->fd;
3471 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3472 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3474 if (ret == CAMERA_ERROR_NONE) {
3475 muse_camera_msg_get(get_effect, pc->cb_info->recvMsg);
3476 *effect = (camera_attr_effect_mode_e)get_effect;
3478 LOGD("ret : 0x%x", ret);
3483 int camera_attr_get_scene_mode(camera_h camera, camera_attr_scene_mode_e *mode)
3485 if( camera == NULL || mode == NULL){
3486 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3487 return CAMERA_ERROR_INVALID_PARAMETER;
3490 int ret = CAMERA_ERROR_NONE;
3491 camera_cli_s *pc = (camera_cli_s *)camera;
3492 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_SCENE_MODE;
3494 if (pc->cb_info == NULL) {
3495 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3496 return CAMERA_ERROR_INVALID_PARAMETER;
3498 sock_fd = pc->cb_info->fd;
3501 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3502 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3504 if (ret == CAMERA_ERROR_NONE) {
3505 muse_camera_msg_get(get_mode, pc->cb_info->recvMsg);
3506 *mode = (camera_attr_scene_mode_e)get_mode;
3508 LOGD("ret : 0x%x", ret);
3513 int camera_attr_is_enabled_tag(camera_h camera, bool *enable)
3515 if( camera == NULL || enable == NULL){
3516 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3517 return CAMERA_ERROR_INVALID_PARAMETER;
3520 int ret = CAMERA_ERROR_NONE;
3521 camera_cli_s *pc = (camera_cli_s *)camera;
3522 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_TAG;
3524 if (pc->cb_info == NULL) {
3525 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3526 return CAMERA_ERROR_INVALID_PARAMETER;
3528 sock_fd = pc->cb_info->fd;
3531 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3532 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3534 if (ret == CAMERA_ERROR_NONE) {
3535 muse_camera_msg_get(get_enabled, pc->cb_info->recvMsg);
3536 *enable = (bool)get_enabled;
3538 LOGD("ret : 0x%x", ret);
3543 int camera_attr_get_tag_image_description(camera_h camera, char **description)
3545 if( camera == NULL || description == NULL){
3546 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3547 return CAMERA_ERROR_INVALID_PARAMETER;
3550 int ret = CAMERA_ERROR_NONE;
3551 camera_cli_s *pc = (camera_cli_s *)camera;
3552 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_IMAGE_DESCRIPTION;
3554 if (pc->cb_info == NULL) {
3555 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3556 return CAMERA_ERROR_INVALID_PARAMETER;
3558 sock_fd = pc->cb_info->fd;
3559 char get_description[MUSE_CAMERA_MSG_MAX_LENGTH] = {0,};
3561 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3562 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3564 if (ret == CAMERA_ERROR_NONE) {
3565 muse_camera_msg_get_string(get_description, pc->cb_info->recvMsg);
3566 *description = strdup(get_description);
3568 LOGD("ret : 0x%x", ret);
3573 int camera_attr_get_tag_orientation(camera_h camera, camera_attr_tag_orientation_e *orientation)
3575 if( camera == NULL || orientation == NULL){
3576 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3577 return CAMERA_ERROR_INVALID_PARAMETER;
3580 int ret = CAMERA_ERROR_NONE;
3581 camera_cli_s *pc = (camera_cli_s *)camera;
3582 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_ORIENTATION;
3584 if (pc->cb_info == NULL) {
3585 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3586 return CAMERA_ERROR_INVALID_PARAMETER;
3588 sock_fd = pc->cb_info->fd;
3589 int get_orientation;
3591 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3592 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3594 if (ret == CAMERA_ERROR_NONE) {
3595 muse_camera_msg_get(get_orientation, pc->cb_info->recvMsg);
3596 *orientation = (camera_attr_tag_orientation_e)get_orientation;
3597 LOGD("success, orientation : %d", *orientation);
3599 LOGD("ret : 0x%x", ret);
3604 int camera_attr_get_tag_software(camera_h camera, char **software)
3606 if( camera == NULL || software == NULL ){
3607 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3608 return CAMERA_ERROR_INVALID_PARAMETER;
3611 int ret = CAMERA_ERROR_NONE;
3612 camera_cli_s *pc = (camera_cli_s *)camera;
3613 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_SOFTWARE;
3615 if (pc->cb_info == NULL) {
3616 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3617 return CAMERA_ERROR_INVALID_PARAMETER;
3619 sock_fd = pc->cb_info->fd;
3620 char get_software[MUSE_CAMERA_MSG_MAX_LENGTH] = {0,};
3622 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3623 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3625 if (ret == CAMERA_ERROR_NONE) {
3626 muse_camera_msg_get_string(get_software, pc->cb_info->recvMsg);
3627 *software = strdup(get_software);
3629 LOGD("ret : 0x%x", ret);
3634 int camera_attr_get_geotag(camera_h camera, double *latitude , double *longitude, double *altitude)
3636 if( camera == NULL || latitude == NULL || longitude == NULL || altitude == NULL){
3637 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3638 return CAMERA_ERROR_INVALID_PARAMETER;
3641 int ret = CAMERA_ERROR_NONE;
3642 camera_cli_s *pc = (camera_cli_s *)camera;
3643 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_GEOTAG;
3644 double get_geotag[3] = {0,};
3646 if (pc->cb_info == NULL) {
3647 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3648 return CAMERA_ERROR_INVALID_PARAMETER;
3650 sock_fd = pc->cb_info->fd;
3652 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3653 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3655 if (ret == CAMERA_ERROR_NONE) {
3656 muse_camera_msg_get_array(get_geotag, pc->cb_info->recvMsg);
3657 *latitude = get_geotag[0];
3658 *longitude = get_geotag[1];
3659 *altitude = get_geotag[2];
3661 LOGE("Returned value is not valid : 0x%x", valid);
3664 LOGD("ret : 0x%x", ret);
3670 int camera_attr_get_flash_mode(camera_h camera, camera_attr_flash_mode_e *mode)
3672 if( camera == NULL || mode == NULL){
3673 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3674 return CAMERA_ERROR_INVALID_PARAMETER;
3677 int ret = CAMERA_ERROR_NONE;
3678 camera_cli_s *pc = (camera_cli_s *)camera;
3679 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_FLASH_MODE;
3681 if (pc->cb_info == NULL) {
3682 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3683 return CAMERA_ERROR_INVALID_PARAMETER;
3685 sock_fd = pc->cb_info->fd;
3688 LOGD("Enter, remote_handle : %x", pc->remote_handle);
3689 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3691 if (ret == CAMERA_ERROR_NONE) {
3692 muse_camera_msg_get(get_mode, pc->cb_info->recvMsg);
3693 *mode = (camera_attr_flash_mode_e)get_mode;
3695 LOGD("ret : 0x%x", ret);
3700 int camera_attr_foreach_supported_af_mode( camera_h camera, camera_attr_supported_af_mode_cb foreach_cb , void *user_data)
3702 if( camera == NULL || foreach_cb == NULL){
3703 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3704 return CAMERA_ERROR_INVALID_PARAMETER;
3706 int ret = CAMERA_ERROR_NONE;
3708 camera_cli_s *pc = (camera_cli_s *)camera;
3709 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_AF_MODE;
3711 LOGD("Enter, handle :%x", pc->remote_handle);
3714 if (pc->cb_info == NULL) {
3715 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3716 return CAMERA_ERROR_INVALID_PARAMETER;
3718 sock_fd = pc->cb_info->fd;
3719 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_AF_MODE] = foreach_cb;
3720 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_AF_MODE] = user_data;
3722 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3723 LOGD("ret : 0x%x", ret);
3728 int camera_attr_foreach_supported_exposure_mode(camera_h camera, camera_attr_supported_exposure_mode_cb foreach_cb , void *user_data)
3730 if( camera == NULL || foreach_cb == NULL){
3731 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3732 return CAMERA_ERROR_INVALID_PARAMETER;
3734 int ret = CAMERA_ERROR_NONE;
3736 camera_cli_s *pc = (camera_cli_s *)camera;
3737 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_EXPOSURE_MODE;
3739 LOGD("Enter, handle :%x", pc->remote_handle);
3742 if (pc->cb_info == NULL) {
3743 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3744 return CAMERA_ERROR_INVALID_PARAMETER;
3746 sock_fd = pc->cb_info->fd;
3747 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EXPOSURE_MODE] = foreach_cb;
3748 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EXPOSURE_MODE] = user_data;
3750 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3751 LOGD("ret : 0x%x", ret);
3756 int camera_attr_foreach_supported_iso( camera_h camera, camera_attr_supported_iso_cb foreach_cb , void *user_data)
3758 if( camera == NULL || foreach_cb == NULL){
3759 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3760 return CAMERA_ERROR_INVALID_PARAMETER;
3762 int ret = CAMERA_ERROR_NONE;
3764 camera_cli_s *pc = (camera_cli_s *)camera;
3765 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_ISO;
3767 LOGD("Enter, handle :%x", pc->remote_handle);
3770 if (pc->cb_info == NULL) {
3771 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3772 return CAMERA_ERROR_INVALID_PARAMETER;
3774 sock_fd = pc->cb_info->fd;
3775 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_ISO] = foreach_cb;
3776 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_ISO] = user_data;
3778 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3779 LOGD("ret : 0x%x", ret);
3784 int camera_attr_foreach_supported_whitebalance(camera_h camera, camera_attr_supported_whitebalance_cb foreach_cb , void *user_data)
3786 if( camera == NULL || foreach_cb == NULL){
3787 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3788 return CAMERA_ERROR_INVALID_PARAMETER;
3790 int ret = CAMERA_ERROR_NONE;
3792 camera_cli_s *pc = (camera_cli_s *)camera;
3793 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_WHITEBALANCE;
3795 LOGD("Enter, handle :%x", pc->remote_handle);
3798 if (pc->cb_info == NULL) {
3799 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3800 return CAMERA_ERROR_INVALID_PARAMETER;
3802 sock_fd = pc->cb_info->fd;
3803 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_WHITEBALANCE] = foreach_cb;
3804 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_WHITEBALANCE] = user_data;
3806 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3807 LOGD("ret : 0x%x", ret);
3812 int camera_attr_foreach_supported_effect(camera_h camera, camera_attr_supported_effect_cb foreach_cb , void *user_data)
3814 if( camera == NULL || foreach_cb == NULL){
3815 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3816 return CAMERA_ERROR_INVALID_PARAMETER;
3818 int ret = CAMERA_ERROR_NONE;
3820 camera_cli_s *pc = (camera_cli_s *)camera;
3821 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_EFFECT;
3823 LOGD("Enter, handle :%x", pc->remote_handle);
3826 if (pc->cb_info == NULL) {
3827 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3828 return CAMERA_ERROR_INVALID_PARAMETER;
3830 sock_fd = pc->cb_info->fd;
3831 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EFFECT] = foreach_cb;
3832 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EFFECT] = user_data;
3834 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3835 LOGD("ret : 0x%x", ret);
3840 int camera_attr_foreach_supported_scene_mode(camera_h camera, camera_attr_supported_scene_mode_cb foreach_cb , void *user_data)
3842 if( camera == NULL || foreach_cb == NULL){
3843 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3844 return CAMERA_ERROR_INVALID_PARAMETER;
3846 int ret = CAMERA_ERROR_NONE;
3848 camera_cli_s *pc = (camera_cli_s *)camera;
3849 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_SCENE_MODE;
3851 LOGD("Enter, handle :%x", pc->remote_handle);
3854 if (pc->cb_info == NULL) {
3855 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3856 return CAMERA_ERROR_INVALID_PARAMETER;
3858 sock_fd = pc->cb_info->fd;
3859 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_SCENE_MODE] = foreach_cb;
3860 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_SCENE_MODE] = user_data;
3862 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3863 LOGD("ret : 0x%x", ret);
3868 int camera_attr_foreach_supported_flash_mode(camera_h camera, camera_attr_supported_flash_mode_cb foreach_cb , void *user_data)
3870 if( camera == NULL || foreach_cb == NULL){
3871 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3872 return CAMERA_ERROR_INVALID_PARAMETER;
3874 int ret = CAMERA_ERROR_NONE;
3876 camera_cli_s *pc = (camera_cli_s *)camera;
3877 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FLASH_MODE;
3879 LOGD("Enter, handle :%x", pc->remote_handle);
3882 if (pc->cb_info == NULL) {
3883 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3884 return CAMERA_ERROR_INVALID_PARAMETER;
3886 sock_fd = pc->cb_info->fd;
3887 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FLASH_MODE] = foreach_cb;
3888 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FLASH_MODE] = user_data;
3890 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3891 LOGD("ret : 0x%x", ret);
3896 int camera_attr_foreach_supported_fps(camera_h camera, camera_attr_supported_fps_cb foreach_cb , void *user_data)
3898 if( camera == NULL || foreach_cb == NULL){
3899 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3900 return CAMERA_ERROR_INVALID_PARAMETER;
3902 int ret = CAMERA_ERROR_NONE;
3904 camera_cli_s *pc = (camera_cli_s *)camera;
3905 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FPS;
3907 if (pc->cb_info == NULL) {
3908 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3909 return CAMERA_ERROR_INVALID_PARAMETER;
3911 sock_fd = pc->cb_info->fd;
3912 LOGD("Enter, handle :%x", pc->remote_handle);
3913 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS] = foreach_cb;
3914 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS] = user_data;
3916 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3917 LOGD("Enter, handle :%x", pc->remote_handle);
3921 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)
3923 if( camera == NULL || foreach_cb == NULL){
3924 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3925 return CAMERA_ERROR_INVALID_PARAMETER;
3927 int ret = CAMERA_ERROR_NONE;
3929 camera_cli_s *pc = (camera_cli_s *)camera;
3930 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FPS_BY_RESOLUTION;
3932 if (pc->cb_info == NULL) {
3933 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3934 return CAMERA_ERROR_INVALID_PARAMETER;
3936 sock_fd = pc->cb_info->fd;
3937 LOGD("Enter, handle :%x", pc->remote_handle);
3938 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS_BY_RESOLUTION] = foreach_cb;
3939 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS_BY_RESOLUTION] = user_data;
3941 muse_camera_msg_send2(api, sock_fd, pc->cb_info, ret, INT, width, INT, height);
3942 LOGD("ret : 0x%x", ret);
3946 int camera_attr_foreach_supported_stream_flip(camera_h camera, camera_attr_supported_stream_flip_cb foreach_cb, void *user_data)
3948 if( camera == NULL || foreach_cb == NULL){
3949 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3950 return CAMERA_ERROR_INVALID_PARAMETER;
3952 int ret = CAMERA_ERROR_NONE;
3954 camera_cli_s *pc = (camera_cli_s *)camera;
3955 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_STREAM_FLIP;
3957 if (pc->cb_info == NULL) {
3958 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3959 return CAMERA_ERROR_INVALID_PARAMETER;
3961 sock_fd = pc->cb_info->fd;
3962 LOGD("Enter, handle :%x", pc->remote_handle);
3963 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_FLIP] = foreach_cb;
3964 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_FLIP] = user_data;
3966 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3967 LOGD("ret : 0x%x", ret);
3972 int camera_attr_foreach_supported_stream_rotation(camera_h camera, camera_attr_supported_stream_rotation_cb foreach_cb, void *user_data)
3974 if( camera == NULL || foreach_cb == NULL){
3975 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3976 return CAMERA_ERROR_INVALID_PARAMETER;
3978 int ret = CAMERA_ERROR_NONE;
3980 camera_cli_s *pc = (camera_cli_s *)camera;
3981 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_STREAM_ROTATION;
3983 if (pc->cb_info == NULL) {
3984 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
3985 return CAMERA_ERROR_INVALID_PARAMETER;
3987 sock_fd = pc->cb_info->fd;
3988 LOGD("Enter, handle :%x", pc->remote_handle);
3989 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION] = foreach_cb;
3990 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION] = user_data;
3992 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
3993 LOGD("ret : 0x%x", ret);
3998 int camera_attr_set_stream_rotation(camera_h camera , camera_rotation_e rotation)
4000 if( camera == NULL){
4001 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
4002 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_STREAM_ROTATION;
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_rotation = (int)rotation;
4016 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4017 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_rotation);
4018 LOGD("ret : 0x%x", ret);
4023 int camera_attr_get_stream_rotation(camera_h camera , camera_rotation_e *rotation)
4025 if( camera == NULL || rotation == NULL ){
4026 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
4027 return CAMERA_ERROR_INVALID_PARAMETER;
4030 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_STREAM_ROTATION;
4034 if (pc->cb_info == NULL) {
4035 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
4036 return CAMERA_ERROR_INVALID_PARAMETER;
4038 sock_fd = pc->cb_info->fd;
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_rotation, pc->cb_info->recvMsg);
4046 *rotation = (camera_rotation_e)get_rotation;
4048 LOGD("ret : 0x%x", ret);
4053 int camera_attr_set_stream_flip(camera_h camera , camera_flip_e flip)
4055 if( camera == NULL){
4056 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
4057 return CAMERA_ERROR_INVALID_PARAMETER;
4060 int ret = CAMERA_ERROR_NONE;
4061 camera_cli_s *pc = (camera_cli_s *)camera;
4062 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_STREAM_FLIP;
4064 if (pc->cb_info == NULL) {
4065 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
4066 return CAMERA_ERROR_INVALID_PARAMETER;
4068 sock_fd = pc->cb_info->fd;
4069 int set_flip = (int)flip;
4071 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4072 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_flip);
4073 LOGD("ret : 0x%x", ret);
4078 int camera_attr_get_stream_flip(camera_h camera , camera_flip_e *flip)
4080 if( camera == NULL || flip == NULL ){
4081 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
4082 return CAMERA_ERROR_INVALID_PARAMETER;
4085 int ret = CAMERA_ERROR_NONE;
4086 camera_cli_s *pc = (camera_cli_s *)camera;
4087 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_STREAM_FLIP;
4089 if (pc->cb_info == NULL) {
4090 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
4091 return CAMERA_ERROR_INVALID_PARAMETER;
4093 sock_fd = pc->cb_info->fd;
4096 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4097 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4099 if (ret == CAMERA_ERROR_NONE) {
4100 muse_camera_msg_get(get_flip, pc->cb_info->recvMsg);
4101 *flip = (camera_flip_e)get_flip;
4103 LOGD("ret : 0x%x", ret);
4107 int camera_attr_set_hdr_mode(camera_h camera, camera_attr_hdr_mode_e mode)
4109 if( camera == NULL){
4110 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4111 return CAMERA_ERROR_INVALID_PARAMETER;
4114 int ret = CAMERA_ERROR_NONE;
4115 camera_cli_s *pc = (camera_cli_s *)camera;
4116 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_HDR_MODE;
4118 if (pc->cb_info == NULL) {
4119 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
4120 return CAMERA_ERROR_INVALID_PARAMETER;
4122 sock_fd = pc->cb_info->fd;
4123 int set_mode = (int)mode;
4125 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4126 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_mode);
4127 LOGD("ret : 0x%x", ret);
4132 int camera_attr_get_hdr_mode(camera_h camera, camera_attr_hdr_mode_e *mode)
4134 if (camera == NULL) {
4135 LOGE("INVALID_PARAMETER(0x%08x) - handle",CAMERA_ERROR_INVALID_PARAMETER);
4136 return CAMERA_ERROR_INVALID_PARAMETER;
4139 LOGE("CAMERA_ERROR_NOT_SUPPORTED(0x%08x) - mode",CAMERA_ERROR_NOT_SUPPORTED);
4140 return CAMERA_ERROR_NOT_SUPPORTED;
4142 int ret = CAMERA_ERROR_NONE;
4143 camera_cli_s *pc = (camera_cli_s *)camera;
4144 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_HDR_MODE;
4146 if (pc->cb_info == NULL) {
4147 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
4148 return CAMERA_ERROR_INVALID_PARAMETER;
4150 sock_fd = pc->cb_info->fd;
4153 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4154 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4156 if (ret == CAMERA_ERROR_NONE) {
4157 muse_camera_msg_get(get_mode, pc->cb_info->recvMsg);
4158 *mode = (camera_attr_hdr_mode_e)get_mode;
4160 LOGD("ret : 0x%x", ret);
4165 bool camera_attr_is_supported_hdr_capture(camera_h camera)
4167 if( camera == NULL){
4168 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
4172 int ret = CAMERA_ERROR_NONE;
4173 camera_cli_s *pc = (camera_cli_s *)camera;
4174 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_HDR_CAPTURE;
4176 if (pc->cb_info == NULL) {
4177 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
4178 return CAMERA_ERROR_INVALID_PARAMETER;
4180 sock_fd = pc->cb_info->fd;
4181 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4182 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4183 LOGD("ret : 0x%x", ret);
4188 int camera_attr_set_hdr_capture_progress_cb(camera_h camera, camera_attr_hdr_progress_cb callback, void* user_data)
4190 if (camera == NULL) {
4191 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
4192 return CAMERA_ERROR_INVALID_PARAMETER;
4194 if (callback == NULL) {
4195 LOGE("CAMERA_ERROR_NOT_SUPPORTED(0x%08x) - callback", CAMERA_ERROR_NOT_SUPPORTED);
4196 return CAMERA_ERROR_NOT_SUPPORTED;
4198 int ret = CAMERA_ERROR_NONE;
4200 camera_cli_s *pc = (camera_cli_s *)camera;
4201 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_HDR_CAPTURE_PROGRESS_CB;
4203 if (pc->cb_info == NULL) {
4204 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
4205 return CAMERA_ERROR_INVALID_PARAMETER;
4207 sock_fd = pc->cb_info->fd;
4208 LOGD("Enter, handle :%x", pc->remote_handle);
4210 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = callback;
4211 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = user_data;
4213 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4214 LOGD("ret : 0x%x", ret);
4219 int camera_attr_unset_hdr_capture_progress_cb(camera_h camera)
4221 if( camera == NULL){
4222 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
4223 return CAMERA_ERROR_INVALID_PARAMETER;
4226 int ret = CAMERA_ERROR_NONE;
4228 camera_cli_s *pc = (camera_cli_s *)camera;
4229 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_UNSET_HDR_CAPTURE_PROGRESS_CB;
4231 if (pc->cb_info == NULL) {
4232 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
4233 return CAMERA_ERROR_INVALID_PARAMETER;
4235 sock_fd = pc->cb_info->fd;
4236 LOGD("Enter, handle :%x", pc->remote_handle);
4238 pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = (void *)NULL;
4239 pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = (void *)NULL;
4241 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4242 LOGD("ret : 0x%x", ret);
4247 int camera_attr_enable_anti_shake(camera_h camera, bool enable)
4249 if (camera == NULL) {
4250 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
4251 return CAMERA_ERROR_INVALID_PARAMETER;
4254 int ret = CAMERA_ERROR_NONE;
4255 camera_cli_s *pc = (camera_cli_s *)camera;
4256 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_ANTI_SHAKE;
4258 if (pc->cb_info == NULL) {
4259 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
4260 return CAMERA_ERROR_INVALID_PARAMETER;
4262 sock_fd = pc->cb_info->fd;
4263 int set_enable = (int)enable;
4265 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4266 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
4267 LOGD("ret : 0x%x", ret);
4272 int camera_attr_is_enabled_anti_shake(camera_h camera , bool *enabled)
4274 if (camera == NULL) {
4275 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
4276 return CAMERA_ERROR_INVALID_PARAMETER;
4278 if (enabled == NULL) {
4279 LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER);
4280 return CAMERA_ERROR_NOT_SUPPORTED;
4282 int ret = CAMERA_ERROR_NONE;
4283 camera_cli_s *pc = (camera_cli_s *)camera;
4284 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_ANTI_SHAKE;
4286 if (pc->cb_info == NULL) {
4287 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
4288 return CAMERA_ERROR_INVALID_PARAMETER;
4290 sock_fd = pc->cb_info->fd;
4293 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4294 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4296 if (ret == CAMERA_ERROR_NONE) {
4297 muse_camera_msg_get(get_enabled, pc->cb_info->recvMsg);
4298 *enabled = (bool)get_enabled;
4300 LOGD("ret : 0x%x", ret);
4305 bool camera_attr_is_supported_anti_shake(camera_h camera)
4308 if( camera == NULL){
4309 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
4313 int ret = CAMERA_ERROR_NONE;
4314 camera_cli_s *pc = (camera_cli_s *)camera;
4315 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_ANTI_SHAKE;
4317 if (pc->cb_info == NULL) {
4318 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
4319 return CAMERA_ERROR_INVALID_PARAMETER;
4321 sock_fd = pc->cb_info->fd;
4322 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4323 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4324 LOGD("ret : 0x%x", ret);
4329 int camera_attr_enable_video_stabilization(camera_h camera, bool enable)
4331 if (camera == NULL) {
4332 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
4333 return CAMERA_ERROR_INVALID_PARAMETER;
4336 int ret = CAMERA_ERROR_NONE;
4337 camera_cli_s *pc = (camera_cli_s *)camera;
4338 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_VIDEO_STABILIZATION;
4340 if (pc->cb_info == NULL) {
4341 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
4342 return CAMERA_ERROR_INVALID_PARAMETER;
4344 sock_fd = pc->cb_info->fd;
4345 int set_enable = (int)enable;
4347 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4348 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
4349 LOGD("ret : 0x%x", ret);
4354 int camera_attr_is_enabled_video_stabilization(camera_h camera, bool *enabled)
4356 if (camera == NULL) {
4357 LOGE("INVALID_PARAMETER(0x%08x) - handle",CAMERA_ERROR_INVALID_PARAMETER);
4358 return CAMERA_ERROR_INVALID_PARAMETER;
4360 if (enabled == NULL) {
4361 LOGE("INVALID_PARAMETER(0x%08x) - enabled",CAMERA_ERROR_INVALID_PARAMETER);
4362 return CAMERA_ERROR_NOT_SUPPORTED;
4364 int ret = CAMERA_ERROR_NONE;
4365 camera_cli_s *pc = (camera_cli_s *)camera;
4366 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_VIDEO_STABILIZATION;
4368 if (pc->cb_info == NULL) {
4369 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
4370 return CAMERA_ERROR_INVALID_PARAMETER;
4372 sock_fd = pc->cb_info->fd;
4375 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4376 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4378 if (ret == CAMERA_ERROR_NONE) {
4379 muse_camera_msg_get(get_enabled, pc->cb_info->recvMsg);
4380 *enabled = (bool)get_enabled;
4382 LOGD("ret : 0x%x", ret);
4387 bool camera_attr_is_supported_video_stabilization(camera_h camera)
4389 if( camera == NULL){
4390 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
4394 int ret = CAMERA_ERROR_NONE;
4395 camera_cli_s *pc = (camera_cli_s *)camera;
4396 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_VIDEO_STABILIZATION;
4398 if (pc->cb_info == NULL) {
4399 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
4400 return CAMERA_ERROR_INVALID_PARAMETER;
4402 sock_fd = pc->cb_info->fd;
4403 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4404 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4405 LOGD("ret : 0x%x", ret);
4410 int camera_attr_enable_auto_contrast(camera_h camera, bool enable)
4412 if( camera == NULL){
4413 LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
4414 return CAMERA_ERROR_INVALID_PARAMETER;
4417 int ret = CAMERA_ERROR_NONE;
4418 camera_cli_s *pc = (camera_cli_s *)camera;
4419 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_AUTO_CONTRAST;
4421 if (pc->cb_info == NULL) {
4422 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
4423 return CAMERA_ERROR_INVALID_PARAMETER;
4425 sock_fd = pc->cb_info->fd;
4426 int set_enable = (int)enable;
4428 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4429 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_enable);
4430 LOGD("ret : 0x%x", ret);
4435 int camera_attr_is_enabled_auto_contrast(camera_h camera, bool *enabled)
4437 if (camera == NULL) {
4438 LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER);
4439 return CAMERA_ERROR_INVALID_PARAMETER;
4441 if (enabled == NULL) {
4442 LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER);
4443 return CAMERA_ERROR_INVALID_PARAMETER;
4445 int ret = CAMERA_ERROR_NONE;
4446 camera_cli_s *pc = (camera_cli_s *)camera;
4447 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_AUTO_CONTRAST;
4449 if (pc->cb_info == NULL) {
4450 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
4451 return CAMERA_ERROR_INVALID_PARAMETER;
4453 sock_fd = pc->cb_info->fd;
4456 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4457 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4459 if (ret == CAMERA_ERROR_NONE) {
4460 muse_camera_msg_get(get_enabled, pc->cb_info->recvMsg);
4461 *enabled = (bool)get_enabled;
4463 LOGD("ret : 0x%x", ret);
4468 bool camera_attr_is_supported_auto_contrast(camera_h camera)
4470 if( camera == NULL){
4471 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
4475 int ret = CAMERA_ERROR_NONE;
4476 camera_cli_s *pc = (camera_cli_s *)camera;
4477 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_AUTO_CONTRAST;
4479 if (pc->cb_info == NULL) {
4480 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
4481 return CAMERA_ERROR_INVALID_PARAMETER;
4483 sock_fd = pc->cb_info->fd;
4484 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4485 muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
4486 LOGD("ret : 0x%x", ret);
4491 int camera_attr_disable_shutter_sound(camera_h camera, bool disable)
4493 if (camera == NULL) {
4494 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
4495 return CAMERA_ERROR_INVALID_PARAMETER;
4498 int ret = CAMERA_ERROR_NONE;
4499 camera_cli_s *pc = (camera_cli_s *)camera;
4500 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_DISABLE_SHUTTER_SOUND;
4502 if (pc->cb_info == NULL) {
4503 LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER);
4504 return CAMERA_ERROR_INVALID_PARAMETER;
4506 sock_fd = pc->cb_info->fd;
4507 int set_disable = (int)disable;
4509 LOGD("Enter, remote_handle : %x", pc->remote_handle);
4510 muse_camera_msg_send1(api, sock_fd, pc->cb_info, ret, INT, set_disable);
4511 LOGD("ret : 0x%x", ret);