Add new interface for extra preview stream format 68/259468/2 accepted/tizen/unified/20210621.123148 submit/tizen/20210618.081505
authorJeongmo Yang <jm80.yang@samsung.com>
Tue, 8 Jun 2021 10:52:25 +0000 (19:52 +0900)
committerJeongmo Yang <jm80.yang@samsung.com>
Tue, 8 Jun 2021 10:53:46 +0000 (19:53 +0900)
[Version] 0.0.10
[Issue Type] New feature

Change-Id: I130b6ca312d792f078224bcfe030d9783cd5756d
Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
include/hal-camera-interface.h
include/hal-camera.h
packaging/hal-api-camera.spec
src/hal-api-camera.c

index d7c1cb5de321c6e7fc5a991decfa4d25da66f794..97b649f45e8452344be657ba3f1831cf35597e65 100644 (file)
@@ -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;
 
 /**
index c822a8174d9b0806dee3213d582e6c6d256db04f..77a507118e87dd82ec324cffd069abd4923a26b0 100644 (file)
@@ -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
index 57c96724778cfdccf38381dac6ca4058759e2077..2d738c2b7aa335bc6f5bbf402ddf5741fddbf05a 100644 (file)
@@ -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
index 7cccd4e7110af03731e1cdc876446ae04c26637c..2d69734ac2eb071299099c314653efbd7b1b634e 100644 (file)
@@ -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;