diff options
Diffstat (limited to 'voctocore/lib')
-rw-r--r-- | voctocore/lib/audiomix.py | 12 | ||||
-rw-r--r-- | voctocore/lib/avpreviewoutput.py | 7 | ||||
-rw-r--r-- | voctocore/lib/avrawoutput.py | 7 | ||||
-rw-r--r-- | voctocore/lib/avsource.py | 7 | ||||
-rw-r--r-- | voctocore/lib/commands.py | 7 | ||||
-rw-r--r-- | voctocore/lib/controlserver.py | 5 | ||||
-rw-r--r-- | voctocore/lib/helper.py | 12 | ||||
-rw-r--r-- | voctocore/lib/pipeline.py | 14 | ||||
-rw-r--r-- | voctocore/lib/tcpmulticonnection.py | 15 | ||||
-rw-r--r-- | voctocore/lib/tcpsingleconnection.py | 10 | ||||
-rw-r--r-- | voctocore/lib/videomix.py | 13 |
11 files changed, 27 insertions, 82 deletions
diff --git a/voctocore/lib/audiomix.py b/voctocore/lib/audiomix.py index 1be32d4..857600f 100644 --- a/voctocore/lib/audiomix.py +++ b/voctocore/lib/audiomix.py @@ -6,18 +6,12 @@ from enum import Enum from lib.config import Config class AudioMix(object): - log = logging.getLogger('AudioMix') - - mixingPipeline = None - - caps = None - names = [] + def __init__(self): + self.log = logging.getLogger('AudioMix') - selectedSource = 0 + self.selectedSource = 0 - def __init__(self): self.caps = Config.get('mix', 'audiocaps') - self.names = Config.getlist('mix', 'sources') self.log.info('Configuring Mixer for %u Sources', len(self.names)) diff --git a/voctocore/lib/avpreviewoutput.py b/voctocore/lib/avpreviewoutput.py index 0ad3515..3a40a00 100644 --- a/voctocore/lib/avpreviewoutput.py +++ b/voctocore/lib/avpreviewoutput.py @@ -6,13 +6,6 @@ from lib.config import Config from lib.tcpmulticonnection import TCPMultiConnection class AVPreviewOutput(TCPMultiConnection): - log = logging.getLogger('AVPreviewOutput') - - name = None - caps = None - - receiverPipeline = None - def __init__(self, channel, port): self.log = logging.getLogger('AVPreviewOutput['+channel+']') super().__init__(port) diff --git a/voctocore/lib/avrawoutput.py b/voctocore/lib/avrawoutput.py index 69c90a2..3c7d739 100644 --- a/voctocore/lib/avrawoutput.py +++ b/voctocore/lib/avrawoutput.py @@ -6,13 +6,6 @@ from lib.config import Config from lib.tcpmulticonnection import TCPMultiConnection class AVRawOutput(TCPMultiConnection): - log = logging.getLogger('AVRawOutput') - - name = None - caps = None - - receiverPipeline = None - def __init__(self, channel, port): self.log = logging.getLogger('AVRawOutput['+channel+']') super().__init__(port) diff --git a/voctocore/lib/avsource.py b/voctocore/lib/avsource.py index 920d906..c84ce85 100644 --- a/voctocore/lib/avsource.py +++ b/voctocore/lib/avsource.py @@ -6,13 +6,6 @@ from lib.config import Config from lib.tcpsingleconnection import TCPSingleConnection class AVSource(TCPSingleConnection): - log = logging.getLogger('AVSource') - - name = None - caps = None - - receiverPipeline = None - def __init__(self, name, port): self.log = logging.getLogger('AVSource['+name+']') super().__init__(port) diff --git a/voctocore/lib/commands.py b/voctocore/lib/commands.py index 5975e98..58dd234 100644 --- a/voctocore/lib/commands.py +++ b/voctocore/lib/commands.py @@ -5,12 +5,9 @@ from lib.config import Config from lib.videomix import CompositeModes class ControlServerCommands(): - log = logging.getLogger('ControlServerCommands') - - pipeline = None - vnames = [] - def __init__(self, pipeline): + self.log = logging.getLogger('ControlServerCommands') + self.pipeline = pipeline self.sources = Config.getlist('mix', 'sources') diff --git a/voctocore/lib/controlserver.py b/voctocore/lib/controlserver.py index 8ebb11b..c457fee 100644 --- a/voctocore/lib/controlserver.py +++ b/voctocore/lib/controlserver.py @@ -6,12 +6,9 @@ from lib.commands import ControlServerCommands from lib.tcpmulticonnection import TCPMultiConnection class ControlServer(TCPMultiConnection): - log = logging.getLogger('ControlServer') - - boundSocket = None - def __init__(self, pipeline): '''Initialize server and start listening.''' + self.log = logging.getLogger('ControlServer') super().__init__(port=9999) self.commands = ControlServerCommands(pipeline) diff --git a/voctocore/lib/helper.py b/voctocore/lib/helper.py deleted file mode 100644 index ac9bfe5..0000000 --- a/voctocore/lib/helper.py +++ /dev/null @@ -1,12 +0,0 @@ -from gi.repository import Gst - -def iteratorHelper(it): - while True: - result, value = it.next() - if result == Gst.IteratorResult.DONE: - break - - if result != Gst.IteratorResult.OK: - raise IteratorError(result) - - yield value diff --git a/voctocore/lib/pipeline.py b/voctocore/lib/pipeline.py index 5a9ce3e..9addca0 100644 --- a/voctocore/lib/pipeline.py +++ b/voctocore/lib/pipeline.py @@ -12,17 +12,9 @@ from lib.audiomix import AudioMix class Pipeline(object): """mixing, streaming and encoding pipeline constuction and control""" - log = logging.getLogger('Pipeline') - - sources = [] - mirrors = [] - previews = [] - - vmix = None - amix = None - mixout = None def __init__(self): + 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')) @@ -30,6 +22,10 @@ class Pipeline(object): if len(names) < 1: raise RuntimeException("At least one AVSource must be configured!") + self.sources = [] + self.mirrors = [] + self.previews = [] + self.log.info('Creating %u Creating AVSources: %s', len(names), names) for idx, name in enumerate(names): port = 10000 + idx diff --git a/voctocore/lib/tcpmulticonnection.py b/voctocore/lib/tcpmulticonnection.py index 2ca6921..201ecde 100644 --- a/voctocore/lib/tcpmulticonnection.py +++ b/voctocore/lib/tcpmulticonnection.py @@ -5,16 +5,15 @@ from gi.repository import GObject from lib.config import Config class TCPMultiConnection(object): - log = logging.getLogger('TCPMultiConnection') - - port = None - - boundSocket = None - currentConnections = [] - - def __init__(self, port): + if not hasattr(self, 'log'): + self.log = logging.getLogger('TCPMultiConnection') + self.port = port + self.port = None + + self.boundSocket = None + self.currentConnections = [] self.log.debug('Binding to Source-Socket on [::]:%u', port) self.boundSocket = socket.socket(socket.AF_INET6) diff --git a/voctocore/lib/tcpsingleconnection.py b/voctocore/lib/tcpsingleconnection.py index d6a05ef..e604ce6 100644 --- a/voctocore/lib/tcpsingleconnection.py +++ b/voctocore/lib/tcpsingleconnection.py @@ -7,12 +7,10 @@ from lib.config import Config class TCPSingleConnection(object): log = logging.getLogger('TCPSingleConnection') - port = None - - boundSocket = None - currentConnection = None - def __init__(self, port): + if not hasattr(self, 'log'): + self.log = logging.getLogger('TCPMultiConnection') + self.port = port self.log.debug('Binding to Source-Socket on [::]:%u', port) @@ -22,6 +20,8 @@ class TCPSingleConnection(object): self.boundSocket.bind(('::', port)) self.boundSocket.listen(1) + self.currentConnection = None + self.log.debug('Setting GObject io-watch on Socket') GObject.io_add_watch(self.boundSocket, GObject.IO_IN, self.on_connect) diff --git a/voctocore/lib/videomix.py b/voctocore/lib/videomix.py index 147b1ba..bd4ca70 100644 --- a/voctocore/lib/videomix.py +++ b/voctocore/lib/videomix.py @@ -12,15 +12,6 @@ class CompositeModes(Enum): class VideoMix(object): log = logging.getLogger('VideoMix') - mixingPipeline = None - - caps = None - names = [] - - compositeMode = CompositeModes.fullscreen - sourceA = 0 - sourceB = 1 - def __init__(self): self.caps = Config.get('mix', 'videocaps') @@ -62,6 +53,10 @@ class VideoMix(object): self.mixingPipeline = Gst.parse_launch(pipeline) self.log.debug('Initializing Mixer-State') + + self.compositeMode = CompositeModes.fullscreen + self.sourceA = 0 + self.sourceB = 1 self.updateMixerState() self.log.debug('Launching Mixing-Pipeline') |