diff options
author | Peter Körner <pkoerner@seibert-media.net> | 2016-09-27 10:02:01 +0200 |
---|---|---|
committer | Peter Körner <pkoerner@seibert-media.net> | 2016-09-27 10:02:01 +0200 |
commit | 7a5fe106524df5cd86ee9dcf6e2cac76c9826321 (patch) | |
tree | 2c09dabdefeab624924115ae41006716faaf5dfa | |
parent | 9834a6809d49ad63cf1af88b44efb02db6bca7ac (diff) |
adapt to pep8 style
-rw-r--r-- | voctocore/lib/avpreviewoutput.py | 31 | ||||
-rw-r--r-- | voctogui/lib/videodisplay.py | 42 |
2 files changed, 37 insertions, 36 deletions
diff --git a/voctocore/lib/avpreviewoutput.py b/voctocore/lib/avpreviewoutput.py index 91e2031..de4c95c 100644 --- a/voctocore/lib/avpreviewoutput.py +++ b/voctocore/lib/avpreviewoutput.py @@ -23,18 +23,19 @@ class AVPreviewOutput(TCPMultiConnection): if Config.getboolean('previews', 'deinterlace'): deinterlace = "deinterlace mode=interlaced !" - venc = 'jpegenc quality=90' - if Config.has_option('previews', 'vaapi'): - try: - encoder = Config.get('previews', 'vaapi') - encoders = { - 'h264': 'vaapih264enc rate-control=cqp init-qp=23 cabac=false max-bframes=0 keyframe-period=60', - 'jpeg': 'vaapijpegenc quality=90 keyframe-period=0', - 'mpeg2': 'vaapimpeg2enc keyframe-period=60', - } - venc = encoders[encoder] - except Exception as e: - self.log.error(e) + venc = 'jpegenc quality=90' + if Config.has_option('previews', 'vaapi'): + try: + encoder = Config.get('previews', 'vaapi') + encoders = { + 'h264': 'vaapih264enc rate-control=cqp init-qp=23' + 'cabac=false max-bframes=0 keyframe-period=60', + 'jpeg': 'vaapijpegenc quality=90 keyframe-period=0', + 'mpeg2': 'vaapimpeg2enc keyframe-period=60', + } + venc = encoders[encoder] + except Exception as e: + self.log.error(e) pipeline = """ intervideosrc channel=video_{channel} ! @@ -43,7 +44,7 @@ class AVPreviewOutput(TCPMultiConnection): videoscale ! videorate ! {vcaps_out} ! - {venc} ! + {venc} ! queue ! mux. @@ -67,8 +68,8 @@ class AVPreviewOutput(TCPMultiConnection): acaps=Config.get('mix', 'audiocaps'), vcaps_in=Config.get('mix', 'videocaps'), vcaps_out=vcaps_out, - deinterlace=deinterlace, - venc=venc + deinterlace=deinterlace, + venc=venc ) self.log.debug('Creating Output-Pipeline:\n%s', pipeline) diff --git a/voctogui/lib/videodisplay.py b/voctogui/lib/videodisplay.py index f42775c..9d531d5 100644 --- a/voctogui/lib/videodisplay.py +++ b/voctogui/lib/videodisplay.py @@ -16,34 +16,34 @@ class VideoDisplay(object): self.drawing_area = drawing_area self.level_callback = level_callback - if Config.has_option('previews', 'videocaps'): - previewcaps = Config.get('previews', 'videocaps') - else: - previewcaps = 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 endoded 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) + 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 endoded-previews for gui') + self.log.info('using raw-video instead of encoded-previews') # Setup Server-Connection, Demuxing and Decoding pipeline = """ @@ -55,7 +55,7 @@ class VideoDisplay(object): if use_previews: pipeline += """ demux. ! - {vdec} ! + {vdec} ! {previewcaps} ! queue ! """ @@ -126,8 +126,8 @@ 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, - host=Config.get('server', 'host'), + vdec=vdec, + host=Config.get('server', 'host'), port=port, ) |