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