From 124536d703e1fe76bb05e188cf8b2d7c9957f28e Mon Sep 17 00:00:00 2001 From: Tangent 128 Date: Thu, 1 Jun 2017 02:29:12 -0400 Subject: [PATCH] Create dump tool for debugging/research --- src/bin/dump.rs | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/bin/dump.rs diff --git a/src/bin/dump.rs b/src/bin/dump.rs new file mode 100644 index 0000000..7ff1dba --- /dev/null +++ b/src/bin/dump.rs @@ -0,0 +1,29 @@ +extern crate lab_ebml; + +use std::env::args; +use std::fs::File; +use std::io::Read; +use std::path::Path; +use lab_ebml::{Schema, Webm}; +use lab_ebml::WebmElement::*; + +pub fn main() { + let mut args = args(); + let _ = args.next(); + let filename = args.next().expect("Reading filename"); + + let mut buffer = Vec::new(); + let mut file = File::open(Path::new(&filename)).expect("Opening file"); + + file.read_to_end(&mut buffer).expect("Reading file contents"); + + for element in Webm.parse(buffer.as_slice()) { + match element { + // suppress printing byte arrays + Tracks(slice) => println!("Tracks[{}]", slice.len()), + Cluster(slice) => println!("Cluster[{}]", slice.len()), + other => println!("{:?}", other) + } + } + +}