[ACR-1329] extend the pre-condition of _get_streaming_download_progress 45/195145/6
authorEunhae Choi <eunhae1.choi@samsung.com>
Tue, 11 Dec 2018 05:58:40 +0000 (14:58 +0900)
committerEunhae Choi <eunhae1.choi@samsung.com>
Mon, 17 Dec 2018 08:21:32 +0000 (17:21 +0900)
- include READY state in pre-condition
- after player_prepare, the state will be READY
  and application can get buffering progress.

Change-Id: I7d3a37f0772685e69aa7ebefc106d1372144e149

include/player.h
src/player.c
test/player_test.c

index e6df6abd091312f8b5f5f0442285da00622a95cd..d5935bf4b844459d96a3182b0d632a7e1a9af090 100644 (file)
@@ -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);
 
 /**
  * @}
index e954532095c2052309aa4b03ffb860f52124fe7b..0747a47f05b6b8a4e7cd8ed5655739c9ae4120ad 100644 (file)
@@ -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 *)&current,
+                                                                       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)
index 42d5b1875c8090252e6dd8efa8e341b7998dd57b..dfa1158a151dad404294e92aca5193a74644a483 100644 (file)
@@ -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");