changeset 16925:4bce034eeb0a

estimate total time also for audio-only files.
author reimar
date Sun, 06 Nov 2005 14:14:53 +0000
parents 6b97696c9295
children 24c52f2c3aa9
files libmpdemux/demuxer.c
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demuxer.c	Sun Nov 06 02:47:43 2005 +0000
+++ b/libmpdemux/demuxer.c	Sun Nov 06 14:14:53 2005 +0000
@@ -933,10 +933,13 @@
 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;     
     }