forked from openlp/openlp
Head 2104 - reverse some changes as not valid in this release
This commit is contained in:
commit
2295a74d5d
@ -143,11 +143,6 @@ class MediaController(object):
|
|||||||
AppLocation.get_directory(AppLocation.AppDir),
|
AppLocation.get_directory(AppLocation.AppDir),
|
||||||
u'core', u'ui', u'media')
|
u'core', u'ui', u'media')
|
||||||
for filename in os.listdir(controller_dir):
|
for filename in os.listdir(controller_dir):
|
||||||
# TODO vlc backend is not yet working on Mac OS X.
|
|
||||||
# For now just ignore vlc backend on Mac OS X.
|
|
||||||
if sys.platform == 'darwin' and filename == 'vlcplayer.py':
|
|
||||||
log.warn(u'Disabling vlc media player')
|
|
||||||
continue
|
|
||||||
if filename.endswith(u'player.py') and \
|
if filename.endswith(u'player.py') and \
|
||||||
not filename == 'mediaplayer.py':
|
not filename == 'mediaplayer.py':
|
||||||
path = os.path.join(controller_dir, filename)
|
path = os.path.join(controller_dir, filename)
|
||||||
@ -188,12 +183,16 @@ class MediaController(object):
|
|||||||
if not self.currentMediaPlayer.keys():
|
if not self.currentMediaPlayer.keys():
|
||||||
self.timer.stop()
|
self.timer.stop()
|
||||||
else:
|
else:
|
||||||
|
any_active = False
|
||||||
for display in self.currentMediaPlayer.keys():
|
for display in self.currentMediaPlayer.keys():
|
||||||
self.currentMediaPlayer[display].resize(display)
|
self.currentMediaPlayer[display].resize(display)
|
||||||
self.currentMediaPlayer[display].update_ui(display)
|
self.currentMediaPlayer[display].update_ui(display)
|
||||||
if self.currentMediaPlayer[display].state == \
|
if self.currentMediaPlayer[display].state == \
|
||||||
MediaState.Playing:
|
MediaState.Playing:
|
||||||
return
|
any_active = True
|
||||||
|
# There are still any active players - no need to stop timer.
|
||||||
|
if any_active:
|
||||||
|
return
|
||||||
# no players are active anymore
|
# no players are active anymore
|
||||||
for display in self.currentMediaPlayer.keys():
|
for display in self.currentMediaPlayer.keys():
|
||||||
if self.currentMediaPlayer[display].state != MediaState.Paused:
|
if self.currentMediaPlayer[display].state != MediaState.Paused:
|
||||||
|
@ -57,7 +57,7 @@ ADDITIONAL_EXT = {
|
|||||||
u'video/x-matroska': [u'.mpv', u'.mkv'],
|
u'video/x-matroska': [u'.mpv', u'.mkv'],
|
||||||
u'video/x-wmv': [u'.wmv'],
|
u'video/x-wmv': [u'.wmv'],
|
||||||
u'video/x-mpg': [u'.mpg'],
|
u'video/x-mpg': [u'.mpg'],
|
||||||
u'video/mpeg' : [u'.mp4', u'.mts'],
|
u'video/mpeg' : [u'.mp4', u'.mts', u'.mov'],
|
||||||
u'video/x-ms-wmv': [u'.wmv']}
|
u'video/x-ms-wmv': [u'.wmv']}
|
||||||
|
|
||||||
VIDEO_CSS = u"""
|
VIDEO_CSS = u"""
|
||||||
|
@ -125,18 +125,21 @@ class VlcPlayer(MediaPlayer):
|
|||||||
display.vlcWidget.resize(display.size())
|
display.vlcWidget.resize(display.size())
|
||||||
display.vlcWidget.raise_()
|
display.vlcWidget.raise_()
|
||||||
display.vlcWidget.hide()
|
display.vlcWidget.hide()
|
||||||
# the media player has to be 'connected' to the QFrame
|
# The media player has to be 'connected' to the QFrame.
|
||||||
# (otherwise a video would be displayed in it's own window)
|
# (otherwise a video would be displayed in it's own window)
|
||||||
# this is platform specific!
|
# This is platform specific!
|
||||||
# you have to give the id of the QFrame (or similar object) to
|
# You have to give the id of the QFrame (or similar object)
|
||||||
# vlc, different platforms have different functions for this
|
# to vlc, different platforms have different functions for this.
|
||||||
|
win_id = int(display.vlcWidget.winId())
|
||||||
if sys.platform == "win32":
|
if sys.platform == "win32":
|
||||||
display.vlcMediaPlayer.set_hwnd(int(display.vlcWidget.winId()))
|
display.vlcMediaPlayer.set_hwnd(win_id)
|
||||||
elif sys.platform == "darwin":
|
elif sys.platform == "darwin":
|
||||||
display.vlcMediaPlayer.set_agl(int(display.vlcWidget.winId()))
|
# We have to use 'set_nsobject' since Qt4 on OSX uses Cocoa
|
||||||
|
# framework and not the old Carbon.
|
||||||
|
display.vlcMediaPlayer.set_nsobject(win_id)
|
||||||
else:
|
else:
|
||||||
# for Linux using the X Server
|
# for Linux using the X Server
|
||||||
display.vlcMediaPlayer.set_xwindow(int(display.vlcWidget.winId()))
|
display.vlcMediaPlayer.set_xwindow(win_id)
|
||||||
self.hasOwnWidget = True
|
self.hasOwnWidget = True
|
||||||
|
|
||||||
def check_available(self):
|
def check_available(self):
|
||||||
@ -156,6 +159,13 @@ class VlcPlayer(MediaPlayer):
|
|||||||
# parse the metadata of the file
|
# parse the metadata of the file
|
||||||
display.vlcMedia.parse()
|
display.vlcMedia.parse()
|
||||||
self.volume(display, volume)
|
self.volume(display, volume)
|
||||||
|
# We need to set media_info.length during load because we want
|
||||||
|
# to avoid start and stop the video twice. Once for real playback
|
||||||
|
# and once to just get media length.
|
||||||
|
#
|
||||||
|
# Media plugin depends on knowing media length before playback.
|
||||||
|
controller.media_info.length = \
|
||||||
|
int(display.vlcMediaPlayer.get_media().get_duration() / 1000)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def media_state_wait(self, display, mediaState):
|
def media_state_wait(self, display, mediaState):
|
||||||
@ -222,6 +232,7 @@ class VlcPlayer(MediaPlayer):
|
|||||||
display.vlcWidget.setVisible(status)
|
display.vlcWidget.setVisible(status)
|
||||||
|
|
||||||
def update_ui(self, display):
|
def update_ui(self, display):
|
||||||
|
# Stop video if playback is finished.
|
||||||
if display.vlcMedia.get_state() == vlc.State.Ended:
|
if display.vlcMedia.get_state() == vlc.State.Ended:
|
||||||
self.stop(display)
|
self.stop(display)
|
||||||
controller = display.controller
|
controller = display.controller
|
||||||
|
Loading…
Reference in New Issue
Block a user