spa: alsa: Add a mechanism for external volume control

Currently enabled at device creation and delegated to an external entity
via spa_device events.
This commit is contained in:
Julian Bouzas 2026-05-15 10:11:13 -04:00
parent c81c66826e
commit eb9a751257
9 changed files with 614 additions and 85 deletions

View file

@ -490,6 +490,11 @@ static struct spa_pod *build_route(struct spa_pod_builder *b, uint32_t id,
dev->n_codecs, dev->codecs);
}
if (dev->ext_volume_flags) {
spa_pod_builder_prop(b, SPA_PROP_volumeControlFlags, 0);
spa_pod_builder_id(b, dev->ext_volume_flags);
}
spa_pod_builder_pop(b, &f[1]);
}
spa_pod_builder_prop(b, SPA_PARAM_ROUTE_devices, 0);
@ -1083,6 +1088,12 @@ static void on_mute_changed(void *data, struct acp_device *dev)
spa_device_emit_event(&this->hooks, event);
}
static void on_ext_vol_event_available(void *data, struct spa_event *event)
{
struct impl *this = data;
spa_device_emit_event(&this->hooks, event);
}
static const struct acp_card_events card_events = {
ACP_VERSION_CARD_EVENTS,
.props_changed = card_props_changed,
@ -1092,6 +1103,7 @@ static const struct acp_card_events card_events = {
.port_available = card_port_available,
.volume_changed = on_volume_changed,
.mute_changed = on_mute_changed,
.ext_vol_event_available = on_ext_vol_event_available,
};
static int impl_get_interface(struct spa_handle *handle, const char *type, void **interface)