Loading...
Searching...
No Matches
loop.h
Go to the documentation of this file.
/* PipeWire */
/* SPDX-FileCopyrightText: Copyright © 2018 Wim Taymans */
/* SPDX-License-Identifier: MIT */
#ifndef PIPEWIRE_LOOP_H
#define PIPEWIRE_LOOP_H
#include <spa/support/loop.h>
#include <spa/utils/dict.h>
#ifdef __cplusplus
extern "C" {
#endif
struct pw_loop {
struct spa_system *system;
struct spa_loop *loop;
struct spa_loop_control *control;
struct spa_loop_utils *utils;
const char *name;
};
#ifndef PW_API_LOOP_IMPL
#define PW_API_LOOP_IMPL static inline
#endif
struct pw_loop *
pw_loop_new(const struct spa_dict *props);
void
pw_loop_destroy(struct pw_loop *loop);
int pw_loop_set_name(struct pw_loop *loop, const char *name);
PW_API_LOOP_IMPL int pw_loop_add_source(struct pw_loop *object, struct spa_source *source)
{
return spa_loop_add_source(object->loop, source);
}
PW_API_LOOP_IMPL int pw_loop_update_source(struct pw_loop *object, struct spa_source *source)
{
return spa_loop_update_source(object->loop, source);
}
PW_API_LOOP_IMPL int pw_loop_remove_source(struct pw_loop *object, struct spa_source *source)
{
return spa_loop_remove_source(object->loop, source);
}
PW_API_LOOP_IMPL int pw_loop_invoke(struct pw_loop *object,
spa_invoke_func_t func, uint32_t seq, const void *data,
size_t size, bool block, void *user_data)
{
return spa_loop_invoke(object->loop, func, seq, data, size, block, user_data);
}
PW_API_LOOP_IMPL int pw_loop_locked(struct pw_loop *object,
spa_invoke_func_t func, uint32_t seq, const void *data,
size_t size, void *user_data)
{
return spa_loop_locked(object->loop, func, seq, data, size, user_data);
}
PW_API_LOOP_IMPL int pw_loop_get_fd(struct pw_loop *object)
{
return spa_loop_control_get_fd(object->control);
}
PW_API_LOOP_IMPL void pw_loop_add_hook(struct pw_loop *object,
struct spa_hook *hook, const struct spa_loop_control_hooks *hooks,
void *data)
{
spa_loop_control_add_hook(object->control, hook, hooks, data);
}
PW_API_LOOP_IMPL void pw_loop_enter(struct pw_loop *object)
{
spa_loop_control_enter(object->control);
}
PW_API_LOOP_IMPL void pw_loop_leave(struct pw_loop *object)
{
spa_loop_control_leave(object->control);
}
PW_API_LOOP_IMPL int pw_loop_iterate(struct pw_loop *object,
int timeout)
{
return spa_loop_control_iterate_fast(object->control, timeout);
}
PW_API_LOOP_IMPL int pw_loop_check(struct pw_loop *object)
{
return spa_loop_control_check(object->control);
}
PW_API_LOOP_IMPL int pw_loop_lock(struct pw_loop *object)
{
return spa_loop_control_lock(object->control);
}
PW_API_LOOP_IMPL int pw_loop_unlock(struct pw_loop *object)
{
return spa_loop_control_unlock(object->control);
}
PW_API_LOOP_IMPL int pw_loop_get_time(struct pw_loop *object, struct timespec *abstime, int64_t timeout)
{
return spa_loop_control_get_time(object->control, abstime, timeout);
}
PW_API_LOOP_IMPL int pw_loop_wait(struct pw_loop *object, const struct timespec *abstime)
{
return spa_loop_control_wait(object->control, abstime);
}
PW_API_LOOP_IMPL int pw_loop_signal(struct pw_loop *object, bool wait_for_accept)
{
return spa_loop_control_signal(object->control, wait_for_accept);
}
PW_API_LOOP_IMPL int pw_loop_accept(struct pw_loop *object)
{
return spa_loop_control_accept(object->control);
}
PW_API_LOOP_IMPL struct spa_source *
pw_loop_add_io(struct pw_loop *object, int fd, uint32_t mask,
bool close, spa_source_io_func_t func, void *data)
{
return spa_loop_utils_add_io(object->utils, fd, mask, close, func, data);
}
PW_API_LOOP_IMPL int pw_loop_update_io(struct pw_loop *object,
struct spa_source *source, uint32_t mask)
{
return spa_loop_utils_update_io(object->utils, source, mask);
}
PW_API_LOOP_IMPL struct spa_source *
pw_loop_add_idle(struct pw_loop *object, bool enabled,
spa_source_idle_func_t func, void *data)
{
return spa_loop_utils_add_idle(object->utils, enabled, func, data);
}
PW_API_LOOP_IMPL int pw_loop_enable_idle(struct pw_loop *object,
struct spa_source *source, bool enabled)
{
return spa_loop_utils_enable_idle(object->utils, source, enabled);
}
PW_API_LOOP_IMPL struct spa_source *
pw_loop_add_event(struct pw_loop *object, spa_source_event_func_t func, void *data)
{
return spa_loop_utils_add_event(object->utils, func, data);
}
PW_API_LOOP_IMPL int pw_loop_signal_event(struct pw_loop *object,
struct spa_source *source)
{
return spa_loop_utils_signal_event(object->utils, source);
}
PW_API_LOOP_IMPL struct spa_source *
pw_loop_add_timer(struct pw_loop *object, spa_source_timer_func_t func, void *data)
{
return spa_loop_utils_add_timer(object->utils, func, data);
}
PW_API_LOOP_IMPL int pw_loop_update_timer(struct pw_loop *object,
struct spa_source *source, struct timespec *value,
struct timespec *interval, bool absolute)
{
return spa_loop_utils_update_timer(object->utils, source, value, interval, absolute);
}
PW_API_LOOP_IMPL struct spa_source *
pw_loop_add_signal(struct pw_loop *object, int signal_number,
spa_source_signal_func_t func, void *data)
{
return spa_loop_utils_add_signal(object->utils, signal_number, func, data);
}
PW_API_LOOP_IMPL void pw_loop_destroy_source(struct pw_loop *object,
struct spa_source *source)
{
spa_loop_utils_destroy_source(object->utils, source);
}
#ifdef __cplusplus
}
#endif
#endif /* PIPEWIRE_LOOP_H */
seq
uint32_t int seq
Definition core.h:432
pw_loop_signal_event
PW_API_LOOP_IMPL int pw_loop_signal_event(struct pw_loop *object, struct spa_source *source)
Definition loop.h:160
pw_loop_enter
PW_API_LOOP_IMPL void pw_loop_enter(struct pw_loop *object)
Definition loop.h:89
pw_loop_invoke
PW_API_LOOP_IMPL int pw_loop_invoke(struct pw_loop *object, spa_invoke_func_t func, uint32_t seq, const void *data, size_t size, bool block, void *user_data)
Definition loop.h:66
pw_loop_get_time
PW_API_LOOP_IMPL int pw_loop_get_time(struct pw_loop *object, struct timespec *abstime, int64_t timeout)
Definition loop.h:114
pw_loop_destroy_source
PW_API_LOOP_IMPL void pw_loop_destroy_source(struct pw_loop *object, struct spa_source *source)
Definition loop.h:182
pw_loop_add_io
PW_API_LOOP_IMPL struct spa_source * pw_loop_add_io(struct pw_loop *object, int fd, uint32_t mask, bool close, spa_source_io_func_t func, void *data)
Definition loop.h:134
pw_loop_lock
PW_API_LOOP_IMPL int pw_loop_lock(struct pw_loop *object)
Definition loop.h:106
pw_loop_signal
PW_API_LOOP_IMPL int pw_loop_signal(struct pw_loop *object, bool wait_for_accept)
Definition loop.h:122
pw_loop_enable_idle
PW_API_LOOP_IMPL int pw_loop_enable_idle(struct pw_loop *object, struct spa_source *source, bool enabled)
Definition loop.h:150
pw_loop_add_source
PW_API_LOOP_IMPL int pw_loop_add_source(struct pw_loop *object, struct spa_source *source)
Definition loop.h:54
pw_loop_accept
PW_API_LOOP_IMPL int pw_loop_accept(struct pw_loop *object)
Definition loop.h:126
pw_loop_update_timer
PW_API_LOOP_IMPL int pw_loop_update_timer(struct pw_loop *object, struct spa_source *source, struct timespec *value, struct timespec *interval, bool absolute)
Definition loop.h:170
pw_loop_unlock
PW_API_LOOP_IMPL int pw_loop_unlock(struct pw_loop *object)
Definition loop.h:110
pw_loop_add_signal
PW_API_LOOP_IMPL struct spa_source * pw_loop_add_signal(struct pw_loop *object, int signal_number, spa_source_signal_func_t func, void *data)
Definition loop.h:177
pw_loop_add_idle
PW_API_LOOP_IMPL struct spa_source * pw_loop_add_idle(struct pw_loop *object, bool enabled, spa_source_idle_func_t func, void *data)
Definition loop.h:145
pw_loop_remove_source
PW_API_LOOP_IMPL int pw_loop_remove_source(struct pw_loop *object, struct spa_source *source)
Definition loop.h:62
pw_loop_add_timer
PW_API_LOOP_IMPL struct spa_source * pw_loop_add_timer(struct pw_loop *object, spa_source_timer_func_t func, void *data)
Definition loop.h:166
pw_loop_set_name
int pw_loop_set_name(struct pw_loop *loop, const char *name)
Definition loop.c:176
PW_API_LOOP_IMPL
#define PW_API_LOOP_IMPL
Definition loop.h:43
pw_loop_wait
PW_API_LOOP_IMPL int pw_loop_wait(struct pw_loop *object, const struct timespec *abstime)
Definition loop.h:118
pw_loop_leave
PW_API_LOOP_IMPL void pw_loop_leave(struct pw_loop *object)
Definition loop.h:93
pw_loop_locked
PW_API_LOOP_IMPL int pw_loop_locked(struct pw_loop *object, spa_invoke_func_t func, uint32_t seq, const void *data, size_t size, void *user_data)
Definition loop.h:72
pw_loop_add_hook
PW_API_LOOP_IMPL void pw_loop_add_hook(struct pw_loop *object, struct spa_hook *hook, const struct spa_loop_control_hooks *hooks, void *data)
Definition loop.h:83
pw_loop_new
struct pw_loop * pw_loop_new(const struct spa_dict *props)
Create a new loop.
Definition loop.c:41
pw_loop_get_fd
PW_API_LOOP_IMPL int pw_loop_get_fd(struct pw_loop *object)
Definition loop.h:79
pw_loop_check
PW_API_LOOP_IMPL int pw_loop_check(struct pw_loop *object)
Definition loop.h:102
pw_loop_iterate
PW_API_LOOP_IMPL int pw_loop_iterate(struct pw_loop *object, int timeout)
Definition loop.h:97
pw_loop_destroy
void pw_loop_destroy(struct pw_loop *loop)
Destroy a loop.
Definition loop.c:157
pw_loop_update_source
PW_API_LOOP_IMPL int pw_loop_update_source(struct pw_loop *object, struct spa_source *source)
Definition loop.h:58
pw_loop_add_event
PW_API_LOOP_IMPL struct spa_source * pw_loop_add_event(struct pw_loop *object, spa_source_event_func_t func, void *data)
Definition loop.h:156
pw_loop_update_io
PW_API_LOOP_IMPL int pw_loop_update_io(struct pw_loop *object, struct spa_source *source, uint32_t mask)
Definition loop.h:139
spa_loop_invoke
SPA_API_LOOP int spa_loop_invoke(struct spa_loop *object, spa_invoke_func_t func, uint32_t seq, const void *data, size_t size, bool block, void *user_data)
Definition loop.h:191
spa_loop_utils_add_idle
SPA_API_LOOP struct spa_source * spa_loop_utils_add_idle(struct spa_loop_utils *object, bool enabled, spa_source_idle_func_t func, void *data)
Definition loop.h:531
spa_loop_utils_add_signal
SPA_API_LOOP struct spa_source * spa_loop_utils_add_signal(struct spa_loop_utils *object, int signal_number, spa_source_signal_func_t func, void *data)
Definition loop.h:570
spa_loop_control_accept
SPA_API_LOOP int spa_loop_control_accept(struct spa_loop_control *object)
Definition loop.h:461
spa_loop_add_source
SPA_API_LOOP int spa_loop_add_source(struct spa_loop *object, struct spa_source *source)
Definition loop.h:176
spa_source_timer_func_t
void(* spa_source_timer_func_t)(void *data, uint64_t expirations)
Definition loop.h:470
spa_loop_utils_add_timer
SPA_API_LOOP struct spa_source * spa_loop_utils_add_timer(struct spa_loop_utils *object, spa_source_timer_func_t func, void *data)
Definition loop.h:556
spa_loop_control_get_fd
SPA_API_LOOP int spa_loop_control_get_fd(struct spa_loop_control *object)
Definition loop.h:397
spa_loop_control_enter
SPA_API_LOOP void spa_loop_control_enter(struct spa_loop_control *object)
Definition loop.h:409
spa_loop_control_signal
SPA_API_LOOP int spa_loop_control_signal(struct spa_loop_control *object, bool wait_for_accept)
Definition loop.h:456
spa_loop_remove_source
SPA_API_LOOP int spa_loop_remove_source(struct spa_loop *object, struct spa_source *source)
Definition loop.h:186
spa_loop_utils_update_timer
SPA_API_LOOP int spa_loop_utils_update_timer(struct spa_loop_utils *object, struct spa_source *source, struct timespec *value, struct timespec *interval, bool absolute)
Definition loop.h:561
spa_loop_utils_enable_idle
SPA_API_LOOP int spa_loop_utils_enable_idle(struct spa_loop_utils *object, struct spa_source *source, bool enabled)
Definition loop.h:537
spa_source_event_func_t
void(* spa_source_event_func_t)(void *data, uint64_t count)
Definition loop.h:469
spa_source_signal_func_t
void(* spa_source_signal_func_t)(void *data, int signal_number)
Definition loop.h:471
spa_loop_control_iterate_fast
SPA_API_LOOP int spa_loop_control_iterate_fast(struct spa_loop_control *object, int timeout)
Definition loop.h:423
spa_loop_control_add_hook
SPA_API_LOOP void spa_loop_control_add_hook(struct spa_loop_control *object, struct spa_hook *hook, const struct spa_loop_control_hooks *hooks, void *data)
Definition loop.h:402
spa_loop_control_wait
SPA_API_LOOP int spa_loop_control_wait(struct spa_loop_control *object, const struct timespec *abstime)
Definition loop.h:450
spa_source_idle_func_t
void(* spa_source_idle_func_t)(void *data)
Definition loop.h:468
spa_loop_control_unlock
SPA_API_LOOP int spa_loop_control_unlock(struct spa_loop_control *object)
Definition loop.h:439
spa_loop_utils_destroy_source
SPA_API_LOOP void spa_loop_utils_destroy_source(struct spa_loop_utils *object, struct spa_source *source)
Definition loop.h:577
spa_loop_control_check
SPA_API_LOOP int spa_loop_control_check(struct spa_loop_control *object)
Definition loop.h:429
spa_loop_utils_add_event
SPA_API_LOOP struct spa_source * spa_loop_utils_add_event(struct spa_loop_utils *object, spa_source_event_func_t func, void *data)
Definition loop.h:544
spa_loop_control_get_time
SPA_API_LOOP int spa_loop_control_get_time(struct spa_loop_control *object, struct timespec *abstime, int64_t timeout)
Definition loop.h:444
spa_invoke_func_t
int(* spa_invoke_func_t)(struct spa_loop *loop, bool async, uint32_t seq, const void *data, size_t size, void *user_data)
Definition loop.h:78
spa_source_io_func_t
void(* spa_source_io_func_t)(void *data, int fd, uint32_t mask)
Definition loop.h:467
spa_loop_control_lock
SPA_API_LOOP int spa_loop_control_lock(struct spa_loop_control *object)
Definition loop.h:434
spa_loop_utils_signal_event
SPA_API_LOOP int spa_loop_utils_signal_event(struct spa_loop_utils *object, struct spa_source *source)
Definition loop.h:549
spa_loop_utils_update_io
SPA_API_LOOP int spa_loop_utils_update_io(struct spa_loop_utils *object, struct spa_source *source, uint32_t mask)
Definition loop.h:524
spa_loop_control_leave
SPA_API_LOOP void spa_loop_control_leave(struct spa_loop_control *object)
Definition loop.h:413
spa_loop_locked
SPA_API_LOOP int spa_loop_locked(struct spa_loop *object, spa_invoke_func_t func, uint32_t seq, const void *data, size_t size, void *user_data)
Definition loop.h:199
spa_loop_update_source
SPA_API_LOOP int spa_loop_update_source(struct spa_loop *object, struct spa_source *source)
Definition loop.h:181
spa_loop_utils_add_io
SPA_API_LOOP struct spa_source * spa_loop_utils_add_io(struct spa_loop_utils *object, int fd, uint32_t mask, bool close, spa_source_io_func_t func, void *data)
Definition loop.h:518
loop.h
spa/support/loop.h
pw_loop
Definition loop.h:33
pw_loop::loop
struct spa_loop * loop
wrapped loop
Definition loop.h:35
pw_loop::control
struct spa_loop_control * control
loop control
Definition loop.h:36
pw_loop::system
struct spa_system * system
system utils
Definition loop.h:34
spa_dict
Definition dict.h:51
spa_hook
A hook, contains the structure with functions and the data passed to the functions.
Definition hook.h:427
spa_loop_control_hooks
Control hooks.
Definition loop.h:212
spa_loop_utils
Definition loop.h:60
spa_source
Definition loop.h:67
spa_source::mask
uint32_t mask
Definition loop.h:72
spa_source::func
spa_source_func_t func
Definition loop.h:69
spa_source::fd
int fd
Definition loop.h:71
dict.h
spa/utils/dict.h