summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2012-10-16 22:01:18 +0200
committerChristian Pointner <equinox@spreadspace.org>2012-10-16 22:01:18 +0200
commita8bde383c41b54bf18310a371a7b8157a3ffb70f (patch)
treedfa8c8a68333bd1d51a14f6cdeb69a78cd597507 /src
parentsmall fix for audio only stream (diff)
audio only works now
Diffstat (limited to 'src')
-rw-r--r--src/audio.json15
-rwxr-xr-xsrc/flufigut.py91
-rw-r--r--src/test.json19
-rw-r--r--src/test2.json19
4 files changed, 99 insertions, 45 deletions
diff --git a/src/audio.json b/src/audio.json
index 1d6e15c..133e776 100644
--- a/src/audio.json
+++ b/src/audio.json
@@ -25,12 +25,15 @@
}
},
"input": {
- "source": "decklink",
- "samplerate": 48000,
- "device": 0,
- "connection": 0,
- "audio-input": 0,
- "mode": 16
+ "alsa": {
+ "type": "ao",
+ "source": "soundcard",
+ "properties": {
+ "samplerate": 48000,
+ "depth": 16,
+ "channels": 2
+ }
+ }
},
"transcode": {
"ogg": [ "high", "medium", "low" ]
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)
diff --git a/src/test.json b/src/test.json
index 59e8334..750141f 100644
--- a/src/test.json
+++ b/src/test.json
@@ -42,13 +42,18 @@
}
},
"input": {
- "source": "decklink",
- "resolution": "720p25",
- "samplerate": 48000,
- "device": 0,
- "connection": 0,
- "audio-input": 0,
- "mode": 16
+ "sdi-av": {
+ "type": "av",
+ "source": "decklink",
+ "properties": {
+ "resolution": "720p25",
+ "samplerate": 48000,
+ "device": 0,
+ "connection": 0,
+ "audio-input": 0,
+ "mode": 16
+ }
+ }
},
"transcode": {
"flash": [ "high", "medium", "low" ],
diff --git a/src/test2.json b/src/test2.json
index 7e76ecb..6ed03b4 100644
--- a/src/test2.json
+++ b/src/test2.json
@@ -37,13 +37,18 @@
}
},
"input": {
- "source": "decklink",
- "resolution": "720p25",
- "samplerate": 48000,
- "device": 0,
- "connection": 0,
- "audio-input": 0,
- "mode": 16
+ "sdi-av": {
+ "type": "av",
+ "source": "decklink",
+ "properties": {
+ "resolution": "720p25",
+ "samplerate": 48000,
+ "device": 0,
+ "connection": 0,
+ "audio-input": 0,
+ "mode": 16
+ }
+ }
},
"transcode": {
"flash": [ "high", "medium", "low" ],