[0.2.82] add nsec api path 62/182462/2 accepted/tizen/unified/20180627.070006 submit/tizen/20180626.021828
authorEunhae Choi <eunhae1.choi@samsung.com>
Mon, 25 Jun 2018 09:26:47 +0000 (18:26 +0900)
committerEunhae Choi <eunhae1.choi@samsung.com>
Tue, 26 Jun 2018 01:13:34 +0000 (10:13 +0900)
Change-Id: I963cc9e278b2b3656b0a1e361ba3f62c07f2eccc

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 e94bb4f..6da94a3 100644 (file)
@@ -737,12 +737,12 @@ int legacy_player_pause(player_h player);
 /**
  * @brief Sets the seek position for playback, asynchronously.
  * @since_tizen 2.3
- * @param[in] player The handle to the media player
- * @param[in] millisecond The position in milliseconds from the start to the seek point
- * @param[in] accurate If @c true the selected position is returned, but this might be considerably slow,
- *                     otherwise @c false
- * @param[in] callback The callback function to register
- * @param[in] user_data        The user data to be passed to the callback function
+ * @param[in] player       The handle to the media player
+ * @param[in] nanoseconds  The position in milliseconds from the start to the seek point
+ * @param[in] accurate     If @c true the selected position is returned, but this might be considerably slow,
+ *                         otherwise @c false
+ * @param[in] callback    The callback function to register
+ * @param[in] user_data           The user data to be passed to the callback function
  * @return @c 0 on success,
  *         otherwise a negative error value
  * @retval #PLAYER_ERROR_NONE Successful
@@ -753,13 +753,13 @@ int legacy_player_pause(player_h player);
  * @post It invokes legacy_player_seek_completed_cb() when seek operation completes, if you set a callback.
  * @see legacy_player_get_play_position()
  */
-int legacy_player_set_play_position(player_h player, int millisecond, bool accurate, player_seek_completed_cb callback, void *user_data);
+int legacy_player_set_play_position(player_h player, int64_t nanoseconds, bool accurate, player_seek_completed_cb callback, void *user_data);
 
 /**
  * @brief Gets the current position in milliseconds.
  * @since_tizen 2.3
- * @param[in]   player The handle to the media player
- * @param[out]  millisecond The current position in milliseconds
+ * @param[in]   player        The handle to the media player
+ * @param[out]  nanoseconds   The current position in milliseconds
  * @return @c 0 on success,
  *         otherwise a negative error value
  * @retval #PLAYER_ERROR_NONE Successful
@@ -769,7 +769,7 @@ int legacy_player_set_play_position(player_h player, int millisecond, bool accur
  * @pre The player state must be one of these: #PLAYER_STATE_IDLE, #PLAYER_STATE_READY, #PLAYER_STATE_PLAYING, or #PLAYER_STATE_PAUSED.
  * @see legacy_player_set_play_position()
  */
-int legacy_player_get_play_position(player_h player, int *millisecond);
+int legacy_player_get_play_position(player_h player, int64_t *nanoseconds);
 
 /**
  * @brief Sets the player's mute status.
@@ -1316,7 +1316,7 @@ int legacy_player_get_album_art(player_h player, void **album_art, int *size);
  * @remarks The media source is associated with the player, using either legacy_player_set_uri() or legacy_player_set_memory_buffer().
  * @remarks The playback type should be local playback or HTTP streaming playback.
  * @param[in]   player The handle to the media player
- * @param[out]  duration The duration in milliseconds
+ * @param[out]  duration The duration in nanoseconds
  * @return @c 0 on success,
  *         otherwise a negative error value
  * @retval #PLAYER_ERROR_NONE Successful
@@ -1327,7 +1327,7 @@ int legacy_player_get_album_art(player_h player, void **album_art, int *size);
  * @see legacy_player_set_uri()
  * @see legacy_player_set_memory_buffer()
  */
-int legacy_player_get_duration(player_h player, int *duration);
+int legacy_player_get_duration(player_h player, int64_t *duration);
 
 /**
  * @}
index ba0fce0..2b8e2ba 100644 (file)
@@ -112,7 +112,7 @@ typedef struct _player_s {
        GCond message_queue_cond;
        int current_message;
        player_error_e error_code;
-       int last_play_position;
+       int64_t last_play_position;
 } player_s;
 
 int __player_convert_error_code(int code, char* func_name);
index 221e8a0..fe5c8ea 100644 (file)
@@ -17,6 +17,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <inttypes.h>
 #include <mm.h>
 #include <mm_player.h>
 #include <mm_player_audioeffect.h>
@@ -539,8 +540,8 @@ static int __msg_callback(int message, void *param, void *user_data)
                }
                break;
        case MM_MESSAGE_PLAY_POSITION:
-               LOGI("MM_MESSAGE_PLAY_POSITION (%d ms)", msg->time.elapsed);
-               handle->last_play_position = (int)msg->time.elapsed;
+               LOGI("MM_MESSAGE_PLAY_POSITION (%"PRId64" ns)", msg->time.elapsed);
+               handle->last_play_position = msg->time.elapsed;
                break;
        case MM_MESSAGE_UNKNOWN:        /* 0x00 */
        case MM_MESSAGE_WARNING:        /* 0x02 */
@@ -1178,10 +1179,10 @@ int legacy_player_pause(player_h player)
        }
 }
 
-int legacy_player_set_play_position(player_h player, int millisecond, bool accurate, player_seek_completed_cb callback, void *user_data)
+int legacy_player_set_play_position(player_h player, int64_t nanoseconds, bool accurate, player_seek_completed_cb callback, void *user_data)
 {
        PLAYER_INSTANCE_CHECK(player);
-       PLAYER_CHECK_CONDITION(millisecond >= 0, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER");
+       PLAYER_CHECK_CONDITION(nanoseconds >= 0, PLAYER_ERROR_INVALID_PARAMETER, "PLAYER_ERROR_INVALID_PARAMETER");
        player_s *handle = (player_s *)player;
        if (!__player_state_validate(handle, PLAYER_STATE_READY)) {
                LOGE("[%s] PLAYER_ERROR_INVALID_STATE(0x%08x) : current state - %d", __FUNCTION__, PLAYER_ERROR_INVALID_STATE, handle->state);
@@ -1192,7 +1193,7 @@ int legacy_player_set_play_position(player_h player, int millisecond, bool accur
                LOGE("[%s] PLAYER_ERROR_SEEK_FAILED temp (0x%08x) : seeking... we can't do any more ", __FUNCTION__, PLAYER_ERROR_SEEK_FAILED);
                return PLAYER_ERROR_SEEK_FAILED;
        } else {
-               LOGI("[%s] Event type : %d, pos : %d ", __FUNCTION__, MUSE_PLAYER_EVENT_TYPE_SEEK, millisecond);
+               LOGI("[%s] Event type : %d, pos : %"PRId64, __FUNCTION__, MUSE_PLAYER_EVENT_TYPE_SEEK, nanoseconds);
                handle->user_cb[MUSE_PLAYER_EVENT_TYPE_SEEK] = callback;
                handle->user_data[MUSE_PLAYER_EVENT_TYPE_SEEK] = user_data;
        }
@@ -1201,7 +1202,7 @@ int legacy_player_set_play_position(player_h player, int millisecond, bool accur
        if (ret != MM_ERROR_NONE)
                return __player_convert_error_code(ret, (char *)__FUNCTION__);
 
-       ret = mm_player_set_position(handle->mm_handle, MM_PLAYER_POS_FORMAT_TIME, millisecond);
+       ret = mm_player_set_position(handle->mm_handle, MM_PLAYER_POS_FORMAT_TIME, nanoseconds);
        if (ret != MM_ERROR_NONE) {
                handle->user_cb[MUSE_PLAYER_EVENT_TYPE_SEEK] = NULL;
                handle->user_data[MUSE_PLAYER_EVENT_TYPE_SEEK] = NULL;
@@ -1211,12 +1212,12 @@ int legacy_player_set_play_position(player_h player, int millisecond, bool accur
        }
 }
 
-int legacy_player_get_play_position(player_h player, int *millisecond)
+int legacy_player_get_play_position(player_h player, int64_t *nanoseconds)
 {
-       unsigned long pos = 0;
+       int64_t pos = 0;
 
        PLAYER_INSTANCE_CHECK(player);
-       PLAYER_NULL_ARG_CHECK(millisecond);
+       PLAYER_NULL_ARG_CHECK(nanoseconds);
        player_s *handle = (player_s *)player;
        if (!__player_state_validate(handle, PLAYER_STATE_IDLE)) {
                LOGE("[%s] PLAYER_ERROR_INVALID_STATE(0x%08x) : current state - %d", __FUNCTION__, PLAYER_ERROR_INVALID_STATE, handle->state);
@@ -1230,17 +1231,17 @@ int legacy_player_get_play_position(player_h player, int *millisecond)
                           libmm-player will post position msg with last playback position before destory pipeline */
                        if (handle->state == PLAYER_STATE_IDLE) {
                                if (handle->last_play_position > 0)
-                                       *millisecond = handle->last_play_position;
+                                       *nanoseconds = handle->last_play_position;
                                else
-                                       *millisecond = 0;
-                               LOGD("position %d", *millisecond);
+                                       *nanoseconds = 0;
+                               LOGD("position %"PRId64, *nanoseconds);
                                return PLAYER_ERROR_NONE;
                        }
                }
 
                return __player_convert_error_code(ret, (char *)__FUNCTION__);
        } else {
-               *millisecond = (int)pos;
+               *nanoseconds = pos;
                return PLAYER_ERROR_NONE;
        }
 }
@@ -1313,24 +1314,26 @@ int legacy_player_is_looping(player_h player, bool *looping)
        }
 }
 
-int legacy_player_get_duration(player_h player, int *duration)
+int legacy_player_get_duration(player_h player, int64_t *duration)
 {
        PLAYER_INSTANCE_CHECK(player);
        PLAYER_NULL_ARG_CHECK(duration);
+       int ret = MM_ERROR_NONE;
+
        player_s *handle = (player_s *)player;
+
        if (!__player_state_validate(handle, PLAYER_STATE_READY)) {
                LOGE("[%s] PLAYER_ERROR_INVALID_STATE(0x%08x) : current state - %d", __FUNCTION__, PLAYER_ERROR_INVALID_STATE, handle->state);
                return PLAYER_ERROR_INVALID_STATE;
        }
-       int _duration;
-       int ret = mm_player_get_attribute(handle->mm_handle, NULL, MM_PLAYER_CONTENT_DURATION, &_duration, (char *)NULL);
+
+       ret = mm_player_get_duration(handle->mm_handle, duration);
        if (ret != MM_ERROR_NONE) {
                return __player_convert_error_code(ret, (char *)__FUNCTION__);
-       } else {
-               *duration = _duration;
-               /* LOGI("[%s] duration : %d",__FUNCTION__,_duration); */
-               return PLAYER_ERROR_NONE;
        }
+
+       LOGD("content dur: %"PRId64, *duration);
+       return PLAYER_ERROR_NONE;
 }
 
 int legacy_player_set_display_mode(player_h player, player_display_mode_e mode)
index 53a3777..f8f3b4f 100644 (file)
@@ -1776,12 +1776,12 @@ int player_disp_set_play_position(muse_module_h module)
        int ret = PLAYER_ERROR_NONE;
        muse_player_api_e api = MUSE_PLAYER_API_SET_PLAY_POSITION;
        muse_player_handle_s *muse_player = NULL;
-       int pos = 0;
+       int64_t pos = 0;
        int accurate = 0;
        bool ret_val = TRUE;
 
        ret_val = _player_disp_get_param_value(muse_server_module_get_msg(module),
-                                                               MUSE_TYPE_INT, "pos", (void *)&pos,
+                                                               MUSE_TYPE_INT64, "pos", (void *)&pos,
                                                                MUSE_TYPE_INT, "accurate", (void *)&accurate,
                                                                INVALID_MUSE_TYPE_VALUE);
        if (ret_val) {
@@ -1801,13 +1801,13 @@ int player_disp_get_play_position(muse_module_h module)
        int ret = PLAYER_ERROR_NONE;
        muse_player_api_e api = MUSE_PLAYER_API_GET_PLAY_POSITION;
        muse_player_handle_s *muse_player = NULL;
-       int pos;
+       int64_t pos = 0;
 
        muse_player = (muse_player_handle_s *)muse_server_ipc_get_handle(module);
 
        ret = legacy_player_get_play_position(muse_player->player_handle, &pos);
 
-       PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "pos", pos);
+       PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT64, "pos", pos);
 
        return ret;
 }
@@ -1883,13 +1883,13 @@ int player_disp_get_duration(muse_module_h module)
        int ret = PLAYER_ERROR_NONE;
        muse_player_api_e api = MUSE_PLAYER_API_GET_DURATION;
        muse_player_handle_s *muse_player = NULL;
-       int duration = 0;
+       int64_t duration = 0;
 
        muse_player = (muse_player_handle_s *)muse_server_ipc_get_handle(module);
 
        ret = legacy_player_get_duration(muse_player->player_handle, &duration);
 
-       PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT, "duration", duration);
+       PLAYER_RETURN_MSG(api, ret, module, MUSE_TYPE_INT64, "duration", duration);
 
        return ret;
 }
@@ -2539,12 +2539,12 @@ int player_disp_set_subtitle_position_offset(muse_module_h module)
        int ret = PLAYER_ERROR_NONE;
        muse_player_handle_s *muse_player = NULL;
        muse_player_api_e api = MUSE_PLAYER_API_SET_SUBTITLE_POSITION_OFFSET;
-       int millisecond;
+       int milliseconds;
 
        muse_player = (muse_player_handle_s *)muse_server_ipc_get_handle(module);
-       player_msg_get(millisecond, muse_server_module_get_msg(module));
+       player_msg_get(milliseconds, muse_server_module_get_msg(module));
 
-       ret = legacy_player_set_subtitle_position_offset(muse_player->player_handle, millisecond);
+       ret = legacy_player_set_subtitle_position_offset(muse_player->player_handle, milliseconds);
 
        PLAYER_RETURN_MSG(api, ret, module);
 
index b69e649..f3793ab 100644 (file)
@@ -1,6 +1,6 @@
 Name:       mmsvc-player
 Summary:    A Media Player module for muse server
-Version:    0.2.81
+Version:    0.2.82
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0