PipeWire  0.3.33
PipeWire Resources

Client owned objects. More...

Data Structures

struct  pw_resource_events
 Resource events. More...
 

Macros

#define pw_resource_notify(r, type, event, version, ...)
 
#define pw_resource_call(r, type, method, version, ...)
 
#define pw_resource_call_res(r, type, method, version, ...)
 

Functions

struct pw_resource * pw_resource_new (struct pw_impl_client *client, uint32_t id, uint32_t permissions, const char *type, uint32_t version, size_t user_data_size)
 Make a new resource for client. More...
 
void pw_resource_destroy (struct pw_resource *resource)
 Destroy a resource. More...
 
void pw_resource_remove (struct pw_resource *resource)
 Remove a resource, like pw_resource_destroy but without sending a remove_id message to the client. More...
 
struct pw_impl_client * pw_resource_get_client (struct pw_resource *resource)
 Get the client owning this resource. More...
 
uint32_t pw_resource_get_id (struct pw_resource *resource)
 Get the unique id of this resource. More...
 
uint32_t pw_resource_get_permissions (struct pw_resource *resource)
 Get the permissions of this resource. More...
 
const char * pw_resource_get_type (struct pw_resource *resource, uint32_t *version)
 Get the type and optionally the version of this resource. More...
 
struct pw_protocol * pw_resource_get_protocol (struct pw_resource *resource)
 Get the protocol used for this resource. More...
 
void * pw_resource_get_user_data (struct pw_resource *resource)
 Get the user data for the resource, the size was given in pw_resource_new. More...
 
void pw_resource_add_listener (struct pw_resource *resource, struct spa_hook *listener, const struct pw_resource_events *events, void *data)
 Add an event listener. More...
 
void pw_resource_add_object_listener (struct pw_resource *resource, struct spa_hook *listener, const void *funcs, void *data)
 Set the resource implementation. More...
 
int pw_resource_ping (struct pw_resource *resource, int seq)
 Generate an ping event for a resource. More...
 
int pw_resource_set_bound_id (struct pw_resource *resource, uint32_t global_id)
 Notify global id this resource is bound to. More...
 
uint32_t pw_resource_get_bound_id (struct pw_resource *resource)
 Get the global id this resource is bound to or SPA_ID_INVALID when not bound. More...
 
void pw_resource_error (struct pw_resource *resource, int res, const char *error)
 Generate an error for a resource. More...
 
void pw_resource_errorf (struct pw_resource *resource, int res, const char *error,...) 1(3
 
void void pw_resource_errorf_id (struct pw_resource *resource, uint32_t id, int res, const char *error,...) 1(4
 
void void struct spa_hook_listpw_resource_get_object_listeners (struct pw_resource *resource)
 Get the list of object listeners from a resource. More...
 
const struct pw_protocol_marshalpw_resource_get_marshal (struct pw_resource *resource)
 Get the marshal functions for the resource. More...
 
int pw_resource_install_marshal (struct pw_resource *resource, bool implementor)
 install a marshal function on a resource More...
 

Detailed Description

Client owned objects.

Resources represent objects owned by a Client Object. They are the result of binding to a global resource or by calling API that creates client owned objects.

The client usually has a proxy object associated with the resource that it can use to communicate with the resource. See Proxy.

Resources are destroyed when the client or the bound object is destroyed.

Macro Definition Documentation

◆ pw_resource_call

#define pw_resource_call (   r,
  type,
  method,
  version,
  ... 
)
Value:
type, method, version, ##__VA_ARGS__)

◆ pw_resource_call_res

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

◆ pw_resource_notify

#define pw_resource_notify (   r,
  type,
  event,
  version,
  ... 
)
Value:
type, event, version, ## __VA_ARGS__)

Function Documentation

◆ pw_resource_add_listener()

void pw_resource_add_listener ( struct pw_resource *  resource,
struct spa_hook listener,
const struct pw_resource_events events,
void *  data 
)

Add an event listener.

References spa_hook_list_append().

◆ pw_resource_add_object_listener()

void pw_resource_add_object_listener ( struct pw_resource *  resource,
struct spa_hook listener,
const void *  funcs,
void *  data 
)

Set the resource implementation.

References spa_hook_list_append().

◆ pw_resource_destroy()

void pw_resource_destroy ( struct pw_resource *  resource)

◆ pw_resource_error()

void pw_resource_error ( struct pw_resource *  resource,
int  res,
const char *  error 
)

Generate an error for a resource.

References client::id.

◆ pw_resource_errorf()

void pw_resource_errorf ( struct pw_resource *  resource,
int  res,
const char *  error,
  ... 
)

◆ pw_resource_errorf_id()

void void pw_resource_errorf_id ( struct pw_resource *  resource,
uint32_t  id,
int  res,
const char *  error,
  ... 
)

◆ pw_resource_get_bound_id()

uint32_t pw_resource_get_bound_id ( struct pw_resource *  resource)

Get the global id this resource is bound to or SPA_ID_INVALID when not bound.

◆ pw_resource_get_client()

struct pw_impl_client* pw_resource_get_client ( struct pw_resource *  resource)

Get the client owning this resource.

◆ pw_resource_get_id()

uint32_t pw_resource_get_id ( struct pw_resource *  resource)

Get the unique id of this resource.

◆ pw_resource_get_marshal()

const struct pw_protocol_marshal* pw_resource_get_marshal ( struct pw_resource *  resource)

Get the marshal functions for the resource.

◆ pw_resource_get_object_listeners()

void void struct spa_hook_list* pw_resource_get_object_listeners ( struct pw_resource *  resource)

Get the list of object listeners from a resource.

◆ pw_resource_get_permissions()

uint32_t pw_resource_get_permissions ( struct pw_resource *  resource)

Get the permissions of this resource.

◆ pw_resource_get_protocol()

struct pw_protocol* pw_resource_get_protocol ( struct pw_resource *  resource)

Get the protocol used for this resource.

◆ pw_resource_get_type()

const char* pw_resource_get_type ( struct pw_resource *  resource,
uint32_t *  version 
)

Get the type and optionally the version of this resource.

◆ pw_resource_get_user_data()

void* pw_resource_get_user_data ( struct pw_resource *  resource)

Get the user data for the resource, the size was given in pw_resource_new.

◆ pw_resource_install_marshal()

int pw_resource_install_marshal ( struct pw_resource *  resource,
bool  implementor 
)

◆ pw_resource_new()

struct pw_resource* pw_resource_new ( struct pw_impl_client *  client,
uint32_t  id,
uint32_t  permissions,
const char *  type,
uint32_t  version,
size_t  user_data_size 
)

Make a new resource for client.

Parameters
clientthe client owning the resource
idthe remote per client id
permissionspermissions on this resource
typeinterface of the resource
versionrequested interface version
user_data_sizeextra user data size

References client::context, spa_hook_list_init(), SPA_ID_INVALID, and impl::this.

◆ pw_resource_ping()

int pw_resource_ping ( struct pw_resource *  resource,
int  seq 
)

Generate an ping event for a resource.

This will generate a pong event with the same sequence number in the return value.

References client::id, NAME, and pw_log_debug.

◆ pw_resource_remove()

void pw_resource_remove ( struct pw_resource *  resource)

Remove a resource, like pw_resource_destroy but without sending a remove_id message to the client.

References pw_resource_destroy().

◆ pw_resource_set_bound_id()

int pw_resource_set_bound_id ( struct pw_resource *  resource,
uint32_t  global_id 
)

Notify global id this resource is bound to.

References client::id, NAME, and pw_log_debug.

Referenced by pw_global_add_resource().

spa_interface
Definition: hook.h:146
pw_resource_get_object_listeners
void void struct spa_hook_list * pw_resource_get_object_listeners(struct pw_resource *resource)
Get the list of object listeners from a resource.
Definition: resource.c:183
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