Special case opus mime detction
authorDerk-Jan Hartman <hartman.wiki@gmail.com>
Sat, 14 Jan 2017 20:21:37 +0000 (12:21 -0800)
committerDerk-Jan Hartman <hartman.wiki@gmail.com>
Sat, 14 Jan 2017 20:21:37 +0000 (12:21 -0800)
Bug: T151352
Change-Id: I44be5d6b407752b39fc8148d31e9f01de28014dc

includes/libs/mime/MimeAnalyzer.php
includes/libs/mime/mime.info
includes/libs/mime/mime.types

index e42d1a9..6ea3c21 100644 (file)
@@ -83,7 +83,7 @@ class MimeAnalyzer implements LoggerAwareInterface {
         * what will break? In practice this probably isn't a problem anyway -- Bryan)
         */
        protected static $wellKnownTypes = <<<EOT
-application/ogg ogx ogg ogm ogv oga spx
+application/ogg ogx ogg ogm ogv oga spx opus
 application/pdf pdf
 application/vnd.oasis.opendocument.chart odc
 application/vnd.oasis.opendocument.chart-template otc
@@ -108,7 +108,8 @@ audio/midi mid midi kar
 audio/mpeg mpga mpa mp2 mp3
 audio/x-aiff aif aiff aifc
 audio/x-wav wav
-audio/ogg oga spx ogg
+audio/ogg oga spx ogg opus
+audio/opus opus ogg oga ogg spx
 image/x-bmp bmp
 image/gif gif
 image/jpeg jpeg jpg jpe
@@ -526,7 +527,7 @@ EOT;
                        'xbm',
 
                        // Formats we recognize magic numbers for
-                       'djvu', 'ogx', 'ogg', 'ogv', 'oga', 'spx',
+                       'djvu', 'ogx', 'ogg', 'ogv', 'oga', 'spx', 'opus',
                        'mid', 'pdf', 'wmf', 'xcf', 'webm', 'mkv', 'mka',
                        'webp',
 
@@ -1054,6 +1055,8 @@ EOT;
                                return MEDIATYPE_AUDIO;
                        } elseif ( strpos( $head, 'speex' ) !== false ) {
                                return MEDIATYPE_AUDIO;
+                       } elseif ( strpos( $head, 'opus' ) !== false ) {
+                               return MEDIATYPE_AUDIO;
                        } else {
                                return MEDIATYPE_MULTIMEDIA;
                        }
index b04d3c6..5edd889 100644 (file)
@@ -35,6 +35,7 @@ audio/wav audio/x-wav audio/wave      [AUDIO]
 audio/midi audio/mid   [AUDIO]
 audio/basic            [AUDIO]
 audio/ogg              [AUDIO]
+audio/opus             [AUDIO]
 audio/x-aiff           [AUDIO]
 audio/x-pn-realaudio   [AUDIO]
 audio/x-realaudio      [AUDIO]
index b4f515a..f1cd59d 100644 (file)
@@ -72,6 +72,7 @@ audio/basic au snd
 audio/midi mid midi kar
 audio/mpeg mpga mp2 mp3
 audio/ogg oga ogg spx opus
+audio/opus opus oga ogg
 video/webm webm
 audio/webm webm
 audio/x-aiff aif aiff aifc