aboutsummaryrefslogtreecommitdiff
path: root/voctocore/experiments/shmsrc.py
blob: 5cb7304e12018dba12c28b36d580274036cf7556 (plain)
  1. #!/usr/bin/python3
  2. from gi.repository import GObject, Gst
  3. class ShmSrc(Gst.Bin):
  4. def __init__(self, socket, caps):
  5. super().__init__()
  6. # Create elements
  7. self.shmsrc = Gst.ElementFactory.make('shmsrc', None)
  8. self.caps = Gst.ElementFactory.make('capsfilter', None)
  9. # Add elements to Bin
  10. self.add(self.shmsrc)
  11. self.add(self.caps)
  12. # Set properties
  13. self.shmsrc.set_property('socket-path', socket)
  14. self.shmsrc.set_property('is-live', True)
  15. self.shmsrc.set_property('do-timestamp', True)
  16. self.caps.set_property('caps', caps)
  17. self.shmsrc.link(self.caps)
  18. self.shmsrc.get_static_pad('src').add_probe(Gst.PadProbeType.BLOCK | Gst.PadProbeType.EVENT_BOTH, self.event_probe, None)
  19. # Add Ghost Pads
  20. self.add_pad(
  21. Gst.GhostPad.new('sink', self.caps.get_static_pad('src'))
  22. )
  23. def event_probe(self, pad, info, ud):
  24. print("event_probe")