From f4e11a989fbbf331db0740135b472ab656ce0845 Mon Sep 17 00:00:00 2001 From: jb-alvarado Date: Thu, 2 Feb 2023 12:52:10 +0100 Subject: [PATCH] check if audio_only on active --- lib/src/filter/mod.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/src/filter/mod.rs b/lib/src/filter/mod.rs index 9dad7a11..712e460c 100644 --- a/lib/src/filter/mod.rs +++ b/lib/src/filter/mod.rs @@ -45,7 +45,7 @@ pub struct Filters { pub audio_out_link: Vec, pub video_out_link: Vec, pub output_map: Vec, - audio_track_count: i32, + config: PlayoutConfig, audio_position: i32, video_position: i32, audio_last: i32, @@ -53,7 +53,7 @@ pub struct Filters { } impl Filters { - pub fn new(audio_track_count: i32, audio_position: i32) -> Self { + pub fn new(config: PlayoutConfig, audio_position: i32) -> Self { Self { audio_chain: String::new(), video_chain: String::new(), @@ -63,7 +63,7 @@ impl Filters { audio_out_link: vec![], video_out_link: vec![], output_map: vec![], - audio_track_count, + config, audio_position, video_position: 0, audio_last: -1, @@ -155,7 +155,7 @@ impl Filters { pub fn map(&mut self) -> Vec { let mut o_map = self.output_map.clone(); - if self.video_last == -1 && !self.video_chain.is_empty() { + if self.video_last == -1 && !self.config.processing.audio_only { let v_map = "0:v".to_string(); if !o_map.contains(&v_map) { @@ -164,7 +164,7 @@ impl Filters { } if self.audio_last == -1 { - for i in 0..self.audio_track_count { + for i in 0..self.config.processing.audio_tracks { let a_map = format!("{}:a:{i}", self.audio_position); if !o_map.contains(&a_map) { @@ -179,7 +179,7 @@ impl Filters { impl Default for Filters { fn default() -> Self { - Self::new(1, 0) + Self::new(PlayoutConfig::new(None), 0) } } @@ -513,7 +513,7 @@ pub fn filter_chains( node: &mut Media, filter_chain: &Option>>>, ) -> Filters { - let mut filters = Filters::new(config.processing.audio_tracks, 0); + let mut filters = Filters::new(config.clone(), 0); if node.unit == Encoder { if !config.processing.audio_only {