Commit graph

199 commits

Author SHA1 Message Date
PatTheMav 4ecfdb722f plugins: Add Linux-specific plugins for CMake build framework 3.0 2024-04-13 23:48:38 -04:00
PatTheMav 2bc4c69ee9 plugins: Fix compile errors introduced by CMake build framework 3.0 2024-04-13 23:48:38 -04:00
Vainock 7ae66c72fd Update translations from Crowdin 2024-02-28 14:20:05 -05:00
Translation Updater ac484a066f Update translations from Crowdin 2024-01-29 20:47:38 +00:00
Translation Updater f674d17168 Update translations from Crowdin 2023-12-05 22:04:31 +00:00
Translation Updater 0d450a34a0 Update translations from Crowdin 2023-10-10 13:34:41 +00:00
Norihiro Kamae d35583dcc8 linux-capture: Remove an unused static function 2023-08-26 16:52:35 -07:00
Translation Updater ecf914dd67 Update translations from Crowdin 2023-08-13 14:09:15 +00:00
Penwywern e9c12b7d9d linux-capture: Add hook signal and proc for Xcomposite window capture 2023-07-30 14:06:53 -07:00
Norihiro Kamae dcb5b0785b linux-capture: Remove obsolete property swap_redblue
The implementation to swap red and blue by the property was removed by
9b6d39299e but the property was left.
2023-06-22 09:26:27 -03:00
Norihiro Kamae 6815c09aba linux-capture: Remove obsolete translation
"LockX" was added by 15fb027647 and removed by later commit 1604400e4.
2023-05-20 16:35:05 -07:00
Translation Updater 7c5560bf1b Update translations from Crowdin 2023-03-27 13:39:03 +00:00
tytan652 1007a0cf42 linux-capture: Fix format-overflow warning 2023-01-19 13:08:46 -05:00
tytan652 2839837ed6 plugins: Fix -Wsign-compare on Linux 2023-01-19 13:08:46 -05:00
tytan652 7de0bd350f libobs,plugins: Remove one-case switches 2023-01-16 11:43:47 +01:00
Translation Updater 783bd52197 Update translations from Crowdin 2023-01-08 04:10:37 +00:00
PatTheMav ae01a626b6
linux-capture: Replace invocations of sprintf with snprintf
Fixes deprecation warnings in Xcode 14/clang on macOS and reduces
chance of buffer overflows.
2022-11-11 19:51:27 +01:00
Kurt Kartaltepe 1249ebe53d linux-capture: Fixup window name/class checking
There were a couple mistakes here that caused the fallback checks other
than window ID to fail to ever return valid results. This restores this
functionality that was broken since the c++/c transition.

fixes #7404
2022-09-24 20:42:57 -03:00
Kurt Kartaltepe b1c65af2b1 linux-capture: Ensure name pixmap is checked
The void cookie will never return an error unless we use the explicitly
checked version of this function.
2022-09-12 12:50:53 -03:00
Translation Updater cc2d0791ca Update translations from Crowdin 2022-08-30 09:00:44 +00:00
Translation Updater 4aaa07f93d Update translations from Crowdin 2022-08-17 04:22:50 +00:00
Translation Updater 81734be37c Update translations from Crowdin 2022-07-31 23:40:53 +00:00
Vainock eb06594381 Use property suffixes for units everywhere 2022-07-22 08:24:51 -04:00
tytan652 8409f72f60 plugins: Replace OBS_UNUSED with UNUSED_PARAMETER
OBS_UNUSED is not portable to MSVC.
2022-07-20 08:22:08 +02:00
Norihiro Kamae 7e3656ab33 plugins: Cleanup unused-parameters
- Remove unnecessary UNUSED_PARAMETER
- Add OBS_UNUSED attribute to unused parameters
- Also removes unused variables
2022-07-19 11:01:00 -04:00
Kurt Kartaltepe c6cb0838fd linux-capture: Silence log spam on xcomposite capture
It is expected that capture might fail, like when a window is minimized.
In these cases we dont want the log to be spammed by X11 errors so
install a noop error handler while we try to import.
2022-07-10 11:24:40 +10:00
Kurt Kartaltepe e9076da901 linux-capture: Retry capture if texture not created
This prevented OBS from re-aquiring capture when windows were minimized
or fullscreened.
2022-07-10 11:24:40 +10:00
Georges Basile Stavracas Neto ddb692ab2d linux-capture: Drop GLX code paths
Default to EGL and remove the sad amount of hacks from xcomposite.
2022-05-24 14:30:14 -03:00
Kurt Kartaltepe fb639e303c linux-capture: Fix map-like behavior for watcher
The original PR missed assigning the `idx` variable in unregister. When
compiled without asserts this would silently not delete sources. Instead
correctly assign idx and skip unregistration if the source doesnt appear
registered.

fixes #6532
2022-05-24 08:16:10 -03:00
Kurt Kartaltepe 9b6d39299e linux-capture: Add EGL support for xcomposite
When running on EGL we can use the new create_texture_from_pixmap
functions to implement xcomposite capture.

This removes the texture indirection previously implemented for GLX due
to not using the spriting functionality in the built in shaders. Now
that we texture directly from the pixmap we can remove the red/blue swap
workarounds.
2022-05-15 09:08:53 -03:00
Kurt Kartaltepe 1604400e48 linux-capture: Rewrite xcomposite
Generally moves all the plugin code into xcomposite-input.cpp and
removes all C++ dependencies.

Migrate as much as possible to xcb from Xlib to enable us to handle
errors and attribute them to the correct callers. This caused many other
knock on issues such as wrongly attributed errors and cleanup code
working incorrectly.

That allows us to use the xcursor-xcb implementation and delete the pure
Xlib implementation. We also add the missing functionality from the Xlib
implementation to the xcb implementation.

Capture glXCreatePixmap errors which occur most commonly on
nvidia+gnome due to nvidia's driver being unable to allocate more than 1
pixmap per window and gnome being the only compositor to read window
data via glx pixmaps.

Fix cleanup after failed glXCreatePixmap that might have leaked pixmaps
and prevented later captures on nvidia drivers for the same reason.
2022-05-14 17:01:08 -03:00
PatTheMav aae3a6a466 cmake: Fix diverging prefix padding for OBS status outputs
Status output related to OBS configuration is prefixed with the string
"OBS" and added padding for enabled and disabled features. This padding
was not aligned between platforms.

By moving the padding and prefix decoration into its own function,
both elements are controlled in a single place. CMake scripts were
changed to use this new function `obs_status` instead of using CMake's
`message` function directly.
2022-03-26 09:44:23 -04:00
Georges Basile Stavracas Neto a147315f33 project: Migrate PipeWire capture into linux-pipewire
The capture ids are preserved, so that it's compatible with the
previous code. No code changes were necessary whatsoever.
2022-03-20 20:53:39 -03:00
PatTheMav 49e9d49943
plugins: Update CMakeLists.txt for included plugins 2022-03-16 23:11:08 +01:00
Florian Zwoch d16950a2f6 linux-capture: Fix for pipewire capture leaking texture handles
Enter the graphics context before calling gs_texture_destroy() or
else the call will fail causing the texture handles to leak.
2022-02-19 20:06:03 -03:00
Translation Updater ac8dbf67be Update translations from Crowdin 2022-02-06 02:24:08 +00:00
Cenk Uluisik f52f34b614 linux-capture: Fix missing parameter for pipewire capture
Commit a3a6710 introduced the obs_pipewire_save() function in the
PipeWire code, but only set it to the monitor capture source. This
was an oversight, it should have been set to the window capture
source as well.

Set the .save vfunc of the window capture source as well.

Closes obsproject/obs-studio#5906
2022-02-04 13:09:12 -03:00
Tatsuyuki Ishi b684e01aad linux-capture: Disable strict binding for NVIDIA drivers
NVIDIA drivers appears to have a bug where binding would be excessively
slow. Apply a workaround similar to what [KWin] does to prevent the issue.

Also performs a refactor so that the code paths with and without the
workaround can be shared.

[KWin]: 4f2c3a00c4/src/libkwineffects/kwinglplatform.cpp

Fixes: 316f858c6 ("linux-capture: Fix capturing on software rasterization setups")
Closes: https://github.com/obsproject/obs-studio/issues/5685

Tested-By: univrsal <uni@vrsal.xyz>
2022-01-07 15:21:09 -08:00
Georges Basile Stavracas Neto a200001d2a linux-capture: Standardize gs_color_format variable names
Name them all to 'gs_format'. We need to be a bit strict with
naming here, since we're dealing with 3 format namespaces (OBS,
PipeWire, and DRM).
2021-12-30 18:41:04 -03:00
Georges Basile Stavracas Neto 64bb5a0974 linux-capture: Unify format lookups
Merge all format lookup functions into a single one, with all
out parameters optional.
2021-12-30 18:41:04 -03:00
Georges Basile Stavracas Neto f0026142f0 linux-capture: Move supported formats into a static table
We've been listing the supported formats in place whenever we
needed so far, but now we're doing it in too many different
places, which is getting confusing.

Move all these sparsely written rules into one single table
of formats, and adjust the code to lookup data on it.
2021-12-30 18:41:04 -03:00
Georges Basile Stavracas Neto d876e735e0 linux-capture: Split array into two variables
Split the 'f' array in two named variables, and move one of
these variables to the appropriate context where its used.

No functional changes.
2021-12-30 18:41:04 -03:00
Georges Basile Stavracas Neto 52a3a8817d linux-capture: Add preferred value out of the loop
Choice pods are built with the first element being the
preferred choice, followed by a list of possible choices.

We add the preferred choice inside the loop, which makes
the code slightly harder to follow.

Factor this out of the loop, into a separate step.
2021-12-30 18:41:04 -03:00
Georges Basile Stavracas Neto 37ba341d3a linux-capture: Rename a variable
'modifierless' is a bit non-descriptive given the lack of a
verb in the variable name. Rename it to 'use_modifiers', and
swap the logic.
2021-12-30 18:41:04 -03:00
columbarius 0532a5c1f0 linux-capture: Fix Ubuntu 21.10 builds
Ubuntu 21.10 provides PipeWire 0.3.32 which is missing the
`SPA_POD_PROP_FLAG_DONT_FIXATE` required for proper DMA-BUF negotiation.
Since this isn't implemented in the DE's of this Ubuntu version just
defining this flag won't have any impact.

Revert after support for Ubuntu 21.10 ended.
2021-12-22 14:27:53 -03:00
columbarius 13693bd199 linux-capture: Add fallback for PipeWire < 0.3.40
Proper DMA-BUF format and modifier negotiation is possible with PipeWire
0.3.40. This commit adds checks for older versions and allows to build
against them.

These are classified as follows:
* PipeWire server older than 0.3.24: Restrict to SHM only
* PipeWire server between 0.3.24 (incl.) and 0.3.40: Announce modifiers
  along with the old method. On failed import drop all modifiers.
* PipeWire server 0.3.40 and newer: Announce modifiers along with the
  old method. On failed import drop only a single modifier.
2021-12-22 14:27:53 -03:00
columbarius abbec90e7e linux-pipewire: Handle DMA-BUF import failure
Importing a DMA-BUF can fail even if the renderer announces support for
the used format modifier pair. This can be caused by a number of reasons
specific to the underlying hardware and api [1]. In that case we want to
remove that modifier from our list of supported ones and renegotiate.

This feature was added in PipeWire 0.3.40. On previous versions the best
we can do is drop all modifiers an fallback to DMA-BUF with another
format or directly to the SHM buffer transport. This mechanism is
demonstrated in [2].

[1] https://xdc2020.x.org/event/9/contributions/615/attachments/704/1301/XDC_2020__Allocation_Constraints.pdf
[2] https://gitlab.freedesktop.org/pipewire/pipewire/-/blob/master/src/examples/video-play-fixate.c
2021-12-22 14:27:53 -03:00
columbarius c31aba9600 linux-capture: Announce supported modifiers via PipeWire
Sharing DMA-BUFs via PipeWire requires the client to announce all
formats together with their supported modifiers. [1]

[1] https://docs.pipewire.org/page_dma_buf.html
2021-12-22 14:27:53 -03:00
columbarius b57f7f0aed linux-capture: Bump minimal PipeWire version to 0.3.33
We require PipeWire 0.3.33 or later to make use of the introduces flags
`SPA_POD_PROP_FLAG_MANDATORY`  and `SPA_POD_PROP_FLAG_DONT_FIXATE`,
which are required for the negotiation process introduced in the
following commits.
2021-12-22 14:27:53 -03:00
Georges Basile Stavracas Neto e41e845272 linux-pipewire: Use DRM fourcc defines directly
It was naive to add these defines here to avoid a direct include when
the entire platform already depends on the DRM subsystem. Just include
it and let it provide the image formats.
2021-12-22 14:27:53 -03:00