[vlc-devel] [RFC 4/6] libvlc: add support for HDR10 metadata during the START_RENDERING

Steve Lhomme robux4 at ycbcr.xyz
Tue Apr 30 11:34:36 CEST 2019


---
 include/vlc/libvlc_media_player.h | 15 ++++++++++++++-
 lib/media_player.c                | 11 +++++++++++
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/include/vlc/libvlc_media_player.h b/include/vlc/libvlc_media_player.h
index b33e365358..faf92cb87c 100644
--- a/include/vlc/libvlc_media_player.h
+++ b/include/vlc/libvlc_media_player.h
@@ -626,6 +626,19 @@ typedef struct
 } libvlc_video_output_cfg_t;
 
 
+typedef struct
+{
+    /* similar to SMPTE ST 2086 mastering display color volume */
+    uint16_t RedPrimary[2];
+    uint16_t GreenPrimary[2];
+    uint16_t BluePrimary[2];
+    uint16_t WhitePoint[2];
+    unsigned int MaxMasteringLuminance;
+    unsigned int MinMasteringLuminance;
+    uint16_t MaxContentLightLevel;
+    uint16_t MaxFrameAverageLightLevel;
+} libvlc_video_hdr10_metadata_t;
+
 /**
  * List of control passed to the @a libvlc_video_control_cb callback
  */
@@ -668,7 +681,7 @@ typedef enum libvlc_video_callback_control_t {
 
     /** Tell the host the rendering is about to start.
      *
-     * \ref input ignored
+     * \ref input libvlc_video_hdr10_metadata_t* or NULL
      * \ref output ignored
      *
      * Between \ref LIBVLC_VIDEO_START_RENDERING and \ref LIBVLC_VIDEO_FINISHED_RENDERING
diff --git a/lib/media_player.c b/lib/media_player.c
index 32c6289222..24a7605e32 100644
--- a/lib/media_player.c
+++ b/lib/media_player.c
@@ -2127,3 +2127,14 @@ static_assert(libvlc_video_primaries_BT601_525 == COLOR_PRIMARIES_BT601_525 &&
               libvlc_video_primaries_DCI_P3    == COLOR_PRIMARIES_DCI_P3 &&
               libvlc_video_primaries_BT470_M   == COLOR_PRIMARIES_BT470_M
               , "libvlc video color primaries mismatch");
+
+static_assert(sizeof(vlc_video_hdr10_metadata_t) == sizeof(libvlc_video_hdr10_metadata_t) &&
+              offsetof(vlc_video_hdr10_metadata_t, RedPrimary)   == offsetof(libvlc_video_hdr10_metadata_t, RedPrimary) &&
+              offsetof(vlc_video_hdr10_metadata_t, GreenPrimary) == offsetof(libvlc_video_hdr10_metadata_t, GreenPrimary) &&
+              offsetof(vlc_video_hdr10_metadata_t, BluePrimary)  == offsetof(libvlc_video_hdr10_metadata_t, BluePrimary) &&
+              offsetof(vlc_video_hdr10_metadata_t, WhitePoint)    == offsetof(libvlc_video_hdr10_metadata_t, WhitePoint) &&
+              offsetof(vlc_video_hdr10_metadata_t, MaxMasteringLuminance) == offsetof(libvlc_video_hdr10_metadata_t, MaxMasteringLuminance) &&
+              offsetof(vlc_video_hdr10_metadata_t, MinMasteringLuminance) == offsetof(libvlc_video_hdr10_metadata_t, MinMasteringLuminance) &&
+              offsetof(vlc_video_hdr10_metadata_t, MaxContentLightLevel) == offsetof(libvlc_video_hdr10_metadata_t, MaxContentLightLevel) &&
+              offsetof(vlc_video_hdr10_metadata_t, MaxFrameAverageLightLevel)== offsetof(libvlc_video_hdr10_metadata_t, MaxFrameAverageLightLevel)
+              , "video surface hdr10 metadata mismatch");
-- 
2.17.1



More information about the vlc-devel mailing list