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>
This commit is contained in:
committed by
Yoann Lopes
parent
3198bf4944
commit
77c9ab4a38
@@ -3,4 +3,4 @@ CONFIG += console
|
||||
|
||||
SOURCES += main.cpp
|
||||
|
||||
LIBS += -lstrmiids -ldmoguids -luuid -lmsdmo -lole32 -loleaut32
|
||||
!wince: LIBS += -lstrmiids -ldmoguids -luuid -lmsdmo -lole32 -loleaut32
|
||||
|
||||
@@ -32,8 +32,10 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <dshow.h>
|
||||
#ifndef _WIN32_WCE
|
||||
#include <d3d9.h>
|
||||
#include <vmr9.h>
|
||||
#endif
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
|
||||
@@ -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 \
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -34,6 +34,8 @@
|
||||
#ifndef DIRECTSHOWMETADATACONTROL_H
|
||||
#define DIRECTSHOWMETADATACONTROL_H
|
||||
|
||||
#include <dshow.h>
|
||||
|
||||
#include <qmetadatareadercontrol.h>
|
||||
|
||||
#include "directshowglobal.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
|
||||
{
|
||||
|
||||
@@ -31,6 +31,8 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include <dshow.h>
|
||||
|
||||
#include "directshowplayercontrol.h"
|
||||
|
||||
#include "directshowplayerservice.h"
|
||||
|
||||
@@ -34,6 +34,8 @@
|
||||
#ifndef DIRECTSHOWPLAYERCONTROL_H
|
||||
#define DIRECTSHOWPLAYERCONTROL_H
|
||||
|
||||
#include <dshow.h>
|
||||
|
||||
#include "qmediacontent.h"
|
||||
#include "qmediaplayercontrol.h"
|
||||
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -34,10 +34,10 @@
|
||||
#ifndef DIRECTSHOWVIDEORENDERERCONTROL_H
|
||||
#define DIRECTSHOWVIDEORENDERERCONTROL_H
|
||||
|
||||
#include "qvideorenderercontrol.h"
|
||||
|
||||
#include <dshow.h>
|
||||
|
||||
#include "qvideorenderercontrol.h"
|
||||
|
||||
class DirectShowEventLoop;
|
||||
|
||||
QT_USE_NAMESPACE
|
||||
|
||||
@@ -34,10 +34,10 @@
|
||||
#ifndef MEDIASAMPLEVIDEOBUFFER_H
|
||||
#define MEDIASAMPLEVIDEOBUFFER_H
|
||||
|
||||
#include <qabstractvideobuffer.h>
|
||||
|
||||
#include <dshow.h>
|
||||
|
||||
#include <qabstractvideobuffer.h>
|
||||
|
||||
class MediaSampleVideoBuffer : public QAbstractVideoBuffer
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user