diff --git a/crates/ec-dvdsub/src/lib.rs b/crates/ec-dvdsub/src/lib.rs index 677a1c3a..30859159 100644 --- a/crates/ec-dvdsub/src/lib.rs +++ b/crates/ec-dvdsub/src/lib.rs @@ -29,6 +29,7 @@ use ec_core::{ pub const MAX_DIMENSION: u32 = 4096; /// Ticks of the SPU delay unit: 1024 periods of the 90 kHz clock. pub const DELAY_UNIT_90K: i64 = 1024; +const CLOCK_90K: TimeBase = TimeBase::new(1, 90_000); /// Finished cues kept for [`DvdSubDecoder::take_cue`]. pub const MAX_PENDING: usize = 64; @@ -475,7 +476,7 @@ pub struct DvdSubDecoder { params: CodecParameters, palette: Palette, canvas: (u32, u32), - ready: VecDeque<(Cue, Option)>, + ready: VecDeque, } impl DvdSubDecoder { @@ -498,21 +499,20 @@ impl DvdSubDecoder { pub fn push_unit(&mut self, unit: &[u8], pts: Option) -> Result<()> { let mut cue = decode_spu(unit, &self.palette, self.canvas)?; if let Some(p) = pts { - let base = TimeBase::try_new(1, 90_000).map_err(|_| Error::corrupt("dvdsub: time base"))?; - let delay = Timestamp::new(cue.start_90k, base) + let delay = Timestamp::new(cue.start_90k, CLOCK_90K) .rescale(p.base, ec_core::Rounding::Nearest); cue.frame.pts = Some(Timestamp::new(p.ticks.saturating_add(delay.ticks), p.base)); } if self.ready.len() >= MAX_PENDING { self.ready.pop_front(); } - self.ready.push_back((cue, pts)); + self.ready.push_back(cue); Ok(()) } /// The next decoded cue with its timing, oldest first. pub fn take_cue(&mut self) -> Option { - self.ready.pop_front().map(|(c, _)| c) + self.ready.pop_front() } }