PipeWire 1.2.7
|
Helper macros and functions More...
Files | |
file | defs.h |
spa/utils/defs.h | |
Data Structures | |
struct | spa_rectangle |
struct | spa_point |
struct | spa_region |
struct | spa_fraction |
struct | spa_error_location |
Enumerations | |
enum | spa_direction { SPA_DIRECTION_INPUT = 0 , SPA_DIRECTION_OUTPUT = 1 } |
Macros | |
#define | SPA_FALLTHROUGH /* FALLTHROUGH */ |
SPA_FALLTHROUGH is an annotation to suppress compiler warnings about switch cases that fall through without a break or return statement. | |
#define | SPA_FLAG_MASK(field, mask, flag) |
#define | SPA_FLAG_IS_SET(field, flag) |
#define | SPA_FLAG_SET(field, flag) |
#define | SPA_FLAG_CLEAR(field, flag) |
#define | SPA_FLAG_UPDATE(field, flag, val) |
#define | SPA_DIRECTION_REVERSE(d) |
#define | SPA_RECTANGLE(width, height) |
#define | SPA_POINT(x, y) |
#define | SPA_REGION(x, y, width, height) |
#define | SPA_FRACTION(num, denom) |
#define | SPA_N_ELEMENTS(arr) |
#define | SPA_FOR_EACH_ELEMENT(arr, ptr) |
Array iterator macro. | |
#define | SPA_FOR_EACH_ELEMENT_VAR(arr, var) |
#define | SPA_ABS(a) |
#define | SPA_MIN(a, b) |
#define | SPA_MAX(a, b) |
#define | SPA_CLAMP(v, low, high) |
#define | SPA_CLAMPF(v, low, high) |
#define | SPA_CLAMPD(v, low, high) |
#define | SPA_SWAP(a, b) |
#define | SPA_TYPECHECK(type, x) |
#define | SPA_CMP(a, b) |
3-way comparison. | |
#define | SPA_PTROFF(ptr_, offset_, type_) |
Return the address (buffer + offset) as pointer of type. | |
#define | SPA_PTROFF_ALIGN(ptr_, offset_, alignment_, type_) |
#define | SPA_MEMBER(b, o, t) |
Deprecated, use SPA_PTROFF and SPA_PTROFF_ALIGN instead. | |
#define | SPA_MEMBER_ALIGN(b, o, a, t) |
#define | SPA_CONTAINER_OF(p, t, m) |
#define | SPA_PTRDIFF(p1, p2) |
#define | SPA_PTR_TO_UINT32(p) |
#define | SPA_UINT32_TO_PTR(u) |
#define | SPA_TIME_INVALID ((int64_t)INT64_MIN) |
#define | SPA_IDX_INVALID ((unsigned int)-1) |
#define | SPA_ID_INVALID ((uint32_t)0xffffffff) |
#define | SPA_NSEC_PER_SEC (1000000000LL) |
#define | SPA_NSEC_PER_MSEC (1000000ll) |
#define | SPA_NSEC_PER_USEC (1000ll) |
#define | SPA_USEC_PER_SEC (1000000ll) |
#define | SPA_USEC_PER_MSEC (1000ll) |
#define | SPA_MSEC_PER_SEC (1000ll) |
#define | SPA_TIMESPEC_TO_NSEC(ts) |
#define | SPA_TIMESPEC_TO_USEC(ts) |
#define | SPA_TIMEVAL_TO_NSEC(tv) |
#define | SPA_TIMEVAL_TO_USEC(tv) |
#define | SPA_PRINTF_FUNC(fmt, arg1) |
#define | SPA_FORMAT_ARG_FUNC(arg1) |
#define | SPA_ALIGNED(align) |
#define | SPA_DEPRECATED |
#define | SPA_EXPORT |
#define | SPA_SENTINEL |
#define | SPA_UNUSED |
#define | SPA_NORETURN |
#define | SPA_WARN_UNUSED_RESULT |
#define | SPA_RESTRICT |
#define | SPA_ROUND_DOWN(num, value) |
#define | SPA_ROUND_UP(num, value) |
#define | SPA_ROUND_MASK(num, mask) |
#define | SPA_ROUND_DOWN_N(num, align) |
#define | SPA_ROUND_UP_N(num, align) |
#define | SPA_SCALE32_UP(val, num, denom) |
#define | SPA_PTR_ALIGNMENT(p, align) |
#define | SPA_IS_ALIGNED(p, align) |
#define | SPA_PTR_ALIGN(p, align, type) |
#define | SPA_LIKELY(x) |
#define | SPA_UNLIKELY(x) |
#define | spa_ptr_type_inside(p1, s1, p2, type, remaining) |
#define | SPA_PTR_TO_INT(p) |
#define | SPA_INT_TO_PTR(u) |
#define | SPA_STRINGIFY_1(...) |
#define | SPA_STRINGIFY(...) |
#define | spa_return_if_fail(expr) |
#define | spa_return_val_if_fail(expr, val) |
#define | spa_assert_se(expr) |
#define | spa_nop() |
#define | spa_assert(expr) |
#define | spa_assert_not_reached() |
#define | spa_memzero(x, l) |
#define | spa_zero(x) |
#define | spa_memcpy(d, s, n) |
#define | spa_memmove(d, s, n) |
#define | spa_aprintf(_fmt, ...) |
Functions | |
static bool | spa_ptrinside (const void *p1, size_t s1, const void *p2, size_t s2, size_t *remaining) |
static bool | spa_ptr_inside_and_aligned (const void *p1, size_t s1, const void *p2, size_t s2, size_t align, size_t *remaining) |
Helper macros and functions
enum spa_direction |
#define SPA_FALLTHROUGH /* FALLTHROUGH */ |
SPA_FALLTHROUGH is an annotation to suppress compiler warnings about switch cases that fall through without a break or return statement.
SPA_FALLTHROUGH is only needed on cases that have code:
switch (foo) { case 1: // These cases have no code. No fallthrough annotations are needed. case 2: case 3: foo = 4; // This case has code, so a fallthrough annotation is needed: SPA_FALLTHROUGH; default: return foo; }
#define SPA_FLAG_MASK | ( | field, | |
mask, | |||
flag ) |
#define SPA_FLAG_IS_SET | ( | field, | |
flag ) |
#define SPA_FLAG_SET | ( | field, | |
flag ) |
#define SPA_FLAG_CLEAR | ( | field, | |
flag ) |
#define SPA_FLAG_UPDATE | ( | field, | |
flag, | |||
val ) |
#define SPA_DIRECTION_REVERSE | ( | d | ) |
#define SPA_RECTANGLE | ( | width, | |
height ) |
#define SPA_POINT | ( | x, | |
y ) |
#define SPA_REGION | ( | x, | |
y, | |||
width, | |||
height ) |
#define SPA_FRACTION | ( | num, | |
denom ) |
#define SPA_N_ELEMENTS | ( | arr | ) |
#define SPA_FOR_EACH_ELEMENT | ( | arr, | |
ptr ) |
Array iterator macro.
Usage:
#define SPA_FOR_EACH_ELEMENT_VAR | ( | arr, | |
var ) |
#define SPA_ABS | ( | a | ) |
#define SPA_MIN | ( | a, | |
b ) |
#define SPA_MAX | ( | a, | |
b ) |
#define SPA_CLAMP | ( | v, | |
low, | |||
high ) |
#define SPA_CLAMPF | ( | v, | |
low, | |||
high ) |
#define SPA_CLAMPD | ( | v, | |
low, | |||
high ) |
#define SPA_SWAP | ( | a, | |
b ) |
#define SPA_TYPECHECK | ( | type, | |
x ) |
#define SPA_CMP | ( | a, | |
b ) |
3-way comparison.
NaN > NaN and NaN > finite numbers
#define SPA_PTROFF | ( | ptr_, | |
offset_, | |||
type_ ) |
Return the address (buffer + offset) as pointer of type.
#define SPA_PTROFF_ALIGN | ( | ptr_, | |
offset_, | |||
alignment_, | |||
type_ ) |
#define SPA_MEMBER | ( | b, | |
o, | |||
t ) |
Deprecated, use SPA_PTROFF and SPA_PTROFF_ALIGN instead.
#define SPA_MEMBER_ALIGN | ( | b, | |
o, | |||
a, | |||
t ) |
#define SPA_CONTAINER_OF | ( | p, | |
t, | |||
m ) |
#define SPA_PTRDIFF | ( | p1, | |
p2 ) |
#define SPA_PTR_TO_UINT32 | ( | p | ) |
#define SPA_UINT32_TO_PTR | ( | u | ) |
#define SPA_TIME_INVALID ((int64_t)INT64_MIN) |
#define SPA_IDX_INVALID ((unsigned int)-1) |
#define SPA_ID_INVALID ((uint32_t)0xffffffff) |
#define SPA_NSEC_PER_SEC (1000000000LL) |
#define SPA_NSEC_PER_MSEC (1000000ll) |
#define SPA_NSEC_PER_USEC (1000ll) |
#define SPA_USEC_PER_SEC (1000000ll) |
#define SPA_USEC_PER_MSEC (1000ll) |
#define SPA_MSEC_PER_SEC (1000ll) |
#define SPA_TIMESPEC_TO_NSEC | ( | ts | ) |
#define SPA_TIMESPEC_TO_USEC | ( | ts | ) |
#define SPA_TIMEVAL_TO_NSEC | ( | tv | ) |
#define SPA_TIMEVAL_TO_USEC | ( | tv | ) |
#define SPA_PRINTF_FUNC | ( | fmt, | |
arg1 ) |
#define SPA_FORMAT_ARG_FUNC | ( | arg1 | ) |
#define SPA_ALIGNED | ( | align | ) |
#define SPA_DEPRECATED |
#define SPA_EXPORT |
#define SPA_SENTINEL |
#define SPA_UNUSED |
#define SPA_NORETURN |
#define SPA_WARN_UNUSED_RESULT |
#define SPA_RESTRICT |
#define SPA_ROUND_DOWN | ( | num, | |
value ) |
#define SPA_ROUND_UP | ( | num, | |
value ) |
#define SPA_ROUND_MASK | ( | num, | |
mask ) |
#define SPA_ROUND_DOWN_N | ( | num, | |
align ) |
#define SPA_ROUND_UP_N | ( | num, | |
align ) |
#define SPA_SCALE32_UP | ( | val, | |
num, | |||
denom ) |
#define SPA_PTR_ALIGNMENT | ( | p, | |
align ) |
#define SPA_IS_ALIGNED | ( | p, | |
align ) |
#define SPA_PTR_ALIGN | ( | p, | |
align, | |||
type ) |
#define SPA_LIKELY | ( | x | ) |
#define SPA_UNLIKELY | ( | x | ) |
#define spa_ptr_type_inside | ( | p1, | |
s1, | |||
p2, | |||
type, | |||
remaining ) |
#define SPA_PTR_TO_INT | ( | p | ) |
#define SPA_INT_TO_PTR | ( | u | ) |
#define SPA_STRINGIFY_1 | ( | ... | ) |
#define SPA_STRINGIFY | ( | ... | ) |
#define spa_return_if_fail | ( | expr | ) |
#define spa_return_val_if_fail | ( | expr, | |
val ) |
#define spa_assert_se | ( | expr | ) |
#define spa_nop | ( | ) |
#define spa_assert | ( | expr | ) |
#define spa_assert_not_reached | ( | ) |
#define spa_memzero | ( | x, | |
l ) |
#define spa_zero | ( | x | ) |
#define spa_memcpy | ( | d, | |
s, | |||
n ) |
#define spa_memmove | ( | d, | |
s, | |||
n ) |
#define spa_aprintf | ( | _fmt, | |
... ) |
|
inlinestatic |
|
inlinestatic |