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