}
impl<'a> DemuxerObject<'a> {
- pub fn create(br: &'a mut ByteReader<'a>, reg: &FullRegister, name: &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) -> 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();
+ return DemuxerObject::Normal(dmx);
+ } else {
+ return DemuxerObject::None
+ }
+ }
let (dmx_name, _) = res.unwrap_or(("", detect::DetectionScore::No));
if dmx_name != "" {
println!("trying demuxer {} on {}", dmx_name, name);
let mut apfx: Option<&str> = None;
let mut ignore_errors = false;
let mut dump_frames = false;
+ let mut force_dmx: Option<&str> = None;
while (cur_arg < args.len()) && args[cur_arg].starts_with('-') {
match args[cur_arg].as_str() {
}
vpfx = Some(args[cur_arg].clone());
},
+ "-demuxer" => {
+ cur_arg += 1;
+ if cur_arg == args.len() {
+ println!("name missing");
+ return;
+ }
+ force_dmx = Some(&args[cur_arg]);
+ },
"-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, is_raw);
+ let mut demuxer = DemuxerObject::create(&mut br, &full_reg, name, force_dmx, is_raw);
if demuxer.is_none() {
println!("No demuxer found!");
return;