Mercurial > mplayer.hg
annotate libfaad2/neaacdec.h @ 16125:e2bcf37fe028
Fix crash with large images
author | reimar |
---|---|
date | Thu, 28 Jul 2005 09:58:32 +0000 |
parents | 2ae5ab4331ca |
children | 59b6fa5b4201 |
rev | line source |
---|---|
13453 | 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. | |
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 ** Commercial non-GPL licensing of this software is possible. | |
23 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. | |
24 ** | |
14727
2ae5ab4331ca
Remove modification notice from files that have not been locally modified.
diego
parents:
13453
diff
changeset
|
25 ** $Id: neaacdec.h,v 1.4 2004/04/03 10:49:14 menno Exp $ |
13453 | 26 **/ |
27 | |
28 #ifndef __NEAACDEC_H__ | |
29 #define __NEAACDEC_H__ | |
30 | |
31 #ifdef __cplusplus | |
32 extern "C" { | |
33 #endif /* __cplusplus */ | |
34 | |
35 | |
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 | |
56 | |
57 | |
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 | |
68 | |
69 #define FAAD2_VERSION "2.1 beta" | |
70 | |
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 */ | |
81 | |
82 /* header types */ | |
83 #define RAW 0 | |
84 #define ADIF 1 | |
85 #define ADTS 2 | |
86 | |
87 /* SBR signalling */ | |
88 #define NO_SBR 0 | |
89 #define SBR_UPSAMPLED 1 | |
90 #define SBR_DOWNSAMPLED 2 | |
91 #define NO_SBR_UPSAMPLED 3 | |
92 | |
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 | |
100 | |
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 */ | |
108 | |
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) | |
120 | |
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 | |
127 | |
128 | |
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 */ | |
132 | |
133 | |
134 typedef void *NeAACDecHandle; | |
135 | |
136 typedef struct mp4AudioSpecificConfig | |
137 { | |
138 /* Audio Specific Info */ | |
139 unsigned char objectTypeIndex; | |
140 unsigned char samplingFrequencyIndex; | |
141 unsigned long samplingFrequency; | |
142 unsigned char channelsConfiguration; | |
143 | |
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; | |
153 | |
154 char sbr_present_flag; | |
155 char forceUpSampling; | |
156 char downSampledSBR; | |
157 } mp4AudioSpecificConfig; | |
158 | |
159 typedef struct NeAACDecConfiguration | |
160 { | |
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; | |
168 | |
169 typedef struct NeAACDecFrameInfo | |
170 { | |
171 unsigned long bytesconsumed; | |
172 unsigned long samples; | |
173 unsigned char channels; | |
174 unsigned char error; | |
175 unsigned long samplerate; | |
176 | |
177 /* SBR: 0: off, 1: on; upsample, 2: on; downsampled, 3: off; upsampled */ | |
178 unsigned char sbr; | |
179 | |
180 /* MPEG-4 ObjectType */ | |
181 unsigned char object_type; | |
182 | |
183 /* AAC header type; MP4 will be signalled as RAW also */ | |
184 unsigned char header_type; | |
185 | |
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; | |
193 | |
194 char* NEAACDECAPI NeAACDecGetErrorMessage(unsigned char errcode); | |
195 | |
196 unsigned long NEAACDECAPI NeAACDecGetCapabilities(void); | |
197 | |
198 NeAACDecHandle NEAACDECAPI NeAACDecOpen(void); | |
199 | |
200 NeAACDecConfigurationPtr NEAACDECAPI NeAACDecGetCurrentConfiguration(NeAACDecHandle hDecoder); | |
201 | |
202 unsigned char NEAACDECAPI NeAACDecSetConfiguration(NeAACDecHandle hDecoder, | |
203 NeAACDecConfigurationPtr config); | |
204 | |
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); | |
211 | |
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); | |
216 | |
217 /* Init the library for DRM */ | |
218 char NEAACDECAPI NeAACDecInitDRM(NeAACDecHandle *hDecoder, unsigned long samplerate, | |
219 unsigned char channels); | |
220 | |
221 void NEAACDECAPI NeAACDecPostSeekReset(NeAACDecHandle hDecoder, long frame); | |
222 | |
223 void NEAACDECAPI NeAACDecClose(NeAACDecHandle hDecoder); | |
224 | |
225 void* NEAACDECAPI NeAACDecDecode(NeAACDecHandle hDecoder, | |
226 NeAACDecFrameInfo *hInfo, | |
227 unsigned char *buffer, | |
228 unsigned long buffer_size); | |
229 | |
230 char NEAACDECAPI NeAACDecAudioSpecificConfig(unsigned char *pBuffer, | |
231 unsigned long buffer_size, | |
232 mp4AudioSpecificConfig *mp4ASC); | |
233 | |
234 #ifdef _WIN32 | |
235 #pragma pack(pop) | |
236 #endif | |
237 | |
238 #ifdef __cplusplus | |
239 } | |
240 #endif /* __cplusplus */ | |
241 | |
242 #endif |