aboutsummaryrefslogtreecommitdiff
path: root/transcoder/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'transcoder/src/lib.rs')
-rw-r--r--transcoder/src/lib.rs26
1 files changed, 25 insertions, 1 deletions
diff --git a/transcoder/src/lib.rs b/transcoder/src/lib.rs
index 1cf5d0d..c49f52c 100644
--- a/transcoder/src/lib.rs
+++ b/transcoder/src/lib.rs
@@ -5,11 +5,35 @@
*/
#![feature(exit_status_error)]
-use tokio::sync::Semaphore;
+use serde::{Deserialize, Serialize};
+use std::sync::LazyLock;
+use tokio::sync::{Mutex, Semaphore};
+
pub mod fragment;
pub mod image;
pub mod subtitles;
pub mod thumbnail;
+#[rustfmt::skip]
+#[derive(Debug, Deserialize, Serialize, Default)]
+pub struct Config {
+ #[serde(default)] pub enable_rkmpp: bool,
+ #[serde(default)] pub enable_rkrga: bool,
+ #[serde(default)] pub use_svtav1: bool,
+ #[serde(default)] pub use_rav1e: bool,
+ pub svtav1_preset: Option<u8>, // 0..=13, high is fast
+ pub rav1e_preset: Option<u8>, // 0..=10
+ pub aom_preset: Option<u8>, // 0..=8, high is fast
+ pub x264_preset: Option<String>,
+}
+
+static CONF: LazyLock<Config> = LazyLock::new(|| {
+ CONF_PRELOAD
+ .blocking_lock()
+ .take()
+ .expect("cache config not preloaded. logic error")
+});
+static CONF_PRELOAD: Mutex<Option<Config>> = Mutex::const_new(None);
+
static LOCAL_IMAGE_TRANSCODING_TASKS: Semaphore = Semaphore::const_new(8);
static LOCAL_VIDEO_TRANSCODING_TASKS: Semaphore = Semaphore::const_new(2);