summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaZderMind <peter@mazdermind.de>2014-08-13 13:36:19 +0200
committerMaZderMind <peter@mazdermind.de>2014-08-13 13:36:19 +0200
commit4acaf2f5de7071b72db81b64fd10020e041cdabb (patch)
tree8417c8e19293c7cb4aa72baed607a1533d0654c6
parentb417822dea6b7d5becf46b97f51b75a4dd931cc7 (diff)
bind to downstream and data events
-rw-r--r--voctocore/experiments/shmsrc.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/voctocore/experiments/shmsrc.py b/voctocore/experiments/shmsrc.py
index 5cb7304..6fa8c30 100644
--- a/voctocore/experiments/shmsrc.py
+++ b/voctocore/experiments/shmsrc.py
@@ -20,7 +20,8 @@ class ShmSrc(Gst.Bin):
self.caps.set_property('caps', caps)
self.shmsrc.link(self.caps)
- self.shmsrc.get_static_pad('src').add_probe(Gst.PadProbeType.BLOCK | Gst.PadProbeType.EVENT_BOTH, self.event_probe, None)
+ self.shmsrc.get_static_pad('src').add_probe(Gst.PadProbeType.BLOCK | Gst.PadProbeType.EVENT_DOWNSTREAM, self.event_probe, None)
+ self.shmsrc.get_static_pad('src').add_probe(Gst.PadProbeType.IDLE | Gst.PadProbeType.DATA_DOWNSTREAM, self.data_probe, None)
# Add Ghost Pads
self.add_pad(
@@ -28,4 +29,13 @@ class ShmSrc(Gst.Bin):
)
def event_probe(self, pad, info, ud):
- print("event_probe")
+ e = info.get_event()
+ print("event_probe", e.type)
+ if e.type == Gst.EventType.EOS:
+ print("shmsrc reported EOS - switching to failover")
+ return Gst.PadProbeReturn.DROP
+ return Gst.PadProbeReturn.PASS
+
+ def data_probe(self, pad, info, ud):
+ print("shmsrc sends data - switching to shmsrc")
+ return Gst.PadProbeReturn.PASS