summaryrefslogtreecommitdiff
path: root/voctocore
diff options
context:
space:
mode:
authorMaZderMind <git@mazdermind.de>2016-08-05 16:26:19 +0200
committerMaZderMind <git@mazdermind.de>2016-08-05 16:26:19 +0200
commit59f0abcf365e7c80bb51912d95ccc6d262d759c8 (patch)
tree6522358a4ce194736645f8e15b6425065ebb2714 /voctocore
parent73a800f74b8a606ce1e970243cc5e707046f0ef6 (diff)
parent24d3c9a08fd5e02998ba965642d5fd934f525466 (diff)
Merge branch 'default-composite'
Diffstat (limited to 'voctocore')
-rw-r--r--voctocore/default-config.ini18
-rw-r--r--voctocore/lib/commands.py10
-rw-r--r--voctocore/lib/videomix.py29
3 files changed, 54 insertions, 3 deletions
diff --git a/voctocore/default-config.ini b/voctocore/default-config.ini
index 398b613..8afd76b 100644
--- a/voctocore/default-config.ini
+++ b/voctocore/default-config.ini
@@ -5,21 +5,39 @@ audiocaps=audio/x-raw,format=S16LE,channels=2,layout=interleaved,rate=48000
; tcp-ports will be 10000,10001,10002
sources=cam1,cam2,grabber
+[fullscreen]
+; if configured, switching to fullscreen will automatically select this
+; source. if not configured, it will not change the last set source
+;default-a=cam1
+
[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/commands.py b/voctocore/lib/commands.py
index 64d1c57..bfe3168 100644
--- a/voctocore/lib/commands.py
+++ b/voctocore/lib/commands.py
@@ -115,9 +115,13 @@ class ControlServerCommands(object):
mode = decodeEnumName(CompositeModes, mode_name_or_id)
self.pipeline.vmix.setCompositeMode(mode)
- status = self._get_composite_status()
- return NotifyResponse('composite_mode', status)
-
+ composite_status = self._get_composite_status()
+ video_status = self._get_video_status()
+ return [
+ NotifyResponse('composite_mode', composite_status),
+ NotifyResponse('video_status', *video_status)
+ ]
+
def set_videos_and_composite(self, src_a_name_or_id, src_b_name_or_id, mode_name_or_id):
if src_a_name_or_id != '*':
src_a_id = decodeName(self.sources, src_a_name_or_id)
diff --git a/voctocore/lib/videomix.py b/voctocore/lib/videomix.py
index 7ff98c2..2fa9200 100644
--- a/voctocore/lib/videomix.py
+++ b/voctocore/lib/videomix.py
@@ -296,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
@@ -335,6 +362,8 @@ class VideoMix(object):
def setCompositeMode(self, mode):
self.compositeMode = mode
+
+ self.selectCompositeModeDefaultSources()
self.recalculateMixerState()
def getCompositeMode(self):