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>
impl<R: Read + Seek> WavStream<R>
Sourcepub fn open(reader: R, source_len: u64) -> Result<Self>
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.
pub fn sample_rate(&self) -> u32
pub fn channels(&self) -> u16
pub fn format(&self) -> SampleFormat
pub fn frames(&self) -> u64
pub fn position_frames(&self) -> u64
Sourcepub fn seek_frame(&mut self, frame: u64) -> Result<()>
pub fn seek_frame(&mut self, frame: u64) -> Result<()>
Seek in whole frames, including the end-of-stream position.
Sourcepub fn read_frames(&mut self, output: &mut [u8]) -> Result<usize>
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.