3147 Commits
Author SHA1 Message Date
Richard StanwayandRyan Foster 6d0083dd61 libobs, docs: Document intended use of obs_module_unload
obs_module_unload was never properly documented, so some plugins use it
to free resources, some use it to save data, etc. While libobs tries to
ensure all objects are shut down and destroyed before calling unload, if
another plugin is holding a strong reference, or if a reference leak has
occurred, libobs may need to call back into a plugin-provided object's
destroy function even after obs_module_unload has returned. If the
plugin has freed memory or other resources needed for the callback then
this likely results in a crash.

Going forward, we should document that obs_module_unload is now intended
only for saving data and releasing references, and that calling libobs
after it returns is not allowed. For cases where resource cleanup is
actually needed (for example, an external out of process helper needs to
be shut down or a release call to a hardware driver), a new
obs_module_destroy callback is intended to be added in a future version.
2026-08-22 16:03:18 -04:00
LainandRyan Foster c3046ec172 libobs/graphics: Break image file API to prevent ABI issues 2026-08-21 15:43:20 -04:00
Norihiro KamaeandRyan Foster f5f55777bb libobs/graphics: Hide GIF decoding data from exported header file 2026-08-21 15:43:20 -04:00
Ryan Foster e0027ee4a3 libobs/graphics: Update libnsgif to 1.0.0 2026-08-21 15:43:19 -04:00
PenwywernandRyan Foster 4cc9c4466c libobs: Ensure module exists before getting locale string 2026-08-20 18:25:04 -04:00
FiniteSingularityandRyan Foster b790a32b2e libobs: Fix file filter for save file path widget 2026-08-20 17:55:08 -04:00
derrodandRyan Foster cc6c7629fd libobs: Deprecate source hiding 2026-08-20 17:26:22 -04:00
Ryan Foster 1bf1379faa libobs: Update version to 32.2.2 2026-08-14 16:57:12 -04:00
Ryan Foster 0052d024fd libobs: Update version to 32.2.1 2026-07-24 17:49:25 -04:00
Ryan Foster f76ad4989d libobs: Update version to 32.2.0 2026-06-19 19:41:04 -04:00
Warchamp7andRyan Foster e8a8ac5451 libobs: Output monitor audio while muted 2026-06-17 16:34:16 -04:00
PatTheMavandRyan Foster 4969a4f5a3 libobs: Apply clang-format 22 formatting 2026-06-17 15:17:09 -04:00
PatTheMavandRyan Foster 426c594513 libobs: Force C language for clang-format 2026-06-17 15:17:09 -04:00
Warchamp7andRyan Foster 30b63c6849 Update C++ files with braces 2026-06-09 13:41:19 -04:00
Richard StanwayandRyan Foster 8801dbef06 libobs: Avoid calling SetDllDirectory when looking for dependent DLLs
Using the full path and appropriate LoadLibraryEx flags is safer as it
gives us more control over the search paths.
2026-06-05 15:27:30 -04:00
Alex LuccisanoandRyan Foster edbe74b2b5 libobs: Add multitrack dynamic bitrate capability
The `OBS_ENCODER_CAP_DYN_BITRATE` flag indicates if an encoder is
capable of supporting dynamic bitrate changes without disturbing
the stream. In the case of multitrack video, dynamic bitrate changes
are also possible, however the encoder must be able to change bitrates
for multiple renditions and multiple codecs and maintain IDR alignment.
Add the `OBS_ENCODER_CAP_MULTITRACK_DYN_BITRATE` to specify this
capability for the encoder.
2026-06-05 14:11:55 -04:00
Ruwen HahnandRyan Foster dd1e93f1ab libobs: Refactor encoder_group access
Also reconfigure all grouped encoders on the same frame.
2026-06-05 14:11:55 -04:00
Dennis SädtlerandRyan Foster 888a5160fa libobs: Adjust obs_canvas_get_video_info() to get video info from mix
This aligns obs_canvas_get_video_info() and obs_get_video_info() and
ensures the frame-rate is correct rather than returning the
potentially stale data stored in the canvas itself.
2026-05-19 15:24:09 -04:00
Dennis SädtlerandRyan Foster 1ecea56817 libobs: Properly fix canvas video reset/restore 2026-05-08 16:28:19 -04:00
Dennis SädtlerandRyan Foster 8fb81caf0a Revert "libobs: Restore only canvases that have video info"
This reverts commit 9a62529f02.
2026-05-08 16:28:19 -04:00
Sebastian BeckmannandRyan Foster 77fb5b4bc7 libobs: Disallow overwriting the crash handler
Setting a new crash handler overwrites the existing one. This is not
desirable.
2026-05-08 13:04:27 -04:00
ansh1406andRyan Foster 5f2720ac98 libobs: initialize peak values using absolute value in get_true_peak and get_sample_peak 2026-05-07 16:35:09 -04:00
cg2121andRyan Foster 8163bbf5c8 frontend, libobs: Add ability to set custom source icons
This allows setting dark and light icons for a source.
2026-05-07 16:11:24 -04:00
Kurt KartaltepeandRyan Foster cbfd6d2677 libobs: Remove extra gs_flush calls
These calls introduce pipeline stalls in OpenGL on low end machines
which can contribute to a fairly significant 10-30% of total rendering
time.

The driver already needs to synchronize events within the context so
these calls are not needed for correctness for OpenGL.
2026-05-07 13:49:53 -04:00
ExeldroandRyan Foster 6f5d00ca71 libobs/graphics: Add support for param assign with type constructor 2026-05-07 12:03:01 -04:00
cg2121andRyan Foster 750c016161 frontend, libobs: Add OBSProperties OBSPtr type
We no longer have to manually destroy obs_properties_t.
2026-05-06 17:27:36 -04:00
ExeldroandRyan Foster eea945b64c libobs/util: Add support for #if and #elif to CF parser 2026-05-06 16:54:48 -04:00
Sebastian BeckmannandRyan Foster dba426630a libobs: Deprecate v1 of obs_properties_add_button
With v1 of this function, it's unclear where exactly the data pointer
comes from or what it is. In fact, this is not determined by libobs, but
the consumer. libobs assumes that the caller of
obs_property_button_clicked passes an obs_context_data pointer, and then
passes the data pointer of that obs_context_data as the data pointer to
the callback.
In OBS Studio, this is always the private data of the associated object.
However, this assumes that there even is such an object (source/encoder/
etc), even though properties are meant to be free-standing. This is not
just philosophical, because with obs_get_source_properties you can
actually get an obs_properties_t that isn't associated with any specific
source, at which point you have no idea what the data pointer will be.

For this reason, obs_properties_add_button v1 needs to go.
obs_properties_add_button2 can be used as a drop-in replacement.
With v2, it's well-defined that the pointer you're passing as priv is
the pointer you get back in the callback as data. If you don't care
about it, simply pass NULL/nullptr.

Once v1 is removed in the future, obs_property_button_clicked should be
replaced with a variant that doesn't take a second argument, as that
argument will no longer be used anywhere.
2026-05-05 15:45:04 -04:00
Ryan Foster fb4d98bf88 libobs: Update version to 32.1.2 2026-04-21 15:00:34 -04:00
Ryan Foster 7272af1375 libobs: Update version to 32.1.1 2026-04-02 14:21:16 -04:00
pkvandRyan Foster 68f5470d15 libobs: Monitoring deduplication fix for 'Desktop Audio' on monitor_only
When an Audio Output Capture source (AOC) like 'Desktop Audio' has
monitoring_type == OBS_MONITORING_TYPE_MONITOR_ONLY, deduplication
should not be triggered. this is an edge case which may not cover a
reasonable use case, but for the sake of completeness, we deal with it.

Signed-off-by: pkv <pkv@obsproject.com>
2026-04-01 14:29:25 -04:00
Hoshino LinaandRyan Foster 49708181b5 libobs/util: Fix fd management in os_process_pipe_create
The sequence should be the same for every fd:

- Close the parent end of the pipe
- If the child end of the pipe is not the intended fd already,
  - Dup it over
  - And close the old fd

This fixes a double-close() in the read path (which is fairly harmless
since it happens in the child, but sticks out in strace), some fd
leakage, and the stderr-already-is-2 case.
2026-03-08 12:12:44 -04:00
PenwywernandRyan Foster a4f3c16065 libobs: Properly handle NULL data in json 2026-02-11 19:27:22 -05:00
Warchamp7andRyan Foster 0df94d5cae image-source: Fix interrupted transitions 2026-02-04 18:53:59 -05:00
Warchamp7andRyan Foster e6b52f2e9b libobs, frontend: Signal transition_stop for cancelled transitions 2026-01-16 15:57:36 -05:00
Warchamp7andRyan Foster b8f0990d50 libobs: Add obs_transition_is_active 2026-01-16 15:57:36 -05:00
ExeldroandRyan Foster 9a62529f02 libobs: Restore only canvases that have video info 2026-01-16 10:54:48 -05:00
Ryan Foster 1d6f1859ea libobs: Update version to 32.1.0 2026-01-14 16:52:36 -05:00
Anton KesyandRyan Foster 380ff3fd58 libobs: Fix typos 2026-01-14 13:47:30 -05:00
derrodandRyan Foster 5cbf0c5e6e libobs: Add API for getting priming samples from audio encoders 2026-01-14 10:48:04 -05:00
PatTheMavandRyan Foster 4625dda66d cmake: Apply gersemi 0.25 formatting 2026-01-09 15:47:12 -05:00
Dennis SädtlerandRyan Foster 4d7776fc3b libobs: Restore original video_t for encoders when GPU scaling is used 2026-01-08 22:37:24 -05:00
Dennis SädtlerandRyan Foster 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
pkvandRyan Foster 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
pkvandRyan Foster 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
ExeldroandRyan Foster 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
pkvandRyan Foster 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
pkvandRyan Foster 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