Go to the documentation of this file.
20 #ifndef __PIPEWIRE_PORT_H__
21 #define __PIPEWIRE_PORT_H__
27 #define PW_TYPE__Port "PipeWire:Object:Port"
28 #define PW_TYPE_PORT_BASE PW_TYPE__Port ":"
30 #include <spa/utils/hook.h>
61 #define PW_VERSION_PORT_EVENTS 0
106 struct spa_hook *listener,
SPA_EXPORT int pw_global_register(struct pw_global *global, struct pw_client *owner, struct pw_global *parent)
register a global to the core registry
Definition: global.c:102
SPA_EXPORT 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:278
const struct pw_properties * pw_port_get_properties(struct pw_port *port)
Get the port properties.
Definition: port.c:246
void(* link_removed)(void *data, struct pw_link *link)
a link is removed from this port
Definition: port.h:77
int pw_port_use_buffers(struct pw_port *port, struct spa_buffer **buffers, uint32_t n_buffers)
Definition: port.c:696
static void pw_map_remove(struct pw_map *map, uint32_t id)
Remove an item at index.
Definition: map.h:140
an output port direction
Definition: introspect.h:49
SPA_EXPORT void pw_global_destroy(struct pw_global *global)
Destroy a global.
Definition: global.c:241
static void pw_map_init(struct pw_map *map, size_t size, size_t extend)
Initialize a map.
Definition: map.h:70
PipeWire client object class.
an input port direction
Definition: introspect.h:48
uint32_t version
Definition: port.h:62
struct spa_hook resource_listener
Definition: factory.c:27
Port events, use pw_port_add_listener.
Definition: port.h:60
Global events, use pw_global_add_listener.
Definition: global.h:59
void pw_resource_set_implementation(struct pw_resource *resource, const void *implementation, void *data)
Set the resource implementation.
Definition: resource.c:128
const char * pw_direction_as_string(enum pw_direction direction)
Convert a pw_direction to a readable string.
Definition: introspect.c:45
struct spa_type_map * map
the type mapper
Definition: type.h:52
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:190
pw_direction
Definition: introspect.h:47
enum pw_direction pw_port_get_direction(struct pw_port *port)
Get the port direction.
Definition: port.c:234
the port is in error
Definition: port.h:51
A global object visible to remote clients.
void(* link_added)(void *data, struct pw_link *link)
a new link is added on this port
Definition: port.h:74
PipeWire type support struct.
Definition: type.h:51
struct spa_dict dict
Definition: properties.h:39
uint32_t core
Definition: type.h:54
uint32_t n_params
Definition: port.c:640
the port is ready for buffer allocation
Definition: port.h:54
SPA_EXPORT int pw_port_update_properties(struct pw_port *port, const struct spa_dict *dict)
Update the port properties.
Definition: port.c:252
SPA_EXPORT struct pw_global * pw_global_new(struct pw_core *core, uint32_t type, uint32_t version, struct pw_properties *properties, void *object)
Create a new global.
Definition: global.c:61
struct spa_type_io io
Definition: type.h:70
Definition: introspect.h:168
struct pw_port * in_port
Definition: port.c:634
int pw_port_register(struct pw_port *port, struct pw_client *owner, struct pw_global *parent, struct pw_properties *properties)
Definition: port.c:402
int pw_port_update_properties(struct pw_port *port, const struct spa_dict *dict)
Update the port properties.
Definition: port.c:252
SPA_EXPORT int pw_properties_setf(struct pw_properties *properties, const char *key, const char *format,...)
Set a property value by format.
Definition: properties.c:338
void pw_log_trace(const char *format,...)
#define PW_VERSION_PORT
Definition: interfaces.h:561
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:278
int pw_port_for_each_filtered_param(struct pw_port *in_port, struct pw_port *out_port, uint32_t in_param_id, uint32_t out_param_id, int(*callback)(void *data, uint32_t id, uint32_t index, uint32_t next, struct spa_pod *param), void *data)
Definition: port.c:650
struct pw_resource * pw_resource_new(struct pw_client *client, uint32_t id, uint32_t permissions, uint32_t type, uint32_t version, size_t user_data_size)
Make a new resource for client.
Definition: resource.c:34
int pw_port_send_command(struct pw_port *port, bool block, const struct spa_command *command)
Definition: port.c:593
void pw_control_destroy(struct pw_control *control)
Definition: control.c:85
#define PW_VERSION_RESOURCE_EVENTS
Definition: resource.h:63
int pw_port_for_each_param(struct pw_port *port, uint32_t param_id, uint32_t index, uint32_t max, const struct spa_pod *filter, int(*callback)(void *data, uint32_t id, uint32_t index, uint32_t next, struct spa_pod *param), void *data)
Definition: port.c:599
void(* destroy)(void *data)
The port is destroyed.
Definition: port.h:65
void * data
Definition: port.c:639
int pw_port_set_param(struct pw_port *port, uint32_t id, uint32_t flags, const struct spa_pod *param)
Definition: port.c:671
#define PW_PORT_CHANGE_MASK_PROPS
Definition: introspect.h:171
struct pw_control * pw_control_new(struct pw_core *core, struct pw_port *port, const struct spa_pod *param, size_t user_data_size)
Definition: control.c:32
void(* info_changed)(void *data, struct pw_port_info *info)
the port info changed
Definition: port.h:71
void * pw_resource_get_user_data(struct pw_resource *resource)
Get the user data for the resource, the size was given in pw_resource_new.
Definition: resource.c:113
SPA_EXPORT enum pw_direction pw_port_get_direction(struct pw_port *port)
Get the port direction.
Definition: port.c:234
#define PW_NODE_CHANGE_MASK_OUTPUT_PORTS
Definition: introspect.h:146
the port is being created
Definition: port.h:52
#define PW_VERSION_NODE_PROXY_METHODS
Definition: interfaces.h:535
uint32_t out_param_id
Definition: port.c:637
static void pw_map_clear(struct pw_map *map)
Clear a map.
Definition: map.h:81
uint32_t in_param_id
Definition: port.c:636
Port methods.
Definition: interfaces.h:608
const SPA_EXPORT char * pw_properties_get(const struct pw_properties *properties, const char *key)
Get a property.
Definition: properties.c:361
SPA_EXPORT const struct pw_properties * pw_port_get_properties(struct pw_port *port)
Get the port properties.
Definition: port.c:246
SPA_EXPORT uint32_t pw_port_get_id(struct pw_port *port)
Get the port id.
Definition: port.c:240
void pw_port_destroy(struct pw_port *port)
Definition: port.c:546
SPA_EXPORT struct pw_properties * pw_properties_copy(const struct pw_properties *properties)
Copy a properties object.
Definition: properties.c:183
SPA_EXPORT int pw_properties_set(struct pw_properties *properties, const char *key, const char *value)
Set a property value.
Definition: properties.c:308
void pw_resource_destroy(struct pw_resource *resource)
Destroy a resource.
Definition: resource.c:169
int pw_port_add(struct pw_port *port, struct pw_node *node)
Definition: port.c:422
int pw_port_alloc_buffers(struct pw_port *port, struct spa_pod **params, uint32_t n_params, struct spa_buffer **buffers, uint32_t *n_buffers)
Definition: port.c:727
void(* state_changed)(void *data, enum pw_port_state state)
the state of the port changed
Definition: port.h:80
#define PW_VERSION_GLOBAL_EVENTS
Definition: global.h:60
struct pw_port * pw_port_new(enum pw_direction direction, uint32_t port_id, struct pw_properties *properties, size_t user_data_size)
Definition: port.c:163
void(* free)(void *data)
The port is freed.
Definition: port.h:68
the port is paused
Definition: port.h:55
#define pw_port_resource_param(r,...)
Definition: interfaces.h:602
struct spa_type_param param
Definition: type.h:71
struct pw_port * out_port
Definition: port.c:635
#define pw_core_resource_error(r,...)
Definition: interfaces.h:338
struct spa_type_param_io param_io
Definition: type.h:79
struct pw_control this
Definition: control.c:26
#define PW_NODE_CHANGE_MASK_INPUT_PORTS
Definition: introspect.h:145
the port is streaming
Definition: port.h:56
uint32_t version
Definition: interfaces.h:610
uint32_t node
Definition: type.h:56
SPA_EXPORT struct pw_properties * pw_properties_new(const char *key,...)
Make a new properties object.
Definition: properties.c:89
void pw_log_error(const char *format,...)
int(* callback)(void *data, uint32_t id, uint32_t index, uint32_t next, struct spa_pod *param)
Definition: port.c:638
pw_port_state
Definition: port.h:50
void(* control_added)(void *data, struct pw_control *control)
a control was added to the port
Definition: port.h:83
void pw_port_unlink(struct pw_port *port)
Definition: port.c:491
static bool pw_map_insert_at(struct pw_map *map, uint32_t id, void *data)
Insert data in the map at an index.
Definition: map.h:119
uint32_t pw_port_get_id(struct pw_port *port)
Get the port id.
Definition: port.c:240
#define pw_loop_invoke(l,...)
Definition: loop.h:52
#define pw_port_resource_info(r,...)
Definition: interfaces.h:601
void pw_link_destroy(struct pw_link *link)
Destroy a link.
Definition: link.c:1331
SPA_EXPORT 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:284
Resource events.
Definition: resource.h:62
void pw_resource_add_listener(struct pw_resource *resource, struct spa_hook *listener, const struct pw_resource_events *events, void *data)
Add an event listener.
Definition: resource.c:119
uint32_t port
Definition: type.h:57
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:284
void pw_log_debug(const char *format,...)
the port is ready for format negotiation
Definition: port.h:53
void * pw_port_get_user_data(struct pw_port *port)
Definition: port.c:292
A collection of key/value pairs.
Definition: properties.h:38
SPA_EXPORT void pw_properties_free(struct pw_properties *properties)
Free a properties object.
Definition: properties.c:245
void(* control_removed)(void *data, struct pw_control *control)
a control was removed from the port
Definition: port.h:86