diff options
| -rw-r--r-- | stream/src/fragment.rs | 1 | ||||
| -rw-r--r-- | stream/src/lib.rs | 1 | ||||
| -rw-r--r-- | transcoder/src/fragment.rs | 5 | ||||
| -rw-r--r-- | transcoder/src/lib.rs | 11 |
4 files changed, 6 insertions, 12 deletions
diff --git a/stream/src/fragment.rs b/stream/src/fragment.rs index 6902d77..62bb0b6 100644 --- a/stream/src/fragment.rs +++ b/stream/src/fragment.rs @@ -123,6 +123,7 @@ pub fn fragment_stream( if !format.remux { segment = transcode( &sinfo.cache, + &sinfo.config.transcoder, track.kind, &format!("{}-T{track_num}-I{index}", HashKey(media_path)), format, diff --git a/stream/src/lib.rs b/stream/src/lib.rs index 1407643..a94f4c7 100644 --- a/stream/src/lib.rs +++ b/stream/src/lib.rs @@ -37,6 +37,7 @@ pub struct Config { #[serde(default)] pub offer_vp8: bool, #[serde(default)] pub offer_vp9: bool, #[serde(default)] pub offer_av1: bool, + pub transcoder: jellytranscoder::Config, } pub struct SMediaInfo { diff --git a/transcoder/src/fragment.rs b/transcoder/src/fragment.rs index 6603afa..85abbd5 100644 --- a/transcoder/src/fragment.rs +++ b/transcoder/src/fragment.rs @@ -3,7 +3,7 @@ which is licensed under the GNU Affero General Public License (version 3); see /COPYING. Copyright (C) 2026 metamuffin <metamuffin.org> */ -use crate::{CONF, Config, LOCAL_VIDEO_TRANSCODING_TASKS}; +use crate::{Config, LOCAL_VIDEO_TRANSCODING_TASKS}; use anyhow::Result; use jellycache::{Cache, HashKey}; use jellyremuxer::{ContainerFormat, demuxers::create_demuxer, muxers::write_fragment}; @@ -22,6 +22,7 @@ use winter_matroska::{Cluster, Segment, TrackEntry as MatroskaTrackEntry, block: pub fn transcode( cache: &Cache, + config: &Config, kind: TrackKind, input_key: &str, output_format: &StreamFormatInfo, @@ -32,7 +33,7 @@ pub fn transcode( kind, &input.tracks.as_ref().unwrap().entries[0], output_format, - &CONF, + config, ) .unwrap(); diff --git a/transcoder/src/lib.rs b/transcoder/src/lib.rs index 50e445c..0b39b51 100644 --- a/transcoder/src/lib.rs +++ b/transcoder/src/lib.rs @@ -6,7 +6,7 @@ #![feature(exit_status_error)] use serde::{Deserialize, Serialize}; -use std::sync::{LazyLock, Mutex}; +use std::sync::Mutex; pub mod fragment; pub mod image; @@ -26,13 +26,4 @@ pub struct Config { pub x264_preset: Option<String>, } -pub static CONF_PRELOAD: Mutex<Option<Config>> = Mutex::new(None); -static CONF: LazyLock<Config> = LazyLock::new(|| { - CONF_PRELOAD - .lock() - .unwrap() - .take() - .expect("transcoder config not preloaded. logic error") -}); - static LOCAL_VIDEO_TRANSCODING_TASKS: Mutex<()> = Mutex::new(()); |