summaryrefslogtreecommitdiff
path: root/voctocore/experiments/videodisplay.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/videodisplay.py
parentf2edaccd1c3aac10c20d30a1f30fa11f226e6ffa (diff)
implement grabbersrc via shm
Diffstat (limited to 'voctocore/experiments/videodisplay.py')
-rw-r--r--voctocore/experiments/videodisplay.py53
1 files changed, 53 insertions, 0 deletions
diff --git a/voctocore/experiments/videodisplay.py b/voctocore/experiments/videodisplay.py
new file mode 100644
index 0000000..57087da
--- /dev/null
+++ b/voctocore/experiments/videodisplay.py
@@ -0,0 +1,53 @@
+#!/usr/bin/python3
+from gi.repository import GObject, Gst
+
+class VideomixerWithDisplay(Gst.Bin):
+ def __init__(self):
+ super().__init__()
+
+ # Create elements
+ self.secondsrc = Gst.ElementFactory.make('videotestsrc', None)
+ self.mixer = Gst.ElementFactory.make('videomixer', None)
+ self.ident = Gst.ElementFactory.make('identity', None)
+ self.conv = Gst.ElementFactory.make('videoconvert', None)
+ self.q1 = Gst.ElementFactory.make('queue', None)
+ self.q2 = Gst.ElementFactory.make('queue', None)
+ self.display = Gst.ElementFactory.make('ximagesink', None)
+
+ # Add elements to Bin
+ self.add(self.secondsrc)
+ self.add(self.mixer)
+ self.add(self.ident)
+ self.add(self.conv)
+ self.add(self.display)
+ self.add(self.q1)
+ self.add(self.q2)
+
+ # Set properties
+ self.secondsrc.set_property('pattern', 'ball')
+ self.ident.set_property('sync', True)
+ self.display.set_property('sync', False)
+
+ # Request Pads
+ self.firstpad = self.mixer.get_request_pad('sink_%u')
+ self.secondpad = self.mixer.get_request_pad('sink_%u')
+
+ # Set pad-properties
+ self.secondpad.set_property('alpha', 0.75)
+ self.secondpad.set_property('xpos', 50)
+ self.secondpad.set_property('ypos', 50)
+
+ # Link elements
+ self.q1.get_static_pad('src').link(self.firstpad)
+
+ self.q2.get_static_pad('src').link(self.secondpad)
+ self.secondsrc.link_filtered(self.ident, Gst.Caps.from_string('video/x-raw,format=BGRA,width=400,height=400,framerate=25/1'))
+ self.ident.link(self.q2)
+
+ self.mixer.link(self.conv)
+ self.conv.link(self.display)
+
+ # Add Ghost Pads
+ self.add_pad(
+ Gst.GhostPad.new('sink', self.q1.get_static_pad('sink'))
+ )