[vlc-commits] hw:d3d11: add D3D11_ReleaseProcessor()

Steve Lhomme git at videolan.org
Mon May 28 13:24:56 CEST 2018


vlc | branch: master | Steve Lhomme <robux4 at videolabs.io> | Thu Nov 30 10:04:24 2017 +0100| [27e5d6e031adfa14c7c1742fc32122db30875a3e] | committer: Steve Lhomme

hw:d3d11: add D3D11_ReleaseProcessor()

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

 modules/hw/d3d11/Makefile.am       |  2 +-
 modules/hw/d3d11/d3d11_processor.c | 62 ++++++++++++++++++++++++++++++++++++++
 modules/hw/d3d11/d3d11_processor.h |  2 ++
 3 files changed, 65 insertions(+), 1 deletion(-)

diff --git a/modules/hw/d3d11/Makefile.am b/modules/hw/d3d11/Makefile.am
index bae0edaf91..e5c5afa3b8 100644
--- a/modules/hw/d3d11/Makefile.am
+++ b/modules/hw/d3d11/Makefile.am
@@ -5,7 +5,7 @@ libdirect3d11_filters_plugin_la_SOURCES = hw/d3d11/d3d11_filters.h \
     hw/d3d11/d3d11_deinterlace.c \
     hw/d3d11/d3d11_surface.c \
     hw/d3d11/d3d11_instance.c \
-    hw/d3d11/d3d11_processor.h
+    hw/d3d11/d3d11_processor.c hw/d3d11/d3d11_processor.h
 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
diff --git a/modules/hw/d3d11/d3d11_processor.c b/modules/hw/d3d11/d3d11_processor.c
new file mode 100644
index 0000000000..43b4840e90
--- /dev/null
+++ b/modules/hw/d3d11/d3d11_processor.c
@@ -0,0 +1,62 @@
+/*****************************************************************************
+ * d3d11_processor.c: D3D11 VideoProcessor helper
+ *****************************************************************************
+ * 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.
+ *****************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <vlc_filter.h>
+#include <vlc_picture.h>
+
+#include <assert.h>
+
+#define COBJMACROS
+#include <initguid.h>
+#include <d3d11.h>
+
+#include "d3d11_processor.h"
+
+#if defined(ID3D11VideoContext_VideoProcessorBlt)
+void D3D11_ReleaseProcessor(d3d11_processor_t *out)
+{
+    if (out->videoProcessor)
+    {
+        ID3D11VideoProcessor_Release(out->videoProcessor);
+        out->videoProcessor = NULL;
+    }
+    if (out->procEnumerator)
+    {
+        ID3D11VideoProcessorEnumerator_Release(out->procEnumerator);
+        out->procEnumerator = NULL;
+    }
+    if (out->d3dviddev)
+    {
+        ID3D11VideoDevice_Release(out->d3dviddev);
+        out->d3dviddev = NULL;
+    }
+    if (out->d3dvidctx)
+    {
+        ID3D11VideoContext_Release(out->d3dvidctx);
+        out->d3dvidctx = NULL;
+    }
+}
+#endif
diff --git a/modules/hw/d3d11/d3d11_processor.h b/modules/hw/d3d11/d3d11_processor.h
index 1d93bfd98a..d239aead73 100644
--- a/modules/hw/d3d11/d3d11_processor.h
+++ b/modules/hw/d3d11/d3d11_processor.h
@@ -35,6 +35,8 @@ typedef struct
     ID3D11VideoProcessorEnumerator *procEnumerator;
     ID3D11VideoProcessor           *videoProcessor;
 } d3d11_processor_t;
+
+void D3D11_ReleaseProcessor(d3d11_processor_t *);
 #endif
 
 #endif /* VLC_D3D11_PROCESSOR_H */



More information about the vlc-commits mailing list