From ab09b15299c9d6c5efea15c720c9c5888d1d6839 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 29 Sep 2011 12:04:56 +0200 Subject: Phonon: Compile Windows. Change-Id: I5639a2e92437ae6e24227bd2676c7eaadb8d285d Reviewed-on: http://codereview.qt-project.org/5785 Reviewed-by: Qt Sanity Bot Reviewed-by: Friedemann Kleint --- src/3rdparty/phonon/ds9/abstractvideorenderer.cpp | 4 +-- src/3rdparty/phonon/ds9/videorenderer_evr.cpp | 2 +- src/3rdparty/phonon/ds9/videorenderer_soft.cpp | 4 +-- src/3rdparty/phonon/ds9/videorenderer_vmr9.cpp | 36 +++++++++++++++++++---- src/3rdparty/phonon/ds9/videowidget.h | 2 +- src/plugins/phonon/ds9/ds9.pro | 1 + 6 files changed, 38 insertions(+), 11 deletions(-) diff --git a/src/3rdparty/phonon/ds9/abstractvideorenderer.cpp b/src/3rdparty/phonon/ds9/abstractvideorenderer.cpp index a9d0694..c350ac6 100644 --- a/src/3rdparty/phonon/ds9/abstractvideorenderer.cpp +++ b/src/3rdparty/phonon/ds9/abstractvideorenderer.cpp @@ -17,8 +17,8 @@ along with this library. If not, see . #include "abstractvideorenderer.h" -#include -#include +#include +#include QT_BEGIN_NAMESPACE diff --git a/src/3rdparty/phonon/ds9/videorenderer_evr.cpp b/src/3rdparty/phonon/ds9/videorenderer_evr.cpp index ff39ecc..415b271 100644 --- a/src/3rdparty/phonon/ds9/videorenderer_evr.cpp +++ b/src/3rdparty/phonon/ds9/videorenderer_evr.cpp @@ -21,7 +21,7 @@ along with this library. If not, see . #ifndef QT_NO_PHONON_VIDEO -#include +#include #include QT_BEGIN_NAMESPACE diff --git a/src/3rdparty/phonon/ds9/videorenderer_soft.cpp b/src/3rdparty/phonon/ds9/videorenderer_soft.cpp index 9c7993c..0e04e85 100644 --- a/src/3rdparty/phonon/ds9/videorenderer_soft.cpp +++ b/src/3rdparty/phonon/ds9/videorenderer_soft.cpp @@ -25,7 +25,7 @@ along with this library. If not, see . #include #include -#include +#include #include #define _USE_MATH_DEFINES //for pi @@ -546,7 +546,7 @@ namespace Phonon //image is updated: we should update the widget //we should never call directly members of target due to thread-safety - QApplication::postEvent(m_renderer, new QEvent(QEvent::UpdateRequest)); + QGuiApplication::postEvent(m_renderer, new QEvent(QEvent::UpdateRequest)); if (!playing) { //useless to test the return value of WaitForSingleObject: timeout can't happen diff --git a/src/3rdparty/phonon/ds9/videorenderer_vmr9.cpp b/src/3rdparty/phonon/ds9/videorenderer_vmr9.cpp index 545b31e..cf4937b 100644 --- a/src/3rdparty/phonon/ds9/videorenderer_vmr9.cpp +++ b/src/3rdparty/phonon/ds9/videorenderer_vmr9.cpp @@ -20,8 +20,11 @@ along with this library. If not, see . #ifndef QT_NO_PHONON_VIDEO -#include +#include #include +#include +#include +#include #include #include @@ -31,6 +34,26 @@ QT_BEGIN_NAMESPACE namespace Phonon { + static inline HWND hwndForWidget(QWidget *widget) + { + QWindow *window = widget->windowHandle(); + return static_cast (QGuiApplication::platformNativeInterface()->nativeResourceForWindow("handle", window)); + } + + static inline HDC getDC(const QWidget *widget) + { + QBackingStore *backingStore = widget->backingStore(); + QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface(); + return static_cast(nativeInterface->nativeResourceForBackingStore("getDC", backingStore)); + } + + static inline void releaseDC(const QWidget *widget) + { + QBackingStore *backingStore = widget->backingStore(); + QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface(); + nativeInterface->nativeResourceForBackingStore("releaseDC", backingStore); + } + namespace DS9 { VideoRendererVMR9::~VideoRendererVMR9() @@ -106,11 +129,15 @@ namespace Phonon void VideoRendererVMR9::repaintCurrentFrame(QWidget *target, const QRect &rect) { - HDC hDC = target->getDC(); + const HDC hDC = getDC(target); // repaint the video ComPointer windowlessControl(m_filter, IID_IVMRWindowlessControl9); - HRESULT hr = windowlessControl ? windowlessControl->RepaintVideo(target->winId(), hDC) : E_POINTER; + HRESULT hr = E_POINTER; + if (windowlessControl) { + const HWND hwnd = hwndForWidget(target); + hr = windowlessControl->RepaintVideo(hwnd, hDC); + } if (FAILED(hr) || m_dstY > 0 || m_dstX > 0) { const QColor c = target->palette().color(target->backgroundRole()); COLORREF color = RGB(c.red(), c.green(), c.blue()); @@ -135,8 +162,7 @@ namespace Phonon ::DeleteObject(hPen); ::DeleteObject(hBrush); } - target->releaseDC(hDC); - + releaseDC(target); } void VideoRendererVMR9::notifyResize(const QSize &size, Phonon::VideoWidget::AspectRatio aspectRatio, diff --git a/src/3rdparty/phonon/ds9/videowidget.h b/src/3rdparty/phonon/ds9/videowidget.h index fc8a6e3..c9ec537 100644 --- a/src/3rdparty/phonon/ds9/videowidget.h +++ b/src/3rdparty/phonon/ds9/videowidget.h @@ -18,7 +18,7 @@ along with this library. If not, see . #ifndef PHONON_VIDEOWIDGET_H #define PHONON_VIDEOWIDGET_H -#include +#include #include #include "backendnode.h" diff --git a/src/plugins/phonon/ds9/ds9.pro b/src/plugins/phonon/ds9/ds9.pro index 9da0955..702ac53 100644 --- a/src/plugins/phonon/ds9/ds9.pro +++ b/src/plugins/phonon/ds9/ds9.pro @@ -2,6 +2,7 @@ load(qt_module) DESTDIR = $$QT_BUILD_TREE/plugins/phonon_backend QT += phonon +QT += widgets win32:!wince*:contains(QT_CONFIG,opengl):LIBS += -lopengl32 win32:!wince*:LIBS += -lgdi32 win32-msvc2005:DEFINES += _CRT_SECURE_NO_WARNINGS -- cgit v1.2.3