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 \
force_key_unit.scenario\
seek_with_stop.scenario\
switch_audio_track_while_paused.scenario\
+ switch_subtitle_track.scenario\
switch_audio_track.scenario
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()):
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
"seek_with_stop",
"switch_audio_track",
"switch_audio_track_while_paused",
+ "switch_subtitle_track",
"scrub_forward_seeking"],
Protocols.HTTP: ["play_15s",
"fast_forward",
"seek_with_stop",
"switch_audio_track",
"switch_audio_track_while_paused",
+ "switch_subtitle_track",
"reverse_playback"],
Protocols.HLS: ["play_15s",
"fast_forward",
"seek_with_stop",
"switch_audio_track",
"switch_audio_track_while_paused",
+ "switch_subtitle_track",
"seek_backward"],
}
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):