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_FEATURE_NAME "http://tizen.org/feature/camera"
38 #define CAMERA_PRIVILEGE_NAME "http://tizen.org/privilege/camera"
39 #define MUSED_KEY_DEVICE_STATE_CHECK "camera_get_device_state_is_called"
40 #define MUSED_KEY_DEVICE_STATE_RETURN "camera_get_device_state_return"
41 #define MUSED_KEY_FLASH_STATE_CHECK "camera_get_flash_state_is_called"
42 #define MUSED_KEY_FLASH_STATE_RETURN "camera_get_flash_state_return"
43 #define MUSED_KEY_FLASH_STATE_COUNT "camera_get_flash_state_count"
45 static int _camera_remove_export_data(muse_module_h module, int key, int remove_all);
47 static void __camera_dispatcher_send_msg(muse_module_h module, char *msg)
61 /*LOGD("msg [%s]", msg);*/
63 len = muse_core_ipc_send_msg(muse_core_client_get_msg_fd(module), msg);
65 LOGE("sending message[%s] failed. errno %d", msg, errno);
68 muse_core_msg_json_factory_free(msg);
73 static void muse_camera_msg_return(int api, int class, int ret, muse_module_h module)
75 char *send_msg = muse_core_msg_json_factory_new(api,
76 MUSE_TYPE_INT, PARAM_API_CLASS, class,
77 MUSE_TYPE_INT, PARAM_RET, ret,
78 MUSE_TYPE_INT, PARAM_GET_TYPE, MUSE_CAMERA_GET_TYPE_NONE,
81 __camera_dispatcher_send_msg(module, send_msg);
86 static void muse_camera_msg_return1(int api, int class, int ret, muse_module_h module,
87 int get_type, int index, const char *name, int value_int, void *value_pointer)
89 char *send_msg = NULL;
91 if (get_type == MUSE_CAMERA_GET_TYPE_INT) {
92 send_msg = muse_core_msg_json_factory_new(api,
93 MUSE_TYPE_INT, PARAM_API_CLASS, class,
94 MUSE_TYPE_INT, PARAM_RET, ret,
95 MUSE_TYPE_INT, PARAM_GET_TYPE, get_type,
96 MUSE_TYPE_INT, PARAM_GET_INDEX, index,
97 MUSE_TYPE_INT, name, value_int,
99 } else if (get_type == MUSE_CAMERA_GET_TYPE_STRING) {
100 send_msg = muse_core_msg_json_factory_new(api,
101 MUSE_TYPE_INT, PARAM_API_CLASS, class,
102 MUSE_TYPE_INT, PARAM_RET, ret,
103 MUSE_TYPE_INT, PARAM_GET_TYPE, get_type,
104 MUSE_TYPE_INT, PARAM_GET_INDEX, index,
105 MUSE_TYPE_STRING, name, value_pointer,
107 } else if (get_type == MUSE_CAMERA_GET_TYPE_POINTER) {
108 send_msg = muse_core_msg_json_factory_new(api,
109 MUSE_TYPE_INT, PARAM_API_CLASS, class,
110 MUSE_TYPE_INT, PARAM_RET, ret,
111 MUSE_TYPE_INT, PARAM_GET_TYPE, get_type,
112 MUSE_TYPE_INT, PARAM_GET_INDEX, index,
113 MUSE_TYPE_POINTER, name, value_pointer,
116 LOGW("unknown type %d", get_type);
119 __camera_dispatcher_send_msg(module, send_msg);
125 static void muse_camera_msg_return2(int api, int class, int ret, muse_module_h module,
126 int get_type, int index, int value0, int value1)
128 char *send_msg = muse_core_msg_json_factory_new(api,
129 MUSE_TYPE_INT, PARAM_API_CLASS, class,
130 MUSE_TYPE_INT, PARAM_RET, ret,
131 MUSE_TYPE_INT, PARAM_GET_TYPE, get_type,
132 MUSE_TYPE_INT, PARAM_GET_INDEX, index,
133 MUSE_TYPE_INT, "get_value0", value0,
134 MUSE_TYPE_INT, "get_value1", value1,
137 __camera_dispatcher_send_msg(module, send_msg);
143 static void muse_camera_msg_event1(int api, int event, int class, muse_module_h module, const char *name, int value)
145 char *send_msg = muse_core_msg_json_factory_new(api,
146 MUSE_TYPE_INT, PARAM_EVENT, event,
147 MUSE_TYPE_INT, PARAM_EVENT_CLASS, class,
148 MUSE_TYPE_INT, name, value,
151 __camera_dispatcher_send_msg(module, send_msg);
157 static void muse_camera_msg_event2(int api, int event, int class, muse_module_h module,
158 const char *name0, int value0, const char *name1, int value1)
160 char *send_msg = muse_core_msg_json_factory_new(api,
161 MUSE_TYPE_INT, PARAM_EVENT, event,
162 MUSE_TYPE_INT, PARAM_EVENT_CLASS, class,
163 MUSE_TYPE_INT, name0, value0,
164 MUSE_TYPE_INT, name1, value1,
167 __camera_dispatcher_send_msg(module, send_msg);
173 static void muse_camera_msg_event3(int api, int event, int class, muse_module_h module,
174 const char *name0, int value0, const char *name1, int value1, const char *name2, int value2)
176 char *send_msg = muse_core_msg_json_factory_new(api,
177 MUSE_TYPE_INT, PARAM_EVENT, event,
178 MUSE_TYPE_INT, PARAM_EVENT_CLASS, class,
179 MUSE_TYPE_INT, name0, value0,
180 MUSE_TYPE_INT, name1, value1,
181 MUSE_TYPE_INT, name2, value2,
184 __camera_dispatcher_send_msg(module, send_msg);
190 bool _camera_dispatcher_callback_supported_theater_mode(int param1, void *user_data)
192 muse_module_h module = (muse_module_h)user_data;
199 muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT,
200 MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE,
201 MUSE_CAMERA_EVENT_CLASS_THREAD_SUB,
202 module, "param1", param1);
207 bool _camera_dispatcher_callback_supported_af_mode(int param1, void *user_data)
209 muse_module_h module = (muse_module_h)user_data;
216 muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT,
217 MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_AF_MODE,
218 MUSE_CAMERA_EVENT_CLASS_THREAD_SUB,
219 module, "param1", param1);
224 bool _camera_dispatcher_callback_supported_exposure_mode(int param1, void *user_data)
226 muse_module_h module = (muse_module_h)user_data;
233 muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT,
234 MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EXPOSURE_MODE,
235 MUSE_CAMERA_EVENT_CLASS_THREAD_SUB,
236 module, "param1", param1);
241 bool _camera_dispatcher_callback_supported_iso_mode(int param1, void *user_data)
243 muse_module_h module = (muse_module_h)user_data;
250 muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT,
251 MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_ISO,
252 MUSE_CAMERA_EVENT_CLASS_THREAD_SUB,
253 module, "param1", param1);
258 bool _camera_dispatcher_callback_supported_whitebalance(int param1, void *user_data)
260 muse_module_h module = (muse_module_h)user_data;
267 muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT,
268 MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_WHITEBALANCE,
269 MUSE_CAMERA_EVENT_CLASS_THREAD_SUB,
270 module, "param1", param1);
275 bool _camera_dispatcher_callback_supported_effect(int param1, void *user_data)
277 muse_module_h module = (muse_module_h)user_data;
284 muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT,
285 MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EFFECT,
286 MUSE_CAMERA_EVENT_CLASS_THREAD_SUB,
287 module, "param1", param1);
292 bool _camera_dispatcher_callback_supported_scene_mode(int param1, void *user_data)
294 muse_module_h module = (muse_module_h)user_data;
301 muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT,
302 MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_SCENE_MODE,
303 MUSE_CAMERA_EVENT_CLASS_THREAD_SUB,
304 module, "param1", param1);
309 bool _camera_dispatcher_callback_supported_flash_mode(int param1, void *user_data)
311 muse_module_h module = (muse_module_h)user_data;
318 muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT,
319 MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FLASH_MODE,
320 MUSE_CAMERA_EVENT_CLASS_THREAD_SUB,
321 module, "param1", param1);
326 bool _camera_dispatcher_callback_supported_flash_mode2(int param1, void *user_data)
328 int *count = (int *)user_data;
336 bool _camera_dispatcher_callback_supported_fps(int param1, void *user_data)
338 muse_module_h module = (muse_module_h)user_data;
345 muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT,
346 MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS,
347 MUSE_CAMERA_EVENT_CLASS_THREAD_SUB,
348 module, "param1", param1);
353 bool _camera_dispatcher_callback_supported_fps_by_resolution(int param1, void *user_data)
355 muse_module_h module = (muse_module_h)user_data;
362 muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT,
363 MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS_BY_RESOLUTION,
364 MUSE_CAMERA_EVENT_CLASS_THREAD_SUB,
365 module, "param1", param1);
370 bool _camera_dispatcher_callback_supported_stream_flip(int param1, void *user_data)
372 muse_module_h module = (muse_module_h)user_data;
379 muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT,
380 MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_FLIP,
381 MUSE_CAMERA_EVENT_CLASS_THREAD_SUB,
382 module, "param1", param1);
387 bool _camera_dispatcher_callback_supported_stream_rotation(int param1, void *user_data)
389 muse_module_h module = (muse_module_h)user_data;
396 muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT,
397 MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION,
398 MUSE_CAMERA_EVENT_CLASS_THREAD_SUB,
399 module, "param1", param1);
404 bool _camera_dispatcher_callback_supported_capture_format(int param1, void *user_data)
406 muse_module_h module = (muse_module_h)user_data;
413 muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT,
414 MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_FORMAT,
415 MUSE_CAMERA_EVENT_CLASS_THREAD_SUB,
416 module, "param1", param1);
421 bool _camera_dispatcher_callback_supported_preview_format(int param1, void *user_data)
423 muse_module_h module = (muse_module_h)user_data;
430 muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT,
431 MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_FORMAT,
432 MUSE_CAMERA_EVENT_CLASS_THREAD_SUB,
433 module, "param1", param1);
438 bool _camera_dispatcher_callback_supported_preview_resolution(int param1, int param2, void *user_data)
440 muse_module_h module = (muse_module_h)user_data;
447 muse_camera_msg_event2(MUSE_CAMERA_CB_EVENT,
448 MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_RESOLUTION,
449 MUSE_CAMERA_EVENT_CLASS_THREAD_SUB,
450 module, "param1", param1, "param2", param2);
455 bool _camera_dispatcher_callback_supported_capture_resolution(int param1, int param2, void *user_data)
457 muse_module_h module = (muse_module_h)user_data;
459 muse_camera_msg_event2(MUSE_CAMERA_CB_EVENT,
460 MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_RESOLUTION,
461 MUSE_CAMERA_EVENT_CLASS_THREAD_SUB,
462 module, "param1", param1, "param2", param2);
467 bool _camera_dispatcher_callback_supported_ptz_type(int param1, void *user_data)
469 muse_module_h module = (muse_module_h)user_data;
476 muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT,
477 MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PTZ_TYPE,
478 MUSE_CAMERA_EVENT_CLASS_THREAD_SUB,
479 module, "param1", param1);
484 static int _camera_remove_export_data(muse_module_h module, int key, int remove_all)
486 muse_camera_handle_s *muse_camera = NULL;
487 GList *tmp_list = NULL;
488 muse_camera_export_data *export_data = NULL;
490 if (module == NULL || (key <= 0 && remove_all == FALSE)) {
491 LOGE("invalid parameter %p, %d", module, key);
495 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
496 if (muse_camera == NULL) {
501 g_mutex_lock(&muse_camera->list_lock);
503 tmp_list = muse_camera->data_list;
506 export_data = (muse_camera_export_data *)tmp_list->data;
507 tmp_list = tmp_list->next;
509 if (export_data->key == key || remove_all) {
510 /*LOGD("key %d matched, remove it (remove_all %d)", key, remove_all);*/
513 LOGW("remove remained export data key %d, internal buffer %p",
514 export_data->key, export_data->internal_buffer);
517 if (export_data->is_capture) {
518 LOGD("capture callback is done");
519 g_cond_signal(&muse_camera->list_cond);
522 if (export_data->bo) {
523 tbm_bo_unref(export_data->bo);
524 export_data->bo = NULL;
526 LOGW("bo for key %d is NULL", key);
529 export_data->key = 0;
531 if (export_data->internal_buffer) {
532 gst_buffer_unref((GstBuffer *)export_data->internal_buffer);
533 export_data->internal_buffer = NULL;
536 if (export_data->data_bo) {
537 tbm_bo_unref(export_data->data_bo);
538 export_data->data_bo = NULL;
541 muse_camera->data_list = g_list_remove(muse_camera->data_list, export_data);
546 if (remove_all == FALSE) {
547 /*LOGD("key %d, remove done");*/
548 g_mutex_unlock(&muse_camera->list_lock);
551 LOGD("check next data");
559 g_mutex_unlock(&muse_camera->list_lock);
562 LOGW("remove all done");
564 LOGE("should not be reached here - key %d", key);
571 void _camera_dispatcher_capturing_cb(camera_image_data_s* image, camera_image_data_s* postview, camera_image_data_s* thumbnail, void *user_data)
573 muse_camera_handle_s *muse_camera = NULL;
574 int data_size_main = 0;
575 int data_size_post = 0;
576 int data_size_thumb = 0;
577 tbm_bo bo_main = NULL;
578 tbm_bo bo_post = NULL;
579 tbm_bo bo_thumb = NULL;
580 tbm_bo_handle bo_main_handle = {.ptr = NULL};
581 tbm_bo_handle bo_post_handle = {.ptr = NULL};
582 tbm_bo_handle bo_thumb_handle = {.ptr = NULL};
583 muse_camera_export_data *export_data_main = NULL;
584 muse_camera_export_data *export_data_post = NULL;
585 muse_camera_export_data *export_data_thumb = NULL;
586 int tbm_key_main = 0;
587 int tbm_key_post = 0;
588 int tbm_key_thumb = 0;
589 muse_module_h module = (muse_module_h)user_data;
590 unsigned char *buf_pos = NULL;
595 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
596 if (!muse_camera || !image) {
597 LOGE("invalid ptr %p %p", muse_camera, image);
602 export_data_main = g_new0(muse_camera_export_data, 1);
603 if (export_data_main == NULL) {
604 LOGE("alloc export_data failed");
608 data_size_main = sizeof(camera_image_data_s) + image->size;
609 if (image->exif && image->exif_size > 0)
610 data_size_main += image->exif_size;
613 bo_main = tbm_bo_alloc(muse_camera->bufmgr, data_size_main, TBM_BO_DEFAULT);
614 if (bo_main == NULL) {
615 LOGE("bo alloc failed");
616 goto main_image_error;
619 bo_main_handle = tbm_bo_map(bo_main, TBM_DEVICE_CPU, TBM_OPTION_READ | TBM_OPTION_WRITE);
620 if (bo_main_handle.ptr == NULL) {
621 LOGE("bo map Error!");
622 goto main_image_error;
625 buf_pos = (unsigned char *)bo_main_handle.ptr;
626 memcpy(buf_pos, image, sizeof(camera_image_data_s));
627 buf_pos += sizeof(camera_image_data_s);
628 memcpy(buf_pos, image->data, image->size);
629 if (image->exif && image->exif_size > 0) {
630 buf_pos += image->size;
631 memcpy(buf_pos, image->exif, image->exif_size);
634 tbm_bo_unmap(bo_main);
636 tbm_key_main = tbm_bo_export(bo_main);
637 if (tbm_key_main == 0) {
638 LOGE("Create key_info ERROR!!");
639 goto main_image_error;
642 LOGD("bo %p, vaddr %p, size %d, key %d",
643 bo_main, bo_main_handle.ptr, data_size_main, tbm_key_main);
646 export_data_main->key = tbm_key_main;
647 export_data_main->bo = bo_main;
648 export_data_main->is_capture = true;
651 if (postview && postview->size > 0) {
652 data_size_post = sizeof(camera_image_data_s) + postview->size;
654 export_data_post = g_new0(muse_camera_export_data, 1);
655 if (export_data_post == NULL) {
656 LOGE("alloc export_data failed");
657 goto postview_image_error;
661 bo_post = tbm_bo_alloc(muse_camera->bufmgr, data_size_post, TBM_BO_DEFAULT);
662 if (bo_post == NULL) {
663 LOGE("bo alloc failed");
664 goto postview_image_error;
667 bo_post_handle = tbm_bo_map(bo_post, TBM_DEVICE_CPU, TBM_OPTION_READ | TBM_OPTION_WRITE);
668 if (bo_post_handle.ptr == NULL) {
669 LOGE("bo map Error!");
670 goto postview_image_error;
673 buf_pos = (unsigned char *)bo_post_handle.ptr;
674 memcpy(buf_pos, postview, sizeof(camera_image_data_s));
675 buf_pos += sizeof(camera_image_data_s);
676 memcpy(buf_pos, postview->data, postview->size);
677 tbm_bo_unmap(bo_post);
679 tbm_key_post = tbm_bo_export(bo_post);
680 if (tbm_key_post == 0) {
681 LOGE("Create key_info ERROR!!");
682 goto postview_image_error;
686 export_data_post->key = tbm_key_post;
687 export_data_post->bo = bo_post;
690 /* thumbnail image */
691 if (thumbnail && thumbnail->size > 0) {
692 data_size_thumb = sizeof(camera_image_data_s) + thumbnail->size;
694 export_data_thumb = g_new0(muse_camera_export_data, 1);
695 if (export_data_thumb == NULL) {
696 LOGE("alloc export_data failed");
697 goto thumbnail_image_error;
701 bo_thumb = tbm_bo_alloc(muse_camera->bufmgr, data_size_thumb, TBM_BO_DEFAULT);
702 if (bo_thumb == NULL) {
703 LOGE("bo alloc failed");
704 goto thumbnail_image_error;
707 bo_thumb_handle = tbm_bo_map(bo_thumb, TBM_DEVICE_CPU, TBM_OPTION_READ | TBM_OPTION_WRITE);
708 if (bo_thumb_handle.ptr == NULL) {
709 LOGE("bo map Error!");
710 goto thumbnail_image_error;
713 buf_pos = (unsigned char *)bo_thumb_handle.ptr;
714 memcpy(buf_pos, thumbnail, sizeof(camera_image_data_s));
715 buf_pos += sizeof(camera_image_data_s);
716 memcpy(buf_pos, thumbnail->data, thumbnail->size);
717 tbm_bo_unmap(bo_thumb);
719 tbm_key_thumb = tbm_bo_export(bo_thumb);
720 if (tbm_key_thumb == 0) {
721 LOGE("Create key_info ERROR!!");
722 goto thumbnail_image_error;
726 export_data_thumb->key = tbm_key_thumb;
727 export_data_thumb->bo = bo_thumb;
730 /* add bo info to list */
731 g_mutex_lock(&muse_camera->list_lock);
733 muse_camera->data_list = g_list_append(muse_camera->data_list, (gpointer)export_data_main);
735 if (export_data_post)
736 muse_camera->data_list = g_list_append(muse_camera->data_list, (gpointer)export_data_post);
738 if (export_data_thumb)
739 muse_camera->data_list = g_list_append(muse_camera->data_list, (gpointer)export_data_thumb);
742 muse_camera_msg_event3(MUSE_CAMERA_CB_EVENT,
743 MUSE_CAMERA_EVENT_TYPE_CAPTURE,
744 MUSE_CAMERA_EVENT_CLASS_THREAD_SUB,
745 module, "tbm_key_main", tbm_key_main, "tbm_key_post", tbm_key_post, "tbm_key_thumb", tbm_key_thumb);
747 /* wait for capture callback return */
748 end_time = g_get_monotonic_time() + G_TIME_SPAN_SECOND * 3;
749 if (!g_cond_wait_until(&muse_camera->list_cond, &muse_camera->list_lock, end_time)) {
750 LOGW("capture callback return timeout");
752 LOGD("capture callback return");
755 g_mutex_unlock(&muse_camera->list_lock);
759 thumbnail_image_error:
761 tbm_bo_unref(bo_thumb);
765 if (export_data_thumb) {
766 g_free(export_data_thumb);
767 export_data_thumb = NULL;
770 postview_image_error:
772 tbm_bo_unref(bo_post);
776 if (export_data_post) {
777 g_free(export_data_post);
778 export_data_post = NULL;
783 tbm_bo_unref(bo_main);
787 if (export_data_main) {
788 g_free(export_data_main);
789 export_data_main = NULL;
795 void _camera_dispatcher_state_changed_cb(camera_state_e previous, camera_state_e current, bool by_policy, void *user_data)
797 muse_module_h module = (muse_module_h)user_data;
798 muse_camera_handle_s *muse_camera = NULL;
799 camera_device_e device_type = CAMERA_DEVICE_CAMERA0;
800 char value_key[KEY_LENGTH] = {'\0',};
801 int ret = CAMERA_ERROR_NONE;
804 LOGD("Enter - previous %d, current %d, by_policy %d",
805 previous, current, by_policy);
807 muse_camera_msg_event3(MUSE_CAMERA_CB_EVENT,
808 MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE,
809 MUSE_CAMERA_EVENT_CLASS_THREAD_MAIN,
810 module, "previous", previous, "current", current, "by_policy", by_policy);
812 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
814 LOGW("NULL muse camera handle");
818 ret = legacy_camera_get_device_type(muse_camera->camera_handle, &device_type);
819 if (ret != CAMERA_ERROR_NONE) {
820 LOGE("get device type failed 0x%x", ret);
824 snprintf(value_key, KEY_LENGTH, "device_state_camera%d", device_type);
825 if (previous == CAMERA_STATE_CREATED && current == CAMERA_STATE_PREVIEW)
826 set_value = CAMERA_DEVICE_STATE_WORKING;
827 else if (previous == CAMERA_STATE_PREVIEW && current == CAMERA_STATE_CREATED)
828 set_value = CAMERA_DEVICE_STATE_NULL;
830 if (set_value != -1) {
831 LOGD("device[%s] state set : %d", value_key, set_value);
832 muse_core_client_set_value(module, value_key, set_value);
838 void _camera_dispatcher_interrupted_cb(camera_policy_e policy, camera_state_e previous, camera_state_e current, void *user_data)
840 muse_module_h module = (muse_module_h)user_data;
842 LOGD("Enter - policy %d, state previous %d, current %d", policy, previous, current);
844 muse_camera_msg_event3(MUSE_CAMERA_CB_EVENT,
845 MUSE_CAMERA_EVENT_TYPE_INTERRUPTED,
846 MUSE_CAMERA_EVENT_CLASS_THREAD_MAIN,
847 module, "policy", policy, "previous", previous, "current", current);
853 void _camera_dispatcher_interrupt_started_cb(camera_policy_e policy, camera_state_e state, void *user_data)
855 muse_module_h module = (muse_module_h)user_data;
857 LOGD("Enter - policy %d, state %d", policy, state);
859 muse_camera_msg_event2(MUSE_CAMERA_CB_EVENT,
860 MUSE_CAMERA_EVENT_TYPE_INTERRUPT_STARTED,
861 MUSE_CAMERA_EVENT_CLASS_THREAD_MAIN,
862 module, "policy", policy, "state", state);
867 void _camera_dispatcher_preview_cb(MMCamcorderVideoStreamDataType *stream, void *user_data)
869 muse_camera_handle_s *muse_camera = NULL;
872 tbm_bo data_bo = NULL;
873 tbm_bo_handle bo_handle = {.ptr = NULL};
874 tbm_bo_handle data_bo_handle = {.ptr = NULL};
875 muse_camera_export_data *export_data = NULL;
879 int buffer_key[BUFFER_MAX_PLANE_NUM] = {0, };
880 int num_buffer_key = 0;
882 muse_module_h module = (muse_module_h)user_data;
883 unsigned char *buf_pos = NULL;
884 char *send_message = NULL;
888 if (module == NULL || stream == NULL) {
889 LOGE("NULL data %p, %p", module, stream);
893 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
894 if (muse_camera == NULL) {
899 export_data = g_new0(muse_camera_export_data, 1);
900 if (export_data == NULL) {
901 LOGE("alloc export_data failed");
905 data_size = sizeof(MMCamcorderVideoStreamDataType);
907 bo = tbm_bo_alloc(muse_camera->bufmgr, data_size, TBM_BO_DEFAULT);
909 LOGE("bo alloc failed");
910 goto _PREVIEW_CB_ERROR;
913 bo_handle = tbm_bo_map(bo, TBM_DEVICE_CPU, TBM_OPTION_READ | TBM_OPTION_WRITE);
914 if (bo_handle.ptr == NULL) {
915 LOGE("bo map Error!");
916 goto _PREVIEW_CB_ERROR;
919 buf_pos = (unsigned char *)bo_handle.ptr;
921 memcpy(buf_pos, stream, sizeof(MMCamcorderVideoStreamDataType));
925 if (stream->bo[0] == NULL) {
927 switch (stream->data_type) {
928 case MM_CAM_STREAM_DATA_YUV420:
929 data_size = stream->data.yuv420.length_yuv;
931 case MM_CAM_STREAM_DATA_YUV422:
932 data_size = stream->data.yuv422.length_yuv;
934 case MM_CAM_STREAM_DATA_YUV420SP:
935 data_size = stream->data.yuv420sp.length_y;
936 data_size += stream->data.yuv420sp.length_uv;
938 case MM_CAM_STREAM_DATA_YUV420P:
939 data_size = stream->data.yuv420p.length_y;
940 data_size += stream->data.yuv420p.length_u;
941 data_size += stream->data.yuv420p.length_v;
943 case MM_CAM_STREAM_DATA_YUV422P:
944 data_size = stream->data.yuv422p.length_y;
945 data_size += stream->data.yuv422p.length_u;
946 data_size += stream->data.yuv422p.length_v;
948 case MM_CAM_STREAM_DATA_ENCODED:
949 data_size = stream->data.encoded.length_data;
952 LOGW("unknown data type %d", stream->data_type);
956 data_bo = tbm_bo_alloc(muse_camera->bufmgr, data_size, TBM_BO_DEFAULT);
957 if (data_bo == NULL) {
958 LOGE("data_bo alloc failed");
959 goto _PREVIEW_CB_ERROR;
962 data_bo_handle = tbm_bo_map(data_bo, TBM_DEVICE_CPU, TBM_OPTION_READ | TBM_OPTION_WRITE);
963 if (data_bo_handle.ptr == NULL) {
964 LOGE("data_bo map Error!");
965 goto _PREVIEW_CB_ERROR;
968 buf_pos = (unsigned char *)data_bo_handle.ptr;
970 switch (stream->data_type) {
971 case MM_CAM_STREAM_DATA_YUV420:
972 memcpy(buf_pos, stream->data.yuv420.yuv, stream->data.yuv420.length_yuv);
974 case MM_CAM_STREAM_DATA_YUV422:
975 memcpy(buf_pos, stream->data.yuv422.yuv, stream->data.yuv422.length_yuv);
977 case MM_CAM_STREAM_DATA_YUV420SP:
978 memcpy(buf_pos, stream->data.yuv420sp.y, stream->data.yuv420sp.length_y);
979 memcpy(buf_pos + stream->data.yuv420sp.length_y, stream->data.yuv420sp.uv, stream->data.yuv420sp.length_uv);
981 case MM_CAM_STREAM_DATA_YUV420P:
982 memcpy(buf_pos, stream->data.yuv420p.y, stream->data.yuv420p.length_y);
983 memcpy(buf_pos + stream->data.yuv420p.length_y, stream->data.yuv420p.u, stream->data.yuv420p.length_u);
984 memcpy(buf_pos + stream->data.yuv420p.length_y + stream->data.yuv420p.length_u, stream->data.yuv420p.v, stream->data.yuv420p.length_v);
986 case MM_CAM_STREAM_DATA_YUV422P:
987 memcpy(buf_pos, stream->data.yuv422p.y, stream->data.yuv422p.length_y);
988 memcpy(buf_pos + stream->data.yuv422p.length_y, stream->data.yuv422p.u, stream->data.yuv422p.length_u);
989 memcpy(buf_pos + stream->data.yuv422p.length_y + stream->data.yuv422p.length_u, stream->data.yuv422p.v, stream->data.yuv422p.length_v);
991 case MM_CAM_STREAM_DATA_ENCODED:
992 memcpy(buf_pos, stream->data.encoded.data, stream->data.encoded.length_data);
998 tbm_bo_unmap(data_bo);
1001 for (i = 0 ; i < BUFFER_MAX_PLANE_NUM ; i++) {
1002 if (stream->bo[i]) {
1003 buffer_key[i] = tbm_bo_export(stream->bo[i]);
1004 if (buffer_key[i] == 0) {
1005 LOGE("failed to export bo %p", stream->bo[i]);
1006 goto _PREVIEW_CB_ERROR;
1010 /*LOGD("num_buffer_key %d", num_buffer_key);*/
1016 tbm_key = tbm_bo_export(bo);
1018 LOGE("Create key_info ERROR!!");
1019 goto _PREVIEW_CB_ERROR;
1023 LOGD("bo %p, vaddr %p, size %d, key %d",
1024 bo, bo_handle.ptr, data_size, tbm_key);
1028 export_data->key = tbm_key;
1029 export_data->bo = bo;
1030 if (stream->internal_buffer) {
1031 export_data->internal_buffer = stream->internal_buffer;
1032 gst_buffer_ref((GstBuffer *)export_data->internal_buffer);
1035 export_data->data_bo = data_bo;
1036 data_key = tbm_bo_export(data_bo);
1037 if (data_key == 0) {
1038 LOGE("Create key_info for data_bo ERROR!!");
1039 goto _PREVIEW_CB_ERROR;
1043 /* add bo info to list */
1044 g_mutex_lock(&muse_camera->list_lock);
1046 muse_camera->data_list = g_list_append(muse_camera->data_list, (gpointer)export_data);
1048 if (muse_camera->is_shutting_down) {
1049 LOGW("now shutting down.. skip this buffer");
1050 g_mutex_unlock(&muse_camera->list_lock);
1051 _camera_remove_export_data(module, tbm_key, FALSE);
1055 g_mutex_unlock(&muse_camera->list_lock);
1057 g_mutex_lock(&muse_camera->preview_cb_lock);
1060 send_message = muse_core_msg_json_factory_new(MUSE_CAMERA_CB_EVENT,
1061 MUSE_TYPE_INT, PARAM_EVENT, MUSE_CAMERA_EVENT_TYPE_PREVIEW,
1062 MUSE_TYPE_INT, PARAM_EVENT_CLASS, MUSE_CAMERA_EVENT_CLASS_THREAD_SUB,
1063 MUSE_TYPE_INT, "tbm_key", tbm_key,
1064 MUSE_TYPE_INT, "num_buffer_key", num_buffer_key,
1065 MUSE_TYPE_INT, "data_key", data_key,
1066 MUSE_TYPE_ARRAY, "buffer_key", BUFFER_MAX_PLANE_NUM, buffer_key,
1069 send_ret = muse_core_ipc_send_msg(muse_core_client_get_msg_fd(module), send_message);
1071 muse_core_msg_json_factory_free(send_message);
1073 /*LOGD("wait preview callback return message");*/
1075 if (!CHECK_PREVIEW_CB(muse_camera, PREVIEW_CB_TYPE_EVAS) && send_ret > 0) {
1076 gint64 end_time = g_get_monotonic_time() + G_TIME_SPAN_SECOND;
1078 if (!g_cond_wait_until(&muse_camera->preview_cb_cond, &muse_camera->preview_cb_lock, end_time)) {
1079 LOGW("preview callback return message timeout");
1081 /*LOGD("preview callback return message received");*/
1085 g_mutex_unlock(&muse_camera->preview_cb_lock);
1095 tbm_bo_unref(data_bo);
1099 g_free(export_data);
1106 void _camera_dispatcher_capture_completed_cb(void *user_data)
1108 muse_module_h module = (muse_module_h)user_data;
1112 muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT,
1113 MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE,
1114 MUSE_CAMERA_EVENT_CLASS_THREAD_MAIN,
1120 void _camera_dispatcher_face_detected_cb(camera_detected_face_s *faces, int count, void *user_data)
1122 muse_module_h module = (muse_module_h)user_data;
1123 muse_camera_handle_s *muse_camera = NULL;
1125 tbm_bo_handle bo_handle = {NULL, };
1126 int bo_size = sizeof(camera_detected_face_s) * count;
1128 muse_camera_export_data *export_data = NULL;
1131 if (module == NULL) {
1132 LOGE("NULL module");
1137 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1138 if (muse_camera == NULL) {
1139 LOGE("NULL handle");
1143 export_data = g_new0(muse_camera_export_data, 1);
1144 if (export_data == NULL) {
1145 LOGE("alloc export_data failed");
1149 bo = tbm_bo_alloc(muse_camera->bufmgr, bo_size, TBM_BO_DEFAULT);
1151 LOGE("tbm_bo_alloc failed");
1153 g_free(export_data);
1159 bo_handle = tbm_bo_map(bo, TBM_DEVICE_CPU, TBM_OPTION_READ | TBM_OPTION_WRITE);
1160 if (bo_handle.ptr == NULL) {
1161 LOGE("bo map Error!");
1166 g_free(export_data);
1172 /* copy face detection info */
1173 memcpy(bo_handle.ptr, faces, bo_size);
1178 tbm_key = tbm_bo_export(bo);
1180 LOGE("failed to export bo for face detection info");
1185 g_free(export_data);
1191 /* set export data */
1192 export_data->bo = bo;
1193 export_data->key = tbm_key;
1195 /* add bo info to list */
1196 g_mutex_lock(&muse_camera->list_lock);
1197 muse_camera->data_list = g_list_append(muse_camera->data_list, (gpointer)export_data);
1198 g_mutex_unlock(&muse_camera->list_lock);
1201 LOGD("face - count %d, buffer size %d, key %d", count, bo_size, tbm_key);
1204 muse_camera_msg_event2(MUSE_CAMERA_CB_EVENT,
1205 MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION,
1206 MUSE_CAMERA_EVENT_CLASS_THREAD_MAIN,
1207 module, "count", count, "tbm_key", tbm_key);
1209 LOGW("invalid count for face detection - %d", count);
1215 void _camera_dispatcher_focus_changed_cb(camera_focus_state_e state, void *user_data)
1217 muse_module_h module = (muse_module_h)user_data;
1219 LOGD("Enter - state %d", state);
1221 muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT,
1222 MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE,
1223 MUSE_CAMERA_EVENT_CLASS_THREAD_MAIN,
1224 module, "state", state);
1229 void _camera_dispatcher_error_cb(camera_error_e error, camera_state_e current_state, void *user_data)
1231 muse_module_h module = (muse_module_h)user_data;
1233 LOGD("Enter - error 0x%x, current_state %d", error, current_state);
1235 muse_camera_msg_event2(MUSE_CAMERA_CB_EVENT,
1236 MUSE_CAMERA_EVENT_TYPE_ERROR,
1237 MUSE_CAMERA_EVENT_CLASS_THREAD_MAIN,
1238 module, "error", error, "current_state", current_state);
1243 void _camera_dispatcher_hdr_progress_cb(int percent, void *user_data)
1245 muse_module_h module = (muse_module_h)user_data;
1249 muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT,
1250 MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS,
1251 MUSE_CAMERA_EVENT_CLASS_THREAD_MAIN,
1252 module, "percent", percent);
1258 static void _camera_task_add_job(muse_camera_handle_s *muse_camera, int api, int class, int value)
1260 muse_camera_task_job_s *job = NULL;
1263 LOGE("NULL handle");
1267 job = g_new0(muse_camera_task_job_s, 1);
1269 LOGE("job alloc failed");
1270 muse_camera_msg_return(api, class, CAMERA_ERROR_INVALID_OPERATION, muse_camera->module);
1278 LOGD("push job - api %d", api);
1280 g_mutex_lock(&muse_camera->task_lock);
1281 g_queue_push_tail(&muse_camera->task_queue, (gpointer)job);
1282 g_cond_signal(&muse_camera->task_cond);
1283 g_mutex_unlock(&muse_camera->task_lock);
1289 static void __camera_task_process_job(muse_camera_handle_s *muse_camera, muse_camera_task_job_s *job)
1291 int ret = CAMERA_ERROR_NONE;
1294 LOGE("NULL handle");
1298 LOGD("job start - api %d, value 0x%x", job->api, job->value);
1301 case MUSE_CAMERA_API_STOP_PREVIEW:
1302 ret = legacy_camera_stop_preview(muse_camera->camera_handle);
1304 case MUSE_CAMERA_API_START_CAPTURE:
1305 ret = legacy_camera_start_capture(muse_camera->camera_handle,
1306 (camera_capturing_cb)_camera_dispatcher_capturing_cb,
1307 (camera_capture_completed_cb)_camera_dispatcher_capture_completed_cb,
1308 (void *)muse_camera->module);
1310 case MUSE_CAMERA_API_SET_PREVIEW_RESOLUTION:
1311 ret = legacy_camera_set_preview_resolution(muse_camera->camera_handle, \
1312 job->value >> 16, 0x0000ffff & job->value);
1314 case MUSE_CAMERA_API_SET_CAPTURE_RESOLUTION:
1315 ret = legacy_camera_set_capture_resolution(muse_camera->camera_handle, \
1316 job->value >> 16, 0x0000ffff & job->value);
1318 case MUSE_CAMERA_API_ATTR_SET_HDR_MODE:
1319 ret = legacy_camera_attr_set_hdr_mode(muse_camera->camera_handle, \
1320 (camera_attr_hdr_mode_e)job->value);
1323 LOGE("unhandled task - api %d", job->api);
1327 LOGD("job done - api %d, ret 0x%x", job->api, ret);
1329 muse_camera_msg_return(job->api, job->class, ret, muse_camera->module);
1339 static void *_camera_dispatcher_task_func(gpointer data)
1341 muse_camera_handle_s *muse_camera = (muse_camera_handle_s *)data;
1342 muse_camera_task_job_s *job = NULL;
1343 gint64 end_time = 0;
1344 bool is_signaled = false;
1345 bool use_wait_until = false;
1348 LOGE("NULL handle");
1354 g_mutex_lock(&muse_camera->task_lock);
1356 while (muse_camera->task_run) {
1357 if (g_queue_is_empty(&muse_camera->task_queue)) {
1358 LOGD("empty queue. wait signal [wait until %d]", use_wait_until);
1360 if (use_wait_until) {
1361 end_time = g_get_monotonic_time() + G_TIME_SPAN_SECOND;
1362 is_signaled = g_cond_wait_until(&muse_camera->task_cond, &muse_camera->task_lock, end_time);
1364 g_cond_wait(&muse_camera->task_cond, &muse_camera->task_lock);
1368 /*LOGD("is_signaled %d", is_signaled);*/
1371 if (!muse_camera->task_run) {
1372 LOGW("stop task thread : is_signaled %d", is_signaled);
1376 job = (muse_camera_task_job_s *)g_queue_pop_head(&muse_camera->task_queue);
1379 LOGE("signal received, but no job");
1384 if (job->api == MUSE_CAMERA_API_STOP_PREVIEW)
1385 use_wait_until = true;
1387 use_wait_until = false;
1389 g_mutex_unlock(&muse_camera->task_lock);
1391 __camera_task_process_job(muse_camera, job);
1393 g_mutex_lock(&muse_camera->task_lock);
1396 while (!g_queue_is_empty(&muse_camera->task_queue)) {
1397 job = (muse_camera_task_job_s *)g_queue_pop_head(&muse_camera->task_queue);
1399 LOGW("remained job - api %d", job->api);
1400 __camera_task_process_job(muse_camera, job);
1404 g_mutex_unlock(&muse_camera->task_lock);
1412 static void _camera_dispatcher_release_resource(muse_module_h module)
1414 muse_camera_handle_s *muse_camera = NULL;
1417 LOGE("NULL handle");
1423 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1425 _camera_remove_export_data(module, 0, TRUE);
1427 g_mutex_clear(&muse_camera->list_lock);
1428 g_cond_clear(&muse_camera->list_cond);
1429 g_mutex_clear(&muse_camera->preview_cb_lock);
1430 g_cond_clear(&muse_camera->preview_cb_cond);
1432 muse_camera->bufmgr = NULL;
1434 if (muse_camera->task_thread) {
1435 LOGW("task thread exiting start");
1437 g_mutex_lock(&muse_camera->task_lock);
1438 muse_camera->task_run = false;
1439 g_cond_signal(&muse_camera->task_cond);
1440 g_mutex_unlock(&muse_camera->task_lock);
1442 LOGW("wait task thread join");
1444 g_thread_join(muse_camera->task_thread);
1445 muse_camera->task_thread = NULL;
1447 LOGW("task thread exiting end");
1450 g_mutex_clear(&muse_camera->task_lock);
1451 g_cond_clear(&muse_camera->task_cond);
1452 g_queue_clear(&muse_camera->task_queue);
1463 int camera_dispatcher_create(muse_module_h module)
1465 int ret = CAMERA_ERROR_NONE;
1468 bool camera_feature_supported = false;
1469 void *gdbus_connection = NULL;
1470 muse_camera_handle_s *muse_camera = NULL;
1471 muse_camera_api_e api = MUSE_CAMERA_API_CREATE;
1472 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1474 muse_camera_msg_get(device_type, muse_core_client_get_msg(module));
1475 muse_camera_msg_get(pid, muse_core_client_get_msg(module));
1477 LOGD("device type : %d, client pid : %d", device_type, pid);
1480 muse_camera = (muse_camera_handle_s *)malloc(sizeof(muse_camera_handle_s));
1481 if (muse_camera == NULL) {
1482 ret = CAMERA_ERROR_OUT_OF_MEMORY;
1483 LOGE("handle alloc failed 0x%x", ret);
1484 muse_camera_msg_return(api, class, ret, module);
1485 return MUSE_CAMERA_ERROR_INVALID;
1488 memset(muse_camera, 0x0, sizeof(muse_camera_handle_s));
1490 if (muse_core_ipc_get_bufmgr(&muse_camera->bufmgr) != MM_ERROR_NONE ||
1491 muse_core_ipc_get_gdbus_connection((GDBusConnection **)&gdbus_connection) != MM_ERROR_NONE) {
1492 LOGE("tbm bufmgr or gdbus conntection failed %p %p", muse_camera->bufmgr, gdbus_connection);
1497 ret = CAMERA_ERROR_INVALID_OPERATION;
1498 muse_camera_msg_return(api, class, ret, module);
1500 return MUSE_CAMERA_ERROR_INVALID;
1503 ret = legacy_camera_create((camera_device_e)device_type, &muse_camera->camera_handle);
1504 if (ret != CAMERA_ERROR_NONE) {
1507 muse_camera_msg_return(api, class, ret, module);
1509 return MUSE_CAMERA_ERROR_INVALID;
1512 g_mutex_init(&muse_camera->task_lock);
1513 g_cond_init(&muse_camera->task_cond);
1514 g_queue_init(&muse_camera->task_queue);
1516 /* camera feature support check */
1517 if (muse_core_get_platform_info(CAMERA_FEATURE_NAME, &camera_feature_supported) != MM_ERROR_NONE)
1518 LOGE("failed to get platform info for camera support");
1520 if (!camera_feature_supported) {
1521 LOGE("CAMERA NOT SUPPORTED, BUT INI FILE FOR CMAERA IS EXISTED. RECOMMEND TO REMOVE IT.");
1522 ret = CAMERA_ERROR_NOT_SUPPORTED;
1526 muse_camera->task_run = true;
1527 muse_camera->task_thread = g_thread_try_new("camera_task_thread",
1528 _camera_dispatcher_task_func, (gpointer)muse_camera, NULL);
1529 if (!muse_camera->task_thread) {
1530 LOGE("failed to create new thread for task");
1534 ret = legacy_camera_set_state_changed_cb(muse_camera->camera_handle,
1535 (camera_state_changed_cb)_camera_dispatcher_state_changed_cb,
1537 if (ret != CAMERA_ERROR_NONE) {
1538 LOGE("legacy_camera_set_state_changed_cb failed : 0x%x", ret);
1542 ret = legacy_camera_set_client_pid(muse_camera->camera_handle, pid);
1543 if (ret != CAMERA_ERROR_NONE) {
1544 LOGE("legacy_camera_set_client_pid failed : 0x%x", ret);
1548 ret = legacy_camera_set_gdbus_connection(muse_camera->camera_handle, gdbus_connection);
1549 if (ret != CAMERA_ERROR_NONE) {
1550 LOGE("legacy_camera_set_gdbus_connection failed : 0x%x", ret);
1554 g_mutex_init(&muse_camera->list_lock);
1555 g_cond_init(&muse_camera->list_cond);
1556 g_mutex_init(&muse_camera->preview_cb_lock);
1557 g_cond_init(&muse_camera->preview_cb_cond);
1558 muse_camera->preview_cb_flag = 0;
1559 muse_camera->module = module;
1561 LOGD("handle : 0x%x", muse_camera);
1563 muse_core_ipc_set_handle(module, (intptr_t)muse_camera);
1564 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_POINTER, -1, "handle", 0, muse_camera);
1566 return MUSE_CAMERA_ERROR_NONE;
1569 if (muse_camera->task_thread) {
1570 g_mutex_lock(&muse_camera->task_lock);
1571 muse_camera->task_run = false;
1572 g_cond_signal(&muse_camera->task_cond);
1573 g_mutex_unlock(&muse_camera->task_lock);
1575 LOGE("task thread join");
1577 g_thread_join(muse_camera->task_thread);
1578 muse_camera->task_thread = NULL;
1581 g_mutex_clear(&muse_camera->task_lock);
1582 g_cond_clear(&muse_camera->task_cond);
1583 g_queue_clear(&muse_camera->task_queue);
1585 legacy_camera_destroy(muse_camera->camera_handle);
1586 muse_camera->camera_handle = NULL;
1590 muse_camera_msg_return(api, class, ret, module);
1592 return MUSE_CAMERA_ERROR_INVALID;
1596 int camera_dispatcher_change_device(muse_module_h module)
1598 int ret = CAMERA_ERROR_NONE;
1599 int device = CAMERA_DEVICE_CAMERA0;
1600 muse_camera_handle_s *muse_camera = NULL;
1601 muse_camera_api_e api = MUSE_CAMERA_API_CHANGE_DEVICE;
1602 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1604 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1606 muse_camera_msg_get(device, muse_core_client_get_msg(module));
1608 LOGD("change device to %d", device);
1610 ret = legacy_camera_change_device(&muse_camera->camera_handle, device,
1611 CHECK_PREVIEW_CB(muse_camera, PREVIEW_CB_TYPE_EVAS));
1613 muse_camera_msg_return(api, class, ret, module);
1615 return MUSE_CAMERA_ERROR_NONE;
1619 int camera_dispatcher_destroy(muse_module_h module)
1621 int ret = CAMERA_ERROR_NONE;
1622 muse_camera_handle_s *muse_camera = NULL;
1623 muse_camera_api_e api = MUSE_CAMERA_API_DESTROY;
1624 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1626 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1628 LOGD("Enter, handle : %p", muse_camera);
1630 ret = legacy_camera_destroy(muse_camera->camera_handle);
1631 if (ret == CAMERA_ERROR_NONE)
1632 _camera_dispatcher_release_resource(module);
1634 muse_camera_msg_return(api, class, ret, module);
1636 if (ret == CAMERA_ERROR_NONE)
1637 return MUSE_CAMERA_ERROR_NONE;
1639 return MUSE_CAMERA_ERROR_INVALID;
1642 int camera_dispatcher_start_preview(muse_module_h module)
1644 int ret = CAMERA_ERROR_NONE;
1646 muse_camera_handle_s *muse_camera = NULL;
1647 muse_camera_api_e api = MUSE_CAMERA_API_START_PREVIEW;
1648 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1650 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1652 LOGD("handle : %p", muse_camera);
1654 /* privilege check */
1655 client_fd = muse_core_client_get_msg_fd(module);
1656 if (!muse_core_security_check_cynara(client_fd, CAMERA_PRIVILEGE_NAME)) {
1657 ret = CAMERA_ERROR_PERMISSION_DENIED;
1658 LOGE("security check failed 0x%x", ret);
1659 muse_camera_msg_return(api, class, ret, module);
1660 return MUSE_CAMERA_ERROR_INVALID;
1663 ret = legacy_camera_start_preview(muse_camera->camera_handle);
1665 muse_camera_msg_return(api, class, ret, module);
1667 return MUSE_CAMERA_ERROR_NONE;
1670 int camera_dispatcher_stop_preview(muse_module_h module)
1672 muse_camera_handle_s *muse_camera = NULL;
1674 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1676 LOGD("handle : %p", muse_camera);
1678 _camera_task_add_job(muse_camera, MUSE_CAMERA_API_STOP_PREVIEW,
1679 MUSE_CAMERA_API_CLASS_IMMEDIATE, 0);
1681 return MUSE_CAMERA_ERROR_NONE;
1684 int camera_dispatcher_start_capture(muse_module_h module)
1686 muse_camera_handle_s *muse_camera = NULL;
1688 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1690 LOGD("handle : %p", muse_camera);
1692 _camera_task_add_job(muse_camera, MUSE_CAMERA_API_START_CAPTURE,
1693 MUSE_CAMERA_API_CLASS_IMMEDIATE, 0);
1695 return MUSE_CAMERA_ERROR_NONE;
1698 int camera_dispatcher_is_supported_continuous_capture(muse_module_h module)
1700 int ret = CAMERA_ERROR_NONE;
1701 muse_camera_handle_s *muse_camera = NULL;
1702 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_CONTINUOUS_CAPTURE;
1703 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1705 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1707 LOGD("handle : %p", muse_camera);
1709 ret = legacy_camera_is_supported_continuous_capture(muse_camera->camera_handle);
1711 LOGD("is supported ret : %d", ret);
1713 muse_camera_msg_return(api, class, ret, module);
1715 return MUSE_CAMERA_ERROR_NONE;
1718 int camera_dispatcher_start_continuous_capture(muse_module_h module)
1720 int ret = CAMERA_ERROR_NONE;
1721 muse_camera_handle_s *muse_camera = NULL;
1725 muse_camera_api_e api = MUSE_CAMERA_API_START_CONTINUOUS_CAPTURE;
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 muse_camera_msg_get(value, muse_core_client_get_msg(module));
1732 count = value >> 16;
1733 interval = 0x0000ffff & value;
1735 LOGD("Enter - count %d, interval %d", count, interval);
1737 ret = legacy_camera_start_continuous_capture(muse_camera->camera_handle,
1740 (camera_capturing_cb)_camera_dispatcher_capturing_cb,
1741 (camera_capture_completed_cb)_camera_dispatcher_capture_completed_cb,
1744 muse_camera_msg_return(api, class, ret, module);
1746 return MUSE_CAMERA_ERROR_NONE;
1749 int camera_dispatcher_stop_continuous_capture(muse_module_h module)
1751 int ret = CAMERA_ERROR_NONE;
1752 muse_camera_handle_s *muse_camera = NULL;
1753 muse_camera_api_e api = MUSE_CAMERA_API_STOP_CONTINUOUS_CAPTURE;
1754 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1756 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1758 LOGD("handle : %p", muse_camera);
1760 ret = legacy_camera_stop_continuous_capture(muse_camera->camera_handle);
1762 muse_camera_msg_return(api, class, ret, module);
1764 return MUSE_CAMERA_ERROR_NONE;
1767 int camera_dispatcher_is_supported_face_detection(muse_module_h module)
1769 int ret = CAMERA_ERROR_NONE;
1770 muse_camera_handle_s *muse_camera = NULL;
1771 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_FACE_DETECTION;
1772 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1774 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1776 LOGD("handle : %p", muse_camera);
1778 ret = legacy_camera_is_supported_face_detection(muse_camera->camera_handle);
1780 LOGD("is supported ret : %d", ret);
1782 muse_camera_msg_return(api, class, ret, module);
1784 return MUSE_CAMERA_ERROR_NONE;
1787 int camera_dispatcher_is_supported_zero_shutter_lag(muse_module_h module)
1789 int ret = CAMERA_ERROR_NONE;
1790 muse_camera_handle_s *muse_camera = NULL;
1791 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_ZERO_SHUTTER_LAG;
1792 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1794 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1796 LOGD("handle : %p", muse_camera);
1798 ret = legacy_camera_is_supported_zero_shutter_lag(muse_camera->camera_handle);
1800 LOGD("is supported ret : %d", ret);
1802 muse_camera_msg_return(api, class, ret, module);
1804 return MUSE_CAMERA_ERROR_NONE;
1807 int camera_dispatcher_is_supported_media_packet_preview_cb(muse_module_h module)
1809 int ret = CAMERA_ERROR_NONE;
1810 muse_camera_handle_s *muse_camera = NULL;
1811 muse_camera_api_e api = MUSE_CAMERA_API_SUPPORT_MEDIA_PACKET_PREVIEW_CB;
1812 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1814 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1816 LOGD("handle : %p", muse_camera);
1818 ret = legacy_camera_is_supported_media_packet_preview_cb(muse_camera->camera_handle);
1820 LOGD("is supported ret : %d", ret);
1822 muse_camera_msg_return(api, class, ret, module);
1824 return MUSE_CAMERA_ERROR_NONE;
1827 int camera_dispatcher_get_device_count(muse_module_h module)
1829 int ret = CAMERA_ERROR_NONE;
1830 muse_camera_handle_s *muse_camera = NULL;
1832 muse_camera_api_e api = MUSE_CAMERA_API_GET_DEVICE_COUNT;
1833 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1835 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1837 LOGD("handle : %p", muse_camera);
1839 ret = legacy_camera_get_device_count(muse_camera->camera_handle, &get_value);
1840 if (ret == CAMERA_ERROR_NONE) {
1841 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
1842 MUSE_CAMERA_GET_INT_DEVICE_COUNT, "get_value", get_value, NULL);
1844 muse_camera_msg_return(api, class, ret, module);
1847 return MUSE_CAMERA_ERROR_NONE;
1850 int camera_dispatcher_start_face_detection(muse_module_h module)
1852 int ret = CAMERA_ERROR_NONE;
1853 muse_camera_handle_s *muse_camera = NULL;
1854 muse_camera_api_e api = MUSE_CAMERA_API_START_FACE_DETECTION;
1855 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1857 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1859 LOGD("Enter, handle : 0x%x, module : %d", muse_camera, module);
1861 ret = legacy_camera_start_face_detection(muse_camera->camera_handle,
1862 (camera_face_detected_cb)_camera_dispatcher_face_detected_cb,
1865 muse_camera_msg_return(api, class, ret, module);
1867 return MUSE_CAMERA_ERROR_NONE;
1870 int camera_dispatcher_stop_face_detection(muse_module_h module)
1872 int ret = CAMERA_ERROR_NONE;
1873 muse_camera_handle_s *muse_camera = NULL;
1874 muse_camera_api_e api = MUSE_CAMERA_API_STOP_FACE_DETECTION;
1875 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1877 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1879 LOGD("handle : %p", muse_camera);
1881 ret = legacy_camera_stop_face_detection(muse_camera->camera_handle);
1883 muse_camera_msg_return(api, class, ret, module);
1885 return MUSE_CAMERA_ERROR_NONE;
1888 int camera_dispatcher_get_state(muse_module_h module)
1890 int ret = CAMERA_ERROR_NONE;
1891 muse_camera_handle_s *muse_camera = NULL;
1892 camera_state_e get_value = CAMERA_STATE_NONE;
1893 muse_camera_api_e api = MUSE_CAMERA_API_GET_STATE;
1894 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1896 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1898 LOGD("handle : %p", muse_camera);
1900 ret = legacy_camera_get_state(muse_camera->camera_handle, &get_value);
1901 if (ret == CAMERA_ERROR_NONE) {
1902 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
1903 MUSE_CAMERA_GET_INT_STATE, "get_value", get_value, NULL);
1905 muse_camera_msg_return(api, class, ret, module);
1908 return MUSE_CAMERA_ERROR_NONE;
1911 int camera_dispatcher_start_focusing(muse_module_h module)
1913 int ret = CAMERA_ERROR_NONE;
1914 muse_camera_handle_s *muse_camera = NULL;
1916 muse_camera_api_e api = MUSE_CAMERA_API_START_FOCUSING;
1917 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1919 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1921 muse_camera_msg_get(is_continuous, muse_core_client_get_msg(module));
1923 LOGD("Enter, handle : 0x%x, module : %d", muse_camera, module);
1925 ret = legacy_camera_start_focusing(muse_camera->camera_handle, (bool)is_continuous);
1927 muse_camera_msg_return(api, class, ret, module);
1929 return MUSE_CAMERA_ERROR_NONE;
1932 int camera_dispatcher_stop_focusing(muse_module_h module)
1934 int ret = CAMERA_ERROR_NONE;
1935 muse_camera_handle_s *muse_camera = NULL;
1936 muse_camera_api_e api = MUSE_CAMERA_API_CANCEL_FOCUSING;
1937 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1939 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1941 LOGD("handle : %p", muse_camera);
1943 ret = legacy_camera_cancel_focusing(muse_camera->camera_handle);
1945 muse_camera_msg_return(api, class, ret, module);
1947 return MUSE_CAMERA_ERROR_NONE;
1950 int camera_dispatcher_set_display(muse_module_h module)
1952 int ret = CAMERA_ERROR_NONE;
1953 muse_camera_handle_s *muse_camera = NULL;
1954 muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY;
1955 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
1956 MMCamWaylandInfo *wl_info = NULL;
1957 camera_display_type_e type = CAMERA_DISPLAY_TYPE_NONE;
1958 camera_h camera = NULL;;
1960 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
1962 LOGD("handle : 0x%x", muse_camera);
1964 camera = muse_camera->camera_handle;
1966 muse_camera_msg_get(type, muse_core_client_get_msg(module));
1968 LOGD("type %d", type);
1970 if (type == CAMERA_DISPLAY_TYPE_OVERLAY) {
1971 wl_info = &muse_camera->wl_info;
1972 muse_camera_msg_get_array(wl_info, muse_core_client_get_msg(module));
1974 LOGD("wayland global surface id : %d, window : %d,%d,%dx%d",
1975 wl_info->global_surface_id, wl_info->window_x, wl_info->window_y,
1976 wl_info->window_width, wl_info->window_height);
1978 ret = legacy_camera_set_display(muse_camera->camera_handle, type, (void *)wl_info);
1980 muse_camera_msg_return(api, class, ret, module);
1982 LOGD("NOT overlay type. set NONE type.");
1984 if (type == CAMERA_DISPLAY_TYPE_EVAS) {
1985 ret = legacy_camera_set_preview_cb(muse_camera->camera_handle,
1986 (camera_preview_cb)_camera_dispatcher_preview_cb,
1989 if (ret == CAMERA_ERROR_NONE)
1990 SET_PREVIEW_CB_TYPE(muse_camera, PREVIEW_CB_TYPE_EVAS);
1993 ret = legacy_camera_set_display(muse_camera->camera_handle, CAMERA_DISPLAY_TYPE_NONE, NULL);
1995 muse_camera_msg_return(api, class, ret, module);
1998 return MUSE_CAMERA_ERROR_NONE;
2001 int camera_dispatcher_set_preview_resolution(muse_module_h module)
2004 muse_camera_handle_s *muse_camera = NULL;
2006 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2008 muse_camera_msg_get(value, muse_core_client_get_msg(module));
2010 _camera_task_add_job(muse_camera, MUSE_CAMERA_API_SET_PREVIEW_RESOLUTION,
2011 MUSE_CAMERA_API_CLASS_IMMEDIATE, value);
2013 return MUSE_CAMERA_ERROR_NONE;
2016 int camera_dispatcher_set_capture_resolution(muse_module_h module)
2019 muse_camera_handle_s *muse_camera = NULL;
2021 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2023 muse_camera_msg_get(value, muse_core_client_get_msg(module));
2025 _camera_task_add_job(muse_camera, MUSE_CAMERA_API_SET_CAPTURE_RESOLUTION,
2026 MUSE_CAMERA_API_CLASS_IMMEDIATE, value);
2028 return MUSE_CAMERA_ERROR_NONE;
2031 int camera_dispatcher_set_capture_format(muse_module_h module)
2033 int ret = CAMERA_ERROR_NONE;
2034 muse_camera_handle_s *muse_camera = NULL;
2036 muse_camera_api_e api = MUSE_CAMERA_API_SET_CAPTURE_FORMAT;
2037 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2039 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2041 muse_camera_msg_get(set_format, muse_core_client_get_msg(module));
2043 LOGD("handle : 0x%x, set_format : %d", muse_camera, set_format);
2045 ret = legacy_camera_set_capture_format(muse_camera->camera_handle, (camera_pixel_format_e)set_format);
2047 muse_camera_msg_return(api, class, ret, module);
2049 return MUSE_CAMERA_ERROR_NONE;
2052 int camera_dispatcher_set_preview_format(muse_module_h module)
2054 int ret = CAMERA_ERROR_NONE;
2055 muse_camera_handle_s *muse_camera = NULL;
2057 muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_FORMAT;
2058 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2060 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2062 muse_camera_msg_get(set_format, muse_core_client_get_msg(module));
2064 LOGD("handle : 0x%x, set_format : %d", muse_camera, set_format);
2066 ret = legacy_camera_set_preview_format(muse_camera->camera_handle, (camera_pixel_format_e)set_format);
2068 muse_camera_msg_return(api, class, ret, module);
2070 return MUSE_CAMERA_ERROR_NONE;
2073 int camera_dispatcher_get_preview_resolution(muse_module_h module)
2075 int ret = CAMERA_ERROR_NONE;
2076 muse_camera_handle_s *muse_camera = NULL;
2080 muse_camera_api_e api = MUSE_CAMERA_API_GET_PREVIEW_RESOLUTION;
2081 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2083 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2085 LOGD("handle : %p", muse_camera);
2087 ret = legacy_camera_get_preview_resolution(muse_camera->camera_handle, &get_width, &get_height);
2088 if (ret == CAMERA_ERROR_NONE) {
2089 get_value = get_width << 16 | get_height;
2090 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
2091 MUSE_CAMERA_GET_INT_PREVIEW_RESOLUTION, "get_value", get_value, NULL);
2093 muse_camera_msg_return(api, class, ret, module);
2096 return MUSE_CAMERA_ERROR_NONE;
2099 int camera_dispatcher_set_display_rotation(muse_module_h module)
2101 int ret = CAMERA_ERROR_NONE;
2102 muse_camera_handle_s *muse_camera = NULL;
2104 muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY_ROTATION;
2105 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2107 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2109 muse_camera_msg_get(set_rotation, muse_core_client_get_msg(module));
2111 LOGD("handle : 0x%x, set_rotation : %d", muse_camera, set_rotation);
2113 ret = legacy_camera_set_display_rotation(muse_camera->camera_handle, (camera_rotation_e)set_rotation);
2115 muse_camera_msg_return(api, class, ret, module);
2117 return MUSE_CAMERA_ERROR_NONE;
2120 int camera_dispatcher_get_display_rotation(muse_module_h module)
2122 int ret = CAMERA_ERROR_NONE;
2123 muse_camera_handle_s *muse_camera = NULL;
2124 camera_rotation_e get_value = CAMERA_ROTATION_NONE;
2125 muse_camera_api_e api = MUSE_CAMERA_API_GET_DISPLAY_ROTATION;
2126 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2128 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2130 LOGD("handle : %p", muse_camera);
2132 ret = legacy_camera_get_display_rotation(muse_camera->camera_handle, &get_value);
2133 if (ret == CAMERA_ERROR_NONE) {
2134 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
2135 MUSE_CAMERA_GET_INT_DISPLAY_ROTATION, "get_value", get_value, NULL);
2137 muse_camera_msg_return(api, class, ret, module);
2140 return MUSE_CAMERA_ERROR_NONE;
2143 int camera_dispatcher_set_display_flip(muse_module_h module)
2145 int ret = CAMERA_ERROR_NONE;
2146 muse_camera_handle_s *muse_camera = NULL;
2148 muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY_FLIP;
2149 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2151 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2153 muse_camera_msg_get(set_flip, muse_core_client_get_msg(module));
2155 LOGD("handle : 0x%x, set_flip : %d", muse_camera, set_flip);
2157 ret = legacy_camera_set_display_flip(muse_camera->camera_handle, (camera_flip_e)set_flip);
2159 muse_camera_msg_return(api, class, ret, module);
2161 return MUSE_CAMERA_ERROR_NONE;
2164 int camera_dispatcher_get_display_flip(muse_module_h module)
2166 int ret = CAMERA_ERROR_NONE;
2167 muse_camera_handle_s *muse_camera = NULL;
2168 camera_flip_e get_value = CAMERA_FLIP_NONE;
2169 muse_camera_api_e api = MUSE_CAMERA_API_GET_DISPLAY_FLIP;
2170 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2172 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2174 LOGD("handle : %p", muse_camera);
2176 ret = legacy_camera_get_display_flip(muse_camera->camera_handle, &get_value);
2177 if (ret == CAMERA_ERROR_NONE) {
2178 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
2179 MUSE_CAMERA_GET_INT_DISPLAY_FLIP, "get_value", get_value, NULL);
2181 muse_camera_msg_return(api, class, ret, module);
2184 return MUSE_CAMERA_ERROR_NONE;
2187 int camera_dispatcher_set_display_visible(muse_module_h module)
2189 int ret = CAMERA_ERROR_NONE;
2190 muse_camera_handle_s *muse_camera = NULL;
2192 muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY_VISIBLE;
2193 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2195 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2197 muse_camera_msg_get(set_visible, muse_core_client_get_msg(module));
2199 LOGD("handle : 0x%x, set_visible : %d", muse_camera, set_visible);
2201 ret = legacy_camera_set_display_visible(muse_camera->camera_handle, (bool)set_visible);
2203 muse_camera_msg_return(api, class, ret, module);
2205 return MUSE_CAMERA_ERROR_NONE;
2208 int camera_dispatcher_is_display_visible(muse_module_h module)
2210 int ret = CAMERA_ERROR_NONE;
2211 muse_camera_handle_s *muse_camera = NULL;
2212 bool get_value = true;
2213 muse_camera_api_e api = MUSE_CAMERA_API_IS_DISPLAY_VISIBLE;
2214 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2216 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2218 LOGD("handle : %p", muse_camera);
2220 ret = legacy_camera_is_display_visible(muse_camera->camera_handle, &get_value);
2221 if (ret == CAMERA_ERROR_NONE) {
2222 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
2223 MUSE_CAMERA_GET_INT_DISPLAY_VISIBLE, "get_value", get_value, NULL);
2225 muse_camera_msg_return(api, class, ret, module);
2228 return MUSE_CAMERA_ERROR_NONE;
2231 int camera_dispatcher_set_display_mode(muse_module_h module)
2233 int ret = CAMERA_ERROR_NONE;
2234 muse_camera_handle_s *muse_camera = NULL;
2236 muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY_MODE;
2237 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2239 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2241 muse_camera_msg_get(set_mode, muse_core_client_get_msg(module));
2243 LOGD("handle : 0x%x, display_mode : %d", muse_camera, set_mode);
2245 ret = legacy_camera_set_display_mode(muse_camera->camera_handle, (camera_display_mode_e)set_mode);
2247 LOGD("ret : 0x%x", ret);
2249 muse_camera_msg_return(api, class, ret, module);
2251 return MUSE_CAMERA_ERROR_NONE;
2254 int camera_dispatcher_get_display_mode(muse_module_h module)
2256 int ret = CAMERA_ERROR_NONE;
2257 muse_camera_handle_s *muse_camera = NULL;
2258 camera_display_mode_e get_value = CAMERA_DISPLAY_MODE_LETTER_BOX;
2259 muse_camera_api_e api = MUSE_CAMERA_API_GET_DISPLAY_MODE;
2260 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2262 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2264 LOGD("handle : %p", muse_camera);
2266 ret = legacy_camera_get_display_mode(muse_camera->camera_handle, &get_value);
2267 if (ret == CAMERA_ERROR_NONE) {
2268 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
2269 MUSE_CAMERA_GET_INT_DISPLAY_MODE, "get_value", get_value, NULL);
2271 muse_camera_msg_return(api, class, ret, module);
2274 return MUSE_CAMERA_ERROR_NONE;
2277 int camera_dispatcher_get_capture_resolution(muse_module_h module)
2279 int ret = CAMERA_ERROR_NONE;
2280 muse_camera_handle_s *muse_camera = NULL;
2284 muse_camera_api_e api = MUSE_CAMERA_API_GET_CAPTURE_RESOLUTION;
2285 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2287 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2289 LOGD("handle : %p", muse_camera);
2291 ret = legacy_camera_get_capture_resolution(muse_camera->camera_handle, &get_width, &get_height);
2292 if (ret == CAMERA_ERROR_NONE) {
2293 get_value = get_width << 16 | get_height;
2294 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
2295 MUSE_CAMERA_GET_INT_CAPTURE_RESOLUTION, "get_value", get_value, NULL);
2297 muse_camera_msg_return(api, class, ret, module);
2300 return MUSE_CAMERA_ERROR_NONE;
2303 int camera_dispatcher_get_capture_format(muse_module_h module)
2305 int ret = CAMERA_ERROR_NONE;
2306 muse_camera_handle_s *muse_camera = NULL;
2307 camera_pixel_format_e get_value = CAMERA_PIXEL_FORMAT_NV12;
2308 muse_camera_api_e api = MUSE_CAMERA_API_GET_CAPTURE_FORMAT;
2309 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2311 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2313 LOGD("handle : %p", muse_camera);
2315 ret = legacy_camera_get_capture_format(muse_camera->camera_handle, &get_value);
2316 if (ret == CAMERA_ERROR_NONE) {
2317 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
2318 MUSE_CAMERA_GET_INT_CAPTURE_FORMAT, "get_value", get_value, NULL);
2320 muse_camera_msg_return(api, class, ret, module);
2323 return MUSE_CAMERA_ERROR_NONE;
2326 int camera_dispatcher_get_preview_format(muse_module_h module)
2328 int ret = CAMERA_ERROR_NONE;
2329 muse_camera_handle_s *muse_camera = NULL;
2330 camera_pixel_format_e get_value = CAMERA_PIXEL_FORMAT_NV12;
2331 muse_camera_api_e api = MUSE_CAMERA_API_GET_PREVIEW_FORMAT;
2332 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2334 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2336 LOGD("handle : %p", muse_camera);
2338 ret = legacy_camera_get_preview_format(muse_camera->camera_handle, &get_value);
2339 if (ret == CAMERA_ERROR_NONE) {
2340 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
2341 MUSE_CAMERA_GET_INT_PREVIEW_FORMAT, "get_value", get_value, NULL);
2343 muse_camera_msg_return(api, class, ret, module);
2346 return MUSE_CAMERA_ERROR_NONE;
2349 int camera_dispatcher_get_facing_direction(muse_module_h module)
2351 int ret = CAMERA_ERROR_NONE;
2352 muse_camera_handle_s *muse_camera = NULL;
2353 camera_facing_direction_e get_value = CAMERA_FACING_DIRECTION_REAR;
2354 muse_camera_api_e api = MUSE_CAMERA_API_GET_FACING_DIRECTION;
2355 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2357 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2359 LOGD("handle : %p", muse_camera);
2361 ret = legacy_camera_get_facing_direction(muse_camera->camera_handle, &get_value);
2362 if (ret == CAMERA_ERROR_NONE) {
2363 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
2364 MUSE_CAMERA_GET_INT_FACING_DIRECTION, "get_value", get_value, NULL);
2366 muse_camera_msg_return(api, class, ret, module);
2369 return MUSE_CAMERA_ERROR_NONE;
2372 int camera_dispatcher_get_flash_state(muse_module_h module)
2374 int ret = CAMERA_ERROR_NONE;
2376 int is_called = false;
2377 char value_key[KEY_LENGTH] = {'\0',};
2378 camera_h camera = NULL;
2379 camera_device_e device_type = CAMERA_DEVICE_CAMERA0;
2380 camera_flash_state_e get_flash_state = CAMERA_FLASH_STATE_NOT_USED;
2381 muse_camera_api_e api = MUSE_CAMERA_API_GET_FLASH_STATE;
2382 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2384 muse_camera_msg_get(device_type, muse_core_client_get_msg(module));
2386 if (device_type > CAMERA_DEVICE_CAMERA1) {
2387 LOGE("invalid device %d", device_type);
2389 ret = CAMERA_ERROR_INVALID_PARAMETER;
2390 muse_camera_msg_return(api, class, ret, module);
2392 return MUSE_CAMERA_ERROR_NONE;
2395 muse_core_client_get_value(module, MUSED_KEY_FLASH_STATE_CHECK, &is_called);
2398 ret = legacy_camera_create(device_type, &camera);
2400 legacy_camera_attr_foreach_supported_flash_mode(camera,
2401 (camera_attr_supported_flash_mode_cb)_camera_dispatcher_callback_supported_flash_mode2,
2404 legacy_camera_destroy(camera);
2408 muse_core_client_set_value(module, MUSED_KEY_FLASH_STATE_RETURN, ret);
2409 muse_core_client_set_value(module, MUSED_KEY_FLASH_STATE_COUNT, count);
2410 muse_core_client_set_value(module, MUSED_KEY_FLASH_STATE_CHECK, (int)true);
2412 muse_core_client_get_value(module, MUSED_KEY_FLASH_STATE_RETURN, &ret);
2413 muse_core_client_get_value(module, MUSED_KEY_FLASH_STATE_COUNT, &count);
2416 LOGD("is_called %d, ret 0x%x, count %d", is_called, ret, count);
2418 if (ret != CAMERA_ERROR_NONE) {
2419 LOGE("failed to create or get camera info 0x%x", ret);
2421 muse_camera_msg_return(api, class, ret, module);
2423 return MUSE_CAMERA_ERROR_NONE;
2427 LOGE("count[%d] of supported flash mode is too small, so return NOT_SUPPORTED", count);
2429 ret = CAMERA_ERROR_NOT_SUPPORTED;
2430 muse_camera_msg_return(api, class, ret, module);
2432 return MUSE_CAMERA_ERROR_NONE;
2435 snprintf(value_key, KEY_LENGTH, "flash_state_camera%d", device_type);
2436 muse_core_client_get_value(module, value_key, (int *)&get_flash_state);
2438 LOGD("[%d] flash state : %d", device_type, get_flash_state);
2440 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
2441 -1, "get_flash_state", get_flash_state, NULL);
2443 return MUSE_CAMERA_ERROR_NONE;
2446 int camera_dispatcher_set_preview_cb(muse_module_h module)
2448 int ret = CAMERA_ERROR_NONE;
2449 muse_camera_handle_s *muse_camera = NULL;
2450 muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_CB;
2451 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2453 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2455 LOGD("handle : %p", muse_camera);
2457 ret = legacy_camera_set_preview_cb(muse_camera->camera_handle,
2458 (camera_preview_cb)_camera_dispatcher_preview_cb,
2461 if (ret == CAMERA_ERROR_NONE)
2462 SET_PREVIEW_CB_TYPE(muse_camera, PREVIEW_CB_TYPE_USER);
2464 LOGD("ret : 0x%x", ret);
2466 muse_camera_msg_return(api, class, ret, module);
2468 return MUSE_CAMERA_ERROR_NONE;
2471 int camera_dispatcher_unset_preview_cb(muse_module_h module)
2473 int ret = CAMERA_ERROR_NONE;
2474 muse_camera_handle_s *muse_camera = NULL;
2475 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_PREVIEW_CB;
2476 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2478 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2480 LOGD("handle : %p", muse_camera);
2482 UNSET_PREVIEW_CB_TYPE(muse_camera, PREVIEW_CB_TYPE_USER);
2483 if (CHECK_PREVIEW_CB(muse_camera, PREVIEW_CB_TYPE_EVAS))
2484 LOGD("Preview callback for evas surface is remained.");
2486 ret = legacy_camera_unset_preview_cb(muse_camera->camera_handle);
2488 LOGD("ret : 0x%x", ret);
2490 muse_camera_msg_return(api, class, ret, module);
2492 return MUSE_CAMERA_ERROR_NONE;
2495 int camera_dispatcher_set_media_packet_preview_cb(muse_module_h module)
2497 int ret = CAMERA_ERROR_NONE;
2498 muse_camera_handle_s *muse_camera = NULL;
2499 muse_camera_api_e api = MUSE_CAMERA_API_SET_MEDIA_PACKET_PREVIEW_CB;
2500 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2502 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2504 LOGD("handle : %p", muse_camera);
2506 ret = legacy_camera_set_media_packet_preview_cb(muse_camera->camera_handle,
2507 (camera_preview_cb)_camera_dispatcher_preview_cb,
2510 LOGD("ret : 0x%x", ret);
2512 muse_camera_msg_return(api, class, ret, module);
2514 return MUSE_CAMERA_ERROR_NONE;
2517 int camera_dispatcher_unset_media_packet_preview_cb(muse_module_h module)
2519 int ret = CAMERA_ERROR_NONE;
2520 muse_camera_handle_s *muse_camera = NULL;
2521 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_MEDIA_PACKET_PREVIEW_CB;
2522 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2524 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2526 LOGD("handle : %p", muse_camera);
2528 ret = legacy_camera_unset_media_packet_preview_cb(muse_camera->camera_handle);
2530 LOGD("ret : 0x%x", ret);
2532 muse_camera_msg_return(api, class, ret, module);
2534 return MUSE_CAMERA_ERROR_NONE;
2537 int camera_dispatcher_set_state_changed_cb(muse_module_h module)
2539 int ret = CAMERA_ERROR_NONE;
2540 muse_camera_api_e api = MUSE_CAMERA_API_SET_STATE_CHANGED_CB;
2541 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2545 muse_camera_msg_return(api, class, ret, module);
2547 return MUSE_CAMERA_ERROR_NONE;
2550 int camera_dispatcher_unset_state_changed_cb(muse_module_h module)
2552 int ret = CAMERA_ERROR_NONE;
2553 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_STATE_CHANGED_CB;
2554 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2558 muse_camera_msg_return(api, class, ret, module);
2560 return MUSE_CAMERA_ERROR_NONE;
2563 int camera_dispatcher_set_interrupted_cb(muse_module_h module)
2565 int ret = CAMERA_ERROR_NONE;
2566 muse_camera_handle_s *muse_camera = NULL;
2567 muse_camera_api_e api = MUSE_CAMERA_API_SET_INTERRUPTED_CB;
2568 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2570 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2572 LOGD("handle : %p", muse_camera);
2574 ret = legacy_camera_set_interrupted_cb(muse_camera->camera_handle,
2575 (camera_interrupted_cb)_camera_dispatcher_interrupted_cb,
2578 LOGD("ret : 0x%x", ret);
2580 muse_camera_msg_return(api, class, ret, module);
2582 return MUSE_CAMERA_ERROR_NONE;
2586 int camera_dispatcher_unset_interrupted_cb(muse_module_h module)
2588 int ret = CAMERA_ERROR_NONE;
2589 muse_camera_handle_s *muse_camera = NULL;
2590 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_INTERRUPTED_CB;
2591 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2593 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2595 LOGD("handle : %p", muse_camera);
2597 ret = legacy_camera_unset_interrupted_cb(muse_camera->camera_handle);
2599 LOGD("ret : 0x%x", ret);
2601 muse_camera_msg_return(api, class, ret, module);
2603 return MUSE_CAMERA_ERROR_NONE;
2607 int camera_dispatcher_set_interrupt_started_cb(muse_module_h module)
2609 int ret = CAMERA_ERROR_NONE;
2610 muse_camera_handle_s *muse_camera = NULL;
2611 muse_camera_api_e api = MUSE_CAMERA_API_SET_INTERRUPT_STARTED_CB;
2612 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2614 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2616 LOGD("handle : %p", muse_camera);
2618 ret = legacy_camera_set_interrupt_started_cb(muse_camera->camera_handle,
2619 (camera_interrupt_started_cb)_camera_dispatcher_interrupt_started_cb,
2622 LOGD("ret : 0x%x", ret);
2624 muse_camera_msg_return(api, class, ret, module);
2626 return MUSE_CAMERA_ERROR_NONE;
2630 int camera_dispatcher_unset_interrupt_started_cb(muse_module_h module)
2632 int ret = CAMERA_ERROR_NONE;
2633 muse_camera_handle_s *muse_camera = NULL;
2634 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_INTERRUPT_STARTED_CB;
2635 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2637 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2639 LOGD("handle : %p", muse_camera);
2641 ret = legacy_camera_unset_interrupt_started_cb(muse_camera->camera_handle);
2643 LOGD("ret : 0x%x", ret);
2645 muse_camera_msg_return(api, class, ret, module);
2647 return MUSE_CAMERA_ERROR_NONE;
2650 int camera_dispatcher_set_focus_changed_cb(muse_module_h module)
2652 int ret = CAMERA_ERROR_NONE;
2653 muse_camera_handle_s *muse_camera = NULL;
2654 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOCUS_CHANGED_CB;
2655 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2657 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2659 LOGD("handle : %p", muse_camera);
2661 ret = legacy_camera_set_focus_changed_cb(muse_camera->camera_handle,
2662 (camera_focus_changed_cb)_camera_dispatcher_focus_changed_cb,
2665 LOGD("ret : 0x%x", ret);
2667 muse_camera_msg_return(api, class, ret, module);
2669 return MUSE_CAMERA_ERROR_NONE;
2672 int camera_dispatcher_unset_focus_changed_cb(muse_module_h module)
2674 int ret = CAMERA_ERROR_NONE;
2675 muse_camera_handle_s *muse_camera = NULL;
2676 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_FOCUS_CHANGED_CB;
2677 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2679 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2681 LOGD("handle : %p", muse_camera);
2683 ret = legacy_camera_unset_focus_changed_cb(muse_camera->camera_handle);
2685 LOGD("ret : 0x%x", ret);
2687 muse_camera_msg_return(api, class, ret, module);
2689 return MUSE_CAMERA_ERROR_NONE;
2692 int camera_dispatcher_set_error_cb(muse_module_h module)
2694 int ret = CAMERA_ERROR_NONE;
2695 muse_camera_handle_s *muse_camera = NULL;
2696 muse_camera_api_e api = MUSE_CAMERA_API_SET_ERROR_CB;
2697 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2699 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2701 LOGD("handle : %p", muse_camera);
2703 ret = legacy_camera_set_error_cb(muse_camera->camera_handle,
2704 (camera_error_cb)_camera_dispatcher_error_cb,
2707 LOGD("ret : 0x%x", ret);
2709 muse_camera_msg_return(api, class, ret, module);
2711 return MUSE_CAMERA_ERROR_NONE;
2714 int camera_dispatcher_unset_error_cb(muse_module_h module)
2716 int ret = CAMERA_ERROR_NONE;
2717 muse_camera_handle_s *muse_camera = NULL;
2718 muse_camera_api_e api = MUSE_CAMERA_API_UNSET_ERROR_CB;
2719 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2721 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2723 LOGD("handle : %p", muse_camera);
2725 ret = legacy_camera_unset_error_cb(muse_camera->camera_handle);
2727 LOGD("ret : 0x%x", ret);
2729 muse_camera_msg_return(api, class, ret, module);
2731 return MUSE_CAMERA_ERROR_NONE;
2734 int camera_dispatcher_foreach_supported_preview_resolution(muse_module_h module)
2736 int ret = CAMERA_ERROR_NONE;
2737 muse_camera_handle_s *muse_camera = NULL;
2738 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_PREVIEW_RESOLUTION;
2739 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
2741 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2743 LOGD("handle : %p", muse_camera);
2745 ret = legacy_camera_foreach_supported_preview_resolution(muse_camera->camera_handle,
2746 (camera_supported_preview_resolution_cb)_camera_dispatcher_callback_supported_preview_resolution,
2749 LOGD("ret : 0x%x", ret);
2751 muse_camera_msg_return(api, class, ret, module);
2753 return MUSE_CAMERA_ERROR_NONE;
2756 int camera_dispatcher_foreach_supported_capture_resolution(muse_module_h module)
2758 int ret = CAMERA_ERROR_NONE;
2759 muse_camera_handle_s *muse_camera = NULL;
2760 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_CAPTURE_RESOLUTION;
2761 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
2763 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2765 LOGD("handle : %p", muse_camera);
2767 ret = legacy_camera_foreach_supported_capture_resolution(muse_camera->camera_handle,
2768 (camera_supported_capture_resolution_cb)_camera_dispatcher_callback_supported_capture_resolution,
2771 LOGD("ret : 0x%x", ret);
2773 muse_camera_msg_return(api, class, ret, module);
2775 return MUSE_CAMERA_ERROR_NONE;
2778 int camera_dispatcher_foreach_supported_capture_format(muse_module_h module)
2780 int ret = CAMERA_ERROR_NONE;
2781 muse_camera_handle_s *muse_camera = NULL;
2782 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_CAPTURE_FORMAT;
2783 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
2785 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2787 LOGD("handle : %p", muse_camera);
2789 ret = legacy_camera_foreach_supported_capture_format(muse_camera->camera_handle,
2790 (camera_supported_capture_format_cb)_camera_dispatcher_callback_supported_capture_format,
2793 LOGD("ret : 0x%x", ret);
2795 muse_camera_msg_return(api, class, ret, module);
2797 return MUSE_CAMERA_ERROR_NONE;
2800 int camera_dispatcher_foreach_supported_preview_format(muse_module_h module)
2802 int ret = CAMERA_ERROR_NONE;
2803 muse_camera_handle_s *muse_camera = NULL;
2804 muse_camera_api_e api = MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_PREVIEW_FORMAT;
2805 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
2807 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2809 LOGD("handle : %p", muse_camera);
2811 ret = legacy_camera_foreach_supported_preview_format(muse_camera->camera_handle,
2812 (camera_supported_preview_format_cb)_camera_dispatcher_callback_supported_preview_format,
2815 LOGD("ret : 0x%x", ret);
2817 muse_camera_msg_return(api, class, ret, module);
2819 return MUSE_CAMERA_ERROR_NONE;
2822 int camera_dispatcher_get_recommended_preview_resolution(muse_module_h module)
2824 int ret = CAMERA_ERROR_NONE;
2825 muse_camera_handle_s *muse_camera = NULL;
2829 muse_camera_api_e api = MUSE_CAMERA_API_GET_RECOMMENDED_PREVIEW_RESOLUTION;
2830 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2832 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2834 LOGD("handle : %p", muse_camera);
2836 ret = legacy_camera_get_recommended_preview_resolution(muse_camera->camera_handle, &get_width, &get_height);
2837 if (ret == CAMERA_ERROR_NONE) {
2838 get_value = get_width << 16 | get_height;
2839 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
2840 MUSE_CAMERA_GET_INT_RECOMMENDED_PREVIEW_RESOLUTION, "get_value", get_value, NULL);
2842 muse_camera_msg_return(api, class, ret, module);
2845 return MUSE_CAMERA_ERROR_NONE;
2848 int camera_dispatcher_attr_get_lens_orientation(muse_module_h module)
2850 int ret = CAMERA_ERROR_NONE;
2851 muse_camera_handle_s *muse_camera = NULL;
2853 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_LENS_ORIENTATION;
2854 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2856 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2858 LOGD("handle : %p", muse_camera);
2860 ret = legacy_camera_attr_get_lens_orientation(muse_camera->camera_handle, &get_value);
2861 if (ret == CAMERA_ERROR_NONE) {
2862 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
2863 MUSE_CAMERA_GET_INT_LENS_ORIENTATION, "get_value", get_value, NULL);
2865 muse_camera_msg_return(api, class, ret, module);
2868 return MUSE_CAMERA_ERROR_NONE;
2871 int camera_dispatcher_attr_set_theater_mode(muse_module_h module)
2873 int ret = CAMERA_ERROR_NONE;
2874 muse_camera_handle_s *muse_camera = NULL;
2876 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_THEATER_MODE;
2877 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2879 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2881 muse_camera_msg_get(set_mode, muse_core_client_get_msg(module));
2883 LOGD("handle : %p", muse_camera);
2885 ret = legacy_camera_attr_set_theater_mode(muse_camera->camera_handle, (camera_attr_theater_mode_e)set_mode);
2887 muse_camera_msg_return(api, class, ret, module);
2889 return MUSE_CAMERA_ERROR_NONE;
2892 int camera_dispatcher_attr_get_theater_mode(muse_module_h module)
2894 int ret = CAMERA_ERROR_NONE;
2895 muse_camera_handle_s *muse_camera = NULL;
2896 camera_attr_theater_mode_e get_value = CAMERA_ATTR_THEATER_MODE_DISABLE;
2897 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_THEATER_MODE;
2898 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2900 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2902 LOGD("handle : %p", muse_camera);
2904 ret = legacy_camera_attr_get_theater_mode(muse_camera->camera_handle, &get_value);
2905 if (ret == CAMERA_ERROR_NONE) {
2906 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
2907 MUSE_CAMERA_GET_INT_THEATER_MODE, "get_value", get_value, NULL);
2909 muse_camera_msg_return(api, class, ret, module);
2912 return MUSE_CAMERA_ERROR_NONE;
2915 int camera_dispatcher_attr_foreach_supported_theater_mode(muse_module_h module)
2917 int ret = CAMERA_ERROR_NONE;
2918 muse_camera_handle_s *muse_camera = NULL;
2919 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_THEATER_MODE;
2920 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
2922 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2923 LOGD("handle : %p", muse_camera);
2925 ret = legacy_camera_attr_foreach_supported_theater_mode(muse_camera->camera_handle,
2926 (camera_attr_supported_theater_mode_cb)_camera_dispatcher_callback_supported_theater_mode,
2929 muse_camera_msg_return(api, class, ret, module);
2931 return MUSE_CAMERA_ERROR_NONE;
2934 int camera_dispatcher_attr_set_preview_fps(muse_module_h module)
2936 int ret = CAMERA_ERROR_NONE;
2937 muse_camera_handle_s *muse_camera = NULL;
2939 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_PREVIEW_FPS;
2940 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2942 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2944 muse_camera_msg_get(set_fps, muse_core_client_get_msg(module));
2946 LOGD("handle : %p", muse_camera);
2948 ret = legacy_camera_attr_set_preview_fps(muse_camera->camera_handle, (camera_attr_fps_e)set_fps);
2950 muse_camera_msg_return(api, class, ret, module);
2952 return MUSE_CAMERA_ERROR_NONE;
2955 int camera_dispatcher_attr_set_image_quality(muse_module_h module)
2957 int ret = CAMERA_ERROR_NONE;
2958 muse_camera_handle_s *muse_camera = NULL;
2960 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_IMAGE_QUALITY;
2961 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2963 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2965 muse_camera_msg_get(quality, muse_core_client_get_msg(module));
2967 LOGD("handle : 0x%x, image_quality : %d", muse_camera, quality);
2969 ret = legacy_camera_attr_set_image_quality(muse_camera->camera_handle, quality);
2971 LOGD("ret : 0x%x", ret);
2973 muse_camera_msg_return(api, class, ret, module);
2975 return MUSE_CAMERA_ERROR_NONE;
2978 int camera_dispatcher_attr_get_preview_fps(muse_module_h module)
2980 int ret = CAMERA_ERROR_NONE;
2981 muse_camera_handle_s *muse_camera = NULL;
2982 camera_attr_fps_e get_value = CAMERA_ATTR_FPS_AUTO;
2983 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_PREVIEW_FPS;
2984 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
2986 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
2988 LOGD("handle : %p", muse_camera);
2990 ret = legacy_camera_attr_get_preview_fps(muse_camera->camera_handle, &get_value);
2991 if (ret == CAMERA_ERROR_NONE) {
2992 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
2993 MUSE_CAMERA_GET_INT_PREVIEW_FPS, "get_value", get_value, NULL);
2995 muse_camera_msg_return(api, class, ret, module);
2998 return MUSE_CAMERA_ERROR_NONE;
3001 int camera_dispatcher_attr_get_image_quality(muse_module_h module)
3003 int ret = CAMERA_ERROR_NONE;
3004 muse_camera_handle_s *muse_camera = NULL;
3006 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_IMAGE_QUALITY;
3007 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3009 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3011 LOGD("handle : %p", muse_camera);
3013 ret = legacy_camera_attr_get_image_quality(muse_camera->camera_handle, &get_value);
3014 if (ret == CAMERA_ERROR_NONE) {
3015 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
3016 MUSE_CAMERA_GET_INT_IMAGE_QUALITY, "get_value", get_value, NULL);
3018 muse_camera_msg_return(api, class, ret, module);
3021 return MUSE_CAMERA_ERROR_NONE;
3024 int camera_dispatcher_attr_set_zoom(muse_module_h module)
3026 int ret = CAMERA_ERROR_NONE;
3027 muse_camera_handle_s *muse_camera = NULL;
3029 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ZOOM;
3030 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3032 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3034 muse_camera_msg_get(zoom, muse_core_client_get_msg(module));
3036 LOGD("handle : 0x%x, zoom : %d", muse_camera, zoom);
3038 ret = legacy_camera_attr_set_zoom(muse_camera->camera_handle, zoom);
3040 LOGD("ret : 0x%x", ret);
3042 muse_camera_msg_return(api, class, ret, module);
3044 return MUSE_CAMERA_ERROR_NONE;
3047 int camera_dispatcher_attr_set_af_mode(muse_module_h module)
3049 int ret = CAMERA_ERROR_NONE;
3050 muse_camera_handle_s *muse_camera = NULL;
3052 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_AF_MODE;
3053 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3055 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3057 muse_camera_msg_get(set_mode, muse_core_client_get_msg(module));
3059 LOGD("handle : 0x%x, set_mode : %d", muse_camera, set_mode);
3061 ret = legacy_camera_attr_set_af_mode(muse_camera->camera_handle, (camera_attr_af_mode_e)set_mode);
3063 LOGD("ret : 0x%x", ret);
3065 muse_camera_msg_return(api, class, ret, module);
3067 return MUSE_CAMERA_ERROR_NONE;
3070 int camera_dispatcher_attr_set_af_area(muse_module_h module)
3072 int ret = CAMERA_ERROR_NONE;
3073 muse_camera_handle_s *muse_camera = NULL;
3077 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_AF_AREA;
3078 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3080 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3082 muse_camera_msg_get(value, muse_core_client_get_msg(module));
3085 y = 0x0000ffff & value;
3087 LOGD("AF area - %d, %d", x, y);
3089 ret = legacy_camera_attr_set_af_area(muse_camera->camera_handle, x, y);
3091 LOGD("ret : 0x%x", ret);
3093 muse_camera_msg_return(api, class, ret, module);
3095 return MUSE_CAMERA_ERROR_NONE;
3098 int camera_dispatcher_attr_clear_af_area(muse_module_h module)
3100 int ret = CAMERA_ERROR_NONE;
3101 muse_camera_handle_s *muse_camera = NULL;
3102 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_CLEAR_AF_AREA;
3103 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3105 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3107 LOGD("handle : %p", muse_camera);
3109 ret = legacy_camera_attr_clear_af_area(muse_camera->camera_handle);
3111 LOGD("ret : 0x%x", ret);
3113 muse_camera_msg_return(api, class, ret, module);
3115 return MUSE_CAMERA_ERROR_NONE;
3118 int camera_dispatcher_attr_set_exposure_mode(muse_module_h module)
3120 int ret = CAMERA_ERROR_NONE;
3121 muse_camera_handle_s *muse_camera = NULL;
3123 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EXPOSURE_MODE;
3124 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3126 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3128 muse_camera_msg_get(set_mode, muse_core_client_get_msg(module));
3130 LOGD("handle : 0x%x, set_mode : %d", muse_camera, set_mode);
3132 ret = legacy_camera_attr_set_exposure_mode(muse_camera->camera_handle, (camera_attr_exposure_mode_e)set_mode);
3134 LOGD("ret : 0x%x", ret);
3136 muse_camera_msg_return(api, class, ret, module);
3138 return MUSE_CAMERA_ERROR_NONE;
3141 int camera_dispatcher_attr_set_exposure(muse_module_h module)
3143 int ret = CAMERA_ERROR_NONE;
3144 muse_camera_handle_s *muse_camera = NULL;
3146 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EXPOSURE;
3147 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3149 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3151 muse_camera_msg_get(value, muse_core_client_get_msg(module));
3153 LOGD("handle : 0x%x, value : %d", muse_camera, value);
3155 ret = legacy_camera_attr_set_exposure(muse_camera->camera_handle, value);
3157 LOGD("ret : 0x%x", ret);
3159 muse_camera_msg_return(api, class, ret, module);
3161 return MUSE_CAMERA_ERROR_NONE;
3164 int camera_dispatcher_attr_set_iso(muse_module_h module)
3166 int ret = CAMERA_ERROR_NONE;
3167 muse_camera_handle_s *muse_camera = NULL;
3169 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ISO;
3170 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3172 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3174 muse_camera_msg_get(set_iso, muse_core_client_get_msg(module));
3176 LOGD("handle : 0x%x, set_iso : %d", muse_camera, set_iso);
3178 ret = legacy_camera_attr_set_iso(muse_camera->camera_handle, (camera_attr_iso_e)set_iso);
3180 LOGD("ret : 0x%x", ret);
3182 muse_camera_msg_return(api, class, ret, module);
3184 return MUSE_CAMERA_ERROR_NONE;
3187 int camera_dispatcher_attr_set_brightness(muse_module_h module)
3189 int ret = CAMERA_ERROR_NONE;
3190 muse_camera_handle_s *muse_camera = NULL;
3192 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_BRIGHTNESS;
3193 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3195 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3197 muse_camera_msg_get(level, muse_core_client_get_msg(module));
3199 LOGD("handle : 0x%x, level : %d", muse_camera, level);
3201 ret = legacy_camera_attr_set_brightness(muse_camera->camera_handle, level);
3203 LOGD("ret : 0x%x", ret);
3205 muse_camera_msg_return(api, class, ret, module);
3207 return MUSE_CAMERA_ERROR_NONE;
3210 int camera_dispatcher_attr_set_contrast(muse_module_h module)
3212 int ret = CAMERA_ERROR_NONE;
3213 muse_camera_handle_s *muse_camera = NULL;
3215 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_CONTRAST;
3216 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3218 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3220 muse_camera_msg_get(level, muse_core_client_get_msg(module));
3222 LOGD("handle : 0x%x, level : %d", muse_camera, level);
3224 ret = legacy_camera_attr_set_contrast(muse_camera->camera_handle, level);
3226 LOGD("ret : 0x%x", ret);
3228 muse_camera_msg_return(api, class, ret, module);
3230 return MUSE_CAMERA_ERROR_NONE;
3233 int camera_dispatcher_attr_set_whitebalance(muse_module_h module)
3235 int ret = CAMERA_ERROR_NONE;
3236 muse_camera_handle_s *muse_camera = NULL;
3237 int set_whitebalance;
3238 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_WHITEBALANCE;
3239 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3241 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3243 muse_camera_msg_get(set_whitebalance, muse_core_client_get_msg(module));
3245 LOGD("handle : 0x%x, set_whitebalance : %d", muse_camera, set_whitebalance);
3247 ret = legacy_camera_attr_set_whitebalance(muse_camera->camera_handle, (camera_attr_whitebalance_e)set_whitebalance);
3249 LOGD("ret : 0x%x", ret);
3251 muse_camera_msg_return(api, class, ret, module);
3253 return MUSE_CAMERA_ERROR_NONE;
3256 int camera_dispatcher_attr_set_effect(muse_module_h module)
3258 int ret = CAMERA_ERROR_NONE;
3259 muse_camera_handle_s *muse_camera = NULL;
3261 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EFFECT;
3262 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3264 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3266 muse_camera_msg_get(set_effect, muse_core_client_get_msg(module));
3268 LOGD("handle : 0x%x, set_effect : %d", muse_camera, set_effect);
3270 ret = legacy_camera_attr_set_effect(muse_camera->camera_handle, (camera_attr_effect_mode_e)set_effect);
3272 LOGD("ret : 0x%x", ret);
3274 muse_camera_msg_return(api, class, ret, module);
3276 return MUSE_CAMERA_ERROR_NONE;
3279 int camera_dispatcher_attr_set_scene_mode(muse_module_h module)
3281 int ret = CAMERA_ERROR_NONE;
3282 muse_camera_handle_s *muse_camera = NULL;
3284 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_SCENE_MODE;
3285 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3287 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3289 muse_camera_msg_get(set_mode, muse_core_client_get_msg(module));
3291 LOGD("handle : 0x%x, set_mode : %d", muse_camera, set_mode);
3293 ret = legacy_camera_attr_set_scene_mode(muse_camera->camera_handle, (camera_attr_scene_mode_e)set_mode);
3295 LOGD("ret : 0x%x", ret);
3297 muse_camera_msg_return(api, class, ret, module);
3299 return MUSE_CAMERA_ERROR_NONE;
3302 int camera_dispatcher_attr_enable_tag(muse_module_h module)
3304 int ret = CAMERA_ERROR_NONE;
3305 muse_camera_handle_s *muse_camera = NULL;
3307 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_TAG;
3308 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3310 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3312 muse_camera_msg_get(set_enable, muse_core_client_get_msg(module));
3314 LOGD("handle : 0x%x, set_enable : %d", muse_camera, set_enable);
3316 ret = legacy_camera_attr_enable_tag(muse_camera->camera_handle, (bool)set_enable);
3318 LOGD("ret : 0x%x", ret);
3320 muse_camera_msg_return(api, class, ret, module);
3322 return MUSE_CAMERA_ERROR_NONE;
3325 int camera_dispatcher_attr_set_tag_image_description(muse_module_h module)
3327 int ret = CAMERA_ERROR_NONE;
3328 muse_camera_handle_s *muse_camera = NULL;
3329 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_IMAGE_DESCRIPTION;
3330 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3331 char description[MUSE_CAMERA_MSG_MAX_LENGTH] = {0,};
3333 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3335 muse_camera_msg_get_string(description, muse_core_client_get_msg(module));
3337 LOGD("handle : 0x%x, description : %s", muse_camera, description);
3339 ret = legacy_camera_attr_set_tag_image_description(muse_camera->camera_handle, description);
3341 LOGD("ret : 0x%x", ret);
3343 muse_camera_msg_return(api, class, ret, module);
3345 return MUSE_CAMERA_ERROR_NONE;
3348 int camera_dispatcher_attr_set_tag_orientation(muse_module_h module)
3350 int ret = CAMERA_ERROR_NONE;
3351 muse_camera_handle_s *muse_camera = NULL;
3352 int set_orientation;
3353 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_ORIENTATION;
3354 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3356 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3358 muse_camera_msg_get(set_orientation, muse_core_client_get_msg(module));
3360 LOGD("handle : 0x%x, set_orientation : %d", muse_camera, set_orientation);
3362 ret = legacy_camera_attr_set_tag_orientation(muse_camera->camera_handle, (camera_attr_tag_orientation_e)set_orientation);
3364 LOGD("ret : 0x%x", ret);
3366 muse_camera_msg_return(api, class, ret, module);
3368 return MUSE_CAMERA_ERROR_NONE;
3371 int camera_dispatcher_attr_set_tag_software(muse_module_h module)
3373 int ret = CAMERA_ERROR_NONE;
3374 muse_camera_handle_s *muse_camera = NULL;
3375 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TAG_SOFTWARE;
3376 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3377 char software[MUSE_CAMERA_MSG_MAX_LENGTH] = {0,};
3379 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3381 muse_camera_msg_get_string(software, muse_core_client_get_msg(module));
3383 LOGD("handle : 0x%x, software : %s", muse_camera, software);
3385 ret = legacy_camera_attr_set_tag_software(muse_camera->camera_handle, software);
3387 LOGD("ret : 0x%x", ret);
3389 muse_camera_msg_return(api, class, ret, module);
3391 return MUSE_CAMERA_ERROR_NONE;
3394 int camera_dispatcher_attr_set_geotag(muse_module_h module)
3396 int ret = CAMERA_ERROR_NONE;
3397 muse_camera_handle_s *muse_camera = NULL;
3398 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_GEOTAG;
3399 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3400 double set_geotag[3] = {0,};
3402 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3404 muse_camera_msg_get_array(set_geotag, muse_core_client_get_msg(module));
3406 LOGD("handle : 0x%x, set_geotag1 : %d, set_geotag2 : %d, set_geotag3 : %d",
3407 muse_camera, set_geotag[0], set_geotag[1], set_geotag[2]);
3409 ret = legacy_camera_attr_set_geotag(muse_camera->camera_handle, set_geotag[0], set_geotag[1], set_geotag[2]);
3411 LOGD("ret : 0x%x", ret);
3413 muse_camera_msg_return(api, class, ret, module);
3415 return MUSE_CAMERA_ERROR_NONE;
3418 int camera_dispatcher_attr_remove_geotag(muse_module_h module)
3420 int ret = CAMERA_ERROR_NONE;
3421 muse_camera_handle_s *muse_camera = NULL;
3422 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_REMOVE_GEOTAG;
3423 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3425 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3427 LOGD("handle : %p", muse_camera);
3429 ret = legacy_camera_attr_remove_geotag(muse_camera->camera_handle);
3431 LOGD("ret : 0x%x", ret);
3433 muse_camera_msg_return(api, class, ret, module);
3435 return MUSE_CAMERA_ERROR_NONE;
3438 int camera_dispatcher_attr_set_flash_mode(muse_module_h module)
3440 int ret = CAMERA_ERROR_NONE;
3442 char value_key[KEY_LENGTH] = {'\0',};
3443 muse_camera_handle_s *muse_camera = NULL;
3444 camera_device_e device_type = CAMERA_DEVICE_CAMERA0;
3445 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_FLASH_MODE;
3446 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3448 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3450 muse_camera_msg_get(set_mode, muse_core_client_get_msg(module));
3452 LOGD("handle : 0x%x, set_mode : %d", muse_camera, set_mode);
3454 ret = legacy_camera_attr_set_flash_mode(muse_camera->camera_handle, (camera_attr_flash_mode_e)set_mode);
3455 if (ret == CAMERA_ERROR_NONE) {
3456 ret = legacy_camera_get_device_type(muse_camera->camera_handle, &device_type);
3457 if (ret == CAMERA_ERROR_NONE) {
3458 snprintf(value_key, KEY_LENGTH, "flash_state_camera%d", device_type);
3459 muse_core_client_set_value(module, value_key, set_mode > 0 ? 1 : 0);
3463 LOGD("ret : 0x%x", ret);
3465 muse_camera_msg_return(api, class, ret, module);
3467 return MUSE_CAMERA_ERROR_NONE;
3470 int camera_dispatcher_attr_get_zoom(muse_module_h module)
3472 int ret = CAMERA_ERROR_NONE;
3473 muse_camera_handle_s *muse_camera = NULL;
3475 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ZOOM;
3476 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3478 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3480 LOGD("handle : %p", muse_camera);
3482 ret = legacy_camera_attr_get_zoom(muse_camera->camera_handle, &get_value);
3483 if (ret == CAMERA_ERROR_NONE) {
3484 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
3485 MUSE_CAMERA_GET_INT_ZOOM, "get_value", get_value, NULL);
3487 muse_camera_msg_return(api, class, ret, module);
3490 return MUSE_CAMERA_ERROR_NONE;
3493 int camera_dispatcher_attr_get_zoom_range(muse_module_h module)
3495 int ret = CAMERA_ERROR_NONE;
3496 muse_camera_handle_s *muse_camera = NULL;
3499 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ZOOM_RANGE;
3500 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3501 muse_camera_get_type_e get_type = MUSE_CAMERA_GET_TYPE_INT_PAIR;
3502 muse_camera_get_int_pair_e index = MUSE_CAMERA_GET_INT_PAIR_ZOOM_RANGE;
3504 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3506 LOGD("handle : %p", muse_camera);
3508 ret = legacy_camera_attr_get_zoom_range(muse_camera->camera_handle, &get_value0, &get_value1);
3509 if (ret == CAMERA_ERROR_NONE)
3510 muse_camera_msg_return2(api, class, ret, module, get_type, index, get_value0, get_value1);
3512 muse_camera_msg_return(api, class, ret, module);
3514 return MUSE_CAMERA_ERROR_NONE;
3517 int camera_dispatcher_attr_get_af_mode(muse_module_h module)
3519 int ret = CAMERA_ERROR_NONE;
3520 muse_camera_handle_s *muse_camera = NULL;
3521 camera_attr_af_mode_e get_value = CAMERA_ATTR_AF_NONE;
3522 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_AF_MODE;
3523 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3525 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3527 LOGD("handle : %p", muse_camera);
3529 ret = legacy_camera_attr_get_af_mode(muse_camera->camera_handle, &get_value);
3530 if (ret == CAMERA_ERROR_NONE) {
3531 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
3532 MUSE_CAMERA_GET_INT_AF_MODE, "get_value", get_value, NULL);
3534 muse_camera_msg_return(api, class, ret, module);
3537 return MUSE_CAMERA_ERROR_NONE;
3540 int camera_dispatcher_attr_get_exposure_mode(muse_module_h module)
3542 int ret = CAMERA_ERROR_NONE;
3543 muse_camera_handle_s *muse_camera = NULL;
3544 camera_attr_exposure_mode_e get_value = CAMERA_ATTR_EXPOSURE_MODE_OFF;
3545 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE_MODE;
3546 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3548 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3550 LOGD("handle : %p", muse_camera);
3552 ret = legacy_camera_attr_get_exposure_mode(muse_camera->camera_handle, &get_value);
3553 if (ret == CAMERA_ERROR_NONE) {
3554 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
3555 MUSE_CAMERA_GET_INT_EXPOSURE_MODE, "get_value", get_value, NULL);
3557 muse_camera_msg_return(api, class, ret, module);
3560 return MUSE_CAMERA_ERROR_NONE;
3563 int camera_dispatcher_attr_get_exposure(muse_module_h module)
3565 int ret = CAMERA_ERROR_NONE;
3566 muse_camera_handle_s *muse_camera = NULL;
3568 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE;
3569 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3571 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3573 LOGD("handle : %p", muse_camera);
3575 ret = legacy_camera_attr_get_exposure(muse_camera->camera_handle, &get_value);
3576 if (ret == CAMERA_ERROR_NONE) {
3577 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
3578 MUSE_CAMERA_GET_INT_EXPOSURE, "get_value", get_value, NULL);
3580 muse_camera_msg_return(api, class, ret, module);
3583 return MUSE_CAMERA_ERROR_NONE;
3586 int camera_dispatcher_attr_get_exposure_range(muse_module_h module)
3588 int ret = CAMERA_ERROR_NONE;
3589 muse_camera_handle_s *muse_camera = NULL;
3592 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE_RANGE;
3593 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3594 muse_camera_get_type_e get_type = MUSE_CAMERA_GET_TYPE_INT_PAIR;
3595 muse_camera_get_int_pair_e index = MUSE_CAMERA_GET_INT_PAIR_EXPOSURE_RANGE;
3597 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3599 LOGD("handle : %p", muse_camera);
3601 ret = legacy_camera_attr_get_exposure_range(muse_camera->camera_handle, &get_value0, &get_value1);
3602 if (ret == CAMERA_ERROR_NONE)
3603 muse_camera_msg_return2(api, class, ret, module, get_type, index, get_value0, get_value1);
3605 muse_camera_msg_return(api, class, ret, module);
3607 return MUSE_CAMERA_ERROR_NONE;
3610 int camera_dispatcher_attr_get_iso(muse_module_h module)
3612 int ret = CAMERA_ERROR_NONE;
3613 muse_camera_handle_s *muse_camera = NULL;
3614 camera_attr_iso_e get_value = CAMERA_ATTR_ISO_AUTO;
3615 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ISO;
3616 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3618 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3620 LOGD("handle : %p", muse_camera);
3622 ret = legacy_camera_attr_get_iso(muse_camera->camera_handle, &get_value);
3623 if (ret == CAMERA_ERROR_NONE) {
3624 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
3625 MUSE_CAMERA_GET_INT_ISO, "get_value", get_value, NULL);
3627 muse_camera_msg_return(api, class, ret, module);
3630 return MUSE_CAMERA_ERROR_NONE;
3633 int camera_dispatcher_attr_get_brightness(muse_module_h module)
3635 int ret = CAMERA_ERROR_NONE;
3636 muse_camera_handle_s *muse_camera = NULL;
3638 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_BRIGHTNESS;
3639 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3641 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3643 LOGD("handle : %p", muse_camera);
3645 ret = legacy_camera_attr_get_brightness(muse_camera->camera_handle, &get_value);
3646 if (ret == CAMERA_ERROR_NONE) {
3647 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
3648 MUSE_CAMERA_GET_INT_BRIGHTNESS, "get_value", get_value, NULL);
3650 muse_camera_msg_return(api, class, ret, module);
3653 return MUSE_CAMERA_ERROR_NONE;
3656 int camera_dispatcher_attr_get_brightness_range(muse_module_h module)
3658 int ret = CAMERA_ERROR_NONE;
3659 muse_camera_handle_s *muse_camera = NULL;
3662 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_BRIGHTNESS_RANGE;
3663 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3664 muse_camera_get_type_e get_type = MUSE_CAMERA_GET_TYPE_INT_PAIR;
3665 muse_camera_get_int_pair_e index = MUSE_CAMERA_GET_INT_PAIR_BRIGHTNESS_RANGE;
3667 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3669 LOGD("handle : %p", muse_camera);
3671 ret = legacy_camera_attr_get_brightness_range(muse_camera->camera_handle, &get_value0, &get_value1);
3672 if (ret == CAMERA_ERROR_NONE)
3673 muse_camera_msg_return2(api, class, ret, module, get_type, index, get_value0, get_value1);
3675 muse_camera_msg_return(api, class, ret, module);
3677 return MUSE_CAMERA_ERROR_NONE;
3680 int camera_dispatcher_attr_get_contrast(muse_module_h module)
3682 int ret = CAMERA_ERROR_NONE;
3683 muse_camera_handle_s *muse_camera = NULL;
3685 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_CONTRAST;
3686 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3688 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3690 LOGD("handle : %p", muse_camera);
3692 ret = legacy_camera_attr_get_contrast(muse_camera->camera_handle, &get_value);
3693 if (ret == CAMERA_ERROR_NONE) {
3694 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
3695 MUSE_CAMERA_GET_INT_CONTRAST, "get_value", get_value, NULL);
3697 muse_camera_msg_return(api, class, ret, module);
3700 return MUSE_CAMERA_ERROR_NONE;
3703 int camera_dispatcher_attr_get_contrast_range(muse_module_h module)
3705 int ret = CAMERA_ERROR_NONE;
3706 muse_camera_handle_s *muse_camera = NULL;
3709 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_CONTRAST_RANGE;
3710 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3711 muse_camera_get_type_e get_type = MUSE_CAMERA_GET_TYPE_INT_PAIR;
3712 muse_camera_get_int_pair_e index = MUSE_CAMERA_GET_INT_PAIR_CONTRAST_RANGE;
3714 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3716 LOGD("handle : %p", muse_camera);
3718 ret = legacy_camera_attr_get_contrast_range(muse_camera->camera_handle, &get_value0, &get_value1);
3719 if (ret == CAMERA_ERROR_NONE)
3720 muse_camera_msg_return2(api, class, ret, module, get_type, index, get_value0, get_value1);
3722 muse_camera_msg_return(api, class, ret, module);
3724 return MUSE_CAMERA_ERROR_NONE;
3727 int camera_dispatcher_attr_get_whitebalance(muse_module_h module)
3729 int ret = CAMERA_ERROR_NONE;
3730 muse_camera_handle_s *muse_camera = NULL;
3731 camera_attr_whitebalance_e get_value = CAMERA_ATTR_WHITE_BALANCE_NONE;
3732 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_WHITEBALANCE;
3733 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3735 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3737 LOGD("handle : %p", muse_camera);
3739 ret = legacy_camera_attr_get_whitebalance(muse_camera->camera_handle, &get_value);
3740 if (ret == CAMERA_ERROR_NONE) {
3741 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
3742 MUSE_CAMERA_GET_INT_WHITE_BALANCE, "get_value", get_value, NULL);
3744 muse_camera_msg_return(api, class, ret, module);
3747 return MUSE_CAMERA_ERROR_NONE;
3750 int camera_dispatcher_attr_get_effect(muse_module_h module)
3752 int ret = CAMERA_ERROR_NONE;
3753 muse_camera_handle_s *muse_camera = NULL;
3754 camera_attr_effect_mode_e get_value = CAMERA_ATTR_EFFECT_NONE;
3755 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EFFECT;
3756 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3758 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3760 LOGD("handle : %p", muse_camera);
3762 ret = legacy_camera_attr_get_effect(muse_camera->camera_handle, &get_value);
3763 if (ret == CAMERA_ERROR_NONE) {
3764 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
3765 MUSE_CAMERA_GET_INT_EFFECT, "get_value", get_value, NULL);
3767 muse_camera_msg_return(api, class, ret, module);
3770 return MUSE_CAMERA_ERROR_NONE;
3773 int camera_dispatcher_attr_get_scene_mode(muse_module_h module)
3775 int ret = CAMERA_ERROR_NONE;
3776 muse_camera_handle_s *muse_camera = NULL;
3777 camera_attr_scene_mode_e get_value = CAMERA_ATTR_SCENE_MODE_NORMAL;
3778 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_SCENE_MODE;
3779 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3781 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3783 LOGD("handle : %p", muse_camera);
3785 ret = legacy_camera_attr_get_scene_mode(muse_camera->camera_handle, &get_value);
3786 if (ret == CAMERA_ERROR_NONE) {
3787 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
3788 MUSE_CAMERA_GET_INT_SCENE_MODE, "get_value", get_value, NULL);
3790 muse_camera_msg_return(api, class, ret, module);
3793 return MUSE_CAMERA_ERROR_NONE;
3796 int camera_dispatcher_attr_is_enabled_tag(muse_module_h module)
3798 int ret = CAMERA_ERROR_NONE;
3799 muse_camera_handle_s *muse_camera = NULL;
3800 bool get_value = false;
3801 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_TAG;
3802 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3804 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3806 LOGD("handle : %p", muse_camera);
3808 ret = legacy_camera_attr_is_enabled_tag(muse_camera->camera_handle, &get_value);
3809 if (ret == CAMERA_ERROR_NONE) {
3810 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
3811 MUSE_CAMERA_GET_INT_ENABLED_TAG, "get_value", get_value, NULL);
3813 muse_camera_msg_return(api, class, ret, module);
3816 return MUSE_CAMERA_ERROR_NONE;
3819 int camera_dispatcher_attr_get_tag_image_description(muse_module_h module)
3821 int ret = CAMERA_ERROR_NONE;
3822 muse_camera_handle_s *muse_camera = NULL;
3823 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_IMAGE_DESCRIPTION;
3824 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3825 char *get_value = NULL;
3827 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3829 ret = legacy_camera_attr_get_tag_image_description(muse_camera->camera_handle, &get_value);
3830 if (ret == CAMERA_ERROR_NONE) {
3831 LOGD("get_description : %s", muse_camera, get_value);
3832 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_STRING,
3833 MUSE_CAMERA_GET_STRING_TAG_IMAGE_DESCRIPTION, "get_value", 0, get_value);
3835 muse_camera_msg_return(api, class, ret, module);
3843 return MUSE_CAMERA_ERROR_NONE;
3846 int camera_dispatcher_attr_get_tag_orientation(muse_module_h module)
3848 int ret = CAMERA_ERROR_NONE;
3849 muse_camera_handle_s *muse_camera = NULL;
3850 camera_attr_tag_orientation_e get_value = CAMERA_ATTR_TAG_ORIENTATION_TOP_LEFT;
3851 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_ORIENTATION;
3852 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3854 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3856 LOGD("handle : %p", muse_camera);
3858 ret = legacy_camera_attr_get_tag_orientation(muse_camera->camera_handle, &get_value);
3859 if (ret == CAMERA_ERROR_NONE) {
3860 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
3861 MUSE_CAMERA_GET_INT_TAG_ORIENTATION, "get_value", get_value, NULL);
3863 muse_camera_msg_return(api, class, ret, module);
3866 return MUSE_CAMERA_ERROR_NONE;
3869 int camera_dispatcher_attr_get_tag_software(muse_module_h module)
3871 int ret = CAMERA_ERROR_NONE;
3872 muse_camera_handle_s *muse_camera = NULL;
3873 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_SOFTWARE;
3874 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3875 char *get_value = NULL;
3877 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3879 ret = legacy_camera_attr_get_tag_software(muse_camera->camera_handle, &get_value);
3880 if (ret == CAMERA_ERROR_NONE) {
3881 LOGD("get_software : %s", get_value);
3882 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_STRING,
3883 MUSE_CAMERA_GET_STRING_TAG_SOFTWARE, "get_value", 0, get_value);
3885 muse_camera_msg_return(api, class, ret, module);
3893 return MUSE_CAMERA_ERROR_NONE;
3896 int camera_dispatcher_attr_get_geotag(muse_module_h module)
3898 int ret = CAMERA_ERROR_NONE;
3899 muse_camera_handle_s *muse_camera = NULL;
3900 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_GEOTAG;
3901 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3902 double get_value[3] = {0.0, 0.0, 0.0};
3903 char *send_msg = NULL;
3904 int msg_array_size = 0;
3906 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3908 LOGD("handle : %p", muse_camera);
3910 ret = legacy_camera_attr_get_geotag(muse_camera->camera_handle, &get_value[0], &get_value[1], &get_value[2]);
3911 if (ret == CAMERA_ERROR_NONE) {
3912 msg_array_size = sizeof(get_value) / sizeof(int) + (sizeof(get_value) % sizeof(int) ? 1 : 0);
3914 send_msg = muse_core_msg_json_factory_new(api,
3915 MUSE_TYPE_INT, PARAM_API_CLASS, class,
3916 MUSE_TYPE_INT, PARAM_RET, ret,
3917 MUSE_TYPE_INT, PARAM_GET_TYPE, MUSE_CAMERA_GET_TYPE_ARRAY,
3918 MUSE_TYPE_ARRAY, "get_value", msg_array_size, get_value,
3921 __camera_dispatcher_send_msg(module, send_msg);
3923 muse_camera_msg_return(api, class, ret, module);
3926 return MUSE_CAMERA_ERROR_NONE;
3929 int camera_dispatcher_attr_get_flash_mode(muse_module_h module)
3931 int ret = CAMERA_ERROR_NONE;
3932 muse_camera_handle_s *muse_camera = NULL;
3933 camera_attr_flash_mode_e get_value = CAMERA_ATTR_FLASH_MODE_OFF;
3934 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_FLASH_MODE;
3935 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
3937 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3939 LOGD("handle : %p", muse_camera);
3941 ret = legacy_camera_attr_get_flash_mode(muse_camera->camera_handle, &get_value);
3942 if (ret == CAMERA_ERROR_NONE) {
3943 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
3944 MUSE_CAMERA_GET_INT_FLASH_MODE, "get_value", get_value, NULL);
3946 muse_camera_msg_return(api, class, ret, module);
3949 return MUSE_CAMERA_ERROR_NONE;
3952 int camera_dispatcher_attr_foreach_supported_af_mode(muse_module_h module)
3954 int ret = CAMERA_ERROR_NONE;
3955 muse_camera_handle_s *muse_camera = NULL;
3956 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_AF_MODE;
3957 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
3959 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3961 LOGD("handle : %p", muse_camera);
3963 ret = legacy_camera_attr_foreach_supported_af_mode(muse_camera->camera_handle,
3964 (camera_attr_supported_af_mode_cb)_camera_dispatcher_callback_supported_af_mode,
3967 LOGD("ret : 0x%x", ret);
3969 muse_camera_msg_return(api, class, ret, module);
3971 return MUSE_CAMERA_ERROR_NONE;
3974 int camera_dispatcher_attr_foreach_supported_exposure_mode(muse_module_h module)
3976 int ret = CAMERA_ERROR_NONE;
3977 muse_camera_handle_s *muse_camera = NULL;
3978 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_EXPOSURE_MODE;
3979 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
3981 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
3983 LOGD("handle : 0x%x, api : %d", muse_camera, api);
3985 ret = legacy_camera_attr_foreach_supported_exposure_mode(muse_camera->camera_handle,
3986 (camera_attr_supported_exposure_mode_cb)_camera_dispatcher_callback_supported_exposure_mode,
3989 LOGD("ret : 0x%x", ret);
3991 muse_camera_msg_return(api, class, ret, module);
3993 return MUSE_CAMERA_ERROR_NONE;
3996 int camera_dispatcher_attr_foreach_supported_iso(muse_module_h module)
3998 int ret = CAMERA_ERROR_NONE;
3999 muse_camera_handle_s *muse_camera = NULL;
4000 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_ISO;
4001 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
4003 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4005 LOGD("handle : %p", muse_camera);
4007 ret = legacy_camera_attr_foreach_supported_iso(muse_camera->camera_handle,
4008 (camera_attr_supported_iso_cb)_camera_dispatcher_callback_supported_iso_mode,
4011 LOGD("ret : 0x%x", ret);
4013 muse_camera_msg_return(api, class, ret, module);
4015 return MUSE_CAMERA_ERROR_NONE;
4018 int camera_dispatcher_attr_foreach_supported_whitebalance(muse_module_h module)
4020 int ret = CAMERA_ERROR_NONE;
4021 muse_camera_handle_s *muse_camera = NULL;
4022 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_WHITEBALANCE;
4023 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
4025 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4027 LOGD("handle : %p", muse_camera);
4029 ret = legacy_camera_attr_foreach_supported_whitebalance(muse_camera->camera_handle,
4030 (camera_attr_supported_whitebalance_cb)_camera_dispatcher_callback_supported_whitebalance,
4033 LOGD("ret : 0x%x", ret);
4035 muse_camera_msg_return(api, class, ret, module);
4037 return MUSE_CAMERA_ERROR_NONE;
4040 int camera_dispatcher_attr_foreach_supported_effect(muse_module_h module)
4042 int ret = CAMERA_ERROR_NONE;
4043 muse_camera_handle_s *muse_camera = NULL;
4044 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_EFFECT;
4045 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
4047 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4049 LOGD("handle : %p", muse_camera);
4051 ret = legacy_camera_attr_foreach_supported_effect(muse_camera->camera_handle,
4052 (camera_attr_supported_effect_cb)_camera_dispatcher_callback_supported_effect,
4055 LOGD("ret : 0x%x", ret);
4057 muse_camera_msg_return(api, class, ret, module);
4059 return MUSE_CAMERA_ERROR_NONE;
4062 int camera_dispatcher_attr_foreach_supported_scene_mode(muse_module_h module)
4064 int ret = CAMERA_ERROR_NONE;
4065 muse_camera_handle_s *muse_camera = NULL;
4066 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_SCENE_MODE;
4067 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
4069 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4071 LOGD("handle : %p", muse_camera);
4073 ret = legacy_camera_attr_foreach_supported_scene_mode(muse_camera->camera_handle,
4074 (camera_attr_supported_scene_mode_cb)_camera_dispatcher_callback_supported_scene_mode,
4077 LOGD("ret : 0x%x", ret);
4079 muse_camera_msg_return(api, class, ret, module);
4081 return MUSE_CAMERA_ERROR_NONE;
4084 int camera_dispatcher_attr_foreach_supported_flash_mode(muse_module_h module)
4086 int ret = CAMERA_ERROR_NONE;
4087 muse_camera_handle_s *muse_camera = NULL;
4088 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FLASH_MODE;
4089 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
4091 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4093 LOGD("handle : %p", muse_camera);
4095 ret = legacy_camera_attr_foreach_supported_flash_mode(muse_camera->camera_handle,
4096 (camera_attr_supported_flash_mode_cb)_camera_dispatcher_callback_supported_flash_mode,
4099 LOGD("ret : 0x%x", ret);
4101 muse_camera_msg_return(api, class, ret, module);
4103 return MUSE_CAMERA_ERROR_NONE;
4106 int camera_dispatcher_attr_foreach_supported_fps(muse_module_h module)
4108 int ret = CAMERA_ERROR_NONE;
4109 muse_camera_handle_s *muse_camera = NULL;
4110 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FPS;
4111 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
4113 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4115 LOGD("handle : %p", muse_camera);
4117 ret = legacy_camera_attr_foreach_supported_fps(muse_camera->camera_handle,
4118 (camera_attr_supported_fps_cb)_camera_dispatcher_callback_supported_fps,
4121 LOGD("ret : 0x%x", ret);
4123 muse_camera_msg_return(api, class, ret, module);
4125 return MUSE_CAMERA_ERROR_NONE;
4128 int camera_dispatcher_attr_foreach_supported_fps_by_resolution(muse_module_h module)
4130 int ret = CAMERA_ERROR_NONE;
4131 muse_camera_handle_s *muse_camera = NULL;
4132 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FPS_BY_RESOLUTION;
4133 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
4138 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4140 muse_camera_msg_get(value, muse_core_client_get_msg(module));
4142 width = value >> 16;
4143 height = 0x0000ffff & value;
4145 LOGD("handle : %p - %dx%d", muse_camera, width, height);
4147 ret = legacy_camera_attr_foreach_supported_fps_by_resolution(muse_camera->camera_handle,
4149 (camera_attr_supported_fps_cb)_camera_dispatcher_callback_supported_fps_by_resolution,
4152 LOGD("ret : 0x%x", ret);
4154 muse_camera_msg_return(api, class, ret, module);
4156 return MUSE_CAMERA_ERROR_NONE;
4159 int camera_dispatcher_attr_foreach_supported_stream_flip(muse_module_h module)
4161 int ret = CAMERA_ERROR_NONE;
4162 muse_camera_handle_s *muse_camera = NULL;
4163 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_STREAM_FLIP;
4164 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
4166 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4168 LOGD("handle : %p", muse_camera);
4170 ret = legacy_camera_attr_foreach_supported_stream_flip(muse_camera->camera_handle,
4171 (camera_attr_supported_stream_flip_cb)_camera_dispatcher_callback_supported_stream_flip,
4174 LOGD("ret : 0x%x", ret);
4176 muse_camera_msg_return(api, class, ret, module);
4178 return MUSE_CAMERA_ERROR_NONE;
4181 int camera_dispatcher_attr_foreach_supported_stream_rotation(muse_module_h module)
4183 int ret = CAMERA_ERROR_NONE;
4184 muse_camera_handle_s *muse_camera = NULL;
4185 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_STREAM_ROTATION;
4186 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
4188 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4190 LOGD("handle : %p", muse_camera);
4192 ret = legacy_camera_attr_foreach_supported_stream_rotation(muse_camera->camera_handle,
4193 (camera_attr_supported_stream_rotation_cb)_camera_dispatcher_callback_supported_stream_rotation,
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_stream_rotation(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_STREAM_ROTATION;
4208 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4211 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4213 muse_camera_msg_get(set_rotation, muse_core_client_get_msg(module));
4215 LOGD("handle : %p", muse_camera);
4217 ret = legacy_camera_attr_set_stream_rotation(muse_camera->camera_handle, (camera_rotation_e)set_rotation);
4219 LOGD("ret : 0x%x", ret);
4221 muse_camera_msg_return(api, class, ret, module);
4223 return MUSE_CAMERA_ERROR_NONE;
4226 int camera_dispatcher_attr_get_stream_rotation(muse_module_h module)
4228 int ret = CAMERA_ERROR_NONE;
4229 muse_camera_handle_s *muse_camera = NULL;
4230 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_STREAM_ROTATION;
4231 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4232 camera_rotation_e get_value = CAMERA_ROTATION_NONE;
4234 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4236 LOGD("handle : %p", muse_camera);
4238 ret = legacy_camera_attr_get_stream_rotation(muse_camera->camera_handle, &get_value);
4239 if (ret == CAMERA_ERROR_NONE) {
4240 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
4241 MUSE_CAMERA_GET_INT_STREAM_ROTATION, "get_value", get_value, NULL);
4243 muse_camera_msg_return(api, class, ret, module);
4246 return MUSE_CAMERA_ERROR_NONE;
4249 int camera_dispatcher_attr_set_stream_flip(muse_module_h module)
4251 int ret = CAMERA_ERROR_NONE;
4252 muse_camera_handle_s *muse_camera = NULL;
4253 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_STREAM_FLIP;
4254 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4257 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4259 muse_camera_msg_get(set_flip, muse_core_client_get_msg(module));
4261 LOGD("handle : %p", muse_camera);
4263 ret = legacy_camera_attr_set_stream_flip(muse_camera->camera_handle, (camera_flip_e)set_flip);
4265 LOGD("ret : 0x%x", ret);
4267 muse_camera_msg_return(api, class, ret, module);
4269 return MUSE_CAMERA_ERROR_NONE;
4272 int camera_dispatcher_attr_get_stream_flip(muse_module_h module)
4274 int ret = CAMERA_ERROR_NONE;
4275 muse_camera_handle_s *muse_camera = NULL;
4276 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_STREAM_FLIP;
4277 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4278 camera_flip_e get_value = CAMERA_FLIP_NONE;
4280 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4282 LOGD("handle : %p", muse_camera);
4284 ret = legacy_camera_attr_get_stream_flip(muse_camera->camera_handle, &get_value);
4285 if (ret == CAMERA_ERROR_NONE) {
4286 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
4287 MUSE_CAMERA_GET_INT_STREAM_FLIP, "get_value", get_value, NULL);
4289 muse_camera_msg_return(api, class, ret, module);
4292 return MUSE_CAMERA_ERROR_NONE;
4295 int camera_dispatcher_attr_set_hdr_mode(muse_module_h module)
4298 muse_camera_handle_s *muse_camera = NULL;
4300 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4302 LOGD("handle : %p", muse_camera);
4304 muse_camera_msg_get(set_mode, muse_core_client_get_msg(module));
4306 _camera_task_add_job(muse_camera, MUSE_CAMERA_API_ATTR_SET_HDR_MODE,
4307 MUSE_CAMERA_API_CLASS_IMMEDIATE, set_mode);
4309 return MUSE_CAMERA_ERROR_NONE;
4312 int camera_dispatcher_attr_get_hdr_mode(muse_module_h module)
4314 int ret = CAMERA_ERROR_NONE;
4315 muse_camera_handle_s *muse_camera = NULL;
4316 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_HDR_MODE;
4317 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4318 camera_attr_hdr_mode_e get_value = CAMERA_ATTR_HDR_MODE_DISABLE;
4320 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4322 LOGD("handle : %p", muse_camera);
4324 ret = legacy_camera_attr_get_hdr_mode(muse_camera->camera_handle, &get_value);
4325 if (ret == CAMERA_ERROR_NONE) {
4326 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
4327 MUSE_CAMERA_GET_INT_HDR_MODE, "get_value", get_value, NULL);
4329 muse_camera_msg_return(api, class, ret, module);
4332 return MUSE_CAMERA_ERROR_NONE;
4335 int camera_dispatcher_attr_is_supported_hdr_capture(muse_module_h module)
4337 int ret = CAMERA_ERROR_NONE;
4338 muse_camera_handle_s *muse_camera = NULL;
4339 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_HDR_CAPTURE;
4340 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4342 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4344 LOGD("handle : %p", muse_camera);
4346 ret = legacy_camera_attr_is_supported_hdr_capture(muse_camera->camera_handle);
4348 LOGD("ret : 0x%x", ret);
4350 muse_camera_msg_return(api, class, ret, module);
4352 return MUSE_CAMERA_ERROR_NONE;
4355 int camera_dispatcher_attr_set_hdr_capture_progress_cb(muse_module_h module)
4357 int ret = CAMERA_ERROR_NONE;
4358 muse_camera_handle_s *muse_camera = NULL;
4359 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_HDR_CAPTURE_PROGRESS_CB;
4360 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4362 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4364 LOGD("handle : %p", muse_camera);
4366 ret = legacy_camera_attr_set_hdr_capture_progress_cb(muse_camera->camera_handle,
4367 (camera_attr_hdr_progress_cb)_camera_dispatcher_hdr_progress_cb,
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_unset_hdr_capture_progress_cb(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_UNSET_HDR_CAPTURE_PROGRESS_CB;
4382 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4384 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4386 LOGD("handle : %p", muse_camera);
4388 ret = legacy_camera_attr_unset_hdr_capture_progress_cb(muse_camera->camera_handle);
4390 LOGD("ret : 0x%x", ret);
4392 muse_camera_msg_return(api, class, ret, module);
4394 return MUSE_CAMERA_ERROR_NONE;
4397 int camera_dispatcher_attr_enable_anti_shake(muse_module_h module)
4399 int ret = CAMERA_ERROR_NONE;
4400 muse_camera_handle_s *muse_camera = NULL;
4401 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_ANTI_SHAKE;
4402 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4405 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4407 muse_camera_msg_get(set_enable, muse_core_client_get_msg(module));
4409 LOGD("handle : %p", muse_camera);
4411 ret = legacy_camera_attr_enable_anti_shake(muse_camera->camera_handle, (bool)set_enable);
4413 LOGD("ret : 0x%x", ret);
4415 muse_camera_msg_return(api, class, ret, module);
4417 return MUSE_CAMERA_ERROR_NONE;
4420 int camera_dispatcher_attr_is_enabled_anti_shake(muse_module_h module)
4422 int ret = CAMERA_ERROR_NONE;
4423 muse_camera_handle_s *muse_camera = NULL;
4424 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_ANTI_SHAKE;
4425 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4426 bool get_value = false;
4428 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4430 LOGD("handle : %p", muse_camera);
4432 ret = legacy_camera_attr_is_enabled_anti_shake(muse_camera->camera_handle, &get_value);
4433 if (ret == CAMERA_ERROR_NONE) {
4434 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
4435 MUSE_CAMERA_GET_INT_ENABLED_ANTI_SHAKE, "get_value", get_value, NULL);
4437 muse_camera_msg_return(api, class, ret, module);
4440 return MUSE_CAMERA_ERROR_NONE;
4443 int camera_dispatcher_attr_is_supported_anti_shake(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_IS_SUPPORTED_ANTI_SHAKE;
4448 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4450 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4452 LOGD("handle : %p", muse_camera);
4454 ret = legacy_camera_attr_is_supported_anti_shake(muse_camera->camera_handle);
4456 LOGD("ret : 0x%x", ret);
4458 muse_camera_msg_return(api, class, ret, module);
4460 return MUSE_CAMERA_ERROR_NONE;
4463 int camera_dispatcher_attr_enable_video_stabilization(muse_module_h module)
4465 int ret = CAMERA_ERROR_NONE;
4466 muse_camera_handle_s *muse_camera = NULL;
4467 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_VIDEO_STABILIZATION;
4468 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4471 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4473 muse_camera_msg_get(set_enable, muse_core_client_get_msg(module));
4475 LOGD("handle : %p", muse_camera);
4477 ret = legacy_camera_attr_enable_video_stabilization(muse_camera->camera_handle, (bool)set_enable);
4479 LOGD("ret : 0x%x", ret);
4481 muse_camera_msg_return(api, class, ret, module);
4483 return MUSE_CAMERA_ERROR_NONE;
4486 int camera_dispatcher_attr_is_enabled_video_stabilization(muse_module_h module)
4488 int ret = CAMERA_ERROR_NONE;
4489 muse_camera_handle_s *muse_camera = NULL;
4490 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_VIDEO_STABILIZATION;
4491 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4492 bool get_value = false;
4494 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4496 LOGD("handle : %p", muse_camera);
4498 ret = legacy_camera_attr_is_enabled_video_stabilization(muse_camera->camera_handle, &get_value);
4499 if (ret == CAMERA_ERROR_NONE) {
4500 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
4501 MUSE_CAMERA_GET_INT_ENABLED_VIDEO_STABILIZATION, "get_value", get_value, NULL);
4503 muse_camera_msg_return(api, class, ret, module);
4506 return MUSE_CAMERA_ERROR_NONE;
4509 int camera_dispatcher_attr_is_supported_video_stabilization(muse_module_h module)
4511 int ret = CAMERA_ERROR_NONE;
4512 muse_camera_handle_s *muse_camera = NULL;
4513 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_VIDEO_STABILIZATION;
4514 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4516 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4518 LOGD("handle : %p", muse_camera);
4520 ret = legacy_camera_attr_is_supported_video_stabilization(muse_camera->camera_handle);
4522 LOGD("ret : 0x%x", ret);
4524 muse_camera_msg_return(api, class, ret, module);
4526 return MUSE_CAMERA_ERROR_NONE;
4529 int camera_dispatcher_attr_enable_auto_contrast(muse_module_h module)
4531 int ret = CAMERA_ERROR_NONE;
4532 muse_camera_handle_s *muse_camera = NULL;
4533 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_ENABLE_AUTO_CONTRAST;
4534 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4537 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4539 muse_camera_msg_get(set_enable, muse_core_client_get_msg(module));
4541 LOGD("handle : %p", muse_camera);
4543 ret = legacy_camera_attr_enable_auto_contrast(muse_camera->camera_handle, (bool)set_enable);
4545 LOGD("ret : 0x%x", ret);
4547 muse_camera_msg_return(api, class, ret, module);
4549 return MUSE_CAMERA_ERROR_NONE;
4552 int camera_dispatcher_attr_is_enabled_auto_contrast(muse_module_h module)
4554 int ret = CAMERA_ERROR_NONE;
4555 muse_camera_handle_s *muse_camera = NULL;
4556 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_AUTO_CONTRAST;
4557 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4558 bool get_value = false;
4560 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4562 LOGD("handle : %p", muse_camera);
4564 ret = legacy_camera_attr_is_enabled_auto_contrast(muse_camera->camera_handle, &get_value);
4565 if (ret == CAMERA_ERROR_NONE) {
4566 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
4567 MUSE_CAMERA_GET_INT_ENABLED_AUTO_CONTRAST, "get_value", get_value, NULL);
4569 muse_camera_msg_return(api, class, ret, module);
4572 return MUSE_CAMERA_ERROR_NONE;
4575 int camera_dispatcher_attr_is_supported_auto_contrast(muse_module_h module)
4577 int ret = CAMERA_ERROR_NONE;
4578 muse_camera_handle_s *muse_camera = NULL;
4579 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_SUPPORTED_AUTO_CONTRAST;
4580 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4582 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4584 LOGD("handle : %p", muse_camera);
4586 ret = legacy_camera_attr_is_supported_auto_contrast(muse_camera->camera_handle);
4588 LOGD("ret : 0x%x", ret);
4590 muse_camera_msg_return(api, class, ret, module);
4592 return MUSE_CAMERA_ERROR_NONE;
4595 int camera_dispatcher_attr_disable_shutter_sound(muse_module_h module)
4597 int ret = CAMERA_ERROR_NONE;
4598 muse_camera_handle_s *muse_camera = NULL;
4599 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_DISABLE_SHUTTER_SOUND;
4600 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4603 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4605 muse_camera_msg_get(set_disable, muse_core_client_get_msg(module));
4607 LOGD("handle : %p", muse_camera);
4609 ret = legacy_camera_attr_disable_shutter_sound(muse_camera->camera_handle, (bool)set_disable);
4611 LOGD("ret : 0x%x", ret);
4613 muse_camera_msg_return(api, class, ret, module);
4615 return MUSE_CAMERA_ERROR_NONE;
4618 int camera_dispatcher_attr_get_encoded_preview_bitrate(muse_module_h module)
4620 int ret = CAMERA_ERROR_NONE;
4621 muse_camera_handle_s *muse_camera = NULL;
4623 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ENCODED_PREVIEW_BITRATE;
4624 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4626 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4628 LOGD("handle : %p", muse_camera);
4630 ret = legacy_camera_attr_get_encoded_preview_bitrate(muse_camera->camera_handle, &get_value);
4631 if (ret == CAMERA_ERROR_NONE) {
4632 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
4633 MUSE_CAMERA_GET_INT_ENCODED_PREVIEW_BITRATE, "get_value", get_value, NULL);
4635 muse_camera_msg_return(api, class, ret, module);
4638 return MUSE_CAMERA_ERROR_NONE;
4641 int camera_dispatcher_attr_set_encoded_preview_bitrate(muse_module_h module)
4643 int ret = CAMERA_ERROR_NONE;
4644 muse_camera_handle_s *muse_camera = NULL;
4646 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ENCODED_PREVIEW_BITRATE;
4647 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4649 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4651 muse_camera_msg_get(set_bitrate, muse_core_client_get_msg(module));
4653 LOGD("handle : 0x%x, set_encoded_preview_bitrate : %d", muse_camera, set_bitrate);
4655 ret = legacy_camera_attr_set_encoded_preview_bitrate(muse_camera->camera_handle, set_bitrate);
4657 LOGD("ret : 0x%x", ret);
4659 muse_camera_msg_return(api, class, ret, module);
4661 return MUSE_CAMERA_ERROR_NONE;
4664 int camera_dispatcher_attr_get_encoded_preview_gop_interval(muse_module_h module)
4666 int ret = CAMERA_ERROR_NONE;
4667 muse_camera_handle_s *muse_camera = NULL;
4669 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ENCODED_PREVIEW_GOP_INTERVAL;
4670 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4672 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4674 LOGD("handle : %p", muse_camera);
4676 ret = legacy_camera_attr_get_encoded_preview_gop_interval(muse_camera->camera_handle, &get_value);
4677 if (ret == CAMERA_ERROR_NONE) {
4678 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
4679 MUSE_CAMERA_GET_INT_ENCODED_PREVIEW_GOP_INTERVAL, "get_value", get_value, NULL);
4681 muse_camera_msg_return(api, class, ret, module);
4684 return MUSE_CAMERA_ERROR_NONE;
4687 int camera_dispatcher_attr_set_encoded_preview_gop_interval(muse_module_h module)
4689 int ret = CAMERA_ERROR_NONE;
4690 muse_camera_handle_s *muse_camera = NULL;
4691 int set_gop_interval;
4692 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_ENCODED_PREVIEW_GOP_INTERVAL;
4693 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4695 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4697 muse_camera_msg_get(set_gop_interval, muse_core_client_get_msg(module));
4699 LOGD("handle : 0x%x, set_encoded_preview_gop_interval : %d", muse_camera, set_gop_interval);
4701 ret = legacy_camera_attr_set_encoded_preview_gop_interval(muse_camera->camera_handle, set_gop_interval);
4703 LOGD("ret : 0x%x", ret);
4705 muse_camera_msg_return(api, class, ret, module);
4707 return MUSE_CAMERA_ERROR_NONE;
4710 int camera_dispatcher_attr_set_pan(muse_module_h module)
4712 int ret = CAMERA_ERROR_NONE;
4713 muse_camera_handle_s *muse_camera = NULL;
4717 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_PAN;
4718 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4720 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4722 muse_camera_msg_get(value, muse_core_client_get_msg(module));
4725 step = 0x0000ffff & value;
4727 LOGD("handle : 0x%x - type %d, step %d", muse_camera, type, step);
4729 ret = legacy_camera_attr_set_pan(muse_camera->camera_handle, type, step);
4731 LOGD("ret : 0x%x", ret);
4733 muse_camera_msg_return(api, class, ret, module);
4735 return MUSE_CAMERA_ERROR_NONE;
4738 int camera_dispatcher_attr_get_pan(muse_module_h module)
4740 int ret = CAMERA_ERROR_NONE;
4741 muse_camera_handle_s *muse_camera = NULL;
4743 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_PAN;
4744 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4746 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4748 LOGD("handle : %p", muse_camera);
4750 ret = legacy_camera_attr_get_pan(muse_camera->camera_handle, &get_value);
4751 if (ret == CAMERA_ERROR_NONE) {
4752 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
4753 MUSE_CAMERA_GET_INT_PAN, "get_value", get_value, NULL);
4755 muse_camera_msg_return(api, class, ret, module);
4758 return MUSE_CAMERA_ERROR_NONE;
4761 int camera_dispatcher_attr_get_pan_range(muse_module_h module)
4763 int ret = CAMERA_ERROR_NONE;
4764 muse_camera_handle_s *muse_camera = NULL;
4767 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_PAN_RANGE;
4768 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4769 muse_camera_get_type_e get_type = MUSE_CAMERA_GET_TYPE_INT_PAIR;
4770 muse_camera_get_int_pair_e index = MUSE_CAMERA_GET_INT_PAIR_PAN_RANGE;
4772 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4774 LOGD("handle : %p", muse_camera);
4776 ret = legacy_camera_attr_get_pan_range(muse_camera->camera_handle, &get_value0, &get_value1);
4777 if (ret == CAMERA_ERROR_NONE)
4778 muse_camera_msg_return2(api, class, ret, module, get_type, index, get_value0, get_value1);
4780 muse_camera_msg_return(api, class, ret, module);
4782 return MUSE_CAMERA_ERROR_NONE;
4785 int camera_dispatcher_attr_set_tilt(muse_module_h module)
4787 int ret = CAMERA_ERROR_NONE;
4788 muse_camera_handle_s *muse_camera = NULL;
4792 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TILT;
4793 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4795 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4797 muse_camera_msg_get(value, muse_core_client_get_msg(module));
4800 step = 0x0000ffff & value;
4802 LOGD("handle : 0x%x - type %d, step %d", muse_camera, type, step);
4804 ret = legacy_camera_attr_set_tilt(muse_camera->camera_handle, type, step);
4806 LOGD("ret : 0x%x", ret);
4808 muse_camera_msg_return(api, class, ret, module);
4810 return MUSE_CAMERA_ERROR_NONE;
4813 int camera_dispatcher_attr_get_tilt(muse_module_h module)
4815 int ret = CAMERA_ERROR_NONE;
4816 muse_camera_handle_s *muse_camera = NULL;
4818 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TILT;
4819 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4821 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4823 LOGD("handle : %p", muse_camera);
4825 ret = legacy_camera_attr_get_tilt(muse_camera->camera_handle, &get_value);
4826 if (ret == CAMERA_ERROR_NONE) {
4827 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
4828 MUSE_CAMERA_GET_INT_TILT, "get_value", get_value, NULL);
4830 muse_camera_msg_return(api, class, ret, module);
4833 return MUSE_CAMERA_ERROR_NONE;
4836 int camera_dispatcher_attr_get_tilt_range(muse_module_h module)
4838 int ret = CAMERA_ERROR_NONE;
4839 muse_camera_handle_s *muse_camera = NULL;
4842 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TILT_RANGE;
4843 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4844 muse_camera_get_type_e get_type = MUSE_CAMERA_GET_TYPE_INT_PAIR;
4845 muse_camera_get_int_pair_e index = MUSE_CAMERA_GET_INT_PAIR_TILT_RANGE;
4847 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4849 LOGD("handle : %p", muse_camera);
4851 ret = legacy_camera_attr_get_tilt_range(muse_camera->camera_handle, &get_value0, &get_value1);
4852 if (ret == CAMERA_ERROR_NONE)
4853 muse_camera_msg_return2(api, class, ret, module, get_type, index, get_value0, get_value1);
4855 muse_camera_msg_return(api, class, ret, module);
4857 return MUSE_CAMERA_ERROR_NONE;
4860 int camera_dispatcher_attr_set_ptz_type(muse_module_h module)
4862 int ret = CAMERA_ERROR_NONE;
4863 muse_camera_handle_s *muse_camera = NULL;
4864 int set_ptz_type = 0;
4865 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_PTZ_TYPE;
4866 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4868 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4870 muse_camera_msg_get(set_ptz_type, muse_core_client_get_msg(module));
4872 LOGD("handle : 0x%x", muse_camera);
4874 ret = legacy_camera_attr_set_ptz_type(muse_camera->camera_handle, set_ptz_type);
4876 LOGD("ret : 0x%x", ret);
4878 muse_camera_msg_return(api, class, ret, module);
4880 return MUSE_CAMERA_ERROR_NONE;
4883 int camera_dispatcher_attr_foreach_supported_ptz_type(muse_module_h module)
4885 int ret = CAMERA_ERROR_NONE;
4886 muse_camera_handle_s *muse_camera = NULL;
4887 muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_PTZ_TYPE;
4888 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB;
4890 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4892 LOGD("handle : %p", muse_camera);
4894 ret = legacy_camera_attr_foreach_supported_ptz_type(muse_camera->camera_handle,
4895 (camera_attr_supported_ptz_type_cb)_camera_dispatcher_callback_supported_ptz_type,
4898 LOGD("ret : 0x%x", ret);
4900 muse_camera_msg_return(api, class, ret, module);
4902 return MUSE_CAMERA_ERROR_NONE;
4905 int camera_dispatcher_attr_set_display_roi_area(muse_module_h module)
4907 int ret = CAMERA_ERROR_NONE;
4908 muse_camera_handle_s *muse_camera = NULL;
4909 int set_display_roi_area[4] = {0,};
4910 muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY_ROI_AREA;
4911 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4913 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4915 muse_camera_msg_get_array(set_display_roi_area, muse_core_client_get_msg(module));
4917 LOGD("handle : 0x%x, x : %d, y : %d, width : %d, height : %d", muse_camera,
4918 set_display_roi_area[0], set_display_roi_area[1], set_display_roi_area[2], set_display_roi_area[3]);
4920 ret = legacy_camera_attr_set_display_roi_area(muse_camera->camera_handle, set_display_roi_area);
4922 LOGD("ret : 0x%x", ret);
4924 muse_camera_msg_return(api, class, ret, module);
4926 return MUSE_CAMERA_ERROR_NONE;
4929 int camera_dispatcher_attr_get_display_roi_area(muse_module_h module)
4931 int ret = CAMERA_ERROR_NONE;
4932 muse_camera_handle_s *muse_camera = NULL;
4933 int get_value[4] = {0,};
4934 muse_camera_api_e api = MUSE_CAMERA_API_GET_DISPLAY_ROI_AREA;
4935 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
4936 char *send_msg = NULL;
4938 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4940 LOGD("handle : %p", muse_camera);
4942 ret = legacy_camera_attr_get_display_roi_area(muse_camera->camera_handle, get_value);
4943 if (ret == CAMERA_ERROR_NONE) {
4944 send_msg = muse_core_msg_json_factory_new(api,
4945 MUSE_TYPE_INT, PARAM_API_CLASS, class,
4946 MUSE_TYPE_INT, PARAM_RET, ret,
4947 MUSE_TYPE_INT, PARAM_GET_TYPE, MUSE_CAMERA_GET_TYPE_ARRAY,
4948 MUSE_TYPE_ARRAY, "get_value", 4, get_value,
4951 __camera_dispatcher_send_msg(module, send_msg);
4953 muse_camera_msg_return(api, class, ret, module);
4956 return MUSE_CAMERA_ERROR_NONE;
4960 int camera_dispatcher_return_buffer(muse_module_h module)
4963 muse_camera_handle_s *muse_camera = NULL;
4965 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4967 muse_camera_msg_get(tbm_key, muse_core_client_get_msg(module));
4969 /*LOGD("handle : %p, key : %d", muse_camera, tbm_key);*/
4971 if (!_camera_remove_export_data(module, tbm_key, FALSE))
4972 LOGE("remove export data failed : key %d", tbm_key);
4974 return MUSE_CAMERA_ERROR_NONE;
4977 int camera_dispatcher_preview_cb_return(muse_module_h module)
4979 muse_camera_handle_s *muse_camera = NULL;
4981 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
4983 if (muse_camera == NULL) {
4984 LOGE("NULL handle");
4985 return MUSE_CAMERA_ERROR_NONE;
4990 g_mutex_lock(&muse_camera->preview_cb_lock);
4991 g_cond_signal(&muse_camera->preview_cb_cond);
4992 /*LOGD("send signal for preview callback");*/
4993 g_mutex_unlock(&muse_camera->preview_cb_lock);
4997 return MUSE_CAMERA_ERROR_NONE;
5000 int camera_dispatcher_set_display_reuse_hint(muse_module_h module)
5002 int ret = CAMERA_ERROR_NONE;
5004 muse_camera_handle_s *muse_camera = NULL;
5005 muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY_REUSE_HINT;
5006 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
5008 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
5010 muse_camera_msg_get(set_hint, muse_core_client_get_msg(module));
5012 LOGD("set hint : %d", set_hint);
5014 ret = legacy_camera_set_display_reuse_hint(muse_camera->camera_handle, (bool)set_hint);
5016 muse_camera_msg_return(api, class, ret, module);
5018 return MUSE_CAMERA_ERROR_NONE;
5021 int camera_dispatcher_get_display_reuse_hint(muse_module_h module)
5023 int ret = CAMERA_ERROR_NONE;
5025 muse_camera_handle_s *muse_camera = NULL;
5026 muse_camera_api_e api = MUSE_CAMERA_API_GET_DISPLAY_REUSE_HINT;
5027 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
5029 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
5031 ret = legacy_camera_get_display_reuse_hint(muse_camera->camera_handle, &get_value);
5032 if (ret == CAMERA_ERROR_NONE) {
5033 LOGD("hint : %d", get_value);
5034 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
5035 MUSE_CAMERA_GET_INT_DISPLAY_REUSE_HINT, "get_value", get_value, NULL);
5037 muse_camera_msg_return(api, class, ret, module);
5040 return MUSE_CAMERA_ERROR_NONE;
5043 int camera_dispatcher_get_device_state(muse_module_h module)
5045 int ret = CAMERA_ERROR_NONE;
5046 int is_called = false;
5047 char value_key[KEY_LENGTH] = {'\0',};
5048 camera_h camera = NULL;
5049 camera_device_e device_type = CAMERA_DEVICE_CAMERA0;
5050 camera_device_state_e get_device_state = CAMERA_DEVICE_STATE_NULL;
5051 muse_camera_api_e api = MUSE_CAMERA_API_GET_DEVICE_STATE;
5052 muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
5054 muse_camera_msg_get(device_type, muse_core_client_get_msg(module));
5056 if (device_type > CAMERA_DEVICE_CAMERA1) {
5057 LOGE("invalid device %d", device_type);
5059 ret = CAMERA_ERROR_INVALID_PARAMETER;
5060 muse_camera_msg_return(api, class, ret, module);
5062 return MUSE_CAMERA_ERROR_NONE;
5065 muse_core_client_get_value(module, MUSED_KEY_DEVICE_STATE_CHECK, &is_called);
5068 ret = legacy_camera_create(device_type, &camera);
5070 legacy_camera_destroy(camera);
5074 muse_core_client_set_value(module, MUSED_KEY_DEVICE_STATE_RETURN, ret);
5075 muse_core_client_set_value(module, MUSED_KEY_DEVICE_STATE_CHECK, (int)true);
5077 muse_core_client_get_value(module, MUSED_KEY_DEVICE_STATE_RETURN, &ret);
5080 LOGD("is_called %d, ret 0x%x", is_called, ret);
5082 if (ret != CAMERA_ERROR_NONE) {
5083 LOGE("failed to create camera handle 0x%x", ret);
5085 muse_camera_msg_return(api, class, ret, module);
5087 return MUSE_CAMERA_ERROR_NONE;
5090 snprintf(value_key, KEY_LENGTH, "device_state_camera%d", device_type);
5091 muse_core_client_get_value(module, value_key, (int *)&get_device_state);
5093 LOGD("device[%d] state : %d", device_type, get_device_state);
5095 muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT,
5096 -1, "get_device_state", get_device_state, NULL);
5098 return MUSE_CAMERA_ERROR_NONE;
5101 int (*dispatcher[MUSE_CAMERA_API_MAX]) (muse_module_h module) = {
5102 camera_dispatcher_create, /* MUSE_CAMERA_API_CREATE */
5103 camera_dispatcher_destroy, /* MUSE_CAMERA_API_DESTROY */
5104 camera_dispatcher_start_preview, /* MUSE_CAMERA_START_PREVIEW */
5105 camera_dispatcher_stop_preview, /* MUSE_CAMERA_API_START_PREVIEW */
5106 camera_dispatcher_start_capture, /* MUSE_CAMERA_START_CAPTURE */
5107 camera_dispatcher_is_supported_continuous_capture, /* MUSE_CAMERA_API_SUPPORT_CONTINUOUS_CAPTURE */
5108 camera_dispatcher_start_continuous_capture, /* MUSE_CAMERA_API_START_CONTINUOUS_CAPTURE, */
5109 camera_dispatcher_stop_continuous_capture, /* MUSE_CAMERA_API_STOP_CONTINUOUS_CAPTURE, */
5110 camera_dispatcher_is_supported_face_detection, /* MUSE_CAMERA_API_SUPPORT_FACE_DETECTION, */
5111 camera_dispatcher_is_supported_zero_shutter_lag, /* MUSE_CAMERA_API_SUPPORT_ZERO_SHUTTER_LAG, */
5112 camera_dispatcher_is_supported_media_packet_preview_cb, /* MUSE_CAMERA_API_SUPPORT_MEDIA_PACKET_PREVIEW_CB, */
5113 camera_dispatcher_get_device_count, /* MUSE_CAMERA_API_GET_DEVICE_COUNT, */
5114 camera_dispatcher_start_face_detection, /* MUSE_CAMERA_API_START_FACE_DETECTION, */
5115 camera_dispatcher_stop_face_detection, /* MUSE_CAMERA_API_STOP_FACE_DETECTION, */
5116 camera_dispatcher_get_state, /* MUSE_CAMERA_API_GET_STATE, */
5117 camera_dispatcher_start_focusing, /* MUSE_CAMERA_API_START_FOCUSING, */
5118 camera_dispatcher_stop_focusing, /* MUSE_CAMERA_API_CANCEL_FOCUSING, */
5119 camera_dispatcher_set_display, /* MUSE_CAMERA_API_SET_DISPLAY, */
5120 camera_dispatcher_set_preview_resolution, /* MUSE_CAMERA_API_SET_PREVIEW_RESOLUTION, */
5121 camera_dispatcher_set_capture_resolution, /* MUSE_CAMERA_API_SET_CAPTURE_RESOLUTION, */
5122 camera_dispatcher_set_capture_format, /* MUSE_CAMERA_API_SET_CAPTURE_FORMAT, */
5123 camera_dispatcher_set_preview_format, /* MUSE_CAMERA_API_SET_PREVIEW_FORMAT, */
5124 camera_dispatcher_get_preview_resolution, /* MUSE_CAMERA_API_GET_PREVIEW_RESOLUTION, */
5125 camera_dispatcher_set_display_rotation, /* MUSE_CAMERA_API_SET_DISPLAY_ROTATION, */
5126 camera_dispatcher_get_display_rotation, /* MUSE_CAMERA_API_GET_DISPLAY_ROTATION, */
5127 camera_dispatcher_set_display_flip, /* MUSE_CAMERA_API_SET_DISPLAY_FLIP, */
5128 camera_dispatcher_get_display_flip, /* MUSE_CAMERA_API_GET_DISPLAY_FLIP, */
5129 camera_dispatcher_set_display_visible, /* MUSE_CAMERA_API_SET_DISPLAY_VISIBLE, */
5130 camera_dispatcher_is_display_visible, /* MUSE_CAMERA_API_IS_DISPLAY_VISIBLE, */
5131 camera_dispatcher_set_display_mode, /* MUSE_CAMERA_API_SET_DISPLAY_MODE, */
5132 camera_dispatcher_get_display_mode, /* MUSE_CAMERA_API_GET_DISPLAY_MODE, */
5133 camera_dispatcher_get_capture_resolution, /* MUSE_CAMERA_API_GET_CAPTURE_RESOLUTION, */
5134 camera_dispatcher_get_capture_format, /* MUSE_CAMERA_API_GET_CAPTURE_FORMAT, */
5135 camera_dispatcher_get_preview_format, /* MUSE_CAMERA_API_GET_PREVIEW_FORMAT, */
5136 camera_dispatcher_get_facing_direction, /* MUSE_CAMERA_API_GET_FACING_DIRECTION, */
5137 camera_dispatcher_get_flash_state, /* MUSE_CAMERA_API_GET_FLASH_STATE, */
5138 camera_dispatcher_set_preview_cb, /* MUSE_CAMERA_API_SET_PREVIEW_CB, */
5139 camera_dispatcher_unset_preview_cb, /* MUSE_CAMERA_API_UNSET_PREVIEW_CB, */
5140 camera_dispatcher_set_media_packet_preview_cb, /* MUSE_CAMERA_API_SET_MEDIA_PACKET_PREVIEW_CB, */
5141 camera_dispatcher_unset_media_packet_preview_cb, /* MUSE_CAMERA_API_UNSET_MEDIA_PACKET_PREVIEW_CB, */
5142 camera_dispatcher_set_state_changed_cb, /* MUSE_CAMERA_API_SET_STATE_CHANGED_CB, */
5143 camera_dispatcher_unset_state_changed_cb, /* MUSE_CAMERA_API_UNSET_STATE_CHANGED_CB, */
5144 camera_dispatcher_set_interrupted_cb, /* MUSE_CAMERA_API_SET_INTERRUPTED_CB, */
5145 camera_dispatcher_unset_interrupted_cb, /* MUSE_CAMERA_API_UNSET_INTERRUPTED_CB, */
5146 camera_dispatcher_set_focus_changed_cb, /* MUSE_CAMERA_API_SET_FOCUS_CHANGED_CB, */
5147 camera_dispatcher_unset_focus_changed_cb, /* MUSE_CAMERA_API_UNSET_FOCUS_CHANGED_CB, */
5148 camera_dispatcher_set_error_cb, /* MUSE_CAMERA_API_SET_ERROR_CB, */
5149 camera_dispatcher_unset_error_cb, /* MUSE_CAMERA_API_UNSET_ERROR_CB, */
5150 camera_dispatcher_foreach_supported_preview_resolution, /* MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_PREVIEW_RESOLUTION, */
5151 camera_dispatcher_foreach_supported_capture_resolution, /* MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_CAPTURE_RESOLUTION, */
5152 camera_dispatcher_foreach_supported_capture_format, /* MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_CAPTURE_FORMAT, */
5153 camera_dispatcher_foreach_supported_preview_format, /* MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_PREVIEW_FORMAT, */
5154 camera_dispatcher_get_recommended_preview_resolution, /* MUSE_CAMERA_API_GET_RECOMMENDED_PREVIEW_RESOLUTION, */
5155 camera_dispatcher_attr_get_lens_orientation, /* MUSE_CAMERA_API_ATTR_GET_LENS_ORIENTATION, */
5156 camera_dispatcher_attr_set_theater_mode, /* MUSE_CAMERA_API_ATTR_SET_THEATER_MODE, */
5157 camera_dispatcher_attr_get_theater_mode, /* MUSE_CAMERA_API_ATTR_GET_THEATER_MODE, */
5158 camera_dispatcher_attr_foreach_supported_theater_mode, /* MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_THEATER_MODE, */
5159 camera_dispatcher_attr_set_preview_fps, /* MUSE_CAMERA_API_ATTR_SET_PREVIEW_FPS, */
5160 camera_dispatcher_attr_set_image_quality, /* MUSE_CAMERA_API_ATTR_SET_IMAGE_QUALITY, */
5161 camera_dispatcher_attr_get_preview_fps, /* MUSE_CAMERA_API_ATTR_GET_PREVIEW_FPS, */
5162 camera_dispatcher_attr_get_image_quality, /* MUSE_CAMERA_API_ATTR_GET_IMAGE_QUALITY, */
5163 camera_dispatcher_attr_set_zoom, /* MUSE_CAMERA_API_ATTR_SET_ZOOM, */
5164 camera_dispatcher_attr_set_af_mode, /* MUSE_CAMERA_API_ATTR_SET_AF_MODE, */
5165 camera_dispatcher_attr_set_af_area, /* MUSE_CAMERA_API_ATTR_SET_AF_AREA, */
5166 camera_dispatcher_attr_clear_af_area, /* MUSE_CAMERA_API_ATTR_CLEAR_AF_AREA, */
5167 camera_dispatcher_attr_set_exposure_mode, /* MUSE_CAMERA_API_ATTR_SET_EXPOSURE_MODE, */
5168 camera_dispatcher_attr_set_exposure, /* MUSE_CAMERA_API_ATTR_SET_EXPOSURE, */
5169 camera_dispatcher_attr_set_iso, /* MUSE_CAMERA_API_ATTR_SET_ISO, */
5170 camera_dispatcher_attr_set_brightness, /* MUSE_CAMERA_API_ATTR_SET_BRIGHTNESS, */
5171 camera_dispatcher_attr_set_contrast, /* MUSE_CAMERA_API_ATTR_SET_CONTRAST, */
5172 camera_dispatcher_attr_set_whitebalance, /* MUSE_CAMERA_API_ATTR_SET_WHITEBALANCE, */
5173 camera_dispatcher_attr_set_effect, /* MUSE_CAMERA_API_ATTR_SET_EFFECT, */
5174 camera_dispatcher_attr_set_scene_mode, /* MUSE_CAMERA_API_ATTR_SET_SCENE_MODE, */
5175 camera_dispatcher_attr_enable_tag, /* MUSE_CAMERA_API_ATTR_ENABLE_TAG, */
5176 camera_dispatcher_attr_set_tag_image_description, /* MUSE_CAMERA_API_ATTR_SET_TAG_IMAGE_DESCRIPTION, */
5177 camera_dispatcher_attr_set_tag_orientation, /* MUSE_CAMERA_API_ATTR_SET_TAG_ORIENTATION, */
5178 camera_dispatcher_attr_set_tag_software, /* MUSE_CAMERA_API_ATTR_SET_TAG_SOFTWARE, */
5179 camera_dispatcher_attr_set_geotag, /* MUSE_CAMERA_API_ATTR_SET_GEOTAG, */
5180 camera_dispatcher_attr_remove_geotag, /* MUSE_CAMERA_API_ATTR_REMOVE_GEOTAG, */
5181 camera_dispatcher_attr_set_flash_mode, /* MUSE_CAMERA_API_ATTR_SET_FLASH_MODE, */
5182 camera_dispatcher_attr_get_zoom, /* MUSE_CAMERA_API_ATTR_GET_ZOOM, */
5183 camera_dispatcher_attr_get_zoom_range, /* MUSE_CAMERA_API_ATTR_GET_ZOOM_RANGE, */
5184 camera_dispatcher_attr_get_af_mode, /* MUSE_CAMERA_API_ATTR_GET_AF_MODE, */
5185 camera_dispatcher_attr_get_exposure_mode, /* MUSE_CAMERA_API_ATTR_GET_EXPOSURE_MODE, */
5186 camera_dispatcher_attr_get_exposure, /* MUSE_CAMERA_API_ATTR_GET_EXPOSURE, */
5187 camera_dispatcher_attr_get_exposure_range, /* MUSE_CAMERA_API_ATTR_GET_EXPOSURE_RANGE, */
5188 camera_dispatcher_attr_get_iso, /* MUSE_CAMERA_API_ATTR_GET_ISO, */
5189 camera_dispatcher_attr_get_brightness, /* MUSE_CAMERA_API_ATTR_GET_BRIGHTNESS, */
5190 camera_dispatcher_attr_get_brightness_range, /* MUSE_CAMERA_API_ATTR_GET_BRIGHTNESS_RANGE, */
5191 camera_dispatcher_attr_get_contrast, /* MUSE_CAMERA_API_ATTR_GET_CONTRAST, */
5192 camera_dispatcher_attr_get_contrast_range, /* MUSE_CAMERA_API_ATTR_GET_CONTRAST_RANGE, */
5193 camera_dispatcher_attr_get_whitebalance, /* MUSE_CAMERA_API_ATTR_GET_WHITEBALANCE, */
5194 camera_dispatcher_attr_get_effect, /* MUSE_CAMERA_API_ATTR_GET_EFFECT, */
5195 camera_dispatcher_attr_get_scene_mode, /* MUSE_CAMERA_API_ATTR_GET_SCENE_MODE, */
5196 camera_dispatcher_attr_is_enabled_tag, /* MUSE_CAMERA_API_ATTR_IS_ENABLED_TAG, */
5197 camera_dispatcher_attr_get_tag_image_description, /* MUSE_CAMERA_API_ATTR_GET_TAG_IMAGE_DESCRIPTION, */
5198 camera_dispatcher_attr_get_tag_orientation, /* MUSE_CAMERA_API_ATTR_GET_TAG_ORIENTATION, */
5199 camera_dispatcher_attr_get_tag_software, /* MUSE_CAMERA_API_ATTR_GET_TAG_SOFTWARE, */
5200 camera_dispatcher_attr_get_geotag, /* MUSE_CAMERA_API_ATTR_GET_GEOTAG, */
5201 camera_dispatcher_attr_get_flash_mode, /* MUSE_CAMERA_API_ATTR_GET_FLASH_MODE, */
5202 camera_dispatcher_attr_foreach_supported_af_mode, /* MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_AF_MODE, */
5203 camera_dispatcher_attr_foreach_supported_exposure_mode, /* MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_EXPOSURE_MODE, */
5204 camera_dispatcher_attr_foreach_supported_iso, /* MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_ISO, */
5205 camera_dispatcher_attr_foreach_supported_whitebalance, /* MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_WHITEBALANCE, */
5206 camera_dispatcher_attr_foreach_supported_effect, /* MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_EFFECT, */
5207 camera_dispatcher_attr_foreach_supported_scene_mode, /* MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_SCENE_MODE, */
5208 camera_dispatcher_attr_foreach_supported_flash_mode, /* MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FLASH_MODE, */
5209 camera_dispatcher_attr_foreach_supported_fps, /* MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FPS, */
5210 camera_dispatcher_attr_foreach_supported_fps_by_resolution, /* MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FPS_BY_RESOLUTION, */
5211 camera_dispatcher_attr_foreach_supported_stream_flip, /* MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_STREAM_FLIP, */
5212 camera_dispatcher_attr_foreach_supported_stream_rotation, /* MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_STREAM_ROTATION, */
5213 camera_dispatcher_attr_set_stream_rotation, /* MUSE_CAMERA_API_ATTR_SET_STREAM_ROTATION, */
5214 camera_dispatcher_attr_get_stream_rotation, /* MUSE_CAMERA_API_ATTR_GET_STREAM_ROTATION, */
5215 camera_dispatcher_attr_set_stream_flip, /* MUSE_CAMERA_API_ATTR_SET_STREAM_FLIP, */
5216 camera_dispatcher_attr_get_stream_flip, /* MUSE_CAMERA_API_ATTR_GET_STREAM_FLIP, */
5217 camera_dispatcher_attr_set_hdr_mode, /* MUSE_CAMERA_API_ATTR_SET_HDR_MODE, */
5218 camera_dispatcher_attr_get_hdr_mode, /* MUSE_CAMERA_API_ATTR_GET_HDR_MODE, */
5219 camera_dispatcher_attr_is_supported_hdr_capture, /* MUSE_CAMERA_API_ATTR_IS_SUPPORTED_HDR_CAPTURE, */
5220 camera_dispatcher_attr_set_hdr_capture_progress_cb, /* MUSE_CAMERA_API_ATTR_SET_HDR_CAPTURE_PROGRESS_CB, */
5221 camera_dispatcher_attr_unset_hdr_capture_progress_cb, /* MUSE_CAMERA_API_ATTR_UNSET_HDR_CAPTURE_PROGRESS_CB, */
5222 camera_dispatcher_attr_enable_anti_shake, /* MUSE_CAMERA_API_ATTR_ENABLE_ANTI_SHAKE, */
5223 camera_dispatcher_attr_is_enabled_anti_shake, /* MUSE_CAMERA_API_ATTR_IS_ENABLED_ANTI_SHAKE, */
5224 camera_dispatcher_attr_is_supported_anti_shake, /* MUSE_CAMERA_API_ATTR_IS_SUPPORTED_ANTI_SHAKE, */
5225 camera_dispatcher_attr_enable_video_stabilization, /* MUSE_CAMERA_API_ATTR_ENABLE_VIDEO_STABILIZATION, */
5226 camera_dispatcher_attr_is_enabled_video_stabilization, /* MUSE_CAMERA_API_ATTR_IS_ENABLED_VIDEO_STABILIZATION, */
5227 camera_dispatcher_attr_is_supported_video_stabilization, /* MUSE_CAMERA_API_ATTR_IS_SUPPORTED_VIDEO_STABILIZATION, */
5228 camera_dispatcher_attr_enable_auto_contrast, /* MUSE_CAMERA_API_ATTR_ENABLE_AUTO_CONTRAST, */
5229 camera_dispatcher_attr_is_enabled_auto_contrast, /* MUSE_CAMERA_API_ATTR_IS_ENABLED_AUTO_CONTRAST, */
5230 camera_dispatcher_attr_is_supported_auto_contrast, /* MUSE_CAMERA_API_ATTR_IS_SUPPORTED_AUTO_CONTRAST, */
5231 camera_dispatcher_attr_disable_shutter_sound, /* MUSE_CAMERA_API_ATTR_DISABLE_SHUTTER_SOUND, */
5232 camera_dispatcher_attr_get_encoded_preview_bitrate, /* MUSE_CAMERA_API_ATTR_GET_ENCODED_PREVIEW_BITRATE, */
5233 camera_dispatcher_attr_set_encoded_preview_bitrate, /* MUSE_CAMERA_API_ATTR_SET_ENCODED_PREVIEW_BITRATE, */
5234 camera_dispatcher_attr_get_encoded_preview_gop_interval, /* MUSE_CAMERA_API_ATTR_GET_ENCODED_PREVIEW_GOP_INTERVAL, */
5235 camera_dispatcher_attr_set_encoded_preview_gop_interval, /* MUSE_CAMERA_API_ATTR_SET_ENCODED_PREVIEW_GOP_INTERVAL, */
5236 camera_dispatcher_attr_set_pan, /* MUSE_CAMERA_API_ATTR_SET_PAN */
5237 camera_dispatcher_attr_get_pan, /* MUSE_CAMERA_API_ATTR_GET_PAN */
5238 camera_dispatcher_attr_get_pan_range, /* MUSE_CAMERA_API_ATTR_GET_PAN_RANGE */
5239 camera_dispatcher_attr_set_tilt, /* MUSE_CAMERA_API_ATTR_SET_TILT */
5240 camera_dispatcher_attr_get_tilt, /* MUSE_CAMERA_API_ATTR_GET_TILT */
5241 camera_dispatcher_attr_get_tilt_range, /* MUSE_CAMERA_API_ATTR_GET_TILT_RANGE */
5242 camera_dispatcher_attr_set_ptz_type, /* MUSE_CAMERA_API_ATTR_SET_PTZ_TYPE */
5243 camera_dispatcher_attr_foreach_supported_ptz_type, /* MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_PTZ_TYPE */
5244 camera_dispatcher_attr_set_display_roi_area, /* MUSE_CAMERA_API_SET_DISPLAY_ROI_AREA */
5245 camera_dispatcher_attr_get_display_roi_area, /* MUSE_CAMERA_API_GET_DISPLAY_ROI_AREA */
5246 camera_dispatcher_return_buffer, /* MUSE_CAMERA_API_RETURN_BUFFER */
5247 camera_dispatcher_preview_cb_return, /* MUSE_CAMERA_API_PREVIEW_CB_RETURN */
5248 camera_dispatcher_set_display_reuse_hint, /* MUSE_CAMERA_API_SET_DISPLAY_REUSE_HINT */
5249 camera_dispatcher_get_display_reuse_hint, /* MUSE_CAMERA_API_GET_DISPLAY_REUSE_HINT */
5250 camera_dispatcher_change_device, /* MUSE_CAMERA_API_CHANGE_DEVICE */
5251 camera_dispatcher_get_device_state, /* MUSE_CAMERA_API_GET_DEVICE_STATE */
5252 camera_dispatcher_set_interrupt_started_cb, /* MUSE_CAMERA_API_SET_INTERRUPT_STARTED_CB, */
5253 camera_dispatcher_unset_interrupt_started_cb /* MUSE_CAMERA_API_UNSET_INTERRUPT_STARTED_CB, */
5257 /******************/
5258 /* cmd dispatcher */
5259 /******************/
5260 static int camera_cmd_dispatcher_initialize(muse_module_h module)
5264 GstPlugin *plugin = NULL;
5266 const char *load_list[] = {
5267 LIBDIR"/gstreamer-1.0/libgstcoreelements.so",
5268 LIBDIR"/gstreamer-1.0/libgstcamerasrc.so",
5269 LIBDIR"/gstreamer-1.0/libgstwaylandsink.so",
5272 item_count = sizeof(load_list) / sizeof(load_list[0]);
5274 LOGD("item count %d", item_count);
5276 for (i = 0 ; i < item_count ; i++) {
5277 plugin = gst_plugin_load_file(load_list[i], NULL);
5279 LOGD("%s loaded", load_list[i]);
5280 gst_object_unref(plugin);
5283 LOGW("failed to load %s", load_list[i]);
5289 return MUSE_CAMERA_ERROR_NONE;
5293 static int camera_cmd_dispatcher_shutdown(muse_module_h module)
5295 muse_camera_handle_s *muse_camera = NULL;
5296 camera_state_e state = CAMERA_STATE_NONE;
5297 int capture_try_count = 0;
5300 muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module);
5301 if (muse_camera == NULL) {
5302 LOGE("NULL handle");
5303 return MUSE_CAMERA_ERROR_INVALID;
5306 legacy_camera_lock(muse_camera->camera_handle, true);
5308 if (legacy_camera_is_used(muse_camera->camera_handle)) {
5309 LOGW("camera is used in recorder.. wait...");
5310 if (legacy_camera_wait(muse_camera->camera_handle, 3000)) {
5311 LOGD("recorder is released");
5313 legacy_camera_lock(muse_camera->camera_handle, false);
5314 LOGE("wait timeout, could not release camera handle %p", muse_camera->camera_handle);
5315 return MUSE_CAMERA_ERROR_INVALID;
5319 legacy_camera_lock(muse_camera->camera_handle, false);
5321 muse_camera->is_shutting_down = true;
5324 legacy_camera_get_state(muse_camera->camera_handle, &state);
5326 LOGW("current state : %d", state);
5329 case CAMERA_STATE_CAPTURING:
5330 if (capture_try_count < 30) {
5331 LOGW("now capturing.. wait for capture data...");
5333 capture_try_count++;
5336 LOGE("wait capture data timeout! keep going...");
5339 case CAMERA_STATE_CAPTURED:
5340 legacy_camera_start_preview(muse_camera->camera_handle);
5342 case CAMERA_STATE_PREVIEW:
5343 _camera_remove_export_data(module, 0, TRUE); /* force return buffer before stop preview */
5344 legacy_camera_stop_preview(muse_camera->camera_handle);
5346 case CAMERA_STATE_CREATED:
5347 ret = legacy_camera_destroy(muse_camera->camera_handle);
5348 if (ret == CAMERA_ERROR_NONE)
5349 _camera_dispatcher_release_resource(module);
5351 LOGE("failed to destroy camera handle");
5360 return MUSE_CAMERA_ERROR_NONE;
5364 int (*cmd_dispatcher[MUSE_MODULE_COMMAND_MAX])(muse_module_h module) = {
5365 camera_cmd_dispatcher_initialize, /* MUSE_MODULE_COMMAND_INITIALIZE */
5366 camera_cmd_dispatcher_shutdown, /* MUSE_MODULE_COMMAND_SHUTDOWN */
5367 NULL, /* MUSE_MODULE_COMMAND_DEBUG_INFO_DUMP */
5368 NULL, /* MUSE_MODULE_COMMAND_CREATE_SERVER_ACK */
5369 NULL, /* MUSE_MODULE_COMMAND_RESOURCE_NOT_AVAILABLE */
5370 NULL /* MUSE_MODULE_COMMAND_EXTERNAL_STORAGE_STATE_CHANGED */