[][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, video, midi, images.

This crate provides data-structures and wrappers to manipulate this format quite easily by reading and decoding or writing and encoding from or into file-streams.


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::new(Box::new(inp));
    for chk in parser
    { 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::new(Box::new(out));
    deparser << Chunk(*b"RIFF", Box::new(*b"WAVE"));



An IFF chunk represents a single segment of a complete IFF file. Note: Even though this structure is capable of stroing data upto usize but IFF limits that to u32 only.


A structure which wraps a reader and parses IFF chunks and behaves like an iterator which yields IFFChunk until an entire-chunk can't be constructed.


A structure which wraps a writer and writes IFF chunks to it, by using << (shift-left) with an RHS of type IFFChunk, also that operand can be chained.