validate:launcher: Generate proper EncodingProfiles for audio/video only media files
authorThibault Saunier <tsaunier@gnome.org>
Wed, 16 Jul 2014 08:12:04 +0000 (10:12 +0200)
committerThibault Saunier <tsaunier@gnome.org>
Wed, 16 Jul 2014 13:47:58 +0000 (15:47 +0200)
validate/tools/launcher/apps/gst-validate.py
validate/tools/launcher/utils.py

index d3448ce..38103b9 100644 (file)
@@ -362,7 +362,7 @@ class GstValidateTranscodingTest(GstValidateTest):
         if urlparse.urlparse(self.dest_file).scheme == "":
             self.dest_file = path2url(self.dest_file)
 
-        profile = get_profile(self.combination)
+        profile = get_profile(self.combination, self.media_descriptor)
         self.add_arguments("-o", profile)
 
     def build_arguments(self):
index 8c2fec8..ffe19de 100644 (file)
@@ -18,9 +18,9 @@
 # Boston, MA 02110-1301, USA.
 """ Some utilies. """
 
-import sys
 import os
 import re
+import sys
 import urllib
 import loggable
 import urlparse
@@ -223,10 +223,19 @@ def get_profile_full(muxer, venc, aenc, video_restriction=None,
     return ret.replace("::", ":")
 
 
-def get_profile(combination, video_restriction=None, audio_restriction=None):
+def get_profile(combination, media_descriptor=None, video_restriction=None, audio_restriction=None):
+    vcaps = FORMATS[combination.vcodec]
+    acaps = FORMATS[combination.acodec]
+    if media_descriptor is not None:
+        if media_descriptor.get_num_tracks("video") == 0:
+            vcaps = None
+
+        if media_descriptor.get_num_tracks("audio") == 0:
+            acaps = None
+
     return get_profile_full(FORMATS[combination.container],
-                            FORMATS[combination.vcodec],
-                            FORMATS[combination.acodec],
+                            vcaps,
+                            acaps,
                             video_restriction=video_restriction,
                             audio_restriction=audio_restriction)