Merge pull request #2738 from exeldro/scene_not_duplicate

libobs: Don't allow duplicating scene sources
master
Jim 2020-05-04 01:38:27 -07:00 committed by GitHub
commit 3e1b5426e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 6 deletions

View File

@ -1166,7 +1166,7 @@ const struct obs_source_info scene_info = {
.id = "scene",
.type = OBS_SOURCE_TYPE_SCENE,
.output_flags = OBS_SOURCE_VIDEO | OBS_SOURCE_CUSTOM_DRAW |
OBS_SOURCE_COMPOSITE,
OBS_SOURCE_COMPOSITE | OBS_SOURCE_DO_NOT_DUPLICATE,
.get_name = scene_getname,
.create = scene_create,
.destroy = scene_destroy,

View File

@ -501,13 +501,12 @@ obs_source_t *obs_source_duplicate(obs_source_t *source, const char *new_name,
if (!obs_source_valid(source, "obs_source_duplicate"))
return NULL;
if ((source->info.output_flags & OBS_SOURCE_DO_NOT_DUPLICATE) != 0) {
obs_source_addref(source);
return source;
}
if (source->info.type == OBS_SOURCE_TYPE_SCENE) {
obs_scene_t *scene = obs_scene_from_source(source);
if (scene && !create_private) {
obs_source_addref(source);
return source;
}
if (!scene)
scene = obs_group_from_source(source);
if (!scene)
@ -521,6 +520,11 @@ obs_source_t *obs_source_duplicate(obs_source_t *source, const char *new_name,
return new_source;
}
if ((source->info.output_flags & OBS_SOURCE_DO_NOT_DUPLICATE) != 0) {
obs_source_addref(source);
return source;
}
settings = obs_data_create();
obs_data_apply(settings, source->context.settings);