changeset 10119:1a777e2b8228

ac3 byteswapping support (when format!=0x2000)
author arpi
date Sat, 17 May 2003 11:35:32 +0000
parents 070f242e4437
children 1827efc60279
files libmpcodecs/ad_liba52.c
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/ad_liba52.c	Sat May 17 11:34:37 2003 +0000
+++ b/libmpcodecs/ad_liba52.c	Sat May 17 11:35:32 2003 +0000
@@ -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");