summaryrefslogtreecommitdiffstats
path: root/src/plugins/mediaservices/directshow/mediaplayer
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/mediaservices/directshow/mediaplayer')
-rw-r--r--src/plugins/mediaservices/directshow/mediaplayer/directshowaudioendpointcontrol.cpp11
-rw-r--r--src/plugins/mediaservices/directshow/mediaplayer/directshowglobal.h81
-rw-r--r--src/plugins/mediaservices/directshow/mediaplayer/directshowioreader.cpp2
-rw-r--r--src/plugins/mediaservices/directshow/mediaplayer/directshowiosource.cpp10
-rw-r--r--src/plugins/mediaservices/directshow/mediaplayer/directshowiosource.h4
-rw-r--r--src/plugins/mediaservices/directshow/mediaplayer/directshowmediatype.cpp34
-rw-r--r--src/plugins/mediaservices/directshow/mediaplayer/directshowmetadatacontrol.cpp4
-rw-r--r--src/plugins/mediaservices/directshow/mediaplayer/directshowmetadatacontrol.h3
-rw-r--r--src/plugins/mediaservices/directshow/mediaplayer/directshowplayercontrol.cpp2
-rw-r--r--src/plugins/mediaservices/directshow/mediaplayer/directshowplayerservice.cpp98
-rw-r--r--src/plugins/mediaservices/directshow/mediaplayer/directshowplayerservice.h1
-rw-r--r--src/plugins/mediaservices/directshow/mediaplayer/mediaplayer.pri2
-rw-r--r--src/plugins/mediaservices/directshow/mediaplayer/videosurfacefilter.cpp18
-rw-r--r--src/plugins/mediaservices/directshow/mediaplayer/videosurfacefilter.h4
-rw-r--r--src/plugins/mediaservices/directshow/mediaplayer/vmr9videowindowcontrol.cpp27
15 files changed, 208 insertions, 93 deletions
diff --git a/src/plugins/mediaservices/directshow/mediaplayer/directshowaudioendpointcontrol.cpp b/src/plugins/mediaservices/directshow/mediaplayer/directshowaudioendpointcontrol.cpp
index 570b44a..5f72ca6 100644
--- a/src/plugins/mediaservices/directshow/mediaplayer/directshowaudioendpointcontrol.cpp
+++ b/src/plugins/mediaservices/directshow/mediaplayer/directshowaudioendpointcontrol.cpp
@@ -55,7 +55,7 @@ DirectShowAudioEndpointControl::DirectShowAudioEndpointControl(
, m_deviceEnumerator(0)
{
if (CreateBindCtx(0, &m_bindContext) == S_OK) {
- m_deviceEnumerator = com_new<ICreateDevEnum>(CLSID_SystemDeviceEnum);
+ m_deviceEnumerator = com_new<ICreateDevEnum>(CLSID_SystemDeviceEnum, IID_ICreateDevEnum);
updateEndpoints();
@@ -82,6 +82,7 @@ QList<QString> DirectShowAudioEndpointControl::availableEndpoints() const
QString DirectShowAudioEndpointControl::endpointDescription(const QString &name) const
{
+#ifdef __IPropertyBag_INTERFACE_DEFINED__
QString description;
if (IMoniker *moniker = m_devices.value(name, 0)) {
@@ -96,7 +97,11 @@ QString DirectShowAudioEndpointControl::endpointDescription(const QString &name)
propertyBag->Release();
}
}
- return description;;
+
+ return description;
+#else
+ return name.section(QLatin1Char('\\'), -1);
+#endif
}
QString DirectShowAudioEndpointControl::defaultEndpoint() const
@@ -120,7 +125,7 @@ void DirectShowAudioEndpointControl::setActiveEndpoint(const QString &name)
if (moniker->BindToObject(
m_bindContext,
0,
- __uuidof(IBaseFilter),
+ IID_IBaseFilter,
reinterpret_cast<void **>(&filter)) == S_OK) {
m_service->setAudioOutput(filter);
diff --git a/src/plugins/mediaservices/directshow/mediaplayer/directshowglobal.h b/src/plugins/mediaservices/directshow/mediaplayer/directshowglobal.h
index 1c9fe54..e43e2a7 100644
--- a/src/plugins/mediaservices/directshow/mediaplayer/directshowglobal.h
+++ b/src/plugins/mediaservices/directshow/mediaplayer/directshowglobal.h
@@ -42,30 +42,30 @@
#ifndef DIRECTSHOWGLOBAL_H
#define DIRECTSHOWGLOBAL_H
-#include <dshow.h>
+#include <QtCore/qglobal.h>
+#include <dshow.h>
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-template <typename T> T *com_cast(IUnknown *unknown)
+template <typename T> T *com_cast(IUnknown *unknown, const IID &iid)
{
T *iface = 0;
- return unknown && unknown->QueryInterface(
- __uuidof(T), reinterpret_cast<void **>(&iface)) == S_OK
+ return unknown && unknown->QueryInterface(iid, reinterpret_cast<void **>(&iface)) == S_OK
? iface
: 0;
}
-template <typename T> T *com_new(const IID &clsid)
+template <typename T> T *com_new(const IID &clsid, const IID &iid)
{
T *object = 0;
return CoCreateInstance(
clsid,
NULL,
CLSCTX_INPROC_SERVER,
- __uuidof(T),
+ iid,
reinterpret_cast<void **>(&object)) == S_OK
? object
: 0;
@@ -75,4 +75,73 @@ QT_END_NAMESPACE
QT_END_HEADER
+#ifndef __IFilterGraph2_INTERFACE_DEFINED__
+#define __IFilterGraph2_INTERFACE_DEFINED__
+#define INTERFACE IFilterGraph2
+DECLARE_INTERFACE_(IFilterGraph2 ,IGraphBuilder)
+{
+ STDMETHOD(AddSourceFilterForMoniker)(THIS_ IMoniker *, IBindCtx *, LPCWSTR,IBaseFilter **) PURE;
+ STDMETHOD(ReconnectEx)(THIS_ IPin *, const AM_MEDIA_TYPE *) PURE;
+ STDMETHOD(RenderEx)(IPin *, DWORD, DWORD *) PURE;
+};
+#undef INTERFACE
+#endif
+
+#ifndef __IAMFilterMiscFlags_INTERFACE_DEFINED__
+#define __IAMFilterMiscFlags_INTERFACE_DEFINED__
+#define INTERFACE IAMFilterMiscFlags
+DECLARE_INTERFACE_(IAMFilterMiscFlags ,IUnknown)
+{
+ STDMETHOD(QueryInterface)(THIS_ REFIID,PVOID*) PURE;
+ STDMETHOD_(ULONG,AddRef)(THIS) PURE;
+ STDMETHOD_(ULONG,Release)(THIS) PURE;
+ STDMETHOD_(ULONG,GetMiscFlags)(THIS) PURE;
+};
+#undef INTERFACE
+#endif
+
+#ifndef __IFileSourceFilter_INTERFACE_DEFINED__
+#define __IFileSourceFilter_INTERFACE_DEFINED__
+#define INTERFACE IFileSourceFilter
+DECLARE_INTERFACE_(IFileSourceFilter ,IUnknown)
+{
+ STDMETHOD(QueryInterface)(THIS_ REFIID,PVOID*) PURE;
+ STDMETHOD_(ULONG,AddRef)(THIS) PURE;
+ STDMETHOD_(ULONG,Release)(THIS) PURE;
+ STDMETHOD(Load)(THIS_ LPCOLESTR, const AM_MEDIA_TYPE *) PURE;
+ STDMETHOD(GetCurFile)(THIS_ LPOLESTR *ppszFileName, AM_MEDIA_TYPE *) PURE;
+};
+#undef INTERFACE
+#endif
+
+#ifndef __IAMOpenProgress_INTERFACE_DEFINED__
+#define __IAMOpenProgress_INTERFACE_DEFINED__
+#define INTERFACE IAMOpenProgress
+DECLARE_INTERFACE_(IAMOpenProgress ,IUnknown)
+{
+ STDMETHOD(QueryInterface)(THIS_ REFIID,PVOID*) PURE;
+ STDMETHOD_(ULONG,AddRef)(THIS) PURE;
+ STDMETHOD_(ULONG,Release)(THIS) PURE;
+ STDMETHOD(QueryProgress)(THIS_ LONGLONG *, LONGLONG *) PURE;
+ STDMETHOD(AbortOperation)(THIS) PURE;
+};
+#undef INTERFACE
+#endif
+
+#ifndef __IFilterChain_INTERFACE_DEFINED__
+#define __IFilterChain_INTERFACE_DEFINED__
+#define INTERFACE IFilterChain
+DECLARE_INTERFACE_(IFilterChain ,IUnknown)
+{
+ STDMETHOD(QueryInterface)(THIS_ REFIID,PVOID*) PURE;
+ STDMETHOD_(ULONG,AddRef)(THIS) PURE;
+ STDMETHOD_(ULONG,Release)(THIS) PURE;
+ STDMETHOD(StartChain)(IBaseFilter *, IBaseFilter *) PURE;
+ STDMETHOD(PauseChain)(IBaseFilter *, IBaseFilter *) PURE;
+ STDMETHOD(StopChain)(IBaseFilter *, IBaseFilter *) PURE;
+ STDMETHOD(RemoveChain)(IBaseFilter *, IBaseFilter *) PURE;
+};
+#undef INTERFACE
+#endif
+
#endif
diff --git a/src/plugins/mediaservices/directshow/mediaplayer/directshowioreader.cpp b/src/plugins/mediaservices/directshow/mediaplayer/directshowioreader.cpp
index 54446b8..7369099 100644
--- a/src/plugins/mediaservices/directshow/mediaplayer/directshowioreader.cpp
+++ b/src/plugins/mediaservices/directshow/mediaplayer/directshowioreader.cpp
@@ -143,7 +143,7 @@ HRESULT DirectShowIOReader::RequestAllocator(
return S_OK;
} else {
- *ppActual = com_new<IMemAllocator>(CLSID_MemoryAllocator);
+ *ppActual = com_new<IMemAllocator>(CLSID_MemoryAllocator, IID_IMemAllocator);
if (*ppActual) {
if ((*ppActual)->SetProperties(pProps, &actualProperties) != S_OK) {
diff --git a/src/plugins/mediaservices/directshow/mediaplayer/directshowiosource.cpp b/src/plugins/mediaservices/directshow/mediaplayer/directshowiosource.cpp
index 1dca465..7b66d56 100644
--- a/src/plugins/mediaservices/directshow/mediaplayer/directshowiosource.cpp
+++ b/src/plugins/mediaservices/directshow/mediaplayer/directshowiosource.cpp
@@ -121,6 +121,10 @@ void DirectShowIOSource::setAllocator(IMemAllocator *allocator)
// IUnknown
HRESULT DirectShowIOSource::QueryInterface(REFIID riid, void **ppvObject)
{
+ // 2dd74950-a890-11d1-abe8-00a0c905f375
+ static const GUID iid_IAmFilterMiscFlags = {
+ 0x2dd74950, 0xa890, 0x11d1, {0xab, 0xe8, 0x00, 0xa0, 0xc9, 0x05, 0xf3, 0x75}};
+
if (!ppvObject) {
return E_POINTER;
} else if (riid == IID_IUnknown
@@ -128,7 +132,7 @@ HRESULT DirectShowIOSource::QueryInterface(REFIID riid, void **ppvObject)
|| riid == IID_IMediaFilter
|| riid == IID_IBaseFilter) {
*ppvObject = static_cast<IBaseFilter *>(this);
- } else if (riid == IID_IAMFilterMiscFlags) {
+ } else if (riid == iid_IAmFilterMiscFlags) {
*ppvObject = static_cast<IAMFilterMiscFlags *>(this);
} else if (riid == IID_IPin) {
*ppvObject = static_cast<IPin *>(this);
@@ -414,8 +418,8 @@ HRESULT DirectShowIOSource::tryConnect(IPin *pin, const AM_MEDIA_TYPE *type)
} else if (!m_allocator) {
hr = VFW_E_NO_TRANSPORT;
- if (IMemInputPin *memPin = com_cast<IMemInputPin>(pin)) {
- if ((m_allocator = com_new<IMemAllocator>(CLSID_MemoryAllocator))) {
+ if (IMemInputPin *memPin = com_cast<IMemInputPin>(pin, IID_IMemInputPin)) {
+ if ((m_allocator = com_new<IMemAllocator>(CLSID_MemoryAllocator, IID_IMemAllocator))) {
ALLOCATOR_PROPERTIES properties;
if (memPin->GetAllocatorRequirements(&properties) == S_OK
|| m_allocator->GetProperties(&properties) == S_OK) {
diff --git a/src/plugins/mediaservices/directshow/mediaplayer/directshowiosource.h b/src/plugins/mediaservices/directshow/mediaplayer/directshowiosource.h
index b626473..1d917df 100644
--- a/src/plugins/mediaservices/directshow/mediaplayer/directshowiosource.h
+++ b/src/plugins/mediaservices/directshow/mediaplayer/directshowiosource.h
@@ -42,17 +42,17 @@
#ifndef DIRECTSHOWIOSOURCE_H
#define DIRECTSHOWIOSOURCE_H
+#include "directshowglobal.h"
#include "directshowioreader.h"
#include "directshowmediatype.h"
#include "directshowmediatypelist.h"
+#include <QtCore/qfile.h>
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-#include <QtCore/qfile.h>
-
class DirectShowIOSource
: public DirectShowMediaTypeList
, public IBaseFilter
diff --git a/src/plugins/mediaservices/directshow/mediaplayer/directshowmediatype.cpp b/src/plugins/mediaservices/directshow/mediaplayer/directshowmediatype.cpp
index f719b29..cf6d45b 100644
--- a/src/plugins/mediaservices/directshow/mediaplayer/directshowmediatype.cpp
+++ b/src/plugins/mediaservices/directshow/mediaplayer/directshowmediatype.cpp
@@ -54,20 +54,20 @@ namespace
static const TypeLookup qt_typeLookup[] =
{
- { QVideoFrame::Format_RGB32, MEDIASUBTYPE_RGB32 },
- { QVideoFrame::Format_BGR24, MEDIASUBTYPE_RGB24 },
- { QVideoFrame::Format_RGB565, MEDIASUBTYPE_RGB565 },
- { QVideoFrame::Format_RGB555, MEDIASUBTYPE_RGB555 },
- { QVideoFrame::Format_AYUV444, MEDIASUBTYPE_AYUV },
- { QVideoFrame::Format_YUYV, MEDIASUBTYPE_YUY2 },
- { QVideoFrame::Format_UYVY, MEDIASUBTYPE_UYVY },
- { QVideoFrame::Format_IMC1, MEDIASUBTYPE_IMC1 },
- { QVideoFrame::Format_IMC2, MEDIASUBTYPE_IMC2 },
- { QVideoFrame::Format_IMC3, MEDIASUBTYPE_IMC3 },
- { QVideoFrame::Format_IMC4, MEDIASUBTYPE_IMC4 },
- { QVideoFrame::Format_YV12, MEDIASUBTYPE_YV12 },
- { QVideoFrame::Format_NV12, MEDIASUBTYPE_NV12 },
- { QVideoFrame::Format_YUV420P, MEDIASUBTYPE_IYUV }
+ { QVideoFrame::Format_RGB32, /*MEDIASUBTYPE_RGB32*/ {0xe436eb7e, 0x524f, 0x11ce, {0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}} },
+ { QVideoFrame::Format_BGR24, /*MEDIASUBTYPE_RGB24*/ {0xe436eb7d, 0x524f, 0x11ce, {0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}} },
+ { QVideoFrame::Format_RGB565, /*MEDIASUBTYPE_RGB565*/ {0xe436eb7b, 0x524f, 0x11ce, {0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}} },
+ { QVideoFrame::Format_RGB555, /*MEDIASUBTYPE_RGB555*/ {0xe436eb7c, 0x524f, 0x11ce, {0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}} },
+ { QVideoFrame::Format_AYUV444, /*MEDIASUBTYPE_AYUV*/ {0x56555941, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}} },
+ { QVideoFrame::Format_YUYV, /*MEDIASUBTYPE_YUY2*/ {0x32595559, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}} },
+ { QVideoFrame::Format_UYVY, /*MEDIASUBTYPE_UYVY*/ {0x59565955, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}} },
+ { QVideoFrame::Format_IMC1, /*MEDIASUBTYPE_IMC1*/ {0x31434D49, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}} },
+ { QVideoFrame::Format_IMC2, /*MEDIASUBTYPE_IMC2*/ {0x32434D49, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}} },
+ { QVideoFrame::Format_IMC3, /*MEDIASUBTYPE_IMC3*/ {0x33434D49, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}} },
+ { QVideoFrame::Format_IMC4, /*MEDIASUBTYPE_IMC4*/ {0x34434D49, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}} },
+ { QVideoFrame::Format_YV12, /*MEDIASUBTYPE_YV12*/ {0x32315659, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}} },
+ { QVideoFrame::Format_NV12, /*MEDIASUBTYPE_NV12*/ {0x3231564E, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}} },
+ { QVideoFrame::Format_YUV420P, /*MEDIASUBTYPE_IYUV*/ {0x56555949, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}} }
};
}
@@ -102,12 +102,16 @@ void DirectShowMediaType::freeData(AM_MEDIA_TYPE *type)
GUID DirectShowMediaType::convertPixelFormat(QVideoFrame::PixelFormat format)
{
+ // MEDIASUBTYPE_None;
+ static const GUID none = {
+ 0xe436eb8e, 0x524f, 0x11ce, {0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70} };
+
const int count = sizeof(qt_typeLookup) / sizeof(TypeLookup);
for (int i = 0; i < count; ++i)
if (qt_typeLookup[i].pixelFormat == format)
return qt_typeLookup[i].mediaType;
- return MEDIASUBTYPE_None;
+ return none;
}
QVideoSurfaceFormat DirectShowMediaType::formatFromType(const AM_MEDIA_TYPE &type)
diff --git a/src/plugins/mediaservices/directshow/mediaplayer/directshowmetadatacontrol.cpp b/src/plugins/mediaservices/directshow/mediaplayer/directshowmetadatacontrol.cpp
index 7b2552f..89821c4 100644
--- a/src/plugins/mediaservices/directshow/mediaplayer/directshowmetadatacontrol.cpp
+++ b/src/plugins/mediaservices/directshow/mediaplayer/directshowmetadatacontrol.cpp
@@ -297,7 +297,7 @@ QVariant DirectShowMetaDataControl::metaData(QtMultimedia::MetaData key) const
}
if (string) {
- value = QString::fromUtf16(string, ::SysStringLen(string));
+ value = QString::fromUtf16(reinterpret_cast<ushort *>(string), ::SysStringLen(string));
::SysFreeString(string);
}
@@ -344,7 +344,7 @@ void DirectShowMetaDataControl::updateGraph(IFilterGraph2 *graph, IBaseFilter *s
if (m_headerInfo)
m_headerInfo->Release();
- m_headerInfo = com_cast<IWMHeaderInfo>(source);
+ m_headerInfo = com_cast<IWMHeaderInfo>(source, IID_IWMHeaderInfo);
#endif
// DirectShowMediaPlayerService holds a lock at this point so defer emitting signals to a later
// time.
diff --git a/src/plugins/mediaservices/directshow/mediaplayer/directshowmetadatacontrol.h b/src/plugins/mediaservices/directshow/mediaplayer/directshowmetadatacontrol.h
index 966f9b8..9a81ba8 100644
--- a/src/plugins/mediaservices/directshow/mediaplayer/directshowmetadatacontrol.h
+++ b/src/plugins/mediaservices/directshow/mediaplayer/directshowmetadatacontrol.h
@@ -42,9 +42,10 @@
#ifndef DIRECTSHOWMETADATACONTROL_H
#define DIRECTSHOWMETADATACONTROL_H
+#include "directshowglobal.h"
+
#include <QtMultimedia/qmetadatacontrol.h>
-#include <dshow.h>
#include <qnetwork.h>
#ifndef QT_NO_WMSDK
diff --git a/src/plugins/mediaservices/directshow/mediaplayer/directshowplayercontrol.cpp b/src/plugins/mediaservices/directshow/mediaplayer/directshowplayercontrol.cpp
index b024557..bb7bac3 100644
--- a/src/plugins/mediaservices/directshow/mediaplayer/directshowplayercontrol.cpp
+++ b/src/plugins/mediaservices/directshow/mediaplayer/directshowplayercontrol.cpp
@@ -371,7 +371,7 @@ void DirectShowPlayerControl::updateAudioOutput(IBaseFilter *filter)
if (m_audio)
m_audio->Release();
- m_audio = com_cast<IBasicAudio>(filter);
+ m_audio = com_cast<IBasicAudio>(filter, IID_IBasicAudio);
}
void DirectShowPlayerControl::updateError(QMediaPlayer::Error error, const QString &errorString)
diff --git a/src/plugins/mediaservices/directshow/mediaplayer/directshowplayerservice.cpp b/src/plugins/mediaservices/directshow/mediaplayer/directshowplayerservice.cpp
index 57f4bec..317fa5c 100644
--- a/src/plugins/mediaservices/directshow/mediaplayer/directshowplayerservice.cpp
+++ b/src/plugins/mediaservices/directshow/mediaplayer/directshowplayerservice.cpp
@@ -56,8 +56,6 @@
#include <QtCore/qthread.h>
#include <QtCore/qvarlengtharray.h>
-#include <uuids.h>
-
Q_GLOBAL_STATIC(DirectShowEventLoop, qt_directShowEventLoop)
QT_BEGIN_NAMESPACE
@@ -80,11 +78,11 @@ private:
DirectShowPlayerService::DirectShowPlayerService(QObject *parent)
: QMediaService(parent)
, m_playerControl(0)
- , m_audioEndpointControl(0)
, m_metaDataControl(0)
, m_videoOutputControl(0)
, m_videoRendererControl(0)
, m_videoWindowControl(0)
+ , m_audioEndpointControl(0)
, m_taskThread(0)
, m_loop(qt_directShowEventLoop())
, m_pendingTasks(0)
@@ -203,9 +201,12 @@ void DirectShowPlayerService::load(const QMediaContent &media, QIODevice *stream
m_graphStatus = InvalidMedia;
m_error = QMediaPlayer::ResourceError;
} else {
+ // {36b73882-c2c8-11cf-8b46-00805f6cef60}
+ static const GUID iid_IFilterGraph2 = {
+ 0x36b73882, 0xc2c8, 0x11cf, {0x8b, 0x46, 0x00, 0x80, 0x5f, 0x6c, 0xef, 0x60} };
m_graphStatus = Loading;
- m_graph = com_new<IFilterGraph2>(CLSID_FilterGraph);
+ m_graph = com_new<IFilterGraph2>(CLSID_FilterGraph, iid_IFilterGraph2);
if (stream)
m_pendingTasks = SetStreamSource;
@@ -231,15 +232,22 @@ void DirectShowPlayerService::doSetUrlSource(QMutexLocker *locker)
HRESULT hr = E_FAIL;
-#ifndef QT_NO_WMSDK
if (url.scheme() == QLatin1String("http") || url.scheme() == QLatin1String("https")) {
- if (IFileSourceFilter *fileSource = com_new<IFileSourceFilter>(CLSID_WMAsfReader)) {
+ static const GUID clsid_WMAsfReader = {
+ 0x187463a0, 0x5bb7, 0x11d3, {0xac, 0xbe, 0x00, 0x80, 0xc7, 0x5e, 0x24, 0x6e} };
+
+ // {56a868a6-0ad4-11ce-b03a-0020af0ba770}
+ 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)) {
locker->unlock();
- hr = fileSource->Load(url.toString().utf16(), 0);
+ hr = fileSource->Load(reinterpret_cast<const OLECHAR *>(url.toString().utf16()), 0);
locker->relock();
if (SUCCEEDED(hr)) {
- source = com_cast<IBaseFilter>(fileSource);
+ source = com_cast<IBaseFilter>(fileSource, IID_IBaseFilter);
if (!SUCCEEDED(hr = m_graph->AddFilter(source, L"Source")) && source) {
source->Release();
@@ -259,13 +267,11 @@ void DirectShowPlayerService::doSetUrlSource(QMutexLocker *locker)
}
if (!SUCCEEDED(hr)) {
-#endif
locker->unlock();
- hr = m_graph->AddSourceFilter(url.toString().utf16(), L"Source", &source);
+ hr = m_graph->AddSourceFilter(
+ reinterpret_cast<const OLECHAR *>(url.toString().utf16()), L"Source", &source);
locker->relock();
-#ifndef QT_NO_WMSDK
}
-#endif
if (SUCCEEDED(hr)) {
m_executedTasks = SetSource;
@@ -299,7 +305,7 @@ void DirectShowPlayerService::doSetUrlSource(QMutexLocker *locker)
default:
m_error = QMediaPlayer::ResourceError;
m_errorString = QString();
- qWarning("DirectShowPlayerService::doSetUrlSource: Unresolved error code %x", hr);
+ qWarning("DirectShowPlayerService::doSetUrlSource: Unresolved error code %x", uint(hr));
break;
}
@@ -342,7 +348,7 @@ void DirectShowPlayerService::doRender(QMutexLocker *locker)
{
m_pendingTasks |= m_executedTasks & (Play | Pause);
- if (IMediaControl *control = com_cast<IMediaControl>(m_graph)) {
+ if (IMediaControl *control = com_cast<IMediaControl>(m_graph, IID_IMediaControl)) {
control->Stop();
control->Release();
}
@@ -393,7 +399,7 @@ void DirectShowPlayerService::doRender(QMutexLocker *locker)
locker->unlock();
HRESULT hr;
if (SUCCEEDED(hr = graph->RenderEx(
- pin, AM_RENDEREX_RENDERTOEXISTINGRENDERERS, 0))) {
+ pin, /*AM_RENDEREX_RENDERTOEXISTINGRENDERERS*/ 1, 0))) {
rendered = true;
} else if (renderHr == S_OK || renderHr == VFW_E_NO_DECOMPRESSOR){
renderHr = hr;
@@ -448,7 +454,7 @@ void DirectShowPlayerService::doRender(QMutexLocker *locker)
m_error = QMediaPlayer::ResourceError;
m_errorString = QString();
qWarning("DirectShowPlayerService::doRender: Unresolved error code %x",
- renderHr);
+ uint(renderHr));
}
}
@@ -462,11 +468,11 @@ void DirectShowPlayerService::doRender(QMutexLocker *locker)
void DirectShowPlayerService::doFinalizeLoad(QMutexLocker *locker)
{
if (m_graphStatus != Loaded) {
- if (IMediaEvent *event = com_cast<IMediaEvent>(m_graph)) {
+ if (IMediaEvent *event = com_cast<IMediaEvent>(m_graph, IID_IMediaEvent)) {
event->GetEventHandle(reinterpret_cast<OAEVENT *>(&m_eventHandle));
event->Release();
}
- if (IMediaSeeking *seeking = com_cast<IMediaSeeking>(m_graph)) {
+ if (IMediaSeeking *seeking = com_cast<IMediaSeeking>(m_graph, IID_IMediaSeeking)) {
LONGLONG duration = 0;
seeking->GetDuration(&duration);
m_duration = duration / 10;
@@ -496,7 +502,12 @@ void DirectShowPlayerService::releaseGraph()
{
if (m_graph) {
if (m_executingTask != 0) {
- if (IAMOpenProgress *progress = com_cast<IAMOpenProgress>(m_graph)) {
+ // {8E1C39A1-DE53-11cf-AA63-0080C744528D}
+ static const GUID iid_IAMOpenProgress = {
+ 0x8E1C39A1, 0xDE53, 0x11cf, {0xAA, 0x63, 0x00, 0x80, 0xC7, 0x44, 0x52, 0x8D} };
+
+ if (IAMOpenProgress *progress = com_cast<IAMOpenProgress>(
+ m_graph, iid_IAMOpenProgress)) {
progress->AbortOperation();
progress->Release();
}
@@ -515,7 +526,7 @@ void DirectShowPlayerService::doReleaseGraph(QMutexLocker *locker)
{
Q_UNUSED(locker);
- if (IMediaControl *control = com_cast<IMediaControl>(m_graph)) {
+ if (IMediaControl *control = com_cast<IMediaControl>(m_graph, IID_IMediaControl)) {
control->Stop();
control->Release();
}
@@ -630,7 +641,7 @@ void DirectShowPlayerService::play()
void DirectShowPlayerService::doPlay(QMutexLocker *locker)
{
- if (IMediaControl *control = com_cast<IMediaControl>(m_graph)) {
+ if (IMediaControl *control = com_cast<IMediaControl>(m_graph, IID_IMediaControl)) {
locker->unlock();
HRESULT hr = control->Run();
locker->relock();
@@ -644,7 +655,7 @@ void DirectShowPlayerService::doPlay(QMutexLocker *locker)
} else {
m_error = QMediaPlayer::ResourceError;
m_errorString = QString();
- qWarning("DirectShowPlayerService::doPlay: Unresolved error code %x", hr);
+ qWarning("DirectShowPlayerService::doPlay: Unresolved error code %x", uint(hr));
QCoreApplication::postEvent(this, new QEvent(QEvent::Type(Error)));
}
@@ -672,7 +683,7 @@ void DirectShowPlayerService::pause()
void DirectShowPlayerService::doPause(QMutexLocker *locker)
{
- if (IMediaControl *control = com_cast<IMediaControl>(m_graph)) {
+ if (IMediaControl *control = com_cast<IMediaControl>(m_graph, IID_IMediaControl)) {
locker->unlock();
HRESULT hr = control->Pause();
locker->relock();
@@ -680,7 +691,7 @@ void DirectShowPlayerService::doPause(QMutexLocker *locker)
control->Release();
if (SUCCEEDED(hr)) {
- if (IMediaSeeking *seeking = com_cast<IMediaSeeking>(m_graph)) {
+ if (IMediaSeeking *seeking = com_cast<IMediaSeeking>(m_graph, IID_IMediaSeeking)) {
LONGLONG position = 0;
seeking->GetCurrentPosition(&position);
@@ -697,7 +708,7 @@ void DirectShowPlayerService::doPause(QMutexLocker *locker)
} else {
m_error = QMediaPlayer::ResourceError;
m_errorString = QString();
- qWarning("DirectShowPlayerService::doPause: Unresolved error code %x", hr);
+ qWarning("DirectShowPlayerService::doPause: Unresolved error code %x", uint(hr));
QCoreApplication::postEvent(this, new QEvent(QEvent::Type(Error)));
}
@@ -723,12 +734,12 @@ void DirectShowPlayerService::stop()
void DirectShowPlayerService::doStop(QMutexLocker *locker)
{
if (m_executedTasks & (Play | Pause)) {
- if (IMediaControl *control = com_cast<IMediaControl>(m_graph)) {
+ if (IMediaControl *control = com_cast<IMediaControl>(m_graph, IID_IMediaControl)) {
control->Stop();
control->Release();
}
- if (IMediaSeeking *seeking = com_cast<IMediaSeeking>(m_graph)) {
+ if (IMediaSeeking *seeking = com_cast<IMediaSeeking>(m_graph, IID_IMediaSeeking)) {
LONGLONG position = 0;
seeking->GetCurrentPosition(&position);
@@ -763,7 +774,7 @@ void DirectShowPlayerService::setRate(qreal rate)
void DirectShowPlayerService::doSetRate(QMutexLocker *locker)
{
- if (IMediaSeeking *seeking = com_cast<IMediaSeeking>(m_graph)) {
+ if (IMediaSeeking *seeking = com_cast<IMediaSeeking>(m_graph, IID_IMediaSeeking)) {
// Cache current values as we can't query IMediaSeeking during a seek due to the
// possibility of a deadlock when flushing the VideoSurfaceFilter.
LONGLONG currentPosition = 0;
@@ -801,7 +812,7 @@ qint64 DirectShowPlayerService::position() const
if (m_graphStatus == Loaded) {
if (m_executingTask == Seek || m_executingTask == SetRate) {
return m_position;
- } else if (IMediaSeeking *seeking = com_cast<IMediaSeeking>(m_graph)) {
+ } else if (IMediaSeeking *seeking = com_cast<IMediaSeeking>(m_graph, IID_IMediaSeeking)) {
LONGLONG position = 0;
seeking->GetCurrentPosition(&position);
@@ -822,7 +833,7 @@ QMediaTimeRange DirectShowPlayerService::availablePlaybackRanges() const
if (m_graphStatus == Loaded) {
if (m_executingTask == Seek || m_executingTask == SetRate) {
return m_playbackRange;
- } else if (IMediaSeeking *seeking = com_cast<IMediaSeeking>(m_graph)) {
+ } else if (IMediaSeeking *seeking = com_cast<IMediaSeeking>(m_graph, IID_IMediaSeeking)) {
LONGLONG minimum = 0;
LONGLONG maximum = 0;
@@ -850,7 +861,7 @@ void DirectShowPlayerService::seek(qint64 position)
void DirectShowPlayerService::doSeek(QMutexLocker *locker)
{
- if (IMediaSeeking *seeking = com_cast<IMediaSeeking>(m_graph)) {
+ if (IMediaSeeking *seeking = com_cast<IMediaSeeking>(m_graph, IID_IMediaSeeking)) {
LONGLONG seekPosition = LONGLONG(m_position) * 10;
// Cache current values as we can't query IMediaSeeking during a seek due to the
@@ -886,7 +897,8 @@ int DirectShowPlayerService::bufferStatus() const
#ifndef QT_NO_WMSDK
QMutexLocker locker(const_cast<QMutex *>(&m_mutex));
- if (IWMReaderAdvanced2 *reader = com_cast<IWMReaderAdvanced2>(m_source)) {
+ if (IWMReaderAdvanced2 *reader = com_cast<IWMReaderAdvanced2>(
+ m_source, IID_IWMReaderAdvanced2)) {
DWORD percentage = 0;
reader->GetBufferProgress(&percentage, 0);
@@ -949,7 +961,7 @@ void DirectShowPlayerService::doReleaseAudioOutput(QMutexLocker *locker)
{
m_pendingTasks |= m_executedTasks & (Play | Pause);
- if (IMediaControl *control = com_cast<IMediaControl>(m_graph)) {
+ if (IMediaControl *control = com_cast<IMediaControl>(m_graph, IID_IMediaControl)) {
control->Stop();
control->Release();
}
@@ -960,7 +972,11 @@ void DirectShowPlayerService::doReleaseAudioOutput(QMutexLocker *locker)
decoder->AddRef();
}
- if (IFilterChain *chain = com_cast<IFilterChain>(m_graph)) {
+ // {DCFBDCF6-0DC2-45f5-9AB2-7C330EA09C29}
+ static const GUID iid_IFilterChain = {
+ 0xDCFBDCF6, 0x0DC2, 0x45f5, {0x9A, 0xB2, 0x7C, 0x33, 0x0E, 0xA0, 0x9C, 0x29} };
+
+ if (IFilterChain *chain = com_cast<IFilterChain>(m_graph, iid_IFilterChain)) {
chain->RemoveChain(decoder, m_audioOutput);
chain->Release();
} else {
@@ -1018,7 +1034,7 @@ void DirectShowPlayerService::doReleaseVideoOutput(QMutexLocker *locker)
{
m_pendingTasks |= m_executedTasks & (Play | Pause);
- if (IMediaControl *control = com_cast<IMediaControl>(m_graph)) {
+ if (IMediaControl *control = com_cast<IMediaControl>(m_graph, IID_IMediaControl)) {
control->Stop();
control->Release();
}
@@ -1035,7 +1051,11 @@ void DirectShowPlayerService::doReleaseVideoOutput(QMutexLocker *locker)
decoder->AddRef();
}
- if (IFilterChain *chain = com_cast<IFilterChain>(m_graph)) {
+ // {DCFBDCF6-0DC2-45f5-9AB2-7C330EA09C29}
+ static const GUID iid_IFilterChain = {
+ 0xDCFBDCF6, 0x0DC2, 0x45f5, {0x9A, 0xB2, 0x7C, 0x33, 0x0E, 0xA0, 0x9C, 0x29} };
+
+ if (IFilterChain *chain = com_cast<IFilterChain>(m_graph, iid_IFilterChain)) {
chain->RemoveChain(decoder, m_videoOutput);
chain->Release();
} else {
@@ -1118,7 +1138,7 @@ void DirectShowPlayerService::videoOutputChanged()
void DirectShowPlayerService::graphEvent(QMutexLocker *locker)
{
- if (IMediaEvent *event = com_cast<IMediaEvent>(m_graph)) {
+ if (IMediaEvent *event = com_cast<IMediaEvent>(m_graph, IID_IMediaEvent)) {
long eventCode;
LONG_PTR param1;
LONG_PTR param2;
@@ -1137,7 +1157,7 @@ void DirectShowPlayerService::graphEvent(QMutexLocker *locker)
m_buffering = false;
m_atEnd = true;
- if (IMediaSeeking *seeking = com_cast<IMediaSeeking>(m_graph)) {
+ if (IMediaSeeking *seeking = com_cast<IMediaSeeking>(m_graph, IID_IMediaSeeking)) {
LONGLONG position = 0;
seeking->GetCurrentPosition(&position);
@@ -1149,7 +1169,7 @@ void DirectShowPlayerService::graphEvent(QMutexLocker *locker)
QCoreApplication::postEvent(this, new QEvent(QEvent::Type(EndOfMedia)));
break;
case EC_LENGTH_CHANGED:
- if (IMediaSeeking *seeking = com_cast<IMediaSeeking>(m_graph)) {
+ if (IMediaSeeking *seeking = com_cast<IMediaSeeking>(m_graph, IID_IMediaSeeking)) {
LONGLONG duration = 0;
seeking->GetDuration(&duration);
m_duration = duration / 10;
diff --git a/src/plugins/mediaservices/directshow/mediaplayer/directshowplayerservice.h b/src/plugins/mediaservices/directshow/mediaplayer/directshowplayerservice.h
index a5da9a4..23515d0 100644
--- a/src/plugins/mediaservices/directshow/mediaplayer/directshowplayerservice.h
+++ b/src/plugins/mediaservices/directshow/mediaplayer/directshowplayerservice.h
@@ -57,7 +57,6 @@
#include <QtCore/private/qwineventnotifier_p.h>
-
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
diff --git a/src/plugins/mediaservices/directshow/mediaplayer/mediaplayer.pri b/src/plugins/mediaservices/directshow/mediaplayer/mediaplayer.pri
index a7adb38..99a1191 100644
--- a/src/plugins/mediaservices/directshow/mediaplayer/mediaplayer.pri
+++ b/src/plugins/mediaservices/directshow/mediaplayer/mediaplayer.pri
@@ -2,7 +2,7 @@ INCLUDEPATH += $$PWD
DEFINES += QMEDIA_DIRECTSHOW_PLAYER
-win32-g++: DEFINES += QT_NO_WMSDK
+!contains(QT_CONFIG, wmsdk): DEFINES += QT_NO_WMSDK
HEADERS += \
$$PWD/directshowaudioendpointcontrol.h \
diff --git a/src/plugins/mediaservices/directshow/mediaplayer/videosurfacefilter.cpp b/src/plugins/mediaservices/directshow/mediaplayer/videosurfacefilter.cpp
index 7b4aad5..a471c68 100644
--- a/src/plugins/mediaservices/directshow/mediaplayer/videosurfacefilter.cpp
+++ b/src/plugins/mediaservices/directshow/mediaplayer/videosurfacefilter.cpp
@@ -84,7 +84,11 @@ VideoSurfaceFilter::~VideoSurfaceFilter()
}
HRESULT VideoSurfaceFilter::QueryInterface(REFIID riid, void **ppvObject)
-{
+{
+ // 2dd74950-a890-11d1-abe8-00a0c905f375
+ static const GUID iid_IAmFilterMiscFlags = {
+ 0x2dd74950, 0xa890, 0x11d1, {0xab, 0xe8, 0x00, 0xa0, 0xc9, 0x05, 0xf3, 0x75} };
+
if (!ppvObject) {
return E_POINTER;
} else if (riid == IID_IUnknown
@@ -92,7 +96,7 @@ HRESULT VideoSurfaceFilter::QueryInterface(REFIID riid, void **ppvObject)
|| riid == IID_IMediaFilter
|| riid == IID_IBaseFilter) {
*ppvObject = static_cast<IBaseFilter *>(this);
- } else if (riid == IID_IAMFilterMiscFlags) {
+ } else if (riid == iid_IAmFilterMiscFlags) {
*ppvObject = static_cast<IAMFilterMiscFlags *>(this);
} else if (riid == IID_IPin) {
*ppvObject = static_cast<IPin *>(this);
@@ -446,7 +450,7 @@ HRESULT VideoSurfaceFilter::EndOfStream()
QMutexLocker locker(&m_mutex);
if (!m_sampleScheduler.scheduleEndOfStream()) {
- if (IMediaEventSink *sink = com_cast<IMediaEventSink>(m_graph)) {
+ if (IMediaEventSink *sink = com_cast<IMediaEventSink>(m_graph, IID_IMediaEventSink)) {
sink->Notify(
EC_COMPLETE,
S_OK,
@@ -570,6 +574,10 @@ void VideoSurfaceFilter::supportedFormatsChanged()
{
QMutexLocker locker(&m_mutex);
+ // MEDIASUBTYPE_None;
+ static const GUID none = {
+ 0xe436eb8e, 0x524f, 0x11ce, {0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70} };
+
QList<QVideoFrame::PixelFormat> formats = m_surface->supportedPixelFormats();
QVector<AM_MEDIA_TYPE> mediaTypes;
@@ -588,7 +596,7 @@ void VideoSurfaceFilter::supportedFormatsChanged()
foreach (QVideoFrame::PixelFormat format, formats) {
type.subtype = DirectShowMediaType::convertPixelFormat(format);
- if (type.subtype != MEDIASUBTYPE_None)
+ if (type.subtype != none)
mediaTypes.append(type);
}
@@ -610,7 +618,7 @@ void VideoSurfaceFilter::sampleReady()
sample->Release();
if (eos) {
- if (IMediaEventSink *sink = com_cast<IMediaEventSink>(m_graph)) {
+ if (IMediaEventSink *sink = com_cast<IMediaEventSink>(m_graph, IID_IMediaEventSink)) {
sink->Notify(
EC_COMPLETE,
S_OK,
diff --git a/src/plugins/mediaservices/directshow/mediaplayer/videosurfacefilter.h b/src/plugins/mediaservices/directshow/mediaplayer/videosurfacefilter.h
index 8f3a101..0607fd3 100644
--- a/src/plugins/mediaservices/directshow/mediaplayer/videosurfacefilter.h
+++ b/src/plugins/mediaservices/directshow/mediaplayer/videosurfacefilter.h
@@ -41,6 +41,7 @@
#ifndef VIDEOSURFACEFILTER_H
#define VIDEOSURFACEFILTER_H
+#include "directshowglobal.h"
#include "directshowmediatypelist.h"
#include "directshowsamplescheduler.h"
#include "directshowmediatype.h"
@@ -52,9 +53,6 @@
#include <QtCore/qstring.h>
#include <QtCore/qwaitcondition.h>
-#include <dshow.h>
-
-
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
diff --git a/src/plugins/mediaservices/directshow/mediaplayer/vmr9videowindowcontrol.cpp b/src/plugins/mediaservices/directshow/mediaplayer/vmr9videowindowcontrol.cpp
index a564e14..b1ddd98 100644
--- a/src/plugins/mediaservices/directshow/mediaplayer/vmr9videowindowcontrol.cpp
+++ b/src/plugins/mediaservices/directshow/mediaplayer/vmr9videowindowcontrol.cpp
@@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE
Vmr9VideoWindowControl::Vmr9VideoWindowControl(QObject *parent)
: QVideoWindowControl(parent)
- , m_filter(com_new<IBaseFilter>(CLSID_VideoMixingRenderer9))
+ , m_filter(com_new<IBaseFilter>(CLSID_VideoMixingRenderer9, IID_IBaseFilter))
, m_windowId(0)
, m_dirtyValues(0)
, m_brightness(0)
@@ -57,7 +57,7 @@ Vmr9VideoWindowControl::Vmr9VideoWindowControl(QObject *parent)
, m_saturation(0)
, m_fullScreen(false)
{
- if (IVMRFilterConfig9 *config = com_cast<IVMRFilterConfig9>(m_filter)) {
+ if (IVMRFilterConfig9 *config = com_cast<IVMRFilterConfig9>(m_filter, IID_IVMRFilterConfig9)) {
config->SetRenderingMode(VMR9Mode_Windowless);
config->SetNumberOfStreams(1);
config->Release();
@@ -81,7 +81,8 @@ void Vmr9VideoWindowControl::setWinId(WId id)
{
m_windowId = id;
- if (IVMRWindowlessControl9 *control = com_cast<IVMRWindowlessControl9>(m_filter)) {
+ if (IVMRWindowlessControl9 *control = com_cast<IVMRWindowlessControl9>(
+ m_filter, IID_IVMRWindowlessControl9)) {
control->SetVideoClippingWindow(m_windowId);
control->Release();
}
@@ -91,7 +92,8 @@ QRect Vmr9VideoWindowControl::displayRect() const
{
QRect rect;
- if (IVMRWindowlessControl9 *control = com_cast<IVMRWindowlessControl9>(m_filter)) {
+ if (IVMRWindowlessControl9 *control = com_cast<IVMRWindowlessControl9>(
+ m_filter, IID_IVMRWindowlessControl9)) {
RECT sourceRect;
RECT displayRect;
@@ -109,7 +111,8 @@ QRect Vmr9VideoWindowControl::displayRect() const
void Vmr9VideoWindowControl::setDisplayRect(const QRect &rect)
{
- if (IVMRWindowlessControl9 *control = com_cast<IVMRWindowlessControl9>(m_filter)) {
+ if (IVMRWindowlessControl9 *control = com_cast<IVMRWindowlessControl9>(
+ m_filter, IID_IVMRWindowlessControl9)) {
RECT sourceRect = { 0, 0, 0, 0 };
RECT displayRect = { rect.left(), rect.top(), rect.right(), rect.bottom() };
@@ -134,7 +137,8 @@ void Vmr9VideoWindowControl::repaint()
if (QWidget *widget = QWidget::find(m_windowId)) {
HDC dc = widget->getDC();
- if (IVMRWindowlessControl9 *control = com_cast<IVMRWindowlessControl9>(m_filter)) {
+ if (IVMRWindowlessControl9 *control = com_cast<IVMRWindowlessControl9>(
+ m_filter, IID_IVMRWindowlessControl9)) {
control->RepaintVideo(m_windowId, dc);
control->Release();
}
@@ -146,7 +150,8 @@ QSize Vmr9VideoWindowControl::nativeSize() const
{
QSize size;
- if (IVMRWindowlessControl9 *control = com_cast<IVMRWindowlessControl9>(m_filter)) {
+ if (IVMRWindowlessControl9 *control = com_cast<IVMRWindowlessControl9>(
+ m_filter, IID_IVMRWindowlessControl9)) {
LONG width;
LONG height;
@@ -161,7 +166,8 @@ QVideoWidget::AspectRatioMode Vmr9VideoWindowControl::aspectRatioMode() const
{
QVideoWidget::AspectRatioMode mode = QVideoWidget::KeepAspectRatio;
- if (IVMRWindowlessControl9 *control = com_cast<IVMRWindowlessControl9>(m_filter)) {
+ if (IVMRWindowlessControl9 *control = com_cast<IVMRWindowlessControl9>(
+ m_filter, IID_IVMRWindowlessControl9)) {
DWORD arMode;
if (control->GetAspectRatioMode(&arMode) == S_OK && arMode == VMR9ARMode_None)
@@ -173,7 +179,8 @@ QVideoWidget::AspectRatioMode Vmr9VideoWindowControl::aspectRatioMode() const
void Vmr9VideoWindowControl::setAspectRatioMode(QVideoWidget::AspectRatioMode mode)
{
- if (IVMRWindowlessControl9 *control = com_cast<IVMRWindowlessControl9>(m_filter)) {
+ if (IVMRWindowlessControl9 *control = com_cast<IVMRWindowlessControl9>(
+ m_filter, IID_IVMRWindowlessControl9)) {
switch (mode) {
case QVideoWidget::IgnoreAspectRatio:
control->SetAspectRatioMode(VMR9ARMode_None);
@@ -254,7 +261,7 @@ void Vmr9VideoWindowControl::setSaturation(int saturation)
void Vmr9VideoWindowControl::setProcAmpValues()
{
- if (IVMRMixerControl9 *control = com_cast<IVMRMixerControl9>(m_filter)) {
+ if (IVMRMixerControl9 *control = com_cast<IVMRMixerControl9>(m_filter, IID_IVMRMixerControl9)) {
VMR9ProcAmpControl procAmp;
procAmp.dwSize = sizeof(VMR9ProcAmpControl);
procAmp.dwFlags = m_dirtyValues;