forked from openlp/openlp
Initial video fudging!
This commit is contained in:
parent
7f773a314b
commit
e37ae62079
@ -23,7 +23,9 @@
|
||||
###############################################################################
|
||||
|
||||
import logging
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
from PyQt4.phonon import Phonon
|
||||
|
||||
from openlp.core.lib import Receiver, str_to_bool
|
||||
|
||||
@ -85,9 +87,16 @@ class MainDisplay(DisplayLabel):
|
||||
self.layout.setSpacing(0)
|
||||
self.layout.setMargin(0)
|
||||
self.layout.setObjectName(u'layout')
|
||||
self.mediaObject = Phonon.MediaObject(self)
|
||||
self.video = Phonon.VideoWidget()
|
||||
self.audio = Phonon.AudioOutput(Phonon.VideoCategory, self.mediaObject)
|
||||
self.video.setFullScreen(True)
|
||||
Phonon.createPath(self.mediaObject, self.video)
|
||||
Phonon.createPath(self.mediaObject, self.audio)
|
||||
self.layout.insertWidget(0, self.video)
|
||||
self.display = QtGui.QLabel(self)
|
||||
self.display.setScaledContents(True)
|
||||
self.layout.addWidget(self.display)
|
||||
self.layout.insertWidget(0, self.display)
|
||||
self.displayBlank = False
|
||||
self.blankFrame = None
|
||||
self.frame = None
|
||||
@ -102,6 +111,8 @@ class MainDisplay(DisplayLabel):
|
||||
QtCore.SIGNAL(u'presentations_start'), self.hideDisplay)
|
||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||
QtCore.SIGNAL(u'presentations_stop'), self.showDisplay)
|
||||
QtCore.QObject.connect(self.mediaObject, QtCore.SIGNAL(u'finished()'),
|
||||
self.onMediaFinish)
|
||||
|
||||
def setup(self, screenNumber):
|
||||
"""
|
||||
@ -220,3 +231,26 @@ class MainDisplay(DisplayLabel):
|
||||
self.display.setPixmap(QtGui.QPixmap.fromImage(self.frame))
|
||||
self.killTimer(self.timer_id)
|
||||
self.timer_id = 0
|
||||
|
||||
def queueMedia(self, item, firstItem=True):
|
||||
if firstItem:
|
||||
self.mediaObject.setCurrentSource(Phonon.MediaSource(item))
|
||||
else:
|
||||
self.mediaObject.enqueue(Phonon.MediaSource(item))
|
||||
|
||||
def playMedia(self):
|
||||
self.display.close()
|
||||
self.mediaObject.play()
|
||||
|
||||
def stopMedia(self):
|
||||
self.mediaObject.stop()
|
||||
|
||||
def onMediaFinish(self):
|
||||
self.mediaObject.stop()
|
||||
self.video.close()
|
||||
self.display = QtGui.QLabel(self)
|
||||
self.display.setScaledContents(True)
|
||||
self.layout.insertWidget(0, self.display)
|
||||
|
||||
def mediaFinished(self):
|
||||
pass
|
||||
|
@ -56,6 +56,7 @@ class MediaMediaItem(MediaManagerItem):
|
||||
#self.ServiceItemIconName = u':/media/media_image.png'
|
||||
self.PreviewFunction = self.video_get_preview
|
||||
MediaManagerItem.__init__(self, parent, icon, title)
|
||||
self.MainDisplay = self.parent.live_controller.parent.mainDisplay
|
||||
|
||||
def requiredIcons(self):
|
||||
MediaManagerItem.requiredIcons(self)
|
||||
@ -78,7 +79,7 @@ class MediaMediaItem(MediaManagerItem):
|
||||
return False
|
||||
service_item.title = u'Media'
|
||||
for index in indexes:
|
||||
filename = self.ListData.getFilename(index)
|
||||
filename = self.ListView.getFilename(index)
|
||||
frame = QtGui.QImage(unicode(filename))
|
||||
(path, name) = os.path.split(filename)
|
||||
service_item.add_from_image(path, name, frame)
|
||||
@ -88,12 +89,24 @@ class MediaMediaItem(MediaManagerItem):
|
||||
log.debug(u'Media Preview Button pressed')
|
||||
items = self.ListView.selectedIndexes()
|
||||
for item in items:
|
||||
text = self.ListData.getValue(item)
|
||||
print text
|
||||
baseItem = self.ListView.item(item.row())
|
||||
itemText = unicode(baseItem.data(QtCore.Qt.UserRole).tostring())
|
||||
print itemText
|
||||
|
||||
def onMediaLiveClick(self):
|
||||
def onLiveClick(self):
|
||||
log.debug(u'Media Live Button pressed')
|
||||
pass
|
||||
items = self.ListView.selectedIndexes()
|
||||
if len(items) > 0:
|
||||
firstPass = True
|
||||
for item in items:
|
||||
baseItem = self.ListView.item(item.row())
|
||||
filename = unicode(baseItem.data(QtCore.Qt.UserRole).toString())
|
||||
if firstPass:
|
||||
self.MainDisplay.queueMedia(filename, firstPass)
|
||||
firstPass = False
|
||||
else:
|
||||
self.MainDisplay.queueMedia(filename, firstPass)
|
||||
self.MainDisplay.playMedia()
|
||||
|
||||
def initialise(self):
|
||||
self.ListView.setSelectionMode(
|
||||
|
Loading…
Reference in New Issue
Block a user