PipeWire 1.1.0
Loading...
Searching...
No Matches
pod.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_H
6#define SPA_POD_H
7
8#ifdef __cplusplus
9extern "C" {
10#endif
11
12#include <spa/utils/defs.h>
13#include <spa/utils/type.h>
14
20#define SPA_POD_BODY_SIZE(pod) (((struct spa_pod*)(pod))->size)
21#define SPA_POD_TYPE(pod) (((struct spa_pod*)(pod))->type)
22#define SPA_POD_SIZE(pod) ((uint64_t)sizeof(struct spa_pod) + SPA_POD_BODY_SIZE(pod))
23#define SPA_POD_CONTENTS_SIZE(type,pod) (SPA_POD_SIZE(pod)-sizeof(type))
24
25#define SPA_POD_CONTENTS(type,pod) SPA_PTROFF((pod),sizeof(type),void)
26#define SPA_POD_CONTENTS_CONST(type,pod) SPA_PTROFF((pod),sizeof(type),const void)
27#define SPA_POD_BODY(pod) SPA_PTROFF((pod),sizeof(struct spa_pod),void)
28#define SPA_POD_BODY_CONST(pod) SPA_PTROFF((pod),sizeof(struct spa_pod),const void)
29
30struct spa_pod {
31 uint32_t size; /* size of the body */
32 uint32_t type; /* a basic id of enum spa_type */
33};
34
35#define SPA_POD_VALUE(type,pod) (((type*)(pod))->value)
36
38 struct spa_pod pod;
39 int32_t value;
40 int32_t _padding;
41};
42
43struct spa_pod_id {
44 struct spa_pod pod;
45 uint32_t value;
46 int32_t _padding;
47};
48
50 struct spa_pod pod;
51 int32_t value;
52 int32_t _padding;
53};
55struct spa_pod_long {
56 struct spa_pod pod;
57 int64_t value;
58};
61 struct spa_pod pod;
62 float value;
63 int32_t _padding;
64};
67 struct spa_pod pod;
68 double value;
69};
72 struct spa_pod pod;
73 /* value here */
74};
77 struct spa_pod pod;
78 /* value here */
79};
82 struct spa_pod pod;
83 struct spa_rectangle value;
84};
87 struct spa_pod pod;
88 struct spa_fraction value;
89};
92 struct spa_pod pod;
93 /* array of uint8_t follows with the bitmap */
94};
96#define SPA_POD_ARRAY_CHILD(arr) (&((struct spa_pod_array*)(arr))->body.child)
97#define SPA_POD_ARRAY_VALUE_TYPE(arr) (SPA_POD_TYPE(SPA_POD_ARRAY_CHILD(arr)))
98#define SPA_POD_ARRAY_VALUE_SIZE(arr) (SPA_POD_BODY_SIZE(SPA_POD_ARRAY_CHILD(arr)))
99#define SPA_POD_ARRAY_N_VALUES(arr) (SPA_POD_ARRAY_VALUE_SIZE(arr) ? ((SPA_POD_BODY_SIZE(arr) - sizeof(struct spa_pod_array_body)) / SPA_POD_ARRAY_VALUE_SIZE(arr)) : 0)
100#define SPA_POD_ARRAY_VALUES(arr) SPA_POD_CONTENTS(struct spa_pod_array, arr)
103 struct spa_pod child;
104 /* array with elements of child.size follows */
107struct spa_pod_array {
108 struct spa_pod pod;
110};
112#define SPA_POD_CHOICE_CHILD(choice) (&((struct spa_pod_choice*)(choice))->body.child)
113#define SPA_POD_CHOICE_TYPE(choice) (((struct spa_pod_choice*)(choice))->body.type)
114#define SPA_POD_CHOICE_FLAGS(choice) (((struct spa_pod_choice*)(choice))->body.flags)
115#define SPA_POD_CHOICE_VALUE_TYPE(choice) (SPA_POD_TYPE(SPA_POD_CHOICE_CHILD(choice)))
116#define SPA_POD_CHOICE_VALUE_SIZE(choice) (SPA_POD_BODY_SIZE(SPA_POD_CHOICE_CHILD(choice)))
117#define SPA_POD_CHOICE_N_VALUES(choice) (SPA_POD_CHOICE_VALUE_SIZE(choice) ? ((SPA_POD_BODY_SIZE(choice) - sizeof(struct spa_pod_choice_body)) / SPA_POD_CHOICE_VALUE_SIZE(choice)) : 0)
118#define SPA_POD_CHOICE_VALUES(choice) (SPA_POD_CONTENTS(struct spa_pod_choice, choice))
120enum spa_choice_type {
129 uint32_t type;
130 uint32_t flags;
131 struct spa_pod child;
132 /* array with elements of child.size follows. Note that there might be more
133 * elements than required by \a type, which should be ignored. */
135
137 struct spa_pod pod;
139};
141struct spa_pod_struct {
142 struct spa_pod pod;
143 /* one or more spa_pod follow */
145
146#define SPA_POD_OBJECT_TYPE(obj) (((struct spa_pod_object*)(obj))->body.type)
147#define SPA_POD_OBJECT_ID(obj) (((struct spa_pod_object*)(obj))->body.id)
150 uint32_t type;
151 uint32_t id;
152 /* contents follow, series of spa_pod_prop */
153};
156 struct spa_pod pod;
158};
159
161 uint32_t type;
162 uint32_t _padding;
163 const void *value;
165
166struct spa_pod_pointer {
167 struct spa_pod pod;
169};
170
171struct spa_pod_fd {
172 struct spa_pod pod;
173 int64_t value;
174};
176#define SPA_POD_PROP_SIZE(prop) (sizeof(struct spa_pod_prop) + (prop)->value.size)
178/* props can be inside an object */
180 uint32_t key;
182#define SPA_POD_PROP_FLAG_READONLY (1u<<0)
183#define SPA_POD_PROP_FLAG_HARDWARE (1u<<1)
184#define SPA_POD_PROP_FLAG_HINT_DICT (1u<<2)
189#define SPA_POD_PROP_FLAG_MANDATORY (1u<<3)
190#define SPA_POD_PROP_FLAG_DONT_FIXATE (1u<<4)
191 uint32_t flags;
192 struct spa_pod value;
193 /* value follows */
196#define SPA_POD_CONTROL_SIZE(ev) (sizeof(struct spa_pod_control) + (ev)->value.size)
197
198/* controls can be inside a sequence and mark timed values */
200 uint32_t offset;
201 uint32_t type;
202 struct spa_pod value;
203 /* value contents follow */
204};
207 uint32_t unit;
208 uint32_t pad;
209 /* series of struct spa_pod_control follows */
210};
211
213struct spa_pod_sequence {
214 struct spa_pod pod;
216};
217
222#ifdef __cplusplus
223} /* extern "C" */
224#endif
226#endif /* SPA_POD_H */
spa/utils/defs.h
spa_choice_type
Definition pod.h:146
@ SPA_CHOICE_Step
range with step: default, min, max, step
Definition pod.h:149
@ SPA_CHOICE_None
no choice, first value is current
Definition pod.h:147
@ SPA_CHOICE_Flags
flags: default, possible flags,...
Definition pod.h:151
@ SPA_CHOICE_Range
range: default, min, max
Definition pod.h:148
@ SPA_CHOICE_Enum
list: default, alternative,...
Definition pod.h:150
spa/utils/type.h
Definition defs.h:137
Definition pod.h:121
struct spa_pod child
Definition pod.h:122
Definition pod.h:126
struct spa_pod pod
Definition pod.h:127
struct spa_pod_array_body body
Definition pod.h:128
Definition pod.h:105
struct spa_pod pod
Definition pod.h:106
Definition pod.h:51
int32_t _padding
Definition pod.h:54
int32_t value
Definition pod.h:53
struct spa_pod pod
Definition pod.h:52
Definition pod.h:90
struct spa_pod pod
Definition pod.h:91
Definition pod.h:154
struct spa_pod child
Definition pod.h:157
uint32_t type
type of choice, one of enum spa_choice_type
Definition pod.h:155
uint32_t flags
extra flags
Definition pod.h:156
Definition pod.h:162
struct spa_pod_choice_body body
Definition pod.h:164
struct spa_pod pod
Definition pod.h:163
Definition pod.h:234
struct spa_pod value
control value, depends on type
Definition pod.h:237
uint32_t type
type of control, enum spa_control_type
Definition pod.h:236
uint32_t offset
media offset
Definition pod.h:235
Definition pod.h:80
double value
Definition pod.h:82
struct spa_pod pod
Definition pod.h:81
Definition pod.h:199
int64_t value
Definition pod.h:201
struct spa_pod pod
Definition pod.h:200
Definition pod.h:74
int32_t _padding
Definition pod.h:77
struct spa_pod pod
Definition pod.h:75
float value
Definition pod.h:76
Definition pod.h:100
struct spa_fraction value
Definition pod.h:102
struct spa_pod pod
Definition pod.h:101
Definition pod.h:57
uint32_t value
Definition pod.h:59
int32_t _padding
Definition pod.h:60
struct spa_pod pod
Definition pod.h:58
Definition pod.h:63
struct spa_pod pod
Definition pod.h:64
int32_t _padding
Definition pod.h:66
int32_t value
Definition pod.h:65
Definition pod.h:69
int64_t value
Definition pod.h:71
struct spa_pod pod
Definition pod.h:70
Definition pod.h:177
uint32_t type
one of enum spa_type
Definition pod.h:178
uint32_t id
id of the object, depends on the object type
Definition pod.h:179
Definition pod.h:183
struct spa_pod pod
Definition pod.h:184
struct spa_pod_object_body body
Definition pod.h:185
Definition pod.h:188
const void * value
Definition pod.h:191
uint32_t _padding
Definition pod.h:190
uint32_t type
pointer id, one of enum spa_type
Definition pod.h:189
Definition pod.h:194
struct spa_pod_pointer_body body
Definition pod.h:196
struct spa_pod pod
Definition pod.h:195
Definition pod.h:208
uint32_t key
key of property, list of valid keys depends on the object type
Definition pod.h:209
uint32_t flags
flags for property
Definition pod.h:225
struct spa_pod value
Definition pod.h:226
Definition pod.h:95
struct spa_pod pod
Definition pod.h:96
struct spa_rectangle value
Definition pod.h:97
Definition pod.h:241
uint32_t pad
Definition pod.h:243
uint32_t unit
Definition pod.h:242
a sequence of timed controls
Definition pod.h:248
struct spa_pod pod
Definition pod.h:249
struct spa_pod_sequence_body body
Definition pod.h:250
Definition pod.h:85
struct spa_pod pod
Definition pod.h:86
Definition pod.h:167
struct spa_pod pod
Definition pod.h:168
Definition pod.h:43
uint32_t type
Definition pod.h:45
uint32_t size
Definition pod.h:44
Definition defs.h:116