PipeWire  0.3.33
Proxy Object

Represents an object on the client side. More...

Data Structures

struct  pw_proxy_events
 Proxy events, use pw_proxy_add_listener. More...
 

Macros

#define pw_proxy_notify(p, type, event, version, ...)
 
#define pw_proxy_call(p, type, method, version, ...)
 
#define pw_proxy_call_res(p, type, method, version, ...)
 

Functions

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. More...
 
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. More...
 
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. More...
 
void pw_proxy_destroy (struct pw_proxy *proxy)
 destroy a proxy More...
 
void * pw_proxy_get_user_data (struct pw_proxy *proxy)
 Get the user_data. More...
 
uint32_t pw_proxy_get_id (struct pw_proxy *proxy)
 Get the local id of the proxy. More...
 
const char * pw_proxy_get_type (struct pw_proxy *proxy, uint32_t *version)
 Get the type and version of the proxy. More...
 
struct pw_protocol * pw_proxy_get_protocol (struct pw_proxy *proxy)
 Get the protocol used for the proxy. More...
 
int pw_proxy_sync (struct pw_proxy *proxy, int seq)
 Generate an sync method for a proxy. More...
 
int pw_proxy_set_bound_id (struct pw_proxy *proxy, uint32_t global_id)
 Set the global id this proxy is bound to. More...
 
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. More...
 
int pw_proxy_error (struct pw_proxy *proxy, int res, const char *error)
 Generate an error for a proxy. More...
 
int pw_proxy_errorf (struct pw_proxy *proxy, int res, const char *error,...) 1(3
 
int struct spa_hook_listpw_proxy_get_object_listeners (struct pw_proxy *proxy)
 Get the listener of proxy. More...
 
const struct pw_protocol_marshalpw_proxy_get_marshal (struct pw_proxy *proxy)
 Get the marshal functions for the proxy. More...
 
int pw_proxy_install_marshal (struct pw_proxy *proxy, bool implementor)
 Install a marshal function on a proxy. More...
 

Detailed Description

Represents an object on the client side.

A pw_proxy acts as a client side proxy to an object existing in a remote pipewire instance. The proxy is responsible for converting interface functions invoked by the client to PipeWire messages. Events will call the handlers set in listener.

See Proxy

Macro Definition Documentation

◆ pw_proxy_call

#define pw_proxy_call (   p,
  type,
  method,
  version,
  ... 
)
Value:
type, method, version, ##__VA_ARGS__)

◆ pw_proxy_call_res

#define pw_proxy_call_res (   p,
  type,
  method,
  version,
  ... 
)
Value:
({ \
int _res = -ENOTSUP; \
spa_interface_call_res((struct spa_interface*)p, \
type, _res, method, version, ##__VA_ARGS__); \
_res; \
})

◆ pw_proxy_notify

#define pw_proxy_notify (   p,
  type,
  event,
  version,
  ... 
)
Value:
type, event, version, ## __VA_ARGS__)

Function Documentation

◆ 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.

References spa_hook_list_append().

◆ 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.

The events depend on the type of the remote object type.

Parameters
proxythe proxy
listenerlistener
funcsproxied functions
datadata passed to events

References spa_hook_list_append().

◆ pw_proxy_destroy()

void pw_proxy_destroy ( struct pw_proxy *  proxy)

destroy a proxy

destroy a proxy

Parameters
proxyProxy object to destroy
Note
This is normally called by The PipeWire Core Global Object when the server decides to destroy the server side object

References NAME, pw_core_destroy, and pw_log_debug.

Referenced by pw_core_disconnect(), pw_filter_disconnect(), and pw_stream_disconnect().

◆ pw_proxy_error()

int pw_proxy_error ( struct pw_proxy *  proxy,
int  res,
const char *  error 
)

Generate an error for a proxy.

References pw_core_error.

Referenced by pw_filter_set_error(), and pw_stream_set_error().

◆ pw_proxy_errorf()

int pw_proxy_errorf ( struct pw_proxy *  proxy,
int  res,
const char *  error,
  ... 
)

◆ 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.

◆ pw_proxy_get_id()

uint32_t pw_proxy_get_id ( struct pw_proxy *  proxy)

Get the local id of the proxy.

◆ pw_proxy_get_marshal()

const struct pw_protocol_marshal* pw_proxy_get_marshal ( struct pw_proxy *  proxy)

Get the marshal functions for the proxy.

◆ pw_proxy_get_object_listeners()

int struct spa_hook_list* pw_proxy_get_object_listeners ( struct pw_proxy *  proxy)

Get the listener of proxy.

◆ pw_proxy_get_protocol()

struct pw_protocol* pw_proxy_get_protocol ( struct pw_proxy *  proxy)

Get the protocol used for the proxy.

◆ 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.

References pw_protocol_marshal::version.

◆ pw_proxy_get_user_data()

void* pw_proxy_get_user_data ( struct pw_proxy *  proxy)

Get the user_data.

The size was given in pw_proxy_new

◆ pw_proxy_install_marshal()

int pw_proxy_install_marshal ( struct pw_proxy *  proxy,
bool  implementor 
)

◆ 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.

Parameters
factoryanother proxy object that serves as a factory
typeType of the proxy object
user_data_sizesize of user_data
Returns
A newly allocated proxy object or NULL on failure

This function creates a new proxy object with the supplied id and type. The proxy object will have an id assigned from the client id space.

See also
The PipeWire Core Global Object

References NAME, pw_log_debug, pw_proxy_init(), SPA_PTROFF, and impl::this.

◆ 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.

This is usually used internally and will also emit the bound event

References NAME, and pw_log_debug.

◆ pw_proxy_sync()

int pw_proxy_sync ( struct pw_proxy *  proxy,
int  seq 
)

Generate an sync method for a proxy.

This will generate a done event with the same seq number of the reply.

References NAME, pw_core_sync, and pw_log_debug.

Referenced by sm_object_sync_update().

spa_interface
Definition: hook.h:146
spa_hook_list_call
#define spa_hook_list_call(l, t, m, v,...)
Call the method named m for each element in list l.
Definition: hook.h:407
spa_interface_call
#define spa_interface_call(iface, method_type, method, vers,...)
Invoke method named method in the callbacks on the given interface object.
Definition: hook.h:198
spa_pod::type
uint32_t type
Definition: pod/pod.h:52
pw_proxy_get_object_listeners
int struct spa_hook_list * pw_proxy_get_object_listeners(struct pw_proxy *proxy)
Get the listener of proxy.
Definition: proxy.c:350