/**
* @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
* @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
* @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.
* @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
* @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);
/**
* @}
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);
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <inttypes.h>
#include <mm.h>
#include <mm_player.h>
#include <mm_player_audioeffect.h>
}
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 */
}
}
-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);
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;
}
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;
}
}
-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);
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;
}
}
}
}
-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)
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) {
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;
}
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;
}
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);
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