validate:launcher Add video mixing tests

+ Move default_testsuite.py to validate_testsuite.py as we are now
exposing tests that are not enabled by default
This commit is contained in:
Thibault Saunier 2014-06-26 13:01:13 +02:00
parent af383ad0c0
commit 7d23d75edb
3 changed files with 121 additions and 3 deletions

View file

@ -2,5 +2,5 @@ appsdir = $(libdir)/gst-validate-launcher/python/launcher/apps/
apps_PYTHON = \ apps_PYTHON = \
ges-launch.py \ ges-launch.py \
validate_default_testsuite.py\ validate/validate_testsuite.py\
gst-validate.py gst-validate.py

View file

@ -256,6 +256,76 @@ class GstValidatePlaybinTestsGenerator(GstValidatePipelineTestsGenerator):
) )
class GstValidateMixerTestsGenerator(GstValidatePipelineTestsGenerator):
def __init__(self, name, test_manager, mixer, media_type, converter="", num_sources=3,
mixed_srcs={}, valid_scenarios=[]):
pipe_template = "%(mixer)s name=_mixer ! " + converter + " ! %(sink)s "
self.converter = converter
self.mixer = mixer
self.media_type = media_type
self.num_sources = num_sources
self.mixed_srcs = mixed_srcs
super(GstValidateMixerTestsGenerator, self).__init__(name, test_manager, pipe_template,
valid_scenarios=valid_scenarios)
def populate_tests(self, uri_minfo_special_scenarios, scenarios):
wanted_ressources = []
for uri, minfo, special_scenarios in uri_minfo_special_scenarios:
protocol = minfo.media_descriptor.get_protocol()
if protocol == Protocols.FILE and \
minfo.media_descriptor.get_num_tracks(self.media_type) > 0:
wanted_ressources.append((uri, minfo))
if not self.mixed_srcs:
if not wanted_ressources:
return
for i in range(len(uri_minfo_special_scenarios) / self.num_sources):
can_run = True
srcs = []
name = ""
for nsource in range(self.num_sources):
uri, minfo = wanted_ressources[i + nsource]
srcs.append("uridecodebin uri=%s ! %s" % (uri, self.converter))
fname = os.path.basename(uri).replace(".", "_")
if not name:
name = fname
else:
name += "+%s" % fname
self.mixed_srcs[name] = tuple(srcs)
for name, srcs in self.mixed_srcs.iteritems():
if isinstance(srcs, dict):
pipe_arguments = {"mixer": self.mixer + " %s" % srcs["mixer_props"]}
srcs = srcs["sources"]
else:
pipe_arguments = {"mixer": self.mixer}
if self.test_manager.options.mute:
pipe_arguments["sink"] = "'fakesink sync=true'"
else:
pipe_arguments["sink"] = "auto%ssink" % self.media_type
pipe = self._pipeline_template % pipe_arguments
for src in srcs:
pipe += "%s ! _mixer. " % src
for scenario in scenarios:
fname = self.get_fname(scenario, Protocols.FILE) + "."
fname += name
self.debug("Adding: %s", fname)
self.add_test(GstValidateLaunchTest(fname,
self.test_manager.options,
self.test_manager.reporter,
pipe,
scenario=scenario)
)
class GstValidateLaunchTest(GstValidateTest): class GstValidateLaunchTest(GstValidateTest):
def __init__(self, classname, options, reporter, pipeline_desc, def __init__(self, classname, options, reporter, pipeline_desc,
timeout=DEFAULT_TIMEOUT, scenario=None, media_descriptor=None): timeout=DEFAULT_TIMEOUT, scenario=None, media_descriptor=None):
@ -403,7 +473,7 @@ class GstValidateTestManager(GstValidateBaseTestManager):
self._run_defaults = True self._run_defaults = True
self._is_populated = False self._is_populated = False
execfile(os.path.join(os.path.dirname(__file__), "apps", execfile(os.path.join(os.path.dirname(__file__), "apps",
"validate_default_testsuite.py"), globals()) "validate", "validate_testsuite.py"), globals())
def init(self): def init(self):
if which(GST_VALIDATE_COMMAND) and which(GST_VALIDATE_TRANSCODING_COMMAND): if which(GST_VALIDATE_COMMAND) and which(GST_VALIDATE_TRANSCODING_COMMAND):
@ -422,7 +492,10 @@ not been tested and explicitely activated if you set use --wanted-tests ALL""")
return return
if not self.options.config: if not self.options.config:
if self._run_defaults:
self.register_defaults() self.register_defaults()
else:
self.register_all()
self._is_populated = True self._is_populated = True

View file

@ -20,6 +20,28 @@
# Boston, MA 02110-1301, USA. # Boston, MA 02110-1301, USA.
valid_mixing_scenarios=["play_15s",
"fast_forward",
"seek_forward",
"seek_backward",
"seek_with_stop",
"scrub_forward_seeking"]
def register_compositing_tests(self):
"""
Those tests are not activated in the default testsuite,
they should be activated in a configuration file.
"""
for compositor in ["compositor", "glmixer"]:
if gst_validate_checkout_element_present(compositor):
self.add_generators(GstValidateMixerTestsGenerator(compositor, self,
compositor,
"video",
converter="deinterlace ! videoconvert ! videorate ! videoscale ! video/x-raw,framerate=25/1,pixel-aspect-ratio=1/1",
valid_scenarios=valid_mixing_scenarios))
def register_default_test_generators(self): def register_default_test_generators(self):
""" """
Registers default test generators Registers default test generators
@ -28,6 +50,22 @@ def register_default_test_generators(self):
GstValidateMediaCheckTestsGenerator(self), GstValidateMediaCheckTestsGenerator(self),
GstValidateTranscodingTestsGenerator(self)]) GstValidateTranscodingTestsGenerator(self)])
for compositor in ["compositor", "glvideomixer"]:
self.add_generators(GstValidateMixerTestsGenerator(compositor + ".simple", self,
compositor,
"video",
converter="deinterlace ! videoconvert",
mixed_srcs= {
"synchronized": {"mixer_props": "sink_1::alpha=0.5 sink_1::xpos=50 sink_1::ypos=50",
"sources":
("videotestsrc pattern=snow timestamp-offset=3000000000 ! 'video/x-raw,format=AYUV,width=640,height=480,framerate=(fraction)30/1' ! timeoverlay",
"videotestsrc pattern=smpte ! 'video/x-raw,format=AYUV,width=800,height=600,framerate=(fraction)10/1' ! timeoverlay")},
"bgra":
("videotestsrc ! video/x-raw, framerate=\(fraction\)10/1, width=100, height=100",
"videotestsrc ! video/x-raw, framerate=\(fraction\)5/1, width=320, height=240")
},
valid_scenarios=valid_mixing_scenarios))
def register_default_scenarios(self): def register_default_scenarios(self):
""" """
@ -95,8 +133,15 @@ def register_defaults(self):
self.register_default_blacklist() self.register_default_blacklist()
self.register_default_test_generators() self.register_default_test_generators()
def register_all(self):
self.register_defaults()
self.register_compositing_tests()
try: try:
GstValidateTestManager.register_defaults = register_defaults GstValidateTestManager.register_defaults = register_defaults
GstValidateTestManager.register_all = register_all
GstValidateTestManager.register_default_blacklist = register_default_blacklist GstValidateTestManager.register_default_blacklist = register_default_blacklist
GstValidateTestManager.register_default_test_generators = register_default_test_generators GstValidateTestManager.register_default_test_generators = register_default_test_generators
GstValidateTestManager.register_default_scenarios = register_default_scenarios GstValidateTestManager.register_default_scenarios = register_default_scenarios