diff options
Diffstat (limited to 'voctocore/lib/videomix.py')
-rw-r--r-- | voctocore/lib/videomix.py | 41 |
1 files changed, 29 insertions, 12 deletions
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): |