println!("usage: nihav-tool [-noout] [-vn] [-an] input [lastpts]");
return;
}
- let mut lastpts: Option<u64> = None;
+ let mut lastpts = NATimePoint::None;
let mut cur_arg: usize = 1;
let mut noout = false;
let mut decode_video = true;
let mut decode_audio = true;
let mut nmode = NumberMode::FrmPTS;
let mut smode = FrameSkipMode::None;
- let mut seek_time = 0u64;
+ let mut seek_time = NATimePoint::None;
let mut vpfx: Option<String> = None;
let mut apfx: Option<&str> = None;
let mut ignore_errors = false;
println!("seek time missing");
return;
}
- let ret = args[cur_arg].parse::<u64>();
+ let ret = args[cur_arg].parse::<NATimePoint>();
if ret.is_err() {
println!("wrong seek time");
return;
let name = args[cur_arg].as_str();
cur_arg += 1;
if cur_arg < args.len() {
- lastpts = Some(u64::from_str_radix(args[cur_arg].as_str(), 10).unwrap());
+ let ret = args[cur_arg].parse::<NATimePoint>();
+ if ret.is_err() {
+ println!("cannot parse end time");
+ return;
+ }
+ lastpts = ret.unwrap();
}
let path = Path::new(name);
br.seek(SeekFrom::Start(0)).unwrap();
let mut dmx = create_demuxer(dmx_fact, &mut br).unwrap();
- if seek_time > 0 {
+ if seek_time != NATimePoint::None {
let ret = dmx.seek(seek_time);
if ret.is_err() {
println!(" seek error {:?}", ret.err().unwrap());
};
}
},
- Err(DecoderError::MissingReference) if seek_time > 0 => {
+ Err(DecoderError::MissingReference) if seek_time != NATimePoint::None => {
println!("ignoring missing ref");
},
Err(reason) => {
}
},
};
- if pkt.get_pts() != None && lastpts.is_some() && pkt.get_pts() >= lastpts { break; }
+ if pkt.get_pts() != None && lastpts != NATimePoint::None && !pkt.ts.less_than(lastpts) { break; }
}
}
//panic!("end");