aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaZderMind <github@mazdermind.de>2015-05-10 20:59:37 +0200
committerMaZderMind <github@mazdermind.de>2015-05-10 20:59:37 +0200
commitff90df796c715ee9c95fb8a2152cea2698fe92ab (patch)
tree626e514d66c9433ea156af1d684337dacbc24087
parente104284f309b4492325931c5b47a16505e44a9a1 (diff)
implement mixer & test-output
-rw-r--r--voctocore/default-config.ini2
-rw-r--r--voctocore/lib/pipeline.py21
-rw-r--r--voctocore/lib/video/mix.py41
-rw-r--r--voctocore/lib/video/rawoutput.py2
-rw-r--r--voctocore/lib/video/src.py2
-rwxr-xr-xvoctocore/scripts/audio-source-cam1.sh (renamed from voctocore/scripts/test-audio-cam1.sh)0
-rwxr-xr-xvoctocore/scripts/video-play-cam1-mirror.sh (renamed from voctocore/scripts/play-cam1-mirror.sh)0
-rwxr-xr-xvoctocore/scripts/video-play-cam2-mirror.sh5
-rwxr-xr-xvoctocore/scripts/video-play-mixer-output.sh5
-rwxr-xr-xvoctocore/scripts/video-source-cam1.sh (renamed from voctocore/scripts/test-video-cam1.sh)0
-rwxr-xr-xvoctocore/scripts/video-source-cam2.sh7
11 files changed, 75 insertions, 10 deletions
diff --git a/voctocore/default-config.ini b/voctocore/default-config.ini
index ccf80b5..802e1af 100644
--- a/voctocore/default-config.ini
+++ b/voctocore/default-config.ini
@@ -8,7 +8,7 @@ encode_previews=true
[sources]
; tcp-ports will be 10000,10001
; video=cam1,cam2,grabber
-video=cam1
+video=cam1,cam2
; tcp-ports will be 20000,20001
audio=cam1,cam2
diff --git a/voctocore/lib/pipeline.py b/voctocore/lib/pipeline.py
index 5687573..fb9b846 100644
--- a/voctocore/lib/pipeline.py
+++ b/voctocore/lib/pipeline.py
@@ -18,12 +18,21 @@ class Pipeline(object):
vsources = []
vmirrors = []
vpreviews = []
+ vmixer = None
+ vmixerout = None
def __init__(self):
+ self.initVideo()
+
+ def initVideo(self):
caps = Config.get('mix', 'videocaps')
self.log.info('Video-Caps configured to: %s', caps)
- for idx, name in enumerate(Config.getlist('sources', 'video')):
+ names = Config.getlist('sources', 'video')
+ if len(names) < 1:
+ raise RuntimeException("At least one Video-Source must be configured!")
+
+ for idx, name in enumerate(names):
port = 10000 + idx
self.log.info('Creating Video-Source %s at tcp-port %u', name, port)
@@ -37,9 +46,9 @@ class Pipeline(object):
mirror = VideoRawOutput('video_%s_mirror' % name, port, caps)
self.vmirrors.append(mirror)
- # self.log.debug('Creating Video-Mixer')
- # self.videomixer = VideoMix()
+ self.log.debug('Creating Video-Mixer')
+ self.videomixer = VideoMix()
- # port = 11000
- # self.log.debug('Creating Video-Mixer-Output at tcp-port %u', port)
- # mirror = VideoRawOutput('video_mix', port, caps)
+ port = 11000
+ self.log.debug('Creating Video-Mixer-Output at tcp-port %u', port)
+ self.vmixerout = VideoRawOutput('video_mix', port, caps)
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(),
diff --git a/voctocore/scripts/test-audio-cam1.sh b/voctocore/scripts/audio-source-cam1.sh
index 0ca10d8..0ca10d8 100755
--- a/voctocore/scripts/test-audio-cam1.sh
+++ b/voctocore/scripts/audio-source-cam1.sh
diff --git a/voctocore/scripts/play-cam1-mirror.sh b/voctocore/scripts/video-play-cam1-mirror.sh
index 75e65c7..75e65c7 100755
--- a/voctocore/scripts/play-cam1-mirror.sh
+++ b/voctocore/scripts/video-play-cam1-mirror.sh
diff --git a/voctocore/scripts/video-play-cam2-mirror.sh b/voctocore/scripts/video-play-cam2-mirror.sh
new file mode 100755
index 0000000..75e65c7
--- /dev/null
+++ b/voctocore/scripts/video-play-cam2-mirror.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+gst-launch-1.0 \
+ tcpclientsrc host=localhost port=13000 !\
+ gdpdepay !\
+ xvimagesink
diff --git a/voctocore/scripts/video-play-mixer-output.sh b/voctocore/scripts/video-play-mixer-output.sh
new file mode 100755
index 0000000..c33b8f3
--- /dev/null
+++ b/voctocore/scripts/video-play-mixer-output.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+gst-launch-1.0 \
+ tcpclientsrc host=localhost port=11000 !\
+ gdpdepay !\
+ xvimagesink
diff --git a/voctocore/scripts/test-video-cam1.sh b/voctocore/scripts/video-source-cam1.sh
index e920c43..e920c43 100755
--- a/voctocore/scripts/test-video-cam1.sh
+++ b/voctocore/scripts/video-source-cam1.sh
diff --git a/voctocore/scripts/video-source-cam2.sh b/voctocore/scripts/video-source-cam2.sh
new file mode 100755
index 0000000..403b852
--- /dev/null
+++ b/voctocore/scripts/video-source-cam2.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+gst-launch-1.0 \
+ videotestsrc pattern=ball !\
+ video/x-raw,format=I420,width=1280,height=720,framerate=25/1,pixel-aspect-ratio=1/1 !\
+ timeoverlay valignment=bottom !\
+ gdppay !\
+ tcpclientsink host=localhost port=10001