aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKostya Shishkov <kostya.shishkov@gmail.com>2020-07-12 11:28:32 +0200
committerKostya Shishkov <kostya.shishkov@gmail.com>2020-07-12 11:28:32 +0200
commitca3b31d75522be92eb588ab74b418e25d92e5be6 (patch)
tree86d54ab2be6f6279d41ee6f5cc82a35143ab214d
parentd9fe2b7119e7c4326f6f940e2354f981a1a3156b (diff)
downloadnihav-encoder-ca3b31d75522be92eb588ab74b418e25d92e5be6.tar.gz
add an option to force timebase value
-rw-r--r--src/main.rs17
1 files changed, 17 insertions, 0 deletions
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::<u32>();
+ let rden = den.parse::<u32>();
+ 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();