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.
This commit is contained in:
gxalpha 2024-05-25 13:40:36 +02:00 committed by Lain
parent 4cf18a9abf
commit a1e0626c14
3 changed files with 12 additions and 0 deletions

View file

@ -702,6 +702,14 @@ Core OBS Signals
Called when a source's audio becomes inactive.
**source_filter_add** (ptr source, ptr filter)
Called when a filter is added to a source.
**source_filter_remove** (ptr source, ptr filter)
Called when a filter is removed from a source.
**source_transition_start** (ptr source)
Called when a transition has started its transition.

View file

@ -3218,6 +3218,7 @@ void obs_source_filter_add(obs_source_t *source, obs_source_t *filter)
calldata_set_ptr(&cd, "source", source);
calldata_set_ptr(&cd, "filter", filter);
signal_handler_signal(obs->signals, "source_filter_add", &cd);
signal_handler_signal(source->context.signals, "filter_add", &cd);
blog(LOG_DEBUG, "- filter '%s' (%s) added to source '%s'",
@ -3256,6 +3257,7 @@ static bool obs_source_filter_remove_refless(obs_source_t *source,
calldata_set_ptr(&cd, "source", source);
calldata_set_ptr(&cd, "filter", filter);
signal_handler_signal(obs->signals, "source_filter_remove", &cd);
signal_handler_signal(source->context.signals, "filter_remove", &cd);
blog(LOG_DEBUG, "- filter '%s' (%s) removed from source '%s'",

View file

@ -1117,6 +1117,8 @@ static const char *obs_signals[] = {
"void source_hide(ptr source)",
"void source_audio_activate(ptr source)",
"void source_audio_deactivate(ptr source)",
"void source_filter_add(ptr source, ptr filter)",
"void source_filter_remove(ptr source, ptr filter)",
"void source_rename(ptr source, string new_name, string prev_name)",
"void source_volume(ptr source, in out float volume)",
"void source_volume_level(ptr source, float level, float magnitude, "