mirror of
https://github.com/moonlight-stream/moonlight-qt
synced 2024-12-13 21:02:28 +00:00
Add reference frame invalidation for the software decoder
This commit is contained in:
parent
55f0e1e1d5
commit
9be9934b8c
14 changed files with 46 additions and 0 deletions
|
@ -19,6 +19,7 @@ public:
|
|||
int frameRate,
|
||||
bool enableVsync) = 0;
|
||||
virtual bool isHardwareAccelerated() = 0;
|
||||
virtual int getDecoderCapabilities() = 0;
|
||||
virtual int submitDecodeUnit(PDECODE_UNIT du) = 0;
|
||||
virtual void renderFrame(SDL_UserEvent* event) = 0;
|
||||
virtual void dropFrame(SDL_UserEvent* event) = 0;
|
||||
|
|
|
@ -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]);
|
||||
|
|
|
@ -24,6 +24,7 @@ public:
|
|||
virtual bool prepareDecoderContext(AVCodecContext* context);
|
||||
virtual void renderFrameAtVsync(AVFrame* frame);
|
||||
virtual bool needsTestFrame();
|
||||
virtual int getDecoderCapabilities();
|
||||
|
||||
private:
|
||||
bool initializeDecoder();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -149,6 +149,12 @@ VAAPIRenderer::needsTestFrame()
|
|||
return true;
|
||||
}
|
||||
|
||||
int
|
||||
VAAPIRenderer::getDecoderCapabilities()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
VAAPIRenderer::renderFrameAtVsync(AVFrame* frame)
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -230,6 +230,11 @@ bool VDPAURenderer::needsTestFrame()
|
|||
return true;
|
||||
}
|
||||
|
||||
int VDPAURenderer::getDecoderCapabilities()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void VDPAURenderer::renderFrameAtVsync(AVFrame* frame)
|
||||
{
|
||||
VdpStatus status;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -196,6 +196,11 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
virtual int getDecoderCapabilities() override
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
private:
|
||||
void setupDisplayLayer()
|
||||
{
|
||||
|
|
|
@ -27,6 +27,11 @@ bool FFmpegVideoDecoder::isHardwareAccelerated()
|
|||
return m_HwDecodeCfg != nullptr;
|
||||
}
|
||||
|
||||
int FFmpegVideoDecoder::getDecoderCapabilities()
|
||||
{
|
||||
return m_Renderer->getDecoderCapabilities();
|
||||
}
|
||||
|
||||
enum AVPixelFormat FFmpegVideoDecoder::ffGetFormat(AVCodecContext* context,
|
||||
const enum AVPixelFormat* pixFmts)
|
||||
{
|
||||
|
|
|
@ -20,6 +20,7 @@ public:
|
|||
int maxFps,
|
||||
bool enableVsync) override;
|
||||
virtual bool isHardwareAccelerated() override;
|
||||
virtual int getDecoderCapabilities() override;
|
||||
virtual int submitDecodeUnit(PDECODE_UNIT du) override;
|
||||
virtual void renderFrame(SDL_UserEvent* event) override;
|
||||
virtual void dropFrame(SDL_UserEvent* event) override;
|
||||
|
|
|
@ -25,6 +25,12 @@ SLVideoDecoder::isHardwareAccelerated()
|
|||
return true;
|
||||
}
|
||||
|
||||
int
|
||||
SLVideoDecoder::getDecoderCapabilities()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool
|
||||
SLVideoDecoder::initialize(StreamingPreferences::VideoDecoderSelection vds,
|
||||
SDL_Window*,
|
||||
|
|
|
@ -17,6 +17,7 @@ public:
|
|||
int frameRate,
|
||||
bool enableVsync);
|
||||
virtual bool isHardwareAccelerated();
|
||||
virtual int getDecoderCapabilities();
|
||||
virtual int submitDecodeUnit(PDECODE_UNIT du);
|
||||
|
||||
// Unused since rendering is done directly from the decode thread
|
||||
|
|
Loading…
Reference in a new issue