Add new internal APIs for camera status of AE and AWB 78/297078/1 accepted/tizen/unified/20230814.165032
authorJeongmo Yang <jm80.yang@samsung.com>
Tue, 8 Aug 2023 10:07:41 +0000 (19:07 +0900)
committerJeongmo Yang <jm80.yang@samsung.com>
Thu, 10 Aug 2023 03:10:35 +0000 (12:10 +0900)
- 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 <jm80.yang@samsung.com>
include/camera_internal.h
packaging/capi-media-camera.spec
src/camera_internal.c
test/camera_test.c

index a7ad9e929741f6912c5afbb2142b5a0161a1ce1f..b003d3a63d6220949ecc443b5c4a31d6d766c5f1 100644 (file)
@@ -37,6 +37,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.
@@ -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);
+
 
 /**
  * @}
index 6ac8a9059728b593c9bcf0772878d0e103ecdf66..4d68fada8559c9d9ac0d835d1bb36c7dba75ba75 100644 (file)
@@ -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
index 9e624d3b6168e224bea6fbe88548201aaaa4f460..6c42e74252ef102bfffd3a3db4a7b2669cac1552 100644 (file)
@@ -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
index c0e3f8cf3299ff6e2704baf13bd9d8a329b316b7..6744e561e77b119abd3a8cafb920403bd1d289f1 100644 (file)
@@ -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)