diff options
author | Andreas Holzammer <andreas.holzammer@kdab.com> | 2016-03-09 11:28:00 +0100 |
---|---|---|
committer | Yoann Lopes <yoann.lopes@theqtcompany.com> | 2016-03-09 12:09:49 +0000 |
commit | 77c9ab4a3871110c6fb569c4e7b17181867c17ad (patch) | |
tree | d4a7513b5ed2db2a1ce6a60dde84b27974037b4c /src/plugins/directshow | |
parent | 3198bf4944edd8f25996c2b4c4516f606165af59 (diff) | |
download | qtmultimedia-77c9ab4a3871110c6fb569c4e7b17181867c17ad.tar.gz |
Port DirectShow backend to wince
dshow.h needs to be included before Qt headers as they include the
windows header with NOMINMAX macro set. DirectShow header needs min/max
macro definition to compile. The min/max macro then conflicts with
QDateTime header, hence needs to be undefined again for some occasions.
Windows Embedded Compact then defines INTERFACE as macro, which conflicts.
Windows Embedded Compact does not support audio end point selection.
Feature has been disabled for this platform.
Windows Embedded Compact does not support setting meta data, control has
been disabled.
Windows Embedded Compact does not support VMR, feature was disabled.
Direct Show renders always top to buttom.
Change-Id: Id17700835e2105fb127b12e3448bea16e3b52546
Reviewed-by: Yoann Lopes <yoann.lopes@theqtcompany.com>
Diffstat (limited to 'src/plugins/directshow')
18 files changed, 97 insertions, 28 deletions
diff --git a/src/plugins/directshow/directshow.pro b/src/plugins/directshow/directshow.pro index 280b52619..117b02ade 100644 --- a/src/plugins/directshow/directshow.pro +++ b/src/plugins/directshow/directshow.pro @@ -13,7 +13,7 @@ SOURCES += dsserviceplugin.cpp mingw: DEFINES += NO_DSHOW_STRSAFE !config_wmf: include(player/player.pri) -include(camera/camera.pri) +!wince: include(camera/camera.pri) OTHER_FILES += \ directshow.json \ diff --git a/src/plugins/directshow/dsserviceplugin.cpp b/src/plugins/directshow/dsserviceplugin.cpp index 4af38b1cc..e889a651d 100644 --- a/src/plugins/directshow/dsserviceplugin.cpp +++ b/src/plugins/directshow/dsserviceplugin.cpp @@ -31,14 +31,16 @@ ** ****************************************************************************/ +#include <dshow.h> + #include <QtCore/qstring.h> #include <QtCore/qdebug.h> #include <QtCore/QFile> #include "dsserviceplugin.h" -#include "dsvideodevicecontrol.h" #ifdef QMEDIA_DIRECTSHOW_CAMERA +#include "dsvideodevicecontrol.h" #include <dshow.h> #include "dscameraservice.h" #endif diff --git a/src/plugins/directshow/player/directshowglobal.h b/src/plugins/directshow/player/directshowglobal.h index d8f1d1200..a563ed361 100644 --- a/src/plugins/directshow/player/directshowglobal.h +++ b/src/plugins/directshow/player/directshowglobal.h @@ -34,10 +34,10 @@ #ifndef DIRECTSHOWGLOBAL_H #define DIRECTSHOWGLOBAL_H -#include <QtCore/qglobal.h> - #include <dshow.h> +#include <QtCore/qglobal.h> + template <typename T> T *com_cast(IUnknown *unknown, const IID &iid) { T *iface = 0; @@ -112,6 +112,7 @@ DECLARE_INTERFACE_(IFileSourceFilter ,IUnknown) #ifndef __IAMOpenProgress_INTERFACE_DEFINED__ #define __IAMOpenProgress_INTERFACE_DEFINED__ +#undef INTERFACE #define INTERFACE IAMOpenProgress DECLARE_INTERFACE_(IAMOpenProgress ,IUnknown) { diff --git a/src/plugins/directshow/player/directshowioreader.h b/src/plugins/directshow/player/directshowioreader.h index dd66b3a3c..203ca759a 100644 --- a/src/plugins/directshow/player/directshowioreader.h +++ b/src/plugins/directshow/player/directshowioreader.h @@ -34,12 +34,12 @@ #ifndef DIRECTSHOWIOREADER_H #define DIRECTSHOWIOREADER_H +#include <dshow.h> + #include <QtCore/qmutex.h> #include <QtCore/qobject.h> #include <QtCore/qwaitcondition.h> -#include <dshow.h> - QT_BEGIN_NAMESPACE class QIODevice; QT_END_NAMESPACE diff --git a/src/plugins/directshow/player/directshowmediatype.cpp b/src/plugins/directshow/player/directshowmediatype.cpp index 1be641f41..fcb254fe9 100644 --- a/src/plugins/directshow/player/directshowmediatype.cpp +++ b/src/plugins/directshow/player/directshowmediatype.cpp @@ -192,9 +192,11 @@ QVideoSurfaceFormat::Direction DirectShowMediaType::scanLineDirection(QVideoFram case QVideoFrame::Format_BGR24: case QVideoFrame::Format_RGB565: case QVideoFrame::Format_RGB555: +#ifndef Q_OS_WINCE return bmiHeader.biHeight < 0 ? QVideoSurfaceFormat::TopToBottom : QVideoSurfaceFormat::BottomToTop; +#endif default: return QVideoSurfaceFormat::TopToBottom; } diff --git a/src/plugins/directshow/player/directshowmediatype.h b/src/plugins/directshow/player/directshowmediatype.h index 8d5e74f1f..5045ff600 100644 --- a/src/plugins/directshow/player/directshowmediatype.h +++ b/src/plugins/directshow/player/directshowmediatype.h @@ -34,9 +34,10 @@ #ifndef DIRECTSHOWMEDIATYPE_H #define DIRECTSHOWMEDIATYPE_H +#include <dshow.h> + #include <qvideosurfaceformat.h> -#include <dshow.h> #include <dvdmedia.h> class DirectShowMediaType : public AM_MEDIA_TYPE diff --git a/src/plugins/directshow/player/directshowmediatypelist.h b/src/plugins/directshow/player/directshowmediatypelist.h index 008293a1f..860334532 100644 --- a/src/plugins/directshow/player/directshowmediatypelist.h +++ b/src/plugins/directshow/player/directshowmediatypelist.h @@ -34,10 +34,10 @@ #ifndef DIRECTSHOWMEDIATYPELIST_H #define DIRECTSHOWMEDIATYPELIST_H -#include <QtCore/qvector.h> - #include <dshow.h> +#include <QtCore/qvector.h> + class DirectShowMediaTypeList : public IUnknown { public: diff --git a/src/plugins/directshow/player/directshowmetadatacontrol.cpp b/src/plugins/directshow/player/directshowmetadatacontrol.cpp index 5400ac8d4..c30320128 100644 --- a/src/plugins/directshow/player/directshowmetadatacontrol.cpp +++ b/src/plugins/directshow/player/directshowmetadatacontrol.cpp @@ -31,13 +31,20 @@ ** ****************************************************************************/ +#include <dshow.h> +#ifdef min +#undef min +#endif +#ifdef max +#undef max +#endif + #include <QtMultimedia/qmediametadata.h> #include <QtCore/qcoreapplication.h> #include <QSize> #include <qdatetime.h> #include <qimage.h> -#include <dshow.h> #include <initguid.h> #include <qnetwork.h> diff --git a/src/plugins/directshow/player/directshowmetadatacontrol.h b/src/plugins/directshow/player/directshowmetadatacontrol.h index 55504ba4b..fee305c1f 100644 --- a/src/plugins/directshow/player/directshowmetadatacontrol.h +++ b/src/plugins/directshow/player/directshowmetadatacontrol.h @@ -34,6 +34,8 @@ #ifndef DIRECTSHOWMETADATACONTROL_H #define DIRECTSHOWMETADATACONTROL_H +#include <dshow.h> + #include <qmetadatareadercontrol.h> #include "directshowglobal.h" diff --git a/src/plugins/directshow/player/directshowpinenum.h b/src/plugins/directshow/player/directshowpinenum.h index 3cc62e226..e3c5a4a67 100644 --- a/src/plugins/directshow/player/directshowpinenum.h +++ b/src/plugins/directshow/player/directshowpinenum.h @@ -34,9 +34,10 @@ #ifndef DIRECTSHOWPINENUM_H #define DIRECTSHOWPINENUM_H +#include <dshow.h> + #include <QtCore/qlist.h> -#include <dshow.h> class DirectShowPinEnum : public IEnumPins { diff --git a/src/plugins/directshow/player/directshowplayercontrol.cpp b/src/plugins/directshow/player/directshowplayercontrol.cpp index 3449c9270..ff3c9af52 100644 --- a/src/plugins/directshow/player/directshowplayercontrol.cpp +++ b/src/plugins/directshow/player/directshowplayercontrol.cpp @@ -31,6 +31,8 @@ ** ****************************************************************************/ +#include <dshow.h> + #include "directshowplayercontrol.h" #include "directshowplayerservice.h" diff --git a/src/plugins/directshow/player/directshowplayercontrol.h b/src/plugins/directshow/player/directshowplayercontrol.h index f67c4108b..f1f387c51 100644 --- a/src/plugins/directshow/player/directshowplayercontrol.h +++ b/src/plugins/directshow/player/directshowplayercontrol.h @@ -34,6 +34,8 @@ #ifndef DIRECTSHOWPLAYERCONTROL_H #define DIRECTSHOWPLAYERCONTROL_H +#include <dshow.h> + #include "qmediacontent.h" #include "qmediaplayercontrol.h" diff --git a/src/plugins/directshow/player/directshowplayerservice.cpp b/src/plugins/directshow/player/directshowplayerservice.cpp index 8e9e50cbf..73279accb 100644 --- a/src/plugins/directshow/player/directshowplayerservice.cpp +++ b/src/plugins/directshow/player/directshowplayerservice.cpp @@ -31,14 +31,25 @@ ** ****************************************************************************/ +#include <dshow.h> +#ifdef min +#undef min +#endif +#ifdef max +#undef max +#endif + #include "directshowplayerservice.h" +#ifndef Q_OS_WINCE #include "directshowaudioendpointcontrol.h" -#include "directshowiosource.h" #include "directshowmetadatacontrol.h" +#include "vmr9videowindowcontrol.h" +#endif +#include "directshowiosource.h" #include "directshowplayercontrol.h" #include "directshowvideorenderercontrol.h" -#include "vmr9videowindowcontrol.h" + #ifdef HAVE_EVR #include "directshowevrvideowindowcontrol.h" @@ -79,10 +90,14 @@ private: DirectShowPlayerService::DirectShowPlayerService(QObject *parent) : QMediaService(parent) , m_playerControl(0) +#ifndef Q_OS_WINCE , m_metaDataControl(0) +#endif , m_videoRendererControl(0) +#ifndef Q_OS_WINCE , m_videoWindowControl(0) , m_audioEndpointControl(0) +#endif , m_taskThread(0) , m_loop(qt_directShowEventLoop()) , m_pendingTasks(0) @@ -106,8 +121,10 @@ DirectShowPlayerService::DirectShowPlayerService(QObject *parent) , m_dontCacheNextSeekResult(false) { m_playerControl = new DirectShowPlayerControl(this); +#ifndef Q_OS_WINCE m_metaDataControl = new DirectShowMetaDataControl(this); m_audioEndpointControl = new DirectShowAudioEndpointControl(this); +#endif m_taskThread = new DirectShowPlayerServiceThread(this); m_taskThread->start(); @@ -138,10 +155,14 @@ DirectShowPlayerService::~DirectShowPlayerService() } delete m_playerControl; +#ifndef Q_OS_WINCE delete m_audioEndpointControl; delete m_metaDataControl; +#endif delete m_videoRendererControl; +#ifndef Q_OS_WINCE delete m_videoWindowControl; +#endif ::CloseHandle(m_taskHandle); } @@ -150,12 +171,18 @@ QMediaControl *DirectShowPlayerService::requestControl(const char *name) { if (qstrcmp(name, QMediaPlayerControl_iid) == 0) { return m_playerControl; +#ifndef Q_OS_WINCE } else if (qstrcmp(name, QAudioOutputSelectorControl_iid) == 0) { return m_audioEndpointControl; } else if (qstrcmp(name, QMetaDataReaderControl_iid) == 0) { return m_metaDataControl; +#endif } else if (qstrcmp(name, QVideoRendererControl_iid) == 0) { - if (!m_videoRendererControl && !m_videoWindowControl) { + if (!m_videoRendererControl +#ifndef Q_OS_WINCE + && !m_videoWindowControl +#endif + ){ m_videoRendererControl = new DirectShowVideoRendererControl(m_loop); connect(m_videoRendererControl, SIGNAL(filterChanged()), @@ -163,6 +190,7 @@ QMediaControl *DirectShowPlayerService::requestControl(const char *name) return m_videoRendererControl; } +#ifndef Q_OS_WINCE } else if (qstrcmp(name, QVideoWindowControl_iid) == 0) { if (!m_videoRendererControl && !m_videoWindowControl) { IBaseFilter *filter; @@ -185,6 +213,7 @@ QMediaControl *DirectShowPlayerService::requestControl(const char *name) return m_videoWindowControl; } +#endif } return 0; } @@ -200,12 +229,14 @@ void DirectShowPlayerService::releaseControl(QMediaControl *control) delete m_videoRendererControl; m_videoRendererControl = 0; +#ifndef Q_OS_WINCE } else if (control == m_videoWindowControl) { setVideoOutput(0); delete m_videoWindowControl; m_videoWindowControl = 0; +#endif } } @@ -231,7 +262,9 @@ void DirectShowPlayerService::load(const QMediaContent &media, QIODevice *stream m_seekable = false; m_atEnd = false; m_dontCacheNextSeekResult = false; +#ifndef Q_OS_WINCE m_metaDataControl->reset(); +#endif if (m_resources.isEmpty() && !stream) { m_pendingTasks = 0; @@ -1135,7 +1168,9 @@ void DirectShowPlayerService::customEvent(QEvent *event) QMutexLocker locker(&m_mutex); m_playerControl->updateMediaInfo(m_duration, m_streamTypes, m_seekable); +#ifndef Q_OS_WINCE m_metaDataControl->updateMetadata(m_graph, m_source, m_url.toString()); +#endif updateStatus(); } else if (event->type() == QEvent::Type(Error)) { diff --git a/src/plugins/directshow/player/directshowplayerservice.h b/src/plugins/directshow/player/directshowplayerservice.h index 4d3762f74..f02f2039f 100644 --- a/src/plugins/directshow/player/directshowplayerservice.h +++ b/src/plugins/directshow/player/directshowplayerservice.h @@ -34,6 +34,8 @@ #ifndef DIRECTSHOWPLAYERSERVICE_H #define DIRECTSHOWPLAYERSERVICE_H +#include <dshow.h> + #include "qmediaplayer.h" #include "qmediaresource.h" #include "qmediaservice.h" @@ -168,10 +170,14 @@ private: }; DirectShowPlayerControl *m_playerControl; +#ifndef Q_OS_WINCE DirectShowMetaDataControl *m_metaDataControl; +#endif DirectShowVideoRendererControl *m_videoRendererControl; +#ifndef Q_OS_WINCE QVideoWindowControl *m_videoWindowControl; DirectShowAudioEndpointControl *m_audioEndpointControl; +#endif QThread *m_taskThread; DirectShowEventLoop *m_loop; diff --git a/src/plugins/directshow/player/directshowsamplescheduler.h b/src/plugins/directshow/player/directshowsamplescheduler.h index f9ef372ec..ad2df794c 100644 --- a/src/plugins/directshow/player/directshowsamplescheduler.h +++ b/src/plugins/directshow/player/directshowsamplescheduler.h @@ -34,12 +34,12 @@ #ifndef DIRECTSHOWSAMPLESCHEDULER_H #define DIRECTSHOWSAMPLESCHEDULER_H +#include <dshow.h> + #include <QtCore/qmutex.h> #include <QtCore/qobject.h> #include <QtCore/qsemaphore.h> -#include <dshow.h> - class DirectShowTimedSample; class DirectShowSampleScheduler : public QObject, public IMemInputPin diff --git a/src/plugins/directshow/player/directshowvideorenderercontrol.h b/src/plugins/directshow/player/directshowvideorenderercontrol.h index 484fda263..d08d124ca 100644 --- a/src/plugins/directshow/player/directshowvideorenderercontrol.h +++ b/src/plugins/directshow/player/directshowvideorenderercontrol.h @@ -34,10 +34,10 @@ #ifndef DIRECTSHOWVIDEORENDERERCONTROL_H #define DIRECTSHOWVIDEORENDERERCONTROL_H -#include "qvideorenderercontrol.h" - #include <dshow.h> +#include "qvideorenderercontrol.h" + class DirectShowEventLoop; QT_USE_NAMESPACE diff --git a/src/plugins/directshow/player/mediasamplevideobuffer.h b/src/plugins/directshow/player/mediasamplevideobuffer.h index e38518571..60c4cb8b0 100644 --- a/src/plugins/directshow/player/mediasamplevideobuffer.h +++ b/src/plugins/directshow/player/mediasamplevideobuffer.h @@ -34,10 +34,10 @@ #ifndef MEDIASAMPLEVIDEOBUFFER_H #define MEDIASAMPLEVIDEOBUFFER_H -#include <qabstractvideobuffer.h> - #include <dshow.h> +#include <qabstractvideobuffer.h> + class MediaSampleVideoBuffer : public QAbstractVideoBuffer { public: diff --git a/src/plugins/directshow/player/player.pri b/src/plugins/directshow/player/player.pri index 5ecb912b2..c5fb8442a 100644 --- a/src/plugins/directshow/player/player.pri +++ b/src/plugins/directshow/player/player.pri @@ -1,45 +1,53 @@ INCLUDEPATH += $$PWD -LIBS += -lstrmiids -ldmoguids -luuid -lmsdmo -lole32 -loleaut32 -lgdi32 +LIBS += -lstrmiids -ldmoguids -luuid -lole32 -loleaut32 +!wince: LIBS += -lmsdmo -lgdi32 + qtHaveModule(widgets): QT += widgets DEFINES += QMEDIA_DIRECTSHOW_PLAYER HEADERS += \ - $$PWD/directshowaudioendpointcontrol.h \ $$PWD/directshoweventloop.h \ $$PWD/directshowglobal.h \ $$PWD/directshowioreader.h \ $$PWD/directshowiosource.h \ $$PWD/directshowmediatype.h \ $$PWD/directshowmediatypelist.h \ - $$PWD/directshowmetadatacontrol.h \ $$PWD/directshowpinenum.h \ $$PWD/directshowplayercontrol.h \ $$PWD/directshowplayerservice.h \ $$PWD/directshowsamplescheduler.h \ $$PWD/directshowvideorenderercontrol.h \ $$PWD/mediasamplevideobuffer.h \ - $$PWD/videosurfacefilter.h \ - $$PWD/vmr9videowindowcontrol.h + $$PWD/videosurfacefilter.h SOURCES += \ - $$PWD/directshowaudioendpointcontrol.cpp \ $$PWD/directshoweventloop.cpp \ $$PWD/directshowioreader.cpp \ $$PWD/directshowiosource.cpp \ $$PWD/directshowmediatype.cpp \ $$PWD/directshowmediatypelist.cpp \ - $$PWD/directshowmetadatacontrol.cpp \ $$PWD/directshowpinenum.cpp \ $$PWD/directshowplayercontrol.cpp \ $$PWD/directshowplayerservice.cpp \ $$PWD/directshowsamplescheduler.cpp \ $$PWD/directshowvideorenderercontrol.cpp \ $$PWD/mediasamplevideobuffer.cpp \ - $$PWD/videosurfacefilter.cpp \ + $$PWD/videosurfacefilter.cpp + +!wince { +HEADERS += \ + $$PWD/directshowaudioendpointcontrol.h \ + $$PWD/directshowmetadatacontrol.h \ + $$PWD/vmr9videowindowcontrol.h + +SOURCES += \ + $$PWD/directshowaudioendpointcontrol.cpp \ + $$PWD/directshowmetadatacontrol.cpp \ $$PWD/vmr9videowindowcontrol.cpp +} config_evr { DEFINES += HAVE_EVR |