diff options
Diffstat (limited to 'stream/src/lib.rs')
-rw-r--r-- | stream/src/lib.rs | 34 |
1 files changed, 7 insertions, 27 deletions
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<Arc<Option<MatroskaMetadata>>> { +async fn async_matroska_metadata(path: PathBuf) -> Result<Arc<MatroskaMetadata>> { Ok(spawn_blocking(move || matroska_metadata(&path)).await??) } -struct InternalStreamInfo { - paths: Vec<PathBuf>, - metadata: Vec<MatroskaMetadata>, - track_to_file: Vec<usize>, +pub(crate) struct InternalStreamInfo { + pub paths: Vec<PathBuf>, + pub metadata: Vec<Arc<MatroskaMetadata>>, + pub track_to_file: Vec<usize>, } async fn stream_info(info: Arc<SMediaInfo>) -> 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<Range<(u64, u64)>>; -// /// 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<Option<(u64, AbsBlock)>>; -// } -// pub struct AbsBlock { -// track: u64, -// pts: u64, -// keyframe: bool, -// lacing: Option<LacingType>, -// data: Vec<u8>, -// } |