simplify code

This commit is contained in:
jb-alvarado 2022-10-25 10:52:02 +02:00
parent 31a4e10df1
commit d5356803d0
4 changed files with 11 additions and 12 deletions

View File

@ -94,7 +94,9 @@ pub fn ingest_server(
server_cmd.append(&mut filter.map());
}
server_cmd.append(&mut config.processing.settings.unwrap());
if let Some(mut cmd) = config.processing.cmd {
server_cmd.append(&mut cmd);
}
let mut is_running;

View File

@ -107,7 +107,9 @@ pub fn player(
dec_cmd.append(&mut filter.map());
}
dec_cmd.append(&mut config.processing.clone().settings.unwrap());
if let Some(mut cmd) = config.processing.cmd.clone() {
dec_cmd.append(&mut cmd);
}
debug!(
"Decoder CMD: <bright-blue>\"ffmpeg {}\"</>",

View File

@ -83,7 +83,7 @@ impl fmt::Display for TextFilter {
}
}
write!(f, "{}", s)
write!(f, "{s}")
}
}
@ -160,6 +160,7 @@ pub fn json_rpc_server(
&& map.contains_key("message")
{
let filter = filter_from_json(map["message"].clone());
debug!("Got drawtext command: <bright-blue>\"{filter}\"</>");
// TODO: in Rust 1.65 use let_chains instead
if !filter.is_empty() && config.text.zmq_stream_socket.is_some() {

View File

@ -164,7 +164,7 @@ pub struct Processing {
pub custom_filter: String,
#[serde(skip_serializing, skip_deserializing)]
pub settings: Option<Vec<String>>,
pub cmd: Option<Vec<String>>,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
@ -289,8 +289,7 @@ impl PlayoutConfig {
config.processing.audio_tracks = 1
}
// We set the decoder settings here, so we only define them ones.
let mut settings = vec_strings![
config.processing.cmd = Some(vec_strings![
"-pix_fmt",
"yuv420p",
"-r",
@ -300,10 +299,7 @@ impl PlayoutConfig {
"-g",
"1",
"-qscale:v",
"2"
];
settings.append(&mut vec_strings![
"2",
"-c:a",
"pcm_bluray",
"-mpegts_m2ts_mode",
@ -317,8 +313,6 @@ impl PlayoutConfig {
"-"
]);
config.processing.settings = Some(settings);
config.ingest.input_cmd = split(config.ingest.input_param.as_str());
config.out.output_count = 1;