aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2025-04-14 14:33:52 +0200
committermetamuffin <metamuffin@disroot.org>2025-04-14 14:33:52 +0200
commit4a36d9e96853bf04d17f8377a7fbf862d108b9f1 (patch)
tree525ace312985400eb36ad942b52bb5505f30944f /common
parent92b119f95dd1cb24054f2440533208c140b66e46 (diff)
downloadjellything-4a36d9e96853bf04d17f8377a7fbf862d108b9f1.tar
jellything-4a36d9e96853bf04d17f8377a7fbf862d108b9f1.tar.bz2
jellything-4a36d9e96853bf04d17f8377a7fbf862d108b9f1.tar.zst
start transcoding refactor
Diffstat (limited to 'common')
-rw-r--r--common/src/config.rs61
-rw-r--r--common/src/jhls.rs27
-rw-r--r--common/src/stream.rs3
3 files changed, 23 insertions, 68 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 {
diff --git a/common/src/jhls.rs b/common/src/jhls.rs
index 6dc976b..90f48f5 100644
--- a/common/src/jhls.rs
+++ b/common/src/jhls.rs
@@ -5,33 +5,6 @@
*/
use bincode::{Decode, Encode};
use serde::{Deserialize, Serialize};
-use std::ops::Range;
-
-#[derive(Debug, Clone, Deserialize, Serialize)]
-pub struct JhlsTrackIndex {
- pub extra_profiles: Vec<EncodingProfile>,
- pub fragments: Vec<Range<f64>>,
-}
-
-#[derive(Debug, Clone, Deserialize, Serialize)]
-#[serde(rename_all = "snake_case")]
-pub enum EncodingProfile {
- Video {
- codec: String,
- preset: Option<u8>,
- bitrate: usize,
- width: Option<usize>,
- },
- Audio {
- codec: String,
- bitrate: usize,
- channels: Option<usize>,
- sample_rate: Option<f64>,
- },
- Subtitles {
- codec: String,
- },
-}
#[derive(Debug, Serialize, Deserialize, Encode, Decode)]
pub struct SubtitleCue {
diff --git a/common/src/stream.rs b/common/src/stream.rs
index 75349cc..a14fd57 100644
--- a/common/src/stream.rs
+++ b/common/src/stream.rs
@@ -91,7 +91,8 @@ pub struct StreamFormatInfo {
pub remux: bool,
pub containers: Vec<StreamContainer>,
- pub pixel_count: Option<u64>,
+ pub width: Option<u64>,
+ pub height: Option<u64>,
pub samplerate: Option<f64>,
pub channels: Option<usize>,
pub bit_depth: Option<u8>,