pub struct OpusDecoder {
pub hybrid_skip_celt: bool,
/* private fields */
}Fields§
§hybrid_skip_celt: boolImplementations§
Source§impl OpusDecoder
impl OpusDecoder
pub fn new(sampling_rate: i32, channels: usize) -> Result<Self, &'static str>
Sourcepub fn init(
slot: &mut MaybeUninit<Self>,
sampling_rate: i32,
channels: usize,
) -> Result<&mut Self, &'static str>
pub fn init( slot: &mut MaybeUninit<Self>, sampling_rate: i32, channels: usize, ) -> Result<&mut Self, &'static str>
Builds a decoder in slot instead of returning it.
Without the heap feature the decoder is about 175 KB, and new returns it
through the stack. init writes it straight into memory you provide, such as
a static, so it never has to fit on the stack.
Sourcepub fn decode(
&mut self,
input: &[u8],
frame_size: usize,
output: &mut [f32],
) -> Result<usize, &'static str>
pub fn decode( &mut self, input: &[u8], frame_size: usize, output: &mut [f32], ) -> Result<usize, &'static str>
Decode one Opus packet into interleaved f32 PCM, returning the
number of samples per channel written.
Packet loss follows libopus: pass an empty packet (&[]) to conceal
frame_size samples (a multiple of 2.5 ms), or a ToC-only 1-byte
packet to conceal the duration that ToC describes. Either way the
frame is concealed in the previous packet’s mode; the placeholder’s
mode, bandwidth and channel bits are ignored.
A packet’s channel count need not match the decoder’s, as in libopus: a stereo decoder plays a mono packet on both channels, and a mono decoder downmixes a stereo packet (SILK plays the mid). libopus encoders send mono packets in stereo streams at low bitrates.