forked from openlp/openlp
bugfixing
This commit is contained in:
parent
11acf005e2
commit
2c225c19a0
@ -30,9 +30,8 @@ import sys, os
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
try:
|
try:
|
||||||
import vlc
|
import vlc
|
||||||
if vlc.get_default_instance():
|
vlc_available = bool(vlc.get_default_instance())
|
||||||
vlc_available = True
|
except ImportError:
|
||||||
except:
|
|
||||||
vlc_available = False
|
vlc_available = False
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
@ -90,10 +89,14 @@ class VlcPlayer(MediaPlayer):
|
|||||||
def setup(self, display):
|
def setup(self, display):
|
||||||
display.vlcWidget = QtGui.QFrame(display)
|
display.vlcWidget = QtGui.QFrame(display)
|
||||||
# creating a basic vlc instance
|
# creating a basic vlc instance
|
||||||
if display.hasAudio:
|
command_line_options = u'--no-video-title-show'
|
||||||
display.vlcInstance = vlc.Instance()
|
if not display.hasAudio:
|
||||||
else:
|
command_line_options += u' --no-audio --no-video-title-show'
|
||||||
display.vlcInstance = vlc.Instance('--no-audio')
|
if QtCore.QSettings().value(u'advanced/hide mouse',
|
||||||
|
QtCore.QVariant(False)).toBool() and \
|
||||||
|
display.controller.isLive:
|
||||||
|
command_line_options += u' --mouse-hide-timeout=0'
|
||||||
|
display.vlcInstance = vlc.Instance(command_line_options)
|
||||||
display.vlcInstance.set_log_verbosity(2)
|
display.vlcInstance.set_log_verbosity(2)
|
||||||
# creating an empty vlc media player
|
# creating an empty vlc media player
|
||||||
display.vlcMediaPlayer = display.vlcInstance.media_player_new()
|
display.vlcMediaPlayer = display.vlcInstance.media_player_new()
|
||||||
@ -135,14 +138,14 @@ class VlcPlayer(MediaPlayer):
|
|||||||
def media_state_wait(self, display, mediaState):
|
def media_state_wait(self, display, mediaState):
|
||||||
"""
|
"""
|
||||||
Wait for the video to change its state
|
Wait for the video to change its state
|
||||||
Wait no longer than 5 seconds.
|
Wait no longer than 60 seconds. (loading an iso file needs a long time)
|
||||||
"""
|
"""
|
||||||
start = datetime.now()
|
start = datetime.now()
|
||||||
while not mediaState == display.vlcMedia.get_state():
|
while not mediaState == display.vlcMedia.get_state():
|
||||||
if display.vlcMedia.get_state() == vlc.State.Error:
|
if display.vlcMedia.get_state() == vlc.State.Error:
|
||||||
return False
|
return False
|
||||||
Receiver.send_message(u'openlp_process_events')
|
Receiver.send_message(u'openlp_process_events')
|
||||||
if (datetime.now() - start).seconds > 50:
|
if (datetime.now() - start).seconds > 60:
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user