mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -04:00
context: implement prop updates with for_each
This commit is contained in:
parent
432f464297
commit
5839400aa0
2 changed files with 18 additions and 14 deletions
|
|
@ -753,3 +753,21 @@ int pw_context_parse_conf_section(struct pw_context *context,
|
||||||
|
|
||||||
return data.count;
|
return data.count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int update_props(void *user_data, const char *location, const char *key,
|
||||||
|
const char *val, size_t len)
|
||||||
|
{
|
||||||
|
struct data *data = user_data;
|
||||||
|
data->count += pw_properties_update_string(data->props, val, len);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
SPA_EXPORT
|
||||||
|
int pw_context_conf_update_props(struct pw_context *context,
|
||||||
|
const char *section, struct pw_properties *props)
|
||||||
|
{
|
||||||
|
struct data data = { .context = context, .props = props };
|
||||||
|
pw_context_conf_section_for_each(context, section,
|
||||||
|
update_props, &data);
|
||||||
|
return data.count;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -537,20 +537,6 @@ const char *pw_context_get_conf_section(struct pw_context *context, const char *
|
||||||
return pw_properties_get(context->conf, section);
|
return pw_properties_get(context->conf, section);
|
||||||
}
|
}
|
||||||
|
|
||||||
SPA_EXPORT
|
|
||||||
int pw_context_conf_update_props(struct pw_context *context,
|
|
||||||
const char *section, struct pw_properties *props)
|
|
||||||
{
|
|
||||||
struct pw_properties *conf = context->conf;
|
|
||||||
const char *str;
|
|
||||||
int count = 0;
|
|
||||||
|
|
||||||
if ((str = pw_properties_get(conf, section)) != NULL)
|
|
||||||
count = pw_properties_update_string(props, str, strlen(str));
|
|
||||||
|
|
||||||
return count;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Update context properties
|
/** Update context properties
|
||||||
*
|
*
|
||||||
* \param context a context
|
* \param context a context
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue