aboutsummaryrefslogtreecommitdiff
path: root/stream/src
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2025-04-15 17:56:06 +0200
committermetamuffin <metamuffin@disroot.org>2025-04-15 17:56:06 +0200
commit50dc0e7bea02d7fc5b38edb7f943e19bd8c0285b (patch)
tree809fda62fe17a66d34b3edb7e595f10310bb112e /stream/src
parentc59abb792391e2f7540a80bb8d989021fe0a5b80 (diff)
downloadjellything-50dc0e7bea02d7fc5b38edb7f943e19bd8c0285b.tar
jellything-50dc0e7bea02d7fc5b38edb7f943e19bd8c0285b.tar.bz2
jellything-50dc0e7bea02d7fc5b38edb7f943e19bd8c0285b.tar.zst
remux playback works
Diffstat (limited to 'stream/src')
-rw-r--r--stream/src/stream_info.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/stream/src/stream_info.rs b/stream/src/stream_info.rs
index a8b6989..43c536a 100644
--- a/stream/src/stream_info.rs
+++ b/stream/src/stream_info.rs
@@ -57,12 +57,7 @@ pub(crate) async fn stream_info(info: Arc<SMediaInfo>) -> Result<(InternalStream
let segment = StreamSegmentInfo {
name: None,
- duration: metadata[0]
- .info
- .as_ref()
- .unwrap()
- .duration
- .unwrap_or_default(),
+ duration: media_duration(&metadata[0]),
tracks,
};
Ok((
@@ -162,3 +157,8 @@ pub(crate) async fn write_stream_info(info: Arc<SMediaInfo>, mut b: DuplexStream
spawn(async move { b.write_all(&serde_json::to_vec(&info)?).await });
Ok(())
}
+
+fn media_duration(m: &MatroskaMetadata) -> f64 {
+ let info = m.info.as_ref().unwrap();
+ (info.duration.unwrap_or_default() * info.timestamp_scale as f64) / 1_000_000_000.
+}