X-Git-Url: https://git.ao2.it/experiments/gstreamer.git/blobdiff_plain/bd161b37c12141ed5c311f03a560b5915ec08527..HEAD:/python/gst-playbin-switch.py diff --git a/python/gst-playbin-switch.py b/python/gst-playbin-switch.py index 85be7f2..0128a94 100755 --- a/python/gst-playbin-switch.py +++ b/python/gst-playbin-switch.py @@ -24,14 +24,13 @@ gi.require_version('Gst', '1.0') from gi.repository import Gst Gst.init(None) -from gi.repository import GObject -GObject.threads_init() +from gi.repository import GLib class Player: def __init__(self): - self.loop = GObject.MainLoop() - self.pipeline = Gst.ElementFactory.make("playbin", "player") + self.loop = GLib.MainLoop() + self.pipeline = Gst.ElementFactory.make("playbin3", "player") files = ["sample_440hz.webm", "sample_880hz.webm"] self.uris = [Gst.filename_to_uri(f) for f in files] @@ -97,7 +96,7 @@ def main(): player.on_switch() return True - GObject.io_add_watch(sys.stdin, GObject.IO_IN, stdin_cb) + GLib.io_add_watch(sys.stdin, GLib.IO_IN, stdin_cb) print("\nPress Enter to switch the source\n") player.run()