PipeWire: spa/pod/iter.h Source File

PipeWire 1.0.3

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
22struct 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
35static 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
52static 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
69static 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
115static 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
126static 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
144static 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
157static 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
170static 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
183static 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
196static 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
209static 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
217static 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
225static 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
235static 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
249static 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
255static 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
264static 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
270static 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
278static 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
284static inline int spa_pod_get_rectangle(const struct spa_pod *pod, struct spa_rectangle *value)
285{
286 if (!spa_pod_is_rectangle(pod))
287 return -EINVAL;
288 *value = SPA_POD_VALUE(struct spa_pod_rectangle, pod);
289 return 0;
290}
291
292static 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
298static inline int spa_pod_get_fraction(const struct spa_pod *pod, struct spa_fraction *value)
299{
300 spa_return_val_if_fail(spa_pod_is_fraction(pod), -EINVAL);
301 *value = SPA_POD_VALUE(struct spa_pod_fraction, pod);
302 return 0;
303}
304
305static 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
311static 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
317static inline void *spa_pod_get_array(const struct spa_pod *pod, uint32_t *n_values)
318{
319 spa_return_val_if_fail(spa_pod_is_array(pod), NULL);
320 *n_values = SPA_POD_ARRAY_N_VALUES(pod);
321 return SPA_POD_ARRAY_VALUES(pod);
322}
323
324static 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
336static 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
342static 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
356static 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
367static 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
383static 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
403static 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
411static 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 &&
416 !SPA_FLAG_IS_SET(res->flags, SPA_POD_PROP_FLAG_DONT_FIXATE))
417 ((struct spa_pod_choice*)&res->value)->body.type = SPA_CHOICE_None;
418 }
419 return 0;
420}
421
422static 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
429static 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
440static 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 */
spa_pod_is_bitmap
static int spa_pod_is_bitmap(const struct spa_pod *pod)
Definition iter.h:310
spa_pod_get_int
static int spa_pod_get_int(const struct spa_pod *pod, int32_t *value)
Definition iter.h:167
spa_pod_is_long
static int spa_pod_is_long(const struct spa_pod *pod)
Definition iter.h:175
spa_pod_is_bytes
static int spa_pod_is_bytes(const struct spa_pod *pod)
Definition iter.h:240
spa_pod_fixate
static int spa_pod_fixate(struct spa_pod *pod)
Definition iter.h:427
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:388
spa_pod_get_pointer
static int spa_pod_get_pointer(const struct spa_pod *pod, uint32_t *type, const void **value)
Definition iter.h:260
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:67
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:303
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:408
spa_pod_next
static void * spa_pod_next(const void *iter)
Definition iter.h:40
spa_pod_is_rectangle
static int spa_pod_is_rectangle(const struct spa_pod *pod)
Definition iter.h:283
spa_pod_is_fd
static int spa_pod_is_fd(const struct spa_pod *pod)
Definition iter.h:269
SPA_POD_OBJECT_FOREACH
#define SPA_POD_OBJECT_FOREACH(obj, iter)
Definition iter.h:108
SPA_POD_BODY
#define SPA_POD_BODY(pod)
Definition pod.h:39
spa_pod_is_pointer
static int spa_pod_is_pointer(const struct spa_pod *pod)
Definition iter.h:254
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:154
spa_pod_is_object_id
static bool spa_pod_is_object_id(const struct spa_pod *pod, uint32_t id)
Definition iter.h:377
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:193
spa_pod_copy_string
static int spa_pod_copy_string(const struct spa_pod *pod, size_t maxlen, char *dest)
Definition iter.h:230
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:329
spa_pod_control_next
static struct spa_pod_control * spa_pod_control_next(const struct spa_pod_control *iter)
Definition iter.h:74
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:416
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:366
spa_pod_get_rectangle
static int spa_pod_get_rectangle(const struct spa_pod *pod, struct spa_rectangle *value)
Definition iter.h:289
spa_pod_get_fd
static int spa_pod_get_fd(const struct spa_pod *pod, int64_t *value)
Definition iter.h:275
spa_pod_is_struct
static int spa_pod_is_struct(const struct spa_pod *pod)
Definition iter.h:361
spa_pod_is_sequence
static int spa_pod_is_sequence(const struct spa_pod *pod)
Definition iter.h:382
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:180
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:120
spa_pod_is_string
static int spa_pod_is_string(const struct spa_pod *pod)
Definition iter.h:214
spa_pod_is_fixated
static int spa_pod_is_fixated(const struct spa_pod *pod)
Definition iter.h:445
spa_pod_is_choice
static int spa_pod_is_choice(const struct spa_pod *pod)
Definition iter.h:341
spa_pod_get_array
static void * spa_pod_get_array(const struct spa_pod *pod, uint32_t *n_values)
Definition iter.h:322
spa_pod_get_string
static int spa_pod_get_string(const struct spa_pod *pod, const char **value)
Definition iter.h:222
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:347
spa_pod_get_double
static int spa_pod_get_double(const struct spa_pod *pod, double *value)
Definition iter.h:206
spa_pod_get_bool
static int spa_pod_get_bool(const struct spa_pod *pod, bool *value)
Definition iter.h:141
spa_pod_prop_next
static struct spa_pod_prop * spa_pod_prop_next(const struct spa_pod_prop *iter)
Definition iter.h:57
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:372
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:316
spa_pod_is_id
static int spa_pod_is_id(const struct spa_pod *pod)
Definition iter.h:149
spa_pod_is_double
static int spa_pod_is_double(const struct spa_pod *pod)
Definition iter.h:201
spa_pod_control_first
static struct spa_pod_control * spa_pod_control_first(const struct spa_pod_sequence_body *body)
Definition iter.h:62
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:45
spa_pod_is_int
static int spa_pod_is_int(const struct spa_pod *pod)
Definition iter.h:162
spa_pod_is_none
static int spa_pod_is_none(const struct spa_pod *pod)
Definition iter.h:131
spa_pod_object_is_fixated
static int spa_pod_object_is_fixated(const struct spa_pod_object *pod)
Definition iter.h:434
spa_pod_is_fraction
static int spa_pod_is_fraction(const struct spa_pod *pod)
Definition iter.h:297
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:188
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:245
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:136
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:50
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:151
SPA_ROUND_UP_N
#define SPA_ROUND_UP_N(num, align)
Definition defs.h:324
spa_return_val_if_fail
#define spa_return_val_if_fail(expr, val)
Definition defs.h:369
SPA_FLAG_IS_SET
#define SPA_FLAG_IS_SET(field, flag)
Definition defs.h:76
SPA_PTROFF
#define SPA_PTROFF(ptr_, offset_, type_)
Return the address (buffer + offset) as pointer of type.
Definition defs.h:198
pod.h
spa/pod/pod.h
spa_fraction
Definition defs.h:123
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
Definition pod.h:162
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
Definition pod.h:194
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::flags
uint32_t flags
flags for property
Definition pod.h:225
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:102