5#ifndef SPA_BUFFER_ALLOC_H
6#define SPA_BUFFER_ALLOC_H
21#define SPA_BUFFER_ALLOC_FLAG_INLINE_META (1<<0)
22#define SPA_BUFFER_ALLOC_FLAG_INLINE_CHUNK (1<<1)
23#define SPA_BUFFER_ALLOC_FLAG_INLINE_DATA (1<<2)
24#define SPA_BUFFER_ALLOC_FLAG_INLINE_ALL 0b111
25#define SPA_BUFFER_ALLOC_FLAG_NO_DATA (1<<3)
62 uint32_t n_metas,
struct spa_meta metas[],
63 uint32_t n_datas,
struct spa_data datas[],
64 uint32_t data_aligns[])
128 for (i = 0, size = 0; i < n_metas; i++)
145 for (i = 0,
size = 0; i < n_datas; i++) {
146 int64_t align = data_aligns[i];
184 void *skel_mem,
void *data_mem)
189 void **dp, *skel, *data;
205 for (i = 0; i < info->
n_metas; i++) {
227 for (i = 0; i < info->
n_datas; i++) {
262 uint32_t n_buffers,
struct spa_buffer *buffers[],
263 void *skel_mem,
void *data_mem)
266 for (i = 0; i < n_buffers; i++) {
299 uint32_t data_aligns[])
static struct spa_buffer ** spa_buffer_alloc_array(uint32_t n_buffers, uint32_t flags, uint32_t n_metas, struct spa_meta metas[], uint32_t n_datas, struct spa_data datas[], uint32_t data_aligns[])
Allocate an array of buffers.
Definition: alloc.h:306
#define SPA_BUFFER_ALLOC_FLAG_INLINE_ALL
Definition: alloc.h:33
static struct spa_buffer * spa_buffer_alloc_layout(struct spa_buffer_alloc_info *info, void *skel_mem, void *data_mem)
Fill skeleton and data according to the allocation info.
Definition: alloc.h:193
#define SPA_BUFFER_ALLOC_FLAG_INLINE_META
add metadata data in the skeleton
Definition: alloc.h:27
static int spa_buffer_alloc_fill_info(struct spa_buffer_alloc_info *info, uint32_t n_metas, struct spa_meta metas[], uint32_t n_datas, struct spa_data datas[], uint32_t data_aligns[])
Fill buffer allocation information.
Definition: alloc.h:71
static int spa_buffer_alloc_layout_array(struct spa_buffer_alloc_info *info, uint32_t n_buffers, struct spa_buffer *buffers[], void *skel_mem, void *data_mem)
Layout an array of buffers.
Definition: alloc.h:271
#define SPA_BUFFER_ALLOC_FLAG_INLINE_CHUNK
add chunk data in the skeleton
Definition: alloc.h:29
#define SPA_BUFFER_ALLOC_FLAG_NO_DATA
don't set data pointers
Definition: alloc.h:35
#define SPA_BUFFER_ALLOC_FLAG_INLINE_DATA
add buffer data to the skeleton
Definition: alloc.h:31
#define SPA_ROUND_UP_N(num, align)
Definition: defs.h:320
#define SPA_PTR_ALIGN(p, align, type)
Definition: defs.h:335
#define SPA_FLAG_IS_SET(field, flag)
Definition: defs.h:76
#define SPA_PTROFF(ptr_, offset_, type_)
Return the address (buffer + offset) as pointer of type.
Definition: defs.h:194
#define SPA_MAX(a, b)
Definition: defs.h:157
information about the buffer layout
Definition: alloc.h:25
size_t mem_size
size of the total memory if not inlined
Definition: alloc.h:47
size_t data_size
size of the data if not inlined
Definition: alloc.h:46
uint32_t n_metas
Definition: alloc.h:38
uint32_t max_align
max of all alignments
Definition: alloc.h:37
size_t meta_size
size of the meta if not inlined
Definition: alloc.h:44
size_t chunk_size
size of the chunk if not inlined
Definition: alloc.h:45
size_t skel_size
size of the struct spa_buffer and inlined meta/chunk/data
Definition: alloc.h:43
struct spa_data * datas
Definition: alloc.h:41
uint32_t * data_aligns
Definition: alloc.h:42
uint32_t n_datas
Definition: alloc.h:39
struct spa_meta * metas
Definition: alloc.h:40
uint32_t flags
Definition: alloc.h:36
A Buffer.
Definition: buffer/buffer.h:90
uint32_t n_metas
number of metadata
Definition: buffer/buffer.h:91
struct spa_meta * metas
array of metadata
Definition: buffer/buffer.h:93
struct spa_data * datas
array of data members
Definition: buffer/buffer.h:94
uint32_t n_datas
number of data members
Definition: buffer/buffer.h:92
Chunk of memory, can change for each buffer.
Definition: buffer/buffer.h:43
uint32_t size
size of valid data.
Definition: buffer/buffer.h:47
Data for a buffer this stays constant for a buffer.
Definition: buffer/buffer.h:62
struct spa_chunk * chunk
valid chunk of memory
Definition: buffer/buffer.h:86
void * data
optional data pointer
Definition: buffer/buffer.h:85
uint32_t maxsize
max size of data
Definition: buffer/buffer.h:84