1 | /*
|
---|
2 | ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
|
---|
3 | ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
|
---|
4 | **
|
---|
5 | ** This program is free software; you can redistribute it and/or modify
|
---|
6 | ** it under the terms of the GNU General Public License as published by
|
---|
7 | ** the Free Software Foundation; either version 2 of the License, or
|
---|
8 | ** (at your option) any later version.
|
---|
9 | **
|
---|
10 | ** This program is distributed in the hope that it will be useful,
|
---|
11 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
12 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
13 | ** GNU General Public License for more details.
|
---|
14 | **
|
---|
15 | ** You should have received a copy of the GNU General Public License
|
---|
16 | ** along with this program; if not, write to the Free Software
|
---|
17 | ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
---|
18 | **
|
---|
19 | ** Any non-GPL usage of this software or parts of this software is strictly
|
---|
20 | ** forbidden.
|
---|
21 | **
|
---|
22 | ** The "appropriate copyright message" mentioned in section 2c of the GPLv2
|
---|
23 | ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
|
---|
24 | **
|
---|
25 | ** Commercial non-GPL licensing of this software is possible.
|
---|
26 | ** For more info contact Nero AG through [email protected].
|
---|
27 | **
|
---|
28 | ** $Id: neaacdec.h,v 1.11 2007/11/01 12:33:29 menno Exp $
|
---|
29 | **/
|
---|
30 |
|
---|
31 | #ifndef __NEAACDEC_H__
|
---|
32 | #define __NEAACDEC_H__
|
---|
33 |
|
---|
34 | #ifdef __cplusplus
|
---|
35 | extern "C" {
|
---|
36 | #endif /* __cplusplus */
|
---|
37 |
|
---|
38 |
|
---|
39 | #if 1
|
---|
40 | /* MACROS FOR BACKWARDS COMPATIBILITY */
|
---|
41 | /* structs */
|
---|
42 | #define faacDecHandle NeAACDecHandle
|
---|
43 | #define faacDecConfiguration NeAACDecConfiguration
|
---|
44 | #define faacDecConfigurationPtr NeAACDecConfigurationPtr
|
---|
45 | #define faacDecFrameInfo NeAACDecFrameInfo
|
---|
46 | /* functions */
|
---|
47 | #define faacDecGetErrorMessage NeAACDecGetErrorMessage
|
---|
48 | #define faacDecSetConfiguration NeAACDecSetConfiguration
|
---|
49 | #define faacDecGetCurrentConfiguration NeAACDecGetCurrentConfiguration
|
---|
50 | #define faacDecInit NeAACDecInit
|
---|
51 | #define faacDecInit2 NeAACDecInit2
|
---|
52 | #define faacDecInitDRM NeAACDecInitDRM
|
---|
53 | #define faacDecPostSeekReset NeAACDecPostSeekReset
|
---|
54 | #define faacDecOpen NeAACDecOpen
|
---|
55 | #define faacDecClose NeAACDecClose
|
---|
56 | #define faacDecDecode NeAACDecDecode
|
---|
57 | #define AudioSpecificConfig NeAACDecAudioSpecificConfig
|
---|
58 | #endif
|
---|
59 |
|
---|
60 |
|
---|
61 | #ifdef _WIN32
|
---|
62 | #pragma pack(push, 8)
|
---|
63 | #ifndef NEAACDECAPI
|
---|
64 | #define NEAACDECAPI __cdecl
|
---|
65 | #endif
|
---|
66 | #else
|
---|
67 | #ifndef NEAACDECAPI
|
---|
68 | #define NEAACDECAPI
|
---|
69 | #endif
|
---|
70 | #endif
|
---|
71 |
|
---|
72 | #define FAAD2_VERSION "2.6"
|
---|
73 |
|
---|
74 | /* object types for AAC */
|
---|
75 | #define MAIN 1
|
---|
76 | #define LC 2
|
---|
77 | #define SSR 3
|
---|
78 | #define LTP 4
|
---|
79 | #define HE_AAC 5
|
---|
80 | #define ER_LC 17
|
---|
81 | #define ER_LTP 19
|
---|
82 | #define LD 23
|
---|
83 | #define DRM_ER_LC 27 /* special object type for DRM */
|
---|
84 |
|
---|
85 | /* header types */
|
---|
86 | #define RAW 0
|
---|
87 | #define ADIF 1
|
---|
88 | #define ADTS 2
|
---|
89 |
|
---|
90 | /* SBR signalling */
|
---|
91 | #define NO_SBR 0
|
---|
92 | #define SBR_UPSAMPLED 1
|
---|
93 | #define SBR_DOWNSAMPLED 2
|
---|
94 | #define NO_SBR_UPSAMPLED 3
|
---|
95 |
|
---|
96 | /* library output formats */
|
---|
97 | #define FAAD_FMT_16BIT 1
|
---|
98 | #define FAAD_FMT_24BIT 2
|
---|
99 | #define FAAD_FMT_32BIT 3
|
---|
100 | #define FAAD_FMT_FLOAT 4
|
---|
101 | #define FAAD_FMT_FIXED FAAD_FMT_FLOAT
|
---|
102 | #define FAAD_FMT_DOUBLE 5
|
---|
103 |
|
---|
104 | /* Capabilities */
|
---|
105 | #define LC_DEC_CAP (1<<0) /* Can decode LC */
|
---|
106 | #define MAIN_DEC_CAP (1<<1) /* Can decode MAIN */
|
---|
107 | #define LTP_DEC_CAP (1<<2) /* Can decode LTP */
|
---|
108 | #define LD_DEC_CAP (1<<3) /* Can decode LD */
|
---|
109 | #define ERROR_RESILIENCE_CAP (1<<4) /* Can decode ER */
|
---|
110 | #define FIXED_POINT_CAP (1<<5) /* Fixed point */
|
---|
111 |
|
---|
112 | /* Channel definitions */
|
---|
113 | #define FRONT_CHANNEL_CENTER (1)
|
---|
114 | #define FRONT_CHANNEL_LEFT (2)
|
---|
115 | #define FRONT_CHANNEL_RIGHT (3)
|
---|
116 | #define SIDE_CHANNEL_LEFT (4)
|
---|
117 | #define SIDE_CHANNEL_RIGHT (5)
|
---|
118 | #define BACK_CHANNEL_LEFT (6)
|
---|
119 | #define BACK_CHANNEL_RIGHT (7)
|
---|
120 | #define BACK_CHANNEL_CENTER (8)
|
---|
121 | #define LFE_CHANNEL (9)
|
---|
122 | #define UNKNOWN_CHANNEL (0)
|
---|
123 |
|
---|
124 | /* DRM channel definitions */
|
---|
125 | #define DRMCH_MONO 1
|
---|
126 | #define DRMCH_STEREO 2
|
---|
127 | #define DRMCH_SBR_MONO 3
|
---|
128 | #define DRMCH_SBR_STEREO 4
|
---|
129 | #define DRMCH_SBR_PS_STEREO 5
|
---|
130 |
|
---|
131 |
|
---|
132 | /* A decode call can eat up to FAAD_MIN_STREAMSIZE bytes per decoded channel,
|
---|
133 | so at least so much bytes per channel should be available in this stream */
|
---|
134 | #define FAAD_MIN_STREAMSIZE 768 /* 6144 bits/channel */
|
---|
135 |
|
---|
136 |
|
---|
137 | typedef void *NeAACDecHandle;
|
---|
138 |
|
---|
139 | typedef struct mp4AudioSpecificConfig
|
---|
140 | {
|
---|
141 | /* Audio Specific Info */
|
---|
142 | unsigned char objectTypeIndex;
|
---|
143 | unsigned char samplingFrequencyIndex;
|
---|
144 | unsigned long samplingFrequency;
|
---|
145 | unsigned char channelsConfiguration;
|
---|
146 |
|
---|
147 | /* GA Specific Info */
|
---|
148 | unsigned char frameLengthFlag;
|
---|
149 | unsigned char dependsOnCoreCoder;
|
---|
150 | unsigned short coreCoderDelay;
|
---|
151 | unsigned char extensionFlag;
|
---|
152 | unsigned char aacSectionDataResilienceFlag;
|
---|
153 | unsigned char aacScalefactorDataResilienceFlag;
|
---|
154 | unsigned char aacSpectralDataResilienceFlag;
|
---|
155 | unsigned char epConfig;
|
---|
156 |
|
---|
157 | char sbr_present_flag;
|
---|
158 | char forceUpSampling;
|
---|
159 | char downSampledSBR;
|
---|
160 | } mp4AudioSpecificConfig;
|
---|
161 |
|
---|
162 | typedef struct NeAACDecConfiguration
|
---|
163 | {
|
---|
164 | unsigned char defObjectType;
|
---|
165 | unsigned long defSampleRate;
|
---|
166 | unsigned char outputFormat;
|
---|
167 | unsigned char downMatrix;
|
---|
168 | unsigned char useOldADTSFormat;
|
---|
169 | unsigned char dontUpSampleImplicitSBR;
|
---|
170 | } NeAACDecConfiguration, *NeAACDecConfigurationPtr;
|
---|
171 |
|
---|
172 | typedef struct NeAACDecFrameInfo
|
---|
173 | {
|
---|
174 | unsigned long bytesconsumed;
|
---|
175 | unsigned long samples;
|
---|
176 | unsigned char channels;
|
---|
177 | unsigned char error;
|
---|
178 | unsigned long samplerate;
|
---|
179 |
|
---|
180 | /* SBR: 0: off, 1: on; upsample, 2: on; downsampled, 3: off; upsampled */
|
---|
181 | unsigned char sbr;
|
---|
182 |
|
---|
183 | /* MPEG-4 ObjectType */
|
---|
184 | unsigned char object_type;
|
---|
185 |
|
---|
186 | /* AAC header type; MP4 will be signalled as RAW also */
|
---|
187 | unsigned char header_type;
|
---|
188 |
|
---|
189 | /* multichannel configuration */
|
---|
190 | unsigned char num_front_channels;
|
---|
191 | unsigned char num_side_channels;
|
---|
192 | unsigned char num_back_channels;
|
---|
193 | unsigned char num_lfe_channels;
|
---|
194 | unsigned char channel_position[64];
|
---|
195 |
|
---|
196 | /* PS: 0: off, 1: on */
|
---|
197 | unsigned char ps;
|
---|
198 | } NeAACDecFrameInfo;
|
---|
199 |
|
---|
200 | char* NEAACDECAPI NeAACDecGetErrorMessage(unsigned char errcode);
|
---|
201 |
|
---|
202 | unsigned long NEAACDECAPI NeAACDecGetCapabilities(void);
|
---|
203 |
|
---|
204 | NeAACDecHandle NEAACDECAPI NeAACDecOpen(void);
|
---|
205 |
|
---|
206 | NeAACDecConfigurationPtr NEAACDECAPI NeAACDecGetCurrentConfiguration(NeAACDecHandle hDecoder);
|
---|
207 |
|
---|
208 | unsigned char NEAACDECAPI NeAACDecSetConfiguration(NeAACDecHandle hDecoder,
|
---|
209 | NeAACDecConfigurationPtr config);
|
---|
210 |
|
---|
211 | /* Init the library based on info from the AAC file (ADTS/ADIF) */
|
---|
212 | long NEAACDECAPI NeAACDecInit(NeAACDecHandle hDecoder,
|
---|
213 | unsigned char *buffer,
|
---|
214 | unsigned long buffer_size,
|
---|
215 | unsigned long *samplerate,
|
---|
216 | unsigned char *channels);
|
---|
217 |
|
---|
218 | /* Init the library using a DecoderSpecificInfo */
|
---|
219 | char NEAACDECAPI NeAACDecInit2(NeAACDecHandle hDecoder, unsigned char *pBuffer,
|
---|
220 | unsigned long SizeOfDecoderSpecificInfo,
|
---|
221 | unsigned long *samplerate, unsigned char *channels);
|
---|
222 |
|
---|
223 | /* Init the library for DRM */
|
---|
224 | char NEAACDECAPI NeAACDecInitDRM(NeAACDecHandle *hDecoder, unsigned long samplerate,
|
---|
225 | unsigned char channels);
|
---|
226 |
|
---|
227 | void NEAACDECAPI NeAACDecPostSeekReset(NeAACDecHandle hDecoder, long frame);
|
---|
228 |
|
---|
229 | void NEAACDECAPI NeAACDecClose(NeAACDecHandle hDecoder);
|
---|
230 |
|
---|
231 | void* NEAACDECAPI NeAACDecDecode(NeAACDecHandle hDecoder,
|
---|
232 | NeAACDecFrameInfo *hInfo,
|
---|
233 | unsigned char *buffer,
|
---|
234 | unsigned long buffer_size);
|
---|
235 |
|
---|
236 | void* NEAACDECAPI NeAACDecDecode2(NeAACDecHandle hDecoder,
|
---|
237 | NeAACDecFrameInfo *hInfo,
|
---|
238 | unsigned char *buffer,
|
---|
239 | unsigned long buffer_size,
|
---|
240 | void **sample_buffer,
|
---|
241 | unsigned long sample_buffer_size);
|
---|
242 |
|
---|
243 | char NEAACDECAPI NeAACDecAudioSpecificConfig(unsigned char *pBuffer,
|
---|
244 | unsigned long buffer_size,
|
---|
245 | mp4AudioSpecificConfig *mp4ASC);
|
---|
246 |
|
---|
247 | #ifdef _WIN32
|
---|
248 | #pragma pack(pop)
|
---|
249 | #endif
|
---|
250 |
|
---|
251 | #ifdef __cplusplus
|
---|
252 | }
|
---|
253 | #endif /* __cplusplus */
|
---|
254 |
|
---|
255 | #endif
|
---|