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