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
This commit is contained in:
nicodvb 2006-02-27 21:13:17 +00:00
parent f380dd575b
commit 941b080f9c
1 changed files with 8 additions and 0 deletions

View File

@ -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;