summaryrefslogtreecommitdiff
path: root/voctogui/lib
diff options
context:
space:
mode:
Diffstat (limited to 'voctogui/lib')
-rw-r--r--voctogui/lib/clock.py20
-rw-r--r--voctogui/lib/connection.py6
-rw-r--r--voctogui/lib/toolbar/misc.py8
-rw-r--r--voctogui/lib/videodisplay.py9
4 files changed, 38 insertions, 5 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')
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/toolbar/misc.py b/voctogui/lib/toolbar/misc.py
index 32dd96c..9528b67 100644
--- a/voctogui/lib/toolbar/misc.py
+++ b/voctogui/lib/toolbar/misc.py
@@ -4,12 +4,17 @@ from gi.repository import Gtk
from lib.config import Config
import lib.connection as Connection
+
class MiscToolbarController(object):
""" Manages Accelerators and Clicks Misc buttons """
def __init__(self, drawing_area, win, uibuilder):
self.log = logging.getLogger('MiscToolbarController')
+ # Accelerators
+ accelerators = Gtk.AccelGroup()
+ win.add_accel_group(accelerators)
+
closebtn = uibuilder.find_widget_recursive(drawing_area, 'close')
closebtn.set_visible( Config.getboolean('misc', 'close') )
closebtn.connect('clicked', self.on_closebtn_clicked)
@@ -18,6 +23,9 @@ class MiscToolbarController(object):
cutbtn.set_visible( Config.getboolean('misc', 'cut') )
cutbtn.connect('clicked', self.on_cutbtn_clicked)
+ key, mod = Gtk.accelerator_parse('t')
+ cutbtn.add_accelerator('clicked', accelerators, key, mod, Gtk.AccelFlags.VISIBLE)
+
def on_closebtn_clicked(self, btn):
self.log.info('close-button clicked')
Gtk.main_quit()
diff --git a/voctogui/lib/videodisplay.py b/voctogui/lib/videodisplay.py
index 8ce1413..78dafba 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 """
@@ -24,7 +25,7 @@ class VideoDisplay(object):
# Setup Server-Connection, Demuxing and Decoding
pipeline = """
- tcpclientsrc host={host} port={port} !
+ tcpclientsrc host={host} port={port} blocksize=1048576 !
queue !
matroskademux name=demux
"""
@@ -88,11 +89,10 @@ class VideoDisplay(object):
level name=lvl interval=50000000 !
"""
- # If Playback is requested, push fo alsa
+ # If Playback is requested, push fo pulseaudio
if play_audio:
- # ts-offset=1000000000 (1s) - should keep audio & video in sync but delay by 1s
pipeline += """
- alsasink sync=False
+ pulsesink
"""
# Otherwise just trash the Audio
@@ -111,6 +111,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()