aboutsummaryrefslogtreecommitdiff
path: root/stream
diff options
context:
space:
mode:
Diffstat (limited to 'stream')
-rw-r--r--stream/src/segment.rs22
1 files changed, 5 insertions, 17 deletions
diff --git a/stream/src/segment.rs b/stream/src/segment.rs
index fdef01c..51674d7 100644
--- a/stream/src/segment.rs
+++ b/stream/src/segment.rs
@@ -6,7 +6,7 @@
use anyhow::{anyhow, bail, Result};
use jellybase::{AssetLocationExt, CONF};
use jellycommon::{stream::StreamSpec, LocalTrack, Node};
-use jellytranscoder::snippet::{transcode, Encoding};
+use jellytranscoder::snippet::transcode;
use log::warn;
use tokio::{fs::File, io::DuplexStream};
use tokio_util::io::SyncIoBridge;
@@ -23,16 +23,12 @@ pub async fn segment_stream(
let track = spec.tracks[0];
let n = spec.index.ok_or(anyhow!("segment index missing"))?;
- if let Some(width) = spec.width {
- let width = width_steps(width);
+ if let Some(profile) = spec.profile {
let location = transcode(
"",
- Encoding::Video {
- codec: "libsvtav1",
- preset: 8,
- bitrate: spec.bitrate.unwrap_or(2_000_000),
- width,
- },
+ CONF.transcoding_profiles
+ .get(profile)
+ .ok_or(anyhow!("profile out of range"))?,
move |b| {
tokio::task::spawn_blocking(move || {
if let Err(err) = jellyremuxer::write_snippet_into(
@@ -75,11 +71,3 @@ pub async fn segment_stream(
Ok(())
}
-
-fn width_steps(width: usize) -> usize {
- match width {
- x if x >= 3840 => 3840,
- x if x >= 1920 => 1920,
- _ => 720,
- }
-}