changeset 939:331e67fa1492

asco try to print gst error messages. untested Ignore-this: 137d6b933ed8a2502f7281e3a0ab5754
author drewp@bigasterisk.com
date Wed, 12 Jun 2013 23:48:32 +0000
parents c2faa69099e6
children 183e3afea4cc
files light9/ascoltami/player.py
diffstat 1 files changed, 11 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/light9/ascoltami/player.py	Wed Jun 12 23:47:12 2013 +0000
+++ b/light9/ascoltami/player.py	Wed Jun 12 23:48:32 2013 +0000
@@ -71,12 +71,20 @@
         """bus.add_signal_watch seems to be having no effect, but this works"""
         bus = self.pipeline.get_bus()
         mt = Gst.MessageType
-        msg = bus.poll(mt.EOS | mt.STREAM_STATUS, 0)
+        msg = bus.poll(mt.EOS | mt.STREAM_STATUS | mt.ERROR,# | mt.ANY,
+                       0)
         if msg is not None:
-            if msg.type == Gst.MessageType.EOS:
+            log.debug("bus message: %r %r", msg.src, msg.type)
+            # i'm trying to catch here a case where the pulseaudio
+            # output has an error, since that's otherwise kind of
+            # mysterious to diagnose. I don't think this is exactly
+            # working.
+            if msg.type == mt.ERROR:
+                log.error(repr(msg.parse_error()))
+            if msg.type == mt.EOS:
                 if self.onEOS is not None:
                     self.onEOS(self.getSong())
-            if msg.type == Gst.MessageType.STREAM_STATUS:
+            if msg.type == mt.STREAM_STATUS:
                 (statusType, _elem) = msg.parse_stream_status()
                 if statusType == Gst.StreamStatusType.ENTER:
                     self.setupAutostop()