From: Kostya Shishkov Date: Thu, 13 Jan 2022 17:29:11 +0000 (+0100) Subject: ignore MusicMatch tag X-Git-Url: https://git.nihav.org/?a=commitdiff_plain;h=62379cdcd0f60f1f28bb4fb50bd99120db987b3c;p=nihav-tool.git ignore MusicMatch tag --- diff --git a/src/demux.rs b/src/demux.rs index bf8a072..0786275 100644 --- a/src/demux.rs +++ b/src/demux.rs @@ -370,6 +370,27 @@ pub fn detect_tags(br: &mut ByteReader) -> (bool, u64, Option) { end = Some(off - size); } } + // check for MusicMatch tag + let ret = if let Some(endpos) = end { + br.seek(SeekFrom::Start(endpos - 0x30)) + } else { + br.seek(SeekFrom::End(-0x30)) + }; + if ret.is_ok() && br.tell() > (0x2000 - 0x30) { + let mut buf = [0; 19]; + br.peek_buf(&mut buf).unwrap(); + if &buf == b"Brava Software Inc." { + br.seek(SeekFrom::Current(-20)).unwrap(); + let mut mm_start = u64::from(br.read_u32le().unwrap()); + if mm_start > 4 && mm_start + 0x2000 <= br.tell() { + let diff = (br.tell() - mm_start) & 3; + if diff != 0 { + mm_start -= 4 - diff; + } + end = Some(mm_start); + } + } + } (is_raw, start, end) }