1
mirror of https://github.com/mpv-player/mpv synced 2024-11-03 03:19:24 +01:00

(nicer) endianness fix for every plugin except pl_format

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@8742 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
colin 2003-01-03 15:12:18 +00:00
parent 9b483e615e
commit c619dbbb5b
7 changed files with 13 additions and 38 deletions

View File

@ -9,6 +9,8 @@
#endif #endif
#endif #endif
#include "../config.h" /* for native endianness */
/* standard, old OSS audio formats */ /* standard, old OSS audio formats */
#ifndef AFMT_MU_LAW #ifndef AFMT_MU_LAW
# define AFMT_MU_LAW 0x00000001 # define AFMT_MU_LAW 0x00000001

View File

@ -122,7 +122,7 @@ static int init(){
float F[KM] = CF; float F[KM] = CF;
// Check input format // 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"); fprintf(stderr,"[pl_eq] Input audio format not yet supported. \n");
return 0; return 0;
} }

View File

@ -20,7 +20,6 @@
#include "audio_plugin.h" #include "audio_plugin.h"
#include "audio_plugin_internal.h" #include "audio_plugin_internal.h"
#include "afmt.h" #include "afmt.h"
#include "../config.h"
static ao_info_t info = { static ao_info_t info = {
"Extra stereo plugin", "Extra stereo plugin",
@ -58,11 +57,7 @@ static int control(int cmd,int arg){
// return: 1=success 0=fail // return: 1=success 0=fail
static int init(){ static int init(){
switch(ao_plugin_data.format){ switch(ao_plugin_data.format){
#ifndef WORDS_BIGENDIAN case(AFMT_S16_NE):
case(AFMT_S16_LE):
#else
case(AFMT_S16_BE):
#endif
break; break;
default: default:
fprintf(stderr,"[pl_extrastereo] Audio format not yet suported \n"); fprintf(stderr,"[pl_extrastereo] Audio format not yet suported \n");
@ -92,11 +87,7 @@ static void reset(){
static int play(){ static int play(){
switch(pl_extrastereo.format){ switch(pl_extrastereo.format){
#ifndef WORDS_BIGENDIAN case(AFMT_S16_NE): {
case(AFMT_S16_LE): {
#else
case(AFMT_S16_BE): {
#endif
int16_t* data=(int16_t*)ao_plugin_data.data; int16_t* data=(int16_t*)ao_plugin_data.data;
int len=ao_plugin_data.len / 2; // 16 bits samples int len=ao_plugin_data.len / 2; // 16 bits samples

View File

@ -24,7 +24,6 @@
#include "audio_plugin.h" #include "audio_plugin.h"
#include "audio_plugin_internal.h" #include "audio_plugin_internal.h"
#include "afmt.h" #include "afmt.h"
#include "../config.h"
static ao_info_t info = static ao_info_t info =
{ {
@ -120,11 +119,7 @@ static int init(){
pl_resample.up=UP; pl_resample.up=UP;
// Sheck input format // Sheck input format
#ifndef WORDS_BIGENDIAN if(ao_plugin_data.format != AFMT_S16_NE){
if(ao_plugin_data.format != AFMT_S16_LE){
#else
if(ao_plugin_data.format != AFMT_S16_BE){
#endif
fprintf(stderr,"[pl_resample] Input audio format not yet suported. \n"); fprintf(stderr,"[pl_resample] Input audio format not yet suported. \n");
return 0; return 0;
} }

View File

@ -108,8 +108,8 @@ static int init(){
pl_surround.passthrough = 1; pl_surround.passthrough = 1;
return 1; return 1;
} }
if (ao_plugin_data.format != AFMT_S16_LE) { if (ao_plugin_data.format != AFMT_S16_NE) {
fprintf(stderr, "pl_surround: I'm dumb and can only handle AFMT_S16_LE audio format, using passthrough mode\n"); fprintf(stderr, "pl_surround: I'm dumb and can only handle AFMT_S16_NE audio format, using passthrough mode\n");
pl_surround.passthrough = 1; pl_surround.passthrough = 1;
return 1; return 1;
} }

View File

@ -31,7 +31,6 @@
#include "audio_plugin.h" #include "audio_plugin.h"
#include "audio_plugin_internal.h" #include "audio_plugin_internal.h"
#include "afmt.h" #include "afmt.h"
#include "../config.h"
static ao_info_t info = { static ao_info_t info = {
"Volume normalizer", "Volume normalizer",
@ -117,11 +116,7 @@ static int control(int cmd,int arg){
// return: 1=success 0=fail // return: 1=success 0=fail
static int init(){ static int init(){
switch(ao_plugin_data.format){ switch(ao_plugin_data.format){
#ifndef WORDS_BIGENDIAN case(AFMT_S16_NE):
case(AFMT_S16_LE):
#else
case(AFMT_S16_BE):
#endif
break; break;
default: default:
fprintf(stderr,"[pl_volnorm] Audio format not yet supported.\n"); fprintf(stderr,"[pl_volnorm] Audio format not yet supported.\n");
@ -147,11 +142,7 @@ static void reset(){
int i; int i;
mul = MUL_INIT; mul = MUL_INIT;
switch(ao_plugin_data.format) { switch(ao_plugin_data.format) {
#ifndef WORDS_BIGENDIAN case(AFMT_S16_NE):
case(AFMT_S16_LE):
#else
case(AFMT_S16_BE):
#endif
#if AVG==1 #if AVG==1
lastavg = MID_S16; lastavg = MID_S16;
#elif AVG==2 #elif AVG==2
@ -174,11 +165,7 @@ static void reset(){
static int play(){ static int play(){
switch(pl_volnorm.format){ switch(pl_volnorm.format){
#ifndef WORDS_BIGENDIAN case(AFMT_S16_NE): {
case(AFMT_S16_LE): {
#else
case(AFMT_S16_BE): {
#endif
#define CLAMP(x,m,M) do { if ((x)<(m)) (x) = (m); else if ((x)>(M)) (x) = (M); } while(0) #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; int16_t* data=(int16_t*)ao_plugin_data.data;

View File

@ -81,7 +81,7 @@ static int init(){
// Sanity sheck this plugin supports AFMT_U8 and AFMT_S16_LE // Sanity sheck this plugin supports AFMT_U8 and AFMT_S16_LE
switch(ao_plugin_data.format){ switch(ao_plugin_data.format){
case(AFMT_U8): case(AFMT_U8):
case(AFMT_S16_LE): case(AFMT_S16_NE):
break; break;
default: default:
fprintf(stderr,"[pl_volume] Audio format not yet suported \n"); fprintf(stderr,"[pl_volume] Audio format not yet suported \n");
@ -135,7 +135,7 @@ static int play(){
} }
break; break;
} }
case(AFMT_S16_LE):{ case(AFMT_S16_NE):{
register int len=ao_plugin_data.len>>1; register int len=ao_plugin_data.len>>1;
register int16_t* data=(int16_t*)ao_plugin_data.data; register int16_t* data=(int16_t*)ao_plugin_data.data;
register int x; register int x;