summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@nokia.com>2011-09-29 12:04:56 +0200
committerQt by Nokia <qt-info@nokia.com>2011-09-29 12:06:28 +0200
commitab09b15299c9d6c5efea15c720c9c5888d1d6839 (patch)
treea255eed514bae373c9e409240afabf281a38a598
parent51e68aa13a39ea978ae0eaa05aa4b23ac91708b4 (diff)
Phonon: Compile Windows.
Change-Id: I5639a2e92437ae6e24227bd2676c7eaadb8d285d Reviewed-on: http://codereview.qt-project.org/5785 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
-rw-r--r--src/3rdparty/phonon/ds9/abstractvideorenderer.cpp4
-rw-r--r--src/3rdparty/phonon/ds9/videorenderer_evr.cpp2
-rw-r--r--src/3rdparty/phonon/ds9/videorenderer_soft.cpp4
-rw-r--r--src/3rdparty/phonon/ds9/videorenderer_vmr9.cpp36
-rw-r--r--src/3rdparty/phonon/ds9/videowidget.h2
-rw-r--r--src/plugins/phonon/ds9/ds9.pro1
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 <http://www.gnu.org/licenses/>.
#include "abstractvideorenderer.h"
-#include <QtGui/QApplication>
-#include <QtGui/QDesktopWidget>
+#include <QtWidgets/QApplication>
+#include <QtWidgets/QDesktopWidget>
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 <http://www.gnu.org/licenses/>.
#ifndef QT_NO_PHONON_VIDEO
-#include <QtGui/QWidget>
+#include <QtWidgets/QWidget>
#include <QtGui/QPainter>
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 <http://www.gnu.org/licenses/>.
#include <QtGui/QPainter>
#include <QtGui/QPaintEngine>
-#include <QtGui/QApplication>
+#include <QtGui/QGuiApplication>
#include <QtCore/QTime>
#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 <http://www.gnu.org/licenses/>.
#ifndef QT_NO_PHONON_VIDEO
-#include <QtGui/QWidget>
+#include <QtWidgets/QWidget>
#include <QtGui/QPainter>
+#include <QtGui/QGuiApplication>
+#include <QtGui/QBackingStore>
+#include <QtGui/QPlatformNativeInterface>
#include <d3d9.h>
#include <vmr9.h>
@@ -31,6 +34,26 @@ QT_BEGIN_NAMESPACE
namespace Phonon
{
+ static inline HWND hwndForWidget(QWidget *widget)
+ {
+ QWindow *window = widget->windowHandle();
+ return static_cast<HWND> (QGuiApplication::platformNativeInterface()->nativeResourceForWindow("handle", window));
+ }
+
+ static inline HDC getDC(const QWidget *widget)
+ {
+ QBackingStore *backingStore = widget->backingStore();
+ QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface();
+ return static_cast<HDC>(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<IVMRWindowlessControl9> 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 <http://www.gnu.org/licenses/>.
#ifndef PHONON_VIDEOWIDGET_H
#define PHONON_VIDEOWIDGET_H
-#include <QtGui/QWidget>
+#include <QtWidgets/QWidget>
#include <phonon/videowidgetinterface.h>
#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