Commit Graph

344 Commits

Author SHA1 Message Date
Dennis Sädtler
1ecea56817 libobs: Properly fix canvas video reset/restore 2026-05-08 16:28:19 -04: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
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
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
Exeldro
fc21c0f2f6 libobs: Fix scene and group load state 2025-09-03 14:14:49 -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
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
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
PatTheMav
3311a7105e libobs: Mark data path modification functions as deprecated 2025-04-30 15:14:57 -04:00
Dennis Sädtler
3d57b1fd63 libobs: Introduce Canvases
This adds a new obs_canvas object that acts as a shareable
(reference-counted) owner of views, mixes, and (optionally) scenes.

This is a step towards faciliatating multi-canvas and multi-output
features in OBS Studio.

It solves a number of complications that exist with the manual approach
of using views, such as audio mixing, source active-state tracking, and
scenes not havinga  reliable way of identifying the actual available
canvas size.
2025-04-02 12:39:46 -04:00
Dennis Sädtler
66da1e42c7 libobs: Add video_reset signal
Signals when a video reset has completed. This is mainly useful when
canvases or views are used, whose mixes will have been freed or
recreated during the reset.
2025-04-02 12:39:46 -04:00
Lain
70dc224a2e libobs: Do not lock sources mutex unnecessarily
In obs_load_sources(), the master sources mutex was being locked
seemingly unnecessarily. This could cause race conditions if used
incorrectly.
2025-02-22 16:06:00 -08:00
Alex Luccisano
c67ea47406 libos: Add obs_get_audio_info2()
The `obs_audio_info2` struct is used in libobs
for resetting audio, however there is a need for
obtaining the additional fields present in the struct
beyond `obs_audio_info`.
2025-01-29 14:37:19 -05:00
derrod
6b449c3a0b libobs: Only modify raw_active counter if (dis-)connection succeeded 2025-01-28 17:36:51 -05:00
Ryan Foster
a1fbf1015f clang-format: Increase column limit from 80 to 120 2024-10-04 18:19:27 -04:00
derrod
b7553b5883 docs,libobs: Remove master volume functions
Never implemented, deprecated in 29.0.
2024-08-28 19:10:27 -04:00
derrod
bda463932e docs,libobs: Remove obs_render_main_view()
Deprecated since 21.0
2024-08-28 19:10:27 -04:00
derrod
07aa98ab34 libobs: Remove obs_get_default_rect_effect()
Originally removed in 0.12.1 but "temporarily" brought
back, then never removed.
2024-08-28 19:10:27 -04:00
Rodney
198581a475 libobs: Add source profiler 2024-08-10 23:51:39 -07:00
Norihiro Kamae
d76f4b3aad libobs: Remove unused static-inline functions 2024-08-07 17:27:49 -04:00
Exeldro
1cb1864cc0 libobs: Fix crash when mix is NULL 2024-07-11 17:24:55 -04:00
gxalpha
a1e0626c14 libobs: Add global source filter add/remove signals
Adds global signals for when a filter is added to or removed from a
source. These will be helpful for listening for changes to a sources
filters without having to attach and detach a signal handler, which
would be annoying in the context of for example context menus which
change sources rapidly.
2024-05-25 17:08:42 -07:00
Ruwen Hahn
c288d42cfd libobs: Add obs_encoder_group_keyframe_aligned_encoders
Ensures grouped encoders start on the same input frame
2024-04-12 14:52:32 -07:00
Kurt Kartaltepe
02c90207fc libobs,libobs-opengl: enable GPU encoding for OpenGL
Enable all of the previously Windows only paths for OpenGL backends that
support encode_texture2

Co-authored-by: Torge Matthies <openglfreak@googlemail.com>
2024-01-26 20:01:58 -05:00
derrod
2963959e71 libobs: Replace circlebuf with deque 2024-01-16 16:45:09 +01:00
derrod
5177a593af libobs: Remove module UI functions 2023-12-02 18:09:20 -06:00
Lain
e358244521 libobs: Fix possible minor memory leak
If this array reserves memory, but doesn't end up pushing any sources
back to the array, then it'd result in a memory leak.
2023-11-26 20:06:51 -06:00
Exeldro
1265950eaf libobs: Don't keep filter mutex in obs_save_source
While filters are saved using obs_save_source other mutex are used.
To prevent a deadlock, don't keep the filter mutex iterating the filters.
This fixes #9893
2023-11-25 20:49:50 -06:00
tt2468
3b0ca4527a libobs: Add obs_reset_audio_monitoring()
Reloads all audio monitoring devices
2023-11-07 01:32:12 -06:00
derrod
117534368b libobs: Profile graphics initialisation and shader compilation 2023-08-02 04:48:43 -07:00
derrod
d90bfc5e0b libobs: Add obs_add_safe_module() 2023-07-21 23:22:07 +02:00
Ruwen Hahn
6cdfb0a8b9 libobs: Allow configuring frame rate divisor for encoders
This allows encoders/outputs to output at a frame rate that is lower
than the configured base frame rate
2023-07-03 09:35:06 -07:00
John Bradley
8981afe5b4 libobs: Set video thread qos class to user interactive on macOS 2023-06-15 15:25:47 +02:00
Exeldro
a77789b266 libobs: Don't keep the sources mutex in tick_sources
Allow other threads to use sources while the graphics thread does
video_tick, update, activate and deactivate on sources
2023-06-10 14:20:13 -07:00
Lain
106c7aa61f Update copyrights/names 2023-05-20 01:31:18 -07:00
cg2121
6254e031d9 libobs: Fix transition lookup by uuid
The obs_get_transition_by_uuid function would return a valid source
even if it wasn't a transition.
2023-04-05 16:52:46 -07:00
Norihiro Kamae
050d2e69b3 libobs: Log when libobs data file is not found
When an effect file is not found while initializing graphics, only one
line error below is logged. To clarify the reason why the initialization
was failed, also log when the file was not found.
Failed to initialize video. Your GPU may not be supported, or your
graphics drivers may need to be updated.
2023-03-27 15:20:56 -04:00
jpark37
e32c2c1427 libobs: Add callback for main texture rendered
Useful for redirecting main texture to DeckLink output for example.
2023-03-24 15:18:45 -07:00
tytan652
56411eda8e libobs,docs: Add protocol enumeration functions 2023-03-19 16:31:05 +01:00
tytan652
201bcda051 libobs,docs: Add protocol in Outputs API 2023-03-19 15:29:03 +01:00
derrod
e6a7cff034 libobs: Use uthash for hotkeys and hotkey pairs 2023-03-18 10:47:50 +01:00
derrod
c68eeaef1d libobs: Use uthash for source objects
All sources are part of a hash table that allows a lookup by UUID.
Public sources additionally are in a hash table allowing lookup by name.
2023-03-18 10:47:49 +01:00
derrod
1fd50a9324 libobs: Add obs_reset_source_uuids 2023-03-12 01:11:38 +01:00
derrod
30519768ad libobs: Add UUIDs to obs_source objects 2023-03-12 01:11:38 +01:00
jpark37
463bf0dff5 libobs,UI: Add P216/P416 pixel formats
Will be useful for ProRes.
2023-02-21 18:48:44 +01:00
PatTheMav
fb7a9edadc libobs: Fix non-exhaustive switch statements 2023-02-18 15:22:33 -08:00
tt2468
25df3e183e libobs: Fix logging of remaining views
OBS has been logging `1 views remain at shutdown` when in reality there
are not technically any views remaining. When views are removed, the
view itself is destroyed immediately, but the mix remains, to be
garbage collected by the graphics thread.

In this case, the view has already been removed, but the graphics
thread has not run an interation and cleaned up the mix, so this
log message appears.

Fixes the issue by checking if a mix actually has an assigned view,
instead of blindly logging existing mixes.
2023-01-18 12:17:35 -06:00
tytan652
cf5c68b773 UI,libobs,libobs-opengl,obs-ffmpeg: Remove unneeded cast in switches
Those casts were usually used to workaround switch warnings.

Also adds default to OBS frontend event switches that had this
workaround.
2023-01-16 11:52:26 +01:00
Ryan Foster
19abcbcd3c Revert "libobs-d3d11: Make sure libobs knows the new adapter index"
This reverts commit e62759a3fa.
2022-12-30 21:14:15 -08:00
Ryan Foster
8dde4bab1e Revert "libobs: Fix adapter index not getting applied to resets"
This reverts commit 02d20e9f36.
2022-12-30 21:14:15 -08:00