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++) {
164 int64_t align = data_aligns[i];
202 void *skel_mem,
void *data_mem)
207 void **dp, *skel, *data;
223 for (i = 0; i < info->
n_metas; i++) {
245 for (i = 0; i < info->
n_datas; i++) {
280 uint32_t n_buffers,
struct spa_buffer *buffers[],
281 void *skel_mem,
void *data_mem)
284 for (i = 0; i < n_buffers; i++) {
317 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:324
#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:289
#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:211
#define SPA_ROUND_UP_N(num, align)
Definition: defs.h:336
#define SPA_PTR_ALIGN(p, align, type)
Definition: defs.h:343
#define SPA_FLAG_IS_SET(field, flag)
Definition: defs.h:92
#define SPA_PTROFF(ptr_, offset_, type_)
Return the address (buffer + offset) as pointer of type.
Definition: defs.h:210
#define SPA_MAX(a, b)
Definition: defs.h:173
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:109
uint32_t n_metas
number of metadata
Definition: buffer.h:110
struct spa_meta * metas
array of metadata
Definition: buffer.h:112
struct spa_data * datas
array of data members
Definition: buffer.h:113
uint32_t n_datas
number of data members
Definition: buffer.h:111
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:81
struct spa_chunk * chunk
valid chunk of memory
Definition: buffer.h:105
void * data
optional data pointer
Definition: buffer.h:104
uint32_t maxsize
max size of data
Definition: buffer.h:103