aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKostya Shishkov <kostya.shishkov@gmail.com>2020-10-03 17:51:58 +0200
committerKostya Shishkov <kostya.shishkov@gmail.com>2020-10-03 17:51:58 +0200
commitb4bf2c3f1a94b2b4ebbfc704e17fbaf366f8fa8b (patch)
treeb394d91978d54dce5a0ca86e435bf7d91fc17fcd
parent7b228074955a9f229660ec242a567ba76f694558 (diff)
downloadnihav-b4bf2c3f1a94b2b4ebbfc704e17fbaf366f8fa8b.tar.gz
wav: generate PTS for demuxed blocks
-rw-r--r--nihav-commonfmt/src/demuxers/wav.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/nihav-commonfmt/src/demuxers/wav.rs b/nihav-commonfmt/src/demuxers/wav.rs
index ce6318a..fb522cd 100644
--- a/nihav-commonfmt/src/demuxers/wav.rs
+++ b/nihav-commonfmt/src/demuxers/wav.rs
@@ -68,7 +68,13 @@ impl<'a> DemuxCore<'a> for WAVDemuxer<'a> {
let str = strmgr.get_stream(0);
if str.is_none() { return Err(InvalidData); }
let stream = str.unwrap();
- let ts = NATimeInfo::new(None, None, None, 1, self.srate);
+ let pts = if self.avg_bytes != 0 {
+ let pos = self.src.tell() - self.data_pos;
+ Some(pos * u64::from(self.srate) / u64::from(self.avg_bytes))
+ } else {
+ None
+ };
+ let ts = NATimeInfo::new(pts, None, None, 1, self.srate);
if self.is_pcm {
let mut bsize = self.block_size;
while bsize < 256 {