Struct caf::CafPacketReader [] [src]

pub struct CafPacketReader<T> where
    T: Read + Seek
{ pub audio_desc: AudioDescription, pub packet_table: Option<PacketTable>, pub chunks: Vec<CafChunk>, pub edit_count: u32, // some fields omitted }

High level Packet reading

Provides a very convenient iterator over the packets of the audio chunk.

Fields

The edit count value stored in the audio chunk.

Methods

impl<T> CafPacketReader<T> where
    T: Read + Seek
[src]

Creates a new CAF packet reader struct from a given reader.

With the filter_by argument you can pass a list of chunk types that are important for you. You shouldn't specify three chunk types though: AudioData, AudioDescription and PacketTable. These are implicitly retrieved, and you can extract the content through iterating over the packets (which are all small parts of the AudioData chunk), and through the audio_desc and packet_table members.

Equal to calling CafChunkReader::new and passing its result to from_chunk_reader.

Creates a new CAF packet reader struct from a given chunk reader.

With the filter_by argument you can pass a list of chunk types that are important for you. You shouldn't specify three chunk types though: AudioData, AudioDescription and PacketTable. These are implicitly retrieved, and you can extract the content through iterating over the packets (which are all small parts of the AudioData chunk), and through the audio_desc and packet_table members.

Returns whether the size of the packets doesn't change

Some formats have a constant, not changing packet size (mostly the uncompressed ones).

Returns the size of the next packet in bytes.

Returns None if all packets were read, Some(_) otherwise.

Very useful if you want to allocate the packet slice yourself.

Read one packet from the audio chunk

Returns Ok(Some(v)) if the next packet could be read successfully, Ok(None) if its the last chunk.

Read one packet from the audio chunk into a pre-allocated array

The method doesn't check whether the size of the passed slice matches the actual next packet length, it uses the length blindly. For correct operation, only use sizes returned from the next_packet_size function, and only if it didn't return None.

Gets the number of packets if its known.

Returns the index of the currently read packet

Seeks to the packet with the given index

This function never has been tested. If there are bugs please report them.