[vlc-devel] [PATCH 1/2] d3d11va: fix winrt compilation

Steve Lhomme robux4 at videolabs.io
Thu May 12 14:13:20 CEST 2016


---
 modules/codec/Makefile.am       |  3 +++
 modules/codec/avcodec/d3d11va.c | 15 ++++++++++++++-
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/modules/codec/Makefile.am b/modules/codec/Makefile.am
index c04fcf6..c0f8d32 100644
--- a/modules/codec/Makefile.am
+++ b/modules/codec/Makefile.am
@@ -377,6 +377,9 @@ libd3d11va_plugin_la_SOURCES = \
 	video_chroma/dxgi_fmt.c video_chroma/dxgi_fmt.h \
 	packetizer/h264_nal.c packetizer/h264_nal.h
 libd3d11va_plugin_la_LIBADD = -lole32 -luuid
+if HAVE_WINSTORE
+libd3d11va_plugin_la_LIBADD += -ld3d11
+endif
 if HAVE_AVCODEC_D3D11VA
 codec_LTLIBRARIES += libd3d11va_plugin.la
 endif
diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c
index 9b3e72e..ed6733e 100644
--- a/modules/codec/avcodec/d3d11va.c
+++ b/modules/codec/avcodec/d3d11va.c
@@ -32,6 +32,9 @@
 # include "config.h"
 #endif
 
+# undef WINAPI_FAMILY
+# define WINAPI_FAMILY WINAPI_FAMILY_DESKTOP_APP
+
 #include <assert.h>
 
 #include <vlc_common.h>
@@ -62,6 +65,10 @@ vlc_module_begin()
     set_callbacks(Open, Close)
 vlc_module_end()
 
+#if VLC_WINSTORE_APP
+#define pf_CreateDevice                 D3D11CreateDevice
+#endif
+
 #include <initguid.h> /* must be last included to not redefine existing GUIDs */
 
 /* dxva2api.h GUIDs: http://msdn.microsoft.com/en-us/library/windows/desktop/ms697067(v=vs100).aspx
@@ -347,7 +354,11 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat pix_fmt,
         }
     }
 
-    err = directx_va_Open(va, &sys->dx_sys, ctx, fmt, dx_sys->d3ddev==NULL || va->sys->d3dctx==NULL);
+#if VLC_WINSTORE_APP
+    err = directx_va_Open(va, &sys->dx_sys, ctx, fmt, false);
+#else
+    err = directx_va_Open(va, &sys->dx_sys, ctx, fmt, dx_sys->d3ddev == NULL || va->sys->d3dctx == NULL);
+#endif
     if (err!=VLC_SUCCESS)
         goto error;
 
@@ -393,6 +404,7 @@ static int D3dCreateDevice(vlc_va_t *va)
         return VLC_SUCCESS;
     }
 
+#if !VLC_WINSTORE_APP
     /* */
     PFN_D3D11_CREATE_DEVICE pf_CreateDevice;
     pf_CreateDevice = (void *)GetProcAddress(dx_sys->hdecoder_dll, "D3D11CreateDevice");
@@ -400,6 +412,7 @@ static int D3dCreateDevice(vlc_va_t *va)
         msg_Err(va, "Cannot locate reference to D3D11CreateDevice ABI in DLL");
         return VLC_EGENERIC;
     }
+#endif
 
     UINT creationFlags = D3D11_CREATE_DEVICE_VIDEO_SUPPORT;
 #if !defined(NDEBUG) //&& defined(_MSC_VER)
-- 
2.8.1



More information about the vlc-devel mailing list