diff options
author | Jeongmo Yang <jm80.yang@samsung.com> | 2021-09-02 15:23:00 +0900 |
---|---|---|
committer | Jeongmo Yang <jm80.yang@samsung.com> | 2021-09-02 15:23:00 +0900 |
commit | 8820038e44be630697951e09e4ed5f756fe795e0 (patch) | |
tree | 60538147d14ccb42ebcafcee036a2fd1c09c7008 | |
parent | 9ab915fa917ada0d150a1fa221537eb8c7f3ea5f (diff) | |
download | camera-accepted/tizen/unified/20210906.123742.tar.gz camera-accepted/tizen/unified/20210906.123742.tar.bz2 camera-accepted/tizen/unified/20210906.123742.zip |
Add new internal APIs for extra preview bitratesubmit/tizen/20210903.031152accepted/tizen/unified/20210906.123742
[Version] 0.4.62
[Issue Type] New feature
Change-Id: I1f7490b88b6d432c28b004bc452ead1489a545d2
Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
-rw-r--r-- | include/camera_internal.h | 32 | ||||
-rw-r--r-- | packaging/capi-media-camera.spec | 2 | ||||
-rw-r--r-- | src/camera_internal.c | 57 | ||||
-rw-r--r-- | test/camera_test.c | 25 |
4 files changed, 115 insertions, 1 deletions
diff --git a/include/camera_internal.h b/include/camera_internal.h index 923000d..68efb85 100644 --- a/include/camera_internal.h +++ b/include/camera_internal.h @@ -478,6 +478,38 @@ int camera_attr_get_focus_level(camera_h camera, int *level); int camera_attr_get_focus_level_range(camera_h camera, int *min, int *max); /** + * @brief Sets the bitrate of extra preview. + * @since_tizen 6.5 + * @param[in] camera The handle to the camera + * @param[in] stream_id The id of extra preview stream + * @param[in] bitrate The bitrate(bps) of extra preview + * @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 + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @retval #CAMERA_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected + * @see camera_attr_get_extra_preview_bitrate() + */ +int camera_attr_set_extra_preview_bitrate(camera_h camera, int stream_id, int bitrate); + +/** + * @brief Gets the bitrate of extra preview. + * @since_tizen 6.5 + * @param[in] camera The handle to the camera + * @param[in] stream_id The id of extra preview stream + * @param[out] bitrate The bitrate(bps) of extra preview stream + * @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 + * @retval #CAMERA_ERROR_NOT_SUPPORTED The feature is not supported + * @retval #CAMERA_ERROR_SERVICE_DISCONNECTED The socket to multimedia server is disconnected + * @see camera_attr_set_extra_preview_bitrate() + */ +int camera_attr_get_extra_preview_bitrate(camera_h camera, int stream_id, int *bitrate); + +/** * @} */ #ifdef __cplusplus diff --git a/packaging/capi-media-camera.spec b/packaging/capi-media-camera.spec index dd6b891..98c2018 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.61 +Version: 0.4.62 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/camera_internal.c b/src/camera_internal.c index 71db289..dda4c16 100644 --- a/src/camera_internal.c +++ b/src/camera_internal.c @@ -660,4 +660,61 @@ int camera_get_extra_preview_stream_format(camera_h camera, int stream_id, camer return ret; } + + +int camera_attr_set_extra_preview_bitrate(camera_h camera, int stream_id, int bitrate) +{ + int ret = CAMERA_ERROR_NONE; + camera_cli_s *pc = (camera_cli_s *)camera; + muse_camera_api_e api = MUSE_CAMERA_API_ATTR_SET_EXTRA_PREVIEW_BITRATE; + camera_msg_param param0; + camera_msg_param param1; + + if (!pc || !pc->cb_info) { + CAM_LOG_ERROR("NULL handle"); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + CAM_LOG_INFO("Enter - stream_id[%d], bitrate[%d]", stream_id, bitrate); + + CAMERA_MSG_PARAM_SET(param0, INT, stream_id); + CAMERA_MSG_PARAM_SET(param1, INT, bitrate); + + _camera_msg_send_param2_int(api, pc->cb_info, &ret, + ¶m0, ¶m1, CAMERA_CB_TIMEOUT); + + CAM_LOG_INFO("ret : 0x%x", ret); + + return ret; +} + + +int camera_attr_get_extra_preview_bitrate(camera_h camera, int stream_id, int *bitrate) +{ + int ret = CAMERA_ERROR_NONE; + camera_cli_s *pc = (camera_cli_s *)camera; + muse_camera_api_e api = MUSE_CAMERA_API_ATTR_GET_EXTRA_PREVIEW_BITRATE; + camera_msg_param param; + + if (!pc || !pc->cb_info || !bitrate) { + CAM_LOG_ERROR("NULL pointer %p %p", pc, bitrate); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + CAM_LOG_INFO("Enter - stream_id[%d]", stream_id); + + CAMERA_MSG_PARAM_SET(param, INT, stream_id); + + _camera_msg_send_param1(api, pc->cb_info, &ret, ¶m, CAMERA_CB_TIMEOUT); + + if (ret == CAMERA_ERROR_NONE) { + *bitrate = pc->cb_info->get_int[MUSE_CAMERA_GET_INT_EXTRA_PREVIEW_BITRATE]; + CAM_LOG_INFO("get bitrate[%d] for stream[%d]", *bitrate, stream_id); + } else { + CAM_LOG_ERROR("get bitrate failed for stream[%d] : 0x%x", stream_id, ret); + } + + return ret; +} + //LCOV_EXCL_STOP diff --git a/test/camera_test.c b/test/camera_test.c index a84daf1..99dd4e5 100644 --- a/test/camera_test.c +++ b/test/camera_test.c @@ -926,6 +926,7 @@ static void print_menu() g_print("\t 'E' EXIF orientation \n"); g_print("\t 'F' Get facing direction of camera module\n"); g_print("\t 's' Extra preview stream format\n"); + g_print("\t 'B' Extra preview bitrate\n"); g_print("\t >>>>>>>>>>>>>>>>>>>> [Display/Filter]\n"); g_print("\t 'v' Visible \n"); g_print("\t 'o' Output mode \n"); @@ -1096,6 +1097,7 @@ static void setting_menu(gchar buf) int stream_id; int pixel_format; int fps; + int bitrate; switch (buf) { /* Camera setting */ @@ -1341,6 +1343,29 @@ static void setting_menu(gchar buf) g_print("\tGet stream_id[%d],pixel format[%d],res[%dx%d],fps[%d]\n", stream_id, pixel_format, width, height, fps); break; + case 'B': /* Setting > Set extra preview bitrate */ + g_print("* Set extra preview bitrate\n"); + + g_print("\tstream_id,bitrate : "); + err = scanf("%d,%d", &stream_id, &bitrate); + flush_stdin(); + + err = camera_attr_set_extra_preview_bitrate(hcamcorder->camera, stream_id, bitrate); + if (err != CAMERA_ERROR_NONE) { + g_print("* Set Error : 0x%x\n", err); + break; + } + + bitrate = -1; + + err = camera_attr_get_extra_preview_bitrate(hcamcorder->camera, stream_id, &bitrate); + if (err != CAMERA_ERROR_NONE) { + g_print("* Get Error : 0x%x\n", err); + break; + } + + g_print("\tGet stream_id[%d],bitrate[%d]\n", stream_id, bitrate); + break; /* Display / Filter setting */ case 'v': /* Display visible */ g_print("* Display visible setting !\n"); |