From 98211a80e9edfc9ceb18535698204753b7e6585a Mon Sep 17 00:00:00 2001 From: Stefan Kost Date: Thu, 31 Jan 2008 19:57:26 +0000 Subject: [PATCH] examples/video-controller.py: Demo how to use the controller on videomixer. Original commit message from CVS: * examples/video-controller.py: Demo how to use the controller on videomixer. --- ChangeLog | 5 ++++ examples/video-controller.py | 44 ++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 examples/video-controller.py diff --git a/ChangeLog b/ChangeLog index 1218e31d05..d6b9ec2312 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-01-31 Stefan Kost + + * examples/video-controller.py: + Demo how to use the controller on videomixer. + 2008-01-31 Jan Schmidt * gst/.cvsignore: diff --git a/examples/video-controller.py b/examples/video-controller.py new file mode 100644 index 0000000000..4b561d1a65 --- /dev/null +++ b/examples/video-controller.py @@ -0,0 +1,44 @@ +#!/usr/bin/env python +# -*- Mode: Python -*- +# vi:si:et:sw=4:sts=4:ts=4 + +# videomixer-controller.py +# (c) 2008 Stefan Kost +# Test case for the GstController using videomixer and videotestsrc + +import pygst +pygst.require('0.10') +import gst +import time + +def main(): + pipeline = gst.Pipeline("videocontroller") + src = gst.element_factory_make("videotestsrc", "src") + mix = gst.element_factory_make("videomixer", "mix") + conv = gst.element_factory_make("ffmpegcolorspace", "conv") + sink = gst.element_factory_make("autovideosink", "sink") + pipeline.add(src, mix, conv, sink) + + spad = src.get_static_pad('src') + dpad = mix.get_request_pad('sink_%d') + + spad.link(dpad) + mix.link(conv) + conv.link(sink) + + control = gst.Controller(dpad, "xpos", "ypos") + control.set_interpolation_mode("xpos", gst.INTERPOLATE_LINEAR) + control.set_interpolation_mode("ypos", gst.INTERPOLATE_LINEAR) + + control.set("xpos", 0, 0) + control.set("xpos", 5 * gst.SECOND, 200) + + control.set("ypos", 0, 0) + control.set("ypos", 5 * gst.SECOND, 200) + + pipeline.set_state(gst.STATE_PLAYING) + + time.sleep(7) + +if __name__ == "__main__": + main()