Struct caf::CafChunkReader
[−]
[src]
pub struct CafChunkReader<T> where
T: Read, { /* fields omitted */ }
Methods
impl<T> CafChunkReader<T> where
T: Read,
[src]
T: Read,
fn new(rdr: T) -> Result<Self, CafError>
fn into_inner(self) -> T
Returns the reader that this Reader wraps
fn read_chunk(&mut self) -> Result<CafChunk, CafError>
fn read_chunk_body(
&mut self,
hdr: &CafChunkHeader
) -> Result<CafChunk, CafError>
&mut self,
hdr: &CafChunkHeader
) -> Result<CafChunk, CafError>
Reads a chunk body into memory and decodes it
fn read_chunk_header(&mut self) -> Result<CafChunkHeader, CafError>
Reads a chunk header
impl<T> CafChunkReader<T> where
T: Read + Seek,
[src]
T: Read + Seek,
fn to_next_chunk(&mut self, hdr: &CafChunkHeader) -> Result<(), CafError>
Seeks to the next chunk header in the file
It is meant to be called directly after a chunk header has been read, with the internal reader's position at the start of a chunk's body. It then seeks to the next chunk header.
With this function you can ignore chunks, not reading them, if they have uninteresting content, or if further knowledge on the file is needed before their content becomes interesting.
Panics if the header's chunk size is unspecified per spec (==-1). "Skipping" would make no sense here, as it will put you to the end of the file.
fn to_previous_chunk(&mut self, hdr: &CafChunkHeader) -> Result<(), CafError>
Seeks to the previous chunk header in the file
It is meant to be called with the internal reader's position at the end of a chunk's body. It then seeks to the start of that chunk body.
Panics if the header's chunk size is unspecified per spec (==-1). "Skipping" would make no sense here, as it will put you to the end of the file.
fn read_chunks_to_mem(
&mut self,
required: Vec<ChunkType>,
content_read: &[ChunkType]
) -> Result<(Vec<CafChunk>, Vec<CafChunkHeader>), CafError>
&mut self,
required: Vec<ChunkType>,
content_read: &[ChunkType]
) -> Result<(Vec<CafChunk>, Vec<CafChunkHeader>), CafError>
Read chunks from a whitelist to memory
Uses the given CafChunkReader
to read all chunks to memory
whose types are inside the content_read
slice.
Stops as soon as all chunk were encountered with types in the
required
argument list.
As we don't have support for reading chunks with unspecified length,
you shouldn't use this function to read audio data to memory.
Generally, reading the audio data chunk to memory is a bad idea
as it may possibly be very big. Instead, use the nice high level
CafPacketReader
struct.