From aa2e12b92df3400e6f9cb89afc16eb968b0c2491 Mon Sep 17 00:00:00 2001 From: MaZderMind Date: Wed, 27 Jan 2016 12:25:53 +0100 Subject: use the server-net-clock in the gui --- voctogui/lib/clock.py | 19 +++++++++++++++++++ voctogui/lib/connection.py | 6 +++++- voctogui/lib/videodisplay.py | 2 ++ 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 voctogui/lib/clock.py (limited to 'voctogui/lib') 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() -- cgit v1.2.3 From 4f561f1d5ba5cd3430ffb987eee65105133e793e Mon Sep 17 00:00:00 2001 From: MaZderMind Date: Wed, 27 Jan 2016 12:35:07 +0100 Subject: base gui-time on gui-system-clock --- voctogui/lib/clock.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'voctogui/lib') diff --git a/voctogui/lib/clock.py b/voctogui/lib/clock.py index 8fdbe3d..862c2d5 100644 --- a/voctogui/lib/clock.py +++ b/voctogui/lib/clock.py @@ -12,8 +12,8 @@ log.debug("Obtaining System-Clock") SystemClock = Gst.SystemClock.obtain() def obtainClock(host): - global log, Clock + global log, Clock, SystemClock log.debug('obtaining NetClientClock from host %s', host) - Clock = GstNet.NetClientClock.new('voctocore', host, port, 0) + Clock = GstNet.NetClientClock.new('voctocore', host, port, SystemClock.get_time()) log.info('obtained NetClientClock from host %s: %s', host, Clock) -- cgit v1.2.3 From 049b95862fe7d751b40c5e448471226c8063f3d8 Mon Sep 17 00:00:00 2001 From: MaZderMind Date: Thu, 28 Jan 2016 12:19:13 +0100 Subject: sync gui-clock --- voctogui/lib/clock.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'voctogui/lib') diff --git a/voctogui/lib/clock.py b/voctogui/lib/clock.py index 862c2d5..9075bdc 100644 --- a/voctogui/lib/clock.py +++ b/voctogui/lib/clock.py @@ -8,12 +8,13 @@ port = 9998 log = logging.getLogger('Clock') Clock = None -log.debug("Obtaining System-Clock") -SystemClock = Gst.SystemClock.obtain() - def obtainClock(host): global log, Clock, SystemClock log.debug('obtaining NetClientClock from host %s', host) - Clock = GstNet.NetClientClock.new('voctocore', host, port, SystemClock.get_time()) - log.info('obtained NetClientClock from host %s: %s', host, Clock) + Clock = GstNet.NetClientClock.new('voctocore', host, port, 0) + log.debug('obtained NetClientClock from host %s: %s', host, Clock) + + log.debug('waiting for NetClientClock to sync to host') + Clock.wait_for_sync(Gst.CLOCK_TIME_NONE) + log.info('successfully synced NetClientClock to host') -- cgit v1.2.3 From 54775670b049a338d97b57218d36da00d778b432 Mon Sep 17 00:00:00 2001 From: MaZderMind Date: Thu, 4 Feb 2016 17:46:02 +0100 Subject: default to sync audio out --- voctogui/lib/videodisplay.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'voctogui/lib') diff --git a/voctogui/lib/videodisplay.py b/voctogui/lib/videodisplay.py index 18ea3bb..9a02658 100644 --- a/voctogui/lib/videodisplay.py +++ b/voctogui/lib/videodisplay.py @@ -93,7 +93,7 @@ class VideoDisplay(object): if play_audio: # ts-offset=1000000000 (1s) - should keep audio & video in sync but delay by 1s pipeline += """ - alsasink sync=False + alsasink """ # Otherwise just trash the Audio -- cgit v1.2.3