public class OpusWriter extends AudioFileWriter
Modifier and Type | Field and Description |
---|---|
AudioConsumer |
audioConsumer
The audio consumer.
|
static int |
PACKETS_PER_OGG_PAGE
Number of packets in an Ogg page (must be less than 255).
|
protected int |
pageCount
Ogg Page count.
|
protected int |
sampleRate
Defines the sampling rate of the audio input.
|
protected int |
streamSerialNumber
Ogg Stream Serial Number.
|
Constructor and Description |
---|
OpusWriter()
Setting up the OggOpus Writer.
|
OpusWriter(AudioConsumer ac)
Instantiates a new opus writer.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close.
|
protected void |
flush(boolean eos)
Flush the Ogg page out of the buffers into the file.
|
void |
open(java.io.File file)
Open.
|
void |
open(java.lang.String filename)
Open.
|
void |
write(byte[] data)
Write data into Socket.
|
void |
write(byte[] data,
int offset,
int count)
Write data into Socket.
|
void |
writeHeader(java.lang.String comment)
Write header.
|
void |
writePacket(byte[] data,
int offset,
int len)
Write data packet.
|
buildOggPageHeader, buildOpusComment, buildOpusHeader, writeInt, writeInt, writeInt, writeLong, writeLong, writeOggPageHeader, writeOpusComment, writeOpusHeader, writeShort, writeShort, writeShort, writeString
public static final int PACKETS_PER_OGG_PAGE
public AudioConsumer audioConsumer
protected int sampleRate
protected int streamSerialNumber
protected int pageCount
public OpusWriter()
public OpusWriter(AudioConsumer ac)
ac
- the acpublic void close() throws java.io.IOException
close
in class AudioFileWriter
java.io.IOException
- Signals that an I/O exception has occurred.public void open(java.io.File file) throws java.io.IOException
open
in class AudioFileWriter
file
- the filejava.io.IOException
- Signals that an I/O exception has occurred.public void open(java.lang.String filename) throws java.io.IOException
open
in class AudioFileWriter
filename
- the filenamejava.io.IOException
- Signals that an I/O exception has occurred.public void writeHeader(java.lang.String comment)
writeHeader
in class AudioFileWriter
comment
- the commentpublic void writePacket(byte[] data, int offset, int len) throws java.io.IOException
writePacket
in class AudioFileWriter
data
- audio dataoffset
- the offset from which to start reading the data.len
- the length of data to read.java.io.IOException
- Signals that an I/O exception has occurred.protected void flush(boolean eos) throws java.io.IOException
eos
- - end of streamjava.io.IOException
- Signals that an I/O exception has occurred.public void write(byte[] data)
data
- the datapublic void write(byte[] data, int offset, int count)
data
- the dataoffset
- the offsetcount
- the count