diff options
author | MaZderMind <git@mazdermind.de> | 2016-09-28 21:21:23 +0200 |
---|---|---|
committer | MaZderMind <git@mazdermind.de> | 2016-09-28 21:21:23 +0200 |
commit | 12ffd2155cbec3d94e8fc2df32532de016005a5c (patch) | |
tree | 19059647c7ec1c4922caecb9b80d77d4ea254370 /voctogui | |
parent | f13be7d7cddc1085a763b63e4b0db9aeee478277 (diff) | |
parent | 7d206f56eb557585986bd259e32293a81899c853 (diff) |
Merge branch 'previews-vaapi'
Diffstat (limited to 'voctogui')
-rw-r--r-- | voctogui/lib/videodisplay.py | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/voctogui/lib/videodisplay.py b/voctogui/lib/videodisplay.py index 9259f6c..fa558dc 100644 --- a/voctogui/lib/videodisplay.py +++ b/voctogui/lib/videodisplay.py @@ -16,16 +16,34 @@ class VideoDisplay(object): self.drawing_area = drawing_area self.level_callback = level_callback - caps = Config.get('mix', 'videocaps') + if Config.has_option('previews', 'videocaps'): + previewcaps = Config.get('previews', 'videocaps') + else: + previewcaps = Config.get('mix', 'videocaps') + use_previews = (Config.getboolean('previews', 'enabled') and Config.getboolean('previews', 'use')) # Preview-Ports are Raw-Ports + 1000 if use_previews: - self.log.info('using jpeg-previews instead of raw-video for gui') + self.log.info('using encoded previews instead of raw-video') port += 1000 + + vdec = 'image/jpeg ! jpegdec' + if Config.has_option('previews', 'vaapi'): + try: + decoder = Config.get('previews', 'vaapi') + decoders = { + 'h264': 'video/x-h264 ! avdec_h264', + 'jpeg': 'image/jpeg ! jpegdec', + 'mpeg2': 'video/mpeg,mpegversion=2 ! mpeg2dec' + } + vdec = decoders[decoder] + except Exception as e: + self.log.error(e) + else: - self.log.info('using raw-video instead of jpeg-previews for gui') + self.log.info('using raw-video instead of encoded-previews') # Setup Server-Connection, Demuxing and Decoding pipeline = """ @@ -37,8 +55,7 @@ class VideoDisplay(object): if use_previews: pipeline += """ demux. ! - image/jpeg ! - jpegdec ! + {vdec} ! {previewcaps} ! queue ! """ @@ -109,6 +126,7 @@ class VideoDisplay(object): vcaps=Config.get('mix', 'videocaps'), previewcaps=Config.get('previews', 'videocaps'), host=Args.host if Args.host else Config.get('server', 'host'), + vdec=vdec, port=port, ) |