]> git.nihav.org Git - nihav.git/commitdiff
mov: if audio extradata does not start with wave pass it in full
authorKostya Shishkov <kostya.shishkov@gmail.com>
Mon, 6 Jul 2020 12:16:04 +0000 (14:16 +0200)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Mon, 6 Jul 2020 12:16:04 +0000 (14:16 +0200)
nihav-commonfmt/src/demuxers/mov.rs

index 4904697e193a901b9b974f518ff90f559b75824f..c10bb2dd7a2500ff136081dd51510e51320cc53c 100644 (file)
@@ -428,6 +428,14 @@ const STBL_CHUNK_HANDLERS: &[TrackChunkHandler] = &[
 fn parse_audio_edata(br: &mut ByteReader, start_pos: u64, size: u64) -> DemuxerResult<Option<Vec<u8>>> {
     let read_part = br.tell() - start_pos;
     if read_part + 8 < size {
+        let mut buf = [0; 8];
+                              br.peek_buf(&mut buf)?;
+        if &buf[4..8] != b"wave" {
+            let mut buf = vec![0; (size - read_part) as usize];
+                              br.read_buf(&mut buf)?;
+            return Ok(Some(buf));
+        }
+
         let csize           = br.read_u32be()? as u64;
         let ctag            = br.read_u32be()?;
         validate!(read_part + csize <= size);