annotate libaf/af_format.h @ 36534:9222b4fbe1c8

mkv: replace a missed "return 0" by "goto err_out". Fixes a memory leak in this error case.
author reimar
date Sun, 19 Jan 2014 11:32:51 +0000
parents f045a1d92c06
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
28229
72d0b1444141 Replace informal license notices by standard license header
diego
parents: 28051
diff changeset
1 /*
72d0b1444141 Replace informal license notices by standard license header
diego
parents: 28051
diff changeset
2 * The sample format system used lin libaf is based on bitmasks.
72d0b1444141 Replace informal license notices by standard license header
diego
parents: 28051
diff changeset
3 * The format definition only refers to the storage format,
72d0b1444141 Replace informal license notices by standard license header
diego
parents: 28051
diff changeset
4 * not the resolution.
72d0b1444141 Replace informal license notices by standard license header
diego
parents: 28051
diff changeset
5 *
72d0b1444141 Replace informal license notices by standard license header
diego
parents: 28051
diff changeset
6 * This file is part of MPlayer.
72d0b1444141 Replace informal license notices by standard license header
diego
parents: 28051
diff changeset
7 *
72d0b1444141 Replace informal license notices by standard license header
diego
parents: 28051
diff changeset
8 * MPlayer is free software; you can redistribute it and/or modify
72d0b1444141 Replace informal license notices by standard license header
diego
parents: 28051
diff changeset
9 * it under the terms of the GNU General Public License as published by
72d0b1444141 Replace informal license notices by standard license header
diego
parents: 28051
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
72d0b1444141 Replace informal license notices by standard license header
diego
parents: 28051
diff changeset
11 * (at your option) any later version.
72d0b1444141 Replace informal license notices by standard license header
diego
parents: 28051
diff changeset
12 *
72d0b1444141 Replace informal license notices by standard license header
diego
parents: 28051
diff changeset
13 * MPlayer is distributed in the hope that it will be useful,
72d0b1444141 Replace informal license notices by standard license header
diego
parents: 28051
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
72d0b1444141 Replace informal license notices by standard license header
diego
parents: 28051
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
72d0b1444141 Replace informal license notices by standard license header
diego
parents: 28051
diff changeset
16 * GNU General Public License for more details.
72d0b1444141 Replace informal license notices by standard license header
diego
parents: 28051
diff changeset
17 *
72d0b1444141 Replace informal license notices by standard license header
diego
parents: 28051
diff changeset
18 * You should have received a copy of the GNU General Public License along
72d0b1444141 Replace informal license notices by standard license header
diego
parents: 28051
diff changeset
19 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
72d0b1444141 Replace informal license notices by standard license header
diego
parents: 28051
diff changeset
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
72d0b1444141 Replace informal license notices by standard license header
diego
parents: 28051
diff changeset
21 */
26029
4129c8cfa742 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 25551
diff changeset
22
4129c8cfa742 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 25551
diff changeset
23 #ifndef MPLAYER_AF_FORMAT_H
4129c8cfa742 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 25551
diff changeset
24 #define MPLAYER_AF_FORMAT_H
8167
e8832e66babd New features:
anders
parents:
diff changeset
25
26064
e173fde700da Replace silly check for config.h inclusion, just include it.
diego
parents: 26029
diff changeset
26 #include "config.h"
14479
cae0dbeb44bb af_format.h needs config.h to be included first.
reimar
parents: 14335
diff changeset
27
24595
85f669a84e7a cosmetics: misc typo fixes
diego
parents: 20771
diff changeset
28 // Endianness
8167
e8832e66babd New features:
anders
parents:
diff changeset
29 #define AF_FORMAT_BE (0<<0) // Big Endian
e8832e66babd New features:
anders
parents:
diff changeset
30 #define AF_FORMAT_LE (1<<0) // Little Endian
e8832e66babd New features:
anders
parents:
diff changeset
31 #define AF_FORMAT_END_MASK (1<<0)
e8832e66babd New features:
anders
parents:
diff changeset
32
35439
5ec9b96eaa48 Some spelling fixes.
reimar
parents: 34103
diff changeset
33 #if HAVE_BIGENDIAN // Native endianness of cpu
8167
e8832e66babd New features:
anders
parents:
diff changeset
34 #define AF_FORMAT_NE AF_FORMAT_BE
e8832e66babd New features:
anders
parents:
diff changeset
35 #else
e8832e66babd New features:
anders
parents:
diff changeset
36 #define AF_FORMAT_NE AF_FORMAT_LE
e8832e66babd New features:
anders
parents:
diff changeset
37 #endif
e8832e66babd New features:
anders
parents:
diff changeset
38
e8832e66babd New features:
anders
parents:
diff changeset
39 // Signed/unsigned
14245
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
40 #define AF_FORMAT_SI (0<<1) // Signed
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
41 #define AF_FORMAT_US (1<<1) // Unsigned
8167
e8832e66babd New features:
anders
parents:
diff changeset
42 #define AF_FORMAT_SIGN_MASK (1<<1)
e8832e66babd New features:
anders
parents:
diff changeset
43
13550
81e62cbe57d9 reimplementation of the pl_extrastereo and pl_volnorm plugins
alex
parents: 8994
diff changeset
44 // Fixed or floating point
8167
e8832e66babd New features:
anders
parents:
diff changeset
45 #define AF_FORMAT_I (0<<2) // Int
35439
5ec9b96eaa48 Some spelling fixes.
reimar
parents: 34103
diff changeset
46 #define AF_FORMAT_F (1<<2) // Floating point
8167
e8832e66babd New features:
anders
parents:
diff changeset
47 #define AF_FORMAT_POINT_MASK (1<<2)
e8832e66babd New features:
anders
parents:
diff changeset
48
14245
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
49 // Bits used
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
50 #define AF_FORMAT_8BIT (0<<3)
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
51 #define AF_FORMAT_16BIT (1<<3)
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
52 #define AF_FORMAT_24BIT (2<<3)
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
53 #define AF_FORMAT_32BIT (3<<3)
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
54 #define AF_FORMAT_40BIT (4<<3)
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
55 #define AF_FORMAT_48BIT (5<<3)
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
56 #define AF_FORMAT_BITS_MASK (7<<3)
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
57
35439
5ec9b96eaa48 Some spelling fixes.
reimar
parents: 34103
diff changeset
58 // Special flags referring to non pcm data
14245
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
59 #define AF_FORMAT_MU_LAW (1<<6)
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
60 #define AF_FORMAT_A_LAW (2<<6)
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
61 #define AF_FORMAT_MPEG2 (3<<6) // MPEG(2) audio
30233
0acca3a641a6 Revert r30170, AF_FORMAT_AC3 is supposed to be the special mask,
reimar
parents: 30128
diff changeset
62 #define AF_FORMAT_AC3 (4<<6) // Dolby Digital AC3
14245
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
63 #define AF_FORMAT_IMA_ADPCM (5<<6)
34103
febe300dbfc0 S/PDIF passthrough decoder
diego
parents: 30241
diff changeset
64 #define AF_FORMAT_IEC61937 (6<<6)
14245
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
65 #define AF_FORMAT_SPECIAL_MASK (7<<6)
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
66
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
67 // PREDEFINED formats
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
68
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
69 #define AF_FORMAT_U8 (AF_FORMAT_I|AF_FORMAT_US|AF_FORMAT_8BIT|AF_FORMAT_NE)
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
70 #define AF_FORMAT_S8 (AF_FORMAT_I|AF_FORMAT_SI|AF_FORMAT_8BIT|AF_FORMAT_NE)
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
71 #define AF_FORMAT_U16_LE (AF_FORMAT_I|AF_FORMAT_US|AF_FORMAT_16BIT|AF_FORMAT_LE)
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
72 #define AF_FORMAT_U16_BE (AF_FORMAT_I|AF_FORMAT_US|AF_FORMAT_16BIT|AF_FORMAT_BE)
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
73 #define AF_FORMAT_S16_LE (AF_FORMAT_I|AF_FORMAT_SI|AF_FORMAT_16BIT|AF_FORMAT_LE)
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
74 #define AF_FORMAT_S16_BE (AF_FORMAT_I|AF_FORMAT_SI|AF_FORMAT_16BIT|AF_FORMAT_BE)
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
75 #define AF_FORMAT_U24_LE (AF_FORMAT_I|AF_FORMAT_US|AF_FORMAT_24BIT|AF_FORMAT_LE)
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
76 #define AF_FORMAT_U24_BE (AF_FORMAT_I|AF_FORMAT_US|AF_FORMAT_24BIT|AF_FORMAT_BE)
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
77 #define AF_FORMAT_S24_LE (AF_FORMAT_I|AF_FORMAT_SI|AF_FORMAT_24BIT|AF_FORMAT_LE)
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
78 #define AF_FORMAT_S24_BE (AF_FORMAT_I|AF_FORMAT_SI|AF_FORMAT_24BIT|AF_FORMAT_BE)
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
79 #define AF_FORMAT_U32_LE (AF_FORMAT_I|AF_FORMAT_US|AF_FORMAT_32BIT|AF_FORMAT_LE)
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
80 #define AF_FORMAT_U32_BE (AF_FORMAT_I|AF_FORMAT_US|AF_FORMAT_32BIT|AF_FORMAT_BE)
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
81 #define AF_FORMAT_S32_LE (AF_FORMAT_I|AF_FORMAT_SI|AF_FORMAT_32BIT|AF_FORMAT_LE)
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
82 #define AF_FORMAT_S32_BE (AF_FORMAT_I|AF_FORMAT_SI|AF_FORMAT_32BIT|AF_FORMAT_BE)
8994
06d7ef3c7b01 export fmt2str()
arpi
parents: 8167
diff changeset
83
14245
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
84 #define AF_FORMAT_FLOAT_LE (AF_FORMAT_F|AF_FORMAT_32BIT|AF_FORMAT_LE)
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
85 #define AF_FORMAT_FLOAT_BE (AF_FORMAT_F|AF_FORMAT_32BIT|AF_FORMAT_BE)
8994
06d7ef3c7b01 export fmt2str()
arpi
parents: 8167
diff changeset
86
30241
02b9c1a452e1 Add support for distinguishing between little- and big-endian SPDIF AC3
reimar
parents: 30234
diff changeset
87 #define AF_FORMAT_AC3_LE (AF_FORMAT_AC3|AF_FORMAT_16BIT|AF_FORMAT_LE)
02b9c1a452e1 Add support for distinguishing between little- and big-endian SPDIF AC3
reimar
parents: 30234
diff changeset
88 #define AF_FORMAT_AC3_BE (AF_FORMAT_AC3|AF_FORMAT_16BIT|AF_FORMAT_BE)
02b9c1a452e1 Add support for distinguishing between little- and big-endian SPDIF AC3
reimar
parents: 30234
diff changeset
89
34103
febe300dbfc0 S/PDIF passthrough decoder
diego
parents: 30241
diff changeset
90 #define AF_FORMAT_IEC61937_LE (AF_FORMAT_IEC61937|AF_FORMAT_16BIT|AF_FORMAT_LE)
febe300dbfc0 S/PDIF passthrough decoder
diego
parents: 30241
diff changeset
91 #define AF_FORMAT_IEC61937_BE (AF_FORMAT_IEC61937|AF_FORMAT_16BIT|AF_FORMAT_BE)
febe300dbfc0 S/PDIF passthrough decoder
diego
parents: 30241
diff changeset
92
29401
f01023c524c3 Replace WORDS_BIGENDIAN by HAVE_BIGENDIAN in all internal code.
diego
parents: 28339
diff changeset
93 #if HAVE_BIGENDIAN
14245
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
94 #define AF_FORMAT_U16_NE AF_FORMAT_U16_BE
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
95 #define AF_FORMAT_S16_NE AF_FORMAT_S16_BE
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
96 #define AF_FORMAT_U24_NE AF_FORMAT_U24_BE
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
97 #define AF_FORMAT_S24_NE AF_FORMAT_S24_BE
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
98 #define AF_FORMAT_U32_NE AF_FORMAT_U32_BE
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
99 #define AF_FORMAT_S32_NE AF_FORMAT_S32_BE
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
100 #define AF_FORMAT_FLOAT_NE AF_FORMAT_FLOAT_BE
30241
02b9c1a452e1 Add support for distinguishing between little- and big-endian SPDIF AC3
reimar
parents: 30234
diff changeset
101 #define AF_FORMAT_AC3_NE AF_FORMAT_AC3_BE
34103
febe300dbfc0 S/PDIF passthrough decoder
diego
parents: 30241
diff changeset
102 #define AF_FORMAT_IEC61937_NE AF_FORMAT_IEC61937_BE
14245
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
103 #else
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
104 #define AF_FORMAT_U16_NE AF_FORMAT_U16_LE
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
105 #define AF_FORMAT_S16_NE AF_FORMAT_S16_LE
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
106 #define AF_FORMAT_U24_NE AF_FORMAT_U24_LE
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
107 #define AF_FORMAT_S24_NE AF_FORMAT_S24_LE
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
108 #define AF_FORMAT_U32_NE AF_FORMAT_U32_LE
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
109 #define AF_FORMAT_S32_NE AF_FORMAT_S32_LE
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
110 #define AF_FORMAT_FLOAT_NE AF_FORMAT_FLOAT_LE
30241
02b9c1a452e1 Add support for distinguishing between little- and big-endian SPDIF AC3
reimar
parents: 30234
diff changeset
111 #define AF_FORMAT_AC3_NE AF_FORMAT_AC3_LE
34103
febe300dbfc0 S/PDIF passthrough decoder
diego
parents: 30241
diff changeset
112 #define AF_FORMAT_IEC61937_NE AF_FORMAT_IEC61937_LE
14245
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
113 #endif
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
114
20771
1e78e35b6c7b Change value used to indicate "unknown audio format" from 0 to -1.
uau
parents: 19108
diff changeset
115 #define AF_FORMAT_UNKNOWN (-1)
1e78e35b6c7b Change value used to indicate "unknown audio format" from 0 to -1.
uau
parents: 19108
diff changeset
116
30234
9d09ff127c25 Add and use AF_FORMAT_IS_AC3 macro.
reimar
parents: 30233
diff changeset
117 #define AF_FORMAT_IS_AC3(fmt) (((fmt) & AF_FORMAT_SPECIAL_MASK) == AF_FORMAT_AC3)
35443
f045a1d92c06 Make AF_FORMAT_IS_IEC61937 include AF_FORMAT_IS_AC3.
reimar
parents: 35439
diff changeset
118 #define AF_FORMAT_IS_IEC61937(fmt) (AF_FORMAT_IS_AC3(fmt) || ((fmt) & AF_FORMAT_SPECIAL_MASK) == AF_FORMAT_IEC61937)
30234
9d09ff127c25 Add and use AF_FORMAT_IS_AC3 macro.
reimar
parents: 30233
diff changeset
119
28051
9e739bdb049c Get rid of pointless 'extern' keywords.
diego
parents: 26064
diff changeset
120 int af_str2fmt(const char *str);
9e739bdb049c Get rid of pointless 'extern' keywords.
diego
parents: 26064
diff changeset
121 int af_str2fmt_short(const char *str);
9e739bdb049c Get rid of pointless 'extern' keywords.
diego
parents: 26064
diff changeset
122 int af_fmt2bits(int format);
9e739bdb049c Get rid of pointless 'extern' keywords.
diego
parents: 26064
diff changeset
123 int af_bits2fmt(int bits);
9e739bdb049c Get rid of pointless 'extern' keywords.
diego
parents: 26064
diff changeset
124 char* af_fmt2str(int format, char* str, int size);
9e739bdb049c Get rid of pointless 'extern' keywords.
diego
parents: 26064
diff changeset
125 const char* af_fmt2str_short(int format);
14245
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
126
26029
4129c8cfa742 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 25551
diff changeset
127 #endif /* MPLAYER_AF_FORMAT_H */