PipeWire 1.1.0
Loading...
Searching...
No Matches
impl-port.h
Go to the documentation of this file.
1/* PipeWire */
2/* SPDX-FileCopyrightText: Copyright © 2018 Wim Taymans */
3/* SPDX-License-Identifier: MIT */
4
5#ifndef PIPEWIRE_IMPL_PORT_H
6#define PIPEWIRE_IMPL_PORT_H
7
8#ifdef __cplusplus
9extern "C" {
10#endif
11
12#include <spa/utils/hook.h>
13
23struct pw_impl_port;
24struct pw_impl_link;
25struct pw_control;
26
27#include <pipewire/impl.h>
28
35};
39#define PW_VERSION_IMPL_PORT_EVENTS 3
40 uint32_t version;
43 void (*destroy) (void *data);
44
46 void (*free) (void *data);
49 void (*initialized) (void *data);
50
52 void (*info_changed) (void *data, const struct pw_port_info *info);
53
55 void (*link_added) (void *data, struct pw_impl_link *link);
56
58 void (*link_removed) (void *data, struct pw_impl_link *link);
59
61 void (*state_changed) (void *data, enum pw_impl_port_state old,
62 enum pw_impl_port_state state, const char *error);
65 void (*control_added) (void *data, struct pw_control *control);
68 void (*control_removed) (void *data, struct pw_control *control);
71 void (*param_changed) (void *data, uint32_t id);
72
74 void (*latency_changed) (void *data);
76 void (*tag_changed) (void *data);
77};
78
81struct pw_impl_port *
83 enum pw_direction direction,
84 uint32_t port_id,
85 const struct spa_port_info *info,
86 size_t user_data_size);
87
90
93
95int pw_impl_port_update_properties(struct pw_impl_port *port, const struct spa_dict *dict);
96
98const struct pw_port_info *pw_impl_port_get_info(struct pw_impl_port *port);
99
101uint32_t pw_impl_port_get_id(struct pw_impl_port *port);
102
105
108
110int pw_impl_port_is_linked(struct pw_impl_port *port);
111
113int pw_impl_port_add(struct pw_impl_port *port, struct pw_impl_node *node);
114
117 struct spa_hook *listener,
118 const struct pw_impl_port_events *events,
119 void *data);
120
125#ifdef __cplusplus
126}
127#endif
128
129#endif /* PIPEWIRE_IMPL_PORT_H */
struct pw_impl_port * pw_context_create_port(struct pw_context *context, enum pw_direction direction, uint32_t port_id, const struct spa_port_info *info, size_t user_data_size)
Create a new port.
Definition impl-port.c:569
int pw_impl_port_update_properties(struct pw_impl_port *port, const struct spa_dict *dict)
Update the port properties.
Definition impl-port.c:808
pw_impl_port_state
Definition impl-port.h:36
int pw_impl_port_is_linked(struct pw_impl_port *port)
check is a port has links, return 0 if not, 1 if it is linked
Definition impl-port.c:1698
const struct pw_properties * pw_impl_port_get_properties(struct pw_impl_port *port)
Get the port properties.
Definition impl-port.c:802
int pw_impl_port_add(struct pw_impl_port *port, struct pw_impl_node *node)
Add a port to a node.
Definition impl-port.c:1068
struct pw_impl_node * pw_impl_port_get_node(struct pw_impl_port *port)
Get the port parent node or NULL when not yet set.
Definition impl-port.c:822
enum pw_direction pw_impl_port_get_direction(struct pw_impl_port *port)
Get the port direction.
Definition impl-port.c:790
const char * pw_impl_port_state_as_string(enum pw_impl_port_state state)
Get the port state as a string.
Definition impl-port.c:76
uint32_t pw_impl_port_get_id(struct pw_impl_port *port)
Get the port id.
Definition impl-port.c:796
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:828
const struct pw_port_info * pw_impl_port_get_info(struct pw_impl_port *port)
Get the port info.
Definition impl-port.c:837
@ PW_IMPL_PORT_STATE_READY
the port is ready for buffer allocation
Definition impl-port.h:40
@ PW_IMPL_PORT_STATE_ERROR
the port is in error
Definition impl-port.h:37
@ PW_IMPL_PORT_STATE_INIT
the port is being created
Definition impl-port.h:38
@ PW_IMPL_PORT_STATE_PAUSED
the port is paused
Definition impl-port.h:41
@ PW_IMPL_PORT_STATE_CONFIGURE
the port is ready for format negotiation
Definition impl-port.h:39
#define pw_direction
The direction of a port.
Definition port.h:46
spa/utils/hook.h
pipewire/impl.h
Port events, use pw_impl_port_add_listener.
Definition impl-port.h:45
void(* control_added)(void *data, struct pw_control *control)
a control was added to the port
Definition impl-port.h:73
void(* destroy)(void *data)
The port is destroyed.
Definition impl-port.h:51
void(* info_changed)(void *data, const struct pw_port_info *info)
the port info changed
Definition impl-port.h:60
void(* free)(void *data)
The port is freed.
Definition impl-port.h:54
void(* link_added)(void *data, struct pw_impl_link *link)
a new link is added on this port
Definition impl-port.h:63
void(* latency_changed)(void *data)
latency changed.
Definition impl-port.h:82
void(* state_changed)(void *data, enum pw_impl_port_state old, enum pw_impl_port_state state, const char *error)
the state of the port changed
Definition impl-port.h:69
uint32_t version
Definition impl-port.h:48
void(* param_changed)(void *data, uint32_t id)
a parameter changed, since version 1
Definition impl-port.h:79
void(* initialized)(void *data)
The port is initialized.
Definition impl-port.h:57
void(* control_removed)(void *data, struct pw_control *control)
a control was removed from the port
Definition impl-port.h:76
void(* tag_changed)(void *data)
tag changed.
Definition impl-port.h:84
void(* link_removed)(void *data, struct pw_impl_link *link)
a link is removed from this port
Definition impl-port.h:66
Definition port.h:55
Definition properties.h:33
struct spa_dict dict
dictionary of key/values
Definition properties.h:34
Definition dict.h:39
A hook, contains the structure with functions and the data passed to the functions.
Definition hook.h:350
Port information structure.
Definition node.h:93