mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-07-14 23:34:08 +00:00
libobs: Add obs_source_set_default_flags
This allows sources to set default flags on creation without interfering with user set flags
This commit is contained in:
parent
eac55edca0
commit
f2287c8a28
|
@ -281,6 +281,7 @@ struct obs_source {
|
|||
|
||||
/* general exposed flags that can be set for the source */
|
||||
uint32_t flags;
|
||||
uint32_t default_flags;
|
||||
|
||||
/* indicates ownership of the info.id buffer */
|
||||
bool owns_info_id;
|
||||
|
|
|
@ -191,6 +191,8 @@ obs_source_t *obs_source_create(enum obs_source_type type, const char *id,
|
|||
blog(LOG_INFO, "source '%s' (%s) created", name, id);
|
||||
obs_source_dosignal(source, "source_create", NULL);
|
||||
|
||||
source->flags = source->default_flags;
|
||||
|
||||
if (info && info->type == OBS_SOURCE_TYPE_TRANSITION)
|
||||
os_atomic_inc_long(&obs->data.active_transitions);
|
||||
return source;
|
||||
|
@ -2091,6 +2093,13 @@ void obs_source_set_flags(obs_source_t *source, uint32_t flags)
|
|||
}
|
||||
}
|
||||
|
||||
void obs_source_set_default_flags(obs_source_t *source, uint32_t flags)
|
||||
{
|
||||
if (!source) return;
|
||||
|
||||
source->default_flags = flags;
|
||||
}
|
||||
|
||||
uint32_t obs_source_get_flags(const obs_source_t *source)
|
||||
{
|
||||
return source ? source->flags : 0;
|
||||
|
|
|
@ -1233,6 +1233,7 @@ obs_source_t *obs_load_source(obs_data_t *source_data)
|
|||
sync = obs_data_get_int(source_data, "sync");
|
||||
obs_source_set_sync_offset(source, sync);
|
||||
|
||||
obs_data_set_default_int(source_data, "flags", source->default_flags);
|
||||
flags = (uint32_t)obs_data_get_int(source_data, "flags");
|
||||
obs_source_set_flags(source, flags);
|
||||
|
||||
|
|
|
@ -862,6 +862,9 @@ EXPORT void obs_source_send_focus(obs_source_t *source, bool focus);
|
|||
EXPORT void obs_source_send_key_click(obs_source_t *source,
|
||||
const struct obs_key_event *event, bool key_up);
|
||||
|
||||
/** Sets the default source flags. */
|
||||
EXPORT void obs_source_set_default_flags(obs_source_t *source, uint32_t flags);
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Scenes */
|
||||
|
|
Loading…
Reference in a new issue