Mercurial > mplayer.hg
changeset 17699:b742a2c71c25
try to get duration from the stream layer, if an implementation of STREAM_CTRL_GET_TIME_LENGTH is available
author | nicodvb |
---|---|
date | Mon, 27 Feb 2006 21:13:17 +0000 |
parents | 14830cce6098 |
children | a0c511c2d0bd |
files | libmpdemux/demux_mpg.c |
diffstat | 1 files changed, 8 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/libmpdemux/demux_mpg.c Mon Feb 27 21:11:28 2006 +0000 +++ b/libmpdemux/demux_mpg.c Mon Feb 27 21:13:17 2006 +0000 @@ -787,9 +787,17 @@ demux_stream_t *d_video=demuxer->video; sh_video_t *sh_video=d_video->sh; mpg_demuxer_t *mpg_d=(mpg_demuxer_t*)demuxer->priv; + int msec = 0; switch(cmd) { case DEMUXER_CTRL_GET_TIME_LENGTH: + msec = stream_control(demuxer->stream, STREAM_CTRL_GET_TIME_LENGTH, arg); + if(msec != STREAM_UNSUPORTED) { + msec = *((unsigned int*)arg); + *((double *)arg)=(double)msec/1000.0f; + mp_msg(MSGT_DEMUXER,MSGL_DBG2,"\r\nDEMUX_MPG_CTRL, stream len: %d (%.3lf)\r\n", msec, *((double*)arg)); + return DEMUXER_CTRL_GUESS; + } if (mpg_d && mpg_d->has_valid_timestamps) { *((double *)arg)=(double)mpg_d->final_pts; return DEMUXER_CTRL_GUESS;