diff options
author | metamuffin <metamuffin@disroot.org> | 2025-04-27 20:00:44 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2025-04-27 20:00:44 +0200 |
commit | 335ba978dbaf203f3603a815147fd75dbf205723 (patch) | |
tree | 57f7959b6f81ad469ddd3062f2e43f88670a08e4 /transcoder/src/lib.rs | |
parent | 11a585b3dbe620dcc8772e713b22f1d9ba80d598 (diff) | |
download | jellything-335ba978dbaf203f3603a815147fd75dbf205723.tar jellything-335ba978dbaf203f3603a815147fd75dbf205723.tar.bz2 jellything-335ba978dbaf203f3603a815147fd75dbf205723.tar.zst |
move cache to own crate
Diffstat (limited to 'transcoder/src/lib.rs')
-rw-r--r-- | transcoder/src/lib.rs | 26 |
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); |