1159b3361Sopenharmony_ci/* 2159b3361Sopenharmony_ci * Blade Type of DLL Interface for Lame encoder 3159b3361Sopenharmony_ci * 4159b3361Sopenharmony_ci * Copyright (c) 1999-2002 A.L. Faber 5159b3361Sopenharmony_ci * Based on bladedll.h version 1.0 written by Jukka Poikolainen 6159b3361Sopenharmony_ci * 7159b3361Sopenharmony_ci * This library is free software; you can redistribute it and/or 8159b3361Sopenharmony_ci * modify it under the terms of the GNU Library General Public 9159b3361Sopenharmony_ci * License as published by the Free Software Foundation; either 10159b3361Sopenharmony_ci * version 2 of the License, or (at your option) any later version. 11159b3361Sopenharmony_ci * 12159b3361Sopenharmony_ci * This library is distributed in the hope that it will be useful, 13159b3361Sopenharmony_ci * but WITHOUT ANY WARRANTY; without even the implied warranty of 14159b3361Sopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15159b3361Sopenharmony_ci * Library General Public License for more details. 16159b3361Sopenharmony_ci * 17159b3361Sopenharmony_ci * You should have received a copy of the GNU Library General Public 18159b3361Sopenharmony_ci * License along with this library; if not, write to the 19159b3361Sopenharmony_ci * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 20159b3361Sopenharmony_ci * Boston, MA 02111-1307, USA. 21159b3361Sopenharmony_ci */ 22159b3361Sopenharmony_ci 23159b3361Sopenharmony_ci#ifndef ___BLADEDLL_H_INCLUDED___ 24159b3361Sopenharmony_ci#define ___BLADEDLL_H_INCLUDED___ 25159b3361Sopenharmony_ci 26159b3361Sopenharmony_ci#ifdef __GNUC__ 27159b3361Sopenharmony_ci#define ATTRIBUTE_PACKED __attribute__((packed)) 28159b3361Sopenharmony_ci#else 29159b3361Sopenharmony_ci#define ATTRIBUTE_PACKED 30159b3361Sopenharmony_ci#pragma pack(push) 31159b3361Sopenharmony_ci#pragma pack(1) 32159b3361Sopenharmony_ci#endif 33159b3361Sopenharmony_ci 34159b3361Sopenharmony_ci#ifdef __cplusplus 35159b3361Sopenharmony_ciextern "C" { 36159b3361Sopenharmony_ci#endif 37159b3361Sopenharmony_ci 38159b3361Sopenharmony_ci/* encoding formats */ 39159b3361Sopenharmony_ci 40159b3361Sopenharmony_ci#define BE_CONFIG_MP3 0 41159b3361Sopenharmony_ci#define BE_CONFIG_LAME 256 42159b3361Sopenharmony_ci 43159b3361Sopenharmony_ci/* type definitions */ 44159b3361Sopenharmony_ci 45159b3361Sopenharmony_citypedef void* HBE_STREAM; 46159b3361Sopenharmony_citypedef HBE_STREAM *PHBE_STREAM; 47159b3361Sopenharmony_citypedef unsigned long BE_ERR; 48159b3361Sopenharmony_ci 49159b3361Sopenharmony_ci/* error codes */ 50159b3361Sopenharmony_ci 51159b3361Sopenharmony_ci#define BE_ERR_SUCCESSFUL 0x00000000 52159b3361Sopenharmony_ci#define BE_ERR_INVALID_FORMAT 0x00000001 53159b3361Sopenharmony_ci#define BE_ERR_INVALID_FORMAT_PARAMETERS 0x00000002 54159b3361Sopenharmony_ci#define BE_ERR_NO_MORE_HANDLES 0x00000003 55159b3361Sopenharmony_ci#define BE_ERR_INVALID_HANDLE 0x00000004 56159b3361Sopenharmony_ci#define BE_ERR_BUFFER_TOO_SMALL 0x00000005 57159b3361Sopenharmony_ci 58159b3361Sopenharmony_ci/* other constants */ 59159b3361Sopenharmony_ci 60159b3361Sopenharmony_ci#define BE_MAX_HOMEPAGE 128 61159b3361Sopenharmony_ci 62159b3361Sopenharmony_ci/* format specific variables */ 63159b3361Sopenharmony_ci 64159b3361Sopenharmony_ci#define BE_MP3_MODE_STEREO 0 65159b3361Sopenharmony_ci#define BE_MP3_MODE_JSTEREO 1 66159b3361Sopenharmony_ci#define BE_MP3_MODE_DUALCHANNEL 2 67159b3361Sopenharmony_ci#define BE_MP3_MODE_MONO 3 68159b3361Sopenharmony_ci 69159b3361Sopenharmony_ci 70159b3361Sopenharmony_ci 71159b3361Sopenharmony_ci#define MPEG1 1 72159b3361Sopenharmony_ci#define MPEG2 0 73159b3361Sopenharmony_ci 74159b3361Sopenharmony_ci#ifdef _BLADEDLL 75159b3361Sopenharmony_ci#undef FLOAT 76159b3361Sopenharmony_ci #include <Windows.h> 77159b3361Sopenharmony_ci#endif 78159b3361Sopenharmony_ci 79159b3361Sopenharmony_ci#define CURRENT_STRUCT_VERSION 1 80159b3361Sopenharmony_ci#define CURRENT_STRUCT_SIZE sizeof(BE_CONFIG) // is currently 331 bytes 81159b3361Sopenharmony_ci 82159b3361Sopenharmony_ci 83159b3361Sopenharmony_citypedef enum 84159b3361Sopenharmony_ci{ 85159b3361Sopenharmony_ci VBR_METHOD_NONE = -1, 86159b3361Sopenharmony_ci VBR_METHOD_DEFAULT = 0, 87159b3361Sopenharmony_ci VBR_METHOD_OLD = 1, 88159b3361Sopenharmony_ci VBR_METHOD_NEW = 2, 89159b3361Sopenharmony_ci VBR_METHOD_MTRH = 3, 90159b3361Sopenharmony_ci VBR_METHOD_ABR = 4 91159b3361Sopenharmony_ci} VBRMETHOD; 92159b3361Sopenharmony_ci 93159b3361Sopenharmony_citypedef enum 94159b3361Sopenharmony_ci{ 95159b3361Sopenharmony_ci LQP_NOPRESET =-1, 96159b3361Sopenharmony_ci 97159b3361Sopenharmony_ci // QUALITY PRESETS 98159b3361Sopenharmony_ci LQP_NORMAL_QUALITY = 0, 99159b3361Sopenharmony_ci LQP_LOW_QUALITY = 1, 100159b3361Sopenharmony_ci LQP_HIGH_QUALITY = 2, 101159b3361Sopenharmony_ci LQP_VOICE_QUALITY = 3, 102159b3361Sopenharmony_ci LQP_R3MIX = 4, 103159b3361Sopenharmony_ci LQP_VERYHIGH_QUALITY = 5, 104159b3361Sopenharmony_ci LQP_STANDARD = 6, 105159b3361Sopenharmony_ci LQP_FAST_STANDARD = 7, 106159b3361Sopenharmony_ci LQP_EXTREME = 8, 107159b3361Sopenharmony_ci LQP_FAST_EXTREME = 9, 108159b3361Sopenharmony_ci LQP_INSANE = 10, 109159b3361Sopenharmony_ci LQP_ABR = 11, 110159b3361Sopenharmony_ci LQP_CBR = 12, 111159b3361Sopenharmony_ci LQP_MEDIUM = 13, 112159b3361Sopenharmony_ci LQP_FAST_MEDIUM = 14, 113159b3361Sopenharmony_ci 114159b3361Sopenharmony_ci // NEW PRESET VALUES 115159b3361Sopenharmony_ci LQP_PHONE =1000, 116159b3361Sopenharmony_ci LQP_SW =2000, 117159b3361Sopenharmony_ci LQP_AM =3000, 118159b3361Sopenharmony_ci LQP_FM =4000, 119159b3361Sopenharmony_ci LQP_VOICE =5000, 120159b3361Sopenharmony_ci LQP_RADIO =6000, 121159b3361Sopenharmony_ci LQP_TAPE =7000, 122159b3361Sopenharmony_ci LQP_HIFI =8000, 123159b3361Sopenharmony_ci LQP_CD =9000, 124159b3361Sopenharmony_ci LQP_STUDIO =10000 125159b3361Sopenharmony_ci 126159b3361Sopenharmony_ci} LAME_QUALITY_PRESET; 127159b3361Sopenharmony_ci 128159b3361Sopenharmony_ci 129159b3361Sopenharmony_ci 130159b3361Sopenharmony_citypedef struct { 131159b3361Sopenharmony_ci DWORD dwConfig; // BE_CONFIG_XXXXX 132159b3361Sopenharmony_ci // Currently only BE_CONFIG_MP3 is supported 133159b3361Sopenharmony_ci union { 134159b3361Sopenharmony_ci 135159b3361Sopenharmony_ci struct { 136159b3361Sopenharmony_ci 137159b3361Sopenharmony_ci DWORD dwSampleRate; // 48000, 44100 and 32000 allowed 138159b3361Sopenharmony_ci BYTE byMode; // BE_MP3_MODE_STEREO, BE_MP3_MODE_DUALCHANNEL, BE_MP3_MODE_MONO 139159b3361Sopenharmony_ci WORD wBitrate; // 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256 and 320 allowed 140159b3361Sopenharmony_ci BOOL bPrivate; 141159b3361Sopenharmony_ci BOOL bCRC; 142159b3361Sopenharmony_ci BOOL bCopyright; 143159b3361Sopenharmony_ci BOOL bOriginal; 144159b3361Sopenharmony_ci 145159b3361Sopenharmony_ci } mp3; // BE_CONFIG_MP3 146159b3361Sopenharmony_ci 147159b3361Sopenharmony_ci struct 148159b3361Sopenharmony_ci { 149159b3361Sopenharmony_ci // STRUCTURE INFORMATION 150159b3361Sopenharmony_ci DWORD dwStructVersion; 151159b3361Sopenharmony_ci DWORD dwStructSize; 152159b3361Sopenharmony_ci 153159b3361Sopenharmony_ci // BASIC ENCODER SETTINGS 154159b3361Sopenharmony_ci DWORD dwSampleRate; // SAMPLERATE OF INPUT FILE 155159b3361Sopenharmony_ci DWORD dwReSampleRate; // DOWNSAMPLERATE, 0=ENCODER DECIDES 156159b3361Sopenharmony_ci LONG nMode; // BE_MP3_MODE_STEREO, BE_MP3_MODE_DUALCHANNEL, BE_MP3_MODE_MONO 157159b3361Sopenharmony_ci DWORD dwBitrate; // CBR bitrate, VBR min bitrate 158159b3361Sopenharmony_ci DWORD dwMaxBitrate; // CBR ignored, VBR Max bitrate 159159b3361Sopenharmony_ci LONG nPreset; // Quality preset, use one of the settings of the LAME_QUALITY_PRESET enum 160159b3361Sopenharmony_ci DWORD dwMpegVersion; // FUTURE USE, MPEG-1 OR MPEG-2 161159b3361Sopenharmony_ci DWORD dwPsyModel; // FUTURE USE, SET TO 0 162159b3361Sopenharmony_ci DWORD dwEmphasis; // FUTURE USE, SET TO 0 163159b3361Sopenharmony_ci 164159b3361Sopenharmony_ci // BIT STREAM SETTINGS 165159b3361Sopenharmony_ci BOOL bPrivate; // Set Private Bit (TRUE/FALSE) 166159b3361Sopenharmony_ci BOOL bCRC; // Insert CRC (TRUE/FALSE) 167159b3361Sopenharmony_ci BOOL bCopyright; // Set Copyright Bit (TRUE/FALSE) 168159b3361Sopenharmony_ci BOOL bOriginal; // Set Original Bit (TRUE/FALSE) 169159b3361Sopenharmony_ci 170159b3361Sopenharmony_ci // VBR STUFF 171159b3361Sopenharmony_ci BOOL bWriteVBRHeader; // WRITE XING VBR HEADER (TRUE/FALSE) 172159b3361Sopenharmony_ci BOOL bEnableVBR; // USE VBR ENCODING (TRUE/FALSE) 173159b3361Sopenharmony_ci INT nVBRQuality; // VBR QUALITY 0..9 174159b3361Sopenharmony_ci DWORD dwVbrAbr_bps; // Use ABR in stead of nVBRQuality 175159b3361Sopenharmony_ci VBRMETHOD nVbrMethod; 176159b3361Sopenharmony_ci BOOL bNoRes; // Disable Bit resorvoir (TRUE/FALSE) 177159b3361Sopenharmony_ci 178159b3361Sopenharmony_ci // MISC SETTINGS 179159b3361Sopenharmony_ci BOOL bStrictIso; // Use strict ISO encoding rules (TRUE/FALSE) 180159b3361Sopenharmony_ci WORD nQuality; // Quality Setting, HIGH BYTE should be NOT LOW byte, otherwhise quality=5 181159b3361Sopenharmony_ci 182159b3361Sopenharmony_ci // FUTURE USE, SET TO 0, align strucutre to 331 bytes 183159b3361Sopenharmony_ci BYTE btReserved[255-4*sizeof(DWORD) - sizeof( WORD )]; 184159b3361Sopenharmony_ci 185159b3361Sopenharmony_ci } LHV1; // LAME header version 1 186159b3361Sopenharmony_ci 187159b3361Sopenharmony_ci struct { 188159b3361Sopenharmony_ci 189159b3361Sopenharmony_ci DWORD dwSampleRate; 190159b3361Sopenharmony_ci BYTE byMode; 191159b3361Sopenharmony_ci WORD wBitrate; 192159b3361Sopenharmony_ci BYTE byEncodingMethod; 193159b3361Sopenharmony_ci 194159b3361Sopenharmony_ci } aac; 195159b3361Sopenharmony_ci 196159b3361Sopenharmony_ci } format; 197159b3361Sopenharmony_ci 198159b3361Sopenharmony_ci} BE_CONFIG, *PBE_CONFIG ATTRIBUTE_PACKED; 199159b3361Sopenharmony_ci 200159b3361Sopenharmony_ci 201159b3361Sopenharmony_citypedef struct { 202159b3361Sopenharmony_ci 203159b3361Sopenharmony_ci // BladeEnc DLL Version number 204159b3361Sopenharmony_ci 205159b3361Sopenharmony_ci BYTE byDLLMajorVersion; 206159b3361Sopenharmony_ci BYTE byDLLMinorVersion; 207159b3361Sopenharmony_ci 208159b3361Sopenharmony_ci // BladeEnc Engine Version Number 209159b3361Sopenharmony_ci 210159b3361Sopenharmony_ci BYTE byMajorVersion; 211159b3361Sopenharmony_ci BYTE byMinorVersion; 212159b3361Sopenharmony_ci 213159b3361Sopenharmony_ci // DLL Release date 214159b3361Sopenharmony_ci 215159b3361Sopenharmony_ci BYTE byDay; 216159b3361Sopenharmony_ci BYTE byMonth; 217159b3361Sopenharmony_ci WORD wYear; 218159b3361Sopenharmony_ci 219159b3361Sopenharmony_ci // BladeEnc Homepage URL 220159b3361Sopenharmony_ci 221159b3361Sopenharmony_ci CHAR zHomepage[BE_MAX_HOMEPAGE + 1]; 222159b3361Sopenharmony_ci 223159b3361Sopenharmony_ci BYTE byAlphaLevel; 224159b3361Sopenharmony_ci BYTE byBetaLevel; 225159b3361Sopenharmony_ci BYTE byMMXEnabled; 226159b3361Sopenharmony_ci 227159b3361Sopenharmony_ci BYTE btReserved[125]; 228159b3361Sopenharmony_ci 229159b3361Sopenharmony_ci 230159b3361Sopenharmony_ci} BE_VERSION, *PBE_VERSION ATTRIBUTE_PACKED; 231159b3361Sopenharmony_ci 232159b3361Sopenharmony_ci#ifndef _BLADEDLL 233159b3361Sopenharmony_ci 234159b3361Sopenharmony_citypedef BE_ERR (*BEINITSTREAM) (PBE_CONFIG, PDWORD, PDWORD, PHBE_STREAM); 235159b3361Sopenharmony_citypedef BE_ERR (*BEENCODECHUNK) (HBE_STREAM, DWORD, PSHORT, PBYTE, PDWORD); 236159b3361Sopenharmony_ci 237159b3361Sopenharmony_ci// added for floating point audio -- DSPguru, jd 238159b3361Sopenharmony_citypedef BE_ERR (*BEENCODECHUNKFLOATS16NI) (HBE_STREAM, DWORD, PFLOAT, PFLOAT, PBYTE, PDWORD); 239159b3361Sopenharmony_citypedef BE_ERR (*BEDEINITSTREAM) (HBE_STREAM, PBYTE, PDWORD); 240159b3361Sopenharmony_citypedef BE_ERR (*BECLOSESTREAM) (HBE_STREAM); 241159b3361Sopenharmony_citypedef VOID (*BEVERSION) (PBE_VERSION); 242159b3361Sopenharmony_citypedef BE_ERR (*BEWRITEVBRHEADER) (LPCSTR); 243159b3361Sopenharmony_citypedef BE_ERR (*BEWRITEINFOTAG) (HBE_STREAM, LPCSTR ); 244159b3361Sopenharmony_ci 245159b3361Sopenharmony_ci#define TEXT_BEINITSTREAM "beInitStream" 246159b3361Sopenharmony_ci#define TEXT_BEENCODECHUNK "beEncodeChunk" 247159b3361Sopenharmony_ci#define TEXT_BEENCODECHUNKFLOATS16NI "beEncodeChunkFloatS16NI" 248159b3361Sopenharmony_ci#define TEXT_BEDEINITSTREAM "beDeinitStream" 249159b3361Sopenharmony_ci#define TEXT_BECLOSESTREAM "beCloseStream" 250159b3361Sopenharmony_ci#define TEXT_BEVERSION "beVersion" 251159b3361Sopenharmony_ci#define TEXT_BEWRITEVBRHEADER "beWriteVBRHeader" 252159b3361Sopenharmony_ci#define TEXT_BEFLUSHNOGAP "beFlushNoGap" 253159b3361Sopenharmony_ci#define TEXT_BEWRITEINFOTAG "beWriteInfoTag" 254159b3361Sopenharmony_ci 255159b3361Sopenharmony_ci 256159b3361Sopenharmony_ci#else 257159b3361Sopenharmony_ci 258159b3361Sopenharmony_ci__declspec(dllexport) BE_ERR beInitStream(PBE_CONFIG pbeConfig, PDWORD dwSamples, PDWORD dwBufferSize, PHBE_STREAM phbeStream); 259159b3361Sopenharmony_ci__declspec(dllexport) BE_ERR beEncodeChunk(HBE_STREAM hbeStream, DWORD nSamples, PSHORT pSamples, PBYTE pOutput, PDWORD pdwOutput); 260159b3361Sopenharmony_ci 261159b3361Sopenharmony_ci// added for floating point audio -- DSPguru, jd 262159b3361Sopenharmony_ci__declspec(dllexport) BE_ERR beEncodeChunkFloatS16NI(HBE_STREAM hbeStream, DWORD nSamples, PFLOAT buffer_l, PFLOAT buffer_r, PBYTE pOutput, PDWORD pdwOutput); 263159b3361Sopenharmony_ci__declspec(dllexport) BE_ERR beDeinitStream(HBE_STREAM hbeStream, PBYTE pOutput, PDWORD pdwOutput); 264159b3361Sopenharmony_ci__declspec(dllexport) BE_ERR beCloseStream(HBE_STREAM hbeStream); 265159b3361Sopenharmony_ci__declspec(dllexport) VOID beVersion(PBE_VERSION pbeVersion); 266159b3361Sopenharmony_ci__declspec(dllexport) BE_ERR beWriteVBRHeader(LPCSTR lpszFileName); 267159b3361Sopenharmony_ci__declspec(dllexport) BE_ERR beFlushNoGap(HBE_STREAM hbeStream, PBYTE pOutput, PDWORD pdwOutput); 268159b3361Sopenharmony_ci__declspec(dllexport) BE_ERR beWriteInfoTag( HBE_STREAM hbeStream, LPCSTR lpszFileName ); 269159b3361Sopenharmony_ci 270159b3361Sopenharmony_ci#endif 271159b3361Sopenharmony_ci 272159b3361Sopenharmony_ci#ifdef __cplusplus 273159b3361Sopenharmony_ci} 274159b3361Sopenharmony_ci#endif 275159b3361Sopenharmony_ci 276159b3361Sopenharmony_ci#ifndef __GNUC__ 277159b3361Sopenharmony_ci#pragma pack(pop) 278159b3361Sopenharmony_ci#endif 279159b3361Sopenharmony_ci 280159b3361Sopenharmony_ci#endif 281