lameonj.encoder.blade
Interface BeStream


public interface BeStream

The BeStream is the interface implemented by the internal class wrapping the encoding stream lifecycle.
Unless the close() is called a BeStream holds a previously initiated LAME stream with: BladeMP3EncDLL.beInitStream(BE_CONFIG,NativeInteger,NativeInteger,NativeInteger).
If the stream is closed the instance must be discarded.

See Also:
LAMEOnJBlade.initStream(BeConfig)

Method Summary
 void close()
          Closes the stream, the instance must be discarded.
 int deinitStream(byte[] pOutput)
          Flushes to the output buffer the internal encoder data remaining.
 int encodeChunk(int nSamples, byte[] pSamples, byte[] pOutput)
          Encodes a chunk of audio samples, the output data is written to the output buffer.
 int encodeChunk(int nSamples, short[] pSamples, byte[] pOutput)
          Encodes a chunk of audio samples, the output data is written to the output buffer.
 int encodeChunkFloatS16NI(int hbeStream, int nSamples, float[] buffer_l, float[] buffer_r, byte[] pOutput)
          Undocumented method.
 int flushNoGap(int hbeStream, byte[] pOutput)
          Undocumented method.
 int getHandle()
          Returns the stream handle used by LAME.
 int getNSamples()
          Returns the maximum number of samples per encoding call.
 int getOutputBufferSize()
          Returns the maximum output buffer size per encoding call.
 boolean isOpen()
          Returns true if the encoding stream is open.
 

Method Detail

getHandle

int getHandle()
Returns the stream handle used by LAME. This is the handle returned in the phbeStream parameter by the call BladeMP3EncDLL.beInitStream(BE_CONFIG,NativeInteger,NativeInteger,NativeInteger) and used to encode.

Returns:
the stream handle. If 0 the stream is closed.

getNSamples

int getNSamples()
Returns the maximum number of samples per encoding call. This is the value returned in the pDwSamples parameter by the call BladeMP3EncDLL.beInitStream(BE_CONFIG,NativeInteger,NativeInteger,NativeInteger).

Returns:
the stream handle.
See Also:
encodeChunk(int,short[],byte[])

getOutputBufferSize

int getOutputBufferSize()
Returns the maximum output buffer size per encoding call. This is the value returned in the pDwSamples parameter by the call BladeMP3EncDLL.beInitStream(BE_CONFIG,NativeInteger,NativeInteger,NativeInteger).

Returns:
the maximum output buffer size.
See Also:
encodeChunk(int,short[],byte[])

isOpen

boolean isOpen()
Returns true if the encoding stream is open.

Returns:
true if open.

close

void close()
Closes the stream, the instance must be discarded.
The method BladeMP3EncDLL.beCloseStream(int) is called.


deinitStream

int deinitStream(byte[] pOutput)
Flushes to the output buffer the internal encoder data remaining.
The method BladeMP3EncDLL.beInitStream(BE_CONFIG,NativeInteger,NativeInteger,NativeInteger) is called.

Parameters:
pOutput - the output buffer receiving the remaining data.
Returns:
the number of bytes written to the output buffer.

encodeChunk

int encodeChunk(int nSamples,
                short[] pSamples,
                byte[] pOutput)
Encodes a chunk of audio samples, the output data is written to the output buffer.
The method BladeMP3EncDLL.beEncodeChunk(int,int,short[],byte[],NativeInteger) is called.

Parameters:
nSamples - the number of samples to be encoded.
pSamples - the samples buffer to be written.
pOutput - the output buffer receiving the encoded data.
Returns:
the number of bytes written to the output buffer.

encodeChunk

int encodeChunk(int nSamples,
                byte[] pSamples,
                byte[] pOutput)
Encodes a chunk of audio samples, the output data is written to the output buffer.
This is a convenience method using a byte[] samples buffer instead a short[] buffer. The byte[] buffer must be 2x the size of the corresponding short[] buffer.

Parameters:
nSamples - the number of samples to be encoded.
pSamples - the samples buffer in bytes (two bytes per sample) to be written.
pOutput - the output buffer receiving the encoded data.
Returns:
the number of bytes written to the output buffer.
See Also:
encodeChunk(int,short[],byte[])

encodeChunkFloatS16NI

int encodeChunkFloatS16NI(int hbeStream,
                          int nSamples,
                          float[] buffer_l,
                          float[] buffer_r,
                          byte[] pOutput)
Undocumented method.


flushNoGap

int flushNoGap(int hbeStream,
               byte[] pOutput)
Undocumented method.



Copyright © 2006-2008 Jose Maria Arranz. All Rights Reserved.