0
0
mirror of https://github.com/obsproject/obs-studio.git synced 2024-09-20 04:42:18 +02:00
Commit Graph

12 Commits

Author SHA1 Message Date
tytan652
7de0bd350f libobs,plugins: Remove one-case switches 2023-01-16 11:43:47 +01: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
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
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
Georges Basile Stavracas Neto
09b5290c7b linux-capture: Load XSHM capture on EGL/X11
Unlike Xcomposite, the XSHM plugin does not use GLX code, and thus
can be used on when EGL renderer is used. It still is X11-specific
though, and shouldn't be used on Wayland.

Rework the obs_module_load() function of linux-capture to use a
switch statement, and load XSHM both on EGL/X11 and GLX/X11.

Fixes https://github.com/obsproject/obs-studio/issues/5122
2021-08-15 00:13:00 -07:00
Georges Basile Stavracas Neto
10a1a708fb linux-capture: Return different descriptions for different captures
Use the current description for X11 / GLX, and a new description for all
PipeWire-based captures (EGL/X11 and EGL/Wayland)
2021-03-29 17:00:31 -03:00
Georges Basile Stavracas Neto
c2f8b2058b linux-capture: Add PipeWire-based capture
Add a new Linux capture based on PipeWire [1] and the Desktop portal [2].

This new capture starts by asking the Desktop portal for a screencapture session.
There are quite a few D-Bus calls involved in this, but the key points are:

 1. A connection to org.freedesktop.portal.ScreenCast is estabilished, and the
    available cursor modes are updated.

 2. CreateSession() is called. This is the first step of the negotiation.

 3. SelectSources() is called. This is when a system dialog pops up asking the
    user to either select a monitor (desktop capture) or a window (window capture).

 4. Start() is called. This signals the compositor that it can setup a PipeWire
    stream, and start sending buffers.

The reply to this fourth call gives OBS Studio the PipeWire fd, and the id of the
PipeWire node where the buffers are being sent to. This allows creating a consumer
PipeWire stream, and receive the buffers.

Metadata cursor is always preferred, but on the lack of it, we ask the stream for
an embedded cursor (i.e. the cursor is drawn at the buffer, and OBS Studio has no
control over it.)

Window capturing is implemented as a crop operation on the buffer. Compositors
can send big buffers, and a crop rectangle, and this is used to paint a subregion
of the buffer in the scene.

The new capture is only loaded when running on EGL, since it depends on EGL to
call gs_texture_create_from_dmabuf().

[1] https://pipewire.org/
[2] https://github.com/flatpak/xdg-desktop-portal/
2021-03-29 17:00:31 -03:00
Georges Basile Stavracas Neto
9810fe9220 linux-capture: Fail to load when running on EGL
Right now, linux-capture hard-depends on GLX. Disable it when
running under EGL.
2021-02-01 19:05:11 -03:00
Kurt Kartaltepe
d86c8121ed Plugins: Add descriptions to modules 2018-09-11 18:28:58 -07:00
jp9000
15fb027647 Combine linux-xcomposite and linux-capture (xshm) 2014-08-29 17:20:02 -07:00
jp9000
a9cd60a78f Rename linux-xshm module to linux-capture 2014-08-29 17:19:30 -07:00