mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-06-17 06:01:12 +00:00
Always request AV_PIX_FMT_DRM_PRIME to ensure we get it if available
This commit is contained in:
@@ -464,18 +464,16 @@ bool DrmRenderer::initialize(PDECODER_PARAMETERS params)
|
|||||||
enum AVPixelFormat DrmRenderer::getPreferredPixelFormat(int videoFormat)
|
enum AVPixelFormat DrmRenderer::getPreferredPixelFormat(int videoFormat)
|
||||||
{
|
{
|
||||||
// DRM PRIME buffers, or whatever the backend renderer wants
|
// DRM PRIME buffers, or whatever the backend renderer wants
|
||||||
if (m_HwAccelBackend) {
|
if (m_BackendRenderer != nullptr) {
|
||||||
return AV_PIX_FMT_DRM_PRIME;
|
|
||||||
}
|
|
||||||
else if (m_BackendRenderer != nullptr) {
|
|
||||||
// Unlike isPixelFormatSupported(), we always return the format
|
|
||||||
// requested by the backend renderer since it's used for setting
|
|
||||||
// up the AVCodecContext.
|
|
||||||
return m_BackendRenderer->getPreferredPixelFormat(videoFormat);
|
return m_BackendRenderer->getPreferredPixelFormat(videoFormat);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// If we're acting as a non-hwaccel renderer, we'll ask for NV12 or P010
|
// We must return this pixel format to ensure it's used with
|
||||||
return (videoFormat & VIDEO_FORMAT_MASK_10BIT) ? AV_PIX_FMT_P010 : AV_PIX_FMT_NV12;
|
// v4l2m2m decoders that go through non-hwaccel format selection.
|
||||||
|
//
|
||||||
|
// For non-hwaccel decoders that don't support DRM PRIME, ffGetFormat()
|
||||||
|
// will call isPixelFormatSupported() and pick a supported swformat.
|
||||||
|
return AV_PIX_FMT_DRM_PRIME;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -490,6 +488,7 @@ bool DrmRenderer::isPixelFormatSupported(int videoFormat, AVPixelFormat pixelFor
|
|||||||
// If we're going to need to map this as a software frame, check
|
// If we're going to need to map this as a software frame, check
|
||||||
// against the set of formats we support in mapSoftwareFrame().
|
// against the set of formats we support in mapSoftwareFrame().
|
||||||
switch (pixelFormat) {
|
switch (pixelFormat) {
|
||||||
|
case AV_PIX_FMT_DRM_PRIME:
|
||||||
case AV_PIX_FMT_NV12:
|
case AV_PIX_FMT_NV12:
|
||||||
case AV_PIX_FMT_NV21:
|
case AV_PIX_FMT_NV21:
|
||||||
case AV_PIX_FMT_P010:
|
case AV_PIX_FMT_P010:
|
||||||
|
|||||||
Reference in New Issue
Block a user