mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
jack: fix default source and sink handling
This commit is contained in:
parent
8c893cbc4a
commit
759e1ccb6b
1 changed files with 28 additions and 18 deletions
|
|
@ -2003,27 +2003,36 @@ static int metadata_property(void *object, uint32_t id,
|
|||
|
||||
pw_log_info("set id:%u key:'%s' value:'%s' type:'%s'", id, key, value, type);
|
||||
|
||||
o = pw_map_lookup(&c->context.globals, id);
|
||||
if (o == NULL)
|
||||
return -EINVAL;
|
||||
if (id == PW_ID_CORE) {
|
||||
if (key) {
|
||||
uint32_t val = value ? (uint32_t)atoi(value) : SPA_ID_INVALID;
|
||||
if (strcmp(key, "default.audio.sink") == 0) {
|
||||
c->metadata->default_audio_sink = val;
|
||||
} else if (strcmp(key, "default.audio.source") == 0) {
|
||||
c->metadata->default_audio_source = val;
|
||||
}
|
||||
} else {
|
||||
c->metadata->default_audio_source = SPA_ID_INVALID;
|
||||
c->metadata->default_audio_sink = SPA_ID_INVALID;
|
||||
}
|
||||
} else {
|
||||
o = pw_map_lookup(&c->context.globals, id);
|
||||
if (o == NULL)
|
||||
return -EINVAL;
|
||||
|
||||
switch (o->type) {
|
||||
case INTERFACE_Node:
|
||||
uuid = client_make_uuid(id);
|
||||
break;
|
||||
case INTERFACE_Port:
|
||||
uuid = jack_port_uuid_generate(id);
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
switch (o->type) {
|
||||
case INTERFACE_Node:
|
||||
uuid = client_make_uuid(id);
|
||||
break;
|
||||
case INTERFACE_Port:
|
||||
uuid = jack_port_uuid_generate(id);
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
update_property(c, uuid, key, type, value);
|
||||
}
|
||||
update_property(c, uuid, key, type, value);
|
||||
|
||||
if (key && strcmp(key, "default.audio.sink") == 0) {
|
||||
c->metadata->default_audio_sink = value ? (uint32_t)atoi(value) : SPA_ID_INVALID;
|
||||
} else if (key && strcmp(key, "default.audio.source") == 0) {
|
||||
c->metadata->default_audio_source = value ? (uint32_t)atoi(value) : SPA_ID_INVALID;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -4072,6 +4081,7 @@ static int port_compare_func(const void *v1, const void *v2)
|
|||
is_cap1 = ((*o1)->port.flags & JackPortIsOutput) == JackPortIsOutput;
|
||||
is_cap2 = ((*o2)->port.flags & JackPortIsOutput) == JackPortIsOutput;
|
||||
|
||||
|
||||
if (c->metadata) {
|
||||
if (is_cap1)
|
||||
is_def1 = (*o1)->port.node_id == c->metadata->default_audio_source;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue