From 999d047bfeae1c3a3c82cd2525fb877e497d6182 Mon Sep 17 00:00:00 2001 From: Ross Patterson Date: Fri, 9 Aug 2019 21:30:48 -0700 Subject: [PATCH] Detect: Checkpoint untested Windows GPU detection --- ffmpeg/_detect.py | 13 +++++++++++++ setup.py | 3 +++ 2 files changed, 16 insertions(+) diff --git a/ffmpeg/_detect.py b/ffmpeg/_detect.py index bcb63aa..c88644b 100644 --- a/ffmpeg/_detect.py +++ b/ffmpeg/_detect.py @@ -54,6 +54,8 @@ HWACCEL_OUTPUT_FORMATS = { 'vaapi': 'vaapi'} GPU_PRODUCT_RE = re.compile(r'(?P[^[]+)(\[(?P[^]]+)\]|)') +GPU_WMI_PROPERTIES = dict( + vendor='AdapterCompatibility', board='VideoProcessor') # Loaded from JSON DATA = None @@ -86,6 +88,17 @@ def detect_gpus(): if not gpu['board']: gpu['board'] = gpu.pop('chip') + elif plat_sys == 'Windows': + import wmi + for controller in wmi.WMI().Win32_VideoController(): + gpu = {} + for key, wmi_prop in GPU_WMI_PROPERTIES.items(): + value = controller.wmi_property(wmi_prop).value + if value: + gpu[key] = value + if gpu: + gpus.append(gpu) + else: # TODO Other platforms raise NotImplementedError( diff --git a/setup.py b/setup.py index 1135d0d..a661f91 100644 --- a/setup.py +++ b/setup.py @@ -72,6 +72,9 @@ setup( long_description=long_description, install_requires=['future'], extras_require={ + 'detect': [ + "pywin32; sys_platform == 'Windows'", + "wmi; sys_platform == 'Windows'"], 'dev': [ 'future==0.17.1', 'numpy==1.16.4',