PipeWire
0.3.33
|
Buffers describe the data and metadata that is exchanged between ports of a node. More...
Data Structures | |
struct | spa_buffer_alloc_info |
information about the buffer layout More... | |
struct | spa_chunk |
Chunk of memory, can change for each buffer. More... | |
struct | spa_data |
Data for a buffer this stays constant for a buffer. More... | |
struct | spa_buffer |
A Buffer. More... | |
struct | spa_meta |
A metadata element. More... | |
struct | spa_meta_header |
Describes essential buffer header metadata such as flags and timestamps. More... | |
struct | spa_meta_region |
metadata structure for Region or an array of these for RegionArray More... | |
struct | spa_meta_bitmap |
Bitmap information. More... | |
struct | spa_meta_cursor |
Cursor information. More... | |
struct | spa_meta_control |
a timed set of events associated with the buffer More... | |
struct | spa_meta_busy |
a busy counter for the buffer More... | |
Functions | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
struct spa_meta * | spa_buffer_find_meta (const struct spa_buffer *b, uint32_t type) |
Find metadata in a buffer. More... | |
void * | spa_buffer_find_meta_data (const struct spa_buffer *b, uint32_t type, size_t size) |
Variables | |
const struct spa_type_info | spa_type_data_type [] |
const struct spa_type_info | spa_type_meta_type [] |
Buffers describe the data and metadata that is exchanged between ports of a node.
#define spa_meta_bitmap_is_valid | ( | m | ) | ((m)->format != 0) |
#define spa_meta_check | ( | p, | |
m | |||
) | (SPA_PTROFF(p,sizeof(*p),void) <= spa_meta_end(m)) |
#define spa_meta_cursor_is_valid | ( | m | ) | ((m)->id != 0) |
#define spa_meta_end | ( | m | ) | SPA_PTROFF((m)->data,(m)->size,void) |
#define spa_meta_first | ( | m | ) | ((m)->data) |
#define spa_meta_for_each | ( | pos, | |
meta | |||
) |
iterate all the items in a metadata
#define spa_meta_region_is_valid | ( | m | ) | ((m)->region.size.width != 0 && (m)->region.size.height != 0) |
#define SPA_TYPE_INFO_Buffer SPA_TYPE_INFO_POINTER_BASE "Buffer" |
#define SPA_TYPE_INFO_BUFFER_BASE SPA_TYPE_INFO_Buffer ":" |
#define SPA_TYPE_INFO_Data SPA_TYPE_INFO_ENUM_BASE "Data" |
Buffers contain data of a certain type.
#define SPA_TYPE_INFO_DATA_BASE SPA_TYPE_INFO_Data ":" |
#define SPA_TYPE_INFO_DATA_Fd SPA_TYPE_INFO_DATA_BASE "Fd" |
base type for fd based memory
#define SPA_TYPE_INFO_DATA_FD_BASE SPA_TYPE_INFO_DATA_Fd ":" |
#define SPA_TYPE_INFO_Meta SPA_TYPE_INFO_POINTER_BASE "Meta" |
#define SPA_TYPE_INFO_META_Array SPA_TYPE_INFO_META_BASE "Array" |
#define SPA_TYPE_INFO_META_ARRAY_BASE SPA_TYPE_INFO_META_Array ":" |
#define SPA_TYPE_INFO_META_ARRAY_Region SPA_TYPE_INFO_META_ARRAY_BASE "Region" |
#define SPA_TYPE_INFO_META_ARRAY_REGION_BASE SPA_TYPE_INFO_META_ARRAY_Region ":" |
#define SPA_TYPE_INFO_META_BASE SPA_TYPE_INFO_Meta ":" |
#define SPA_TYPE_INFO_META_Region SPA_TYPE_INFO_META_BASE "Region" |
#define SPA_TYPE_INFO_META_REGION_BASE SPA_TYPE_INFO_META_Region ":" |
enum spa_data_type |
Enumerator | |
---|---|
SPA_DATA_Invalid | |
SPA_DATA_MemPtr | pointer to memory, the data field in struct spa_data is set. |
SPA_DATA_MemFd | generic fd, mmap to get to memory |
SPA_DATA_DmaBuf | fd to dmabuf memory |
SPA_DATA_MemId | memory is identified with an id |
_SPA_DATA_LAST | not part of ABI |
enum spa_meta_type |
Enumerator | |
---|---|
SPA_META_Invalid | |
SPA_META_Header | struct spa_meta_header |
SPA_META_VideoCrop | struct spa_meta_region with cropping data |
SPA_META_VideoDamage | array of struct spa_meta_region with damage |
SPA_META_Bitmap | struct spa_meta_bitmap |
SPA_META_Cursor | struct spa_meta_cursor |
SPA_META_Control | metadata contains a spa_meta_control associated with the data |
SPA_META_Busy | don't write to buffer when count > 0 |
_SPA_META_LAST | not part of ABI/API |
|
inline |
Allocate an array of buffers.
Allocate n_buffers with the given metadata, memory and alignment information.
The buffer array, structures, data and metadata will all be allocated in one block of memory with the proper requested alignment.
n_buffers | the number of buffers to create |
flags | extra flags |
n_metas | number of metadatas |
metas | n_metas metadata specification |
n_datas | number of datas |
datas | n_datas memory specification |
data_aligns | n_datas alignment specifications |
References spa_buffer_alloc_info::data_aligns, spa_buffer_alloc_info::datas, spa_buffer_alloc_info::flags, spa_buffer_alloc_info::max_align, spa_buffer_alloc_info::metas, spa_buffer_alloc_info::n_datas, spa_buffer_alloc_info::n_metas, spa_buffer_alloc_info::skel_size, spa_buffer_alloc_fill_info(), SPA_BUFFER_ALLOC_FLAG_INLINE_ALL, spa_buffer_alloc_layout_array(), SPA_PTR_ALIGN, and SPA_PTROFF.
|
inline |
Fill buffer allocation information.
Fill info with allocation information needed to allocate buffers with the given number of metadata and data members.
The required size of the skeleton (the struct spa_buffer) information and the memory (for the metadata, chunk and buffer memory) will be calculated.
The flags member in info should be configured before calling this functions.
info | the information to fill |
n_metas | the number of metadatas for the buffer |
metas | an array of metadata items |
n_datas | the number of datas for the buffer |
datas | an array of n_datas items |
data_aligns | n_datas alignments |
References spa_buffer_alloc_info::chunk_size, spa_buffer_alloc_info::data_aligns, spa_buffer_alloc_info::data_size, spa_buffer_alloc_info::datas, spa_buffer_alloc_info::flags, spa_buffer_alloc_info::max_align, spa_data::maxsize, spa_buffer_alloc_info::mem_size, spa_buffer_alloc_info::meta_size, spa_buffer_alloc_info::metas, spa_buffer_alloc_info::n_datas, spa_buffer_alloc_info::n_metas, n_metas, spa_chunk::size, spa_buffer_alloc_info::skel_size, SPA_BUFFER_ALLOC_FLAG_INLINE_CHUNK, SPA_BUFFER_ALLOC_FLAG_INLINE_DATA, SPA_BUFFER_ALLOC_FLAG_INLINE_META, SPA_BUFFER_ALLOC_FLAG_NO_DATA, SPA_FLAG_IS_SET, SPA_MAX, and SPA_ROUND_UP_N.
Referenced by spa_buffer_alloc_array().
|
inline |
Fill skeleton and data according to the allocation info.
Use the allocation info to create a struct SPA Buffers into skel_mem and data_mem.
Depending on the flags given when calling spa_buffer_alloc_fill_info(), the buffer meta, chunk and memory will be referenced in either skel_mem or data_mem.
info | an allocation info |
skel_mem | memory to hold the struct SPA Buffers and the pointers to meta, chunk and memory. |
data_mem | memory to hold the meta, chunk and memory |
References spa_data::chunk, spa_data::data, spa_meta::data, spa_buffer_alloc_info::data_aligns, spa_buffer_alloc_info::datas, datas, spa_buffer_alloc_info::flags, spa_data::maxsize, spa_buffer_alloc_info::metas, metas, spa_buffer_alloc_info::n_datas, n_datas, spa_buffer_alloc_info::n_metas, n_metas, spa_chunk::size, spa_meta::size, SPA_BUFFER_ALLOC_FLAG_INLINE_CHUNK, SPA_BUFFER_ALLOC_FLAG_INLINE_DATA, SPA_BUFFER_ALLOC_FLAG_INLINE_META, SPA_BUFFER_ALLOC_FLAG_NO_DATA, SPA_FLAG_IS_SET, SPA_PTR_ALIGN, SPA_PTROFF, and SPA_ROUND_UP_N.
Referenced by spa_buffer_alloc_layout_array().
|
inline |
Layout an array of buffers.
Use the allocation info to layout the memory of an array of buffers.
skel_mem should point to at least info->skel_size * n_buffers bytes of memory. data_mem should point to at least info->mem_size * n_buffers bytes of memory.
info | the allocation info for one buffer |
n_buffers | the number of buffers to create |
buffers | a array with space to hold n_buffers pointers to buffers |
skel_mem | memory for the struct SPA Buffers |
data_mem | memory for the meta, chunk, memory of the buffer if not inlined in the skeleton. |
References spa_buffer_alloc_info::mem_size, spa_buffer_alloc_info::skel_size, spa_buffer_alloc_layout(), and SPA_PTROFF.
Referenced by spa_buffer_alloc_array().
|
inline |
Find metadata in a buffer.
References metas, n_metas, and spa_meta::type.
Referenced by spa_buffer_find_meta_data().
|
inline |
References spa_meta::data, spa_chunk::size, spa_meta::size, spa_buffer_find_meta(), and spa_meta::type.
const struct spa_type_info spa_type_data_type[] |
Referenced by spa_debug_buffer().
const struct spa_type_info spa_type_meta_type[] |
Referenced by spa_debug_buffer().