Skip to content

Commit 73562f1

Browse files
committed
changes AVI detection so it won't trigger on WAV files
1 parent 14014d4 commit 73562f1

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/registry.jl

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ add_format(format"NRRD", "NRRD", [".nrrd", ".nhdr"], [:NRRD])
1414
add_format(format"AndorSIF", "Andor Technology Multi-Channel File", ".sif", [:AndorSIF, LOAD])
1515

1616

17-
add_format(format"AVI", UInt8[0x52,0x49,0x46,0x46], ".avi", [:ImageMagick])
1817
add_format(format"CRW", UInt8[0x49,0x49,0x1a,0x00,0x00,0x00,0x48,0x45], ".crw", [:ImageMagick])
1918
add_format(format"CUR", UInt8[0x00,0x00,0x02,0x00], ".cur", [:ImageMagick])
2019
add_format(format"DCX", UInt8[0xb1,0x68,0xde,0x3a], ".dcx", [:ImageMagick])
@@ -100,6 +99,19 @@ add_format(format"OFF", "OFF", ".off", [:MeshIO])
10099

101100

102101
### Complex cases
102+
103+
# AVI is a subtype of RIFF, as is WAV
104+
function detectavi(io)
105+
seekstart(io)
106+
magic = ascii(read(io, UInt8, 4))
107+
magic == "RIFF" || return false
108+
seek(s, 8)
109+
submagic = ascii(read(io, UInt8, 4))
110+
111+
submagic == "AVI "
112+
end
113+
add_format(format"AVI", detectavi, ".avi", [:ImageMagick])
114+
103115
# HDF5: the complication is that the magic bytes may start at
104116
# 0, 512, 1024, 2048, or any multiple of 2 thereafter
105117
h5magic = (0x89,0x48,0x44,0x46,0x0d,0x0a,0x1a,0x0a)

0 commit comments

Comments
 (0)