Skip to main content

Decoder

Struct Decoder 

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

Streaming AHX decoder with fixed synthesis and PCM arrays, available with std.

No allocation or seeking is performed by this decoder. Wrap files in std::io::BufReader for efficient small reads. Reader-owned buffering and output handling are outside the decoder’s allocation guarantee.

Implementations§

Source§

impl<R> Decoder<R>

Source

pub const fn metadata(&self) -> Metadata

Validated file timing and header layout.

Source

pub const fn state(&self) -> DecoderState

Current decoding progress, successful completion, or terminal failure.

Source

pub fn into_inner(self) -> R

Recover the reader at its current position, without rewinding.

Source§

impl<R: Read> Decoder<R>

Source

pub fn new(reader: R) -> Result<Self, Error>

Validate the header and initialize fixed-size storage without allocating.

Source

pub fn next_block(&mut self) -> Result<Option<&[i16]>, Error>

Decode up to SAMPLES_PER_FRAME mono PCM16 elements into borrowed storage.

No startup samples are discarded and no resampling occurs. The final block is trimmed to the declared duration after validating the footer. Errors invalidate the reader; calls after an error return Error::Failed. An unwinding panic in caller I/O also leaves it failed. Calls after successful EOF return None without reading further input.

Trait Implementations§

Source§

impl<R> Debug for Decoder<R>

Available on crate feature std only.
Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<R> Freeze for Decoder<R>
where Stream<ReaderInput<R>, [i16; 1152]>: Freeze,

§

impl<R> RefUnwindSafe for Decoder<R>
where Stream<ReaderInput<R>, [i16; 1152]>: RefUnwindSafe,

§

impl<R> Send for Decoder<R>
where Stream<ReaderInput<R>, [i16; 1152]>: Send,

§

impl<R> Sync for Decoder<R>
where Stream<ReaderInput<R>, [i16; 1152]>: Sync,

§

impl<R> Unpin for Decoder<R>
where Stream<ReaderInput<R>, [i16; 1152]>: Unpin,

§

impl<R> UnsafeUnpin for Decoder<R>
where Stream<ReaderInput<R>, [i16; 1152]>: UnsafeUnpin,

§

impl<R> UnwindSafe for Decoder<R>
where Stream<ReaderInput<R>, [i16; 1152]>: UnwindSafe,

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.