aboutsummaryrefslogtreecommitdiff
path: root/stream/src
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2024-01-29 13:22:21 +0100
committermetamuffin <metamuffin@disroot.org>2024-01-29 13:22:21 +0100
commit2676e755286d117b100d379fce84ec3da6d8ae98 (patch)
tree2a075db5468f0c8c2f653be5222c183f4362fcfa /stream/src
parenta4526fd2eb670c8fac2c28eb1597f0c091f25a2a (diff)
downloadjellything-2676e755286d117b100d379fce84ec3da6d8ae98.tar
jellything-2676e755286d117b100d379fce84ec3da6d8ae98.tar.bz2
jellything-2676e755286d117b100d379fce84ec3da6d8ae98.tar.zst
consistent name for {snippet,segment?,fragment}
Diffstat (limited to 'stream/src')
-rw-r--r--stream/src/fragment.rs (renamed from stream/src/segment.rs)8
-rw-r--r--stream/src/hls.rs8
-rw-r--r--stream/src/jhls.rs2
-rw-r--r--stream/src/lib.rs8
-rw-r--r--stream/src/webvtt.rs2
5 files changed, 14 insertions, 14 deletions
diff --git a/stream/src/segment.rs b/stream/src/fragment.rs
index a5162cd..f08114c 100644
--- a/stream/src/segment.rs
+++ b/stream/src/fragment.rs
@@ -10,12 +10,12 @@ use jellycommon::{
user::{PermissionSet, UserPermission},
LocalTrack, Node,
};
-use jellytranscoder::snippet::transcode;
+use jellytranscoder::fragment::transcode;
use log::warn;
use tokio::{fs::File, io::DuplexStream};
use tokio_util::io::SyncIoBridge;
-pub async fn segment_stream(
+pub async fn fragment_stream(
node: Node,
local_tracks: Vec<LocalTrack>,
spec: StreamSpec,
@@ -42,7 +42,7 @@ pub async fn segment_stream(
.ok_or(anyhow!("profile out of range"))?,
move |b| {
tokio::task::spawn_blocking(move || {
- if let Err(err) = jellyremuxer::write_snippet_into(
+ if let Err(err) = jellyremuxer::write_fragment_into(
SyncIoBridge::new(b),
&CONF.media_path,
&node.public,
@@ -66,7 +66,7 @@ pub async fn segment_stream(
} else {
let b = SyncIoBridge::new(b);
tokio::task::spawn_blocking(move || {
- if let Err(err) = jellyremuxer::write_snippet_into(
+ if let Err(err) = jellyremuxer::write_fragment_into(
b,
&CONF.media_path,
&node.public,
diff --git a/stream/src/hls.rs b/stream/src/hls.rs
index 310c6b1..7f69d2c 100644
--- a/stream/src/hls.rs
+++ b/stream/src/hls.rs
@@ -53,8 +53,8 @@ pub async fn hls_variant_stream(
let local_track = local_tracks.get(0).ok_or(anyhow!("no track"))?.to_owned();
let track_index = spec.tracks[0];
let media_info = node.public.media.to_owned().ok_or(anyhow!("no media?"))?;
- let snips = spawn_blocking(move || {
- jellyremuxer::snippet::snippet_index(
+ let frags = spawn_blocking(move || {
+ jellyremuxer::fragment::fragment_index(
&CONF.media_path,
&node.public,
&local_track,
@@ -70,8 +70,8 @@ pub async fn hls_variant_stream(
writeln!(out, "#EXT-X-VERSION:4")?;
writeln!(out, "#EXT-X-MEDIA-SEQUENCE:0")?;
- spec.format = StreamFormat::Snippet;
- for (i, Range { start, end }) in snips.iter().enumerate() {
+ spec.format = StreamFormat::Fragment;
+ for (i, Range { start, end }) in frags.iter().enumerate() {
writeln!(out, "#EXTINF:{:},", end - start)?;
spec.index = Some(i);
writeln!(out, "stream?{}", spec.to_query())?;
diff --git a/stream/src/jhls.rs b/stream/src/jhls.rs
index e26df1b..1313c7a 100644
--- a/stream/src/jhls.rs
+++ b/stream/src/jhls.rs
@@ -26,7 +26,7 @@ pub async fn jhls_index(
.to_owned();
let segments = tokio::task::spawn_blocking(move || {
- jellyremuxer::snippet::snippet_index(
+ jellyremuxer::fragment::fragment_index(
&CONF.media_path,
&node.public,
&local_track,
diff --git a/stream/src/lib.rs b/stream/src/lib.rs
index 906e638..4d96f8c 100644
--- a/stream/src/lib.rs
+++ b/stream/src/lib.rs
@@ -6,7 +6,7 @@
#![feature(iterator_try_collect)]
pub mod hls;
pub mod jhls;
-pub mod segment;
+pub mod fragment;
pub mod webvtt;
use anyhow::{anyhow, bail, Context, Result};
@@ -18,7 +18,7 @@ use jellycommon::{
LocalTrack, Node, TrackSource,
};
use jhls::jhls_index;
-use segment::segment_stream;
+use fragment::fragment_stream;
use std::{io::SeekFrom, ops::Range};
use tokio::{
fs::File,
@@ -41,7 +41,7 @@ pub fn stream_head(spec: &StreamSpec) -> StreamHead {
StreamFormat::HlsMaster | StreamFormat::HlsVariant => StreamHead { content_type: "application/vnd.apple.mpegurl", range_supported: false },
StreamFormat::JhlsIndex => StreamHead { content_type: "application/jellything-seekindex+json", range_supported: false },
StreamFormat::Webvtt => StreamHead { content_type: "text/vtt", range_supported: false },
- StreamFormat::Snippet => StreamHead { content_type: webm_or_mkv, range_supported: false },
+ StreamFormat::Fragment => StreamHead { content_type: webm_or_mkv, range_supported: false },
StreamFormat::Jvtt => StreamHead { content_type: "application/jellything-vtt+json", range_supported: false },
}
}
@@ -87,7 +87,7 @@ pub async fn stream(
StreamFormat::HlsMaster => hls_master_stream(node, local_tracks, spec, b).await?,
StreamFormat::HlsVariant => hls_variant_stream(node, local_tracks, spec, b).await?,
StreamFormat::JhlsIndex => jhls_index(node, &local_tracks, spec, b, perms).await?,
- StreamFormat::Snippet => segment_stream(node, local_tracks, spec, b, perms).await?,
+ StreamFormat::Fragment => fragment_stream(node, local_tracks, spec, b, perms).await?,
StreamFormat::Webvtt => vtt_stream(false, node, local_tracks, spec, b).await?,
StreamFormat::Jvtt => vtt_stream(true, node, local_tracks, spec, b).await?,
}
diff --git a/stream/src/webvtt.rs b/stream/src/webvtt.rs
index 3c9ec41..ec26398 100644
--- a/stream/src/webvtt.rs
+++ b/stream/src/webvtt.rs
@@ -19,7 +19,7 @@ pub async fn vtt_stream(
) -> Result<()> {
// TODO cache
- // TODO should use snippets too? big films take too long...
+ // TODO should use fragments too? big films take too long...
let tracki = *spec.tracks.get(0).ok_or(anyhow!("no track selected"))?;
let local_track = local_tracks.get(0).ok_or(anyhow!("no tracks"))?.clone();