pipewire-pulse: use defines for our keys

This commit is contained in:
Wim Taymans 2020-12-18 17:19:24 +01:00
parent a25f1a6a1d
commit f7a7feea4e

View file

@ -162,21 +162,21 @@ static int load_module(struct client *client, const char *name, const char *argu
goto out; goto out;
} }
if ((str = pw_properties_get(props, "sink_name")) != NULL) { if ((str = pw_properties_get(props, "sink_name")) != NULL) {
pw_properties_set(props, "node.name", str); pw_properties_set(props, PW_KEY_NODE_NAME, str);
pw_properties_set(props, "sink_name", NULL); pw_properties_set(props, "sink_name", NULL);
} else { } else {
pw_properties_set(props, "node.name", "null"); pw_properties_set(props, PW_KEY_NODE_NAME, "null");
} }
if ((str = pw_properties_get(props, "sink_properties")) != NULL) { if ((str = pw_properties_get(props, "sink_properties")) != NULL) {
add_props(props, str); add_props(props, str);
pw_properties_set(props, "sink_properties", NULL); pw_properties_set(props, "sink_properties", NULL);
} }
if ((str = pw_properties_get(props, "channels")) != NULL) { if ((str = pw_properties_get(props, "channels")) != NULL) {
pw_properties_set(props, "audio.channels", str); pw_properties_set(props, SPA_KEY_AUDIO_CHANNELS, str);
pw_properties_set(props, "channels", NULL); pw_properties_set(props, "channels", NULL);
} }
if ((str = pw_properties_get(props, "rate")) != NULL) { if ((str = pw_properties_get(props, "rate")) != NULL) {
pw_properties_set(props, "audio.rate", str); pw_properties_set(props, SPA_KEY_AUDIO_RATE, str);
pw_properties_set(props, "rate", NULL); pw_properties_set(props, "rate", NULL);
} }
if ((str = pw_properties_get(props, "channel_map")) != NULL) { if ((str = pw_properties_get(props, "channel_map")) != NULL) {
@ -190,14 +190,14 @@ static int load_module(struct client *client, const char *name, const char *argu
for (i = 0; i < map.channels; i++) for (i = 0; i < map.channels; i++)
p += snprintf(p, 6, "%s%s", i == 0 ? "" : ",", p += snprintf(p, 6, "%s%s", i == 0 ? "" : ",",
channel_id2name(map.map[i])); channel_id2name(map.map[i]));
pw_properties_set(props, "audio.position", s); pw_properties_set(props, SPA_KEY_AUDIO_POSITION, s);
pw_properties_set(props, "channel_map", NULL); pw_properties_set(props, "channel_map", NULL);
} }
if ((str = pw_properties_get(props, "device.description")) != NULL) { if ((str = pw_properties_get(props, "device.description")) != NULL) {
pw_properties_set(props, "node.description", str); pw_properties_set(props, PW_KEY_NODE_DESCRIPTION, str);
pw_properties_set(props, "device.description", NULL); pw_properties_set(props, "device.description", NULL);
} }
pw_properties_set(props, "factory.name", "support.null-audio-sink"); pw_properties_set(props, PW_KEY_FACTORY_NAME, "support.null-audio-sink");
module = calloc(1, sizeof(struct module)); module = calloc(1, sizeof(struct module));
module->client = client; module->client = client;
@ -207,7 +207,6 @@ static int load_module(struct client *client, const char *name, const char *argu
if ((res = load_null_sink_module(client, module, props)) < 0) if ((res = load_null_sink_module(client, module, props)) < 0)
goto out; goto out;
} }
out: out:
if (res < 0) { if (res < 0) {
free(module); free(module);