<html><head></head><body>Hi,<br><br>I don't know if it's better handled as a separate callback. I do have a problem with tying the API to HDR10 though.<br><br><div class="gmail_quote">Le 5 février 2020 14:16:58 GMT+02:00, Steve Lhomme <robux4@ycbcr.xyz> a écrit :<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<pre class="k9mail">On 2020-02-04 19:50, Rémi Denis-Courmont wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;">Le tiistaina 4. helmikuuta 2020, 17.25.56 EET Steve Lhomme a écrit :<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #ad7fa8; padding-left: 1ex;"> Just like with D3D11, it should theoretically be possible to send the HDR10<br> metadata of the frame we're about to display over HDMI.<br><br> We should get this information as early as possible to prepare the tone<br> mapping we will use for rendering.<hr>   doc/libvlc/QtGL/qtvlcwidget.cpp   |  2 +-<br>   doc/libvlc/sdl_opengl_player.cpp  |  2 +-<br>   include/vlc/libvlc_media_player.h | 33 ++++++++++++++++---------------<br>   modules/video_output/vgl.c        |  4 ++--<br>   4 files changed, 21 insertions(+), 20 deletions(-)<br><br> diff --git a/doc/libvlc/QtGL/qtvlcwidget.cpp<br> b/doc/libvlc/QtGL/qtvlcwidget.cpp index a9abeccc167..7c1eee7a43b 100644<br> --- a/doc/libvlc/QtGL/qtvlcwidget.cpp<br> +++ b/doc/libvlc/QtGL/qtvlcwidget.cpp<br> @@ -93,7 +93,7 @@ public:<br>       }<br><br>       // This callback is called to set the OpenGL context<br> -    static bool make_current(void* data, bool current)<br> +    static bool make_current(void* data, bool current, const<br> libvlc_video_frame_hdr10_metadata_t *hdr10) {<br>           VLCVideo* that = static_cast<VLCVideo*>(data);<br>           if (current)<br> diff --git a/doc/libvlc/sdl_opengl_player.cpp<br> b/doc/libvlc/sdl_opengl_player.cpp index d34b99b2682..903f0fefb3c 100644<br> --- a/doc/libvlc/sdl_opengl_player.cpp<br> +++ b/doc/libvlc/sdl_opengl_player.cpp<br> @@ -182,7 +182,7 @@ public:<br>       }<br><br>       // This callback is called to set the OpenGL context<br> -    static bool make_current(void* data, bool current)<br> +    static bool make_current(void* data, bool current, const<br> libvlc_video_frame_hdr10_metadata_t *hdr10) {<br>           VLCVideo* that = static_cast<VLCVideo*>(data);<br>           if (current)<br> diff --git a/include/vlc/libvlc_media_player.h<br> b/include/vlc/libvlc_media_player.h index 7c72c9774b2..02ca8b5fd54 100644<br> --- a/include/vlc/libvlc_media_player.h<br> +++ b/include/vlc/libvlc_media_player.h<br> @@ -540,15 +540,29 @@ typedef void (*libvlc_video_update_output_cb)(void*<br> opaque, unsigned width, unsi */<br>   typedef void (*libvlc_video_swap_cb)(void* opaque);<br><br> +typedef struct<br> +{<br> +    /* similar to SMPTE ST 2086 mastering display color volume */<br> +    uint16_t RedPrimary[2];<br> +    uint16_t GreenPrimary[2];<br> +    uint16_t BluePrimary[2];<br> +    uint16_t WhitePoint[2];<br> +    unsigned int MaxMasteringLuminance;<br> +    unsigned int MinMasteringLuminance;<br> +    uint16_t MaxContentLightLevel;<br> +    uint16_t MaxFrameAverageLightLevel;<br> +} libvlc_video_frame_hdr10_metadata_t;<br> +<br>   /**<br>    * Callback prototype to set up the OpenGL context for rendering<br>    *<br>    * \param opaque private pointer passed to the @a<br> libvlc_video_set_output_callbacks() [IN] * \param enter true to set the<br> context as current, false to unset it [IN] + * \param hdr10<br> libvlc_video_frame_hdr10_metadata_t* or NULL [IN] * \return true on success<br>    * \version LibVLC 4.0.0 or later<br>    */<br> -typedef bool (*libvlc_video_makeCurrent_cb)(void* opaque, bool enter);<br> +typedef bool (*libvlc_video_makeCurrent_cb)(void* opaque, bool enter, const<br> libvlc_video_frame_hdr10_metadata_t *hdr10);<br></blockquote>That seems way too specific to current generation / too inextensible, to fit in<br>the generic make_current callback...<br></blockquote><br>I can add an extra callback to be called when the rendering is about to <br>start. It will only be called by the D3D11 output for now. And those who <br>don't want to receive the data can also not set the callback.<br><br>As for extensibility, I suppose passing the structure with an ID of the <br>type+version of the structure could help. Either passing all structures <br>in a table of {type, structure*} or passing then one by one. I prefer <br>the latter.<br><br>>><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;"><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #ad7fa8; padding-left: 1ex;">   /**<br>    * Callback prototype to load opengl functions<br> @@ -712,24 +726,11 @@ typedef bool( *libvlc_video_direct3d_update_output_cb<br> )( void *opaque, const libvlc_video_direct3d_cfg_t *cfg,<br> libvlc_video_output_cfg_t *output );<br><br> -typedef struct<br> -{<br> -    /* similar to SMPTE ST 2086 mastering display color volume */<br> -    uint16_t RedPrimary[2];<br> -    uint16_t GreenPrimary[2];<br> -    uint16_t BluePrimary[2];<br> -    uint16_t WhitePoint[2];<br> -    unsigned int MaxMasteringLuminance;<br> -    unsigned int MinMasteringLuminance;<br> -    uint16_t MaxContentLightLevel;<br> -    uint16_t MaxFrameAverageLightLevel;<br> -} libvlc_video_direct3d_hdr10_metadata_t;<br> -<br>   /** Tell the host the rendering is about to start/has finished.<br>    *<br>    * \param opaque private pointer set on the opaque parameter of @a<br> libvlc_video_direct3d_device_setup_cb() [IN] * \param enter true if the<br> rendering is about to start, false if it's finished - * \param hdr10<br> libvlc_video_direct3d_hdr10_metadata_t* or NULL [IN] + * \param hdr10<br> libvlc_video_frame_hdr10_metadata_t* or NULL [IN] * \return true on success<br>    * \version LibVLC 4.0.0 or later<br>    *<br> @@ -748,7 +749,7 @@ typedef struct<br>    * - RSSetViewports()<br>    * - DrawIndexed()<br>    */<br> -typedef bool( *libvlc_video_direct3d_start_end_rendering_cb )( void<br> *opaque, bool enter, const libvlc_video_direct3d_hdr10_metadata_t *hdr10 );<br> +typedef bool( *libvlc_video_direct3d_start_end_rendering_cb )( void<br> *opaque, bool enter, const libvlc_video_frame_hdr10_metadata_t *hdr10 );<br><br>   /** Tell the host the rendering for the given plane is about to start<br>    *<br> diff --git a/modules/video_output/vgl.c b/modules/video_output/vgl.c<br> index d880f1a5ff5..9f550e53c13 100644<br> --- a/modules/video_output/vgl.c<br> +++ b/modules/video_output/vgl.c<br> @@ -58,14 +58,14 @@ static void *OurGetProcAddress(vlc_gl_t *gl, const char<br> *name) static int MakeCurrent(vlc_gl_t *gl)<br>   {<br>       vout_display_sys_t *sys = gl->sys;<br> -    bool success = sys->makeCurrentCb(sys->opaque, true);<br> +    bool success = sys->makeCurrentCb(sys->opaque, true, NULL);<br>       return success ? VLC_SUCCESS : VLC_EGENERIC;<br>   }<br><br>   static void ReleaseCurrent(vlc_gl_t *gl)<br>   {<br>       vout_display_sys_t *sys = gl->sys;<br> -    sys->makeCurrentCb(sys->opaque, false);<br> +    sys->makeCurrentCb(sys->opaque, false, NULL);<br>   }<br><br>   static void VglSwapBuffers(vlc_gl_t *gl)<br></blockquote><br>-- <br>Реми Дёни-Курмон<br><a href="http://www.remlab.net/">http://www.remlab.net/</a><hr>vlc-devel mailing list<br>To unsubscribe or modify your subscription options:<br><a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a><br><br></blockquote><hr>vlc-devel mailing list<br>To unsubscribe or modify your subscription options:<br><a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a></pre></blockquote></div><br>-- <br>Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.</body></html>