PipeWire: spa/pod/iter.h Source File

PipeWire 1.4.7

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