clarify PIPEWIRE_NODE

PIPEWIRE_NODE is mapped to TARGET_OBJECT so it contains the serial or
the node name.
Make sure pw-stream maps this to TARGET_OBJECT.
Make JACK use the PIPEWIRE_NODE for serial or node.name.
This commit is contained in:
Wim Taymans 2023-01-10 17:11:43 +01:00
parent 2254c74fb9
commit 95f87301c7
3 changed files with 11 additions and 10 deletions

View file

@ -55,7 +55,8 @@ applications:
samplerate. This function will attempt to change
the graph samplerate to `denom` and use the
specified `num` as the buffer size.
* `PIPEWIRE_NODE=<id>` to request a link to the specified node
* `PIPEWIRE_NODE=<id>` to request a link to the specified node. The
id can be a node.name or object.serial of the target node.
### Using tools

View file

@ -5591,16 +5591,13 @@ const char ** jack_get_ports (jack_client_t *client,
struct object *o;
struct pw_array tmp;
const char *str;
uint32_t i, count, id;
uint32_t i, count;
int r;
regex_t port_regex, type_regex;
spa_return_val_if_fail(c != NULL, NULL);
if ((str = getenv("PIPEWIRE_NODE")) != NULL)
id = pw_properties_parse_int(str);
else
id = SPA_ID_INVALID;
str = getenv("PIPEWIRE_NODE");
if (port_name_pattern && port_name_pattern[0]) {
if ((r = regcomp(&port_regex, port_name_pattern, REG_EXTENDED | REG_NOSUB)) != 0) {
@ -5615,7 +5612,7 @@ const char ** jack_get_ports (jack_client_t *client,
}
}
pw_log_debug("%p: ports id:%d name:\"%s\" type:\"%s\" flags:%08lx", c, id,
pw_log_debug("%p: ports target:%s name:\"%s\" type:\"%s\" flags:%08lx", c, str,
port_name_pattern, type_name_pattern, flags);
pthread_mutex_lock(&c->context.lock);
@ -5631,8 +5628,11 @@ const char ** jack_get_ports (jack_client_t *client,
continue;
if (!SPA_FLAG_IS_SET(o->port.flags, flags))
continue;
if (id != SPA_ID_INVALID && o->port.node_id != id)
continue;
if (str != NULL && o->port.node != NULL) {
if (!spa_strstartswith(o->port.name, str) &&
o->port.node->serial != atoll(str))
continue;
}
if (port_name_pattern && port_name_pattern[0]) {
bool match;

View file

@ -1892,7 +1892,7 @@ pw_stream_connect(struct pw_stream *stream,
if (target_id != PW_ID_ANY)
pw_properties_setf(stream->properties, PW_KEY_NODE_TARGET, "%d", target_id);
else if ((str = getenv("PIPEWIRE_NODE")) != NULL)
pw_properties_set(stream->properties, PW_KEY_NODE_TARGET, str);
pw_properties_set(stream->properties, PW_KEY_TARGET_OBJECT, str);
if ((flags & PW_STREAM_FLAG_AUTOCONNECT) &&
pw_properties_get(stream->properties, PW_KEY_NODE_AUTOCONNECT) == NULL) {
str = getenv("PIPEWIRE_AUTOCONNECT");