From e0fd84d6f50ed4290787654e13a678dabef2bff3 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sat, 29 Jan 2022 00:28:46 -0600 Subject: [PATCH] Fix build with old libdrm headers --- app/streaming/video/ffmpeg-renderers/drm.cpp | 3 +- app/streaming/video/ffmpeg-renderers/drm.h | 36 ++++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/app/streaming/video/ffmpeg-renderers/drm.cpp b/app/streaming/video/ffmpeg-renderers/drm.cpp index 48bb49f4..8c8feb34 100644 --- a/app/streaming/video/ffmpeg-renderers/drm.cpp +++ b/app/streaming/video/ffmpeg-renderers/drm.cpp @@ -370,7 +370,8 @@ bool DrmRenderer::initialize(PDECODER_PARAMETERS params) // If we have an HDR output metadata property, construct the metadata blob // to apply when we are called to enter HDR mode. if (m_HdrOutputMetadataProp != nullptr) { - struct hdr_output_metadata outputMetadata; + DrmDefs::hdr_output_metadata outputMetadata; + outputMetadata.metadata_type = 0; // HDMI_STATIC_METADATA_TYPE1 outputMetadata.hdmi_metadata_type1.eotf = params->hdrMetadata.eotf; outputMetadata.hdmi_metadata_type1.metadata_type = params->hdrMetadata.staticMetadataDescriptorId; diff --git a/app/streaming/video/ffmpeg-renderers/drm.h b/app/streaming/video/ffmpeg-renderers/drm.h index 9bcedb50..104175ca 100644 --- a/app/streaming/video/ffmpeg-renderers/drm.h +++ b/app/streaming/video/ffmpeg-renderers/drm.h @@ -5,6 +5,42 @@ #include #include +// Newer libdrm headers have these HDR structs, but some older ones don't. +namespace DrmDefs +{ + // HDR structs is copied from linux include/linux/hdmi.h + struct hdr_metadata_infoframe + { + uint8_t eotf; + uint8_t metadata_type; + + struct + { + uint16_t x, y; + } display_primaries[3]; + + struct + { + uint16_t x, y; + } white_point; + + uint16_t max_display_mastering_luminance; + uint16_t min_display_mastering_luminance; + + uint16_t max_cll; + uint16_t max_fall; + }; + + struct hdr_output_metadata + { + uint32_t metadata_type; + + union { + struct hdr_metadata_infoframe hdmi_metadata_type1; + }; + }; +} + class DrmRenderer : public IFFmpegRenderer { public: DrmRenderer();