Struct claxon::frame::FrameReader
[−]
[src]
pub struct FrameReader<R: Read, Sample: Sample> { // some fields omitted }
Reads frames from a stream and exposes decoded blocks as an iterator.
TODO: for now, it is assumes that the reader starts at a frame header; no searching for a sync code is performed at the moment.
Methods
impl<R: Read, Sample: Sample> FrameReader<R, Sample>
[src]
fn new(input: R) -> FrameReader<R, Sample>
Creates a new frame reader that will yield at least one element.
fn read_next_or_eof(&mut self, buffer: Vec<Sample>) -> FrameResult<Sample>
Tries to decode the next frame.
The buffer is moved into the returned block, so that the same buffer may
be reused to decode multiple blocks, avoiding a heap allocation every
time. It can be retrieved again with block.into_buffer()
. If the
buffer is not large enough to hold all samples, a larger buffer is
allocated automatically.
TODO: I should really be consistent with 'read' and 'decode'.