5 #ifndef SPA_BUFFER_ALLOC_H 6 #define SPA_BUFFER_ALLOC_H 14 #ifndef SPA_API_BUFFER_ALLOC 16 #define SPA_API_BUFFER_ALLOC SPA_API_IMPL 18 #define SPA_API_BUFFER_ALLOC static inline 29 #define SPA_BUFFER_ALLOC_FLAG_INLINE_META (1<<0) 30 #define SPA_BUFFER_ALLOC_FLAG_INLINE_CHUNK (1<<1) 31 #define SPA_BUFFER_ALLOC_FLAG_INLINE_DATA (1<<2) 32 #define SPA_BUFFER_ALLOC_FLAG_INLINE_ALL 0b111 33 #define SPA_BUFFER_ALLOC_FLAG_NO_DATA (1<<3) 70 uint32_t n_metas,
struct spa_meta metas[],
71 uint32_t n_datas,
struct spa_data datas[],
72 uint32_t data_aligns[])
136 for (i = 0, size = 0; i < n_metas; i++)
153 for (i = 0,
size = 0; i < n_datas; i++) {
154 int64_t align = data_aligns[i];
192 void *skel_mem,
void *data_mem)
197 void **dp, *skel, *data;
213 for (i = 0; i < info->
n_metas; i++) {
235 for (i = 0; i < info->
n_datas; i++) {
270 uint32_t n_buffers,
struct spa_buffer *buffers[],
271 void *skel_mem,
void *data_mem)
274 for (i = 0; i < n_buffers; i++) {
307 uint32_t data_aligns[])
312 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
size_t chunk_size
size of the chunk if not inlined
Definition: alloc.h:55
struct spa_meta * metas
array of metadata
Definition: buffer.h:117
uint32_t n_metas
Definition: alloc.h:48
#define SPA_BUFFER_ALLOC_FLAG_INLINE_DATA
add buffer data to the skeleton
Definition: alloc.h:41
#define SPA_BUFFER_ALLOC_FLAG_INLINE_ALL
Definition: alloc.h:43
uint32_t flags
Definition: alloc.h:46
size_t mem_size
size of the total memory if not inlined
Definition: alloc.h:57
size_t skel_size
size of the struct spa_buffer and inlined meta/chunk/data
Definition: alloc.h:53
#define SPA_BUFFER_ALLOC_FLAG_INLINE_META
add metadata data in the skeleton
Definition: alloc.h:37
struct spa_chunk * chunk
valid chunk of memory
Definition: buffer.h:110
SPA_API_BUFFER_ALLOC 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:316
#define SPA_ROUND_UP_N(num, align)
Definition: defs.h:360
struct spa_data * datas
array of data members
Definition: buffer.h:118
A Buffer.
Definition: buffer.h:114
Data for a buffer this stays constant for a buffer.
Definition: buffer.h:80
SPA_API_BUFFER_ALLOC 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:81
struct spa_meta * metas
Definition: alloc.h:50
size_t meta_size
size of the meta if not inlined
Definition: alloc.h:54
uint32_t n_datas
Definition: alloc.h:49
#define SPA_PTROFF(ptr_, offset_, type_)
Return the address (buffer + offset) as pointer of type.
Definition: defs.h:222
#define SPA_FLAG_IS_SET(field, flag)
Definition: defs.h:90
#define SPA_BUFFER_ALLOC_FLAG_INLINE_CHUNK
add chunk data in the skeleton
Definition: alloc.h:39
struct spa_data * datas
Definition: alloc.h:51
#define SPA_BUFFER_ALLOC_FLAG_NO_DATA
don't set data pointers
Definition: alloc.h:45
#define SPA_MAX(a, b)
Definition: defs.h:171
SPA_API_BUFFER_ALLOC 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:281
#define SPA_API_BUFFER_ALLOC
Definition: alloc.h:25
#define SPA_PTR_ALIGN(p, align, type)
Definition: defs.h:382
void * data
optional data pointer
Definition: buffer.h:109
uint32_t size
size of valid data.
Definition: buffer.h:63
Chunk of memory, can change for each buffer.
Definition: buffer.h:59
uint32_t n_metas
number of metadata
Definition: buffer.h:115
uint32_t max_align
max of all alignments
Definition: alloc.h:47
size_t data_size
size of the data if not inlined
Definition: alloc.h:56
uint32_t * data_aligns
Definition: alloc.h:52
uint32_t maxsize
max size of data
Definition: buffer.h:108
uint32_t n_datas
number of data members
Definition: buffer.h:116
SPA_API_BUFFER_ALLOC 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:203
information about the buffer layout
Definition: alloc.h:35