public class OggSpeexWriter extends AudioFileWriter
Modifier and Type | Field and Description |
---|---|
private int |
channels
Defines the number of channels of the audio input (1=mono, 2=stereo).
|
private byte[] |
dataBuffer
Data buffer
|
private int |
dataBufferPtr
Pointer within the Data buffer
|
private long |
granulepos
Absolute granule position
(the number of audio samples from beginning of file to end of Ogg Packet).
|
private byte[] |
headerBuffer
Header buffer
|
private int |
headerBufferPtr
Pointer within the Header buffer
|
private int |
mode
Defines the encoder mode (0=NB, 1=WB and 2-UWB).
|
private int |
nframes
Defines the number of frames per speex packet.
|
private java.io.OutputStream |
out
The OutputStream
|
private int |
packetCount
Speex packet count within an Ogg Page
|
static int |
PACKETS_PER_OGG_PAGE
Number of packets in an Ogg page (must be less than 255)
|
private int |
pageCount
Ogg Page count
|
private int |
sampleRate
Defines the sampling rate of the audio input.
|
private int |
size |
private int |
streamSerialNumber
Ogg Stream Serial Number
|
private boolean |
vbr
Defines whether or not to use VBR (Variable Bit Rate).
|
Constructor and Description |
---|
OggSpeexWriter()
Builds an Ogg Speex Writer.
|
OggSpeexWriter(int mode,
int sampleRate,
int channels,
int nframes,
boolean vbr)
Builds an Ogg Speex Writer.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the output file.
|
private void |
flush(boolean eos)
Flush the Ogg page out of the buffers into the file.
|
void |
open(java.io.File file)
Open the output file.
|
void |
open(java.lang.String filename)
Open the output file.
|
private void |
setFormat(int mode,
int sampleRate,
int channels,
int nframes,
boolean vbr)
Sets the output format.
|
void |
setSerialNumber(int serialNumber)
Sets the Stream Serial Number.
|
void |
writeHeader(java.lang.String comment)
Writes the header pages that start the Ogg Speex file.
|
void |
writePacket(byte[] data,
int offset,
int len)
Writes a packet of audio.
|
buildOggPageHeader, buildSpeexComment, buildSpeexHeader, writeInt, writeInt, writeInt, writeLong, writeLong, writeOggPageHeader, writeShort, writeShort, writeShort, writeSpeexComment, writeSpeexHeader, writeString
public static final int PACKETS_PER_OGG_PAGE
private java.io.OutputStream out
private int mode
private int sampleRate
private int channels
private int nframes
private boolean vbr
private int size
private int streamSerialNumber
private byte[] dataBuffer
private int dataBufferPtr
private byte[] headerBuffer
private int headerBufferPtr
private int pageCount
private int packetCount
private long granulepos
public OggSpeexWriter()
public OggSpeexWriter(int mode, int sampleRate, int channels, int nframes, boolean vbr)
mode
- the mode of the encoder (0=NB, 1=WB, 2=UWB).sampleRate
- the number of samples per second.channels
- the number of audio channels (1=mono, 2=stereo, ...).nframes
- the number of frames per speex packet.vbr
- private void setFormat(int mode, int sampleRate, int channels, int nframes, boolean vbr)
mode
- the mode of the encoder (0=NB, 1=WB, 2=UWB).sampleRate
- the number of samples per second.channels
- the number of audio channels (1=mono, 2=stereo, ...).nframes
- the number of frames per speex packet.vbr
- public void setSerialNumber(int serialNumber)
serialNumber
- public void close() throws java.io.IOException
close
in class AudioFileWriter
java.io.IOException
- if there was an exception closing the Audio Writer.public void open(java.io.File file) throws java.io.IOException
open
in class AudioFileWriter
file
- - file to open.java.io.IOException
- if there was an exception opening the Audio Writer.public void open(java.lang.String filename) throws java.io.IOException
open
in class AudioFileWriter
filename
- - file to open.java.io.IOException
- if there was an exception opening the Audio Writer.public void writeHeader(java.lang.String comment) throws java.io.IOException
writeHeader
in class AudioFileWriter
comment
- description to be included in the header.java.io.IOException
public void writePacket(byte[] data, int offset, int len) throws java.io.IOException
writePacket
in class AudioFileWriter
data
- - audio data.offset
- - the offset from which to start reading the data.len
- - the length of data to read.java.io.IOException
private void flush(boolean eos) throws java.io.IOException
eos
- - end of streamjava.io.IOException
Copyright © 1999-2004 Wimba S.A. All Rights Reserved.