]> git.nihav.org Git - nihav.git/commitdiff
mov: skip common atoms in video codec extradata
authorKostya Shishkov <kostya.shishkov@gmail.com>
Mon, 14 Dec 2020 16:11:38 +0000 (17:11 +0100)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Mon, 14 Dec 2020 16:11:38 +0000 (17:11 +0100)
nihav-commonfmt/src/demuxers/mov.rs

index ac124faec443190d44b9b8296822c750588ab49d..da5059185777e1dab73d03b245649e3218f5ef73 100644 (file)
@@ -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];