aboutsummaryrefslogtreecommitdiff
path: root/voctocore
diff options
context:
space:
mode:
authorMaZderMind <git@mazdermind.de>2016-02-04 17:46:31 +0100
committerMaZderMind <git@mazdermind.de>2016-02-04 17:46:31 +0100
commit3e4b04b2d1bfd96b7018a2058cbb0a847e012cf7 (patch)
tree53da2041ced4fc463126725d6e66589897eb6576 /voctocore
parent140d4651afcdbf72a4b2637acd0c71925816eb82 (diff)
parent54775670b049a338d97b57218d36da00d778b432 (diff)
Merge branch 'nettime'
Diffstat (limited to 'voctocore')
-rw-r--r--voctocore/README.md1
-rw-r--r--voctocore/lib/audiomix.py2
-rw-r--r--voctocore/lib/avpreviewoutput.py2
-rw-r--r--voctocore/lib/avrawoutput.py2
-rw-r--r--voctocore/lib/avsource.py2
-rw-r--r--voctocore/lib/clock.py15
-rw-r--r--voctocore/lib/streamblanker.py2
-rw-r--r--voctocore/lib/videomix.py2
-rwxr-xr-xvoctocore/voctocore.py2
9 files changed, 29 insertions, 1 deletions
diff --git a/voctocore/README.md b/voctocore/README.md
index ac98694..f5ed2c3 100644
--- a/voctocore/README.md
+++ b/voctocore/README.md
@@ -36,6 +36,7 @@ Also, if enabled in Config, another Building-Block is chained after the Main-Mix
\-> Encoder* -> PreviewPort* 14000…
9999 Control-Server
+9998 GstNetTimeProvider Network-Clock
*) only when [previews] enabled=true is configured
**) only when [stream-blanker] enabled=true is configured
diff --git a/voctocore/lib/audiomix.py b/voctocore/lib/audiomix.py
index 1c72ede..6c1768a 100644
--- a/voctocore/lib/audiomix.py
+++ b/voctocore/lib/audiomix.py
@@ -3,6 +3,7 @@ from gi.repository import Gst
from enum import Enum
from lib.config import Config
+from lib.clock import Clock
class AudioMix(object):
def __init__(self):
@@ -47,6 +48,7 @@ class AudioMix(object):
self.log.debug('Creating Mixing-Pipeline:\n%s', pipeline)
self.mixingPipeline = Gst.parse_launch(pipeline)
+ self.mixingPipeline.use_clock(Clock)
self.log.debug('Binding Error & End-of-Stream-Signal on Mixing-Pipeline')
self.mixingPipeline.bus.add_signal_watch()
diff --git a/voctocore/lib/avpreviewoutput.py b/voctocore/lib/avpreviewoutput.py
index f757e1c..04ff637 100644
--- a/voctocore/lib/avpreviewoutput.py
+++ b/voctocore/lib/avpreviewoutput.py
@@ -3,6 +3,7 @@ from gi.repository import Gst
from lib.config import Config
from lib.tcpmulticonnection import TCPMultiConnection
+from lib.clock import Clock
class AVPreviewOutput(TCPMultiConnection):
def __init__(self, channel, port):
@@ -49,6 +50,7 @@ class AVPreviewOutput(TCPMultiConnection):
self.log.debug('Creating Output-Pipeline:\n%s', pipeline)
self.outputPipeline = Gst.parse_launch(pipeline)
+ self.outputPipeline.use_clock(Clock)
self.log.debug('Binding Error & End-of-Stream-Signal on Output-Pipeline')
self.outputPipeline.bus.add_signal_watch()
diff --git a/voctocore/lib/avrawoutput.py b/voctocore/lib/avrawoutput.py
index 62a03d2..60d2b37 100644
--- a/voctocore/lib/avrawoutput.py
+++ b/voctocore/lib/avrawoutput.py
@@ -3,6 +3,7 @@ from gi.repository import Gst
from lib.config import Config
from lib.tcpmulticonnection import TCPMultiConnection
+from lib.clock import Clock
class AVRawOutput(TCPMultiConnection):
def __init__(self, channel, port):
@@ -38,6 +39,7 @@ class AVRawOutput(TCPMultiConnection):
)
self.log.debug('Creating Output-Pipeline:\n%s', pipeline)
self.outputPipeline = Gst.parse_launch(pipeline)
+ self.outputPipeline.use_clock(Clock)
self.log.debug('Binding Error & End-of-Stream-Signal on Output-Pipeline')
self.outputPipeline.bus.add_signal_watch()
diff --git a/voctocore/lib/avsource.py b/voctocore/lib/avsource.py
index c9f4dea..f814c45 100644
--- a/voctocore/lib/avsource.py
+++ b/voctocore/lib/avsource.py
@@ -3,6 +3,7 @@ from gi.repository import Gst
from lib.config import Config
from lib.tcpsingleconnection import TCPSingleConnection
+from lib.clock import Clock
class AVSource(TCPSingleConnection):
def __init__(self, name, port, outputs=None, has_audio=True, has_video=True):
@@ -64,6 +65,7 @@ class AVSource(TCPSingleConnection):
self.log.debug('Launching Source-Pipeline:\n%s', pipeline)
self.receiverPipeline = Gst.parse_launch(pipeline)
+ self.receiverPipeline.use_clock(Clock)
self.log.debug('Binding End-of-Stream-Signal on Source-Pipeline')
self.receiverPipeline.bus.add_signal_watch()
diff --git a/voctocore/lib/clock.py b/voctocore/lib/clock.py
new file mode 100644
index 0000000..ed8152e
--- /dev/null
+++ b/voctocore/lib/clock.py
@@ -0,0 +1,15 @@
+#!/usr/bin/python3
+import logging
+from gi.repository import Gst, GstNet
+
+__all__ = ['Clock', 'NetTimeProvider']
+port = 9998
+
+log = logging.getLogger('Clock')
+
+log.debug("Obtaining System-Clock")
+Clock = Gst.SystemClock.obtain()
+log.info("Using System-Clock for all Pipelines: %s", Clock)
+
+log.info("Starting NetTimeProvider on Port %u", port)
+NetTimeProvider = GstNet.NetTimeProvider.new(Clock, None, port)
diff --git a/voctocore/lib/streamblanker.py b/voctocore/lib/streamblanker.py
index b3f460c..fea3d6a 100644
--- a/voctocore/lib/streamblanker.py
+++ b/voctocore/lib/streamblanker.py
@@ -3,6 +3,7 @@ from gi.repository import Gst
from enum import Enum
from lib.config import Config
+from lib.clock import Clock
class StreamBlanker(object):
log = logging.getLogger('StreamBlanker')
@@ -53,6 +54,7 @@ class StreamBlanker(object):
self.log.debug('Creating Mixing-Pipeline:\n%s', pipeline)
self.mixingPipeline = Gst.parse_launch(pipeline)
+ self.mixingPipeline.use_clock(Clock)
self.log.debug('Binding Error & End-of-Stream-Signal on Mixing-Pipeline')
self.mixingPipeline.bus.add_signal_watch()
diff --git a/voctocore/lib/videomix.py b/voctocore/lib/videomix.py
index 98614db..7ff98c2 100644
--- a/voctocore/lib/videomix.py
+++ b/voctocore/lib/videomix.py
@@ -3,6 +3,7 @@ from gi.repository import Gst
from enum import Enum, unique
from lib.config import Config
+from lib.clock import Clock
@unique
class CompositeModes(Enum):
@@ -71,6 +72,7 @@ class VideoMix(object):
self.log.debug('Creating Mixing-Pipeline:\n%s', pipeline)
self.mixingPipeline = Gst.parse_launch(pipeline)
+ self.mixingPipeline.use_clock(Clock)
self.log.debug('Binding Error & End-of-Stream-Signal on Mixing-Pipeline')
self.mixingPipeline.bus.add_signal_watch()
diff --git a/voctocore/voctocore.py b/voctocore/voctocore.py
index 39def6a..b1955e0 100755
--- a/voctocore/voctocore.py
+++ b/voctocore/voctocore.py
@@ -3,7 +3,7 @@ import gi, signal, logging, sys
# import GStreamer and GLib-Helper classes
gi.require_version('Gst', '1.0')
-from gi.repository import Gst, GObject
+from gi.repository import Gst, GstNet, GObject
# check min-version
minGst = (1, 5)