diff options
author | MaZderMind <git@mazdermind.de> | 2016-09-26 20:42:07 +0200 |
---|---|---|
committer | MaZderMind <git@mazdermind.de> | 2016-09-26 20:42:07 +0200 |
commit | 6e846c7081e242213cd70ceacfcff319e221942c (patch) | |
tree | 9d037e9272e65aea06c74775b2af1eae2f50a46e /voctocore/lib/pipeline.py | |
parent | fbcbc3743e9179738244a96be54aa588e44314cb (diff) | |
parent | 1972da7f6aa60d3cb3b68808d0381e37898665f3 (diff) |
Merge branch 'pep8'
Diffstat (limited to 'voctocore/lib/pipeline.py')
-rw-r--r-- | voctocore/lib/pipeline.py | 184 |
1 files changed, 95 insertions, 89 deletions
diff --git a/voctocore/lib/pipeline.py b/voctocore/lib/pipeline.py index a13f1d2..1a1349e 100644 --- a/voctocore/lib/pipeline.py +++ b/voctocore/lib/pipeline.py @@ -10,93 +10,99 @@ from lib.videomix import VideoMix from lib.audiomix import AudioMix from lib.streamblanker import StreamBlanker -class Pipeline(object): - """mixing, streaming and encoding pipeline constuction and control""" - - def __init__(self): - self.log = logging.getLogger('Pipeline') - self.log.info('Video-Caps configured to: %s', Config.get('mix', 'videocaps')) - self.log.info('Audio-Caps configured to: %s', Config.get('mix', 'audiocaps')) - - names = Config.getlist('mix', 'sources') - if len(names) < 1: - raise RuntimeError("At least one AVSource must be configured!") - - self.sources = [] - self.mirrors = [] - self.previews = [] - self.sbsources = [] - - self.log.info('Creating %u Creating AVSources: %s', len(names), names) - for idx, name in enumerate(names): - port = 10000 + idx - self.log.info('Creating AVSource %s at tcp-port %u', name, port) - - outputs = [name+'_mixer', name+'_mirror'] - if Config.getboolean('previews', 'enabled'): - outputs.append(name+'_preview') - - source = AVSource(name, port, outputs=outputs) - self.sources.append(source) - - - port = 13000 + idx - self.log.info('Creating Mirror-Output for AVSource %s at tcp-port %u', name, port) - - mirror = AVRawOutput('%s_mirror' % name, port) - self.mirrors.append(mirror) - - - if Config.getboolean('previews', 'enabled'): - port = 14000 + idx - self.log.info('Creating Preview-Output for AVSource %s at tcp-port %u', name, port) - - preview = AVPreviewOutput('%s_preview' % name, port) - self.previews.append(preview) - - self.log.info('Creating Videmixer') - self.vmix = VideoMix() - - self.log.info('Creating Audiomixer') - self.amix = AudioMix() - - port = 16000 - self.log.info('Creating Mixer-Background VSource at tcp-port %u', port) - self.bgsrc = AVSource('background', port, has_audio=False) - - port = 11000 - self.log.info('Creating Mixer-Output at tcp-port %u', port) - self.mixout = AVRawOutput('mix_out', port) - - - if Config.getboolean('previews', 'enabled'): - port = 12000 - self.log.info('Creating Preview-Output for AVSource %s at tcp-port %u', name, port) - - self.mixpreview = AVPreviewOutput('mix_preview', port) - - if Config.getboolean('stream-blanker', 'enabled'): - names = Config.getlist('stream-blanker', 'sources') - if len(names) < 1: - raise RuntimeError("At least one StreamBlanker-Source must be configured or the StreamBlanker disabled!") - for idx, name in enumerate(names): - port = 17000 + idx - self.log.info('Creating StreamBlanker VSource %s at tcp-port %u', name, port) - - source = AVSource('%s_streamblanker' % name, port, has_audio=False) - self.sbsources.append(source) - - port = 18000 - self.log.info('Creating StreamBlanker ASource at tcp-port %u', port) - - source = AVSource('streamblanker', port, has_video=False) - self.sbsources.append(source) - - - self.log.info('Creating StreamBlanker') - self.streamblanker = StreamBlanker() - - port = 15000 - self.log.info('Creating StreamBlanker-Output at tcp-port %u', port) - self.streamout = AVRawOutput('streamblanker_out', port) +class Pipeline(object): + """mixing, streaming and encoding pipeline constuction and control""" + + def __init__(self): + self.log = logging.getLogger('Pipeline') + self.log.info('Video-Caps configured to: %s', + Config.get('mix', 'videocaps')) + self.log.info('Audio-Caps configured to: %s', + Config.get('mix', 'audiocaps')) + + names = Config.getlist('mix', 'sources') + if len(names) < 1: + raise RuntimeError("At least one AVSource must be configured!") + + self.sources = [] + self.mirrors = [] + self.previews = [] + self.sbsources = [] + + self.log.info('Creating %u Creating AVSources: %s', len(names), names) + for idx, name in enumerate(names): + port = 10000 + idx + self.log.info('Creating AVSource %s at tcp-port %u', name, port) + + outputs = [name + '_mixer', name + '_mirror'] + if Config.getboolean('previews', 'enabled'): + outputs.append(name + '_preview') + + source = AVSource(name, port, outputs=outputs) + self.sources.append(source) + + port = 13000 + idx + self.log.info('Creating Mirror-Output for AVSource %s ' + 'at tcp-port %u', name, port) + + mirror = AVRawOutput('%s_mirror' % name, port) + self.mirrors.append(mirror) + + if Config.getboolean('previews', 'enabled'): + port = 14000 + idx + self.log.info('Creating Preview-Output for AVSource %s ' + 'at tcp-port %u', name, port) + + preview = AVPreviewOutput('%s_preview' % name, port) + self.previews.append(preview) + + self.log.info('Creating Videmixer') + self.vmix = VideoMix() + + self.log.info('Creating Audiomixer') + self.amix = AudioMix() + + port = 16000 + self.log.info('Creating Mixer-Background VSource at tcp-port %u', port) + self.bgsrc = AVSource('background', port, has_audio=False) + + port = 11000 + self.log.info('Creating Mixer-Output at tcp-port %u', port) + self.mixout = AVRawOutput('mix_out', port) + + if Config.getboolean('previews', 'enabled'): + port = 12000 + self.log.info('Creating Preview-Output for AVSource %s ' + 'at tcp-port %u', name, port) + + self.mixpreview = AVPreviewOutput('mix_preview', port) + + if Config.getboolean('stream-blanker', 'enabled'): + names = Config.getlist('stream-blanker', 'sources') + if len(names) < 1: + raise RuntimeError('At least one StreamBlanker-Source must ' + 'be configured or the ' + 'StreamBlanker disabled!') + for idx, name in enumerate(names): + port = 17000 + idx + self.log.info('Creating StreamBlanker VSource %s ' + 'at tcp-port %u', name, port) + + source = AVSource('{}_streamblanker'.format(name), port, + has_audio=False) + self.sbsources.append(source) + + port = 18000 + self.log.info('Creating StreamBlanker ASource at tcp-port %u', + port) + + source = AVSource('streamblanker', port, has_video=False) + self.sbsources.append(source) + + self.log.info('Creating StreamBlanker') + self.streamblanker = StreamBlanker() + + port = 15000 + self.log.info('Creating StreamBlanker-Output at tcp-port %u', port) + self.streamout = AVRawOutput('streamblanker_out', port) |