[vlc-commits] direct3d11: only set the vd->fmt once

Steve Lhomme git at videolan.org
Wed Aug 1 13:03:52 CEST 2018


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Aug  1 13:03:18 2018 +0200| [5801f7cda364930c27886ab3b50505389fed9ec5] | committer: Steve Lhomme

direct3d11: only set the vd->fmt once

And use video_format_Copy() since it may contain the palette of vd->source.

It also needs a video_format_Clean() before because it was originally set
using video_format_Copy() of vd->source in the core in VoutValidateFormat().

Fixes #20487

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

 modules/video_output/win32/direct3d11.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index f15991cba2..c11005482a 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -1220,8 +1220,7 @@ static int Direct3D11Open(vout_display_t *vd)
 
     D3D11SetColorSpace(vd);
 
-    video_format_t fmt;
-    video_format_Copy(&fmt, &vd->source);
+    video_format_t fmt = vd->source;
     int err = SetupOutputFormat(vd, &fmt);
     if (err != VLC_SUCCESS)
     {
@@ -1253,9 +1252,6 @@ static int Direct3D11Open(vout_display_t *vd)
         return VLC_EGENERIC;
     }
 
-    video_format_Clean(&vd->fmt);
-    vd->fmt = fmt;
-
     return VLC_SUCCESS;
 }
 
@@ -1329,7 +1325,8 @@ static int SetupOutputFormat(vout_display_t *vd, video_format_t *fmt)
         Direct3D11DestroyResources(vd);
         return VLC_EGENERIC;
     }
-    vd->fmt = *fmt;
+    video_format_Clean(&vd->fmt);
+    video_format_Copy(&vd->fmt, fmt);
 
     return VLC_SUCCESS;
 }



More information about the vlc-commits mailing list