opus_repacketizer_cat method
Add a packet to the current repacketizer state.
This packet must match the configuration of any packets already submitted
for repacketization since the last call to opus_repacketizer_init().
This means that it must have the same coding mode, audio bandwidth, frame
size, and channel count.
This can be checked in advance by examining the top 6 bits of the first
byte of the packet, and ensuring they match the top 6 bits of the first
byte of any previously submitted packet.
The total duration of audio in the repacketizer state also must not exceed
120 ms, the maximum duration of a single packet, after adding this packet.
*
The contents of the current repacketizer state can be extracted into new
packets using opus_repacketizer_out() or opus_repacketizer_out_range().
*
In order to add a packet with a different configuration or to add more
audio beyond 120 ms, you must clear the repacketizer state by calling
opus_repacketizer_init().
If a packet is too large to add to the current repacketizer state, no part
of it is added, even if it contains multiple frames, some of which might
fit.
If you wish to be able to add parts of such packets, you should first use
another repacketizer to split the packet into pieces and add them
individually.
@see opus_repacketizer_out_range
@see opus_repacketizer_out
@see opus_repacketizer_init
@param rp OpusRepacketizer*: The repacketizer state to which to
add the packet.
@paramin
data const unsigned char*: The packet data.
The application must ensure
this pointer remains valid
until the next call to
opus_repacketizer_init() or
opus_repacketizer_destroy().
@param len opus_int32: The number of bytes in the packet data.
@returns An error code indicating whether or not the operation succeeded.
@retval #OPUS_OK The packet's contents have been added to the repacketizer
state.
@retval #OPUS_INVALID_PACKET The packet did not have a valid TOC sequence,
the packet's TOC sequence was not compatible
with previously submitted packets (because
the coding mode, audio bandwidth, frame size,
or channel count did not match), or adding
this packet would increase the total amount of
audio stored in the repacketizer state to more
than 120 ms.
Implementation
int opus_repacketizer_cat(
ffi.Pointer<OpusRepacketizer> rp,
ffi.Pointer<ffi.Uint8> data,
int len,
) {
return _opus_repacketizer_cat(rp, data, len);
}