PipeWire 1.6.8

Loading...
Searching...
No Matches
vararg.h
Go to the documentation of this file.
1/* Simple Plugin API */
2/* SPDX-FileCopyrightText: Copyright © 2019 Wim Taymans */
3/* SPDX-License-Identifier: MIT */
4
5#ifndef SPA_POD_VARARG_H
6#define SPA_POD_VARARG_H
7
8#include <stdarg.h>
9
10#include <spa/pod/pod.h>
11
12#ifdef __cplusplus
13 extern "C" {
14#endif
15
20
21#define SPA_POD_Prop(key,...) \
22 key, ##__VA_ARGS__
23#define SPA_POD_Propf(key,flags,...) \
24 SPA_ID_INVALID, key, flags, ##__VA_ARGS__
25
26#define SPA_POD_Control(offset,type,...) \
27 offset, type, ##__VA_ARGS__
28
29#define SPA_CHOICE_RANGE(def,min,max) 3,(def),(min),(max)
30#define SPA_CHOICE_STEP(def,min,max,step) 4,(def),(min),(max),(step)
31#define SPA_CHOICE_ENUM(n_vals,def,alt1,...) (n_vals),(def),(alt1),##__VA_ARGS__
32#define SPA_CHOICE_FLAGS(flags) 1, (flags)
33#define SPA_CHOICE_FEATURES(features) 1, (features)
34#define SPA_CHOICE_BOOL(def) 3,(def),(def),!(def)
35
36#define SPA_POD_Bool(val) "b", val
37#define SPA_POD_CHOICE_Bool(def) "?eb", SPA_CHOICE_BOOL(def)
38
39#define SPA_POD_Id(val) "I", val
40#define SPA_POD_CHOICE_ENUM_Id(n_vals,...) "?eI", SPA_CHOICE_ENUM(n_vals, __VA_ARGS__)
41
42#define SPA_POD_Int(val) "i", val
43#define SPA_POD_CHOICE_ENUM_Int(n_vals,...) "?ei", SPA_CHOICE_ENUM(n_vals, __VA_ARGS__)
44#define SPA_POD_CHOICE_RANGE_Int(def,min,max) "?ri", SPA_CHOICE_RANGE(def, min, max)
45#define SPA_POD_CHOICE_STEP_Int(def,min,max,step) "?si", SPA_CHOICE_STEP(def, min, max, step)
46#define SPA_POD_CHOICE_FLAGS_Int(flags) "?fi", SPA_CHOICE_FLAGS(flags)
47#define SPA_POD_CHOICE_FEATURES_Int(features) "?Fi", SPA_CHOICE_FEATURES(features)
48
49#define SPA_POD_Long(val) "l", val
50#define SPA_POD_CHOICE_ENUM_Long(n_vals,...) "?el", SPA_CHOICE_ENUM(n_vals, __VA_ARGS__)
51#define SPA_POD_CHOICE_RANGE_Long(def,min,max) "?rl", SPA_CHOICE_RANGE(def, min, max)
52#define SPA_POD_CHOICE_STEP_Long(def,min,max,step) "?sl", SPA_CHOICE_STEP(def, min, max, step)
53#define SPA_POD_CHOICE_FLAGS_Long(flags) "?fl", SPA_CHOICE_FLAGS(flags)
54#define SPA_POD_CHOICE_FEATURES_LONG(features) "?Fl", SPA_CHOICE_FEATURES(features)
55
56#define SPA_POD_Float(val) "f", val
57#define SPA_POD_CHOICE_ENUM_Float(n_vals,...) "?ef", SPA_CHOICE_ENUM(n_vals, __VA_ARGS__)
58#define SPA_POD_CHOICE_RANGE_Float(def,min,max) "?rf", SPA_CHOICE_RANGE(def, min, max)
59#define SPA_POD_CHOICE_STEP_Float(def,min,max,step) "?sf", SPA_CHOICE_STEP(def, min, max, step)
60
61#define SPA_POD_Double(val) "d", val
62#define SPA_POD_CHOICE_ENUM_Double(n_vals,...) "?ed", SPA_CHOICE_ENUM(n_vals, __VA_ARGS__)
63#define SPA_POD_CHOICE_RANGE_Double(def,min,max) "?rd", SPA_CHOICE_RANGE(def, min, max)
64#define SPA_POD_CHOICE_STEP_Double(def,min,max,step) "?sd", SPA_CHOICE_STEP(def, min, max, step)
65
66#define SPA_POD_String(val) "s",val
67#define SPA_POD_Stringn(val,len) "S",val,len
68
69#define SPA_POD_Bytes(val,len) "y",val,len
70
71#define SPA_POD_Rectangle(val) "R",val
72#define SPA_POD_CHOICE_ENUM_Rectangle(n_vals,...) "?eR", SPA_CHOICE_ENUM(n_vals, __VA_ARGS__)
73#define SPA_POD_CHOICE_RANGE_Rectangle(def,min,max) "?rR", SPA_CHOICE_RANGE((def),(min),(max))
74#define SPA_POD_CHOICE_STEP_Rectangle(def,min,max,step) "?sR", SPA_CHOICE_STEP((def),(min),(max),(step))
75
76#define SPA_POD_Fraction(val) "F",val
77#define SPA_POD_CHOICE_ENUM_Fraction(n_vals,...) "?eF", SPA_CHOICE_ENUM(n_vals, __VA_ARGS__)
78#define SPA_POD_CHOICE_RANGE_Fraction(def,min,max) "?rF", SPA_CHOICE_RANGE((def),(min),(max))
79#define SPA_POD_CHOICE_STEP_Fraction(def,min,max,step) "?sF", SPA_CHOICE_STEP(def, min, max, step)
80
81#define SPA_POD_Array(csize,ctype,n_vals,vals) "a", csize,ctype,n_vals,vals
82#define SPA_POD_Pointer(type,val) "p", type,val
83#define SPA_POD_Fd(val) "h", val
84#define SPA_POD_None() "P", NULL
85#define SPA_POD_Pod(val) "P", val
86#define SPA_POD_PodObject(val) "O", val
87#define SPA_POD_PodStruct(val) "T", val
88#define SPA_POD_PodChoice(val) "V", val
89
90#define SPA_POD_PodBody(val,body) "Q", val, body
91#define SPA_POD_PodBodyObject(val,body) "N", val, body
92#define SPA_POD_PodBodyStruct(val,body) "U", val, body
93#define SPA_POD_PodBodyChoice(val,body) "W", val, body
94
95
99
100#ifdef __cplusplus
101} /* extern "C" */
102#endif
103
104#endif /* SPA_POD_VARARG_H */
pod.h
spa/pod/pod.h