Making a fix so that video codec name switched from "vp8 video" to "vp8"
authorChristopher Allan Webber <cwebber@dustycloud.org>
Wed, 6 Mar 2013 18:05:40 +0000 (12:05 -0600)
committerChristopher Allan Webber <cwebber@dustycloud.org>
Wed, 6 Mar 2013 18:05:40 +0000 (12:05 -0600)
"vp8 video" is what vp8 is marked as in gstreamer's metadata.
However, the browser expects it just as the name "vp8".  So fixing
that.

This commit sponsored by Tyng-Ruey Chuang.  Thank you!

mediagoblin/media_types/video/models.py

index 970ceb757dac68e21ea6093dc52cfa6c15ba0d54..f696a8927de1d225bf4e2e9f4771d5630a3d0abd 100644 (file)
@@ -78,10 +78,17 @@ class VideoData(Base):
                 mimetype = "video/ogg"
             else:
                 mimetype = orig_metadata['mimetype']
+
+            video_codec = orig_metadata["tags"]["video-codec"].lower()
+            audio_codec = orig_metadata["tags"]["audio-codec"].lower()
+
+            # We don't want the "video" at the end of vp8...
+            # not sure of a nicer way to be cleaning this stuff
+            if video_codec == "vp8 video":
+                video_codec = "vp8"
+
             return '%s; codecs="%s, %s"' % (
-                mimetype,
-                orig_metadata["tags"]["video-codec"].lower(),
-                orig_metadata["tags"]["audio-codec"].lower())
+                mimetype, video_codec, audio_codec)
         else:
             return video.MEDIA_MANAGER["default_webm_type"]