summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThibault Saunier <tsaunier@igalia.com>2019-05-06 11:29:53 -0400
committerThibault Saunier <tsaunier@igalia.com>2019-05-06 11:30:47 -0400
commit6fcd2c835fa9cfc4c61cdac654aafeaeb1bc1262 (patch)
treef9a6438521917c33bf4e7456c224fa8f24b7e97f
parent2e91b713f1098b6bf1438a72dcacd597e21b25c5 (diff)
override Element before Bin so we can access element fields of bins
And add a test See https://gitlab.gnome.org/GNOME/pygobject/issues/325
-rw-r--r--gi/overrides/Gst.py31
-rw-r--r--testsuite/test_gst.py7
2 files changed, 23 insertions, 15 deletions
diff --git a/gi/overrides/Gst.py b/gi/overrides/Gst.py
index 83b087c..bd4cd3b 100644
--- a/gi/overrides/Gst.py
+++ b/gi/overrides/Gst.py
@@ -56,6 +56,22 @@ python module to use with Gst 0.10"
warnings.warn(warn_msg, RuntimeWarning)
+
+class Element(Gst.Element):
+ @staticmethod
+ def link_many(*args):
+ '''
+ @raises: Gst.LinkError
+ '''
+ for pair in pairwise(args):
+ if not pair[0].link(pair[1]):
+ raise LinkError(
+ 'Failed to link {} and {}'.format(pair[0], pair[1]))
+
+Element = override(Element)
+__all__.append('Element')
+
+
class Bin(Gst.Bin):
def __init__(self, name=None):
Gst.Bin.__init__(self, name=name)
@@ -593,21 +609,6 @@ def pairwise(iterable):
return zip(a, b)
-class Element(Gst.Element):
- @staticmethod
- def link_many(*args):
- '''
- @raises: Gst.LinkError
- '''
- for pair in pairwise(args):
- if not pair[0].link(pair[1]):
- raise LinkError(
- 'Failed to link {} and {}'.format(pair[0], pair[1]))
-
-Element = override(Element)
-__all__.append('Element')
-
-
def TIME_ARGS(time):
if time == Gst.CLOCK_TIME_NONE:
return "CLOCK_TIME_NONE"
diff --git a/testsuite/test_gst.py b/testsuite/test_gst.py
index 7ca8f7a..d63f4e2 100644
--- a/testsuite/test_gst.py
+++ b/testsuite/test_gst.py
@@ -86,5 +86,12 @@ class TestStructure(TestCase):
test = Gst.Structure('test,test=1')
self.assertEqual(test['test'], 1)
+
+class TestBin(TestCase):
+
+ def test_add_pad(self):
+ Gst.init(None)
+ self.assertEqual(Gst.ElementFactory.make("bin", None).sinkpads, [])
+
if __name__ == "__main__":
unittest.main()