From f29d6c800190f4760e9fa3a13fcb2a088b5af5ba Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Mon, 1 Oct 2012 01:24:54 +0200 Subject: only add encoder if it not already exists --- src/flufigut.py | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/flufigut.py b/src/flufigut.py index a47e544..4007e4f 100755 --- a/src/flufigut.py +++ b/src/flufigut.py @@ -180,15 +180,16 @@ for format in transcode.keys(): else: feeder = 'resize-%s' % resolution video_encoder = 'encode-%s-%s' % (encoder, resolution) - flow['encoder_video'][video_encoder] = { - 'type': '%s-encode' % encoder, - 'desc': "%s encoder for %sx%s" % (encoder, globals['resolutions'][resolution]['width'], globals['resolutions'][resolution]['height']), - 'worker': 'encoder-%s' % encoder, - 'feeder': feeder, - 'properties': { - 'bitrate': bitrate, - }, - } + if video_encoder not in flow['encoder_video'].keys(): + flow['encoder_video'][video_encoder] = { + 'type': '%s-encode' % encoder, + 'desc': "%s encoder for %sx%s" % (encoder, globals['resolutions'][resolution]['width'], globals['resolutions'][resolution]['height']), + 'worker': 'encoder-%s' % encoder, + 'feeder': feeder, + 'properties': { + 'bitrate': bitrate, + }, + } audio_encoder = 'none' if 'audio' in globals['formats'][format]: @@ -201,15 +202,16 @@ for format in transcode.keys(): samplerate = input['samplerate'] feeder = 'raw-input:audio' audio_encoder = 'encode-%s-%i-%i' % (encoder, bitrate, samplerate) - flow['encoder_audio'][audio_encoder] = { - 'type': '%s-encode' % encoder, - 'desc': "%s encoder for %i kbit/s @ %i Hz" % (encoder, bitrate, samplerate), - 'worker': 'encoder-%s' % encoder, - 'feeder': feeder, - 'properties': { - 'bitrate': bitrate, - }, - } + if audio_encoder not in flow['encoder_audio']: + flow['encoder_audio'][audio_encoder] = { + 'type': '%s-encode' % encoder, + 'desc': "%s encoder for %i kbit/s @ %i Hz" % (encoder, bitrate, samplerate), + 'worker': 'encoder-%s' % encoder, + 'feeder': feeder, + 'properties': { + 'bitrate': bitrate, + }, + } muxer = globals['formats'][format]['muxer'] flow['muxer']['muxer-%s-%s' % (muxer, profile)] = { -- cgit v1.2.3