summaryrefslogtreecommitdiffstats
path: root/src/plugins/directshow
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/directshow')
-rw-r--r--src/plugins/directshow/directshow.pro5
-rw-r--r--src/plugins/directshow/player/directshowaudioendpointcontrol.cpp2
-rw-r--r--src/plugins/directshow/player/directshowevrvideowindowcontrol.cpp63
-rw-r--r--src/plugins/directshow/player/directshowevrvideowindowcontrol.h55
-rw-r--r--src/plugins/directshow/player/directshowglobal.h12
-rw-r--r--src/plugins/directshow/player/directshowioreader.cpp2
-rw-r--r--src/plugins/directshow/player/directshowiosource.cpp2
-rw-r--r--src/plugins/directshow/player/directshowplayerservice.cpp37
-rw-r--r--src/plugins/directshow/player/directshowplayerservice.h8
-rw-r--r--src/plugins/directshow/player/player.pri24
-rw-r--r--src/plugins/directshow/player/vmr9videowindowcontrol.cpp7
11 files changed, 175 insertions, 42 deletions
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<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 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<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 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 <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 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<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 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<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 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<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 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 <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)) {