PipeWire 1.4.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#ifdef __cplusplus
9 extern "C" {
10#endif
11
12#include <stdarg.h>
13
14#include <spa/pod/pod.h>
15
20
21#define SPA_POD_Prop(key,...) \
22 key, ##__VA_ARGS__
23
24#define SPA_POD_Control(offset,type,...) \
25 offset, type, ##__VA_ARGS__
26
27#define SPA_CHOICE_RANGE(def,min,max) 3,(def),(min),(max)
28#define SPA_CHOICE_STEP(def,min,max,step) 4,(def),(min),(max),(step)
29#define SPA_CHOICE_ENUM(n_vals,...) (n_vals),##__VA_ARGS__
30#define SPA_CHOICE_FLAGS(flags) 1, (flags)
31#define SPA_CHOICE_BOOL(def) 3,(def),(def),!(def)
32
33#define SPA_POD_Bool(val) "b", val
34#define SPA_POD_CHOICE_Bool(def) "?eb", SPA_CHOICE_BOOL(def)
35
36#define SPA_POD_Id(val) "I", val
37#define SPA_POD_CHOICE_ENUM_Id(n_vals,...) "?eI", SPA_CHOICE_ENUM(n_vals, __VA_ARGS__)
38
39#define SPA_POD_Int(val) "i", val
40#define SPA_POD_CHOICE_ENUM_Int(n_vals,...) "?ei", SPA_CHOICE_ENUM(n_vals, __VA_ARGS__)
41#define SPA_POD_CHOICE_RANGE_Int(def,min,max) "?ri", SPA_CHOICE_RANGE(def, min, max)
42#define SPA_POD_CHOICE_STEP_Int(def,min,max,step) "?si", SPA_CHOICE_STEP(def, min, max, step)
43#define SPA_POD_CHOICE_FLAGS_Int(flags) "?fi", SPA_CHOICE_FLAGS(flags)
44
45#define SPA_POD_Long(val) "l", val
46#define SPA_POD_CHOICE_ENUM_Long(n_vals,...) "?el", SPA_CHOICE_ENUM(n_vals, __VA_ARGS__)
47#define SPA_POD_CHOICE_RANGE_Long(def,min,max) "?rl", SPA_CHOICE_RANGE(def, min, max)
48#define SPA_POD_CHOICE_STEP_Long(def,min,max,step) "?sl", SPA_CHOICE_STEP(def, min, max, step)
49#define SPA_POD_CHOICE_FLAGS_Long(flags) "?fl", SPA_CHOICE_FLAGS(flags)
50
51#define SPA_POD_Float(val) "f", val
52#define SPA_POD_CHOICE_ENUM_Float(n_vals,...) "?ef", SPA_CHOICE_ENUM(n_vals, __VA_ARGS__)
53#define SPA_POD_CHOICE_RANGE_Float(def,min,max) "?rf", SPA_CHOICE_RANGE(def, min, max)
54#define SPA_POD_CHOICE_STEP_Float(def,min,max,step) "?sf", SPA_CHOICE_STEP(def, min, max, step)
55
56#define SPA_POD_Double(val) "d", val
57#define SPA_POD_CHOICE_ENUM_Double(n_vals,...) "?ed", SPA_CHOICE_ENUM(n_vals, __VA_ARGS__)
58#define SPA_POD_CHOICE_RANGE_Double(def,min,max) "?rd", SPA_CHOICE_RANGE(def, min, max)
59#define SPA_POD_CHOICE_STEP_Double(def,min,max,step) "?sd", SPA_CHOICE_STEP(def, min, max, step)
60
61#define SPA_POD_String(val) "s",val
62#define SPA_POD_Stringn(val,len) "S",val,len
63
64#define SPA_POD_Bytes(val,len) "y",val,len
65
66#define SPA_POD_Rectangle(val) "R",val
67#define SPA_POD_CHOICE_ENUM_Rectangle(n_vals,...) "?eR", SPA_CHOICE_ENUM(n_vals, __VA_ARGS__)
68#define SPA_POD_CHOICE_RANGE_Rectangle(def,min,max) "?rR", SPA_CHOICE_RANGE((def),(min),(max))
69#define SPA_POD_CHOICE_STEP_Rectangle(def,min,max,step) "?sR", SPA_CHOICE_STEP((def),(min),(max),(step))
70
71#define SPA_POD_Fraction(val) "F",val
72#define SPA_POD_CHOICE_ENUM_Fraction(n_vals,...) "?eF", SPA_CHOICE_ENUM(n_vals, __VA_ARGS__)
73#define SPA_POD_CHOICE_RANGE_Fraction(def,min,max) "?rF", SPA_CHOICE_RANGE((def),(min),(max))
74#define SPA_POD_CHOICE_STEP_Fraction(def,min,max,step) "?sF", SPA_CHOICE_STEP(def, min, max, step)
75
76#define SPA_POD_Array(csize,ctype,n_vals,vals) "a", csize,ctype,n_vals,vals
77#define SPA_POD_Pointer(type,val) "p", type,val
78#define SPA_POD_Fd(val) "h", val
79#define SPA_POD_None() "P", NULL
80#define SPA_POD_Pod(val) "P", val
81#define SPA_POD_PodObject(val) "O", val
82#define SPA_POD_PodStruct(val) "T", val
83#define SPA_POD_PodChoice(val) "V", val
84
88
89#ifdef __cplusplus
90} /* extern "C" */
91#endif
92
93#endif /* SPA_POD_VARARG_H */
pod.h
spa/pod/pod.h