#parser #riff #chunk #iff

iffc

IFF chunk encoder and decoder

3 releases

0.1.2 May 17, 2020
0.1.1 May 17, 2020
0.1.0 May 16, 2020

#324 in Multimedia

ISC license

5KB

iffc

Electronic Arts IFF chunk and decoder similar to Python's chunks module. This library can be used to read or write to some formats that use the derivative of this format (eg. WAVE, RMI, AVI, TIFF) using file-streams.



lib.rs:

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.

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::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"));
}

No runtime deps