}
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
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);
}
}
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()) {
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()) {
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() {
}
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; },
}
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;