From f199b3ac86c19d4bc1addf9a0be96ec548e40f29 Mon Sep 17 00:00:00 2001 From: Jeongmo Yang Date: Thu, 7 Jul 2016 17:38:50 +0900 Subject: [PATCH 01/16] [Release version 0.2.41] 1. Add new dispatchers for new APIs 2. Remove unnecessary feature 3. Update code for capture completed callback in case of interrupt Change-Id: I96874365aaedc31cc59dda588e9366c70c6826ab Signed-off-by: Jeongmo Yang --- legacy/CMakeLists.txt | 7 ---- legacy/include/legacy_camera.h | 5 +++ legacy/include/legacy_camera_private.h | 4 +- legacy/src/legacy_camera.c | 70 +++++++++++++++++++++++++++------- legacy/src/legacy_camera_internal.c | 4 +- muse/CMakeLists.txt | 7 ---- muse/include/muse_camera.h | 2 + muse/include/muse_camera_internal.h | 2 - muse/src/muse_camera_dispatcher.c | 50 +++++++++++++++++++++--- packaging/mmsvc-camera.spec | 22 +---------- 10 files changed, 113 insertions(+), 60 deletions(-) diff --git a/legacy/CMakeLists.txt b/legacy/CMakeLists.txt index ba63123..faa8867 100644 --- a/legacy/CMakeLists.txt +++ b/legacy/CMakeLists.txt @@ -29,13 +29,6 @@ IF("${ARCH}" STREQUAL "arm") ADD_DEFINITIONS("-DTARGET") ENDIF("${ARCH}" STREQUAL "arm") -IF(WAYLAND_SUPPORT) - ADD_DEFINITIONS("-DHAVE_WAYLAND") -ENDIF(WAYLAND_SUPPORT) -IF(X11_SUPPORT) - ADD_DEFINITIONS("-DHAVE_X11") -ENDIF(X11_SUPPORT) - ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"") ADD_DEFINITIONS("-DTIZEN_DEBUG") diff --git a/legacy/include/legacy_camera.h b/legacy/include/legacy_camera.h index 84d47cd..b97d282 100644 --- a/legacy/include/legacy_camera.h +++ b/legacy/include/legacy_camera.h @@ -1328,6 +1328,11 @@ int legacy_camera_set_display_mode(camera_h camera , camera_display_mode_e mode) */ int legacy_camera_get_display_mode(camera_h camera, camera_display_mode_e *mode); + +int legacy_camera_set_display_reuse_hint(camera_h camera, int hint); + +int legacy_camera_get_display_reuse_hint(camera_h camera, int *hint); + /** * @brief Sets the resolution of the captured image. * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif diff --git a/legacy/include/legacy_camera_private.h b/legacy/include/legacy_camera_private.h index 0108530..0aef5ed 100644 --- a/legacy/include/legacy_camera_private.h +++ b/legacy/include/legacy_camera_private.h @@ -55,9 +55,7 @@ typedef struct _camera_s{ void* user_cb[_CAMERA_EVENT_TYPE_NUM]; void* user_data[_CAMERA_EVENT_TYPE_NUM]; void* display_handle; -#ifdef HAVE_WAYLAND MMCamWaylandInfo *wl_info; -#endif /* #ifdef HAVE_WAYLAND */ camera_display_type_e display_type; unsigned int state; @@ -83,6 +81,8 @@ typedef struct _camera_s{ GList *cb_data_list; GMutex idle_cb_lock; + + void *reuse_element; } camera_s; int _camera_get_mm_handle(camera_h camera , MMHandleType *handle); diff --git a/legacy/src/legacy_camera.c b/legacy/src/legacy_camera.c index 63229dd..b3f3e73 100644 --- a/legacy/src/legacy_camera.c +++ b/legacy/src/legacy_camera.c @@ -29,9 +29,7 @@ #include #include #include -#ifdef HAVE_WAYLAND #include -#endif /* HAVE_WAYLAND */ #include #ifdef LOG_TAG @@ -190,6 +188,7 @@ int __convert_camera_error_code(const char *func, int code) default: ret = CAMERA_ERROR_INVALID_OPERATION; errorstr = "INVALID_OPERATION"; + break; } if (code != MM_ERROR_NONE) { @@ -364,9 +363,6 @@ static int __mm_camera_message_callback(int message, void *param, void *user_dat break; } - previous_state = handle->state; - handle->state = __camera_state_convert(m->state.current ); - if (message == MM_MESSAGE_CAMCORDER_STATE_CHANGED_BY_ASM) { switch (m->state.code) { case MM_MSG_CODE_INTERRUPTED_BY_CALL_START: @@ -392,11 +388,25 @@ static int __mm_camera_message_callback(int message, void *param, void *user_dat LOGW("CAMERA_POLICY_RESOURCE_CONFLICT"); } + if (policy != CAMERA_POLICY_NONE && + handle->state == CAMERA_STATE_CAPTURING) { + handle->state = CAMERA_STATE_CAPTURED; + if (handle->user_cb[_CAMERA_EVENT_TYPE_STATE_CHANGE]) { + ((camera_state_changed_cb)handle->user_cb[_CAMERA_EVENT_TYPE_STATE_CHANGE])(CAMERA_STATE_CAPTURING, + handle->state, policy, handle->user_data[_CAMERA_EVENT_TYPE_STATE_CHANGE]); + } + + if (handle->user_cb[_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE]) { + ((camera_capture_completed_cb)handle->user_cb[_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE])(handle->user_data[_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE]); + } + } + + previous_state = handle->state; + handle->state = __camera_state_convert(m->state.current); + if (previous_state != handle->state && handle->user_cb[_CAMERA_EVENT_TYPE_STATE_CHANGE]) { ((camera_state_changed_cb)handle->user_cb[_CAMERA_EVENT_TYPE_STATE_CHANGE])(previous_state, - handle->state, - policy, - handle->user_data[_CAMERA_EVENT_TYPE_STATE_CHANGE]); + handle->state, policy, handle->user_data[_CAMERA_EVENT_TYPE_STATE_CHANGE]); } /* should change intermediate state MM_CAMCORDER_STATE_READY is not valid in capi , change to NULL state */ @@ -404,9 +414,7 @@ static int __mm_camera_message_callback(int message, void *param, void *user_dat m->state.current == MM_CAMCORDER_STATE_NULL) { if (handle->user_cb[_CAMERA_EVENT_TYPE_INTERRUPTED]) { ((camera_interrupted_cb)handle->user_cb[_CAMERA_EVENT_TYPE_INTERRUPTED])(policy, - previous_state, - handle->state, - handle->user_data[_CAMERA_EVENT_TYPE_INTERRUPTED]); + previous_state, handle->state, handle->user_data[_CAMERA_EVENT_TYPE_INTERRUPTED]); } else { LOGW("_CAMERA_EVENT_TYPE_INTERRUPTED cb is NULL"); } @@ -686,12 +694,12 @@ int legacy_camera_destroy(camera_h camera) if (ret == MM_ERROR_NONE) { _camera_remove_cb_message(handle); g_mutex_clear(&handle->idle_cb_lock); -#ifdef HAVE_WAYLAND + if (handle->wl_info) { free(handle->wl_info); handle->wl_info = NULL; } -#endif /* HAVE_WAYLAND */ + free(handle); } @@ -1965,6 +1973,42 @@ int legacy_camera_unset_error_cb(camera_h camera) } +int legacy_camera_set_display_reuse_hint(camera_h camera, int hint) +{ + int ret = CAMERA_ERROR_NONE; + camera_s *handle = (camera_s *)camera; + + if (!handle) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, + MMCAM_DISPLAY_REUSE_HINT, hint, + NULL); + + return __convert_camera_error_code(__func__, ret); +} + + +int legacy_camera_get_display_reuse_hint(camera_h camera, int *hint) +{ + int ret = CAMERA_ERROR_NONE; + camera_s *handle = (camera_s *)camera; + + if (!handle || !hint) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, + MMCAM_DISPLAY_REUSE_HINT, hint, + NULL); + + return __convert_camera_error_code(__func__, ret); +} + + int legacy_camera_foreach_supported_preview_resolution(camera_h camera, camera_supported_preview_resolution_cb foreach_cb, void *user_data) { if (camera == NULL || foreach_cb == NULL) { diff --git a/legacy/src/legacy_camera_internal.c b/legacy/src/legacy_camera_internal.c index 126ef4f..f05fc67 100644 --- a/legacy/src/legacy_camera_internal.c +++ b/legacy/src/legacy_camera_internal.c @@ -38,12 +38,10 @@ int legacy_camera_get_video_caps(camera_h camera, char **caps) int ret; camera_s *handle = (camera_s *)camera; -#ifdef HAVE_WAYLAND ret = mm_camcorder_get_video_caps(handle->mm_handle, caps); - if(ret != MM_ERROR_NONE) { + if (ret != MM_ERROR_NONE) { return __convert_camera_error_code(__func__, ret); } -#endif /* HAVE_WAYLAND */ return CAMERA_ERROR_NONE; } diff --git a/muse/CMakeLists.txt b/muse/CMakeLists.txt index 25cdcdb..ac4a5fe 100644 --- a/muse/CMakeLists.txt +++ b/muse/CMakeLists.txt @@ -26,13 +26,6 @@ IF("${ARCH}" STREQUAL "arm") ADD_DEFINITIONS("-DTARGET") ENDIF("${ARCH}" STREQUAL "arm") -IF(WAYLAND_SUPPORT) - ADD_DEFINITIONS("-DHAVE_WAYLAND") -ENDIF(WAYLAND_SUPPORT) -IF(X11_SUPPORT) - ADD_DEFINITIONS("-DHAVE_X11") -ENDIF(X11_SUPPORT) - ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"") ADD_DEFINITIONS("-DTIZEN_DEBUG") diff --git a/muse/include/muse_camera.h b/muse/include/muse_camera.h index f16ea6c..0a40047 100644 --- a/muse/include/muse_camera.h +++ b/muse/include/muse_camera.h @@ -182,6 +182,8 @@ typedef enum { MUSE_CAMERA_API_GET_DISPLAY_ROI_AREA, MUSE_CAMERA_API_RETURN_BUFFER, MUSE_CAMERA_API_PREVIEW_CB_RETURN, //145 + MUSE_CAMERA_API_SET_DISPLAY_REUSE_HINT, + MUSE_CAMERA_API_GET_DISPLAY_REUSE_HINT, MUSE_CAMERA_API_MAX } muse_camera_api_e; diff --git a/muse/include/muse_camera_internal.h b/muse/include/muse_camera_internal.h index a12a5ec..1637990 100644 --- a/muse/include/muse_camera_internal.h +++ b/muse/include/muse_camera_internal.h @@ -44,9 +44,7 @@ typedef struct { GMutex preview_cb_lock; GCond preview_cb_cond; guint preview_cb_flag; -#ifdef HAVE_WAYLAND MMCamWaylandInfo wl_info; -#endif /* HAVE_WAYLAND */ } muse_camera_handle_s; diff --git a/muse/src/muse_camera_dispatcher.c b/muse/src/muse_camera_dispatcher.c index d99e061..8e61bd4 100644 --- a/muse/src/muse_camera_dispatcher.c +++ b/muse/src/muse_camera_dispatcher.c @@ -1444,9 +1444,7 @@ int camera_dispatcher_set_display(muse_module_h module) muse_camera_handle_s *muse_camera = NULL; muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY; muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; -#ifdef HAVE_WAYLAND MMCamWaylandInfo *wl_info = NULL; -#endif /* HAVE_WAYLAND */ camera_display_type_e type = CAMERA_DISPLAY_TYPE_NONE; camera_h camera = NULL;; @@ -1459,7 +1457,7 @@ int camera_dispatcher_set_display(muse_module_h module) muse_camera_msg_get(type, muse_core_client_get_msg(module)); LOGD("type %d", type); -#ifdef HAVE_WAYLAND + if (type == CAMERA_DISPLAY_TYPE_OVERLAY) { wl_info = &muse_camera->wl_info; muse_camera_msg_get_array(wl_info, muse_core_client_get_msg(module)); @@ -1472,7 +1470,6 @@ int camera_dispatcher_set_display(muse_module_h module) muse_camera_msg_return(api, class, ret, module); } else { -#endif /* HAVE_WAYLAND */ LOGD("NOT overlay type. set NONE type."); if (type == CAMERA_DISPLAY_TYPE_EVAS) { @@ -1487,9 +1484,7 @@ int camera_dispatcher_set_display(muse_module_h module) ret = legacy_camera_set_display(muse_camera->camera_handle, CAMERA_DISPLAY_TYPE_NONE, NULL); muse_camera_msg_return(api, class, ret, module); -#ifdef HAVE_WAYLAND } -#endif /* HAVE_WAYLAND */ return MUSE_CAMERA_ERROR_NONE; } @@ -4390,6 +4385,47 @@ int camera_dispatcher_preview_cb_return(muse_module_h module) return MUSE_CAMERA_ERROR_NONE; } +int camera_dispatcher_set_display_reuse_hint(muse_module_h module) +{ + int ret = CAMERA_ERROR_NONE; + int set_hint = 0; + muse_camera_handle_s *muse_camera = NULL; + muse_camera_api_e api = MUSE_CAMERA_API_SET_DISPLAY_REUSE_HINT; + muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; + + muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module); + + muse_camera_msg_get(set_hint, muse_core_client_get_msg(module)); + + LOGD("set hint : %d", set_hint); + + ret = legacy_camera_set_display_reuse_hint(muse_camera->camera_handle, (bool)set_hint); + + muse_camera_msg_return(api, class, ret, module); + + return MUSE_CAMERA_ERROR_NONE; +} + +int camera_dispatcher_get_display_reuse_hint(muse_module_h module) +{ + int ret = CAMERA_ERROR_NONE; + int get_hint = 0; + muse_camera_handle_s *muse_camera = NULL; + muse_camera_api_e api = MUSE_CAMERA_API_GET_DISPLAY_REUSE_HINT; + muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; + + muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module); + + ret = legacy_camera_get_display_reuse_hint(muse_camera->camera_handle, &get_hint); + if (ret == CAMERA_ERROR_NONE) { + LOGD("get hint : %d", get_hint); + muse_camera_msg_return1(api, class, ret, module, INT, get_hint); + } else { + muse_camera_msg_return(api, class, ret, module); + } + + return MUSE_CAMERA_ERROR_NONE; +} int (*dispatcher[MUSE_CAMERA_API_MAX]) (muse_module_h module) = { camera_dispatcher_create, /* MUSE_CAMERA_API_CREATE */ @@ -4538,6 +4574,8 @@ int (*dispatcher[MUSE_CAMERA_API_MAX]) (muse_module_h module) = { camera_dispatcher_attr_get_display_roi_area, /* MUSE_CAMERA_API_GET_DISPLAY_ROI_AREA */ camera_dispatcher_return_buffer, /* MUSE_CAMERA_API_RETURN_BUFFER, */ camera_dispatcher_preview_cb_return, /* MUSE_CAMERA_API_PREVIEW_CB_RETURN, */ + camera_dispatcher_set_display_reuse_hint, /* MUSE_CAMERA_API_SET_DISPLAY_REUSE_HINT, */ + camera_dispatcher_get_display_reuse_hint, /* MUSE_CAMERA_API_GET_DISPLAY_REUSE_HINT, */ }; diff --git a/packaging/mmsvc-camera.spec b/packaging/mmsvc-camera.spec index 2de8658..618cead 100644 --- a/packaging/mmsvc-camera.spec +++ b/packaging/mmsvc-camera.spec @@ -1,9 +1,6 @@ -%bcond_with wayland -%bcond_with x - Name: mmsvc-camera Summary: A Camera module for muse server -Version: 0.2.40 +Version: 0.2.41 Release: 0 Group: Multimedia/Libraries License: Apache-2.0 @@ -14,12 +11,7 @@ BuildRequires: pkgconfig(dlog) BuildRequires: pkgconfig(mused) BuildRequires: pkgconfig(mm-camcorder) BuildRequires: pkgconfig(capi-base-common) -%if %{with x} -BuildRequires: pkgconfig(ecore-x) -%endif -%if %{with wayland} BuildRequires: pkgconfig(ecore-wayland) -%endif BuildRequires: pkgconfig(libtbm) BuildRequires: pkgconfig(evas) BuildRequires: pkgconfig(ecore) @@ -52,17 +44,7 @@ Development related files of a Camera module for muse server. export CFLAGS+=" -DTIZEN_DEBUG_ENABLE" %endif MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'` -%cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DFULLVER=%{version} -DMAJORVER=${MAJORVER} \ -%if %{with wayland} - -DWAYLAND_SUPPORT=On \ -%else - -DWAYLAND_SUPPORT=Off \ -%endif -%if %{with x} - -DX11_SUPPORT=On -%else - -DX11_SUPPORT=Off -%endif +%cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DFULLVER=%{version} -DMAJORVER=${MAJORVER} make %{?jobs:-j%jobs} -- 2.7.4 From 9e384aff4b17c5d789aa288527f772dd0816be38 Mon Sep 17 00:00:00 2001 From: Haesu Gwon Date: Thu, 14 Jul 2016 16:11:57 +0900 Subject: [PATCH 02/16] [Release version 0.2.42] Fix Tizen coding rule violation Change-Id: Idb391dd904dea4e90b5e1259f747a323af28d4d7 Signed-off-by: Haesu Gwon --- legacy/include/legacy_camera.h | 412 +++++++-------- legacy/include/legacy_camera_private.h | 4 +- legacy/src/legacy_camera.c | 902 +++++++++++++++------------------ legacy/src/legacy_camera_internal.c | 7 +- muse/include/muse_camera.h | 78 +-- muse/include/muse_camera_msg.h | 86 ++-- muse/src/muse_camera_dispatcher.c | 358 ++++++------- packaging/mmsvc-camera.spec | 2 +- 8 files changed, 868 insertions(+), 981 deletions(-) diff --git a/legacy/include/legacy_camera.h b/legacy/include/legacy_camera.h index b97d282..0e2b83b 100644 --- a/legacy/include/legacy_camera.h +++ b/legacy/include/legacy_camera.h @@ -41,55 +41,51 @@ extern "C" { * @brief Enumeration for the error codes of Camera. * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ -typedef enum -{ - CAMERA_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */ - CAMERA_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */ - CAMERA_ERROR_INVALID_STATE = CAMERA_ERROR_CLASS | 0x02, /**< Invalid state */ - CAMERA_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */ - CAMERA_ERROR_DEVICE = CAMERA_ERROR_CLASS | 0x04, /**< Device error */ - CAMERA_ERROR_INVALID_OPERATION = TIZEN_ERROR_INVALID_OPERATION, /**< Internal error */ - CAMERA_ERROR_SOUND_POLICY = CAMERA_ERROR_CLASS | 0x06, /**< Blocked by Audio Session Manager (Deprecated since 3.0) */ - CAMERA_ERROR_SECURITY_RESTRICTED = CAMERA_ERROR_CLASS | 0x07, /**< Restricted by security system policy */ - CAMERA_ERROR_DEVICE_BUSY = CAMERA_ERROR_CLASS | 0x08, /**< The device is using another application or working on some operation */ - CAMERA_ERROR_DEVICE_NOT_FOUND = CAMERA_ERROR_CLASS | 0x09, /**< No camera device */ - CAMERA_ERROR_SOUND_POLICY_BY_CALL = CAMERA_ERROR_CLASS | 0x0a, /**< Blocked by Audio Session Manager - CALL (Deprecated since 3.0) */ - CAMERA_ERROR_SOUND_POLICY_BY_ALARM = CAMERA_ERROR_CLASS | 0x0b, /**< Blocked by Audio Session Manager - ALARM (Deprecated since 3.0) */ - CAMERA_ERROR_ESD = CAMERA_ERROR_CLASS | 0x0c, /**< ESD situation */ - CAMERA_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< The access to the resources can not be granted*/ - CAMERA_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< The feature is not supported */ - CAMERA_ERROR_RESOURCE_CONFLICT = CAMERA_ERROR_CLASS | 0x0d, /**< Blocked by resource conflict (Since 3.0) */ +typedef enum { + CAMERA_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */ + CAMERA_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */ + CAMERA_ERROR_INVALID_STATE = CAMERA_ERROR_CLASS | 0x02, /**< Invalid state */ + CAMERA_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */ + CAMERA_ERROR_DEVICE = CAMERA_ERROR_CLASS | 0x04, /**< Device error */ + CAMERA_ERROR_INVALID_OPERATION = TIZEN_ERROR_INVALID_OPERATION, /**< Internal error */ + CAMERA_ERROR_SOUND_POLICY = CAMERA_ERROR_CLASS | 0x06, /**< Blocked by Audio Session Manager (Deprecated since 3.0) */ + CAMERA_ERROR_SECURITY_RESTRICTED = CAMERA_ERROR_CLASS | 0x07, /**< Restricted by security system policy */ + CAMERA_ERROR_DEVICE_BUSY = CAMERA_ERROR_CLASS | 0x08, /**< The device is using another application or working on some operation */ + CAMERA_ERROR_DEVICE_NOT_FOUND = CAMERA_ERROR_CLASS | 0x09, /**< No camera device */ + CAMERA_ERROR_SOUND_POLICY_BY_CALL = CAMERA_ERROR_CLASS | 0x0a, /**< Blocked by Audio Session Manager - CALL (Deprecated since 3.0) */ + CAMERA_ERROR_SOUND_POLICY_BY_ALARM = CAMERA_ERROR_CLASS | 0x0b, /**< Blocked by Audio Session Manager - ALARM (Deprecated since 3.0) */ + CAMERA_ERROR_ESD = CAMERA_ERROR_CLASS | 0x0c, /**< ESD situation */ + CAMERA_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< The access to the resources can not be granted*/ + CAMERA_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< The feature is not supported */ + CAMERA_ERROR_RESOURCE_CONFLICT = CAMERA_ERROR_CLASS | 0x0d, /**< Blocked by resource conflict (Since 3.0) */ } camera_error_e; /** * @brief Enumeration for the camera state. * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ -typedef enum -{ - CAMERA_STATE_NONE, /**< Before creating */ - CAMERA_STATE_CREATED, /**< Created, but not initialized yet */ - CAMERA_STATE_PREVIEW, /**< Preview */ - CAMERA_STATE_CAPTURING, /**< While capturing */ - CAMERA_STATE_CAPTURED /**< After capturing */ +typedef enum { + CAMERA_STATE_NONE, /**< Before creating */ + CAMERA_STATE_CREATED, /**< Created, but not initialized yet */ + CAMERA_STATE_PREVIEW, /**< Preview */ + CAMERA_STATE_CAPTURING, /**< While capturing */ + CAMERA_STATE_CAPTURED /**< After capturing */ } camera_state_e; /** * @brief Enumeration for the camera device. * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ -typedef enum -{ - CAMERA_DEVICE_CAMERA0 = 0, /**< Primary camera */ - CAMERA_DEVICE_CAMERA1 /**< Secondary camera */ +typedef enum { + CAMERA_DEVICE_CAMERA0 = 0, /**< Primary camera */ + CAMERA_DEVICE_CAMERA1 /**< Secondary camera */ } camera_device_e; /** * @brief Enumeration for the camera pixel format. * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ -typedef enum -{ +typedef enum { CAMERA_PIXEL_FORMAT_INVALID = -1, /**< Invalid pixel format */ CAMERA_PIXEL_FORMAT_NV12, /**< NV12 pixel format */ CAMERA_PIXEL_FORMAT_NV12T, /**< NV12 Tiled pixel format */ @@ -112,8 +108,7 @@ typedef enum * @brief Enumeration for the camera display type. * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ -typedef enum -{ +typedef enum { CAMERA_DISPLAY_TYPE_OVERLAY = 0, /**< Overlay surface display */ CAMERA_DISPLAY_TYPE_EVAS, /**< Evas object surface display */ CAMERA_DISPLAY_TYPE_NONE, /**< This disposes off buffers */ @@ -124,8 +119,7 @@ typedef enum * @brief Enumeration for the camera policy. * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ -typedef enum -{ +typedef enum { CAMERA_POLICY_NONE = 0, /**< None */ CAMERA_POLICY_SOUND, /**< Sound policy (Deprecated since 3.0) */ CAMERA_POLICY_SOUND_BY_CALL, /**< Sound policy by CALL (Deprecated since 3.0) */ @@ -138,8 +132,7 @@ typedef enum * @brief Enumeration for the camera rotation type. * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ -typedef enum -{ +typedef enum { CAMERA_ROTATION_NONE, /**< No rotation */ CAMERA_ROTATION_90, /**< 90 degree rotation */ CAMERA_ROTATION_180, /**< 180 degree rotation */ @@ -151,8 +144,7 @@ typedef enum * @brief Enumeration for the camera flip type. * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ -typedef enum -{ +typedef enum { CAMERA_FLIP_NONE, /**< No Flip */ CAMERA_FLIP_HORIZONTAL, /**< Horizontal flip */ CAMERA_FLIP_VERTICAL, /**< Vertical flip */ @@ -163,12 +155,11 @@ typedef enum * @brief Enumeration for the camera focus state. * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ -typedef enum -{ - CAMERA_FOCUS_STATE_RELEASED = 0, /**< Focus released */ - CAMERA_FOCUS_STATE_ONGOING, /**< Focus in progress */ - CAMERA_FOCUS_STATE_FOCUSED, /**< Focus succeeded */ - CAMERA_FOCUS_STATE_FAILED, /**< Focus failed */ +typedef enum { + CAMERA_FOCUS_STATE_RELEASED = 0, /**< Focus released */ + CAMERA_FOCUS_STATE_ONGOING, /**< Focus in progress */ + CAMERA_FOCUS_STATE_FOCUSED, /**< Focus succeeded */ + CAMERA_FOCUS_STATE_FAILED, /**< Focus failed */ } camera_focus_state_e; /** @@ -193,8 +184,7 @@ typedef enum { * @brief The structure type of the image data. * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ - typedef struct -{ +typedef struct { unsigned char *data; /**< The image buffer */ unsigned int size; /**< The size of the buffer */ int width; /**< The width of the image */ @@ -208,8 +198,7 @@ typedef enum { * @brief The structure type for face detection. * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ -typedef struct -{ +typedef struct { int id; /**< The ID of each face */ int score; /**< The confidence level for the detection of the face */ int x; /**< The x coordinates of the face */ @@ -222,8 +211,7 @@ typedef struct * @brief The structure type to preview stream data. * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ -typedef struct -{ +typedef struct { camera_pixel_format_e format; /**< The format of the frame pixel */ int width; /**< The width of the frame */ int height; /**< The height of the frame */ @@ -272,7 +260,7 @@ typedef void *camera_display_h; * @brief Gets a display handle. * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ -#define GET_DISPLAY(x) (void*)(x) +#define GET_DISPLAY(x) (void *)(x) #endif @@ -289,8 +277,7 @@ typedef void *camera_display_h; * @brief Enumeration for the camera display mode. * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ -typedef enum -{ +typedef enum { CAMERA_DISPLAY_MODE_LETTER_BOX = 0, /**< Letter box */ CAMERA_DISPLAY_MODE_ORIGIN_SIZE, /**< Origin size */ CAMERA_DISPLAY_MODE_FULL, /**< Full screen */ @@ -312,57 +299,55 @@ typedef enum * @brief Enumeration for the color tone, which provides the impression of looking through a tinted glass. * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ -typedef enum -{ - CAMERA_ATTR_EFFECT_NONE = 0, /**< None */ - CAMERA_ATTR_EFFECT_MONO, /**< Mono */ - CAMERA_ATTR_EFFECT_SEPIA, /**< Sepia */ - CAMERA_ATTR_EFFECT_NEGATIVE, /**< Negative */ - CAMERA_ATTR_EFFECT_BLUE, /**< Blue */ - CAMERA_ATTR_EFFECT_GREEN, /**< Green */ - CAMERA_ATTR_EFFECT_AQUA, /**< Aqua */ - CAMERA_ATTR_EFFECT_VIOLET, /**< Violet */ - CAMERA_ATTR_EFFECT_ORANGE, /**< Orange */ - CAMERA_ATTR_EFFECT_GRAY, /**< Gray */ - CAMERA_ATTR_EFFECT_RED, /**< Red */ - CAMERA_ATTR_EFFECT_ANTIQUE, /**< Antique */ - CAMERA_ATTR_EFFECT_WARM, /**< Warm */ - CAMERA_ATTR_EFFECT_PINK, /**< Pink */ - CAMERA_ATTR_EFFECT_YELLOW, /**< Yellow */ - CAMERA_ATTR_EFFECT_PURPLE, /**< Purple */ - CAMERA_ATTR_EFFECT_EMBOSS, /**< Emboss */ - CAMERA_ATTR_EFFECT_OUTLINE, /**< Outline */ - CAMERA_ATTR_EFFECT_SOLARIZATION, /**< Solarization */ - CAMERA_ATTR_EFFECT_SKETCH, /**< Sketch */ - CAMERA_ATTR_EFFECT_WASHED, /**< Washed */ - CAMERA_ATTR_EFFECT_VINTAGE_WARM, /**< Vintage warm */ - CAMERA_ATTR_EFFECT_VINTAGE_COLD, /**< Vintage cold */ - CAMERA_ATTR_EFFECT_POSTERIZATION, /**< Posterization */ - CAMERA_ATTR_EFFECT_CARTOON, /**< Cartoon */ - CAMERA_ATTR_EFFECT_SELECTIVE_RED, /**< Selective color - Red */ - CAMERA_ATTR_EFFECT_SELECTIVE_GREEN, /**< Selective color - Green */ - CAMERA_ATTR_EFFECT_SELECTIVE_BLUE, /**< Selective color - Blue */ - CAMERA_ATTR_EFFECT_SELECTIVE_YELLOW, /**< Selective color - Yellow */ - CAMERA_ATTR_EFFECT_SELECTIVE_RED_YELLOW, /**< Selective color - Red and Yellow */ - CAMERA_ATTR_EFFECT_OTHER_GRAPHICS, /**< Other Graphic effects */ +typedef enum { + CAMERA_ATTR_EFFECT_NONE = 0, /**< None */ + CAMERA_ATTR_EFFECT_MONO, /**< Mono */ + CAMERA_ATTR_EFFECT_SEPIA, /**< Sepia */ + CAMERA_ATTR_EFFECT_NEGATIVE, /**< Negative */ + CAMERA_ATTR_EFFECT_BLUE, /**< Blue */ + CAMERA_ATTR_EFFECT_GREEN, /**< Green */ + CAMERA_ATTR_EFFECT_AQUA, /**< Aqua */ + CAMERA_ATTR_EFFECT_VIOLET, /**< Violet */ + CAMERA_ATTR_EFFECT_ORANGE, /**< Orange */ + CAMERA_ATTR_EFFECT_GRAY, /**< Gray */ + CAMERA_ATTR_EFFECT_RED, /**< Red */ + CAMERA_ATTR_EFFECT_ANTIQUE, /**< Antique */ + CAMERA_ATTR_EFFECT_WARM, /**< Warm */ + CAMERA_ATTR_EFFECT_PINK, /**< Pink */ + CAMERA_ATTR_EFFECT_YELLOW, /**< Yellow */ + CAMERA_ATTR_EFFECT_PURPLE, /**< Purple */ + CAMERA_ATTR_EFFECT_EMBOSS, /**< Emboss */ + CAMERA_ATTR_EFFECT_OUTLINE, /**< Outline */ + CAMERA_ATTR_EFFECT_SOLARIZATION, /**< Solarization */ + CAMERA_ATTR_EFFECT_SKETCH, /**< Sketch */ + CAMERA_ATTR_EFFECT_WASHED, /**< Washed */ + CAMERA_ATTR_EFFECT_VINTAGE_WARM, /**< Vintage warm */ + CAMERA_ATTR_EFFECT_VINTAGE_COLD, /**< Vintage cold */ + CAMERA_ATTR_EFFECT_POSTERIZATION, /**< Posterization */ + CAMERA_ATTR_EFFECT_CARTOON, /**< Cartoon */ + CAMERA_ATTR_EFFECT_SELECTIVE_RED, /**< Selective color - Red */ + CAMERA_ATTR_EFFECT_SELECTIVE_GREEN, /**< Selective color - Green */ + CAMERA_ATTR_EFFECT_SELECTIVE_BLUE, /**< Selective color - Blue */ + CAMERA_ATTR_EFFECT_SELECTIVE_YELLOW, /**< Selective color - Yellow */ + CAMERA_ATTR_EFFECT_SELECTIVE_RED_YELLOW, /**< Selective color - Red and Yellow */ + CAMERA_ATTR_EFFECT_OTHER_GRAPHICS, /**< Other Graphic effects */ } camera_attr_effect_mode_e; /** * @brief Enumeration for the white balance levels of the camera. * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ -typedef enum -{ - CAMERA_ATTR_WHITE_BALANCE_NONE = 0, /**< None */ - CAMERA_ATTR_WHITE_BALANCE_AUTOMATIC, /**< Automatic */ - CAMERA_ATTR_WHITE_BALANCE_DAYLIGHT, /**< Daylight */ - CAMERA_ATTR_WHITE_BALANCE_CLOUDY, /**< Cloudy */ - CAMERA_ATTR_WHITE_BALANCE_FLUORESCENT, /**< Fluorescent */ - CAMERA_ATTR_WHITE_BALANCE_INCANDESCENT, /**< Incandescent */ - CAMERA_ATTR_WHITE_BALANCE_SHADE, /**< Shade */ - CAMERA_ATTR_WHITE_BALANCE_HORIZON, /**< Horizon */ - CAMERA_ATTR_WHITE_BALANCE_FLASH, /**< Flash */ - CAMERA_ATTR_WHITE_BALANCE_CUSTOM, /**< Custom */ +typedef enum { + CAMERA_ATTR_WHITE_BALANCE_NONE = 0, /**< None */ + CAMERA_ATTR_WHITE_BALANCE_AUTOMATIC, /**< Automatic */ + CAMERA_ATTR_WHITE_BALANCE_DAYLIGHT, /**< Daylight */ + CAMERA_ATTR_WHITE_BALANCE_CLOUDY, /**< Cloudy */ + CAMERA_ATTR_WHITE_BALANCE_FLUORESCENT, /**< Fluorescent */ + CAMERA_ATTR_WHITE_BALANCE_INCANDESCENT, /**< Incandescent */ + CAMERA_ATTR_WHITE_BALANCE_SHADE, /**< Shade */ + CAMERA_ATTR_WHITE_BALANCE_HORIZON, /**< Horizon */ + CAMERA_ATTR_WHITE_BALANCE_FLASH, /**< Flash */ + CAMERA_ATTR_WHITE_BALANCE_CUSTOM, /**< Custom */ } camera_attr_whitebalance_e; /** @@ -370,124 +355,116 @@ typedef enum * @details The mode of operation can be in daylight, night, or back-light. * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ -typedef enum -{ - CAMERA_ATTR_SCENE_MODE_NORMAL = 0, /**< Normal */ - CAMERA_ATTR_SCENE_MODE_PORTRAIT, /**< Portrait */ - CAMERA_ATTR_SCENE_MODE_LANDSCAPE, /**< Landscape */ - CAMERA_ATTR_SCENE_MODE_SPORTS, /**< Sports */ - CAMERA_ATTR_SCENE_MODE_PARTY_N_INDOOR, /**< Party & indoor */ - CAMERA_ATTR_SCENE_MODE_BEACH_N_INDOOR, /**< Beach & indoor */ - CAMERA_ATTR_SCENE_MODE_SUNSET, /**< Sunset */ - CAMERA_ATTR_SCENE_MODE_DUSK_N_DAWN, /**< Dusk & dawn */ - CAMERA_ATTR_SCENE_MODE_FALL_COLOR, /**< Fall */ - CAMERA_ATTR_SCENE_MODE_NIGHT_SCENE, /**< Night scene */ - CAMERA_ATTR_SCENE_MODE_FIREWORK, /**< Firework */ - CAMERA_ATTR_SCENE_MODE_TEXT, /**< Text */ - CAMERA_ATTR_SCENE_MODE_SHOW_WINDOW, /**< Show window */ - CAMERA_ATTR_SCENE_MODE_CANDLE_LIGHT, /**< Candle light */ - CAMERA_ATTR_SCENE_MODE_BACKLIGHT, /**< Backlight */ - CAMERA_ATTR_SCENE_MODE_AQUA, /**< Aqua */ +typedef enum { + CAMERA_ATTR_SCENE_MODE_NORMAL = 0, /**< Normal */ + CAMERA_ATTR_SCENE_MODE_PORTRAIT, /**< Portrait */ + CAMERA_ATTR_SCENE_MODE_LANDSCAPE, /**< Landscape */ + CAMERA_ATTR_SCENE_MODE_SPORTS, /**< Sports */ + CAMERA_ATTR_SCENE_MODE_PARTY_N_INDOOR, /**< Party & indoor */ + CAMERA_ATTR_SCENE_MODE_BEACH_N_INDOOR, /**< Beach & indoor */ + CAMERA_ATTR_SCENE_MODE_SUNSET, /**< Sunset */ + CAMERA_ATTR_SCENE_MODE_DUSK_N_DAWN, /**< Dusk & dawn */ + CAMERA_ATTR_SCENE_MODE_FALL_COLOR, /**< Fall */ + CAMERA_ATTR_SCENE_MODE_NIGHT_SCENE, /**< Night scene */ + CAMERA_ATTR_SCENE_MODE_FIREWORK, /**< Firework */ + CAMERA_ATTR_SCENE_MODE_TEXT, /**< Text */ + CAMERA_ATTR_SCENE_MODE_SHOW_WINDOW, /**< Show window */ + CAMERA_ATTR_SCENE_MODE_CANDLE_LIGHT, /**< Candle light */ + CAMERA_ATTR_SCENE_MODE_BACKLIGHT, /**< Backlight */ + CAMERA_ATTR_SCENE_MODE_AQUA, /**< Aqua */ } camera_attr_scene_mode_e; /** * @brief Enumeration for the auto focus mode. * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ -typedef enum -{ - CAMERA_ATTR_AF_NONE = 0, /**< auto-focus is not set */ - CAMERA_ATTR_AF_NORMAL, /**< auto-focus in the normal mode */ - CAMERA_ATTR_AF_MACRO, /**< auto-focus in the macro mode(close distance) */ - CAMERA_ATTR_AF_FULL, /**< auto-focus in the full mode(all range scan, limited by device spec) */ +typedef enum { + CAMERA_ATTR_AF_NONE = 0, /**< auto-focus is not set */ + CAMERA_ATTR_AF_NORMAL, /**< auto-focus in the normal mode */ + CAMERA_ATTR_AF_MACRO, /**< auto-focus in the macro mode(close distance) */ + CAMERA_ATTR_AF_FULL, /**< auto-focus in the full mode(all range scan, limited by device spec) */ } camera_attr_af_mode_e; /** * @brief Enumeration for the ISO levels of the camera. * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ -typedef enum -{ - CAMERA_ATTR_ISO_AUTO = 0, /**< ISO auto mode */ - CAMERA_ATTR_ISO_50, /**< ISO 50 */ - CAMERA_ATTR_ISO_100, /**< ISO 100 */ - CAMERA_ATTR_ISO_200, /**< ISO 200 */ - CAMERA_ATTR_ISO_400, /**< ISO 400 */ - CAMERA_ATTR_ISO_800, /**< ISO 800 */ - CAMERA_ATTR_ISO_1600, /**< ISO 1600 */ - CAMERA_ATTR_ISO_3200, /**< ISO 3200 */ +typedef enum { + CAMERA_ATTR_ISO_AUTO = 0, /**< ISO auto mode */ + CAMERA_ATTR_ISO_50, /**< ISO 50 */ + CAMERA_ATTR_ISO_100, /**< ISO 100 */ + CAMERA_ATTR_ISO_200, /**< ISO 200 */ + CAMERA_ATTR_ISO_400, /**< ISO 400 */ + CAMERA_ATTR_ISO_800, /**< ISO 800 */ + CAMERA_ATTR_ISO_1600, /**< ISO 1600 */ + CAMERA_ATTR_ISO_3200, /**< ISO 3200 */ } camera_attr_iso_e; /** * @brief Enumeration for the camera exposure modes. * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ -typedef enum -{ - CAMERA_ATTR_EXPOSURE_MODE_OFF = 0, /**< Off */ - CAMERA_ATTR_EXPOSURE_MODE_ALL, /**< All mode */ - CAMERA_ATTR_EXPOSURE_MODE_CENTER, /**< Center mode */ - CAMERA_ATTR_EXPOSURE_MODE_SPOT, /**< Spot mode */ - CAMERA_ATTR_EXPOSURE_MODE_CUSTOM, /**< Custom mode */ +typedef enum { + CAMERA_ATTR_EXPOSURE_MODE_OFF = 0, /**< Off */ + CAMERA_ATTR_EXPOSURE_MODE_ALL, /**< All mode */ + CAMERA_ATTR_EXPOSURE_MODE_CENTER, /**< Center mode */ + CAMERA_ATTR_EXPOSURE_MODE_SPOT, /**< Spot mode */ + CAMERA_ATTR_EXPOSURE_MODE_CUSTOM, /**< Custom mode */ } camera_attr_exposure_mode_e; /** * @brief Enumeration for the orientation values of tag. * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ -typedef enum -{ - CAMERA_ATTR_TAG_ORIENTATION_TOP_LEFT = 1, /**< Row #0 is at the top, Column #0 is to the left */ - CAMERA_ATTR_TAG_ORIENTATION_TOP_RIGHT = 2, /**< Row #0 is at the top, Column #0 is to the right (flipped) */ - CAMERA_ATTR_TAG_ORIENTATION_BOTTOM_RIGHT = 3, /**< Row #0 is at the bottom, Column #0 is to the right */ - CAMERA_ATTR_TAG_ORIENTATION_BOTTOM_LEFT = 4, /**< Row #0 is at the bottom, Column #0 is to the left (flipped) */ - CAMERA_ATTR_TAG_ORIENTATION_LEFT_TOP = 5, /**< Row #0 is to the left, Column #0 is at the top (flipped) */ - CAMERA_ATTR_TAG_ORIENTATION_RIGHT_TOP = 6, /**< Row #0 is to the right, Column #0 is at the top */ - CAMERA_ATTR_TAG_ORIENTATION_RIGHT_BOTTOM = 7, /**< Row #0 is to the right, Column #0 is at the bottom (flipped) */ - CAMERA_ATTR_TAG_ORIENTATION_LEFT_BOTTOM = 8, /**< Row #0 is to the left, Column #0 is at the bottom */ +typedef enum { + CAMERA_ATTR_TAG_ORIENTATION_TOP_LEFT = 1, /**< Row #0 is at the top, Column #0 is to the left */ + CAMERA_ATTR_TAG_ORIENTATION_TOP_RIGHT = 2, /**< Row #0 is at the top, Column #0 is to the right (flipped) */ + CAMERA_ATTR_TAG_ORIENTATION_BOTTOM_RIGHT = 3, /**< Row #0 is at the bottom, Column #0 is to the right */ + CAMERA_ATTR_TAG_ORIENTATION_BOTTOM_LEFT = 4, /**< Row #0 is at the bottom, Column #0 is to the left (flipped) */ + CAMERA_ATTR_TAG_ORIENTATION_LEFT_TOP = 5, /**< Row #0 is to the left, Column #0 is at the top (flipped) */ + CAMERA_ATTR_TAG_ORIENTATION_RIGHT_TOP = 6, /**< Row #0 is to the right, Column #0 is at the top */ + CAMERA_ATTR_TAG_ORIENTATION_RIGHT_BOTTOM = 7, /**< Row #0 is to the right, Column #0 is at the bottom (flipped) */ + CAMERA_ATTR_TAG_ORIENTATION_LEFT_BOTTOM = 8, /**< Row #0 is to the left, Column #0 is at the bottom */ } camera_attr_tag_orientation_e; /** * @brief Enumeration for the flash mode. * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ -typedef enum -{ - CAMERA_ATTR_FLASH_MODE_OFF = 0, /**< Always off */ - CAMERA_ATTR_FLASH_MODE_ON, /**< Always splashes */ - CAMERA_ATTR_FLASH_MODE_AUTO, /**< Depending on intensity of light, strobe starts to flash */ - CAMERA_ATTR_FLASH_MODE_REDEYE_REDUCTION, /**< Red eye reduction. Multiple flash before capturing */ - CAMERA_ATTR_FLASH_MODE_SLOW_SYNC, /**< Slow sync curtain synchronization */ - CAMERA_ATTR_FLASH_MODE_FRONT_CURTAIN, /**< Front curtain synchronization */ - CAMERA_ATTR_FLASH_MODE_REAR_CURTAIN, /**< Rear curtain synchronization */ - CAMERA_ATTR_FLASH_MODE_PERMANENT, /**< Keep turned on until turning off */ +typedef enum { + CAMERA_ATTR_FLASH_MODE_OFF = 0, /**< Always off */ + CAMERA_ATTR_FLASH_MODE_ON, /**< Always splashes */ + CAMERA_ATTR_FLASH_MODE_AUTO, /**< Depending on intensity of light, strobe starts to flash */ + CAMERA_ATTR_FLASH_MODE_REDEYE_REDUCTION, /**< Red eye reduction. Multiple flash before capturing */ + CAMERA_ATTR_FLASH_MODE_SLOW_SYNC, /**< Slow sync curtain synchronization */ + CAMERA_ATTR_FLASH_MODE_FRONT_CURTAIN, /**< Front curtain synchronization */ + CAMERA_ATTR_FLASH_MODE_REAR_CURTAIN, /**< Rear curtain synchronization */ + CAMERA_ATTR_FLASH_MODE_PERMANENT, /**< Keep turned on until turning off */ } camera_attr_flash_mode_e; /** * @brief Enumeration to preview FPS. * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ -typedef enum -{ - CAMERA_ATTR_FPS_AUTO = 0, /**< AUTO FPS */ - CAMERA_ATTR_FPS_7 = 7, /**< 7 FPS */ - CAMERA_ATTR_FPS_8 = 8, /**< 8 FPS */ - CAMERA_ATTR_FPS_15 = 15, /**< 15 FPS */ - CAMERA_ATTR_FPS_20 = 20, /**< 20 FPS */ - CAMERA_ATTR_FPS_24 = 24, /**< 24 FPS */ - CAMERA_ATTR_FPS_25 = 25, /**< 25 FPS */ - CAMERA_ATTR_FPS_30 = 30, /**< 30 FPS */ - CAMERA_ATTR_FPS_60 = 60, /**< 60 FPS */ - CAMERA_ATTR_FPS_90 = 90, /**< 90 FPS */ - CAMERA_ATTR_FPS_120 = 120 /**< 120 FPS */ +typedef enum { + CAMERA_ATTR_FPS_AUTO = 0, /**< AUTO FPS */ + CAMERA_ATTR_FPS_7 = 7, /**< 7 FPS */ + CAMERA_ATTR_FPS_8 = 8, /**< 8 FPS */ + CAMERA_ATTR_FPS_15 = 15, /**< 15 FPS */ + CAMERA_ATTR_FPS_20 = 20, /**< 20 FPS */ + CAMERA_ATTR_FPS_24 = 24, /**< 24 FPS */ + CAMERA_ATTR_FPS_25 = 25, /**< 25 FPS */ + CAMERA_ATTR_FPS_30 = 30, /**< 30 FPS */ + CAMERA_ATTR_FPS_60 = 60, /**< 60 FPS */ + CAMERA_ATTR_FPS_90 = 90, /**< 90 FPS */ + CAMERA_ATTR_FPS_120 = 120 /**< 120 FPS */ } camera_attr_fps_e; /** * @brief Enumeration for the theater mode. * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ -typedef enum -{ +typedef enum { CAMERA_ATTR_THEATER_MODE_DISABLE = 0, /**< Disable theater mode - External display shows same image as device display */ CAMERA_ATTR_THEATER_MODE_ENABLE = 2, /**< Enable theater mode - Preview image is displayed on external display with full screen mode, but preview image is not shown on device display */ CAMERA_ATTR_THEATER_MODE_CLONE = 1 /**< Clone mode - Preview image is displayed on external display with full screen mode. Also preview image is shown by the UI on device display */ @@ -497,8 +474,7 @@ typedef enum * @brief Enumeration for HDR capture mode. * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ -typedef enum -{ +typedef enum { CAMERA_ATTR_HDR_MODE_DISABLE = 0, /**< Disable HDR capture */ CAMERA_ATTR_HDR_MODE_ENABLE, /**< Enable HDR capture */ CAMERA_ATTR_HDR_MODE_KEEP_ORIGINAL /**< Enable HDR capture and keep original image data */ @@ -544,8 +520,7 @@ typedef enum { * will invoke this callback if you register this callback using camera_set_state_changed_cb(). * @see camera_set_state_changed_cb() */ -typedef void (*camera_state_changed_cb)(camera_state_e previous, camera_state_e current, - bool by_policy, void *user_data); +typedef void (*camera_state_changed_cb)(camera_state_e previous, camera_state_e current, bool by_policy, void *user_data); /** * @brief Called when the camera is interrupted by policy. @@ -699,8 +674,7 @@ typedef bool (*camera_supported_capture_resolution_cb)(int width, int height, vo * @pre camera_foreach_supported_capture_format() will invoke this callback. * @see camera_foreach_supported_capture_format() */ -typedef bool (*camera_supported_capture_format_cb)(camera_pixel_format_e format, - void *user_data); +typedef bool (*camera_supported_capture_format_cb)(camera_pixel_format_e format, void *user_data); /** * @brief Called once for the pixel format of each supported preview format. @@ -711,8 +685,7 @@ typedef bool (*camera_supported_capture_format_cb)(camera_pixel_format_e format, * @pre camera_foreach_supported_preview_format() will invoke this callback. * @see camera_foreach_supported_preview_format() */ -typedef bool (*camera_supported_preview_format_cb)(camera_pixel_format_e format, - void *user_data); +typedef bool (*camera_supported_preview_format_cb)(camera_pixel_format_e format, void *user_data); /** * @} @@ -1152,7 +1125,7 @@ int legacy_camera_stop_face_detection(camera_h camera); * @exception #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * */ - bool legacy_camera_is_supported_continuous_capture(camera_h camera); +bool legacy_camera_is_supported_continuous_capture(camera_h camera); /** * @brief Retrieves all supported camera preview resolutions by invoking the callback function once for each supported camera preview resolution. @@ -1173,7 +1146,7 @@ int legacy_camera_stop_face_detection(camera_h camera); * @see camera_supported_preview_resolution_cb() */ int legacy_camera_foreach_supported_preview_resolution(camera_h camera, - camera_supported_preview_resolution_cb callback, void *user_data); + camera_supported_preview_resolution_cb callback, void *user_data); /** * @} @@ -1397,7 +1370,7 @@ int legacy_camera_get_capture_resolution(camera_h camera, int *width, int *heigh * @see camera_supported_capture_resolution_cb() */ int legacy_camera_foreach_supported_capture_resolution(camera_h camera, - camera_supported_capture_resolution_cb callback, void *user_data); + camera_supported_capture_resolution_cb callback, void *user_data); /** * @} @@ -1471,7 +1444,7 @@ int legacy_camera_get_capture_format(camera_h camera, camera_pixel_format_e *for * @see camera_supported_capture_format_cb() */ int legacy_camera_foreach_supported_capture_format(camera_h camera, - camera_supported_capture_format_cb callback, void *user_data); + camera_supported_capture_format_cb callback, void *user_data); /** * @} @@ -1555,7 +1528,7 @@ int legacy_camera_get_facing_direction(camera_h camera, camera_facing_direction_ * @see camera_supported_preview_format_cb() */ int legacy_camera_foreach_supported_preview_format(camera_h camera, - camera_supported_preview_format_cb callback, void *user_data); + camera_supported_preview_format_cb callback, void *user_data); /** * @ingroup CAPI_MEDIA_CAMERA_CAPABILITY_MODULE @@ -1720,8 +1693,7 @@ int legacy_camera_unset_media_packet_preview_cb(camera_h camera); * @see legacy_camera_unset_state_changed_cb() * @see camera_state_changed_cb() */ -int legacy_camera_set_state_changed_cb(camera_h camera, camera_state_changed_cb callback, - void *user_data); +int legacy_camera_set_state_changed_cb(camera_h camera, camera_state_changed_cb callback, void *user_data); /** * @brief Unregisters the callback function. @@ -1750,8 +1722,7 @@ int legacy_camera_unset_state_changed_cb(camera_h camera); * @see legacy_camera_unset_interrupted_cb() * @see camera_interrupted_cb() */ -int legacy_camera_set_interrupted_cb(camera_h camera, camera_interrupted_cb callback, - void *user_data); +int legacy_camera_set_interrupted_cb(camera_h camera, camera_interrupted_cb callback, void *user_data); /** * @brief Unregisters the callback function. @@ -1783,8 +1754,7 @@ int legacy_camera_unset_interrupted_cb(camera_h camera); * @see camera_unset_focus_changed_cb() * @see camera_focus_changed_cb() */ -int legacy_camera_set_focus_changed_cb(camera_h camera, camera_focus_changed_cb callback, - void *user_data); +int legacy_camera_set_focus_changed_cb(camera_h camera, camera_focus_changed_cb callback, void *user_data); /** * @brief Unregisters the callback function. @@ -1866,8 +1836,7 @@ typedef bool (*camera_attr_supported_af_mode_cb)(camera_attr_af_mode_e mode, voi * @see camera_attr_foreach_supported_exposure_mode() * @see #camera_attr_exposure_mode_e */ -typedef bool (*camera_attr_supported_exposure_mode_cb)(camera_attr_exposure_mode_e mode, - void *user_data); +typedef bool (*camera_attr_supported_exposure_mode_cb)(camera_attr_exposure_mode_e mode, void *user_data); /** * @brief Called to get each supported ISO mode. @@ -1890,8 +1859,7 @@ typedef bool (*camera_attr_supported_iso_cb)(camera_attr_iso_e iso, void *user_d * @see camera_attr_foreach_supported_whitebalance() * @see #camera_attr_whitebalance_e */ -typedef bool (*camera_attr_supported_whitebalance_cb)(camera_attr_whitebalance_e wb, - void *user_data); +typedef bool (*camera_attr_supported_whitebalance_cb)(camera_attr_whitebalance_e wb, void *user_data); /** * @brief Called to get each supported effect mode. @@ -1902,8 +1870,7 @@ typedef bool (*camera_attr_supported_whitebalance_cb)(camera_attr_whitebalance_e * @pre camera_attr_foreach_supported_effect() will invoke this callback. * @see camera_attr_foreach_supported_effect() */ -typedef bool (*camera_attr_supported_effect_cb)(camera_attr_effect_mode_e effect, - void *user_data); +typedef bool (*camera_attr_supported_effect_cb)(camera_attr_effect_mode_e effect, void *user_data); /** * @brief Called to get each supported scene mode. @@ -1915,8 +1882,7 @@ typedef bool (*camera_attr_supported_effect_cb)(camera_attr_effect_mode_e effect * @see camera_attr_foreach_supported_scene_mode() * @see #camera_attr_scene_mode_e */ -typedef bool (*camera_attr_supported_scene_mode_cb)(camera_attr_scene_mode_e mode, - void *user_data); +typedef bool (*camera_attr_supported_scene_mode_cb)(camera_attr_scene_mode_e mode, void *user_data); /** * @brief Called to get each supported flash mode. @@ -1927,8 +1893,7 @@ typedef bool (*camera_attr_supported_scene_mode_cb)(camera_attr_scene_mode_e mod * @pre camera_attr_foreach_supported_flash_mode() will invoke this callback. * @see camera_attr_foreach_supported_flash_mode() */ -typedef bool (*camera_attr_supported_flash_mode_cb)(camera_attr_flash_mode_e mode, - void *user_data); +typedef bool (*camera_attr_supported_flash_mode_cb)(camera_attr_flash_mode_e mode, void *user_data); /** * @brief Called to get each supported FPS mode. @@ -2052,8 +2017,7 @@ int legacy_camera_attr_get_preview_fps(camera_h camera, camera_attr_fps_e *fps); * @see camera_attr_get_preview_fps() * @see camera_attr_supported_fps_cb() */ -int legacy_camera_attr_foreach_supported_fps(camera_h camera, camera_attr_supported_fps_cb callback, - void *user_data); +int legacy_camera_attr_foreach_supported_fps(camera_h camera, camera_attr_supported_fps_cb callback, void *user_data); /** * @brief Retrieves all supported FPS modes by invoking the callback function once for each supported FPS mode. @@ -2075,8 +2039,8 @@ int legacy_camera_attr_foreach_supported_fps(camera_h camera, camera_attr_suppor * @see camera_attr_get_preview_fps() * @see camera_attr_supported_fps_cb() */ -int legacy_camera_attr_foreach_supported_fps_by_resolution(camera_h camera, int width, int height, - camera_attr_supported_fps_cb callback ,void *user_data); +int legacy_camera_attr_foreach_supported_fps_by_resolution(camera_h camera, int width, int height, + camera_attr_supported_fps_cb callback, void *user_data); /** * @} @@ -2272,8 +2236,7 @@ int legacy_camera_attr_clear_af_area(camera_h camera); * @see legacy_camera_attr_get_af_mode() * @see camera_attr_supported_af_mode_cb() */ -int legacy_camera_attr_foreach_supported_af_mode(camera_h camera, - camera_attr_supported_af_mode_cb callback, void *user_data); +int legacy_camera_attr_foreach_supported_af_mode(camera_h camera, camera_attr_supported_af_mode_cb callback, void *user_data); /** * @} @@ -2341,8 +2304,7 @@ int legacy_camera_attr_get_exposure_mode(camera_h camera, camera_attr_exposure_m * @see legacy_camera_attr_get_exposure_mode() * @see camera_attr_supported_exposure_mode_cb() */ -int legacy_camera_attr_foreach_supported_exposure_mode(camera_h camera, - camera_attr_supported_exposure_mode_cb callback, void *user_data); +int legacy_camera_attr_foreach_supported_exposure_mode(camera_h camera, camera_attr_supported_exposure_mode_cb callback, void *user_data); /** * @} @@ -2456,8 +2418,7 @@ int legacy_camera_attr_get_iso(camera_h camera, camera_attr_iso_e *iso); * @see legacy_camera_attr_get_iso() * @see camera_attr_supported_iso_cb() */ -int legacy_camera_attr_foreach_supported_iso(camera_h camera, camera_attr_supported_iso_cb callback, - void *user_data); +int legacy_camera_attr_foreach_supported_iso(camera_h camera, camera_attr_supported_iso_cb callback, void *user_data); /** * @} @@ -2525,8 +2486,7 @@ int legacy_camera_attr_get_theater_mode(camera_h camera, camera_attr_theater_mod * @see legacy_camera_attr_get_theater_mode() * @see camera_attr_supported_theater_mode_cb() */ -int legacy_camera_attr_foreach_supported_theater_mode(camera_h camera, - camera_attr_supported_theater_mode_cb callback, void *user_data); +int legacy_camera_attr_foreach_supported_theater_mode(camera_h camera, camera_attr_supported_theater_mode_cb callback, void *user_data); /** * @} @@ -2693,8 +2653,7 @@ int legacy_camera_attr_get_whitebalance(camera_h camera, camera_attr_whitebalanc * @see legacy_camera_attr_get_whitebalance() * @see camera_attr_supported_whitebalance_cb() */ -int legacy_camera_attr_foreach_supported_whitebalance(camera_h camera, - camera_attr_supported_whitebalance_cb callback, void *user_data); +int legacy_camera_attr_foreach_supported_whitebalance(camera_h camera, camera_attr_supported_whitebalance_cb callback, void *user_data); /** * @} @@ -2763,8 +2722,7 @@ int legacy_camera_attr_get_effect(camera_h camera, camera_attr_effect_mode_e *ef * @see legacy_camera_attr_get_effect() * @see camera_attr_supported_effect_cb() */ -int legacy_camera_attr_foreach_supported_effect(camera_h camera, - camera_attr_supported_effect_cb callback, void *user_data); +int legacy_camera_attr_foreach_supported_effect(camera_h camera, camera_attr_supported_effect_cb callback, void *user_data); /** * @} @@ -2832,8 +2790,7 @@ int legacy_camera_attr_get_scene_mode(camera_h camera, camera_attr_scene_mode_e * @see legacy_camera_attr_get_scene_mode() * @see legacy_camera_attr_supported_scene_mode_cb() */ -int legacy_camera_attr_foreach_supported_scene_mode(camera_h camera, - camera_attr_supported_scene_mode_cb callback, void *user_data); +int legacy_camera_attr_foreach_supported_scene_mode(camera_h camera, camera_attr_supported_scene_mode_cb callback, void *user_data); /** * @} @@ -3012,7 +2969,7 @@ int legacy_camera_attr_remove_geotag(camera_h camera); * @privlevel public * @privilege %http://tizen.org/privilege/camera * @remarks Since 2.4, while setting the flash mode, if the flash was preempted by other APIs,\n - then this function returns #CAMERA_ERROR_DEVICE_BUSY error. + then this function returns #CAMERA_ERROR_DEVICE_BUSY error. * @param[in] camera The handle to the camera * @param[in] mode The flash mode * @return @c 0 on success, otherwise a negative error value @@ -3066,8 +3023,7 @@ int legacy_camera_attr_get_flash_mode(camera_h camera, camera_attr_flash_mode_e * @see legacy_camera_attr_get_flash_mode() * @see camera_attr_supported_flash_mode_cb() */ -int legacy_camera_attr_foreach_supported_flash_mode(camera_h camera, - camera_attr_supported_flash_mode_cb callback, void *user_data); +int legacy_camera_attr_foreach_supported_flash_mode(camera_h camera, camera_attr_supported_flash_mode_cb callback, void *user_data); /** * @} @@ -3147,8 +3103,7 @@ int legacy_camera_attr_get_stream_rotation(camera_h camera , camera_rotation_e * * @see legacy_camera_attr_get_stream_rotation() * @see legacy_camera_attr_supported_stream_rotation_cb() */ -int legacy_camera_attr_foreach_supported_stream_rotation(camera_h camera, - camera_attr_supported_stream_rotation_cb callback, void *user_data); +int legacy_camera_attr_foreach_supported_stream_rotation(camera_h camera, camera_attr_supported_stream_rotation_cb callback, void *user_data); /** * @} @@ -3214,8 +3169,7 @@ int legacy_camera_attr_get_stream_flip(camera_h camera , camera_flip_e *flip); * @see legacy_camera_attr_get_stream_flip() * @see legacy_camera_attr_supported_stream_flip_cb() */ -int legacy_camera_attr_foreach_supported_stream_flip(camera_h camera, - camera_attr_supported_stream_flip_cb callback, void *user_data); +int legacy_camera_attr_foreach_supported_stream_flip(camera_h camera, camera_attr_supported_stream_flip_cb callback, void *user_data); /** * @} diff --git a/legacy/include/legacy_camera_private.h b/legacy/include/legacy_camera_private.h index 0aef5ed..e4bca29 100644 --- a/legacy/include/legacy_camera_private.h +++ b/legacy/include/legacy_camera_private.h @@ -42,14 +42,14 @@ typedef enum { _CAMERA_EVENT_TYPE_FACE_DETECTION, _CAMERA_EVENT_TYPE_VIDEO_FRAME_RENDER_ERROR, _CAMERA_EVENT_TYPE_NUM -}_camera_event_e; +} _camera_event_e; typedef struct _camera_cb_data { int event_type; void *handle; } camera_cb_data; -typedef struct _camera_s{ +typedef struct _camera_s { MMHandleType mm_handle; void* user_cb[_CAMERA_EVENT_TYPE_NUM]; diff --git a/legacy/src/legacy_camera.c b/legacy/src/legacy_camera.c index b3f3e73..390e181 100644 --- a/legacy/src/legacy_camera.c +++ b/legacy/src/legacy_camera.c @@ -65,7 +65,7 @@ void _camera_remove_cb_message(camera_s *handle) if (!cb_data) { LOGW("cb_data is NULL"); } else { - ret = g_idle_remove_by_data (cb_data); + ret = g_idle_remove_by_data(cb_data); LOGW("Remove cb_data[%p]. ret[%d]", cb_data, ret); handle->cb_data_list = g_list_remove(handle->cb_data_list, cb_data); @@ -201,17 +201,15 @@ int __convert_camera_error_code(const char *func, int code) static gboolean __mm_videostream_callback(MMCamcorderVideoStreamDataType *stream, void *user_data) { - if (user_data == NULL || stream == NULL) { + if (user_data == NULL || stream == NULL) return 0; - } camera_s *handle = (camera_s *)user_data; - if (handle->user_cb[_CAMERA_EVENT_TYPE_PREVIEW]) { + if (handle->user_cb[_CAMERA_EVENT_TYPE_PREVIEW]) ((camera_preview_cb)handle->user_cb[_CAMERA_EVENT_TYPE_PREVIEW])(stream, handle->user_data[_CAMERA_EVENT_TYPE_PREVIEW]); - } else if (handle->user_cb[_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW]) { + else if (handle->user_cb[_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW]) ((camera_preview_cb)handle->user_cb[_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW])(stream, handle->user_data[_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW]); - } return 1; } @@ -219,9 +217,8 @@ static gboolean __mm_videostream_callback(MMCamcorderVideoStreamDataType *stream static gboolean __mm_capture_callback(MMCamcorderCaptureDataType *frame, MMCamcorderCaptureDataType *thumbnail, void *user_data) { - if (user_data == NULL || frame == NULL) { + if (user_data == NULL || frame == NULL) return 0; - } camera_s *handle = (camera_s *)user_data; int ret = MM_ERROR_NONE; @@ -245,8 +242,8 @@ static gboolean __mm_capture_callback(MMCamcorderCaptureDataType *frame, MMCamco image.format = frame->format; ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, - "captured-exif-raw-data", &exif, &exif_size, - NULL); + "captured-exif-raw-data", &exif, &exif_size, + NULL); if (ret == MM_ERROR_NONE) { image.exif = exif; image.exif_size = exif_size; @@ -262,8 +259,8 @@ static gboolean __mm_capture_callback(MMCamcorderCaptureDataType *frame, MMCamco } ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, - "captured-screennail", &scrnl, &scrnl_size, - NULL); + "captured-screennail", &scrnl, &scrnl_size, + NULL); if (ret == MM_ERROR_NONE && scrnl) { postview.data = scrnl->data; postview.size = scrnl->length; @@ -278,18 +275,16 @@ static gboolean __mm_capture_callback(MMCamcorderCaptureDataType *frame, MMCamco } ((camera_capturing_cb)handle->user_cb[_CAMERA_EVENT_TYPE_CAPTURE])(&image, - scrnl ? &postview : NULL, - thumbnail ? &thumb : NULL, - handle->user_data[_CAMERA_EVENT_TYPE_CAPTURE]); + scrnl ? &postview : NULL, + thumbnail ? &thumb : NULL, + handle->user_data[_CAMERA_EVENT_TYPE_CAPTURE]); } /* update captured state */ if (handle->capture_count == 1 && handle->hdr_keep_mode) { - if (handle->current_capture_count == 2) { + if (handle->current_capture_count == 2) handle->is_capture_completed = true; - } - } else if (handle->capture_count == handle->current_capture_count || - handle->is_continuous_shot_break) { + } else if (handle->capture_count == handle->current_capture_count || handle->is_continuous_shot_break) { handle->is_capture_completed = true; } @@ -334,9 +329,8 @@ static camera_state_e __camera_state_convert(MMCamcorderStateType mm_state) static int __mm_camera_message_callback(int message, void *param, void *user_data) { - if (user_data == NULL || param == NULL) { + if (user_data == NULL || param == NULL) return 0; - } int i = 0; int camera_error = 0; @@ -346,9 +340,8 @@ static int __mm_camera_message_callback(int message, void *param, void *user_dat camera_policy_e policy = CAMERA_POLICY_NONE; MMCamFaceDetectInfo *cam_fd_info = NULL; - if (handle->relay_message_callback) { + if (handle->relay_message_callback) handle->relay_message_callback(message, param, handle->relay_user_data); - } switch (message) { case MM_MESSAGE_CAMCORDER_STATE_CHANGED: @@ -359,7 +352,7 @@ static int __mm_camera_message_callback(int message, void *param, void *user_dat (m->state.previous < MM_CAMCORDER_STATE_NONE || m->state.previous > MM_CAMCORDER_STATE_PAUSED || m->state.code != 0)) { - LOGI( "Invalid state changed message"); + LOGI("Invalid state changed message"); break; } @@ -388,17 +381,15 @@ static int __mm_camera_message_callback(int message, void *param, void *user_dat LOGW("CAMERA_POLICY_RESOURCE_CONFLICT"); } - if (policy != CAMERA_POLICY_NONE && - handle->state == CAMERA_STATE_CAPTURING) { + if (policy != CAMERA_POLICY_NONE && handle->state == CAMERA_STATE_CAPTURING) { handle->state = CAMERA_STATE_CAPTURED; if (handle->user_cb[_CAMERA_EVENT_TYPE_STATE_CHANGE]) { ((camera_state_changed_cb)handle->user_cb[_CAMERA_EVENT_TYPE_STATE_CHANGE])(CAMERA_STATE_CAPTURING, handle->state, policy, handle->user_data[_CAMERA_EVENT_TYPE_STATE_CHANGE]); } - if (handle->user_cb[_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE]) { + if (handle->user_cb[_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE]) ((camera_capture_completed_cb)handle->user_cb[_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE])(handle->user_data[_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE]); - } } previous_state = handle->state; @@ -410,8 +401,7 @@ static int __mm_camera_message_callback(int message, void *param, void *user_dat } /* should change intermediate state MM_CAMCORDER_STATE_READY is not valid in capi , change to NULL state */ - if (policy != CAMERA_POLICY_NONE && - m->state.current == MM_CAMCORDER_STATE_NULL) { + if (policy != CAMERA_POLICY_NONE && m->state.current == MM_CAMCORDER_STATE_NULL) { if (handle->user_cb[_CAMERA_EVENT_TYPE_INTERRUPTED]) { ((camera_interrupted_cb)handle->user_cb[_CAMERA_EVENT_TYPE_INTERRUPTED])(policy, previous_state, handle->state, handle->user_data[_CAMERA_EVENT_TYPE_INTERRUPTED]); @@ -420,41 +410,39 @@ static int __mm_camera_message_callback(int message, void *param, void *user_dat } } break; - case MM_MESSAGE_CAMCORDER_FOCUS_CHANGED : + case MM_MESSAGE_CAMCORDER_FOCUS_CHANGED: if (handle->user_cb[_CAMERA_EVENT_TYPE_FOCUS_CHANGE]) { ((camera_focus_changed_cb)handle->user_cb[_CAMERA_EVENT_TYPE_FOCUS_CHANGE])(m->code, - handle->user_data[_CAMERA_EVENT_TYPE_FOCUS_CHANGE]); + handle->user_data[_CAMERA_EVENT_TYPE_FOCUS_CHANGE]); } break; case MM_MESSAGE_CAMCORDER_CAPTURED: handle->current_capture_complete_count = m->code; if (handle->state == CAMERA_STATE_CAPTURING && - (handle->capture_count == 1 || - m->code == handle->capture_count || - handle->is_continuous_shot_break)) { + (handle->capture_count == 1 || m->code == handle->capture_count || handle->is_continuous_shot_break)) { /* pseudo state change */ previous_state = handle->state; handle->state = CAMERA_STATE_CAPTURED; - if (previous_state != handle->state && - handle->user_cb[_CAMERA_EVENT_TYPE_STATE_CHANGE]) { + + if (previous_state != handle->state && handle->user_cb[_CAMERA_EVENT_TYPE_STATE_CHANGE]) { ((camera_state_changed_cb)handle->user_cb[_CAMERA_EVENT_TYPE_STATE_CHANGE])(previous_state, - handle->state, - 0, - handle->user_data[_CAMERA_EVENT_TYPE_STATE_CHANGE]); + handle->state, + 0, + handle->user_data[_CAMERA_EVENT_TYPE_STATE_CHANGE]); } - if (handle->user_cb[_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE]) { + + if (handle->user_cb[_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE]) ((camera_capture_completed_cb)handle->user_cb[_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE])(handle->user_data[_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE]); - } } break; case MM_MESSAGE_CAMCORDER_VIDEO_SNAPSHOT_CAPTURED: - if (handle->user_cb[_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE]) { + if (handle->user_cb[_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE]) ((camera_capture_completed_cb)handle->user_cb[_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE])(handle->user_data[_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE]); - } + break; case MM_MESSAGE_CAMCORDER_ERROR: switch (m->code) { - case MM_ERROR_CAMCORDER_DEVICE : + case MM_ERROR_CAMCORDER_DEVICE: case MM_ERROR_CAMCORDER_DEVICE_TIMEOUT: case MM_ERROR_CAMCORDER_DEVICE_WRONG_JPEG: camera_error = CAMERA_ERROR_DEVICE; @@ -482,7 +470,7 @@ static int __mm_camera_message_callback(int message, void *param, void *user_dat case MM_ERROR_CAMCORDER_DEVICE_REG_TROUBLE: camera_error = CAMERA_ERROR_ESD; break; - default : + default: camera_error = CAMERA_ERROR_INVALID_OPERATION; break; } @@ -492,8 +480,8 @@ static int __mm_camera_message_callback(int message, void *param, void *user_dat if (camera_error != 0 && handle->user_cb[_CAMERA_EVENT_TYPE_ERROR]) { ((camera_error_cb)handle->user_cb[_CAMERA_EVENT_TYPE_ERROR])(camera_error, - handle->state, - handle->user_data[_CAMERA_EVENT_TYPE_ERROR]); + handle->state, + handle->user_data[_CAMERA_EVENT_TYPE_ERROR]); } break; @@ -521,8 +509,8 @@ static int __mm_camera_message_callback(int message, void *param, void *user_dat if (handle->user_cb[_CAMERA_EVENT_TYPE_FACE_DETECTION]) { ((camera_face_detected_cb)handle->user_cb[_CAMERA_EVENT_TYPE_FACE_DETECTION])(faces, - handle->num_of_faces, - handle->user_data[_CAMERA_EVENT_TYPE_FACE_DETECTION]); + handle->num_of_faces, + handle->user_data[_CAMERA_EVENT_TYPE_FACE_DETECTION]); } } else { handle->num_of_faces = 0; @@ -553,17 +541,15 @@ static int __capture_completed_event_cb(void *data) previous_state = handle->state; handle->state = CAMERA_STATE_CAPTURED; - if (previous_state != handle->state && - handle->user_cb[_CAMERA_EVENT_TYPE_STATE_CHANGE]) { + if (previous_state != handle->state && handle->user_cb[_CAMERA_EVENT_TYPE_STATE_CHANGE]) { ((camera_state_changed_cb)handle->user_cb[_CAMERA_EVENT_TYPE_STATE_CHANGE])(previous_state, - handle->state, - 0, - handle->user_data[_CAMERA_EVENT_TYPE_STATE_CHANGE]); + handle->state, + 0, + handle->user_data[_CAMERA_EVENT_TYPE_STATE_CHANGE]); } - if (handle->user_cb[_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE]) { + if (handle->user_cb[_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE]) ((camera_capture_completed_cb)handle->user_cb[_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE])(handle->user_data[_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE]); - } } return false; @@ -571,7 +557,7 @@ static int __capture_completed_event_cb(void *data) int legacy_camera_create(camera_device_e device, camera_h* camera) { - if (camera == NULL){ + if (camera == NULL) { LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } @@ -583,11 +569,11 @@ int legacy_camera_create(camera_device_e device, camera_h* camera) camera_s *handle = NULL; char *error = NULL; - LOGW("device name = [%d]",device); + LOGW("device name = [%d]", device); info.videodev_type = device; - handle = (camera_s*)malloc( sizeof(camera_s) ); + handle = (camera_s *)malloc(sizeof(camera_s)); if (handle == NULL) { LOGE("malloc fail"); return CAMERA_ERROR_OUT_OF_MEMORY; @@ -598,17 +584,17 @@ int legacy_camera_create(camera_device_e device, camera_h* camera) ret = mm_camcorder_create(&handle->mm_handle, &info); if (ret != MM_ERROR_NONE) { free(handle); - return __convert_camera_error_code(__func__,ret); + return __convert_camera_error_code(__func__, ret); } preview_format = MM_PIXEL_FORMAT_YUYV; rotation = MM_DISPLAY_ROTATION_NONE; ret = mm_camcorder_get_attributes(handle->mm_handle, &error, - MMCAM_RECOMMEND_PREVIEW_FORMAT_FOR_CAPTURE, &preview_format, - MMCAM_RECOMMEND_DISPLAY_ROTATION, &rotation, - MMCAM_CAPTURE_WIDTH, &handle->capture_width, - MMCAM_CAPTURE_HEIGHT, &handle->capture_height, - NULL); + MMCAM_RECOMMEND_PREVIEW_FORMAT_FOR_CAPTURE, &preview_format, + MMCAM_RECOMMEND_DISPLAY_ROTATION, &rotation, + MMCAM_CAPTURE_WIDTH, &handle->capture_width, + MMCAM_CAPTURE_HEIGHT, &handle->capture_height, + NULL); if (ret != MM_ERROR_NONE) { LOGE("mm_camcorder_get_attributes fail(%x)", ret); if (error) { @@ -623,14 +609,14 @@ int legacy_camera_create(camera_device_e device, camera_h* camera) } ret = mm_camcorder_set_attributes(handle->mm_handle, &error, - MMCAM_MODE, MM_CAMCORDER_MODE_VIDEO_CAPTURE, - MMCAM_CAMERA_FORMAT, preview_format, - MMCAM_IMAGE_ENCODER, MM_IMAGE_CODEC_JPEG, - MMCAM_CAPTURE_FORMAT, MM_PIXEL_FORMAT_ENCODED, - MMCAM_DISPLAY_SURFACE, MM_DISPLAY_SURFACE_NULL, - MMCAM_DISPLAY_ROTATION, rotation, - MMCAM_CAPTURE_COUNT, 1, - NULL); + MMCAM_MODE, MM_CAMCORDER_MODE_VIDEO_CAPTURE, + MMCAM_CAMERA_FORMAT, preview_format, + MMCAM_IMAGE_ENCODER, MM_IMAGE_CODEC_JPEG, + MMCAM_CAPTURE_FORMAT, MM_PIXEL_FORMAT_ENCODED, + MMCAM_DISPLAY_SURFACE, MM_DISPLAY_SURFACE_NULL, + MMCAM_DISPLAY_ROTATION, rotation, + MMCAM_CAPTURE_COUNT, 1, + NULL); handle->display_type = CAMERA_DISPLAY_TYPE_NONE; @@ -662,8 +648,8 @@ int legacy_camera_create(camera_device_e device, camera_h* camera) g_mutex_init(&handle->idle_cb_lock); mm_camcorder_set_message_callback(handle->mm_handle, - __mm_camera_message_callback, - (void*)handle); + __mm_camera_message_callback, + (void *)handle); *camera = (camera_h)handle; @@ -727,8 +713,8 @@ int legacy_camera_start_preview(camera_h camera) /* for receving MM_MESSAGE_CAMCORDER_CAPTURED evnet must be seted capture callback */ mm_camcorder_set_video_capture_callback(handle->mm_handle, - (mm_camcorder_video_capture_callback)__mm_capture_callback, - (void *)handle); + (mm_camcorder_video_capture_callback)__mm_capture_callback, + (void *)handle); mm_camcorder_get_state(handle->mm_handle, &mm_state); if (mm_state != MM_CAMCORDER_STATE_READY) { @@ -798,16 +784,16 @@ int legacy_camera_start_capture(camera_h camera, camera_capturing_cb capturing_c if (handle->capture_resolution_modified) { mm_camcorder_set_attributes(handle->mm_handle, NULL, - MMCAM_CAPTURE_WIDTH, handle->capture_width, - MMCAM_CAPTURE_HEIGHT, handle->capture_height, - NULL); + MMCAM_CAPTURE_WIDTH, handle->capture_width, + MMCAM_CAPTURE_HEIGHT, handle->capture_height, + NULL); handle->capture_resolution_modified = false; } mm_camcorder_set_attributes(handle->mm_handle, NULL, - MMCAM_CAPTURE_COUNT, 1, - NULL); + MMCAM_CAPTURE_COUNT, 1, + NULL); handle->capture_count = 1; handle->is_continuous_shot_break = false; @@ -850,11 +836,10 @@ bool legacy_camera_is_supported_continuous_capture(camera_h camera) return false; } - if (info.int_range.max > 1) { + if (info.int_range.max > 1) return true; - } else { + else return false; - } } @@ -890,9 +875,9 @@ int legacy_camera_start_continuous_capture(camera_h camera, int count, int inter supported_zsl = FALSE; ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, - MMCAM_CAPTURE_COUNT, count, - MMCAM_CAPTURE_INTERVAL, interval, - NULL); + MMCAM_CAPTURE_COUNT, count, + MMCAM_CAPTURE_INTERVAL, interval, + NULL); if (ret != MM_ERROR_NONE) { LOGE("error set continuous shot attribute 0x%x", ret); return __convert_camera_error_code(__func__, ret); @@ -914,8 +899,8 @@ int legacy_camera_start_continuous_capture(camera_h camera, int count, int inter handle->is_capture_completed = false; ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, - MMCAM_SUPPORT_ZSL_CAPTURE, &supported_zsl, - NULL); + MMCAM_SUPPORT_ZSL_CAPTURE, &supported_zsl, + NULL); if (ret != MM_ERROR_NONE) { LOGE("(%x) error get continuous shot attribute", ret); } @@ -927,17 +912,17 @@ int legacy_camera_start_continuous_capture(camera_h camera, int count, int inter int capture_height; mm_camcorder_get_attributes(handle->mm_handle, NULL, - MMCAM_CAMERA_WIDTH, &preview_width, - MMCAM_CAMERA_HEIGHT, &preview_height, - MMCAM_CAPTURE_WIDTH, &capture_width, - MMCAM_CAPTURE_HEIGHT, &capture_height, - NULL); + MMCAM_CAMERA_WIDTH, &preview_width, + MMCAM_CAMERA_HEIGHT, &preview_height, + MMCAM_CAPTURE_WIDTH, &capture_width, + MMCAM_CAPTURE_HEIGHT, &capture_height, + NULL); if (preview_width != capture_width || preview_height != capture_height) { mm_camcorder_set_attributes(handle->mm_handle, NULL, - MMCAM_CAPTURE_WIDTH, preview_width, - MMCAM_CAPTURE_HEIGHT, preview_height, - NULL); + MMCAM_CAPTURE_WIDTH, preview_width, + MMCAM_CAPTURE_HEIGHT, preview_height, + NULL); handle->capture_resolution_modified = true; } @@ -949,7 +934,7 @@ int legacy_camera_start_continuous_capture(camera_h camera, int count, int inter handle->user_data[_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = (void *)user_data; ret = mm_camcorder_capture_start(handle->mm_handle); - if(ret != MM_ERROR_NONE ){ + if (ret != MM_ERROR_NONE) { LOGE("mm_camcorder_capture_start failed 0x%x", ret); handle->user_cb[_CAMERA_EVENT_TYPE_CAPTURE] = NULL; handle->user_data[_CAMERA_EVENT_TYPE_CAPTURE] = NULL; @@ -985,14 +970,13 @@ int legacy_camera_stop_continuous_capture(camera_h camera) } ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, - "capture-break-cont-shot", 1, - NULL); + "capture-break-cont-shot", 1, + NULL); if (ret == MM_ERROR_NONE) { handle->is_continuous_shot_break = true; - if (handle->current_capture_count > 0) { + if (handle->current_capture_count > 0) handle->is_capture_completed = true; - } g_idle_add_full(G_PRIORITY_DEFAULT_IDLE, __capture_completed_event_cb, handle, NULL); } @@ -1047,8 +1031,8 @@ bool legacy_camera_is_supported_zero_shutter_lag(camera_h camera) } ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, - MMCAM_SUPPORT_ZSL_CAPTURE, &supported_zsl, - NULL); + MMCAM_SUPPORT_ZSL_CAPTURE, &supported_zsl, + NULL); set_last_result(__convert_camera_error_code(__func__, ret)); if (ret != MM_ERROR_NONE) { LOGE("MMCAM_SUPPORT_ZSL_CAPTURE get failed"); @@ -1073,8 +1057,8 @@ bool legacy_camera_is_supported_media_packet_preview_cb(camera_h camera) } ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, - MMCAM_SUPPORT_MEDIA_PACKET_PREVIEW_CB, &supported, - NULL); + MMCAM_SUPPORT_MEDIA_PACKET_PREVIEW_CB, &supported, + NULL); set_last_result(__convert_camera_error_code(__func__, ret)); if (ret != MM_ERROR_NONE) { LOGE("MMCAM_SUPPORT_MEDIA_PACKET_PREVIEW_CB get failed"); @@ -1098,8 +1082,8 @@ int legacy_camera_get_device_count(camera_h camera, int *device_count) } ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, - MMCAM_CAMERA_DEVICE_COUNT, device_count, - NULL); + MMCAM_CAMERA_DEVICE_COUNT, device_count, + NULL); return __convert_camera_error_code(__func__, ret); } @@ -1128,15 +1112,15 @@ int legacy_camera_start_face_detection(camera_h camera, camera_face_detected_cb } ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, - MMCAM_DETECT_MODE, MM_CAMCORDER_DETECT_MODE_ON, - NULL); + MMCAM_DETECT_MODE, MM_CAMCORDER_DETECT_MODE_ON, + NULL); if (ret == MM_ERROR_NONE) { handle->user_cb[_CAMERA_EVENT_TYPE_FACE_DETECTION] = (void *)callback; handle->user_data[_CAMERA_EVENT_TYPE_FACE_DETECTION] = (void *)user_data; handle->num_of_faces = 0; } - return __convert_camera_error_code(__func__,ret); + return __convert_camera_error_code(__func__, ret); } @@ -1156,15 +1140,15 @@ int legacy_camera_stop_face_detection(camera_h camera) } ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, - MMCAM_DETECT_MODE, MM_CAMCORDER_DETECT_MODE_OFF, - NULL); + MMCAM_DETECT_MODE, MM_CAMCORDER_DETECT_MODE_OFF, + NULL); if (ret == MM_ERROR_NONE) { handle->user_cb[_CAMERA_EVENT_TYPE_FACE_DETECTION] = NULL; handle->user_data[_CAMERA_EVENT_TYPE_FACE_DETECTION] = NULL; handle->num_of_faces = 0; } - return __convert_camera_error_code(__func__,ret); + return __convert_camera_error_code(__func__, ret); } @@ -1183,8 +1167,8 @@ int legacy_camera_get_state(camera_h camera, camera_state_e *state) capi_state = __camera_state_convert(mmstate); if ((handle->state == CAMERA_STATE_CAPTURED || handle->is_capture_completed) && - (handle->current_capture_count > 0 || handle->is_capture_completed) && - mmstate == MM_CAMCORDER_STATE_CAPTURING) { + (handle->current_capture_count > 0 || handle->is_capture_completed) && + mmstate == MM_CAMCORDER_STATE_CAPTURING) { capi_state = CAMERA_STATE_CAPTURED; } @@ -1221,8 +1205,8 @@ int legacy_camera_start_focusing(camera_h camera, bool continuous) LOGD("apply cached focus mode %d", handle->cached_focus_mode); mm_camcorder_set_attributes(handle->mm_handle, NULL, - MMCAM_CAMERA_AF_SCAN_RANGE, handle->cached_focus_mode, - NULL); + MMCAM_CAMERA_AF_SCAN_RANGE, handle->cached_focus_mode, + NULL); handle->cached_focus_mode = -1; } @@ -1231,9 +1215,9 @@ int legacy_camera_start_focusing(camera_h camera, bool continuous) return __camera_start_continuous_focusing(camera); } else { mm_camcorder_set_attributes(handle->mm_handle, NULL, - MMCAM_CAMERA_FOCUS_MODE, handle->focus_area_valid ? \ - MM_CAMCORDER_FOCUS_MODE_TOUCH_AUTO : MM_CAMCORDER_FOCUS_MODE_AUTO, - NULL); + MMCAM_CAMERA_FOCUS_MODE, handle->focus_area_valid ? \ + MM_CAMCORDER_FOCUS_MODE_TOUCH_AUTO : MM_CAMCORDER_FOCUS_MODE_AUTO, + NULL); return __convert_camera_error_code(__func__, mm_camcorder_start_focusing(((camera_s *)camera)->mm_handle)); } @@ -1253,15 +1237,15 @@ int __camera_start_continuous_focusing(camera_h camera) handle->on_continuous_focusing = true; mm_camcorder_get_attributes(handle->mm_handle, NULL, - MMCAM_CAMERA_FOCUS_MODE, &mode, - NULL); + MMCAM_CAMERA_FOCUS_MODE, &mode, + NULL); if (mode == MM_CAMCORDER_FOCUS_MODE_CONTINUOUS) { ret = mm_camcorder_start_focusing(handle->mm_handle); } else { ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, - MMCAM_CAMERA_FOCUS_MODE, MM_CAMCORDER_FOCUS_MODE_CONTINUOUS, - NULL); + MMCAM_CAMERA_FOCUS_MODE, MM_CAMCORDER_FOCUS_MODE_CONTINUOUS, + NULL); } return __convert_camera_error_code(__func__, ret); @@ -1346,8 +1330,8 @@ int legacy_camera_set_display(camera_h camera, camera_display_type_e type, camer } ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, - MMCAM_DISPLAY_SOCKET_PATH, socket_path, strlen(socket_path), - NULL); + MMCAM_DISPLAY_SOCKET_PATH, socket_path, strlen(socket_path), + NULL); } else if (type != CAMERA_DISPLAY_TYPE_NONE) { ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, MMCAM_DISPLAY_HANDLE, set_handle, sizeof(void *), @@ -1361,7 +1345,7 @@ int legacy_camera_set_display(camera_h camera, camera_display_type_e type, camer int legacy_camera_set_preview_resolution(camera_h camera, int width, int height) { - if( camera == NULL){ + if (camera == NULL) { LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } @@ -1378,18 +1362,17 @@ int legacy_camera_set_preview_resolution(camera_h camera, int width, int height) int i = 0; mm_camcorder_get_attributes(handle->mm_handle, NULL, - MMCAM_CAMERA_FPS, &mm_fps, - NULL); + MMCAM_CAMERA_FPS, &mm_fps, + NULL); ret = mm_camcorder_get_fps_list_by_resolution(handle->mm_handle, width, height, &info); - if (ret != MM_ERROR_NONE) { + if (ret != MM_ERROR_NONE) return __convert_camera_error_code(__func__, ret); - } for (i = 0 ; i < info.int_array.count ; i++) { - if (info.int_array.array[i] == mm_fps) { + if (info.int_array.array[i] == mm_fps) break; - } + if (i == info.int_array.count - 1) { LOGE("Not supported resolution: Current set Resolution's FPS is not supported in wanted resolution."); return CAMERA_ERROR_NOT_SUPPORTED; @@ -1397,9 +1380,9 @@ int legacy_camera_set_preview_resolution(camera_h camera, int width, int height) } ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, - MMCAM_CAMERA_WIDTH, width, - MMCAM_CAMERA_HEIGHT, height, - NULL); + MMCAM_CAMERA_WIDTH, width, + MMCAM_CAMERA_HEIGHT, height, + NULL); return __convert_camera_error_code(__func__, ret); } @@ -1421,9 +1404,9 @@ int legacy_camera_set_capture_resolution(camera_h camera, int width, int height) camera_s *handle = (camera_s *)camera; ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, - MMCAM_CAPTURE_WIDTH, width, - MMCAM_CAPTURE_HEIGHT, height, - NULL); + MMCAM_CAPTURE_WIDTH, width, + MMCAM_CAPTURE_HEIGHT, height, + NULL); if (ret == MM_ERROR_NONE) { handle->capture_width = width; handle->capture_height = height; @@ -1450,8 +1433,8 @@ int legacy_camera_set_capture_format(camera_h camera, camera_pixel_format_e form camera_s *handle = (camera_s *)camera; ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, - MMCAM_CAPTURE_FORMAT, format, - NULL); + MMCAM_CAPTURE_FORMAT, format, + NULL); return __convert_camera_error_code(__func__, ret); } @@ -1479,17 +1462,16 @@ int legacy_camera_set_preview_format(camera_h camera, camera_pixel_format_e form MMCamAttrsInfo supported_format; ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_FORMAT , &supported_format); for (i = 0 ; i < supported_format.int_array.count ; i++) { - if (supported_format.int_array.array[i] == MM_PIXEL_FORMAT_ITLV_JPEG_UYVY) { + if (supported_format.int_array.array[i] == MM_PIXEL_FORMAT_ITLV_JPEG_UYVY) supported_ITLV_UYVY = true; - } } ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, - MMCAM_CAMERA_FORMAT, supported_ITLV_UYVY ? MM_PIXEL_FORMAT_ITLV_JPEG_UYVY : MM_PIXEL_FORMAT_UYVY, - NULL); + MMCAM_CAMERA_FORMAT, supported_ITLV_UYVY ? MM_PIXEL_FORMAT_ITLV_JPEG_UYVY : MM_PIXEL_FORMAT_UYVY, + NULL); } else { ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, - MMCAM_CAMERA_FORMAT, format, - NULL); + MMCAM_CAMERA_FORMAT, format, + NULL); } return __convert_camera_error_code(__func__, ret); @@ -1507,9 +1489,9 @@ int legacy_camera_get_preview_resolution(camera_h camera, int *width, int *heigh camera_s *handle = (camera_s *)camera; ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, - MMCAM_CAMERA_WIDTH, width, - MMCAM_CAMERA_HEIGHT, height, - NULL); + MMCAM_CAMERA_WIDTH, width, + MMCAM_CAMERA_HEIGHT, height, + NULL); return __convert_camera_error_code(__func__, ret); } @@ -1531,8 +1513,8 @@ int legacy_camera_set_display_rotation(camera_h camera, camera_rotation_e rotati camera_s *handle = (camera_s *)camera; ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, - MMCAM_DISPLAY_ROTATION, rotation, - NULL); + MMCAM_DISPLAY_ROTATION, rotation, + NULL); return __convert_camera_error_code(__func__, ret); } @@ -1549,8 +1531,8 @@ int legacy_camera_get_display_rotation(camera_h camera, camera_rotation_e *rotat camera_s *handle = (camera_s *)camera; ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, - MMCAM_DISPLAY_ROTATION, rotation, - NULL); + MMCAM_DISPLAY_ROTATION, rotation, + NULL); return __convert_camera_error_code(__func__, ret); } @@ -1572,8 +1554,8 @@ int legacy_camera_set_display_flip(camera_h camera, camera_flip_e flip) camera_s *handle = (camera_s *)camera; ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, - MMCAM_DISPLAY_FLIP, flip, - NULL); + MMCAM_DISPLAY_FLIP, flip, + NULL); return __convert_camera_error_code(__func__, ret); } @@ -1590,8 +1572,8 @@ int legacy_camera_get_display_flip(camera_h camera, camera_flip_e *flip) camera_s *handle = (camera_s *)camera; ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, - MMCAM_DISPLAY_FLIP, flip, - NULL); + MMCAM_DISPLAY_FLIP, flip, + NULL); return __convert_camera_error_code(__func__, ret); } @@ -1608,8 +1590,8 @@ int legacy_camera_set_display_visible(camera_h camera, bool visible) camera_s *handle = (camera_s *)camera; ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, - MMCAM_DISPLAY_VISIBLE, visible, - NULL); + MMCAM_DISPLAY_VISIBLE, visible, + NULL); return __convert_camera_error_code(__func__, ret); } @@ -1627,12 +1609,11 @@ int legacy_camera_is_display_visible(camera_h camera, bool* visible) camera_s *handle = (camera_s *)camera; ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, - MMCAM_DISPLAY_VISIBLE, &result, - NULL); + MMCAM_DISPLAY_VISIBLE, &result, + NULL); - if (ret == MM_ERROR_NONE) { + if (ret == MM_ERROR_NONE) *visible = result; - } return __convert_camera_error_code(__func__, ret); } @@ -1654,8 +1635,8 @@ int legacy_camera_set_display_mode(camera_h camera, camera_display_mode_e mode) camera_s *handle = (camera_s *)camera; ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, - MMCAM_DISPLAY_GEOMETRY_METHOD, mode, - NULL); + MMCAM_DISPLAY_GEOMETRY_METHOD, mode, + NULL); return __convert_camera_error_code(__func__, ret); } @@ -1672,8 +1653,8 @@ int legacy_camera_get_display_mode(camera_h camera, camera_display_mode_e *mode) camera_s *handle = (camera_s *)camera; ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, - MMCAM_DISPLAY_GEOMETRY_METHOD, mode, - NULL); + MMCAM_DISPLAY_GEOMETRY_METHOD, mode, + NULL); return __convert_camera_error_code(__func__, ret); } @@ -1706,8 +1687,8 @@ int legacy_camera_get_capture_format(camera_h camera, camera_pixel_format_e *for camera_s *handle = (camera_s *)camera; ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, - MMCAM_CAPTURE_FORMAT, format, - NULL); + MMCAM_CAPTURE_FORMAT, format, + NULL); return __convert_camera_error_code(__func__, ret); } @@ -1724,12 +1705,11 @@ int legacy_camera_get_preview_format(camera_h camera, camera_pixel_format_e *for camera_s *handle = (camera_s *)camera; ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, - MMCAM_CAMERA_FORMAT, format, - NULL); + MMCAM_CAMERA_FORMAT, format, + NULL); - if ((MMPixelFormatType)*format == MM_PIXEL_FORMAT_ITLV_JPEG_UYVY) { + if ((MMPixelFormatType)*format == MM_PIXEL_FORMAT_ITLV_JPEG_UYVY) *format = CAMERA_PIXEL_FORMAT_UYVY; - } return __convert_camera_error_code(__func__, ret); } @@ -1745,8 +1725,8 @@ int legacy_camera_get_facing_direction(camera_h camera, camera_facing_direction_ camera_s *handle = (camera_s *)camera; ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, - MMCAM_CAMERA_FACING_DIRECTION, facing_direction, - NULL); + MMCAM_CAMERA_FACING_DIRECTION, facing_direction, + NULL); return __convert_camera_error_code(__func__, ret); } @@ -1763,8 +1743,8 @@ int legacy_camera_set_preview_cb(camera_h camera, camera_preview_cb callback, vo handle->user_data[_CAMERA_EVENT_TYPE_PREVIEW] = (void *)user_data; mm_camcorder_set_video_stream_callback(handle->mm_handle, - (mm_camcorder_video_stream_callback)__mm_videostream_callback, - (void *)handle); + (mm_camcorder_video_stream_callback)__mm_videostream_callback, + (void *)handle); return CAMERA_ERROR_NONE; } @@ -1781,8 +1761,8 @@ int legacy_camera_unset_preview_cb(camera_h camera) if (handle->user_cb[_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] == NULL) { mm_camcorder_set_video_stream_callback(handle->mm_handle, - (mm_camcorder_video_stream_callback)NULL, - (void *)NULL); + (mm_camcorder_video_stream_callback)NULL, + (void *)NULL); } handle->user_cb[_CAMERA_EVENT_TYPE_PREVIEW] = (void *)NULL; @@ -1814,8 +1794,8 @@ int legacy_camera_set_media_packet_preview_cb(camera_h camera, camera_preview_cb handle->user_data[_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = (void *)user_data; mm_camcorder_set_video_stream_callback(handle->mm_handle, - (mm_camcorder_video_stream_callback)__mm_videostream_callback, - (void *)handle); + (mm_camcorder_video_stream_callback)__mm_videostream_callback, + (void *)handle); return CAMERA_ERROR_NONE; } @@ -1837,8 +1817,8 @@ int legacy_camera_unset_media_packet_preview_cb(camera_h camera) if (handle->user_cb[_CAMERA_EVENT_TYPE_PREVIEW] == NULL) { mm_camcorder_set_video_stream_callback(handle->mm_handle, - (mm_camcorder_video_stream_callback)NULL, - (void *)NULL); + (mm_camcorder_video_stream_callback)NULL, + (void *)NULL); } handle->user_cb[_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = (void *)NULL; @@ -2024,14 +2004,12 @@ int legacy_camera_foreach_supported_preview_resolution(camera_h camera, camera_s ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_WIDTH, &preview_width); ret |= mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_HEIGHT, &preview_height); - if (ret != CAMERA_ERROR_NONE) { + if (ret != CAMERA_ERROR_NONE) return __convert_camera_error_code(__func__, ret); - } for (i = 0 ; i < preview_width.int_array.count ; i++) { - if (!foreach_cb(preview_width.int_array.array[i], preview_height.int_array.array[i], user_data)) { + if (!foreach_cb(preview_width.int_array.array[i], preview_height.int_array.array[i], user_data)) break; - } } return CAMERA_ERROR_NONE; @@ -2053,14 +2031,12 @@ int legacy_camera_foreach_supported_capture_resolution(camera_h camera, camera_s ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAPTURE_WIDTH, &capture_width); ret |= mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAPTURE_HEIGHT, &capture_height); - if (ret != CAMERA_ERROR_NONE) { + if (ret != CAMERA_ERROR_NONE) return __convert_camera_error_code(__func__, ret); - } for (i = 0 ; i < capture_width.int_array.count ; i++) { - if (!foreach_cb(capture_width.int_array.array[i], capture_height.int_array.array[i], user_data)) { + if (!foreach_cb(capture_width.int_array.array[i], capture_height.int_array.array[i], user_data)) break; - } } return CAMERA_ERROR_NONE; @@ -2080,15 +2056,13 @@ int legacy_camera_foreach_supported_capture_format(camera_h camera, camera_suppo MMCamAttrsInfo format; ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAPTURE_FORMAT, &format); - if (ret != CAMERA_ERROR_NONE) { + if (ret != CAMERA_ERROR_NONE) return __convert_camera_error_code(__func__, ret); - } for (i = 0 ; i < format.int_array.count ; i++) { if (format.int_array.array[i] != MM_PIXEL_FORMAT_ITLV_JPEG_UYVY) { - if (!foreach_cb(format.int_array.array[i], user_data)) { + if (!foreach_cb(format.int_array.array[i], user_data)) break; - } } } @@ -2109,15 +2083,13 @@ int legacy_camera_foreach_supported_preview_format(camera_h camera, camera_suppo MMCamAttrsInfo format; ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_FORMAT, &format); - if (ret != CAMERA_ERROR_NONE) { + if (ret != CAMERA_ERROR_NONE) return __convert_camera_error_code(__func__, ret); - } for (i = 0 ; i < format.int_array.count ; i++) { if (format.int_array.array[i] != MM_PIXEL_FORMAT_ITLV_JPEG_UYVY) { - if (!foreach_cb(format.int_array.array[i], user_data)) { + if (!foreach_cb(format.int_array.array[i], user_data)) break; - } } } @@ -2157,9 +2129,8 @@ int legacy_camera_get_recommended_preview_resolution(camera_h camera, int *width ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_RECOMMEND_CAMERA_WIDTH, &width_info); ret |= mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_RECOMMEND_CAMERA_HEIGHT, &height_info); - if (ret != MM_ERROR_NONE) { + if (ret != MM_ERROR_NONE) return __convert_camera_error_code(__func__, ret); - } if (width && (unsigned int)width_info.int_array.count > wide) { *width = width_info.int_array.array[wide]; @@ -2193,8 +2164,8 @@ int legacy_camera_attr_get_lens_orientation(camera_h camera, int *angle) int rotation = MM_DISPLAY_ROTATION_NONE; ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, - MMCAM_RECOMMEND_DISPLAY_ROTATION, &rotation, - NULL); + MMCAM_RECOMMEND_DISPLAY_ROTATION, &rotation, + NULL); if (ret == MM_ERROR_NONE) { switch (rotation) { @@ -2210,7 +2181,7 @@ int legacy_camera_attr_get_lens_orientation(camera_h camera, int *angle) case MM_DISPLAY_ROTATION_270: *angle = 90; break; - default : + default: *angle = 0; break; } @@ -2236,8 +2207,8 @@ int legacy_camera_attr_set_theater_mode(camera_h camera, camera_attr_theater_mod camera_s *handle = (camera_s *)camera; ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, - MMCAM_DISPLAY_MODE, mode, - NULL); + MMCAM_DISPLAY_MODE, mode, + NULL); return __convert_camera_error_code(__func__, ret); } @@ -2254,8 +2225,8 @@ int legacy_camera_attr_get_theater_mode(camera_h camera, camera_attr_theater_mod camera_s *handle = (camera_s *)camera; ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, - MMCAM_DISPLAY_MODE, mode, - NULL); + MMCAM_DISPLAY_MODE, mode, + NULL); return __convert_camera_error_code(__func__, ret); } @@ -2274,14 +2245,12 @@ int legacy_camera_attr_foreach_supported_theater_mode(camera_h camera, camera_at MMCamAttrsInfo info; ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_DISPLAY_MODE, &info); - if (ret != CAMERA_ERROR_NONE) { + if (ret != CAMERA_ERROR_NONE) return __convert_camera_error_code(__func__, ret); - } for (i = 0 ; i < info.int_array.count ; i++) { - if (!foreach_cb(info.int_array.array[i], user_data)) { + if (!foreach_cb(info.int_array.array[i], user_data)) break; - } } return CAMERA_ERROR_NONE; @@ -2305,13 +2274,13 @@ int legacy_camera_attr_set_preview_fps(camera_h camera, camera_attr_fps_e fps) if (fps == CAMERA_ATTR_FPS_AUTO) { ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, - MMCAM_CAMERA_FPS_AUTO, true, - NULL); + MMCAM_CAMERA_FPS_AUTO, true, + NULL); } else { ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, - MMCAM_CAMERA_FPS_AUTO, false, - MMCAM_CAMERA_FPS, fps, - NULL); + MMCAM_CAMERA_FPS_AUTO, false, + MMCAM_CAMERA_FPS, fps, + NULL); } return __convert_camera_error_code(__func__, ret); @@ -2334,8 +2303,8 @@ int legacy_camera_attr_set_image_quality(camera_h camera, int quality) camera_s *handle = (camera_s *)camera; ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, - MMCAM_IMAGE_ENCODER_QUALITY, quality, - NULL); + MMCAM_IMAGE_ENCODER_QUALITY, quality, + NULL); return __convert_camera_error_code(__func__, ret); } @@ -2354,15 +2323,14 @@ int legacy_camera_attr_get_preview_fps(camera_h camera, camera_attr_fps_e *fps) camera_s *handle = (camera_s *)camera; ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, - MMCAM_CAMERA_FPS, &mm_fps, - MMCAM_CAMERA_FPS_AUTO, &is_auto, - NULL); + MMCAM_CAMERA_FPS, &mm_fps, + MMCAM_CAMERA_FPS_AUTO, &is_auto, + NULL); if (ret == MM_ERROR_NONE) { - if (is_auto) { + if (is_auto) *fps = CAMERA_ATTR_FPS_AUTO; - } else { + else *fps = mm_fps; - } } return __convert_camera_error_code(__func__, ret); @@ -2380,8 +2348,8 @@ int legacy_camera_attr_get_image_quality(camera_h camera, int *quality) camera_s *handle = (camera_s *)camera; ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, - MMCAM_IMAGE_ENCODER_QUALITY, quality, - NULL); + MMCAM_IMAGE_ENCODER_QUALITY, quality, + NULL); return __convert_camera_error_code(__func__, ret); } @@ -2403,8 +2371,8 @@ int legacy_camera_attr_set_zoom(camera_h camera, int zoom) camera_s *handle = (camera_s *)camera; ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, - MMCAM_CAMERA_DIGITAL_ZOOM, zoom, - NULL); + MMCAM_CAMERA_DIGITAL_ZOOM, zoom, + NULL); return __convert_camera_error_code(__func__, ret); } @@ -2428,8 +2396,8 @@ int legacy_camera_attr_set_af_mode(camera_h camera, camera_attr_af_mode_e mode) bool should_change_focus_mode = false; mm_camcorder_get_attributes(handle->mm_handle, NULL, - MMCAM_CAMERA_FOCUS_MODE, &focus_mode, - NULL); + MMCAM_CAMERA_FOCUS_MODE, &focus_mode, + NULL); if (focus_mode != MM_CAMCORDER_FOCUS_MODE_TOUCH_AUTO && focus_mode != MM_CAMCORDER_FOCUS_MODE_CONTINUOUS && @@ -2449,31 +2417,31 @@ int legacy_camera_attr_set_af_mode(camera_h camera, camera_attr_af_mode_e mode) if (mode != CAMERA_ATTR_AF_NONE && should_change_focus_mode) { mm_camcorder_set_attributes(handle->mm_handle, NULL, - MMCAM_CAMERA_FOCUS_MODE, MM_CAMCORDER_FOCUS_MODE_AUTO, - NULL); + MMCAM_CAMERA_FOCUS_MODE, MM_CAMCORDER_FOCUS_MODE_AUTO, + NULL); } switch (mode) { case CAMERA_ATTR_AF_NONE: ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, - MMCAM_CAMERA_FOCUS_MODE, MM_CAMCORDER_FOCUS_MODE_NONE, - MMCAM_CAMERA_AF_SCAN_RANGE, MM_CAMCORDER_AUTO_FOCUS_NONE, - NULL); + MMCAM_CAMERA_FOCUS_MODE, MM_CAMCORDER_FOCUS_MODE_NONE, + MMCAM_CAMERA_AF_SCAN_RANGE, MM_CAMCORDER_AUTO_FOCUS_NONE, + NULL); break; case CAMERA_ATTR_AF_NORMAL: ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, - MMCAM_CAMERA_AF_SCAN_RANGE, MM_CAMCORDER_AUTO_FOCUS_NORMAL, - NULL); + MMCAM_CAMERA_AF_SCAN_RANGE, MM_CAMCORDER_AUTO_FOCUS_NORMAL, + NULL); break; case CAMERA_ATTR_AF_MACRO: ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, - MMCAM_CAMERA_AF_SCAN_RANGE, MM_CAMCORDER_AUTO_FOCUS_MACRO, - NULL); + MMCAM_CAMERA_AF_SCAN_RANGE, MM_CAMCORDER_AUTO_FOCUS_MACRO, + NULL); break; case CAMERA_ATTR_AF_FULL: ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, - MMCAM_CAMERA_AF_SCAN_RANGE, MM_CAMCORDER_AUTO_FOCUS_FULL, - NULL); + MMCAM_CAMERA_AF_SCAN_RANGE, MM_CAMCORDER_AUTO_FOCUS_FULL, + NULL); break; default: LOGE("invalid mode %d", mode); @@ -2507,12 +2475,11 @@ int legacy_camera_attr_set_af_area(camera_h camera, int x, int y) } ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, - MMCAM_CAMERA_AF_TOUCH_X, x, - MMCAM_CAMERA_AF_TOUCH_Y, y, - NULL); - if (ret == MM_ERROR_NONE) { + MMCAM_CAMERA_AF_TOUCH_X, x, + MMCAM_CAMERA_AF_TOUCH_Y, y, + NULL); + if (ret == MM_ERROR_NONE) handle->focus_area_valid = true; - } return __convert_camera_error_code(__func__, ret); } @@ -2545,12 +2512,13 @@ int legacy_camera_attr_set_exposure_mode(camera_h camera, camera_attr_exposure_m return CAMERA_ERROR_INVALID_PARAMETER; } - int maptable[] = {MM_CAMCORDER_AUTO_EXPOSURE_OFF, /* CAMERA_ATTR_EXPOSURE_MODE_OFF */ - MM_CAMCORDER_AUTO_EXPOSURE_ALL, /* CAMERA_ATTR_EXPOSURE_MODE_ALL */ - MM_CAMCORDER_AUTO_EXPOSURE_CENTER_1, /* CAMERA_ATTR_EXPOSURE_MODE_CENTER */ - MM_CAMCORDER_AUTO_EXPOSURE_SPOT_1, /* CAMERA_ATTR_EXPOSURE_MODE_SPOT */ - MM_CAMCORDER_AUTO_EXPOSURE_CUSTOM_1, /* CAMERA_ATTR_EXPOSURE_MODE_CUSTOM */ - }; + int maptable[] = { + MM_CAMCORDER_AUTO_EXPOSURE_OFF, /* CAMERA_ATTR_EXPOSURE_MODE_OFF */ + MM_CAMCORDER_AUTO_EXPOSURE_ALL, /* CAMERA_ATTR_EXPOSURE_MODE_ALL */ + MM_CAMCORDER_AUTO_EXPOSURE_CENTER_1, /* CAMERA_ATTR_EXPOSURE_MODE_CENTER */ + MM_CAMCORDER_AUTO_EXPOSURE_SPOT_1, /* CAMERA_ATTR_EXPOSURE_MODE_SPOT */ + MM_CAMCORDER_AUTO_EXPOSURE_CUSTOM_1, /* CAMERA_ATTR_EXPOSURE_MODE_CUSTOM */ + }; int ret = MM_ERROR_NONE; camera_s *handle = (camera_s *)camera; @@ -2561,8 +2529,8 @@ int legacy_camera_attr_set_exposure_mode(camera_h camera, camera_attr_exposure_m } ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, - MMCAM_CAMERA_EXPOSURE_MODE, maptable[mode], - NULL); + MMCAM_CAMERA_EXPOSURE_MODE, maptable[mode], + NULL); return __convert_camera_error_code(__func__, ret); } @@ -2579,8 +2547,8 @@ int legacy_camera_attr_set_exposure(camera_h camera, int value) camera_s *handle = (camera_s *)camera; ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, - MMCAM_CAMERA_EXPOSURE_VALUE, value, - NULL); + MMCAM_CAMERA_EXPOSURE_VALUE, value, + NULL); return __convert_camera_error_code(__func__, ret); } @@ -2599,11 +2567,11 @@ int legacy_camera_attr_set_iso(camera_h camera, camera_attr_iso_e iso) } int ret = MM_ERROR_NONE; - camera_s *handle = (camera_s*)camera; + camera_s *handle = (camera_s *)camera; ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, - MMCAM_CAMERA_ISO, iso, - NULL); + MMCAM_CAMERA_ISO, iso, + NULL); return __convert_camera_error_code(__func__, ret); } @@ -2620,8 +2588,8 @@ int legacy_camera_attr_set_brightness(camera_h camera, int level) camera_s *handle = (camera_s *)camera; ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, - MMCAM_FILTER_BRIGHTNESS, level, - NULL); + MMCAM_FILTER_BRIGHTNESS, level, + NULL); return __convert_camera_error_code(__func__, ret); } @@ -2638,8 +2606,8 @@ int legacy_camera_attr_set_contrast(camera_h camera, int level) camera_s *handle = (camera_s *)camera; ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, - MMCAM_FILTER_CONTRAST, level, - NULL); + MMCAM_FILTER_CONTRAST, level, + NULL); return __convert_camera_error_code(__func__, ret); } @@ -2661,8 +2629,8 @@ int legacy_camera_attr_set_whitebalance(camera_h camera, camera_attr_whitebalanc camera_s *handle = (camera_s *)camera; ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, - MMCAM_FILTER_WB, wb, - NULL); + MMCAM_FILTER_WB, wb, + NULL); return __convert_camera_error_code(__func__, ret); } @@ -2684,8 +2652,8 @@ int legacy_camera_attr_set_effect(camera_h camera, camera_attr_effect_mode_e eff camera_s *handle = (camera_s *)camera; ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, - MMCAM_FILTER_COLOR_TONE, effect, - NULL); + MMCAM_FILTER_COLOR_TONE, effect, + NULL); return __convert_camera_error_code(__func__, ret); } @@ -2707,8 +2675,8 @@ int legacy_camera_attr_set_scene_mode(camera_h camera, camera_attr_scene_mode_e camera_s *handle = (camera_s *)camera; ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, - MMCAM_FILTER_SCENE_MODE, mode, - NULL); + MMCAM_FILTER_SCENE_MODE, mode, + NULL); return __convert_camera_error_code(__func__, ret); } @@ -2725,8 +2693,8 @@ int legacy_camera_attr_enable_tag(camera_h camera, bool enable) camera_s *handle = (camera_s *)camera; ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, - MMCAM_TAG_ENABLE, enable, - NULL); + MMCAM_TAG_ENABLE, enable, + NULL); return __convert_camera_error_code(__func__, ret); } @@ -2808,11 +2776,11 @@ int legacy_camera_attr_set_geotag(camera_h camera, double latitude , double long camera_s *handle = (camera_s *)camera; ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, - MMCAM_TAG_GPS_ENABLE, true, - MMCAM_TAG_LATITUDE, latitude, - MMCAM_TAG_LONGITUDE, longitude, - MMCAM_TAG_ALTITUDE, altitude, - NULL); + MMCAM_TAG_GPS_ENABLE, true, + MMCAM_TAG_LATITUDE, latitude, + MMCAM_TAG_LONGITUDE, longitude, + MMCAM_TAG_ALTITUDE, altitude, + NULL); return __convert_camera_error_code(__func__, ret); } @@ -2829,8 +2797,8 @@ int legacy_camera_attr_remove_geotag(camera_h camera) camera_s *handle = (camera_s *)camera; ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, - MMCAM_TAG_GPS_ENABLE, false, - NULL); + MMCAM_TAG_GPS_ENABLE, false, + NULL); return __convert_camera_error_code(__func__, ret); } @@ -2852,8 +2820,8 @@ int legacy_camera_attr_set_flash_mode(camera_h camera, camera_attr_flash_mode_e camera_s *handle = (camera_s *)camera; ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, - MMCAM_STROBE_MODE, mode, - NULL); + MMCAM_STROBE_MODE, mode, + NULL); return __convert_camera_error_code(__func__, ret); } @@ -2870,8 +2838,8 @@ int legacy_camera_attr_get_zoom(camera_h camera, int *zoom) camera_s *handle = (camera_s *)camera; ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, - MMCAM_CAMERA_DIGITAL_ZOOM, zoom, - NULL); + MMCAM_CAMERA_DIGITAL_ZOOM, zoom, + NULL); return __convert_camera_error_code(__func__, ret); } @@ -2912,10 +2880,10 @@ int legacy_camera_attr_get_af_mode(camera_h camera, camera_attr_af_mode_e *mode) camera_s *handle = (camera_s *)camera; ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, - MMCAM_CAMERA_FOCUS_MODE, &focus_mode, - MMCAM_CAMERA_AF_SCAN_RANGE, &af_range, - MMCAM_DETECT_MODE, &detect_mode, - NULL); + MMCAM_CAMERA_FOCUS_MODE, &focus_mode, + MMCAM_CAMERA_AF_SCAN_RANGE, &af_range, + MMCAM_DETECT_MODE, &detect_mode, + NULL); if (ret == MM_ERROR_NONE) { switch (focus_mode) { case MM_CAMCORDER_FOCUS_MODE_NONE: @@ -2939,7 +2907,7 @@ int legacy_camera_attr_get_af_mode(camera_h camera, camera_attr_af_mode_e *mode) case MM_CAMCORDER_AUTO_FOCUS_FULL: *mode = CAMERA_ATTR_AF_FULL; break; - default : + default: *mode = CAMERA_ATTR_AF_NORMAL; break; } @@ -2961,27 +2929,27 @@ int legacy_camera_attr_get_exposure_mode(camera_h camera, camera_attr_exposure_m return CAMERA_ERROR_INVALID_PARAMETER; } - int maptable[] = {CAMERA_ATTR_EXPOSURE_MODE_OFF, /* MM_CAMCORDER_AUTO_EXPOSURE_OFF */ - CAMERA_ATTR_EXPOSURE_MODE_ALL, /* MM_CAMCORDER_AUTO_EXPOSURE_ALL */ - CAMERA_ATTR_EXPOSURE_MODE_CENTER, /* MM_CAMCORDER_AUTO_EXPOSURE_CENTER_1 */ - CAMERA_ATTR_EXPOSURE_MODE_CENTER, /* MM_CAMCORDER_AUTO_EXPOSURE_CENTER_2 */ - CAMERA_ATTR_EXPOSURE_MODE_CENTER, /* MM_CAMCORDER_AUTO_EXPOSURE_CENTER_3 */ - CAMERA_ATTR_EXPOSURE_MODE_SPOT, /* MM_CAMCORDER_AUTO_EXPOSURE_SPOT_1 */ - CAMERA_ATTR_EXPOSURE_MODE_SPOT, /* MM_CAMCORDER_AUTO_EXPOSURE_SPOT_2 */ - CAMERA_ATTR_EXPOSURE_MODE_CUSTOM, /* MM_CAMCORDER_AUTO_EXPOSURE_CUSTOM_1 */ - CAMERA_ATTR_EXPOSURE_MODE_CUSTOM /* MM_CAMCORDER_AUTO_EXPOSURE_CUSTOM_2 */ - }; + int maptable[] = { + CAMERA_ATTR_EXPOSURE_MODE_OFF, /* MM_CAMCORDER_AUTO_EXPOSURE_OFF */ + CAMERA_ATTR_EXPOSURE_MODE_ALL, /* MM_CAMCORDER_AUTO_EXPOSURE_ALL */ + CAMERA_ATTR_EXPOSURE_MODE_CENTER, /* MM_CAMCORDER_AUTO_EXPOSURE_CENTER_1 */ + CAMERA_ATTR_EXPOSURE_MODE_CENTER, /* MM_CAMCORDER_AUTO_EXPOSURE_CENTER_2 */ + CAMERA_ATTR_EXPOSURE_MODE_CENTER, /* MM_CAMCORDER_AUTO_EXPOSURE_CENTER_3 */ + CAMERA_ATTR_EXPOSURE_MODE_SPOT, /* MM_CAMCORDER_AUTO_EXPOSURE_SPOT_1 */ + CAMERA_ATTR_EXPOSURE_MODE_SPOT, /* MM_CAMCORDER_AUTO_EXPOSURE_SPOT_2 */ + CAMERA_ATTR_EXPOSURE_MODE_CUSTOM, /* MM_CAMCORDER_AUTO_EXPOSURE_CUSTOM_1 */ + CAMERA_ATTR_EXPOSURE_MODE_CUSTOM /* MM_CAMCORDER_AUTO_EXPOSURE_CUSTOM_2 */ + }; int ret = MM_ERROR_NONE; int exposure_mode; camera_s *handle = (camera_s *)camera; ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, - MMCAM_CAMERA_EXPOSURE_MODE, &exposure_mode, - NULL); + MMCAM_CAMERA_EXPOSURE_MODE, &exposure_mode, + NULL); - if (ret == CAMERA_ERROR_NONE) { - *mode = maptable[abs(exposure_mode%9)]; - } + if (ret == CAMERA_ERROR_NONE) + *mode = maptable[abs(exposure_mode % 9)]; return __convert_camera_error_code(__func__, ret); } @@ -2998,8 +2966,8 @@ int legacy_camera_attr_get_exposure(camera_h camera, int *value) camera_s *handle = (camera_s *)camera; ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, - MMCAM_CAMERA_EXPOSURE_VALUE, value, - NULL); + MMCAM_CAMERA_EXPOSURE_VALUE, value, + NULL); return __convert_camera_error_code(__func__, ret); } @@ -3037,8 +3005,8 @@ int legacy_camera_attr_get_iso(camera_h camera, camera_attr_iso_e *iso) camera_s *handle = (camera_s *)camera; ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, - MMCAM_CAMERA_ISO, iso, - NULL); + MMCAM_CAMERA_ISO, iso, + NULL); return __convert_camera_error_code(__func__, ret); } @@ -3055,8 +3023,8 @@ int legacy_camera_attr_get_brightness(camera_h camera, int *level) camera_s *handle = (camera_s *)camera; ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, - MMCAM_FILTER_BRIGHTNESS, level, - NULL); + MMCAM_FILTER_BRIGHTNESS, level, + NULL); return __convert_camera_error_code(__func__, ret); } @@ -3094,8 +3062,8 @@ int legacy_camera_attr_get_contrast(camera_h camera, int *level) camera_s *handle = (camera_s *)camera; ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, - MMCAM_FILTER_CONTRAST, level, - NULL); + MMCAM_FILTER_CONTRAST, level, + NULL); return __convert_camera_error_code(__func__, ret); } @@ -3133,8 +3101,8 @@ int legacy_camera_attr_get_whitebalance(camera_h camera, camera_attr_whitebalanc camera_s *handle = (camera_s *)camera; ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, - MMCAM_FILTER_WB, wb, - NULL); + MMCAM_FILTER_WB, wb, + NULL); return __convert_camera_error_code(__func__, ret); } @@ -3151,8 +3119,8 @@ int legacy_camera_attr_get_effect(camera_h camera, camera_attr_effect_mode_e *ef camera_s *handle = (camera_s *)camera; ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, - MMCAM_FILTER_COLOR_TONE, effect, - NULL); + MMCAM_FILTER_COLOR_TONE, effect, + NULL); return __convert_camera_error_code(__func__, ret); } @@ -3169,8 +3137,8 @@ int legacy_camera_attr_get_scene_mode(camera_h camera, camera_attr_scene_mode_e camera_s *handle = (camera_s *)camera; ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, - MMCAM_FILTER_SCENE_MODE, mode, - NULL); + MMCAM_FILTER_SCENE_MODE, mode, + NULL); return __convert_camera_error_code(__func__, ret); } @@ -3187,8 +3155,8 @@ int legacy_camera_attr_is_enabled_tag(camera_h camera, bool *enable) camera_s *handle = (camera_s *)camera; ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, - MMCAM_TAG_ENABLE, enable, - NULL); + MMCAM_TAG_ENABLE, enable, + NULL); return __convert_camera_error_code(__func__, ret); } @@ -3207,14 +3175,13 @@ int legacy_camera_attr_get_tag_image_description(camera_h camera, char **descrip int desc_size; ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, - MMCAM_TAG_IMAGE_DESCRIPTION, &ndescription, &desc_size, - NULL); + MMCAM_TAG_IMAGE_DESCRIPTION, &ndescription, &desc_size, + NULL); if (ret == MM_ERROR_NONE) { - if (ndescription != NULL) { + if (ndescription != NULL) *description = strdup(ndescription); - } else { + else *description = strdup(""); - } } return __convert_camera_error_code(__func__, ret); @@ -3232,8 +3199,8 @@ int legacy_camera_attr_get_tag_orientation(camera_h camera, camera_attr_tag_orie camera_s *handle = (camera_s *)camera; ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, - MMCAM_TAG_ORIENTATION, orientation, - NULL); + MMCAM_TAG_ORIENTATION, orientation, + NULL); return __convert_camera_error_code(__func__, ret); } @@ -3252,14 +3219,13 @@ int legacy_camera_attr_get_tag_software(camera_h camera, char **software) int soft_size; ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, - MMCAM_TAG_SOFTWARE, &soft, &soft_size, - NULL); + MMCAM_TAG_SOFTWARE, &soft, &soft_size, + NULL); if (ret == MM_ERROR_NONE) { - if (soft != NULL) { + if (soft != NULL) *software = strdup(soft); - } else { + else *software = strdup(""); - } } return __convert_camera_error_code(__func__, ret); @@ -3277,10 +3243,10 @@ int legacy_camera_attr_get_geotag(camera_h camera, double *latitude , double *lo camera_s *handle = (camera_s *)camera; ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, - MMCAM_TAG_LATITUDE, latitude, - MMCAM_TAG_LONGITUDE, longitude, - MMCAM_TAG_ALTITUDE, altitude, - NULL); + MMCAM_TAG_LATITUDE, latitude, + MMCAM_TAG_LONGITUDE, longitude, + MMCAM_TAG_ALTITUDE, altitude, + NULL); return __convert_camera_error_code(__func__, ret); } @@ -3297,8 +3263,8 @@ int legacy_camera_attr_get_flash_mode(camera_h camera, camera_attr_flash_mode_e camera_s *handle = (camera_s *)camera; ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, - MMCAM_STROBE_MODE, mode, - NULL); + MMCAM_STROBE_MODE, mode, + NULL); return __convert_camera_error_code(__func__, ret); } @@ -3317,9 +3283,8 @@ int legacy_camera_attr_foreach_supported_af_mode(camera_h camera, camera_attr_su MMCamAttrsInfo af_range; ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_AF_SCAN_RANGE, &af_range); - if (ret != MM_ERROR_NONE) { + if (ret != MM_ERROR_NONE) return __convert_camera_error_code(__func__, ret); - } for (i = 0 ; i < af_range.int_array.count ; i++) { if (!foreach_cb(af_range.int_array.array[i], user_data)) { @@ -3338,33 +3303,32 @@ int legacy_camera_attr_foreach_supported_exposure_mode(camera_h camera, camera_a return CAMERA_ERROR_INVALID_PARAMETER; } - int maptable[] = {CAMERA_ATTR_EXPOSURE_MODE_OFF, /* MM_CAMCORDER_AUTO_EXPOSURE_OFF */ - CAMERA_ATTR_EXPOSURE_MODE_ALL, /* MM_CAMCORDER_AUTO_EXPOSURE_ALL */ - CAMERA_ATTR_EXPOSURE_MODE_CENTER, /* MM_CAMCORDER_AUTO_EXPOSURE_CENTER_1 */ - -1, /* MM_CAMCORDER_AUTO_EXPOSURE_CENTER_2 */ - -1, /* MM_CAMCORDER_AUTO_EXPOSURE_CENTER_3 */ - CAMERA_ATTR_EXPOSURE_MODE_SPOT, /* MM_CAMCORDER_AUTO_EXPOSURE_SPOT_1 */ - -1, /* MM_CAMCORDER_AUTO_EXPOSURE_SPOT_2 */ - CAMERA_ATTR_EXPOSURE_MODE_CUSTOM, /* MM_CAMCORDER_AUTO_EXPOSURE_CUSTOM_1 */ - -1 /* MM_CAMCORDER_AUTO_EXPOSURE_CUSTOM_2 */ - }; + int maptable[] = { + CAMERA_ATTR_EXPOSURE_MODE_OFF, /* MM_CAMCORDER_AUTO_EXPOSURE_OFF */ + CAMERA_ATTR_EXPOSURE_MODE_ALL, /* MM_CAMCORDER_AUTO_EXPOSURE_ALL */ + CAMERA_ATTR_EXPOSURE_MODE_CENTER, /* MM_CAMCORDER_AUTO_EXPOSURE_CENTER_1 */ + -1, /* MM_CAMCORDER_AUTO_EXPOSURE_CENTER_2 */ + -1, /* MM_CAMCORDER_AUTO_EXPOSURE_CENTER_3 */ + CAMERA_ATTR_EXPOSURE_MODE_SPOT, /* MM_CAMCORDER_AUTO_EXPOSURE_SPOT_1 */ + -1, /* MM_CAMCORDER_AUTO_EXPOSURE_SPOT_2 */ + CAMERA_ATTR_EXPOSURE_MODE_CUSTOM, /* MM_CAMCORDER_AUTO_EXPOSURE_CUSTOM_1 */ + -1 /* MM_CAMCORDER_AUTO_EXPOSURE_CUSTOM_2 */ + }; int i = 0; int ret = MM_ERROR_NONE; camera_s *handle = (camera_s *)camera; MMCamAttrsInfo info; ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_EXPOSURE_MODE, &info); - if (ret != MM_ERROR_NONE) { + if (ret != MM_ERROR_NONE) return __convert_camera_error_code(__func__, ret); - } for (i = 0 ; i < info.int_array.count ; i++) { if (info.int_array.array[i] >= MM_CAMCORDER_AUTO_EXPOSURE_OFF && info.int_array.array[i] <= MM_CAMCORDER_AUTO_EXPOSURE_CUSTOM_2) { if (maptable[info.int_array.array[i]] != -1) { - if (!foreach_cb(maptable[info.int_array.array[i]], user_data)) { + if (!foreach_cb(maptable[info.int_array.array[i]], user_data)) break; - } } } else { LOGW("unknown value %d", info.int_array.array[i]); @@ -3388,14 +3352,12 @@ int legacy_camera_attr_foreach_supported_iso(camera_h camera, camera_attr_suppor MMCamAttrsInfo info; ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_ISO, &info); - if (ret != MM_ERROR_NONE) { + if (ret != MM_ERROR_NONE) return __convert_camera_error_code(__func__, ret); - } for (i = 0 ; i < info.int_array.count ; i++) { - if (!foreach_cb(info.int_array.array[i], user_data)) { + if (!foreach_cb(info.int_array.array[i], user_data)) break; - } } return CAMERA_ERROR_NONE; @@ -3415,14 +3377,12 @@ int legacy_camera_attr_foreach_supported_whitebalance(camera_h camera, camera_at MMCamAttrsInfo info; ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_FILTER_WB, &info); - if (ret != MM_ERROR_NONE) { + if (ret != MM_ERROR_NONE) return __convert_camera_error_code(__func__, ret); - } for (i = 0 ; i < info.int_array.count ; i++) { - if (!foreach_cb(info.int_array.array[i], user_data)) { + if (!foreach_cb(info.int_array.array[i], user_data)) break; - } } return CAMERA_ERROR_NONE; @@ -3442,14 +3402,12 @@ int legacy_camera_attr_foreach_supported_effect(camera_h camera, camera_attr_sup MMCamAttrsInfo info; ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_FILTER_COLOR_TONE, &info); - if (ret != MM_ERROR_NONE) { + if (ret != MM_ERROR_NONE) return __convert_camera_error_code(__func__, ret); - } for (i = 0 ; i < info.int_array.count ; i++) { - if (!foreach_cb(info.int_array.array[i], user_data)) { + if (!foreach_cb(info.int_array.array[i], user_data)) break; - } } return CAMERA_ERROR_NONE; @@ -3469,14 +3427,12 @@ int legacy_camera_attr_foreach_supported_scene_mode(camera_h camera, camera_attr MMCamAttrsInfo info; ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_FILTER_SCENE_MODE, &info); - if (ret != MM_ERROR_NONE) { + if (ret != MM_ERROR_NONE) return __convert_camera_error_code(__func__, ret); - } for (i = 0 ; i < info.int_array.count ; i++) { - if (!foreach_cb(info.int_array.array[i], user_data)) { + if (!foreach_cb(info.int_array.array[i], user_data)) break; - } } return CAMERA_ERROR_NONE; @@ -3496,14 +3452,12 @@ int legacy_camera_attr_foreach_supported_flash_mode(camera_h camera, camera_attr MMCamAttrsInfo info; ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_STROBE_MODE, &info); - if (ret != MM_ERROR_NONE) { + if (ret != MM_ERROR_NONE) return __convert_camera_error_code(__func__, ret); - } for (i = 0 ; i < info.int_array.count ; i++) { - if (!foreach_cb(info.int_array.array[i], user_data)) { + if (!foreach_cb(info.int_array.array[i], user_data)) break; - } } return CAMERA_ERROR_NONE; @@ -3525,22 +3479,19 @@ int legacy_camera_attr_foreach_supported_fps(camera_h camera, camera_attr_suppor int i = 0; ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, - MMCAM_CAMERA_WIDTH, &width, - MMCAM_CAMERA_HEIGHT, &height, - NULL); - if (ret != MM_ERROR_NONE) { + MMCAM_CAMERA_WIDTH, &width, + MMCAM_CAMERA_HEIGHT, &height, + NULL); + if (ret != MM_ERROR_NONE) return __convert_camera_error_code(__func__, ret); - } ret = mm_camcorder_get_fps_list_by_resolution(handle->mm_handle, width, height, &info); - if (ret != MM_ERROR_NONE) { + if (ret != MM_ERROR_NONE) return __convert_camera_error_code(__func__, ret); - } for (i = 0 ; i < info.int_array.count ; i++) { - if (!foreach_cb(info.int_array.array[i], user_data)) { + if (!foreach_cb(info.int_array.array[i], user_data)) break; - } } return CAMERA_ERROR_NONE; @@ -3560,14 +3511,12 @@ int legacy_camera_attr_foreach_supported_fps_by_resolution(camera_h camera, int int i = 0; ret = mm_camcorder_get_fps_list_by_resolution(handle->mm_handle, width, height, &info); - if (ret != MM_ERROR_NONE) { + if (ret != MM_ERROR_NONE) return __convert_camera_error_code(__func__, ret); - } for (i = 0 ; i < info.int_array.count ; i++) { - if (!foreach_cb(info.int_array.array[i], user_data)) { + if (!foreach_cb(info.int_array.array[i], user_data)) break; - } } return CAMERA_ERROR_NONE; @@ -3587,14 +3536,12 @@ int legacy_camera_attr_foreach_supported_stream_flip(camera_h camera, camera_att MMCamAttrsInfo info; ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_FLIP, &info); - if (ret != MM_ERROR_NONE) { + if (ret != MM_ERROR_NONE) return __convert_camera_error_code(__func__, ret); - } for (i = 0 ; i < info.int_array.count ; i++) { - if (!foreach_cb(info.int_array.array[i], user_data)) { + if (!foreach_cb(info.int_array.array[i], user_data)) break; - } } return CAMERA_ERROR_NONE; @@ -3614,14 +3561,12 @@ int legacy_camera_attr_foreach_supported_stream_rotation(camera_h camera, camera MMCamAttrsInfo info; ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_ROTATION, &info); - if (ret != MM_ERROR_NONE) { + if (ret != MM_ERROR_NONE) return __convert_camera_error_code(__func__, ret); - } for (i = 0 ; i < info.int_array.count ; i++) { - if (!foreach_cb(info.int_array.array[i], user_data)) { + if (!foreach_cb(info.int_array.array[i], user_data)) break; - } } return CAMERA_ERROR_NONE; @@ -3644,8 +3589,8 @@ int legacy_camera_attr_set_stream_rotation(camera_h camera, camera_rotation_e ro camera_s *handle = (camera_s *)camera; ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, - MMCAM_CAMERA_ROTATION, rotation, - NULL); + MMCAM_CAMERA_ROTATION, rotation, + NULL); return __convert_camera_error_code(__func__, ret); } @@ -3662,8 +3607,8 @@ int legacy_camera_attr_get_stream_rotation(camera_h camera, camera_rotation_e *r camera_s *handle = (camera_s *)camera; ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, - MMCAM_CAMERA_ROTATION, rotation, - NULL); + MMCAM_CAMERA_ROTATION, rotation, + NULL); return __convert_camera_error_code(__func__, ret); } @@ -3685,8 +3630,8 @@ int legacy_camera_attr_set_stream_flip(camera_h camera, camera_flip_e flip) camera_s *handle = (camera_s *)camera; ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, - MMCAM_CAMERA_FLIP, flip, - NULL); + MMCAM_CAMERA_FLIP, flip, + NULL); return __convert_camera_error_code(__func__, ret); } @@ -3703,8 +3648,8 @@ int legacy_camera_attr_get_stream_flip(camera_h camera, camera_flip_e *flip) camera_s *handle = (camera_s *)camera; ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, - MMCAM_CAMERA_FLIP, flip, - NULL); + MMCAM_CAMERA_FLIP, flip, + NULL); return __convert_camera_error_code(__func__, ret); } @@ -3745,7 +3690,7 @@ int _camera_get_mm_handle(camera_h camera, MMHandleType *handle) return CAMERA_ERROR_INVALID_PARAMETER; } - camera_s *camera_handle = (camera_s*)camera; + camera_s *camera_handle = (camera_s *)camera; *handle = camera_handle->mm_handle; @@ -3755,7 +3700,7 @@ int _camera_get_mm_handle(camera_h camera, MMHandleType *handle) int _camera_set_relay_mm_message_callback(camera_h camera, MMMessageCallback callback, void *user_data) { - if( camera == NULL ){ + if (camera == NULL) { LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } @@ -3789,15 +3734,14 @@ int legacy_camera_attr_set_hdr_mode(camera_h camera, camera_attr_hdr_mode_e mode camera_s *handle = (camera_s *)camera; ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, - MMCAM_CAMERA_HDR_CAPTURE, mode, - NULL); + MMCAM_CAMERA_HDR_CAPTURE, mode, + NULL); if (ret == MM_ERROR_NONE) { - if (mode == CAMERA_ATTR_HDR_MODE_KEEP_ORIGINAL) { + if (mode == CAMERA_ATTR_HDR_MODE_KEEP_ORIGINAL) handle->hdr_keep_mode = true; - } else { + else handle->hdr_keep_mode = false; - } } return __convert_camera_error_code(__func__, ret); @@ -3825,8 +3769,8 @@ int legacy_camera_attr_get_hdr_mode(camera_h camera, camera_attr_hdr_mode_e *mod camera_s *handle = (camera_s *)camera; ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, - MMCAM_CAMERA_HDR_CAPTURE, mode, - NULL); + MMCAM_CAMERA_HDR_CAPTURE, mode, + NULL); return __convert_camera_error_code(__func__, ret); } @@ -3927,13 +3871,12 @@ int legacy_camera_attr_enable_anti_shake(camera_h camera, bool enable) int mode = MM_CAMCORDER_AHS_OFF; camera_s *handle = (camera_s *)camera; - if (enable) { + if (enable) mode = MM_CAMCORDER_AHS_ON; - } ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, - MMCAM_CAMERA_ANTI_HANDSHAKE, mode, - NULL); + MMCAM_CAMERA_ANTI_HANDSHAKE, mode, + NULL); return __convert_camera_error_code(__func__, ret); } @@ -3960,8 +3903,8 @@ int legacy_camera_attr_is_enabled_anti_shake(camera_h camera, bool *enabled) camera_s *handle = (camera_s *)camera; ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, - MMCAM_CAMERA_ANTI_HANDSHAKE, enabled, - NULL); + MMCAM_CAMERA_ANTI_HANDSHAKE, enabled, + NULL); return __convert_camera_error_code(__func__, ret); } @@ -3987,9 +3930,8 @@ bool legacy_camera_attr_is_supported_anti_shake(camera_h camera) } for (i = 0 ; i < ash_info.int_array.count ; i++) { - if (ash_info.int_array.array[i] == MM_CAMCORDER_AHS_ON) { + if (ash_info.int_array.array[i] == MM_CAMCORDER_AHS_ON) return true; - } } return false; @@ -4010,15 +3952,14 @@ int legacy_camera_attr_enable_video_stabilization(camera_h camera, bool enable) int ret = MM_ERROR_NONE; int mode = MM_CAMCORDER_VIDEO_STABILIZATION_OFF; - camera_s *handle = (camera_s*)camera; + camera_s *handle = (camera_s *)camera; - if (enable) { + if (enable) mode = MM_CAMCORDER_VIDEO_STABILIZATION_ON; - } ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, - MMCAM_CAMERA_VIDEO_STABILIZATION, mode, - NULL); + MMCAM_CAMERA_VIDEO_STABILIZATION, mode, + NULL); return __convert_camera_error_code(__func__, ret); } @@ -4046,11 +3987,10 @@ int legacy_camera_attr_is_enabled_video_stabilization(camera_h camera, bool *ena camera_s *handle = (camera_s *)camera; ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, - MMCAM_CAMERA_VIDEO_STABILIZATION, &mode, - NULL); - if (ret == MM_ERROR_NONE) { + MMCAM_CAMERA_VIDEO_STABILIZATION, &mode, + NULL); + if (ret == MM_ERROR_NONE) *enabled = (mode == MM_CAMCORDER_VIDEO_STABILIZATION_ON); - } return __convert_camera_error_code(__func__, ret); } @@ -4076,9 +4016,8 @@ bool legacy_camera_attr_is_supported_video_stabilization(camera_h camera) } for (i = 0 ; i < vs_info.int_array.count ; i++) { - if (vs_info.int_array.array[i] == MM_CAMCORDER_VIDEO_STABILIZATION_ON) { + if (vs_info.int_array.array[i] == MM_CAMCORDER_VIDEO_STABILIZATION_ON) return true; - } } return false; @@ -4101,13 +4040,12 @@ int legacy_camera_attr_enable_auto_contrast(camera_h camera, bool enable) int mode = MM_CAMCORDER_WDR_OFF; camera_s *handle = (camera_s *)camera; - if (enable) { + if (enable) mode = MM_CAMCORDER_WDR_ON; - } ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, - MMCAM_CAMERA_WDR, mode, - NULL); + MMCAM_CAMERA_WDR, mode, + NULL); return __convert_camera_error_code(__func__, ret); } @@ -4135,12 +4073,11 @@ int legacy_camera_attr_is_enabled_auto_contrast(camera_h camera, bool *enabled) camera_s *handle = (camera_s *)camera; ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, - MMCAM_CAMERA_WDR, &mode, - NULL); + MMCAM_CAMERA_WDR, &mode, + NULL); - if (ret == MM_ERROR_NONE) { + if (ret == MM_ERROR_NONE) *enabled = mode; - } return __convert_camera_error_code(__func__, ret); } @@ -4166,9 +4103,8 @@ bool legacy_camera_attr_is_supported_auto_contrast(camera_h camera) } for (i = 0 ; i < info.int_array.count ; i++) { - if (info.int_array.array[i] == MM_CAMCORDER_WDR_ON) { + if (info.int_array.array[i] == MM_CAMCORDER_WDR_ON) return true; - } } return false; @@ -4208,8 +4144,8 @@ int legacy_camera_attr_get_encoded_preview_bitrate(camera_h camera, int *bitrate camera_s *handle = (camera_s *)camera; ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, - MMCAM_ENCODED_PREVIEW_BITRATE, bitrate, - NULL); + MMCAM_ENCODED_PREVIEW_BITRATE, bitrate, + NULL); return __convert_camera_error_code(__func__, ret); } @@ -4231,8 +4167,8 @@ int legacy_camera_attr_set_encoded_preview_bitrate(camera_h camera, int bitrate) camera_s *handle = (camera_s *)camera; ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, - MMCAM_ENCODED_PREVIEW_BITRATE, bitrate, - NULL); + MMCAM_ENCODED_PREVIEW_BITRATE, bitrate, + NULL); return __convert_camera_error_code(__func__, ret); } @@ -4249,8 +4185,8 @@ int legacy_camera_attr_get_encoded_preview_gop_interval(camera_h camera, int *in camera_s *handle = (camera_s *)camera; ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, - MMCAM_ENCODED_PREVIEW_GOP_INTERVAL, interval, - NULL); + MMCAM_ENCODED_PREVIEW_GOP_INTERVAL, interval, + NULL); return __convert_camera_error_code(__func__, ret); } @@ -4272,8 +4208,8 @@ int legacy_camera_attr_set_encoded_preview_gop_interval(camera_h camera, int int camera_s *handle = (camera_s *)camera; ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, - MMCAM_ENCODED_PREVIEW_GOP_INTERVAL, interval, - NULL); + MMCAM_ENCODED_PREVIEW_GOP_INTERVAL, interval, + NULL); return __convert_camera_error_code(__func__, ret); } @@ -4298,8 +4234,8 @@ int legacy_camera_attr_set_pan(camera_h camera, int move_type, int pan_step) if (move_type == CAMERA_ATTR_PTZ_MOVE_RELATIVE) { ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, - pan_type, &step, - NULL); + pan_type, &step, + NULL); if (ret == MM_ERROR_NONE) { step += pan_step; @@ -4312,8 +4248,8 @@ int legacy_camera_attr_set_pan(camera_h camera, int move_type, int pan_step) } ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, - pan_type, step, - NULL); + pan_type, step, + NULL); return __convert_camera_error_code(__func__, ret); } @@ -4336,8 +4272,8 @@ int legacy_camera_attr_get_pan(camera_h camera, int *pan_step) pan_type = MMCAM_CAMERA_PAN_ELEC; ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, - pan_type, pan_step, - NULL); + pan_type, pan_step, + NULL); return __convert_camera_error_code(__func__, ret); } @@ -4389,8 +4325,8 @@ int legacy_camera_attr_set_tilt(camera_h camera, int move_type, int tilt_step) if (move_type == CAMERA_ATTR_PTZ_MOVE_RELATIVE) { ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, - tilt_type, &step, - NULL); + tilt_type, &step, + NULL); if (ret == MM_ERROR_NONE) { step += tilt_step; @@ -4403,8 +4339,8 @@ int legacy_camera_attr_set_tilt(camera_h camera, int move_type, int tilt_step) } ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, - tilt_type, step, - NULL); + tilt_type, step, + NULL); return __convert_camera_error_code(__func__, ret); } @@ -4427,8 +4363,8 @@ int legacy_camera_attr_get_tilt(camera_h camera, int *tilt_step) tilt_type = MMCAM_CAMERA_TILT_ELEC; ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, - tilt_type, tilt_step, - NULL); + tilt_type, tilt_step, + NULL); return __convert_camera_error_code(__func__, ret); } @@ -4472,8 +4408,8 @@ int legacy_camera_attr_set_ptz_type(camera_h camera, int ptz_type) camera_s *handle = (camera_s *)camera; ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, - MMCAM_CAMERA_PTZ_TYPE, ptz_type, - NULL); + MMCAM_CAMERA_PTZ_TYPE, ptz_type, + NULL); if (ret != MM_ERROR_NONE) handle->ptz_type = ptz_type; @@ -4495,14 +4431,12 @@ int legacy_camera_attr_foreach_supported_ptz_type(camera_h camera, camera_attr_s MMCamAttrsInfo info; ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_PTZ_TYPE, &info); - if (ret != MM_ERROR_NONE) { + if (ret != MM_ERROR_NONE) return __convert_camera_error_code(__func__, ret); - } for (i = 0 ; i < info.int_array.count ; i++) { - if (!foreach_cb(info.int_array.array[i], user_data)) { + if (!foreach_cb(info.int_array.array[i], user_data)) break; - } } return CAMERA_ERROR_NONE; @@ -4521,8 +4455,8 @@ int legacy_camera_attr_set_display_roi_area(camera_h camera, int *display_roi_ar camera_s *handle = (camera_s *)camera; ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, - MMCAM_DISPLAY_GEOMETRY_METHOD, ¤t_method, - NULL); + MMCAM_DISPLAY_GEOMETRY_METHOD, ¤t_method, + NULL); if (ret != MM_ERROR_NONE) { LOGE("INVALID_OPERATION(0x%08x)", CAMERA_ERROR_INVALID_OPERATION); return CAMERA_ERROR_INVALID_OPERATION; @@ -4534,11 +4468,11 @@ int legacy_camera_attr_set_display_roi_area(camera_h camera, int *display_roi_ar } ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, - MMCAM_DISPLAY_RECT_X, display_roi_area[0], - MMCAM_DISPLAY_RECT_Y, display_roi_area[1], - MMCAM_DISPLAY_RECT_WIDTH, display_roi_area[2], - MMCAM_DISPLAY_RECT_HEIGHT, display_roi_area[3], - NULL); + MMCAM_DISPLAY_RECT_X, display_roi_area[0], + MMCAM_DISPLAY_RECT_Y, display_roi_area[1], + MMCAM_DISPLAY_RECT_WIDTH, display_roi_area[2], + MMCAM_DISPLAY_RECT_HEIGHT, display_roi_area[3], + NULL); return __convert_camera_error_code(__func__, ret); } @@ -4559,8 +4493,8 @@ int legacy_camera_attr_get_display_roi_area(camera_h camera, int *display_roi_ar camera_s *handle = (camera_s *)camera; ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, - MMCAM_DISPLAY_GEOMETRY_METHOD, ¤t_method, - NULL); + MMCAM_DISPLAY_GEOMETRY_METHOD, ¤t_method, + NULL); if (ret != MM_ERROR_NONE) { LOGE("INVALID_OPERATION(0x%08x)", CAMERA_ERROR_INVALID_OPERATION); return CAMERA_ERROR_INVALID_OPERATION; @@ -4572,11 +4506,11 @@ int legacy_camera_attr_get_display_roi_area(camera_h camera, int *display_roi_ar } ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, - MMCAM_DISPLAY_RECT_X, &x, - MMCAM_DISPLAY_RECT_Y, &y, - MMCAM_DISPLAY_RECT_WIDTH, &width, - MMCAM_DISPLAY_RECT_HEIGHT, &height, - NULL); + MMCAM_DISPLAY_RECT_X, &x, + MMCAM_DISPLAY_RECT_Y, &y, + MMCAM_DISPLAY_RECT_WIDTH, &width, + MMCAM_DISPLAY_RECT_HEIGHT, &height, + NULL); if (ret == MM_ERROR_NONE) { LOGD("get roi area : %d,%d,%dx%d", x, y, width, height); diff --git a/legacy/src/legacy_camera_internal.c b/legacy/src/legacy_camera_internal.c index f05fc67..1fa52d8 100644 --- a/legacy/src/legacy_camera_internal.c +++ b/legacy/src/legacy_camera_internal.c @@ -39,9 +39,8 @@ int legacy_camera_get_video_caps(camera_h camera, char **caps) camera_s *handle = (camera_s *)camera; ret = mm_camcorder_get_video_caps(handle->mm_handle, caps); - if (ret != MM_ERROR_NONE) { + if (ret != MM_ERROR_NONE) return __convert_camera_error_code(__func__, ret); - } return CAMERA_ERROR_NONE; } @@ -59,8 +58,8 @@ int legacy_camera_set_client_pid(camera_h camera, int pid) LOGE("pid %d", pid); ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, - MMCAM_PID_FOR_SOUND_FOCUS, pid, - NULL); + MMCAM_PID_FOR_SOUND_FOCUS, pid, + NULL); return __convert_camera_error_code(__func__, ret); } diff --git a/muse/include/muse_camera.h b/muse/include/muse_camera.h index 0a40047..a620f13 100644 --- a/muse/include/muse_camera.h +++ b/muse/include/muse_camera.h @@ -36,152 +36,152 @@ extern "C" { * @brief Enumeration for the muse camera apis. */ typedef enum { - MUSE_CAMERA_API_CREATE, //0 + MUSE_CAMERA_API_CREATE, /* 0 */ MUSE_CAMERA_API_DESTROY, MUSE_CAMERA_API_START_PREVIEW, MUSE_CAMERA_API_STOP_PREVIEW, MUSE_CAMERA_API_START_CAPTURE, - MUSE_CAMERA_API_SUPPORT_CONTINUOUS_CAPTURE, //5 + MUSE_CAMERA_API_SUPPORT_CONTINUOUS_CAPTURE, /* 5 */ MUSE_CAMERA_API_START_CONTINUOUS_CAPTURE, MUSE_CAMERA_API_STOP_CONTINUOUS_CAPTURE, MUSE_CAMERA_API_SUPPORT_FACE_DETECTION, MUSE_CAMERA_API_SUPPORT_ZERO_SHUTTER_LAG, - MUSE_CAMERA_API_SUPPORT_MEDIA_PACKET_PREVIEW_CB, //10 + MUSE_CAMERA_API_SUPPORT_MEDIA_PACKET_PREVIEW_CB, /* 10 */ MUSE_CAMERA_API_GET_DEVICE_COUNT, MUSE_CAMERA_API_START_FACE_DETECTION, MUSE_CAMERA_API_STOP_FACE_DETECTION, MUSE_CAMERA_API_GET_STATE, - MUSE_CAMERA_API_START_FOCUSING, //15 + MUSE_CAMERA_API_START_FOCUSING, /* 15 */ MUSE_CAMERA_API_CANCEL_FOCUSING, MUSE_CAMERA_API_SET_DISPLAY, MUSE_CAMERA_API_SET_PREVIEW_RESOLUTION, MUSE_CAMERA_API_SET_CAPTURE_RESOLUTION, - MUSE_CAMERA_API_SET_CAPTURE_FORMAT, //20 + MUSE_CAMERA_API_SET_CAPTURE_FORMAT, /* 20 */ MUSE_CAMERA_API_SET_PREVIEW_FORMAT, MUSE_CAMERA_API_GET_PREVIEW_RESOLUTION, MUSE_CAMERA_API_SET_DISPLAY_ROTATION, MUSE_CAMERA_API_GET_DISPLAY_ROTATION, - MUSE_CAMERA_API_SET_DISPLAY_FLIP, //25 + MUSE_CAMERA_API_SET_DISPLAY_FLIP, /* 25 */ MUSE_CAMERA_API_GET_DISPLAY_FLIP, MUSE_CAMERA_API_SET_DISPLAY_VISIBLE, MUSE_CAMERA_API_IS_DISPLAY_VISIBLE, MUSE_CAMERA_API_SET_DISPLAY_MODE, - MUSE_CAMERA_API_GET_DISPLAY_MODE, //30 + MUSE_CAMERA_API_GET_DISPLAY_MODE, /* 30 */ MUSE_CAMERA_API_GET_CAPTURE_RESOLUTION, MUSE_CAMERA_API_GET_CAPTURE_FORMAT, MUSE_CAMERA_API_GET_PREVIEW_FORMAT, MUSE_CAMERA_API_GET_FACING_DIRECTION, - MUSE_CAMERA_API_GET_FLASH_STATE, //35 + MUSE_CAMERA_API_GET_FLASH_STATE, /* 35 */ MUSE_CAMERA_API_SET_PREVIEW_CB, MUSE_CAMERA_API_UNSET_PREVIEW_CB, MUSE_CAMERA_API_SET_MEDIA_PACKET_PREVIEW_CB, MUSE_CAMERA_API_UNSET_MEDIA_PACKET_PREVIEW_CB, - MUSE_CAMERA_API_SET_STATE_CHANGED_CB, //40 + MUSE_CAMERA_API_SET_STATE_CHANGED_CB, /* 40 */ MUSE_CAMERA_API_UNSET_STATE_CHANGED_CB, MUSE_CAMERA_API_SET_INTERRUPTED_CB, MUSE_CAMERA_API_UNSET_INTERRUPTED_CB, MUSE_CAMERA_API_SET_FOCUS_CHANGED_CB, - MUSE_CAMERA_API_UNSET_FOCUS_CHANGED_CB, //45 + MUSE_CAMERA_API_UNSET_FOCUS_CHANGED_CB, /* 45 */ MUSE_CAMERA_API_SET_ERROR_CB, MUSE_CAMERA_API_UNSET_ERROR_CB, MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_PREVIEW_RESOLUTION, MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_CAPTURE_RESOLUTION, - MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_CAPTURE_FORMAT, //50 + MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_CAPTURE_FORMAT, /* 50 */ MUSE_CAMERA_API_SET_FOREACH_SUPPORTED_PREVIEW_FORMAT, MUSE_CAMERA_API_GET_RECOMMENDED_PREVIEW_RESOLUTION, MUSE_CAMERA_API_ATTR_GET_LENS_ORIENTATION, MUSE_CAMERA_API_ATTR_SET_THEATER_MODE, - MUSE_CAMERA_API_ATTR_GET_THEATER_MODE, //55 + MUSE_CAMERA_API_ATTR_GET_THEATER_MODE, /* 55 */ MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_THEATER_MODE, MUSE_CAMERA_API_ATTR_SET_PREVIEW_FPS, MUSE_CAMERA_API_ATTR_SET_IMAGE_QUALITY, MUSE_CAMERA_API_ATTR_GET_PREVIEW_FPS, - MUSE_CAMERA_API_ATTR_GET_IMAGE_QUALITY, //60 + MUSE_CAMERA_API_ATTR_GET_IMAGE_QUALITY, /* 60 */ MUSE_CAMERA_API_ATTR_SET_ZOOM, MUSE_CAMERA_API_ATTR_SET_AF_MODE, MUSE_CAMERA_API_ATTR_SET_AF_AREA, MUSE_CAMERA_API_ATTR_CLEAR_AF_AREA, - MUSE_CAMERA_API_ATTR_SET_EXPOSURE_MODE, //65 + MUSE_CAMERA_API_ATTR_SET_EXPOSURE_MODE, /* 65 */ MUSE_CAMERA_API_ATTR_SET_EXPOSURE, MUSE_CAMERA_API_ATTR_SET_ISO, MUSE_CAMERA_API_ATTR_SET_BRIGHTNESS, MUSE_CAMERA_API_ATTR_SET_CONTRAST, - MUSE_CAMERA_API_ATTR_SET_WHITEBALANCE, //70 + MUSE_CAMERA_API_ATTR_SET_WHITEBALANCE, /* 70 */ MUSE_CAMERA_API_ATTR_SET_EFFECT, MUSE_CAMERA_API_ATTR_SET_SCENE_MODE, MUSE_CAMERA_API_ATTR_ENABLE_TAG, MUSE_CAMERA_API_ATTR_SET_TAG_IMAGE_DESCRIPTION, - MUSE_CAMERA_API_ATTR_SET_TAG_ORIENTATION, //75 + MUSE_CAMERA_API_ATTR_SET_TAG_ORIENTATION, /* 75 */ MUSE_CAMERA_API_ATTR_SET_TAG_SOFTWARE, MUSE_CAMERA_API_ATTR_SET_GEOTAG, MUSE_CAMERA_API_ATTR_REMOVE_GEOTAG, MUSE_CAMERA_API_ATTR_SET_FLASH_MODE, - MUSE_CAMERA_API_ATTR_GET_ZOOM, //80 + MUSE_CAMERA_API_ATTR_GET_ZOOM, /* 80 */ MUSE_CAMERA_API_ATTR_GET_ZOOM_RANGE, MUSE_CAMERA_API_ATTR_GET_AF_MODE, MUSE_CAMERA_API_ATTR_GET_EXPOSURE_MODE, MUSE_CAMERA_API_ATTR_GET_EXPOSURE, - MUSE_CAMERA_API_ATTR_GET_EXPOSURE_RANGE, //85 + MUSE_CAMERA_API_ATTR_GET_EXPOSURE_RANGE, /* 85 */ MUSE_CAMERA_API_ATTR_GET_ISO, MUSE_CAMERA_API_ATTR_GET_BRIGHTNESS, MUSE_CAMERA_API_ATTR_GET_BRIGHTNESS_RANGE, MUSE_CAMERA_API_ATTR_GET_CONTRAST, - MUSE_CAMERA_API_ATTR_GET_CONTRAST_RANGE, //90 + MUSE_CAMERA_API_ATTR_GET_CONTRAST_RANGE, /* 90 */ MUSE_CAMERA_API_ATTR_GET_WHITEBALANCE, MUSE_CAMERA_API_ATTR_GET_EFFECT, MUSE_CAMERA_API_ATTR_GET_SCENE_MODE, MUSE_CAMERA_API_ATTR_IS_ENABLED_TAG, - MUSE_CAMERA_API_ATTR_GET_TAG_IMAGE_DESCRIPTION, //95 + MUSE_CAMERA_API_ATTR_GET_TAG_IMAGE_DESCRIPTION, /* 95 */ MUSE_CAMERA_API_ATTR_GET_TAG_ORIENTATION, MUSE_CAMERA_API_ATTR_GET_TAG_SOFTWARE, MUSE_CAMERA_API_ATTR_GET_GEOTAG, MUSE_CAMERA_API_ATTR_GET_FLASH_MODE, - MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_AF_MODE, //100 + MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_AF_MODE, /* 100 */ MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_EXPOSURE_MODE, MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_ISO, MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_WHITEBALANCE, MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_EFFECT, - MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_SCENE_MODE, //105 + MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_SCENE_MODE, /* 105 */ MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FLASH_MODE, MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FPS, MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FPS_BY_RESOLUTION, MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_STREAM_FLIP, - MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_STREAM_ROTATION, //110 + MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_STREAM_ROTATION, /* 110 */ MUSE_CAMERA_API_ATTR_SET_STREAM_ROTATION, MUSE_CAMERA_API_ATTR_GET_STREAM_ROTATION, MUSE_CAMERA_API_ATTR_SET_STREAM_FLIP, MUSE_CAMERA_API_ATTR_GET_STREAM_FLIP, - MUSE_CAMERA_API_ATTR_SET_HDR_MODE, //115 + MUSE_CAMERA_API_ATTR_SET_HDR_MODE, /* 115 */ MUSE_CAMERA_API_ATTR_GET_HDR_MODE, MUSE_CAMERA_API_ATTR_IS_SUPPORTED_HDR_CAPTURE, MUSE_CAMERA_API_ATTR_SET_HDR_CAPTURE_PROGRESS_CB, MUSE_CAMERA_API_ATTR_UNSET_HDR_CAPTURE_PROGRESS_CB, - MUSE_CAMERA_API_ATTR_ENABLE_ANTI_SHAKE, //120 + MUSE_CAMERA_API_ATTR_ENABLE_ANTI_SHAKE, /* 120 */ MUSE_CAMERA_API_ATTR_IS_ENABLED_ANTI_SHAKE, MUSE_CAMERA_API_ATTR_IS_SUPPORTED_ANTI_SHAKE, MUSE_CAMERA_API_ATTR_ENABLE_VIDEO_STABILIZATION, MUSE_CAMERA_API_ATTR_IS_ENABLED_VIDEO_STABILIZATION, - MUSE_CAMERA_API_ATTR_IS_SUPPORTED_VIDEO_STABILIZATION, //125 + MUSE_CAMERA_API_ATTR_IS_SUPPORTED_VIDEO_STABILIZATION, /* 125 */ MUSE_CAMERA_API_ATTR_ENABLE_AUTO_CONTRAST, MUSE_CAMERA_API_ATTR_IS_ENABLED_AUTO_CONTRAST, MUSE_CAMERA_API_ATTR_IS_SUPPORTED_AUTO_CONTRAST, MUSE_CAMERA_API_ATTR_DISABLE_SHUTTER_SOUND, - MUSE_CAMERA_API_ATTR_GET_ENCODED_PREVIEW_BITRATE, //130 + MUSE_CAMERA_API_ATTR_GET_ENCODED_PREVIEW_BITRATE, /* 130 */ MUSE_CAMERA_API_ATTR_SET_ENCODED_PREVIEW_BITRATE, MUSE_CAMERA_API_ATTR_GET_ENCODED_PREVIEW_GOP_INTERVAL, MUSE_CAMERA_API_ATTR_SET_ENCODED_PREVIEW_GOP_INTERVAL, MUSE_CAMERA_API_ATTR_SET_PAN, - MUSE_CAMERA_API_ATTR_GET_PAN, //135 + MUSE_CAMERA_API_ATTR_GET_PAN, /* 135 */ MUSE_CAMERA_API_ATTR_GET_PAN_RANGE, MUSE_CAMERA_API_ATTR_SET_TILT, MUSE_CAMERA_API_ATTR_GET_TILT, MUSE_CAMERA_API_ATTR_GET_TILT_RANGE, - MUSE_CAMERA_API_ATTR_SET_PTZ_TYPE, //140 + MUSE_CAMERA_API_ATTR_SET_PTZ_TYPE, /* 140 */ MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_PTZ_TYPE, MUSE_CAMERA_API_SET_DISPLAY_ROI_AREA, MUSE_CAMERA_API_GET_DISPLAY_ROI_AREA, MUSE_CAMERA_API_RETURN_BUFFER, - MUSE_CAMERA_API_PREVIEW_CB_RETURN, //145 + MUSE_CAMERA_API_PREVIEW_CB_RETURN, /* 145 */ MUSE_CAMERA_API_SET_DISPLAY_REUSE_HINT, MUSE_CAMERA_API_GET_DISPLAY_REUSE_HINT, MUSE_CAMERA_API_MAX @@ -200,36 +200,36 @@ typedef enum { * @brief Enumeration for the muse camera events. */ typedef enum { - MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE, //0 + MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE, /* 0 */ MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE, MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE, MUSE_CAMERA_EVENT_TYPE_PREVIEW, MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW, - MUSE_CAMERA_EVENT_TYPE_CAPTURE, //5 + MUSE_CAMERA_EVENT_TYPE_CAPTURE, /* 5 */ MUSE_CAMERA_EVENT_TYPE_ERROR, MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS, MUSE_CAMERA_EVENT_TYPE_INTERRUPTED, MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION, - MUSE_CAMERA_EVENT_TYPE_VIDEO_FRAME_RENDER_ERROR, //10 + MUSE_CAMERA_EVENT_TYPE_VIDEO_FRAME_RENDER_ERROR, /* 10 */ MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_RESOLUTION, MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_RESOLUTION, MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_FORMAT, MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_FORMAT, - MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE, //15 + MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE, /* 15 */ MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_AF_MODE, MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EXPOSURE_MODE, MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_ISO, MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_WHITEBALANCE, - MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EFFECT, //20 + MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EFFECT, /* 20 */ MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_SCENE_MODE, MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FLASH_MODE, MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS, MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS_BY_RESOLUTION, - MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_FLIP, //25 + MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_FLIP, /* 25 */ MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION, MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PTZ_TYPE, - MUSE_CAMERA_EVENT_TYPE_NUM //28 -}muse_camera_event_e; + MUSE_CAMERA_EVENT_TYPE_NUM /* 28 */ +} muse_camera_event_e; /** * @brief Enumeration for the muse camera events class. @@ -259,7 +259,7 @@ typedef enum { /** * @brief Definition for the callback event id. */ -#define MUSE_CAMERA_CB_EVENT MUSE_CAMERA_API_MAX + 1 //129 +#define MUSE_CAMERA_CB_EVENT MUSE_CAMERA_API_MAX + 1 /* 148 */ /** * @brief Definition for the max message length. diff --git a/muse/include/muse_camera_msg.h b/muse/include/muse_camera_msg.h index 8f30fa5..d285583 100644 --- a/muse/include/muse_camera_msg.h +++ b/muse/include/muse_camera_msg.h @@ -156,7 +156,7 @@ typedef const char* STRING; * @param[out] ret The delivered return value from the module to proxy side. */ #define muse_camera_msg_send(api, fd, cb_info, ret) \ - do{ \ + do { \ char *__sndMsg__; \ int __len__; \ __sndMsg__ = muse_core_msg_json_factory_new(api, 0); \ @@ -167,7 +167,7 @@ typedef const char* STRING; } else \ ret = _client_wait_for_cb_return(api, cb_info, CALLBACK_TIME_OUT); \ muse_core_msg_json_factory_free(__sndMsg__); \ - }while(0) + } while (0) /** * @brief Send the message from proxy to module via ipc. @@ -176,7 +176,7 @@ typedef const char* STRING; * @param[in] cb_info The callback information, waiting for the ack from the module. */ #define muse_camera_msg_send_no_return(api, fd, cb_info) \ - do{ \ + do { \ char *__sndMsg__; \ int __len__; \ __sndMsg__ = muse_core_msg_json_factory_new(api, 0); \ @@ -185,7 +185,7 @@ typedef const char* STRING; LOGE("sending message failed"); \ } \ muse_core_msg_json_factory_free(__sndMsg__); \ - } while(0) + } while (0) /** * @brief Send the message from proxy to module via ipc, waits more period of time for the ack. @@ -195,10 +195,10 @@ typedef const char* STRING; * @param[out] ret The delivered return value from the module to proxy side. */ #define muse_camera_msg_send_longtime(api, fd, cb_info, ret) \ - do{ \ + do { \ char *__sndMsg__; \ int __len__; \ - __sndMsg__ = muse_core_msg_json_factory_new(api, 0); \ + __sndMsg__ = muse_core_msg_json_factory_new(api, 0); \ __len__ = muse_core_ipc_send_msg(fd, __sndMsg__); \ if (__len__ <= 0) { \ LOGE("sending message failed"); \ @@ -206,7 +206,7 @@ typedef const char* STRING; } else \ ret = _client_wait_for_cb_return(api, cb_info, CALLBACK_TIME_OUT_LONG); \ muse_core_msg_json_factory_free(__sndMsg__); \ - }while(0) + } while (0) /** * @brief Send the message from proxy to module via ipc, adding 1 more parameter. @@ -218,7 +218,7 @@ typedef const char* STRING; * @param[in] param A single parameter to be included in the message. */ #define muse_camera_msg_send1(api, fd, cb_info, ret, type, param) \ - do{ \ + do { \ char *__sndMsg__; \ int __len__; \ type __value__ = (type)param; \ @@ -232,7 +232,7 @@ typedef const char* STRING; } else \ ret = _client_wait_for_cb_return(api, cb_info, CALLBACK_TIME_OUT); \ muse_core_msg_json_factory_free(__sndMsg__); \ - }while(0) + } while (0) /** * @brief Send the message from proxy to module via ipc, adding 1 more parameter. @@ -243,7 +243,7 @@ typedef const char* STRING; * @param[in] param A single parameter to be included in the message. */ #define muse_camera_msg_send1_no_return(api, fd, cb_info, type, param) \ - do{ \ + do { \ char *__sndMsg__; \ int __len__; \ type __value__ = (type)param; \ @@ -255,7 +255,7 @@ typedef const char* STRING; LOGE("sending message failed"); \ } \ muse_core_msg_json_factory_free(__sndMsg__); \ - }while(0) + } while (0) /** * @brief Send the message from proxy to module via ipc, adding 2 more parameters. @@ -269,7 +269,7 @@ typedef const char* STRING; * @param[in] param2 The 2nd parameter to be included in the message. */ #define muse_camera_msg_send2(api, fd, cb_info, ret, type1, param1, type2, param2) \ - do{ \ + do { \ char *__sndMsg__; \ int __len__; \ type1 __value1__ = (type1)param1; \ @@ -285,7 +285,7 @@ typedef const char* STRING; } else \ ret = _client_wait_for_cb_return(api, cb_info, CALLBACK_TIME_OUT); \ muse_core_msg_json_factory_free(__sndMsg__); \ - }while(0) + } while (0) /** * @brief Send the message from proxy to module via ipc, adding 3 more parameters. @@ -301,7 +301,7 @@ typedef const char* STRING; * @param[in] param3 The 3rd parameter to be included in the message. */ #define muse_camera_msg_send3(api, fd, cb_info, ret, type1, param1, type2, param2, type3, param3) \ - do{ \ + do { \ char *__sndMsg__; \ int __len__; \ type1 __value1__ = (type1)param1; \ @@ -319,7 +319,7 @@ typedef const char* STRING; } else \ ret = _client_wait_for_cb_return(api, cb_info, CALLBACK_TIME_OUT); \ muse_core_msg_json_factory_free(__sndMsg__); \ - }while(0) + } while (0) /** * @brief Send the message from proxy to module via ipc, adding an array data. @@ -332,14 +332,14 @@ typedef const char* STRING; * @param[in] datum_size The size of the array. */ #define muse_camera_msg_send_array(api, fd, cb_info, ret, param, length, datum_size) \ - do{ \ + do { \ char *__sndMsg__; \ int __len__; \ int *__value__ = (int *)param; \ __sndMsg__ = muse_core_msg_json_factory_new(api, \ MUSE_TYPE_ARRAY, #param, \ - datum_size == sizeof(int)? length / sizeof(int) : \ - length / sizeof(int) + (length % sizeof(int)?1:0), \ + datum_size == sizeof(int) ? length / sizeof(int) : \ + length / sizeof(int) + (length % sizeof(int) ? 1 : 0), \ __value__, \ 0); \ __len__ = muse_core_ipc_send_msg(fd, __sndMsg__); \ @@ -349,7 +349,7 @@ typedef const char* STRING; } else \ ret = _client_wait_for_cb_return(api, cb_info, CALLBACK_TIME_OUT); \ muse_core_msg_json_factory_free(__sndMsg__); \ - }while(0) + } while (0) /** * @brief Send the message from proxy to module via ipc, adding an array data and value. @@ -364,7 +364,7 @@ typedef const char* STRING; * @param[in] param2 The 2rd parameter to be included in the message. */ #define muse_camera_msg_send_array_and_value(api, fd, cb_info, ret, param, length, datum_size, type, param2) \ - do{ \ + do { \ char *__sndMsg__; \ int __len__; \ int *__value__ = (int *)param; \ @@ -372,8 +372,8 @@ typedef const char* STRING; __sndMsg__ = muse_core_msg_json_factory_new(api, \ MUSE_TYPE_##type, #param2, __value2__, \ MUSE_TYPE_ARRAY, #param, \ - datum_size == sizeof(int)? length / sizeof(int) : \ - length / sizeof(int) + (length % sizeof(int)?1:0), \ + datum_size == sizeof(int) ? length / sizeof(int) : \ + length / sizeof(int) + (length % sizeof(int) ? 1 : 0), \ __value__, \ 0); \ __len__ = muse_core_ipc_send_msg(fd, __sndMsg__); \ @@ -383,7 +383,7 @@ typedef const char* STRING; } else \ ret = _client_wait_for_cb_return(api, cb_info, CALLBACK_TIME_OUT); \ muse_core_msg_json_factory_free(__sndMsg__); \ - }while(0) + } while (0) /** * @brief Returning the ack message from the server to client side. @@ -393,7 +393,7 @@ typedef const char* STRING; * @param[in] module The module info for the ipc transportation. */ #define muse_camera_msg_return(api, class, ret, module) \ - do{ \ + do { \ char *__sndMsg__; \ int __len__; \ __sndMsg__ = muse_core_msg_json_factory_new(api, \ @@ -406,7 +406,7 @@ typedef const char* STRING; ret = CAMERA_ERROR_INVALID_OPERATION; \ } \ muse_core_msg_json_factory_free(__sndMsg__); \ - }while(0) + } while (0) /** * @brief Returning the ack message from the server to client side. @@ -418,7 +418,7 @@ typedef const char* STRING; * @param[in] param A parameter to be included in the message. */ #define muse_camera_msg_return1(api, class, ret, module, type, param) \ - do{ \ + do { \ char *__sndMsg__; \ int __len__; \ type __value__ = (type)param; \ @@ -433,7 +433,7 @@ typedef const char* STRING; ret = CAMERA_ERROR_INVALID_OPERATION; \ } \ muse_core_msg_json_factory_free(__sndMsg__); \ - }while(0) + } while (0) /** * @brief Returning the ack message from the server to client side, adding 2 parameters. @@ -447,7 +447,7 @@ typedef const char* STRING; * @param[in] param2 The 2nd parameter to be included in the message. */ #define muse_camera_msg_return2(api, class, ret, module, type1, param1, type2, param2) \ - do{ \ + do { \ char *__sndMsg__; \ int __len__; \ type1 __value1__ = (type1)param1; \ @@ -464,7 +464,7 @@ typedef const char* STRING; ret = CAMERA_ERROR_INVALID_OPERATION; \ } \ muse_core_msg_json_factory_free(__sndMsg__); \ - }while(0) + } while (0) /** * @brief Returning the ack message from the server to client side, adding 3 parameters. @@ -480,7 +480,7 @@ typedef const char* STRING; * @param[in] param3 The 3rd parameter to be included in the message. */ #define muse_camera_msg_return3(api, class, ret, module, type1, param1, type2, param2, type3, param3) \ - do{ \ + do { \ char *__sndMsg__; \ int __len__; \ type1 __value1__ = (type1)param1; \ @@ -499,7 +499,7 @@ typedef const char* STRING; ret = CAMERA_ERROR_INVALID_OPERATION; \ } \ muse_core_msg_json_factory_free(__sndMsg__); \ - }while(0) + } while (0) /** * @brief Returning the ack message from the server to client side, adding array parameter. @@ -512,7 +512,7 @@ typedef const char* STRING; * @param[in] datum_size The size of the array. */ #define muse_camera_msg_return_array(api, class, ret, module, param, length, datum_size) \ - do{ \ + do { \ char *__sndMsg__; \ int __len__; \ int *__value__ = (int *)param; \ @@ -520,8 +520,8 @@ typedef const char* STRING; MUSE_TYPE_INT, PARAM_API_CLASS, class, \ MUSE_TYPE_INT, PARAM_RET, ret, \ MUSE_TYPE_ARRAY, #param, \ - datum_size == sizeof(int)? length / sizeof(int) : \ - length / sizeof(int) + (length % sizeof(int)?1:0), \ + datum_size == sizeof(int) ? length / sizeof(int) : \ + length / sizeof(int) + (length % sizeof(int) ? 1 : 0), \ __value__, \ 0); \ __len__ = muse_core_ipc_send_msg(muse_core_client_get_msg_fd(module), __sndMsg__); \ @@ -530,7 +530,7 @@ typedef const char* STRING; ret = CAMERA_ERROR_INVALID_OPERATION; \ } \ muse_core_msg_json_factory_free(__sndMsg__); \ - }while(0) + } while (0) /** * @brief Returning the event ack message from the server to client side, adding array parameter. @@ -540,7 +540,7 @@ typedef const char* STRING; * @param[in] module The module info for the ipc transportation. */ #define muse_camera_msg_event(api, event, class, module) \ - do{ \ + do { \ char *__sndMsg__; \ __sndMsg__ = muse_core_msg_json_factory_new(api, \ MUSE_TYPE_INT, PARAM_EVENT, event, \ @@ -548,7 +548,7 @@ typedef const char* STRING; 0); \ muse_core_ipc_send_msg(muse_core_client_get_msg_fd(module), __sndMsg__); \ muse_core_msg_json_factory_free(__sndMsg__); \ - }while(0) + } while (0) /** * @brief Returning the event ack message from the server to client side, adding array parameter. @@ -560,7 +560,7 @@ typedef const char* STRING; * @param[in] param A parameter to be included in the message. */ #define muse_camera_msg_event1(api, event, class, module, type, param) \ - do{ \ + do { \ char *__sndMsg__; \ type __value__ = (type)param; \ __sndMsg__ = muse_core_msg_json_factory_new(api, \ @@ -570,7 +570,7 @@ typedef const char* STRING; 0); \ muse_core_ipc_send_msg(muse_core_client_get_msg_fd(module), __sndMsg__); \ muse_core_msg_json_factory_free(__sndMsg__); \ - }while(0) + } while (0) /** * @brief Returning the event ack message from the server to client side, adding array parameter. @@ -583,7 +583,7 @@ typedef const char* STRING; * @param[in] param2 The 2nd parameter to be included in the message. */ #define muse_camera_msg_event2(api, event, class, module, type1, param1, type2, param2) \ - do{ \ + do { \ char *__sndMsg__; \ type1 __value1__ = (type1)param1; \ type2 __value2__ = (type2)param2; \ @@ -595,7 +595,7 @@ typedef const char* STRING; 0); \ muse_core_ipc_send_msg(muse_core_client_get_msg_fd(module), __sndMsg__); \ muse_core_msg_json_factory_free(__sndMsg__); \ - }while(0) + } while (0) /** * @brief Returning the event ack message from the server to client side, adding array parameter. @@ -610,7 +610,7 @@ typedef const char* STRING; * @param[in] param3 The 3rd parameter to be included in the message. */ #define muse_camera_msg_event3(api, event, class, module, type1, param1, type2, param2, type3, param3) \ - do{ \ + do { \ char *__sndMsg__; \ type1 __value1__ = (type1)param1; \ type2 __value2__ = (type2)param2; \ @@ -624,7 +624,7 @@ typedef const char* STRING; 0); \ muse_core_ipc_send_msg(muse_core_client_get_msg_fd(module), __sndMsg__); \ muse_core_msg_json_factory_free(__sndMsg__); \ - }while(0) + } while (0) #ifdef __cplusplus } diff --git a/muse/src/muse_camera_dispatcher.c b/muse/src/muse_camera_dispatcher.c index 8e61bd4..caf412a 100644 --- a/muse/src/muse_camera_dispatcher.c +++ b/muse/src/muse_camera_dispatcher.c @@ -48,10 +48,10 @@ void _camera_dispatcher_callback_supported_theater_mode(int param1, void *user_d LOGD("Enter!! param : %d", param1); muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT, - MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE, - MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, - module, - INT, param1); + MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE, + MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, + module, + INT, param1); } void _camera_dispatcher_callback_supported_af_mode(int param1, void *user_data) @@ -61,10 +61,10 @@ void _camera_dispatcher_callback_supported_af_mode(int param1, void *user_data) LOGD("Enter!! param : %d", param1); muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT, - MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_AF_MODE, - MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, - module, - INT, param1); + MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_AF_MODE, + MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, + module, + INT, param1); } void _camera_dispatcher_callback_supported_exposure_mode(int param1, void *user_data) @@ -74,10 +74,10 @@ void _camera_dispatcher_callback_supported_exposure_mode(int param1, void *user_ LOGD("Enter!! param : %d", param1); muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT, - MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EXPOSURE_MODE, - MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, - module, - INT, param1); + MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EXPOSURE_MODE, + MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, + module, + INT, param1); } void _camera_dispatcher_callback_supported_iso_mode(int param1, void *user_data) @@ -87,10 +87,10 @@ void _camera_dispatcher_callback_supported_iso_mode(int param1, void *user_data) LOGD("Enter!! param : %d", param1); muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT, - MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_ISO, - MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, - module, - INT, param1); + MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_ISO, + MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, + module, + INT, param1); } void _camera_dispatcher_callback_supported_whitebalance(int param1, void *user_data) @@ -100,10 +100,10 @@ void _camera_dispatcher_callback_supported_whitebalance(int param1, void *user_d LOGD("Enter!! param : %d", param1); muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT, - MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_WHITEBALANCE, - MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, - module, - INT, param1); + MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_WHITEBALANCE, + MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, + module, + INT, param1); } void _camera_dispatcher_callback_supported_effect(int param1, void *user_data) @@ -113,10 +113,10 @@ void _camera_dispatcher_callback_supported_effect(int param1, void *user_data) LOGD("Enter!! param : %d", param1); muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT, - MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EFFECT, - MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, - module, - INT, param1); + MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EFFECT, + MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, + module, + INT, param1); } void _camera_dispatcher_callback_supported_scene_mode(int param1, void *user_data) @@ -126,10 +126,10 @@ void _camera_dispatcher_callback_supported_scene_mode(int param1, void *user_dat LOGD("Enter!! param : %d", param1); muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT, - MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_SCENE_MODE, - MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, - module, - INT, param1); + MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_SCENE_MODE, + MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, + module, + INT, param1); } void _camera_dispatcher_callback_supported_flash_mode(int param1, void *user_data) @@ -139,10 +139,10 @@ void _camera_dispatcher_callback_supported_flash_mode(int param1, void *user_dat LOGD("Enter!! param : %d", param1); muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT, - MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FLASH_MODE, - MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, - module, - INT, param1); + MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FLASH_MODE, + MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, + module, + INT, param1); } int _camera_dispatcher_callback_supported_flash_mode2(int param1, void *user_data) @@ -166,10 +166,10 @@ void _camera_dispatcher_callback_supported_fps(int param1, void *user_data) LOGD("Enter!! param : %d", param1); muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT, - MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS, - MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, - module, - INT, param1); + MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS, + MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, + module, + INT, param1); } void _camera_dispatcher_callback_supported_fps_by_resolution(int param1, void *user_data) @@ -179,10 +179,10 @@ void _camera_dispatcher_callback_supported_fps_by_resolution(int param1, void *u LOGD("Enter!! param : %d", param1); muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT, - MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS_BY_RESOLUTION, - MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, - module, - INT, param1); + MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS_BY_RESOLUTION, + MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, + module, + INT, param1); } void _camera_dispatcher_callback_supported_stream_flip(int param1, void *user_data) @@ -192,10 +192,10 @@ void _camera_dispatcher_callback_supported_stream_flip(int param1, void *user_da LOGD("Enter!! param : %d", param1); muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT, - MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_FLIP, - MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, - module, - INT, param1); + MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_FLIP, + MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, + module, + INT, param1); } void _camera_dispatcher_callback_supported_stream_rotation(int param1, void *user_data) @@ -205,10 +205,10 @@ void _camera_dispatcher_callback_supported_stream_rotation(int param1, void *use LOGD("Enter!! param : %d", param1); muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT, - MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION, - MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, - module, - INT, param1); + MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION, + MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, + module, + INT, param1); } void _camera_dispatcher_callback_supported_capture_format(int param1, void *user_data) @@ -218,10 +218,10 @@ void _camera_dispatcher_callback_supported_capture_format(int param1, void *user LOGD("Enter!! param : %d", param1); muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT, - MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_FORMAT, - MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, - module, - INT, param1); + MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_FORMAT, + MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, + module, + INT, param1); } void _camera_dispatcher_callback_supported_preview_format(int param1, void *user_data) @@ -231,10 +231,10 @@ void _camera_dispatcher_callback_supported_preview_format(int param1, void *user LOGD("Enter!! param : %d", param1); muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT, - MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_FORMAT, - MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, - module, - INT, param1); + MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_FORMAT, + MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, + module, + INT, param1); } void _camera_dispatcher_callback_supported_preview_resolution(int param1, int param2, void *user_data) @@ -244,11 +244,11 @@ void _camera_dispatcher_callback_supported_preview_resolution(int param1, int pa LOGD("Enter!! param1 : %d, param2 : %d", param1, param2); muse_camera_msg_event2(MUSE_CAMERA_CB_EVENT, - MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_RESOLUTION, - MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, - module, - INT, param1, - INT, param2); + MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_RESOLUTION, + MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, + module, + INT, param1, + INT, param2); } void _camera_dispatcher_callback_supported_capture_resolution(int param1, int param2, void *user_data) @@ -258,11 +258,11 @@ void _camera_dispatcher_callback_supported_capture_resolution(int param1, int pa LOGD("Enter!! param1 : %d, param2 : %d", param1, param2); muse_camera_msg_event2(MUSE_CAMERA_CB_EVENT, - MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_RESOLUTION, - MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, - module, - INT, param1, - INT, param2); + MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_RESOLUTION, + MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, + module, + INT, param1, + INT, param2); } void _camera_dispatcher_callback_supported_ptz_type(int param1, void *user_data) @@ -272,10 +272,10 @@ void _camera_dispatcher_callback_supported_ptz_type(int param1, void *user_data) LOGD("Enter!! param : %d", param1); muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT, - MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PTZ_TYPE, - MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, - module, - INT, param1); + MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PTZ_TYPE, + MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, + module, + INT, param1); } static int _camera_remove_export_data(muse_module_h module, int key, int remove_all) @@ -412,7 +412,7 @@ void _camera_dispatcher_capturing_cb(camera_image_data_s* image, camera_image_da tbm_bo_unmap(bo_main); tbm_key_main = tbm_bo_export(bo_main); - if(tbm_key_main == 0) { + if (tbm_key_main == 0) { LOGE("Create key_info ERROR!!"); goto main_image_error; } @@ -455,7 +455,7 @@ void _camera_dispatcher_capturing_cb(camera_image_data_s* image, camera_image_da tbm_bo_unmap(bo_post); tbm_key_post = tbm_bo_export(bo_post); - if(tbm_key_post == 0) { + if (tbm_key_post == 0) { LOGE("Create key_info ERROR!!"); goto postview_image_error; } @@ -496,7 +496,7 @@ void _camera_dispatcher_capturing_cb(camera_image_data_s* image, camera_image_da tbm_bo_unmap(bo_thumb); tbm_key_thumb = tbm_bo_export(bo_thumb); - if(tbm_key_thumb == 0) { + if (tbm_key_thumb == 0) { LOGE("Create key_info ERROR!!"); goto thumbnail_image_error; } @@ -518,12 +518,12 @@ void _camera_dispatcher_capturing_cb(camera_image_data_s* image, camera_image_da /* send message */ muse_camera_msg_event3(MUSE_CAMERA_CB_EVENT, - MUSE_CAMERA_EVENT_TYPE_CAPTURE, - MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, - module, - INT, tbm_key_main, - INT, tbm_key_post, - INT, tbm_key_thumb); + MUSE_CAMERA_EVENT_TYPE_CAPTURE, + MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, + module, + INT, tbm_key_main, + INT, tbm_key_post, + INT, tbm_key_thumb); return; @@ -571,12 +571,12 @@ void _camera_dispatcher_state_changed_cb(camera_state_e previous, camera_state_e previous, current, by_policy); muse_camera_msg_event3(MUSE_CAMERA_CB_EVENT, - MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE, - MUSE_CAMERA_EVENT_CLASS_THREAD_MAIN, - module, - INT, previous, - INT, current, - INT, by_policy); + MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE, + MUSE_CAMERA_EVENT_CLASS_THREAD_MAIN, + module, + INT, previous, + INT, current, + INT, by_policy); return; } @@ -588,12 +588,12 @@ void _camera_dispatcher_interrupted_cb(camera_policy_e policy, camera_state_e pr LOGD("Enter - policy %d, state previous %d, current %d", policy, previous, current); muse_camera_msg_event3(MUSE_CAMERA_CB_EVENT, - MUSE_CAMERA_EVENT_TYPE_INTERRUPTED, - MUSE_CAMERA_EVENT_CLASS_THREAD_MAIN, - module, - INT, policy, - INT, previous, - INT, current); + MUSE_CAMERA_EVENT_TYPE_INTERRUPTED, + MUSE_CAMERA_EVENT_CLASS_THREAD_MAIN, + module, + INT, policy, + INT, previous, + INT, current); return; } @@ -681,7 +681,7 @@ void _camera_dispatcher_preview_cb(MMCamcorderVideoStreamDataType *stream, void case MM_CAM_STREAM_DATA_ENCODED: data_size = stream->data.encoded.length_data; break; - default : + default: LOGW("unknown data type %d", stream->data_type); break; } @@ -724,7 +724,7 @@ void _camera_dispatcher_preview_cb(MMCamcorderVideoStreamDataType *stream, void case MM_CAM_STREAM_DATA_ENCODED: memcpy(buf_pos, stream->data.encoded.data, stream->data.encoded.length_data); break; - default : + default: break; } @@ -747,7 +747,7 @@ void _camera_dispatcher_preview_cb(MMCamcorderVideoStreamDataType *stream, void } tbm_key = tbm_bo_export(bo); - if(tbm_key == 0) { + if (tbm_key == 0) { LOGE("Create key_info ERROR!!"); goto _PREVIEW_CB_ERROR; } @@ -797,7 +797,7 @@ void _camera_dispatcher_preview_cb(MMCamcorderVideoStreamDataType *stream, void /*LOGD("wait preview callback return message");*/ if (!CHECK_PREVIEW_CB(muse_camera, PREVIEW_CB_TYPE_EVAS)) { - gint64 end_time = g_get_monotonic_time () + G_TIME_SPAN_SECOND; + gint64 end_time = g_get_monotonic_time() + G_TIME_SPAN_SECOND; if (!g_cond_wait_until(&muse_camera->preview_cb_cond, &muse_camera->preview_cb_lock, end_time)) { LOGW("preview callback return message timeout"); @@ -834,9 +834,9 @@ void _camera_dispatcher_capture_completed_cb(void *user_data) LOGD("Enter"); muse_camera_msg_event(MUSE_CAMERA_CB_EVENT, - MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE, - MUSE_CAMERA_EVENT_CLASS_THREAD_MAIN, - module); + MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE, + MUSE_CAMERA_EVENT_CLASS_THREAD_MAIN, + module); return; } @@ -922,11 +922,11 @@ void _camera_dispatcher_face_detected_cb(camera_detected_face_s *faces, int coun /* send message */ muse_camera_msg_event2(MUSE_CAMERA_CB_EVENT, - MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION, - MUSE_CAMERA_EVENT_CLASS_THREAD_MAIN, - module, - INT, count, - INT, tbm_key); + MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION, + MUSE_CAMERA_EVENT_CLASS_THREAD_MAIN, + module, + INT, count, + INT, tbm_key); } else { LOGW("invalid count for face detection - %d", count); } @@ -941,10 +941,10 @@ void _camera_dispatcher_focus_changed_cb(camera_focus_state_e state, void *user_ LOGD("Enter - state %d", state); muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT, - MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE, - MUSE_CAMERA_EVENT_CLASS_THREAD_MAIN, - module, - INT, state); + MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE, + MUSE_CAMERA_EVENT_CLASS_THREAD_MAIN, + module, + INT, state); return; } @@ -956,11 +956,11 @@ void _camera_dispatcher_error_cb(camera_error_e error, camera_state_e current_st LOGD("Enter - error 0x%x, current_state %d", error, current_state); muse_camera_msg_event2(MUSE_CAMERA_CB_EVENT, - MUSE_CAMERA_EVENT_TYPE_ERROR, - MUSE_CAMERA_EVENT_CLASS_THREAD_MAIN, - module, - INT, error, - INT, current_state); + MUSE_CAMERA_EVENT_TYPE_ERROR, + MUSE_CAMERA_EVENT_CLASS_THREAD_MAIN, + module, + INT, error, + INT, current_state); return; } @@ -972,10 +972,10 @@ void _camera_dispatcher_hdr_progress_cb(int percent, void *user_data) LOGD("Enter"); muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT, - MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS, - MUSE_CAMERA_EVENT_CLASS_THREAD_MAIN, - module, - INT, percent); + MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS, + MUSE_CAMERA_EVENT_CLASS_THREAD_MAIN, + module, + INT, percent); return; } @@ -1182,9 +1182,9 @@ int camera_dispatcher_start_capture(muse_module_h module) } ret = legacy_camera_start_capture(muse_camera->camera_handle, - (camera_capturing_cb)capturing_cb, - (camera_capture_completed_cb)completed_cb, - (void *)module); + (camera_capturing_cb)capturing_cb, + (camera_capture_completed_cb)completed_cb, + (void *)module); muse_camera_msg_return(api, class, ret, module); @@ -1228,11 +1228,11 @@ int camera_dispatcher_start_continuous_capture(muse_module_h module) LOGD("Enter, handle : %p, module : %p", muse_camera, module); ret = legacy_camera_start_continuous_capture(muse_camera->camera_handle, - count, - interval, - (camera_capturing_cb)_camera_dispatcher_capturing_cb, - (camera_capture_completed_cb)_camera_dispatcher_capture_completed_cb, - (void *)module); + count, + interval, + (camera_capturing_cb)_camera_dispatcher_capturing_cb, + (camera_capture_completed_cb)_camera_dispatcher_capture_completed_cb, + (void *)module); muse_camera_msg_return(api, class, ret, module); @@ -1351,8 +1351,8 @@ int camera_dispatcher_start_face_detection(muse_module_h module) LOGD("Enter, handle : 0x%x, module : %d", muse_camera, module); ret = legacy_camera_start_face_detection(muse_camera->camera_handle, - (camera_face_detected_cb)_camera_dispatcher_face_detected_cb, - (void *)module); + (camera_face_detected_cb)_camera_dispatcher_face_detected_cb, + (void *)module); muse_camera_msg_return(api, class, ret, module); @@ -1474,8 +1474,8 @@ int camera_dispatcher_set_display(muse_module_h module) if (type == CAMERA_DISPLAY_TYPE_EVAS) { ret = legacy_camera_set_preview_cb(muse_camera->camera_handle, - (camera_preview_cb)_camera_dispatcher_preview_cb, - (void *)module); + (camera_preview_cb)_camera_dispatcher_preview_cb, + (void *)module); if (ret == CAMERA_ERROR_NONE) SET_PREVIEW_CB_TYPE(muse_camera, PREVIEW_CB_TYPE_EVAS); @@ -1933,8 +1933,8 @@ int camera_dispatcher_set_preview_cb(muse_module_h module) LOGD("handle : %p", muse_camera); ret = legacy_camera_set_preview_cb(muse_camera->camera_handle, - (camera_preview_cb)_camera_dispatcher_preview_cb, - (void *)module); + (camera_preview_cb)_camera_dispatcher_preview_cb, + (void *)module); if (ret == CAMERA_ERROR_NONE) SET_PREVIEW_CB_TYPE(muse_camera, PREVIEW_CB_TYPE_USER); @@ -1982,8 +1982,8 @@ int camera_dispatcher_set_media_packet_preview_cb(muse_module_h module) LOGD("handle : %p", muse_camera); ret = legacy_camera_set_media_packet_preview_cb(muse_camera->camera_handle, - (camera_preview_cb)_camera_dispatcher_preview_cb, - (void *)module); + (camera_preview_cb)_camera_dispatcher_preview_cb, + (void *)module); LOGD("ret : 0x%x", ret); @@ -2024,8 +2024,8 @@ int camera_dispatcher_set_state_changed_cb(muse_module_h module) LOGD("handle : %p", muse_camera); ret = legacy_camera_set_state_changed_cb(muse_camera->camera_handle, - (camera_state_changed_cb)_camera_dispatcher_state_changed_cb, - (void *)module); + (camera_state_changed_cb)_camera_dispatcher_state_changed_cb, + (void *)module); LOGD("ret : 0x%x", ret); @@ -2066,8 +2066,8 @@ int camera_dispatcher_set_interrupted_cb(muse_module_h module) LOGD("handle : %p", muse_camera); ret = legacy_camera_set_interrupted_cb(muse_camera->camera_handle, - (camera_interrupted_cb)_camera_dispatcher_interrupted_cb, - (void *)module); + (camera_interrupted_cb)_camera_dispatcher_interrupted_cb, + (void *)module); LOGD("ret : 0x%x", ret); @@ -2108,8 +2108,8 @@ int camera_dispatcher_set_focus_changed_cb(muse_module_h module) LOGD("handle : %p", muse_camera); ret = legacy_camera_set_focus_changed_cb(muse_camera->camera_handle, - (camera_focus_changed_cb)_camera_dispatcher_focus_changed_cb, - (void *)module); + (camera_focus_changed_cb)_camera_dispatcher_focus_changed_cb, + (void *)module); LOGD("ret : 0x%x", ret); @@ -2150,8 +2150,8 @@ int camera_dispatcher_set_error_cb(muse_module_h module) LOGD("handle : %p", muse_camera); ret = legacy_camera_set_error_cb(muse_camera->camera_handle, - (camera_error_cb)_camera_dispatcher_error_cb, - (void *)module); + (camera_error_cb)_camera_dispatcher_error_cb, + (void *)module); LOGD("ret : 0x%x", ret); @@ -2192,8 +2192,8 @@ int camera_dispatcher_foreach_supported_preview_resolution(muse_module_h module) LOGD("handle : %p", muse_camera); ret = legacy_camera_foreach_supported_preview_resolution(muse_camera->camera_handle, - (camera_supported_preview_resolution_cb)_camera_dispatcher_callback_supported_preview_resolution, - (void *)module); + (camera_supported_preview_resolution_cb)_camera_dispatcher_callback_supported_preview_resolution, + (void *)module); LOGD("ret : 0x%x", ret); @@ -2214,8 +2214,8 @@ int camera_dispatcher_foreach_supported_capture_resolution(muse_module_h module) LOGD("handle : %p", muse_camera); ret = legacy_camera_foreach_supported_capture_resolution(muse_camera->camera_handle, - (camera_supported_capture_resolution_cb)_camera_dispatcher_callback_supported_capture_resolution, - (void *)module); + (camera_supported_capture_resolution_cb)_camera_dispatcher_callback_supported_capture_resolution, + (void *)module); LOGD("ret : 0x%x", ret); @@ -2236,8 +2236,8 @@ int camera_dispatcher_foreach_supported_capture_format(muse_module_h module) LOGD("handle : %p", muse_camera); ret = legacy_camera_foreach_supported_capture_format(muse_camera->camera_handle, - (camera_supported_capture_format_cb)_camera_dispatcher_callback_supported_capture_format, - (void *)module); + (camera_supported_capture_format_cb)_camera_dispatcher_callback_supported_capture_format, + (void *)module); LOGD("ret : 0x%x", ret); @@ -2258,8 +2258,8 @@ int camera_dispatcher_foreach_supported_preview_format(muse_module_h module) LOGD("handle : %p", muse_camera); ret = legacy_camera_foreach_supported_preview_format(muse_camera->camera_handle, - (camera_supported_preview_format_cb)_camera_dispatcher_callback_supported_preview_format, - (void *)module); + (camera_supported_preview_format_cb)_camera_dispatcher_callback_supported_preview_format, + (void *)module); LOGD("ret : 0x%x", ret); @@ -2367,8 +2367,8 @@ int camera_dispatcher_attr_foreach_supported_theater_mode(muse_module_h module) LOGD("handle : %p", muse_camera); ret = legacy_camera_attr_foreach_supported_theater_mode(muse_camera->camera_handle, - (camera_attr_supported_theater_mode_cb)_camera_dispatcher_callback_supported_theater_mode, - (void *)module); + (camera_attr_supported_theater_mode_cb)_camera_dispatcher_callback_supported_theater_mode, + (void *)module); muse_camera_msg_return(api, class, ret, module); @@ -2894,9 +2894,9 @@ int camera_dispatcher_attr_set_flash_mode(muse_module_h module) ret = legacy_camera_get_device_type(muse_camera->camera_handle, &device_type); if (ret == CAMERA_ERROR_NONE) { if (device_type == CAMERA_DEVICE_CAMERA0) - muse_core_client_set_value(module, "flash_state_camera0", set_mode>0?1:0); + muse_core_client_set_value(module, "flash_state_camera0", set_mode > 0 ? 1 : 0); else - muse_core_client_set_value(module, "flash_state_camera1", set_mode>0?1:0); + muse_core_client_set_value(module, "flash_state_camera1", set_mode > 0 ? 1 : 0); } } @@ -3371,8 +3371,8 @@ int camera_dispatcher_attr_foreach_supported_af_mode(muse_module_h module) LOGD("handle : %p", muse_camera); ret = legacy_camera_attr_foreach_supported_af_mode(muse_camera->camera_handle, - (camera_attr_supported_af_mode_cb)_camera_dispatcher_callback_supported_af_mode, - (void *)module); + (camera_attr_supported_af_mode_cb)_camera_dispatcher_callback_supported_af_mode, + (void *)module); LOGD("ret : 0x%x", ret); @@ -3393,8 +3393,8 @@ int camera_dispatcher_attr_foreach_supported_exposure_mode(muse_module_h module) LOGD("handle : 0x%x, api : %d", muse_camera, api); ret = legacy_camera_attr_foreach_supported_exposure_mode(muse_camera->camera_handle, - (camera_attr_supported_exposure_mode_cb)_camera_dispatcher_callback_supported_exposure_mode, - (void *)module); + (camera_attr_supported_exposure_mode_cb)_camera_dispatcher_callback_supported_exposure_mode, + (void *)module); LOGD("ret : 0x%x", ret); @@ -3415,8 +3415,8 @@ int camera_dispatcher_attr_foreach_supported_iso(muse_module_h module) LOGD("handle : %p", muse_camera); ret = legacy_camera_attr_foreach_supported_iso(muse_camera->camera_handle, - (camera_attr_supported_iso_cb)_camera_dispatcher_callback_supported_iso_mode, - (void *)module); + (camera_attr_supported_iso_cb)_camera_dispatcher_callback_supported_iso_mode, + (void *)module); LOGD("ret : 0x%x", ret); @@ -3437,8 +3437,8 @@ int camera_dispatcher_attr_foreach_supported_whitebalance(muse_module_h module) LOGD("handle : %p", muse_camera); ret = legacy_camera_attr_foreach_supported_whitebalance(muse_camera->camera_handle, - (camera_attr_supported_whitebalance_cb)_camera_dispatcher_callback_supported_whitebalance, - (void *)module); + (camera_attr_supported_whitebalance_cb)_camera_dispatcher_callback_supported_whitebalance, + (void *)module); LOGD("ret : 0x%x", ret); @@ -3459,8 +3459,8 @@ int camera_dispatcher_attr_foreach_supported_effect(muse_module_h module) LOGD("handle : %p", muse_camera); ret = legacy_camera_attr_foreach_supported_effect(muse_camera->camera_handle, - (camera_attr_supported_effect_cb)_camera_dispatcher_callback_supported_effect, - (void *)module); + (camera_attr_supported_effect_cb)_camera_dispatcher_callback_supported_effect, + (void *)module); LOGD("ret : 0x%x", ret); @@ -3481,8 +3481,8 @@ int camera_dispatcher_attr_foreach_supported_scene_mode(muse_module_h module) LOGD("handle : %p", muse_camera); ret = legacy_camera_attr_foreach_supported_scene_mode(muse_camera->camera_handle, - (camera_attr_supported_scene_mode_cb)_camera_dispatcher_callback_supported_scene_mode, - (void *)module); + (camera_attr_supported_scene_mode_cb)_camera_dispatcher_callback_supported_scene_mode, + (void *)module); LOGD("ret : 0x%x", ret); @@ -3503,8 +3503,8 @@ int camera_dispatcher_attr_foreach_supported_flash_mode(muse_module_h module) LOGD("handle : %p", muse_camera); ret = legacy_camera_attr_foreach_supported_flash_mode(muse_camera->camera_handle, - (camera_attr_supported_flash_mode_cb)_camera_dispatcher_callback_supported_flash_mode, - (void *)module); + (camera_attr_supported_flash_mode_cb)_camera_dispatcher_callback_supported_flash_mode, + (void *)module); LOGD("ret : 0x%x", ret); @@ -3525,8 +3525,8 @@ int camera_dispatcher_attr_foreach_supported_fps(muse_module_h module) LOGD("handle : %p", muse_camera); ret = legacy_camera_attr_foreach_supported_fps(muse_camera->camera_handle, - (camera_attr_supported_fps_cb)_camera_dispatcher_callback_supported_fps, - (void *)module); + (camera_attr_supported_fps_cb)_camera_dispatcher_callback_supported_fps, + (void *)module); LOGD("ret : 0x%x", ret); @@ -3552,9 +3552,9 @@ int camera_dispatcher_attr_foreach_supported_fps_by_resolution(muse_module_h mod LOGD("handle : %p", muse_camera); ret = legacy_camera_attr_foreach_supported_fps_by_resolution(muse_camera->camera_handle, - width, height, - (camera_attr_supported_fps_cb)_camera_dispatcher_callback_supported_fps_by_resolution, - (void *)module); + width, height, + (camera_attr_supported_fps_cb)_camera_dispatcher_callback_supported_fps_by_resolution, + (void *)module); LOGD("ret : 0x%x", ret); @@ -3575,8 +3575,8 @@ int camera_dispatcher_attr_foreach_supported_stream_flip(muse_module_h module) LOGD("handle : %p", muse_camera); ret = legacy_camera_attr_foreach_supported_stream_flip(muse_camera->camera_handle, - (camera_attr_supported_stream_flip_cb)_camera_dispatcher_callback_supported_stream_flip, - (void *)module); + (camera_attr_supported_stream_flip_cb)_camera_dispatcher_callback_supported_stream_flip, + (void *)module); LOGD("ret : 0x%x", ret); @@ -3597,8 +3597,8 @@ int camera_dispatcher_attr_foreach_supported_stream_rotation(muse_module_h modul LOGD("handle : %p", muse_camera); ret = legacy_camera_attr_foreach_supported_stream_rotation(muse_camera->camera_handle, - (camera_attr_supported_stream_rotation_cb)_camera_dispatcher_callback_supported_stream_rotation, - (void *)module); + (camera_attr_supported_stream_rotation_cb)_camera_dispatcher_callback_supported_stream_rotation, + (void *)module); LOGD("ret : 0x%x", ret); @@ -3774,8 +3774,8 @@ int camera_dispatcher_attr_set_hdr_capture_progress_cb(muse_module_h module) LOGD("handle : %p", muse_camera); ret = legacy_camera_attr_set_hdr_capture_progress_cb(muse_camera->camera_handle, - (camera_attr_hdr_progress_cb)_camera_dispatcher_hdr_progress_cb, - (void *)module); + (camera_attr_hdr_progress_cb)_camera_dispatcher_hdr_progress_cb, + (void *)module); LOGD("ret : 0x%x", ret); @@ -4287,8 +4287,8 @@ int camera_dispatcher_attr_foreach_supported_ptz_type(muse_module_h module) LOGD("handle : %p", muse_camera); ret = legacy_camera_attr_foreach_supported_ptz_type(muse_camera->camera_handle, - (camera_attr_supported_ptz_type_cb)_camera_dispatcher_callback_supported_ptz_type, - (void *)module); + (camera_attr_supported_ptz_type_cb)_camera_dispatcher_callback_supported_ptz_type, + (void *)module); LOGD("ret : 0x%x", ret); diff --git a/packaging/mmsvc-camera.spec b/packaging/mmsvc-camera.spec index 618cead..b4892f8 100644 --- a/packaging/mmsvc-camera.spec +++ b/packaging/mmsvc-camera.spec @@ -1,6 +1,6 @@ Name: mmsvc-camera Summary: A Camera module for muse server -Version: 0.2.41 +Version: 0.2.42 Release: 0 Group: Multimedia/Libraries License: Apache-2.0 -- 2.7.4 From 41156049306941ef07a88922251953f089749214 Mon Sep 17 00:00:00 2001 From: Jeongmo Yang Date: Wed, 20 Jul 2016 16:51:54 +0900 Subject: [PATCH 03/16] [Release version 0.2.43] Add new dispatcher for camera_change_device API Change-Id: I2a34a9ed2a36c626f5aef3f46aa82bc43513cfca Signed-off-by: Jeongmo Yang --- legacy/include/legacy_camera.h | 358 +++++++++++++++++++-------------- legacy/include/legacy_camera_private.h | 15 +- legacy/src/legacy_camera.c | 218 +++++++++++++------- muse/include/muse_camera.h | 1 + muse/src/muse_camera_dispatcher.c | 32 ++- packaging/mmsvc-camera.spec | 2 +- 6 files changed, 388 insertions(+), 238 deletions(-) diff --git a/legacy/include/legacy_camera.h b/legacy/include/legacy_camera.h index 0e2b83b..10d0682 100644 --- a/legacy/include/legacy_camera.h +++ b/legacy/include/legacy_camera.h @@ -244,7 +244,7 @@ typedef struct { /** * @brief The Camera handle. * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif - * @see recorder_create_videorecorder() + * @see legacy_recorder_create_videorecorder() */ typedef struct camera_s *camera_h; @@ -516,9 +516,9 @@ typedef enum { * @param[in] current The current state of the camera * @param[in] by_policy If @c true the state is changed by policy, otherwise @c false * @param[in] user_data The user data passed from the callback registration function - * @pre camera_start_preview(), camera_start_capture() or camera_stop_preview() + * @pre legacy_camera_start_preview(), camera_start_capture() or camera_stop_preview() * will invoke this callback if you register this callback using camera_set_state_changed_cb(). - * @see camera_set_state_changed_cb() + * @see legacy_camera_set_state_changed_cb() */ typedef void (*camera_state_changed_cb)(camera_state_e previous, camera_state_e current, bool by_policy, void *user_data); @@ -530,7 +530,7 @@ typedef void (*camera_state_changed_cb)(camera_state_e previous, camera_state_e * @param[in] previous The previous state of the camera * @param[in] current The current state of the camera * @param[in] user_data The user data passed from the callback registration function - * @see camera_set_interrupted_cb() + * @see legacy_camera_set_interrupted_cb() */ typedef void (*camera_interrupted_cb)(camera_policy_e policy, camera_state_e previous, camera_state_e current, void *user_data); @@ -545,11 +545,11 @@ typedef void (*camera_interrupted_cb)(camera_policy_e policy, camera_state_e pre * * @param[in] state The current state of the auto-focus * @param[in] user_data The user data passed from the callback registration function - * @pre camera_start_focusing() will invoke this callback if you register it using camera_set_focus_changed_cb(). - * @see camera_set_focus_changed_cb() - * @see camera_unset_focus_changed_cb() - * @see camera_start_focusing() - * @see camera_cancel_focusing() + * @pre legacy_camera_start_focusing() will invoke this callback if you register it using camera_set_focus_changed_cb(). + * @see legacy_camera_set_focus_changed_cb() + * @see legacy_camera_unset_focus_changed_cb() + * @see legacy_camera_start_focusing() + * @see legacy_camera_cancel_focusing() */ typedef void (*camera_focus_changed_cb)(camera_focus_state_e state, void *user_data); @@ -562,10 +562,10 @@ typedef void (*camera_focus_changed_cb)(camera_focus_state_e state, void *user_d * * @param[in] frame The reference pointer to preview stream data * @param[in] user_data The user data passed from the callback registration function - * @pre camera_start_preview() will invoke this callback function if you register this callback using camera_set_preview_cb(). - * @see camera_start_preview() - * @see camera_set_preview_cb() - * @see camera_unset_preview_cb() + * @pre legacy_camera_start_preview() will invoke this callback function if you register this callback using camera_set_preview_cb(). + * @see legacy_camera_start_preview() + * @see legacy_camera_set_preview_cb() + * @see legacy_camera_unset_preview_cb() */ typedef void (*camera_preview_cb)(MMCamcorderVideoStreamDataType *frame, void *user_data); @@ -580,10 +580,10 @@ typedef void (*camera_preview_cb)(MMCamcorderVideoStreamDataType *frame, void *u * @param[in] postview The image data of the postview * @param[in] thumbnail The image data of the thumbnail (it should be @c NULL if the available thumbnail data does not exist) * @param[in] user_data The user data passed from the callback registration function - * @pre camera_start_capture() or camera_start_continuous_capture() will invoke this callback function if it is registered using camera_start_capture() or camera_start_continuous_capture(). - * @see camera_start_capture() - * @see camera_start_continuous_capture() - * @see camera_capture_completed_cb() + * @pre legacy_camera_start_capture() or camera_start_continuous_capture() will invoke this callback function if it is registered using camera_start_capture() or camera_start_continuous_capture(). + * @see legacy_camera_start_capture() + * @see legacy_camera_start_continuous_capture() + * @see legacy_camera_capture_completed_cb() */ typedef void (*camera_capturing_cb)(camera_image_data_s *image, camera_image_data_s *postview, camera_image_data_s *thumbnail, void *user_data); @@ -595,10 +595,10 @@ typedef void (*camera_capturing_cb)(camera_image_data_s *image, camera_image_dat * If you want to show the user a preview after capturing is finished, an application can use camera_start_preview() after calling this callback. * * @param[in] user_data The user data passed from the callback registration function - * @pre This callback function is invoked if it is registered using camera_start_capture() or camera_start_continuous_capture(). - * @see camera_start_capture() - * @see camera_start_continuous_capture() - * @see camera_capturing_cb() + * @pre This callback function is invoked if it is registered using camera_start_capture() or camera_start_continuous_capture(). + * @see legacy_camera_start_capture() + * @see legacy_camera_start_continuous_capture() + * @see legacy_camera_capturing_cb() */ typedef void (*camera_capture_completed_cb)(void *user_data); @@ -616,9 +616,9 @@ typedef void (*camera_capture_completed_cb)(void *user_data); * @param[in] error The error code * @param[in] current_state The current state of the camera * @param[in] user_data The user data passed from the callback registration function - * @pre This callback function is invoked if it is registered using camera_set_error_cb(). - * @see camera_set_error_cb() - * @see camera_unset_error_cb() + * @pre This callback function is invoked if it is registered using camera_set_error_cb(). + * @see legacy_camera_set_error_cb() + * @see legacy_camera_unset_error_cb() */ typedef void (*camera_error_cb)(camera_error_e error, camera_state_e current_state, void *user_data); @@ -628,7 +628,7 @@ typedef void (*camera_error_cb)(camera_error_e error, camera_state_e current_sta * @param[in] faces The detected face array * @param[in] count The length of the array * @param[in] user_data The user data passed from the callback registration function - * @see camera_start_face_detection() + * @see legacy_camera_start_face_detection() */ typedef void (*camera_face_detected_cb)(camera_detected_face_s *faces, int count, void *user_data); @@ -648,8 +648,8 @@ typedef void (*camera_face_detected_cb)(camera_detected_face_s *faces, int count * @param[in] height The preview image height * @param[in] user_data The user data passed from the foreach function * @return @c true to continue with the next iteration of the loop, \n otherwise @c false to break out of the loop - * @pre camera_foreach_supported_preview_resolution() will invoke this callback. - * @see camera_foreach_supported_preview_resolution() + * @pre legacy_camera_foreach_supported_preview_resolution() will invoke this callback. + * @see legacy_camera_foreach_supported_preview_resolution() */ typedef bool (*camera_supported_preview_resolution_cb)(int width, int height, void *user_data); @@ -660,8 +660,8 @@ typedef bool (*camera_supported_preview_resolution_cb)(int width, int height, vo * @param[in] height The capture resolution height * @param[in] user_data The user data passed from the foreach function * @return @c true to continue with the next iteration of the loop, \n otherwise @c false to break out of the loop - * @pre camera_foreach_supported_capture_resolution() will invoke this callback. - * @see camera_foreach_supported_capture_resolution() + * @pre legacy_camera_foreach_supported_capture_resolution() will invoke this callback. + * @see legacy_camera_foreach_supported_capture_resolution() */ typedef bool (*camera_supported_capture_resolution_cb)(int width, int height, void *user_data); @@ -671,8 +671,8 @@ typedef bool (*camera_supported_capture_resolution_cb)(int width, int height, vo * @param[in] format The supported pixel format * @param[in] user_data The user data passed from the foreach function * @return @c true to continue with the next iteration of the loop, \n otherwise @c false to break out of the loop - * @pre camera_foreach_supported_capture_format() will invoke this callback. - * @see camera_foreach_supported_capture_format() + * @pre legacy_camera_foreach_supported_capture_format() will invoke this callback. + * @see legacy_camera_foreach_supported_capture_format() */ typedef bool (*camera_supported_capture_format_cb)(camera_pixel_format_e format, void *user_data); @@ -682,8 +682,8 @@ typedef bool (*camera_supported_capture_format_cb)(camera_pixel_format_e format, * @param[in] format The supported preview data format * @param[in] user_data The user data passed from the foreach function * @return @c true to continue with the next iteration of the loop, \n otherwise @c false to break out of the loop - * @pre camera_foreach_supported_preview_format() will invoke this callback. - * @see camera_foreach_supported_preview_format() + * @pre legacy_camera_foreach_supported_preview_format() will invoke this callback. + * @see legacy_camera_foreach_supported_preview_format() */ typedef bool (*camera_supported_preview_format_cb)(camera_pixel_format_e format, void *user_data); @@ -718,11 +718,37 @@ typedef bool (*camera_supported_preview_format_cb)(camera_pixel_format_e format, * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @post If it succeeds, the camera state will be #CAMERA_STATE_CREATED. * - * @see camera_destroy() + * @see legacy_camera_destroy() */ int legacy_camera_create(camera_device_e device, camera_h *camera); /** + * @brief Changes camera device. + * + * @since_tizen 3.0 + * @privlevel public + * @privilege %http://tizen.org/privilege/camera + * @remarks This function can be used to change camera device simply without camera_destroy() and camera_create().\n + * If display reuse hint is set by camera_set_display_reuse_hint() before stop preview,\n + * display handle will be reused and last frame on display can be kept even though camera device is changed. + * @param[in] camera The handle to the camera + * @param[in] device The hardware camera to access + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_INVALID_STATE Invalid state + * @retval #CAMERA_ERROR_OUT_OF_MEMORY Out of memory + * @retval #CAMERA_ERROR_INVALID_OPERATION Invalid operation + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @pre The camera state must be set to #CAMERA_STATE_CREATED. + * @post If it succeeds, the camera attributes and settings will be reset. + * + * @see legacy_camera_set_display_reuse_hint() + * @see legacy_camera_get_display_reuse_hint() + */ +int legacy_camera_change_device(camera_h *camera, camera_device_e device); + +/** * @brief Destroys the camera handle and releases all its resources. * * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif @@ -765,7 +791,7 @@ int legacy_camera_destroy(camera_h camera); * @post If it succeeds, the camera state will be #CAMERA_STATE_PREVIEW.\n * legacy_camera_preview_cb() will be called when preview image data becomes available. * - * @see camera_stop_preview() + * @see legacy_camera_stop_preview() * @see legacy_camera_set_display() * @see legacy_camera_set_preview_cb() * @see legacy_camera_set_media_packet_preview_cb() @@ -796,9 +822,9 @@ int legacy_camera_start_preview(camera_h camera); * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @pre The camera state must be set to #CAMERA_STATE_PREVIEW. * @post The camera state will be #CAMERA_STATE_CREATED. - * @see camera_start_preview() - * @see camera_unset_preview_cb() - * @see camera_unset_media_packet_preview_cb() + * @see legacy_camera_start_preview() + * @see legacy_camera_unset_preview_cb() + * @see legacy_camera_unset_media_packet_preview_cb() */ int legacy_camera_stop_preview(camera_h camera); @@ -971,7 +997,7 @@ int legacy_camera_start_focusing(camera_h camera, bool continuous); * @pre The camera state must be set to #CAMERA_STATE_PREVIEW. * * @see legacy_camera_start_focusing() - * @see camera_focus_changed_cb() + * @see legacy_camera_focus_changed_cb() */ int legacy_camera_cancel_focusing(camera_h camera); @@ -1015,8 +1041,8 @@ int legacy_camera_set_display(camera_h camera, camera_display_type_e type, camer * @pre The camera state must be set to #CAMERA_STATE_CREATED or #CAMERA_STATE_PREVIEW. * * @see legacy_camera_start_preview() - * @see camera_get_preview_resolution() - * @see camera_foreach_supported_preview_resolution() + * @see legacy_camera_get_preview_resolution() + * @see legacy_camera_foreach_supported_preview_resolution() */ int legacy_camera_set_preview_resolution(camera_h camera, int width, int height); @@ -1032,8 +1058,8 @@ int legacy_camera_set_preview_resolution(camera_h camera, int width, int height) * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported - * @see camera_set_preview_resolution() - * @see camera_foreach_supported_preview_resolution() + * @see legacy_camera_set_preview_resolution() + * @see legacy_camera_foreach_supported_preview_resolution() */ int legacy_camera_get_preview_resolution(camera_h camera, int *width, int *height); @@ -1050,8 +1076,8 @@ int legacy_camera_get_preview_resolution(camera_h camera, int *width, int *heigh * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported - * @see camera_set_preview_resolution() - * @see camera_foreach_supported_preview_resolution() + * @see legacy_camera_set_preview_resolution() + * @see legacy_camera_foreach_supported_preview_resolution() */ int legacy_camera_get_recommended_preview_resolution(camera_h camera, int *width, int *height); @@ -1141,9 +1167,9 @@ bool legacy_camera_is_supported_continuous_capture(camera_h camera); * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @post This function invokes legacy_camera_supported_preview_resolution_cb() repeatedly to retrieve each supported preview resolution. * - * @see camera_set_preview_resolution() - * @see camera_get_preview_resolution() - * @see camera_supported_preview_resolution_cb() + * @see legacy_camera_set_preview_resolution() + * @see legacy_camera_get_preview_resolution() + * @see legacy_camera_supported_preview_resolution_cb() */ int legacy_camera_foreach_supported_preview_resolution(camera_h camera, camera_supported_preview_resolution_cb callback, void *user_data); @@ -1175,7 +1201,7 @@ int legacy_camera_foreach_supported_preview_resolution(camera_h camera, * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @see legacy_camera_start_preview() - * @see camera_get_display_rotation() + * @see legacy_camera_get_display_rotation() */ int legacy_camera_set_display_rotation(camera_h camera, camera_rotation_e rotation); @@ -1211,7 +1237,7 @@ int legacy_camera_get_display_rotation(camera_h camera, camera_rotation_e *rotat * @retval #CAMERA_ERROR_INVALID_OPERATION Display type is incorrect * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported - * @see camera_get_display_flip() + * @see legacy_camera_get_display_flip() */ int legacy_camera_set_display_flip(camera_h camera, camera_flip_e flip); @@ -1301,9 +1327,35 @@ int legacy_camera_set_display_mode(camera_h camera , camera_display_mode_e mode) */ int legacy_camera_get_display_mode(camera_h camera, camera_display_mode_e *mode); - +/** + * @brief Sets hint for reuse display. + * @since_tizen 3.0 + * @remarks To reuse display, camera_change_device() function should be called for change the camera device. + * @param[in] camera The handle to the camera + * @param[in] hint The hint for reuse display + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_INVALID_STATE Invalid state + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @pre The camera state must be set to #CAMERA_STATE_PREVIEW. + * @see legacy_camera_get_display_reuse_hint() + * @see legacy_camera_change_device() + */ int legacy_camera_set_display_reuse_hint(camera_h camera, int hint); +/** + * @brief Gets hint for reuse display. + * @since_tizen 3.0 + * @param[in] camera The handle to the camera + * @param[out] hint The hint for reuse display + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @see legacy_camera_get_display_reuse_hint() + * @see legacy_camera_change_device() + */ int legacy_camera_get_display_reuse_hint(camera_h camera, int *hint); /** @@ -1322,8 +1374,8 @@ int legacy_camera_get_display_reuse_hint(camera_h camera, int *hint); * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @pre The camera state must be set to #CAMERA_STATE_CREATED or #CAMERA_STATE_PREVIEW. * @see legacy_camera_start_capture() - * @see camera_get_capture_resolution() - * @see camera_foreach_supported_capture_resolution() + * @see legacy_camera_get_capture_resolution() + * @see legacy_camera_foreach_supported_capture_resolution() */ int legacy_camera_set_capture_resolution(camera_h camera, int width, int height); @@ -1367,7 +1419,7 @@ int legacy_camera_get_capture_resolution(camera_h camera, int *width, int *heigh * @post This function invokes legacy_camera_supported_capture_resolution_cb() repeatedly to retrieve each supported capture resolution. * @see legacy_camera_set_capture_resolution() * @see legacy_camera_get_capture_resolution() - * @see camera_supported_capture_resolution_cb() + * @see legacy_camera_supported_capture_resolution_cb() */ int legacy_camera_foreach_supported_capture_resolution(camera_h camera, camera_supported_capture_resolution_cb callback, void *user_data); @@ -1394,10 +1446,10 @@ int legacy_camera_foreach_supported_capture_resolution(camera_h camera, * @retval #CAMERA_ERROR_INVALID_STATE Invalid state * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported - * @pre The camera state must be set to #CAMERA_STATE_CREATED or #CAMERA_STATE_PREVIEW. + * @pre The camera state must be set to #CAMERA_STATE_CREATED or #CAMERA_STATE_PREVIEW. * @see legacy_camera_start_capture() - * @see camera_get_capture_format() - * @see camera_foreach_supported_capture_format() + * @see legacy_camera_get_capture_format() + * @see legacy_camera_foreach_supported_capture_format() */ int legacy_camera_set_capture_format(camera_h camera, camera_pixel_format_e format); @@ -1412,8 +1464,8 @@ int legacy_camera_set_capture_format(camera_h camera, camera_pixel_format_e form * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported - * @see camera_set_capture_format() - * @see camera_foreach_supported_capture_format() + * @see legacy_camera_set_capture_format() + * @see legacy_camera_foreach_supported_capture_format() */ int legacy_camera_get_capture_format(camera_h camera, camera_pixel_format_e *format); @@ -1439,9 +1491,9 @@ int legacy_camera_get_capture_format(camera_h camera, camera_pixel_format_e *for * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @post This function invokes legacy_camera_supported_capture_format_cb() repeatedly to retrieve each supported capture format. - * @see camera_set_capture_format() - * @see camera_get_capture_format() - * @see camera_supported_capture_format_cb() + * @see legacy_camera_set_capture_format() + * @see legacy_camera_get_capture_format() + * @see legacy_camera_supported_capture_format_cb() */ int legacy_camera_foreach_supported_capture_format(camera_h camera, camera_supported_capture_format_cb callback, void *user_data); @@ -1469,8 +1521,8 @@ int legacy_camera_foreach_supported_capture_format(camera_h camera, * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @pre The camera state must be set to #CAMERA_STATE_CREATED. * @see legacy_camera_start_preview() - * @see camera_get_preview_format() - * @see camera_foreach_supported_preview_format() + * @see legacy_camera_get_preview_format() + * @see legacy_camera_foreach_supported_preview_format() */ int legacy_camera_set_preview_format(camera_h camera, camera_pixel_format_e format); @@ -1484,8 +1536,8 @@ int legacy_camera_set_preview_format(camera_h camera, camera_pixel_format_e form * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported - * @see camera_set_preview_format() - * @see camera_foreach_supported_preview_format() + * @see legacy_camera_set_preview_format() + * @see legacy_camera_foreach_supported_preview_format() */ int legacy_camera_get_preview_format(camera_h camera, camera_pixel_format_e *format); @@ -1523,9 +1575,9 @@ int legacy_camera_get_facing_direction(camera_h camera, camera_facing_direction_ * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @post This function invokes legacy_camera_supported_preview_format_cb() repeatly to retrieve each supported preview format. - * @see camera_set_preview_format() - * @see camera_get_preview_format() - * @see camera_supported_preview_format_cb() + * @see legacy_camera_set_preview_format() + * @see legacy_camera_get_preview_format() + * @see legacy_camera_supported_preview_format_cb() */ int legacy_camera_foreach_supported_preview_format(camera_h camera, camera_supported_preview_format_cb callback, void *user_data); @@ -1620,10 +1672,10 @@ bool legacy_camera_is_supported_media_packet_preview_cb(camera_h camera); * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported - * @pre The camera's state must be set to #CAMERA_STATE_CREATED. - * @see camera_start_preview() + * @pre The camera's state must be set to #CAMERA_STATE_CREATED. + * @see legacy_camera_start_preview() * @see legacy_camera_unset_preview_cb() - * @see camera_preview_cb() + * @see legacy_camera_preview_cb() */ int legacy_camera_set_preview_cb(camera_h camera, camera_preview_cb callback, void *user_data); @@ -1658,10 +1710,10 @@ int legacy_camera_unset_preview_cb(camera_h camera); * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported - * @pre The camera's state should be #CAMERA_STATE_CREATED. - * @see camera_start_preview() - * @see camera_unset_media_packet_preview_cb() - * @see camera_media_packet_preview_cb() + * @pre The camera's state should be #CAMERA_STATE_CREATED. + * @see legacy_camera_start_preview() + * @see legacy_camera_unset_media_packet_preview_cb() + * @see legacy_camera_media_packet_preview_cb() */ int legacy_camera_set_media_packet_preview_cb(camera_h camera, camera_preview_cb callback, void *user_data); @@ -1674,7 +1726,7 @@ int legacy_camera_set_media_packet_preview_cb(camera_h camera, camera_preview_cb * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported - * @see camera_set_media_packet_preview_cb() + * @see legacy_camera_set_media_packet_preview_cb() */ int legacy_camera_unset_media_packet_preview_cb(camera_h camera); @@ -1691,7 +1743,7 @@ int legacy_camera_unset_media_packet_preview_cb(camera_h camera); * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @post This function will invoke legacy_camera_state_changed_cb() when the camera state changes. * @see legacy_camera_unset_state_changed_cb() - * @see camera_state_changed_cb() + * @see legacy_camera_state_changed_cb() */ int legacy_camera_set_state_changed_cb(camera_h camera, camera_state_changed_cb callback, void *user_data); @@ -1720,7 +1772,7 @@ int legacy_camera_unset_state_changed_cb(camera_h camera); * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @see legacy_camera_unset_interrupted_cb() - * @see camera_interrupted_cb() + * @see legacy_camera_interrupted_cb() */ int legacy_camera_set_interrupted_cb(camera_h camera, camera_interrupted_cb callback, void *user_data); @@ -1749,10 +1801,10 @@ int legacy_camera_unset_interrupted_cb(camera_h camera); * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @post This function will invoke legacy_camera_focus_changed_cb() when the auto-focus state changes. - * @see camera_start_focusing() - * @see camera_cancel_focusing() - * @see camera_unset_focus_changed_cb() - * @see camera_focus_changed_cb() + * @see legacy_camera_start_focusing() + * @see legacy_camera_cancel_focusing() + * @see legacy_camera_unset_focus_changed_cb() + * @see legacy_camera_focus_changed_cb() */ int legacy_camera_set_focus_changed_cb(camera_h camera, camera_focus_changed_cb callback, void *user_data); @@ -1789,7 +1841,7 @@ int legacy_camera_unset_focus_changed_cb(camera_h camera); * @post This function will invoke legacy_camera_error_cb() when an asynchronous operation error occurs. * @see legacy_camera_unset_error_cb() - * @see camera_error_cb() + * @see legacy_camera_error_cb() */ int legacy_camera_set_error_cb(camera_h camera, camera_error_cb callback, void *user_data); @@ -1821,8 +1873,8 @@ int legacy_camera_unset_error_cb(camera_h camera); * @param[in] mode The supported auto-focus mode * @param[in] user_data The user data passed from the foreach function * @return @c true to continue with the next iteration of the loop, \n otherwise @c false to break out of the loop - * @pre camera_attr_foreach_supported_af_mode() will invoke this callback. - * @see camera_attr_foreach_supported_af_mode() + * @pre legacy_camera_attr_foreach_supported_af_mode() will invoke this callback. + * @see legacy_camera_attr_foreach_supported_af_mode() */ typedef bool (*camera_attr_supported_af_mode_cb)(camera_attr_af_mode_e mode, void *user_data); @@ -1832,9 +1884,9 @@ typedef bool (*camera_attr_supported_af_mode_cb)(camera_attr_af_mode_e mode, voi * @param[in] mode The supported exposure mode * @param[in] user_data The user data passed from the foreach function * @return @c true to continue with the next iteration of the loop, \n otherwise @c false to break out of the loop - * @pre camera_attr_foreach_supported_exposure_mode() will invoke this callback. - * @see camera_attr_foreach_supported_exposure_mode() - * @see #camera_attr_exposure_mode_e + * @pre legacy_camera_attr_foreach_supported_exposure_mode() will invoke this callback. + * @see legacy_camera_attr_foreach_supported_exposure_mode() + * @see #camera_attr_exposure_mode_e */ typedef bool (*camera_attr_supported_exposure_mode_cb)(camera_attr_exposure_mode_e mode, void *user_data); @@ -1844,8 +1896,8 @@ typedef bool (*camera_attr_supported_exposure_mode_cb)(camera_attr_exposure_mode * @param[in] iso The supported ISO mode * @param[in] user_data The user data passed from the foreach function * @return @c true to continue with the next iteration of the loop, \n otherwise @c false to break out of the loop - * @pre camera_attr_foreach_supported_iso() will invoke this callback. - * @see camera_attr_foreach_supported_iso() + * @pre legacy_camera_attr_foreach_supported_iso() will invoke this callback. + * @see legacy_camera_attr_foreach_supported_iso() */ typedef bool (*camera_attr_supported_iso_cb)(camera_attr_iso_e iso, void *user_data); @@ -1855,9 +1907,9 @@ typedef bool (*camera_attr_supported_iso_cb)(camera_attr_iso_e iso, void *user_d * @param[in] wb The supported white balance mode * @param[in] user_data The user data passed from the foreach function * @return @c true to continue with the next iteration of the loop, \n otherwise @c false to break out of the loop - * @pre camera_attr_foreach_supported_whitebalance() will invoke this callback. - * @see camera_attr_foreach_supported_whitebalance() - * @see #camera_attr_whitebalance_e + * @pre legacy_camera_attr_foreach_supported_whitebalance() will invoke this callback. + * @see legacy_camera_attr_foreach_supported_whitebalance() + * @see #camera_attr_whitebalance_e */ typedef bool (*camera_attr_supported_whitebalance_cb)(camera_attr_whitebalance_e wb, void *user_data); @@ -1867,8 +1919,8 @@ typedef bool (*camera_attr_supported_whitebalance_cb)(camera_attr_whitebalance_e * @param[in] effect The supported effect mode * @param[in] user_data The user data passed from the foreach function * @return @c true to continue with the next iteration of the loop, \n otherwise @c false to break out of the loop - * @pre camera_attr_foreach_supported_effect() will invoke this callback. - * @see camera_attr_foreach_supported_effect() + * @pre legacy_camera_attr_foreach_supported_effect() will invoke this callback. + * @see legacy_camera_attr_foreach_supported_effect() */ typedef bool (*camera_attr_supported_effect_cb)(camera_attr_effect_mode_e effect, void *user_data); @@ -1878,9 +1930,9 @@ typedef bool (*camera_attr_supported_effect_cb)(camera_attr_effect_mode_e effect * @param[in] mode The supported scene mode * @param[in] user_data The user data passed from the foreach function * @return @c true to continue with the next iteration of the loop, \n otherwise @c false to break out of the loop - * @pre camera_attr_foreach_supported_scene_mode() will invoke this callback. - * @see camera_attr_foreach_supported_scene_mode() - * @see #camera_attr_scene_mode_e + * @pre legacy_camera_attr_foreach_supported_scene_mode() will invoke this callback. + * @see legacy_camera_attr_foreach_supported_scene_mode() + * @see #camera_attr_scene_mode_e */ typedef bool (*camera_attr_supported_scene_mode_cb)(camera_attr_scene_mode_e mode, void *user_data); @@ -1890,8 +1942,8 @@ typedef bool (*camera_attr_supported_scene_mode_cb)(camera_attr_scene_mode_e mod * @param[in] mode The supported flash mode * @param[in] user_data The user data passed from the foreach function * @return @c true to continue with the next iteration of the loop, \n otherwise @c false to break out of the loop - * @pre camera_attr_foreach_supported_flash_mode() will invoke this callback. - * @see camera_attr_foreach_supported_flash_mode() + * @pre legacy_camera_attr_foreach_supported_flash_mode() will invoke this callback. + * @see legacy_camera_attr_foreach_supported_flash_mode() */ typedef bool (*camera_attr_supported_flash_mode_cb)(camera_attr_flash_mode_e mode, void *user_data); @@ -1901,8 +1953,8 @@ typedef bool (*camera_attr_supported_flash_mode_cb)(camera_attr_flash_mode_e mod * @param[in] mode The supported FPS mode * @param[in] user_data The user data passed from the foreach function * @return @c true to continue with the next iteration of the loop, \n otherwise @c false to break out of the loop - * @pre camera_attr_foreach_supported_fps() will invoke this callback. - * @see camera_attr_foreach_supported_fps() + * @pre legacy_camera_attr_foreach_supported_fps() will invoke this callback. + * @see legacy_camera_attr_foreach_supported_fps() */ typedef bool (*camera_attr_supported_fps_cb)(camera_attr_fps_e fps, void *user_data); @@ -1912,8 +1964,8 @@ typedef bool (*camera_attr_supported_fps_cb)(camera_attr_fps_e fps, void *user_d * @param[in] mode The supported stream flip mode * @param[in] user_data The user data passed from the foreach function * @return @c true to continue with the next iteration of the loop, \n @c false to break out of the loop - * @pre camera_attr_foreach_supported_stream_flip() will invoke this callback. - * @see camera_attr_foreach_supported_stream_flip() + * @pre legacy_camera_attr_foreach_supported_stream_flip() will invoke this callback. + * @see legacy_camera_attr_foreach_supported_stream_flip() */ typedef bool (*camera_attr_supported_stream_flip_cb)(camera_flip_e flip, void *user_data); @@ -1923,8 +1975,8 @@ typedef bool (*camera_attr_supported_stream_flip_cb)(camera_flip_e flip, void *u * @param[in] mode The supported stream rotation mode * @param[in] user_data The user data passed from the foreach function * @return @c true to continue with the next iteration of the loop, \n @c false to break out of the loop - * @pre camera_attr_foreach_supported_stream_rotation() will invoke this callback. - * @see camera_attr_foreach_supported_stream_rotation() + * @pre legacy_camera_attr_foreach_supported_stream_rotation() will invoke this callback. + * @see legacy_camera_attr_foreach_supported_stream_rotation() */ typedef bool (*camera_attr_supported_stream_rotation_cb)(camera_rotation_e rotation, void *user_data); @@ -1934,8 +1986,8 @@ typedef bool (*camera_attr_supported_stream_rotation_cb)(camera_rotation_e rotat * @param[in] mode The supported theater mode * @param[in] user_data The user data passed from the foreach function * @return @c true to continue with the next iteration of the loop, \n @c false to break out of the loop - * @pre camera_attr_foreach_supported_theater_mode() will invoke this callback. - * @see camera_attr_foreach_supported_theater_mode() + * @pre legacy_camera_attr_foreach_supported_theater_mode() will invoke this callback. + * @see legacy_camera_attr_foreach_supported_theater_mode() */ typedef bool (*camera_attr_supported_theater_mode_cb)(camera_attr_theater_mode_e mode, void *user_data); @@ -1945,8 +1997,8 @@ typedef bool (*camera_attr_supported_theater_mode_cb)(camera_attr_theater_mode_e * @param[in] type The supported ptz type * @param[in] user_data The user data passed from the foreach function * @return @c true to continue with the next iteration of the loop, \n @c false to break out of the loop - * @pre camera_attr_foreach_supported_ptz_type() will invoke this callback. - * @see camera_attr_foreach_supported_ptz_type() + * @pre legacy_camera_attr_foreach_supported_ptz_type() will invoke this callback. + * @see legacy_camera_attr_foreach_supported_ptz_type() */ typedef bool (*camera_attr_supported_ptz_type_cb)(camera_attr_ptz_type_e type, void *user_data); @@ -1972,8 +2024,8 @@ typedef bool (*camera_attr_supported_ptz_type_cb)(camera_attr_ptz_type_e type, v * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @see legacy_camera_start_preview() - * @see camera_attr_get_preview_fps() - * @see camera_attr_foreach_supported_fps() + * @see legacy_camera_attr_get_preview_fps() + * @see legacy_camera_attr_foreach_supported_fps() */ int legacy_camera_attr_set_preview_fps(camera_h camera, camera_attr_fps_e fps); @@ -1987,8 +2039,8 @@ int legacy_camera_attr_set_preview_fps(camera_h camera, camera_attr_fps_e fps); * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported - * @see camera_attr_set_preview_fps() - * @see camera_attr_foreach_supported_fps() + * @see legacy_camera_attr_set_preview_fps() + * @see legacy_camera_attr_foreach_supported_fps() */ int legacy_camera_attr_get_preview_fps(camera_h camera, camera_attr_fps_e *fps); @@ -2013,9 +2065,9 @@ int legacy_camera_attr_get_preview_fps(camera_h camera, camera_attr_fps_e *fps); * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @post This function invokes legacy_camera_attr_supported_fps_cb() repeatly to get each supported FPS mode. - * @see camera_attr_set_preview_fps() - * @see camera_attr_get_preview_fps() - * @see camera_attr_supported_fps_cb() + * @see legacy_camera_attr_set_preview_fps() + * @see legacy_camera_attr_get_preview_fps() + * @see legacy_camera_attr_supported_fps_cb() */ int legacy_camera_attr_foreach_supported_fps(camera_h camera, camera_attr_supported_fps_cb callback, void *user_data); @@ -2035,9 +2087,9 @@ int legacy_camera_attr_foreach_supported_fps(camera_h camera, camera_attr_suppor * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @post This function invokes legacy_camera_attr_supported_fps_cb() repeatly to get each supported FPS mode. - * @see camera_attr_set_preview_fps() - * @see camera_attr_get_preview_fps() - * @see camera_attr_supported_fps_cb() + * @see legacy_camera_attr_set_preview_fps() + * @see legacy_camera_attr_get_preview_fps() + * @see legacy_camera_attr_supported_fps_cb() */ int legacy_camera_attr_foreach_supported_fps_by_resolution(camera_h camera, int width, int height, camera_attr_supported_fps_cb callback, void *user_data); @@ -2067,7 +2119,7 @@ int legacy_camera_attr_foreach_supported_fps_by_resolution(camera_h camera, int * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @pre The camera state must be set to #CAMERA_STATE_CREATED or #CAMERA_STATE_PREVIEW. * @see legacy_camera_start_preview() - * @see camera_attr_get_image_quality() + * @see legacy_camera_attr_get_image_quality() */ int legacy_camera_attr_set_image_quality(camera_h camera, int quality); @@ -2148,9 +2200,9 @@ int legacy_camera_attr_get_zoom_range(camera_h camera , int *min , int *max); * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported - * @see camera_attr_get_af_mode() - * @see camera_attr_foreach_supported_af_mode() - * @see #camera_attr_af_mode_e + * @see legacy_camera_attr_get_af_mode() + * @see legacy_camera_attr_foreach_supported_af_mode() + * @see #camera_attr_af_mode_e */ int legacy_camera_attr_set_af_mode(camera_h camera, camera_attr_af_mode_e mode); @@ -2168,7 +2220,7 @@ int legacy_camera_attr_set_af_mode(camera_h camera, camera_attr_af_mode_e mode); * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @see legacy_camera_attr_foreach_supported_af_mode() * @see legacy_camera_attr_set_af_mode() - * @see #camera_attr_af_mode_e + * @see #camera_attr_af_mode_e */ int legacy_camera_attr_get_af_mode(camera_h camera, camera_attr_af_mode_e *mode); @@ -2234,7 +2286,7 @@ int legacy_camera_attr_clear_af_area(camera_h camera); * @post This function invokes legacy_camera_attr_supported_af_mode_cb() to get all the supported auto focus modes. * @see legacy_camera_attr_set_af_mode() * @see legacy_camera_attr_get_af_mode() - * @see camera_attr_supported_af_mode_cb() + * @see legacy_camera_attr_supported_af_mode_cb() */ int legacy_camera_attr_foreach_supported_af_mode(camera_h camera, camera_attr_supported_af_mode_cb callback, void *user_data); @@ -2302,7 +2354,7 @@ int legacy_camera_attr_get_exposure_mode(camera_h camera, camera_attr_exposure_m * @post This function invokes legacy_camera_attr_supported_exposure_mode_cb() to get all the supported exposure modes. * @see legacy_camera_attr_set_exposure_mode() * @see legacy_camera_attr_get_exposure_mode() - * @see camera_attr_supported_exposure_mode_cb() + * @see legacy_camera_attr_supported_exposure_mode_cb() */ int legacy_camera_attr_foreach_supported_exposure_mode(camera_h camera, camera_attr_supported_exposure_mode_cb callback, void *user_data); @@ -2327,7 +2379,7 @@ int legacy_camera_attr_foreach_supported_exposure_mode(camera_h camera, camera_a * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported - * @see camera_attr_get_exposure() + * @see legacy_camera_attr_get_exposure() */ int legacy_camera_attr_set_exposure(camera_h camera, int value); @@ -2341,7 +2393,7 @@ int legacy_camera_attr_set_exposure(camera_h camera, int value); * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported - * @see camera_attr_set_exposure() + * @see legacy_camera_attr_set_exposure() */ int legacy_camera_attr_get_exposure(camera_h camera, int *value); @@ -2357,7 +2409,7 @@ int legacy_camera_attr_get_exposure(camera_h camera, int *value); * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported - * @see camera_attr_set_exposure() + * @see legacy_camera_attr_set_exposure() */ int legacy_camera_attr_get_exposure_range(camera_h camera, int *min, int *max); @@ -2373,7 +2425,7 @@ int legacy_camera_attr_get_exposure_range(camera_h camera, int *min, int *max); * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported - * @see camera_attr_get_iso() + * @see legacy_camera_attr_get_iso() * @see legacy_camera_attr_foreach_supported_iso() */ int legacy_camera_attr_set_iso(camera_h camera, camera_attr_iso_e iso); @@ -2388,7 +2440,7 @@ int legacy_camera_attr_set_iso(camera_h camera, camera_attr_iso_e iso); * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported - * @see camera_attr_set_iso() + * @see legacy_camera_attr_set_iso() * @see legacy_camera_attr_foreach_supported_iso() */ int legacy_camera_attr_get_iso(camera_h camera, camera_attr_iso_e *iso); @@ -2414,9 +2466,9 @@ int legacy_camera_attr_get_iso(camera_h camera, camera_attr_iso_e *iso); * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @post This function invokes legacy_camera_attr_supported_iso_cb() to get all the supported ISO levels. - * @see camera_attr_set_iso() + * @see legacy_camera_attr_set_iso() * @see legacy_camera_attr_get_iso() - * @see camera_attr_supported_iso_cb() + * @see legacy_camera_attr_supported_iso_cb() */ int legacy_camera_attr_foreach_supported_iso(camera_h camera, camera_attr_supported_iso_cb callback, void *user_data); @@ -2442,8 +2494,8 @@ int legacy_camera_attr_foreach_supported_iso(camera_h camera, camera_attr_suppor * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported - * @pre This function is valid only when the external display is connected. - * @see camera_attr_get_theater_mode() + * @pre This function is valid only when the external display is connected. + * @see legacy_camera_attr_get_theater_mode() */ int legacy_camera_attr_set_theater_mode(camera_h camera, camera_attr_theater_mode_e mode); @@ -2457,7 +2509,7 @@ int legacy_camera_attr_set_theater_mode(camera_h camera, camera_attr_theater_mod * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported - * @see camera_attr_get_theater_mode() + * @see legacy_camera_attr_get_theater_mode() */ int legacy_camera_attr_get_theater_mode(camera_h camera, camera_attr_theater_mode_e *mode); @@ -2484,7 +2536,7 @@ int legacy_camera_attr_get_theater_mode(camera_h camera, camera_attr_theater_mod * @post This function invokes legacy_camera_attr_supported_theater_mode_cb() to get all supported theater modes. * @see legacy_camera_attr_set_theater_mode() * @see legacy_camera_attr_get_theater_mode() - * @see camera_attr_supported_theater_mode_cb() + * @see legacy_camera_attr_supported_theater_mode_cb() */ int legacy_camera_attr_foreach_supported_theater_mode(camera_h camera, camera_attr_supported_theater_mode_cb callback, void *user_data); @@ -2651,7 +2703,7 @@ int legacy_camera_attr_get_whitebalance(camera_h camera, camera_attr_whitebalanc * @post This function invokes legacy_camera_attr_supported_whitebalance_cb() to get all the supported white balances. * @see legacy_camera_attr_set_whitebalance() * @see legacy_camera_attr_get_whitebalance() - * @see camera_attr_supported_whitebalance_cb() + * @see legacy_camera_attr_supported_whitebalance_cb() */ int legacy_camera_attr_foreach_supported_whitebalance(camera_h camera, camera_attr_supported_whitebalance_cb callback, void *user_data); @@ -2720,7 +2772,7 @@ int legacy_camera_attr_get_effect(camera_h camera, camera_attr_effect_mode_e *ef * @post This function invokes legacy_camera_attr_supported_effect_cb() to get all the supported effect modes. * @see legacy_camera_attr_set_effect() * @see legacy_camera_attr_get_effect() - * @see camera_attr_supported_effect_cb() + * @see legacy_camera_attr_supported_effect_cb() */ int legacy_camera_attr_foreach_supported_effect(camera_h camera, camera_attr_supported_effect_cb callback, void *user_data); @@ -2760,7 +2812,7 @@ int legacy_camera_attr_set_scene_mode(camera_h camera, camera_attr_scene_mode_e * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported - * @see camera_attr_foreach_supported_scene_mode() + * @see legacy_camera_attr_foreach_supported_scene_mode() * @see legacy_camera_attr_set_scene_mode() */ int legacy_camera_attr_get_scene_mode(camera_h camera, camera_attr_scene_mode_e *mode); @@ -2786,7 +2838,7 @@ int legacy_camera_attr_get_scene_mode(camera_h camera, camera_attr_scene_mode_e * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @post This function invokes legacy_camera_attr_supported_scene_mode_cb() to get all the supported scene modes. - * @see camera_attr_set_scene_mode() + * @see legacy_camera_attr_set_scene_mode() * @see legacy_camera_attr_get_scene_mode() * @see legacy_camera_attr_supported_scene_mode_cb() */ @@ -2868,7 +2920,7 @@ int legacy_camera_attr_get_tag_image_description(camera_h camera, char **descrip * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported - * @see camera_attr_get_tag_orientation() + * @see legacy_camera_attr_get_tag_orientation() */ int legacy_camera_attr_set_tag_orientation(camera_h camera, camera_attr_tag_orientation_e orientation); @@ -2882,7 +2934,7 @@ int legacy_camera_attr_set_tag_orientation(camera_h camera, camera_attr_tag_orie * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported - * @see camera_attr_set_tag_orientation() + * @see legacy_camera_attr_set_tag_orientation() */ int legacy_camera_attr_get_tag_orientation(camera_h camera, camera_attr_tag_orientation_e *orientation); @@ -2978,7 +3030,7 @@ int legacy_camera_attr_remove_geotag(camera_h camera); * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @retval #CAMERA_ERROR_DEVICE_BUSY The flash was preempted by other API - * @see camera_attr_foreach_supported_flash_mode() + * @see legacy_camera_attr_foreach_supported_flash_mode() * @see legacy_camera_attr_get_flash_mode() */ int legacy_camera_attr_set_flash_mode(camera_h camera, camera_attr_flash_mode_e mode); @@ -3019,9 +3071,9 @@ int legacy_camera_attr_get_flash_mode(camera_h camera, camera_attr_flash_mode_e * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @post This function invokes legacy_camera_attr_supported_flash_mode_cb() to get all supported flash modes. - * @see camera_attr_set_flash_mode() + * @see legacy_camera_attr_set_flash_mode() * @see legacy_camera_attr_get_flash_mode() - * @see camera_attr_supported_flash_mode_cb() + * @see legacy_camera_attr_supported_flash_mode_cb() */ int legacy_camera_attr_foreach_supported_flash_mode(camera_h camera, camera_attr_supported_flash_mode_cb callback, void *user_data); @@ -3058,7 +3110,7 @@ int legacy_camera_attr_get_lens_orientation(camera_h camera, int *angle); * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported - * @pre The camera state must be set to #CAMERA_STATE_CREATED. + * @pre The camera state must be set to #CAMERA_STATE_CREATED. * @see legacy_camera_attr_get_stream_rotation() */ int legacy_camera_attr_set_stream_rotation(camera_h camera , camera_rotation_e rotation); @@ -3073,7 +3125,7 @@ int legacy_camera_attr_set_stream_rotation(camera_h camera , camera_rotation_e r * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported - * @pre The camera state must be set to #CAMERA_STATE_CREATED. + * @pre The camera state must be set to #CAMERA_STATE_CREATED. * @see legacy_camera_attr_set_stream_rotation() */ int legacy_camera_attr_get_stream_rotation(camera_h camera , camera_rotation_e *rotation); @@ -3124,7 +3176,7 @@ int legacy_camera_attr_foreach_supported_stream_rotation(camera_h camera, camera * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported - * @pre The camera state must be set to #CAMERA_STATE_CREATED. + * @pre The camera state must be set to #CAMERA_STATE_CREATED. * @see legacy_camera_attr_set_stream_rotation() */ int legacy_camera_attr_set_stream_flip(camera_h camera , camera_flip_e flip); @@ -3139,7 +3191,7 @@ int legacy_camera_attr_set_stream_flip(camera_h camera , camera_flip_e flip); * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported - * @pre The camera state must be set to #CAMERA_STATE_CREATED. + * @pre The camera state must be set to #CAMERA_STATE_CREATED. * @see legacy_camera_attr_set_stream_rotation() */ int legacy_camera_attr_get_stream_flip(camera_h camera , camera_flip_e *flip); @@ -3636,7 +3688,7 @@ int legacy_camera_attr_set_ptz_type(camera_h camera, int ptz_type); * @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported * @post This function invokes camera_attr_supported_ptz_type_cb() to get all supported ptz type. - * @see camera_attr_set_ptz_type() + * @see legacy_camera_attr_set_ptz_type() */ int legacy_camera_attr_foreach_supported_ptz_type(camera_h camera, camera_attr_supported_ptz_type_cb foreach_cb, void *user_data); diff --git a/legacy/include/legacy_camera_private.h b/legacy/include/legacy_camera_private.h index e4bca29..8dcd4af 100644 --- a/legacy/include/legacy_camera_private.h +++ b/legacy/include/legacy_camera_private.h @@ -52,15 +52,14 @@ typedef struct _camera_cb_data { typedef struct _camera_s { MMHandleType mm_handle; - void* user_cb[_CAMERA_EVENT_TYPE_NUM]; - void* user_data[_CAMERA_EVENT_TYPE_NUM]; - void* display_handle; - MMCamWaylandInfo *wl_info; + void *user_cb[_CAMERA_EVENT_TYPE_NUM]; + void *user_data[_CAMERA_EVENT_TYPE_NUM]; + void *display_handle; camera_display_type_e display_type; unsigned int state; MMMessageCallback relay_message_callback; - void* relay_user_data; + void *relay_user_data; int capture_count; int capture_width; int capture_height; @@ -78,11 +77,6 @@ typedef struct _camera_s { int cached_focus_mode; camera_device_e device_type; camera_attr_ptz_type_e ptz_type; - - GList *cb_data_list; - GMutex idle_cb_lock; - - void *reuse_element; } camera_s; int _camera_get_mm_handle(camera_h camera , MMHandleType *handle); @@ -90,7 +84,6 @@ int _camera_set_relay_mm_message_callback(camera_h camera, MMMessageCallback cal int __camera_start_continuous_focusing(camera_h camera); int _camera_set_use(camera_h camera, bool used); bool _camera_is_used(camera_h camera); -void _camera_remove_cb_message(camera_s *handle); int __convert_camera_error_code(const char* func, int code); #ifdef __cplusplus diff --git a/legacy/src/legacy_camera.c b/legacy/src/legacy_camera.c index 390e181..4964df6 100644 --- a/legacy/src/legacy_camera.c +++ b/legacy/src/legacy_camera.c @@ -40,53 +40,6 @@ static gboolean __mm_videostream_callback(MMCamcorderVideoStreamDataType *stream, void *user_data); static gboolean __mm_capture_callback(MMCamcorderCaptureDataType *frame, MMCamcorderCaptureDataType *thumbnail, void *user_data); -void _camera_remove_cb_message(camera_s *handle) -{ - int ret = 0; - GList *list = NULL; - camera_cb_data *cb_data = NULL; - - if (handle == NULL) { - LOGE("handle is NULL"); - return; - } - - LOGI("start"); - - g_mutex_lock(&handle->idle_cb_lock); - - if (handle->cb_data_list) { - list = handle->cb_data_list; - - while (list) { - cb_data = list->data; - list = g_list_next(list); - - if (!cb_data) { - LOGW("cb_data is NULL"); - } else { - ret = g_idle_remove_by_data(cb_data); - LOGW("Remove cb_data[%p]. ret[%d]", cb_data, ret); - - handle->cb_data_list = g_list_remove(handle->cb_data_list, cb_data); - free(cb_data); - cb_data = NULL; - } - } - - g_list_free(handle->cb_data_list); - handle->cb_data_list = NULL; - } else { - LOGW("There is no remained callback"); - } - - g_mutex_unlock(&handle->idle_cb_lock); - - LOGI("done"); - - return; -} - int __convert_camera_error_code(const char *func, int code) { @@ -555,21 +508,21 @@ static int __capture_completed_event_cb(void *data) return false; } -int legacy_camera_create(camera_device_e device, camera_h* camera) +int legacy_camera_create(camera_device_e device, camera_h *camera) { + int ret = MM_ERROR_NONE; + int preview_format = MM_PIXEL_FORMAT_NV12; + int rotation = MM_DISPLAY_ROTATION_NONE; + camera_s *handle = NULL; + char *error = NULL; + MMCamPreset info; + if (camera == NULL) { LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret = MM_ERROR_NONE;; - MMCamPreset info; - int preview_format; - int rotation; - camera_s *handle = NULL; - char *error = NULL; - - LOGW("device name = [%d]", device); + LOGD("device name = [%d]",device); info.videodev_type = device; @@ -645,15 +598,143 @@ int legacy_camera_create(camera_device_e device, camera_h* camera) handle->device_type = device; handle->ptz_type = CAMERA_ATTR_PTZ_TYPE_ELECTRONIC; - g_mutex_init(&handle->idle_cb_lock); - mm_camcorder_set_message_callback(handle->mm_handle, - __mm_camera_message_callback, - (void *)handle); + __mm_camera_message_callback, (void *)handle); *camera = (camera_h)handle; - LOGW("camera handle %p", handle); + LOGD("legacy camera handle %p", handle); + + return __convert_camera_error_code(__func__, ret); +} + + +int legacy_camera_change_device(camera_h *camera, camera_device_e device) +{ + int ret = MM_ERROR_NONE; + int pid = 0; + int size = 0; + camera_s *old_handle = NULL; + camera_s *new_handle = NULL; + camera_state_e capi_state = CAMERA_STATE_NONE; + void *reuse_element = NULL; + + if (camera == NULL) { + LOGE("NULL handle"); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + if (device < CAMERA_DEVICE_CAMERA0 || device > CAMERA_DEVICE_CAMERA1) { + LOGE("invalid device %d", device); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + old_handle = (camera_s *)*camera; + + if (old_handle->is_used_in_recorder) { + LOGE("camera is using in another recorder."); + return CAMERA_ERROR_INVALID_OPERATION; + } + + if (old_handle->device_type == device) { + LOGE("same device. no need to change it."); + return CAMERA_ERROR_NONE; + } + + /* check current state */ + legacy_camera_get_state(*camera, &capi_state); + if (capi_state != CAMERA_STATE_CREATED) { + LOGE("invalid state %d", capi_state); + return CAMERA_ERROR_INVALID_STATE; + } + + /* get reuse element */ + ret = mm_camcorder_get_attributes(old_handle->mm_handle, NULL, + MMCAM_DISPLAY_REUSE_ELEMENT, &reuse_element, &size, + NULL); + if (ret != MM_ERROR_NONE) { + LOGE("failed to get reuse element 0x%x", ret); + return __convert_camera_error_code(__func__, ret); + } + + LOGD("reuse element %p", reuse_element); + + /* create new handle */ + ret = legacy_camera_create(device, (camera_h *)&new_handle); + if (ret != CAMERA_ERROR_NONE) { + LOGE("failed to create new handle 0x%x", ret); + return ret; + } + + /* set reuse element in new handle */ + ret = mm_camcorder_set_attributes(new_handle->mm_handle, NULL, + MMCAM_DISPLAY_REUSE_ELEMENT, reuse_element, size, + NULL); + if (ret != MM_ERROR_NONE) { + LOGE("failed to set reuse element 0x%x", ret); + goto _CHANGE_DEVICE_FAILED; + } + + /* reset reuse element in old handle */ + ret = mm_camcorder_set_attributes(old_handle->mm_handle, NULL, + MMCAM_DISPLAY_REUSE_ELEMENT, NULL, 0, + NULL); + if (ret != MM_ERROR_NONE) { + LOGE("failed to reset reuse element 0x%x", ret); + goto _CHANGE_DEVICE_FAILED; + } + + /* get pid from old handle */ + ret = mm_camcorder_get_attributes(old_handle->mm_handle, NULL, + MMCAM_PID_FOR_SOUND_FOCUS, &pid, + NULL); + if (ret != MM_ERROR_NONE) { + LOGE("failed to get pid 0x%x", ret); + goto _CHANGE_DEVICE_FAILED; + } + + LOGD("client pid %d from old handle", pid); + + /* set pid to new handle */ + ret = mm_camcorder_set_attributes(new_handle->mm_handle, NULL, + MMCAM_PID_FOR_SOUND_FOCUS, pid, + NULL); + if (ret != MM_ERROR_NONE) { + LOGE("failed to get pid 0x%x", ret); + goto _CHANGE_DEVICE_FAILED; + } + + /* set previous display */ + ret = legacy_camera_set_display(new_handle, old_handle->display_type, old_handle->display_handle); + if (ret != MM_ERROR_NONE) { + LOGE("legacy_camera_set_display failed0x%x", ret); + goto _CHANGE_DEVICE_FAILED; + } + + /* release old handle */ + ret = legacy_camera_destroy((camera_h)old_handle); + if (ret != CAMERA_ERROR_NONE) { + LOGE("failed to destroy old handle %p 0x%x", old_handle, ret); + goto _CHANGE_DEVICE_FAILED; + } + + *camera = (camera_h)new_handle; + + LOGD("new handle %p", new_handle); + + return CAMERA_ERROR_NONE; + +_CHANGE_DEVICE_FAILED: + if (new_handle) { + legacy_camera_destroy((camera_h)new_handle); + new_handle = NULL; + } + + if (reuse_element) { + mm_camcorder_set_attributes(old_handle->mm_handle, NULL, + MMCAM_DISPLAY_REUSE_ELEMENT, reuse_element, size, + NULL); + } return __convert_camera_error_code(__func__, ret); } @@ -678,14 +759,6 @@ int legacy_camera_destroy(camera_h camera) ret = mm_camcorder_destroy(handle->mm_handle); if (ret == MM_ERROR_NONE) { - _camera_remove_cb_message(handle); - g_mutex_clear(&handle->idle_cb_lock); - - if (handle->wl_info) { - free(handle->wl_info); - handle->wl_info = NULL; - } - free(handle); } @@ -1957,12 +2030,19 @@ int legacy_camera_set_display_reuse_hint(camera_h camera, int hint) { int ret = CAMERA_ERROR_NONE; camera_s *handle = (camera_s *)camera; + camera_state_e capi_state = CAMERA_STATE_NONE; if (!handle) { LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } + legacy_camera_get_state(camera, &capi_state); + if (capi_state != CAMERA_STATE_PREVIEW) { + LOGE("invalid state %d", capi_state); + return CAMERA_ERROR_INVALID_STATE; + } + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, MMCAM_DISPLAY_REUSE_HINT, hint, NULL); diff --git a/muse/include/muse_camera.h b/muse/include/muse_camera.h index a620f13..32c8205 100644 --- a/muse/include/muse_camera.h +++ b/muse/include/muse_camera.h @@ -184,6 +184,7 @@ typedef enum { MUSE_CAMERA_API_PREVIEW_CB_RETURN, /* 145 */ MUSE_CAMERA_API_SET_DISPLAY_REUSE_HINT, MUSE_CAMERA_API_GET_DISPLAY_REUSE_HINT, + MUSE_CAMERA_API_CHANGE_DEVICE, MUSE_CAMERA_API_MAX } muse_camera_api_e; diff --git a/muse/src/muse_camera_dispatcher.c b/muse/src/muse_camera_dispatcher.c index caf412a..2a9a0fb 100644 --- a/muse/src/muse_camera_dispatcher.c +++ b/muse/src/muse_camera_dispatcher.c @@ -1064,6 +1064,29 @@ int camera_dispatcher_create(muse_module_h module) return MUSE_CAMERA_ERROR_NONE; } + +int camera_dispatcher_change_device(muse_module_h module) +{ + int ret = CAMERA_ERROR_NONE; + int device = CAMERA_DEVICE_CAMERA0; + muse_camera_handle_s *muse_camera = NULL; + muse_camera_api_e api = MUSE_CAMERA_API_CHANGE_DEVICE; + muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; + + muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module); + + muse_camera_msg_get(device, muse_core_client_get_msg(module)); + + LOGD("change device to %d", device); + + ret = legacy_camera_change_device(&muse_camera->camera_handle, device); + + muse_camera_msg_return(api, class, ret, module); + + return MUSE_CAMERA_ERROR_NONE; +} + + int camera_dispatcher_destroy(muse_module_h module) { int ret = CAMERA_ERROR_NONE; @@ -4572,10 +4595,11 @@ int (*dispatcher[MUSE_CAMERA_API_MAX]) (muse_module_h module) = { camera_dispatcher_attr_foreach_supported_ptz_type, /* MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_PTZ_TYPE */ camera_dispatcher_attr_set_display_roi_area, /* MUSE_CAMERA_API_SET_DISPLAY_ROI_AREA */ camera_dispatcher_attr_get_display_roi_area, /* MUSE_CAMERA_API_GET_DISPLAY_ROI_AREA */ - camera_dispatcher_return_buffer, /* MUSE_CAMERA_API_RETURN_BUFFER, */ - camera_dispatcher_preview_cb_return, /* MUSE_CAMERA_API_PREVIEW_CB_RETURN, */ - camera_dispatcher_set_display_reuse_hint, /* MUSE_CAMERA_API_SET_DISPLAY_REUSE_HINT, */ - camera_dispatcher_get_display_reuse_hint, /* MUSE_CAMERA_API_GET_DISPLAY_REUSE_HINT, */ + camera_dispatcher_return_buffer, /* MUSE_CAMERA_API_RETURN_BUFFER */ + camera_dispatcher_preview_cb_return, /* MUSE_CAMERA_API_PREVIEW_CB_RETURN */ + camera_dispatcher_set_display_reuse_hint, /* MUSE_CAMERA_API_SET_DISPLAY_REUSE_HINT */ + camera_dispatcher_get_display_reuse_hint, /* MUSE_CAMERA_API_GET_DISPLAY_REUSE_HINT */ + camera_dispatcher_change_device /* MUSE_CAMERA_API_CHANGE_DEVICE */ }; diff --git a/packaging/mmsvc-camera.spec b/packaging/mmsvc-camera.spec index b4892f8..9c911d7 100644 --- a/packaging/mmsvc-camera.spec +++ b/packaging/mmsvc-camera.spec @@ -1,6 +1,6 @@ Name: mmsvc-camera Summary: A Camera module for muse server -Version: 0.2.42 +Version: 0.2.43 Release: 0 Group: Multimedia/Libraries License: Apache-2.0 -- 2.7.4 From f2a0041ac27a66bc2c8cd0e8930c9732177c9eb4 Mon Sep 17 00:00:00 2001 From: Jeongmo Yang Date: Thu, 28 Jul 2016 11:40:58 +0900 Subject: [PATCH 04/16] [Release version 0.2.44] Remove build warning Change-Id: Ia36b4569dbd694d192364e74905a7a4bc8fc38f4 Signed-off-by: Jeongmo Yang --- legacy/src/legacy_camera.c | 2 +- packaging/mmsvc-camera.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/legacy/src/legacy_camera.c b/legacy/src/legacy_camera.c index 4964df6..d0e356a 100644 --- a/legacy/src/legacy_camera.c +++ b/legacy/src/legacy_camera.c @@ -705,7 +705,7 @@ int legacy_camera_change_device(camera_h *camera, camera_device_e device) } /* set previous display */ - ret = legacy_camera_set_display(new_handle, old_handle->display_type, old_handle->display_handle); + ret = legacy_camera_set_display((camera_h)new_handle, old_handle->display_type, old_handle->display_handle); if (ret != MM_ERROR_NONE) { LOGE("legacy_camera_set_display failed0x%x", ret); goto _CHANGE_DEVICE_FAILED; diff --git a/packaging/mmsvc-camera.spec b/packaging/mmsvc-camera.spec index 9c911d7..5b7fe2b 100644 --- a/packaging/mmsvc-camera.spec +++ b/packaging/mmsvc-camera.spec @@ -1,6 +1,6 @@ Name: mmsvc-camera Summary: A Camera module for muse server -Version: 0.2.43 +Version: 0.2.44 Release: 0 Group: Multimedia/Libraries License: Apache-2.0 -- 2.7.4 From 72d3e61e3ea1ca94ff654f45d3cb21dda23a6ab7 Mon Sep 17 00:00:00 2001 From: Jeongmo Yang Date: Tue, 9 Aug 2016 18:08:39 +0900 Subject: [PATCH 05/16] [Release version 0.2.45] Add module initialize function Change-Id: Ibc3be453c0ac8272554dd1ed702b0cd6b38d77e1 Signed-off-by: Jeongmo Yang --- muse/CMakeLists.txt | 1 + muse/src/muse_camera_dispatcher.c | 38 +++++++++++++++++++++++++++++++++++++- packaging/mmsvc-camera.spec | 4 ++-- 3 files changed, 40 insertions(+), 3 deletions(-) diff --git a/muse/CMakeLists.txt b/muse/CMakeLists.txt index ac4a5fe..46652e0 100644 --- a/muse/CMakeLists.txt +++ b/muse/CMakeLists.txt @@ -28,6 +28,7 @@ ENDIF("${ARCH}" STREQUAL "arm") ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"") ADD_DEFINITIONS("-DTIZEN_DEBUG") +ADD_DEFINITIONS("-DLIBDIR=\"${LIBDIR}\"") SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=${LIB_INSTALL_DIR}") diff --git a/muse/src/muse_camera_dispatcher.c b/muse/src/muse_camera_dispatcher.c index 2a9a0fb..97ae158 100644 --- a/muse/src/muse_camera_dispatcher.c +++ b/muse/src/muse_camera_dispatcher.c @@ -4606,6 +4606,39 @@ int (*dispatcher[MUSE_CAMERA_API_MAX]) (muse_module_h module) = { /******************/ /* cmd dispatcher */ /******************/ +static int camera_cmd_dispatcher_initialize(muse_module_h module) +{ + int item_count = 0; + int i = 0; + GstPlugin *plugin = NULL; + + const char *load_list[] = { + LIBDIR"/gstreamer-1.0/libgstcoreelements.so", + LIBDIR"/gstreamer-1.0/libgstcamerasrc.so", + LIBDIR"/gstreamer-1.0/libgstwaylandsink.so", + }; + + item_count = sizeof(load_list) / sizeof(load_list[0]); + + LOGD("item count %d", item_count); + + for (i = 0 ; i < item_count ; i++) { + plugin = gst_plugin_load_file(load_list[i], NULL); + if (plugin) { + LOGD("%s loaded", load_list[i]); + gst_object_unref(plugin); + plugin = NULL; + } else { + LOGW("failed to load %s", load_list[i]); + } + } + + LOGD("done"); + + return MUSE_CAMERA_ERROR_NONE; +} + + static int camera_cmd_dispatcher_shutdown(muse_module_h module) { muse_camera_handle_s *muse_camera = NULL; @@ -4665,8 +4698,11 @@ again: return MUSE_CAMERA_ERROR_NONE; } + int (*cmd_dispatcher[MUSE_MODULE_COMMAND_MAX])(muse_module_h module) = { - NULL, /* MUSE_MODULE_COMMAND_INITIALIZE */ + camera_cmd_dispatcher_initialize, /* MUSE_MODULE_COMMAND_INITIALIZE */ camera_cmd_dispatcher_shutdown, /* MUSE_MODULE_COMMAND_SHUTDOWN */ NULL, /* MUSE_MODULE_COMMAND_DEBUG_INFO_DUMP */ + NULL, /* MUSE_MODULE_COMMAND_CREATE_SERVER_ACK */ + NULL /* MUSE_MODULE_COMMAND_RESOURCE_NOT_AVAILABLE */ }; diff --git a/packaging/mmsvc-camera.spec b/packaging/mmsvc-camera.spec index 5b7fe2b..b838800 100644 --- a/packaging/mmsvc-camera.spec +++ b/packaging/mmsvc-camera.spec @@ -1,6 +1,6 @@ Name: mmsvc-camera Summary: A Camera module for muse server -Version: 0.2.44 +Version: 0.2.45 Release: 0 Group: Multimedia/Libraries License: Apache-2.0 @@ -44,7 +44,7 @@ Development related files of a Camera module for muse server. export CFLAGS+=" -DTIZEN_DEBUG_ENABLE" %endif MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'` -%cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DFULLVER=%{version} -DMAJORVER=${MAJORVER} +%cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DFULLVER=%{version} -DMAJORVER=${MAJORVER} -DLIBDIR=%{_libdir} make %{?jobs:-j%jobs} -- 2.7.4 From 9645250787a907c02e851d2de028f7b5158e9e7d Mon Sep 17 00:00:00 2001 From: Jeongmo Yang Date: Wed, 24 Aug 2016 11:10:55 +0900 Subject: [PATCH 06/16] [Release version 0.2.45] 1. Remove unused macro, 2. Update code for 2 parameter APIs Change-Id: Ibce3b4549bdec9ac670b56431a8bd0877bb23cf6 Signed-off-by: Jeongmo Yang --- muse/include/muse_camera.h | 5 - muse/include/muse_camera_msg.h | 237 -------------------------------------- muse/src/muse_camera_dispatcher.c | 114 +++++++++--------- packaging/mmsvc-camera.spec | 2 +- 4 files changed, 61 insertions(+), 297 deletions(-) diff --git a/muse/include/muse_camera.h b/muse/include/muse_camera.h index 32c8205..1150a1e 100644 --- a/muse/include/muse_camera.h +++ b/muse/include/muse_camera.h @@ -282,11 +282,6 @@ typedef enum { */ #define CALLBACK_TIME_OUT 5 -/** - * @brief Definition for the long wait time of the ipc callback. - */ -#define CALLBACK_TIME_OUT_LONG 8 - #ifdef __cplusplus } diff --git a/muse/include/muse_camera_msg.h b/muse/include/muse_camera_msg.h index d285583..cecd91a 100644 --- a/muse/include/muse_camera_msg.h +++ b/muse/include/muse_camera_msg.h @@ -149,243 +149,6 @@ typedef const char* STRING; muse_core_msg_json_deserialize(#param, buf, NULL, ¶m, &e, MUSE_TYPE_ANY) /** - * @brief Send the message from proxy to module via ipc. - * @param[in] api The enumeration of the corresponding api. - * @param[in] fd The socket fd that connected to the module via ipc. - * @param[in] cb_info The callback information, waiting for the ack from the module. - * @param[out] ret The delivered return value from the module to proxy side. - */ -#define muse_camera_msg_send(api, fd, cb_info, ret) \ - do { \ - char *__sndMsg__; \ - int __len__; \ - __sndMsg__ = muse_core_msg_json_factory_new(api, 0); \ - __len__ = muse_core_ipc_send_msg(fd, __sndMsg__); \ - if (__len__ <= 0) { \ - LOGE("sending message failed"); \ - ret = CAMERA_ERROR_INVALID_OPERATION; \ - } else \ - ret = _client_wait_for_cb_return(api, cb_info, CALLBACK_TIME_OUT); \ - muse_core_msg_json_factory_free(__sndMsg__); \ - } while (0) - -/** - * @brief Send the message from proxy to module via ipc. - * @param[in] api The enumeration of the corresponding api. - * @param[in] fd The socket fd that connected to the module via ipc. - * @param[in] cb_info The callback information, waiting for the ack from the module. - */ -#define muse_camera_msg_send_no_return(api, fd, cb_info) \ - do { \ - char *__sndMsg__; \ - int __len__; \ - __sndMsg__ = muse_core_msg_json_factory_new(api, 0); \ - __len__ = muse_core_ipc_send_msg(fd, __sndMsg__); \ - if (__len__ <= 0) { \ - LOGE("sending message failed"); \ - } \ - muse_core_msg_json_factory_free(__sndMsg__); \ - } while (0) - -/** - * @brief Send the message from proxy to module via ipc, waits more period of time for the ack. - * @param[in] api The enumeration of the corresponding api. - * @param[in] fd The socket fd that connected to the module via ipc. - * @param[in] cb_info The callback information, waiting for the ack from the module. - * @param[out] ret The delivered return value from the module to proxy side. - */ -#define muse_camera_msg_send_longtime(api, fd, cb_info, ret) \ - do { \ - char *__sndMsg__; \ - int __len__; \ - __sndMsg__ = muse_core_msg_json_factory_new(api, 0); \ - __len__ = muse_core_ipc_send_msg(fd, __sndMsg__); \ - if (__len__ <= 0) { \ - LOGE("sending message failed"); \ - ret = CAMERA_ERROR_INVALID_OPERATION; \ - } else \ - ret = _client_wait_for_cb_return(api, cb_info, CALLBACK_TIME_OUT_LONG); \ - muse_core_msg_json_factory_free(__sndMsg__); \ - } while (0) - -/** - * @brief Send the message from proxy to module via ipc, adding 1 more parameter. - * @param[in] api The enumeration of the corresponding api. - * @param[in] fd The socket fd that connected to the module via ipc. - * @param[in] cb_info The callback information, waiting for the ack from the module. - * @param[out] ret The delivered return value from the module to proxy side. - * @param[in] type The data type of the parameter. - * @param[in] param A single parameter to be included in the message. - */ -#define muse_camera_msg_send1(api, fd, cb_info, ret, type, param) \ - do { \ - char *__sndMsg__; \ - int __len__; \ - type __value__ = (type)param; \ - __sndMsg__ = muse_core_msg_json_factory_new(api, \ - MUSE_TYPE_##type, #param, __value__, \ - 0); \ - __len__ = muse_core_ipc_send_msg(fd, __sndMsg__); \ - if (__len__ <= 0) { \ - LOGE("sending message failed"); \ - ret = CAMERA_ERROR_INVALID_OPERATION; \ - } else \ - ret = _client_wait_for_cb_return(api, cb_info, CALLBACK_TIME_OUT); \ - muse_core_msg_json_factory_free(__sndMsg__); \ - } while (0) - -/** - * @brief Send the message from proxy to module via ipc, adding 1 more parameter. - * @param[in] api The enumeration of the corresponding api. - * @param[in] fd The socket fd that connected to the module via ipc. - * @param[in] cb_info The callback information, waiting for the ack from the module. - * @param[in] type The data type of the parameter. - * @param[in] param A single parameter to be included in the message. - */ -#define muse_camera_msg_send1_no_return(api, fd, cb_info, type, param) \ - do { \ - char *__sndMsg__; \ - int __len__; \ - type __value__ = (type)param; \ - __sndMsg__ = muse_core_msg_json_factory_new(api, \ - MUSE_TYPE_##type, #param, __value__, \ - 0); \ - __len__ = muse_core_ipc_send_msg(fd, __sndMsg__); \ - if (__len__ <= 0) { \ - LOGE("sending message failed"); \ - } \ - muse_core_msg_json_factory_free(__sndMsg__); \ - } while (0) - -/** - * @brief Send the message from proxy to module via ipc, adding 2 more parameters. - * @param[in] api The enumeration of the corresponding api. - * @param[in] fd The socket fd that connected to the module via ipc. - * @param[in] cb_info The callback information, waiting for the ack from the module. - * @param[out] ret The delivered return value from the module to proxy side. - * @param[in] type1 The data type of the parameter. - * @param[in] param1 The first parameter to be included in the message. - * @param[in] type2 The data type of the parameter. - * @param[in] param2 The 2nd parameter to be included in the message. - */ -#define muse_camera_msg_send2(api, fd, cb_info, ret, type1, param1, type2, param2) \ - do { \ - char *__sndMsg__; \ - int __len__; \ - type1 __value1__ = (type1)param1; \ - type2 __value2__ = (type2)param2; \ - __sndMsg__ = muse_core_msg_json_factory_new(api, \ - MUSE_TYPE_##type1, #param1, __value1__, \ - MUSE_TYPE_##type2, #param2, __value2__, \ - 0); \ - __len__ = muse_core_ipc_send_msg(fd, __sndMsg__); \ - if (__len__ <= 0) { \ - LOGE("sending message failed"); \ - ret = CAMERA_ERROR_INVALID_OPERATION; \ - } else \ - ret = _client_wait_for_cb_return(api, cb_info, CALLBACK_TIME_OUT); \ - muse_core_msg_json_factory_free(__sndMsg__); \ - } while (0) - -/** - * @brief Send the message from proxy to module via ipc, adding 3 more parameters. - * @param[in] api The enumeration of the corresponding api. - * @param[in] fd The socket fd that connected to the module via ipc. - * @param[in] cb_info The callback information, waiting for the ack from the module. - * @param[out] ret The delivered return value from the module to proxy side. - * @param[in] type1 The data type of the parameter. - * @param[in] param1 The first parameter to be included in the message. - * @param[in] type2 The data type of the parameter. - * @param[in] param2 The 2nd parameter to be included in the message. - * @param[in] type3 The data type of the parameter. - * @param[in] param3 The 3rd parameter to be included in the message. - */ -#define muse_camera_msg_send3(api, fd, cb_info, ret, type1, param1, type2, param2, type3, param3) \ - do { \ - char *__sndMsg__; \ - int __len__; \ - type1 __value1__ = (type1)param1; \ - type2 __value2__ = (type2)param2; \ - type3 __value3__ = (type3)param3; \ - __sndMsg__ = muse_core_msg_json_factory_new(api, \ - MUSE_TYPE_##type1, #param1, __value1__, \ - MUSE_TYPE_##type2, #param2, __value2__, \ - MUSE_TYPE_##type3, #param3, __value3__, \ - 0); \ - __len__ = muse_core_ipc_send_msg(fd, __sndMsg__); \ - if (__len__ <= 0) { \ - LOGE("sending message failed"); \ - ret = CAMERA_ERROR_INVALID_OPERATION; \ - } else \ - ret = _client_wait_for_cb_return(api, cb_info, CALLBACK_TIME_OUT); \ - muse_core_msg_json_factory_free(__sndMsg__); \ - } while (0) - -/** - * @brief Send the message from proxy to module via ipc, adding an array data. - * @param[in] api The enumeration of the corresponding api. - * @param[in] fd The socket fd that connected to the module via ipc. - * @param[in] cb_info The callback information, waiting for the ack from the module. - * @param[out] ret The delivered return value from the module to proxy side. - * @param[in] param The array data parameter to be included in the message. - * @param[in] length The length of the array. - * @param[in] datum_size The size of the array. - */ -#define muse_camera_msg_send_array(api, fd, cb_info, ret, param, length, datum_size) \ - do { \ - char *__sndMsg__; \ - int __len__; \ - int *__value__ = (int *)param; \ - __sndMsg__ = muse_core_msg_json_factory_new(api, \ - MUSE_TYPE_ARRAY, #param, \ - datum_size == sizeof(int) ? length / sizeof(int) : \ - length / sizeof(int) + (length % sizeof(int) ? 1 : 0), \ - __value__, \ - 0); \ - __len__ = muse_core_ipc_send_msg(fd, __sndMsg__); \ - if (__len__ <= 0) { \ - LOGE("sending message failed"); \ - ret = CAMERA_ERROR_INVALID_OPERATION; \ - } else \ - ret = _client_wait_for_cb_return(api, cb_info, CALLBACK_TIME_OUT); \ - muse_core_msg_json_factory_free(__sndMsg__); \ - } while (0) - -/** - * @brief Send the message from proxy to module via ipc, adding an array data and value. - * @param[in] api The enumeration of the corresponding api. - * @param[in] fd The socket fd that connected to the module via ipc. - * @param[in] cb_info The callback information, waiting for the ack from the module. - * @param[out] ret The delivered return value from the module to proxy side. - * @param[in] param The array data parameter to be included in the message. - * @param[in] length The length of the array. - * @param[in] datum_size The size of the array. - * @param[in] type The data type of the parameter. - * @param[in] param2 The 2rd parameter to be included in the message. - */ -#define muse_camera_msg_send_array_and_value(api, fd, cb_info, ret, param, length, datum_size, type, param2) \ - do { \ - char *__sndMsg__; \ - int __len__; \ - int *__value__ = (int *)param; \ - type __value2__ = (type)param2; \ - __sndMsg__ = muse_core_msg_json_factory_new(api, \ - MUSE_TYPE_##type, #param2, __value2__, \ - MUSE_TYPE_ARRAY, #param, \ - datum_size == sizeof(int) ? length / sizeof(int) : \ - length / sizeof(int) + (length % sizeof(int) ? 1 : 0), \ - __value__, \ - 0); \ - __len__ = muse_core_ipc_send_msg(fd, __sndMsg__); \ - if (__len__ <= 0) { \ - LOGE("sending message failed"); \ - ret = CAMERA_ERROR_INVALID_OPERATION; \ - } else \ - ret = _client_wait_for_cb_return(api, cb_info, CALLBACK_TIME_OUT); \ - muse_core_msg_json_factory_free(__sndMsg__); \ - } while (0) - -/** * @brief Returning the ack message from the server to client side. * @param[in] api The enumeration of the corresponding api. * @param[in] class The enumeration of the api class. diff --git a/muse/src/muse_camera_dispatcher.c b/muse/src/muse_camera_dispatcher.c index 97ae158..1004f26 100644 --- a/muse/src/muse_camera_dispatcher.c +++ b/muse/src/muse_camera_dispatcher.c @@ -1182,31 +1182,16 @@ int camera_dispatcher_start_capture(muse_module_h module) { int ret = CAMERA_ERROR_NONE; muse_camera_handle_s *muse_camera = NULL; - int is_capturing_cb = 0; - int is_completed_cb = 0; - void *capturing_cb = NULL; - void *completed_cb = NULL; muse_camera_api_e api = MUSE_CAMERA_API_START_CAPTURE; muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module); - muse_camera_msg_get(is_capturing_cb, muse_core_client_get_msg(module)); - muse_camera_msg_get(is_completed_cb, muse_core_client_get_msg(module)); - - LOGD("Enter, handle : %p, module : %p, capturing_cb %d, completed_cb %d", - muse_camera, module, is_capturing_cb, is_completed_cb); - - if (is_capturing_cb) { - capturing_cb = _camera_dispatcher_capturing_cb; - } - if (is_completed_cb) { - completed_cb = _camera_dispatcher_capture_completed_cb; - } + LOGD("Enter, handle : %p, module : %p", muse_camera, module); ret = legacy_camera_start_capture(muse_camera->camera_handle, - (camera_capturing_cb)capturing_cb, - (camera_capture_completed_cb)completed_cb, + (camera_capturing_cb)_camera_dispatcher_capturing_cb, + (camera_capture_completed_cb)_camera_dispatcher_capture_completed_cb, (void *)module); muse_camera_msg_return(api, class, ret, module); @@ -1238,17 +1223,20 @@ int camera_dispatcher_start_continuous_capture(muse_module_h module) { int ret = CAMERA_ERROR_NONE; muse_camera_handle_s *muse_camera = NULL; - int count; - int interval; + int value = 0; + int count = 0; + int interval = 0; muse_camera_api_e api = MUSE_CAMERA_API_START_CONTINUOUS_CAPTURE; muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module); - muse_camera_msg_get(count, muse_core_client_get_msg(module)); - muse_camera_msg_get(interval, muse_core_client_get_msg(module)); + muse_camera_msg_get(value, muse_core_client_get_msg(module)); + + count = value >> 16; + interval = 0x0000ffff & value; - LOGD("Enter, handle : %p, module : %p", muse_camera, module); + LOGD("Enter - count %d, interval %d", count, interval); ret = legacy_camera_start_continuous_capture(muse_camera->camera_handle, count, @@ -1516,17 +1504,20 @@ int camera_dispatcher_set_preview_resolution(muse_module_h module) { int ret = CAMERA_ERROR_NONE; muse_camera_handle_s *muse_camera = NULL; - int width; - int height; + int value = 0; + int width = 0; + int height = 0; muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_RESOLUTION; muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module); - muse_camera_msg_get(width, muse_core_client_get_msg(module)); - muse_camera_msg_get(height, muse_core_client_get_msg(module)); + muse_camera_msg_get(value, muse_core_client_get_msg(module)); + + width = value >> 16; + height = 0x0000ffff & value; - LOGD("handle : 0x%x, set_width : %d, set_height : 0x%x", muse_camera, width, height); + LOGD("0x%x -> %dx%d", value, width, height); ret = legacy_camera_set_preview_resolution(muse_camera->camera_handle, width, height); @@ -1539,15 +1530,18 @@ int camera_dispatcher_set_capture_resolution(muse_module_h module) { int ret = CAMERA_ERROR_NONE; muse_camera_handle_s *muse_camera = NULL; - int width; - int height; + int value = 0; + int width = 0; + int height = 0; muse_camera_api_e api = MUSE_CAMERA_API_SET_CAPTURE_RESOLUTION; muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module); - muse_camera_msg_get(width, muse_core_client_get_msg(module)); - muse_camera_msg_get(height, muse_core_client_get_msg(module)); + muse_camera_msg_get(value, muse_core_client_get_msg(module)); + + width = value >> 16; + height = 0x0000ffff & value; LOGD("handle : 0x%x, set_width : %d, set_height : %d", muse_camera, width, height); @@ -2536,17 +2530,20 @@ int camera_dispatcher_attr_set_af_area(muse_module_h module) { int ret = CAMERA_ERROR_NONE; muse_camera_handle_s *muse_camera = NULL; - int x; - int y; + int value = 0; + int x = 0; + int y = 0; muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_AF_AREA; muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module); - muse_camera_msg_get(x, muse_core_client_get_msg(module)); - muse_camera_msg_get(y, muse_core_client_get_msg(module)); + muse_camera_msg_get(value, muse_core_client_get_msg(module)); + + x = value >> 16; + y = 0x0000ffff & value; - LOGD("handle : %p", muse_camera); + LOGD("AF area - %d, %d", x, y); ret = legacy_camera_attr_set_af_area(muse_camera->camera_handle, x, y); @@ -3564,15 +3561,18 @@ int camera_dispatcher_attr_foreach_supported_fps_by_resolution(muse_module_h mod muse_camera_handle_s *muse_camera = NULL; muse_camera_api_e api = MUSE_CAMERA_API_ATTR_FOREACH_SUPPORTED_FPS_BY_RESOLUTION; muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_THREAD_SUB; - int width; - int height; + int value = 0; + int width = 0; + int height = 0; muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module); - muse_camera_msg_get(width, muse_core_client_get_msg(module)); - muse_camera_msg_get(height, muse_core_client_get_msg(module)); + muse_camera_msg_get(value, muse_core_client_get_msg(module)); - LOGD("handle : %p", muse_camera); + width = value >> 16; + height = 0x0000ffff & value; + + LOGD("handle : %p - %dx%d", muse_camera, width, height); ret = legacy_camera_attr_foreach_supported_fps_by_resolution(muse_camera->camera_handle, width, height, @@ -4139,19 +4139,22 @@ int camera_dispatcher_attr_set_pan(muse_module_h module) { int ret = CAMERA_ERROR_NONE; muse_camera_handle_s *muse_camera = NULL; - int set_move_type = 0; - int set_pan_step = 0; + int value = 0; + int type = 0; + int step = 0; muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_PAN; muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module); - muse_camera_msg_get(set_move_type, muse_core_client_get_msg(module)); - muse_camera_msg_get(set_pan_step, muse_core_client_get_msg(module)); + muse_camera_msg_get(value, muse_core_client_get_msg(module)); - LOGD("handle : 0x%x", muse_camera); + type = value >> 16; + step = 0x0000ffff & value; + + LOGD("handle : 0x%x - type %d, step %d", muse_camera, type, step); - ret = legacy_camera_attr_set_pan(muse_camera->camera_handle, set_move_type, set_pan_step); + ret = legacy_camera_attr_set_pan(muse_camera->camera_handle, type, step); LOGD("ret : 0x%x", ret); @@ -4209,19 +4212,22 @@ int camera_dispatcher_attr_set_tilt(muse_module_h module) { int ret = CAMERA_ERROR_NONE; muse_camera_handle_s *muse_camera = NULL; - int set_move_type = 0; - int set_tilt_step = 0; + int value = 0; + int type = 0; + int step = 0; muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_TILT; muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module); - muse_camera_msg_get(set_move_type, muse_core_client_get_msg(module)); - muse_camera_msg_get(set_tilt_step, muse_core_client_get_msg(module)); + muse_camera_msg_get(value, muse_core_client_get_msg(module)); - LOGD("handle : 0x%x", muse_camera); + type = value >> 16; + step = 0x0000ffff & value; + + LOGD("handle : 0x%x - type %d, step %d", muse_camera, type, step); - ret = legacy_camera_attr_set_tilt(muse_camera->camera_handle, set_move_type, set_tilt_step); + ret = legacy_camera_attr_set_tilt(muse_camera->camera_handle, type, step); LOGD("ret : 0x%x", ret); diff --git a/packaging/mmsvc-camera.spec b/packaging/mmsvc-camera.spec index b838800..bf82de9 100644 --- a/packaging/mmsvc-camera.spec +++ b/packaging/mmsvc-camera.spec @@ -1,6 +1,6 @@ Name: mmsvc-camera Summary: A Camera module for muse server -Version: 0.2.45 +Version: 0.2.46 Release: 0 Group: Multimedia/Libraries License: Apache-2.0 -- 2.7.4 From 63828558000a2a000afd10405be8c7edb2846887 Mon Sep 17 00:00:00 2001 From: Jeongmo Yang Date: Tue, 30 Aug 2016 17:26:24 +0900 Subject: [PATCH 07/16] [Release version 0.2.47] Remove unused macro Change-Id: I4f455ca816a48539d04fd0903b5da7cf0dc0f084 Signed-off-by: Jeongmo Yang --- muse/include/muse_camera.h | 15 --------------- packaging/mmsvc-camera.spec | 2 +- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/muse/include/muse_camera.h b/muse/include/muse_camera.h index 1150a1e..7af4ef0 100644 --- a/muse/include/muse_camera.h +++ b/muse/include/muse_camera.h @@ -267,21 +267,6 @@ typedef enum { */ #define MUSE_CAMERA_MSG_MAX_LENGTH 512 -/** - * @brief Definition for the socket path length of the ipc sink. - */ -#define SOCKET_PATH_LENGTH 32 - -/** - * @brief Definition for the socket path base of the ipc sink. - */ -#define SOCKET_PATH_BASE "/tmp/mused_gst.%d" - -/** - * @brief Definition for the wait time of the ipc callback. - */ -#define CALLBACK_TIME_OUT 5 - #ifdef __cplusplus } diff --git a/packaging/mmsvc-camera.spec b/packaging/mmsvc-camera.spec index bf82de9..049df3b 100644 --- a/packaging/mmsvc-camera.spec +++ b/packaging/mmsvc-camera.spec @@ -1,6 +1,6 @@ Name: mmsvc-camera Summary: A Camera module for muse server -Version: 0.2.46 +Version: 0.2.47 Release: 0 Group: Multimedia/Libraries License: Apache-2.0 -- 2.7.4 From 0b7016184256c71313144c556347662980b48d09 Mon Sep 17 00:00:00 2001 From: Jeongmo Yang Date: Wed, 7 Sep 2016 14:44:59 +0900 Subject: [PATCH 08/16] Fix Svace issue - "new_handle" is compared to NULL after dereferenced [Version] 0.2.48 [Profile] Common [Issue Type] Svace [Dependency module] N/A [Dependency commit] N/A [Test] [M(T) - Boot=(OK), sdb=(OK), Home=(OK), Touch=(OK), Version=tizen-mobile_20160906.1] Change-Id: I88afa599f817715067f15a609529f43fe6063644 Signed-off-by: Jeongmo Yang --- legacy/src/legacy_camera.c | 6 ++---- packaging/mmsvc-camera.spec | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/legacy/src/legacy_camera.c b/legacy/src/legacy_camera.c index d0e356a..cd05235 100644 --- a/legacy/src/legacy_camera.c +++ b/legacy/src/legacy_camera.c @@ -725,10 +725,8 @@ int legacy_camera_change_device(camera_h *camera, camera_device_e device) return CAMERA_ERROR_NONE; _CHANGE_DEVICE_FAILED: - if (new_handle) { - legacy_camera_destroy((camera_h)new_handle); - new_handle = NULL; - } + legacy_camera_destroy((camera_h)new_handle); + new_handle = NULL; if (reuse_element) { mm_camcorder_set_attributes(old_handle->mm_handle, NULL, diff --git a/packaging/mmsvc-camera.spec b/packaging/mmsvc-camera.spec index 049df3b..2c0faa3 100644 --- a/packaging/mmsvc-camera.spec +++ b/packaging/mmsvc-camera.spec @@ -1,6 +1,6 @@ Name: mmsvc-camera Summary: A Camera module for muse server -Version: 0.2.47 +Version: 0.2.48 Release: 0 Group: Multimedia/Libraries License: Apache-2.0 -- 2.7.4 From a34089ab997c91206e824945bfab11f776f8a03a Mon Sep 17 00:00:00 2001 From: Jeongmo Yang Date: Thu, 8 Sep 2016 21:39:30 +0900 Subject: [PATCH 09/16] Add new functions to support new Native APIs Camera device state related APIs will be added. This commit supports them and some unused code is removed. [Version] 0.2.49 [Profile] Common [Issue Type] New function [Dependency module] N/A [Dependency commit] N/A [Test] [M(T) - Boot=(OK), sdb=(OK), Home=(OK), Touch=(OK), Version=] Change-Id: I28f2054a2f6f93639440a433a080190a2957220f Signed-off-by: Jeongmo Yang --- legacy/include/legacy_camera.h | 10 +++ muse/include/muse_camera.h | 9 ++ muse/src/muse_camera_dispatcher.c | 170 +++++++++++++++++++++++--------------- packaging/mmsvc-camera.spec | 2 +- 4 files changed, 124 insertions(+), 67 deletions(-) diff --git a/legacy/include/legacy_camera.h b/legacy/include/legacy_camera.h index 10d0682..9ac1bee 100644 --- a/legacy/include/legacy_camera.h +++ b/legacy/include/legacy_camera.h @@ -73,6 +73,16 @@ typedef enum { } camera_state_e; /** + * @brief Enumeration for the camera device state. + * @since_tizen 3.0 + */ +typedef enum { + CAMERA_DEVICE_STATE_NULL, /**< Not opened */ + CAMERA_DEVICE_STATE_OPENED, /**< Opened */ + CAMERA_DEVICE_STATE_WORKING /**< Now previewing or capturing or is being used for video recording */ +} camera_device_state_e; + +/** * @brief Enumeration for the camera device. * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ diff --git a/muse/include/muse_camera.h b/muse/include/muse_camera.h index 7af4ef0..909bf11 100644 --- a/muse/include/muse_camera.h +++ b/muse/include/muse_camera.h @@ -185,6 +185,8 @@ typedef enum { MUSE_CAMERA_API_SET_DISPLAY_REUSE_HINT, MUSE_CAMERA_API_GET_DISPLAY_REUSE_HINT, MUSE_CAMERA_API_CHANGE_DEVICE, + MUSE_CAMERA_API_GET_DEVICE_STATE, + MUSE_CAMERA_API_MAX } muse_camera_api_e; @@ -267,6 +269,13 @@ typedef enum { */ #define MUSE_CAMERA_MSG_MAX_LENGTH 512 +/** + * @brief Definition for device state change signal + */ +#define MM_CAMCORDER_DBUS_OBJECT "/org/tizen/MMCamcorder" +#define MM_CAMCORDER_DBUS_INTERFACE_CAMERA "org.tizen.MMCamcorder.Camera" +#define MM_CAMCORDER_DBUS_SIGNAL_STATE_CHANGED "DeviceStateChanged" + #ifdef __cplusplus } diff --git a/muse/src/muse_camera_dispatcher.c b/muse/src/muse_camera_dispatcher.c index 1004f26..4d4d8bc 100644 --- a/muse/src/muse_camera_dispatcher.c +++ b/muse/src/muse_camera_dispatcher.c @@ -34,7 +34,7 @@ #undef LOG_TAG #endif #define LOG_TAG "MUSED_CAMERA" -#define KEY_NUM 9527 +#define KEY_LENGTH 24 #define CAMERA_PRIVILEGE_NAME "http://tizen.org/privilege/camera" @@ -566,6 +566,11 @@ main_image_error: void _camera_dispatcher_state_changed_cb(camera_state_e previous, camera_state_e current, bool by_policy, void *user_data) { muse_module_h module = (muse_module_h)user_data; + muse_camera_handle_s *muse_camera = NULL; + camera_device_e device_type = CAMERA_DEVICE_CAMERA0; + char value_key[KEY_LENGTH] = {'\0',}; + int ret = CAMERA_ERROR_NONE; + int set_value = -1; LOGD("Enter - previous %d, current %d, by_policy %d", previous, current, by_policy); @@ -578,6 +583,28 @@ void _camera_dispatcher_state_changed_cb(camera_state_e previous, camera_state_e INT, current, INT, by_policy); + muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module); + if (muse_camera) { + ret = legacy_camera_get_device_type(muse_camera->camera_handle, &device_type); + if (ret != CAMERA_ERROR_NONE) { + LOGE("get device type failed 0x%x", ret); + return; + } + + snprintf(value_key, KEY_LENGTH, "device_state_camera%d", device_type); + if (previous == CAMERA_STATE_CREATED && current == CAMERA_STATE_PREVIEW) + set_value = CAMERA_DEVICE_STATE_WORKING; + else if (previous == CAMERA_STATE_PREVIEW && current == CAMERA_STATE_CREATED) + set_value = CAMERA_DEVICE_STATE_NULL; + + if (set_value != -1) { + LOGD("device state set : %d", set_value); + muse_core_client_set_value(module, value_key, set_value); + } + } else { + LOGW("NULL muse camera handle"); + } + return; } @@ -1037,18 +1064,18 @@ int camera_dispatcher_create(muse_module_h module) return MUSE_CAMERA_ERROR_NONE; } + ret = legacy_camera_set_state_changed_cb(muse_camera->camera_handle, + (camera_state_changed_cb)_camera_dispatcher_state_changed_cb, + (void *)module); + if (ret != CAMERA_ERROR_NONE) { + LOGE("legacy_camera_set_state_changed_cb failed : 0x%x", ret); + goto _CREATE_ERROR; + } + ret = legacy_camera_set_client_pid(muse_camera->camera_handle, pid); if (ret != CAMERA_ERROR_NONE) { LOGE("legacy_camera_set_client_pid failed : 0x%x", ret); - - legacy_camera_destroy(muse_camera->camera_handle); - muse_camera->camera_handle = NULL; - - free(muse_camera); - muse_camera = NULL; - muse_camera_msg_return(api, class, ret, module); - - return MUSE_CAMERA_ERROR_NONE; + goto _CREATE_ERROR; } g_mutex_init(&muse_camera->list_lock); @@ -1062,6 +1089,16 @@ int camera_dispatcher_create(muse_module_h module) muse_camera_msg_return1(api, class, ret, module, POINTER, handle); return MUSE_CAMERA_ERROR_NONE; + +_CREATE_ERROR: + legacy_camera_destroy(muse_camera->camera_handle); + muse_camera->camera_handle = NULL; + + free(muse_camera); + muse_camera = NULL; + muse_camera_msg_return(api, class, ret, module); + + return MUSE_CAMERA_ERROR_NONE; } @@ -1123,39 +1160,14 @@ int camera_dispatcher_start_preview(muse_module_h module) muse_camera_handle_s *muse_camera = NULL; muse_camera_api_e api = MUSE_CAMERA_API_START_PREVIEW; muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; - char *caps = NULL; - camera_state_e prev_state = CAMERA_STATE_NONE; muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module); LOGD("handle : %p", muse_camera); - legacy_camera_get_state(muse_camera->camera_handle, &prev_state); - ret = legacy_camera_start_preview(muse_camera->camera_handle); - if (ret != CAMERA_ERROR_NONE) { - LOGD("start preview failed 0x%x", ret); - muse_camera_msg_return(api, class, ret, module); - return MUSE_CAMERA_ERROR_NONE; - } - if (prev_state == CAMERA_STATE_CREATED) { - ret = legacy_camera_get_video_caps(muse_camera->camera_handle, &caps); - if (ret == CAMERA_ERROR_NONE && caps) { - LOGD("caps : %s", caps); - muse_camera_msg_return2(api, class, ret, module, STRING, caps, INT, prev_state); - g_free(caps); - } else { - LOGD("Failed to get server's video caps. ret 0x%x, caps %p", ret, caps); - muse_camera_msg_return(api, class, ret, module); - if (legacy_camera_stop_preview(muse_camera->camera_handle) != CAMERA_ERROR_NONE) { - LOGW("failed to stop preview"); - } - } - } else { - LOGD("preview started after capture"); - muse_camera_msg_return1(api, class, ret, module, INT, prev_state); - } + muse_camera_msg_return(api, class, ret, module); return MUSE_CAMERA_ERROR_NONE; } @@ -1884,6 +1896,7 @@ int camera_dispatcher_get_flash_state(muse_module_h module) { int ret = CAMERA_ERROR_NONE; int count = 0; + char value_key[KEY_LENGTH] = {'\0',}; camera_h camera = NULL; camera_device_e device_type = CAMERA_DEVICE_CAMERA0; camera_flash_state_e get_flash_state = CAMERA_FLASH_STATE_NOT_USED; @@ -1893,7 +1906,7 @@ int camera_dispatcher_get_flash_state(muse_module_h module) muse_camera_msg_get(device_type, muse_core_client_get_msg(module)); if (device_type < CAMERA_DEVICE_CAMERA0 || device_type > CAMERA_DEVICE_CAMERA1) { - LOGE("invalid device type %d", device_type); + LOGE("invalid device %d", device_type); ret = CAMERA_ERROR_INVALID_PARAMETER; muse_camera_msg_return(api, class, ret, module); @@ -1926,12 +1939,10 @@ int camera_dispatcher_get_flash_state(muse_module_h module) return MUSE_CAMERA_ERROR_NONE; } - if (device_type == CAMERA_DEVICE_CAMERA0) - muse_core_client_get_value(module, "flash_state_camera0", (int *)&get_flash_state); - else - muse_core_client_get_value(module, "flash_state_camera1", (int *)&get_flash_state); + snprintf(value_key, KEY_LENGTH, "flash_state_camera%d", device_type); + muse_core_client_get_value(module, value_key, (int *)&get_flash_state); - LOGD("fash state : %d", get_flash_state); + LOGD("[%d] flash state : %d", device_type, get_flash_state); muse_camera_msg_return1(api, class, ret, module, INT, get_flash_state); @@ -2032,19 +2043,10 @@ int camera_dispatcher_unset_media_packet_preview_cb(muse_module_h module) int camera_dispatcher_set_state_changed_cb(muse_module_h module) { int ret = CAMERA_ERROR_NONE; - muse_camera_handle_s *muse_camera = NULL; muse_camera_api_e api = MUSE_CAMERA_API_SET_STATE_CHANGED_CB; muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; - muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module); - - LOGD("handle : %p", muse_camera); - - ret = legacy_camera_set_state_changed_cb(muse_camera->camera_handle, - (camera_state_changed_cb)_camera_dispatcher_state_changed_cb, - (void *)module); - - LOGD("ret : 0x%x", ret); + LOGD("Enter"); muse_camera_msg_return(api, class, ret, module); @@ -2054,17 +2056,10 @@ int camera_dispatcher_set_state_changed_cb(muse_module_h module) int camera_dispatcher_unset_state_changed_cb(muse_module_h module) { int ret = CAMERA_ERROR_NONE; - muse_camera_handle_s *muse_camera = NULL; muse_camera_api_e api = MUSE_CAMERA_API_UNSET_STATE_CHANGED_CB; muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; - muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module); - - LOGD("handle : %p", muse_camera); - - ret = legacy_camera_unset_state_changed_cb(muse_camera->camera_handle); - - LOGD("ret : 0x%x", ret); + LOGD("Enter"); muse_camera_msg_return(api, class, ret, module); @@ -2897,8 +2892,9 @@ int camera_dispatcher_attr_remove_geotag(muse_module_h module) int camera_dispatcher_attr_set_flash_mode(muse_module_h module) { int ret = CAMERA_ERROR_NONE; - muse_camera_handle_s *muse_camera = NULL; int set_mode = 0;; + char value_key[KEY_LENGTH] = {'\0',}; + muse_camera_handle_s *muse_camera = NULL; camera_device_e device_type = CAMERA_DEVICE_CAMERA0; muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_FLASH_MODE; muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; @@ -2913,10 +2909,8 @@ int camera_dispatcher_attr_set_flash_mode(muse_module_h module) if (ret == CAMERA_ERROR_NONE) { ret = legacy_camera_get_device_type(muse_camera->camera_handle, &device_type); if (ret == CAMERA_ERROR_NONE) { - if (device_type == CAMERA_DEVICE_CAMERA0) - muse_core_client_set_value(module, "flash_state_camera0", set_mode > 0 ? 1 : 0); - else - muse_core_client_set_value(module, "flash_state_camera1", set_mode > 0 ? 1 : 0); + snprintf(value_key, KEY_LENGTH, "flash_state_camera%d", device_type); + muse_core_client_set_value(module, value_key, set_mode > 0 ? 1 : 0); } } @@ -4456,6 +4450,49 @@ int camera_dispatcher_get_display_reuse_hint(muse_module_h module) return MUSE_CAMERA_ERROR_NONE; } +int camera_dispatcher_get_device_state(muse_module_h module) +{ + int ret = CAMERA_ERROR_NONE; + char value_key[KEY_LENGTH] = {'\0',}; + camera_h camera = NULL; + camera_device_e device_type = CAMERA_DEVICE_CAMERA0; + camera_device_state_e get_device_state = CAMERA_DEVICE_STATE_NULL; + muse_camera_api_e api = MUSE_CAMERA_API_GET_DEVICE_STATE; + muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; + + muse_camera_msg_get(device_type, muse_core_client_get_msg(module)); + + if (device_type < CAMERA_DEVICE_CAMERA0 || device_type > CAMERA_DEVICE_CAMERA1) { + LOGE("invalid device %d", device_type); + + ret = CAMERA_ERROR_INVALID_PARAMETER; + muse_camera_msg_return(api, class, ret, module); + + return MUSE_CAMERA_ERROR_NONE; + } + + ret = legacy_camera_create(device_type, &camera); + if (ret != CAMERA_ERROR_NONE) { + LOGE("failed to create camera handle 0x%x", ret); + + muse_camera_msg_return(api, class, ret, module); + + return MUSE_CAMERA_ERROR_NONE; + } + + legacy_camera_destroy(camera); + camera = NULL; + + snprintf(value_key, KEY_LENGTH, "device_state_camera%d", device_type); + muse_core_client_get_value(module, value_key, (int *)&get_device_state); + + LOGD("device[%d] state : %d", device_type, get_device_state); + + muse_camera_msg_return1(api, class, ret, module, INT, get_device_state); + + return MUSE_CAMERA_ERROR_NONE; +} + int (*dispatcher[MUSE_CAMERA_API_MAX]) (muse_module_h module) = { camera_dispatcher_create, /* MUSE_CAMERA_API_CREATE */ camera_dispatcher_destroy, /* MUSE_CAMERA_API_DESTROY */ @@ -4605,7 +4642,8 @@ int (*dispatcher[MUSE_CAMERA_API_MAX]) (muse_module_h module) = { camera_dispatcher_preview_cb_return, /* MUSE_CAMERA_API_PREVIEW_CB_RETURN */ camera_dispatcher_set_display_reuse_hint, /* MUSE_CAMERA_API_SET_DISPLAY_REUSE_HINT */ camera_dispatcher_get_display_reuse_hint, /* MUSE_CAMERA_API_GET_DISPLAY_REUSE_HINT */ - camera_dispatcher_change_device /* MUSE_CAMERA_API_CHANGE_DEVICE */ + camera_dispatcher_change_device, /* MUSE_CAMERA_API_CHANGE_DEVICE */ + camera_dispatcher_get_device_state /* MUSE_CAMERA_API_GET_DEVICE_STATE */ }; diff --git a/packaging/mmsvc-camera.spec b/packaging/mmsvc-camera.spec index 2c0faa3..12339df 100644 --- a/packaging/mmsvc-camera.spec +++ b/packaging/mmsvc-camera.spec @@ -1,6 +1,6 @@ Name: mmsvc-camera Summary: A Camera module for muse server -Version: 0.2.48 +Version: 0.2.49 Release: 0 Group: Multimedia/Libraries License: Apache-2.0 -- 2.7.4 From 749124d0f88a56a790eb6bc1af3283098228f643 Mon Sep 17 00:00:00 2001 From: Jeongmo Yang Date: Wed, 21 Sep 2016 17:44:28 +0900 Subject: [PATCH 10/16] Change calling thread from sub to main for capture callback [Version] 0.2.50 [Profile] Common [Issue Type] Update Change-Id: I3d3b05e03edb061b97040bd89f343ed3a668c599 Signed-off-by: Jeongmo Yang --- muse/src/muse_camera_dispatcher.c | 37 +++++++++++++++++++------------------ packaging/mmsvc-camera.spec | 2 +- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/muse/src/muse_camera_dispatcher.c b/muse/src/muse_camera_dispatcher.c index 4d4d8bc..546c8f0 100644 --- a/muse/src/muse_camera_dispatcher.c +++ b/muse/src/muse_camera_dispatcher.c @@ -519,7 +519,7 @@ void _camera_dispatcher_capturing_cb(camera_image_data_s* image, camera_image_da /* send message */ muse_camera_msg_event3(MUSE_CAMERA_CB_EVENT, MUSE_CAMERA_EVENT_TYPE_CAPTURE, - MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, + MUSE_CAMERA_EVENT_CLASS_THREAD_MAIN, module, INT, tbm_key_main, INT, tbm_key_post, @@ -584,25 +584,26 @@ void _camera_dispatcher_state_changed_cb(camera_state_e previous, camera_state_e INT, by_policy); muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module); - if (muse_camera) { - ret = legacy_camera_get_device_type(muse_camera->camera_handle, &device_type); - if (ret != CAMERA_ERROR_NONE) { - LOGE("get device type failed 0x%x", ret); - return; - } + if (!muse_camera) { + LOGW("NULL muse camera handle"); + return; + } - snprintf(value_key, KEY_LENGTH, "device_state_camera%d", device_type); - if (previous == CAMERA_STATE_CREATED && current == CAMERA_STATE_PREVIEW) - set_value = CAMERA_DEVICE_STATE_WORKING; - else if (previous == CAMERA_STATE_PREVIEW && current == CAMERA_STATE_CREATED) - set_value = CAMERA_DEVICE_STATE_NULL; + ret = legacy_camera_get_device_type(muse_camera->camera_handle, &device_type); + if (ret != CAMERA_ERROR_NONE) { + LOGE("get device type failed 0x%x", ret); + return; + } - if (set_value != -1) { - LOGD("device state set : %d", set_value); - muse_core_client_set_value(module, value_key, set_value); - } - } else { - LOGW("NULL muse camera handle"); + snprintf(value_key, KEY_LENGTH, "device_state_camera%d", device_type); + if (previous == CAMERA_STATE_CREATED && current == CAMERA_STATE_PREVIEW) + set_value = CAMERA_DEVICE_STATE_WORKING; + else if (previous == CAMERA_STATE_PREVIEW && current == CAMERA_STATE_CREATED) + set_value = CAMERA_DEVICE_STATE_NULL; + + if (set_value != -1) { + LOGD("device[%s] state set : %d", value_key, set_value); + muse_core_client_set_value(module, value_key, set_value); } return; diff --git a/packaging/mmsvc-camera.spec b/packaging/mmsvc-camera.spec index 12339df..92e8f72 100644 --- a/packaging/mmsvc-camera.spec +++ b/packaging/mmsvc-camera.spec @@ -1,6 +1,6 @@ Name: mmsvc-camera Summary: A Camera module for muse server -Version: 0.2.49 +Version: 0.2.50 Release: 0 Group: Multimedia/Libraries License: Apache-2.0 -- 2.7.4 From d557d62a0e1237e775603e0a4dc768fb13546f23 Mon Sep 17 00:00:00 2001 From: Jeongmo Yang Date: Mon, 10 Oct 2016 18:13:18 +0900 Subject: [PATCH 11/16] Update code for device state APIs 1. Add code to emit signal for device state change 2. Remove unused code [Version] 0.2.51 [Profile] Common [Issue Type] Update [Dependency module] libmm-camcorder [Dependency commit] 6012f7ec5032f940e8446a7aec9a9ee001ba05c6 [Test] [M(T) - Boot=(OK), sdb=(OK), Home=(OK), Touch=(OK), Version=tizen-mobile_20161007.1] Change-Id: I5f6f22d99abe564df1354c34555152ec98559668 Signed-off-by: Jeongmo Yang --- legacy/include/legacy_camera_internal.h | 29 ++++++++++---------------- legacy/src/legacy_camera.c | 37 ++++++++++++++++++++++++++++++++- legacy/src/legacy_camera_internal.c | 29 +++++++++++++++----------- packaging/mmsvc-camera.spec | 2 +- 4 files changed, 65 insertions(+), 32 deletions(-) diff --git a/legacy/include/legacy_camera_internal.h b/legacy/include/legacy_camera_internal.h index bdd6dbb..ccfb764 100644 --- a/legacy/include/legacy_camera_internal.h +++ b/legacy/include/legacy_camera_internal.h @@ -24,15 +24,14 @@ extern "C" { /** * @file camera_internal.h - * @brief This file contains the Camera Product-internal API for framework, related structures and enumerations. + * @brief This file contains the Camera internal API for framework, related structures and enumerations. */ /** - * @brief Registers a callback function to be invoked when camera needs updated xid. + * @brief Set pid of client for sound focus API. * @ingroup CAPI_MEDIA_CAMERA_MUSED_MODULE - * @remarks This function is valid only for #CAMERA_DISPLAY_TYPE_OVERLAY. * @param[in] camera The handle to the camera - * @param[in] caps The caps information of the server's video element + * @param[in] pid The pid of client * * @return @c 0 on success, otherwise a negative error value * @retval #CAMERA_ERROR_NONE Successful @@ -40,26 +39,20 @@ extern "C" { * @retval #CAMERA_ERROR_INVALID_OPERATION Invalid operation * @retval #CAMERA_ERROR_INVALID_STATE Invalid state * @pre The camera state must be #CAMERA_STATE_CREATED by camera_create(). - * @post camera_get_video_caps() will be invoked. - * - * @see camera_get_video_caps() */ -int legacy_camera_get_video_caps(camera_h camera, char **caps); +int legacy_camera_set_client_pid(camera_h camera, int pid); /** - * @brief Set pid of client for sound focus API. + * @brief Emit signal to notify some information. * @ingroup CAPI_MEDIA_CAMERA_MUSED_MODULE * @param[in] camera The handle to the camera - * @param[in] pid The pid of client - * - * @return @c 0 on success, otherwise a negative error value - * @retval #CAMERA_ERROR_NONE Successful - * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #CAMERA_ERROR_INVALID_OPERATION Invalid operation - * @retval #CAMERA_ERROR_INVALID_STATE Invalid state - * @pre The camera state must be #CAMERA_STATE_CREATED by camera_create(). + * @param[in] object_name The name of signal object + * @param[in] interface_name The name of signal interface + * @param[in] signal_name The name of signal + * @param[in] value The value of signal to emit */ -int legacy_camera_set_client_pid(camera_h camera, int pid); +void legacy_camera_emit_signal(camera_h camera, const char *object_name, + const char *interface_name, const char *signal_name, int value); #ifdef __cplusplus diff --git a/legacy/src/legacy_camera.c b/legacy/src/legacy_camera.c index cd05235..eb696dd 100644 --- a/legacy/src/legacy_camera.c +++ b/legacy/src/legacy_camera.c @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include #include @@ -37,6 +37,13 @@ #endif #define LOG_TAG "LEGACY_CAMERA" +/** + * @brief Definition for device state change signal + */ +#define MM_CAMCORDER_DBUS_OBJECT "/org/tizen/MMCamcorder" +#define MM_CAMCORDER_DBUS_INTERFACE_CAMERA "org.tizen.MMCamcorder.Camera" +#define MM_CAMCORDER_DBUS_SIGNAL_STATE_CHANGED "DeviceStateChanged" + static gboolean __mm_videostream_callback(MMCamcorderVideoStreamDataType *stream, void *user_data); static gboolean __mm_capture_callback(MMCamcorderCaptureDataType *frame, MMCamcorderCaptureDataType *thumbnail, void *user_data); @@ -301,6 +308,10 @@ static int __mm_camera_message_callback(int message, void *param, void *user_dat case MM_MESSAGE_CAMCORDER_STATE_CHANGED_BY_ASM: case MM_MESSAGE_CAMCORDER_STATE_CHANGED_BY_SECURITY: case MM_MESSAGE_CAMCORDER_STATE_CHANGED_BY_RM: + { + int emit_value = 0; + int device_state = -1; + if (message == MM_MESSAGE_CAMCORDER_STATE_CHANGED && (m->state.previous < MM_CAMCORDER_STATE_NONE || m->state.previous > MM_CAMCORDER_STATE_PAUSED || @@ -309,6 +320,7 @@ static int __mm_camera_message_callback(int message, void *param, void *user_dat break; } + /* check policy */ if (message == MM_MESSAGE_CAMCORDER_STATE_CHANGED_BY_ASM) { switch (m->state.code) { case MM_MSG_CODE_INTERRUPTED_BY_CALL_START: @@ -353,6 +365,28 @@ static int __mm_camera_message_callback(int message, void *param, void *user_dat handle->state, policy, handle->user_data[_CAMERA_EVENT_TYPE_STATE_CHANGE]); } + /* emit signal for camera device state */ + if (m->state.previous == MM_CAMCORDER_STATE_READY && m->state.current == MM_CAMCORDER_STATE_NULL) + device_state = CAMERA_DEVICE_STATE_NULL; + else if ((m->state.previous == MM_CAMCORDER_STATE_NULL && m->state.current == MM_CAMCORDER_STATE_READY) || + (m->state.previous == MM_CAMCORDER_STATE_PREPARE && m->state.current == MM_CAMCORDER_STATE_READY)) + device_state = CAMERA_DEVICE_STATE_OPENED; + else if (m->state.previous == MM_CAMCORDER_STATE_READY && + m->state.current == MM_CAMCORDER_STATE_PREPARE) + device_state = CAMERA_DEVICE_STATE_WORKING; + + if (device_state != -1) { + emit_value = handle->device_type << 16 | device_state; + + LOGD("camera devce state change signal [0x8x]", emit_value); + + legacy_camera_emit_signal((camera_h)handle, + MM_CAMCORDER_DBUS_OBJECT, + MM_CAMCORDER_DBUS_INTERFACE_CAMERA, + MM_CAMCORDER_DBUS_SIGNAL_STATE_CHANGED, + emit_value); + } + /* should change intermediate state MM_CAMCORDER_STATE_READY is not valid in capi , change to NULL state */ if (policy != CAMERA_POLICY_NONE && m->state.current == MM_CAMCORDER_STATE_NULL) { if (handle->user_cb[_CAMERA_EVENT_TYPE_INTERRUPTED]) { @@ -363,6 +397,7 @@ static int __mm_camera_message_callback(int message, void *param, void *user_dat } } break; + } case MM_MESSAGE_CAMCORDER_FOCUS_CHANGED: if (handle->user_cb[_CAMERA_EVENT_TYPE_FOCUS_CHANGE]) { ((camera_focus_changed_cb)handle->user_cb[_CAMERA_EVENT_TYPE_FOCUS_CHANGE])(m->code, diff --git a/legacy/src/legacy_camera_internal.c b/legacy/src/legacy_camera_internal.c index 1fa52d8..986336b 100644 --- a/legacy/src/legacy_camera_internal.c +++ b/legacy/src/legacy_camera_internal.c @@ -33,18 +33,6 @@ #define LOG_TAG "LEGACY_CAMERA" -int legacy_camera_get_video_caps(camera_h camera, char **caps) -{ - int ret; - camera_s *handle = (camera_s *)camera; - - ret = mm_camcorder_get_video_caps(handle->mm_handle, caps); - if (ret != MM_ERROR_NONE) - return __convert_camera_error_code(__func__, ret); - - return CAMERA_ERROR_NONE; -} - int legacy_camera_set_client_pid(camera_h camera, int pid) { int ret; @@ -63,3 +51,20 @@ int legacy_camera_set_client_pid(camera_h camera, int pid) return __convert_camera_error_code(__func__, ret); } + + +void legacy_camera_emit_signal(camera_h camera, const char *object_name, + const char *interface_name, const char *signal_name, int value) +{ + camera_s *handle = (camera_s *)camera; + + if (!handle) { + LOGE("NULL handle"); + return; + } + + mm_camcorder_emit_signal(handle->mm_handle, + object_name, interface_name, signal_name, value); + + return; +} diff --git a/packaging/mmsvc-camera.spec b/packaging/mmsvc-camera.spec index 92e8f72..fc96504 100644 --- a/packaging/mmsvc-camera.spec +++ b/packaging/mmsvc-camera.spec @@ -1,6 +1,6 @@ Name: mmsvc-camera Summary: A Camera module for muse server -Version: 0.2.50 +Version: 0.2.51 Release: 0 Group: Multimedia/Libraries License: Apache-2.0 -- 2.7.4 From 00300ad35a43ff14c6445298d684b662019b758f Mon Sep 17 00:00:00 2001 From: Jeongmo Yang Date: Tue, 11 Oct 2016 20:19:19 +0900 Subject: [PATCH 12/16] Change event class from THREAD_MAIN to THREAD_SUB for capture callback THREAD_MAIN event class is workaround code for TBT test. It's rollbacked because this commit will make capture callback as syncronously, then TBT capture issue could not be occurred. (capture completed callback can be called although capture callback is not returned.) [Version] 0.2.52 [Profile] Common [Issue Type] Update [Dependency module] N/A [Dependency commit] N/A [Test] [M(T) - Boot=(OK), sdb=(OK), Home=(OK), Touch=(OK), Version=tizen-mobile_20161007.1] Change-Id: I6430ccca7c8acf7a2f9b7333f9dc440a8de844ea Signed-off-by: Jeongmo Yang --- muse/include/muse_camera.h | 1 + muse/include/muse_camera_internal.h | 1 + muse/src/muse_camera_dispatcher.c | 221 +++++++++++++++++++----------------- packaging/mmsvc-camera.spec | 2 +- 4 files changed, 122 insertions(+), 103 deletions(-) diff --git a/muse/include/muse_camera.h b/muse/include/muse_camera.h index 909bf11..c420d31 100644 --- a/muse/include/muse_camera.h +++ b/muse/include/muse_camera.h @@ -248,6 +248,7 @@ typedef struct { int key; void *internal_buffer; tbm_bo data_bo; + bool is_capture; } muse_camera_export_data; diff --git a/muse/include/muse_camera_internal.h b/muse/include/muse_camera_internal.h index 1637990..6c92e98 100644 --- a/muse/include/muse_camera_internal.h +++ b/muse/include/muse_camera_internal.h @@ -41,6 +41,7 @@ typedef struct { tbm_bufmgr bufmgr; GList *data_list; GMutex list_lock; + GCond list_cond; GMutex preview_cb_lock; GCond preview_cb_cond; guint preview_cb_flag; diff --git a/muse/src/muse_camera_dispatcher.c b/muse/src/muse_camera_dispatcher.c index 546c8f0..f490120 100644 --- a/muse/src/muse_camera_dispatcher.c +++ b/muse/src/muse_camera_dispatcher.c @@ -305,6 +305,11 @@ static int _camera_remove_export_data(muse_module_h module, int key, int remove_ if (export_data->key == key || remove_all) { /*LOGD("key %d matched, remove it (remove_all %d)", key, remove_all);*/ + if (export_data->is_capture) { + LOGD("capture callback is done"); + g_cond_signal(&muse_camera->list_cond); + } + if (export_data->bo) { tbm_bo_unref(export_data->bo); export_data->bo = NULL; @@ -373,158 +378,168 @@ void _camera_dispatcher_capturing_cb(camera_image_data_s* image, camera_image_da int tbm_key_thumb = 0; muse_module_h module = (muse_module_h)user_data; unsigned char *buf_pos = NULL; + gint64 end_time = 0; LOGD("Enter!!"); muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module); - if (muse_camera == NULL) { - LOGE("NULL handle"); + if (!muse_camera || !image || image->size <= 0) { + LOGE("invalid ptr %p %p or size %d", muse_camera, image, image->size); return; } + /* main image */ export_data_main = g_new0(muse_camera_export_data, 1); if (export_data_main == NULL) { LOGE("alloc export_data failed"); return; } - if (image != NULL) { - if (image->size > 0) { - data_size_main = sizeof(camera_image_data_s) + image->size; + data_size_main = sizeof(camera_image_data_s) + image->size; - /* alloc bo */ - bo_main = tbm_bo_alloc(muse_camera->bufmgr, data_size_main, TBM_BO_DEFAULT); - if (bo_main == NULL) { - LOGE("bo alloc failed"); - goto main_image_error; - } - - bo_main_handle = tbm_bo_map(bo_main, TBM_DEVICE_CPU, TBM_OPTION_READ | TBM_OPTION_WRITE); - if (bo_main_handle.ptr == NULL) { - LOGE("bo map Error!"); - goto main_image_error; - } + /* alloc bo */ + bo_main = tbm_bo_alloc(muse_camera->bufmgr, data_size_main, TBM_BO_DEFAULT); + if (bo_main == NULL) { + LOGE("bo alloc failed"); + goto main_image_error; + } - buf_pos = (unsigned char *)bo_main_handle.ptr; - memcpy(buf_pos, image, sizeof(camera_image_data_s)); - buf_pos += sizeof(camera_image_data_s); - memcpy(buf_pos, image->data, image->size); - tbm_bo_unmap(bo_main); + bo_main_handle = tbm_bo_map(bo_main, TBM_DEVICE_CPU, TBM_OPTION_READ | TBM_OPTION_WRITE); + if (bo_main_handle.ptr == NULL) { + LOGE("bo map Error!"); + goto main_image_error; + } - tbm_key_main = tbm_bo_export(bo_main); - if (tbm_key_main == 0) { - LOGE("Create key_info ERROR!!"); - goto main_image_error; - } - LOGD("bo %p, vaddr %p, size %d, key %d", - bo_main, bo_main_handle.ptr, data_size_main, tbm_key_main); + buf_pos = (unsigned char *)bo_main_handle.ptr; + memcpy(buf_pos, image, sizeof(camera_image_data_s)); + buf_pos += sizeof(camera_image_data_s); + memcpy(buf_pos, image->data, image->size); + tbm_bo_unmap(bo_main); - /* set bo info */ - export_data_main->key = tbm_key_main; - export_data_main->bo = bo_main; - } + tbm_key_main = tbm_bo_export(bo_main); + if (tbm_key_main == 0) { + LOGE("Create key_info ERROR!!"); + goto main_image_error; } - if (postview != NULL) { - if (postview->size > 0) { - data_size_post = sizeof(camera_image_data_s) + postview->size; + LOGD("bo %p, vaddr %p, size %d, key %d", + bo_main, bo_main_handle.ptr, data_size_main, tbm_key_main); - export_data_post = g_new0(muse_camera_export_data, 1); - if (export_data_post == NULL) { - LOGE("alloc export_data failed"); - goto postview_image_error; - } + /* set bo info */ + export_data_main->key = tbm_key_main; + export_data_main->bo = bo_main; + export_data_main->is_capture = true; - /* alloc bo */ - bo_post = tbm_bo_alloc(muse_camera->bufmgr, data_size_post, TBM_BO_DEFAULT); - if (bo_post == NULL) { - LOGE("bo alloc failed"); - goto postview_image_error; - } + /* postview image */ + if (postview && postview->size > 0) { + data_size_post = sizeof(camera_image_data_s) + postview->size; - bo_post_handle = tbm_bo_map(bo_post, TBM_DEVICE_CPU, TBM_OPTION_READ | TBM_OPTION_WRITE); - if (bo_post_handle.ptr == NULL) { - LOGE("bo map Error!"); - goto postview_image_error; - } + export_data_post = g_new0(muse_camera_export_data, 1); + if (export_data_post == NULL) { + LOGE("alloc export_data failed"); + goto postview_image_error; + } - buf_pos = (unsigned char *)bo_post_handle.ptr; - memcpy(buf_pos, postview, sizeof(camera_image_data_s)); - buf_pos += sizeof(camera_image_data_s); - memcpy(buf_pos, postview->data, postview->size); - tbm_bo_unmap(bo_post); + /* alloc bo */ + bo_post = tbm_bo_alloc(muse_camera->bufmgr, data_size_post, TBM_BO_DEFAULT); + if (bo_post == NULL) { + LOGE("bo alloc failed"); + goto postview_image_error; + } - tbm_key_post = tbm_bo_export(bo_post); - if (tbm_key_post == 0) { - LOGE("Create key_info ERROR!!"); - goto postview_image_error; - } + bo_post_handle = tbm_bo_map(bo_post, TBM_DEVICE_CPU, TBM_OPTION_READ | TBM_OPTION_WRITE); + if (bo_post_handle.ptr == NULL) { + LOGE("bo map Error!"); + goto postview_image_error; + } - /* set bo info */ - export_data_post->key = tbm_key_post; - export_data_post->bo = bo_post; + buf_pos = (unsigned char *)bo_post_handle.ptr; + memcpy(buf_pos, postview, sizeof(camera_image_data_s)); + buf_pos += sizeof(camera_image_data_s); + memcpy(buf_pos, postview->data, postview->size); + tbm_bo_unmap(bo_post); + + tbm_key_post = tbm_bo_export(bo_post); + if (tbm_key_post == 0) { + LOGE("Create key_info ERROR!!"); + goto postview_image_error; } - } - if (thumbnail != NULL) { - if (thumbnail->size > 0) { - data_size_thumb = sizeof(camera_image_data_s) + thumbnail->size; + /* set bo info */ + export_data_post->key = tbm_key_post; + export_data_post->bo = bo_post; + } - export_data_thumb = g_new0(muse_camera_export_data, 1); - if (export_data_thumb == NULL) { - LOGE("alloc export_data failed"); - goto thumbnail_image_error; - } + /* thumbnail image */ + if (thumbnail && thumbnail->size > 0) { + data_size_thumb = sizeof(camera_image_data_s) + thumbnail->size; - /* alloc bo */ - bo_thumb = tbm_bo_alloc(muse_camera->bufmgr, data_size_thumb, TBM_BO_DEFAULT); - if (bo_thumb == NULL) { - LOGE("bo alloc failed"); - goto thumbnail_image_error; - } + export_data_thumb = g_new0(muse_camera_export_data, 1); + if (export_data_thumb == NULL) { + LOGE("alloc export_data failed"); + goto thumbnail_image_error; + } - bo_thumb_handle = tbm_bo_map(bo_thumb, TBM_DEVICE_CPU, TBM_OPTION_READ | TBM_OPTION_WRITE); - if (bo_thumb_handle.ptr == NULL) { - LOGE("bo map Error!"); - goto thumbnail_image_error; - } + /* alloc bo */ + bo_thumb = tbm_bo_alloc(muse_camera->bufmgr, data_size_thumb, TBM_BO_DEFAULT); + if (bo_thumb == NULL) { + LOGE("bo alloc failed"); + goto thumbnail_image_error; + } - buf_pos = (unsigned char *)bo_thumb_handle.ptr; - memcpy(buf_pos, thumbnail, sizeof(camera_image_data_s)); - buf_pos += sizeof(camera_image_data_s); - memcpy(buf_pos, thumbnail->data, thumbnail->size); - tbm_bo_unmap(bo_thumb); + bo_thumb_handle = tbm_bo_map(bo_thumb, TBM_DEVICE_CPU, TBM_OPTION_READ | TBM_OPTION_WRITE); + if (bo_thumb_handle.ptr == NULL) { + LOGE("bo map Error!"); + goto thumbnail_image_error; + } - tbm_key_thumb = tbm_bo_export(bo_thumb); - if (tbm_key_thumb == 0) { - LOGE("Create key_info ERROR!!"); - goto thumbnail_image_error; - } + buf_pos = (unsigned char *)bo_thumb_handle.ptr; + memcpy(buf_pos, thumbnail, sizeof(camera_image_data_s)); + buf_pos += sizeof(camera_image_data_s); + memcpy(buf_pos, thumbnail->data, thumbnail->size); + tbm_bo_unmap(bo_thumb); - /* set bo info */ - export_data_thumb->key = tbm_key_thumb; - export_data_thumb->bo = bo_thumb; + tbm_key_thumb = tbm_bo_export(bo_thumb); + if (tbm_key_thumb == 0) { + LOGE("Create key_info ERROR!!"); + goto thumbnail_image_error; } + + /* set bo info */ + export_data_thumb->key = tbm_key_thumb; + export_data_thumb->bo = bo_thumb; } /* add bo info to list */ g_mutex_lock(&muse_camera->list_lock); + muse_camera->data_list = g_list_append(muse_camera->data_list, (gpointer)export_data_main); - if (export_data_post != NULL) + + if (export_data_post) muse_camera->data_list = g_list_append(muse_camera->data_list, (gpointer)export_data_post); - if (export_data_thumb != NULL) + + if (export_data_thumb) muse_camera->data_list = g_list_append(muse_camera->data_list, (gpointer)export_data_thumb); - g_mutex_unlock(&muse_camera->list_lock); /* send message */ muse_camera_msg_event3(MUSE_CAMERA_CB_EVENT, MUSE_CAMERA_EVENT_TYPE_CAPTURE, - MUSE_CAMERA_EVENT_CLASS_THREAD_MAIN, + MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, module, INT, tbm_key_main, INT, tbm_key_post, INT, tbm_key_thumb); + /* wait for capture callback return */ + end_time = g_get_monotonic_time() + G_TIME_SPAN_SECOND * 3; + if (!g_cond_wait_until(&muse_camera->list_cond, &muse_camera->list_lock, end_time)) { + LOGW("capture callback return timeout"); + } else { + LOGD("capture callback return"); + } + + g_mutex_unlock(&muse_camera->list_lock); + return; thumbnail_image_error: @@ -1080,6 +1095,7 @@ int camera_dispatcher_create(muse_module_h module) } g_mutex_init(&muse_camera->list_lock); + g_cond_init(&muse_camera->list_cond); g_mutex_init(&muse_camera->preview_cb_lock); g_cond_init(&muse_camera->preview_cb_cond); muse_camera->preview_cb_flag = 0; @@ -1141,6 +1157,7 @@ int camera_dispatcher_destroy(muse_module_h module) _camera_remove_export_data(module, 0, TRUE); g_mutex_clear(&muse_camera->list_lock); + g_cond_clear(&muse_camera->list_cond); g_mutex_clear(&muse_camera->preview_cb_lock); g_cond_clear(&muse_camera->preview_cb_cond); diff --git a/packaging/mmsvc-camera.spec b/packaging/mmsvc-camera.spec index fc96504..462891d 100644 --- a/packaging/mmsvc-camera.spec +++ b/packaging/mmsvc-camera.spec @@ -1,6 +1,6 @@ Name: mmsvc-camera Summary: A Camera module for muse server -Version: 0.2.51 +Version: 0.2.52 Release: 0 Group: Multimedia/Libraries License: Apache-2.0 -- 2.7.4 From caef418f50d267d8ff8b42ed34dce5c045234f2a Mon Sep 17 00:00:00 2001 From: Jeongmo Yang Date: Mon, 17 Oct 2016 11:49:27 +0900 Subject: [PATCH 13/16] Fix Svace issue - DEREF_AFTER_NULL [Version] 0.2.53 [Profile] Common [Issue Type] Bug fix [Dependency module] N/A [Dependency commit] N/A Change-Id: I7158e17487b41a29e8431610f4f477e27a6c4b79 Signed-off-by: Jeongmo Yang --- muse/src/muse_camera_dispatcher.c | 4 ++-- packaging/mmsvc-camera.spec | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/muse/src/muse_camera_dispatcher.c b/muse/src/muse_camera_dispatcher.c index f490120..e8b5d79 100644 --- a/muse/src/muse_camera_dispatcher.c +++ b/muse/src/muse_camera_dispatcher.c @@ -383,8 +383,8 @@ void _camera_dispatcher_capturing_cb(camera_image_data_s* image, camera_image_da LOGD("Enter!!"); muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module); - if (!muse_camera || !image || image->size <= 0) { - LOGE("invalid ptr %p %p or size %d", muse_camera, image, image->size); + if (!muse_camera || !image) { + LOGE("invalid ptr %p %p", muse_camera, image); return; } diff --git a/packaging/mmsvc-camera.spec b/packaging/mmsvc-camera.spec index 462891d..aea44f7 100644 --- a/packaging/mmsvc-camera.spec +++ b/packaging/mmsvc-camera.spec @@ -1,6 +1,6 @@ Name: mmsvc-camera Summary: A Camera module for muse server -Version: 0.2.52 +Version: 0.2.53 Release: 0 Group: Multimedia/Libraries License: Apache-2.0 -- 2.7.4 From 3f31d58ad718b902cdff1a343fb14c4ee53de211 Mon Sep 17 00:00:00 2001 From: Jeongmo Yang Date: Tue, 25 Oct 2016 15:06:40 +0900 Subject: [PATCH 14/16] 1. Add new function to set gdbus connection, 2. Bug fix for EXIF info 1. Sometimes, got crashed when get gdbus connection, so do not get gdbus connection in camera module and get from outside(muse server) 2. EXIF info is missed, fixed it. [Version] 0.2.54 [Profile] Common [Issue Type] Update and bug fix [Dependency module] libmm-camcorder, mmsvc-core [Test] [M(T) - Boot=(OK), sdb=(OK), Home=(OK), Touch=(OK), Version=tizen-mobile_20161024.2] Change-Id: I628804ad3b6b612b61f1550dc1f103f52b20cdd5 Signed-off-by: Jeongmo Yang --- legacy/include/legacy_camera_internal.h | 17 +++++++++- legacy/src/legacy_camera.c | 5 ++- legacy/src/legacy_camera_internal.c | 20 +++++++++++ muse/src/muse_camera_dispatcher.c | 59 ++++++++++----------------------- packaging/mmsvc-camera.spec | 2 +- 5 files changed, 59 insertions(+), 44 deletions(-) diff --git a/legacy/include/legacy_camera_internal.h b/legacy/include/legacy_camera_internal.h index ccfb764..8a41219 100644 --- a/legacy/include/legacy_camera_internal.h +++ b/legacy/include/legacy_camera_internal.h @@ -38,7 +38,7 @@ extern "C" { * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter * @retval #CAMERA_ERROR_INVALID_OPERATION Invalid operation * @retval #CAMERA_ERROR_INVALID_STATE Invalid state - * @pre The camera state must be #CAMERA_STATE_CREATED by camera_create(). + * @pre The camera state must be #CAMERA_STATE_CREATED by legacy_camera_create(). */ int legacy_camera_set_client_pid(camera_h camera, int pid); @@ -54,6 +54,21 @@ int legacy_camera_set_client_pid(camera_h camera, int pid); void legacy_camera_emit_signal(camera_h camera, const char *object_name, const char *interface_name, const char *signal_name, int value); +/** + * @brief Set gdbus connection created from outside. + * @ingroup CAPI_MEDIA_CAMERA_MUSED_MODULE + * @param[in] camera The handle to the camera + * @param[in] gdbus_conn The connection of gdbus + * + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_INVALID_OPERATION Invalid operation + * @retval #CAMERA_ERROR_INVALID_STATE Invalid state + * @pre The camera state must be #CAMERA_STATE_CREATED by legacy_camera_create(). + */ +int legacy_camera_set_gdbus_connection(camera_h camera, void *gdbud_connection); + #ifdef __cplusplus } diff --git a/legacy/src/legacy_camera.c b/legacy/src/legacy_camera.c index eb696dd..5d81c54 100644 --- a/legacy/src/legacy_camera.c +++ b/legacy/src/legacy_camera.c @@ -204,9 +204,12 @@ static gboolean __mm_capture_callback(MMCamcorderCaptureDataType *frame, MMCamco ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, "captured-exif-raw-data", &exif, &exif_size, NULL); - if (ret == MM_ERROR_NONE) { + if (ret == MM_ERROR_NONE && + exif && exif_size > 0) { image.exif = exif; image.exif_size = exif_size; + } else { + LOGW("invalid EXIF info %p, size %d", exif, exif_size); } } diff --git a/legacy/src/legacy_camera_internal.c b/legacy/src/legacy_camera_internal.c index 986336b..c270cf1 100644 --- a/legacy/src/legacy_camera_internal.c +++ b/legacy/src/legacy_camera_internal.c @@ -68,3 +68,23 @@ void legacy_camera_emit_signal(camera_h camera, const char *object_name, return; } + + +int legacy_camera_set_gdbus_connection(camera_h camera, void *gdbus_connection) +{ + int ret; + camera_s *handle = (camera_s *)camera; + + if (handle == NULL) { + LOGE("NULL handle"); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + LOGD("gdbus connection %p", gdbus_connection); + + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, + MMCAM_GDBUS_CONNECTION, gdbus_connection, sizeof(gdbus_connection), + NULL); + + return __convert_camera_error_code(__func__, ret); +} diff --git a/muse/src/muse_camera_dispatcher.c b/muse/src/muse_camera_dispatcher.c index e8b5d79..68a7525 100644 --- a/muse/src/muse_camera_dispatcher.c +++ b/muse/src/muse_camera_dispatcher.c @@ -45,8 +45,6 @@ void _camera_dispatcher_callback_supported_theater_mode(int param1, void *user_d { muse_module_h module = (muse_module_h)user_data; - LOGD("Enter!! param : %d", param1); - muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT, MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE, MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, @@ -58,8 +56,6 @@ void _camera_dispatcher_callback_supported_af_mode(int param1, void *user_data) { muse_module_h module = (muse_module_h)user_data; - LOGD("Enter!! param : %d", param1); - muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT, MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_AF_MODE, MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, @@ -71,8 +67,6 @@ void _camera_dispatcher_callback_supported_exposure_mode(int param1, void *user_ { muse_module_h module = (muse_module_h)user_data; - LOGD("Enter!! param : %d", param1); - muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT, MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EXPOSURE_MODE, MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, @@ -84,8 +78,6 @@ void _camera_dispatcher_callback_supported_iso_mode(int param1, void *user_data) { muse_module_h module = (muse_module_h)user_data; - LOGD("Enter!! param : %d", param1); - muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT, MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_ISO, MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, @@ -97,8 +89,6 @@ void _camera_dispatcher_callback_supported_whitebalance(int param1, void *user_d { muse_module_h module = (muse_module_h)user_data; - LOGD("Enter!! param : %d", param1); - muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT, MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_WHITEBALANCE, MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, @@ -110,8 +100,6 @@ void _camera_dispatcher_callback_supported_effect(int param1, void *user_data) { muse_module_h module = (muse_module_h)user_data; - LOGD("Enter!! param : %d", param1); - muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT, MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EFFECT, MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, @@ -123,8 +111,6 @@ void _camera_dispatcher_callback_supported_scene_mode(int param1, void *user_dat { muse_module_h module = (muse_module_h)user_data; - LOGD("Enter!! param : %d", param1); - muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT, MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_SCENE_MODE, MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, @@ -136,8 +122,6 @@ void _camera_dispatcher_callback_supported_flash_mode(int param1, void *user_dat { muse_module_h module = (muse_module_h)user_data; - LOGD("Enter!! param : %d", param1); - muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT, MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FLASH_MODE, MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, @@ -149,12 +133,8 @@ int _camera_dispatcher_callback_supported_flash_mode2(int param1, void *user_dat { int *count = (int *)user_data; - LOGD("Enter!! param : %d", param1); - - if (count) { + if (count) (*count)++; - LOGD("count : %d", *count); - } return true; } @@ -163,8 +143,6 @@ void _camera_dispatcher_callback_supported_fps(int param1, void *user_data) { muse_module_h module = (muse_module_h)user_data; - LOGD("Enter!! param : %d", param1); - muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT, MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS, MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, @@ -176,8 +154,6 @@ void _camera_dispatcher_callback_supported_fps_by_resolution(int param1, void *u { muse_module_h module = (muse_module_h)user_data; - LOGD("Enter!! param : %d", param1); - muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT, MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS_BY_RESOLUTION, MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, @@ -189,8 +165,6 @@ void _camera_dispatcher_callback_supported_stream_flip(int param1, void *user_da { muse_module_h module = (muse_module_h)user_data; - LOGD("Enter!! param : %d", param1); - muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT, MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_FLIP, MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, @@ -202,8 +176,6 @@ void _camera_dispatcher_callback_supported_stream_rotation(int param1, void *use { muse_module_h module = (muse_module_h)user_data; - LOGD("Enter!! param : %d", param1); - muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT, MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION, MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, @@ -215,8 +187,6 @@ void _camera_dispatcher_callback_supported_capture_format(int param1, void *user { muse_module_h module = (muse_module_h)user_data; - LOGD("Enter!! param : %d", param1); - muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT, MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_FORMAT, MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, @@ -228,8 +198,6 @@ void _camera_dispatcher_callback_supported_preview_format(int param1, void *user { muse_module_h module = (muse_module_h)user_data; - LOGD("Enter!! param : %d", param1); - muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT, MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_FORMAT, MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, @@ -241,8 +209,6 @@ void _camera_dispatcher_callback_supported_preview_resolution(int param1, int pa { muse_module_h module = (muse_module_h)user_data; - LOGD("Enter!! param1 : %d, param2 : %d", param1, param2); - muse_camera_msg_event2(MUSE_CAMERA_CB_EVENT, MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_RESOLUTION, MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, @@ -255,8 +221,6 @@ void _camera_dispatcher_callback_supported_capture_resolution(int param1, int pa { muse_module_h module = (muse_module_h)user_data; - LOGD("Enter!! param1 : %d, param2 : %d", param1, param2); - muse_camera_msg_event2(MUSE_CAMERA_CB_EVENT, MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_RESOLUTION, MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, @@ -269,8 +233,6 @@ void _camera_dispatcher_callback_supported_ptz_type(int param1, void *user_data) { muse_module_h module = (muse_module_h)user_data; - LOGD("Enter!! param : %d", param1); - muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT, MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PTZ_TYPE, MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, @@ -396,6 +358,8 @@ void _camera_dispatcher_capturing_cb(camera_image_data_s* image, camera_image_da } data_size_main = sizeof(camera_image_data_s) + image->size; + if (image->exif && image->exif_size > 0) + data_size_main += image->exif_size; /* alloc bo */ bo_main = tbm_bo_alloc(muse_camera->bufmgr, data_size_main, TBM_BO_DEFAULT); @@ -414,6 +378,11 @@ void _camera_dispatcher_capturing_cb(camera_image_data_s* image, camera_image_da memcpy(buf_pos, image, sizeof(camera_image_data_s)); buf_pos += sizeof(camera_image_data_s); memcpy(buf_pos, image->data, image->size); + if (image->exif && image->exif_size > 0) { + buf_pos += image->size; + memcpy(buf_pos, image->exif, image->exif_size); + } + tbm_bo_unmap(bo_main); tbm_key_main = tbm_bo_export(bo_main); @@ -1029,6 +998,7 @@ int camera_dispatcher_create(muse_module_h module) int device_type; int client_fd = -1; int pid = 0; + void *gdbus_connection = NULL; intptr_t handle; muse_camera_handle_s *muse_camera = NULL; muse_camera_api_e api = MUSE_CAMERA_API_CREATE; @@ -1059,8 +1029,9 @@ int camera_dispatcher_create(muse_module_h module) memset(muse_camera, 0x0, sizeof(muse_camera_handle_s)); - if (muse_core_ipc_get_bufmgr(&muse_camera->bufmgr) != MM_ERROR_NONE) { - LOGE("muse_core_ipc_get_bufmgr failed"); + if (muse_core_ipc_get_bufmgr(&muse_camera->bufmgr) != MM_ERROR_NONE || + muse_core_ipc_get_gdbus_connection((GDBusConnection **)&gdbus_connection) != MM_ERROR_NONE) { + LOGE("tbm bufmgr or gdbus conntection failed %p %p", muse_camera->bufmgr, gdbus_connection); free(muse_camera); muse_camera = NULL; @@ -1094,6 +1065,12 @@ int camera_dispatcher_create(muse_module_h module) goto _CREATE_ERROR; } + ret = legacy_camera_set_gdbus_connection(muse_camera->camera_handle, gdbus_connection); + if (ret != CAMERA_ERROR_NONE) { + LOGE("legacy_camera_set_gdbus_connection failed : 0x%x", ret); + goto _CREATE_ERROR; + } + g_mutex_init(&muse_camera->list_lock); g_cond_init(&muse_camera->list_cond); g_mutex_init(&muse_camera->preview_cb_lock); diff --git a/packaging/mmsvc-camera.spec b/packaging/mmsvc-camera.spec index aea44f7..ff1b6ef 100644 --- a/packaging/mmsvc-camera.spec +++ b/packaging/mmsvc-camera.spec @@ -1,6 +1,6 @@ Name: mmsvc-camera Summary: A Camera module for muse server -Version: 0.2.53 +Version: 0.2.54 Release: 0 Group: Multimedia/Libraries License: Apache-2.0 -- 2.7.4 From 3b54b447de44e5115676f5d34988391e8585be2f Mon Sep 17 00:00:00 2001 From: Jeongmo Yang Date: Thu, 3 Nov 2016 15:50:50 +0900 Subject: [PATCH 15/16] Add new enums for get APIs and code optimization 1. The previous mechanism for get APIs is extracting get value from received message. But, received message could be overwritten by next message, so get API could lost the value from server. To resolve it, this commit adds new enums and client can store the values to each independent space. 2. Replace some macros by function. [Version] 0.2.55 [Profile] Common [Issue Type] Update [Dependency module] N/A [Test] [M(T) - Boot=(OK), sdb=(OK), Home=(OK), Touch=(OK), Version=tizen-mobile_20161101.3] Change-Id: I687b53b8cba6bb759feea5191320911409a8496b Signed-off-by: Jeongmo Yang --- muse/include/muse_camera.h | 83 +++++ muse/include/muse_camera_msg.h | 269 +-------------- muse/src/muse_camera_dispatcher.c | 671 +++++++++++++++++++++++++------------- packaging/mmsvc-camera.spec | 2 +- 4 files changed, 542 insertions(+), 483 deletions(-) diff --git a/muse/include/muse_camera.h b/muse/include/muse_camera.h index c420d31..3de83f2 100644 --- a/muse/include/muse_camera.h +++ b/muse/include/muse_camera.h @@ -243,6 +243,89 @@ typedef enum { MUSE_CAMERA_EVENT_CLASS_NUM } muse_camera_event_class_e; +/** + * @brief Enumeration for the muse camera get type list. + */ +typedef enum { + MUSE_CAMERA_GET_TYPE_NONE, + MUSE_CAMERA_GET_TYPE_INT, + MUSE_CAMERA_GET_TYPE_INT_PAIR, + MUSE_CAMERA_GET_TYPE_ARRAY, + MUSE_CAMERA_GET_TYPE_STRING, + MUSE_CAMERA_GET_TYPE_POINTER, + MUSE_CAMERA_GET_TYPE +} muse_camera_get_type_e; + +/** + * @brief Enumeration for the integer type list. + */ +typedef enum { + MUSE_CAMERA_GET_INT_STATE = 0, + MUSE_CAMERA_GET_INT_DEVICE_COUNT, + MUSE_CAMERA_GET_INT_FACING_DIRECTION, + MUSE_CAMERA_GET_INT_LENS_ORIENTATION, + MUSE_CAMERA_GET_INT_PREVIEW_RESOLUTION, + MUSE_CAMERA_GET_INT_PREVIEW_FORMAT, + MUSE_CAMERA_GET_INT_PREVIEW_FPS, + MUSE_CAMERA_GET_INT_RECOMMENDED_PREVIEW_RESOLUTION, + MUSE_CAMERA_GET_INT_CAPTURE_RESOLUTION, + MUSE_CAMERA_GET_INT_CAPTURE_FORMAT, + MUSE_CAMERA_GET_INT_DISPLAY_FLIP, + MUSE_CAMERA_GET_INT_DISPLAY_MODE, + MUSE_CAMERA_GET_INT_DISPLAY_REUSE_HINT, + MUSE_CAMERA_GET_INT_DISPLAY_ROTATION, + MUSE_CAMERA_GET_INT_DISPLAY_VISIBLE, + MUSE_CAMERA_GET_INT_THEATER_MODE, + MUSE_CAMERA_GET_INT_FLASH_MODE, + MUSE_CAMERA_GET_INT_AF_MODE, + MUSE_CAMERA_GET_INT_ISO, + MUSE_CAMERA_GET_INT_BRIGHTNESS, + MUSE_CAMERA_GET_INT_CONTRAST, + MUSE_CAMERA_GET_INT_EFFECT, + MUSE_CAMERA_GET_INT_SCENE_MODE, + MUSE_CAMERA_GET_INT_WHITE_BALANCE, + MUSE_CAMERA_GET_INT_EXPOSURE, + MUSE_CAMERA_GET_INT_EXPOSURE_MODE, + MUSE_CAMERA_GET_INT_HDR_MODE, + MUSE_CAMERA_GET_INT_IMAGE_QUALITY, + MUSE_CAMERA_GET_INT_STREAM_FLIP, + MUSE_CAMERA_GET_INT_STREAM_ROTATION, + MUSE_CAMERA_GET_INT_TAG_ORIENTATION, + MUSE_CAMERA_GET_INT_ZOOM, + MUSE_CAMERA_GET_INT_PAN, + MUSE_CAMERA_GET_INT_TILT, + MUSE_CAMERA_GET_INT_ENABLED_ANTI_SHAKE, + MUSE_CAMERA_GET_INT_ENABLED_AUTO_CONTRAST, + MUSE_CAMERA_GET_INT_ENABLED_TAG, + MUSE_CAMERA_GET_INT_ENABLED_VIDEO_STABILIZATION, + MUSE_CAMERA_GET_INT_ENCODED_PREVIEW_BITRATE, + MUSE_CAMERA_GET_INT_ENCODED_PREVIEW_GOP_INTERVAL, + MUSE_CAMERA_GET_INT_NUM +} muse_camera_get_int_e; + +/** + * @brief Enumeration for the integer pair type list. + */ +typedef enum { + MUSE_CAMERA_GET_INT_PAIR_ZOOM_RANGE, + MUSE_CAMERA_GET_INT_PAIR_BRIGHTNESS_RANGE, + MUSE_CAMERA_GET_INT_PAIR_CONTRAST_RANGE, + MUSE_CAMERA_GET_INT_PAIR_EXPOSURE_RANGE, + MUSE_CAMERA_GET_INT_PAIR_PAN_RANGE, + MUSE_CAMERA_GET_INT_PAIR_TILT_RANGE, + MUSE_CAMERA_GET_INT_PAIR_NUM +} muse_camera_get_int_pair_e; + + +/** + * @brief Enumeration for the string type list. + */ +typedef enum { + MUSE_CAMERA_GET_STRING_TAG_IMAGE_DESCRIPTION, + MUSE_CAMERA_GET_STRING_TAG_SOFTWARE, + MUSE_CAMERA_GET_STRING_NUM +} muse_camera_get_string_e; + typedef struct { tbm_bo bo; int key; diff --git a/muse/include/muse_camera_msg.h b/muse/include/muse_camera_msg.h index cecd91a..c356bb0 100644 --- a/muse/include/muse_camera_msg.h +++ b/muse/include/muse_camera_msg.h @@ -40,6 +40,16 @@ extern "C" { #define PARAM_RET "ret" /** + * @brief Definition for the get_type parameter. + */ +#define PARAM_GET_TYPE "get_type" + +/** + * @brief Definition for the get_index parameter. + */ +#define PARAM_GET_INDEX "get_index" + +/** * @brief Definition for the event parameter. */ #define PARAM_EVENT "event" @@ -99,6 +109,7 @@ typedef double DOUBLE; */ typedef const char* STRING; + /** * @brief Query the specific value from the input message via ipc. * @param[in] param The key to query, the variable name should be matched to the message's one. @@ -131,264 +142,6 @@ typedef const char* STRING; #define muse_camera_msg_get_pointer(param, buf) \ muse_core_msg_json_deserialize(#param, buf, NULL, ¶m, NULL, MUSE_TYPE_POINTER) -/** - * @brief Query the specific 64bit integer type value from the input message via ipc. - * @param[in] param The key to query, the variable name should be matched to the message's one. - * @param[out] buf The string of message buffer. - */ -#define muse_camera_msg_get_64bit(param, buf) \ - muse_core_msg_json_deserialize(#param, buf, NULL, ¶m, NULL, MUSE_TYPE_INT64) - -/** - * @brief Query the specific value with error return from the input message via ipc. - * @param[in] param The key to query, the variable name should be matched to the message's one. - * @param[out] buf The string of message buffer. - * @param[out] e The error return from the core api. - */ -#define muse_camera_msg_get_error_e(param, buf, e) \ - muse_core_msg_json_deserialize(#param, buf, NULL, ¶m, &e, MUSE_TYPE_ANY) - -/** - * @brief Returning the ack message from the server to client side. - * @param[in] api The enumeration of the corresponding api. - * @param[in] class The enumeration of the api class. - * @param[out] ret The delivered return value from the module to proxy side. - * @param[in] module The module info for the ipc transportation. - */ -#define muse_camera_msg_return(api, class, ret, module) \ - do { \ - char *__sndMsg__; \ - int __len__; \ - __sndMsg__ = muse_core_msg_json_factory_new(api, \ - MUSE_TYPE_INT, PARAM_API_CLASS, class, \ - MUSE_TYPE_INT, PARAM_RET, ret, \ - 0); \ - __len__ = muse_core_ipc_send_msg(muse_core_client_get_msg_fd(module), __sndMsg__); \ - if (__len__ <= 0) { \ - LOGE("sending message failed"); \ - ret = CAMERA_ERROR_INVALID_OPERATION; \ - } \ - muse_core_msg_json_factory_free(__sndMsg__); \ - } while (0) - -/** - * @brief Returning the ack message from the server to client side. - * @param[in] api The enumeration of the corresponding api. - * @param[in] class The enumeration of the api class. - * @param[out] ret The delivered return value from the module to proxy side. - * @param[in] module The module info for the ipc transportation. - * @param[in] type The data type of the parameter. - * @param[in] param A parameter to be included in the message. - */ -#define muse_camera_msg_return1(api, class, ret, module, type, param) \ - do { \ - char *__sndMsg__; \ - int __len__; \ - type __value__ = (type)param; \ - __sndMsg__ = muse_core_msg_json_factory_new(api, \ - MUSE_TYPE_INT, PARAM_API_CLASS, class, \ - MUSE_TYPE_INT, PARAM_RET, ret, \ - MUSE_TYPE_##type, #param, __value__, \ - 0); \ - __len__ = muse_core_ipc_send_msg(muse_core_client_get_msg_fd(module), __sndMsg__); \ - if (__len__ <= 0) { \ - LOGE("sending message failed"); \ - ret = CAMERA_ERROR_INVALID_OPERATION; \ - } \ - muse_core_msg_json_factory_free(__sndMsg__); \ - } while (0) - -/** - * @brief Returning the ack message from the server to client side, adding 2 parameters. - * @param[in] api The enumeration of the corresponding api. - * @param[in] class The enumeration of the api class. - * @param[out] ret The delivered return value from the module to proxy side. - * @param[in] module The module info for the ipc transportation. - * @param[in] type1 The data type of the parameter. - * @param[in] param1 The 1st parameter to be included in the message. - * @param[in] type2 The data type of the parameter. - * @param[in] param2 The 2nd parameter to be included in the message. - */ -#define muse_camera_msg_return2(api, class, ret, module, type1, param1, type2, param2) \ - do { \ - char *__sndMsg__; \ - int __len__; \ - type1 __value1__ = (type1)param1; \ - type2 __value2__ = (type2)param2; \ - __sndMsg__ = muse_core_msg_json_factory_new(api, \ - MUSE_TYPE_INT, PARAM_API_CLASS, class, \ - MUSE_TYPE_INT, PARAM_RET, ret, \ - MUSE_TYPE_##type1, #param1, __value1__, \ - MUSE_TYPE_##type2, #param2, __value2__, \ - 0); \ - __len__ = muse_core_ipc_send_msg(muse_core_client_get_msg_fd(module), __sndMsg__); \ - if (__len__ <= 0) { \ - LOGE("sending message failed"); \ - ret = CAMERA_ERROR_INVALID_OPERATION; \ - } \ - muse_core_msg_json_factory_free(__sndMsg__); \ - } while (0) - -/** - * @brief Returning the ack message from the server to client side, adding 3 parameters. - * @param[in] api The enumeration of the corresponding api. - * @param[in] class The enumeration of the api class. - * @param[out] ret The delivered return value from the module to proxy side. - * @param[in] module The module info for the ipc transportation. - * @param[in] type1 The data type of the parameter. - * @param[in] param1 The 1st parameter to be included in the message. - * @param[in] type2 The data type of the parameter. - * @param[in] param2 The 2nd parameter to be included in the message. - * @param[in] type3 The data type of the parameter. - * @param[in] param3 The 3rd parameter to be included in the message. - */ -#define muse_camera_msg_return3(api, class, ret, module, type1, param1, type2, param2, type3, param3) \ - do { \ - char *__sndMsg__; \ - int __len__; \ - type1 __value1__ = (type1)param1; \ - type2 __value2__ = (type2)param2; \ - type3 __value3__ = (type3)param3; \ - __sndMsg__ = muse_core_msg_json_factory_new(api, \ - MUSE_TYPE_INT, PARAM_API_CLASS, class, \ - MUSE_TYPE_INT, PARAM_RET, ret, \ - MUSE_TYPE_##type1, #param1, __value1__, \ - MUSE_TYPE_##type2, #param2, __value2__, \ - MUSE_TYPE_##type3, #param3, __value3__, \ - 0); \ - __len__ = muse_core_ipc_send_msg(muse_core_client_get_msg_fd(module), __sndMsg__); \ - if (__len__ <= 0) { \ - LOGE("sending message failed"); \ - ret = CAMERA_ERROR_INVALID_OPERATION; \ - } \ - muse_core_msg_json_factory_free(__sndMsg__); \ - } while (0) - -/** - * @brief Returning the ack message from the server to client side, adding array parameter. - * @param[in] api The enumeration of the corresponding api. - * @param[in] class The enumeration of the api class. - * @param[out] ret The delivered return value from the module to proxy side. - * @param[in] module The module info for the ipc transportation. - * @param[in] param The array data parameter to be included in the message. - * @param[in] length The length of the array. - * @param[in] datum_size The size of the array. - */ -#define muse_camera_msg_return_array(api, class, ret, module, param, length, datum_size) \ - do { \ - char *__sndMsg__; \ - int __len__; \ - int *__value__ = (int *)param; \ - __sndMsg__ = muse_core_msg_json_factory_new(api, \ - MUSE_TYPE_INT, PARAM_API_CLASS, class, \ - MUSE_TYPE_INT, PARAM_RET, ret, \ - MUSE_TYPE_ARRAY, #param, \ - datum_size == sizeof(int) ? length / sizeof(int) : \ - length / sizeof(int) + (length % sizeof(int) ? 1 : 0), \ - __value__, \ - 0); \ - __len__ = muse_core_ipc_send_msg(muse_core_client_get_msg_fd(module), __sndMsg__); \ - if (__len__ <= 0) { \ - LOGE("sending message failed"); \ - ret = CAMERA_ERROR_INVALID_OPERATION; \ - } \ - muse_core_msg_json_factory_free(__sndMsg__); \ - } while (0) - -/** - * @brief Returning the event ack message from the server to client side, adding array parameter. - * @param[in] api The enumeration of the corresponding api. - * @param[in] event The enumeration of the event. - * @param[in] class The enumeration of the event class. - * @param[in] module The module info for the ipc transportation. - */ -#define muse_camera_msg_event(api, event, class, module) \ - do { \ - char *__sndMsg__; \ - __sndMsg__ = muse_core_msg_json_factory_new(api, \ - MUSE_TYPE_INT, PARAM_EVENT, event, \ - MUSE_TYPE_INT, PARAM_EVENT_CLASS, class, \ - 0); \ - muse_core_ipc_send_msg(muse_core_client_get_msg_fd(module), __sndMsg__); \ - muse_core_msg_json_factory_free(__sndMsg__); \ - } while (0) - -/** - * @brief Returning the event ack message from the server to client side, adding array parameter. - * @param[in] api The enumeration of the corresponding api. - * @param[in] event The enumeration of the event. - * @param[in] class The enumeration of the event class. - * @param[in] module The module info for the ipc transportation. - * @param[in] type The data type of the parameter. - * @param[in] param A parameter to be included in the message. - */ -#define muse_camera_msg_event1(api, event, class, module, type, param) \ - do { \ - char *__sndMsg__; \ - type __value__ = (type)param; \ - __sndMsg__ = muse_core_msg_json_factory_new(api, \ - MUSE_TYPE_INT, PARAM_EVENT, event, \ - MUSE_TYPE_INT, PARAM_EVENT_CLASS, class, \ - MUSE_TYPE_##type, #param, __value__, \ - 0); \ - muse_core_ipc_send_msg(muse_core_client_get_msg_fd(module), __sndMsg__); \ - muse_core_msg_json_factory_free(__sndMsg__); \ - } while (0) - -/** - * @brief Returning the event ack message from the server to client side, adding array parameter. - * @param[in] api The enumeration of the corresponding api. - * @param[in] event The enumeration of the event. - * @param[in] class The enumeration of the event class. - * @param[in] module The module info for the ipc transportation. - * @param[in] param1 The 1st parameter to be included in the message. - * @param[in] type2 The data type of the parameter. - * @param[in] param2 The 2nd parameter to be included in the message. - */ -#define muse_camera_msg_event2(api, event, class, module, type1, param1, type2, param2) \ - do { \ - char *__sndMsg__; \ - type1 __value1__ = (type1)param1; \ - type2 __value2__ = (type2)param2; \ - __sndMsg__ = muse_core_msg_json_factory_new(api, \ - MUSE_TYPE_INT, PARAM_EVENT, event, \ - MUSE_TYPE_INT, PARAM_EVENT_CLASS, class, \ - MUSE_TYPE_##type1, #param1, __value1__, \ - MUSE_TYPE_##type2, #param2, __value2__, \ - 0); \ - muse_core_ipc_send_msg(muse_core_client_get_msg_fd(module), __sndMsg__); \ - muse_core_msg_json_factory_free(__sndMsg__); \ - } while (0) - -/** - * @brief Returning the event ack message from the server to client side, adding array parameter. - * @param[in] api The enumeration of the corresponding api. - * @param[in] event The enumeration of the event. - * @param[in] class The enumeration of the event class. - * @param[in] module The module info for the ipc transportation. - * @param[in] param1 The 1st parameter to be included in the message. - * @param[in] type2 The data type of the parameter. - * @param[in] param2 The 2nd parameter to be included in the message. - * @param[in] type3 The data type of the parameter. - * @param[in] param3 The 3rd parameter to be included in the message. - */ -#define muse_camera_msg_event3(api, event, class, module, type1, param1, type2, param2, type3, param3) \ - do { \ - char *__sndMsg__; \ - type1 __value1__ = (type1)param1; \ - type2 __value2__ = (type2)param2; \ - type3 __value3__ = (type3)param3; \ - __sndMsg__ = muse_core_msg_json_factory_new(api, \ - MUSE_TYPE_INT, PARAM_EVENT, event, \ - MUSE_TYPE_INT, PARAM_EVENT_CLASS, class, \ - MUSE_TYPE_##type1, #param1, __value1__, \ - MUSE_TYPE_##type2, #param2, __value2__, \ - MUSE_TYPE_##type3, #param3, __value3__, \ - 0); \ - muse_core_ipc_send_msg(muse_core_client_get_msg_fd(module), __sndMsg__); \ - muse_core_msg_json_factory_free(__sndMsg__); \ - } while (0) - #ifdef __cplusplus } #endif diff --git a/muse/src/muse_camera_dispatcher.c b/muse/src/muse_camera_dispatcher.c index 68a7525..d4b1c9e 100644 --- a/muse/src/muse_camera_dispatcher.c +++ b/muse/src/muse_camera_dispatcher.c @@ -40,6 +40,148 @@ static int _camera_remove_export_data(muse_module_h module, int key, int remove_all); +static void __camera_dispatcher_send_msg(muse_module_h module, char *msg) +{ + int len = 0; + + if (!msg) { + LOGE("NULL msg"); + return; + } + + if (!module) { + LOGE("NULL module"); + goto _DONE; + } + + /*LOGD("msg [%s]", msg);*/ + + len = muse_core_ipc_send_msg(muse_core_client_get_msg_fd(module), msg); + if (len <= 0) + LOGE("sending message[%s] failed. errno %d", msg, errno); + +_DONE: + muse_core_msg_json_factory_free(msg); + + return; +} + +static void muse_camera_msg_return(int api, int class, int ret, muse_module_h module) +{ + char *send_msg = muse_core_msg_json_factory_new(api, + MUSE_TYPE_INT, PARAM_API_CLASS, class, + MUSE_TYPE_INT, PARAM_RET, ret, + MUSE_TYPE_INT, PARAM_GET_TYPE, MUSE_CAMERA_GET_TYPE_NONE, + 0); + + __camera_dispatcher_send_msg(module, send_msg); + + return; +} + +static void muse_camera_msg_return1(int api, int class, int ret, muse_module_h module, + int get_type, int index, const char *name, int value_int, void *value_pointer) +{ + char *send_msg = NULL; + + if (get_type == MUSE_CAMERA_GET_TYPE_INT) { + send_msg = muse_core_msg_json_factory_new(api, + MUSE_TYPE_INT, PARAM_API_CLASS, class, + MUSE_TYPE_INT, PARAM_RET, ret, + MUSE_TYPE_INT, PARAM_GET_TYPE, get_type, + MUSE_TYPE_INT, PARAM_GET_INDEX, index, + MUSE_TYPE_INT, name, value_int, + 0); + } else if (get_type == MUSE_CAMERA_GET_TYPE_STRING) { + send_msg = muse_core_msg_json_factory_new(api, + MUSE_TYPE_INT, PARAM_API_CLASS, class, + MUSE_TYPE_INT, PARAM_RET, ret, + MUSE_TYPE_INT, PARAM_GET_TYPE, get_type, + MUSE_TYPE_INT, PARAM_GET_INDEX, index, + MUSE_TYPE_STRING, name, value_pointer, + 0); + } else if (get_type == MUSE_CAMERA_GET_TYPE_POINTER) { + send_msg = muse_core_msg_json_factory_new(api, + MUSE_TYPE_INT, PARAM_API_CLASS, class, + MUSE_TYPE_INT, PARAM_RET, ret, + MUSE_TYPE_INT, PARAM_GET_TYPE, get_type, + MUSE_TYPE_INT, PARAM_GET_INDEX, index, + MUSE_TYPE_POINTER, name, value_pointer, + 0); + } else { + LOGW("unknown type %d", get_type); + } + + __camera_dispatcher_send_msg(module, send_msg); + + return; +} + + +static void muse_camera_msg_return2(int api, int class, int ret, muse_module_h module, + int get_type, int index, int value0, int value1) +{ + char *send_msg = muse_core_msg_json_factory_new(api, + MUSE_TYPE_INT, PARAM_API_CLASS, class, + MUSE_TYPE_INT, PARAM_RET, ret, + MUSE_TYPE_INT, PARAM_GET_TYPE, get_type, + MUSE_TYPE_INT, PARAM_GET_INDEX, index, + MUSE_TYPE_INT, "get_value0", value0, + MUSE_TYPE_INT, "get_value1", value1, + 0); + + __camera_dispatcher_send_msg(module, send_msg); + + return; +} + + +static void muse_camera_msg_event1(int api, int event, int class, muse_module_h module, const char *name, int value) +{ + char *send_msg = muse_core_msg_json_factory_new(api, + MUSE_TYPE_INT, PARAM_EVENT, event, + MUSE_TYPE_INT, PARAM_EVENT_CLASS, class, + MUSE_TYPE_INT, name, value, + 0); + + __camera_dispatcher_send_msg(module, send_msg); + + return; +} + + +static void muse_camera_msg_event2(int api, int event, int class, muse_module_h module, + const char *name0, int value0, const char *name1, int value1) +{ + char *send_msg = muse_core_msg_json_factory_new(api, + MUSE_TYPE_INT, PARAM_EVENT, event, + MUSE_TYPE_INT, PARAM_EVENT_CLASS, class, + MUSE_TYPE_INT, name0, value0, + MUSE_TYPE_INT, name1, value1, + 0); + + __camera_dispatcher_send_msg(module, send_msg); + + return; +} + + +static void muse_camera_msg_event3(int api, int event, int class, muse_module_h module, + const char *name0, int value0, const char *name1, int value1, const char *name2, int value2) +{ + char *send_msg = muse_core_msg_json_factory_new(api, + MUSE_TYPE_INT, PARAM_EVENT, event, + MUSE_TYPE_INT, PARAM_EVENT_CLASS, class, + MUSE_TYPE_INT, name0, value0, + MUSE_TYPE_INT, name1, value1, + MUSE_TYPE_INT, name2, value2, + 0); + + __camera_dispatcher_send_msg(module, send_msg); + + return; +} + void _camera_dispatcher_callback_supported_theater_mode(int param1, void *user_data) { @@ -48,8 +190,9 @@ void _camera_dispatcher_callback_supported_theater_mode(int param1, void *user_d muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT, MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE, MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, - module, - INT, param1); + module, "param1", param1); + + return; } void _camera_dispatcher_callback_supported_af_mode(int param1, void *user_data) @@ -59,8 +202,9 @@ void _camera_dispatcher_callback_supported_af_mode(int param1, void *user_data) muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT, MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_AF_MODE, MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, - module, - INT, param1); + module, "param1", param1); + + return; } void _camera_dispatcher_callback_supported_exposure_mode(int param1, void *user_data) @@ -70,8 +214,9 @@ void _camera_dispatcher_callback_supported_exposure_mode(int param1, void *user_ muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT, MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EXPOSURE_MODE, MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, - module, - INT, param1); + module, "param1", param1); + + return; } void _camera_dispatcher_callback_supported_iso_mode(int param1, void *user_data) @@ -81,8 +226,9 @@ void _camera_dispatcher_callback_supported_iso_mode(int param1, void *user_data) muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT, MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_ISO, MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, - module, - INT, param1); + module, "param1", param1); + + return; } void _camera_dispatcher_callback_supported_whitebalance(int param1, void *user_data) @@ -92,8 +238,9 @@ void _camera_dispatcher_callback_supported_whitebalance(int param1, void *user_d muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT, MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_WHITEBALANCE, MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, - module, - INT, param1); + module, "param1", param1); + + return; } void _camera_dispatcher_callback_supported_effect(int param1, void *user_data) @@ -103,8 +250,9 @@ void _camera_dispatcher_callback_supported_effect(int param1, void *user_data) muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT, MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EFFECT, MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, - module, - INT, param1); + module, "param1", param1); + + return; } void _camera_dispatcher_callback_supported_scene_mode(int param1, void *user_data) @@ -114,8 +262,9 @@ void _camera_dispatcher_callback_supported_scene_mode(int param1, void *user_dat muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT, MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_SCENE_MODE, MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, - module, - INT, param1); + module, "param1", param1); + + return; } void _camera_dispatcher_callback_supported_flash_mode(int param1, void *user_data) @@ -125,8 +274,9 @@ void _camera_dispatcher_callback_supported_flash_mode(int param1, void *user_dat muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT, MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FLASH_MODE, MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, - module, - INT, param1); + module, "param1", param1); + + return; } int _camera_dispatcher_callback_supported_flash_mode2(int param1, void *user_data) @@ -146,8 +296,9 @@ void _camera_dispatcher_callback_supported_fps(int param1, void *user_data) muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT, MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS, MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, - module, - INT, param1); + module, "param1", param1); + + return; } void _camera_dispatcher_callback_supported_fps_by_resolution(int param1, void *user_data) @@ -157,8 +308,9 @@ void _camera_dispatcher_callback_supported_fps_by_resolution(int param1, void *u muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT, MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS_BY_RESOLUTION, MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, - module, - INT, param1); + module, "param1", param1); + + return; } void _camera_dispatcher_callback_supported_stream_flip(int param1, void *user_data) @@ -168,8 +320,9 @@ void _camera_dispatcher_callback_supported_stream_flip(int param1, void *user_da muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT, MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_FLIP, MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, - module, - INT, param1); + module, "param1", param1); + + return; } void _camera_dispatcher_callback_supported_stream_rotation(int param1, void *user_data) @@ -179,8 +332,9 @@ void _camera_dispatcher_callback_supported_stream_rotation(int param1, void *use muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT, MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION, MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, - module, - INT, param1); + module, "param1", param1); + + return; } void _camera_dispatcher_callback_supported_capture_format(int param1, void *user_data) @@ -190,8 +344,9 @@ void _camera_dispatcher_callback_supported_capture_format(int param1, void *user muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT, MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_FORMAT, MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, - module, - INT, param1); + module, "param1", param1); + + return; } void _camera_dispatcher_callback_supported_preview_format(int param1, void *user_data) @@ -201,8 +356,9 @@ void _camera_dispatcher_callback_supported_preview_format(int param1, void *user muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT, MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_FORMAT, MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, - module, - INT, param1); + module, "param1", param1); + + return; } void _camera_dispatcher_callback_supported_preview_resolution(int param1, int param2, void *user_data) @@ -212,9 +368,9 @@ void _camera_dispatcher_callback_supported_preview_resolution(int param1, int pa muse_camera_msg_event2(MUSE_CAMERA_CB_EVENT, MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_RESOLUTION, MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, - module, - INT, param1, - INT, param2); + module, "param1", param1, "param2", param2); + + return; } void _camera_dispatcher_callback_supported_capture_resolution(int param1, int param2, void *user_data) @@ -224,9 +380,9 @@ void _camera_dispatcher_callback_supported_capture_resolution(int param1, int pa muse_camera_msg_event2(MUSE_CAMERA_CB_EVENT, MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_RESOLUTION, MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, - module, - INT, param1, - INT, param2); + module, "param1", param1, "param2", param2); + + return; } void _camera_dispatcher_callback_supported_ptz_type(int param1, void *user_data) @@ -236,8 +392,9 @@ void _camera_dispatcher_callback_supported_ptz_type(int param1, void *user_data) muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT, MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PTZ_TYPE, MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, - module, - INT, param1); + module, "param1", param1); + + return; } static int _camera_remove_export_data(muse_module_h module, int key, int remove_all) @@ -494,10 +651,7 @@ void _camera_dispatcher_capturing_cb(camera_image_data_s* image, camera_image_da muse_camera_msg_event3(MUSE_CAMERA_CB_EVENT, MUSE_CAMERA_EVENT_TYPE_CAPTURE, MUSE_CAMERA_EVENT_CLASS_THREAD_SUB, - module, - INT, tbm_key_main, - INT, tbm_key_post, - INT, tbm_key_thumb); + module, "tbm_key_main", tbm_key_main, "tbm_key_post", tbm_key_post, "tbm_key_thumb", tbm_key_thumb); /* wait for capture callback return */ end_time = g_get_monotonic_time() + G_TIME_SPAN_SECOND * 3; @@ -562,10 +716,7 @@ void _camera_dispatcher_state_changed_cb(camera_state_e previous, camera_state_e muse_camera_msg_event3(MUSE_CAMERA_CB_EVENT, MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE, MUSE_CAMERA_EVENT_CLASS_THREAD_MAIN, - module, - INT, previous, - INT, current, - INT, by_policy); + module, "previous", previous, "current", current, "by_policy", by_policy); muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module); if (!muse_camera) { @@ -602,10 +753,7 @@ void _camera_dispatcher_interrupted_cb(camera_policy_e policy, camera_state_e pr muse_camera_msg_event3(MUSE_CAMERA_CB_EVENT, MUSE_CAMERA_EVENT_TYPE_INTERRUPTED, MUSE_CAMERA_EVENT_CLASS_THREAD_MAIN, - module, - INT, policy, - INT, previous, - INT, current); + module, "policy", policy, "previous", previous, "current", current); return; } @@ -845,10 +993,11 @@ void _camera_dispatcher_capture_completed_cb(void *user_data) LOGD("Enter"); - muse_camera_msg_event(MUSE_CAMERA_CB_EVENT, + muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT, MUSE_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE, MUSE_CAMERA_EVENT_CLASS_THREAD_MAIN, - module); + module, "none", 0); + return; } @@ -936,9 +1085,7 @@ void _camera_dispatcher_face_detected_cb(camera_detected_face_s *faces, int coun muse_camera_msg_event2(MUSE_CAMERA_CB_EVENT, MUSE_CAMERA_EVENT_TYPE_FACE_DETECTION, MUSE_CAMERA_EVENT_CLASS_THREAD_MAIN, - module, - INT, count, - INT, tbm_key); + module, "count", count, "tbm_key", tbm_key); } else { LOGW("invalid count for face detection - %d", count); } @@ -955,8 +1102,7 @@ void _camera_dispatcher_focus_changed_cb(camera_focus_state_e state, void *user_ muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT, MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE, MUSE_CAMERA_EVENT_CLASS_THREAD_MAIN, - module, - INT, state); + module, "state", state); return; } @@ -970,9 +1116,7 @@ void _camera_dispatcher_error_cb(camera_error_e error, camera_state_e current_st muse_camera_msg_event2(MUSE_CAMERA_CB_EVENT, MUSE_CAMERA_EVENT_TYPE_ERROR, MUSE_CAMERA_EVENT_CLASS_THREAD_MAIN, - module, - INT, error, - INT, current_state); + module, "error", error, "current_state", current_state); return; } @@ -986,8 +1130,8 @@ void _camera_dispatcher_hdr_progress_cb(int percent, void *user_data) muse_camera_msg_event1(MUSE_CAMERA_CB_EVENT, MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS, MUSE_CAMERA_EVENT_CLASS_THREAD_MAIN, - module, - INT, percent); + module, "percent", percent); + return; } @@ -999,7 +1143,6 @@ int camera_dispatcher_create(muse_module_h module) int client_fd = -1; int pid = 0; void *gdbus_connection = NULL; - intptr_t handle; muse_camera_handle_s *muse_camera = NULL; muse_camera_api_e api = MUSE_CAMERA_API_CREATE; muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; @@ -1078,9 +1221,8 @@ int camera_dispatcher_create(muse_module_h module) muse_camera->preview_cb_flag = 0; LOGD("handle : 0x%x", muse_camera); - handle = (intptr_t)muse_camera; muse_core_ipc_set_handle(module, (intptr_t)muse_camera); - muse_camera_msg_return1(api, class, ret, module, POINTER, handle); + muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_POINTER, -1, "handle", 0, muse_camera); return MUSE_CAMERA_ERROR_NONE; @@ -1339,7 +1481,7 @@ int camera_dispatcher_get_device_count(muse_module_h module) { int ret = CAMERA_ERROR_NONE; muse_camera_handle_s *muse_camera = NULL; - int get_device_count = 0; + int get_value = 0; muse_camera_api_e api = MUSE_CAMERA_API_GET_DEVICE_COUNT; muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; @@ -1347,9 +1489,10 @@ int camera_dispatcher_get_device_count(muse_module_h module) LOGD("handle : %p", muse_camera); - ret = legacy_camera_get_device_count(muse_camera->camera_handle, &get_device_count); + ret = legacy_camera_get_device_count(muse_camera->camera_handle, &get_value); if (ret == CAMERA_ERROR_NONE) { - muse_camera_msg_return1(api, class, ret, module, INT, get_device_count); + muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT, + MUSE_CAMERA_GET_INT_DEVICE_COUNT, "get_value", get_value, NULL); } else { muse_camera_msg_return(api, class, ret, module); } @@ -1399,7 +1542,7 @@ int camera_dispatcher_get_state(muse_module_h module) { int ret = CAMERA_ERROR_NONE; muse_camera_handle_s *muse_camera = NULL; - camera_state_e get_state = CAMERA_STATE_NONE; + camera_state_e get_value = CAMERA_STATE_NONE; muse_camera_api_e api = MUSE_CAMERA_API_GET_STATE; muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; @@ -1407,9 +1550,10 @@ int camera_dispatcher_get_state(muse_module_h module) LOGD("handle : %p", muse_camera); - ret = legacy_camera_get_state(muse_camera->camera_handle, &get_state); + ret = legacy_camera_get_state(muse_camera->camera_handle, &get_value); if (ret == CAMERA_ERROR_NONE) { - muse_camera_msg_return1(api, class, ret, module, INT, get_state); + muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT, + MUSE_CAMERA_GET_INT_STATE, "get_value", get_value, NULL); } else { muse_camera_msg_return(api, class, ret, module); } @@ -1607,6 +1751,7 @@ int camera_dispatcher_get_preview_resolution(muse_module_h module) muse_camera_handle_s *muse_camera = NULL; int get_width = 0; int get_height = 0; + int get_value = 0; muse_camera_api_e api = MUSE_CAMERA_API_GET_PREVIEW_RESOLUTION; muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; @@ -1616,7 +1761,9 @@ int camera_dispatcher_get_preview_resolution(muse_module_h module) ret = legacy_camera_get_preview_resolution(muse_camera->camera_handle, &get_width, &get_height); if (ret == CAMERA_ERROR_NONE) { - muse_camera_msg_return2(api, class, ret, module, INT, get_width, INT, get_height); + get_value = get_width << 16 | get_height; + muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT, + MUSE_CAMERA_GET_INT_PREVIEW_RESOLUTION, "get_value", get_value, NULL); } else { muse_camera_msg_return(api, class, ret, module); } @@ -1649,7 +1796,7 @@ int camera_dispatcher_get_display_rotation(muse_module_h module) { int ret = CAMERA_ERROR_NONE; muse_camera_handle_s *muse_camera = NULL; - camera_rotation_e get_rotation = CAMERA_ROTATION_NONE; + camera_rotation_e get_value = CAMERA_ROTATION_NONE; muse_camera_api_e api = MUSE_CAMERA_API_GET_DISPLAY_ROTATION; muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; @@ -1657,9 +1804,10 @@ int camera_dispatcher_get_display_rotation(muse_module_h module) LOGD("handle : %p", muse_camera); - ret = legacy_camera_get_display_rotation(muse_camera->camera_handle, &get_rotation); + ret = legacy_camera_get_display_rotation(muse_camera->camera_handle, &get_value); if (ret == CAMERA_ERROR_NONE) { - muse_camera_msg_return1(api, class, ret, module, INT, get_rotation); + muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT, + MUSE_CAMERA_GET_INT_DISPLAY_ROTATION, "get_value", get_value, NULL); } else { muse_camera_msg_return(api, class, ret, module); } @@ -1692,7 +1840,7 @@ int camera_dispatcher_get_display_flip(muse_module_h module) { int ret = CAMERA_ERROR_NONE; muse_camera_handle_s *muse_camera = NULL; - camera_flip_e get_flip = CAMERA_FLIP_NONE; + camera_flip_e get_value = CAMERA_FLIP_NONE; muse_camera_api_e api = MUSE_CAMERA_API_GET_DISPLAY_FLIP; muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; @@ -1700,9 +1848,10 @@ int camera_dispatcher_get_display_flip(muse_module_h module) LOGD("handle : %p", muse_camera); - ret = legacy_camera_get_display_flip(muse_camera->camera_handle, &get_flip); + ret = legacy_camera_get_display_flip(muse_camera->camera_handle, &get_value); if (ret == CAMERA_ERROR_NONE) { - muse_camera_msg_return1(api, class, ret, module, INT, get_flip); + muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT, + MUSE_CAMERA_GET_INT_DISPLAY_FLIP, "get_value", get_value, NULL); } else { muse_camera_msg_return(api, class, ret, module); } @@ -1735,7 +1884,7 @@ int camera_dispatcher_is_display_visible(muse_module_h module) { int ret = CAMERA_ERROR_NONE; muse_camera_handle_s *muse_camera = NULL; - bool get_visible = true; + bool get_value = true; muse_camera_api_e api = MUSE_CAMERA_API_IS_DISPLAY_VISIBLE; muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; @@ -1743,9 +1892,10 @@ int camera_dispatcher_is_display_visible(muse_module_h module) LOGD("handle : %p", muse_camera); - ret = legacy_camera_is_display_visible(muse_camera->camera_handle, &get_visible); + ret = legacy_camera_is_display_visible(muse_camera->camera_handle, &get_value); if (ret == CAMERA_ERROR_NONE) { - muse_camera_msg_return1(api, class, ret, module, INT, get_visible); + muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT, + MUSE_CAMERA_GET_INT_DISPLAY_VISIBLE, "get_value", get_value, NULL); } else { muse_camera_msg_return(api, class, ret, module); } @@ -1780,7 +1930,7 @@ int camera_dispatcher_get_display_mode(muse_module_h module) { int ret = CAMERA_ERROR_NONE; muse_camera_handle_s *muse_camera = NULL; - camera_display_mode_e get_mode = CAMERA_DISPLAY_MODE_LETTER_BOX; + camera_display_mode_e get_value = CAMERA_DISPLAY_MODE_LETTER_BOX; muse_camera_api_e api = MUSE_CAMERA_API_GET_DISPLAY_MODE; muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; @@ -1788,9 +1938,10 @@ int camera_dispatcher_get_display_mode(muse_module_h module) LOGD("handle : %p", muse_camera); - ret = legacy_camera_get_display_mode(muse_camera->camera_handle, &get_mode); + ret = legacy_camera_get_display_mode(muse_camera->camera_handle, &get_value); if (ret == CAMERA_ERROR_NONE) { - muse_camera_msg_return1(api, class, ret, module, INT, get_mode); + muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT, + MUSE_CAMERA_GET_INT_DISPLAY_MODE, "get_value", get_value, NULL); } else { muse_camera_msg_return(api, class, ret, module); } @@ -1804,6 +1955,7 @@ int camera_dispatcher_get_capture_resolution(muse_module_h module) muse_camera_handle_s *muse_camera = NULL; int get_width = 0; int get_height = 0; + int get_value = 0; muse_camera_api_e api = MUSE_CAMERA_API_GET_CAPTURE_RESOLUTION; muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; @@ -1813,7 +1965,9 @@ int camera_dispatcher_get_capture_resolution(muse_module_h module) ret = legacy_camera_get_capture_resolution(muse_camera->camera_handle, &get_width, &get_height); if (ret == CAMERA_ERROR_NONE) { - muse_camera_msg_return2(api, class, ret, module, INT, get_width, INT, get_height); + get_value = get_width << 16 | get_height; + muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT, + MUSE_CAMERA_GET_INT_CAPTURE_RESOLUTION, "get_value", get_value, NULL); } else { muse_camera_msg_return(api, class, ret, module); } @@ -1825,7 +1979,7 @@ int camera_dispatcher_get_capture_format(muse_module_h module) { int ret = CAMERA_ERROR_NONE; muse_camera_handle_s *muse_camera = NULL; - camera_pixel_format_e get_format = CAMERA_PIXEL_FORMAT_NV12; + camera_pixel_format_e get_value = CAMERA_PIXEL_FORMAT_NV12; muse_camera_api_e api = MUSE_CAMERA_API_GET_CAPTURE_FORMAT; muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; @@ -1833,9 +1987,10 @@ int camera_dispatcher_get_capture_format(muse_module_h module) LOGD("handle : %p", muse_camera); - ret = legacy_camera_get_capture_format(muse_camera->camera_handle, &get_format); + ret = legacy_camera_get_capture_format(muse_camera->camera_handle, &get_value); if (ret == CAMERA_ERROR_NONE) { - muse_camera_msg_return1(api, class, ret, module, INT, get_format); + muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT, + MUSE_CAMERA_GET_INT_CAPTURE_FORMAT, "get_value", get_value, NULL); } else { muse_camera_msg_return(api, class, ret, module); } @@ -1847,7 +2002,7 @@ int camera_dispatcher_get_preview_format(muse_module_h module) { int ret = CAMERA_ERROR_NONE; muse_camera_handle_s *muse_camera = NULL; - camera_pixel_format_e get_format = CAMERA_PIXEL_FORMAT_NV12; + camera_pixel_format_e get_value = CAMERA_PIXEL_FORMAT_NV12; muse_camera_api_e api = MUSE_CAMERA_API_GET_PREVIEW_FORMAT; muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; @@ -1855,9 +2010,10 @@ int camera_dispatcher_get_preview_format(muse_module_h module) LOGD("handle : %p", muse_camera); - ret = legacy_camera_get_preview_format(muse_camera->camera_handle, &get_format); + ret = legacy_camera_get_preview_format(muse_camera->camera_handle, &get_value); if (ret == CAMERA_ERROR_NONE) { - muse_camera_msg_return1(api, class, ret, module, INT, get_format); + muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT, + MUSE_CAMERA_GET_INT_PREVIEW_FORMAT, "get_value", get_value, NULL); } else { muse_camera_msg_return(api, class, ret, module); } @@ -1869,7 +2025,7 @@ int camera_dispatcher_get_facing_direction(muse_module_h module) { int ret = CAMERA_ERROR_NONE; muse_camera_handle_s *muse_camera = NULL; - camera_facing_direction_e get_facing_direction = CAMERA_FACING_DIRECTION_REAR; + camera_facing_direction_e get_value = CAMERA_FACING_DIRECTION_REAR; muse_camera_api_e api = MUSE_CAMERA_API_GET_FACING_DIRECTION; muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; @@ -1877,9 +2033,10 @@ int camera_dispatcher_get_facing_direction(muse_module_h module) LOGD("handle : %p", muse_camera); - ret = legacy_camera_get_facing_direction(muse_camera->camera_handle, &get_facing_direction); + ret = legacy_camera_get_facing_direction(muse_camera->camera_handle, &get_value); if (ret == CAMERA_ERROR_NONE) { - muse_camera_msg_return1(api, class, ret, module, INT, get_facing_direction); + muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT, + MUSE_CAMERA_GET_INT_FACING_DIRECTION, "get_value", get_value, NULL); } else { muse_camera_msg_return(api, class, ret, module); } @@ -1913,7 +2070,7 @@ int camera_dispatcher_get_flash_state(muse_module_h module) if (ret != CAMERA_ERROR_NONE) { LOGE("failed to create camera handle 0x%x", ret); - muse_camera_msg_return1(api, class, ret, module, INT, get_flash_state); + muse_camera_msg_return(api, class, ret, module); return MUSE_CAMERA_ERROR_NONE; } @@ -1929,7 +2086,7 @@ int camera_dispatcher_get_flash_state(muse_module_h module) LOGE("count[%d] of supported flash mode is too small, so return NOT_SUPPORTED", count); ret = CAMERA_ERROR_NOT_SUPPORTED; - muse_camera_msg_return1(api, class, ret, module, INT, get_flash_state); + muse_camera_msg_return(api, class, ret, module); return MUSE_CAMERA_ERROR_NONE; } @@ -1939,7 +2096,8 @@ int camera_dispatcher_get_flash_state(muse_module_h module) LOGD("[%d] flash state : %d", device_type, get_flash_state); - muse_camera_msg_return1(api, class, ret, module, INT, get_flash_state); + muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT, + -1, "get_flash_state", get_flash_state, NULL); return MUSE_CAMERA_ERROR_NONE; } @@ -2281,6 +2439,7 @@ int camera_dispatcher_get_recommended_preview_resolution(muse_module_h module) muse_camera_handle_s *muse_camera = NULL; int get_width = 0; int get_height = 0; + int get_value = 0; muse_camera_api_e api = MUSE_CAMERA_API_GET_RECOMMENDED_PREVIEW_RESOLUTION; muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; @@ -2290,7 +2449,9 @@ int camera_dispatcher_get_recommended_preview_resolution(muse_module_h module) ret = legacy_camera_get_recommended_preview_resolution(muse_camera->camera_handle, &get_width, &get_height); if (ret == CAMERA_ERROR_NONE) { - muse_camera_msg_return2(api, class, ret, module, INT, get_width, INT, get_height); + get_value = get_width << 16 | get_height; + muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT, + MUSE_CAMERA_GET_INT_RECOMMENDED_PREVIEW_RESOLUTION, "get_value", get_value, NULL); } else { muse_camera_msg_return(api, class, ret, module); } @@ -2302,7 +2463,7 @@ int camera_dispatcher_attr_get_lens_orientation(muse_module_h module) { int ret = CAMERA_ERROR_NONE; muse_camera_handle_s *muse_camera = NULL; - int get_angle = 0; + int get_value = 0; muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_LENS_ORIENTATION; muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; @@ -2310,9 +2471,10 @@ int camera_dispatcher_attr_get_lens_orientation(muse_module_h module) LOGD("handle : %p", muse_camera); - ret = legacy_camera_attr_get_lens_orientation(muse_camera->camera_handle, &get_angle); + ret = legacy_camera_attr_get_lens_orientation(muse_camera->camera_handle, &get_value); if (ret == CAMERA_ERROR_NONE) { - muse_camera_msg_return1(api, class, ret, module, INT, get_angle); + muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT, + MUSE_CAMERA_GET_INT_LENS_ORIENTATION, "get_value", get_value, NULL); } else { muse_camera_msg_return(api, class, ret, module); } @@ -2345,7 +2507,7 @@ int camera_dispatcher_attr_get_theater_mode(muse_module_h module) { int ret = CAMERA_ERROR_NONE; muse_camera_handle_s *muse_camera = NULL; - camera_attr_theater_mode_e get_mode = CAMERA_ATTR_THEATER_MODE_DISABLE; + camera_attr_theater_mode_e get_value = CAMERA_ATTR_THEATER_MODE_DISABLE; muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_THEATER_MODE; muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; @@ -2353,9 +2515,10 @@ int camera_dispatcher_attr_get_theater_mode(muse_module_h module) LOGD("handle : %p", muse_camera); - ret = legacy_camera_attr_get_theater_mode(muse_camera->camera_handle, &get_mode); + ret = legacy_camera_attr_get_theater_mode(muse_camera->camera_handle, &get_value); if (ret == CAMERA_ERROR_NONE) { - muse_camera_msg_return1(api, class, ret, module, INT, get_mode); + muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT, + MUSE_CAMERA_GET_INT_THEATER_MODE, "get_value", get_value, NULL); } else { muse_camera_msg_return(api, class, ret, module); } @@ -2430,7 +2593,7 @@ int camera_dispatcher_attr_get_preview_fps(muse_module_h module) { int ret = CAMERA_ERROR_NONE; muse_camera_handle_s *muse_camera = NULL; - camera_attr_fps_e get_fps = CAMERA_ATTR_FPS_AUTO; + camera_attr_fps_e get_value = CAMERA_ATTR_FPS_AUTO; muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_PREVIEW_FPS; muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; @@ -2438,9 +2601,10 @@ int camera_dispatcher_attr_get_preview_fps(muse_module_h module) LOGD("handle : %p", muse_camera); - ret = legacy_camera_attr_get_preview_fps(muse_camera->camera_handle, &get_fps); + ret = legacy_camera_attr_get_preview_fps(muse_camera->camera_handle, &get_value); if (ret == CAMERA_ERROR_NONE) { - muse_camera_msg_return1(api, class, ret, module, INT, get_fps); + muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT, + MUSE_CAMERA_GET_INT_PREVIEW_FPS, "get_value", get_value, NULL); } else { muse_camera_msg_return(api, class, ret, module); } @@ -2452,7 +2616,7 @@ int camera_dispatcher_attr_get_image_quality(muse_module_h module) { int ret = CAMERA_ERROR_NONE; muse_camera_handle_s *muse_camera = NULL; - int get_quality = 0; + int get_value = 0; muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_IMAGE_QUALITY; muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; @@ -2460,9 +2624,10 @@ int camera_dispatcher_attr_get_image_quality(muse_module_h module) LOGD("handle : %p", muse_camera); - ret = legacy_camera_attr_get_image_quality(muse_camera->camera_handle, &get_quality); + ret = legacy_camera_attr_get_image_quality(muse_camera->camera_handle, &get_value); if (ret == CAMERA_ERROR_NONE) { - muse_camera_msg_return1(api, class, ret, module, INT, get_quality); + muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT, + MUSE_CAMERA_GET_INT_IMAGE_QUALITY, "get_value", get_value, NULL); } else { muse_camera_msg_return(api, class, ret, module); } @@ -2920,7 +3085,7 @@ int camera_dispatcher_attr_get_zoom(muse_module_h module) { int ret = CAMERA_ERROR_NONE; muse_camera_handle_s *muse_camera = NULL; - int get_zoom = 0; + int get_value = 0; muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ZOOM; muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; @@ -2928,9 +3093,10 @@ int camera_dispatcher_attr_get_zoom(muse_module_h module) LOGD("handle : %p", muse_camera); - ret = legacy_camera_attr_get_zoom(muse_camera->camera_handle, &get_zoom); + ret = legacy_camera_attr_get_zoom(muse_camera->camera_handle, &get_value); if (ret == CAMERA_ERROR_NONE) { - muse_camera_msg_return1(api, class, ret, module, INT, get_zoom); + muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT, + MUSE_CAMERA_GET_INT_ZOOM, "get_value", get_value, NULL); } else { muse_camera_msg_return(api, class, ret, module); } @@ -2942,18 +3108,20 @@ int camera_dispatcher_attr_get_zoom_range(muse_module_h module) { int ret = CAMERA_ERROR_NONE; muse_camera_handle_s *muse_camera = NULL; - int get_min = 0; - int get_max = 0; + int get_value0 = 0; + int get_value1 = 0; muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ZOOM_RANGE; muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; + muse_camera_get_type_e get_type = MUSE_CAMERA_GET_TYPE_INT_PAIR; + muse_camera_get_int_pair_e index = MUSE_CAMERA_GET_INT_PAIR_ZOOM_RANGE; muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module); LOGD("handle : %p", muse_camera); - ret = legacy_camera_attr_get_zoom_range(muse_camera->camera_handle, &get_min, &get_max); + ret = legacy_camera_attr_get_zoom_range(muse_camera->camera_handle, &get_value0, &get_value1); if (ret == CAMERA_ERROR_NONE) { - muse_camera_msg_return2(api, class, ret, module, INT, get_min, INT, get_max); + muse_camera_msg_return2(api, class, ret, module, get_type, index, get_value0, get_value1); } else { muse_camera_msg_return(api, class, ret, module); } @@ -2965,7 +3133,7 @@ int camera_dispatcher_attr_get_af_mode(muse_module_h module) { int ret = CAMERA_ERROR_NONE; muse_camera_handle_s *muse_camera = NULL; - camera_attr_af_mode_e get_mode = CAMERA_ATTR_AF_NONE; + camera_attr_af_mode_e get_value = CAMERA_ATTR_AF_NONE; muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_AF_MODE; muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; @@ -2973,9 +3141,10 @@ int camera_dispatcher_attr_get_af_mode(muse_module_h module) LOGD("handle : %p", muse_camera); - ret = legacy_camera_attr_get_af_mode(muse_camera->camera_handle, &get_mode); + ret = legacy_camera_attr_get_af_mode(muse_camera->camera_handle, &get_value); if (ret == CAMERA_ERROR_NONE) { - muse_camera_msg_return1(api, class, ret, module, INT, get_mode); + muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT, + MUSE_CAMERA_GET_INT_AF_MODE, "get_value", get_value, NULL); } else { muse_camera_msg_return(api, class, ret, module); } @@ -2987,7 +3156,7 @@ int camera_dispatcher_attr_get_exposure_mode(muse_module_h module) { int ret = CAMERA_ERROR_NONE; muse_camera_handle_s *muse_camera = NULL; - camera_attr_exposure_mode_e get_mode = CAMERA_ATTR_EXPOSURE_MODE_OFF; + camera_attr_exposure_mode_e get_value = CAMERA_ATTR_EXPOSURE_MODE_OFF; muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE_MODE; muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; @@ -2995,9 +3164,10 @@ int camera_dispatcher_attr_get_exposure_mode(muse_module_h module) LOGD("handle : %p", muse_camera); - ret = legacy_camera_attr_get_exposure_mode(muse_camera->camera_handle, &get_mode); + ret = legacy_camera_attr_get_exposure_mode(muse_camera->camera_handle, &get_value); if (ret == CAMERA_ERROR_NONE) { - muse_camera_msg_return1(api, class, ret, module, INT, get_mode); + muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT, + MUSE_CAMERA_GET_INT_EXPOSURE_MODE, "get_value", get_value, NULL); } else { muse_camera_msg_return(api, class, ret, module); } @@ -3019,7 +3189,8 @@ int camera_dispatcher_attr_get_exposure(muse_module_h module) ret = legacy_camera_attr_get_exposure(muse_camera->camera_handle, &get_value); if (ret == CAMERA_ERROR_NONE) { - muse_camera_msg_return1(api, class, ret, module, INT, get_value); + muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT, + MUSE_CAMERA_GET_INT_EXPOSURE, "get_value", get_value, NULL); } else { muse_camera_msg_return(api, class, ret, module); } @@ -3031,18 +3202,20 @@ int camera_dispatcher_attr_get_exposure_range(muse_module_h module) { int ret = CAMERA_ERROR_NONE; muse_camera_handle_s *muse_camera = NULL; - int get_min = 0; - int get_max = 0; + int get_value0 = 0; + int get_value1 = 0; muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXPOSURE_RANGE; muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; + muse_camera_get_type_e get_type = MUSE_CAMERA_GET_TYPE_INT_PAIR; + muse_camera_get_int_pair_e index = MUSE_CAMERA_GET_INT_PAIR_EXPOSURE_RANGE; muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module); LOGD("handle : %p", muse_camera); - ret = legacy_camera_attr_get_exposure_range(muse_camera->camera_handle, &get_min, &get_max); + ret = legacy_camera_attr_get_exposure_range(muse_camera->camera_handle, &get_value0, &get_value1); if (ret == CAMERA_ERROR_NONE) { - muse_camera_msg_return2(api, class, ret, module, INT, get_min, INT, get_max); + muse_camera_msg_return2(api, class, ret, module, get_type, index, get_value0, get_value1); } else { muse_camera_msg_return(api, class, ret, module); } @@ -3054,7 +3227,7 @@ int camera_dispatcher_attr_get_iso(muse_module_h module) { int ret = CAMERA_ERROR_NONE; muse_camera_handle_s *muse_camera = NULL; - camera_attr_iso_e get_iso = CAMERA_ATTR_ISO_AUTO; + camera_attr_iso_e get_value = CAMERA_ATTR_ISO_AUTO; muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ISO; muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; @@ -3062,9 +3235,10 @@ int camera_dispatcher_attr_get_iso(muse_module_h module) LOGD("handle : %p", muse_camera); - ret = legacy_camera_attr_get_iso(muse_camera->camera_handle, &get_iso); + ret = legacy_camera_attr_get_iso(muse_camera->camera_handle, &get_value); if (ret == CAMERA_ERROR_NONE) { - muse_camera_msg_return1(api, class, ret, module, INT, get_iso); + muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT, + MUSE_CAMERA_GET_INT_ISO, "get_value", get_value, NULL); } else { muse_camera_msg_return(api, class, ret, module); } @@ -3076,7 +3250,7 @@ int camera_dispatcher_attr_get_brightness(muse_module_h module) { int ret = CAMERA_ERROR_NONE; muse_camera_handle_s *muse_camera = NULL; - int get_level = 0; + int get_value = 0; muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_BRIGHTNESS; muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; @@ -3084,9 +3258,10 @@ int camera_dispatcher_attr_get_brightness(muse_module_h module) LOGD("handle : %p", muse_camera); - ret = legacy_camera_attr_get_brightness(muse_camera->camera_handle, &get_level); + ret = legacy_camera_attr_get_brightness(muse_camera->camera_handle, &get_value); if (ret == CAMERA_ERROR_NONE) { - muse_camera_msg_return1(api, class, ret, module, INT, get_level); + muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT, + MUSE_CAMERA_GET_INT_BRIGHTNESS, "get_value", get_value, NULL); } else { muse_camera_msg_return(api, class, ret, module); } @@ -3098,18 +3273,20 @@ int camera_dispatcher_attr_get_brightness_range(muse_module_h module) { int ret = CAMERA_ERROR_NONE; muse_camera_handle_s *muse_camera = NULL; - int get_min = 0; - int get_max = 0; + int get_value0 = 0; + int get_value1 = 0; muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_BRIGHTNESS_RANGE; muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; + muse_camera_get_type_e get_type = MUSE_CAMERA_GET_TYPE_INT_PAIR; + muse_camera_get_int_pair_e index = MUSE_CAMERA_GET_INT_PAIR_BRIGHTNESS_RANGE; muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module); LOGD("handle : %p", muse_camera); - ret = legacy_camera_attr_get_brightness_range(muse_camera->camera_handle, &get_min, &get_max); + ret = legacy_camera_attr_get_brightness_range(muse_camera->camera_handle, &get_value0, &get_value1); if (ret == CAMERA_ERROR_NONE) { - muse_camera_msg_return2(api, class, ret, module, INT, get_min, INT, get_max); + muse_camera_msg_return2(api, class, ret, module, get_type, index, get_value0, get_value1); } else { muse_camera_msg_return(api, class, ret, module); } @@ -3121,7 +3298,7 @@ int camera_dispatcher_attr_get_contrast(muse_module_h module) { int ret = CAMERA_ERROR_NONE; muse_camera_handle_s *muse_camera = NULL; - int get_level = 0; + int get_value = 0; muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_CONTRAST; muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; @@ -3129,9 +3306,10 @@ int camera_dispatcher_attr_get_contrast(muse_module_h module) LOGD("handle : %p", muse_camera); - ret = legacy_camera_attr_get_contrast(muse_camera->camera_handle, &get_level); + ret = legacy_camera_attr_get_contrast(muse_camera->camera_handle, &get_value); if (ret == CAMERA_ERROR_NONE) { - muse_camera_msg_return1(api, class, ret, module, INT, get_level); + muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT, + MUSE_CAMERA_GET_INT_CONTRAST, "get_value", get_value, NULL); } else { muse_camera_msg_return(api, class, ret, module); } @@ -3143,18 +3321,20 @@ int camera_dispatcher_attr_get_contrast_range(muse_module_h module) { int ret = CAMERA_ERROR_NONE; muse_camera_handle_s *muse_camera = NULL; - int get_min = 0; - int get_max = 0; + int get_value0 = 0; + int get_value1 = 0; muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_CONTRAST_RANGE; muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; + muse_camera_get_type_e get_type = MUSE_CAMERA_GET_TYPE_INT_PAIR; + muse_camera_get_int_pair_e index = MUSE_CAMERA_GET_INT_PAIR_CONTRAST_RANGE; muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module); LOGD("handle : %p", muse_camera); - ret = legacy_camera_attr_get_contrast_range(muse_camera->camera_handle, &get_min, &get_max); + ret = legacy_camera_attr_get_contrast_range(muse_camera->camera_handle, &get_value0, &get_value1); if (ret == CAMERA_ERROR_NONE) { - muse_camera_msg_return2(api, class, ret, module, INT, get_min, INT, get_max); + muse_camera_msg_return2(api, class, ret, module, get_type, index, get_value0, get_value1); } else { muse_camera_msg_return(api, class, ret, module); } @@ -3166,7 +3346,7 @@ int camera_dispatcher_attr_get_whitebalance(muse_module_h module) { int ret = CAMERA_ERROR_NONE; muse_camera_handle_s *muse_camera = NULL; - camera_attr_whitebalance_e get_wb = CAMERA_ATTR_WHITE_BALANCE_NONE; + camera_attr_whitebalance_e get_value = CAMERA_ATTR_WHITE_BALANCE_NONE; muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_WHITEBALANCE; muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; @@ -3174,9 +3354,10 @@ int camera_dispatcher_attr_get_whitebalance(muse_module_h module) LOGD("handle : %p", muse_camera); - ret = legacy_camera_attr_get_whitebalance(muse_camera->camera_handle, &get_wb); + ret = legacy_camera_attr_get_whitebalance(muse_camera->camera_handle, &get_value); if (ret == CAMERA_ERROR_NONE) { - muse_camera_msg_return1(api, class, ret, module, INT, get_wb); + muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT, + MUSE_CAMERA_GET_INT_WHITE_BALANCE, "get_value", get_value, NULL); } else { muse_camera_msg_return(api, class, ret, module); } @@ -3188,7 +3369,7 @@ int camera_dispatcher_attr_get_effect(muse_module_h module) { int ret = CAMERA_ERROR_NONE; muse_camera_handle_s *muse_camera = NULL; - camera_attr_effect_mode_e get_effect = CAMERA_ATTR_EFFECT_NONE; + camera_attr_effect_mode_e get_value = CAMERA_ATTR_EFFECT_NONE; muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EFFECT; muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; @@ -3196,9 +3377,10 @@ int camera_dispatcher_attr_get_effect(muse_module_h module) LOGD("handle : %p", muse_camera); - ret = legacy_camera_attr_get_effect(muse_camera->camera_handle, &get_effect); + ret = legacy_camera_attr_get_effect(muse_camera->camera_handle, &get_value); if (ret == CAMERA_ERROR_NONE) { - muse_camera_msg_return1(api, class, ret, module, INT, get_effect); + muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT, + MUSE_CAMERA_GET_INT_EFFECT, "get_value", get_value, NULL); } else { muse_camera_msg_return(api, class, ret, module); } @@ -3210,7 +3392,7 @@ int camera_dispatcher_attr_get_scene_mode(muse_module_h module) { int ret = CAMERA_ERROR_NONE; muse_camera_handle_s *muse_camera = NULL; - camera_attr_scene_mode_e get_mode = CAMERA_ATTR_SCENE_MODE_NORMAL; + camera_attr_scene_mode_e get_value = CAMERA_ATTR_SCENE_MODE_NORMAL; muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_SCENE_MODE; muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; @@ -3218,9 +3400,10 @@ int camera_dispatcher_attr_get_scene_mode(muse_module_h module) LOGD("handle : %p", muse_camera); - ret = legacy_camera_attr_get_scene_mode(muse_camera->camera_handle, &get_mode); + ret = legacy_camera_attr_get_scene_mode(muse_camera->camera_handle, &get_value); if (ret == CAMERA_ERROR_NONE) { - muse_camera_msg_return1(api, class, ret, module, INT, get_mode); + muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT, + MUSE_CAMERA_GET_INT_SCENE_MODE, "get_value", get_value, NULL); } else { muse_camera_msg_return(api, class, ret, module); } @@ -3232,7 +3415,7 @@ int camera_dispatcher_attr_is_enabled_tag(muse_module_h module) { int ret = CAMERA_ERROR_NONE; muse_camera_handle_s *muse_camera = NULL; - bool get_enabled = false; + bool get_value = false; muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_TAG; muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; @@ -3240,9 +3423,10 @@ int camera_dispatcher_attr_is_enabled_tag(muse_module_h module) LOGD("handle : %p", muse_camera); - ret = legacy_camera_attr_is_enabled_tag(muse_camera->camera_handle, &get_enabled); + ret = legacy_camera_attr_is_enabled_tag(muse_camera->camera_handle, &get_value); if (ret == CAMERA_ERROR_NONE) { - muse_camera_msg_return1(api, class, ret, module, INT, get_enabled); + muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT, + MUSE_CAMERA_GET_INT_ENABLED_TAG, "get_value", get_value, NULL); } else { muse_camera_msg_return(api, class, ret, module); } @@ -3256,21 +3440,22 @@ int camera_dispatcher_attr_get_tag_image_description(muse_module_h module) muse_camera_handle_s *muse_camera = NULL; muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_IMAGE_DESCRIPTION; muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; - char *get_description = NULL; + char *get_value = NULL; muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module); - ret = legacy_camera_attr_get_tag_image_description(muse_camera->camera_handle, &get_description); + ret = legacy_camera_attr_get_tag_image_description(muse_camera->camera_handle, &get_value); if (ret == CAMERA_ERROR_NONE) { - LOGD("get_description : %s", muse_camera, get_description); - muse_camera_msg_return1(api, class, ret, module, STRING, get_description); + LOGD("get_description : %s", muse_camera, get_value); + muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_STRING, + MUSE_CAMERA_GET_STRING_TAG_IMAGE_DESCRIPTION, "get_value", 0, get_value); } else { muse_camera_msg_return(api, class, ret, module); } - if (get_description) { - free(get_description); - get_description = NULL; + if (get_value) { + free(get_value); + get_value = NULL; } return MUSE_CAMERA_ERROR_NONE; @@ -3280,7 +3465,7 @@ int camera_dispatcher_attr_get_tag_orientation(muse_module_h module) { int ret = CAMERA_ERROR_NONE; muse_camera_handle_s *muse_camera = NULL; - camera_attr_tag_orientation_e get_orientation = CAMERA_ATTR_TAG_ORIENTATION_TOP_LEFT; + camera_attr_tag_orientation_e get_value = CAMERA_ATTR_TAG_ORIENTATION_TOP_LEFT; muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_ORIENTATION; muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; @@ -3288,9 +3473,10 @@ int camera_dispatcher_attr_get_tag_orientation(muse_module_h module) LOGD("handle : %p", muse_camera); - ret = legacy_camera_attr_get_tag_orientation(muse_camera->camera_handle, &get_orientation); + ret = legacy_camera_attr_get_tag_orientation(muse_camera->camera_handle, &get_value); if (ret == CAMERA_ERROR_NONE) { - muse_camera_msg_return1(api, class, ret, module, INT, get_orientation); + muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT, + MUSE_CAMERA_GET_INT_TAG_ORIENTATION, "get_value", get_value, NULL); } else { muse_camera_msg_return(api, class, ret, module); } @@ -3304,21 +3490,22 @@ int camera_dispatcher_attr_get_tag_software(muse_module_h module) muse_camera_handle_s *muse_camera = NULL; muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TAG_SOFTWARE; muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; - char *get_software = NULL; + char *get_value = NULL; muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module); - ret = legacy_camera_attr_get_tag_software(muse_camera->camera_handle, &get_software); + ret = legacy_camera_attr_get_tag_software(muse_camera->camera_handle, &get_value); if (ret == CAMERA_ERROR_NONE) { - LOGD("get_software : %s", get_software); - muse_camera_msg_return1(api, class, ret, module, STRING, get_software); + LOGD("get_software : %s", get_value); + muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_STRING, + MUSE_CAMERA_GET_STRING_TAG_SOFTWARE, "get_value", 0, get_value); } else { muse_camera_msg_return(api, class, ret, module); } - if (get_software) { - free(get_software); - get_software = NULL; + if (get_value) { + free(get_value); + get_value = NULL; } return MUSE_CAMERA_ERROR_NONE; @@ -3330,15 +3517,26 @@ int camera_dispatcher_attr_get_geotag(muse_module_h module) muse_camera_handle_s *muse_camera = NULL; muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_GEOTAG; muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; - double get_geotag[3] = {0.0, 0.0, 0.0}; + double get_value[3] = {0.0, 0.0, 0.0}; + char *send_msg = NULL; + int msg_array_size = 0; muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module); LOGD("handle : %p", muse_camera); - ret = legacy_camera_attr_get_geotag(muse_camera->camera_handle, &get_geotag[0], &get_geotag[1], &get_geotag[2]); + ret = legacy_camera_attr_get_geotag(muse_camera->camera_handle, &get_value[0], &get_value[1], &get_value[2]); if (ret == CAMERA_ERROR_NONE) { - muse_camera_msg_return_array(api, class, ret, module, get_geotag, sizeof(get_geotag), sizeof(double)); + msg_array_size = sizeof(get_value) / sizeof(int) + (sizeof(get_value) % sizeof(int) ? 1 : 0); + + send_msg = muse_core_msg_json_factory_new(api, + MUSE_TYPE_INT, PARAM_API_CLASS, class, + MUSE_TYPE_INT, PARAM_RET, ret, + MUSE_TYPE_INT, PARAM_GET_TYPE, MUSE_CAMERA_GET_TYPE_ARRAY, + MUSE_TYPE_ARRAY, "get_value", msg_array_size, get_value, + 0); + + __camera_dispatcher_send_msg(module, send_msg); } else { muse_camera_msg_return(api, class, ret, module); } @@ -3350,7 +3548,7 @@ int camera_dispatcher_attr_get_flash_mode(muse_module_h module) { int ret = CAMERA_ERROR_NONE; muse_camera_handle_s *muse_camera = NULL; - camera_attr_flash_mode_e get_mode = CAMERA_ATTR_FLASH_MODE_OFF; + camera_attr_flash_mode_e get_value = CAMERA_ATTR_FLASH_MODE_OFF; muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_FLASH_MODE; muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; @@ -3358,9 +3556,10 @@ int camera_dispatcher_attr_get_flash_mode(muse_module_h module) LOGD("handle : %p", muse_camera); - ret = legacy_camera_attr_get_flash_mode(muse_camera->camera_handle, &get_mode); + ret = legacy_camera_attr_get_flash_mode(muse_camera->camera_handle, &get_value); if (ret == CAMERA_ERROR_NONE) { - muse_camera_msg_return1(api, class, ret, module, INT, get_mode); + muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT, + MUSE_CAMERA_GET_INT_FLASH_MODE, "get_value", get_value, NULL); } else { muse_camera_msg_return(api, class, ret, module); } @@ -3648,15 +3847,16 @@ int camera_dispatcher_attr_get_stream_rotation(muse_module_h module) muse_camera_handle_s *muse_camera = NULL; muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_STREAM_ROTATION; muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; - camera_rotation_e get_rotation = CAMERA_ROTATION_NONE; + camera_rotation_e get_value = CAMERA_ROTATION_NONE; muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module); LOGD("handle : %p", muse_camera); - ret = legacy_camera_attr_get_stream_rotation(muse_camera->camera_handle, &get_rotation); + ret = legacy_camera_attr_get_stream_rotation(muse_camera->camera_handle, &get_value); if (ret == CAMERA_ERROR_NONE) { - muse_camera_msg_return1(api, class, ret, module, INT, get_rotation); + muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT, + MUSE_CAMERA_GET_INT_STREAM_ROTATION, "get_value", get_value, NULL); } else { muse_camera_msg_return(api, class, ret, module); } @@ -3693,15 +3893,16 @@ int camera_dispatcher_attr_get_stream_flip(muse_module_h module) muse_camera_handle_s *muse_camera = NULL; muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_STREAM_FLIP; muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; - camera_flip_e get_flip = CAMERA_FLIP_NONE; + camera_flip_e get_value = CAMERA_FLIP_NONE; muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module); LOGD("handle : %p", muse_camera); - ret = legacy_camera_attr_get_stream_flip(muse_camera->camera_handle, &get_flip); + ret = legacy_camera_attr_get_stream_flip(muse_camera->camera_handle, &get_value); if (ret == CAMERA_ERROR_NONE) { - muse_camera_msg_return1(api, class, ret, module, INT, get_flip); + muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT, + MUSE_CAMERA_GET_INT_STREAM_FLIP, "get_value", get_value, NULL); } else { muse_camera_msg_return(api, class, ret, module); } @@ -3738,15 +3939,16 @@ int camera_dispatcher_attr_get_hdr_mode(muse_module_h module) muse_camera_handle_s *muse_camera = NULL; muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_HDR_MODE; muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; - camera_attr_hdr_mode_e get_mode = CAMERA_ATTR_HDR_MODE_DISABLE; + camera_attr_hdr_mode_e get_value = CAMERA_ATTR_HDR_MODE_DISABLE; muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module); LOGD("handle : %p", muse_camera); - ret = legacy_camera_attr_get_hdr_mode(muse_camera->camera_handle, &get_mode); + ret = legacy_camera_attr_get_hdr_mode(muse_camera->camera_handle, &get_value); if (ret == CAMERA_ERROR_NONE) { - muse_camera_msg_return1(api, class, ret, module, INT, get_mode); + muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT, + MUSE_CAMERA_GET_INT_HDR_MODE, "get_value", get_value, NULL); } else { muse_camera_msg_return(api, class, ret, module); } @@ -3845,15 +4047,16 @@ int camera_dispatcher_attr_is_enabled_anti_shake(muse_module_h module) muse_camera_handle_s *muse_camera = NULL; muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_ANTI_SHAKE; muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; - bool get_enabled = false; + bool get_value = false; muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module); LOGD("handle : %p", muse_camera); - ret = legacy_camera_attr_is_enabled_anti_shake(muse_camera->camera_handle, &get_enabled); + ret = legacy_camera_attr_is_enabled_anti_shake(muse_camera->camera_handle, &get_value); if (ret == CAMERA_ERROR_NONE) { - muse_camera_msg_return1(api, class, ret, module, INT, get_enabled); + muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT, + MUSE_CAMERA_GET_INT_ENABLED_ANTI_SHAKE, "get_value", get_value, NULL); } else { muse_camera_msg_return(api, class, ret, module); } @@ -3910,15 +4113,16 @@ int camera_dispatcher_attr_is_enabled_video_stabilization(muse_module_h module) muse_camera_handle_s *muse_camera = NULL; muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_VIDEO_STABILIZATION; muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; - bool get_enabled = false; + bool get_value = false; muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module); LOGD("handle : %p", muse_camera); - ret = legacy_camera_attr_is_enabled_video_stabilization(muse_camera->camera_handle, &get_enabled); + ret = legacy_camera_attr_is_enabled_video_stabilization(muse_camera->camera_handle, &get_value); if (ret == CAMERA_ERROR_NONE) { - muse_camera_msg_return1(api, class, ret, module, INT, get_enabled); + muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT, + MUSE_CAMERA_GET_INT_ENABLED_VIDEO_STABILIZATION, "get_value", get_value, NULL); } else { muse_camera_msg_return(api, class, ret, module); } @@ -3975,15 +4179,16 @@ int camera_dispatcher_attr_is_enabled_auto_contrast(muse_module_h module) muse_camera_handle_s *muse_camera = NULL; muse_camera_api_e api = MUSE_CAMERA_API_ATTR_IS_ENABLED_AUTO_CONTRAST; muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; - bool get_enabled = false; + bool get_value = false; muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module); LOGD("handle : %p", muse_camera); - ret = legacy_camera_attr_is_enabled_auto_contrast(muse_camera->camera_handle, &get_enabled); + ret = legacy_camera_attr_is_enabled_auto_contrast(muse_camera->camera_handle, &get_value); if (ret == CAMERA_ERROR_NONE) { - muse_camera_msg_return1(api, class, ret, module, INT, get_enabled); + muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT, + MUSE_CAMERA_GET_INT_ENABLED_AUTO_CONTRAST, "get_value", get_value, NULL); } else { muse_camera_msg_return(api, class, ret, module); } @@ -4038,7 +4243,7 @@ int camera_dispatcher_attr_get_encoded_preview_bitrate(muse_module_h module) { int ret = CAMERA_ERROR_NONE; muse_camera_handle_s *muse_camera = NULL; - int get_bitrate; + int get_value = 0; muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ENCODED_PREVIEW_BITRATE; muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; @@ -4046,9 +4251,10 @@ int camera_dispatcher_attr_get_encoded_preview_bitrate(muse_module_h module) LOGD("handle : %p", muse_camera); - ret = legacy_camera_attr_get_encoded_preview_bitrate(muse_camera->camera_handle, &get_bitrate); + ret = legacy_camera_attr_get_encoded_preview_bitrate(muse_camera->camera_handle, &get_value); if (ret == CAMERA_ERROR_NONE) { - muse_camera_msg_return1(api, class, ret, module, INT, get_bitrate); + muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT, + MUSE_CAMERA_GET_INT_ENCODED_PREVIEW_BITRATE, "get_value", get_value, NULL); } else { muse_camera_msg_return(api, class, ret, module); } @@ -4083,7 +4289,7 @@ int camera_dispatcher_attr_get_encoded_preview_gop_interval(muse_module_h module { int ret = CAMERA_ERROR_NONE; muse_camera_handle_s *muse_camera = NULL; - int get_gop_interval; + int get_value; muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_ENCODED_PREVIEW_GOP_INTERVAL; muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; @@ -4091,9 +4297,10 @@ int camera_dispatcher_attr_get_encoded_preview_gop_interval(muse_module_h module LOGD("handle : %p", muse_camera); - ret = legacy_camera_attr_get_encoded_preview_gop_interval(muse_camera->camera_handle, &get_gop_interval); + ret = legacy_camera_attr_get_encoded_preview_gop_interval(muse_camera->camera_handle, &get_value); if (ret == CAMERA_ERROR_NONE) { - muse_camera_msg_return1(api, class, ret, module, INT, get_gop_interval); + muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT, + MUSE_CAMERA_GET_INT_ENCODED_PREVIEW_GOP_INTERVAL, "get_value", get_value, NULL); } else { muse_camera_msg_return(api, class, ret, module); } @@ -4156,7 +4363,7 @@ int camera_dispatcher_attr_get_pan(muse_module_h module) { int ret = CAMERA_ERROR_NONE; muse_camera_handle_s *muse_camera = NULL; - int get_pan_step = 0; + int get_value = 0; muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_PAN; muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; @@ -4164,9 +4371,10 @@ int camera_dispatcher_attr_get_pan(muse_module_h module) LOGD("handle : %p", muse_camera); - ret = legacy_camera_attr_get_pan(muse_camera->camera_handle, &get_pan_step); + ret = legacy_camera_attr_get_pan(muse_camera->camera_handle, &get_value); if (ret == CAMERA_ERROR_NONE) { - muse_camera_msg_return1(api, class, ret, module, INT, get_pan_step); + muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT, + MUSE_CAMERA_GET_INT_PAN, "get_value", get_value, NULL); } else { muse_camera_msg_return(api, class, ret, module); } @@ -4178,18 +4386,20 @@ int camera_dispatcher_attr_get_pan_range(muse_module_h module) { int ret = CAMERA_ERROR_NONE; muse_camera_handle_s *muse_camera = NULL; - int get_min = 0; - int get_max = 0; + int get_value0 = 0; + int get_value1 = 0; muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_PAN_RANGE; muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; + muse_camera_get_type_e get_type = MUSE_CAMERA_GET_TYPE_INT_PAIR; + muse_camera_get_int_pair_e index = MUSE_CAMERA_GET_INT_PAIR_PAN_RANGE; muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module); LOGD("handle : %p", muse_camera); - ret = legacy_camera_attr_get_pan_range(muse_camera->camera_handle, &get_min, &get_max); + ret = legacy_camera_attr_get_pan_range(muse_camera->camera_handle, &get_value0, &get_value1); if (ret == CAMERA_ERROR_NONE) { - muse_camera_msg_return2(api, class, ret, module, INT, get_min, INT, get_max); + muse_camera_msg_return2(api, class, ret, module, get_type, index, get_value0, get_value1); } else { muse_camera_msg_return(api, class, ret, module); } @@ -4229,7 +4439,7 @@ int camera_dispatcher_attr_get_tilt(muse_module_h module) { int ret = CAMERA_ERROR_NONE; muse_camera_handle_s *muse_camera = NULL; - int get_tilt_step = 0; + int get_value = 0; muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TILT; muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; @@ -4237,9 +4447,10 @@ int camera_dispatcher_attr_get_tilt(muse_module_h module) LOGD("handle : %p", muse_camera); - ret = legacy_camera_attr_get_tilt(muse_camera->camera_handle, &get_tilt_step); + ret = legacy_camera_attr_get_tilt(muse_camera->camera_handle, &get_value); if (ret == CAMERA_ERROR_NONE) { - muse_camera_msg_return1(api, class, ret, module, INT, get_tilt_step); + muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT, + MUSE_CAMERA_GET_INT_TILT, "get_value", get_value, NULL); } else { muse_camera_msg_return(api, class, ret, module); } @@ -4251,18 +4462,20 @@ int camera_dispatcher_attr_get_tilt_range(muse_module_h module) { int ret = CAMERA_ERROR_NONE; muse_camera_handle_s *muse_camera = NULL; - int get_min = 0; - int get_max = 0; + int get_value0 = 0; + int get_value1 = 0; muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_TILT_RANGE; muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; + muse_camera_get_type_e get_type = MUSE_CAMERA_GET_TYPE_INT_PAIR; + muse_camera_get_int_pair_e index = MUSE_CAMERA_GET_INT_PAIR_TILT_RANGE; muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module); LOGD("handle : %p", muse_camera); - ret = legacy_camera_attr_get_tilt_range(muse_camera->camera_handle, &get_min, &get_max); + ret = legacy_camera_attr_get_tilt_range(muse_camera->camera_handle, &get_value0, &get_value1); if (ret == CAMERA_ERROR_NONE) { - muse_camera_msg_return2(api, class, ret, module, INT, get_min, INT, get_max); + muse_camera_msg_return2(api, class, ret, module, get_type, index, get_value0, get_value1); } else { muse_camera_msg_return(api, class, ret, module); } @@ -4343,17 +4556,25 @@ int camera_dispatcher_attr_get_display_roi_area(muse_module_h module) { int ret = CAMERA_ERROR_NONE; muse_camera_handle_s *muse_camera = NULL; - int get_display_roi_area[4] = {0,}; + int get_value[4] = {0,}; muse_camera_api_e api = MUSE_CAMERA_API_GET_DISPLAY_ROI_AREA; muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; + char *send_msg = NULL; muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module); LOGD("handle : %p", muse_camera); - ret = legacy_camera_attr_get_display_roi_area(muse_camera->camera_handle, get_display_roi_area); + ret = legacy_camera_attr_get_display_roi_area(muse_camera->camera_handle, get_value); if (ret == CAMERA_ERROR_NONE) { - muse_camera_msg_return_array(api, class, ret, module, get_display_roi_area, sizeof(get_display_roi_area), sizeof(int)); + send_msg = muse_core_msg_json_factory_new(api, + MUSE_TYPE_INT, PARAM_API_CLASS, class, + MUSE_TYPE_INT, PARAM_RET, ret, + MUSE_TYPE_INT, PARAM_GET_TYPE, MUSE_CAMERA_GET_TYPE_ARRAY, + MUSE_TYPE_ARRAY, "get_value", 4, get_value, + 0); + + __camera_dispatcher_send_msg(module, send_msg); } else { muse_camera_msg_return(api, class, ret, module); } @@ -4427,17 +4648,18 @@ int camera_dispatcher_set_display_reuse_hint(muse_module_h module) int camera_dispatcher_get_display_reuse_hint(muse_module_h module) { int ret = CAMERA_ERROR_NONE; - int get_hint = 0; + int get_value = 0; muse_camera_handle_s *muse_camera = NULL; muse_camera_api_e api = MUSE_CAMERA_API_GET_DISPLAY_REUSE_HINT; muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module); - ret = legacy_camera_get_display_reuse_hint(muse_camera->camera_handle, &get_hint); + ret = legacy_camera_get_display_reuse_hint(muse_camera->camera_handle, &get_value); if (ret == CAMERA_ERROR_NONE) { - LOGD("get hint : %d", get_hint); - muse_camera_msg_return1(api, class, ret, module, INT, get_hint); + LOGD("hint : %d", get_value); + muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT, + MUSE_CAMERA_GET_INT_DISPLAY_REUSE_HINT, "get_value", get_value, NULL); } else { muse_camera_msg_return(api, class, ret, module); } @@ -4483,7 +4705,8 @@ int camera_dispatcher_get_device_state(muse_module_h module) LOGD("device[%d] state : %d", device_type, get_device_state); - muse_camera_msg_return1(api, class, ret, module, INT, get_device_state); + muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_INT, + -1, "get_device_state", get_device_state, NULL); return MUSE_CAMERA_ERROR_NONE; } diff --git a/packaging/mmsvc-camera.spec b/packaging/mmsvc-camera.spec index ff1b6ef..1277f04 100644 --- a/packaging/mmsvc-camera.spec +++ b/packaging/mmsvc-camera.spec @@ -1,6 +1,6 @@ Name: mmsvc-camera Summary: A Camera module for muse server -Version: 0.2.54 +Version: 0.2.55 Release: 0 Group: Multimedia/Libraries License: Apache-2.0 -- 2.7.4 From a7f5644c9e643a3d075b1d66d8092c944b89e330 Mon Sep 17 00:00:00 2001 From: Jeongmo Yang Date: Thu, 10 Nov 2016 19:32:07 +0900 Subject: [PATCH 16/16] Add task thread for some APIs related preview restart internally The timeout could be occurred in camerasrc if app sets preview callback and call some APIs related preview restart internally, because, for restarting preview, all camera buffers should be returned to camerasrc, but, return buffer event can not be processed while calling some APIs which restarts preview internally.(deadlock) so, added task thread and the APIs are processed in the task thread to process return buffer event immediately. [Version] 0.2.56 [Profile] Common [Issue Type] Update [Dependency module] N/A [Test] [M(T) - Boot=(OK), sdb=(OK), Home=(OK), Touch=(OK), Version=tizen-mobile_20161110.1] Change-Id: I6a55b0aa5f71f6595b75bce823f71c35b1a61287 Signed-off-by: Jeongmo Yang --- muse/include/muse_camera_internal.h | 14 ++ muse/src/muse_camera_dispatcher.c | 253 ++++++++++++++++++++++++++++-------- packaging/mmsvc-camera.spec | 2 +- 3 files changed, 212 insertions(+), 57 deletions(-) diff --git a/muse/include/muse_camera_internal.h b/muse/include/muse_camera_internal.h index 6c92e98..dc85d9f 100644 --- a/muse/include/muse_camera_internal.h +++ b/muse/include/muse_camera_internal.h @@ -26,6 +26,7 @@ extern "C" { * @brief This file contains the muse camera internal API for framework, related structures and enumerations. */ +#include #include #include @@ -36,6 +37,13 @@ extern "C" { #define SET_PREVIEW_CB_TYPE(muse_camera, cb_type) ((muse_camera)->preview_cb_flag |= cb_type) #define UNSET_PREVIEW_CB_TYPE(muse_camera, cb_type) ((muse_camera)->preview_cb_flag &= ~cb_type) + +typedef struct { + int api; + int class; + int value; +} muse_camera_task_job_s; + typedef struct { camera_h camera_handle; tbm_bufmgr bufmgr; @@ -46,6 +54,12 @@ typedef struct { GCond preview_cb_cond; guint preview_cb_flag; MMCamWaylandInfo wl_info; + GThread *task_thread; + GMutex task_lock; + GCond task_cond; + GQueue task_queue; + gboolean task_run; + muse_module_h module; } muse_camera_handle_s; diff --git a/muse/src/muse_camera_dispatcher.c b/muse/src/muse_camera_dispatcher.c index d4b1c9e..7609441 100644 --- a/muse/src/muse_camera_dispatcher.c +++ b/muse/src/muse_camera_dispatcher.c @@ -24,8 +24,6 @@ #include #include "muse_camera_msg.h" #include "muse_camera_internal.h" -#include -#include #include #include #include @@ -477,6 +475,7 @@ static int _camera_remove_export_data(muse_module_h module, int key, int remove_ return FALSE; } + void _camera_dispatcher_capturing_cb(camera_image_data_s* image, camera_image_data_s* postview, camera_image_data_s* thumbnail, void *user_data) { muse_camera_handle_s *muse_camera = NULL; @@ -1136,6 +1135,139 @@ void _camera_dispatcher_hdr_progress_cb(int percent, void *user_data) } +static void _camera_task_add_job(muse_camera_handle_s *muse_camera, int api, int class, int value) +{ + muse_camera_task_job_s *job = NULL; + + if (!muse_camera) { + LOGE("NULL handle"); + return; + } + + job = g_new0(muse_camera_task_job_s, 1); + + job->api = api; + job->class = class; + job->value = value; + + LOGD("push job - api %d", api); + + g_mutex_lock(&muse_camera->task_lock); + g_queue_push_tail(&muse_camera->task_queue, (gpointer)job); + g_cond_signal(&muse_camera->task_cond); + g_mutex_unlock(&muse_camera->task_lock); + + return; +} + + +static void __camera_task_process_job(muse_camera_handle_s *muse_camera, muse_camera_task_job_s *job) +{ + int ret = CAMERA_ERROR_NONE; + + if (!job) { + LOGE("NULL job"); + return; + } + + if (!muse_camera) { + LOGE("NULL handle"); + goto _PROCESS_DONE; + } + + LOGD("job start - api %d, value 0x%x", job->api, job->value); + + switch (job->api) { + case MUSE_CAMERA_API_STOP_PREVIEW: + ret = legacy_camera_stop_preview(muse_camera->camera_handle); + break; + case MUSE_CAMERA_API_START_CAPTURE: + ret = legacy_camera_start_capture(muse_camera->camera_handle, + (camera_capturing_cb)_camera_dispatcher_capturing_cb, + (camera_capture_completed_cb)_camera_dispatcher_capture_completed_cb, + (void *)muse_camera->module); + break; + case MUSE_CAMERA_API_SET_PREVIEW_RESOLUTION: + ret = legacy_camera_set_preview_resolution(muse_camera->camera_handle, \ + job->value >> 16, 0x0000ffff & job->value); + break; + case MUSE_CAMERA_API_SET_CAPTURE_RESOLUTION: + ret = legacy_camera_set_capture_resolution(muse_camera->camera_handle, \ + job->value >> 16, 0x0000ffff & job->value); + break; + case MUSE_CAMERA_API_ATTR_SET_HDR_MODE: + ret = legacy_camera_attr_set_hdr_mode(muse_camera->camera_handle, \ + (camera_attr_hdr_mode_e)job->value); + break; + default: + LOGE("unhandled task - api %d", job->api); + goto _PROCESS_DONE; + } + + LOGD("job done - api %d, ret 0x%x", job->api, ret); + + muse_camera_msg_return(job->api, job->class, ret, muse_camera->module); + +_PROCESS_DONE: + g_free(job); + job = NULL; + + return; +} + + +static void *_camera_dispatcher_task_func(gpointer data) +{ + muse_camera_handle_s *muse_camera = (muse_camera_handle_s *)data; + muse_camera_task_job_s *job = NULL; + + if (!muse_camera) { + LOGE("NULL handle"); + return NULL; + } + + LOGD("enter"); + + g_mutex_lock(&muse_camera->task_lock); + + while (true) { + if (g_queue_is_empty(&muse_camera->task_queue)) { + LOGD("empty queue. wait signal"); + g_cond_wait(&muse_camera->task_cond, &muse_camera->task_lock); + LOGD("signal received"); + } + + if (!muse_camera->task_run) { + LOGD("stop task thread"); + break; + } + + job = (muse_camera_task_job_s *)g_queue_pop_head(&muse_camera->task_queue); + + g_mutex_unlock(&muse_camera->task_lock); + + __camera_task_process_job(muse_camera, job); + + g_mutex_lock(&muse_camera->task_lock); + } + + while (!g_queue_is_empty(&muse_camera->task_queue)) { + job = (muse_camera_task_job_s *)g_queue_pop_head(&muse_camera->task_queue); + + if (job) + LOGW("remained job - api %d", job->api); + + __camera_task_process_job(muse_camera, job); + } + + g_mutex_unlock(&muse_camera->task_lock); + + LOGD("leave"); + + return NULL; +} + + int camera_dispatcher_create(muse_module_h module) { int ret = CAMERA_ERROR_NONE; @@ -1194,6 +1326,18 @@ int camera_dispatcher_create(muse_module_h module) return MUSE_CAMERA_ERROR_NONE; } + g_mutex_init(&muse_camera->task_lock); + g_cond_init(&muse_camera->task_cond); + g_queue_init(&muse_camera->task_queue); + + muse_camera->task_run = true; + muse_camera->task_thread = g_thread_try_new("camera_task_thread", + _camera_dispatcher_task_func, (gpointer)muse_camera, NULL); + if (!muse_camera->task_thread) { + LOGE("failed to create new thread for task"); + goto _CREATE_ERROR; + } + ret = legacy_camera_set_state_changed_cb(muse_camera->camera_handle, (camera_state_changed_cb)_camera_dispatcher_state_changed_cb, (void *)module); @@ -1219,14 +1363,33 @@ int camera_dispatcher_create(muse_module_h module) g_mutex_init(&muse_camera->preview_cb_lock); g_cond_init(&muse_camera->preview_cb_cond); muse_camera->preview_cb_flag = 0; + muse_camera->module = module; LOGD("handle : 0x%x", muse_camera); + muse_core_ipc_set_handle(module, (intptr_t)muse_camera); muse_camera_msg_return1(api, class, ret, module, MUSE_CAMERA_GET_TYPE_POINTER, -1, "handle", 0, muse_camera); return MUSE_CAMERA_ERROR_NONE; _CREATE_ERROR: + if (muse_camera->task_thread) { + g_mutex_lock(&muse_camera->task_lock); + muse_camera->task_run = false; + g_cond_signal(&muse_camera->task_cond); + g_mutex_unlock(&muse_camera->task_lock); + + LOGE("task thread join"); + + g_thread_join(muse_camera->task_thread); + g_thread_unref(muse_camera->task_thread); + muse_camera->task_thread = NULL; + } + + g_mutex_clear(&muse_camera->task_lock); + g_cond_clear(&muse_camera->task_cond); + g_queue_clear(&muse_camera->task_queue); + legacy_camera_destroy(muse_camera->camera_handle); muse_camera->camera_handle = NULL; @@ -1282,6 +1445,23 @@ int camera_dispatcher_destroy(muse_module_h module) muse_camera->bufmgr = NULL; + if (muse_camera->task_thread) { + g_mutex_lock(&muse_camera->task_lock); + muse_camera->task_run = false; + g_cond_signal(&muse_camera->task_cond); + g_mutex_unlock(&muse_camera->task_lock); + + LOGE("task thread join"); + + g_thread_join(muse_camera->task_thread); + g_thread_unref(muse_camera->task_thread); + muse_camera->task_thread = NULL; + } + + g_mutex_clear(&muse_camera->task_lock); + g_cond_clear(&muse_camera->task_cond); + g_queue_clear(&muse_camera->task_queue); + free(muse_camera); muse_camera = NULL; } @@ -1311,39 +1491,28 @@ int camera_dispatcher_start_preview(muse_module_h module) int camera_dispatcher_stop_preview(muse_module_h module) { - int ret = CAMERA_ERROR_NONE; muse_camera_handle_s *muse_camera = NULL; - muse_camera_api_e api = MUSE_CAMERA_API_STOP_PREVIEW; - muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module); LOGD("handle : %p", muse_camera); - ret = legacy_camera_stop_preview(muse_camera->camera_handle); - - muse_camera_msg_return(api, class, ret, module); + _camera_task_add_job(muse_camera, MUSE_CAMERA_API_STOP_PREVIEW, + MUSE_CAMERA_API_CLASS_IMMEDIATE, 0); return MUSE_CAMERA_ERROR_NONE; } int camera_dispatcher_start_capture(muse_module_h module) { - int ret = CAMERA_ERROR_NONE; muse_camera_handle_s *muse_camera = NULL; - muse_camera_api_e api = MUSE_CAMERA_API_START_CAPTURE; - muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module); - LOGD("Enter, handle : %p, module : %p", muse_camera, module); - - ret = legacy_camera_start_capture(muse_camera->camera_handle, - (camera_capturing_cb)_camera_dispatcher_capturing_cb, - (camera_capture_completed_cb)_camera_dispatcher_capture_completed_cb, - (void *)module); + LOGD("handle : %p", muse_camera); - muse_camera_msg_return(api, class, ret, module); + _camera_task_add_job(muse_camera, MUSE_CAMERA_API_START_CAPTURE, + MUSE_CAMERA_API_CLASS_IMMEDIATE, 0); return MUSE_CAMERA_ERROR_NONE; } @@ -1653,52 +1822,30 @@ int camera_dispatcher_set_display(muse_module_h module) int camera_dispatcher_set_preview_resolution(muse_module_h module) { - int ret = CAMERA_ERROR_NONE; - muse_camera_handle_s *muse_camera = NULL; int value = 0; - int width = 0; - int height = 0; - muse_camera_api_e api = MUSE_CAMERA_API_SET_PREVIEW_RESOLUTION; - muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; + muse_camera_handle_s *muse_camera = NULL; muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module); muse_camera_msg_get(value, muse_core_client_get_msg(module)); - width = value >> 16; - height = 0x0000ffff & value; - - LOGD("0x%x -> %dx%d", value, width, height); - - ret = legacy_camera_set_preview_resolution(muse_camera->camera_handle, width, height); - - muse_camera_msg_return(api, class, ret, module); + _camera_task_add_job(muse_camera, MUSE_CAMERA_API_SET_PREVIEW_RESOLUTION, + MUSE_CAMERA_API_CLASS_IMMEDIATE, value); return MUSE_CAMERA_ERROR_NONE; } int camera_dispatcher_set_capture_resolution(muse_module_h module) { - int ret = CAMERA_ERROR_NONE; - muse_camera_handle_s *muse_camera = NULL; int value = 0; - int width = 0; - int height = 0; - muse_camera_api_e api = MUSE_CAMERA_API_SET_CAPTURE_RESOLUTION; - muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; + muse_camera_handle_s *muse_camera = NULL; muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module); muse_camera_msg_get(value, muse_core_client_get_msg(module)); - width = value >> 16; - height = 0x0000ffff & value; - - LOGD("handle : 0x%x, set_width : %d, set_height : %d", muse_camera, width, height); - - ret = legacy_camera_set_capture_resolution(muse_camera->camera_handle, width, height); - - muse_camera_msg_return(api, class, ret, module); + _camera_task_add_job(muse_camera, MUSE_CAMERA_API_SET_CAPTURE_RESOLUTION, + MUSE_CAMERA_API_CLASS_IMMEDIATE, value); return MUSE_CAMERA_ERROR_NONE; } @@ -3912,23 +4059,17 @@ int camera_dispatcher_attr_get_stream_flip(muse_module_h module) int camera_dispatcher_attr_set_hdr_mode(muse_module_h module) { - int ret = CAMERA_ERROR_NONE; + int set_mode = 0; muse_camera_handle_s *muse_camera = NULL; - muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_HDR_MODE; - muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE; - int set_mode; muse_camera = (muse_camera_handle_s *)muse_core_ipc_get_handle(module); - muse_camera_msg_get(set_mode, muse_core_client_get_msg(module)); - LOGD("handle : %p", muse_camera); - ret = legacy_camera_attr_set_hdr_mode(muse_camera->camera_handle, (camera_attr_hdr_mode_e)set_mode); - - LOGD("ret : 0x%x", ret); + muse_camera_msg_get(set_mode, muse_core_client_get_msg(module)); - muse_camera_msg_return(api, class, ret, module); + _camera_task_add_job(muse_camera, MUSE_CAMERA_API_ATTR_SET_HDR_MODE, + MUSE_CAMERA_API_CLASS_IMMEDIATE, set_mode); return MUSE_CAMERA_ERROR_NONE; } diff --git a/packaging/mmsvc-camera.spec b/packaging/mmsvc-camera.spec index 1277f04..1285da3 100644 --- a/packaging/mmsvc-camera.spec +++ b/packaging/mmsvc-camera.spec @@ -1,6 +1,6 @@ Name: mmsvc-camera Summary: A Camera module for muse server -Version: 0.2.55 +Version: 0.2.56 Release: 0 Group: Multimedia/Libraries License: Apache-2.0 -- 2.7.4