lameonj.decoder.std
Interface GenericDecoder

All Superinterfaces:
Decoder

public interface GenericDecoder
extends Decoder

This interface may be used to progressively decode MP3 data to PCM.

A decoding process must start decoding MP3 headers, the method decodeHeaders(byte[],int) must be called until it returns a non-null MP3 header object.

See Also:
LAMEOnJStdDecoder.createGenericDecoder()

Method Summary
 PCMFrame decodeFrame(byte[] mp3buf, int size)
          Decodes the specified MP3 data to build one PCM frame.
 mp3data_struct decodeHeaders(byte[] mp3buf, int size)
          Process the specified MP3 data containing MP3 header info.
 PCMFrame decodePendingFrame()
          Decodes any pending (not processed) MP3 data to build one PCM frame.
 
Methods inherited from interface lameonj.decoder.std.Decoder
close, fixWAVHeader, getMP3DataStruct, getPCMDataSize, isClosed, isMP3HeaderComplete, writeDecodedFrame, writeWAVHeader
 

Method Detail

decodeHeaders

mp3data_struct decodeHeaders(byte[] mp3buf,
                             int size)
Process the specified MP3 data containing MP3 header info.

If this method returns null, specified MP3 data is not enough to extract header info. Call again until returns a non-null object.

Submitted MP3 data can contain several MP3 frames, not processed data is queued internally and used later. Call decodePendingFrame() to process pending MP3 frames to avoid excessive memory consumption.

Parameters:
mp3buf - buffer containing MP3 data to decode.
size - the number of bytes of the MP3 buffer to process.
Returns:
the MP3 header object. Null if not enough MP3 data was submitted.

decodeFrame

PCMFrame decodeFrame(byte[] mp3buf,
                     int size)
Decodes the specified MP3 data to build one PCM frame.

Any internal MP3 data pending to process is used first to build the PCM frame.

If submitted MP3 data is not enough returns null. Call again providing new data.

Submitted MP3 data can contain several MP3 frames, not processed data is queued internally and used later. Before calling this method, call decodePendingFrame() to process pending MP3 frames to avoid excessive memory consumption.

Parameters:
mp3buf - buffer containing MP3 data to decode.
size - the number of bytes of the MP3 buffer to process.
Returns:
a PCM frame object. Null if not enough MP3 data was submitted.

decodePendingFrame

PCMFrame decodePendingFrame()
Decodes any pending (not processed) MP3 data to build one PCM frame.

If pending MP3 data is not enough to build a PCM frame returns null.

Before submitting new MP3 data to the decoder call this method several times until returns null to avoid excessive memory consumption.

Returns:
a PCM frame object. Null if not enough MP3 data is pending.


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