diff options
Diffstat (limited to 'common/src/config.rs')
-rw-r--r-- | common/src/config.rs | 61 |
1 files changed, 21 insertions, 40 deletions
diff --git a/common/src/config.rs b/common/src/config.rs index d7682df..a0dc459 100644 --- a/common/src/config.rs +++ b/common/src/config.rs @@ -4,7 +4,7 @@ Copyright (C) 2025 metamuffin <metamuffin.org> */ -use crate::{jhls::EncodingProfile, user::PermissionSet}; +use crate::user::PermissionSet; use serde::{Deserialize, Serialize}; use std::{collections::HashMap, path::PathBuf}; @@ -20,11 +20,30 @@ pub struct GlobalConfig { #[serde(default = "default::cache_path")] pub cache_path: PathBuf, #[serde(default = "default::media_path")] pub media_path: PathBuf, #[serde(default = "default::secrets_path")] pub secrets_path: PathBuf, - #[serde(default = "default::transcoding_profiles")] pub transcoding_profiles: Vec<EncodingProfile>, #[serde(default = "default::max_in_memory_cache_size")] pub max_in_memory_cache_size: usize, #[serde(default)] pub admin_username: Option<String>, #[serde(default = "default::login_expire")] pub login_expire: i64, #[serde(default)] pub default_permission_set: PermissionSet, + #[serde(default)] encoders: EncoderPreferences, +} + +#[derive(Debug, Deserialize, Serialize, Default)] +pub struct EncoderPreferences { + avc: Option<EncoderClass>, + hevc: Option<EncoderClass>, + vp8: Option<EncoderClass>, + vp9: Option<EncoderClass>, + av1: Option<EncoderClass>, +} + +#[derive(Debug, Deserialize, Serialize)] +enum EncoderClass { + Aom, + Svt, + X26n, + Vpx, + Vaapi, + Rkmpp, } #[derive(Serialize, Deserialize, Debug, Default)] @@ -59,7 +78,6 @@ pub struct ApiSecrets { } mod default { - use crate::jhls::EncodingProfile; use std::path::PathBuf; pub fn login_expire() -> i64 { @@ -83,43 +101,6 @@ mod default { pub fn max_in_memory_cache_size() -> usize { 50_000_000 } - pub fn transcoding_profiles() -> Vec<EncodingProfile> { - vec![ - EncodingProfile::Video { - codec: "libsvtav1".to_string(), - preset: Some(8), - bitrate: 2_000_000, - width: Some(1920), - }, - EncodingProfile::Video { - codec: "libsvtav1".to_string(), - preset: Some(8), - bitrate: 1_200_000, - width: Some(1280), - }, - EncodingProfile::Video { - codec: "libsvtav1".to_string(), - preset: Some(8), - bitrate: 300_000, - width: Some(640), - }, - EncodingProfile::Audio { - codec: "libopus".to_string(), - bitrate: 128_000, - sample_rate: None, - channels: Some(2), - }, - EncodingProfile::Audio { - codec: "libopus".to_string(), - bitrate: 64_000, - sample_rate: None, - channels: Some(2), - }, - EncodingProfile::Subtitles { - codec: "webvtt".to_string(), - }, - ] - } } fn return_true() -> bool { |