diff --git a/validate/data/Makefile.am b/validate/data/Makefile.am index 3fb2628973..47033716ee 100644 --- a/validate/data/Makefile.am +++ b/validate/data/Makefile.am @@ -15,6 +15,7 @@ scenarios_DATA = simple_seeks.scenario \ force_key_unit.scenario\ seek_with_stop.scenario\ switch_audio_track_while_paused.scenario\ + switch_subtitle_track.scenario\ switch_audio_track.scenario EXTRA_DIST = simple_seeks.scenario \ @@ -33,4 +34,5 @@ EXTRA_DIST = simple_seeks.scenario \ force_key_unit.scenario\ seek_with_stop.scenario\ switch_audio_track_while_paused.scenario\ + switch_subtitle_track.scenario\ switch_audio_track.scenario diff --git a/validate/data/switch_subtitle_track.scenario b/validate/data/switch_subtitle_track.scenario new file mode 100644 index 0000000000..0ba7ed30bf --- /dev/null +++ b/validate/data/switch_subtitle_track.scenario @@ -0,0 +1,3 @@ +description, summary="Change subtitle track at 1 second while playing back", min-subtitle-track=2, duration=5.0 +switch-track, playback_time=1.0, type=text, index=(string)+1 +stop, playback_time=5.0 diff --git a/validate/tools/launcher/apps/gst-validate.py b/validate/tools/launcher/apps/gst-validate.py index 447f02e6f6..c0372a10ca 100644 --- a/validate/tools/launcher/apps/gst-validate.py +++ b/validate/tools/launcher/apps/gst-validate.py @@ -62,13 +62,13 @@ class MediaDescriptor(Loggable): return True return False - def get_num_audio_tracks(self): - naudio = 0 + def get_num_tracks(self, track_type): + n = 0 for stream in self.media_xml.findall("streams")[0].findall("stream"): - if stream.attrib["type"] == "audio": - naudio += 1 + if stream.attrib["type"] == track_type: + n += 1 - return naudio + return n def is_compatible(self, scenario): if scenario.seeks() and (not self.is_seekable() or self.is_image()): @@ -76,11 +76,13 @@ class MediaDescriptor(Loggable): 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 + for track_type in ['audio', 'subtitle']: + if self.get_num_tracks(track_type) < scenario.get_min_tracks(track_type): + self.debug("%s -- %s | At least %s %s track needed < %s" + % (scenario, self.get_uri(), track_type, + scenario.get_min_tracks(track_type), + self.get_num_tracks(track_type))) + return False return True @@ -155,6 +157,7 @@ G_V_SCENARIOS = {Protocols.FILE: ["play_15s", "seek_with_stop", "switch_audio_track", "switch_audio_track_while_paused", + "switch_subtitle_track", "scrub_forward_seeking"], Protocols.HTTP: ["play_15s", "fast_forward", @@ -163,6 +166,7 @@ G_V_SCENARIOS = {Protocols.FILE: ["play_15s", "seek_with_stop", "switch_audio_track", "switch_audio_track_while_paused", + "switch_subtitle_track", "reverse_playback"], Protocols.HLS: ["play_15s", "fast_forward", @@ -170,6 +174,7 @@ G_V_SCENARIOS = {Protocols.FILE: ["play_15s", "seek_with_stop", "switch_audio_track", "switch_audio_track_while_paused", + "switch_subtitle_track", "seek_backward"], } diff --git a/validate/tools/launcher/baseclasses.py b/validate/tools/launcher/baseclasses.py index a2fc5e3106..540d2dbe1b 100644 --- a/validate/tools/launcher/baseclasses.py +++ b/validate/tools/launcher/baseclasses.py @@ -678,11 +678,14 @@ class Scenario(object): if hasattr(self, "reverse_playback"): return bool(self.seek) + return False - def get_min_audio_tracks(self): - if hasattr(self, "min_audio_track"): - return int(self.min_audio_track) - return 0 + + def get_min_tracks(self, track_type): + try: + return int(getattr(self, "min_%s_track" % track_type)) + except AttributeError: + return 0 class ScenarioManager(Loggable):