From 6ca68c45a12644e1abb0b2cb62878f35e4747f4e Mon Sep 17 00:00:00 2001 From: Jeongmo Yang Date: Mon, 20 Mar 2023 16:23:40 +0900 Subject: [ACR-1754] Add new APIs for camera settings - New enums in camera_attr_exposure_mode_e : CAMERA_ATTR_EXPOSURE_MODE_SHUTTER_PRIORITY : CAMERA_ATTR_EXPOSURE_MODE_APERTURE_PRIORITY - New functions : int camera_attr_set_gain(camera_h camera, int level); : int camera_attr_get_gain(camera_h camera, int *level); : int camera_attr_get_gain_range(camera_h camera, int *min, int *max); : int camera_attr_get_gain_step(camera_h camera, int *step); : int camera_attr_set_whitebalance_temperature(camera_h camera, int temperature); : int camera_attr_get_whitebalance_temperature(camera_h camera, int *temperature); : int camera_attr_get_whitebalance_temperature_range(camera_h camera, int *min, int *max); : int camera_attr_get_whitebalance_temperature_step(camera_h camera, int *step); : int camera_attr_set_saturation(camera_h camera, int level); : int camera_attr_get_saturation(camera_h camera, int *level); : int camera_attr_get_saturation_range(camera_h camera, int *min, int *max); : int camera_attr_set_sharpness(camera_h camera, int level); : int camera_attr_get_sharpness(camera_h camera, int *level); : int camera_attr_get_sharpness_range(camera_h camera, int *min, int *max); [Version] 0.4.100 [Issue Type] New feature Change-Id: Ib19b5a2ef7923d2b1529bf2a2cb51df1fa6c9eab Signed-off-by: Jeongmo Yang --- include/camera.h | 240 +++++++++++++++++++++++++++- packaging/capi-media-camera.spec | 2 +- src/camera.c | 334 +++++++++++++++++++++++++++++++++++++++ test/camera_test.c | 60 +++++++ 4 files changed, 630 insertions(+), 6 deletions(-) diff --git a/include/camera.h b/include/camera.h index 5f070e0..d9d35b9 100644 --- a/include/camera.h +++ b/include/camera.h @@ -480,11 +480,13 @@ typedef enum { * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ typedef enum { - CAMERA_ATTR_EXPOSURE_MODE_OFF = 0, /**< Off */ - CAMERA_ATTR_EXPOSURE_MODE_ALL, /**< All mode */ - CAMERA_ATTR_EXPOSURE_MODE_CENTER, /**< Center mode */ - CAMERA_ATTR_EXPOSURE_MODE_SPOT, /**< Spot mode */ - CAMERA_ATTR_EXPOSURE_MODE_CUSTOM, /**< Custom mode */ + CAMERA_ATTR_EXPOSURE_MODE_OFF = 0, /**< Off */ + CAMERA_ATTR_EXPOSURE_MODE_ALL, /**< All mode */ + CAMERA_ATTR_EXPOSURE_MODE_CENTER, /**< Center mode */ + CAMERA_ATTR_EXPOSURE_MODE_SPOT, /**< Spot mode */ + CAMERA_ATTR_EXPOSURE_MODE_CUSTOM, /**< Custom mode */ + CAMERA_ATTR_EXPOSURE_MODE_SHUTTER_PRIORITY, /**< Shutter priority mode (Since 7.5) */ + CAMERA_ATTR_EXPOSURE_MODE_APERTURE_PRIORITY /**< Aperture priority mode (Since 7.5) */ } camera_attr_exposure_mode_e; /** @@ -3066,6 +3068,74 @@ int camera_attr_set_iso(camera_h camera, camera_attr_iso_e iso); */ int camera_attr_get_iso(camera_h camera, camera_attr_iso_e *iso); +/** + * @brief Sets the gain level. + * @since_tizen 7.5 + * @param[in] camera The handle to the camera + * @param[in] level The gain level + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_INVALID_STATE Invalid state + * @retval #CAMERA_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected + * @pre The camera state must be set to #CAMERA_STATE_CREATED or #CAMERA_STATE_PREVIEW. + * @see camera_attr_get_gain() + * @see camera_attr_get_gain_range() + * @see camera_attr_get_gain_step() + */ +int camera_attr_set_gain(camera_h camera, int level); + +/** + * @brief Gets the gain level. + * @since_tizen 7.5 + * @param[in] camera The handle to the camera + * @param[out] level The gain level + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected + * @see camera_attr_set_gain() + * @see camera_attr_get_gain_range() + * @see camera_attr_get_gain_step() + */ +int camera_attr_get_gain(camera_h camera, int *level); + +/** + * @brief Gets the available gain level. + * @since_tizen 7.5 + * @remarks If the min value is greater than the max value, it means that this feature is not supported. + * @param[in] camera The handle to the camera + * @param[out] min The minimum gain level + * @param[out] max The maximum gain level + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected + * @see camera_attr_set_gain() + * @see camera_attr_get_gain() + * @see camera_attr_get_gain_step() + */ +int camera_attr_get_gain_range(camera_h camera, int *min, int *max); + +/** + * @brief Gets the gain level step. + * @since_tizen 7.5 + * @param[in] camera The handle to the camera + * @param[out] step The gain level step + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected + * @see camera_attr_set_gain() + * @see camera_attr_get_gain() + * @see camera_attr_get_gain_range() + */ +int camera_attr_get_gain_step(camera_h camera, int *step); + /** * @} */ @@ -3357,6 +3427,166 @@ int camera_attr_set_whitebalance(camera_h camera, camera_attr_whitebalance_e whi */ int camera_attr_get_whitebalance(camera_h camera, camera_attr_whitebalance_e *whitebalance); +/** + * @brief Sets the white balance temperature. + * @since_tizen 7.5 + * @param[in] camera The handle to the camera + * @param[in] temperature The white balance temperature + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected + * @see camera_attr_get_whitebalance_temperature() + * @see camera_attr_get_whitebalance_temperature_range() + * @see camera_attr_get_whitebalance_temperature_step() + */ +int camera_attr_set_whitebalance_temperature(camera_h camera, int temperature); + +/** + * @brief Gets the white balance temperature. + * @since_tizen 7.5 + * @param[in] camera The handle to the camera + * @param[out] temperature The white balance temperature + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected + * @see camera_attr_set_whitebalance_temperature() + * @see camera_attr_get_whitebalance_temperature_range() + * @see camera_attr_get_whitebalance_temperature_step() + */ +int camera_attr_get_whitebalance_temperature(camera_h camera, int *temperature); + +/** + * @brief Gets the available white balance temperature. + * @since_tizen 7.5 + * @remarks If the min value is greater than the max value, it means that this feature is not supported. + * @param[in] camera The handle to the camera + * @param[out] min The minimum white balance temperature + * @param[out] max The maximum white balance temperature + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected + * @see camera_attr_set_whitebalance_temperature() + * @see camera_attr_get_whitebalance_temperature() + * @see camera_attr_get_whitebalance_temperature_step() + */ +int camera_attr_get_whitebalance_temperature_range(camera_h camera, int *min, int *max); + +/** + * @brief Gets the step of white balance temperature. + * @since_tizen 7.5 + * @param[in] camera The handle to the camera + * @param[out] step The step of white balance temperature + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected + * @see camera_attr_set_whitebalance_temperature() + * @see camera_attr_get_whitebalance_temperature() + * @see camera_attr_get_whitebalance_temperature_range() + */ +int camera_attr_get_whitebalance_temperature_step(camera_h camera, int *step); + +/** + * @brief Sets the saturation level. + * @since_tizen 7.5 + * @param[in] camera The handle to the camera + * @param[in] level The saturation level + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected + * @see camera_attr_get_saturation() + * @see camera_attr_get_saturation_range() + */ +int camera_attr_set_saturation(camera_h camera, int level); + +/** + * @brief Gets the saturation level. + * @since_tizen 7.5 + * @param[in] camera The handle to the camera + * @param[out] level The saturation level + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected + * @see camera_attr_set_saturation() + * @see camera_attr_get_saturation_range() + */ +int camera_attr_get_saturation(camera_h camera, int *level); + +/** + * @brief Gets the available saturation level. + * @since_tizen 7.5 + * @remarks If the min value is greater than the max value, it means that this feature is not supported. + * @param[in] camera The handle to the camera + * @param[out] min The minimum saturation level + * @param[out] max The maximum saturation level + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected + * @see camera_attr_set_saturation() + * @see camera_attr_get_saturation() + */ +int camera_attr_get_saturation_range(camera_h camera, int *min, int *max); + +/** + * @brief Sets the sharpness level. + * @since_tizen 7.5 + * @param[in] camera The handle to the camera + * @param[in] level The sharpness level + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected + * @see camera_attr_get_sharpness() + * @see camera_attr_get_sharpness_range() + */ +int camera_attr_set_sharpness(camera_h camera, int level); + +/** + * @brief Gets the sharpness level. + * @since_tizen 7.5 + * @param[in] camera The handle to the camera + * @param[out] level The sharpness level + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected + * @see camera_attr_set_sharpness() + * @see camera_attr_get_sharpness_range() + */ +int camera_attr_get_sharpness(camera_h camera, int *level); + +/** + * @brief Gets the available sharpness level. + * @since_tizen 7.5 + * @remarks If the min value is greater than the max value, it means that this feature is not supported. + * @param[in] camera The handle to the camera + * @param[out] min The minimum sharpness level + * @param[out] max The maximum sharpness level + * @return @c 0 on success, otherwise a negative error value + * @retval #CAMERA_ERROR_NONE Successful + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @retval #CAMERA_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CAMERA_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected + * @see camera_attr_set_sharpness() + * @see camera_attr_get_sharpness() + */ +int camera_attr_get_sharpness_range(camera_h camera, int *min, int *max); + /** * @} */ diff --git a/packaging/capi-media-camera.spec b/packaging/capi-media-camera.spec index cc873fe..8a79716 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.99 +Version: 0.4.100 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/camera.c b/src/camera.c index a0a07e9..121ba32 100644 --- a/src/camera.c +++ b/src/camera.c @@ -4735,6 +4735,27 @@ int camera_attr_set_iso(camera_h camera, camera_attr_iso_e iso) } +int camera_attr_set_gain(camera_h camera, int level) +{ + int ret = CAMERA_ERROR_NONE; + camera_cli_s *pc = (camera_cli_s *)camera; + muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_GAIN; + camera_msg_param param; + + CAMERA_CHECK_HANDLE_RETURN_VAL(pc, CAMERA_ERROR_INVALID_PARAMETER); + + CAM_LOG_INFO("Enter"); + + CAMERA_MSG_PARAM_SET(param, INT, level); + + _camera_msg_send_param1(api, pc->cb_info, &ret, ¶m, CAMERA_CB_TIMEOUT); + + CAM_LOG_INFO("ret : 0x%x", ret); + + return ret; +} + + int camera_attr_set_brightness(camera_h camera, int level) { int ret = CAMERA_ERROR_NONE; @@ -4798,6 +4819,48 @@ int camera_attr_set_hue(camera_h camera, int level) } +int camera_attr_set_saturation(camera_h camera, int level) +{ + int ret = CAMERA_ERROR_NONE; + camera_cli_s *pc = (camera_cli_s *)camera; + muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_SATURATION; + camera_msg_param param; + + CAMERA_CHECK_HANDLE_RETURN_VAL(pc, CAMERA_ERROR_INVALID_PARAMETER); + + CAM_LOG_INFO("Enter"); + + CAMERA_MSG_PARAM_SET(param, INT, level); + + _camera_msg_send_param1(api, pc->cb_info, &ret, ¶m, CAMERA_CB_TIMEOUT); + + CAM_LOG_INFO("ret : 0x%x", ret); + + return ret; +} + + +int camera_attr_set_sharpness(camera_h camera, int level) +{ + int ret = CAMERA_ERROR_NONE; + camera_cli_s *pc = (camera_cli_s *)camera; + muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_SHARPNESS; + camera_msg_param param; + + CAMERA_CHECK_HANDLE_RETURN_VAL(pc, CAMERA_ERROR_INVALID_PARAMETER); + + CAM_LOG_INFO("Enter"); + + CAMERA_MSG_PARAM_SET(param, INT, level); + + _camera_msg_send_param1(api, pc->cb_info, &ret, ¶m, CAMERA_CB_TIMEOUT); + + CAM_LOG_INFO("ret : 0x%x", ret); + + return ret; +} + + int camera_attr_set_whitebalance(camera_h camera, camera_attr_whitebalance_e wb) { int ret = CAMERA_ERROR_NONE; @@ -4820,6 +4883,27 @@ int camera_attr_set_whitebalance(camera_h camera, camera_attr_whitebalance_e wb) } +int camera_attr_set_whitebalance_temperature(camera_h camera, int temperature) +{ + int ret = CAMERA_ERROR_NONE; + camera_cli_s *pc = (camera_cli_s *)camera; + muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_WHITEBALANCE_TEMPERATURE; + camera_msg_param param; + + CAMERA_CHECK_HANDLE_RETURN_VAL(pc, CAMERA_ERROR_INVALID_PARAMETER); + + CAM_LOG_INFO("Enter"); + + CAMERA_MSG_PARAM_SET(param, INT, temperature); + + _camera_msg_send_param1(api, pc->cb_info, &ret, ¶m, CAMERA_CB_TIMEOUT); + + CAM_LOG_INFO("ret : 0x%x", ret); + + return ret; +} + + int camera_attr_set_effect(camera_h camera, camera_attr_effect_mode_e effect) { int ret = CAMERA_ERROR_NONE; @@ -5146,6 +5230,80 @@ int camera_attr_get_iso(camera_h camera, camera_attr_iso_e *iso) } +int camera_attr_get_gain(camera_h camera, int *level) +{ + int ret = CAMERA_ERROR_NONE; + camera_cli_s *pc = (camera_cli_s *)camera; + muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_GAIN; + + if (!pc || !pc->cb_info || !level) { + CAM_LOG_ERROR("NULL pointer %p %p", pc, level); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + CAM_LOG_INFO("Enter"); + + _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT); + + if (ret == CAMERA_ERROR_NONE) + *level = pc->cb_info->get_int[MUSE_CAMERA_GET_INT_GAIN]; + + CAM_LOG_INFO("ret : 0x%x", ret); + + return ret; +} + + +int camera_attr_get_gain_range(camera_h camera, int *min, int *max) +{ + int ret = CAMERA_ERROR_NONE; + camera_cli_s *pc = (camera_cli_s *)camera; + muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_GAIN_RANGE; + + if (!pc || !pc->cb_info || !min || !max) { + CAM_LOG_ERROR("NULL pointer %p %p %p", pc, min, max); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + CAM_LOG_INFO("Enter"); + + _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT); + + if (ret == CAMERA_ERROR_NONE) { + *min = pc->cb_info->get_int_pair[MUSE_CAMERA_GET_INT_PAIR_GAIN_RANGE][0]; + *max = pc->cb_info->get_int_pair[MUSE_CAMERA_GET_INT_PAIR_GAIN_RANGE][1]; + } + + CAM_LOG_INFO("ret : 0x%x", ret); + + return ret; +} + + +int camera_attr_get_gain_step(camera_h camera, int *step) +{ + int ret = CAMERA_ERROR_NONE; + camera_cli_s *pc = (camera_cli_s *)camera; + muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_GAIN_STEP; + + if (!pc || !pc->cb_info || !step) { + CAM_LOG_ERROR("NULL pointer %p %p", pc, step); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + CAM_LOG_INFO("Enter"); + + _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT); + + if (ret == CAMERA_ERROR_NONE) + *step = pc->cb_info->get_int[MUSE_CAMERA_GET_INT_GAIN_STEP]; + + CAM_LOG_INFO("ret : 0x%x", ret); + + return ret; +} + + int camera_attr_get_brightness(camera_h camera, int *level) { int ret = CAMERA_ERROR_NONE; @@ -5298,6 +5456,108 @@ int camera_attr_get_hue_range(camera_h camera, int *min, int *max) } +int camera_attr_get_saturation(camera_h camera, int *level) +{ + int ret = CAMERA_ERROR_NONE; + camera_cli_s *pc = (camera_cli_s *)camera; + muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_SATURATION; + + if (!pc || !pc->cb_info || !level) { + CAM_LOG_ERROR("NULL pointer %p %p", pc, level); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + CAM_LOG_INFO("Enter"); + + _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT); + + if (ret == CAMERA_ERROR_NONE) + *level = pc->cb_info->get_int[MUSE_CAMERA_GET_INT_SATURATION]; + + CAM_LOG_INFO("ret : 0x%x", ret); + + return ret; +} + + +int camera_attr_get_saturation_range(camera_h camera, int *min, int *max) +{ + int ret = CAMERA_ERROR_NONE; + camera_cli_s *pc = (camera_cli_s *)camera; + muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_SATURATION_RANGE; + + if (!pc || !pc->cb_info || !min || !max) { + CAM_LOG_ERROR("NULL pointer %p %p %p", pc, min, max); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + CAM_LOG_INFO("Enter"); + + _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT); + + if (ret == CAMERA_ERROR_NONE) { + *min = pc->cb_info->get_int_pair[MUSE_CAMERA_GET_INT_PAIR_SATURATION_RANGE][0]; + *max = pc->cb_info->get_int_pair[MUSE_CAMERA_GET_INT_PAIR_SATURATION_RANGE][1]; + CAM_LOG_INFO("min %d, max %d", *min, *max); + } + + CAM_LOG_INFO("ret : 0x%x", ret); + + return ret; +} + + +int camera_attr_get_sharpness(camera_h camera, int *level) +{ + int ret = CAMERA_ERROR_NONE; + camera_cli_s *pc = (camera_cli_s *)camera; + muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_SHARPNESS; + + if (!pc || !pc->cb_info || !level) { + CAM_LOG_ERROR("NULL pointer %p %p", pc, level); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + CAM_LOG_INFO("Enter"); + + _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT); + + if (ret == CAMERA_ERROR_NONE) + *level = pc->cb_info->get_int[MUSE_CAMERA_GET_INT_SHARPNESS]; + + CAM_LOG_INFO("ret : 0x%x", ret); + + return ret; +} + + +int camera_attr_get_sharpness_range(camera_h camera, int *min, int *max) +{ + int ret = CAMERA_ERROR_NONE; + camera_cli_s *pc = (camera_cli_s *)camera; + muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_SHARPNESS_RANGE; + + if (!pc || !pc->cb_info || !min || !max) { + CAM_LOG_ERROR("NULL pointer %p %p %p", pc, min, max); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + CAM_LOG_INFO("Enter"); + + _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT); + + if (ret == CAMERA_ERROR_NONE) { + *min = pc->cb_info->get_int_pair[MUSE_CAMERA_GET_INT_PAIR_SHARPNESS_RANGE][0]; + *max = pc->cb_info->get_int_pair[MUSE_CAMERA_GET_INT_PAIR_SHARPNESS_RANGE][1]; + CAM_LOG_INFO("min %d, max %d", *min, *max); + } + + CAM_LOG_INFO("ret : 0x%x", ret); + + return ret; +} + + int camera_attr_get_whitebalance(camera_h camera, camera_attr_whitebalance_e *wb) { int ret = CAMERA_ERROR_NONE; @@ -5322,6 +5582,80 @@ int camera_attr_get_whitebalance(camera_h camera, camera_attr_whitebalance_e *wb } +int camera_attr_get_whitebalance_temperature(camera_h camera, int *temperature) +{ + int ret = CAMERA_ERROR_NONE; + camera_cli_s *pc = (camera_cli_s *)camera; + muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_WHITEBALANCE_TEMPERATURE; + + if (!pc || !pc->cb_info || !temperature) { + CAM_LOG_ERROR("NULL pointer %p %p", pc, temperature); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + CAM_LOG_INFO("Enter"); + + _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT); + + if (ret == CAMERA_ERROR_NONE) + *temperature = pc->cb_info->get_int[MUSE_CAMERA_GET_INT_WHITE_BALANCE_TEMPERATURE]; + + CAM_LOG_INFO("ret : 0x%x", ret); + + return ret; +} + + +int camera_attr_get_whitebalance_temperature_range(camera_h camera, int *min, int *max) +{ + int ret = CAMERA_ERROR_NONE; + camera_cli_s *pc = (camera_cli_s *)camera; + muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_WHITEBALANCE_TEMPERATURE_RANGE; + + if (!pc || !pc->cb_info || !min || !max) { + CAM_LOG_ERROR("NULL pointer %p %p %p", pc, min, max); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + CAM_LOG_INFO("Enter"); + + _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT); + + if (ret == CAMERA_ERROR_NONE) { + *min = pc->cb_info->get_int_pair[MUSE_CAMERA_GET_INT_PAIR_WHITE_BALANCE_TEMPERATURE_RANGE][0]; + *max = pc->cb_info->get_int_pair[MUSE_CAMERA_GET_INT_PAIR_WHITE_BALANCE_TEMPERATURE_RANGE][1]; + } + + CAM_LOG_INFO("ret : 0x%x", ret); + + return ret; +} + + +int camera_attr_get_whitebalance_temperature_step(camera_h camera, int *step) +{ + int ret = CAMERA_ERROR_NONE; + camera_cli_s *pc = (camera_cli_s *)camera; + muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_WHITEBALANCE_TEMPERATURE_STEP; + + if (!pc || !pc->cb_info || !step) { + CAM_LOG_ERROR("NULL pointer %p %p", pc, step); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + CAM_LOG_INFO("Enter"); + + _camera_msg_send(api, NULL, pc->cb_info, &ret, CAMERA_CB_TIMEOUT); + + if (ret == CAMERA_ERROR_NONE) + *step = pc->cb_info->get_int[MUSE_CAMERA_GET_INT_WHITE_BALANCE_TEMPERATURE_STEP]; + + CAM_LOG_INFO("ret : 0x%x", ret); + + return ret; +} + + int camera_attr_get_effect(camera_h camera, camera_attr_effect_mode_e *effect) { int ret = CAMERA_ERROR_NONE; diff --git a/test/camera_test.c b/test/camera_test.c index bf60c7a..3b6c50b 100644 --- a/test/camera_test.c +++ b/test/camera_test.c @@ -840,7 +840,11 @@ void print_menu() g_print("\t 'g' Brightness \n"); g_print("\t 'c' Contrast \n"); g_print("\t 'h' Hue \n"); + g_print("\t 'a' Saturation \n"); + g_print("\t 'A' Sharpness \n"); + g_print("\t 'q' Gain \n"); g_print("\t 'w' White balance \n"); + g_print("\t 'W' White balance temperature \n"); g_print("\t 't' Color tone \n"); g_print("\t 'd' WDR \n"); g_print("\t 'e' EV program mode \n"); @@ -1000,6 +1004,7 @@ static void setting_menu(gchar buf) int fps; int bitrate; int interval; + int step = 0; switch (buf) { /* Camera setting */ @@ -1387,6 +1392,46 @@ static void setting_menu(gchar buf) g_print("\n Hue is not supported (%d,%d)\n", min, max); } break; + case 'a': /* Setting > Saturation */ + g_print("*Saturation !\n"); + camera_attr_get_saturation_range(hcamcorder->camera, &min, &max); + if (max >= min) { + camera_attr_get_saturation(hcamcorder->camera, &idx); + g_print("\n Select Saturation min(%d)-max(%d)(current:%d) > ", min, max, idx); + err = scanf("%d", &idx); + flush_stdin(); + bret = camera_attr_set_saturation(hcamcorder->camera, idx); + } else { + g_print("\n Saturation is not supported\n"); + } + break; + case 'A': /* Setting > Sharpness */ + g_print("*Sharpness !\n"); + camera_attr_get_sharpness_range(hcamcorder->camera, &min, &max); + if (max >= min) { + camera_attr_get_sharpness(hcamcorder->camera, &idx); + g_print("\n Select Sharpness min(%d)-max(%d)(current:%d) > ", min, max, idx); + err = scanf("%d", &idx); + flush_stdin(); + bret = camera_attr_set_sharpness(hcamcorder->camera, idx); + } else { + g_print("\n Sharpness is not supported\n"); + } + break; + case 'q': /* Setting > Gain */ + g_print("*Gain !\n"); + camera_attr_get_gain_range(hcamcorder->camera, &min, &max); + if (max >= min) { + camera_attr_get_gain(hcamcorder->camera, &idx); + camera_attr_get_gain_step(hcamcorder->camera, &step); + g_print("\n Select Gain min(%d)-max(%d)(current:%d,step:%d) > ", min, max, idx, step); + err = scanf("%d", &idx); + flush_stdin(); + bret = camera_attr_set_gain(hcamcorder->camera, idx); + } else { + g_print("\n Gain is not supported\n"); + } + break; case 'w': /* Setting > White balance */ g_print("*White balance !\n"); g_print("\n Select White balance \n"); @@ -1395,6 +1440,21 @@ static void setting_menu(gchar buf) flush_stdin(); bret = camera_attr_set_whitebalance(hcamcorder->camera, idx); break; + case 'W': /* Setting > White balance temperature */ + g_print("*White balance temperature !\n"); + camera_attr_get_whitebalance_temperature_range(hcamcorder->camera, &min, &max); + if (max >= min) { + camera_attr_get_whitebalance_temperature(hcamcorder->camera, &idx); + camera_attr_get_whitebalance_temperature_step(hcamcorder->camera, &step); + g_print("\n Select White balance temperature min(%d)-max(%d)(current:%d,step:%d) > ", + min, max, idx, step); + err = scanf("%d", &idx); + flush_stdin(); + bret = camera_attr_set_whitebalance_temperature(hcamcorder->camera, idx); + } else { + g_print("\n White balance temperature is not supported\n"); + } + break; case 't': /* Setting > Color tone */ g_print("*Color tone !\n"); camera_attr_foreach_supported_effect(hcamcorder->camera, colortone_cb, NULL); -- cgit v1.2.3