add ffmpeg eatgv codec
[mplayer/greg.git] / libfaad2 / neaacdec.h
blobe0c10b66c5853ead491a8b693a252299e2428420
1 /*
2 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
3 ** Copyright (C) 2003-2004 M. Bakker, Ahead Software 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.
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.
19 ** Any non-GPL usage of this software or parts of this software is strictly
20 ** forbidden.
22 ** Commercial non-GPL licensing of this software is possible.
23 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
25 ** $Id: neaacdec.h,v 1.5 2004/09/04 14:56:27 menno Exp $
26 **/
28 #ifndef __NEAACDEC_H__
29 #define __NEAACDEC_H__
31 #ifdef __cplusplus
32 extern "C" {
33 #endif /* __cplusplus */
36 #if 1
37 /* MACROS FOR BACKWARDS COMPATIBILITY */
38 /* structs */
39 #define faacDecHandle NeAACDecHandle
40 #define faacDecConfiguration NeAACDecConfiguration
41 #define faacDecConfigurationPtr NeAACDecConfigurationPtr
42 #define faacDecFrameInfo NeAACDecFrameInfo
43 /* functions */
44 #define faacDecGetErrorMessage NeAACDecGetErrorMessage
45 #define faacDecSetConfiguration NeAACDecSetConfiguration
46 #define faacDecGetCurrentConfiguration NeAACDecGetCurrentConfiguration
47 #define faacDecInit NeAACDecInit
48 #define faacDecInit2 NeAACDecInit2
49 #define faacDecInitDRM NeAACDecInitDRM
50 #define faacDecPostSeekReset NeAACDecPostSeekReset
51 #define faacDecOpen NeAACDecOpen
52 #define faacDecClose NeAACDecClose
53 #define faacDecDecode NeAACDecDecode
54 #define AudioSpecificConfig NeAACDecAudioSpecificConfig
55 #endif
58 #ifdef _WIN32
59 #pragma pack(push, 8)
60 #ifndef NEAACDECAPI
61 #define NEAACDECAPI __cdecl
62 #endif
63 #else
64 #ifndef NEAACDECAPI
65 #define NEAACDECAPI
66 #endif
67 #endif
69 #define FAAD2_VERSION "2.1 beta"
71 /* object types for AAC */
72 #define MAIN 1
73 #define LC 2
74 #define SSR 3
75 #define LTP 4
76 #define HE_AAC 5
77 #define ER_LC 17
78 #define ER_LTP 19
79 #define LD 23
80 #define DRM_ER_LC 27 /* special object type for DRM */
82 /* header types */
83 #define RAW 0
84 #define ADIF 1
85 #define ADTS 2
86 #define LATM 3
88 /* SBR signalling */
89 #define NO_SBR 0
90 #define SBR_UPSAMPLED 1
91 #define SBR_DOWNSAMPLED 2
92 #define NO_SBR_UPSAMPLED 3
94 /* library output formats */
95 #define FAAD_FMT_16BIT 1
96 #define FAAD_FMT_24BIT 2
97 #define FAAD_FMT_32BIT 3
98 #define FAAD_FMT_FLOAT 4
99 #define FAAD_FMT_FIXED FAAD_FMT_FLOAT
100 #define FAAD_FMT_DOUBLE 5
102 /* Capabilities */
103 #define LC_DEC_CAP (1<<0) /* Can decode LC */
104 #define MAIN_DEC_CAP (1<<1) /* Can decode MAIN */
105 #define LTP_DEC_CAP (1<<2) /* Can decode LTP */
106 #define LD_DEC_CAP (1<<3) /* Can decode LD */
107 #define ERROR_RESILIENCE_CAP (1<<4) /* Can decode ER */
108 #define FIXED_POINT_CAP (1<<5) /* Fixed point */
110 /* Channel definitions */
111 #define FRONT_CHANNEL_CENTER (1)
112 #define FRONT_CHANNEL_LEFT (2)
113 #define FRONT_CHANNEL_RIGHT (3)
114 #define SIDE_CHANNEL_LEFT (4)
115 #define SIDE_CHANNEL_RIGHT (5)
116 #define BACK_CHANNEL_LEFT (6)
117 #define BACK_CHANNEL_RIGHT (7)
118 #define BACK_CHANNEL_CENTER (8)
119 #define LFE_CHANNEL (9)
120 #define UNKNOWN_CHANNEL (0)
122 /* DRM channel definitions */
123 #define DRMCH_MONO 1
124 #define DRMCH_STEREO 2
125 #define DRMCH_SBR_MONO 3
126 #define DRMCH_SBR_STEREO 4
127 #define DRMCH_SBR_PS_STEREO 5
130 /* A decode call can eat up to FAAD_MIN_STREAMSIZE bytes per decoded channel,
131 so at least so much bytes per channel should be available in this stream */
132 #define FAAD_MIN_STREAMSIZE 768 /* 6144 bits/channel */
135 typedef void *NeAACDecHandle;
137 typedef struct mp4AudioSpecificConfig
139 /* Audio Specific Info */
140 unsigned char objectTypeIndex;
141 unsigned char samplingFrequencyIndex;
142 unsigned long samplingFrequency;
143 unsigned char channelsConfiguration;
145 /* GA Specific Info */
146 unsigned char frameLengthFlag;
147 unsigned char dependsOnCoreCoder;
148 unsigned short coreCoderDelay;
149 unsigned char extensionFlag;
150 unsigned char aacSectionDataResilienceFlag;
151 unsigned char aacScalefactorDataResilienceFlag;
152 unsigned char aacSpectralDataResilienceFlag;
153 unsigned char epConfig;
155 char sbr_present_flag;
156 char forceUpSampling;
157 char downSampledSBR;
158 } mp4AudioSpecificConfig;
160 typedef struct NeAACDecConfiguration
162 unsigned char defObjectType;
163 unsigned long defSampleRate;
164 unsigned char outputFormat;
165 unsigned char downMatrix;
166 unsigned char useOldADTSFormat;
167 unsigned char dontUpSampleImplicitSBR;
168 } NeAACDecConfiguration, *NeAACDecConfigurationPtr;
170 typedef struct NeAACDecFrameInfo
172 unsigned long bytesconsumed;
173 unsigned long samples;
174 unsigned char channels;
175 unsigned char error;
176 unsigned long samplerate;
178 /* SBR: 0: off, 1: on; upsample, 2: on; downsampled, 3: off; upsampled */
179 unsigned char sbr;
181 /* MPEG-4 ObjectType */
182 unsigned char object_type;
184 /* AAC header type; MP4 will be signalled as RAW also */
185 unsigned char header_type;
187 /* multichannel configuration */
188 unsigned char num_front_channels;
189 unsigned char num_side_channels;
190 unsigned char num_back_channels;
191 unsigned char num_lfe_channels;
192 unsigned char channel_position[64];
194 /* PS: 0: off, 1: on */
195 unsigned char ps;
196 } NeAACDecFrameInfo;
198 char* NEAACDECAPI NeAACDecGetErrorMessage(unsigned char errcode);
200 unsigned long NEAACDECAPI NeAACDecGetCapabilities(void);
202 NeAACDecHandle NEAACDECAPI NeAACDecOpen(void);
204 NeAACDecConfigurationPtr NEAACDECAPI NeAACDecGetCurrentConfiguration(NeAACDecHandle hDecoder);
206 unsigned char NEAACDECAPI NeAACDecSetConfiguration(NeAACDecHandle hDecoder,
207 NeAACDecConfigurationPtr config);
209 /* Init the library based on info from the AAC file (ADTS/ADIF) */
210 long NEAACDECAPI NeAACDecInit(NeAACDecHandle hDecoder,
211 unsigned char *buffer,
212 unsigned long buffer_size,
213 unsigned long *samplerate,
214 unsigned char *channels);
216 /* Init the library using a DecoderSpecificInfo */
217 char NEAACDECAPI NeAACDecInit2(NeAACDecHandle hDecoder, unsigned char *pBuffer,
218 unsigned long SizeOfDecoderSpecificInfo,
219 unsigned long *samplerate, unsigned char *channels);
221 /* Init the library for DRM */
222 char NEAACDECAPI NeAACDecInitDRM(NeAACDecHandle *hDecoder, unsigned long samplerate,
223 unsigned char channels);
225 void NEAACDECAPI NeAACDecPostSeekReset(NeAACDecHandle hDecoder, long frame);
227 void NEAACDECAPI NeAACDecClose(NeAACDecHandle hDecoder);
229 void* NEAACDECAPI NeAACDecDecode(NeAACDecHandle hDecoder,
230 NeAACDecFrameInfo *hInfo,
231 unsigned char *buffer,
232 unsigned long buffer_size);
234 void* NEAACDECAPI NeAACDecDecode2(NeAACDecHandle hDecoder,
235 NeAACDecFrameInfo *hInfo,
236 unsigned char *buffer,
237 unsigned long buffer_size,
238 void **sample_buffer,
239 unsigned long sample_buffer_size);
241 char NEAACDECAPI NeAACDecAudioSpecificConfig(unsigned char *pBuffer,
242 unsigned long buffer_size,
243 mp4AudioSpecificConfig *mp4ASC);
245 #ifdef _WIN32
246 #pragma pack(pop)
247 #endif
249 #ifdef __cplusplus
251 #endif /* __cplusplus */
253 #endif