|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.xiph.speex.SpeexDecoder
public class SpeexDecoder
Main Speex Decoder class. This class decodes the given Speex packets into PCM 16bit samples.
Here's an example that decodes and recovers one Speex packet.
SpeexDecoder speexDecoder = new SpeexDecoder(); speexDecoder.processData(data, packetOffset, packetSize); byte[] decoded = new byte[speexDecoder.getProcessedBataByteSize()]; speexDecoder.getProcessedData(decoded, 0);
Field Summary | |
---|---|
private Bits |
bits
|
private int |
channels
|
private float[] |
decodedData
|
private Decoder |
decoder
|
private int |
frameSize
|
private short[] |
outputData
|
private int |
outputSize
|
private int |
sampleRate
|
static java.lang.String |
VERSION
Version of the Speex Decoder |
Constructor Summary | |
---|---|
SpeexDecoder()
Constructor |
Method Summary | |
---|---|
int |
getChannels()
Returns the number of channels. |
int |
getProcessedData(byte[] data,
int offset)
Pull the decoded data out into a byte array at the given offset and returns the number of bytes processed and just read. |
int |
getProcessedData(short[] data,
int offset)
Pull the decoded data out into a short array at the given offset and returns tne number of shorts processed and just read |
int |
getProcessedDataByteSize()
Returns the number of bytes processed and ready to be read. |
int |
getSampleRate()
Returns the sample rate. |
boolean |
init(int mode,
int sampleRate,
int channels,
boolean enhanced)
Initialise the Speex Decoder. |
void |
processData(boolean lost)
This is where the actual decoding takes place. |
void |
processData(byte[] data,
int offset,
int len)
This is where the actual decoding takes place |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String VERSION
private int sampleRate
private int channels
private float[] decodedData
private short[] outputData
private int outputSize
private Bits bits
private Decoder decoder
private int frameSize
Constructor Detail |
---|
public SpeexDecoder()
Method Detail |
---|
public boolean init(int mode, int sampleRate, int channels, boolean enhanced)
mode
- the mode of the decoder (0=NB, 1=WB, 2=UWB).sampleRate
- the number of samples per second.channels
- the number of audio channels (1=mono, 2=stereo, ...).enhanced
- whether to enable perceptual enhancement or not.
public int getSampleRate()
public int getChannels()
public int getProcessedData(byte[] data, int offset)
data
- offset
-
public int getProcessedData(short[] data, int offset)
data
- offset
-
public int getProcessedDataByteSize()
public void processData(byte[] data, int offset, int len) throws java.io.StreamCorruptedException
data
- - the Speex data (frame) to decode.
If it is null, the packet is supposed lost.offset
- - the offset from which to start reading the data.len
- - the length of data to read (Speex frame size).
java.io.StreamCorruptedException
- If the input stream is invalid.public void processData(boolean lost) throws java.io.StreamCorruptedException
lost
- - true if the Speex packet has been lost.
java.io.StreamCorruptedException
- If the input stream is invalid.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |