[][src]Struct audiopus::coder::Decoder

pub struct Decoder { /* fields omitted */ }

Decoder to decode.

Methods

impl Decoder[src]

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

Creates a new Opus decoder.

pub fn decode<'a, TP, TS>(
    &mut self,
    input: Option<TP>,
    output: TS,
    fec: bool
) -> Result<usize> where
    TP: TryInto<Packet<'a>>,
    TS: TryInto<MutSignals<'a, i16>>, 
[src]

Decodes an Opus packet as input and writes decoded data into output. Passing None as input indicates a packet loss.

Errors: If passed input's length exceeds std::i32::MAX, PacketTooLarge will be returned. If passed output's length exceeds std::i32::MAX, SignalsTooLarge will be returned.

pub fn decode_float<'a, TP, TS>(
    &mut self,
    input: TP,
    output: TS,
    fec: bool
) -> Result<usize> where
    TP: TryInto<Packet<'a>>,
    TS: TryInto<MutSignals<'a, f32>>, 
[src]

Decodes an Opus frame from floating point input.

The input signal (interleaved if 2 channels) will be encoded into the output payload and on success, returns the length of the encoded packet.

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

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

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

Gets the pitch period at 48 kHz 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.

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

Gets the decoder's configured amount to scale PCM signal by in Q8 dB units.

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

Configures decoder gain adjustment.

Scales the decoded output by a factor of gain specified in Q8 dB units.

Warning: This has a maximum range of -32768 to 32767 inclusive, and returns BadArgument otherwise. The default is 0 indicating no adjustment.

Info: This setting survives decoder reset.

pub fn size(&self) -> usize[src]

Gets size of self's underlying Opus-decoder in bytes.

Trait Implementations

impl GenericCtl for Decoder[src]

impl Drop for Decoder[src]

fn drop(&mut self)[src]

We have to ensure that the resource our wrapping Opus-struct is pointing to is deallocated properly.

impl Debug for Decoder[src]

Auto Trait Implementations

impl !Send for Decoder

impl !Sync for Decoder

Blanket Implementations

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

impl<T> From for T[src]

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

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

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

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

The type returned in the event of a conversion error.