projects
/
nihav-tool.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
2e4688a
)
allow dumping raw frames
author
Kostya Shishkov
<kostya.shishkov@gmail.com>
Fri, 1 May 2020 15:17:10 +0000
(17:17 +0200)
committer
Kostya Shishkov
<kostya.shishkov@gmail.com>
Fri, 1 May 2020 15:17:10 +0000
(17:17 +0200)
src/main.rs
patch
|
blob
|
blame
|
history
diff --git
a/src/main.rs
b/src/main.rs
index bb94c1218432969bcebead768e75deb3fbaa6b68..59c18788c78ff3a8b7485fd71478eae3c4584e75 100644
(file)
--- a/
src/main.rs
+++ b/
src/main.rs
@@
-2,7
+2,7
@@
extern crate nihav_core;
extern crate nihav_registry;
extern crate nihav_allstuff;
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};
use std::fs::File;
use std::path::Path;
use nihav_core::io::byteio::{FileReader, ByteReader};
@@
-95,6
+95,7
@@
fn main() {
let mut vpfx: Option<String> = None;
let mut apfx: Option<&str> = None;
let mut ignore_errors = false;
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() {
while (cur_arg < args.len()) && args[cur_arg].starts_with('-') {
match args[cur_arg].as_str() {
@@
-135,6
+136,7
@@
fn main() {
vpfx = Some(args[cur_arg].clone());
},
"-ignerr" => { ignore_errors = true; },
vpfx = Some(args[cur_arg].clone());
},
"-ignerr" => { ignore_errors = true; },
+ "-dumpfrm" => { dump_frames = true; },
_ => { println!("unknown option {}", args[cur_arg]); return; },
}
cur_arg += 1;
_ => { println!("unknown option {}", args[cur_arg]); return; },
}
cur_arg += 1;
@@
-233,6
+235,7
@@
panic!("decoder {} not found", info.get_name());
}
}
}
}
+ let mut frmnum = 0;
loop {
let pktres = dmx.get_frame();
if let Err(e) = pktres {
loop {
let pktres = dmx.get_frame();
if let Err(e) = pktres {
@@
-242,6
+245,12
@@
panic!("decoder {} not found", info.get_name());
let streamno = pkt.get_stream().get_id();
let sr = sids.iter().position(|x| *x == streamno);
let idx = sr.unwrap();
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) => {
if let Some((ref mut dsupp, ref mut dec)) = decs[idx] {
match dec.decode(dsupp, &pkt) {
Ok(frm) => {