summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKostya Shishkov <[email protected]>2020-10-07 14:09:25 +0200
committerKostya Shishkov <[email protected]>2020-10-07 14:09:25 +0200
commit7c51b54540335c7a7231f98c43e7bbcda6a2a8a8 (patch)
tree376829a991424273fcdf976376ff8c8c90b211f8
parent42fa9a844c4b8e46189ffaf9e5f803b3c03e7042 (diff)
tta: report sample-based duration
-rw-r--r--nihav-llaudio/src/demuxers/tta.rs5
1 files changed, 4 insertions, 1 deletions
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<u64>,
sizetab: Vec<u32>,
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> {