From 27332f87e1a4c3c325ba19a4f5009fdff41312ae Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Tue, 17 Mar 2015 22:06:21 +0000 Subject: [PATCH] Run XInitThreads when using VLC to make it work correctly. Fixes bug 1433245. Fixes: https://launchpad.net/bugs/1433245 --- openlp/core/ui/media/vlcplayer.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/openlp/core/ui/media/vlcplayer.py b/openlp/core/ui/media/vlcplayer.py index 46057fcf9..f7f7589ea 100644 --- a/openlp/core/ui/media/vlcplayer.py +++ b/openlp/core/ui/media/vlcplayer.py @@ -30,7 +30,7 @@ import threading from PyQt4 import QtGui -from openlp.core.common import Settings, is_win, is_macosx +from openlp.core.common import Settings, is_win, is_macosx, is_linux from openlp.core.lib import translate from openlp.core.ui.media import MediaState, MediaType from openlp.core.ui.media.mediaplayer import MediaPlayer @@ -62,6 +62,13 @@ if VLC_AVAILABLE: if LooseVersion(VERSION.split()[0]) < LooseVersion('1.1.0'): VLC_AVAILABLE = False log.debug('VLC could not be loaded, because the vlc version is too old: %s' % VERSION) + if is_linux(): + import ctypes + try: + x11 = ctypes.cdll.LoadLibrary('libX11.so') + x11.XInitThreads() + except: + log.exception('Failed to XInitThreads(), VLC might not work properly!') AUDIO_EXT = ['*.mp3', '*.wav', '*.wma', '*.ogg']