spa: alsa: Add a mechanism for external volume control

Currently enabled at device creation and delegated to an external entity
via a varlink protocol.
This commit is contained in:
Arun Raghavan 2026-02-11 15:06:56 -08:00
parent c1031bef1b
commit 283c091b71
9 changed files with 758 additions and 88 deletions

View file

@ -21,6 +21,7 @@
#include <spa/support/loop.h>
#include <spa/support/plugin.h>
#include <spa/support/i18n.h>
#include <spa/support/varlink.h>
#include <spa/monitor/device.h>
#include <spa/monitor/utils.h>
#include <spa/monitor/event.h>
@ -36,6 +37,7 @@
#include "acp/acp.h"
extern struct spa_i18n *acp_i18n;
extern struct spa_varlink *acp_varlink;
#define MAX_POLL 16
#define MAX_CHANNELS SPA_AUDIO_MAX_CHANNELS
@ -63,6 +65,7 @@ struct impl {
struct spa_log *log;
struct spa_loop *loop;
struct spa_varlink *varlink;
uint32_t info_all;
struct spa_device_info info;
@ -490,6 +493,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);
@ -1152,6 +1160,7 @@ impl_init(const struct spa_handle_factory *factory,
this->loop = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Loop);
acp_i18n = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_I18N);
acp_varlink = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Varlink);
if (this->loop == NULL) {
spa_log_error(this->log, "a Loop interface is needed");
return -EINVAL;