diff options
author | MaZderMind <git@mazdermind.de> | 2015-11-26 15:58:07 +0100 |
---|---|---|
committer | MaZderMind <git@mazdermind.de> | 2015-11-26 15:58:07 +0100 |
commit | d513ed2bb25250945daebb4804324cd5e6ad5048 (patch) | |
tree | b5594f800655dca41fbf27a4a668c7e451a78495 /voctocore | |
parent | ee496ab095be69efa070aab06a7dc4db81f8bb94 (diff) |
warn on imcompatible input formats, fixes #25
Diffstat (limited to 'voctocore')
-rw-r--r-- | voctocore/lib/asource.py | 15 | ||||
-rw-r--r-- | voctocore/lib/avsource.py | 26 | ||||
-rw-r--r-- | voctocore/lib/vsource.py | 15 |
3 files changed, 56 insertions, 0 deletions
diff --git a/voctocore/lib/asource.py b/voctocore/lib/asource.py index 2383a32..6cf6029 100644 --- a/voctocore/lib/asource.py +++ b/voctocore/lib/asource.py @@ -32,8 +32,23 @@ class ASource(TCPSingleConnection): self.receiverPipeline.bus.connect("message::eos", self.on_eos) self.receiverPipeline.bus.connect("message::error", self.on_error) + self.all_audio_caps = Gst.Caps.from_string('audio/x-raw') + self.audio_caps = Gst.Caps.from_string(Config.get('mix', 'audiocaps')) + + 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_audio_caps): + self.log.debug('new demuxer-pad is a audio-pad, testing against configured audio-caps') + if not caps.can_intersect(self.audio_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.audio_caps.to_string()) def on_eos(self, bus, message): self.log.debug('Received End-of-Stream-Signal on Source-Pipeline') diff --git a/voctocore/lib/avsource.py b/voctocore/lib/avsource.py index 9b2a6ea..ecd5b0f 100644 --- a/voctocore/lib/avsource.py +++ b/voctocore/lib/avsource.py @@ -66,8 +66,34 @@ class AVSource(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')) + + self.all_audio_caps = Gst.Caps.from_string('audio/x-raw') + self.audio_caps = Gst.Caps.from_string(Config.get('mix', 'audiocaps')) + + 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_audio_caps): + self.log.debug('new demuxer-pad is a audio-pad, testing against configured audio-caps') + if not caps.can_intersect(self.audio_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.audio_caps.to_string()) + + + elif 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') 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') |