From b9862e981309216dda3a1265b9c22b42c55ff592 Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Mon, 14 Dec 2020 17:11:38 +0100 Subject: [PATCH] mov: skip common atoms in video codec extradata --- nihav-commonfmt/src/demuxers/mov.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/nihav-commonfmt/src/demuxers/mov.rs b/nihav-commonfmt/src/demuxers/mov.rs index ac124fa..da50591 100644 --- a/nihav-commonfmt/src/demuxers/mov.rs +++ b/nihav-commonfmt/src/demuxers/mov.rs @@ -605,8 +605,21 @@ fn read_stsd(track: &mut Track, br: &mut ByteReader, size: u64) -> DemuxerResult let format = if depth > 8 { RGB24_FORMAT } else { PAL8_FORMAT }; let mut vhdr = NAVideoInfo::new(width, height, false, format); vhdr.bits = depth as u8; + //skip various common atoms + while br.tell() - start_pos + 4 < size { + let mut buf = [0u8; 8]; + br.peek_buf(&mut buf)?; + let tsize = read_u32be(&buf).unwrap() as usize; + let tag = &buf[4..8]; + validate!(tsize >= 8); + match tag { + b"pasp" | b"clap" => { + br.read_skip(tsize)?; + }, + _ => break, + }; + } let edata = if br.tell() - start_pos + 4 < size { -//todo skip various common atoms let edata_size = br.read_u32be()? as usize; validate!(edata_size >= 4); let mut buf = vec![0; edata_size - 4]; -- 2.39.5