Implement D3D11VA video rendering

This commit is contained in:
Cameron Gutman
2022-02-04 21:51:34 -06:00
parent 67612f607e
commit f256407789
8 changed files with 362 additions and 35 deletions
+10 -1
View File
@@ -17,6 +17,7 @@ public:
virtual ~D3D11VARenderer() override;
virtual bool initialize(PDECODER_PARAMETERS params) override;
virtual bool prepareDecoderContext(AVCodecContext* context, AVDictionary**) override;
virtual bool prepareDecoderContextInGetFormat(AVCodecContext* context, AVPixelFormat pixelFormat) override;
virtual void renderFrame(AVFrame* frame) override;
virtual void notifyOverlayUpdated(Overlay::OverlayType) override;
virtual void setHdrMode(bool enabled) override;
@@ -28,6 +29,8 @@ private:
bool setupRenderingResources();
void renderOverlay(Overlay::OverlayType type);
void updateColorConversionConstants(AVFrame* frame);
void renderVideo(AVFrame* frame);
bool checkDecoderSupport(IDXGIAdapter* adapter);
IDXGIFactory5* m_Factory;
@@ -41,10 +44,15 @@ private:
int m_DisplayWidth;
int m_DisplayHeight;
bool m_Windowed;
AVColorSpace m_LastColorSpace;
AVColorRange m_LastColorRange;
bool m_AllowTearing;
HANDLE m_FrameWaitableObject;
ID3D11PixelShader* m_VideoPixelShader;
ID3D11Buffer* m_VideoVertexBuffer;
ID3D11Buffer* m_VideoConstantBuffer;
SDL_SpinLock m_OverlayLock;
ID3D11Buffer* m_OverlayVertexBuffers[Overlay::OverlayMax];
@@ -52,6 +60,7 @@ private:
ID3D11ShaderResourceView* m_OverlayTextureResourceViews[Overlay::OverlayMax];
ID3D11PixelShader* m_OverlayPixelShader;
AVBufferRef* m_HwContext;
AVBufferRef* m_HwDeviceContext;
AVBufferRef* m_HwFramesContext;
};