From: Kostya Shishkov Date: Sun, 12 Jul 2020 09:28:32 +0000 (+0200) Subject: add an option to force timebase value X-Git-Url: https://git.nihav.org/?p=nihav-encoder.git;a=commitdiff_plain;h=ca3b31d75522be92eb588ab74b418e25d92e5be6 add an option to force timebase value --- 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();