From 48eeff42b2c3506ed9fb57daf8e9d31ef1c7e1df Mon Sep 17 00:00:00 2001 From: Jeongmo Yang Date: Tue, 8 Aug 2023 19:07:41 +0900 Subject: [PATCH] Add new internal APIs for camera status of AE and AWB - enum : camera_status_auto_exposure_e CAMERA_STATUS_AUTO_EXPOSURE_NONE CAMERA_STATUS_AUTO_EXPOSURE_UNSTABLE CAMERA_STATUS_AUTO_EXPOSURE_STABLE : camera_status_auto_white_balance_e CAMERA_STATUS_AUTO_WHITE_BALANCE_NONE CAMERA_STATUS_AUTO_WHITE_BALANCE_UNSTABLE CAMERA_STATUS_AUTO_WHITE_BALANCE_STABLE - function : int camera_attr_get_preview_frame_status_auto_exposure(camera_h camera, camera_status_auto_exposure_e *status); : int camera_attr_get_preview_frame_status_auto_white_balance(camera_h camera, camera_status_auto_white_balance_e *status); [Version] 0.4.113 [Issue Type] New feature Change-Id: Ic65317db473b3b32e0ea72a63746756bf748824b Signed-off-by: Jeongmo Yang --- include/camera_internal.h | 54 +++++++++++++++++++++++++++++++++++++++- packaging/capi-media-camera.spec | 2 +- src/camera_internal.c | 48 +++++++++++++++++++++++++++++++++++ test/camera_test.c | 14 +++++++++++ 4 files changed, 116 insertions(+), 2 deletions(-) diff --git a/include/camera_internal.h b/include/camera_internal.h index a7ad9e9..b003d3a 100644 --- a/include/camera_internal.h +++ b/include/camera_internal.h @@ -39,6 +39,28 @@ extern "C" { /** * @internal + * @brief Enumeration for the auto exposure status of preview frame. + * @since_tizen 7.0 + */ +typedef enum { + CAMERA_STATUS_AUTO_EXPOSURE_NONE, /**< None */ + CAMERA_STATUS_AUTO_EXPOSURE_UNSTABLE, /**< Unstable */ + CAMERA_STATUS_AUTO_EXPOSURE_STABLE /**< Stable */ +} camera_status_auto_exposure_e; + +/** + * @internal + * @brief Enumeration for the auto white balance status of preview frame. + * @since_tizen 7.0 + */ +typedef enum { + CAMERA_STATUS_AUTO_WHITE_BALANCE_NONE, /**< None */ + CAMERA_STATUS_AUTO_WHITE_BALANCE_UNSTABLE, /**< Unstable */ + CAMERA_STATUS_AUTO_WHITE_BALANCE_STABLE /**< Stable */ +} camera_status_auto_white_balance_e; + +/** + * @internal * @brief The structure type of the frame meta. * @since_tizen 7.0 * @remarks This is available for specific device only. @@ -232,7 +254,7 @@ int camera_attr_get_preview_frame_timestamp(camera_h camera, unsigned long *time /** * @internal - * @brief Gets the frame meta of preview buffer. + * @brief Gets the frame meta of preview frame. * @since_tizen 7.0 * @remarks The function should be called in camera_preview_cb() or camera_media_packet_preview_cb(),\n * otherwise, it will return #CAMERA_ERROR_INVALID_OPERATION. @@ -245,6 +267,36 @@ int camera_attr_get_preview_frame_timestamp(camera_h camera, unsigned long *time */ int camera_attr_get_preview_frame_meta(camera_h camera, camera_frame_meta_s *frame_meta); +/** + * @internal + * @brief Gets the auto exposure status of preview frame. + * @since_tizen 7.0 + * @remarks The function should be called in camera_preview_cb() or camera_media_packet_preview_cb(),\n + * otherwise, it will return #CAMERA_ERROR_INVALID_OPERATION. + * @param[in] camera The handle to the camera + * @param[out] status The auto exposure status of preview frame + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_OPERATION Internal error + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + */ +int camera_attr_get_preview_frame_status_auto_exposure(camera_h camera, camera_status_auto_exposure_e *status); + +/** + * @internal + * @brief Gets the auto white balance status of preview frame. + * @since_tizen 7.0 + * @remarks The function should be called in camera_preview_cb() or camera_media_packet_preview_cb(),\n + * otherwise, it will return #CAMERA_ERROR_INVALID_OPERATION. + * @param[in] camera The handle to the camera + * @param[out] status The auto white balance status of preview frame + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_INVALID_OPERATION Internal error + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + */ +int camera_attr_get_preview_frame_status_auto_white_balance(camera_h camera, camera_status_auto_white_balance_e *status); + /** * @} diff --git a/packaging/capi-media-camera.spec b/packaging/capi-media-camera.spec index 6ac8a90..4d68fad 100644 --- a/packaging/capi-media-camera.spec +++ b/packaging/capi-media-camera.spec @@ -1,6 +1,6 @@ Name: capi-media-camera Summary: A Camera API -Version: 0.4.112 +Version: 0.4.113 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/camera_internal.c b/src/camera_internal.c index 9e624d3..6c42e74 100644 --- a/src/camera_internal.c +++ b/src/camera_internal.c @@ -344,4 +344,52 @@ int camera_attr_get_preview_frame_meta(camera_h camera, camera_frame_meta_s *fra return CAMERA_ERROR_NONE; } + + +int camera_attr_get_preview_frame_status_auto_exposure(camera_h camera, camera_status_auto_exposure_e *status) +{ + camera_cli_s *pc = (camera_cli_s *)camera; + MMCamcorderVideoStreamDataType *stream = NULL; + + if (!pc || !pc->cb_info || !status) { + CAM_LOG_ERROR("NULL pointer %p %p", pc, status); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + stream = pc->cb_info->stream_data; + if (!stream) { + CAM_LOG_ERROR("no stream data, maybe it's not in preview callback"); + return CAMERA_ERROR_INVALID_OPERATION; + } + + *status = stream->status_ae; + + CAM_LOG_DEBUG("status: auto exposure[%d]", *status); + + return CAMERA_ERROR_NONE; +} + + +int camera_attr_get_preview_frame_status_auto_white_balance(camera_h camera, camera_status_auto_white_balance_e *status) +{ + camera_cli_s *pc = (camera_cli_s *)camera; + MMCamcorderVideoStreamDataType *stream = NULL; + + if (!pc || !pc->cb_info || !status) { + CAM_LOG_ERROR("NULL pointer %p %p", pc, status); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + stream = pc->cb_info->stream_data; + if (!stream) { + CAM_LOG_ERROR("no stream data, maybe it's not in preview callback"); + return CAMERA_ERROR_INVALID_OPERATION; + } + + *status = stream->status_awb; + + CAM_LOG_DEBUG("status: auto white balance[%d]", *status); + + return CAMERA_ERROR_NONE; +} //LCOV_EXCL_STOP diff --git a/test/camera_test.c b/test/camera_test.c index c0e3f8c..6744e56 100644 --- a/test/camera_test.c +++ b/test/camera_test.c @@ -465,6 +465,8 @@ static void _camera_preview_cb(camera_preview_data_s *frame, void *user_data) camera_rotation_e rotation = CAMERA_ROTATION_NONE; unsigned long timestamp = 0; camera_frame_meta_s frame_meta = {0, }; + camera_status_auto_exposure_e status_ae = CAMERA_STATUS_AUTO_EXPOSURE_NONE; + camera_status_auto_white_balance_e status_awb = CAMERA_STATUS_AUTO_WHITE_BALANCE_NONE; if (!cam_handle || !frame) { LOGE("NULL param! %p %p", cam_handle, frame); @@ -491,6 +493,18 @@ static void _camera_preview_cb(camera_preview_data_s *frame, void *user_data) LOGW("get preview frame meta timestamp failed[0x%x]", ret); } + ret = camera_attr_get_preview_frame_status_auto_exposure(cam_handle, &status_ae); + if (ret == CAMERA_ERROR_NONE) + LOGD("status: auto exposure[%d]", status_ae); + else + LOGW("get preview frame status auto exposure failed[0x%x]", ret); + + ret = camera_attr_get_preview_frame_status_auto_white_balance(cam_handle, &status_awb); + if (ret == CAMERA_ERROR_NONE) + LOGD("status: auto white balance[%d]", status_awb); + else + LOGW("get preview frame status auto white balance failed[0x%x]", ret); + _camera_print_preview_info(frame, -1); if (g_camera_preview_cb_dump) -- 2.7.4