mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -04:00
pod: add info property flag
Add an info property flag that should not be taken into account when intersecting. We use this for docs and labels. Improve builder, make it possible to make struct properties with flags. Add some docs to the property flags and ranges.
This commit is contained in:
parent
a9ece1df91
commit
1c19342487
2 changed files with 32 additions and 29 deletions
|
|
@ -398,6 +398,8 @@ static inline uint32_t spa_pod_flag_from_id(char id)
|
|||
return SPA_POD_PROP_FLAG_READONLY;
|
||||
case 'd':
|
||||
return SPA_POD_PROP_FLAG_DEPRECATED;
|
||||
case 'i':
|
||||
return SPA_POD_PROP_FLAG_INFO;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -500,7 +502,9 @@ spa_pod_builder_addv(struct spa_pod_builder *builder,
|
|||
const char *format, va_list args)
|
||||
{
|
||||
while (format) {
|
||||
switch (*format) {
|
||||
char t = *format;
|
||||
next:
|
||||
switch (t) {
|
||||
case '<':
|
||||
{
|
||||
uint32_t id = va_arg(args, uint32_t);
|
||||
|
|
@ -516,32 +520,28 @@ spa_pod_builder_addv(struct spa_pod_builder *builder,
|
|||
break;
|
||||
case ':':
|
||||
{
|
||||
const char *spec;
|
||||
char type;
|
||||
int n_values;
|
||||
uint32_t key, flags;
|
||||
|
||||
key = va_arg(args, uint32_t);
|
||||
format = spec = va_arg(args, const char *);
|
||||
type = *spec;
|
||||
if (*spec != '\0')
|
||||
spec++;
|
||||
flags = spa_pod_range_from_id(*spec);
|
||||
if (*spec != '\0')
|
||||
spec++;
|
||||
for (;*spec;spec++)
|
||||
flags |= spa_pod_flag_from_id(*spec);
|
||||
format = va_arg(args, const char *);
|
||||
t = *format;
|
||||
if (*format != '\0')
|
||||
format++;
|
||||
flags = spa_pod_range_from_id(*format);
|
||||
if (*format != '\0')
|
||||
format++;
|
||||
for (;*format;format++)
|
||||
flags |= spa_pod_flag_from_id(*format);
|
||||
|
||||
spa_pod_builder_push_prop(builder, key, flags);
|
||||
|
||||
if (type == '{' || type == '[')
|
||||
continue;
|
||||
|
||||
format = spec;
|
||||
if (t == '<' || t == '[')
|
||||
goto next;
|
||||
|
||||
n_values = -1;
|
||||
while (n_values-- != 0) {
|
||||
SPA_POD_BUILDER_COLLECT(builder, type, args);
|
||||
SPA_POD_BUILDER_COLLECT(builder, t, args);
|
||||
|
||||
if ((flags & SPA_POD_PROP_RANGE_MASK) == 0)
|
||||
break;
|
||||
|
|
@ -565,10 +565,11 @@ spa_pod_builder_addv(struct spa_pod_builder *builder,
|
|||
format = va_arg(args, const char *);
|
||||
continue;
|
||||
default:
|
||||
SPA_POD_BUILDER_COLLECT(builder,*format,args);
|
||||
SPA_POD_BUILDER_COLLECT(builder, t, args);
|
||||
break;;
|
||||
}
|
||||
format++;
|
||||
if (*format != '\0')
|
||||
format++;
|
||||
}
|
||||
return spa_pod_builder_deref(builder, builder->frame[builder->state.depth].ref);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -209,16 +209,18 @@ struct spa_pod_fd {
|
|||
|
||||
struct spa_pod_prop_body {
|
||||
uint32_t key;
|
||||
#define SPA_POD_PROP_RANGE_NONE 0
|
||||
#define SPA_POD_PROP_RANGE_MIN_MAX 1
|
||||
#define SPA_POD_PROP_RANGE_STEP 2
|
||||
#define SPA_POD_PROP_RANGE_ENUM 3
|
||||
#define SPA_POD_PROP_RANGE_FLAGS 4
|
||||
#define SPA_POD_PROP_RANGE_MASK 0xf
|
||||
#define SPA_POD_PROP_FLAG_UNSET (1 << 4)
|
||||
#define SPA_POD_PROP_FLAG_OPTIONAL (1 << 5)
|
||||
#define SPA_POD_PROP_FLAG_READONLY (1 << 6)
|
||||
#define SPA_POD_PROP_FLAG_DEPRECATED (1 << 7)
|
||||
#define SPA_POD_PROP_RANGE_NONE 0 /**< no range */
|
||||
#define SPA_POD_PROP_RANGE_MIN_MAX 1 /**< property has range */
|
||||
#define SPA_POD_PROP_RANGE_STEP 2 /**< property has range with step */
|
||||
#define SPA_POD_PROP_RANGE_ENUM 3 /**< property has enumeration */
|
||||
#define SPA_POD_PROP_RANGE_FLAGS 4 /**< property has flags */
|
||||
#define SPA_POD_PROP_RANGE_MASK 0xf /**< mask to select range type */
|
||||
#define SPA_POD_PROP_FLAG_UNSET (1 << 4) /**< property value is unset */
|
||||
#define SPA_POD_PROP_FLAG_OPTIONAL (1 << 5) /**< property value is optional */
|
||||
#define SPA_POD_PROP_FLAG_READONLY (1 << 6) /**< property is readonly */
|
||||
#define SPA_POD_PROP_FLAG_DEPRECATED (1 << 7) /**< property is deprecated */
|
||||
#define SPA_POD_PROP_FLAG_INFO (1 << 8) /**< property is informational and is not
|
||||
* used when filtering */
|
||||
uint32_t flags;
|
||||
struct spa_pod value;
|
||||
/* array with elements of value.size follows,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue