[Mplayer-cvslog] CVS: main/libaf af_format.c,1.4,1.5 af_resample.c,1.9,1.10

Jürgen Keil jkeil at mplayerhq.hu
Sat Oct 12 22:02:05 CEST 2002


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

Modified Files:
	af_format.c af_resample.c 
Log Message:
Fix for audio filters on big endian cpus.  It's working now on Solaris SPARC & 
x86


Index: af_format.c
===================================================================
RCS file: /cvsroot/mplayer/main/libaf/af_format.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- af_format.c	11 Oct 2002 04:23:52 -0000	1.4
+++ af_format.c	12 Oct 2002 20:02:01 -0000	1.5
@@ -28,6 +28,12 @@
 #define LE 		(1<<2) // Little Endian
 #define END_MASK	(1<<2)
 
+#if WORDS_BIGENDIAN	       // native endian of cpu
+#define	NE	BE
+#else
+#define	NE	LE
+#endif
+
 // Signed
 #define US		(0<<3) // Un Signed
 #define SI		(1<<3) // SIgned
@@ -128,8 +134,8 @@
 
   la = l->audio;
 
-  // Change to little endian
-  if((cf&END_MASK)!=LE){
+  // Change to cpu native endian
+  if((cf&END_MASK)!=NE){
     switch(cf&NBITS_MASK){
     case(B16):{
       register uint16_t s;
@@ -150,6 +156,7 @@
     break;
     }
   }
+
   // Change signed/unsigned
   if((cf&SIGN_MASK) != (lf&SIGN_MASK)){
     switch((cf&NBITS_MASK)){
@@ -234,8 +241,9 @@
       break;      
     }
   }
-  // Switch to the correct endainess (again the problem with sun?)
-  if((lf&END_MASK)!=LE){
+
+  // Switch from cpu native endian to the correct endianess 
+  if((lf&END_MASK)!=NE){
     switch(lf&NBITS_MASK){
     case(B16):{
       register uint16_t s;

Index: af_resample.c
===================================================================
RCS file: /cvsroot/mplayer/main/libaf/af_resample.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- af_resample.c	8 Oct 2002 10:20:36 -0000	1.9
+++ af_resample.c	12 Oct 2002 20:02:01 -0000	1.10
@@ -212,11 +212,11 @@
 
     // Set parameters
     af->data->nch    = n->nch;
-    af->data->format = AFMT_S16_LE;
+    af->data->format = AFMT_S16_NE;
     af->data->bps    = 2;
     if(af->data->format != n->format || af->data->bps != n->bps)
       rv = AF_FALSE;
-    n->format = AFMT_S16_LE;
+    n->format = AFMT_S16_NE;
     n->bps = 2;
 
     // Calculate up and down sampling factors




More information about the MPlayer-cvslog mailing list