From: Jeongmo Yang Date: Tue, 8 Aug 2023 10:07:41 +0000 (+0900) Subject: Add new internal APIs for camera status of AE and AWB X-Git-Tag: accepted/tizen/7.0/unified/20230811.173915^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F89%2F296989%2F1;p=platform%2Fcore%2Fapi%2Fcamera.git 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.104 [Issue Type] New feature Change-Id: Ic65317db473b3b32e0ea72a63746756bf748824b Signed-off-by: Jeongmo Yang --- diff --git a/include/camera_internal.h b/include/camera_internal.h index d36328e..20c3c7b 100644 --- a/include/camera_internal.h +++ b/include/camera_internal.h @@ -39,6 +39,29 @@ extern "C" { #define CAMERA_DEVICE_MAX ((CAMERA_DEVICE_CAMERA9 + 1) * 2) + +/** + * @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 camera device list. @@ -295,7 +318,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. @@ -308,6 +331,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 0e65914..7b6564b 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.103 +Version: 0.4.104 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/camera_internal.c b/src/camera_internal.c index ab10efb..e4775cd 100644 --- a/src/camera_internal.c +++ b/src/camera_internal.c @@ -433,4 +433,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 17d8b66..4b1cca4 100644 --- a/test/camera_test.c +++ b/test/camera_test.c @@ -461,6 +461,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) { g_print("\n[PREVIEW_CB] NULL param! %p %p\n", cam_handle, frame); @@ -487,6 +489,18 @@ static void _camera_preview_cb(camera_preview_data_s *frame, void *user_data) g_print("[PREVIEW_CB] get preview frame meta timestamp failed[0x%x]\n", ret); } + ret = camera_attr_get_preview_frame_status_auto_exposure(cam_handle, &status_ae); + if (ret == CAMERA_ERROR_NONE) + g_print("[PREVIEW_CB] status: auto exposure[%d]\n", status_ae); + else + g_print("[PREVIEW_CB] get preview frame status auto exposure failed[0x%x]\n", ret); + + ret = camera_attr_get_preview_frame_status_auto_white_balance(cam_handle, &status_awb); + if (ret == CAMERA_ERROR_NONE) + g_print("[PREVIEW_CB] status: auto white balance[%d]\n", status_awb); + else + g_print("[PREVIEW_CB] get preview frame status auto white balance failed[0x%x]\n", ret); + _camera_print_preview_info(frame); if (g_camera_preview_cb_dump)