[vlc-commits] dxa9: use a close callback for locally defined operations

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


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue Oct  6 11:17:41 2020 +0200| [9941262499378f2a5654fb025db700ae14617c7e] | committer: Steve Lhomme

dxa9: use a close callback for locally defined operations

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

 modules/hw/d3d9/d3d9_filters.c      |  4 ++--
 modules/hw/d3d9/d3d9_filters.h      |  2 --
 modules/hw/d3d9/dxa9.c              | 25 ++++++++++++-------------
 modules/hw/d3d9/dxva2_deinterlace.c | 28 ++++++++++++++--------------
 4 files changed, 28 insertions(+), 31 deletions(-)

diff --git a/modules/hw/d3d9/d3d9_filters.c b/modules/hw/d3d9/d3d9_filters.c
index d63db68bd7..7c36d3e3ad 100644
--- a/modules/hw/d3d9/d3d9_filters.c
+++ b/modules/hw/d3d9/d3d9_filters.c
@@ -514,7 +514,7 @@ vlc_module_begin()
 
     add_submodule()
     set_description(N_("Direct3D9 deinterlace filter"))
-    set_callbacks(D3D9OpenDeinterlace, D3D9CloseDeinterlace)
+    set_callback( D3D9OpenDeinterlace )
     add_shortcut ("deinterlace")
 
     add_submodule()
@@ -522,7 +522,7 @@ vlc_module_begin()
     set_callback( D3D9OpenConverter )
 
     add_submodule()
-    set_callbacks( D3D9OpenCPUConverter, D3D9CloseCPUConverter )
+    set_callback( D3D9OpenCPUConverter )
     set_capability( "video converter", 10 )
 
     add_submodule()
diff --git a/modules/hw/d3d9/d3d9_filters.h b/modules/hw/d3d9/d3d9_filters.h
index 1e8ae4250b..c098e07a1b 100644
--- a/modules/hw/d3d9/d3d9_filters.h
+++ b/modules/hw/d3d9/d3d9_filters.h
@@ -29,10 +29,8 @@
 #include "../../video_chroma/d3d9_fmt.h"
 
 int  D3D9OpenDeinterlace(vlc_object_t *);
-void D3D9CloseDeinterlace(vlc_object_t *);
 int  D3D9OpenConverter(vlc_object_t *);
 int  D3D9OpenCPUConverter(vlc_object_t *);
-void D3D9CloseCPUConverter(vlc_object_t *);
 
 int D3D9OpenDecoderDevice(vlc_decoder_device *, vout_window_t *);
 
diff --git a/modules/hw/d3d9/dxa9.c b/modules/hw/d3d9/dxa9.c
index 5f1c5c14c8..6fcb33e10f 100644
--- a/modules/hw/d3d9/dxa9.c
+++ b/modules/hw/d3d9/dxa9.c
@@ -445,8 +445,19 @@ int D3D9OpenConverter( vlc_object_t *obj )
     return VLC_SUCCESS;
 }
 
+static void D3D9CloseCPUConverter( filter_t *p_filter )
+{
+    filter_sys_t *p_sys = p_filter->p_sys;
+    DeleteFilter(p_sys->filter);
+    if (p_sys->staging)
+        picture_Release(p_sys->staging);
+    vlc_video_context_Release(p_filter->vctx_out);
+    free( p_sys );
+    p_filter->p_sys = NULL;
+}
+
 static const struct vlc_filter_operations YV12_D3D9_ops = {
-    .filter_video = YV12_D3D9_Filter,
+    .filter_video = YV12_D3D9_Filter, .close = D3D9CloseCPUConverter,
 };
 
 int D3D9OpenCPUConverter( vlc_object_t *obj )
@@ -534,15 +545,3 @@ done:
     }
     return err;
 }
-
-void D3D9CloseCPUConverter( vlc_object_t *obj )
-{
-    filter_t *p_filter = (filter_t *)obj;
-    filter_sys_t *p_sys = p_filter->p_sys;
-    DeleteFilter(p_sys->filter);
-    if (p_sys->staging)
-        picture_Release(p_sys->staging);
-    vlc_video_context_Release(p_filter->vctx_out);
-    free( p_sys );
-    p_filter->p_sys = NULL;
-}
diff --git a/modules/hw/d3d9/dxva2_deinterlace.c b/modules/hw/d3d9/dxva2_deinterlace.c
index 0d5f582550..a520fb3bbc 100644
--- a/modules/hw/d3d9/dxva2_deinterlace.c
+++ b/modules/hw/d3d9/dxva2_deinterlace.c
@@ -321,8 +321,21 @@ picture_t *AllocPicture( filter_t *p_filter )
     return pic;
 }
 
+
+static void D3D9CloseDeinterlace(filter_t *filter)
+{
+    filter_sys_t *sys = filter->p_sys;
+
+    IDirect3DSurface9_Release( sys->hw_surface );
+    IDirectXVideoProcessor_Release( sys->processor );
+    FreeLibrary( sys->hdecoder_dll );
+    vlc_video_context_Release(filter->vctx_out);
+
+    free(sys);
+}
+
 static const struct vlc_filter_operations filter_ops = {
-    .filter_video = Deinterlace, .flush = Flush,
+    .filter_video = Deinterlace, .flush = Flush, .close = D3D9CloseDeinterlace,
 };
 
 int D3D9OpenDeinterlace(vlc_object_t *obj)
@@ -522,16 +535,3 @@ error:
 
     return VLC_EGENERIC;
 }
-
-void D3D9CloseDeinterlace(vlc_object_t *obj)
-{
-    filter_t *filter = (filter_t *)obj;
-    filter_sys_t *sys = filter->p_sys;
-
-    IDirect3DSurface9_Release( sys->hw_surface );
-    IDirectXVideoProcessor_Release( sys->processor );
-    FreeLibrary( sys->hdecoder_dll );
-    vlc_video_context_Release(filter->vctx_out);
-
-    free(sys);
-}



More information about the vlc-commits mailing list