annotate libaf/af_format.h @ 14471:6cdd5669e930

Here is an updated draft with the bits discussed previously merged: - short startcode removed - QT/Microsoft codec_specific_data removed, reverted to a neutral format - meta packet removed, merged in the info packet. - stream class simplified, added metadata stream patch by (Luca Barbato <lu_zero gentoo org>)
author michael
date Wed, 12 Jan 2005 11:54:30 +0000
parents 8380694ba14f
children cae0dbeb44bb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8167
e8832e66babd New features:
anders
parents:
diff changeset
1 /* The sample format system used lin libaf is based on bitmasks. The
e8832e66babd New features:
anders
parents:
diff changeset
2 format definition only refers to the storage format not the
e8832e66babd New features:
anders
parents:
diff changeset
3 resolution. */
14245
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
4 #ifndef __af_format_h__
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
5 #define __af_format_h__
8167
e8832e66babd New features:
anders
parents:
diff changeset
6
e8832e66babd New features:
anders
parents:
diff changeset
7 // Endianess
e8832e66babd New features:
anders
parents:
diff changeset
8 #define AF_FORMAT_BE (0<<0) // Big Endian
e8832e66babd New features:
anders
parents:
diff changeset
9 #define AF_FORMAT_LE (1<<0) // Little Endian
e8832e66babd New features:
anders
parents:
diff changeset
10 #define AF_FORMAT_END_MASK (1<<0)
e8832e66babd New features:
anders
parents:
diff changeset
11
e8832e66babd New features:
anders
parents:
diff changeset
12 #if WORDS_BIGENDIAN // Native endian of cpu
e8832e66babd New features:
anders
parents:
diff changeset
13 #define AF_FORMAT_NE AF_FORMAT_BE
e8832e66babd New features:
anders
parents:
diff changeset
14 #else
e8832e66babd New features:
anders
parents:
diff changeset
15 #define AF_FORMAT_NE AF_FORMAT_LE
e8832e66babd New features:
anders
parents:
diff changeset
16 #endif
e8832e66babd New features:
anders
parents:
diff changeset
17
e8832e66babd New features:
anders
parents:
diff changeset
18 // Signed/unsigned
14245
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
19 #define AF_FORMAT_SI (0<<1) // Signed
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
20 #define AF_FORMAT_US (1<<1) // Unsigned
8167
e8832e66babd New features:
anders
parents:
diff changeset
21 #define AF_FORMAT_SIGN_MASK (1<<1)
e8832e66babd New features:
anders
parents:
diff changeset
22
13550
81e62cbe57d9 reimplementation of the pl_extrastereo and pl_volnorm plugins
alex
parents: 8994
diff changeset
23 // Fixed or floating point
8167
e8832e66babd New features:
anders
parents:
diff changeset
24 #define AF_FORMAT_I (0<<2) // Int
e8832e66babd New features:
anders
parents:
diff changeset
25 #define AF_FORMAT_F (1<<2) // Foating point
e8832e66babd New features:
anders
parents:
diff changeset
26 #define AF_FORMAT_POINT_MASK (1<<2)
e8832e66babd New features:
anders
parents:
diff changeset
27
14245
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
28 // Bits used
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
29 #define AF_FORMAT_8BIT (0<<3)
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
30 #define AF_FORMAT_16BIT (1<<3)
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
31 #define AF_FORMAT_24BIT (2<<3)
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
32 #define AF_FORMAT_32BIT (3<<3)
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
33 #define AF_FORMAT_40BIT (4<<3)
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
34 #define AF_FORMAT_48BIT (5<<3)
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
35 #define AF_FORMAT_BITS_MASK (7<<3)
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
36
8167
e8832e66babd New features:
anders
parents:
diff changeset
37 // Special flags refering to non pcm data
14245
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
38 #define AF_FORMAT_MU_LAW (1<<6)
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
39 #define AF_FORMAT_A_LAW (2<<6)
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
40 #define AF_FORMAT_MPEG2 (3<<6) // MPEG(2) audio
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
41 #define AF_FORMAT_AC3 (4<<6) // Dolby Digital AC3
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
42 #define AF_FORMAT_IMA_ADPCM (5<<6)
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
43 #define AF_FORMAT_SPECIAL_MASK (7<<6)
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
44
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
45 // PREDEFINED formats
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
46
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
47 #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
48 #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
49 #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
50 #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
51 #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
52 #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
53 #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
54 #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
55 #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
56 #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
57 #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
58 #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
59 #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
60 #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
61
14245
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
62 #define AF_FORMAT_FLOAT_LE (AF_FORMAT_F|AF_FORMAT_32BIT|AF_FORMAT_LE)
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
63 #define AF_FORMAT_FLOAT_BE (AF_FORMAT_F|AF_FORMAT_32BIT|AF_FORMAT_BE)
8994
06d7ef3c7b01 export fmt2str()
arpi
parents: 8167
diff changeset
64
14245
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
65 #ifdef WORDS_BIGENDIAN
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
66 #define AF_FORMAT_U16_NE AF_FORMAT_U16_BE
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
67 #define AF_FORMAT_S16_NE AF_FORMAT_S16_BE
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
68 #define AF_FORMAT_U24_NE AF_FORMAT_U24_BE
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
69 #define AF_FORMAT_S24_NE AF_FORMAT_S24_BE
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
70 #define AF_FORMAT_U32_NE AF_FORMAT_U32_BE
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
71 #define AF_FORMAT_S32_NE AF_FORMAT_S32_BE
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
72 #define AF_FORMAT_FLOAT_NE AF_FORMAT_FLOAT_BE
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
73 #else
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
74 #define AF_FORMAT_U16_NE AF_FORMAT_U16_LE
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
75 #define AF_FORMAT_S16_NE AF_FORMAT_S16_LE
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
76 #define AF_FORMAT_U24_NE AF_FORMAT_U24_LE
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
77 #define AF_FORMAT_S24_NE AF_FORMAT_S24_LE
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
78 #define AF_FORMAT_U32_NE AF_FORMAT_U32_LE
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
79 #define AF_FORMAT_S32_NE AF_FORMAT_S32_LE
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
80 #define AF_FORMAT_FLOAT_NE AF_FORMAT_FLOAT_LE
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
81 #endif
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
82
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
83 extern int af_str2fmt(char *str);
14335
8380694ba14f af_bits2fmt and af_str2fmt_short, also removed the extra FORMAT_BPS control in format.c
alex
parents: 14263
diff changeset
84 extern int af_str2fmt_short(char *str);
14245
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
85 extern int af_fmt2bits(int format);
14335
8380694ba14f af_bits2fmt and af_str2fmt_short, also removed the extra FORMAT_BPS control in format.c
alex
parents: 14263
diff changeset
86 extern int af_bits2fmt(int bits);
14245
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
87 extern char* af_fmt2str(int format, char* str, int size);
14263
bc80d39d19e8 af_fmt2str_short
alex
parents: 14245
diff changeset
88 extern char* af_fmt2str_short(int format);
14245
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
89
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13550
diff changeset
90 #endif /* __af_format_h__ */