PipeWire  0.3.20
impl-port.h
Go to the documentation of this file.
1 /* PipeWire
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 PIPEWIRE_IMPL_PORT_H
26 #define PIPEWIRE_IMPL_PORT_H
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 #include <spa/utils/hook.h>
33 
44 struct pw_impl_port;
45 struct pw_impl_link;
46 struct pw_control;
47 
48 #include <pipewire/impl.h>
49 
56 };
57 
60 #define PW_VERSION_IMPL_PORT_EVENTS 1
61  uint32_t version;
62 
64  void (*destroy) (void *data);
65 
67  void (*free) (void *data);
68 
70  void (*initialized) (void *data);
71 
73  void (*info_changed) (void *data, const struct pw_port_info *info);
74 
76  void (*link_added) (void *data, struct pw_impl_link *link);
77 
79  void (*link_removed) (void *data, struct pw_impl_link *link);
80 
82  void (*state_changed) (void *data, enum pw_impl_port_state old,
83  enum pw_impl_port_state state, const char *error);
84 
86  void (*control_added) (void *data, struct pw_control *control);
87 
89  void (*control_removed) (void *data, struct pw_control *control);
90 
92  void (*param_changed) (void *data, uint32_t id);
93 };
94 
97 struct pw_impl_port *
98 pw_context_create_port(struct pw_context *context,
99  enum pw_direction direction,
100  uint32_t port_id,
101  const struct spa_port_info *info,
102  size_t user_data_size);
103 
106 
109 
111 int pw_impl_port_update_properties(struct pw_impl_port *port, const struct spa_dict *dict);
112 
114 const struct pw_port_info *pw_impl_port_get_info(struct pw_impl_port *port);
115 
117 uint32_t pw_impl_port_get_id(struct pw_impl_port *port);
118 
121 
124 
126 int pw_impl_port_add(struct pw_impl_port *port, struct pw_impl_node *node);
127 
130  struct spa_hook *listener,
131  const struct pw_impl_port_events *events,
132  void *data);
133 
134 #ifdef __cplusplus
135 }
136 #endif
137 
138 #endif /* PIPEWIRE_IMPL_PORT_H */
the PipeWire context
The control object.
PipeWire node class.
The port object.
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:395
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:872
static uint32_t id
Definition: core.h:325
int pw_impl_port_update_properties(struct pw_impl_port *port, const struct spa_dict *dict)
Update the port properties.
Definition: impl-port.c:619
pw_impl_port_state
Definition: impl-port.h:50
@ PW_IMPL_PORT_STATE_READY
the port is ready for buffer allocation
Definition: impl-port.h:54
@ PW_IMPL_PORT_STATE_ERROR
the port is in error
Definition: impl-port.h:51
@ PW_IMPL_PORT_STATE_INIT
the port is being created
Definition: impl-port.h:52
@ PW_IMPL_PORT_STATE_PAUSED
the port is paused
Definition: impl-port.h:55
@ PW_IMPL_PORT_STATE_CONFIGURE
the port is ready for format negotiation
Definition: impl-port.h:53
const struct pw_properties * pw_impl_port_get_properties(struct pw_impl_port *port)
Get the port properties.
Definition: impl-port.c:613
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:1239
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:635
enum pw_direction pw_impl_port_get_direction(struct pw_impl_port *port)
Get the port direction.
Definition: impl-port.c:601
uint32_t pw_impl_port_get_id(struct pw_impl_port *port)
Get the port id.
Definition: impl-port.c:607
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:641
const struct pw_port_info * pw_impl_port_get_info(struct pw_impl_port *port)
Get the port info.
Definition: impl-port.c:650
#define pw_direction
Definition: port.h:47
Definition: stream.c:85
Definition: filter.c:74
Definition: buffers.c:44
Port events, use pw_impl_port_add_listener.
Definition: impl-port.h:59
void(* control_added)(void *data, struct pw_control *control)
a control was added to the port
Definition: impl-port.h:86
void(* destroy)(void *data)
The port is destroyed.
Definition: impl-port.h:64
void(* info_changed)(void *data, const struct pw_port_info *info)
the port info changed
Definition: impl-port.h:73
void(* free)(void *data)
The port is freed.
Definition: impl-port.h:67
void(* link_added)(void *data, struct pw_impl_link *link)
a new link is added on this port
Definition: impl-port.h:76
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:82
uint32_t version
Definition: impl-port.h:61
void(* param_changed)(void *data, uint32_t id)
a parameter changed, since version 1
Definition: impl-port.h:92
void(* initialized)(void *data)
The port is initialized.
Definition: impl-port.h:70
void(* control_removed)(void *data, struct pw_control *control)
a control was removed from the port
Definition: impl-port.h:89
void(* link_removed)(void *data, struct pw_impl_link *link)
a link is removed from this port
Definition: impl-port.h:79
Definition: port.h:61
A collection of key/value pairs.
Definition: properties.h:45
struct spa_dict dict
dictionary of key/values
Definition: properties.h:46