Skip to content

Commit

Permalink
Merge pull request #56 from Bulkin/mov-fix
Browse files Browse the repository at this point in the history
Improve detection of mov files (video/quicktime).
  • Loading branch information
bojand authored Mar 1, 2023
2 parents 67f2984 + fdd039d commit 67e0e83
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/matchers/video.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,8 @@ pub fn is_webm(buf: &[u8]) -> bool {
/// Returns whether a buffer is Quicktime MOV video data.
pub fn is_mov(buf: &[u8]) -> bool {
buf.len() > 15
&& ((buf[0] == 0x0
&& buf[1] == 0x0
&& buf[2] == 0x0
&& buf[3] == 0x14
&& buf[4] == 0x66
&& buf[5] == 0x74
&& buf[6] == 0x79
&& buf[7] == 0x70)
&& (((buf[4] == b'f' && buf[5] == b't' && buf[6] == b'y' && buf[7] == b'p')
&& (buf[8] == b'q' && buf[9] == b't' && buf[10] == b' ' && buf[11] == b' '))
|| (buf[4] == 0x6d && buf[5] == 0x6f && buf[6] == 0x6f && buf[7] == 0x76)
|| (buf[4] == 0x6d && buf[5] == 0x64 && buf[6] == 0x61 && buf[7] == 0x74)
|| (buf[12] == 0x6d && buf[13] == 0x64 && buf[14] == 0x61 && buf[15] == 0x74))
Expand Down
Binary file added testdata/sample2.mov
Binary file not shown.
1 change: 1 addition & 0 deletions tests/video.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ test_format!(Video, "video/x-matroska", "mkv", mkv, "sample.mkv");
test_format!(Video, "video/webm", "webm", webm, "sample.webm");

test_format!(Video, "video/quicktime", "mov", mov, "sample.mov");
test_format!(Video, "video/quicktime", "mov", mov2, "sample2.mov");

test_format!(Video, "video/x-msvideo", "avi", avi, "sample.avi");

Expand Down

0 comments on commit 67e0e83

Please sign in to comment.