From 95bd9d58d8d37ddec8d37f5b35128689c0aa55a8 Mon Sep 17 00:00:00 2001 From: Yoann Lopes Date: Thu, 10 Sep 2015 18:25:37 +0200 Subject: DirectShow: use the EVR in the window control. Reuse existing code from the WMF plugin, which already uses the EVR. This enables HW-accelerated video decoding when using QMediaPlayer with a QVideoWidget. Task-number: QTBUG-45593 Change-Id: I757e4d53cd2c648aee6ba33a4851a8c6adc62843 Reviewed-by: Christian Stromme --- src/plugins/common/evr.pri | 8 + src/plugins/common/evr/evrdefs.h | 127 +++++++ src/plugins/common/evr/evrvideowindowcontrol.cpp | 355 ++++++++++++++++++++ src/plugins/common/evr/evrvideowindowcontrol.h | 101 ++++++ src/plugins/directshow/directshow.pro | 5 - .../player/directshowaudioendpointcontrol.cpp | 2 +- .../player/directshowevrvideowindowcontrol.cpp | 63 ++++ .../player/directshowevrvideowindowcontrol.h | 55 +++ src/plugins/directshow/player/directshowglobal.h | 12 + .../directshow/player/directshowioreader.cpp | 2 +- .../directshow/player/directshowiosource.cpp | 2 +- .../directshow/player/directshowplayerservice.cpp | 37 ++- .../directshow/player/directshowplayerservice.h | 8 +- src/plugins/directshow/player/player.pri | 24 +- .../directshow/player/vmr9videowindowcontrol.cpp | 7 +- src/plugins/wmf/player/evr9videowindowcontrol.cpp | 367 --------------------- src/plugins/wmf/player/evr9videowindowcontrol.h | 106 ------ src/plugins/wmf/player/mfevrvideowindowcontrol.cpp | 85 +++++ src/plugins/wmf/player/mfevrvideowindowcontrol.h | 57 ++++ src/plugins/wmf/player/mfplayerservice.cpp | 22 +- src/plugins/wmf/player/mfplayerservice.h | 12 +- src/plugins/wmf/player/mfplayersession.cpp | 12 +- src/plugins/wmf/player/mfplayersession.h | 2 +- src/plugins/wmf/player/player.pri | 11 +- src/plugins/wmf/wmf.pro | 14 +- 25 files changed, 927 insertions(+), 569 deletions(-) create mode 100644 src/plugins/common/evr.pri create mode 100644 src/plugins/common/evr/evrdefs.h create mode 100644 src/plugins/common/evr/evrvideowindowcontrol.cpp create mode 100644 src/plugins/common/evr/evrvideowindowcontrol.h create mode 100644 src/plugins/directshow/player/directshowevrvideowindowcontrol.cpp create mode 100644 src/plugins/directshow/player/directshowevrvideowindowcontrol.h delete mode 100644 src/plugins/wmf/player/evr9videowindowcontrol.cpp delete mode 100644 src/plugins/wmf/player/evr9videowindowcontrol.h create mode 100644 src/plugins/wmf/player/mfevrvideowindowcontrol.cpp create mode 100644 src/plugins/wmf/player/mfevrvideowindowcontrol.h (limited to 'src') diff --git a/src/plugins/common/evr.pri b/src/plugins/common/evr.pri new file mode 100644 index 000000000..f951f6730 --- /dev/null +++ b/src/plugins/common/evr.pri @@ -0,0 +1,8 @@ +INCLUDEPATH += $$PWD/evr + +qtHaveModule(widgets): QT += widgets + +HEADERS += $$PWD/evr/evrvideowindowcontrol.h \ + $$PWD/evr/evrdefs.h + +SOURCES += $$PWD/evr/evrvideowindowcontrol.cpp diff --git a/src/plugins/common/evr/evrdefs.h b/src/plugins/common/evr/evrdefs.h new file mode 100644 index 000000000..ce6ca6584 --- /dev/null +++ b/src/plugins/common/evr/evrdefs.h @@ -0,0 +1,127 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef EVRDEFS_H +#define EVRDEFS_H + +#include +#include +#include + +// The following is required to compile with MinGW + +#ifdef __GNUC__ +typedef struct MFVideoNormalizedRect { + float left; + float top; + float right; + float bottom; +} MFVideoNormalizedRect; +#endif + +#ifndef __IMFGetService_INTERFACE_DEFINED__ +#define __IMFGetService_INTERFACE_DEFINED__ +DEFINE_GUID(IID_IMFGetService, 0xfa993888, 0x4383, 0x415a, 0xa9,0x30, 0xdd,0x47,0x2a,0x8c,0xf6,0xf7); +MIDL_INTERFACE("fa993888-4383-415a-a930-dd472a8cf6f7") +IMFGetService : public IUnknown +{ + virtual HRESULT STDMETHODCALLTYPE GetService(REFGUID, REFIID, LPVOID *) = 0; +}; +#ifdef __CRT_UUID_DECL +__CRT_UUID_DECL(IMFGetService, 0xfa993888, 0x4383, 0x415a, 0xa9,0x30, 0xdd,0x47,0x2a,0x8c,0xf6,0xf7) +#endif +#endif // __IMFGetService_INTERFACE_DEFINED__ + +#ifndef __IMFVideoDisplayControl_INTERFACE_DEFINED__ +#define __IMFVideoDisplayControl_INTERFACE_DEFINED__ +typedef enum MFVideoAspectRatioMode +{ + MFVideoARMode_None = 0, + MFVideoARMode_PreservePicture = 0x1, + MFVideoARMode_PreservePixel = 0x2, + MFVideoARMode_NonLinearStretch = 0x4, + MFVideoARMode_Mask = 0x7 +} MFVideoAspectRatioMode; + +DEFINE_GUID(IID_IMFVideoDisplayControl, 0xa490b1e4, 0xab84, 0x4d31, 0xa1,0xb2, 0x18,0x1e,0x03,0xb1,0x07,0x7a); +MIDL_INTERFACE("a490b1e4-ab84-4d31-a1b2-181e03b1077a") +IMFVideoDisplayControl : public IUnknown +{ + virtual HRESULT STDMETHODCALLTYPE GetNativeVideoSize(SIZE *, SIZE *) = 0; + virtual HRESULT STDMETHODCALLTYPE GetIdealVideoSize(SIZE *, SIZE *) = 0; + virtual HRESULT STDMETHODCALLTYPE SetVideoPosition(const MFVideoNormalizedRect *, const LPRECT) = 0; + virtual HRESULT STDMETHODCALLTYPE GetVideoPosition(MFVideoNormalizedRect *, LPRECT) = 0; + virtual HRESULT STDMETHODCALLTYPE SetAspectRatioMode(DWORD) = 0; + virtual HRESULT STDMETHODCALLTYPE GetAspectRatioMode(DWORD *) = 0; + virtual HRESULT STDMETHODCALLTYPE SetVideoWindow(HWND) = 0; + virtual HRESULT STDMETHODCALLTYPE GetVideoWindow(HWND *) = 0; + virtual HRESULT STDMETHODCALLTYPE RepaintVideo(void) = 0; + virtual HRESULT STDMETHODCALLTYPE GetCurrentImage(BITMAPINFOHEADER *, BYTE **, DWORD *, LONGLONG *) = 0; + virtual HRESULT STDMETHODCALLTYPE SetBorderColor(COLORREF) = 0; + virtual HRESULT STDMETHODCALLTYPE GetBorderColor(COLORREF *) = 0; + virtual HRESULT STDMETHODCALLTYPE SetRenderingPrefs(DWORD) = 0; + virtual HRESULT STDMETHODCALLTYPE GetRenderingPrefs(DWORD *) = 0; + virtual HRESULT STDMETHODCALLTYPE SetFullscreen(BOOL) = 0; + virtual HRESULT STDMETHODCALLTYPE GetFullscreen(BOOL *) = 0; +}; +#ifdef __CRT_UUID_DECL +__CRT_UUID_DECL(IMFVideoDisplayControl, 0xa490b1e4, 0xab84, 0x4d31, 0xa1,0xb2, 0x18,0x1e,0x03,0xb1,0x07,0x7a) +#endif +#endif // __IMFVideoDisplayControl_INTERFACE_DEFINED__ + +#ifndef __IMFVideoProcessor_INTERFACE_DEFINED__ +#define __IMFVideoProcessor_INTERFACE_DEFINED__ +DEFINE_GUID(IID_IMFVideoProcessor, 0x6AB0000C, 0xFECE, 0x4d1f, 0xA2,0xAC, 0xA9,0x57,0x35,0x30,0x65,0x6E); +MIDL_INTERFACE("6AB0000C-FECE-4d1f-A2AC-A9573530656E") +IMFVideoProcessor : public IUnknown +{ + virtual HRESULT STDMETHODCALLTYPE GetAvailableVideoProcessorModes(UINT *, GUID **) = 0; + virtual HRESULT STDMETHODCALLTYPE GetVideoProcessorCaps(LPGUID, DXVA2_VideoProcessorCaps *) = 0; + virtual HRESULT STDMETHODCALLTYPE GetVideoProcessorMode(LPGUID) = 0; + virtual HRESULT STDMETHODCALLTYPE SetVideoProcessorMode(LPGUID) = 0; + virtual HRESULT STDMETHODCALLTYPE GetProcAmpRange(DWORD, DXVA2_ValueRange *) = 0; + virtual HRESULT STDMETHODCALLTYPE GetProcAmpValues(DWORD, DXVA2_ProcAmpValues *) = 0; + virtual HRESULT STDMETHODCALLTYPE SetProcAmpValues(DWORD, DXVA2_ProcAmpValues *) = 0; + virtual HRESULT STDMETHODCALLTYPE GetFilteringRange(DWORD, DXVA2_ValueRange *) = 0; + virtual HRESULT STDMETHODCALLTYPE GetFilteringValue(DWORD, DXVA2_Fixed32 *) = 0; + virtual HRESULT STDMETHODCALLTYPE SetFilteringValue(DWORD, DXVA2_Fixed32 *) = 0; + virtual HRESULT STDMETHODCALLTYPE GetBackgroundColor(COLORREF *) = 0; + virtual HRESULT STDMETHODCALLTYPE SetBackgroundColor(COLORREF) = 0; +}; +#ifdef __CRT_UUID_DECL +__CRT_UUID_DECL(IMFVideoProcessor, 0x6AB0000C, 0xFECE, 0x4d1f, 0xA2,0xAC, 0xA9,0x57,0x35,0x30,0x65,0x6E) +#endif +#endif // __IMFVideoProcessor_INTERFACE_DEFINED__ + +#endif // EVRDEFS_H + diff --git a/src/plugins/common/evr/evrvideowindowcontrol.cpp b/src/plugins/common/evr/evrvideowindowcontrol.cpp new file mode 100644 index 000000000..faa23d6e5 --- /dev/null +++ b/src/plugins/common/evr/evrvideowindowcontrol.cpp @@ -0,0 +1,355 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "evrvideowindowcontrol.h" + +#ifndef QT_NO_WIDGETS +#include +#endif + +EvrVideoWindowControl::EvrVideoWindowControl(QObject *parent) + : QVideoWindowControl(parent) + , m_windowId(0) + , m_windowColor(RGB(0, 0, 0)) + , m_dirtyValues(0) + , m_aspectRatioMode(Qt::KeepAspectRatio) + , m_brightness(0) + , m_contrast(0) + , m_hue(0) + , m_saturation(0) + , m_fullScreen(false) + , m_displayControl(0) + , m_processor(0) +{ +} + +EvrVideoWindowControl::~EvrVideoWindowControl() +{ + clear(); +} + +bool EvrVideoWindowControl::setEvr(IUnknown *evr) +{ + clear(); + + if (!evr) + return true; + + static const GUID mr_VIDEO_RENDER_SERVICE = { 0x1092a86c, 0xab1a, 0x459a, {0xa3, 0x36, 0x83, 0x1f, 0xbc, 0x4d, 0x11, 0xff} }; + static const GUID mr_VIDEO_MIXER_SERVICE = { 0x73cd2fc, 0x6cf4, 0x40b7, {0x88, 0x59, 0xe8, 0x95, 0x52, 0xc8, 0x41, 0xf8} }; + IMFGetService *service = NULL; + + if (SUCCEEDED(evr->QueryInterface(IID_PPV_ARGS(&service))) + && SUCCEEDED(service->GetService(mr_VIDEO_RENDER_SERVICE, IID_PPV_ARGS(&m_displayControl)))) { + + service->GetService(mr_VIDEO_MIXER_SERVICE, IID_PPV_ARGS(&m_processor)); + + setWinId(m_windowId); + setDisplayRect(m_displayRect); + setAspectRatioMode(m_aspectRatioMode); + m_dirtyValues = DXVA2_ProcAmp_Brightness | DXVA2_ProcAmp_Contrast | DXVA2_ProcAmp_Hue | DXVA2_ProcAmp_Saturation; + applyImageControls(); + } + + if (service) + service->Release(); + + return m_displayControl != NULL; +} + +void EvrVideoWindowControl::clear() +{ + if (m_displayControl) + m_displayControl->Release(); + m_displayControl = NULL; + + if (m_processor) + m_processor->Release(); + m_processor = NULL; +} + +WId EvrVideoWindowControl::winId() const +{ + return m_windowId; +} + +void EvrVideoWindowControl::setWinId(WId id) +{ + m_windowId = id; + +#ifndef QT_NO_WIDGETS + if (QWidget *widget = QWidget::find(m_windowId)) { + const QColor color = widget->palette().color(QPalette::Window); + + m_windowColor = RGB(color.red(), color.green(), color.blue()); + } +#endif + + if (m_displayControl) + m_displayControl->SetVideoWindow(HWND(m_windowId)); +} + +QRect EvrVideoWindowControl::displayRect() const +{ + return m_displayRect; +} + +void EvrVideoWindowControl::setDisplayRect(const QRect &rect) +{ + m_displayRect = rect; + + if (m_displayControl) { + RECT displayRect = { rect.left(), rect.top(), rect.right() + 1, rect.bottom() + 1 }; + QSize sourceSize = nativeSize(); + + RECT sourceRect = { 0, 0, sourceSize.width(), sourceSize.height() }; + + if (m_aspectRatioMode == Qt::KeepAspectRatioByExpanding) { + QSize clippedSize = rect.size(); + clippedSize.scale(sourceRect.right, sourceRect.bottom, Qt::KeepAspectRatio); + + sourceRect.left = (sourceRect.right - clippedSize.width()) / 2; + sourceRect.top = (sourceRect.bottom - clippedSize.height()) / 2; + sourceRect.right = sourceRect.left + clippedSize.width(); + sourceRect.bottom = sourceRect.top + clippedSize.height(); + } + + if (sourceSize.width() > 0 && sourceSize.height() > 0) { + MFVideoNormalizedRect sourceNormRect; + sourceNormRect.left = float(sourceRect.left) / float(sourceRect.right); + sourceNormRect.top = float(sourceRect.top) / float(sourceRect.bottom); + sourceNormRect.right = float(sourceRect.right) / float(sourceRect.right); + sourceNormRect.bottom = float(sourceRect.bottom) / float(sourceRect.bottom); + m_displayControl->SetVideoPosition(&sourceNormRect, &displayRect); + } else { + m_displayControl->SetVideoPosition(NULL, &displayRect); + } + } +} + +bool EvrVideoWindowControl::isFullScreen() const +{ + return m_fullScreen; +} + +void EvrVideoWindowControl::setFullScreen(bool fullScreen) +{ + if (m_fullScreen == fullScreen) + return; + emit fullScreenChanged(m_fullScreen = fullScreen); +} + +void EvrVideoWindowControl::repaint() +{ + QSize size = nativeSize(); + if (size.width() > 0 && size.height() > 0 + && m_displayControl + && SUCCEEDED(m_displayControl->RepaintVideo())) { + return; + } + + PAINTSTRUCT paint; + if (HDC dc = ::BeginPaint(HWND(m_windowId), &paint)) { + HPEN pen = ::CreatePen(PS_SOLID, 1, m_windowColor); + HBRUSH brush = ::CreateSolidBrush(m_windowColor); + ::SelectObject(dc, pen); + ::SelectObject(dc, brush); + + ::Rectangle( + dc, + m_displayRect.left(), + m_displayRect.top(), + m_displayRect.right() + 1, + m_displayRect.bottom() + 1); + + ::DeleteObject(pen); + ::DeleteObject(brush); + ::EndPaint(HWND(m_windowId), &paint); + } +} + +QSize EvrVideoWindowControl::nativeSize() const +{ + QSize size; + if (m_displayControl) { + SIZE sourceSize; + if (SUCCEEDED(m_displayControl->GetNativeVideoSize(&sourceSize, 0))) + size = QSize(sourceSize.cx, sourceSize.cy); + } + return size; +} + +Qt::AspectRatioMode EvrVideoWindowControl::aspectRatioMode() const +{ + return m_aspectRatioMode; +} + +void EvrVideoWindowControl::setAspectRatioMode(Qt::AspectRatioMode mode) +{ + m_aspectRatioMode = mode; + + if (m_displayControl) { + switch (mode) { + case Qt::IgnoreAspectRatio: + //comment from MSDN: Do not maintain the aspect ratio of the video. Stretch the video to fit the output rectangle. + m_displayControl->SetAspectRatioMode(MFVideoARMode_None); + break; + case Qt::KeepAspectRatio: + //comment from MSDN: Preserve the aspect ratio of the video by letterboxing or within the output rectangle. + m_displayControl->SetAspectRatioMode(MFVideoARMode_PreservePicture); + break; + case Qt::KeepAspectRatioByExpanding: + //for this mode, more adjustment will be done in setDisplayRect + m_displayControl->SetAspectRatioMode(MFVideoARMode_PreservePicture); + break; + default: + break; + } + setDisplayRect(m_displayRect); + } +} + +int EvrVideoWindowControl::brightness() const +{ + return m_brightness; +} + +void EvrVideoWindowControl::setBrightness(int brightness) +{ + if (m_brightness == brightness) + return; + + m_brightness = brightness; + + m_dirtyValues |= DXVA2_ProcAmp_Brightness; + + applyImageControls(); + + emit brightnessChanged(brightness); +} + +int EvrVideoWindowControl::contrast() const +{ + return m_contrast; +} + +void EvrVideoWindowControl::setContrast(int contrast) +{ + if (m_contrast == contrast) + return; + + m_contrast = contrast; + + m_dirtyValues |= DXVA2_ProcAmp_Contrast; + + applyImageControls(); + + emit contrastChanged(contrast); +} + +int EvrVideoWindowControl::hue() const +{ + return m_hue; +} + +void EvrVideoWindowControl::setHue(int hue) +{ + if (m_hue == hue) + return; + + m_hue = hue; + + m_dirtyValues |= DXVA2_ProcAmp_Hue; + + applyImageControls(); + + emit hueChanged(hue); +} + +int EvrVideoWindowControl::saturation() const +{ + return m_saturation; +} + +void EvrVideoWindowControl::setSaturation(int saturation) +{ + if (m_saturation == saturation) + return; + + m_saturation = saturation; + + m_dirtyValues |= DXVA2_ProcAmp_Saturation; + + applyImageControls(); + + emit saturationChanged(saturation); +} + +void EvrVideoWindowControl::applyImageControls() +{ + if (m_processor) { + DXVA2_ProcAmpValues values; + if (m_dirtyValues & DXVA2_ProcAmp_Brightness) { + values.Brightness = scaleProcAmpValue(DXVA2_ProcAmp_Brightness, m_brightness); + } + if (m_dirtyValues & DXVA2_ProcAmp_Contrast) { + values.Contrast = scaleProcAmpValue(DXVA2_ProcAmp_Contrast, m_contrast); + } + if (m_dirtyValues & DXVA2_ProcAmp_Hue) { + values.Hue = scaleProcAmpValue(DXVA2_ProcAmp_Hue, m_hue); + } + if (m_dirtyValues & DXVA2_ProcAmp_Saturation) { + values.Saturation = scaleProcAmpValue(DXVA2_ProcAmp_Saturation, m_saturation); + } + + if (SUCCEEDED(m_processor->SetProcAmpValues(m_dirtyValues, &values))) { + m_dirtyValues = 0; + } + } +} + +DXVA2_Fixed32 EvrVideoWindowControl::scaleProcAmpValue(DWORD prop, int value) const +{ + float scaledValue = 0.0; + + DXVA2_ValueRange range; + if (SUCCEEDED(m_processor->GetProcAmpRange(prop, &range))) { + scaledValue = DXVA2FixedToFloat(range.DefaultValue); + if (value > 0) + scaledValue += float(value) * (DXVA2FixedToFloat(range.MaxValue) - DXVA2FixedToFloat(range.DefaultValue)) / 100; + else if (value < 0) + scaledValue -= float(value) * (DXVA2FixedToFloat(range.MinValue) - DXVA2FixedToFloat(range.DefaultValue)) / 100; + } + + return DXVA2FloatToFixed(scaledValue); +} diff --git a/src/plugins/common/evr/evrvideowindowcontrol.h b/src/plugins/common/evr/evrvideowindowcontrol.h new file mode 100644 index 000000000..beb82ec05 --- /dev/null +++ b/src/plugins/common/evr/evrvideowindowcontrol.h @@ -0,0 +1,101 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Mobility Components. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef EVRVIDEOWINDOWCONTROL_H +#define EVRVIDEOWINDOWCONTROL_H + +#include "qvideowindowcontrol.h" + +#include "evrdefs.h" + +QT_USE_NAMESPACE + +class EvrVideoWindowControl : public QVideoWindowControl +{ + Q_OBJECT +public: + EvrVideoWindowControl(QObject *parent = 0); + ~EvrVideoWindowControl(); + + bool setEvr(IUnknown *evr); + + WId winId() const; + void setWinId(WId id); + + QRect displayRect() const; + void setDisplayRect(const QRect &rect); + + bool isFullScreen() const; + void setFullScreen(bool fullScreen); + + void repaint(); + + QSize nativeSize() const; + + Qt::AspectRatioMode aspectRatioMode() const; + void setAspectRatioMode(Qt::AspectRatioMode mode); + + int brightness() const; + void setBrightness(int brightness); + + int contrast() const; + void setContrast(int contrast); + + int hue() const; + void setHue(int hue); + + int saturation() const; + void setSaturation(int saturation); + + void applyImageControls(); + +private: + void clear(); + DXVA2_Fixed32 scaleProcAmpValue(DWORD prop, int value) const; + + WId m_windowId; + COLORREF m_windowColor; + DWORD m_dirtyValues; + Qt::AspectRatioMode m_aspectRatioMode; + QRect m_displayRect; + int m_brightness; + int m_contrast; + int m_hue; + int m_saturation; + bool m_fullScreen; + + IMFVideoDisplayControl *m_displayControl; + IMFVideoProcessor *m_processor; +}; + +#endif diff --git a/src/plugins/directshow/directshow.pro b/src/plugins/directshow/directshow.pro index 7815927db..4d7183923 100644 --- a/src/plugins/directshow/directshow.pro +++ b/src/plugins/directshow/directshow.pro @@ -13,11 +13,6 @@ SOURCES += dsserviceplugin.cpp !config_wmsdk: DEFINES += QT_NO_WMSDK -qtHaveModule(widgets) { - QT += multimediawidgets - DEFINES += HAVE_WIDGETS -} - mingw: DEFINES += NO_DSHOW_STRSAFE !config_wmf: include(player/player.pri) diff --git a/src/plugins/directshow/player/directshowaudioendpointcontrol.cpp b/src/plugins/directshow/player/directshowaudioendpointcontrol.cpp index 798a94102..d063447e3 100644 --- a/src/plugins/directshow/player/directshowaudioendpointcontrol.cpp +++ b/src/plugins/directshow/player/directshowaudioendpointcontrol.cpp @@ -44,7 +44,7 @@ DirectShowAudioEndpointControl::DirectShowAudioEndpointControl( , m_deviceEnumerator(0) { if (CreateBindCtx(0, &m_bindContext) == S_OK) { - m_deviceEnumerator = com_new(CLSID_SystemDeviceEnum, IID_ICreateDevEnum); + m_deviceEnumerator = com_new(CLSID_SystemDeviceEnum); updateEndpoints(); diff --git a/src/plugins/directshow/player/directshowevrvideowindowcontrol.cpp b/src/plugins/directshow/player/directshowevrvideowindowcontrol.cpp new file mode 100644 index 000000000..7bffe47d2 --- /dev/null +++ b/src/plugins/directshow/player/directshowevrvideowindowcontrol.cpp @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "directshowevrvideowindowcontrol.h" + +#include "directshowglobal.h" + +DirectShowEvrVideoWindowControl::DirectShowEvrVideoWindowControl(QObject *parent) + : EvrVideoWindowControl(parent) + , m_evrFilter(NULL) +{ +} + +DirectShowEvrVideoWindowControl::~DirectShowEvrVideoWindowControl() +{ + if (m_evrFilter) + m_evrFilter->Release(); +} + +IBaseFilter *DirectShowEvrVideoWindowControl::filter() +{ + static const GUID clsid_EnhancendVideoRenderer = { 0xfa10746c, 0x9b63, 0x4b6c, {0xbc, 0x49, 0xfc, 0x30, 0xe, 0xa5, 0xf2, 0x56} }; + + if (!m_evrFilter) { + m_evrFilter = com_new(clsid_EnhancendVideoRenderer); + if (!setEvr(m_evrFilter)) { + m_evrFilter->Release(); + m_evrFilter = NULL; + } + } + + return m_evrFilter; +} diff --git a/src/plugins/directshow/player/directshowevrvideowindowcontrol.h b/src/plugins/directshow/player/directshowevrvideowindowcontrol.h new file mode 100644 index 000000000..46171812b --- /dev/null +++ b/src/plugins/directshow/player/directshowevrvideowindowcontrol.h @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef DIRECTSHOWEVRVIDEOWINDOWCONTROL_H +#define DIRECTSHOWEVRVIDEOWINDOWCONTROL_H + +#include "evrvideowindowcontrol.h" + +struct IBaseFilter; + +QT_USE_NAMESPACE + +class DirectShowEvrVideoWindowControl : public EvrVideoWindowControl +{ +public: + DirectShowEvrVideoWindowControl(QObject *parent = 0); + ~DirectShowEvrVideoWindowControl(); + + IBaseFilter *filter(); + +private: + IBaseFilter *m_evrFilter; +}; + +#endif // DIRECTSHOWEVRVIDEOWINDOWCONTROL_H diff --git a/src/plugins/directshow/player/directshowglobal.h b/src/plugins/directshow/player/directshowglobal.h index 68cb23649..d8f1d1200 100644 --- a/src/plugins/directshow/player/directshowglobal.h +++ b/src/plugins/directshow/player/directshowglobal.h @@ -46,6 +46,18 @@ template T *com_cast(IUnknown *unknown, const IID &iid) : 0; } +template T *com_new(const IID &clsid) +{ + T *object = 0; + return CoCreateInstance( + clsid, + NULL, + CLSCTX_INPROC_SERVER, + IID_PPV_ARGS(&object)) == S_OK + ? object + : 0; +} + template T *com_new(const IID &clsid, const IID &iid) { T *object = 0; diff --git a/src/plugins/directshow/player/directshowioreader.cpp b/src/plugins/directshow/player/directshowioreader.cpp index bee072d3b..298d099d2 100644 --- a/src/plugins/directshow/player/directshowioreader.cpp +++ b/src/plugins/directshow/player/directshowioreader.cpp @@ -132,7 +132,7 @@ HRESULT DirectShowIOReader::RequestAllocator( return S_OK; } else { - *ppActual = com_new(CLSID_MemoryAllocator, IID_IMemAllocator); + *ppActual = com_new(CLSID_MemoryAllocator); if (*ppActual) { if ((*ppActual)->SetProperties(pProps, &actualProperties) != S_OK) { diff --git a/src/plugins/directshow/player/directshowiosource.cpp b/src/plugins/directshow/player/directshowiosource.cpp index 424120fd8..e1034a9c6 100644 --- a/src/plugins/directshow/player/directshowiosource.cpp +++ b/src/plugins/directshow/player/directshowiosource.cpp @@ -413,7 +413,7 @@ HRESULT DirectShowIOSource::tryConnect(IPin *pin, const AM_MEDIA_TYPE *type) hr = VFW_E_NO_TRANSPORT; if (IMemInputPin *memPin = com_cast(pin, IID_IMemInputPin)) { - if ((m_allocator = com_new(CLSID_MemoryAllocator, IID_IMemAllocator))) { + if ((m_allocator = com_new(CLSID_MemoryAllocator))) { ALLOCATOR_PROPERTIES properties; if (memPin->GetAllocatorRequirements(&properties) == S_OK || m_allocator->GetProperties(&properties) == S_OK) { diff --git a/src/plugins/directshow/player/directshowplayerservice.cpp b/src/plugins/directshow/player/directshowplayerservice.cpp index b73fa5c4c..a9b686360 100644 --- a/src/plugins/directshow/player/directshowplayerservice.cpp +++ b/src/plugins/directshow/player/directshowplayerservice.cpp @@ -38,8 +38,10 @@ #include "directshowmetadatacontrol.h" #include "directshowplayercontrol.h" #include "directshowvideorenderercontrol.h" -#if defined(HAVE_WIDGETS) && !defined(Q_WS_SIMULATOR) #include "vmr9videowindowcontrol.h" + +#ifdef HAVE_EVR +#include "directshowevrvideowindowcontrol.h" #endif #ifndef QT_NO_WMSDK @@ -79,9 +81,7 @@ DirectShowPlayerService::DirectShowPlayerService(QObject *parent) , m_playerControl(0) , m_metaDataControl(0) , m_videoRendererControl(0) -#if defined(HAVE_WIDGETS) && !defined(Q_WS_SIMULATOR) , m_videoWindowControl(0) -#endif , m_audioEndpointControl(0) , m_taskThread(0) , m_loop(qt_directShowEventLoop()) @@ -140,9 +140,7 @@ DirectShowPlayerService::~DirectShowPlayerService() delete m_audioEndpointControl; delete m_metaDataControl; delete m_videoRendererControl; -#if defined(HAVE_WIDGETS) && !defined(Q_WS_SIMULATOR) delete m_videoWindowControl; -#endif ::CloseHandle(m_taskHandle); } @@ -156,11 +154,7 @@ QMediaControl *DirectShowPlayerService::requestControl(const char *name) } else if (qstrcmp(name, QMetaDataReaderControl_iid) == 0) { return m_metaDataControl; } else if (qstrcmp(name, QVideoRendererControl_iid) == 0) { -#if defined(HAVE_WIDGETS) && !defined(Q_WS_SIMULATOR) if (!m_videoRendererControl && !m_videoWindowControl) { -#else - if (!m_videoRendererControl) { -#endif m_videoRendererControl = new DirectShowVideoRendererControl(m_loop); connect(m_videoRendererControl, SIGNAL(filterChanged()), @@ -168,16 +162,28 @@ QMediaControl *DirectShowPlayerService::requestControl(const char *name) return m_videoRendererControl; } -#if defined(HAVE_WIDGETS) && !defined(Q_WS_SIMULATOR) } else if (qstrcmp(name, QVideoWindowControl_iid) == 0) { if (!m_videoRendererControl && !m_videoWindowControl) { - m_videoWindowControl = new Vmr9VideoWindowControl; + IBaseFilter *filter; - setVideoOutput(m_videoWindowControl->filter()); +#ifdef HAVE_EVR + DirectShowEvrVideoWindowControl *evrControl = new DirectShowEvrVideoWindowControl; + if ((filter = evrControl->filter())) + m_videoWindowControl = evrControl; + else + delete evrControl; +#endif + // Fall back to the VMR9 if the EVR is not available + if (!m_videoWindowControl) { + Vmr9VideoWindowControl *vmr9Control = new Vmr9VideoWindowControl; + filter = vmr9Control->filter(); + m_videoWindowControl = vmr9Control; + } + + setVideoOutput(filter); return m_videoWindowControl; } -#endif } return 0; } @@ -193,14 +199,12 @@ void DirectShowPlayerService::releaseControl(QMediaControl *control) delete m_videoRendererControl; m_videoRendererControl = 0; -#if defined(HAVE_WIDGETS) && !defined(Q_WS_SIMULATOR) } else if (control == m_videoWindowControl) { setVideoOutput(0); delete m_videoWindowControl; m_videoWindowControl = 0; -#endif } } @@ -275,8 +279,7 @@ void DirectShowPlayerService::doSetUrlSource(QMutexLocker *locker) static const GUID iid_IFileSourceFilter = { 0x56a868a6, 0x0ad4, 0x11ce, {0xb0, 0x3a, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70} }; - if (IFileSourceFilter *fileSource = com_new( - clsid_WMAsfReader, iid_IFileSourceFilter)) { + if (IFileSourceFilter *fileSource = com_new(clsid_WMAsfReader, iid_IFileSourceFilter)) { locker->unlock(); hr = fileSource->Load(reinterpret_cast(m_url.toString().utf16()), 0); diff --git a/src/plugins/directshow/player/directshowplayerservice.h b/src/plugins/directshow/player/directshowplayerservice.h index f4da103dc..edfde105e 100644 --- a/src/plugins/directshow/player/directshowplayerservice.h +++ b/src/plugins/directshow/player/directshowplayerservice.h @@ -51,12 +51,10 @@ class DirectShowAudioEndpointControl; class DirectShowMetaDataControl; class DirectShowPlayerControl; class DirectShowVideoRendererControl; -#if defined(HAVE_WIDGETS) && !defined(Q_WS_SIMULATOR) -class Vmr9VideoWindowControl; -#endif QT_BEGIN_NAMESPACE class QMediaContent; +class QVideoWindowControl; QT_END_NAMESPACE QT_USE_NAMESPACE @@ -172,9 +170,7 @@ private: DirectShowPlayerControl *m_playerControl; DirectShowMetaDataControl *m_metaDataControl; DirectShowVideoRendererControl *m_videoRendererControl; -#if defined(HAVE_WIDGETS) && !defined(Q_WS_SIMULATOR) - Vmr9VideoWindowControl *m_videoWindowControl; -#endif + QVideoWindowControl *m_videoWindowControl; DirectShowAudioEndpointControl *m_audioEndpointControl; QThread *m_taskThread; diff --git a/src/plugins/directshow/player/player.pri b/src/plugins/directshow/player/player.pri index c5c934a38..8586ea5da 100644 --- a/src/plugins/directshow/player/player.pri +++ b/src/plugins/directshow/player/player.pri @@ -1,5 +1,9 @@ INCLUDEPATH += $$PWD +LIBS += -lstrmiids -ldmoguids -luuid -lmsdmo -lole32 -loleaut32 -lgdi32 + +qtHaveModule(widgets): QT += widgets + DEFINES += QMEDIA_DIRECTSHOW_PLAYER HEADERS += \ @@ -17,7 +21,8 @@ HEADERS += \ $$PWD/directshowsamplescheduler.h \ $$PWD/directshowvideorenderercontrol.h \ $$PWD/mediasamplevideobuffer.h \ - $$PWD/videosurfacefilter.h + $$PWD/videosurfacefilter.h \ + $$PWD/vmr9videowindowcontrol.h SOURCES += \ $$PWD/directshowaudioendpointcontrol.cpp \ @@ -33,14 +38,16 @@ SOURCES += \ $$PWD/directshowsamplescheduler.cpp \ $$PWD/directshowvideorenderercontrol.cpp \ $$PWD/mediasamplevideobuffer.cpp \ - $$PWD/videosurfacefilter.cpp + $$PWD/videosurfacefilter.cpp \ + $$PWD/vmr9videowindowcontrol.cpp -qtHaveModule(widgets):!simulator { - HEADERS += \ - $$PWD/vmr9videowindowcontrol.h +config_evr { + DEFINES += HAVE_EVR - SOURCES += \ - $$PWD/vmr9videowindowcontrol.cpp + include($$PWD/../../common/evr.pri) + + HEADERS += $$PWD/directshowevrvideowindowcontrol.h + SOURCES += $$PWD/directshowevrvideowindowcontrol.cpp } config_wshellitem { @@ -48,6 +55,3 @@ config_wshellitem { } else { DEFINES += QT_NO_SHELLITEM } - -LIBS += -lstrmiids -ldmoguids -luuid -lmsdmo -lole32 -loleaut32 -lgdi32 - diff --git a/src/plugins/directshow/player/vmr9videowindowcontrol.cpp b/src/plugins/directshow/player/vmr9videowindowcontrol.cpp index 48ff6c2c3..853ca031c 100644 --- a/src/plugins/directshow/player/vmr9videowindowcontrol.cpp +++ b/src/plugins/directshow/player/vmr9videowindowcontrol.cpp @@ -35,13 +35,16 @@ #include "directshowglobal.h" +#ifndef QT_NO_WIDGETS #include #include +#endif Vmr9VideoWindowControl::Vmr9VideoWindowControl(QObject *parent) : QVideoWindowControl(parent) - , m_filter(com_new(CLSID_VideoMixingRenderer9, IID_IBaseFilter)) + , m_filter(com_new(CLSID_VideoMixingRenderer9)) , m_windowId(0) + , m_windowColor(RGB(0, 0, 0)) , m_dirtyValues(0) , m_aspectRatioMode(Qt::KeepAspectRatio) , m_brightness(0) @@ -74,11 +77,13 @@ void Vmr9VideoWindowControl::setWinId(WId id) { m_windowId = id; +#ifndef QT_NO_WIDGETS if (QWidget *widget = QWidget::find(m_windowId)) { const QColor color = widget->palette().color(QPalette::Window); m_windowColor = RGB(color.red(), color.green(), color.blue()); } +#endif if (IVMRWindowlessControl9 *control = com_cast( m_filter, IID_IVMRWindowlessControl9)) { diff --git a/src/plugins/wmf/player/evr9videowindowcontrol.cpp b/src/plugins/wmf/player/evr9videowindowcontrol.cpp deleted file mode 100644 index e94918dba..000000000 --- a/src/plugins/wmf/player/evr9videowindowcontrol.cpp +++ /dev/null @@ -1,367 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Mobility Components. -** -** $QT_BEGIN_LICENSE:LGPL21$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "evr9videowindowcontrol.h" -#include -#include -#include - -Evr9VideoWindowControl::Evr9VideoWindowControl(QObject *parent) - : QVideoWindowControl(parent) - , m_windowId(0) - , m_dirtyValues(0) - , m_aspectRatioMode(Qt::KeepAspectRatio) - , m_brightness(0) - , m_contrast(0) - , m_hue(0) - , m_saturation(0) - , m_fullScreen(false) - , m_currentActivate(0) - , m_evrSink(0) - , m_displayControl(0) - , m_processor(0) -{ -} - -Evr9VideoWindowControl::~Evr9VideoWindowControl() -{ - clear(); -} - -void Evr9VideoWindowControl::clear() -{ - if (m_processor) - m_processor->Release(); - if (m_displayControl) - m_displayControl->Release(); - if (m_evrSink) - m_evrSink->Release(); - if (m_currentActivate) { - m_currentActivate->ShutdownObject(); - m_currentActivate->Release(); - } - - m_processor = NULL; - m_displayControl = NULL; - m_evrSink = NULL; - m_currentActivate = NULL; -} - -void Evr9VideoWindowControl::releaseActivate() -{ - clear(); -} - -WId Evr9VideoWindowControl::winId() const -{ - return m_windowId; -} - -void Evr9VideoWindowControl::setWinId(WId id) -{ - m_windowId = id; - - if (QWidget *widget = QWidget::find(m_windowId)) { - const QColor color = widget->palette().color(QPalette::Window); - - m_windowColor = RGB(color.red(), color.green(), color.blue()); - } - - if (m_displayControl) { - m_displayControl->SetVideoWindow(HWND(m_windowId)); - } -} - -QRect Evr9VideoWindowControl::displayRect() const -{ - return m_displayRect; -} - -void Evr9VideoWindowControl::setDisplayRect(const QRect &rect) -{ - m_displayRect = rect; - - if (m_displayControl) { - RECT displayRect = { rect.left(), rect.top(), rect.right() + 1, rect.bottom() + 1 }; - QSize sourceSize = nativeSize(); - - RECT sourceRect = { 0, 0, sourceSize.width(), sourceSize.height() }; - - if (m_aspectRatioMode == Qt::KeepAspectRatioByExpanding) { - QSize clippedSize = rect.size(); - clippedSize.scale(sourceRect.right, sourceRect.bottom, Qt::KeepAspectRatio); - - sourceRect.left = (sourceRect.right - clippedSize.width()) / 2; - sourceRect.top = (sourceRect.bottom - clippedSize.height()) / 2; - sourceRect.right = sourceRect.left + clippedSize.width(); - sourceRect.bottom = sourceRect.top + clippedSize.height(); - } - - if (sourceSize.width() > 0 && sourceSize.height() > 0) { - MFVideoNormalizedRect sourceNormRect; - sourceNormRect.left = float(sourceRect.left) / float(sourceRect.right); - sourceNormRect.top = float(sourceRect.top) / float(sourceRect.bottom); - sourceNormRect.right = float(sourceRect.right) / float(sourceRect.right); - sourceNormRect.bottom = float(sourceRect.bottom) / float(sourceRect.bottom); - m_displayControl->SetVideoPosition(&sourceNormRect, &displayRect); - } else { - m_displayControl->SetVideoPosition(NULL, &displayRect); - } - } -} - -bool Evr9VideoWindowControl::isFullScreen() const -{ - return m_fullScreen; -} - -void Evr9VideoWindowControl::setFullScreen(bool fullScreen) -{ - if (m_fullScreen == fullScreen) - return; - emit fullScreenChanged(m_fullScreen = fullScreen); -} - -void Evr9VideoWindowControl::repaint() -{ - QSize size = nativeSize(); - if (size.width() > 0 && size.height() > 0 - && m_displayControl - && SUCCEEDED(m_displayControl->RepaintVideo())) { - return; - } - - PAINTSTRUCT paint; - if (HDC dc = ::BeginPaint(HWND(m_windowId), &paint)) { - HPEN pen = ::CreatePen(PS_SOLID, 1, m_windowColor); - HBRUSH brush = ::CreateSolidBrush(m_windowColor); - ::SelectObject(dc, pen); - ::SelectObject(dc, brush); - - ::Rectangle( - dc, - m_displayRect.left(), - m_displayRect.top(), - m_displayRect.right() + 1, - m_displayRect.bottom() + 1); - - ::DeleteObject(pen); - ::DeleteObject(brush); - ::EndPaint(HWND(m_windowId), &paint); - } -} - -QSize Evr9VideoWindowControl::nativeSize() const -{ - QSize size; - if (m_displayControl) { - SIZE sourceSize; - if (SUCCEEDED(m_displayControl->GetNativeVideoSize(&sourceSize, 0))) - size = QSize(sourceSize.cx, sourceSize.cy); - } - return size; -} - -Qt::AspectRatioMode Evr9VideoWindowControl::aspectRatioMode() const -{ - return m_aspectRatioMode; -} - -void Evr9VideoWindowControl::setAspectRatioMode(Qt::AspectRatioMode mode) -{ - m_aspectRatioMode = mode; - - if (m_displayControl) { - switch (mode) { - case Qt::IgnoreAspectRatio: - //comment from MSDN: Do not maintain the aspect ratio of the video. Stretch the video to fit the output rectangle. - m_displayControl->SetAspectRatioMode(MFVideoARMode_None); - break; - case Qt::KeepAspectRatio: - //comment from MSDN: Preserve the aspect ratio of the video by letterboxing or within the output rectangle. - m_displayControl->SetAspectRatioMode(MFVideoARMode_PreservePicture); - break; - case Qt::KeepAspectRatioByExpanding: - //for this mode, more adjustment will be done in setDisplayRect - m_displayControl->SetAspectRatioMode(MFVideoARMode_PreservePicture); - break; - default: - break; - } - setDisplayRect(m_displayRect); - } -} - -int Evr9VideoWindowControl::brightness() const -{ - return m_brightness; -} - -void Evr9VideoWindowControl::setBrightness(int brightness) -{ - if (m_brightness == brightness) - return; - - m_brightness = brightness; - - m_dirtyValues |= DXVA2_ProcAmp_Brightness; - - setProcAmpValues(); - - emit brightnessChanged(brightness); -} - -int Evr9VideoWindowControl::contrast() const -{ - return m_contrast; -} - -void Evr9VideoWindowControl::setContrast(int contrast) -{ - if (m_contrast == contrast) - return; - - m_contrast = contrast; - - m_dirtyValues |= DXVA2_ProcAmp_Contrast; - - setProcAmpValues(); - - emit contrastChanged(contrast); -} - -int Evr9VideoWindowControl::hue() const -{ - return m_hue; -} - -void Evr9VideoWindowControl::setHue(int hue) -{ - if (m_hue == hue) - return; - - m_hue = hue; - - m_dirtyValues |= DXVA2_ProcAmp_Hue; - - setProcAmpValues(); - - emit hueChanged(hue); -} - -int Evr9VideoWindowControl::saturation() const -{ - return m_saturation; -} - -void Evr9VideoWindowControl::setSaturation(int saturation) -{ - if (m_saturation == saturation) - return; - - m_saturation = saturation; - - m_dirtyValues |= DXVA2_ProcAmp_Saturation; - - setProcAmpValues(); - - emit saturationChanged(saturation); -} - -IMFActivate* Evr9VideoWindowControl::createActivate() -{ - clear(); - - if (FAILED(MFCreateVideoRendererActivate(0, &m_currentActivate))) { - qWarning() << "Failed to create evr video renderer activate!"; - return 0; - } - if (FAILED(m_currentActivate->ActivateObject(IID_IMFMediaSink, (LPVOID*)(&m_evrSink)))) { - qWarning() << "Failed to activate evr media sink!"; - return 0; - } - if (FAILED(MFGetService(m_evrSink, MR_VIDEO_RENDER_SERVICE, IID_PPV_ARGS(&m_displayControl)))) { - qWarning() << "Failed to get display control from evr media sink!"; - return 0; - } - if (FAILED(MFGetService(m_evrSink, MR_VIDEO_MIXER_SERVICE, IID_PPV_ARGS(&m_processor)))) { - qWarning() << "Failed to get video processor from evr media sink!"; - return 0; - } - - setWinId(m_windowId); - setDisplayRect(m_displayRect); - setAspectRatioMode(m_aspectRatioMode); - m_dirtyValues = DXVA2_ProcAmp_Brightness | DXVA2_ProcAmp_Contrast | DXVA2_ProcAmp_Hue | DXVA2_ProcAmp_Saturation; - - return m_currentActivate; -} - -void Evr9VideoWindowControl::setProcAmpValues() -{ - if (m_processor) { - DXVA2_ProcAmpValues values; - if (m_dirtyValues & DXVA2_ProcAmp_Brightness) { - values.Brightness = scaleProcAmpValue(DXVA2_ProcAmp_Brightness, m_brightness); - } - if (m_dirtyValues & DXVA2_ProcAmp_Contrast) { - values.Contrast = scaleProcAmpValue(DXVA2_ProcAmp_Contrast, m_contrast); - } - if (m_dirtyValues & DXVA2_ProcAmp_Hue) { - values.Hue = scaleProcAmpValue(DXVA2_ProcAmp_Hue, m_hue); - } - if (m_dirtyValues & DXVA2_ProcAmp_Saturation) { - values.Saturation = scaleProcAmpValue(DXVA2_ProcAmp_Saturation, m_saturation); - } - - if (SUCCEEDED(m_processor->SetProcAmpValues(m_dirtyValues, &values))) { - m_dirtyValues = 0; - } - } -} - -DXVA2_Fixed32 Evr9VideoWindowControl::scaleProcAmpValue(DWORD prop, int value) const -{ - float scaledValue = 0.0; - - DXVA2_ValueRange range; - if (SUCCEEDED(m_processor->GetProcAmpRange(prop, &range))) { - scaledValue = DXVA2FixedToFloat(range.DefaultValue); - if (value > 0) - scaledValue += float(value) * (DXVA2FixedToFloat(range.MaxValue) - DXVA2FixedToFloat(range.DefaultValue)) / 100; - else if (value < 0) - scaledValue -= float(value) * (DXVA2FixedToFloat(range.MinValue) - DXVA2FixedToFloat(range.DefaultValue)) / 100; - } - - return DXVA2FloatToFixed(scaledValue); -} diff --git a/src/plugins/wmf/player/evr9videowindowcontrol.h b/src/plugins/wmf/player/evr9videowindowcontrol.h deleted file mode 100644 index 05486f987..000000000 --- a/src/plugins/wmf/player/evr9videowindowcontrol.h +++ /dev/null @@ -1,106 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Mobility Components. -** -** $QT_BEGIN_LICENSE:LGPL21$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef EVR9VIDEOWINDOWCONTROL_H -#define EVR9VIDEOWINDOWCONTROL_H - -#include "qvideowindowcontrol.h" - -#include -#include -#include - -QT_USE_NAMESPACE - -class Evr9VideoWindowControl : public QVideoWindowControl -{ - Q_OBJECT -public: - Evr9VideoWindowControl(QObject *parent = 0); - ~Evr9VideoWindowControl(); - - WId winId() const; - void setWinId(WId id); - - QRect displayRect() const; - void setDisplayRect(const QRect &rect); - - bool isFullScreen() const; - void setFullScreen(bool fullScreen); - - void repaint(); - - QSize nativeSize() const; - - Qt::AspectRatioMode aspectRatioMode() const; - void setAspectRatioMode(Qt::AspectRatioMode mode); - - int brightness() const; - void setBrightness(int brightness); - - int contrast() const; - void setContrast(int contrast); - - int hue() const; - void setHue(int hue); - - int saturation() const; - void setSaturation(int saturation); - - IMFActivate* createActivate(); - void releaseActivate(); - - void setProcAmpValues(); - -private: - void clear(); - DXVA2_Fixed32 scaleProcAmpValue(DWORD prop, int value) const; - - WId m_windowId; - COLORREF m_windowColor; - DWORD m_dirtyValues; - Qt::AspectRatioMode m_aspectRatioMode; - QRect m_displayRect; - int m_brightness; - int m_contrast; - int m_hue; - int m_saturation; - bool m_fullScreen; - - IMFActivate *m_currentActivate; - IMFMediaSink *m_evrSink; - IMFVideoDisplayControl *m_displayControl; - IMFVideoProcessor *m_processor; -}; - -#endif diff --git a/src/plugins/wmf/player/mfevrvideowindowcontrol.cpp b/src/plugins/wmf/player/mfevrvideowindowcontrol.cpp new file mode 100644 index 000000000..404f38125 --- /dev/null +++ b/src/plugins/wmf/player/mfevrvideowindowcontrol.cpp @@ -0,0 +1,85 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "mfevrvideowindowcontrol.h" + +#include + +MFEvrVideoWindowControl::MFEvrVideoWindowControl(QObject *parent) + : EvrVideoWindowControl(parent) + , m_currentActivate(NULL) + , m_evrSink(NULL) +{ +} + +MFEvrVideoWindowControl::~MFEvrVideoWindowControl() +{ + clear(); +} + +void MFEvrVideoWindowControl::clear() +{ + setEvr(NULL); + + if (m_evrSink) + m_evrSink->Release(); + if (m_currentActivate) { + m_currentActivate->ShutdownObject(); + m_currentActivate->Release(); + } + m_evrSink = NULL; + m_currentActivate = NULL; +} + +IMFActivate* MFEvrVideoWindowControl::createActivate() +{ + clear(); + + if (FAILED(MFCreateVideoRendererActivate(0, &m_currentActivate))) { + qWarning() << "Failed to create evr video renderer activate!"; + return NULL; + } + if (FAILED(m_currentActivate->ActivateObject(IID_IMFMediaSink, (LPVOID*)(&m_evrSink)))) { + qWarning() << "Failed to activate evr media sink!"; + return NULL; + } + if (!setEvr(m_evrSink)) + return NULL; + + return m_currentActivate; +} + +void MFEvrVideoWindowControl::releaseActivate() +{ + clear(); +} diff --git a/src/plugins/wmf/player/mfevrvideowindowcontrol.h b/src/plugins/wmf/player/mfevrvideowindowcontrol.h new file mode 100644 index 000000000..e5a38f27d --- /dev/null +++ b/src/plugins/wmf/player/mfevrvideowindowcontrol.h @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef MFEVRVIDEOWINDOWCONTROL_H +#define MFEVRVIDEOWINDOWCONTROL_H + +#include "evrvideowindowcontrol.h" + +QT_USE_NAMESPACE + +class MFEvrVideoWindowControl : public EvrVideoWindowControl +{ +public: + MFEvrVideoWindowControl(QObject *parent = 0); + ~MFEvrVideoWindowControl(); + + IMFActivate* createActivate(); + void releaseActivate(); + +private: + void clear(); + + IMFActivate *m_currentActivate; + IMFMediaSink *m_evrSink; +}; + +#endif // MFEVRVIDEOWINDOWCONTROL_H diff --git a/src/plugins/wmf/player/mfplayerservice.cpp b/src/plugins/wmf/player/mfplayerservice.cpp index 4e88b0498..99c6abb3e 100644 --- a/src/plugins/wmf/player/mfplayerservice.cpp +++ b/src/plugins/wmf/player/mfplayerservice.cpp @@ -36,9 +36,7 @@ #include #include "mfplayercontrol.h" -#if defined(HAVE_WIDGETS) && !defined(Q_WS_SIMULATOR) -#include "evr9videowindowcontrol.h" -#endif +#include "mfevrvideowindowcontrol.h" #include "mfvideorenderercontrol.h" #include "mfaudioendpointcontrol.h" #include "mfaudioprobecontrol.h" @@ -50,9 +48,7 @@ MFPlayerService::MFPlayerService(QObject *parent) : QMediaService(parent) , m_session(0) -#if defined(HAVE_WIDGETS) && !defined(Q_WS_SIMULATOR) , m_videoWindowControl(0) -#endif , m_videoRendererControl(0) { m_audioEndpointControl = new MFAudioEndpointControl(this); @@ -65,10 +61,8 @@ MFPlayerService::~MFPlayerService() { m_session->close(); -#if defined(HAVE_WIDGETS) && !defined(Q_WS_SIMULATOR) if (m_videoWindowControl) delete m_videoWindowControl; -#endif if (m_videoRendererControl) delete m_videoRendererControl; @@ -85,21 +79,15 @@ QMediaControl* MFPlayerService::requestControl(const char *name) } else if (qstrcmp(name, QMetaDataReaderControl_iid) == 0) { return m_metaDataControl; } else if (qstrcmp(name, QVideoRendererControl_iid) == 0) { -#if defined(HAVE_WIDGETS) && !defined(Q_WS_SIMULATOR) if (!m_videoRendererControl && !m_videoWindowControl) { -#else - if (!m_videoRendererControl) { -#endif m_videoRendererControl = new MFVideoRendererControl; return m_videoRendererControl; } -#if defined(HAVE_WIDGETS) && !defined(Q_WS_SIMULATOR) } else if (qstrcmp(name, QVideoWindowControl_iid) == 0) { if (!m_videoRendererControl && !m_videoWindowControl) { - m_videoWindowControl = new Evr9VideoWindowControl; + m_videoWindowControl = new MFEvrVideoWindowControl; return m_videoWindowControl; } -#endif } else if (qstrcmp(name,QMediaAudioProbeControl_iid) == 0) { if (m_session) { MFAudioProbeControl *probe = new MFAudioProbeControl(this); @@ -129,12 +117,10 @@ void MFPlayerService::releaseControl(QMediaControl *control) delete m_videoRendererControl; m_videoRendererControl = 0; return; -#if defined(HAVE_WIDGETS) && !defined(Q_WS_SIMULATOR) } else if (control == m_videoWindowControl) { delete m_videoWindowControl; m_videoWindowControl = 0; return; -#endif } MFAudioProbeControl* audioProbe = qobject_cast(control); @@ -164,12 +150,10 @@ MFVideoRendererControl* MFPlayerService::videoRendererControl() const return m_videoRendererControl; } -#if defined(HAVE_WIDGETS) && !defined(Q_WS_SIMULATOR) -Evr9VideoWindowControl* MFPlayerService::videoWindowControl() const +MFEvrVideoWindowControl* MFPlayerService::videoWindowControl() const { return m_videoWindowControl; } -#endif MFMetaDataControl* MFPlayerService::metaDataControl() const { diff --git a/src/plugins/wmf/player/mfplayerservice.h b/src/plugins/wmf/player/mfplayerservice.h index 62eb6b640..b3db70799 100644 --- a/src/plugins/wmf/player/mfplayerservice.h +++ b/src/plugins/wmf/player/mfplayerservice.h @@ -48,9 +48,7 @@ QT_END_NAMESPACE QT_USE_NAMESPACE -#if defined(HAVE_WIDGETS) && !defined(Q_WS_SIMULATOR) -class Evr9VideoWindowControl; -#endif +class MFEvrVideoWindowControl; class MFAudioEndpointControl; class MFVideoRendererControl; class MFPlayerControl; @@ -69,18 +67,14 @@ public: MFAudioEndpointControl* audioEndpointControl() const; MFVideoRendererControl* videoRendererControl() const; -#if defined(HAVE_WIDGETS) && !defined(Q_WS_SIMULATOR) - Evr9VideoWindowControl* videoWindowControl() const; -#endif + MFEvrVideoWindowControl* videoWindowControl() const; MFMetaDataControl* metaDataControl() const; private: MFPlayerSession *m_session; MFVideoRendererControl *m_videoRendererControl; MFAudioEndpointControl *m_audioEndpointControl; -#if defined(HAVE_WIDGETS) && !defined(Q_WS_SIMULATOR) - Evr9VideoWindowControl *m_videoWindowControl; -#endif + MFEvrVideoWindowControl *m_videoWindowControl; MFPlayerControl *m_player; MFMetaDataControl *m_metaDataControl; }; diff --git a/src/plugins/wmf/player/mfplayersession.cpp b/src/plugins/wmf/player/mfplayersession.cpp index 283853def..e4c498b76 100644 --- a/src/plugins/wmf/player/mfplayersession.cpp +++ b/src/plugins/wmf/player/mfplayersession.cpp @@ -43,9 +43,7 @@ #include #include "mfplayercontrol.h" -#if defined(HAVE_WIDGETS) && !defined(Q_WS_SIMULATOR) -#include "evr9videowindowcontrol.h" -#endif +#include "mfevrvideowindowcontrol.h" #include "mfvideorenderercontrol.h" #include "mfaudioendpointcontrol.h" @@ -140,10 +138,8 @@ void MFPlayerSession::close() if (m_playerService->videoRendererControl()) { m_playerService->videoRendererControl()->releaseActivate(); -#if defined(HAVE_WIDGETS) && !defined(Q_WS_SIMULATOR) } else if (m_playerService->videoWindowControl()) { m_playerService->videoWindowControl()->releaseActivate(); -#endif } if (m_session) @@ -404,10 +400,8 @@ IMFTopologyNode* MFPlayerSession::addOutputNode(IMFStreamDescriptor *streamDesc, mediaType = Video; if (m_playerService->videoRendererControl()) { activate = m_playerService->videoRendererControl()->createActivate(); -#if defined(HAVE_WIDGETS) && !defined(Q_WS_SIMULATOR) } else if (m_playerService->videoWindowControl()) { activate = m_playerService->videoWindowControl()->createActivate(); -#endif } else { qWarning() << "no videoWindowControl or videoRendererControl, unable to add output node for video data"; } @@ -1580,13 +1574,11 @@ void MFPlayerSession::handleSessionEvent(IMFMediaEvent *sessionEvent) } updatePendingCommands(CmdStart); -#if defined(HAVE_WIDGETS) && !defined(Q_WS_SIMULATOR) // playback started, we can now set again the procAmpValues if they have been // changed previously (these are lost when loading a new media) if (m_playerService->videoWindowControl()) { - m_playerService->videoWindowControl()->setProcAmpValues(); + m_playerService->videoWindowControl()->applyImageControls(); } -#endif break; case MESessionStopped: if (m_status != QMediaPlayer::EndOfMedia) { diff --git a/src/plugins/wmf/player/mfplayersession.h b/src/plugins/wmf/player/mfplayersession.h index effb36fa2..1d136ba55 100644 --- a/src/plugins/wmf/player/mfplayersession.h +++ b/src/plugins/wmf/player/mfplayersession.h @@ -57,7 +57,7 @@ QT_USE_NAMESPACE class SourceResolver; #ifndef Q_WS_SIMULATOR -class Evr9VideoWindowControl; +class EvrVideoWindowControl; #endif class MFAudioEndpointControl; class MFVideoRendererControl; diff --git a/src/plugins/wmf/player/player.pri b/src/plugins/wmf/player/player.pri index dd5c9dc12..c24370eea 100644 --- a/src/plugins/wmf/player/player.pri +++ b/src/plugins/wmf/player/player.pri @@ -12,7 +12,8 @@ HEADERS += \ $$PWD/mfaudioendpointcontrol.h \ $$PWD/mfmetadatacontrol.h \ $$PWD/mfaudioprobecontrol.h \ - $$PWD/mfvideoprobecontrol.h + $$PWD/mfvideoprobecontrol.h \ + $$PWD/mfevrvideowindowcontrol.h SOURCES += \ $$PWD/mfplayerservice.cpp \ @@ -22,9 +23,7 @@ SOURCES += \ $$PWD/mfaudioendpointcontrol.cpp \ $$PWD/mfmetadatacontrol.cpp \ $$PWD/mfaudioprobecontrol.cpp \ - $$PWD/mfvideoprobecontrol.cpp + $$PWD/mfvideoprobecontrol.cpp \ + $$PWD/mfevrvideowindowcontrol.cpp -qtHaveModule(widgets):!simulator { - HEADERS += $$PWD/evr9videowindowcontrol.h - SOURCES += $$PWD/evr9videowindowcontrol.cpp -} +include($$PWD/../../common/evr.pri) diff --git a/src/plugins/wmf/wmf.pro b/src/plugins/wmf/wmf.pro index 60fc3f641..68a777f37 100644 --- a/src/plugins/wmf/wmf.pro +++ b/src/plugins/wmf/wmf.pro @@ -1,9 +1,6 @@ TARGET = wmfengine QT += multimedia-private network -qtHaveModule(widgets) { - QT += multimediawidgets-private - DEFINES += HAVE_WIDGETS -} + win32:!qtHaveModule(opengl) { LIBS_PRIVATE += -lgdi32 -luser32 } @@ -37,15 +34,14 @@ contains(QT_CONFIG, angle)|contains(QT_CONFIG, dynamicgl) { QT += gui-private HEADERS += \ - evrcustompresenter.h \ - evrd3dpresentengine.h + $$PWD/evrcustompresenter.h \ + $$PWD/evrd3dpresentengine.h SOURCES += \ - evrcustompresenter.cpp \ - evrd3dpresentengine.cpp + $$PWD/evrcustompresenter.cpp \ + $$PWD/evrd3dpresentengine.cpp } - include (player/player.pri) include (decoder/decoder.pri) -- cgit v1.2.3