Commit b969e1c7 authored by Ville Skyttä's avatar Ville Skyttä
Browse files

audio/vnd.dts.hd: include parent type magic in magic match

Matching just 0x64582025 within the first 18725 bytes of any file is
prone to false positives.

The priority of the magic match here being bumped to 60 seems to
indicate intent to make it take precedence over the parent
`audio/vnd.dts`. But we should take the parent magic into account here
as it does not "inherit" with `sub-class-of`.

As the comment for this match says "16bits HD be", accept only "16bits
core be" as the parent at least for now, not all possible parent
magics -- it would not seem consistent to have it in "14bits"
variants, or the "16bits core le" one. The test case we have for this
is one matching "16bits core be".

Refs xdg/shared-mime-info#166
Refs xdg/shared-mime-info#167
parent ddc78dee
......@@ -4145,7 +4145,9 @@ command to generate the output files.
<comment>DTSHD audio</comment>
<sub-class-of type="audio/vnd.dts"/>
<magic priority="60">
<match type="big32" value="0x64582025" offset="0:18725"/> <!-- 16bits HD be -->
<match type="big32" value="0x7FFE8001" offset="0"> <!-- 16bits core be -->
<match type="big32" value="0x64582025" offset="4:18725"/> <!-- 16bits HD be -->
</match>
</magic>
<alias type="audio/x-dtshd"/>
<glob pattern="*.dtshd"/>
......
......@@ -251,6 +251,8 @@ test.vsd application/vnd.visio ox
# Copied from https://bugs.freedesktop.org/show_bug.cgi?id=40800
test.dts audio/vnd.dts
test.dtshd audio/vnd.dts.hd
# perl -e 'print "This is not DTSHD: \x{64}\x{58}\x{20}\x{25}"'
test-not-dtshd.txt text/plain
# Copied from http://samples.mplayerhq.hu/A-codecs/amr/sample2.amr
sample2.amr audio/AMR
# Testing case-insensitive mime-type matching
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment