winrt: Introduce DirectX pipeline bypass.
Qt Windows Runtime camera uses DirectVideo to convert NV12 format texture to BGRA format texture. As the EGL Node can draw using NV12 already, allow video render control to choose which path to take. By default use DirectVideo. Bypass can be used as fallback when DirectVideo cannot be used or is not working. Task-Id: QTBUG-48331 Change-Id: I0cb87a7c4523bfb60610e6b41ab3fb05aff092a1 Reviewed-by: Andrew Knight <andrew.knight@intopalo.com>
This commit is contained in:
@@ -40,6 +40,8 @@
|
||||
#include <QtMultimedia/QVideoRendererControl>
|
||||
#include <QtMultimedia/QVideoSurfaceFormat>
|
||||
|
||||
#include <qt_windows.h>
|
||||
|
||||
struct ID3D11Device;
|
||||
struct ID3D11Texture2D;
|
||||
|
||||
@@ -53,6 +55,11 @@ public:
|
||||
explicit QWinRTAbstractVideoRendererControl(const QSize &size, QObject *parent = 0);
|
||||
~QWinRTAbstractVideoRendererControl();
|
||||
|
||||
enum BlitMode {
|
||||
DirectVideo,
|
||||
MediaFoundation
|
||||
};
|
||||
|
||||
QAbstractVideoSurface *surface() const Q_DECL_OVERRIDE;
|
||||
void setSurface(QAbstractVideoSurface *surface) Q_DECL_OVERRIDE;
|
||||
|
||||
@@ -63,7 +70,11 @@ public:
|
||||
|
||||
void setActive(bool active);
|
||||
|
||||
BlitMode blitMode() const;
|
||||
void setBlitMode(BlitMode mode);
|
||||
|
||||
virtual bool render(ID3D11Texture2D *texture) = 0;
|
||||
virtual bool dequeueFrame(QVideoFrame *frame);
|
||||
|
||||
static ID3D11Device *d3dDevice();
|
||||
|
||||
@@ -74,12 +85,29 @@ private slots:
|
||||
void syncAndRender();
|
||||
|
||||
private:
|
||||
void textureToFrame();
|
||||
Q_INVOKABLE void present();
|
||||
|
||||
QScopedPointer<QWinRTAbstractVideoRendererControlPrivate> d_ptr;
|
||||
Q_DECLARE_PRIVATE(QWinRTAbstractVideoRendererControl)
|
||||
};
|
||||
|
||||
class CriticalSectionLocker
|
||||
{
|
||||
public:
|
||||
CriticalSectionLocker(CRITICAL_SECTION *section)
|
||||
: m_section(section)
|
||||
{
|
||||
EnterCriticalSection(m_section);
|
||||
}
|
||||
~CriticalSectionLocker()
|
||||
{
|
||||
LeaveCriticalSection(m_section);
|
||||
}
|
||||
private:
|
||||
CRITICAL_SECTION *m_section;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QWINRTABSTRACTVIDEORENDERERCONTROL_H
|
||||
|
||||
Reference in New Issue
Block a user