0
0
mirror of https://github.com/obsproject/obs-studio.git synced 2024-09-20 13:08:50 +02:00
Commit Graph

187 Commits

Author SHA1 Message Date
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
Ryan Foster
79c0f0105c linux-capture: Log window capture's target
Closes jp9000/obs-studio#983
2017-11-26 18:01:28 -08:00
Jim
dde03af95e Merge pull request #987 from seirl/master
Add fix to watch for VisibilityNotify events.
2017-09-12 05:30:36 -07:00
Gol-D-Ace
8d8c2e5a22 Update translations from Crowdin 2017-08-10 16:07:40 +02:00
Aidan Epstein
f4a8137412 linux-capture: Watch for VisibilityNotify events
Some window managers like i3 don't issue Expose events when switching
between workspaces, but send VisibilityNotify events. This causes the
stream to freeze even when the workspace is switched back.

Related issue: #863
2017-08-07 12:33:29 +02:00
Gol-D-Ace
3d2cacd782 Update translations from Crowdin 2017-05-20 10:18:41 +02:00
Gol-D-Ace
dbf95bdc15 Update translations from Crowdin 2017-03-05 23:40:11 +01:00
Gol-D-Ace
6223ed6520 Update translations from Crowdin 2017-01-07 00:23:16 +01:00
Gol-D-Ace
69f0bc244a Update translations from Crowdin 2016-12-23 20:46:47 +01:00
Gol-D-Ace
2d47dc4e2c Update translations from Crowdin 2016-11-20 12:22:26 +01:00
Gol-D-Ace
90e805ad9b Update translations from CrowdIn 2016-11-16 00:32:47 +01:00
Gol-D-Ace
aadc7263c0 Update translations from Crowdin 2016-09-28 01:17:24 +02:00
Gol-D-Ace
cb036b2713 Update translations from Crowdin 2016-08-08 16:21:48 +02:00
Christoph Hohmann
83aab23242 linux-capture: Add OBS_SOURCE_DO_NOT_DUPLICATE to window capture sources
It seems that it is not possible to create multiple OpenGL textures
for the same window. When sources are duplicated in studio mode this
causes window capture sources to become black. The
OBS_SOURCE_DO_NOT_DUPLICATE flag prevents that this happens.
2016-07-18 18:05:40 +02:00
Gol-D-Ace
81adb13f59 Update translations from Crowdin 2016-07-06 01:18:27 +02:00
jp9000
ee4febcd06 linux-capture: Don't find window via class if class empty 2016-07-03 22:27:38 -07:00
jp9000
e389ae8a75 linux-capture: Additionally search windows via WM_CLASS
If window capture fails to find a window with a matching title, search
for a window with the same window class additionally as a backup.

Replaces the third part of the internal window string with the class
name instead of the program path due to the fact that the program path
rarely seemed to work.
2016-07-02 23:49:19 -07:00
jp9000
57d580f8a9 linux-capture: Convert window strings to UTF-8 strings
The UI expects everything to be in UTF-8, so convert all window strings
to UTF-8 whenever getting a window name.
2016-06-05 19:25:37 -07:00
jp9000
5d16e44899 linux-capture: Fix window capture crashes
The xcomposite window capture crashes were due to a few factors:
-------------------------------
1.) The source's X error handler was possibly being overwritten by
another part of the program despite us locking the display, presumably
something in Qt which isn't locking the display when pushing/popping its
own error handler (though this is not yet certain).  The source's calls
to X functions happen in the graphics thread, which is separate from the
UI thread, and it was noticed that somehow the error handler would be
overwritten almost seemingly at random, indicating that something else
in the program outside of OBS code was not locking the display while
pushing/popping the error handler.

To replicate this, make it so that the source cannot find the target
window and so it continually searches for it each video_tick call, then
resize the main OBS window continually (which causes Qt to push/pop its
own error handlers).  A crash will almost always occur due to BadWindow
despite our error handling.

2.) Calling X functions with a window ID that no longer exists,
particularly XGetWindowAttributes, in conjunction the unknown error
handler set in case #1 would cause the program to outright crash because
that error handler is programmed to crash on BadWindow for whatever
reason.  The source would call X functions without even checking if
'win' was 0.

3.) The source stored window IDs (in JSON, even if they've long since
become invalid/pointless, such as system restarts).  This is a bad
practice and will result in more cases of BadWindow.

Fixing the problem (reducing the possibility of getting BadWindow):
-------------------------------
Step 1.) Deprecate and ignore window IDs in stored settings.  Instead of
using window IDs to find the window, we now must always search the
windows and find the target window via the window name exclusively.
This helps ensure that we actually consistently have a working window
ID.

Step 2.) Do not call any X functions if the window ID is 0.

Step 3.) Reset the window ID to 0 any time the window has updated, and
make the source find the window again to ensure it still exists before
attempting to use any X functions on the window ID again.
2016-06-05 00:12:43 -07:00
Gol-D-Ace
fe56a12867 Update translations from Crowdin 2016-05-14 00:27:59 +02:00
Gol-D-Ace
5ed7081213 Update translations from Crowdin 2016-04-23 10:29:21 +02:00
Aesen Vismea
9cf56f8b4c linux-capture: Add "Use alpha-less texture format" option
This is to work around a Mesa issue that prevents copying
between RGB and RGBA textures. Other drivers seem to allow
this, even though it's technically not allowed by the GL
spec.

Closes jp9000/obs-studio#514
2016-04-08 03:17:33 -07:00
jp9000
69da1151e0 Update translations from Crowdin 2016-03-19 12:08:48 -07:00
Charles Ray Shisler III
2e642fcc61 linux-capture: Remove red background from texture
When a source window was not available, a red background was shown
instead. This was undesirable, and expected behavior would be for the
background to be transparent, enabling what exists behind the source
to be shown.
2016-02-21 19:15:21 -08:00
Charles Ray Shisler III
2bdc1e9d7c linux-capture: Fix texture lingering after window closes
After source window closes, texture is still visible in preview until
the source window opens again.
2016-02-21 18:59:30 -08:00
Gol-D-Ace
2b7036dc93 Add latest translations from Crowdin 2016-02-21 22:16:12 +01:00
jp9000
cd97ce2a17 libobs: Add source output flag OBS_SOURCE_DO_NOT_DUPLICATE
Certain types of sources (display captures, game captures, audio
device captures, video device captures) should not be duplicated.  This
capability flag hints that the source prefers references over full
duplication.
2016-01-26 11:49:50 -08:00
jp9000
756fec3503 linux-capture: Clear x events when exiting handler
This is probably not necessary but might fix an issue where errors pass
through to other parts of the program, possibly causing the crash on
exit related to the xcomposite capture.
2016-01-26 11:49:21 -08:00
Lucian Poston
c392164f03 linux-capture: Log warning when unable to query windows
Checks whether window manager supports ewmh. Logs warning if ewmh is not
supported.

Closes jp9000/obs-studio#488
2016-01-26 11:49:20 -08:00
Gol-D-Ace
2ee1d82860 Add latest translations from Crowdin 2015-11-16 21:04:55 +01:00
jp9000
6ad8df8adb (API Change) libobs: Use single func for base effects
API removed:
--------------------
gs_effect_t *obs_get_default_effect(void);
gs_effect_t *obs_get_default_rect_effect(void);
gs_effect_t *obs_get_opaque_effect(void);
gs_effect_t *obs_get_solid_effect(void);
gs_effect_t *obs_get_bicubic_effect(void);
gs_effect_t *obs_get_lanczos_effect(void);
gs_effect_t *obs_get_bilinear_lowres_effect(void);

API added:
--------------------
gs_effect_t *obs_get_base_effect(enum obs_base_effect effect);

Summary:
--------------------
Combines multiple near-identical functions into a single function with
an enum parameter.
2015-10-19 00:52:45 -07:00
dodgepong
76c18b079b Latest translations from CrowdIn 2015-09-22 23:33:29 -04:00
jp9000
6285a47726 (API Change) libobs: Pass type data to get_name callbacks
API changed from:
obs_source_info::get_name(void)
obs_output_info::get_name(void)
obs_encoder_info::get_name(void)
obs_service_info::get_name(void)

API changed to:
obs_source_info::get_name(void *type_data)
obs_output_info::get_name(void *type_data)
obs_encoder_info::get_name(void *type_data)
obs_service_info::get_name(void *type_data)

This allows the type data to be used when getting the name of the
object (useful for plugin wrappers primarily).

NOTE: Though a parameter was added, this is backward-compatible with
older plugins due to calling convention.  The new parameter will simply
be ignored by older plugins, and the stack (if used) will be cleaned up
by the caller.
2015-09-16 09:21:12 -07:00
Gökberk Yaltıraklı
8efbcc599a linux-capture: Try to reacquire lost windows
When a window being captured is closed, it never tries to reacquire.
This just searches for the window in video_tick and reacquires if the
currently set window is found again.

Closes jp9000/obs-studio#465
2015-08-16 09:35:10 -07:00
dodgepong
d0fbe3b382 Add latest translations from CrowdIn 2015-05-08 17:10:39 -04:00
fryshorts
cee8c6efa6 linux-capture: Fix documentation
Fix argument name in the documentation to match the code.
2015-04-08 23:02:58 +02:00
dodgepong
a04548070c UI: Add latest translations from CrowdIn 2015-03-25 20:51:25 -04:00
jp9000
e20ec366b2 Make capture sources w/o alpha use opaque effect
This fixes an issue primarily with filter rendering: when capturing
windows and displays, their alpha channel is almost always 0, causing
the image to be completely invisible unintentionally.  The original fix
for this for many sources was just to turn off the blending, which would
be fine if you're not rendering any filters, but filters will render to
render targets first, and that lack of alpha will end up carrying over
in to the final image.

This doesn't apply to any mac captures because mac actually seems to set
the alpha channel to 1.
2015-03-22 19:18:05 -07:00
jp9000
233004631f linux-capture: Mark captures as custom drawn
The linux window and monitor captures draw in a custom way, therefore
they must be marked as types of sources that do custom rendering.
2015-03-22 18:38:49 -07:00
dodgepong
eb918d01b4 Add latest translations from CrowdIn 2015-02-09 19:26:17 -05:00
fryshorts
35ed828bc2 linux-capture: Fix crash on missing texture
Add a check to the cursor render function to ensure the cursor texture
exists. It seems like it is very unlikely but still possible, that the
first tick which should set the texture might fail. In that case obs
would crash in the render function.
2015-01-13 22:22:39 +01:00
fryshorts
e009c7951d linux-capture: Fix possible null dereferences
Add checks for valid pointers when requesting the cursor information and
pixel data.
2015-01-13 22:19:47 +01:00
jp9000
b277f2b737 Don't update video of sources if not displaying
This is a bit of an optimization to reduce load a little bit if any of
the video capture sources are not currently being displayed on the
screen.  They will simply not capture or update their texture data if
they are not currently being shown anywhere.

The mac and window game capture sources don't really apply due to the
fact that their textures aren't updated on the source's end (they update
inside of the hooks).
2015-01-05 02:10:32 -08:00
Jim
903bb137a0 Merge pull request #312 from fryshorts/xshm-xcb-conversion
linux-capture: Xshm plugin xcb conversion
2014-12-28 23:31:32 -08:00
raincomplex
01491a96d3 Mark windows changed on Expose
On i3wm, windows aren't unmapped when switching away from a window's
workspace, but it does cause OBS to lose the capture. Because
switching back will not trigger a MapNotify, the capture fails to
restart unless you resize or move the window (ConfigureNotify). An
Expose event is fired by the wm, however, so catching this correctly
restarts the capture.
2014-12-24 15:23:08 -05:00
fryshorts
db9b71b80b linux-capture: Refactor source data
Remove comments from and align members in the source data struct for the
xshm capture plugin.
2014-12-22 00:47:44 +01:00
fryshorts
ed839dce19 linux-capture: Remove unused dependencies
Remove dependencies from cmake that are no longer needed due to the
port to xcb.
2014-12-22 00:47:44 +01:00
fryshorts
2dffa894f3 linux-capture: Port display connection to xcb
Remove the last bits of Xlib code from the xshm capture plugin and use
xcb exclusively.
2014-12-22 00:30:14 +01:00
fryshorts
114ccd33ee linux-capture: Port geometry functions to xcb
Replace XLib code with xcb in the geometry helper functions.
2014-12-22 00:13:42 +01:00
fryshorts
4d2e730bfa linux-capture: Remove XLib based shm helpers
Remove the old XLib based shm helper functions from xhelpers.
2014-12-22 00:13:41 +01:00
fryshorts
008f4467f0 linux-capture: Use xcb to check for extensions
Use the previously added helper function to check for needed extensions.
2014-12-22 00:13:41 +01:00
fryshorts
aa016706a2 linux-capture: Port cursor handling to xcb
Use the new xcb based cursor library to handle the cursor in the
xshm plugin.
2014-12-22 00:13:41 +01:00
fryshorts
38f2c57c12 linux-capture: Port xshm handling to xcb
Use the new xcb based xshm functions to attach the shared memory segment
and capture the image from the xserver.
2014-12-22 00:13:41 +01:00
fryshorts
e20cf649b8 linux-capture: Add xcb screen to source data
Add xcb screen structure to the source data for later use in the porting
process.
2014-12-22 00:13:41 +01:00
fryshorts
53ee22ae5a linux-capture: Add xcb connection to source data
Add a xcb connection to the source data for the xshm capture for later
use in the porting process.
2014-12-22 00:13:41 +01:00
fryshorts
4ad41004e0 linux-capture: Add function to check extensions
Add an internal function to check for all the extensions needed by the
xshm capture to work.
2014-12-21 23:21:46 +01:00
fryshorts
172a4d7a52 linux-capture: Add xcb cursor helper library
Add a new helper library to handle the mouse cursor using xcb.
Since porting the old library without either keeping legacy code or
breaking the api would have been non-trivial, this is added as a
completely separate implementation. Once all code is ported over to
use this library, the old one can be removed.
2014-12-21 23:13:46 +01:00
fryshorts
069ee92ff4 linux-capture: Add helper to get xcb screen
Add a helper function to get a xcb screen from a screen id.
2014-12-21 23:13:27 +01:00
fryshorts
e7cdb837aa linux-capture: Add xcb helper functions for shm
Add new helper functions managing the shm segment with xcb to xhelpers.
2014-12-21 23:13:27 +01:00
fryshorts
8caba4deca linux-capture: Add xcb libraries to cmake
Add xcb libraries needed to port the plugin away from xlib to cmake.
2014-12-21 23:13:25 +01:00
fryshorts
cc56634e91 linux-xshm: Handle missing screens.
This adds a check to the screen enumeration in order to handle missing
screens by adding them to the list but disabling them.
2014-11-20 00:14:10 +01:00
fryshorts
67ca94f7e4 linux-xshm: Add server property.
This adds a property to the source properties which lets the user
specify the X server to capture from. Since this is probably something
thats only useful under certain circumstances it is implemented as
an advanced setting which is only shown when the corresponding option
for advanced settings is checked.
2014-11-20 00:10:11 +01:00
fryshorts
04a7db867f linux-xshm: Refactoring of setup code.
This moves the code to start/stop the capture to respectively named
function in order to clean up the update function.
This means that the capture is stopped/started whenever the settings are
changed. While this increases overhead for some settings, this will also
enable future settings that require a full restart of capture process.
2014-11-18 21:03:50 +01:00
fryshorts
a4d09fe742 linux-xshm: Small change for texture update function.
This removes the entering/leaving of the graphics context from this
function and requires the calling code to make sure the context is
present.
2014-11-18 21:03:50 +01:00
fryshorts
cc52b432e7 linux-xshm: Improve geometry update function.
This adds the screen id from the source properties to the source
struct and changes the geometry function to use that value instead
of requiring the settings object of the source.
2014-11-18 21:03:50 +01:00
fryshorts
08c9f39220 linux-xshm: Use macro for logging.
This adds a macro to automatically prepend the plugin name to debug
statements like it is done in other plugins.
2014-11-18 21:03:50 +01:00
fryshorts
1a51d5fab7 linux-xshm: Improve source struct.
This adds documentation to the source struct and moves one bool to the
end to avoid a hole due to alignment.
2014-11-18 21:03:50 +01:00
Zachary Lund
ab7fa5bdb4 linux-capture: Add X border option to xcomposite
XComposite, which is currently our only capture method for windows,
doesn't handle X border width. This works in a lot of cases but anytime
there's a border, a bug occurs where the lower right is clipped.  This
patch has two goals:

1) To position and size the capture texture correctly in accordance to
the border.

2) Adds a configuration option to allow people to toggle it (which in
most cases will simply do nothing) with a default of not including it.
2014-11-09 22:17:45 -08:00
dodgepong
17804ec12f Add latest translations from CrowdIn 2014-10-31 21:02:47 -04:00
Ben Torell
958b5c12de Latest translations from Crowdin 2014-10-11 18:47:35 -04:00
Palana
94a93abb2b (API Change) Pass data to get_properties when possible 2014-10-01 15:39:57 +02:00
jp9000
c9df41c1e2 (API Change) Remove pointers from all typedefs
Typedef pointers are unsafe.  If you do:
typedef struct bla *bla_t;
then you cannot use it as a constant, such as: const bla_t, because
that constant will be to the pointer itself rather than to the
underlying data.  I admit this was a fundamental mistake that must
be corrected.

All typedefs that were pointer types will now have their pointers
removed from the type itself, and the pointers will be used when they
are actually used as variables/parameters/returns instead.

This does not break ABI though, which is pretty nice.
2014-09-25 21:48:11 -07:00
Zachary Lund
0f228e6ee5 No need to subtract window position from translated coordinates 2014-08-30 13:09:00 -05:00
jp9000
66e8674100 linux-capture: Add cursor capture to xcomposite 2014-08-29 17:20:26 -07:00
jp9000
0102896328 linux-capture: Add x/y cursor position vars 2014-08-29 17:20:26 -07:00
jp9000
378e910ad3 linux-capture: Rename pos_* vars to render_*
the pos_x and pos_y variables were somewhat deceptive, because they were
not actually the poition of the cursor.  They represented the position
of the cursor's bitmap on the screen, not the position of the cursor.
2014-08-29 17:20:26 -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