PipeWire: pipewire/proxy.h Source File

PipeWire 1.6.8

Loading...
Searching...
No Matches
proxy.h
Go to the documentation of this file.
1/* PipeWire */
2/* SPDX-FileCopyrightText: Copyright © 2018 Wim Taymans */
3/* SPDX-License-Identifier: MIT */
4
5#ifndef PIPEWIRE_PROXY_H
6#define PIPEWIRE_PROXY_H
7
8#include <spa/utils/hook.h>
9
10#ifdef __cplusplus
11extern "C" {
12#endif
13
71
83
88struct pw_proxy;
89
90#include <pipewire/protocol.h>
91
93struct pw_proxy_events {
94#define PW_VERSION_PROXY_EVENTS 1
95 uint32_t version;
96
98 void (*destroy) (void *data);
99
101 void (*bound) (void *data, uint32_t global_id);
102
105 void (*removed) (void *data);
106
108 void (*done) (void *data, int seq);
109
111 void (*error) (void *data, int seq, int res, const char *message);
112
113 void (*bound_props) (void *data, uint32_t global_id, const struct spa_dict *props);
114};
115
116/* Make a new proxy object. The id can be used to bind to a remote object and
117 * can be retrieved with \ref pw_proxy_get_id . */
118struct pw_proxy *
119 pw_proxy_new(struct pw_proxy *factory,
120 const char *type, /* interface type */
121 uint32_t version, /* interface version */
122 size_t user_data_size /* size of user data */);
123
125void pw_proxy_add_listener(struct pw_proxy *proxy,
126 struct spa_hook *listener,
127 const struct pw_proxy_events *events,
128 void *data);
129
132void pw_proxy_add_object_listener(struct pw_proxy *proxy,
133 struct spa_hook *listener,
134 const void *funcs,
135 void *data );
136
138void pw_proxy_destroy(struct pw_proxy *proxy);
139
140void pw_proxy_ref(struct pw_proxy *proxy);
141void pw_proxy_unref(struct pw_proxy *proxy);
142
144void *pw_proxy_get_user_data(struct pw_proxy *proxy);
145
147uint32_t pw_proxy_get_id(struct pw_proxy *proxy);
148
150const char *pw_proxy_get_type(struct pw_proxy *proxy, uint32_t *version);
151
153struct pw_protocol *pw_proxy_get_protocol(struct pw_proxy *proxy);
154
157int pw_proxy_sync(struct pw_proxy *proxy, int seq);
158
161int pw_proxy_set_bound_id(struct pw_proxy *proxy, uint32_t global_id);
164uint32_t pw_proxy_get_bound_id(struct pw_proxy *proxy);
165
167int pw_proxy_error(struct pw_proxy *proxy, int res, const char *error);
168int pw_proxy_errorf(struct pw_proxy *proxy, int res, const char *error, ...) SPA_PRINTF_FUNC(3, 4);
169
171struct spa_hook_list *pw_proxy_get_object_listeners(struct pw_proxy *proxy);
172
174const struct pw_protocol_marshal *pw_proxy_get_marshal(struct pw_proxy *proxy);
175
177int pw_proxy_install_marshal(struct pw_proxy *proxy, bool implementor);
178
179#define pw_proxy_notify(p,type,event,version,...) \
180 spa_hook_list_call(pw_proxy_get_object_listeners(p), \
181 type, event, version, ## __VA_ARGS__)
182
183#define pw_proxy_call(p,type,method,version,...) \
184 spa_interface_call((struct spa_interface*)p, \
185 type, method, version, ##__VA_ARGS__)
186
187#define pw_proxy_call_res(p,type,method,version,...) \
188({ \
189 int _res = -ENOTSUP; \
190 spa_interface_call_res((struct spa_interface*)p, \
191 type, _res, method, version, ##__VA_ARGS__); \
192 _res; \
193})
194
198
199#ifdef __cplusplus
200}
201#endif
202
203#endif /* PIPEWIRE_PROXY_H */
seq
uint32_t int seq
Definition core.h:432
message
uint32_t int int const char * message
Definition core.h:433
res
uint32_t int int res
Definition core.h:433
pw_proxy_set_bound_id
int pw_proxy_set_bound_id(struct pw_proxy *proxy, uint32_t global_id)
Set the global id this proxy is bound to.
Definition proxy.c:141
pw_proxy_add_listener
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:172
pw_proxy_get_marshal
const struct pw_protocol_marshal * pw_proxy_get_marshal(struct pw_proxy *proxy)
Get the marshal functions for the proxy.
Definition proxy.c:349
pw_proxy_get_user_data
void * pw_proxy_get_user_data(struct pw_proxy *proxy)
Get the user_data.
Definition proxy.c:129
pw_proxy_get_type
const char * pw_proxy_get_type(struct pw_proxy *proxy, uint32_t *version)
Get the type and version of the proxy.
Definition proxy.c:156
pw_proxy_add_object_listener
void pw_proxy_add_object_listener(struct pw_proxy *proxy, struct spa_hook *listener, const void *funcs, void *data)
Add a listener for the events received from the remote object.
Definition proxy.c:181
pw_proxy_new
struct pw_proxy * pw_proxy_new(struct pw_proxy *factory, const char *type, uint32_t version, size_t user_data_size)
Create a proxy object with a given id and type.
Definition proxy.c:73
pw_proxy_errorf
int pw_proxy_errorf(struct pw_proxy *proxy, int res, const char *error,...)
Definition proxy.c:316
pw_proxy_unref
void pw_proxy_unref(struct pw_proxy *proxy)
Definition proxy.c:267
pw_proxy_error
int pw_proxy_error(struct pw_proxy *proxy, int res, const char *error)
Generate an error for a proxy.
Definition proxy.c:331
pw_proxy_get_object_listeners
struct spa_hook_list * pw_proxy_get_object_listeners(struct pw_proxy *proxy)
Get the listener of proxy.
Definition proxy.c:343
pw_proxy_get_bound_id
uint32_t pw_proxy_get_bound_id(struct pw_proxy *proxy)
Get the global id bound to this proxy of SPA_ID_INVALID when not bound to a global.
Definition proxy.c:150
pw_proxy_get_protocol
struct pw_protocol * pw_proxy_get_protocol(struct pw_proxy *proxy)
Get the protocol used for the proxy.
Definition proxy.c:164
pw_proxy_sync
int pw_proxy_sync(struct pw_proxy *proxy, int seq)
Generate an sync method for a proxy.
Definition proxy.c:303
pw_proxy_get_id
uint32_t pw_proxy_get_id(struct pw_proxy *proxy)
Get the local id of the proxy.
Definition proxy.c:135
pw_proxy_ref
void pw_proxy_ref(struct pw_proxy *proxy)
Definition proxy.c:296
pw_proxy_install_marshal
int pw_proxy_install_marshal(struct pw_proxy *proxy, bool implementor)
Install a marshal function on a proxy.
Definition proxy.c:104
pw_proxy_destroy
void pw_proxy_destroy(struct pw_proxy *proxy)
destroy a proxy
Definition proxy.c:209
SPA_PRINTF_FUNC
#define SPA_PRINTF_FUNC(fmt, arg1)
Definition defs.h:297
hook.h
spa/utils/hook.h
protocol.h
pipewire/protocol.h
pw_protocol_marshal
Definition protocol.h:77
pw_protocol
pw_proxy_events
Proxy events, use pw_proxy_add_listener.
Definition proxy.h:98
pw_proxy_events::done
void(* done)(void *data, int seq)
a reply to a sync method completed
Definition proxy.h:114
pw_proxy_events::bound_props
void(* bound_props)(void *data, uint32_t global_id, const struct spa_dict *props)
Definition proxy.h:119
pw_proxy_events::version
uint32_t version
Definition proxy.h:101
pw_proxy_events::removed
void(* removed)(void *data)
a proxy is removed from the server.
Definition proxy.h:111
pw_proxy_events::bound
void(* bound)(void *data, uint32_t global_id)
a proxy is bound to a global id
Definition proxy.h:107
pw_proxy_events::destroy
void(* destroy)(void *data)
The proxy is destroyed.
Definition proxy.h:104
pw_proxy_events::error
void(* error)(void *data, int seq, int res, const char *message)
an error occurred on the proxy
Definition proxy.h:117
pw_proxy
spa_dict
Definition dict.h:51
spa_hook_list
A list of hooks.
Definition hook.h:416
spa_hook
A hook, contains the structure with functions and the data passed to the functions.
Definition hook.h:427