[Mplayer-cvslog] CVS: main/libmpdemux demux_audio.c,1.1,1.2

Alban Bedel CVS albeu at mplayer.dev.hu
Thu Feb 14 19:37:36 CET 2002


Update of /cvsroot/mplayer/main/libmpdemux
In directory mplayer:/var/tmp.root/cvs-serv13548/libmpdemux

Modified Files:
	demux_audio.c 
Log Message:
Improved mp3 detection (don't detect mpeg1/2 as mp3 anymore)
Added resync_audio call


Index: demux_audio.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demux_audio.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- demux_audio.c	14 Feb 2002 13:04:35 -0000	1.1
+++ demux_audio.c	14 Feb 2002 18:37:33 -0000	1.2
@@ -25,6 +25,7 @@
 
 extern int mp_decode_mp3_header(unsigned char* hbuf);
 extern void free_sh_audio(sh_audio_t* sh);
+extern void resync_audio_stream(sh_audio_t *sh_audio);
 
 
 int demux_audio_open(demuxer_t* demuxer) {
@@ -82,8 +83,18 @@
   switch(frmt) {
   case MP3:
     sh_audio->format = 0x55;
-    stream_seek(s,st_pos);
     demuxer->movi_start = st_pos;
+    for(n = 0; n < 5 ; n++) {
+      pos = mp_decode_mp3_header(hdr);
+      if(pos < 0)
+	return 0;
+      stream_skip(s,pos-4);
+      if(s->eof)
+	return 0;
+      stream_read(s,hdr,4);
+      if(s->eof)
+	return 0;
+    }
     if(s->end_pos) {
       char tag[4];
       stream_seek(s,s->end_pos-128);
@@ -197,7 +208,7 @@
 	ds_add_packet(ds,dp);
 	return 1;
       }
-    }
+    } break;
   case WAV : {
     int l = sh_audio->wf->nAvgBytesPerSec;
     demux_packet_t*  dp = new_demux_packet(l);
@@ -245,5 +256,7 @@
   }
 
   stream_seek(s,pos);
+
+  resync_audio_stream(sh_audio);
 
 }




More information about the MPlayer-cvslog mailing list