PipeWire  0.3.61
defs.h File Reference

spa/utils/defs.h More...

Go to the source code of this file.

Data Structures

struct  spa_rectangle
 
struct  spa_point
 
struct  spa_region
 
struct  spa_fraction
 

Macros

#define SPA_STATIC_ASSERT(a, b)    ((void)sizeof(struct { int spa_static_assertion_failed : 2 * !!(a) - 1; }))
 
#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. More...
 
#define SPA_FLAG_MASK(field, mask, flag)   (((field) & (mask)) == (flag))
 
#define SPA_FLAG_IS_SET(field, flag)   SPA_FLAG_MASK(field, flag, flag)
 
#define SPA_FLAG_SET(field, flag)   ((field) |= (flag))
 
#define SPA_FLAG_CLEAR(field, flag)
 
#define SPA_FLAG_UPDATE(field, flag, val)   ((val) ? SPA_FLAG_SET((field),(flag)) : SPA_FLAG_CLEAR((field),(flag)))
 
#define SPA_DIRECTION_REVERSE(d)   ((d) ^ 1)
 
#define SPA_RECTANGLE(width, height)   ((struct spa_rectangle){ (width), (height) })
 
#define SPA_POINT(x, y)   ((struct spa_point){ (x), (y) })
 
#define SPA_REGION(x, y, width, height)   ((struct spa_region){ SPA_POINT(x,y), SPA_RECTANGLE(width,height) })
 
#define SPA_FRACTION(num, denom)   ((struct spa_fraction){ (num), (denom) })
 
#define SPA_N_ELEMENTS(arr)   (sizeof(arr) / sizeof((arr)[0]))
 
#define SPA_FOR_EACH_ELEMENT(arr, ptr)    for ((ptr) = arr; (void*)(ptr) < SPA_PTROFF(arr, sizeof(arr), void); (ptr)++)
 Array iterator macro. More...
 
#define SPA_FOR_EACH_ELEMENT_VAR(arr, var)    for (__typeof__((arr)[0])* (var) = arr; (void*)(var) < SPA_PTROFF(arr, sizeof(arr), void); (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_SWAP(a, b)
 
#define SPA_TYPECHECK(type, x)
 
#define SPA_PTROFF(ptr_, offset_, type_)   ((type_*)((uintptr_t)(ptr_) + (ptrdiff_t)(offset_)))
 Return the address (buffer + offset) as pointer of type. More...
 
#define SPA_PTROFF_ALIGN(ptr_, offset_, alignment_, type_)    SPA_PTR_ALIGN(SPA_PTROFF(ptr_,offset_,type_),alignment_,type_)
 
#define SPA_MEMBER(b, o, t)   SPA_PTROFF(b,o,t)
 Deprecated, use SPA_PTROFF and SPA_PTROFF_ALIGN instead. More...
 
#define SPA_MEMBER_ALIGN(b, o, a, t)   SPA_PTROFF_ALIGN(b,o,a,t)
 
#define SPA_CONTAINER_OF(p, t, m)   ((t*)((uintptr_t)(p) - offsetof(t,m)))
 
#define SPA_PTRDIFF(p1, p2)   ((intptr_t)(p1) - (intptr_t)(p2))
 
#define SPA_PTR_TO_INT(p)   ((int) ((intptr_t) (p)))
 
#define SPA_INT_TO_PTR(u)   ((void*) ((intptr_t) (u)))
 
#define SPA_PTR_TO_UINT32(p)   ((uint32_t) ((uintptr_t) (p)))
 
#define SPA_UINT32_TO_PTR(u)   ((void*) ((uintptr_t) (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)   ((ts)->tv_sec * SPA_NSEC_PER_SEC + (ts)->tv_nsec)
 
#define SPA_TIMESPEC_TO_USEC(ts)   ((ts)->tv_sec * SPA_USEC_PER_SEC + (ts)->tv_nsec / SPA_NSEC_PER_USEC)
 
#define SPA_TIMEVAL_TO_NSEC(tv)   ((tv)->tv_sec * SPA_NSEC_PER_SEC + (tv)->tv_usec * SPA_NSEC_PER_USEC)
 
#define SPA_TIMEVAL_TO_USEC(tv)   ((tv)->tv_sec * SPA_USEC_PER_SEC + (tv)->tv_usec)
 
#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)   ((__typeof__(num))((mask)-1))
 
#define SPA_ROUND_DOWN_N(num, align)   ((num) & ~SPA_ROUND_MASK(num, align))
 
#define SPA_ROUND_UP_N(num, align)   ((((num)-1) | SPA_ROUND_MASK(num, align))+1)
 
#define SPA_PTR_ALIGNMENT(p, align)   ((intptr_t)(p) & ((align)-1))
 
#define SPA_IS_ALIGNED(p, align)   (SPA_PTR_ALIGNMENT(p,align) == 0)
 
#define SPA_PTR_ALIGN(p, align, type)   ((type*)SPA_ROUND_UP_N((intptr_t)(p), (intptr_t)(align)))
 
#define SPA_LIKELY(x)   (x)
 
#define SPA_UNLIKELY(x)   (x)
 
#define SPA_STRINGIFY_1(...)   #__VA_ARGS__
 
#define SPA_STRINGIFY(...)   SPA_STRINGIFY_1(__VA_ARGS__)
 
#define spa_return_if_fail(expr)
 
#define spa_return_val_if_fail(expr, val)
 
#define spa_assert_se(expr)
 
#define spa_nop()   do {} while (false)
 
#define spa_assert(expr)   spa_assert_se(expr)
 
#define spa_assert_not_reached()
 
#define spa_memzero(x, l)   (memset((x), 0, (l)))
 
#define spa_zero(x)   (spa_memzero(&(x), sizeof(x)))
 
#define spa_memcpy(d, s, n)   memcpy(d,s,n)
 
#define spa_memmove(d, s, n)   memmove(d,s,n)
 
#define spa_aprintf(_fmt, ...)
 

Enumerations

enum  spa_direction { SPA_DIRECTION_INPUT = 0 , SPA_DIRECTION_OUTPUT = 1 }
 

Detailed Description

Macro Definition Documentation

◆ SPA_STATIC_ASSERT

#define SPA_STATIC_ASSERT (   a,
 
)     ((void)sizeof(struct { int spa_static_assertion_failed : 2 * !!(a) - 1; }))