buffers: add support for mandatory metadata

Add a SPA_PARAM_BUFFERS_metaType in the Buffers object. This contains a
bitmask of the mandatory metadata items that should be included on a
buffer when using this Buffers param.

Make the buffer allocation logic skip over the Buffers params that
require unavailable metadata.

This can be used to, for example, enforce specific metadata to describe
extra buffer memory (such as the meaning of generic file descriptors).

One such use is the explicit sync, where an extra buffer data is needed
for the sync fd along with metadata that contains the sync_point.
This commit is contained in:
Wim Taymans 2024-04-02 12:05:12 +02:00
parent a5c8100666
commit 986de92521
3 changed files with 12 additions and 4 deletions

View file

@ -56,6 +56,7 @@ static const struct spa_type_info spa_type_param_buffers[] = {
{ SPA_PARAM_BUFFERS_stride, SPA_TYPE_Int, SPA_TYPE_INFO_PARAM_BLOCK_INFO_BASE "stride", NULL },
{ SPA_PARAM_BUFFERS_align, SPA_TYPE_Int, SPA_TYPE_INFO_PARAM_BLOCK_INFO_BASE "align", NULL },
{ SPA_PARAM_BUFFERS_dataType, SPA_TYPE_Int, SPA_TYPE_INFO_PARAM_BLOCK_INFO_BASE "dataType", NULL },
{ SPA_PARAM_BUFFERS_metaType, SPA_TYPE_Int, SPA_TYPE_INFO_PARAM_BLOCK_INFO_BASE "metaType", NULL },
{ 0, 0, NULL, NULL },
};

View file

@ -24,7 +24,8 @@ enum spa_param_buffers {
SPA_PARAM_BUFFERS_size, /**< size of a data block memory (Int)*/
SPA_PARAM_BUFFERS_stride, /**< stride of data block memory (Int) */
SPA_PARAM_BUFFERS_align, /**< alignment of data block memory (Int) */
SPA_PARAM_BUFFERS_dataType, /**< possible memory types (Int, mask of enum spa_data_type) */
SPA_PARAM_BUFFERS_dataType, /**< possible memory types (flags choice Int, mask of enum spa_data_type) */
SPA_PARAM_BUFFERS_metaType, /**< required meta data types (Int, mask of enum spa_meta_type) */
};
/** properties for SPA_TYPE_OBJECT_ParamMeta */