80#define SPA_POD_ARRAY_BODY_FOREACH(body, _size, iter) \
81 for ((iter) = (__typeof__(iter))SPA_PTROFF((body), sizeof(struct spa_pod_array_body), void); \
82 (body)->child.size > 0 && spa_ptrinside(body, _size, iter, (body)->child.size, NULL); \
83 (iter) = (__typeof__(iter))SPA_PTROFF((iter), (body)->child.size, void))
85#define SPA_POD_ARRAY_FOREACH(obj, iter) \
86 SPA_POD_ARRAY_BODY_FOREACH(&(obj)->body, SPA_POD_BODY_SIZE(obj), iter)
88#define SPA_POD_CHOICE_BODY_FOREACH(body, _size, iter) \
89 for ((iter) = (__typeof__(iter))SPA_PTROFF((body), sizeof(struct spa_pod_choice_body), void); \
90 (body)->child.size > 0 && spa_ptrinside(body, _size, iter, (body)->child.size, NULL); \
91 (iter) = (__typeof__(iter))SPA_PTROFF((iter), (body)->child.size, void))
93#define SPA_POD_CHOICE_FOREACH(obj, iter) \
94 SPA_POD_CHOICE_BODY_FOREACH(&(obj)->body, SPA_POD_BODY_SIZE(obj), iter)
96#define SPA_POD_FOREACH(pod, size, iter) \
97 for ((iter) = (pod); \
98 spa_pod_is_inside(pod, size, iter); \
99 (iter) = (__typeof__(iter))spa_pod_next(iter))
101#define SPA_POD_STRUCT_FOREACH(obj, iter) \
102 SPA_POD_FOREACH(SPA_POD_BODY(obj), SPA_POD_BODY_SIZE(obj), iter)
104#define SPA_POD_OBJECT_BODY_FOREACH(body, size, iter) \
105 for ((iter) = spa_pod_prop_first(body); \
106 spa_pod_prop_is_inside(body, size, iter); \
107 (iter) = spa_pod_prop_next(iter))
109#define SPA_POD_OBJECT_FOREACH(obj, iter) \
110 SPA_POD_OBJECT_BODY_FOREACH(&(obj)->body, SPA_POD_BODY_SIZE(obj), iter)
112#define SPA_POD_SEQUENCE_BODY_FOREACH(body, size, iter) \
113 for ((iter) = spa_pod_control_first(body); \
114 spa_pod_control_is_inside(body, size, iter); \
115 (iter) = spa_pod_control_next(iter))
117#define SPA_POD_SEQUENCE_FOREACH(seq, iter) \
118 SPA_POD_SEQUENCE_BODY_FOREACH(&(seq)->body, SPA_POD_BODY_SIZE(seq), iter)
124 if (size <
sizeof(
struct spa_pod) ||
offset + size > maxsize)
331 void *values, uint32_t max_values)
337 n_values =
SPA_MIN(n_values, max_values);
static int spa_pod_is_bitmap(const struct spa_pod *pod)
Definition iter.h:316
static int spa_pod_get_int(const struct spa_pod *pod, int32_t *value)
Definition iter.h:173
static int spa_pod_is_long(const struct spa_pod *pod)
Definition iter.h:181
static int spa_pod_is_bytes(const struct spa_pod *pod)
Definition iter.h:246
static int spa_pod_fixate(struct spa_pod *pod)
Definition iter.h:433
static 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:394
static int spa_pod_get_pointer(const struct spa_pod *pod, uint32_t *type, const void **value)
Definition iter.h:266
static bool spa_pod_control_is_inside(const struct spa_pod_sequence_body *body, uint32_t size, const struct spa_pod_control *iter)
Definition iter.h:71
#define SPA_POD_VALUE(type, pod)
Definition pod.h:49
static int spa_pod_get_fraction(const struct spa_pod *pod, struct spa_fraction *value)
Definition iter.h:309
static const struct spa_pod_prop * spa_pod_find_prop(const struct spa_pod *pod, const struct spa_pod_prop *start, uint32_t key)
Definition iter.h:414
static void * spa_pod_next(const void *iter)
Definition iter.h:42
static int spa_pod_is_rectangle(const struct spa_pod *pod)
Definition iter.h:289
static int spa_pod_is_fd(const struct spa_pod *pod)
Definition iter.h:275
static int spa_pod_object_has_props(const struct spa_pod_object *pod)
Definition iter.h:451
#define SPA_POD_OBJECT_FOREACH(obj, iter)
Definition iter.h:114
static int spa_pod_is_pointer(const struct spa_pod *pod)
Definition iter.h:260
#define SPA_POD_TYPE(pod)
Definition pod.h:28
static int spa_pod_get_id(const struct spa_pod *pod, uint32_t *value)
Definition iter.h:160
static bool spa_pod_is_object_id(const struct spa_pod *pod, uint32_t id)
Definition iter.h:383
#define SPA_POD_BODY_SIZE(pod)
Definition pod.h:26
static int spa_pod_get_float(const struct spa_pod *pod, float *value)
Definition iter.h:199
static int spa_pod_copy_string(const struct spa_pod *pod, size_t maxlen, char *dest)
Definition iter.h:236
static uint32_t spa_pod_copy_array(const struct spa_pod *pod, uint32_t type, void *values, uint32_t max_values)
Definition iter.h:335
static struct spa_pod_control * spa_pod_control_next(const struct spa_pod_control *iter)
Definition iter.h:80
#define SPA_POD_PROP_FLAG_DONT_FIXATE
choices need no fixation
Definition pod.h:224
static int spa_pod_object_fixate(struct spa_pod_object *pod)
Definition iter.h:422
static bool spa_pod_is_inside(const void *pod, uint32_t size, const void *iter)
Definition iter.h:34
static int spa_pod_is_object(const struct spa_pod *pod)
Definition iter.h:372
static int spa_pod_get_rectangle(const struct spa_pod *pod, struct spa_rectangle *value)
Definition iter.h:295
static int spa_pod_get_fd(const struct spa_pod *pod, int64_t *value)
Definition iter.h:281
static int spa_pod_is_struct(const struct spa_pod *pod)
Definition iter.h:367
static int spa_pod_is_sequence(const struct spa_pod *pod)
Definition iter.h:388
#define SPA_POD_ARRAY_VALUE_SIZE(arr)
Definition pod.h:115
#define SPA_POD_CONTROL_SIZE(ev)
Definition pod.h:231
static int spa_pod_get_long(const struct spa_pod *pod, int64_t *value)
Definition iter.h:186
#define SPA_POD_CONTENTS(type, pod)
Definition pod.h:35
static void * spa_pod_from_data(void *data, size_t maxsize, off_t offset, size_t size)
Definition iter.h:126
static int spa_pod_is_string(const struct spa_pod *pod)
Definition iter.h:220
static int spa_pod_is_fixated(const struct spa_pod *pod)
Definition iter.h:459
static int spa_pod_is_choice(const struct spa_pod *pod)
Definition iter.h:347
static void * spa_pod_get_array(const struct spa_pod *pod, uint32_t *n_values)
Definition iter.h:328
static int spa_pod_get_string(const struct spa_pod *pod, const char **value)
Definition iter.h:228
#define SPA_POD_PROP_SIZE(prop)
Definition pod.h:205
static struct spa_pod * spa_pod_get_values(const struct spa_pod *pod, uint32_t *n_vals, uint32_t *choice)
Definition iter.h:353
static int spa_pod_get_double(const struct spa_pod *pod, double *value)
Definition iter.h:212
static int spa_pod_get_bool(const struct spa_pod *pod, bool *value)
Definition iter.h:147
static struct spa_pod_prop * spa_pod_prop_next(const struct spa_pod_prop *iter)
Definition iter.h:61
#define SPA_POD_OBJECT_TYPE(obj)
Definition pod.h:173
#define SPA_POD_OBJECT_ID(obj)
Definition pod.h:175
static bool spa_pod_is_object_type(const struct spa_pod *pod, uint32_t type)
Definition iter.h:378
#define SPA_POD_ARRAY_VALUE_TYPE(arr)
Definition pod.h:113
static int spa_pod_is_array(const struct spa_pod *pod)
Definition iter.h:322
static int spa_pod_is_id(const struct spa_pod *pod)
Definition iter.h:155
static int spa_pod_is_double(const struct spa_pod *pod)
Definition iter.h:207
static struct spa_pod_control * spa_pod_control_first(const struct spa_pod_sequence_body *body)
Definition iter.h:66
#define SPA_POD_CHOICE_N_VALUES(choice)
Definition pod.h:142
static struct spa_pod_prop * spa_pod_prop_first(const struct spa_pod_object_body *body)
Definition iter.h:47
static int spa_pod_is_int(const struct spa_pod *pod)
Definition iter.h:168
static int spa_pod_is_none(const struct spa_pod *pod)
Definition iter.h:137
static int spa_pod_object_is_fixated(const struct spa_pod_object *pod)
Definition iter.h:440
static int spa_pod_is_fraction(const struct spa_pod *pod)
Definition iter.h:303
#define SPA_POD_SIZE(pod)
Definition pod.h:30
static int spa_pod_is_float(const struct spa_pod *pod)
Definition iter.h:194
#define SPA_POD_CHOICE_CHILD(choice)
Definition pod.h:132
#define SPA_POD_ARRAY_N_VALUES(arr)
Definition pod.h:117
#define SPA_POD_CHOICE_TYPE(choice)
Definition pod.h:134
static int spa_pod_get_bytes(const struct spa_pod *pod, const void **value, uint32_t *len)
Definition iter.h:251
#define SPA_POD_ARRAY_VALUES(arr)
Definition pod.h:119
static int spa_pod_is_bool(const struct spa_pod *pod)
Definition iter.h:142
static bool spa_pod_prop_is_inside(const struct spa_pod_object_body *body, uint32_t size, const struct spa_pod_prop *iter)
Definition iter.h:52
@ SPA_CHOICE_None
no choice, first value is current
Definition pod.h:147
@ SPA_TYPE_Int
Definition type.h:34
@ SPA_TYPE_Rectangle
Definition type.h:40
@ SPA_TYPE_Long
Definition type.h:35
@ SPA_TYPE_Bool
Definition type.h:32
@ SPA_TYPE_Bytes
Definition type.h:39
@ SPA_TYPE_Bitmap
Definition type.h:42
@ SPA_TYPE_Object
Definition type.h:45
@ SPA_TYPE_Float
Definition type.h:36
@ SPA_TYPE_Fraction
Definition type.h:41
@ SPA_TYPE_None
Definition type.h:31
@ SPA_TYPE_Sequence
Definition type.h:46
@ SPA_TYPE_Double
Definition type.h:37
@ SPA_TYPE_Id
Definition type.h:33
@ SPA_TYPE_Choice
Definition type.h:49
@ SPA_TYPE_Pointer
Definition type.h:47
@ SPA_TYPE_Array
Definition type.h:43
@ SPA_TYPE_String
Definition type.h:38
@ SPA_TYPE_Fd
Definition type.h:48
@ SPA_TYPE_Struct
Definition type.h:44
#define SPA_MIN(a, b)
Definition defs.h:165
#define SPA_ROUND_UP_N(num, align)
Definition defs.h:342
#define spa_return_val_if_fail(expr, val)
Definition defs.h:431
#define SPA_FLAG_IS_SET(field, flag)
Definition defs.h:90
#define spa_ptr_type_inside(p1, s1, p2, type, remaining)
Definition defs.h:401
#define SPA_PTROFF(ptr_, offset_, type_)
Return the address (buffer + offset) as pointer of type.
Definition defs.h:222
struct spa_pod pod
Definition pod.h:163
struct spa_pod value
control value, depends on type
Definition pod.h:237
uint32_t type
type of control, enum spa_control_type
Definition pod.h:236
uint32_t offset
media offset
Definition pod.h:235
struct spa_pod pod
Definition iter.h:28
uint32_t offset
Definition iter.h:30
struct spa_pod_frame * parent
Definition iter.h:29
uint32_t flags
Definition iter.h:31
struct spa_pod pod
Definition pod.h:184
struct spa_pod_object_body body
Definition pod.h:185
struct spa_pod pod
Definition pod.h:195
uint32_t key
key of property, list of valid keys depends on the object type
Definition pod.h:209
struct spa_pod value
Definition pod.h:226
uint32_t type
Definition pod.h:45
uint32_t size
Definition pod.h:44