From 507121f7fe2d170dd8db99d3112602036ddef718 Mon Sep 17 00:00:00 2001 From: alex Date: Mon, 27 Dec 2004 17:30:15 +0000 Subject: removing AFMT_ dependancy git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@14246 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libao2/Makefile | 2 +- libao2/afmt.c | 90 --------------------------------- libao2/afmt.h | 84 ------------------------------- libao2/ao_alsa.c | 32 ++++++------ libao2/ao_alsa5.c | 18 +++---- libao2/ao_arts.c | 14 +++--- libao2/ao_dsound.c | 16 +++--- libao2/ao_dxr2.c | 7 ++- libao2/ao_esd.c | 10 ++-- libao2/ao_jack.c | 10 ++-- libao2/ao_macosx.c | 4 +- libao2/ao_mpegpes.c | 16 +++--- libao2/ao_nas.c | 18 +++---- libao2/ao_null.c | 4 +- libao2/ao_oss.c | 131 +++++++++++++++++++++++++++++++++++++++++------- libao2/ao_pcm.c | 16 +++--- libao2/ao_plugin.c | 6 +-- libao2/ao_polyp.c | 10 ++-- libao2/ao_sdl.c | 32 ++++++------ libao2/ao_win32.c | 18 +++---- libao2/audio_out.c | 2 +- libao2/audio_plugin.h | 2 +- libao2/pl_delay.c | 4 +- libao2/pl_eq.c | 4 +- libao2/pl_extrastereo.c | 6 +-- libao2/pl_format.c | 59 +++++++++++----------- libao2/pl_resample.c | 4 +- libao2/pl_surround.c | 6 +-- libao2/pl_volnorm.c | 8 +-- libao2/pl_volume.c | 10 ++-- 30 files changed, 283 insertions(+), 360 deletions(-) delete mode 100644 libao2/afmt.c delete mode 100644 libao2/afmt.h (limited to 'libao2') diff --git a/libao2/Makefile b/libao2/Makefile index bc3002b1fb..cb1bd674d0 100644 --- a/libao2/Makefile +++ b/libao2/Makefile @@ -2,7 +2,7 @@ include config.mak LIBNAME = libao2.a -SRCS=afmt.c audio_out.c ao_mpegpes.c ao_null.c ao_pcm.c ao_plugin.c pl_delay.c pl_format.c pl_surround.c remez.c pl_resample.c pl_volume.c pl_extrastereo.c pl_volnorm.c pl_eq.c $(OPTIONAL_SRCS) +SRCS=audio_out.c ao_mpegpes.c ao_null.c ao_pcm.c ao_plugin.c pl_delay.c pl_format.c pl_surround.c remez.c pl_resample.c pl_volume.c pl_extrastereo.c pl_volnorm.c pl_eq.c $(OPTIONAL_SRCS) OBJS=$(SRCS:.c=.o) diff --git a/libao2/afmt.c b/libao2/afmt.c deleted file mode 100644 index 95cd817ca2..0000000000 --- a/libao2/afmt.c +++ /dev/null @@ -1,90 +0,0 @@ -#include -#include - -#include "config.h" -#include "afmt.h" - -char *audio_out_format_name(int format) -{ - switch (format) - { - case AFMT_MU_LAW: - return("Mu-Law"); - case AFMT_A_LAW: - return("A-Law"); - case AFMT_IMA_ADPCM: - return("Ima-ADPCM"); - case AFMT_S8: - return("Signed 8-bit"); - case AFMT_U8: - return("Unsigned 8-bit"); - case AFMT_U16_LE: - return("Unsigned 16-bit (Little-Endian)"); - case AFMT_U16_BE: - return("Unsigned 16-bit (Big-Endian)"); - case AFMT_S16_LE: - return("Signed 16-bit (Little-Endian)"); - case AFMT_S16_BE: - return("Signed 16-bit (Big-Endian)"); - case AFMT_MPEG: - return("MPEG (2) audio"); - case AFMT_AC3: - return("AC3"); - case AFMT_U32_LE: - return("Unsigned 32-bit (Little-Endian)"); - case AFMT_U32_BE: - return("Unsigned 32-bit (Big-Endian)"); - case AFMT_S32_LE: - return("Signed 32-bit (Little-Endian)"); - case AFMT_S32_BE: - return("Signed 32-bit (Big-Endian)"); - case AFMT_U24_LE: - return("Unsigned 24-bit (Little-Endian)"); - case AFMT_U24_BE: - return("Unsigned 24-bit (Big-Endian)"); - case AFMT_S24_LE: - return("Signed 24-bit (Little-Endian)"); - case AFMT_S24_BE: - return("Signed 24-bit (Big-Endian)"); - case AFMT_FLOAT: - return("Floating Point"); - } - return("Unknown"); -} - -// return number of bits for 1 sample in one channel, or 8 bits for compressed -int audio_out_format_bits(int format){ - switch (format) - { - case AFMT_S16_LE: - case AFMT_S16_BE: - case AFMT_U16_LE: - case AFMT_U16_BE: - return 16;//16 bits - - case AFMT_S32_LE: - case AFMT_S32_BE: - case AFMT_U32_LE: - case AFMT_U32_BE: - case AFMT_FLOAT: - return 32; - - case AFMT_S24_LE: - case AFMT_S24_BE: - case AFMT_U24_LE: - case AFMT_U24_BE: - return 24; - - case AFMT_MU_LAW: - case AFMT_A_LAW: - case AFMT_IMA_ADPCM: - case AFMT_S8: - case AFMT_U8: - case AFMT_MPEG: - case AFMT_AC3: - default: - return 8;//default 1 byte - - } - return 8; -} diff --git a/libao2/afmt.h b/libao2/afmt.h deleted file mode 100644 index 04dc762c1b..0000000000 --- a/libao2/afmt.h +++ /dev/null @@ -1,84 +0,0 @@ - -/* Defines that AFMT_ stuff */ - -#ifdef HAVE_SYS_SOUNDCARD_H -#include /* For AFMT_* on linux */ -#else -#ifdef HAVE_SOUNDCARD_H -#include /* OpenBSD have this instead of */ -#endif -#endif - -#include "config.h" /* for native endianness */ - -/* standard, old OSS audio formats */ -#ifndef AFMT_MU_LAW -# define AFMT_MU_LAW 0x00000001 -# define AFMT_A_LAW 0x00000002 -# define AFMT_IMA_ADPCM 0x00000004 -# define AFMT_U8 0x00000008 -# define AFMT_S16_LE 0x00000010 /* Little endian signed 16*/ -# define AFMT_S16_BE 0x00000020 /* Big endian signed 16 */ -# define AFMT_S8 0x00000040 -# define AFMT_U16_LE 0x00000080 /* Little endian U16 */ -# define AFMT_U16_BE 0x00000100 /* Big endian U16 */ -#endif - -#ifndef AFMT_MPEG -# define AFMT_MPEG 0x00000200 /* MPEG (2) audio */ -#endif - -#ifndef AFMT_AC3 -# define AFMT_AC3 0x00000400 /* Dolby Digital AC3 */ -#endif - -/* 24 bit formats from the linux kernel */ -#ifndef AFMT_S24_LE - -// FreeBSD fix... -#if AFMT_S32_LE == 0x1000 - -#define AFMT_S24_LE 0x00010000 -#define AFMT_S24_BE 0x00020000 -#define AFMT_U24_LE 0x00040000 -#define AFMT_U24_BE 0x00080000 - -#else - -#define AFMT_S24_LE 0x00000800 -#define AFMT_S24_BE 0x00001000 -#define AFMT_U24_LE 0x00002000 -#define AFMT_U24_BE 0x00004000 - -#endif - -#endif - -/* 32 bit formats from the linux kernel */ -#ifndef AFMT_S32_LE -#define AFMT_S32_LE 0x00008000 -#define AFMT_S32_BE 0x00010000 -#define AFMT_U32_LE 0x00020000 -#define AFMT_U32_BE 0x00040000 -#endif - -/* native endian formats */ -#ifndef AFMT_S16_NE -# if WORDS_BIGENDIAN -# define AFMT_S16_NE AFMT_S16_BE -# define AFMT_S24_NE AFMT_S24_BE -# define AFMT_S32_NE AFMT_S32_BE -# else -# define AFMT_S16_NE AFMT_S16_LE -# define AFMT_S24_NE AFMT_S24_LE -# define AFMT_S32_NE AFMT_S32_LE -# endif -#endif - -#ifndef AFMT_FLOAT -# define AFMT_FLOAT 0x00100000 -#endif - -/* for formats that don't have a corresponding AFMT_* type, - * use the flags from libaf/af_format.h or'ed with this */ -#define AFMT_AF_FLAGS 0x70000000 diff --git a/libao2/ao_alsa.c b/libao2/ao_alsa.c index 2aa6cdaebe..539fd0fa7c 100644 --- a/libao2/ao_alsa.c +++ b/libao2/ao_alsa.c @@ -37,7 +37,7 @@ #include "audio_out.h" #include "audio_out_internal.h" -#include "afmt.h" +#include "libaf/af_format.h" static ao_info_t info = { @@ -125,7 +125,7 @@ static int control(int cmd, void *arg) } if(mixer_device) card = mixer_device; - if(ao_data.format == AFMT_AC3) + if(ao_data.format == AF_FORMAT_AC3) return CONTROL_TRUE; //allocate simple id @@ -275,42 +275,42 @@ static int init(int rate_hz, int channels, int format, int flags) switch (format) { - case AFMT_S8: + case AF_FORMAT_S8: alsa_format = SND_PCM_FORMAT_S8; break; - case AFMT_U8: + case AF_FORMAT_U8: alsa_format = SND_PCM_FORMAT_U8; break; - case AFMT_U16_LE: + case AF_FORMAT_U16_LE: alsa_format = SND_PCM_FORMAT_U16_LE; break; - case AFMT_U16_BE: + case AF_FORMAT_U16_BE: alsa_format = SND_PCM_FORMAT_U16_BE; break; #ifndef WORDS_BIGENDIAN - case AFMT_AC3: + case AF_FORMAT_AC3: #endif - case AFMT_S16_LE: + case AF_FORMAT_S16_LE: alsa_format = SND_PCM_FORMAT_S16_LE; break; #ifdef WORDS_BIGENDIAN - case AFMT_AC3: + case AF_FORMAT_AC3: #endif - case AFMT_S16_BE: + case AF_FORMAT_S16_BE: alsa_format = SND_PCM_FORMAT_S16_BE; break; - case AFMT_S32_LE: + case AF_FORMAT_S32_LE: alsa_format = SND_PCM_FORMAT_S32_LE; break; - case AFMT_S32_BE: + case AF_FORMAT_S32_BE: alsa_format = SND_PCM_FORMAT_S32_BE; break; - case AFMT_FLOAT: + case AF_FORMAT_FLOAT_LE: alsa_format = SND_PCM_FORMAT_FLOAT_LE; break; default: - alsa_format = SND_PCM_FORMAT_MPEG; //? default should be -1 + alsa_format = SND_PCM_FORMAT_MPEG2; //? default should be -1 break; } @@ -412,7 +412,7 @@ static int init(int rate_hz, int channels, int format, int flags) * while opening the abstract alias for the spdif subdevice * 'iec958' */ - if (format == AFMT_AC3) { + if (format == AF_FORMAT_AC3) { unsigned char s[4]; switch (channels) { @@ -590,7 +590,7 @@ static int init(int rate_hz, int channels, int format, int flags) "alsa-init: format %s are not supported by hardware, trying default\n", audio_out_format_name(format)); alsa_format = SND_PCM_FORMAT_S16_LE; - ao_data.format = AFMT_S16_LE; + ao_data.format = AF_FORMAT_S16_LE; ao_data.bps = channels * rate_hz * 2; } diff --git a/libao2/ao_alsa5.c b/libao2/ao_alsa5.c index 68f2cbcaa5..ed073f55ae 100644 --- a/libao2/ao_alsa5.c +++ b/libao2/ao_alsa5.c @@ -13,7 +13,7 @@ #include "audio_out.h" #include "audio_out_internal.h" -#include "afmt.h" +#include "libaf/af_format.h" #include "mp_msg.h" #include "help_mp.h" @@ -75,28 +75,28 @@ static int init(int rate_hz, int channels, int format, int flags) memset(&alsa_format, 0, sizeof(alsa_format)); switch (format) { - case AFMT_S8: + case AF_FORMAT_S8: alsa_format.format = SND_PCM_SFMT_S8; break; - case AFMT_U8: + case AF_FORMAT_U8: alsa_format.format = SND_PCM_SFMT_U8; break; - case AFMT_U16_LE: + case AF_FORMAT_U16_LE: alsa_format.format = SND_PCM_SFMT_U16_LE; break; - case AFMT_U16_BE: + case AF_FORMAT_U16_BE: alsa_format.format = SND_PCM_SFMT_U16_BE; break; #ifndef WORDS_BIGENDIAN - case AFMT_AC3: + case AF_FORMAT_AC3: #endif - case AFMT_S16_LE: + case AF_FORMAT_S16_LE: alsa_format.format = SND_PCM_SFMT_S16_LE; break; #ifdef WORDS_BIGENDIAN - case AFMT_AC3: + case AF_FORMAT_AC3: #endif - case AFMT_S16_BE: + case AF_FORMAT_S16_BE: alsa_format.format = SND_PCM_SFMT_S16_BE; break; default: diff --git a/libao2/ao_arts.c b/libao2/ao_arts.c index 8d2918d74f..ad19b9845b 100644 --- a/libao2/ao_arts.c +++ b/libao2/ao_arts.c @@ -12,12 +12,12 @@ #include "audio_out.h" #include "audio_out_internal.h" -#include "afmt.h" +#include "libaf/af_format.h" #include "config.h" #include "mp_msg.h" #include "help_mp.h" -#define OBTAIN_BITRATE(a) (((a != AFMT_U8) && (a != AFMT_S8)) ? 16 : 8) +#define OBTAIN_BITRATE(a) (((a != AF_FORMAT_U8) && (a != AF_FORMAT_S8)) ? 16 : 8) /* Feel free to experiment with the following values: */ #define ARTS_PACKETS 10 /* Number of audio packets */ @@ -60,12 +60,12 @@ static int init(int rate_hz, int channels, int format, int flags) * using mplayer's audio filters. */ switch (format) { - case AFMT_U8: - case AFMT_S8: - format = AFMT_U8; + case AF_FORMAT_U8: + case AF_FORMAT_S8: + format = AF_FORMAT_U8; break; default: - format = AFMT_S16_LE; /* artsd always expects little endian?*/ + format = AF_FORMAT_S16_LE; /* artsd always expects little endian?*/ break; } @@ -74,7 +74,7 @@ static int init(int rate_hz, int channels, int format, int flags) ao_data.samplerate = rate_hz; ao_data.bps = (rate_hz*channels); - if(format != AFMT_U8 && format != AFMT_S8) + if(format != AF_FORMAT_U8 && format != AF_FORMAT_S8) ao_data.bps*=2; stream=arts_play_stream(rate_hz, OBTAIN_BITRATE(format), channels, "MPlayer"); diff --git a/libao2/ao_dsound.c b/libao2/ao_dsound.c index 0344c7410e..39ab901df8 100644 --- a/libao2/ao_dsound.c +++ b/libao2/ao_dsound.c @@ -28,7 +28,7 @@ #define DIRECTSOUND_VERSION 0x0600 #include -#include "afmt.h" +#include "libaf/af_format.h" #include "audio_out.h" #include "audio_out_internal.h" #include "mp_msg.h" @@ -265,7 +265,7 @@ static int write_buffer(unsigned char *data, int len) if (SUCCEEDED(res)) { - if( (ao_data.channels == 6) && (ao_data.format!=AFMT_AC3) ) { + if( (ao_data.channels == 6) && (ao_data.format!=AF_FORMAT_AC3) ) { // reorder channels while writing to pointers. // it's this easy because buffer size and len are always // aligned to multiples of channels*bytespersample @@ -366,14 +366,14 @@ static int init(int rate, int channels, int format, int flags) //check if the format is supported in general switch(format){ - case AFMT_AC3: - case AFMT_S24_LE: - case AFMT_S16_LE: - case AFMT_S8: + case AF_FORMAT_AC3: + case AF_FORMAT_S24_LE: + case AF_FORMAT_S16_LE: + case AF_FORMAT_S8: break; default: mp_msg(MSGT_AO, MSGL_V,"ao_dsound: format %s not supported defaulting to Signed 16-bit Little-Endian\n",audio_out_format_name(format)); - format=AFMT_S16_LE; + format=AF_FORMAT_S16_LE; } //fill global ao_data ao_data.channels = channels; @@ -389,7 +389,7 @@ static int init(int rate, int channels, int format, int flags) wformat.Format.cbSize = (channels > 2) ? sizeof(WAVEFORMATEXTENSIBLE)-sizeof(WAVEFORMATEX) : 0; wformat.Format.nChannels = channels; wformat.Format.nSamplesPerSec = rate; - if (format == AFMT_AC3) { + if (format == AF_FORMAT_AC3) { wformat.Format.wFormatTag = WAVE_FORMAT_DOLBY_AC3_SPDIF; wformat.Format.wBitsPerSample = 16; wformat.Format.nBlockAlign = 4; diff --git a/libao2/ao_dxr2.c b/libao2/ao_dxr2.c index 7ec4d2c499..f495d12ed4 100644 --- a/libao2/ao_dxr2.c +++ b/libao2/ao_dxr2.c @@ -11,8 +11,7 @@ #include "audio_out.h" #include "audio_out_internal.h" - -#include "afmt.h" +#include "libaf/af_format.h" static ao_info_t info = @@ -158,9 +157,9 @@ static int get_space(){ // return: number of bytes played static int play(void* data,int len,int flags){ // MPEG and AC3 don't work :-( - if(ao_data.format==AFMT_MPEG) + if(ao_data.format==AF_FORMAT_MPEG2) dxr2_send_packet(data,len,0xC0,ao_data.pts); - else if(ao_data.format==AFMT_AC3) + else if(ao_data.format==AF_FORMAT_AC3) dxr2_send_packet(data,len,0x80,ao_data.pts); else { int i; diff --git a/libao2/ao_esd.c b/libao2/ao_esd.c index 11001062d6..a850ad6009 100644 --- a/libao2/ao_esd.c +++ b/libao2/ao_esd.c @@ -32,7 +32,7 @@ #include "audio_out.h" #include "audio_out_internal.h" -#include "afmt.h" +#include "libaf/af_format.h" #include "config.h" #include "mp_msg.h" #include "help_mp.h" @@ -200,14 +200,14 @@ static int init(int rate_hz, int channels, int format, int flags) /* EsounD can play 8bit unsigned and 16bit signed native */ switch (format) { - case AFMT_S8: - case AFMT_U8: + case AF_FORMAT_S8: + case AF_FORMAT_U8: esd_fmt |= ESD_BITS8; - ao_data.format = AFMT_U8; + ao_data.format = AF_FORMAT_U8; break; default: esd_fmt |= ESD_BITS16; - ao_data.format = AFMT_S16_NE; + ao_data.format = AF_FORMAT_S16_NE; bytes_per_sample *= 2; break; } diff --git a/libao2/ao_jack.c b/libao2/ao_jack.c index 0f4ce43061..6e11c9752d 100644 --- a/libao2/ao_jack.c +++ b/libao2/ao_jack.c @@ -14,7 +14,7 @@ #include "audio_out.h" #include "audio_out_internal.h" -#include "afmt.h" +#include "libaf/af_format.h" #include "config.h" #include "mp_msg.h" @@ -146,14 +146,14 @@ static int init(int rate_hz, int channels, int format, int flags) } switch (format) { - case AFMT_U8: - case AFMT_S8: - format = AFMT_U8; + case AF_FORMAT_U8: + case AF_FORMAT_S8: + format = AF_FORMAT_U8; bits_per_sample = 8; m = 1; break; default: - format = AFMT_S16_LE; + format = AF_FORMAT_S16_LE; bits_per_sample = 16; m = 2; break; diff --git a/libao2/ao_macosx.c b/libao2/ao_macosx.c index b13fcac4c9..8ab0ab2b3c 100644 --- a/libao2/ao_macosx.c +++ b/libao2/ao_macosx.c @@ -47,7 +47,7 @@ #include "audio_out.h" #include "audio_out_internal.h" -#include "afmt.h" +#include "libaf/af_format.h" static ao_info_t info = { @@ -252,7 +252,7 @@ static int init(int rate,int channels,int format,int flags) if (ao->outputStreamBasicDescription.mFormatID == kAudioFormatLinearPCM) { uint32_t flags = ao->outputStreamBasicDescription.mFormatFlags; if (flags & kAudioFormatFlagIsFloat) { - ao_data.format = AFMT_FLOAT; + ao_data.format = AF_FORMAT_FLOAT_NE; } else { ao_msg(MSGT_AO,MSGL_WARN, "Unsupported audio output " "format %d. Please report this to the developer\n", diff --git a/libao2/ao_mpegpes.c b/libao2/ao_mpegpes.c index be9ad4a7f2..925d78b609 100644 --- a/libao2/ao_mpegpes.c +++ b/libao2/ao_mpegpes.c @@ -15,7 +15,7 @@ #include "audio_out.h" #include "audio_out_internal.h" -#include "afmt.h" +#include "libaf/af_format.h" #include "mp_msg.h" #include "help_mp.h" @@ -96,14 +96,14 @@ static int init(int rate,int channels,int format,int flags){ ao_data.channels=2; ao_data.outburst=2000; switch(format){ - case AFMT_S16_LE: - case AFMT_S16_BE: - case AFMT_MPEG: - case AFMT_AC3: + case AF_FORMAT_S16_LE: + case AF_FORMAT_S16_BE: + case AF_FORMAT_MPEG2: + case AF_FORMAT_AC3: ao_data.format=format; break; default: - ao_data.format=AFMT_S16_BE; + ao_data.format=AF_FORMAT_S16_BE; } retry: @@ -174,14 +174,14 @@ static int get_space(){ // return: number of bytes played static int play(void* data,int len,int flags){ // printf("\nao_mpegpes: play(%d) freq=%d\n",len,freq_id); - if(ao_data.format==AFMT_MPEG) + if(ao_data.format==AF_FORMAT_MPEG2) send_pes_packet(data,len,0x1C0,ao_data.pts); else { int i; unsigned short *s=data; // if(len>2000) len=2000; // printf("ao_mpegpes: len=%d \n",len); - if(ao_data.format==AFMT_S16_LE || ao_data.format==AFMT_AC3) + if(ao_data.format==AF_FORMAT_S16_LE || ao_data.format==AF_FORMAT_AC3) for(i=0;i>8)|(s[i]<<8); // le<->be send_lpcm_packet(data,len,0xA0,ao_data.pts,freq_id); } diff --git a/libao2/ao_nas.c b/libao2/ao_nas.c index 6f77bcbd9e..5955ac1b89 100644 --- a/libao2/ao_nas.c +++ b/libao2/ao_nas.c @@ -37,7 +37,7 @@ #include "audio_out.h" #include "audio_out_internal.h" -#include "afmt.h" +#include "libaf/af_format.h" #define NAS_FRAG_SIZE 4096 @@ -312,22 +312,22 @@ static AuDeviceID nas_find_device(AuServer *aud, int nch) static unsigned int nas_aformat_to_auformat(unsigned int *format) { switch (*format) { - case AFMT_U8: + case AF_FORMAT_U8: return AuFormatLinearUnsigned8; - case AFMT_S8: + case AF_FORMAT_S8: return AuFormatLinearSigned8; - case AFMT_U16_LE: + case AF_FORMAT_U16_LE: return AuFormatLinearUnsigned16LSB; - case AFMT_U16_BE: + case AF_FORMAT_U16_BE: return AuFormatLinearUnsigned16MSB; - case AFMT_S16_LE: + case AF_FORMAT_S16_LE: return AuFormatLinearSigned16LSB; - case AFMT_S16_BE: + case AF_FORMAT_S16_BE: return AuFormatLinearSigned16MSB; - case AFMT_MU_LAW: + case AF_FORMAT_MU_LAW: return AuFormatULAW8; default: - *format=AFMT_S16_NE; + *format=AF_FORMAT_S16_NE; return nas_aformat_to_auformat(format); } } diff --git a/libao2/ao_null.c b/libao2/ao_null.c index 59d115a400..80f3f6c351 100644 --- a/libao2/ao_null.c +++ b/libao2/ao_null.c @@ -2,7 +2,7 @@ #include #include -#include "afmt.h" +#include "libaf/af_format.h" #include "audio_out.h" #include "audio_out_internal.h" @@ -55,7 +55,7 @@ static int init(int rate,int channels,int format,int flags){ ao_data.samplerate=rate; ao_data.format=format; ao_data.bps=channels*rate; - if (format != AFMT_U8 && format != AFMT_S8) + if (format != AF_FORMAT_U8 && format != AF_FORMAT_S8) ao_data.bps*=2; buffer=0; gettimeofday(&last_tv, 0); diff --git a/libao2/ao_oss.c b/libao2/ao_oss.c index 8028835b81..7fa33e4603 100644 --- a/libao2/ao_oss.c +++ b/libao2/ao_oss.c @@ -9,14 +9,21 @@ #include #include #include -//#include #include "config.h" #include "mp_msg.h" #include "mixer.h" #include "help_mp.h" -#include "afmt.h" +#ifdef HAVE_SYS_SOUNDCARD_H +#include +#else +#ifdef HAVE_SOUNDCARD_H +#include +#endif +#endif + +#include "../libaf/af_format.h" #include "audio_out.h" #include "audio_out_internal.h" @@ -33,6 +40,86 @@ static ao_info_t info = LIBAO_EXTERN(oss) +static int format2oss(int format) +{ + switch(format) + { + case AF_FORMAT_U8: return AFMT_U8; + case AF_FORMAT_S8: return AFMT_S8; + case AF_FORMAT_U16_LE: return AFMT_U16_LE; + case AF_FORMAT_U16_BE: return AFMT_U16_BE; + case AF_FORMAT_S16_LE: return AFMT_S16_LE; + case AF_FORMAT_S16_BE: return AFMT_S16_BE; +#ifdef AFMT_S24_LE + case AF_FORMAT_U24_LE: return AFMT_U24_LE; + case AF_FORMAT_U24_BE: return AFMT_U24_BE; + case AF_FORMAT_S24_LE: return AFMT_S24_LE; + case AF_FORMAT_S24_BE: return AFMT_S24_BE; +#endif +#ifdef AFMT_S32_LE + case AF_FORMAT_U32_LE: return AFMT_U32_LE; + case AF_FORMAT_U32_BE: return AFMT_U32_BE; + case AF_FORMAT_S32_LE: return AFMT_S32_LE; + case AF_FORMAT_S32_BE: return AFMT_S32_BE; +#endif +#ifdef AFMT_FLOAT + case AF_FORMAT_FLOAT_NE: return AFMT_FLOAT; +#endif + // SPECIALS + case AF_FORMAT_MU_LAW: return AFMT_MU_LAW; + case AF_FORMAT_A_LAW: return AFMT_A_LAW; + case AF_FORMAT_IMA_ADPCM: return AFMT_IMA_ADPCM; +#ifdef AFMT_MPEG + case AF_FORMAT_MPEG2: return AFMT_MPEG; +#endif +#ifdef AFMT_AC3 + case AF_FORMAT_AC3: return AFMT_AC3; +#endif + } + printf("Unknown format: %x\n", format); + return -1; +} + +static int oss2format(int format) +{ + switch(format) + { + case AFMT_U8: return AF_FORMAT_U8; + case AFMT_S8: return AF_FORMAT_S8; + case AFMT_U16_LE: return AF_FORMAT_U16_LE; + case AFMT_U16_BE: return AF_FORMAT_U16_BE; + case AFMT_S16_LE: return AF_FORMAT_S16_LE; + case AFMT_S16_BE: return AF_FORMAT_S16_BE; +#ifdef AFMT_S24_LE + case AFMT_U24_LE: return AF_FORMAT_U24_LE; + case AFMT_U24_BE: return AF_FORMAT_U24_BE; + case AFMT_S24_LE: return AF_FORMAT_S24_LE; + case AFMT_S24_BE: return AF_FORMAT_S24_BE; +#endif +#ifdef AFMT_S32_LE + case AFMT_U32_LE: return AF_FORMAT_U32_LE; + case AFMT_U32_BE: return AF_FORMAT_U32_BE; + case AFMT_S32_LE: return AF_FORMAT_S32_LE; + case AFMT_S32_BE: return AF_FORMAT_S32_BE; +#endif +#ifdef AFMT_FLOAT + case AFMT_FLOAT: return AF_FORMAT_FLOAT_NE; +#endif + // SPECIALS + case AFMT_MU_LAW: return AF_FORMAT_MU_LAW; + case AFMT_A_LAW: return AF_FORMAT_A_LAW; + case AFMT_IMA_ADPCM: return AF_FORMAT_IMA_ADPCM; +#ifdef AFMT_MPEG + case AFMT_MPEG: return AF_FORMAT_MPEG2; +#endif +#ifdef AFMT_AC3 + case AFMT_AC3: return AF_FORMAT_AC3; +#endif + } + printf("Unknown format: %x\n", format); + return -1; +} + static char *dsp=PATH_DEV_DSP; static audio_buf_info zz; static int audio_fd=-1; @@ -57,7 +144,7 @@ static int control(int cmd,void *arg){ ao_control_vol_t *vol = (ao_control_vol_t *)arg; int fd, v, devs; - if(ao_data.format == AFMT_AC3) + if(ao_data.format == AF_FORMAT_AC3) return CONTROL_TRUE; if ((fd = open(oss_mixer_device, O_RDONLY)) > 0) @@ -95,9 +182,10 @@ static int control(int cmd,void *arg){ // return: 1=success 0=fail static int init(int rate,int channels,int format,int flags){ char *mixer_channels [SOUND_MIXER_NRDEVICES] = SOUND_DEVICE_NAMES; + int oss_format; - mp_msg(MSGT_AO,MSGL_V,"ao2: %d Hz %d chans %s\n",rate,channels, - audio_out_format_name(format)); +// mp_msg(MSGT_AO,MSGL_V,"ao2: %d Hz %d chans %s\n",rate,channels, +// audio_out_format_name(format)); if (ao_subdevice) dsp = ao_subdevice; @@ -160,32 +248,39 @@ static int init(int rate,int channels,int format,int flags){ fcntl(audio_fd, F_SETFD, FD_CLOEXEC); #endif - if(format == AFMT_AC3) { + if(format == AF_FORMAT_AC3) { ao_data.samplerate=rate; ioctl (audio_fd, SNDCTL_DSP_SPEED, &ao_data.samplerate); } ac3_retry: ao_data.format=format; - if( ioctl(audio_fd, SNDCTL_DSP_SETFMT, &ao_data.format)<0 || - ao_data.format != format) if(format == AFMT_AC3){ + oss_format=format2oss(format); + if (oss_format == -1) return 0; + if( ioctl(audio_fd, SNDCTL_DSP_SETFMT, &oss_format)<0 || + oss_format != format2oss(format)) if(format == AF_FORMAT_AC3){ mp_msg(MSGT_AO,MSGL_WARN, MSGTR_AO_OSS_CantSetAC3, dsp); #ifdef WORDS_BIGENDIAN - format=AFMT_S16_BE; + oss_format=AFMT_S16_BE; + format=AF_FORMAT_S16_BE; #else - format=AFMT_S16_LE; + oss_format=AFMT_S16_LE; + format=AF_FORMAT_S16_LE; #endif goto ac3_retry; } - mp_msg(MSGT_AO,MSGL_V,"audio_setup: sample format: %s (requested: %s)\n", - audio_out_format_name(ao_data.format), audio_out_format_name(format)); +// mp_msg(MSGT_AO,MSGL_V,"audio_setup: sample format: %s (requested: %s)\n", +// audio_out_format_name(ao_data.format), audio_out_format_name(format)); #if 0 - if(ao_data.format!=format) + if(oss_format!=format2oss(format)) mp_msg(MSGT_AO,MSGL_WARN,"WARNING! Your soundcard does NOT support %s sample format! Broken audio or bad playback speed are possible! Try with '-aop list=format'\n",audio_out_format_name(format)); #endif + + ao_data.format = oss2format(oss_format); + if (ao_data.format == -1) return 0; ao_data.channels = channels; - if(format != AFMT_AC3) { + if(format != AF_FORMAT_AC3) { // We only use SNDCTL_DSP_CHANNELS for >2 channels, in case some drivers don't have it if (ao_data.channels > 2) { if ( ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &ao_data.channels) == -1 || @@ -253,7 +348,7 @@ ac3_retry: } ao_data.bps=ao_data.channels; - if(ao_data.format != AFMT_U8 && ao_data.format != AFMT_S8) + if(ao_data.format != AF_FORMAT_U8 && ao_data.format != AF_FORMAT_S8) ao_data.bps*=2; ao_data.outburst-=ao_data.outburst % ao_data.bps; // round down @@ -280,6 +375,7 @@ static void uninit(int immed){ // stop playing and empty buffers (for seeking/pause) static void reset(){ + int oss_format; uninit(1); audio_fd=open(dsp, O_WRONLY); if(audio_fd < 0){ @@ -291,8 +387,9 @@ static void reset(){ fcntl(audio_fd, F_SETFD, FD_CLOEXEC); #endif - ioctl (audio_fd, SNDCTL_DSP_SETFMT, &ao_data.format); - if(ao_data.format != AFMT_AC3) { + oss_format = format2oss(ao_data.format); + ioctl (audio_fd, SNDCTL_DSP_SETFMT, &oss_format); + if(ao_data.format != AF_FORMAT_AC3) { if (ao_data.channels > 2) ioctl (audio_fd, SNDCTL_DSP_CHANNELS, &ao_data.channels); else { diff --git a/libao2/ao_pcm.c b/libao2/ao_pcm.c index d1cf65f2a0..609f79c9f0 100644 --- a/libao2/ao_pcm.c +++ b/libao2/ao_pcm.c @@ -5,7 +5,7 @@ #include #include "bswap.h" -#include "afmt.h" +#include "libaf/af_format.h" #include "audio_out.h" #include "audio_out_internal.h" #include "mp_msg.h" @@ -89,12 +89,12 @@ static int init(int rate,int channels,int format,int flags){ bits=8; switch(format){ - case AFMT_S8: - format=AFMT_U8; - case AFMT_U8: + case AF_FORMAT_S8: + format=AF_FORMAT_U8; + case AF_FORMAT_U8: break; default: - format=AFMT_S16_LE; + format=AF_FORMAT_S16_LE; bits=16; break; } @@ -114,9 +114,9 @@ static int init(int rate,int channels,int format,int flags){ wavhdr.data_length=le2me_32(0x7ffff000); wavhdr.file_length = wavhdr.data_length + sizeof(wavhdr) - 8; - mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AO_PCM_FileInfo, ao_outputfilename, - (ao_pcm_waveheader?"WAVE":"RAW PCM"), rate, - (channels > 1) ? "Stereo" : "Mono", audio_out_format_name(format)); +// mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AO_PCM_FileInfo, ao_outputfilename, +// (ao_pcm_waveheader?"WAVE":"RAW PCM"), rate, +// (channels > 1) ? "Stereo" : "Mono", audio_out_format_name(format)); mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AO_PCM_HintInfo); fp = fopen(ao_outputfilename, "wb"); diff --git a/libao2/ao_plugin.c b/libao2/ao_plugin.c index 357d338743..0da8959c3e 100644 --- a/libao2/ao_plugin.c +++ b/libao2/ao_plugin.c @@ -6,7 +6,7 @@ #include "mp_msg.h" #include "help_mp.h" -#include "afmt.h" +#include "libaf/af_format.h" #include "audio_out.h" #include "audio_out_internal.h" @@ -140,7 +140,7 @@ static int init(int rate,int channels,int format,int flags){ ao_plugin_local_data.format=format; ao_plugin_local_data.channels=channels; - ao_plugin_local_data.bpm=audio_out_format_bits(format); + ao_plugin_local_data.bpm=af_fmt2bits(format); ao_plugin_data.rate=rate; ao_plugin_data.channels=channels; @@ -168,7 +168,7 @@ static int init(int rate,int channels,int format,int flags){ // Calculate bps ao_plugin_local_data.bps=(float)(ao_plugin_data.rate * ao_plugin_data.channels); - ao_plugin_local_data.bps*=audio_out_format_bits(ao_plugin_data.format)/8; + ao_plugin_local_data.bps*=af_fmt2bits(ao_plugin_data.format)/8; // This should never happen but check anyway if(NULL==ao_plugin_local_data.driver) diff --git a/libao2/ao_polyp.c b/libao2/ao_polyp.c index ef072d2381..e75d05aaf4 100644 --- a/libao2/ao_polyp.c +++ b/libao2/ao_polyp.c @@ -6,7 +6,7 @@ #include "audio_out.h" #include "audio_out_internal.h" -#include "afmt.h" +#include "libaf/af_format.h" #include "config.h" #include "mp_msg.h" @@ -91,16 +91,16 @@ static int init(int rate_hz, int channels, int format, int flags) { ss.rate = rate_hz; switch (format) { - case AFMT_U8: + case AF_FORMAT_U8: ss.format = PA_SAMPLE_U8; break; - case AFMT_S16_LE: + case AF_FORMAT_S16_LE: ss.format = PA_SAMPLE_S16LE; break; - case AFMT_S16_BE: + case AF_FORMAT_S16_BE: ss.format = PA_SAMPLE_S16BE; break; - case AFMT_FLOAT: + case AF_FORMAT_FLOAT_NE: ss.format = PA_SAMPLE_FLOAT32; break; default: diff --git a/libao2/ao_sdl.c b/libao2/ao_sdl.c index 73a2c05a3d..bc2db2e258 100644 --- a/libao2/ao_sdl.c +++ b/libao2/ao_sdl.c @@ -20,7 +20,7 @@ #include "audio_out.h" #include "audio_out_internal.h" -#include "afmt.h" +#include "libaf/af_format.h" #include #include "osdep/timer.h" @@ -181,7 +181,7 @@ static int init(int rate,int channels,int format,int flags){ /* Allocate ring-buffer memory */ buffer = (unsigned char *) malloc(BUFFSIZE); - mp_msg(MSGT_AO,MSGL_INFO,MSGTR_AO_SDL_INFO, rate, (channels > 1) ? "Stereo" : "Mono", audio_out_format_name(format)); +// mp_msg(MSGT_AO,MSGL_INFO,MSGTR_AO_SDL_INFO, rate, (channels > 1) ? "Stereo" : "Mono", audio_out_format_name(format)); if(ao_subdevice) { setenv("SDL_AUDIODRIVER", ao_subdevice, 1); @@ -193,32 +193,32 @@ static int init(int rate,int channels,int format,int flags){ ao_data.format=format; ao_data.bps=channels*rate; - if(format != AFMT_U8 && format != AFMT_S8) + if(format != AF_FORMAT_U8 && format != AF_FORMAT_S8) ao_data.bps*=2; /* The desired audio format (see SDL_AudioSpec) */ switch(format) { - case AFMT_U8: + case AF_FORMAT_U8: aspec.format = AUDIO_U8; break; - case AFMT_S16_LE: + case AF_FORMAT_S16_LE: aspec.format = AUDIO_S16LSB; break; - case AFMT_S16_BE: + case AF_FORMAT_S16_BE: aspec.format = AUDIO_S16MSB; break; - case AFMT_S8: + case AF_FORMAT_S8: aspec.format = AUDIO_S8; break; - case AFMT_U16_LE: + case AF_FORMAT_U16_LE: aspec.format = AUDIO_U16LSB; break; - case AFMT_U16_BE: + case AF_FORMAT_U16_BE: aspec.format = AUDIO_U16MSB; break; default: aspec.format = AUDIO_S16LSB; - ao_data.format = AFMT_S16_LE; + ao_data.format = AF_FORMAT_S16_LE; mp_msg(MSGT_AO,MSGL_WARN,MSGTR_AO_SDL_UnsupportedAudioFmt, format); } @@ -256,22 +256,22 @@ void callback(void *userdata, Uint8 *stream, int len); userdata is the pointer s switch(obtained.format) { case AUDIO_U8 : - ao_data.format = AFMT_U8; + ao_data.format = AF_FORMAT_U8; break; case AUDIO_S16LSB : - ao_data.format = AFMT_S16_LE; + ao_data.format = AF_FORMAT_S16_LE; break; case AUDIO_S16MSB : - ao_data.format = AFMT_S16_BE; + ao_data.format = AF_FORMAT_S16_BE; break; case AUDIO_S8 : - ao_data.format = AFMT_S8; + ao_data.format = AF_FORMAT_S8; break; case AUDIO_U16LSB : - ao_data.format = AFMT_U16_LE; + ao_data.format = AF_FORMAT_U16_LE; break; case AUDIO_U16MSB : - ao_data.format = AFMT_U16_BE; + ao_data.format = AF_FORMAT_U16_BE; break; default: mp_msg(MSGT_AO,MSGL_WARN,MSGTR_AO_SDL_UnsupportedAudioFmt, obtained.format); diff --git a/libao2/ao_win32.c b/libao2/ao_win32.c index ba004c7b26..e589ced8c1 100644 --- a/libao2/ao_win32.c +++ b/libao2/ao_win32.c @@ -23,7 +23,7 @@ #include #include -#include "afmt.h" +#include "libaf/af_format.h" #include "audio_out.h" #include "audio_out_internal.h" #include "mp_msg.h" @@ -149,21 +149,21 @@ static int init(int rate,int channels,int format,int flags) int i; switch(format){ - case AFMT_AC3: - case AFMT_S24_LE: - case AFMT_S16_LE: - case AFMT_S8: + case AF_FORMAT_AC3: + case AF_FORMAT_S24_LE: + case AF_FORMAT_S16_LE: + case AF_FORMAT_S8: break; default: mp_msg(MSGT_AO, MSGL_V,"ao_win32: format %s not supported defaulting to Signed 16-bit Little-Endian\n",audio_out_format_name(format)); - format=AFMT_S16_LE; + format=AF_FORMAT_S16_LE; } //fill global ao_data ao_data.channels=channels; ao_data.samplerate=rate; ao_data.format=format; ao_data.bps=channels*rate; - if(format != AFMT_U8 && format != AFMT_S8) + if(format != AF_FORMAT_U8 && format != AF_FORMAT_S8) ao_data.bps*=2; if(ao_data.buffersize==-1) { @@ -179,7 +179,7 @@ static int init(int rate,int channels,int format,int flags) wformat.Format.cbSize = (channels>2)?sizeof(WAVEFORMATEXTENSIBLE)-sizeof(WAVEFORMATEX):0; wformat.Format.nChannels = channels; wformat.Format.nSamplesPerSec = rate; - if(format == AFMT_AC3) + if(format == AF_FORMAT_AC3) { wformat.Format.wFormatTag = WAVE_FORMAT_DOLBY_AC3_SPDIF; wformat.Format.wBitsPerSample = 16; @@ -208,7 +208,7 @@ static int init(int rate,int channels,int format,int flags) mp_msg(MSGT_AO, MSGL_ERR,"ao_win32: format not supported switching to default\n"); ao_data.channels = wformat.Format.nChannels = 2; ao_data.samplerate = wformat.Format.nSamplesPerSec = 44100; - ao_data.format = AFMT_S16_LE; + ao_data.format = AF_FORMAT_S16_LE; ao_data.bps=ao_data.channels * ao_data.samplerate*2; wformat.Format.wBitsPerSample=16; wformat.Format.wFormatTag=WAVE_FORMAT_PCM; diff --git a/libao2/audio_out.c b/libao2/audio_out.c index 97691bc2d7..0bd37ad555 100644 --- a/libao2/audio_out.c +++ b/libao2/audio_out.c @@ -4,7 +4,6 @@ #include "config.h" #include "audio_out.h" -#include "afmt.h" #include "mp_msg.h" #include "help_mp.h" @@ -187,6 +186,7 @@ ao_functions_t* init_best_audio_out(char** ao_list,int use_plugin,int rate,int c audio_out_plugin.control(AOCONTROL_SET_PLUGIN_DRIVER,audio_out); audio_out=&audio_out_plugin; } +// if(audio_out->control(AOCONTROL_QUERY_FORMAT, (int)format) == CONTROL_TRUE) if(audio_out->init(rate,channels,format,flags)) return audio_out; // success! } diff --git a/libao2/audio_plugin.h b/libao2/audio_plugin.h index 170efea901..1936e19d36 100644 --- a/libao2/audio_plugin.h +++ b/libao2/audio_plugin.h @@ -45,7 +45,7 @@ extern ao_plugin_cfg_t ao_plugin_cfg; // Configuration defaults #define CFG_DEFAULTS { \ NULL, \ - AFMT_S16_LE, \ + AF_FORMAT_S16_LE, \ 0, \ 48000, \ 101, \ diff --git a/libao2/pl_delay.c b/libao2/pl_delay.c index e39489505f..ed1693431c 100644 --- a/libao2/pl_delay.c +++ b/libao2/pl_delay.c @@ -12,7 +12,7 @@ #include "audio_out.h" #include "audio_plugin.h" #include "audio_plugin_internal.h" -#include "afmt.h" +#include "libaf/af_format.h" static ao_info_t info = { @@ -65,7 +65,7 @@ static int init(){ // Tell ao_plugin how much this plugin adds to the overall time delay time_delay=-1*(float)ao_plugin_cfg.pl_delay_len/((float)pl_delay.channels*(float)pl_delay.rate); - if(pl_delay.format != AFMT_U8 && pl_delay.format != AFMT_S8) + if(pl_delay.format != AF_FORMAT_U8 && pl_delay.format != AF_FORMAT_S8) time_delay/=2; ao_plugin_data.delay_fix+=time_delay; diff --git a/libao2/pl_eq.c b/libao2/pl_eq.c index bb30470d91..1165b8033d 100644 --- a/libao2/pl_eq.c +++ b/libao2/pl_eq.c @@ -24,7 +24,7 @@ #include "audio_out.h" #include "audio_plugin.h" #include "audio_plugin_internal.h" -#include "afmt.h" +#include "libaf/af_format.h" #include "eq.h" static ao_info_t info = @@ -122,7 +122,7 @@ static int init(){ float F[KM] = CF; // Check input format - if(ao_plugin_data.format != AFMT_S16_NE){ + if(ao_plugin_data.format != AF_FORMAT_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 845a984a15..9f3404d5fe 100644 --- a/libao2/pl_extrastereo.c +++ b/libao2/pl_extrastereo.c @@ -19,7 +19,7 @@ #include "audio_out.h" #include "audio_plugin.h" #include "audio_plugin_internal.h" -#include "afmt.h" +#include "libaf/af_format.h" static ao_info_t info = { "Extra stereo plugin", @@ -57,7 +57,7 @@ static int control(int cmd,void *arg){ // return: 1=success 0=fail static int init(){ switch(ao_plugin_data.format){ - case(AFMT_S16_NE): + case(AF_FORMAT_S16_NE): break; default: fprintf(stderr,"[pl_extrastereo] Audio format not yet suported \n"); @@ -87,7 +87,7 @@ static void reset(){ static int play(){ switch(pl_extrastereo.format){ - case(AFMT_S16_NE): { + case(AF_FORMAT_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_format.c b/libao2/pl_format.c index 87b5bc8720..46ddaaa6a6 100644 --- a/libao2/pl_format.c +++ b/libao2/pl_format.c @@ -16,7 +16,7 @@ #include "audio_out.h" #include "audio_plugin.h" #include "audio_plugin_internal.h" -#include "afmt.h" +#include "libaf/af_format.h" static ao_info_t info = { @@ -75,29 +75,30 @@ static int control(int cmd,void *arg){ // open & setup audio device // return: 1=success 0=fail static int init(){ + char buf1[128], buf2[128]; // Sheck input format switch(ao_plugin_data.format){ - case(AFMT_U8): + case(AF_FORMAT_U8): pl_format.in=LE|B08|US; break; - case(AFMT_S8): + case(AF_FORMAT_S8): pl_format.in=LE|B08|SI; break; - case(AFMT_S16_LE): + case(AF_FORMAT_S16_LE): pl_format.in=LE|B16|SI; break; - case(AFMT_S16_BE): + case(AF_FORMAT_S16_BE): pl_format.in=BE|B16|SI; break; - case(AFMT_U16_LE): + case(AF_FORMAT_U16_LE): pl_format.in=LE|B16|US; break; - case(AFMT_U16_BE): + case(AF_FORMAT_U16_BE): pl_format.in=BE|B16|US; break; - case(AFMT_S32_LE): + case(AF_FORMAT_S32_LE): pl_format.in=LE|B32|SI; break; - case(AFMT_S32_BE): + case(AF_FORMAT_S32_BE): pl_format.in=BE|B32|SI; break; - case(AFMT_IMA_ADPCM): - case(AFMT_MU_LAW): - case(AFMT_A_LAW): - case(AFMT_MPEG): - case(AFMT_AC3): + case(AF_FORMAT_IMA_ADPCM): + case(AF_FORMAT_MU_LAW): + case(AF_FORMAT_A_LAW): + case(AF_FORMAT_MPEG2): + case(AF_FORMAT_AC3): printf("[pl_format] Input audio format not yet suported \n"); return 0; default: @@ -106,27 +107,27 @@ static int init(){ } // Sheck output format switch(ao_plugin_cfg.pl_format_type){ - case(AFMT_U8): + case(AF_FORMAT_U8): pl_format.out=LE|B08|US; break; - case(AFMT_S8): + case(AF_FORMAT_S8): pl_format.out=LE|B08|SI; break; - case(AFMT_S16_LE): + case(AF_FORMAT_S16_LE): pl_format.out=LE|B16|SI; break; - case(AFMT_S16_BE): + case(AF_FORMAT_S16_BE): pl_format.out=BE|B16|SI; break; - case(AFMT_U16_LE): + case(AF_FORMAT_U16_LE): pl_format.out=LE|B16|US; break; - case(AFMT_U16_BE): + case(AF_FORMAT_U16_BE): pl_format.out=BE|B16|US; break; - case(AFMT_S32_LE): + case(AF_FORMAT_S32_LE): pl_format.out=LE|B32|SI; break; - case(AFMT_S32_BE): + case(AF_FORMAT_S32_BE): pl_format.out=BE|B32|SI; break; - case(AFMT_IMA_ADPCM): - case(AFMT_MU_LAW): - case(AFMT_A_LAW): - case(AFMT_MPEG): - case(AFMT_AC3): + case(AF_FORMAT_IMA_ADPCM): + case(AF_FORMAT_MU_LAW): + case(AF_FORMAT_A_LAW): + case(AF_FORMAT_MPEG2): + case(AF_FORMAT_AC3): printf("[pl_format] Output audio format not yet suported \n"); return 0; default: @@ -136,8 +137,8 @@ static int init(){ // Tell the world what we are up to printf("[pl_format] Input format: %s, output format: %s \n", - audio_out_format_name(ao_plugin_data.format), - audio_out_format_name(ao_plugin_cfg.pl_format_type)); + af_fmt2str(ao_plugin_data.format, &buf1, 128), + af_fmt2str(ao_plugin_cfg.pl_format_type, &buf2, 128)); // We are changing the format ao_plugin_data.format=ao_plugin_cfg.pl_format_type; diff --git a/libao2/pl_resample.c b/libao2/pl_resample.c index 505eb0aa1d..b240fdd25e 100644 --- a/libao2/pl_resample.c +++ b/libao2/pl_resample.c @@ -23,7 +23,7 @@ #include "audio_out.h" #include "audio_plugin.h" #include "audio_plugin_internal.h" -#include "afmt.h" +#include "libaf/af_format.h" static ao_info_t info = { @@ -119,7 +119,7 @@ static int init(){ pl_resample.up=UP; // Sheck input format - if(ao_plugin_data.format != AFMT_S16_NE){ + if(ao_plugin_data.format != AF_FORMAT_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 e0e6e52570..6700bd5471 100644 --- a/libao2/pl_surround.c +++ b/libao2/pl_surround.c @@ -44,7 +44,7 @@ #include "audio_out.h" #include "audio_plugin.h" #include "audio_plugin_internal.h" -#include "afmt.h" +#include "libaf/af_format.h" #include "remez.h" #include "firfilter.c" @@ -108,8 +108,8 @@ static int init(){ pl_surround.passthrough = 1; return 1; } - 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"); + if (ao_plugin_data.format != AF_FORMAT_S16_NE) { + fprintf(stderr, "pl_surround: I'm dumb and can only handle AF_FORMAT_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 dd5d0a4e9b..4a4823a244 100644 --- a/libao2/pl_volnorm.c +++ b/libao2/pl_volnorm.c @@ -30,7 +30,7 @@ #include "audio_out.h" #include "audio_plugin.h" #include "audio_plugin_internal.h" -#include "afmt.h" +#include "libaf/af_format.h" static ao_info_t info = { "Volume normalizer", @@ -116,7 +116,7 @@ static int control(int cmd,void *arg){ // return: 1=success 0=fail static int init(){ switch(ao_plugin_data.format){ - case(AFMT_S16_NE): + case(AF_FORMAT_S16_NE): break; default: fprintf(stderr,"[pl_volnorm] Audio format not yet supported.\n"); @@ -142,7 +142,7 @@ static void reset(){ int i; mul = MUL_INIT; switch(ao_plugin_data.format) { - case(AFMT_S16_NE): + case(AF_FORMAT_S16_NE): #if AVG==1 lastavg = MID_S16; #elif AVG==2 @@ -165,7 +165,7 @@ static void reset(){ static int play(){ switch(pl_volnorm.format){ - case(AFMT_S16_NE): { + case(AF_FORMAT_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 bce069a8c4..2b673d3e1e 100644 --- a/libao2/pl_volume.c +++ b/libao2/pl_volume.c @@ -20,7 +20,7 @@ #include "audio_out.h" #include "audio_plugin.h" #include "audio_plugin_internal.h" -#include "afmt.h" +#include "libaf/af_format.h" static ao_info_t info = { @@ -80,8 +80,8 @@ static int control(int cmd,void *arg){ 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_NE): + case(AF_FORMAT_U8): + case(AF_FORMAT_S16_NE): break; default: fprintf(stderr,"[pl_volume] Audio format not yet suported \n"); @@ -117,7 +117,7 @@ static int play(){ vol=(vol*vol*vol)>>12; // Change the volume. switch(pl_volume.format){ - case(AFMT_U8):{ + case(AF_FORMAT_U8):{ register uint8_t* data=(uint8_t*)ao_plugin_data.data; register int x; for(i=0;i>1; register int16_t* data=(int16_t*)ao_plugin_data.data; register int x; -- cgit v1.2.3