[Mplayer-cvslog] CVS: main/libmpcodecs ad_liba52.c,1.9,1.10

Arpi of Ize arpi at mplayerhq.hu
Sat May 17 13:35:36 CEST 2003


Update of /cvsroot/mplayer/main/libmpcodecs
In directory mail:/var/tmp.root/cvs-serv18304

Modified Files:
	ad_liba52.c 
Log Message:
ac3 byteswapping support (when format!=0x2000)


Index: ad_liba52.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/ad_liba52.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- ad_liba52.c	18 Jan 2003 19:29:46 -0000	1.9
+++ ad_liba52.c	17 May 2003 11:35:32 -0000	1.10
@@ -43,21 +43,25 @@
     sh_audio->a_in_buffer_len=0;
     /* sync frame:*/
 while(1){
-    while(sh_audio->a_in_buffer_len<7){
+    while(sh_audio->a_in_buffer_len<8){
 	int c=demux_getc(sh_audio->ds);
 	if(c<0) return -1; /* EOF*/
         sh_audio->a_in_buffer[sh_audio->a_in_buffer_len++]=c;
     }
+    if(sh_audio->format!=0x2000) swab(sh_audio->a_in_buffer,sh_audio->a_in_buffer,8);
     length = a52_syncinfo (sh_audio->a_in_buffer, &flags, &sample_rate, &bit_rate);
     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);
+    if(sh_audio->format!=0x2000) swab(sh_audio->a_in_buffer,sh_audio->a_in_buffer,8);
+    memcpy(sh_audio->a_in_buffer,sh_audio->a_in_buffer+1,7);
     --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);
     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);
+    demux_read_data(sh_audio->ds,sh_audio->a_in_buffer+8,length-8);
+    if(sh_audio->format!=0x2000)
+	swab(sh_audio->a_in_buffer+8,sh_audio->a_in_buffer+8,length-8);
     
     if(crc16_block(sh_audio->a_in_buffer+2,length-2)!=0)
 	mp_msg(MSGT_DECAUDIO,MSGL_STATUS,"a52: CRC check failed!  \n");



More information about the MPlayer-cvslog mailing list