diff options
author | Kostya Shishkov <kostya.shishkov@gmail.com> | 2022-01-13 18:29:11 +0100 |
---|---|---|
committer | Kostya Shishkov <kostya.shishkov@gmail.com> | 2022-01-13 18:29:11 +0100 |
commit | 62379cdcd0f60f1f28bb4fb50bd99120db987b3c (patch) | |
tree | e7c8c91f7d09c7a2b5bb1b9179c434097d8d09f6 | |
parent | dd612d5590928bcebeba04fb46b26e893e28f24b (diff) | |
download | nihav-tool-62379cdcd0f60f1f28bb4fb50bd99120db987b3c.tar.gz |
ignore MusicMatch tag
-rw-r--r-- | src/demux.rs | 21 |
1 files changed, 21 insertions, 0 deletions
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<u64>) { 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) } |