From 7e19285f3ddeb71a82802fd878b7914e0e348e5c Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Sun, 17 May 2020 13:57:51 +0200 Subject: [PATCH] mov: ignore some common chunks --- nihav-commonfmt/src/demuxers/mov.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/nihav-commonfmt/src/demuxers/mov.rs b/nihav-commonfmt/src/demuxers/mov.rs index e7c9a42..80054ed 100644 --- a/nihav-commonfmt/src/demuxers/mov.rs +++ b/nihav-commonfmt/src/demuxers/mov.rs @@ -75,6 +75,7 @@ const IGNORED_CHUNKS: &[u32] = &[ ]; const ROOT_CHUNK_HANDLERS: &[RootChunkHandler] = &[ + RootChunkHandler { ctype: mktag!(b"ftyp"), parse: read_ftyp }, RootChunkHandler { ctype: mktag!(b"mdat"), parse: read_mdat }, RootChunkHandler { ctype: mktag!(b"moov"), parse: read_moov }, ]; @@ -150,6 +151,11 @@ fn skip_chunk(_track: &mut Track, br: &mut ByteReader, size: u64) -> DemuxerResu Ok(size) } +fn read_ftyp(dmx: &mut MOVDemuxer, _strmgr: &mut StreamManager, size: u64) -> DemuxerResult { + dmx.src.skip64(size)?; + Ok(size) +} + fn read_mdat(dmx: &mut MOVDemuxer, _strmgr: &mut StreamManager, size: u64) -> DemuxerResult { dmx.mdat_pos = dmx.src.tell(); dmx.mdat_size = size; @@ -166,6 +172,7 @@ const MOOV_CHUNK_HANDLERS: &[RootChunkHandler] = &[ RootChunkHandler { ctype: mktag!(b"mvhd"), parse: read_mvhd }, RootChunkHandler { ctype: mktag!(b"ctab"), parse: read_ctab }, RootChunkHandler { ctype: mktag!(b"trak"), parse: read_trak }, + RootChunkHandler { ctype: mktag!(b"meta"), parse: read_meta }, ]; fn read_mvhd(dmx: &mut MOVDemuxer, _strmgr: &mut StreamManager, size: u64) -> DemuxerResult { @@ -200,6 +207,11 @@ fn read_ctab(dmx: &mut MOVDemuxer, _strmgr: &mut StreamManager, size: u64) -> De read_palette(&mut dmx.src, size, &mut dmx.pal) } +fn read_meta(dmx: &mut MOVDemuxer, _strmgr: &mut StreamManager, size: u64) -> DemuxerResult { + dmx.src.skip64(size)?; + Ok(size) +} + fn read_trak(dmx: &mut MOVDemuxer, strmgr: &mut StreamManager, size: u64) -> DemuxerResult { let mut track = Track::new(dmx.cur_track as u32, dmx.tb_den); track.read_trak(&mut dmx.src, size)?; -- 2.39.5