177 Commits

Author SHA1 Message Date
jpark37
9eaf2fa766 linux-capture: Add OBS_SOURCE_SRGB flag 2021-05-03 01:19:56 -07:00
tytan652
66d79a926a linux-capture: Ask for PipeWire if deps not found
CMake will now emit a fatal error if PipeWire or Gio are not present.
2021-04-09 06:44:53 -07:00
Georges Basile Stavracas Neto
84b4257276 linux-capture: De-escalate assertion to a warning
The assertion exposed a bug in the KDE implementation of the Desktop
portal. However, it comes with the side effect of exiting OBS Studio
in this case, where we can actually make it work (even if buggy).

De-escalate the assertion to a warning, and then attempt to find the
correct stream to use.
2021-04-05 03:11:30 -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
a0464b0f8f linux-capture: Shuffle around CMake code
In preparation for the introduction of the new PipeWire-based capture,
use variables for include_directories() and target_link_libraries(),
and move them to the bottom of the file.
2021-03-29 17:00:31 -03:00
Jim
190ab876cc
Merge pull request #2484 from GeorgesStavracas/feaneron/egl-wayland
EGL/Wayland (Wayland, pt 3)
2021-02-12 01:30:05 -08:00
Jim
40a47b3af4
Merge pull request #3047 from MaZderMind/bugfix/3040
linux-capture: Fix Problems with the Window-Selection of the XComposite Source
2021-02-01 14:18:12 -08: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
c12ccd4e15 linux-capture: Ensure locks are initialized
In case no-one else initializes X11 locks do this as part of loading the
module.

Fixes #3479
2021-01-28 13:11:16 -08:00
Kurt Kartaltepe
0dce235fdb linux-capture: Fix lock ordering
xcompcap was taking locks in the wrong order resulting in deadlocks on
close. If you had an xcompcap properties window open on close it was
nearly 100% deadlock. This ensures locks are taken in the same order as
libobs takes when shutting down.
2021-01-26 03:33:05 -08:00
MaZderMind
9afd1c99bd linux-capture: Remove unused code 2021-01-24 16:36:41 -08:00
MaZderMind
6bb39ea3de linux-capture: scan for re-created windows more often 2021-01-24 16:36:41 -08:00
MaZderMind
4b8c490ed5 linux-capture: XSelectInput tracking improvement
Track all windows corresponding to sources and ensure that we only
disable XSelectInput events once all sources for a given window have
been removed. Previously we may have stopped listening for events if
multiple sources captured the same window and one was removed.

We also move window redirection into the helper to avoid similar issues.
2021-01-24 16:35:45 -08:00
MaZderMind
a92c68fb9f linux-capture: Capture windows by id first
Previously we only captured by window name and class. This prevented
capture of windows with the same name and class, and caused captures to
switch from one window to another of the same name and class.
2021-01-24 15:04:26 -08:00
jpark37
33b744270a linux-capture: Support linear SRGB
Well, linear SRGB for screen capture. The window capture path failed to
copy between SRGB textures for some reason, so just force nonlinear
formats instead.
2021-01-21 07:42:57 -08:00
Gol-D-Ace
7368a2c7cc Update translations from Crowdin 2020-12-14 00:29:44 +01:00
Gol-D-Ace
7ab98ca00f Update translations from Crowdin 2020-11-25 20:11:39 +01:00
Gol-D-Ace
c66ebde080 Update translations from Crowdin 2020-09-27 23:07:27 +02:00
Jim
f40abba2d4
Merge pull request #2790 from hosaka-corp/crop-xshm-capture
linux-capture: Add support for cropping the input source
2020-06-26 01:41:48 -07:00
jp9000
7993179466 cmake: Add cmake folders 2020-05-13 06:52:37 -07:00
meta
06db185fa1 linux-capture: Add support for cropping input source
Adds support and relevant properties for cropping screen capture input.
2020-04-23 18:39:04 -05:00
Jim
8e7481fb75
Merge pull request #2497 from keith-packard/linux-capture-randr-monitors
linux-capture: Use RandR monitors for screen information
2020-03-21 19:46:41 -07:00
Gol-D-Ace
d74fc65047 Update translations from Crowdin 2020-03-16 20:14:50 +01:00
Keith Packard
96924553f0 linux-capture: Use RandR monitors for screen information
RandR has two sets of screen geometry information:

 1. CRTC. These are the physical scanout engines in the hardware

 2. Monitors. These are the logical partitions of the screen.

By default, each CRTC gets mapped to a Monitor. However, some monitors
actually require two CRTCs to drive them due to limitations in the
scanout hardware. Users can also create 'virtual' monitors to support
VNC or other systems.

This patch makes the RandR code prefer the Monitor mechanism to the
older CRTC mechanism. If the server doesn't support a new enough RandR
version, the existing CRTC code is used instead.

The name of the monitor is also provided in place of the arbitrary
number to help users select the desired source.

Signed-off-by: Keith Packard <keithp@keithp.com>
2020-03-13 18:29:35 -07:00
Clayton Groeneveld
82ffcdc827 UI: Add source icons 2019-11-24 20:50:42 -08:00
Chris Angelico
fd668695db linux-capture: Fix cursor draw bug when cropping window cap.
When cropping the left or top of a window capture, OBS would misalign
the drawn cursor, placing it as if the entire window were being
captured. Instead, offset the captured cursor by the same number of
pixels, thus placing the cursor back where it belongs.
2019-11-20 22:09:47 -08:00
Ford Smith
003e8474d3 linux-capture: Fix bug with xshm input showing multiple 0x0 windows 2019-10-02 13:51:28 -04:00
Gol-D-Ace
03b5be75e4 Update translations from Crowdin 2019-09-17 23:21:00 +02:00
Kurt Kartaltepe
e39e13e7b8 linux-capture: Texture unbound after GS_GL_DUMMYTEX changes 2019-08-17 22:47:32 -07:00
Kurt Kartaltepe
1402a80583 linux-capture: Revert GS_RGBX usage 2019-08-11 18:30:23 -07:00
Kurt Kartaltepe
4ac77ee970 linux-capture: Fix xcompcap robustness
Move xlock after initial window listing
	- XErrorLock uses static fields so when you use them recursively
	  they collide and do weird things. This keeps the two xlocks from
      colliding.

Build obs textures based on returned pixmap texture types to ensure
compatibility during copies. (prevents glCopyImageSubData failed due to
texture incompatibilities)

Fix alpha check by using pixmap depth instead of checking channel sizes
(wrong on nvidia and maybe amd hardware)

Fix X error checking, now you will get 1 BadAlloc when pixmap allocation
fails instead "glCopyImageSubData failed" every frame. (occurs on Gnome
under special circumstances)
2019-07-08 20:27:26 -07: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
Gol-D-Ace
973bc481ce Update translations from Crowdin 2019-06-11 01:42:42 +02:00
Gary Kramlich
758868093b linux-capture: Add randr support
Add randr suport to the xshm plugin and prefer it over xinerama.

Add libxcb-xrandr0-dev as CI dependency
2019-04-05 16:05:59 -05:00
Gol-D-Ace
e78ac5ebef Update translations from Crowdin 2019-04-04 16:19:51 +02:00
Gol-D-Ace
c3711bdd5e Update translations from Crowdin 2019-02-20 22:26:07 +01:00
Jim
e7fcd71715
Merge pull request #1513 from SingularityAzure/linux-capture-xcompcap-singularity
linux-capture: XCompCap now chooses glXFBConfigs based on window depth
2019-01-04 06:36:02 -08:00
Philip Haynes
bb42c8dfb6 linux-capture: XCompCap now chooses glXFBConfigs based on window depth
Rather than inheriting the exact visuals from the window,
find whether the color buffer has alpha, find a config with
the necessary attributes for capture, and match its depth to
the depth of the window instead of the color buffer. Also,
cleanup glxpixmap texture binding before destroying the texture.

Update: Style conformancy changes
2018-10-12 00:33:32 -05:00
Jim
2a08f1d144
Merge pull request #1495 from SingularityAzure/linux-capture-xcompcap-singularity
linux-capture: Fix repeated color-swapping and improve robustness further
2018-09-24 14:55:09 -07:00
Philip Haynes
c286f0c202 linux-capture: Fix repeated swapping of swapRedBlue and improve robustness further
Previously toggled swapRedBlue every update regardless of settings being set, which resulted in
moving or resizing of windows causing undesired color-swapping behavior. Also now use more direct
method of comparing visualIDs without type-casting and base the glxpixmap attributes on texture
format being used rather than the bit-depth of the window.
2018-09-23 17:54:18 -05:00
Jim
47285c2ba6
Merge pull request #1485 from SingularityAzure/linux-capture-xcompcap-singularity
linux-capture: Improve XComposite capture robustness
2018-09-22 14:20:43 -07:00
Jim
af320a0838
Merge pull request #1480 from kkartaltepe/module-descriptions
Plugins: Add descriptions to modules
2018-09-16 15:34:28 -07:00
Philip Haynes
5fe6feb59a linux-capture: Improve XComposite capture robustness
Adds support for windows with alpha channels as well as swapping red
and blue when using GS_BGRX. glXFBConfig now attempts to inherit
its format from the captured window when possible.

Change log message
2018-09-13 10:53:20 -05:00
Kurt Kartaltepe
d86c8121ed Plugins: Add descriptions to modules 2018-09-11 18:28:58 -07:00
Gol-D-Ace
a79aaa28ab Update translations from Crowdin 2018-08-18 04:16:35 +02:00
Jim
47043b2566
Merge pull request #1220 from admshao/opengl-color-info
Opengl color info
2018-03-15 16:36:31 -07:00
Gol-D-Ace
88282c168c Update translations from Crowdin 2018-03-15 09:00:28 +01:00
Shaolin
b452338f62 linux-capture: Request at least 8 bits for alpha
10bpc support is under active development all over the linux stack
so while we wait for it to mature, request an alpha size of 8.
2018-03-12 22:36:50 -03:00
Gol-D-Ace
ae22886f67 Update translations from Crowdin 2018-01-22 04:55:52 +01:00