[MPlayer-cvslog] r23572 - trunk/libmpdemux/demuxer.c

zuxy subversion at mplayerhq.hu
Sun Jun 17 15:28:52 CEST 2007


Author: zuxy
Date: Sun Jun 17 15:28:52 2007
New Revision: 23572

Log:
More accurate seeking for demuxers lacking DEMUXER_CTRL_GET_TIME_LENGTH control


Modified:
   trunk/libmpdemux/demuxer.c

Modified: trunk/libmpdemux/demuxer.c
==============================================================================
--- trunk/libmpdemux/demuxer.c	(original)
+++ trunk/libmpdemux/demuxer.c	Sun Jun 17 15:28:52 2007
@@ -1038,7 +1038,9 @@ double demuxer_get_time_length(demuxer_t
     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)
+      if (sh_video && sh_video->i_bps && sh_audio && sh_audio->i_bps)
+        get_time_ans = (double)(demuxer->movi_end-demuxer->movi_start)/(sh_video->i_bps+sh_audio->i_bps);
+      else 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;



More information about the MPlayer-cvslog mailing list