From 3682da788109b51d1272327612fcf5974cbd4170 Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Tue, 14 Apr 2026 21:10:47 +0200 Subject: [PATCH] mov: when inventing keyframes intra-only mode should take priority --- nihav-commonfmt/src/demuxers/mov/pktread.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/nihav-commonfmt/src/demuxers/mov/pktread.rs b/nihav-commonfmt/src/demuxers/mov/pktread.rs index 2185664..5ec9889 100644 --- a/nihav-commonfmt/src/demuxers/mov/pktread.rs +++ b/nihav-commonfmt/src/demuxers/mov/pktread.rs @@ -181,17 +181,17 @@ impl QTPacketDemuxer { } pub fn invent_keyframes(&mut self, intraonly: bool) { self.keyframes.reserve(self.time_to_sample.len()); - if self.time_to_sample.len() > 2 { + if intraonly && !self.chunk_sizes.is_empty() { + for samp in 0..self.chunk_sizes.len() { + self.keyframes.push((samp + 1) as u32); + } + } else if self.time_to_sample.len() > 2 { let mut abs_csamp = 1u64; for &(count, _scount) in self.time_to_sample.iter() { let count = u64::from(count); self.keyframes.push(abs_csamp as u32); abs_csamp += count; } - } else if intraonly && !self.chunk_sizes.is_empty() { - for samp in 0..self.chunk_sizes.len() { - self.keyframes.push((samp + 1) as u32); - } } else { let max_nsamps = self.sample_map.iter().fold(0u32, |mns, &(_sno, ns)| mns.max(ns)); if max_nsamps >= 3 { -- 2.39.5