From f1ad7e2486d5605acca7f4c211f06a6935f23276 Mon Sep 17 00:00:00 2001 From: columbarius Date: Mon, 7 Dec 2020 14:57:33 +0100 Subject: [PATCH] filter: Add mappable dataTypes to SPA_PARAM_BUFFERS_dataType if PW_FILTER_PORT_MAP_BUFFERS is set for inputs This lets consumer just set SPA_DATA_MemPtr as their supported dataType and will add all by PW_STREAM_MAP_BUFFERS supported dataTypes, which are made available with the MemPtr API to the param --- src/pipewire/filter.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/pipewire/filter.c b/src/pipewire/filter.c index ca5e25cdf..91879ff25 100644 --- a/src/pipewire/filter.c +++ b/src/pipewire/filter.c @@ -188,6 +188,28 @@ static struct param *add_param(struct filter *impl, struct port *port, if (p == NULL) return NULL; + if (id == SPA_PARAM_Buffers && SPA_FLAG_IS_SET(port->flags, PW_FILTER_PORT_FLAG_MAP_BUFFERS) && + port->direction == SPA_DIRECTION_INPUT) + { + const struct spa_pod_prop *pod_param; + uint32_t dataType = 0; + + pod_param = spa_pod_find_prop(param, NULL, SPA_PARAM_BUFFERS_dataType); + if (pod_param != NULL) + { + spa_pod_get_int(&pod_param->value, (int32_t*)&dataType); + pw_log_debug(NAME" dataType: %d", dataType); + if ((dataType & (1< 0) + { + pw_log_debug(NAME" Change dataType"); + struct spa_pod_int *int_pod = (struct spa_pod_int*)&pod_param->value; + dataType = dataType | mappable_dataTypes; + pw_log_debug(NAME" dataType: %d", dataType); + int_pod->value = dataType; + } + } + } + p->id = id; p->flags = flags; p->param = SPA_MEMBER(p, sizeof(struct param), struct spa_pod);