mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-09-24 23:31:36 +08:00
(API Change) libobs: Remove "User sources list" (skip)
(Note: This commit breaks UI compilation. Skip if bisecting) API Removed: ------------------------ obs_add_source API Changed: ------------------------ obs_source_remove: Now just marks/signals a source for removal The concept of "user sources" is flawed: it was something that the front-end was forced to deal with if it wanted to automate source saving/loading, and often it had to code around it. That's not how saving/loading should work, a front-end should be allowed to manage lists of sources in the way it explicitly chooses, and it should be able to choose which sources it wants to save/load.
This commit is contained in:
+3
-28
@@ -72,7 +72,6 @@ static const struct obs_source_info *get_source_info(enum obs_source_type type,
|
||||
|
||||
static const char *source_signals[] = {
|
||||
"void destroy(ptr source)",
|
||||
"void add(ptr source)",
|
||||
"void remove(ptr source)",
|
||||
"void save(ptr source)",
|
||||
"void load(ptr source)",
|
||||
@@ -480,37 +479,13 @@ bool obs_weak_source_references_source(obs_weak_source_t *weak,
|
||||
|
||||
void obs_source_remove(obs_source_t *source)
|
||||
{
|
||||
struct obs_core_data *data = &obs->data;
|
||||
size_t id;
|
||||
bool exists;
|
||||
|
||||
if (!obs_source_valid(source, "obs_source_remove"))
|
||||
return;
|
||||
|
||||
pthread_mutex_lock(&data->sources_mutex);
|
||||
|
||||
if (source->removed) {
|
||||
pthread_mutex_unlock(&data->sources_mutex);
|
||||
return;
|
||||
}
|
||||
|
||||
source->removed = true;
|
||||
|
||||
obs_source_addref(source);
|
||||
|
||||
id = da_find(data->user_sources, &source, 0);
|
||||
exists = (id != DARRAY_INVALID);
|
||||
if (exists) {
|
||||
da_erase(data->user_sources, id);
|
||||
obs_source_release(source);
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&data->sources_mutex);
|
||||
|
||||
if (exists)
|
||||
if (!source->removed) {
|
||||
source->removed = true;
|
||||
obs_source_dosignal(source, "source_remove", "remove");
|
||||
|
||||
obs_source_release(source);
|
||||
}
|
||||
}
|
||||
|
||||
bool obs_source_removed(const obs_source_t *source)
|
||||
|
||||
Reference in New Issue
Block a user