From 1d2ed0a54c21e0ab7dd01b5f3975bb5df12d40ea Mon Sep 17 00:00:00 2001 From: metamuffin Date: Tue, 28 Nov 2023 13:31:28 +0100 Subject: ass to webvtt conversion --- stream/src/lib.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'stream/src/lib.rs') diff --git a/stream/src/lib.rs b/stream/src/lib.rs index e9b9a4b..604e3eb 100644 --- a/stream/src/lib.rs +++ b/stream/src/lib.rs @@ -7,6 +7,7 @@ pub mod hls; pub mod jhls; pub mod segment; +pub mod webvtt; use anyhow::{anyhow, bail, Context, Result}; use hls::{hls_master_stream, hls_variant_stream}; @@ -24,6 +25,7 @@ use tokio::{ io::{duplex, AsyncReadExt, AsyncSeekExt, AsyncWriteExt, DuplexStream}, }; use tokio_util::io::SyncIoBridge; +use webvtt::webvtt_stream; pub struct StreamHead { pub content_type: &'static str, @@ -38,6 +40,7 @@ pub fn stream_head(spec: &StreamSpec) -> StreamHead { StreamFormat::Matroska => StreamHead { content_type: webm_or_mkv, range_supported: true }, 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::Webvtt => StreamHead { content_type: "text/vtt", range_supported: false }, StreamFormat::Segment => StreamHead { content_type: webm_or_mkv, range_supported: false }, } } @@ -69,6 +72,7 @@ pub async fn stream( StreamFormat::HlsVariant => hls_variant_stream(node, track_sources, spec, b).await?, StreamFormat::Jhls => jhls_stream(node, track_sources, spec, b, perms).await?, StreamFormat::Segment => segment_stream(node, track_sources, spec, b, perms).await?, + StreamFormat::Webvtt => webvtt_stream(node, track_sources, spec, b).await?, } Ok(a) -- cgit v1.2.3-70-g09d2