Merge pull request #670 from jb-alvarado/master

fix #669
This commit is contained in:
jb-alvarado 2024-06-04 12:21:58 +00:00 committed by GitHub
commit 717b42521a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 100 additions and 17 deletions

74
Cargo.lock generated
View File

@ -855,7 +855,7 @@ version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8eebd66744a15ded14960ab4ccdbfb51ad3b81f51f3f04a80adac98c985396c9"
dependencies = [
"hashbrown",
"hashbrown 0.14.5",
"stacker",
]
@ -1098,7 +1098,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856"
dependencies = [
"cfg-if",
"hashbrown",
"hashbrown 0.14.5",
"lock_api",
"once_cell",
"parking_lot_core",
@ -1122,6 +1122,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4"
dependencies = [
"powerfmt",
"serde",
]
[[package]]
@ -1292,7 +1293,7 @@ checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a"
[[package]]
name = "ffplayout"
version = "0.23.0"
version = "0.23.1"
dependencies = [
"chrono",
"clap",
@ -1314,7 +1315,7 @@ dependencies = [
[[package]]
name = "ffplayout-api"
version = "0.23.0"
version = "0.23.1"
dependencies = [
"actix-files",
"actix-multipart",
@ -1358,7 +1359,7 @@ dependencies = [
[[package]]
name = "ffplayout-lib"
version = "0.23.0"
version = "0.23.1"
dependencies = [
"chrono",
"crossbeam-channel",
@ -1376,6 +1377,7 @@ dependencies = [
"reqwest",
"serde",
"serde_json",
"serde_with",
"shlex",
"signal-child",
"simplelog",
@ -1664,13 +1666,19 @@ dependencies = [
"futures-sink",
"futures-util",
"http 0.2.12",
"indexmap",
"indexmap 2.2.6",
"slab",
"tokio",
"tokio-util",
"tracing",
]
[[package]]
name = "hashbrown"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
[[package]]
name = "hashbrown"
version = "0.14.5"
@ -1687,7 +1695,7 @@ version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8094feaf31ff591f651a2664fb9cfd92bba7a60ce3197265e9482ebe753c8f7"
dependencies = [
"hashbrown",
"hashbrown 0.14.5",
]
[[package]]
@ -1908,6 +1916,17 @@ version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "206ca75c9c03ba3d4ace2460e57b189f39f43de612c2f85836e65c929701bb2d"
[[package]]
name = "indexmap"
version = "1.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99"
dependencies = [
"autocfg",
"hashbrown 0.12.3",
"serde",
]
[[package]]
name = "indexmap"
version = "2.2.6"
@ -1915,7 +1934,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26"
dependencies = [
"equivalent",
"hashbrown",
"hashbrown 0.14.5",
"serde",
]
[[package]]
@ -3057,7 +3077,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8de514ef58196f1fc96dcaef80fe6170a1ce6215df9687a93fe8300e773fefc5"
dependencies = [
"form_urlencoded",
"indexmap",
"indexmap 2.2.6",
"itoa",
"ryu",
"serde",
@ -3104,6 +3124,36 @@ dependencies = [
"serde",
]
[[package]]
name = "serde_with"
version = "3.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ad483d2ab0149d5a5ebcd9972a3852711e0153d863bf5a5d0391d28883c4a20"
dependencies = [
"base64 0.22.1",
"chrono",
"hex",
"indexmap 1.9.3",
"indexmap 2.2.6",
"serde",
"serde_derive",
"serde_json",
"serde_with_macros",
"time",
]
[[package]]
name = "serde_with_macros"
version = "3.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "65569b702f41443e8bc8bbb1c5779bd0450bbe723b56198980e80ec45780bce2"
dependencies = [
"darling",
"proc-macro2",
"quote",
"syn 2.0.63",
]
[[package]]
name = "serial_test"
version = "3.1.1"
@ -3311,7 +3361,7 @@ dependencies = [
"futures-util",
"hashlink",
"hex",
"indexmap",
"indexmap 2.2.6",
"log",
"memchr",
"once_cell",
@ -3589,7 +3639,7 @@ dependencies = [
[[package]]
name = "tests"
version = "0.23.0"
version = "0.23.1"
dependencies = [
"chrono",
"crossbeam-channel",
@ -3772,7 +3822,7 @@ version = "0.22.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3328d4f68a705b2a4498da1d580585d39a6510f98318a2cec3018a7ec61ddef"
dependencies = [
"indexmap",
"indexmap 2.2.6",
"serde",
"serde_spanned",
"toml_datetime",

View File

@ -4,7 +4,7 @@ default-members = ["ffplayout-api", "ffplayout-engine", "tests"]
resolver = "2"
[workspace.package]
version = "0.23.0"
version = "0.23.1"
license = "GPL-3.0"
repository = "https://github.com/ffplayout/ffplayout"
authors = ["Jonathan Baecker <jonbae77@gmail.com>"]

View File

@ -6,7 +6,7 @@ input_param = ""
# output_param get also applied to ingest instance.
output_param = ""
[filters]
[decoder.filters]
deinterlace = "" # yadif=0:-1:0
pad_scale_w = "" # scale={}:-1
pad_scale_h = "" # scale=-1:{}

View File

@ -45,7 +45,7 @@ depends = ""
recommends = "sudo"
suggests = "ffmpeg"
copyright = "Copyright (c) 2022, Jonathan Baecker. All rights reserved."
conf-files = ["/etc/ffplayout/ffplayout.toml"]
conf-files = ["/etc/ffplayout/ffplayout.toml", "/etc/ffplayout/advanced.toml"]
assets = [
[
"../target/x86_64-unknown-linux-musl/release/ffpapi",

View File

@ -25,6 +25,7 @@ regex = "1"
reqwest = { version = "0.12", default-features = false, features = ["blocking", "json", "rustls-tls"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
serde_with = "3.8"
shlex = "1.1"
simplelog = { version = "0.12", features = ["paris"] }
time = { version = "0.3", features = ["formatting", "macros"] }

View File

@ -1,6 +1,7 @@
use std::{fs::File, io::Read, path::PathBuf};
use serde::{Deserialize, Serialize};
use serde_with::{serde_as, NoneAsEmptyString};
use shlex::split;
#[derive(Debug, Default, Serialize, Deserialize, Clone)]
@ -10,9 +11,12 @@ pub struct AdvancedConfig {
pub ingest: IngestConfig,
}
#[serde_as]
#[derive(Debug, Default, Serialize, Deserialize, Clone)]
pub struct DecoderConfig {
#[serde_as(as = "NoneAsEmptyString")]
pub input_param: Option<String>,
#[serde_as(as = "NoneAsEmptyString")]
pub output_param: Option<String>,
pub filters: Filters,
#[serde(skip_serializing, skip_deserializing)]
@ -21,43 +25,70 @@ pub struct DecoderConfig {
pub output_cmd: Option<Vec<String>>,
}
#[serde_as]
#[derive(Debug, Default, Serialize, Deserialize, Clone)]
pub struct EncoderConfig {
#[serde_as(as = "NoneAsEmptyString")]
pub input_param: Option<String>,
#[serde(skip_serializing, skip_deserializing)]
pub input_cmd: Option<Vec<String>>,
}
#[serde_as]
#[derive(Debug, Default, Serialize, Deserialize, Clone)]
pub struct IngestConfig {
#[serde_as(as = "NoneAsEmptyString")]
pub input_param: Option<String>,
#[serde(skip_serializing, skip_deserializing)]
pub input_cmd: Option<Vec<String>>,
}
#[serde_as]
#[derive(Debug, Default, Serialize, Deserialize, Clone)]
pub struct Filters {
#[serde_as(as = "NoneAsEmptyString")]
pub deinterlace: Option<String>,
#[serde_as(as = "NoneAsEmptyString")]
pub pad_scale_w: Option<String>,
#[serde_as(as = "NoneAsEmptyString")]
pub pad_scale_h: Option<String>,
#[serde_as(as = "NoneAsEmptyString")]
pub pad_video: Option<String>,
#[serde_as(as = "NoneAsEmptyString")]
pub fps: Option<String>,
#[serde_as(as = "NoneAsEmptyString")]
pub scale: Option<String>,
#[serde_as(as = "NoneAsEmptyString")]
pub set_dar: Option<String>,
#[serde_as(as = "NoneAsEmptyString")]
pub fade_in: Option<String>,
#[serde_as(as = "NoneAsEmptyString")]
pub fade_out: Option<String>,
#[serde_as(as = "NoneAsEmptyString")]
pub overlay_logo_scale: Option<String>,
#[serde_as(as = "NoneAsEmptyString")]
pub overlay_logo_fade_in: Option<String>,
#[serde_as(as = "NoneAsEmptyString")]
pub overlay_logo_fade_out: Option<String>,
#[serde_as(as = "NoneAsEmptyString")]
pub overlay_logo: Option<String>,
#[serde_as(as = "NoneAsEmptyString")]
pub tpad: Option<String>,
#[serde_as(as = "NoneAsEmptyString")]
pub drawtext_from_file: Option<String>,
#[serde_as(as = "NoneAsEmptyString")]
pub drawtext_from_zmq: Option<String>,
#[serde_as(as = "NoneAsEmptyString")]
pub aevalsrc: Option<String>,
#[serde_as(as = "NoneAsEmptyString")]
pub afade_in: Option<String>,
#[serde_as(as = "NoneAsEmptyString")]
pub afade_out: Option<String>,
#[serde_as(as = "NoneAsEmptyString")]
pub apad: Option<String>,
#[serde_as(as = "NoneAsEmptyString")]
pub volume: Option<String>,
#[serde_as(as = "NoneAsEmptyString")]
pub split: Option<String>,
}
@ -72,8 +103,9 @@ impl AdvancedConfig {
eprintln!("Read advanced config file: {e}")
};
if let Ok(tm) = toml_edit::de::from_str(&contents) {
config = tm
match toml_edit::de::from_str(&contents) {
Ok(tm) => config = tm,
Err(e) => eprintln!("Serialize advanced config file: {e}"),
};
if let Some(input_parm) = &config.decoder.input_param {