vlc | branch: master | Steve Lhomme <rob...@ycbcr.xyz> | Wed Mar 25 11:40:53 
2020 +0100| [1a78a1296b92aaae3366cd68cb6caa9a7bfa9cd1] | committer: Steve Lhomme

direct3d11: only send HDR metadata when we don't tone map the source

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1a78a1296b92aaae3366cd68cb6caa9a7bfa9cd1
---

 modules/video_output/win32/d3d11_swapchain.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/modules/video_output/win32/d3d11_swapchain.c 
b/modules/video_output/win32/d3d11_swapchain.c
index aee680445d..894032db1a 100644
--- a/modules/video_output/win32/d3d11_swapchain.c
+++ b/modules/video_output/win32/d3d11_swapchain.c
@@ -80,6 +80,7 @@ struct d3d11_local_swapchain
 #endif /* !VLC_WINSTORE_APP */
     IDXGISwapChain1        *dxgiswapChain;   /* DXGI 1.2 swap chain */
     IDXGISwapChain4        *dxgiswapChain4;  /* DXGI 1.5 for HDR metadata */
+    bool                    send_metadata;
     DXGI_HDR_METADATA_HDR10 hdr10;
 
     ID3D11RenderTargetView *swapchainTargetView[D3D11_MAX_RENDER_TARGET];
@@ -234,6 +235,9 @@ static void SelectSwapchainColorspace(struct 
d3d11_local_swapchain *display, con
         msg_Err(display->obj, "Failed to set colorspace %s. (hr=0x%lX)", 
color_spaces[best].name, hr);
 done:
     display->colorspace = &color_spaces[best];
+    display->send_metadata = color_spaces[best].transfer == 
(video_transfer_func_t) cfg->transfer &&
+                             color_spaces[best].primaries == 
(video_color_primaries_t) cfg->primaries &&
+                             color_spaces[best].color == (video_color_space_t) 
cfg->colorspace;
     if (dxgiswapChain3)
         IDXGISwapChain3_Release(dxgiswapChain3);
 }
@@ -516,7 +520,8 @@ void LocalSwapchainSetMetadata( void *opaque, 
libvlc_video_metadata_type_t type,
     struct d3d11_local_swapchain *display = opaque;
 
     assert(type == libvlc_video_metadata_frame_hdr10);
-    if (type == libvlc_video_metadata_frame_hdr10 && metadata && 
display->dxgiswapChain4)
+    if ( type == libvlc_video_metadata_frame_hdr10 && metadata &&
+         display->send_metadata && display->dxgiswapChain4 )
     {
         const libvlc_video_frame_hdr10_metadata_t *p_hdr10 = metadata;
         DXGI_HDR_METADATA_HDR10 hdr10 = { 0 };

_______________________________________________
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to