[vlc-commits] d3d11: set the Close callback in the generated operations structure

Steve Lhomme git at videolan.org
Mon Oct 12 15:55:52 CEST 2020


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue Oct  6 11:01:42 2020 +0200| [132e0741d7edbfc61fe32a0e729f3954b63ef3fd] | committer: Steve Lhomme

d3d11: set the Close callback in the generated operations structure

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

 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 a8f59e5d4b..abd43d7ae1 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 555d2b6ba3..fbc1e2fd6a 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 fe20618a69..9fa42114aa 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);
-}



More information about the vlc-commits mailing list