summaryrefslogtreecommitdiffstats
path: root/libmpdemux/demuxer.c
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2005-11-06 14:14:53 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2005-11-06 14:14:53 +0000
commitfb99b3a5c49d79c18157954e4d8376010f325b5f (patch)
treef9b73b4c883125bd536d476e2c0e9c505db17fc0 /libmpdemux/demuxer.c
parent490380977c1e3574eeb8386d8345175e4f78cbb3 (diff)
downloadmpv-fb99b3a5c49d79c18157954e4d8376010f325b5f.tar.bz2
mpv-fb99b3a5c49d79c18157954e4d8376010f325b5f.tar.xz
estimate total time also for audio-only files.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@16926 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux/demuxer.c')
-rw-r--r--libmpdemux/demuxer.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libmpdemux/demuxer.c b/libmpdemux/demuxer.c
index 7cc18810c7..44a6b14a8f 100644
--- a/libmpdemux/demuxer.c
+++ b/libmpdemux/demuxer.c
@@ -933,10 +933,13 @@ int demux_control(demuxer_t *demuxer, int cmd, void *arg) {
double demuxer_get_time_length(demuxer_t *demuxer){
double get_time_ans;
sh_video_t *sh_video = demuxer->video->sh;
+ sh_audio_t *sh_audio = demuxer->audio->sh;
// <= 0 means DEMUXER_CTRL_NOTIMPL or DEMUXER_CTRL_DONTKNOW
if (demux_control(demuxer, DEMUXER_CTRL_GET_TIME_LENGTH,(void *)&get_time_ans)<=0) {
if (sh_video && sh_video->i_bps)
get_time_ans = (double)(demuxer->movi_end-demuxer->movi_start)/sh_video->i_bps;
+ else if (sh_audio && sh_audio->i_bps)
+ get_time_ans = (double)(demuxer->movi_end-demuxer->movi_start)/sh_audio->i_bps;
else
get_time_ans=0;
}