[vlc-devel] [PATCH 11/20] hw:d3d11: move all the filters into a single module
Steve Lhomme
robux4 at videolabs.io
Wed Nov 22 18:18:30 CET 2017
---
configure.ac | 2 +-
modules/hw/d3d11/Makefile.am | 35 ++++++----------------
modules/hw/d3d11/d3d11_deinterlace.c | 14 ++-------
.../hw/d3d11/{d3d11_adjust.c => d3d11_filters.c} | 19 ++++++++++--
modules/hw/d3d11/d3d11_filters.h | 35 ++++++++++++++++++++++
modules/hw/d3d11/d3d11_surface.c | 23 ++++----------
6 files changed, 70 insertions(+), 58 deletions(-)
rename modules/hw/d3d11/{d3d11_adjust.c => d3d11_filters.c} (97%)
create mode 100644 modules/hw/d3d11/d3d11_filters.h
diff --git a/configure.ac b/configure.ac
index d9ce412e5e..84dfd75b0c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3318,7 +3318,7 @@ AS_IF([test "${enable_directx}" != "no"], [
dnl Direct3D11
AC_CHECK_HEADERS(d3d11.h, [
- VLC_ADD_PLUGIN([direct3d11 direct3d11_deinterlace direct3d11_adjust])
+ VLC_ADD_PLUGIN([direct3d11 direct3d11_filters])
])
dnl Direct3D9
diff --git a/modules/hw/d3d11/Makefile.am b/modules/hw/d3d11/Makefile.am
index 999d4c6052..4bca091326 100644
--- a/modules/hw/d3d11/Makefile.am
+++ b/modules/hw/d3d11/Makefile.am
@@ -1,32 +1,15 @@
d3d11dir = $(pluginsdir)/d3d11
-d3d11_LTLIBRARIES =
-libdirect3d11_deinterlace_plugin_la_SOURCES = hw/d3d11/d3d11_deinterlace.c
-libdirect3d11_deinterlace_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(voutdir)'
-libdirect3d11_deinterlace_plugin_la_LIBADD = libdeinterlace_common.la libd3d11_common.la
+libdirect3d11_filters_plugin_la_SOURCES = hw/d3d11/d3d11_filters.h \
+ hw/d3d11/d3d11_filters.c \
+ hw/d3d11/d3d11_deinterlace.c \
+ hw/d3d11/d3d11_surface.c
+libdirect3d11_filters_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(d3d11dir)'
+libdirect3d11_filters_plugin_la_LIBADD = libchroma_copy.la libdeinterlace_common.la libd3d11_common.la
if HAVE_WINSTORE
-libdirect3d11_deinterlace_plugin_la_LIBADD += -ld3d11
-endif
-libdirect3d11_adjust_plugin_la_SOURCES = hw/d3d11/d3d11_adjust.c
-libdirect3d11_adjust_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(voutdir)'
-libdirect3d11_adjust_plugin_la_LIBADD = libd3d11_common.la
-if HAVE_WINSTORE
-libdirect3d11_adjust_plugin_la_LIBADD += -ld3d11
-endif
-
-if HAVE_AVCODEC_D3D11VA
-#video_filter_LTLIBRARIES += $(LTLIBdirect3d11_deinterlace) $(LTLIBdirect3d11_adjust)
-d3d11_LTLIBRARIES += libdirect3d11_deinterlace_plugin.la libdirect3d11_adjust_plugin.la
+libdirect3d11_filters_plugin_la_LIBADD += -ld3d11
endif
-# GPU/CPU converter
-libd3d11_surface_plugin_la_SOURCES = hw/d3d11/d3d11_surface.c
-libd3d11_surface_plugin_la_LIBADD = libchroma_copy.la libd3d11_common.la
-if HAVE_WINSTORE
-libd3d11_surface_plugin_la_LIBADD += -ld3d11
-endif
-
-if HAVE_AVCODEC_D3D11VA
-d3d11_LTLIBRARIES += libd3d11_surface_plugin.la
-endif
+d3d11_LTLIBRARIES = $(LTLIBdirect3d11_filters)
+EXTRA_LTLIBRARIES += libdirect3d11_filters_plugin.la
diff --git a/modules/hw/d3d11/d3d11_deinterlace.c b/modules/hw/d3d11/d3d11_deinterlace.c
index 64c098558e..1b977d9847 100644
--- a/modules/hw/d3d11/d3d11_deinterlace.c
+++ b/modules/hw/d3d11/d3d11_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>
@@ -36,6 +35,7 @@
#include <initguid.h>
#include <d3d11.h>
+#include "d3d11_filters.h"
#include "../../video_chroma/d3d11_fmt.h"
#include "../../video_filter/deinterlace/common.h"
@@ -281,7 +281,7 @@ static picture_t *NewOutputPicture( filter_t *p_filter )
return pic;
}
-static int D3D11OpenDeinterlace(vlc_object_t *obj)
+int D3D11OpenDeinterlace(vlc_object_t *obj)
{
filter_t *filter = (filter_t *)obj;
HRESULT hr;
@@ -515,7 +515,7 @@ error:
return VLC_EGENERIC;
}
-static void D3D11CloseDeinterlace(vlc_object_t *obj)
+void D3D11CloseDeinterlace(vlc_object_t *obj)
{
filter_t *filter = (filter_t *)obj;
filter_sys_t *sys = filter->p_sys;
@@ -530,11 +530,3 @@ static void D3D11CloseDeinterlace(vlc_object_t *obj)
free(sys);
}
-vlc_module_begin()
- set_description(N_("Direct3D11 deinterlacing filter"))
- set_capability("video filter", 0)
- set_category(CAT_VIDEO)
- set_subcategory(SUBCAT_VIDEO_VFILTER)
- set_callbacks(D3D11OpenDeinterlace, D3D11CloseDeinterlace)
- add_shortcut ("deinterlace")
-vlc_module_end()
diff --git a/modules/hw/d3d11/d3d11_adjust.c b/modules/hw/d3d11/d3d11_filters.c
similarity index 97%
rename from modules/hw/d3d11/d3d11_adjust.c
rename to modules/hw/d3d11/d3d11_filters.c
index f5ace01acc..70764a3e87 100644
--- a/modules/hw/d3d11/d3d11_adjust.c
+++ b/modules/hw/d3d11/d3d11_filters.c
@@ -1,7 +1,7 @@
/*****************************************************************************
- * d3d11_adjust.c: D3D11 adjust filter (no gamma)
+ * d3d11_adjust.c: D3D11 filters module callbacks
*****************************************************************************
- * Copyright (C) 2017 Videolabs SAS
+ * Copyright © 2017 VLC authors, VideoLAN and VideoLabs
*
* Authors: Steve Lhomme <robux4 at gmail.com>
*
@@ -38,6 +38,7 @@
#include <initguid.h>
#include <d3d11.h>
+#include "d3d11_filters.h"
#include "../../video_chroma/d3d11_fmt.h"
#ifdef __MINGW32__
@@ -616,7 +617,7 @@ static void D3D11CloseAdjust(vlc_object_t *obj)
}
vlc_module_begin()
- set_description(N_("Direct3D11 adjust filter"))
+ set_description(N_("Direct3D11 filter"))
set_capability("video filter", 0)
set_category( CAT_VIDEO )
set_subcategory( SUBCAT_VIDEO_VFILTER )
@@ -642,4 +643,16 @@ vlc_module_begin()
THRES_TEXT, THRES_LONGTEXT, false )
change_safe()
+ add_submodule()
+ set_callbacks( D3D11OpenDeinterlace, D3D11CloseDeinterlace )
+ add_shortcut ("deinterlace")
+
+ add_submodule()
+ set_capability( "video converter", 10 )
+ set_callbacks( D3D11OpenConverter, D3D11CloseConverter )
+
+ add_submodule()
+ set_callbacks( D3D11OpenCPUConverter, D3D11CloseCPUConverter )
+ set_capability( "video converter", 10 )
+
vlc_module_end()
diff --git a/modules/hw/d3d11/d3d11_filters.h b/modules/hw/d3d11/d3d11_filters.h
new file mode 100644
index 0000000000..10f1076ea7
--- /dev/null
+++ b/modules/hw/d3d11/d3d11_filters.h
@@ -0,0 +1,35 @@
+/*****************************************************************************
+ * d3d11_filters.h : D3D11 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_D3D11_FILTERS_H
+#define VLC_D3D11_FILTERS_H
+
+#include <vlc_common.h>
+
+int D3D11OpenDeinterlace(vlc_object_t *);
+void D3D11CloseDeinterlace(vlc_object_t *);
+int D3D11OpenConverter(vlc_object_t *);
+void D3D11CloseConverter(vlc_object_t *);
+int D3D11OpenCPUConverter(vlc_object_t *);
+void D3D11CloseCPUConverter(vlc_object_t *);
+
+#endif /* VLC_D3D11_FILTERS_H */
diff --git a/modules/hw/d3d11/d3d11_surface.c b/modules/hw/d3d11/d3d11_surface.c
index 24de73ae7c..8acd61814a 100644
--- a/modules/hw/d3d11/d3d11_surface.c
+++ b/modules/hw/d3d11/d3d11_surface.c
@@ -29,7 +29,6 @@
#endif
#include <vlc_common.h>
-#include <vlc_plugin.h>
#include <vlc_filter.h>
#include <vlc_picture.h>
#include <vlc_modules.h>
@@ -41,6 +40,8 @@
#include <windows.h>
#define COBJMACROS
#include <d3d11.h>
+
+#include "d3d11_filters.h"
#include "../../video_chroma/d3d11_fmt.h"
#ifdef ID3D11VideoContext_VideoProcessorBlt
@@ -624,7 +625,7 @@ VIDEO_FILTER_WRAPPER (D3D11_NV12)
VIDEO_FILTER_WRAPPER (D3D11_YUY2)
VIDEO_FILTER_WRAPPER (NV12_D3D11)
-static int D3D11OpenConverter( vlc_object_t *obj )
+int D3D11OpenConverter( vlc_object_t *obj )
{
filter_t *p_filter = (filter_t *)obj;
int err = VLC_EGENERIC;
@@ -671,7 +672,7 @@ done:
return err;
}
-static int D3D11OpenCPUConverter( vlc_object_t *obj )
+int D3D11OpenCPUConverter( vlc_object_t *obj )
{
filter_t *p_filter = (filter_t *)obj;
int err = VLC_EGENERIC;
@@ -796,7 +797,7 @@ done:
return err;
}
-static void D3D11CloseConverter( vlc_object_t *obj )
+void D3D11CloseConverter( vlc_object_t *obj )
{
filter_t *p_filter = (filter_t *)obj;
filter_sys_t *p_sys = (filter_sys_t*) p_filter->p_sys;
@@ -819,7 +820,7 @@ static void D3D11CloseConverter( vlc_object_t *obj )
p_filter->p_sys = NULL;
}
-static void D3D11CloseCPUConverter( vlc_object_t *obj )
+void D3D11CloseCPUConverter( vlc_object_t *obj )
{
filter_t *p_filter = (filter_t *)obj;
filter_sys_t *p_sys = (filter_sys_t*) p_filter->p_sys;
@@ -829,15 +830,3 @@ static void D3D11CloseCPUConverter( vlc_object_t *obj )
free( p_sys );
p_filter->p_sys = NULL;
}
-
-/*****************************************************************************
- * Module descriptor.
- *****************************************************************************/
-vlc_module_begin ()
- set_description( N_("Conversions from D3D11 to YUV") )
- set_capability( "video converter", 10 )
- set_callbacks( D3D11OpenConverter, D3D11CloseConverter )
- add_submodule()
- set_callbacks( D3D11OpenCPUConverter, D3D11CloseCPUConverter )
- set_capability( "video converter", 10 )
-vlc_module_end ()
--
2.14.2
More information about the vlc-devel
mailing list