PipeWire: remote.h Source File

PipeWire 0.2.5

remote.h
Go to the documentation of this file.
1 /* PipeWire
2 * Copyright (C) 2015 Wim Taymans <wim.taymans@gmail.com>
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
13 *
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 */
19
20 #ifndef __PIPEWIRE_REMOTE_H__
21 #define __PIPEWIRE_REMOTE_H__
22
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26
27 #include <spa/utils/hook.h>
28
107 struct pw_remote;
108
109 #include <pipewire/core.h>
110 #include <pipewire/properties.h>
111 #include <pipewire/protocol.h>
112 #include <pipewire/proxy.h>
113
115 enum pw_remote_state {
116 PW_REMOTE_STATE_ERROR = -1,
117 PW_REMOTE_STATE_UNCONNECTED = 0,
118 PW_REMOTE_STATE_CONNECTING = 1,
119 PW_REMOTE_STATE_CONNECTED = 2,
120 };
121
123 const char *pw_remote_state_as_string(enum pw_remote_state state);
124
126 struct pw_remote_events {
127 #define PW_VERSION_REMOTE_EVENTS 0
128 uint32_t version;
129
131 void (*destroy) (void *data);
133 void (*info_changed) (void *data, const struct pw_core_info *info);
135 void (*sync_reply) (void *data, uint32_t seq);
137 void (*state_changed) (void *data, enum pw_remote_state old,
138 enum pw_remote_state state, const char *error);
139 };
140
142 #define PW_REMOTE_PROP_PROTOCOL "pipewire.protocol"
143
144 #define PW_REMOTE_PROP_REMOTE_NAME "pipewire.remote.name"
145
148 struct pw_remote *
149 pw_remote_new(struct pw_core *core,
150 struct pw_properties *properties,
152 size_t user_data_size );
153
155 void pw_remote_destroy(struct pw_remote *remote);
156
158 struct pw_core *pw_remote_get_core(struct pw_remote *remote);
159
161 const struct pw_properties *pw_remote_get_properties(struct pw_remote *remote);
162
164 void *pw_remote_get_user_data(struct pw_remote *remote);
165
167 enum pw_remote_state pw_remote_get_state(struct pw_remote *remote, const char **error);
168
170 void pw_remote_add_listener(struct pw_remote *remote,
171 struct spa_hook *listener,
172 const struct pw_remote_events *events,
173 void *data);
174
177 int pw_remote_connect(struct pw_remote *remote);
178
182 int pw_remote_connect_fd(struct pw_remote *remote, int fd);
183
186 int pw_remote_steal_fd(struct pw_remote *remote);
187
189 struct pw_core_proxy * pw_remote_get_core_proxy(struct pw_remote *remote);
190
192 const struct pw_core_info *pw_remote_get_core_info(struct pw_remote *remote);
193
195 struct pw_proxy *pw_remote_find_proxy(struct pw_remote *remote, uint32_t id);
196
198 int pw_remote_disconnect(struct pw_remote *remote);
199
201 struct pw_proxy *pw_remote_export(struct pw_remote *remote, struct pw_node *node);
202
203 #ifdef __cplusplus
204 }
205 #endif
206
207 #endif /* __PIPEWIRE_REMOTE_H__ */
pw_properties
A collection of key/value pairs.
Definition: properties.h:38
pw_remote_add_listener
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:336
PW_REMOTE_STATE_UNCONNECTED
not connected
Definition: remote.h:117
pw_remote::pw_remote_destroy
void pw_remote_destroy(struct pw_remote *remote)
Destroy a remote.
Definition: remote.c:289
pw_remote_find_proxy
struct pw_proxy * pw_remote_find_proxy(struct pw_remote *remote, uint32_t id)
Get the proxy with the given id.
Definition: remote.c:379
pw_remote::pw_remote_state_as_string
const char * pw_remote_state_as_string(enum pw_remote_state state)
Convert a pw_remote_state to a readable string.
Definition: remote.c:106
pw_remote_get_core
struct pw_core * pw_remote_get_core(struct pw_remote *remote)
Get the core used to construct this remote.
Definition: remote.c:314
core.h
pw_core
the core PipeWire object
pw_remote_events::version
uint32_t version
Definition: remote.h:128
PW_REMOTE_STATE_CONNECTING
connecting to remote PipeWire
Definition: remote.h:118
pw_core_info
The core information.
Definition: introspect.h:76
pw_remote_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:1321
pw_remote_events::destroy
void(* destroy)(void *data)
The remote is destroyed.
Definition: remote.h:131
protocol.h
pw_remote_events::sync_reply
void(* sync_reply)(void *data, uint32_t seq)
emited when a reply to a sync was received
Definition: remote.h:135
pw_proxy
Represents an object on the client side.
pw_remote::pw_remote_connect
int pw_remote_connect(struct pw_remote *remote)
Connect to a remote PipeWire.
Definition: remote.c:396
PW_REMOTE_STATE_CONNECTED
remote is connected and ready
Definition: remote.h:119
pw_remote_get_properties
const struct pw_properties * pw_remote_get_properties(struct pw_remote *remote)
Get the remote properties.
Definition: remote.c:319
pw_remote
Represents a connection with a remote PipeWire instance.
pw_remote_steal_fd
int pw_remote_steal_fd(struct pw_remote *remote)
Steal the fd of the remote connection or < 0 on error.
Definition: remote.c:425
pw_remote_get_state
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:329
pw_remote_events::state_changed
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
pw_remote::pw_remote_connect_fd
int pw_remote_connect_fd(struct pw_remote *remote, int fd)
Connect to a remote PipeWire on the given socket.
Definition: remote.c:410
pw_remote_get_core_proxy
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:369
properties.h
proxy.h
pw_remote_get_user_data
void * pw_remote_get_user_data(struct pw_remote *remote)
Get the user_data.
Definition: remote.c:324
pw_node
PipeWire node class.
pw_remote::pw_remote_disconnect
int pw_remote_disconnect(struct pw_remote *remote)
Disconnect from the remote PipeWire.
Definition: remote.c:435
pw_remote_events::info_changed
void(* info_changed)(void *data, const struct pw_core_info *info)
emited when the remote core info changed
Definition: remote.h:133
pw_remote_events
Events for the remote.
Definition: remote.h:126
pw_remote_state
pw_remote_state
The state of a pw_remote.
Definition: remote.h:115
PW_REMOTE_STATE_ERROR
remote is in error
Definition: remote.h:116
pw_remote_get_core_info
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:374
pw_remote::pw_remote_new
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:211