summaryrefslogtreecommitdiff
path: root/voctocore/lib/avrawoutput.py
diff options
context:
space:
mode:
authorMaZderMind <github@mazdermind.de>2015-05-22 13:06:51 +0200
committerMaZderMind <github@mazdermind.de>2015-05-22 13:06:51 +0200
commitedcc25932bd94c65134b44c0c24b3984e49b7259 (patch)
treeaa38f881a44b57366a46975b8637d634743f39ec /voctocore/lib/avrawoutput.py
parenta1d1076b2243f6c1e9527afb0be359407fe2f4c4 (diff)
better error-handling on all pipelines
Diffstat (limited to 'voctocore/lib/avrawoutput.py')
-rw-r--r--voctocore/lib/avrawoutput.py23
1 files changed, 19 insertions, 4 deletions
diff --git a/voctocore/lib/avrawoutput.py b/voctocore/lib/avrawoutput.py
index ea13ad4..0c363e6 100644
--- a/voctocore/lib/avrawoutput.py
+++ b/voctocore/lib/avrawoutput.py
@@ -36,13 +36,20 @@ class AVRawOutput(TCPMultiConnection):
acaps=Config.get('mix', 'audiocaps'),
vcaps=Config.get('mix', 'videocaps')
)
- self.log.debug('Launching Output-Pipeline:\n%s', pipeline)
- self.receiverPipeline = Gst.parse_launch(pipeline)
- self.receiverPipeline.set_state(Gst.State.PLAYING)
+ self.log.debug('Creating Output-Pipeline:\n%s', pipeline)
+ self.outputPipeline = Gst.parse_launch(pipeline)
+
+ self.log.debug('Binding Error & End-of-Stream-Signal on Output-Pipeline')
+ self.outputPipeline.bus.add_signal_watch()
+ self.outputPipeline.bus.connect("message::eos", self.on_eos)
+ self.outputPipeline.bus.connect("message::error", self.on_error)
+
+ self.log.debug('Launching Output-Pipeline')
+ self.outputPipeline.set_state(Gst.State.PLAYING)
def on_accepted(self, conn, addr):
self.log.debug('Adding fd %u to multifdsink', conn.fileno())
- fdsink = self.receiverPipeline.get_by_name('fd')
+ fdsink = self.outputPipeline.get_by_name('fd')
fdsink.emit('add', conn.fileno())
def on_disconnect(multifdsink, fileno):
@@ -51,3 +58,11 @@ class AVRawOutput(TCPMultiConnection):
self.close_connection(conn)
fdsink.connect('client-fd-removed', on_disconnect)
+
+ def on_eos(self, bus, message):
+ self.log.debug('Received End-of-Stream-Signal on Output-Pipeline')
+
+ def on_error(self, bus, message):
+ self.log.debug('Received Error-Signal on Output-Pipeline')
+ (error, debug) = message.parse_error()
+ self.log.debug('Error-Details: #%u: %s', error.code, debug)