impl-port: handle tags like latency

No links on the port will result in a NULL tag and >0 links will always
result in a non-NULL tag (that could be empty).

This makes it easier to see when a port is linked or not.
This commit is contained in:
Wim Taymans 2025-11-05 11:26:23 +01:00
parent ffb7663f4d
commit fc55ceb2f4

View file

@ -1874,11 +1874,10 @@ int pw_impl_port_recalc_tag(struct pw_impl_port *port)
tag = other->tag[other->direction]; tag = other->tag[other->direction];
if (tag) { if (tag) {
void *state = NULL; void *state = NULL;
while (spa_tag_parse(tag, &info, &state) == 1) { while (spa_tag_parse(tag, &info, &state) == 1)
spa_tag_build_add_info(&b.b, info.info); spa_tag_build_add_info(&b.b, info.info);
count++;
}
} }
count++;
} }
} else { } else {
spa_list_for_each(l, &port->links, input_link) { spa_list_for_each(l, &port->links, input_link) {
@ -1886,11 +1885,10 @@ int pw_impl_port_recalc_tag(struct pw_impl_port *port)
tag = other->tag[other->direction]; tag = other->tag[other->direction];
if (tag) { if (tag) {
void *state = NULL; void *state = NULL;
while (spa_tag_parse(tag, &info, &state) == 1) { while (spa_tag_parse(tag, &info, &state) == 1)
spa_tag_build_add_info(&b.b, info.info); spa_tag_build_add_info(&b.b, info.info);
count++;
}
} }
count++;
} }
} }
param = count == 0 ? NULL : spa_tag_build_end(&b.b, &f); param = count == 0 ? NULL : spa_tag_build_end(&b.b, &f);