|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectfi.helsinki.cs.ohtu.mpeg2.audio.mpa.MP2Data
public class MP2Data
This class encodes compressed audio data to binary form. TODO: Add support for joint stereo.
Nested Class Summary | |
---|---|
static class |
MP2Data.Channel
Represents a single audio channel. |
Field Summary | |
---|---|
private MP2Data.Channel[] |
channels
Audio channels for this audio data chunk |
private int |
jsbound
From which sub-band the sub-band data is joint between channels |
private QuantizationTables.QuantizationTable |
qTable
Quantization table for this audio data chunk |
Constructor Summary | |
---|---|
MP2Data(MP2Data.Channel[] channels,
QuantizationTables.QuantizationTable qTable)
Creates a new AudioData instance from given channels using
given quantization table. |
|
MP2Data(MP2Data.Channel[] channels,
QuantizationTables.QuantizationTable qTable,
int jsbound)
Creates a new AudioData instance from given channels
with a joint stereo bound, using a given quantization table. |
|
MP2Data(MP2Data.Channel channel,
QuantizationTables.QuantizationTable qTable)
Creates a new AudioData instance from given channel using
given quanization table. |
Method Summary | |
---|---|
private void |
encodeBitAllocation(BitOutputStream stream,
CRC16 crc16)
Writes the bit allocation of current audio data chunk to given stream and updates CRC-16 checksum. |
private void |
encodeSamples(BitOutputStream stream)
Writes the samples of current audio data chunk to given stream. |
private void |
encodeScaleFactors(BitOutputStream stream,
CRC16 crc16)
Writes the scale factors of current audio data chunk to given stream and updates CRC-16 checksum. |
void |
writeTo(BitOutputStream stream)
Writes this audio data chunk to given stream. |
void |
writeTo(BitOutputStream stream,
CRC16 crc16)
Writes this audio data chunk to given stream and updates CRC-16 checksum. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private final MP2Data.Channel[] channels
private final int jsbound
private final QuantizationTables.QuantizationTable qTable
Constructor Detail |
---|
public MP2Data(MP2Data.Channel[] channels, QuantizationTables.QuantizationTable qTable, int jsbound)
AudioData
instance from given channels
with a joint stereo bound, using a given quantization table.
Starting from sub-band jsbound
the first channel is
used as a data source. The scale factor information is a slight
exception as both the channels have their own scale factors.
To keep things somewhat consistent, the joint sub-bands have
to have equal bit allocations. Otherwise undefined behaviour
will occur.
channels
- the array of compressed audio channelsqTable
- the quantization table for the audio samplesjsbound
- the joint stereo bound of the sub-bandspublic MP2Data(MP2Data.Channel[] channels, QuantizationTables.QuantizationTable qTable)
AudioData
instance from given channels using
given quantization table.
channels
- An array of compressed audio channelsqTable
- Quantization table for the audio samplespublic MP2Data(MP2Data.Channel channel, QuantizationTables.QuantizationTable qTable)
AudioData
instance from given channel using
given quanization table.
channel
- An audio channelqTable
- Quantization table for the audio samplesMethod Detail |
---|
private void encodeBitAllocation(BitOutputStream stream, CRC16 crc16) throws java.io.IOException
stream
- Stream in to which the bit allocation is writtencrc16
- CRC-16 instance to update
java.io.IOException
private void encodeScaleFactors(BitOutputStream stream, CRC16 crc16) throws java.io.IOException
stream
- Stream in to which the scale factors are writtencrc16
- CRC-16 instance to update
java.io.IOException
private void encodeSamples(BitOutputStream stream) throws java.io.IOException
stream
- Stream in to which the samples are written
java.io.IOException
public void writeTo(BitOutputStream stream, CRC16 crc16) throws java.io.IOException
stream
- Stream in to which this audio data chunk is writtencrc16
- CRC-16 instance to update
java.io.IOException
public void writeTo(BitOutputStream stream) throws java.io.IOException
stream
- Stream in to which this audio data chunk is written
java.io.IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |