diff --git a/qtmultimedia.pro b/qtmultimedia.pro index 47c56e8b6f1a77e95e2ef2bcb245bc1c875b6d0e..98bb3152fcc2404d19b3e955a23b5f68e07e5f9b 100644 --- a/qtmultimedia.pro +++ b/qtmultimedia.pro @@ -6,9 +6,9 @@ win32 { qtCompileTest(directshow) { qtCompileTest(wshellitem) } + qtCompileTest(evr) qtCompileTest(wmsdk) contains(QT_CONFIG, wmf-backend): qtCompileTest(wmf) - qtCompileTest(evr) } else:mac { qtCompileTest(avfoundation) } else:qnx { diff --git a/src/plugins/common/evr.pri b/src/plugins/common/evr.pri new file mode 100644 index 0000000000000000000000000000000000000000..f951f673073e2bdfb45aceb5f9828b0811ec433e --- /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 0000000000000000000000000000000000000000..ce6ca6584ed8b55bbdff7ce3b64eb598f7e8d68c --- /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 <d3d9.h> +#include <Evr9.h> +#include <dxva2api.h> + +// 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/wmf/player/evr9videowindowcontrol.cpp b/src/plugins/common/evr/evrvideowindowcontrol.cpp similarity index 73% rename from src/plugins/wmf/player/evr9videowindowcontrol.cpp rename to src/plugins/common/evr/evrvideowindowcontrol.cpp index e94918dba098181e31cc66333b0af37b1f4cffc0..faa23d6e596621621a4a06f6e3cc903f3d0fdada 100644 --- a/src/plugins/wmf/player/evr9videowindowcontrol.cpp +++ b/src/plugins/common/evr/evrvideowindowcontrol.cpp @@ -3,7 +3,7 @@ ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** -** This file is part of the Qt Mobility Components. +** This file is part of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage @@ -31,14 +31,16 @@ ** ****************************************************************************/ -#include "evr9videowindowcontrol.h" -#include <QtWidgets/qwidget.h> -#include <QtCore/qdebug.h> -#include <QtCore/qglobal.h> +#include "evrvideowindowcontrol.h" -Evr9VideoWindowControl::Evr9VideoWindowControl(QObject *parent) +#ifndef QT_NO_WIDGETS +#include <qwidget.h> +#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) @@ -46,68 +48,83 @@ Evr9VideoWindowControl::Evr9VideoWindowControl(QObject *parent) , m_hue(0) , m_saturation(0) , m_fullScreen(false) - , m_currentActivate(0) - , m_evrSink(0) , m_displayControl(0) , m_processor(0) { } -Evr9VideoWindowControl::~Evr9VideoWindowControl() +EvrVideoWindowControl::~EvrVideoWindowControl() { clear(); } -void Evr9VideoWindowControl::clear() +bool EvrVideoWindowControl::setEvr(IUnknown *evr) { - 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(); + 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(); } - m_processor = NULL; - m_displayControl = NULL; - m_evrSink = NULL; - m_currentActivate = NULL; + if (service) + service->Release(); + + return m_displayControl != NULL; } -void Evr9VideoWindowControl::releaseActivate() +void EvrVideoWindowControl::clear() { - clear(); + if (m_displayControl) + m_displayControl->Release(); + m_displayControl = NULL; + + if (m_processor) + m_processor->Release(); + m_processor = NULL; } -WId Evr9VideoWindowControl::winId() const +WId EvrVideoWindowControl::winId() const { return m_windowId; } -void Evr9VideoWindowControl::setWinId(WId id) +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) { + if (m_displayControl) m_displayControl->SetVideoWindow(HWND(m_windowId)); - } } -QRect Evr9VideoWindowControl::displayRect() const +QRect EvrVideoWindowControl::displayRect() const { return m_displayRect; } -void Evr9VideoWindowControl::setDisplayRect(const QRect &rect) +void EvrVideoWindowControl::setDisplayRect(const QRect &rect) { m_displayRect = rect; @@ -140,19 +157,19 @@ void Evr9VideoWindowControl::setDisplayRect(const QRect &rect) } } -bool Evr9VideoWindowControl::isFullScreen() const +bool EvrVideoWindowControl::isFullScreen() const { return m_fullScreen; } -void Evr9VideoWindowControl::setFullScreen(bool fullScreen) +void EvrVideoWindowControl::setFullScreen(bool fullScreen) { if (m_fullScreen == fullScreen) return; emit fullScreenChanged(m_fullScreen = fullScreen); } -void Evr9VideoWindowControl::repaint() +void EvrVideoWindowControl::repaint() { QSize size = nativeSize(); if (size.width() > 0 && size.height() > 0 @@ -181,7 +198,7 @@ void Evr9VideoWindowControl::repaint() } } -QSize Evr9VideoWindowControl::nativeSize() const +QSize EvrVideoWindowControl::nativeSize() const { QSize size; if (m_displayControl) { @@ -192,12 +209,12 @@ QSize Evr9VideoWindowControl::nativeSize() const return size; } -Qt::AspectRatioMode Evr9VideoWindowControl::aspectRatioMode() const +Qt::AspectRatioMode EvrVideoWindowControl::aspectRatioMode() const { return m_aspectRatioMode; } -void Evr9VideoWindowControl::setAspectRatioMode(Qt::AspectRatioMode mode) +void EvrVideoWindowControl::setAspectRatioMode(Qt::AspectRatioMode mode) { m_aspectRatioMode = mode; @@ -222,12 +239,12 @@ void Evr9VideoWindowControl::setAspectRatioMode(Qt::AspectRatioMode mode) } } -int Evr9VideoWindowControl::brightness() const +int EvrVideoWindowControl::brightness() const { return m_brightness; } -void Evr9VideoWindowControl::setBrightness(int brightness) +void EvrVideoWindowControl::setBrightness(int brightness) { if (m_brightness == brightness) return; @@ -236,17 +253,17 @@ void Evr9VideoWindowControl::setBrightness(int brightness) m_dirtyValues |= DXVA2_ProcAmp_Brightness; - setProcAmpValues(); + applyImageControls(); emit brightnessChanged(brightness); } -int Evr9VideoWindowControl::contrast() const +int EvrVideoWindowControl::contrast() const { return m_contrast; } -void Evr9VideoWindowControl::setContrast(int contrast) +void EvrVideoWindowControl::setContrast(int contrast) { if (m_contrast == contrast) return; @@ -255,17 +272,17 @@ void Evr9VideoWindowControl::setContrast(int contrast) m_dirtyValues |= DXVA2_ProcAmp_Contrast; - setProcAmpValues(); + applyImageControls(); emit contrastChanged(contrast); } -int Evr9VideoWindowControl::hue() const +int EvrVideoWindowControl::hue() const { return m_hue; } -void Evr9VideoWindowControl::setHue(int hue) +void EvrVideoWindowControl::setHue(int hue) { if (m_hue == hue) return; @@ -274,17 +291,17 @@ void Evr9VideoWindowControl::setHue(int hue) m_dirtyValues |= DXVA2_ProcAmp_Hue; - setProcAmpValues(); + applyImageControls(); emit hueChanged(hue); } -int Evr9VideoWindowControl::saturation() const +int EvrVideoWindowControl::saturation() const { return m_saturation; } -void Evr9VideoWindowControl::setSaturation(int saturation) +void EvrVideoWindowControl::setSaturation(int saturation) { if (m_saturation == saturation) return; @@ -293,41 +310,12 @@ void Evr9VideoWindowControl::setSaturation(int saturation) m_dirtyValues |= DXVA2_ProcAmp_Saturation; - setProcAmpValues(); + applyImageControls(); 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() +void EvrVideoWindowControl::applyImageControls() { if (m_processor) { DXVA2_ProcAmpValues values; @@ -350,7 +338,7 @@ void Evr9VideoWindowControl::setProcAmpValues() } } -DXVA2_Fixed32 Evr9VideoWindowControl::scaleProcAmpValue(DWORD prop, int value) const +DXVA2_Fixed32 EvrVideoWindowControl::scaleProcAmpValue(DWORD prop, int value) const { float scaledValue = 0.0; diff --git a/src/plugins/wmf/player/evr9videowindowcontrol.h b/src/plugins/common/evr/evrvideowindowcontrol.h similarity index 86% rename from src/plugins/wmf/player/evr9videowindowcontrol.h rename to src/plugins/common/evr/evrvideowindowcontrol.h index 05486f987b772c8a494c8d8f514bfae52c2f62cd..beb82ec05d658ec58a2a1ae055503af1591aa346 100644 --- a/src/plugins/wmf/player/evr9videowindowcontrol.h +++ b/src/plugins/common/evr/evrvideowindowcontrol.h @@ -31,23 +31,23 @@ ** ****************************************************************************/ -#ifndef EVR9VIDEOWINDOWCONTROL_H -#define EVR9VIDEOWINDOWCONTROL_H +#ifndef EVRVIDEOWINDOWCONTROL_H +#define EVRVIDEOWINDOWCONTROL_H #include "qvideowindowcontrol.h" -#include <Mfidl.h> -#include <d3d9.h> -#include <Evr9.h> +#include "evrdefs.h" QT_USE_NAMESPACE -class Evr9VideoWindowControl : public QVideoWindowControl +class EvrVideoWindowControl : public QVideoWindowControl { Q_OBJECT public: - Evr9VideoWindowControl(QObject *parent = 0); - ~Evr9VideoWindowControl(); + EvrVideoWindowControl(QObject *parent = 0); + ~EvrVideoWindowControl(); + + bool setEvr(IUnknown *evr); WId winId() const; void setWinId(WId id); @@ -77,10 +77,7 @@ public: int saturation() const; void setSaturation(int saturation); - IMFActivate* createActivate(); - void releaseActivate(); - - void setProcAmpValues(); + void applyImageControls(); private: void clear(); @@ -97,8 +94,6 @@ private: int m_saturation; bool m_fullScreen; - IMFActivate *m_currentActivate; - IMFMediaSink *m_evrSink; IMFVideoDisplayControl *m_displayControl; IMFVideoProcessor *m_processor; }; diff --git a/src/plugins/directshow/directshow.pro b/src/plugins/directshow/directshow.pro index 7815927dbaeb499f6edd53b7aed4e0df19feafd7..4d7183923472361e9f574b4c5ee3ae766e9c4fc8 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 798a9410239df7f6f7c92d2e71fab79beacfae2f..d063447e37a09f19ae5202ae59d3e4ecb43a185b 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<ICreateDevEnum>(CLSID_SystemDeviceEnum, IID_ICreateDevEnum); + m_deviceEnumerator = com_new<ICreateDevEnum>(CLSID_SystemDeviceEnum); updateEndpoints(); diff --git a/src/plugins/directshow/player/directshowevrvideowindowcontrol.cpp b/src/plugins/directshow/player/directshowevrvideowindowcontrol.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7bffe47d2a627f3a5957cd2dc65994a0719cfefd --- /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<IBaseFilter>(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 0000000000000000000000000000000000000000..46171812b61f8e9c616f1a324c4f5f60372a5482 --- /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 68cb23649a58d8487e93c008dd4e9f873e9830f7..d8f1d1200b2bc15e544fb9ff709a63dad29c1271 100644 --- a/src/plugins/directshow/player/directshowglobal.h +++ b/src/plugins/directshow/player/directshowglobal.h @@ -46,6 +46,18 @@ template <typename T> T *com_cast(IUnknown *unknown, const IID &iid) : 0; } +template <typename T> 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 <typename T> 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 bee072d3bab443b86648f2abf4a2dac875a4c852..298d099d2aadf626a2ceaa0c34ebabe3007cc8c2 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<IMemAllocator>(CLSID_MemoryAllocator, IID_IMemAllocator); + *ppActual = com_new<IMemAllocator>(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 424120fd8bded430dae26f6c6b8e54db16e6eb1c..e1034a9c6e94ca0edcf252fd7038d6e80925ca6d 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<IMemInputPin>(pin, IID_IMemInputPin)) { - if ((m_allocator = com_new<IMemAllocator>(CLSID_MemoryAllocator, IID_IMemAllocator))) { + if ((m_allocator = com_new<IMemAllocator>(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 b73fa5c4caf8537fbaefc556d74ad710fc095df7..a9b686360afa9ab1d7d9ea503e5e1ca244753f0f 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<IFileSourceFilter>( - clsid_WMAsfReader, iid_IFileSourceFilter)) { + if (IFileSourceFilter *fileSource = com_new<IFileSourceFilter>(clsid_WMAsfReader, iid_IFileSourceFilter)) { locker->unlock(); hr = fileSource->Load(reinterpret_cast<const OLECHAR *>(m_url.toString().utf16()), 0); diff --git a/src/plugins/directshow/player/directshowplayerservice.h b/src/plugins/directshow/player/directshowplayerservice.h index f4da103dc5dcb5cff0c405e9df4ff62fa911c5ea..edfde105e1d54111cd7287ef2838bb96e8866421 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 c5c934a38e78a6d04c0c1f1e1f1fd29f4cb71703..8586ea5da1eeb00f6c44dc741b2ef5a7dc4000e7 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 48ff6c2c3f5d275cc95c7b7da92305d2215e7f9c..853ca031c3176f00401bc0cd23915304ed022557 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 <QtGui/QPalette> #include <QtWidgets/QWidget> +#endif Vmr9VideoWindowControl::Vmr9VideoWindowControl(QObject *parent) : QVideoWindowControl(parent) - , m_filter(com_new<IBaseFilter>(CLSID_VideoMixingRenderer9, IID_IBaseFilter)) + , m_filter(com_new<IBaseFilter>(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<IVMRWindowlessControl9>( m_filter, IID_IVMRWindowlessControl9)) { diff --git a/src/plugins/wmf/player/mfevrvideowindowcontrol.cpp b/src/plugins/wmf/player/mfevrvideowindowcontrol.cpp new file mode 100644 index 0000000000000000000000000000000000000000..404f381254fd9b926700c5aedd64735357737832 --- /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 <qdebug.h> + +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 0000000000000000000000000000000000000000..e5a38f27db9ab887663b1a0b3d921f52694fa845 --- /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 4e88b0498391540fa35a72bcb360ffba86c3a1c4..99c6abb3e01d53e9def0dab6016d9a26e8111ec8 100644 --- a/src/plugins/wmf/player/mfplayerservice.cpp +++ b/src/plugins/wmf/player/mfplayerservice.cpp @@ -36,9 +36,7 @@ #include <QtCore/qdebug.h> #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<MFAudioProbeControl*>(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 62eb6b6406f3de03779e42919c4cc937e299976d..b3db70799b28428f2e02abbebc80b8d1f9103644 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 283853def2813af6e2a5b52fad35f64134073cbf..e4c498b76e67bc3fe5ba8109c68a5637d04841f1 100644 --- a/src/plugins/wmf/player/mfplayersession.cpp +++ b/src/plugins/wmf/player/mfplayersession.cpp @@ -43,9 +43,7 @@ #include <QtCore/qbuffer.h> #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 effb36fa2131f5574cf059a801fc61ac4f7d9cf6..1d136ba55e4b1faa834c7c3d7b9bd952179e59b4 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 dd5c9dc12412e0dba04ab920574bbf1572ea0cae..c24370eea66f192f652e57f977910403f14d57f5 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 60fc3f6413fb20dad4d12cec5e166b0b21c28368..68a777f374788a8c7169da822142921ffb73141a 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)