PipeWire 1.2.6

Loading...
Searching...
No Matches
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{
292 if (!spa_pod_is_rectangle(pod))
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{
306 spa_return_val_if_fail(spa_pod_is_fraction(pod), -EINVAL);
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{
325 spa_return_val_if_fail(spa_pod_is_array(pod), NULL);
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 &&
422 !SPA_FLAG_IS_SET(res->flags, SPA_POD_PROP_FLAG_DONT_FIXATE))
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 */
spa_pod_is_bitmap
static int spa_pod_is_bitmap(const struct spa_pod *pod)
Definition iter.h:316
spa_pod_get_int
static int spa_pod_get_int(const struct spa_pod *pod, int32_t *value)
Definition iter.h:173
spa_pod_is_long
static int spa_pod_is_long(const struct spa_pod *pod)
Definition iter.h:181
spa_pod_is_bytes
static int spa_pod_is_bytes(const struct spa_pod *pod)
Definition iter.h:246
spa_pod_fixate
static int spa_pod_fixate(struct spa_pod *pod)
Definition iter.h:433
spa_pod_object_find_prop
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
spa_pod_get_pointer
static int spa_pod_get_pointer(const struct spa_pod *pod, uint32_t *type, const void **value)
Definition iter.h:266
spa_pod_control_is_inside
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
SPA_POD_VALUE
#define SPA_POD_VALUE(type, pod)
Definition pod.h:49
spa_pod_get_fraction
static int spa_pod_get_fraction(const struct spa_pod *pod, struct spa_fraction *value)
Definition iter.h:309
spa_pod_find_prop
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
spa_pod_next
static void * spa_pod_next(const void *iter)
Definition iter.h:42
spa_pod_is_rectangle
static int spa_pod_is_rectangle(const struct spa_pod *pod)
Definition iter.h:289
spa_pod_is_fd
static int spa_pod_is_fd(const struct spa_pod *pod)
Definition iter.h:275
spa_pod_object_has_props
static int spa_pod_object_has_props(const struct spa_pod_object *pod)
Definition iter.h:451
SPA_POD_OBJECT_FOREACH
#define SPA_POD_OBJECT_FOREACH(obj, iter)
Definition iter.h:114
spa_pod_is_pointer
static int spa_pod_is_pointer(const struct spa_pod *pod)
Definition iter.h:260
SPA_POD_TYPE
#define SPA_POD_TYPE(pod)
Definition pod.h:28
spa_pod_get_id
static int spa_pod_get_id(const struct spa_pod *pod, uint32_t *value)
Definition iter.h:160
spa_pod_is_object_id
static bool spa_pod_is_object_id(const struct spa_pod *pod, uint32_t id)
Definition iter.h:383
SPA_POD_BODY_SIZE
#define SPA_POD_BODY_SIZE(pod)
Definition pod.h:26
spa_pod_get_float
static int spa_pod_get_float(const struct spa_pod *pod, float *value)
Definition iter.h:199
spa_pod_copy_string
static int spa_pod_copy_string(const struct spa_pod *pod, size_t maxlen, char *dest)
Definition iter.h:236
spa_pod_copy_array
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
spa_pod_control_next
static struct spa_pod_control * spa_pod_control_next(const struct spa_pod_control *iter)
Definition iter.h:80
SPA_POD_PROP_FLAG_DONT_FIXATE
#define SPA_POD_PROP_FLAG_DONT_FIXATE
choices need no fixation
Definition pod.h:224
spa_pod_object_fixate
static int spa_pod_object_fixate(struct spa_pod_object *pod)
Definition iter.h:422
spa_pod_is_inside
static bool spa_pod_is_inside(const void *pod, uint32_t size, const void *iter)
Definition iter.h:34
spa_pod_is_object
static int spa_pod_is_object(const struct spa_pod *pod)
Definition iter.h:372
spa_pod_get_rectangle
static int spa_pod_get_rectangle(const struct spa_pod *pod, struct spa_rectangle *value)
Definition iter.h:295
spa_pod_get_fd
static int spa_pod_get_fd(const struct spa_pod *pod, int64_t *value)
Definition iter.h:281
spa_pod_is_struct
static int spa_pod_is_struct(const struct spa_pod *pod)
Definition iter.h:367
spa_pod_is_sequence
static int spa_pod_is_sequence(const struct spa_pod *pod)
Definition iter.h:388
SPA_POD_ARRAY_VALUE_SIZE
#define SPA_POD_ARRAY_VALUE_SIZE(arr)
Definition pod.h:115
SPA_POD_CONTROL_SIZE
#define SPA_POD_CONTROL_SIZE(ev)
Definition pod.h:231
spa_pod_get_long
static int spa_pod_get_long(const struct spa_pod *pod, int64_t *value)
Definition iter.h:186
SPA_POD_CONTENTS
#define SPA_POD_CONTENTS(type, pod)
Definition pod.h:35
spa_pod_from_data
static void * spa_pod_from_data(void *data, size_t maxsize, off_t offset, size_t size)
Definition iter.h:126
spa_pod_is_string
static int spa_pod_is_string(const struct spa_pod *pod)
Definition iter.h:220
spa_pod_is_fixated
static int spa_pod_is_fixated(const struct spa_pod *pod)
Definition iter.h:459
spa_pod_is_choice
static int spa_pod_is_choice(const struct spa_pod *pod)
Definition iter.h:347
spa_pod_get_array
static void * spa_pod_get_array(const struct spa_pod *pod, uint32_t *n_values)
Definition iter.h:328
spa_pod_get_string
static int spa_pod_get_string(const struct spa_pod *pod, const char **value)
Definition iter.h:228
SPA_POD_PROP_SIZE
#define SPA_POD_PROP_SIZE(prop)
Definition pod.h:205
spa_pod_get_values
static struct spa_pod * spa_pod_get_values(const struct spa_pod *pod, uint32_t *n_vals, uint32_t *choice)
Definition iter.h:353
spa_pod_get_double
static int spa_pod_get_double(const struct spa_pod *pod, double *value)
Definition iter.h:212
spa_pod_get_bool
static int spa_pod_get_bool(const struct spa_pod *pod, bool *value)
Definition iter.h:147
spa_pod_prop_next
static struct spa_pod_prop * spa_pod_prop_next(const struct spa_pod_prop *iter)
Definition iter.h:61
SPA_POD_OBJECT_TYPE
#define SPA_POD_OBJECT_TYPE(obj)
Definition pod.h:173
SPA_POD_OBJECT_ID
#define SPA_POD_OBJECT_ID(obj)
Definition pod.h:175
spa_pod_is_object_type
static bool spa_pod_is_object_type(const struct spa_pod *pod, uint32_t type)
Definition iter.h:378
SPA_POD_ARRAY_VALUE_TYPE
#define SPA_POD_ARRAY_VALUE_TYPE(arr)
Definition pod.h:113
spa_pod_is_array
static int spa_pod_is_array(const struct spa_pod *pod)
Definition iter.h:322
spa_pod_is_id
static int spa_pod_is_id(const struct spa_pod *pod)
Definition iter.h:155
spa_pod_is_double
static int spa_pod_is_double(const struct spa_pod *pod)
Definition iter.h:207
spa_pod_control_first
static struct spa_pod_control * spa_pod_control_first(const struct spa_pod_sequence_body *body)
Definition iter.h:66
SPA_POD_CHOICE_N_VALUES
#define SPA_POD_CHOICE_N_VALUES(choice)
Definition pod.h:142
spa_pod_prop_first
static struct spa_pod_prop * spa_pod_prop_first(const struct spa_pod_object_body *body)
Definition iter.h:47
spa_pod_is_int
static int spa_pod_is_int(const struct spa_pod *pod)
Definition iter.h:168
spa_pod_is_none
static int spa_pod_is_none(const struct spa_pod *pod)
Definition iter.h:137
spa_pod_object_is_fixated
static int spa_pod_object_is_fixated(const struct spa_pod_object *pod)
Definition iter.h:440
spa_pod_is_fraction
static int spa_pod_is_fraction(const struct spa_pod *pod)
Definition iter.h:303
SPA_POD_SIZE
#define SPA_POD_SIZE(pod)
Definition pod.h:30
spa_pod_is_float
static int spa_pod_is_float(const struct spa_pod *pod)
Definition iter.h:194
SPA_POD_CHOICE_CHILD
#define SPA_POD_CHOICE_CHILD(choice)
Definition pod.h:132
SPA_POD_ARRAY_N_VALUES
#define SPA_POD_ARRAY_N_VALUES(arr)
Definition pod.h:117
SPA_POD_CHOICE_TYPE
#define SPA_POD_CHOICE_TYPE(choice)
Definition pod.h:134
spa_pod_get_bytes
static int spa_pod_get_bytes(const struct spa_pod *pod, const void **value, uint32_t *len)
Definition iter.h:251
SPA_POD_ARRAY_VALUES
#define SPA_POD_ARRAY_VALUES(arr)
Definition pod.h:119
spa_pod_is_bool
static int spa_pod_is_bool(const struct spa_pod *pod)
Definition iter.h:142
spa_pod_prop_is_inside
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
@ SPA_CHOICE_None
no choice, first value is current
Definition pod.h:147
SPA_TYPE_Int
@ SPA_TYPE_Int
Definition type.h:34
SPA_TYPE_Rectangle
@ SPA_TYPE_Rectangle
Definition type.h:40
SPA_TYPE_Long
@ SPA_TYPE_Long
Definition type.h:35
SPA_TYPE_Bool
@ SPA_TYPE_Bool
Definition type.h:32
SPA_TYPE_Bytes
@ SPA_TYPE_Bytes
Definition type.h:39
SPA_TYPE_Bitmap
@ SPA_TYPE_Bitmap
Definition type.h:42
SPA_TYPE_Object
@ SPA_TYPE_Object
Definition type.h:45
SPA_TYPE_Float
@ SPA_TYPE_Float
Definition type.h:36
SPA_TYPE_Fraction
@ SPA_TYPE_Fraction
Definition type.h:41
SPA_TYPE_None
@ SPA_TYPE_None
Definition type.h:31
SPA_TYPE_Sequence
@ SPA_TYPE_Sequence
Definition type.h:46
SPA_TYPE_Double
@ SPA_TYPE_Double
Definition type.h:37
SPA_TYPE_Id
@ SPA_TYPE_Id
Definition type.h:33
SPA_TYPE_Choice
@ SPA_TYPE_Choice
Definition type.h:49
SPA_TYPE_Pointer
@ SPA_TYPE_Pointer
Definition type.h:47
SPA_TYPE_Array
@ SPA_TYPE_Array
Definition type.h:43
SPA_TYPE_String
@ SPA_TYPE_String
Definition type.h:38
SPA_TYPE_Fd
@ SPA_TYPE_Fd
Definition type.h:48
SPA_TYPE_Struct
@ SPA_TYPE_Struct
Definition type.h:44
SPA_MIN
#define SPA_MIN(a, b)
Definition defs.h:165
SPA_ROUND_UP_N
#define SPA_ROUND_UP_N(num, align)
Definition defs.h:342
spa_return_val_if_fail
#define spa_return_val_if_fail(expr, val)
Definition defs.h:431
SPA_FLAG_IS_SET
#define SPA_FLAG_IS_SET(field, flag)
Definition defs.h:90
spa_ptr_type_inside
#define spa_ptr_type_inside(p1, s1, p2, type, remaining)
Definition defs.h:401
SPA_PTROFF
#define SPA_PTROFF(ptr_, offset_, type_)
Return the address (buffer + offset) as pointer of type.
Definition defs.h:222
pod.h
spa/pod/pod.h
spa_fraction
Definition defs.h:137
spa_pod_array_body
Definition pod.h:121
spa_pod_bool
Definition pod.h:51
spa_pod_bytes
Definition pod.h:90
spa_pod_choice_body
Definition pod.h:154
spa_pod_choice_body::type
uint32_t type
type of choice, one of enum spa_choice_type
Definition pod.h:155
spa_pod_choice
Definition pod.h:162
spa_pod_choice::body
struct spa_pod_choice_body body
Definition pod.h:164
spa_pod_choice::pod
struct spa_pod pod
Definition pod.h:163
spa_pod_control
Definition pod.h:234
spa_pod_control::value
struct spa_pod value
control value, depends on type
Definition pod.h:237
spa_pod_control::type
uint32_t type
type of control, enum spa_control_type
Definition pod.h:236
spa_pod_control::offset
uint32_t offset
media offset
Definition pod.h:235
spa_pod_double
Definition pod.h:80
spa_pod_fd
Definition pod.h:199
spa_pod_float
Definition pod.h:74
spa_pod_fraction
Definition pod.h:100
spa_pod_frame
Definition iter.h:27
spa_pod_frame::pod
struct spa_pod pod
Definition iter.h:28
spa_pod_frame::offset
uint32_t offset
Definition iter.h:30
spa_pod_frame::parent
struct spa_pod_frame * parent
Definition iter.h:29
spa_pod_frame::flags
uint32_t flags
Definition iter.h:31
spa_pod_id
Definition pod.h:57
spa_pod_int
Definition pod.h:63
spa_pod_long
Definition pod.h:69
spa_pod_object_body
Definition pod.h:177
spa_pod_object
Definition pod.h:183
spa_pod_object::pod
struct spa_pod pod
Definition pod.h:184
spa_pod_object::body
struct spa_pod_object_body body
Definition pod.h:185
spa_pod_pointer_body
Definition pod.h:188
spa_pod_pointer_body::value
const void * value
Definition pod.h:191
spa_pod_pointer_body::type
uint32_t type
pointer id, one of enum spa_type
Definition pod.h:189
spa_pod_pointer
Definition pod.h:194
spa_pod_pointer::body
struct spa_pod_pointer_body body
Definition pod.h:196
spa_pod_pointer::pod
struct spa_pod pod
Definition pod.h:195
spa_pod_prop
Definition pod.h:208
spa_pod_prop::key
uint32_t key
key of property, list of valid keys depends on the object type
Definition pod.h:209
spa_pod_prop::value
struct spa_pod value
Definition pod.h:226
spa_pod_rectangle
Definition pod.h:95
spa_pod_sequence_body
Definition pod.h:241
spa_pod_string
Definition pod.h:85
spa_pod
Definition pod.h:43
spa_pod::type
uint32_t type
Definition pod.h:45
spa_pod::size
uint32_t size
Definition pod.h:44
spa_rectangle
Definition defs.h:116