From: Kostya Shishkov Date: Thu, 11 Jun 2020 08:19:55 +0000 (+0200) Subject: add frame skipping mode X-Git-Url: https://git.nihav.org/?a=commitdiff_plain;h=69524874857bc441acc89c768e6cc7095f615a17;p=nihav-tool.git add frame skipping mode --- diff --git a/src/main.rs b/src/main.rs index 0892c43..1be4e2a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -83,6 +83,7 @@ fn main() { 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 vpfx: Option = None; let mut apfx: Option<&str> = None; @@ -98,6 +99,8 @@ fn main() { "-nm=count" => { nmode = NumberMode::Counter; }, "-nm=pktpts" => { nmode = NumberMode::PktPTS; }, "-nm=frmpts" => { nmode = NumberMode::FrmPTS; }, + "-skip=key" => { smode = FrameSkipMode::KeyframesOnly; }, + "-skip=intra" => { smode = FrameSkipMode::IntraOnly; }, "-seek" => { cur_arg += 1; if cur_arg == args.len() { @@ -171,6 +174,7 @@ println!(" seek error {:?}", ret.err().unwrap()); let mut decs: Vec, Box)>> = Vec::new(); let mut sids: Vec = Vec::new(); let mut writers: Vec = Vec::new(); + let dec_opts = [NAOption{name: FRAME_SKIP_OPTION, value: NAValue::String(smode.to_string())}]; for i in 0..dmx.get_num_streams() { let s = dmx.get_stream(i).unwrap(); let info = s.get_info(); @@ -188,6 +192,7 @@ println!("stream {} - {} {}", i, s, info.get_name()); let mut dec = (decfunc.unwrap())(); let mut dsupp = Box::new(NADecoderSupport::new()); dec.init(&mut dsupp, info).unwrap(); + dec.set_options(&dec_opts); decs.push(Some((dsupp, dec))); if !noout { writers.push(Outputter::Video(FrameOutput{prefix: if let Some(ref str) = vpfx { str.clone() } else { "out".to_string() }, streamno: i, frameno: 1, nmode}));