diff options
Diffstat (limited to 'stream/src/lib.rs')
-rw-r--r-- | stream/src/lib.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/stream/src/lib.rs b/stream/src/lib.rs index 726f1e8..be1ff32 100644 --- a/stream/src/lib.rs +++ b/stream/src/lib.rs @@ -7,12 +7,13 @@ pub mod hls; pub mod segment; use anyhow::{anyhow, bail, Context, Result}; +use hls::{hls_master_stream, hls_variant_stream}; use jellybase::CONF; use jellycommon::{ stream::{StreamFormat, StreamSpec}, LocalTrack, MediaSource, Node, }; -use segment::stream_segment; +use segment::segment_stream; use std::{io::SeekFrom, ops::Range}; use tokio::{ fs::File, @@ -31,7 +32,7 @@ pub fn stream_head(spec: &StreamSpec) -> StreamHead { match spec.format { StreamFormat::Original => StreamHead { content_type: "video/x-matroska", range_supported: true }, StreamFormat::Matroska => StreamHead { content_type: webm_or_mkv, range_supported: true }, - StreamFormat::Hls => StreamHead { content_type: "application/vnd.apple.mpegurl", range_supported: false }, + StreamFormat::HlsMaster | StreamFormat::HlsVariant => StreamHead { content_type: "application/vnd.apple.mpegurl", range_supported: false }, StreamFormat::Jhls => StreamHead { content_type: "application/jellything-jhls+json", range_supported: false }, StreamFormat::Segment => StreamHead { content_type: webm_or_mkv, range_supported: false }, } @@ -53,9 +54,10 @@ pub async fn stream(node: Node, spec: StreamSpec, range: Range<usize>) -> Result match spec.format { StreamFormat::Original => original_stream(track_sources, spec, range, b).await?, StreamFormat::Matroska => remux_stream(node, track_sources, spec, range, b).await?, - StreamFormat::Hls => bail!("unsupported"), + StreamFormat::HlsMaster => hls_master_stream(node, track_sources, spec, b).await?, + StreamFormat::HlsVariant => hls_variant_stream(node, track_sources, spec, b).await?, StreamFormat::Jhls => bail!("unsupported"), - StreamFormat::Segment => stream_segment(node, track_sources, spec, b).await?, + StreamFormat::Segment => segment_stream(node, track_sources, spec, b).await?, } Ok(a) |