aboutsummaryrefslogtreecommitdiff
path: root/stream/src
diff options
context:
space:
mode:
Diffstat (limited to 'stream/src')
-rw-r--r--stream/src/fragment.rs6
-rw-r--r--stream/src/hls.rs11
-rw-r--r--stream/src/jhls.rs7
-rw-r--r--stream/src/lib.rs12
-rw-r--r--stream/src/webvtt.rs9
5 files changed, 15 insertions, 30 deletions
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;