Go to the documentation of this file.
20 #ifndef __PIPEWIRE_REMOTE_H__
21 #define __PIPEWIRE_REMOTE_H__
27 #include <spa/utils/hook.h>
127 #define PW_VERSION_REMOTE_EVENTS 0
142 #define PW_REMOTE_PROP_PROTOCOL "pipewire.protocol"
144 #define PW_REMOTE_PROP_REMOTE_NAME "pipewire.remote.name"
152 size_t user_data_size );
171 struct spa_hook *listener,
parameters to map a memory range
Definition: mem.h:69
SPA_EXPORT const struct pw_core_info * pw_remote_get_core_info(struct pw_remote *remote)
Get the remote core info, can only be called when connected.
Definition: remote.c:386
void pw_remote_add_listener(struct pw_remote *remote, struct spa_hook *listener, const struct pw_remote_events *events, void *data)
Add listener for events.
Definition: remote.c:346
@ PW_REMOTE_STATE_UNCONNECTED
not connected
Definition: remote.h:117
int pw_port_use_buffers(struct pw_port *port, struct spa_buffer **buffers, uint32_t n_buffers)
Definition: port.c:696
static bool pw_array_ensure_size(struct pw_array *arr, size_t size)
Make sure size bytes can be added to the array.
Definition: array.h:76
@ PW_REMOTE_STATE_ERROR
remote is in error
Definition: remote.h:116
SPA_EXPORT void * pw_remote_get_user_data(struct pw_remote *remote)
Get the user_data.
Definition: remote.c:332
static void * pw_map_lookup(struct pw_map *map, uint32_t id)
Find an item in the map.
Definition: map.h:152
static void pw_map_remove(struct pw_map *map, uint32_t id)
Remove an item at index.
Definition: map.h:140
SPA_EXPORT struct pw_module * pw_module_load(struct pw_core *core, const char *name, const char *args, struct pw_client *owner, struct pw_global *parent, struct pw_properties *properties)
Load a module.
Definition: module.c:167
int pw_remote_disconnect(struct pw_remote *remote)
Disconnect from the remote PipeWire.
Definition: remote.c:452
The core information.
Definition: introspect.h:76
#define pw_protocol_new_client(p,...)
Definition: protocol.h:100
static void pw_map_init(struct pw_map *map, size_t size, size_t extend)
Initialize a map.
Definition: map.h:70
Represents a connection with a remote PipeWire instance.
struct pw_proxy * pw_remote_find_proxy(struct pw_remote *remote, uint32_t id)
Get the proxy with the given id.
Definition: remote.c:392
#define PW_STREAM_PROP_LATENCY_MIN
The minimum latency of the stream, int, default 0.
Definition: stream.h:251
void pw_node_add_listener(struct pw_node *node, struct spa_hook *listener, const struct pw_node_events *events, void *data)
Add an event listener.
Definition: node.c:596
Manages protocols and their implementation.
#define pw_loop_add_io(l,...)
Definition: loop.h:60
SPA_EXPORT void pw_fill_remote_properties(struct pw_core *core, struct pw_properties *properties)
Fill remote properties.
Definition: pipewire.c:395
SPA_EXPORT void pw_proxy_destroy(struct pw_proxy *proxy)
Destroy a proxy object.
Definition: proxy.c:124
struct pw_core_info * pw_core_info_update(struct pw_core_info *info, const struct pw_core_info *update)
Update and existing pw_core_info with update.
Definition: introspect.c:122
Proxy events, use pw_proxy_add_listener.
Definition: proxy.h:102
int pw_remote_steal_fd(struct pw_remote *remote)
Steal the fd of the remote connection or < 0 on error.
Definition: remote.c:441
#define pw_array_for_each(pos, array)
Definition: array.h:56
PipeWire type support struct.
Definition: type.h:51
void pw_log_info(const char *format,...)
static struct spa_pod * pw_spa_pod_copy(const struct spa_pod *pod)
Copy a pod structure.
Definition: utils.h:52
struct pw_proxy * pw_remote_export(struct pw_remote *remote, struct pw_node *node)
run a local node in a remote graph
Definition: remote.c:1339
#define PW_VERSION_CORE_PROXY_EVENTS
Definition: interfaces.h:271
An array object.
Definition: array.h:36
uint32_t core
Definition: type.h:54
#define PW_MAP_ID_TO_PTR(id)
Convert an id to a pointer that can be inserted into the map.
Definition: map.h:60
#define PW_MAP_RANGE_INIT
Definition: mem.h:75
#define PW_VERSION_PROXY_EVENTS
Definition: proxy.h:103
#define pw_protocol_client_connect(c, cb, d)
Definition: protocol.h:53
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
Core events.
Definition: interfaces.h:270
void * pw_remote_get_user_data(struct pw_remote *remote)
Get the user_data.
Definition: remote.c:332
void pw_log_trace(const char *format,...)
void pw_remote_destroy(struct pw_remote *remote)
Destroy a remote.
Definition: remote.c:294
@ PW_REMOTE_STATE_CONNECTING
connecting to remote PipeWire
Definition: remote.h:118
#define pw_loop_destroy_source(l,...)
Definition: loop.h:69
const char * pw_remote_state_as_string(enum pw_remote_state state)
Convert a pw_remote_state to a readable string.
Definition: remote.c:107
int pw_port_send_command(struct pw_port *port, bool block, const struct spa_command *command)
Definition: port.c:593
struct pw_core * pw_remote_get_core(struct pw_remote *remote)
Get the core used to construct this remote.
Definition: remote.c:320
#define pw_protocol_client_disconnect(c)
Definition: protocol.h:56
struct pw_core_proxy * pw_remote_get_core_proxy(struct pw_remote *remote)
Get the core proxy, can only be called when connected.
Definition: remote.c:380
SPA_EXPORT const struct pw_properties * pw_remote_get_properties(struct pw_remote *remote)
Get the remote properties.
Definition: remote.c:326
Represents an object on the client side.
SPA_EXPORT void pw_remote_add_listener(struct pw_remote *remote, struct spa_hook *listener, const struct pw_remote_events *events, void *data)
Add listener for events.
Definition: remote.c:346
SPA_EXPORT enum pw_remote_state pw_remote_get_state(struct pw_remote *remote, const char **error)
Get the current state, error is set when state is PW_REMOTE_STATE_ERROR.
Definition: remote.c:338
int pw_port_set_param(struct pw_port *port, uint32_t id, uint32_t flags, const struct spa_pod *param)
Definition: port.c:671
void * pw_proxy_get_user_data(struct pw_proxy *proxy)
Get the user_data.
Definition: proxy.c:80
static void pw_map_clear(struct pw_map *map)
Clear a map.
Definition: map.h:81
void pw_core_info_free(struct pw_core_info *info)
Free a pw_core_info.
Definition: introspect.c:163
SPA_EXPORT struct pw_proxy * pw_remote_export(struct pw_remote *remote, struct pw_node *node)
run a local node in a remote graph
Definition: remote.c:1339
@ PW_REMOTE_STATE_CONNECTED
remote is connected and ready
Definition: remote.h:119
SPA_EXPORT struct pw_proxy * pw_proxy_new(struct pw_proxy *factory, uint32_t type, size_t user_data_size)
Create a proxy object with a given id and type.
Definition: proxy.c:47
int pw_remote_connect(struct pw_remote *remote)
Connect to a remote PipeWire.
Definition: remote.c:410
Node events, listen to them with pw_node_add_listener.
Definition: node.h:51
const SPA_EXPORT char * pw_properties_get(const struct pw_properties *properties, const char *key)
Get a property.
Definition: properties.c:361
const struct pw_core_info * pw_remote_get_core_info(struct pw_remote *remote)
Get the remote core info, can only be called when connected.
Definition: remote.c:386
struct pw_remote * pw_remote_new(struct pw_core *core, struct pw_properties *properties, size_t user_data_size)
Create a new unconnected remote.
Definition: remote.c:215
void(* sync_reply)(void *data, uint32_t seq)
emited when a reply to a sync was received
Definition: remote.h:135
static void * pw_array_add(struct pw_array *arr, size_t size)
Add ref size bytes to arr.
Definition: array.h:98
struct pw_protocol * pw_core_find_protocol(struct pw_core *core, const char *name)
Definition: protocol.c:161
struct pw_core * pw_node_get_core(struct pw_node *node)
Get the core of this node.
Definition: node.c:469
#define pw_array_get_len(a, t)
Get the number of items of type t in array.
Definition: array.h:50
void(* state_changed)(void *data, enum pw_remote_state old, enum pw_remote_state state, const char *error)
emited when the state changes
Definition: remote.h:137
SPA_EXPORT int pw_properties_set(struct pw_properties *properties, const char *key, const char *value)
Set a property value.
Definition: properties.c:308
struct pw_type * pw_core_get_type(struct pw_core *core)
Get the type object of a core.
Definition: core.c:552
#define pw_protocol_client_steal_fd(c)
Definition: protocol.h:55
void pw_proxy_add_listener(struct pw_proxy *proxy, struct spa_hook *listener, const struct pw_proxy_events *events, void *data)
Add an event listener to proxy.
Definition: proxy.c:98
SPA_EXPORT struct pw_core_proxy * pw_remote_get_core_proxy(struct pw_remote *remote)
Get the core proxy, can only be called when connected.
Definition: remote.c:380
int pw_stream_disconnect(struct pw_stream *stream)
Disconnect stream.
Definition: stream.c:1339
#define pw_loop_update_io(l,...)
Definition: loop.h:61
#define pw_protocol_client_connect_fd(c, fd, cl)
Definition: protocol.h:54
SPA_EXPORT int pw_remote_steal_fd(struct pw_remote *remote)
Steal the fd of the remote connection or < 0 on error.
Definition: remote.c:441
enum pw_remote_state pw_remote_get_state(struct pw_remote *remote, const char **error)
Get the current state, error is set when state is PW_REMOTE_STATE_ERROR.
Definition: remote.c:338
struct pw_control this
Definition: control.c:26
void pw_stream_destroy(struct pw_stream *stream)
Destroy a stream.
Definition: stream.c:536
const struct pw_properties * pw_remote_get_properties(struct pw_remote *remote)
Get the remote properties.
Definition: remote.c:326
SPA_EXPORT struct pw_properties * pw_properties_new(const char *key,...)
Make a new properties object.
Definition: properties.c:89
#define PW_STREAM_PROP_IS_LIVE
Indicates that the stream is live, boolean default false.
Definition: stream.h:249
void pw_log_error(const char *format,...)
int pw_remote_connect_fd(struct pw_remote *remote, int fd)
Connect to a remote PipeWire on the given socket.
Definition: remote.c:425
struct spa_type_data data
Definition: type.h:73
PipeWire stream object class.
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
#define pw_loop_invoke(l,...)
Definition: loop.h:52
#define PW_VERSION_NODE_EVENTS
Definition: node.h:52
SPA_EXPORT struct pw_core * pw_remote_get_core(struct pw_remote *remote)
Get the core used to construct this remote.
Definition: remote.c:320
void(* info_changed)(void *data, const struct pw_core_info *info)
emited when the remote core info changed
Definition: remote.h:133
Events for the remote.
Definition: remote.h:126
#define pw_protocol_client_destroy(c)
Definition: protocol.h:57
#define PW_REMOTE_PROP_PROTOCOL
Specify the name of the protocol to use, default is using the native protocol.
Definition: remote.h:142
uint32_t port
Definition: type.h:57
SPA_EXPORT struct pw_proxy * pw_remote_find_proxy(struct pw_remote *remote, uint32_t id)
Get the proxy with the given id.
Definition: remote.c:392
uint32_t version
Definition: remote.h:128
void pw_log_warn(const char *format,...)
void pw_log_debug(const char *format,...)
pw_remote_state
Definition: remote.h:115
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(* destroy)(void *data)
The remote is destroyed.
Definition: remote.h:131
static void pw_array_init(struct pw_array *arr, size_t extend)
Initialize the array with given extend.
Definition: array.h:62