aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/demux.rs10
-rw-r--r--src/main.rs6
2 files changed, 10 insertions, 6 deletions
diff --git a/src/demux.rs b/src/demux.rs
index 56659c7..9c65b85 100644
--- a/src/demux.rs
+++ b/src/demux.rs
@@ -98,14 +98,14 @@ pub enum DemuxerObject<'a> {
}
impl<'a> DemuxerObject<'a> {
- pub fn create(br: &'a mut ByteReader<'a>, reg: &FullRegister, name: &str, force_dmx: Option<&str>, is_raw: bool) -> DemuxerObject<'a> {
+ pub fn create(br: &'a mut ByteReader<'a>, reg: &FullRegister, name: &str, force_dmx: Option<&str>, is_raw: bool, opts: &[NAOption]) -> DemuxerObject<'a> {
if !is_raw {
let res = detect::detect_format(name, br);
if let Some(dmx_name) = force_dmx {
println!("forcing demuxer {} on {}", dmx_name, name);
if let Some(dmx_fact) = reg.dmx_reg.find_demuxer(dmx_name) {
br.seek(SeekFrom::Start(0)).unwrap();
- let dmx = create_demuxer(dmx_fact, br).unwrap();
+ let dmx = create_demuxer_with_options(dmx_fact, br, opts).unwrap();
return DemuxerObject::Normal(dmx);
} else {
return DemuxerObject::None
@@ -116,7 +116,7 @@ impl<'a> DemuxerObject<'a> {
println!("trying demuxer {} on {}", dmx_name, name);
if let Some(dmx_fact) = reg.dmx_reg.find_demuxer(dmx_name) {
br.seek(SeekFrom::Start(0)).unwrap();
- let dmx = create_demuxer(dmx_fact, br).unwrap();
+ let dmx = create_demuxer_with_options(dmx_fact, br, opts).unwrap();
return DemuxerObject::Normal(dmx);
}
}
@@ -124,7 +124,7 @@ impl<'a> DemuxerObject<'a> {
println!("trying raw demuxer {} on {}", dmx_name, name);
if let Some(rdmx_fact) = reg.rdmx_reg.find_demuxer(dmx_name) {
br.seek(SeekFrom::Start(0)).unwrap();
- let dmx = create_raw_demuxer(rdmx_fact, br).unwrap();
+ let dmx = create_raw_demuxer_with_options(rdmx_fact, br, opts).unwrap();
let mut pkts = Vec::new();
for stream in dmx.get_streams() {
if let Some(pcreate) = reg.pkt_reg.find_packetiser(stream.get_info().get_name()) {
@@ -141,7 +141,7 @@ impl<'a> DemuxerObject<'a> {
if rdmx.check_format(br) {
println!("detected {} as {}", name, rdmx.get_name());
br.seek(SeekFrom::Start(0)).unwrap();
- let dmx = create_raw_demuxer(*rdmx, br).unwrap();
+ let dmx = create_raw_demuxer_with_options(*rdmx, br, opts).unwrap();
let mut pkts = Vec::new();
for stream in dmx.get_streams() {
if let Some(pcreate) = reg.pkt_reg.find_packetiser(stream.get_info().get_name()) {
diff --git a/src/main.rs b/src/main.rs
index 929ab6e..fcf6a56 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -105,6 +105,7 @@ fn main() {
let mut ignore_errors = false;
let mut dump_frames = false;
let mut force_dmx: Option<&str> = None;
+ let mut demux_opts: Vec<NAOption> = Vec::new();
while (cur_arg < args.len()) && args[cur_arg].starts_with('-') {
match args[cur_arg].as_str() {
@@ -154,6 +155,9 @@ fn main() {
}
force_dmx = Some(&args[cur_arg]);
},
+ "-print_mov_chunks" => {
+ demux_opts.push(NAOption{name: "print_chunks", value: NAValue::Bool(true) });
+ },
"-ignerr" => { ignore_errors = true; },
"-dumpfrm" => { dump_frames = true; },
_ => { println!("unknown option {}", args[cur_arg]); return; },
@@ -188,7 +192,7 @@ fn main() {
}
let mut br = ByteReader::new(nfr.as_mut());
let full_reg = FullRegister::new();
- let mut demuxer = DemuxerObject::create(&mut br, &full_reg, name, force_dmx, is_raw);
+ let mut demuxer = DemuxerObject::create(&mut br, &full_reg, name, force_dmx, is_raw, &demux_opts);
if demuxer.is_none() {
println!("No demuxer found!");
return;