BladeMP3EncDLL.h 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. /*
  2. * Blade DLL Interface for LAME.
  3. *
  4. * Copyright (c) 1999 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 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.
  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. * Lesser General Public License for more details.
  16. *
  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.
  21. */
  22. #ifndef ___BLADEDLL_H_INCLUDED___
  23. #define ___BLADEDLL_H_INCLUDED___
  24. #pragma pack(push)
  25. #pragma pack(1)
  26. #ifdef __cplusplus
  27. extern "C" {
  28. #endif
  29. /* encoding formats */
  30. #define BE_CONFIG_MP3 0
  31. #define BE_CONFIG_LAME 256
  32. /* type definitions */
  33. typedef unsigned long HBE_STREAM;
  34. typedef HBE_STREAM *PHBE_STREAM;
  35. typedef unsigned long BE_ERR;
  36. /* error codes */
  37. #define BE_ERR_SUCCESSFUL 0x00000000
  38. #define BE_ERR_INVALID_FORMAT 0x00000001
  39. #define BE_ERR_INVALID_FORMAT_PARAMETERS 0x00000002
  40. #define BE_ERR_NO_MORE_HANDLES 0x00000003
  41. #define BE_ERR_INVALID_HANDLE 0x00000004
  42. #define BE_ERR_BUFFER_TOO_SMALL 0x00000005
  43. /* other constants */
  44. #define BE_MAX_HOMEPAGE 128
  45. /* format specific variables */
  46. #define BE_MP3_MODE_STEREO 0
  47. #define BE_MP3_MODE_JSTEREO 1
  48. #define BE_MP3_MODE_DUALCHANNEL 2
  49. #define BE_MP3_MODE_MONO 3
  50. #define MPEG1 1
  51. #define MPEG2 0
  52. #ifdef _BLADEDLL
  53. #undef FLOAT
  54. #include <Windows.h>
  55. #endif
  56. #define CURRENT_STRUCT_VERSION 1
  57. #define CURRENT_STRUCT_SIZE sizeof(BE_CONFIG) // is currently 331 bytes
  58. /* OBSOLETE, VALUES STILL WORK
  59. typedef enum
  60. {
  61. NORMAL_QUALITY=0,
  62. LOW_QUALITY,
  63. HIGH_QUALITY,
  64. VOICE_QUALITY
  65. } LAME_QUALTIY_PRESET;
  66. */
  67. typedef enum
  68. {
  69. VBR_METHOD_NONE = -1,
  70. VBR_METHOD_DEFAULT = 0,
  71. VBR_METHOD_OLD = 1,
  72. VBR_METHOD_NEW = 2,
  73. VBR_METHOD_MTRH = 3,
  74. VBR_METHOD_ABR = 4
  75. } VBRMETHOD;
  76. typedef enum
  77. {
  78. LQP_NOPRESET=-1,
  79. // QUALITY PRESETS
  80. LQP_NORMAL_QUALITY = 0,
  81. LQP_LOW_QUALITY = 1,
  82. LQP_HIGH_QUALITY = 2,
  83. LQP_VOICE_QUALITY = 3,
  84. LQP_R3MIX = 4,
  85. LQP_VERYHIGH_QUALITY = 5,
  86. LQP_STANDARD = 6,
  87. LQP_FAST_STANDARD = 7,
  88. LQP_EXTREME = 8,
  89. LQP_FAST_EXTREME = 9,
  90. LQP_INSANE = 10,
  91. LQP_ABR = 11,
  92. LQP_CBR = 12,
  93. LQP_MEDIUM = 13,
  94. LQP_FAST_MEDIUM = 14,
  95. // NEW PRESET VALUES
  96. LQP_PHONE =1000,
  97. LQP_SW =2000,
  98. LQP_AM =3000,
  99. LQP_FM =4000,
  100. LQP_VOICE =5000,
  101. LQP_RADIO =6000,
  102. LQP_TAPE =7000,
  103. LQP_HIFI =8000,
  104. LQP_CD =9000,
  105. LQP_STUDIO =10000
  106. } LAME_QUALTIY_PRESET;
  107. typedef struct {
  108. DWORD dwConfig; // BE_CONFIG_XXXXX
  109. // Currently only BE_CONFIG_MP3 is supported
  110. union {
  111. struct {
  112. DWORD dwSampleRate; // 48000, 44100 and 32000 allowed. RG note: also seems to support 16000, 22050, 24000.
  113. BYTE byMode; // BE_MP3_MODE_STEREO, BE_MP3_MODE_DUALCHANNEL, BE_MP3_MODE_MONO
  114. WORD wBitrate; // 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256 and 320 allowed. RG note: also seems to support 8,16,24.
  115. BOOL bPrivate;
  116. BOOL bCRC;
  117. BOOL bCopyright;
  118. BOOL bOriginal;
  119. } mp3; // BE_CONFIG_MP3
  120. struct
  121. {
  122. // STRUCTURE INFORMATION
  123. DWORD dwStructVersion;
  124. DWORD dwStructSize;
  125. // BASIC ENCODER SETTINGS
  126. DWORD dwSampleRate; // SAMPLERATE OF INPUT FILE
  127. DWORD dwReSampleRate; // DOWNSAMPLERATE, 0=ENCODER DECIDES
  128. LONG nMode; // BE_MP3_MODE_STEREO, BE_MP3_MODE_DUALCHANNEL, BE_MP3_MODE_MONO
  129. DWORD dwBitrate; // CBR bitrate, VBR min bitrate
  130. DWORD dwMaxBitrate; // CBR ignored, VBR Max bitrate
  131. LONG nPreset; // Quality preset, use one of the settings of the LAME_QUALITY_PRESET enum
  132. DWORD dwMpegVersion; // FUTURE USE, MPEG-1 OR MPEG-2
  133. DWORD dwPsyModel; // FUTURE USE, SET TO 0
  134. DWORD dwEmphasis; // FUTURE USE, SET TO 0
  135. // BIT STREAM SETTINGS
  136. BOOL bPrivate; // Set Private Bit (TRUE/FALSE)
  137. BOOL bCRC; // Insert CRC (TRUE/FALSE)
  138. BOOL bCopyright; // Set Copyright Bit (TRUE/FALSE)
  139. BOOL bOriginal; // Set Original Bit (TRUE/FALSE)
  140. // VBR STUFF
  141. BOOL bWriteVBRHeader; // WRITE XING VBR HEADER (TRUE/FALSE)
  142. BOOL bEnableVBR; // USE VBR ENCODING (TRUE/FALSE)
  143. INT nVBRQuality; // VBR QUALITY 0..9
  144. DWORD dwVbrAbr_bps; // Use ABR in stead of nVBRQuality
  145. VBRMETHOD nVbrMethod;
  146. BOOL bNoRes; // Disable Bit resorvoir
  147. // MISC SETTINGS
  148. BOOL bStrictIso; // Use strict ISO encoding rules (TRUE/FALSE)
  149. WORD nQuality; // Quality Setting, HIGH BYTE should be NOT LOW byte, otherwhise quality=5
  150. // FUTURE USE, SET TO 0, align strucutre to 331 bytes
  151. BYTE btReserved[255-4*sizeof(DWORD) - sizeof( WORD )];
  152. } LHV1; // LAME header version 1
  153. struct {
  154. DWORD dwSampleRate;
  155. BYTE byMode;
  156. WORD wBitrate;
  157. BYTE byEncodingMethod;
  158. } aac;
  159. } format;
  160. } BE_CONFIG, *PBE_CONFIG;
  161. typedef struct {
  162. // BladeEnc DLL Version number
  163. BYTE byDLLMajorVersion;
  164. BYTE byDLLMinorVersion;
  165. // BladeEnc Engine Version Number
  166. BYTE byMajorVersion;
  167. BYTE byMinorVersion;
  168. // DLL Release date
  169. BYTE byDay;
  170. BYTE byMonth;
  171. WORD wYear;
  172. // BladeEnc Homepage URL
  173. CHAR zHomepage[BE_MAX_HOMEPAGE + 1];
  174. BYTE byAlphaLevel;
  175. BYTE byBetaLevel;
  176. BYTE byMMXEnabled;
  177. BYTE btReserved[125];
  178. } BE_VERSION, *PBE_VERSION;
  179. #ifndef _BLADEDLL
  180. typedef BE_ERR (*BEINITSTREAM) (PBE_CONFIG, PDWORD, PDWORD, PHBE_STREAM);
  181. typedef BE_ERR (*BEENCODECHUNK) (HBE_STREAM, DWORD, PSHORT, PBYTE, PDWORD);
  182. // added for floating point audio -- DSPguru, jd
  183. typedef BE_ERR (*BEENCODECHUNKFLOATS16NI) (HBE_STREAM, DWORD, PFLOAT, PFLOAT, PBYTE, PDWORD);
  184. typedef BE_ERR (*BEDEINITSTREAM) (HBE_STREAM, PBYTE, PDWORD);
  185. typedef BE_ERR (*BECLOSESTREAM) (HBE_STREAM);
  186. typedef VOID (*BEVERSION) (PBE_VERSION);
  187. typedef VOID (*BEWRITEVBRHEADER) (LPCSTR);
  188. #define TEXT_BEINITSTREAM "beInitStream"
  189. #define TEXT_BEENCODECHUNK "beEncodeChunk"
  190. #define TEXT_BEENCODECHUNKFLOATS16NI "beEncodeChunkFloatS16NI"
  191. #define TEXT_BEDEINITSTREAM "beDeinitStream"
  192. #define TEXT_BECLOSESTREAM "beCloseStream"
  193. #define TEXT_BEVERSION "beVersion"
  194. #define TEXT_BEWRITEVBRHEADER "beWriteVBRHeader"
  195. #else
  196. __declspec(dllexport) BE_ERR beInitStream(PBE_CONFIG pbeConfig, PDWORD dwSamples, PDWORD dwBufferSize, PHBE_STREAM phbeStream);
  197. __declspec(dllexport) BE_ERR beEncodeChunk(HBE_STREAM hbeStream, DWORD nSamples, PSHORT pSamples, PBYTE pOutput, PDWORD pdwOutput);
  198. // added for floating point audio -- DSPguru, jd
  199. __declspec(dllexport) BE_ERR beEncodeChunkFloatS16NI(HBE_STREAM hbeStream, DWORD nSamples, PFLOAT buffer_l, PFLOAT buffer_r, PBYTE pOutput, PDWORD pdwOutput);
  200. __declspec(dllexport) BE_ERR beDeinitStream(HBE_STREAM hbeStream, PBYTE pOutput, PDWORD pdwOutput);
  201. __declspec(dllexport) BE_ERR beCloseStream(HBE_STREAM hbeStream);
  202. __declspec(dllexport) VOID beVersion(PBE_VERSION pbeVersion);
  203. __declspec(dllexport) BE_ERR beWriteVBRHeader(LPCSTR lpszFileName);
  204. __declspec(dllexport) BE_ERR beFlushNoGap(HBE_STREAM hbeStream, PBYTE pOutput, PDWORD pdwOutput);
  205. __declspec(dllexport) BE_ERR beWriteInfoTag( HBE_STREAM hbeStream, LPCSTR lpszFileName);
  206. #endif
  207. #pragma pack(pop)
  208. #ifdef __cplusplus
  209. }
  210. #endif
  211. #endif