[MPlayer-cvslog] CVS: main/libmpdemux demux_audio.c,1.38,1.39

Reimar Döffinger CVS syncmail at mplayerhq.hu
Fri Sep 9 22:05:45 CEST 2005


CVS change done by Reimar Döffinger CVS

Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var2/tmp/cvs-serv9379/libmpdemux

Modified Files:
	demux_audio.c 
Log Message:
Ignore movi_end (except on error) to allow playing growing files.
Also adds a check if stream_read read the requested length.
This and the movi_end check on error help not accidently playing ID3 tags.


Index: demux_audio.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demux_audio.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- demux_audio.c	2 Sep 2005 08:32:32 -0000	1.38
+++ demux_audio.c	9 Sep 2005 20:05:42 -0000	1.39
@@ -404,7 +404,7 @@
   priv = demux->priv;
   s = demux->stream;
 
-  if(s->eof || (demux->movi_end && stream_tell(s) >= demux->movi_end) )
+  if(s->eof)
     return 0;
 
   switch(priv->frmt) {
@@ -412,15 +412,18 @@
     while(1) {
       uint8_t hdr[4];
       stream_read(s,hdr,4);
-      if (s->eof || (demux->movi_end && stream_tell(s) >= demux->movi_end))
+      if (s->eof)
         return 0;
       l = mp_decode_mp3_header(hdr);
       if(l < 0) {
+	if (demux->movi_end && stream_tell(s) >= demux->movi_end)
+	  return 0; // might be ID3 tag, i.e. EOF
 	stream_skip(s,-3);
       } else {
 	dp = new_demux_packet(l);
 	memcpy(dp->buffer,hdr,4);
-	stream_read(s,dp->buffer + 4,l-4);
+	if (stream_read(s,dp->buffer + 4,l-4) != l-4)
+	  return 0;
 	priv->last_pts = priv->last_pts < 0 ? 0 : priv->last_pts + sh_audio->audio.dwScale/(float)sh_audio->samplerate;
 	break;
       }




More information about the MPlayer-cvslog mailing list