PipeWire  0.3.33
result.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_RESULT_H
26 #define SPA_UTILS_RESULT_H
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
37 #include <spa/utils/defs.h>
38 #include <spa/utils/list.h>
39 
40 #define SPA_ASYNC_BIT (1 << 30)
41 #define SPA_ASYNC_SEQ_MASK (SPA_ASYNC_BIT - 1)
42 #define SPA_ASYNC_MASK (~SPA_ASYNC_SEQ_MASK)
43 
44 #define SPA_RESULT_IS_OK(res) ((res) >= 0)
45 #define SPA_RESULT_IS_ERROR(res) ((res) < 0)
46 #define SPA_RESULT_IS_ASYNC(res) (((res) & SPA_ASYNC_MASK) == SPA_ASYNC_BIT)
47 
48 #define SPA_RESULT_ASYNC_SEQ(res) ((res) & SPA_ASYNC_SEQ_MASK)
49 #define SPA_RESULT_RETURN_ASYNC(seq) (SPA_ASYNC_BIT | SPA_RESULT_ASYNC_SEQ(seq))
50 
51 #define spa_strerror(err) \
52 ({ \
53  int _err = -err; \
54  if (SPA_RESULT_IS_ASYNC(err)) \
55  _err = EINPROGRESS; \
56  strerror(_err); \
57 })
58 
63 #ifdef __cplusplus
64 } /* extern "C" */
65 #endif
66 
67 #endif /* SPA_UTILS_RESULT_H */
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_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_object
Definition: pod/pod.h:175
PW_KEY_MEDIA_ROLE
#define PW_KEY_MEDIA_ROLE
Role: Movie, Music, Camera, Screen, Communication, Game, Notification, DSP, Production,...
Definition: src/pipewire/keys.h:281
SPA_TYPE_Float
@ SPA_TYPE_Float
Definition: build-12775836/doc/spa/utils/type.h:50
NAME
#define NAME
Definition: restore-stream.c:51
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
metadata
Definition: impl-metadata.c:43
PW_KEY_APP_ID
#define PW_KEY_APP_ID
a textual id for identifying an application logically.
Definition: src/pipewire/keys.h:109
spa_dict_item::key
const char * key
Definition: utils/dict.h:42
pw_loop_update_timer
#define pw_loop_update_timer(l,...)
Definition: src/pipewire/loop.h:78
SPA_POD_OBJECT_FOREACH
#define SPA_POD_OBJECT_FOREACH(obj, iter)
Definition: iter.h:123
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
spa_pod_builder_float
int spa_pod_builder_float(struct spa_pod_builder *builder, float val)
Definition: builder.h:265
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
string.h
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_streq
bool spa_streq(const char *s1, const char *s2)
Definition: string.h:50
spa_pod_prop
Definition: pod/pod.h:199
spa_list_for_each
#define spa_list_for_each(pos, head, member)
Definition: list.h:111
spa_aprintf
#define spa_aprintf(_fmt,...)
Definition: defs.h:323
pw_loop
Definition: src/pipewire/loop.h:47
stream::restored
unsigned int restored
Definition: restore-stream.c:81
impl::listener
struct spa_hook listener
Definition: access-flatpak.c:46
stream::key
char * key
Definition: restore-stream.c:80
impl
Definition: control.c:33
impl::props
struct pw_properties * props
Definition: module-example-sink.c:81
PW_KEY_MEDIA_NAME
#define PW_KEY_MEDIA_NAME
media name.
Definition: src/pipewire/keys.h:286
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
spa_strstartswith
bool spa_strstartswith(const char *s, const char *prefix)
Definition: string.h:71
stream::listener
struct spa_hook listener
Definition: restore-stream.c:83
impl::id
uint32_t id
Definition: module-echo-cancel.c:139
SPA_POD_BUILDER_INIT
#define SPA_POD_BUILDER_INIT(buffer, size)
Definition: builder.h:71
SPA_PARAM_Props
@ SPA_PARAM_Props
properties as SPA_TYPE_OBJECT_Props
Definition: param.h:46
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
stream
Definition: stream.c:97
SESSION_KEY
#define SESSION_KEY
Definition: restore-stream.c:52
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
spa_type_info::name
const char * name
Definition: build-12775836/doc/spa/utils/type.h:140
spa_pod
Definition: pod/pod.h:50
SAVE_INTERVAL
#define SAVE_INTERVAL
Definition: restore-stream.c:55
sync
Definition: media-session.c:119
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
impl::now
struct timespec now
Definition: default-profile.c:87
SPA_N_ELEMENTS
#define SPA_N_ELEMENTS(arr)
Definition: defs.h:109
SPA_AUDIO_MAX_CHANNELS
#define SPA_AUDIO_MAX_CHANNELS
Definition: audio/raw.h:43
PW_TYPE_INTERFACE_Node
#define PW_TYPE_INTERFACE_Node
Definition: src/pipewire/node.h:50
stream::data
struct data data
Definition: stream.c:151
pw_properties_clear
void pw_properties_clear(struct pw_properties *properties)
Clear a properties object.
Definition: properties.c:277
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
PW_KEY_NODE_NAME
#define PW_KEY_NODE_NAME
node name
Definition: src/pipewire/keys.h:138
spa_hook
A hook, contains the structure with functions and the data passed to the functions.
Definition: hook.h:295
PW_KEY_APP_NAME
#define PW_KEY_APP_NAME
application keys
Definition: src/pipewire/keys.h:108
spa_json_init
void spa_json_init(struct spa_json *iter, const char *data, size_t size)
Definition: json.h:59
impl::sync
unsigned int sync
Definition: restore-stream.c:71
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
stream::media_class
char * media_class
Definition: restore-stream.c:79
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
stream::impl
struct impl * impl
Definition: restore-stream.c:78
pw_log_level_enabled
#define pw_log_level_enabled(lev)
Check if a loglevel is enabled.
Definition: src/pipewire/log.h:78
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
pw_node_set_param
#define pw_node_set_param(c,...)
Definition: src/pipewire/node.h:201
spa_json_get_string
int spa_json_get_string(struct spa_json *iter, char *res, int maxlen)
Definition: json.h:360
spa_pod_frame
Definition: iter.h:42
impl::metadata_listener
struct spa_hook metadata_listener
Definition: settings.c:46
spa_dict_item::value
const char * value
Definition: utils/dict.h:43
spa_strerror
#define spa_strerror(err)
Definition: result.h:51
result.h
PW_ID_CORE
#define PW_ID_CORE
default ID for the core object after connect
Definition: core.h:66
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
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
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_AUDIO_CHANNEL_UNKNOWN
@ SPA_AUDIO_CHANNEL_UNKNOWN
unspecified
Definition: audio/raw.h:169
impl::context
struct pw_context * context
Definition: settings.c:43
PW_KEY_MEDIA_CLASS
#define PW_KEY_MEDIA_CLASS
class Ex: "Video/Source"
Definition: src/pipewire/keys.h:285
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
impl::session
struct sm_media_session * session
Definition: access-flatpak.c:45
parser.h
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_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
sm_media_session_export_metadata
struct pw_metadata * sm_media_session_export_metadata(struct sm_media_session *sess, const char *name)
Definition: metadata.c:64
spa_debug_type_short_name
const char * spa_debug_type_short_name(const char *name)
Definition: types.h:60
SPA_PROP_channelVolumes
@ SPA_PROP_channelVolumes
a volume array, one volume per channel (Array of Float)
Definition: props.h:85
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_json_enter_array
int spa_json_enter_array(struct spa_json *iter, struct spa_json *sub)
Definition: json.h:224
defs.h
spa_hook_remove
void spa_hook_remove(struct spa_hook *hook)
Remove a hook.
Definition: hook.h:336
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
stream::obj
struct sm_node * obj
Definition: restore-stream.c:75
sm_restore_stream_start
int sm_restore_stream_start(struct sm_media_session *session)
Definition: restore-stream.c:531
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
list.h
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_json_get_bool
int spa_json_get_bool(struct spa_json *iter, bool *res)
Definition: json.h:301
pw_properties_new
struct pw_properties * pw_properties_new(const char *key,...) 1
Make a new properties object.
Definition: properties.c:98
impl::metadata
struct pw_metadata * metadata
Definition: restore-stream.c:66
spa_pod_builder
Definition: builder.h:63
hook.h
PREFIX
#define PREFIX
Definition: restore-stream.c:53
spa_json
Definition: json.h:49
impl::metadata
struct pw_impl_metadata * metadata
Definition: settings.c:44
builder.h
stream::id
uint32_t id
Definition: restore-stream.c:77
pw_properties
Definition: properties.h:49
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