23 #ifndef SPA_BUFFER_ALLOC_H
24 #define SPA_BUFFER_ALLOC_H
39 #define SPA_BUFFER_ALLOC_FLAG_INLINE_META (1<<0)
40 #define SPA_BUFFER_ALLOC_FLAG_INLINE_CHUNK (1<<1)
41 #define SPA_BUFFER_ALLOC_FLAG_INLINE_DATA (1<<2)
42 #define SPA_BUFFER_ALLOC_FLAG_INLINE_ALL 0b111
43 #define SPA_BUFFER_ALLOC_FLAG_NO_DATA (1<<3)
80 uint32_t n_metas,
struct spa_meta metas[],
81 uint32_t n_datas,
struct spa_data datas[],
82 uint32_t data_aligns[])
146 for (i = 0, size = 0; i < n_metas; i++)
163 for (i = 0,
size = 0; i < n_datas; i++) {
201 void *skel_mem,
void *data_mem)
206 void **dp, *skel, *data;
222 for (i = 0; i < info->
n_metas; i++) {
244 for (i = 0; i < info->
n_datas; i++) {
279 uint32_t n_buffers,
struct spa_buffer *buffers[],
280 void *skel_mem,
void *data_mem)
283 for (i = 0; i < n_buffers; i++) {
316 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:323
#define SPA_BUFFER_ALLOC_FLAG_INLINE_ALL
Definition: alloc.h:51
#define SPA_BUFFER_ALLOC_FLAG_INLINE_META
add metadata data in the skeleton
Definition: alloc.h:45
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:89
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:288
#define SPA_BUFFER_ALLOC_FLAG_INLINE_CHUNK
add chunk data in the skeleton
Definition: alloc.h:47
#define SPA_BUFFER_ALLOC_FLAG_NO_DATA
don't set data pointers
Definition: alloc.h:53
#define SPA_BUFFER_ALLOC_FLAG_INLINE_DATA
add buffer data to the skeleton
Definition: alloc.h:49
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:210
#define SPA_ROUND_UP_N(num, align)
Definition: defs.h:296
#define SPA_PTR_ALIGN(p, align, type)
Definition: defs.h:303
#define SPA_FLAG_IS_SET(field, flag)
Definition: defs.h:82
#define SPA_PTROFF(ptr_, offset_, type_)
Return the address (buffer + offset) as pointer of type.
Definition: defs.h:183
#define SPA_MAX(a, b)
Definition: defs.h:152
information about the buffer layout
Definition: alloc.h:43
size_t mem_size
size of the total memory if not inlined
Definition: alloc.h:65
size_t data_size
size of the data if not inlined
Definition: alloc.h:64
uint32_t n_metas
Definition: alloc.h:56
uint32_t max_align
max of all alignments
Definition: alloc.h:55
size_t meta_size
size of the meta if not inlined
Definition: alloc.h:62
size_t chunk_size
size of the chunk if not inlined
Definition: alloc.h:63
size_t skel_size
size of the struct spa_buffer and inlined meta/chunk/data
Definition: alloc.h:61
struct spa_data * datas
Definition: alloc.h:59
uint32_t * data_aligns
Definition: alloc.h:60
uint32_t n_datas
Definition: alloc.h:57
struct spa_meta * metas
Definition: alloc.h:58
uint32_t flags
Definition: alloc.h:54
A Buffer.
Definition: buffer.h:105
uint32_t n_metas
number of metadata
Definition: buffer.h:106
struct spa_meta * metas
array of metadata
Definition: buffer.h:108
struct spa_data * datas
array of data members
Definition: buffer.h:109
uint32_t n_datas
number of data members
Definition: buffer.h:107
Chunk of memory, can change for each buffer.
Definition: buffer.h:62
uint32_t size
size of valid data.
Definition: buffer.h:66
Data for a buffer this stays constant for a buffer.
Definition: buffer.h:77
struct spa_chunk * chunk
valid chunk of memory
Definition: buffer.h:101
void * data
optional data pointer
Definition: buffer.h:100
uint32_t maxsize
max size of data
Definition: buffer.h:99