calculate fps from string, #183

This commit is contained in:
jb-alvarado 2022-08-30 11:17:35 +02:00
parent a83f81bef2
commit f3bf833dc9
3 changed files with 9 additions and 5 deletions

@ -1 +1 @@
Subproject commit ec78765c0bfbe583ff9b5cbdcd6d011ecb89ac62
Subproject commit cb20817330c5fd837eec1ae5716aa60f28f2b973

View File

@ -10,7 +10,7 @@ pub fn filter_node(config: &PlayoutConfig, add_tail: bool) -> String {
return logo_chain;
}
if let Some(fps) = config.processing.logo_fps.clone() {
if let Some(fps) = config.processing.logo_fps {
let opacity = format!(
"format=rgba,colorchannelmixer=aa={}",
config.processing.logo_opacity

View File

@ -91,7 +91,7 @@ pub struct Processing {
pub logo: String,
#[serde(skip_serializing, skip_deserializing)]
pub logo_fps: Option<String>,
pub logo_fps: Option<f64>,
pub logo_scale: String,
pub logo_opacity: f32,
@ -232,9 +232,13 @@ impl PlayoutConfig {
.video_streams
.get(0)
.and_then(|v| v.r_frame_rate.split_once('/'))
.map(|f| f.0)
.and_then(|f| {
f.0.parse::<f64>()
.ok()
.and_then(|x_num| f.1.parse::<f64>().ok().map(|y_num| x_num / y_num))
})
{
config.processing.logo_fps = Some(fps.to_string());
config.processing.logo_fps = Some(fps);
};
}