diff options
author | MaZderMind <peter@mazdermind.de> | 2014-09-04 07:52:53 +0200 |
---|---|---|
committer | MaZderMind <peter@mazdermind.de> | 2014-09-04 07:52:53 +0200 |
commit | 638f52635b788a4c43b232cc6d59be11ec6dab52 (patch) | |
tree | 222e904c13ec66de099b375958545d5ac4630596 | |
parent | f59b1f19172bb7e5187f91fd37a89d7cc9217795 (diff) |
optimize linking
-rw-r--r-- | voctocore/lib/shmsrc.py | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/voctocore/lib/shmsrc.py b/voctocore/lib/shmsrc.py index 76b95e8..64e3555 100644 --- a/voctocore/lib/shmsrc.py +++ b/voctocore/lib/shmsrc.py @@ -18,18 +18,18 @@ class FailsafeShmSrc(Gst.Bin): # Create elements self.shmsrc = Gst.ElementFactory.make('shmsrc', None) - self.identity1 = Gst.ElementFactory.make('identity', None) - self.identity2 = Gst.ElementFactory.make('identity', None) + self.capsfilter = Gst.ElementFactory.make('capsfilter', None) + self.failsrcsyncer = Gst.ElementFactory.make('identity', None) self.switch = Gst.ElementFactory.make('input-selector', None) self.failsrc = Gst.ElementFactory.make('videotestsrc', None) - if not self.shmsrc or not self.identity1 or not self.identity2 or not self.switch or not self.failsrc: + if not self.shmsrc or not self.capsfilter or not self.failsrcsyncer or not self.switch or not self.failsrc: self.log.error('could not create elements') # Add elements to Bin self.add(self.shmsrc) - self.add(self.identity1) - self.add(self.identity2) + self.add(self.capsfilter) + self.add(self.failsrcsyncer) self.add(self.switch) self.add(self.failsrc) @@ -41,15 +41,16 @@ class FailsafeShmSrc(Gst.Bin): self.shmsrc.set_property('socket-path', socket) self.shmsrc.set_property('is-live', True) self.shmsrc.set_property('do-timestamp', True) - self.identity2.set_property('sync', True) self.switch.set_property('active-pad', self.failpad) + self.failsrcsyncer.set_property('sync', True) + self.capsfilter.set_property('caps', caps) # Link elements - self.shmsrc.link_filtered(self.identity1, caps) - self.identity1.get_static_pad('src').link(self.goodpad) + self.shmsrc.link(self.capsfilter) + self.capsfilter.get_static_pad('src').link(self.goodpad) - self.failsrc.link_filtered(self.identity2, caps) - self.identity2.get_static_pad('src').link(self.failpad) + self.failsrc.link_filtered(self.failsrcsyncer, caps) + self.failsrcsyncer.get_static_pad('src').link(self.failpad) # Install pad probes self.shmsrc.get_static_pad('src').add_probe(Gst.PadProbeType.BLOCK | Gst.PadProbeType.EVENT_DOWNSTREAM, self.event_probe, None) |