public class OpusRepacketizer extends Object
OpusRepacketizer class.
| Constructor and Description |
|---|
OpusRepacketizer()
Allocates memory and initializes the new repacketizer with
opus_repacketizer_init().
|
| Modifier and Type | Method and Description |
|---|---|
int |
addPacket(byte[] data,
int data_offset,
int len)
opus_repacketizer_cat.
|
int |
createPacket(byte[] data,
int data_offset,
int maxlen)
Construct a new packet from data previously submitted to the repacketizer
state via opus_repacketizer_cat().
|
int |
createPacket(int begin,
int end,
byte[] data,
int data_offset,
int maxlen)
Construct a new packet from data previously submitted to the repacketizer
state via opus_repacketizer_cat().
|
int |
getNumFrames()
Return the total number of frames contained in packet data submitted to
the repacketizer state so far via opus_repacketizer_cat() since the last
call to opus_repacketizer_init() or opus_repacketizer_create().
|
static int |
padMultistreamPacket(byte[] data,
int data_offset,
int len,
int new_len,
int nb_streams)
Pads a given Opus multi-stream packet to a larger size (possibly changing
the TOC sequence).
|
static int |
padPacket(byte[] data,
int data_offset,
int len,
int new_len)
Pads a given Opus packet to a larger size (possibly changing the TOC
sequence).
|
void |
Reset()
(Re)initializes a previously allocated repacketizer state.
|
static int |
unpadMultistreamPacket(byte[] data,
int data_offset,
int len,
int nb_streams)
Remove all padding from a given Opus multi-stream packet and rewrite the
TOC sequence to minimize space usage.
|
static int |
unpadPacket(byte[] data,
int data_offset,
int len)
Remove all padding from a given Opus packet and rewrite the TOC sequence
to minimize space usage.
|
public OpusRepacketizer()
public void Reset()
public int addPacket(byte[] data,
int data_offset,
int len)
data - : The packet data. The application must ensure this pointer
remains valid until the next call to opus_repacketizer_init() or
opus_repacketizer_destroy().len: - The number of bytes in the packet data.data_offset - a intpublic int getNumFrames()
public int createPacket(int begin,
int end,
byte[] data,
int data_offset,
int maxlen)
begin - int: The index of the first frame in the current
repacketizer state to include in the output.end - int: One past the index of the last frame in the
current repacketizer state to include in the output.maxlen - opus_int32: The maximum number of bytes to store
in the output buffer. In order to guarantee success, this should be at
least 1276 for a single frame, or for multiple frames,
1277*(end-begin). However, 1*(end-begin) plus
the size of all packet data submitted to the repacketizer since the last
call to opus_repacketizer_init() or opus_repacketizer_create() is also
sufficient, and possibly much smaller.data - an array of byte objectsdata_offset - a intpublic int createPacket(byte[] data,
int data_offset,
int maxlen)
maxlen - opus_int32: The maximum number of bytes to store in
the output buffer. In order to guarantee
success, this should be at least
1277*opus_repacketizer_get_nb_frames(rp).
However,
1*opus_repacketizer_get_nb_frames(rp)
plus the size of all packet data
submitted to the repacketizer since the
last call to opus_repacketizer_init() or
opus_repacketizer_create() is also
sufficient, and possibly much smaller.data - an array of byte objectsdata_offset - a intpublic static int padPacket(byte[] data,
int data_offset,
int len,
int new_len)
len - opus_int32: The size of the packet. This must be at
least 1.new_len - opus_int32: The desired size of the packet after
padding. This must be at least as large as len.data - an array of byte objectsdata_offset - a intpublic static int unpadPacket(byte[] data,
int data_offset,
int len)
len - opus_int32: The size of the packet. This must be at
least 1.data - an array of byte objectsdata_offset - a intpublic static int padMultistreamPacket(byte[] data,
int data_offset,
int len,
int new_len,
int nb_streams)
len - opus_int32: The size of the packet. This must be at
least 1.new_len - opus_int32: The desired size of the packet after
padding. This must be at least 1.nb_streams - opus_int32: The number of streams (not
channels) in the packet. This must be at least as large as len.data - an array of byte objectsdata_offset - a intpublic static int unpadMultistreamPacket(byte[] data,
int data_offset,
int len,
int nb_streams)
len - opus_int32: The size of the packet. This must be at
least 1.nb_streams - opus_int32: The number of streams (not
channels) in the packet. This must be at least 1.data - an array of byte objectsdata_offset - a intCopyright © 2024. All rights reserved.