buffer: more work on buffer allocation

Separate buffer sizes in the info. Make it possible to not set
data pointers for when we use memfd for the memory.
Improve format conversion.
Work on in-place conversion in test-convert2
This commit is contained in:
Wim Taymans 2018-04-09 09:30:56 +02:00
parent 142ef38df9
commit 53e03019da
6 changed files with 121 additions and 78 deletions

View file

@ -800,25 +800,25 @@ static int impl_node_process(struct spa_node *node)
{
int i, n_bytes;
uint32_t n_src_datas = sbuf->outbuf->n_datas;
uint32_t n_dst_datas = dbuf->outbuf->n_datas;
struct spa_buffer *sb = sbuf->outbuf, *db = dbuf->outbuf;
uint32_t n_src_datas = sb->n_datas;
uint32_t n_dst_datas = db->n_datas;
const void *src_datas[n_src_datas];
void *dst_datas[n_dst_datas];
n_bytes = sbuf->outbuf->datas[0].chunk->size;
n_bytes = sb->datas[0].chunk->size;
for (i = 0; i < n_src_datas; i++)
src_datas[i] = sbuf->outbuf->datas[i].data;
for (i = 0; i < n_dst_datas; i++)
dst_datas[i] = dbuf->outbuf->datas[i].data;
src_datas[i] = sb->datas[i].data;
for (i = 0; i < n_dst_datas; i++) {
dst_datas[i] = db->datas[i].data;
db->datas[i].chunk->size =
(n_bytes / inport->stride) * outport->stride;
}
this->convert(this, n_dst_datas, dst_datas,
n_src_datas, src_datas,
this->matrix, n_bytes);
for (i = 0; i < n_dst_datas; i++)
dbuf->outbuf->datas[i].chunk->size = (n_bytes / inport->stride) *
outport->stride;
}
outio->status = SPA_STATUS_HAVE_BUFFER;