diff options
Diffstat (limited to 'voctocore/experiments/shmsrc.py')
-rw-r--r-- | voctocore/experiments/shmsrc.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/voctocore/experiments/shmsrc.py b/voctocore/experiments/shmsrc.py new file mode 100644 index 0000000..e9dd23a --- /dev/null +++ b/voctocore/experiments/shmsrc.py @@ -0,0 +1,27 @@ +#!/usr/bin/python3 +from gi.repository import GObject, Gst + +class ShmSrc(Gst.Bin): + def __init__(self, socket, caps): + super().__init__() + + # Create elements + self.shmsrc = Gst.ElementFactory.make('shmsrc', None) + self.caps = Gst.ElementFactory.make('capsfilter', None) + + # Add elements to Bin + self.add(self.shmsrc) + self.add(self.caps) + + # Set properties + self.shmsrc.set_property('socket-path', socket) + self.shmsrc.set_property('is-live', True) + self.shmsrc.set_property('do-timestamp', True) + + self.caps.set_property('caps', caps) + self.shmsrc.link(self.caps) + + # Add Ghost Pads + self.add_pad( + Gst.GhostPad.new('sink', self.caps.get_static_pad('src')) + ) |