blob: f3243f36af2c3ed114f6e6812945cc7382b283f2 (
plain)
- #!/usr/bin/python3
- import logging
- from lib.config import Config
- class ControlServerCommands():
- log = logging.getLogger('ControlServerCommands')
- pipeline = None
- vnames = []
- def __init__(self, pipeline):
- self.pipeline = pipeline
- self.vnames = Config.getlist('sources', 'video')
- def decodeVideoSrcName(self, src_name_or_id):
- if isinstance(src_name_or_id, str):
- try:
- return self.vnames.index(src_name_or_id)
- except Exception as e:
- raise IndexError("video-source %s unknown" % src_name_or_id)
- if src_name_or_id < 0 or src_name_or_id >= len(self.vnames):
- raise IndexError("video-source %s unknown" % src_name_or_id)
- def set_video_a(self, src_name_or_id):
- src_id = self.decodeVideoSrcName(src_name_or_id)
- self.pipeline.vmixer.setVideoA(src_id)
- return True
- def set_video_b(self, src_name_or_id):
- src_id = self.decodeVideoSrcName(src_name_or_id)
- self.pipeline.vmixer.setVideoB(src_id)
- return True
- def set_composite_mode(self, composite_mode):
- self.pipeline.vmixer.set_composite_mode(src_name_or_id)
- return True
|