meta: add metadata features

Add a new features property to the metadata param. This should be
of type CHOICE_FEATURES_Int and should contain the extra features
supported by this metadata.

Make a special features metadata type that is a combination of the
metadata type in the upper 16 bits and the features for that type in the
lower 16 bits. Make a function to search if a type has certain feature
bits.

On the server, when negotiating buffers and metadata, check the result
of the features after filtering and if they are not 0, place them as
0 sized extra feature metadata on the buffer.

Add some metadata features for the sync_timeline, one that specifies
that the RELEASE flag is supported. With this in place, a producer can
see if a consumer supports the UNSCHEDULED_RELEASE flag.

See #4885
This commit is contained in:
Wim Taymans 2025-09-19 14:05:04 +02:00
parent a859c7a651
commit 00d983a40d
4 changed files with 31 additions and 4 deletions

View file

@ -221,12 +221,12 @@ int pw_buffers_negotiate(struct pw_context *context, uint32_t flags,
if ((res = param_filter(result, &input, &output, SPA_PARAM_Meta, &b)) > 0)
n_params += res;
metas = alloca(sizeof(struct spa_meta) * n_params);
metas = alloca(sizeof(struct spa_meta) * n_params * 2);
n_metas = 0;
params = alloca(n_params * sizeof(struct spa_pod *));
for (i = 0, offset = 0; i < n_params; i++) {
uint32_t type, size;
uint32_t type, size, features = 0;
params[i] = SPA_PTROFF(buffer, offset, struct spa_pod);
spa_pod_fixate(params[i]);
@ -239,7 +239,8 @@ int pw_buffers_negotiate(struct pw_context *context, uint32_t flags,
if (spa_pod_parse_object(params[i],
SPA_TYPE_OBJECT_ParamMeta, NULL,
SPA_PARAM_META_type, SPA_POD_Id(&type),
SPA_PARAM_META_size, SPA_POD_Int(&size)) < 0) {
SPA_PARAM_META_size, SPA_POD_Int(&size),
SPA_PARAM_META_features, SPA_POD_OPT_Int(&features)) < 0) {
pw_log_warn("%p: invalid Meta param", result);
continue;
}
@ -250,6 +251,11 @@ int pw_buffers_negotiate(struct pw_context *context, uint32_t flags,
metas[n_metas].type = type;
metas[n_metas].size = size;
n_metas++;
if (features != 0) {
metas[n_metas].type = SPA_META_TYPE_FEATURES(type, features);
metas[n_metas].size = 0;
n_metas++;
}
}
max_buffers = context->settings.link_max_buffers;