pub struct OpusDecoder { /* private fields */ }Implementations§
Source§impl OpusDecoder
impl OpusDecoder
Sourcepub fn new_default() -> Self
pub fn new_default() -> Self
Create a default Opus decoder (48kHz, stereo)
Sourcepub fn decode_into_raw(&mut self, data: &[u8], output: &mut [i16]) -> usize
pub fn decode_into_raw(&mut self, data: &[u8], output: &mut [i16]) -> usize
Lower-level decode that does not perform the stereo→mono downmix.
Used internally by both the trait impl and the back-comat decode.
Trait Implementations§
Source§impl Decoder for OpusDecoder
impl Decoder for OpusDecoder
Source§fn enable_concealment(&mut self) -> bool
fn enable_concealment(&mut self) -> bool
Opus’s concealment is part of the decoder: always on.
Source§fn conceal_into(
&mut self,
samples: usize,
out: &mut [Sample],
) -> Result<usize, CodecError>
fn conceal_into( &mut self, samples: usize, out: &mut [Sample], ) -> Result<usize, CodecError>
Conceals with Opus’s own packet loss concealment, faded through a
long loss as G.711 and G.722’s is: full level for 10 ms, silence at
60 ms. samples must be an Opus frame size (a multiple of 2.5 ms, at
most 20 ms); others fail with DecodeFailed.
Source§fn conceal(&mut self, samples: usize) -> PcmBuf
fn conceal(&mut self, samples: usize) -> PcmBuf
Override the default to downmix stereo to mono, as decode does.
Source§fn recover_into(
&mut self,
next: &[u8],
samples: usize,
out: &mut [Sample],
) -> Result<usize, CodecError>
fn recover_into( &mut self, next: &[u8], samples: usize, out: &mut [Sample], ) -> Result<usize, CodecError>
Rebuilds the lost frame from next’s in-band FEC (libopus’s
decode_fec), concealing what it doesn’t cover. samples as for
conceal_into.
Source§fn recover(&mut self, next: &[u8], samples: usize) -> PcmBuf
fn recover(&mut self, next: &[u8], samples: usize) -> PcmBuf
Override the default to downmix stereo to mono, as decode does.
Source§fn decode(&mut self, data: &[u8]) -> PcmBuf
fn decode(&mut self, data: &[u8]) -> PcmBuf
Override the default to preserve back-comat stereo→mono downmix
when the decoder was configured with channels == 2.
Source§fn decode_into(
&mut self,
data: &[u8],
out: &mut [Sample],
) -> Result<usize, CodecError>
fn decode_into( &mut self, data: &[u8], out: &mut [Sample], ) -> Result<usize, CodecError>
Source§fn max_decode_samples(&self, n_bytes: usize) -> usize
fn max_decode_samples(&self, n_bytes: usize) -> usize
decode_into will write
for an input of n_bytes bytes.