spudec: Fix calc_bbox to always return sensible values
[mplayer/glamo.git] / libaf / af_format.h
blob5f194c1365df42fd931db417bd90ded9e61afed2
1 /*
2 * The sample format system used lin libaf is based on bitmasks.
3 * The format definition only refers to the storage format,
4 * not the resolution.
6 * This file is part of MPlayer.
8 * MPlayer is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * MPlayer is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 #ifndef MPLAYER_AF_FORMAT_H
24 #define MPLAYER_AF_FORMAT_H
26 #include "config.h"
28 // Endianness
29 #define AF_FORMAT_BE (0<<0) // Big Endian
30 #define AF_FORMAT_LE (1<<0) // Little Endian
31 #define AF_FORMAT_END_MASK (1<<0)
33 #if HAVE_BIGENDIAN // Native endian of cpu
34 #define AF_FORMAT_NE AF_FORMAT_BE
35 #else
36 #define AF_FORMAT_NE AF_FORMAT_LE
37 #endif
39 // Signed/unsigned
40 #define AF_FORMAT_SI (0<<1) // Signed
41 #define AF_FORMAT_US (1<<1) // Unsigned
42 #define AF_FORMAT_SIGN_MASK (1<<1)
44 // Fixed or floating point
45 #define AF_FORMAT_I (0<<2) // Int
46 #define AF_FORMAT_F (1<<2) // Foating point
47 #define AF_FORMAT_POINT_MASK (1<<2)
49 // Bits used
50 #define AF_FORMAT_8BIT (0<<3)
51 #define AF_FORMAT_16BIT (1<<3)
52 #define AF_FORMAT_24BIT (2<<3)
53 #define AF_FORMAT_32BIT (3<<3)
54 #define AF_FORMAT_40BIT (4<<3)
55 #define AF_FORMAT_48BIT (5<<3)
56 #define AF_FORMAT_BITS_MASK (7<<3)
58 // Special flags refering to non pcm data
59 #define AF_FORMAT_MU_LAW (1<<6)
60 #define AF_FORMAT_A_LAW (2<<6)
61 #define AF_FORMAT_MPEG2 (3<<6) // MPEG(2) audio
62 #define AF_FORMAT_AC3 (4<<6) // Dolby Digital AC3
63 #define AF_FORMAT_IMA_ADPCM (5<<6)
64 #define AF_FORMAT_SPECIAL_MASK (7<<6)
66 // PREDEFINED formats
68 #define AF_FORMAT_U8 (AF_FORMAT_I|AF_FORMAT_US|AF_FORMAT_8BIT|AF_FORMAT_NE)
69 #define AF_FORMAT_S8 (AF_FORMAT_I|AF_FORMAT_SI|AF_FORMAT_8BIT|AF_FORMAT_NE)
70 #define AF_FORMAT_U16_LE (AF_FORMAT_I|AF_FORMAT_US|AF_FORMAT_16BIT|AF_FORMAT_LE)
71 #define AF_FORMAT_U16_BE (AF_FORMAT_I|AF_FORMAT_US|AF_FORMAT_16BIT|AF_FORMAT_BE)
72 #define AF_FORMAT_S16_LE (AF_FORMAT_I|AF_FORMAT_SI|AF_FORMAT_16BIT|AF_FORMAT_LE)
73 #define AF_FORMAT_S16_BE (AF_FORMAT_I|AF_FORMAT_SI|AF_FORMAT_16BIT|AF_FORMAT_BE)
74 #define AF_FORMAT_U24_LE (AF_FORMAT_I|AF_FORMAT_US|AF_FORMAT_24BIT|AF_FORMAT_LE)
75 #define AF_FORMAT_U24_BE (AF_FORMAT_I|AF_FORMAT_US|AF_FORMAT_24BIT|AF_FORMAT_BE)
76 #define AF_FORMAT_S24_LE (AF_FORMAT_I|AF_FORMAT_SI|AF_FORMAT_24BIT|AF_FORMAT_LE)
77 #define AF_FORMAT_S24_BE (AF_FORMAT_I|AF_FORMAT_SI|AF_FORMAT_24BIT|AF_FORMAT_BE)
78 #define AF_FORMAT_U32_LE (AF_FORMAT_I|AF_FORMAT_US|AF_FORMAT_32BIT|AF_FORMAT_LE)
79 #define AF_FORMAT_U32_BE (AF_FORMAT_I|AF_FORMAT_US|AF_FORMAT_32BIT|AF_FORMAT_BE)
80 #define AF_FORMAT_S32_LE (AF_FORMAT_I|AF_FORMAT_SI|AF_FORMAT_32BIT|AF_FORMAT_LE)
81 #define AF_FORMAT_S32_BE (AF_FORMAT_I|AF_FORMAT_SI|AF_FORMAT_32BIT|AF_FORMAT_BE)
83 #define AF_FORMAT_FLOAT_LE (AF_FORMAT_F|AF_FORMAT_32BIT|AF_FORMAT_LE)
84 #define AF_FORMAT_FLOAT_BE (AF_FORMAT_F|AF_FORMAT_32BIT|AF_FORMAT_BE)
86 #define AF_FORMAT_AC3_LE (AF_FORMAT_AC3|AF_FORMAT_16BIT|AF_FORMAT_LE)
87 #define AF_FORMAT_AC3_BE (AF_FORMAT_AC3|AF_FORMAT_16BIT|AF_FORMAT_BE)
89 #if HAVE_BIGENDIAN
90 #define AF_FORMAT_U16_NE AF_FORMAT_U16_BE
91 #define AF_FORMAT_S16_NE AF_FORMAT_S16_BE
92 #define AF_FORMAT_U24_NE AF_FORMAT_U24_BE
93 #define AF_FORMAT_S24_NE AF_FORMAT_S24_BE
94 #define AF_FORMAT_U32_NE AF_FORMAT_U32_BE
95 #define AF_FORMAT_S32_NE AF_FORMAT_S32_BE
96 #define AF_FORMAT_FLOAT_NE AF_FORMAT_FLOAT_BE
97 #define AF_FORMAT_AC3_NE AF_FORMAT_AC3_BE
98 #else
99 #define AF_FORMAT_U16_NE AF_FORMAT_U16_LE
100 #define AF_FORMAT_S16_NE AF_FORMAT_S16_LE
101 #define AF_FORMAT_U24_NE AF_FORMAT_U24_LE
102 #define AF_FORMAT_S24_NE AF_FORMAT_S24_LE
103 #define AF_FORMAT_U32_NE AF_FORMAT_U32_LE
104 #define AF_FORMAT_S32_NE AF_FORMAT_S32_LE
105 #define AF_FORMAT_FLOAT_NE AF_FORMAT_FLOAT_LE
106 #define AF_FORMAT_AC3_NE AF_FORMAT_AC3_LE
107 #endif
109 #define AF_FORMAT_UNKNOWN (-1)
111 #define AF_FORMAT_IS_AC3(fmt) (((fmt) & AF_FORMAT_SPECIAL_MASK) == AF_FORMAT_AC3)
113 int af_str2fmt(const char *str);
114 int af_str2fmt_short(const char *str);
115 int af_fmt2bits(int format);
116 int af_bits2fmt(int bits);
117 char* af_fmt2str(int format, char* str, int size);
118 const char* af_fmt2str_short(int format);
120 #endif /* MPLAYER_AF_FORMAT_H */