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;
426 tmp_list = tmp_list->next;
428 if (export_data->key == key || remove_all) {
429 /*LOGD("key %d matched, remove it (remove_all %d)", key, remove_all);*/
432 LOGW("remove remained export data key %d, internal buffer %p",
433 export_data->key, export_data->internal_buffer);
436 if (export_data->is_capture) {
437 LOGD("capture callback is done");
438 g_cond_signal(&muse_camera->list_cond);
441 if (export_data->bo) {
442 tbm_bo_unref(export_data->bo);
443 export_data->bo = NULL;
445 LOGW("bo for key %d is NULL", key);
448 export_data->key = 0;
450 if (export_data->internal_buffer) {
451 gst_buffer_unref((GstBuffer *)export_data->internal_buffer);
452 export_data->internal_buffer = NULL;
455 if (export_data->data_bo) {
456 tbm_bo_unref(export_data->data_bo);
457 export_data->data_bo = NULL;
460 muse_camera->data_list = g_list_remove(muse_camera->data_list, export_data);
465 if (remove_all == FALSE) {
466 /*LOGD("key %d, remove done");*/
467 g_mutex_unlock(&muse_camera->list_lock);
470 LOGD("check next data");
478 g_mutex_unlock(&muse_camera->list_lock);
481 LOGW("remove all done");
483 LOGE("should not be reached here - key %d", key);
490 void _camera_dispatcher_capturing_cb(camera_image_data_s* image, camera_image_data_s* postview, camera_image_data_s* thumbnail, void *user_data)
492 muse_camera_handle_s *muse_camera = NULL;
493 int data_size_main = 0;
494 int data_size_post = 0;
495 int data_size_thumb = 0;
496 tbm_bo bo_main = NULL;
497 tbm_bo bo_post = NULL;
498 tbm_bo bo_thumb = NULL;
499 tbm_bo_handle bo_main_handle = {.ptr = NULL};
500 tbm_bo_handle bo_post_handle = {.ptr = NULL};
501 tbm_bo_handle bo_thumb_handle = {.ptr = NULL};
502 muse_camera_export_data *export_data_main = NULL;
503 muse_camera_export_data *export_data_post = NULL;
504 muse_camera_export_data *export_data_thumb = NULL;
505 int tbm_key_main = 0;
506 int tbm_key_post = 0;
507 int tbm_key_thumb = 0;
508 muse_module_h module = (muse_module_h)user_data;
509 unsigned char *buf_pos = NULL;
514 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
515 if (!muse_camera || !image) {
516 LOGE("invalid ptr %p %p", muse_camera, image);
521 export_data_main = g_new0(muse_camera_export_data, 1);
522 if (export_data_main == NULL) {
523 LOGE("alloc export_data failed");
527 data_size_main = sizeof(camera_image_data_s) + image->size;
528 if (image->exif && image->exif_size > 0)
529 data_size_main += image->exif_size;
532 bo_main = tbm_bo_alloc(muse_camera->bufmgr, data_size_main, TBM_BO_DEFAULT);
533 if (bo_main == NULL) {
534 LOGE("bo alloc failed");
535 goto main_image_error;
538 bo_main_handle = tbm_bo_map(bo_main, TBM_DEVICE_CPU, TBM_OPTION_READ | TBM_OPTION_WRITE);
539 if (bo_main_handle.ptr == NULL) {
540 LOGE("bo map Error!");
541 goto main_image_error;
544 buf_pos = (unsigned char *)bo_main_handle.ptr;
545 memcpy(buf_pos, image, sizeof(camera_image_data_s));
546 buf_pos += sizeof(camera_image_data_s);
547 memcpy(buf_pos, image->data, image->size);
548 if (image->exif && image->exif_size > 0) {
549 buf_pos += image->size;
550 memcpy(buf_pos, image->exif, image->exif_size);
553 tbm_bo_unmap(bo_main);
555 tbm_key_main = tbm_bo_export(bo_main);
556 if (tbm_key_main == 0) {
557 LOGE("Create key_info ERROR!!");
558 goto main_image_error;
561 LOGD("bo %p, vaddr %p, size %d, key %d",
562 bo_main, bo_main_handle.ptr, data_size_main, tbm_key_main);
565 export_data_main->key = tbm_key_main;
566 export_data_main->bo = bo_main;
567 export_data_main->is_capture = true;
570 if (postview && postview->size > 0) {
571 data_size_post = sizeof(camera_image_data_s) + postview->size;
573 export_data_post = g_new0(muse_camera_export_data, 1);
574 if (export_data_post == NULL) {
575 LOGE("alloc export_data failed");
576 goto postview_image_error;
580 bo_post = tbm_bo_alloc(muse_camera->bufmgr, data_size_post, TBM_BO_DEFAULT);
581 if (bo_post == NULL) {
582 LOGE("bo alloc failed");
583 goto postview_image_error;
586 bo_post_handle = tbm_bo_map(bo_post, TBM_DEVICE_CPU, TBM_OPTION_READ | TBM_OPTION_WRITE);
587 if (bo_post_handle.ptr == NULL) {
588 LOGE("bo map Error!");
589 goto postview_image_error;
592 buf_pos = (unsigned char *)bo_post_handle.ptr;
593 memcpy(buf_pos, postview, sizeof(camera_image_data_s));
594 buf_pos += sizeof(camera_image_data_s);
595 memcpy(buf_pos, postview->data, postview->size);
596 tbm_bo_unmap(bo_post);
598 tbm_key_post = tbm_bo_export(bo_post);
599 if (tbm_key_post == 0) {
600 LOGE("Create key_info ERROR!!");
601 goto postview_image_error;
605 export_data_post->key = tbm_key_post;
606 export_data_post->bo = bo_post;
609 /* thumbnail image */
610 if (thumbnail && thumbnail->size > 0) {
611 data_size_thumb = sizeof(camera_image_data_s) + thumbnail->size;
613 export_data_thumb = g_new0(muse_camera_export_data, 1);
614 if (export_data_thumb == NULL) {
615 LOGE("alloc export_data failed");
616 goto thumbnail_image_error;
620 bo_thumb = tbm_bo_alloc(muse_camera->bufmgr, data_size_thumb, TBM_BO_DEFAULT);
621 if (bo_thumb == NULL) {
622 LOGE("bo alloc failed");
623 goto thumbnail_image_error;
626 bo_thumb_handle = tbm_bo_map(bo_thumb, TBM_DEVICE_CPU, TBM_OPTION_READ | TBM_OPTION_WRITE);
627 if (bo_thumb_handle.ptr == NULL) {
628 LOGE("bo map Error!");
629 goto thumbnail_image_error;
632 buf_pos = (unsigned char *)bo_thumb_handle.ptr;
633 memcpy(buf_pos, thumbnail, sizeof(camera_image_data_s));
634 buf_pos += sizeof(camera_image_data_s);
635 memcpy(buf_pos, thumbnail->data, thumbnail->size);
636 tbm_bo_unmap(bo_thumb);
638 tbm_key_thumb = tbm_bo_export(bo_thumb);
639 if (tbm_key_thumb == 0) {
640 LOGE("Create key_info ERROR!!");
641 goto thumbnail_image_error;
645 export_data_thumb->key = tbm_key_thumb;
646 export_data_thumb->bo = bo_thumb;
649 /* add bo info to list */
650 g_mutex_lock(&muse_camera->list_lock);
652 muse_camera->data_list = g_list_append(muse_camera->data_list, (gpointer)export_data_main);
654 if (export_data_post)
655 muse_camera->data_list = g_list_append(muse_camera->data_list, (gpointer)export_data_post);
657 if (export_data_thumb)
658 muse_camera->data_list = g_list_append(muse_camera->data_list, (gpointer)export_data_thumb);
661 muse_camera_msg_event3(MUSE_CAMERA_CB_EVENT,
662 MUSE_CAMERA_EVENT_TYPE_CAPTURE,
663 MUSE_CAMERA_EVENT_CLASS_THREAD_SUB,
664 module, "tbm_key_main", tbm_key_main, "tbm_key_post", tbm_key_post, "tbm_key_thumb", tbm_key_thumb);
666 /* wait for capture callback return */
667 end_time = g_get_monotonic_time() + G_TIME_SPAN_SECOND * 3;
668 if (!g_cond_wait_until(&muse_camera->list_cond, &muse_camera->list_lock, end_time)) {
669 LOGW("capture callback return timeout");
671 LOGD("capture callback return");
674 g_mutex_unlock(&muse_camera->list_lock);
678 thumbnail_image_error:
680 tbm_bo_unref(bo_thumb);
684 if (export_data_thumb) {
685 g_free(export_data_thumb);
686 export_data_thumb = NULL;
689 postview_image_error:
691 tbm_bo_unref(bo_post);
695 if (export_data_post) {
696 g_free(export_data_post);
697 export_data_post = NULL;
702 tbm_bo_unref(bo_main);
706 if (export_data_main) {
707 g_free(export_data_main);
708 export_data_main = NULL;
714 void _camera_dispatcher_state_changed_cb(camera_state_e previous, camera_state_e current, bool by_policy, void *user_data)
716 muse_module_h module = (muse_module_h)user_data;
717 muse_camera_handle_s *muse_camera = NULL;
718 camera_device_e device_type = CAMERA_DEVICE_CAMERA0;
719 char value_key[KEY_LENGTH] = {'\0',};
720 int ret = CAMERA_ERROR_NONE;
723 LOGD("Enter - previous %d, current %d, by_policy %d",
724 previous, current, by_policy);
726 muse_camera_msg_event3(MUSE_CAMERA_CB_EVENT,
727 MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE,
728 MUSE_CAMERA_EVENT_CLASS_THREAD_MAIN,
729 module, "previous", previous, "current", current, "by_policy", by_policy);
731 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
733 LOGW("NULL muse camera handle");
737 ret = legacy_camera_get_device_type(muse_camera->camera_handle, &device_type);
738 if (ret != CAMERA_ERROR_NONE) {
739 LOGE("get device type failed 0x%x", ret);
743 snprintf(value_key, KEY_LENGTH, "device_state_camera%d", device_type);
744 if (previous == CAMERA_STATE_CREATED && current == CAMERA_STATE_PREVIEW)
745 set_value = CAMERA_DEVICE_STATE_WORKING;
746 else if (previous == CAMERA_STATE_PREVIEW && current == CAMERA_STATE_CREATED)
747 set_value = CAMERA_DEVICE_STATE_NULL;
749 if (set_value != -1) {
750 LOGD("device[%s] state set : %d", value_key, set_value);
751 muse_core_client_set_value(module, value_key, set_value);
757 void _camera_dispatcher_interrupted_cb(camera_policy_e policy, camera_state_e previous, camera_state_e current, void *user_data)
759 muse_module_h module = (muse_module_h)user_data;
761 LOGD("Enter - policy %d, state previous %d, current %d", policy, previous, current);
763 muse_camera_msg_event3(MUSE_CAMERA_CB_EVENT,
764 MUSE_CAMERA_EVENT_TYPE_INTERRUPTED,
765 MUSE_CAMERA_EVENT_CLASS_THREAD_MAIN,
766 module, "policy", policy, "previous", previous, "current", current);
771 void _camera_dispatcher_preview_cb(MMCamcorderVideoStreamDataType *stream, void *user_data)
773 muse_camera_handle_s *muse_camera = NULL;
776 tbm_bo data_bo = NULL;
777 tbm_bo_handle bo_handle = {.ptr = NULL};
778 tbm_bo_handle data_bo_handle = {.ptr = NULL};
779 muse_camera_export_data *export_data = NULL;
783 int buffer_key[BUFFER_MAX_PLANE_NUM] = {0, };
784 int num_buffer_key = 0;
786 muse_module_h module = (muse_module_h)user_data;
787 unsigned char *buf_pos = NULL;
788 char *send_message = NULL;
792 if (module == NULL || stream == NULL) {
793 LOGE("NULL data %p, %p", module, stream);
797 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
798 if (muse_camera == NULL) {
803 export_data = g_new0(muse_camera_export_data, 1);
804 if (export_data == NULL) {
805 LOGE("alloc export_data failed");
809 data_size = sizeof(MMCamcorderVideoStreamDataType);
811 bo = tbm_bo_alloc(muse_camera->bufmgr, data_size, TBM_BO_DEFAULT);
813 LOGE("bo alloc failed");
814 goto _PREVIEW_CB_ERROR;
817 bo_handle = tbm_bo_map(bo, TBM_DEVICE_CPU, TBM_OPTION_READ | TBM_OPTION_WRITE);
818 if (bo_handle.ptr == NULL) {
819 LOGE("bo map Error!");
820 goto _PREVIEW_CB_ERROR;
823 buf_pos = (unsigned char *)bo_handle.ptr;
825 memcpy(buf_pos, stream, sizeof(MMCamcorderVideoStreamDataType));
829 if (stream->bo[0] == NULL) {
831 switch (stream->data_type) {
832 case MM_CAM_STREAM_DATA_YUV420:
833 data_size = stream->data.yuv420.length_yuv;
835 case MM_CAM_STREAM_DATA_YUV422:
836 data_size = stream->data.yuv422.length_yuv;
838 case MM_CAM_STREAM_DATA_YUV420SP:
839 data_size = stream->data.yuv420sp.length_y;
840 data_size += stream->data.yuv420sp.length_uv;
842 case MM_CAM_STREAM_DATA_YUV420P:
843 data_size = stream->data.yuv420p.length_y;
844 data_size += stream->data.yuv420p.length_u;
845 data_size += stream->data.yuv420p.length_v;
847 case MM_CAM_STREAM_DATA_YUV422P:
848 data_size = stream->data.yuv422p.length_y;
849 data_size += stream->data.yuv422p.length_u;
850 data_size += stream->data.yuv422p.length_v;
852 case MM_CAM_STREAM_DATA_ENCODED:
853 data_size = stream->data.encoded.length_data;
856 LOGW("unknown data type %d", stream->data_type);
860 data_bo = tbm_bo_alloc(muse_camera->bufmgr, data_size, TBM_BO_DEFAULT);
861 if (data_bo == NULL) {
862 LOGE("data_bo alloc failed");
863 goto _PREVIEW_CB_ERROR;
866 data_bo_handle = tbm_bo_map(data_bo, TBM_DEVICE_CPU, TBM_OPTION_READ | TBM_OPTION_WRITE);
867 if (data_bo_handle.ptr == NULL) {
868 LOGE("data_bo map Error!");
869 goto _PREVIEW_CB_ERROR;
872 buf_pos = (unsigned char *)data_bo_handle.ptr;
874 switch (stream->data_type) {
875 case MM_CAM_STREAM_DATA_YUV420:
876 memcpy(buf_pos, stream->data.yuv420.yuv, stream->data.yuv420.length_yuv);
878 case MM_CAM_STREAM_DATA_YUV422:
879 memcpy(buf_pos, stream->data.yuv422.yuv, stream->data.yuv422.length_yuv);
881 case MM_CAM_STREAM_DATA_YUV420SP:
882 memcpy(buf_pos, stream->data.yuv420sp.y, stream->data.yuv420sp.length_y);
883 memcpy(buf_pos + stream->data.yuv420sp.length_y, stream->data.yuv420sp.uv, stream->data.yuv420sp.length_uv);
885 case MM_CAM_STREAM_DATA_YUV420P:
886 memcpy(buf_pos, stream->data.yuv420p.y, stream->data.yuv420p.length_y);
887 memcpy(buf_pos + stream->data.yuv420p.length_y, stream->data.yuv420p.u, stream->data.yuv420p.length_u);
888 memcpy(buf_pos + stream->data.yuv420p.length_y + stream->data.yuv420p.length_u, stream->data.yuv420p.v, stream->data.yuv420p.length_v);
890 case MM_CAM_STREAM_DATA_YUV422P:
891 memcpy(buf_pos, stream->data.yuv422p.y, stream->data.yuv422p.length_y);
892 memcpy(buf_pos + stream->data.yuv422p.length_y, stream->data.yuv422p.u, stream->data.yuv422p.length_u);
893 memcpy(buf_pos + stream->data.yuv422p.length_y + stream->data.yuv422p.length_u, stream->data.yuv422p.v, stream->data.yuv422p.length_v);
895 case MM_CAM_STREAM_DATA_ENCODED:
896 memcpy(buf_pos, stream->data.encoded.data, stream->data.encoded.length_data);
902 tbm_bo_unmap(data_bo);
905 for (i = 0 ; i < BUFFER_MAX_PLANE_NUM ; i++) {
907 buffer_key[i] = tbm_bo_export(stream->bo[i]);
908 if (buffer_key[i] == 0) {
909 LOGE("failed to export bo %p", stream->bo[i]);
910 goto _PREVIEW_CB_ERROR;
914 /*LOGD("num_buffer_key %d", num_buffer_key);*/
920 tbm_key = tbm_bo_export(bo);
922 LOGE("Create key_info ERROR!!");
923 goto _PREVIEW_CB_ERROR;
927 LOGD("bo %p, vaddr %p, size %d, key %d",
928 bo, bo_handle.ptr, data_size, tbm_key);
932 export_data->key = tbm_key;
933 export_data->bo = bo;
934 if (stream->internal_buffer) {
935 export_data->internal_buffer = stream->internal_buffer;
936 gst_buffer_ref((GstBuffer *)export_data->internal_buffer);
939 export_data->data_bo = data_bo;
940 data_key = tbm_bo_export(data_bo);
942 LOGE("Create key_info for data_bo ERROR!!");
943 goto _PREVIEW_CB_ERROR;
947 /* add bo info to list */
948 g_mutex_lock(&muse_camera->list_lock);
950 muse_camera->data_list = g_list_append(muse_camera->data_list, (gpointer)export_data);
952 if (muse_camera->is_shutting_down) {
953 LOGW("now shutting down.. skip this buffer");
954 g_mutex_unlock(&muse_camera->list_lock);
955 _camera_remove_export_data(module, tbm_key, FALSE);
959 g_mutex_unlock(&muse_camera->list_lock);
961 g_mutex_lock(&muse_camera->preview_cb_lock);
964 send_message = muse_core_msg_json_factory_new(MUSE_CAMERA_CB_EVENT,
965 MUSE_TYPE_INT, PARAM_EVENT, MUSE_CAMERA_EVENT_TYPE_PREVIEW,
966 MUSE_TYPE_INT, PARAM_EVENT_CLASS, MUSE_CAMERA_EVENT_CLASS_THREAD_SUB,
967 MUSE_TYPE_INT, "tbm_key", tbm_key,
968 MUSE_TYPE_INT, "num_buffer_key", num_buffer_key,
969 MUSE_TYPE_INT, "data_key", data_key,
970 MUSE_TYPE_ARRAY, "buffer_key", BUFFER_MAX_PLANE_NUM, buffer_key,
973 send_ret = muse_core_ipc_send_msg(muse_core_client_get_msg_fd(module), send_message);
975 muse_core_msg_json_factory_free(send_message);
977 /*LOGD("wait preview callback return message");*/
979 if (!CHECK_PREVIEW_CB(muse_camera, PREVIEW_CB_TYPE_EVAS) && send_ret > 0) {
980 gint64 end_time = g_get_monotonic_time() + G_TIME_SPAN_SECOND;
982 if (!g_cond_wait_until(&muse_camera->preview_cb_cond, &muse_camera->preview_cb_lock, end_time)) {
983 LOGW("preview callback return message timeout");
985 /*LOGD("preview callback return message received");*/
989 g_mutex_unlock(&muse_camera->preview_cb_lock);
999 tbm_bo_unref(data_bo);
1003 g_free(export_data);
1010 void _camera_dispatcher_capture_completed_cb(void *user_data)
1012 muse_module_h module = (muse_module_h)user_data;
1016 muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT,
1017 MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE,
1018 MUSE_CAMERA_EVENT_CLASS_THREAD_MAIN,
1024 void _camera_dispatcher_face_detected_cb(camera_detected_face_s *faces, int count, void *user_data)
1026 muse_module_h module = (muse_module_h)user_data;
1027 muse_camera_handle_s *muse_camera = NULL;
1029 tbm_bo_handle bo_handle = {NULL, };
1030 int bo_size = sizeof(camera_detected_face_s) * count;
1032 muse_camera_export_data *export_data = NULL;
1035 if (module == NULL) {
1036 LOGE("NULL module");
1041 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1042 if (muse_camera == NULL) {
1043 LOGE("NULL handle");
1047 export_data = g_new0(muse_camera_export_data, 1);
1048 if (export_data == NULL) {
1049 LOGE("alloc export_data failed");
1053 bo = tbm_bo_alloc(muse_camera->bufmgr, bo_size, TBM_BO_DEFAULT);
1055 LOGE("tbm_bo_alloc failed");
1057 g_free(export_data);
1063 bo_handle = tbm_bo_map(bo, TBM_DEVICE_CPU, TBM_OPTION_READ | TBM_OPTION_WRITE);
1064 if (bo_handle.ptr == NULL) {
1065 LOGE("bo map Error!");
1070 g_free(export_data);
1076 /* copy face detection info */
1077 memcpy(bo_handle.ptr, faces, bo_size);
1082 tbm_key = tbm_bo_export(bo);
1084 LOGE("failed to export bo for face detection info");
1089 g_free(export_data);
1095 /* set export data */
1096 export_data->bo = bo;
1097 export_data->key = tbm_key;
1099 /* add bo info to list */
1100 g_mutex_lock(&muse_camera->list_lock);
1101 muse_camera->data_list = g_list_append(muse_camera->data_list, (gpointer)export_data);
1102 g_mutex_unlock(&muse_camera->list_lock);
1105 LOGD("face - count %d, buffer size %d, key %d", count, bo_size, tbm_key);
1108 muse_camera_msg_event2(MUSE_CAMERA_CB_EVENT,
1109 MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION,
1110 MUSE_CAMERA_EVENT_CLASS_THREAD_MAIN,
1111 module, "count", count, "tbm_key", tbm_key);
1113 LOGW("invalid count for face detection - %d", count);
1119 void _camera_dispatcher_focus_changed_cb(camera_focus_state_e state, void *user_data)
1121 muse_module_h module = (muse_module_h)user_data;
1123 LOGD("Enter - state %d", state);
1125 muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT,
1126 MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE,
1127 MUSE_CAMERA_EVENT_CLASS_THREAD_MAIN,
1128 module, "state", state);
1133 void _camera_dispatcher_error_cb(camera_error_e error, camera_state_e current_state, void *user_data)
1135 muse_module_h module = (muse_module_h)user_data;
1137 LOGD("Enter - error 0x%x, current_state %d", error, current_state);
1139 muse_camera_msg_event2(MUSE_CAMERA_CB_EVENT,
1140 MUSE_CAMERA_EVENT_TYPE_ERROR,
1141 MUSE_CAMERA_EVENT_CLASS_THREAD_MAIN,
1142 module, "error", error, "current_state", current_state);
1147 void _camera_dispatcher_hdr_progress_cb(int percent, void *user_data)
1149 muse_module_h module = (muse_module_h)user_data;
1153 muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT,
1154 MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS,
1155 MUSE_CAMERA_EVENT_CLASS_THREAD_MAIN,
1156 module, "percent", percent);
1162 static void _camera_task_add_job(muse_camera_handle_s *muse_camera, int api, int class, int value)
1164 muse_camera_task_job_s *job = NULL;
1167 LOGE("NULL handle");
1171 job = g_new0(muse_camera_task_job_s, 1);
1173 LOGE("job alloc failed");
1174 muse_camera_msg_return(api, class, CAMERA_ERROR_INVALID_OPERATION, muse_camera->module);
1182 LOGD("push job - api %d", api);
1184 g_mutex_lock(&muse_camera->task_lock);
1185 g_queue_push_tail(&muse_camera->task_queue, (gpointer)job);
1186 g_cond_signal(&muse_camera->task_cond);
1187 g_mutex_unlock(&muse_camera->task_lock);
1193 static void __camera_task_process_job(muse_camera_handle_s *muse_camera, muse_camera_task_job_s *job)
1195 int ret = CAMERA_ERROR_NONE;
1198 LOGE("NULL handle");
1202 LOGD("job start - api %d, value 0x%x", job->api, job->value);
1205 case MUSE_CAMERA_API_STOP_PREVIEW:
1206 ret = legacy_camera_stop_preview(muse_camera->camera_handle);
1208 case MUSE_CAMERA_API_START_CAPTURE:
1209 ret = legacy_camera_start_capture(muse_camera->camera_handle,
1210 (camera_capturing_cb)_camera_dispatcher_capturing_cb,
1211 (camera_capture_completed_cb)_camera_dispatcher_capture_completed_cb,
1212 (void *)muse_camera->module);
1214 case MUSE_CAMERA_API_SET_PREVIEW_RESOLUTION:
1215 ret = legacy_camera_set_preview_resolution(muse_camera->camera_handle, \
1216 job->value >> 16, 0x0000ffff & job->value);
1218 case MUSE_CAMERA_API_SET_CAPTURE_RESOLUTION:
1219 ret = legacy_camera_set_capture_resolution(muse_camera->camera_handle, \
1220 job->value >> 16, 0x0000ffff & job->value);
1222 case MUSE_CAMERA_API_ATTR_SET_HDR_MODE:
1223 ret = legacy_camera_attr_set_hdr_mode(muse_camera->camera_handle, \
1224 (camera_attr_hdr_mode_e)job->value);
1227 LOGE("unhandled task - api %d", job->api);
1231 LOGD("job done - api %d, ret 0x%x", job->api, ret);
1233 muse_camera_msg_return(job->api, job->class, ret, muse_camera->module);
1243 static void *_camera_dispatcher_task_func(gpointer data)
1245 muse_camera_handle_s *muse_camera = (muse_camera_handle_s *)data;
1246 muse_camera_task_job_s *job = NULL;
1247 gint64 end_time = 0;
1248 bool is_signaled = false;
1249 bool use_wait_until = false;
1252 LOGE("NULL handle");
1258 g_mutex_lock(&muse_camera->task_lock);
1260 while (muse_camera->task_run) {
1261 if (g_queue_is_empty(&muse_camera->task_queue)) {
1262 LOGD("empty queue. wait signal [wait until %d]", use_wait_until);
1264 if (use_wait_until) {
1265 end_time = g_get_monotonic_time() + G_TIME_SPAN_SECOND;
1266 is_signaled = g_cond_wait_until(&muse_camera->task_cond, &muse_camera->task_lock, end_time);
1268 g_cond_wait(&muse_camera->task_cond, &muse_camera->task_lock);
1272 /*LOGD("is_signaled %d", is_signaled);*/
1275 if (!muse_camera->task_run) {
1276 LOGW("stop task thread : is_signaled %d", is_signaled);
1280 job = (muse_camera_task_job_s *)g_queue_pop_head(&muse_camera->task_queue);
1283 LOGE("signal received, but no job");
1288 if (job->api == MUSE_CAMERA_API_STOP_PREVIEW)
1289 use_wait_until = true;
1291 use_wait_until = false;
1293 g_mutex_unlock(&muse_camera->task_lock);
1295 __camera_task_process_job(muse_camera, job);
1297 g_mutex_lock(&muse_camera->task_lock);
1300 while (!g_queue_is_empty(&muse_camera->task_queue)) {
1301 job = (muse_camera_task_job_s *)g_queue_pop_head(&muse_camera->task_queue);
1303 LOGW("remained job - api %d", job->api);
1304 __camera_task_process_job(muse_camera, job);
1308 g_mutex_unlock(&muse_camera->task_lock);
1316 static void _camera_dispatcher_release_resource(muse_module_h module)
1318 muse_camera_handle_s *muse_camera = NULL;
1321 LOGE("NULL handle");
1327 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1329 _camera_remove_export_data(module, 0, TRUE);
1331 g_mutex_clear(&muse_camera->list_lock);
1332 g_cond_clear(&muse_camera->list_cond);
1333 g_mutex_clear(&muse_camera->preview_cb_lock);
1334 g_cond_clear(&muse_camera->preview_cb_cond);
1336 muse_camera->bufmgr = NULL;
1338 if (muse_camera->task_thread) {
1339 LOGW("task thread exiting start");
1341 g_mutex_lock(&muse_camera->task_lock);
1342 muse_camera->task_run = false;
1343 g_cond_signal(&muse_camera->task_cond);
1344 g_mutex_unlock(&muse_camera->task_lock);
1346 LOGW("wait task thread join");
1348 g_thread_join(muse_camera->task_thread);
1349 muse_camera->task_thread = NULL;
1351 LOGW("task thread exiting end");
1354 g_mutex_clear(&muse_camera->task_lock);
1355 g_cond_clear(&muse_camera->task_cond);
1356 g_queue_clear(&muse_camera->task_queue);
1367 int camera_dispatcher_create(muse_module_h module)
1369 int ret = CAMERA_ERROR_NONE;
1373 void *gdbus_connection = NULL;
1374 muse_camera_handle_s *muse_camera = NULL;
1375 muse_camera_api_e api = MUSE_CAMERA_API_CREATE;
1376 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1378 muse_camera_msg_get(device_type, muse_core_client_get_msg(module));
1379 muse_camera_msg_get(pid, muse_core_client_get_msg(module));
1381 LOGD("device type : %d, client pid : %d", device_type, pid);
1383 /* privilege check */
1384 client_fd = muse_core_client_get_msg_fd(module);
1385 if (!muse_core_security_check_cynara(client_fd, CAMERA_PRIVILEGE_NAME)) {
1386 ret = CAMERA_ERROR_PERMISSION_DENIED;
1387 LOGE("security check failed 0x%x", ret);
1388 muse_camera_msg_return(api, class, ret, module);
1389 return MUSE_CAMERA_ERROR_NONE;
1393 muse_camera = (muse_camera_handle_s *)malloc(sizeof(muse_camera_handle_s));
1394 if (muse_camera == NULL) {
1395 ret = CAMERA_ERROR_OUT_OF_MEMORY;
1396 LOGE("handle alloc failed 0x%x", ret);
1397 muse_camera_msg_return(api, class, ret, module);
1398 return MUSE_CAMERA_ERROR_NONE;
1401 memset(muse_camera, 0x0, sizeof(muse_camera_handle_s));
1403 if (muse_core_ipc_get_bufmgr(&muse_camera->bufmgr) != MM_ERROR_NONE ||
1404 muse_core_ipc_get_gdbus_connection((GDBusConnection **)&gdbus_connection) != MM_ERROR_NONE) {
1405 LOGE("tbm bufmgr or gdbus conntection failed %p %p", muse_camera->bufmgr, gdbus_connection);
1410 ret = CAMERA_ERROR_INVALID_OPERATION;
1411 muse_camera_msg_return(api, class, ret, module);
1413 return MUSE_CAMERA_ERROR_NONE;
1416 ret = legacy_camera_create((camera_device_e)device_type, &muse_camera->camera_handle);
1417 if (ret != CAMERA_ERROR_NONE) {
1420 muse_camera_msg_return(api, class, ret, module);
1422 return MUSE_CAMERA_ERROR_NONE;
1425 g_mutex_init(&muse_camera->task_lock);
1426 g_cond_init(&muse_camera->task_cond);
1427 g_queue_init(&muse_camera->task_queue);
1429 muse_camera->task_run = true;
1430 muse_camera->task_thread = g_thread_try_new("camera_task_thread",
1431 _camera_dispatcher_task_func, (gpointer)muse_camera, NULL);
1432 if (!muse_camera->task_thread) {
1433 LOGE("failed to create new thread for task");
1437 ret = legacy_camera_set_state_changed_cb(muse_camera->camera_handle,
1438 (camera_state_changed_cb)_camera_dispatcher_state_changed_cb,
1440 if (ret != CAMERA_ERROR_NONE) {
1441 LOGE("legacy_camera_set_state_changed_cb failed : 0x%x", ret);
1445 ret = legacy_camera_set_client_pid(muse_camera->camera_handle, pid);
1446 if (ret != CAMERA_ERROR_NONE) {
1447 LOGE("legacy_camera_set_client_pid failed : 0x%x", ret);
1451 ret = legacy_camera_set_gdbus_connection(muse_camera->camera_handle, gdbus_connection);
1452 if (ret != CAMERA_ERROR_NONE) {
1453 LOGE("legacy_camera_set_gdbus_connection failed : 0x%x", ret);
1457 g_mutex_init(&muse_camera->list_lock);
1458 g_cond_init(&muse_camera->list_cond);
1459 g_mutex_init(&muse_camera->preview_cb_lock);
1460 g_cond_init(&muse_camera->preview_cb_cond);
1461 muse_camera->preview_cb_flag = 0;
1462 muse_camera->module = module;
1464 LOGD("handle : 0x%x", muse_camera);
1466 muse_core_ipc_set_handle(module, (intptr_t)muse_camera);
1467 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_POINTER, -1, "handle", 0, muse_camera);
1469 return MUSE_CAMERA_ERROR_NONE;
1472 if (muse_camera->task_thread) {
1473 g_mutex_lock(&muse_camera->task_lock);
1474 muse_camera->task_run = false;
1475 g_cond_signal(&muse_camera->task_cond);
1476 g_mutex_unlock(&muse_camera->task_lock);
1478 LOGE("task thread join");
1480 g_thread_join(muse_camera->task_thread);
1481 muse_camera->task_thread = NULL;
1484 g_mutex_clear(&muse_camera->task_lock);
1485 g_cond_clear(&muse_camera->task_cond);
1486 g_queue_clear(&muse_camera->task_queue);
1488 legacy_camera_destroy(muse_camera->camera_handle);
1489 muse_camera->camera_handle = NULL;
1493 muse_camera_msg_return(api, class, ret, module);
1495 return MUSE_CAMERA_ERROR_NONE;
1499 int camera_dispatcher_change_device(muse_module_h module)
1501 int ret = CAMERA_ERROR_NONE;
1502 int device = CAMERA_DEVICE_CAMERA0;
1503 muse_camera_handle_s *muse_camera = NULL;
1504 muse_camera_api_e api = MUSE_CAMERA_API_CHANGE_DEVICE;
1505 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1507 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1509 muse_camera_msg_get(device, muse_core_client_get_msg(module));
1511 LOGD("change device to %d", device);
1513 ret = legacy_camera_change_device(&muse_camera->camera_handle, device,
1514 CHECK_PREVIEW_CB(muse_camera, PREVIEW_CB_TYPE_EVAS));
1516 muse_camera_msg_return(api, class, ret, module);
1518 return MUSE_CAMERA_ERROR_NONE;
1522 int camera_dispatcher_destroy(muse_module_h module)
1524 int ret = CAMERA_ERROR_NONE;
1525 muse_camera_handle_s *muse_camera = NULL;
1526 muse_camera_api_e api = MUSE_CAMERA_API_DESTROY;
1527 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1529 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1531 LOGD("Enter, handle : %p", muse_camera);
1533 ret = legacy_camera_destroy(muse_camera->camera_handle);
1534 if (ret == CAMERA_ERROR_NONE)
1535 _camera_dispatcher_release_resource(module);
1537 muse_camera_msg_return(api, class, ret, module);
1539 return MUSE_CAMERA_ERROR_NONE;
1542 int camera_dispatcher_start_preview(muse_module_h module)
1544 int ret = CAMERA_ERROR_NONE;
1545 muse_camera_handle_s *muse_camera = NULL;
1546 muse_camera_api_e api = MUSE_CAMERA_API_START_PREVIEW;
1547 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1549 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1551 LOGD("handle : %p", muse_camera);
1553 ret = legacy_camera_start_preview(muse_camera->camera_handle);
1555 muse_camera_msg_return(api, class, ret, module);
1557 return MUSE_CAMERA_ERROR_NONE;
1560 int camera_dispatcher_stop_preview(muse_module_h module)
1562 muse_camera_handle_s *muse_camera = NULL;
1564 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1566 LOGD("handle : %p", muse_camera);
1568 _camera_task_add_job(muse_camera, MUSE_CAMERA_API_STOP_PREVIEW,
1569 MUSE_CAMERA_API_CLASS_IMMEDIATE, 0);
1571 return MUSE_CAMERA_ERROR_NONE;
1574 int camera_dispatcher_start_capture(muse_module_h module)
1576 muse_camera_handle_s *muse_camera = NULL;
1578 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1580 LOGD("handle : %p", muse_camera);
1582 _camera_task_add_job(muse_camera, MUSE_CAMERA_API_START_CAPTURE,
1583 MUSE_CAMERA_API_CLASS_IMMEDIATE, 0);
1585 return MUSE_CAMERA_ERROR_NONE;
1588 int camera_dispatcher_is_supported_continuous_capture(muse_module_h module)
1590 int ret = CAMERA_ERROR_NONE;
1591 muse_camera_handle_s *muse_camera = NULL;
1592 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_CONTINUOUS_CAPTURE;
1593 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1595 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1597 LOGD("handle : %p", muse_camera);
1599 ret = legacy_camera_is_supported_continuous_capture(muse_camera->camera_handle);
1601 LOGD("is supported ret : %d", ret);
1603 muse_camera_msg_return(api, class, ret, module);
1605 return MUSE_CAMERA_ERROR_NONE;
1608 int camera_dispatcher_start_continuous_capture(muse_module_h module)
1610 int ret = CAMERA_ERROR_NONE;
1611 muse_camera_handle_s *muse_camera = NULL;
1615 muse_camera_api_e api = MUSE_CAMERA_API_START_CONTINUOUS_CAPTURE;
1616 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1618 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1620 muse_camera_msg_get(value, muse_core_client_get_msg(module));
1622 count = value >> 16;
1623 interval = 0x0000ffff & value;
1625 LOGD("Enter - count %d, interval %d", count, interval);
1627 ret = legacy_camera_start_continuous_capture(muse_camera->camera_handle,
1630 (camera_capturing_cb)_camera_dispatcher_capturing_cb,
1631 (camera_capture_completed_cb)_camera_dispatcher_capture_completed_cb,
1634 muse_camera_msg_return(api, class, ret, module);
1636 return MUSE_CAMERA_ERROR_NONE;
1639 int camera_dispatcher_stop_continuous_capture(muse_module_h module)
1641 int ret = CAMERA_ERROR_NONE;
1642 muse_camera_handle_s *muse_camera = NULL;
1643 muse_camera_api_e api = MUSE_CAMERA_API_STOP_CONTINUOUS_CAPTURE;
1644 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1646 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1648 LOGD("handle : %p", muse_camera);
1650 ret = legacy_camera_stop_continuous_capture(muse_camera->camera_handle);
1652 muse_camera_msg_return(api, class, ret, module);
1654 return MUSE_CAMERA_ERROR_NONE;
1657 int camera_dispatcher_is_supported_face_detection(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_FACE_DETECTION;
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_face_detection(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_is_supported_zero_shutter_lag(muse_module_h module)
1679 int ret = CAMERA_ERROR_NONE;
1680 muse_camera_handle_s *muse_camera = NULL;
1681 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_ZERO_SHUTTER_LAG;
1682 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1684 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1686 LOGD("handle : %p", muse_camera);
1688 ret = legacy_camera_is_supported_zero_shutter_lag(muse_camera->camera_handle);
1690 LOGD("is supported ret : %d", ret);
1692 muse_camera_msg_return(api, class, ret, module);
1694 return MUSE_CAMERA_ERROR_NONE;
1697 int camera_dispatcher_is_supported_media_packet_preview_cb(muse_module_h module)
1699 int ret = CAMERA_ERROR_NONE;
1700 muse_camera_handle_s *muse_camera = NULL;
1701 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_MEDIA_PACKET_PREVIEW_CB;
1702 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1704 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1706 LOGD("handle : %p", muse_camera);
1708 ret = legacy_camera_is_supported_media_packet_preview_cb(muse_camera->camera_handle);
1710 LOGD("is supported ret : %d", ret);
1712 muse_camera_msg_return(api, class, ret, module);
1714 return MUSE_CAMERA_ERROR_NONE;
1717 int camera_dispatcher_get_device_count(muse_module_h module)
1719 int ret = CAMERA_ERROR_NONE;
1720 muse_camera_handle_s *muse_camera = NULL;
1722 muse_camera_api_e api = MUSE_CAMERA_API_GET_DEVICE_COUNT;
1723 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1725 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1727 LOGD("handle : %p", muse_camera);
1729 ret = legacy_camera_get_device_count(muse_camera->camera_handle, &get_value);
1730 if (ret == CAMERA_ERROR_NONE) {
1731 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
1732 MUSE_CAMERA_GET_INT_DEVICE_COUNT, "get_value", get_value, NULL);
1734 muse_camera_msg_return(api, class, ret, module);
1737 return MUSE_CAMERA_ERROR_NONE;
1740 int camera_dispatcher_start_face_detection(muse_module_h module)
1742 int ret = CAMERA_ERROR_NONE;
1743 muse_camera_handle_s *muse_camera = NULL;
1744 muse_camera_api_e api = MUSE_CAMERA_API_START_FACE_DETECTION;
1745 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1747 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1749 LOGD("Enter, handle : 0x%x, module : %d", muse_camera, module);
1751 ret = legacy_camera_start_face_detection(muse_camera->camera_handle,
1752 (camera_face_detected_cb)_camera_dispatcher_face_detected_cb,
1755 muse_camera_msg_return(api, class, ret, module);
1757 return MUSE_CAMERA_ERROR_NONE;
1760 int camera_dispatcher_stop_face_detection(muse_module_h module)
1762 int ret = CAMERA_ERROR_NONE;
1763 muse_camera_handle_s *muse_camera = NULL;
1764 muse_camera_api_e api = MUSE_CAMERA_API_STOP_FACE_DETECTION;
1765 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1767 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1769 LOGD("handle : %p", muse_camera);
1771 ret = legacy_camera_stop_face_detection(muse_camera->camera_handle);
1773 muse_camera_msg_return(api, class, ret, module);
1775 return MUSE_CAMERA_ERROR_NONE;
1778 int camera_dispatcher_get_state(muse_module_h module)
1780 int ret = CAMERA_ERROR_NONE;
1781 muse_camera_handle_s *muse_camera = NULL;
1782 camera_state_e get_value = CAMERA_STATE_NONE;
1783 muse_camera_api_e api = MUSE_CAMERA_API_GET_STATE;
1784 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1786 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1788 LOGD("handle : %p", muse_camera);
1790 ret = legacy_camera_get_state(muse_camera->camera_handle, &get_value);
1791 if (ret == CAMERA_ERROR_NONE) {
1792 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
1793 MUSE_CAMERA_GET_INT_STATE, "get_value", get_value, NULL);
1795 muse_camera_msg_return(api, class, ret, module);
1798 return MUSE_CAMERA_ERROR_NONE;
1801 int camera_dispatcher_start_focusing(muse_module_h module)
1803 int ret = CAMERA_ERROR_NONE;
1804 muse_camera_handle_s *muse_camera = NULL;
1806 muse_camera_api_e api = MUSE_CAMERA_API_START_FOCUSING;
1807 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1809 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1811 muse_camera_msg_get(is_continuous, muse_core_client_get_msg(module));
1813 LOGD("Enter, handle : 0x%x, module : %d", muse_camera, module);
1815 ret = legacy_camera_start_focusing(muse_camera->camera_handle, (bool)is_continuous);
1817 muse_camera_msg_return(api, class, ret, module);
1819 return MUSE_CAMERA_ERROR_NONE;
1822 int camera_dispatcher_stop_focusing(muse_module_h module)
1824 int ret = CAMERA_ERROR_NONE;
1825 muse_camera_handle_s *muse_camera = NULL;
1826 muse_camera_api_e api = MUSE_CAMERA_API_CANCEL_FOCUSING;
1827 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1829 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1831 LOGD("handle : %p", muse_camera);
1833 ret = legacy_camera_cancel_focusing(muse_camera->camera_handle);
1835 muse_camera_msg_return(api, class, ret, module);
1837 return MUSE_CAMERA_ERROR_NONE;
1840 int camera_dispatcher_set_display(muse_module_h module)
1842 int ret = CAMERA_ERROR_NONE;
1843 muse_camera_handle_s *muse_camera = NULL;
1844 muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY;
1845 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1846 MMCamWaylandInfo *wl_info = NULL;
1847 camera_display_type_e type = CAMERA_DISPLAY_TYPE_NONE;
1848 camera_h camera = NULL;;
1850 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1852 LOGD("handle : 0x%x", muse_camera);
1854 camera = muse_camera->camera_handle;
1856 muse_camera_msg_get(type, muse_core_client_get_msg(module));
1858 LOGD("type %d", type);
1860 if (type == CAMERA_DISPLAY_TYPE_OVERLAY) {
1861 wl_info = &muse_camera->wl_info;
1862 muse_camera_msg_get_array(wl_info, muse_core_client_get_msg(module));
1864 LOGD("wayland global surface id : %d, window : %d,%d,%dx%d",
1865 wl_info->global_surface_id, wl_info->window_x, wl_info->window_y,
1866 wl_info->window_width, wl_info->window_height);
1868 ret = legacy_camera_set_display(muse_camera->camera_handle, type, (void *)wl_info);
1870 muse_camera_msg_return(api, class, ret, module);
1872 LOGD("NOT overlay type. set NONE type.");
1874 if (type == CAMERA_DISPLAY_TYPE_EVAS) {
1875 ret = legacy_camera_set_preview_cb(muse_camera->camera_handle,
1876 (camera_preview_cb)_camera_dispatcher_preview_cb,
1879 if (ret == CAMERA_ERROR_NONE)
1880 SET_PREVIEW_CB_TYPE(muse_camera, PREVIEW_CB_TYPE_EVAS);
1883 ret = legacy_camera_set_display(muse_camera->camera_handle, CAMERA_DISPLAY_TYPE_NONE, NULL);
1885 muse_camera_msg_return(api, class, ret, module);
1888 return MUSE_CAMERA_ERROR_NONE;
1891 int camera_dispatcher_set_preview_resolution(muse_module_h module)
1894 muse_camera_handle_s *muse_camera = NULL;
1896 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1898 muse_camera_msg_get(value, muse_core_client_get_msg(module));
1900 _camera_task_add_job(muse_camera, MUSE_CAMERA_API_SET_PREVIEW_RESOLUTION,
1901 MUSE_CAMERA_API_CLASS_IMMEDIATE, value);
1903 return MUSE_CAMERA_ERROR_NONE;
1906 int camera_dispatcher_set_capture_resolution(muse_module_h module)
1909 muse_camera_handle_s *muse_camera = NULL;
1911 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1913 muse_camera_msg_get(value, muse_core_client_get_msg(module));
1915 _camera_task_add_job(muse_camera, MUSE_CAMERA_API_SET_CAPTURE_RESOLUTION,
1916 MUSE_CAMERA_API_CLASS_IMMEDIATE, value);
1918 return MUSE_CAMERA_ERROR_NONE;
1921 int camera_dispatcher_set_capture_format(muse_module_h module)
1923 int ret = CAMERA_ERROR_NONE;
1924 muse_camera_handle_s *muse_camera = NULL;
1926 muse_camera_api_e api = MUSE_CAMERA_API_SET_CAPTURE_FORMAT;
1927 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1929 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1931 muse_camera_msg_get(set_format, muse_core_client_get_msg(module));
1933 LOGD("handle : 0x%x, set_format : %d", muse_camera, set_format);
1935 ret = legacy_camera_set_capture_format(muse_camera->camera_handle, (camera_pixel_format_e)set_format);
1937 muse_camera_msg_return(api, class, ret, module);
1939 return MUSE_CAMERA_ERROR_NONE;
1942 int camera_dispatcher_set_preview_format(muse_module_h module)
1944 int ret = CAMERA_ERROR_NONE;
1945 muse_camera_handle_s *muse_camera = NULL;
1947 muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_FORMAT;
1948 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1950 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1952 muse_camera_msg_get(set_format, muse_core_client_get_msg(module));
1954 LOGD("handle : 0x%x, set_format : %d", muse_camera, set_format);
1956 ret = legacy_camera_set_preview_format(muse_camera->camera_handle, (camera_pixel_format_e)set_format);
1958 muse_camera_msg_return(api, class, ret, module);
1960 return MUSE_CAMERA_ERROR_NONE;
1963 int camera_dispatcher_get_preview_resolution(muse_module_h module)
1965 int ret = CAMERA_ERROR_NONE;
1966 muse_camera_handle_s *muse_camera = NULL;
1970 muse_camera_api_e api = MUSE_CAMERA_API_GET_PREVIEW_RESOLUTION;
1971 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1973 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1975 LOGD("handle : %p", muse_camera);
1977 ret = legacy_camera_get_preview_resolution(muse_camera->camera_handle, &get_width, &get_height);
1978 if (ret == CAMERA_ERROR_NONE) {
1979 get_value = get_width << 16 | get_height;
1980 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
1981 MUSE_CAMERA_GET_INT_PREVIEW_RESOLUTION, "get_value", get_value, NULL);
1983 muse_camera_msg_return(api, class, ret, module);
1986 return MUSE_CAMERA_ERROR_NONE;
1989 int camera_dispatcher_set_display_rotation(muse_module_h module)
1991 int ret = CAMERA_ERROR_NONE;
1992 muse_camera_handle_s *muse_camera = NULL;
1994 muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY_ROTATION;
1995 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1997 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1999 muse_camera_msg_get(set_rotation, muse_core_client_get_msg(module));
2001 LOGD("handle : 0x%x, set_rotation : %d", muse_camera, set_rotation);
2003 ret = legacy_camera_set_display_rotation(muse_camera->camera_handle, (camera_rotation_e)set_rotation);
2005 muse_camera_msg_return(api, class, ret, module);
2007 return MUSE_CAMERA_ERROR_NONE;
2010 int camera_dispatcher_get_display_rotation(muse_module_h module)
2012 int ret = CAMERA_ERROR_NONE;
2013 muse_camera_handle_s *muse_camera = NULL;
2014 camera_rotation_e get_value = CAMERA_ROTATION_NONE;
2015 muse_camera_api_e api = MUSE_CAMERA_API_GET_DISPLAY_ROTATION;
2016 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2018 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2020 LOGD("handle : %p", muse_camera);
2022 ret = legacy_camera_get_display_rotation(muse_camera->camera_handle, &get_value);
2023 if (ret == CAMERA_ERROR_NONE) {
2024 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
2025 MUSE_CAMERA_GET_INT_DISPLAY_ROTATION, "get_value", get_value, NULL);
2027 muse_camera_msg_return(api, class, ret, module);
2030 return MUSE_CAMERA_ERROR_NONE;
2033 int camera_dispatcher_set_display_flip(muse_module_h module)
2035 int ret = CAMERA_ERROR_NONE;
2036 muse_camera_handle_s *muse_camera = NULL;
2038 muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY_FLIP;
2039 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2041 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2043 muse_camera_msg_get(set_flip, muse_core_client_get_msg(module));
2045 LOGD("handle : 0x%x, set_flip : %d", muse_camera, set_flip);
2047 ret = legacy_camera_set_display_flip(muse_camera->camera_handle, (camera_flip_e)set_flip);
2049 muse_camera_msg_return(api, class, ret, module);
2051 return MUSE_CAMERA_ERROR_NONE;
2054 int camera_dispatcher_get_display_flip(muse_module_h module)
2056 int ret = CAMERA_ERROR_NONE;
2057 muse_camera_handle_s *muse_camera = NULL;
2058 camera_flip_e get_value = CAMERA_FLIP_NONE;
2059 muse_camera_api_e api = MUSE_CAMERA_API_GET_DISPLAY_FLIP;
2060 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2062 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2064 LOGD("handle : %p", muse_camera);
2066 ret = legacy_camera_get_display_flip(muse_camera->camera_handle, &get_value);
2067 if (ret == CAMERA_ERROR_NONE) {
2068 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
2069 MUSE_CAMERA_GET_INT_DISPLAY_FLIP, "get_value", get_value, NULL);
2071 muse_camera_msg_return(api, class, ret, module);
2074 return MUSE_CAMERA_ERROR_NONE;
2077 int camera_dispatcher_set_display_visible(muse_module_h module)
2079 int ret = CAMERA_ERROR_NONE;
2080 muse_camera_handle_s *muse_camera = NULL;
2082 muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY_VISIBLE;
2083 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2085 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2087 muse_camera_msg_get(set_visible, muse_core_client_get_msg(module));
2089 LOGD("handle : 0x%x, set_visible : %d", muse_camera, set_visible);
2091 ret = legacy_camera_set_display_visible(muse_camera->camera_handle, (bool)set_visible);
2093 muse_camera_msg_return(api, class, ret, module);
2095 return MUSE_CAMERA_ERROR_NONE;
2098 int camera_dispatcher_is_display_visible(muse_module_h module)
2100 int ret = CAMERA_ERROR_NONE;
2101 muse_camera_handle_s *muse_camera = NULL;
2102 bool get_value = true;
2103 muse_camera_api_e api = MUSE_CAMERA_API_IS_DISPLAY_VISIBLE;
2104 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2106 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2108 LOGD("handle : %p", muse_camera);
2110 ret = legacy_camera_is_display_visible(muse_camera->camera_handle, &get_value);
2111 if (ret == CAMERA_ERROR_NONE) {
2112 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
2113 MUSE_CAMERA_GET_INT_DISPLAY_VISIBLE, "get_value", get_value, NULL);
2115 muse_camera_msg_return(api, class, ret, module);
2118 return MUSE_CAMERA_ERROR_NONE;
2121 int camera_dispatcher_set_display_mode(muse_module_h module)
2123 int ret = CAMERA_ERROR_NONE;
2124 muse_camera_handle_s *muse_camera = NULL;
2126 muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY_MODE;
2127 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2129 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2131 muse_camera_msg_get(set_mode, muse_core_client_get_msg(module));
2133 LOGD("handle : 0x%x, display_mode : %d", muse_camera, set_mode);
2135 ret = legacy_camera_set_display_mode(muse_camera->camera_handle, (camera_display_mode_e)set_mode);
2137 LOGD("ret : 0x%x", ret);
2139 muse_camera_msg_return(api, class, ret, module);
2141 return MUSE_CAMERA_ERROR_NONE;
2144 int camera_dispatcher_get_display_mode(muse_module_h module)
2146 int ret = CAMERA_ERROR_NONE;
2147 muse_camera_handle_s *muse_camera = NULL;
2148 camera_display_mode_e get_value = CAMERA_DISPLAY_MODE_LETTER_BOX;
2149 muse_camera_api_e api = MUSE_CAMERA_API_GET_DISPLAY_MODE;
2150 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2152 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2154 LOGD("handle : %p", muse_camera);
2156 ret = legacy_camera_get_display_mode(muse_camera->camera_handle, &get_value);
2157 if (ret == CAMERA_ERROR_NONE) {
2158 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
2159 MUSE_CAMERA_GET_INT_DISPLAY_MODE, "get_value", get_value, NULL);
2161 muse_camera_msg_return(api, class, ret, module);
2164 return MUSE_CAMERA_ERROR_NONE;
2167 int camera_dispatcher_get_capture_resolution(muse_module_h module)
2169 int ret = CAMERA_ERROR_NONE;
2170 muse_camera_handle_s *muse_camera = NULL;
2174 muse_camera_api_e api = MUSE_CAMERA_API_GET_CAPTURE_RESOLUTION;
2175 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2177 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2179 LOGD("handle : %p", muse_camera);
2181 ret = legacy_camera_get_capture_resolution(muse_camera->camera_handle, &get_width, &get_height);
2182 if (ret == CAMERA_ERROR_NONE) {
2183 get_value = get_width << 16 | get_height;
2184 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
2185 MUSE_CAMERA_GET_INT_CAPTURE_RESOLUTION, "get_value", get_value, NULL);
2187 muse_camera_msg_return(api, class, ret, module);
2190 return MUSE_CAMERA_ERROR_NONE;
2193 int camera_dispatcher_get_capture_format(muse_module_h module)
2195 int ret = CAMERA_ERROR_NONE;
2196 muse_camera_handle_s *muse_camera = NULL;
2197 camera_pixel_format_e get_value = CAMERA_PIXEL_FORMAT_NV12;
2198 muse_camera_api_e api = MUSE_CAMERA_API_GET_CAPTURE_FORMAT;
2199 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2201 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2203 LOGD("handle : %p", muse_camera);
2205 ret = legacy_camera_get_capture_format(muse_camera->camera_handle, &get_value);
2206 if (ret == CAMERA_ERROR_NONE) {
2207 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
2208 MUSE_CAMERA_GET_INT_CAPTURE_FORMAT, "get_value", get_value, NULL);
2210 muse_camera_msg_return(api, class, ret, module);
2213 return MUSE_CAMERA_ERROR_NONE;
2216 int camera_dispatcher_get_preview_format(muse_module_h module)
2218 int ret = CAMERA_ERROR_NONE;
2219 muse_camera_handle_s *muse_camera = NULL;
2220 camera_pixel_format_e get_value = CAMERA_PIXEL_FORMAT_NV12;
2221 muse_camera_api_e api = MUSE_CAMERA_API_GET_PREVIEW_FORMAT;
2222 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2224 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2226 LOGD("handle : %p", muse_camera);
2228 ret = legacy_camera_get_preview_format(muse_camera->camera_handle, &get_value);
2229 if (ret == CAMERA_ERROR_NONE) {
2230 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
2231 MUSE_CAMERA_GET_INT_PREVIEW_FORMAT, "get_value", get_value, NULL);
2233 muse_camera_msg_return(api, class, ret, module);
2236 return MUSE_CAMERA_ERROR_NONE;
2239 int camera_dispatcher_get_facing_direction(muse_module_h module)
2241 int ret = CAMERA_ERROR_NONE;
2242 muse_camera_handle_s *muse_camera = NULL;
2243 camera_facing_direction_e get_value = CAMERA_FACING_DIRECTION_REAR;
2244 muse_camera_api_e api = MUSE_CAMERA_API_GET_FACING_DIRECTION;
2245 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2247 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2249 LOGD("handle : %p", muse_camera);
2251 ret = legacy_camera_get_facing_direction(muse_camera->camera_handle, &get_value);
2252 if (ret == CAMERA_ERROR_NONE) {
2253 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
2254 MUSE_CAMERA_GET_INT_FACING_DIRECTION, "get_value", get_value, NULL);
2256 muse_camera_msg_return(api, class, ret, module);
2259 return MUSE_CAMERA_ERROR_NONE;
2262 int camera_dispatcher_get_flash_state(muse_module_h module)
2264 int ret = CAMERA_ERROR_NONE;
2266 bool is_called = false;
2267 char value_key[KEY_LENGTH] = {'\0',};
2268 camera_h camera = NULL;
2269 camera_device_e device_type = CAMERA_DEVICE_CAMERA0;
2270 camera_flash_state_e get_flash_state = CAMERA_FLASH_STATE_NOT_USED;
2271 muse_camera_api_e api = MUSE_CAMERA_API_GET_FLASH_STATE;
2272 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2274 muse_camera_msg_get(device_type, muse_core_client_get_msg(module));
2276 if (device_type < CAMERA_DEVICE_CAMERA0 || device_type > CAMERA_DEVICE_CAMERA1) {
2277 LOGE("invalid device %d", device_type);
2279 ret = CAMERA_ERROR_INVALID_PARAMETER;
2280 muse_camera_msg_return(api, class, ret, module);
2282 return MUSE_CAMERA_ERROR_NONE;
2285 muse_core_client_get_value(module, MUSED_KEY_FLASH_STATE_CHECK, (int *)&is_called);
2288 ret = legacy_camera_create(device_type, &camera);
2290 legacy_camera_attr_foreach_supported_flash_mode(camera,
2291 (camera_attr_supported_flash_mode_cb)_camera_dispatcher_callback_supported_flash_mode2,
2294 legacy_camera_destroy(camera);
2298 muse_core_client_set_value(module, MUSED_KEY_FLASH_STATE_RETURN, ret);
2299 muse_core_client_set_value(module, MUSED_KEY_FLASH_STATE_COUNT, count);
2300 muse_core_client_set_value(module, MUSED_KEY_FLASH_STATE_CHECK, (int)true);
2302 muse_core_client_get_value(module, MUSED_KEY_FLASH_STATE_RETURN, &ret);
2303 muse_core_client_get_value(module, MUSED_KEY_FLASH_STATE_COUNT, &count);
2306 LOGD("is_called %d, ret 0x%x, count %d", is_called, ret, count);
2308 if (ret != CAMERA_ERROR_NONE) {
2309 LOGE("failed to create or get camera info 0x%x", ret);
2311 muse_camera_msg_return(api, class, ret, module);
2313 return MUSE_CAMERA_ERROR_NONE;
2317 LOGE("count[%d] of supported flash mode is too small, so return NOT_SUPPORTED", count);
2319 ret = CAMERA_ERROR_NOT_SUPPORTED;
2320 muse_camera_msg_return(api, class, ret, module);
2322 return MUSE_CAMERA_ERROR_NONE;
2325 snprintf(value_key, KEY_LENGTH, "flash_state_camera%d", device_type);
2326 muse_core_client_get_value(module, value_key, (int *)&get_flash_state);
2328 LOGD("[%d] flash state : %d", device_type, get_flash_state);
2330 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
2331 -1, "get_flash_state", get_flash_state, NULL);
2333 return MUSE_CAMERA_ERROR_NONE;
2336 int camera_dispatcher_set_preview_cb(muse_module_h module)
2338 int ret = CAMERA_ERROR_NONE;
2339 muse_camera_handle_s *muse_camera = NULL;
2340 muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_CB;
2341 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2343 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2345 LOGD("handle : %p", muse_camera);
2347 ret = legacy_camera_set_preview_cb(muse_camera->camera_handle,
2348 (camera_preview_cb)_camera_dispatcher_preview_cb,
2351 if (ret == CAMERA_ERROR_NONE)
2352 SET_PREVIEW_CB_TYPE(muse_camera, PREVIEW_CB_TYPE_USER);
2354 LOGD("ret : 0x%x", ret);
2356 muse_camera_msg_return(api, class, ret, module);
2358 return MUSE_CAMERA_ERROR_NONE;
2361 int camera_dispatcher_unset_preview_cb(muse_module_h module)
2363 int ret = CAMERA_ERROR_NONE;
2364 muse_camera_handle_s *muse_camera = NULL;
2365 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_PREVIEW_CB;
2366 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2368 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2370 LOGD("handle : %p", muse_camera);
2372 UNSET_PREVIEW_CB_TYPE(muse_camera, PREVIEW_CB_TYPE_USER);
2373 if (CHECK_PREVIEW_CB(muse_camera, PREVIEW_CB_TYPE_EVAS))
2374 LOGD("Preview callback for evas surface is remained.");
2376 ret = legacy_camera_unset_preview_cb(muse_camera->camera_handle);
2378 LOGD("ret : 0x%x", ret);
2380 muse_camera_msg_return(api, class, ret, module);
2382 return MUSE_CAMERA_ERROR_NONE;
2385 int camera_dispatcher_set_media_packet_preview_cb(muse_module_h module)
2387 int ret = CAMERA_ERROR_NONE;
2388 muse_camera_handle_s *muse_camera = NULL;
2389 muse_camera_api_e api = MUSE_CAMERA_API_SET_MEDIA_PACKET_PREVIEW_CB;
2390 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2392 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2394 LOGD("handle : %p", muse_camera);
2396 ret = legacy_camera_set_media_packet_preview_cb(muse_camera->camera_handle,
2397 (camera_preview_cb)_camera_dispatcher_preview_cb,
2400 LOGD("ret : 0x%x", ret);
2402 muse_camera_msg_return(api, class, ret, module);
2404 return MUSE_CAMERA_ERROR_NONE;
2407 int camera_dispatcher_unset_media_packet_preview_cb(muse_module_h module)
2409 int ret = CAMERA_ERROR_NONE;
2410 muse_camera_handle_s *muse_camera = NULL;
2411 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_MEDIA_PACKET_PREVIEW_CB;
2412 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2414 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2416 LOGD("handle : %p", muse_camera);
2418 ret = legacy_camera_unset_media_packet_preview_cb(muse_camera->camera_handle);
2420 LOGD("ret : 0x%x", ret);
2422 muse_camera_msg_return(api, class, ret, module);
2424 return MUSE_CAMERA_ERROR_NONE;
2427 int camera_dispatcher_set_state_changed_cb(muse_module_h module)
2429 int ret = CAMERA_ERROR_NONE;
2430 muse_camera_api_e api = MUSE_CAMERA_API_SET_STATE_CHANGED_CB;
2431 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2435 muse_camera_msg_return(api, class, ret, module);
2437 return MUSE_CAMERA_ERROR_NONE;
2440 int camera_dispatcher_unset_state_changed_cb(muse_module_h module)
2442 int ret = CAMERA_ERROR_NONE;
2443 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_STATE_CHANGED_CB;
2444 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2448 muse_camera_msg_return(api, class, ret, module);
2450 return MUSE_CAMERA_ERROR_NONE;
2453 int camera_dispatcher_set_interrupted_cb(muse_module_h module)
2455 int ret = CAMERA_ERROR_NONE;
2456 muse_camera_handle_s *muse_camera = NULL;
2457 muse_camera_api_e api = MUSE_CAMERA_API_SET_INTERRUPTED_CB;
2458 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2460 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2462 LOGD("handle : %p", muse_camera);
2464 ret = legacy_camera_set_interrupted_cb(muse_camera->camera_handle,
2465 (camera_interrupted_cb)_camera_dispatcher_interrupted_cb,
2468 LOGD("ret : 0x%x", ret);
2470 muse_camera_msg_return(api, class, ret, module);
2472 return MUSE_CAMERA_ERROR_NONE;
2475 int camera_dispatcher_unset_interrupted_cb(muse_module_h module)
2477 int ret = CAMERA_ERROR_NONE;
2478 muse_camera_handle_s *muse_camera = NULL;
2479 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_INTERRUPTED_CB;
2480 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2482 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2484 LOGD("handle : %p", muse_camera);
2486 ret = legacy_camera_unset_interrupted_cb(muse_camera->camera_handle);
2488 LOGD("ret : 0x%x", ret);
2490 muse_camera_msg_return(api, class, ret, module);
2492 return MUSE_CAMERA_ERROR_NONE;
2495 int camera_dispatcher_set_focus_changed_cb(muse_module_h module)
2497 int ret = CAMERA_ERROR_NONE;
2498 muse_camera_handle_s *muse_camera = NULL;
2499 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOCUS_CHANGED_CB;
2500 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2502 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2504 LOGD("handle : %p", muse_camera);
2506 ret = legacy_camera_set_focus_changed_cb(muse_camera->camera_handle,
2507 (camera_focus_changed_cb)_camera_dispatcher_focus_changed_cb,
2510 LOGD("ret : 0x%x", ret);
2512 muse_camera_msg_return(api, class, ret, module);
2514 return MUSE_CAMERA_ERROR_NONE;
2517 int camera_dispatcher_unset_focus_changed_cb(muse_module_h module)
2519 int ret = CAMERA_ERROR_NONE;
2520 muse_camera_handle_s *muse_camera = NULL;
2521 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_FOCUS_CHANGED_CB;
2522 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2524 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2526 LOGD("handle : %p", muse_camera);
2528 ret = legacy_camera_unset_focus_changed_cb(muse_camera->camera_handle);
2530 LOGD("ret : 0x%x", ret);
2532 muse_camera_msg_return(api, class, ret, module);
2534 return MUSE_CAMERA_ERROR_NONE;
2537 int camera_dispatcher_set_error_cb(muse_module_h module)
2539 int ret = CAMERA_ERROR_NONE;
2540 muse_camera_handle_s *muse_camera = NULL;
2541 muse_camera_api_e api = MUSE_CAMERA_API_SET_ERROR_CB;
2542 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2544 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2546 LOGD("handle : %p", muse_camera);
2548 ret = legacy_camera_set_error_cb(muse_camera->camera_handle,
2549 (camera_error_cb)_camera_dispatcher_error_cb,
2552 LOGD("ret : 0x%x", ret);
2554 muse_camera_msg_return(api, class, ret, module);
2556 return MUSE_CAMERA_ERROR_NONE;
2559 int camera_dispatcher_unset_error_cb(muse_module_h module)
2561 int ret = CAMERA_ERROR_NONE;
2562 muse_camera_handle_s *muse_camera = NULL;
2563 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_ERROR_CB;
2564 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2566 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2568 LOGD("handle : %p", muse_camera);
2570 ret = legacy_camera_unset_error_cb(muse_camera->camera_handle);
2572 LOGD("ret : 0x%x", ret);
2574 muse_camera_msg_return(api, class, ret, module);
2576 return MUSE_CAMERA_ERROR_NONE;
2579 int camera_dispatcher_foreach_supported_preview_resolution(muse_module_h module)
2581 int ret = CAMERA_ERROR_NONE;
2582 muse_camera_handle_s *muse_camera = NULL;
2583 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_PREVIEW_RESOLUTION;
2584 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
2586 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2588 LOGD("handle : %p", muse_camera);
2590 ret = legacy_camera_foreach_supported_preview_resolution(muse_camera->camera_handle,
2591 (camera_supported_preview_resolution_cb)_camera_dispatcher_callback_supported_preview_resolution,
2594 LOGD("ret : 0x%x", ret);
2596 muse_camera_msg_return(api, class, ret, module);
2598 return MUSE_CAMERA_ERROR_NONE;
2601 int camera_dispatcher_foreach_supported_capture_resolution(muse_module_h module)
2603 int ret = CAMERA_ERROR_NONE;
2604 muse_camera_handle_s *muse_camera = NULL;
2605 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_CAPTURE_RESOLUTION;
2606 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
2608 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2610 LOGD("handle : %p", muse_camera);
2612 ret = legacy_camera_foreach_supported_capture_resolution(muse_camera->camera_handle,
2613 (camera_supported_capture_resolution_cb)_camera_dispatcher_callback_supported_capture_resolution,
2616 LOGD("ret : 0x%x", ret);
2618 muse_camera_msg_return(api, class, ret, module);
2620 return MUSE_CAMERA_ERROR_NONE;
2623 int camera_dispatcher_foreach_supported_capture_format(muse_module_h module)
2625 int ret = CAMERA_ERROR_NONE;
2626 muse_camera_handle_s *muse_camera = NULL;
2627 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_CAPTURE_FORMAT;
2628 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
2630 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2632 LOGD("handle : %p", muse_camera);
2634 ret = legacy_camera_foreach_supported_capture_format(muse_camera->camera_handle,
2635 (camera_supported_capture_format_cb)_camera_dispatcher_callback_supported_capture_format,
2638 LOGD("ret : 0x%x", ret);
2640 muse_camera_msg_return(api, class, ret, module);
2642 return MUSE_CAMERA_ERROR_NONE;
2645 int camera_dispatcher_foreach_supported_preview_format(muse_module_h module)
2647 int ret = CAMERA_ERROR_NONE;
2648 muse_camera_handle_s *muse_camera = NULL;
2649 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_PREVIEW_FORMAT;
2650 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
2652 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2654 LOGD("handle : %p", muse_camera);
2656 ret = legacy_camera_foreach_supported_preview_format(muse_camera->camera_handle,
2657 (camera_supported_preview_format_cb)_camera_dispatcher_callback_supported_preview_format,
2660 LOGD("ret : 0x%x", ret);
2662 muse_camera_msg_return(api, class, ret, module);
2664 return MUSE_CAMERA_ERROR_NONE;
2667 int camera_dispatcher_get_recommended_preview_resolution(muse_module_h module)
2669 int ret = CAMERA_ERROR_NONE;
2670 muse_camera_handle_s *muse_camera = NULL;
2674 muse_camera_api_e api = MUSE_CAMERA_API_GET_RECOMMENDED_PREVIEW_RESOLUTION;
2675 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2677 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2679 LOGD("handle : %p", muse_camera);
2681 ret = legacy_camera_get_recommended_preview_resolution(muse_camera->camera_handle, &get_width, &get_height);
2682 if (ret == CAMERA_ERROR_NONE) {
2683 get_value = get_width << 16 | get_height;
2684 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
2685 MUSE_CAMERA_GET_INT_RECOMMENDED_PREVIEW_RESOLUTION, "get_value", get_value, NULL);
2687 muse_camera_msg_return(api, class, ret, module);
2690 return MUSE_CAMERA_ERROR_NONE;
2693 int camera_dispatcher_attr_get_lens_orientation(muse_module_h module)
2695 int ret = CAMERA_ERROR_NONE;
2696 muse_camera_handle_s *muse_camera = NULL;
2698 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_LENS_ORIENTATION;
2699 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2701 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2703 LOGD("handle : %p", muse_camera);
2705 ret = legacy_camera_attr_get_lens_orientation(muse_camera->camera_handle, &get_value);
2706 if (ret == CAMERA_ERROR_NONE) {
2707 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
2708 MUSE_CAMERA_GET_INT_LENS_ORIENTATION, "get_value", get_value, NULL);
2710 muse_camera_msg_return(api, class, ret, module);
2713 return MUSE_CAMERA_ERROR_NONE;
2716 int camera_dispatcher_attr_set_theater_mode(muse_module_h module)
2718 int ret = CAMERA_ERROR_NONE;
2719 muse_camera_handle_s *muse_camera = NULL;
2721 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_THEATER_MODE;
2722 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2724 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2726 muse_camera_msg_get(set_mode, muse_core_client_get_msg(module));
2728 LOGD("handle : %p", muse_camera);
2730 ret = legacy_camera_attr_set_theater_mode(muse_camera->camera_handle, (camera_attr_theater_mode_e)set_mode);
2732 muse_camera_msg_return(api, class, ret, module);
2734 return MUSE_CAMERA_ERROR_NONE;
2737 int camera_dispatcher_attr_get_theater_mode(muse_module_h module)
2739 int ret = CAMERA_ERROR_NONE;
2740 muse_camera_handle_s *muse_camera = NULL;
2741 camera_attr_theater_mode_e get_value = CAMERA_ATTR_THEATER_MODE_DISABLE;
2742 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_THEATER_MODE;
2743 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2745 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2747 LOGD("handle : %p", muse_camera);
2749 ret = legacy_camera_attr_get_theater_mode(muse_camera->camera_handle, &get_value);
2750 if (ret == CAMERA_ERROR_NONE) {
2751 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
2752 MUSE_CAMERA_GET_INT_THEATER_MODE, "get_value", get_value, NULL);
2754 muse_camera_msg_return(api, class, ret, module);
2757 return MUSE_CAMERA_ERROR_NONE;
2760 int camera_dispatcher_attr_foreach_supported_theater_mode(muse_module_h module)
2762 int ret = CAMERA_ERROR_NONE;
2763 muse_camera_handle_s *muse_camera = NULL;
2764 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_THEATER_MODE;
2765 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
2767 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2768 LOGD("handle : %p", muse_camera);
2770 ret = legacy_camera_attr_foreach_supported_theater_mode(muse_camera->camera_handle,
2771 (camera_attr_supported_theater_mode_cb)_camera_dispatcher_callback_supported_theater_mode,
2774 muse_camera_msg_return(api, class, ret, module);
2776 return MUSE_CAMERA_ERROR_NONE;
2779 int camera_dispatcher_attr_set_preview_fps(muse_module_h module)
2781 int ret = CAMERA_ERROR_NONE;
2782 muse_camera_handle_s *muse_camera = NULL;
2784 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_PREVIEW_FPS;
2785 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2787 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2789 muse_camera_msg_get(set_fps, muse_core_client_get_msg(module));
2791 LOGD("handle : %p", muse_camera);
2793 ret = legacy_camera_attr_set_preview_fps(muse_camera->camera_handle, (camera_attr_fps_e)set_fps);
2795 muse_camera_msg_return(api, class, ret, module);
2797 return MUSE_CAMERA_ERROR_NONE;
2800 int camera_dispatcher_attr_set_image_quality(muse_module_h module)
2802 int ret = CAMERA_ERROR_NONE;
2803 muse_camera_handle_s *muse_camera = NULL;
2805 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_IMAGE_QUALITY;
2806 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2808 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2810 muse_camera_msg_get(quality, muse_core_client_get_msg(module));
2812 LOGD("handle : 0x%x, image_quality : %d", muse_camera, quality);
2814 ret = legacy_camera_attr_set_image_quality(muse_camera->camera_handle, quality);
2816 LOGD("ret : 0x%x", ret);
2818 muse_camera_msg_return(api, class, ret, module);
2820 return MUSE_CAMERA_ERROR_NONE;
2823 int camera_dispatcher_attr_get_preview_fps(muse_module_h module)
2825 int ret = CAMERA_ERROR_NONE;
2826 muse_camera_handle_s *muse_camera = NULL;
2827 camera_attr_fps_e get_value = CAMERA_ATTR_FPS_AUTO;
2828 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_PREVIEW_FPS;
2829 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2831 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2833 LOGD("handle : %p", muse_camera);
2835 ret = legacy_camera_attr_get_preview_fps(muse_camera->camera_handle, &get_value);
2836 if (ret == CAMERA_ERROR_NONE) {
2837 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
2838 MUSE_CAMERA_GET_INT_PREVIEW_FPS, "get_value", get_value, NULL);
2840 muse_camera_msg_return(api, class, ret, module);
2843 return MUSE_CAMERA_ERROR_NONE;
2846 int camera_dispatcher_attr_get_image_quality(muse_module_h module)
2848 int ret = CAMERA_ERROR_NONE;
2849 muse_camera_handle_s *muse_camera = NULL;
2851 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_IMAGE_QUALITY;
2852 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2854 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2856 LOGD("handle : %p", muse_camera);
2858 ret = legacy_camera_attr_get_image_quality(muse_camera->camera_handle, &get_value);
2859 if (ret == CAMERA_ERROR_NONE) {
2860 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
2861 MUSE_CAMERA_GET_INT_IMAGE_QUALITY, "get_value", get_value, NULL);
2863 muse_camera_msg_return(api, class, ret, module);
2866 return MUSE_CAMERA_ERROR_NONE;
2869 int camera_dispatcher_attr_set_zoom(muse_module_h module)
2871 int ret = CAMERA_ERROR_NONE;
2872 muse_camera_handle_s *muse_camera = NULL;
2874 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ZOOM;
2875 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2877 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2879 muse_camera_msg_get(zoom, muse_core_client_get_msg(module));
2881 LOGD("handle : 0x%x, zoom : %d", muse_camera, zoom);
2883 ret = legacy_camera_attr_set_zoom(muse_camera->camera_handle, zoom);
2885 LOGD("ret : 0x%x", ret);
2887 muse_camera_msg_return(api, class, ret, module);
2889 return MUSE_CAMERA_ERROR_NONE;
2892 int camera_dispatcher_attr_set_af_mode(muse_module_h module)
2894 int ret = CAMERA_ERROR_NONE;
2895 muse_camera_handle_s *muse_camera = NULL;
2897 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_AF_MODE;
2898 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2900 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2902 muse_camera_msg_get(set_mode, muse_core_client_get_msg(module));
2904 LOGD("handle : 0x%x, set_mode : %d", muse_camera, set_mode);
2906 ret = legacy_camera_attr_set_af_mode(muse_camera->camera_handle, (camera_attr_af_mode_e)set_mode);
2908 LOGD("ret : 0x%x", ret);
2910 muse_camera_msg_return(api, class, ret, module);
2912 return MUSE_CAMERA_ERROR_NONE;
2915 int camera_dispatcher_attr_set_af_area(muse_module_h module)
2917 int ret = CAMERA_ERROR_NONE;
2918 muse_camera_handle_s *muse_camera = NULL;
2922 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_AF_AREA;
2923 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2925 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2927 muse_camera_msg_get(value, muse_core_client_get_msg(module));
2930 y = 0x0000ffff & value;
2932 LOGD("AF area - %d, %d", x, y);
2934 ret = legacy_camera_attr_set_af_area(muse_camera->camera_handle, x, y);
2936 LOGD("ret : 0x%x", ret);
2938 muse_camera_msg_return(api, class, ret, module);
2940 return MUSE_CAMERA_ERROR_NONE;
2943 int camera_dispatcher_attr_clear_af_area(muse_module_h module)
2945 int ret = CAMERA_ERROR_NONE;
2946 muse_camera_handle_s *muse_camera = NULL;
2947 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_CLEAR_AF_AREA;
2948 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2950 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2952 LOGD("handle : %p", muse_camera);
2954 ret = legacy_camera_attr_clear_af_area(muse_camera->camera_handle);
2956 LOGD("ret : 0x%x", ret);
2958 muse_camera_msg_return(api, class, ret, module);
2960 return MUSE_CAMERA_ERROR_NONE;
2963 int camera_dispatcher_attr_set_exposure_mode(muse_module_h module)
2965 int ret = CAMERA_ERROR_NONE;
2966 muse_camera_handle_s *muse_camera = NULL;
2968 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EXPOSURE_MODE;
2969 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2971 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2973 muse_camera_msg_get(set_mode, muse_core_client_get_msg(module));
2975 LOGD("handle : 0x%x, set_mode : %d", muse_camera, set_mode);
2977 ret = legacy_camera_attr_set_exposure_mode(muse_camera->camera_handle, (camera_attr_exposure_mode_e)set_mode);
2979 LOGD("ret : 0x%x", ret);
2981 muse_camera_msg_return(api, class, ret, module);
2983 return MUSE_CAMERA_ERROR_NONE;
2986 int camera_dispatcher_attr_set_exposure(muse_module_h module)
2988 int ret = CAMERA_ERROR_NONE;
2989 muse_camera_handle_s *muse_camera = NULL;
2991 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EXPOSURE;
2992 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2994 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2996 muse_camera_msg_get(value, muse_core_client_get_msg(module));
2998 LOGD("handle : 0x%x, value : %d", muse_camera, value);
3000 ret = legacy_camera_attr_set_exposure(muse_camera->camera_handle, value);
3002 LOGD("ret : 0x%x", ret);
3004 muse_camera_msg_return(api, class, ret, module);
3006 return MUSE_CAMERA_ERROR_NONE;
3009 int camera_dispatcher_attr_set_iso(muse_module_h module)
3011 int ret = CAMERA_ERROR_NONE;
3012 muse_camera_handle_s *muse_camera = NULL;
3014 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ISO;
3015 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3017 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3019 muse_camera_msg_get(set_iso, muse_core_client_get_msg(module));
3021 LOGD("handle : 0x%x, set_iso : %d", muse_camera, set_iso);
3023 ret = legacy_camera_attr_set_iso(muse_camera->camera_handle, (camera_attr_iso_e)set_iso);
3025 LOGD("ret : 0x%x", ret);
3027 muse_camera_msg_return(api, class, ret, module);
3029 return MUSE_CAMERA_ERROR_NONE;
3032 int camera_dispatcher_attr_set_brightness(muse_module_h module)
3034 int ret = CAMERA_ERROR_NONE;
3035 muse_camera_handle_s *muse_camera = NULL;
3037 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_BRIGHTNESS;
3038 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3040 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3042 muse_camera_msg_get(level, muse_core_client_get_msg(module));
3044 LOGD("handle : 0x%x, level : %d", muse_camera, level);
3046 ret = legacy_camera_attr_set_brightness(muse_camera->camera_handle, level);
3048 LOGD("ret : 0x%x", ret);
3050 muse_camera_msg_return(api, class, ret, module);
3052 return MUSE_CAMERA_ERROR_NONE;
3055 int camera_dispatcher_attr_set_contrast(muse_module_h module)
3057 int ret = CAMERA_ERROR_NONE;
3058 muse_camera_handle_s *muse_camera = NULL;
3060 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_CONTRAST;
3061 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3063 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3065 muse_camera_msg_get(level, muse_core_client_get_msg(module));
3067 LOGD("handle : 0x%x, level : %d", muse_camera, level);
3069 ret = legacy_camera_attr_set_contrast(muse_camera->camera_handle, level);
3071 LOGD("ret : 0x%x", ret);
3073 muse_camera_msg_return(api, class, ret, module);
3075 return MUSE_CAMERA_ERROR_NONE;
3078 int camera_dispatcher_attr_set_whitebalance(muse_module_h module)
3080 int ret = CAMERA_ERROR_NONE;
3081 muse_camera_handle_s *muse_camera = NULL;
3082 int set_whitebalance;
3083 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_WHITEBALANCE;
3084 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3086 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3088 muse_camera_msg_get(set_whitebalance, muse_core_client_get_msg(module));
3090 LOGD("handle : 0x%x, set_whitebalance : %d", muse_camera, set_whitebalance);
3092 ret = legacy_camera_attr_set_whitebalance(muse_camera->camera_handle, (camera_attr_whitebalance_e)set_whitebalance);
3094 LOGD("ret : 0x%x", ret);
3096 muse_camera_msg_return(api, class, ret, module);
3098 return MUSE_CAMERA_ERROR_NONE;
3101 int camera_dispatcher_attr_set_effect(muse_module_h module)
3103 int ret = CAMERA_ERROR_NONE;
3104 muse_camera_handle_s *muse_camera = NULL;
3106 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EFFECT;
3107 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3109 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3111 muse_camera_msg_get(set_effect, muse_core_client_get_msg(module));
3113 LOGD("handle : 0x%x, set_effect : %d", muse_camera, set_effect);
3115 ret = legacy_camera_attr_set_effect(muse_camera->camera_handle, (camera_attr_effect_mode_e)set_effect);
3117 LOGD("ret : 0x%x", ret);
3119 muse_camera_msg_return(api, class, ret, module);
3121 return MUSE_CAMERA_ERROR_NONE;
3124 int camera_dispatcher_attr_set_scene_mode(muse_module_h module)
3126 int ret = CAMERA_ERROR_NONE;
3127 muse_camera_handle_s *muse_camera = NULL;
3129 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_SCENE_MODE;
3130 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3132 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3134 muse_camera_msg_get(set_mode, muse_core_client_get_msg(module));
3136 LOGD("handle : 0x%x, set_mode : %d", muse_camera, set_mode);
3138 ret = legacy_camera_attr_set_scene_mode(muse_camera->camera_handle, (camera_attr_scene_mode_e)set_mode);
3140 LOGD("ret : 0x%x", ret);
3142 muse_camera_msg_return(api, class, ret, module);
3144 return MUSE_CAMERA_ERROR_NONE;
3147 int camera_dispatcher_attr_enable_tag(muse_module_h module)
3149 int ret = CAMERA_ERROR_NONE;
3150 muse_camera_handle_s *muse_camera = NULL;
3152 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_TAG;
3153 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3155 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3157 muse_camera_msg_get(set_enable, muse_core_client_get_msg(module));
3159 LOGD("handle : 0x%x, set_enable : %d", muse_camera, set_enable);
3161 ret = legacy_camera_attr_enable_tag(muse_camera->camera_handle, (bool)set_enable);
3163 LOGD("ret : 0x%x", ret);
3165 muse_camera_msg_return(api, class, ret, module);
3167 return MUSE_CAMERA_ERROR_NONE;
3170 int camera_dispatcher_attr_set_tag_image_description(muse_module_h module)
3172 int ret = CAMERA_ERROR_NONE;
3173 muse_camera_handle_s *muse_camera = NULL;
3174 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_IMAGE_DESCRIPTION;
3175 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3176 char description[MUSE_CAMERA_MSG_MAX_LENGTH] = {0,};
3178 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3180 muse_camera_msg_get_string(description, muse_core_client_get_msg(module));
3182 LOGD("handle : 0x%x, description : %s", muse_camera, description);
3184 ret = legacy_camera_attr_set_tag_image_description(muse_camera->camera_handle, description);
3186 LOGD("ret : 0x%x", ret);
3188 muse_camera_msg_return(api, class, ret, module);
3190 return MUSE_CAMERA_ERROR_NONE;
3193 int camera_dispatcher_attr_set_tag_orientation(muse_module_h module)
3195 int ret = CAMERA_ERROR_NONE;
3196 muse_camera_handle_s *muse_camera = NULL;
3197 int set_orientation;
3198 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_ORIENTATION;
3199 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3201 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3203 muse_camera_msg_get(set_orientation, muse_core_client_get_msg(module));
3205 LOGD("handle : 0x%x, set_orientation : %d", muse_camera, set_orientation);
3207 ret = legacy_camera_attr_set_tag_orientation(muse_camera->camera_handle, (camera_attr_tag_orientation_e)set_orientation);
3209 LOGD("ret : 0x%x", ret);
3211 muse_camera_msg_return(api, class, ret, module);
3213 return MUSE_CAMERA_ERROR_NONE;
3216 int camera_dispatcher_attr_set_tag_software(muse_module_h module)
3218 int ret = CAMERA_ERROR_NONE;
3219 muse_camera_handle_s *muse_camera = NULL;
3220 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_SOFTWARE;
3221 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3222 char software[MUSE_CAMERA_MSG_MAX_LENGTH] = {0,};
3224 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3226 muse_camera_msg_get_string(software, muse_core_client_get_msg(module));
3228 LOGD("handle : 0x%x, software : %s", muse_camera, software);
3230 ret = legacy_camera_attr_set_tag_software(muse_camera->camera_handle, software);
3232 LOGD("ret : 0x%x", ret);
3234 muse_camera_msg_return(api, class, ret, module);
3236 return MUSE_CAMERA_ERROR_NONE;
3239 int camera_dispatcher_attr_set_geotag(muse_module_h module)
3241 int ret = CAMERA_ERROR_NONE;
3242 muse_camera_handle_s *muse_camera = NULL;
3243 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_GEOTAG;
3244 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3245 double set_geotag[3] = {0,};
3247 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3249 muse_camera_msg_get_array(set_geotag, muse_core_client_get_msg(module));
3251 LOGD("handle : 0x%x, set_geotag1 : %d, set_geotag2 : %d, set_geotag3 : %d",
3252 muse_camera, set_geotag[0], set_geotag[1], set_geotag[2]);
3254 ret = legacy_camera_attr_set_geotag(muse_camera->camera_handle, set_geotag[0], set_geotag[1], set_geotag[2]);
3256 LOGD("ret : 0x%x", ret);
3258 muse_camera_msg_return(api, class, ret, module);
3260 return MUSE_CAMERA_ERROR_NONE;
3263 int camera_dispatcher_attr_remove_geotag(muse_module_h module)
3265 int ret = CAMERA_ERROR_NONE;
3266 muse_camera_handle_s *muse_camera = NULL;
3267 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_REMOVE_GEOTAG;
3268 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3270 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3272 LOGD("handle : %p", muse_camera);
3274 ret = legacy_camera_attr_remove_geotag(muse_camera->camera_handle);
3276 LOGD("ret : 0x%x", ret);
3278 muse_camera_msg_return(api, class, ret, module);
3280 return MUSE_CAMERA_ERROR_NONE;
3283 int camera_dispatcher_attr_set_flash_mode(muse_module_h module)
3285 int ret = CAMERA_ERROR_NONE;
3287 char value_key[KEY_LENGTH] = {'\0',};
3288 muse_camera_handle_s *muse_camera = NULL;
3289 camera_device_e device_type = CAMERA_DEVICE_CAMERA0;
3290 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_FLASH_MODE;
3291 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3293 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3295 muse_camera_msg_get(set_mode, muse_core_client_get_msg(module));
3297 LOGD("handle : 0x%x, set_mode : %d", muse_camera, set_mode);
3299 ret = legacy_camera_attr_set_flash_mode(muse_camera->camera_handle, (camera_attr_flash_mode_e)set_mode);
3300 if (ret == CAMERA_ERROR_NONE) {
3301 ret = legacy_camera_get_device_type(muse_camera->camera_handle, &device_type);
3302 if (ret == CAMERA_ERROR_NONE) {
3303 snprintf(value_key, KEY_LENGTH, "flash_state_camera%d", device_type);
3304 muse_core_client_set_value(module, value_key, set_mode > 0 ? 1 : 0);
3308 LOGD("ret : 0x%x", ret);
3310 muse_camera_msg_return(api, class, ret, module);
3312 return MUSE_CAMERA_ERROR_NONE;
3315 int camera_dispatcher_attr_get_zoom(muse_module_h module)
3317 int ret = CAMERA_ERROR_NONE;
3318 muse_camera_handle_s *muse_camera = NULL;
3320 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ZOOM;
3321 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3323 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3325 LOGD("handle : %p", muse_camera);
3327 ret = legacy_camera_attr_get_zoom(muse_camera->camera_handle, &get_value);
3328 if (ret == CAMERA_ERROR_NONE) {
3329 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
3330 MUSE_CAMERA_GET_INT_ZOOM, "get_value", get_value, NULL);
3332 muse_camera_msg_return(api, class, ret, module);
3335 return MUSE_CAMERA_ERROR_NONE;
3338 int camera_dispatcher_attr_get_zoom_range(muse_module_h module)
3340 int ret = CAMERA_ERROR_NONE;
3341 muse_camera_handle_s *muse_camera = NULL;
3344 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ZOOM_RANGE;
3345 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3346 muse_camera_get_type_e get_type = MUSE_CAMERA_GET_TYPE_INT_PAIR;
3347 muse_camera_get_int_pair_e index = MUSE_CAMERA_GET_INT_PAIR_ZOOM_RANGE;
3349 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3351 LOGD("handle : %p", muse_camera);
3353 ret = legacy_camera_attr_get_zoom_range(muse_camera->camera_handle, &get_value0, &get_value1);
3354 if (ret == CAMERA_ERROR_NONE)
3355 muse_camera_msg_return2(api, class, ret, module, get_type, index, get_value0, get_value1);
3357 muse_camera_msg_return(api, class, ret, module);
3359 return MUSE_CAMERA_ERROR_NONE;
3362 int camera_dispatcher_attr_get_af_mode(muse_module_h module)
3364 int ret = CAMERA_ERROR_NONE;
3365 muse_camera_handle_s *muse_camera = NULL;
3366 camera_attr_af_mode_e get_value = CAMERA_ATTR_AF_NONE;
3367 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_AF_MODE;
3368 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3370 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3372 LOGD("handle : %p", muse_camera);
3374 ret = legacy_camera_attr_get_af_mode(muse_camera->camera_handle, &get_value);
3375 if (ret == CAMERA_ERROR_NONE) {
3376 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
3377 MUSE_CAMERA_GET_INT_AF_MODE, "get_value", get_value, NULL);
3379 muse_camera_msg_return(api, class, ret, module);
3382 return MUSE_CAMERA_ERROR_NONE;
3385 int camera_dispatcher_attr_get_exposure_mode(muse_module_h module)
3387 int ret = CAMERA_ERROR_NONE;
3388 muse_camera_handle_s *muse_camera = NULL;
3389 camera_attr_exposure_mode_e get_value = CAMERA_ATTR_EXPOSURE_MODE_OFF;
3390 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE_MODE;
3391 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3393 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3395 LOGD("handle : %p", muse_camera);
3397 ret = legacy_camera_attr_get_exposure_mode(muse_camera->camera_handle, &get_value);
3398 if (ret == CAMERA_ERROR_NONE) {
3399 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
3400 MUSE_CAMERA_GET_INT_EXPOSURE_MODE, "get_value", get_value, NULL);
3402 muse_camera_msg_return(api, class, ret, module);
3405 return MUSE_CAMERA_ERROR_NONE;
3408 int camera_dispatcher_attr_get_exposure(muse_module_h module)
3410 int ret = CAMERA_ERROR_NONE;
3411 muse_camera_handle_s *muse_camera = NULL;
3413 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE;
3414 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3416 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3418 LOGD("handle : %p", muse_camera);
3420 ret = legacy_camera_attr_get_exposure(muse_camera->camera_handle, &get_value);
3421 if (ret == CAMERA_ERROR_NONE) {
3422 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
3423 MUSE_CAMERA_GET_INT_EXPOSURE, "get_value", get_value, NULL);
3425 muse_camera_msg_return(api, class, ret, module);
3428 return MUSE_CAMERA_ERROR_NONE;
3431 int camera_dispatcher_attr_get_exposure_range(muse_module_h module)
3433 int ret = CAMERA_ERROR_NONE;
3434 muse_camera_handle_s *muse_camera = NULL;
3437 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE_RANGE;
3438 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3439 muse_camera_get_type_e get_type = MUSE_CAMERA_GET_TYPE_INT_PAIR;
3440 muse_camera_get_int_pair_e index = MUSE_CAMERA_GET_INT_PAIR_EXPOSURE_RANGE;
3442 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3444 LOGD("handle : %p", muse_camera);
3446 ret = legacy_camera_attr_get_exposure_range(muse_camera->camera_handle, &get_value0, &get_value1);
3447 if (ret == CAMERA_ERROR_NONE)
3448 muse_camera_msg_return2(api, class, ret, module, get_type, index, get_value0, get_value1);
3450 muse_camera_msg_return(api, class, ret, module);
3452 return MUSE_CAMERA_ERROR_NONE;
3455 int camera_dispatcher_attr_get_iso(muse_module_h module)
3457 int ret = CAMERA_ERROR_NONE;
3458 muse_camera_handle_s *muse_camera = NULL;
3459 camera_attr_iso_e get_value = CAMERA_ATTR_ISO_AUTO;
3460 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ISO;
3461 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3463 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3465 LOGD("handle : %p", muse_camera);
3467 ret = legacy_camera_attr_get_iso(muse_camera->camera_handle, &get_value);
3468 if (ret == CAMERA_ERROR_NONE) {
3469 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
3470 MUSE_CAMERA_GET_INT_ISO, "get_value", get_value, NULL);
3472 muse_camera_msg_return(api, class, ret, module);
3475 return MUSE_CAMERA_ERROR_NONE;
3478 int camera_dispatcher_attr_get_brightness(muse_module_h module)
3480 int ret = CAMERA_ERROR_NONE;
3481 muse_camera_handle_s *muse_camera = NULL;
3483 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_BRIGHTNESS;
3484 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3486 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3488 LOGD("handle : %p", muse_camera);
3490 ret = legacy_camera_attr_get_brightness(muse_camera->camera_handle, &get_value);
3491 if (ret == CAMERA_ERROR_NONE) {
3492 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
3493 MUSE_CAMERA_GET_INT_BRIGHTNESS, "get_value", get_value, NULL);
3495 muse_camera_msg_return(api, class, ret, module);
3498 return MUSE_CAMERA_ERROR_NONE;
3501 int camera_dispatcher_attr_get_brightness_range(muse_module_h module)
3503 int ret = CAMERA_ERROR_NONE;
3504 muse_camera_handle_s *muse_camera = NULL;
3507 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_BRIGHTNESS_RANGE;
3508 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3509 muse_camera_get_type_e get_type = MUSE_CAMERA_GET_TYPE_INT_PAIR;
3510 muse_camera_get_int_pair_e index = MUSE_CAMERA_GET_INT_PAIR_BRIGHTNESS_RANGE;
3512 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3514 LOGD("handle : %p", muse_camera);
3516 ret = legacy_camera_attr_get_brightness_range(muse_camera->camera_handle, &get_value0, &get_value1);
3517 if (ret == CAMERA_ERROR_NONE)
3518 muse_camera_msg_return2(api, class, ret, module, get_type, index, get_value0, get_value1);
3520 muse_camera_msg_return(api, class, ret, module);
3522 return MUSE_CAMERA_ERROR_NONE;
3525 int camera_dispatcher_attr_get_contrast(muse_module_h module)
3527 int ret = CAMERA_ERROR_NONE;
3528 muse_camera_handle_s *muse_camera = NULL;
3530 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_CONTRAST;
3531 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3533 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3535 LOGD("handle : %p", muse_camera);
3537 ret = legacy_camera_attr_get_contrast(muse_camera->camera_handle, &get_value);
3538 if (ret == CAMERA_ERROR_NONE) {
3539 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
3540 MUSE_CAMERA_GET_INT_CONTRAST, "get_value", get_value, NULL);
3542 muse_camera_msg_return(api, class, ret, module);
3545 return MUSE_CAMERA_ERROR_NONE;
3548 int camera_dispatcher_attr_get_contrast_range(muse_module_h module)
3550 int ret = CAMERA_ERROR_NONE;
3551 muse_camera_handle_s *muse_camera = NULL;
3554 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_CONTRAST_RANGE;
3555 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3556 muse_camera_get_type_e get_type = MUSE_CAMERA_GET_TYPE_INT_PAIR;
3557 muse_camera_get_int_pair_e index = MUSE_CAMERA_GET_INT_PAIR_CONTRAST_RANGE;
3559 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3561 LOGD("handle : %p", muse_camera);
3563 ret = legacy_camera_attr_get_contrast_range(muse_camera->camera_handle, &get_value0, &get_value1);
3564 if (ret == CAMERA_ERROR_NONE)
3565 muse_camera_msg_return2(api, class, ret, module, get_type, index, get_value0, get_value1);
3567 muse_camera_msg_return(api, class, ret, module);
3569 return MUSE_CAMERA_ERROR_NONE;
3572 int camera_dispatcher_attr_get_whitebalance(muse_module_h module)
3574 int ret = CAMERA_ERROR_NONE;
3575 muse_camera_handle_s *muse_camera = NULL;
3576 camera_attr_whitebalance_e get_value = CAMERA_ATTR_WHITE_BALANCE_NONE;
3577 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_WHITEBALANCE;
3578 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3580 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3582 LOGD("handle : %p", muse_camera);
3584 ret = legacy_camera_attr_get_whitebalance(muse_camera->camera_handle, &get_value);
3585 if (ret == CAMERA_ERROR_NONE) {
3586 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
3587 MUSE_CAMERA_GET_INT_WHITE_BALANCE, "get_value", get_value, NULL);
3589 muse_camera_msg_return(api, class, ret, module);
3592 return MUSE_CAMERA_ERROR_NONE;
3595 int camera_dispatcher_attr_get_effect(muse_module_h module)
3597 int ret = CAMERA_ERROR_NONE;
3598 muse_camera_handle_s *muse_camera = NULL;
3599 camera_attr_effect_mode_e get_value = CAMERA_ATTR_EFFECT_NONE;
3600 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EFFECT;
3601 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3603 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3605 LOGD("handle : %p", muse_camera);
3607 ret = legacy_camera_attr_get_effect(muse_camera->camera_handle, &get_value);
3608 if (ret == CAMERA_ERROR_NONE) {
3609 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
3610 MUSE_CAMERA_GET_INT_EFFECT, "get_value", get_value, NULL);
3612 muse_camera_msg_return(api, class, ret, module);
3615 return MUSE_CAMERA_ERROR_NONE;
3618 int camera_dispatcher_attr_get_scene_mode(muse_module_h module)
3620 int ret = CAMERA_ERROR_NONE;
3621 muse_camera_handle_s *muse_camera = NULL;
3622 camera_attr_scene_mode_e get_value = CAMERA_ATTR_SCENE_MODE_NORMAL;
3623 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_SCENE_MODE;
3624 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3626 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3628 LOGD("handle : %p", muse_camera);
3630 ret = legacy_camera_attr_get_scene_mode(muse_camera->camera_handle, &get_value);
3631 if (ret == CAMERA_ERROR_NONE) {
3632 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
3633 MUSE_CAMERA_GET_INT_SCENE_MODE, "get_value", get_value, NULL);
3635 muse_camera_msg_return(api, class, ret, module);
3638 return MUSE_CAMERA_ERROR_NONE;
3641 int camera_dispatcher_attr_is_enabled_tag(muse_module_h module)
3643 int ret = CAMERA_ERROR_NONE;
3644 muse_camera_handle_s *muse_camera = NULL;
3645 bool get_value = false;
3646 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_TAG;
3647 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3649 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3651 LOGD("handle : %p", muse_camera);
3653 ret = legacy_camera_attr_is_enabled_tag(muse_camera->camera_handle, &get_value);
3654 if (ret == CAMERA_ERROR_NONE) {
3655 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
3656 MUSE_CAMERA_GET_INT_ENABLED_TAG, "get_value", get_value, NULL);
3658 muse_camera_msg_return(api, class, ret, module);
3661 return MUSE_CAMERA_ERROR_NONE;
3664 int camera_dispatcher_attr_get_tag_image_description(muse_module_h module)
3666 int ret = CAMERA_ERROR_NONE;
3667 muse_camera_handle_s *muse_camera = NULL;
3668 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_IMAGE_DESCRIPTION;
3669 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3670 char *get_value = NULL;
3672 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3674 ret = legacy_camera_attr_get_tag_image_description(muse_camera->camera_handle, &get_value);
3675 if (ret == CAMERA_ERROR_NONE) {
3676 LOGD("get_description : %s", muse_camera, get_value);
3677 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_STRING,
3678 MUSE_CAMERA_GET_STRING_TAG_IMAGE_DESCRIPTION, "get_value", 0, get_value);
3680 muse_camera_msg_return(api, class, ret, module);
3688 return MUSE_CAMERA_ERROR_NONE;
3691 int camera_dispatcher_attr_get_tag_orientation(muse_module_h module)
3693 int ret = CAMERA_ERROR_NONE;
3694 muse_camera_handle_s *muse_camera = NULL;
3695 camera_attr_tag_orientation_e get_value = CAMERA_ATTR_TAG_ORIENTATION_TOP_LEFT;
3696 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_ORIENTATION;
3697 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3699 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3701 LOGD("handle : %p", muse_camera);
3703 ret = legacy_camera_attr_get_tag_orientation(muse_camera->camera_handle, &get_value);
3704 if (ret == CAMERA_ERROR_NONE) {
3705 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
3706 MUSE_CAMERA_GET_INT_TAG_ORIENTATION, "get_value", get_value, NULL);
3708 muse_camera_msg_return(api, class, ret, module);
3711 return MUSE_CAMERA_ERROR_NONE;
3714 int camera_dispatcher_attr_get_tag_software(muse_module_h module)
3716 int ret = CAMERA_ERROR_NONE;
3717 muse_camera_handle_s *muse_camera = NULL;
3718 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_SOFTWARE;
3719 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3720 char *get_value = NULL;
3722 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3724 ret = legacy_camera_attr_get_tag_software(muse_camera->camera_handle, &get_value);
3725 if (ret == CAMERA_ERROR_NONE) {
3726 LOGD("get_software : %s", get_value);
3727 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_STRING,
3728 MUSE_CAMERA_GET_STRING_TAG_SOFTWARE, "get_value", 0, get_value);
3730 muse_camera_msg_return(api, class, ret, module);
3738 return MUSE_CAMERA_ERROR_NONE;
3741 int camera_dispatcher_attr_get_geotag(muse_module_h module)
3743 int ret = CAMERA_ERROR_NONE;
3744 muse_camera_handle_s *muse_camera = NULL;
3745 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_GEOTAG;
3746 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3747 double get_value[3] = {0.0, 0.0, 0.0};
3748 char *send_msg = NULL;
3749 int msg_array_size = 0;
3751 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3753 LOGD("handle : %p", muse_camera);
3755 ret = legacy_camera_attr_get_geotag(muse_camera->camera_handle, &get_value[0], &get_value[1], &get_value[2]);
3756 if (ret == CAMERA_ERROR_NONE) {
3757 msg_array_size = sizeof(get_value) / sizeof(int) + (sizeof(get_value) % sizeof(int) ? 1 : 0);
3759 send_msg = muse_core_msg_json_factory_new(api,
3760 MUSE_TYPE_INT, PARAM_API_CLASS, class,
3761 MUSE_TYPE_INT, PARAM_RET, ret,
3762 MUSE_TYPE_INT, PARAM_GET_TYPE, MUSE_CAMERA_GET_TYPE_ARRAY,
3763 MUSE_TYPE_ARRAY, "get_value", msg_array_size, get_value,
3766 __camera_dispatcher_send_msg(module, send_msg);
3768 muse_camera_msg_return(api, class, ret, module);
3771 return MUSE_CAMERA_ERROR_NONE;
3774 int camera_dispatcher_attr_get_flash_mode(muse_module_h module)
3776 int ret = CAMERA_ERROR_NONE;
3777 muse_camera_handle_s *muse_camera = NULL;
3778 camera_attr_flash_mode_e get_value = CAMERA_ATTR_FLASH_MODE_OFF;
3779 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_FLASH_MODE;
3780 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3782 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3784 LOGD("handle : %p", muse_camera);
3786 ret = legacy_camera_attr_get_flash_mode(muse_camera->camera_handle, &get_value);
3787 if (ret == CAMERA_ERROR_NONE) {
3788 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
3789 MUSE_CAMERA_GET_INT_FLASH_MODE, "get_value", get_value, NULL);
3791 muse_camera_msg_return(api, class, ret, module);
3794 return MUSE_CAMERA_ERROR_NONE;
3797 int camera_dispatcher_attr_foreach_supported_af_mode(muse_module_h module)
3799 int ret = CAMERA_ERROR_NONE;
3800 muse_camera_handle_s *muse_camera = NULL;
3801 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_AF_MODE;
3802 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
3804 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3806 LOGD("handle : %p", muse_camera);
3808 ret = legacy_camera_attr_foreach_supported_af_mode(muse_camera->camera_handle,
3809 (camera_attr_supported_af_mode_cb)_camera_dispatcher_callback_supported_af_mode,
3812 LOGD("ret : 0x%x", ret);
3814 muse_camera_msg_return(api, class, ret, module);
3816 return MUSE_CAMERA_ERROR_NONE;
3819 int camera_dispatcher_attr_foreach_supported_exposure_mode(muse_module_h module)
3821 int ret = CAMERA_ERROR_NONE;
3822 muse_camera_handle_s *muse_camera = NULL;
3823 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_EXPOSURE_MODE;
3824 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
3826 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3828 LOGD("handle : 0x%x, api : %d", muse_camera, api);
3830 ret = legacy_camera_attr_foreach_supported_exposure_mode(muse_camera->camera_handle,
3831 (camera_attr_supported_exposure_mode_cb)_camera_dispatcher_callback_supported_exposure_mode,
3834 LOGD("ret : 0x%x", ret);
3836 muse_camera_msg_return(api, class, ret, module);
3838 return MUSE_CAMERA_ERROR_NONE;
3841 int camera_dispatcher_attr_foreach_supported_iso(muse_module_h module)
3843 int ret = CAMERA_ERROR_NONE;
3844 muse_camera_handle_s *muse_camera = NULL;
3845 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_ISO;
3846 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
3848 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3850 LOGD("handle : %p", muse_camera);
3852 ret = legacy_camera_attr_foreach_supported_iso(muse_camera->camera_handle,
3853 (camera_attr_supported_iso_cb)_camera_dispatcher_callback_supported_iso_mode,
3856 LOGD("ret : 0x%x", ret);
3858 muse_camera_msg_return(api, class, ret, module);
3860 return MUSE_CAMERA_ERROR_NONE;
3863 int camera_dispatcher_attr_foreach_supported_whitebalance(muse_module_h module)
3865 int ret = CAMERA_ERROR_NONE;
3866 muse_camera_handle_s *muse_camera = NULL;
3867 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_WHITEBALANCE;
3868 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
3870 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3872 LOGD("handle : %p", muse_camera);
3874 ret = legacy_camera_attr_foreach_supported_whitebalance(muse_camera->camera_handle,
3875 (camera_attr_supported_whitebalance_cb)_camera_dispatcher_callback_supported_whitebalance,
3878 LOGD("ret : 0x%x", ret);
3880 muse_camera_msg_return(api, class, ret, module);
3882 return MUSE_CAMERA_ERROR_NONE;
3885 int camera_dispatcher_attr_foreach_supported_effect(muse_module_h module)
3887 int ret = CAMERA_ERROR_NONE;
3888 muse_camera_handle_s *muse_camera = NULL;
3889 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_EFFECT;
3890 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
3892 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3894 LOGD("handle : %p", muse_camera);
3896 ret = legacy_camera_attr_foreach_supported_effect(muse_camera->camera_handle,
3897 (camera_attr_supported_effect_cb)_camera_dispatcher_callback_supported_effect,
3900 LOGD("ret : 0x%x", ret);
3902 muse_camera_msg_return(api, class, ret, module);
3904 return MUSE_CAMERA_ERROR_NONE;
3907 int camera_dispatcher_attr_foreach_supported_scene_mode(muse_module_h module)
3909 int ret = CAMERA_ERROR_NONE;
3910 muse_camera_handle_s *muse_camera = NULL;
3911 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_SCENE_MODE;
3912 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
3914 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3916 LOGD("handle : %p", muse_camera);
3918 ret = legacy_camera_attr_foreach_supported_scene_mode(muse_camera->camera_handle,
3919 (camera_attr_supported_scene_mode_cb)_camera_dispatcher_callback_supported_scene_mode,
3922 LOGD("ret : 0x%x", ret);
3924 muse_camera_msg_return(api, class, ret, module);
3926 return MUSE_CAMERA_ERROR_NONE;
3929 int camera_dispatcher_attr_foreach_supported_flash_mode(muse_module_h module)
3931 int ret = CAMERA_ERROR_NONE;
3932 muse_camera_handle_s *muse_camera = NULL;
3933 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FLASH_MODE;
3934 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
3936 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3938 LOGD("handle : %p", muse_camera);
3940 ret = legacy_camera_attr_foreach_supported_flash_mode(muse_camera->camera_handle,
3941 (camera_attr_supported_flash_mode_cb)_camera_dispatcher_callback_supported_flash_mode,
3944 LOGD("ret : 0x%x", ret);
3946 muse_camera_msg_return(api, class, ret, module);
3948 return MUSE_CAMERA_ERROR_NONE;
3951 int camera_dispatcher_attr_foreach_supported_fps(muse_module_h module)
3953 int ret = CAMERA_ERROR_NONE;
3954 muse_camera_handle_s *muse_camera = NULL;
3955 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FPS;
3956 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
3958 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3960 LOGD("handle : %p", muse_camera);
3962 ret = legacy_camera_attr_foreach_supported_fps(muse_camera->camera_handle,
3963 (camera_attr_supported_fps_cb)_camera_dispatcher_callback_supported_fps,
3966 LOGD("ret : 0x%x", ret);
3968 muse_camera_msg_return(api, class, ret, module);
3970 return MUSE_CAMERA_ERROR_NONE;
3973 int camera_dispatcher_attr_foreach_supported_fps_by_resolution(muse_module_h module)
3975 int ret = CAMERA_ERROR_NONE;
3976 muse_camera_handle_s *muse_camera = NULL;
3977 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FPS_BY_RESOLUTION;
3978 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
3983 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3985 muse_camera_msg_get(value, muse_core_client_get_msg(module));
3987 width = value >> 16;
3988 height = 0x0000ffff & value;
3990 LOGD("handle : %p - %dx%d", muse_camera, width, height);
3992 ret = legacy_camera_attr_foreach_supported_fps_by_resolution(muse_camera->camera_handle,
3994 (camera_attr_supported_fps_cb)_camera_dispatcher_callback_supported_fps_by_resolution,
3997 LOGD("ret : 0x%x", ret);
3999 muse_camera_msg_return(api, class, ret, module);
4001 return MUSE_CAMERA_ERROR_NONE;
4004 int camera_dispatcher_attr_foreach_supported_stream_flip(muse_module_h module)
4006 int ret = CAMERA_ERROR_NONE;
4007 muse_camera_handle_s *muse_camera = NULL;
4008 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_STREAM_FLIP;
4009 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
4011 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4013 LOGD("handle : %p", muse_camera);
4015 ret = legacy_camera_attr_foreach_supported_stream_flip(muse_camera->camera_handle,
4016 (camera_attr_supported_stream_flip_cb)_camera_dispatcher_callback_supported_stream_flip,
4019 LOGD("ret : 0x%x", ret);
4021 muse_camera_msg_return(api, class, ret, module);
4023 return MUSE_CAMERA_ERROR_NONE;
4026 int camera_dispatcher_attr_foreach_supported_stream_rotation(muse_module_h module)
4028 int ret = CAMERA_ERROR_NONE;
4029 muse_camera_handle_s *muse_camera = NULL;
4030 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_STREAM_ROTATION;
4031 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
4033 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4035 LOGD("handle : %p", muse_camera);
4037 ret = legacy_camera_attr_foreach_supported_stream_rotation(muse_camera->camera_handle,
4038 (camera_attr_supported_stream_rotation_cb)_camera_dispatcher_callback_supported_stream_rotation,
4041 LOGD("ret : 0x%x", ret);
4043 muse_camera_msg_return(api, class, ret, module);
4045 return MUSE_CAMERA_ERROR_NONE;
4048 int camera_dispatcher_attr_set_stream_rotation(muse_module_h module)
4050 int ret = CAMERA_ERROR_NONE;
4051 muse_camera_handle_s *muse_camera = NULL;
4052 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_STREAM_ROTATION;
4053 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4056 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4058 muse_camera_msg_get(set_rotation, muse_core_client_get_msg(module));
4060 LOGD("handle : %p", muse_camera);
4062 ret = legacy_camera_attr_set_stream_rotation(muse_camera->camera_handle, (camera_rotation_e)set_rotation);
4064 LOGD("ret : 0x%x", ret);
4066 muse_camera_msg_return(api, class, ret, module);
4068 return MUSE_CAMERA_ERROR_NONE;
4071 int camera_dispatcher_attr_get_stream_rotation(muse_module_h module)
4073 int ret = CAMERA_ERROR_NONE;
4074 muse_camera_handle_s *muse_camera = NULL;
4075 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_STREAM_ROTATION;
4076 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4077 camera_rotation_e get_value = CAMERA_ROTATION_NONE;
4079 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4081 LOGD("handle : %p", muse_camera);
4083 ret = legacy_camera_attr_get_stream_rotation(muse_camera->camera_handle, &get_value);
4084 if (ret == CAMERA_ERROR_NONE) {
4085 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
4086 MUSE_CAMERA_GET_INT_STREAM_ROTATION, "get_value", get_value, NULL);
4088 muse_camera_msg_return(api, class, ret, module);
4091 return MUSE_CAMERA_ERROR_NONE;
4094 int camera_dispatcher_attr_set_stream_flip(muse_module_h module)
4096 int ret = CAMERA_ERROR_NONE;
4097 muse_camera_handle_s *muse_camera = NULL;
4098 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_STREAM_FLIP;
4099 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4102 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4104 muse_camera_msg_get(set_flip, muse_core_client_get_msg(module));
4106 LOGD("handle : %p", muse_camera);
4108 ret = legacy_camera_attr_set_stream_flip(muse_camera->camera_handle, (camera_flip_e)set_flip);
4110 LOGD("ret : 0x%x", ret);
4112 muse_camera_msg_return(api, class, ret, module);
4114 return MUSE_CAMERA_ERROR_NONE;
4117 int camera_dispatcher_attr_get_stream_flip(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_STREAM_FLIP;
4122 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4123 camera_flip_e get_value = CAMERA_FLIP_NONE;
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_stream_flip(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_STREAM_FLIP, "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_set_hdr_mode(muse_module_h module)
4143 muse_camera_handle_s *muse_camera = NULL;
4145 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4147 LOGD("handle : %p", muse_camera);
4149 muse_camera_msg_get(set_mode, muse_core_client_get_msg(module));
4151 _camera_task_add_job(muse_camera, MUSE_CAMERA_API_ATTR_SET_HDR_MODE,
4152 MUSE_CAMERA_API_CLASS_IMMEDIATE, set_mode);
4154 return MUSE_CAMERA_ERROR_NONE;
4157 int camera_dispatcher_attr_get_hdr_mode(muse_module_h module)
4159 int ret = CAMERA_ERROR_NONE;
4160 muse_camera_handle_s *muse_camera = NULL;
4161 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_HDR_MODE;
4162 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4163 camera_attr_hdr_mode_e get_value = CAMERA_ATTR_HDR_MODE_DISABLE;
4165 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4167 LOGD("handle : %p", muse_camera);
4169 ret = legacy_camera_attr_get_hdr_mode(muse_camera->camera_handle, &get_value);
4170 if (ret == CAMERA_ERROR_NONE) {
4171 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
4172 MUSE_CAMERA_GET_INT_HDR_MODE, "get_value", get_value, NULL);
4174 muse_camera_msg_return(api, class, ret, module);
4177 return MUSE_CAMERA_ERROR_NONE;
4180 int camera_dispatcher_attr_is_supported_hdr_capture(muse_module_h module)
4182 int ret = CAMERA_ERROR_NONE;
4183 muse_camera_handle_s *muse_camera = NULL;
4184 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_HDR_CAPTURE;
4185 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4187 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4189 LOGD("handle : %p", muse_camera);
4191 ret = legacy_camera_attr_is_supported_hdr_capture(muse_camera->camera_handle);
4193 LOGD("ret : 0x%x", ret);
4195 muse_camera_msg_return(api, class, ret, module);
4197 return MUSE_CAMERA_ERROR_NONE;
4200 int camera_dispatcher_attr_set_hdr_capture_progress_cb(muse_module_h module)
4202 int ret = CAMERA_ERROR_NONE;
4203 muse_camera_handle_s *muse_camera = NULL;
4204 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_HDR_CAPTURE_PROGRESS_CB;
4205 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4207 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4209 LOGD("handle : %p", muse_camera);
4211 ret = legacy_camera_attr_set_hdr_capture_progress_cb(muse_camera->camera_handle,
4212 (camera_attr_hdr_progress_cb)_camera_dispatcher_hdr_progress_cb,
4215 LOGD("ret : 0x%x", ret);
4217 muse_camera_msg_return(api, class, ret, module);
4219 return MUSE_CAMERA_ERROR_NONE;
4222 int camera_dispatcher_attr_unset_hdr_capture_progress_cb(muse_module_h module)
4224 int ret = CAMERA_ERROR_NONE;
4225 muse_camera_handle_s *muse_camera = NULL;
4226 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_UNSET_HDR_CAPTURE_PROGRESS_CB;
4227 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4229 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4231 LOGD("handle : %p", muse_camera);
4233 ret = legacy_camera_attr_unset_hdr_capture_progress_cb(muse_camera->camera_handle);
4235 LOGD("ret : 0x%x", ret);
4237 muse_camera_msg_return(api, class, ret, module);
4239 return MUSE_CAMERA_ERROR_NONE;
4242 int camera_dispatcher_attr_enable_anti_shake(muse_module_h module)
4244 int ret = CAMERA_ERROR_NONE;
4245 muse_camera_handle_s *muse_camera = NULL;
4246 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_ANTI_SHAKE;
4247 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4250 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4252 muse_camera_msg_get(set_enable, muse_core_client_get_msg(module));
4254 LOGD("handle : %p", muse_camera);
4256 ret = legacy_camera_attr_enable_anti_shake(muse_camera->camera_handle, (bool)set_enable);
4258 LOGD("ret : 0x%x", ret);
4260 muse_camera_msg_return(api, class, ret, module);
4262 return MUSE_CAMERA_ERROR_NONE;
4265 int camera_dispatcher_attr_is_enabled_anti_shake(muse_module_h module)
4267 int ret = CAMERA_ERROR_NONE;
4268 muse_camera_handle_s *muse_camera = NULL;
4269 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_ANTI_SHAKE;
4270 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4271 bool get_value = false;
4273 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4275 LOGD("handle : %p", muse_camera);
4277 ret = legacy_camera_attr_is_enabled_anti_shake(muse_camera->camera_handle, &get_value);
4278 if (ret == CAMERA_ERROR_NONE) {
4279 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
4280 MUSE_CAMERA_GET_INT_ENABLED_ANTI_SHAKE, "get_value", get_value, NULL);
4282 muse_camera_msg_return(api, class, ret, module);
4285 return MUSE_CAMERA_ERROR_NONE;
4288 int camera_dispatcher_attr_is_supported_anti_shake(muse_module_h module)
4290 int ret = CAMERA_ERROR_NONE;
4291 muse_camera_handle_s *muse_camera = NULL;
4292 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_ANTI_SHAKE;
4293 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4295 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4297 LOGD("handle : %p", muse_camera);
4299 ret = legacy_camera_attr_is_supported_anti_shake(muse_camera->camera_handle);
4301 LOGD("ret : 0x%x", ret);
4303 muse_camera_msg_return(api, class, ret, module);
4305 return MUSE_CAMERA_ERROR_NONE;
4308 int camera_dispatcher_attr_enable_video_stabilization(muse_module_h module)
4310 int ret = CAMERA_ERROR_NONE;
4311 muse_camera_handle_s *muse_camera = NULL;
4312 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_VIDEO_STABILIZATION;
4313 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4316 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4318 muse_camera_msg_get(set_enable, muse_core_client_get_msg(module));
4320 LOGD("handle : %p", muse_camera);
4322 ret = legacy_camera_attr_enable_video_stabilization(muse_camera->camera_handle, (bool)set_enable);
4324 LOGD("ret : 0x%x", ret);
4326 muse_camera_msg_return(api, class, ret, module);
4328 return MUSE_CAMERA_ERROR_NONE;
4331 int camera_dispatcher_attr_is_enabled_video_stabilization(muse_module_h module)
4333 int ret = CAMERA_ERROR_NONE;
4334 muse_camera_handle_s *muse_camera = NULL;
4335 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_VIDEO_STABILIZATION;
4336 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4337 bool get_value = false;
4339 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4341 LOGD("handle : %p", muse_camera);
4343 ret = legacy_camera_attr_is_enabled_video_stabilization(muse_camera->camera_handle, &get_value);
4344 if (ret == CAMERA_ERROR_NONE) {
4345 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
4346 MUSE_CAMERA_GET_INT_ENABLED_VIDEO_STABILIZATION, "get_value", get_value, NULL);
4348 muse_camera_msg_return(api, class, ret, module);
4351 return MUSE_CAMERA_ERROR_NONE;
4354 int camera_dispatcher_attr_is_supported_video_stabilization(muse_module_h module)
4356 int ret = CAMERA_ERROR_NONE;
4357 muse_camera_handle_s *muse_camera = NULL;
4358 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_VIDEO_STABILIZATION;
4359 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4361 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4363 LOGD("handle : %p", muse_camera);
4365 ret = legacy_camera_attr_is_supported_video_stabilization(muse_camera->camera_handle);
4367 LOGD("ret : 0x%x", ret);
4369 muse_camera_msg_return(api, class, ret, module);
4371 return MUSE_CAMERA_ERROR_NONE;
4374 int camera_dispatcher_attr_enable_auto_contrast(muse_module_h module)
4376 int ret = CAMERA_ERROR_NONE;
4377 muse_camera_handle_s *muse_camera = NULL;
4378 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_AUTO_CONTRAST;
4379 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4382 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4384 muse_camera_msg_get(set_enable, muse_core_client_get_msg(module));
4386 LOGD("handle : %p", muse_camera);
4388 ret = legacy_camera_attr_enable_auto_contrast(muse_camera->camera_handle, (bool)set_enable);
4390 LOGD("ret : 0x%x", ret);
4392 muse_camera_msg_return(api, class, ret, module);
4394 return MUSE_CAMERA_ERROR_NONE;
4397 int camera_dispatcher_attr_is_enabled_auto_contrast(muse_module_h module)
4399 int ret = CAMERA_ERROR_NONE;
4400 muse_camera_handle_s *muse_camera = NULL;
4401 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_AUTO_CONTRAST;
4402 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4403 bool get_value = false;
4405 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4407 LOGD("handle : %p", muse_camera);
4409 ret = legacy_camera_attr_is_enabled_auto_contrast(muse_camera->camera_handle, &get_value);
4410 if (ret == CAMERA_ERROR_NONE) {
4411 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
4412 MUSE_CAMERA_GET_INT_ENABLED_AUTO_CONTRAST, "get_value", get_value, NULL);
4414 muse_camera_msg_return(api, class, ret, module);
4417 return MUSE_CAMERA_ERROR_NONE;
4420 int camera_dispatcher_attr_is_supported_auto_contrast(muse_module_h module)
4422 int ret = CAMERA_ERROR_NONE;
4423 muse_camera_handle_s *muse_camera = NULL;
4424 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_AUTO_CONTRAST;
4425 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4427 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4429 LOGD("handle : %p", muse_camera);
4431 ret = legacy_camera_attr_is_supported_auto_contrast(muse_camera->camera_handle);
4433 LOGD("ret : 0x%x", ret);
4435 muse_camera_msg_return(api, class, ret, module);
4437 return MUSE_CAMERA_ERROR_NONE;
4440 int camera_dispatcher_attr_disable_shutter_sound(muse_module_h module)
4442 int ret = CAMERA_ERROR_NONE;
4443 muse_camera_handle_s *muse_camera = NULL;
4444 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_DISABLE_SHUTTER_SOUND;
4445 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4448 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4450 muse_camera_msg_get(set_disable, muse_core_client_get_msg(module));
4452 LOGD("handle : %p", muse_camera);
4454 ret = legacy_camera_attr_disable_shutter_sound(muse_camera->camera_handle, (bool)set_disable);
4456 LOGD("ret : 0x%x", ret);
4458 muse_camera_msg_return(api, class, ret, module);
4460 return MUSE_CAMERA_ERROR_NONE;
4463 int camera_dispatcher_attr_get_encoded_preview_bitrate(muse_module_h module)
4465 int ret = CAMERA_ERROR_NONE;
4466 muse_camera_handle_s *muse_camera = NULL;
4468 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ENCODED_PREVIEW_BITRATE;
4469 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4471 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4473 LOGD("handle : %p", muse_camera);
4475 ret = legacy_camera_attr_get_encoded_preview_bitrate(muse_camera->camera_handle, &get_value);
4476 if (ret == CAMERA_ERROR_NONE) {
4477 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
4478 MUSE_CAMERA_GET_INT_ENCODED_PREVIEW_BITRATE, "get_value", get_value, NULL);
4480 muse_camera_msg_return(api, class, ret, module);
4483 return MUSE_CAMERA_ERROR_NONE;
4486 int camera_dispatcher_attr_set_encoded_preview_bitrate(muse_module_h module)
4488 int ret = CAMERA_ERROR_NONE;
4489 muse_camera_handle_s *muse_camera = NULL;
4491 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ENCODED_PREVIEW_BITRATE;
4492 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4494 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4496 muse_camera_msg_get(set_bitrate, muse_core_client_get_msg(module));
4498 LOGD("handle : 0x%x, set_encoded_preview_bitrate : %d", muse_camera, set_bitrate);
4500 ret = legacy_camera_attr_set_encoded_preview_bitrate(muse_camera->camera_handle, set_bitrate);
4502 LOGD("ret : 0x%x", ret);
4504 muse_camera_msg_return(api, class, ret, module);
4506 return MUSE_CAMERA_ERROR_NONE;
4509 int camera_dispatcher_attr_get_encoded_preview_gop_interval(muse_module_h module)
4511 int ret = CAMERA_ERROR_NONE;
4512 muse_camera_handle_s *muse_camera = NULL;
4514 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ENCODED_PREVIEW_GOP_INTERVAL;
4515 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4517 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4519 LOGD("handle : %p", muse_camera);
4521 ret = legacy_camera_attr_get_encoded_preview_gop_interval(muse_camera->camera_handle, &get_value);
4522 if (ret == CAMERA_ERROR_NONE) {
4523 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
4524 MUSE_CAMERA_GET_INT_ENCODED_PREVIEW_GOP_INTERVAL, "get_value", get_value, NULL);
4526 muse_camera_msg_return(api, class, ret, module);
4529 return MUSE_CAMERA_ERROR_NONE;
4532 int camera_dispatcher_attr_set_encoded_preview_gop_interval(muse_module_h module)
4534 int ret = CAMERA_ERROR_NONE;
4535 muse_camera_handle_s *muse_camera = NULL;
4536 int set_gop_interval;
4537 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ENCODED_PREVIEW_GOP_INTERVAL;
4538 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4540 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4542 muse_camera_msg_get(set_gop_interval, muse_core_client_get_msg(module));
4544 LOGD("handle : 0x%x, set_encoded_preview_gop_interval : %d", muse_camera, set_gop_interval);
4546 ret = legacy_camera_attr_set_encoded_preview_gop_interval(muse_camera->camera_handle, set_gop_interval);
4548 LOGD("ret : 0x%x", ret);
4550 muse_camera_msg_return(api, class, ret, module);
4552 return MUSE_CAMERA_ERROR_NONE;
4555 int camera_dispatcher_attr_set_pan(muse_module_h module)
4557 int ret = CAMERA_ERROR_NONE;
4558 muse_camera_handle_s *muse_camera = NULL;
4562 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_PAN;
4563 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4565 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4567 muse_camera_msg_get(value, muse_core_client_get_msg(module));
4570 step = 0x0000ffff & value;
4572 LOGD("handle : 0x%x - type %d, step %d", muse_camera, type, step);
4574 ret = legacy_camera_attr_set_pan(muse_camera->camera_handle, type, step);
4576 LOGD("ret : 0x%x", ret);
4578 muse_camera_msg_return(api, class, ret, module);
4580 return MUSE_CAMERA_ERROR_NONE;
4583 int camera_dispatcher_attr_get_pan(muse_module_h module)
4585 int ret = CAMERA_ERROR_NONE;
4586 muse_camera_handle_s *muse_camera = NULL;
4588 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_PAN;
4589 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4591 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4593 LOGD("handle : %p", muse_camera);
4595 ret = legacy_camera_attr_get_pan(muse_camera->camera_handle, &get_value);
4596 if (ret == CAMERA_ERROR_NONE) {
4597 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
4598 MUSE_CAMERA_GET_INT_PAN, "get_value", get_value, NULL);
4600 muse_camera_msg_return(api, class, ret, module);
4603 return MUSE_CAMERA_ERROR_NONE;
4606 int camera_dispatcher_attr_get_pan_range(muse_module_h module)
4608 int ret = CAMERA_ERROR_NONE;
4609 muse_camera_handle_s *muse_camera = NULL;
4612 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_PAN_RANGE;
4613 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4614 muse_camera_get_type_e get_type = MUSE_CAMERA_GET_TYPE_INT_PAIR;
4615 muse_camera_get_int_pair_e index = MUSE_CAMERA_GET_INT_PAIR_PAN_RANGE;
4617 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4619 LOGD("handle : %p", muse_camera);
4621 ret = legacy_camera_attr_get_pan_range(muse_camera->camera_handle, &get_value0, &get_value1);
4622 if (ret == CAMERA_ERROR_NONE)
4623 muse_camera_msg_return2(api, class, ret, module, get_type, index, get_value0, get_value1);
4625 muse_camera_msg_return(api, class, ret, module);
4627 return MUSE_CAMERA_ERROR_NONE;
4630 int camera_dispatcher_attr_set_tilt(muse_module_h module)
4632 int ret = CAMERA_ERROR_NONE;
4633 muse_camera_handle_s *muse_camera = NULL;
4637 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TILT;
4638 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4640 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4642 muse_camera_msg_get(value, muse_core_client_get_msg(module));
4645 step = 0x0000ffff & value;
4647 LOGD("handle : 0x%x - type %d, step %d", muse_camera, type, step);
4649 ret = legacy_camera_attr_set_tilt(muse_camera->camera_handle, type, step);
4651 LOGD("ret : 0x%x", ret);
4653 muse_camera_msg_return(api, class, ret, module);
4655 return MUSE_CAMERA_ERROR_NONE;
4658 int camera_dispatcher_attr_get_tilt(muse_module_h module)
4660 int ret = CAMERA_ERROR_NONE;
4661 muse_camera_handle_s *muse_camera = NULL;
4663 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TILT;
4664 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4666 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4668 LOGD("handle : %p", muse_camera);
4670 ret = legacy_camera_attr_get_tilt(muse_camera->camera_handle, &get_value);
4671 if (ret == CAMERA_ERROR_NONE) {
4672 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
4673 MUSE_CAMERA_GET_INT_TILT, "get_value", get_value, NULL);
4675 muse_camera_msg_return(api, class, ret, module);
4678 return MUSE_CAMERA_ERROR_NONE;
4681 int camera_dispatcher_attr_get_tilt_range(muse_module_h module)
4683 int ret = CAMERA_ERROR_NONE;
4684 muse_camera_handle_s *muse_camera = NULL;
4687 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TILT_RANGE;
4688 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4689 muse_camera_get_type_e get_type = MUSE_CAMERA_GET_TYPE_INT_PAIR;
4690 muse_camera_get_int_pair_e index = MUSE_CAMERA_GET_INT_PAIR_TILT_RANGE;
4692 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4694 LOGD("handle : %p", muse_camera);
4696 ret = legacy_camera_attr_get_tilt_range(muse_camera->camera_handle, &get_value0, &get_value1);
4697 if (ret == CAMERA_ERROR_NONE)
4698 muse_camera_msg_return2(api, class, ret, module, get_type, index, get_value0, get_value1);
4700 muse_camera_msg_return(api, class, ret, module);
4702 return MUSE_CAMERA_ERROR_NONE;
4705 int camera_dispatcher_attr_set_ptz_type(muse_module_h module)
4707 int ret = CAMERA_ERROR_NONE;
4708 muse_camera_handle_s *muse_camera = NULL;
4709 int set_ptz_type = 0;
4710 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_PTZ_TYPE;
4711 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4713 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4715 muse_camera_msg_get(set_ptz_type, muse_core_client_get_msg(module));
4717 LOGD("handle : 0x%x", muse_camera);
4719 ret = legacy_camera_attr_set_ptz_type(muse_camera->camera_handle, set_ptz_type);
4721 LOGD("ret : 0x%x", ret);
4723 muse_camera_msg_return(api, class, ret, module);
4725 return MUSE_CAMERA_ERROR_NONE;
4728 int camera_dispatcher_attr_foreach_supported_ptz_type(muse_module_h module)
4730 int ret = CAMERA_ERROR_NONE;
4731 muse_camera_handle_s *muse_camera = NULL;
4732 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_PTZ_TYPE;
4733 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
4735 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4737 LOGD("handle : %p", muse_camera);
4739 ret = legacy_camera_attr_foreach_supported_ptz_type(muse_camera->camera_handle,
4740 (camera_attr_supported_ptz_type_cb)_camera_dispatcher_callback_supported_ptz_type,
4743 LOGD("ret : 0x%x", ret);
4745 muse_camera_msg_return(api, class, ret, module);
4747 return MUSE_CAMERA_ERROR_NONE;
4750 int camera_dispatcher_attr_set_display_roi_area(muse_module_h module)
4752 int ret = CAMERA_ERROR_NONE;
4753 muse_camera_handle_s *muse_camera = NULL;
4754 int set_display_roi_area[4] = {0,};
4755 muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY_ROI_AREA;
4756 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4758 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4760 muse_camera_msg_get_array(set_display_roi_area, muse_core_client_get_msg(module));
4762 LOGD("handle : 0x%x, x : %d, y : %d, width : %d, height : %d", muse_camera,
4763 set_display_roi_area[0], set_display_roi_area[1], set_display_roi_area[2], set_display_roi_area[3]);
4765 ret = legacy_camera_attr_set_display_roi_area(muse_camera->camera_handle, set_display_roi_area);
4767 LOGD("ret : 0x%x", ret);
4769 muse_camera_msg_return(api, class, ret, module);
4771 return MUSE_CAMERA_ERROR_NONE;
4774 int camera_dispatcher_attr_get_display_roi_area(muse_module_h module)
4776 int ret = CAMERA_ERROR_NONE;
4777 muse_camera_handle_s *muse_camera = NULL;
4778 int get_value[4] = {0,};
4779 muse_camera_api_e api = MUSE_CAMERA_API_GET_DISPLAY_ROI_AREA;
4780 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4781 char *send_msg = NULL;
4783 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4785 LOGD("handle : %p", muse_camera);
4787 ret = legacy_camera_attr_get_display_roi_area(muse_camera->camera_handle, get_value);
4788 if (ret == CAMERA_ERROR_NONE) {
4789 send_msg = muse_core_msg_json_factory_new(api,
4790 MUSE_TYPE_INT, PARAM_API_CLASS, class,
4791 MUSE_TYPE_INT, PARAM_RET, ret,
4792 MUSE_TYPE_INT, PARAM_GET_TYPE, MUSE_CAMERA_GET_TYPE_ARRAY,
4793 MUSE_TYPE_ARRAY, "get_value", 4, get_value,
4796 __camera_dispatcher_send_msg(module, send_msg);
4798 muse_camera_msg_return(api, class, ret, module);
4801 return MUSE_CAMERA_ERROR_NONE;
4805 int camera_dispatcher_return_buffer(muse_module_h module)
4808 muse_camera_handle_s *muse_camera = NULL;
4810 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4812 muse_camera_msg_get(tbm_key, muse_core_client_get_msg(module));
4814 /*LOGD("handle : %p, key : %d", muse_camera, tbm_key);*/
4816 if (!_camera_remove_export_data(module, tbm_key, FALSE))
4817 LOGE("remove export data failed : key %d", tbm_key);
4819 return MUSE_CAMERA_ERROR_NONE;
4822 int camera_dispatcher_preview_cb_return(muse_module_h module)
4824 muse_camera_handle_s *muse_camera = NULL;
4826 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4828 if (muse_camera == NULL) {
4829 LOGE("NULL handle");
4830 return MUSE_CAMERA_ERROR_NONE;
4835 g_mutex_lock(&muse_camera->preview_cb_lock);
4836 g_cond_signal(&muse_camera->preview_cb_cond);
4837 /*LOGD("send signal for preview callback");*/
4838 g_mutex_unlock(&muse_camera->preview_cb_lock);
4842 return MUSE_CAMERA_ERROR_NONE;
4845 int camera_dispatcher_set_display_reuse_hint(muse_module_h module)
4847 int ret = CAMERA_ERROR_NONE;
4849 muse_camera_handle_s *muse_camera = NULL;
4850 muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY_REUSE_HINT;
4851 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4853 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4855 muse_camera_msg_get(set_hint, muse_core_client_get_msg(module));
4857 LOGD("set hint : %d", set_hint);
4859 ret = legacy_camera_set_display_reuse_hint(muse_camera->camera_handle, (bool)set_hint);
4861 muse_camera_msg_return(api, class, ret, module);
4863 return MUSE_CAMERA_ERROR_NONE;
4866 int camera_dispatcher_get_display_reuse_hint(muse_module_h module)
4868 int ret = CAMERA_ERROR_NONE;
4870 muse_camera_handle_s *muse_camera = NULL;
4871 muse_camera_api_e api = MUSE_CAMERA_API_GET_DISPLAY_REUSE_HINT;
4872 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4874 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4876 ret = legacy_camera_get_display_reuse_hint(muse_camera->camera_handle, &get_value);
4877 if (ret == CAMERA_ERROR_NONE) {
4878 LOGD("hint : %d", get_value);
4879 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
4880 MUSE_CAMERA_GET_INT_DISPLAY_REUSE_HINT, "get_value", get_value, NULL);
4882 muse_camera_msg_return(api, class, ret, module);
4885 return MUSE_CAMERA_ERROR_NONE;
4888 int camera_dispatcher_get_device_state(muse_module_h module)
4890 int ret = CAMERA_ERROR_NONE;
4891 bool is_called = false;
4892 char value_key[KEY_LENGTH] = {'\0',};
4893 camera_h camera = NULL;
4894 camera_device_e device_type = CAMERA_DEVICE_CAMERA0;
4895 camera_device_state_e get_device_state = CAMERA_DEVICE_STATE_NULL;
4896 muse_camera_api_e api = MUSE_CAMERA_API_GET_DEVICE_STATE;
4897 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4899 muse_camera_msg_get(device_type, muse_core_client_get_msg(module));
4901 if (device_type < CAMERA_DEVICE_CAMERA0 || device_type > CAMERA_DEVICE_CAMERA1) {
4902 LOGE("invalid device %d", device_type);
4904 ret = CAMERA_ERROR_INVALID_PARAMETER;
4905 muse_camera_msg_return(api, class, ret, module);
4907 return MUSE_CAMERA_ERROR_NONE;
4910 muse_core_client_get_value(module, MUSED_KEY_DEVICE_STATE_CHECK, (int *)&is_called);
4913 ret = legacy_camera_create(device_type, &camera);
4915 legacy_camera_destroy(camera);
4919 muse_core_client_set_value(module, MUSED_KEY_DEVICE_STATE_RETURN, ret);
4920 muse_core_client_set_value(module, MUSED_KEY_DEVICE_STATE_CHECK, (int)true);
4922 muse_core_client_get_value(module, MUSED_KEY_DEVICE_STATE_RETURN, &ret);
4925 LOGD("is_called %d, ret 0x%x", is_called, ret);
4927 if (ret != CAMERA_ERROR_NONE) {
4928 LOGE("failed to create camera handle 0x%x", ret);
4930 muse_camera_msg_return(api, class, ret, module);
4932 return MUSE_CAMERA_ERROR_NONE;
4935 snprintf(value_key, KEY_LENGTH, "device_state_camera%d", device_type);
4936 muse_core_client_get_value(module, value_key, (int *)&get_device_state);
4938 LOGD("device[%d] state : %d", device_type, get_device_state);
4940 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
4941 -1, "get_device_state", get_device_state, NULL);
4943 return MUSE_CAMERA_ERROR_NONE;
4946 int (*dispatcher[MUSE_CAMERA_API_MAX]) (muse_module_h module) = {
4947 camera_dispatcher_create, /* MUSE_CAMERA_API_CREATE */
4948 camera_dispatcher_destroy, /* MUSE_CAMERA_API_DESTROY */
4949 camera_dispatcher_start_preview, /* MUSE_CAMERA_START_PREVIEW */
4950 camera_dispatcher_stop_preview, /* MUSE_CAMERA_API_START_PREVIEW */
4951 camera_dispatcher_start_capture, /* MUSE_CAMERA_START_CAPTURE */
4952 camera_dispatcher_is_supported_continuous_capture, /* MUSE_CAMERA_API_SUPPORT_CONTINUOUS_CAPTURE */
4953 camera_dispatcher_start_continuous_capture, /* MUSE_CAMERA_API_START_CONTINUOUS_CAPTURE, */
4954 camera_dispatcher_stop_continuous_capture, /* MUSE_CAMERA_API_STOP_CONTINUOUS_CAPTURE, */
4955 camera_dispatcher_is_supported_face_detection, /* MUSE_CAMERA_API_SUPPORT_FACE_DETECTION, */
4956 camera_dispatcher_is_supported_zero_shutter_lag, /* MUSE_CAMERA_API_SUPPORT_ZERO_SHUTTER_LAG, */
4957 camera_dispatcher_is_supported_media_packet_preview_cb, /* MUSE_CAMERA_API_SUPPORT_MEDIA_PACKET_PREVIEW_CB, */
4958 camera_dispatcher_get_device_count, /* MUSE_CAMERA_API_GET_DEVICE_COUNT, */
4959 camera_dispatcher_start_face_detection, /* MUSE_CAMERA_API_START_FACE_DETECTION, */
4960 camera_dispatcher_stop_face_detection, /* MUSE_CAMERA_API_STOP_FACE_DETECTION, */
4961 camera_dispatcher_get_state, /* MUSE_CAMERA_API_GET_STATE, */
4962 camera_dispatcher_start_focusing, /* MUSE_CAMERA_API_START_FOCUSING, */
4963 camera_dispatcher_stop_focusing, /* MUSE_CAMERA_API_CANCEL_FOCUSING, */
4964 camera_dispatcher_set_display, /* MUSE_CAMERA_API_SET_DISPLAY, */
4965 camera_dispatcher_set_preview_resolution, /* MUSE_CAMERA_API_SET_PREVIEW_RESOLUTION, */
4966 camera_dispatcher_set_capture_resolution, /* MUSE_CAMERA_API_SET_CAPTURE_RESOLUTION, */
4967 camera_dispatcher_set_capture_format, /* MUSE_CAMERA_API_SET_CAPTURE_FORMAT, */
4968 camera_dispatcher_set_preview_format, /* MUSE_CAMERA_API_SET_PREVIEW_FORMAT, */
4969 camera_dispatcher_get_preview_resolution, /* MUSE_CAMERA_API_GET_PREVIEW_RESOLUTION, */
4970 camera_dispatcher_set_display_rotation, /* MUSE_CAMERA_API_SET_DISPLAY_ROTATION, */
4971 camera_dispatcher_get_display_rotation, /* MUSE_CAMERA_API_GET_DISPLAY_ROTATION, */
4972 camera_dispatcher_set_display_flip, /* MUSE_CAMERA_API_SET_DISPLAY_FLIP, */
4973 camera_dispatcher_get_display_flip, /* MUSE_CAMERA_API_GET_DISPLAY_FLIP, */
4974 camera_dispatcher_set_display_visible, /* MUSE_CAMERA_API_SET_DISPLAY_VISIBLE, */
4975 camera_dispatcher_is_display_visible, /* MUSE_CAMERA_API_IS_DISPLAY_VISIBLE, */
4976 camera_dispatcher_set_display_mode, /* MUSE_CAMERA_API_SET_DISPLAY_MODE, */
4977 camera_dispatcher_get_display_mode, /* MUSE_CAMERA_API_GET_DISPLAY_MODE, */
4978 camera_dispatcher_get_capture_resolution, /* MUSE_CAMERA_API_GET_CAPTURE_RESOLUTION, */
4979 camera_dispatcher_get_capture_format, /* MUSE_CAMERA_API_GET_CAPTURE_FORMAT, */
4980 camera_dispatcher_get_preview_format, /* MUSE_CAMERA_API_GET_PREVIEW_FORMAT, */
4981 camera_dispatcher_get_facing_direction, /* MUSE_CAMERA_API_GET_FACING_DIRECTION, */
4982 camera_dispatcher_get_flash_state, /* MUSE_CAMERA_API_GET_FLASH_STATE, */
4983 camera_dispatcher_set_preview_cb, /* MUSE_CAMERA_API_SET_PREVIEW_CB, */
4984 camera_dispatcher_unset_preview_cb, /* MUSE_CAMERA_API_UNSET_PREVIEW_CB, */
4985 camera_dispatcher_set_media_packet_preview_cb, /* MUSE_CAMERA_API_SET_MEDIA_PACKET_PREVIEW_CB, */
4986 camera_dispatcher_unset_media_packet_preview_cb, /* MUSE_CAMERA_API_UNSET_MEDIA_PACKET_PREVIEW_CB, */
4987 camera_dispatcher_set_state_changed_cb, /* MUSE_CAMERA_API_SET_STATE_CHANGED_CB, */
4988 camera_dispatcher_unset_state_changed_cb, /* MUSE_CAMERA_API_UNSET_STATE_CHANGED_CB, */
4989 camera_dispatcher_set_interrupted_cb, /* MUSE_CAMERA_API_SET_INTERRUPTED_CB, */
4990 camera_dispatcher_unset_interrupted_cb, /* MUSE_CAMERA_API_UNSET_INTERRUPTED_CB, */
4991 camera_dispatcher_set_focus_changed_cb, /* MUSE_CAMERA_API_SET_FOCUS_CHANGED_CB, */
4992 camera_dispatcher_unset_focus_changed_cb, /* MUSE_CAMERA_API_UNSET_FOCUS_CHANGED_CB, */
4993 camera_dispatcher_set_error_cb, /* MUSE_CAMERA_API_SET_ERROR_CB, */
4994 camera_dispatcher_unset_error_cb, /* MUSE_CAMERA_API_UNSET_ERROR_CB, */
4995 camera_dispatcher_foreach_supported_preview_resolution, /* MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_PREVIEW_RESOLUTION, */
4996 camera_dispatcher_foreach_supported_capture_resolution, /* MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_CAPTURE_RESOLUTION, */
4997 camera_dispatcher_foreach_supported_capture_format, /* MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_CAPTURE_FORMAT, */
4998 camera_dispatcher_foreach_supported_preview_format, /* MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_PREVIEW_FORMAT, */
4999 camera_dispatcher_get_recommended_preview_resolution, /* MUSE_CAMERA_API_GET_RECOMMENDED_PREVIEW_RESOLUTION, */
5000 camera_dispatcher_attr_get_lens_orientation, /* MUSE_CAMERA_API_ATTR_GET_LENS_ORIENTATION, */
5001 camera_dispatcher_attr_set_theater_mode, /* MUSE_CAMERA_API_ATTR_SET_THEATER_MODE, */
5002 camera_dispatcher_attr_get_theater_mode, /* MUSE_CAMERA_API_ATTR_GET_THEATER_MODE, */
5003 camera_dispatcher_attr_foreach_supported_theater_mode, /* MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_THEATER_MODE, */
5004 camera_dispatcher_attr_set_preview_fps, /* MUSE_CAMERA_API_ATTR_SET_PREVIEW_FPS, */
5005 camera_dispatcher_attr_set_image_quality, /* MUSE_CAMERA_API_ATTR_SET_IMAGE_QUALITY, */
5006 camera_dispatcher_attr_get_preview_fps, /* MUSE_CAMERA_API_ATTR_GET_PREVIEW_FPS, */
5007 camera_dispatcher_attr_get_image_quality, /* MUSE_CAMERA_API_ATTR_GET_IMAGE_QUALITY, */
5008 camera_dispatcher_attr_set_zoom, /* MUSE_CAMERA_API_ATTR_SET_ZOOM, */
5009 camera_dispatcher_attr_set_af_mode, /* MUSE_CAMERA_API_ATTR_SET_AF_MODE, */
5010 camera_dispatcher_attr_set_af_area, /* MUSE_CAMERA_API_ATTR_SET_AF_AREA, */
5011 camera_dispatcher_attr_clear_af_area, /* MUSE_CAMERA_API_ATTR_CLEAR_AF_AREA, */
5012 camera_dispatcher_attr_set_exposure_mode, /* MUSE_CAMERA_API_ATTR_SET_EXPOSURE_MODE, */
5013 camera_dispatcher_attr_set_exposure, /* MUSE_CAMERA_API_ATTR_SET_EXPOSURE, */
5014 camera_dispatcher_attr_set_iso, /* MUSE_CAMERA_API_ATTR_SET_ISO, */
5015 camera_dispatcher_attr_set_brightness, /* MUSE_CAMERA_API_ATTR_SET_BRIGHTNESS, */
5016 camera_dispatcher_attr_set_contrast, /* MUSE_CAMERA_API_ATTR_SET_CONTRAST, */
5017 camera_dispatcher_attr_set_whitebalance, /* MUSE_CAMERA_API_ATTR_SET_WHITEBALANCE, */
5018 camera_dispatcher_attr_set_effect, /* MUSE_CAMERA_API_ATTR_SET_EFFECT, */
5019 camera_dispatcher_attr_set_scene_mode, /* MUSE_CAMERA_API_ATTR_SET_SCENE_MODE, */
5020 camera_dispatcher_attr_enable_tag, /* MUSE_CAMERA_API_ATTR_ENABLE_TAG, */
5021 camera_dispatcher_attr_set_tag_image_description, /* MUSE_CAMERA_API_ATTR_SET_TAG_IMAGE_DESCRIPTION, */
5022 camera_dispatcher_attr_set_tag_orientation, /* MUSE_CAMERA_API_ATTR_SET_TAG_ORIENTATION, */
5023 camera_dispatcher_attr_set_tag_software, /* MUSE_CAMERA_API_ATTR_SET_TAG_SOFTWARE, */
5024 camera_dispatcher_attr_set_geotag, /* MUSE_CAMERA_API_ATTR_SET_GEOTAG, */
5025 camera_dispatcher_attr_remove_geotag, /* MUSE_CAMERA_API_ATTR_REMOVE_GEOTAG, */
5026 camera_dispatcher_attr_set_flash_mode, /* MUSE_CAMERA_API_ATTR_SET_FLASH_MODE, */
5027 camera_dispatcher_attr_get_zoom, /* MUSE_CAMERA_API_ATTR_GET_ZOOM, */
5028 camera_dispatcher_attr_get_zoom_range, /* MUSE_CAMERA_API_ATTR_GET_ZOOM_RANGE, */
5029 camera_dispatcher_attr_get_af_mode, /* MUSE_CAMERA_API_ATTR_GET_AF_MODE, */
5030 camera_dispatcher_attr_get_exposure_mode, /* MUSE_CAMERA_API_ATTR_GET_EXPOSURE_MODE, */
5031 camera_dispatcher_attr_get_exposure, /* MUSE_CAMERA_API_ATTR_GET_EXPOSURE, */
5032 camera_dispatcher_attr_get_exposure_range, /* MUSE_CAMERA_API_ATTR_GET_EXPOSURE_RANGE, */
5033 camera_dispatcher_attr_get_iso, /* MUSE_CAMERA_API_ATTR_GET_ISO, */
5034 camera_dispatcher_attr_get_brightness, /* MUSE_CAMERA_API_ATTR_GET_BRIGHTNESS, */
5035 camera_dispatcher_attr_get_brightness_range, /* MUSE_CAMERA_API_ATTR_GET_BRIGHTNESS_RANGE, */
5036 camera_dispatcher_attr_get_contrast, /* MUSE_CAMERA_API_ATTR_GET_CONTRAST, */
5037 camera_dispatcher_attr_get_contrast_range, /* MUSE_CAMERA_API_ATTR_GET_CONTRAST_RANGE, */
5038 camera_dispatcher_attr_get_whitebalance, /* MUSE_CAMERA_API_ATTR_GET_WHITEBALANCE, */
5039 camera_dispatcher_attr_get_effect, /* MUSE_CAMERA_API_ATTR_GET_EFFECT, */
5040 camera_dispatcher_attr_get_scene_mode, /* MUSE_CAMERA_API_ATTR_GET_SCENE_MODE, */
5041 camera_dispatcher_attr_is_enabled_tag, /* MUSE_CAMERA_API_ATTR_IS_ENABLED_TAG, */
5042 camera_dispatcher_attr_get_tag_image_description, /* MUSE_CAMERA_API_ATTR_GET_TAG_IMAGE_DESCRIPTION, */
5043 camera_dispatcher_attr_get_tag_orientation, /* MUSE_CAMERA_API_ATTR_GET_TAG_ORIENTATION, */
5044 camera_dispatcher_attr_get_tag_software, /* MUSE_CAMERA_API_ATTR_GET_TAG_SOFTWARE, */
5045 camera_dispatcher_attr_get_geotag, /* MUSE_CAMERA_API_ATTR_GET_GEOTAG, */
5046 camera_dispatcher_attr_get_flash_mode, /* MUSE_CAMERA_API_ATTR_GET_FLASH_MODE, */
5047 camera_dispatcher_attr_foreach_supported_af_mode, /* MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_AF_MODE, */
5048 camera_dispatcher_attr_foreach_supported_exposure_mode, /* MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_EXPOSURE_MODE, */
5049 camera_dispatcher_attr_foreach_supported_iso, /* MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_ISO, */
5050 camera_dispatcher_attr_foreach_supported_whitebalance, /* MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_WHITEBALANCE, */
5051 camera_dispatcher_attr_foreach_supported_effect, /* MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_EFFECT, */
5052 camera_dispatcher_attr_foreach_supported_scene_mode, /* MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_SCENE_MODE, */
5053 camera_dispatcher_attr_foreach_supported_flash_mode, /* MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FLASH_MODE, */
5054 camera_dispatcher_attr_foreach_supported_fps, /* MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FPS, */
5055 camera_dispatcher_attr_foreach_supported_fps_by_resolution, /* MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FPS_BY_RESOLUTION, */
5056 camera_dispatcher_attr_foreach_supported_stream_flip, /* MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_STREAM_FLIP, */
5057 camera_dispatcher_attr_foreach_supported_stream_rotation, /* MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_STREAM_ROTATION, */
5058 camera_dispatcher_attr_set_stream_rotation, /* MUSE_CAMERA_API_ATTR_SET_STREAM_ROTATION, */
5059 camera_dispatcher_attr_get_stream_rotation, /* MUSE_CAMERA_API_ATTR_GET_STREAM_ROTATION, */
5060 camera_dispatcher_attr_set_stream_flip, /* MUSE_CAMERA_API_ATTR_SET_STREAM_FLIP, */
5061 camera_dispatcher_attr_get_stream_flip, /* MUSE_CAMERA_API_ATTR_GET_STREAM_FLIP, */
5062 camera_dispatcher_attr_set_hdr_mode, /* MUSE_CAMERA_API_ATTR_SET_HDR_MODE, */
5063 camera_dispatcher_attr_get_hdr_mode, /* MUSE_CAMERA_API_ATTR_GET_HDR_MODE, */
5064 camera_dispatcher_attr_is_supported_hdr_capture, /* MUSE_CAMERA_API_ATTR_IS_SUPPORTED_HDR_CAPTURE, */
5065 camera_dispatcher_attr_set_hdr_capture_progress_cb, /* MUSE_CAMERA_API_ATTR_SET_HDR_CAPTURE_PROGRESS_CB, */
5066 camera_dispatcher_attr_unset_hdr_capture_progress_cb, /* MUSE_CAMERA_API_ATTR_UNSET_HDR_CAPTURE_PROGRESS_CB, */
5067 camera_dispatcher_attr_enable_anti_shake, /* MUSE_CAMERA_API_ATTR_ENABLE_ANTI_SHAKE, */
5068 camera_dispatcher_attr_is_enabled_anti_shake, /* MUSE_CAMERA_API_ATTR_IS_ENABLED_ANTI_SHAKE, */
5069 camera_dispatcher_attr_is_supported_anti_shake, /* MUSE_CAMERA_API_ATTR_IS_SUPPORTED_ANTI_SHAKE, */
5070 camera_dispatcher_attr_enable_video_stabilization, /* MUSE_CAMERA_API_ATTR_ENABLE_VIDEO_STABILIZATION, */
5071 camera_dispatcher_attr_is_enabled_video_stabilization, /* MUSE_CAMERA_API_ATTR_IS_ENABLED_VIDEO_STABILIZATION, */
5072 camera_dispatcher_attr_is_supported_video_stabilization, /* MUSE_CAMERA_API_ATTR_IS_SUPPORTED_VIDEO_STABILIZATION, */
5073 camera_dispatcher_attr_enable_auto_contrast, /* MUSE_CAMERA_API_ATTR_ENABLE_AUTO_CONTRAST, */
5074 camera_dispatcher_attr_is_enabled_auto_contrast, /* MUSE_CAMERA_API_ATTR_IS_ENABLED_AUTO_CONTRAST, */
5075 camera_dispatcher_attr_is_supported_auto_contrast, /* MUSE_CAMERA_API_ATTR_IS_SUPPORTED_AUTO_CONTRAST, */
5076 camera_dispatcher_attr_disable_shutter_sound, /* MUSE_CAMERA_API_ATTR_DISABLE_SHUTTER_SOUND, */
5077 camera_dispatcher_attr_get_encoded_preview_bitrate, /* MUSE_CAMERA_API_ATTR_GET_ENCODED_PREVIEW_BITRATE, */
5078 camera_dispatcher_attr_set_encoded_preview_bitrate, /* MUSE_CAMERA_API_ATTR_SET_ENCODED_PREVIEW_BITRATE, */
5079 camera_dispatcher_attr_get_encoded_preview_gop_interval, /* MUSE_CAMERA_API_ATTR_GET_ENCODED_PREVIEW_GOP_INTERVAL, */
5080 camera_dispatcher_attr_set_encoded_preview_gop_interval, /* MUSE_CAMERA_API_ATTR_SET_ENCODED_PREVIEW_GOP_INTERVAL, */
5081 camera_dispatcher_attr_set_pan, /* MUSE_CAMERA_API_ATTR_SET_PAN */
5082 camera_dispatcher_attr_get_pan, /* MUSE_CAMERA_API_ATTR_GET_PAN */
5083 camera_dispatcher_attr_get_pan_range, /* MUSE_CAMERA_API_ATTR_GET_PAN_RANGE */
5084 camera_dispatcher_attr_set_tilt, /* MUSE_CAMERA_API_ATTR_SET_TILT */
5085 camera_dispatcher_attr_get_tilt, /* MUSE_CAMERA_API_ATTR_GET_TILT */
5086 camera_dispatcher_attr_get_tilt_range, /* MUSE_CAMERA_API_ATTR_GET_TILT_RANGE */
5087 camera_dispatcher_attr_set_ptz_type, /* MUSE_CAMERA_API_ATTR_SET_PTZ_TYPE */
5088 camera_dispatcher_attr_foreach_supported_ptz_type, /* MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_PTZ_TYPE */
5089 camera_dispatcher_attr_set_display_roi_area, /* MUSE_CAMERA_API_SET_DISPLAY_ROI_AREA */
5090 camera_dispatcher_attr_get_display_roi_area, /* MUSE_CAMERA_API_GET_DISPLAY_ROI_AREA */
5091 camera_dispatcher_return_buffer, /* MUSE_CAMERA_API_RETURN_BUFFER */
5092 camera_dispatcher_preview_cb_return, /* MUSE_CAMERA_API_PREVIEW_CB_RETURN */
5093 camera_dispatcher_set_display_reuse_hint, /* MUSE_CAMERA_API_SET_DISPLAY_REUSE_HINT */
5094 camera_dispatcher_get_display_reuse_hint, /* MUSE_CAMERA_API_GET_DISPLAY_REUSE_HINT */
5095 camera_dispatcher_change_device, /* MUSE_CAMERA_API_CHANGE_DEVICE */
5096 camera_dispatcher_get_device_state /* MUSE_CAMERA_API_GET_DEVICE_STATE */
5100 /******************/
5101 /* cmd dispatcher */
5102 /******************/
5103 static int camera_cmd_dispatcher_initialize(muse_module_h module)
5107 GstPlugin *plugin = NULL;
5109 const char *load_list[] = {
5110 LIBDIR"/gstreamer-1.0/libgstcoreelements.so",
5111 LIBDIR"/gstreamer-1.0/libgstcamerasrc.so",
5112 LIBDIR"/gstreamer-1.0/libgstwaylandsink.so",
5115 item_count = sizeof(load_list) / sizeof(load_list[0]);
5117 LOGD("item count %d", item_count);
5119 for (i = 0 ; i < item_count ; i++) {
5120 plugin = gst_plugin_load_file(load_list[i], NULL);
5122 LOGD("%s loaded", load_list[i]);
5123 gst_object_unref(plugin);
5126 LOGW("failed to load %s", load_list[i]);
5132 return MUSE_CAMERA_ERROR_NONE;
5136 static int camera_cmd_dispatcher_shutdown(muse_module_h module)
5138 muse_camera_handle_s *muse_camera = NULL;
5139 camera_state_e state = CAMERA_STATE_NONE;
5140 int capture_try_count = 0;
5143 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
5144 if (muse_camera == NULL) {
5145 LOGE("NULL handle");
5146 return MUSE_CAMERA_ERROR_INVALID;
5149 legacy_camera_lock(muse_camera->camera_handle, true);
5151 if (legacy_camera_is_used(muse_camera->camera_handle)) {
5152 LOGW("camera is used in recorder.. wait...");
5153 if (legacy_camera_wait(muse_camera->camera_handle, 3000)) {
5154 LOGD("recorder is released");
5156 legacy_camera_lock(muse_camera->camera_handle, false);
5157 LOGE("wait timeout, could not release camera handle %p", muse_camera->camera_handle);
5158 return MUSE_CAMERA_ERROR_INVALID;
5162 legacy_camera_lock(muse_camera->camera_handle, false);
5164 muse_camera->is_shutting_down = true;
5167 legacy_camera_get_state(muse_camera->camera_handle, &state);
5169 LOGW("current state : %d", state);
5172 case CAMERA_STATE_CAPTURING:
5173 if (capture_try_count < 30) {
5174 LOGW("now capturing.. wait for capture data...");
5176 capture_try_count++;
5179 LOGE("wait capture data timeout! keep going...");
5182 case CAMERA_STATE_CAPTURED:
5183 legacy_camera_start_preview(muse_camera->camera_handle);
5185 case CAMERA_STATE_PREVIEW:
5186 _camera_remove_export_data(module, 0, TRUE); /* force return buffer before stop preview */
5187 legacy_camera_stop_preview(muse_camera->camera_handle);
5189 case CAMERA_STATE_CREATED:
5190 ret = legacy_camera_destroy(muse_camera->camera_handle);
5191 if (ret == CAMERA_ERROR_NONE)
5192 _camera_dispatcher_release_resource(module);
5194 LOGE("failed to destroy camera handle");
5203 return MUSE_CAMERA_ERROR_NONE;
5207 int (*cmd_dispatcher[MUSE_MODULE_COMMAND_MAX])(muse_module_h module) = {
5208 camera_cmd_dispatcher_initialize, /* MUSE_MODULE_COMMAND_INITIALIZE */
5209 camera_cmd_dispatcher_shutdown, /* MUSE_MODULE_COMMAND_SHUTDOWN */
5210 NULL, /* MUSE_MODULE_COMMAND_DEBUG_INFO_DUMP */
5211 NULL, /* MUSE_MODULE_COMMAND_CREATE_SERVER_ACK */
5212 NULL /* MUSE_MODULE_COMMAND_RESOURCE_NOT_AVAILABLE */