Add reference frame invalidation for the software decoder

This commit is contained in:
Cameron Gutman 2018-08-25 12:38:04 -07:00
commit 9be9934b8c
14 changed files with 46 additions and 0 deletions

View file

@ -619,6 +619,11 @@ bool DXVA2Renderer::needsTestFrame()
return false;
}
int DXVA2Renderer::getDecoderCapabilities()
{
return 0;
}
void DXVA2Renderer::renderFrameAtVsync(AVFrame *frame)
{
IDirect3DSurface9* surface = reinterpret_cast<IDirect3DSurface9*>(frame->data[3]);

View file

@ -24,6 +24,7 @@ public:
virtual bool prepareDecoderContext(AVCodecContext* context);
virtual void renderFrameAtVsync(AVFrame* frame);
virtual bool needsTestFrame();
virtual int getDecoderCapabilities();
private:
bool initializeDecoder();

View file

@ -18,6 +18,7 @@ public:
virtual bool prepareDecoderContext(AVCodecContext* context) = 0;
virtual void renderFrameAtVsync(AVFrame* frame) = 0;
virtual bool needsTestFrame() = 0;
virtual int getDecoderCapabilities() = 0;
};
class SdlRenderer : public IFFmpegRenderer {
@ -33,6 +34,7 @@ public:
virtual bool prepareDecoderContext(AVCodecContext* context);
virtual void renderFrameAtVsync(AVFrame* frame);
virtual bool needsTestFrame();
virtual int getDecoderCapabilities();
private:
SDL_Renderer* m_Renderer;

View file

@ -36,6 +36,12 @@ bool SdlRenderer::needsTestFrame()
return false;
}
int SdlRenderer::getDecoderCapabilities()
{
// The FFmpeg CPU decoder can handle reference frame invalidation
return CAPABILITY_REFERENCE_FRAME_INVALIDATION_AVC | CAPABILITY_REFERENCE_FRAME_INVALIDATION_HEVC;
}
bool SdlRenderer::initialize(SDL_Window* window,
int,
int width,

View file

@ -149,6 +149,12 @@ VAAPIRenderer::needsTestFrame()
return true;
}
int
VAAPIRenderer::getDecoderCapabilities()
{
return 0;
}
void
VAAPIRenderer::renderFrameAtVsync(AVFrame* frame)
{

View file

@ -39,6 +39,7 @@ public:
virtual bool prepareDecoderContext(AVCodecContext* context);
virtual void renderFrameAtVsync(AVFrame* frame);
virtual bool needsTestFrame();
virtual int getDecoderCapabilities();
private:
int m_WindowSystem;

View file

@ -230,6 +230,11 @@ bool VDPAURenderer::needsTestFrame()
return true;
}
int VDPAURenderer::getDecoderCapabilities()
{
return 0;
}
void VDPAURenderer::renderFrameAtVsync(AVFrame* frame)
{
VdpStatus status;

View file

@ -22,6 +22,7 @@ public:
virtual bool prepareDecoderContext(AVCodecContext* context);
virtual void renderFrameAtVsync(AVFrame* frame);
virtual bool needsTestFrame();
virtual int getDecoderCapabilities();
private:
uint32_t m_VideoWidth, m_VideoHeight;

View file

@ -196,6 +196,11 @@ public:
return false;
}
virtual int getDecoderCapabilities() override
{
return 0;
}
private:
void setupDisplayLayer()
{