5#ifndef SPA_POD_FILTER_H
6#define SPA_POD_FILTER_H
18#include <spa/pod/dynamic.h>
24#ifndef SPA_API_POD_FILTER
26 #define SPA_API_POD_FILTER SPA_API_IMPL
28 #define SPA_API_POD_FILTER static inline
38 uint32_t type,
const void *r1,
const void *r2, uint32_t size)
44 if (size <
sizeof(int32_t))
46 val = (*(int32_t *) r1) & (*(int32_t *) r2);
55 if (size <
sizeof(int64_t))
57 val = (*(int64_t *) r1) & (*(int64_t *) r2);
76 uint32_t j, k, nalt1, nalt2, nc_offs;
77 void *alt1, *alt2, *a1, *a2;
78 uint32_t type, size, p1c, p2c;
80 int res, n_copied = 0;
86 if (nalt1 < 1 || nalt2 < 1)
123 for (j = 0, a2 = alt2; j < nalt2; j++, a2 =
SPA_PTROFF(a2, size,
void)) {
124 for (k = 0, a1 = alt1; k < nalt1; k++, a1 =
SPA_PTROFF(a1,size,
void)) {
140 bool found_def =
false;
145 for (j = 0, a1 = alt1; j < nalt1; j++, a1 =
SPA_PTROFF(a1,size,
void)) {
155 for (j = 0, a1 = alt1; j < nalt1; j++, a1 =
SPA_PTROFF(a1,size,
void)) {
160 if (n_copied++ == 0 && !found_def)
175 for (j = 0, a2 = alt2; j < nalt2; j++, a2 =
SPA_PTROFF(a2,size,
void)) {
250 }
else if (n_copied == 1) {
254 }
else if (n_copied > 1) {
265 const struct spa_pod *filter, uint32_t filter_size)
273 bool do_copy =
false, do_advance =
false;
274 uint32_t filter_offset = 0;
375 if (filter == NULL) {
379 spa_pod_dynamic_builder_continue(&db,
b);
383 spa_pod_dynamic_builder_clean(&db);
385 if (
res >= 0 && result) {
401 uint32_t nvals, choice;
409 vals, vals, nvals, choice)) {
uint32_t int int res
Definition core.h:433
SPA_API_POD_BUILDER void * spa_pod_builder_pop(struct spa_pod_builder *builder, struct spa_pod_frame *frame)
Definition builder.h:213
SPA_API_POD_BUILDER int spa_pod_builder_int(struct spa_pod_builder *builder, int32_t val)
Definition builder.h:296
SPA_API_POD_BUILDER int spa_pod_builder_long(struct spa_pod_builder *builder, int64_t val)
Definition builder.h:305
SPA_API_POD_BUILDER int spa_pod_builder_push_choice(struct spa_pod_builder *builder, struct spa_pod_frame *frame, uint32_t type, uint32_t flags)
Definition builder.h:446
SPA_API_POD_COMPARE int spa_pod_compare_is_in_range(uint32_t type, const void *v, const void *min, const void *max, const void *step, uint32_t size 1)
Definition compare.h:225
SPA_API_POD_BUILDER int spa_pod_builder_child(struct spa_pod_builder *builder, uint32_t size, uint32_t type)
Definition builder.h:268
SPA_API_POD_ITER struct spa_pod * spa_pod_get_values(const struct spa_pod *pod, uint32_t *n_vals, uint32_t *choice)
Definition iter.h:229
SPA_API_POD_FILTER int spa_pod_filter_flags_value(struct spa_pod_builder *b, uint32_t type, const void *r1, const void *r2, uint32_t size)
Definition filter.h:44
#define SPA_POD_PROP_FLAG_MANDATORY
is mandatory, when filtering, both sides need this property or filtering fails.
Definition pod.h:241
SPA_API_POD_COMPARE int spa_pod_compare_is_valid_choice(uint32_t type, uint32_t size, const void *val, const void *vals, uint32_t n_vals, uint32_t choice)
Definition compare.h:236
SPA_API_POD_FILTER int spa_pod_filter_prop(struct spa_pod_builder *b, const struct spa_pod_prop *p1, const struct spa_pod_prop *p2)
Definition filter.h:77
SPA_API_POD_BUILDER void spa_pod_builder_get_state(struct spa_pod_builder *builder, struct spa_pod_builder_state *state)
Definition builder.h:75
#define SPA_POD_PROP_FLAG_DROP
drop property, when filtering, both sides need the property or it will be dropped.
Definition pod.h:246
SPA_API_POD_ITER const struct spa_pod_prop * spa_pod_object_find_prop(const struct spa_pod_object *pod, const struct spa_pod_prop *start, uint32_t key)
Definition iter.h:254
SPA_API_POD_COMPARE int spa_pod_compare_value(uint32_t type, const void *r1, const void *r2, uint32_t size)
Definition compare.h:43
#define SPA_POD_OBJECT_FOREACH(obj, iter)
Definition iter.h:118
#define SPA_POD_BODY(pod)
Definition pod.h:44
SPA_API_POD_BODY int spa_pod_is_object(const struct spa_pod *pod)
Definition body.h:428
SPA_API_POD_ITER void * spa_pod_next(const void *iter)
Definition iter.h:46
SPA_API_POD_BUILDER int spa_pod_builder_push_struct(struct spa_pod_builder *builder, struct spa_pod_frame *frame)
Definition builder.h:462
SPA_API_POD_FILTER int spa_pod_filter_make(struct spa_pod *pod)
Definition filter.h:424
SPA_API_POD_BUILDER struct spa_pod * spa_pod_builder_deref(struct spa_pod_builder *builder, uint32_t offset)
Definition builder.h:121
SPA_API_POD_BUILDER int spa_pod_builder_push_object(struct spa_pod_builder *builder, struct spa_pod_frame *frame, uint32_t type, uint32_t id)
Definition builder.h:475
#define SPA_POD_PROP_FLAG_DONT_FIXATE
choices need no fixation
Definition pod.h:244
SPA_API_POD_BUILDER void spa_pod_builder_remove(struct spa_pod_builder *builder, uint32_t size)
Definition builder.h:187
SPA_API_POD_FILTER int spa_pod_filter(struct spa_pod_builder *b, struct spa_pod **result, const struct spa_pod *pod, const struct spa_pod *filter)
Definition filter.h:370
#define SPA_POD_FOREACH(pod, size, iter)
Definition iter.h:105
#define SPA_POD_PROP_SIZE(prop)
Definition pod.h:224
SPA_API_POD_ITER bool spa_pod_is_inside(const void *pod, uint32_t size, const void *iter)
Definition iter.h:38
SPA_API_POD_BUILDER int spa_pod_builder_raw(struct spa_pod_builder *builder, const void *data, uint32_t size)
Definition builder.h:150
SPA_API_POD_FILTER int spa_pod_filter_object_make(struct spa_pod_object *pod)
Definition filter.h:400
SPA_API_POD_BUILDER int spa_pod_builder_raw_padded(struct spa_pod_builder *builder, const void *data, uint32_t size)
Definition builder.h:205
SPA_API_POD_FILTER int spa_pod_filter_part(struct spa_pod_builder *b, const struct spa_pod *pod, uint32_t pod_size, const struct spa_pod *filter, uint32_t filter_size)
Definition filter.h:270
#define SPA_POD_SIZE(pod)
Definition pod.h:35
SPA_API_POD_COMPARE int spa_pod_memcmp(const struct spa_pod *a, const struct spa_pod *b)
Definition compare.h:90
SPA_API_POD_BODY int spa_pod_is_choice(const struct spa_pod *pod)
Definition body.h:389
SPA_API_POD_BUILDER int spa_pod_builder_prop(struct spa_pod_builder *builder, uint32_t key, uint32_t flags)
Definition builder.h:490
SPA_API_POD_BUILDER struct spa_pod * spa_pod_builder_deref_fallback(struct spa_pod_builder *builder, uint32_t offset, struct spa_pod *fallback)
Definition builder.h:108
@ SPA_CHOICE_Step
range with step: default, min, max, step
Definition pod.h:163
@ SPA_CHOICE_None
no choice, first value is current
Definition pod.h:161
@ SPA_CHOICE_Flags
flags: first value is flags
Definition pod.h:165
@ SPA_CHOICE_Range
range: default, min, max
Definition pod.h:162
@ SPA_CHOICE_Enum
list: default, alternative,...
Definition pod.h:164
@ SPA_TYPE_Int
Definition type.h:45
@ SPA_TYPE_Long
Definition type.h:46
@ SPA_TYPE_Object
Definition type.h:56
@ SPA_TYPE_Struct
Definition type.h:55
#define spa_zero(x)
Definition defs.h:512
#define spa_return_val_if_fail(expr, val)
Definition defs.h:460
#define SPA_SWAP(a, b)
Definition defs.h:195
#define SPA_FLAG_IS_SET(field, flag)
Definition defs.h:90
#define SPA_PTROFF(ptr_, offset_, type_)
Return the address (buffer + offset) as pointer of type.
Definition defs.h:222
#define SPA_API_POD_FILTER
Definition filter.h:35
void * data
Definition builder.h:64
uint32_t type
type of choice, one of enum spa_choice_type
Definition pod.h:169
struct spa_pod_choice_body body
Definition pod.h:178
struct spa_pod pod
Definition pod.h:177
struct spa_pod_builder b
Definition dynamic.h:30
uint32_t type
one of enum spa_type
Definition pod.h:197
uint32_t id
id of the object, depends on the object type
Definition pod.h:198
struct spa_pod_object_body body
Definition pod.h:204
uint32_t key
key of property, list of valid keys depends on the object type
Definition pod.h:228
uint32_t flags
flags for property
Definition pod.h:248
struct spa_pod value
Definition pod.h:249
uint32_t type
Definition pod.h:59
uint32_t size
Definition pod.h:58