18#ifndef D3DVIDEOWIDGET_H
19#define D3DVIDEOWIDGET_H
21#include "videowidget.h"
24#include <directxmath.h>
26class D3DVideoWidget :
public Mlt::VideoWidget
30 explicit D3DVideoWidget(QObject *parent =
nullptr);
31 virtual ~D3DVideoWidget();
34 virtual void initialize();
35 virtual void beforeRendering();
36 virtual void renderVideo();
39 enum Stage { VertexStage, FragmentStage };
40 void prepareShader(Stage stage);
41 QByteArray compileShader(Stage stage,
const QByteArray &source,
const QByteArray &entryPoint);
42 ID3D11ShaderResourceView *initTexture(
const void *p,
int width,
int height);
44 ID3D11Device *m_device =
nullptr;
45 ID3D11DeviceContext *m_context =
nullptr;
47 QByteArray m_vertEntryPoint;
49 QByteArray m_fragEntryPoint;
51 bool m_initialized =
false;
52 ID3D11Buffer *m_vbuf =
nullptr;
53 ID3D11Buffer *m_cbuf =
nullptr;
54 ID3D11VertexShader *m_vs =
nullptr;
55 ID3D11PixelShader *m_ps =
nullptr;
56 ID3D11InputLayout *m_inputLayout =
nullptr;
57 ID3D11RasterizerState *m_rastState =
nullptr;
58 ID3D11DepthStencilState *m_dsState =
nullptr;
59 ID3D11ShaderResourceView *m_texture[3] = {
nullptr,
nullptr,
nullptr};
66 ConstantBuffer m_constants;