summaryrefslogtreecommitdiffstats
path: root/src/plugins/common/evr/evrcustompresenter.h
diff options
context:
space:
mode:
authorYoann Lopes <yoann.lopes@theqtcompany.com>2015-11-27 11:56:50 +0100
committerYoann Lopes <yoann.lopes@theqtcompany.com>2016-01-12 15:51:32 +0000
commitc7397523e77578cf8f09ba3258791f68c34e2e5f (patch)
tree9c293c768038f74564d411cd27cff5ce22ed46ac /src/plugins/common/evr/evrcustompresenter.h
parent36549dbe148055d6ecf98952b05b4ff2310fe491 (diff)
Windows: Improve EVR presenter.
Removed hard dependency to Angle; it's now required only when rendering to a texture. If Angle is not used, the buffers are now mappable to system memory. This enables HW-accelerated video decoding in QML for non-ANGLE builds. Note that the frame data have to do a round-trip through system memory, which is not ideal but still faster than SW decoding. Task-number: QTBUG-45593 Change-Id: Icc3503142df4e8dbb53b4e11f409b161fd2f9bde Reviewed-by: Christian Stromme <christian.stromme@theqtcompany.com>
Diffstat (limited to 'src/plugins/common/evr/evrcustompresenter.h')
-rw-r--r--src/plugins/common/evr/evrcustompresenter.h40
1 files changed, 27 insertions, 13 deletions
diff --git a/src/plugins/common/evr/evrcustompresenter.h b/src/plugins/common/evr/evrcustompresenter.h
index b9067d9ae..e25780140 100644
--- a/src/plugins/common/evr/evrcustompresenter.h
+++ b/src/plugins/common/evr/evrcustompresenter.h
@@ -37,13 +37,19 @@
#include <QObject>
#include <qmutex.h>
#include <qqueue.h>
+#include <qevent.h>
+#include <qvideosurfaceformat.h>
#include "evrdefs.h"
+QT_BEGIN_NAMESPACE
+class QAbstractVideoSurface;
+QT_END_NAMESPACE
+
QT_USE_NAMESPACE
+class EVRCustomPresenter;
class D3DPresentEngine;
-class QAbstractVideoSurface;
template<class T>
class AsyncCallback : public IMFAsyncCallback
@@ -108,13 +114,9 @@ public:
Flush = WM_USER + 2
};
- Scheduler();
+ Scheduler(EVRCustomPresenter *presenter);
~Scheduler();
- void setCallback(QObject *cb) {
- m_CB = cb;
- }
-
void setFrameRate(const MFRatio &fps);
void setClockRate(float rate) { m_playbackRate = rate; }
@@ -135,10 +137,11 @@ public:
private:
DWORD schedulerThreadProcPrivate();
+ EVRCustomPresenter *m_presenter;
+
QQueue<IMFSample*> m_scheduledSamples; // Samples waiting to be presented.
IMFClock *m_clock; // Presentation clock. Can be NULL.
- QObject *m_CB; // Weak reference; do not delete.
DWORD m_threadID;
HANDLE m_schedulerThread;
@@ -181,8 +184,6 @@ class EVRCustomPresenter
, public IMFGetService
, public IMFTopologyServiceLookupClient
{
- Q_OBJECT
-
public:
// Defines the state of the presenter.
enum RenderState
@@ -203,9 +204,18 @@ public:
FrameStepComplete // Sample was rendered.
};
- EVRCustomPresenter();
+ enum PresenterEvents
+ {
+ StartSurface = QEvent::User,
+ StopSurface = QEvent::User + 1,
+ PresentSample = QEvent::User + 2
+ };
+
+ EVRCustomPresenter(QAbstractVideoSurface *surface = 0);
~EVRCustomPresenter();
+ bool isValid() const;
+
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void ** ppv);
STDMETHODIMP_(ULONG) AddRef();
@@ -240,9 +250,11 @@ public:
void supportedFormatsChanged();
void setSurface(QAbstractVideoSurface *surface);
-private Q_SLOTS:
void startSurface();
void stopSurface();
+ void presentSample(IMFSample *sample);
+
+ bool event(QEvent *);
private:
HRESULT checkShutdown() const
@@ -342,7 +354,7 @@ private:
MFVideoNormalizedRect m_sourceRect;
float m_playbackRate;
- D3DPresentEngine *m_D3DPresentEngine; // Rendering engine. (Never null if the constructor succeeds.)
+ D3DPresentEngine *m_presentEngine; // Rendering engine. (Never null if the constructor succeeds.)
IMFClock *m_clock; // The EVR's clock.
IMFTransform *m_mixer; // The EVR's mixer.
@@ -350,7 +362,9 @@ private:
IMFMediaType *m_mediaType; // Output media type
QAbstractVideoSurface *m_surface;
- QList<DWORD> m_supportedGLFormats;
+ bool m_canRenderToSurface;
+
+ IMFSample *m_sampleToPresent;
};
bool qt_evr_setCustomPresenter(IUnknown *evr, EVRCustomPresenter *presenter);