libobs: Add obs_source_info::get_properties2
Uses type_data to get the type-specific data of a source type
This commit is contained in:
@@ -722,14 +722,18 @@ obs_data_t *obs_get_source_defaults(const char *id)
|
||||
obs_properties_t *obs_get_source_properties(const char *id)
|
||||
{
|
||||
const struct obs_source_info *info = get_source_info(id);
|
||||
if (info && info->get_properties) {
|
||||
if (info && (info->get_properties || info->get_properties2)) {
|
||||
obs_data_t *defaults = get_defaults(info);
|
||||
obs_properties_t *properties;
|
||||
obs_properties_t *props;
|
||||
|
||||
properties = info->get_properties(NULL);
|
||||
obs_properties_apply_settings(properties, defaults);
|
||||
if (info->get_properties2)
|
||||
props = info->get_properties2(NULL, info->type_data);
|
||||
else
|
||||
props = info->get_properties(NULL);
|
||||
|
||||
obs_properties_apply_settings(props, defaults);
|
||||
obs_data_release(defaults);
|
||||
return properties;
|
||||
return props;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@@ -737,13 +741,13 @@ obs_properties_t *obs_get_source_properties(const char *id)
|
||||
bool obs_is_source_configurable(const char *id)
|
||||
{
|
||||
const struct obs_source_info *info = get_source_info(id);
|
||||
return info && info->get_properties;
|
||||
return info && (info->get_properties || info->get_properties2);
|
||||
}
|
||||
|
||||
bool obs_source_configurable(const obs_source_t *source)
|
||||
{
|
||||
return data_valid(source, "obs_source_configurable") &&
|
||||
source->info.get_properties;
|
||||
(source->info.get_properties || source->info.get_properties2);
|
||||
}
|
||||
|
||||
obs_properties_t *obs_source_properties(const obs_source_t *source)
|
||||
@@ -751,7 +755,14 @@ obs_properties_t *obs_source_properties(const obs_source_t *source)
|
||||
if (!data_valid(source, "obs_source_properties"))
|
||||
return NULL;
|
||||
|
||||
if (source->info.get_properties) {
|
||||
if (source->info.get_properties2) {
|
||||
obs_properties_t *props;
|
||||
props = source->info.get_properties2(source->context.data,
|
||||
source->info.type_data);
|
||||
obs_properties_apply_settings(props, source->context.settings);
|
||||
return props;
|
||||
|
||||
} else if (source->info.get_properties) {
|
||||
obs_properties_t *props;
|
||||
props = source->info.get_properties(source->context.data);
|
||||
obs_properties_apply_settings(props, source->context.settings);
|
||||
|
@@ -209,6 +209,7 @@ struct obs_source_info {
|
||||
* Gets the property information of this source
|
||||
*
|
||||
* @return The properties data
|
||||
* @deprecated Use get_properties2 if type_data is needed
|
||||
*/
|
||||
obs_properties_t *(*get_properties)(void *data);
|
||||
|
||||
@@ -437,6 +438,15 @@ struct obs_source_info {
|
||||
* @param[out] settings Data to assign default settings to
|
||||
*/
|
||||
void (*get_defaults2)(void *type_data, obs_data_t *settings);
|
||||
|
||||
/**
|
||||
* Gets the property information of this source
|
||||
*
|
||||
* @param data Source data
|
||||
* @param type_data The type_data variable of this structure
|
||||
* @return The properties data
|
||||
*/
|
||||
obs_properties_t *(*get_properties2)(void *data, void *type_data);
|
||||
};
|
||||
|
||||
EXPORT void obs_register_source_s(const struct obs_source_info *info,
|
||||
|
Reference in New Issue
Block a user