From 80343d02e9e29e4bc55d790b491ce0d0c7bff201 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Mon, 3 Mar 2025 16:58:59 +0100 Subject: a --- server/src/routes/stream.rs | 8 +++++--- stream/src/lib.rs | 3 ++- transcoder/src/fragment.rs | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/server/src/routes/stream.rs b/server/src/routes/stream.rs index d65b346..4b3d02e 100644 --- a/server/src/routes/stream.rs +++ b/server/src/routes/stream.rs @@ -28,12 +28,13 @@ use std::{ }; use tokio::io::{duplex, DuplexStream}; -#[head("/n/<_id>/stream?")] +#[head("/n/<_id>/stream?")] pub async fn r_stream_head( _sess: Session, _id: &str, - spec: StreamSpec, + spec: BTreeMap, ) -> Result, MyError> { + let spec = StreamSpec::from_query_kv(&spec).map_err(|x| anyhow!("spec invalid: {x}"))?; let head = jellystream::stream_head(&spec); Ok(Either::Left(StreamResponse { stream: duplex(0).0, @@ -52,6 +53,7 @@ pub async fn r_stream( range: Option, spec: BTreeMap, ) -> Result, MyError> { + let spec = StreamSpec::from_query_kv(&spec).map_err(|x| anyhow!("spec invalid: {x}"))?; // TODO perm let node = db .get_node_slug(id)? @@ -129,7 +131,7 @@ pub async fn r_stream( let head = jellystream::stream_head(&spec); - match jellystream::stream(media, spec, urange, &session.user.permissions).await { + match jellystream::stream(media, spec, urange).await { Ok(stream) => Ok(Either::Left(StreamResponse { stream, range, diff --git a/stream/src/lib.rs b/stream/src/lib.rs index 68b7e44..1f32239 100644 --- a/stream/src/lib.rs +++ b/stream/src/lib.rs @@ -148,8 +148,9 @@ async fn copy_stream(mut inp: File, mut out: DuplexStream, mut amount: usize) -> // TODO functions to test seekability, get live status and enumate segments trait MediaSource { + fn loaded_ranges(&self) -> Result>>; /// Seeks to some position close to, but before, `time` ticks. - fn seek(&mut self, time: u64) -> Result<()>; + fn seek(&mut self, segment: u64, time: u64) -> Result<()>; /// Retrieve headers (info and tracks) for some segment. fn segment_headers(&mut self, seg: u64) -> Result<(Info, Tracks)>; /// Returns the next block and the current segment index diff --git a/transcoder/src/fragment.rs b/transcoder/src/fragment.rs index 8822fa2..ff6a9db 100644 --- a/transcoder/src/fragment.rs +++ b/transcoder/src/fragment.rs @@ -17,7 +17,7 @@ use tokio::{ }; // TODO odd video resolutions can cause errors when transcoding to YUV42{0,2} -// TODO with an implementation that cant handle it (SVT-AV1 such an impl). +// TODO with an implementation that cant handle it (SVT-AV1 is such an impl). pub async fn transcode( key: &str, -- cgit v1.2.3-70-g09d2