[vlc-devel] [PATCH 4/4] direct3d11: always place the picture based on the quad source dimensions

Steve Lhomme robux4 at videolabs.io
Tue Aug 1 15:01:23 CEST 2017


They may not always be equal to the vd->fmt.
---
 modules/video_output/win32/direct3d11.c | 33 +++++++++++++++++++++++++++++----
 1 file changed, 29 insertions(+), 4 deletions(-)

diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 6a6ca49674..a975ca008a 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -1061,7 +1061,13 @@ static int Control(vout_display_t *vd, int query, va_list args)
     RECT before_dest_clipped = sys->sys.rect_dest_clipped;
     RECT before_dest         = sys->sys.rect_dest;
 
+    unsigned int i_outside_width  = vd->fmt.i_width;
+    unsigned int i_outside_height = vd->fmt.i_height;
+    vd->fmt.i_width  = sys->picQuad.i_width;
+    vd->fmt.i_height = sys->picQuad.i_height;
     int res = CommonControl( vd, query, args );
+    vd->fmt.i_width  = i_outside_width;
+    vd->fmt.i_height = i_outside_height;
 
     if (query == VOUT_DISPLAY_CHANGE_VIEWPOINT)
     {
@@ -1090,7 +1096,13 @@ static void Manage(vout_display_t *vd)
     RECT before_dest_clipped = sys->sys.rect_dest_clipped;
     RECT before_dest         = sys->sys.rect_dest;
 
+    unsigned int i_outside_width  = vd->fmt.i_width;
+    unsigned int i_outside_height = vd->fmt.i_height;
+    vd->fmt.i_width  = sys->picQuad.i_width;
+    vd->fmt.i_height = sys->picQuad.i_height;
     CommonManage(vd);
+    vd->fmt.i_width  = i_outside_width;
+    vd->fmt.i_height = i_outside_height;
 
     if (!RectEquals(&before_src_clipped, &sys->sys.rect_src_clipped) ||
         !RectEquals(&before_dest_clipped, &sys->sys.rect_dest_clipped) ||
@@ -1146,14 +1158,21 @@ static void Prepare(vout_display_t *vd, picture_t *picture, subpicture_t *subpic
             assert(p_sys->resourceView[0]!=NULL);
         }
 
-        if ( vd->fmt.i_height != texDesc.Height ||
-             vd->fmt.i_width != texDesc.Width )
+        if ( sys->picQuad.i_height != texDesc.Height ||
+             sys->picQuad.i_width != texDesc.Width )
         {
             /* the decoder produced different sizes than the vout, we need to
              * adjust the vertex */
-            vd->fmt.i_height = texDesc.Height;
-            vd->fmt.i_width = texDesc.Width;
+            sys->picQuad.i_height = texDesc.Height;
+            sys->picQuad.i_width = texDesc.Width;
+
+            unsigned int i_outside_width  = vd->fmt.i_width;
+            unsigned int i_outside_height = vd->fmt.i_height;
+            vd->fmt.i_width  = sys->picQuad.i_width;
+            vd->fmt.i_height = sys->picQuad.i_height;
             UpdateRects(vd, NULL, NULL, true);
+            vd->fmt.i_width  = i_outside_width;
+            vd->fmt.i_height = i_outside_height;
             UpdateSize(vd);
         }
     }
@@ -1635,7 +1654,13 @@ static int Direct3D11Open(vout_display_t *vd, video_format_t *fmt)
         sys->picQuad.i_height = (sys->picQuad.i_height + 0x01) & ~0x01;
     }
 
+    unsigned int i_outside_width  = vd->fmt.i_width;
+    unsigned int i_outside_height = vd->fmt.i_height;
+    vd->fmt.i_width  = sys->picQuad.i_width;
+    vd->fmt.i_height = sys->picQuad.i_height;
     UpdateRects(vd, NULL, NULL, true);
+    vd->fmt.i_width  = i_outside_width;
+    vd->fmt.i_height = i_outside_height;
 
 #if defined(HAVE_ID3D11VIDEODECODER)
     if( sys->context_lock != INVALID_HANDLE_VALUE )
-- 
2.12.1



More information about the vlc-devel mailing list