[vlc-devel] [PATCH 7/9] direct3d11: use a fallback chroma when default doesn't work and vout is forced

Steve Lhomme robux4 at videolabs.io
Tue Nov 28 11:19:24 CET 2017


---
 modules/video_output/win32/direct3d11.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index da9e5b778c..aee028fbc7 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -1480,7 +1480,24 @@ static int Direct3D11Open(vout_display_t *vd)
     video_format_Copy(&fmt, &vd->source);
     int err = SetupOutputFormat(vd, &fmt);
     if (err != VLC_SUCCESS)
-        return err;
+    {
+        if (!is_d3d11_opaque(vd->source.i_chroma) && vd->obj.force )
+        {
+            const vlc_fourcc_t *list = vlc_fourcc_IsYUV(vd->source.i_chroma) ?
+                        vlc_fourcc_GetYUVFallback(vd->source.i_chroma) :
+                        vlc_fourcc_GetRGBFallback(vd->source.i_chroma);
+            for (unsigned i = 0; list[i] != 0; i++) {
+                fmt.i_chroma = list[i];
+                if (fmt.i_chroma == vd->source.i_chroma)
+                    continue;
+                err = SetupOutputFormat(vd, &fmt);
+                if (err == VLC_SUCCESS)
+                    break;
+            }
+        }
+        if (err != VLC_SUCCESS)
+            return err;
+    }
 
     if (Direct3D11CreateGenericResources(vd)) {
         msg_Err(vd, "Failed to allocate resources");
-- 
2.14.2



More information about the vlc-devel mailing list