diff options
author | metamuffin <metamuffin@disroot.org> | 2025-01-29 16:07:58 +0100 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2025-01-29 16:07:58 +0100 |
commit | e7ba3274e27fad755f15465581f5b403c82ab4d2 (patch) | |
tree | f2d693c61786ee6ed027636393fd75f086bd77e8 /stream | |
parent | 5ac3f397b4a28b7bf8b399e73ad0d29e3da45ab0 (diff) | |
download | jellything-e7ba3274e27fad755f15465581f5b403c82ab4d2.tar jellything-e7ba3274e27fad755f15465581f5b403c82ab4d2.tar.bz2 jellything-e7ba3274e27fad755f15465581f5b403c82ab4d2.tar.zst |
prepare database refactor
Diffstat (limited to 'stream')
-rw-r--r-- | stream/Cargo.toml | 6 | ||||
-rw-r--r-- | stream/src/fragment.rs | 6 | ||||
-rw-r--r-- | stream/src/hls.rs | 11 | ||||
-rw-r--r-- | stream/src/jhls.rs | 7 | ||||
-rw-r--r-- | stream/src/lib.rs | 12 | ||||
-rw-r--r-- | stream/src/webvtt.rs | 9 |
6 files changed, 18 insertions, 33 deletions
diff --git a/stream/Cargo.toml b/stream/Cargo.toml index d476044..b66cfca 100644 --- a/stream/Cargo.toml +++ b/stream/Cargo.toml @@ -11,6 +11,6 @@ jellyremuxer = { path = "../remuxer" } log = { workspace = true } anyhow = { workspace = true } -tokio = { version = "1.41.0", features = ["io-util"] } -tokio-util = { version = "0.7.12", features = ["io", "io-util"] } -serde_json = "1.0.132" +tokio = { version = "1.43.0", features = ["io-util"] } +tokio-util = { version = "0.7.13", features = ["io", "io-util"] } +serde_json = "1.0.138" diff --git a/stream/src/fragment.rs b/stream/src/fragment.rs index 1082e1c..4b4fd44 100644 --- a/stream/src/fragment.rs +++ b/stream/src/fragment.rs @@ -36,7 +36,7 @@ pub async fn fragment_stream( if let Some(profile) = spec.profile { perms.assert(&UserPermission::Transcode)?; let location = transcode( - &format!("{track} {n} {:?}", node.private.source), // TODO maybe not use the entire source + &format!("{track} {n} {:?}", node), // TODO maybe not use the entire source CONF.transcoding_profiles .get(profile) .ok_or(anyhow!("profile out of range"))?, @@ -45,7 +45,7 @@ pub async fn fragment_stream( if let Err(err) = jellyremuxer::write_fragment_into( SyncIoBridge::new(b), &CONF.media_path, - &node.public, + &node, &local_track, track, false, @@ -69,7 +69,7 @@ pub async fn fragment_stream( if let Err(err) = jellyremuxer::write_fragment_into( b, &CONF.media_path, - &node.public, + &node, &local_track, track, spec.webm.unwrap_or(false), diff --git a/stream/src/hls.rs b/stream/src/hls.rs index 342cbde..894d1b6 100644 --- a/stream/src/hls.rs +++ b/stream/src/hls.rs @@ -22,7 +22,7 @@ pub async fn hls_master_stream( _spec: StreamSpec, mut b: DuplexStream, ) -> Result<()> { - let media = node.public.media.as_ref().ok_or(anyhow!("no media"))?; + let media = node.media.as_ref().ok_or(anyhow!("no media"))?; let mut out = String::new(); writeln!(out, "#EXTM3U")?; writeln!(out, "#EXT-X-VERSION:4")?; @@ -57,14 +57,9 @@ pub async fn hls_variant_stream( ) -> Result<()> { let local_track = local_tracks.first().ok_or(anyhow!("no track"))?.to_owned(); let track_index = spec.track[0]; - let media_info = node.public.media.to_owned().ok_or(anyhow!("no media?"))?; + let media_info = node.media.to_owned().ok_or(anyhow!("no media?"))?; let frags = spawn_blocking(move || { - jellyremuxer::fragment::fragment_index( - &CONF.media_path, - &node.public, - &local_track, - track_index, - ) + jellyremuxer::fragment::fragment_index(&CONF.media_path, &node, &local_track, track_index) }) .await??; diff --git a/stream/src/jhls.rs b/stream/src/jhls.rs index 2e45378..ea5cbfc 100644 --- a/stream/src/jhls.rs +++ b/stream/src/jhls.rs @@ -26,12 +26,7 @@ pub async fn jhls_index( .to_owned(); let segments = tokio::task::spawn_blocking(move || { - jellyremuxer::fragment::fragment_index( - &CONF.media_path, - &node.public, - &local_track, - spec.track[0], - ) + jellyremuxer::fragment::fragment_index(&CONF.media_path, &node, &local_track, spec.track[0]) }) .await??; diff --git a/stream/src/lib.rs b/stream/src/lib.rs index a316042..f4cbbf6 100644 --- a/stream/src/lib.rs +++ b/stream/src/lib.rs @@ -57,20 +57,18 @@ pub async fn stream( let (a, b) = duplex(4096); // TODO remux of mixed remote and local tracks?! - let track_sources = node - .private - .source - .to_owned() - .ok_or(anyhow!("node has no media"))?; + let track_sources = node.media.to_owned().ok_or(anyhow!("node has no media"))?; let local_tracks = spec .track .iter() .map(|i| { anyhow::Ok( - match track_sources + match &track_sources + .tracks .get(*i) .ok_or(anyhow!("track does not exist"))? + .source { TrackSource::Local(t) => t.to_owned(), TrackSource::Remote(_) => bail!("track is not local"), @@ -109,7 +107,7 @@ async fn remux_stream( b, range, CONF.media_path.to_owned(), - node.public, + &node, local_tracks, spec.track, spec.webm.unwrap_or(false), diff --git a/stream/src/webvtt.rs b/stream/src/webvtt.rs index 316e224..d5b2f9a 100644 --- a/stream/src/webvtt.rs +++ b/stream/src/webvtt.rs @@ -23,7 +23,7 @@ pub async fn vtt_stream( let tracki = *spec.track.first().ok_or(anyhow!("no track selected"))?; let local_track = local_tracks.first().ok_or(anyhow!("no tracks"))?.clone(); - let track = &node.public.media.unwrap().tracks[tracki]; + let track = &node.media.unwrap().tracks[tracki]; let cp = local_track.codec_private.clone(); let subtitles = async_cache_memory( @@ -49,11 +49,8 @@ pub async fn vtt_stream( let output = if json { serde_json::to_string(subtitles.as_ref())? } else { - write_webvtt( - node.public.title.clone().unwrap_or_default(), - subtitles.as_ref(), - ) - .context("writing webvtt")? + write_webvtt(node.title.clone().unwrap_or_default(), subtitles.as_ref()) + .context("writing webvtt")? }; tokio::task::spawn(async move { let _ = b.write_all(output.as_bytes()).await; |