Loading...
Searching...
No Matches
impl-port.h
Go to the documentation of this file.
/* PipeWire */
/* SPDX-FileCopyrightText: Copyright © 2018 Wim Taymans */
/* SPDX-License-Identifier: MIT */
#ifndef PIPEWIRE_IMPL_PORT_H
#define PIPEWIRE_IMPL_PORT_H
#include <spa/utils/hook.h>
#ifdef __cplusplus
extern "C" {
#endif
struct pw_impl_port;
struct pw_impl_link;
struct pw_control;
#include <pipewire/impl.h>
enum pw_impl_port_state {
PW_IMPL_PORT_STATE_ERROR = -1,
PW_IMPL_PORT_STATE_INIT = 0,
PW_IMPL_PORT_STATE_CONFIGURE = 1,
PW_IMPL_PORT_STATE_READY = 2,
PW_IMPL_PORT_STATE_PAUSED = 3,
};
struct pw_impl_port_events {
#define PW_VERSION_IMPL_PORT_EVENTS 4
uint32_t version;
void (*destroy) (void *data);
/** The port is freed */
void (*free) (void *data);
void (*initialized) (void *data);
void (*info_changed) (void *data, const struct pw_port_info *info);
void (*link_added) (void *data, struct pw_impl_link *link);
void (*link_removed) (void *data, struct pw_impl_link *link);
void (*state_changed) (void *data, enum pw_impl_port_state old,
enum pw_impl_port_state state, const char *error);
void (*control_added) (void *data, struct pw_control *control);
void (*control_removed) (void *data, struct pw_control *control);
void (*param_changed) (void *data, uint32_t id);
void (*latency_changed) (void *data);
void (*tag_changed) (void *data);
void (*capability_changed) (void *data);
};
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);
enum pw_direction pw_impl_port_get_direction(struct pw_impl_port *port);
const struct pw_properties *pw_impl_port_get_properties(struct pw_impl_port *port);
int pw_impl_port_update_properties(struct pw_impl_port *port, const struct spa_dict *dict);
const struct pw_port_info *pw_impl_port_get_info(struct pw_impl_port *port);
uint32_t pw_impl_port_get_id(struct pw_impl_port *port);
const char *pw_impl_port_state_as_string(enum pw_impl_port_state state);
struct pw_impl_node *pw_impl_port_get_node(struct pw_impl_port *port);
int pw_impl_port_is_linked(struct pw_impl_port *port);
int pw_impl_port_add(struct pw_impl_port *port, struct pw_impl_node *node);
void pw_impl_port_add_listener(struct pw_impl_port *port,
struct spa_hook *listener,
const struct pw_impl_port_events *events,
void *data);
#ifdef __cplusplus
}
#endif
#endif /* PIPEWIRE_IMPL_PORT_H */
id
uint32_t id
Definition core.h:432
pw_context_create_port
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:947
pw_impl_port_update_properties
int pw_impl_port_update_properties(struct pw_impl_port *port, const struct spa_dict *dict)
Update the port properties.
Definition impl-port.c:1193
pw_impl_port_state
pw_impl_port_state
Definition impl-port.h:36
pw_impl_port_is_linked
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:2026
pw_impl_port_get_properties
const struct pw_properties * pw_impl_port_get_properties(struct pw_impl_port *port)
Get the port properties.
Definition impl-port.c:1187
pw_impl_port_add
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:1423
pw_impl_port_get_node
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:1207
pw_impl_port_get_direction
enum pw_direction pw_impl_port_get_direction(struct pw_impl_port *port)
Get the port direction.
Definition impl-port.c:1175
pw_impl_port_state_as_string
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:107
pw_impl_port_get_id
uint32_t pw_impl_port_get_id(struct pw_impl_port *port)
Get the port id.
Definition impl-port.c:1181
pw_impl_port_add_listener
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:1213
pw_impl_port_get_info
const struct pw_port_info * pw_impl_port_get_info(struct pw_impl_port *port)
Get the port info.
Definition impl-port.c:1222
PW_IMPL_PORT_STATE_READY
@ PW_IMPL_PORT_STATE_READY
the port is ready for buffer allocation
Definition impl-port.h:40
PW_IMPL_PORT_STATE_ERROR
@ PW_IMPL_PORT_STATE_ERROR
the port is in error
Definition impl-port.h:37
PW_IMPL_PORT_STATE_INIT
@ PW_IMPL_PORT_STATE_INIT
the port is being created
Definition impl-port.h:38
PW_IMPL_PORT_STATE_PAUSED
@ PW_IMPL_PORT_STATE_PAUSED
the port is paused
Definition impl-port.h:41
PW_IMPL_PORT_STATE_CONFIGURE
@ PW_IMPL_PORT_STATE_CONFIGURE
the port is ready for format negotiation
Definition impl-port.h:39
pw_direction
#define pw_direction
The direction of a port.
Definition port.h:51
hook.h
spa/utils/hook.h
impl.h
pipewire/impl.h
pw_context
pw_control
pw_impl_link
pw_impl_node
pw_impl_port_events
Port events, use pw_impl_port_add_listener.
Definition impl-port.h:45
pw_impl_port_events::control_added
void(* control_added)(void *data, struct pw_control *control)
a control was added to the port
Definition impl-port.h:73
pw_impl_port_events::destroy
void(* destroy)(void *data)
The port is destroyed.
Definition impl-port.h:51
pw_impl_port_events::info_changed
void(* info_changed)(void *data, const struct pw_port_info *info)
the port info changed
Definition impl-port.h:60
pw_impl_port_events::free
void(* free)(void *data)
The port is freed.
Definition impl-port.h:54
pw_impl_port_events::link_added
void(* link_added)(void *data, struct pw_impl_link *link)
a new link is added on this port
Definition impl-port.h:63
pw_impl_port_events::latency_changed
void(* latency_changed)(void *data)
latency changed.
Definition impl-port.h:82
pw_impl_port_events::state_changed
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
pw_impl_port_events::version
uint32_t version
Definition impl-port.h:48
pw_impl_port_events::capability_changed
void(* capability_changed)(void *data)
capability changed.
Definition impl-port.h:86
pw_impl_port_events::param_changed
void(* param_changed)(void *data, uint32_t id)
a parameter changed, since version 1
Definition impl-port.h:79
pw_impl_port_events::initialized
void(* initialized)(void *data)
The port is initialized.
Definition impl-port.h:57
pw_impl_port_events::control_removed
void(* control_removed)(void *data, struct pw_control *control)
a control was removed from the port
Definition impl-port.h:76
pw_impl_port_events::tag_changed
void(* tag_changed)(void *data)
tag changed.
Definition impl-port.h:84
pw_impl_port_events::link_removed
void(* link_removed)(void *data, struct pw_impl_link *link)
a link is removed from this port
Definition impl-port.h:66
pw_impl_port
pw_port_info
Definition port.h:60
pw_properties
Definition properties.h:39
pw_properties::dict
struct spa_dict dict
dictionary of key/values
Definition properties.h:40
spa_dict
Definition dict.h:51
spa_hook
A hook, contains the structure with functions and the data passed to the functions.
Definition hook.h:427
spa_port_info
Port information structure.
Definition node.h:103