aboutsummaryrefslogtreecommitdiff
path: root/voctocore
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
parent7edf8ecf415fb98221c76d84de9bd7770bdb3c0e (diff)
allows separate defaults for each of the composition modes
Diffstat (limited to 'voctocore')
-rw-r--r--voctocore/default-config.ini17
-rw-r--r--voctocore/lib/pipeline.py1
-rw-r--r--voctocore/lib/videomix.py41
3 files changed, 43 insertions, 16 deletions
diff --git a/voctocore/default-config.ini b/voctocore/default-config.ini
index 5b552e0..b93c312 100644
--- a/voctocore/default-config.ini
+++ b/voctocore/default-config.ini
@@ -4,24 +4,35 @@ audiocaps=audio/x-raw,format=S16LE,channels=2,layout=interleaved,rate=48000
; tcp-ports will be 10000,10001,10002
sources=cam1,cam2,grabber
-; defcompa sets a default A for the composite view. This value can either be -1 (disbaled) or one of the
-; sources defined in 'sources' counted startung with zero (e.g. first source is 0)
-defcompa=-1
+
[side-by-side-equal]
; defaults to 1% of the video width
;gutter=12
;ypos=200
+; if configured, switching to the sbs-equal mode will automatically select these
+; sources. if not configured, it will not change the last set sources
+;default-a=cam1
+;default-b=cam2
+
[side-by-side-preview]
;asize=1024x576
;apos=12/12
;bsize=320x180
;bpos=948/528
+; automatically select these sources when switching to sbs-preview
+;default-a=grabber
+;default-b=cam1
+
[picture-in-picture]
;pipsize=320x180
;pippos=948/528
+; automatically select these sources when switching to pip
+;default-a=grabber
+;default-b=cam1
+
[previews]
; disable if ui & server run on the same computer and can exchange uncompressed video frames
enabled=false
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):