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_INVALID;
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_INVALID;
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_INVALID;
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_INVALID;
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_INVALID;
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 if (ret == CAMERA_ERROR_NONE)
1540 return MUSE_CAMERA_ERROR_NONE;
1542 return MUSE_CAMERA_ERROR_INVALID;
1545 int camera_dispatcher_start_preview(muse_module_h module)
1547 int ret = CAMERA_ERROR_NONE;
1548 muse_camera_handle_s *muse_camera = NULL;
1549 muse_camera_api_e api = MUSE_CAMERA_API_START_PREVIEW;
1550 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1552 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1554 LOGD("handle : %p", muse_camera);
1556 ret = legacy_camera_start_preview(muse_camera->camera_handle);
1558 muse_camera_msg_return(api, class, ret, module);
1560 return MUSE_CAMERA_ERROR_NONE;
1563 int camera_dispatcher_stop_preview(muse_module_h module)
1565 muse_camera_handle_s *muse_camera = NULL;
1567 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1569 LOGD("handle : %p", muse_camera);
1571 _camera_task_add_job(muse_camera, MUSE_CAMERA_API_STOP_PREVIEW,
1572 MUSE_CAMERA_API_CLASS_IMMEDIATE, 0);
1574 return MUSE_CAMERA_ERROR_NONE;
1577 int camera_dispatcher_start_capture(muse_module_h module)
1579 muse_camera_handle_s *muse_camera = NULL;
1581 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1583 LOGD("handle : %p", muse_camera);
1585 _camera_task_add_job(muse_camera, MUSE_CAMERA_API_START_CAPTURE,
1586 MUSE_CAMERA_API_CLASS_IMMEDIATE, 0);
1588 return MUSE_CAMERA_ERROR_NONE;
1591 int camera_dispatcher_is_supported_continuous_capture(muse_module_h module)
1593 int ret = CAMERA_ERROR_NONE;
1594 muse_camera_handle_s *muse_camera = NULL;
1595 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_CONTINUOUS_CAPTURE;
1596 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1598 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1600 LOGD("handle : %p", muse_camera);
1602 ret = legacy_camera_is_supported_continuous_capture(muse_camera->camera_handle);
1604 LOGD("is supported ret : %d", ret);
1606 muse_camera_msg_return(api, class, ret, module);
1608 return MUSE_CAMERA_ERROR_NONE;
1611 int camera_dispatcher_start_continuous_capture(muse_module_h module)
1613 int ret = CAMERA_ERROR_NONE;
1614 muse_camera_handle_s *muse_camera = NULL;
1618 muse_camera_api_e api = MUSE_CAMERA_API_START_CONTINUOUS_CAPTURE;
1619 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1621 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1623 muse_camera_msg_get(value, muse_core_client_get_msg(module));
1625 count = value >> 16;
1626 interval = 0x0000ffff & value;
1628 LOGD("Enter - count %d, interval %d", count, interval);
1630 ret = legacy_camera_start_continuous_capture(muse_camera->camera_handle,
1633 (camera_capturing_cb)_camera_dispatcher_capturing_cb,
1634 (camera_capture_completed_cb)_camera_dispatcher_capture_completed_cb,
1637 muse_camera_msg_return(api, class, ret, module);
1639 return MUSE_CAMERA_ERROR_NONE;
1642 int camera_dispatcher_stop_continuous_capture(muse_module_h module)
1644 int ret = CAMERA_ERROR_NONE;
1645 muse_camera_handle_s *muse_camera = NULL;
1646 muse_camera_api_e api = MUSE_CAMERA_API_STOP_CONTINUOUS_CAPTURE;
1647 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1649 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1651 LOGD("handle : %p", muse_camera);
1653 ret = legacy_camera_stop_continuous_capture(muse_camera->camera_handle);
1655 muse_camera_msg_return(api, class, ret, module);
1657 return MUSE_CAMERA_ERROR_NONE;
1660 int camera_dispatcher_is_supported_face_detection(muse_module_h module)
1662 int ret = CAMERA_ERROR_NONE;
1663 muse_camera_handle_s *muse_camera = NULL;
1664 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_FACE_DETECTION;
1665 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1667 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1669 LOGD("handle : %p", muse_camera);
1671 ret = legacy_camera_is_supported_face_detection(muse_camera->camera_handle);
1673 LOGD("is supported ret : %d", ret);
1675 muse_camera_msg_return(api, class, ret, module);
1677 return MUSE_CAMERA_ERROR_NONE;
1680 int camera_dispatcher_is_supported_zero_shutter_lag(muse_module_h module)
1682 int ret = CAMERA_ERROR_NONE;
1683 muse_camera_handle_s *muse_camera = NULL;
1684 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_ZERO_SHUTTER_LAG;
1685 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1687 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1689 LOGD("handle : %p", muse_camera);
1691 ret = legacy_camera_is_supported_zero_shutter_lag(muse_camera->camera_handle);
1693 LOGD("is supported ret : %d", ret);
1695 muse_camera_msg_return(api, class, ret, module);
1697 return MUSE_CAMERA_ERROR_NONE;
1700 int camera_dispatcher_is_supported_media_packet_preview_cb(muse_module_h module)
1702 int ret = CAMERA_ERROR_NONE;
1703 muse_camera_handle_s *muse_camera = NULL;
1704 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_MEDIA_PACKET_PREVIEW_CB;
1705 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1707 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1709 LOGD("handle : %p", muse_camera);
1711 ret = legacy_camera_is_supported_media_packet_preview_cb(muse_camera->camera_handle);
1713 LOGD("is supported ret : %d", ret);
1715 muse_camera_msg_return(api, class, ret, module);
1717 return MUSE_CAMERA_ERROR_NONE;
1720 int camera_dispatcher_get_device_count(muse_module_h module)
1722 int ret = CAMERA_ERROR_NONE;
1723 muse_camera_handle_s *muse_camera = NULL;
1725 muse_camera_api_e api = MUSE_CAMERA_API_GET_DEVICE_COUNT;
1726 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1728 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1730 LOGD("handle : %p", muse_camera);
1732 ret = legacy_camera_get_device_count(muse_camera->camera_handle, &get_value);
1733 if (ret == CAMERA_ERROR_NONE) {
1734 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
1735 MUSE_CAMERA_GET_INT_DEVICE_COUNT, "get_value", get_value, NULL);
1737 muse_camera_msg_return(api, class, ret, module);
1740 return MUSE_CAMERA_ERROR_NONE;
1743 int camera_dispatcher_start_face_detection(muse_module_h module)
1745 int ret = CAMERA_ERROR_NONE;
1746 muse_camera_handle_s *muse_camera = NULL;
1747 muse_camera_api_e api = MUSE_CAMERA_API_START_FACE_DETECTION;
1748 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1750 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1752 LOGD("Enter, handle : 0x%x, module : %d", muse_camera, module);
1754 ret = legacy_camera_start_face_detection(muse_camera->camera_handle,
1755 (camera_face_detected_cb)_camera_dispatcher_face_detected_cb,
1758 muse_camera_msg_return(api, class, ret, module);
1760 return MUSE_CAMERA_ERROR_NONE;
1763 int camera_dispatcher_stop_face_detection(muse_module_h module)
1765 int ret = CAMERA_ERROR_NONE;
1766 muse_camera_handle_s *muse_camera = NULL;
1767 muse_camera_api_e api = MUSE_CAMERA_API_STOP_FACE_DETECTION;
1768 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1770 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1772 LOGD("handle : %p", muse_camera);
1774 ret = legacy_camera_stop_face_detection(muse_camera->camera_handle);
1776 muse_camera_msg_return(api, class, ret, module);
1778 return MUSE_CAMERA_ERROR_NONE;
1781 int camera_dispatcher_get_state(muse_module_h module)
1783 int ret = CAMERA_ERROR_NONE;
1784 muse_camera_handle_s *muse_camera = NULL;
1785 camera_state_e get_value = CAMERA_STATE_NONE;
1786 muse_camera_api_e api = MUSE_CAMERA_API_GET_STATE;
1787 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1789 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1791 LOGD("handle : %p", muse_camera);
1793 ret = legacy_camera_get_state(muse_camera->camera_handle, &get_value);
1794 if (ret == CAMERA_ERROR_NONE) {
1795 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
1796 MUSE_CAMERA_GET_INT_STATE, "get_value", get_value, NULL);
1798 muse_camera_msg_return(api, class, ret, module);
1801 return MUSE_CAMERA_ERROR_NONE;
1804 int camera_dispatcher_start_focusing(muse_module_h module)
1806 int ret = CAMERA_ERROR_NONE;
1807 muse_camera_handle_s *muse_camera = NULL;
1809 muse_camera_api_e api = MUSE_CAMERA_API_START_FOCUSING;
1810 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1812 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1814 muse_camera_msg_get(is_continuous, muse_core_client_get_msg(module));
1816 LOGD("Enter, handle : 0x%x, module : %d", muse_camera, module);
1818 ret = legacy_camera_start_focusing(muse_camera->camera_handle, (bool)is_continuous);
1820 muse_camera_msg_return(api, class, ret, module);
1822 return MUSE_CAMERA_ERROR_NONE;
1825 int camera_dispatcher_stop_focusing(muse_module_h module)
1827 int ret = CAMERA_ERROR_NONE;
1828 muse_camera_handle_s *muse_camera = NULL;
1829 muse_camera_api_e api = MUSE_CAMERA_API_CANCEL_FOCUSING;
1830 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1832 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1834 LOGD("handle : %p", muse_camera);
1836 ret = legacy_camera_cancel_focusing(muse_camera->camera_handle);
1838 muse_camera_msg_return(api, class, ret, module);
1840 return MUSE_CAMERA_ERROR_NONE;
1843 int camera_dispatcher_set_display(muse_module_h module)
1845 int ret = CAMERA_ERROR_NONE;
1846 muse_camera_handle_s *muse_camera = NULL;
1847 muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY;
1848 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1849 MMCamWaylandInfo *wl_info = NULL;
1850 camera_display_type_e type = CAMERA_DISPLAY_TYPE_NONE;
1851 camera_h camera = NULL;;
1853 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1855 LOGD("handle : 0x%x", muse_camera);
1857 camera = muse_camera->camera_handle;
1859 muse_camera_msg_get(type, muse_core_client_get_msg(module));
1861 LOGD("type %d", type);
1863 if (type == CAMERA_DISPLAY_TYPE_OVERLAY) {
1864 wl_info = &muse_camera->wl_info;
1865 muse_camera_msg_get_array(wl_info, muse_core_client_get_msg(module));
1867 LOGD("wayland global surface id : %d, window : %d,%d,%dx%d",
1868 wl_info->global_surface_id, wl_info->window_x, wl_info->window_y,
1869 wl_info->window_width, wl_info->window_height);
1871 ret = legacy_camera_set_display(muse_camera->camera_handle, type, (void *)wl_info);
1873 muse_camera_msg_return(api, class, ret, module);
1875 LOGD("NOT overlay type. set NONE type.");
1877 if (type == CAMERA_DISPLAY_TYPE_EVAS) {
1878 ret = legacy_camera_set_preview_cb(muse_camera->camera_handle,
1879 (camera_preview_cb)_camera_dispatcher_preview_cb,
1882 if (ret == CAMERA_ERROR_NONE)
1883 SET_PREVIEW_CB_TYPE(muse_camera, PREVIEW_CB_TYPE_EVAS);
1886 ret = legacy_camera_set_display(muse_camera->camera_handle, CAMERA_DISPLAY_TYPE_NONE, NULL);
1888 muse_camera_msg_return(api, class, ret, module);
1891 return MUSE_CAMERA_ERROR_NONE;
1894 int camera_dispatcher_set_preview_resolution(muse_module_h module)
1897 muse_camera_handle_s *muse_camera = NULL;
1899 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1901 muse_camera_msg_get(value, muse_core_client_get_msg(module));
1903 _camera_task_add_job(muse_camera, MUSE_CAMERA_API_SET_PREVIEW_RESOLUTION,
1904 MUSE_CAMERA_API_CLASS_IMMEDIATE, value);
1906 return MUSE_CAMERA_ERROR_NONE;
1909 int camera_dispatcher_set_capture_resolution(muse_module_h module)
1912 muse_camera_handle_s *muse_camera = NULL;
1914 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1916 muse_camera_msg_get(value, muse_core_client_get_msg(module));
1918 _camera_task_add_job(muse_camera, MUSE_CAMERA_API_SET_CAPTURE_RESOLUTION,
1919 MUSE_CAMERA_API_CLASS_IMMEDIATE, value);
1921 return MUSE_CAMERA_ERROR_NONE;
1924 int camera_dispatcher_set_capture_format(muse_module_h module)
1926 int ret = CAMERA_ERROR_NONE;
1927 muse_camera_handle_s *muse_camera = NULL;
1929 muse_camera_api_e api = MUSE_CAMERA_API_SET_CAPTURE_FORMAT;
1930 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1932 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1934 muse_camera_msg_get(set_format, muse_core_client_get_msg(module));
1936 LOGD("handle : 0x%x, set_format : %d", muse_camera, set_format);
1938 ret = legacy_camera_set_capture_format(muse_camera->camera_handle, (camera_pixel_format_e)set_format);
1940 muse_camera_msg_return(api, class, ret, module);
1942 return MUSE_CAMERA_ERROR_NONE;
1945 int camera_dispatcher_set_preview_format(muse_module_h module)
1947 int ret = CAMERA_ERROR_NONE;
1948 muse_camera_handle_s *muse_camera = NULL;
1950 muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_FORMAT;
1951 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1953 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1955 muse_camera_msg_get(set_format, muse_core_client_get_msg(module));
1957 LOGD("handle : 0x%x, set_format : %d", muse_camera, set_format);
1959 ret = legacy_camera_set_preview_format(muse_camera->camera_handle, (camera_pixel_format_e)set_format);
1961 muse_camera_msg_return(api, class, ret, module);
1963 return MUSE_CAMERA_ERROR_NONE;
1966 int camera_dispatcher_get_preview_resolution(muse_module_h module)
1968 int ret = CAMERA_ERROR_NONE;
1969 muse_camera_handle_s *muse_camera = NULL;
1973 muse_camera_api_e api = MUSE_CAMERA_API_GET_PREVIEW_RESOLUTION;
1974 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1976 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1978 LOGD("handle : %p", muse_camera);
1980 ret = legacy_camera_get_preview_resolution(muse_camera->camera_handle, &get_width, &get_height);
1981 if (ret == CAMERA_ERROR_NONE) {
1982 get_value = get_width << 16 | get_height;
1983 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
1984 MUSE_CAMERA_GET_INT_PREVIEW_RESOLUTION, "get_value", get_value, NULL);
1986 muse_camera_msg_return(api, class, ret, module);
1989 return MUSE_CAMERA_ERROR_NONE;
1992 int camera_dispatcher_set_display_rotation(muse_module_h module)
1994 int ret = CAMERA_ERROR_NONE;
1995 muse_camera_handle_s *muse_camera = NULL;
1997 muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY_ROTATION;
1998 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2000 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2002 muse_camera_msg_get(set_rotation, muse_core_client_get_msg(module));
2004 LOGD("handle : 0x%x, set_rotation : %d", muse_camera, set_rotation);
2006 ret = legacy_camera_set_display_rotation(muse_camera->camera_handle, (camera_rotation_e)set_rotation);
2008 muse_camera_msg_return(api, class, ret, module);
2010 return MUSE_CAMERA_ERROR_NONE;
2013 int camera_dispatcher_get_display_rotation(muse_module_h module)
2015 int ret = CAMERA_ERROR_NONE;
2016 muse_camera_handle_s *muse_camera = NULL;
2017 camera_rotation_e get_value = CAMERA_ROTATION_NONE;
2018 muse_camera_api_e api = MUSE_CAMERA_API_GET_DISPLAY_ROTATION;
2019 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2021 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2023 LOGD("handle : %p", muse_camera);
2025 ret = legacy_camera_get_display_rotation(muse_camera->camera_handle, &get_value);
2026 if (ret == CAMERA_ERROR_NONE) {
2027 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
2028 MUSE_CAMERA_GET_INT_DISPLAY_ROTATION, "get_value", get_value, NULL);
2030 muse_camera_msg_return(api, class, ret, module);
2033 return MUSE_CAMERA_ERROR_NONE;
2036 int camera_dispatcher_set_display_flip(muse_module_h module)
2038 int ret = CAMERA_ERROR_NONE;
2039 muse_camera_handle_s *muse_camera = NULL;
2041 muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY_FLIP;
2042 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2044 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2046 muse_camera_msg_get(set_flip, muse_core_client_get_msg(module));
2048 LOGD("handle : 0x%x, set_flip : %d", muse_camera, set_flip);
2050 ret = legacy_camera_set_display_flip(muse_camera->camera_handle, (camera_flip_e)set_flip);
2052 muse_camera_msg_return(api, class, ret, module);
2054 return MUSE_CAMERA_ERROR_NONE;
2057 int camera_dispatcher_get_display_flip(muse_module_h module)
2059 int ret = CAMERA_ERROR_NONE;
2060 muse_camera_handle_s *muse_camera = NULL;
2061 camera_flip_e get_value = CAMERA_FLIP_NONE;
2062 muse_camera_api_e api = MUSE_CAMERA_API_GET_DISPLAY_FLIP;
2063 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2065 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2067 LOGD("handle : %p", muse_camera);
2069 ret = legacy_camera_get_display_flip(muse_camera->camera_handle, &get_value);
2070 if (ret == CAMERA_ERROR_NONE) {
2071 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
2072 MUSE_CAMERA_GET_INT_DISPLAY_FLIP, "get_value", get_value, NULL);
2074 muse_camera_msg_return(api, class, ret, module);
2077 return MUSE_CAMERA_ERROR_NONE;
2080 int camera_dispatcher_set_display_visible(muse_module_h module)
2082 int ret = CAMERA_ERROR_NONE;
2083 muse_camera_handle_s *muse_camera = NULL;
2085 muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY_VISIBLE;
2086 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2088 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2090 muse_camera_msg_get(set_visible, muse_core_client_get_msg(module));
2092 LOGD("handle : 0x%x, set_visible : %d", muse_camera, set_visible);
2094 ret = legacy_camera_set_display_visible(muse_camera->camera_handle, (bool)set_visible);
2096 muse_camera_msg_return(api, class, ret, module);
2098 return MUSE_CAMERA_ERROR_NONE;
2101 int camera_dispatcher_is_display_visible(muse_module_h module)
2103 int ret = CAMERA_ERROR_NONE;
2104 muse_camera_handle_s *muse_camera = NULL;
2105 bool get_value = true;
2106 muse_camera_api_e api = MUSE_CAMERA_API_IS_DISPLAY_VISIBLE;
2107 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2109 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2111 LOGD("handle : %p", muse_camera);
2113 ret = legacy_camera_is_display_visible(muse_camera->camera_handle, &get_value);
2114 if (ret == CAMERA_ERROR_NONE) {
2115 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
2116 MUSE_CAMERA_GET_INT_DISPLAY_VISIBLE, "get_value", get_value, NULL);
2118 muse_camera_msg_return(api, class, ret, module);
2121 return MUSE_CAMERA_ERROR_NONE;
2124 int camera_dispatcher_set_display_mode(muse_module_h module)
2126 int ret = CAMERA_ERROR_NONE;
2127 muse_camera_handle_s *muse_camera = NULL;
2129 muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY_MODE;
2130 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2132 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2134 muse_camera_msg_get(set_mode, muse_core_client_get_msg(module));
2136 LOGD("handle : 0x%x, display_mode : %d", muse_camera, set_mode);
2138 ret = legacy_camera_set_display_mode(muse_camera->camera_handle, (camera_display_mode_e)set_mode);
2140 LOGD("ret : 0x%x", ret);
2142 muse_camera_msg_return(api, class, ret, module);
2144 return MUSE_CAMERA_ERROR_NONE;
2147 int camera_dispatcher_get_display_mode(muse_module_h module)
2149 int ret = CAMERA_ERROR_NONE;
2150 muse_camera_handle_s *muse_camera = NULL;
2151 camera_display_mode_e get_value = CAMERA_DISPLAY_MODE_LETTER_BOX;
2152 muse_camera_api_e api = MUSE_CAMERA_API_GET_DISPLAY_MODE;
2153 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2155 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2157 LOGD("handle : %p", muse_camera);
2159 ret = legacy_camera_get_display_mode(muse_camera->camera_handle, &get_value);
2160 if (ret == CAMERA_ERROR_NONE) {
2161 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
2162 MUSE_CAMERA_GET_INT_DISPLAY_MODE, "get_value", get_value, NULL);
2164 muse_camera_msg_return(api, class, ret, module);
2167 return MUSE_CAMERA_ERROR_NONE;
2170 int camera_dispatcher_get_capture_resolution(muse_module_h module)
2172 int ret = CAMERA_ERROR_NONE;
2173 muse_camera_handle_s *muse_camera = NULL;
2177 muse_camera_api_e api = MUSE_CAMERA_API_GET_CAPTURE_RESOLUTION;
2178 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2180 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2182 LOGD("handle : %p", muse_camera);
2184 ret = legacy_camera_get_capture_resolution(muse_camera->camera_handle, &get_width, &get_height);
2185 if (ret == CAMERA_ERROR_NONE) {
2186 get_value = get_width << 16 | get_height;
2187 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
2188 MUSE_CAMERA_GET_INT_CAPTURE_RESOLUTION, "get_value", get_value, NULL);
2190 muse_camera_msg_return(api, class, ret, module);
2193 return MUSE_CAMERA_ERROR_NONE;
2196 int camera_dispatcher_get_capture_format(muse_module_h module)
2198 int ret = CAMERA_ERROR_NONE;
2199 muse_camera_handle_s *muse_camera = NULL;
2200 camera_pixel_format_e get_value = CAMERA_PIXEL_FORMAT_NV12;
2201 muse_camera_api_e api = MUSE_CAMERA_API_GET_CAPTURE_FORMAT;
2202 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2204 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2206 LOGD("handle : %p", muse_camera);
2208 ret = legacy_camera_get_capture_format(muse_camera->camera_handle, &get_value);
2209 if (ret == CAMERA_ERROR_NONE) {
2210 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
2211 MUSE_CAMERA_GET_INT_CAPTURE_FORMAT, "get_value", get_value, NULL);
2213 muse_camera_msg_return(api, class, ret, module);
2216 return MUSE_CAMERA_ERROR_NONE;
2219 int camera_dispatcher_get_preview_format(muse_module_h module)
2221 int ret = CAMERA_ERROR_NONE;
2222 muse_camera_handle_s *muse_camera = NULL;
2223 camera_pixel_format_e get_value = CAMERA_PIXEL_FORMAT_NV12;
2224 muse_camera_api_e api = MUSE_CAMERA_API_GET_PREVIEW_FORMAT;
2225 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2227 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2229 LOGD("handle : %p", muse_camera);
2231 ret = legacy_camera_get_preview_format(muse_camera->camera_handle, &get_value);
2232 if (ret == CAMERA_ERROR_NONE) {
2233 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
2234 MUSE_CAMERA_GET_INT_PREVIEW_FORMAT, "get_value", get_value, NULL);
2236 muse_camera_msg_return(api, class, ret, module);
2239 return MUSE_CAMERA_ERROR_NONE;
2242 int camera_dispatcher_get_facing_direction(muse_module_h module)
2244 int ret = CAMERA_ERROR_NONE;
2245 muse_camera_handle_s *muse_camera = NULL;
2246 camera_facing_direction_e get_value = CAMERA_FACING_DIRECTION_REAR;
2247 muse_camera_api_e api = MUSE_CAMERA_API_GET_FACING_DIRECTION;
2248 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2250 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2252 LOGD("handle : %p", muse_camera);
2254 ret = legacy_camera_get_facing_direction(muse_camera->camera_handle, &get_value);
2255 if (ret == CAMERA_ERROR_NONE) {
2256 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
2257 MUSE_CAMERA_GET_INT_FACING_DIRECTION, "get_value", get_value, NULL);
2259 muse_camera_msg_return(api, class, ret, module);
2262 return MUSE_CAMERA_ERROR_NONE;
2265 int camera_dispatcher_get_flash_state(muse_module_h module)
2267 int ret = CAMERA_ERROR_NONE;
2269 bool is_called = false;
2270 char value_key[KEY_LENGTH] = {'\0',};
2271 camera_h camera = NULL;
2272 camera_device_e device_type = CAMERA_DEVICE_CAMERA0;
2273 camera_flash_state_e get_flash_state = CAMERA_FLASH_STATE_NOT_USED;
2274 muse_camera_api_e api = MUSE_CAMERA_API_GET_FLASH_STATE;
2275 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2277 muse_camera_msg_get(device_type, muse_core_client_get_msg(module));
2279 if (device_type < CAMERA_DEVICE_CAMERA0 || device_type > CAMERA_DEVICE_CAMERA1) {
2280 LOGE("invalid device %d", device_type);
2282 ret = CAMERA_ERROR_INVALID_PARAMETER;
2283 muse_camera_msg_return(api, class, ret, module);
2285 return MUSE_CAMERA_ERROR_NONE;
2288 muse_core_client_get_value(module, MUSED_KEY_FLASH_STATE_CHECK, (int *)&is_called);
2291 ret = legacy_camera_create(device_type, &camera);
2293 legacy_camera_attr_foreach_supported_flash_mode(camera,
2294 (camera_attr_supported_flash_mode_cb)_camera_dispatcher_callback_supported_flash_mode2,
2297 legacy_camera_destroy(camera);
2301 muse_core_client_set_value(module, MUSED_KEY_FLASH_STATE_RETURN, ret);
2302 muse_core_client_set_value(module, MUSED_KEY_FLASH_STATE_COUNT, count);
2303 muse_core_client_set_value(module, MUSED_KEY_FLASH_STATE_CHECK, (int)true);
2305 muse_core_client_get_value(module, MUSED_KEY_FLASH_STATE_RETURN, &ret);
2306 muse_core_client_get_value(module, MUSED_KEY_FLASH_STATE_COUNT, &count);
2309 LOGD("is_called %d, ret 0x%x, count %d", is_called, ret, count);
2311 if (ret != CAMERA_ERROR_NONE) {
2312 LOGE("failed to create or get camera info 0x%x", ret);
2314 muse_camera_msg_return(api, class, ret, module);
2316 return MUSE_CAMERA_ERROR_NONE;
2320 LOGE("count[%d] of supported flash mode is too small, so return NOT_SUPPORTED", count);
2322 ret = CAMERA_ERROR_NOT_SUPPORTED;
2323 muse_camera_msg_return(api, class, ret, module);
2325 return MUSE_CAMERA_ERROR_NONE;
2328 snprintf(value_key, KEY_LENGTH, "flash_state_camera%d", device_type);
2329 muse_core_client_get_value(module, value_key, (int *)&get_flash_state);
2331 LOGD("[%d] flash state : %d", device_type, get_flash_state);
2333 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
2334 -1, "get_flash_state", get_flash_state, NULL);
2336 return MUSE_CAMERA_ERROR_NONE;
2339 int camera_dispatcher_set_preview_cb(muse_module_h module)
2341 int ret = CAMERA_ERROR_NONE;
2342 muse_camera_handle_s *muse_camera = NULL;
2343 muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_CB;
2344 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2346 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2348 LOGD("handle : %p", muse_camera);
2350 ret = legacy_camera_set_preview_cb(muse_camera->camera_handle,
2351 (camera_preview_cb)_camera_dispatcher_preview_cb,
2354 if (ret == CAMERA_ERROR_NONE)
2355 SET_PREVIEW_CB_TYPE(muse_camera, PREVIEW_CB_TYPE_USER);
2357 LOGD("ret : 0x%x", ret);
2359 muse_camera_msg_return(api, class, ret, module);
2361 return MUSE_CAMERA_ERROR_NONE;
2364 int camera_dispatcher_unset_preview_cb(muse_module_h module)
2366 int ret = CAMERA_ERROR_NONE;
2367 muse_camera_handle_s *muse_camera = NULL;
2368 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_PREVIEW_CB;
2369 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2371 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2373 LOGD("handle : %p", muse_camera);
2375 UNSET_PREVIEW_CB_TYPE(muse_camera, PREVIEW_CB_TYPE_USER);
2376 if (CHECK_PREVIEW_CB(muse_camera, PREVIEW_CB_TYPE_EVAS))
2377 LOGD("Preview callback for evas surface is remained.");
2379 ret = legacy_camera_unset_preview_cb(muse_camera->camera_handle);
2381 LOGD("ret : 0x%x", ret);
2383 muse_camera_msg_return(api, class, ret, module);
2385 return MUSE_CAMERA_ERROR_NONE;
2388 int camera_dispatcher_set_media_packet_preview_cb(muse_module_h module)
2390 int ret = CAMERA_ERROR_NONE;
2391 muse_camera_handle_s *muse_camera = NULL;
2392 muse_camera_api_e api = MUSE_CAMERA_API_SET_MEDIA_PACKET_PREVIEW_CB;
2393 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2395 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2397 LOGD("handle : %p", muse_camera);
2399 ret = legacy_camera_set_media_packet_preview_cb(muse_camera->camera_handle,
2400 (camera_preview_cb)_camera_dispatcher_preview_cb,
2403 LOGD("ret : 0x%x", ret);
2405 muse_camera_msg_return(api, class, ret, module);
2407 return MUSE_CAMERA_ERROR_NONE;
2410 int camera_dispatcher_unset_media_packet_preview_cb(muse_module_h module)
2412 int ret = CAMERA_ERROR_NONE;
2413 muse_camera_handle_s *muse_camera = NULL;
2414 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_MEDIA_PACKET_PREVIEW_CB;
2415 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2417 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2419 LOGD("handle : %p", muse_camera);
2421 ret = legacy_camera_unset_media_packet_preview_cb(muse_camera->camera_handle);
2423 LOGD("ret : 0x%x", ret);
2425 muse_camera_msg_return(api, class, ret, module);
2427 return MUSE_CAMERA_ERROR_NONE;
2430 int camera_dispatcher_set_state_changed_cb(muse_module_h module)
2432 int ret = CAMERA_ERROR_NONE;
2433 muse_camera_api_e api = MUSE_CAMERA_API_SET_STATE_CHANGED_CB;
2434 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2438 muse_camera_msg_return(api, class, ret, module);
2440 return MUSE_CAMERA_ERROR_NONE;
2443 int camera_dispatcher_unset_state_changed_cb(muse_module_h module)
2445 int ret = CAMERA_ERROR_NONE;
2446 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_STATE_CHANGED_CB;
2447 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2451 muse_camera_msg_return(api, class, ret, module);
2453 return MUSE_CAMERA_ERROR_NONE;
2456 int camera_dispatcher_set_interrupted_cb(muse_module_h module)
2458 int ret = CAMERA_ERROR_NONE;
2459 muse_camera_handle_s *muse_camera = NULL;
2460 muse_camera_api_e api = MUSE_CAMERA_API_SET_INTERRUPTED_CB;
2461 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2463 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2465 LOGD("handle : %p", muse_camera);
2467 ret = legacy_camera_set_interrupted_cb(muse_camera->camera_handle,
2468 (camera_interrupted_cb)_camera_dispatcher_interrupted_cb,
2471 LOGD("ret : 0x%x", ret);
2473 muse_camera_msg_return(api, class, ret, module);
2475 return MUSE_CAMERA_ERROR_NONE;
2478 int camera_dispatcher_unset_interrupted_cb(muse_module_h module)
2480 int ret = CAMERA_ERROR_NONE;
2481 muse_camera_handle_s *muse_camera = NULL;
2482 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_INTERRUPTED_CB;
2483 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2485 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2487 LOGD("handle : %p", muse_camera);
2489 ret = legacy_camera_unset_interrupted_cb(muse_camera->camera_handle);
2491 LOGD("ret : 0x%x", ret);
2493 muse_camera_msg_return(api, class, ret, module);
2495 return MUSE_CAMERA_ERROR_NONE;
2498 int camera_dispatcher_set_focus_changed_cb(muse_module_h module)
2500 int ret = CAMERA_ERROR_NONE;
2501 muse_camera_handle_s *muse_camera = NULL;
2502 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOCUS_CHANGED_CB;
2503 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2505 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2507 LOGD("handle : %p", muse_camera);
2509 ret = legacy_camera_set_focus_changed_cb(muse_camera->camera_handle,
2510 (camera_focus_changed_cb)_camera_dispatcher_focus_changed_cb,
2513 LOGD("ret : 0x%x", ret);
2515 muse_camera_msg_return(api, class, ret, module);
2517 return MUSE_CAMERA_ERROR_NONE;
2520 int camera_dispatcher_unset_focus_changed_cb(muse_module_h module)
2522 int ret = CAMERA_ERROR_NONE;
2523 muse_camera_handle_s *muse_camera = NULL;
2524 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_FOCUS_CHANGED_CB;
2525 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2527 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2529 LOGD("handle : %p", muse_camera);
2531 ret = legacy_camera_unset_focus_changed_cb(muse_camera->camera_handle);
2533 LOGD("ret : 0x%x", ret);
2535 muse_camera_msg_return(api, class, ret, module);
2537 return MUSE_CAMERA_ERROR_NONE;
2540 int camera_dispatcher_set_error_cb(muse_module_h module)
2542 int ret = CAMERA_ERROR_NONE;
2543 muse_camera_handle_s *muse_camera = NULL;
2544 muse_camera_api_e api = MUSE_CAMERA_API_SET_ERROR_CB;
2545 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2547 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2549 LOGD("handle : %p", muse_camera);
2551 ret = legacy_camera_set_error_cb(muse_camera->camera_handle,
2552 (camera_error_cb)_camera_dispatcher_error_cb,
2555 LOGD("ret : 0x%x", ret);
2557 muse_camera_msg_return(api, class, ret, module);
2559 return MUSE_CAMERA_ERROR_NONE;
2562 int camera_dispatcher_unset_error_cb(muse_module_h module)
2564 int ret = CAMERA_ERROR_NONE;
2565 muse_camera_handle_s *muse_camera = NULL;
2566 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_ERROR_CB;
2567 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2569 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2571 LOGD("handle : %p", muse_camera);
2573 ret = legacy_camera_unset_error_cb(muse_camera->camera_handle);
2575 LOGD("ret : 0x%x", ret);
2577 muse_camera_msg_return(api, class, ret, module);
2579 return MUSE_CAMERA_ERROR_NONE;
2582 int camera_dispatcher_foreach_supported_preview_resolution(muse_module_h module)
2584 int ret = CAMERA_ERROR_NONE;
2585 muse_camera_handle_s *muse_camera = NULL;
2586 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_PREVIEW_RESOLUTION;
2587 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
2589 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2591 LOGD("handle : %p", muse_camera);
2593 ret = legacy_camera_foreach_supported_preview_resolution(muse_camera->camera_handle,
2594 (camera_supported_preview_resolution_cb)_camera_dispatcher_callback_supported_preview_resolution,
2597 LOGD("ret : 0x%x", ret);
2599 muse_camera_msg_return(api, class, ret, module);
2601 return MUSE_CAMERA_ERROR_NONE;
2604 int camera_dispatcher_foreach_supported_capture_resolution(muse_module_h module)
2606 int ret = CAMERA_ERROR_NONE;
2607 muse_camera_handle_s *muse_camera = NULL;
2608 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_CAPTURE_RESOLUTION;
2609 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
2611 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2613 LOGD("handle : %p", muse_camera);
2615 ret = legacy_camera_foreach_supported_capture_resolution(muse_camera->camera_handle,
2616 (camera_supported_capture_resolution_cb)_camera_dispatcher_callback_supported_capture_resolution,
2619 LOGD("ret : 0x%x", ret);
2621 muse_camera_msg_return(api, class, ret, module);
2623 return MUSE_CAMERA_ERROR_NONE;
2626 int camera_dispatcher_foreach_supported_capture_format(muse_module_h module)
2628 int ret = CAMERA_ERROR_NONE;
2629 muse_camera_handle_s *muse_camera = NULL;
2630 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_CAPTURE_FORMAT;
2631 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
2633 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2635 LOGD("handle : %p", muse_camera);
2637 ret = legacy_camera_foreach_supported_capture_format(muse_camera->camera_handle,
2638 (camera_supported_capture_format_cb)_camera_dispatcher_callback_supported_capture_format,
2641 LOGD("ret : 0x%x", ret);
2643 muse_camera_msg_return(api, class, ret, module);
2645 return MUSE_CAMERA_ERROR_NONE;
2648 int camera_dispatcher_foreach_supported_preview_format(muse_module_h module)
2650 int ret = CAMERA_ERROR_NONE;
2651 muse_camera_handle_s *muse_camera = NULL;
2652 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_PREVIEW_FORMAT;
2653 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
2655 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2657 LOGD("handle : %p", muse_camera);
2659 ret = legacy_camera_foreach_supported_preview_format(muse_camera->camera_handle,
2660 (camera_supported_preview_format_cb)_camera_dispatcher_callback_supported_preview_format,
2663 LOGD("ret : 0x%x", ret);
2665 muse_camera_msg_return(api, class, ret, module);
2667 return MUSE_CAMERA_ERROR_NONE;
2670 int camera_dispatcher_get_recommended_preview_resolution(muse_module_h module)
2672 int ret = CAMERA_ERROR_NONE;
2673 muse_camera_handle_s *muse_camera = NULL;
2677 muse_camera_api_e api = MUSE_CAMERA_API_GET_RECOMMENDED_PREVIEW_RESOLUTION;
2678 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2680 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2682 LOGD("handle : %p", muse_camera);
2684 ret = legacy_camera_get_recommended_preview_resolution(muse_camera->camera_handle, &get_width, &get_height);
2685 if (ret == CAMERA_ERROR_NONE) {
2686 get_value = get_width << 16 | get_height;
2687 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
2688 MUSE_CAMERA_GET_INT_RECOMMENDED_PREVIEW_RESOLUTION, "get_value", get_value, NULL);
2690 muse_camera_msg_return(api, class, ret, module);
2693 return MUSE_CAMERA_ERROR_NONE;
2696 int camera_dispatcher_attr_get_lens_orientation(muse_module_h module)
2698 int ret = CAMERA_ERROR_NONE;
2699 muse_camera_handle_s *muse_camera = NULL;
2701 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_LENS_ORIENTATION;
2702 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2704 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2706 LOGD("handle : %p", muse_camera);
2708 ret = legacy_camera_attr_get_lens_orientation(muse_camera->camera_handle, &get_value);
2709 if (ret == CAMERA_ERROR_NONE) {
2710 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
2711 MUSE_CAMERA_GET_INT_LENS_ORIENTATION, "get_value", get_value, NULL);
2713 muse_camera_msg_return(api, class, ret, module);
2716 return MUSE_CAMERA_ERROR_NONE;
2719 int camera_dispatcher_attr_set_theater_mode(muse_module_h module)
2721 int ret = CAMERA_ERROR_NONE;
2722 muse_camera_handle_s *muse_camera = NULL;
2724 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_THEATER_MODE;
2725 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2727 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2729 muse_camera_msg_get(set_mode, muse_core_client_get_msg(module));
2731 LOGD("handle : %p", muse_camera);
2733 ret = legacy_camera_attr_set_theater_mode(muse_camera->camera_handle, (camera_attr_theater_mode_e)set_mode);
2735 muse_camera_msg_return(api, class, ret, module);
2737 return MUSE_CAMERA_ERROR_NONE;
2740 int camera_dispatcher_attr_get_theater_mode(muse_module_h module)
2742 int ret = CAMERA_ERROR_NONE;
2743 muse_camera_handle_s *muse_camera = NULL;
2744 camera_attr_theater_mode_e get_value = CAMERA_ATTR_THEATER_MODE_DISABLE;
2745 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_THEATER_MODE;
2746 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2748 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2750 LOGD("handle : %p", muse_camera);
2752 ret = legacy_camera_attr_get_theater_mode(muse_camera->camera_handle, &get_value);
2753 if (ret == CAMERA_ERROR_NONE) {
2754 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
2755 MUSE_CAMERA_GET_INT_THEATER_MODE, "get_value", get_value, NULL);
2757 muse_camera_msg_return(api, class, ret, module);
2760 return MUSE_CAMERA_ERROR_NONE;
2763 int camera_dispatcher_attr_foreach_supported_theater_mode(muse_module_h module)
2765 int ret = CAMERA_ERROR_NONE;
2766 muse_camera_handle_s *muse_camera = NULL;
2767 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_THEATER_MODE;
2768 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
2770 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2771 LOGD("handle : %p", muse_camera);
2773 ret = legacy_camera_attr_foreach_supported_theater_mode(muse_camera->camera_handle,
2774 (camera_attr_supported_theater_mode_cb)_camera_dispatcher_callback_supported_theater_mode,
2777 muse_camera_msg_return(api, class, ret, module);
2779 return MUSE_CAMERA_ERROR_NONE;
2782 int camera_dispatcher_attr_set_preview_fps(muse_module_h module)
2784 int ret = CAMERA_ERROR_NONE;
2785 muse_camera_handle_s *muse_camera = NULL;
2787 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_PREVIEW_FPS;
2788 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2790 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2792 muse_camera_msg_get(set_fps, muse_core_client_get_msg(module));
2794 LOGD("handle : %p", muse_camera);
2796 ret = legacy_camera_attr_set_preview_fps(muse_camera->camera_handle, (camera_attr_fps_e)set_fps);
2798 muse_camera_msg_return(api, class, ret, module);
2800 return MUSE_CAMERA_ERROR_NONE;
2803 int camera_dispatcher_attr_set_image_quality(muse_module_h module)
2805 int ret = CAMERA_ERROR_NONE;
2806 muse_camera_handle_s *muse_camera = NULL;
2808 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_IMAGE_QUALITY;
2809 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2811 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2813 muse_camera_msg_get(quality, muse_core_client_get_msg(module));
2815 LOGD("handle : 0x%x, image_quality : %d", muse_camera, quality);
2817 ret = legacy_camera_attr_set_image_quality(muse_camera->camera_handle, quality);
2819 LOGD("ret : 0x%x", ret);
2821 muse_camera_msg_return(api, class, ret, module);
2823 return MUSE_CAMERA_ERROR_NONE;
2826 int camera_dispatcher_attr_get_preview_fps(muse_module_h module)
2828 int ret = CAMERA_ERROR_NONE;
2829 muse_camera_handle_s *muse_camera = NULL;
2830 camera_attr_fps_e get_value = CAMERA_ATTR_FPS_AUTO;
2831 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_PREVIEW_FPS;
2832 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2834 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2836 LOGD("handle : %p", muse_camera);
2838 ret = legacy_camera_attr_get_preview_fps(muse_camera->camera_handle, &get_value);
2839 if (ret == CAMERA_ERROR_NONE) {
2840 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
2841 MUSE_CAMERA_GET_INT_PREVIEW_FPS, "get_value", get_value, NULL);
2843 muse_camera_msg_return(api, class, ret, module);
2846 return MUSE_CAMERA_ERROR_NONE;
2849 int camera_dispatcher_attr_get_image_quality(muse_module_h module)
2851 int ret = CAMERA_ERROR_NONE;
2852 muse_camera_handle_s *muse_camera = NULL;
2854 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_IMAGE_QUALITY;
2855 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2857 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2859 LOGD("handle : %p", muse_camera);
2861 ret = legacy_camera_attr_get_image_quality(muse_camera->camera_handle, &get_value);
2862 if (ret == CAMERA_ERROR_NONE) {
2863 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
2864 MUSE_CAMERA_GET_INT_IMAGE_QUALITY, "get_value", get_value, NULL);
2866 muse_camera_msg_return(api, class, ret, module);
2869 return MUSE_CAMERA_ERROR_NONE;
2872 int camera_dispatcher_attr_set_zoom(muse_module_h module)
2874 int ret = CAMERA_ERROR_NONE;
2875 muse_camera_handle_s *muse_camera = NULL;
2877 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ZOOM;
2878 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2880 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2882 muse_camera_msg_get(zoom, muse_core_client_get_msg(module));
2884 LOGD("handle : 0x%x, zoom : %d", muse_camera, zoom);
2886 ret = legacy_camera_attr_set_zoom(muse_camera->camera_handle, zoom);
2888 LOGD("ret : 0x%x", ret);
2890 muse_camera_msg_return(api, class, ret, module);
2892 return MUSE_CAMERA_ERROR_NONE;
2895 int camera_dispatcher_attr_set_af_mode(muse_module_h module)
2897 int ret = CAMERA_ERROR_NONE;
2898 muse_camera_handle_s *muse_camera = NULL;
2900 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_AF_MODE;
2901 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2903 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2905 muse_camera_msg_get(set_mode, muse_core_client_get_msg(module));
2907 LOGD("handle : 0x%x, set_mode : %d", muse_camera, set_mode);
2909 ret = legacy_camera_attr_set_af_mode(muse_camera->camera_handle, (camera_attr_af_mode_e)set_mode);
2911 LOGD("ret : 0x%x", ret);
2913 muse_camera_msg_return(api, class, ret, module);
2915 return MUSE_CAMERA_ERROR_NONE;
2918 int camera_dispatcher_attr_set_af_area(muse_module_h module)
2920 int ret = CAMERA_ERROR_NONE;
2921 muse_camera_handle_s *muse_camera = NULL;
2925 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_AF_AREA;
2926 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2928 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2930 muse_camera_msg_get(value, muse_core_client_get_msg(module));
2933 y = 0x0000ffff & value;
2935 LOGD("AF area - %d, %d", x, y);
2937 ret = legacy_camera_attr_set_af_area(muse_camera->camera_handle, x, y);
2939 LOGD("ret : 0x%x", ret);
2941 muse_camera_msg_return(api, class, ret, module);
2943 return MUSE_CAMERA_ERROR_NONE;
2946 int camera_dispatcher_attr_clear_af_area(muse_module_h module)
2948 int ret = CAMERA_ERROR_NONE;
2949 muse_camera_handle_s *muse_camera = NULL;
2950 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_CLEAR_AF_AREA;
2951 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2953 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2955 LOGD("handle : %p", muse_camera);
2957 ret = legacy_camera_attr_clear_af_area(muse_camera->camera_handle);
2959 LOGD("ret : 0x%x", ret);
2961 muse_camera_msg_return(api, class, ret, module);
2963 return MUSE_CAMERA_ERROR_NONE;
2966 int camera_dispatcher_attr_set_exposure_mode(muse_module_h module)
2968 int ret = CAMERA_ERROR_NONE;
2969 muse_camera_handle_s *muse_camera = NULL;
2971 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EXPOSURE_MODE;
2972 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2974 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2976 muse_camera_msg_get(set_mode, muse_core_client_get_msg(module));
2978 LOGD("handle : 0x%x, set_mode : %d", muse_camera, set_mode);
2980 ret = legacy_camera_attr_set_exposure_mode(muse_camera->camera_handle, (camera_attr_exposure_mode_e)set_mode);
2982 LOGD("ret : 0x%x", ret);
2984 muse_camera_msg_return(api, class, ret, module);
2986 return MUSE_CAMERA_ERROR_NONE;
2989 int camera_dispatcher_attr_set_exposure(muse_module_h module)
2991 int ret = CAMERA_ERROR_NONE;
2992 muse_camera_handle_s *muse_camera = NULL;
2994 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EXPOSURE;
2995 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2997 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2999 muse_camera_msg_get(value, muse_core_client_get_msg(module));
3001 LOGD("handle : 0x%x, value : %d", muse_camera, value);
3003 ret = legacy_camera_attr_set_exposure(muse_camera->camera_handle, value);
3005 LOGD("ret : 0x%x", ret);
3007 muse_camera_msg_return(api, class, ret, module);
3009 return MUSE_CAMERA_ERROR_NONE;
3012 int camera_dispatcher_attr_set_iso(muse_module_h module)
3014 int ret = CAMERA_ERROR_NONE;
3015 muse_camera_handle_s *muse_camera = NULL;
3017 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ISO;
3018 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3020 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3022 muse_camera_msg_get(set_iso, muse_core_client_get_msg(module));
3024 LOGD("handle : 0x%x, set_iso : %d", muse_camera, set_iso);
3026 ret = legacy_camera_attr_set_iso(muse_camera->camera_handle, (camera_attr_iso_e)set_iso);
3028 LOGD("ret : 0x%x", ret);
3030 muse_camera_msg_return(api, class, ret, module);
3032 return MUSE_CAMERA_ERROR_NONE;
3035 int camera_dispatcher_attr_set_brightness(muse_module_h module)
3037 int ret = CAMERA_ERROR_NONE;
3038 muse_camera_handle_s *muse_camera = NULL;
3040 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_BRIGHTNESS;
3041 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3043 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3045 muse_camera_msg_get(level, muse_core_client_get_msg(module));
3047 LOGD("handle : 0x%x, level : %d", muse_camera, level);
3049 ret = legacy_camera_attr_set_brightness(muse_camera->camera_handle, level);
3051 LOGD("ret : 0x%x", ret);
3053 muse_camera_msg_return(api, class, ret, module);
3055 return MUSE_CAMERA_ERROR_NONE;
3058 int camera_dispatcher_attr_set_contrast(muse_module_h module)
3060 int ret = CAMERA_ERROR_NONE;
3061 muse_camera_handle_s *muse_camera = NULL;
3063 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_CONTRAST;
3064 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3066 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3068 muse_camera_msg_get(level, muse_core_client_get_msg(module));
3070 LOGD("handle : 0x%x, level : %d", muse_camera, level);
3072 ret = legacy_camera_attr_set_contrast(muse_camera->camera_handle, level);
3074 LOGD("ret : 0x%x", ret);
3076 muse_camera_msg_return(api, class, ret, module);
3078 return MUSE_CAMERA_ERROR_NONE;
3081 int camera_dispatcher_attr_set_whitebalance(muse_module_h module)
3083 int ret = CAMERA_ERROR_NONE;
3084 muse_camera_handle_s *muse_camera = NULL;
3085 int set_whitebalance;
3086 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_WHITEBALANCE;
3087 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3089 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3091 muse_camera_msg_get(set_whitebalance, muse_core_client_get_msg(module));
3093 LOGD("handle : 0x%x, set_whitebalance : %d", muse_camera, set_whitebalance);
3095 ret = legacy_camera_attr_set_whitebalance(muse_camera->camera_handle, (camera_attr_whitebalance_e)set_whitebalance);
3097 LOGD("ret : 0x%x", ret);
3099 muse_camera_msg_return(api, class, ret, module);
3101 return MUSE_CAMERA_ERROR_NONE;
3104 int camera_dispatcher_attr_set_effect(muse_module_h module)
3106 int ret = CAMERA_ERROR_NONE;
3107 muse_camera_handle_s *muse_camera = NULL;
3109 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EFFECT;
3110 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3112 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3114 muse_camera_msg_get(set_effect, muse_core_client_get_msg(module));
3116 LOGD("handle : 0x%x, set_effect : %d", muse_camera, set_effect);
3118 ret = legacy_camera_attr_set_effect(muse_camera->camera_handle, (camera_attr_effect_mode_e)set_effect);
3120 LOGD("ret : 0x%x", ret);
3122 muse_camera_msg_return(api, class, ret, module);
3124 return MUSE_CAMERA_ERROR_NONE;
3127 int camera_dispatcher_attr_set_scene_mode(muse_module_h module)
3129 int ret = CAMERA_ERROR_NONE;
3130 muse_camera_handle_s *muse_camera = NULL;
3132 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_SCENE_MODE;
3133 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3135 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3137 muse_camera_msg_get(set_mode, muse_core_client_get_msg(module));
3139 LOGD("handle : 0x%x, set_mode : %d", muse_camera, set_mode);
3141 ret = legacy_camera_attr_set_scene_mode(muse_camera->camera_handle, (camera_attr_scene_mode_e)set_mode);
3143 LOGD("ret : 0x%x", ret);
3145 muse_camera_msg_return(api, class, ret, module);
3147 return MUSE_CAMERA_ERROR_NONE;
3150 int camera_dispatcher_attr_enable_tag(muse_module_h module)
3152 int ret = CAMERA_ERROR_NONE;
3153 muse_camera_handle_s *muse_camera = NULL;
3155 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_TAG;
3156 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3158 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3160 muse_camera_msg_get(set_enable, muse_core_client_get_msg(module));
3162 LOGD("handle : 0x%x, set_enable : %d", muse_camera, set_enable);
3164 ret = legacy_camera_attr_enable_tag(muse_camera->camera_handle, (bool)set_enable);
3166 LOGD("ret : 0x%x", ret);
3168 muse_camera_msg_return(api, class, ret, module);
3170 return MUSE_CAMERA_ERROR_NONE;
3173 int camera_dispatcher_attr_set_tag_image_description(muse_module_h module)
3175 int ret = CAMERA_ERROR_NONE;
3176 muse_camera_handle_s *muse_camera = NULL;
3177 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_IMAGE_DESCRIPTION;
3178 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3179 char description[MUSE_CAMERA_MSG_MAX_LENGTH] = {0,};
3181 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3183 muse_camera_msg_get_string(description, muse_core_client_get_msg(module));
3185 LOGD("handle : 0x%x, description : %s", muse_camera, description);
3187 ret = legacy_camera_attr_set_tag_image_description(muse_camera->camera_handle, description);
3189 LOGD("ret : 0x%x", ret);
3191 muse_camera_msg_return(api, class, ret, module);
3193 return MUSE_CAMERA_ERROR_NONE;
3196 int camera_dispatcher_attr_set_tag_orientation(muse_module_h module)
3198 int ret = CAMERA_ERROR_NONE;
3199 muse_camera_handle_s *muse_camera = NULL;
3200 int set_orientation;
3201 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_ORIENTATION;
3202 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3204 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3206 muse_camera_msg_get(set_orientation, muse_core_client_get_msg(module));
3208 LOGD("handle : 0x%x, set_orientation : %d", muse_camera, set_orientation);
3210 ret = legacy_camera_attr_set_tag_orientation(muse_camera->camera_handle, (camera_attr_tag_orientation_e)set_orientation);
3212 LOGD("ret : 0x%x", ret);
3214 muse_camera_msg_return(api, class, ret, module);
3216 return MUSE_CAMERA_ERROR_NONE;
3219 int camera_dispatcher_attr_set_tag_software(muse_module_h module)
3221 int ret = CAMERA_ERROR_NONE;
3222 muse_camera_handle_s *muse_camera = NULL;
3223 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_SOFTWARE;
3224 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3225 char software[MUSE_CAMERA_MSG_MAX_LENGTH] = {0,};
3227 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3229 muse_camera_msg_get_string(software, muse_core_client_get_msg(module));
3231 LOGD("handle : 0x%x, software : %s", muse_camera, software);
3233 ret = legacy_camera_attr_set_tag_software(muse_camera->camera_handle, software);
3235 LOGD("ret : 0x%x", ret);
3237 muse_camera_msg_return(api, class, ret, module);
3239 return MUSE_CAMERA_ERROR_NONE;
3242 int camera_dispatcher_attr_set_geotag(muse_module_h module)
3244 int ret = CAMERA_ERROR_NONE;
3245 muse_camera_handle_s *muse_camera = NULL;
3246 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_GEOTAG;
3247 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3248 double set_geotag[3] = {0,};
3250 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3252 muse_camera_msg_get_array(set_geotag, muse_core_client_get_msg(module));
3254 LOGD("handle : 0x%x, set_geotag1 : %d, set_geotag2 : %d, set_geotag3 : %d",
3255 muse_camera, set_geotag[0], set_geotag[1], set_geotag[2]);
3257 ret = legacy_camera_attr_set_geotag(muse_camera->camera_handle, set_geotag[0], set_geotag[1], set_geotag[2]);
3259 LOGD("ret : 0x%x", ret);
3261 muse_camera_msg_return(api, class, ret, module);
3263 return MUSE_CAMERA_ERROR_NONE;
3266 int camera_dispatcher_attr_remove_geotag(muse_module_h module)
3268 int ret = CAMERA_ERROR_NONE;
3269 muse_camera_handle_s *muse_camera = NULL;
3270 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_REMOVE_GEOTAG;
3271 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3273 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3275 LOGD("handle : %p", muse_camera);
3277 ret = legacy_camera_attr_remove_geotag(muse_camera->camera_handle);
3279 LOGD("ret : 0x%x", ret);
3281 muse_camera_msg_return(api, class, ret, module);
3283 return MUSE_CAMERA_ERROR_NONE;
3286 int camera_dispatcher_attr_set_flash_mode(muse_module_h module)
3288 int ret = CAMERA_ERROR_NONE;
3290 char value_key[KEY_LENGTH] = {'\0',};
3291 muse_camera_handle_s *muse_camera = NULL;
3292 camera_device_e device_type = CAMERA_DEVICE_CAMERA0;
3293 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_FLASH_MODE;
3294 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3296 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3298 muse_camera_msg_get(set_mode, muse_core_client_get_msg(module));
3300 LOGD("handle : 0x%x, set_mode : %d", muse_camera, set_mode);
3302 ret = legacy_camera_attr_set_flash_mode(muse_camera->camera_handle, (camera_attr_flash_mode_e)set_mode);
3303 if (ret == CAMERA_ERROR_NONE) {
3304 ret = legacy_camera_get_device_type(muse_camera->camera_handle, &device_type);
3305 if (ret == CAMERA_ERROR_NONE) {
3306 snprintf(value_key, KEY_LENGTH, "flash_state_camera%d", device_type);
3307 muse_core_client_set_value(module, value_key, set_mode > 0 ? 1 : 0);
3311 LOGD("ret : 0x%x", ret);
3313 muse_camera_msg_return(api, class, ret, module);
3315 return MUSE_CAMERA_ERROR_NONE;
3318 int camera_dispatcher_attr_get_zoom(muse_module_h module)
3320 int ret = CAMERA_ERROR_NONE;
3321 muse_camera_handle_s *muse_camera = NULL;
3323 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ZOOM;
3324 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3326 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3328 LOGD("handle : %p", muse_camera);
3330 ret = legacy_camera_attr_get_zoom(muse_camera->camera_handle, &get_value);
3331 if (ret == CAMERA_ERROR_NONE) {
3332 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
3333 MUSE_CAMERA_GET_INT_ZOOM, "get_value", get_value, NULL);
3335 muse_camera_msg_return(api, class, ret, module);
3338 return MUSE_CAMERA_ERROR_NONE;
3341 int camera_dispatcher_attr_get_zoom_range(muse_module_h module)
3343 int ret = CAMERA_ERROR_NONE;
3344 muse_camera_handle_s *muse_camera = NULL;
3347 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ZOOM_RANGE;
3348 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3349 muse_camera_get_type_e get_type = MUSE_CAMERA_GET_TYPE_INT_PAIR;
3350 muse_camera_get_int_pair_e index = MUSE_CAMERA_GET_INT_PAIR_ZOOM_RANGE;
3352 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3354 LOGD("handle : %p", muse_camera);
3356 ret = legacy_camera_attr_get_zoom_range(muse_camera->camera_handle, &get_value0, &get_value1);
3357 if (ret == CAMERA_ERROR_NONE)
3358 muse_camera_msg_return2(api, class, ret, module, get_type, index, get_value0, get_value1);
3360 muse_camera_msg_return(api, class, ret, module);
3362 return MUSE_CAMERA_ERROR_NONE;
3365 int camera_dispatcher_attr_get_af_mode(muse_module_h module)
3367 int ret = CAMERA_ERROR_NONE;
3368 muse_camera_handle_s *muse_camera = NULL;
3369 camera_attr_af_mode_e get_value = CAMERA_ATTR_AF_NONE;
3370 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_AF_MODE;
3371 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3373 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3375 LOGD("handle : %p", muse_camera);
3377 ret = legacy_camera_attr_get_af_mode(muse_camera->camera_handle, &get_value);
3378 if (ret == CAMERA_ERROR_NONE) {
3379 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
3380 MUSE_CAMERA_GET_INT_AF_MODE, "get_value", get_value, NULL);
3382 muse_camera_msg_return(api, class, ret, module);
3385 return MUSE_CAMERA_ERROR_NONE;
3388 int camera_dispatcher_attr_get_exposure_mode(muse_module_h module)
3390 int ret = CAMERA_ERROR_NONE;
3391 muse_camera_handle_s *muse_camera = NULL;
3392 camera_attr_exposure_mode_e get_value = CAMERA_ATTR_EXPOSURE_MODE_OFF;
3393 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE_MODE;
3394 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3396 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3398 LOGD("handle : %p", muse_camera);
3400 ret = legacy_camera_attr_get_exposure_mode(muse_camera->camera_handle, &get_value);
3401 if (ret == CAMERA_ERROR_NONE) {
3402 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
3403 MUSE_CAMERA_GET_INT_EXPOSURE_MODE, "get_value", get_value, NULL);
3405 muse_camera_msg_return(api, class, ret, module);
3408 return MUSE_CAMERA_ERROR_NONE;
3411 int camera_dispatcher_attr_get_exposure(muse_module_h module)
3413 int ret = CAMERA_ERROR_NONE;
3414 muse_camera_handle_s *muse_camera = NULL;
3416 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE;
3417 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3419 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3421 LOGD("handle : %p", muse_camera);
3423 ret = legacy_camera_attr_get_exposure(muse_camera->camera_handle, &get_value);
3424 if (ret == CAMERA_ERROR_NONE) {
3425 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
3426 MUSE_CAMERA_GET_INT_EXPOSURE, "get_value", get_value, NULL);
3428 muse_camera_msg_return(api, class, ret, module);
3431 return MUSE_CAMERA_ERROR_NONE;
3434 int camera_dispatcher_attr_get_exposure_range(muse_module_h module)
3436 int ret = CAMERA_ERROR_NONE;
3437 muse_camera_handle_s *muse_camera = NULL;
3440 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE_RANGE;
3441 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3442 muse_camera_get_type_e get_type = MUSE_CAMERA_GET_TYPE_INT_PAIR;
3443 muse_camera_get_int_pair_e index = MUSE_CAMERA_GET_INT_PAIR_EXPOSURE_RANGE;
3445 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3447 LOGD("handle : %p", muse_camera);
3449 ret = legacy_camera_attr_get_exposure_range(muse_camera->camera_handle, &get_value0, &get_value1);
3450 if (ret == CAMERA_ERROR_NONE)
3451 muse_camera_msg_return2(api, class, ret, module, get_type, index, get_value0, get_value1);
3453 muse_camera_msg_return(api, class, ret, module);
3455 return MUSE_CAMERA_ERROR_NONE;
3458 int camera_dispatcher_attr_get_iso(muse_module_h module)
3460 int ret = CAMERA_ERROR_NONE;
3461 muse_camera_handle_s *muse_camera = NULL;
3462 camera_attr_iso_e get_value = CAMERA_ATTR_ISO_AUTO;
3463 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ISO;
3464 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3466 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3468 LOGD("handle : %p", muse_camera);
3470 ret = legacy_camera_attr_get_iso(muse_camera->camera_handle, &get_value);
3471 if (ret == CAMERA_ERROR_NONE) {
3472 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
3473 MUSE_CAMERA_GET_INT_ISO, "get_value", get_value, NULL);
3475 muse_camera_msg_return(api, class, ret, module);
3478 return MUSE_CAMERA_ERROR_NONE;
3481 int camera_dispatcher_attr_get_brightness(muse_module_h module)
3483 int ret = CAMERA_ERROR_NONE;
3484 muse_camera_handle_s *muse_camera = NULL;
3486 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_BRIGHTNESS;
3487 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3489 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3491 LOGD("handle : %p", muse_camera);
3493 ret = legacy_camera_attr_get_brightness(muse_camera->camera_handle, &get_value);
3494 if (ret == CAMERA_ERROR_NONE) {
3495 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
3496 MUSE_CAMERA_GET_INT_BRIGHTNESS, "get_value", get_value, NULL);
3498 muse_camera_msg_return(api, class, ret, module);
3501 return MUSE_CAMERA_ERROR_NONE;
3504 int camera_dispatcher_attr_get_brightness_range(muse_module_h module)
3506 int ret = CAMERA_ERROR_NONE;
3507 muse_camera_handle_s *muse_camera = NULL;
3510 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_BRIGHTNESS_RANGE;
3511 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3512 muse_camera_get_type_e get_type = MUSE_CAMERA_GET_TYPE_INT_PAIR;
3513 muse_camera_get_int_pair_e index = MUSE_CAMERA_GET_INT_PAIR_BRIGHTNESS_RANGE;
3515 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3517 LOGD("handle : %p", muse_camera);
3519 ret = legacy_camera_attr_get_brightness_range(muse_camera->camera_handle, &get_value0, &get_value1);
3520 if (ret == CAMERA_ERROR_NONE)
3521 muse_camera_msg_return2(api, class, ret, module, get_type, index, get_value0, get_value1);
3523 muse_camera_msg_return(api, class, ret, module);
3525 return MUSE_CAMERA_ERROR_NONE;
3528 int camera_dispatcher_attr_get_contrast(muse_module_h module)
3530 int ret = CAMERA_ERROR_NONE;
3531 muse_camera_handle_s *muse_camera = NULL;
3533 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_CONTRAST;
3534 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3536 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3538 LOGD("handle : %p", muse_camera);
3540 ret = legacy_camera_attr_get_contrast(muse_camera->camera_handle, &get_value);
3541 if (ret == CAMERA_ERROR_NONE) {
3542 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
3543 MUSE_CAMERA_GET_INT_CONTRAST, "get_value", get_value, NULL);
3545 muse_camera_msg_return(api, class, ret, module);
3548 return MUSE_CAMERA_ERROR_NONE;
3551 int camera_dispatcher_attr_get_contrast_range(muse_module_h module)
3553 int ret = CAMERA_ERROR_NONE;
3554 muse_camera_handle_s *muse_camera = NULL;
3557 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_CONTRAST_RANGE;
3558 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3559 muse_camera_get_type_e get_type = MUSE_CAMERA_GET_TYPE_INT_PAIR;
3560 muse_camera_get_int_pair_e index = MUSE_CAMERA_GET_INT_PAIR_CONTRAST_RANGE;
3562 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3564 LOGD("handle : %p", muse_camera);
3566 ret = legacy_camera_attr_get_contrast_range(muse_camera->camera_handle, &get_value0, &get_value1);
3567 if (ret == CAMERA_ERROR_NONE)
3568 muse_camera_msg_return2(api, class, ret, module, get_type, index, get_value0, get_value1);
3570 muse_camera_msg_return(api, class, ret, module);
3572 return MUSE_CAMERA_ERROR_NONE;
3575 int camera_dispatcher_attr_get_whitebalance(muse_module_h module)
3577 int ret = CAMERA_ERROR_NONE;
3578 muse_camera_handle_s *muse_camera = NULL;
3579 camera_attr_whitebalance_e get_value = CAMERA_ATTR_WHITE_BALANCE_NONE;
3580 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_WHITEBALANCE;
3581 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3583 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3585 LOGD("handle : %p", muse_camera);
3587 ret = legacy_camera_attr_get_whitebalance(muse_camera->camera_handle, &get_value);
3588 if (ret == CAMERA_ERROR_NONE) {
3589 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
3590 MUSE_CAMERA_GET_INT_WHITE_BALANCE, "get_value", get_value, NULL);
3592 muse_camera_msg_return(api, class, ret, module);
3595 return MUSE_CAMERA_ERROR_NONE;
3598 int camera_dispatcher_attr_get_effect(muse_module_h module)
3600 int ret = CAMERA_ERROR_NONE;
3601 muse_camera_handle_s *muse_camera = NULL;
3602 camera_attr_effect_mode_e get_value = CAMERA_ATTR_EFFECT_NONE;
3603 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EFFECT;
3604 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3606 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3608 LOGD("handle : %p", muse_camera);
3610 ret = legacy_camera_attr_get_effect(muse_camera->camera_handle, &get_value);
3611 if (ret == CAMERA_ERROR_NONE) {
3612 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
3613 MUSE_CAMERA_GET_INT_EFFECT, "get_value", get_value, NULL);
3615 muse_camera_msg_return(api, class, ret, module);
3618 return MUSE_CAMERA_ERROR_NONE;
3621 int camera_dispatcher_attr_get_scene_mode(muse_module_h module)
3623 int ret = CAMERA_ERROR_NONE;
3624 muse_camera_handle_s *muse_camera = NULL;
3625 camera_attr_scene_mode_e get_value = CAMERA_ATTR_SCENE_MODE_NORMAL;
3626 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_SCENE_MODE;
3627 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3629 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3631 LOGD("handle : %p", muse_camera);
3633 ret = legacy_camera_attr_get_scene_mode(muse_camera->camera_handle, &get_value);
3634 if (ret == CAMERA_ERROR_NONE) {
3635 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
3636 MUSE_CAMERA_GET_INT_SCENE_MODE, "get_value", get_value, NULL);
3638 muse_camera_msg_return(api, class, ret, module);
3641 return MUSE_CAMERA_ERROR_NONE;
3644 int camera_dispatcher_attr_is_enabled_tag(muse_module_h module)
3646 int ret = CAMERA_ERROR_NONE;
3647 muse_camera_handle_s *muse_camera = NULL;
3648 bool get_value = false;
3649 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_TAG;
3650 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3652 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3654 LOGD("handle : %p", muse_camera);
3656 ret = legacy_camera_attr_is_enabled_tag(muse_camera->camera_handle, &get_value);
3657 if (ret == CAMERA_ERROR_NONE) {
3658 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
3659 MUSE_CAMERA_GET_INT_ENABLED_TAG, "get_value", get_value, NULL);
3661 muse_camera_msg_return(api, class, ret, module);
3664 return MUSE_CAMERA_ERROR_NONE;
3667 int camera_dispatcher_attr_get_tag_image_description(muse_module_h module)
3669 int ret = CAMERA_ERROR_NONE;
3670 muse_camera_handle_s *muse_camera = NULL;
3671 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_IMAGE_DESCRIPTION;
3672 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3673 char *get_value = NULL;
3675 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3677 ret = legacy_camera_attr_get_tag_image_description(muse_camera->camera_handle, &get_value);
3678 if (ret == CAMERA_ERROR_NONE) {
3679 LOGD("get_description : %s", muse_camera, get_value);
3680 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_STRING,
3681 MUSE_CAMERA_GET_STRING_TAG_IMAGE_DESCRIPTION, "get_value", 0, get_value);
3683 muse_camera_msg_return(api, class, ret, module);
3691 return MUSE_CAMERA_ERROR_NONE;
3694 int camera_dispatcher_attr_get_tag_orientation(muse_module_h module)
3696 int ret = CAMERA_ERROR_NONE;
3697 muse_camera_handle_s *muse_camera = NULL;
3698 camera_attr_tag_orientation_e get_value = CAMERA_ATTR_TAG_ORIENTATION_TOP_LEFT;
3699 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_ORIENTATION;
3700 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3702 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3704 LOGD("handle : %p", muse_camera);
3706 ret = legacy_camera_attr_get_tag_orientation(muse_camera->camera_handle, &get_value);
3707 if (ret == CAMERA_ERROR_NONE) {
3708 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
3709 MUSE_CAMERA_GET_INT_TAG_ORIENTATION, "get_value", get_value, NULL);
3711 muse_camera_msg_return(api, class, ret, module);
3714 return MUSE_CAMERA_ERROR_NONE;
3717 int camera_dispatcher_attr_get_tag_software(muse_module_h module)
3719 int ret = CAMERA_ERROR_NONE;
3720 muse_camera_handle_s *muse_camera = NULL;
3721 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_SOFTWARE;
3722 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3723 char *get_value = NULL;
3725 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3727 ret = legacy_camera_attr_get_tag_software(muse_camera->camera_handle, &get_value);
3728 if (ret == CAMERA_ERROR_NONE) {
3729 LOGD("get_software : %s", get_value);
3730 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_STRING,
3731 MUSE_CAMERA_GET_STRING_TAG_SOFTWARE, "get_value", 0, get_value);
3733 muse_camera_msg_return(api, class, ret, module);
3741 return MUSE_CAMERA_ERROR_NONE;
3744 int camera_dispatcher_attr_get_geotag(muse_module_h module)
3746 int ret = CAMERA_ERROR_NONE;
3747 muse_camera_handle_s *muse_camera = NULL;
3748 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_GEOTAG;
3749 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3750 double get_value[3] = {0.0, 0.0, 0.0};
3751 char *send_msg = NULL;
3752 int msg_array_size = 0;
3754 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3756 LOGD("handle : %p", muse_camera);
3758 ret = legacy_camera_attr_get_geotag(muse_camera->camera_handle, &get_value[0], &get_value[1], &get_value[2]);
3759 if (ret == CAMERA_ERROR_NONE) {
3760 msg_array_size = sizeof(get_value) / sizeof(int) + (sizeof(get_value) % sizeof(int) ? 1 : 0);
3762 send_msg = muse_core_msg_json_factory_new(api,
3763 MUSE_TYPE_INT, PARAM_API_CLASS, class,
3764 MUSE_TYPE_INT, PARAM_RET, ret,
3765 MUSE_TYPE_INT, PARAM_GET_TYPE, MUSE_CAMERA_GET_TYPE_ARRAY,
3766 MUSE_TYPE_ARRAY, "get_value", msg_array_size, get_value,
3769 __camera_dispatcher_send_msg(module, send_msg);
3771 muse_camera_msg_return(api, class, ret, module);
3774 return MUSE_CAMERA_ERROR_NONE;
3777 int camera_dispatcher_attr_get_flash_mode(muse_module_h module)
3779 int ret = CAMERA_ERROR_NONE;
3780 muse_camera_handle_s *muse_camera = NULL;
3781 camera_attr_flash_mode_e get_value = CAMERA_ATTR_FLASH_MODE_OFF;
3782 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_FLASH_MODE;
3783 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3785 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3787 LOGD("handle : %p", muse_camera);
3789 ret = legacy_camera_attr_get_flash_mode(muse_camera->camera_handle, &get_value);
3790 if (ret == CAMERA_ERROR_NONE) {
3791 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
3792 MUSE_CAMERA_GET_INT_FLASH_MODE, "get_value", get_value, NULL);
3794 muse_camera_msg_return(api, class, ret, module);
3797 return MUSE_CAMERA_ERROR_NONE;
3800 int camera_dispatcher_attr_foreach_supported_af_mode(muse_module_h module)
3802 int ret = CAMERA_ERROR_NONE;
3803 muse_camera_handle_s *muse_camera = NULL;
3804 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_AF_MODE;
3805 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
3807 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3809 LOGD("handle : %p", muse_camera);
3811 ret = legacy_camera_attr_foreach_supported_af_mode(muse_camera->camera_handle,
3812 (camera_attr_supported_af_mode_cb)_camera_dispatcher_callback_supported_af_mode,
3815 LOGD("ret : 0x%x", ret);
3817 muse_camera_msg_return(api, class, ret, module);
3819 return MUSE_CAMERA_ERROR_NONE;
3822 int camera_dispatcher_attr_foreach_supported_exposure_mode(muse_module_h module)
3824 int ret = CAMERA_ERROR_NONE;
3825 muse_camera_handle_s *muse_camera = NULL;
3826 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_EXPOSURE_MODE;
3827 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
3829 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3831 LOGD("handle : 0x%x, api : %d", muse_camera, api);
3833 ret = legacy_camera_attr_foreach_supported_exposure_mode(muse_camera->camera_handle,
3834 (camera_attr_supported_exposure_mode_cb)_camera_dispatcher_callback_supported_exposure_mode,
3837 LOGD("ret : 0x%x", ret);
3839 muse_camera_msg_return(api, class, ret, module);
3841 return MUSE_CAMERA_ERROR_NONE;
3844 int camera_dispatcher_attr_foreach_supported_iso(muse_module_h module)
3846 int ret = CAMERA_ERROR_NONE;
3847 muse_camera_handle_s *muse_camera = NULL;
3848 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_ISO;
3849 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
3851 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3853 LOGD("handle : %p", muse_camera);
3855 ret = legacy_camera_attr_foreach_supported_iso(muse_camera->camera_handle,
3856 (camera_attr_supported_iso_cb)_camera_dispatcher_callback_supported_iso_mode,
3859 LOGD("ret : 0x%x", ret);
3861 muse_camera_msg_return(api, class, ret, module);
3863 return MUSE_CAMERA_ERROR_NONE;
3866 int camera_dispatcher_attr_foreach_supported_whitebalance(muse_module_h module)
3868 int ret = CAMERA_ERROR_NONE;
3869 muse_camera_handle_s *muse_camera = NULL;
3870 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_WHITEBALANCE;
3871 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
3873 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3875 LOGD("handle : %p", muse_camera);
3877 ret = legacy_camera_attr_foreach_supported_whitebalance(muse_camera->camera_handle,
3878 (camera_attr_supported_whitebalance_cb)_camera_dispatcher_callback_supported_whitebalance,
3881 LOGD("ret : 0x%x", ret);
3883 muse_camera_msg_return(api, class, ret, module);
3885 return MUSE_CAMERA_ERROR_NONE;
3888 int camera_dispatcher_attr_foreach_supported_effect(muse_module_h module)
3890 int ret = CAMERA_ERROR_NONE;
3891 muse_camera_handle_s *muse_camera = NULL;
3892 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_EFFECT;
3893 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
3895 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3897 LOGD("handle : %p", muse_camera);
3899 ret = legacy_camera_attr_foreach_supported_effect(muse_camera->camera_handle,
3900 (camera_attr_supported_effect_cb)_camera_dispatcher_callback_supported_effect,
3903 LOGD("ret : 0x%x", ret);
3905 muse_camera_msg_return(api, class, ret, module);
3907 return MUSE_CAMERA_ERROR_NONE;
3910 int camera_dispatcher_attr_foreach_supported_scene_mode(muse_module_h module)
3912 int ret = CAMERA_ERROR_NONE;
3913 muse_camera_handle_s *muse_camera = NULL;
3914 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_SCENE_MODE;
3915 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
3917 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3919 LOGD("handle : %p", muse_camera);
3921 ret = legacy_camera_attr_foreach_supported_scene_mode(muse_camera->camera_handle,
3922 (camera_attr_supported_scene_mode_cb)_camera_dispatcher_callback_supported_scene_mode,
3925 LOGD("ret : 0x%x", ret);
3927 muse_camera_msg_return(api, class, ret, module);
3929 return MUSE_CAMERA_ERROR_NONE;
3932 int camera_dispatcher_attr_foreach_supported_flash_mode(muse_module_h module)
3934 int ret = CAMERA_ERROR_NONE;
3935 muse_camera_handle_s *muse_camera = NULL;
3936 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FLASH_MODE;
3937 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
3939 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3941 LOGD("handle : %p", muse_camera);
3943 ret = legacy_camera_attr_foreach_supported_flash_mode(muse_camera->camera_handle,
3944 (camera_attr_supported_flash_mode_cb)_camera_dispatcher_callback_supported_flash_mode,
3947 LOGD("ret : 0x%x", ret);
3949 muse_camera_msg_return(api, class, ret, module);
3951 return MUSE_CAMERA_ERROR_NONE;
3954 int camera_dispatcher_attr_foreach_supported_fps(muse_module_h module)
3956 int ret = CAMERA_ERROR_NONE;
3957 muse_camera_handle_s *muse_camera = NULL;
3958 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FPS;
3959 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
3961 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3963 LOGD("handle : %p", muse_camera);
3965 ret = legacy_camera_attr_foreach_supported_fps(muse_camera->camera_handle,
3966 (camera_attr_supported_fps_cb)_camera_dispatcher_callback_supported_fps,
3969 LOGD("ret : 0x%x", ret);
3971 muse_camera_msg_return(api, class, ret, module);
3973 return MUSE_CAMERA_ERROR_NONE;
3976 int camera_dispatcher_attr_foreach_supported_fps_by_resolution(muse_module_h module)
3978 int ret = CAMERA_ERROR_NONE;
3979 muse_camera_handle_s *muse_camera = NULL;
3980 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FPS_BY_RESOLUTION;
3981 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
3986 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3988 muse_camera_msg_get(value, muse_core_client_get_msg(module));
3990 width = value >> 16;
3991 height = 0x0000ffff & value;
3993 LOGD("handle : %p - %dx%d", muse_camera, width, height);
3995 ret = legacy_camera_attr_foreach_supported_fps_by_resolution(muse_camera->camera_handle,
3997 (camera_attr_supported_fps_cb)_camera_dispatcher_callback_supported_fps_by_resolution,
4000 LOGD("ret : 0x%x", ret);
4002 muse_camera_msg_return(api, class, ret, module);
4004 return MUSE_CAMERA_ERROR_NONE;
4007 int camera_dispatcher_attr_foreach_supported_stream_flip(muse_module_h module)
4009 int ret = CAMERA_ERROR_NONE;
4010 muse_camera_handle_s *muse_camera = NULL;
4011 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_STREAM_FLIP;
4012 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
4014 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4016 LOGD("handle : %p", muse_camera);
4018 ret = legacy_camera_attr_foreach_supported_stream_flip(muse_camera->camera_handle,
4019 (camera_attr_supported_stream_flip_cb)_camera_dispatcher_callback_supported_stream_flip,
4022 LOGD("ret : 0x%x", ret);
4024 muse_camera_msg_return(api, class, ret, module);
4026 return MUSE_CAMERA_ERROR_NONE;
4029 int camera_dispatcher_attr_foreach_supported_stream_rotation(muse_module_h module)
4031 int ret = CAMERA_ERROR_NONE;
4032 muse_camera_handle_s *muse_camera = NULL;
4033 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_STREAM_ROTATION;
4034 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
4036 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4038 LOGD("handle : %p", muse_camera);
4040 ret = legacy_camera_attr_foreach_supported_stream_rotation(muse_camera->camera_handle,
4041 (camera_attr_supported_stream_rotation_cb)_camera_dispatcher_callback_supported_stream_rotation,
4044 LOGD("ret : 0x%x", ret);
4046 muse_camera_msg_return(api, class, ret, module);
4048 return MUSE_CAMERA_ERROR_NONE;
4051 int camera_dispatcher_attr_set_stream_rotation(muse_module_h module)
4053 int ret = CAMERA_ERROR_NONE;
4054 muse_camera_handle_s *muse_camera = NULL;
4055 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_STREAM_ROTATION;
4056 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4059 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4061 muse_camera_msg_get(set_rotation, muse_core_client_get_msg(module));
4063 LOGD("handle : %p", muse_camera);
4065 ret = legacy_camera_attr_set_stream_rotation(muse_camera->camera_handle, (camera_rotation_e)set_rotation);
4067 LOGD("ret : 0x%x", ret);
4069 muse_camera_msg_return(api, class, ret, module);
4071 return MUSE_CAMERA_ERROR_NONE;
4074 int camera_dispatcher_attr_get_stream_rotation(muse_module_h module)
4076 int ret = CAMERA_ERROR_NONE;
4077 muse_camera_handle_s *muse_camera = NULL;
4078 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_STREAM_ROTATION;
4079 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4080 camera_rotation_e get_value = CAMERA_ROTATION_NONE;
4082 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4084 LOGD("handle : %p", muse_camera);
4086 ret = legacy_camera_attr_get_stream_rotation(muse_camera->camera_handle, &get_value);
4087 if (ret == CAMERA_ERROR_NONE) {
4088 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
4089 MUSE_CAMERA_GET_INT_STREAM_ROTATION, "get_value", get_value, NULL);
4091 muse_camera_msg_return(api, class, ret, module);
4094 return MUSE_CAMERA_ERROR_NONE;
4097 int camera_dispatcher_attr_set_stream_flip(muse_module_h module)
4099 int ret = CAMERA_ERROR_NONE;
4100 muse_camera_handle_s *muse_camera = NULL;
4101 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_STREAM_FLIP;
4102 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4105 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4107 muse_camera_msg_get(set_flip, muse_core_client_get_msg(module));
4109 LOGD("handle : %p", muse_camera);
4111 ret = legacy_camera_attr_set_stream_flip(muse_camera->camera_handle, (camera_flip_e)set_flip);
4113 LOGD("ret : 0x%x", ret);
4115 muse_camera_msg_return(api, class, ret, module);
4117 return MUSE_CAMERA_ERROR_NONE;
4120 int camera_dispatcher_attr_get_stream_flip(muse_module_h module)
4122 int ret = CAMERA_ERROR_NONE;
4123 muse_camera_handle_s *muse_camera = NULL;
4124 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_STREAM_FLIP;
4125 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4126 camera_flip_e get_value = CAMERA_FLIP_NONE;
4128 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4130 LOGD("handle : %p", muse_camera);
4132 ret = legacy_camera_attr_get_stream_flip(muse_camera->camera_handle, &get_value);
4133 if (ret == CAMERA_ERROR_NONE) {
4134 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
4135 MUSE_CAMERA_GET_INT_STREAM_FLIP, "get_value", get_value, NULL);
4137 muse_camera_msg_return(api, class, ret, module);
4140 return MUSE_CAMERA_ERROR_NONE;
4143 int camera_dispatcher_attr_set_hdr_mode(muse_module_h module)
4146 muse_camera_handle_s *muse_camera = NULL;
4148 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4150 LOGD("handle : %p", muse_camera);
4152 muse_camera_msg_get(set_mode, muse_core_client_get_msg(module));
4154 _camera_task_add_job(muse_camera, MUSE_CAMERA_API_ATTR_SET_HDR_MODE,
4155 MUSE_CAMERA_API_CLASS_IMMEDIATE, set_mode);
4157 return MUSE_CAMERA_ERROR_NONE;
4160 int camera_dispatcher_attr_get_hdr_mode(muse_module_h module)
4162 int ret = CAMERA_ERROR_NONE;
4163 muse_camera_handle_s *muse_camera = NULL;
4164 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_HDR_MODE;
4165 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4166 camera_attr_hdr_mode_e get_value = CAMERA_ATTR_HDR_MODE_DISABLE;
4168 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4170 LOGD("handle : %p", muse_camera);
4172 ret = legacy_camera_attr_get_hdr_mode(muse_camera->camera_handle, &get_value);
4173 if (ret == CAMERA_ERROR_NONE) {
4174 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
4175 MUSE_CAMERA_GET_INT_HDR_MODE, "get_value", get_value, NULL);
4177 muse_camera_msg_return(api, class, ret, module);
4180 return MUSE_CAMERA_ERROR_NONE;
4183 int camera_dispatcher_attr_is_supported_hdr_capture(muse_module_h module)
4185 int ret = CAMERA_ERROR_NONE;
4186 muse_camera_handle_s *muse_camera = NULL;
4187 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_HDR_CAPTURE;
4188 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4190 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4192 LOGD("handle : %p", muse_camera);
4194 ret = legacy_camera_attr_is_supported_hdr_capture(muse_camera->camera_handle);
4196 LOGD("ret : 0x%x", ret);
4198 muse_camera_msg_return(api, class, ret, module);
4200 return MUSE_CAMERA_ERROR_NONE;
4203 int camera_dispatcher_attr_set_hdr_capture_progress_cb(muse_module_h module)
4205 int ret = CAMERA_ERROR_NONE;
4206 muse_camera_handle_s *muse_camera = NULL;
4207 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_HDR_CAPTURE_PROGRESS_CB;
4208 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4210 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4212 LOGD("handle : %p", muse_camera);
4214 ret = legacy_camera_attr_set_hdr_capture_progress_cb(muse_camera->camera_handle,
4215 (camera_attr_hdr_progress_cb)_camera_dispatcher_hdr_progress_cb,
4218 LOGD("ret : 0x%x", ret);
4220 muse_camera_msg_return(api, class, ret, module);
4222 return MUSE_CAMERA_ERROR_NONE;
4225 int camera_dispatcher_attr_unset_hdr_capture_progress_cb(muse_module_h module)
4227 int ret = CAMERA_ERROR_NONE;
4228 muse_camera_handle_s *muse_camera = NULL;
4229 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_UNSET_HDR_CAPTURE_PROGRESS_CB;
4230 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4232 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4234 LOGD("handle : %p", muse_camera);
4236 ret = legacy_camera_attr_unset_hdr_capture_progress_cb(muse_camera->camera_handle);
4238 LOGD("ret : 0x%x", ret);
4240 muse_camera_msg_return(api, class, ret, module);
4242 return MUSE_CAMERA_ERROR_NONE;
4245 int camera_dispatcher_attr_enable_anti_shake(muse_module_h module)
4247 int ret = CAMERA_ERROR_NONE;
4248 muse_camera_handle_s *muse_camera = NULL;
4249 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_ANTI_SHAKE;
4250 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4253 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4255 muse_camera_msg_get(set_enable, muse_core_client_get_msg(module));
4257 LOGD("handle : %p", muse_camera);
4259 ret = legacy_camera_attr_enable_anti_shake(muse_camera->camera_handle, (bool)set_enable);
4261 LOGD("ret : 0x%x", ret);
4263 muse_camera_msg_return(api, class, ret, module);
4265 return MUSE_CAMERA_ERROR_NONE;
4268 int camera_dispatcher_attr_is_enabled_anti_shake(muse_module_h module)
4270 int ret = CAMERA_ERROR_NONE;
4271 muse_camera_handle_s *muse_camera = NULL;
4272 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_ANTI_SHAKE;
4273 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4274 bool get_value = false;
4276 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4278 LOGD("handle : %p", muse_camera);
4280 ret = legacy_camera_attr_is_enabled_anti_shake(muse_camera->camera_handle, &get_value);
4281 if (ret == CAMERA_ERROR_NONE) {
4282 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
4283 MUSE_CAMERA_GET_INT_ENABLED_ANTI_SHAKE, "get_value", get_value, NULL);
4285 muse_camera_msg_return(api, class, ret, module);
4288 return MUSE_CAMERA_ERROR_NONE;
4291 int camera_dispatcher_attr_is_supported_anti_shake(muse_module_h module)
4293 int ret = CAMERA_ERROR_NONE;
4294 muse_camera_handle_s *muse_camera = NULL;
4295 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_ANTI_SHAKE;
4296 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4298 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4300 LOGD("handle : %p", muse_camera);
4302 ret = legacy_camera_attr_is_supported_anti_shake(muse_camera->camera_handle);
4304 LOGD("ret : 0x%x", ret);
4306 muse_camera_msg_return(api, class, ret, module);
4308 return MUSE_CAMERA_ERROR_NONE;
4311 int camera_dispatcher_attr_enable_video_stabilization(muse_module_h module)
4313 int ret = CAMERA_ERROR_NONE;
4314 muse_camera_handle_s *muse_camera = NULL;
4315 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_VIDEO_STABILIZATION;
4316 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4319 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4321 muse_camera_msg_get(set_enable, muse_core_client_get_msg(module));
4323 LOGD("handle : %p", muse_camera);
4325 ret = legacy_camera_attr_enable_video_stabilization(muse_camera->camera_handle, (bool)set_enable);
4327 LOGD("ret : 0x%x", ret);
4329 muse_camera_msg_return(api, class, ret, module);
4331 return MUSE_CAMERA_ERROR_NONE;
4334 int camera_dispatcher_attr_is_enabled_video_stabilization(muse_module_h module)
4336 int ret = CAMERA_ERROR_NONE;
4337 muse_camera_handle_s *muse_camera = NULL;
4338 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_VIDEO_STABILIZATION;
4339 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4340 bool get_value = false;
4342 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4344 LOGD("handle : %p", muse_camera);
4346 ret = legacy_camera_attr_is_enabled_video_stabilization(muse_camera->camera_handle, &get_value);
4347 if (ret == CAMERA_ERROR_NONE) {
4348 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
4349 MUSE_CAMERA_GET_INT_ENABLED_VIDEO_STABILIZATION, "get_value", get_value, NULL);
4351 muse_camera_msg_return(api, class, ret, module);
4354 return MUSE_CAMERA_ERROR_NONE;
4357 int camera_dispatcher_attr_is_supported_video_stabilization(muse_module_h module)
4359 int ret = CAMERA_ERROR_NONE;
4360 muse_camera_handle_s *muse_camera = NULL;
4361 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_VIDEO_STABILIZATION;
4362 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4364 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4366 LOGD("handle : %p", muse_camera);
4368 ret = legacy_camera_attr_is_supported_video_stabilization(muse_camera->camera_handle);
4370 LOGD("ret : 0x%x", ret);
4372 muse_camera_msg_return(api, class, ret, module);
4374 return MUSE_CAMERA_ERROR_NONE;
4377 int camera_dispatcher_attr_enable_auto_contrast(muse_module_h module)
4379 int ret = CAMERA_ERROR_NONE;
4380 muse_camera_handle_s *muse_camera = NULL;
4381 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_AUTO_CONTRAST;
4382 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4385 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4387 muse_camera_msg_get(set_enable, muse_core_client_get_msg(module));
4389 LOGD("handle : %p", muse_camera);
4391 ret = legacy_camera_attr_enable_auto_contrast(muse_camera->camera_handle, (bool)set_enable);
4393 LOGD("ret : 0x%x", ret);
4395 muse_camera_msg_return(api, class, ret, module);
4397 return MUSE_CAMERA_ERROR_NONE;
4400 int camera_dispatcher_attr_is_enabled_auto_contrast(muse_module_h module)
4402 int ret = CAMERA_ERROR_NONE;
4403 muse_camera_handle_s *muse_camera = NULL;
4404 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_AUTO_CONTRAST;
4405 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4406 bool get_value = false;
4408 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4410 LOGD("handle : %p", muse_camera);
4412 ret = legacy_camera_attr_is_enabled_auto_contrast(muse_camera->camera_handle, &get_value);
4413 if (ret == CAMERA_ERROR_NONE) {
4414 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
4415 MUSE_CAMERA_GET_INT_ENABLED_AUTO_CONTRAST, "get_value", get_value, NULL);
4417 muse_camera_msg_return(api, class, ret, module);
4420 return MUSE_CAMERA_ERROR_NONE;
4423 int camera_dispatcher_attr_is_supported_auto_contrast(muse_module_h module)
4425 int ret = CAMERA_ERROR_NONE;
4426 muse_camera_handle_s *muse_camera = NULL;
4427 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_AUTO_CONTRAST;
4428 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4430 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4432 LOGD("handle : %p", muse_camera);
4434 ret = legacy_camera_attr_is_supported_auto_contrast(muse_camera->camera_handle);
4436 LOGD("ret : 0x%x", ret);
4438 muse_camera_msg_return(api, class, ret, module);
4440 return MUSE_CAMERA_ERROR_NONE;
4443 int camera_dispatcher_attr_disable_shutter_sound(muse_module_h module)
4445 int ret = CAMERA_ERROR_NONE;
4446 muse_camera_handle_s *muse_camera = NULL;
4447 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_DISABLE_SHUTTER_SOUND;
4448 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4451 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4453 muse_camera_msg_get(set_disable, muse_core_client_get_msg(module));
4455 LOGD("handle : %p", muse_camera);
4457 ret = legacy_camera_attr_disable_shutter_sound(muse_camera->camera_handle, (bool)set_disable);
4459 LOGD("ret : 0x%x", ret);
4461 muse_camera_msg_return(api, class, ret, module);
4463 return MUSE_CAMERA_ERROR_NONE;
4466 int camera_dispatcher_attr_get_encoded_preview_bitrate(muse_module_h module)
4468 int ret = CAMERA_ERROR_NONE;
4469 muse_camera_handle_s *muse_camera = NULL;
4471 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ENCODED_PREVIEW_BITRATE;
4472 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4474 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4476 LOGD("handle : %p", muse_camera);
4478 ret = legacy_camera_attr_get_encoded_preview_bitrate(muse_camera->camera_handle, &get_value);
4479 if (ret == CAMERA_ERROR_NONE) {
4480 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
4481 MUSE_CAMERA_GET_INT_ENCODED_PREVIEW_BITRATE, "get_value", get_value, NULL);
4483 muse_camera_msg_return(api, class, ret, module);
4486 return MUSE_CAMERA_ERROR_NONE;
4489 int camera_dispatcher_attr_set_encoded_preview_bitrate(muse_module_h module)
4491 int ret = CAMERA_ERROR_NONE;
4492 muse_camera_handle_s *muse_camera = NULL;
4494 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ENCODED_PREVIEW_BITRATE;
4495 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4497 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4499 muse_camera_msg_get(set_bitrate, muse_core_client_get_msg(module));
4501 LOGD("handle : 0x%x, set_encoded_preview_bitrate : %d", muse_camera, set_bitrate);
4503 ret = legacy_camera_attr_set_encoded_preview_bitrate(muse_camera->camera_handle, set_bitrate);
4505 LOGD("ret : 0x%x", ret);
4507 muse_camera_msg_return(api, class, ret, module);
4509 return MUSE_CAMERA_ERROR_NONE;
4512 int camera_dispatcher_attr_get_encoded_preview_gop_interval(muse_module_h module)
4514 int ret = CAMERA_ERROR_NONE;
4515 muse_camera_handle_s *muse_camera = NULL;
4517 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ENCODED_PREVIEW_GOP_INTERVAL;
4518 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4520 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4522 LOGD("handle : %p", muse_camera);
4524 ret = legacy_camera_attr_get_encoded_preview_gop_interval(muse_camera->camera_handle, &get_value);
4525 if (ret == CAMERA_ERROR_NONE) {
4526 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
4527 MUSE_CAMERA_GET_INT_ENCODED_PREVIEW_GOP_INTERVAL, "get_value", get_value, NULL);
4529 muse_camera_msg_return(api, class, ret, module);
4532 return MUSE_CAMERA_ERROR_NONE;
4535 int camera_dispatcher_attr_set_encoded_preview_gop_interval(muse_module_h module)
4537 int ret = CAMERA_ERROR_NONE;
4538 muse_camera_handle_s *muse_camera = NULL;
4539 int set_gop_interval;
4540 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ENCODED_PREVIEW_GOP_INTERVAL;
4541 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4543 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4545 muse_camera_msg_get(set_gop_interval, muse_core_client_get_msg(module));
4547 LOGD("handle : 0x%x, set_encoded_preview_gop_interval : %d", muse_camera, set_gop_interval);
4549 ret = legacy_camera_attr_set_encoded_preview_gop_interval(muse_camera->camera_handle, set_gop_interval);
4551 LOGD("ret : 0x%x", ret);
4553 muse_camera_msg_return(api, class, ret, module);
4555 return MUSE_CAMERA_ERROR_NONE;
4558 int camera_dispatcher_attr_set_pan(muse_module_h module)
4560 int ret = CAMERA_ERROR_NONE;
4561 muse_camera_handle_s *muse_camera = NULL;
4565 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_PAN;
4566 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4568 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4570 muse_camera_msg_get(value, muse_core_client_get_msg(module));
4573 step = 0x0000ffff & value;
4575 LOGD("handle : 0x%x - type %d, step %d", muse_camera, type, step);
4577 ret = legacy_camera_attr_set_pan(muse_camera->camera_handle, type, step);
4579 LOGD("ret : 0x%x", ret);
4581 muse_camera_msg_return(api, class, ret, module);
4583 return MUSE_CAMERA_ERROR_NONE;
4586 int camera_dispatcher_attr_get_pan(muse_module_h module)
4588 int ret = CAMERA_ERROR_NONE;
4589 muse_camera_handle_s *muse_camera = NULL;
4591 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_PAN;
4592 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4594 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4596 LOGD("handle : %p", muse_camera);
4598 ret = legacy_camera_attr_get_pan(muse_camera->camera_handle, &get_value);
4599 if (ret == CAMERA_ERROR_NONE) {
4600 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
4601 MUSE_CAMERA_GET_INT_PAN, "get_value", get_value, NULL);
4603 muse_camera_msg_return(api, class, ret, module);
4606 return MUSE_CAMERA_ERROR_NONE;
4609 int camera_dispatcher_attr_get_pan_range(muse_module_h module)
4611 int ret = CAMERA_ERROR_NONE;
4612 muse_camera_handle_s *muse_camera = NULL;
4615 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_PAN_RANGE;
4616 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4617 muse_camera_get_type_e get_type = MUSE_CAMERA_GET_TYPE_INT_PAIR;
4618 muse_camera_get_int_pair_e index = MUSE_CAMERA_GET_INT_PAIR_PAN_RANGE;
4620 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4622 LOGD("handle : %p", muse_camera);
4624 ret = legacy_camera_attr_get_pan_range(muse_camera->camera_handle, &get_value0, &get_value1);
4625 if (ret == CAMERA_ERROR_NONE)
4626 muse_camera_msg_return2(api, class, ret, module, get_type, index, get_value0, get_value1);
4628 muse_camera_msg_return(api, class, ret, module);
4630 return MUSE_CAMERA_ERROR_NONE;
4633 int camera_dispatcher_attr_set_tilt(muse_module_h module)
4635 int ret = CAMERA_ERROR_NONE;
4636 muse_camera_handle_s *muse_camera = NULL;
4640 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TILT;
4641 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4643 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4645 muse_camera_msg_get(value, muse_core_client_get_msg(module));
4648 step = 0x0000ffff & value;
4650 LOGD("handle : 0x%x - type %d, step %d", muse_camera, type, step);
4652 ret = legacy_camera_attr_set_tilt(muse_camera->camera_handle, type, step);
4654 LOGD("ret : 0x%x", ret);
4656 muse_camera_msg_return(api, class, ret, module);
4658 return MUSE_CAMERA_ERROR_NONE;
4661 int camera_dispatcher_attr_get_tilt(muse_module_h module)
4663 int ret = CAMERA_ERROR_NONE;
4664 muse_camera_handle_s *muse_camera = NULL;
4666 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TILT;
4667 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4669 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4671 LOGD("handle : %p", muse_camera);
4673 ret = legacy_camera_attr_get_tilt(muse_camera->camera_handle, &get_value);
4674 if (ret == CAMERA_ERROR_NONE) {
4675 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
4676 MUSE_CAMERA_GET_INT_TILT, "get_value", get_value, NULL);
4678 muse_camera_msg_return(api, class, ret, module);
4681 return MUSE_CAMERA_ERROR_NONE;
4684 int camera_dispatcher_attr_get_tilt_range(muse_module_h module)
4686 int ret = CAMERA_ERROR_NONE;
4687 muse_camera_handle_s *muse_camera = NULL;
4690 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TILT_RANGE;
4691 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4692 muse_camera_get_type_e get_type = MUSE_CAMERA_GET_TYPE_INT_PAIR;
4693 muse_camera_get_int_pair_e index = MUSE_CAMERA_GET_INT_PAIR_TILT_RANGE;
4695 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4697 LOGD("handle : %p", muse_camera);
4699 ret = legacy_camera_attr_get_tilt_range(muse_camera->camera_handle, &get_value0, &get_value1);
4700 if (ret == CAMERA_ERROR_NONE)
4701 muse_camera_msg_return2(api, class, ret, module, get_type, index, get_value0, get_value1);
4703 muse_camera_msg_return(api, class, ret, module);
4705 return MUSE_CAMERA_ERROR_NONE;
4708 int camera_dispatcher_attr_set_ptz_type(muse_module_h module)
4710 int ret = CAMERA_ERROR_NONE;
4711 muse_camera_handle_s *muse_camera = NULL;
4712 int set_ptz_type = 0;
4713 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_PTZ_TYPE;
4714 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4716 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4718 muse_camera_msg_get(set_ptz_type, muse_core_client_get_msg(module));
4720 LOGD("handle : 0x%x", muse_camera);
4722 ret = legacy_camera_attr_set_ptz_type(muse_camera->camera_handle, set_ptz_type);
4724 LOGD("ret : 0x%x", ret);
4726 muse_camera_msg_return(api, class, ret, module);
4728 return MUSE_CAMERA_ERROR_NONE;
4731 int camera_dispatcher_attr_foreach_supported_ptz_type(muse_module_h module)
4733 int ret = CAMERA_ERROR_NONE;
4734 muse_camera_handle_s *muse_camera = NULL;
4735 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_PTZ_TYPE;
4736 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
4738 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4740 LOGD("handle : %p", muse_camera);
4742 ret = legacy_camera_attr_foreach_supported_ptz_type(muse_camera->camera_handle,
4743 (camera_attr_supported_ptz_type_cb)_camera_dispatcher_callback_supported_ptz_type,
4746 LOGD("ret : 0x%x", ret);
4748 muse_camera_msg_return(api, class, ret, module);
4750 return MUSE_CAMERA_ERROR_NONE;
4753 int camera_dispatcher_attr_set_display_roi_area(muse_module_h module)
4755 int ret = CAMERA_ERROR_NONE;
4756 muse_camera_handle_s *muse_camera = NULL;
4757 int set_display_roi_area[4] = {0,};
4758 muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY_ROI_AREA;
4759 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4761 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4763 muse_camera_msg_get_array(set_display_roi_area, muse_core_client_get_msg(module));
4765 LOGD("handle : 0x%x, x : %d, y : %d, width : %d, height : %d", muse_camera,
4766 set_display_roi_area[0], set_display_roi_area[1], set_display_roi_area[2], set_display_roi_area[3]);
4768 ret = legacy_camera_attr_set_display_roi_area(muse_camera->camera_handle, set_display_roi_area);
4770 LOGD("ret : 0x%x", ret);
4772 muse_camera_msg_return(api, class, ret, module);
4774 return MUSE_CAMERA_ERROR_NONE;
4777 int camera_dispatcher_attr_get_display_roi_area(muse_module_h module)
4779 int ret = CAMERA_ERROR_NONE;
4780 muse_camera_handle_s *muse_camera = NULL;
4781 int get_value[4] = {0,};
4782 muse_camera_api_e api = MUSE_CAMERA_API_GET_DISPLAY_ROI_AREA;
4783 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4784 char *send_msg = NULL;
4786 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4788 LOGD("handle : %p", muse_camera);
4790 ret = legacy_camera_attr_get_display_roi_area(muse_camera->camera_handle, get_value);
4791 if (ret == CAMERA_ERROR_NONE) {
4792 send_msg = muse_core_msg_json_factory_new(api,
4793 MUSE_TYPE_INT, PARAM_API_CLASS, class,
4794 MUSE_TYPE_INT, PARAM_RET, ret,
4795 MUSE_TYPE_INT, PARAM_GET_TYPE, MUSE_CAMERA_GET_TYPE_ARRAY,
4796 MUSE_TYPE_ARRAY, "get_value", 4, get_value,
4799 __camera_dispatcher_send_msg(module, send_msg);
4801 muse_camera_msg_return(api, class, ret, module);
4804 return MUSE_CAMERA_ERROR_NONE;
4808 int camera_dispatcher_return_buffer(muse_module_h module)
4811 muse_camera_handle_s *muse_camera = NULL;
4813 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4815 muse_camera_msg_get(tbm_key, muse_core_client_get_msg(module));
4817 /*LOGD("handle : %p, key : %d", muse_camera, tbm_key);*/
4819 if (!_camera_remove_export_data(module, tbm_key, FALSE))
4820 LOGE("remove export data failed : key %d", tbm_key);
4822 return MUSE_CAMERA_ERROR_NONE;
4825 int camera_dispatcher_preview_cb_return(muse_module_h module)
4827 muse_camera_handle_s *muse_camera = NULL;
4829 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4831 if (muse_camera == NULL) {
4832 LOGE("NULL handle");
4833 return MUSE_CAMERA_ERROR_NONE;
4838 g_mutex_lock(&muse_camera->preview_cb_lock);
4839 g_cond_signal(&muse_camera->preview_cb_cond);
4840 /*LOGD("send signal for preview callback");*/
4841 g_mutex_unlock(&muse_camera->preview_cb_lock);
4845 return MUSE_CAMERA_ERROR_NONE;
4848 int camera_dispatcher_set_display_reuse_hint(muse_module_h module)
4850 int ret = CAMERA_ERROR_NONE;
4852 muse_camera_handle_s *muse_camera = NULL;
4853 muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY_REUSE_HINT;
4854 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4856 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4858 muse_camera_msg_get(set_hint, muse_core_client_get_msg(module));
4860 LOGD("set hint : %d", set_hint);
4862 ret = legacy_camera_set_display_reuse_hint(muse_camera->camera_handle, (bool)set_hint);
4864 muse_camera_msg_return(api, class, ret, module);
4866 return MUSE_CAMERA_ERROR_NONE;
4869 int camera_dispatcher_get_display_reuse_hint(muse_module_h module)
4871 int ret = CAMERA_ERROR_NONE;
4873 muse_camera_handle_s *muse_camera = NULL;
4874 muse_camera_api_e api = MUSE_CAMERA_API_GET_DISPLAY_REUSE_HINT;
4875 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4877 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4879 ret = legacy_camera_get_display_reuse_hint(muse_camera->camera_handle, &get_value);
4880 if (ret == CAMERA_ERROR_NONE) {
4881 LOGD("hint : %d", get_value);
4882 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
4883 MUSE_CAMERA_GET_INT_DISPLAY_REUSE_HINT, "get_value", get_value, NULL);
4885 muse_camera_msg_return(api, class, ret, module);
4888 return MUSE_CAMERA_ERROR_NONE;
4891 int camera_dispatcher_get_device_state(muse_module_h module)
4893 int ret = CAMERA_ERROR_NONE;
4894 bool is_called = false;
4895 char value_key[KEY_LENGTH] = {'\0',};
4896 camera_h camera = NULL;
4897 camera_device_e device_type = CAMERA_DEVICE_CAMERA0;
4898 camera_device_state_e get_device_state = CAMERA_DEVICE_STATE_NULL;
4899 muse_camera_api_e api = MUSE_CAMERA_API_GET_DEVICE_STATE;
4900 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4902 muse_camera_msg_get(device_type, muse_core_client_get_msg(module));
4904 if (device_type < CAMERA_DEVICE_CAMERA0 || device_type > CAMERA_DEVICE_CAMERA1) {
4905 LOGE("invalid device %d", device_type);
4907 ret = CAMERA_ERROR_INVALID_PARAMETER;
4908 muse_camera_msg_return(api, class, ret, module);
4910 return MUSE_CAMERA_ERROR_NONE;
4913 muse_core_client_get_value(module, MUSED_KEY_DEVICE_STATE_CHECK, (int *)&is_called);
4916 ret = legacy_camera_create(device_type, &camera);
4918 legacy_camera_destroy(camera);
4922 muse_core_client_set_value(module, MUSED_KEY_DEVICE_STATE_RETURN, ret);
4923 muse_core_client_set_value(module, MUSED_KEY_DEVICE_STATE_CHECK, (int)true);
4925 muse_core_client_get_value(module, MUSED_KEY_DEVICE_STATE_RETURN, &ret);
4928 LOGD("is_called %d, ret 0x%x", is_called, ret);
4930 if (ret != CAMERA_ERROR_NONE) {
4931 LOGE("failed to create camera handle 0x%x", ret);
4933 muse_camera_msg_return(api, class, ret, module);
4935 return MUSE_CAMERA_ERROR_NONE;
4938 snprintf(value_key, KEY_LENGTH, "device_state_camera%d", device_type);
4939 muse_core_client_get_value(module, value_key, (int *)&get_device_state);
4941 LOGD("device[%d] state : %d", device_type, get_device_state);
4943 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
4944 -1, "get_device_state", get_device_state, NULL);
4946 return MUSE_CAMERA_ERROR_NONE;
4949 int (*dispatcher[MUSE_CAMERA_API_MAX]) (muse_module_h module) = {
4950 camera_dispatcher_create, /* MUSE_CAMERA_API_CREATE */
4951 camera_dispatcher_destroy, /* MUSE_CAMERA_API_DESTROY */
4952 camera_dispatcher_start_preview, /* MUSE_CAMERA_START_PREVIEW */
4953 camera_dispatcher_stop_preview, /* MUSE_CAMERA_API_START_PREVIEW */
4954 camera_dispatcher_start_capture, /* MUSE_CAMERA_START_CAPTURE */
4955 camera_dispatcher_is_supported_continuous_capture, /* MUSE_CAMERA_API_SUPPORT_CONTINUOUS_CAPTURE */
4956 camera_dispatcher_start_continuous_capture, /* MUSE_CAMERA_API_START_CONTINUOUS_CAPTURE, */
4957 camera_dispatcher_stop_continuous_capture, /* MUSE_CAMERA_API_STOP_CONTINUOUS_CAPTURE, */
4958 camera_dispatcher_is_supported_face_detection, /* MUSE_CAMERA_API_SUPPORT_FACE_DETECTION, */
4959 camera_dispatcher_is_supported_zero_shutter_lag, /* MUSE_CAMERA_API_SUPPORT_ZERO_SHUTTER_LAG, */
4960 camera_dispatcher_is_supported_media_packet_preview_cb, /* MUSE_CAMERA_API_SUPPORT_MEDIA_PACKET_PREVIEW_CB, */
4961 camera_dispatcher_get_device_count, /* MUSE_CAMERA_API_GET_DEVICE_COUNT, */
4962 camera_dispatcher_start_face_detection, /* MUSE_CAMERA_API_START_FACE_DETECTION, */
4963 camera_dispatcher_stop_face_detection, /* MUSE_CAMERA_API_STOP_FACE_DETECTION, */
4964 camera_dispatcher_get_state, /* MUSE_CAMERA_API_GET_STATE, */
4965 camera_dispatcher_start_focusing, /* MUSE_CAMERA_API_START_FOCUSING, */
4966 camera_dispatcher_stop_focusing, /* MUSE_CAMERA_API_CANCEL_FOCUSING, */
4967 camera_dispatcher_set_display, /* MUSE_CAMERA_API_SET_DISPLAY, */
4968 camera_dispatcher_set_preview_resolution, /* MUSE_CAMERA_API_SET_PREVIEW_RESOLUTION, */
4969 camera_dispatcher_set_capture_resolution, /* MUSE_CAMERA_API_SET_CAPTURE_RESOLUTION, */
4970 camera_dispatcher_set_capture_format, /* MUSE_CAMERA_API_SET_CAPTURE_FORMAT, */
4971 camera_dispatcher_set_preview_format, /* MUSE_CAMERA_API_SET_PREVIEW_FORMAT, */
4972 camera_dispatcher_get_preview_resolution, /* MUSE_CAMERA_API_GET_PREVIEW_RESOLUTION, */
4973 camera_dispatcher_set_display_rotation, /* MUSE_CAMERA_API_SET_DISPLAY_ROTATION, */
4974 camera_dispatcher_get_display_rotation, /* MUSE_CAMERA_API_GET_DISPLAY_ROTATION, */
4975 camera_dispatcher_set_display_flip, /* MUSE_CAMERA_API_SET_DISPLAY_FLIP, */
4976 camera_dispatcher_get_display_flip, /* MUSE_CAMERA_API_GET_DISPLAY_FLIP, */
4977 camera_dispatcher_set_display_visible, /* MUSE_CAMERA_API_SET_DISPLAY_VISIBLE, */
4978 camera_dispatcher_is_display_visible, /* MUSE_CAMERA_API_IS_DISPLAY_VISIBLE, */
4979 camera_dispatcher_set_display_mode, /* MUSE_CAMERA_API_SET_DISPLAY_MODE, */
4980 camera_dispatcher_get_display_mode, /* MUSE_CAMERA_API_GET_DISPLAY_MODE, */
4981 camera_dispatcher_get_capture_resolution, /* MUSE_CAMERA_API_GET_CAPTURE_RESOLUTION, */
4982 camera_dispatcher_get_capture_format, /* MUSE_CAMERA_API_GET_CAPTURE_FORMAT, */
4983 camera_dispatcher_get_preview_format, /* MUSE_CAMERA_API_GET_PREVIEW_FORMAT, */
4984 camera_dispatcher_get_facing_direction, /* MUSE_CAMERA_API_GET_FACING_DIRECTION, */
4985 camera_dispatcher_get_flash_state, /* MUSE_CAMERA_API_GET_FLASH_STATE, */
4986 camera_dispatcher_set_preview_cb, /* MUSE_CAMERA_API_SET_PREVIEW_CB, */
4987 camera_dispatcher_unset_preview_cb, /* MUSE_CAMERA_API_UNSET_PREVIEW_CB, */
4988 camera_dispatcher_set_media_packet_preview_cb, /* MUSE_CAMERA_API_SET_MEDIA_PACKET_PREVIEW_CB, */
4989 camera_dispatcher_unset_media_packet_preview_cb, /* MUSE_CAMERA_API_UNSET_MEDIA_PACKET_PREVIEW_CB, */
4990 camera_dispatcher_set_state_changed_cb, /* MUSE_CAMERA_API_SET_STATE_CHANGED_CB, */
4991 camera_dispatcher_unset_state_changed_cb, /* MUSE_CAMERA_API_UNSET_STATE_CHANGED_CB, */
4992 camera_dispatcher_set_interrupted_cb, /* MUSE_CAMERA_API_SET_INTERRUPTED_CB, */
4993 camera_dispatcher_unset_interrupted_cb, /* MUSE_CAMERA_API_UNSET_INTERRUPTED_CB, */
4994 camera_dispatcher_set_focus_changed_cb, /* MUSE_CAMERA_API_SET_FOCUS_CHANGED_CB, */
4995 camera_dispatcher_unset_focus_changed_cb, /* MUSE_CAMERA_API_UNSET_FOCUS_CHANGED_CB, */
4996 camera_dispatcher_set_error_cb, /* MUSE_CAMERA_API_SET_ERROR_CB, */
4997 camera_dispatcher_unset_error_cb, /* MUSE_CAMERA_API_UNSET_ERROR_CB, */
4998 camera_dispatcher_foreach_supported_preview_resolution, /* MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_PREVIEW_RESOLUTION, */
4999 camera_dispatcher_foreach_supported_capture_resolution, /* MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_CAPTURE_RESOLUTION, */
5000 camera_dispatcher_foreach_supported_capture_format, /* MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_CAPTURE_FORMAT, */
5001 camera_dispatcher_foreach_supported_preview_format, /* MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_PREVIEW_FORMAT, */
5002 camera_dispatcher_get_recommended_preview_resolution, /* MUSE_CAMERA_API_GET_RECOMMENDED_PREVIEW_RESOLUTION, */
5003 camera_dispatcher_attr_get_lens_orientation, /* MUSE_CAMERA_API_ATTR_GET_LENS_ORIENTATION, */
5004 camera_dispatcher_attr_set_theater_mode, /* MUSE_CAMERA_API_ATTR_SET_THEATER_MODE, */
5005 camera_dispatcher_attr_get_theater_mode, /* MUSE_CAMERA_API_ATTR_GET_THEATER_MODE, */
5006 camera_dispatcher_attr_foreach_supported_theater_mode, /* MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_THEATER_MODE, */
5007 camera_dispatcher_attr_set_preview_fps, /* MUSE_CAMERA_API_ATTR_SET_PREVIEW_FPS, */
5008 camera_dispatcher_attr_set_image_quality, /* MUSE_CAMERA_API_ATTR_SET_IMAGE_QUALITY, */
5009 camera_dispatcher_attr_get_preview_fps, /* MUSE_CAMERA_API_ATTR_GET_PREVIEW_FPS, */
5010 camera_dispatcher_attr_get_image_quality, /* MUSE_CAMERA_API_ATTR_GET_IMAGE_QUALITY, */
5011 camera_dispatcher_attr_set_zoom, /* MUSE_CAMERA_API_ATTR_SET_ZOOM, */
5012 camera_dispatcher_attr_set_af_mode, /* MUSE_CAMERA_API_ATTR_SET_AF_MODE, */
5013 camera_dispatcher_attr_set_af_area, /* MUSE_CAMERA_API_ATTR_SET_AF_AREA, */
5014 camera_dispatcher_attr_clear_af_area, /* MUSE_CAMERA_API_ATTR_CLEAR_AF_AREA, */
5015 camera_dispatcher_attr_set_exposure_mode, /* MUSE_CAMERA_API_ATTR_SET_EXPOSURE_MODE, */
5016 camera_dispatcher_attr_set_exposure, /* MUSE_CAMERA_API_ATTR_SET_EXPOSURE, */
5017 camera_dispatcher_attr_set_iso, /* MUSE_CAMERA_API_ATTR_SET_ISO, */
5018 camera_dispatcher_attr_set_brightness, /* MUSE_CAMERA_API_ATTR_SET_BRIGHTNESS, */
5019 camera_dispatcher_attr_set_contrast, /* MUSE_CAMERA_API_ATTR_SET_CONTRAST, */
5020 camera_dispatcher_attr_set_whitebalance, /* MUSE_CAMERA_API_ATTR_SET_WHITEBALANCE, */
5021 camera_dispatcher_attr_set_effect, /* MUSE_CAMERA_API_ATTR_SET_EFFECT, */
5022 camera_dispatcher_attr_set_scene_mode, /* MUSE_CAMERA_API_ATTR_SET_SCENE_MODE, */
5023 camera_dispatcher_attr_enable_tag, /* MUSE_CAMERA_API_ATTR_ENABLE_TAG, */
5024 camera_dispatcher_attr_set_tag_image_description, /* MUSE_CAMERA_API_ATTR_SET_TAG_IMAGE_DESCRIPTION, */
5025 camera_dispatcher_attr_set_tag_orientation, /* MUSE_CAMERA_API_ATTR_SET_TAG_ORIENTATION, */
5026 camera_dispatcher_attr_set_tag_software, /* MUSE_CAMERA_API_ATTR_SET_TAG_SOFTWARE, */
5027 camera_dispatcher_attr_set_geotag, /* MUSE_CAMERA_API_ATTR_SET_GEOTAG, */
5028 camera_dispatcher_attr_remove_geotag, /* MUSE_CAMERA_API_ATTR_REMOVE_GEOTAG, */
5029 camera_dispatcher_attr_set_flash_mode, /* MUSE_CAMERA_API_ATTR_SET_FLASH_MODE, */
5030 camera_dispatcher_attr_get_zoom, /* MUSE_CAMERA_API_ATTR_GET_ZOOM, */
5031 camera_dispatcher_attr_get_zoom_range, /* MUSE_CAMERA_API_ATTR_GET_ZOOM_RANGE, */
5032 camera_dispatcher_attr_get_af_mode, /* MUSE_CAMERA_API_ATTR_GET_AF_MODE, */
5033 camera_dispatcher_attr_get_exposure_mode, /* MUSE_CAMERA_API_ATTR_GET_EXPOSURE_MODE, */
5034 camera_dispatcher_attr_get_exposure, /* MUSE_CAMERA_API_ATTR_GET_EXPOSURE, */
5035 camera_dispatcher_attr_get_exposure_range, /* MUSE_CAMERA_API_ATTR_GET_EXPOSURE_RANGE, */
5036 camera_dispatcher_attr_get_iso, /* MUSE_CAMERA_API_ATTR_GET_ISO, */
5037 camera_dispatcher_attr_get_brightness, /* MUSE_CAMERA_API_ATTR_GET_BRIGHTNESS, */
5038 camera_dispatcher_attr_get_brightness_range, /* MUSE_CAMERA_API_ATTR_GET_BRIGHTNESS_RANGE, */
5039 camera_dispatcher_attr_get_contrast, /* MUSE_CAMERA_API_ATTR_GET_CONTRAST, */
5040 camera_dispatcher_attr_get_contrast_range, /* MUSE_CAMERA_API_ATTR_GET_CONTRAST_RANGE, */
5041 camera_dispatcher_attr_get_whitebalance, /* MUSE_CAMERA_API_ATTR_GET_WHITEBALANCE, */
5042 camera_dispatcher_attr_get_effect, /* MUSE_CAMERA_API_ATTR_GET_EFFECT, */
5043 camera_dispatcher_attr_get_scene_mode, /* MUSE_CAMERA_API_ATTR_GET_SCENE_MODE, */
5044 camera_dispatcher_attr_is_enabled_tag, /* MUSE_CAMERA_API_ATTR_IS_ENABLED_TAG, */
5045 camera_dispatcher_attr_get_tag_image_description, /* MUSE_CAMERA_API_ATTR_GET_TAG_IMAGE_DESCRIPTION, */
5046 camera_dispatcher_attr_get_tag_orientation, /* MUSE_CAMERA_API_ATTR_GET_TAG_ORIENTATION, */
5047 camera_dispatcher_attr_get_tag_software, /* MUSE_CAMERA_API_ATTR_GET_TAG_SOFTWARE, */
5048 camera_dispatcher_attr_get_geotag, /* MUSE_CAMERA_API_ATTR_GET_GEOTAG, */
5049 camera_dispatcher_attr_get_flash_mode, /* MUSE_CAMERA_API_ATTR_GET_FLASH_MODE, */
5050 camera_dispatcher_attr_foreach_supported_af_mode, /* MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_AF_MODE, */
5051 camera_dispatcher_attr_foreach_supported_exposure_mode, /* MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_EXPOSURE_MODE, */
5052 camera_dispatcher_attr_foreach_supported_iso, /* MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_ISO, */
5053 camera_dispatcher_attr_foreach_supported_whitebalance, /* MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_WHITEBALANCE, */
5054 camera_dispatcher_attr_foreach_supported_effect, /* MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_EFFECT, */
5055 camera_dispatcher_attr_foreach_supported_scene_mode, /* MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_SCENE_MODE, */
5056 camera_dispatcher_attr_foreach_supported_flash_mode, /* MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FLASH_MODE, */
5057 camera_dispatcher_attr_foreach_supported_fps, /* MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FPS, */
5058 camera_dispatcher_attr_foreach_supported_fps_by_resolution, /* MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FPS_BY_RESOLUTION, */
5059 camera_dispatcher_attr_foreach_supported_stream_flip, /* MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_STREAM_FLIP, */
5060 camera_dispatcher_attr_foreach_supported_stream_rotation, /* MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_STREAM_ROTATION, */
5061 camera_dispatcher_attr_set_stream_rotation, /* MUSE_CAMERA_API_ATTR_SET_STREAM_ROTATION, */
5062 camera_dispatcher_attr_get_stream_rotation, /* MUSE_CAMERA_API_ATTR_GET_STREAM_ROTATION, */
5063 camera_dispatcher_attr_set_stream_flip, /* MUSE_CAMERA_API_ATTR_SET_STREAM_FLIP, */
5064 camera_dispatcher_attr_get_stream_flip, /* MUSE_CAMERA_API_ATTR_GET_STREAM_FLIP, */
5065 camera_dispatcher_attr_set_hdr_mode, /* MUSE_CAMERA_API_ATTR_SET_HDR_MODE, */
5066 camera_dispatcher_attr_get_hdr_mode, /* MUSE_CAMERA_API_ATTR_GET_HDR_MODE, */
5067 camera_dispatcher_attr_is_supported_hdr_capture, /* MUSE_CAMERA_API_ATTR_IS_SUPPORTED_HDR_CAPTURE, */
5068 camera_dispatcher_attr_set_hdr_capture_progress_cb, /* MUSE_CAMERA_API_ATTR_SET_HDR_CAPTURE_PROGRESS_CB, */
5069 camera_dispatcher_attr_unset_hdr_capture_progress_cb, /* MUSE_CAMERA_API_ATTR_UNSET_HDR_CAPTURE_PROGRESS_CB, */
5070 camera_dispatcher_attr_enable_anti_shake, /* MUSE_CAMERA_API_ATTR_ENABLE_ANTI_SHAKE, */
5071 camera_dispatcher_attr_is_enabled_anti_shake, /* MUSE_CAMERA_API_ATTR_IS_ENABLED_ANTI_SHAKE, */
5072 camera_dispatcher_attr_is_supported_anti_shake, /* MUSE_CAMERA_API_ATTR_IS_SUPPORTED_ANTI_SHAKE, */
5073 camera_dispatcher_attr_enable_video_stabilization, /* MUSE_CAMERA_API_ATTR_ENABLE_VIDEO_STABILIZATION, */
5074 camera_dispatcher_attr_is_enabled_video_stabilization, /* MUSE_CAMERA_API_ATTR_IS_ENABLED_VIDEO_STABILIZATION, */
5075 camera_dispatcher_attr_is_supported_video_stabilization, /* MUSE_CAMERA_API_ATTR_IS_SUPPORTED_VIDEO_STABILIZATION, */
5076 camera_dispatcher_attr_enable_auto_contrast, /* MUSE_CAMERA_API_ATTR_ENABLE_AUTO_CONTRAST, */
5077 camera_dispatcher_attr_is_enabled_auto_contrast, /* MUSE_CAMERA_API_ATTR_IS_ENABLED_AUTO_CONTRAST, */
5078 camera_dispatcher_attr_is_supported_auto_contrast, /* MUSE_CAMERA_API_ATTR_IS_SUPPORTED_AUTO_CONTRAST, */
5079 camera_dispatcher_attr_disable_shutter_sound, /* MUSE_CAMERA_API_ATTR_DISABLE_SHUTTER_SOUND, */
5080 camera_dispatcher_attr_get_encoded_preview_bitrate, /* MUSE_CAMERA_API_ATTR_GET_ENCODED_PREVIEW_BITRATE, */
5081 camera_dispatcher_attr_set_encoded_preview_bitrate, /* MUSE_CAMERA_API_ATTR_SET_ENCODED_PREVIEW_BITRATE, */
5082 camera_dispatcher_attr_get_encoded_preview_gop_interval, /* MUSE_CAMERA_API_ATTR_GET_ENCODED_PREVIEW_GOP_INTERVAL, */
5083 camera_dispatcher_attr_set_encoded_preview_gop_interval, /* MUSE_CAMERA_API_ATTR_SET_ENCODED_PREVIEW_GOP_INTERVAL, */
5084 camera_dispatcher_attr_set_pan, /* MUSE_CAMERA_API_ATTR_SET_PAN */
5085 camera_dispatcher_attr_get_pan, /* MUSE_CAMERA_API_ATTR_GET_PAN */
5086 camera_dispatcher_attr_get_pan_range, /* MUSE_CAMERA_API_ATTR_GET_PAN_RANGE */
5087 camera_dispatcher_attr_set_tilt, /* MUSE_CAMERA_API_ATTR_SET_TILT */
5088 camera_dispatcher_attr_get_tilt, /* MUSE_CAMERA_API_ATTR_GET_TILT */
5089 camera_dispatcher_attr_get_tilt_range, /* MUSE_CAMERA_API_ATTR_GET_TILT_RANGE */
5090 camera_dispatcher_attr_set_ptz_type, /* MUSE_CAMERA_API_ATTR_SET_PTZ_TYPE */
5091 camera_dispatcher_attr_foreach_supported_ptz_type, /* MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_PTZ_TYPE */
5092 camera_dispatcher_attr_set_display_roi_area, /* MUSE_CAMERA_API_SET_DISPLAY_ROI_AREA */
5093 camera_dispatcher_attr_get_display_roi_area, /* MUSE_CAMERA_API_GET_DISPLAY_ROI_AREA */
5094 camera_dispatcher_return_buffer, /* MUSE_CAMERA_API_RETURN_BUFFER */
5095 camera_dispatcher_preview_cb_return, /* MUSE_CAMERA_API_PREVIEW_CB_RETURN */
5096 camera_dispatcher_set_display_reuse_hint, /* MUSE_CAMERA_API_SET_DISPLAY_REUSE_HINT */
5097 camera_dispatcher_get_display_reuse_hint, /* MUSE_CAMERA_API_GET_DISPLAY_REUSE_HINT */
5098 camera_dispatcher_change_device, /* MUSE_CAMERA_API_CHANGE_DEVICE */
5099 camera_dispatcher_get_device_state /* MUSE_CAMERA_API_GET_DEVICE_STATE */
5103 /******************/
5104 /* cmd dispatcher */
5105 /******************/
5106 static int camera_cmd_dispatcher_initialize(muse_module_h module)
5110 GstPlugin *plugin = NULL;
5112 const char *load_list[] = {
5113 LIBDIR"/gstreamer-1.0/libgstcoreelements.so",
5114 LIBDIR"/gstreamer-1.0/libgstcamerasrc.so",
5115 LIBDIR"/gstreamer-1.0/libgstwaylandsink.so",
5118 item_count = sizeof(load_list) / sizeof(load_list[0]);
5120 LOGD("item count %d", item_count);
5122 for (i = 0 ; i < item_count ; i++) {
5123 plugin = gst_plugin_load_file(load_list[i], NULL);
5125 LOGD("%s loaded", load_list[i]);
5126 gst_object_unref(plugin);
5129 LOGW("failed to load %s", load_list[i]);
5135 return MUSE_CAMERA_ERROR_NONE;
5139 static int camera_cmd_dispatcher_shutdown(muse_module_h module)
5141 muse_camera_handle_s *muse_camera = NULL;
5142 camera_state_e state = CAMERA_STATE_NONE;
5143 int capture_try_count = 0;
5146 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
5147 if (muse_camera == NULL) {
5148 LOGE("NULL handle");
5149 return MUSE_CAMERA_ERROR_INVALID;
5152 legacy_camera_lock(muse_camera->camera_handle, true);
5154 if (legacy_camera_is_used(muse_camera->camera_handle)) {
5155 LOGW("camera is used in recorder.. wait...");
5156 if (legacy_camera_wait(muse_camera->camera_handle, 3000)) {
5157 LOGD("recorder is released");
5159 legacy_camera_lock(muse_camera->camera_handle, false);
5160 LOGE("wait timeout, could not release camera handle %p", muse_camera->camera_handle);
5161 return MUSE_CAMERA_ERROR_INVALID;
5165 legacy_camera_lock(muse_camera->camera_handle, false);
5167 muse_camera->is_shutting_down = true;
5170 legacy_camera_get_state(muse_camera->camera_handle, &state);
5172 LOGW("current state : %d", state);
5175 case CAMERA_STATE_CAPTURING:
5176 if (capture_try_count < 30) {
5177 LOGW("now capturing.. wait for capture data...");
5179 capture_try_count++;
5182 LOGE("wait capture data timeout! keep going...");
5185 case CAMERA_STATE_CAPTURED:
5186 legacy_camera_start_preview(muse_camera->camera_handle);
5188 case CAMERA_STATE_PREVIEW:
5189 _camera_remove_export_data(module, 0, TRUE); /* force return buffer before stop preview */
5190 legacy_camera_stop_preview(muse_camera->camera_handle);
5192 case CAMERA_STATE_CREATED:
5193 ret = legacy_camera_destroy(muse_camera->camera_handle);
5194 if (ret == CAMERA_ERROR_NONE)
5195 _camera_dispatcher_release_resource(module);
5197 LOGE("failed to destroy camera handle");
5206 return MUSE_CAMERA_ERROR_NONE;
5210 int (*cmd_dispatcher[MUSE_MODULE_COMMAND_MAX])(muse_module_h module) = {
5211 camera_cmd_dispatcher_initialize, /* MUSE_MODULE_COMMAND_INITIALIZE */
5212 camera_cmd_dispatcher_shutdown, /* MUSE_MODULE_COMMAND_SHUTDOWN */
5213 NULL, /* MUSE_MODULE_COMMAND_DEBUG_INFO_DUMP */
5214 NULL, /* MUSE_MODULE_COMMAND_CREATE_SERVER_ACK */
5215 NULL, /* MUSE_MODULE_COMMAND_RESOURCE_NOT_AVAILABLE */
5216 NULL /* MUSE_MODULE_COMMAND_EXTERNAL_STORAGE_STATE_CHANGED */