From: Kostya Shishkov Date: Sat, 3 Oct 2020 15:51:58 +0000 (+0200) Subject: wav: generate PTS for demuxed blocks X-Git-Url: https://git.nihav.org/?a=commitdiff_plain;h=b4bf2c3f1a94b2b4ebbfc704e17fbaf366f8fa8b;p=nihav.git wav: generate PTS for demuxed blocks --- 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 {