10725
|
1 /*
|
|
2 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
|
|
3 ** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
|
10989
|
4 **
|
10725
|
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.
|
10989
|
9 **
|
10725
|
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.
|
10989
|
14 **
|
10725
|
15 ** You should have received a copy of the GNU General Public License
|
10989
|
16 ** along with this program; if not, write to the Free Software
|
10725
|
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 **
|
10989
|
25 ** $Id: faad.h,v 1.33 2003/09/24 19:55:34 menno Exp $
|
10725
|
26 **/
|
|
27
|
|
28 #ifndef __AACDEC_H__
|
|
29 #define __AACDEC_H__
|
|
30
|
|
31 #ifdef __cplusplus
|
|
32 extern "C" {
|
|
33 #endif /* __cplusplus */
|
|
34
|
|
35 #ifdef _WIN32
|
|
36 #pragma pack(push, 8)
|
|
37 #ifndef FAADAPI
|
|
38 #define FAADAPI __cdecl
|
|
39 #endif
|
|
40 #else
|
|
41 #ifndef FAADAPI
|
|
42 #define FAADAPI
|
|
43 #endif
|
|
44 #endif
|
|
45
|
|
46 #define FAAD2_VERSION "2.0 RC1 "
|
|
47
|
|
48 /* object types for AAC */
|
10989
|
49 #define MAIN 1
|
|
50 #define LC 2
|
|
51 #define SSR 3
|
|
52 #define LTP 4
|
|
53 #define HE_AAC 5
|
10725
|
54 #define ER_LC 17
|
|
55 #define ER_LTP 19
|
|
56 #define LD 23
|
|
57 #define DRM_ER_LC 27 /* special object type for DRM */
|
|
58
|
|
59 /* header types */
|
|
60 #define RAW 0
|
|
61 #define ADIF 1
|
|
62 #define ADTS 2
|
|
63
|
10989
|
64 /* SBR signalling */
|
|
65 #define NO_SBR 0
|
|
66 #define SBR_UPSAMPLED 1
|
|
67 #define SBR_DOWNSAMPLED 2
|
|
68 #define NO_SBR_UPSAMPLED 3
|
|
69
|
10725
|
70 /* library output formats */
|
|
71 #define FAAD_FMT_16BIT 1
|
|
72 #define FAAD_FMT_24BIT 2
|
|
73 #define FAAD_FMT_32BIT 3
|
|
74 #define FAAD_FMT_FLOAT 4
|
|
75 #define FAAD_FMT_DOUBLE 5
|
|
76 #define FAAD_FMT_16BIT_DITHER 6
|
|
77 #define FAAD_FMT_16BIT_L_SHAPE 7
|
|
78 #define FAAD_FMT_16BIT_M_SHAPE 8
|
|
79 #define FAAD_FMT_16BIT_H_SHAPE 9
|
|
80
|
|
81 /* Capabilities */
|
|
82 #define LC_DEC_CAP (1<<0)
|
|
83 #define MAIN_DEC_CAP (1<<1)
|
|
84 #define LTP_DEC_CAP (1<<2)
|
|
85 #define LD_DEC_CAP (1<<3)
|
|
86 #define ERROR_RESILIENCE_CAP (1<<4)
|
|
87 #define FIXED_POINT_CAP (1<<5)
|
|
88
|
|
89 /* Channel definitions */
|
|
90 #define FRONT_CHANNEL_CENTER (1)
|
|
91 #define FRONT_CHANNEL_LEFT (2)
|
|
92 #define FRONT_CHANNEL_RIGHT (3)
|
|
93 #define SIDE_CHANNEL_LEFT (4)
|
|
94 #define SIDE_CHANNEL_RIGHT (5)
|
|
95 #define BACK_CHANNEL_LEFT (6)
|
|
96 #define BACK_CHANNEL_RIGHT (7)
|
|
97 #define BACK_CHANNEL_CENTER (8)
|
|
98 #define LFE_CHANNEL (9)
|
|
99 #define UNKNOWN_CHANNEL (0)
|
|
100
|
10989
|
101 /* DRM channel definitions */
|
|
102 #define DRMCH_MONO 1
|
|
103 #define DRMCH_STEREO 2
|
|
104 #define DRMCH_SBR_MONO 3
|
|
105 #define DRMCH_SBR_LC_STEREO 4
|
|
106 #define DRMCH_SBR_STEREO 5
|
|
107
|
10725
|
108
|
|
109 /* A decode call can eat up to FAAD_MIN_STREAMSIZE bytes per decoded channel,
|
|
110 so at least so much bytes per channel should be available in this stream */
|
|
111 #define FAAD_MIN_STREAMSIZE 768 /* 6144 bits/channel */
|
|
112
|
|
113
|
|
114 typedef void *faacDecHandle;
|
|
115
|
|
116 typedef struct mp4AudioSpecificConfig
|
|
117 {
|
|
118 /* Audio Specific Info */
|
|
119 unsigned char objectTypeIndex;
|
|
120 unsigned char samplingFrequencyIndex;
|
|
121 unsigned long samplingFrequency;
|
|
122 unsigned char channelsConfiguration;
|
|
123
|
|
124 /* GA Specific Info */
|
|
125 unsigned char frameLengthFlag;
|
|
126 unsigned char dependsOnCoreCoder;
|
|
127 unsigned short coreCoderDelay;
|
|
128 unsigned char extensionFlag;
|
|
129 unsigned char aacSectionDataResilienceFlag;
|
|
130 unsigned char aacScalefactorDataResilienceFlag;
|
|
131 unsigned char aacSpectralDataResilienceFlag;
|
|
132 unsigned char epConfig;
|
|
133
|
|
134 char sbr_present_flag;
|
10989
|
135 char forceUpSampling;
|
10725
|
136 } mp4AudioSpecificConfig;
|
|
137
|
|
138 typedef struct faacDecConfiguration
|
|
139 {
|
|
140 unsigned char defObjectType;
|
|
141 unsigned long defSampleRate;
|
|
142 unsigned char outputFormat;
|
|
143 unsigned char downMatrix;
|
10989
|
144 unsigned char useOldADTSFormat;
|
10725
|
145 } faacDecConfiguration, *faacDecConfigurationPtr;
|
|
146
|
|
147 typedef struct faacDecFrameInfo
|
|
148 {
|
|
149 unsigned long bytesconsumed;
|
|
150 unsigned long samples;
|
|
151 unsigned char channels;
|
|
152 unsigned char error;
|
|
153 unsigned long samplerate;
|
|
154
|
10989
|
155 /* SBR: 0: off, 1: on; upsample, 2: on; downsampled, 3: off; upsampled */
|
|
156 unsigned char sbr;
|
|
157
|
|
158 /* MPEG-4 ObjectType */
|
|
159 unsigned char object_type;
|
|
160
|
|
161 /* AAC header type; MP4 will be signalled as RAW also */
|
|
162 unsigned char header_type;
|
|
163
|
10725
|
164 /* multichannel configuration */
|
|
165 unsigned char num_front_channels;
|
|
166 unsigned char num_side_channels;
|
|
167 unsigned char num_back_channels;
|
|
168 unsigned char num_lfe_channels;
|
|
169 unsigned char channel_position[64];
|
|
170 } faacDecFrameInfo;
|
|
171
|
|
172 char* FAADAPI faacDecGetErrorMessage(unsigned char errcode);
|
|
173
|
|
174 unsigned long FAADAPI faacDecGetCapabilities();
|
|
175
|
|
176 faacDecHandle FAADAPI faacDecOpen();
|
|
177
|
|
178 faacDecConfigurationPtr FAADAPI faacDecGetCurrentConfiguration(faacDecHandle hDecoder);
|
|
179
|
|
180 unsigned char FAADAPI faacDecSetConfiguration(faacDecHandle hDecoder,
|
|
181 faacDecConfigurationPtr config);
|
|
182
|
|
183 /* Init the library based on info from the AAC file (ADTS/ADIF) */
|
|
184 long FAADAPI faacDecInit(faacDecHandle hDecoder,
|
|
185 unsigned char *buffer,
|
|
186 unsigned long buffer_size,
|
|
187 unsigned long *samplerate,
|
|
188 unsigned char *channels);
|
|
189
|
|
190 /* Init the library using a DecoderSpecificInfo */
|
|
191 char FAADAPI faacDecInit2(faacDecHandle hDecoder, unsigned char *pBuffer,
|
|
192 unsigned long SizeOfDecoderSpecificInfo,
|
|
193 unsigned long *samplerate, unsigned char *channels);
|
|
194
|
|
195 /* Init the library for DRM */
|
|
196 char FAADAPI faacDecInitDRM(faacDecHandle hDecoder, unsigned long samplerate,
|
|
197 unsigned char channels);
|
|
198
|
10989
|
199 void FAADAPI faacDecPostSeekReset(faacDecHandle hDecoder, long frame);
|
|
200
|
10725
|
201 void FAADAPI faacDecClose(faacDecHandle hDecoder);
|
|
202
|
|
203 void* FAADAPI faacDecDecode(faacDecHandle hDecoder,
|
|
204 faacDecFrameInfo *hInfo,
|
|
205 unsigned char *buffer,
|
|
206 unsigned long buffer_size);
|
|
207
|
|
208 char FAADAPI AudioSpecificConfig(unsigned char *pBuffer,
|
|
209 unsigned long buffer_size,
|
|
210 mp4AudioSpecificConfig *mp4ASC);
|
|
211
|
|
212 #ifdef _WIN32
|
|
213 #pragma pack(pop)
|
|
214 #endif
|
|
215
|
|
216 #ifdef __cplusplus
|
|
217 }
|
|
218 #endif /* __cplusplus */
|
|
219
|
|
220 #endif
|