changeset 5453:0e63c2f19ba6

twos audio fixed
author arpi
date Mon, 01 Apr 2002 15:25:50 +0000
parents eb87391a5292
children c6252cfb68e2
files libmpcodecs/ad_pcm.c
diffstat 1 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/ad_pcm.c	Mon Apr 01 14:01:22 2002 +0000
+++ b/libmpcodecs/ad_pcm.c	Mon Apr 01 15:25:50 2002 +0000
@@ -29,7 +29,8 @@
     case 0x7:  sh_audio->sample_format=AFMT_MU_LAW;break;
     case 0x11: sh_audio->sample_format=AFMT_IMA_ADPCM;break;
     case 0x50: sh_audio->sample_format=AFMT_MPEG;break;
-    case 0x736F7774: sh_audio->sample_format=AFMT_S16_LE;sh_audio->codec->driver=AFM_DVDPCM;break;
+    //  format 0x736f7774  ; "twos" (MOV files)
+    case 0x736F7774: sh_audio->sample_format=AFMT_S16_LE;/*sh_audio->codec->driver=AFM_DVDPCM;*/ break;
 /*    case 0x2000: sh_audio->sample_format=AFMT_AC3; */
     default: sh_audio->sample_format=(sh_audio->samplesize==2)?AFMT_S16_LE:AFMT_U8;
   }
@@ -62,5 +63,15 @@
 
 static int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int maxlen)
 {
+  if(sh_audio->format==0x736F7774){ // "twos" is swapped byteorder
+    int j,len;
+    len=demux_read_data(sh_audio->ds,buf,(minlen+1)&(~1));
+    for(j=0;j<len;j+=2){
+      char x=buf[j];
+      buf[j]=buf[j+1];
+      buf[j+1]=x;
+    }
+    return len;
+  }
   return demux_read_data(sh_audio->ds,buf,minlen);
 }