From 48a57a52d85d387efe122fb4d9fb113f577a0a98 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Sun, 13 Apr 2025 18:19:03 +0200 Subject: arc mkmeta --- stream/src/lib.rs | 34 +++++++--------------------------- 1 file changed, 7 insertions(+), 27 deletions(-) (limited to 'stream/src') diff --git a/stream/src/lib.rs b/stream/src/lib.rs index 59b4960..d09759f 100644 --- a/stream/src/lib.rs +++ b/stream/src/lib.rs @@ -96,24 +96,22 @@ pub async fn stream( Ok(a) } -async fn async_matroska_metadata(path: PathBuf) -> Result>> { +async fn async_matroska_metadata(path: PathBuf) -> Result> { Ok(spawn_blocking(move || matroska_metadata(&path)).await??) } -struct InternalStreamInfo { - paths: Vec, - metadata: Vec, - track_to_file: Vec, +pub(crate) struct InternalStreamInfo { + pub paths: Vec, + pub metadata: Vec>, + pub track_to_file: Vec, } async fn stream_info(info: Arc) -> Result<(InternalStreamInfo, StreamInfo)> { let mut metadata = Vec::new(); let mut paths = Vec::new(); for path in &info.files { - if let Some(meta) = (*async_matroska_metadata(path.clone()).await?).clone() { - metadata.push(meta); - paths.push(path.clone()); - } + metadata.push(async_matroska_metadata(path.clone()).await?); + paths.push(path.clone()); } let mut tracks = Vec::new(); @@ -232,21 +230,3 @@ async fn copy_stream(mut inp: File, mut out: DuplexStream, mut amount: usize) -> amount -= size; } } - -// // TODO functions to test seekability, get live status and enumate segments -// trait MediaSource { -// fn loaded_range(&self) -> Result>; -// /// Seeks to some position close to, but before, `time` ticks. -// 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 -// fn next(&mut self) -> Result>; -// } -// pub struct AbsBlock { -// track: u64, -// pts: u64, -// keyframe: bool, -// lacing: Option, -// data: Vec, -// } -- cgit v1.2.3-70-g09d2