485 Commits

Author SHA1 Message Date
jpark37
4f4fc3bfe6 win-capture: Restore Vulkan 1.1 version hack 2020-03-07 20:07:56 -08:00
jpark37
3439be57fe win-capture: Support VK_FORMAT_A8B8G8R8_UNORM_PACK32 2020-03-07 09:58:07 -08:00
jp9000
87f5bd6e9f win-capture/graphics-hook: Fix wrong HWND
Game capture assumes the top-level ancestor HWND, not a child HWND.
This fixes bugs such as the VLC window not capturing anymore due to the
fact that the capture HWND of VLC is a child window of the main VLC
window and not the main VLC window itself.
2020-03-07 07:35:34 -08:00
Jim
abff240d2a
Merge pull request #2466 from jpark37/win-capture-cleanup
win-capture clean-up
2020-03-07 04:46:13 -08:00
jp9000
5dcad74019 win-capture: Set ALL APPLICATION PACKAGES perms if elevated 2020-03-07 04:01:13 -08:00
jp9000
465174413a win-capture: Remove microsoft store from capture blacklist 2020-03-06 21:53:53 -08:00
jpark37
9da6a4d6f6 win-capture: Vulkan capture clean-up
Remove unnecessary DXGI swap chain creation, and use VK_NULL_HANDLE.
2020-03-06 17:04:31 -08:00
jpark37
fc4f3c0934 win-capture: Clean up various VC++ warnings 2020-03-06 17:02:38 -08:00
craftwar
3821a0344e win-capture: Fix format string warning 2020-03-06 19:52:02 +08:00
jp9000
72bb592673 win-capture: Increment graphics hook version 2020-03-06 03:39:56 -08:00
jpark37
c706a7bed5 win-capture: Handle NULL VkApplicationInfo 2020-03-05 21:20:00 -08:00
jp9000
ec247ba982 win-capture: Find correct window even if it's minimized
In window capture, it will search for a window with a specific title,
but will not search minimized windows.  This fixes that by making is
acquire the correct window even if that window is minimized, rather than
potentially risk it capturing the wrong window of the same type.
2020-03-04 22:21:45 -08:00
jp9000
d5974b9e30 win-capture: Disable correct capture method index
When "Automatic" was added, the index for the item that needed to be
disabled became incorrect (to disable WCG).
2020-03-03 21:09:54 -08:00
VodBox
9aedc7e5b7 win-capture: Prevent WGC being selected when unavailable 2020-03-03 23:06:25 +13:00
jp9000
e40f2cc155 win-capture: Fix registry lookup bug
The make_filename command was misplaced.  Was meant to be right below
the get_programdata_path call.
2020-02-29 10:32:20 -08:00
jp9000
7e78c17ace win-capture: Check hook version before capture init
Checks the hook version to ensure compatibility with hook DLL.  It's
unlikely it'll ever be necessary to increment the hook version, but this
is just a precautionary thing that allows a hook DLL to make sure it's
rejected by an older OBS version if needed.  Again however, very
unlikely that the major version will ever be incremented.
2020-02-29 04:53:29 -08:00
Matthieu Cunzi
74acbd7ed0 win-capture: Add Vulkan capture
Co-authored-by: jp9000 <obs.jim@gmail.com>
Co-authored-by: jpark37 <jpark37@users.noreply.github.com>
2020-02-29 04:53:28 -08:00
jp9000
72e770458f win-capture: Use full DLL path for inject helper
The inject helper should be able to specify the full path rather than
assume the path of the hook DLL.  This change allows us to modify the
hook's location.  This needs to be done because the hook needs to be
relocated to ProgramData to prevent the possibility of multiple Vulkan
capture hooks.
2020-02-29 00:15:54 -08:00
jp9000
a20f1168a7 win-capture/graphics-hook: Don't allow multiple hooks
Prevents multiple separate hook DLLs from being loaded in to a target at
once.  This is done just in the off-chance that someone might add
another hook to the Vulkan layer registry.
2020-02-29 00:15:54 -08:00
jpark37
5c38c6455f win-capture: Refactor create_hook_info 2020-02-29 00:15:54 -08:00
jpark37
39dc64f0f8 win-capture/graphics-hook: Refactor mutex check
OpenMutex doesn't return INVALID_HANDLE_VALUE, so there's no need to
check for that.  Also only call CloseHandle if the call was successful.
2020-02-29 00:15:54 -08:00
jp9000
3e3521b9e1 win-capture/graphics-hook: Fix OBS detection
Fixes where the graphics hook would try to detect if OBS is currently
active or not.
2020-02-28 23:48:11 -08:00
jp9000
ef6a6827f4 win-capture/graphics-hook: Add flog and flog_hr
Allows automatically outputting the function name as part of the hook
logging.  This really doesn't need to be a manual process.  Makes code a
bit cleaner when used.
2020-02-28 23:48:11 -08:00
Jim
0f214bcce6
Merge pull request #1871 from VodBox/game-window-check
win-capture: Fix hook collisions with multiple game captures
2020-02-28 23:47:48 -08:00
jp9000
764d5a2d3f win-capture: Preserve current window setting
This re-uses the game capture code for checking whether the original
window still exists or not.  If it doesn't or the name changed, it'll
insert the value at the top of the list so it doesn't automatically
select another when the user opens properties.

Basically, this fixes an issue where opening properties could sometimes
cause it to instantly capture whatever window was at the top of the
list, which is undesirable.

Closes obsproject/obs-studio#2421
2020-02-27 04:45:21 -08:00
jp9000
ffe4c767c3 win-capture: Move window capture method below window 2020-02-27 03:22:04 -08:00
jpark37
2111a3a02f libobs-winrt: win-capture: Support client area toggle for WGC 2020-02-24 21:31:53 -08:00
jpark37
cce9fb7f95 win-capture: Hide settings if Automatic is WGC 2020-02-24 19:42:46 -08:00
jp9000
572ce73115 win-capture: Add 'auto' method to window capture
Adds an "Automatic" method to the capture method property of window
capture.  This allows the ability for window capture to automatically
determine the best capture method to use.  Primarily, it prefers BitBlt
in most cases, but will use WGC when it detects the window is a browser,
microsoft office, or a UWP program.

This was implemented because the new capture method has a number of
undesired effects associated with it -- the issue of the capture border
that we can do nothing about, the fact that we can't control the capture
of the cursor, and the fact that Microsoft designed it to switch the
cursor away from hardware cursor mode when the capture is active (there
was absolutely no reason to do this because even OBS can capture the
hardware cursor with no issue).  Until we get a new version of this API
that doesn't absolutely blow, we're stuck preferring BitBlt instead.

But hey, at least people will be able to capture browser windows now.
2020-02-22 21:02:33 -08:00
jpark37
ffc48dbbab win-capture: Windows Graphics Capture support
Users will now have the option of legacy window capture via BitBlt, or
Windows Graphics Capture, which is new to Windows 10.

There are two annoyances with the new capture method though. One is that
there is a bright, yellow border added to the original window (but not
the OBS view of it). The other is that the mouse cursor is always
captured, and we won't be able to capture without cursor until a later
version of Windows 10 is released.

It should also be noted that DPI scaling is now applied, which may
result in blurrier images caused by Windows rescaling.
2020-02-22 21:02:33 -08:00
jpark37
d4ca08c4c7 win-capture: Add support for finding windows via EnumWindows
The top-level window appears to be preferred for upcoming Windows
Graphics Capture support, at least for UWP apps.
2020-02-22 21:02:33 -08:00
VodBox
d2e115881d win-capture: Fix hook collisions with multiple game captures
Before this change, after a game capture source would send a signal to
init or restart a graphics hook, it would respond to any and all hook
ready signals.

With multiple game capture sources in the same scene, a source could
receive the signal intended for another source, and show the wrong
texture.

This change adds the window handle to the name for shared data with the
hook, resulting in hooks for other sources being ignored.
2020-02-18 21:20:48 +13:00
Richard Stanway
fb6936a934 win-capture: Faster display / window capture updates
When changing the target for display or window capture, force a
refresh of the source by setting the timer to fire immediately. This
removes 1-3 seconds of "lag" before the new display or window is
visible and makes the UI feel more responsive.

Closes https://github.com/obsproject/obs-studio/issues/2322
2020-02-03 23:22:42 +01:00
Peter Geis
64d0b7fcb4 libobs: Enable compilation on aarch64
Add arch checks to enable aarch-compat layer on aarch64, retain normal
gcc intrinsics on x86 and ppc64.
2019-11-25 13:04:21 -05:00
Clayton Groeneveld
82ffcdc827 UI: Add source icons 2019-11-24 20:50:42 -08:00
tujinshu
76e6a99124 win-capture: Fix rare crash when GL program exits
**Commit message modified and clarified by Jim**

When hooking a program that has both DirectX and OpenGL contexts in use,
it is possible to cause a crash on shutdown due to capture_active()
returning true when an OpenGL context is deleted.  Normally, when
capturing an OpenGL program, this would not happen because the 'active'
variable would not be set due to OpenGL capture not being initialized,
but if DirectX is captured while an OpenGL context is available, and
OpenGL could not load these required functions, then GL can crash due to
trying to use unavailable functions.

This case is extremely rare and doesn't happen under normal
circumstances; only if a program is using both DirectX and OpenGL within
the same program simultaneously, and *only* if OpenGL could not load the
required functions.  This likely almost never happens under normal
programs, games, and hardware.  This was apparently produced by hooking
a GL Qt program that used QWebEngine, which used multiple contexts at
once.
2019-11-05 13:44:15 -08:00
Joel Bethke
6fb3552d70 win-capture: Add additional exe to window capture blacklist
These are additional internal windows processes that should not
be listed in the window capture dropdown.
2019-10-16 19:47:43 -05:00
Jim
6b08c064f6
Merge pull request #2066 from jpark37/feature-level-baseline
Use D3D_FEATURE_LEVEL_10_0 as baseline
2019-10-12 20:55:33 -07:00
jpark37
1ce61c57c0 win-capture: Fix extra duplicator refs
Make duplicator_capture_tick the sole creater, and reference adder of
IDXGIOutputDuplication objects. This prevents a situation where
duplicator_capture::showing cause be false while
duplicator_capture::duplicator was not null at startup on background
scenes, preventing IDXGIOutputDuplication from being recreated when
DXGI_ERROR_ACCESS_LOST.
2019-10-10 19:03:18 -07:00
Gol-D-Ace
03b5be75e4 Update translations from Crowdin 2019-09-17 23:21:00 +02:00
jpark37
3ddef4bf7d win-capture: Remove support for feature level 9.3
Be consistent with libobs-d3d11, which now uses 10_0 as the baseline.
2019-09-08 22:43:41 -07:00
jpark37
ef39715c31 win-capture: Remove unused variable from D3D12 capture 2019-09-08 22:36:25 -07:00
craftwar
e004ce8064 graphics-hook: Fix format specifier 2019-09-02 21:12:27 +08:00
jp9000
d981c10906 Revert "win-capture: Don't leak dynamic library references"
This reverts commit c5928bff4a96977b220027c067ac6b9335b6b4e2.

This breaks game capture.
2019-08-17 12:23:44 -07:00
Michael Fabian 'Xaymar' Dirks
c5928bff4a win-capture: Don't leak dynamic library references 2019-07-24 18:26:45 +02:00
jp9000
f53df7da64 clang-format: Apply formatting
Code submissions have continually suffered from formatting
inconsistencies that constantly have to be addressed.  Using
clang-format simplifies this by making code formatting more consistent,
and allows automation of the code formatting so that maintainers can
focus more on the code itself instead of code formatting.
2019-06-23 23:49:10 -07:00
jp9000
53615ee10f clang-format: Add clang-format files 2019-06-23 01:53:56 -07:00
Gol-D-Ace
973bc481ce Update translations from Crowdin 2019-06-11 01:42:42 +02:00
jp9000
1f39259bc5 win-capture: Add discord to game capture blacklist 2019-06-01 20:07:39 -07:00
geemion
f6581952bc win-capture/graphics-hook: Check if mutex abandoned
It's possible that the mutexes used with shared memory capture to return
WAIT_ABANDONED if OBS is shut down abnormally while the mutex is locked.
2019-04-14 03:44:48 -07:00