libobs: Add obs_source_reset_settings()

Allows the ability to reset (erase) a source's existing settings and
replace them with new settings. This is useful for things such as
reverting to older settings.
This commit is contained in:
jp9000 2021-04-30 18:29:08 -07:00
parent 5f7e81d628
commit 60447872c0
3 changed files with 18 additions and 0 deletions

View File

@ -818,6 +818,13 @@ General Source Functions
---------------------
.. function:: void obs_source_reset_settings(obs_source_t *source, obs_data_t *settings)
Same as :c:func:`obs_source_update`, but clears existing settings
first.
---------------------
.. function:: void obs_source_video_render(obs_source_t *source)
Renders a video source. This will call the

View File

@ -941,6 +941,15 @@ void obs_source_update(obs_source_t *source, obs_data_t *settings)
}
}
void obs_source_reset_settings(obs_source_t *source, obs_data_t *settings)
{
if (!obs_source_valid(source, "obs_source_reset_settings"))
return;
obs_data_clear(source->context.settings);
obs_source_update(source, settings);
}
void obs_source_update_properties(obs_source_t *source)
{
if (!obs_source_valid(source, "obs_source_update_properties"))

View File

@ -942,6 +942,8 @@ EXPORT obs_properties_t *obs_source_properties(const obs_source_t *source);
/** Updates settings for this source */
EXPORT void obs_source_update(obs_source_t *source, obs_data_t *settings);
EXPORT void obs_source_reset_settings(obs_source_t *source,
obs_data_t *settings);
/** Renders a video source. */
EXPORT void obs_source_video_render(obs_source_t *source);