Commit Graph

3076 Commits

Author SHA1 Message Date
Sebastian Beckmann
62429135ba libobs: Use RTLD_NOW to load modules
RTLD_LAZY means that symbols will only be resolved when first used,
while RTLD_NOW tries to resolve them immediately. This means that if
there are missing symbols (e.g, because a function got removed from
libobs), dlopen with RTLD_LAZY will happily open that module but we get
a runtime crash when the module tries to use that symbol, while with
RTLD_NOW we instead get a (nicer) error on dlopen.
2025-09-03 16:01:57 -04:00
Sebastian Beckmann
ac913b3854 libobs: Fix comment typo
verison -> version
As a drive-by, also changes null to NULL.
2025-09-03 15:34:26 -04:00
Sebastian Beckmann
4cd1444c9a libobs: Set module for outputs 2025-09-03 15:34:26 -04:00
Sebastian Beckmann
5841db6efc libobs: Remove unused obs_*_info module pointer
These were likely originally used for the obs_*_get_module functions,
but no longer are. Additionally, they weren't even implemented for
anything but obs_source_info. Let's remove this before it hits stable.
2025-09-03 15:34:26 -04:00
Exeldro
fc21c0f2f6 libobs: Fix scene and group load state 2025-09-03 14:14:49 -04:00
Ryan Foster
1239ef5f83 libobs: Update version to 32.0.0 2025-08-28 16:58:24 -04:00
FiniteSingularity
14004cec96 libobs: Add core logic for phase 1 plugin manager
Phase 1 of the plugin manager provides the the ability to toggle off/on
plugins loading when OBS starts. Additionally, it implements loading of
a manifest file for plugins that allows plugin authors to provide more
detailed information about the plugin including authors, support site,
name, description.

In order to accomplish this, this change updates libobs to provide
more detailed tracking of modules- specifically tracking both enabled
and disabled modules, alone with a module load state which indicates
why a module is not loaded. Additionally, changes were made to establish
a links between a module and any features (inputs, outputs, encoders,
and services) it provides (and thus the ability to determine why a
feature might not be enabled). Along with these changes to modules,
this commit also provides an indicator and lookup for core modules which
can not be disabled by the plugin manager.

Finally, this change provides functions to properly load and retrieve
a standardized plugin metadata file.
2025-08-28 14:29:10 -04:00
Sebastian Beckmann
e2712f097e libobs: Deprecate obs_data_autoselect_*
The autoselect functionality was meant to enable user feedback for when
data was selected, but something else actually used, for example in case
the value "Auto" was chosen, or an incompatible one.

However, it has a few problems:
1. It was not really used, the only places in OBS were the legacy Video
Capture Device on macOS and the Video Capture Device on Windows.
2. It was never even fully implemented in the UI. In fact, the
properties view *only* supports it for obs_property_list, despite the
API theoretically allowing any data/property type.
3. The core obs_data seems like the wrong place for this kind of
interaction between plugins and UI. obs_data should carry data from one
place to another, some built-in feedback mechanism for the other
direction doesn't make too much sense. If the functionality is desired,
I think this should be rearchitectured as some place of explicit data
transfer.

Let's mark it as deprecated for future removal.
2025-08-25 19:13:25 -04:00
Sebastian Beckmann
609cf6168e libobs/util: Add PRAGMA_DISABLE_DEPRECATION macro
On MSVC, PRAGMA_WARN_DEPRECATION already does that, but on other
compilers it still throws a warning. PRAGMA_DISABLE_DEPRECATION is for
(rare) situations where it's intentional and correct that the deprecated
API is still used, such as to make sure some other API still works
internally.
2025-08-25 19:13:25 -04:00
Sebastian Beckmann
cdf4f672dd libobs: Remove unused code
I forgot to remove this when removing the only functions that used it.

Amends 163493d1e1.
Amends d283181c83.
2025-08-22 21:11:53 -04:00
tytan652
ec447243c5 libobs: Add Flatpak commit logging
This can allow to determine the origin of a Flatpak build.
2025-08-22 20:21:36 -04:00
pkv
9bb940acd8 libobs: Fix audio duplication for monitored source
This fixes the following issue:
- when an Audio Capture source (like 'Desktop Audio',
'wasapi_output_capture' or 'pulse_output_capture') and monitoring use
the same device, one gets duplicated audio for any monitored source,
since their audio is added through both the current scene and the output
capture.
This creates a shift in audio level (about 3 dBFS for white noise, and
oftentimes for music; up to 6 dBFS for very low frequency sine waves).
We solve the bug by:
- detecting when an Audio Capture source and monitoring share the same
device;
- silencing monitored sources whenever the Audio Capture source is
unmuted.

Signed-off-by: pkv <pkv@obsproject.com>
2025-08-22 19:48:59 -04:00
Norihiro Kamae
505b76e8a7 libobs: Reject plugins compiled with newer libobs
Check obs_module_ver and reject if the plugin is built with a newer
libobs major/minor version.
2025-08-22 17:10:09 -04:00
pkv
50cdabbb5f libobs: Fix audio duplication
This fixes the following bug:
- a source might be copied into the same scene or through a nested scene.
The audio level will then increase by +6 dBFS.
An earlier fix [1] dealt with this bug at the scene audio rendering
level, which leaves some edge cases since the fix is not located
directly in the core audio callback.
The current fix consists in:
- tagging individual sources which appear several times in the audio
tree at each tick;
- promote them to root_nodes sources;
- bypass their mixing in scenes and transitions.
Due to being mixed as root_nodes, the audio of duplicated sources
appears only once in the final audio mix.

[1] https://github.com/obsproject/obs-studio/pull/10537

Signed-off-by: pkv <pkv@obsproject.com>
2025-08-22 16:01:13 -04:00
pkv
f027f62f90 Revert libobs: Mix audio of each source in a scene only once
This reverts commit: 8a38e33 [1].
This also reverts commit: 72924ac [2].
(in favour of a fix in core audio pipeline, which allows to address
edge cases).

[1] libobs: Mix audio of each source in a scene only once
8a38e3375b
[2] libobs: Deduplicate audio for nested scenes/groups if not
transitioning
72924ac1f3

Signed-off-by: pkv <pkv@obsproject.com>
2025-08-22 16:01:13 -04:00
derrod
1d01fe8584 libobs: Include all audio priming packets if closest is start 2025-08-21 16:27:24 -04:00
tytan652
2bd23cd50d libobs,cmake: Replace vendored SIMD Everywhere by prefix/system install
SIMD Everywhere finder needs to be installed alongside libobs CMake
package since its headers depends on it.

C++ cmath header is included on Windows on ARM to ensure that all math
functions are correctly defined when included in C++ code.
https://github.com/simd-everywhere/simde/issues/1304

macOS intrinsics is included to make sure that no redefinition error
happens.
2025-08-21 15:22:08 -04:00
Dennis Sädtler
b0b84ad4c9 libobs: Improve HEVC packet priority determination 2025-08-21 14:12:20 -04:00
Ryan Foster
01e7b78929 libobs: Use os_oom() for out of memory crash
This change will make the crash stack clearer when OBS is crashing due
to "out of memory" rather than an explicit bmalloc/brealloc(0) call.
2025-08-20 19:06:11 -04:00
Ryan Foster
94a736f179 libobs: Duplicate os_breakpoint to os_oom
Create a specific "out of memory" variant of os_breakpoint to facilitate
troubleshooting and to differentiate an "out of memory" crash from a
more generic crash.
2025-08-20 19:06:11 -04:00
Dennis Sädtler
e4c39eb648 libobs: Allow interleaver to recover from temporary stalls
The interleaver requires packets with sufficiently high timestamps from
all encoders to be available to send out before it outputs a packet.
This means that if one encoder stalls and does not submit packets for
a while the interleaver can end up with a permanent increase to its
delay due to multiple packets being received from the other encoders
without being able to send any.

This change introduces a recovery mechanism that relies on an upper
bound for the amount of packets that may become "streamable" at a time
being calculated, and flushing additional packets if that bound is
violated.

The upper bound is based on the largest expected interval between
packets and how many packets for each encoder could arrive within
double that interval (to give us a bit of wiggle room since not
all encoders will deliver frames 100% consistently).

This ensures that we still send data at a steady rate but allow the
buffer to drain if it becomes larger than it needs to be.
2025-08-20 18:42:11 -04:00
Sebastian Beckmann
b7c399f6d8 libobs: Remove v1 scene item transform API
Deprecated since 4b138f674f (30.1).
2025-08-20 18:05:15 -04:00
Sebastian Beckmann
d283181c83 libobs: Remove obs_scene_sceneitem_from_source
Use obs_scene_enum_items to find sources instead.

Deprecated since 4dd3cf6758 (31.0).
2025-08-20 18:05:15 -04:00
Sebastian Beckmann
163493d1e1 libobs: Remove obs_view_get_video_info
Deprecated since fc891295b6 (30.1).
2025-08-20 18:05:15 -04:00
Sebastian Beckmann
be66c8a701 libobs: Remove circlebuf
Deprecated since a4b8e1a6a9 (30.1).
2025-08-20 18:05:15 -04:00
PatTheMav
87698b1e01 libobs: Fix clear color mismatch in Metal and OpenGL on Apple Silicon
The OpenGL frontend is implemented in Metal for Apple Silicon Macs.

Metal does not provide a direct "clear" command (neither do D3D12 or
Vulkan) and instead a clear is a load command for a render target of a
render pass.

All writes (and color calculations) in Metal happen in linear space,
with appropriate gamma encoding and decoding happening automatically
depending on the pixel format of the the textures attached to the
pipeline.

Thus setting a clear color with linear gamma is the correct approach to
avoid the SRGB gamma curve being applied twice for both scenarios.
2025-08-20 17:01:09 -04:00
Ryan Foster
7778070cbd libobs: Update version to 31.1.2 2025-07-25 16:55:48 -04:00
Marco
46ce91e582 libobs: Start video output even if there is no mix
This fixes a change in PR 11605 that breaks Decklink video outputs.
get_mix_for_video() returns NULL for those outputs, causing
start_raw_video() to return before connecting the output.
2025-07-25 15:49:19 -04:00
Ryan Foster
a32b3f9f6d libobs: Update version to 31.1.1 2025-07-11 21:35:41 -04:00
Sebastian Beckmann
8e66418dc9 libobs: Actually mark obs_[add|remove]_data_path as deprecated
3311a7105e was meant to mark these as
deprecated, but put the deprecated marker in the .c file which doesn't
work.
2025-06-02 14:50:19 -04:00
Ryan Foster
e8d1834f68 libobs: Update version to 31.1.0 2025-05-23 20:55:49 -04:00
Norihiro Kamae
90d158cf17 libobs/util: Fix coprocess not having environment variables 2025-05-22 15:06:37 -04:00
derrod
56f75bd3e0 win-capture: Add SDL_app to list of generic classes 2025-05-19 19:25:56 -04:00
Ryan Foster
11ee75d2c2 libobs: Fix canvas_dosignal_source() using wrong signal handler 2025-05-12 16:25:21 -04:00
Exeldro
e855bb9d0d libobs: Add obs_canvas_get_signal_handler 2025-05-12 16:25:21 -04:00
Alex Luccisano
ef3e7b2563 libobs: Add checks to some graphics API functions
A few recently introduced graphics API functions needed for Enhanced
Broadcasting were marked as `GRAPHICS_IMPORT_OPTIONAL`. Add the
proper checks in the wrapper to ensure they are safe on platforms
that do not implement the underlying function.
2025-05-09 13:08:10 -04:00
Ed Maste
6204c22853 libobs/util: Fix build on FreeBSD
FreeBSD already implemented os_get_free_size.  Move the new Linux
implementation into the existing not-__FreeBSD__ block.

Fixes: 935613816f ("libobs/util: Update `os_get_free_size()`")
2025-05-07 15:22:24 -04:00
Dennis Sädtler
33734ef99c libobs: Fall back to main canvas dimensions if group canvas unset 2025-05-07 14:01:15 -04:00
Dennis Sädtler
66f47924ea libobs: Add obs_canvas_rename_source() 2025-05-06 16:07:47 -04:00
Dennis Sädtler
de7df57ee2 libobs: Raise max number of output encoders to 10 2025-05-05 17:17:20 -04:00
Miha Frangež
1fc94ecde5 libobs/util: Fix os_process_pipe_create on Linux
This fixes a regression on Linux, introduced in commit 9bc3082.

According to the POSIX specification for the exec family of commands, 
"The first argument is the filename or pathname of the executable to 
be executed". This was done correctly before, but the above commit 
removed "sh" from the arguments, breaking the pipe function on Linux.
2025-05-05 16:54:12 -04:00
Dennis Sädtler
f1e44c122c libobs: Improve readability of scene duplication type 2025-05-05 15:19:31 -04:00
tytan652
5ed5863556 libobs: Fix module load in relocatable scenario 2025-05-03 16:34:25 -07:00
PatTheMav
3311a7105e libobs: Mark data path modification functions as deprecated 2025-04-30 15:14:57 -04:00
gxalpha
281f8137f5 UI,libobs,obs-outputs: Remove HAVE_OBSCONFIG_H ifdefs
With the removal of all legacy code paths, obsconfig.h always exists and
the compile definition always gets set. As such, it's no longer
necessary to check for it.

As removing the definition itself could be seen as a breaking change,
this simply moves the definition to pc.in and cmake.in files for now to
preserve the value for plugins that might expect this to be set. We may
remove the definition entirely in a later release.
2025-04-30 13:05:35 -04:00
Penwywern
63260148df libobs: Use absolute path for install prefix module load 2025-04-28 15:04:27 -04:00
Norihiro Kamae
220b0ec649 libobs/callback: Catch fail cases with missing error data
In `parse_decl_string`, it jumps to `fail` label if an error occurs.
However, if the lexer encountered an error for example, `cfp.error_list`
may be empty.
2025-04-28 14:26:07 -04:00
Ilya Melamed
a19945b53a libobs: Fix setting non-0 order on only scene item 2025-04-28 13:50:01 -04:00
tytan652
1bf84a6901 cmake: Replace Xcb CMake finders with ECM 2025-04-28 13:30:26 -04:00
Norihiro Kamae
5c448452cf libobs/util: Prevent locking mutex in child process when checking Qt5
The frontend has set a log handler which locks the mutex in `LogString`.
If `os_dlopen` fails in the child process, it calls `blog` and attempted
to lock the mutex that may have already been locked by another thread
before `fork()`. This change prevents the child process from locking the
mutex, resolving the potential deadlock.
2025-04-25 19:10:34 -04:00