summaryrefslogtreecommitdiff
path: root/src/flufigut.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/flufigut.py')
-rwxr-xr-xsrc/flufigut.py193
1 files changed, 93 insertions, 100 deletions
diff --git a/src/flufigut.py b/src/flufigut.py
index 44ebddc..7704518 100755
--- a/src/flufigut.py
+++ b/src/flufigut.py
@@ -107,7 +107,6 @@ elif master > 1:
raise SystemExit("You have configured multiple master clock devices!")
-samplerates = []
for mux_name in mux.keys():
for format in mux[mux_name]['formats'].keys():
if 'audio' in mux[mux_name]:
@@ -115,24 +114,22 @@ for mux_name in mux.keys():
input_samplerate = input[source]['properties']['samplerate']
if 'samplerate' in globals['formats'][format]:
samplerate = globals['formats'][format]['samplerate']
- if samplerate not in samplerates:
- if samplerate != input_samplerate:
-
- worker_name = 'resample-%s' % (source)
- if worker_name not in worker:
- worker[worker_name] = -1
- else:
- worker[worker_name] = 1
- feeder = 'input-%s' % (mux[mux_name]['audio'])
- flow['input']['resample-%s-%s' % (source, samplerate)] = {
- 'type': 'audio-resample',
- 'desc': "resample audio from %s to %s Hz" % (source, samplerate),
- 'worker': 'resample',
- 'feeder': feeder,
- 'properties': {
- 'samplerate': samplerate,
- },
- }
+ if samplerate != input_samplerate:
+ worker_name = 'resample-%s' % (source)
+ if worker_name not in worker:
+ worker[worker_name] = -1
+ else:
+ worker[worker_name] = 1
+ feeder = 'input-%s' % (mux[mux_name]['audio'])
+ flow['input']['resample-%s-%s' % (source, samplerate)] = {
+ 'type': 'audio-resample',
+ 'desc': "resample audio from %s to %s Hz" % (source, samplerate),
+ 'worker': 'resample',
+ 'feeder': feeder,
+ 'properties': {
+ 'samplerate': samplerate,
+ },
+ }
if 'video' in mux[mux_name]:
source = mux[mux_name]['video'].split(':')[0]
@@ -167,88 +164,84 @@ flow['encoder_video'] = {}
flow['encoder_audio'] = {}
flow['muxer'] = {}
-# for format in transcode.keys():
-# for profile in transcode[format]:
-# video_encoder = 'none'
-# if 'video' in globals['formats'][format]:
-# encoder = globals['formats'][format]['video']
-# resolution = globals['profiles'][profile]['video']
-# bitrate = globals['bitrates'][encoder][resolution]
-# if resolution != input_resolution:
-# feeder = 'resize-%s' % resolution
-# else:
-# if input_type == 'av':
-# feeder = '%s:%s' % (input_name, "video")
-# elif input_type == 'vo':
-# feeder = '%s' % (input_name)
-# else:
-# raise SystemExit("format definition needs audio but no audio input given")
-# video_encoder = 'encode-%s-%s' % (encoder, resolution)
-# if video_encoder not in flow['encoder_video'].keys():
-# worker_name = 'encoder-%s-%s' % (encoder, resolution)
-# if worker_name not in worker:
-# worker[worker_name] = -1
-# else:
-# worker[worker_name] = 1
-# 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': worker_name,
-# 'feeder': feeder,
-# 'properties': {
-# 'bitrate': bitrate,
-# },
-# }
-
-# audio_encoder = 'none'
-# if 'audio' in globals['formats'][format]:
-# encoder = globals['formats'][format]['audio']
-# bitrate = globals['profiles'][profile]['audio']
-# if 'samplerate' in globals['formats'][format]:
-# samplerate = globals['formats'][format]['samplerate']
-# else:
-# samplerate = input_samplerate
-
-# if samplerate != input_samplerate:
-# feeder = 'resample-%s' % samplerate
-# else:
-# if input_type == 'av':
-# feeder = '%s:%s' % (input_name, "audio")
-# elif input_type == 'ao':
-# feeder = '%s' % (input_name)
-# else:
-# raise SystemExit("format definition needs audio but no audio input given")
-# audio_encoder = 'encode-%s-%i-%i' % (encoder, bitrate, samplerate)
-# if audio_encoder not in flow['encoder_audio']:
-# worker_name = 'encoder-%s-%s' % (encoder, bitrate)
-# if worker_name not in worker:
-# worker[worker_name] = -1
-# else:
-# worker[worker_name] = 1
-# flow['encoder_audio'][audio_encoder] = {
-# 'type': '%s-encode' % encoder,
-# 'desc': "%s encoder for %i kbit/s @ %i Hz" % (encoder, bitrate, samplerate),
-# 'worker': worker_name,
-# 'feeder': feeder,
-# 'properties': {
-# 'bitrate': bitrate,
-# },
-# }
-# muxer = globals['formats'][format]['muxer']
-# worker_name = 'muxer-%s-%s' % (format, profile)
-# if worker_name not in worker:
-# worker[worker_name] = -1
-# else:
-# worker[worker_name] = 1
-# flow['muxer']['muxer-%s-%s' % (format, profile)] = {
-# 'type': '%s-mux' % muxer,
-# 'desc': "%s muxer profile %s" % (format, profile),
-# 'worker': worker_name,
-# 'feeder_audio': audio_encoder,
-# 'feeder_video': video_encoder,
-# 'properties': {},
-# }
+for mux_name in mux.keys():
+ for format in mux[mux_name]['formats'].keys():
+ for profile in mux[mux_name]['formats'][format]:
+ audio_encoder = 'none'
+ if 'audio' in mux[mux_name]:
+ encoder = globals['formats'][format]['audio']
+ bitrate = globals['profiles'][profile]['audio']
+ if 'samplerate' in globals['formats'][format]:
+ samplerate = globals['formats'][format]['samplerate']
+ else:
+ samplerate = input_samplerate
+
+ source = mux[mux_name]['audio'].split(':')[0]
+ input_samplerate = input[source]['properties']['samplerate']
+ if samplerate != input_samplerate:
+ feeder = 'resample-%s-%s' % (source, samplerate)
+ else:
+ feeder = mux[mux_name]['audio']
+ audio_encoder = 'encode-%s-%s-%i-%i' % (source, encoder, bitrate, samplerate)
+ if audio_encoder not in flow['encoder_audio']:
+ worker_name = 'encoder-%s-%s-%s' % (source, encoder, bitrate)
+ if worker_name not in worker:
+ worker[worker_name] = -1
+ else:
+ worker[worker_name] = 1
+ flow['encoder_audio'][audio_encoder] = {
+ 'type': '%s-encode' % encoder,
+ 'desc': "%s encoder for %i kbit/s @ %i Hz, from %s" % (encoder, bitrate, samplerate, source),
+ 'worker': worker_name,
+ 'feeder': feeder,
+ 'properties': {
+ 'bitrate': bitrate,
+ },
+ }
+
+ video_encoder = 'none'
+ if 'video' in mux[mux_name]:
+ encoder = globals['formats'][format]['video']
+ resolution = globals['profiles'][profile]['video']
+ bitrate = globals['bitrates'][encoder][resolution]
+ source = mux[mux_name]['video'].split(':')[0]
+ input_resolution = input[source]['properties']['resolution']
+ if resolution != input_resolution:
+ feeder = 'resize-%s-%s' % (source, resolution)
+ else:
+ feeder = mux[mux_name]['video']
+ video_encoder = 'encode-%s-%s-%s' % (source, encoder, resolution)
+ if video_encoder not in flow['encoder_video'].keys():
+ worker_name = 'encoder-%s-%s-%s' % (source, encoder, resolution)
+ if worker_name not in worker:
+ worker[worker_name] = -1
+ else:
+ worker[worker_name] = 1
+ flow['encoder_video'][video_encoder] = {
+ 'type': '%s-encode' % encoder,
+ 'desc': "%s encoder for %sx%s, from %s" % (encoder, globals['resolutions'][resolution]['width'], globals['resolutions'][resolution]['height'], source),
+ 'worker': worker_name,
+ 'feeder': feeder,
+ 'properties': {
+ 'bitrate': bitrate,
+ },
+ }
+
+ muxer = globals['formats'][format]['muxer']
+ worker_name = 'muxer-%s-%s-%s' % (mux_name, format, profile)
+ if worker_name not in worker:
+ worker[worker_name] = -1
+ else:
+ worker[worker_name] = 1
+ flow['muxer']['muxer-%s-%s-%s' % (mux_name, format, profile)] = {
+ 'type': '%s-mux' % muxer,
+ 'desc': "%s muxer for %s, profile %s" % (format, mux_name, profile),
+ 'worker': worker_name,
+ 'feeder_audio': audio_encoder,
+ 'feeder_video': video_encoder,
+ 'properties': {},
+ }
### generate streamer components ################################