📄 lamedllinterface.htm
字号:
<html><head><meta http-equiv="Content-Type"content="text/html; charset=iso-8859-1"><meta name="GENERATOR" content="Microsoft FrontPage Express 2.0"><title>Lame-</title></head><body bgcolor="#FFFFFF"><p align="center"> </p><p align="center"><font size="7">Lame-enc DLL</font> <br><font size="5">Interface version 1.32</font> (and above)<br>(Lame engine version: 3.93 or higher) <br><font size="6">Programmers Manual</font></p><p align="center"><i>The lame_enc.dll and this manual iscopyright by Albert L Faber<br>Originally the the DLL interface is modeled after the BladeEncDLL interface<br>which is copyrighted by Tord Jansson and Jukka Poikolainen<br>This document and the DLL interface may be distributed freely</i><br><i>as long as modifications are released under the LGPL license.</i></p><p align="center"> </p><p align="center"><b>Homepage</b>: <ahref="http://www.cdex.n3.net">http://www.cdex.n3.net</a><br><b>E-mail:</b> mailto: <ahref="mailto:afaber@users.sourceforge.net">afaber@users.sourceforge.net</a></p><p><br><br><br><br></p><p><font size="5">Distribution</font> </p><p>People and companies who wants to distributelame_enc.dll with their commercial products are free to do so asfar as I'm concerned (LGPL license), but should be aware thatlame_enc.dll might infringe certain MP3 related software patentsheld by Fraunhofer IIS in certain countries. </p><p><br> </p><p><font size="5">Disclaimer</font> </p><p>lame_enc.dll and this manual is distributed 'as is' with nowarranty of any kind. The Author is not to be held responsiblefor the result of any use or misuse of this product. <br> <br> </p><p><font size="5">Current Bugs and Limitations</font> </p><p>Although the interface is designed to be able to handlemultiple parallel streams it can't be done yet due to limitationsin the engine, only one stream is allowed. <br> </p><p><font size="5">Future Compatibility</font> </p><p>This interface should be compatible with all future versionsof lame_enc.DLL without any need to recompile your programs. Youshould therefore <b>not</b> check the version number upon startand prevent users from running your program with a later versionof lame_enc.DLL. <br> </p><hr><p><font size="5">How to use the DLL</font> </p><p>1. Fill in a <a href="#The BE_CONFIG Structure">BE_CONFIG </a>structureand send it to <a href="#beInitStream()">beInitStream()</a>. Makesure that BE_ERR_SUCCESSFUL is returned. </p><p>2. Reserve at least the amount of memory returned indwBufferSize as your output buffer. </p><p>3. Call <a href="#beEncodeChunk()">beEncodeChunk()</a> untilyou've encoded everything you want. </p><p>4. Call <a href="#beDeinitStream()">beDeinitStream()</a> tomake sure that all encoded data is flushed out before closing thestream. </p><p>5. Close the stream using <a href="#beCloseStream()">beCloseStream()</a></p><p>6. Finally, call the <a href="#beWriteVBRHeader()">beWriteVBRHeader()</a>functions, to insert the INFO tag MP3 Header. This is anextension of the Xing VBR tag which is also used for CBRencodings. This call can only be omitted if the INFO tag wasexplicilty disabled in the BE_CONFIG Structure.</p><p>A handy feature is the available <ahref="#Lame_enc.dll debug option">Lame_enc.dll debug option</a>,which will dump the important lame internal settings to a textfile.<br> </p><p> </p><p><font size="5">Return Values</font> </p><p>See the header-file for a complete list of function returnvalues. All functions should return BE_ERR_SUCCESSFUL unlesssomething went wrong. <br> </p><hr><h1><a name="Type definitions"><font size="5">Type definitions</font></a></h1><p>The DLL is by default compiled with the MS Visual C/C++compiler, which has the following type definitions:</p><table border="0"> <tr> <td>Type </td> <td>Description</td> </tr> <tr> <td>CHAR</td> <td>signed char (8 bits)</td> </tr> <tr> <td>BYTE</td> <td>unsigned char (8 bits)</td> </tr> <tr> <td>SHORT</td> <td>signed short (16 bits)</td> </tr> <tr> <td>WORD</td> <td>unsigned short (16 bits)</td> </tr> <tr> <td>INT</td> <td>signed long (32 bits)</td> </tr> <tr> <td>LONG</td> <td>signed long (32 bits)</td> </tr> <tr> <td>BOOL</td> <td>signed long (32 bits) (YES, 32 bits for a one bit value)<br> TRUE = 0<br> FALSE=-1</td> </tr> <tr> <td>DWORD</td> <td>unsigned long (32 bits)</td> </tr> <tr> <td>FLOAT</td> <td>floating point (32 bits)</td> </tr> <tr> <td>DOUBLE</td> <td>float point (64 bits)</td> </tr> <tr> <td>LPCSTR</td> <td>const char* (32 bits pointer to zero terminated character string)</td> </tr></table><p>Within the lame_enc.dll All the structure elements are onebyte alligned (due to backwards compatibility with BladEnc.DLL!</p><p> </p><hr><h1><a name="The BE_CONFIG Structure"><font size="5">TheBE_CONFIG Structure </font></a></h1><p><font size="3">Currently there the BE_CONFIG structure has tovarians, the old MP3 config structure that is truly compatiblewith the old BladeEnc interface, and the new defined LHV1structure, which can set far more options in the lame encoder</font></p><p> </p><h2><font size="5">The MP3 BE_CONFIG - structure (OBSOLETE)</font></h2><p>This is the old structure as it was originally defined by theBladeEnc.DLL interface. However, I do highly recommend to use thenew Lame specific config structure, since it gives you morecontrol over the Lame encoder settings.</p><p>These are the members of the BE_CONFIG structure you need tofill in before you call beInitStream(): <br> </p><table border="0"> <tr> <td><b>dwConfig</b></td> <td>Specifies what kind of output you want. Since only MP3 currently is supported you must set this to <b>BE_CONFIG_MP3</b></td> </tr> <tr> <td><b>format.mp3.dwSampleRate</b> </td> <td>Samplerate in Hz for MP3 file. This can be set to either <b>32000</b>, <b>44100</b> or <b>48000</b>.</td> </tr> <tr> <td><b>format.mp3.byMode</b></td> <td>Stereomode for MP3 file. This can be either <b>BE_MP3_MODE_STEREO</b>, <b>BE_MP3_MODE_DUALCHANNEL</b> or <b>BE_MP3_MODE_MONO.</b></td> </tr> <tr> <td><b>format.mp3.bitrate</b></td> <td>Bitrate (i.e. size) of MP3 file in kBit/s. Allowed bitrates are: <b>32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256</b> and <b>320</b>.</td> </tr> <tr> <td><b>format.mp3.bCopyright</b></td> <td>If this is set to TRUE the Copyright bit in the MP3 stream will be set.</td> </tr> <tr> <td><b>format.mp3.bCRC</b></td> <td>Set this to TRUE in order to enable CRC-checksum in the bitstream.</td> </tr> <tr> <td><b>format.mp3.bOriginal</b></td> <td>If this is set to TRUE the Original bit in the MP3 stream will be set.</td> </tr> <tr> <td><b>format.mp3.bPrivate</b></td> <td>If this is set to TRUE the Private bit in the MP3 stream will be set.</td> </tr></table><p> </p><h2><font size="5">The LHV1 BE_CONFIG - structure (recommended)</font></h2><p>These are the members of the LHV1 BE_CONFIG structure, youneed to fill in before you call beInitStream(): <br></p><table border="0"> <tr> <td><b>dwConfig</b></td> <td>Specifies what kind of output you want. Since only MP3 currently is supported you must set this to <b>BE_CONFIG_LAME</b></td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td><b>format.LHV1.dwStructVersion</b></td> <td>Indicates the version number of the structure, current version number is 1</td> </tr> <tr> <td><b>format.LHV1.dwStructSize</b></td> <td>Specifies the size of the BE_CONFIG structure (currently 331 bytes)</td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td><b>format.LHV1.dwSampleRate</b> </td> <td>Samplerate in Hz for MP3 file. This can be set to either:<br> <b>32000</b>, <b>44100</b> or <b>48000</b> for MPEG-I<br> <b>16000</b>, <b>22050</b> or <b>24000</b> for MPEG-I<br> <b>8000</b>, <b>11025</b> or <b>12000</b> for MPEG-II.5</td> </tr> <tr> <td><b>format.LHV1.dwReSampleRate</b></td> <td>Specifies to which sample rate the input stream has to be resampled, if set to 0, the encoder will decide which ReSample rate to use</td> </tr> <tr> <td><b>format.LHV1.nMode</b></td> <td>Stereomode for MP3 file. This can be either <b>BE_MP3_MODE_STEREO</b>, <b>BE_MP3_MODE_JSTEREO, BE_MP3_MODE_DUALCHANNEL</b> or <b>BE_MP3_MODE_MONO.</b></td> </tr> <tr> <td><strong>format.LHV1.dwBitrate</strong></td> <td>For CBR, this specifies the actual bitrate, for VBR, it specifies the minimum bitrate<br> Allowed bitrates are: <b>32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256</b> and <b>320</b>.for MPEG-I<br> Allowed bitrates are: <b>8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144 </b>and<b> 160</b>.for MPEG-II<p><strong>Note:</strong> dwBitrate is used as the minimum bitrate in the case of using a VBR mode.</p> </td> </tr> <tr> <td><strong>format.LHV1.dwMaxBitrate</strong></td> <td>When VBR mode is enabled, it specifies the maximum allowed bitrate (see also dwBitrate to specify the minium bitrate), for CBR mode this setting is ignored.</td> </tr> <tr> <td><strong>format.LHV1.nPreset</strong></td> <td>Keep in mind that the presets can overwrite some of the other settings, since it is called right before the encoder is initialized<br> <table border="0"> <tr> <td>The nPreset option can be set to one of the following presets values::</td> </tr> </table> <p>LQP_NOPRESET (don't use any presets)<br> LQP_NORMAL_QUALITY (quality is set to 5)<br> LQP_LOW_QUALITY (quality is set to 9)<br> LQP_HIGH_QUALITY (quality is set to 2)<br> LQP_VOICE_QUALITY (use for voice encoding)<br> LQP_R3MIX (r3mix preset option)<br> LQP_VERYHIGH_QUALITY (quality is set to 0)<br> LQP_STANDARD (lame command line alt-preset standard)<br> LQP_FAST_STANDARD (lame command line alt-preset fast standard)<br> LQP_EXTREME (lame command line alt-preset extreme)<br> LQP_FAST_EXTREME (lame command line alt-preset fast extreme)<br> LQP_INSANE (lame command line alt-preset insane)<br> LQP_ABR (lame command line alt-preset abr)<br> LQP_CBR(lame command line alt-preset cbr)<br> <br> <strong>(old lame preset options)</strong><br> LQP_PHONE <br> LQP_SW<br> LQP_AM<br> LQP_FM<br> LQP_VOICE<br> LQP_RADIO<br> LQP_TAPE<br> LQP_HIFI<br> LQP_CD<br> LQP_STUDIO</p> </td> </tr> <tr> <td> </td> </tr> <tr> <td><b>format.LHV1.bCopyright</b></td> <td>If this is set to TRUE the Copyright bit in the MP3 stream will be set.</td> </tr> <tr>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -