PipeWire: spa/pod/body.h Source File

PipeWire 1.6.8

Loading...
Searching...
No Matches
body.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_BODY_H
6#define SPA_POD_BODY_H
7
8#include <errno.h>
9#include <sys/types.h>
10
11#include <spa/pod/pod.h>
12#include <spa/utils/atomic.h>
13
14#ifdef __cplusplus
15extern "C" {
16#endif
17
18#ifndef SPA_API_POD_BODY
19 #ifdef SPA_API_IMPL
20 #define SPA_API_POD_BODY SPA_API_IMPL
21 #else
22 #define SPA_API_POD_BODY static inline
23 #endif
24#endif
25
30
31struct spa_pod_frame {
32 struct spa_pod pod;
33 struct spa_pod_frame *parent;
34 uint32_t offset;
35 uint32_t flags;
36};
37
38 SPA_API_POD_BODY uint32_t spa_pod_type_size(uint32_t type)
39{
40 switch (type) {
41 case SPA_TYPE_None:
42 case SPA_TYPE_Bytes:
43 case SPA_TYPE_Struct:
44 case SPA_TYPE_Pod:
45 return 0;
46 case SPA_TYPE_String:
47 return 1;
48 case SPA_TYPE_Bool:
49 case SPA_TYPE_Int:
50 return sizeof(int32_t);
51 case SPA_TYPE_Id:
52 return sizeof(uint32_t);
53 case SPA_TYPE_Long:
54 return sizeof(int64_t);
55 case SPA_TYPE_Float:
56 return sizeof(float);
57 case SPA_TYPE_Double:
58 return sizeof(double);
59 case SPA_TYPE_Rectangle:
60 return sizeof(struct spa_rectangle);
61 case SPA_TYPE_Fraction:
62 return sizeof(struct spa_fraction);
63 case SPA_TYPE_Bitmap:
64 return sizeof(uint8_t);
65 case SPA_TYPE_Array:
66 return sizeof(struct spa_pod_array_body);
67 case SPA_TYPE_Object:
68 return sizeof(struct spa_pod_object_body);
69 case SPA_TYPE_Sequence:
70 return sizeof(struct spa_pod_sequence_body);
71 case SPA_TYPE_Pointer:
72 return sizeof(struct spa_pod_pointer_body);
73 case SPA_TYPE_Fd:
74 return sizeof(int64_t);
75 case SPA_TYPE_Choice:
76 return sizeof(struct spa_pod_choice_body);
77 }
78 return 0;
79}
80
81 SPA_API_POD_BODY int spa_pod_choice_n_values(uint32_t choice_type, uint32_t *min, uint32_t *max)
82{
83 switch (choice_type) {
84 case SPA_CHOICE_Enum:
85 *min = 2;
86 *max = UINT32_MAX;
87 break;
88 case SPA_CHOICE_Range:
89 *min = *max = 3;
90 break;
91 case SPA_CHOICE_Step:
92 *min = *max = 4;
93 break;
94 case SPA_CHOICE_None:
95 case SPA_CHOICE_Flags:
96 *min = *max = 1;
97 break;
98 default:
99 /*
100 * This must always return at least 1, because callers
101 * assume that n_vals >= spa_pod_choice_n_values()
102 * mean that n_vals is at least 1.
103 */
104 *min = 1;
105 *max = UINT32_MAX;
106 return 0;
107 }
108 return 1;
109}
110
111 SPA_API_POD_BODY int spa_pod_body_from_data(void *data, size_t maxsize, off_t offset, size_t size,
112 struct spa_pod *pod, const void **body)
113{
114 if (offset < 0 || offset > (int64_t)UINT32_MAX)
115 return -EINVAL;
116 if (size < sizeof(struct spa_pod) ||
117 size > maxsize ||
118 maxsize - size < (uint32_t)offset)
119 return -EINVAL;
120 memcpy(pod, SPA_PTROFF(data, offset, void), sizeof(struct spa_pod));
121 if (!SPA_POD_IS_VALID(pod))
122 return -EINVAL;
123 if (pod->size > size - sizeof(struct spa_pod))
124 return -EINVAL;
125 *body = SPA_PTROFF(data, offset + sizeof(struct spa_pod), void);
126 return 0;
127}
128
129 SPA_API_POD_BODY int spa_pod_is_none(const struct spa_pod *pod)
130{
131 return SPA_POD_CHECK_TYPE(pod, SPA_TYPE_None);
132}
133
134 SPA_API_POD_BODY int spa_pod_is_bool(const struct spa_pod *pod)
135{
136 return SPA_POD_CHECK(pod, SPA_TYPE_Bool, sizeof(int32_t));
137}
138
139#define SPA_POD_BODY_LOAD_ONCE(a, b) (*(a) = SPA_LOAD_ONCE(*(__typeof__(a))(b)))
140#define SPA_POD_BODY_LOAD_FIELD_ONCE(a, b, field) ((a)->field = SPA_LOAD_ONCE(((__typeof__(a))(b))->field))
141
142 SPA_API_POD_BODY int spa_pod_body_get_bool(const struct spa_pod *pod, const void *body, bool *value)
143{
144 if (!spa_pod_is_bool(pod))
145 return -EINVAL;
146 *value = !!__atomic_load_n((const int32_t *)body, __ATOMIC_RELAXED);
147 return 0;
148}
149
150 SPA_API_POD_BODY int spa_pod_is_id(const struct spa_pod *pod)
151{
152 return SPA_POD_CHECK(pod, SPA_TYPE_Id, sizeof(uint32_t));
153}
154
155 SPA_API_POD_BODY int spa_pod_body_get_id(const struct spa_pod *pod, const void *body, uint32_t *value)
156{
157 if (!spa_pod_is_id(pod))
158 return -EINVAL;
159 SPA_POD_BODY_LOAD_ONCE(value, body);
160 return 0;
161}
162
163 SPA_API_POD_BODY int spa_pod_is_int(const struct spa_pod *pod)
164{
165 return SPA_POD_CHECK(pod, SPA_TYPE_Int, sizeof(int32_t));
166}
167
168 SPA_API_POD_BODY int spa_pod_body_get_int(const struct spa_pod *pod, const void *body, int32_t *value)
169{
170 if (!spa_pod_is_int(pod))
171 return -EINVAL;
172 SPA_POD_BODY_LOAD_ONCE(value, body);
173 return 0;
174}
175
176 SPA_API_POD_BODY int spa_pod_is_long(const struct spa_pod *pod)
177{
178 return SPA_POD_CHECK(pod, SPA_TYPE_Long, sizeof(int64_t));
179}
180
181 SPA_API_POD_BODY int spa_pod_body_get_long(const struct spa_pod *pod, const void *body, int64_t *value)
182{
183 if (!spa_pod_is_long(pod))
184 return -EINVAL;
185 /* TODO this is wrong per C standard, but if it breaks so does the Linux kernel. */
186 SPA_BARRIER;
187 memcpy(value, body, sizeof *value);
188 SPA_BARRIER;
189 return 0;
190}
191
192 SPA_API_POD_BODY int spa_pod_is_float(const struct spa_pod *pod)
193{
194 return SPA_POD_CHECK(pod, SPA_TYPE_Float, sizeof(float));
195}
196
197 SPA_API_POD_BODY int spa_pod_body_get_float(const struct spa_pod *pod, const void *body, float *value)
198{
199 if (!spa_pod_is_float(pod))
200 return -EINVAL;
201 SPA_BARRIER;
202 memcpy(value, body, sizeof *value);
203 SPA_BARRIER;
204 return 0;
205}
206
207 SPA_API_POD_BODY int spa_pod_is_double(const struct spa_pod *pod)
208{
209 return SPA_POD_CHECK(pod, SPA_TYPE_Double, sizeof(double));
210}
211
212 SPA_API_POD_BODY int spa_pod_body_get_double(const struct spa_pod *pod, const void *body, double *value)
213{
214 if (!spa_pod_is_double(pod))
215 return -EINVAL;
216 SPA_BARRIER;
217 memcpy(value, body, sizeof *value);
218 SPA_BARRIER;
219 return 0;
220}
221
222 SPA_API_POD_BODY int spa_pod_is_string(const struct spa_pod *pod)
223{
224 return SPA_POD_CHECK(pod, SPA_TYPE_String, 1);
225}
226
227 SPA_API_POD_BODY int spa_pod_body_get_string(const struct spa_pod *pod,
228 const void *body, const char **value)
229{
230 const char *s;
231 if (!spa_pod_is_string(pod))
232 return -EINVAL;
233 s = (const char *)body;
234 if (((const volatile char *)s)[pod->size-1] != '\0')
235 return -EINVAL;
236 *value = s;
237 return 0;
238}
239
240 SPA_API_POD_BODY int spa_pod_body_copy_string(const struct spa_pod *pod, const void *body,
241 char *dest, size_t maxlen)
242{
243 const char *s;
244 if (spa_pod_body_get_string(pod, body, &s) < 0 || maxlen < 1)
245 return -EINVAL;
246 SPA_BARRIER;
247 strncpy(dest, s, maxlen-1);
248 SPA_BARRIER;
249 dest[maxlen-1]= '\0';
250 return 0;
251}
252
253 SPA_API_POD_BODY int spa_pod_is_bytes(const struct spa_pod *pod)
254{
255 return SPA_POD_CHECK_TYPE(pod, SPA_TYPE_Bytes);
256}
257
258 SPA_API_POD_BODY int spa_pod_body_get_bytes(const struct spa_pod *pod, const void *body,
259 const void **value, uint32_t *len)
260{
261 if (!spa_pod_is_bytes(pod))
262 return -EINVAL;
263 *value = (const void *)body;
264 *len = pod->size;
265 return 0;
266}
267
268 SPA_API_POD_BODY int spa_pod_is_pointer(const struct spa_pod *pod)
269{
270 return SPA_POD_CHECK(pod, SPA_TYPE_Pointer, sizeof(struct spa_pod_pointer_body));
271}
272
273 SPA_API_POD_BODY int spa_pod_body_get_pointer(const struct spa_pod *pod, const void *body,
274 uint32_t *type, const void **value)
275{
276 struct spa_pod_pointer_body b;
277 if (!spa_pod_is_pointer(pod))
278 return -EINVAL;
279 SPA_POD_BODY_LOAD_FIELD_ONCE(&b, body, type);
280 SPA_POD_BODY_LOAD_FIELD_ONCE(&b, body, value);
281 *type = b.type;
282 *value = b.value;
283 return 0;
284}
285
286 SPA_API_POD_BODY int spa_pod_is_fd(const struct spa_pod *pod)
287{
288 return SPA_POD_CHECK(pod, SPA_TYPE_Fd, sizeof(int64_t));
289}
290
291 SPA_API_POD_BODY int spa_pod_body_get_fd(const struct spa_pod *pod, const void *body,
292 int64_t *value)
293{
294 if (!spa_pod_is_fd(pod))
295 return -EINVAL;
296 SPA_BARRIER;
297 memcpy(value, body, sizeof *value);
298 SPA_BARRIER;
299 return 0;
300}
301
302 SPA_API_POD_BODY int spa_pod_is_rectangle(const struct spa_pod *pod)
303{
304 return SPA_POD_CHECK(pod, SPA_TYPE_Rectangle, sizeof(struct spa_rectangle));
305}
306
307 SPA_API_POD_BODY int spa_pod_body_get_rectangle(const struct spa_pod *pod, const void *body,
308 struct spa_rectangle *value)
309{
310 if (!spa_pod_is_rectangle(pod))
311 return -EINVAL;
312 SPA_POD_BODY_LOAD_FIELD_ONCE(value, body, width);
313 SPA_POD_BODY_LOAD_FIELD_ONCE(value, body, height);
314 return 0;
315}
316
317 SPA_API_POD_BODY int spa_pod_is_fraction(const struct spa_pod *pod)
318{
319 return SPA_POD_CHECK(pod, SPA_TYPE_Fraction, sizeof(struct spa_fraction));
320}
321 SPA_API_POD_BODY int spa_pod_body_get_fraction(const struct spa_pod *pod, const void *body,
322 struct spa_fraction *value)
323{
324 if (!spa_pod_is_fraction(pod))
325 return -EINVAL;
326 SPA_POD_BODY_LOAD_FIELD_ONCE(value, body, num);
327 SPA_POD_BODY_LOAD_FIELD_ONCE(value, body, denom);
328 return 0;
329}
330
331 SPA_API_POD_BODY int spa_pod_is_bitmap(const struct spa_pod *pod)
332{
333 return SPA_POD_CHECK(pod, SPA_TYPE_Bitmap, sizeof(uint8_t));
334}
335 SPA_API_POD_BODY int spa_pod_body_get_bitmap(const struct spa_pod *pod, const void *body,
336 const uint8_t **value)
337{
338 if (!spa_pod_is_bitmap(pod))
339 return -EINVAL;
340 *value = (const uint8_t *)body;
341 return 0;
342}
343
344 SPA_API_POD_BODY int spa_pod_is_array(const struct spa_pod *pod)
345{
346 return SPA_POD_CHECK(pod, SPA_TYPE_Array, sizeof(struct spa_pod_array_body));
347}
348 SPA_API_POD_BODY int spa_pod_body_get_array(const struct spa_pod *pod, const void *body,
349 struct spa_pod_array *arr, const void **arr_body)
350{
351 if (!spa_pod_is_array(pod))
352 return -EINVAL;
353 arr->pod = *pod;
354 SPA_POD_BODY_LOAD_FIELD_ONCE(&arr->body.child, body, type);
355 SPA_POD_BODY_LOAD_FIELD_ONCE(&arr->body.child, body, size);
356 *arr_body = SPA_PTROFF(body, sizeof(struct spa_pod_array_body), void);
357 return 0;
358}
359 SPA_API_POD_BODY const void *spa_pod_array_body_get_values(const struct spa_pod_array *arr,
360 const void *body, uint32_t *n_values, uint32_t *val_size, uint32_t *val_type)
361{
362 uint32_t child_size = arr->body.child.size;
363 *n_values = child_size ? (arr->pod.size - sizeof(arr->body)) / child_size : 0;
364 *val_size = child_size;
365 *val_type = arr->body.child.type;
366 if (*val_size < spa_pod_type_size(*val_type))
367 *n_values = 0;
368 return body;
369}
370
371 SPA_API_POD_BODY const void *spa_pod_body_get_array_values(const struct spa_pod *pod,
372 const void *body, uint32_t *n_values, uint32_t *val_size, uint32_t *val_type)
373{
374 struct spa_pod_array arr;
375 if (spa_pod_body_get_array(pod, body, &arr, &body) < 0)
376 return NULL;
377 return spa_pod_array_body_get_values(&arr, body, n_values, val_size, val_type);
378}
379
380 SPA_API_POD_BODY int spa_pod_is_choice(const struct spa_pod *pod)
381{
382 return SPA_POD_CHECK(pod, SPA_TYPE_Choice, sizeof(struct spa_pod_choice_body));
383}
384 SPA_API_POD_BODY int spa_pod_body_get_choice(const struct spa_pod *pod, const void *body,
385 struct spa_pod_choice *choice, const void **choice_body)
386{
387 if (!spa_pod_is_choice(pod))
388 return -EINVAL;
389 choice->pod = *pod;
390 SPA_POD_BODY_LOAD_FIELD_ONCE(&choice->body, body, type);
391 SPA_POD_BODY_LOAD_FIELD_ONCE(&choice->body, body, flags);
392 SPA_POD_BODY_LOAD_FIELD_ONCE(&choice->body, body, child.size);
393 SPA_POD_BODY_LOAD_FIELD_ONCE(&choice->body, body, child.type);
394 *choice_body = SPA_PTROFF(body, sizeof(struct spa_pod_choice_body), void);
395 return 0;
396}
397 SPA_API_POD_BODY const void *spa_pod_choice_body_get_values(const struct spa_pod_choice *pod,
398 const void *body, uint32_t *n_values, uint32_t *choice,
399 uint32_t *val_size, uint32_t *val_type)
400{
401 uint32_t child_size = pod->body.child.size, min, max;
402 *val_size = child_size;
403 *val_type = pod->body.child.type;
404 *n_values = child_size ? (pod->pod.size - sizeof(pod->body)) / child_size : 0;
405 *choice = pod->body.type;
406 spa_pod_choice_n_values(*choice, &min, &max);
407 if (*n_values < min || *val_size < spa_pod_type_size(*val_type))
408 *n_values = 0;
409 else if (*n_values > max)
410 *n_values = max;
411 return body;
412}
413
414 SPA_API_POD_BODY int spa_pod_is_struct(const struct spa_pod *pod)
415{
416 return SPA_POD_CHECK_TYPE(pod, SPA_TYPE_Struct);
417}
418
419 SPA_API_POD_BODY int spa_pod_is_object(const struct spa_pod *pod)
420{
421 return SPA_POD_CHECK(pod, SPA_TYPE_Object, sizeof(struct spa_pod_object_body));
422}
423 SPA_API_POD_BODY int spa_pod_body_get_object(const struct spa_pod *pod, const void *body,
424 struct spa_pod_object *object, const void **object_body)
425{
426 if (!spa_pod_is_object(pod))
427 return -EINVAL;
428 object->pod = *pod;
429 SPA_POD_BODY_LOAD_FIELD_ONCE(&object->body, body, type);
430 SPA_POD_BODY_LOAD_FIELD_ONCE(&object->body, body, id);
431 *object_body = SPA_PTROFF(body, sizeof(struct spa_pod_object_body), void);
432 return 0;
433}
434
435 SPA_API_POD_BODY int spa_pod_is_sequence(const struct spa_pod *pod)
436{
437 return SPA_POD_CHECK(pod, SPA_TYPE_Sequence, sizeof(struct spa_pod_sequence_body));
438}
439 SPA_API_POD_BODY int spa_pod_body_get_sequence(const struct spa_pod *pod, const void *body,
440 struct spa_pod_sequence *seq, const void **seq_body)
441{
442 if (!spa_pod_is_sequence(pod))
443 return -EINVAL;
444 seq->pod = *pod;
445 SPA_POD_BODY_LOAD_FIELD_ONCE(&seq->body, body, unit);
446 SPA_POD_BODY_LOAD_FIELD_ONCE(&seq->body, body, pad);
447 *seq_body = SPA_PTROFF(body, sizeof(struct spa_pod_sequence_body), void);
448 return 0;
449}
450
454
455#ifdef __cplusplus
456} /* extern "C" */
457#endif
458
459#endif /* SPA_POD_BODY_H */
SPA_API_POD_BODY
#define SPA_API_POD_BODY
Definition body.h:29
seq
uint32_t int seq
Definition core.h:432
spa_pod_is_sequence
SPA_API_POD_BODY int spa_pod_is_sequence(const struct spa_pod *pod)
Definition body.h:444
spa_pod_is_pointer
SPA_API_POD_BODY int spa_pod_is_pointer(const struct spa_pod *pod)
Definition body.h:277
spa_pod_is_bitmap
SPA_API_POD_BODY int spa_pod_is_bitmap(const struct spa_pod *pod)
Definition body.h:340
SPA_POD_IS_VALID
#define SPA_POD_IS_VALID(pod)
Definition pod.h:48
spa_pod_is_fraction
SPA_API_POD_BODY int spa_pod_is_fraction(const struct spa_pod *pod)
Definition body.h:326
spa_pod_body_get_pointer
SPA_API_POD_BODY int spa_pod_body_get_pointer(const struct spa_pod *pod, const void *body, uint32_t *type, const void **value)
Definition body.h:282
spa_pod_is_double
SPA_API_POD_BODY int spa_pod_is_double(const struct spa_pod *pod)
Definition body.h:216
spa_pod_body_get_array_values
SPA_API_POD_BODY const void * spa_pod_body_get_array_values(const struct spa_pod *pod, const void *body, uint32_t *n_values, uint32_t *val_size, uint32_t *val_type)
Definition body.h:380
spa_pod_body_get_sequence
SPA_API_POD_BODY int spa_pod_body_get_sequence(const struct spa_pod *pod, const void *body, struct spa_pod_sequence *seq, const void **seq_body)
Definition body.h:448
spa_pod_body_get_string
SPA_API_POD_BODY int spa_pod_body_get_string(const struct spa_pod *pod, const void *body, const char **value)
Definition body.h:236
spa_pod_is_array
SPA_API_POD_BODY int spa_pod_is_array(const struct spa_pod *pod)
Definition body.h:353
spa_pod_is_rectangle
SPA_API_POD_BODY int spa_pod_is_rectangle(const struct spa_pod *pod)
Definition body.h:311
spa_pod_is_struct
SPA_API_POD_BODY int spa_pod_is_struct(const struct spa_pod *pod)
Definition body.h:423
spa_pod_is_int
SPA_API_POD_BODY int spa_pod_is_int(const struct spa_pod *pod)
Definition body.h:172
spa_pod_is_fd
SPA_API_POD_BODY int spa_pod_is_fd(const struct spa_pod *pod)
Definition body.h:295
spa_pod_body_get_fraction
SPA_API_POD_BODY int spa_pod_body_get_fraction(const struct spa_pod *pod, const void *body, struct spa_fraction *value)
Definition body.h:330
spa_pod_is_none
SPA_API_POD_BODY int spa_pod_is_none(const struct spa_pod *pod)
Definition body.h:136
spa_pod_choice_n_values
SPA_API_POD_BODY int spa_pod_choice_n_values(uint32_t choice_type, uint32_t *min, uint32_t *max)
Definition body.h:88
spa_pod_is_object
SPA_API_POD_BODY int spa_pod_is_object(const struct spa_pod *pod)
Definition body.h:428
spa_pod_array_body_get_values
SPA_API_POD_BODY const void * spa_pod_array_body_get_values(const struct spa_pod_array *arr, const void *body, uint32_t *n_values, uint32_t *val_size, uint32_t *val_type)
Definition body.h:368
spa_pod_is_bool
SPA_API_POD_BODY int spa_pod_is_bool(const struct spa_pod *pod)
Definition body.h:141
SPA_POD_CHECK_TYPE
#define SPA_POD_CHECK_TYPE(pod, _type)
Definition pod.h:50
spa_pod_is_id
SPA_API_POD_BODY int spa_pod_is_id(const struct spa_pod *pod)
Definition body.h:159
spa_pod_type_size
SPA_API_POD_BODY uint32_t spa_pod_type_size(uint32_t type)
Definition body.h:45
SPA_POD_BODY_LOAD_FIELD_ONCE
#define SPA_POD_BODY_LOAD_FIELD_ONCE(a, b, field)
Definition body.h:149
spa_pod_body_get_array
SPA_API_POD_BODY int spa_pod_body_get_array(const struct spa_pod *pod, const void *body, struct spa_pod_array *arr, const void **arr_body)
Definition body.h:357
spa_pod_body_get_double
SPA_API_POD_BODY int spa_pod_body_get_double(const struct spa_pod *pod, const void *body, double *value)
Definition body.h:221
spa_pod_body_copy_string
SPA_API_POD_BODY int spa_pod_body_copy_string(const struct spa_pod *pod, const void *body, char *dest, size_t maxlen)
Definition body.h:249
spa_pod_body_get_long
SPA_API_POD_BODY int spa_pod_body_get_long(const struct spa_pod *pod, const void *body, int64_t *value)
Definition body.h:190
spa_pod_body_get_object
SPA_API_POD_BODY int spa_pod_body_get_object(const struct spa_pod *pod, const void *body, struct spa_pod_object *object, const void **object_body)
Definition body.h:432
spa_pod_choice_body_get_values
SPA_API_POD_BODY const void * spa_pod_choice_body_get_values(const struct spa_pod_choice *pod, const void *body, uint32_t *n_values, uint32_t *choice, uint32_t *val_size, uint32_t *val_type)
Definition body.h:406
spa_pod_is_bytes
SPA_API_POD_BODY int spa_pod_is_bytes(const struct spa_pod *pod)
Definition body.h:262
spa_pod_body_get_int
SPA_API_POD_BODY int spa_pod_body_get_int(const struct spa_pod *pod, const void *body, int32_t *value)
Definition body.h:177
spa_pod_is_string
SPA_API_POD_BODY int spa_pod_is_string(const struct spa_pod *pod)
Definition body.h:231
SPA_POD_BODY_LOAD_ONCE
#define SPA_POD_BODY_LOAD_ONCE(a, b)
Definition body.h:147
spa_pod_body_get_float
SPA_API_POD_BODY int spa_pod_body_get_float(const struct spa_pod *pod, const void *body, float *value)
Definition body.h:206
spa_pod_body_get_rectangle
SPA_API_POD_BODY int spa_pod_body_get_rectangle(const struct spa_pod *pod, const void *body, struct spa_rectangle *value)
Definition body.h:316
spa_pod_body_get_bool
SPA_API_POD_BODY int spa_pod_body_get_bool(const struct spa_pod *pod, const void *body, bool *value)
Definition body.h:151
spa_pod_body_get_bitmap
SPA_API_POD_BODY int spa_pod_body_get_bitmap(const struct spa_pod *pod, const void *body, const uint8_t **value)
Definition body.h:344
spa_pod_body_from_data
SPA_API_POD_BODY int spa_pod_body_from_data(void *data, size_t maxsize, off_t offset, size_t size, struct spa_pod *pod, const void **body)
Definition body.h:118
spa_pod_body_get_choice
SPA_API_POD_BODY int spa_pod_body_get_choice(const struct spa_pod *pod, const void *body, struct spa_pod_choice *choice, const void **choice_body)
Definition body.h:393
spa_pod_body_get_fd
SPA_API_POD_BODY int spa_pod_body_get_fd(const struct spa_pod *pod, const void *body, int64_t *value)
Definition body.h:300
spa_pod_is_choice
SPA_API_POD_BODY int spa_pod_is_choice(const struct spa_pod *pod)
Definition body.h:389
spa_pod_body_get_id
SPA_API_POD_BODY int spa_pod_body_get_id(const struct spa_pod *pod, const void *body, uint32_t *value)
Definition body.h:164
spa_pod_is_float
SPA_API_POD_BODY int spa_pod_is_float(const struct spa_pod *pod)
Definition body.h:201
spa_pod_body_get_bytes
SPA_API_POD_BODY int spa_pod_body_get_bytes(const struct spa_pod *pod, const void *body, const void **value, uint32_t *len)
Definition body.h:267
SPA_POD_CHECK
#define SPA_POD_CHECK(pod, _type, _size)
Definition pod.h:53
spa_pod_is_long
SPA_API_POD_BODY int spa_pod_is_long(const struct spa_pod *pod)
Definition body.h:185
SPA_CHOICE_Step
@ SPA_CHOICE_Step
range with step: default, min, max, step
Definition pod.h:163
SPA_CHOICE_None
@ SPA_CHOICE_None
no choice, first value is current
Definition pod.h:161
SPA_CHOICE_Flags
@ SPA_CHOICE_Flags
flags: first value is flags
Definition pod.h:165
SPA_CHOICE_Range
@ SPA_CHOICE_Range
range: default, min, max
Definition pod.h:162
SPA_CHOICE_Enum
@ SPA_CHOICE_Enum
list: default, alternative,...
Definition pod.h:164
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_Pod
@ SPA_TYPE_Pod
Definition type.h:61
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_BARRIER
#define SPA_BARRIER
Definition defs.h:315
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:135
spa_pod_array_body::child
struct spa_pod child
Definition pod.h:136
spa_pod_array
Definition pod.h:140
spa_pod_array::pod
struct spa_pod pod
Definition pod.h:141
spa_pod_array::body
struct spa_pod_array_body body
Definition pod.h:142
spa_pod_choice_body
Definition pod.h:168
spa_pod_choice_body::type
uint32_t type
type of choice, one of enum spa_choice_type
Definition pod.h:169
spa_pod_choice
Definition pod.h:176
spa_pod_choice::body
struct spa_pod_choice_body body
Definition pod.h:178
spa_pod_choice::pod
struct spa_pod pod
Definition pod.h:177
spa_pod_frame
Definition body.h:38
spa_pod_frame::pod
struct spa_pod pod
Definition body.h:39
spa_pod_frame::offset
uint32_t offset
Definition body.h:41
spa_pod_frame::parent
struct spa_pod_frame * parent
Definition body.h:40
spa_pod_frame::flags
uint32_t flags
Definition body.h:42
spa_pod_object_body
Definition pod.h:196
spa_pod_object
Definition pod.h:202
spa_pod_pointer_body
Definition pod.h:207
spa_pod_pointer_body::value
const void * value
Definition pod.h:210
spa_pod_pointer_body::type
uint32_t type
pointer id, one of enum spa_type
Definition pod.h:208
spa_pod_sequence_body
Definition pod.h:264
spa_pod_sequence
a sequence of timed controls
Definition pod.h:271
spa_pod
Definition pod.h:57
spa_pod::type
uint32_t type
Definition pod.h:59
spa_pod::size
uint32_t size
Definition pod.h:58
spa_rectangle
Definition defs.h:116