Added a dead simple example
authorEinar Jørgen Haraldseid <einar@haraldseid.net>
Sat, 3 Jun 2017 07:51:20 +0000 (09:51 +0200)
committerEinar Jørgen Haraldseid <einar@haraldseid.net>
Sat, 3 Jun 2017 07:51:20 +0000 (09:51 +0200)
example0.py [new file with mode: 0644]

diff --git a/example0.py b/example0.py
new file mode 100644 (file)
index 0000000..8254be8
--- /dev/null
@@ -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)