Debian Codegraph @

Dll/BladeMP3EncDLL.h

raw
1 /*
2 * Blade Type of DLL Interface for Lame encoder
3 *
4 * Copyright (c) 1999-2002 A.L. Faber
5 * Based on bladedll.h version 1.0 written by Jukka Poikolainen
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
16 *
17 * You should have received a copy of the GNU Library General Public
18 * License along with this library; if not, write to the
19 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
21 */
22
23 #ifndef ___BLADEDLL_H_INCLUDED___
24 #define ___BLADEDLL_H_INCLUDED___
25
26 #ifdef __GNUC__
27 #define ATTRIBUTE_PACKED __attribute__((packed))
28 #else
29 #define ATTRIBUTE_PACKED
30 #pragma pack(push)
31 #pragma pack(1)
32 #endif
33
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37
38 /* encoding formats */
39
40 #define BE_CONFIG_MP3 0
41 #define BE_CONFIG_LAME 256
42
43 /* type definitions */
44
45 typedef void* HBE_STREAM;
46 typedef HBE_STREAM *PHBE_STREAM;
47 typedef unsigned long BE_ERR;
48
49 /* error codes */
50
51 #define BE_ERR_SUCCESSFUL 0x00000000
52 #define BE_ERR_INVALID_FORMAT 0x00000001
53 #define BE_ERR_INVALID_FORMAT_PARAMETERS 0x00000002
54 #define BE_ERR_NO_MORE_HANDLES 0x00000003
55 #define BE_ERR_INVALID_HANDLE 0x00000004
56 #define BE_ERR_BUFFER_TOO_SMALL 0x00000005
57
58 /* other constants */
59
60 #define BE_MAX_HOMEPAGE 128
61
62 /* format specific variables */
63
64 #define BE_MP3_MODE_STEREO 0
65 #define BE_MP3_MODE_JSTEREO 1
66 #define BE_MP3_MODE_DUALCHANNEL 2
67 #define BE_MP3_MODE_MONO 3
68
69
70
71 #define MPEG1 1
72 #define MPEG2 0
73
74 #ifdef _BLADEDLL
75 #undef FLOAT
76 #include <Windows.h>
77 #endif
78
79 #define CURRENT_STRUCT_VERSION 1
80 #define CURRENT_STRUCT_SIZE sizeof(BE_CONFIG) // is currently 331 bytes
81
82
83 typedef enum
84 {
85 VBR_METHOD_NONE = -1,
86 VBR_METHOD_DEFAULT = 0,
87 VBR_METHOD_OLD = 1,
88 VBR_METHOD_NEW = 2,
89 VBR_METHOD_MTRH = 3,
90 VBR_METHOD_ABR = 4
91 } VBRMETHOD;
92
93 typedef enum
94 {
95 LQP_NOPRESET =-1,
96
97 // QUALITY PRESETS
98 LQP_NORMAL_QUALITY = 0,
99 LQP_LOW_QUALITY = 1,
100 LQP_HIGH_QUALITY = 2,
101 LQP_VOICE_QUALITY = 3,
102 LQP_R3MIX = 4,
103 LQP_VERYHIGH_QUALITY = 5,
104 LQP_STANDARD = 6,
105 LQP_FAST_STANDARD = 7,
106 LQP_EXTREME = 8,
107 LQP_FAST_EXTREME = 9,
108 LQP_INSANE = 10,
109 LQP_ABR = 11,
110 LQP_CBR = 12,
111 LQP_MEDIUM = 13,
112 LQP_FAST_MEDIUM = 14,
113
114 // NEW PRESET VALUES
115 LQP_PHONE =1000,
116 LQP_SW =2000,
117 LQP_AM =3000,
118 LQP_FM =4000,
119 LQP_VOICE =5000,
120 LQP_RADIO =6000,
121 LQP_TAPE =7000,
122 LQP_HIFI =8000,
123 LQP_CD =9000,
124 LQP_STUDIO =10000
125
126 } LAME_QUALITY_PRESET;
127
128
129
130 typedef struct {
131 DWORD dwConfig; // BE_CONFIG_XXXXX
132 // Currently only BE_CONFIG_MP3 is supported
133 union {
134
135 struct {
136
137 DWORD dwSampleRate; // 48000, 44100 and 32000 allowed
138 BYTE byMode; // BE_MP3_MODE_STEREO, BE_MP3_MODE_DUALCHANNEL, BE_MP3_MODE_MONO
139 WORD wBitrate; // 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256 and 320 allowed
140 BOOL bPrivate;
141 BOOL bCRC;
142 BOOL bCopyright;
143 BOOL bOriginal;
144
145 } mp3; // BE_CONFIG_MP3
146
147 struct
148 {
149 // STRUCTURE INFORMATION
150 DWORD dwStructVersion;
151 DWORD dwStructSize;
152
153 // BASIC ENCODER SETTINGS
154 DWORD dwSampleRate; // SAMPLERATE OF INPUT FILE
155 DWORD dwReSampleRate; // DOWNSAMPLERATE, 0=ENCODER DECIDES
156 LONG nMode; // BE_MP3_MODE_STEREO, BE_MP3_MODE_DUALCHANNEL, BE_MP3_MODE_MONO
157 DWORD dwBitrate; // CBR bitrate, VBR min bitrate
158 DWORD dwMaxBitrate; // CBR ignored, VBR Max bitrate
159 LONG nPreset; // Quality preset, use one of the settings of the LAME_QUALITY_PRESET enum
160 DWORD dwMpegVersion; // FUTURE USE, MPEG-1 OR MPEG-2
161 DWORD dwPsyModel; // FUTURE USE, SET TO 0
162 DWORD dwEmphasis; // FUTURE USE, SET TO 0
163
164 // BIT STREAM SETTINGS
165 BOOL bPrivate; // Set Private Bit (TRUE/FALSE)
166 BOOL bCRC; // Insert CRC (TRUE/FALSE)
167 BOOL bCopyright; // Set Copyright Bit (TRUE/FALSE)
168 BOOL bOriginal; // Set Original Bit (TRUE/FALSE)
169
170 // VBR STUFF
171 BOOL bWriteVBRHeader; // WRITE XING VBR HEADER (TRUE/FALSE)
172 BOOL bEnableVBR; // USE VBR ENCODING (TRUE/FALSE)
173 INT nVBRQuality; // VBR QUALITY 0..9
174 DWORD dwVbrAbr_bps; // Use ABR in stead of nVBRQuality
175 VBRMETHOD nVbrMethod;
176 BOOL bNoRes; // Disable Bit resorvoir (TRUE/FALSE)
177
178 // MISC SETTINGS
179 BOOL bStrictIso; // Use strict ISO encoding rules (TRUE/FALSE)
180 WORD nQuality; // Quality Setting, HIGH BYTE should be NOT LOW byte, otherwhise quality=5
181
182 // FUTURE USE, SET TO 0, align strucutre to 331 bytes
183 BYTE btReserved[255-4*sizeof(DWORD) - sizeof( WORD )];
184
185 } LHV1; // LAME header version 1
186
187 struct {
188
189 DWORD dwSampleRate;
190 BYTE byMode;
191 WORD wBitrate;
192 BYTE byEncodingMethod;
193
194 } aac;
195
196 } format;
197
198 } BE_CONFIG, *PBE_CONFIG ATTRIBUTE_PACKED;
199
200
201 typedef struct {
202
203 // BladeEnc DLL Version number
204
205 BYTE byDLLMajorVersion;
206 BYTE byDLLMinorVersion;
207
208 // BladeEnc Engine Version Number
209
210 BYTE byMajorVersion;
211 BYTE byMinorVersion;
212
213 // DLL Release date
214
215 BYTE byDay;
216 BYTE byMonth;
217 WORD wYear;
218
219 // BladeEnc Homepage URL
220
221 CHAR zHomepage[BE_MAX_HOMEPAGE + 1];
222
223 BYTE byAlphaLevel;
224 BYTE byBetaLevel;
225 BYTE byMMXEnabled;
226
227 BYTE btReserved[125];
228
229
230 } BE_VERSION, *PBE_VERSION ATTRIBUTE_PACKED;
231
232 #ifndef _BLADEDLL
233
234 typedef BE_ERR (*BEINITSTREAM) (PBE_CONFIG, PDWORD, PDWORD, PHBE_STREAM);
235 typedef BE_ERR (*BEENCODECHUNK) (HBE_STREAM, DWORD, PSHORT, PBYTE, PDWORD);
236
237 // added for floating point audio -- DSPguru, jd
238 typedef BE_ERR (*BEENCODECHUNKFLOATS16NI) (HBE_STREAM, DWORD, PFLOAT, PFLOAT, PBYTE, PDWORD);
239 typedef BE_ERR (*BEDEINITSTREAM) (HBE_STREAM, PBYTE, PDWORD);
240 typedef BE_ERR (*BECLOSESTREAM) (HBE_STREAM);
241 typedef VOID (*BEVERSION) (PBE_VERSION);
242 typedef BE_ERR (*BEWRITEVBRHEADER) (LPCSTR);
243 typedef BE_ERR (*BEWRITEINFOTAG) (HBE_STREAM, LPCSTR );
244
245 #define TEXT_BEINITSTREAM "beInitStream"
246 #define TEXT_BEENCODECHUNK "beEncodeChunk"
247 #define TEXT_BEENCODECHUNKFLOATS16NI "beEncodeChunkFloatS16NI"
248 #define TEXT_BEDEINITSTREAM "beDeinitStream"
249 #define TEXT_BECLOSESTREAM "beCloseStream"
250 #define TEXT_BEVERSION "beVersion"
251 #define TEXT_BEWRITEVBRHEADER "beWriteVBRHeader"
252 #define TEXT_BEFLUSHNOGAP "beFlushNoGap"
253 #define TEXT_BEWRITEINFOTAG "beWriteInfoTag"
254
255
256 #else
257
258 __declspec(dllexport) BE_ERR beInitStream(PBE_CONFIG pbeConfig, PDWORD dwSamples, PDWORD dwBufferSize, PHBE_STREAM phbeStream);
259 __declspec(dllexport) BE_ERR beEncodeChunk(HBE_STREAM hbeStream, DWORD nSamples, PSHORT pSamples, PBYTE pOutput, PDWORD pdwOutput);
260
261 // added for floating point audio -- DSPguru, jd
262 __declspec(dllexport) BE_ERR beEncodeChunkFloatS16NI(HBE_STREAM hbeStream, DWORD nSamples, PFLOAT buffer_l, PFLOAT buffer_r, PBYTE pOutput, PDWORD pdwOutput);
263 __declspec(dllexport) BE_ERR beDeinitStream(HBE_STREAM hbeStream, PBYTE pOutput, PDWORD pdwOutput);
264 __declspec(dllexport) BE_ERR beCloseStream(HBE_STREAM hbeStream);
265 __declspec(dllexport) VOID beVersion(PBE_VERSION pbeVersion);
266 __declspec(dllexport) BE_ERR beWriteVBRHeader(LPCSTR lpszFileName);
267 __declspec(dllexport) BE_ERR beFlushNoGap(HBE_STREAM hbeStream, PBYTE pOutput, PDWORD pdwOutput);
268 __declspec(dllexport) BE_ERR beWriteInfoTag( HBE_STREAM hbeStream, LPCSTR lpszFileName );
269
270 #endif
271
272 #ifdef __cplusplus
273 }
274 #endif
275
276 #ifndef __GNUC__
277 #pragma pack(pop)
278 #endif
279
280 #endif