gint64 cur, GstSeekType stop_type, gint64 stop);
static int __gst_pending_seek(mm_player_t* player);
-static int __gst_set_position(mm_player_t* player, int format, unsigned long position, gboolean internal_called);
-static int __gst_get_position(mm_player_t* player, int format, unsigned long *position);
+static int __gst_set_position(mm_player_t* player, int format, gint64 position, gboolean internal_called);
+static int __gst_get_position(mm_player_t* player, int format, gint64 *position);
static int __gst_get_buffer_position(mm_player_t* player, int format, unsigned long* start_pos, unsigned long* stop_pos);
static int __gst_adjust_subtitle_position(mm_player_t* player, int format, int position);
static int __gst_set_message_callback(mm_player_t* player, MMMessageCallback callback, gpointer user_param);
missing_only = FALSE;
}
- if ((flag & ATTR_DURATION) || (!has_duration && missing_only) || all) {
+ if ((flag & ATTR_DURATION) || (!has_duration && missing_only) || all) {
LOGD("try to update duration");
has_duration = FALSE;
- if (gst_element_query_duration(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, GST_FORMAT_TIME, &dur_nsec)) {
+ if (gst_element_query_duration(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, GST_FORMAT_TIME, &dur_nsec) && (dur_nsec > 0)) {
player->duration = dur_nsec;
- LOGW("duration : %lld msec", GST_TIME_AS_MSECONDS(dur_nsec));
+ LOGW("duration : %"G_GINT64_FORMAT" msec", GST_TIME_AS_MSECONDS(dur_nsec));
+ has_duration = TRUE;
}
if (player->duration < 0) {
- LOGW("duration : %lld is Non-Initialized !!! \n", player->duration);
+ LOGW("duration is Non-Initialized !!!");
player->duration = 0;
}
/* check duration is OK */
if (dur_nsec == 0 && !MMPLAYER_IS_LIVE_STREAMING(player)) {
/* FIXIT : find another way to get duration here. */
- LOGE("finally it's failed to get duration from pipeline. progressbar will not work correctely!");
- } else {
- /*update duration */
- mm_attrs_set_int_by_name(attrs, "content_duration", GST_TIME_AS_MSECONDS(dur_nsec));
- has_duration = TRUE;
+ LOGW("finally it's failed to get duration from pipeline. progressbar will not work correctely!");
}
}
LOGD("no negitiated caps from videosink");
gst_object_unref(pad);
pad = NULL;
- } else
+ } else {
LOGD("no videosink sink pad");
+ }
}
}
} else if (MMPLAYER_IS_HTTP_STREAMING(player)) {
data_size = player->http_content_size;
}
- LOGD("try to update bitrate : data_size = %lld", data_size);
+ LOGD("try to update bitrate : data_size = %"G_GUINT64_FORMAT, data_size);
if (data_size) {
guint64 bitrate = 0;
MMHandleType attrs = 0;
guint64 data_size = 0;
gchar* path = NULL;
- unsigned long pos_msec = 0;
+ gint64 pos_nsec = 0;
struct stat sb;
MMPLAYER_RETURN_IF_FAIL(player && player->pipeline && player->pipeline->mainbin);
- __gst_get_position(player, MM_PLAYER_POS_FORMAT_TIME, &pos_msec); // update last_position
+ __gst_get_position(player, MM_PLAYER_POS_FORMAT_TIME, &pos_nsec); /* to update player->last_position */
attrs = MMPLAYER_GET_ATTRS(player);
if (!attrs) {
if ((MMPLAYER_IS_LIVE_STREAMING(player)) && (MMPLAYER_IS_RTSP_STREAMING(player))) {
- LOGD("player->last_position=%lld , player->streamer->buffering_percent=%d \n",
+ LOGD("player->last_position=%"G_GINT64_FORMAT" , player->streamer->buffering_percent=%d \n",
GST_TIME_AS_SECONDS(player->last_position), player->streamer->buffering_percent);
if ((GST_TIME_AS_SECONDS(player->last_position) <= 0) && (MMPLAYER_CURRENT_STATE(player) == MM_PLAYER_STATE_PAUSED)) {
if ((MMPLAYER_IS_RTSP_STREAMING(player)) && (player->pending_seek.is_pending)) {
int retVal = MM_ERROR_NONE;
- LOGD("trying to play from (%lu) pending position\n", player->pending_seek.pos);
+ LOGD("trying to play from (%"G_GINT64_FORMAT") pending position\n", player->pending_seek.pos);
retVal = __gst_set_position(player, player->pending_seek.format, player->pending_seek.pos, TRUE);
gchar *video_frame_size = NULL;
gst_structure_get(gst_message_get_structure(msg), "rtsp_duration", G_TYPE_UINT64, &player->duration, NULL);
- LOGD("rtsp duration : %lld msec", GST_TIME_AS_MSECONDS(player->duration));
+ LOGD("rtsp duration : %"G_GINT64_FORMAT" msec", GST_TIME_AS_MSECONDS(player->duration));
player->streaming_type = __mmplayer_get_stream_service_type(player);
- mm_attrs_set_int_by_name(attrs, "content_duration", GST_TIME_AS_MSECONDS(player->duration));
gst_structure_get(gst_message_get_structure(msg), "rtsp_audio_codec", G_TYPE_STRING, &audio_codec, NULL);
LOGD("rtsp_audio_codec : %s", audio_codec);
LOGD("msg src : [%s]", GST_ELEMENT_NAME(GST_ELEMENT_CAST(msg->src)));
if (gst_element_query_duration(GST_ELEMENT_CAST(msg->src), GST_FORMAT_BYTES, &bytes)) {
- LOGD("data total size of http content: %lld", bytes);
+ LOGD("data total size of http content: %"G_GINT64_FORMAT, bytes);
player->http_content_size = (bytes > 0) ? (bytes) : (0);
}
} else
mm_player_audio_stream_buff_t *tmp = (mm_player_audio_stream_buff_t *)l->data;
if (tmp) {
if (send_all) {
- LOGD("[%lld] send remained data.", tmp->channel_mask);
+ LOGD("[%"G_GUINT64_FORMAT"] send remained data.", tmp->channel_mask);
__mmplayer_audio_stream_send_data(player, tmp);
}
if (tmp->pcm_data)
audio_stream.data_size = a_buffer->data_size;
audio_stream.data = a_buffer->pcm_data;
- /* LOGD("[%lld] send data size:%d, %p", audio_stream.channel_mask, audio_stream.data_size, player->audio_stream_cb_user_param); */
+ /* LOGD("[%"G_GUINT64_FORMAT"] send data size:%d, %p", audio_stream.channel_mask, audio_stream.data_size, player->audio_stream_cb_user_param); */
player->audio_stream_render_cb_ex(&audio_stream, player->audio_stream_cb_user_param);
MMPLAYER_FLEAVE();
mm_player_audio_stream_buff_t *tmp = (mm_player_audio_stream_buff_t *)l->data;
if (tmp) {
if (channel_mask == tmp->channel_mask) {
- /* LOGD("[%lld] total: %d, data: %d, buffer: %d", channel_mask, tmp->data_size, a_size, tmp->buff_size); */
+ /* LOGD("[%"G_GUINT64_FORMAT"] total: %d, data: %d, buffer: %d", channel_mask, tmp->data_size, a_size, tmp->buff_size); */
if (tmp->data_size + a_size < tmp->buff_size) {
memcpy(tmp->pcm_data + tmp->data_size, a_data, a_size);
tmp->data_size += a_size;
__mmplayer_audio_stream_send_data(player, tmp);
if (a_size > tmp->buff_size) {
- LOGD("[%lld] adj buffer size %d -> %d", channel_mask, tmp->buff_size, a_size);
+ LOGD("[%"G_GUINT64_FORMAT"] adj buffer size %d -> %d", channel_mask, tmp->buff_size, a_size);
tmp->pcm_data = g_realloc(tmp->pcm_data, a_size);
if (tmp->pcm_data == NULL) {
LOGE("failed to realloc data.");
goto DONE;
}
memcpy(a_buffer->pcm_data, a_data, a_size);
- /* LOGD("new [%lld] total:%d buff:%d", channel_mask, a_buffer->data_size, a_buffer->buff_size); */
+ /* LOGD("new [%"G_GUINT64_FORMAT"] total:%d buff:%d", channel_mask, a_buffer->data_size, a_buffer->buff_size); */
player->audio_stream_buff_list = g_list_append(player->audio_stream_buff_list, a_buffer);
} else {
/* If sync is TRUE, send data directly. */
/* set size and timestamp */
dataBlock = gst_buffer_peek_memory(buffer, 0);
stream->length_total = gst_memory_get_sizes(dataBlock, NULL, NULL);
- stream->timestamp = (unsigned int)(GST_BUFFER_PTS(buffer)/1000000); /* nano sec -> mili sec */
+ stream->timestamp = (unsigned int)(GST_BUFFER_PTS(buffer)/GST_MSECOND); /* nano sec -> mili sec */
/* check zero-copy */
if (player->set_mode.video_zc &&
return MM_ERROR_NONE;
}
-static int __gst_adjust_video_position(mm_player_t* player, int offset)
-{
- MMPLAYER_FENTER();
- LOGD("adjusting video_pos in player") ;
- int current_pos = 0;
- /* check player and videobin are created */
- MMPLAYER_RETURN_VAL_IF_FAIL(player && player->pipeline, MM_ERROR_PLAYER_NOT_INITIALIZED);
- if (!player->pipeline->videobin ||
- !player->pipeline->videobin[MMPLAYER_V_SINK].gst) {
- LOGD("no video pipeline or sink is there");
- return MM_ERROR_PLAYER_INVALID_STATE ;
- }
- if (offset == 0) {
- LOGD("nothing to do\n");
- MMPLAYER_FLEAVE();
- return MM_ERROR_NONE;
- }
- if (__gst_get_position(player, MM_PLAYER_POS_FORMAT_TIME, (unsigned long*)¤t_pos) != MM_ERROR_NONE) {
- LOGD("failed to get current position");
- return MM_ERROR_PLAYER_INTERNAL;
- }
- if ((current_pos - offset) < GST_TIME_AS_MSECONDS(player->duration)) {
- LOGD("enter video delay is valid");
- } else {
- LOGD("enter video delay is crossing content boundary");
- return MM_ERROR_INVALID_ARGUMENT ;
- }
- g_object_set(G_OBJECT(player->pipeline->videobin[MMPLAYER_V_SINK].gst), "ts-offset", ((gint64) offset * G_GINT64_CONSTANT(1000000)), NULL);
- LOGD("video delay has been done");
- MMPLAYER_FLEAVE();
-
- return MM_ERROR_NONE;
-}
static void
__gst_appsrc_feed_data_mem(GstElement *element, guint size, gpointer user_data)
__mm_player_streaming_set_queue2(player->streamer,
element,
TRUE,
- player->ini.http_max_size_bytes + PLAYER_PD_EXT_MAX_SIZE_BYTE,
+ player->ini.http_max_size_bytes, // + PLAYER_PD_EXT_MAX_SIZE_BYTE,
pre_buffering_time,
1.0,
player->ini.http_buffering_limit,
return ret;
}
- LOGD("trying to play from(%lu) pending position\n", player->pending_seek.pos);
+ LOGD("trying to play from(%"G_GINT64_FORMAT") pending position\n", player->pending_seek.pos);
ret = __gst_set_position(player, player->pending_seek.format, player->pending_seek.pos, FALSE);
}
static int
-__gst_set_position(mm_player_t* player, int format, unsigned long position, gboolean internal_called)
+__gst_set_position(mm_player_t* player, int format, gint64 position, gboolean internal_called)
{
- unsigned long dur_msec = 0;
gint64 dur_nsec = 0;
gint64 pos_nsec = 0;
gboolean ret = TRUE;
/* NOTE : duration cannot be zero except live streaming.
* Since some element could have some timing problemn with quering duration, try again.
*/
- if (!player->duration) {
+ if (player->duration == 0) {
if (!gst_element_query_duration(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, GST_FORMAT_TIME, &dur_nsec)) {
/* For RTSP Streaming , duration is not returned in READY state. So seek to the previous position does not work properly.
* Added a patch to postpone the actual seek when state changes to PLAY. Sending a fake SEEK_COMPLETED event to finish the current request. */
}
player->duration = dur_nsec;
}
-
- if (player->duration) {
- dur_msec = GST_TIME_AS_MSECONDS(player->duration);
- } else {
- LOGE("could not get the duration. fail to seek.\n");
- goto SEEK_ERROR;
- }
}
LOGD("playback rate: %f\n", player->playback_rate);
gboolean seekable = FALSE;
/* check position is valid or not */
- if (position > dur_msec)
+ if (position > player->duration)
goto INVALID_ARGS;
query = gst_query_new_seeking(GST_FORMAT_TIME);
gst_query_unref(query); /* keep seeking operation */
}
- LOGD("seeking to(%lu) msec, duration is %d msec\n", position, dur_msec);
+ LOGD("seeking to(%"G_GINT64_FORMAT") nsec, duration is %"G_GINT64_FORMAT" nsec\n", position, player->duration);
/* For rtspsrc stack , npt-start value coming from server is used for finding the current position.
But when a rtsp clip (especially from Youtube Desktop View) is paused and kept for sometime,npt-start is still increasing.
if (!internal_called)
player->doing_seek = TRUE;
- pos_nsec = position * G_GINT64_CONSTANT(1000000);
-
if ((MMPLAYER_IS_HTTP_STREAMING(player)) && (!player->videodec_linked)) {
gint64 cur_time = 0;
__gst_pause(player, FALSE);
}
+ pos_nsec = position;
+
/* rtsp streaming case, there is no sink after READY TO PAUSE state(no preroll state change).
that's why set position through property. */
if ((MMPLAYER_IS_RTSP_STREAMING(player)) &&
}
if (!ret) {
- LOGE("failed to set position. dur[%lu] pos[%lu] pos_msec[%llu]\n", dur_msec, position, pos_nsec);
+ LOGE("failed to set position.");
goto SEEK_ERROR;
}
}
case MM_PLAYER_POS_FORMAT_PERCENT:
{
- LOGD("seeking to(%lu)%% \n", position);
+ LOGD("seeking to %"G_GINT64_FORMAT"%%", position);
if (player->doing_seek) {
LOGD("not completed seek");
GST_FORMAT_TIME, seek_flags,
GST_SEEK_TYPE_SET, pos_nsec, GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE);
if (!ret) {
- LOGE("failed to set position. dur[%lud] pos[%lud] pos_msec[%"G_GUINT64_FORMAT"]\n", dur_msec, position, pos_nsec);
+ LOGE("failed to set position. pos[%"G_GINT64_FORMAT"] dur[%"G_GINT64_FORMAT"] ", pos_nsec, player->duration);
goto SEEK_ERROR;
}
}
player->pending_seek.format = format;
player->pending_seek.pos = position;
- LOGW("player current-state : %s, pending-state : %s, just preserve pending position(%lu).\n",
- MMPLAYER_STATE_GET_NAME(MMPLAYER_CURRENT_STATE(player)), MMPLAYER_STATE_GET_NAME(MMPLAYER_PENDING_STATE(player)), player->pending_seek.pos);
+ LOGW("player current-state : %s, pending-state : %s, just preserve pending position(%"G_GINT64_FORMAT").\n",
+ MMPLAYER_STATE_GET_NAME(MMPLAYER_CURRENT_STATE(player)),
+ MMPLAYER_STATE_GET_NAME(MMPLAYER_PENDING_STATE(player)),
+ player->pending_seek.pos);
return MM_ERROR_NONE;
INVALID_ARGS:
- LOGE("invalid arguments, position : %ld dur : %ld format : %d \n", position, dur_msec, format);
+ LOGE("invalid arguments, position: %"G_GINT64_FORMAT" dur : %"G_GINT64_FORMAT" format : %d \n", position, player->duration, format);
return MM_ERROR_INVALID_ARGUMENT;
SEEK_ERROR:
#define TRICKPLAY_OFFSET GST_MSECOND
static int
-__gst_get_position(mm_player_t* player, int format, unsigned long* position)
+__gst_get_position(mm_player_t* player, int format, gint64* position)
{
MMPlayerStateType current_state = MM_PLAYER_STATE_NONE;
- gint64 pos_msec = 0;
+ gint64 pos_nsec = 0;
gboolean ret = TRUE;
MMPLAYER_RETURN_VAL_IF_FAIL(player && position && player->pipeline && player->pipeline->mainbin,
* please refer to below comments in details
*/
if (current_state != MM_PLAYER_STATE_PAUSED)
- ret = gst_element_query_position(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, GST_FORMAT_TIME, &pos_msec);
+ ret = gst_element_query_position(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, GST_FORMAT_TIME, &pos_nsec);
/* NOTE : get last point to overcome some bad operation of some elements
*(returning zero when getting current position in paused state
* and when failed to get postion during seeking
*/
if ((current_state == MM_PLAYER_STATE_PAUSED) || (!ret)) {
- LOGD("pos_msec = %"GST_TIME_FORMAT" and ret = %d and state = %d", GST_TIME_ARGS(pos_msec), ret, current_state);
+ LOGD("pos_nsec = %"GST_TIME_FORMAT" and ret = %d and state = %d", GST_TIME_ARGS(pos_nsec), ret, current_state);
if (player->playback_rate < 0.0)
- pos_msec = player->last_position - TRICKPLAY_OFFSET;
+ pos_nsec = player->last_position - TRICKPLAY_OFFSET;
else
- pos_msec = player->last_position;
+ pos_nsec = player->last_position;
if (!ret)
- pos_msec = player->last_position;
+ pos_nsec = player->last_position;
else
- player->last_position = pos_msec;
+ player->last_position = pos_nsec;
- LOGD("returning last point : %"GST_TIME_FORMAT, GST_TIME_ARGS(pos_msec));
+ LOGD("returning last point : %"GST_TIME_FORMAT, GST_TIME_ARGS(pos_nsec));
} else {
- if (player->duration > 0 && pos_msec > player->duration)
- pos_msec = player->duration;
+ if (player->duration > 0 && pos_nsec > player->duration)
+ pos_nsec = player->duration;
- player->last_position = pos_msec;
+ player->last_position = pos_nsec;
}
switch (format) {
case MM_PLAYER_POS_FORMAT_TIME:
- *position = GST_TIME_AS_MSECONDS(pos_msec);
+ *position = pos_nsec;
break;
case MM_PLAYER_POS_FORMAT_PERCENT:
{
if (player->duration <= 0) {
- LOGD("duration is [%lld], so returning position 0\n", player->duration);
+ LOGD("duration is [%"G_GINT64_FORMAT"], so returning position 0\n", player->duration);
*position = 0;
} else {
- LOGD("postion is [%lld] msec , duration is [%lld] msec", pos_msec, player->duration);
- *position = pos_msec * 100 / player->duration;
+ LOGD("position is [%"G_GINT64_FORMAT"] nsec , duration is [%"G_GINT64_FORMAT"] nsec", pos_nsec, player->duration);
+ *position = (gint64)(pos_nsec * 100 / player->duration);
}
break;
}
MMPlayerGstElement *mainbin = NULL;
gint start_per = DEFAULT_PER_VALUE, stop_per = DEFAULT_PER_VALUE;
gint64 buffered_total = 0;
- unsigned long position = 0;
+ gint64 position = 0;
gint buffered_sec = -1;
GstBufferingMode mode = GST_BUFFERING_STREAM;
gint64 content_size_time = player->duration;
return MM_ERROR_NONE;
}
- LOGD("pos %d ms, dur %d sec, len %"G_GUINT64_FORMAT" bytes",
- position, (guint)(content_size_time/GST_SECOND), content_size_bytes);
+ LOGD("pos %"G_GINT64_FORMAT" msec, dur %d sec, len %"G_GUINT64_FORMAT" bytes",
+ GST_TIME_AS_MSECONDS(position), (guint)GST_TIME_AS_SECONDS(content_size_time), content_size_bytes);
mainbin = player->pipeline->mainbin;
- start_per = (gint)(floor(100 *(gdouble)(position*GST_MSECOND) / (gdouble)content_size_time));
+ start_per = (gint)(floor(100 *(gdouble)position / (gdouble)content_size_time));
if (mainbin[MMPLAYER_M_MUXED_S_BUFFER].gst) {
GstQuery *query = NULL;
LOGW("no need to interrupt, so leave");
} else {
MMMessageParamType msg = {0, };
- unsigned long pos = 0;
+ gint64 pos = 0;
player->interrupted_by_resource = TRUE;
LOGW("failed to get play position.");
} else {
msg.union_type = MM_MSG_UNION_TIME;
- msg.time.elapsed = (unsigned int)pos;
+ msg.time.elapsed = pos;
MMPLAYER_POST_MSG(player, MM_MESSAGE_PLAY_POSITION, &msg);
}
LOGD("video resource conflict so, resource will be freed by unrealizing");
_mmplayer_pause(MMHandleType hplayer)
{
mm_player_t* player = (mm_player_t*)hplayer;
- gint64 pos_msec = 0;
+ gint64 pos_nsec = 0;
gboolean async = FALSE;
gint ret = MM_ERROR_NONE;
*(returning zero when getting current position in paused state) of some
* elements
*/
- if (!gst_element_query_position(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, GST_FORMAT_TIME, &pos_msec))
+ if (!gst_element_query_position(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, GST_FORMAT_TIME, &pos_nsec))
LOGW("getting current position failed in paused\n");
- player->last_position = pos_msec;
+ player->last_position = pos_nsec;
/* For rtspsrc stack , npt-start value coming from server is used for finding the current position.
But when a rtsp clip (especially from Youtube Desktop View) is paused and kept for sometime,npt-start is still increasing.
_mmplayer_set_playspeed(MMHandleType hplayer, float rate, bool streaming)
{
mm_player_t* player = (mm_player_t*)hplayer;
- gint64 pos_msec = 0;
+ gint64 pos_nsec = 0;
int ret = MM_ERROR_NONE;
int mute = FALSE;
signed long long start = 0, stop = 0;
current_state = MMPLAYER_CURRENT_STATE(player);
if (current_state != MM_PLAYER_STATE_PAUSED)
- ret = gst_element_query_position(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, GST_FORMAT_TIME, &pos_msec);
+ ret = gst_element_query_position(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, GST_FORMAT_TIME, &pos_nsec);
- LOGD("pos_msec = %"GST_TIME_FORMAT" and ret = %d and state = %d", GST_TIME_ARGS(pos_msec), ret, current_state);
+ LOGD("pos_msec = %"GST_TIME_FORMAT" and ret = %d and state = %d", GST_TIME_ARGS(pos_nsec), ret, current_state);
if ((current_state == MM_PLAYER_STATE_PAUSED)
|| (!ret) /*|| (player->last_position != 0 && pos_msec == 0)*/) {
- LOGW("returning last point : %lld\n", player->last_position);
- pos_msec = player->last_position;
+ LOGW("returning last point : %"G_GINT64_FORMAT, player->last_position);
+ pos_nsec = player->last_position;
}
if (rate >= 0) {
- start = pos_msec;
+ start = pos_nsec;
stop = GST_CLOCK_TIME_NONE;
} else {
start = GST_CLOCK_TIME_NONE;
- stop = pos_msec;
+ stop = pos_nsec;
}
if (!__gst_seek(player, player->pipeline->mainbin[MMPLAYER_M_PIPE].gst,
}
int
-_mmplayer_set_position(MMHandleType hplayer, int format, int position)
+_mmplayer_set_position(MMHandleType hplayer, int format, gint64 position)
{
mm_player_t* player = (mm_player_t*)hplayer;
int ret = MM_ERROR_NONE;
/* check pipline building state */
__mmplayer_check_pipeline(player);
- ret = __gst_set_position(player, format, (unsigned long)position, FALSE);
+ ret = __gst_set_position(player, format, position, FALSE);
MMPLAYER_FLEAVE();
}
int
-_mmplayer_get_position(MMHandleType hplayer, int format, unsigned long *position)
+_mmplayer_get_position(MMHandleType hplayer, int format, gint64 *position)
{
mm_player_t* player = (mm_player_t*)hplayer;
int ret = MM_ERROR_NONE;
}
int
-_mmplayer_get_buffer_position(MMHandleType hplayer, int format, unsigned long* start_pos, unsigned long* stop_pos)
+_mmplayer_get_duration(MMHandleType hplayer, gint64 *duration)
{
mm_player_t* player = (mm_player_t*)hplayer;
int ret = MM_ERROR_NONE;
MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
+ MMPLAYER_RETURN_VAL_IF_FAIL(duration, MM_ERROR_COMMON_INVALID_ARGUMENT);
- ret = __gst_get_buffer_position(player, format, start_pos, stop_pos);
-
+ *duration = player->duration;
return ret;
}
int
-_mmplayer_adjust_subtitle_postion(MMHandleType hplayer, int format, int position)
+_mmplayer_get_buffer_position(MMHandleType hplayer, int format, unsigned long* start_pos, unsigned long* stop_pos)
{
mm_player_t* player = (mm_player_t*)hplayer;
int ret = MM_ERROR_NONE;
- MMPLAYER_FENTER();
-
MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
- ret = __gst_adjust_subtitle_position(player, format, position);
-
- MMPLAYER_FLEAVE();
+ ret = __gst_get_buffer_position(player, format, start_pos, stop_pos);
return ret;
}
+
int
-_mmplayer_adjust_video_postion(MMHandleType hplayer, int offset)
+_mmplayer_adjust_subtitle_postion(MMHandleType hplayer, int format, int position)
{
mm_player_t* player = (mm_player_t*)hplayer;
int ret = MM_ERROR_NONE;
MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
- ret = __gst_adjust_video_position(player, offset);
+ ret = __gst_adjust_subtitle_position(player, format, position);
MMPLAYER_FLEAVE();
qsrcpad = gst_element_get_static_pad(queue2, "src");
if (GST_PAD_LINK_OK != gst_pad_link(srcpad, sinkpad)) {
- LOGE("failed to link buffering queue\n");
+ LOGE("failed to link buffering queue");
goto ERROR;
}
if (!gst_element_query_duration(player->pipeline->mainbin[MMPLAYER_M_SRC].gst, GST_FORMAT_BYTES, &dur_bytes))
- LOGE("fail to get duration.\n");
+ LOGE("fail to get duration");
- LOGD("dur_bytes = %lld\n", dur_bytes);
+ LOGD("dur_bytes = %"G_GINT64_FORMAT, dur_bytes);
muxed_buffer_type_e type = MUXED_BUFFER_TYPE_MEM_QUEUE;
// if (!g_strrstr(GST_ELEMENT_NAME(sinkelement), "mpegtsdemux"))
if (!g_strrstr(player->type, "video/mpegts")) {
max_buffer_size_bytes = (type == MUXED_BUFFER_TYPE_FILE) ? (player->ini.http_max_size_bytes) : (5*1024*1024);
- LOGD("max_buffer_size_bytes = %d\n", max_buffer_size_bytes);
+ LOGD("max_buffer_size_bytes = %d", max_buffer_size_bytes);
- // FIXME : pass ini setting directly. is this ok?
+ /* FIXME : pass ini setting directly. is this ok? */
__mm_player_streaming_set_queue2(player->streamer,
queue2,
FALSE,
/* do get/set position for new videosink plugin */
{
- unsigned long position = 0;
- gint64 pos_msec = 0;
+ gint64 position = 0;
LOGD("do get/set position for new videosink plugin");
if (__gst_get_position(player, MM_PLAYER_POS_FORMAT_TIME, &position)) {
}
#else
/* key unit seek */
- pos_msec = position * G_GINT64_CONSTANT(1000000);
ret = __gst_seek(player, player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, 1.0,
GST_FORMAT_TIME, (GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT),
- GST_SEEK_TYPE_SET, pos_msec,
+ GST_SEEK_TYPE_SET, position,
GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE);
if (!ret) {
LOGE("failed to set position");
goto ERROR;
}
- LOGD("seek time = %lld, rate = %f\n", time, player->playback_rate);
+ LOGD("seek time = %"G_GINT64_FORMAT", rate = %f", time, player->playback_rate);
event = gst_event_new_seek(player->playback_rate, GST_FORMAT_TIME, (GstSeekFlags)(GST_SEEK_FLAG_FLUSH), GST_SEEK_TYPE_SET, time, GST_SEEK_TYPE_NONE, -1);
if (event) {
__gst_send_event_to_sink(player, event);
}
int
-_mmplayer_set_video_share_master_clock(MMHandleType hplayer,
- long long clock,
- long long clock_delta,
- long long video_time,
- long long media_clock,
- long long audio_time)
+_mmplayer_set_video_share_master_clock(MMHandleType hplayer, gint64 clock, gint64 clock_delta,
+ gint64 video_time, gint64 media_clock, gint64 audio_time)
{
mm_player_t* player = (mm_player_t*) hplayer;
MMPlayerGstElement* mainbin = NULL;
MMPLAYER_RETURN_VAL_IF_FAIL(player->pipeline->mainbin, MM_ERROR_PLAYER_NOT_INITIALIZED);
MMPLAYER_RETURN_VAL_IF_FAIL(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, MM_ERROR_PLAYER_NOT_INITIALIZED);
- // LOGD("in(us) : %lld, %lld, %lld, %lld, %lld", clock, clock_delta, video_time, media_clock, audio_time);
+ /* LOGD("in(us) : %"G_GINT64_FORMAT", %"G_GINT64_FORMAT", %"G_GINT64_FORMAT", %"G_GINT64_FORMAT", %"G_GINT64_FORMAT,
+ clock, clock_delta, video_time, media_clock, audio_time); */
if ((video_time < 0) || (player->doing_seek)) {
- LOGD("skip setting master clock. %lld", video_time);
+ LOGD("skip setting master clock. %lld", video_time);
goto EXIT;
}
if ((current_state != MM_PLAYER_STATE_PLAYING) ||
(!query_ret)) {
position = player->last_position;
- LOGD("query fail. %lld", position);
+ LOGD("query fail. %"G_GINT64_FORMAT, position);
}
clock *= GST_USECOND;
position_delta *= GST_USECOND;
adj_base_time = position_delta;
- LOGD("video_share_clock_delta = %lld, adj = %lld", player->video_share_clock_delta, adj_base_time);
+ LOGD("video_share_clock_delta = %"G_GINT64_FORMAT", adj = %"G_GINT64_FORMAT, player->video_share_clock_delta, adj_base_time);
} else {
gint64 new_play_time = 0;
adj_base_time = position - new_play_time;
- LOGD("%lld(delay) = %lld - %lld / %lld(adj) = %lld(slave_pos) - %lld(master_pos) - %lld(delay)",
+ LOGD("%"G_GINT64_FORMAT"(delay) = %"G_GINT64_FORMAT" - %"G_GINT64_FORMAT" / %"G_GINT64_FORMAT
+ "(adj) = %"G_GINT64_FORMAT"(slave_pos) - %"G_GINT64_FORMAT"(master_pos) - %"G_GINT64_FORMAT"(delay)",
network_delay, clock_delta, player->video_share_clock_delta, adj_base_time, position, video_time, network_delay);
}
}
int
-_mmplayer_get_video_share_master_clock(MMHandleType hplayer,
- long long *video_time,
- long long *media_clock,
- long long *audio_time)
+_mmplayer_get_video_share_master_clock(MMHandleType hplayer, gint64 *video_time, gint64 *media_clock, gint64 *audio_time)
{
mm_player_t* player = (mm_player_t*) hplayer;
MMPlayerGstElement* mainbin = NULL;
*media_clock = *video_time = *audio_time = (position/GST_USECOND);
- LOGD("media_clock: %lld, video_time: %lld(us)", *media_clock, *video_time);
+ LOGD("media_clock: %"G_GINT64_FORMAT", video_time: %"G_GINT64_FORMAT"(us)", *media_clock, *video_time);
if (curr_clock)
gst_object_unref(curr_clock);