Author: nick
Date: Sat Oct 5 16:29:37 2013
New Revision: 1529477
URL: http://svn.apache.org/r1529477
Log:
TIKA-1177 Add a common parent type for the Matroska container, then add
data+name tests for WebM and Matroska Video which use them. (For full
detection, we need TIKA-1180)
Modified:
tika/trunk/tika-core/src/main/resources/org/apache/tika/mime/tika-mimetypes.xml
tika/trunk/tika-parsers/src/test/java/org/apache/tika/mime/TestMimeTypes.java
Modified:
tika/trunk/tika-core/src/main/resources/org/apache/tika/mime/tika-mimetypes.xml
URL:
http://svn.apache.org/viewvc/tika/trunk/tika-core/src/main/resources/org/apache/tika/mime/tika-mimetypes.xml?rev=1529477&r1=1529476&r2=1529477&view=diff
==============================================================================
---
tika/trunk/tika-core/src/main/resources/org/apache/tika/mime/tika-mimetypes.xml
(original)
+++
tika/trunk/tika-core/src/main/resources/org/apache/tika/mime/tika-mimetypes.xml
Sat Oct 5 16:29:37 2013
@@ -5502,25 +5502,31 @@
<glob pattern="*.movie"/>
</mime-type>
+ <mime-type type="application/x-matroska">
+ <_comment>Matroska Media Container</_comment>
+ <!-- Common magic across all Matroska varients -->
+ <!-- For full detection, we need a custom Detector, see TIKA-1180 -->
+ <magic priority="40">
+ <match value="0x1A45DFA3" type="string" offset="0" />
+ </magic>
+ </mime-type>
+
<mime-type type="video/x-matroska">
+ <sub-class-of type="application/x-matroska"/>
<glob pattern="*.mkv" />
- <!-- TODO: The magic value below isn't present in all MKV files,
0x1A45DFA3 is but also applies to WebM
- <magic priority="40">
+ <!-- Note: The magic value below isn't present in all MKV files -->
+ <magic priority="50">
<match value="0x1A45DFA3934282886D6174726F736B61" type="string"
offset="0" />
</magic>
- -->
</mime-type>
<mime-type type="audio/x-matroska">
+ <sub-class-of type="application/x-matroska"/>
<glob pattern="*.mka" />
</mime-type>
-
+
<mime-type type="video/webm">
+ <sub-class-of type="application/x-matroska"/>
<glob pattern="*.webm" />
- <!-- TODO: The magic value below would match MKV as well
- <magic priority="40">
- <match value="0x1A45DFA3" type="string" offset="0" />
- </magic>
- -->
</mime-type>
<mime-type type="x-conference/x-cooltalk">
Modified:
tika/trunk/tika-parsers/src/test/java/org/apache/tika/mime/TestMimeTypes.java
URL:
http://svn.apache.org/viewvc/tika/trunk/tika-parsers/src/test/java/org/apache/tika/mime/TestMimeTypes.java?rev=1529477&r1=1529476&r2=1529477&view=diff
==============================================================================
---
tika/trunk/tika-parsers/src/test/java/org/apache/tika/mime/TestMimeTypes.java
(original)
+++
tika/trunk/tika-parsers/src/test/java/org/apache/tika/mime/TestMimeTypes.java
Sat Oct 5 16:29:37 2013
@@ -663,8 +663,9 @@ public class TestMimeTypes extends TestC
public void testMatroskaDetection() throws Exception {
assertType("video/x-matroska", "testMKV.mkv");
- // TODO: need better magic value for data detection
- // assertTypeByData("video/x-matroska", "testMKV.mkv");
+ // TODO: Need custom detector data detection, see TIKA-1180
+ assertTypeByData("application/x-matroska", "testMKV.mkv");
+ assertTypeByNameAndData("video/x-matroska", "testMKV.mkv");
assertTypeByName("video/x-matroska", "x.mkv");
assertTypeByName("video/x-matroska", "x.MKV");
assertTypeByName("audio/x-matroska", "x.mka");
@@ -673,8 +674,9 @@ public class TestMimeTypes extends TestC
public void testWebMDetection() throws Exception {
assertType("video/webm", "testWEBM.webm");
- // TODO: need better magic value for data detection
- // assertTypeByData("video/x-matroska", "testMKV.mkv");
+ // TODO: Need custom detector data detection, see TIKA-1180
+ assertTypeByData("application/x-matroska", "testWEBM.webm");
+ assertTypeByNameAndData("video/webm", "testWEBM.webm");
assertTypeByName("video/webm", "x.webm");
assertTypeByName("video/webm", "x.WEBM");
}