mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-07-15 07:44:10 +00:00
libobs: Add obs_save_sources_filtered (skip)
(Note: This commit breaks UI compilation. Skip if bisecting) Adds a means of saving specific sources that the front-end chooses, rather than being forced to use the now-removed "user list".
This commit is contained in:
parent
70fec7ae8e
commit
ec86bdaa09
18
libobs/obs.c
18
libobs/obs.c
|
@ -1572,7 +1572,8 @@ obs_data_t *obs_save_source(obs_source_t *source)
|
|||
return source_data;
|
||||
}
|
||||
|
||||
obs_data_array_t *obs_save_sources(void)
|
||||
obs_data_array_t *obs_save_sources_filtered(obs_save_source_filter_cb cb,
|
||||
void *data_)
|
||||
{
|
||||
struct obs_core_data *data = &obs->data;
|
||||
obs_data_array_t *array;
|
||||
|
@ -1587,7 +1588,8 @@ obs_data_array_t *obs_save_sources(void)
|
|||
source = data->first_source;
|
||||
|
||||
while (source) {
|
||||
if ((source->info.type == OBS_SOURCE_TYPE_INPUT) != 0) {
|
||||
if ((source->info.type == OBS_SOURCE_TYPE_INPUT) != 0 &&
|
||||
cb(data_, source)) {
|
||||
obs_data_t *source_data = obs_save_source(source);
|
||||
|
||||
obs_data_array_push_back(array, source_data);
|
||||
|
@ -1602,6 +1604,18 @@ obs_data_array_t *obs_save_sources(void)
|
|||
return array;
|
||||
}
|
||||
|
||||
static bool save_source_filter(void *data, obs_source_t *source)
|
||||
{
|
||||
UNUSED_PARAMETER(data);
|
||||
UNUSED_PARAMETER(source);
|
||||
return true;
|
||||
}
|
||||
|
||||
obs_data_array_t *obs_save_sources(void)
|
||||
{
|
||||
return obs_save_sources_filtered(save_source_filter, NULL);
|
||||
}
|
||||
|
||||
/* ensures that names are never blank */
|
||||
static inline char *dup_name(const char *name)
|
||||
{
|
||||
|
|
|
@ -560,6 +560,10 @@ EXPORT void obs_load_sources(obs_data_array_t *array);
|
|||
/** Saves sources to a data array */
|
||||
EXPORT obs_data_array_t *obs_save_sources(void);
|
||||
|
||||
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);
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* View context */
|
||||
|
|
Loading…
Reference in a new issue