diff options
author | Kostya Shishkov <kostya.shishkov@gmail.com> | 2020-10-03 17:51:58 +0200 |
---|---|---|
committer | Kostya Shishkov <kostya.shishkov@gmail.com> | 2020-10-03 17:51:58 +0200 |
commit | b4bf2c3f1a94b2b4ebbfc704e17fbaf366f8fa8b (patch) | |
tree | b394d91978d54dce5a0ca86e435bf7d91fc17fcd | |
parent | 7b228074955a9f229660ec242a567ba76f694558 (diff) | |
download | nihav-b4bf2c3f1a94b2b4ebbfc704e17fbaf366f8fa8b.tar.gz |
wav: generate PTS for demuxed blocks
-rw-r--r-- | nihav-commonfmt/src/demuxers/wav.rs | 8 |
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 { |