PipeWire  0.3.67
iter.h
Go to the documentation of this file.
1 /* Simple Plugin API */
2 /* SPDX-FileCopyrightText: Copyright © 2018 Wim Taymans */
3 /* SPDX-License-Identifier: MIT */
4 
5 #ifndef SPA_POD_ITER_H
6 #define SPA_POD_ITER_H
7 
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11 
12 #include <errno.h>
13 #include <sys/types.h>
14 
15 #include <spa/pod/pod.h>
16 
22 struct spa_pod_frame {
23  struct spa_pod pod;
24  struct spa_pod_frame *parent;
25  uint32_t offset;
26  uint32_t flags;
27 };
28 
29 static inline bool spa_pod_is_inside(const void *pod, uint32_t size, const void *iter)
30 {
31  return SPA_POD_BODY(iter) <= SPA_PTROFF(pod, size, void) &&
32  SPA_PTROFF(iter, SPA_POD_SIZE(iter), void) <= SPA_PTROFF(pod, size, void);
33 }
34 
35 static inline void *spa_pod_next(const void *iter)
36 {
37  return SPA_PTROFF(iter, SPA_ROUND_UP_N(SPA_POD_SIZE(iter), 8), void);
38 }
39 
40 static inline struct spa_pod_prop *spa_pod_prop_first(const struct spa_pod_object_body *body)
41 {
42  return SPA_PTROFF(body, sizeof(struct spa_pod_object_body), struct spa_pod_prop);
43 }
44 
45 static inline bool spa_pod_prop_is_inside(const struct spa_pod_object_body *body,
46  uint32_t size, const struct spa_pod_prop *iter)
47 {
48  return SPA_POD_CONTENTS(struct spa_pod_prop, iter) <= SPA_PTROFF(body, size, void) &&
49  SPA_PTROFF(iter, SPA_POD_PROP_SIZE(iter), void) <= SPA_PTROFF(body, size, void);
50 }
51 
52 static inline struct spa_pod_prop *spa_pod_prop_next(const struct spa_pod_prop *iter)
53 {
54  return SPA_PTROFF(iter, SPA_ROUND_UP_N(SPA_POD_PROP_SIZE(iter), 8), struct spa_pod_prop);
55 }
56 
57 static inline struct spa_pod_control *spa_pod_control_first(const struct spa_pod_sequence_body *body)
58 {
59  return SPA_PTROFF(body, sizeof(struct spa_pod_sequence_body), struct spa_pod_control);
60 }
61 
62 static inline bool spa_pod_control_is_inside(const struct spa_pod_sequence_body *body,
63  uint32_t size, const struct spa_pod_control *iter)
64 {
65  return SPA_POD_CONTENTS(struct spa_pod_control, iter) <= SPA_PTROFF(body, size, void) &&
66  SPA_PTROFF(iter, SPA_POD_CONTROL_SIZE(iter), void) <= SPA_PTROFF(body, size, void);
67 }
68 
69 static inline struct spa_pod_control *spa_pod_control_next(const struct spa_pod_control *iter)
70 {
71  return SPA_PTROFF(iter, SPA_ROUND_UP_N(SPA_POD_CONTROL_SIZE(iter), 8), struct spa_pod_control);
72 }
73 
74 #define SPA_POD_ARRAY_BODY_FOREACH(body, _size, iter) \
75  for ((iter) = (__typeof__(iter))SPA_PTROFF((body), sizeof(struct spa_pod_array_body), void); \
76  (iter) < (__typeof__(iter))SPA_PTROFF((body), (_size), void); \
77  (iter) = (__typeof__(iter))SPA_PTROFF((iter), (body)->child.size, void))
78 
79 #define SPA_POD_ARRAY_FOREACH(obj, iter) \
80  SPA_POD_ARRAY_BODY_FOREACH(&(obj)->body, SPA_POD_BODY_SIZE(obj), iter)
81 
82 #define SPA_POD_CHOICE_BODY_FOREACH(body, _size, iter) \
83  for ((iter) = (__typeof__(iter))SPA_PTROFF((body), sizeof(struct spa_pod_choice_body), void); \
84  (iter) < (__typeof__(iter))SPA_PTROFF((body), (_size), void); \
85  (iter) = (__typeof__(iter))SPA_PTROFF((iter), (body)->child.size, void))
86 
87 #define SPA_POD_CHOICE_FOREACH(obj, iter) \
88  SPA_POD_CHOICE_BODY_FOREACH(&(obj)->body, SPA_POD_BODY_SIZE(obj), iter)
89 
90 #define SPA_POD_FOREACH(pod, size, iter) \
91  for ((iter) = (pod); \
92  spa_pod_is_inside(pod, size, iter); \
93  (iter) = (__typeof__(iter))spa_pod_next(iter))
94 
95 #define SPA_POD_STRUCT_FOREACH(obj, iter) \
96  SPA_POD_FOREACH(SPA_POD_BODY(obj), SPA_POD_BODY_SIZE(obj), iter)
97 
98 #define SPA_POD_OBJECT_BODY_FOREACH(body, size, iter) \
99  for ((iter) = spa_pod_prop_first(body); \
100  spa_pod_prop_is_inside(body, size, iter); \
101  (iter) = spa_pod_prop_next(iter))
102 
103 #define SPA_POD_OBJECT_FOREACH(obj, iter) \
104  SPA_POD_OBJECT_BODY_FOREACH(&(obj)->body, SPA_POD_BODY_SIZE(obj), iter)
105 
106 #define SPA_POD_SEQUENCE_BODY_FOREACH(body, size, iter) \
107  for ((iter) = spa_pod_control_first(body); \
108  spa_pod_control_is_inside(body, size, iter); \
109  (iter) = spa_pod_control_next(iter))
110 
111 #define SPA_POD_SEQUENCE_FOREACH(seq, iter) \
112  SPA_POD_SEQUENCE_BODY_FOREACH(&(seq)->body, SPA_POD_BODY_SIZE(seq), iter)
113 
114 
115 static inline void *spa_pod_from_data(void *data, size_t maxsize, off_t offset, size_t size)
116 {
117  void *pod;
118  if (size < sizeof(struct spa_pod) || offset + size > maxsize)
119  return NULL;
120  pod = SPA_PTROFF(data, offset, void);
121  if (SPA_POD_SIZE(pod) > size)
122  return NULL;
123  return pod;
124 }
125 
126 static inline int spa_pod_is_none(const struct spa_pod *pod)
127 {
128  return (SPA_POD_TYPE(pod) == SPA_TYPE_None);
129 }
130 
131 static inline int spa_pod_is_bool(const struct spa_pod *pod)
132 {
133  return (SPA_POD_TYPE(pod) == SPA_TYPE_Bool && SPA_POD_BODY_SIZE(pod) >= sizeof(int32_t));
134 }
135 
136 static inline int spa_pod_get_bool(const struct spa_pod *pod, bool *value)
137 {
138  if (!spa_pod_is_bool(pod))
139  return -EINVAL;
140  *value = !!SPA_POD_VALUE(struct spa_pod_bool, pod);
141  return 0;
142 }
143 
144 static inline int spa_pod_is_id(const struct spa_pod *pod)
145 {
146  return (SPA_POD_TYPE(pod) == SPA_TYPE_Id && SPA_POD_BODY_SIZE(pod) >= sizeof(uint32_t));
147 }
148 
149 static inline int spa_pod_get_id(const struct spa_pod *pod, uint32_t *value)
150 {
151  if (!spa_pod_is_id(pod))
152  return -EINVAL;
153  *value = SPA_POD_VALUE(struct spa_pod_id, pod);
154  return 0;
155 }
156 
157 static inline int spa_pod_is_int(const struct spa_pod *pod)
158 {
159  return (SPA_POD_TYPE(pod) == SPA_TYPE_Int && SPA_POD_BODY_SIZE(pod) >= sizeof(int32_t));
160 }
161 
162 static inline int spa_pod_get_int(const struct spa_pod *pod, int32_t *value)
163 {
164  if (!spa_pod_is_int(pod))
165  return -EINVAL;
166  *value = SPA_POD_VALUE(struct spa_pod_int, pod);
167  return 0;
168 }
169 
170 static inline int spa_pod_is_long(const struct spa_pod *pod)
171 {
172  return (SPA_POD_TYPE(pod) == SPA_TYPE_Long && SPA_POD_BODY_SIZE(pod) >= sizeof(int64_t));
173 }
174 
175 static inline int spa_pod_get_long(const struct spa_pod *pod, int64_t *value)
176 {
177  if (!spa_pod_is_long(pod))
178  return -EINVAL;
179  *value = SPA_POD_VALUE(struct spa_pod_long, pod);
180  return 0;
181 }
182 
183 static inline int spa_pod_is_float(const struct spa_pod *pod)
184 {
185  return (SPA_POD_TYPE(pod) == SPA_TYPE_Float && SPA_POD_BODY_SIZE(pod) >= sizeof(float));
186 }
187 
188 static inline int spa_pod_get_float(const struct spa_pod *pod, float *value)
189 {
190  if (!spa_pod_is_float(pod))
191  return -EINVAL;
192  *value = SPA_POD_VALUE(struct spa_pod_float, pod);
193  return 0;
194 }
195 
196 static inline int spa_pod_is_double(const struct spa_pod *pod)
197 {
198  return (SPA_POD_TYPE(pod) == SPA_TYPE_Double && SPA_POD_BODY_SIZE(pod) >= sizeof(double));
199 }
200 
201 static inline int spa_pod_get_double(const struct spa_pod *pod, double *value)
202 {
203  if (!spa_pod_is_double(pod))
204  return -EINVAL;
205  *value = SPA_POD_VALUE(struct spa_pod_double, pod);
206  return 0;
207 }
208 
209 static inline int spa_pod_is_string(const struct spa_pod *pod)
210 {
211  const char *s = (const char *)SPA_POD_CONTENTS(struct spa_pod_string, pod);
212  return (SPA_POD_TYPE(pod) == SPA_TYPE_String &&
213  SPA_POD_BODY_SIZE(pod) > 0 &&
214  s[SPA_POD_BODY_SIZE(pod)-1] == '\0');
215 }
216 
217 static inline int spa_pod_get_string(const struct spa_pod *pod, const char **value)
218 {
219  if (!spa_pod_is_string(pod))
220  return -EINVAL;
221  *value = (const char *)SPA_POD_CONTENTS(struct spa_pod_string, pod);
222  return 0;
223 }
224 
225 static inline int spa_pod_copy_string(const struct spa_pod *pod, size_t maxlen, char *dest)
226 {
227  const char *s = (const char *)SPA_POD_CONTENTS(struct spa_pod_string, pod);
228  if (!spa_pod_is_string(pod) || maxlen < 1)
229  return -EINVAL;
230  strncpy(dest, s, maxlen-1);
231  dest[maxlen-1]= '\0';
232  return 0;
233 }
234 
235 static inline int spa_pod_is_bytes(const struct spa_pod *pod)
236 {
237  return SPA_POD_TYPE(pod) == SPA_TYPE_Bytes;
238 }
239 
240 static inline int spa_pod_get_bytes(const struct spa_pod *pod, const void **value, uint32_t *len)
241 {
242  if (!spa_pod_is_bytes(pod))
243  return -EINVAL;
244  *value = (const void *)SPA_POD_CONTENTS(struct spa_pod_bytes, pod);
245  *len = SPA_POD_BODY_SIZE(pod);
246  return 0;
247 }
248 
249 static inline int spa_pod_is_pointer(const struct spa_pod *pod)
250 {
251  return (SPA_POD_TYPE(pod) == SPA_TYPE_Pointer &&
252  SPA_POD_BODY_SIZE(pod) >= sizeof(struct spa_pod_pointer_body));
253 }
254 
255 static inline int spa_pod_get_pointer(const struct spa_pod *pod, uint32_t *type, const void **value)
256 {
257  if (!spa_pod_is_pointer(pod))
258  return -EINVAL;
259  *type = ((struct spa_pod_pointer*)pod)->body.type;
260  *value = ((struct spa_pod_pointer*)pod)->body.value;
261  return 0;
262 }
263 
264 static inline int spa_pod_is_fd(const struct spa_pod *pod)
265 {
266  return (SPA_POD_TYPE(pod) == SPA_TYPE_Fd &&
267  SPA_POD_BODY_SIZE(pod) >= sizeof(int64_t));
268 }
269 
270 static inline int spa_pod_get_fd(const struct spa_pod *pod, int64_t *value)
271 {
272  if (!spa_pod_is_fd(pod))
273  return -EINVAL;
274  *value = SPA_POD_VALUE(struct spa_pod_fd, pod);
275  return 0;
276 }
277 
278 static inline int spa_pod_is_rectangle(const struct spa_pod *pod)
279 {
280  return (SPA_POD_TYPE(pod) == SPA_TYPE_Rectangle &&
281  SPA_POD_BODY_SIZE(pod) >= sizeof(struct spa_rectangle));
282 }
283 
284 static inline int spa_pod_get_rectangle(const struct spa_pod *pod, struct spa_rectangle *value)
285 {
287  return -EINVAL;
288  *value = SPA_POD_VALUE(struct spa_pod_rectangle, pod);
289  return 0;
290 }
291 
292 static inline int spa_pod_is_fraction(const struct spa_pod *pod)
293 {
294  return (SPA_POD_TYPE(pod) == SPA_TYPE_Fraction &&
295  SPA_POD_BODY_SIZE(pod) >= sizeof(struct spa_fraction));
296 }
297 
298 static inline int spa_pod_get_fraction(const struct spa_pod *pod, struct spa_fraction *value)
299 {
301  *value = SPA_POD_VALUE(struct spa_pod_fraction, pod);
302  return 0;
303 }
304 
305 static inline int spa_pod_is_bitmap(const struct spa_pod *pod)
306 {
307  return (SPA_POD_TYPE(pod) == SPA_TYPE_Bitmap &&
308  SPA_POD_BODY_SIZE(pod) >= sizeof(uint8_t));
309 }
310 
311 static inline int spa_pod_is_array(const struct spa_pod *pod)
312 {
313  return (SPA_POD_TYPE(pod) == SPA_TYPE_Array &&
314  SPA_POD_BODY_SIZE(pod) >= sizeof(struct spa_pod_array_body));
315 }
316 
317 static inline void *spa_pod_get_array(const struct spa_pod *pod, uint32_t *n_values)
318 {
320  *n_values = SPA_POD_ARRAY_N_VALUES(pod);
321  return SPA_POD_ARRAY_VALUES(pod);
322 }
323 
324 static inline uint32_t spa_pod_copy_array(const struct spa_pod *pod, uint32_t type,
325  void *values, uint32_t max_values)
326 {
327  uint32_t n_values;
328  void *v = spa_pod_get_array(pod, &n_values);
329  if (v == NULL || max_values == 0 || SPA_POD_ARRAY_VALUE_TYPE(pod) != type)
330  return 0;
331  n_values = SPA_MIN(n_values, max_values);
332  memcpy(values, v, SPA_POD_ARRAY_VALUE_SIZE(pod) * n_values);
333  return n_values;
334 }
335 
336 static inline int spa_pod_is_choice(const struct spa_pod *pod)
337 {
338  return (SPA_POD_TYPE(pod) == SPA_TYPE_Choice &&
339  SPA_POD_BODY_SIZE(pod) >= sizeof(struct spa_pod_choice_body));
340 }
341 
342 static inline struct spa_pod *spa_pod_get_values(const struct spa_pod *pod, uint32_t *n_vals, uint32_t *choice)
343 {
344  if (pod->type == SPA_TYPE_Choice) {
345  *n_vals = SPA_POD_CHOICE_N_VALUES(pod);
346  if ((*choice = SPA_POD_CHOICE_TYPE(pod)) == SPA_CHOICE_None)
347  *n_vals = SPA_MIN(1u, SPA_POD_CHOICE_N_VALUES(pod));
348  return (struct spa_pod*)SPA_POD_CHOICE_CHILD(pod);
349  } else {
350  *n_vals = 1;
351  *choice = SPA_CHOICE_None;
352  return (struct spa_pod*)pod;
353  }
354 }
355 
356 static inline int spa_pod_is_struct(const struct spa_pod *pod)
357 {
358  return (SPA_POD_TYPE(pod) == SPA_TYPE_Struct);
359 }
360 
361 static inline int spa_pod_is_object(const struct spa_pod *pod)
362 {
363  return (SPA_POD_TYPE(pod) == SPA_TYPE_Object &&
364  SPA_POD_BODY_SIZE(pod) >= sizeof(struct spa_pod_object_body));
365 }
366 
367 static inline bool spa_pod_is_object_type(const struct spa_pod *pod, uint32_t type)
368 {
369  return (pod && spa_pod_is_object(pod) && SPA_POD_OBJECT_TYPE(pod) == type);
370 }
371 
372 static inline bool spa_pod_is_object_id(const struct spa_pod *pod, uint32_t id)
373 {
374  return (pod && spa_pod_is_object(pod) && SPA_POD_OBJECT_ID(pod) == id);
375 }
376 
377 static inline int spa_pod_is_sequence(const struct spa_pod *pod)
378 {
379  return (SPA_POD_TYPE(pod) == SPA_TYPE_Sequence &&
380  SPA_POD_BODY_SIZE(pod) >= sizeof(struct spa_pod_sequence_body));
381 }
382 
383 static inline const struct spa_pod_prop *spa_pod_object_find_prop(const struct spa_pod_object *pod,
384  const struct spa_pod_prop *start, uint32_t key)
385 {
386  const struct spa_pod_prop *first, *res;
387 
388  first = spa_pod_prop_first(&pod->body);
389  start = start ? spa_pod_prop_next(start) : first;
390 
391  for (res = start; spa_pod_prop_is_inside(&pod->body, pod->pod.size, res);
392  res = spa_pod_prop_next(res)) {
393  if (res->key == key)
394  return res;
395  }
396  for (res = first; res != start; res = spa_pod_prop_next(res)) {
397  if (res->key == key)
398  return res;
399  }
400  return NULL;
401 }
402 
403 static inline const struct spa_pod_prop *spa_pod_find_prop(const struct spa_pod *pod,
404  const struct spa_pod_prop *start, uint32_t key)
405 {
406  if (!spa_pod_is_object(pod))
407  return NULL;
408  return spa_pod_object_find_prop((const struct spa_pod_object *)pod, start, key);
409 }
410 
411 static inline int spa_pod_object_fixate(struct spa_pod_object *pod)
412 {
413  struct spa_pod_prop *res;
414  SPA_POD_OBJECT_FOREACH(pod, res) {
415  if (res->value.type == SPA_TYPE_Choice &&
417  ((struct spa_pod_choice*)&res->value)->body.type = SPA_CHOICE_None;
418  }
419  return 0;
420 }
421 
422 static inline int spa_pod_fixate(struct spa_pod *pod)
423 {
424  if (!spa_pod_is_object(pod))
425  return -EINVAL;
426  return spa_pod_object_fixate((struct spa_pod_object *)pod);
427 }
428 
429 static inline int spa_pod_object_is_fixated(const struct spa_pod_object *pod)
430 {
431  struct spa_pod_prop *res;
432  SPA_POD_OBJECT_FOREACH(pod, res) {
433  if (res->value.type == SPA_TYPE_Choice &&
434  ((struct spa_pod_choice*)&res->value)->body.type != SPA_CHOICE_None)
435  return 0;
436  }
437  return 1;
438 }
439 
440 static inline int spa_pod_is_fixated(const struct spa_pod *pod)
441 {
442  if (!spa_pod_is_object(pod))
443  return -EINVAL;
444  return spa_pod_object_is_fixated((const struct spa_pod_object *)pod);
445 }
446 
451 #ifdef __cplusplus
452 } /* extern "C" */
453 #endif
454 
455 #endif /* SPA_POD_H */
static int spa_pod_is_bitmap(const struct spa_pod *pod)
Definition: iter.h:310
static struct spa_pod_control * spa_pod_control_first(const struct spa_pod_sequence_body *body)
Definition: iter.h:62
static int spa_pod_get_int(const struct spa_pod *pod, int32_t *value)
Definition: iter.h:167
static int spa_pod_is_long(const struct spa_pod *pod)
Definition: iter.h:175
static int spa_pod_is_bytes(const struct spa_pod *pod)
Definition: iter.h:240
static struct spa_pod_prop * spa_pod_prop_next(const struct spa_pod_prop *iter)
Definition: iter.h:57
static int spa_pod_fixate(struct spa_pod *pod)
Definition: iter.h:427
static struct spa_pod * spa_pod_get_values(const struct spa_pod *pod, uint32_t *n_vals, uint32_t *choice)
Definition: iter.h:347
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:388
static int spa_pod_get_pointer(const struct spa_pod *pod, uint32_t *type, const void **value)
Definition: iter.h:260
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:67
#define SPA_POD_VALUE(type, pod)
Definition: pod/pod.h:49
static int spa_pod_get_fraction(const struct spa_pod *pod, struct spa_fraction *value)
Definition: iter.h:303
static int spa_pod_is_rectangle(const struct spa_pod *pod)
Definition: iter.h:283
static int spa_pod_is_fd(const struct spa_pod *pod)
Definition: iter.h:269
#define SPA_POD_OBJECT_FOREACH(obj, iter)
Definition: iter.h:108
#define SPA_POD_BODY(pod)
Definition: pod/pod.h:39
static int spa_pod_is_pointer(const struct spa_pod *pod)
Definition: iter.h:254
#define SPA_POD_TYPE(pod)
Definition: pod/pod.h:28
static void * spa_pod_from_data(void *data, size_t maxsize, off_t offset, size_t size)
Definition: iter.h:120
static int spa_pod_get_id(const struct spa_pod *pod, uint32_t *value)
Definition: iter.h:154
static bool spa_pod_is_object_id(const struct spa_pod *pod, uint32_t id)
Definition: iter.h:377
#define SPA_POD_BODY_SIZE(pod)
Definition: pod/pod.h:26
static int spa_pod_get_float(const struct spa_pod *pod, float *value)
Definition: iter.h:193
static int spa_pod_copy_string(const struct spa_pod *pod, size_t maxlen, char *dest)
Definition: iter.h:230
static uint32_t spa_pod_copy_array(const struct spa_pod *pod, uint32_t type, void *values, uint32_t max_values)
Definition: iter.h:329
#define SPA_POD_PROP_FLAG_DONT_FIXATE
choices need no fixation
Definition: pod/pod.h:224
static int spa_pod_object_fixate(struct spa_pod_object *pod)
Definition: iter.h:416
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:366
static int spa_pod_get_rectangle(const struct spa_pod *pod, struct spa_rectangle *value)
Definition: iter.h:289
static int spa_pod_get_fd(const struct spa_pod *pod, int64_t *value)
Definition: iter.h:275
static int spa_pod_is_struct(const struct spa_pod *pod)
Definition: iter.h:361
static int spa_pod_is_sequence(const struct spa_pod *pod)
Definition: iter.h:382
#define SPA_POD_ARRAY_VALUE_SIZE(arr)
Definition: pod/pod.h:115
static struct spa_pod_control * spa_pod_control_next(const struct spa_pod_control *iter)
Definition: iter.h:74
#define SPA_POD_CONTROL_SIZE(ev)
Definition: pod/pod.h:231
static int spa_pod_get_long(const struct spa_pod *pod, int64_t *value)
Definition: iter.h:180
#define SPA_POD_CONTENTS(type, pod)
Definition: pod/pod.h:35
static int spa_pod_is_string(const struct spa_pod *pod)
Definition: iter.h:214
static int spa_pod_is_fixated(const struct spa_pod *pod)
Definition: iter.h:445
static void * spa_pod_next(const void *iter)
Definition: iter.h:40
static void * spa_pod_get_array(const struct spa_pod *pod, uint32_t *n_values)
Definition: iter.h:322
static int spa_pod_is_choice(const struct spa_pod *pod)
Definition: iter.h:341
static int spa_pod_get_string(const struct spa_pod *pod, const char **value)
Definition: iter.h:222
#define SPA_POD_PROP_SIZE(prop)
Definition: pod/pod.h:205
static int spa_pod_get_double(const struct spa_pod *pod, double *value)
Definition: iter.h:206
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:408
static int spa_pod_get_bool(const struct spa_pod *pod, bool *value)
Definition: iter.h:141
#define SPA_POD_OBJECT_TYPE(obj)
Definition: pod/pod.h:173
#define SPA_POD_OBJECT_ID(obj)
Definition: pod/pod.h:175
static bool spa_pod_is_object_type(const struct spa_pod *pod, uint32_t type)
Definition: iter.h:372
#define SPA_POD_ARRAY_VALUE_TYPE(arr)
Definition: pod/pod.h:113
static int spa_pod_is_array(const struct spa_pod *pod)
Definition: iter.h:316
static int spa_pod_is_id(const struct spa_pod *pod)
Definition: iter.h:149
static int spa_pod_is_double(const struct spa_pod *pod)
Definition: iter.h:201
#define SPA_POD_CHOICE_N_VALUES(choice)
Definition: pod/pod.h:142
static int spa_pod_is_int(const struct spa_pod *pod)
Definition: iter.h:162
static int spa_pod_is_none(const struct spa_pod *pod)
Definition: iter.h:131
static struct spa_pod_prop * spa_pod_prop_first(const struct spa_pod_object_body *body)
Definition: iter.h:45
static int spa_pod_object_is_fixated(const struct spa_pod_object *pod)
Definition: iter.h:434
static int spa_pod_is_fraction(const struct spa_pod *pod)
Definition: iter.h:297
#define SPA_POD_SIZE(pod)
Definition: pod/pod.h:30
static int spa_pod_is_float(const struct spa_pod *pod)
Definition: iter.h:188
#define SPA_POD_CHOICE_CHILD(choice)
Definition: pod/pod.h:132
#define SPA_POD_ARRAY_N_VALUES(arr)
Definition: pod/pod.h:117
#define SPA_POD_CHOICE_TYPE(choice)
Definition: pod/pod.h:134
static int spa_pod_get_bytes(const struct spa_pod *pod, const void **value, uint32_t *len)
Definition: iter.h:245
#define SPA_POD_ARRAY_VALUES(arr)
Definition: pod/pod.h:119
static int spa_pod_is_bool(const struct spa_pod *pod)
Definition: iter.h:136
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:50
@ SPA_CHOICE_None
no choice, first value is current
Definition: pod/pod.h:147
@ SPA_TYPE_Int
Definition: spa/include/spa/utils/type.h:34
@ SPA_TYPE_Rectangle
Definition: spa/include/spa/utils/type.h:40
@ SPA_TYPE_Long
Definition: spa/include/spa/utils/type.h:35
@ SPA_TYPE_Bool
Definition: spa/include/spa/utils/type.h:32
@ SPA_TYPE_Bytes
Definition: spa/include/spa/utils/type.h:39
@ SPA_TYPE_Bitmap
Definition: spa/include/spa/utils/type.h:42
@ SPA_TYPE_Object
Definition: spa/include/spa/utils/type.h:45
@ SPA_TYPE_Float
Definition: spa/include/spa/utils/type.h:36
@ SPA_TYPE_Fraction
Definition: spa/include/spa/utils/type.h:41
@ SPA_TYPE_None
Definition: spa/include/spa/utils/type.h:31
@ SPA_TYPE_Sequence
Definition: spa/include/spa/utils/type.h:46
@ SPA_TYPE_Double
Definition: spa/include/spa/utils/type.h:37
@ SPA_TYPE_Id
Definition: spa/include/spa/utils/type.h:33
@ SPA_TYPE_Choice
Definition: spa/include/spa/utils/type.h:49
@ SPA_TYPE_Pointer
Definition: spa/include/spa/utils/type.h:47
@ SPA_TYPE_Array
Definition: spa/include/spa/utils/type.h:43
@ SPA_TYPE_String
Definition: spa/include/spa/utils/type.h:38
@ SPA_TYPE_Fd
Definition: spa/include/spa/utils/type.h:48
@ SPA_TYPE_Struct
Definition: spa/include/spa/utils/type.h:44
#define SPA_MIN(a, b)
Definition: defs.h:151
#define SPA_ROUND_UP_N(num, align)
Definition: defs.h:320
#define spa_return_val_if_fail(expr, val)
Definition: defs.h:365
#define SPA_FLAG_IS_SET(field, flag)
Definition: defs.h:76
#define SPA_PTROFF(ptr_, offset_, type_)
Return the address (buffer + offset) as pointer of type.
Definition: defs.h:194
spa/pod/pod.h
Definition: defs.h:123
Definition: pod/pod.h:121
Definition: pod/pod.h:51
Definition: pod/pod.h:90
Definition: pod/pod.h:154
Definition: pod/pod.h:162
struct spa_pod pod
Definition: pod/pod.h:163
Definition: pod/pod.h:234
struct spa_pod value
control value, depends on type
Definition: pod/pod.h:237
uint32_t type
type of control, enum spa_control_type
Definition: pod/pod.h:236
uint32_t offset
media offset
Definition: pod/pod.h:235
Definition: pod/pod.h:80
Definition: pod/pod.h:199
Definition: pod/pod.h:74
Definition: pod/pod.h:100
Definition: iter.h:27
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
Definition: pod/pod.h:57
Definition: pod/pod.h:63
Definition: pod/pod.h:69
Definition: pod/pod.h:177
Definition: pod/pod.h:183
struct spa_pod pod
Definition: pod/pod.h:184
struct spa_pod_object_body body
Definition: pod/pod.h:185
Definition: pod/pod.h:188
Definition: pod/pod.h:194
struct spa_pod pod
Definition: pod/pod.h:195
Definition: pod/pod.h:208
uint32_t key
key of property, list of valid keys depends on the object type
Definition: pod/pod.h:209
uint32_t flags
flags for property
Definition: pod/pod.h:225
struct spa_pod value
Definition: pod/pod.h:226
Definition: pod/pod.h:95
Definition: pod/pod.h:241
Definition: pod/pod.h:85
Definition: pod/pod.h:43
uint32_t type
Definition: pod/pod.h:45
uint32_t size
Definition: pod/pod.h:44
Definition: defs.h:102