mplayer: remove generic duration calculation

This was useless for anything but the raw demuxers. In most cases, this
would most likely lead to display of bogus duration values, because the
bitrates used are per-track, not the total file bitrate. There was
actually no case left where this code was helpful.

Note that demux_lavf has its own code for this using the total file
bitrate. Also, mplayer.c can calculate the playback percentage from
current file position / current file size. This is not removed.
This commit is contained in:
wm4 2013-07-12 23:11:04 +02:00
parent 32b828e442
commit 666cb2dac2
1 changed files with 1 additions and 11 deletions

View File

@ -3029,17 +3029,7 @@ double get_time_length(struct MPContext *mpctx)
if (len >= 0) if (len >= 0)
return len; return len;
struct sh_video *sh_video = mpctx->sh_video; // Unknown
struct sh_audio *sh_audio = mpctx->sh_audio;
if (sh_video && sh_video->i_bps && sh_audio && sh_audio->i_bps)
return (double) (demuxer->movi_end - demuxer->movi_start) /
(sh_video->i_bps + sh_audio->i_bps);
if (sh_video && sh_video->i_bps)
return (double) (demuxer->movi_end - demuxer->movi_start) /
sh_video->i_bps;
if (sh_audio && sh_audio->i_bps)
return (double) (demuxer->movi_end - demuxer->movi_start) /
sh_audio->i_bps;
return 0; return 0;
} }