From d513ed2bb25250945daebb4804324cd5e6ad5048 Mon Sep 17 00:00:00 2001 From: MaZderMind Date: Thu, 26 Nov 2015 15:58:07 +0100 Subject: warn on imcompatible input formats, fixes #25 --- voctocore/lib/vsource.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'voctocore/lib/vsource.py') diff --git a/voctocore/lib/vsource.py b/voctocore/lib/vsource.py index 2296eac..893c7c0 100644 --- a/voctocore/lib/vsource.py +++ b/voctocore/lib/vsource.py @@ -32,8 +32,23 @@ class VSource(TCPSingleConnection): self.receiverPipeline.bus.connect("message::eos", self.on_eos) self.receiverPipeline.bus.connect("message::error", self.on_error) + self.all_video_caps = Gst.Caps.from_string('video/x-raw') + self.video_caps = Gst.Caps.from_string(Config.get('mix', 'videocaps')) + + demux = self.receiverPipeline.get_by_name('demux') + demux.connect('pad-added', self.on_pad_added) + self.receiverPipeline.set_state(Gst.State.PLAYING) + def on_pad_added(self, demux, src_pad): + caps = src_pad.query_caps(None) + self.log.debug('demuxer added pad w/ caps: %s', caps.to_string()) + if caps.can_intersect(self.all_video_caps): + self.log.debug('new demuxer-pad is a video-pad, testing against configured video-caps') + if not caps.can_intersect(self.video_caps): + self.log.warning('the incoming connection presented a video-stream that is not compatible to the configured caps') + self.log.warning(' incoming caps: %s', caps.to_string()) + self.log.warning(' configured caps: %s', self.video_caps.to_string()) def on_eos(self, bus, message): self.log.debug('Received End-of-Stream-Signal on Source-Pipeline') -- cgit v1.2.3