[vlc-commits] vout:win32: move the decoder+display pool in respective modules

Steve Lhomme git at videolan.org
Tue Feb 26 09:14:00 CET 2019


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue Feb 26 08:50:55 2019 +0100| [98e5b6d8f5eea548abbbd7fa2a3c84949cb5efcd] | committer: Steve Lhomme

vout:win32: move the decoder+display pool in respective modules

There's no generic pool for all win32 modules anymore, only the D3D zero copy
ones and the OpenGL one.

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

 modules/video_output/win32/common.h     |  1 -
 modules/video_output/win32/direct3d11.c | 19 ++++++++++---------
 modules/video_output/win32/direct3d9.c  | 18 ++++++++++--------
 modules/video_output/win32/glwin32.c    |  7 ++++---
 4 files changed, 24 insertions(+), 21 deletions(-)

diff --git a/modules/video_output/win32/common.h b/modules/video_output/win32/common.h
index 275e65b5a0..36e47adb19 100644
--- a/modules/video_output/win32/common.h
+++ b/modules/video_output/win32/common.h
@@ -69,7 +69,6 @@ typedef struct vout_display_sys_win32_t
     RECT         rect_dest;
     RECT         rect_dest_clipped;
 
-    picture_pool_t *pool;
     vout_display_cfg_t vdcfg;
 
     bool use_desktop;     /* show video on desktop window ? */
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index d2ffd7797c..544f68efd4 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -102,6 +102,7 @@ struct vout_display_sys_t
     ID3D11Query              *prepareWait;
 
     picture_sys_t            stagingSys;
+    picture_pool_t           *pool; /* hardware decoding pool */
 
     ID3D11RenderTargetView   *swapchainTargetView[D3D11_MAX_SHADER_VIEW];
 
@@ -567,8 +568,8 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned pool_size)
     picture_t *picture;
     unsigned  picture_count = 0;
 
-    if (sys->sys.pool)
-        return sys->sys.pool;
+    if (sys->pool)
+        return sys->pool;
 
     video_format_t surface_fmt = vd->fmt;
     surface_fmt.i_width  = sys->picQuad.i_width;
@@ -631,10 +632,10 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned pool_size)
         }
     }
 
-    sys->sys.pool = picture_pool_New( pool_size, pictures );
+    sys->pool = picture_pool_New( pool_size, pictures );
 
 error:
-    if (sys->sys.pool == NULL) {
+    if (sys->pool == NULL) {
         if (pictures) {
             msg_Dbg(vd, "Failed to create the picture d3d11 pool");
             for (unsigned i=0;i<picture_count; ++i)
@@ -643,12 +644,12 @@ error:
         }
 
         /* create an empty pool to avoid crashing */
-        sys->sys.pool = picture_pool_New( 0, NULL );
+        sys->pool = picture_pool_New( 0, NULL );
     } else {
         msg_Dbg(vd, "D3D11 pool succeed with %d surfaces (%dx%d) context 0x%p",
                 pool_size, surface_fmt.i_width, surface_fmt.i_height, sys->d3d_dev.d3dcontext);
     }
-    return sys->sys.pool;
+    return sys->pool;
 }
 
 static void DestroyDisplayPoolPicture(picture_t *picture)
@@ -1675,10 +1676,10 @@ static void Direct3D11DestroyPool(vout_display_t *vd)
 {
     vout_display_sys_t *sys = vd->sys;
 
-    if (sys->sys.pool)
+    if (sys->pool)
     {
-        picture_pool_Release(sys->sys.pool);
-        sys->sys.pool = NULL;
+        picture_pool_Release(sys->pool);
+        sys->pool = NULL;
     }
 }
 
diff --git a/modules/video_output/win32/direct3d9.c b/modules/video_output/win32/direct3d9.c
index 2917300d1f..89c36038bd 100644
--- a/modules/video_output/win32/direct3d9.c
+++ b/modules/video_output/win32/direct3d9.c
@@ -155,6 +155,7 @@ struct vout_display_sys_t
 
     const d3d9_format_t     *sw_texture_fmt;  /* Rendering texture(s) format */
     IDirect3DSurface9       *dx_render;
+    picture_pool_t          *pool; /* hardware decoding pool */
 
     /* */
     bool                    reset_device;
@@ -292,11 +293,12 @@ error:
 
 static picture_pool_t *DisplayPool(vout_display_t *vd, unsigned count)
 {
-    if ( vd->sys->sys.pool != NULL )
-        return vd->sys->sys.pool;
-    vd->sys->sys.pool = Direct3D9CreatePicturePool(VLC_OBJECT(vd), &vd->sys->d3d_dev,
-        &vd->fmt, count);
-    return vd->sys->sys.pool;
+    if ( vd->sys->pool == NULL )
+    {
+        vd->sys->pool = Direct3D9CreatePicturePool(VLC_OBJECT(vd), &vd->sys->d3d_dev,
+                                                   &vd->fmt, count);
+    }
+    return vd->sys->pool;
 }
 
 /**
@@ -526,10 +528,10 @@ static void Direct3D9DestroyResources(vout_display_t *vd)
         IDirect3DSurface9_Release(vd->sys->dx_render);
         vd->sys->dx_render = NULL;
     }
-    if (vd->sys->sys.pool)
+    if (vd->sys->pool)
     {
-        picture_pool_Release(vd->sys->sys.pool);
-        vd->sys->sys.pool = NULL;
+        picture_pool_Release(vd->sys->pool);
+        vd->sys->pool = NULL;
     }
     Direct3D9DestroyShaders(vd);
 }
diff --git a/modules/video_output/win32/glwin32.c b/modules/video_output/win32/glwin32.c
index 0c39fa721e..b0286b762e 100644
--- a/modules/video_output/win32/glwin32.c
+++ b/modules/video_output/win32/glwin32.c
@@ -64,6 +64,7 @@ struct vout_display_sys_t
 
     vlc_gl_t              *gl;
     vout_display_opengl_t *vgl;
+    picture_pool_t        *pool;
 };
 
 static picture_pool_t *Pool  (vout_display_t *, unsigned);
@@ -202,12 +203,12 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned count)
 {
     vout_display_sys_t *sys = vd->sys;
 
-    if (!sys->sys.pool && vlc_gl_MakeCurrent (sys->gl) == VLC_SUCCESS)
+    if (!sys->pool && vlc_gl_MakeCurrent (sys->gl) == VLC_SUCCESS)
     {
-        sys->sys.pool = vout_display_opengl_GetPool(sys->vgl, count);
+        sys->pool = vout_display_opengl_GetPool(sys->vgl, count);
         vlc_gl_ReleaseCurrent (sys->gl);
     }
-    return sys->sys.pool;
+    return sys->pool;
 }
 
 static void Prepare(vout_display_t *vd, picture_t *picture, subpicture_t *subpicture,



More information about the vlc-commits mailing list