From 0779862cda14e39574a40ee5999d3957d01a0522 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 24 May 2021 13:12:00 +0200 Subject: [PATCH] alsa-seq: add port latency reporting --- spa/plugins/alsa/alsa-seq-bridge.c | 16 ++++++++++++++++ spa/plugins/alsa/alsa-seq.h | 3 ++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/spa/plugins/alsa/alsa-seq-bridge.c b/spa/plugins/alsa/alsa-seq-bridge.c index 513d80e40..0bbccdfde 100644 --- a/spa/plugins/alsa/alsa-seq-bridge.c +++ b/spa/plugins/alsa/alsa-seq-bridge.c @@ -411,6 +411,7 @@ static void init_port(struct seq_state *state, struct seq_port *port, const snd_ port->params[IDX_IO] = SPA_PARAM_INFO(SPA_PARAM_IO, SPA_PARAM_INFO_READ); port->params[IDX_Format] = SPA_PARAM_INFO(SPA_PARAM_Format, SPA_PARAM_INFO_WRITE); port->params[IDX_Buffers] = SPA_PARAM_INFO(SPA_PARAM_Buffers, 0); + port->params[IDX_Latency] = SPA_PARAM_INFO(SPA_PARAM_Latency, SPA_PARAM_INFO_READWRITE); port->info.params = port->params; port->info.n_params = N_PORT_PARAMS; @@ -574,6 +575,21 @@ impl_node_port_enum_params(void *object, int seq, } break; + case SPA_PARAM_Latency: + switch (result.index) { + case 0: + param = spa_pod_builder_add_object(&b, + SPA_TYPE_OBJECT_ParamLatency, id, + SPA_PARAM_LATENCY_direction, SPA_POD_Id(direction), + SPA_PARAM_LATENCY_quantum, SPA_POD_Float(1.0f), + SPA_PARAM_LATENCY_min, SPA_POD_Int(0), + SPA_PARAM_LATENCY_max, SPA_POD_Int(0)); + break; + default: + return 0; + } + break; + default: return -ENOENT; } diff --git a/spa/plugins/alsa/alsa-seq.h b/spa/plugins/alsa/alsa-seq.h index d55119b07..9a6c603b8 100644 --- a/spa/plugins/alsa/alsa-seq.h +++ b/spa/plugins/alsa/alsa-seq.h @@ -76,7 +76,8 @@ struct seq_port { #define IDX_IO 2 #define IDX_Format 3 #define IDX_Buffers 4 -#define N_PORT_PARAMS 5 +#define IDX_Latency 5 +#define N_PORT_PARAMS 6 struct spa_param_info params[N_PORT_PARAMS]; struct spa_io_buffers *io;