[vlc-commits] d3d11va: make the OS detection not dependent on the app manifest
Steve Lhomme
git at videolan.org
Tue Aug 7 14:19:02 CEST 2018
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue Aug 7 14:18:04 2018 +0200| [28676840e3539b56c3339ee617d6b982e0565ed9] | committer: Steve Lhomme
d3d11va: make the OS detection not dependent on the app manifest
hopefully the location won't change in future Windows versions
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=28676840e3539b56c3339ee617d6b982e0565ed9
---
modules/codec/avcodec/d3d11va.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c
index 6e5fc20f44..1d6a8f5cc4 100644
--- a/modules/codec/avcodec/d3d11va.c
+++ b/modules/codec/avcodec/d3d11va.c
@@ -43,8 +43,6 @@
#include <vlc_charset.h>
#include <vlc_codec.h>
-#include <versionhelpers.h>
-
#define COBJMACROS
#include <initguid.h>
#include <d3d11.h>
@@ -321,9 +319,18 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat pix_fmt,
if (pix_fmt != AV_PIX_FMT_D3D11VA_VLD)
return VLC_EGENERIC;
+#if !VLC_WINSTORE_APP
/* Allow using D3D11VA automatically starting from Windows 8.1 */
- if (!va->obj.force && !IsWindows8Point1OrGreater())
- return VLC_EGENERIC;
+ if (!va->obj.force)
+ {
+ bool isWin81OrGreater = false;
+ HMODULE hKernel32 = GetModuleHandle(TEXT("kernel32.dll"));
+ if (likely(hKernel32 != NULL))
+ isWin81OrGreater = GetProcAddress(hKernel32, "IsProcessCritical") != NULL;
+ if (!isWin81OrGreater)
+ return VLC_EGENERIC;
+ }
+#endif
vlc_va_sys_t *sys = calloc(1, sizeof (*sys));
if (unlikely(sys == NULL))
More information about the vlc-commits
mailing list