summaryrefslogtreecommitdiff
path: root/voctogui/lib/clock.py
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 /voctogui/lib/clock.py
parent140d4651afcdbf72a4b2637acd0c71925816eb82 (diff)
parent54775670b049a338d97b57218d36da00d778b432 (diff)
Merge branch 'nettime'
Diffstat (limited to 'voctogui/lib/clock.py')
-rw-r--r--voctogui/lib/clock.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/voctogui/lib/clock.py b/voctogui/lib/clock.py
new file mode 100644
index 0000000..9075bdc
--- /dev/null
+++ b/voctogui/lib/clock.py
@@ -0,0 +1,20 @@
+#!/usr/bin/python3
+import logging
+from gi.repository import Gst, GstNet
+
+__all__ = ['Clock']
+port = 9998
+
+log = logging.getLogger('Clock')
+Clock = None
+
+def obtainClock(host):
+ global log, Clock, SystemClock
+
+ log.debug('obtaining NetClientClock from host %s', host)
+ 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')