X-Git-Url: https://git.ao2.it/experiments/gstreamer.git/blobdiff_plain/bd161b37c12141ed5c311f03a560b5915ec08527..HEAD:/python/gst-looping-video-2.py diff --git a/python/gst-looping-video-2.py b/python/gst-looping-video-2.py index 074dbda..2976906 100755 --- a/python/gst-looping-video-2.py +++ b/python/gst-looping-video-2.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # A simple looping player. # Version 2, based on "about-to-finish" handling. @@ -13,14 +13,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, uri): self._uri = uri - self._player = Gst.ElementFactory.make("playbin", "player") + self._player = Gst.ElementFactory.make("playbin3", "player") self._player.set_property("uri", uri) self._player.connect("about-to-finish", self.on_about_to_finish) @@ -30,7 +29,7 @@ class Player: def run(self): self._player.set_state(Gst.State.PLAYING) - self.loop = GObject.MainLoop() + self.loop = GLib.MainLoop() self.loop.run() def quit(self): @@ -43,7 +42,7 @@ class Player: def on_error(self, bus, msg): (err, debug) = msg.parse_error() - print "Error: %s" % err, debug + print("Error: %s" % err, debug) self.quit()