Merge branch 'spa-device-external-vol-control' into 'master'

spa: alsa: Add option to send external volume control events

See merge request pipewire/pipewire!2836
This commit is contained in:
Julian Bouzas 2026-05-28 13:25:08 +00:00
commit eed1094fbd
24 changed files with 1311 additions and 99 deletions

View file

@ -3740,7 +3740,7 @@ static int fill_card_info(struct client *client, struct message *m,
}
static int fill_sink_info_proplist(struct message *m, const struct spa_dict *sink_props,
const struct pw_manager_object *card)
const struct device_info *dev_info, const struct pw_manager_object *card)
{
struct pw_device_info *card_info = card ? card->info : NULL;
spa_autoptr(pw_properties) props = NULL;
@ -3754,6 +3754,26 @@ static int fill_sink_info_proplist(struct message *m, const struct spa_dict *sin
sink_props = &props->dict;
}
if (dev_info->volume_info.flags & VOLUME_CONTROL_MASK) {
props = pw_properties_new_dict(sink_props);
if (props == NULL)
return -ENOMEM;
#define SET_PROP(k, f) pw_properties_set(props, k, dev_info->volume_info.flags & (f) ? "true" : "false")
SET_PROP("device.volume.read-volume", VOLUME_READ);
SET_PROP("device.volume.write-volume-value", VOLUME_WRITE);
SET_PROP("device.volume.write-volume-updown", VOLUME_UPDOWN);
SET_PROP("device.volume.read-mute", VOLUME_READ_MUTE);
SET_PROP("device.volume.write-mute-value", VOLUME_WRITE_MUTE);
SET_PROP("device.volume.write-mute-toggle", VOLUME_TOGGLE_MUTE);
SET_PROP("device.volume.read-balance", VOLUME_READ_BALANCE);
SET_PROP("device.volume.write-balance", VOLUME_WRITE_BALANCE);
pw_properties_add(props, card_info->props);
sink_props = &props->dict;
}
message_put(m, TAG_PROPLIST, sink_props, TAG_INVALID);
return 0;
@ -3852,7 +3872,7 @@ static int fill_sink_info(struct client *client, struct message *m,
if (client->version >= 13) {
int res;
if ((res = fill_sink_info_proplist(m, info->props, card)) < 0)
if ((res = fill_sink_info_proplist(m, info->props, &dev_info, card)) < 0)
return res;
message_put(m,
TAG_USEC, 0LL, /* requested latency */