summaryrefslogtreecommitdiff
path: root/src/flufigut.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/flufigut.py')
-rwxr-xr-xsrc/flufigut.py91
1 files changed, 66 insertions, 25 deletions
diff --git a/src/flufigut.py b/src/flufigut.py
index 1c0e538..2a81fe2 100755
--- a/src/flufigut.py
+++ b/src/flufigut.py
@@ -76,25 +76,40 @@ for machine in globals['machines']:
### generate input components ###################################
flow['input'] = {}
+input_name = ""
+input_type = ""
+input_samplerate = 0
+input_resolution = ""
+
if 'input' not in worker:
worker['input'] = -1
else:
worker['input'] = 1
-flow['input']['raw-input'] = {
- 'type': input['source'],
- 'desc': "capture raw AV from %s" % input['source'],
- 'worker': 'input',
- 'properties': {},
- }
-for property in input.keys():
- if property == 'samplerate':
- flow['input']['raw-input']['properties'][property] = input['samplerate']
- elif property == 'resolution':
- flow['input']['raw-input']['properties']['width'] = globals['resolutions'][input[property]]['width']
- flow['input']['raw-input']['properties']['height'] = globals['resolutions'][input[property]]['height']
- flow['input']['raw-input']['properties']['framerate'] = globals['resolutions'][input[property]]['rate']
- elif property != 'source':
- flow['input']['raw-input']['properties'][property] = input[property]
+for source in input:
+ input_name = 'input-%s' % source
+ input_type = input[source]['type']
+ flow['input'][input_name] = {
+ 'type': input[source]['source'],
+ 'desc': "capture raw %s from %s" % (input[source]['type'], source),
+ 'worker': 'input',
+ 'properties': {},
+ }
+ properties = input[source]['properties']
+ for property in properties.keys():
+ if property == 'resolution':
+ flow['input'][input_name]['properties']['width'] = globals['resolutions'][properties[property]]['width']
+ flow['input'][input_name]['properties']['height'] = globals['resolutions'][properties[property]]['height']
+ flow['input'][input_name]['properties']['framerate'] = globals['resolutions'][properties[property]]['rate']
+ input_resolution = properties[property]
+ else:
+ flow['input'][input_name]['properties'][property] = properties[property]
+ if property == 'samplerate':
+ input_samplerate = properties[property]
+
+ break # until now only one input source can be used
+
+if input_name == "":
+ raise SystemExit("no input defined!")
samplerates = [ ]
resolutions = [ ]
@@ -102,14 +117,14 @@ 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:
+ if input_samplerate != samplerate:
samplerates.append(samplerate)
for profile in transcode[format]:
if 'video' in globals['profiles'][profile]:
resolution = globals['profiles'][profile]['video']
if resolution not in resolutions:
- if input['resolution'] != resolution:
- if globals['resolutions'][resolution]['rate'] != globals['resolutions'][input['resolution']]['rate']:
+ 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)
@@ -118,11 +133,17 @@ for resolution in resolutions:
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': 'raw-input:video',
+ 'feeder': feeder,
'properties': {
'width': globals['resolutions'][resolution]['width'],
'height': globals['resolutions'][resolution]['height'],
@@ -134,11 +155,18 @@ for samplerate in samplerates:
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': 'raw-input:audio',
+ 'feeder': feeder,
'properties': {
'samplerate': samplerate,
},
@@ -156,10 +184,15 @@ for format in transcode.keys():
encoder = globals['formats'][format]['video']
resolution = globals['profiles'][profile]['video']
bitrate = globals['bitrates'][encoder][resolution]
- if resolution == input['resolution']:
- feeder = 'raw-input:video'
- else:
+ 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)
@@ -183,10 +216,18 @@ for format in transcode.keys():
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:
- samplerate = input['samplerate']
- feeder = 'raw-input:audio'
+ 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)