Commit Graph

3106 Commits

Author SHA1 Message Date
Dennis Sädtler
4d7776fc3b libobs: Restore original video_t for encoders when GPU scaling is used 2026-01-08 22:37:24 -05:00
Dennis Sädtler
659163e0e8 libobs: Fix NAL type for HEVC caption SEIs 2025-12-17 18:02:19 -05:00
Ryan Foster
dcdbd2e904 libobs: Update version to 32.0.4 2025-12-12 16:33:05 -05:00
pkv
ad4315b15a libobs: Fix default macOS monitoring device
The default device retrieved was the one used for system sounds.
This fixes it by retrieving the one used to output audio.

It seems the bug has been there since the initial writing of this bit of
code (so 2017).
2025-12-12 15:21:42 -05:00
pkv
91917f8120 libobs: Improve monitoring deduplication
The monitoring deduplication was previously checking at each audio tick
the whole audio tree for Audio Output Capture (AOC) devices used for
monitoring. The profiling did not show any big impact on the audio
callback. But due to reports of a significant slowdown for scenes with
numerous audio sources, we have moved the check on AOC from the audio
thread to the UI thread.

So we implemented obs_source_audio_output_capture_device_changed which
is triggered whenever:
- a monitoring device is changed in Settings > Audio,
- an Audio Output Capture source changes its device or on startup.

This function compares the AOC device with the monitoring device in UI
thread. If they are identical, a signal is sent to the audio thread to
add an audio task updating the AOC duplicating source pointer at the end
of an audio tick.

This triggers monitoring deduplication if the ptr is not NULL.
The calls in the AOC are implemented in next commits.
The rest of the logic in obs-audio.c is the same except on one count,
which is that we check against the muted state of the AOC rather than
its user_muted; with the new logic, muted works better.

Signed-off-by: pkv <pkv@obsproject.com>
2025-12-12 15:21:42 -05:00
Exeldro
ea9e4ca06e libobs: Do not wait for audio of removed sources 2025-12-10 13:24:22 -05:00
Ryan Foster
9a8470355f libobs: Update version to 32.0.3 2025-12-05 16:38:14 -05:00
pkv
4ea2074eed libobs: Add devices_match to null monitor
This adds the devices_match function to null monitor to fix linking
issues on linux when pulse audio is disabled.
Fixes #12810

Signed-off-by: pkv <pkv@obsproject.com>
2025-11-26 14:16:53 -05:00
pkv
eb4161e72e libobs: Monitoring deduplication for default devices
This adds comparison to default devices to the monitoring deduplication.
When a user picks a default device, the device_id setting is 'default',
which prevents any comparison.
The comparison is done by leveraging the libobs/audio-monitoring
devices_match function.
For macOS, some special care is taken because the devices list differ
for 'Desktop Audio' and 'monitoring' since coreaudio sdk has no pure
audio capture; so 'default' in the two lists do not match in general.
One then retrieves the device_id for the default desktop audio for macOS
through get_desktop_default_id function.

Signed-off-by: pkv <pkv@obsproject.com>
2025-11-11 13:55:34 -05:00
pkv
2f2c66a597 libobs: Enable retrieval of macOS default audio output capture device
This allows retrieval of the default audio output capture device.

Signed-off-by: pkv <pkv@obsproject.com>
2025-11-11 13:55:34 -05:00
Exeldro
d84ff0eb6f libobs: Don't use removed sources 2025-11-07 17:07:14 -05:00
pkv
189ed7c386 libobs: Trigger monitoring deduplication when fader is at minimum
When the 'Audio Output Capture' source (usually Desktop Audio) has its
fader at minimum, we should disable the deduplication logic.
This is done by checking against the obs_source volume member.

Signed-off-by: pkv <pkv@obsproject.com>
2025-10-30 13:27:54 -04:00
pkv
af17e71dd1 libobs: Additional monitoring deduplication check with pulse
Pulse audio may append .monitor to device id; this commit adds this case
to the deduplication trigger.

Signed-off-by: pkv <pkv@obsproject.com>
2025-10-30 13:27:54 -04:00
pkv
967e19b3fa libobs: Check tracks for monitoring deduplication
Monitoring deduplication must be applied only to tracks for which the
monitored source and the 'Audio Output Capture' source are both enabled.
This adds such checks.

Signed-off-by: pkv <pkv@obsproject.com>
2025-10-30 13:27:54 -04:00
Ryan Foster
c025f210d3 libobs: Update version to 32.0.2 2025-10-23 08:42:31 -04:00
Ryan Foster
0b12296320 libobs: Update version to 32.0.1 2025-09-26 16:36:36 -04:00
pkv
9696f54937 libobs: Log monitoring audio deduplication
The commit adds a log line to inform the user that deduplication is
being applied. The info is displayed whenever deduplication first
occurs.

Signed-off-by: pkv <pkv@obsproject.com>
2025-09-26 12:12:08 -04:00
pkv
40dd9f6c5e libobs: Fix for monitoring deduplication edge case
When an 'Audio Capture Source' device is also used for monitoring, the
deduplication logic is applied: all monitored sources are silenced.
But this should not silence the 'Audio Capture Source' if for some
reason, it is being monitored (the user will get echoes, but hey, it's
their choice). So we exclude the 'Audio Capture Source' from the
silenced sources.

Signed-off-by: pkv <pkv@obsproject.com>
2025-09-26 12:12:08 -04:00
Ryan Foster
1e281538a4 libobs: Raise out of memory exception manually when out of memory
The previous attempt to clarify an out of memory exception/crash
resulted in the compiler optimizing os_breakpoint() and os_oom() into
the same result, which meant that crash stacks in the wild were still
not specific enough to be helpful. Forcefully differentiating the
functions in Release configuration by having os_breakpoint() only call
__debugbreak() and having os_oom() call RaiseException() should give us
clearer crash stacks.

Amends 94a736f179.
2025-09-17 16:29:06 -04:00
Sebastian Beckmann
b6555a4baa libobs: Treat os_dlopen failure as module load failure
Communicate that a module has failed to load via obs_module_failure_info
2025-09-12 15:16:06 -04:00
Sebastian Beckmann
a4b62d26be libobs: Differentiate between plugin load failures
It's important to differentiate whether a plugin fails to open (dl_open
returning NULL, being compiled for a newer libobs, etc) or whether it
opened correctly, but failed to initialize (returned NULL during
obs_module_load()).
With that, we can also create disabled modules for modules that fail to
open, which in the future should enable better user communication in the
UI (besides the module_load_failure_info).
2025-09-12 15:16:06 -04:00
Sebastian Beckmann
fd214a9c6e libobs: Rename MODULE_FILE_NOT_FOUND code to MODULE_FAILED_TO_OPEN
This code is returned if os_dlopen returns NULL. This can happen for
multiple reasons, not just because the file can't be found. Since [1]
other causes are getting more common, but this could also happen before.

[1]: 62429135ba
2025-09-12 15:16:06 -04:00
Norihiro Kamae
139fd801ee libobs/util: Fix memory leak at failure condition 2025-09-12 13:46:58 -04:00
PatTheMav
cb634b9875 libobs: Update default draw effect to also provide D65P3 conversion 2025-09-04 17:58:27 -04:00
PatTheMav
4dab2c51b8 libobs: Add prerequisites for Metal and Swift support 2025-09-04 17:58:27 -04:00
Ryan Foster
3afc2577d3 libobs: Remove Qt5 module check
Partial revert of a0eae6f33c.
Partial revert of 23c3ad4d02.
Partial revert of 97b34ebb76.

Keep all of the get_plugin_info stuff, remove the Qt5 checks.
2025-09-04 16:57:07 -04:00
Ryan Foster
2004ea6b16 Revert "libobs/util: Reject plugins linking Qt5 library for Linux"
This reverts commit 615728fa3b.

Includes partial revert of 62429135ba.
2025-09-04 16:57:07 -04:00
Ryan Foster
f31485939c Revert "libobs: Assume Qt 6, always warn about Qt 5 plugins"
This reverts commit 5ed0b8a0b8.
2025-09-04 16:57:07 -04:00
Ryan Foster
a7b5aef36a Revert "libobs/util: Prevent locking mutex in child process when checking Qt5"
This reverts commit 5c448452cf.
2025-09-04 16:57:07 -04:00
Sebastian Beckmann
11b9f1aa83 libobs: Re-include groups in obs_enum_scenes
[1] changes this condition to obs_source_is_scene as a drive-by, however
they aren't equivalent. obs_source_is_scene checks whether the source's
is is "scene", which doesn't include groups, while OBS_SOURCE_TYPE_SCENE
does. Suddenly not including groups is quite the API break.
This now means obs_canvas_enum_scenes does also include groups, however
that is much less of an egregious API change.

[1]: 8c5858ae05
2025-09-04 16:11:19 -04:00
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