Go to the documentation of this file.
25 #ifndef PIPEWIRE_PORT_H
26 #define PIPEWIRE_PORT_H
50 #define PW_TYPE_INTERFACE_Port PW_TYPE_INFO_INTERFACE_BASE "Port"
52 #define PW_VERSION_PORT 3
56 #define pw_direction spa_direction
57 #define PW_DIRECTION_INPUT SPA_DIRECTION_INPUT
58 #define PW_DIRECTION_OUTPUT SPA_DIRECTION_OUTPUT
66 #define PW_PORT_CHANGE_MASK_PROPS (1 << 0)
67 #define PW_PORT_CHANGE_MASK_PARAMS (1 << 1)
68 #define PW_PORT_CHANGE_MASK_ALL ((1 << 2)-1)
82 #define PW_PORT_EVENT_INFO 0
83 #define PW_PORT_EVENT_PARAM 1
84 #define PW_PORT_EVENT_NUM 2
88 #define PW_VERSION_PORT_EVENTS 0
107 void (*
param) (
void *object,
int seq,
108 uint32_t
id, uint32_t index, uint32_t next,
112 #define PW_PORT_METHOD_ADD_LISTENER 0
113 #define PW_PORT_METHOD_SUBSCRIBE_PARAMS 1
114 #define PW_PORT_METHOD_ENUM_PARAMS 2
115 #define PW_PORT_METHOD_NUM 3
119 #define PW_VERSION_PORT_METHODS 0
150 uint32_t id, uint32_t
start, uint32_t num,
154 #define pw_port_method(o,method,version,...) \
156 int _res = -ENOTSUP; \
157 spa_interface_call_res((struct spa_interface*)o, \
158 struct pw_port_methods, _res, \
159 method, version, ##__VA_ARGS__); \
163 #define pw_port_add_listener(c,...) pw_port_method(c,add_listener,0,__VA_ARGS__)
164 #define pw_port_subscribe_params(c,...) pw_port_method(c,subscribe_params,0,__VA_ARGS__)
165 #define pw_port_enum_params(c,...) pw_port_method(c,enum_params,0,__VA_ARGS__)
#define NAME
Definition: policy-node.c:49
#define PW_KEY_STREAM_DONT_REMIX
don't remix channels
Definition: src/pipewire/keys.h:272
#define PW_DIRECTION_INPUT
Definition: port.h:57
struct spa_list node_list
Definition: policy-node.c:86
int int const char * pw_properties_get(const struct pw_properties *properties, const char *key)
Get a property.
Definition: properties.c:487
struct spa_dict * props
the properties of the node
Definition: src/pipewire/node.h:85
Audio information description.
Definition: audio/raw.h:285
Definition: module-filter-chain.c:176
Definition: pod/pod.h:175
uint32_t rate
Definition: audio/raw.h:288
#define PW_KEY_MEDIA_ROLE
Role: Movie, Music, Camera, Screen, Communication, Game, Notification, DSP, Production,...
Definition: src/pipewire/keys.h:281
uint32_t client_id
Definition: policy-ep.c:79
bool exclusive
Definition: policy-ep.c:262
struct spa_audio_info format
Definition: alsa-endpoint.c:86
#define NODE_TYPE_UNKNOWN
Definition: policy-node.c:113
struct impl * impl
Definition: alsa-endpoint.c:67
uint32_t media_type
Definition: policy-ep.c:88
#define SPA_POD_Pod(val)
Definition: vararg.h:100
#define NODE_TYPE_DEVICE
Definition: policy-node.c:115
#define SPA_POD_Int(val)
Definition: vararg.h:59
#define spa_zero(x)
Definition: defs.h:303
@ SPA_TYPE_OBJECT_Format
Definition: build-12775836/doc/spa/utils/type.h:90
const char * link_group
Definition: policy-node.c:556
Port methods.
Definition: port.h:118
char * key
Definition: policy-node.c:68
The core information.
Definition: core.h:73
int connect_count
Definition: policy-node.c:121
unsigned int configured
Definition: policy-node.c:127
enum pw_direction direction
Definition: alsa-monitor.c:69
@ SPA_PARAM_PORT_CONFIG_format
(Object) format filter
Definition: param.h:151
uint64_t change_mask
bitfield of changed fields since last call
Definition: port.h:69
uint32_t linked
Definition: policy-ep.c:77
enum pw_direction direction
port direction
Definition: port.h:65
@ SPA_TYPE_Id
Definition: build-12775836/doc/spa/utils/type.h:47
int spa_json_enter_object(struct spa_json *iter, struct spa_json *sub)
Definition: json.h:214
void pw_port_info_free(struct pw_port_info *info)
Definition: introspect.c:283
uint32_t n_params
number of items in params
Definition: port.h:72
@ PW_NODE_STATE_RUNNING
the node is running
Definition: src/pipewire/node.h:63
struct spa_list link
link in impl node_list
Definition: module-filter-chain.c:156
user data to add to an object
Definition: filter.c:75
uint8_t data[MAX_BUFFER]
Definition: module-profiler.c:87
uint32_t version
Definition: port.h:89
bool spa_streq(const char *s1, const char *s2)
Definition: string.h:50
#define spa_list_for_each(pos, head, member)
Definition: list.h:111
unsigned int linking_node_removed
Definition: policy-node.c:88
struct sm_node * obj
Definition: bluez-autoswitch.c:79
struct spa_pod * spa_format_audio_raw_build(struct spa_pod_builder *builder, uint32_t id, struct spa_audio_info_raw *info)
Definition: audio/format-utils.h:72
Port events.
Definition: port.h:87
int32_t priority
Definition: policy-node.c:111
int seq
Definition: policy-ep.c:65
char * media
Definition: stream-endpoint.c:70
struct spa_hook listener
Definition: access-flatpak.c:46
Definition: alsa-monitor.c:82
Definition: module-filter-chain.c:155
struct spa_hook listener
Definition: bluez-autoswitch.c:81
char * config
Definition: policy-node.c:71
struct spa_audio_info_raw raw
Definition: param/audio/format.h:44
struct sm_endpoint_stream * obj
Definition: policy-ep.c:99
@ SPA_PARAM_PORT_CONFIG_direction
direction, input/output (Id enum spa_direction)
Definition: param.h:147
uint64_t plugged
Definition: policy-ep.c:264
#define DEFAULT_CONFIG_AUDIO_SOURCE_KEY
Definition: policy-node.c:58
#define PW_KEY_NODE_DONT_RECONNECT
don't reconnect this node
Definition: src/pipewire/keys.h:165
#define DEFAULT_AUDIO_SOURCE
Definition: policy-node.c:62
int spa_pod_object_fixate(struct spa_pod_object *pod)
Definition: iter.h:431
#define DEFAULT_VIDEO_SOURCE_KEY
Definition: policy-node.c:56
#define PW_KEY_NODE_LINK_GROUP
the node is internally linked to nodes with the same link-group
Definition: src/pipewire/keys.h:179
@ SPA_MEDIA_TYPE_audio
Definition: param/format.h:42
bool spa_strstartswith(const char *s, const char *prefix)
Definition: string.h:71
enum spa_audio_format format
Definition: audio/raw.h:286
int32_t priority
Definition: policy-ep.c:80
uint32_t id
Definition: module-echo-cancel.c:139
#define SPA_POD_OPT_Int(val)
Definition: parser.h:521
#define PW_KEY_NODE_AUTOCONNECT
node wants to be automatically connected to a compatible node
Definition: src/pipewire/keys.h:150
unsigned int exclusive
Definition: policy-ep.c:93
struct spa_audio_info_raw info
Definition: module-echo-cancel.c:145
#define ENDPOINT_TYPE_STREAM
Definition: policy-ep.c:83
@ SPA_PARAM_PORT_CONFIG_MODE_dsp
dsp configuration, depending on the external format.
Definition: param.h:139
#define SESSION_KEY
Definition: policy-node.c:50
uint32_t channels
Definition: audio/raw.h:289
struct spa_dict * props
the properties of the port
Definition: port.h:70
struct spa_list endpoint_list
Definition: policy-ep.c:64
unsigned int busy
Definition: policy-ep.c:95
#define DEFAULT_AUDIO_SOURCE_KEY
Definition: policy-node.c:55
@ SPA_PARAM_Format
configured format as SPA_TYPE_OBJECT_Format
Definition: param.h:48
int failed_count
Definition: policy-node.c:122
enum pw_direction pw_direction_reverse(enum pw_direction direction)
Reverse the direction.
Definition: pipewire.c:729
struct impl * impl
Definition: alsa-monitor.c:68
unsigned int active
Definition: policy-node.c:124
#define PW_KEY_LINK_INPUT_NODE
input node id of a link
Definition: src/pipewire/keys.h:198
int sm_policy_ep_start(struct sm_media_session *session)
Definition: policy-ep.c:514
Definition: module-link-factory.c:298
int priority
Definition: policy-ep.c:263
unsigned int enabled
Definition: policy-node.c:126
#define PW_DIRECTION_OUTPUT
Definition: port.h:58
uint64_t plugged
Definition: policy-ep.c:92
#define pw_client_error(c,...)
Definition: client.h:170
unsigned char active
Definition: bluez-autoswitch.c:82
void spa_list_remove(struct spa_list *elem)
Definition: list.h:69
struct timespec now
Definition: default-profile.c:87
#define PW_KEY_STREAM_CAPTURE_SINK
Try to capture the sink output instead of source output.
Definition: src/pipewire/keys.h:273
#define SPA_FLAG_SET(field, flag)
Definition: defs.h:74
bool streams_follow_default
Definition: policy-node.c:93
#define SPA_AUDIO_MAX_CHANNELS
Definition: audio/raw.h:43
#define PW_KEY_LINK_INPUT_PORT
input port id of a link
Definition: src/pipewire/keys.h:199
struct node * failed_peer
Definition: policy-node.c:108
#define PW_TYPE_INTERFACE_Node
Definition: src/pipewire/node.h:50
char * media
Definition: policy-ep.c:86
uint32_t version
Definition: port.h:120
#define SPA_TIMESPEC_TO_NSEC(ts)
Definition: defs.h:191
@ SPA_PARAM_PORT_CONFIG_monitor
(Bool) enable monitor output ports on input ports
Definition: param.h:149
struct node * peer
Definition: policy-node.c:107
@ SPA_PARAM_PortConfig
port configuration as SPA_TYPE_OBJECT_ParamPortConfig
Definition: param.h:55
#define PW_KEY_NODE_NAME
node name
Definition: src/pipewire/keys.h:138
#define PW_KEY_DEVICE_API
API this device is accessed with.
Definition: src/pipewire/keys.h:217
A hook, contains the structure with functions and the data passed to the functions.
Definition: hook.h:295
#define DEFAULT_CONFIG_VIDEO_SOURCE_KEY
Definition: policy-node.c:59
enum pw_direction direction
Definition: policy-ep.c:75
#define PW_KEY_NODE_PLUGGED
when the node was created.
Definition: src/pipewire/keys.h:142
@ SPA_AUDIO_CHANNEL_FL
front left
Definition: audio/raw.h:174
struct spa_param_info * params
parameters
Definition: port.h:71
@ SPA_FORMAT_AUDIO_rate
sample rate (Int)
Definition: param/format.h:109
void spa_json_init(struct spa_json *iter, const char *data, size_t size)
Definition: json.h:59
uint32_t flags
Definition: audio/raw.h:287
@ SPA_LOG_LEVEL_DEBUG
Definition: build-12775836/doc/spa/support/log.h:51
struct impl * impl
Definition: restore-stream.c:78
information about a parameter
Definition: param.h:64
void spa_list_init(struct spa_list *list)
Definition: list.h:44
struct spa_node * node
Definition: alsa-monitor.c:76
#define PW_KEY_LINK_OUTPUT_PORT
output port id of a link
Definition: src/pipewire/keys.h:201
#define DEFAULT_AUDIO_SINK
Definition: policy-node.c:61
uint32_t media_subtype
Definition: param/audio/format.h:42
void spa_pod_builder_init(struct spa_pod_builder *builder, void *data, uint32_t size)
Definition: builder.h:96
#define PW_KEY_STREAM_MONITOR
Indicates that the stream is monitoring and might select a less accurate but faster conversion algori...
Definition: src/pipewire/keys.h:269
#define pw_log_level_enabled(lev)
Check if a loglevel is enabled.
Definition: src/pipewire/log.h:78
struct impl * impl
Definition: policy-ep.c:259
Definition: utils/dict.h:48
#define PW_KEY_NODE_TARGET
node wants to be connected to the target node/session
Definition: src/pipewire/keys.h:152
#define DEFAULT_VIDEO_SOURCE
Definition: policy-node.c:63
unsigned int enabled
Definition: policy-ep.c:94
#define SPA_POD_Bool(val)
Definition: vararg.h:53
#define pw_node_set_param(c,...)
Definition: src/pipewire/node.h:201
struct spa_audio_info format
Definition: stream-endpoint.c:74
Definition: bluez-autoswitch.c:86
const char * spa_dict_lookup(const struct spa_dict *dict, const char *key)
Definition: utils/dict.h:99
#define SESSION_KEY
Definition: policy-ep.c:49
int spa_json_get_string(struct spa_json *iter, char *res, int maxlen)
Definition: json.h:360
struct node * node
Definition: policy-node.c:553
Definition: param/audio/format.h:40
unsigned int monitor
Definition: policy-node.c:129
@ SPA_PARAM_EnumFormat
available formats as SPA_TYPE_OBJECT_Format
Definition: param.h:47
void(* info)(void *object, const struct pw_port_info *info)
Notify port info.
Definition: port.h:95
#define spa_pod_parse_object(pod, type, id,...)
Definition: parser.h:560
Definition: policy-node.c:67
struct spa_list link
link in impl endpoint_list
Definition: alsa-endpoint.c:65
#define PW_ID_CORE
default ID for the core object after connect
Definition: core.h:66
uint32_t client_id
Definition: policy-node.c:110
#define DEFAULT_CONFIG_AUDIO_SINK_KEY
Definition: policy-node.c:57
#define pw_log_debug(...)
Definition: src/pipewire/log.h:89
int spa_format_parse(const struct spa_pod *format, uint32_t *media_type, uint32_t *media_subtype)
Definition: format-utils.h:42
int(* subscribe_params)(void *object, uint32_t *ids, uint32_t n_ids)
Subscribe to parameter changes.
Definition: port.h:135
#define PW_KEY_LINK_OUTPUT_NODE
output node id of a link
Definition: src/pipewire/keys.h:200
int spa_json_next(struct spa_json *iter, const char **value)
Get the next token.
Definition: json.h:74
struct spa_hook meta_listener
Definition: bluez-autoswitch.c:64
uint32_t id
Definition: policy-ep.c:71
#define PW_KEY_NODE_EXCLUSIVE
node wants exclusive access to resources
Definition: src/pipewire/keys.h:149
Definition: alsa-endpoint.c:64
const char * media
Definition: policy-node.c:555
unsigned int capture_sink
Definition: policy-node.c:130
#define DEFAULT_AUDIO_SINK_KEY
Definition: policy-node.c:54
#define SPA_ID_INVALID
Definition: defs.h:182
struct pw_context * context
Definition: settings.c:43
#define PW_KEY_MEDIA_CLASS
class Ex: "Video/Source"
Definition: src/pipewire/keys.h:285
struct sm_media_session * session
Definition: access-flatpak.c:45
struct endpoint * ep
Definition: policy-ep.c:260
#define PW_KEY_CLIENT_ID
Client properties.
Definition: src/pipewire/keys.h:131
uint32_t position[SPA_AUDIO_MAX_CHANNELS]
Definition: audio/raw.h:290
@ SPA_FORMAT_AUDIO_channels
number of audio channels (Int)
Definition: param/format.h:110
@ SPA_AUDIO_CHANNEL_FR
front right
Definition: audio/raw.h:175
struct endpoint * endpoint
Definition: alsa-endpoint.c:93
uint32_t spa_pod_copy_array(const struct spa_pod *pod, uint32_t type, void *values, uint32_t max_values)
Definition: iter.h:344
unsigned int node_list_changed
Definition: policy-node.c:87
#define PW_TYPE_INTERFACE_Client
Definition: client.h:46
#define PW_CORE_CHANGE_MASK_PROPS
Definition: core.h:80
uint32_t id
id of the global
Definition: port.h:64
#define ENDPOINT_TYPE_UNKNOWN
Definition: policy-ep.c:82
@ SPA_FORMAT_AUDIO_format
audio format, (Id enum spa_audio_format)
Definition: param/format.h:107
#define pw_log_warn(...)
Definition: src/pipewire/log.h:87
unsigned int dont_remix
Definition: policy-node.c:128
uint32_t type
Definition: policy-node.c:116
#define NAME
Definition: policy-ep.c:48
#define spa_pod_builder_add_object(b, type, id,...)
Definition: builder.h:650
@ SPA_FORMAT_AUDIO_position
channel positions (Id enum spa_audio_position)
Definition: param/format.h:111
union spa_audio_info::@5 info
#define SPA_AUDIO_FLAG_UNPOSITIONED
Definition: audio/raw.h:283
void spa_hook_remove(struct spa_hook *hook)
Remove a hook.
Definition: hook.h:336
@ SPA_PARAM_PORT_CONFIG_mode
(Id enum spa_param_port_config_mode) mode
Definition: param.h:148
#define pw_log_info(...)
Definition: src/pipewire/log.h:88
@ SPA_AUDIO_FORMAT_F32
Definition: audio/raw.h:117
unsigned int virtual
Definition: policy-node.c:131
int(* add_listener)(void *object, struct spa_hook *listener, const struct pw_port_events *events, void *data)
Definition: port.h:122
struct sm_node * obj
Definition: restore-stream.c:75
int spa_debug_pod(int indent, const struct spa_type_info *info, const struct spa_pod *pod)
Definition: debug/pod.h:200
uint32_t media_type
Definition: param/audio/format.h:41
char * key_config
Definition: policy-node.c:69
uint32_t sample_rate
Definition: policy-node.c:84
const char * pw_direction_as_string(enum pw_direction direction)
Convert a pw_direction to a readable string.
Definition: introspect.c:52
#define ENDPOINT_TYPE_DEVICE
Definition: policy-ep.c:84
struct sm_endpoint * obj
Definition: policy-ep.c:69
struct endpoint * endpoint
Definition: policy-ep.c:261
#define SPA_POD_OPT_Pod(val)
Definition: parser.h:533
#define SPA_POD_Id(val)
Definition: vararg.h:56
#define PW_KEY_PRIORITY_SESSION
priority in session manager
Definition: src/pipewire/keys.h:97
bool capture_sink
Definition: policy-node.c:557
struct pw_properties * pw_properties_new(const char *key,...) 1
Make a new properties object.
Definition: properties.c:98
uint32_t type
Definition: policy-ep.c:85
@ SPA_TYPE_OBJECT_ParamPortConfig
Definition: build-12775836/doc/spa/utils/type.h:95
char * value
Definition: policy-node.c:70
int pw_properties_setf(struct pw_properties *properties, const char *key, const char *format,...) 1(3
#define MAX_LINK_RETRY
Definition: policy-node.c:65
struct pw_port_info * pw_port_info_update(struct pw_port_info *info, const struct pw_port_info *update)
Definition: introspect.c:237
The node information.
Definition: src/pipewire/node.h:70
#define NODE_TYPE_STREAM
Definition: policy-node.c:114
enum pw_direction direction
Definition: policy-node.c:558
void(* param)(void *object, int seq, uint32_t id, uint32_t index, uint32_t next, const struct spa_pod *param)
Notify a port param.
Definition: port.h:107
#define pw_direction
The direction of a port.
Definition: port.h:56
unsigned int exclusive
Definition: policy-node.c:125
@ SPA_MEDIA_SUBTYPE_raw
Definition: param/format.h:53
int sm_policy_node_start(struct sm_media_session *session)
Definition: policy-node.c:1135
struct default_node defaults[4]
Definition: policy-node.c:91
uint32_t id
Definition: restore-stream.c:77
Definition: properties.h:49
void pw_properties_free(struct pw_properties *properties)
Free a properties object.
Definition: properties.c:364
uint64_t plugged
Definition: policy-node.c:123
uint32_t id
Definition: alsa-monitor.c:72
uint32_t media_subtype
Definition: policy-ep.c:89
int(* enum_params)(void *object, int seq, uint32_t id, uint32_t start, uint32_t num, const struct spa_pod *filter)
Enumerate port parameters.
Definition: port.h:149
unsigned int linking
Definition: policy-node.c:132
#define spa_list_append(list, item)
Definition: list.h:81