avoid conflicting types error on cygwin
[mplayer.git] / libfaad2 / neaacdec.h
blob71ab4078af90bca943be28a03f093cc3e5600685
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.4 2004/04/03 10:49:14 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
87 /* SBR signalling */
88 #define NO_SBR 0
89 #define SBR_UPSAMPLED 1
90 #define SBR_DOWNSAMPLED 2
91 #define NO_SBR_UPSAMPLED 3
93 /* library output formats */
94 #define FAAD_FMT_16BIT 1
95 #define FAAD_FMT_24BIT 2
96 #define FAAD_FMT_32BIT 3
97 #define FAAD_FMT_FLOAT 4
98 #define FAAD_FMT_FIXED FAAD_FMT_FLOAT
99 #define FAAD_FMT_DOUBLE 5
101 /* Capabilities */
102 #define LC_DEC_CAP (1<<0) /* Can decode LC */
103 #define MAIN_DEC_CAP (1<<1) /* Can decode MAIN */
104 #define LTP_DEC_CAP (1<<2) /* Can decode LTP */
105 #define LD_DEC_CAP (1<<3) /* Can decode LD */
106 #define ERROR_RESILIENCE_CAP (1<<4) /* Can decode ER */
107 #define FIXED_POINT_CAP (1<<5) /* Fixed point */
109 /* Channel definitions */
110 #define FRONT_CHANNEL_CENTER (1)
111 #define FRONT_CHANNEL_LEFT (2)
112 #define FRONT_CHANNEL_RIGHT (3)
113 #define SIDE_CHANNEL_LEFT (4)
114 #define SIDE_CHANNEL_RIGHT (5)
115 #define BACK_CHANNEL_LEFT (6)
116 #define BACK_CHANNEL_RIGHT (7)
117 #define BACK_CHANNEL_CENTER (8)
118 #define LFE_CHANNEL (9)
119 #define UNKNOWN_CHANNEL (0)
121 /* DRM channel definitions */
122 #define DRMCH_MONO 1
123 #define DRMCH_STEREO 2
124 #define DRMCH_SBR_MONO 3
125 #define DRMCH_SBR_STEREO 4
126 #define DRMCH_SBR_PS_STEREO 5
129 /* A decode call can eat up to FAAD_MIN_STREAMSIZE bytes per decoded channel,
130 so at least so much bytes per channel should be available in this stream */
131 #define FAAD_MIN_STREAMSIZE 768 /* 6144 bits/channel */
134 typedef void *NeAACDecHandle;
136 typedef struct mp4AudioSpecificConfig
138 /* Audio Specific Info */
139 unsigned char objectTypeIndex;
140 unsigned char samplingFrequencyIndex;
141 unsigned long samplingFrequency;
142 unsigned char channelsConfiguration;
144 /* GA Specific Info */
145 unsigned char frameLengthFlag;
146 unsigned char dependsOnCoreCoder;
147 unsigned short coreCoderDelay;
148 unsigned char extensionFlag;
149 unsigned char aacSectionDataResilienceFlag;
150 unsigned char aacScalefactorDataResilienceFlag;
151 unsigned char aacSpectralDataResilienceFlag;
152 unsigned char epConfig;
154 char sbr_present_flag;
155 char forceUpSampling;
156 char downSampledSBR;
157 } mp4AudioSpecificConfig;
159 typedef struct NeAACDecConfiguration
161 unsigned char defObjectType;
162 unsigned long defSampleRate;
163 unsigned char outputFormat;
164 unsigned char downMatrix;
165 unsigned char useOldADTSFormat;
166 unsigned char dontUpSampleImplicitSBR;
167 } NeAACDecConfiguration, *NeAACDecConfigurationPtr;
169 typedef struct NeAACDecFrameInfo
171 unsigned long bytesconsumed;
172 unsigned long samples;
173 unsigned char channels;
174 unsigned char error;
175 unsigned long samplerate;
177 /* SBR: 0: off, 1: on; upsample, 2: on; downsampled, 3: off; upsampled */
178 unsigned char sbr;
180 /* MPEG-4 ObjectType */
181 unsigned char object_type;
183 /* AAC header type; MP4 will be signalled as RAW also */
184 unsigned char header_type;
186 /* multichannel configuration */
187 unsigned char num_front_channels;
188 unsigned char num_side_channels;
189 unsigned char num_back_channels;
190 unsigned char num_lfe_channels;
191 unsigned char channel_position[64];
192 } NeAACDecFrameInfo;
194 char* NEAACDECAPI NeAACDecGetErrorMessage(unsigned char errcode);
196 unsigned long NEAACDECAPI NeAACDecGetCapabilities(void);
198 NeAACDecHandle NEAACDECAPI NeAACDecOpen(void);
200 NeAACDecConfigurationPtr NEAACDECAPI NeAACDecGetCurrentConfiguration(NeAACDecHandle hDecoder);
202 unsigned char NEAACDECAPI NeAACDecSetConfiguration(NeAACDecHandle hDecoder,
203 NeAACDecConfigurationPtr config);
205 /* Init the library based on info from the AAC file (ADTS/ADIF) */
206 long NEAACDECAPI NeAACDecInit(NeAACDecHandle hDecoder,
207 unsigned char *buffer,
208 unsigned long buffer_size,
209 unsigned long *samplerate,
210 unsigned char *channels);
212 /* Init the library using a DecoderSpecificInfo */
213 char NEAACDECAPI NeAACDecInit2(NeAACDecHandle hDecoder, unsigned char *pBuffer,
214 unsigned long SizeOfDecoderSpecificInfo,
215 unsigned long *samplerate, unsigned char *channels);
217 /* Init the library for DRM */
218 char NEAACDECAPI NeAACDecInitDRM(NeAACDecHandle *hDecoder, unsigned long samplerate,
219 unsigned char channels);
221 void NEAACDECAPI NeAACDecPostSeekReset(NeAACDecHandle hDecoder, long frame);
223 void NEAACDECAPI NeAACDecClose(NeAACDecHandle hDecoder);
225 void* NEAACDECAPI NeAACDecDecode(NeAACDecHandle hDecoder,
226 NeAACDecFrameInfo *hInfo,
227 unsigned char *buffer,
228 unsigned long buffer_size);
230 char NEAACDECAPI NeAACDecAudioSpecificConfig(unsigned char *pBuffer,
231 unsigned long buffer_size,
232 mp4AudioSpecificConfig *mp4ASC);
234 #ifdef _WIN32
235 #pragma pack(pop)
236 #endif
238 #ifdef __cplusplus
240 #endif /* __cplusplus */
242 #endif