validate:launcher: Factorize code to get a MediaDescriptor name for classname

Instead of copy/pasting that code badly
This commit is contained in:
Thibault Saunier 2014-09-12 10:47:18 +02:00
parent 490a8f1ed9
commit b856d5985c
2 changed files with 7 additions and 6 deletions

View file

@ -94,12 +94,9 @@ class GstValidateTranscodingTestsGenerator(GstValidateTestsGenerator):
continue
for comb in self.test_manager.get_encoding_formats():
suffix = os.path.basename (mediainfo.media_descriptor.get_path())
suffix = suffix.replace (".media_info", "")
suffix = suffix.replace (".stream_info", "")
classname = "validate.%s.transcode.to_%s.%s" % (mediainfo.media_descriptor.get_protocol(),
str(comb).replace(' ', '_'),
suffix.replace('.', '_'))
mediainfo.media_descriptor.get_clean_name())
self.add_test(GstValidateTranscodingTest(classname,
self.test_manager.options,
self.test_manager.reporter,
@ -184,8 +181,7 @@ class GstValidatePlaybinTestsGenerator(GstValidatePipelineTestsGenerator):
fname = "%s.%s" % (self.get_fname(scenario,
protocol),
os.path.basename(minfo.media_descriptor.get_path()).replace(".stream_info",
'').replace(".media_info", ''))
os.path.basename(minfo.media_descriptor.get_clean_name()))
self.debug("Adding: %s", fname)
if scenario.does_reverse_playback() and protocol == Protocols.HTTP:

View file

@ -1219,6 +1219,11 @@ class GstValidateMediaDescriptor(MediaDescriptor):
return n
def get_clean_name(self):
name = os.path.basename(self.get_path())
name = re.sub("\.stream_info|\.media_info", "", name)
return name.replace('.', "_")
class MediaFormatCombination(object):
_FORMATS = {"aac": "audio/mpeg,mpegversion=4",