1 # -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python
3 # Copyright (c) 2015,Thibault Saunier <thibault.saunier@collabora.com>
4 # 2015,Vineeth T M <vineeth.tm@samsung.com>
6 # This program is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU Lesser General Public
8 # License as published by the Free Software Foundation; either
9 # version 2.1 of the License, or (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # Lesser General Public License for more details.
16 # You should have received a copy of the GNU Lesser General Public
17 # License along with this program; if not, write to the
18 # Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
19 # Boston, MA 02110-1301, USA.
22 The GstValidate default testsuite
27 gi.require_version("Gst", "1.0")
29 from gi.repository import Gst # noqa
30 from gi.repository import GObject # noqa
32 TEST_MANAGER = "validate"
35 "validateelements.launch_pipeline.videocropbottom=2147483647.play_15s issues": {
37 "validateelements.launch_pipeline.videocropbottom=2147483647.play_15s"
41 "issue-id": "runtime::not-negotiated",
42 "summary": "a NOT NEGOTIATED message has been posted on the bus.",
44 "detected-on": "pipeline0",
49 "validateelements.launch_pipeline.videocropleft=2147483647.play_15s issues": {
51 "validateelements.launch_pipeline.videocropleft=2147483647.play_15s"
55 "issue-id": "runtime::not-negotiated",
56 "summary": "a NOT NEGOTIATED message has been posted on the bus.",
58 "detected-on": "pipeline0",
63 "validateelements.launch_pipeline.videocropright=2147483647.play_15s issues": {
65 "validateelements.launch_pipeline.videocropright=2147483647.play_15s"
69 "issue-id": "runtime::not-negotiated",
70 "summary": "a NOT NEGOTIATED message has been posted on the bus.",
72 "detected-on": "pipeline0",
77 "validateelements.launch_pipeline.videocroptop=2147483647.play_15s issues": {
79 "validateelements.launch_pipeline.videocroptop=2147483647.play_15s"
83 "issue-id": "runtime::not-negotiated",
84 "summary": "a NOT NEGOTIATED message has been posted on the bus.",
86 "detected-on": "pipeline0",
91 "validateelements.launch_pipeline.avwaitrecording=False.play_15s issues": {
93 "validateelements.launch_pipeline.avwaitrecording=False.play_15s"
102 "validateelements.launch_pipeline.avwaitrecording=True.play_15s issues": {
104 "validateelements.launch_pipeline.avwaitrecording=True.play_15s"
113 "validateelements.launch_pipeline.avwaittarget-running-time=0.play_15s issues": {
115 "validateelements.launch_pipeline.avwaittarget-running-time=0.play_15s"
124 "validateelements.launch_pipeline.avwaittarget-running-time=18446744073709551615.play_15s issues": {
126 "validateelements.launch_pipeline.avwaittarget-running-time=18446744073709551615.play_15s"
135 "validateelements.launch_pipeline.cvsmoothkernel-height=2147483647.play_15s issues": {
136 "tests": ["validateelements.launch_pipeline.cvsmoothkernel-height=2147483647.play_15s issues"],
144 "validateelements.launch_pipeline.cvsmoothkernel-width=2147483647.play_15s issues": {
145 "tests": ["validateelements.launch_pipeline.cvsmoothkernel-width=2147483647.play_15s issues"],
153 "validateelements.launch_pipeline.rawaudioparsenum-channels=2147483647.play_15s issues": {
155 "validateelements.launch_pipeline.rawaudioparsenum-channels=2147483647.play_15s"
159 "issue-id": "g-log::critical",
160 "summary": "We got a g_log critical issue",
162 "detected-on": "pipeline0"
165 "issue-id": "runtime::error-on-bus",
166 "summary": "We got an ERROR message on the bus",
168 "detected-on": "pipeline0"
172 "validateelements.launch_pipeline.rawvideoparseframe-size=4294967295.play_15s issues": {
174 "validateelements.launch_pipeline.rawvideoparseframe-size=4294967295.play_15s"
178 "issue-id": "runtime::error-on-bus",
179 "summary": "We got an ERROR message on the bus",
181 "detected-on": "pipeline0"
185 "validateelements.launch_pipeline.rawvideoparseheight=0.play_15s issues": {
187 "validateelements.launch_pipeline.rawvideoparseheight=0.play_15s"
191 "issue-id": "runtime::not-negotiated",
192 "summary": "a NOT NEGOTIATED message has been posted on the bus.",
194 "detected-on": "pipeline0"
197 "issue-id": "runtime::error-on-bus",
198 "summary": "We got an ERROR message on the bus",
200 "detected-on": "pipeline0"
204 "validateelements.launch_pipeline.rawvideoparseheight=2147483647.play_15s issues": {
206 "validateelements.launch_pipeline.rawvideoparseheight=2147483647.play_15s"
210 "issue-id": "runtime::not-negotiated",
211 "summary": "a NOT NEGOTIATED message has been posted on the bus.",
213 "detected-on": "pipeline0"
216 "issue-id": "runtime::error-on-bus",
217 "summary": "We got an ERROR message on the bus",
219 "detected-on": "pipeline0"
223 "validateelements.launch_pipeline.rawvideoparsewidth=0.play_15s issues": {
225 "validateelements.launch_pipeline.rawvideoparsewidth=0.play_15s"
229 "issue-id": "runtime::not-negotiated",
230 "summary": "a NOT NEGOTIATED message has been posted on the bus.",
232 "detected-on": "pipeline0"
235 "issue-id": "runtime::error-on-bus",
236 "summary": "We got an ERROR message on the bus",
238 "detected-on": "pipeline0"
242 "validateelements.launch_pipeline.rawvideoparsewidth=2147483647.play_15s issues": {
244 "validateelements.launch_pipeline.rawvideoparsewidth=2147483647.play_15s"
248 "issue-id": "runtime::not-negotiated",
249 "summary": "a NOT NEGOTIATED message has been posted on the bus.",
251 "detected-on": "pipeline0"
254 "issue-id": "runtime::error-on-bus",
255 "summary": "We got an ERROR message on the bus",
257 "detected-on": "pipeline0"
261 "validateelements.launch_pipeline.shapewipeborder=0.0.play_15s issues": {
263 "validateelements.launch_pipeline.shapewipeborder=0.0.play_15s"
272 "validateelements.launch_pipeline.shapewipeborder=1.0.play_15s issues": {
274 "validateelements.launch_pipeline.shapewipeborder=1.0.play_15s"
283 "validateelements.launch_pipeline.shapewipeposition=0.0.play_15s issues": {
285 "validateelements.launch_pipeline.shapewipeposition=0.0.play_15s"
294 "validateelements.launch_pipeline.shapewipeposition=1.0.play_15s issues": {
296 "validateelements.launch_pipeline.shapewipeposition=1.0.play_15s"
305 "validateelements.launch_pipeline.videoraterate=0.0.play_15s issues": {
307 "validateelements.launch_pipeline.videoraterate=0.0.play_15s"
316 "validateelements.launch_pipeline.webrtcdspcompression-gain-db=0.play_15s issues": {
318 "validateelements.launch_pipeline.webrtcdspcompression-gain-db=0.play_15s"
322 "issue-id": "runtime::error-on-bus",
323 "summary": "We got an ERROR message on the bus",
325 "detected-on": "pipeline0"
329 "validateelements.launch_pipeline.webrtcdspcompression-gain-db=9.play_15s issues": {
331 "validateelements.launch_pipeline.webrtcdspcompression-gain-db=9.play_15s"
335 "issue-id": "runtime::error-on-bus",
336 "summary": "We got an ERROR message on the bus",
338 "detected-on": "pipeline0"
342 "validateelements.launch_pipeline.webrtcdspcompression-gain-db=90.play_15s issues": {
344 "validateelements.launch_pipeline.webrtcdspcompression-gain-db=90.play_15s"
348 "issue-id": "runtime::error-on-bus",
349 "summary": "We got an ERROR message on the bus",
351 "detected-on": "pipeline0"
355 "validateelements.launch_pipeline.webrtcdspdelay-agnostic=False.play_15s issues": {
357 "validateelements.launch_pipeline.webrtcdspdelay-agnostic=False.play_15s"
361 "issue-id": "runtime::error-on-bus",
362 "summary": "We got an ERROR message on the bus",
364 "detected-on": "pipeline0"
368 "validateelements.launch_pipeline.webrtcdspdelay-agnostic=True.play_15s issues": {
370 "validateelements.launch_pipeline.webrtcdspdelay-agnostic=True.play_15s"
374 "issue-id": "runtime::error-on-bus",
375 "summary": "We got an ERROR message on the bus",
377 "detected-on": "pipeline0"
381 "validateelements.launch_pipeline.webrtcdspecho-cancel=True.play_15s issues": {
383 "validateelements.launch_pipeline.webrtcdspecho-cancel=True.play_15s"
387 "issue-id": "runtime::error-on-bus",
388 "summary": "We got an ERROR message on the bus",
390 "detected-on": "pipeline0"
394 "validateelements.launch_pipeline.webrtcdspexperimental-agc=False.play_15s issues": {
396 "validateelements.launch_pipeline.webrtcdspexperimental-agc=False.play_15s"
400 "issue-id": "runtime::error-on-bus",
401 "summary": "We got an ERROR message on the bus",
403 "detected-on": "pipeline0"
407 "validateelements.launch_pipeline.webrtcdspexperimental-agc=True.play_15s issues": {
409 "validateelements.launch_pipeline.webrtcdspexperimental-agc=True.play_15s"
413 "issue-id": "runtime::error-on-bus",
414 "summary": "We got an ERROR message on the bus",
416 "detected-on": "pipeline0"
420 "validateelements.launch_pipeline.webrtcdspextended-filter=False.play_15s issues": {
422 "validateelements.launch_pipeline.webrtcdspextended-filter=False.play_15s"
426 "issue-id": "runtime::error-on-bus",
427 "summary": "We got an ERROR message on the bus",
429 "detected-on": "pipeline0"
433 "validateelements.launch_pipeline.webrtcdspextended-filter=True.play_15s issues": {
435 "validateelements.launch_pipeline.webrtcdspextended-filter=True.play_15s"
439 "issue-id": "runtime::error-on-bus",
440 "summary": "We got an ERROR message on the bus",
442 "detected-on": "pipeline0"
446 "validateelements.launch_pipeline.webrtcdspgain-control=False.play_15s issues": {
448 "validateelements.launch_pipeline.webrtcdspgain-control=False.play_15s"
452 "issue-id": "runtime::error-on-bus",
453 "summary": "We got an ERROR message on the bus",
455 "detected-on": "pipeline0"
459 "validateelements.launch_pipeline.webrtcdspgain-control=True.play_15s issues": {
461 "validateelements.launch_pipeline.webrtcdspgain-control=True.play_15s"
465 "issue-id": "runtime::error-on-bus",
466 "summary": "We got an ERROR message on the bus",
468 "detected-on": "pipeline0"
472 "validateelements.launch_pipeline.webrtcdsphigh-pass-filter=False.play_15s issues": {
474 "validateelements.launch_pipeline.webrtcdsphigh-pass-filter=False.play_15s"
478 "issue-id": "runtime::error-on-bus",
479 "summary": "We got an ERROR message on the bus",
481 "detected-on": "pipeline0"
485 "validateelements.launch_pipeline.webrtcdsphigh-pass-filter=True.play_15s issues": {
487 "validateelements.launch_pipeline.webrtcdsphigh-pass-filter=True.play_15s"
491 "issue-id": "runtime::error-on-bus",
492 "summary": "We got an ERROR message on the bus",
494 "detected-on": "pipeline0"
498 "validateelements.launch_pipeline.webrtcdsplimiter=False.play_15s issues": {
500 "validateelements.launch_pipeline.webrtcdsplimiter=False.play_15s"
504 "issue-id": "runtime::error-on-bus",
505 "summary": "We got an ERROR message on the bus",
507 "detected-on": "pipeline0"
511 "validateelements.launch_pipeline.webrtcdsplimiter=True.play_15s issues": {
513 "validateelements.launch_pipeline.webrtcdsplimiter=True.play_15s"
517 "issue-id": "runtime::error-on-bus",
518 "summary": "We got an ERROR message on the bus",
520 "detected-on": "pipeline0"
524 "validateelements.launch_pipeline.webrtcdspnoise-suppression=False.play_15s issues": {
526 "validateelements.launch_pipeline.webrtcdspnoise-suppression=False.play_15s"
530 "issue-id": "runtime::error-on-bus",
531 "summary": "We got an ERROR message on the bus",
533 "detected-on": "pipeline0"
537 "validateelements.launch_pipeline.webrtcdspnoise-suppression=True.play_15s issues": {
539 "validateelements.launch_pipeline.webrtcdspnoise-suppression=True.play_15s"
543 "issue-id": "runtime::error-on-bus",
544 "summary": "We got an ERROR message on the bus",
546 "detected-on": "pipeline0"
550 "validateelements.launch_pipeline.webrtcdspstartup-min-volume=12.play_15s issues": {
552 "validateelements.launch_pipeline.webrtcdspstartup-min-volume=12.play_15s"
556 "issue-id": "runtime::error-on-bus",
557 "summary": "We got an ERROR message on the bus",
559 "detected-on": "pipeline0"
563 "validateelements.launch_pipeline.webrtcdspstartup-min-volume=255.play_15s issues": {
565 "validateelements.launch_pipeline.webrtcdspstartup-min-volume=255.play_15s"
569 "issue-id": "runtime::error-on-bus",
570 "summary": "We got an ERROR message on the bus",
572 "detected-on": "pipeline0"
576 "validateelements.launch_pipeline.webrtcdsptarget-level-dbfs=0.play_15s issues": {
578 "validateelements.launch_pipeline.webrtcdsptarget-level-dbfs=0.play_15s"
582 "issue-id": "runtime::error-on-bus",
583 "summary": "We got an ERROR message on the bus",
585 "detected-on": "pipeline0"
589 "validateelements.launch_pipeline.webrtcdsptarget-level-dbfs=3.play_15s issues": {
591 "validateelements.launch_pipeline.webrtcdsptarget-level-dbfs=3.play_15s"
595 "issue-id": "runtime::error-on-bus",
596 "summary": "We got an ERROR message on the bus",
598 "detected-on": "pipeline0"
602 "validateelements.launch_pipeline.webrtcdsptarget-level-dbfs=31.play_15s issues": {
604 "validateelements.launch_pipeline.webrtcdsptarget-level-dbfs=31.play_15s"
608 "issue-id": "runtime::error-on-bus",
609 "summary": "We got an ERROR message on the bus",
611 "detected-on": "pipeline0"
615 "validateelements.launch_pipeline.webrtcdspvoice-detection-frame-size-ms=10.play_15s issues": {
617 "validateelements.launch_pipeline.webrtcdspvoice-detection-frame-size-ms=10.play_15s"
621 "issue-id": "runtime::error-on-bus",
622 "summary": "We got an ERROR message on the bus",
624 "detected-on": "pipeline0"
628 "validateelements.launch_pipeline.webrtcdspvoice-detection-frame-size-ms=30.play_15s issues": {
630 "validateelements.launch_pipeline.webrtcdspvoice-detection-frame-size-ms=30.play_15s"
634 "issue-id": "runtime::error-on-bus",
635 "summary": "We got an ERROR message on the bus",
637 "detected-on": "pipeline0"
641 "validateelements.launch_pipeline.webrtcdspvoice-detection=False.play_15s issues": {
643 "validateelements.launch_pipeline.webrtcdspvoice-detection=False.play_15s"
647 "issue-id": "runtime::error-on-bus",
648 "summary": "We got an ERROR message on the bus",
650 "detected-on": "pipeline0"
654 "validateelements.launch_pipeline.webrtcdspvoice-detection=True.play_15s issues": {
656 "validateelements.launch_pipeline.webrtcdspvoice-detection=True.play_15s"
660 "issue-id": "runtime::error-on-bus",
661 "summary": "We got an ERROR message on the bus",
663 "detected-on": "pipeline0"
667 "validateelements.launch_pipeline.cameracalibratedelay=2147483647.play_15s issues": {
668 "tests": ["validateelements.launch_pipeline.cameracalibratedelay=2147483647.play_15s issues"],
679 def pspec_is_numeric(prop):
680 return prop.value_type in [GObject.TYPE_INT, GObject.TYPE_INT64,
681 GObject.TYPE_UINT, GObject.TYPE_UINT64,
682 GObject.TYPE_LONG, GObject.TYPE_ULONG,
687 def get_pipe_and_populate(test_manager, klass, fname, prop, loop):
688 prop_value = Gst.ElementFactory.make(fname, None).get_property(prop.name)
690 if prop.value_type == GObject.TYPE_BOOLEAN:
695 cname = fname + " %s=%s" % (prop.name, bool_value)
696 tname = fname + "%s=%s" % (prop.name, bool_value)
697 elif pspec_is_numeric(prop):
699 int_value = prop.default_value
701 int_value = prop.minimum
703 int_value = prop.maximum
704 cname = fname + " %s=%s" % (prop.name, int_value)
705 tname = fname + "%s=%s" % (prop.name, int_value)
707 cname = fname + " %s=%s" % (prop.name, prop_value)
708 tname = fname + "%s=%s" % (prop.name, prop_value)
711 cpipe = "audiotestsrc num-buffers=20 ! %s " % (cname)
712 sink = "! audioconvert ! %(audiosink)s"
713 elif "Video" in klass:
715 cname = "glfilterbin filter = %s" % (cname)
716 cpipe = "videotestsrc num-buffers=20 ! %s " % (cname)
717 sink = "! videoconvert ! %(videosink)s"
721 if test_manager.options.mute:
722 cpipe += "! fakesink"
724 cpipe += "%s" % (sink)
726 return (tname, cpipe)
729 def setup_tests(test_manager, options):
730 print("Setting up tests to validate all elements")
731 pipelines_descriptions = []
732 test_manager.add_expected_issues(KNOWN_ISSUES)
733 test_manager.set_default_blacklist([
734 ("validateelements.launch_pipeline.videobox*",
735 "Those are broken pipelines."),
736 ("validateelements.launch_pipeline.frei0r*",
737 "video filter plugins"),
738 ("validateelements.launch_pipeline.smpte*",
739 "smpte cannot be tested with simple pipeline. Hence excluding"),
740 ("validateelements.launch_pipeline.glfilterbin*",
741 "glfilter bin doesnt launch."),
742 ("validateelements.launch_pipeline.audiomixmatrix*",
743 "Now deprecated and requires specific properties to be set."),
745 valid_scenarios = ["play_15s"]
747 factories = Gst.Registry.get().get_feature_list(Gst.ElementFactory)
748 for element_factory in factories:
753 klass = element_factory.get_metadata("klass")
754 fname = element_factory.get_name()
756 if "Audio" not in klass and "Video" not in klass:
759 padstemplates = element_factory.get_static_pad_templates()
760 for padtemplate in padstemplates:
761 if padtemplate.static_caps.string:
762 caps = padtemplate.get_caps()
763 for i in range(caps.get_size()):
764 structure = caps.get_structure(i)
765 if "audio/x-raw" in structure.get_name():
766 if padtemplate.direction == Gst.PadDirection.SRC:
768 elif padtemplate.direction == Gst.PadDirection.SINK:
770 elif "video/x-raw" in structure.get_name():
771 if padtemplate.direction == Gst.PadDirection.SRC:
773 elif padtemplate.direction == Gst.PadDirection.SINK:
776 if (audiosink is False and videosink is False) or (audiosrc is False and videosrc is False):
779 element = Gst.ElementFactory.make(fname, None)
781 print("Could not create element: %s" % fname)
784 props = GObject.list_properties(element)
786 if "name" in prop.name or "parent" in prop.name or "qos" in prop.name or \
787 "latency" in prop.name or "message-forward" in prop.name:
789 if (prop.flags & GObject.ParamFlags.WRITABLE) and \
790 (prop.flags & GObject.ParamFlags.READABLE):
791 if prop.value_type == GObject.TYPE_BOOLEAN:
793 elif pspec_is_numeric(prop):
800 description = get_pipe_and_populate(test_manager, klass,
802 if None is not description:
803 pipelines_descriptions.append(description)
805 # No restriction about scenarios that are potentially used
806 test_manager.add_scenarios(valid_scenarios)
807 test_manager.add_generators(test_manager.GstValidatePipelineTestsGenerator
808 ("validate_elements", test_manager,
809 pipelines_descriptions=pipelines_descriptions,
810 valid_scenarios=valid_scenarios))