Loading...
Searching...
No Matches
client-node.h
Go to the documentation of this file.
/* PipeWire */
/* SPDX-FileCopyrightText: Copyright © 2018 Wim Taymans */
/* SPDX-License-Identifier: MIT */
#ifndef PIPEWIRE_EXT_CLIENT_NODE_H
#define PIPEWIRE_EXT_CLIENT_NODE_H
#ifdef __cplusplus
extern "C" {
#endif
#include <spa/utils/defs.h>
#include <spa/param/param.h>
#define PW_TYPE_INTERFACE_ClientNode PW_TYPE_INFO_INTERFACE_BASE "ClientNode"
#define PW_VERSION_CLIENT_NODE 5
struct pw_client_node;
#define PW_EXTENSION_MODULE_CLIENT_NODE PIPEWIRE_MODULE_PREFIX "module-client-node"
struct pw_client_node_buffer {
uint32_t mem_id;
uint32_t offset;
uint32_t size;
struct spa_buffer *buffer;
};
#define PW_CLIENT_NODE_EVENT_TRANSPORT 0
#define PW_CLIENT_NODE_EVENT_SET_PARAM 1
#define PW_CLIENT_NODE_EVENT_SET_IO 2
#define PW_CLIENT_NODE_EVENT_EVENT 3
#define PW_CLIENT_NODE_EVENT_COMMAND 4
#define PW_CLIENT_NODE_EVENT_ADD_PORT 5
#define PW_CLIENT_NODE_EVENT_REMOVE_PORT 6
#define PW_CLIENT_NODE_EVENT_PORT_SET_PARAM 7
#define PW_CLIENT_NODE_EVENT_PORT_USE_BUFFERS 8
#define PW_CLIENT_NODE_EVENT_PORT_SET_IO 9
#define PW_CLIENT_NODE_EVENT_SET_ACTIVATION 10
#define PW_CLIENT_NODE_EVENT_PORT_SET_MIX_INFO 11
#define PW_CLIENT_NODE_EVENT_NUM 12
struct pw_client_node_events {
#define PW_VERSION_CLIENT_NODE_EVENTS 1
uint32_t version;
int (*transport) (void *data,
int readfd,
int writefd,
uint32_t mem_id,
uint32_t offset,
uint32_t size);
int (*set_param) (void *data,
uint32_t id, uint32_t flags,
const struct spa_pod *param);
int (*set_io) (void *data,
uint32_t id,
uint32_t mem_id,
uint32_t offset,
uint32_t size);
int (*event) (void *data, const struct spa_event *event);
int (*command) (void *data, const struct spa_command *command);
int (*add_port) (void *data,
enum spa_direction direction,
uint32_t port_id,
const struct spa_dict *props);
int (*remove_port) (void *data,
enum spa_direction direction,
uint32_t port_id);
int (*port_set_param) (void *data,
enum spa_direction direction,
uint32_t port_id,
uint32_t id, uint32_t flags,
const struct spa_pod *param);
int (*port_use_buffers) (void *data,
enum spa_direction direction,
uint32_t port_id,
uint32_t mix_id,
uint32_t flags,
uint32_t n_buffers,
struct pw_client_node_buffer *buffers);
int (*port_set_io) (void *data,
enum spa_direction direction,
uint32_t port_id,
uint32_t mix_id,
uint32_t id,
uint32_t mem_id,
uint32_t offset,
uint32_t size);
int (*set_activation) (void *data,
uint32_t node_id,
int signalfd,
uint32_t mem_id,
uint32_t offset,
uint32_t size);
int (*port_set_mix_info) (void *data,
enum spa_direction direction,
uint32_t port_id,
uint32_t mix_id,
uint32_t peer_id,
const struct spa_dict *props);
};
#define PW_CLIENT_NODE_METHOD_ADD_LISTENER 0
#define PW_CLIENT_NODE_METHOD_GET_NODE 1
#define PW_CLIENT_NODE_METHOD_UPDATE 2
#define PW_CLIENT_NODE_METHOD_PORT_UPDATE 3
#define PW_CLIENT_NODE_METHOD_SET_ACTIVE 4
#define PW_CLIENT_NODE_METHOD_EVENT 5
#define PW_CLIENT_NODE_METHOD_PORT_BUFFERS 6
#define PW_CLIENT_NODE_METHOD_NUM 7
struct pw_client_node_methods {
#define PW_VERSION_CLIENT_NODE_METHODS 0
uint32_t version;
int (*add_listener) (void *object,
struct spa_hook *listener,
const struct pw_client_node_events *events,
void *data);
struct pw_node * (*get_node) (void *object, uint32_t version, size_t user_data_size);
int (*update) (void *object,
#define PW_CLIENT_NODE_UPDATE_PARAMS (1 << 0)
#define PW_CLIENT_NODE_UPDATE_INFO (1 << 1)
uint32_t change_mask,
uint32_t n_params,
const struct spa_pod **params,
const struct spa_node_info *info);
int (*port_update) (void *object,
enum spa_direction direction,
uint32_t port_id,
#define PW_CLIENT_NODE_PORT_UPDATE_PARAMS (1 << 0)
#define PW_CLIENT_NODE_PORT_UPDATE_INFO (1 << 1)
uint32_t change_mask,
uint32_t n_params,
const struct spa_pod **params,
const struct spa_port_info *info);
int (*set_active) (void *object, bool active);
int (*event) (void *object, const struct spa_event *event);
int (*port_buffers) (void *object,
enum spa_direction direction,
uint32_t port_id,
uint32_t mix_id,
uint32_t n_buffers,
struct spa_buffer **buffers);
};
#define pw_client_node_method(o,method,version,...) \
({ \
int _res = -ENOTSUP; \
spa_interface_call_res((struct spa_interface*)o, \
struct pw_client_node_methods, _res, \
method, version, ##__VA_ARGS__); \
_res; \
})
#define pw_client_node_add_listener(c,...) pw_client_node_method(c,add_listener,0,__VA_ARGS__)
static inline struct pw_node *
pw_client_node_get_node(struct pw_client_node *p, uint32_t version, size_t user_data_size)
{
struct pw_node *res = NULL;
spa_interface_call_res((struct spa_interface*)p,
struct pw_client_node_methods, res,
get_node, 0, version, user_data_size);
return res;
}
#define pw_client_node_update(c,...) pw_client_node_method(c,update,0,__VA_ARGS__)
#define pw_client_node_port_update(c,...) pw_client_node_method(c,port_update,0,__VA_ARGS__)
#define pw_client_node_set_active(c,...) pw_client_node_method(c,set_active,0,__VA_ARGS__)
#define pw_client_node_event(c,...) pw_client_node_method(c,event,0,__VA_ARGS__)
#define pw_client_node_port_buffers(c,...) pw_client_node_method(c,port_buffers,0,__VA_ARGS__)
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* PIPEWIRE_EXT_CLIENT_NODE_H */
defs.h
spa/utils/defs.h
pw_client_node_get_node
static struct pw_node * pw_client_node_get_node(struct pw_client_node *p, uint32_t version, size_t user_data_size)
Definition client-node.h:351
pw_client_node_methods::update
int(* update)(void *object, #define PW_CLIENT_NODE_UPDATE_PARAMS #define PW_CLIENT_NODE_UPDATE_INFO uint32_t change_mask, uint32_t n_params, const struct spa_pod **params, const struct spa_node_info *info)
Update the node ports and properties.
Definition client-node.h:283
pw_client_node_methods::port_update
int(* port_update)(void *object, enum spa_direction direction, uint32_t port_id, #define PW_CLIENT_NODE_PORT_UPDATE_PARAMS #define PW_CLIENT_NODE_PORT_UPDATE_INFO uint32_t change_mask, uint32_t n_params, const struct spa_pod **params, const struct spa_port_info *info)
Update a node port.
Definition client-node.h:304
spa_interface_call_res
#define spa_interface_call_res(iface, method_type, res, method, vers,...)
Invoke method named method in the callbacks on the given interface object.
Definition hook.h:251
spa_direction
spa_direction
Definition defs.h:92
param.h
spa/param/param.h
pw_client_node_buffer
information about a buffer
Definition client-node.h:39
pw_client_node_buffer::size
uint32_t size
size in memory
Definition client-node.h:42
pw_client_node_buffer::mem_id
uint32_t mem_id
the memory id for the metadata
Definition client-node.h:40
pw_client_node_buffer::offset
uint32_t offset
offset in memory
Definition client-node.h:41
pw_client_node_buffer::buffer
struct spa_buffer * buffer
buffer describing metadata and buffer memory
Definition client-node.h:43
pw_client_node_events
Client Node events
Definition client-node.h:74
pw_client_node_events::port_set_io
int(* port_set_io)(void *data, enum spa_direction direction, uint32_t port_id, uint32_t mix_id, uint32_t id, uint32_t mem_id, uint32_t offset, uint32_t size)
Configure the io area with id of port_id.
Definition client-node.h:198
pw_client_node_events::port_use_buffers
int(* port_use_buffers)(void *data, enum spa_direction direction, uint32_t port_id, uint32_t mix_id, uint32_t flags, uint32_t n_buffers, struct pw_client_node_buffer *buffers)
Notify the port of buffers.
Definition client-node.h:180
pw_client_node_events::remove_port
int(* remove_port)(void *data, enum spa_direction direction, uint32_t port_id)
A port was removed from the node.
Definition client-node.h:154
pw_client_node_events::version
uint32_t version
Definition client-node.h:77
pw_client_node_events::port_set_param
int(* port_set_param)(void *data, enum spa_direction direction, uint32_t port_id, uint32_t id, uint32_t flags, const struct spa_pod *param)
A parameter was configured on the port.
Definition client-node.h:166
pw_client_node_events::event
int(* event)(void *data, const struct spa_event *event)
Receive an event from the client node.
Definition client-node.h:127
pw_client_node_events::set_activation
int(* set_activation)(void *data, uint32_t node_id, int signalfd, uint32_t mem_id, uint32_t offset, uint32_t size)
Notify the activation record of the next node to trigger.
Definition client-node.h:217
pw_client_node_events::port_set_mix_info
int(* port_set_mix_info)(void *data, enum spa_direction direction, uint32_t port_id, uint32_t mix_id, uint32_t peer_id, const struct spa_dict *props)
Notify about the peer of mix_id.
Definition client-node.h:235
pw_client_node_events::command
int(* command)(void *data, const struct spa_command *command)
Notify of a new node command.
Definition client-node.h:133
pw_client_node_events::set_io
int(* set_io)(void *data, uint32_t id, uint32_t mem_id, uint32_t offset, uint32_t size)
Configure an IO area for the client.
Definition client-node.h:119
pw_client_node_events::add_port
int(* add_port)(void *data, enum spa_direction direction, uint32_t port_id, const struct spa_dict *props)
A new port was added to the node.
Definition client-node.h:144
pw_client_node_events::set_param
int(* set_param)(void *data, uint32_t id, uint32_t flags, const struct spa_pod *param)
Notify of a property change.
Definition client-node.h:105
pw_client_node_events::transport
int(* transport)(void *data, int readfd, int writefd, uint32_t mem_id, uint32_t offset, uint32_t size)
Notify of a new transport area.
Definition client-node.h:89
pw_client_node_methods
Client Node methods
Definition client-node.h:261
pw_client_node_methods::event
int(* event)(void *object, const struct spa_event *event)
Send an event to the node.
Definition client-node.h:323
pw_client_node_methods::add_listener
int(* add_listener)(void *object, struct spa_hook *listener, const struct pw_client_node_events *events, void *data)
Definition client-node.h:266
pw_client_node_methods::port_buffers
int(* port_buffers)(void *object, enum spa_direction direction, uint32_t port_id, uint32_t mix_id, uint32_t n_buffers, struct spa_buffer **buffers)
Send allocated buffers.
Definition client-node.h:328
pw_client_node_methods::version
uint32_t version
Definition client-node.h:264
pw_client_node_methods::set_active
int(* set_active)(void *object, bool active)
Activate or deactivate the node.
Definition client-node.h:318
pw_client_node
pw_node
spa_buffer
A Buffer.
Definition buffer.h:94
spa_command
Definition command.h:29
spa_dict
Definition dict.h:39
spa_event
Definition event.h:28
spa_hook
A hook, contains the structure with functions and the data passed to the functions.
Definition hook.h:350
spa_interface
Definition hook.h:138
spa_node_info
Node information structure.
Definition node.h:48
spa_pod
Definition pod.h:43
spa_port_info
Port information structure.
Definition node.h:93