summaryrefslogtreecommitdiff
path: root/voctocore
diff options
context:
space:
mode:
authorMaZderMind <github@mazdermind.de>2014-07-29 23:44:07 +0200
committerMaZderMind <github@mazdermind.de>2014-07-29 23:44:07 +0200
commit5c0570c8e66bc1e2e8167e8660305a28b7ba659b (patch)
treefac3727d9f194188db5af47b9afcd39f07670b48 /voctocore
parentc752709208522a5a04416e0d033aa32f8c0dc8c0 (diff)
demonstrate use of bins for dynamic input configuration
Diffstat (limited to 'voctocore')
-rw-r--r--voctocore/videomix.py27
1 files changed, 18 insertions, 9 deletions
diff --git a/voctocore/videomix.py b/voctocore/videomix.py
index 1426cb4..4ed9d25 100644
--- a/voctocore/videomix.py
+++ b/voctocore/videomix.py
@@ -10,17 +10,26 @@ class Videomix:
self.pipeline = Gst.parse_launch("""
videomixer name=livevideo ! autovideosink
input-selector name=liveaudio ! autoaudiosink
-
- uridecodebin name=cam0 uri=file:///home/peter/122.mp4
- uridecodebin name=cam1 uri=file:///home/peter/10025.mp4
-
- cam0. ! videoconvert ! videoscale ! videorate ! video/x-raw,width=1024,height=576,framerate=25/1 ! livevideo.
- cam1. ! videoconvert ! videoscale ! videorate ! video/x-raw,width=1024,height=576,framerate=25/1 ! livevideo.
-
- cam0. ! audioconvert ! liveaudio.
- cam1. ! audioconvert ! liveaudio.
""")
+ uris = ('file:///home/peter/122.mp4', 'file:///home/peter/10025.mp4',)
+ for idx, uri in enumerate(uris):
+ # create a bin for camera input
+ camberabin = Gst.parse_bin_from_description("""
+ uridecodebin name=input
+ input. ! videoconvert ! videoscale ! videorate ! video/x-raw,width=1024,height=576,framerate=25/1 ! identity name=video_src
+ input. ! audioconvert name=audio_src
+ """, False)
+
+ # configure camera input
+ camberabin.get_by_name('input').set_property('uri', uri)
+
+ # add to pipeline and link to mixers
+ self.pipeline.add(camberabin)
+ camberabin.get_by_name('video_src').link(self.pipeline.get_by_name('livevideo'))
+ camberabin.get_by_name('audio_src').link(self.pipeline.get_by_name('liveaudio'))
+
+ # demonstrate some control
liveaudio = self.pipeline.get_by_name('liveaudio')
liveaudio.set_property('active-pad', liveaudio.get_static_pad('sink_0'))