audio-dsp: implement buffer size param

This commit is contained in:
Wim Taymans 2018-02-16 18:15:37 +01:00
parent 9cb2891741
commit f039238288

View file

@ -438,7 +438,7 @@ static int port_enum_params(struct spa_node *node,
struct spa_pod_builder *builder) struct spa_pod_builder *builder)
{ {
struct node *n = SPA_CONTAINER_OF(node, struct node, node_impl); struct node *n = SPA_CONTAINER_OF(node, struct node, node_impl);
struct pw_type *type = n->impl->t; struct pw_type *t = n->impl->t;
struct spa_pod *param; struct spa_pod *param;
struct spa_pod_builder b = { 0 }; struct spa_pod_builder b = { 0 };
uint8_t buffer[1024]; uint8_t buffer[1024];
@ -447,14 +447,25 @@ static int port_enum_params(struct spa_node *node,
next: next:
spa_pod_builder_init(&b, buffer, sizeof(buffer)); spa_pod_builder_init(&b, buffer, sizeof(buffer));
if (id == type->param.idEnumFormat) { if (id == t->param.idEnumFormat) {
if ((res = port_enum_formats(node, direction, port_id, index, filter, &param, &b)) <= 0) if ((res = port_enum_formats(node, direction, port_id, index, filter, &param, &b)) <= 0)
return res; return res;
} }
else if (id == type->param.idFormat) { else if (id == t->param.idFormat) {
if ((res = port_enum_formats(node, direction, port_id, index, filter, &param, &b)) <= 0) if ((res = port_enum_formats(node, direction, port_id, index, filter, &param, &b)) <= 0)
return res; return res;
} }
else if (id == t->param.idBuffers) {
if (*index > 0)
return 0;
param = spa_pod_builder_object(&b,
id, t->param_buffers.Buffers,
":", t->param_buffers.size, "i", n->buffer_size * sizeof(float),
":", t->param_buffers.stride, "i", 0,
":", t->param_buffers.buffers, "ir", 2, 2, 1, 2,
":", t->param_buffers.align, "i", 16);
}
else else
return -ENOENT; return -ENOENT;