PipeWire  0.3.33
defs.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_UTILS_DEFS_H
26 #define SPA_UTILS_DEFS_H
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #else
31 #include <stdbool.h>
32 #endif
33 #include <inttypes.h>
34 #include <signal.h>
35 #include <stdlib.h>
36 #include <string.h>
37 #include <stddef.h>
38 #include <stdio.h>
39 
63 #if defined(__clang__) && defined(__cplusplus) && __cplusplus >= 201103L
64  /* clang's fallthrough annotations are only available starting in C++11. */
65 # define SPA_FALLTHROUGH [[clang::fallthrough]];
66 #elif __GNUC__ >= 7 || __clang_major__ >= 10
67 # define SPA_FALLTHROUGH __attribute__ ((fallthrough));
68 #else
69 # define SPA_FALLTHROUGH /* FALLTHROUGH */
70 #endif
71 
72 #define SPA_FLAG_MASK(field,mask,flag) (((field) & (mask)) == (flag))
73 #define SPA_FLAG_IS_SET(field,flag) SPA_FLAG_MASK(field,flag,flag)
74 #define SPA_FLAG_SET(field,flag) ((field) |= (flag))
75 #define SPA_FLAG_CLEAR(field,flag) ((field) &= ~(flag))
76 #define SPA_FLAG_UPDATE(field,flag,val) ((val) ? SPA_FLAG_SET(field,flag) : SPA_FLAG_CLEAR(field,flag))
77 
81 };
82 
83 #define SPA_DIRECTION_REVERSE(d) ((d) ^ 1)
84 
85 #define SPA_RECTANGLE(width,height) (struct spa_rectangle){ width, height }
86 struct spa_rectangle {
87  uint32_t width;
88  uint32_t height;
89 };
90 
91 #define SPA_POINT(x,y) (struct spa_point){ x, y }
92 struct spa_point {
93  int32_t x;
94  int32_t y;
95 };
96 
97 #define SPA_REGION(x,y,width,height) (struct spa_region){ SPA_POINT(x,y), SPA_RECTANGLE(width,height) }
98 struct spa_region {
99  struct spa_point position;
100  struct spa_rectangle size;
101 };
102 
103 #define SPA_FRACTION(num,denom) (struct spa_fraction){ num, denom }
104 struct spa_fraction {
105  uint32_t num;
106  uint32_t denom;
107 };
108 
109 #define SPA_N_ELEMENTS(arr) (sizeof(arr) / sizeof((arr)[0]))
110 
120 #define SPA_FOR_EACH_ELEMENT(arr, ptr) \
121  for (ptr = arr; (void*)ptr < SPA_PTROFF(arr, sizeof(arr), void); ptr++)
122 
123 #define SPA_MIN(a,b) \
124 ({ \
125  __typeof__(a) _min_a = (a); \
126  __typeof__(b) _min_b = (b); \
127  SPA_LIKELY(_min_a < _min_b) ? _min_a : _min_b; \
128 })
129 #define SPA_MAX(a,b) \
130 ({ \
131  __typeof__(a) _max_a = (a); \
132  __typeof__(b) _max_b = (b); \
133  SPA_LIKELY(_max_a > _max_b) ? _max_a : _max_b; \
134 })
135 #define SPA_CLAMP(v,low,high) \
136 ({ \
137  __typeof__(v) _v = (v); \
138  __typeof__(low) _low = (low); \
139  __typeof__(high) _high = (high); \
140  SPA_MIN(SPA_MAX(_v, _low), _high); \
141 })
142 
143 #define SPA_SWAP(a,b) \
144 ({ \
145  __typeof__(a) _t = (a); \
146  a = b; b = _t; \
147 })
148 
149 #define SPA_TYPECHECK(type,x) \
150 ({ type _dummy; \
151  typeof(x) _dummy2; \
152  (void)(&_dummy == &_dummy2); \
153  x; \
154 })
155 
159 #define SPA_PTROFF(ptr_,offset_,type_) ((type_*)((uint8_t*)(ptr_) + (int)(offset_)))
160 #define SPA_PTROFF_ALIGN(ptr_,offset_,alignment_,type_) \
161  SPA_PTR_ALIGN(SPA_PTROFF(ptr_,offset_,type_),alignment_,type_)
162 
163 
167 #define SPA_MEMBER(b,o,t) SPA_PTROFF(b,o,t)
168 #define SPA_MEMBER_ALIGN(b,o,a,t) SPA_PTROFF_ALIGN(b,o,a,t)
169 
170 #define SPA_CONTAINER_OF(p,t,m) (t*)((uint8_t*)p - offsetof (t,m))
171 
172 #define SPA_PTRDIFF(p1,p2) ((uint8_t*)(p1) - (uint8_t*)(p2))
173 
174 #define SPA_PTR_TO_INT(p) ((int) ((intptr_t) (p)))
175 #define SPA_INT_TO_PTR(u) ((void*) ((intptr_t) (u)))
176 
177 #define SPA_PTR_TO_UINT32(p) ((uint32_t) ((uintptr_t) (p)))
178 #define SPA_UINT32_TO_PTR(u) ((void*) ((uintptr_t) (u)))
179 
180 #define SPA_TIME_INVALID ((int64_t)INT64_MIN)
181 #define SPA_IDX_INVALID ((unsigned int)-1)
182 #define SPA_ID_INVALID ((uint32_t)0xffffffff)
183 
184 #define SPA_NSEC_PER_SEC (1000000000ll)
185 #define SPA_NSEC_PER_MSEC (1000000ll)
186 #define SPA_NSEC_PER_USEC (1000ll)
187 #define SPA_USEC_PER_SEC (1000000ll)
188 #define SPA_USEC_PER_MSEC (1000ll)
189 #define SPA_MSEC_PER_SEC (1000ll)
190 
191 #define SPA_TIMESPEC_TO_NSEC(ts) ((ts)->tv_sec * SPA_NSEC_PER_SEC + (ts)->tv_nsec)
192 #define SPA_TIMESPEC_TO_USEC(ts) ((ts)->tv_sec * SPA_USEC_PER_SEC + (ts)->tv_nsec / SPA_NSEC_PER_USEC)
193 #define SPA_TIMEVAL_TO_NSEC(tv) ((tv)->tv_sec * SPA_NSEC_PER_SEC + (tv)->tv_usec * SPA_NSEC_PER_USEC)
194 #define SPA_TIMEVAL_TO_USEC(tv) ((tv)->tv_sec * SPA_USEC_PER_SEC + (tv)->tv_usec)
195 
196 #ifdef __GNUC__
197 #define SPA_PRINTF_FUNC(fmt, arg1) __attribute__((format(printf, fmt, arg1)))
198 #define SPA_ALIGNED(align) __attribute__((aligned(align)))
199 #define SPA_DEPRECATED __attribute__ ((deprecated))
200 #define SPA_EXPORT __attribute__((visibility("default")))
201 #define SPA_SENTINEL __attribute__((__sentinel__))
202 #define SPA_UNUSED __attribute__ ((unused))
203 #define SPA_NORETURN __attribute__ ((noreturn))
204 #else
205 #define SPA_PRINTF_FUNC(fmt, arg1)
206 #define SPA_ALIGNED(align)
207 #define SPA_DEPRECATED
208 #define SPA_EXPORT
209 #define SPA_SENTINEL
210 #define SPA_UNUSED
211 #define SPA_NORETURN
212 #endif
213 
214 #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
215 #define SPA_RESTRICT restrict
216 #elif defined(__GNUC__) && __GNUC__ >= 4
217 #define SPA_RESTRICT __restrict__
218 #else
219 #define SPA_RESTRICT
220 #endif
221 
222 #define SPA_ROUND_DOWN_N(num,align) ((num) & ~((align) - 1))
223 #define SPA_ROUND_UP_N(num,align) SPA_ROUND_DOWN_N((num) + ((align) - 1),align)
224 
225 #define SPA_PTR_ALIGNMENT(p,align) ((intptr_t)(p) & ((align)-1))
226 #define SPA_IS_ALIGNED(p,align) (SPA_PTR_ALIGNMENT(p,align) == 0)
227 #define SPA_PTR_ALIGN(p,align,type) (type*)SPA_ROUND_UP_N((intptr_t)(p), (intptr_t)(align))
228 
229 #ifndef SPA_LIKELY
230 #ifdef __GNUC__
231 #define SPA_LIKELY(x) (__builtin_expect(!!(x),1))
232 #define SPA_UNLIKELY(x) (__builtin_expect(!!(x),0))
233 #else
234 #define SPA_LIKELY(x) (x)
235 #define SPA_UNLIKELY(x) (x)
236 #endif
237 #endif
238 
239 #define SPA_STRINGIFY_1(...) #__VA_ARGS__
240 #define SPA_STRINGIFY(...) SPA_STRINGIFY_1(__VA_ARGS__)
241 
242 #define spa_return_if_fail(expr) \
243  do { \
244  if (SPA_UNLIKELY(!(expr))) { \
245  fprintf(stderr, "'%s' failed at %s:%u %s()\n", \
246  #expr , __FILE__, __LINE__, __func__); \
247  return; \
248  } \
249  } while(false)
250 
251 #define spa_return_val_if_fail(expr, val) \
252  do { \
253  if (SPA_UNLIKELY(!(expr))) { \
254  fprintf(stderr, "'%s' failed at %s:%u %s()\n", \
255  #expr , __FILE__, __LINE__, __func__); \
256  return (val); \
257  } \
258  } while(false)
259 
260 /* spa_assert_se() is an assert which guarantees side effects of x,
261  * i.e. is never optimized away, regardless of NDEBUG or FASTPATH. */
262 #ifndef __COVERITY__
263 #define spa_assert_se(expr) \
264  do { \
265  if (SPA_UNLIKELY(!(expr))) { \
266  fprintf(stderr, "'%s' failed at %s:%u %s()\n", \
267  #expr , __FILE__, __LINE__, __func__); \
268  abort(); \
269  } \
270  } while (false)
271 #else
272 #define spa_assert_se(expr) \
273  do { \
274  int _unique_var = (expr); \
275  if (!_unique_var) \
276  abort(); \
277  } while (false)
278 #endif
279 
280 /* Does exactly nothing */
281 #define spa_nop() do {} while (false)
282 
283 #ifdef NDEBUG
284 #define spa_assert(expr) spa_nop()
285 #elif defined (FASTPATH)
286 #define spa_assert(expr) spa_assert_se(expr)
287 #else
288 #define spa_assert(expr) spa_assert_se(expr)
289 #endif
290 
291 #ifdef NDEBUG
292 #define spa_assert_not_reached() abort()
293 #else
294 #define spa_assert_not_reached() \
295  do { \
296  fprintf(stderr, "Code should not be reached at %s:%u %s()\n", \
297  __FILE__, __LINE__, __func__); \
298  abort(); \
299  } while (false)
300 #endif
301 
302 #define spa_memzero(x,l) (memset((x), 0, (l)))
303 #define spa_zero(x) (spa_memzero(&(x), sizeof(x)))
304 
305 #ifdef SPA_DEBUG_MEMCPY
306 #define spa_memcpy(d,s,n) \
307 ({ \
308  fprintf(stderr, "%s:%u %s() memcpy(%p, %p, %zd)\n", \
309  __FILE__, __LINE__, __func__, (d), (s), (size_t)(n)); \
310  memcpy(d,s,n); \
311 })
312 #define spa_memmove(d,s,n) \
313 ({ \
314  fprintf(stderr, "%s:%u %s() memmove(%p, %p, %zd)\n", \
315  __FILE__, __LINE__, __func__, (d), (s), (size_t)(n)); \
316  memmove(d,s,n); \
317 })
318 #else
319 #define spa_memcpy(d,s,n) memcpy(d,s,n)
320 #define spa_memmove(d,s,n) memmove(d,s,n)
321 #endif
322 
323 #define spa_aprintf(_fmt, ...) \
324 ({ \
325  char *_strp; \
326  if (asprintf(&(_strp), (_fmt), ## __VA_ARGS__ ) == -1) \
327  _strp = NULL; \
328  _strp; \
329 })
330 
335 #ifdef __cplusplus
336 } /* extern "C" */
337 #endif
338 
339 #endif /* SPA_UTILS_DEFS_H */
spa_pod_get_long
int spa_pod_get_long(const struct spa_pod *pod, int64_t *value)
Definition: iter.h:195
PW_KEY_DEVICE_NAME
#define PW_KEY_DEVICE_NAME
device name
Definition: src/pipewire/keys.h:211
pw_context_get_main_loop
struct pw_loop * pw_context_get_main_loop(struct pw_context *context)
get the context main loop
Definition: context.c:567
PW_KEY_DEVICE_BUS
#define PW_KEY_DEVICE_BUS
bus of the device if applicable.
Definition: src/pipewire/keys.h:234
pw_properties_get
int int const char * pw_properties_get(const struct pw_properties *properties, const char *key)
Get a property.
Definition: properties.c:487
spa_pod_parser_push_struct
int spa_pod_parser_push_struct(struct spa_pod_parser *parser, struct spa_pod_frame *frame)
Definition: parser.h:253
spa_pod_object
Definition: pod/pod.h:175
spa_rectangle::width
uint32_t width
Definition: defs.h:87
SPA_PARAM_Profile
@ SPA_PARAM_Profile
profile configuration as SPA_TYPE_OBJECT_ParamProfile
Definition: param.h:53
SPA_TYPE_Float
@ SPA_TYPE_Float
Definition: build-12775836/doc/spa/utils/type.h:50
spa_direction
spa_direction
Definition: defs.h:78
device::listener
struct spa_hook listener
Definition: alsa-monitor.c:105
route::device_id
uint32_t device_id
Definition: default-routes.c:154
SPA_POD_OPT_Id
#define SPA_POD_OPT_Id(val)
Definition: parser.h:520
sm_media_session_add_listener
int sm_media_session_add_listener(struct sm_media_session *sess, struct spa_hook *listener, const struct sm_media_session_events *events, void *data)
Definition: media-session.c:1519
route_info::available
enum spa_param_availability available
Definition: default-routes.c:142
NAME
#define NAME
Definition: default-nodes.c:47
pw_array_first
#define pw_array_first(a)
Definition: array.h:68
SPA_POD_Pod
#define SPA_POD_Pod(val)
Definition: vararg.h:100
PW_TYPE_INTERFACE_Device
#define PW_TYPE_INTERFACE_Device
Definition: src/pipewire/device.h:37
SPA_POD_Int
#define SPA_POD_Int(val)
Definition: vararg.h:59
SPA_PARAM_PROFILE_name
@ SPA_PARAM_PROFILE_name
profile name (String)
Definition: param.h:114
spa_zero
#define spa_zero(x)
Definition: defs.h:303
pw_loop_update_timer
#define pw_loop_update_timer(l,...)
Definition: src/pipewire/loop.h:78
route_info::generation
uint32_t generation
Definition: default-routes.c:141
route::props
struct spa_pod * props
Definition: default-routes.c:159
SPA_POD_OBJECT_FOREACH
#define SPA_POD_OBJECT_FOREACH(obj, iter)
Definition: iter.h:123
route::index
uint32_t index
Definition: default-routes.c:153
spa_json_get_float
int spa_json_get_float(struct spa_json *iter, float *res)
Definition: json.h:247
SPA_PROP_mute
@ SPA_PROP_mute
mute (Bool)
Definition: props.h:81
pw_array_check
#define pw_array_check(a, p)
Definition: array.h:70
device::key
char * key
Definition: default-profile.c:106
spa_pod_builder_float
int spa_pod_builder_float(struct spa_pod_builder *builder, float val)
Definition: builder.h:265
route::save
bool save
Definition: default-routes.c:161
SPA_TYPE_Id
@ SPA_TYPE_Id
Definition: build-12775836/doc/spa/utils/type.h:47
spa_json_enter_object
int spa_json_enter_object(struct spa_json *iter, struct spa_json *sub)
Definition: json.h:214
spa_type_info::type
uint32_t type
Definition: build-12775836/doc/spa/utils/type.h:138
spa_type_audio_channel
const struct spa_type_info spa_type_audio_channel[]
Definition: param/audio/type-info.h:159
name
const char * name
Definition: media-session.c:2379
spa_point::x
int32_t x
Definition: defs.h:93
string.h
SPA_PARAM_ROUTE_devices
@ SPA_PARAM_ROUTE_devices
associated device indexes (Array of Int)
Definition: param.h:171
data
user data to add to an object
Definition: filter.c:75
impl::data
uint8_t data[MAX_BUFFER]
Definition: module-profiler.c:87
SPA_CLAMP
#define SPA_CLAMP(v, low, high)
Definition: defs.h:135
spa_streq
bool spa_streq(const char *s1, const char *s2)
Definition: string.h:50
spa_pod_prop
Definition: pod/pod.h:199
route::priority
uint32_t priority
Definition: default-routes.c:157
spa_list_for_each
#define spa_list_for_each(pos, head, member)
Definition: list.h:111
device::impl
struct impl * impl
Definition: alsa-monitor.c:83
route::direction
enum spa_direction direction
Definition: default-routes.c:155
spa_pod_builder_add
int spa_pod_builder_add(struct spa_pod_builder *builder,...)
Definition: builder.h:638
spa_aprintf
#define spa_aprintf(_fmt,...)
Definition: defs.h:323
spa_region::size
struct spa_rectangle size
Definition: defs.h:100
pw_loop
Definition: src/pipewire/loop.h:47
pw_device_set_param
#define pw_device_set_param(c,...)
Definition: src/pipewire/device.h:156
SPA_DIRECTION_INPUT
@ SPA_DIRECTION_INPUT
Definition: defs.h:79
PREFIX
#define PREFIX
Definition: default-profile.c:82
spa_pod_parser_pop
int spa_pod_parser_pop(struct spa_pod_parser *parser, struct spa_pod_frame *frame)
Definition: parser.h:128
impl::listener
struct spa_hook listener
Definition: access-flatpak.c:46
spa_rectangle::height
uint32_t height
Definition: defs.h:88
spa_pod_parser_get
int spa_pod_parser_get(struct spa_pod_parser *parser,...)
Definition: parser.h:507
device
Definition: alsa-monitor.c:82
spa_fraction
Definition: defs.h:104
impl
Definition: control.c:33
route_info::prev_active
unsigned int prev_active
Definition: default-routes.c:147
SPA_PROP_channelMap
@ SPA_PROP_channelMap
a channelmap array (Array (Id enum spa_audio_channel))
Definition: props.h:89
spa_pod_builder_push_object
int spa_pod_builder_push_object(struct spa_pod_builder *builder, struct spa_pod_frame *frame, uint32_t type, uint32_t id)
Definition: builder.h:426
route::p
struct sm_param * p
Definition: default-routes.c:152
SPA_PROP_latencyOffsetNsec
@ SPA_PROP_latencyOffsetNsec
delay adjustment
Definition: props.h:94
pw_array_for_each
#define pw_array_for_each(pos, array)
Definition: array.h:72
route_info::save
unsigned int save
Definition: default-routes.c:146
SPA_PARAM_ROUTE_index
@ SPA_PARAM_ROUTE_index
index of the routing destination (Int)
Definition: param.h:157
impl::id
uint32_t id
Definition: module-echo-cancel.c:139
route_info::name
char name[64]
Definition: default-routes.c:145
DEFAULT_CONFIG_AUDIO_SOURCE_KEY
#define DEFAULT_CONFIG_AUDIO_SOURCE_KEY
Definition: default-nodes.c:53
SPA_POD_OPT_Int
#define SPA_POD_OPT_Int(val)
Definition: parser.h:521
pw_array_remove
#define pw_array_remove(a, p)
Definition: array.h:82
SPA_POD_BUILDER_INIT
#define SPA_POD_BUILDER_INIT(buffer, size)
Definition: builder.h:71
route_info::index
uint32_t index
Definition: default-routes.c:140
pw_array_get_len
#define pw_array_get_len(a, t)
Get the number of items of type t in array.
Definition: array.h:62
pod.h
spa_source
Definition: build-12775836/doc/spa/support/loop.h:58
pw_properties::dict
struct spa_dict dict
dictionary of key/values
Definition: properties.h:50
pw_loop_destroy_source
#define pw_loop_destroy_source(l,...)
Definition: src/pipewire/loop.h:80
spa_dict_item
Definition: utils/dict.h:41
SPA_PARAM_ROUTE_save
@ SPA_PARAM_ROUTE_save
If route should be saved (Bool)
Definition: param.h:173
SAVE_INTERVAL
#define SAVE_INTERVAL
Definition: default-profile.c:84
profile::prio
uint32_t prio
Definition: default-profile.c:153
SPA_PARAM_ROUTE_priority
@ SPA_PARAM_ROUTE_priority
priority of the destination (Int)
Definition: param.h:162
pw_array
Definition: array.h:48
spa_point
Definition: defs.h:92
item
Definition: impl-metadata.c:49
spa_pod_builder_pop
void * spa_pod_builder_pop(struct spa_pod_builder *builder, struct spa_pod_frame *frame)
Definition: builder.h:175
SPA_PROP_volume
@ SPA_PROP_volume
a volume (Float), 0.0 silence, 1.0 normal
Definition: props.h:80
DEFAULT_CONFIG_VIDEO_SOURCE_KEY
#define DEFAULT_CONFIG_VIDEO_SOURCE_KEY
Definition: default-nodes.c:54
spa_rectangle
Definition: defs.h:86
SPA_PARAM_ROUTE_available
@ SPA_PARAM_ROUTE_available
availability of the destination (Id enum spa_param_availability)
Definition: param.h:163
spa_type_info::name
const char * name
Definition: build-12775836/doc/spa/utils/type.h:140
spa_pod
Definition: pod/pod.h:50
SPA_TYPE_OBJECT_ParamProfile
@ SPA_TYPE_OBJECT_ParamProfile
Definition: build-12775836/doc/spa/utils/type.h:94
spa_pod_builder_bool
int spa_pod_builder_bool(struct spa_pod_builder *builder, bool val)
Definition: builder.h:233
spa_pod_get_bool
int spa_pod_get_bool(const struct spa_pod *pod, bool *value)
Definition: iter.h:156
profile::p
struct sm_param * p
Definition: default-profile.c:150
impl::now
struct timespec now
Definition: default-profile.c:87
SPA_AUDIO_MAX_CHANNELS
#define SPA_AUDIO_MAX_CHANNELS
Definition: audio/raw.h:43
SPA_PARAM_ROUTE_props
@ SPA_PARAM_ROUTE_props
properties SPA_TYPE_OBJECT_Props
Definition: param.h:170
route
Definition: default-routes.c:151
SPA_PARAM_PROFILE_save
@ SPA_PARAM_PROFILE_save
If profile should be saved (Bool)
Definition: param.h:132
pw_properties_clear
void pw_properties_clear(struct pw_properties *properties)
Clear a properties object.
Definition: properties.c:277
PREFIX
#define PREFIX
Definition: default-routes.c:52
spa_pod_builder_array
int spa_pod_builder_array(struct spa_pod_builder *builder, uint32_t child_size, uint32_t child_type, uint32_t n_elems, const void *elems)
Definition: builder.h:377
spa_dict_for_each
#define spa_dict_for_each(item, dict)
Definition: utils/dict.h:58
spa_hook
A hook, contains the structure with functions and the data passed to the functions.
Definition: hook.h:295
NAME
#define NAME
Definition: default-profile.c:80
profile::save
bool save
Definition: default-profile.c:155
spa_json_init
void spa_json_init(struct spa_json *iter, const char *data, size_t size)
Definition: json.h:59
NAME
#define NAME
Definition: default-routes.c:50
sm_media_session_load_state
int sm_media_session_load_state(struct sm_media_session *sess, const char *name, struct pw_properties *props)
Definition: media-session.c:2019
SPA_POD_OPT_Bool
#define SPA_POD_OPT_Bool(val)
Definition: parser.h:519
sm_object_remove_data
int sm_object_remove_data(struct sm_object *obj, const char *id)
Definition: media-session.c:290
sm_object_get_data
void * sm_object_get_data(struct sm_object *obj, const char *id)
Definition: media-session.c:281
spa_pod_prop::key
uint32_t key
key of property, list of valid keys depends on the object type
Definition: pod/pod.h:200
SPA_LOG_LEVEL_DEBUG
@ SPA_LOG_LEVEL_DEBUG
Definition: build-12775836/doc/spa/support/log.h:51
SPA_PARAM_AVAILABILITY_yes
@ SPA_PARAM_AVAILABILITY_yes
available
Definition: param.h:107
spa_pod_parser_pod
void spa_pod_parser_pod(struct spa_pod_parser *parser, const struct spa_pod *pod)
Definition: parser.h:64
impl::to_restore
struct pw_properties * to_restore
Definition: default-routes.c:67
device::best_profile
uint32_t best_profile
Definition: default-profile.c:111
SPA_PARAM_EnumRoute
@ SPA_PARAM_EnumRoute
routing enumeration as SPA_TYPE_OBJECT_ParamRoute
Definition: param.h:56
SPA_PARAM_ROUTE_direction
@ SPA_PARAM_ROUTE_direction
direction, input/output (Id enum spa_direction)
Definition: param.h:158
pw_log_level_enabled
#define pw_log_level_enabled(lev)
Check if a loglevel is enabled.
Definition: src/pipewire/log.h:78
device::active_profile
uint32_t active_profile
Definition: default-profile.c:112
route_info::prev_available
enum spa_param_availability prev_available
Definition: default-routes.c:143
spa_pod_parser
Definition: parser.h:49
SAVE_INTERVAL
#define SAVE_INTERVAL
Definition: default-nodes.c:50
SPA_POD_Bool
#define SPA_POD_Bool(val)
Definition: vararg.h:53
SPA_DIRECTION_OUTPUT
@ SPA_DIRECTION_OUTPUT
Definition: defs.h:80
sm_object_add_listener
int sm_object_add_listener(struct sm_object *obj, struct spa_hook *listener, const struct sm_object_events *events, void *data)
Definition: media-session.c:1512
spa_dict_lookup
const char * spa_dict_lookup(const struct spa_dict *dict, const char *key)
Definition: utils/dict.h:99
SAVE_INTERVAL
#define SAVE_INTERVAL
Definition: default-routes.c:54
item::key
char * key
Definition: impl-metadata.c:51
spa_json_get_string
int spa_json_get_string(struct spa_json *iter, char *res, int maxlen)
Definition: json.h:360
profile::classes
struct spa_pod * classes
Definition: default-routes.c:437
spa_pod_frame
Definition: iter.h:42
SPA_PARAM_EnumProfile
@ SPA_PARAM_EnumProfile
profile enumeration as SPA_TYPE_OBJECT_ParamProfile
Definition: param.h:52
device::restore_saved_profile
unsigned int restore_saved_profile
Definition: default-profile.c:110
spa_pod_parse_object
#define spa_pod_parse_object(pod, type, id,...)
Definition: parser.h:560
DEFAULT_CONFIG_AUDIO_SINK_KEY
#define DEFAULT_CONFIG_AUDIO_SINK_KEY
Definition: default-nodes.c:52
spa_strerror
#define spa_strerror(err)
Definition: result.h:51
result.h
device::id
uint32_t id
Definition: alsa-monitor.c:85
spa_fraction::denom
uint32_t denom
Definition: defs.h:106
spa_pod_builder_long
int spa_pod_builder_long(struct spa_pod_builder *builder, int64_t val)
Definition: builder.h:257
PW_ID_CORE
#define PW_ID_CORE
default ID for the core object after connect
Definition: core.h:66
sm_default_profile_start
int sm_default_profile_start(struct sm_media_session *session)
Definition: default-profile.c:478
spa_pod_get_array
void * spa_pod_get_array(const struct spa_pod *pod, uint32_t *n_values)
Definition: iter.h:337
SPA_TYPE_OBJECT_Props
@ SPA_TYPE_OBJECT_Props
Definition: build-12775836/doc/spa/utils/type.h:89
param
Definition: filter.c:80
pw_loop_add_timer
#define pw_loop_add_timer(l,...)
Definition: src/pipewire/loop.h:77
device::name
char * name
Definition: default-profile.c:105
pw_log_debug
#define pw_log_debug(...)
Definition: src/pipewire/log.h:89
spa_json_next
int spa_json_next(struct spa_json *iter, const char **value)
Get the next token.
Definition: json.h:74
impl::meta_listener
struct spa_hook meta_listener
Definition: bluez-autoswitch.c:64
spa_pod_get_float
int spa_pod_get_float(const struct spa_pod *pod, float *value)
Definition: iter.h:208
spa_pod_builder_prop
int spa_pod_builder_prop(struct spa_pod_builder *builder, uint32_t key, uint32_t flags)
Definition: builder.h:441
SPA_PARAM_AVAILABILITY_no
@ SPA_PARAM_AVAILABILITY_no
not available
Definition: param.h:106
SPA_PARAM_ROUTE_name
@ SPA_PARAM_ROUTE_name
name of the routing destination (String)
Definition: param.h:160
SPA_AUDIO_CHANNEL_UNKNOWN
@ SPA_AUDIO_CHANNEL_UNKNOWN
unspecified
Definition: audio/raw.h:169
SPA_ID_INVALID
#define SPA_ID_INVALID
Definition: defs.h:182
device::generation
uint32_t generation
Definition: default-routes.c:81
SPA_PARAM_ROUTE_profiles
@ SPA_PARAM_ROUTE_profiles
associated profile indexes (Array of Int)
Definition: param.h:169
impl::context
struct pw_context * context
Definition: settings.c:43
pw_properties_set
int pw_properties_set(struct pw_properties *properties, const char *key, const char *value)
Set a property value.
Definition: properties.c:435
profile::index
uint32_t index
Definition: default-profile.c:151
impl::session
struct sm_media_session * session
Definition: access-flatpak.c:45
parser.h
spa_region
Definition: defs.h:98
SESSION_KEY
#define SESSION_KEY
Definition: default-routes.c:51
sm_object_add_data
void * sm_object_add_data(struct sm_object *obj, const char *id, size_t size)
Definition: media-session.c:261
SPA_PARAM_PROFILE_priority
@ SPA_PARAM_PROFILE_priority
profile priority (Int)
Definition: param.h:116
profile::available
uint32_t available
Definition: default-profile.c:154
spa_pod_copy_array
uint32_t spa_pod_copy_array(const struct spa_pod *pod, uint32_t type, void *values, uint32_t max_values)
Definition: iter.h:344
SPA_PARAM_AVAILABILITY_unknown
@ SPA_PARAM_AVAILABILITY_unknown
unknown availability
Definition: param.h:105
SPA_TYPE_OBJECT_ParamRoute
@ SPA_TYPE_OBJECT_ParamRoute
Definition: build-12775836/doc/spa/utils/type.h:96
ROUTE_INIT
#define ROUTE_INIT(__p)
Definition: default-routes.c:164
spa_debug_type_short_name
const char * spa_debug_type_short_name(const char *name)
Definition: types.h:60
route_info::active
unsigned int active
Definition: default-routes.c:148
pw_log_warn
#define pw_log_warn(...)
Definition: src/pipewire/log.h:87
route::name
const char * name
Definition: default-routes.c:156
SPA_POD_String
#define SPA_POD_String(val)
Definition: vararg.h:81
item::value
char * value
Definition: impl-metadata.c:53
route::available
enum spa_param_availability available
Definition: default-routes.c:158
SPA_PROP_channelVolumes
@ SPA_PROP_channelVolumes
a volume array, one volume per channel (Array of Float)
Definition: props.h:85
impl::properties
struct pw_properties * properties
Definition: module-access.c:141
SPA_PARAM_PROFILE_index
@ SPA_PARAM_PROFILE_index
profile index (Int)
Definition: param.h:113
json.h
sm_media_session_save_state
int sm_media_session_save_state(struct sm_media_session *sess, const char *name, const struct pw_properties *props)
Definition: media-session.c:2025
spa_pod_builder_add_object
#define spa_pod_builder_add_object(b, type, id,...)
Definition: builder.h:650
spa_json_enter_array
int spa_json_enter_array(struct spa_json *iter, struct spa_json *sub)
Definition: json.h:224
SESSION_KEY
#define SESSION_KEY
Definition: default-nodes.c:48
spa_hook_remove
void spa_hook_remove(struct spa_hook *hook)
Remove a hook.
Definition: hook.h:336
device::route_info
struct pw_array route_info
Definition: default-routes.c:82
impl::idle_timeout
struct spa_source * idle_timeout
Definition: default-nodes.c:61
pw_log_info
#define pw_log_info(...)
Definition: src/pipewire/log.h:88
spa_param_availability
spa_param_availability
Definition: param.h:104
device::obj
struct sm_device * obj
Definition: default-profile.c:101
spa_debug_pod
int spa_debug_pod(int indent, const struct spa_type_info *info, const struct spa_pod *pod)
Definition: debug/pod.h:200
pipewire.h
profile::name
const char * name
Definition: default-profile.c:152
sm_media_session_schedule_rescan
int sm_media_session_schedule_rescan(struct sm_media_session *sess)
Definition: media-session.c:1569
spa_pod_prop::value
struct spa_pod value
Definition: pod/pod.h:212
SPA_PARAM_ROUTE_device
@ SPA_PARAM_ROUTE_device
device id (Int)
Definition: param.h:159
route_info
Definition: default-routes.c:139
spa_fraction::num
uint32_t num
Definition: defs.h:105
SPA_POD_STRUCT_FOREACH
#define SPA_POD_STRUCT_FOREACH(obj, iter)
Definition: iter.h:115
route_info::direction
enum spa_direction direction
Definition: default-routes.c:144
sm_default_routes_start
int sm_default_routes_start(struct sm_media_session *session)
Definition: default-routes.c:905
spa_json_get_bool
int spa_json_get_bool(struct spa_json *iter, bool *res)
Definition: json.h:301
sm_default_nodes_start
int sm_default_nodes_start(struct sm_media_session *session)
Definition: default-nodes.c:169
SPA_POD_OPT_Pod
#define SPA_POD_OPT_Pod(val)
Definition: parser.h:533
SPA_PARAM_Route
@ SPA_PARAM_Route
routing configuration as SPA_TYPE_OBJECT_ParamRoute
Definition: param.h:57
SPA_POD_Id
#define SPA_POD_Id(val)
Definition: vararg.h:56
pw_properties_new
struct pw_properties * pw_properties_new(const char *key,...) 1
Make a new properties object.
Definition: properties.c:98
route::profiles
struct spa_pod * profiles
Definition: default-routes.c:160
SPA_PARAM_PROFILE_available
@ SPA_PARAM_PROFILE_available
availability of the profile (Id enum spa_param_availability)
Definition: param.h:117
pw_properties_setf
int pw_properties_setf(struct pw_properties *properties, const char *key, const char *format,...) 1(3
spa_pod_builder
Definition: builder.h:63
hook.h
spa_point::y
int32_t y
Definition: defs.h:94
spa_region::position
struct spa_point position
Definition: defs.h:99
spa_json
Definition: json.h:49
profile
Definition: default-profile.c:149
builder.h
pw_properties
Definition: properties.h:49
SPA_PARAM_PROFILE_classes
@ SPA_PARAM_PROFILE_classes
node classes provided by this profile (Struct( Int : number of items following Struct( String : class...
Definition: param.h:123
SESSION_KEY
#define SESSION_KEY
Definition: default-profile.c:81
pw_properties_free
void pw_properties_free(struct pw_properties *properties)
Free a properties object.
Definition: properties.c:364
pw_log_error
#define pw_log_error(...)
Definition: src/pipewire/log.h:86