diff options
author | Jeongmo Yang <jm80.yang@samsung.com> | 2021-09-08 21:56:13 +0900 |
---|---|---|
committer | Jeongmo Yang <jm80.yang@samsung.com> | 2021-09-15 16:14:19 +0900 |
commit | b664247d48bd43850de60124aa0ebfd5419ddd27 (patch) | |
tree | a5f6d3031a78382f9ea4dadf2d8b97a01566cd65 | |
parent | 8820038e44be630697951e09e4ed5f756fe795e0 (diff) | |
download | camera-b664247d48bd43850de60124aa0ebfd5419ddd27.tar.gz camera-b664247d48bd43850de60124aa0ebfd5419ddd27.tar.bz2 camera-b664247d48bd43850de60124aa0ebfd5419ddd27.zip |
Add new internal APIs for extra preview GOP intervaltizen_6.5.m2_releasesubmit/tizen_6.5/20211028.161701submit/tizen/20210915.115302accepted/tizen/unified/20210916.014246accepted/tizen/6.5/unified/20211028.094459
[Version] 0.4.63
[Issue Type] New feature
Change-Id: I89999a855ae63f405fb5a6bd12b36b96b1c798a8
Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
-rw-r--r-- | include/camera_internal.h | 38 | ||||
-rw-r--r-- | packaging/capi-media-camera.spec | 2 | ||||
-rw-r--r-- | src/camera_internal.c | 64 | ||||
-rw-r--r-- | test/camera_test.c | 53 |
4 files changed, 149 insertions, 8 deletions
diff --git a/include/camera_internal.h b/include/camera_internal.h index 68efb85..b14a8d9 100644 --- a/include/camera_internal.h +++ b/include/camera_internal.h @@ -478,6 +478,7 @@ 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); /** + * @internal * @brief Sets the bitrate of extra preview. * @since_tizen 6.5 * @param[in] camera The handle to the camera @@ -494,6 +495,7 @@ int camera_attr_get_focus_level_range(camera_h camera, int *min, int *max); int camera_attr_set_extra_preview_bitrate(camera_h camera, int stream_id, int bitrate); /** + * @internal * @brief Gets the bitrate of extra preview. * @since_tizen 6.5 * @param[in] camera The handle to the camera @@ -510,6 +512,42 @@ int camera_attr_set_extra_preview_bitrate(camera_h camera, int stream_id, int bi int camera_attr_get_extra_preview_bitrate(camera_h camera, int stream_id, int *bitrate); /** + * @internal + * @brief Sets the GOP (Group Of Pictures) interval of extra preview. + * @since_tizen 6.5 + * @remarks The recommended range is from 1,000 (1 second) to 600,000 (10 minutes). \n + * But, due to codec limitations, it may not apply. + * @param[in] camera The handle to the camera + * @param[in] stream_id The id of extra preview stream + * @param[in] interval The GOP interval of extra preview (millisecond) + * @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_gop_interval() + */ +int camera_attr_set_extra_preview_gop_interval(camera_h camera, int stream_id, int interval); + +/** + * @internal + * @brief Gets the GOP (Group Of Pictures) interval 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] interval The GOP interval of extra preview (millisecond) + * @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_gop_interval() + */ +int camera_attr_get_extra_preview_gop_interval(camera_h camera, int stream_id, int *interval); + +/** * @} */ #ifdef __cplusplus diff --git a/packaging/capi-media-camera.spec b/packaging/capi-media-camera.spec index 98c2018..6e88cae 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.62 +Version: 0.4.63 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/camera_internal.c b/src/camera_internal.c index dda4c16..f84ecea 100644 --- a/src/camera_internal.c +++ b/src/camera_internal.c @@ -594,7 +594,7 @@ int camera_set_extra_preview_stream_format(camera_h camera, int stream_id, camer return CAMERA_ERROR_INVALID_PARAMETER; } - CAM_LOG_INFO("Enter - stream_id[%d],[%d,%dx%d,%d]", + CAM_LOG_INFO("Enter - stream[%d],[%d,%dx%d,%d]", stream_id, pixel_format, width, height, fps); msg = muse_core_msg_new(api, @@ -643,7 +643,7 @@ int camera_get_extra_preview_stream_format(camera_h camera, int stream_id, camer return CAMERA_ERROR_INVALID_PARAMETER; } - CAM_LOG_INFO("Enter - stream_id[%d]", stream_id); + CAM_LOG_INFO("Enter - stream[%d]", stream_id); CAMERA_MSG_PARAM_SET(param, INT, stream_id); @@ -675,7 +675,7 @@ int camera_attr_set_extra_preview_bitrate(camera_h camera, int stream_id, int bi return CAMERA_ERROR_INVALID_PARAMETER; } - CAM_LOG_INFO("Enter - stream_id[%d], bitrate[%d]", stream_id, bitrate); + CAM_LOG_INFO("Enter - stream[%d], bitrate[%d]", stream_id, bitrate); CAMERA_MSG_PARAM_SET(param0, INT, stream_id); CAMERA_MSG_PARAM_SET(param1, INT, bitrate); @@ -701,7 +701,7 @@ int camera_attr_get_extra_preview_bitrate(camera_h camera, int stream_id, int *b return CAMERA_ERROR_INVALID_PARAMETER; } - CAM_LOG_INFO("Enter - stream_id[%d]", stream_id); + CAM_LOG_INFO("Enter - stream[%d]", stream_id); CAMERA_MSG_PARAM_SET(param, INT, stream_id); @@ -717,4 +717,60 @@ int camera_attr_get_extra_preview_bitrate(camera_h camera, int stream_id, int *b return ret; } + +int camera_attr_set_extra_preview_gop_interval(camera_h camera, int stream_id, int interval) +{ + 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_GOP_INTERVAL; + 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[%d], GOP interval[%d]", stream_id, interval); + + CAMERA_MSG_PARAM_SET(param0, INT, stream_id); + CAMERA_MSG_PARAM_SET(param1, INT, interval); + + _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_gop_interval(camera_h camera, int stream_id, int *interval) +{ + 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_GOP_INTERVAL; + camera_msg_param param; + + if (!pc || !pc->cb_info || !interval) { + CAM_LOG_ERROR("NULL pointer %p %p", pc, interval); + return CAMERA_ERROR_INVALID_PARAMETER; + } + + CAM_LOG_INFO("Enter - stream[%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) { + *interval = pc->cb_info->get_int[MUSE_CAMERA_GET_INT_EXTRA_PREVIEW_GOP_INTERVAL]; + CAM_LOG_INFO("get GOP interval[%d] for stream[%d]", *interval, stream_id); + } else { + CAM_LOG_ERROR("get GOP interval 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 99dd4e5..311fa63 100644 --- a/test/camera_test.c +++ b/test/camera_test.c @@ -927,6 +927,7 @@ static void print_menu() 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 'V' Extra preview GOP interval\n"); g_print("\t >>>>>>>>>>>>>>>>>>>> [Display/Filter]\n"); g_print("\t 'v' Visible \n"); g_print("\t 'o' Output mode \n"); @@ -1098,6 +1099,7 @@ static void setting_menu(gchar buf) int pixel_format; int fps; int bitrate; + int interval; switch (buf) { /* Camera setting */ @@ -1345,9 +1347,20 @@ static void setting_menu(gchar buf) break; case 'B': /* Setting > Set extra preview bitrate */ g_print("* Set extra preview bitrate\n"); + g_print("\tstream_id : "); + err = scanf("%d", &stream_id); + flush_stdin(); + + err = camera_attr_get_extra_preview_bitrate(hcamcorder->camera, stream_id, &bitrate); + if (err != CAMERA_ERROR_NONE) { + g_print("\tFailed to get bitrate for stream_id[%d]\n", stream_id); + break; + } - g_print("\tstream_id,bitrate : "); - err = scanf("%d,%d", &stream_id, &bitrate); + g_print("\tCurrent bitrate[%d]bps for stream_id[%d]\n", bitrate, stream_id); + + g_print("\tSet bitrate(bps) : "); + err = scanf("%d", &bitrate); flush_stdin(); err = camera_attr_set_extra_preview_bitrate(hcamcorder->camera, stream_id, bitrate); @@ -1364,7 +1377,41 @@ static void setting_menu(gchar buf) break; } - g_print("\tGet stream_id[%d],bitrate[%d]\n", stream_id, bitrate); + g_print("\tResult bitrate[%d]bps for stream_id[%d]\n", bitrate, stream_id); + break; + case 'V': /* Setting > Set extra preview GOP interval */ + g_print("* Set extra preview GOP interval\n"); + g_print("\tstream_id : "); + err = scanf("%d", &stream_id); + flush_stdin(); + + err = camera_attr_get_extra_preview_gop_interval(hcamcorder->camera, stream_id, &interval); + if (err != CAMERA_ERROR_NONE) { + g_print("\tFailed to get GOP interval for stream_id[%d]\n", stream_id); + break; + } + + g_print("\tCurrent GOP interval[%d]bps for stream_id[%d]\n", interval, stream_id); + + g_print("\tSet GOP interval(ms) : "); + err = scanf("%d", &interval); + flush_stdin(); + + err = camera_attr_set_extra_preview_gop_interval(hcamcorder->camera, stream_id, interval); + if (err != CAMERA_ERROR_NONE) { + g_print("* Set Error : 0x%x\n", err); + break; + } + + interval = -1; + + err = camera_attr_get_extra_preview_gop_interval(hcamcorder->camera, stream_id, &interval); + if (err != CAMERA_ERROR_NONE) { + g_print("* Get Error : 0x%x\n", err); + break; + } + + g_print("\tResult GOP interval[%d]bps for stream_id[%d]\n", interval, stream_id); break; /* Display / Filter setting */ case 'v': /* Display visible */ |