comparison libfaad2/faad.h @ 10725:e989150f8216

libfaad2 v2.0rc1 imported
author arpi
date Sat, 30 Aug 2003 22:30:28 +0000
parents
children 3185f64f6350
comparison
equal deleted inserted replaced
10724:adf5697b9d83 10725:e989150f8216
1 /*
2 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
3 ** Copyright (C) 2003 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 **
25 ** $Id: faad.h,v 1.26 2003/07/29 08:20:11 menno Exp $
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 */
49 #define MAIN 0
50 #define LC 1
51 #define SSR 2
52 #define LTP 3
53 #define ER_LC 17
54 #define ER_LTP 19
55 #define LD 23
56 #define DRM_ER_LC 27 /* special object type for DRM */
57
58 /* header types */
59 #define RAW 0
60 #define ADIF 1
61 #define ADTS 2
62
63 /* library output formats */
64 #define FAAD_FMT_16BIT 1
65 #define FAAD_FMT_24BIT 2
66 #define FAAD_FMT_32BIT 3
67 #define FAAD_FMT_FLOAT 4
68 #define FAAD_FMT_DOUBLE 5
69 #define FAAD_FMT_16BIT_DITHER 6
70 #define FAAD_FMT_16BIT_L_SHAPE 7
71 #define FAAD_FMT_16BIT_M_SHAPE 8
72 #define FAAD_FMT_16BIT_H_SHAPE 9
73
74 /* Capabilities */
75 #define LC_DEC_CAP (1<<0)
76 #define MAIN_DEC_CAP (1<<1)
77 #define LTP_DEC_CAP (1<<2)
78 #define LD_DEC_CAP (1<<3)
79 #define ERROR_RESILIENCE_CAP (1<<4)
80 #define FIXED_POINT_CAP (1<<5)
81
82 /* Channel definitions */
83 #define FRONT_CHANNEL_CENTER (1)
84 #define FRONT_CHANNEL_LEFT (2)
85 #define FRONT_CHANNEL_RIGHT (3)
86 #define SIDE_CHANNEL_LEFT (4)
87 #define SIDE_CHANNEL_RIGHT (5)
88 #define BACK_CHANNEL_LEFT (6)
89 #define BACK_CHANNEL_RIGHT (7)
90 #define BACK_CHANNEL_CENTER (8)
91 #define LFE_CHANNEL (9)
92 #define UNKNOWN_CHANNEL (0)
93
94
95 /* A decode call can eat up to FAAD_MIN_STREAMSIZE bytes per decoded channel,
96 so at least so much bytes per channel should be available in this stream */
97 #define FAAD_MIN_STREAMSIZE 768 /* 6144 bits/channel */
98
99
100 typedef void *faacDecHandle;
101
102 typedef struct mp4AudioSpecificConfig
103 {
104 /* Audio Specific Info */
105 unsigned char objectTypeIndex;
106 unsigned char samplingFrequencyIndex;
107 unsigned long samplingFrequency;
108 unsigned char channelsConfiguration;
109
110 /* GA Specific Info */
111 unsigned char frameLengthFlag;
112 unsigned char dependsOnCoreCoder;
113 unsigned short coreCoderDelay;
114 unsigned char extensionFlag;
115 unsigned char aacSectionDataResilienceFlag;
116 unsigned char aacScalefactorDataResilienceFlag;
117 unsigned char aacSpectralDataResilienceFlag;
118 unsigned char epConfig;
119
120 char sbr_present_flag;
121 } mp4AudioSpecificConfig;
122
123 typedef struct faacDecConfiguration
124 {
125 unsigned char defObjectType;
126 unsigned long defSampleRate;
127 unsigned char outputFormat;
128 unsigned char downMatrix;
129 } faacDecConfiguration, *faacDecConfigurationPtr;
130
131 typedef struct faacDecFrameInfo
132 {
133 unsigned long bytesconsumed;
134 unsigned long samples;
135 unsigned char channels;
136 unsigned char error;
137 unsigned long samplerate;
138
139 /* multichannel configuration */
140 unsigned char num_front_channels;
141 unsigned char num_side_channels;
142 unsigned char num_back_channels;
143 unsigned char num_lfe_channels;
144 unsigned char channel_position[64];
145 } faacDecFrameInfo;
146
147 char* FAADAPI faacDecGetErrorMessage(unsigned char errcode);
148
149 unsigned long FAADAPI faacDecGetCapabilities();
150
151 faacDecHandle FAADAPI faacDecOpen();
152
153 faacDecConfigurationPtr FAADAPI faacDecGetCurrentConfiguration(faacDecHandle hDecoder);
154
155 unsigned char FAADAPI faacDecSetConfiguration(faacDecHandle hDecoder,
156 faacDecConfigurationPtr config);
157
158 /* Init the library based on info from the AAC file (ADTS/ADIF) */
159 long FAADAPI faacDecInit(faacDecHandle hDecoder,
160 unsigned char *buffer,
161 unsigned long buffer_size,
162 unsigned long *samplerate,
163 unsigned char *channels);
164
165 /* Init the library using a DecoderSpecificInfo */
166 char FAADAPI faacDecInit2(faacDecHandle hDecoder, unsigned char *pBuffer,
167 unsigned long SizeOfDecoderSpecificInfo,
168 unsigned long *samplerate, unsigned char *channels);
169
170 /* Init the library for DRM */
171 char FAADAPI faacDecInitDRM(faacDecHandle hDecoder, unsigned long samplerate,
172 unsigned char channels);
173
174 void FAADAPI faacDecClose(faacDecHandle hDecoder);
175
176 void* FAADAPI faacDecDecode(faacDecHandle hDecoder,
177 faacDecFrameInfo *hInfo,
178 unsigned char *buffer,
179 unsigned long buffer_size);
180
181 char FAADAPI AudioSpecificConfig(unsigned char *pBuffer,
182 unsigned long buffer_size,
183 mp4AudioSpecificConfig *mp4ASC);
184
185 #ifdef _WIN32
186 #pragma pack(pop)
187 #endif
188
189 #ifdef __cplusplus
190 }
191 #endif /* __cplusplus */
192
193 #endif