Go to the documentation of this file.
25 #ifndef PIPEWIRE_IMPL_LINK_H
26 #define PIPEWIRE_IMPL_LINK_H
48 #define PW_VERSION_IMPL_LINK_EVENTS 0
77 struct pw_impl_port *output,
78 struct pw_impl_port *input,
81 size_t user_data_size );
116 struct pw_impl_link *
pw_impl_link_find(
struct pw_impl_port *output,
struct pw_impl_port *input);
int pw_global_update_permissions(struct pw_global *global, struct pw_impl_client *client, uint32_t old_permissions, uint32_t new_permissions)
Definition: global.c:314
@ PW_IMPL_PORT_STATE_INIT
the port is being created
Definition: impl-port.h:51
#define PW_DIRECTION_INPUT
Definition: port.h:57
int int const char * pw_properties_get(const struct pw_properties *properties, const char *key)
Get a property.
Definition: properties.c:487
struct pw_global * pw_impl_link_get_global(struct pw_impl_link *link)
Get the global of the link.
Definition: impl-link.c:1389
Definition: module-filter-chain.c:176
void pw_work_queue_destroy(struct pw_work_queue *queue)
Destroy a work queue.
Definition: work-queue.c:132
#define PW_LINK_CHANGE_MASK_STATE
Definition: link.h:77
pw_impl_port_state
Definition: impl-port.h:49
int pw_context_find_format(struct pw_context *context, struct pw_impl_port *output, struct pw_impl_port *input, struct pw_properties *props, uint32_t n_format_filters, struct spa_pod **format_filters, struct spa_pod **format, struct spa_pod_builder *builder, char **error)
Find a common format between two ports.
Definition: context.c:800
void(* pw_work_func_t)(void *obj, void *data, int res, uint32_t id)
Definition: work-queue.h:43
struct pw_impl_link * pw_context_create_link(struct pw_context *context, struct pw_impl_port *output, struct pw_impl_port *input, struct spa_pod *format_filter, struct pw_properties *properties, size_t user_data_size)
Make a new link between two ports.
Definition: impl-link.c:1065
void pw_impl_link_destroy(struct pw_impl_link *link)
Destroy a link.
Definition: impl-link.c:1307
#define PW_KEY_OBJECT_ID
a global object id
Definition: src/pipewire/keys.h:66
int pw_control_remove_link(struct pw_control_link *link)
Definition: control.c:237
int pw_impl_port_set_param(struct pw_impl_port *port, uint32_t id, uint32_t flags, const struct spa_pod *param)
Definition: impl-port.c:1365
int pw_global_register(struct pw_global *global)
Register a global object to the context registry.
Definition: global.c:125
struct spa_list link
link in struct endpoint_link link_list or struct impl link_list
Definition: module-filter-chain.c:177
@ PW_LINK_STATE_NEGOTIATING
the link is negotiating formats
Definition: link.h:62
#define PW_KEY_MODULE_ID
module properties
Definition: src/pipewire/keys.h:249
#define PW_LINK_CHANGE_MASK_ALL
Definition: link.h:80
int pw_context_recalc_graph(struct pw_context *context, const char *reason)
Definition: context.c:1092
#define PW_TYPE_INTERFACE_Link
Definition: link.h:52
@ SPA_PARAM_Latency
latency reporting, a SPA_TYPE_OBJECT_ParamLatency
Definition: param.h:59
void(* initialized)(void *data)
a Link is initialized
Definition: impl-link.h:58
user data to add to an object
Definition: filter.c:75
struct pw_global * pw_global_new(struct pw_context *context, const char *type, uint32_t version, struct pw_properties *properties, pw_global_bind_func_t func, void *object)
Create a new global object.
Definition: global.c:66
uint8_t data[MAX_BUFFER]
Definition: module-profiler.c:87
int pw_global_add_resource(struct pw_global *global, struct pw_resource *resource)
Add a resource to a global.
Definition: global.c:230
#define PW_KEY_OBJECT_PATH
object properties
Definition: src/pipewire/keys.h:65
#define spa_list_for_each(pos, head, member)
Definition: list.h:111
const char * pw_node_state_as_string(enum pw_node_state state)
Convert a pw_node_state to a readable string.
Definition: introspect.c:34
@ PW_LINK_STATE_PAUSED
the link is paused
Definition: link.h:64
link events added with pw_impl_link_add_listener
Definition: impl-link.h:47
uint32_t pw_global_get_permissions(struct pw_global *global, struct pw_impl_client *client)
Get the permissions of the global for a given client.
Definition: global.c:45
const char * error
an error reason if state is error
Definition: link.h:83
Port events, use pw_impl_port_add_listener.
Definition: impl-port.h:58
struct pw_impl_link * pw_impl_link_find(struct pw_impl_port *output_port, struct pw_impl_port *input_port)
Find the link between 2 ports.
Definition: impl-link.c:1359
#define spa_aprintf(_fmt,...)
Definition: defs.h:323
#define SPA_EXPORT
Definition: defs.h:208
@ PW_NODE_STATE_IDLE
the node is running but there is no active port
Definition: src/pipewire/node.h:61
@ SPA_DIRECTION_INPUT
Definition: defs.h:79
struct port * output
Definition: module-filter-chain.c:182
Global events, use pw_global_add_listener.
Definition: global.h:68
int seq
Definition: policy-ep.c:65
int pw_impl_link_register(struct pw_impl_link *link, struct pw_properties *properties)
Finish link configuration and register.
Definition: impl-link.c:1243
#define pw_log_trace(...)
Definition: src/pipewire/log.h:90
#define PW_KEY_LINK_FEEDBACK
indicate that a link is a feedback link and the target will receive data in the next cycle
Definition: src/pipewire/keys.h:205
void(* free)(void *data)
A link is freed.
Definition: impl-link.h:55
int pw_impl_port_recalc_latency(struct pw_impl_port *port)
Definition: impl-port.c:1301
struct spa_hook listener
Definition: access-flatpak.c:46
#define pw_link_resource_info(r,...)
Definition: impl-link.c:46
@ PW_NODE_STATE_ERROR
error state
Definition: src/pipewire/node.h:57
int pw_work_queue_complete(struct pw_work_queue *queue, void *obj, uint32_t seq, int res)
Complete a work item.
Definition: work-queue.c:247
int spa_node_port_enum_params_sync(struct spa_node *node, enum spa_direction direction, uint32_t port_id, uint32_t id, uint32_t *index, const struct spa_pod *filter, struct spa_pod **param, struct spa_pod_builder *builder)
Definition: build-12775836/doc/spa/node/utils.h:92
int pw_buffers_negotiate(struct pw_context *context, uint32_t flags, struct spa_node *outnode, uint32_t out_port_id, struct spa_node *innode, uint32_t in_port_id, struct pw_buffers *result)
Definition: buffers.c:238
int pw_impl_port_use_buffers(struct pw_impl_port *port, struct pw_impl_port_mix *mix, uint32_t flags, struct spa_buffer **buffers, uint32_t n_buffers)
Definition: impl-port.c:1485
void spa_hook_list_append(struct spa_hook_list *list, struct spa_hook *hook, const void *funcs, void *data)
Append a hook.
Definition: hook.h:316
void(* port_unlinked)(void *data, struct pw_impl_port *port)
A port is unlinked.
Definition: impl-link.h:69
#define SPA_PTROFF(ptr_, offset_, type_)
Return the address (buffer + offset) as pointer of type.
Definition: defs.h:159
struct spa_node * node
Definition: buffers.c:45
@ PW_IMPL_PORT_STATE_ERROR
the port is in error
Definition: impl-port.h:50
#define SPA_POD_OBJECT_ID(obj)
Definition: pod/pod.h:167
#define SPA_RESULT_IS_ERROR(res)
Definition: result.h:45
int pw_control_add_link(struct pw_control *control, uint32_t cmix, struct pw_control *other, uint32_t omix, struct pw_control_link *link)
Definition: control.c:166
#define SPA_POD_BUILDER_INIT(buffer, size)
Definition: builder.h:71
#define PW_VERSION_LINK
Definition: link.h:54
struct spa_audio_info_raw info
Definition: module-echo-cancel.c:145
void * data
Definition: builder.h:64
Definition: build-12775836/doc/spa/support/loop.h:44
struct spa_dict dict
dictionary of key/values
Definition: properties.h:50
#define PW_VERSION_IMPL_PORT_EVENTS
Definition: impl-port.h:59
#define SPA_CONTAINER_OF(p, t, m)
Definition: defs.h:170
@ SPA_PARAM_Format
configured format as SPA_TYPE_OBJECT_Format
Definition: param.h:48
uint32_t version
Definition: impl-link.h:49
int pw_context_debug_port_params(struct pw_context *this, struct spa_node *node, enum spa_direction direction, uint32_t port_id, uint32_t id, int err, const char *debug,...)
Definition: context.c:745
IO area to exchange buffers.
Definition: io.h:93
struct pw_port * port
Definition: filter.c:96
struct spa_pod * spa_pod_copy(const struct spa_pod *pod)
Copy a pod structure.
Definition: builder.h:676
#define PW_KEY_LINK_INPUT_NODE
input node id of a link
Definition: src/pipewire/keys.h:198
@ SPA_IO_Buffers
area to exchange buffers, struct spa_io_buffers
Definition: io.h:53
int pw_impl_node_set_state(struct pw_impl_node *node, enum pw_node_state state)
Set the node state.
Definition: impl-node.c:2057
void pw_global_add_listener(struct pw_global *global, struct spa_hook *listener, const struct pw_global_events *events, void *data)
Add an event listener on the global.
Definition: global.c:255
#define spa_node_port_set_io(n,...)
Definition: build-12775836/doc/spa/node/node.h:660
#define PW_DIRECTION_OUTPUT
Definition: port.h:58
int spa_pod_fixate(struct spa_pod *pod)
Definition: iter.h:442
#define NAME
Definition: impl-link.c:42
@ PW_LINK_STATE_ERROR
the link is in error
Definition: link.h:59
struct port * input
Definition: module-filter-chain.c:183
void spa_list_remove(struct spa_list *elem)
Definition: list.h:69
#define SPA_FLAG_SET(field, flag)
Definition: defs.h:74
#define PW_KEY_LINK_INPUT_PORT
input port id of a link
Definition: src/pipewire/keys.h:199
@ PW_LINK_STATE_ALLOCATING
the link is allocating buffers
Definition: link.h:63
#define SPA_RESULT_IS_OK(res)
Definition: result.h:44
const char * pw_link_state_as_string(enum pw_link_state state)
Convert a pw_link_state to a readable string.
Definition: introspect.c:64
void(* destroy)(void *data)
A link is destroyed.
Definition: impl-link.h:52
enum pw_link_state state
the current state of the link
Definition: link.h:82
#define PW_KEY_FACTORY_ID
Factory properties.
Definition: src/pipewire/keys.h:259
A hook, contains the structure with functions and the data passed to the functions.
Definition: hook.h:295
#define PW_VERSION_IMPL_NODE_EVENTS
Definition: impl-node.h:52
struct pw_impl_port * pw_impl_link_get_output(struct pw_impl_link *link)
Get the output port of the link.
Definition: impl-link.c:1395
struct pw_loop * loop
Definition: module-protocol-simple.c:86
#define PW_BUFFERS_FLAG_SHARED
buffers can be shared
Definition: buffers.h:39
Node events, listen to them with pw_impl_node_add_listener.
Definition: impl-node.h:51
@ PW_LINK_STATE_INIT
the link is initialized
Definition: link.h:61
#define SPA_PORT_FLAG_LIVE
output buffers from this port are timestamped against a live clock.
Definition: build-12775836/doc/spa/node/node.h:110
int spa_pod_compare(const struct spa_pod *pod1, const struct spa_pod *pod2)
Definition: compare.h:99
@ SPA_LOG_LEVEL_DEBUG
Definition: build-12775836/doc/spa/support/log.h:51
#define SPA_FLAG_IS_SET(field, flag)
Definition: defs.h:73
#define PW_KEY_LINK_OUTPUT_PORT
output port id of a link
Definition: src/pipewire/keys.h:201
void spa_pod_builder_init(struct spa_pod_builder *builder, void *data, uint32_t size)
Definition: builder.h:96
#define SPA_RESULT_IS_ASYNC(res)
Definition: result.h:46
@ SPA_DIRECTION_OUTPUT
Definition: defs.h:80
int pw_impl_port_init_mix(struct pw_impl_port *port, struct pw_impl_port_mix *mix)
Definition: impl-port.c:207
@ PW_NODE_STATE_SUSPENDED
the node is suspended, the device might be closed
Definition: src/pipewire/node.h:59
void pw_impl_port_add_listener(struct pw_impl_port *port, struct spa_hook *listener, const struct pw_impl_port_events *events, void *data)
Add an event listener on the port.
Definition: impl-port.c:691
uint32_t port_id
Definition: buffers.c:47
void pw_buffers_clear(struct pw_buffers *buffers)
Definition: buffers.c:356
#define SPA_RESULT_ASYNC_SEQ(res)
Definition: result.h:48
@ SPA_LOG_LEVEL_ERROR
Definition: build-12775836/doc/spa/support/log.h:48
int pw_global_update_keys(struct pw_global *global, const struct spa_dict *dict, const char *const keys[])
Update the global properties, must be done when unregistered.
Definition: global.c:209
@ SPA_PARAM_EnumFormat
available formats as SPA_TYPE_OBJECT_Format
Definition: param.h:47
#define spa_strerror(err)
Definition: result.h:51
struct pw_work_queue * work
Definition: module-echo-cancel.c:136
struct pw_resource * pw_resource_new(struct pw_impl_client *client, uint32_t id, uint32_t permissions, const char *type, uint32_t version, size_t user_data_size)
Make a new resource for client.
Definition: resource.c:43
struct pw_impl_port * pw_impl_link_get_input(struct pw_impl_link *link)
Get the input port of the link.
Definition: impl-link.c:1401
void pw_impl_port_update_state(struct pw_impl_port *port, enum pw_impl_port_state state, int res, char *error)
Definition: impl-port.c:106
@ PW_IMPL_PORT_STATE_CONFIGURE
the port is ready for format negotiation
Definition: impl-port.h:52
uint32_t pw_work_queue_add(struct pw_work_queue *queue, void *obj, int res, pw_work_func_t func, void *data)
Add an item to the work queue.
Definition: work-queue.c:162
#define pw_log_debug(...)
Definition: src/pipewire/log.h:89
Definition: module-protocol-native.c:103
const struct spa_type_info spa_type_io[]
Definition: node/type-info.h:46
#define PW_KEY_LINK_OUTPUT_NODE
output node id of a link
Definition: src/pipewire/keys.h:200
#define SPA_FALLTHROUGH
SPA_FALLTHROUGH is an annotation to suppress compiler warnings about switch cases that fall through w...
Definition: defs.h:69
#define spa_node_sync(n,...)
Definition: build-12775836/doc/spa/node/node.h:650
void pw_global_destroy(struct pw_global *global)
Destroy a global.
Definition: global.c:369
@ PW_LINK_STATE_ACTIVE
the link is active
Definition: link.h:65
#define PW_VERSION_GLOBAL_EVENTS
Definition: global.h:69
#define SPA_ID_INVALID
Definition: defs.h:182
void pw_impl_link_add_listener(struct pw_impl_link *link, struct spa_hook *listener, const struct pw_impl_link_events *events, void *data)
Add an event listener to link.
Definition: impl-link.c:1350
int pw_properties_set(struct pw_properties *properties, const char *key, const char *value)
Set a property value.
Definition: properties.c:435
#define PW_KEY_CLIENT_ID
Client properties.
Definition: src/pipewire/keys.h:131
#define PW_LINK_CHANGE_MASK_FORMAT
Definition: link.h:78
void(* info_changed)(void *data, const struct pw_link_info *info)
The info changed on a link.
Definition: impl-link.h:61
void pw_resource_error(struct pw_resource *resource, int res, const char *error)
Generate an error for a resource.
Definition: resource.c:255
#define pw_log_warn(...)
Definition: src/pipewire/log.h:87
#define PW_BUFFERS_FLAG_NO_MEM
don't allocate buffer memory
Definition: buffers.h:38
struct pw_context * pw_impl_link_get_context(struct pw_impl_link *link)
Get the context of a link.
Definition: impl-link.c:1371
struct pw_properties * properties
Definition: module-access.c:141
The link information.
Definition: link.h:71
int pw_impl_port_release_mix(struct pw_impl_port *port, struct pw_impl_port_mix *mix)
Definition: impl-port.c:252
struct pw_control this
Definition: control.c:34
#define pw_loop_invoke(l,...)
Definition: src/pipewire/loop.h:63
int pw_impl_link_activate(struct pw_impl_link *this)
Definition: impl-link.c:542
const struct spa_type_info spa_type_param[]
Definition: param/type-info.h:46
int pw_impl_link_prepare(struct pw_impl_link *this)
Definition: impl-link.c:678
void spa_hook_remove(struct spa_hook *hook)
Remove a hook.
Definition: hook.h:336
#define pw_log_info(...)
Definition: src/pipewire/log.h:88
void(* state_changed)(void *data, enum pw_link_state old, enum pw_link_state state, const char *error)
The link state changed, error is only valid when the state is in error.
Definition: impl-link.h:65
@ PW_IMPL_PORT_STATE_PAUSED
the port is paused
Definition: impl-port.h:54
struct pw_work_queue * pw_work_queue_new(struct pw_loop *loop)
Create a new PipeWire Work Queue Object.
Definition: work-queue.c:98
#define PW_KEY_LINK_PASSIVE
indicate that a link is passive and does not cause the graph to be runnable.
Definition: src/pipewire/keys.h:202
void spa_hook_list_init(struct spa_hook_list *list)
Initialize a hook list to the empty list.
Definition: hook.h:305
pw_link_state
The different link states.
Definition: link.h:58
void pw_impl_node_add_listener(struct pw_impl_node *node, struct spa_hook *listener, const struct pw_impl_node_events *events, void *data)
Add an event listener.
Definition: impl-node.c:1692
uint32_t size
Definition: builder.h:65
int pw_work_queue_cancel(struct pw_work_queue *queue, void *obj, uint32_t id)
Cancel a work item.
Definition: work-queue.c:216
#define SPA_NODE_BUFFERS_FLAG_ALLOC
flags to pass to the use_buffers functions
Definition: build-12775836/doc/spa/node/node.h:256
#define SPA_PORT_FLAG_CAN_ALLOC_BUFFERS
the port can allocate buffer data
Definition: build-12775836/doc/spa/node/node.h:103
const char * pw_direction_as_string(enum pw_direction direction)
Convert a pw_direction to a readable string.
Definition: introspect.c:52
int pw_impl_link_deactivate(struct pw_impl_link *this)
Definition: impl-link.c:729
#define SPA_IO_BUFFERS_INIT
Definition: io.h:103
#define MAX_HOPS
Definition: impl-link.c:44
const struct pw_link_info * pw_impl_link_get_info(struct pw_impl_link *link)
Get the link info.
Definition: impl-link.c:1383
struct pw_properties * pw_properties_new(const char *key,...) 1
Make a new properties object.
Definition: properties.c:98
int pw_properties_setf(struct pw_properties *properties, const char *key, const char *format,...) 1(3
enum spa_direction direction
Definition: buffers.c:46
uint32_t id
Definition: filter.c:94
void * pw_impl_link_get_user_data(struct pw_impl_link *link)
Get the user_data of a link, the size of the memory is given when constructing the link.
Definition: impl-link.c:1377
Definition: properties.h:49
void spa_hook_list_clean(struct spa_hook_list *list)
Remove all hooks from the list.
Definition: hook.h:344
void pw_properties_free(struct pw_properties *properties)
Free a properties object.
Definition: properties.c:364
#define pw_log_error(...)
Definition: src/pipewire/log.h:86
const char * spa_debug_type_find_name(const struct spa_type_info *info, uint32_t type)
Definition: types.h:68
@ PW_IMPL_PORT_STATE_READY
the port is ready for buffer allocation
Definition: impl-port.h:53
#define spa_list_append(list, item)
Definition: list.h:81