[−][src]Crate iffc
IFF is a binary-interchange format developed by Electronic Arts for tagging binary data with a meaning. This file is made of out of segments referred to as so called "chunks". This format is used for mainly storing multimedia, eg. audio: WAVE, video: AVI, midi: RMI, images: TIFF.
This crate provides data-structures and wrappers to manipulate this format quite easily by reading or writing into file-streams.
Decoding is done with iterators and Encoding is done with a fancy
operator: <<
shift left. Some basic syntax to work this library
is shown below.
Examples
To decode all the chunks avialable from the given reader:
use iffc::Decoder; fn main() { let inp = std::io::Cursor::new(b"RIFF\x04\x00\x00\x00WAVE"); let parser = Decoder(Box::new(inp)); for chk in inp { println!("{:?}: {}", chk.0, chk.1.len()); } }
To encode chunks into a given writer:
use iffc::{Encoder, Chunk}; fn main() { let out = std::io::Cursor::new(Vec::new()); let deparser = Encoder(Box::new(out)); deparser << Chunk(*b"RIFF", b"WAVE".to_vec()); }
Structs
Chunk | An IFF chunk represents a single segment of a complete IFF
file. Note: Even though this structure is capable of stroing
data upto |
Decoder | A structure which wraps a reader and parses IFF chunks and
behaves like an iterator which yields |
Encoder | A structure which wraps a writer and writes IFF chunks to it,
by using |