org.xiph.speex
Class OggSpeexWriter
public class OggSpeexWriter
Ogg Speex Writer
- Marc Gimpel, Wimba S.A. (mgimpel@horizonwimba.com)
static int | PACKETS_PER_OGG_PAGE - Number of packets in an Ogg page (must be less than 255)
|
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 OutputStream | out - The OutputStream
|
private int | packetCount - Speex packet count within an Ogg Page
|
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).
|
OggSpeexWriter() - Builds an Ogg Speex Writer.
|
OggSpeexWriter(int mode, int sampleRate, int channels, int nframes, boolean vbr) - Builds an Ogg Speex Writer.
|
void | close() - Closes the output file.
|
private void | flush(boolean eos) - Flush the Ogg page out of the buffers into the file.
|
void | open(File file) - Open the output file.
|
void | open(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(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 , close , open , open , writeHeader , writeInt , writeInt , writeInt , writeLong , writeLong , writeOggPageHeader , writePacket , writeShort , writeShort , writeShort , writeSpeexComment , writeSpeexHeader , writeString |
PACKETS_PER_OGG_PAGE
public static final int PACKETS_PER_OGG_PAGE
Number of packets in an Ogg page (must be less than 255)
channels
private int channels
Defines the number of channels of the audio input (1=mono, 2=stereo).
dataBuffer
private byte[] dataBuffer
Data buffer
dataBufferPtr
private int dataBufferPtr
Pointer within the Data buffer
granulepos
private long granulepos
Absolute granule position
(the number of audio samples from beginning of file to end of Ogg Packet).
headerBuffer
private byte[] headerBuffer
Header buffer
headerBufferPtr
private int headerBufferPtr
Pointer within the Header buffer
mode
private int mode
Defines the encoder mode (0=NB, 1=WB and 2-UWB).
nframes
private int nframes
Defines the number of frames per speex packet.
out
private OutputStream out
The OutputStream
packetCount
private int packetCount
Speex packet count within an Ogg Page
pageCount
private int pageCount
Ogg Page count
sampleRate
private int sampleRate
Defines the sampling rate of the audio input.
streamSerialNumber
private int streamSerialNumber
Ogg Stream Serial Number
vbr
private boolean vbr
Defines whether or not to use VBR (Variable Bit Rate).
OggSpeexWriter
public OggSpeexWriter()
Builds an Ogg Speex Writer.
OggSpeexWriter
public OggSpeexWriter(int mode,
int sampleRate,
int channels,
int nframes,
boolean vbr)
Builds an Ogg Speex Writer.
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
-
close
public void close()
throws IOException
Closes the output file.
- close in interface AudioFileWriter
flush
private void flush(boolean eos)
throws IOException
Flush the Ogg page out of the buffers into the file.
open
public void open(File file)
throws IOException
Open the output file.
- open in interface AudioFileWriter
open
public void open(String filename)
throws IOException
Open the output file.
- open in interface AudioFileWriter
filename
- - file to open.
setFormat
private void setFormat(int mode,
int sampleRate,
int channels,
int nframes,
boolean vbr)
Sets the output format.
Must be called before WriteHeader().
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
-
setSerialNumber
public void setSerialNumber(int serialNumber)
Sets the Stream Serial Number.
Must not be changed mid stream.
writeHeader
public void writeHeader(String comment)
throws IOException
Writes the header pages that start the Ogg Speex file.
Prepares file for data to be written.
- writeHeader in interface AudioFileWriter
comment
- description to be included in the header.
writePacket
public void writePacket(byte[] data,
int offset,
int len)
throws IOException
Writes a packet of audio.
- writePacket in interface AudioFileWriter
data
- - audio data.offset
- - the offset from which to start reading the data.len
- - the length of data to read.
Copyright © 1999-2004 Wimba S.A. All Rights Reserved.