aboutsummaryrefslogtreecommitdiff
path: root/voctocore
diff options
context:
space:
mode:
authorMaZderMind <github@mazdermind.de>2015-05-24 20:10:52 +0200
committerMaZderMind <github@mazdermind.de>2015-05-24 20:10:52 +0200
commitaf37e85d4a9c8825773c22851c0008ba42a9e63a (patch)
tree0ce1cd4565af60e007efe51254ce596f4d1c6697 /voctocore
parent75da6856b600170f5903531584a0d3524cd76361 (diff)
involve a scaler and more properties to match the voctomix core more closely
Diffstat (limited to 'voctocore')
-rwxr-xr-xvoctocore/experiments/sync-videomix.py43
1 files changed, 36 insertions, 7 deletions
diff --git a/voctocore/experiments/sync-videomix.py b/voctocore/experiments/sync-videomix.py
index 0f6e780..1e17a2e 100755
--- a/voctocore/experiments/sync-videomix.py
+++ b/voctocore/experiments/sync-videomix.py
@@ -17,11 +17,15 @@ class Example:
pipeline = """
videotestsrc pattern=red !
{caps} !
+ videoscale !
+ capsfilter name=caps0 !
identity sync=true signal-handoffs=false !
mix.
videotestsrc pattern=green !
{caps} !
+ videoscale !
+ capsfilter name=caps1 !
identity sync=true signal-handoffs=false !
mix.
@@ -32,22 +36,47 @@ class Example:
pngenc !
multifilesink location=frame%04d.png
""".format(
- caps='video/x-raw,height=450,width=800,format=I420,framerate=25/1'
+ caps='video/x-raw,width=800,height=450,format=I420,framerate=25/1'
)
self.pipeline = Gst.parse_launch(pipeline)
sig = self.pipeline.get_by_name('sig')
sig.connect('handoff', self.handoff)
- self.mix = self.pipeline.get_by_name('mix')
- self.state = 0
+ self.pad0 = self.pipeline.get_by_name('mix').get_static_pad('sink_0')
+ self.pad1 = self.pipeline.get_by_name('mix').get_static_pad('sink_1')
+
+ self.caps0 = self.pipeline.get_by_name('caps0')
+ self.caps1 = self.pipeline.get_by_name('caps1')
+
+ self.state = False
def handoff(self, object, buffer):
- mixerpad = self.mix.get_static_pad('sink_1')
- print('handoff, alpha=%u' % self.state)
- mixerpad.set_property('alpha', self.state)
- self.state = 0 if self.state else 1
+ if self.state:
+ padA = self.pad0
+ padB = self.pad1
+ capsA = self.caps0
+ capsB = self.caps1
+ else:
+ padA = self.pad1
+ padB = self.pad0
+ capsA = self.caps1
+ capsB = self.caps0
+
+ padA.set_property('xpos', 10)
+ padA.set_property('ypos', 10)
+ padA.set_property('alpha', 1.0)
+ padA.set_property('zorder', 1)
+ capsA.set_property('caps', Gst.Caps.from_string('video/x-raw,width=400,height=225'))
+
+ padB.set_property('xpos', 390)
+ padB.set_property('ypos', 215)
+ padB.set_property('alpha', 1.0)
+ padB.set_property('zorder', 2)
+ capsB.set_property('caps', Gst.Caps.from_string('video/x-raw,width=400,height=225'))
+
+ self.state = not self.state
def run(self):
self.pipeline.set_state(Gst.State.PLAYING)