From: Eunhae Choi Date: Tue, 11 Dec 2018 05:58:40 +0000 (+0900) Subject: [ACR-1329] extend the pre-condition of _get_streaming_download_progress X-Git-Tag: submit/tizen/20181218.081409~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b42b31cf62afc13aaf6a9f10ce30caca9dbae631;p=platform%2Fcore%2Fapi%2Fplayer.git [ACR-1329] extend the pre-condition of _get_streaming_download_progress - include READY state in pre-condition - after player_prepare, the state will be READY and application can get buffering progress. Change-Id: I7d3a37f0772685e69aa7ebefc106d1372144e149 --- diff --git a/include/player.h b/include/player.h index e6df6ab..d5935bf 100644 --- a/include/player.h +++ b/include/player.h @@ -1747,17 +1747,17 @@ int player_set_streaming_user_agent(player_h player, const char *user_agent, int * @brief Gets the download progress for streaming playback. * @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif * @param[in] player The handle to the media player - * @param[out] start The starting position in percentage [0, 100] - * @param[out] current The current position in percentage [0, 100] + * @param[out] start The starting position of received data in percentage [0, 100] + * @param[out] end The end position of received data in percentage [0, 100] * @return @c 0 on success, * otherwise a negative error value * @retval #PLAYER_ERROR_NONE Successful * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state - * @pre The player state must be set to #PLAYER_STATE_PLAYING by calling player_start() or set to #PLAYER_STATE_PAUSED by calling player_pause(). + * @pre The player state must be one of #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED. */ -int player_get_streaming_download_progress(player_h player, int *start, int *current); +int player_get_streaming_download_progress(player_h player, int *start, int *end); /** * @} diff --git a/src/player.c b/src/player.c index e954532..0747a47 100644 --- a/src/player.c +++ b/src/player.c @@ -3888,15 +3888,15 @@ int player_set_streaming_user_agent(player_h player, const char *user_agent, int return ret; } -int player_get_streaming_download_progress(player_h player, int *pstart, int *pcurrent) +int player_get_streaming_download_progress(player_h player, int *start, int *end) { PLAYER_INSTANCE_CHECK(player); - PLAYER_NULL_ARG_CHECK(pstart && pcurrent); + PLAYER_NULL_ARG_CHECK(start && end); int ret = PLAYER_ERROR_NONE; muse_player_api_e api = MUSE_PLAYER_API_GET_STREAMING_DOWNLOAD_PROGRESS; player_cli_s *pc = (player_cli_s *) player; char *ret_buf = NULL; - int start = 0, current = 0; + int start_pos = 0, end_pos = 0; LOGD("ENTER"); @@ -3904,19 +3904,18 @@ int player_get_streaming_download_progress(player_h player, int *pstart, int *pc if (ret == PLAYER_ERROR_NONE) { bool ret_val = true; ret_val = _player_get_param_value(ret_buf, - MUSE_TYPE_INT, "start", (void *)&start, - MUSE_TYPE_INT, "current", (void *)¤t, + MUSE_TYPE_INT, "start_pos", (void *)&start_pos, + MUSE_TYPE_INT, "end_pos", (void *)&end_pos, INVALID_MUSE_TYPE_VALUE); if (ret_val) { - *pstart = start; - *pcurrent = current; + *start = start_pos; + *end = end_pos; } else { ret = PLAYER_ERROR_INVALID_OPERATION; } } g_free(ret_buf); return ret; - } int player_set_completed_cb(player_h player, player_completed_cb callback, void *user_data) diff --git a/test/player_test.c b/test/player_test.c index 42d5b18..dfa1158 100644 --- a/test/player_test.c +++ b/test/player_test.c @@ -1450,6 +1450,14 @@ static void set_buffer_size(int prebuffer, int rebuffer) player_set_streaming_buffering_time(g_player[0], prebuffer, rebuffer); } +static void get_buffering_position() +{ + int ret; + int start = 0, end = 0; + ret = player_get_streaming_download_progress(g_player[0], &start, &end); + g_print(" ==> [Player_Test] buffering pos ()%d return : %d ~ %d\n", ret, start, end); +} + static void get_position() { int position = 0; @@ -2259,6 +2267,8 @@ void _interpret_main_menu(char *cmd) g_menu_state = CURRENT_STATUS_VIDEO360_SET_FOV; } else if (!strncmp(cmd, "sz", 2)) { g_menu_state = CURRENT_STATUS_VIDEO360_SET_ZOOM; + } else if (strncmp(cmd, "lb", 2) == 0) { + get_buffering_position(); } else { g_print("unknown menu \n"); } @@ -2304,7 +2314,8 @@ void display_sub_basic() g_print("[audio eq] E. Set Audio EQ\t"); g_print("H. Get Audio EQ\n"); g_print("[position] j. Set Position \t"); - g_print("l. Get Position\n"); + g_print("l. Get Position\t"); + g_print("lb. Get buffering position\n"); g_print("[trick] tr. set playback rate\n"); g_print("[duration] m. Get Duration\n"); g_print("[Stream Info] n. Get stream info (Video Size, codec, audio stream info, and tag info)\n");