projects
/
vidi-player.git
/ commitdiff
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
bd98d9d
)
vidi/Player.py: use per message callbacks
author
Antonio Ospite <ao2@ao2.it>
Fri, 2 Dec 2016 16:18:38 +0000
(17:18 +0100)
committer
Antonio Ospite <ao2@ao2.it>
Fri, 2 Dec 2016 16:24:09 +0000
(17:24 +0100)
vidi/Player.py
patch
|
blob
|
history
diff --git
a/vidi/Player.py
b/vidi/Player.py
index
cf30f9f
..
d2eacef
100755
(executable)
--- a/
vidi/Player.py
+++ b/
vidi/Player.py
@@
-30,9
+30,11
@@
GObject.threads_init()
class Player(object):
def __init__(self, pipeline):
self.pipeline = pipeline
class Player(object):
def __init__(self, pipeline):
self.pipeline = pipeline
+
bus = self.pipeline.get_bus()
bus.add_signal_watch()
bus = self.pipeline.get_bus()
bus.add_signal_watch()
- bus.connect("message", self.bus_message_cb)
+ bus.connect("message::eos", self.on_eos)
+ bus.connect('message::error', self.on_error)
self.mainloop = GObject.MainLoop()
self.mainloop = GObject.MainLoop()
@@
-41,9
+43,13
@@
class Player(object):
pipeline = Gst.parse_launch(pipeline_string)
return Player(pipeline)
pipeline = Gst.parse_launch(pipeline_string)
return Player(pipeline)
- def bus_message_cb(self, unused_bus, message):
- if message.type == Gst.MessageType.EOS:
- self.stop()
+ def on_eos(self, bus, message):
+ self.stop()
+
+ def on_error(self, bus, msg):
+ (err, debug) = msg.parse_error()
+ print("Error: %s" % err)
+ self.stop()
def play(self):
self.pipeline.set_state(Gst.State.PLAYING)
def play(self):
self.pipeline.set_state(Gst.State.PLAYING)