PipeWire  0.1.5
port.h
Go to the documentation of this file.
1 /* PipeWire
2  * Copyright (C) 2015 Wim Taymans <wim.taymans@gmail.com>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  */
19 
20 #ifndef __PIPEWIRE_PORT_H__
21 #define __PIPEWIRE_PORT_H__
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 #define PW_TYPE__Port "PipeWire:Object:Port"
28 #define PW_TYPE_PORT_BASE PW_TYPE__Port ":"
29 
30 #include <spa/hook.h>
31 #include <spa/node.h>
32 #include <spa/buffer.h>
33 
44 struct pw_port;
45 struct pw_link;
46 
47 #include <pipewire/core.h>
48 #include <pipewire/introspect.h>
49 #include <pipewire/node.h>
50 
58 };
59 
62 #define PW_VERSION_PORT_EVENTS 0
63  uint32_t version;
64 
66  void (*destroy) (void *data);
67 
69  void (*free) (void *data);
70 
72  void (*link_added) (void *data, struct pw_link *link);
73 
75  void (*link_removed) (void *data, struct pw_link *link);
76 
78  void (*state_changed) (void *data, enum pw_port_state state);
79 
81  void (*properties_changed) (void *data, const struct pw_properties *properties);
82 };
83 
85 enum pw_direction pw_port_get_direction(struct pw_port *port);
86 
88 const struct pw_properties *pw_port_get_properties(struct pw_port *port);
89 
91 void pw_port_update_properties(struct pw_port *port, const struct spa_dict *dict);
92 
94 uint32_t pw_port_get_id(struct pw_port *port);
95 
97 struct pw_node *pw_port_get_node(struct pw_port *port);
98 
100 void pw_port_add_listener(struct pw_port *port,
101  struct spa_hook *listener,
102  const struct pw_port_events *events,
103  void *data);
104 
105 #ifdef __cplusplus
106 }
107 #endif
108 
109 #endif /* __PIPEWIRE_PORT_H__ */
A collection of key/value pairs.
Definition: properties.h:38
uint32_t pw_port_get_id(struct pw_port *port)
Get the port id.
Definition: port.c:209
void(* link_added)(void *data, struct pw_link *link)
a new link is added on this port
Definition: port.h:72
struct spa_dict dict
Definition: properties.h:39
the port is ready for format negotiation
Definition: port.h:54
void pw_port_add_listener(struct pw_port *port, struct spa_hook *listener, const struct pw_port_events *events, void *data)
Add an event listener on the port.
Definition: port.c:234
void(* properties_changed)(void *data, const struct pw_properties *properties)
the properties of the port changed
Definition: port.h:81
uint32_t version
Definition: port.h:63
const struct pw_properties * pw_port_get_properties(struct pw_port *port)
Get the port properties.
Definition: port.c:214
void pw_port_update_properties(struct pw_port *port, const struct spa_dict *dict)
Update the port properties.
Definition: port.c:219
Port events, use pw_port_add_listener.
Definition: port.h:61
the port is in error
Definition: port.h:52
pw_port_state
Definition: port.h:51
the port is streaming
Definition: port.h:57
the port is paused
Definition: port.h:56
void(* free)(void *data)
The port is freed.
Definition: port.h:69
the port is ready for buffer allocation
Definition: port.h:55
void(* state_changed)(void *data, enum pw_port_state state)
the state of the port changed
Definition: port.h:78
void(* destroy)(void *data)
The port is destroyed.
Definition: port.h:66
enum pw_direction pw_port_get_direction(struct pw_port *port)
Get the port direction.
Definition: port.c:204
PipeWire node class.
struct pw_node * pw_port_get_node(struct pw_port *port)
Get the port parent node or NULL when not yet set.
Definition: port.c:229
the port is being created
Definition: port.h:53
void(* link_removed)(void *data, struct pw_link *link)
a link is removed from this port
Definition: port.h:75
The port object.
pw_direction
The direction of a port.
Definition: introspect.h:47