[vlc-devel] [PATCH v2 05/26] d3d11: set the Close callback in the generated operations structure

Steve Lhomme robux4 at ycbcr.xyz
Fri Oct 9 15:04:01 CEST 2020


---
 modules/hw/d3d11/d3d11_filters.c |  2 +-
 modules/hw/d3d11/d3d11_filters.h |  1 -
 modules/hw/d3d11/d3d11_surface.c | 33 ++++++++++++++++----------------
 3 files changed, 17 insertions(+), 19 deletions(-)

diff --git a/modules/hw/d3d11/d3d11_filters.c b/modules/hw/d3d11/d3d11_filters.c
index a8f59e5d4b9..abd43d7ae1c 100644
--- a/modules/hw/d3d11/d3d11_filters.c
+++ b/modules/hw/d3d11/d3d11_filters.c
@@ -599,7 +599,7 @@ vlc_module_begin()
 
     add_submodule()
     set_capability( "video converter", 10 )
-    set_callbacks( D3D11OpenConverter, D3D11CloseConverter )
+    set_callback( D3D11OpenConverter )
 
     add_submodule()
     set_callback( D3D11OpenCPUConverter )
diff --git a/modules/hw/d3d11/d3d11_filters.h b/modules/hw/d3d11/d3d11_filters.h
index 555d2b6ba3a..fbc1e2fd6af 100644
--- a/modules/hw/d3d11/d3d11_filters.h
+++ b/modules/hw/d3d11/d3d11_filters.h
@@ -30,7 +30,6 @@
 
 int  D3D11OpenDeinterlace(vlc_object_t *);
 int  D3D11OpenConverter(vlc_object_t *);
-void D3D11CloseConverter(vlc_object_t *);
 int  D3D11OpenCPUConverter(vlc_object_t *);
 
 int  D3D11OpenDecoderDeviceW8(vlc_decoder_device *, vout_window_t *);
diff --git a/modules/hw/d3d11/d3d11_surface.c b/modules/hw/d3d11/d3d11_surface.c
index fe20618a696..9fa42114aac 100644
--- a/modules/hw/d3d11/d3d11_surface.c
+++ b/modules/hw/d3d11/d3d11_surface.c
@@ -591,9 +591,22 @@ static void NV12_D3D11(filter_t *p_filter, picture_t *src, picture_t *dst)
     dst->i_planes = 0;
 }
 
-VIDEO_FILTER_WRAPPER (D3D11_NV12)
-VIDEO_FILTER_WRAPPER (D3D11_YUY2)
-VIDEO_FILTER_WRAPPER (D3D11_RGBA)
+static void D3D11CloseConverter( filter_t *p_filter )
+{
+    filter_sys_t *p_sys = p_filter->p_sys;
+#if CAN_PROCESSOR
+    if (p_sys->procOutTexture)
+        ID3D11Texture2D_Release(p_sys->procOutTexture);
+    D3D11_ReleaseProcessor( &p_sys->d3d_proc );
+#endif
+    CopyCleanCache(&p_sys->cache);
+    if (p_sys->staging)
+        ID3D11Texture2D_Release(p_sys->staging);
+}
+
+VIDEO_FILTER_WRAPPER_CLOSE(D3D11_NV12, D3D11CloseConverter)
+VIDEO_FILTER_WRAPPER_CLOSE(D3D11_YUY2, D3D11CloseConverter)
+VIDEO_FILTER_WRAPPER_CLOSE(D3D11_RGBA, D3D11CloseConverter)
 
 static picture_t *AllocateCPUtoGPUTexture(filter_t *p_filter, filter_sys_t *p_sys)
 {
@@ -845,17 +858,3 @@ done:
     }
     return err;
 }
-
-void D3D11CloseConverter( vlc_object_t *obj )
-{
-    filter_t *p_filter = (filter_t *)obj;
-    filter_sys_t *p_sys = p_filter->p_sys;
-#if CAN_PROCESSOR
-    if (p_sys->procOutTexture)
-        ID3D11Texture2D_Release(p_sys->procOutTexture);
-    D3D11_ReleaseProcessor( &p_sys->d3d_proc );
-#endif
-    CopyCleanCache(&p_sys->cache);
-    if (p_sys->staging)
-        ID3D11Texture2D_Release(p_sys->staging);
-}
-- 
2.26.2



More information about the vlc-devel mailing list