validate:launcher: Add support for audio track switching scenario

This commit is contained in:
Thibault Saunier 2014-04-25 13:17:39 +02:00
parent 8b4542540c
commit be72ec5f6a
3 changed files with 42 additions and 13 deletions

View file

@ -1,2 +1,2 @@
description, summary="Change audio track at 5 second to the second audio track"
description, summary="Change audio track at 5 second to the second audio track", min-audio-track=2
switch-track, name=Next-audio-track, playback_time=5.0, type=audio, index=(string)+1

View file

@ -29,8 +29,9 @@ from utils import MediaFormatCombination, get_profile,\
path2url, DEFAULT_TIMEOUT, which, GST_SECOND, Result, \
compare_rendered_with_original, Protocols
class MediaDescriptor(object):
class MediaDescriptor(Loggable):
def __init__(self, xml_path):
Loggable.__init__(self)
self.media_xml = ET.parse(xml_path).getroot()
# Sanity checks
@ -61,14 +62,28 @@ class MediaDescriptor(object):
return True
return False
def num_audio_tracks(media_xml):
def get_num_audio_tracks(self):
naudio = 0
for stream in media_xml.findall("streams")[0].findall("stream"):
for stream in self.media_xml.findall("streams")[0].findall("stream"):
if stream.attrib["type"] == "audio":
naudio += 1
return naudio
def is_compatible(self, scenario):
if scenario.seeks() and (not self.is_seekable() or self.is_image()):
self.debug("Do not run %s as %s does not support seeking",
scenario, self.get_uri())
return False
if self.get_num_audio_tracks() < scenario.get_min_audio_tracks():
self.debug("%s -- %s | At least %s audio track needed < %s"
% (scenario, self.get_uri(),
scenario.get_min_audio_tracks(), self.get_num_audio_tracks()))
return False
return True
class PipelineDescriptor(object):
def __init__(self, name, pipeline):
self.name = name
@ -96,7 +111,7 @@ class PlaybinDescriptor(PipelineDescriptor):
pipe += " uri=%s" % uri
if hasattr(scenario, "reverse-playback") and protocol == Protocols.HTTP:
if scenario.does_reverse_playback() and protocol == Protocols.HTTP:
# 10MB so we can reverse playback
pipe += " ring-buffer-max-size=10485760"
@ -164,7 +179,7 @@ G_V_BLACKLISTED_TESTS = \
"https://bugzilla.gnome.org/show_bug.cgi?id=723268"),
("validate.*.reverse_playback.*webm$",
"https://bugzilla.gnome.org/show_bug.cgi?id=679250"),
("validate.*.playback.reverse_playback.*\.ts|validate.*.playback.reverse_playback.*\.MTS",
("validate.*.playback.reverse_playback.*ts|validate.*.playback.reverse_playback.*MTS",
"https://bugzilla.gnome.org/show_bug.cgi?id=702595"),
("validate.http.playback.seek_with_stop.*webm",
"matroskademux.gst_matroska_demux_handle_seek_push: Seek end-time not supported in streaming mode"),
@ -351,8 +366,6 @@ class GstValidateManager(TestsManager, Loggable):
timeout=timeout))
for uri, mediainfo in self._list_uris():
if mediainfo.media_descriptor.is_image():
continue
for comb in G_V_ENCODING_TARGET_COMBINATIONS:
@ -449,14 +462,13 @@ class GstValidateManager(TestsManager, Loggable):
scenarios = self._scenarios.get_scenario(None)
for scenario in scenarios:
if not minfo.media_descriptor.is_compatible(scenario):
continue
npipe = pipe_descriptor.get_pipeline(self.options,
protocol,
scenario,
uri)
if not minfo.media_descriptor.is_seekable() or minfo.media_descriptor.is_image():
self.debug("Do not run %s as %s does not support seeking",
scenario, uri)
continue
fname = "%s.%s" % (self._get_fname(scenario,
protocol),

View file

@ -668,7 +668,24 @@ class Scenario(object):
self.name = name
for prop, value in props:
setattr(self, prop, value)
setattr(self, prop.replace("-", "_"), value)
def seeks(self):
if hasattr(self, "seek"):
return bool(self.seek)
return False
def does_reverse_playback(self):
if hasattr(self, "reverse_playback"):
return bool(self.seek)
def get_min_audio_tracks(self):
if hasattr(self, "min_audio_track"):
return int(self.min_audio_track)
return 0
class ScenarioManager(Loggable):
_instance = None