mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-30 04:45:36 +00:00
validate: Add a scenarios that switchs subtitle track
+ Make it easier and cleaner to tell that a switch is actually disabling a track type. And run the scenario in gst-validate-launcher by default
This commit is contained in:
parent
3281add6b5
commit
da42500df7
4 changed files with 27 additions and 14 deletions
|
@ -15,6 +15,7 @@ scenarios_DATA = simple_seeks.scenario \
|
||||||
force_key_unit.scenario\
|
force_key_unit.scenario\
|
||||||
seek_with_stop.scenario\
|
seek_with_stop.scenario\
|
||||||
switch_audio_track_while_paused.scenario\
|
switch_audio_track_while_paused.scenario\
|
||||||
|
switch_subtitle_track.scenario\
|
||||||
switch_audio_track.scenario
|
switch_audio_track.scenario
|
||||||
|
|
||||||
EXTRA_DIST = simple_seeks.scenario \
|
EXTRA_DIST = simple_seeks.scenario \
|
||||||
|
@ -33,4 +34,5 @@ EXTRA_DIST = simple_seeks.scenario \
|
||||||
force_key_unit.scenario\
|
force_key_unit.scenario\
|
||||||
seek_with_stop.scenario\
|
seek_with_stop.scenario\
|
||||||
switch_audio_track_while_paused.scenario\
|
switch_audio_track_while_paused.scenario\
|
||||||
|
switch_subtitle_track.scenario\
|
||||||
switch_audio_track.scenario
|
switch_audio_track.scenario
|
||||||
|
|
3
validate/data/switch_subtitle_track.scenario
Normal file
3
validate/data/switch_subtitle_track.scenario
Normal file
|
@ -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
|
|
@ -62,13 +62,13 @@ class MediaDescriptor(Loggable):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def get_num_audio_tracks(self):
|
def get_num_tracks(self, track_type):
|
||||||
naudio = 0
|
n = 0
|
||||||
for stream in self.media_xml.findall("streams")[0].findall("stream"):
|
for stream in self.media_xml.findall("streams")[0].findall("stream"):
|
||||||
if stream.attrib["type"] == "audio":
|
if stream.attrib["type"] == track_type:
|
||||||
naudio += 1
|
n += 1
|
||||||
|
|
||||||
return naudio
|
return n
|
||||||
|
|
||||||
def is_compatible(self, scenario):
|
def is_compatible(self, scenario):
|
||||||
if scenario.seeks() and (not self.is_seekable() or self.is_image()):
|
if scenario.seeks() and (not self.is_seekable() or self.is_image()):
|
||||||
|
@ -76,11 +76,13 @@ class MediaDescriptor(Loggable):
|
||||||
scenario, self.get_uri())
|
scenario, self.get_uri())
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if self.get_num_audio_tracks() < scenario.get_min_audio_tracks():
|
for track_type in ['audio', 'subtitle']:
|
||||||
self.debug("%s -- %s | At least %s audio track needed < %s"
|
if self.get_num_tracks(track_type) < scenario.get_min_tracks(track_type):
|
||||||
% (scenario, self.get_uri(),
|
self.debug("%s -- %s | At least %s %s track needed < %s"
|
||||||
scenario.get_min_audio_tracks(), self.get_num_audio_tracks()))
|
% (scenario, self.get_uri(), track_type,
|
||||||
return False
|
scenario.get_min_tracks(track_type),
|
||||||
|
self.get_num_tracks(track_type)))
|
||||||
|
return False
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -155,6 +157,7 @@ G_V_SCENARIOS = {Protocols.FILE: ["play_15s",
|
||||||
"seek_with_stop",
|
"seek_with_stop",
|
||||||
"switch_audio_track",
|
"switch_audio_track",
|
||||||
"switch_audio_track_while_paused",
|
"switch_audio_track_while_paused",
|
||||||
|
"switch_subtitle_track",
|
||||||
"scrub_forward_seeking"],
|
"scrub_forward_seeking"],
|
||||||
Protocols.HTTP: ["play_15s",
|
Protocols.HTTP: ["play_15s",
|
||||||
"fast_forward",
|
"fast_forward",
|
||||||
|
@ -163,6 +166,7 @@ G_V_SCENARIOS = {Protocols.FILE: ["play_15s",
|
||||||
"seek_with_stop",
|
"seek_with_stop",
|
||||||
"switch_audio_track",
|
"switch_audio_track",
|
||||||
"switch_audio_track_while_paused",
|
"switch_audio_track_while_paused",
|
||||||
|
"switch_subtitle_track",
|
||||||
"reverse_playback"],
|
"reverse_playback"],
|
||||||
Protocols.HLS: ["play_15s",
|
Protocols.HLS: ["play_15s",
|
||||||
"fast_forward",
|
"fast_forward",
|
||||||
|
@ -170,6 +174,7 @@ G_V_SCENARIOS = {Protocols.FILE: ["play_15s",
|
||||||
"seek_with_stop",
|
"seek_with_stop",
|
||||||
"switch_audio_track",
|
"switch_audio_track",
|
||||||
"switch_audio_track_while_paused",
|
"switch_audio_track_while_paused",
|
||||||
|
"switch_subtitle_track",
|
||||||
"seek_backward"],
|
"seek_backward"],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -678,11 +678,14 @@ class Scenario(object):
|
||||||
if hasattr(self, "reverse_playback"):
|
if hasattr(self, "reverse_playback"):
|
||||||
return bool(self.seek)
|
return bool(self.seek)
|
||||||
|
|
||||||
|
return False
|
||||||
|
|
||||||
def get_min_audio_tracks(self):
|
|
||||||
if hasattr(self, "min_audio_track"):
|
def get_min_tracks(self, track_type):
|
||||||
return int(self.min_audio_track)
|
try:
|
||||||
return 0
|
return int(getattr(self, "min_%s_track" % track_type))
|
||||||
|
except AttributeError:
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
class ScenarioManager(Loggable):
|
class ScenarioManager(Loggable):
|
||||||
|
|
Loading…
Reference in a new issue