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

Reimar Döffinger CVS syncmail at mplayerhq.hu
Sun May 9 01:41:15 CEST 2004


CVS change done by Reimar Döffinger CVS

Update of /cvsroot/mplayer/main/libmpcodecs
In directory mail:/var2/tmp/cvs-serv21778

Modified Files:
	ad_pcm.c 
Log Message:
fix bigendian problems (left-right swapped 8bit pcms), add 32bit support


Index: ad_pcm.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/ad_pcm.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- ad_pcm.c	28 Mar 2004 22:03:37 -0000	1.9
+++ ad_pcm.c	8 May 2004 23:41:13 -0000	1.10
@@ -23,13 +23,23 @@
   sh_audio->channels=h->nChannels;
   sh_audio->samplerate=h->nSamplesPerSec;
   sh_audio->samplesize=(h->wBitsPerSample+7)/8;
+  sh_audio->sample_format=AFMT_S16_LE; // default
   switch(sh_audio->format){ /* hardware formats: */
+    case 0x1: // Microsoft PCM
+       switch (sh_audio->samplesize) {
+         case 1: sh_audio->sample_format=AFMT_U8; break;
+         case 2: sh_audio->sample_format=AFMT_S16_LE; break;
+         case 4: sh_audio->sample_format=AFMT_S32_LE; break;
+       }
+       break;
     case 0x6:  sh_audio->sample_format=AFMT_A_LAW;break;
     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 0x2000: sh_audio->sample_format=AFMT_AC3; */
     case 0x736F7774: // 'twos'
+       sh_audio->sample_format=AFMT_S16_BE;
+       // intended fall-through
     case 0x74776F73: // 'swot'
        if(sh_audio->samplesize==1) sh_audio->sample_format=AFMT_S8;
 // Uncomment this if twos audio is broken for you
@@ -74,17 +84,5 @@
   int len=sh_audio->channels*sh_audio->samplesize-1;
   len=(minlen+len)&(~len); // sample align
   len=demux_read_data(sh_audio->ds,buf,len);
-#ifdef WORDS_BIGENDIAN
-  if(sh_audio->format!=0x736F7774){
-#else
-  if(sh_audio->format==0x736F7774){ // "twos" is swapped byteorder
-#endif
-    int j;
-    for(j=0;j<len;j+=2){
-      char x=buf[j];
-      buf[j]=buf[j+1];
-      buf[j+1]=x;
-    }
-  }
   return len;
 }




More information about the MPlayer-cvslog mailing list