[MPlayer-cvslog] r29526 - trunk/libmpdemux/demux_rawaudio.c

reimar subversion at mplayerhq.hu
Mon Aug 17 00:44:29 CEST 2009


Author: reimar
Date: Mon Aug 17 00:44:29 2009
New Revision: 29526

Log:
Add some protection to the rawaudio GET_LENGTH/GET_PERCENT_POS in case the
file length is not known (streaming).

Modified:
   trunk/libmpdemux/demux_rawaudio.c

Modified: trunk/libmpdemux/demux_rawaudio.c
==============================================================================
--- trunk/libmpdemux/demux_rawaudio.c	Mon Aug 17 00:39:10 2009	(r29525)
+++ trunk/libmpdemux/demux_rawaudio.c	Mon Aug 17 00:44:29 2009	(r29526)
@@ -117,11 +117,12 @@ static int demux_rawaudio_control(demuxe
   sh_audio_t *sh_audio = demuxer->audio->sh;
   switch(cmd) {
   case DEMUXER_CTRL_GET_TIME_LENGTH:
-    if (!sh_audio->i_bps) return DEMUXER_CTRL_DONTKNOW;
+    if (!sh_audio->i_bps || demuxer->movi_start >= demuxer->movi_end) return DEMUXER_CTRL_DONTKNOW;
     *(double *)arg = (double)(demuxer->movi_end - demuxer->movi_start) / sh_audio->i_bps;
     return DEMUXER_CTRL_GUESS;
 
   case DEMUXER_CTRL_GET_PERCENT_POS:
+    if (demuxer->movi_start >= demuxer->movi_end) return DEMUXER_CTRL_DONTKNOW;
     *(int *)arg = (stream_tell(demuxer->stream) - demuxer->movi_start) * 100 / (demuxer->movi_end - demuxer->movi_start);
     return DEMUXER_CTRL_GUESS;
   }


More information about the MPlayer-cvslog mailing list