From c619dbbb5b2c95b9dd3e311fe5288430b3f7d18e Mon Sep 17 00:00:00 2001 From: colin Date: Fri, 3 Jan 2003 15:12:18 +0000 Subject: [PATCH] (nicer) endianness fix for every plugin except pl_format git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@8742 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libao2/afmt.h | 2 ++ libao2/pl_eq.c | 2 +- libao2/pl_extrastereo.c | 13 ++----------- libao2/pl_resample.c | 7 +------ libao2/pl_surround.c | 4 ++-- libao2/pl_volnorm.c | 19 +++---------------- libao2/pl_volume.c | 4 ++-- 7 files changed, 13 insertions(+), 38 deletions(-) diff --git a/libao2/afmt.h b/libao2/afmt.h index 2b5b904a92..f7c4fcd616 100644 --- a/libao2/afmt.h +++ b/libao2/afmt.h @@ -9,6 +9,8 @@ #endif #endif +#include "../config.h" /* for native endianness */ + /* standard, old OSS audio formats */ #ifndef AFMT_MU_LAW # define AFMT_MU_LAW 0x00000001 diff --git a/libao2/pl_eq.c b/libao2/pl_eq.c index 30e7a390ac..8fdc2ae35c 100644 --- a/libao2/pl_eq.c +++ b/libao2/pl_eq.c @@ -122,7 +122,7 @@ static int init(){ float F[KM] = CF; // Check input format - if(ao_plugin_data.format != AFMT_S16_LE){ + if(ao_plugin_data.format != AFMT_S16_NE){ fprintf(stderr,"[pl_eq] Input audio format not yet supported. \n"); return 0; } diff --git a/libao2/pl_extrastereo.c b/libao2/pl_extrastereo.c index a8abeec8d8..12b1cc2853 100644 --- a/libao2/pl_extrastereo.c +++ b/libao2/pl_extrastereo.c @@ -20,7 +20,6 @@ #include "audio_plugin.h" #include "audio_plugin_internal.h" #include "afmt.h" -#include "../config.h" static ao_info_t info = { "Extra stereo plugin", @@ -58,11 +57,7 @@ static int control(int cmd,int arg){ // return: 1=success 0=fail static int init(){ switch(ao_plugin_data.format){ -#ifndef WORDS_BIGENDIAN - case(AFMT_S16_LE): -#else - case(AFMT_S16_BE): -#endif + case(AFMT_S16_NE): break; default: fprintf(stderr,"[pl_extrastereo] Audio format not yet suported \n"); @@ -92,11 +87,7 @@ static void reset(){ static int play(){ switch(pl_extrastereo.format){ -#ifndef WORDS_BIGENDIAN - case(AFMT_S16_LE): { -#else - case(AFMT_S16_BE): { -#endif + case(AFMT_S16_NE): { int16_t* data=(int16_t*)ao_plugin_data.data; int len=ao_plugin_data.len / 2; // 16 bits samples diff --git a/libao2/pl_resample.c b/libao2/pl_resample.c index 039f50ac66..8698bb8d68 100644 --- a/libao2/pl_resample.c +++ b/libao2/pl_resample.c @@ -24,7 +24,6 @@ #include "audio_plugin.h" #include "audio_plugin_internal.h" #include "afmt.h" -#include "../config.h" static ao_info_t info = { @@ -120,11 +119,7 @@ static int init(){ pl_resample.up=UP; // Sheck input format -#ifndef WORDS_BIGENDIAN - if(ao_plugin_data.format != AFMT_S16_LE){ -#else - if(ao_plugin_data.format != AFMT_S16_BE){ -#endif + if(ao_plugin_data.format != AFMT_S16_NE){ fprintf(stderr,"[pl_resample] Input audio format not yet suported. \n"); return 0; } diff --git a/libao2/pl_surround.c b/libao2/pl_surround.c index a7e629b0e3..d351342bb8 100644 --- a/libao2/pl_surround.c +++ b/libao2/pl_surround.c @@ -108,8 +108,8 @@ static int init(){ pl_surround.passthrough = 1; return 1; } - if (ao_plugin_data.format != AFMT_S16_LE) { - fprintf(stderr, "pl_surround: I'm dumb and can only handle AFMT_S16_LE audio format, using passthrough mode\n"); + if (ao_plugin_data.format != AFMT_S16_NE) { + fprintf(stderr, "pl_surround: I'm dumb and can only handle AFMT_S16_NE audio format, using passthrough mode\n"); pl_surround.passthrough = 1; return 1; } diff --git a/libao2/pl_volnorm.c b/libao2/pl_volnorm.c index 4ca29dbdd2..4a3c82f516 100644 --- a/libao2/pl_volnorm.c +++ b/libao2/pl_volnorm.c @@ -31,7 +31,6 @@ #include "audio_plugin.h" #include "audio_plugin_internal.h" #include "afmt.h" -#include "../config.h" static ao_info_t info = { "Volume normalizer", @@ -117,11 +116,7 @@ static int control(int cmd,int arg){ // return: 1=success 0=fail static int init(){ switch(ao_plugin_data.format){ -#ifndef WORDS_BIGENDIAN - case(AFMT_S16_LE): -#else - case(AFMT_S16_BE): -#endif + case(AFMT_S16_NE): break; default: fprintf(stderr,"[pl_volnorm] Audio format not yet supported.\n"); @@ -147,11 +142,7 @@ static void reset(){ int i; mul = MUL_INIT; switch(ao_plugin_data.format) { -#ifndef WORDS_BIGENDIAN - case(AFMT_S16_LE): -#else - case(AFMT_S16_BE): -#endif + case(AFMT_S16_NE): #if AVG==1 lastavg = MID_S16; #elif AVG==2 @@ -174,11 +165,7 @@ static void reset(){ static int play(){ switch(pl_volnorm.format){ -#ifndef WORDS_BIGENDIAN - case(AFMT_S16_LE): { -#else - case(AFMT_S16_BE): { -#endif + case(AFMT_S16_NE): { #define CLAMP(x,m,M) do { if ((x)<(m)) (x) = (m); else if ((x)>(M)) (x) = (M); } while(0) int16_t* data=(int16_t*)ao_plugin_data.data; diff --git a/libao2/pl_volume.c b/libao2/pl_volume.c index a6590cce16..e0fb5e0e1b 100644 --- a/libao2/pl_volume.c +++ b/libao2/pl_volume.c @@ -81,7 +81,7 @@ static int init(){ // Sanity sheck this plugin supports AFMT_U8 and AFMT_S16_LE switch(ao_plugin_data.format){ case(AFMT_U8): - case(AFMT_S16_LE): + case(AFMT_S16_NE): break; default: fprintf(stderr,"[pl_volume] Audio format not yet suported \n"); @@ -135,7 +135,7 @@ static int play(){ } break; } - case(AFMT_S16_LE):{ + case(AFMT_S16_NE):{ register int len=ao_plugin_data.len>>1; register int16_t* data=(int16_t*)ao_plugin_data.data; register int x;