projects
/
experiments
/
gstreamer.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
python: update python examples to modern python, Gst, and Glib versions
[experiments/gstreamer.git]
/
python
/
gst-trick-mode-looping-1.py
diff --git
a/python/gst-trick-mode-looping-1.py
b/python/gst-trick-mode-looping-1.py
index
5a14848
..
9d4ecbd
100755
(executable)
--- a/
python/gst-trick-mode-looping-1.py
+++ b/
python/gst-trick-mode-looping-1.py
@@
-1,4
+1,4
@@
-#!/usr/bin/env python
+#!/usr/bin/env python
3
#
# A simple "trick-mode" looping player.
# Version 1, based on EOS handling.
#
# A simple "trick-mode" looping player.
# Version 1, based on EOS handling.
@@
-13,8
+13,7
@@
gi.require_version('Gst', '1.0')
from gi.repository import Gst
Gst.init(None)
from gi.repository import Gst
Gst.init(None)
-from gi.repository import GObject
-GObject.threads_init()
+from gi.repository import GLib
class Player:
class Player:
@@
-32,7
+31,7
@@
class Player:
def run(self):
self._player.set_state(Gst.State.PLAYING)
def run(self):
self._player.set_state(Gst.State.PLAYING)
- self.loop = G
Object
.MainLoop()
+ self.loop = G
Lib
.MainLoop()
self.loop.run()
def quit(self):
self.loop.run()
def quit(self):
@@
-45,16
+44,16
@@
class Player:
def on_error(self, bus, msg):
(err, debug) = msg.parse_error()
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
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()
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)
if old_state == Gst.State.READY and new_state == Gst.State.PAUSED:
self.set_rate(self._rate)