Skip to main content

WavStream

Struct WavStream 

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

A seekable, bounded RIFF/WAVE PCM source. The owner must supply a stable, authorized reader whose range begins at its current position and remains unchanged for this object’s lifetime. Parsing does not establish authority, provenance, or integrity. Reads use a caller-provided byte buffer.

Implementations§

Source§

impl<R: Read + Seek> WavStream<R>

Source

pub fn open(reader: R, source_len: u64) -> Result<Self>

Scan a bounded WAVE range. Chunk headers are limited to 4096; PCM 16, packed PCM 24, PCM 32 and IEEE float 32 are admitted. The source length is supplied by the owner so adjacent container data is never scanned.

Source

pub fn sample_rate(&self) -> u32

Source

pub fn channels(&self) -> u16

Source

pub fn format(&self) -> SampleFormat

Source

pub fn frames(&self) -> u64

Source

pub fn position_frames(&self) -> u64

Source

pub fn seek_frame(&mut self, frame: u64) -> Result<()>

Seek in whole frames, including the end-of-stream position.

Source

pub fn read_frames(&mut self, output: &mut [u8]) -> Result<usize>

Read whole frames into output; returns frames read. At EOF returns 0. An I/O failure poisons the reader so partial bytes cannot be replayed as a valid frame sequence. Caller may expose the filled bytes via AudioView.

Auto Trait Implementations§

§

impl<R> Freeze for WavStream<R>
where R: Freeze,

§

impl<R> RefUnwindSafe for WavStream<R>
where R: RefUnwindSafe,

§

impl<R> Send for WavStream<R>
where R: Send,

§

impl<R> Sync for WavStream<R>
where R: Sync,

§

impl<R> Unpin for WavStream<R>
where R: Unpin,

§

impl<R> UnsafeUnpin for WavStream<R>
where R: UnsafeUnpin,

§

impl<R> UnwindSafe for WavStream<R>
where R: 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.