extern crate nihav_registry;
extern crate nihav_allstuff;
-use std::io::SeekFrom;
+use std::io::{SeekFrom, Write};
use std::fs::File;
use std::path::Path;
use nihav_core::io::byteio::{FileReader, ByteReader};
let mut vpfx: Option<String> = None;
let mut apfx: Option<&str> = None;
let mut ignore_errors = false;
+ let mut dump_frames = false;
while (cur_arg < args.len()) && args[cur_arg].starts_with('-') {
match args[cur_arg].as_str() {
vpfx = Some(args[cur_arg].clone());
},
"-ignerr" => { ignore_errors = true; },
+ "-dumpfrm" => { dump_frames = true; },
_ => { println!("unknown option {}", args[cur_arg]); return; },
}
cur_arg += 1;
}
}
+ let mut frmnum = 0;
loop {
let pktres = dmx.get_frame();
if let Err(e) = pktres {
let streamno = pkt.get_stream().get_id();
let sr = sids.iter().position(|x| *x == streamno);
let idx = sr.unwrap();
+ if dump_frames {
+ let name = format!("out{:02}_{:08}.frm", streamno, pkt.get_pts().unwrap_or(frmnum));
+ let mut ofile = File::create(name).unwrap();
+ ofile.write(pkt.get_buffer().as_slice()).unwrap();
+ frmnum += 1;
+ }
if let Some((ref mut dsupp, ref mut dec)) = decs[idx] {
match dec.decode(dsupp, &pkt) {
Ok(frm) => {