summaryrefslogtreecommitdiffstats
path: root/libaf
diff options
context:
space:
mode:
Diffstat (limited to 'libaf')
-rw-r--r--libaf/af_format.c16
-rw-r--r--libaf/af_resample.c4
2 files changed, 14 insertions, 6 deletions
diff --git a/libaf/af_format.c b/libaf/af_format.c
index d12829cacc..c6047b25ab 100644
--- a/libaf/af_format.c
+++ b/libaf/af_format.c
@@ -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 @@ static af_data_t* play(struct af_instance_s* af, af_data_t* data)
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 @@ static af_data_t* play(struct af_instance_s* af, af_data_t* data)
break;
}
}
+
// Change signed/unsigned
if((cf&SIGN_MASK) != (lf&SIGN_MASK)){
switch((cf&NBITS_MASK)){
@@ -234,8 +241,9 @@ static af_data_t* play(struct af_instance_s* af, af_data_t* data)
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;
diff --git a/libaf/af_resample.c b/libaf/af_resample.c
index 3d706dce83..acd350afa3 100644
--- a/libaf/af_resample.c
+++ b/libaf/af_resample.c
@@ -212,11 +212,11 @@ static int control(struct af_instance_s* af, int cmd, void* arg)
// 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