[vlc-commits] d3d11va: make the OS detection not dependent on the app manifest
Steve Lhomme
git at videolan.org
Tue Aug 7 14:23:17 CEST 2018
vlc/vlc-3.0 | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue Aug 7 14:18:04 2018 +0200| [b33c5a26bc1f3d0e644e8b875f56c7e33ada275b] | committer: Steve Lhomme
d3d11va: make the OS detection not dependent on the app manifest
hopefully the location won't change in future Windows versions
(cherry picked from commit 28676840e3539b56c3339ee617d6b982e0565ed9)
> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=b33c5a26bc1f3d0e644e8b875f56c7e33ada275b
---
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 f73f5dfce8..48e40f54da 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>
@@ -320,9 +318,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