-#!/usr/bin/env python
+#!/usr/bin/env python3
#
# A simple "trick-mode" looping player.
# Version 3, based on segment seeking.
from gi.repository import Gst
Gst.init(None)
-from gi.repository import GObject
-GObject.threads_init()
+from gi.repository import GLib
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):
def on_error(self, bus, msg):
(err, debug) = msg.parse_error()
- print "Error: %s" % err, debug
+ print("Error: %s" % err, debug)
self.quit()
def on_state_changed(self, bus, msg):
if msg.src != self._player:
return
- print 'on_state_changed'
+ print('on_state_changed')
old_state, new_state, pending = msg.parse_state_changed()
- print "%s -> %s" % (old_state, new_state)
+ print("%s -> %s" % (old_state, new_state))
if old_state == Gst.State.READY and new_state == Gst.State.PAUSED:
self.set_rate(self._rate)