2
* Blade Type of DLL Interface for Lame encoder
4
* Copyright (c) 1999-2002 A.L. Faber
5
* Based on bladedll.h version 1.0 written by Jukka Poikolainen
7
* This library is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU Lesser 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.
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
* Lesser General Public License for more details.
17
* You should have received a copy of the GNU Lesser 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.
25
#ifndef ___BLADEDLL_H_INCLUDED___
26
#define ___BLADEDLL_H_INCLUDED___
29
//#define ATTRIBUTE_PACKED __attribute__((packed))
30
#define ATTRIBUTE_PACKED
32
#define ATTRIBUTE_PACKED
41
/* encoding formats */
43
#define BE_CONFIG_MP3 0
44
#define BE_CONFIG_LAME 256
46
/* type definitions */
48
typedef unsigned long HBE_STREAM;
49
typedef HBE_STREAM *PHBE_STREAM;
50
typedef unsigned long BE_ERR;
54
#define BE_ERR_SUCCESSFUL 0x00000000
55
#define BE_ERR_INVALID_FORMAT 0x00000001
56
#define BE_ERR_INVALID_FORMAT_PARAMETERS 0x00000002
57
#define BE_ERR_NO_MORE_HANDLES 0x00000003
58
#define BE_ERR_INVALID_HANDLE 0x00000004
59
#define BE_ERR_BUFFER_TOO_SMALL 0x00000005
63
#define BE_MAX_HOMEPAGE 128
65
/* format specific variables */
67
#define BE_MP3_MODE_STEREO 0
68
#define BE_MP3_MODE_JSTEREO 1
69
#define BE_MP3_MODE_DUALCHANNEL 2
70
#define BE_MP3_MODE_MONO 3
82
#define CURRENT_STRUCT_VERSION 1
83
#define CURRENT_STRUCT_SIZE sizeof(BE_CONFIG) // is currently 331 bytes
89
VBR_METHOD_DEFAULT = 0,
101
LQP_NORMAL_QUALITY = 0,
103
LQP_HIGH_QUALITY = 2,
104
LQP_VOICE_QUALITY = 3,
106
LQP_VERYHIGH_QUALITY = 5,
108
LQP_FAST_STANDARD = 7,
110
LQP_FAST_EXTREME = 9,
115
LQP_FAST_MEDIUM = 14,
129
} LAME_QUALITY_PRESET;
134
unsigned long dwConfig; // BE_CONFIG_XXXXX
135
// Currently only BE_CONFIG_MP3 is supported
140
unsigned long dwSampleRate; // 48000, 44100 and 32000 allowed
141
unsigned char byMode; // BE_MP3_MODE_STEREO, BE_MP3_MODE_DUALCHANNEL, BE_MP3_MODE_MONO
142
unsigned short wBitrate; // 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256 and 320 allowed
148
} mp3; // BE_CONFIG_MP3
152
// STRUCTURE INFORMATION
153
unsigned long dwStructVersion;
154
unsigned long dwStructSize;
156
// BASIC ENCODER SETTINGS
157
unsigned long dwSampleRate; // SAMPLERATE OF INPUT FILE
158
unsigned long dwReSampleRate; // DOWNSAMPLERATE, 0=ENCODER DECIDES
159
long nMode; // BE_MP3_MODE_STEREO, BE_MP3_MODE_DUALCHANNEL, BE_MP3_MODE_MONO
160
unsigned long dwBitrate; // CBR bitrate, VBR min bitrate
161
unsigned long dwMaxBitrate; // CBR ignored, VBR Max bitrate
162
long nPreset; // Quality preset, use one of the settings of the LAME_QUALITY_PRESET enum
163
unsigned long dwMpegVersion; // FUTURE USE, MPEG-1 OR MPEG-2
164
unsigned long dwPsyModel; // FUTURE USE, SET TO 0
165
unsigned long dwEmphasis; // FUTURE USE, SET TO 0
167
// BIT STREAM SETTINGS
168
int bPrivate; // Set Private Bit (TRUE/FALSE)
169
int bCRC; // Insert CRC (TRUE/FALSE)
170
int bCopyright; // Set Copyright Bit (TRUE/FALSE)
171
int bOriginal; // Set Original Bit (TRUE/FALSE)
174
int bWriteVBRHeader; // WRITE XING VBR HEADER (TRUE/FALSE)
175
int bEnableVBR; // USE VBR ENCODING (TRUE/FALSE)
176
int nVBRQuality; // VBR QUALITY 0..9
177
unsigned long dwVbrAbr_bps; // Use ABR in stead of nVBRQuality
178
VBRMETHOD nVbrMethod;
179
int bNoRes; // Disable Bit resorvoir (TRUE/FALSE)
182
int bStrictIso; // Use strict ISO encoding rules (TRUE/FALSE)
183
unsigned short nQuality; // Quality Setting, HIGH unsigned char should be NOT LOW byte, otherwhise quality=5
185
// FUTURE USE, SET TO 0, align strucutre to 331 bytes
186
unsigned char btReserved[255-4*sizeof(unsigned long) - sizeof( unsigned short )];
188
} LHV1; // LAME header version 1
192
unsigned long dwSampleRate;
193
unsigned char byMode;
194
unsigned short wBitrate;
195
unsigned char byEncodingMethod;
201
} BE_CONFIG, *PBE_CONFIG ATTRIBUTE_PACKED;
206
// BladeEnc DLL Version number
208
unsigned char byDLLMajorVersion;
209
unsigned char byDLLMinorVersion;
211
// BladeEnc Engine Version Number
213
unsigned char byMajorVersion;
214
unsigned char byMinorVersion;
219
unsigned char byMonth;
220
unsigned short wYear;
222
// BladeEnc Homepage URL
224
char zHomepage[BE_MAX_HOMEPAGE + 1];
226
unsigned char byAlphaLevel;
227
unsigned char byBetaLevel;
228
unsigned char byMMXEnabled;
230
unsigned char btReserved[125];
233
} BE_VERSION, *PBE_VERSION ATTRIBUTE_PACKED;
237
typedef unsigned long (*BEINITSTREAM) (PBE_CONFIG, unsigned long *, unsigned long *, PHBE_STREAM);
238
typedef unsigned long (*BEENCODECHUNK) (HBE_STREAM, unsigned long, short *, unsigned char *, unsigned long *);
240
// added for floating point audio -- DSPguru, jd
241
typedef unsigned long (*BEENCODECHUNKFLOATS16NI) (HBE_STREAM, unsigned long, float *, float *, unsigned char *, unsigned long *);
242
typedef unsigned long (*BEDEINITSTREAM) (HBE_STREAM, unsigned char *, unsigned long *);
243
typedef unsigned long (*BECLOSESTREAM) (HBE_STREAM);
244
typedef void (*BEVERSION) (PBE_VERSION);
245
typedef unsigned long (*BEWRITEVBRHEADER) (const char*);
246
typedef unsigned long (*BEWRITEINFOTAG) (HBE_STREAM, const char * );
248
#define TEXT_BEINITSTREAM "beInitStream"
249
#define TEXT_BEENCODECHUNK "beEncodeChunk"
250
#define TEXT_BEENCODECHUNKFLOATS16NI "beEncodeChunkFloatS16NI"
251
#define TEXT_BEDEINITSTREAM "beDeinitStream"
252
#define TEXT_BECLOSESTREAM "beCloseStream"
253
#define TEXT_BEVERSION "beVersion"
254
#define TEXT_BEWRITEVBRHEADER "beWriteVBRHeader"
255
#define TEXT_BEFLUSHNOGAP "beFlushNoGap"
256
#define TEXT_BEWRITEINFOTAG "beWriteInfoTag"
261
__declspec(dllexport) unsigned long beInitStream(PBE_CONFIG pbeConfig, Punsigned long dwSamples, Punsigned long dwBufferSize, PHBE_STREAM phbeStream);
262
__declspec(dllexport) unsigned long beEncodeChunk(HBE_STREAM hbeStream, unsigned long nSamples, PSHORT pSamples, Punsigned char pOutput, Punsigned long pdwOutput);
264
// added for floating point audio -- DSPguru, jd
265
__declspec(dllexport) unsigned long beEncodeChunkFloatS16NI(HBE_STREAM hbeStream, unsigned long nSamples, PFLOAT buffer_l, PFLOAT buffer_r, Punsigned char pOutput, Punsigned long pdwOutput);
266
__declspec(dllexport) unsigned long beDeinitStream(HBE_STREAM hbeStream, Punsigned char pOutput, Punsigned long pdwOutput);
267
__declspec(dllexport) unsigned long beCloseStream(HBE_STREAM hbeStream);
268
__declspec(dllexport) VOID beVersion(PBE_VERSION pbeVersion);
269
__declspec(dllexport) unsigned long beWriteVBRHeader(LPCSTR lpszFileName);
270
__declspec(dllexport) unsigned long beFlushNoGap(HBE_STREAM hbeStream, Punsigned char pOutput, Punsigned long pdwOutput);
271
__declspec(dllexport) unsigned long beWriteInfoTag( HBE_STREAM hbeStream, LPCSTR lpszFileName );