changeset 5455:5546543ae874

cleanup
author arpi
date Mon, 01 Apr 2002 15:45:45 +0000
parents c6252cfb68e2
children 600208b5b5d3
files libmpcodecs/ad_pcm.c
diffstat 1 files changed, 5 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/ad_pcm.c	Mon Apr 01 15:26:23 2002 +0000
+++ b/libmpcodecs/ad_pcm.c	Mon Apr 01 15:45:45 2002 +0000
@@ -29,8 +29,6 @@
     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;
-    //  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;
   }
@@ -63,15 +61,16 @@
 
 static int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int maxlen)
 {
+  int len=sh_audio->channels*sh_audio->samplesize-1;
+  len=(minlen+len)&(~len); // sample align
+  len=demux_read_data(sh_audio->ds,buf,len);
   if(sh_audio->format==0x736F7774){ // "twos" is swapped byteorder
-    int j,len;
-    len=demux_read_data(sh_audio->ds,buf,(minlen+1)&(~1));
+    int j;
     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);
+  return len;
 }