forked from openlp/openlp
Move call to XInitThreads for linux-vlc setup to module-load. Fixes bug 1473632.
Fixes: https://launchpad.net/bugs/1473632
This commit is contained in:
parent
62aef46b55
commit
5940a77b20
@ -84,7 +84,6 @@ def get_vlc():
|
|||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
raise
|
raise
|
||||||
|
|
||||||
if is_vlc_available:
|
if is_vlc_available:
|
||||||
try:
|
try:
|
||||||
VERSION = vlc.libvlc_get_version().decode('UTF-8')
|
VERSION = vlc.libvlc_get_version().decode('UTF-8')
|
||||||
@ -95,8 +94,16 @@ def get_vlc():
|
|||||||
if LooseVersion(VERSION.split()[0]) < LooseVersion('1.1.0'):
|
if LooseVersion(VERSION.split()[0]) < LooseVersion('1.1.0'):
|
||||||
is_vlc_available = False
|
is_vlc_available = False
|
||||||
log.debug('VLC could not be loaded, because the vlc version is too old: %s' % VERSION)
|
log.debug('VLC could not be loaded, because the vlc version is too old: %s' % VERSION)
|
||||||
# On linux we need to initialise X threads, but not when running tests.
|
if is_vlc_available:
|
||||||
if is_vlc_available and is_linux() and 'nose' not in sys.argv[0]:
|
return vlc
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
# On linux we need to initialise X threads, but not when running tests.
|
||||||
|
# This needs to happen on module load and not in get_vlc(), otherwise it can cause crashes on some DE on some setups
|
||||||
|
# (reported on Gnome3, Unity, Cinnamon, all GTK+ based) when using native filedialogs...
|
||||||
|
if get_vlc() and is_linux() and 'nose' not in sys.argv[0]:
|
||||||
import ctypes
|
import ctypes
|
||||||
try:
|
try:
|
||||||
x11 = ctypes.cdll.LoadLibrary('libX11.so')
|
x11 = ctypes.cdll.LoadLibrary('libX11.so')
|
||||||
@ -104,11 +111,6 @@ def get_vlc():
|
|||||||
except:
|
except:
|
||||||
log.exception('Failed to run XInitThreads(), VLC might not work properly!')
|
log.exception('Failed to run XInitThreads(), VLC might not work properly!')
|
||||||
|
|
||||||
if is_vlc_available:
|
|
||||||
return vlc
|
|
||||||
else:
|
|
||||||
return None
|
|
||||||
|
|
||||||
|
|
||||||
class VlcPlayer(MediaPlayer):
|
class VlcPlayer(MediaPlayer):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user