From 2bc61c9012aecebba06484a25e4ca3e31d0cdc2f Mon Sep 17 00:00:00 2001 From: MaZderMind Date: Sun, 6 Sep 2015 13:50:51 +0200 Subject: USe Server-Configured Video-Size in Warning-Overlay --- voctogui/lib/warningoverlay.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/voctogui/lib/warningoverlay.py b/voctogui/lib/warningoverlay.py index ad86b69..6df932e 100644 --- a/voctogui/lib/warningoverlay.py +++ b/voctogui/lib/warningoverlay.py @@ -1,5 +1,7 @@ import logging -from gi.repository import GLib +from gi.repository import GLib, Gst + +from lib.config import Config class VideoWarningOverlay(object): """ Displays a Warning-Overlay above the Video-Feed of another VideoDisplay """ @@ -13,6 +15,15 @@ class VideoWarningOverlay(object): GLib.timeout_add_seconds(1, self.on_blink_callback) + caps_string = Config.get('mix', 'videocaps') + self.log.debug('parsing video-caps: %s', caps_string) + caps = Gst.Caps.from_string(caps_string) + struct = caps.get_structure(0) + _, self.width = struct.get_int('width') + _, self.height = struct.get_int('height') + + self.log.debug('configuring size to %ux%u', self.width, self.height) + def on_blink_callback(self): self.blink_state = not self.blink_state @@ -32,8 +43,8 @@ class VideoWarningOverlay(object): if not self.enabled: return - w = 1920 - h = 1080/20 + w = self.width + h = self.height / 20 if self.blink_state: cr.set_source_rgba(1.0, 0.0, 0.0, 0.8) -- cgit v1.2.3