port: just number unknown channels

Ports with unknown channel layout are just numbered.
This commit is contained in:
Wim Taymans 2018-10-17 12:45:50 +02:00
parent 6590d3a258
commit a086fc5c0c
2 changed files with 14 additions and 6 deletions

View file

@ -171,6 +171,7 @@ static void node_port_init(void *data, struct pw_port *port)
void *iface;
const struct spa_support *support;
uint32_t n_support;
char position[8];
direction = pw_port_get_direction(port);
if (direction == n->direction)
@ -184,16 +185,22 @@ static void node_port_init(void *data, struct pw_port *port)
"port.terminal", "1",
NULL);
if ((str = pw_properties_get(old, "port.channel")) != NULL)
pw_properties_setf(new, "port.name", "%s_%s",
direction == PW_DIRECTION_INPUT ? "playback" : "capture",
str);
if ((str = pw_properties_get(old, "port.channel")) == NULL ||
strcmp(str, "UNK") == 0) {
snprintf(position, 7, "%d", port->port_id);
str = position;
}
pw_properties_setf(new, "port.name", "%s_%s",
direction == PW_DIRECTION_INPUT ? "playback" : "capture",
str);
pw_properties_setf(new, "port.alias1", "%s_pcm:%s:%s%s",
pw_properties_get(n->props, "device.api"),
pw_properties_get(n->props, "device.name"),
direction == PW_DIRECTION_INPUT ? "in" : "out",
str ? str : "UNK");
str);
pw_port_update_properties(port, &new->dict);
pw_properties_free(new);

View file

@ -535,7 +535,8 @@ int pw_port_add(struct pw_port *port, struct pw_node *node)
}
if ((str = pw_properties_get(port->properties, "port.name")) == NULL) {
if ((str = pw_properties_get(port->properties, "port.channel")) != NULL) {
if ((str = pw_properties_get(port->properties, "port.channel")) != NULL &&
strcmp(str, "UNK") != 0) {
pw_properties_setf(port->properties, "port.name", "%s_%s", dir, str);
}
else {