[vlc-devel] [PATCH 12/20] hw:d3d9: move all the filters into a single module

Steve Lhomme robux4 at videolabs.io
Wed Nov 22 18:18:31 CET 2017


---
 configure.ac                                      |  2 +-
 modules/hw/d3d9/Makefile.am                       | 25 ++++++----------
 modules/hw/d3d9/{d3d9_adjust.c => d3d9_filters.c} | 18 ++++++++++--
 modules/hw/d3d9/d3d9_filters.h                    | 35 +++++++++++++++++++++++
 modules/hw/d3d9/dxa9.c                            | 23 ++++-----------
 modules/hw/d3d9/dxva2_deinterlace.c               | 16 +++--------
 6 files changed, 70 insertions(+), 49 deletions(-)
 rename modules/hw/d3d9/{d3d9_adjust.c => d3d9_filters.c} (97%)
 create mode 100644 modules/hw/d3d9/d3d9_filters.h

diff --git a/configure.ac b/configure.ac
index 84dfd75b0c..eb70aa90b8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3335,7 +3335,7 @@ AS_IF([test "${enable_directx}" != "no"], [
           #endif
         ]],[[;]])
       ],[
-        VLC_ADD_PLUGIN([direct3d9_deinterlace direct3d9_adjust])
+        VLC_ADD_PLUGIN([direct3d9_filters])
       ],
       [AC_MSG_WARN([Could not find required IDirectXVideoDecoder in dxva2api.h])])
 
diff --git a/modules/hw/d3d9/Makefile.am b/modules/hw/d3d9/Makefile.am
index 0ce35b8efd..9428d3395a 100644
--- a/modules/hw/d3d9/Makefile.am
+++ b/modules/hw/d3d9/Makefile.am
@@ -1,22 +1,13 @@
 d3d9dir = $(pluginsdir)/d3d9
-d3d9_LTLIBRARIES =
 
-# GPU/CPU converter
-libdxa9_plugin_la_SOURCES = hw/d3d9/dxa9.c
-libdxa9_plugin_la_LIBADD = libd3d9_common.la libchroma_copy.la
-
-if HAVE_AVCODEC_DXVA2
-d3d9_LTLIBRARIES += libdxa9_plugin.la
-endif
-
-libdirect3d9_deinterlace_plugin_la_SOURCES = hw/d3d9/dxva2_deinterlace.c
-libdirect3d9_deinterlace_plugin_la_LIBADD = libd3d9_common.la $(LIBCOM) libdeinterlace_common.la
-libdirect3d9_deinterlace_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(voutdir)'
-libdirect3d9_adjust_plugin_la_SOURCES = hw/d3d9/d3d9_adjust.c
-libdirect3d9_adjust_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(voutdir)'
-libdirect3d9_adjust_plugin_la_LIBADD = libd3d9_common.la $(LIBCOM)
+libdirect3d9_filters_plugin_la_SOURCES = hw/d3d9/d3d9_filters.h \
+    hw/d3d9/d3d9_filters.c \
+    hw/d3d9/dxva2_deinterlace.c \
+    hw/d3d9/dxa9.c
+libdirect3d9_filters_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(d3d9dir)'
+libdirect3d9_filters_plugin_la_LIBADD = libchroma_copy.la libdeinterlace_common.la libd3d9_common.la
 
 if HAVE_WIN32_DESKTOP
-#video_filter_LTLIBRARIES = $(LTLIBdirect3d9_deinterlace) $(LTLIBdirect3d9_adjust)
-d3d9_LTLIBRARIES += libdirect3d9_deinterlace_plugin.la libdirect3d9_adjust_plugin.la
+d3d9_LTLIBRARIES = $(LTLIBdirect3d9_filters)
+EXTRA_LTLIBRARIES += libdirect3d9_filters_plugin.la
 endif
diff --git a/modules/hw/d3d9/d3d9_adjust.c b/modules/hw/d3d9/d3d9_filters.c
similarity index 97%
rename from modules/hw/d3d9/d3d9_adjust.c
rename to modules/hw/d3d9/d3d9_filters.c
index b62ea5ef95..9153b931b6 100644
--- a/modules/hw/d3d9/d3d9_adjust.c
+++ b/modules/hw/d3d9/d3d9_filters.c
@@ -1,7 +1,7 @@
 /*****************************************************************************
- * d3d9_adjust.c: D3D9 adjust filter (no gamma)
+ * d3d9_filters.c: D3D9 filters module callbacks
  *****************************************************************************
- * Copyright (C) 2017 Videolabs SAS
+ * Copyright © 2017 VLC authors, VideoLAN and VideoLabs
  *
  * Authors: Steve Lhomme <robux4 at gmail.com>
  *
@@ -39,6 +39,8 @@
 #include <dxva2api.h>
 #include "../../video_chroma/d3d9_fmt.h"
 
+#include "d3d9_filters.h"
+
 struct filter_level
 {
     atomic_int   level;
@@ -464,4 +466,16 @@ vlc_module_begin()
     add_bool( "brightness-threshold", false,
               THRES_TEXT, THRES_LONGTEXT, false )
         change_safe()
+
+    add_submodule()
+    set_callbacks(D3D9OpenDeinterlace, D3D9CloseDeinterlace)
+    add_shortcut ("deinterlace")
+
+    add_submodule()
+    set_capability( "video converter", 10 )
+    set_callbacks( D3D9OpenConverter, D3D9CloseConverter )
+
+    add_submodule()
+    set_callbacks( D3D9OpenCPUConverter, D3D9CloseCPUConverter )
+    set_capability( "video converter", 10 )
 vlc_module_end()
diff --git a/modules/hw/d3d9/d3d9_filters.h b/modules/hw/d3d9/d3d9_filters.h
new file mode 100644
index 0000000000..0d495dc2e5
--- /dev/null
+++ b/modules/hw/d3d9/d3d9_filters.h
@@ -0,0 +1,35 @@
+/*****************************************************************************
+ * d3d9_filters.h : D3D9 filters module callbacks
+ *****************************************************************************
+ * Copyright © 2017 VLC authors, VideoLAN and VideoLabs
+ *
+ * Authors: Steve Lhomme <robux4 at gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifndef VLC_D3D9_FILTERS_H
+#define VLC_D3D9_FILTERS_H
+
+#include <vlc_common.h>
+
+int  D3D9OpenDeinterlace(vlc_object_t *);
+void D3D9CloseDeinterlace(vlc_object_t *);
+int  D3D9OpenConverter(vlc_object_t *);
+void D3D9CloseConverter(vlc_object_t *);
+int  D3D9OpenCPUConverter(vlc_object_t *);
+void D3D9CloseCPUConverter(vlc_object_t *);
+
+#endif /* VLC_D3D9_FILTERS_H */
diff --git a/modules/hw/d3d9/dxa9.c b/modules/hw/d3d9/dxa9.c
index ff26e2d3ff..d6624a7f5a 100644
--- a/modules/hw/d3d9/dxa9.c
+++ b/modules/hw/d3d9/dxa9.c
@@ -30,11 +30,12 @@
 #endif
 
 #include <vlc_common.h>
-#include <vlc_plugin.h>
 #include <vlc_filter.h>
 #include <vlc_picture.h>
 #include <vlc_modules.h>
 
+#include "d3d9_filters.h"
+
 #include "../../video_chroma/copy.h"
 
 #include <windows.h>
@@ -287,7 +288,7 @@ VIDEO_FILTER_WRAPPER (DXA9_YV12)
 VIDEO_FILTER_WRAPPER (DXA9_NV12)
 VIDEO_FILTER_WRAPPER (YV12_D3D9)
 
-static int D3D9OpenConverter( vlc_object_t *obj )
+int D3D9OpenConverter( vlc_object_t *obj )
 {
     filter_t *p_filter = (filter_t *)obj;
     HINSTANCE hd3d_dll = NULL;
@@ -336,7 +337,7 @@ done:
     return err;
 }
 
-static int D3D9OpenCPUConverter( vlc_object_t *obj )
+int D3D9OpenCPUConverter( vlc_object_t *obj )
 {
     filter_t *p_filter = (filter_t *)obj;
     int err = VLC_EGENERIC;
@@ -455,7 +456,7 @@ done:
     return err;
 }
 
-static void D3D9CloseConverter( vlc_object_t *obj )
+void D3D9CloseConverter( vlc_object_t *obj )
 {
     filter_t *p_filter = (filter_t *)obj;
     copy_cache_t *p_copy_cache = (copy_cache_t*) p_filter->p_sys;
@@ -464,7 +465,7 @@ static void D3D9CloseConverter( vlc_object_t *obj )
     p_filter->p_sys = NULL;
 }
 
-static void D3D9CloseCPUConverter( vlc_object_t *obj )
+void D3D9CloseCPUConverter( vlc_object_t *obj )
 {
     filter_t *p_filter = (filter_t *)obj;
     filter_sys_t *p_sys = (filter_sys_t*) p_filter->p_sys;
@@ -475,15 +476,3 @@ static void D3D9CloseCPUConverter( vlc_object_t *obj )
     free( p_sys );
     p_filter->p_sys = NULL;
 }
-
-/*****************************************************************************
- * Module descriptor.
- *****************************************************************************/
-vlc_module_begin ()
-    set_description( N_("Conversions from DxVA2 to YUV") )
-    set_capability( "video converter", 10 )
-    set_callbacks( D3D9OpenConverter, D3D9CloseConverter )
-    add_submodule()
-        set_callbacks( D3D9OpenCPUConverter, D3D9CloseCPUConverter )
-        set_capability( "video converter", 10 )
-vlc_module_end ()
diff --git a/modules/hw/d3d9/dxva2_deinterlace.c b/modules/hw/d3d9/dxva2_deinterlace.c
index 06fb217826..4afd34fbe1 100644
--- a/modules/hw/d3d9/dxva2_deinterlace.c
+++ b/modules/hw/d3d9/dxva2_deinterlace.c
@@ -28,7 +28,6 @@
 #include <assert.h>
 
 #include <vlc_common.h>
-#include <vlc_plugin.h>
 #include <vlc_filter.h>
 #include <vlc_picture.h>
 
@@ -39,6 +38,8 @@
 #include "../../video_chroma/d3d9_fmt.h"
 #include "../../video_filter/deinterlace/common.h"
 
+#include "d3d9_filters.h"
+
 struct filter_sys_t
 {
     HINSTANCE                      hdecoder_dll;
@@ -266,7 +267,7 @@ static picture_t *NewOutputPicture( filter_t *p_filter )
     return pic;
 }
 
-static int D3D9OpenDeinterlace(vlc_object_t *obj)
+int D3D9OpenDeinterlace(vlc_object_t *obj)
 {
     filter_t *filter = (filter_t *)obj;
     filter_sys_t *sys = NULL;
@@ -492,7 +493,7 @@ error:
     return VLC_EGENERIC;
 }
 
-static void D3D9CloseDeinterlace(vlc_object_t *obj)
+void D3D9CloseDeinterlace(vlc_object_t *obj)
 {
     filter_t *filter = (filter_t *)obj;
     filter_sys_t *sys = filter->p_sys;
@@ -505,12 +506,3 @@ static void D3D9CloseDeinterlace(vlc_object_t *obj)
 
     free(sys);
 }
-
-vlc_module_begin()
-    set_description(N_("Direct3D9 deinterlacing filter"))
-    set_capability("video filter", 0)
-    set_category(CAT_VIDEO)
-    set_subcategory(SUBCAT_VIDEO_VFILTER)
-    set_callbacks(D3D9OpenDeinterlace, D3D9CloseDeinterlace)
-    add_shortcut ("deinterlace")
-vlc_module_end()
-- 
2.14.2



More information about the vlc-devel mailing list