summaryrefslogtreecommitdiff
path: root/voctocore/experiments/shmsrc.py
blob: e9dd23a6aac5dc199f9115d629d50b393c85fc7c (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. # Add Ghost Pads
  19. self.add_pad(
  20. Gst.GhostPad.new('sink', self.caps.get_static_pad('src'))
  21. )