Head 2079

This commit is contained in:
Tim Bentley 2012-10-10 19:10:10 +01:00
commit c43cdea8b1
12 changed files with 102 additions and 29 deletions

View File

@ -48,7 +48,7 @@ import sys
from inspect import getargspec from inspect import getargspec
__version__ = "N/A" __version__ = "N/A"
build_date = "Fri Sep 28 22:48:50 2012" build_date = "Fri Oct 5 21:35:59 2012"
if sys.version_info[0] > 2: if sys.version_info[0] > 2:
str = str str = str
@ -680,6 +680,19 @@ class LogCb(ctypes.c_void_p):
\note Log message handlers <b>must</b> be thread-safe. \note Log message handlers <b>must</b> be thread-safe.
""" """
pass pass
class VideoLockCb(ctypes.c_void_p):
"""Callback prototype to allocate and lock a picture buffer.
Whenever a new video frame needs to be decoded, the lock callback is
invoked. Depending on the video chroma, one or three pixel planes of
adequate dimensions must be returned via the second parameter. Those
planes must be aligned on 32-bytes boundaries.
\param opaque private pointer as passed to L{libvlc_video_set_callbacks}() [IN]
\param planes start address of the pixel planes (LibVLC allocates the array
of void pointers, this callback must initialize the array) [OUT]
\return a private pointer for the display and unlock callbacks to identify
the picture buffers
"""
pass
class VideoUnlockCb(ctypes.c_void_p): class VideoUnlockCb(ctypes.c_void_p):
"""Callback prototype to unlock a picture buffer. """Callback prototype to unlock a picture buffer.
When the video frame decoding is complete, the unlock callback is invoked. When the video frame decoding is complete, the unlock callback is invoked.
@ -687,7 +700,7 @@ This callback might not be needed at all. It is only an indication that the
application can now read the pixel values if it needs to. application can now read the pixel values if it needs to.
\warning A picture buffer is unlocked after the picture is decoded, \warning A picture buffer is unlocked after the picture is decoded,
but before the picture is displayed. but before the picture is displayed.
\param opaque private pointer as passed to libvlc_video_set_callbacks() [IN] \param opaque private pointer as passed to L{libvlc_video_set_callbacks}() [IN]
\param picture private pointer returned from the @ref libvlc_video_lock_cb \param picture private pointer returned from the @ref libvlc_video_lock_cb
callback [IN] callback [IN]
\param planes pixel planes as defined by the @ref libvlc_video_lock_cb \param planes pixel planes as defined by the @ref libvlc_video_lock_cb
@ -698,7 +711,7 @@ class VideoDisplayCb(ctypes.c_void_p):
"""Callback prototype to display a picture. """Callback prototype to display a picture.
When the video frame needs to be shown, as determined by the media playback When the video frame needs to be shown, as determined by the media playback
clock, the display callback is invoked. clock, the display callback is invoked.
\param opaque private pointer as passed to libvlc_video_set_callbacks() [IN] \param opaque private pointer as passed to L{libvlc_video_set_callbacks}() [IN]
\param picture private pointer returned from the @ref libvlc_video_lock_cb \param picture private pointer returned from the @ref libvlc_video_lock_cb
callback [IN] callback [IN]
""" """
@ -710,7 +723,7 @@ and the chain of video filters (if any). It can opt to change any parameter
as it needs. In that case, LibVLC will attempt to convert the video format as it needs. In that case, LibVLC will attempt to convert the video format
(rescaling and chroma conversion) but these operations can be CPU intensive. (rescaling and chroma conversion) but these operations can be CPU intensive.
\param opaque pointer to the private pointer passed to \param opaque pointer to the private pointer passed to
libvlc_video_set_callbacks() [IN/OUT] L{libvlc_video_set_callbacks}() [IN/OUT]
\param chroma pointer to the 4 bytes video format identifier [IN/OUT] \param chroma pointer to the 4 bytes video format identifier [IN/OUT]
\param width pointer to the pixel width [IN/OUT] \param width pointer to the pixel width [IN/OUT]
\param height pointer to the pixel height [IN/OUT] \param height pointer to the pixel height [IN/OUT]
@ -730,7 +743,7 @@ in the video decoders, video filters and/or video converters.
pass pass
class VideoCleanupCb(ctypes.c_void_p): class VideoCleanupCb(ctypes.c_void_p):
"""Callback prototype to configure picture buffers format. """Callback prototype to configure picture buffers format.
\param opaque private pointer as passed to libvlc_video_set_callbacks() \param opaque private pointer as passed to L{libvlc_video_set_callbacks}()
(and possibly modified by @ref libvlc_video_format_cb) [IN] (and possibly modified by @ref libvlc_video_format_cb) [IN]
""" """
pass pass
@ -806,6 +819,18 @@ class CallbackDecorators(object):
\param args variable argument list for the format \param args variable argument list for the format
\note Log message handlers <b>must</b> be thread-safe. \note Log message handlers <b>must</b> be thread-safe.
''' '''
VideoLockCb = ctypes.CFUNCTYPE(ctypes.c_void_p, ctypes.c_void_p, ListPOINTER(ctypes.c_void_p))
VideoLockCb.__doc__ = '''Callback prototype to allocate and lock a picture buffer.
Whenever a new video frame needs to be decoded, the lock callback is
invoked. Depending on the video chroma, one or three pixel planes of
adequate dimensions must be returned via the second parameter. Those
planes must be aligned on 32-bytes boundaries.
\param opaque private pointer as passed to L{libvlc_video_set_callbacks}() [IN]
\param planes start address of the pixel planes (LibVLC allocates the array
of void pointers, this callback must initialize the array) [OUT]
\return a private pointer for the display and unlock callbacks to identify
the picture buffers
'''
VideoUnlockCb = ctypes.CFUNCTYPE(ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ListPOINTER(ctypes.c_void_p)) VideoUnlockCb = ctypes.CFUNCTYPE(ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ListPOINTER(ctypes.c_void_p))
VideoUnlockCb.__doc__ = '''Callback prototype to unlock a picture buffer. VideoUnlockCb.__doc__ = '''Callback prototype to unlock a picture buffer.
When the video frame decoding is complete, the unlock callback is invoked. When the video frame decoding is complete, the unlock callback is invoked.
@ -813,7 +838,7 @@ This callback might not be needed at all. It is only an indication that the
application can now read the pixel values if it needs to. application can now read the pixel values if it needs to.
\warning A picture buffer is unlocked after the picture is decoded, \warning A picture buffer is unlocked after the picture is decoded,
but before the picture is displayed. but before the picture is displayed.
\param opaque private pointer as passed to libvlc_video_set_callbacks() [IN] \param opaque private pointer as passed to L{libvlc_video_set_callbacks}() [IN]
\param picture private pointer returned from the @ref libvlc_video_lock_cb \param picture private pointer returned from the @ref libvlc_video_lock_cb
callback [IN] callback [IN]
\param planes pixel planes as defined by the @ref libvlc_video_lock_cb \param planes pixel planes as defined by the @ref libvlc_video_lock_cb
@ -823,7 +848,7 @@ but before the picture is displayed.
VideoDisplayCb.__doc__ = '''Callback prototype to display a picture. VideoDisplayCb.__doc__ = '''Callback prototype to display a picture.
When the video frame needs to be shown, as determined by the media playback When the video frame needs to be shown, as determined by the media playback
clock, the display callback is invoked. clock, the display callback is invoked.
\param opaque private pointer as passed to libvlc_video_set_callbacks() [IN] \param opaque private pointer as passed to L{libvlc_video_set_callbacks}() [IN]
\param picture private pointer returned from the @ref libvlc_video_lock_cb \param picture private pointer returned from the @ref libvlc_video_lock_cb
callback [IN] callback [IN]
''' '''
@ -834,7 +859,7 @@ and the chain of video filters (if any). It can opt to change any parameter
as it needs. In that case, LibVLC will attempt to convert the video format as it needs. In that case, LibVLC will attempt to convert the video format
(rescaling and chroma conversion) but these operations can be CPU intensive. (rescaling and chroma conversion) but these operations can be CPU intensive.
\param opaque pointer to the private pointer passed to \param opaque pointer to the private pointer passed to
libvlc_video_set_callbacks() [IN/OUT] L{libvlc_video_set_callbacks}() [IN/OUT]
\param chroma pointer to the 4 bytes video format identifier [IN/OUT] \param chroma pointer to the 4 bytes video format identifier [IN/OUT]
\param width pointer to the pixel width [IN/OUT] \param width pointer to the pixel width [IN/OUT]
\param height pointer to the pixel height [IN/OUT] \param height pointer to the pixel height [IN/OUT]
@ -853,7 +878,7 @@ in the video decoders, video filters and/or video converters.
''' '''
VideoCleanupCb = ctypes.CFUNCTYPE(ctypes.c_void_p, ctypes.c_void_p) VideoCleanupCb = ctypes.CFUNCTYPE(ctypes.c_void_p, ctypes.c_void_p)
VideoCleanupCb.__doc__ = '''Callback prototype to configure picture buffers format. VideoCleanupCb.__doc__ = '''Callback prototype to configure picture buffers format.
\param opaque private pointer as passed to libvlc_video_set_callbacks() \param opaque private pointer as passed to L{libvlc_video_set_callbacks}()
(and possibly modified by @ref libvlc_video_format_cb) [IN] (and possibly modified by @ref libvlc_video_format_cb) [IN]
''' '''
AudioPlayCb = ctypes.CFUNCTYPE(ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_uint, ctypes.c_int64) AudioPlayCb = ctypes.CFUNCTYPE(ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_uint, ctypes.c_int64)
@ -2483,9 +2508,22 @@ class MediaPlayer(_Ctype):
''' '''
return libvlc_media_player_stop(self) return libvlc_media_player_stop(self)
def video_set_callbacks(self, lock, unlock, display, opaque):
'''Set callbacks and private data to render decoded video to a custom area
in memory.
Use L{video_set_format}() or L{video_set_format_callbacks}()
to configure the decoded format.
@param lock: callback to lock video memory (must not be NULL).
@param unlock: callback to unlock video memory (or NULL if not needed).
@param display: callback to display video (or NULL if not needed).
@param opaque: private pointer for the three callbacks (as first parameter).
@version: LibVLC 1.1.1 or later.
'''
return libvlc_video_set_callbacks(self, lock, unlock, display, opaque)
def video_set_format(self, chroma, width, height, pitch): def video_set_format(self, chroma, width, height, pitch):
'''Set decoded video chroma and dimensions. '''Set decoded video chroma and dimensions.
This only works in combination with libvlc_video_set_callbacks(), This only works in combination with L{video_set_callbacks}(),
and is mutually exclusive with L{video_set_format_callbacks}(). and is mutually exclusive with L{video_set_format_callbacks}().
@param chroma: a four-characters string identifying the chroma (e.g. "RV32" or "YUYV"). @param chroma: a four-characters string identifying the chroma (e.g. "RV32" or "YUYV").
@param width: pixel width. @param width: pixel width.
@ -2498,7 +2536,7 @@ class MediaPlayer(_Ctype):
def video_set_format_callbacks(self, setup, cleanup): def video_set_format_callbacks(self, setup, cleanup):
'''Set decoded video chroma and dimensions. This only works in combination with '''Set decoded video chroma and dimensions. This only works in combination with
libvlc_video_set_callbacks(). L{video_set_callbacks}().
@param setup: callback to select the video format (cannot be NULL). @param setup: callback to select the video format (cannot be NULL).
@param cleanup: callback to release any allocated resources (or NULL). @param cleanup: callback to release any allocated resources (or NULL).
@version: LibVLC 2.0.0 or later. @version: LibVLC 2.0.0 or later.
@ -4382,9 +4420,26 @@ def libvlc_media_player_stop(p_mi):
None, MediaPlayer) None, MediaPlayer)
return f(p_mi) return f(p_mi)
def libvlc_video_set_callbacks(mp, lock, unlock, display, opaque):
'''Set callbacks and private data to render decoded video to a custom area
in memory.
Use L{libvlc_video_set_format}() or L{libvlc_video_set_format_callbacks}()
to configure the decoded format.
@param mp: the media player.
@param lock: callback to lock video memory (must not be NULL).
@param unlock: callback to unlock video memory (or NULL if not needed).
@param display: callback to display video (or NULL if not needed).
@param opaque: private pointer for the three callbacks (as first parameter).
@version: LibVLC 1.1.1 or later.
'''
f = _Cfunctions.get('libvlc_video_set_callbacks', None) or \
_Cfunction('libvlc_video_set_callbacks', ((1,), (1,), (1,), (1,), (1,),), None,
None, MediaPlayer, VideoLockCb, VideoUnlockCb, VideoDisplayCb, ctypes.c_void_p)
return f(mp, lock, unlock, display, opaque)
def libvlc_video_set_format(mp, chroma, width, height, pitch): def libvlc_video_set_format(mp, chroma, width, height, pitch):
'''Set decoded video chroma and dimensions. '''Set decoded video chroma and dimensions.
This only works in combination with libvlc_video_set_callbacks(), This only works in combination with L{libvlc_video_set_callbacks}(),
and is mutually exclusive with L{libvlc_video_set_format_callbacks}(). and is mutually exclusive with L{libvlc_video_set_format_callbacks}().
@param mp: the media player. @param mp: the media player.
@param chroma: a four-characters string identifying the chroma (e.g. "RV32" or "YUYV"). @param chroma: a four-characters string identifying the chroma (e.g. "RV32" or "YUYV").
@ -4401,7 +4456,7 @@ def libvlc_video_set_format(mp, chroma, width, height, pitch):
def libvlc_video_set_format_callbacks(mp, setup, cleanup): def libvlc_video_set_format_callbacks(mp, setup, cleanup):
'''Set decoded video chroma and dimensions. This only works in combination with '''Set decoded video chroma and dimensions. This only works in combination with
libvlc_video_set_callbacks(). L{libvlc_video_set_callbacks}().
@param mp: the media player. @param mp: the media player.
@param setup: callback to select the video format (cannot be NULL). @param setup: callback to select the video format (cannot be NULL).
@param cleanup: callback to release any allocated resources (or NULL). @param cleanup: callback to release any allocated resources (or NULL).
@ -5878,10 +5933,9 @@ def libvlc_vlm_get_event_manager(p_instance):
return f(p_instance) return f(p_instance)
# 3 function(s) blacklisted: # 2 function(s) blacklisted:
# libvlc_printerr # libvlc_printerr
# libvlc_set_exit_handler # libvlc_set_exit_handler
# libvlc_video_set_callbacks
# 17 function(s) not wrapped as methods: # 17 function(s) not wrapped as methods:
# libvlc_audio_output_list_release # libvlc_audio_output_list_release

View File

@ -855,7 +855,11 @@ class SlideController(DisplayController):
else: else:
label = QtGui.QLabel() label = QtGui.QLabel()
label.setMargin(4) label.setMargin(4)
label.setScaledContents(True) if serviceItem.is_media():
label.setAlignment(QtCore.Qt.AlignHCenter |
QtCore.Qt.AlignVCenter)
else:
label.setScaledContents(True)
if self.serviceItem.is_command(): if self.serviceItem.is_command():
label.setPixmap(QtGui.QPixmap(frame[u'image'])) label.setPixmap(QtGui.QPixmap(frame[u'image']))
else: else:

View File

@ -35,7 +35,7 @@ class Ui_AlertDialog(object):
def setupUi(self, alertDialog): def setupUi(self, alertDialog):
alertDialog.setObjectName(u'alertDialog') alertDialog.setObjectName(u'alertDialog')
alertDialog.resize(400, 300) alertDialog.resize(400, 300)
alertDialog.setWindowIcon(build_icon(u':/icon/openlp.org-icon-32.bmp')) alertDialog.setWindowIcon(build_icon(u':/icon/openlp-logo-16x16.png'))
self.alertDialogLayout = QtGui.QGridLayout(alertDialog) self.alertDialogLayout = QtGui.QGridLayout(alertDialog)
self.alertDialogLayout.setObjectName(u'alertDialogLayout') self.alertDialogLayout.setObjectName(u'alertDialogLayout')
self.alertTextLayout = QtGui.QFormLayout() self.alertTextLayout = QtGui.QFormLayout()

View File

@ -36,7 +36,7 @@ class Ui_CustomEditDialog(object):
customEditDialog.setObjectName(u'customEditDialog') customEditDialog.setObjectName(u'customEditDialog')
customEditDialog.resize(450, 350) customEditDialog.resize(450, 350)
customEditDialog.setWindowIcon( customEditDialog.setWindowIcon(
build_icon(u':/icon/openlp.org-icon-32.bmp')) build_icon(u':/icon/openlp-logo-16x16.png'))
self.dialogLayout = QtGui.QVBoxLayout(customEditDialog) self.dialogLayout = QtGui.QVBoxLayout(customEditDialog)
self.dialogLayout.setObjectName(u'dialogLayout') self.dialogLayout.setObjectName(u'dialogLayout')
self.titleLayout = QtGui.QHBoxLayout() self.titleLayout = QtGui.QHBoxLayout()

View File

@ -43,10 +43,12 @@ from openlp.core.ui.media import get_media_players, set_media_players
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
CLAPPERICON = build_icon(QtGui.QImage(u':/media/image_clapperboard.png')) CLAPPERBOARD = u':/media/slidecontroller_multimedia.png'
AUDIOICON = build_icon(QtGui.QImage(u':/songs/song_search_all.png')) VIDEO = QtGui.QImage(u':/media/media_video.png')
AUDIO = QtGui.QImage(u':/media/media_audio.png')
DVDICON = QtGui.QImage(u':/media/media_video.png') DVDICON = QtGui.QImage(u':/media/media_video.png')
class MediaMediaItem(MediaManagerItem): class MediaMediaItem(MediaManagerItem):
""" """
This is the custom media manager item for Media Slides. This is the custom media manager item for Media Slides.
@ -177,11 +179,11 @@ class MediaMediaItem(MediaManagerItem):
filename = unicode(item.data(QtCore.Qt.UserRole).toString()) filename = unicode(item.data(QtCore.Qt.UserRole).toString())
if os.path.exists(filename): if os.path.exists(filename):
service_item = ServiceItem() service_item = ServiceItem()
service_item.title = unicode(self.displayTypeComboBox.currentText()) service_item.title = \
unicode(self.displayTypeComboBox.currentText())
service_item.shortname = service_item.title service_item.shortname = service_item.title
(path, name) = os.path.split(filename) (path, name) = os.path.split(filename)
service_item.add_from_command(path, name, service_item.add_from_command(path, name,CLAPPERBOARD)
u':/media/image_clapperboard.png')
if self.plugin.liveController.mediaController.video( if self.plugin.liveController.mediaController.video(
self.plugin.liveController, service_item, True, True): self.plugin.liveController, service_item, True, True):
self.resetAction.setVisible(True) self.resetAction.setVisible(True)
@ -228,6 +230,9 @@ class MediaMediaItem(MediaManagerItem):
service_item.will_auto_start = True service_item.will_auto_start = True
# force a non-existent theme # force a non-existent theme
service_item.theme = -1 service_item.theme = -1
frame = CLAPPERBOARD
(path, name) = os.path.split(filename)
service_item.add_from_command(path, name, frame)
return True return True
def initialise(self): def initialise(self):
@ -302,9 +307,9 @@ class MediaMediaItem(MediaManagerItem):
item_name = QtGui.QListWidgetItem(filename) item_name = QtGui.QListWidgetItem(filename)
if u'*.%s' % (filename.split(u'.')[-1].lower()) in \ if u'*.%s' % (filename.split(u'.')[-1].lower()) in \
self.plugin.mediaController.audio_extensions_list: self.plugin.mediaController.audio_extensions_list:
item_name.setIcon(AUDIOICON) item_name.setIcon(AUDIO)
else: else:
item_name.setIcon(CLAPPERICON) item_name.setIcon(VIDEO)
item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(track)) item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(track))
else: else:
filename = os.path.split(unicode(track))[1] filename = os.path.split(unicode(track))[1]

View File

@ -55,7 +55,9 @@ window.OpenLP = {
); );
}, },
loadService: function (event) { loadService: function (event) {
event.preventDefault(); if (event) {
event.preventDefault();
}
$.getJSON( $.getJSON(
"/api/service/list", "/api/service/list",
function (data, status) { function (data, status) {
@ -150,6 +152,10 @@ window.OpenLP = {
OpenLP.currentSlide = data.results.slide; OpenLP.currentSlide = data.results.slide;
OpenLP.currentItem = data.results.item; OpenLP.currentItem = data.results.item;
if ($("#service-manager").is(":visible")) { if ($("#service-manager").is(":visible")) {
if (OpenLP.currentService != data.results.service) {
OpenLP.currentService = data.results.service;
OpenLP.loadService();
}
$("#service-manager div[data-role=content] ul[data-role=listview] li").attr("data-theme", "c").removeClass("ui-btn-up-e").addClass("ui-btn-up-c"); $("#service-manager div[data-role=content] ul[data-role=listview] li").attr("data-theme", "c").removeClass("ui-btn-up-e").addClass("ui-btn-up-c");
$("#service-manager div[data-role=content] ul[data-role=listview] li a").each(function () { $("#service-manager div[data-role=content] ul[data-role=listview] li a").each(function () {
var item = $(this); var item = $(this);

View File

@ -139,8 +139,10 @@ window.OpenLP = {
"/api/poll", "/api/poll",
function (data, status) { function (data, status) {
OpenLP.updateClock(data); OpenLP.updateClock(data);
if (OpenLP.currentItem != data.results.item) { if (OpenLP.currentItem != data.results.item ||
OpenLP.currentService != data.results.service) {
OpenLP.currentItem = data.results.item; OpenLP.currentItem = data.results.item;
OpenLP.currentService = data.results.service;
OpenLP.loadSlides(); OpenLP.loadSlides();
} }
else if (OpenLP.currentSlide != data.results.slide) { else if (OpenLP.currentSlide != data.results.slide) {

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -130,7 +130,9 @@
<qresource prefix="media"> <qresource prefix="media">
<file>media_time.png</file> <file>media_time.png</file>
<file>media_stop.png</file> <file>media_stop.png</file>
<file>image_clapperboard.png</file> <file>media_audio.png</file>
<file>media_video.png</file>
<file>slidecontroller_multimedia.png</file>
</qresource> </qresource>
<qresource prefix="messagebox"> <qresource prefix="messagebox">
<file>messagebox_critical.png</file> <file>messagebox_critical.png</file>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB