From 421ae902167ec993afe5b0c54909e22c245dfe6a Mon Sep 17 00:00:00 2001 From: MaZderMind Date: Thu, 14 May 2015 13:15:52 +0200 Subject: Re-Enable Video-Mixing capabilities and implement dummy Audio-Mixer --- voctocore/lib/audiomix.py | 17 +++++++++++++++-- voctocore/lib/commands.py | 6 +++--- voctocore/lib/pipeline.py | 21 +++++++++++++++++++-- voctocore/lib/videomix.py | 7 ++++--- 4 files changed, 41 insertions(+), 10 deletions(-) (limited to 'voctocore') diff --git a/voctocore/lib/audiomix.py b/voctocore/lib/audiomix.py index bd803b2..24c34a9 100644 --- a/voctocore/lib/audiomix.py +++ b/voctocore/lib/audiomix.py @@ -6,7 +6,7 @@ from enum import Enum from lib.config import Config class AudioMix(object): - log = logging.getLogger('VideoMix') + log = logging.getLogger('AudioMix') mixingPipeline = None @@ -16,4 +16,17 @@ class AudioMix(object): selectedSource = 0 def __init__(self): - pass + self.caps = Config.get('mix', 'audiocaps') + + pipeline = """ + interaudiosrc channel=audio_cam1_mixer ! + {caps} ! + queue ! + interaudiosink channel=audio_mix + """.format( + caps=self.caps + ) + + self.log.debug('Creating Mixing-Pipeline:\n%s', pipeline) + self.mixingPipeline = Gst.parse_launch(pipeline) + self.mixingPipeline.set_state(Gst.State.PLAYING) diff --git a/voctocore/lib/commands.py b/voctocore/lib/commands.py index 9673e57..c898baf 100644 --- a/voctocore/lib/commands.py +++ b/voctocore/lib/commands.py @@ -27,12 +27,12 @@ class ControlServerCommands(): def set_video_a(self, src_name_or_id): src_id = self.decodeSourceName(src_name_or_id) - self.pipeline.vmixer.setVideoA(src_id) + self.pipeline.vmix.setVideoA(src_id) return True def set_video_b(self, src_name_or_id): src_id = self.decodeSourceName(src_name_or_id) - self.pipeline.vmixer.setVideoB(src_id) + self.pipeline.vmix.setVideoB(src_id) return True def set_composite_mode(self, composite_mode): @@ -41,5 +41,5 @@ class ControlServerCommands(): except KeyError as e: raise KeyError("composite-mode %s unknown" % composite_mode) - self.pipeline.vmixer.setCompositeMode(mode) + self.pipeline.vmix.setCompositeMode(mode) return True diff --git a/voctocore/lib/pipeline.py b/voctocore/lib/pipeline.py index 03fdd3d..3aa8085 100644 --- a/voctocore/lib/pipeline.py +++ b/voctocore/lib/pipeline.py @@ -6,13 +6,17 @@ from gi.repository import Gst from lib.config import Config from lib.avsource import AVSource from lib.avrawoutput import AVRawOutput +from lib.videomix import VideoMix +from lib.audiomix import AudioMix class Pipeline(object): """mixing, streaming and encoding pipeline constuction and control""" log = logging.getLogger('Pipeline') sources = [] - mirrors = [] + outputs = [] + vmix = None + amix = None def __init__(self): self.log.info('Video-Caps configured to: %s', Config.get('mix', 'videocaps')) @@ -35,4 +39,17 @@ class Pipeline(object): self.log.info('Creating Mirror-Output for AVSource %s at tcp-port %u', name, port) mirror = AVRawOutput('%s_mirror' % name, port) - self.mirrors.append(mirror) + self.outputs.append(mirror) + + + self.log.info('Creating Videmixer') + self.vmix = VideoMix() + + self.log.info('Creating Videmixer') + self.amix = AudioMix() + + port = 11000 + self.log.info('Creating Mixer-Output at tcp-port %u', port) + + output = AVRawOutput('mix', port) + self.outputs.append(output) diff --git a/voctocore/lib/videomix.py b/voctocore/lib/videomix.py index bcac7d2..dbebede 100644 --- a/voctocore/lib/videomix.py +++ b/voctocore/lib/videomix.py @@ -24,13 +24,14 @@ class VideoMix(object): def __init__(self): self.caps = Config.get('mix', 'videocaps') - self.names = Config.getlist('sources', 'video') + self.names = Config.getlist('mix', 'sources') self.log.info('Configuring Mixer for %u Sources', len(self.names)) pipeline = """ videomixer name=mix ! {caps} ! - textoverlay text=mixer halignment=left valignment=top ypad=175 ! + textoverlay halignment=left valignment=top ypad=175 text=VideoMix ! + timeoverlay halignment=left valignment=top ypad=175 xpad=400 ! intervideosink channel=video_mix """.format( caps=self.caps @@ -55,7 +56,7 @@ class VideoMix(object): self.log.debug('Initializing Mixer-State') self.updateMixerState() - self.log.debug('Launching Mixing-Pipeline:\n%s', pipeline) + self.log.debug('Launching Mixing-Pipeline') self.mixingPipeline.set_state(Gst.State.PLAYING) def updateMixerState(self): -- cgit v1.2.3