summaryrefslogtreecommitdiff
path: root/voctocore/experiments/shmsrc.py
diff options
context:
space:
mode:
authorMaZderMind <github@mazdermind.de>2014-08-11 21:53:25 +0200
committerMaZderMind <github@mazdermind.de>2014-08-11 21:53:25 +0200
commit95cefc34d05a36c523ae74d340b95d67a930e856 (patch)
treec914388388e71dab8692b5d6155c0d886a05ba32 /voctocore/experiments/shmsrc.py
parentf2edaccd1c3aac10c20d30a1f30fa11f226e6ffa (diff)
implement grabbersrc via shm
Diffstat (limited to 'voctocore/experiments/shmsrc.py')
-rw-r--r--voctocore/experiments/shmsrc.py27
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'))
+ )