From 03d309fccc55868dbce53fd65131069bbc5a0167 Mon Sep 17 00:00:00 2001 From: Jeongmo Yang Date: Tue, 8 Jun 2021 19:52:25 +0900 Subject: [PATCH] Add new interface for extra preview stream format [Version] 0.0.10 [Issue Type] New feature Change-Id: I130b6ca312d792f078224bcfe030d9783cd5756d Signed-off-by: Jeongmo Yang --- include/hal-camera-interface.h | 2 ++ include/hal-camera.h | 31 +++++++++++++++++++++++++++++++ packaging/hal-api-camera.spec | 2 +- src/hal-api-camera.c | 24 ++++++++++++++++++++++++ 4 files changed, 58 insertions(+), 1 deletion(-) diff --git a/include/hal-camera-interface.h b/include/hal-camera-interface.h index d7c1cb5..97b649f 100644 --- a/include/hal-camera-interface.h +++ b/include/hal-camera-interface.h @@ -621,6 +621,8 @@ typedef struct _hal_backend_media_camera_funcs { int (*set_extra_preview_frame_cb)(void *camera_handle, hal_camera_extra_preview_frame_cb callback, void *user_data); int (*unset_extra_preview_frame_cb)(void *camera_handle); int (*release_extra_preview_buffer)(void *camera_handle, int stream_id, int buffer_index); + int (*set_extra_preview_stream_format)(void *camera_handle, int stream_id, camera_format_s *format); + int (*get_extra_preview_stream_format)(void *camera_handle, int stream_id, camera_format_s *format); } hal_backend_camera_funcs; /** diff --git a/include/hal-camera.h b/include/hal-camera.h index c822a81..77a5071 100644 --- a/include/hal-camera.h +++ b/include/hal-camera.h @@ -256,6 +256,37 @@ int hal_camera_release_preview_buffer(void *camera_handle, int buffer_index); */ int hal_camera_stop_preview(void *camera_handle); +/** + * @brief Sets the format of the extra preview stream. + * @since_tizen 6.5 + * @param[in] camera_handle The handle to the camera HAL + * @param[in] stream_id The id of extra preview stream + * @param[in] format The format of the extra preview stream + * @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_DEVICE_NOT_SUPPORTED The feature is not supported + * @pre The camera state must be set to #CAMERA_STATE_OPENED. + * @see hal_camera_get_extra_preview_stream_format() + */ +int hal_camera_set_extra_preview_stream_format(void *camera_handle, int stream_id, camera_format_s *format); + +/** + * @brief Gets the format of the extra preview stream. + * @since_tizen 6.5 + * @param[in] camera_handle The handle to the camera HAL + * @param[in] stream_id The id of extra preview stream + * @param[out] format The format of the extra preview stream + * @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_DEVICE_NOT_SUPPORTED The feature is not supported + * @see hal_camera_set_extra_preview_stream_format() + */ +int hal_camera_get_extra_preview_stream_format(void *camera_handle, int stream_id, camera_format_s *format); + /** * @brief Sets a callback function to be called for extra preview frames. * @since_tizen 6.5 diff --git a/packaging/hal-api-camera.spec b/packaging/hal-api-camera.spec index 57c9672..2d738c2 100644 --- a/packaging/hal-api-camera.spec +++ b/packaging/hal-api-camera.spec @@ -4,7 +4,7 @@ ### main package ######### Name: %{name} Summary: %{name} interface -Version: 0.0.9 +Version: 0.0.10 Release: 0 Group: Development/Libraries License: Apache-2.0 diff --git a/src/hal-api-camera.c b/src/hal-api-camera.c index 7cccd4e..2d69734 100644 --- a/src/hal-api-camera.c +++ b/src/hal-api-camera.c @@ -408,6 +408,30 @@ int hal_camera_stop_record(void *camera_handle) } +int hal_camera_set_extra_preview_stream_format(void *camera_handle, int stream_id, camera_format_s *format) +{ + hal_camera_s *handle = (hal_camera_s *)camera_handle; + + HAL_CAMERA_RETURN_IF_FAILED(handle, CAMERA_ERROR_INVALID_PARAMETER); + HAL_CAMERA_RETURN_IF_FAILED(handle->funcs, CAMERA_ERROR_INVALID_PARAMETER); + HAL_CAMERA_RETURN_IF_FAILED(handle->funcs->set_extra_preview_stream_format, CAMERA_ERROR_NOT_IMPLEMENTED); + + return handle->funcs->set_extra_preview_stream_format(handle->backend, stream_id, format); +} + + +int hal_camera_get_extra_preview_stream_format(void *camera_handle, int stream_id, camera_format_s *format) +{ + hal_camera_s *handle = (hal_camera_s *)camera_handle; + + HAL_CAMERA_RETURN_IF_FAILED(handle, CAMERA_ERROR_INVALID_PARAMETER); + HAL_CAMERA_RETURN_IF_FAILED(handle->funcs, CAMERA_ERROR_INVALID_PARAMETER); + HAL_CAMERA_RETURN_IF_FAILED(handle->funcs->get_extra_preview_stream_format, CAMERA_ERROR_NOT_IMPLEMENTED); + + return handle->funcs->get_extra_preview_stream_format(handle->backend, stream_id, format); +} + + int hal_camera_set_command(void *camera_handle, int64_t command, void *value) { hal_camera_s *handle = (hal_camera_s *)camera_handle; -- 2.34.1