mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-08-30 05:51:01 +00:00
Allow NV12 and NV21 to be selected for non-hwaccel decoders using the SDL renderer
This commit is contained in:
@@ -62,6 +62,11 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
virtual bool isPixelFormatSupported(int videoFormat, enum AVPixelFormat pixelFormat) {
|
||||
// By default, we only support the preferred pixel format
|
||||
return getPreferredPixelFormat(videoFormat) == pixelFormat;
|
||||
}
|
||||
|
||||
// IOverlayRenderer
|
||||
virtual void notifyOverlayUpdated(Overlay::OverlayType) override {
|
||||
// Nothing
|
||||
|
||||
@@ -127,6 +127,21 @@ bool SdlRenderer::isRenderThreadSupported()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SdlRenderer::isPixelFormatSupported(int, AVPixelFormat pixelFormat)
|
||||
{
|
||||
// Remember to keep this in sync with SdlRenderer::renderFrame()!
|
||||
switch (pixelFormat)
|
||||
{
|
||||
case AV_PIX_FMT_YUV420P:
|
||||
case AV_PIX_FMT_NV12:
|
||||
case AV_PIX_FMT_NV21:
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool SdlRenderer::initialize(PDECODER_PARAMETERS params)
|
||||
{
|
||||
Uint32 rendererFlags = SDL_RENDERER_ACCELERATED;
|
||||
@@ -271,6 +286,7 @@ void SdlRenderer::renderFrame(AVFrame* frame)
|
||||
if (m_Texture == nullptr) {
|
||||
Uint32 sdlFormat;
|
||||
|
||||
// Remember to keep this in sync with SdlRenderer::isPixelFormatSupported()!
|
||||
switch (frame->format)
|
||||
{
|
||||
case AV_PIX_FMT_YUV420P:
|
||||
|
||||
@@ -13,6 +13,7 @@ public:
|
||||
virtual void renderFrame(AVFrame* frame) override;
|
||||
virtual void notifyOverlayUpdated(Overlay::OverlayType) override;
|
||||
virtual bool isRenderThreadSupported() override;
|
||||
virtual bool isPixelFormatSupported(int videoFormat, enum AVPixelFormat pixelFormat) override;
|
||||
|
||||
private:
|
||||
void renderOverlay(Overlay::OverlayType type);
|
||||
|
||||
Reference in New Issue
Block a user