pulse-server: also remap module property keys and values

When loading a module, remap the pulseaudio properties to pipewire ones
for consistency.

move the media-roles to remap, because it's more about remapping between
pa and pw.

Fixes #2076
This commit is contained in:
Wim Taymans 2022-02-04 15:15:42 +01:00
parent 8c10080324
commit 143fadf68e
7 changed files with 36 additions and 25 deletions

View file

@ -41,6 +41,7 @@
#include "internal.h"
#include "log.h"
#include "module.h"
#include "remap.h"
static void on_module_unload(void *obj, void *data, int res, uint32_t index)
{
@ -139,6 +140,7 @@ void module_args_add_props(struct pw_properties *props, const char *str)
{
char *s = strdup(str), *p = s, *e, f;
const char *k, *v;
const struct str_map *map;
while (*p) {
e = strchr(p, '=');
@ -168,6 +170,13 @@ void module_args_add_props(struct pw_properties *props, const char *str)
if (*e != '\0')
p++;
*e = '\0';
if ((map = str_map_find(props_key_map, NULL, k)) != NULL) {
k = map->pw_str;
if (map->child != NULL &&
(map = str_map_find(map->child, NULL, v)) != NULL)
v = map->pw_str;
}
pw_properties_set(props, k, v);
}
free(s);