From 290b3466d8057b523a22edd69eb5c4fefe69901e Mon Sep 17 00:00:00 2001 From: Jeongmo Yang Date: Tue, 2 Jun 2015 20:23:18 +0900 Subject: [PATCH] 1. Code clean up 2. Update latest code Change-Id: I9f321e00ac83441705c4f800a6fab5cb917bae55 Signed-off-by: Jeongmo Yang --- CMakeLists.txt | 2 +- include/camera.h | 377 ++-- packaging/capi-media-camera.spec | 3 +- src/camera.c | 3594 +++++++++++++++++++++++--------------- src/camera_internal.c | 24 +- 5 files changed, 2379 insertions(+), 1621 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c6cb71d..9106d8e 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,7 +23,7 @@ SET(service "media") SET(submodule "camera") # for package file -SET(dependents "dlog audio-session-mgr mm-camcorder capi-base-common capi-media-tool gstreamer-1.0 libtbm evas ecore elementary") +SET(dependents "dlog audio-session-mgr mm-camcorder capi-base-common capi-media-tool gstreamer-1.0 libtbm evas ecore elementary vconf") SET(pc_dependents "mm-camcorder capi-base-common capi-media-tool gstreamer-1.0 libtbm evas ecore elementary") SET(fw_name "${project_prefix}-${service}-${submodule}") diff --git a/include/camera.h b/include/camera.h index 8c730f1..e37f818 100644 --- a/include/camera.h +++ b/include/camera.h @@ -27,7 +27,7 @@ extern "C" { /** * @file camera.h * @brief This file contains the Camera API, related structures and enumerations. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ /** @@ -39,7 +39,7 @@ extern "C" { /** * @brief Enumeration for the error codes of Camera. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ typedef enum { @@ -62,7 +62,7 @@ typedef enum /** * @brief Enumeration for the camera state. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ typedef enum { @@ -75,7 +75,7 @@ typedef enum /** * @brief Enumeration for the camera device. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ typedef enum { @@ -85,7 +85,7 @@ typedef enum /** * @brief Enumeration for the camera pixel format. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ typedef enum { @@ -108,7 +108,7 @@ typedef enum /** * @brief Enumeration for the camera display type. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ typedef enum { @@ -119,7 +119,7 @@ typedef enum /** * @brief Enumeration for the camera policy. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ typedef enum { @@ -132,7 +132,7 @@ typedef enum /** * @brief Enumeration for the camera rotation type. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ typedef enum { @@ -145,7 +145,7 @@ typedef enum /** * @brief Enumeration for the camera flip type. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ typedef enum { @@ -157,7 +157,7 @@ typedef enum /** * @brief Enumeration for the camera focus state. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ typedef enum { @@ -169,7 +169,7 @@ typedef enum /** * @brief The structure type of the image data. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ typedef struct { @@ -184,7 +184,7 @@ typedef enum /** * @brief The structure type for face detection. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ typedef struct { @@ -198,7 +198,7 @@ typedef struct /** * @brief The structure type to preview stream data. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ typedef struct { @@ -233,14 +233,14 @@ typedef struct /** * @brief The Camera handle. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @see recorder_create_videorecorder() */ typedef struct camera_s *camera_h; /** * @brief The Camera display handle. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ typedef void *camera_display_h; @@ -248,7 +248,7 @@ typedef void *camera_display_h; /** * @brief Gets a display handle. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ #define GET_DISPLAY(x) (void*)(x) @@ -265,7 +265,7 @@ typedef void *camera_display_h; /** * @brief Enumeration for the camera display mode. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ typedef enum { @@ -286,7 +286,7 @@ typedef enum /** * @brief Enumeration for the color tone, which provides the impression of looking through a tinted glass. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ typedef enum { @@ -325,7 +325,7 @@ typedef enum /** * @brief Enumeration for the white balance levels of the camera. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ typedef enum { @@ -344,7 +344,7 @@ typedef enum /** * @brief Enumeration for the scene mode. * @details The mode of operation can be in daylight, night, or back-light. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ typedef enum { @@ -368,7 +368,7 @@ typedef enum /** * @brief Enumeration for the auto focus mode. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ typedef enum { @@ -380,7 +380,7 @@ typedef enum /** * @brief Enumeration for the ISO levels of the camera. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ typedef enum { @@ -396,7 +396,7 @@ typedef enum /** * @brief Enumeration for the camera exposure modes. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ typedef enum { @@ -409,7 +409,7 @@ typedef enum /** * @brief Enumeration for the orientation values of tag. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ typedef enum { @@ -425,7 +425,7 @@ typedef enum /** * @brief Enumeration for the flash mode. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ typedef enum { @@ -441,7 +441,7 @@ typedef enum /** * @brief Enumeration to preview FPS. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ typedef enum { @@ -460,7 +460,7 @@ typedef enum /** * @brief Enumeration for the theater mode. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ typedef enum { @@ -471,7 +471,7 @@ typedef enum /** * @brief Enumeration for HDR capture mode. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ typedef enum { @@ -492,7 +492,7 @@ typedef enum /** * @brief Called when the camera state is changed. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * * @param[in] previous The previous state of the camera * @param[in] current The current state of the camera @@ -507,7 +507,7 @@ typedef void (*camera_state_changed_cb)(camera_state_e previous, camera_state_e /** * @brief Called when the camera is interrupted by policy. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * * @param[in] policy The policy that interrupted the camera * @param[in] previous The previous state of the camera @@ -524,7 +524,7 @@ typedef void (*camera_interrupted_cb)(camera_policy_e policy, camera_state_e pre * Changes of focus state are as follows: \n * #CAMERA_FOCUS_STATE_RELEASED -> start focusing -> #CAMERA_FOCUS_STATE_ONGOING -> working -> * #CAMERA_FOCUS_STATE_FOCUSED or #CAMERA_FOCUS_STATE_FAILED. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * * @param[in] state The current state of the auto-focus * @param[in] user_data The user data passed from the callback registration function @@ -538,7 +538,7 @@ typedef void (*camera_focus_changed_cb)(camera_focus_state_e state, void *user_d /** * @brief Called to register for notifications about delivering a copy of the new preview frame when every preview frame is displayed. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * * @remarks This function is issued in the context of gstreamer so the UI update code should not be directly invoked.\n * If the camera is used as a recorder then this callback function won't be called. @@ -554,7 +554,7 @@ typedef void (*camera_preview_cb)(camera_preview_data_s *frame, void *user_data) /** * @brief Called to register for notifications about delivering media packet when every preview frame is displayed. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * * @remarks This function is issued in the context of gstreamer so the UI update code should not be directly invoked.\n * If the camera is used as a recorder then this callback function won't be called.\n @@ -571,7 +571,7 @@ typedef void (*camera_media_packet_preview_cb)(media_packet_h pkt, void *user_da /** * @brief Called to get information about image data taken by the camera once per frame while capturing. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * * @remarks This function is issued in the context of gstreamer (video source thread) so the UI update code should not be directly invoked. * You must not call camera_start_preview() within this callback. @@ -589,7 +589,7 @@ typedef void (*camera_capturing_cb)(camera_image_data_s* image, camera_image_dat /** * @brief Called when the camera capturing completes. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * * @remarks The callback is called after camera_capturing_cb() is completed.\n * If you want to show the user a preview after capturing is finished, an application can use camera_start_preview() after calling this callback. @@ -604,7 +604,7 @@ typedef void (*camera_capture_completed_cb)(void *user_data); /** * @brief Called when an error occurs. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * * @remarks This callback informs about a critical error situation.\n * When this callback is invoked, the user should release the resource and terminate the application.\n @@ -624,7 +624,7 @@ typedef void (*camera_error_cb)(camera_error_e error, camera_state_e current_sta /** * @brief Called when a face is detected in the preview frame. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @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 @@ -643,7 +643,7 @@ typedef void (*camera_face_detected_cb)(camera_detected_face_s *faces, int count /** * @brief Called once for each supported preview resolution. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] width The preview image width * @param[in] height The preview image height * @param[in] user_data The user data passed from the foreach function @@ -655,7 +655,7 @@ typedef bool (*camera_supported_preview_resolution_cb)(int width, int height, vo /** * @brief Called once for each supported capture resolution. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] width The capture resolution width * @param[in] height The capture resolution height * @param[in] user_data The user data passed from the foreach function @@ -667,7 +667,7 @@ typedef bool (*camera_supported_capture_resolution_cb)(int width, int height, vo /** * @brief Called once for the pixel format of each supported capture format. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @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 @@ -679,7 +679,7 @@ typedef bool (*camera_supported_capture_format_cb)(camera_pixel_format_e format, /** * @brief Called once for the pixel format of each supported preview format. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @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 @@ -701,7 +701,7 @@ typedef bool (*camera_supported_preview_format_cb)(camera_pixel_format_e format, /** * @brief Creates a new camera handle for controlling a camera. * - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @privlevel public * @privilege %http://tizen.org/privilege/camera * @remarks Multiple handles on a context at the same time are allowed to be created. However, @@ -727,7 +727,7 @@ int camera_create(camera_device_e device, camera_h *camera); /** * @brief Destroys the camera handle and releases all its resources. * - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @privlevel public * @privilege %http://tizen.org/privilege/camera * @param[in] camera The handle to the camera @@ -745,7 +745,7 @@ int camera_destroy(camera_h camera); /** * @brief Starts capturing and drawing preview frames on the screen. * - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @privlevel public * @privilege %http://tizen.org/privilege/camera * @param[in] camera The handle to the camera @@ -784,7 +784,7 @@ int camera_start_preview(camera_h camera); /** * @brief Stops capturing and drawing preview frames. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @privlevel public * @privilege %http://tizen.org/privilege/camera * @param[in] camera The handle to the camera @@ -806,7 +806,7 @@ int camera_stop_preview(camera_h camera); /** * @brief Starts capturing of still images. * - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @privlevel public * @privilege %http://tizen.org/privilege/camera * @remarks This function causes the transition of the camera state from #CAMERA_STATE_CAPTURING to #CAMERA_STATE_CAPTURED automatically\n @@ -846,7 +846,7 @@ int camera_start_capture(camera_h camera, camera_capturing_cb capturing_cb , cam /** * @brief Starts continuously capturing still images. * - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @privlevel public * @privilege %http://tizen.org/privilege/camera * @remarks If this is not supported zero shutter lag occurs. The capture resolution could be changed to the preview resolution.\n @@ -880,7 +880,7 @@ int camera_start_continuous_capture(camera_h camera, int count, int interval, ca /** * @brief Aborts continuous capturing. * - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @privlevel public * @privilege %http://tizen.org/privilege/camera * @remarks The camera state will be changed to #CAMERA_STATE_CAPTURED. @@ -901,7 +901,7 @@ int camera_stop_continuous_capture(camera_h camera); /** * @brief Gets the state of the camera. * - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] camera The handle to the camera * @param[out] state The current state of the camera * @return @c 0 on success, otherwise a negative error value @@ -919,7 +919,7 @@ int camera_get_state(camera_h camera, camera_state_e *state); /** * @brief Starts camera auto-focusing, asynchronously. * - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @privlevel public * @privilege %http://tizen.org/privilege/camera * @remarks If continuous status is @c true, the camera continuously tries to focus. @@ -944,7 +944,7 @@ int camera_start_focusing(camera_h camera, bool continuous); /** * @brief Stops camera auto focusing. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @privlevel public * @privilege %http://tizen.org/privilege/camera * @param[in] camera The handle to the camera @@ -965,7 +965,7 @@ int camera_cancel_focusing(camera_h camera); /** * @brief Sets the display handle to show preview images. * - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @remarks This function must be called before previewing (see camera_start_preview()). * @param[in] camera The handle to the camera * @param[in] type The display type @@ -986,7 +986,7 @@ int camera_set_display(camera_h camera, camera_display_type_e type, camera_displ /** * @brief Sets the resolution of the preview. * - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @privlevel public * @privilege %http://tizen.org/privilege/camera * @remarks This function should be called before previewing (camera_start_preview()). @@ -1010,7 +1010,7 @@ int camera_set_preview_resolution(camera_h camera, int width, int height); /** * @brief Gets the resolution of the preview. * - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] camera The handle to the camera * @param[out] width The preview width * @param[out] height The preview height @@ -1027,7 +1027,7 @@ int camera_get_preview_resolution(camera_h camera, int *width, int *height); /** * @brief Gets the recommended preview resolution. * - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @remarks Depending on the capture resolution aspect ratio and display resolution, the recommended preview resolution is determined. * @param[in] camera The handle to the camera * @param[out] width The preview width @@ -1044,7 +1044,7 @@ int camera_get_recommended_preview_resolution(camera_h camera, int *width, int * /** * @brief Starts face detection. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @privlevel public * @privilege %http://tizen.org/privilege/camera * @remarks This should be called after the preview is started.\n @@ -1074,7 +1074,7 @@ int camera_start_face_detection(camera_h camera, camera_face_detected_cb callbac /** * @brief Stops face detection. * - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @privlevel public * @privilege %http://tizen.org/privilege/camera * @param[in] camera The handle to the camera @@ -1102,7 +1102,7 @@ int camera_stop_face_detection(camera_h camera); /** * @brief Gets continuous capture feature's supported state. * @ingroup CAPI_MEDIA_CAMERA_CAPABILITY_MODULE - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section. * @param[in] camera The handle to the camera * @return @c true on supported, otherwise false @@ -1117,7 +1117,7 @@ int camera_stop_face_detection(camera_h camera); /** * @brief Retrieves all supported camera preview resolutions by invoking the callback function once for each supported camera preview resolution. * - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] camera The handle to the camera * @param[in] callback The callback function to be invoked * @param[in] user_data The user data to be passed to the callback function @@ -1148,7 +1148,7 @@ int camera_foreach_supported_preview_resolution(camera_h camera, * @ingroup CAPI_MEDIA_CAMERA_DISPLAY_MODULE * @brief Sets the display rotation. * - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @privlevel public * @privilege %http://tizen.org/privilege/camera * @remarks This function should be called before previewing (see camera_start_preview()) @@ -1170,7 +1170,7 @@ int camera_set_display_rotation(camera_h camera, camera_rotation_e rotation); * @ingroup CAPI_MEDIA_CAMERA_DISPLAY_MODULE * @brief Gets the display rotation. * - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] camera The handle to the camera * @param[out] rotation The display rotation * @return @c 0 on success, otherwise a negative error value @@ -1186,7 +1186,7 @@ int camera_get_display_rotation(camera_h camera, camera_rotation_e *rotation); * @ingroup CAPI_MEDIA_CAMERA_DISPLAY_MODULE * @brief Sets the display flip. * - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @privlevel public * @privilege %http://tizen.org/privilege/camera * @param[in] camera The handle to the camera @@ -1206,7 +1206,7 @@ int camera_set_display_flip(camera_h camera, camera_flip_e flip); * @ingroup CAPI_MEDIA_CAMERA_DISPLAY_MODULE * @brief Gets the display flip. * - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] camera The handle to the camera * @param[out] flip The display flip * @return @c 0 on success, otherwise a negative error value @@ -1222,7 +1222,7 @@ int camera_get_display_flip(camera_h camera, camera_flip_e *flip); * @ingroup CAPI_MEDIA_CAMERA_DISPLAY_MODULE * @brief Sets the visible property for display. * - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @privlevel public * @privilege %http://tizen.org/privilege/camera * @param[in] camera The handle to the camera @@ -1241,7 +1241,7 @@ int camera_set_display_visible(camera_h camera, bool visible); * @ingroup CAPI_MEDIA_CAMERA_DISPLAY_MODULE * @brief Gets the visible property of display. * - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] camera The handle to the camera * @param[out] visible @c true if camera display is visible, otherwise @c false * @@ -1258,7 +1258,7 @@ int camera_is_display_visible(camera_h camera, bool *visible); * @ingroup CAPI_MEDIA_CAMERA_DISPLAY_MODULE * @brief Sets the display mode. * - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] camera The handle to the camera * @param[in] mode The display mode * @@ -1275,7 +1275,7 @@ int camera_set_display_mode(camera_h camera , camera_display_mode_e mode); * @ingroup CAPI_MEDIA_CAMERA_DISPLAY_MODULE * @brief Gets the display mode. * - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] camera The handle to the camera * @param[out] mode The display mode * @@ -1290,7 +1290,7 @@ int camera_get_display_mode(camera_h camera, camera_display_mode_e *mode); /** * @brief Sets the resolution of the captured image. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @privlevel public * @privilege %http://tizen.org/privilege/camera * @param[in] camera The handle to the camera @@ -1311,7 +1311,7 @@ int camera_set_capture_resolution(camera_h camera, int width, int height); /** * @brief Gets the resolution of the captured image. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] camera The handle to the camera * @param[out] width The capture width * @param[out] height The capture height @@ -1337,7 +1337,7 @@ int camera_get_capture_resolution(camera_h camera, int *width, int *height); /** * @brief Retrieves all supported camera captured resolutions by invoking the callback function once for each supported camera capture resolution. * - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] camera The handle to the camera * @param[in] callback The callback function to register * @param[in] user_data The user data to be passed to the callback function @@ -1366,7 +1366,7 @@ int camera_foreach_supported_capture_resolution(camera_h camera, /** * @brief Sets the format of an image to be captured. * - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @remarks This function should be called before capturing (see camera_start_capture()). * @param[in] camera The handle to the camera * @param[out] format The format of the image to be captured @@ -1386,7 +1386,7 @@ int camera_set_capture_format(camera_h camera, camera_pixel_format_e format); /** * @brief Gets the format of the image to be captured. * - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] camera The handle to the camera * @param[out] format The format of the image to be captured * @return @c 0 on success, otherwise a negative error value @@ -1411,7 +1411,7 @@ int camera_get_capture_format(camera_h camera, camera_pixel_format_e *format); /** * @brief Retrieves all supported camera capture formats by invoking the callback function once for each supported camera capture format. * - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] camera The handle to the camera * @param[in] callback The callback function to be invoked * @param[in] user_data The user data to be passed to the callback function @@ -1439,7 +1439,7 @@ int camera_foreach_supported_capture_format(camera_h camera, /** * @brief Sets the preview data format. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @remarks This function should be called before previewing (see camera_start_preview()). * @param[in] camera The handle to the camera * @param[in] format The preview data format @@ -1458,7 +1458,7 @@ int camera_set_preview_format(camera_h camera, camera_pixel_format_e format); /** * @brief Gets the format of the preview stream. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] camera The handle to the camera * @param[out] format The preview data format * @return @c 0 on success, otherwise a negative error value @@ -1482,7 +1482,7 @@ int camera_get_preview_format(camera_h camera, camera_pixel_format_e *format); /** * @brief Retrieves all supported camera preview formats by invoking the callback function once for each supported camera preview format. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] camera The handle to the camera * @param[in] callback The callback function to be invoked * @param[in] user_data The user data to be passed to the callback function @@ -1502,7 +1502,7 @@ int camera_foreach_supported_preview_format(camera_h camera, /** * @ingroup CAPI_MEDIA_CAMERA_CAPABILITY_MODULE * @brief Gets the face detection feature's supported state. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section. * @param[in] camera The handle to the camera * @return @c true if supported, otherwise @c false @@ -1518,7 +1518,7 @@ bool camera_is_supported_face_detection(camera_h camera); /** * @brief Gets the zero shutter lag feature's supported state. * @ingroup CAPI_MEDIA_CAMERA_CAPABILITY_MODULE - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @remarks If supporting zero shutter lag, continuous shot can be done with full capture size. \n * The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section. * @param[in] camera The handle to the camera @@ -1534,7 +1534,7 @@ bool camera_is_supported_zero_shutter_lag(camera_h camera); /** * @ingroup CAPI_MEDIA_CAMERA_CAPABILITY_MODULE * @brief Gets the camera device count. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @remarks If the device supports primary and secondary camera, this returns @c 2. If @c 1 is returned, the device only supports primary camera. * @param[in] camera The handle to the camera * @param[out] device_count The device count @@ -1550,7 +1550,7 @@ int camera_get_device_count(camera_h camera, int *device_count); /** * @brief Gets the media packet preview callback feature's supported state. * @ingroup CAPI_MEDIA_CAMERA_CAPABILITY_MODULE - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section. * @param[in] camera The handle to the camera * @return @c true if supported, otherwise @c false @@ -1573,7 +1573,7 @@ bool camera_is_supported_media_packet_preview_cb(camera_h camera); /** * @brief Registers a callback function to be called once per frame when previewing. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @remarks This callback does not work in the video recorder mode.\n * This function should be called before previewing (see camera_start_preview()).\n * A registered callback is called on the internal thread of the camera.\n @@ -1598,7 +1598,7 @@ int camera_set_preview_cb(camera_h camera, camera_preview_cb callback, void *use /** * @brief Unregisters the callback function. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] camera The handle to the camera * @return @c 0 on success, otherwise a negative error value * @retval #CAMERA_ERROR_NONE Successful @@ -1611,7 +1611,7 @@ int camera_unset_preview_cb(camera_h camera); /** * @brief Registers a media packet callback function to be called once per frame when previewing. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @remarks This callback does not work in video recorder mode.\n * This function should be called before previewing (see camera_start_preview())\n * A registered callback is called on the internal thread of the camera.\n @@ -1636,7 +1636,7 @@ int camera_set_media_packet_preview_cb(camera_h camera, camera_media_packet_prev /** * @brief Unregisters the media packet callback function. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] camera The handle to the camera * @return @c 0 on success, otherwise a negative error value * @retval #CAMERA_ERROR_NONE Successful @@ -1649,7 +1649,7 @@ int camera_unset_media_packet_preview_cb(camera_h camera); /** * @brief Registers a callback function to be called when the camera state changes. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] camera The handle to the camera * @param[in] callback The callback function to register * @param[in] user_data The user data to be passed to the callback function @@ -1667,7 +1667,7 @@ int camera_set_state_changed_cb(camera_h camera, camera_state_changed_cb callbac /** * @brief Unregisters the callback function. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] camera The handle to the camera * @return @c 0 on success, otherwise a negative error value * @retval #CAMERA_ERROR_NONE Successful @@ -1680,7 +1680,7 @@ int camera_unset_state_changed_cb(camera_h camera); /** * @brief Registers a callback function to be called when the camera is interrupted by policy. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] camera The handle to the camera * @param[in] callback The callback function to register * @param[in] user_data The user data to be passed to the callback function @@ -1697,7 +1697,7 @@ int camera_set_interrupted_cb(camera_h camera, camera_interrupted_cb callback, /** * @brief Unregisters the callback function. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] camera The handle to the camera * @return @c 0 on success, otherwise a negative error value * @retval #CAMERA_ERROR_NONE Successful @@ -1710,7 +1710,7 @@ int camera_unset_interrupted_cb(camera_h camera); /** * @brief Registers a callback function to be called when the auto-focus state changes. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] camera The handle to the camera * @param[in] callback The callback function to register * @param[in] user_data The user data to be passed to the callback function @@ -1730,7 +1730,7 @@ int camera_set_focus_changed_cb(camera_h camera, camera_focus_changed_cb callbac /** * @brief Unregisters the callback function. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] camera The handle to the camera * @return @c 0 on success, otherwise a negative error value * @retval #CAMERA_ERROR_NONE Successful @@ -1743,7 +1743,7 @@ int camera_unset_focus_changed_cb(camera_h camera); /** * @brief Registers a callback function to be called when an asynchronous operation error occurs. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @remarks This callback informs about a critical error situation.\n * When this callback is invoked, the user should release the resource and terminate the application.\n * In case of errors, one of the following codes will occur:\n @@ -1767,7 +1767,7 @@ int camera_set_error_cb(camera_h camera, camera_error_cb callback, void *user_da /** * @brief Unregisters the callback function. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] camera The handle to the camera * @return @c 0 on success, otherwise a negative error value * @retval #CAMERA_ERROR_NONE Successful @@ -1789,6 +1789,7 @@ int camera_unset_error_cb(camera_h camera); /** * @brief Called to get each supported auto-focus mode. + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @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 @@ -1799,6 +1800,7 @@ typedef bool (*camera_attr_supported_af_mode_cb)(camera_attr_af_mode_e mode, voi /** * @brief Called to get each supported exposure mode. + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @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 @@ -1811,6 +1813,7 @@ typedef bool (*camera_attr_supported_exposure_mode_cb)(camera_attr_exposure_mode /** * @brief Called to get each supported ISO mode. + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @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 @@ -1821,6 +1824,7 @@ typedef bool (*camera_attr_supported_iso_cb)(camera_attr_iso_e iso, void *user_d /** * @brief Called to get each supported white balance. + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @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 @@ -1833,6 +1837,7 @@ typedef bool (*camera_attr_supported_whitebalance_cb)(camera_attr_whitebalance_e /** * @brief Called to get each supported effect mode. + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @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 @@ -1844,6 +1849,7 @@ typedef bool (*camera_attr_supported_effect_cb)(camera_attr_effect_mode_e effect /** * @brief Called to get each supported scene mode. + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @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 @@ -1856,6 +1862,7 @@ typedef bool (*camera_attr_supported_scene_mode_cb)(camera_attr_scene_mode_e mod /** * @brief Called to get each supported flash mode. + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @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 @@ -1867,6 +1874,7 @@ typedef bool (*camera_attr_supported_flash_mode_cb)(camera_attr_flash_mode_e mod /** * @brief Called to get each supported FPS mode. + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @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 @@ -1877,6 +1885,7 @@ typedef bool (*camera_attr_supported_fps_cb)(camera_attr_fps_e fps, void *user_d /** * @brief Called to get each supported stream flip mode. + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @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 @@ -1887,6 +1896,7 @@ typedef bool (*camera_attr_supported_stream_flip_cb)(camera_flip_e flip, void *u /** * @brief Called to get each supported stream rotation mode. + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @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 @@ -1897,6 +1907,7 @@ typedef bool (*camera_attr_supported_stream_rotation_cb)(camera_rotation_e rotat /** * @brief Called to get each supported theater mode. + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @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 @@ -1916,7 +1927,7 @@ typedef bool (*camera_attr_supported_theater_mode_cb)(camera_attr_theater_mode_e /** * @brief Sets the preview frame rate. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @remarks This function should be called before previewing (see camera_start_preview()). * @param[in] camera The handle to the camera * @param[in] fps The frame rate @@ -1934,7 +1945,7 @@ int camera_attr_set_preview_fps(camera_h camera, camera_attr_fps_e fps); /** * @brief Gets the frames per second of a preview video stream. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] camera The handle to the camera * @param[out] fps The frames per second of the preview video stream * @return @c 0 on success, otherwise a negative error value @@ -1958,7 +1969,7 @@ int camera_attr_get_preview_fps(camera_h camera, camera_attr_fps_e *fps); /** * @brief Retrieves all supported FPS modes by invoking the callback function once for each supported FPS mode. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] camera The handle to the camera * @param[in] callback The callback function to invoke * @param[in] user_data The user data to be passed to the callback function @@ -1976,6 +1987,29 @@ int camera_attr_foreach_supported_fps(camera_h camera, camera_attr_supported_fps void *user_data); /** + * @brief Retrieves all supported FPS modes by invoking the callback function once for each supported FPS mode. + * @since_tizen 2.4 + * @param[in] camera The handle to the camera + * @privlevel public + * @privilege %http://tizen.org/privilege/camera + * @param[in] width Required preview resolution's width + * @param[in] height Required preview resolution's height + * @param[in] callback The callback function to invoke + * @param[in] user_data The user data to be passed to the callback function + * @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_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_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() + */ +int camera_attr_foreach_supported_fps_by_resolution(camera_h camera, int width, int height, + camera_attr_supported_fps_cb callback ,void *user_data); + +/** * @} */ @@ -1987,7 +2021,7 @@ int camera_attr_foreach_supported_fps(camera_h camera, camera_attr_supported_fps /** * @brief Sets quality of the image. * @details The range for image quality is 1 to 100. If @a quality is out of range, #CAMERA_ERROR_INVALID_PARAMETER error occurred. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @privlevel public * @privilege %http://tizen.org/privilege/camera * @param[in] camera The handle to the camera @@ -2006,7 +2040,7 @@ int camera_attr_set_image_quality(camera_h camera, int quality); /** * @brief Gets the quality of a still image, which is captured. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] camera The handle to the camera * @param[out] quality The quality of the image(1 ~ 100) * @return @c 0 on success, otherwise a negative error value @@ -2021,7 +2055,7 @@ int camera_attr_get_image_quality(camera_h camera, int *quality); /** * @brief Sets the zoom level. * @details The range for the zoom level is received from camera_attr_get_zoom_range(). If @a zoom is out of range, the #CAMERA_ERROR_INVALID_PARAMETER error occurs. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @privlevel public * @privilege %http://tizen.org/privilege/camera * @param[in] camera The handle to the camera @@ -2038,7 +2072,7 @@ int camera_attr_set_zoom(camera_h camera, int zoom); /** * @brief Gets the zoom level. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] camera The handle to the camera * @param[out] zoom The zoom level * @return @c 0 on success, otherwise a negative error value @@ -2053,7 +2087,7 @@ int camera_attr_get_zoom(camera_h camera, int *zoom); /** * @brief Gets the available zoom level. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @remarks If the min value is greater than the max value, it means that this feature is not supported. * @param[in] camera The handle to the camera * @param[out] min The minimum zoom level @@ -2071,7 +2105,7 @@ int camera_attr_get_zoom_range(camera_h camera , int *min , int *max); /** * @brief Sets the auto focus mode. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @privlevel public * @privilege %http://tizen.org/privilege/camera * @param[in] camera The handle to the camera @@ -2089,7 +2123,7 @@ int camera_attr_set_af_mode(camera_h camera, camera_attr_af_mode_e mode); /** * @brief Gets the auto focus mode. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @privlevel public * @privilege %http://tizen.org/privilege/camera * @param[in] camera The handle to the camera @@ -2107,7 +2141,7 @@ int camera_attr_get_af_mode(camera_h camera, camera_attr_af_mode_e *mode); /** * @brief Sets auto focus area. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @privlevel public * @privilege %http://tizen.org/privilege/camera * @remarks This API is invalid in the #CAMERA_ATTR_AF_NONE mode.\n @@ -2128,7 +2162,7 @@ int camera_attr_set_af_area(camera_h camera, int x, int y); /** * @brief Clears the auto focus area. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @privlevel public * @privilege %http://tizen.org/privilege/camera * @remarks The focusing area is set to the center. @@ -2155,7 +2189,7 @@ int camera_attr_clear_af_area(camera_h camera); /** * @brief Retrieves all supported auto focus modes by invoking the callback function once for each supported auto focus mode. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] camera The handle to the camera * @param[in] callback The callback function to invoke * @param[in] user_data The user data to be passed to the callback function @@ -2183,7 +2217,7 @@ int camera_attr_foreach_supported_af_mode(camera_h camera, /** * @brief Sets the exposure mode. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @privlevel public * @privilege %http://tizen.org/privilege/camera * @param[in] camera The handle to the camera @@ -2200,7 +2234,7 @@ int camera_attr_set_exposure_mode(camera_h camera, camera_attr_exposure_mode_e m /** * @brief Gets the exposure mode. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] camera The handle to the camera * @param[out] mode The exposure mode * @return @c 0 on success, otherwise a negative error value @@ -2224,7 +2258,7 @@ int camera_attr_get_exposure_mode(camera_h camera, camera_attr_exposure_mode_e * /** * @brief Retrieves all supported exposure modes by invoking the callback function once for each supported exposure mode. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] camera The handle to the camera * @param[in] callback The callback function to be invoked * @param[in] user_data The user data to be passed to the callback function @@ -2252,7 +2286,7 @@ int camera_attr_foreach_supported_exposure_mode(camera_h camera, /** * @brief Sets the exposure value. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @privlevel public * @privilege %http://tizen.org/privilege/camera * @param[in] camera The handle to the camera @@ -2268,7 +2302,7 @@ int camera_attr_set_exposure(camera_h camera, int value); /** * @brief Gets the exposure value. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] camera The handle to the camera * @param[out] value The exposure value * @return @c 0 on success, otherwise a negative error value @@ -2282,7 +2316,7 @@ int camera_attr_get_exposure(camera_h camera, int *value); /** * @brief Gets the available exposure value. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @remarks If the min value is greater than the max value, it means that this feature is not supported. * @param[in] camera The handle to the camera * @param[out] min The minimum exposure value @@ -2298,7 +2332,7 @@ int camera_attr_get_exposure_range(camera_h camera, int *min, int *max); /** * @brief Sets the ISO level. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @privlevel public * @privilege %http://tizen.org/privilege/camera * @param[in] camera The handle to the camera @@ -2315,7 +2349,7 @@ int camera_attr_set_iso(camera_h camera, camera_attr_iso_e iso); /** * @brief Gets the ISO level. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] camera The handle to the camera * @param[out] iso The ISO level * @return @c 0 on success, otherwise a negative error value @@ -2339,7 +2373,7 @@ int camera_attr_get_iso(camera_h camera, camera_attr_iso_e *iso); /** * @brief Retrieves all supported ISO levels by invoking the callback function once for each supported ISO level. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] camera The handle to the camera * @param[in] callback The callback function to be invoked * @param[in] user_data The user data to be passed to the callback function @@ -2367,7 +2401,7 @@ int camera_attr_foreach_supported_iso(camera_h camera, camera_attr_supported_iso /** * @brief Sets the theater mode. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @privlevel public * @privilege %http://tizen.org/privilege/camera * @remarks If you want to display the preview image on the external display with the full screen mode, use this function. @@ -2385,7 +2419,7 @@ int camera_attr_set_theater_mode(camera_h camera, camera_attr_theater_mode_e mod /** * @brief Gets the theater mode. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] camera The handle to the camera * @param[in] mode Currnet theater mode * @return @c 0 on success, otherwise a negative error value @@ -2408,7 +2442,7 @@ int camera_attr_get_theater_mode(camera_h camera, camera_attr_theater_mode_e *mo /** * @brief Retrieves all supported theater modes by invoking callback function once for each supported theater modes. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] camera The handle to the camera * @param[in] callback The callback function to be invoked * @param[in] user_data The user data to be passed to the callback function @@ -2437,7 +2471,7 @@ int camera_attr_foreach_supported_theater_mode(camera_h camera, /** * @brief Sets the brightness level. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @privlevel public * @privilege %http://tizen.org/privilege/camera * @param[in] camera The handle to the camera @@ -2454,7 +2488,7 @@ int camera_attr_set_brightness(camera_h camera, int level); /** * @brief Gets the brightness level. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] camera The handle to the camera * @param[out] level The brightness level * @return @c 0 on success, otherwise a negative error value @@ -2469,7 +2503,7 @@ int camera_attr_get_brightness(camera_h camera, int *level); /** * @brief Gets the available brightness level. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @remarks If the min value is greater than the max value, it means that this feature is not supported. * @param[in] camera The handle to the camera * @param[out] min The minimum brightness level @@ -2486,7 +2520,7 @@ int camera_attr_get_brightness_range(camera_h camera, int *min, int *max); /** * @brief Sets the contrast level. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @privlevel public * @privilege %http://tizen.org/privilege/camera * @param[in] camera The handle to the camera @@ -2503,7 +2537,7 @@ int camera_attr_set_contrast(camera_h camera, int level); /** * @brief Gets the contrast level. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] camera The handle to the camera * @param[out] level The contrast level * @return @c 0 on success, otherwise a negative error value @@ -2518,7 +2552,7 @@ int camera_attr_get_contrast(camera_h camera, int *level); /** * @brief Gets the available contrast level. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @remarks If the min value is greater than the max value, it means that this feature is not supported. * @param[in] camera The handle to the camera * @param[out] min The minimum contrast level @@ -2535,7 +2569,7 @@ int camera_attr_get_contrast_range(camera_h camera, int *min , int *max); /** * @brief Sets the white balance mode. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @privlevel public * @privilege %http://tizen.org/privilege/camera * @param[in] camera The handle to the camera @@ -2552,7 +2586,7 @@ int camera_attr_set_whitebalance(camera_h camera, camera_attr_whitebalance_e whi /** * @brief Gets the white balance mode. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] camera The handle to the camera * @param[out] whitebalance The white balance mode * @return @c 0 on success, otherwise a negative error value @@ -2576,7 +2610,7 @@ int camera_attr_get_whitebalance(camera_h camera, camera_attr_whitebalance_e *wh /** * @brief Retrieves all supported white balances by invoking the callback function once for each supported white balance. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] camera The handle to the camera * @param[in] callback The callback function to be invoked * @param[in] user_data The user data to be passed to the callback function @@ -2604,7 +2638,7 @@ int camera_attr_foreach_supported_whitebalance(camera_h camera, /** * @brief Sets the camera effect mode. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @privlevel public * @privilege %http://tizen.org/privilege/camera * @param[in] camera The handle to the camera @@ -2622,7 +2656,7 @@ int camera_attr_set_effect(camera_h camera, camera_attr_effect_mode_e effect); /** * @brief Gets the camera effect mode. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] camera The handle to the camera * @param[out] effect The camera effect mode * @return @c 0 on success, otherwise a negative error value @@ -2646,7 +2680,7 @@ int camera_attr_get_effect(camera_h camera, camera_attr_effect_mode_e *effect); /** * @brief Retrieves all supported effect modes by invoking the callback function once for each supported effect mode. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] camera The handle to the camera * @param[in] callback The callback function to invoke * @param[in] user_data The user data to be passed to the callback function @@ -2674,7 +2708,7 @@ int camera_attr_foreach_supported_effect(camera_h camera, /** * @brief Sets the scene mode. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @privlevel public * @privilege %http://tizen.org/privilege/camera * @param[in] camera The handle to the camera @@ -2691,7 +2725,7 @@ int camera_attr_set_scene_mode(camera_h camera, camera_attr_scene_mode_e mode); /** * @brief Gets the scene mode. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] camera The handle to the camera * @param[out] mode The scene mode * @return @c 0 on success, otherwise a negative error value @@ -2715,7 +2749,7 @@ int camera_attr_get_scene_mode(camera_h camera, camera_attr_scene_mode_e *mode); /** * @brief Retrieves all supported scene modes by invoking the callback function once for each supported scene mode. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] camera The handle to the camera * @param[in] callback The callback function to invoke * @param[in] user_data The user data to be passed to the callback function @@ -2743,7 +2777,7 @@ int camera_attr_foreach_supported_scene_mode(camera_h camera, /** * @brief Enables to write EXIF(Exchangeable image file format) tags in a JPEG file. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] camera The handle to the camera * @param[in] enable If @c true writing EXIF tags in a JPEG file is enabled, otherwise @c false * @return @c 0 on success, otherwise a negative error value @@ -2757,7 +2791,7 @@ int camera_attr_enable_tag(camera_h camera, bool enable); /** * @brief Gets the value that indicates whether writing EXIF(Exchangeable image file format) tags in a JPEG file is enabled. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] camera The handle to the camera * @param[out] enabled If @c true camera information is enabled, otherwise @c false * @return @c 0 on success, otherwise a negative error value @@ -2771,7 +2805,7 @@ int camera_attr_is_enabled_tag(camera_h camera, bool *enabled); /** * @brief Sets the camera image description in the EXIF(Exchangeable image file format) tag. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] camera The handle to the camera * @param[in] description The string with description * @return @c 0 on success, otherwise a negative error value @@ -2785,7 +2819,7 @@ int camera_attr_set_tag_image_description(camera_h camera, const char *descripti /** * @brief Gets the camera image description in EXIF(Exchangeable image file format) tag. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @remarks You must release @a description using free(). * @param[in] camera The handle to the camera * @param[out] description A pointer to a string @@ -2800,7 +2834,7 @@ int camera_attr_get_tag_image_description(camera_h camera, char **description); /** * @brief Sets the camera orientation in the EXIF(Exchangeable image file format) tag. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] camera The handle to the camera * @param[in] orientation The camera orientation * @return @c 0 on success, otherwise a negative error value @@ -2814,7 +2848,7 @@ int camera_attr_set_tag_orientation(camera_h camera, camera_attr_tag_orientation /** * @brief Gets the camera orientation in the EXIF(Exchangeable image file format) tag. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] camera The handle to the camera * @param[out] orientation The camera orientation * @return @c 0 on success, otherwise a negative error value @@ -2828,7 +2862,7 @@ int camera_attr_get_tag_orientation(camera_h camera, camera_attr_tag_orientation /** * @brief Sets the software information in the EXIF(Exchangeable image file format) tag. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] camera The handle to the camera * @param[in] software The software information tag * @return @c 0 on success, otherwise a negative error value @@ -2842,7 +2876,7 @@ int camera_attr_set_tag_software(camera_h camera, const char *software); /** * @brief Gets the software information in the EXIF(Exchangeable image file format) tag. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @remarks You must release @a software using free(). * @param[in] camera The handle to the camera * @param[out] software A pointer to a string @@ -2857,7 +2891,7 @@ int camera_attr_get_tag_software(camera_h camera, char **software); /** * @brief Sets the geotag(GPS data) in the EXIF(Exchangeable image file format) tag. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] camera The handle to the camera * @param[in] latitude The latitude data * @param[in] longitude The longitude data @@ -2874,7 +2908,7 @@ int camera_attr_set_geotag(camera_h camera, double latitude , double longitude, /** * @brief Gets the geotag(GPS data) in the EXIF(Exchangeable image file format) tag. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] camera The handle to the camera * @param[out] latitude The latitude data * @param[out] longitude The longitude data @@ -2891,7 +2925,7 @@ int camera_attr_get_geotag(camera_h camera, double *latitude , double *longitude /** * @brief Removes the geotag(GPS data) in the EXIF(Exchangeable image file format) tag. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] camera The handle to the camera * @return @c 0 on success, otherwise a negative error value * @retval #CAMERA_ERROR_NONE Successful @@ -2905,9 +2939,11 @@ int camera_attr_remove_geotag(camera_h camera); /** * @brief Sets the camera's flash mode. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @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. * @param[in] camera The handle to the camera * @param[in] mode The flash mode * @return @c 0 on success, otherwise a negative error value @@ -2915,6 +2951,7 @@ int camera_attr_remove_geotag(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 + * @retval #CAMERA_ERROR_DEVICE_BUSY The flash was preempted by other API * @see camera_attr_foreach_supported_flash_mode() * @see camera_attr_get_flash_mode() */ @@ -2922,7 +2959,7 @@ int camera_attr_set_flash_mode(camera_h camera, camera_attr_flash_mode_e mode); /** * @brief Gets the camera's flash mode. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] camera The handle to the camera * @param[out] mode The flash mode * @return @c 0 on success, otherwise a negative error value @@ -2946,7 +2983,7 @@ int camera_attr_get_flash_mode(camera_h camera, camera_attr_flash_mode_e *mode); /** * @brief Retrieves all supported flash modes by invoking the callback function once for each supported flash mode. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] camera The handle to the camera * @param[in] callback The callback function to invoke * @param[in] user_data The user data passed to the callback registration function @@ -2974,7 +3011,7 @@ int camera_attr_foreach_supported_flash_mode(camera_h camera, /** * @brief Gets the camera len's orientation angle. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] camera The handle to the camera * @param[out] angle The orientation angle * @return @c 0 on success, otherwise a negative error value @@ -2988,7 +3025,7 @@ int camera_attr_get_lens_orientation(camera_h camera, int *angle); /** * @brief Sets the stream rotation. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] camera The handle to the camera * @param[in] rotation The stream rotation * @return @c 0 on success, otherwise a negative error value @@ -3003,7 +3040,7 @@ int camera_attr_set_stream_rotation(camera_h camera , camera_rotation_e rotation /** * @brief Gets the stream rotation. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] camera The handle to the camera * @param[out] rotation The stream rotation * @return @c 0 on success, otherwise a negative error value @@ -3027,7 +3064,7 @@ int camera_attr_get_stream_rotation(camera_h camera , camera_rotation_e *rotatio /** * @brief Retrieves all supported stream rotation modes by invoking callback function once for each supported stream rotation mode. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] camera The handle to the camera * @param[in] callback The callback function to invoke * @param[in] user_data The user data to be passed to the callback function @@ -3055,7 +3092,7 @@ int camera_attr_foreach_supported_stream_rotation(camera_h camera, /** * @brief Sets the stream flip. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] camera The handle to the camera * @param[in] flip The stream flip * @return @c 0 on success, otherwise a negative error value @@ -3070,7 +3107,7 @@ int camera_attr_set_stream_flip(camera_h camera , camera_flip_e flip); /** * @brief Gets the stream flip. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] camera The handle to the camera * @param[out] flip The stream flip * @return @c 0 on success, otherwise a negative error value @@ -3094,7 +3131,7 @@ int camera_attr_get_stream_flip(camera_h camera , camera_flip_e *flip); /** * @brief Retrieves all supported stream flip modes by invoking callback function once for each supported stream flip mode. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] camera The handle to the camera * @param[in] callback The callback function to invoke * @param[in] user_data The user data to be passed to the callback function @@ -3122,7 +3159,7 @@ int camera_attr_foreach_supported_stream_flip(camera_h camera, /** * @brief Called when the HDR capture process is updated. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] percent The progress percentage of HDR capture * @param[in] user_data The user data passed from the callback registration function * @pre camera_start_capture() will invoke this callback if you register it using camera_attr_set_hdr_capture_progress_cb(). @@ -3135,7 +3172,7 @@ typedef void (*camera_attr_hdr_progress_cb)(int percent, void *user_data); /** * @brief Sets the mode of HDR(High dynamic range) capture. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @privlevel public * @privilege %http://tizen.org/privilege/camera * @remarks Taking multiple pictures at different exposure levels and intelligently stitching them together so that we eventually arrive at a picture that is representative in both dark and bright areas.\n @@ -3158,7 +3195,7 @@ int camera_attr_set_hdr_mode(camera_h camera, camera_attr_hdr_mode_e mode); /** * @brief Gets the mode of HDR(High dynamic range) capture. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] camera The handle to the camera * @param[out] mode The mode of HDR capture * @return @c 0 on success, otherwise a negative error value @@ -3175,7 +3212,7 @@ int camera_attr_get_hdr_mode(camera_h camera, camera_attr_hdr_mode_e *mode); /** * @brief Registers a callback function to be called when HDR capture is progressing. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @remarks This callback notifies progress of the HDR process. * @param[in] camera The handle to the camera * @param[in] callback The callback function to invoke @@ -3194,7 +3231,7 @@ int camera_attr_set_hdr_capture_progress_cb(camera_h camera, camera_attr_hdr_pro /** * @brief Unregisters the callback function. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] camera The handle to the camera * @return @c 0 on success, otherwise a negative error value * @retval #CAMERA_ERROR_NONE Successful @@ -3211,7 +3248,7 @@ int camera_attr_unset_hdr_capture_progress_cb(camera_h camera); /** * @ingroup CAPI_MEDIA_CAMERA_CAPABILITY_MODULE * @brief Gets the support state of HDR capture. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section. * @param[in] camera The handle to the camera * @return @c true if supported, otherwise @c false @@ -3228,7 +3265,7 @@ bool camera_attr_is_supported_hdr_capture(camera_h camera); /** * @brief Enables/Disables the anti-shake feature. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @privlevel public * @privilege %http://tizen.org/privilege/camera * @remarks This feature is used for image capture. @@ -3247,7 +3284,7 @@ int camera_attr_enable_anti_shake(camera_h camera, bool enable); /** * @brief Gets the state of the anti-shake feature. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] camera The handle to the camera * @param[out] enabled The state of anti-shake * @return @c 0 on success, otherwise a negative error value @@ -3263,7 +3300,7 @@ int camera_attr_is_enabled_anti_shake(camera_h camera , bool *enabled); /** * @ingroup CAPI_MEDIA_CAMERA_CAPABILITY_MODULE * @brief Gets the support state of the anti-shake feature. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section. * @param[in] camera The handle to the camera * @return @c true if supported, otherwise @c false @@ -3278,7 +3315,7 @@ bool camera_attr_is_supported_anti_shake(camera_h camera); /** * @brief Enables/Disables the video stabilization feature. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @privlevel public * @privilege %http://tizen.org/privilege/camera * @remarks If video stabilization is enabled, zero shutter lag is disabled.\n @@ -3298,7 +3335,7 @@ int camera_attr_enable_video_stabilization(camera_h camera, bool enable); /** * @brief Gets the state of the video stabilization feature. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] camera The handle to the camera * @param[out] enabled The state of video stabilization * @return @c 0 on success, otherwise a negative error value @@ -3312,9 +3349,9 @@ int camera_attr_enable_video_stabilization(camera_h camera, bool enable); int camera_attr_is_enabled_video_stabilization(camera_h camera, bool *enabled); /** - * @ingroup CAPI_MEDIA_CAMERA_CAPABILITY_MODULE + * @ingroup CAPI_MEDIA_CAMERA_CAPABILITY_MODULE * @brief Gets the support state of the video stabilization feature. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section. * @param[in] camera The handle to the camera * @return @c true if supported, otherwise @c false @@ -3329,7 +3366,7 @@ bool camera_attr_is_supported_video_stabilization(camera_h camera); /** * @brief Enables/Disables auto contrast. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @privlevel public * @privilege %http://tizen.org/privilege/camera * @param[in] camera The handle to the camera @@ -3345,7 +3382,7 @@ int camera_attr_enable_auto_contrast(camera_h camera, bool enable); /** * @brief Gets the state of auto contrast. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @param[in] camera The handle to the camera * @param[out] enabled The state of auto contrast * @return @c 0 on success, otherwise a negative error value @@ -3369,7 +3406,7 @@ int camera_attr_is_enabled_auto_contrast(camera_h camera, bool *enabled); /** * @brief Gets state of support of auto contrast feature. * @ingroup CAPI_MEDIA_CAMERA_CAPABILITY_MODULE - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section. * @param[in] camera The handle to the camera * @return true on supported, otherwise false @@ -3393,7 +3430,7 @@ bool camera_attr_is_supported_auto_contrast(camera_h camera); /** * @brief Disables shutter sound. - * @since_tizen 2.3 + * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @remarks In some countries, this operation is not permitted. * @param[in] camera The handle to the camera * @param[in] disable If @c true shutter sound is disabled, otherwise @c false diff --git a/packaging/capi-media-camera.spec b/packaging/capi-media-camera.spec index 52d227a..75600cb 100755 --- a/packaging/capi-media-camera.spec +++ b/packaging/capi-media-camera.spec @@ -3,7 +3,7 @@ Name: capi-media-camera Summary: A Camera library in Tizen C API -Version: 0.2.1 +Version: 0.2.2 Release: 0 Group: Multimedia/API License: Apache-2.0 @@ -19,6 +19,7 @@ BuildRequires: pkgconfig(libtbm) BuildRequires: pkgconfig(evas) BuildRequires: pkgconfig(ecore) BuildRequires: pkgconfig(elementary) +BuildRequires: pkgconfig(vconf) Requires(post): /sbin/ldconfig Requires(postun): /sbin/ldconfig diff --git a/src/camera.c b/src/camera.c index 7f2b647..fe94384 100644 --- a/src/camera.c +++ b/src/camera.c @@ -39,15 +39,17 @@ #endif #define LOG_TAG "TIZEN_N_CAMERA" -static gboolean __mm_videostream_callback(MMCamcorderVideoStreamDataType * stream, void *user_data); +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){ + +void _camera_remove_cb_message(camera_s *handle) +{ int ret = 0; GList *list = NULL; camera_cb_data *cb_data = NULL; - if( handle == NULL ){ + if (handle == NULL) { LOGE("handle is NULL"); return; } @@ -56,14 +58,14 @@ void _camera_remove_cb_message(camera_s *handle){ g_mutex_lock(&handle->idle_cb_lock); - if( handle->cb_data_list ){ + if (handle->cb_data_list) { list = handle->cb_data_list; - while( list ){ + while (list) { cb_data = list->data; list = g_list_next(list); - if( !cb_data ){ + if (!cb_data) { LOGW("cb_data is NULL"); } else { ret = g_idle_remove_by_data (cb_data); @@ -89,111 +91,109 @@ void _camera_remove_cb_message(camera_s *handle){ } -int __convert_camera_error_code(const char* func, int code){ +int __convert_camera_error_code(const char *func, int code) +{ int ret = CAMERA_ERROR_NONE; const char *errorstr = NULL; - switch( code ){ - case MM_ERROR_NONE: - ret = CAMERA_ERROR_NONE; - errorstr = "ERROR_NONE"; - break; - case MM_ERROR_CAMCORDER_INVALID_ARGUMENT: - case MM_ERROR_COMMON_INVALID_ATTRTYPE: - ret = CAMERA_ERROR_INVALID_PARAMETER; - errorstr = "INVALID_PARAMETER"; - break; - case MM_ERROR_CAMCORDER_NOT_INITIALIZED: - case MM_ERROR_CAMCORDER_INVALID_STATE: - ret = CAMERA_ERROR_INVALID_STATE; - errorstr = "INVALID_STATE"; - break; - case MM_ERROR_CAMCORDER_DEVICE_NOT_FOUND: - ret = CAMERA_ERROR_DEVICE_NOT_FOUND; - errorstr = "DEVICE_NOT_FOUND"; - break; - case MM_ERROR_CAMCORDER_DEVICE_BUSY: - case MM_ERROR_CAMCORDER_DEVICE_OPEN: - case MM_ERROR_CAMCORDER_CMD_IS_RUNNING: - ret = CAMERA_ERROR_DEVICE_BUSY; - errorstr = "DEVICE_BUSY"; - break; - case MM_ERROR_CAMCORDER_DEVICE: - case MM_ERROR_CAMCORDER_DEVICE_IO: - case MM_ERROR_CAMCORDER_DEVICE_TIMEOUT: - case MM_ERROR_CAMCORDER_DEVICE_WRONG_JPEG: - case MM_ERROR_CAMCORDER_DEVICE_LACK_BUFFER: - ret = CAMERA_ERROR_DEVICE; - errorstr = "ERROR_DEVICE"; - break; - - case MM_ERROR_CAMCORDER_GST_CORE: - case MM_ERROR_CAMCORDER_GST_LIBRARY: - case MM_ERROR_CAMCORDER_GST_RESOURCE: - case MM_ERROR_CAMCORDER_GST_STREAM: - case MM_ERROR_CAMCORDER_GST_STATECHANGE: - case MM_ERROR_CAMCORDER_GST_NEGOTIATION: - case MM_ERROR_CAMCORDER_GST_LINK: - case MM_ERROR_CAMCORDER_GST_FLOW_ERROR: - case MM_ERROR_CAMCORDER_ENCODER: - case MM_ERROR_CAMCORDER_ENCODER_BUFFER: - case MM_ERROR_CAMCORDER_ENCODER_WRONG_TYPE: - case MM_ERROR_CAMCORDER_ENCODER_WORKING: - case MM_ERROR_CAMCORDER_INTERNAL: - case MM_ERROR_CAMCORDER_RESPONSE_TIMEOUT: - case MM_ERROR_CAMCORDER_DSP_FAIL: - case MM_ERROR_CAMCORDER_AUDIO_EMPTY: - case MM_ERROR_CAMCORDER_CREATE_CONFIGURE: - case MM_ERROR_CAMCORDER_FILE_SIZE_OVER: - case MM_ERROR_CAMCORDER_DISPLAY_DEVICE_OFF: - case MM_ERROR_CAMCORDER_INVALID_CONDITION: - ret = CAMERA_ERROR_INVALID_OPERATION; - errorstr = "INVALID_OPERATION"; - break; - - case MM_ERROR_CAMCORDER_RESOURCE_CREATION: - case MM_ERROR_COMMON_OUT_OF_MEMORY: - ret = CAMERA_ERROR_OUT_OF_MEMORY; - errorstr = "OUT_OF_MEMORY"; - break; - - case MM_ERROR_POLICY_BLOCKED: - ret = CAMERA_ERROR_SOUND_POLICY; - errorstr = "ERROR_SOUND_POLICY"; - break; - case MM_ERROR_POLICY_BLOCKED_BY_CALL: - ret = CAMERA_ERROR_SOUND_POLICY_BY_CALL; - errorstr = "ERROR_SOUND_POLICY_BY_CALL"; - break; - case MM_ERROR_POLICY_BLOCKED_BY_ALARM: - ret = CAMERA_ERROR_SOUND_POLICY_BY_ALARM; - errorstr = "ERROR_SOUND_POLICY_BY_ALARM"; - break; - case MM_ERROR_POLICY_RESTRICTED: - ret = CAMERA_ERROR_SECURITY_RESTRICTED; - errorstr = "ERROR_RESTRICTED"; - break; - case MM_ERROR_CAMCORDER_DEVICE_REG_TROUBLE: - ret = CAMERA_ERROR_ESD; - errorstr = "ERROR_ESD"; - break; - case MM_ERROR_COMMON_INVALID_PERMISSION: - ret = CAMERA_ERROR_PERMISSION_DENIED; - errorstr = "ERROR_PERMISSION_DENIED"; - break; - case MM_ERROR_COMMON_OUT_OF_ARRAY: - case MM_ERROR_COMMON_OUT_OF_RANGE: - case MM_ERROR_COMMON_ATTR_NOT_EXIST: - case MM_ERROR_CAMCORDER_NOT_SUPPORTED: - ret = CAMERA_ERROR_NOT_SUPPORTED; - errorstr = "ERROR_NOT_SUPPORTED"; - break; - default: - ret = CAMERA_ERROR_INVALID_OPERATION; - errorstr = "INVALID_OPERATION"; + switch (code) { + case MM_ERROR_NONE: + ret = CAMERA_ERROR_NONE; + errorstr = "ERROR_NONE"; + break; + case MM_ERROR_CAMCORDER_INVALID_ARGUMENT: + case MM_ERROR_COMMON_INVALID_ATTRTYPE: + ret = CAMERA_ERROR_INVALID_PARAMETER; + errorstr = "INVALID_PARAMETER"; + break; + case MM_ERROR_CAMCORDER_NOT_INITIALIZED: + case MM_ERROR_CAMCORDER_INVALID_STATE: + ret = CAMERA_ERROR_INVALID_STATE; + errorstr = "INVALID_STATE"; + break; + case MM_ERROR_CAMCORDER_DEVICE_NOT_FOUND: + ret = CAMERA_ERROR_DEVICE_NOT_FOUND; + errorstr = "DEVICE_NOT_FOUND"; + break; + case MM_ERROR_CAMCORDER_DEVICE_BUSY: + case MM_ERROR_CAMCORDER_DEVICE_OPEN: + case MM_ERROR_CAMCORDER_CMD_IS_RUNNING: + ret = CAMERA_ERROR_DEVICE_BUSY; + errorstr = "DEVICE_BUSY"; + break; + case MM_ERROR_CAMCORDER_DEVICE: + case MM_ERROR_CAMCORDER_DEVICE_IO: + case MM_ERROR_CAMCORDER_DEVICE_TIMEOUT: + case MM_ERROR_CAMCORDER_DEVICE_WRONG_JPEG: + case MM_ERROR_CAMCORDER_DEVICE_LACK_BUFFER: + ret = CAMERA_ERROR_DEVICE; + errorstr = "ERROR_DEVICE"; + break; + case MM_ERROR_CAMCORDER_GST_CORE: + case MM_ERROR_CAMCORDER_GST_LIBRARY: + case MM_ERROR_CAMCORDER_GST_RESOURCE: + case MM_ERROR_CAMCORDER_GST_STREAM: + case MM_ERROR_CAMCORDER_GST_STATECHANGE: + case MM_ERROR_CAMCORDER_GST_NEGOTIATION: + case MM_ERROR_CAMCORDER_GST_LINK: + case MM_ERROR_CAMCORDER_GST_FLOW_ERROR: + case MM_ERROR_CAMCORDER_ENCODER: + case MM_ERROR_CAMCORDER_ENCODER_BUFFER: + case MM_ERROR_CAMCORDER_ENCODER_WRONG_TYPE: + case MM_ERROR_CAMCORDER_ENCODER_WORKING: + case MM_ERROR_CAMCORDER_INTERNAL: + case MM_ERROR_CAMCORDER_RESPONSE_TIMEOUT: + case MM_ERROR_CAMCORDER_DSP_FAIL: + case MM_ERROR_CAMCORDER_AUDIO_EMPTY: + case MM_ERROR_CAMCORDER_CREATE_CONFIGURE: + case MM_ERROR_CAMCORDER_FILE_SIZE_OVER: + case MM_ERROR_CAMCORDER_DISPLAY_DEVICE_OFF: + case MM_ERROR_CAMCORDER_INVALID_CONDITION: + ret = CAMERA_ERROR_INVALID_OPERATION; + errorstr = "INVALID_OPERATION"; + break; + case MM_ERROR_CAMCORDER_RESOURCE_CREATION: + case MM_ERROR_COMMON_OUT_OF_MEMORY: + ret = CAMERA_ERROR_OUT_OF_MEMORY; + errorstr = "OUT_OF_MEMORY"; + break; + case MM_ERROR_POLICY_BLOCKED: + ret = CAMERA_ERROR_SOUND_POLICY; + errorstr = "ERROR_SOUND_POLICY"; + break; + case MM_ERROR_POLICY_BLOCKED_BY_CALL: + ret = CAMERA_ERROR_SOUND_POLICY_BY_CALL; + errorstr = "ERROR_SOUND_POLICY_BY_CALL"; + break; + case MM_ERROR_POLICY_BLOCKED_BY_ALARM: + ret = CAMERA_ERROR_SOUND_POLICY_BY_ALARM; + errorstr = "ERROR_SOUND_POLICY_BY_ALARM"; + break; + case MM_ERROR_POLICY_RESTRICTED: + ret = CAMERA_ERROR_SECURITY_RESTRICTED; + errorstr = "ERROR_RESTRICTED"; + break; + case MM_ERROR_CAMCORDER_DEVICE_REG_TROUBLE: + ret = CAMERA_ERROR_ESD; + errorstr = "ERROR_ESD"; + break; + case MM_ERROR_COMMON_INVALID_PERMISSION: + ret = CAMERA_ERROR_PERMISSION_DENIED; + errorstr = "ERROR_PERMISSION_DENIED"; + break; + case MM_ERROR_COMMON_OUT_OF_ARRAY: + case MM_ERROR_COMMON_OUT_OF_RANGE: + case MM_ERROR_COMMON_ATTR_NOT_EXIST: + case MM_ERROR_CAMCORDER_NOT_SUPPORTED: + ret = CAMERA_ERROR_NOT_SUPPORTED; + errorstr = "ERROR_NOT_SUPPORTED"; + break; + default: + ret = CAMERA_ERROR_INVALID_OPERATION; + errorstr = "INVALID_OPERATION"; } - if( code != MM_ERROR_NONE ){ + if (code != MM_ERROR_NONE) { LOGE("%s(0x%08x) : core frameworks error code(0x%08x)", errorstr, ret, code); } @@ -201,58 +201,66 @@ 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) +static gboolean __mm_videostream_callback(MMCamcorderVideoStreamDataType *stream, void *user_data) +{ + if (user_data == NULL || stream == NULL) { return 0; + } + + camera_s *handle = (camera_s *)user_data; - 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_data_s frame; - frame.format = stream->format; - if( frame.format == (camera_pixel_format_e)MM_PIXEL_FORMAT_ITLV_JPEG_UYVY ) + + if (stream->format == MM_PIXEL_FORMAT_ITLV_JPEG_UYVY) { frame.format = MM_PIXEL_FORMAT_UYVY; + } else { + frame.format = stream->format; + } frame.width = stream->width; frame.height = stream->height; frame.timestamp = stream->timestamp; frame.num_of_planes = stream->num_planes; - switch( stream->data_type ){ - case MM_CAM_STREAM_DATA_YUV420 : - frame.data.single_plane.yuv = stream->data.yuv420.yuv; - frame.data.single_plane.size = stream->data.yuv420.length_yuv; - break; - case MM_CAM_STREAM_DATA_YUV422: - frame.data.single_plane.yuv = stream->data.yuv422.yuv; - frame.data.single_plane.size = stream->data.yuv422.length_yuv; - break; - case MM_CAM_STREAM_DATA_YUV420SP: - frame.data.double_plane.y = stream->data.yuv420sp.y; - frame.data.double_plane.uv = stream->data.yuv420sp.uv; - frame.data.double_plane.y_size = stream->data.yuv420sp.length_y; - frame.data.double_plane.uv_size = stream->data.yuv420sp.length_uv; - break; - case MM_CAM_STREAM_DATA_YUV420P: - frame.data.triple_plane.y = stream->data.yuv420p.y; - frame.data.triple_plane.u = stream->data.yuv420p.u; - frame.data.triple_plane.v = stream->data.yuv420p.v; - frame.data.triple_plane.y_size = stream->data.yuv420p.length_y; - frame.data.triple_plane.u_size = stream->data.yuv420p.length_u; - frame.data.triple_plane.v_size = stream->data.yuv420p.length_v; - break; - case MM_CAM_STREAM_DATA_YUV422P: - frame.data.triple_plane.y = stream->data.yuv422p.y; - frame.data.triple_plane.u = stream->data.yuv422p.u; - frame.data.triple_plane.v = stream->data.yuv422p.v; - frame.data.triple_plane.y_size = stream->data.yuv422p.length_y; - frame.data.triple_plane.u_size = stream->data.yuv422p.length_u; - frame.data.triple_plane.v_size = stream->data.yuv422p.length_v; - break; - default : - break; + + switch (stream->data_type) { + case MM_CAM_STREAM_DATA_YUV420: + frame.data.single_plane.yuv = stream->data.yuv420.yuv; + frame.data.single_plane.size = stream->data.yuv420.length_yuv; + break; + case MM_CAM_STREAM_DATA_YUV422: + frame.data.single_plane.yuv = stream->data.yuv422.yuv; + frame.data.single_plane.size = stream->data.yuv422.length_yuv; + break; + case MM_CAM_STREAM_DATA_YUV420SP: + frame.data.double_plane.y = stream->data.yuv420sp.y; + frame.data.double_plane.uv = stream->data.yuv420sp.uv; + frame.data.double_plane.y_size = stream->data.yuv420sp.length_y; + frame.data.double_plane.uv_size = stream->data.yuv420sp.length_uv; + break; + case MM_CAM_STREAM_DATA_YUV420P: + frame.data.triple_plane.y = stream->data.yuv420p.y; + frame.data.triple_plane.u = stream->data.yuv420p.u; + frame.data.triple_plane.v = stream->data.yuv420p.v; + frame.data.triple_plane.y_size = stream->data.yuv420p.length_y; + frame.data.triple_plane.u_size = stream->data.yuv420p.length_u; + frame.data.triple_plane.v_size = stream->data.yuv420p.length_v; + break; + case MM_CAM_STREAM_DATA_YUV422P: + frame.data.triple_plane.y = stream->data.yuv422p.y; + frame.data.triple_plane.u = stream->data.yuv422p.u; + frame.data.triple_plane.v = stream->data.yuv422p.v; + frame.data.triple_plane.y_size = stream->data.yuv422p.length_y; + frame.data.triple_plane.u_size = stream->data.yuv422p.length_u; + frame.data.triple_plane.v_size = stream->data.yuv422p.length_v; + break; + default : + break; } + ((camera_preview_cb)handle->user_cb[_CAMERA_EVENT_TYPE_PREVIEW])(&frame, handle->user_data[_CAMERA_EVENT_TYPE_PREVIEW]); } - if( handle->user_cb[_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] ){ + if (handle->user_cb[_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW]) { media_packet_h pkt = NULL; tbm_surface_h tsurf = NULL; uint32_t bo_format = 0; @@ -261,34 +269,77 @@ static gboolean __mm_videostream_callback(MMCamcorderVideoStreamDataType * strea int ret = 0; media_format_mimetype_e mimetype = MEDIA_FORMAT_NV12; bool make_pkt_fmt = false; + tbm_surface_info_s tsurf_info; + + memset(&tsurf_info, 0x0, sizeof(tbm_surface_info_s)); /* create tbm surface */ - for( i = 0, bo_num = 0 ; i < BUFFER_MAX_PLANE_NUM ; i++ ){ - if( stream->bo[i] ){ + for (i = 0, bo_num = 0 ; i < BUFFER_MAX_PLANE_NUM ; i++) { + if (stream->bo[i]) { bo_num++; } + tsurf_info.planes[i].stride = stream->stride[i]; } /* get tbm surface format */ ret = _camera_get_tbm_surface_format(stream->format, &bo_format); ret |= _camera_get_media_packet_mimetype(stream->format, &mimetype); - if( bo_num > 0 && ret == CAMERA_ERROR_NONE ){ - tsurf = tbm_surface_internal_create_with_bos(stream->width, stream->height, bo_format, (tbm_bo *)stream->bo, bo_num); + if (bo_num > 0 && ret == CAMERA_ERROR_NONE) { + tsurf_info.width = stream->width; + tsurf_info.height = stream->height; + tsurf_info.format = bo_format; + tsurf_info.bpp = tbm_surface_internal_get_bpp(bo_format); + tsurf_info.num_planes = tbm_surface_internal_get_num_planes(bo_format); + + switch (bo_format) { + case TBM_FORMAT_NV12: + case TBM_FORMAT_NV21: + tsurf_info.planes[0].size = stream->stride[0] * stream->elevation[0]; + tsurf_info.planes[1].size = stream->stride[1] * stream->elevation[1]; + tsurf_info.planes[0].offset = 0; + if (bo_num == 1) { + tsurf_info.planes[1].offset = tsurf_info.planes[0].size; + } + tsurf_info.size = tsurf_info.planes[0].size + tsurf_info.planes[1].size; + break; + case TBM_FORMAT_YUV420: + case TBM_FORMAT_YVU420: + tsurf_info.planes[0].size = stream->stride[0] * stream->elevation[0]; + tsurf_info.planes[1].size = stream->stride[1] * stream->elevation[1]; + tsurf_info.planes[2].size = stream->stride[2] * stream->elevation[2]; + tsurf_info.planes[0].offset = 0; + if (bo_num == 1) { + tsurf_info.planes[1].offset = tsurf_info.planes[0].size; + tsurf_info.planes[2].offset = tsurf_info.planes[0].size + tsurf_info.planes[1].size; + } + tsurf_info.size = tsurf_info.planes[0].size + tsurf_info.planes[1].size + tsurf_info.planes[2].size; + break; + case TBM_FORMAT_UYVY: + case TBM_FORMAT_YUYV: + tsurf_info.planes[0].size = (stream->stride[0] * stream->elevation[0]) << 1; + tsurf_info.planes[0].offset = 0; + tsurf_info.size = tsurf_info.planes[0].size; + break; + default: + break; + } + + tsurf = tbm_surface_internal_create_with_bos(&tsurf_info, (tbm_bo *)stream->bo, bo_num); /*LOGD("tbm surface %p", tsurf);*/ } - if( tsurf ){ + if (tsurf) { /* check media packet format */ - if( handle->pkt_fmt ){ + if (handle->pkt_fmt) { int pkt_fmt_width = 0; int pkt_fmt_height = 0; media_format_mimetype_e pkt_fmt_mimetype = MEDIA_FORMAT_NV12; media_format_get_video_info(handle->pkt_fmt, &pkt_fmt_mimetype, &pkt_fmt_width, &pkt_fmt_height, NULL, NULL); - if( pkt_fmt_mimetype != mimetype || + if (pkt_fmt_mimetype != mimetype || pkt_fmt_width != stream->width || - pkt_fmt_height != stream->height ){ + pkt_fmt_height != stream->height) { LOGW("different format. current 0x%x, %dx%d, new 0x%x, %dx%d", pkt_fmt_mimetype, pkt_fmt_width, pkt_fmt_height, mimetype, stream->width, stream->height); media_format_unref(handle->pkt_fmt); @@ -300,7 +351,7 @@ static gboolean __mm_videostream_callback(MMCamcorderVideoStreamDataType * strea } /* create packet format */ - if( make_pkt_fmt ){ + if (make_pkt_fmt) { LOGW("make new pkt_fmt - mimetype 0x%x, %dx%d", mimetype, stream->width, stream->height); ret = media_format_create(&handle->pkt_fmt); if (ret == MEDIA_FORMAT_ERROR_NONE) { @@ -315,7 +366,7 @@ static gboolean __mm_videostream_callback(MMCamcorderVideoStreamDataType * strea /* create media packet */ ret = media_packet_create_from_tbm_surface(handle->pkt_fmt, tsurf, (media_packet_finalize_cb)_camera_media_packet_finalize, (void *)handle, &pkt); - if( ret != MEDIA_PACKET_ERROR_NONE ){ + if (ret != MEDIA_PACKET_ERROR_NONE) { LOGE("media_packet_create_from_tbm_surface failed"); tbm_surface_destroy(tsurf); @@ -325,19 +376,19 @@ static gboolean __mm_videostream_callback(MMCamcorderVideoStreamDataType * strea LOGE("failed to create tbm surface %dx%d, format %d, bo_num %d", stream->width, stream->height, stream->format, bo_num); } - if( pkt ){ + if (pkt) { /*LOGD("media packet %p, internal buffer %p", pkt, stream->internal_buffer);*/ /* set internal buffer */ ret = media_packet_set_extra(pkt, stream->internal_buffer); - if( ret != MEDIA_PACKET_ERROR_NONE ){ + if (ret != MEDIA_PACKET_ERROR_NONE) { LOGE("media_packet_set_extra failed"); media_packet_destroy(pkt); pkt = NULL; } else { /* set timestamp : msec -> nsec */ - if( media_packet_set_pts(pkt, (uint64_t)(stream->timestamp) * 1000000) != MEDIA_PACKET_ERROR_NONE ){ + if (media_packet_set_pts(pkt, (uint64_t)(stream->timestamp) * 1000000) != MEDIA_PACKET_ERROR_NONE) { LOGW("media_packet_set_pts failed"); } @@ -353,43 +404,55 @@ static gboolean __mm_videostream_callback(MMCamcorderVideoStreamDataType * strea return 1; } -static gboolean __mm_capture_callback(MMCamcorderCaptureDataType *frame, MMCamcorderCaptureDataType *thumbnail, void *user_data){ - if( user_data == NULL || frame == NULL) + +static gboolean __mm_capture_callback(MMCamcorderCaptureDataType *frame, MMCamcorderCaptureDataType *thumbnail, void *user_data) +{ + if (user_data == NULL || frame == NULL) { return 0; + } + + camera_s *handle = (camera_s *)user_data; + int ret = MM_ERROR_NONE; + unsigned char *exif = NULL; + int exif_size = 0; + MMCamcorderCaptureDataType *scrnl = NULL; + int scrnl_size = 0; - camera_s * handle = (camera_s*)user_data; handle->current_capture_count++; - if( handle->user_cb[_CAMERA_EVENT_TYPE_CAPTURE] ){ - MMCamcorderCaptureDataType *scrnl = NULL; - int size = 0; + + if (handle->user_cb[_CAMERA_EVENT_TYPE_CAPTURE]) { camera_image_data_s image = { NULL, 0, 0, 0, 0, NULL, 0 }; camera_image_data_s thumb = { NULL, 0, 0, 0, 0, NULL, 0 }; camera_image_data_s postview = { NULL, 0, 0, 0, 0, NULL, 0 }; - if( frame ){ - int ret; - unsigned char *exif; - int exif_size; + + if (frame) { image.data = frame->data; image.size = frame->length; image.width = frame->width; image.height = frame->height; image.format = frame->format; - ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, "captured-exif-raw-data", &exif, &exif_size, NULL); - if( ret == MM_ERROR_NONE ){ + + ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, + "captured-exif-raw-data", &exif, &exif_size, + NULL); + if (ret == MM_ERROR_NONE) { image.exif = exif; image.exif_size = exif_size; } } - if( thumbnail ){ + if (thumbnail) { thumb.data = thumbnail->data; thumb.size = thumbnail->length; thumb.width = thumbnail->width; thumb.height = thumbnail->height; thumb.format = thumbnail->format; } - mm_camcorder_get_attributes( handle->mm_handle, NULL, "captured-screennail", &scrnl, &size,NULL ); - if( scrnl ){ + + ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, + "captured-screennail", &scrnl, &scrnl_size, + NULL); + if (ret == MM_ERROR_NONE && scrnl) { postview.data = scrnl->data; postview.size = scrnl->length; postview.width = scrnl->width; @@ -397,312 +460,373 @@ static gboolean __mm_capture_callback(MMCamcorderCaptureDataType *frame, MMCamco postview.format = scrnl->format; } - ((camera_capturing_cb)handle->user_cb[_CAMERA_EVENT_TYPE_CAPTURE])(&image, scrnl ? &postview : NULL, thumbnail ? &thumb : NULL, handle->user_data[_CAMERA_EVENT_TYPE_CAPTURE]); + ((camera_capturing_cb)handle->user_cb[_CAMERA_EVENT_TYPE_CAPTURE])(&image, + 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 ){ + + /* update captured state */ + if (handle->capture_count == 1 && handle->hdr_keep_mode) { + 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; } return 1; } -static camera_state_e __camera_state_convert(MMCamcorderStateType mm_state){ + +static camera_state_e __camera_state_convert(MMCamcorderStateType mm_state) +{ camera_state_e state = CAMERA_STATE_NONE; - switch( mm_state ){ - case MM_CAMCORDER_STATE_NONE: - state = CAMERA_STATE_NONE; - break; - case MM_CAMCORDER_STATE_NULL: - state = CAMERA_STATE_CREATED; - break; - case MM_CAMCORDER_STATE_READY: - state = CAMERA_STATE_CREATED; - break; - case MM_CAMCORDER_STATE_PREPARE: - state = CAMERA_STATE_PREVIEW; - break; - case MM_CAMCORDER_STATE_CAPTURING: - state = CAMERA_STATE_CAPTURING; - break; - case MM_CAMCORDER_STATE_RECORDING: - state = CAMERA_STATE_PREVIEW; - break; - case MM_CAMCORDER_STATE_PAUSED: - state = CAMERA_STATE_PREVIEW; - break; - default: - state = CAMERA_STATE_NONE; - break; + switch (mm_state) { + case MM_CAMCORDER_STATE_NONE: + state = CAMERA_STATE_NONE; + break; + case MM_CAMCORDER_STATE_NULL: + state = CAMERA_STATE_CREATED; + break; + case MM_CAMCORDER_STATE_READY: + state = CAMERA_STATE_CREATED; + break; + case MM_CAMCORDER_STATE_PREPARE: + state = CAMERA_STATE_PREVIEW; + break; + case MM_CAMCORDER_STATE_CAPTURING: + state = CAMERA_STATE_CAPTURING; + break; + case MM_CAMCORDER_STATE_RECORDING: + state = CAMERA_STATE_PREVIEW; + break; + case MM_CAMCORDER_STATE_PAUSED: + state = CAMERA_STATE_PREVIEW; + break; + default: + state = CAMERA_STATE_NONE; + break; } return state; } -static int __mm_camera_message_callback(int message, void *param, void *user_data){ - if( user_data == NULL || param == NULL ) +static int __mm_camera_message_callback(int message, void *param, void *user_data) +{ + if (user_data == NULL || param == NULL) { return 0; + } - camera_s * handle = (camera_s*)user_data; + int i = 0; + int camera_error = 0; + camera_s *handle = (camera_s *)user_data; + MMMessageParamType *m = (MMMessageParamType *)param; + camera_state_e previous_state; + camera_policy_e policy = CAMERA_POLICY_NONE; + MMCamRecordingReport *report = NULL; + 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); + } - MMMessageParamType *m = (MMMessageParamType*)param; - camera_state_e previous_state; + switch (message) { + case MM_MESSAGE_CAMCORDER_STATE_CHANGED: + case MM_MESSAGE_CAMCORDER_STATE_CHANGED_BY_ASM: + case MM_MESSAGE_CAMCORDER_STATE_CHANGED_BY_SECURITY: + if (message == MM_MESSAGE_CAMCORDER_STATE_CHANGED && + (m->state.previous < MM_CAMCORDER_STATE_NONE || + m->state.previous > MM_CAMCORDER_STATE_PAUSED || + m->state.code != 0)) { + LOGI( "Invalid state changed message"); + break; + } + previous_state = handle->state; + handle->state = __camera_state_convert(m->state.current ); - switch(message){ - case MM_MESSAGE_CAMCORDER_STATE_CHANGED: - case MM_MESSAGE_CAMCORDER_STATE_CHANGED_BY_ASM: - case MM_MESSAGE_CAMCORDER_STATE_CHANGED_BY_SECURITY: - if( message == MM_MESSAGE_CAMCORDER_STATE_CHANGED && (m->state.previous < MM_CAMCORDER_STATE_NONE || m->state.previous > MM_CAMCORDER_STATE_PAUSED || m->state.code != 0) ){ - LOGI( "Invalid state changed message"); + if (message == MM_MESSAGE_CAMCORDER_STATE_CHANGED_BY_ASM) { + switch (m->state.code) { + case ASM_EVENT_SOURCE_CALL_START: + case ASM_EVENT_SOURCE_CALL_END: + policy = CAMERA_POLICY_SOUND_BY_CALL; + LOGW("CAMERA_POLICY_SOUND_BY_CALL"); + break; + case ASM_EVENT_SOURCE_ALARM_START: + case ASM_EVENT_SOURCE_ALARM_END: + policy = CAMERA_POLICY_SOUND_BY_ALARM; + LOGW("CAMERA_POLICY_SOUND_BY_ALARM"); + break; + default: + policy = CAMERA_POLICY_SOUND; + LOGW("CAMERA_POLICY_SOUND"); break; } + } else if (message == MM_MESSAGE_CAMCORDER_STATE_CHANGED_BY_SECURITY) { + policy = CAMERA_POLICY_SECURITY; + LOGW("CAMERA_POLICY_SECURITY"); + } - previous_state = handle->state; - handle->state = __camera_state_convert(m->state.current ); - camera_policy_e policy = CAMERA_POLICY_NONE; - if (message == MM_MESSAGE_CAMCORDER_STATE_CHANGED_BY_ASM) { - switch (m->state.code) { - case ASM_EVENT_SOURCE_CALL_START: - policy = CAMERA_POLICY_SOUND_BY_CALL; - LOGW("CAMERA_POLICY_SOUND_BY_CALL"); - break; - case ASM_EVENT_SOURCE_ALARM_START: - case ASM_EVENT_SOURCE_ALARM_END: - policy = CAMERA_POLICY_SOUND_BY_ALARM; - LOGW("CAMERA_POLICY_SOUND_BY_ALARM"); - break; - default: - policy = CAMERA_POLICY_SOUND; - LOGW("CAMERA_POLICY_SOUND"); - break; - } - } else if (message == MM_MESSAGE_CAMCORDER_STATE_CHANGED_BY_SECURITY) { - policy = CAMERA_POLICY_SECURITY; - LOGW("CAMERA_POLICY_SECURITY"); - } + 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]); + } - 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]); + /* 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]) { + ((camera_interrupted_cb)handle->user_cb[_CAMERA_EVENT_TYPE_INTERRUPTED])(policy, + previous_state, + handle->state, + handle->user_data[_CAMERA_EVENT_TYPE_INTERRUPTED]); + } else { + LOGW("_CAMERA_EVENT_TYPE_INTERRUPTED cb is NULL"); } - - // 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]){ - ((camera_interrupted_cb)handle->user_cb[_CAMERA_EVENT_TYPE_INTERRUPTED])(policy, previous_state, handle->state, handle->user_data[_CAMERA_EVENT_TYPE_INTERRUPTED]); - } else { - LOGW("_CAMERA_EVENT_TYPE_INTERRUPTED cb is NULL"); - } + } + 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, + handle->user_data[_CAMERA_EVENT_TYPE_FOCUS_CHANGE]); + } + break; + case MM_MESSAGE_CAMCORDER_CAPTURED: + handle->current_capture_complete_count = m->code; + if (handle->capture_count == 1 || + m->code == handle->capture_count || + (handle->is_continuous_shot_break && + handle->state == CAMERA_STATE_CAPTURING)) { + /* 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]) { + ((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]); } - - 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, handle->user_data[_CAMERA_EVENT_TYPE_FOCUS_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]); } + } + break; + case MM_MESSAGE_CAMCORDER_VIDEO_CAPTURED: + case MM_MESSAGE_CAMCORDER_AUDIO_CAPTURED: + report = (MMCamRecordingReport *)m->data; + if (report != NULL && report->recording_filename) { + free(report->recording_filename); + report->recording_filename = NULL; + } + if (report) { + free(report); + report = NULL; + } + break; + case MM_MESSAGE_CAMCORDER_VIDEO_SNAPSHOT_CAPTURED: + 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_TIMEOUT: + case MM_ERROR_CAMCORDER_DEVICE_WRONG_JPEG: + camera_error = CAMERA_ERROR_DEVICE; break; - case MM_MESSAGE_CAMCORDER_CAPTURED: - { - handle->current_capture_complete_count = m->code; - if( handle->capture_count == 1 || m->code == handle->capture_count ||(handle->is_continuous_shot_break && handle->state == CAMERA_STATE_CAPTURING) ){ - //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] ){ - ((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]); - } - 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]); - } - } + case MM_ERROR_CAMCORDER_GST_CORE: + case MM_ERROR_CAMCORDER_GST_LIBRARY: + case MM_ERROR_CAMCORDER_GST_RESOURCE: + case MM_ERROR_CAMCORDER_GST_STREAM: + case MM_ERROR_CAMCORDER_GST_NEGOTIATION: + case MM_ERROR_CAMCORDER_GST_FLOW_ERROR: + case MM_ERROR_CAMCORDER_ENCODER: + case MM_ERROR_CAMCORDER_ENCODER_BUFFER: + case MM_ERROR_CAMCORDER_ENCODER_WORKING: + case MM_ERROR_CAMCORDER_MNOTE_CREATION: + case MM_ERROR_CAMCORDER_MNOTE_ADD_ENTRY: + case MM_ERROR_CAMCORDER_INTERNAL: + case MM_ERROR_FILE_NOT_FOUND: + case MM_ERROR_FILE_READ: + camera_error = CAMERA_ERROR_INVALID_OPERATION; break; - } - case MM_MESSAGE_CAMCORDER_VIDEO_CAPTURED: - case MM_MESSAGE_CAMCORDER_AUDIO_CAPTURED: - { - MMCamRecordingReport *report = (MMCamRecordingReport *)m ->data; - if( report != NULL && report->recording_filename ){ - free(report->recording_filename ); - report->recording_filename = NULL; - } - if( report ){ - free(report); - report = NULL; - } + case MM_ERROR_CAMCORDER_LOW_MEMORY: + case MM_ERROR_CAMCORDER_MNOTE_MALLOC: + camera_error = CAMERA_ERROR_OUT_OF_MEMORY; break; - } - case MM_MESSAGE_CAMCORDER_VIDEO_SNAPSHOT_CAPTURED: - { - 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]); - } + case MM_ERROR_CAMCORDER_DEVICE_REG_TROUBLE: + camera_error = CAMERA_ERROR_ESD; + break; + default : + camera_error = CAMERA_ERROR_INVALID_OPERATION; break; } - case MM_MESSAGE_CAMCORDER_ERROR: - { - int errorcode = m->code; - int camera_error = 0; - switch( errorcode ){ - case MM_ERROR_CAMCORDER_DEVICE : - case MM_ERROR_CAMCORDER_DEVICE_TIMEOUT: - case MM_ERROR_CAMCORDER_DEVICE_WRONG_JPEG: - camera_error = CAMERA_ERROR_DEVICE; - break; - case MM_ERROR_CAMCORDER_GST_CORE: - case MM_ERROR_CAMCORDER_GST_LIBRARY: - case MM_ERROR_CAMCORDER_GST_RESOURCE: - case MM_ERROR_CAMCORDER_GST_STREAM: - case MM_ERROR_CAMCORDER_GST_NEGOTIATION: - case MM_ERROR_CAMCORDER_GST_FLOW_ERROR: - case MM_ERROR_CAMCORDER_ENCODER: - case MM_ERROR_CAMCORDER_ENCODER_BUFFER: - case MM_ERROR_CAMCORDER_ENCODER_WORKING: - case MM_ERROR_CAMCORDER_MNOTE_CREATION: - case MM_ERROR_CAMCORDER_MNOTE_ADD_ENTRY: - case MM_ERROR_CAMCORDER_INTERNAL: - case MM_ERROR_FILE_NOT_FOUND: - case MM_ERROR_FILE_READ: - camera_error = CAMERA_ERROR_INVALID_OPERATION; - break; - case MM_ERROR_CAMCORDER_LOW_MEMORY: - case MM_ERROR_CAMCORDER_MNOTE_MALLOC: - camera_error = CAMERA_ERROR_OUT_OF_MEMORY; - break; - case MM_ERROR_CAMCORDER_DEVICE_REG_TROUBLE: - camera_error = CAMERA_ERROR_ESD; - break; - default : - camera_error = CAMERA_ERROR_INVALID_OPERATION; - break; - } - /* set capture completed flag as true to release camera handle */ - handle->is_capture_completed = true; - - 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]); + /* set capture completed flag as true to release camera handle */ + handle->is_capture_completed = true; - break; + 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]); } - case MM_MESSAGE_CAMCORDER_HDR_PROGRESS: - { - int percent = m->code; - if( handle->user_cb[_CAMERA_EVENT_TYPE_HDR_PROGRESS] ) - ((camera_attr_hdr_progress_cb)handle->user_cb[_CAMERA_EVENT_TYPE_HDR_PROGRESS])(percent, handle->user_data[_CAMERA_EVENT_TYPE_HDR_PROGRESS]); - break; + + break; + case MM_MESSAGE_CAMCORDER_HDR_PROGRESS: + if (handle->user_cb[_CAMERA_EVENT_TYPE_HDR_PROGRESS]) { + ((camera_attr_hdr_progress_cb)handle->user_cb[_CAMERA_EVENT_TYPE_HDR_PROGRESS])(m->code, + handle->user_data[_CAMERA_EVENT_TYPE_HDR_PROGRESS]); } - case MM_MESSAGE_CAMCORDER_FACE_DETECT_INFO: - { - MMCamFaceDetectInfo *cam_fd_info = (MMCamFaceDetectInfo *)(m->data); - if ( cam_fd_info ) { - camera_detected_face_s faces[cam_fd_info->num_of_faces]; - handle->num_of_faces = cam_fd_info->num_of_faces > MAX_DETECTED_FACE ? MAX_DETECTED_FACE : cam_fd_info->num_of_faces; - int i; - for(i=0; i < handle->num_of_faces ; i++){ - faces[i].id = cam_fd_info->face_info[i].id; - faces[i].score = cam_fd_info->face_info[i].score; - faces[i].x = cam_fd_info->face_info[i].rect.x; - faces[i].y = cam_fd_info->face_info[i].rect.y; - faces[i].width = cam_fd_info->face_info[i].rect.width; - faces[i].height = cam_fd_info->face_info[i].rect.height; - handle->faceinfo[i] = faces[i]; //cache face coordinate - } - 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]); - }else{ - handle->num_of_faces = 0; + break; + case MM_MESSAGE_CAMCORDER_FACE_DETECT_INFO: + cam_fd_info = (MMCamFaceDetectInfo *)(m->data); + if (cam_fd_info) { + camera_detected_face_s faces[cam_fd_info->num_of_faces]; + handle->num_of_faces = cam_fd_info->num_of_faces > MAX_DETECTED_FACE ? MAX_DETECTED_FACE : cam_fd_info->num_of_faces; + + for (i = 0 ; i < handle->num_of_faces ; i++) { + faces[i].id = cam_fd_info->face_info[i].id; + faces[i].score = cam_fd_info->face_info[i].score; + faces[i].x = cam_fd_info->face_info[i].rect.x; + faces[i].y = cam_fd_info->face_info[i].rect.y; + faces[i].width = cam_fd_info->face_info[i].rect.width; + faces[i].height = cam_fd_info->face_info[i].rect.height; + handle->faceinfo[i] = faces[i]; //cache face coordinate } - break; + + 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]); + } + } else { + handle->num_of_faces = 0; } - default: - break; + break; + default: + break; } return 1; } -static int __capture_completed_event_cb(void *data){ - camera_s *handle = (camera_s*)data; - if( handle->current_capture_count > 0 && handle->current_capture_count == handle->current_capture_complete_count && handle->state == CAMERA_STATE_CAPTURING ){ - //pseudo state change - camera_state_e previous_state = handle->state; + +static int __capture_completed_event_cb(void *data) +{ + camera_s *handle = (camera_s *)data; + camera_state_e previous_state = CAMERA_STATE_NONE; + + if (handle == NULL) { + LOGE("handle is NULL"); + return false; + } + + if (handle->current_capture_count > 0 && + handle->current_capture_count == handle->current_capture_complete_count && + handle->state == CAMERA_STATE_CAPTURING) { + /* 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] ){ - ((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]); + + 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]); } - 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; } -int camera_create(camera_device_e device, camera_h* camera){ - - if( camera == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); +int camera_create(camera_device_e device, camera_h* camera) +{ + if (camera == NULL){ + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; + int ret = MM_ERROR_NONE;; MMCamPreset info; int preview_format; int rotation; + camera_s *handle = NULL; + char *error = NULL; LOGW("device name = [%d]",device); info.videodev_type = device; - camera_s* handle = (camera_s*)malloc( sizeof(camera_s) ); - if( handle==NULL ){ + handle = (camera_s*)malloc( sizeof(camera_s) ); + if (handle == NULL) { LOGE("malloc fail"); return CAMERA_ERROR_OUT_OF_MEMORY; } - memset(handle, 0 , sizeof(camera_s)); + + memset(handle, 0x0, sizeof(camera_s)); ret = mm_camcorder_create(&handle->mm_handle, &info); - if( ret != MM_ERROR_NONE ){ + if (ret != MM_ERROR_NONE) { free(handle); 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, NULL, + 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); + if (ret != MM_ERROR_NONE) { + LOGE("mm_camcorder_get_attributes fail(%x)", ret); + if (error) { + LOGE("failed attribute name %s", error); + free(error); + } + + mm_camcorder_destroy(handle->mm_handle); + free(handle); + + return __convert_camera_error_code(__func__, ret); + } - char *error; ret = mm_camcorder_set_attributes(handle->mm_handle, &error, - MMCAM_MODE , MM_CAMCORDER_MODE_VIDEO_CAPTURE, + MMCAM_MODE, MM_CAMCORDER_MODE_VIDEO_CAPTURE, MMCAM_CAMERA_FORMAT, preview_format, - MMCAM_IMAGE_ENCODER , MM_IMAGE_CODEC_JPEG, + 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, - (void*)NULL); + NULL); handle->display_type = CAMERA_DISPLAY_TYPE_NONE; - if( ret != MM_ERROR_NONE ){ - LOGE("mm_camcorder_set_attributes fail(%x, %s)", ret, error); + if (ret != MM_ERROR_NONE) { + LOGE("mm_camcorder_set_attributes fail(%x)", ret); + if (error) { + LOGE("failed attribute name %s", error); + free(error); + } + mm_camcorder_destroy(handle->mm_handle); - free(error); free(handle); + return __convert_camera_error_code(__func__, ret); } @@ -715,39 +839,45 @@ int camera_create(camera_device_e device, camera_h* camera){ handle->is_used_in_recorder = false; handle->on_continuous_focusing = false; handle->cached_focus_mode = -1; + g_mutex_init(&handle->idle_cb_lock); - mm_camcorder_set_message_callback(handle->mm_handle, __mm_camera_message_callback, (void*)handle); - LOGW("camera handle %p", handle); + mm_camcorder_set_message_callback(handle->mm_handle, + __mm_camera_message_callback, + (void*)handle); *camera = (camera_h)handle; + + LOGW("camera handle %p", handle); + return __convert_camera_error_code(__func__, ret); } - int camera_destroy(camera_h camera) + +int camera_destroy(camera_h camera) { - if( camera == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + if (camera == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s *handle = (camera_s*)camera; - if( handle->is_used_in_recorder ){ + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; + + if (handle->is_used_in_recorder) { LOGE("camera is using in another recorder."); return CAMERA_ERROR_INVALID_OPERATION; } LOGW("camera handle %p", handle); - ret = mm_camcorder_destroy(handle->mm_handle); - - if( handle->pkt_fmt ){ + if (handle->pkt_fmt) { media_format_unref(handle->pkt_fmt); handle->pkt_fmt = NULL; } - if( ret == MM_ERROR_NONE ){ + ret = mm_camcorder_destroy(handle->mm_handle); + if (ret == MM_ERROR_NONE) { _camera_remove_cb_message(handle); g_mutex_clear(&handle->idle_cb_lock); #ifdef HAVE_WAYLAND @@ -762,58 +892,65 @@ int camera_create(camera_device_e device, camera_h* camera){ return __convert_camera_error_code(__func__, ret); } -int camera_start_preview(camera_h camera){ - LOGW("start"); - if( camera == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_start_preview(camera_h camera) +{ + if (camera == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s *handle = (camera_s*)camera; - camera_state_e capi_state; - camera_get_state(camera, &capi_state); + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; + camera_state_e capi_state = CAMERA_STATE_NONE; + MMCamcorderStateType mm_state = MM_CAMCORDER_STATE_NONE; - if( capi_state == CAMERA_STATE_CAPTURED ){ + camera_get_state(camera, &capi_state); + if (capi_state == CAMERA_STATE_CAPTURED) { ret = mm_camcorder_capture_stop(handle->mm_handle); return __convert_camera_error_code(__func__, ret); } - /*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); + /* 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); - MMCamcorderStateType state; - mm_camcorder_get_state(handle->mm_handle, &state); - if( state != MM_CAMCORDER_STATE_READY ){ + mm_camcorder_get_state(handle->mm_handle, &mm_state); + if (mm_state != MM_CAMCORDER_STATE_READY) { ret = mm_camcorder_realize(handle->mm_handle); - if( ret != MM_ERROR_NONE ){ + if (ret != MM_ERROR_NONE) { + LOGE("mm_camcorder_realize failed 0x%x", ret); return __convert_camera_error_code(__func__, ret); } } ret = mm_camcorder_start(handle->mm_handle); - if( ret != MM_ERROR_NONE ){ - /*start fail */ + if (ret != MM_ERROR_NONE) { + LOGE("mm_camcorder_start failed 0x%x, call mm_camcorder_unrealize", ret); mm_camcorder_unrealize(handle->mm_handle); } return __convert_camera_error_code(__func__, ret); } -int camera_stop_preview(camera_h camera){ - if( camera == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); - return CAMERA_ERROR_INVALID_PARAMETER; - } - int ret; - camera_s *handle = (camera_s*)camera; - MMCamcorderStateType state ; - mm_camcorder_get_state(handle->mm_handle, &state); +int camera_stop_preview(camera_h camera) +{ + if (camera == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + int ret = MM_ERROR_NONE;; + camera_s *handle = (camera_s *)camera; + MMCamcorderStateType state = MM_CAMCORDER_STATE_NONE; - if( state == MM_CAMCORDER_STATE_PREPARE ){ + mm_camcorder_get_state(handle->mm_handle, &state); + if (state == MM_CAMCORDER_STATE_PREPARE) { ret = mm_camcorder_stop(handle->mm_handle); - if( ret != MM_ERROR_NONE ){ + if (ret != MM_ERROR_NONE) { + LOGE("mm_camcorder_stop failed 0x%x", ret); return __convert_camera_error_code(__func__, ret); } } @@ -825,31 +962,38 @@ int camera_stop_preview(camera_h camera){ return __convert_camera_error_code(__func__, ret); } -int camera_start_capture(camera_h camera, camera_capturing_cb capturing_cb , camera_capture_completed_cb completed_cb , void *user_data){ - if( camera == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_start_capture(camera_h camera, camera_capturing_cb capturing_cb, camera_capture_completed_cb completed_cb, void *user_data) +{ + if (camera == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - camera_s * handle = (camera_s*)camera; - int ret; - MMCamcorderStateType state; + camera_s *handle = (camera_s *)camera; + int ret = MM_ERROR_NONE; + MMCamcorderStateType state = MM_CAMCORDER_STATE_NONE; + mm_camcorder_get_state(handle->mm_handle, &state); - if( state != MM_CAMCORDER_STATE_PREPARE && + if (state != MM_CAMCORDER_STATE_PREPARE && state != MM_CAMCORDER_STATE_RECORDING && - state != MM_CAMCORDER_STATE_PAUSED ){ - LOGE("INVALID_STATE(0x%08x)",CAMERA_ERROR_INVALID_STATE); + state != MM_CAMCORDER_STATE_PAUSED) { + LOGE("INVALID_STATE(0x%08x)", CAMERA_ERROR_INVALID_STATE); return CAMERA_ERROR_INVALID_STATE; } - if( handle->capture_resolution_modified ){ + 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); + handle->capture_resolution_modified = false; } - mm_camcorder_set_attributes(handle->mm_handle, NULL, MMCAM_CAPTURE_COUNT , 1,NULL); + + mm_camcorder_set_attributes(handle->mm_handle, NULL, + MMCAM_CAPTURE_COUNT, 1, + NULL); handle->capture_count = 1; handle->is_continuous_shot_break = false; @@ -857,12 +1001,13 @@ int camera_start_capture(camera_h camera, camera_capturing_cb capturing_cb , cam handle->current_capture_complete_count = 0; handle->is_capture_completed = false; - handle->user_cb[_CAMERA_EVENT_TYPE_CAPTURE] = (void*)capturing_cb; - handle->user_data[_CAMERA_EVENT_TYPE_CAPTURE] = (void*)user_data; - handle->user_cb[_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = (void*)completed_cb; - handle->user_data[_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = (void*)user_data; + handle->user_cb[_CAMERA_EVENT_TYPE_CAPTURE] = (void *)capturing_cb; + handle->user_data[_CAMERA_EVENT_TYPE_CAPTURE] = (void *)user_data; + handle->user_cb[_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = (void *)completed_cb; + handle->user_data[_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = (void *)user_data; + ret = mm_camcorder_capture_start(handle->mm_handle); - if( ret != 0 ){ + if (ret != MM_ERROR_NONE) { handle->user_cb[_CAMERA_EVENT_TYPE_CAPTURE] = NULL; handle->user_data[_CAMERA_EVENT_TYPE_CAPTURE] = NULL; handle->user_cb[_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = NULL; @@ -872,60 +1017,69 @@ int camera_start_capture(camera_h camera, camera_capturing_cb capturing_cb , cam return __convert_camera_error_code(__func__, ret); } -bool camera_is_supported_continuous_capture(camera_h camera){ - if( camera == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +bool camera_is_supported_continuous_capture(camera_h camera) +{ + if (camera == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return false; } int ret = MM_ERROR_NONE; - camera_s * handle = (camera_s*)camera; + camera_s *handle = (camera_s *)camera; MMCamAttrsInfo info; - ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAPTURE_COUNT , &info); + + ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAPTURE_COUNT, &info); set_last_result(__convert_camera_error_code(__func__, ret)); - if( ret != MM_ERROR_NONE ){ + if (ret != MM_ERROR_NONE) { + LOGE("MMCAM_CAPTURE_COUNT info get failed 0x%x", ret); return false; } - if( info.int_range.max > 1){ + + if (info.int_range.max > 1) { return true; } else { return false; } } -int camera_start_continuous_capture(camera_h camera, int count, int interval, camera_capturing_cb capturing_cb, camera_capture_completed_cb completed_cb , void *user_data){ - if( camera == NULL ){ + +int camera_start_continuous_capture(camera_h camera, int count, int interval, camera_capturing_cb capturing_cb, camera_capture_completed_cb completed_cb, void *user_data) +{ + if (camera == NULL) { LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - if( camera_is_supported_continuous_capture(camera) == false ){ + if (camera_is_supported_continuous_capture(camera) == false) { LOGE("NOT_SUPPORTED(0x%08x)", CAMERA_ERROR_NOT_SUPPORTED); return CAMERA_ERROR_NOT_SUPPORTED; } - if( count < 2 || interval < 0 ){ + if (count < 2 || interval < 0) { LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - camera_s * handle = (camera_s*)camera; + camera_s *handle = (camera_s *)camera; + MMCamcorderStateType state = MM_CAMCORDER_STATE_NONE; + int supported_zsl = FALSE; + int ret = MM_ERROR_NONE; - MMCamcorderStateType state; mm_camcorder_get_state(handle->mm_handle, &state); - if( state != MM_CAMCORDER_STATE_PREPARE ){ - LOGE("INVALID_STATE(0x%08x)",CAMERA_ERROR_INVALID_STATE); + if (state != MM_CAMCORDER_STATE_PREPARE) { + LOGE("INVALID_STATE(0x%08x)", CAMERA_ERROR_INVALID_STATE); return CAMERA_ERROR_INVALID_STATE; } - int supported_zsl = FALSE; + supported_zsl = FALSE; - int ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, - MMCAM_CAPTURE_COUNT, count, - MMCAM_CAPTURE_INTERVAL, interval, - NULL); - if( ret != 0 ){ - LOGE("(%x) error set continuous shot attribute", ret); + ret = mm_camcorder_set_attributes(handle->mm_handle, 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); } @@ -935,12 +1089,14 @@ int camera_start_continuous_capture(camera_h camera, int count, int interval, ca handle->current_capture_complete_count = 0; handle->is_capture_completed = false; - ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, MMCAM_SUPPORT_ZSL_CAPTURE, &supported_zsl, NULL); - if( ret != 0 ){ + ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, + MMCAM_SUPPORT_ZSL_CAPTURE, &supported_zsl, + NULL); + if (ret != MM_ERROR_NONE) { LOGE("(%x) error get continuous shot attribute", ret); } - if( !supported_zsl ){ + if (!supported_zsl) { int preview_width; int preview_height; int capture_width; @@ -952,69 +1108,79 @@ int camera_start_continuous_capture(camera_h camera, int count, int interval, ca MMCAM_CAPTURE_WIDTH, &capture_width, MMCAM_CAPTURE_HEIGHT, &capture_height, NULL); - if( preview_width != capture_width || preview_height != capture_height ){ + + 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); + handle->capture_resolution_modified = true; } } - handle->user_cb[_CAMERA_EVENT_TYPE_CAPTURE] = (void*)capturing_cb; - handle->user_data[_CAMERA_EVENT_TYPE_CAPTURE] = (void*)user_data; - handle->user_cb[_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = (void*)completed_cb; - handle->user_data[_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = (void*)user_data; + handle->user_cb[_CAMERA_EVENT_TYPE_CAPTURE] = (void *)capturing_cb; + handle->user_data[_CAMERA_EVENT_TYPE_CAPTURE] = (void *)user_data; + handle->user_cb[_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = (void *)completed_cb; + handle->user_data[_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = (void *)user_data; ret = mm_camcorder_capture_start(handle->mm_handle); - if( ret != 0 ){ + 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; handle->user_cb[_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = NULL; handle->user_data[_CAMERA_EVENT_TYPE_CAPTURE_COMPLETE] = NULL; } - return __convert_camera_error_code(__func__,ret); + return __convert_camera_error_code(__func__, ret); } -int camera_stop_continuous_capture(camera_h camera){ - if( camera == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_stop_continuous_capture(camera_h camera) +{ + if (camera == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - if( camera_is_supported_continuous_capture(camera) == false ){ + if (camera_is_supported_continuous_capture(camera) == false) { LOGE("NOT_SUPPORTED(0x%08x)", CAMERA_ERROR_NOT_SUPPORTED); return CAMERA_ERROR_NOT_SUPPORTED; } - camera_s *handle = (camera_s*)camera; + camera_s *handle = (camera_s *)camera; + int ret = MM_ERROR_NONE; + camera_state_e state = CAMERA_STATE_NONE; - int ret; - camera_state_e state; camera_get_state(camera, &state); - - if( state != CAMERA_STATE_CAPTURING && handle->capture_count > 1 ){ - LOGE("INVALID_STATE(0x%08x)",CAMERA_ERROR_INVALID_STATE); + if (state != CAMERA_STATE_CAPTURING && handle->capture_count > 1) { + LOGE("INVALID_STATE(0x%08x)", CAMERA_ERROR_INVALID_STATE); return CAMERA_ERROR_INVALID_STATE; } - ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, "capture-break-cont-shot", 1, NULL); - if( ret == MM_ERROR_NONE ){ + ret = mm_camcorder_set_attributes(handle->mm_handle, 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); } - return __convert_camera_error_code(__func__,ret); + return __convert_camera_error_code(__func__, ret); } -bool camera_is_supported_face_detection(camera_h camera){ + +bool camera_is_supported_face_detection(camera_h camera) +{ if (camera == NULL) { - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return false; } @@ -1025,14 +1191,14 @@ bool camera_is_supported_face_detection(camera_h camera){ ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_DETECT_MODE , &info); set_last_result(__convert_camera_error_code(__func__, ret)); - if( ret != MM_ERROR_NONE ){ + if (ret != MM_ERROR_NONE) { LOGE("MMCAM_DETECT_MODE get attr info failed"); return false; } - if( info.validity_type == MM_CAM_ATTRS_VALID_TYPE_INT_ARRAY ){ - for( i = 0 ; i < info.int_array.count ; i++ ){ - if( info.int_array.array[i] == MM_CAMCORDER_DETECT_MODE_ON ){ + if (info.validity_type == MM_CAM_ATTRS_VALID_TYPE_INT_ARRAY) { + for (i = 0 ; i < info.int_array.count ; i++) { + if (info.int_array.array[i] == MM_CAMCORDER_DETECT_MODE_ON) { LOGD("face detection supported"); return true; } @@ -1044,19 +1210,23 @@ bool camera_is_supported_face_detection(camera_h camera){ return false; } -bool camera_is_supported_zero_shutter_lag(camera_h camera){ + +bool camera_is_supported_zero_shutter_lag(camera_h camera) +{ int ret = MM_ERROR_NONE; int supported_zsl = false; camera_s *handle = (camera_s *)camera; - if( camera == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + if (camera == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return false; } - ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, MMCAM_SUPPORT_ZSL_CAPTURE, &supported_zsl, NULL); + ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, + MMCAM_SUPPORT_ZSL_CAPTURE, &supported_zsl, + NULL); set_last_result(__convert_camera_error_code(__func__, ret)); - if( ret != MM_ERROR_NONE ){ + if (ret != MM_ERROR_NONE) { LOGE("MMCAM_SUPPORT_ZSL_CAPTURE get failed"); return false; } @@ -1066,12 +1236,14 @@ bool camera_is_supported_zero_shutter_lag(camera_h camera){ return supported_zsl; } -bool camera_is_supported_media_packet_preview_cb(camera_h camera){ + +bool camera_is_supported_media_packet_preview_cb(camera_h camera) +{ int ret = MM_ERROR_NONE; int supported = false; camera_s *handle = (camera_s *)camera; - if( camera == NULL ){ + if (camera == NULL) { LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return false; } @@ -1080,7 +1252,7 @@ bool camera_is_supported_media_packet_preview_cb(camera_h camera){ MMCAM_SUPPORT_MEDIA_PACKET_PREVIEW_CB, &supported, NULL); set_last_result(__convert_camera_error_code(__func__, ret)); - if( ret != MM_ERROR_NONE ){ + if (ret != MM_ERROR_NONE) { LOGE("MMCAM_SUPPORT_MEDIA_PACKET_PREVIEW_CB get failed"); return false; } @@ -1090,11 +1262,13 @@ bool camera_is_supported_media_packet_preview_cb(camera_h camera){ return supported; } -int camera_get_device_count(camera_h camera, int *device_count){ + +int camera_get_device_count(camera_h camera, int *device_count) +{ int ret = MM_ERROR_NONE; camera_s *handle = (camera_s *)camera; - if( camera == NULL || device_count == NULL ){ + if (camera == NULL || device_count == NULL) { LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } @@ -1106,129 +1280,171 @@ int camera_get_device_count(camera_h camera, int *device_count){ return __convert_camera_error_code(__func__, ret); } -int camera_start_face_detection(camera_h camera, camera_face_detected_cb callback, void * user_data){ - if( camera == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_start_face_detection(camera_h camera, camera_face_detected_cb callback, void *user_data) +{ + if (camera == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - if( camera_is_supported_face_detection(camera) == false ){ + if (camera_is_supported_face_detection(camera) == false) { LOGE("NOT_SUPPORTED(0x%08x)", CAMERA_ERROR_NOT_SUPPORTED); return CAMERA_ERROR_NOT_SUPPORTED; } - camera_s * handle = (camera_s*)camera; + camera_s *handle = (camera_s *)camera; camera_state_e state = CAMERA_STATE_NONE; - int ret; + int ret = MM_ERROR_NONE; + camera_get_state(camera, &state); - if( state != CAMERA_STATE_PREVIEW ){ - LOGE("INVALID_STATE(0x%08x)",CAMERA_ERROR_INVALID_STATE); + if (state != CAMERA_STATE_PREVIEW) { + LOGE("INVALID_STATE(0x%08x)", CAMERA_ERROR_INVALID_STATE); return CAMERA_ERROR_INVALID_STATE; } ret = mm_camcorder_set_attributes(handle->mm_handle, 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; + 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); } -int camera_stop_face_detection(camera_h camera){ - if( camera == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_stop_face_detection(camera_h camera) +{ + if (camera == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - camera_s * handle = (camera_s*)camera; - int ret; - if( camera_is_supported_face_detection(camera) == false ){ + camera_s *handle = (camera_s *)camera; + int ret = MM_ERROR_NONE; + + if (camera_is_supported_face_detection(camera) == false) { LOGE("NOT_SUPPORTED(0x%08x)", CAMERA_ERROR_NOT_SUPPORTED); return CAMERA_ERROR_NOT_SUPPORTED; } - ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, MMCAM_DETECT_MODE, MM_CAMCORDER_DETECT_MODE_OFF, NULL); - handle->user_cb[_CAMERA_EVENT_TYPE_FACE_DETECTION] = NULL; - handle->user_data[_CAMERA_EVENT_TYPE_FACE_DETECTION] = NULL; - handle->num_of_faces = 0; + ret = mm_camcorder_set_attributes(handle->mm_handle, 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); } -int camera_get_state(camera_h camera, camera_state_e * state){ - if( camera == NULL || state == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_get_state(camera_h camera, camera_state_e *state) +{ + if (camera == NULL || state == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - camera_s *handle = (camera_s*)camera; - camera_state_e capi_state; - MMCamcorderStateType mmstate ; - mm_camcorder_get_state(handle->mm_handle, &mmstate); + camera_s *handle = (camera_s *)camera; + camera_state_e capi_state = CAMERA_STATE_NONE; + MMCamcorderStateType mmstate = MM_CAMCORDER_STATE_NONE; + mm_camcorder_get_state(handle->mm_handle, &mmstate); 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 ){ + if ((handle->state == CAMERA_STATE_CAPTURED || handle->is_capture_completed) && + (handle->current_capture_count > 0 || handle->is_capture_completed) && + mmstate == MM_CAMCORDER_STATE_CAPTURING) { capi_state = CAMERA_STATE_CAPTURED; } *state = capi_state; + return CAMERA_ERROR_NONE; } -int camera_start_focusing( camera_h camera, bool continuous ){ - if( camera == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_start_focusing(camera_h camera, bool continuous) +{ + if (camera == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - camera_s *handle = (camera_s*)camera; - if( handle->cached_focus_mode != -1 ){ + camera_s *handle = (camera_s *)camera; + + if (handle->cached_focus_mode != -1) { 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); + + mm_camcorder_set_attributes(handle->mm_handle, NULL, + MMCAM_CAMERA_AF_SCAN_RANGE, handle->cached_focus_mode, + NULL); + handle->cached_focus_mode = -1; } - if( continuous ) + if (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); - return __convert_camera_error_code(__func__, mm_camcorder_start_focusing(((camera_s*)camera)->mm_handle)); + } 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); + + return __convert_camera_error_code(__func__, mm_camcorder_start_focusing(((camera_s *)camera)->mm_handle)); } } -int __camera_start_continuous_focusing(camera_h camera){ - if( camera == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int __camera_start_continuous_focusing(camera_h camera) +{ + if (camera == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - camera_s *handle = (camera_s*)camera; - int ret; - int mode; + camera_s *handle = (camera_s *)camera; + int ret = MM_ERROR_NONE; + int mode = MM_CAMCORDER_FOCUS_MODE_NONE; + handle->on_continuous_focusing = true; - ret = mm_camcorder_get_attributes(handle->mm_handle ,NULL, MMCAM_CAMERA_FOCUS_MODE , &mode, NULL); + mm_camcorder_get_attributes(handle->mm_handle, NULL, + MMCAM_CAMERA_FOCUS_MODE, &mode, + NULL); - if( mode == MM_CAMCORDER_FOCUS_MODE_CONTINUOUS ) + 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); + } else { + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, + MMCAM_CAMERA_FOCUS_MODE, MM_CAMCORDER_FOCUS_MODE_CONTINUOUS, + NULL); + } + return __convert_camera_error_code(__func__, ret); } -int camera_cancel_focusing(camera_h camera){ - if( camera == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_cancel_focusing(camera_h camera) +{ + if (camera == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - camera_s *handle = (camera_s*)camera; + + camera_s *handle = (camera_s *)camera; + handle->on_continuous_focusing = false; + return __convert_camera_error_code(__func__, mm_camcorder_stop_focusing(handle->mm_handle)); } + int camera_set_display(camera_h camera, camera_display_type_e type, camera_display_h display) { int ret = MM_ERROR_NONE; @@ -1239,12 +1455,12 @@ int camera_set_display(camera_h camera, camera_display_type_e type, camera_displ Evas_Object *obj = NULL; const char *object_type = NULL; - if( camera == NULL ){ + if (camera == NULL) { LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - if( type != CAMERA_DISPLAY_TYPE_NONE && display == NULL ){ + if (type != CAMERA_DISPLAY_TYPE_NONE && display == NULL) { LOGE("display type[%d] is not NONE, but display handle is NULL", type); return CAMERA_ERROR_INVALID_PARAMETER; } @@ -1252,7 +1468,7 @@ int camera_set_display(camera_h camera, camera_display_type_e type, camera_displ handle = (camera_s *)camera; handle->display_type = type; - if( type == CAMERA_DISPLAY_TYPE_NONE ){ + if (type == CAMERA_DISPLAY_TYPE_NONE) { /* NULL surface */ set_surface = MM_DISPLAY_SURFACE_NULL; handle->display_handle = 0; @@ -1261,8 +1477,8 @@ int camera_set_display(camera_h camera, camera_display_type_e type, camera_displ } else { obj = (Evas_Object *)display; object_type = evas_object_type_get(obj); - if( object_type ){ - if( type == CAMERA_DISPLAY_TYPE_OVERLAY && !strcmp(object_type, "elm_win") ){ + if (object_type) { + if (type == CAMERA_DISPLAY_TYPE_OVERLAY && !strcmp(object_type, "elm_win")) { #ifdef HAVE_WAYLAND MMCamWaylandInfo *wl_info = (MMCamWaylandInfo *)malloc(sizeof(MMCamWaylandInfo)); @@ -1308,7 +1524,7 @@ int camera_set_display(camera_h camera, camera_display_type_e type, camera_displ LOGD("display type OVERLAY : handle %p, %d", set_handle, (int)handle->display_handle); #endif /* HAVE_WAYLAND */ - } else if( type == CAMERA_DISPLAY_TYPE_EVAS && !strcmp(object_type, "image") ) { + } else if (type == CAMERA_DISPLAY_TYPE_EVAS && !strcmp(object_type, "image")) { /* evas object surface */ handle->display_handle = display; set_surface = MM_DISPLAY_SURFACE_EVAS; @@ -1330,35 +1546,69 @@ int camera_set_display(camera_h camera, camera_display_type_e type, camera_displ MMCAM_DISPLAY_SURFACE, set_surface, NULL); - if( ret == MM_ERROR_NONE && type != CAMERA_DISPLAY_TYPE_NONE ){ - ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, MMCAM_DISPLAY_HANDLE, set_handle, sizeof(void *), NULL); + if (ret == MM_ERROR_NONE && type != CAMERA_DISPLAY_TYPE_NONE) { + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, + MMCAM_DISPLAY_HANDLE, set_handle, sizeof(void *), + NULL); } return __convert_camera_error_code(__func__, ret); } -int camera_set_preview_resolution(camera_h camera, int width, int height){ - if( camera == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_set_preview_resolution(camera_h camera, int width, int height) +{ + if( camera == NULL){ + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; - ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, MMCAM_CAMERA_WIDTH , width ,MMCAM_CAMERA_HEIGHT ,height, NULL); + + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; + MMCamAttrsInfo info; + int mm_fps = 0; + int i = 0; + + mm_camcorder_get_attributes(handle->mm_handle, NULL, + MMCAM_CAMERA_FPS, &mm_fps, + NULL); + + mm_camcorder_get_fps_list_by_resolution(handle->mm_handle, width, height, &info); + + for (i = 0 ; i < info.int_array.count ; i++) { + 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; + } + } + + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, + MMCAM_CAMERA_WIDTH, width, + MMCAM_CAMERA_HEIGHT, height, + NULL); + return __convert_camera_error_code(__func__, ret); } -int camera_set_capture_resolution(camera_h camera, int width, int height){ - if( camera == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_set_capture_resolution(camera_h camera, int width, int height) +{ + if (camera == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; - ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, MMCAM_CAPTURE_WIDTH, width ,MMCAM_CAPTURE_HEIGHT , height, NULL); + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; - if( ret == MM_ERROR_NONE ){ + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, + MMCAM_CAPTURE_WIDTH, width, + MMCAM_CAPTURE_HEIGHT, height, + NULL); + if (ret == MM_ERROR_NONE) { handle->capture_width = width; handle->capture_height = height; } @@ -1366,55 +1616,68 @@ int camera_set_capture_resolution(camera_h camera, int width, int height){ return __convert_camera_error_code(__func__, ret); } -int camera_set_capture_format(camera_h camera, camera_pixel_format_e format){ - if( camera == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_set_capture_format(camera_h camera, camera_pixel_format_e format) +{ + if (camera == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; - ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, MMCAM_CAPTURE_FORMAT, format , NULL); + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; + + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, + MMCAM_CAPTURE_FORMAT, format, + NULL); return __convert_camera_error_code(__func__, ret); } -int camera_set_preview_format(camera_h camera, camera_pixel_format_e format){ - if( camera == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_set_preview_format(camera_h camera, camera_pixel_format_e format) +{ + if (camera == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; + int i = 0; + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; - if( format == CAMERA_PIXEL_FORMAT_UYVY ){ + if (format == CAMERA_PIXEL_FORMAT_UYVY) { bool supported_ITLV_UYVY = false; MMCamAttrsInfo supported_format; ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_FORMAT , &supported_format); - int i; - for( i=0 ; i < supported_format.int_array.count ; i++ ){ - if( supported_format.int_array.array[i] == MM_PIXEL_FORMAT_ITLV_JPEG_UYVY ) + for (i = 0 ; i < supported_format.int_array.count ; i++) { + 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); } else { - ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, MMCAM_CAMERA_FORMAT, format , NULL); + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, + MMCAM_CAMERA_FORMAT, format, + NULL); } return __convert_camera_error_code(__func__, ret); } -int camera_get_preview_resolution(camera_h camera, int *width, int *height){ - if( camera == NULL || width == NULL || height == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_get_preview_resolution(camera_h camera, int *width, int *height) +{ + if (camera == NULL || width == NULL || height == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; + ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, MMCAM_CAMERA_WIDTH, width, MMCAM_CAMERA_HEIGHT, height, @@ -1423,17 +1686,20 @@ int camera_get_preview_resolution(camera_h camera, int *width, int *height){ return __convert_camera_error_code(__func__, ret); } -int camera_set_display_rotation(camera_h camera, camera_rotation_e rotation){ - if( camera == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_set_display_rotation(camera_h camera, camera_rotation_e rotation) +{ + if (camera == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - if( rotation > CAMERA_ROTATION_270 ) + if (rotation > CAMERA_ROTATION_270) { return CAMERA_ERROR_INVALID_PARAMETER; + } - int ret; - camera_s * handle = (camera_s*)camera; + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, MMCAM_DISPLAY_ROTATION, rotation, @@ -1442,30 +1708,38 @@ int camera_set_display_rotation(camera_h camera, camera_rotation_e rotation){ return __convert_camera_error_code(__func__, ret); } -int camera_get_display_rotation( camera_h camera, camera_rotation_e *rotation){ - if( camera == NULL || rotation == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_get_display_rotation(camera_h camera, camera_rotation_e *rotation) +{ + if (camera == NULL || rotation == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; + + ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, + MMCAM_DISPLAY_ROTATION, rotation, + NULL); - ret = mm_camcorder_get_attributes(handle->mm_handle ,NULL, MMCAM_DISPLAY_ROTATION , rotation, NULL); return __convert_camera_error_code(__func__, ret); } -int camera_set_display_flip(camera_h camera, camera_flip_e flip){ - if( camera == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_set_display_flip(camera_h camera, camera_flip_e flip) +{ + if (camera == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - if( flip > CAMERA_FLIP_BOTH ) + if (flip > CAMERA_FLIP_BOTH) { return CAMERA_ERROR_INVALID_PARAMETER; + } - int ret; - camera_s * handle = (camera_s*)camera; + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, MMCAM_DISPLAY_FLIP, flip, @@ -1474,14 +1748,16 @@ int camera_set_display_flip(camera_h camera, camera_flip_e flip){ return __convert_camera_error_code(__func__, ret); } -int camera_get_display_flip(camera_h camera, camera_flip_e *flip){ - if( camera == NULL || flip == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_get_display_flip(camera_h camera, camera_flip_e *flip) +{ + if (camera == NULL || flip == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, MMCAM_DISPLAY_FLIP, flip, @@ -1490,14 +1766,16 @@ int camera_get_display_flip(camera_h camera, camera_flip_e *flip){ return __convert_camera_error_code(__func__, ret); } -int camera_set_display_visible(camera_h camera, bool visible){ - if( camera == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_set_display_visible(camera_h camera, bool visible) +{ + if (camera == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, MMCAM_DISPLAY_VISIBLE, visible, @@ -1506,37 +1784,43 @@ int camera_set_display_visible(camera_h camera, bool visible){ return __convert_camera_error_code(__func__, ret); } -int camera_is_display_visible(camera_h camera, bool* visible){ - if( camera == NULL || visible == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); - return CAMERA_ERROR_INVALID_PARAMETER; - } - int ret; - int result; - camera_s * handle = (camera_s*)camera; +int camera_is_display_visible(camera_h camera, bool* visible) +{ + if (camera == NULL || visible == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + int ret = MM_ERROR_NONE; + int result = false; + camera_s *handle = (camera_s *)camera; ret = mm_camcorder_get_attributes(handle->mm_handle, 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); } -int camera_set_display_mode(camera_h camera, camera_display_mode_e mode){ - if( camera == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_set_display_mode(camera_h camera, camera_display_mode_e mode) +{ + if (camera == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - if( mode > CAMERA_DISPLAY_MODE_CROPPED_FULL ) + if (mode > CAMERA_DISPLAY_MODE_CROPPED_FULL) { return CAMERA_ERROR_INVALID_PARAMETER; + } - int ret; - camera_s * handle = (camera_s*)camera; + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, MMCAM_DISPLAY_GEOMETRY_METHOD, mode, @@ -1545,14 +1829,16 @@ int camera_set_display_mode(camera_h camera, camera_display_mode_e mode){ return __convert_camera_error_code(__func__, ret); } -int camera_get_display_mode(camera_h camera, camera_display_mode_e* mode){ - if( camera == NULL || mode == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_get_display_mode(camera_h camera, camera_display_mode_e *mode) +{ + if (camera == NULL || mode == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, MMCAM_DISPLAY_GEOMETRY_METHOD, mode, @@ -1561,27 +1847,32 @@ int camera_get_display_mode(camera_h camera, camera_display_mode_e* mode){ return __convert_camera_error_code(__func__, ret); } -int camera_get_capture_resolution(camera_h camera, int *width, int *height){ - if( camera == NULL || width== NULL || height == NULL){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_get_capture_resolution(camera_h camera, int *width, int *height) +{ + if (camera == NULL || width == NULL || height == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - camera_s * handle = (camera_s*)camera; + camera_s *handle = (camera_s *)camera; + *width = handle->capture_width; *height = handle->capture_height; return CAMERA_ERROR_NONE; } -int camera_get_capture_format(camera_h camera, camera_pixel_format_e *format){ - if( camera == NULL || format == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_get_capture_format(camera_h camera, camera_pixel_format_e *format) +{ + if (camera == NULL || format == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, MMCAM_CAPTURE_FORMAT, format, @@ -1590,34 +1881,39 @@ int camera_get_capture_format(camera_h camera, camera_pixel_format_e *format){ return __convert_camera_error_code(__func__, ret); } -int camera_get_preview_format(camera_h camera, camera_pixel_format_e *format){ - if( camera == NULL || format == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_get_preview_format(camera_h camera, camera_pixel_format_e *format) +{ + if (camera == NULL || format == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; ret = mm_camcorder_get_attributes(handle->mm_handle, 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); } -int camera_set_preview_cb(camera_h camera, camera_preview_cb callback, void* user_data){ - if( camera == NULL || callback == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_set_preview_cb(camera_h camera, camera_preview_cb callback, void *user_data) +{ + if (camera == NULL || callback == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } camera_s *handle = (camera_s *)camera; - handle->user_cb[_CAMERA_EVENT_TYPE_PREVIEW] = (void*)callback; - handle->user_data[_CAMERA_EVENT_TYPE_PREVIEW] = (void*)user_data; + handle->user_cb[_CAMERA_EVENT_TYPE_PREVIEW] = (void *)callback; + 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, @@ -1626,15 +1922,17 @@ int camera_set_preview_cb(camera_h camera, camera_preview_cb callback, void* use return CAMERA_ERROR_NONE; } -int camera_unset_preview_cb( camera_h camera){ - if( camera == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_unset_preview_cb(camera_h camera) +{ + if (camera == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } camera_s *handle = (camera_s *)camera; - if( handle->user_cb[_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] == NULL ){ + 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); @@ -1646,18 +1944,20 @@ int camera_unset_preview_cb( camera_h camera){ return CAMERA_ERROR_NONE; } -int camera_set_media_packet_preview_cb(camera_h camera, camera_media_packet_preview_cb callback, void* user_data){ - if( camera == NULL ){ + +int camera_set_media_packet_preview_cb(camera_h camera, camera_media_packet_preview_cb callback, void *user_data) +{ + if (camera == NULL) { LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - if( camera_is_supported_media_packet_preview_cb(camera) == false ){ + if (camera_is_supported_media_packet_preview_cb(camera) == false) { LOGE("NOT SUPPORTED"); return CAMERA_ERROR_NOT_SUPPORTED; } - if( callback == NULL ){ + if (callback == NULL) { LOGE("INVALID_PARAMETER(0x%08x) - callback", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } @@ -1673,267 +1973,315 @@ int camera_set_media_packet_preview_cb(camera_h camera, camera_media_packet_prev return CAMERA_ERROR_NONE; } -int camera_unset_media_packet_preview_cb(camera_h camera){ - if( camera == NULL ){ + +int camera_unset_media_packet_preview_cb(camera_h camera) +{ + if (camera == NULL) { LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - if( camera_is_supported_media_packet_preview_cb(camera) == false ){ + if (camera_is_supported_media_packet_preview_cb(camera) == false) { LOGE("NOT SUPPORTED"); return CAMERA_ERROR_NOT_SUPPORTED; } camera_s *handle = (camera_s *)camera; - if( handle->user_cb[_CAMERA_EVENT_TYPE_PREVIEW] == NULL ){ + 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); + (void *)NULL); } - handle->user_cb[_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = (void*)NULL; - handle->user_data[_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = (void*)NULL; + handle->user_cb[_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = (void *)NULL; + handle->user_data[_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = (void *)NULL; return CAMERA_ERROR_NONE; } -int camera_set_state_changed_cb(camera_h camera, camera_state_changed_cb callback, void* user_data){ - if( camera == NULL || callback == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_set_state_changed_cb(camera_h camera, camera_state_changed_cb callback, void *user_data) +{ + if (camera == NULL || callback == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - camera_s * handle = (camera_s*)camera; - handle->user_cb[_CAMERA_EVENT_TYPE_STATE_CHANGE] = (void*)callback; - handle->user_data[_CAMERA_EVENT_TYPE_STATE_CHANGE] = (void*)user_data; + camera_s *handle = (camera_s *)camera; + handle->user_cb[_CAMERA_EVENT_TYPE_STATE_CHANGE] = (void *)callback; + handle->user_data[_CAMERA_EVENT_TYPE_STATE_CHANGE] = (void *)user_data; return CAMERA_ERROR_NONE; } -int camera_unset_state_changed_cb(camera_h camera){ - if( camera == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + + +int camera_unset_state_changed_cb(camera_h camera) +{ + if (camera == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - camera_s * handle = (camera_s*)camera; - handle->user_cb[_CAMERA_EVENT_TYPE_STATE_CHANGE] = (void*)NULL; - handle->user_data[_CAMERA_EVENT_TYPE_STATE_CHANGE] = (void*)NULL; + camera_s *handle = (camera_s *)camera; + handle->user_cb[_CAMERA_EVENT_TYPE_STATE_CHANGE] = (void *)NULL; + handle->user_data[_CAMERA_EVENT_TYPE_STATE_CHANGE] = (void *)NULL; return CAMERA_ERROR_NONE; } -int camera_set_interrupted_cb(camera_h camera, camera_interrupted_cb callback, void *user_data){ - if( camera == NULL || callback == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_set_interrupted_cb(camera_h camera, camera_interrupted_cb callback, void *user_data) +{ + if (camera == NULL || callback == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - camera_s * handle = (camera_s*)camera; - handle->user_cb[_CAMERA_EVENT_TYPE_INTERRUPTED] = (void*)callback; - handle->user_data[_CAMERA_EVENT_TYPE_INTERRUPTED] = (void*)user_data; + camera_s *handle = (camera_s *)camera; + handle->user_cb[_CAMERA_EVENT_TYPE_INTERRUPTED] = (void *)callback; + handle->user_data[_CAMERA_EVENT_TYPE_INTERRUPTED] = (void *)user_data; return CAMERA_ERROR_NONE; } -int camera_unset_interrupted_cb(camera_h camera){ - if( camera == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_unset_interrupted_cb(camera_h camera) +{ + if (camera == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - camera_s * handle = (camera_s*)camera; - handle->user_cb[_CAMERA_EVENT_TYPE_INTERRUPTED] = (void*)NULL; - handle->user_data[_CAMERA_EVENT_TYPE_INTERRUPTED] = (void*)NULL; + camera_s *handle = (camera_s *)camera; + + handle->user_cb[_CAMERA_EVENT_TYPE_INTERRUPTED] = (void *)NULL; + handle->user_data[_CAMERA_EVENT_TYPE_INTERRUPTED] = (void *)NULL; return CAMERA_ERROR_NONE; } -int camera_set_focus_changed_cb(camera_h camera, camera_focus_changed_cb callback, void* user_data){ - if( camera == NULL || callback == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_set_focus_changed_cb(camera_h camera, camera_focus_changed_cb callback, void *user_data) +{ + if (camera == NULL || callback == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - camera_s * handle = (camera_s*)camera; - handle->user_cb[_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = (void*)callback; - handle->user_data[_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = (void*)user_data; + camera_s *handle = (camera_s *)camera; + + handle->user_cb[_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = (void *)callback; + handle->user_data[_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = (void *)user_data; return CAMERA_ERROR_NONE; } -int camera_unset_focus_changed_cb(camera_h camera){ - if( camera == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + + +int camera_unset_focus_changed_cb(camera_h camera) +{ + if (camera == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - camera_s * handle = (camera_s*)camera; - handle->user_cb[_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = (void*)NULL; - handle->user_data[_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = (void*)NULL; + camera_s *handle = (camera_s *)camera; + + handle->user_cb[_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = (void *)NULL; + handle->user_data[_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = (void *)NULL; return CAMERA_ERROR_NONE; } -int camera_set_error_cb(camera_h camera, camera_error_cb callback, void *user_data){ - if( camera == NULL || callback == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_set_error_cb(camera_h camera, camera_error_cb callback, void *user_data) +{ + if (camera == NULL || callback == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - camera_s * handle = (camera_s*)camera; - handle->user_cb[_CAMERA_EVENT_TYPE_ERROR] = (void*)callback; - handle->user_data[_CAMERA_EVENT_TYPE_ERROR] = (void*)user_data; + camera_s *handle = (camera_s *)camera; + + handle->user_cb[_CAMERA_EVENT_TYPE_ERROR] = (void *)callback; + handle->user_data[_CAMERA_EVENT_TYPE_ERROR] = (void *)user_data; return CAMERA_ERROR_NONE; } -int camera_unset_error_cb(camera_h camera){ - if( camera == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_unset_error_cb(camera_h camera) +{ + if (camera == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - camera_s * handle = (camera_s*)camera; - handle->user_cb[_CAMERA_EVENT_TYPE_ERROR] = (void*)NULL; - handle->user_data[_CAMERA_EVENT_TYPE_ERROR] = (void*)NULL; + camera_s *handle = (camera_s *)camera; + + handle->user_cb[_CAMERA_EVENT_TYPE_ERROR] = (void *)NULL; + handle->user_data[_CAMERA_EVENT_TYPE_ERROR] = (void *)NULL; return CAMERA_ERROR_NONE; } -int camera_foreach_supported_preview_resolution(camera_h camera, camera_supported_preview_resolution_cb foreach_cb , void *user_data){ - if( camera == NULL || foreach_cb == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_foreach_supported_preview_resolution(camera_h camera, camera_supported_preview_resolution_cb foreach_cb, void *user_data) +{ + if (camera == NULL || foreach_cb == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; + int i = 0; + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; MMCamAttrsInfo preview_width; MMCamAttrsInfo preview_height; - 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 ) + 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) { return __convert_camera_error_code(__func__, ret); + } - int i; - 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) ) + 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)) { break; + } } return CAMERA_ERROR_NONE; } -int camera_foreach_supported_capture_resolution(camera_h camera, camera_supported_capture_resolution_cb foreach_cb , void *user_data){ - if( camera == NULL || foreach_cb == NULL){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_foreach_supported_capture_resolution(camera_h camera, camera_supported_capture_resolution_cb foreach_cb, void *user_data) +{ + if (camera == NULL || foreach_cb == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; + + int i = 0; + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; MMCamAttrsInfo capture_width; MMCamAttrsInfo capture_height; - 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 ) + 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) { return __convert_camera_error_code(__func__, ret); + } - int i; - 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) ) + 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)) { break; + } } + return CAMERA_ERROR_NONE; } -int camera_foreach_supported_capture_format(camera_h camera, camera_supported_capture_format_cb foreach_cb , void *user_data){ - if( camera == NULL || foreach_cb == NULL){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_foreach_supported_capture_format(camera_h camera, camera_supported_capture_format_cb foreach_cb, void *user_data) +{ + if (camera == NULL || foreach_cb == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; + int i = 0; + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; MMCamAttrsInfo format; - ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAPTURE_FORMAT , &format); - if( ret != CAMERA_ERROR_NONE ) + ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAPTURE_FORMAT, &format); + if (ret != CAMERA_ERROR_NONE) { return __convert_camera_error_code(__func__, ret); + } - int i; - 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) ) + 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)) { break; + } + } } return CAMERA_ERROR_NONE; } -int camera_foreach_supported_preview_format(camera_h camera, camera_supported_preview_format_cb foreach_cb , void *user_data){ - if( camera == NULL || foreach_cb == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_foreach_supported_preview_format(camera_h camera, camera_supported_preview_format_cb foreach_cb, void *user_data) +{ + if (camera == NULL || foreach_cb == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; + int i = 0; + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; MMCamAttrsInfo format; - ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_FORMAT , &format); - if( ret != CAMERA_ERROR_NONE ) + ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_FORMAT, &format); + if (ret != CAMERA_ERROR_NONE) { return __convert_camera_error_code(__func__, ret); + } - int i; - for( i=0 ; i < format.int_array.count ; i++ ){ - if( format.int_array.array[i] != MM_PIXEL_FORMAT_ITLV_JPEG_UYVY /* || format.int_array.array[i] != MM_PIXEL_FORMAT_ITLV_JPEG_NV12 */) - if ( !foreach_cb(format.int_array.array[i], user_data) ) + 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)) { break; + } + } } return CAMERA_ERROR_NONE; } -int camera_get_recommended_preview_resolution(camera_h camera, int *width, int *height){ - if( camera == NULL || width == NULL || height == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_get_recommended_preview_resolution(camera_h camera, int *width, int *height) +{ + if (camera == NULL || width == NULL || height == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - enum MMCamcorderPreviewType wide; - int capture_w, capture_h; - double ratio; - int ret; - camera_s * handle = (camera_s*)camera; + enum MMCamcorderPreviewType wide = MM_CAMCORDER_PREVIEW_TYPE_NORMAL; + int capture_w = 0; + int capture_h = 0; + double ratio = 0.0; + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; + MMCamAttrsInfo width_info; + MMCamAttrsInfo height_info; camera_get_capture_resolution(camera, &capture_w, &capture_h); - ratio = (double)capture_w/(double)capture_h; - if( ratio > 1.5 ){ + ratio = (double)capture_w / (double)capture_h; + if (ratio > 1.5) { wide = MM_CAMCORDER_PREVIEW_TYPE_WIDE; - } else if( ratio == 1.0 ){ + } else if (ratio == 1.0) { wide = MM_CAMCORDER_PREVIEW_TYPE_SQUARE; } else { wide = MM_CAMCORDER_PREVIEW_TYPE_NORMAL; } - MMCamAttrsInfo width_info, height_info; - 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_WIDTH, &width_info); ret |= mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_RECOMMEND_CAMERA_HEIGHT, &height_info); - - if( ret != 0 ) + if (ret != MM_ERROR_NONE) { return __convert_camera_error_code(__func__, ret); + } - if( width && (unsigned int)width_info.int_array.count > wide ){ + if (width && (unsigned int)width_info.int_array.count > wide) { *width = width_info.int_array.array[wide]; } else { LOGE("there is no width value for resolution %dx%d type %d", capture_w, capture_h, wide); return CAMERA_ERROR_INVALID_OPERATION; } - if( height && (unsigned int)height_info.int_array.count > wide ){ + if (height && (unsigned int)height_info.int_array.count > wide) { *height = height_info.int_array.array[wide]; } else { LOGE("there is no height value for resolution %dx%d type %d", capture_w, capture_h, wide); @@ -1945,18 +2293,24 @@ int camera_get_recommended_preview_resolution(camera_h camera, int *width, int * return CAMERA_ERROR_NONE; } -int camera_attr_get_lens_orientation(camera_h camera, int *angle){ - if( camera == NULL || angle == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_get_lens_orientation(camera_h camera, int *angle) +{ + if (camera == NULL || angle == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; - int rotation; - ret = mm_camcorder_get_attributes(handle->mm_handle ,NULL, MMCAM_RECOMMEND_DISPLAY_ROTATION, &rotation , NULL); + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; + int rotation = MM_DISPLAY_ROTATION_NONE; - switch( rotation ){ + ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, + MMCAM_RECOMMEND_DISPLAY_ROTATION, &rotation, + NULL); + + if (ret == MM_ERROR_NONE) { + switch (rotation) { case MM_DISPLAY_ROTATION_NONE: *angle = 0; break; @@ -1972,215 +2326,266 @@ int camera_attr_get_lens_orientation(camera_h camera, int *angle){ default : *angle = 0; break; + } } return __convert_camera_error_code(__func__, ret); } -int camera_attr_set_theater_mode(camera_h camera, camera_attr_theater_mode_e mode){ - if( camera == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_set_theater_mode(camera_h camera, camera_attr_theater_mode_e mode) +{ + if (camera == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; - ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, MMCAM_DISPLAY_MODE, mode, NULL); + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; + + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, + MMCAM_DISPLAY_MODE, mode, + NULL); return __convert_camera_error_code(__func__, ret); } -int camera_attr_get_theater_mode(camera_h camera, camera_attr_theater_mode_e *mode){ - if( camera == NULL || mode == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_get_theater_mode(camera_h camera, camera_attr_theater_mode_e *mode) +{ + if (camera == NULL || mode == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; - ret = mm_camcorder_get_attributes(handle->mm_handle ,NULL, MMCAM_DISPLAY_MODE , mode, NULL); + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; + + ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, + MMCAM_DISPLAY_MODE, mode, + NULL); return __convert_camera_error_code(__func__, ret); } -int camera_attr_foreach_supported_theater_mode(camera_h camera, camera_attr_supported_theater_mode_cb foreach_cb, void *user_data){ - if( camera == NULL || foreach_cb == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_foreach_supported_theater_mode(camera_h camera, camera_attr_supported_theater_mode_cb foreach_cb, void *user_data) +{ + if (camera == NULL || foreach_cb == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; + 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_DISPLAY_MODE , &info); - if( ret != CAMERA_ERROR_NONE ) + ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_DISPLAY_MODE, &info); + if (ret != CAMERA_ERROR_NONE) { return __convert_camera_error_code(__func__, ret); + } - int i; - for (i=0 ; i < info.int_array.count ; i++ ){ - if ( !foreach_cb(info.int_array.array[i],user_data) ) + for (i = 0 ; i < info.int_array.count ; i++) { + if (!foreach_cb(info.int_array.array[i], user_data)) { break; + } } return CAMERA_ERROR_NONE; } -int camera_attr_set_preview_fps(camera_h camera, camera_attr_fps_e fps){ - if( camera == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_set_preview_fps(camera_h camera, camera_attr_fps_e fps) +{ + if (camera == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; - if( fps == CAMERA_ATTR_FPS_AUTO ){ + if (fps == CAMERA_ATTR_FPS_AUTO) { ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, - MMCAM_CAMERA_FPS_AUTO, 1, - NULL); + MMCAM_CAMERA_FPS_AUTO, true, + NULL); } else { ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, - MMCAM_CAMERA_FPS_AUTO, 0, - MMCAM_CAMERA_FPS, fps, - NULL); + MMCAM_CAMERA_FPS_AUTO, false, + MMCAM_CAMERA_FPS, fps, + NULL); } return __convert_camera_error_code(__func__, ret); } -int camera_attr_set_image_quality(camera_h camera, int quality){ - if( camera == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_set_image_quality(camera_h camera, int quality) +{ + if (camera == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; - ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, MMCAM_IMAGE_ENCODER_QUALITY , quality, NULL); + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; + + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, + MMCAM_IMAGE_ENCODER_QUALITY, quality, + NULL); return __convert_camera_error_code(__func__, ret); } -int camera_attr_get_preview_fps(camera_h camera, camera_attr_fps_e *fps){ - if( camera == NULL || fps == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_get_preview_fps(camera_h camera, camera_attr_fps_e *fps) +{ + if (camera == NULL || fps == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - int mm_fps; - int is_auto; - 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); + int ret = MM_ERROR_NONE; + int mm_fps = 0; + int is_auto = false; + camera_s *handle = (camera_s *)camera; - if( is_auto ) - *fps = CAMERA_ATTR_FPS_AUTO; - else - *fps = mm_fps; + ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, + MMCAM_CAMERA_FPS, &mm_fps, + MMCAM_CAMERA_FPS_AUTO, &is_auto, + NULL); + if (ret == MM_ERROR_NONE) { + if (is_auto) { + *fps = CAMERA_ATTR_FPS_AUTO; + } else { + *fps = mm_fps; + } + } return __convert_camera_error_code(__func__, ret); } -int camera_attr_get_image_quality(camera_h camera, int *quality){ - if( camera == NULL || quality == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_get_image_quality(camera_h camera, int *quality) +{ + if (camera == NULL || quality == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; - ret = mm_camcorder_get_attributes(handle->mm_handle ,NULL, MMCAM_IMAGE_ENCODER_QUALITY , quality, NULL); + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; + + ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, + MMCAM_IMAGE_ENCODER_QUALITY, quality, + NULL); return __convert_camera_error_code(__func__, ret); } -int camera_attr_set_zoom(camera_h camera, int zoom){ - if( camera == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_set_zoom(camera_h camera, int zoom) +{ + if (camera == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; - ret = mm_camcorder_set_attributes(handle->mm_handle ,NULL, MMCAM_CAMERA_DIGITAL_ZOOM , zoom, NULL); + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; + + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, + MMCAM_CAMERA_DIGITAL_ZOOM, zoom, + NULL); return __convert_camera_error_code(__func__, ret); } -int camera_attr_set_af_mode(camera_h camera, camera_attr_af_mode_e mode){ - if( camera == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_set_af_mode(camera_h camera, camera_attr_af_mode_e mode) +{ + if (camera == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret = CAMERA_ERROR_INVALID_PARAMETER; - camera_s * handle = (camera_s*)camera; - + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; int focus_mode; bool should_change_focus_mode = false; + mm_camcorder_get_attributes(handle->mm_handle, NULL, MMCAM_CAMERA_FOCUS_MODE, &focus_mode, NULL); - if( focus_mode != MM_CAMCORDER_FOCUS_MODE_TOUCH_AUTO && focus_mode != MM_CAMCORDER_FOCUS_MODE_CONTINUOUS && focus_mode != MM_CAMCORDER_FOCUS_MODE_AUTO ) + if (focus_mode != MM_CAMCORDER_FOCUS_MODE_TOUCH_AUTO && + focus_mode != MM_CAMCORDER_FOCUS_MODE_CONTINUOUS && + focus_mode != MM_CAMCORDER_FOCUS_MODE_AUTO) { should_change_focus_mode = true; + } - if( mode != CAMERA_ATTR_AF_NONE && focus_mode == MM_CAMCORDER_FOCUS_MODE_CONTINUOUS && !handle->on_continuous_focusing ){ + if (mode != CAMERA_ATTR_AF_NONE && + focus_mode == MM_CAMCORDER_FOCUS_MODE_CONTINUOUS && + !handle->on_continuous_focusing) { handle->cached_focus_mode = mode; LOGD("af mode will be set actually start focusing"); - return __convert_camera_error_code(__func__, 0); + return __convert_camera_error_code(__func__, MM_ERROR_NONE); } else { handle->cached_focus_mode = -1; } - 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); + 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); } - 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); - 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); - 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); - 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); - break; - default: - return ret; + 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); + 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); + 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); + 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); + break; + default: + LOGE("invalid mode %d", mode); + return CAMERA_ERROR_INVALID_PARAMETER; } return __convert_camera_error_code(__func__, ret); } -int camera_attr_set_af_area(camera_h camera, int x, int y){ - if( camera == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_set_af_area(camera_h camera, int x, int y) +{ + if (camera == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret = CAMERA_ERROR_INVALID_PARAMETER; - camera_s * handle = (camera_s*)camera; + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; camera_attr_af_mode_e mode; - camera_attr_get_af_mode(camera, &mode); - if( mode == CAMERA_ATTR_AF_NONE ){ - LOGE("INVALID_OPERATION(0x%08x) AF mode is CAMERA_ATTR_AF_NONE",CAMERA_ERROR_INVALID_OPERATION); + camera_attr_get_af_mode(camera, &mode); + if (mode == CAMERA_ATTR_AF_NONE) { + LOGE("INVALID_OPERATION(0x%08x) AF mode is CAMERA_ATTR_AF_NONE", CAMERA_ERROR_INVALID_OPERATION); return CAMERA_ERROR_INVALID_OPERATION; } @@ -2188,55 +2593,69 @@ int camera_attr_set_af_area(camera_h camera, int x, int y){ MMCAM_CAMERA_AF_TOUCH_X, x, MMCAM_CAMERA_AF_TOUCH_Y, y, NULL); - - if( ret == MM_ERROR_NONE ) + if (ret == MM_ERROR_NONE) { handle->focus_area_valid = true; + } return __convert_camera_error_code(__func__, ret); } -int camera_attr_clear_af_area(camera_h camera){ - if( camera == NULL ){ + +int camera_attr_clear_af_area(camera_h camera) +{ + if (camera == NULL) { LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - camera_s * handle = (camera_s*)camera; + camera_s *handle = (camera_s *)camera; + handle->focus_area_valid = false; - return CAMERA_ERROR_NONE; + return 0; } -int camera_attr_set_exposure_mode(camera_h camera, camera_attr_exposure_mode_e mode){ - if( camera == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_set_exposure_mode(camera_h camera, camera_attr_exposure_mode_e mode) +{ + if (camera == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int maptable[] = {MM_CAMCORDER_AUTO_EXPOSURE_OFF, //CAMCORDER_EXPOSURE_MODE_OFF - MM_CAMCORDER_AUTO_EXPOSURE_ALL, //CAMCORDER_EXPOSURE_MODE_ALL - MM_CAMCORDER_AUTO_EXPOSURE_CENTER_1, //CAMCORDER_EXPOSURE_MODE_CENTER - MM_CAMCORDER_AUTO_EXPOSURE_SPOT_1, //CAMCORDER_EXPOSURE_MODE_SPOT - MM_CAMCORDER_AUTO_EXPOSURE_CUSTOM_1,//CAMCORDER_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; + + if (mode < CAMERA_ATTR_EXPOSURE_MODE_OFF || mode > CAMERA_ATTR_EXPOSURE_MODE_CUSTOM) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); + return CAMERA_ERROR_INVALID_PARAMETER; + } - int ret; - camera_s * handle = (camera_s*)camera; ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, - MMCAM_CAMERA_EXPOSURE_MODE, maptable[abs(mode%5)], + MMCAM_CAMERA_EXPOSURE_MODE, maptable[mode], NULL); return __convert_camera_error_code(__func__, ret); } -int camera_attr_set_exposure(camera_h camera, int value){ - if( camera == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_set_exposure(camera_h camera, int value) +{ + if (camera == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, MMCAM_CAMERA_EXPOSURE_VALUE, value, NULL); @@ -2244,14 +2663,17 @@ int camera_attr_set_exposure(camera_h camera, int value){ return __convert_camera_error_code(__func__, ret); } -int camera_attr_set_iso(camera_h camera, camera_attr_iso_e iso){ - if( camera == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_set_iso(camera_h camera, camera_attr_iso_e iso) +{ + if (camera == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s*)camera; + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, MMCAM_CAMERA_ISO, iso, NULL); @@ -2259,14 +2681,17 @@ int camera_attr_set_iso(camera_h camera, camera_attr_iso_e iso){ return __convert_camera_error_code(__func__, ret); } -int camera_attr_set_brightness(camera_h camera, int level){ - if( camera == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_set_brightness(camera_h camera, int level) +{ + if (camera == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, MMCAM_FILTER_BRIGHTNESS, level, NULL); @@ -2274,14 +2699,17 @@ int camera_attr_set_brightness(camera_h camera, int level){ return __convert_camera_error_code(__func__, ret); } -int camera_attr_set_contrast(camera_h camera, int level){ - if( camera == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_set_contrast(camera_h camera, int level) +{ + if (camera == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, MMCAM_FILTER_CONTRAST, level, NULL); @@ -2289,14 +2717,17 @@ int camera_attr_set_contrast(camera_h camera, int level){ return __convert_camera_error_code(__func__, ret); } -int camera_attr_set_whitebalance(camera_h camera, camera_attr_whitebalance_e wb){ - if( camera == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_set_whitebalance(camera_h camera, camera_attr_whitebalance_e wb) +{ + if (camera == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, MMCAM_FILTER_WB, wb, NULL); @@ -2304,14 +2735,17 @@ int camera_attr_set_whitebalance(camera_h camera, camera_attr_whitebalance_e wb) return __convert_camera_error_code(__func__, ret); } -int camera_attr_set_effect(camera_h camera, camera_attr_effect_mode_e effect){ - if( camera == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_set_effect(camera_h camera, camera_attr_effect_mode_e effect) +{ + if (camera == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, MMCAM_FILTER_COLOR_TONE, effect, NULL); @@ -2319,14 +2753,17 @@ int camera_attr_set_effect(camera_h camera, camera_attr_effect_mode_e effect){ return __convert_camera_error_code(__func__, ret); } -int camera_attr_set_scene_mode(camera_h camera, camera_attr_scene_mode_e mode){ - if( camera == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_set_scene_mode(camera_h camera, camera_attr_scene_mode_e mode) +{ + if (camera == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, MMCAM_FILTER_SCENE_MODE, mode, NULL); @@ -2334,14 +2771,17 @@ int camera_attr_set_scene_mode(camera_h camera, camera_attr_scene_mode_e mode){ return __convert_camera_error_code(__func__, ret); } -int camera_attr_enable_tag(camera_h camera, bool enable){ - if( camera == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_enable_tag(camera_h camera, bool enable) +{ + if (camera == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, MMCAM_TAG_ENABLE, enable, NULL); @@ -2349,14 +2789,17 @@ int camera_attr_enable_tag(camera_h camera, bool enable){ return __convert_camera_error_code(__func__, ret); } -int camera_attr_set_tag_image_description(camera_h camera, const char *description){ - if( camera == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_set_tag_image_description(camera_h camera, const char *description) +{ + if (camera == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, MMCAM_TAG_IMAGE_DESCRIPTION, description, strlen(description), NULL); @@ -2364,14 +2807,17 @@ int camera_attr_set_tag_image_description(camera_h camera, const char *descript return __convert_camera_error_code(__func__, ret); } -int camera_attr_set_tag_orientation(camera_h camera, camera_attr_tag_orientation_e orientation){ - if( camera == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_set_tag_orientation(camera_h camera, camera_attr_tag_orientation_e orientation) +{ + if (camera == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, MMCAM_TAG_ORIENTATION, orientation, NULL); @@ -2379,14 +2825,17 @@ int camera_attr_set_tag_orientation(camera_h camera, camera_attr_tag_orientatio return __convert_camera_error_code(__func__, ret); } -int camera_attr_set_tag_software(camera_h camera, const char *software){ - if( camera == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_set_tag_software(camera_h camera, const char *software) +{ + if (camera == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, MMCAM_TAG_SOFTWARE, software, strlen(software), NULL); @@ -2394,16 +2843,19 @@ int camera_attr_set_tag_software(camera_h camera, const char *software){ return __convert_camera_error_code(__func__, ret); } -int camera_attr_set_geotag(camera_h camera, double latitude , double longitude, double altitude){ - if( camera == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_set_geotag(camera_h camera, double latitude , double longitude, double altitude) +{ + if (camera == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, - MMCAM_TAG_GPS_ENABLE, 1, + MMCAM_TAG_GPS_ENABLE, true, MMCAM_TAG_LATITUDE, latitude, MMCAM_TAG_LONGITUDE, longitude, MMCAM_TAG_ALTITUDE, altitude, @@ -2412,29 +2864,35 @@ int camera_attr_set_geotag(camera_h camera, double latitude , double longitude, return __convert_camera_error_code(__func__, ret); } -int camera_attr_remove_geotag(camera_h camera){ - if( camera == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_remove_geotag(camera_h camera) +{ + if (camera == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, - MMCAM_TAG_GPS_ENABLE, 0, + MMCAM_TAG_GPS_ENABLE, false, NULL); return __convert_camera_error_code(__func__, ret); } -int camera_attr_set_flash_mode(camera_h camera, camera_attr_flash_mode_e mode){ - if( camera == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_set_flash_mode(camera_h camera, camera_attr_flash_mode_e mode) +{ + if (camera == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, MMCAM_STROBE_MODE, mode, NULL); @@ -2443,14 +2901,16 @@ int camera_attr_set_flash_mode(camera_h camera, camera_attr_flash_mode_e mode){ } -int camera_attr_get_zoom(camera_h camera, int *zoom){ - if( camera == NULL || zoom == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); +int camera_attr_get_zoom(camera_h camera, int *zoom) +{ + if (camera == NULL || zoom == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; + ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, MMCAM_CAMERA_DIGITAL_ZOOM, zoom, NULL); @@ -2458,54 +2918,58 @@ int camera_attr_get_zoom(camera_h camera, int *zoom){ return __convert_camera_error_code(__func__, ret); } -int camera_attr_get_zoom_range(camera_h camera, int *min, int *max){ - if( camera == NULL || min == NULL || max == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_get_zoom_range(camera_h camera, int *min, int *max) +{ + if (camera == NULL || min == NULL || max == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; MMCamAttrsInfo ainfo; - ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_DIGITAL_ZOOM, &ainfo); - if( min ) + ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_DIGITAL_ZOOM, &ainfo); + if (ret == MM_ERROR_NONE) { *min = ainfo.int_range.min; - if( max ) *max = ainfo.int_range.max; + } return __convert_camera_error_code(__func__, ret); } -int camera_attr_get_af_mode( camera_h camera, camera_attr_af_mode_e *mode){ - if( camera == NULL || mode == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_get_af_mode(camera_h camera, camera_attr_af_mode_e *mode) +{ + if (camera == NULL || mode == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; + int ret = MM_ERROR_NONE; int focus_mode; int af_range; int detect_mode; - camera_s * handle = (camera_s*)camera; + 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); - - if( ret == CAMERA_ERROR_NONE ){ - switch( focus_mode ){ - case MM_CAMCORDER_FOCUS_MODE_NONE : - case MM_CAMCORDER_FOCUS_MODE_PAN : - case MM_CAMCORDER_FOCUS_MODE_MANUAL : + if (ret == MM_ERROR_NONE) { + switch (focus_mode) { + case MM_CAMCORDER_FOCUS_MODE_NONE: + case MM_CAMCORDER_FOCUS_MODE_PAN: + case MM_CAMCORDER_FOCUS_MODE_MANUAL: *mode = CAMERA_ATTR_AF_NONE; break; case MM_CAMCORDER_FOCUS_MODE_AUTO: case MM_CAMCORDER_FOCUS_MODE_TOUCH_AUTO: case MM_CAMCORDER_FOCUS_MODE_CONTINUOUS: - switch ( af_range ){ - case MM_CAMCORDER_AUTO_FOCUS_NONE : + switch (af_range) { + case MM_CAMCORDER_AUTO_FOCUS_NONE: *mode = CAMERA_ATTR_AF_NORMAL; break; case MM_CAMCORDER_AUTO_FOCUS_NORMAL: @@ -2522,7 +2986,7 @@ int camera_attr_get_af_mode( camera_h camera, camera_attr_af_mode_e *mode){ break; } break; - default : + default: *mode = CAMERA_ATTR_AF_NONE; break; } @@ -2531,74 +2995,89 @@ int camera_attr_get_af_mode( camera_h camera, camera_attr_af_mode_e *mode){ return __convert_camera_error_code(__func__, ret); } -int camera_attr_get_exposure_mode( camera_h camera, camera_attr_exposure_mode_e *mode){ - if( camera == NULL|| mode == NULL){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_get_exposure_mode(camera_h camera, camera_attr_exposure_mode_e *mode) +{ + if (camera == NULL || mode == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); 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 ret; + 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); - if( ret == CAMERA_ERROR_NONE ){ + camera_s *handle = (camera_s *)camera; + + ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, + MMCAM_CAMERA_EXPOSURE_MODE, &exposure_mode, + NULL); + + if (ret == CAMERA_ERROR_NONE) { *mode = maptable[abs(exposure_mode%9)]; } return __convert_camera_error_code(__func__, ret); } -int camera_attr_get_exposure(camera_h camera, int *value){ - if( camera == NULL || value == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_get_exposure(camera_h camera, int *value) +{ + if (camera == NULL || value == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; - ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, MMCAM_CAMERA_EXPOSURE_VALUE, value, NULL); + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; + + ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, + MMCAM_CAMERA_EXPOSURE_VALUE, value, + NULL); return __convert_camera_error_code(__func__, ret); } -int camera_attr_get_exposure_range(camera_h camera, int *min, int *max){ - if( camera == NULL || min == NULL || max == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_get_exposure_range(camera_h camera, int *min, int *max) +{ + if (camera == NULL || min == NULL || max == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; MMCamAttrsInfo ainfo; - ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_EXPOSURE_VALUE, &ainfo); - if( min ) + ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_EXPOSURE_VALUE, &ainfo); + if (ret == MM_ERROR_NONE) { *min = ainfo.int_range.min; - if( max ) *max = ainfo.int_range.max; + } return __convert_camera_error_code(__func__, ret); } -int camera_attr_get_iso( camera_h camera, camera_attr_iso_e *iso){ - if( camera == NULL || iso == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_get_iso(camera_h camera, camera_attr_iso_e *iso) +{ + if (camera == NULL || iso == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; + ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, MMCAM_CAMERA_ISO, iso, NULL); @@ -2606,14 +3085,17 @@ int camera_attr_get_iso( camera_h camera, camera_attr_iso_e *iso){ return __convert_camera_error_code(__func__, ret); } -int camera_attr_get_brightness(camera_h camera, int *level){ - if( camera == NULL || level == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_get_brightness(camera_h camera, int *level) +{ + if (camera == NULL || level == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; + ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, MMCAM_FILTER_BRIGHTNESS, level, NULL); @@ -2621,33 +3103,38 @@ int camera_attr_get_brightness(camera_h camera, int *level){ return __convert_camera_error_code(__func__, ret); } -int camera_attr_get_brightness_range(camera_h camera, int *min, int *max){ - if( camera == NULL || min == NULL || max == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_get_brightness_range(camera_h camera, int *min, int *max) +{ + if (camera == NULL || min == NULL || max == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; MMCamAttrsInfo ainfo; - ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_FILTER_BRIGHTNESS, &ainfo); - if( min ) + ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_FILTER_BRIGHTNESS, &ainfo); + if (ret == MM_ERROR_NONE) { *min = ainfo.int_range.min; - if( max ) *max = ainfo.int_range.max; + } return __convert_camera_error_code(__func__, ret); } -int camera_attr_get_contrast(camera_h camera, int *level){ - if( camera == NULL || level == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_get_contrast(camera_h camera, int *level) +{ + if (camera == NULL || level == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; + ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, MMCAM_FILTER_CONTRAST, level, NULL); @@ -2655,33 +3142,38 @@ int camera_attr_get_contrast(camera_h camera, int *level){ return __convert_camera_error_code(__func__, ret); } -int camera_attr_get_contrast_range(camera_h camera, int *min , int *max){ - if( camera == NULL || min == NULL || max == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_get_contrast_range(camera_h camera, int *min, int *max) +{ + if (camera == NULL || min == NULL || max == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; MMCamAttrsInfo ainfo; - ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_FILTER_CONTRAST, &ainfo); - if( min ) + ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_FILTER_CONTRAST, &ainfo); + if (ret == MM_ERROR_NONE) { *min = ainfo.int_range.min; - if( max ) *max = ainfo.int_range.max; + } return __convert_camera_error_code(__func__, ret); } -int camera_attr_get_whitebalance(camera_h camera, camera_attr_whitebalance_e *wb){ - if( camera == NULL || wb == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_get_whitebalance(camera_h camera, camera_attr_whitebalance_e *wb) +{ + if (camera == NULL || wb == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; + ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, MMCAM_FILTER_WB, wb, NULL); @@ -2689,35 +3181,35 @@ int camera_attr_get_whitebalance(camera_h camera, camera_attr_whitebalance_e *w return __convert_camera_error_code(__func__, ret); } -int camera_attr_get_effect(camera_h camera, camera_attr_effect_mode_e *effect){ - if( camera == NULL || effect == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_get_effect(camera_h camera, camera_attr_effect_mode_e *effect) +{ + if (camera == NULL || effect == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; - int tone; + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; + ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, - MMCAM_FILTER_COLOR_TONE, &tone, + MMCAM_FILTER_COLOR_TONE, effect, NULL); - if( ret != CAMERA_ERROR_NONE ) - return __convert_camera_error_code(__func__, ret); - - *effect = (camera_attr_effect_mode_e)tone; - return __convert_camera_error_code(__func__, ret); } -int camera_attr_get_scene_mode(camera_h camera, camera_attr_scene_mode_e *mode){ - if( camera == NULL || mode == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_get_scene_mode(camera_h camera, camera_attr_scene_mode_e *mode) +{ + if (camera == NULL || mode == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; + ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, MMCAM_FILTER_SCENE_MODE, mode, NULL); @@ -2725,14 +3217,16 @@ int camera_attr_get_scene_mode(camera_h camera, camera_attr_scene_mode_e *mode) return __convert_camera_error_code(__func__, ret); } -int camera_attr_is_enabled_tag(camera_h camera, bool *enable){ - if( camera == NULL || enable == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_is_enabled_tag(camera_h camera, bool *enable) +{ + if (camera == NULL || enable == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, MMCAM_TAG_ENABLE, enable, @@ -2741,36 +3235,44 @@ int camera_attr_is_enabled_tag(camera_h camera, bool *enable){ return __convert_camera_error_code(__func__, ret); } -int camera_attr_get_tag_image_description(camera_h camera, char **description){ - if( camera == NULL || description == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_get_tag_image_description(camera_h camera, char **description) +{ + if (camera == NULL || description == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; char *ndescription = NULL; int desc_size; - ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, MMCAM_TAG_IMAGE_DESCRIPTION, &ndescription, &desc_size, NULL); - if( ret == CAMERA_ERROR_NONE ){ - if( ndescription != NULL ) + ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, + MMCAM_TAG_IMAGE_DESCRIPTION, &ndescription, &desc_size, + NULL); + if (ret == MM_ERROR_NONE) { + if (ndescription != NULL) { *description = strdup(ndescription); - else + } else { *description = strdup(""); + } } return __convert_camera_error_code(__func__, ret); } -int camera_attr_get_tag_orientation(camera_h camera, camera_attr_tag_orientation_e *orientation){ - if( camera == NULL || orientation == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_get_tag_orientation(camera_h camera, camera_attr_tag_orientation_e *orientation) +{ + if (camera == NULL || orientation == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; + ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, MMCAM_TAG_ORIENTATION, orientation, NULL); @@ -2778,37 +3280,44 @@ int camera_attr_get_tag_orientation(camera_h camera, camera_attr_tag_orientatio return __convert_camera_error_code(__func__, ret); } -int camera_attr_get_tag_software(camera_h camera, char **software){ - if( camera == NULL || software == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_get_tag_software(camera_h camera, char **software) +{ + if (camera == NULL || software == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; - char *soft; + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; + char *soft = NULL; int soft_size; - ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, MMCAM_TAG_SOFTWARE, &soft, &soft_size, NULL); - - if( ret == CAMERA_ERROR_NONE ){ - if( soft != NULL ) + ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, + MMCAM_TAG_SOFTWARE, &soft, &soft_size, + NULL); + if (ret == MM_ERROR_NONE) { + if (soft != NULL) { *software = strdup(soft); - else + } else { *software = strdup(""); + } } return __convert_camera_error_code(__func__, ret); } -int camera_attr_get_geotag(camera_h camera, double *latitude , double *longitude, double *altitude){ - if( camera == NULL || latitude == NULL || longitude == NULL || altitude == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_get_geotag(camera_h camera, double *latitude , double *longitude, double *altitude) +{ + if (camera == NULL || latitude == NULL || longitude == NULL || altitude == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; + ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, MMCAM_TAG_LATITUDE, latitude, MMCAM_TAG_LONGITUDE, longitude, @@ -2818,14 +3327,17 @@ int camera_attr_get_geotag(camera_h camera, double *latitude , double *longitude return __convert_camera_error_code(__func__, ret); } -int camera_attr_get_flash_mode(camera_h camera, camera_attr_flash_mode_e *mode){ - if( camera == NULL || mode == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_get_flash_mode(camera_h camera, camera_attr_flash_mode_e *mode) +{ + if (camera == NULL || mode == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; + ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, MMCAM_STROBE_MODE, mode, NULL); @@ -2833,297 +3345,389 @@ int camera_attr_get_flash_mode(camera_h camera, camera_attr_flash_mode_e *mode) return __convert_camera_error_code(__func__, ret); } -int camera_attr_foreach_supported_af_mode( camera_h camera, camera_attr_supported_af_mode_cb foreach_cb , void *user_data){ - if( camera == NULL || foreach_cb == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_foreach_supported_af_mode(camera_h camera, camera_attr_supported_af_mode_cb foreach_cb, void *user_data) +{ + if (camera == NULL || foreach_cb == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - int i; - camera_s * handle = (camera_s*)camera; + int ret = MM_ERROR_NONE; + int i = 0; + camera_s *handle = (camera_s *)camera; MMCamAttrsInfo af_range; MMCamAttrsInfo focus_mode; ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_AF_SCAN_RANGE, &af_range); ret |= mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_FOCUS_MODE, &focus_mode); - - if( ret != CAMERA_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) ) - goto ENDCALLBACK; } - ENDCALLBACK: + for (i = 0 ; i < af_range.int_array.count ; i++) { + if (!foreach_cb(af_range.int_array.array[i], user_data)) { + break;; + } + } return CAMERA_ERROR_NONE; } -int camera_attr_foreach_supported_exposure_mode(camera_h camera, camera_attr_supported_exposure_mode_cb foreach_cb , void *user_data){ - if( camera == NULL || foreach_cb == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_foreach_supported_exposure_mode(camera_h camera, camera_attr_supported_exposure_mode_cb foreach_cb, void *user_data) +{ + if (camera == NULL || foreach_cb == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); 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 ret; - camera_s * handle = (camera_s*)camera; + 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 != CAMERA_ERROR_NONE ) + ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_EXPOSURE_MODE, &info); + if (ret != MM_ERROR_NONE) { return __convert_camera_error_code(__func__, ret); + } - int i; - for( i=0 ; i < info.int_array.count ; i++ ){ - if( maptable[info.int_array.array[i]] != -1 ){ - if ( !foreach_cb(maptable[info.int_array.array[i]],user_data) ) - break; + 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)) { + break; + } + } + } else { + LOGW("unknown value %d", info.int_array.array[i]); } } return CAMERA_ERROR_NONE; } -int camera_attr_foreach_supported_iso( camera_h camera, camera_attr_supported_iso_cb foreach_cb , void *user_data){ - if( camera == NULL || foreach_cb == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_foreach_supported_iso(camera_h camera, camera_attr_supported_iso_cb foreach_cb, void *user_data) +{ + if (camera == NULL || foreach_cb == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; + 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_ISO , &info); - if( ret != CAMERA_ERROR_NONE ) + ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_ISO, &info); + if (ret != MM_ERROR_NONE) { return __convert_camera_error_code(__func__, ret); + } - int i; - for( i=0 ; i < info.int_array.count ; i++ ){ - if( !foreach_cb(info.int_array.array[i],user_data) ) + for (i = 0 ; i < info.int_array.count ; i++) { + if (!foreach_cb(info.int_array.array[i], user_data)) { break; + } } return CAMERA_ERROR_NONE; } -int camera_attr_foreach_supported_whitebalance(camera_h camera, camera_attr_supported_whitebalance_cb foreach_cb , void *user_data){ - if( camera == NULL || foreach_cb == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_foreach_supported_whitebalance(camera_h camera, camera_attr_supported_whitebalance_cb foreach_cb, void *user_data) +{ + if (camera == NULL || foreach_cb == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; + 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_FILTER_WB, &info); + 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)) { + break; + } + } - if( ret != CAMERA_ERROR_NONE ) + return CAMERA_ERROR_NONE; +} + + +int camera_attr_foreach_supported_effect(camera_h camera, camera_attr_supported_effect_cb foreach_cb, void *user_data) +{ + if (camera == NULL || foreach_cb == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + 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_FILTER_COLOR_TONE, &info); + if (ret != MM_ERROR_NONE) { return __convert_camera_error_code(__func__, ret); + } - int i; - for( i=0 ; i < info.int_array.count ; i++ ){ - if ( !foreach_cb(info.int_array.array[i],user_data) ) + for (i = 0 ; i < info.int_array.count ; i++) { + if (!foreach_cb(info.int_array.array[i], user_data)) { break; + } } return CAMERA_ERROR_NONE; } -int camera_attr_foreach_supported_effect(camera_h camera, camera_attr_supported_effect_cb foreach_cb , void *user_data){ - if( camera == NULL || foreach_cb == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_foreach_supported_scene_mode(camera_h camera, camera_attr_supported_scene_mode_cb foreach_cb, void *user_data) +{ + if (camera == NULL || foreach_cb == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; + 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_FILTER_COLOR_TONE , &info); - if( ret != CAMERA_ERROR_NONE ) + ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_FILTER_SCENE_MODE, &info); + if (ret != MM_ERROR_NONE) { return __convert_camera_error_code(__func__, ret); + } - int i; - for( i=0 ; i < info.int_array.count ; i++){ - int effect = info.int_array.array[i]; - if( !foreach_cb(effect,user_data) ) - break; + for (i = 0 ; i < info.int_array.count ; i++) { + if (!foreach_cb(info.int_array.array[i], user_data)) { + break; + } } return CAMERA_ERROR_NONE; } -int camera_attr_foreach_supported_scene_mode(camera_h camera, camera_attr_supported_scene_mode_cb foreach_cb , void *user_data){ - if( camera == NULL || foreach_cb == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_foreach_supported_flash_mode(camera_h camera, camera_attr_supported_flash_mode_cb foreach_cb, void *user_data) +{ + if (camera == NULL || foreach_cb == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; + 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_FILTER_SCENE_MODE , &info); - if( ret != CAMERA_ERROR_NONE ) + ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_STROBE_MODE, &info); + if (ret != MM_ERROR_NONE) { return __convert_camera_error_code(__func__, ret); + } - int i; - for( i=0 ; i < info.int_array.count ; i++){ - if ( !foreach_cb(info.int_array.array[i],user_data) ) + for (i = 0 ; i < info.int_array.count ; i++) { + if (!foreach_cb(info.int_array.array[i], user_data)) { break; + } } return CAMERA_ERROR_NONE; } -int camera_attr_foreach_supported_flash_mode(camera_h camera, camera_attr_supported_flash_mode_cb foreach_cb , void *user_data){ - if( camera == NULL || foreach_cb == NULL){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_foreach_supported_fps(camera_h camera, camera_attr_supported_fps_cb foreach_cb, void *user_data) +{ + if (camera == NULL || foreach_cb == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; MMCamAttrsInfo info; - ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_STROBE_MODE , &info); + int width = 0; + int height = 0; + int i = 0; - if( ret != CAMERA_ERROR_NONE ) + ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, + 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) { return __convert_camera_error_code(__func__, ret); + } - int i; - for( i=0 ; i < info.int_array.count ; i++){ - if( !foreach_cb(info.int_array.array[i],user_data) ) + for (i = 0 ; i < info.int_array.count ; i++) { + if (!foreach_cb(info.int_array.array[i], user_data)) { break; + } } return CAMERA_ERROR_NONE; } -int camera_attr_foreach_supported_fps(camera_h camera, camera_attr_supported_fps_cb foreach_cb , void *user_data){ - if( camera == NULL || foreach_cb == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_foreach_supported_fps_by_resolution(camera_h camera, int width, int height, camera_attr_supported_fps_cb foreach_cb, void *user_data) +{ + if (camera == NULL || foreach_cb == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; MMCamAttrsInfo info; - ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_FPS , &info); + int i = 0; - if( ret != CAMERA_ERROR_NONE ) + ret = mm_camcorder_get_fps_list_by_resolution(handle->mm_handle, width, height, &info); + if (ret != MM_ERROR_NONE) { return __convert_camera_error_code(__func__, ret); + } - int i; - for( i=0 ; i < info.int_array.count ; i++){ - if( !foreach_cb(info.int_array.array[i],user_data) ) + for (i = 0 ; i < info.int_array.count ; i++) { + if (!foreach_cb(info.int_array.array[i], user_data)) { break; + } } return CAMERA_ERROR_NONE; } -int camera_attr_foreach_supported_stream_flip(camera_h camera, camera_attr_supported_stream_flip_cb foreach_cb, void *user_data){ - if( camera == NULL || foreach_cb == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_foreach_supported_stream_flip(camera_h camera, camera_attr_supported_stream_flip_cb foreach_cb, void *user_data) +{ + if (camera == NULL || foreach_cb == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; + 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_FLIP , &info); - if( ret != CAMERA_ERROR_NONE ) + ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_FLIP, &info); + if (ret != MM_ERROR_NONE) { return __convert_camera_error_code(__func__, ret); + } - int i; - for( i=0 ; i < info.int_array.count ; i++){ - if( !foreach_cb(info.int_array.array[i], user_data) ) + for (i = 0 ; i < info.int_array.count ; i++) { + if (!foreach_cb(info.int_array.array[i], user_data)) { break; + } } return CAMERA_ERROR_NONE; } -int camera_attr_foreach_supported_stream_rotation(camera_h camera, camera_attr_supported_stream_rotation_cb foreach_cb, void *user_data){ - if( camera == NULL || foreach_cb == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_foreach_supported_stream_rotation(camera_h camera, camera_attr_supported_stream_rotation_cb foreach_cb, void *user_data) +{ + if (camera == NULL || foreach_cb == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; + 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_ROTATION , &info); - if( ret != CAMERA_ERROR_NONE ) + ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_ROTATION, &info); + if (ret != MM_ERROR_NONE) { return __convert_camera_error_code(__func__, ret); + } - int i; - for( i=0 ; i < info.int_array.count ; i++ ){ - if( !foreach_cb(info.int_array.array[i], user_data) ) + for (i = 0 ; i < info.int_array.count ; i++) { + if (!foreach_cb(info.int_array.array[i], user_data)) { break; + } } return CAMERA_ERROR_NONE; } -int camera_attr_set_stream_rotation(camera_h camera , camera_rotation_e rotation){ - if( camera == NULL){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_set_stream_rotation(camera_h camera, camera_rotation_e rotation) +{ + if (camera == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - if( rotation > CAMERA_ROTATION_270 ) + if (rotation < CAMERA_ROTATION_NONE || rotation > CAMERA_ROTATION_270) { + LOGE("INVALID_PARAMETER - %d", rotation); return CAMERA_ERROR_INVALID_PARAMETER; + } - int ret; - camera_s * handle = (camera_s*)camera; + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; - ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, MMCAM_CAMERA_ROTATION, rotation, NULL); + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, + MMCAM_CAMERA_ROTATION, rotation, + NULL); return __convert_camera_error_code(__func__, ret); } -int camera_attr_get_stream_rotation(camera_h camera , camera_rotation_e *rotation){ - if( camera == NULL || rotation == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_get_stream_rotation(camera_h camera, camera_rotation_e *rotation) +{ + if (camera == NULL || rotation == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; - ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, MMCAM_CAMERA_ROTATION, rotation, NULL); + ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, + MMCAM_CAMERA_ROTATION, rotation, + NULL); return __convert_camera_error_code(__func__, ret); } -int camera_attr_set_stream_flip(camera_h camera , camera_flip_e flip){ - if( camera == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_set_stream_flip(camera_h camera, camera_flip_e flip) +{ + if (camera == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - if( flip > CAMERA_FLIP_BOTH ) + if (flip < CAMERA_FLIP_NONE || flip > CAMERA_FLIP_BOTH) { + LOGE("INVALID_PARAMETER - %d", flip); return CAMERA_ERROR_INVALID_PARAMETER; + } + + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; - int ret; - camera_s * handle = (camera_s*)camera; ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, MMCAM_CAMERA_FLIP, flip, NULL); @@ -3131,62 +3735,93 @@ int camera_attr_set_stream_flip(camera_h camera , camera_flip_e flip){ return __convert_camera_error_code(__func__, ret); } -int camera_attr_get_stream_flip(camera_h camera , camera_flip_e *flip){ - if( camera == NULL || flip == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_get_stream_flip(camera_h camera, camera_flip_e *flip) +{ + if (camera == NULL || flip == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; - ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, MMCAM_CAMERA_FLIP, flip, NULL); + + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; + + ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, + MMCAM_CAMERA_FLIP, flip, + NULL); return __convert_camera_error_code(__func__, ret); } -int _camera_set_use(camera_h camera, bool used){ - camera_s * handle = (camera_s*)camera; + +int _camera_set_use(camera_h camera, bool used) +{ + camera_s *handle = (camera_s *)camera; + + if (handle == NULL) { + LOGE("handle is NULL"); + return CAMERA_ERROR_INVALID_PARAMETER; + } + handle->is_used_in_recorder = used; + return CAMERA_ERROR_NONE; } -bool _camera_is_used(camera_h camera){ - camera_s * handle = (camera_s*)camera; + +bool _camera_is_used(camera_h camera) +{ + camera_s *handle = (camera_s *)camera; + + if (handle == NULL) { + LOGE("handle is NULL"); + return false; + } + return handle->is_used_in_recorder; } -int _camera_get_mm_handle(camera_h camera , MMHandleType *handle){ - if( camera == NULL || handle == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int _camera_get_mm_handle(camera_h camera, MMHandleType *handle) +{ + if (camera == NULL || handle == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } + camera_s *camera_handle = (camera_s*)camera; + *handle = camera_handle->mm_handle; return CAMERA_ERROR_NONE; } -int _camera_set_relay_mm_message_callback(camera_h camera, MMMessageCallback callback, void *user_data){ + +int _camera_set_relay_mm_message_callback(camera_h camera, MMMessageCallback callback, void *user_data) +{ if( camera == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - camera_s *handle = (camera_s*)camera; + camera_s *handle = (camera_s *)camera; handle->relay_message_callback = callback; handle->relay_user_data = user_data; return CAMERA_ERROR_NONE; } -int _camera_get_tbm_surface_format(int in_format, uint32_t *out_format){ - if( in_format <= MM_PIXEL_FORMAT_INVALID || + +int _camera_get_tbm_surface_format(int in_format, uint32_t *out_format) +{ + if (in_format <= MM_PIXEL_FORMAT_INVALID || in_format >= MM_PIXEL_FORMAT_NUM || - out_format == NULL ){ + out_format == NULL) { LOGE("INVALID_PARAMETER : in_format %d, out_format ptr %p", in_format, out_format); return CAMERA_ERROR_INVALID_PARAMETER; } - switch( in_format ){ + switch (in_format) { case MM_PIXEL_FORMAT_NV12: case MM_PIXEL_FORMAT_NV12T: *out_format = TBM_FORMAT_NV12; @@ -3233,10 +3868,12 @@ int _camera_get_tbm_surface_format(int in_format, uint32_t *out_format){ return CAMERA_ERROR_NONE; } -int _camera_get_media_packet_mimetype(int in_format, media_format_mimetype_e *mimetype){ - if( in_format <= MM_PIXEL_FORMAT_INVALID || + +int _camera_get_media_packet_mimetype(int in_format, media_format_mimetype_e *mimetype) +{ + if (in_format <= MM_PIXEL_FORMAT_INVALID || in_format >= MM_PIXEL_FORMAT_NUM || - mimetype == NULL ){ + mimetype == NULL) { LOGE("INVALID_PARAMETER : in_format %d, mimetype ptr %p", in_format, mimetype); return CAMERA_ERROR_INVALID_PARAMETER; } @@ -3288,37 +3925,38 @@ int _camera_get_media_packet_mimetype(int in_format, media_format_mimetype_e *mi return CAMERA_ERROR_NONE; } -int _camera_media_packet_finalize(media_packet_h pkt, int error_code, void *user_data){ + +int _camera_media_packet_finalize(media_packet_h pkt, int error_code, void *user_data) +{ int ret = 0; void *internal_buffer = NULL; tbm_surface_h tsurf = NULL; - if( pkt == NULL || user_data == NULL ){ + if (pkt == NULL || user_data == NULL) { LOGE("invalid parameter buffer %p, user_data %p", pkt, user_data); return MEDIA_PACKET_FINALIZE; } ret = media_packet_get_extra(pkt, &internal_buffer); - - if( ret != MEDIA_PACKET_ERROR_NONE ){ + if (ret != MEDIA_PACKET_ERROR_NONE) { LOGE("media_packet_get_extra failed 0x%x", ret); return MEDIA_PACKET_FINALIZE; } /*LOGD("pointer gst buffer %p, ret 0x%x", internal_buffer, ret);*/ - if( internal_buffer ){ + if (internal_buffer) { gst_buffer_unref((GstBuffer *)internal_buffer); internal_buffer = NULL; } ret = media_packet_get_tbm_surface(pkt, &tsurf); - if( ret != MEDIA_PACKET_ERROR_NONE ){ + if (ret != MEDIA_PACKET_ERROR_NONE) { LOGE("media_packet_get_tbm_surface failed 0x%x", ret); return MEDIA_PACKET_FINALIZE; } - if( tsurf ){ + if (tsurf) { tbm_surface_destroy(tsurf); tsurf = NULL; } @@ -3326,78 +3964,87 @@ int _camera_media_packet_finalize(media_packet_h pkt, int error_code, void *user return MEDIA_PACKET_FINALIZE; } -int camera_attr_set_hdr_mode(camera_h camera, camera_attr_hdr_mode_e mode){ - if( camera == NULL ){ + +int camera_attr_set_hdr_mode(camera_h camera, camera_attr_hdr_mode_e mode) +{ + if (camera == NULL) { LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - if( camera_attr_is_supported_hdr_capture(camera) == false ){ + if (camera_attr_is_supported_hdr_capture(camera) == false) { LOGE("NOT_SUPPORTED(0x%08x)", CAMERA_ERROR_NOT_SUPPORTED); return CAMERA_ERROR_NOT_SUPPORTED; } - int ret; - camera_s * handle = (camera_s*)camera; - ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, MMCAM_CAMERA_HDR_CAPTURE, mode, NULL); + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; + + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, + MMCAM_CAMERA_HDR_CAPTURE, mode, + NULL); - if( ret == MM_ERROR_NONE ){ - if( mode == CAMERA_ATTR_HDR_MODE_KEEP_ORIGINAL ) + if (ret == MM_ERROR_NONE) { + 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); } -int camera_attr_get_hdr_mode(camera_h camera, camera_attr_hdr_mode_e *mode){ - if( camera == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x) - handle",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_get_hdr_mode(camera_h camera, camera_attr_hdr_mode_e *mode) +{ + if (camera == NULL) { + LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - if( camera_attr_is_supported_hdr_capture(camera) == false ){ + if (camera_attr_is_supported_hdr_capture(camera) == false) { LOGE("NOT_SUPPORTED(0x%08x)", CAMERA_ERROR_NOT_SUPPORTED); return CAMERA_ERROR_NOT_SUPPORTED; } - if( mode == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x) - mode",CAMERA_ERROR_INVALID_PARAMETER); + if (mode == NULL) { + LOGE("INVALID_PARAMETER(0x%08x) - mode", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - int result; - camera_s * handle = (camera_s*)camera; - ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, MMCAM_CAMERA_HDR_CAPTURE, &result, NULL); + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; - if( ret == MM_ERROR_NONE ){ - *mode = result; - } + ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, + MMCAM_CAMERA_HDR_CAPTURE, mode, + NULL); return __convert_camera_error_code(__func__, ret); } -bool camera_attr_is_supported_hdr_capture(camera_h camera){ - if( camera == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +bool camera_attr_is_supported_hdr_capture(camera_h camera) +{ + if (camera == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return false; } - int ret; - int i; - camera_s * handle = (camera_s*)camera; + + int ret = MM_ERROR_NONE; + int i = 0; + camera_s *handle = (camera_s *)camera; MMCamAttrsInfo hdr_info; ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_HDR_CAPTURE, &hdr_info); set_last_result(__convert_camera_error_code(__func__, ret)); - if( ret != MM_ERROR_NONE ){ + if (ret != MM_ERROR_NONE) { LOGE("MMCAM_CAMERA_HDR_CAPTURE get attr info failed"); return false; } - for( i = 0; i < hdr_info.int_array.count ; i++ ){ - if( hdr_info.int_array.array[i] >= MM_CAMCORDER_HDR_ON ){ + for (i = 0; i < hdr_info.int_array.count ; i++) { + if (hdr_info.int_array.array[i] >= MM_CAMCORDER_HDR_ON) { LOGD("HDR capture supported"); return true; } @@ -3408,267 +4055,332 @@ bool camera_attr_is_supported_hdr_capture(camera_h camera){ return false; } -int camera_attr_set_hdr_capture_progress_cb(camera_h camera, camera_attr_hdr_progress_cb callback, void* user_data){ - if( camera == NULL ){ + +int camera_attr_set_hdr_capture_progress_cb(camera_h camera, camera_attr_hdr_progress_cb callback, void *user_data) +{ + if (camera == NULL) { LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - if( camera_attr_is_supported_hdr_capture(camera) == false ){ + if (camera_attr_is_supported_hdr_capture(camera) == false) { LOGE("NOT_SUPPORTED(0x%08x)", CAMERA_ERROR_NOT_SUPPORTED); return CAMERA_ERROR_NOT_SUPPORTED; } - if( callback == NULL ){ + if (callback == NULL) { LOGE("INVALID_PARAMETER(0x%08x) - callback", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - camera_s * handle = (camera_s*)camera; - handle->user_cb[_CAMERA_EVENT_TYPE_HDR_PROGRESS] = (void*)callback; - handle->user_data[_CAMERA_EVENT_TYPE_HDR_PROGRESS] = (void*)user_data; + camera_s *handle = (camera_s *)camera; + + handle->user_cb[_CAMERA_EVENT_TYPE_HDR_PROGRESS] = (void *)callback; + handle->user_data[_CAMERA_EVENT_TYPE_HDR_PROGRESS] = (void *)user_data; + return CAMERA_ERROR_NONE; } -int camera_attr_unset_hdr_capture_progress_cb(camera_h camera){ - if( camera == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_unset_hdr_capture_progress_cb(camera_h camera) +{ + if (camera == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - if( camera_attr_is_supported_hdr_capture(camera) == false ){ + if (camera_attr_is_supported_hdr_capture(camera) == false) { LOGE("NOT_SUPPORTED(0x%08x)", CAMERA_ERROR_NOT_SUPPORTED); return CAMERA_ERROR_NOT_SUPPORTED; } - camera_s * handle = (camera_s*)camera; - handle->user_cb[_CAMERA_EVENT_TYPE_HDR_PROGRESS] = (void*)NULL; - handle->user_data[_CAMERA_EVENT_TYPE_HDR_PROGRESS] = (void*)NULL; + camera_s *handle = (camera_s *)camera; + + handle->user_cb[_CAMERA_EVENT_TYPE_HDR_PROGRESS] = (void *)NULL; + handle->user_data[_CAMERA_EVENT_TYPE_HDR_PROGRESS] = (void *)NULL; return CAMERA_ERROR_NONE; } -int camera_attr_enable_anti_shake(camera_h camera, bool enable){ - if( camera == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_enable_anti_shake(camera_h camera, bool enable) +{ + if (camera == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - if( camera_attr_is_supported_anti_shake(camera) == false ){ + if (camera_attr_is_supported_anti_shake(camera) == false) { LOGE("NOT_SUPPORTED(0x%08x)", CAMERA_ERROR_NOT_SUPPORTED); return CAMERA_ERROR_NOT_SUPPORTED; } - int ret; + int ret = MM_ERROR_NONE; int mode = MM_CAMCORDER_AHS_OFF; + camera_s *handle = (camera_s *)camera; - if( enable ) + if (enable) { mode = MM_CAMCORDER_AHS_ON; + } - camera_s * handle = (camera_s*)camera; - ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, MMCAM_CAMERA_ANTI_HANDSHAKE, mode, NULL); + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, + MMCAM_CAMERA_ANTI_HANDSHAKE, mode, + NULL); return __convert_camera_error_code(__func__, ret); } -int camera_attr_is_enabled_anti_shake(camera_h camera , bool *enabled){ - if( camera == NULL ){ + +int camera_attr_is_enabled_anti_shake(camera_h camera, bool *enabled) +{ + if (camera == NULL) { LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - if( camera_attr_is_supported_anti_shake(camera) == false ){ + if (camera_attr_is_supported_anti_shake(camera) == false) { LOGE("NOT_SUPPORTED(0x%08x)", CAMERA_ERROR_NOT_SUPPORTED); return CAMERA_ERROR_NOT_SUPPORTED; } - if( enabled == NULL ){ + if (enabled == NULL) { LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - int mode = MM_CAMCORDER_AHS_OFF; - camera_s * handle = (camera_s*)camera; - ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, MMCAM_CAMERA_ANTI_HANDSHAKE, &mode, NULL); + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; - if( ret == MM_ERROR_NONE ) - *enabled = mode; + ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, + MMCAM_CAMERA_ANTI_HANDSHAKE, enabled, + NULL); return __convert_camera_error_code(__func__, ret); } -bool camera_attr_is_supported_anti_shake(camera_h camera){ - if( camera == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +bool camera_attr_is_supported_anti_shake(camera_h camera) +{ + if (camera == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return false; } - int i; - camera_s * handle = (camera_s*)camera; + int i = 0; + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; MMCamAttrsInfo ash_info; - int ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_ANTI_HANDSHAKE , &ash_info); + + ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_ANTI_HANDSHAKE, &ash_info); set_last_result(__convert_camera_error_code(__func__, ret)); + if (ret != MM_ERROR_NONE) { + LOGE("MMCAM_CAMERA_ANTI_HANDSHAKE get attr info failed"); + return false; + } - for( i=0 ; i < ash_info.int_array.count ; i++ ){ - if( ash_info.int_array.array[i] == MM_CAMCORDER_AHS_ON ) + for (i = 0 ; i < ash_info.int_array.count ; i++) { + if (ash_info.int_array.array[i] == MM_CAMCORDER_AHS_ON) { return true; + } } return false; } -int camera_attr_enable_video_stabilization(camera_h camera, bool enable){ - if( camera == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_enable_video_stabilization(camera_h camera, bool enable) +{ + if (camera == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - if( camera_attr_is_supported_video_stabilization(camera) == false ){ + if (camera_attr_is_supported_video_stabilization(camera) == false) { LOGE("NOT_SUPPORTED(0x%08x)", CAMERA_ERROR_NOT_SUPPORTED); return CAMERA_ERROR_NOT_SUPPORTED; } - int ret; + int ret = MM_ERROR_NONE; int mode = MM_CAMCORDER_VIDEO_STABILIZATION_OFF; + camera_s *handle = (camera_s*)camera; - if( enable ) + if (enable) { mode = MM_CAMCORDER_VIDEO_STABILIZATION_ON; + } - camera_s * handle = (camera_s*)camera; - ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, MMCAM_CAMERA_VIDEO_STABILIZATION, mode, NULL); + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, + MMCAM_CAMERA_VIDEO_STABILIZATION, mode, + NULL); return __convert_camera_error_code(__func__, ret); } -int camera_attr_is_enabled_video_stabilization(camera_h camera, bool *enabled){ - if( camera == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x) - handle",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_is_enabled_video_stabilization(camera_h camera, bool *enabled) +{ + if (camera == NULL) { + LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - if( camera_attr_is_supported_video_stabilization(camera) == false ){ + if (camera_attr_is_supported_video_stabilization(camera) == false) { LOGE("NOT_SUPPORTED(0x%08x)", CAMERA_ERROR_NOT_SUPPORTED); return CAMERA_ERROR_NOT_SUPPORTED; } - if( enabled == NULL ){ + if (enabled == NULL) { LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; + int ret = MM_ERROR_NONE; int mode = MM_CAMCORDER_VIDEO_STABILIZATION_OFF; - camera_s * handle = (camera_s*)camera; - ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, MMCAM_CAMERA_VIDEO_STABILIZATION, &mode, NULL); + camera_s *handle = (camera_s *)camera; - if( ret == MM_ERROR_NONE ) + ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, + 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); } -bool camera_attr_is_supported_video_stabilization(camera_h camera){ - if( camera == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +bool camera_attr_is_supported_video_stabilization(camera_h camera) +{ + if (camera == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return false; } - int i; - camera_s * handle = (camera_s*)camera; + int i = 0; + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; MMCamAttrsInfo vs_info; - int ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_VIDEO_STABILIZATION , &vs_info); + + ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_VIDEO_STABILIZATION, &vs_info); set_last_result(__convert_camera_error_code(__func__, ret)); + if (ret != MM_ERROR_NONE) { + LOGE("MMCAM_CAMERA_VIDEO_STABILIZATION get attr info failed"); + return false; + } - for( i=0 ; i < vs_info.int_array.count ; i++ ){ - if( vs_info.int_array.array[i] == MM_CAMCORDER_VIDEO_STABILIZATION_ON ) + for (i = 0 ; i < vs_info.int_array.count ; i++) { + if (vs_info.int_array.array[i] == MM_CAMCORDER_VIDEO_STABILIZATION_ON) { return true; + } } return false; } -int camera_attr_enable_auto_contrast(camera_h camera, bool enable){ - if( camera == NULL ){ + +int camera_attr_enable_auto_contrast(camera_h camera, bool enable) +{ + if (camera == NULL) { LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - if( camera_attr_is_supported_auto_contrast(camera) == false ){ + if (camera_attr_is_supported_auto_contrast(camera) == false) { LOGE("NOT_SUPPORTED(0x%08x)", CAMERA_ERROR_NOT_SUPPORTED); return CAMERA_ERROR_NOT_SUPPORTED; } - int ret; + int ret = MM_ERROR_NONE; int mode = MM_CAMCORDER_WDR_OFF; + camera_s *handle = (camera_s *)camera; - if( enable ) + if (enable) { mode = MM_CAMCORDER_WDR_ON; + } - camera_s * handle = (camera_s*)camera; - ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, MMCAM_CAMERA_WDR, mode, NULL); + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, + MMCAM_CAMERA_WDR, mode, + NULL); return __convert_camera_error_code(__func__, ret); } -int camera_attr_is_enabled_auto_contrast(camera_h camera, bool *enabled){ - if( camera == NULL ){ + +int camera_attr_is_enabled_auto_contrast(camera_h camera, bool *enabled) +{ + if (camera == NULL) { LOGE("INVALID_PARAMETER(0x%08x) - handle", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - if( camera_attr_is_supported_auto_contrast(camera) == false ){ + if (camera_attr_is_supported_auto_contrast(camera) == false) { LOGE("NOT_SUPPORTED(0x%08x)", CAMERA_ERROR_NOT_SUPPORTED); return CAMERA_ERROR_NOT_SUPPORTED; } - if( enabled == NULL ){ + if (enabled == NULL) { LOGE("INVALID_PARAMETER(0x%08x) - enabled", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; + int ret = MM_ERROR_NONE; int mode = MM_CAMCORDER_WDR_OFF; - camera_s * handle = (camera_s*)camera; - ret = mm_camcorder_get_attributes(handle->mm_handle ,NULL, MMCAM_CAMERA_WDR , &mode, NULL); + camera_s *handle = (camera_s *)camera; - if( ret == MM_ERROR_NONE ) + ret = mm_camcorder_get_attributes(handle->mm_handle, NULL, + MMCAM_CAMERA_WDR, &mode, + NULL); + + if (ret == MM_ERROR_NONE) { *enabled = mode; + } return __convert_camera_error_code(__func__, ret); } -bool camera_attr_is_supported_auto_contrast(camera_h camera) { - if( camera == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +bool camera_attr_is_supported_auto_contrast(camera_h camera) +{ + if (camera == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return false; } - int i; - camera_s * handle = (camera_s*)camera; + int i = 0; + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; MMCamAttrsInfo info; - int ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_WDR, &info); + + ret = mm_camcorder_get_attribute_info(handle->mm_handle, MMCAM_CAMERA_WDR, &info); set_last_result(__convert_camera_error_code(__func__, ret)); + if (ret != MM_ERROR_NONE) { + LOGE("MMCAM_CAMERA_WDR get attr info failed"); + return false; + } - for( i=0 ; i < info.int_array.count ; i++ ) { - if( info.int_array.array[i] == MM_CAMCORDER_WDR_ON ) + for (i = 0 ; i < info.int_array.count ; i++) { + if (info.int_array.array[i] == MM_CAMCORDER_WDR_ON) { return true; + } } return false; } -int camera_attr_disable_shutter_sound(camera_h camera, bool disable){ - if (camera == NULL ){ - LOGE("INVALID_PARAMETER(0x%08x)",CAMERA_ERROR_INVALID_PARAMETER); + +int camera_attr_disable_shutter_sound(camera_h camera, bool disable) +{ + if (camera == NULL) { + LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER); return CAMERA_ERROR_INVALID_PARAMETER; } - int ret; - camera_s * handle = (camera_s*)camera; - ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, "capture-sound-enable", !disable, NULL); + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; - if( ret != 0 ){ + ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, + "capture-sound-enable", !disable, + NULL); + if (ret != MM_ERROR_NONE) { LOGE("CAMERA_ERROR_INVALID_OPERATION : not permitted disable shutter sound"); return CAMERA_ERROR_INVALID_OPERATION; } diff --git a/src/camera_internal.c b/src/camera_internal.c index a452f56..026e53c 100644 --- a/src/camera_internal.c +++ b/src/camera_internal.c @@ -38,46 +38,54 @@ int camera_set_x11_display_rotation(camera_h camera, camera_rotation_e rotation) return camera_set_display_rotation(camera, rotation); } + int camera_get_x11_display_rotation(camera_h camera, camera_rotation_e *rotation) { return camera_get_display_rotation(camera, rotation); } + int camera_set_x11_display_flip(camera_h camera, camera_flip_e flip) { return camera_set_display_flip(camera, flip); } + int camera_get_x11_display_flip(camera_h camera, camera_flip_e *flip) { return camera_get_display_flip(camera, flip); } + int camera_set_x11_display_visible(camera_h camera, bool visible) { return camera_set_display_visible(camera, visible); } -int camera_is_x11_display_visible(camera_h camera, bool* visible) + +int camera_is_x11_display_visible(camera_h camera, bool *visible) { return camera_is_display_visible(camera, visible); } + int camera_set_x11_display_mode(camera_h camera, camera_display_mode_e mode) { return camera_set_display_mode(camera, mode); } -int camera_get_x11_display_mode(camera_h camera, camera_display_mode_e* mode) + +int camera_get_x11_display_mode(camera_h camera, camera_display_mode_e *mode) { return camera_get_display_mode(camera, mode); } + int camera_set_x11_display_pixmap(camera_h camera, camera_x11_pixmap_updated_cb callback, void *user_data) { - int ret; - camera_s *handle = (camera_s*)camera; - camera_state_e capi_state; + int ret = MM_ERROR_NONE; + camera_s *handle = (camera_s *)camera; + camera_state_e capi_state = CAMERA_STATE_NONE; if (handle == NULL || callback == NULL) { LOGE("INVALID_PARAMETER(handle:%p,callback:%p,user_data:%p)", handle, callback, user_data); @@ -91,9 +99,9 @@ int camera_set_x11_display_pixmap(camera_h camera, camera_x11_pixmap_updated_cb } ret = mm_camcorder_set_attributes(handle->mm_handle, NULL, - MMCAM_DISPLAY_SURFACE, MM_DISPLAY_SURFACE_X_EXT, - MMCAM_DISPLAY_HANDLE, callback, sizeof(unsigned int (void *)), - NULL); + MMCAM_DISPLAY_SURFACE, MM_DISPLAY_SURFACE_X_EXT, + MMCAM_DISPLAY_HANDLE, callback, sizeof(void *), + NULL); return __convert_camera_error_code(__func__, ret); } -- 2.7.4