Function mp4parse::read_box

source ยท
pub fn read_box<T: BufRead>(f: &mut T, context: &mut MediaContext) -> Result<()>
Expand description

Read the contents of a box, including sub boxes. Metadata is accumulated in the passed-through MediaContext struct.

Examples found in repository?
examples/dump.rs (line 15)
10
11
12
13
14
15
16
17
18
19
20
21
22
fn dump_file(filename: &String) {
    let file = File::open(filename).unwrap();
    let mut reader = BufReader::new(file);
    let mut context = mp4parse::MediaContext { tracks: Vec::new() };
    loop {
        match mp4parse::read_box(&mut reader, &mut context) {
            Ok(_) => {},
            Err(Error::UnexpectedEOF) => { break },
            Err(e) => { panic!(e); },
        }
    }
    println!("-- result of parsing '{}' --\n{}", filename, context);
}