Display the HDR option if the platform has a decoder that supports it

This commit is contained in:
Cameron Gutman
2022-01-29 00:59:04 -06:00
parent e0fd84d6f5
commit 1cbdd0e675
10 changed files with 77 additions and 46 deletions
+1
View File
@@ -64,6 +64,7 @@ public:
virtual bool initialize(PDECODER_PARAMETERS params) = 0;
virtual bool isHardwareAccelerated() = 0;
virtual bool isAlwaysFullScreen() = 0;
virtual bool isHdrSupported() = 0;
virtual int getDecoderCapabilities() = 0;
virtual int getDecoderColorspace() = 0;
virtual QSize getDecoderMaxResolution() = 0;
+8 -1
View File
@@ -410,8 +410,15 @@ enum AVPixelFormat DrmRenderer::getPreferredPixelFormat(int)
int DrmRenderer::getRendererAttributes()
{
int attributes = 0;
// This renderer can only draw in full-screen
return RENDERER_ATTRIBUTE_FULLSCREEN_ONLY;
attributes |= RENDERER_ATTRIBUTE_FULLSCREEN_ONLY;
// This renderer supports HDR
attributes |= RENDERER_ATTRIBUTE_HDR_SUPPORT;
return attributes;
}
void DrmRenderer::setHdrMode(bool enabled)
@@ -90,6 +90,7 @@ private:
#define RENDERER_ATTRIBUTE_FULLSCREEN_ONLY 0x01
#define RENDERER_ATTRIBUTE_1080P_MAX 0x02
#define RENDERER_ATTRIBUTE_HDR_SUPPORT 0x04
class IFFmpegRenderer : public Overlay::IOverlayRenderer {
public:
@@ -505,6 +505,12 @@ public:
return COLORSPACE_REC_601;
}
int getRendererAttributes() override
{
// AVSampleBufferDisplayLayer supports HDR output
return RENDERER_ATTRIBUTE_HDR_SUPPORT;
}
private:
AVBufferRef* m_HwContext;
AVSampleBufferDisplayLayer* m_DisplayLayer;
+5
View File
@@ -57,6 +57,11 @@ bool FFmpegVideoDecoder::isAlwaysFullScreen()
return m_FrontendRenderer->getRendererAttributes() & RENDERER_ATTRIBUTE_FULLSCREEN_ONLY;
}
bool FFmpegVideoDecoder::isHdrSupported()
{
return m_FrontendRenderer->getRendererAttributes() & RENDERER_ATTRIBUTE_HDR_SUPPORT;
}
void FFmpegVideoDecoder::setHdrMode(bool enabled)
{
m_FrontendRenderer->setHdrMode(enabled);
+1
View File
@@ -18,6 +18,7 @@ public:
virtual bool initialize(PDECODER_PARAMETERS params) override;
virtual bool isHardwareAccelerated() override;
virtual bool isAlwaysFullScreen() override;
virtual bool isHdrSupported() override;
virtual int getDecoderCapabilities() override;
virtual int getDecoderColorspace() override;
virtual QSize getDecoderMaxResolution() override;
+12 -9
View File
@@ -9,19 +9,22 @@ class SLVideoDecoder : public IVideoDecoder
public:
SLVideoDecoder(bool testOnly);
virtual ~SLVideoDecoder();
virtual bool initialize(PDECODER_PARAMETERS params);
virtual bool isHardwareAccelerated();
virtual bool isAlwaysFullScreen();
virtual int getDecoderCapabilities();
virtual int getDecoderColorspace();
virtual QSize getDecoderMaxResolution();
virtual int submitDecodeUnit(PDECODE_UNIT du);
virtual bool initialize(PDECODER_PARAMETERS params) override;
virtual bool isHardwareAccelerated() override;
virtual bool isAlwaysFullScreen() override;
virtual int getDecoderCapabilities() override;
virtual int getDecoderColorspace() override;
virtual QSize getDecoderMaxResolution() override;
virtual int submitDecodeUnit(PDECODE_UNIT du) override;
// Unused since rendering is done directly from the decode thread
virtual void renderFrameOnMainThread() {}
virtual void renderFrameOnMainThread() override {}
// HDR is not supported by SLVideo
virtual void setHdrMode(bool) {}
virtual void setHdrMode(bool) override {}
virtual bool isHdrSupported() override {
return false;
}
private:
static void slLogCallback(void* context, ESLVideoLog logLevel, const char* message);