From: Kostya Shishkov Date: Wed, 7 Oct 2020 12:09:25 +0000 (+0200) Subject: tta: report sample-based duration X-Git-Url: https://git.nihav.org/?a=commitdiff_plain;h=7c51b54540335c7a7231f98c43e7bbcda6a2a8a8;p=nihav.git tta: report sample-based duration --- diff --git a/nihav-llaudio/src/demuxers/tta.rs b/nihav-llaudio/src/demuxers/tta.rs index 973ff84..25fac1b 100644 --- a/nihav-llaudio/src/demuxers/tta.rs +++ b/nihav-llaudio/src/demuxers/tta.rs @@ -9,6 +9,7 @@ struct TTADemuxer<'a> { offtab: Vec, sizetab: Vec, framelen: u32, + duration: u64, } impl<'a> TTADemuxer<'a> { @@ -21,6 +22,7 @@ impl<'a> TTADemuxer<'a> { offtab: Vec::new(), sizetab: Vec::new(), framelen: 0, + duration: 0, } } } @@ -46,6 +48,7 @@ impl<'a> DemuxCore<'a> for TTADemuxer<'a> { self.framelen = srate * 256 / 245; self.nframes = (self.nsamples + self.framelen - 1) / self.framelen; + self.duration = u64::from(self.nsamples) * 1000 / u64::from(srate); seek_index.mode = SeekIndexMode::Present; let mut off = u64::from(self.nframes) * 4 + 4 + 22; @@ -96,7 +99,7 @@ impl<'a> DemuxCore<'a> for TTADemuxer<'a> { Ok(()) } - fn get_duration(&self) -> u64 { 0 } + fn get_duration(&self) -> u64 { self.duration } } impl<'a> NAOptionHandler for TTADemuxer<'a> {