aboutsummaryrefslogtreecommitdiff
path: root/voctogui/lib
diff options
context:
space:
mode:
authorMaZderMind <github@mazdermind.de>2016-01-27 12:25:53 +0100
committerMaZderMind <git@mazdermind.de>2016-02-02 16:05:56 +0100
commitaa2e12b92df3400e6f9cb89afc16eb968b0c2491 (patch)
treeed05ec86ce2d2e85a708ec1514341122f8069d1f /voctogui/lib
parent5e301fd1a88acf698f1918ddf8ea5981d12ac811 (diff)
use the server-net-clock in the gui
Diffstat (limited to 'voctogui/lib')
-rw-r--r--voctogui/lib/clock.py19
-rw-r--r--voctogui/lib/connection.py6
-rw-r--r--voctogui/lib/videodisplay.py2
3 files changed, 26 insertions, 1 deletions
diff --git a/voctogui/lib/clock.py b/voctogui/lib/clock.py
new file mode 100644
index 0000000..8fdbe3d
--- /dev/null
+++ b/voctogui/lib/clock.py
@@ -0,0 +1,19 @@
+#!/usr/bin/python3
+import logging
+from gi.repository import Gst, GstNet
+
+__all__ = ['Clock']
+port = 9998
+
+log = logging.getLogger('Clock')
+Clock = None
+
+log.debug("Obtaining System-Clock")
+SystemClock = Gst.SystemClock.obtain()
+
+def obtainClock(host):
+ global log, Clock
+
+ log.debug('obtaining NetClientClock from host %s', host)
+ Clock = GstNet.NetClientClock.new('voctocore', host, port, 0)
+ log.info('obtained NetClientClock from host %s: %s', host, Clock)
diff --git a/voctogui/lib/connection.py b/voctogui/lib/connection.py
index 6a9c025..6f8245f 100644
--- a/voctogui/lib/connection.py
+++ b/voctogui/lib/connection.py
@@ -7,17 +7,21 @@ from gi.repository import Gtk, GObject
log = logging.getLogger('Connection')
conn = None
+ip = None
port = 9999
command_queue = Queue()
signal_handlers = {}
def establish(host):
- global conn, port, log
+ global conn, port, log, ip
log.info('establishing Connection to %s', host)
conn = socket.create_connection( (host, port) )
log.debug('Connection successful \o/')
+ ip = conn.getpeername()[0]
+ log.debug('Remote-IP is %s', ip)
+
def fetchServerConfig():
global conn, log
diff --git a/voctogui/lib/videodisplay.py b/voctogui/lib/videodisplay.py
index 8ce1413..18ea3bb 100644
--- a/voctogui/lib/videodisplay.py
+++ b/voctogui/lib/videodisplay.py
@@ -2,6 +2,7 @@ import logging
from gi.repository import Gst
from lib.config import Config
+from lib.clock import Clock
class VideoDisplay(object):
""" Displays a Voctomix-Video-Stream into a GtkWidget """
@@ -111,6 +112,7 @@ class VideoDisplay(object):
self.log.debug('Creating Display-Pipeline:\n%s', pipeline)
self.pipeline = Gst.parse_launch(pipeline)
+ self.pipeline.use_clock(Clock)
self.drawing_area.realize()
self.xid = self.drawing_area.get_property('window').get_xid()