Add new internal APIs for camera status of AE and AWB 89/296989/1 accepted/tizen/7.0/unified/20230811.173915
authorJeongmo Yang <jm80.yang@samsung.com>
Tue, 8 Aug 2023 10:07:41 +0000 (19:07 +0900)
committerJeongmo Yang <jm80.yang@samsung.com>
Tue, 8 Aug 2023 10:09:45 +0000 (19:09 +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.104
[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 d36328e..20c3c7b 100644 (file)
@@ -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);
+
 
 /**
  * @}
index 0e65914..7b6564b 100644 (file)
@@ -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
index ab10efb..e4775cd 100644 (file)
@@ -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
index 17d8b66..4b1cca4 100644 (file)
@@ -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)