diff options
author | nicodvb <nicodvb@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2006-02-27 21:13:17 +0000 |
---|---|---|
committer | nicodvb <nicodvb@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2006-02-27 21:13:17 +0000 |
commit | 941b080f9ccdf8d2e66cc9314208edfa2013ac7a (patch) | |
tree | 3391574cf2e5483b119d77087d3350434d8dc93c | |
parent | f380dd575b81d65aa3d4f677ac22f27836fb1ee7 (diff) | |
download | mpv-941b080f9ccdf8d2e66cc9314208edfa2013ac7a.tar.bz2 mpv-941b080f9ccdf8d2e66cc9314208edfa2013ac7a.tar.xz |
try to get duration from the stream layer, if an implementation of STREAM_CTRL_GET_TIME_LENGTH is available
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@17700 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r-- | libmpdemux/demux_mpg.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libmpdemux/demux_mpg.c b/libmpdemux/demux_mpg.c index 647ece7e83..72d60669cc 100644 --- a/libmpdemux/demux_mpg.c +++ b/libmpdemux/demux_mpg.c @@ -787,9 +787,17 @@ int demux_mpg_control(demuxer_t *demuxer,int cmd, void *arg){ 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; |