From: Einar Jørgen Haraldseid Date: Sat, 3 Jun 2017 07:51:20 +0000 (+0200) Subject: Added a dead simple example X-Git-Url: https://git.slaskete.net/python-gstreamer-examples/commitdiff_plain/16da69ecfba52fe2221aa9b7132b74f7a1a82eb8?ds=inline Added a dead simple example --- diff --git a/example0.py b/example0.py new file mode 100644 index 0000000..8254be8 --- /dev/null +++ b/example0.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python +# An even simpler gstreamer example, omitting all that class stuff + +import gi, time +gi.require_version('Gst', '1.0') +from gi.repository import Gst + +# Create the gstreamer pipeline +Gst.init(None) +pipeline = Gst.Pipeline() + +# Audio source (src) +audio = Gst.ElementFactory.make("audiotestsrc") +pipeline.add(audio) + +# Audio output (sink) +pulsesink = Gst.ElementFactory.make("pulsesink") +pipeline.add(pulsesink) + +# Link our two elements together +audio.link(pulsesink) + +# Start the pipeline +pipeline.set_state(Gst.State.PLAYING) + +# Something to do while the pipeline is playing +while True: + time.sleep(0.001)