Add default implementation of getLength to base MediaHandler class
authorBrian Wolff <bawolff+wn@gmail.com>
Sat, 22 Mar 2014 02:28:38 +0000 (23:28 -0300)
committerBrian Wolff <bawolff+wn@gmail.com>
Mon, 24 Mar 2014 03:05:39 +0000 (00:05 -0300)
It was being called in File::getLength, but was only implemented
in a subclass, that's not even in core. Any method of a handler
class called from a method in File class should work on any
subclass of MediaHandler.

Change-Id: I94eda90ec3dd64b6ff2e3a5732aa539366cec521

includes/media/MediaHandler.php

index ee11599..e4caf35 100644 (file)
@@ -798,4 +798,18 @@ abstract class MediaHandler {
        public function getDefaultRenderLanguage( File $file ) {
                return null;
        }
+
+       /**
+        * If its an audio file, return the length of the file. Otherwise 0.
+        *
+        * File::getLength() existed for a long time, but was calling a method
+        * that only existed in some subclasses of this class (The TMH ones).
+        *
+        * @param File $file
+        * @return float Length in seconds
+        * @since 1.23
+        */
+       public function getLength( $file ) {
+               return 0.0;
+       }
 }