From ca3b31d75522be92eb588ab74b418e25d92e5be6 Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Sun, 12 Jul 2020 11:28:32 +0200 Subject: [PATCH] add an option to force timebase value --- src/main.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/main.rs b/src/main.rs index ac5a92c..de13de9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -185,6 +185,23 @@ impl Transcoder { } else if oval.len() == 2 { //todo parse encoder options, store, init later match oval[0] { + "timebase" => { + let mut parts = oval[1].split('/'); + let num = parts.next().unwrap(); + let den = parts.next(); + if let Some(den) = den { + let rnum = num.parse::(); + let rden = den.parse::(); + if let (Ok(num), Ok(den)) = (rnum, rden) { + ostr.enc_params.tb_num = num; + ostr.enc_params.tb_den = den; + } else { + println!("invalid timebase value"); + } + } else { + println!("invalid timebase format (should be num/den)"); + } + }, "encoder" => { if enc_reg.find_encoder(oval[1]).is_some() { ostr.enc_name = oval[1].to_string(); -- 2.39.5