[Mplayer-cvslog] CVS: main dec_audio.c,1.62,1.63

Arpi of Ize arpi at mplayer.dev.hu
Fri Dec 28 18:35:13 CET 2001


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

Modified Files:
	dec_audio.c 
Log Message:
a52 sync fixed

Index: dec_audio.c
===================================================================
RCS file: /cvsroot/mplayer/main/dec_audio.c,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -r1.62 -r1.63
--- dec_audio.c	28 Dec 2001 12:03:52 -0000	1.62
+++ dec_audio.c	28 Dec 2001 17:35:10 -0000	1.63
@@ -136,6 +136,9 @@
 int flags=0;
 int sample_rate=0;
 int bit_rate=0;
+
+    sh_audio->a_in_buffer_len=0;
+    // sync frame:
 while(1){
     while(sh_audio->a_in_buffer_len<7){
 	int c=demux_getc(sh_audio->ds);
@@ -143,23 +146,17 @@
         sh_audio->a_in_buffer[sh_audio->a_in_buffer_len++]=c;
     }
     length = a52_syncinfo (sh_audio->a_in_buffer, &flags, &sample_rate, &bit_rate);
-    if(!length){
-	// bad file => resync
-	memcpy(sh_audio->a_in_buffer,sh_audio->a_in_buffer+1,6);
-	--sh_audio->a_in_buffer_len;
-	continue;
-    }
+    if(length>=7 && length<=3840) break; // we're done.
+    // bad file => resync
+    memcpy(sh_audio->a_in_buffer,sh_audio->a_in_buffer+1,6);
+    --sh_audio->a_in_buffer_len;
+}
     mp_msg(MSGT_DECAUDIO,MSGL_DBG2,"a52: len=%d  flags=0x%X  %d Hz %d bit/s\n",length,flags,sample_rate,bit_rate);
-    if(length<7 || length>3840){
-	 mp_msg(MSGT_DECAUDIO,MSGL_ERR,"a52: invalid frame length: %d\n",length);
-	 continue;
-    }
     sh_audio->samplerate=sample_rate;
     sh_audio->i_bps=bit_rate/8;
     demux_read_data(sh_audio->ds,sh_audio->a_in_buffer+7,length-7);
     return length;
 }
-}
 
 int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int maxlen);
 
@@ -974,6 +971,7 @@
 	sample_t level=1, bias=384;
         if(!sh_audio->a_in_buffer_len) 
 	    if(a52_fillbuff(sh_audio)<0) break; // EOF
+	    
 	switch(sh_audio->channels){
 	    case 1: flags=A52_MONO; break;
 //	    case 2: flags=A52_STEREO; break;




More information about the MPlayer-cvslog mailing list