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
This commit is contained in:
columbarius 2020-12-07 14:57:33 +01:00 committed by Wim Taymans
parent 9b7aa168cb
commit f1ad7e2486

View file

@ -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<<SPA_DATA_MemPtr)) > 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);