0
0
mirror of https://github.com/obsproject/obs-studio.git synced 2024-09-20 04:42:18 +02:00

libobs: Add obs_reset_source_uuids

This commit is contained in:
derrod 2023-03-09 20:33:23 +01:00 committed by Rodney
parent 29db52ad27
commit 1fd50a9324
2 changed files with 19 additions and 0 deletions

View File

@ -2535,6 +2535,21 @@ obs_data_array_t *obs_save_sources(void)
return obs_save_sources_filtered(save_source_filter, NULL);
}
void obs_reset_source_uuids()
{
pthread_mutex_lock(&obs->data.sources_mutex);
struct obs_source *source = obs->data.first_source;
while (source) {
bfree((void *)source->context.uuid);
source->context.uuid = os_generate_uuid();
source = (struct obs_source *)source->context.next;
}
pthread_mutex_unlock(&obs->data.sources_mutex);
}
/* ensures that names are never blank */
static inline char *dup_name(const char *name, bool private)
{

View File

@ -798,6 +798,10 @@ typedef bool (*obs_save_source_filter_cb)(void *data, obs_source_t *source);
EXPORT obs_data_array_t *obs_save_sources_filtered(obs_save_source_filter_cb cb,
void *data);
/** Reset source UUIDs. NOTE: this function is only to be used by the UI and
* will be removed in a future version! */
EXPORT void obs_reset_source_uuids(void);
enum obs_obj_type {
OBS_OBJ_TYPE_INVALID,
OBS_OBJ_TYPE_SOURCE,