diff options
author | MaZderMind <peter@mazdermind.de> | 2014-08-30 19:26:54 +0200 |
---|---|---|
committer | MaZderMind <peter@mazdermind.de> | 2014-08-30 19:26:54 +0200 |
commit | 14be298e81954080f089ea219c1b3c687c6def18 (patch) | |
tree | 51d7ee9553a53b4fa4aca4c3f96552588ad3b53f | |
parent | 795cdf591e86670dfc81fe6da70747ddfdc9b753 (diff) |
link videomixer via requested ghostpad
-rw-r--r-- | voctocore/lib/pipeline.py | 6 | ||||
-rw-r--r-- | voctocore/lib/quadmix.py | 4 | ||||
-rw-r--r-- | voctocore/lib/videomix.py | 25 |
3 files changed, 16 insertions, 19 deletions
diff --git a/voctocore/lib/pipeline.py b/voctocore/lib/pipeline.py index e60c95a..35ecf2a 100644 --- a/voctocore/lib/pipeline.py +++ b/voctocore/lib/pipeline.py @@ -59,10 +59,8 @@ class Pipeline(Gst.Pipeline): mixerpad = self.quadmixer.request_mixer_pad() distributor.get_static_pad('src_a').link(mixerpad) - self.videomixer.add_source(distributor) - - # distributor.link(self.quadmixer) - # distributor.link(self.videomixer) + mixerpad = self.videomixer.request_mixer_pad() + distributor.get_static_pad('src_b').link(mixerpad) # for audiosource in Config.getlist('sources', 'audio'): # sourcebin = FailsafeShmSrc(os.path.join(socketpath, audiosource)) diff --git a/voctocore/lib/quadmix.py b/voctocore/lib/quadmix.py index b72e56d..8d69304 100644 --- a/voctocore/lib/quadmix.py +++ b/voctocore/lib/quadmix.py @@ -49,7 +49,7 @@ class QuadMix(Gst.Bin): self.mixerpads.append(mixerpad) srcpad.link(mixerpad) - self.log.info('requested mixerpad %u', len(self.mixerpads) - 1) + self.log.info('requested mixerpad %u (named %s)', len(self.mixerpads) - 1, mixerpad.get_name()) ghostpad = Gst.GhostPad.new(mixerpad.get_name(), sinkpad) self.add_pad(ghostpad) return ghostpad @@ -124,7 +124,7 @@ class QuadMix(Gst.Bin): place[0] = 0 def set_active(self, target): - self.log.info('enabling videosource %u, disabling other', target) + self.log.info('setting videosource %u active, disabling other', target) for idx, previewbin in enumerate(self.previewbins): previewbin.set_active(target == idx) diff --git a/voctocore/lib/videomix.py b/voctocore/lib/videomix.py index d32dd90..3f2dd7e 100644 --- a/voctocore/lib/videomix.py +++ b/voctocore/lib/videomix.py @@ -6,7 +6,7 @@ from lib.config import Config class VideoMix(Gst.Bin): log = logging.getLogger('VideoMix') - sinkpads = [] + mixerpads = [] def __init__(self): super().__init__() @@ -27,18 +27,17 @@ class VideoMix(Gst.Bin): Gst.GhostPad.new('src', self.conv.get_static_pad('src')) ) - # I don't know how to create a on-request ghost-pad - def add_source(self, src): - self.log.info('adding source %s', src.get_name()) - sinkpad = self.mixer.get_request_pad('sink_%u') - sinkpad.set_property('alpha', 1) - self.sinkpads.append(sinkpad) + def request_mixer_pad(self): + mixerpad = self.mixer.get_request_pad('sink_%u') + self.mixerpads.append(mixerpad) + mixerpad.set_property('alpha', 1) - #srcpad = src.get_compatible_pad(sinkpad, None) - #srcpad.link(sinkpad) - src.link(self.mixer) # linking ghost pads + self.log.info('requested mixerpad %u (named %s)', len(self.mixerpads) - 1, mixerpad.get_name()) + ghostpad = Gst.GhostPad.new(mixerpad.get_name(), mixerpad) + self.add_pad(ghostpad) + return ghostpad def set_active(self, target): - self.log.info('setting source #%u active', target) - for idx, sinkpad in enumerate(self.sinkpads): - sinkpad.set_property('alpha', int(target == idx)) + self.log.info('setting videosource %u active, disabling other', target) + for idx, mixerpad in enumerate(self.mixerpads): + mixerpad.set_property('alpha', int(target == idx)) |