|
7 | 7 | from typing import TYPE_CHECKING, TypedDict
|
8 | 8 |
|
9 | 9 | from pygrabber import dshow_graph
|
10 |
| -from winsdk.windows.media.capture import MediaCapture |
11 | 10 |
|
12 | 11 | from capture_method.BitBltCaptureMethod import BitBltCaptureMethod
|
13 | 12 | from capture_method.CaptureMethodBase import CaptureMethodBase
|
14 | 13 | from capture_method.DesktopDuplicationCaptureMethod import DesktopDuplicationCaptureMethod
|
15 | 14 | from capture_method.ForceFullContentRenderingCaptureMethod import ForceFullContentRenderingCaptureMethod
|
16 | 15 | from capture_method.VideoCaptureDeviceCaptureMethod import VideoCaptureDeviceCaptureMethod
|
17 | 16 | from capture_method.WindowsGraphicsCaptureMethod import WindowsGraphicsCaptureMethod
|
18 |
| -from utils import WINDOWS_BUILD_NUMBER |
| 17 | +from utils import WINDOWS_BUILD_NUMBER, get_direct3d_device |
19 | 18 |
|
20 | 19 | if TYPE_CHECKING:
|
21 | 20 | from AutoSplit import AutoSplit
|
22 | 21 |
|
23 | 22 | WGC_MIN_BUILD = 17134
|
24 | 23 | """https://docs.microsoft.com/en-us/uwp/api/windows.graphics.capture.graphicscapturepicker#applies-to"""
|
| 24 | +LEARNING_MODE_DEVICE_BUILD = 17763 |
| 25 | +"""https://learn.microsoft.com/en-us/uwp/api/windows.ai.machinelearning.learningmodeldevice""" |
25 | 26 |
|
26 | 27 |
|
27 | 28 | class Region(TypedDict):
|
@@ -121,8 +122,8 @@ def __getitem__(self, key: CaptureMethodEnum):
|
121 | 122 | short_description="fast, most compatible, capped at 60fps",
|
122 | 123 | description=(
|
123 | 124 | f"\nOnly available in Windows 10.0.{WGC_MIN_BUILD} and up. "
|
124 |
| - "\nDue to current technical limitations, it requires having at least one " |
125 |
| - "\naudio or video Capture Device connected and enabled. Even if it won't be used. " |
| 125 | + f"\nDue to current technical limitations, Windows versions below 10.0.0.{LEARNING_MODE_DEVICE_BUILD}" |
| 126 | + "\nrequire having at least one audio or video Capture Device connected and enabled." |
126 | 127 | "\nAllows recording UWP apps, Hardware Accelerated and Exclusive Fullscreen windows. "
|
127 | 128 | "\nAdds a yellow border on Windows 10 (not on Windows 11)."
|
128 | 129 | "\nCaps at around 60 FPS. "
|
@@ -166,21 +167,18 @@ def __getitem__(self, key: CaptureMethodEnum):
|
166 | 167 | })
|
167 | 168 |
|
168 | 169 |
|
169 |
| -def test_for_media_capture(): |
170 |
| - async def coroutine(): |
171 |
| - return await (MediaCapture().initialize_async() or asyncio.sleep(0)) |
| 170 | +def try_get_direct3d_device(): |
172 | 171 | try:
|
173 |
| - asyncio.run(coroutine()) |
174 |
| - return True |
| 172 | + return get_direct3d_device() |
175 | 173 | except OSError:
|
176 |
| - return False |
| 174 | + return None |
177 | 175 |
|
178 | 176 |
|
179 | 177 | # Detect and remove unsupported capture methods
|
180 | 178 | if ( # Windows Graphics Capture requires a minimum Windows Build
|
181 | 179 | WINDOWS_BUILD_NUMBER < WGC_MIN_BUILD
|
182 |
| - # Our current implementation of Windows Graphics Capture requires at least one CaptureDevice |
183 |
| - or not test_for_media_capture() |
| 180 | + # Our current implementation of Windows Graphics Capture does not ensure we can get an ID3DDevice |
| 181 | + or not try_get_direct3d_device() |
184 | 182 | ):
|
185 | 183 | CAPTURE_METHODS.pop(CaptureMethodEnum.WINDOWS_GRAPHICS_CAPTURE)
|
186 | 184 |
|
|
0 commit comments