aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--server/src/routes/stream.rs8
-rw-r--r--stream/src/lib.rs3
-rw-r--r--transcoder/src/fragment.rs2
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?<spec>")]
+#[head("/n/<_id>/stream?<spec..>")]
pub async fn r_stream_head(
_sess: Session,
_id: &str,
- spec: StreamSpec,
+ spec: BTreeMap<String, String>,
) -> Result<Either<StreamResponse, Redirect>, 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<RequestRange>,
spec: BTreeMap<String, String>,
) -> Result<Either<StreamResponse, RedirectResponse>, 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<Vec<Range<(u64, u64)>>>;
/// 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,