summaryrefslogtreecommitdiff
path: root/voctocore/lib
diff options
context:
space:
mode:
authorMaZderMind <git@mazdermind.de>2016-08-04 17:45:54 +0200
committerMaZderMind <git@mazdermind.de>2016-08-04 17:45:54 +0200
commit2fb283d47d583fad5572400835876789f212c986 (patch)
treefd1109ed069f5533809be7a1ecf919769de975dd /voctocore/lib
parent7edf8ecf415fb98221c76d84de9bd7770bdb3c0e (diff)
allows separate defaults for each of the composition modes
Diffstat (limited to 'voctocore/lib')
-rw-r--r--voctocore/lib/pipeline.py1
-rw-r--r--voctocore/lib/videomix.py41
2 files changed, 29 insertions, 13 deletions
diff --git a/voctocore/lib/pipeline.py b/voctocore/lib/pipeline.py
index a705871..a13f1d2 100644
--- a/voctocore/lib/pipeline.py
+++ b/voctocore/lib/pipeline.py
@@ -17,7 +17,6 @@ class Pipeline(object):
self.log = logging.getLogger('Pipeline')
self.log.info('Video-Caps configured to: %s', Config.get('mix', 'videocaps'))
self.log.info('Audio-Caps configured to: %s', Config.get('mix', 'audiocaps'))
- self.log.info('Default composit a source configured to: %s', Config.get('mix', 'defcompa'))
names = Config.getlist('mix', 'sources')
if len(names) < 1:
diff --git a/voctocore/lib/videomix.py b/voctocore/lib/videomix.py
index 047f0d4..2fa9200 100644
--- a/voctocore/lib/videomix.py
+++ b/voctocore/lib/videomix.py
@@ -30,8 +30,6 @@ class VideoMix(object):
def __init__(self):
self.caps = Config.get('mix', 'videocaps')
- self.defcompa = int(Config.get('mix', 'defcompa'))
-
self.names = Config.getlist('mix', 'sources')
self.log.info('Configuring Mixer for %u Sources', len(self.names))
@@ -298,6 +296,33 @@ class VideoMix(object):
mixerpad.set_property('alpha', state.alpha)
mixerpad.set_property('zorder', state.zorder)
+ def selectCompositeModeDefaultSources(self):
+ sectionNames = {
+ CompositeModes.fullscreen: 'fullscreen',
+ CompositeModes.side_by_side_equal: 'side-by-side-equal',
+ CompositeModes.side_by_side_preview: 'side-by-side-preview',
+ CompositeModes.picture_in_picture: 'picture-in-picture'
+ }
+
+ compositeModeName = self.compositeMode.name
+ sectionName = sectionNames[self.compositeMode]
+
+ try:
+ defSource = Config.get(sectionName, 'default-a')
+ self.setVideoSourceA(self.names.index(defSource))
+ self.log.info('Changing sourceA to default of Mode %s: %s', compositeModeName, defSource)
+ except Exception as e:
+ print(e)
+ pass
+
+ try:
+ defSource = Config.get(sectionName, 'default-b')
+ self.setVideoSourceB(self.names.index(defSource))
+ self.log.info('Changing sourceB to default of Mode %s: %s', compositeModeName, defSource)
+ except Exception as e:
+ print(e)
+ pass
+
def on_handoff(self, object, buffer):
if self.padStateDirty:
self.padStateDirty = False
@@ -336,17 +361,9 @@ class VideoMix(object):
return self.sourceB
def setCompositeMode(self, mode):
-
- print(str(self.sourceA) + ' Source ID')
- print(str(self.defcompa) + 'defcomp')
- if self.defcompa != -1:
- if self.sourceA != self.defcompa:
- self.sourceB = self.sourceA
- self.sourceA = self.defcompa
- print(str(self.sourceA) + ' A ' + str(self.sourceB) + ' B')
-
-
self.compositeMode = mode
+
+ self.selectCompositeModeDefaultSources()
self.recalculateMixerState()
def getCompositeMode(self):