Struct Compressed Read Ahead
pub struct CompressedReadAhead { /* private fields */ }Expand description
Owned compressed worker pump. Prepare 1..65536 scratch frames and matching channel ring. No thread/clock/device is created. Decode/seek and destruction may allocate and must stay outside audio; only consumer pop is callback-safe. Pending decoded scratch retains unqueued suffixes under backpressure.
Implementations§
§impl CompressedReadAhead
impl CompressedReadAhead
pub fn new( reader: CompressedReader, producer: AudioProducer, maximum_frames: usize, ) -> Result<Self, AudioFileError>
pub fn sample_rate(&self) -> u32
pub fn channels(&self) -> u16
pub fn reader_position(&self) -> usize
pub fn reader_position(&self) -> usize
Includes pending/queued frames, rather than audible/sample-clock position.
pub fn pump(&mut self) -> Result<ReadAheadProgress, AudioFileError>
pub fn pump(&mut self) -> Result<ReadAheadProgress, AudioFileError>
At most one bounded stream read. Full rings retain remaining scratch and prevent another read until it is queued. EOF means verified stream end; pending/queued audio can still require playback. Decode faults poison the pump; queued earlier audio remains and cannot be rolled back.
pub fn seek_stopped(
&mut self,
consumer: &mut AudioConsumer,
frame: usize,
) -> Result<(), AudioFileError>
pub fn seek_stopped( &mut self, consumer: &mut AudioConsumer, frame: usize, ) -> Result<(), AudioFileError>
Reclaim both endpoints after stopping/joining users. Reject foreign queues or failed replay before changing pending/queued state. Success clears old generation audio and poison. Default readers replay O(target); indexed FLAC readers decode one indexed packet. Neither mode provides a live seek.