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.
20 #include <sys/types.h>
21 #include <sys/socket.h>
25 #include "muse_camera_msg.h"
26 #include "muse_camera_internal.h"
28 #include <muse_core_security.h>
34 #define LOG_TAG "MUSED_CAMERA"
37 #define CAMERA_PRIVILEGE_NAME "http://tizen.org/privilege/camera"
38 #define MUSED_KEY_DEVICE_STATE_CHECK "camera_get_device_state_is_called"
39 #define MUSED_KEY_DEVICE_STATE_RETURN "camera_get_device_state_return"
40 #define MUSED_KEY_FLASH_STATE_CHECK "camera_get_flash_state_is_called"
41 #define MUSED_KEY_FLASH_STATE_RETURN "camera_get_flash_state_return"
42 #define MUSED_KEY_FLASH_STATE_COUNT "camera_get_flash_state_count"
44 static int _camera_remove_export_data(muse_module_h module, int key, int remove_all);
46 static void __camera_dispatcher_send_msg(muse_module_h module, char *msg)
60 /*LOGD("msg [%s]", msg);*/
62 len = muse_core_ipc_send_msg(muse_core_client_get_msg_fd(module), msg);
64 LOGE("sending message[%s] failed. errno %d", msg, errno);
67 muse_core_msg_json_factory_free(msg);
72 static void muse_camera_msg_return(int api, int class, int ret, muse_module_h module)
74 char *send_msg = muse_core_msg_json_factory_new(api,
75 MUSE_TYPE_INT, PARAM_API_CLASS, class,
76 MUSE_TYPE_INT, PARAM_RET, ret,
77 MUSE_TYPE_INT, PARAM_GET_TYPE, MUSE_CAMERA_GET_TYPE_NONE,
80 __camera_dispatcher_send_msg(module, send_msg);
85 static void muse_camera_msg_return1(int api, int class, int ret, muse_module_h module,
86 int get_type, int index, const char *name, int value_int, void *value_pointer)
88 char *send_msg = NULL;
90 if (get_type == MUSE_CAMERA_GET_TYPE_INT) {
91 send_msg = muse_core_msg_json_factory_new(api,
92 MUSE_TYPE_INT, PARAM_API_CLASS, class,
93 MUSE_TYPE_INT, PARAM_RET, ret,
94 MUSE_TYPE_INT, PARAM_GET_TYPE, get_type,
95 MUSE_TYPE_INT, PARAM_GET_INDEX, index,
96 MUSE_TYPE_INT, name, value_int,
98 } else if (get_type == MUSE_CAMERA_GET_TYPE_STRING) {
99 send_msg = muse_core_msg_json_factory_new(api,
100 MUSE_TYPE_INT, PARAM_API_CLASS, class,
101 MUSE_TYPE_INT, PARAM_RET, ret,
102 MUSE_TYPE_INT, PARAM_GET_TYPE, get_type,
103 MUSE_TYPE_INT, PARAM_GET_INDEX, index,
104 MUSE_TYPE_STRING, name, value_pointer,
106 } else if (get_type == MUSE_CAMERA_GET_TYPE_POINTER) {
107 send_msg = muse_core_msg_json_factory_new(api,
108 MUSE_TYPE_INT, PARAM_API_CLASS, class,
109 MUSE_TYPE_INT, PARAM_RET, ret,
110 MUSE_TYPE_INT, PARAM_GET_TYPE, get_type,
111 MUSE_TYPE_INT, PARAM_GET_INDEX, index,
112 MUSE_TYPE_POINTER, name, value_pointer,
115 LOGW("unknown type %d", get_type);
118 __camera_dispatcher_send_msg(module, send_msg);
124 static void muse_camera_msg_return2(int api, int class, int ret, muse_module_h module,
125 int get_type, int index, int value0, int value1)
127 char *send_msg = muse_core_msg_json_factory_new(api,
128 MUSE_TYPE_INT, PARAM_API_CLASS, class,
129 MUSE_TYPE_INT, PARAM_RET, ret,
130 MUSE_TYPE_INT, PARAM_GET_TYPE, get_type,
131 MUSE_TYPE_INT, PARAM_GET_INDEX, index,
132 MUSE_TYPE_INT, "get_value0", value0,
133 MUSE_TYPE_INT, "get_value1", value1,
136 __camera_dispatcher_send_msg(module, send_msg);
142 static void muse_camera_msg_event1(int api, int event, int class, muse_module_h module, const char *name, int value)
144 char *send_msg = muse_core_msg_json_factory_new(api,
145 MUSE_TYPE_INT, PARAM_EVENT, event,
146 MUSE_TYPE_INT, PARAM_EVENT_CLASS, class,
147 MUSE_TYPE_INT, name, value,
150 __camera_dispatcher_send_msg(module, send_msg);
156 static void muse_camera_msg_event2(int api, int event, int class, muse_module_h module,
157 const char *name0, int value0, const char *name1, int value1)
159 char *send_msg = muse_core_msg_json_factory_new(api,
160 MUSE_TYPE_INT, PARAM_EVENT, event,
161 MUSE_TYPE_INT, PARAM_EVENT_CLASS, class,
162 MUSE_TYPE_INT, name0, value0,
163 MUSE_TYPE_INT, name1, value1,
166 __camera_dispatcher_send_msg(module, send_msg);
172 static void muse_camera_msg_event3(int api, int event, int class, muse_module_h module,
173 const char *name0, int value0, const char *name1, int value1, const char *name2, int value2)
175 char *send_msg = muse_core_msg_json_factory_new(api,
176 MUSE_TYPE_INT, PARAM_EVENT, event,
177 MUSE_TYPE_INT, PARAM_EVENT_CLASS, class,
178 MUSE_TYPE_INT, name0, value0,
179 MUSE_TYPE_INT, name1, value1,
180 MUSE_TYPE_INT, name2, value2,
183 __camera_dispatcher_send_msg(module, send_msg);
189 void _camera_dispatcher_callback_supported_theater_mode(int param1, void *user_data)
191 muse_module_h module = (muse_module_h)user_data;
193 muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT,
194 MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE,
195 MUSE_CAMERA_EVENT_CLASS_THREAD_SUB,
196 module, "param1", param1);
201 void _camera_dispatcher_callback_supported_af_mode(int param1, void *user_data)
203 muse_module_h module = (muse_module_h)user_data;
205 muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT,
206 MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_AF_MODE,
207 MUSE_CAMERA_EVENT_CLASS_THREAD_SUB,
208 module, "param1", param1);
213 void _camera_dispatcher_callback_supported_exposure_mode(int param1, void *user_data)
215 muse_module_h module = (muse_module_h)user_data;
217 muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT,
218 MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EXPOSURE_MODE,
219 MUSE_CAMERA_EVENT_CLASS_THREAD_SUB,
220 module, "param1", param1);
225 void _camera_dispatcher_callback_supported_iso_mode(int param1, void *user_data)
227 muse_module_h module = (muse_module_h)user_data;
229 muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT,
230 MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_ISO,
231 MUSE_CAMERA_EVENT_CLASS_THREAD_SUB,
232 module, "param1", param1);
237 void _camera_dispatcher_callback_supported_whitebalance(int param1, void *user_data)
239 muse_module_h module = (muse_module_h)user_data;
241 muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT,
242 MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_WHITEBALANCE,
243 MUSE_CAMERA_EVENT_CLASS_THREAD_SUB,
244 module, "param1", param1);
249 void _camera_dispatcher_callback_supported_effect(int param1, void *user_data)
251 muse_module_h module = (muse_module_h)user_data;
253 muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT,
254 MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EFFECT,
255 MUSE_CAMERA_EVENT_CLASS_THREAD_SUB,
256 module, "param1", param1);
261 void _camera_dispatcher_callback_supported_scene_mode(int param1, void *user_data)
263 muse_module_h module = (muse_module_h)user_data;
265 muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT,
266 MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_SCENE_MODE,
267 MUSE_CAMERA_EVENT_CLASS_THREAD_SUB,
268 module, "param1", param1);
273 void _camera_dispatcher_callback_supported_flash_mode(int param1, void *user_data)
275 muse_module_h module = (muse_module_h)user_data;
277 muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT,
278 MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FLASH_MODE,
279 MUSE_CAMERA_EVENT_CLASS_THREAD_SUB,
280 module, "param1", param1);
285 int _camera_dispatcher_callback_supported_flash_mode2(int param1, void *user_data)
287 int *count = (int *)user_data;
295 void _camera_dispatcher_callback_supported_fps(int param1, void *user_data)
297 muse_module_h module = (muse_module_h)user_data;
299 muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT,
300 MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS,
301 MUSE_CAMERA_EVENT_CLASS_THREAD_SUB,
302 module, "param1", param1);
307 void _camera_dispatcher_callback_supported_fps_by_resolution(int param1, void *user_data)
309 muse_module_h module = (muse_module_h)user_data;
311 muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT,
312 MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS_BY_RESOLUTION,
313 MUSE_CAMERA_EVENT_CLASS_THREAD_SUB,
314 module, "param1", param1);
319 void _camera_dispatcher_callback_supported_stream_flip(int param1, void *user_data)
321 muse_module_h module = (muse_module_h)user_data;
323 muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT,
324 MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_FLIP,
325 MUSE_CAMERA_EVENT_CLASS_THREAD_SUB,
326 module, "param1", param1);
331 void _camera_dispatcher_callback_supported_stream_rotation(int param1, void *user_data)
333 muse_module_h module = (muse_module_h)user_data;
335 muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT,
336 MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION,
337 MUSE_CAMERA_EVENT_CLASS_THREAD_SUB,
338 module, "param1", param1);
343 void _camera_dispatcher_callback_supported_capture_format(int param1, void *user_data)
345 muse_module_h module = (muse_module_h)user_data;
347 muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT,
348 MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_FORMAT,
349 MUSE_CAMERA_EVENT_CLASS_THREAD_SUB,
350 module, "param1", param1);
355 void _camera_dispatcher_callback_supported_preview_format(int param1, void *user_data)
357 muse_module_h module = (muse_module_h)user_data;
359 muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT,
360 MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_FORMAT,
361 MUSE_CAMERA_EVENT_CLASS_THREAD_SUB,
362 module, "param1", param1);
367 void _camera_dispatcher_callback_supported_preview_resolution(int param1, int param2, void *user_data)
369 muse_module_h module = (muse_module_h)user_data;
371 muse_camera_msg_event2(MUSE_CAMERA_CB_EVENT,
372 MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_RESOLUTION,
373 MUSE_CAMERA_EVENT_CLASS_THREAD_SUB,
374 module, "param1", param1, "param2", param2);
379 void _camera_dispatcher_callback_supported_capture_resolution(int param1, int param2, void *user_data)
381 muse_module_h module = (muse_module_h)user_data;
383 muse_camera_msg_event2(MUSE_CAMERA_CB_EVENT,
384 MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_RESOLUTION,
385 MUSE_CAMERA_EVENT_CLASS_THREAD_SUB,
386 module, "param1", param1, "param2", param2);
391 void _camera_dispatcher_callback_supported_ptz_type(int param1, void *user_data)
393 muse_module_h module = (muse_module_h)user_data;
395 muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT,
396 MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PTZ_TYPE,
397 MUSE_CAMERA_EVENT_CLASS_THREAD_SUB,
398 module, "param1", param1);
403 static int _camera_remove_export_data(muse_module_h module, int key, int remove_all)
405 muse_camera_handle_s *muse_camera = NULL;
406 GList *tmp_list = NULL;
407 muse_camera_export_data *export_data = NULL;
409 if (module == NULL || (key <= 0 && remove_all == FALSE)) {
410 LOGE("invalid parameter %p, %d", module, key);
414 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
415 if (muse_camera == NULL) {
420 g_mutex_lock(&muse_camera->list_lock);
422 tmp_list = muse_camera->data_list;
425 export_data = (muse_camera_export_data *)tmp_list->data;
427 if (export_data->key == key || remove_all) {
428 /*LOGD("key %d matched, remove it (remove_all %d)", key, remove_all);*/
430 if (export_data->is_capture) {
431 LOGD("capture callback is done");
432 g_cond_signal(&muse_camera->list_cond);
435 if (export_data->bo) {
436 tbm_bo_unref(export_data->bo);
437 export_data->bo = NULL;
439 LOGW("bo for key %d is NULL", key);
441 export_data->key = 0;
442 if (export_data->internal_buffer) {
443 gst_buffer_unref((GstBuffer *)export_data->internal_buffer);
444 export_data->internal_buffer = NULL;
447 if (export_data->data_bo) {
448 tbm_bo_unref(export_data->data_bo);
449 export_data->data_bo = NULL;
452 muse_camera->data_list = g_list_remove(muse_camera->data_list, export_data);
457 if (remove_all == FALSE) {
458 /*LOGD("key %d, remove done");*/
459 g_mutex_unlock(&muse_camera->list_lock);
462 LOGD("check next data");
469 tmp_list = tmp_list->next;
472 g_mutex_unlock(&muse_camera->list_lock);
475 LOGD("remove all done");
477 LOGE("should not be reached here - key %d", key);
484 void _camera_dispatcher_capturing_cb(camera_image_data_s* image, camera_image_data_s* postview, camera_image_data_s* thumbnail, void *user_data)
486 muse_camera_handle_s *muse_camera = NULL;
487 int data_size_main = 0;
488 int data_size_post = 0;
489 int data_size_thumb = 0;
490 tbm_bo bo_main = NULL;
491 tbm_bo bo_post = NULL;
492 tbm_bo bo_thumb = NULL;
493 tbm_bo_handle bo_main_handle = {.ptr = NULL};
494 tbm_bo_handle bo_post_handle = {.ptr = NULL};
495 tbm_bo_handle bo_thumb_handle = {.ptr = NULL};
496 muse_camera_export_data *export_data_main = NULL;
497 muse_camera_export_data *export_data_post = NULL;
498 muse_camera_export_data *export_data_thumb = NULL;
499 int tbm_key_main = 0;
500 int tbm_key_post = 0;
501 int tbm_key_thumb = 0;
502 muse_module_h module = (muse_module_h)user_data;
503 unsigned char *buf_pos = NULL;
508 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
509 if (!muse_camera || !image) {
510 LOGE("invalid ptr %p %p", muse_camera, image);
515 export_data_main = g_new0(muse_camera_export_data, 1);
516 if (export_data_main == NULL) {
517 LOGE("alloc export_data failed");
521 data_size_main = sizeof(camera_image_data_s) + image->size;
522 if (image->exif && image->exif_size > 0)
523 data_size_main += image->exif_size;
526 bo_main = tbm_bo_alloc(muse_camera->bufmgr, data_size_main, TBM_BO_DEFAULT);
527 if (bo_main == NULL) {
528 LOGE("bo alloc failed");
529 goto main_image_error;
532 bo_main_handle = tbm_bo_map(bo_main, TBM_DEVICE_CPU, TBM_OPTION_READ | TBM_OPTION_WRITE);
533 if (bo_main_handle.ptr == NULL) {
534 LOGE("bo map Error!");
535 goto main_image_error;
538 buf_pos = (unsigned char *)bo_main_handle.ptr;
539 memcpy(buf_pos, image, sizeof(camera_image_data_s));
540 buf_pos += sizeof(camera_image_data_s);
541 memcpy(buf_pos, image->data, image->size);
542 if (image->exif && image->exif_size > 0) {
543 buf_pos += image->size;
544 memcpy(buf_pos, image->exif, image->exif_size);
547 tbm_bo_unmap(bo_main);
549 tbm_key_main = tbm_bo_export(bo_main);
550 if (tbm_key_main == 0) {
551 LOGE("Create key_info ERROR!!");
552 goto main_image_error;
555 LOGD("bo %p, vaddr %p, size %d, key %d",
556 bo_main, bo_main_handle.ptr, data_size_main, tbm_key_main);
559 export_data_main->key = tbm_key_main;
560 export_data_main->bo = bo_main;
561 export_data_main->is_capture = true;
564 if (postview && postview->size > 0) {
565 data_size_post = sizeof(camera_image_data_s) + postview->size;
567 export_data_post = g_new0(muse_camera_export_data, 1);
568 if (export_data_post == NULL) {
569 LOGE("alloc export_data failed");
570 goto postview_image_error;
574 bo_post = tbm_bo_alloc(muse_camera->bufmgr, data_size_post, TBM_BO_DEFAULT);
575 if (bo_post == NULL) {
576 LOGE("bo alloc failed");
577 goto postview_image_error;
580 bo_post_handle = tbm_bo_map(bo_post, TBM_DEVICE_CPU, TBM_OPTION_READ | TBM_OPTION_WRITE);
581 if (bo_post_handle.ptr == NULL) {
582 LOGE("bo map Error!");
583 goto postview_image_error;
586 buf_pos = (unsigned char *)bo_post_handle.ptr;
587 memcpy(buf_pos, postview, sizeof(camera_image_data_s));
588 buf_pos += sizeof(camera_image_data_s);
589 memcpy(buf_pos, postview->data, postview->size);
590 tbm_bo_unmap(bo_post);
592 tbm_key_post = tbm_bo_export(bo_post);
593 if (tbm_key_post == 0) {
594 LOGE("Create key_info ERROR!!");
595 goto postview_image_error;
599 export_data_post->key = tbm_key_post;
600 export_data_post->bo = bo_post;
603 /* thumbnail image */
604 if (thumbnail && thumbnail->size > 0) {
605 data_size_thumb = sizeof(camera_image_data_s) + thumbnail->size;
607 export_data_thumb = g_new0(muse_camera_export_data, 1);
608 if (export_data_thumb == NULL) {
609 LOGE("alloc export_data failed");
610 goto thumbnail_image_error;
614 bo_thumb = tbm_bo_alloc(muse_camera->bufmgr, data_size_thumb, TBM_BO_DEFAULT);
615 if (bo_thumb == NULL) {
616 LOGE("bo alloc failed");
617 goto thumbnail_image_error;
620 bo_thumb_handle = tbm_bo_map(bo_thumb, TBM_DEVICE_CPU, TBM_OPTION_READ | TBM_OPTION_WRITE);
621 if (bo_thumb_handle.ptr == NULL) {
622 LOGE("bo map Error!");
623 goto thumbnail_image_error;
626 buf_pos = (unsigned char *)bo_thumb_handle.ptr;
627 memcpy(buf_pos, thumbnail, sizeof(camera_image_data_s));
628 buf_pos += sizeof(camera_image_data_s);
629 memcpy(buf_pos, thumbnail->data, thumbnail->size);
630 tbm_bo_unmap(bo_thumb);
632 tbm_key_thumb = tbm_bo_export(bo_thumb);
633 if (tbm_key_thumb == 0) {
634 LOGE("Create key_info ERROR!!");
635 goto thumbnail_image_error;
639 export_data_thumb->key = tbm_key_thumb;
640 export_data_thumb->bo = bo_thumb;
643 /* add bo info to list */
644 g_mutex_lock(&muse_camera->list_lock);
646 muse_camera->data_list = g_list_append(muse_camera->data_list, (gpointer)export_data_main);
648 if (export_data_post)
649 muse_camera->data_list = g_list_append(muse_camera->data_list, (gpointer)export_data_post);
651 if (export_data_thumb)
652 muse_camera->data_list = g_list_append(muse_camera->data_list, (gpointer)export_data_thumb);
655 muse_camera_msg_event3(MUSE_CAMERA_CB_EVENT,
656 MUSE_CAMERA_EVENT_TYPE_CAPTURE,
657 MUSE_CAMERA_EVENT_CLASS_THREAD_SUB,
658 module, "tbm_key_main", tbm_key_main, "tbm_key_post", tbm_key_post, "tbm_key_thumb", tbm_key_thumb);
660 /* wait for capture callback return */
661 end_time = g_get_monotonic_time() + G_TIME_SPAN_SECOND * 3;
662 if (!g_cond_wait_until(&muse_camera->list_cond, &muse_camera->list_lock, end_time)) {
663 LOGW("capture callback return timeout");
665 LOGD("capture callback return");
668 g_mutex_unlock(&muse_camera->list_lock);
672 thumbnail_image_error:
674 tbm_bo_unref(bo_thumb);
678 if (export_data_thumb) {
679 g_free(export_data_thumb);
680 export_data_thumb = NULL;
683 postview_image_error:
685 tbm_bo_unref(bo_post);
689 if (export_data_post) {
690 g_free(export_data_post);
691 export_data_post = NULL;
696 tbm_bo_unref(bo_main);
700 if (export_data_main) {
701 g_free(export_data_main);
702 export_data_main = NULL;
708 void _camera_dispatcher_state_changed_cb(camera_state_e previous, camera_state_e current, bool by_policy, void *user_data)
710 muse_module_h module = (muse_module_h)user_data;
711 muse_camera_handle_s *muse_camera = NULL;
712 camera_device_e device_type = CAMERA_DEVICE_CAMERA0;
713 char value_key[KEY_LENGTH] = {'\0',};
714 int ret = CAMERA_ERROR_NONE;
717 LOGD("Enter - previous %d, current %d, by_policy %d",
718 previous, current, by_policy);
720 muse_camera_msg_event3(MUSE_CAMERA_CB_EVENT,
721 MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE,
722 MUSE_CAMERA_EVENT_CLASS_THREAD_MAIN,
723 module, "previous", previous, "current", current, "by_policy", by_policy);
725 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
727 LOGW("NULL muse camera handle");
731 ret = legacy_camera_get_device_type(muse_camera->camera_handle, &device_type);
732 if (ret != CAMERA_ERROR_NONE) {
733 LOGE("get device type failed 0x%x", ret);
737 snprintf(value_key, KEY_LENGTH, "device_state_camera%d", device_type);
738 if (previous == CAMERA_STATE_CREATED && current == CAMERA_STATE_PREVIEW)
739 set_value = CAMERA_DEVICE_STATE_WORKING;
740 else if (previous == CAMERA_STATE_PREVIEW && current == CAMERA_STATE_CREATED)
741 set_value = CAMERA_DEVICE_STATE_NULL;
743 if (set_value != -1) {
744 LOGD("device[%s] state set : %d", value_key, set_value);
745 muse_core_client_set_value(module, value_key, set_value);
751 void _camera_dispatcher_interrupted_cb(camera_policy_e policy, camera_state_e previous, camera_state_e current, void *user_data)
753 muse_module_h module = (muse_module_h)user_data;
755 LOGD("Enter - policy %d, state previous %d, current %d", policy, previous, current);
757 muse_camera_msg_event3(MUSE_CAMERA_CB_EVENT,
758 MUSE_CAMERA_EVENT_TYPE_INTERRUPTED,
759 MUSE_CAMERA_EVENT_CLASS_THREAD_MAIN,
760 module, "policy", policy, "previous", previous, "current", current);
765 void _camera_dispatcher_preview_cb(MMCamcorderVideoStreamDataType *stream, void *user_data)
767 muse_camera_handle_s *muse_camera = NULL;
770 tbm_bo data_bo = NULL;
771 tbm_bo_handle bo_handle = {.ptr = NULL};
772 tbm_bo_handle data_bo_handle = {.ptr = NULL};
773 muse_camera_export_data *export_data = NULL;
777 int buffer_key[BUFFER_MAX_PLANE_NUM] = {0, };
778 int num_buffer_key = 0;
779 muse_module_h module = (muse_module_h)user_data;
780 unsigned char *buf_pos = NULL;
781 char *send_message = NULL;
785 if (module == NULL || stream == NULL) {
786 LOGE("NULL data %p, %p", module, stream);
790 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
791 if (muse_camera == NULL) {
796 export_data = g_new0(muse_camera_export_data, 1);
797 if (export_data == NULL) {
798 LOGE("alloc export_data failed");
802 data_size = sizeof(MMCamcorderVideoStreamDataType);
804 bo = tbm_bo_alloc(muse_camera->bufmgr, data_size, TBM_BO_DEFAULT);
806 LOGE("bo alloc failed");
807 goto _PREVIEW_CB_ERROR;
810 bo_handle = tbm_bo_map(bo, TBM_DEVICE_CPU, TBM_OPTION_READ | TBM_OPTION_WRITE);
811 if (bo_handle.ptr == NULL) {
812 LOGE("bo map Error!");
813 goto _PREVIEW_CB_ERROR;
816 buf_pos = (unsigned char *)bo_handle.ptr;
818 memcpy(buf_pos, stream, sizeof(MMCamcorderVideoStreamDataType));
822 if (stream->bo[0] == NULL) {
824 switch (stream->data_type) {
825 case MM_CAM_STREAM_DATA_YUV420:
826 data_size = stream->data.yuv420.length_yuv;
828 case MM_CAM_STREAM_DATA_YUV422:
829 data_size = stream->data.yuv422.length_yuv;
831 case MM_CAM_STREAM_DATA_YUV420SP:
832 data_size = stream->data.yuv420sp.length_y;
833 data_size += stream->data.yuv420sp.length_uv;
835 case MM_CAM_STREAM_DATA_YUV420P:
836 data_size = stream->data.yuv420p.length_y;
837 data_size += stream->data.yuv420p.length_u;
838 data_size += stream->data.yuv420p.length_v;
840 case MM_CAM_STREAM_DATA_YUV422P:
841 data_size = stream->data.yuv422p.length_y;
842 data_size += stream->data.yuv422p.length_u;
843 data_size += stream->data.yuv422p.length_v;
845 case MM_CAM_STREAM_DATA_ENCODED:
846 data_size = stream->data.encoded.length_data;
849 LOGW("unknown data type %d", stream->data_type);
853 data_bo = tbm_bo_alloc(muse_camera->bufmgr, data_size, TBM_BO_DEFAULT);
854 if (data_bo == NULL) {
855 LOGE("data_bo alloc failed");
856 goto _PREVIEW_CB_ERROR;
859 data_bo_handle = tbm_bo_map(data_bo, TBM_DEVICE_CPU, TBM_OPTION_READ | TBM_OPTION_WRITE);
860 if (data_bo_handle.ptr == NULL) {
861 LOGE("data_bo map Error!");
862 goto _PREVIEW_CB_ERROR;
865 buf_pos = (unsigned char *)data_bo_handle.ptr;
867 switch (stream->data_type) {
868 case MM_CAM_STREAM_DATA_YUV420:
869 memcpy(buf_pos, stream->data.yuv420.yuv, stream->data.yuv420.length_yuv);
871 case MM_CAM_STREAM_DATA_YUV422:
872 memcpy(buf_pos, stream->data.yuv422.yuv, stream->data.yuv422.length_yuv);
874 case MM_CAM_STREAM_DATA_YUV420SP:
875 memcpy(buf_pos, stream->data.yuv420sp.y, stream->data.yuv420sp.length_y);
876 memcpy(buf_pos + stream->data.yuv420sp.length_y, stream->data.yuv420sp.uv, stream->data.yuv420sp.length_uv);
878 case MM_CAM_STREAM_DATA_YUV420P:
879 memcpy(buf_pos, stream->data.yuv420p.y, stream->data.yuv420p.length_y);
880 memcpy(buf_pos + stream->data.yuv420p.length_y, stream->data.yuv420p.u, stream->data.yuv420p.length_u);
881 memcpy(buf_pos + stream->data.yuv420p.length_y + stream->data.yuv420p.length_u, stream->data.yuv420p.v, stream->data.yuv420p.length_v);
883 case MM_CAM_STREAM_DATA_YUV422P:
884 memcpy(buf_pos, stream->data.yuv422p.y, stream->data.yuv422p.length_y);
885 memcpy(buf_pos + stream->data.yuv422p.length_y, stream->data.yuv422p.u, stream->data.yuv422p.length_u);
886 memcpy(buf_pos + stream->data.yuv422p.length_y + stream->data.yuv422p.length_u, stream->data.yuv422p.v, stream->data.yuv422p.length_v);
888 case MM_CAM_STREAM_DATA_ENCODED:
889 memcpy(buf_pos, stream->data.encoded.data, stream->data.encoded.length_data);
895 tbm_bo_unmap(data_bo);
898 for (i = 0 ; i < BUFFER_MAX_PLANE_NUM ; i++) {
900 buffer_key[i] = tbm_bo_export(stream->bo[i]);
901 if (buffer_key[i] == 0) {
902 LOGE("failed to export bo %p", stream->bo[i]);
903 goto _PREVIEW_CB_ERROR;
907 /*LOGD("num_buffer_key %d", num_buffer_key);*/
913 tbm_key = tbm_bo_export(bo);
915 LOGE("Create key_info ERROR!!");
916 goto _PREVIEW_CB_ERROR;
920 LOGD("bo %p, vaddr %p, size %d, key %d",
921 bo, bo_handle.ptr, data_size, tbm_key);
925 export_data->key = tbm_key;
926 export_data->bo = bo;
927 if (stream->internal_buffer) {
928 export_data->internal_buffer = stream->internal_buffer;
929 gst_buffer_ref((GstBuffer *)export_data->internal_buffer);
932 export_data->data_bo = data_bo;
933 data_key = tbm_bo_export(data_bo);
935 LOGE("Create key_info for data_bo ERROR!!");
936 goto _PREVIEW_CB_ERROR;
940 /* add bo info to list */
941 g_mutex_lock(&muse_camera->list_lock);
942 muse_camera->data_list = g_list_append(muse_camera->data_list, (gpointer)export_data);
943 g_mutex_unlock(&muse_camera->list_lock);
945 g_mutex_lock(&muse_camera->preview_cb_lock);
948 send_message = muse_core_msg_json_factory_new(MUSE_CAMERA_CB_EVENT,
949 MUSE_TYPE_INT, PARAM_EVENT, MUSE_CAMERA_EVENT_TYPE_PREVIEW,
950 MUSE_TYPE_INT, PARAM_EVENT_CLASS, MUSE_CAMERA_EVENT_CLASS_THREAD_SUB,
951 MUSE_TYPE_INT, "tbm_key", tbm_key,
952 MUSE_TYPE_INT, "num_buffer_key", num_buffer_key,
953 MUSE_TYPE_INT, "data_key", data_key,
954 MUSE_TYPE_ARRAY, "buffer_key", BUFFER_MAX_PLANE_NUM, buffer_key,
957 muse_core_ipc_send_msg(muse_core_client_get_msg_fd(module), send_message);
959 muse_core_msg_json_factory_free(send_message);
961 /*LOGD("wait preview callback return message");*/
963 if (!CHECK_PREVIEW_CB(muse_camera, PREVIEW_CB_TYPE_EVAS)) {
964 gint64 end_time = g_get_monotonic_time() + G_TIME_SPAN_SECOND;
966 if (!g_cond_wait_until(&muse_camera->preview_cb_cond, &muse_camera->preview_cb_lock, end_time)) {
967 LOGW("preview callback return message timeout");
969 /*LOGD("preview callback return message received");*/
973 g_mutex_unlock(&muse_camera->preview_cb_lock);
983 tbm_bo_unref(data_bo);
994 void _camera_dispatcher_capture_completed_cb(void *user_data)
996 muse_module_h module = (muse_module_h)user_data;
1000 muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT,
1001 MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE,
1002 MUSE_CAMERA_EVENT_CLASS_THREAD_MAIN,
1008 void _camera_dispatcher_face_detected_cb(camera_detected_face_s *faces, int count, void *user_data)
1010 muse_module_h module = (muse_module_h)user_data;
1011 muse_camera_handle_s *muse_camera = NULL;
1013 tbm_bo_handle bo_handle = {NULL, };
1014 int bo_size = sizeof(camera_detected_face_s) * count;
1016 muse_camera_export_data *export_data = NULL;
1019 if (module == NULL) {
1020 LOGE("NULL module");
1025 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1026 if (muse_camera == NULL) {
1027 LOGE("NULL handle");
1031 export_data = g_new0(muse_camera_export_data, 1);
1032 if (export_data == NULL) {
1033 LOGE("alloc export_data failed");
1037 bo = tbm_bo_alloc(muse_camera->bufmgr, bo_size, TBM_BO_DEFAULT);
1039 LOGE("tbm_bo_alloc failed");
1041 g_free(export_data);
1047 bo_handle = tbm_bo_map(bo, TBM_DEVICE_CPU, TBM_OPTION_READ | TBM_OPTION_WRITE);
1048 if (bo_handle.ptr == NULL) {
1049 LOGE("bo map Error!");
1054 g_free(export_data);
1060 /* copy face detection info */
1061 memcpy(bo_handle.ptr, faces, bo_size);
1066 tbm_key = tbm_bo_export(bo);
1068 LOGE("failed to export bo for face detection info");
1073 g_free(export_data);
1079 /* set export data */
1080 export_data->bo = bo;
1081 export_data->key = tbm_key;
1083 /* add bo info to list */
1084 g_mutex_lock(&muse_camera->list_lock);
1085 muse_camera->data_list = g_list_append(muse_camera->data_list, (gpointer)export_data);
1086 g_mutex_unlock(&muse_camera->list_lock);
1089 LOGD("face - count %d, buffer size %d, key %d", count, bo_size, tbm_key);
1092 muse_camera_msg_event2(MUSE_CAMERA_CB_EVENT,
1093 MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION,
1094 MUSE_CAMERA_EVENT_CLASS_THREAD_MAIN,
1095 module, "count", count, "tbm_key", tbm_key);
1097 LOGW("invalid count for face detection - %d", count);
1103 void _camera_dispatcher_focus_changed_cb(camera_focus_state_e state, void *user_data)
1105 muse_module_h module = (muse_module_h)user_data;
1107 LOGD("Enter - state %d", state);
1109 muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT,
1110 MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE,
1111 MUSE_CAMERA_EVENT_CLASS_THREAD_MAIN,
1112 module, "state", state);
1117 void _camera_dispatcher_error_cb(camera_error_e error, camera_state_e current_state, void *user_data)
1119 muse_module_h module = (muse_module_h)user_data;
1121 LOGD("Enter - error 0x%x, current_state %d", error, current_state);
1123 muse_camera_msg_event2(MUSE_CAMERA_CB_EVENT,
1124 MUSE_CAMERA_EVENT_TYPE_ERROR,
1125 MUSE_CAMERA_EVENT_CLASS_THREAD_MAIN,
1126 module, "error", error, "current_state", current_state);
1131 void _camera_dispatcher_hdr_progress_cb(int percent, void *user_data)
1133 muse_module_h module = (muse_module_h)user_data;
1137 muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT,
1138 MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS,
1139 MUSE_CAMERA_EVENT_CLASS_THREAD_MAIN,
1140 module, "percent", percent);
1146 static void _camera_task_add_job(muse_camera_handle_s *muse_camera, int api, int class, int value)
1148 muse_camera_task_job_s *job = NULL;
1151 LOGE("NULL handle");
1155 job = g_new0(muse_camera_task_job_s, 1);
1157 LOGE("job alloc failed");
1158 muse_camera_msg_return(api, class, CAMERA_ERROR_INVALID_OPERATION, muse_camera->module);
1166 LOGD("push job - api %d", api);
1168 g_mutex_lock(&muse_camera->task_lock);
1169 g_queue_push_tail(&muse_camera->task_queue, (gpointer)job);
1170 g_cond_signal(&muse_camera->task_cond);
1171 g_mutex_unlock(&muse_camera->task_lock);
1177 static void __camera_task_process_job(muse_camera_handle_s *muse_camera, muse_camera_task_job_s *job)
1179 int ret = CAMERA_ERROR_NONE;
1182 LOGE("NULL handle");
1186 LOGD("job start - api %d, value 0x%x", job->api, job->value);
1189 case MUSE_CAMERA_API_STOP_PREVIEW:
1190 ret = legacy_camera_stop_preview(muse_camera->camera_handle);
1192 case MUSE_CAMERA_API_START_CAPTURE:
1193 ret = legacy_camera_start_capture(muse_camera->camera_handle,
1194 (camera_capturing_cb)_camera_dispatcher_capturing_cb,
1195 (camera_capture_completed_cb)_camera_dispatcher_capture_completed_cb,
1196 (void *)muse_camera->module);
1198 case MUSE_CAMERA_API_SET_PREVIEW_RESOLUTION:
1199 ret = legacy_camera_set_preview_resolution(muse_camera->camera_handle, \
1200 job->value >> 16, 0x0000ffff & job->value);
1202 case MUSE_CAMERA_API_SET_CAPTURE_RESOLUTION:
1203 ret = legacy_camera_set_capture_resolution(muse_camera->camera_handle, \
1204 job->value >> 16, 0x0000ffff & job->value);
1206 case MUSE_CAMERA_API_ATTR_SET_HDR_MODE:
1207 ret = legacy_camera_attr_set_hdr_mode(muse_camera->camera_handle, \
1208 (camera_attr_hdr_mode_e)job->value);
1211 LOGE("unhandled task - api %d", job->api);
1215 LOGD("job done - api %d, ret 0x%x", job->api, ret);
1217 muse_camera_msg_return(job->api, job->class, ret, muse_camera->module);
1227 static void *_camera_dispatcher_task_func(gpointer data)
1229 muse_camera_handle_s *muse_camera = (muse_camera_handle_s *)data;
1230 muse_camera_task_job_s *job = NULL;
1231 gint64 end_time = 0;
1232 bool is_signaled = false;
1233 bool use_wait_until = false;
1236 LOGE("NULL handle");
1242 g_mutex_lock(&muse_camera->task_lock);
1244 while (muse_camera->task_run) {
1245 if (g_queue_is_empty(&muse_camera->task_queue)) {
1246 LOGD("empty queue. wait signal [wait until %d]", use_wait_until);
1248 if (use_wait_until) {
1249 end_time = g_get_monotonic_time() + G_TIME_SPAN_SECOND;
1250 is_signaled = g_cond_wait_until(&muse_camera->task_cond, &muse_camera->task_lock, end_time);
1252 g_cond_wait(&muse_camera->task_cond, &muse_camera->task_lock);
1256 /*LOGD("is_signaled %d", is_signaled);*/
1259 if (!muse_camera->task_run) {
1260 LOGW("stop task thread : is_signaled %d", is_signaled);
1264 job = (muse_camera_task_job_s *)g_queue_pop_head(&muse_camera->task_queue);
1267 LOGE("signal received, but no job");
1272 if (job->api == MUSE_CAMERA_API_STOP_PREVIEW)
1273 use_wait_until = true;
1275 use_wait_until = false;
1277 g_mutex_unlock(&muse_camera->task_lock);
1279 __camera_task_process_job(muse_camera, job);
1281 g_mutex_lock(&muse_camera->task_lock);
1284 while (!g_queue_is_empty(&muse_camera->task_queue)) {
1285 job = (muse_camera_task_job_s *)g_queue_pop_head(&muse_camera->task_queue);
1287 LOGW("remained job - api %d", job->api);
1288 __camera_task_process_job(muse_camera, job);
1292 g_mutex_unlock(&muse_camera->task_lock);
1300 int camera_dispatcher_create(muse_module_h module)
1302 int ret = CAMERA_ERROR_NONE;
1306 void *gdbus_connection = NULL;
1307 muse_camera_handle_s *muse_camera = NULL;
1308 muse_camera_api_e api = MUSE_CAMERA_API_CREATE;
1309 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1311 muse_camera_msg_get(device_type, muse_core_client_get_msg(module));
1312 muse_camera_msg_get(pid, muse_core_client_get_msg(module));
1314 LOGD("device type : %d, client pid : %d", device_type, pid);
1316 /* privilege check */
1317 client_fd = muse_core_client_get_msg_fd(module);
1318 if (!muse_core_security_check_cynara(client_fd, CAMERA_PRIVILEGE_NAME)) {
1319 ret = CAMERA_ERROR_PERMISSION_DENIED;
1320 LOGE("security check failed 0x%x", ret);
1321 muse_camera_msg_return(api, class, ret, module);
1322 return MUSE_CAMERA_ERROR_NONE;
1326 muse_camera = (muse_camera_handle_s *)malloc(sizeof(muse_camera_handle_s));
1327 if (muse_camera == NULL) {
1328 ret = CAMERA_ERROR_OUT_OF_MEMORY;
1329 LOGE("handle alloc failed 0x%x", ret);
1330 muse_camera_msg_return(api, class, ret, module);
1331 return MUSE_CAMERA_ERROR_NONE;
1334 memset(muse_camera, 0x0, sizeof(muse_camera_handle_s));
1336 if (muse_core_ipc_get_bufmgr(&muse_camera->bufmgr) != MM_ERROR_NONE ||
1337 muse_core_ipc_get_gdbus_connection((GDBusConnection **)&gdbus_connection) != MM_ERROR_NONE) {
1338 LOGE("tbm bufmgr or gdbus conntection failed %p %p", muse_camera->bufmgr, gdbus_connection);
1343 ret = CAMERA_ERROR_INVALID_OPERATION;
1344 muse_camera_msg_return(api, class, ret, module);
1346 return MUSE_CAMERA_ERROR_NONE;
1349 ret = legacy_camera_create((camera_device_e)device_type, &muse_camera->camera_handle);
1350 if (ret != CAMERA_ERROR_NONE) {
1353 muse_camera_msg_return(api, class, ret, module);
1355 return MUSE_CAMERA_ERROR_NONE;
1358 g_mutex_init(&muse_camera->task_lock);
1359 g_cond_init(&muse_camera->task_cond);
1360 g_queue_init(&muse_camera->task_queue);
1362 muse_camera->task_run = true;
1363 muse_camera->task_thread = g_thread_try_new("camera_task_thread",
1364 _camera_dispatcher_task_func, (gpointer)muse_camera, NULL);
1365 if (!muse_camera->task_thread) {
1366 LOGE("failed to create new thread for task");
1370 ret = legacy_camera_set_state_changed_cb(muse_camera->camera_handle,
1371 (camera_state_changed_cb)_camera_dispatcher_state_changed_cb,
1373 if (ret != CAMERA_ERROR_NONE) {
1374 LOGE("legacy_camera_set_state_changed_cb failed : 0x%x", ret);
1378 ret = legacy_camera_set_client_pid(muse_camera->camera_handle, pid);
1379 if (ret != CAMERA_ERROR_NONE) {
1380 LOGE("legacy_camera_set_client_pid failed : 0x%x", ret);
1384 ret = legacy_camera_set_gdbus_connection(muse_camera->camera_handle, gdbus_connection);
1385 if (ret != CAMERA_ERROR_NONE) {
1386 LOGE("legacy_camera_set_gdbus_connection failed : 0x%x", ret);
1390 g_mutex_init(&muse_camera->list_lock);
1391 g_cond_init(&muse_camera->list_cond);
1392 g_mutex_init(&muse_camera->preview_cb_lock);
1393 g_cond_init(&muse_camera->preview_cb_cond);
1394 muse_camera->preview_cb_flag = 0;
1395 muse_camera->module = module;
1397 LOGD("handle : 0x%x", muse_camera);
1399 muse_core_ipc_set_handle(module, (intptr_t)muse_camera);
1400 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_POINTER, -1, "handle", 0, muse_camera);
1402 return MUSE_CAMERA_ERROR_NONE;
1405 if (muse_camera->task_thread) {
1406 g_mutex_lock(&muse_camera->task_lock);
1407 muse_camera->task_run = false;
1408 g_cond_signal(&muse_camera->task_cond);
1409 g_mutex_unlock(&muse_camera->task_lock);
1411 LOGE("task thread join");
1413 g_thread_join(muse_camera->task_thread);
1414 muse_camera->task_thread = NULL;
1417 g_mutex_clear(&muse_camera->task_lock);
1418 g_cond_clear(&muse_camera->task_cond);
1419 g_queue_clear(&muse_camera->task_queue);
1421 legacy_camera_destroy(muse_camera->camera_handle);
1422 muse_camera->camera_handle = NULL;
1426 muse_camera_msg_return(api, class, ret, module);
1428 return MUSE_CAMERA_ERROR_NONE;
1432 int camera_dispatcher_change_device(muse_module_h module)
1434 int ret = CAMERA_ERROR_NONE;
1435 int device = CAMERA_DEVICE_CAMERA0;
1436 muse_camera_handle_s *muse_camera = NULL;
1437 muse_camera_api_e api = MUSE_CAMERA_API_CHANGE_DEVICE;
1438 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1440 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1442 muse_camera_msg_get(device, muse_core_client_get_msg(module));
1444 LOGD("change device to %d", device);
1446 ret = legacy_camera_change_device(&muse_camera->camera_handle, device,
1447 CHECK_PREVIEW_CB(muse_camera, PREVIEW_CB_TYPE_EVAS));
1449 muse_camera_msg_return(api, class, ret, module);
1451 return MUSE_CAMERA_ERROR_NONE;
1455 int camera_dispatcher_destroy(muse_module_h module)
1457 int ret = CAMERA_ERROR_NONE;
1458 muse_camera_handle_s *muse_camera = NULL;
1459 muse_camera_api_e api = MUSE_CAMERA_API_DESTROY;
1460 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1462 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1464 LOGD("Enter, handle : %p", muse_camera);
1466 ret = legacy_camera_destroy(muse_camera->camera_handle);
1467 if (ret == CAMERA_ERROR_NONE) {
1468 _camera_remove_export_data(module, 0, TRUE);
1470 g_mutex_clear(&muse_camera->list_lock);
1471 g_cond_clear(&muse_camera->list_cond);
1472 g_mutex_clear(&muse_camera->preview_cb_lock);
1473 g_cond_clear(&muse_camera->preview_cb_cond);
1475 muse_camera->bufmgr = NULL;
1477 if (muse_camera->task_thread) {
1478 g_mutex_lock(&muse_camera->task_lock);
1479 muse_camera->task_run = false;
1480 g_cond_signal(&muse_camera->task_cond);
1481 g_mutex_unlock(&muse_camera->task_lock);
1483 LOGE("task thread join");
1485 g_thread_join(muse_camera->task_thread);
1486 muse_camera->task_thread = NULL;
1489 g_mutex_clear(&muse_camera->task_lock);
1490 g_cond_clear(&muse_camera->task_cond);
1491 g_queue_clear(&muse_camera->task_queue);
1497 muse_camera_msg_return(api, class, ret, module);
1499 return MUSE_CAMERA_ERROR_NONE;
1502 int camera_dispatcher_start_preview(muse_module_h module)
1504 int ret = CAMERA_ERROR_NONE;
1505 muse_camera_handle_s *muse_camera = NULL;
1506 muse_camera_api_e api = MUSE_CAMERA_API_START_PREVIEW;
1507 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1509 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1511 LOGD("handle : %p", muse_camera);
1513 ret = legacy_camera_start_preview(muse_camera->camera_handle);
1515 muse_camera_msg_return(api, class, ret, module);
1517 return MUSE_CAMERA_ERROR_NONE;
1520 int camera_dispatcher_stop_preview(muse_module_h module)
1522 muse_camera_handle_s *muse_camera = NULL;
1524 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1526 LOGD("handle : %p", muse_camera);
1528 _camera_task_add_job(muse_camera, MUSE_CAMERA_API_STOP_PREVIEW,
1529 MUSE_CAMERA_API_CLASS_IMMEDIATE, 0);
1531 return MUSE_CAMERA_ERROR_NONE;
1534 int camera_dispatcher_start_capture(muse_module_h module)
1536 muse_camera_handle_s *muse_camera = NULL;
1538 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1540 LOGD("handle : %p", muse_camera);
1542 _camera_task_add_job(muse_camera, MUSE_CAMERA_API_START_CAPTURE,
1543 MUSE_CAMERA_API_CLASS_IMMEDIATE, 0);
1545 return MUSE_CAMERA_ERROR_NONE;
1548 int camera_dispatcher_is_supported_continuous_capture(muse_module_h module)
1550 int ret = CAMERA_ERROR_NONE;
1551 muse_camera_handle_s *muse_camera = NULL;
1552 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_CONTINUOUS_CAPTURE;
1553 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1555 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1557 LOGD("handle : %p", muse_camera);
1559 ret = legacy_camera_is_supported_continuous_capture(muse_camera->camera_handle);
1561 LOGD("is supported ret : %d", ret);
1563 muse_camera_msg_return(api, class, ret, module);
1565 return MUSE_CAMERA_ERROR_NONE;
1568 int camera_dispatcher_start_continuous_capture(muse_module_h module)
1570 int ret = CAMERA_ERROR_NONE;
1571 muse_camera_handle_s *muse_camera = NULL;
1575 muse_camera_api_e api = MUSE_CAMERA_API_START_CONTINUOUS_CAPTURE;
1576 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1578 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1580 muse_camera_msg_get(value, muse_core_client_get_msg(module));
1582 count = value >> 16;
1583 interval = 0x0000ffff & value;
1585 LOGD("Enter - count %d, interval %d", count, interval);
1587 ret = legacy_camera_start_continuous_capture(muse_camera->camera_handle,
1590 (camera_capturing_cb)_camera_dispatcher_capturing_cb,
1591 (camera_capture_completed_cb)_camera_dispatcher_capture_completed_cb,
1594 muse_camera_msg_return(api, class, ret, module);
1596 return MUSE_CAMERA_ERROR_NONE;
1599 int camera_dispatcher_stop_continuous_capture(muse_module_h module)
1601 int ret = CAMERA_ERROR_NONE;
1602 muse_camera_handle_s *muse_camera = NULL;
1603 muse_camera_api_e api = MUSE_CAMERA_API_STOP_CONTINUOUS_CAPTURE;
1604 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1606 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1608 LOGD("handle : %p", muse_camera);
1610 ret = legacy_camera_stop_continuous_capture(muse_camera->camera_handle);
1612 muse_camera_msg_return(api, class, ret, module);
1614 return MUSE_CAMERA_ERROR_NONE;
1617 int camera_dispatcher_is_supported_face_detection(muse_module_h module)
1619 int ret = CAMERA_ERROR_NONE;
1620 muse_camera_handle_s *muse_camera = NULL;
1621 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_FACE_DETECTION;
1622 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1624 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1626 LOGD("handle : %p", muse_camera);
1628 ret = legacy_camera_is_supported_face_detection(muse_camera->camera_handle);
1630 LOGD("is supported ret : %d", ret);
1632 muse_camera_msg_return(api, class, ret, module);
1634 return MUSE_CAMERA_ERROR_NONE;
1637 int camera_dispatcher_is_supported_zero_shutter_lag(muse_module_h module)
1639 int ret = CAMERA_ERROR_NONE;
1640 muse_camera_handle_s *muse_camera = NULL;
1641 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_ZERO_SHUTTER_LAG;
1642 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1644 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1646 LOGD("handle : %p", muse_camera);
1648 ret = legacy_camera_is_supported_zero_shutter_lag(muse_camera->camera_handle);
1650 LOGD("is supported ret : %d", ret);
1652 muse_camera_msg_return(api, class, ret, module);
1654 return MUSE_CAMERA_ERROR_NONE;
1657 int camera_dispatcher_is_supported_media_packet_preview_cb(muse_module_h module)
1659 int ret = CAMERA_ERROR_NONE;
1660 muse_camera_handle_s *muse_camera = NULL;
1661 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_MEDIA_PACKET_PREVIEW_CB;
1662 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1664 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1666 LOGD("handle : %p", muse_camera);
1668 ret = legacy_camera_is_supported_media_packet_preview_cb(muse_camera->camera_handle);
1670 LOGD("is supported ret : %d", ret);
1672 muse_camera_msg_return(api, class, ret, module);
1674 return MUSE_CAMERA_ERROR_NONE;
1677 int camera_dispatcher_get_device_count(muse_module_h module)
1679 int ret = CAMERA_ERROR_NONE;
1680 muse_camera_handle_s *muse_camera = NULL;
1682 muse_camera_api_e api = MUSE_CAMERA_API_GET_DEVICE_COUNT;
1683 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1685 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1687 LOGD("handle : %p", muse_camera);
1689 ret = legacy_camera_get_device_count(muse_camera->camera_handle, &get_value);
1690 if (ret == CAMERA_ERROR_NONE) {
1691 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
1692 MUSE_CAMERA_GET_INT_DEVICE_COUNT, "get_value", get_value, NULL);
1694 muse_camera_msg_return(api, class, ret, module);
1697 return MUSE_CAMERA_ERROR_NONE;
1700 int camera_dispatcher_start_face_detection(muse_module_h module)
1702 int ret = CAMERA_ERROR_NONE;
1703 muse_camera_handle_s *muse_camera = NULL;
1704 muse_camera_api_e api = MUSE_CAMERA_API_START_FACE_DETECTION;
1705 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1707 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1709 LOGD("Enter, handle : 0x%x, module : %d", muse_camera, module);
1711 ret = legacy_camera_start_face_detection(muse_camera->camera_handle,
1712 (camera_face_detected_cb)_camera_dispatcher_face_detected_cb,
1715 muse_camera_msg_return(api, class, ret, module);
1717 return MUSE_CAMERA_ERROR_NONE;
1720 int camera_dispatcher_stop_face_detection(muse_module_h module)
1722 int ret = CAMERA_ERROR_NONE;
1723 muse_camera_handle_s *muse_camera = NULL;
1724 muse_camera_api_e api = MUSE_CAMERA_API_STOP_FACE_DETECTION;
1725 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1727 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1729 LOGD("handle : %p", muse_camera);
1731 ret = legacy_camera_stop_face_detection(muse_camera->camera_handle);
1733 muse_camera_msg_return(api, class, ret, module);
1735 return MUSE_CAMERA_ERROR_NONE;
1738 int camera_dispatcher_get_state(muse_module_h module)
1740 int ret = CAMERA_ERROR_NONE;
1741 muse_camera_handle_s *muse_camera = NULL;
1742 camera_state_e get_value = CAMERA_STATE_NONE;
1743 muse_camera_api_e api = MUSE_CAMERA_API_GET_STATE;
1744 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1746 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1748 LOGD("handle : %p", muse_camera);
1750 ret = legacy_camera_get_state(muse_camera->camera_handle, &get_value);
1751 if (ret == CAMERA_ERROR_NONE) {
1752 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
1753 MUSE_CAMERA_GET_INT_STATE, "get_value", get_value, NULL);
1755 muse_camera_msg_return(api, class, ret, module);
1758 return MUSE_CAMERA_ERROR_NONE;
1761 int camera_dispatcher_start_focusing(muse_module_h module)
1763 int ret = CAMERA_ERROR_NONE;
1764 muse_camera_handle_s *muse_camera = NULL;
1766 muse_camera_api_e api = MUSE_CAMERA_API_START_FOCUSING;
1767 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1769 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1771 muse_camera_msg_get(is_continuous, muse_core_client_get_msg(module));
1773 LOGD("Enter, handle : 0x%x, module : %d", muse_camera, module);
1775 ret = legacy_camera_start_focusing(muse_camera->camera_handle, (bool)is_continuous);
1777 muse_camera_msg_return(api, class, ret, module);
1779 return MUSE_CAMERA_ERROR_NONE;
1782 int camera_dispatcher_stop_focusing(muse_module_h module)
1784 int ret = CAMERA_ERROR_NONE;
1785 muse_camera_handle_s *muse_camera = NULL;
1786 muse_camera_api_e api = MUSE_CAMERA_API_CANCEL_FOCUSING;
1787 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1789 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1791 LOGD("handle : %p", muse_camera);
1793 ret = legacy_camera_cancel_focusing(muse_camera->camera_handle);
1795 muse_camera_msg_return(api, class, ret, module);
1797 return MUSE_CAMERA_ERROR_NONE;
1800 int camera_dispatcher_set_display(muse_module_h module)
1802 int ret = CAMERA_ERROR_NONE;
1803 muse_camera_handle_s *muse_camera = NULL;
1804 muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY;
1805 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1806 MMCamWaylandInfo *wl_info = NULL;
1807 camera_display_type_e type = CAMERA_DISPLAY_TYPE_NONE;
1808 camera_h camera = NULL;;
1810 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1812 LOGD("handle : 0x%x", muse_camera);
1814 camera = muse_camera->camera_handle;
1816 muse_camera_msg_get(type, muse_core_client_get_msg(module));
1818 LOGD("type %d", type);
1820 if (type == CAMERA_DISPLAY_TYPE_OVERLAY) {
1821 wl_info = &muse_camera->wl_info;
1822 muse_camera_msg_get_array(wl_info, muse_core_client_get_msg(module));
1824 LOGD("wayland global surface id : %d, window : %d,%d,%dx%d",
1825 wl_info->global_surface_id, wl_info->window_x, wl_info->window_y,
1826 wl_info->window_width, wl_info->window_height);
1828 ret = legacy_camera_set_display(muse_camera->camera_handle, type, (void *)wl_info);
1830 muse_camera_msg_return(api, class, ret, module);
1832 LOGD("NOT overlay type. set NONE type.");
1834 if (type == CAMERA_DISPLAY_TYPE_EVAS) {
1835 ret = legacy_camera_set_preview_cb(muse_camera->camera_handle,
1836 (camera_preview_cb)_camera_dispatcher_preview_cb,
1839 if (ret == CAMERA_ERROR_NONE)
1840 SET_PREVIEW_CB_TYPE(muse_camera, PREVIEW_CB_TYPE_EVAS);
1843 ret = legacy_camera_set_display(muse_camera->camera_handle, CAMERA_DISPLAY_TYPE_NONE, NULL);
1845 muse_camera_msg_return(api, class, ret, module);
1848 return MUSE_CAMERA_ERROR_NONE;
1851 int camera_dispatcher_set_preview_resolution(muse_module_h module)
1854 muse_camera_handle_s *muse_camera = NULL;
1856 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1858 muse_camera_msg_get(value, muse_core_client_get_msg(module));
1860 _camera_task_add_job(muse_camera, MUSE_CAMERA_API_SET_PREVIEW_RESOLUTION,
1861 MUSE_CAMERA_API_CLASS_IMMEDIATE, value);
1863 return MUSE_CAMERA_ERROR_NONE;
1866 int camera_dispatcher_set_capture_resolution(muse_module_h module)
1869 muse_camera_handle_s *muse_camera = NULL;
1871 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1873 muse_camera_msg_get(value, muse_core_client_get_msg(module));
1875 _camera_task_add_job(muse_camera, MUSE_CAMERA_API_SET_CAPTURE_RESOLUTION,
1876 MUSE_CAMERA_API_CLASS_IMMEDIATE, value);
1878 return MUSE_CAMERA_ERROR_NONE;
1881 int camera_dispatcher_set_capture_format(muse_module_h module)
1883 int ret = CAMERA_ERROR_NONE;
1884 muse_camera_handle_s *muse_camera = NULL;
1886 muse_camera_api_e api = MUSE_CAMERA_API_SET_CAPTURE_FORMAT;
1887 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1889 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1891 muse_camera_msg_get(set_format, muse_core_client_get_msg(module));
1893 LOGD("handle : 0x%x, set_format : %d", muse_camera, set_format);
1895 ret = legacy_camera_set_capture_format(muse_camera->camera_handle, (camera_pixel_format_e)set_format);
1897 muse_camera_msg_return(api, class, ret, module);
1899 return MUSE_CAMERA_ERROR_NONE;
1902 int camera_dispatcher_set_preview_format(muse_module_h module)
1904 int ret = CAMERA_ERROR_NONE;
1905 muse_camera_handle_s *muse_camera = NULL;
1907 muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_FORMAT;
1908 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1910 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1912 muse_camera_msg_get(set_format, muse_core_client_get_msg(module));
1914 LOGD("handle : 0x%x, set_format : %d", muse_camera, set_format);
1916 ret = legacy_camera_set_preview_format(muse_camera->camera_handle, (camera_pixel_format_e)set_format);
1918 muse_camera_msg_return(api, class, ret, module);
1920 return MUSE_CAMERA_ERROR_NONE;
1923 int camera_dispatcher_get_preview_resolution(muse_module_h module)
1925 int ret = CAMERA_ERROR_NONE;
1926 muse_camera_handle_s *muse_camera = NULL;
1930 muse_camera_api_e api = MUSE_CAMERA_API_GET_PREVIEW_RESOLUTION;
1931 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1933 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1935 LOGD("handle : %p", muse_camera);
1937 ret = legacy_camera_get_preview_resolution(muse_camera->camera_handle, &get_width, &get_height);
1938 if (ret == CAMERA_ERROR_NONE) {
1939 get_value = get_width << 16 | get_height;
1940 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
1941 MUSE_CAMERA_GET_INT_PREVIEW_RESOLUTION, "get_value", get_value, NULL);
1943 muse_camera_msg_return(api, class, ret, module);
1946 return MUSE_CAMERA_ERROR_NONE;
1949 int camera_dispatcher_set_display_rotation(muse_module_h module)
1951 int ret = CAMERA_ERROR_NONE;
1952 muse_camera_handle_s *muse_camera = NULL;
1954 muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY_ROTATION;
1955 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1957 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1959 muse_camera_msg_get(set_rotation, muse_core_client_get_msg(module));
1961 LOGD("handle : 0x%x, set_rotation : %d", muse_camera, set_rotation);
1963 ret = legacy_camera_set_display_rotation(muse_camera->camera_handle, (camera_rotation_e)set_rotation);
1965 muse_camera_msg_return(api, class, ret, module);
1967 return MUSE_CAMERA_ERROR_NONE;
1970 int camera_dispatcher_get_display_rotation(muse_module_h module)
1972 int ret = CAMERA_ERROR_NONE;
1973 muse_camera_handle_s *muse_camera = NULL;
1974 camera_rotation_e get_value = CAMERA_ROTATION_NONE;
1975 muse_camera_api_e api = MUSE_CAMERA_API_GET_DISPLAY_ROTATION;
1976 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1978 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1980 LOGD("handle : %p", muse_camera);
1982 ret = legacy_camera_get_display_rotation(muse_camera->camera_handle, &get_value);
1983 if (ret == CAMERA_ERROR_NONE) {
1984 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
1985 MUSE_CAMERA_GET_INT_DISPLAY_ROTATION, "get_value", get_value, NULL);
1987 muse_camera_msg_return(api, class, ret, module);
1990 return MUSE_CAMERA_ERROR_NONE;
1993 int camera_dispatcher_set_display_flip(muse_module_h module)
1995 int ret = CAMERA_ERROR_NONE;
1996 muse_camera_handle_s *muse_camera = NULL;
1998 muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY_FLIP;
1999 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2001 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2003 muse_camera_msg_get(set_flip, muse_core_client_get_msg(module));
2005 LOGD("handle : 0x%x, set_flip : %d", muse_camera, set_flip);
2007 ret = legacy_camera_set_display_flip(muse_camera->camera_handle, (camera_flip_e)set_flip);
2009 muse_camera_msg_return(api, class, ret, module);
2011 return MUSE_CAMERA_ERROR_NONE;
2014 int camera_dispatcher_get_display_flip(muse_module_h module)
2016 int ret = CAMERA_ERROR_NONE;
2017 muse_camera_handle_s *muse_camera = NULL;
2018 camera_flip_e get_value = CAMERA_FLIP_NONE;
2019 muse_camera_api_e api = MUSE_CAMERA_API_GET_DISPLAY_FLIP;
2020 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2022 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2024 LOGD("handle : %p", muse_camera);
2026 ret = legacy_camera_get_display_flip(muse_camera->camera_handle, &get_value);
2027 if (ret == CAMERA_ERROR_NONE) {
2028 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
2029 MUSE_CAMERA_GET_INT_DISPLAY_FLIP, "get_value", get_value, NULL);
2031 muse_camera_msg_return(api, class, ret, module);
2034 return MUSE_CAMERA_ERROR_NONE;
2037 int camera_dispatcher_set_display_visible(muse_module_h module)
2039 int ret = CAMERA_ERROR_NONE;
2040 muse_camera_handle_s *muse_camera = NULL;
2042 muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY_VISIBLE;
2043 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2045 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2047 muse_camera_msg_get(set_visible, muse_core_client_get_msg(module));
2049 LOGD("handle : 0x%x, set_visible : %d", muse_camera, set_visible);
2051 ret = legacy_camera_set_display_visible(muse_camera->camera_handle, (bool)set_visible);
2053 muse_camera_msg_return(api, class, ret, module);
2055 return MUSE_CAMERA_ERROR_NONE;
2058 int camera_dispatcher_is_display_visible(muse_module_h module)
2060 int ret = CAMERA_ERROR_NONE;
2061 muse_camera_handle_s *muse_camera = NULL;
2062 bool get_value = true;
2063 muse_camera_api_e api = MUSE_CAMERA_API_IS_DISPLAY_VISIBLE;
2064 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2066 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2068 LOGD("handle : %p", muse_camera);
2070 ret = legacy_camera_is_display_visible(muse_camera->camera_handle, &get_value);
2071 if (ret == CAMERA_ERROR_NONE) {
2072 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
2073 MUSE_CAMERA_GET_INT_DISPLAY_VISIBLE, "get_value", get_value, NULL);
2075 muse_camera_msg_return(api, class, ret, module);
2078 return MUSE_CAMERA_ERROR_NONE;
2081 int camera_dispatcher_set_display_mode(muse_module_h module)
2083 int ret = CAMERA_ERROR_NONE;
2084 muse_camera_handle_s *muse_camera = NULL;
2086 muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY_MODE;
2087 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2089 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2091 muse_camera_msg_get(set_mode, muse_core_client_get_msg(module));
2093 LOGD("handle : 0x%x, display_mode : %d", muse_camera, set_mode);
2095 ret = legacy_camera_set_display_mode(muse_camera->camera_handle, (camera_display_mode_e)set_mode);
2097 LOGD("ret : 0x%x", ret);
2099 muse_camera_msg_return(api, class, ret, module);
2101 return MUSE_CAMERA_ERROR_NONE;
2104 int camera_dispatcher_get_display_mode(muse_module_h module)
2106 int ret = CAMERA_ERROR_NONE;
2107 muse_camera_handle_s *muse_camera = NULL;
2108 camera_display_mode_e get_value = CAMERA_DISPLAY_MODE_LETTER_BOX;
2109 muse_camera_api_e api = MUSE_CAMERA_API_GET_DISPLAY_MODE;
2110 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2112 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2114 LOGD("handle : %p", muse_camera);
2116 ret = legacy_camera_get_display_mode(muse_camera->camera_handle, &get_value);
2117 if (ret == CAMERA_ERROR_NONE) {
2118 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
2119 MUSE_CAMERA_GET_INT_DISPLAY_MODE, "get_value", get_value, NULL);
2121 muse_camera_msg_return(api, class, ret, module);
2124 return MUSE_CAMERA_ERROR_NONE;
2127 int camera_dispatcher_get_capture_resolution(muse_module_h module)
2129 int ret = CAMERA_ERROR_NONE;
2130 muse_camera_handle_s *muse_camera = NULL;
2134 muse_camera_api_e api = MUSE_CAMERA_API_GET_CAPTURE_RESOLUTION;
2135 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2137 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2139 LOGD("handle : %p", muse_camera);
2141 ret = legacy_camera_get_capture_resolution(muse_camera->camera_handle, &get_width, &get_height);
2142 if (ret == CAMERA_ERROR_NONE) {
2143 get_value = get_width << 16 | get_height;
2144 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
2145 MUSE_CAMERA_GET_INT_CAPTURE_RESOLUTION, "get_value", get_value, NULL);
2147 muse_camera_msg_return(api, class, ret, module);
2150 return MUSE_CAMERA_ERROR_NONE;
2153 int camera_dispatcher_get_capture_format(muse_module_h module)
2155 int ret = CAMERA_ERROR_NONE;
2156 muse_camera_handle_s *muse_camera = NULL;
2157 camera_pixel_format_e get_value = CAMERA_PIXEL_FORMAT_NV12;
2158 muse_camera_api_e api = MUSE_CAMERA_API_GET_CAPTURE_FORMAT;
2159 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2161 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2163 LOGD("handle : %p", muse_camera);
2165 ret = legacy_camera_get_capture_format(muse_camera->camera_handle, &get_value);
2166 if (ret == CAMERA_ERROR_NONE) {
2167 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
2168 MUSE_CAMERA_GET_INT_CAPTURE_FORMAT, "get_value", get_value, NULL);
2170 muse_camera_msg_return(api, class, ret, module);
2173 return MUSE_CAMERA_ERROR_NONE;
2176 int camera_dispatcher_get_preview_format(muse_module_h module)
2178 int ret = CAMERA_ERROR_NONE;
2179 muse_camera_handle_s *muse_camera = NULL;
2180 camera_pixel_format_e get_value = CAMERA_PIXEL_FORMAT_NV12;
2181 muse_camera_api_e api = MUSE_CAMERA_API_GET_PREVIEW_FORMAT;
2182 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2184 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2186 LOGD("handle : %p", muse_camera);
2188 ret = legacy_camera_get_preview_format(muse_camera->camera_handle, &get_value);
2189 if (ret == CAMERA_ERROR_NONE) {
2190 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
2191 MUSE_CAMERA_GET_INT_PREVIEW_FORMAT, "get_value", get_value, NULL);
2193 muse_camera_msg_return(api, class, ret, module);
2196 return MUSE_CAMERA_ERROR_NONE;
2199 int camera_dispatcher_get_facing_direction(muse_module_h module)
2201 int ret = CAMERA_ERROR_NONE;
2202 muse_camera_handle_s *muse_camera = NULL;
2203 camera_facing_direction_e get_value = CAMERA_FACING_DIRECTION_REAR;
2204 muse_camera_api_e api = MUSE_CAMERA_API_GET_FACING_DIRECTION;
2205 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2207 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2209 LOGD("handle : %p", muse_camera);
2211 ret = legacy_camera_get_facing_direction(muse_camera->camera_handle, &get_value);
2212 if (ret == CAMERA_ERROR_NONE) {
2213 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
2214 MUSE_CAMERA_GET_INT_FACING_DIRECTION, "get_value", get_value, NULL);
2216 muse_camera_msg_return(api, class, ret, module);
2219 return MUSE_CAMERA_ERROR_NONE;
2222 int camera_dispatcher_get_flash_state(muse_module_h module)
2224 int ret = CAMERA_ERROR_NONE;
2226 bool is_called = false;
2227 char value_key[KEY_LENGTH] = {'\0',};
2228 camera_h camera = NULL;
2229 camera_device_e device_type = CAMERA_DEVICE_CAMERA0;
2230 camera_flash_state_e get_flash_state = CAMERA_FLASH_STATE_NOT_USED;
2231 muse_camera_api_e api = MUSE_CAMERA_API_GET_FLASH_STATE;
2232 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2234 muse_camera_msg_get(device_type, muse_core_client_get_msg(module));
2236 if (device_type < CAMERA_DEVICE_CAMERA0 || device_type > CAMERA_DEVICE_CAMERA1) {
2237 LOGE("invalid device %d", device_type);
2239 ret = CAMERA_ERROR_INVALID_PARAMETER;
2240 muse_camera_msg_return(api, class, ret, module);
2242 return MUSE_CAMERA_ERROR_NONE;
2245 muse_core_client_get_value(module, MUSED_KEY_FLASH_STATE_CHECK, (int *)&is_called);
2248 ret = legacy_camera_create(device_type, &camera);
2250 legacy_camera_attr_foreach_supported_flash_mode(camera,
2251 (camera_attr_supported_flash_mode_cb)_camera_dispatcher_callback_supported_flash_mode2,
2254 legacy_camera_destroy(camera);
2258 muse_core_client_set_value(module, MUSED_KEY_FLASH_STATE_RETURN, ret);
2259 muse_core_client_set_value(module, MUSED_KEY_FLASH_STATE_COUNT, count);
2260 muse_core_client_set_value(module, MUSED_KEY_FLASH_STATE_CHECK, (int)true);
2262 muse_core_client_get_value(module, MUSED_KEY_FLASH_STATE_RETURN, &ret);
2263 muse_core_client_get_value(module, MUSED_KEY_FLASH_STATE_COUNT, &count);
2266 LOGD("is_called %d, ret 0x%x, count %d", is_called, ret, count);
2268 if (ret != CAMERA_ERROR_NONE) {
2269 LOGE("failed to create or get camera info 0x%x", ret);
2271 muse_camera_msg_return(api, class, ret, module);
2273 return MUSE_CAMERA_ERROR_NONE;
2277 LOGE("count[%d] of supported flash mode is too small, so return NOT_SUPPORTED", count);
2279 ret = CAMERA_ERROR_NOT_SUPPORTED;
2280 muse_camera_msg_return(api, class, ret, module);
2282 return MUSE_CAMERA_ERROR_NONE;
2285 snprintf(value_key, KEY_LENGTH, "flash_state_camera%d", device_type);
2286 muse_core_client_get_value(module, value_key, (int *)&get_flash_state);
2288 LOGD("[%d] flash state : %d", device_type, get_flash_state);
2290 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
2291 -1, "get_flash_state", get_flash_state, NULL);
2293 return MUSE_CAMERA_ERROR_NONE;
2296 int camera_dispatcher_set_preview_cb(muse_module_h module)
2298 int ret = CAMERA_ERROR_NONE;
2299 muse_camera_handle_s *muse_camera = NULL;
2300 muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_CB;
2301 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2303 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2305 LOGD("handle : %p", muse_camera);
2307 ret = legacy_camera_set_preview_cb(muse_camera->camera_handle,
2308 (camera_preview_cb)_camera_dispatcher_preview_cb,
2311 if (ret == CAMERA_ERROR_NONE)
2312 SET_PREVIEW_CB_TYPE(muse_camera, PREVIEW_CB_TYPE_USER);
2314 LOGD("ret : 0x%x", ret);
2316 muse_camera_msg_return(api, class, ret, module);
2318 return MUSE_CAMERA_ERROR_NONE;
2321 int camera_dispatcher_unset_preview_cb(muse_module_h module)
2323 int ret = CAMERA_ERROR_NONE;
2324 muse_camera_handle_s *muse_camera = NULL;
2325 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_PREVIEW_CB;
2326 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2328 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2330 LOGD("handle : %p", muse_camera);
2332 UNSET_PREVIEW_CB_TYPE(muse_camera, PREVIEW_CB_TYPE_USER);
2333 if (CHECK_PREVIEW_CB(muse_camera, PREVIEW_CB_TYPE_EVAS))
2334 LOGD("Preview callback for evas surface is remained.");
2336 ret = legacy_camera_unset_preview_cb(muse_camera->camera_handle);
2338 LOGD("ret : 0x%x", ret);
2340 muse_camera_msg_return(api, class, ret, module);
2342 return MUSE_CAMERA_ERROR_NONE;
2345 int camera_dispatcher_set_media_packet_preview_cb(muse_module_h module)
2347 int ret = CAMERA_ERROR_NONE;
2348 muse_camera_handle_s *muse_camera = NULL;
2349 muse_camera_api_e api = MUSE_CAMERA_API_SET_MEDIA_PACKET_PREVIEW_CB;
2350 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2352 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2354 LOGD("handle : %p", muse_camera);
2356 ret = legacy_camera_set_media_packet_preview_cb(muse_camera->camera_handle,
2357 (camera_preview_cb)_camera_dispatcher_preview_cb,
2360 LOGD("ret : 0x%x", ret);
2362 muse_camera_msg_return(api, class, ret, module);
2364 return MUSE_CAMERA_ERROR_NONE;
2367 int camera_dispatcher_unset_media_packet_preview_cb(muse_module_h module)
2369 int ret = CAMERA_ERROR_NONE;
2370 muse_camera_handle_s *muse_camera = NULL;
2371 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_MEDIA_PACKET_PREVIEW_CB;
2372 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2374 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2376 LOGD("handle : %p", muse_camera);
2378 ret = legacy_camera_unset_media_packet_preview_cb(muse_camera->camera_handle);
2380 LOGD("ret : 0x%x", ret);
2382 muse_camera_msg_return(api, class, ret, module);
2384 return MUSE_CAMERA_ERROR_NONE;
2387 int camera_dispatcher_set_state_changed_cb(muse_module_h module)
2389 int ret = CAMERA_ERROR_NONE;
2390 muse_camera_api_e api = MUSE_CAMERA_API_SET_STATE_CHANGED_CB;
2391 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2395 muse_camera_msg_return(api, class, ret, module);
2397 return MUSE_CAMERA_ERROR_NONE;
2400 int camera_dispatcher_unset_state_changed_cb(muse_module_h module)
2402 int ret = CAMERA_ERROR_NONE;
2403 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_STATE_CHANGED_CB;
2404 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2408 muse_camera_msg_return(api, class, ret, module);
2410 return MUSE_CAMERA_ERROR_NONE;
2413 int camera_dispatcher_set_interrupted_cb(muse_module_h module)
2415 int ret = CAMERA_ERROR_NONE;
2416 muse_camera_handle_s *muse_camera = NULL;
2417 muse_camera_api_e api = MUSE_CAMERA_API_SET_INTERRUPTED_CB;
2418 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2420 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2422 LOGD("handle : %p", muse_camera);
2424 ret = legacy_camera_set_interrupted_cb(muse_camera->camera_handle,
2425 (camera_interrupted_cb)_camera_dispatcher_interrupted_cb,
2428 LOGD("ret : 0x%x", ret);
2430 muse_camera_msg_return(api, class, ret, module);
2432 return MUSE_CAMERA_ERROR_NONE;
2435 int camera_dispatcher_unset_interrupted_cb(muse_module_h module)
2437 int ret = CAMERA_ERROR_NONE;
2438 muse_camera_handle_s *muse_camera = NULL;
2439 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_INTERRUPTED_CB;
2440 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2442 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2444 LOGD("handle : %p", muse_camera);
2446 ret = legacy_camera_unset_interrupted_cb(muse_camera->camera_handle);
2448 LOGD("ret : 0x%x", ret);
2450 muse_camera_msg_return(api, class, ret, module);
2452 return MUSE_CAMERA_ERROR_NONE;
2455 int camera_dispatcher_set_focus_changed_cb(muse_module_h module)
2457 int ret = CAMERA_ERROR_NONE;
2458 muse_camera_handle_s *muse_camera = NULL;
2459 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOCUS_CHANGED_CB;
2460 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2462 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2464 LOGD("handle : %p", muse_camera);
2466 ret = legacy_camera_set_focus_changed_cb(muse_camera->camera_handle,
2467 (camera_focus_changed_cb)_camera_dispatcher_focus_changed_cb,
2470 LOGD("ret : 0x%x", ret);
2472 muse_camera_msg_return(api, class, ret, module);
2474 return MUSE_CAMERA_ERROR_NONE;
2477 int camera_dispatcher_unset_focus_changed_cb(muse_module_h module)
2479 int ret = CAMERA_ERROR_NONE;
2480 muse_camera_handle_s *muse_camera = NULL;
2481 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_FOCUS_CHANGED_CB;
2482 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2484 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2486 LOGD("handle : %p", muse_camera);
2488 ret = legacy_camera_unset_focus_changed_cb(muse_camera->camera_handle);
2490 LOGD("ret : 0x%x", ret);
2492 muse_camera_msg_return(api, class, ret, module);
2494 return MUSE_CAMERA_ERROR_NONE;
2497 int camera_dispatcher_set_error_cb(muse_module_h module)
2499 int ret = CAMERA_ERROR_NONE;
2500 muse_camera_handle_s *muse_camera = NULL;
2501 muse_camera_api_e api = MUSE_CAMERA_API_SET_ERROR_CB;
2502 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2504 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2506 LOGD("handle : %p", muse_camera);
2508 ret = legacy_camera_set_error_cb(muse_camera->camera_handle,
2509 (camera_error_cb)_camera_dispatcher_error_cb,
2512 LOGD("ret : 0x%x", ret);
2514 muse_camera_msg_return(api, class, ret, module);
2516 return MUSE_CAMERA_ERROR_NONE;
2519 int camera_dispatcher_unset_error_cb(muse_module_h module)
2521 int ret = CAMERA_ERROR_NONE;
2522 muse_camera_handle_s *muse_camera = NULL;
2523 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_ERROR_CB;
2524 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2526 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2528 LOGD("handle : %p", muse_camera);
2530 ret = legacy_camera_unset_error_cb(muse_camera->camera_handle);
2532 LOGD("ret : 0x%x", ret);
2534 muse_camera_msg_return(api, class, ret, module);
2536 return MUSE_CAMERA_ERROR_NONE;
2539 int camera_dispatcher_foreach_supported_preview_resolution(muse_module_h module)
2541 int ret = CAMERA_ERROR_NONE;
2542 muse_camera_handle_s *muse_camera = NULL;
2543 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_PREVIEW_RESOLUTION;
2544 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
2546 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2548 LOGD("handle : %p", muse_camera);
2550 ret = legacy_camera_foreach_supported_preview_resolution(muse_camera->camera_handle,
2551 (camera_supported_preview_resolution_cb)_camera_dispatcher_callback_supported_preview_resolution,
2554 LOGD("ret : 0x%x", ret);
2556 muse_camera_msg_return(api, class, ret, module);
2558 return MUSE_CAMERA_ERROR_NONE;
2561 int camera_dispatcher_foreach_supported_capture_resolution(muse_module_h module)
2563 int ret = CAMERA_ERROR_NONE;
2564 muse_camera_handle_s *muse_camera = NULL;
2565 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_CAPTURE_RESOLUTION;
2566 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
2568 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2570 LOGD("handle : %p", muse_camera);
2572 ret = legacy_camera_foreach_supported_capture_resolution(muse_camera->camera_handle,
2573 (camera_supported_capture_resolution_cb)_camera_dispatcher_callback_supported_capture_resolution,
2576 LOGD("ret : 0x%x", ret);
2578 muse_camera_msg_return(api, class, ret, module);
2580 return MUSE_CAMERA_ERROR_NONE;
2583 int camera_dispatcher_foreach_supported_capture_format(muse_module_h module)
2585 int ret = CAMERA_ERROR_NONE;
2586 muse_camera_handle_s *muse_camera = NULL;
2587 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_CAPTURE_FORMAT;
2588 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
2590 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2592 LOGD("handle : %p", muse_camera);
2594 ret = legacy_camera_foreach_supported_capture_format(muse_camera->camera_handle,
2595 (camera_supported_capture_format_cb)_camera_dispatcher_callback_supported_capture_format,
2598 LOGD("ret : 0x%x", ret);
2600 muse_camera_msg_return(api, class, ret, module);
2602 return MUSE_CAMERA_ERROR_NONE;
2605 int camera_dispatcher_foreach_supported_preview_format(muse_module_h module)
2607 int ret = CAMERA_ERROR_NONE;
2608 muse_camera_handle_s *muse_camera = NULL;
2609 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_PREVIEW_FORMAT;
2610 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
2612 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2614 LOGD("handle : %p", muse_camera);
2616 ret = legacy_camera_foreach_supported_preview_format(muse_camera->camera_handle,
2617 (camera_supported_preview_format_cb)_camera_dispatcher_callback_supported_preview_format,
2620 LOGD("ret : 0x%x", ret);
2622 muse_camera_msg_return(api, class, ret, module);
2624 return MUSE_CAMERA_ERROR_NONE;
2627 int camera_dispatcher_get_recommended_preview_resolution(muse_module_h module)
2629 int ret = CAMERA_ERROR_NONE;
2630 muse_camera_handle_s *muse_camera = NULL;
2634 muse_camera_api_e api = MUSE_CAMERA_API_GET_RECOMMENDED_PREVIEW_RESOLUTION;
2635 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2637 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2639 LOGD("handle : %p", muse_camera);
2641 ret = legacy_camera_get_recommended_preview_resolution(muse_camera->camera_handle, &get_width, &get_height);
2642 if (ret == CAMERA_ERROR_NONE) {
2643 get_value = get_width << 16 | get_height;
2644 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
2645 MUSE_CAMERA_GET_INT_RECOMMENDED_PREVIEW_RESOLUTION, "get_value", get_value, NULL);
2647 muse_camera_msg_return(api, class, ret, module);
2650 return MUSE_CAMERA_ERROR_NONE;
2653 int camera_dispatcher_attr_get_lens_orientation(muse_module_h module)
2655 int ret = CAMERA_ERROR_NONE;
2656 muse_camera_handle_s *muse_camera = NULL;
2658 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_LENS_ORIENTATION;
2659 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2661 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2663 LOGD("handle : %p", muse_camera);
2665 ret = legacy_camera_attr_get_lens_orientation(muse_camera->camera_handle, &get_value);
2666 if (ret == CAMERA_ERROR_NONE) {
2667 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
2668 MUSE_CAMERA_GET_INT_LENS_ORIENTATION, "get_value", get_value, NULL);
2670 muse_camera_msg_return(api, class, ret, module);
2673 return MUSE_CAMERA_ERROR_NONE;
2676 int camera_dispatcher_attr_set_theater_mode(muse_module_h module)
2678 int ret = CAMERA_ERROR_NONE;
2679 muse_camera_handle_s *muse_camera = NULL;
2681 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_THEATER_MODE;
2682 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2684 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2686 muse_camera_msg_get(set_mode, muse_core_client_get_msg(module));
2688 LOGD("handle : %p", muse_camera);
2690 ret = legacy_camera_attr_set_theater_mode(muse_camera->camera_handle, (camera_attr_theater_mode_e)set_mode);
2692 muse_camera_msg_return(api, class, ret, module);
2694 return MUSE_CAMERA_ERROR_NONE;
2697 int camera_dispatcher_attr_get_theater_mode(muse_module_h module)
2699 int ret = CAMERA_ERROR_NONE;
2700 muse_camera_handle_s *muse_camera = NULL;
2701 camera_attr_theater_mode_e get_value = CAMERA_ATTR_THEATER_MODE_DISABLE;
2702 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_THEATER_MODE;
2703 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2705 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2707 LOGD("handle : %p", muse_camera);
2709 ret = legacy_camera_attr_get_theater_mode(muse_camera->camera_handle, &get_value);
2710 if (ret == CAMERA_ERROR_NONE) {
2711 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
2712 MUSE_CAMERA_GET_INT_THEATER_MODE, "get_value", get_value, NULL);
2714 muse_camera_msg_return(api, class, ret, module);
2717 return MUSE_CAMERA_ERROR_NONE;
2720 int camera_dispatcher_attr_foreach_supported_theater_mode(muse_module_h module)
2722 int ret = CAMERA_ERROR_NONE;
2723 muse_camera_handle_s *muse_camera = NULL;
2724 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_THEATER_MODE;
2725 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
2727 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2728 LOGD("handle : %p", muse_camera);
2730 ret = legacy_camera_attr_foreach_supported_theater_mode(muse_camera->camera_handle,
2731 (camera_attr_supported_theater_mode_cb)_camera_dispatcher_callback_supported_theater_mode,
2734 muse_camera_msg_return(api, class, ret, module);
2736 return MUSE_CAMERA_ERROR_NONE;
2739 int camera_dispatcher_attr_set_preview_fps(muse_module_h module)
2741 int ret = CAMERA_ERROR_NONE;
2742 muse_camera_handle_s *muse_camera = NULL;
2744 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_PREVIEW_FPS;
2745 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2747 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2749 muse_camera_msg_get(set_fps, muse_core_client_get_msg(module));
2751 LOGD("handle : %p", muse_camera);
2753 ret = legacy_camera_attr_set_preview_fps(muse_camera->camera_handle, (camera_attr_fps_e)set_fps);
2755 muse_camera_msg_return(api, class, ret, module);
2757 return MUSE_CAMERA_ERROR_NONE;
2760 int camera_dispatcher_attr_set_image_quality(muse_module_h module)
2762 int ret = CAMERA_ERROR_NONE;
2763 muse_camera_handle_s *muse_camera = NULL;
2765 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_IMAGE_QUALITY;
2766 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2768 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2770 muse_camera_msg_get(quality, muse_core_client_get_msg(module));
2772 LOGD("handle : 0x%x, image_quality : %d", muse_camera, quality);
2774 ret = legacy_camera_attr_set_image_quality(muse_camera->camera_handle, quality);
2776 LOGD("ret : 0x%x", ret);
2778 muse_camera_msg_return(api, class, ret, module);
2780 return MUSE_CAMERA_ERROR_NONE;
2783 int camera_dispatcher_attr_get_preview_fps(muse_module_h module)
2785 int ret = CAMERA_ERROR_NONE;
2786 muse_camera_handle_s *muse_camera = NULL;
2787 camera_attr_fps_e get_value = CAMERA_ATTR_FPS_AUTO;
2788 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_PREVIEW_FPS;
2789 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2791 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2793 LOGD("handle : %p", muse_camera);
2795 ret = legacy_camera_attr_get_preview_fps(muse_camera->camera_handle, &get_value);
2796 if (ret == CAMERA_ERROR_NONE) {
2797 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
2798 MUSE_CAMERA_GET_INT_PREVIEW_FPS, "get_value", get_value, NULL);
2800 muse_camera_msg_return(api, class, ret, module);
2803 return MUSE_CAMERA_ERROR_NONE;
2806 int camera_dispatcher_attr_get_image_quality(muse_module_h module)
2808 int ret = CAMERA_ERROR_NONE;
2809 muse_camera_handle_s *muse_camera = NULL;
2811 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_IMAGE_QUALITY;
2812 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2814 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2816 LOGD("handle : %p", muse_camera);
2818 ret = legacy_camera_attr_get_image_quality(muse_camera->camera_handle, &get_value);
2819 if (ret == CAMERA_ERROR_NONE) {
2820 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
2821 MUSE_CAMERA_GET_INT_IMAGE_QUALITY, "get_value", get_value, NULL);
2823 muse_camera_msg_return(api, class, ret, module);
2826 return MUSE_CAMERA_ERROR_NONE;
2829 int camera_dispatcher_attr_set_zoom(muse_module_h module)
2831 int ret = CAMERA_ERROR_NONE;
2832 muse_camera_handle_s *muse_camera = NULL;
2834 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ZOOM;
2835 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2837 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2839 muse_camera_msg_get(zoom, muse_core_client_get_msg(module));
2841 LOGD("handle : 0x%x, zoom : %d", muse_camera, zoom);
2843 ret = legacy_camera_attr_set_zoom(muse_camera->camera_handle, zoom);
2845 LOGD("ret : 0x%x", ret);
2847 muse_camera_msg_return(api, class, ret, module);
2849 return MUSE_CAMERA_ERROR_NONE;
2852 int camera_dispatcher_attr_set_af_mode(muse_module_h module)
2854 int ret = CAMERA_ERROR_NONE;
2855 muse_camera_handle_s *muse_camera = NULL;
2857 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_AF_MODE;
2858 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2860 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2862 muse_camera_msg_get(set_mode, muse_core_client_get_msg(module));
2864 LOGD("handle : 0x%x, set_mode : %d", muse_camera, set_mode);
2866 ret = legacy_camera_attr_set_af_mode(muse_camera->camera_handle, (camera_attr_af_mode_e)set_mode);
2868 LOGD("ret : 0x%x", ret);
2870 muse_camera_msg_return(api, class, ret, module);
2872 return MUSE_CAMERA_ERROR_NONE;
2875 int camera_dispatcher_attr_set_af_area(muse_module_h module)
2877 int ret = CAMERA_ERROR_NONE;
2878 muse_camera_handle_s *muse_camera = NULL;
2882 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_AF_AREA;
2883 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2885 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2887 muse_camera_msg_get(value, muse_core_client_get_msg(module));
2890 y = 0x0000ffff & value;
2892 LOGD("AF area - %d, %d", x, y);
2894 ret = legacy_camera_attr_set_af_area(muse_camera->camera_handle, x, y);
2896 LOGD("ret : 0x%x", ret);
2898 muse_camera_msg_return(api, class, ret, module);
2900 return MUSE_CAMERA_ERROR_NONE;
2903 int camera_dispatcher_attr_clear_af_area(muse_module_h module)
2905 int ret = CAMERA_ERROR_NONE;
2906 muse_camera_handle_s *muse_camera = NULL;
2907 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_CLEAR_AF_AREA;
2908 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2910 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2912 LOGD("handle : %p", muse_camera);
2914 ret = legacy_camera_attr_clear_af_area(muse_camera->camera_handle);
2916 LOGD("ret : 0x%x", ret);
2918 muse_camera_msg_return(api, class, ret, module);
2920 return MUSE_CAMERA_ERROR_NONE;
2923 int camera_dispatcher_attr_set_exposure_mode(muse_module_h module)
2925 int ret = CAMERA_ERROR_NONE;
2926 muse_camera_handle_s *muse_camera = NULL;
2928 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EXPOSURE_MODE;
2929 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2931 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2933 muse_camera_msg_get(set_mode, muse_core_client_get_msg(module));
2935 LOGD("handle : 0x%x, set_mode : %d", muse_camera, set_mode);
2937 ret = legacy_camera_attr_set_exposure_mode(muse_camera->camera_handle, (camera_attr_exposure_mode_e)set_mode);
2939 LOGD("ret : 0x%x", ret);
2941 muse_camera_msg_return(api, class, ret, module);
2943 return MUSE_CAMERA_ERROR_NONE;
2946 int camera_dispatcher_attr_set_exposure(muse_module_h module)
2948 int ret = CAMERA_ERROR_NONE;
2949 muse_camera_handle_s *muse_camera = NULL;
2951 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EXPOSURE;
2952 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2954 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2956 muse_camera_msg_get(value, muse_core_client_get_msg(module));
2958 LOGD("handle : 0x%x, value : %d", muse_camera, value);
2960 ret = legacy_camera_attr_set_exposure(muse_camera->camera_handle, value);
2962 LOGD("ret : 0x%x", ret);
2964 muse_camera_msg_return(api, class, ret, module);
2966 return MUSE_CAMERA_ERROR_NONE;
2969 int camera_dispatcher_attr_set_iso(muse_module_h module)
2971 int ret = CAMERA_ERROR_NONE;
2972 muse_camera_handle_s *muse_camera = NULL;
2974 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ISO;
2975 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2977 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2979 muse_camera_msg_get(set_iso, muse_core_client_get_msg(module));
2981 LOGD("handle : 0x%x, set_iso : %d", muse_camera, set_iso);
2983 ret = legacy_camera_attr_set_iso(muse_camera->camera_handle, (camera_attr_iso_e)set_iso);
2985 LOGD("ret : 0x%x", ret);
2987 muse_camera_msg_return(api, class, ret, module);
2989 return MUSE_CAMERA_ERROR_NONE;
2992 int camera_dispatcher_attr_set_brightness(muse_module_h module)
2994 int ret = CAMERA_ERROR_NONE;
2995 muse_camera_handle_s *muse_camera = NULL;
2997 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_BRIGHTNESS;
2998 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3000 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3002 muse_camera_msg_get(level, muse_core_client_get_msg(module));
3004 LOGD("handle : 0x%x, level : %d", muse_camera, level);
3006 ret = legacy_camera_attr_set_brightness(muse_camera->camera_handle, level);
3008 LOGD("ret : 0x%x", ret);
3010 muse_camera_msg_return(api, class, ret, module);
3012 return MUSE_CAMERA_ERROR_NONE;
3015 int camera_dispatcher_attr_set_contrast(muse_module_h module)
3017 int ret = CAMERA_ERROR_NONE;
3018 muse_camera_handle_s *muse_camera = NULL;
3020 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_CONTRAST;
3021 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3023 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3025 muse_camera_msg_get(level, muse_core_client_get_msg(module));
3027 LOGD("handle : 0x%x, level : %d", muse_camera, level);
3029 ret = legacy_camera_attr_set_contrast(muse_camera->camera_handle, level);
3031 LOGD("ret : 0x%x", ret);
3033 muse_camera_msg_return(api, class, ret, module);
3035 return MUSE_CAMERA_ERROR_NONE;
3038 int camera_dispatcher_attr_set_whitebalance(muse_module_h module)
3040 int ret = CAMERA_ERROR_NONE;
3041 muse_camera_handle_s *muse_camera = NULL;
3042 int set_whitebalance;
3043 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_WHITEBALANCE;
3044 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3046 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3048 muse_camera_msg_get(set_whitebalance, muse_core_client_get_msg(module));
3050 LOGD("handle : 0x%x, set_whitebalance : %d", muse_camera, set_whitebalance);
3052 ret = legacy_camera_attr_set_whitebalance(muse_camera->camera_handle, (camera_attr_whitebalance_e)set_whitebalance);
3054 LOGD("ret : 0x%x", ret);
3056 muse_camera_msg_return(api, class, ret, module);
3058 return MUSE_CAMERA_ERROR_NONE;
3061 int camera_dispatcher_attr_set_effect(muse_module_h module)
3063 int ret = CAMERA_ERROR_NONE;
3064 muse_camera_handle_s *muse_camera = NULL;
3066 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EFFECT;
3067 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3069 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3071 muse_camera_msg_get(set_effect, muse_core_client_get_msg(module));
3073 LOGD("handle : 0x%x, set_effect : %d", muse_camera, set_effect);
3075 ret = legacy_camera_attr_set_effect(muse_camera->camera_handle, (camera_attr_effect_mode_e)set_effect);
3077 LOGD("ret : 0x%x", ret);
3079 muse_camera_msg_return(api, class, ret, module);
3081 return MUSE_CAMERA_ERROR_NONE;
3084 int camera_dispatcher_attr_set_scene_mode(muse_module_h module)
3086 int ret = CAMERA_ERROR_NONE;
3087 muse_camera_handle_s *muse_camera = NULL;
3089 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_SCENE_MODE;
3090 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3092 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3094 muse_camera_msg_get(set_mode, muse_core_client_get_msg(module));
3096 LOGD("handle : 0x%x, set_mode : %d", muse_camera, set_mode);
3098 ret = legacy_camera_attr_set_scene_mode(muse_camera->camera_handle, (camera_attr_scene_mode_e)set_mode);
3100 LOGD("ret : 0x%x", ret);
3102 muse_camera_msg_return(api, class, ret, module);
3104 return MUSE_CAMERA_ERROR_NONE;
3107 int camera_dispatcher_attr_enable_tag(muse_module_h module)
3109 int ret = CAMERA_ERROR_NONE;
3110 muse_camera_handle_s *muse_camera = NULL;
3112 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_TAG;
3113 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3115 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3117 muse_camera_msg_get(set_enable, muse_core_client_get_msg(module));
3119 LOGD("handle : 0x%x, set_enable : %d", muse_camera, set_enable);
3121 ret = legacy_camera_attr_enable_tag(muse_camera->camera_handle, (bool)set_enable);
3123 LOGD("ret : 0x%x", ret);
3125 muse_camera_msg_return(api, class, ret, module);
3127 return MUSE_CAMERA_ERROR_NONE;
3130 int camera_dispatcher_attr_set_tag_image_description(muse_module_h module)
3132 int ret = CAMERA_ERROR_NONE;
3133 muse_camera_handle_s *muse_camera = NULL;
3134 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_IMAGE_DESCRIPTION;
3135 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3136 char description[MUSE_CAMERA_MSG_MAX_LENGTH] = {0,};
3138 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3140 muse_camera_msg_get_string(description, muse_core_client_get_msg(module));
3142 LOGD("handle : 0x%x, description : %s", muse_camera, description);
3144 ret = legacy_camera_attr_set_tag_image_description(muse_camera->camera_handle, description);
3146 LOGD("ret : 0x%x", ret);
3148 muse_camera_msg_return(api, class, ret, module);
3150 return MUSE_CAMERA_ERROR_NONE;
3153 int camera_dispatcher_attr_set_tag_orientation(muse_module_h module)
3155 int ret = CAMERA_ERROR_NONE;
3156 muse_camera_handle_s *muse_camera = NULL;
3157 int set_orientation;
3158 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_ORIENTATION;
3159 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3161 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3163 muse_camera_msg_get(set_orientation, muse_core_client_get_msg(module));
3165 LOGD("handle : 0x%x, set_orientation : %d", muse_camera, set_orientation);
3167 ret = legacy_camera_attr_set_tag_orientation(muse_camera->camera_handle, (camera_attr_tag_orientation_e)set_orientation);
3169 LOGD("ret : 0x%x", ret);
3171 muse_camera_msg_return(api, class, ret, module);
3173 return MUSE_CAMERA_ERROR_NONE;
3176 int camera_dispatcher_attr_set_tag_software(muse_module_h module)
3178 int ret = CAMERA_ERROR_NONE;
3179 muse_camera_handle_s *muse_camera = NULL;
3180 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_SOFTWARE;
3181 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3182 char software[MUSE_CAMERA_MSG_MAX_LENGTH] = {0,};
3184 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3186 muse_camera_msg_get_string(software, muse_core_client_get_msg(module));
3188 LOGD("handle : 0x%x, software : %s", muse_camera, software);
3190 ret = legacy_camera_attr_set_tag_software(muse_camera->camera_handle, software);
3192 LOGD("ret : 0x%x", ret);
3194 muse_camera_msg_return(api, class, ret, module);
3196 return MUSE_CAMERA_ERROR_NONE;
3199 int camera_dispatcher_attr_set_geotag(muse_module_h module)
3201 int ret = CAMERA_ERROR_NONE;
3202 muse_camera_handle_s *muse_camera = NULL;
3203 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_GEOTAG;
3204 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3205 double set_geotag[3] = {0,};
3207 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3209 muse_camera_msg_get_array(set_geotag, muse_core_client_get_msg(module));
3211 LOGD("handle : 0x%x, set_geotag1 : %d, set_geotag2 : %d, set_geotag3 : %d",
3212 muse_camera, set_geotag[0], set_geotag[1], set_geotag[2]);
3214 ret = legacy_camera_attr_set_geotag(muse_camera->camera_handle, set_geotag[0], set_geotag[1], set_geotag[2]);
3216 LOGD("ret : 0x%x", ret);
3218 muse_camera_msg_return(api, class, ret, module);
3220 return MUSE_CAMERA_ERROR_NONE;
3223 int camera_dispatcher_attr_remove_geotag(muse_module_h module)
3225 int ret = CAMERA_ERROR_NONE;
3226 muse_camera_handle_s *muse_camera = NULL;
3227 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_REMOVE_GEOTAG;
3228 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3230 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3232 LOGD("handle : %p", muse_camera);
3234 ret = legacy_camera_attr_remove_geotag(muse_camera->camera_handle);
3236 LOGD("ret : 0x%x", ret);
3238 muse_camera_msg_return(api, class, ret, module);
3240 return MUSE_CAMERA_ERROR_NONE;
3243 int camera_dispatcher_attr_set_flash_mode(muse_module_h module)
3245 int ret = CAMERA_ERROR_NONE;
3247 char value_key[KEY_LENGTH] = {'\0',};
3248 muse_camera_handle_s *muse_camera = NULL;
3249 camera_device_e device_type = CAMERA_DEVICE_CAMERA0;
3250 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_FLASH_MODE;
3251 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3253 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3255 muse_camera_msg_get(set_mode, muse_core_client_get_msg(module));
3257 LOGD("handle : 0x%x, set_mode : %d", muse_camera, set_mode);
3259 ret = legacy_camera_attr_set_flash_mode(muse_camera->camera_handle, (camera_attr_flash_mode_e)set_mode);
3260 if (ret == CAMERA_ERROR_NONE) {
3261 ret = legacy_camera_get_device_type(muse_camera->camera_handle, &device_type);
3262 if (ret == CAMERA_ERROR_NONE) {
3263 snprintf(value_key, KEY_LENGTH, "flash_state_camera%d", device_type);
3264 muse_core_client_set_value(module, value_key, set_mode > 0 ? 1 : 0);
3268 LOGD("ret : 0x%x", ret);
3270 muse_camera_msg_return(api, class, ret, module);
3272 return MUSE_CAMERA_ERROR_NONE;
3275 int camera_dispatcher_attr_get_zoom(muse_module_h module)
3277 int ret = CAMERA_ERROR_NONE;
3278 muse_camera_handle_s *muse_camera = NULL;
3280 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ZOOM;
3281 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3283 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3285 LOGD("handle : %p", muse_camera);
3287 ret = legacy_camera_attr_get_zoom(muse_camera->camera_handle, &get_value);
3288 if (ret == CAMERA_ERROR_NONE) {
3289 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
3290 MUSE_CAMERA_GET_INT_ZOOM, "get_value", get_value, NULL);
3292 muse_camera_msg_return(api, class, ret, module);
3295 return MUSE_CAMERA_ERROR_NONE;
3298 int camera_dispatcher_attr_get_zoom_range(muse_module_h module)
3300 int ret = CAMERA_ERROR_NONE;
3301 muse_camera_handle_s *muse_camera = NULL;
3304 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ZOOM_RANGE;
3305 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3306 muse_camera_get_type_e get_type = MUSE_CAMERA_GET_TYPE_INT_PAIR;
3307 muse_camera_get_int_pair_e index = MUSE_CAMERA_GET_INT_PAIR_ZOOM_RANGE;
3309 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3311 LOGD("handle : %p", muse_camera);
3313 ret = legacy_camera_attr_get_zoom_range(muse_camera->camera_handle, &get_value0, &get_value1);
3314 if (ret == CAMERA_ERROR_NONE)
3315 muse_camera_msg_return2(api, class, ret, module, get_type, index, get_value0, get_value1);
3317 muse_camera_msg_return(api, class, ret, module);
3319 return MUSE_CAMERA_ERROR_NONE;
3322 int camera_dispatcher_attr_get_af_mode(muse_module_h module)
3324 int ret = CAMERA_ERROR_NONE;
3325 muse_camera_handle_s *muse_camera = NULL;
3326 camera_attr_af_mode_e get_value = CAMERA_ATTR_AF_NONE;
3327 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_AF_MODE;
3328 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3330 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3332 LOGD("handle : %p", muse_camera);
3334 ret = legacy_camera_attr_get_af_mode(muse_camera->camera_handle, &get_value);
3335 if (ret == CAMERA_ERROR_NONE) {
3336 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
3337 MUSE_CAMERA_GET_INT_AF_MODE, "get_value", get_value, NULL);
3339 muse_camera_msg_return(api, class, ret, module);
3342 return MUSE_CAMERA_ERROR_NONE;
3345 int camera_dispatcher_attr_get_exposure_mode(muse_module_h module)
3347 int ret = CAMERA_ERROR_NONE;
3348 muse_camera_handle_s *muse_camera = NULL;
3349 camera_attr_exposure_mode_e get_value = CAMERA_ATTR_EXPOSURE_MODE_OFF;
3350 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE_MODE;
3351 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3353 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3355 LOGD("handle : %p", muse_camera);
3357 ret = legacy_camera_attr_get_exposure_mode(muse_camera->camera_handle, &get_value);
3358 if (ret == CAMERA_ERROR_NONE) {
3359 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
3360 MUSE_CAMERA_GET_INT_EXPOSURE_MODE, "get_value", get_value, NULL);
3362 muse_camera_msg_return(api, class, ret, module);
3365 return MUSE_CAMERA_ERROR_NONE;
3368 int camera_dispatcher_attr_get_exposure(muse_module_h module)
3370 int ret = CAMERA_ERROR_NONE;
3371 muse_camera_handle_s *muse_camera = NULL;
3373 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE;
3374 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3376 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3378 LOGD("handle : %p", muse_camera);
3380 ret = legacy_camera_attr_get_exposure(muse_camera->camera_handle, &get_value);
3381 if (ret == CAMERA_ERROR_NONE) {
3382 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
3383 MUSE_CAMERA_GET_INT_EXPOSURE, "get_value", get_value, NULL);
3385 muse_camera_msg_return(api, class, ret, module);
3388 return MUSE_CAMERA_ERROR_NONE;
3391 int camera_dispatcher_attr_get_exposure_range(muse_module_h module)
3393 int ret = CAMERA_ERROR_NONE;
3394 muse_camera_handle_s *muse_camera = NULL;
3397 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE_RANGE;
3398 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3399 muse_camera_get_type_e get_type = MUSE_CAMERA_GET_TYPE_INT_PAIR;
3400 muse_camera_get_int_pair_e index = MUSE_CAMERA_GET_INT_PAIR_EXPOSURE_RANGE;
3402 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3404 LOGD("handle : %p", muse_camera);
3406 ret = legacy_camera_attr_get_exposure_range(muse_camera->camera_handle, &get_value0, &get_value1);
3407 if (ret == CAMERA_ERROR_NONE)
3408 muse_camera_msg_return2(api, class, ret, module, get_type, index, get_value0, get_value1);
3410 muse_camera_msg_return(api, class, ret, module);
3412 return MUSE_CAMERA_ERROR_NONE;
3415 int camera_dispatcher_attr_get_iso(muse_module_h module)
3417 int ret = CAMERA_ERROR_NONE;
3418 muse_camera_handle_s *muse_camera = NULL;
3419 camera_attr_iso_e get_value = CAMERA_ATTR_ISO_AUTO;
3420 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ISO;
3421 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3423 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3425 LOGD("handle : %p", muse_camera);
3427 ret = legacy_camera_attr_get_iso(muse_camera->camera_handle, &get_value);
3428 if (ret == CAMERA_ERROR_NONE) {
3429 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
3430 MUSE_CAMERA_GET_INT_ISO, "get_value", get_value, NULL);
3432 muse_camera_msg_return(api, class, ret, module);
3435 return MUSE_CAMERA_ERROR_NONE;
3438 int camera_dispatcher_attr_get_brightness(muse_module_h module)
3440 int ret = CAMERA_ERROR_NONE;
3441 muse_camera_handle_s *muse_camera = NULL;
3443 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_BRIGHTNESS;
3444 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3446 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3448 LOGD("handle : %p", muse_camera);
3450 ret = legacy_camera_attr_get_brightness(muse_camera->camera_handle, &get_value);
3451 if (ret == CAMERA_ERROR_NONE) {
3452 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
3453 MUSE_CAMERA_GET_INT_BRIGHTNESS, "get_value", get_value, NULL);
3455 muse_camera_msg_return(api, class, ret, module);
3458 return MUSE_CAMERA_ERROR_NONE;
3461 int camera_dispatcher_attr_get_brightness_range(muse_module_h module)
3463 int ret = CAMERA_ERROR_NONE;
3464 muse_camera_handle_s *muse_camera = NULL;
3467 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_BRIGHTNESS_RANGE;
3468 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3469 muse_camera_get_type_e get_type = MUSE_CAMERA_GET_TYPE_INT_PAIR;
3470 muse_camera_get_int_pair_e index = MUSE_CAMERA_GET_INT_PAIR_BRIGHTNESS_RANGE;
3472 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3474 LOGD("handle : %p", muse_camera);
3476 ret = legacy_camera_attr_get_brightness_range(muse_camera->camera_handle, &get_value0, &get_value1);
3477 if (ret == CAMERA_ERROR_NONE)
3478 muse_camera_msg_return2(api, class, ret, module, get_type, index, get_value0, get_value1);
3480 muse_camera_msg_return(api, class, ret, module);
3482 return MUSE_CAMERA_ERROR_NONE;
3485 int camera_dispatcher_attr_get_contrast(muse_module_h module)
3487 int ret = CAMERA_ERROR_NONE;
3488 muse_camera_handle_s *muse_camera = NULL;
3490 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_CONTRAST;
3491 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3493 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3495 LOGD("handle : %p", muse_camera);
3497 ret = legacy_camera_attr_get_contrast(muse_camera->camera_handle, &get_value);
3498 if (ret == CAMERA_ERROR_NONE) {
3499 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
3500 MUSE_CAMERA_GET_INT_CONTRAST, "get_value", get_value, NULL);
3502 muse_camera_msg_return(api, class, ret, module);
3505 return MUSE_CAMERA_ERROR_NONE;
3508 int camera_dispatcher_attr_get_contrast_range(muse_module_h module)
3510 int ret = CAMERA_ERROR_NONE;
3511 muse_camera_handle_s *muse_camera = NULL;
3514 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_CONTRAST_RANGE;
3515 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3516 muse_camera_get_type_e get_type = MUSE_CAMERA_GET_TYPE_INT_PAIR;
3517 muse_camera_get_int_pair_e index = MUSE_CAMERA_GET_INT_PAIR_CONTRAST_RANGE;
3519 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3521 LOGD("handle : %p", muse_camera);
3523 ret = legacy_camera_attr_get_contrast_range(muse_camera->camera_handle, &get_value0, &get_value1);
3524 if (ret == CAMERA_ERROR_NONE)
3525 muse_camera_msg_return2(api, class, ret, module, get_type, index, get_value0, get_value1);
3527 muse_camera_msg_return(api, class, ret, module);
3529 return MUSE_CAMERA_ERROR_NONE;
3532 int camera_dispatcher_attr_get_whitebalance(muse_module_h module)
3534 int ret = CAMERA_ERROR_NONE;
3535 muse_camera_handle_s *muse_camera = NULL;
3536 camera_attr_whitebalance_e get_value = CAMERA_ATTR_WHITE_BALANCE_NONE;
3537 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_WHITEBALANCE;
3538 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3540 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3542 LOGD("handle : %p", muse_camera);
3544 ret = legacy_camera_attr_get_whitebalance(muse_camera->camera_handle, &get_value);
3545 if (ret == CAMERA_ERROR_NONE) {
3546 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
3547 MUSE_CAMERA_GET_INT_WHITE_BALANCE, "get_value", get_value, NULL);
3549 muse_camera_msg_return(api, class, ret, module);
3552 return MUSE_CAMERA_ERROR_NONE;
3555 int camera_dispatcher_attr_get_effect(muse_module_h module)
3557 int ret = CAMERA_ERROR_NONE;
3558 muse_camera_handle_s *muse_camera = NULL;
3559 camera_attr_effect_mode_e get_value = CAMERA_ATTR_EFFECT_NONE;
3560 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EFFECT;
3561 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3563 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3565 LOGD("handle : %p", muse_camera);
3567 ret = legacy_camera_attr_get_effect(muse_camera->camera_handle, &get_value);
3568 if (ret == CAMERA_ERROR_NONE) {
3569 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
3570 MUSE_CAMERA_GET_INT_EFFECT, "get_value", get_value, NULL);
3572 muse_camera_msg_return(api, class, ret, module);
3575 return MUSE_CAMERA_ERROR_NONE;
3578 int camera_dispatcher_attr_get_scene_mode(muse_module_h module)
3580 int ret = CAMERA_ERROR_NONE;
3581 muse_camera_handle_s *muse_camera = NULL;
3582 camera_attr_scene_mode_e get_value = CAMERA_ATTR_SCENE_MODE_NORMAL;
3583 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_SCENE_MODE;
3584 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3586 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3588 LOGD("handle : %p", muse_camera);
3590 ret = legacy_camera_attr_get_scene_mode(muse_camera->camera_handle, &get_value);
3591 if (ret == CAMERA_ERROR_NONE) {
3592 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
3593 MUSE_CAMERA_GET_INT_SCENE_MODE, "get_value", get_value, NULL);
3595 muse_camera_msg_return(api, class, ret, module);
3598 return MUSE_CAMERA_ERROR_NONE;
3601 int camera_dispatcher_attr_is_enabled_tag(muse_module_h module)
3603 int ret = CAMERA_ERROR_NONE;
3604 muse_camera_handle_s *muse_camera = NULL;
3605 bool get_value = false;
3606 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_TAG;
3607 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3609 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3611 LOGD("handle : %p", muse_camera);
3613 ret = legacy_camera_attr_is_enabled_tag(muse_camera->camera_handle, &get_value);
3614 if (ret == CAMERA_ERROR_NONE) {
3615 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
3616 MUSE_CAMERA_GET_INT_ENABLED_TAG, "get_value", get_value, NULL);
3618 muse_camera_msg_return(api, class, ret, module);
3621 return MUSE_CAMERA_ERROR_NONE;
3624 int camera_dispatcher_attr_get_tag_image_description(muse_module_h module)
3626 int ret = CAMERA_ERROR_NONE;
3627 muse_camera_handle_s *muse_camera = NULL;
3628 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_IMAGE_DESCRIPTION;
3629 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3630 char *get_value = NULL;
3632 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3634 ret = legacy_camera_attr_get_tag_image_description(muse_camera->camera_handle, &get_value);
3635 if (ret == CAMERA_ERROR_NONE) {
3636 LOGD("get_description : %s", muse_camera, get_value);
3637 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_STRING,
3638 MUSE_CAMERA_GET_STRING_TAG_IMAGE_DESCRIPTION, "get_value", 0, get_value);
3640 muse_camera_msg_return(api, class, ret, module);
3648 return MUSE_CAMERA_ERROR_NONE;
3651 int camera_dispatcher_attr_get_tag_orientation(muse_module_h module)
3653 int ret = CAMERA_ERROR_NONE;
3654 muse_camera_handle_s *muse_camera = NULL;
3655 camera_attr_tag_orientation_e get_value = CAMERA_ATTR_TAG_ORIENTATION_TOP_LEFT;
3656 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_ORIENTATION;
3657 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3659 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3661 LOGD("handle : %p", muse_camera);
3663 ret = legacy_camera_attr_get_tag_orientation(muse_camera->camera_handle, &get_value);
3664 if (ret == CAMERA_ERROR_NONE) {
3665 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
3666 MUSE_CAMERA_GET_INT_TAG_ORIENTATION, "get_value", get_value, NULL);
3668 muse_camera_msg_return(api, class, ret, module);
3671 return MUSE_CAMERA_ERROR_NONE;
3674 int camera_dispatcher_attr_get_tag_software(muse_module_h module)
3676 int ret = CAMERA_ERROR_NONE;
3677 muse_camera_handle_s *muse_camera = NULL;
3678 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_SOFTWARE;
3679 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3680 char *get_value = NULL;
3682 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3684 ret = legacy_camera_attr_get_tag_software(muse_camera->camera_handle, &get_value);
3685 if (ret == CAMERA_ERROR_NONE) {
3686 LOGD("get_software : %s", get_value);
3687 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_STRING,
3688 MUSE_CAMERA_GET_STRING_TAG_SOFTWARE, "get_value", 0, get_value);
3690 muse_camera_msg_return(api, class, ret, module);
3698 return MUSE_CAMERA_ERROR_NONE;
3701 int camera_dispatcher_attr_get_geotag(muse_module_h module)
3703 int ret = CAMERA_ERROR_NONE;
3704 muse_camera_handle_s *muse_camera = NULL;
3705 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_GEOTAG;
3706 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3707 double get_value[3] = {0.0, 0.0, 0.0};
3708 char *send_msg = NULL;
3709 int msg_array_size = 0;
3711 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3713 LOGD("handle : %p", muse_camera);
3715 ret = legacy_camera_attr_get_geotag(muse_camera->camera_handle, &get_value[0], &get_value[1], &get_value[2]);
3716 if (ret == CAMERA_ERROR_NONE) {
3717 msg_array_size = sizeof(get_value) / sizeof(int) + (sizeof(get_value) % sizeof(int) ? 1 : 0);
3719 send_msg = muse_core_msg_json_factory_new(api,
3720 MUSE_TYPE_INT, PARAM_API_CLASS, class,
3721 MUSE_TYPE_INT, PARAM_RET, ret,
3722 MUSE_TYPE_INT, PARAM_GET_TYPE, MUSE_CAMERA_GET_TYPE_ARRAY,
3723 MUSE_TYPE_ARRAY, "get_value", msg_array_size, get_value,
3726 __camera_dispatcher_send_msg(module, send_msg);
3728 muse_camera_msg_return(api, class, ret, module);
3731 return MUSE_CAMERA_ERROR_NONE;
3734 int camera_dispatcher_attr_get_flash_mode(muse_module_h module)
3736 int ret = CAMERA_ERROR_NONE;
3737 muse_camera_handle_s *muse_camera = NULL;
3738 camera_attr_flash_mode_e get_value = CAMERA_ATTR_FLASH_MODE_OFF;
3739 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_FLASH_MODE;
3740 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3742 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3744 LOGD("handle : %p", muse_camera);
3746 ret = legacy_camera_attr_get_flash_mode(muse_camera->camera_handle, &get_value);
3747 if (ret == CAMERA_ERROR_NONE) {
3748 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
3749 MUSE_CAMERA_GET_INT_FLASH_MODE, "get_value", get_value, NULL);
3751 muse_camera_msg_return(api, class, ret, module);
3754 return MUSE_CAMERA_ERROR_NONE;
3757 int camera_dispatcher_attr_foreach_supported_af_mode(muse_module_h module)
3759 int ret = CAMERA_ERROR_NONE;
3760 muse_camera_handle_s *muse_camera = NULL;
3761 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_AF_MODE;
3762 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
3764 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3766 LOGD("handle : %p", muse_camera);
3768 ret = legacy_camera_attr_foreach_supported_af_mode(muse_camera->camera_handle,
3769 (camera_attr_supported_af_mode_cb)_camera_dispatcher_callback_supported_af_mode,
3772 LOGD("ret : 0x%x", ret);
3774 muse_camera_msg_return(api, class, ret, module);
3776 return MUSE_CAMERA_ERROR_NONE;
3779 int camera_dispatcher_attr_foreach_supported_exposure_mode(muse_module_h module)
3781 int ret = CAMERA_ERROR_NONE;
3782 muse_camera_handle_s *muse_camera = NULL;
3783 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_EXPOSURE_MODE;
3784 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
3786 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3788 LOGD("handle : 0x%x, api : %d", muse_camera, api);
3790 ret = legacy_camera_attr_foreach_supported_exposure_mode(muse_camera->camera_handle,
3791 (camera_attr_supported_exposure_mode_cb)_camera_dispatcher_callback_supported_exposure_mode,
3794 LOGD("ret : 0x%x", ret);
3796 muse_camera_msg_return(api, class, ret, module);
3798 return MUSE_CAMERA_ERROR_NONE;
3801 int camera_dispatcher_attr_foreach_supported_iso(muse_module_h module)
3803 int ret = CAMERA_ERROR_NONE;
3804 muse_camera_handle_s *muse_camera = NULL;
3805 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_ISO;
3806 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
3808 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3810 LOGD("handle : %p", muse_camera);
3812 ret = legacy_camera_attr_foreach_supported_iso(muse_camera->camera_handle,
3813 (camera_attr_supported_iso_cb)_camera_dispatcher_callback_supported_iso_mode,
3816 LOGD("ret : 0x%x", ret);
3818 muse_camera_msg_return(api, class, ret, module);
3820 return MUSE_CAMERA_ERROR_NONE;
3823 int camera_dispatcher_attr_foreach_supported_whitebalance(muse_module_h module)
3825 int ret = CAMERA_ERROR_NONE;
3826 muse_camera_handle_s *muse_camera = NULL;
3827 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_WHITEBALANCE;
3828 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
3830 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3832 LOGD("handle : %p", muse_camera);
3834 ret = legacy_camera_attr_foreach_supported_whitebalance(muse_camera->camera_handle,
3835 (camera_attr_supported_whitebalance_cb)_camera_dispatcher_callback_supported_whitebalance,
3838 LOGD("ret : 0x%x", ret);
3840 muse_camera_msg_return(api, class, ret, module);
3842 return MUSE_CAMERA_ERROR_NONE;
3845 int camera_dispatcher_attr_foreach_supported_effect(muse_module_h module)
3847 int ret = CAMERA_ERROR_NONE;
3848 muse_camera_handle_s *muse_camera = NULL;
3849 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_EFFECT;
3850 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
3852 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3854 LOGD("handle : %p", muse_camera);
3856 ret = legacy_camera_attr_foreach_supported_effect(muse_camera->camera_handle,
3857 (camera_attr_supported_effect_cb)_camera_dispatcher_callback_supported_effect,
3860 LOGD("ret : 0x%x", ret);
3862 muse_camera_msg_return(api, class, ret, module);
3864 return MUSE_CAMERA_ERROR_NONE;
3867 int camera_dispatcher_attr_foreach_supported_scene_mode(muse_module_h module)
3869 int ret = CAMERA_ERROR_NONE;
3870 muse_camera_handle_s *muse_camera = NULL;
3871 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_SCENE_MODE;
3872 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
3874 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3876 LOGD("handle : %p", muse_camera);
3878 ret = legacy_camera_attr_foreach_supported_scene_mode(muse_camera->camera_handle,
3879 (camera_attr_supported_scene_mode_cb)_camera_dispatcher_callback_supported_scene_mode,
3882 LOGD("ret : 0x%x", ret);
3884 muse_camera_msg_return(api, class, ret, module);
3886 return MUSE_CAMERA_ERROR_NONE;
3889 int camera_dispatcher_attr_foreach_supported_flash_mode(muse_module_h module)
3891 int ret = CAMERA_ERROR_NONE;
3892 muse_camera_handle_s *muse_camera = NULL;
3893 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FLASH_MODE;
3894 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
3896 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3898 LOGD("handle : %p", muse_camera);
3900 ret = legacy_camera_attr_foreach_supported_flash_mode(muse_camera->camera_handle,
3901 (camera_attr_supported_flash_mode_cb)_camera_dispatcher_callback_supported_flash_mode,
3904 LOGD("ret : 0x%x", ret);
3906 muse_camera_msg_return(api, class, ret, module);
3908 return MUSE_CAMERA_ERROR_NONE;
3911 int camera_dispatcher_attr_foreach_supported_fps(muse_module_h module)
3913 int ret = CAMERA_ERROR_NONE;
3914 muse_camera_handle_s *muse_camera = NULL;
3915 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FPS;
3916 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
3918 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3920 LOGD("handle : %p", muse_camera);
3922 ret = legacy_camera_attr_foreach_supported_fps(muse_camera->camera_handle,
3923 (camera_attr_supported_fps_cb)_camera_dispatcher_callback_supported_fps,
3926 LOGD("ret : 0x%x", ret);
3928 muse_camera_msg_return(api, class, ret, module);
3930 return MUSE_CAMERA_ERROR_NONE;
3933 int camera_dispatcher_attr_foreach_supported_fps_by_resolution(muse_module_h module)
3935 int ret = CAMERA_ERROR_NONE;
3936 muse_camera_handle_s *muse_camera = NULL;
3937 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FPS_BY_RESOLUTION;
3938 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
3943 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3945 muse_camera_msg_get(value, muse_core_client_get_msg(module));
3947 width = value >> 16;
3948 height = 0x0000ffff & value;
3950 LOGD("handle : %p - %dx%d", muse_camera, width, height);
3952 ret = legacy_camera_attr_foreach_supported_fps_by_resolution(muse_camera->camera_handle,
3954 (camera_attr_supported_fps_cb)_camera_dispatcher_callback_supported_fps_by_resolution,
3957 LOGD("ret : 0x%x", ret);
3959 muse_camera_msg_return(api, class, ret, module);
3961 return MUSE_CAMERA_ERROR_NONE;
3964 int camera_dispatcher_attr_foreach_supported_stream_flip(muse_module_h module)
3966 int ret = CAMERA_ERROR_NONE;
3967 muse_camera_handle_s *muse_camera = NULL;
3968 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_STREAM_FLIP;
3969 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
3971 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3973 LOGD("handle : %p", muse_camera);
3975 ret = legacy_camera_attr_foreach_supported_stream_flip(muse_camera->camera_handle,
3976 (camera_attr_supported_stream_flip_cb)_camera_dispatcher_callback_supported_stream_flip,
3979 LOGD("ret : 0x%x", ret);
3981 muse_camera_msg_return(api, class, ret, module);
3983 return MUSE_CAMERA_ERROR_NONE;
3986 int camera_dispatcher_attr_foreach_supported_stream_rotation(muse_module_h module)
3988 int ret = CAMERA_ERROR_NONE;
3989 muse_camera_handle_s *muse_camera = NULL;
3990 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_STREAM_ROTATION;
3991 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
3993 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3995 LOGD("handle : %p", muse_camera);
3997 ret = legacy_camera_attr_foreach_supported_stream_rotation(muse_camera->camera_handle,
3998 (camera_attr_supported_stream_rotation_cb)_camera_dispatcher_callback_supported_stream_rotation,
4001 LOGD("ret : 0x%x", ret);
4003 muse_camera_msg_return(api, class, ret, module);
4005 return MUSE_CAMERA_ERROR_NONE;
4008 int camera_dispatcher_attr_set_stream_rotation(muse_module_h module)
4010 int ret = CAMERA_ERROR_NONE;
4011 muse_camera_handle_s *muse_camera = NULL;
4012 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_STREAM_ROTATION;
4013 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4016 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4018 muse_camera_msg_get(set_rotation, muse_core_client_get_msg(module));
4020 LOGD("handle : %p", muse_camera);
4022 ret = legacy_camera_attr_set_stream_rotation(muse_camera->camera_handle, (camera_rotation_e)set_rotation);
4024 LOGD("ret : 0x%x", ret);
4026 muse_camera_msg_return(api, class, ret, module);
4028 return MUSE_CAMERA_ERROR_NONE;
4031 int camera_dispatcher_attr_get_stream_rotation(muse_module_h module)
4033 int ret = CAMERA_ERROR_NONE;
4034 muse_camera_handle_s *muse_camera = NULL;
4035 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_STREAM_ROTATION;
4036 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4037 camera_rotation_e get_value = CAMERA_ROTATION_NONE;
4039 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4041 LOGD("handle : %p", muse_camera);
4043 ret = legacy_camera_attr_get_stream_rotation(muse_camera->camera_handle, &get_value);
4044 if (ret == CAMERA_ERROR_NONE) {
4045 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
4046 MUSE_CAMERA_GET_INT_STREAM_ROTATION, "get_value", get_value, NULL);
4048 muse_camera_msg_return(api, class, ret, module);
4051 return MUSE_CAMERA_ERROR_NONE;
4054 int camera_dispatcher_attr_set_stream_flip(muse_module_h module)
4056 int ret = CAMERA_ERROR_NONE;
4057 muse_camera_handle_s *muse_camera = NULL;
4058 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_STREAM_FLIP;
4059 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4062 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4064 muse_camera_msg_get(set_flip, muse_core_client_get_msg(module));
4066 LOGD("handle : %p", muse_camera);
4068 ret = legacy_camera_attr_set_stream_flip(muse_camera->camera_handle, (camera_flip_e)set_flip);
4070 LOGD("ret : 0x%x", ret);
4072 muse_camera_msg_return(api, class, ret, module);
4074 return MUSE_CAMERA_ERROR_NONE;
4077 int camera_dispatcher_attr_get_stream_flip(muse_module_h module)
4079 int ret = CAMERA_ERROR_NONE;
4080 muse_camera_handle_s *muse_camera = NULL;
4081 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_STREAM_FLIP;
4082 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4083 camera_flip_e get_value = CAMERA_FLIP_NONE;
4085 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4087 LOGD("handle : %p", muse_camera);
4089 ret = legacy_camera_attr_get_stream_flip(muse_camera->camera_handle, &get_value);
4090 if (ret == CAMERA_ERROR_NONE) {
4091 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
4092 MUSE_CAMERA_GET_INT_STREAM_FLIP, "get_value", get_value, NULL);
4094 muse_camera_msg_return(api, class, ret, module);
4097 return MUSE_CAMERA_ERROR_NONE;
4100 int camera_dispatcher_attr_set_hdr_mode(muse_module_h module)
4103 muse_camera_handle_s *muse_camera = NULL;
4105 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4107 LOGD("handle : %p", muse_camera);
4109 muse_camera_msg_get(set_mode, muse_core_client_get_msg(module));
4111 _camera_task_add_job(muse_camera, MUSE_CAMERA_API_ATTR_SET_HDR_MODE,
4112 MUSE_CAMERA_API_CLASS_IMMEDIATE, set_mode);
4114 return MUSE_CAMERA_ERROR_NONE;
4117 int camera_dispatcher_attr_get_hdr_mode(muse_module_h module)
4119 int ret = CAMERA_ERROR_NONE;
4120 muse_camera_handle_s *muse_camera = NULL;
4121 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_HDR_MODE;
4122 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4123 camera_attr_hdr_mode_e get_value = CAMERA_ATTR_HDR_MODE_DISABLE;
4125 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4127 LOGD("handle : %p", muse_camera);
4129 ret = legacy_camera_attr_get_hdr_mode(muse_camera->camera_handle, &get_value);
4130 if (ret == CAMERA_ERROR_NONE) {
4131 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
4132 MUSE_CAMERA_GET_INT_HDR_MODE, "get_value", get_value, NULL);
4134 muse_camera_msg_return(api, class, ret, module);
4137 return MUSE_CAMERA_ERROR_NONE;
4140 int camera_dispatcher_attr_is_supported_hdr_capture(muse_module_h module)
4142 int ret = CAMERA_ERROR_NONE;
4143 muse_camera_handle_s *muse_camera = NULL;
4144 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_HDR_CAPTURE;
4145 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4147 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4149 LOGD("handle : %p", muse_camera);
4151 ret = legacy_camera_attr_is_supported_hdr_capture(muse_camera->camera_handle);
4153 LOGD("ret : 0x%x", ret);
4155 muse_camera_msg_return(api, class, ret, module);
4157 return MUSE_CAMERA_ERROR_NONE;
4160 int camera_dispatcher_attr_set_hdr_capture_progress_cb(muse_module_h module)
4162 int ret = CAMERA_ERROR_NONE;
4163 muse_camera_handle_s *muse_camera = NULL;
4164 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_HDR_CAPTURE_PROGRESS_CB;
4165 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4167 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4169 LOGD("handle : %p", muse_camera);
4171 ret = legacy_camera_attr_set_hdr_capture_progress_cb(muse_camera->camera_handle,
4172 (camera_attr_hdr_progress_cb)_camera_dispatcher_hdr_progress_cb,
4175 LOGD("ret : 0x%x", ret);
4177 muse_camera_msg_return(api, class, ret, module);
4179 return MUSE_CAMERA_ERROR_NONE;
4182 int camera_dispatcher_attr_unset_hdr_capture_progress_cb(muse_module_h module)
4184 int ret = CAMERA_ERROR_NONE;
4185 muse_camera_handle_s *muse_camera = NULL;
4186 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_UNSET_HDR_CAPTURE_PROGRESS_CB;
4187 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4189 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4191 LOGD("handle : %p", muse_camera);
4193 ret = legacy_camera_attr_unset_hdr_capture_progress_cb(muse_camera->camera_handle);
4195 LOGD("ret : 0x%x", ret);
4197 muse_camera_msg_return(api, class, ret, module);
4199 return MUSE_CAMERA_ERROR_NONE;
4202 int camera_dispatcher_attr_enable_anti_shake(muse_module_h module)
4204 int ret = CAMERA_ERROR_NONE;
4205 muse_camera_handle_s *muse_camera = NULL;
4206 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_ANTI_SHAKE;
4207 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4210 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4212 muse_camera_msg_get(set_enable, muse_core_client_get_msg(module));
4214 LOGD("handle : %p", muse_camera);
4216 ret = legacy_camera_attr_enable_anti_shake(muse_camera->camera_handle, (bool)set_enable);
4218 LOGD("ret : 0x%x", ret);
4220 muse_camera_msg_return(api, class, ret, module);
4222 return MUSE_CAMERA_ERROR_NONE;
4225 int camera_dispatcher_attr_is_enabled_anti_shake(muse_module_h module)
4227 int ret = CAMERA_ERROR_NONE;
4228 muse_camera_handle_s *muse_camera = NULL;
4229 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_ANTI_SHAKE;
4230 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4231 bool get_value = false;
4233 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4235 LOGD("handle : %p", muse_camera);
4237 ret = legacy_camera_attr_is_enabled_anti_shake(muse_camera->camera_handle, &get_value);
4238 if (ret == CAMERA_ERROR_NONE) {
4239 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
4240 MUSE_CAMERA_GET_INT_ENABLED_ANTI_SHAKE, "get_value", get_value, NULL);
4242 muse_camera_msg_return(api, class, ret, module);
4245 return MUSE_CAMERA_ERROR_NONE;
4248 int camera_dispatcher_attr_is_supported_anti_shake(muse_module_h module)
4250 int ret = CAMERA_ERROR_NONE;
4251 muse_camera_handle_s *muse_camera = NULL;
4252 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_ANTI_SHAKE;
4253 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4255 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4257 LOGD("handle : %p", muse_camera);
4259 ret = legacy_camera_attr_is_supported_anti_shake(muse_camera->camera_handle);
4261 LOGD("ret : 0x%x", ret);
4263 muse_camera_msg_return(api, class, ret, module);
4265 return MUSE_CAMERA_ERROR_NONE;
4268 int camera_dispatcher_attr_enable_video_stabilization(muse_module_h module)
4270 int ret = CAMERA_ERROR_NONE;
4271 muse_camera_handle_s *muse_camera = NULL;
4272 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_VIDEO_STABILIZATION;
4273 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4276 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4278 muse_camera_msg_get(set_enable, muse_core_client_get_msg(module));
4280 LOGD("handle : %p", muse_camera);
4282 ret = legacy_camera_attr_enable_video_stabilization(muse_camera->camera_handle, (bool)set_enable);
4284 LOGD("ret : 0x%x", ret);
4286 muse_camera_msg_return(api, class, ret, module);
4288 return MUSE_CAMERA_ERROR_NONE;
4291 int camera_dispatcher_attr_is_enabled_video_stabilization(muse_module_h module)
4293 int ret = CAMERA_ERROR_NONE;
4294 muse_camera_handle_s *muse_camera = NULL;
4295 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_VIDEO_STABILIZATION;
4296 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4297 bool get_value = false;
4299 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4301 LOGD("handle : %p", muse_camera);
4303 ret = legacy_camera_attr_is_enabled_video_stabilization(muse_camera->camera_handle, &get_value);
4304 if (ret == CAMERA_ERROR_NONE) {
4305 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
4306 MUSE_CAMERA_GET_INT_ENABLED_VIDEO_STABILIZATION, "get_value", get_value, NULL);
4308 muse_camera_msg_return(api, class, ret, module);
4311 return MUSE_CAMERA_ERROR_NONE;
4314 int camera_dispatcher_attr_is_supported_video_stabilization(muse_module_h module)
4316 int ret = CAMERA_ERROR_NONE;
4317 muse_camera_handle_s *muse_camera = NULL;
4318 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_VIDEO_STABILIZATION;
4319 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4321 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4323 LOGD("handle : %p", muse_camera);
4325 ret = legacy_camera_attr_is_supported_video_stabilization(muse_camera->camera_handle);
4327 LOGD("ret : 0x%x", ret);
4329 muse_camera_msg_return(api, class, ret, module);
4331 return MUSE_CAMERA_ERROR_NONE;
4334 int camera_dispatcher_attr_enable_auto_contrast(muse_module_h module)
4336 int ret = CAMERA_ERROR_NONE;
4337 muse_camera_handle_s *muse_camera = NULL;
4338 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_AUTO_CONTRAST;
4339 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4342 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4344 muse_camera_msg_get(set_enable, muse_core_client_get_msg(module));
4346 LOGD("handle : %p", muse_camera);
4348 ret = legacy_camera_attr_enable_auto_contrast(muse_camera->camera_handle, (bool)set_enable);
4350 LOGD("ret : 0x%x", ret);
4352 muse_camera_msg_return(api, class, ret, module);
4354 return MUSE_CAMERA_ERROR_NONE;
4357 int camera_dispatcher_attr_is_enabled_auto_contrast(muse_module_h module)
4359 int ret = CAMERA_ERROR_NONE;
4360 muse_camera_handle_s *muse_camera = NULL;
4361 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_AUTO_CONTRAST;
4362 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4363 bool get_value = false;
4365 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4367 LOGD("handle : %p", muse_camera);
4369 ret = legacy_camera_attr_is_enabled_auto_contrast(muse_camera->camera_handle, &get_value);
4370 if (ret == CAMERA_ERROR_NONE) {
4371 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
4372 MUSE_CAMERA_GET_INT_ENABLED_AUTO_CONTRAST, "get_value", get_value, NULL);
4374 muse_camera_msg_return(api, class, ret, module);
4377 return MUSE_CAMERA_ERROR_NONE;
4380 int camera_dispatcher_attr_is_supported_auto_contrast(muse_module_h module)
4382 int ret = CAMERA_ERROR_NONE;
4383 muse_camera_handle_s *muse_camera = NULL;
4384 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_AUTO_CONTRAST;
4385 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4387 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4389 LOGD("handle : %p", muse_camera);
4391 ret = legacy_camera_attr_is_supported_auto_contrast(muse_camera->camera_handle);
4393 LOGD("ret : 0x%x", ret);
4395 muse_camera_msg_return(api, class, ret, module);
4397 return MUSE_CAMERA_ERROR_NONE;
4400 int camera_dispatcher_attr_disable_shutter_sound(muse_module_h module)
4402 int ret = CAMERA_ERROR_NONE;
4403 muse_camera_handle_s *muse_camera = NULL;
4404 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_DISABLE_SHUTTER_SOUND;
4405 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4408 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4410 muse_camera_msg_get(set_disable, muse_core_client_get_msg(module));
4412 LOGD("handle : %p", muse_camera);
4414 ret = legacy_camera_attr_disable_shutter_sound(muse_camera->camera_handle, (bool)set_disable);
4416 LOGD("ret : 0x%x", ret);
4418 muse_camera_msg_return(api, class, ret, module);
4420 return MUSE_CAMERA_ERROR_NONE;
4423 int camera_dispatcher_attr_get_encoded_preview_bitrate(muse_module_h module)
4425 int ret = CAMERA_ERROR_NONE;
4426 muse_camera_handle_s *muse_camera = NULL;
4428 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ENCODED_PREVIEW_BITRATE;
4429 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4431 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4433 LOGD("handle : %p", muse_camera);
4435 ret = legacy_camera_attr_get_encoded_preview_bitrate(muse_camera->camera_handle, &get_value);
4436 if (ret == CAMERA_ERROR_NONE) {
4437 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
4438 MUSE_CAMERA_GET_INT_ENCODED_PREVIEW_BITRATE, "get_value", get_value, NULL);
4440 muse_camera_msg_return(api, class, ret, module);
4443 return MUSE_CAMERA_ERROR_NONE;
4446 int camera_dispatcher_attr_set_encoded_preview_bitrate(muse_module_h module)
4448 int ret = CAMERA_ERROR_NONE;
4449 muse_camera_handle_s *muse_camera = NULL;
4451 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ENCODED_PREVIEW_BITRATE;
4452 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4454 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4456 muse_camera_msg_get(set_bitrate, muse_core_client_get_msg(module));
4458 LOGD("handle : 0x%x, set_encoded_preview_bitrate : %d", muse_camera, set_bitrate);
4460 ret = legacy_camera_attr_set_encoded_preview_bitrate(muse_camera->camera_handle, set_bitrate);
4462 LOGD("ret : 0x%x", ret);
4464 muse_camera_msg_return(api, class, ret, module);
4466 return MUSE_CAMERA_ERROR_NONE;
4469 int camera_dispatcher_attr_get_encoded_preview_gop_interval(muse_module_h module)
4471 int ret = CAMERA_ERROR_NONE;
4472 muse_camera_handle_s *muse_camera = NULL;
4474 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ENCODED_PREVIEW_GOP_INTERVAL;
4475 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4477 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4479 LOGD("handle : %p", muse_camera);
4481 ret = legacy_camera_attr_get_encoded_preview_gop_interval(muse_camera->camera_handle, &get_value);
4482 if (ret == CAMERA_ERROR_NONE) {
4483 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
4484 MUSE_CAMERA_GET_INT_ENCODED_PREVIEW_GOP_INTERVAL, "get_value", get_value, NULL);
4486 muse_camera_msg_return(api, class, ret, module);
4489 return MUSE_CAMERA_ERROR_NONE;
4492 int camera_dispatcher_attr_set_encoded_preview_gop_interval(muse_module_h module)
4494 int ret = CAMERA_ERROR_NONE;
4495 muse_camera_handle_s *muse_camera = NULL;
4496 int set_gop_interval;
4497 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ENCODED_PREVIEW_GOP_INTERVAL;
4498 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4500 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4502 muse_camera_msg_get(set_gop_interval, muse_core_client_get_msg(module));
4504 LOGD("handle : 0x%x, set_encoded_preview_gop_interval : %d", muse_camera, set_gop_interval);
4506 ret = legacy_camera_attr_set_encoded_preview_gop_interval(muse_camera->camera_handle, set_gop_interval);
4508 LOGD("ret : 0x%x", ret);
4510 muse_camera_msg_return(api, class, ret, module);
4512 return MUSE_CAMERA_ERROR_NONE;
4515 int camera_dispatcher_attr_set_pan(muse_module_h module)
4517 int ret = CAMERA_ERROR_NONE;
4518 muse_camera_handle_s *muse_camera = NULL;
4522 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_PAN;
4523 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4525 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4527 muse_camera_msg_get(value, muse_core_client_get_msg(module));
4530 step = 0x0000ffff & value;
4532 LOGD("handle : 0x%x - type %d, step %d", muse_camera, type, step);
4534 ret = legacy_camera_attr_set_pan(muse_camera->camera_handle, type, step);
4536 LOGD("ret : 0x%x", ret);
4538 muse_camera_msg_return(api, class, ret, module);
4540 return MUSE_CAMERA_ERROR_NONE;
4543 int camera_dispatcher_attr_get_pan(muse_module_h module)
4545 int ret = CAMERA_ERROR_NONE;
4546 muse_camera_handle_s *muse_camera = NULL;
4548 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_PAN;
4549 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4551 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4553 LOGD("handle : %p", muse_camera);
4555 ret = legacy_camera_attr_get_pan(muse_camera->camera_handle, &get_value);
4556 if (ret == CAMERA_ERROR_NONE) {
4557 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
4558 MUSE_CAMERA_GET_INT_PAN, "get_value", get_value, NULL);
4560 muse_camera_msg_return(api, class, ret, module);
4563 return MUSE_CAMERA_ERROR_NONE;
4566 int camera_dispatcher_attr_get_pan_range(muse_module_h module)
4568 int ret = CAMERA_ERROR_NONE;
4569 muse_camera_handle_s *muse_camera = NULL;
4572 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_PAN_RANGE;
4573 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4574 muse_camera_get_type_e get_type = MUSE_CAMERA_GET_TYPE_INT_PAIR;
4575 muse_camera_get_int_pair_e index = MUSE_CAMERA_GET_INT_PAIR_PAN_RANGE;
4577 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4579 LOGD("handle : %p", muse_camera);
4581 ret = legacy_camera_attr_get_pan_range(muse_camera->camera_handle, &get_value0, &get_value1);
4582 if (ret == CAMERA_ERROR_NONE)
4583 muse_camera_msg_return2(api, class, ret, module, get_type, index, get_value0, get_value1);
4585 muse_camera_msg_return(api, class, ret, module);
4587 return MUSE_CAMERA_ERROR_NONE;
4590 int camera_dispatcher_attr_set_tilt(muse_module_h module)
4592 int ret = CAMERA_ERROR_NONE;
4593 muse_camera_handle_s *muse_camera = NULL;
4597 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TILT;
4598 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4600 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4602 muse_camera_msg_get(value, muse_core_client_get_msg(module));
4605 step = 0x0000ffff & value;
4607 LOGD("handle : 0x%x - type %d, step %d", muse_camera, type, step);
4609 ret = legacy_camera_attr_set_tilt(muse_camera->camera_handle, type, step);
4611 LOGD("ret : 0x%x", ret);
4613 muse_camera_msg_return(api, class, ret, module);
4615 return MUSE_CAMERA_ERROR_NONE;
4618 int camera_dispatcher_attr_get_tilt(muse_module_h module)
4620 int ret = CAMERA_ERROR_NONE;
4621 muse_camera_handle_s *muse_camera = NULL;
4623 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TILT;
4624 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4626 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4628 LOGD("handle : %p", muse_camera);
4630 ret = legacy_camera_attr_get_tilt(muse_camera->camera_handle, &get_value);
4631 if (ret == CAMERA_ERROR_NONE) {
4632 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
4633 MUSE_CAMERA_GET_INT_TILT, "get_value", get_value, NULL);
4635 muse_camera_msg_return(api, class, ret, module);
4638 return MUSE_CAMERA_ERROR_NONE;
4641 int camera_dispatcher_attr_get_tilt_range(muse_module_h module)
4643 int ret = CAMERA_ERROR_NONE;
4644 muse_camera_handle_s *muse_camera = NULL;
4647 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TILT_RANGE;
4648 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4649 muse_camera_get_type_e get_type = MUSE_CAMERA_GET_TYPE_INT_PAIR;
4650 muse_camera_get_int_pair_e index = MUSE_CAMERA_GET_INT_PAIR_TILT_RANGE;
4652 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4654 LOGD("handle : %p", muse_camera);
4656 ret = legacy_camera_attr_get_tilt_range(muse_camera->camera_handle, &get_value0, &get_value1);
4657 if (ret == CAMERA_ERROR_NONE)
4658 muse_camera_msg_return2(api, class, ret, module, get_type, index, get_value0, get_value1);
4660 muse_camera_msg_return(api, class, ret, module);
4662 return MUSE_CAMERA_ERROR_NONE;
4665 int camera_dispatcher_attr_set_ptz_type(muse_module_h module)
4667 int ret = CAMERA_ERROR_NONE;
4668 muse_camera_handle_s *muse_camera = NULL;
4669 int set_ptz_type = 0;
4670 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_PTZ_TYPE;
4671 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4673 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4675 muse_camera_msg_get(set_ptz_type, muse_core_client_get_msg(module));
4677 LOGD("handle : 0x%x", muse_camera);
4679 ret = legacy_camera_attr_set_ptz_type(muse_camera->camera_handle, set_ptz_type);
4681 LOGD("ret : 0x%x", ret);
4683 muse_camera_msg_return(api, class, ret, module);
4685 return MUSE_CAMERA_ERROR_NONE;
4688 int camera_dispatcher_attr_foreach_supported_ptz_type(muse_module_h module)
4690 int ret = CAMERA_ERROR_NONE;
4691 muse_camera_handle_s *muse_camera = NULL;
4692 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_PTZ_TYPE;
4693 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
4695 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4697 LOGD("handle : %p", muse_camera);
4699 ret = legacy_camera_attr_foreach_supported_ptz_type(muse_camera->camera_handle,
4700 (camera_attr_supported_ptz_type_cb)_camera_dispatcher_callback_supported_ptz_type,
4703 LOGD("ret : 0x%x", ret);
4705 muse_camera_msg_return(api, class, ret, module);
4707 return MUSE_CAMERA_ERROR_NONE;
4710 int camera_dispatcher_attr_set_display_roi_area(muse_module_h module)
4712 int ret = CAMERA_ERROR_NONE;
4713 muse_camera_handle_s *muse_camera = NULL;
4714 int set_display_roi_area[4] = {0,};
4715 muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY_ROI_AREA;
4716 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4718 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4720 muse_camera_msg_get_array(set_display_roi_area, muse_core_client_get_msg(module));
4722 LOGD("handle : 0x%x, x : %d, y : %d, width : %d, height : %d", muse_camera,
4723 set_display_roi_area[0], set_display_roi_area[1], set_display_roi_area[2], set_display_roi_area[3]);
4725 ret = legacy_camera_attr_set_display_roi_area(muse_camera->camera_handle, set_display_roi_area);
4727 LOGD("ret : 0x%x", ret);
4729 muse_camera_msg_return(api, class, ret, module);
4731 return MUSE_CAMERA_ERROR_NONE;
4734 int camera_dispatcher_attr_get_display_roi_area(muse_module_h module)
4736 int ret = CAMERA_ERROR_NONE;
4737 muse_camera_handle_s *muse_camera = NULL;
4738 int get_value[4] = {0,};
4739 muse_camera_api_e api = MUSE_CAMERA_API_GET_DISPLAY_ROI_AREA;
4740 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4741 char *send_msg = NULL;
4743 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4745 LOGD("handle : %p", muse_camera);
4747 ret = legacy_camera_attr_get_display_roi_area(muse_camera->camera_handle, get_value);
4748 if (ret == CAMERA_ERROR_NONE) {
4749 send_msg = muse_core_msg_json_factory_new(api,
4750 MUSE_TYPE_INT, PARAM_API_CLASS, class,
4751 MUSE_TYPE_INT, PARAM_RET, ret,
4752 MUSE_TYPE_INT, PARAM_GET_TYPE, MUSE_CAMERA_GET_TYPE_ARRAY,
4753 MUSE_TYPE_ARRAY, "get_value", 4, get_value,
4756 __camera_dispatcher_send_msg(module, send_msg);
4758 muse_camera_msg_return(api, class, ret, module);
4761 return MUSE_CAMERA_ERROR_NONE;
4765 int camera_dispatcher_return_buffer(muse_module_h module)
4768 muse_camera_handle_s *muse_camera = NULL;
4770 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4772 muse_camera_msg_get(tbm_key, muse_core_client_get_msg(module));
4774 /*LOGD("handle : %p, key : %d", muse_camera, tbm_key);*/
4776 if (!_camera_remove_export_data(module, tbm_key, FALSE))
4777 LOGE("remove export data failed : key %d", tbm_key);
4779 return MUSE_CAMERA_ERROR_NONE;
4782 int camera_dispatcher_preview_cb_return(muse_module_h module)
4784 muse_camera_handle_s *muse_camera = NULL;
4786 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4788 if (muse_camera == NULL) {
4789 LOGE("NULL handle");
4790 return MUSE_CAMERA_ERROR_NONE;
4795 g_mutex_lock(&muse_camera->preview_cb_lock);
4796 g_cond_signal(&muse_camera->preview_cb_cond);
4797 /*LOGD("send signal for preview callback");*/
4798 g_mutex_unlock(&muse_camera->preview_cb_lock);
4802 return MUSE_CAMERA_ERROR_NONE;
4805 int camera_dispatcher_set_display_reuse_hint(muse_module_h module)
4807 int ret = CAMERA_ERROR_NONE;
4809 muse_camera_handle_s *muse_camera = NULL;
4810 muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY_REUSE_HINT;
4811 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4813 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4815 muse_camera_msg_get(set_hint, muse_core_client_get_msg(module));
4817 LOGD("set hint : %d", set_hint);
4819 ret = legacy_camera_set_display_reuse_hint(muse_camera->camera_handle, (bool)set_hint);
4821 muse_camera_msg_return(api, class, ret, module);
4823 return MUSE_CAMERA_ERROR_NONE;
4826 int camera_dispatcher_get_display_reuse_hint(muse_module_h module)
4828 int ret = CAMERA_ERROR_NONE;
4830 muse_camera_handle_s *muse_camera = NULL;
4831 muse_camera_api_e api = MUSE_CAMERA_API_GET_DISPLAY_REUSE_HINT;
4832 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4834 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4836 ret = legacy_camera_get_display_reuse_hint(muse_camera->camera_handle, &get_value);
4837 if (ret == CAMERA_ERROR_NONE) {
4838 LOGD("hint : %d", get_value);
4839 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
4840 MUSE_CAMERA_GET_INT_DISPLAY_REUSE_HINT, "get_value", get_value, NULL);
4842 muse_camera_msg_return(api, class, ret, module);
4845 return MUSE_CAMERA_ERROR_NONE;
4848 int camera_dispatcher_get_device_state(muse_module_h module)
4850 int ret = CAMERA_ERROR_NONE;
4851 bool is_called = false;
4852 char value_key[KEY_LENGTH] = {'\0',};
4853 camera_h camera = NULL;
4854 camera_device_e device_type = CAMERA_DEVICE_CAMERA0;
4855 camera_device_state_e get_device_state = CAMERA_DEVICE_STATE_NULL;
4856 muse_camera_api_e api = MUSE_CAMERA_API_GET_DEVICE_STATE;
4857 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4859 muse_camera_msg_get(device_type, muse_core_client_get_msg(module));
4861 if (device_type < CAMERA_DEVICE_CAMERA0 || device_type > CAMERA_DEVICE_CAMERA1) {
4862 LOGE("invalid device %d", device_type);
4864 ret = CAMERA_ERROR_INVALID_PARAMETER;
4865 muse_camera_msg_return(api, class, ret, module);
4867 return MUSE_CAMERA_ERROR_NONE;
4870 muse_core_client_get_value(module, MUSED_KEY_DEVICE_STATE_CHECK, (int *)&is_called);
4873 ret = legacy_camera_create(device_type, &camera);
4875 legacy_camera_destroy(camera);
4879 muse_core_client_set_value(module, MUSED_KEY_DEVICE_STATE_RETURN, ret);
4880 muse_core_client_set_value(module, MUSED_KEY_DEVICE_STATE_CHECK, (int)true);
4882 muse_core_client_get_value(module, MUSED_KEY_DEVICE_STATE_RETURN, &ret);
4885 LOGD("is_called %d, ret 0x%x", is_called, ret);
4887 if (ret != CAMERA_ERROR_NONE) {
4888 LOGE("failed to create camera handle 0x%x", ret);
4890 muse_camera_msg_return(api, class, ret, module);
4892 return MUSE_CAMERA_ERROR_NONE;
4895 snprintf(value_key, KEY_LENGTH, "device_state_camera%d", device_type);
4896 muse_core_client_get_value(module, value_key, (int *)&get_device_state);
4898 LOGD("device[%d] state : %d", device_type, get_device_state);
4900 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
4901 -1, "get_device_state", get_device_state, NULL);
4903 return MUSE_CAMERA_ERROR_NONE;
4906 int (*dispatcher[MUSE_CAMERA_API_MAX]) (muse_module_h module) = {
4907 camera_dispatcher_create, /* MUSE_CAMERA_API_CREATE */
4908 camera_dispatcher_destroy, /* MUSE_CAMERA_API_DESTROY */
4909 camera_dispatcher_start_preview, /* MUSE_CAMERA_START_PREVIEW */
4910 camera_dispatcher_stop_preview, /* MUSE_CAMERA_API_START_PREVIEW */
4911 camera_dispatcher_start_capture, /* MUSE_CAMERA_START_CAPTURE */
4912 camera_dispatcher_is_supported_continuous_capture, /* MUSE_CAMERA_API_SUPPORT_CONTINUOUS_CAPTURE */
4913 camera_dispatcher_start_continuous_capture, /* MUSE_CAMERA_API_START_CONTINUOUS_CAPTURE, */
4914 camera_dispatcher_stop_continuous_capture, /* MUSE_CAMERA_API_STOP_CONTINUOUS_CAPTURE, */
4915 camera_dispatcher_is_supported_face_detection, /* MUSE_CAMERA_API_SUPPORT_FACE_DETECTION, */
4916 camera_dispatcher_is_supported_zero_shutter_lag, /* MUSE_CAMERA_API_SUPPORT_ZERO_SHUTTER_LAG, */
4917 camera_dispatcher_is_supported_media_packet_preview_cb, /* MUSE_CAMERA_API_SUPPORT_MEDIA_PACKET_PREVIEW_CB, */
4918 camera_dispatcher_get_device_count, /* MUSE_CAMERA_API_GET_DEVICE_COUNT, */
4919 camera_dispatcher_start_face_detection, /* MUSE_CAMERA_API_START_FACE_DETECTION, */
4920 camera_dispatcher_stop_face_detection, /* MUSE_CAMERA_API_STOP_FACE_DETECTION, */
4921 camera_dispatcher_get_state, /* MUSE_CAMERA_API_GET_STATE, */
4922 camera_dispatcher_start_focusing, /* MUSE_CAMERA_API_START_FOCUSING, */
4923 camera_dispatcher_stop_focusing, /* MUSE_CAMERA_API_CANCEL_FOCUSING, */
4924 camera_dispatcher_set_display, /* MUSE_CAMERA_API_SET_DISPLAY, */
4925 camera_dispatcher_set_preview_resolution, /* MUSE_CAMERA_API_SET_PREVIEW_RESOLUTION, */
4926 camera_dispatcher_set_capture_resolution, /* MUSE_CAMERA_API_SET_CAPTURE_RESOLUTION, */
4927 camera_dispatcher_set_capture_format, /* MUSE_CAMERA_API_SET_CAPTURE_FORMAT, */
4928 camera_dispatcher_set_preview_format, /* MUSE_CAMERA_API_SET_PREVIEW_FORMAT, */
4929 camera_dispatcher_get_preview_resolution, /* MUSE_CAMERA_API_GET_PREVIEW_RESOLUTION, */
4930 camera_dispatcher_set_display_rotation, /* MUSE_CAMERA_API_SET_DISPLAY_ROTATION, */
4931 camera_dispatcher_get_display_rotation, /* MUSE_CAMERA_API_GET_DISPLAY_ROTATION, */
4932 camera_dispatcher_set_display_flip, /* MUSE_CAMERA_API_SET_DISPLAY_FLIP, */
4933 camera_dispatcher_get_display_flip, /* MUSE_CAMERA_API_GET_DISPLAY_FLIP, */
4934 camera_dispatcher_set_display_visible, /* MUSE_CAMERA_API_SET_DISPLAY_VISIBLE, */
4935 camera_dispatcher_is_display_visible, /* MUSE_CAMERA_API_IS_DISPLAY_VISIBLE, */
4936 camera_dispatcher_set_display_mode, /* MUSE_CAMERA_API_SET_DISPLAY_MODE, */
4937 camera_dispatcher_get_display_mode, /* MUSE_CAMERA_API_GET_DISPLAY_MODE, */
4938 camera_dispatcher_get_capture_resolution, /* MUSE_CAMERA_API_GET_CAPTURE_RESOLUTION, */
4939 camera_dispatcher_get_capture_format, /* MUSE_CAMERA_API_GET_CAPTURE_FORMAT, */
4940 camera_dispatcher_get_preview_format, /* MUSE_CAMERA_API_GET_PREVIEW_FORMAT, */
4941 camera_dispatcher_get_facing_direction, /* MUSE_CAMERA_API_GET_FACING_DIRECTION, */
4942 camera_dispatcher_get_flash_state, /* MUSE_CAMERA_API_GET_FLASH_STATE, */
4943 camera_dispatcher_set_preview_cb, /* MUSE_CAMERA_API_SET_PREVIEW_CB, */
4944 camera_dispatcher_unset_preview_cb, /* MUSE_CAMERA_API_UNSET_PREVIEW_CB, */
4945 camera_dispatcher_set_media_packet_preview_cb, /* MUSE_CAMERA_API_SET_MEDIA_PACKET_PREVIEW_CB, */
4946 camera_dispatcher_unset_media_packet_preview_cb, /* MUSE_CAMERA_API_UNSET_MEDIA_PACKET_PREVIEW_CB, */
4947 camera_dispatcher_set_state_changed_cb, /* MUSE_CAMERA_API_SET_STATE_CHANGED_CB, */
4948 camera_dispatcher_unset_state_changed_cb, /* MUSE_CAMERA_API_UNSET_STATE_CHANGED_CB, */
4949 camera_dispatcher_set_interrupted_cb, /* MUSE_CAMERA_API_SET_INTERRUPTED_CB, */
4950 camera_dispatcher_unset_interrupted_cb, /* MUSE_CAMERA_API_UNSET_INTERRUPTED_CB, */
4951 camera_dispatcher_set_focus_changed_cb, /* MUSE_CAMERA_API_SET_FOCUS_CHANGED_CB, */
4952 camera_dispatcher_unset_focus_changed_cb, /* MUSE_CAMERA_API_UNSET_FOCUS_CHANGED_CB, */
4953 camera_dispatcher_set_error_cb, /* MUSE_CAMERA_API_SET_ERROR_CB, */
4954 camera_dispatcher_unset_error_cb, /* MUSE_CAMERA_API_UNSET_ERROR_CB, */
4955 camera_dispatcher_foreach_supported_preview_resolution, /* MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_PREVIEW_RESOLUTION, */
4956 camera_dispatcher_foreach_supported_capture_resolution, /* MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_CAPTURE_RESOLUTION, */
4957 camera_dispatcher_foreach_supported_capture_format, /* MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_CAPTURE_FORMAT, */
4958 camera_dispatcher_foreach_supported_preview_format, /* MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_PREVIEW_FORMAT, */
4959 camera_dispatcher_get_recommended_preview_resolution, /* MUSE_CAMERA_API_GET_RECOMMENDED_PREVIEW_RESOLUTION, */
4960 camera_dispatcher_attr_get_lens_orientation, /* MUSE_CAMERA_API_ATTR_GET_LENS_ORIENTATION, */
4961 camera_dispatcher_attr_set_theater_mode, /* MUSE_CAMERA_API_ATTR_SET_THEATER_MODE, */
4962 camera_dispatcher_attr_get_theater_mode, /* MUSE_CAMERA_API_ATTR_GET_THEATER_MODE, */
4963 camera_dispatcher_attr_foreach_supported_theater_mode, /* MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_THEATER_MODE, */
4964 camera_dispatcher_attr_set_preview_fps, /* MUSE_CAMERA_API_ATTR_SET_PREVIEW_FPS, */
4965 camera_dispatcher_attr_set_image_quality, /* MUSE_CAMERA_API_ATTR_SET_IMAGE_QUALITY, */
4966 camera_dispatcher_attr_get_preview_fps, /* MUSE_CAMERA_API_ATTR_GET_PREVIEW_FPS, */
4967 camera_dispatcher_attr_get_image_quality, /* MUSE_CAMERA_API_ATTR_GET_IMAGE_QUALITY, */
4968 camera_dispatcher_attr_set_zoom, /* MUSE_CAMERA_API_ATTR_SET_ZOOM, */
4969 camera_dispatcher_attr_set_af_mode, /* MUSE_CAMERA_API_ATTR_SET_AF_MODE, */
4970 camera_dispatcher_attr_set_af_area, /* MUSE_CAMERA_API_ATTR_SET_AF_AREA, */
4971 camera_dispatcher_attr_clear_af_area, /* MUSE_CAMERA_API_ATTR_CLEAR_AF_AREA, */
4972 camera_dispatcher_attr_set_exposure_mode, /* MUSE_CAMERA_API_ATTR_SET_EXPOSURE_MODE, */
4973 camera_dispatcher_attr_set_exposure, /* MUSE_CAMERA_API_ATTR_SET_EXPOSURE, */
4974 camera_dispatcher_attr_set_iso, /* MUSE_CAMERA_API_ATTR_SET_ISO, */
4975 camera_dispatcher_attr_set_brightness, /* MUSE_CAMERA_API_ATTR_SET_BRIGHTNESS, */
4976 camera_dispatcher_attr_set_contrast, /* MUSE_CAMERA_API_ATTR_SET_CONTRAST, */
4977 camera_dispatcher_attr_set_whitebalance, /* MUSE_CAMERA_API_ATTR_SET_WHITEBALANCE, */
4978 camera_dispatcher_attr_set_effect, /* MUSE_CAMERA_API_ATTR_SET_EFFECT, */
4979 camera_dispatcher_attr_set_scene_mode, /* MUSE_CAMERA_API_ATTR_SET_SCENE_MODE, */
4980 camera_dispatcher_attr_enable_tag, /* MUSE_CAMERA_API_ATTR_ENABLE_TAG, */
4981 camera_dispatcher_attr_set_tag_image_description, /* MUSE_CAMERA_API_ATTR_SET_TAG_IMAGE_DESCRIPTION, */
4982 camera_dispatcher_attr_set_tag_orientation, /* MUSE_CAMERA_API_ATTR_SET_TAG_ORIENTATION, */
4983 camera_dispatcher_attr_set_tag_software, /* MUSE_CAMERA_API_ATTR_SET_TAG_SOFTWARE, */
4984 camera_dispatcher_attr_set_geotag, /* MUSE_CAMERA_API_ATTR_SET_GEOTAG, */
4985 camera_dispatcher_attr_remove_geotag, /* MUSE_CAMERA_API_ATTR_REMOVE_GEOTAG, */
4986 camera_dispatcher_attr_set_flash_mode, /* MUSE_CAMERA_API_ATTR_SET_FLASH_MODE, */
4987 camera_dispatcher_attr_get_zoom, /* MUSE_CAMERA_API_ATTR_GET_ZOOM, */
4988 camera_dispatcher_attr_get_zoom_range, /* MUSE_CAMERA_API_ATTR_GET_ZOOM_RANGE, */
4989 camera_dispatcher_attr_get_af_mode, /* MUSE_CAMERA_API_ATTR_GET_AF_MODE, */
4990 camera_dispatcher_attr_get_exposure_mode, /* MUSE_CAMERA_API_ATTR_GET_EXPOSURE_MODE, */
4991 camera_dispatcher_attr_get_exposure, /* MUSE_CAMERA_API_ATTR_GET_EXPOSURE, */
4992 camera_dispatcher_attr_get_exposure_range, /* MUSE_CAMERA_API_ATTR_GET_EXPOSURE_RANGE, */
4993 camera_dispatcher_attr_get_iso, /* MUSE_CAMERA_API_ATTR_GET_ISO, */
4994 camera_dispatcher_attr_get_brightness, /* MUSE_CAMERA_API_ATTR_GET_BRIGHTNESS, */
4995 camera_dispatcher_attr_get_brightness_range, /* MUSE_CAMERA_API_ATTR_GET_BRIGHTNESS_RANGE, */
4996 camera_dispatcher_attr_get_contrast, /* MUSE_CAMERA_API_ATTR_GET_CONTRAST, */
4997 camera_dispatcher_attr_get_contrast_range, /* MUSE_CAMERA_API_ATTR_GET_CONTRAST_RANGE, */
4998 camera_dispatcher_attr_get_whitebalance, /* MUSE_CAMERA_API_ATTR_GET_WHITEBALANCE, */
4999 camera_dispatcher_attr_get_effect, /* MUSE_CAMERA_API_ATTR_GET_EFFECT, */
5000 camera_dispatcher_attr_get_scene_mode, /* MUSE_CAMERA_API_ATTR_GET_SCENE_MODE, */
5001 camera_dispatcher_attr_is_enabled_tag, /* MUSE_CAMERA_API_ATTR_IS_ENABLED_TAG, */
5002 camera_dispatcher_attr_get_tag_image_description, /* MUSE_CAMERA_API_ATTR_GET_TAG_IMAGE_DESCRIPTION, */
5003 camera_dispatcher_attr_get_tag_orientation, /* MUSE_CAMERA_API_ATTR_GET_TAG_ORIENTATION, */
5004 camera_dispatcher_attr_get_tag_software, /* MUSE_CAMERA_API_ATTR_GET_TAG_SOFTWARE, */
5005 camera_dispatcher_attr_get_geotag, /* MUSE_CAMERA_API_ATTR_GET_GEOTAG, */
5006 camera_dispatcher_attr_get_flash_mode, /* MUSE_CAMERA_API_ATTR_GET_FLASH_MODE, */
5007 camera_dispatcher_attr_foreach_supported_af_mode, /* MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_AF_MODE, */
5008 camera_dispatcher_attr_foreach_supported_exposure_mode, /* MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_EXPOSURE_MODE, */
5009 camera_dispatcher_attr_foreach_supported_iso, /* MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_ISO, */
5010 camera_dispatcher_attr_foreach_supported_whitebalance, /* MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_WHITEBALANCE, */
5011 camera_dispatcher_attr_foreach_supported_effect, /* MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_EFFECT, */
5012 camera_dispatcher_attr_foreach_supported_scene_mode, /* MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_SCENE_MODE, */
5013 camera_dispatcher_attr_foreach_supported_flash_mode, /* MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FLASH_MODE, */
5014 camera_dispatcher_attr_foreach_supported_fps, /* MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FPS, */
5015 camera_dispatcher_attr_foreach_supported_fps_by_resolution, /* MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FPS_BY_RESOLUTION, */
5016 camera_dispatcher_attr_foreach_supported_stream_flip, /* MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_STREAM_FLIP, */
5017 camera_dispatcher_attr_foreach_supported_stream_rotation, /* MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_STREAM_ROTATION, */
5018 camera_dispatcher_attr_set_stream_rotation, /* MUSE_CAMERA_API_ATTR_SET_STREAM_ROTATION, */
5019 camera_dispatcher_attr_get_stream_rotation, /* MUSE_CAMERA_API_ATTR_GET_STREAM_ROTATION, */
5020 camera_dispatcher_attr_set_stream_flip, /* MUSE_CAMERA_API_ATTR_SET_STREAM_FLIP, */
5021 camera_dispatcher_attr_get_stream_flip, /* MUSE_CAMERA_API_ATTR_GET_STREAM_FLIP, */
5022 camera_dispatcher_attr_set_hdr_mode, /* MUSE_CAMERA_API_ATTR_SET_HDR_MODE, */
5023 camera_dispatcher_attr_get_hdr_mode, /* MUSE_CAMERA_API_ATTR_GET_HDR_MODE, */
5024 camera_dispatcher_attr_is_supported_hdr_capture, /* MUSE_CAMERA_API_ATTR_IS_SUPPORTED_HDR_CAPTURE, */
5025 camera_dispatcher_attr_set_hdr_capture_progress_cb, /* MUSE_CAMERA_API_ATTR_SET_HDR_CAPTURE_PROGRESS_CB, */
5026 camera_dispatcher_attr_unset_hdr_capture_progress_cb, /* MUSE_CAMERA_API_ATTR_UNSET_HDR_CAPTURE_PROGRESS_CB, */
5027 camera_dispatcher_attr_enable_anti_shake, /* MUSE_CAMERA_API_ATTR_ENABLE_ANTI_SHAKE, */
5028 camera_dispatcher_attr_is_enabled_anti_shake, /* MUSE_CAMERA_API_ATTR_IS_ENABLED_ANTI_SHAKE, */
5029 camera_dispatcher_attr_is_supported_anti_shake, /* MUSE_CAMERA_API_ATTR_IS_SUPPORTED_ANTI_SHAKE, */
5030 camera_dispatcher_attr_enable_video_stabilization, /* MUSE_CAMERA_API_ATTR_ENABLE_VIDEO_STABILIZATION, */
5031 camera_dispatcher_attr_is_enabled_video_stabilization, /* MUSE_CAMERA_API_ATTR_IS_ENABLED_VIDEO_STABILIZATION, */
5032 camera_dispatcher_attr_is_supported_video_stabilization, /* MUSE_CAMERA_API_ATTR_IS_SUPPORTED_VIDEO_STABILIZATION, */
5033 camera_dispatcher_attr_enable_auto_contrast, /* MUSE_CAMERA_API_ATTR_ENABLE_AUTO_CONTRAST, */
5034 camera_dispatcher_attr_is_enabled_auto_contrast, /* MUSE_CAMERA_API_ATTR_IS_ENABLED_AUTO_CONTRAST, */
5035 camera_dispatcher_attr_is_supported_auto_contrast, /* MUSE_CAMERA_API_ATTR_IS_SUPPORTED_AUTO_CONTRAST, */
5036 camera_dispatcher_attr_disable_shutter_sound, /* MUSE_CAMERA_API_ATTR_DISABLE_SHUTTER_SOUND, */
5037 camera_dispatcher_attr_get_encoded_preview_bitrate, /* MUSE_CAMERA_API_ATTR_GET_ENCODED_PREVIEW_BITRATE, */
5038 camera_dispatcher_attr_set_encoded_preview_bitrate, /* MUSE_CAMERA_API_ATTR_SET_ENCODED_PREVIEW_BITRATE, */
5039 camera_dispatcher_attr_get_encoded_preview_gop_interval, /* MUSE_CAMERA_API_ATTR_GET_ENCODED_PREVIEW_GOP_INTERVAL, */
5040 camera_dispatcher_attr_set_encoded_preview_gop_interval, /* MUSE_CAMERA_API_ATTR_SET_ENCODED_PREVIEW_GOP_INTERVAL, */
5041 camera_dispatcher_attr_set_pan, /* MUSE_CAMERA_API_ATTR_SET_PAN */
5042 camera_dispatcher_attr_get_pan, /* MUSE_CAMERA_API_ATTR_GET_PAN */
5043 camera_dispatcher_attr_get_pan_range, /* MUSE_CAMERA_API_ATTR_GET_PAN_RANGE */
5044 camera_dispatcher_attr_set_tilt, /* MUSE_CAMERA_API_ATTR_SET_TILT */
5045 camera_dispatcher_attr_get_tilt, /* MUSE_CAMERA_API_ATTR_GET_TILT */
5046 camera_dispatcher_attr_get_tilt_range, /* MUSE_CAMERA_API_ATTR_GET_TILT_RANGE */
5047 camera_dispatcher_attr_set_ptz_type, /* MUSE_CAMERA_API_ATTR_SET_PTZ_TYPE */
5048 camera_dispatcher_attr_foreach_supported_ptz_type, /* MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_PTZ_TYPE */
5049 camera_dispatcher_attr_set_display_roi_area, /* MUSE_CAMERA_API_SET_DISPLAY_ROI_AREA */
5050 camera_dispatcher_attr_get_display_roi_area, /* MUSE_CAMERA_API_GET_DISPLAY_ROI_AREA */
5051 camera_dispatcher_return_buffer, /* MUSE_CAMERA_API_RETURN_BUFFER */
5052 camera_dispatcher_preview_cb_return, /* MUSE_CAMERA_API_PREVIEW_CB_RETURN */
5053 camera_dispatcher_set_display_reuse_hint, /* MUSE_CAMERA_API_SET_DISPLAY_REUSE_HINT */
5054 camera_dispatcher_get_display_reuse_hint, /* MUSE_CAMERA_API_GET_DISPLAY_REUSE_HINT */
5055 camera_dispatcher_change_device, /* MUSE_CAMERA_API_CHANGE_DEVICE */
5056 camera_dispatcher_get_device_state /* MUSE_CAMERA_API_GET_DEVICE_STATE */
5060 /******************/
5061 /* cmd dispatcher */
5062 /******************/
5063 static int camera_cmd_dispatcher_initialize(muse_module_h module)
5067 GstPlugin *plugin = NULL;
5069 const char *load_list[] = {
5070 LIBDIR"/gstreamer-1.0/libgstcoreelements.so",
5071 LIBDIR"/gstreamer-1.0/libgstcamerasrc.so",
5072 LIBDIR"/gstreamer-1.0/libgstwaylandsink.so",
5075 item_count = sizeof(load_list) / sizeof(load_list[0]);
5077 LOGD("item count %d", item_count);
5079 for (i = 0 ; i < item_count ; i++) {
5080 plugin = gst_plugin_load_file(load_list[i], NULL);
5082 LOGD("%s loaded", load_list[i]);
5083 gst_object_unref(plugin);
5086 LOGW("failed to load %s", load_list[i]);
5092 return MUSE_CAMERA_ERROR_NONE;
5096 static int camera_cmd_dispatcher_shutdown(muse_module_h module)
5098 muse_camera_handle_s *muse_camera = NULL;
5099 camera_state_e state = CAMERA_STATE_NONE;
5100 int capture_try_count = 0;
5102 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
5103 if (muse_camera == NULL) {
5104 LOGE("NULL handle");
5105 return MUSE_CAMERA_ERROR_INVALID;
5108 legacy_camera_lock(muse_camera->camera_handle, true);
5110 if (legacy_camera_is_used(muse_camera->camera_handle)) {
5111 LOGW("camera is used in recorder.. wait...");
5112 if (legacy_camera_wait(muse_camera->camera_handle, 3000)) {
5113 LOGD("recorder is released");
5115 legacy_camera_lock(muse_camera->camera_handle, false);
5116 LOGE("wait timeout, could not release camera handle %p", muse_camera->camera_handle);
5117 return MUSE_CAMERA_ERROR_INVALID;
5121 legacy_camera_lock(muse_camera->camera_handle, false);
5124 legacy_camera_get_state(muse_camera->camera_handle, &state);
5126 LOGW("current state : %d", state);
5129 case CAMERA_STATE_CAPTURING:
5130 if (capture_try_count < 30) {
5131 LOGW("now capturing.. wait for capture data...");
5133 capture_try_count++;
5136 LOGE("wait capture data timeout! keep going...");
5139 case CAMERA_STATE_CAPTURED:
5140 legacy_camera_start_preview(muse_camera->camera_handle);
5142 case CAMERA_STATE_PREVIEW:
5143 legacy_camera_stop_preview(muse_camera->camera_handle);
5145 case CAMERA_STATE_CREATED:
5146 if (legacy_camera_destroy(muse_camera->camera_handle) == CAMERA_ERROR_NONE) {
5147 _camera_remove_export_data(module, 0, TRUE);
5149 g_mutex_clear(&muse_camera->list_lock);
5150 g_mutex_clear(&muse_camera->preview_cb_lock);
5151 g_cond_clear(&muse_camera->preview_cb_cond);
5153 muse_camera->bufmgr = NULL;
5158 LOGE("failed to destroy camera handle");
5167 return MUSE_CAMERA_ERROR_NONE;
5171 int (*cmd_dispatcher[MUSE_MODULE_COMMAND_MAX])(muse_module_h module) = {
5172 camera_cmd_dispatcher_initialize, /* MUSE_MODULE_COMMAND_INITIALIZE */
5173 camera_cmd_dispatcher_shutdown, /* MUSE_MODULE_COMMAND_SHUTDOWN */
5174 NULL, /* MUSE_MODULE_COMMAND_DEBUG_INFO_DUMP */
5175 NULL, /* MUSE_MODULE_COMMAND_CREATE_SERVER_ACK */
5176 NULL /* MUSE_MODULE_COMMAND_RESOURCE_NOT_AVAILABLE */