[][src]Struct magnum_opus::Decoder

pub struct Decoder { /* fields omitted */ }

An Opus decoder with associated state.

Implementations

impl Decoder[src]

pub fn new(sample_rate: u32, channels: Channels) -> Result<Decoder>[src]

Create and initialize a decoder.

pub fn decode(
    &mut self,
    input: &[u8],
    output: &mut [i16],
    fec: bool
) -> Result<usize>
[src]

Decode an Opus packet.

pub fn decode_float(
    &mut self,
    input: &[u8],
    output: &mut [f32],
    fec: bool
) -> Result<usize>
[src]

Decode an Opus packet with floating point output.

pub fn get_nb_samples(&self, packet: &[u8]) -> Result<usize>[src]

Get the number of samples of an Opus packet.

pub fn reset_state(&mut self) -> Result<()>[src]

Reset the codec state to be equivalent to a freshly initialized state.

pub fn get_final_range(&mut self) -> Result<u32>[src]

Get the final range of the codec's entropy coder.

pub fn get_bandwidth(&mut self) -> Result<Bandwidth>[src]

Get the decoder's last bandpass.

pub fn get_sample_rate(&mut self) -> Result<u32>[src]

Get the samping rate the decoder was intialized with.

pub fn set_gain(&mut self, gain: i32) -> Result<()>[src]

Configures decoder gain adjustment.

Scales the decoded output by a factor specified in Q8 dB units. This has a maximum range of -32768 to 32768 inclusive, and returns BadArg otherwise. The default is zero indicating no adjustment. This setting survives decoder reset.

gain = pow(10, x / (20.0 * 256))

pub fn get_gain(&mut self) -> Result<i32>[src]

Gets the decoder's configured gain adjustment.

pub fn get_last_packet_duration(&mut self) -> Result<u32>[src]

Gets the duration (in samples) of the last packet successfully decoded or concealed.

pub fn get_pitch(&mut self) -> Result<i32>[src]

Gets the pitch of the last decoded frame, if available.

This can be used for any post-processing algorithm requiring the use of pitch, e.g. time stretching/shortening. If the last frame was not voiced, or if the pitch was not coded in the frame, then zero is returned.

Trait Implementations

impl Debug for Decoder[src]

impl Drop for Decoder[src]

impl Send for Decoder[src]

Auto Trait Implementations

impl RefUnwindSafe for Decoder

impl !Sync for Decoder

impl Unpin for Decoder

impl UnwindSafe for Decoder

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.