Top Description Fields Constructors Methods
javazoom.jl.decoder

public Class MP3Decoder

extends Object
Class Inheritance

The Decoder class encapsulates the details of decoding an MPEG audio frame.
Author
MDM
Since
0.0.5
Version
0.0.7 12/12/99

Field Summary

Modifier and TypeField and Description
public static final int
DECODER_ERROR

The first decoder error code.

private SynthesisFilter
filter1

Synthesis filter for the left channel.

private SynthesisFilter
filter2

Sythesis filter for the right channel.

public static final int
ILLEGAL_SUBBAND_ALLOCATION

Illegal allocation in subband layer.

private boolean
private LayerIDecoder
private LayerIIDecoder
private LayerIIIDecoder
private OutputBuffer
output

The Obuffer instance that will receive the decoded PCM samples.

private int
private int
public static final int
public static final int
UNSUPPORTED_LAYER

Layer not supported by the decoder.

Constructor Summary

AccessConstructor and Description
public
MP3Decoder()

Creates a new Decoder instance with default parameters.

Method Summary

Modifier and TypeMethod and Description
public OutputBuffer

Returns:

A SampleBuffer containing the decoded samples.
decodeFrame
(Header
The header describing the frame to decode.
header
,
Bitstream
The bistream that provides the bits for te body of the frame.
stream
)

Decodes one frame from an MPEG audio bitstream.

public int

Returns:

The number of output channels in the decoded samples: 1 for mono, or 2 for stereo.
getOutputChannels
()

Retrieves the number of channels of PCM samples output by this decoder.

public int
getOutputFrequency()

Retrieves the sample frequency of the PCM samples output by this decoder.

private void
protected DecoderException
newDecoderException(int errorcode)

protected DecoderException
newDecoderException(int errorcode, Throwable throwable)

protected FrameDecoder
retrieveDecoder(Header header, Bitstream stream, int layer)

public void
setOutputBuffer(OutputBuffer out)

Changes the output buffer.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

DECODER_ERRORback to summary
public static final int DECODER_ERROR

The first decoder error code. See the DecoderErrors interface for other decoder error codes.

filter1back to summary
private SynthesisFilter filter1

Synthesis filter for the left channel.

filter2back to summary
private SynthesisFilter filter2

Sythesis filter for the right channel.

ILLEGAL_SUBBAND_ALLOCATIONback to summary
public static final int ILLEGAL_SUBBAND_ALLOCATION

Illegal allocation in subband layer. Indicates a corrupt stream.

initializedback to summary
private boolean initialized
l1decoderback to summary
private LayerIDecoder l1decoder
l2decoderback to summary
private LayerIIDecoder l2decoder
l3decoderback to summary
private LayerIIIDecoder l3decoder
outputback to summary
private OutputBuffer output

The Obuffer instance that will receive the decoded PCM samples.

outputChannelsback to summary
private int outputChannels
outputFrequencyback to summary
private int outputFrequency
UNKNOWN_ERRORback to summary
public static final int UNKNOWN_ERROR
UNSUPPORTED_LAYERback to summary
public static final int UNSUPPORTED_LAYER

Layer not supported by the decoder.

Constructor Detail

MP3Decoderback to summary
public MP3Decoder()

Creates a new Decoder instance with default parameters.

Method Detail

decodeFrameback to summary
public OutputBuffer decodeFrame(Header header, Bitstream stream) throws DecoderException

Decodes one frame from an MPEG audio bitstream.

Parameters
header:Header

The header describing the frame to decode.

stream:Bitstream

The bistream that provides the bits for te body of the frame.

Returns:OutputBuffer

A SampleBuffer containing the decoded samples.

getOutputChannelsback to summary
public int getOutputChannels()

Retrieves the number of channels of PCM samples output by this decoder. This usually corresponds to the number of channels in the MPEG audio stream, although it may differ.

Returns:int

The number of output channels in the decoded samples: 1 for mono, or 2 for stereo.

getOutputFrequencyback to summary
public int getOutputFrequency()

Retrieves the sample frequency of the PCM samples output by this decoder. This typically corresponds to the sample rate encoded in the MPEG audio stream.

initializeback to summary
private void initialize(Header header) throws DecoderException
newDecoderExceptionback to summary
protected DecoderException newDecoderException(int errorcode)
newDecoderExceptionback to summary
protected DecoderException newDecoderException(int errorcode, Throwable throwable)
retrieveDecoderback to summary
protected FrameDecoder retrieveDecoder(Header header, Bitstream stream, int layer) throws DecoderException
setOutputBufferback to summary
public void setOutputBuffer(OutputBuffer out)

Changes the output buffer. This will take effect the next time decodeFrame() is called.