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:
Palana 2015-10-30 11:10:06 +01:00 committed by jp9000
parent 70fec7ae8e
commit ec86bdaa09
2 changed files with 20 additions and 2 deletions

View file

@ -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)
{

View file

@ -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 */