Allow NV12 and NV21 to be selected for non-hwaccel decoders using the SDL renderer
This commit is contained in:
parent
cede6ce8a9
commit
b9463b3c0e
5 changed files with 35 additions and 1 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue