[0.2.95] extend the pre-condition of _get_streaming_download_progress() 87/195687/3
authorEunhae Choi <eunhae1.choi@samsung.com>
Mon, 17 Dec 2018 08:15:36 +0000 (17:15 +0900)
committerEunhae Choi <eunhae1.choi@samsung.com>
Mon, 17 Dec 2018 08:56:55 +0000 (17:56 +0900)
- extend the pre-condition of _get_streaming_download_progress()
  which is related to the ACR-1329
- apply the changed interface of mm_player_get_buffer_position()
- rename paramter of _get_streaming_download_progress() to make clear the meaning

Change-Id: I2cf86b7f89c9fdea5dcd48343b53fa7ec5e0f696

legacy/include/legacy_player.h
legacy/include/legacy_player_private.h
legacy/src/legacy_player.c
muse/src/muse_player.c
packaging/mmsvc-player.spec

index c587fa3404e199006f766d8b63c092d8b42ba2c7..40b861ea7fd16ecd19ce833958f6bce1896b5632 100644 (file)
@@ -1501,7 +1501,7 @@ int legacy_player_set_streaming_user_agent(player_h player, const char *user_age
  * @since_tizen 2.3
  * @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] end The end position in percentage [0, 100]
  * @return @c 0 on success,
  *         otherwise a negative error value
  * @retval #PLAYER_ERROR_NONE Successful
@@ -1510,7 +1510,7 @@ int legacy_player_set_streaming_user_agent(player_h player, const char *user_age
  * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state
  * @pre The player state must be set to #PLAYER_STATE_PLAYING by calling legacy_player_start() or set to #PLAYER_STATE_PAUSED by calling legacy_player_pause().
  */
-int legacy_player_get_streaming_download_progress(player_h player, int *start, int *current);
+int legacy_player_get_streaming_download_progress(player_h player, int *start, int *end);
 
 /**
  * @brief Registers a callback function to be invoked when the playback is finished.
index 3bee2a163d2ce2fc988a40076e20dabe8a6387d8..90d5b5610438a4bdc24526a2ef122387ddbbb388 100644 (file)
@@ -36,7 +36,7 @@ do {  \
        PLAYER_CHECK_CONDITION(player->state == expected_state, PLAYER_ERROR_INVALID_STATE, "PLAYER_ERROR_INVALID_STATE")
 
 #define PLAYER_NULL_ARG_CHECK(arg)      \
-       PLAYER_CHECK_CONDITION(arg != NULL, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER")
+       PLAYER_CHECK_CONDITION((arg), PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER")
 
 #define PLAYER_RANGE_ARG_CHECK(arg, min, max)      \
 do {   \
index b83ab76651ee50dff6b98aaca1de489d4f032557..8398f2e8b9e78ca234e8c2941f1a76da40c42ad5 100644 (file)
@@ -1812,26 +1812,24 @@ int legacy_player_set_streaming_user_agent(player_h player, const char *user_age
                return PLAYER_ERROR_NONE;
 }
 
-int legacy_player_get_streaming_download_progress(player_h player, int *start, int *current)
+int legacy_player_get_streaming_download_progress(player_h player, int *start_pos, int *end_pos)
 {
-       PLAYER_INSTANCE_CHECK(player);
-       PLAYER_NULL_ARG_CHECK(start);
-       PLAYER_NULL_ARG_CHECK(current);
+       int ret = MM_ERROR_NONE;
        player_s *handle = (player_s *)player;
-       if (handle->state != PLAYER_STATE_PLAYING && handle->state != PLAYER_STATE_PAUSED) {
-               LOGE("[%s] PLAYER_ERROR_INVALID_STATE(0x%08x) : current state - %d", __FUNCTION__, PLAYER_ERROR_INVALID_STATE, handle->state);
+
+       PLAYER_INSTANCE_CHECK(player);
+       PLAYER_NULL_ARG_CHECK(start_pos && end_pos);
+
+       if (!__player_state_validate(handle, PLAYER_STATE_READY)) {
+               LOGE("invalid state error, current state - %d", handle->state);
                return PLAYER_ERROR_INVALID_STATE;
        }
-       unsigned long _current = 0;
-       unsigned long _start = 0;
-       int ret = mm_player_get_buffer_position(handle->mm_handle, MM_PLAYER_POS_FORMAT_PERCENT, &_start, &_current);
-       if (ret != MM_ERROR_NONE) {
+
+       ret = mm_player_get_buffer_position(handle->mm_handle, start_pos, end_pos);
+       if (ret != MM_ERROR_NONE)
                return __player_convert_error_code(ret, (char *)__FUNCTION__);
-       } else {
-               *start = (int)_start;
-               *current = (int)_current;
-               return PLAYER_ERROR_NONE;
-       }
+
+       return PLAYER_ERROR_NONE;
 }
 
 int legacy_player_set_completed_cb(player_h player, player_completed_cb callback, void *user_data)
index 858e274d6e4a52bdfa02473fa61e86b9e2f0ba05..69983685478f0e21123a15cb8b88a43d8d9e9987 100644 (file)
@@ -2483,13 +2483,13 @@ int player_disp_get_streaming_download_progress(muse_module_h module)
        int ret = PLAYER_ERROR_NONE;
        muse_player_handle_s *muse_player = NULL;
        muse_player_api_e api = MUSE_PLAYER_API_GET_STREAMING_DOWNLOAD_PROGRESS;
-       int start, current;
+       int start_pos = 0, end_pos = 0;
 
        muse_player = (muse_player_handle_s *)muse_server_ipc_get_handle(module);
 
-       ret = legacy_player_get_streaming_download_progress(muse_player->player_handle, &start, &current);
+       ret = legacy_player_get_streaming_download_progress(muse_player->player_handle, &start_pos, &end_pos);
 
-       PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "start", start, MUSE_TYPE_INT, "current", current);
+       PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "start_pos", start_pos, MUSE_TYPE_INT, "end_pos", end_pos);
 
        return ret;
 }
index 5df9c504b20ddfa6007b1f127fb6b2bb66a27937..df462fa37d16f3a849dccf3ca81f4f300d647e3d 100644 (file)
@@ -1,6 +1,6 @@
 Name:       mmsvc-player
 Summary:    A Media Player module for muse server
-Version:    0.2.94
+Version:    0.2.95
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0