Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/108482


Change subject: Let TMH detect webm files using opus and VP9 codecs
......................................................................

Let TMH detect webm files using opus and VP9 codecs

From what I understand VP9/Opus is the future of webm. This
patch will make sure such files are properly identified
in their long descriptions. It should also prevent TMH from
trying to play a VP9 file in a browser only supporting webm.

Bug: 60245
Change-Id: Icd368504d986821d4650347694c5b6705ceabe5d
---
M handlers/WebMHandler/WebMHandler.php
1 file changed, 19 insertions(+), 1 deletion(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TimedMediaHandler 
refs/changes/82/108482/1

diff --git a/handlers/WebMHandler/WebMHandler.php 
b/handlers/WebMHandler/WebMHandler.php
index 356755c..fae4812 100644
--- a/handlers/WebMHandler/WebMHandler.php
+++ b/handlers/WebMHandler/WebMHandler.php
@@ -89,7 +89,14 @@
         * @return String
         */
        function getWebType( $file ) {
-               return 'video/webm; codecs="vp8, vorbis"';
+               $streams = $this->getStreamTypes( $file );
+               if ( count( $streams ) === 0 ) {
+                       return 'video/webm';
+               }
+
+               $codecs = strtolower( implode( ', ', $streams ) );
+
+               return 'video/webm; codecs="' . $streams . '"';
        }
 
        /**
@@ -104,10 +111,21 @@
                }
                if( isset( $metadata['audio'] ) && 
$metadata['audio']['dataformat'] == 'vorbis' ){
                        $streamTypes[] =  'Vorbis';
+               } elseif ( isset( $metadata['audio'] ) &&
+                       ( $metadata['audio']['dataformat'] == 'opus'
+                       || $metadata['audio']['dataformat'] == 'A_OPUS'
+               ) ) {
+                       // Currently getID3 calls it A_OPUS. That will probably 
change to 'opus'
+                       // once getID3 actually gets support for the codec.
+                       $streamTypes[] = 'Opus';
                }
                // id3 gives 'V_VP8' for what we call VP8
                if( $metadata['video']['dataformat'] == 'vp8' ){
                        $streamTypes[] =  'VP8';
+               } elseif( $metadata['video']['dataformat'] === 'vp9' || 
$metadata['video']['dataformat'] === 'V_VP9' ) {
+                       // Currently getID3 calls it V_VP9. That will probably 
change to vp9
+                       // once getID3 actually gets support for the codec.
+                       $streamTypes[] =  'VP9';
                }
 
                return $streamTypes;

-- 
To view, visit https://gerrit.wikimedia.org/r/108482
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icd368504d986821d4650347694c5b6705ceabe5d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TimedMediaHandler
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff <bawolff...@gmail.com>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to