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)
86 #define PW_PORT_EVENT_INFO 0
87 #define PW_PORT_EVENT_PARAM 1
88 #define PW_PORT_EVENT_NUM 2
92 #define PW_VERSION_PORT_EVENTS 0
111 void (*
param) (
void *object,
int seq,
112 uint32_t
id, uint32_t index, uint32_t next,
116 #define PW_PORT_METHOD_ADD_LISTENER 0
117 #define PW_PORT_METHOD_SUBSCRIBE_PARAMS 1
118 #define PW_PORT_METHOD_ENUM_PARAMS 2
119 #define PW_PORT_METHOD_NUM 3
123 #define PW_VERSION_PORT_METHODS 0
154 uint32_t id, uint32_t
start, uint32_t num,
158 #define pw_port_method(o,method,version,...) \
160 int _res = -ENOTSUP; \
161 spa_interface_call_res((struct spa_interface*)o, \
162 struct pw_port_methods, _res, \
163 method, version, ##__VA_ARGS__); \
167 #define pw_port_add_listener(c,...) pw_port_method(c,add_listener,0,__VA_ARGS__)
168 #define pw_port_subscribe_params(c,...) pw_port_method(c,subscribe_params,0,__VA_ARGS__)
169 #define pw_port_enum_params(c,...) pw_port_method(c,enum_params,0,__VA_ARGS__)
#define NAME
Definition: policy-node.c:50
#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:90
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:288
Definition: module-filter-chain.c:183
Definition: pod/pod.h:175
uint32_t rate
Definition: audio/raw.h:291
#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:82
bool exclusive
Definition: policy-ep.c:265
struct spa_audio_info format
Definition: alsa-endpoint.c:89
bool passthrough_only
Definition: policy-node.c:781
#define NODE_TYPE_UNKNOWN
Definition: policy-node.c:118
@ SPA_PARAM_PORT_CONFIG_MODE_passthrough
passthrough configuration
Definition: param.h:137
struct impl * impl
Definition: alsa-endpoint.c:70
uint32_t media_type
Definition: policy-ep.c:91
#define SPA_POD_Pod(val)
Definition: vararg.h:100
#define NODE_TYPE_DEVICE
Definition: policy-node.c:120
#define SPA_POD_Int(val)
Definition: vararg.h:59
#define spa_zero(x)
Definition: defs.h:310
@ SPA_TYPE_OBJECT_Format
Definition: obj-x86_64-linux-gnu/doc/spa/utils/type.h:90
const char * link_group
Definition: policy-node.c:775
Port methods.
Definition: port.h:122
char * key
Definition: policy-node.c:72
The core information.
Definition: core.h:73
int connect_count
Definition: policy-node.c:126
unsigned int configured
Definition: policy-node.c:132
enum pw_direction direction
Definition: alsa-monitor.c:136
bool can_passthrough
Definition: policy-node.c:782
@ SPA_PARAM_PORT_CONFIG_format
(Object) format filter
Definition: param.h:151
@ SPA_MEDIA_SUBTYPE_iec958
Definition: param/format.h:55
uint64_t change_mask
bitfield of changed fields since last call
Definition: port.h:69
uint32_t linked
Definition: policy-ep.c:80
enum pw_direction direction
port direction
Definition: port.h:65
@ SPA_TYPE_Id
Definition: obj-x86_64-linux-gnu/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:308
#define PW_LOG_TOPIC_INIT(var)
Definition: src/pipewire/log.h:136
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:163
@ SPA_PARAM_ROUTE_devices
associated device indexes (Array of Int)
Definition: param.h:171
user data to add to an object
Definition: filter.c:75
uint8_t data[MAX_BUFFER]
Definition: module-profiler.c:90
uint32_t version
Definition: port.h:93
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:92
struct sm_node * obj
Definition: bluez-autoswitch.c:82
bool spa_atou32(const char *str, uint32_t *val, int base)
Convert str to an uint32_t with the given base and store the result in val.
Definition: string.h:137
struct sm_object * obj
Definition: bluez-autoswitch.c:94
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:103
@ PW_NODE_STATE_IDLE
the node is running but there is no active port
Definition: src/pipewire/node.h:61
Port events.
Definition: port.h:91
int32_t priority
Definition: policy-node.c:116
int seq
Definition: policy-ep.c:68
char * media
Definition: stream-endpoint.c:73
unsigned int passthrough_only
Definition: policy-node.c:139
struct spa_hook listener
Definition: access-flatpak.c:65
Definition: alsa-monitor.c:149
Definition: module-filter-chain.c:162
struct spa_hook listener
Definition: bluez-autoswitch.c:84
char * config
Definition: policy-node.c:75
struct spa_audio_info_raw raw
Definition: param/audio/format.h:46
PW_LOG_TOPIC_STATIC(mod_topic, "ms.mod." NAME)
struct sm_endpoint_stream * obj
Definition: policy-ep.c:102
@ SPA_PARAM_PORT_CONFIG_direction
direction, input/output (Id enum spa_direction)
Definition: param.h:147
uint64_t plugged
Definition: policy-ep.c:267
#define DEFAULT_CONFIG_AUDIO_SOURCE_KEY
Definition: policy-node.c:59
#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:63
int spa_pod_object_fixate(struct spa_pod_object *pod)
Definition: iter.h:431
#define DEFAULT_VIDEO_SOURCE_KEY
Definition: policy-node.c:57
#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
struct node * result
Definition: policy-node.c:771
bool spa_strstartswith(const char *s, const char *prefix)
Definition: string.h:71
enum spa_audio_format format
Definition: audio/raw.h:289
int32_t priority
Definition: policy-ep.c:83
uint32_t id
Definition: module-echo-cancel.c:143
#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:96
struct spa_audio_info_raw info
Definition: module-echo-cancel.c:149
#define ENDPOINT_TYPE_STREAM
Definition: policy-ep.c:86
@ SPA_PARAM_PORT_CONFIG_MODE_dsp
dsp configuration, depending on the external format.
Definition: param.h:139
#define SESSION_KEY
Definition: policy-node.c:51
uint32_t channels
Definition: audio/raw.h:292
int spa_pod_filter(struct spa_pod_builder *b, struct spa_pod **result, const struct spa_pod *pod, const struct spa_pod *filter)
Definition: obj-x86_64-linux-gnu/doc/spa/pod/filter.h:387
struct spa_dict * props
the properties of the port
Definition: port.h:70
struct spa_list endpoint_list
Definition: policy-ep.c:67
unsigned int busy
Definition: policy-ep.c:98
#define DEFAULT_AUDIO_SOURCE_KEY
Definition: policy-node.c:56
@ SPA_PARAM_Format
configured format as SPA_TYPE_OBJECT_Format
Definition: param.h:48
int failed_count
Definition: policy-node.c:127
enum pw_direction pw_direction_reverse(enum pw_direction direction)
Reverse the direction.
Definition: pipewire.c:841
struct impl * impl
Definition: alsa-monitor.c:135
unsigned int active
Definition: policy-node.c:129
@ SPA_PARAM_ROUTE_available
availability of the destination (Id enum spa_param_availability)
Definition: param.h:163
#define PW_KEY_LINK_INPUT_NODE
input node id of a link
Definition: src/pipewire/keys.h:198
@ SPA_PARAM_PORT_CONFIG_MODE_convert
convert configuration
Definition: param.h:138
int sm_policy_ep_start(struct sm_media_session *session)
Definition: policy-ep.c:517
Definition: module-link-factory.c:301
int priority
Definition: policy-ep.c:266
unsigned int enabled
Definition: policy-node.c:131
#define PW_DIRECTION_OUTPUT
Definition: port.h:58
uint64_t plugged
Definition: policy-ep.c:95
#define pw_client_error(c,...)
Definition: client.h:173
unsigned char active
Definition: bluez-autoswitch.c:85
void spa_list_remove(struct spa_list *elem)
Definition: list.h:69
struct timespec now
Definition: default-profile.c:90
#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:97
#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:113
#define PW_TYPE_INTERFACE_Node
Definition: src/pipewire/node.h:50
char * media
Definition: policy-ep.c:89
uint32_t version
Definition: port.h:124
#define SPA_TIMESPEC_TO_NSEC(ts)
Definition: defs.h:196
@ SPA_PARAM_PORT_CONFIG_monitor
(Bool) enable monitor output ports on input ports
Definition: param.h:149
struct node * peer
Definition: policy-node.c:112
@ 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
@ SPA_NODE_COMMAND_Suspend
suspend a node, this removes all configured formats and closes any devices
Definition: node/command.h:41
#define DEFAULT_CONFIG_VIDEO_SOURCE_KEY
Definition: policy-node.c:60
enum pw_direction direction
Definition: policy-ep.c:78
#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:177
#define SPA_NODE_COMMAND_INIT(id)
Definition: node/command.h:60
struct spa_param_info * params
parameters
Definition: port.h:71
@ SPA_FORMAT_AUDIO_rate
sample rate (Int)
Definition: param/format.h:111
void spa_json_init(struct spa_json *iter, const char *data, size_t size)
Definition: json.h:59
#define pw_node_send_command(c,...)
Definition: src/pipewire/node.h:206
uint32_t flags
Definition: audio/raw.h:290
PW_LOG_TOPIC_STATIC(mod_topic, "ms.mod." NAME)
@ SPA_LOG_LEVEL_DEBUG
Definition: obj-x86_64-linux-gnu/doc/spa/support/log.h:62
struct impl * impl
Definition: restore-stream.c:100
information about a parameter
Definition: param.h:64
struct pw_port_info * pw_port_info_merge(struct pw_port_info *info, const struct pw_port_info *update, bool reset)
Definition: introspect.c:253
void spa_list_init(struct spa_list *list)
Definition: list.h:44
struct spa_node * node
Definition: alsa-monitor.c:143
#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:62
uint32_t media_subtype
Definition: param/audio/format.h:44
void spa_pod_builder_init(struct spa_pod_builder *builder, void *data, uint32_t size)
Definition: builder.h:96
@ SPA_PARAM_EnumRoute
routing enumeration as SPA_TYPE_OBJECT_ParamRoute
Definition: param.h:56
#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:140
struct impl * impl
Definition: policy-ep.c:262
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:64
unsigned int enabled
Definition: policy-ep.c:97
#define SPA_POD_Bool(val)
Definition: vararg.h:53
#define pw_node_set_param(c,...)
Definition: src/pipewire/node.h:205
struct spa_audio_info format
Definition: stream-endpoint.c:77
Definition: bluez-autoswitch.c:90
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:772
Definition: param/audio/format.h:42
unsigned int monitor
Definition: policy-node.c:134
@ 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:99
#define spa_pod_parse_object(pod, type, id,...)
Definition: parser.h:560
Definition: policy-node.c:71
struct spa_list link
link in impl endpoint_list
Definition: alsa-endpoint.c:68
#define PW_ID_CORE
default ID for the core object after connect
Definition: core.h:66
void * spa_pod_get_array(const struct spa_pod *pod, uint32_t *n_values)
Definition: iter.h:337
uint32_t client_id
Definition: policy-node.c:115
#define DEFAULT_CONFIG_AUDIO_SINK_KEY
Definition: policy-node.c:58
#define pw_log_debug(...)
Definition: src/pipewire/log.h:155
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:139
#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:67
@ SPA_PARAM_AVAILABILITY_no
not available
Definition: param.h:106
uint32_t id
Definition: policy-ep.c:74
#define PW_KEY_NODE_EXCLUSIVE
node wants exclusive access to resources
Definition: src/pipewire/keys.h:149
Definition: alsa-endpoint.c:67
const char * media
Definition: policy-node.c:774
unsigned int capture_sink
Definition: policy-node.c:135
#define DEFAULT_AUDIO_SINK_KEY
Definition: policy-node.c:55
#define SPA_ID_INVALID
Definition: defs.h:187
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:64
struct endpoint * ep
Definition: policy-ep.c:263
#define PW_KEY_CLIENT_ID
Client properties.
Definition: src/pipewire/keys.h:131
uint32_t position[SPA_AUDIO_MAX_CHANNELS]
Definition: audio/raw.h:293
@ SPA_FORMAT_AUDIO_channels
number of audio channels (Int)
Definition: param/format.h:112
bool have_passthrough
Definition: policy-node.c:780
@ SPA_AUDIO_CHANNEL_FR
front right
Definition: audio/raw.h:178
struct endpoint * endpoint
Definition: alsa-endpoint.c:96
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:91
#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:85
@ SPA_TYPE_OBJECT_ParamRoute
Definition: obj-x86_64-linux-gnu/doc/spa/utils/type.h:96
@ SPA_FORMAT_AUDIO_format
audio format, (Id enum spa_audio_format)
Definition: param/format.h:109
#define pw_log_warn(...)
Definition: src/pipewire/log.h:153
Definition: pod/command.h:44
unsigned int dont_remix
Definition: policy-node.c:133
uint32_t type
Definition: policy-node.c:121
const char unsigned long int n
Definition: src/pipewire/i18n.h:35
#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:113
union spa_audio_info::@5 info
#define SPA_AUDIO_FLAG_UNPOSITIONED
Definition: audio/raw.h:286
unsigned int passthrough
Definition: policy-node.c:140
void spa_hook_remove(struct spa_hook *hook)
Remove a hook.
Definition: hook.h:354
@ 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:154
spa_param_availability
Definition: param.h:104
@ SPA_AUDIO_FORMAT_F32
Definition: audio/raw.h:120
unsigned int virtual
Definition: policy-node.c:136
int(* add_listener)(void *object, struct spa_hook *listener, const struct pw_port_events *events, void *data)
Definition: port.h:126
struct sm_node * obj
Definition: restore-stream.c:97
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:43
unsigned int have_passthrough
Definition: policy-node.c:138
char * key_config
Definition: policy-node.c:73
@ SPA_PARAM_ROUTE_device
device id (Int)
Definition: param.h:159
uint32_t sample_rate
Definition: policy-node.c:88
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:87
struct sm_endpoint * obj
Definition: policy-ep.c:72
struct endpoint * endpoint
Definition: policy-ep.c:264
bool alsa_no_dsp
Definition: policy-node.c:98
#define SPA_POD_OPT_Pod(val)
Definition: parser.h:533
@ SPA_PARAM_Route
routing configuration as SPA_TYPE_OBJECT_ParamRoute
Definition: param.h:57
#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:776
struct pw_properties * pw_properties_new(const char *key,...) 1
Make a new properties object.
Definition: properties.c:98
unsigned int want_passthrough
Definition: policy-node.c:141
uint32_t type
Definition: policy-ep.c:88
@ SPA_TYPE_OBJECT_ParamPortConfig
Definition: obj-x86_64-linux-gnu/doc/spa/utils/type.h:95
char * value
Definition: policy-node.c:74
int pw_properties_setf(struct pw_properties *properties, const char *key, const char *format,...) 1(3
#define MAX_LINK_RETRY
Definition: policy-node.c:66
struct pw_port_info * pw_port_info_update(struct pw_port_info *info, const struct pw_port_info *update)
Definition: introspect.c:301
The node information.
Definition: src/pipewire/node.h:70
#define NODE_TYPE_STREAM
Definition: policy-node.c:119
@ SPA_MEDIA_SUBTYPE_dsd
S/PDIF.
Definition: param/format.h:56
enum pw_direction direction
Definition: policy-node.c:777
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:111
#define pw_direction
The direction of a port.
Definition: port.h:56
unsigned int exclusive
Definition: policy-node.c:130
@ SPA_MEDIA_SUBTYPE_raw
Definition: param/format.h:53
int sm_policy_node_start(struct sm_media_session *session)
Definition: policy-node.c:1396
struct default_node defaults[4]
Definition: policy-node.c:95
uint32_t id
Definition: restore-stream.c:99
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:128
uint32_t id
Definition: alsa-monitor.c:139
uint32_t media_subtype
Definition: policy-ep.c:92
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:153
unsigned int linking
Definition: policy-node.c:137
#define spa_list_append(list, item)
Definition: list.h:81