summaryrefslogtreecommitdiff
path: root/src/flufigut.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/flufigut.py')
-rwxr-xr-xsrc/flufigut.py117
1 files changed, 54 insertions, 63 deletions
diff --git a/src/flufigut.py b/src/flufigut.py
index a3759a5..44ebddc 100755
--- a/src/flufigut.py
+++ b/src/flufigut.py
@@ -107,69 +107,60 @@ elif master > 1:
raise SystemExit("You have configured multiple master clock devices!")
-
-# samplerates = [ ]
-# resolutions = [ ]
-# for format in transcode.keys():
-# if 'samplerate' in globals['formats'][format]:
-# samplerate = globals['formats'][format]['samplerate']
-# if samplerate not in samplerates:
-# if input_samplerate != samplerate:
-# samplerates.append(samplerate)
-# for profile in transcode[format]:
-# if 'video' in globals['profiles'][profile]:
-# if input_resolution == "":
-# raise SystemExit("format definition needs video but no video input given")
-# resolution = globals['profiles'][profile]['video']
-# if resolution not in resolutions:
-# if input_resolution != resolution:
-# if globals['resolutions'][resolution]['rate'] != globals['resolutions'][input_resolution]['rate']:
-# raise SystemExit("ERROR: video rate conversion is not yet supported!!!")
-# resolutions.append(resolution)
-
-# for resolution in resolutions:
-# if 'resize' not in worker:
-# worker['resize'] = -1
-# else:
-# worker['resize'] = 1
-# if input_type == 'av':
-# feeder = '%s:%s' % (input_name, "video")
-# elif input_type == 'vo':
-# feeder = '%s' % (input_name)
-# else:
-# raise SystemExit("format definition needs video but no video input given")
-# flow['input']['resize-%s' % resolution] = {
-# 'type': 'video-resize',
-# 'desc': "resize video to %sx%s" % (globals['resolutions'][resolution]['width'], globals['resolutions'][resolution]['height']),
-# 'worker': 'resize',
-# 'feeder': feeder,
-# 'properties': {
-# 'width': globals['resolutions'][resolution]['width'],
-# 'height': globals['resolutions'][resolution]['height'],
-# },
-# }
-
-# for samplerate in samplerates:
-# if 'resample' not in worker:
-# worker['resample'] = -1
-# else:
-# worker['resample'] = 1
-
-# 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")
-# flow['input']['resample-%s' % samplerate] = {
-# 'type': 'audio-resample',
-# 'desc': "resample audio to %s Hz" % samplerate,
-# 'worker': 'resample',
-# 'feeder': feeder,
-# 'properties': {
-# 'samplerate': samplerate,
-# },
-# }
+samplerates = []
+for mux_name in mux.keys():
+ for format in mux[mux_name]['formats'].keys():
+ if 'audio' in mux[mux_name]:
+ source = mux[mux_name]['audio'].split(':')[0]
+ 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 'video' in mux[mux_name]:
+ source = mux[mux_name]['video'].split(':')[0]
+ input_resolution = input[source]['properties']['resolution']
+ for profile in mux[mux_name]['formats'][format]:
+ if 'video' in globals['profiles'][profile]:
+ if input_resolution == "":
+ raise SystemExit("format definition needs video but no video input given")
+ resolution = globals['profiles'][profile]['video']
+ if input_resolution != resolution:
+ if globals['resolutions'][resolution]['rate'] != globals['resolutions'][input_resolution]['rate']:
+ raise SystemExit("ERROR: video rate conversion is not yet supported!!!")
+ worker_name = 'resize-%s' % (source)
+ if worker_name not in worker:
+ worker[worker_name] = -1
+ else:
+ worker[worker_name] = 1
+ feeder = 'input-%s' % (mux[mux_name]['video'])
+ flow['input']['resize-%s-%s' % (source, resolution)] = {
+ 'type': 'video-resize',
+ 'desc': "resize video from %s to %sx%s" % (source, globals['resolutions'][resolution]['width'], globals['resolutions'][resolution]['height']),
+ 'worker': 'resize',
+ 'feeder': feeder,
+ 'properties': {
+ 'width': globals['resolutions'][resolution]['width'],
+ 'height': globals['resolutions'][resolution]['height'],
+ },
+ }
### generate encoder and muxer components #######################
flow['encoder_video'] = {}