From ff90df796c715ee9c95fb8a2152cea2698fe92ab Mon Sep 17 00:00:00 2001 From: MaZderMind Date: Sun, 10 May 2015 20:59:37 +0200 Subject: implement mixer & test-output --- voctocore/lib/video/mix.py | 41 +++++++++++++++++++++++++++++++++++++++- voctocore/lib/video/rawoutput.py | 2 +- voctocore/lib/video/src.py | 2 +- 3 files changed, 42 insertions(+), 3 deletions(-) (limited to 'voctocore/lib/video') diff --git a/voctocore/lib/video/mix.py b/voctocore/lib/video/mix.py index 2d73d7b..8bb7036 100644 --- a/voctocore/lib/video/mix.py +++ b/voctocore/lib/video/mix.py @@ -7,9 +7,48 @@ from lib.config import Config class VideoMix(object): log = logging.getLogger('VideoMix') + mixingPipeline = None + def __init__(self): caps = Config.get('mix', 'videocaps') names = Config.getlist('sources', 'video') self.log.info('Configuring Mixer for %u Sources', len(names)) - #for idx, name in enumerate(): + + pipeline = """ + videomixer name=mix ! + {caps} ! + textoverlay text=mixer halignment=left valignment=top ypad=175 ! + intervideosink channel=video_mix + """.format( + caps=caps + ) + + for idx, name in enumerate(names): + pipeline += """ + intervideosrc channel=video_{name}_mixer ! + {caps} ! + videoscale ! + capsfilter name=caps_{idx} ! + mix. + """.format( + name=name, + caps=caps, + idx=idx + ) + + self.log.debug('Launching Mixing-Pipeline:\n%s', pipeline) + self.mixingPipeline = Gst.parse_launch(pipeline) + self.mixingPipeline.set_state(Gst.State.PLAYING) + + mixerpad = self.mixingPipeline.get_by_name('mix').get_static_pad('sink_0') + mixerpad.set_property('alpha', 0.5) + mixerpad.set_property('xpos', 64) + mixerpad.set_property('ypos', 64) + + mixerpad = self.mixingPipeline.get_by_name('mix').get_static_pad('sink_1') + mixerpad.set_property('alpha', 0.2) + + capsilter = self.mixingPipeline.get_by_name('caps_1') + capsilter.set_property('caps', Gst.Caps.from_string( + 'video/x-raw,width=320,height=180')) diff --git a/voctocore/lib/video/rawoutput.py b/voctocore/lib/video/rawoutput.py index ecdb1ba..bb9efc4 100644 --- a/voctocore/lib/video/rawoutput.py +++ b/voctocore/lib/video/rawoutput.py @@ -40,7 +40,7 @@ class VideoRawOutput(object): pipeline = """ intervideosrc channel={channel} ! {caps} ! - textoverlay text={channel} halignment=left valignment=top ypad=125 ! + textoverlay text={channel} halignment=left valignment=top ypad=225 ! gdppay ! fdsink fd={fd} """.format( diff --git a/voctocore/lib/video/src.py b/voctocore/lib/video/src.py index dbbe12d..404b60f 100644 --- a/voctocore/lib/video/src.py +++ b/voctocore/lib/video/src.py @@ -66,7 +66,7 @@ class VideoSrc(object): fdsrc fd={fd} ! gdpdepay ! {caps} ! - textoverlay text=video_{name}_fd halignment=left valignment=top ypad=175 ! + textoverlay text=video_{name}_fd halignment=left valignment=top ypad=125 ! intervideosink channel=video_{name}_in """.format( fd=conn.fileno(), -- cgit v1.2.3