Skip to main content

OpusDecoder

Struct OpusDecoder 

Source
pub struct OpusDecoder {
    pub hybrid_skip_celt: bool,
    /* private fields */
}

Fields§

§hybrid_skip_celt: bool

Implementations§

Source§

impl OpusDecoder

Source

pub fn new(sampling_rate: i32, channels: usize) -> Result<Self, &'static str>

Source

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.

Source

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.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.