PipeWire 1.1.0
Loading...
Searching...
No Matches
result.h
Go to the documentation of this file.
1/* Simple Plugin API */
2/* SPDX-FileCopyrightText: Copyright © 2018 Wim Taymans */
3/* SPDX-License-Identifier: MIT */
4
5#ifndef SPA_UTILS_RESULT_H
6#define SPA_UTILS_RESULT_H
7
8#ifdef __cplusplus
9extern "C" {
10#endif
11
22#include <spa/utils/defs.h>
23#include <spa/utils/list.h>
24
25#define SPA_ASYNC_BIT (1 << 30)
26#define SPA_ASYNC_SEQ_MASK (SPA_ASYNC_BIT - 1)
27#define SPA_ASYNC_MASK (~SPA_ASYNC_SEQ_MASK)
28
29#define SPA_RESULT_IS_OK(res) ((res) >= 0)
30#define SPA_RESULT_IS_ERROR(res) ((res) < 0)
31#define SPA_RESULT_IS_ASYNC(res) (((res) & SPA_ASYNC_MASK) == SPA_ASYNC_BIT)
32
33#define SPA_RESULT_ASYNC_SEQ(res) ((res) & SPA_ASYNC_SEQ_MASK)
34#define SPA_RESULT_RETURN_ASYNC(seq) (SPA_ASYNC_BIT | SPA_RESULT_ASYNC_SEQ(seq))
36#define spa_strerror(err) \
37({ \
38 int _err = -(err); \
39 if (SPA_RESULT_IS_ASYNC(err)) \
40 _err = EINPROGRESS; \
41 strerror(_err); \
42})
43
48#ifdef __cplusplus
49} /* extern "C" */
50#endif
51
52#endif /* SPA_UTILS_RESULT_H */
spa/utils/defs.h
spa/utils/list.h