Skip to main content

Decoder

Struct Decoder 

Source
pub struct Decoder { /* private fields */ }
Expand description

A WMA v2 decoder for one stream. Give it the packets in order with decode_packet, then call flush once at the end.

Implementations§

Source§

impl Decoder

Source

pub fn new(p: &Params) -> Result<Self>

A decoder for a stream with these parameters. It fails when the format tag is not WMA v2 or the parameters are not supported.

Source

pub fn channels(&self) -> usize

The number of channels.

Source

pub fn sample_rate(&self) -> u32

The sample rate, in samples per second.

Source

pub fn delay(&self) -> usize

Codec delay in samples per channel: the first two frames only prime the overlap and are not output.

Source

pub fn frame_len(&self) -> usize

Samples per channel produced by each frame.

Source

pub fn decode_packet(&mut self, packet: &[u8], out: &mut Vec<f32>) -> Result<()>

Decode one packet (block_align bytes), appending interleaved samples in [-1, 1) to out. On error nothing is appended and the bit reservoir is dropped, so the next packet starts cleanly.

Source

pub fn flush(&mut self, out: &mut Vec<f32>)

Emit the final overlap tail (one frame) after the last packet and reset.

Source

pub fn reset(&mut self)

Forget all stream state, e.g. before seeking.

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.