/**
* @brief The Camera handle.
* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @see recorder_create_videorecorder()
+ * @see legacy_recorder_create_videorecorder()
*/
typedef struct camera_s *camera_h;
* @param[in] current The current state of the camera
* @param[in] by_policy If @c true the state is changed by policy, otherwise @c false
* @param[in] user_data The user data passed from the callback registration function
- * @pre camera_start_preview(), camera_start_capture() or camera_stop_preview()
+ * @pre legacy_camera_start_preview(), camera_start_capture() or camera_stop_preview()
* will invoke this callback if you register this callback using camera_set_state_changed_cb().
- * @see camera_set_state_changed_cb()
+ * @see legacy_camera_set_state_changed_cb()
*/
typedef void (*camera_state_changed_cb)(camera_state_e previous, camera_state_e current, bool by_policy, void *user_data);
* @param[in] previous The previous state of the camera
* @param[in] current The current state of the camera
* @param[in] user_data The user data passed from the callback registration function
- * @see camera_set_interrupted_cb()
+ * @see legacy_camera_set_interrupted_cb()
*/
typedef void (*camera_interrupted_cb)(camera_policy_e policy, camera_state_e previous, camera_state_e current, void *user_data);
*
* @param[in] state The current state of the auto-focus
* @param[in] user_data The user data passed from the callback registration function
- * @pre camera_start_focusing() will invoke this callback if you register it using camera_set_focus_changed_cb().
- * @see camera_set_focus_changed_cb()
- * @see camera_unset_focus_changed_cb()
- * @see camera_start_focusing()
- * @see camera_cancel_focusing()
+ * @pre legacy_camera_start_focusing() will invoke this callback if you register it using camera_set_focus_changed_cb().
+ * @see legacy_camera_set_focus_changed_cb()
+ * @see legacy_camera_unset_focus_changed_cb()
+ * @see legacy_camera_start_focusing()
+ * @see legacy_camera_cancel_focusing()
*/
typedef void (*camera_focus_changed_cb)(camera_focus_state_e state, void *user_data);
*
* @param[in] frame The reference pointer to preview stream data
* @param[in] user_data The user data passed from the callback registration function
- * @pre camera_start_preview() will invoke this callback function if you register this callback using camera_set_preview_cb().
- * @see camera_start_preview()
- * @see camera_set_preview_cb()
- * @see camera_unset_preview_cb()
+ * @pre legacy_camera_start_preview() will invoke this callback function if you register this callback using camera_set_preview_cb().
+ * @see legacy_camera_start_preview()
+ * @see legacy_camera_set_preview_cb()
+ * @see legacy_camera_unset_preview_cb()
*/
typedef void (*camera_preview_cb)(MMCamcorderVideoStreamDataType *frame, void *user_data);
* @param[in] postview The image data of the postview
* @param[in] thumbnail The image data of the thumbnail (it should be @c NULL if the available thumbnail data does not exist)
* @param[in] user_data The user data passed from the callback registration function
- * @pre camera_start_capture() or camera_start_continuous_capture() will invoke this callback function if it is registered using camera_start_capture() or camera_start_continuous_capture().
- * @see camera_start_capture()
- * @see camera_start_continuous_capture()
- * @see camera_capture_completed_cb()
+ * @pre legacy_camera_start_capture() or camera_start_continuous_capture() will invoke this callback function if it is registered using camera_start_capture() or camera_start_continuous_capture().
+ * @see legacy_camera_start_capture()
+ * @see legacy_camera_start_continuous_capture()
+ * @see legacy_camera_capture_completed_cb()
*/
typedef void (*camera_capturing_cb)(camera_image_data_s *image, camera_image_data_s *postview, camera_image_data_s *thumbnail, void *user_data);
* If you want to show the user a preview after capturing is finished, an application can use camera_start_preview() after calling this callback.
*
* @param[in] user_data The user data passed from the callback registration function
- * @pre This callback function is invoked if it is registered using camera_start_capture() or camera_start_continuous_capture().
- * @see camera_start_capture()
- * @see camera_start_continuous_capture()
- * @see camera_capturing_cb()
+ * @pre This callback function is invoked if it is registered using camera_start_capture() or camera_start_continuous_capture().
+ * @see legacy_camera_start_capture()
+ * @see legacy_camera_start_continuous_capture()
+ * @see legacy_camera_capturing_cb()
*/
typedef void (*camera_capture_completed_cb)(void *user_data);
* @param[in] error The error code
* @param[in] current_state The current state of the camera
* @param[in] user_data The user data passed from the callback registration function
- * @pre This callback function is invoked if it is registered using camera_set_error_cb().
- * @see camera_set_error_cb()
- * @see camera_unset_error_cb()
+ * @pre This callback function is invoked if it is registered using camera_set_error_cb().
+ * @see legacy_camera_set_error_cb()
+ * @see legacy_camera_unset_error_cb()
*/
typedef void (*camera_error_cb)(camera_error_e error, camera_state_e current_state, void *user_data);
* @param[in] faces The detected face array
* @param[in] count The length of the array
* @param[in] user_data The user data passed from the callback registration function
- * @see camera_start_face_detection()
+ * @see legacy_camera_start_face_detection()
*/
typedef void (*camera_face_detected_cb)(camera_detected_face_s *faces, int count, void *user_data);
* @param[in] height The preview image height
* @param[in] user_data The user data passed from the foreach function
* @return @c true to continue with the next iteration of the loop, \n otherwise @c false to break out of the loop
- * @pre camera_foreach_supported_preview_resolution() will invoke this callback.
- * @see camera_foreach_supported_preview_resolution()
+ * @pre legacy_camera_foreach_supported_preview_resolution() will invoke this callback.
+ * @see legacy_camera_foreach_supported_preview_resolution()
*/
typedef bool (*camera_supported_preview_resolution_cb)(int width, int height, void *user_data);
* @param[in] height The capture resolution height
* @param[in] user_data The user data passed from the foreach function
* @return @c true to continue with the next iteration of the loop, \n otherwise @c false to break out of the loop
- * @pre camera_foreach_supported_capture_resolution() will invoke this callback.
- * @see camera_foreach_supported_capture_resolution()
+ * @pre legacy_camera_foreach_supported_capture_resolution() will invoke this callback.
+ * @see legacy_camera_foreach_supported_capture_resolution()
*/
typedef bool (*camera_supported_capture_resolution_cb)(int width, int height, void *user_data);
* @param[in] format The supported pixel format
* @param[in] user_data The user data passed from the foreach function
* @return @c true to continue with the next iteration of the loop, \n otherwise @c false to break out of the loop
- * @pre camera_foreach_supported_capture_format() will invoke this callback.
- * @see camera_foreach_supported_capture_format()
+ * @pre legacy_camera_foreach_supported_capture_format() will invoke this callback.
+ * @see legacy_camera_foreach_supported_capture_format()
*/
typedef bool (*camera_supported_capture_format_cb)(camera_pixel_format_e format, void *user_data);
* @param[in] format The supported preview data format
* @param[in] user_data The user data passed from the foreach function
* @return @c true to continue with the next iteration of the loop, \n otherwise @c false to break out of the loop
- * @pre camera_foreach_supported_preview_format() will invoke this callback.
- * @see camera_foreach_supported_preview_format()
+ * @pre legacy_camera_foreach_supported_preview_format() will invoke this callback.
+ * @see legacy_camera_foreach_supported_preview_format()
*/
typedef bool (*camera_supported_preview_format_cb)(camera_pixel_format_e format, void *user_data);
* @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
* @post If it succeeds, the camera state will be #CAMERA_STATE_CREATED.
*
- * @see camera_destroy()
+ * @see legacy_camera_destroy()
*/
int legacy_camera_create(camera_device_e device, camera_h *camera);
/**
+ * @brief Changes camera device.
+ *
+ * @since_tizen 3.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/camera
+ * @remarks This function can be used to change camera device simply without camera_destroy() and camera_create().\n
+ * If display reuse hint is set by camera_set_display_reuse_hint() before stop preview,\n
+ * display handle will be reused and last frame on display can be kept even though camera device is changed.
+ * @param[in] camera The handle to the camera
+ * @param[in] device The hardware camera to access
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #CAMERA_ERROR_NONE Successful
+ * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CAMERA_ERROR_INVALID_STATE Invalid state
+ * @retval #CAMERA_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #CAMERA_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
+ * @pre The camera state must be set to #CAMERA_STATE_CREATED.
+ * @post If it succeeds, the camera attributes and settings will be reset.
+ *
+ * @see legacy_camera_set_display_reuse_hint()
+ * @see legacy_camera_get_display_reuse_hint()
+ */
+int legacy_camera_change_device(camera_h *camera, camera_device_e device);
+
+/**
* @brief Destroys the camera handle and releases all its resources.
*
* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @post If it succeeds, the camera state will be #CAMERA_STATE_PREVIEW.\n
* legacy_camera_preview_cb() will be called when preview image data becomes available.
*
- * @see camera_stop_preview()
+ * @see legacy_camera_stop_preview()
* @see legacy_camera_set_display()
* @see legacy_camera_set_preview_cb()
* @see legacy_camera_set_media_packet_preview_cb()
* @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
* @pre The camera state must be set to #CAMERA_STATE_PREVIEW.
* @post The camera state will be #CAMERA_STATE_CREATED.
- * @see camera_start_preview()
- * @see camera_unset_preview_cb()
- * @see camera_unset_media_packet_preview_cb()
+ * @see legacy_camera_start_preview()
+ * @see legacy_camera_unset_preview_cb()
+ * @see legacy_camera_unset_media_packet_preview_cb()
*/
int legacy_camera_stop_preview(camera_h camera);
* @pre The camera state must be set to #CAMERA_STATE_PREVIEW.
*
* @see legacy_camera_start_focusing()
- * @see camera_focus_changed_cb()
+ * @see legacy_camera_focus_changed_cb()
*/
int legacy_camera_cancel_focusing(camera_h camera);
* @pre The camera state must be set to #CAMERA_STATE_CREATED or #CAMERA_STATE_PREVIEW.
*
* @see legacy_camera_start_preview()
- * @see camera_get_preview_resolution()
- * @see camera_foreach_supported_preview_resolution()
+ * @see legacy_camera_get_preview_resolution()
+ * @see legacy_camera_foreach_supported_preview_resolution()
*/
int legacy_camera_set_preview_resolution(camera_h camera, int width, int height);
* @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
- * @see camera_set_preview_resolution()
- * @see camera_foreach_supported_preview_resolution()
+ * @see legacy_camera_set_preview_resolution()
+ * @see legacy_camera_foreach_supported_preview_resolution()
*/
int legacy_camera_get_preview_resolution(camera_h camera, int *width, int *height);
* @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
- * @see camera_set_preview_resolution()
- * @see camera_foreach_supported_preview_resolution()
+ * @see legacy_camera_set_preview_resolution()
+ * @see legacy_camera_foreach_supported_preview_resolution()
*/
int legacy_camera_get_recommended_preview_resolution(camera_h camera, int *width, int *height);
* @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
* @post This function invokes legacy_camera_supported_preview_resolution_cb() repeatedly to retrieve each supported preview resolution.
*
- * @see camera_set_preview_resolution()
- * @see camera_get_preview_resolution()
- * @see camera_supported_preview_resolution_cb()
+ * @see legacy_camera_set_preview_resolution()
+ * @see legacy_camera_get_preview_resolution()
+ * @see legacy_camera_supported_preview_resolution_cb()
*/
int legacy_camera_foreach_supported_preview_resolution(camera_h camera,
camera_supported_preview_resolution_cb callback, void *user_data);
* @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
* @see legacy_camera_start_preview()
- * @see camera_get_display_rotation()
+ * @see legacy_camera_get_display_rotation()
*/
int legacy_camera_set_display_rotation(camera_h camera, camera_rotation_e rotation);
* @retval #CAMERA_ERROR_INVALID_OPERATION Display type is incorrect
* @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
- * @see camera_get_display_flip()
+ * @see legacy_camera_get_display_flip()
*/
int legacy_camera_set_display_flip(camera_h camera, camera_flip_e flip);
*/
int legacy_camera_get_display_mode(camera_h camera, camera_display_mode_e *mode);
-
+/**
+ * @brief Sets hint for reuse display.
+ * @since_tizen 3.0
+ * @remarks To reuse display, camera_change_device() function should be called for change the camera device.
+ * @param[in] camera The handle to the camera
+ * @param[in] hint The hint for reuse display
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #CAMERA_ERROR_NONE Successful
+ * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CAMERA_ERROR_INVALID_STATE Invalid state
+ * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
+ * @pre The camera state must be set to #CAMERA_STATE_PREVIEW.
+ * @see legacy_camera_get_display_reuse_hint()
+ * @see legacy_camera_change_device()
+ */
int legacy_camera_set_display_reuse_hint(camera_h camera, int hint);
+/**
+ * @brief Gets hint for reuse display.
+ * @since_tizen 3.0
+ * @param[in] camera The handle to the camera
+ * @param[out] hint The hint for reuse display
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #CAMERA_ERROR_NONE Successful
+ * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
+ * @see legacy_camera_get_display_reuse_hint()
+ * @see legacy_camera_change_device()
+ */
int legacy_camera_get_display_reuse_hint(camera_h camera, int *hint);
/**
* @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
* @pre The camera state must be set to #CAMERA_STATE_CREATED or #CAMERA_STATE_PREVIEW.
* @see legacy_camera_start_capture()
- * @see camera_get_capture_resolution()
- * @see camera_foreach_supported_capture_resolution()
+ * @see legacy_camera_get_capture_resolution()
+ * @see legacy_camera_foreach_supported_capture_resolution()
*/
int legacy_camera_set_capture_resolution(camera_h camera, int width, int height);
* @post This function invokes legacy_camera_supported_capture_resolution_cb() repeatedly to retrieve each supported capture resolution.
* @see legacy_camera_set_capture_resolution()
* @see legacy_camera_get_capture_resolution()
- * @see camera_supported_capture_resolution_cb()
+ * @see legacy_camera_supported_capture_resolution_cb()
*/
int legacy_camera_foreach_supported_capture_resolution(camera_h camera,
camera_supported_capture_resolution_cb callback, void *user_data);
* @retval #CAMERA_ERROR_INVALID_STATE Invalid state
* @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
- * @pre The camera state must be set to #CAMERA_STATE_CREATED or #CAMERA_STATE_PREVIEW.
+ * @pre The camera state must be set to #CAMERA_STATE_CREATED or #CAMERA_STATE_PREVIEW.
* @see legacy_camera_start_capture()
- * @see camera_get_capture_format()
- * @see camera_foreach_supported_capture_format()
+ * @see legacy_camera_get_capture_format()
+ * @see legacy_camera_foreach_supported_capture_format()
*/
int legacy_camera_set_capture_format(camera_h camera, camera_pixel_format_e format);
* @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
- * @see camera_set_capture_format()
- * @see camera_foreach_supported_capture_format()
+ * @see legacy_camera_set_capture_format()
+ * @see legacy_camera_foreach_supported_capture_format()
*/
int legacy_camera_get_capture_format(camera_h camera, camera_pixel_format_e *format);
* @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
* @post This function invokes legacy_camera_supported_capture_format_cb() repeatedly to retrieve each supported capture format.
- * @see camera_set_capture_format()
- * @see camera_get_capture_format()
- * @see camera_supported_capture_format_cb()
+ * @see legacy_camera_set_capture_format()
+ * @see legacy_camera_get_capture_format()
+ * @see legacy_camera_supported_capture_format_cb()
*/
int legacy_camera_foreach_supported_capture_format(camera_h camera,
camera_supported_capture_format_cb callback, void *user_data);
* @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
* @pre The camera state must be set to #CAMERA_STATE_CREATED.
* @see legacy_camera_start_preview()
- * @see camera_get_preview_format()
- * @see camera_foreach_supported_preview_format()
+ * @see legacy_camera_get_preview_format()
+ * @see legacy_camera_foreach_supported_preview_format()
*/
int legacy_camera_set_preview_format(camera_h camera, camera_pixel_format_e format);
* @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
- * @see camera_set_preview_format()
- * @see camera_foreach_supported_preview_format()
+ * @see legacy_camera_set_preview_format()
+ * @see legacy_camera_foreach_supported_preview_format()
*/
int legacy_camera_get_preview_format(camera_h camera, camera_pixel_format_e *format);
* @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
* @post This function invokes legacy_camera_supported_preview_format_cb() repeatly to retrieve each supported preview format.
- * @see camera_set_preview_format()
- * @see camera_get_preview_format()
- * @see camera_supported_preview_format_cb()
+ * @see legacy_camera_set_preview_format()
+ * @see legacy_camera_get_preview_format()
+ * @see legacy_camera_supported_preview_format_cb()
*/
int legacy_camera_foreach_supported_preview_format(camera_h camera,
camera_supported_preview_format_cb callback, void *user_data);
* @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
- * @pre The camera's state must be set to #CAMERA_STATE_CREATED.
- * @see camera_start_preview()
+ * @pre The camera's state must be set to #CAMERA_STATE_CREATED.
+ * @see legacy_camera_start_preview()
* @see legacy_camera_unset_preview_cb()
- * @see camera_preview_cb()
+ * @see legacy_camera_preview_cb()
*/
int legacy_camera_set_preview_cb(camera_h camera, camera_preview_cb callback, void *user_data);
* @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
- * @pre The camera's state should be #CAMERA_STATE_CREATED.
- * @see camera_start_preview()
- * @see camera_unset_media_packet_preview_cb()
- * @see camera_media_packet_preview_cb()
+ * @pre The camera's state should be #CAMERA_STATE_CREATED.
+ * @see legacy_camera_start_preview()
+ * @see legacy_camera_unset_media_packet_preview_cb()
+ * @see legacy_camera_media_packet_preview_cb()
*/
int legacy_camera_set_media_packet_preview_cb(camera_h camera, camera_preview_cb callback, void *user_data);
* @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
- * @see camera_set_media_packet_preview_cb()
+ * @see legacy_camera_set_media_packet_preview_cb()
*/
int legacy_camera_unset_media_packet_preview_cb(camera_h camera);
* @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
* @post This function will invoke legacy_camera_state_changed_cb() when the camera state changes.
* @see legacy_camera_unset_state_changed_cb()
- * @see camera_state_changed_cb()
+ * @see legacy_camera_state_changed_cb()
*/
int legacy_camera_set_state_changed_cb(camera_h camera, camera_state_changed_cb callback, void *user_data);
* @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
* @see legacy_camera_unset_interrupted_cb()
- * @see camera_interrupted_cb()
+ * @see legacy_camera_interrupted_cb()
*/
int legacy_camera_set_interrupted_cb(camera_h camera, camera_interrupted_cb callback, void *user_data);
* @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
* @post This function will invoke legacy_camera_focus_changed_cb() when the auto-focus state changes.
- * @see camera_start_focusing()
- * @see camera_cancel_focusing()
- * @see camera_unset_focus_changed_cb()
- * @see camera_focus_changed_cb()
+ * @see legacy_camera_start_focusing()
+ * @see legacy_camera_cancel_focusing()
+ * @see legacy_camera_unset_focus_changed_cb()
+ * @see legacy_camera_focus_changed_cb()
*/
int legacy_camera_set_focus_changed_cb(camera_h camera, camera_focus_changed_cb callback, void *user_data);
* @post This function will invoke legacy_camera_error_cb() when an asynchronous operation error occurs.
* @see legacy_camera_unset_error_cb()
- * @see camera_error_cb()
+ * @see legacy_camera_error_cb()
*/
int legacy_camera_set_error_cb(camera_h camera, camera_error_cb callback, void *user_data);
* @param[in] mode The supported auto-focus mode
* @param[in] user_data The user data passed from the foreach function
* @return @c true to continue with the next iteration of the loop, \n otherwise @c false to break out of the loop
- * @pre camera_attr_foreach_supported_af_mode() will invoke this callback.
- * @see camera_attr_foreach_supported_af_mode()
+ * @pre legacy_camera_attr_foreach_supported_af_mode() will invoke this callback.
+ * @see legacy_camera_attr_foreach_supported_af_mode()
*/
typedef bool (*camera_attr_supported_af_mode_cb)(camera_attr_af_mode_e mode, void *user_data);
* @param[in] mode The supported exposure mode
* @param[in] user_data The user data passed from the foreach function
* @return @c true to continue with the next iteration of the loop, \n otherwise @c false to break out of the loop
- * @pre camera_attr_foreach_supported_exposure_mode() will invoke this callback.
- * @see camera_attr_foreach_supported_exposure_mode()
- * @see #camera_attr_exposure_mode_e
+ * @pre legacy_camera_attr_foreach_supported_exposure_mode() will invoke this callback.
+ * @see legacy_camera_attr_foreach_supported_exposure_mode()
+ * @see #camera_attr_exposure_mode_e
*/
typedef bool (*camera_attr_supported_exposure_mode_cb)(camera_attr_exposure_mode_e mode, void *user_data);
* @param[in] iso The supported ISO mode
* @param[in] user_data The user data passed from the foreach function
* @return @c true to continue with the next iteration of the loop, \n otherwise @c false to break out of the loop
- * @pre camera_attr_foreach_supported_iso() will invoke this callback.
- * @see camera_attr_foreach_supported_iso()
+ * @pre legacy_camera_attr_foreach_supported_iso() will invoke this callback.
+ * @see legacy_camera_attr_foreach_supported_iso()
*/
typedef bool (*camera_attr_supported_iso_cb)(camera_attr_iso_e iso, void *user_data);
* @param[in] wb The supported white balance mode
* @param[in] user_data The user data passed from the foreach function
* @return @c true to continue with the next iteration of the loop, \n otherwise @c false to break out of the loop
- * @pre camera_attr_foreach_supported_whitebalance() will invoke this callback.
- * @see camera_attr_foreach_supported_whitebalance()
- * @see #camera_attr_whitebalance_e
+ * @pre legacy_camera_attr_foreach_supported_whitebalance() will invoke this callback.
+ * @see legacy_camera_attr_foreach_supported_whitebalance()
+ * @see #camera_attr_whitebalance_e
*/
typedef bool (*camera_attr_supported_whitebalance_cb)(camera_attr_whitebalance_e wb, void *user_data);
* @param[in] effect The supported effect mode
* @param[in] user_data The user data passed from the foreach function
* @return @c true to continue with the next iteration of the loop, \n otherwise @c false to break out of the loop
- * @pre camera_attr_foreach_supported_effect() will invoke this callback.
- * @see camera_attr_foreach_supported_effect()
+ * @pre legacy_camera_attr_foreach_supported_effect() will invoke this callback.
+ * @see legacy_camera_attr_foreach_supported_effect()
*/
typedef bool (*camera_attr_supported_effect_cb)(camera_attr_effect_mode_e effect, void *user_data);
* @param[in] mode The supported scene mode
* @param[in] user_data The user data passed from the foreach function
* @return @c true to continue with the next iteration of the loop, \n otherwise @c false to break out of the loop
- * @pre camera_attr_foreach_supported_scene_mode() will invoke this callback.
- * @see camera_attr_foreach_supported_scene_mode()
- * @see #camera_attr_scene_mode_e
+ * @pre legacy_camera_attr_foreach_supported_scene_mode() will invoke this callback.
+ * @see legacy_camera_attr_foreach_supported_scene_mode()
+ * @see #camera_attr_scene_mode_e
*/
typedef bool (*camera_attr_supported_scene_mode_cb)(camera_attr_scene_mode_e mode, void *user_data);
* @param[in] mode The supported flash mode
* @param[in] user_data The user data passed from the foreach function
* @return @c true to continue with the next iteration of the loop, \n otherwise @c false to break out of the loop
- * @pre camera_attr_foreach_supported_flash_mode() will invoke this callback.
- * @see camera_attr_foreach_supported_flash_mode()
+ * @pre legacy_camera_attr_foreach_supported_flash_mode() will invoke this callback.
+ * @see legacy_camera_attr_foreach_supported_flash_mode()
*/
typedef bool (*camera_attr_supported_flash_mode_cb)(camera_attr_flash_mode_e mode, void *user_data);
* @param[in] mode The supported FPS mode
* @param[in] user_data The user data passed from the foreach function
* @return @c true to continue with the next iteration of the loop, \n otherwise @c false to break out of the loop
- * @pre camera_attr_foreach_supported_fps() will invoke this callback.
- * @see camera_attr_foreach_supported_fps()
+ * @pre legacy_camera_attr_foreach_supported_fps() will invoke this callback.
+ * @see legacy_camera_attr_foreach_supported_fps()
*/
typedef bool (*camera_attr_supported_fps_cb)(camera_attr_fps_e fps, void *user_data);
* @param[in] mode The supported stream flip mode
* @param[in] user_data The user data passed from the foreach function
* @return @c true to continue with the next iteration of the loop, \n @c false to break out of the loop
- * @pre camera_attr_foreach_supported_stream_flip() will invoke this callback.
- * @see camera_attr_foreach_supported_stream_flip()
+ * @pre legacy_camera_attr_foreach_supported_stream_flip() will invoke this callback.
+ * @see legacy_camera_attr_foreach_supported_stream_flip()
*/
typedef bool (*camera_attr_supported_stream_flip_cb)(camera_flip_e flip, void *user_data);
* @param[in] mode The supported stream rotation mode
* @param[in] user_data The user data passed from the foreach function
* @return @c true to continue with the next iteration of the loop, \n @c false to break out of the loop
- * @pre camera_attr_foreach_supported_stream_rotation() will invoke this callback.
- * @see camera_attr_foreach_supported_stream_rotation()
+ * @pre legacy_camera_attr_foreach_supported_stream_rotation() will invoke this callback.
+ * @see legacy_camera_attr_foreach_supported_stream_rotation()
*/
typedef bool (*camera_attr_supported_stream_rotation_cb)(camera_rotation_e rotation, void *user_data);
* @param[in] mode The supported theater mode
* @param[in] user_data The user data passed from the foreach function
* @return @c true to continue with the next iteration of the loop, \n @c false to break out of the loop
- * @pre camera_attr_foreach_supported_theater_mode() will invoke this callback.
- * @see camera_attr_foreach_supported_theater_mode()
+ * @pre legacy_camera_attr_foreach_supported_theater_mode() will invoke this callback.
+ * @see legacy_camera_attr_foreach_supported_theater_mode()
*/
typedef bool (*camera_attr_supported_theater_mode_cb)(camera_attr_theater_mode_e mode, void *user_data);
* @param[in] type The supported ptz type
* @param[in] user_data The user data passed from the foreach function
* @return @c true to continue with the next iteration of the loop, \n @c false to break out of the loop
- * @pre camera_attr_foreach_supported_ptz_type() will invoke this callback.
- * @see camera_attr_foreach_supported_ptz_type()
+ * @pre legacy_camera_attr_foreach_supported_ptz_type() will invoke this callback.
+ * @see legacy_camera_attr_foreach_supported_ptz_type()
*/
typedef bool (*camera_attr_supported_ptz_type_cb)(camera_attr_ptz_type_e type, void *user_data);
* @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
* @see legacy_camera_start_preview()
- * @see camera_attr_get_preview_fps()
- * @see camera_attr_foreach_supported_fps()
+ * @see legacy_camera_attr_get_preview_fps()
+ * @see legacy_camera_attr_foreach_supported_fps()
*/
int legacy_camera_attr_set_preview_fps(camera_h camera, camera_attr_fps_e fps);
* @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
- * @see camera_attr_set_preview_fps()
- * @see camera_attr_foreach_supported_fps()
+ * @see legacy_camera_attr_set_preview_fps()
+ * @see legacy_camera_attr_foreach_supported_fps()
*/
int legacy_camera_attr_get_preview_fps(camera_h camera, camera_attr_fps_e *fps);
* @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
* @post This function invokes legacy_camera_attr_supported_fps_cb() repeatly to get each supported FPS mode.
- * @see camera_attr_set_preview_fps()
- * @see camera_attr_get_preview_fps()
- * @see camera_attr_supported_fps_cb()
+ * @see legacy_camera_attr_set_preview_fps()
+ * @see legacy_camera_attr_get_preview_fps()
+ * @see legacy_camera_attr_supported_fps_cb()
*/
int legacy_camera_attr_foreach_supported_fps(camera_h camera, camera_attr_supported_fps_cb callback, void *user_data);
* @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
* @post This function invokes legacy_camera_attr_supported_fps_cb() repeatly to get each supported FPS mode.
- * @see camera_attr_set_preview_fps()
- * @see camera_attr_get_preview_fps()
- * @see camera_attr_supported_fps_cb()
+ * @see legacy_camera_attr_set_preview_fps()
+ * @see legacy_camera_attr_get_preview_fps()
+ * @see legacy_camera_attr_supported_fps_cb()
*/
int legacy_camera_attr_foreach_supported_fps_by_resolution(camera_h camera, int width, int height,
camera_attr_supported_fps_cb callback, void *user_data);
* @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
* @pre The camera state must be set to #CAMERA_STATE_CREATED or #CAMERA_STATE_PREVIEW.
* @see legacy_camera_start_preview()
- * @see camera_attr_get_image_quality()
+ * @see legacy_camera_attr_get_image_quality()
*/
int legacy_camera_attr_set_image_quality(camera_h camera, int quality);
* @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
- * @see camera_attr_get_af_mode()
- * @see camera_attr_foreach_supported_af_mode()
- * @see #camera_attr_af_mode_e
+ * @see legacy_camera_attr_get_af_mode()
+ * @see legacy_camera_attr_foreach_supported_af_mode()
+ * @see #camera_attr_af_mode_e
*/
int legacy_camera_attr_set_af_mode(camera_h camera, camera_attr_af_mode_e mode);
* @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
* @see legacy_camera_attr_foreach_supported_af_mode()
* @see legacy_camera_attr_set_af_mode()
- * @see #camera_attr_af_mode_e
+ * @see #camera_attr_af_mode_e
*/
int legacy_camera_attr_get_af_mode(camera_h camera, camera_attr_af_mode_e *mode);
* @post This function invokes legacy_camera_attr_supported_af_mode_cb() to get all the supported auto focus modes.
* @see legacy_camera_attr_set_af_mode()
* @see legacy_camera_attr_get_af_mode()
- * @see camera_attr_supported_af_mode_cb()
+ * @see legacy_camera_attr_supported_af_mode_cb()
*/
int legacy_camera_attr_foreach_supported_af_mode(camera_h camera, camera_attr_supported_af_mode_cb callback, void *user_data);
* @post This function invokes legacy_camera_attr_supported_exposure_mode_cb() to get all the supported exposure modes.
* @see legacy_camera_attr_set_exposure_mode()
* @see legacy_camera_attr_get_exposure_mode()
- * @see camera_attr_supported_exposure_mode_cb()
+ * @see legacy_camera_attr_supported_exposure_mode_cb()
*/
int legacy_camera_attr_foreach_supported_exposure_mode(camera_h camera, camera_attr_supported_exposure_mode_cb callback, void *user_data);
* @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
- * @see camera_attr_get_exposure()
+ * @see legacy_camera_attr_get_exposure()
*/
int legacy_camera_attr_set_exposure(camera_h camera, int value);
* @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
- * @see camera_attr_set_exposure()
+ * @see legacy_camera_attr_set_exposure()
*/
int legacy_camera_attr_get_exposure(camera_h camera, int *value);
* @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
- * @see camera_attr_set_exposure()
+ * @see legacy_camera_attr_set_exposure()
*/
int legacy_camera_attr_get_exposure_range(camera_h camera, int *min, int *max);
* @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
- * @see camera_attr_get_iso()
+ * @see legacy_camera_attr_get_iso()
* @see legacy_camera_attr_foreach_supported_iso()
*/
int legacy_camera_attr_set_iso(camera_h camera, camera_attr_iso_e iso);
* @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
- * @see camera_attr_set_iso()
+ * @see legacy_camera_attr_set_iso()
* @see legacy_camera_attr_foreach_supported_iso()
*/
int legacy_camera_attr_get_iso(camera_h camera, camera_attr_iso_e *iso);
* @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
* @post This function invokes legacy_camera_attr_supported_iso_cb() to get all the supported ISO levels.
- * @see camera_attr_set_iso()
+ * @see legacy_camera_attr_set_iso()
* @see legacy_camera_attr_get_iso()
- * @see camera_attr_supported_iso_cb()
+ * @see legacy_camera_attr_supported_iso_cb()
*/
int legacy_camera_attr_foreach_supported_iso(camera_h camera, camera_attr_supported_iso_cb callback, void *user_data);
* @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
- * @pre This function is valid only when the external display is connected.
- * @see camera_attr_get_theater_mode()
+ * @pre This function is valid only when the external display is connected.
+ * @see legacy_camera_attr_get_theater_mode()
*/
int legacy_camera_attr_set_theater_mode(camera_h camera, camera_attr_theater_mode_e mode);
* @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
- * @see camera_attr_get_theater_mode()
+ * @see legacy_camera_attr_get_theater_mode()
*/
int legacy_camera_attr_get_theater_mode(camera_h camera, camera_attr_theater_mode_e *mode);
* @post This function invokes legacy_camera_attr_supported_theater_mode_cb() to get all supported theater modes.
* @see legacy_camera_attr_set_theater_mode()
* @see legacy_camera_attr_get_theater_mode()
- * @see camera_attr_supported_theater_mode_cb()
+ * @see legacy_camera_attr_supported_theater_mode_cb()
*/
int legacy_camera_attr_foreach_supported_theater_mode(camera_h camera, camera_attr_supported_theater_mode_cb callback, void *user_data);
* @post This function invokes legacy_camera_attr_supported_whitebalance_cb() to get all the supported white balances.
* @see legacy_camera_attr_set_whitebalance()
* @see legacy_camera_attr_get_whitebalance()
- * @see camera_attr_supported_whitebalance_cb()
+ * @see legacy_camera_attr_supported_whitebalance_cb()
*/
int legacy_camera_attr_foreach_supported_whitebalance(camera_h camera, camera_attr_supported_whitebalance_cb callback, void *user_data);
* @post This function invokes legacy_camera_attr_supported_effect_cb() to get all the supported effect modes.
* @see legacy_camera_attr_set_effect()
* @see legacy_camera_attr_get_effect()
- * @see camera_attr_supported_effect_cb()
+ * @see legacy_camera_attr_supported_effect_cb()
*/
int legacy_camera_attr_foreach_supported_effect(camera_h camera, camera_attr_supported_effect_cb callback, void *user_data);
* @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
- * @see camera_attr_foreach_supported_scene_mode()
+ * @see legacy_camera_attr_foreach_supported_scene_mode()
* @see legacy_camera_attr_set_scene_mode()
*/
int legacy_camera_attr_get_scene_mode(camera_h camera, camera_attr_scene_mode_e *mode);
* @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
* @post This function invokes legacy_camera_attr_supported_scene_mode_cb() to get all the supported scene modes.
- * @see camera_attr_set_scene_mode()
+ * @see legacy_camera_attr_set_scene_mode()
* @see legacy_camera_attr_get_scene_mode()
* @see legacy_camera_attr_supported_scene_mode_cb()
*/
* @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
- * @see camera_attr_get_tag_orientation()
+ * @see legacy_camera_attr_get_tag_orientation()
*/
int legacy_camera_attr_set_tag_orientation(camera_h camera, camera_attr_tag_orientation_e orientation);
* @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
- * @see camera_attr_set_tag_orientation()
+ * @see legacy_camera_attr_set_tag_orientation()
*/
int legacy_camera_attr_get_tag_orientation(camera_h camera, camera_attr_tag_orientation_e *orientation);
* @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
* @retval #CAMERA_ERROR_DEVICE_BUSY The flash was preempted by other API
- * @see camera_attr_foreach_supported_flash_mode()
+ * @see legacy_camera_attr_foreach_supported_flash_mode()
* @see legacy_camera_attr_get_flash_mode()
*/
int legacy_camera_attr_set_flash_mode(camera_h camera, camera_attr_flash_mode_e mode);
* @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
* @post This function invokes legacy_camera_attr_supported_flash_mode_cb() to get all supported flash modes.
- * @see camera_attr_set_flash_mode()
+ * @see legacy_camera_attr_set_flash_mode()
* @see legacy_camera_attr_get_flash_mode()
- * @see camera_attr_supported_flash_mode_cb()
+ * @see legacy_camera_attr_supported_flash_mode_cb()
*/
int legacy_camera_attr_foreach_supported_flash_mode(camera_h camera, camera_attr_supported_flash_mode_cb callback, void *user_data);
* @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
- * @pre The camera state must be set to #CAMERA_STATE_CREATED.
+ * @pre The camera state must be set to #CAMERA_STATE_CREATED.
* @see legacy_camera_attr_get_stream_rotation()
*/
int legacy_camera_attr_set_stream_rotation(camera_h camera , camera_rotation_e rotation);
* @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
- * @pre The camera state must be set to #CAMERA_STATE_CREATED.
+ * @pre The camera state must be set to #CAMERA_STATE_CREATED.
* @see legacy_camera_attr_set_stream_rotation()
*/
int legacy_camera_attr_get_stream_rotation(camera_h camera , camera_rotation_e *rotation);
* @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
- * @pre The camera state must be set to #CAMERA_STATE_CREATED.
+ * @pre The camera state must be set to #CAMERA_STATE_CREATED.
* @see legacy_camera_attr_set_stream_rotation()
*/
int legacy_camera_attr_set_stream_flip(camera_h camera , camera_flip_e flip);
* @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
- * @pre The camera state must be set to #CAMERA_STATE_CREATED.
+ * @pre The camera state must be set to #CAMERA_STATE_CREATED.
* @see legacy_camera_attr_set_stream_rotation()
*/
int legacy_camera_attr_get_stream_flip(camera_h camera , camera_flip_e *flip);
* @retval #CAMERA_ERROR_PERMISSION_DENIED The access to the resources can not be granted
* @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported
* @post This function invokes camera_attr_supported_ptz_type_cb() to get all supported ptz type.
- * @see camera_attr_set_ptz_type()
+ * @see legacy_camera_attr_set_ptz_type()
*/
int legacy_camera_attr_foreach_supported_ptz_type(camera_h camera, camera_attr_supported_ptz_type_cb foreach_cb, void *user_data);
static gboolean __mm_videostream_callback(MMCamcorderVideoStreamDataType *stream, void *user_data);
static gboolean __mm_capture_callback(MMCamcorderCaptureDataType *frame, MMCamcorderCaptureDataType *thumbnail, void *user_data);
-void _camera_remove_cb_message(camera_s *handle)
-{
- int ret = 0;
- GList *list = NULL;
- camera_cb_data *cb_data = NULL;
-
- if (handle == NULL) {
- LOGE("handle is NULL");
- return;
- }
-
- LOGI("start");
-
- g_mutex_lock(&handle->idle_cb_lock);
-
- if (handle->cb_data_list) {
- list = handle->cb_data_list;
-
- while (list) {
- cb_data = list->data;
- list = g_list_next(list);
-
- if (!cb_data) {
- LOGW("cb_data is NULL");
- } else {
- ret = g_idle_remove_by_data(cb_data);
- LOGW("Remove cb_data[%p]. ret[%d]", cb_data, ret);
-
- handle->cb_data_list = g_list_remove(handle->cb_data_list, cb_data);
- free(cb_data);
- cb_data = NULL;
- }
- }
-
- g_list_free(handle->cb_data_list);
- handle->cb_data_list = NULL;
- } else {
- LOGW("There is no remained callback");
- }
-
- g_mutex_unlock(&handle->idle_cb_lock);
-
- LOGI("done");
-
- return;
-}
-
int __convert_camera_error_code(const char *func, int code)
{
return false;
}
-int legacy_camera_create(camera_device_e device, camera_h* camera)
+int legacy_camera_create(camera_device_e device, camera_h *camera)
{
+ int ret = MM_ERROR_NONE;
+ int preview_format = MM_PIXEL_FORMAT_NV12;
+ int rotation = MM_DISPLAY_ROTATION_NONE;
+ camera_s *handle = NULL;
+ char *error = NULL;
+ MMCamPreset info;
+
if (camera == NULL) {
LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
return CAMERA_ERROR_INVALID_PARAMETER;
}
- int ret = MM_ERROR_NONE;;
- MMCamPreset info;
- int preview_format;
- int rotation;
- camera_s *handle = NULL;
- char *error = NULL;
-
- LOGW("device name = [%d]", device);
+ LOGD("device name = [%d]",device);
info.videodev_type = device;
handle->device_type = device;
handle->ptz_type = CAMERA_ATTR_PTZ_TYPE_ELECTRONIC;
- g_mutex_init(&handle->idle_cb_lock);
-
mm_camcorder_set_message_callback(handle->mm_handle,
- __mm_camera_message_callback,
- (void *)handle);
+ __mm_camera_message_callback, (void *)handle);
*camera = (camera_h)handle;
- LOGW("camera handle %p", handle);
+ LOGD("legacy camera handle %p", handle);
+
+ return __convert_camera_error_code(__func__, ret);
+}
+
+
+int legacy_camera_change_device(camera_h *camera, camera_device_e device)
+{
+ int ret = MM_ERROR_NONE;
+ int pid = 0;
+ int size = 0;
+ camera_s *old_handle = NULL;
+ camera_s *new_handle = NULL;
+ camera_state_e capi_state = CAMERA_STATE_NONE;
+ void *reuse_element = NULL;
+
+ if (camera == NULL) {
+ LOGE("NULL handle");
+ return CAMERA_ERROR_INVALID_PARAMETER;
+ }
+
+ if (device < CAMERA_DEVICE_CAMERA0 || device > CAMERA_DEVICE_CAMERA1) {
+ LOGE("invalid device %d", device);
+ return CAMERA_ERROR_INVALID_PARAMETER;
+ }
+
+ old_handle = (camera_s *)*camera;
+
+ if (old_handle->is_used_in_recorder) {
+ LOGE("camera is using in another recorder.");
+ return CAMERA_ERROR_INVALID_OPERATION;
+ }
+
+ if (old_handle->device_type == device) {
+ LOGE("same device. no need to change it.");
+ return CAMERA_ERROR_NONE;
+ }
+
+ /* check current state */
+ legacy_camera_get_state(*camera, &capi_state);
+ if (capi_state != CAMERA_STATE_CREATED) {
+ LOGE("invalid state %d", capi_state);
+ return CAMERA_ERROR_INVALID_STATE;
+ }
+
+ /* get reuse element */
+ ret = mm_camcorder_get_attributes(old_handle->mm_handle, NULL,
+ MMCAM_DISPLAY_REUSE_ELEMENT, &reuse_element, &size,
+ NULL);
+ if (ret != MM_ERROR_NONE) {
+ LOGE("failed to get reuse element 0x%x", ret);
+ return __convert_camera_error_code(__func__, ret);
+ }
+
+ LOGD("reuse element %p", reuse_element);
+
+ /* create new handle */
+ ret = legacy_camera_create(device, (camera_h *)&new_handle);
+ if (ret != CAMERA_ERROR_NONE) {
+ LOGE("failed to create new handle 0x%x", ret);
+ return ret;
+ }
+
+ /* set reuse element in new handle */
+ ret = mm_camcorder_set_attributes(new_handle->mm_handle, NULL,
+ MMCAM_DISPLAY_REUSE_ELEMENT, reuse_element, size,
+ NULL);
+ if (ret != MM_ERROR_NONE) {
+ LOGE("failed to set reuse element 0x%x", ret);
+ goto _CHANGE_DEVICE_FAILED;
+ }
+
+ /* reset reuse element in old handle */
+ ret = mm_camcorder_set_attributes(old_handle->mm_handle, NULL,
+ MMCAM_DISPLAY_REUSE_ELEMENT, NULL, 0,
+ NULL);
+ if (ret != MM_ERROR_NONE) {
+ LOGE("failed to reset reuse element 0x%x", ret);
+ goto _CHANGE_DEVICE_FAILED;
+ }
+
+ /* get pid from old handle */
+ ret = mm_camcorder_get_attributes(old_handle->mm_handle, NULL,
+ MMCAM_PID_FOR_SOUND_FOCUS, &pid,
+ NULL);
+ if (ret != MM_ERROR_NONE) {
+ LOGE("failed to get pid 0x%x", ret);
+ goto _CHANGE_DEVICE_FAILED;
+ }
+
+ LOGD("client pid %d from old handle", pid);
+
+ /* set pid to new handle */
+ ret = mm_camcorder_set_attributes(new_handle->mm_handle, NULL,
+ MMCAM_PID_FOR_SOUND_FOCUS, pid,
+ NULL);
+ if (ret != MM_ERROR_NONE) {
+ LOGE("failed to get pid 0x%x", ret);
+ goto _CHANGE_DEVICE_FAILED;
+ }
+
+ /* set previous display */
+ ret = legacy_camera_set_display(new_handle, old_handle->display_type, old_handle->display_handle);
+ if (ret != MM_ERROR_NONE) {
+ LOGE("legacy_camera_set_display failed0x%x", ret);
+ goto _CHANGE_DEVICE_FAILED;
+ }
+
+ /* release old handle */
+ ret = legacy_camera_destroy((camera_h)old_handle);
+ if (ret != CAMERA_ERROR_NONE) {
+ LOGE("failed to destroy old handle %p 0x%x", old_handle, ret);
+ goto _CHANGE_DEVICE_FAILED;
+ }
+
+ *camera = (camera_h)new_handle;
+
+ LOGD("new handle %p", new_handle);
+
+ return CAMERA_ERROR_NONE;
+
+_CHANGE_DEVICE_FAILED:
+ if (new_handle) {
+ legacy_camera_destroy((camera_h)new_handle);
+ new_handle = NULL;
+ }
+
+ if (reuse_element) {
+ mm_camcorder_set_attributes(old_handle->mm_handle, NULL,
+ MMCAM_DISPLAY_REUSE_ELEMENT, reuse_element, size,
+ NULL);
+ }
return __convert_camera_error_code(__func__, ret);
}
ret = mm_camcorder_destroy(handle->mm_handle);
if (ret == MM_ERROR_NONE) {
- _camera_remove_cb_message(handle);
- g_mutex_clear(&handle->idle_cb_lock);
-
- if (handle->wl_info) {
- free(handle->wl_info);
- handle->wl_info = NULL;
- }
-
free(handle);
}
{
int ret = CAMERA_ERROR_NONE;
camera_s *handle = (camera_s *)camera;
+ camera_state_e capi_state = CAMERA_STATE_NONE;
if (!handle) {
LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
return CAMERA_ERROR_INVALID_PARAMETER;
}
+ legacy_camera_get_state(camera, &capi_state);
+ if (capi_state != CAMERA_STATE_PREVIEW) {
+ LOGE("invalid state %d", capi_state);
+ return CAMERA_ERROR_INVALID_STATE;
+ }
+
ret = mm_camcorder_set_attributes(handle->mm_handle, NULL,
MMCAM_DISPLAY_REUSE_HINT, hint,
NULL);