From cafa00841fc1d0515a2063e7c64d884ad2019658 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 29 Aug 2012 00:50:26 +0200 Subject: libaf: rename af_format.h to format.h af_format.h declares some symbols which are defined in format.c. The fact that af_format.c is a completely unrelated file is rather confusing. Having the header and implementation file use the same base name is more uniform. (af_format.c is the audio conversion filter, while af_format.h and format.c are about audio formats and their properties.) Also fix all source files which include this file. --- libaf/af.h | 2 +- libaf/af_format.h | 135 ------------------------------------------------------ libaf/format.h | 135 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 136 insertions(+), 136 deletions(-) delete mode 100644 libaf/af_format.h create mode 100644 libaf/format.h (limited to 'libaf') diff --git a/libaf/af.h b/libaf/af.h index ceca34c90d..4542b32c60 100644 --- a/libaf/af.h +++ b/libaf/af.h @@ -24,7 +24,7 @@ #include "config.h" #include "options.h" -#include "af_format.h" +#include "libaf/format.h" #include "control.h" #include "cpudetect.h" #include "mp_msg.h" diff --git a/libaf/af_format.h b/libaf/af_format.h deleted file mode 100644 index 36f5c3fb59..0000000000 --- a/libaf/af_format.h +++ /dev/null @@ -1,135 +0,0 @@ -/* - * The sample format system used lin libaf is based on bitmasks. - * The format definition only refers to the storage format, - * not the resolution. - * - * This file is part of MPlayer. - * - * MPlayer is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * MPlayer is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with MPlayer; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef MPLAYER_AF_FORMAT_H -#define MPLAYER_AF_FORMAT_H - -#include -#include "config.h" -#include "bstr.h" - -// Endianness -#define AF_FORMAT_BE (0<<0) // Big Endian -#define AF_FORMAT_LE (1<<0) // Little Endian -#define AF_FORMAT_END_MASK (1<<0) - -#if BYTE_ORDER == BIG_ENDIAN -#define AF_FORMAT_NE AF_FORMAT_BE -#else -#define AF_FORMAT_NE AF_FORMAT_LE -#endif - -// Signed/unsigned -#define AF_FORMAT_SI (0<<1) // Signed -#define AF_FORMAT_US (1<<1) // Unsigned -#define AF_FORMAT_SIGN_MASK (1<<1) - -// Fixed or floating point -#define AF_FORMAT_I (0<<2) // Int -#define AF_FORMAT_F (1<<2) // Foating point -#define AF_FORMAT_POINT_MASK (1<<2) - -// Bits used -#define AF_FORMAT_8BIT (0<<3) -#define AF_FORMAT_16BIT (1<<3) -#define AF_FORMAT_24BIT (2<<3) -#define AF_FORMAT_32BIT (3<<3) -#define AF_FORMAT_40BIT (4<<3) -#define AF_FORMAT_48BIT (5<<3) -#define AF_FORMAT_BITS_MASK (7<<3) - -// Special flags refering to non pcm data -#define AF_FORMAT_MU_LAW (1<<6) -#define AF_FORMAT_A_LAW (2<<6) -#define AF_FORMAT_MPEG2 (3<<6) // MPEG(2) audio -#define AF_FORMAT_AC3 (4<<6) // Dolby Digital AC3 -#define AF_FORMAT_IMA_ADPCM (5<<6) -#define AF_FORMAT_IEC61937 (6<<6) -#define AF_FORMAT_SPECIAL_MASK (7<<6) - -// PREDEFINED formats - -#define AF_FORMAT_U8 (AF_FORMAT_I|AF_FORMAT_US|AF_FORMAT_8BIT|AF_FORMAT_NE) -#define AF_FORMAT_S8 (AF_FORMAT_I|AF_FORMAT_SI|AF_FORMAT_8BIT|AF_FORMAT_NE) -#define AF_FORMAT_U16_LE (AF_FORMAT_I|AF_FORMAT_US|AF_FORMAT_16BIT|AF_FORMAT_LE) -#define AF_FORMAT_U16_BE (AF_FORMAT_I|AF_FORMAT_US|AF_FORMAT_16BIT|AF_FORMAT_BE) -#define AF_FORMAT_S16_LE (AF_FORMAT_I|AF_FORMAT_SI|AF_FORMAT_16BIT|AF_FORMAT_LE) -#define AF_FORMAT_S16_BE (AF_FORMAT_I|AF_FORMAT_SI|AF_FORMAT_16BIT|AF_FORMAT_BE) -#define AF_FORMAT_U24_LE (AF_FORMAT_I|AF_FORMAT_US|AF_FORMAT_24BIT|AF_FORMAT_LE) -#define AF_FORMAT_U24_BE (AF_FORMAT_I|AF_FORMAT_US|AF_FORMAT_24BIT|AF_FORMAT_BE) -#define AF_FORMAT_S24_LE (AF_FORMAT_I|AF_FORMAT_SI|AF_FORMAT_24BIT|AF_FORMAT_LE) -#define AF_FORMAT_S24_BE (AF_FORMAT_I|AF_FORMAT_SI|AF_FORMAT_24BIT|AF_FORMAT_BE) -#define AF_FORMAT_U32_LE (AF_FORMAT_I|AF_FORMAT_US|AF_FORMAT_32BIT|AF_FORMAT_LE) -#define AF_FORMAT_U32_BE (AF_FORMAT_I|AF_FORMAT_US|AF_FORMAT_32BIT|AF_FORMAT_BE) -#define AF_FORMAT_S32_LE (AF_FORMAT_I|AF_FORMAT_SI|AF_FORMAT_32BIT|AF_FORMAT_LE) -#define AF_FORMAT_S32_BE (AF_FORMAT_I|AF_FORMAT_SI|AF_FORMAT_32BIT|AF_FORMAT_BE) - -#define AF_FORMAT_FLOAT_LE (AF_FORMAT_F|AF_FORMAT_32BIT|AF_FORMAT_LE) -#define AF_FORMAT_FLOAT_BE (AF_FORMAT_F|AF_FORMAT_32BIT|AF_FORMAT_BE) - -#define AF_FORMAT_AC3_LE (AF_FORMAT_AC3|AF_FORMAT_16BIT|AF_FORMAT_LE) -#define AF_FORMAT_AC3_BE (AF_FORMAT_AC3|AF_FORMAT_16BIT|AF_FORMAT_BE) - -#define AF_FORMAT_IEC61937_LE (AF_FORMAT_IEC61937|AF_FORMAT_16BIT|AF_FORMAT_LE) -#define AF_FORMAT_IEC61937_BE (AF_FORMAT_IEC61937|AF_FORMAT_16BIT|AF_FORMAT_BE) - -#if BYTE_ORDER == BIG_ENDIAN -#define AF_FORMAT_U16_NE AF_FORMAT_U16_BE -#define AF_FORMAT_S16_NE AF_FORMAT_S16_BE -#define AF_FORMAT_U24_NE AF_FORMAT_U24_BE -#define AF_FORMAT_S24_NE AF_FORMAT_S24_BE -#define AF_FORMAT_U32_NE AF_FORMAT_U32_BE -#define AF_FORMAT_S32_NE AF_FORMAT_S32_BE -#define AF_FORMAT_FLOAT_NE AF_FORMAT_FLOAT_BE -#define AF_FORMAT_AC3_NE AF_FORMAT_AC3_BE -#define AF_FORMAT_IEC61937_NE AF_FORMAT_IEC61937_BE -#else -#define AF_FORMAT_U16_NE AF_FORMAT_U16_LE -#define AF_FORMAT_S16_NE AF_FORMAT_S16_LE -#define AF_FORMAT_U24_NE AF_FORMAT_U24_LE -#define AF_FORMAT_S24_NE AF_FORMAT_S24_LE -#define AF_FORMAT_U32_NE AF_FORMAT_U32_LE -#define AF_FORMAT_S32_NE AF_FORMAT_S32_LE -#define AF_FORMAT_FLOAT_NE AF_FORMAT_FLOAT_LE -#define AF_FORMAT_AC3_NE AF_FORMAT_AC3_LE -#define AF_FORMAT_IEC61937_NE AF_FORMAT_IEC61937_LE -#endif - -#define AF_FORMAT_UNKNOWN (-1) - -#define AF_FORMAT_IS_AC3(fmt) (((fmt) & AF_FORMAT_SPECIAL_MASK) == AF_FORMAT_AC3) -#define AF_FORMAT_IS_IEC61937(fmt) (((fmt) & AF_FORMAT_SPECIAL_MASK) == AF_FORMAT_IEC61937) - -struct af_fmt_entry { - const char *name; - int format; -}; - -extern const struct af_fmt_entry af_fmtstr_table[]; - -int af_str2fmt_short(bstr str); -int af_fmt2bits(int format); -int af_bits2fmt(int bits); -char* af_fmt2str(int format, char* str, int size); -const char* af_fmt2str_short(int format); - -#endif /* MPLAYER_AF_FORMAT_H */ diff --git a/libaf/format.h b/libaf/format.h new file mode 100644 index 0000000000..36f5c3fb59 --- /dev/null +++ b/libaf/format.h @@ -0,0 +1,135 @@ +/* + * The sample format system used lin libaf is based on bitmasks. + * The format definition only refers to the storage format, + * not the resolution. + * + * This file is part of MPlayer. + * + * MPlayer is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * MPlayer is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with MPlayer; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef MPLAYER_AF_FORMAT_H +#define MPLAYER_AF_FORMAT_H + +#include +#include "config.h" +#include "bstr.h" + +// Endianness +#define AF_FORMAT_BE (0<<0) // Big Endian +#define AF_FORMAT_LE (1<<0) // Little Endian +#define AF_FORMAT_END_MASK (1<<0) + +#if BYTE_ORDER == BIG_ENDIAN +#define AF_FORMAT_NE AF_FORMAT_BE +#else +#define AF_FORMAT_NE AF_FORMAT_LE +#endif + +// Signed/unsigned +#define AF_FORMAT_SI (0<<1) // Signed +#define AF_FORMAT_US (1<<1) // Unsigned +#define AF_FORMAT_SIGN_MASK (1<<1) + +// Fixed or floating point +#define AF_FORMAT_I (0<<2) // Int +#define AF_FORMAT_F (1<<2) // Foating point +#define AF_FORMAT_POINT_MASK (1<<2) + +// Bits used +#define AF_FORMAT_8BIT (0<<3) +#define AF_FORMAT_16BIT (1<<3) +#define AF_FORMAT_24BIT (2<<3) +#define AF_FORMAT_32BIT (3<<3) +#define AF_FORMAT_40BIT (4<<3) +#define AF_FORMAT_48BIT (5<<3) +#define AF_FORMAT_BITS_MASK (7<<3) + +// Special flags refering to non pcm data +#define AF_FORMAT_MU_LAW (1<<6) +#define AF_FORMAT_A_LAW (2<<6) +#define AF_FORMAT_MPEG2 (3<<6) // MPEG(2) audio +#define AF_FORMAT_AC3 (4<<6) // Dolby Digital AC3 +#define AF_FORMAT_IMA_ADPCM (5<<6) +#define AF_FORMAT_IEC61937 (6<<6) +#define AF_FORMAT_SPECIAL_MASK (7<<6) + +// PREDEFINED formats + +#define AF_FORMAT_U8 (AF_FORMAT_I|AF_FORMAT_US|AF_FORMAT_8BIT|AF_FORMAT_NE) +#define AF_FORMAT_S8 (AF_FORMAT_I|AF_FORMAT_SI|AF_FORMAT_8BIT|AF_FORMAT_NE) +#define AF_FORMAT_U16_LE (AF_FORMAT_I|AF_FORMAT_US|AF_FORMAT_16BIT|AF_FORMAT_LE) +#define AF_FORMAT_U16_BE (AF_FORMAT_I|AF_FORMAT_US|AF_FORMAT_16BIT|AF_FORMAT_BE) +#define AF_FORMAT_S16_LE (AF_FORMAT_I|AF_FORMAT_SI|AF_FORMAT_16BIT|AF_FORMAT_LE) +#define AF_FORMAT_S16_BE (AF_FORMAT_I|AF_FORMAT_SI|AF_FORMAT_16BIT|AF_FORMAT_BE) +#define AF_FORMAT_U24_LE (AF_FORMAT_I|AF_FORMAT_US|AF_FORMAT_24BIT|AF_FORMAT_LE) +#define AF_FORMAT_U24_BE (AF_FORMAT_I|AF_FORMAT_US|AF_FORMAT_24BIT|AF_FORMAT_BE) +#define AF_FORMAT_S24_LE (AF_FORMAT_I|AF_FORMAT_SI|AF_FORMAT_24BIT|AF_FORMAT_LE) +#define AF_FORMAT_S24_BE (AF_FORMAT_I|AF_FORMAT_SI|AF_FORMAT_24BIT|AF_FORMAT_BE) +#define AF_FORMAT_U32_LE (AF_FORMAT_I|AF_FORMAT_US|AF_FORMAT_32BIT|AF_FORMAT_LE) +#define AF_FORMAT_U32_BE (AF_FORMAT_I|AF_FORMAT_US|AF_FORMAT_32BIT|AF_FORMAT_BE) +#define AF_FORMAT_S32_LE (AF_FORMAT_I|AF_FORMAT_SI|AF_FORMAT_32BIT|AF_FORMAT_LE) +#define AF_FORMAT_S32_BE (AF_FORMAT_I|AF_FORMAT_SI|AF_FORMAT_32BIT|AF_FORMAT_BE) + +#define AF_FORMAT_FLOAT_LE (AF_FORMAT_F|AF_FORMAT_32BIT|AF_FORMAT_LE) +#define AF_FORMAT_FLOAT_BE (AF_FORMAT_F|AF_FORMAT_32BIT|AF_FORMAT_BE) + +#define AF_FORMAT_AC3_LE (AF_FORMAT_AC3|AF_FORMAT_16BIT|AF_FORMAT_LE) +#define AF_FORMAT_AC3_BE (AF_FORMAT_AC3|AF_FORMAT_16BIT|AF_FORMAT_BE) + +#define AF_FORMAT_IEC61937_LE (AF_FORMAT_IEC61937|AF_FORMAT_16BIT|AF_FORMAT_LE) +#define AF_FORMAT_IEC61937_BE (AF_FORMAT_IEC61937|AF_FORMAT_16BIT|AF_FORMAT_BE) + +#if BYTE_ORDER == BIG_ENDIAN +#define AF_FORMAT_U16_NE AF_FORMAT_U16_BE +#define AF_FORMAT_S16_NE AF_FORMAT_S16_BE +#define AF_FORMAT_U24_NE AF_FORMAT_U24_BE +#define AF_FORMAT_S24_NE AF_FORMAT_S24_BE +#define AF_FORMAT_U32_NE AF_FORMAT_U32_BE +#define AF_FORMAT_S32_NE AF_FORMAT_S32_BE +#define AF_FORMAT_FLOAT_NE AF_FORMAT_FLOAT_BE +#define AF_FORMAT_AC3_NE AF_FORMAT_AC3_BE +#define AF_FORMAT_IEC61937_NE AF_FORMAT_IEC61937_BE +#else +#define AF_FORMAT_U16_NE AF_FORMAT_U16_LE +#define AF_FORMAT_S16_NE AF_FORMAT_S16_LE +#define AF_FORMAT_U24_NE AF_FORMAT_U24_LE +#define AF_FORMAT_S24_NE AF_FORMAT_S24_LE +#define AF_FORMAT_U32_NE AF_FORMAT_U32_LE +#define AF_FORMAT_S32_NE AF_FORMAT_S32_LE +#define AF_FORMAT_FLOAT_NE AF_FORMAT_FLOAT_LE +#define AF_FORMAT_AC3_NE AF_FORMAT_AC3_LE +#define AF_FORMAT_IEC61937_NE AF_FORMAT_IEC61937_LE +#endif + +#define AF_FORMAT_UNKNOWN (-1) + +#define AF_FORMAT_IS_AC3(fmt) (((fmt) & AF_FORMAT_SPECIAL_MASK) == AF_FORMAT_AC3) +#define AF_FORMAT_IS_IEC61937(fmt) (((fmt) & AF_FORMAT_SPECIAL_MASK) == AF_FORMAT_IEC61937) + +struct af_fmt_entry { + const char *name; + int format; +}; + +extern const struct af_fmt_entry af_fmtstr_table[]; + +int af_str2fmt_short(bstr str); +int af_fmt2bits(int format); +int af_bits2fmt(int bits); +char* af_fmt2str(int format, char* str, int size); +const char* af_fmt2str_short(int format); + +#endif /* MPLAYER_AF_FORMAT_H */ -- cgit v1.2.3