PipeWire  0.3.27
resource.c File Reference

Macros

#define NAME   "resource"
 

Functions

SPA_EXPORT struct pw_resourcepw_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...
 
SPA_EXPORT int pw_resource_install_marshal (struct pw_resource *this, bool implementor)
 install a marshal function on a resource More...
 
SPA_EXPORT struct pw_impl_clientpw_resource_get_client (struct pw_resource *resource)
 Get the client owning this resource. More...
 
SPA_EXPORT uint32_t pw_resource_get_id (struct pw_resource *resource)
 Get the unique id of this resource. More...
 
SPA_EXPORT uint32_t pw_resource_get_permissions (struct pw_resource *resource)
 Get the permissions of this resource. More...
 
SPA_EXPORT const char * pw_resource_get_type (struct pw_resource *resource, uint32_t *version)
 Get the type and optionally the version of this resource. More...
 
SPA_EXPORT struct pw_protocolpw_resource_get_protocol (struct pw_resource *resource)
 Get the protocol used for this resource. More...
 
SPA_EXPORT 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...
 
SPA_EXPORT 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...
 
SPA_EXPORT void pw_resource_add_object_listener (struct pw_resource *resource, struct spa_hook *listener, const void *funcs, void *data)
 Set the resource implementation. More...
 
SPA_EXPORT struct spa_hook_list * pw_resource_get_object_listeners (struct pw_resource *resource)
 Get the list of object listeners from a resource. More...
 
SPA_EXPORT const struct pw_protocol_marshalpw_resource_get_marshal (struct pw_resource *resource)
 Get the marshal functions for the resource. More...
 
SPA_EXPORT int pw_resource_ping (struct pw_resource *resource, int seq)
 Generate an ping event for a resource. More...
 
SPA_EXPORT int pw_resource_set_bound_id (struct pw_resource *resource, uint32_t global_id)
 Notify global id this resource is bound to. More...
 
SPA_EXPORT 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...
 
SPA_EXPORT void pw_resource_errorf (struct pw_resource *resource, int res, const char *error,...)
 
SPA_EXPORT void pw_resource_errorf_id (struct pw_resource *resource, uint32_t id, int res, const char *error,...)
 
SPA_EXPORT void pw_resource_error (struct pw_resource *resource, int res, const char *error)
 Generate an error for a resource. More...
 
SPA_EXPORT void pw_resource_destroy (struct pw_resource *resource)
 Destroy a resource. More...
 
SPA_EXPORT 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...
 

Macro Definition Documentation

◆ NAME

#define NAME   "resource"

Function Documentation

◆ pw_resource_add_listener()

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

◆ pw_resource_add_object_listener()

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

Set the resource implementation.

◆ pw_resource_destroy()

SPA_EXPORT void pw_resource_destroy ( struct pw_resource resource)

◆ pw_resource_error()

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

Generate an error for a resource.

References res.

◆ pw_resource_errorf()

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

References res, va_end(), and va_start().

◆ pw_resource_errorf_id()

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

References res, va_end(), and va_start().

◆ pw_resource_get_bound_id()

SPA_EXPORT 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()

SPA_EXPORT struct pw_impl_client* pw_resource_get_client ( struct pw_resource resource)

Get the client owning this resource.

◆ pw_resource_get_id()

SPA_EXPORT uint32_t pw_resource_get_id ( struct pw_resource resource)

Get the unique id of this resource.

◆ pw_resource_get_marshal()

SPA_EXPORT 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()

SPA_EXPORT 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()

SPA_EXPORT uint32_t pw_resource_get_permissions ( struct pw_resource resource)

Get the permissions of this resource.

◆ pw_resource_get_protocol()

SPA_EXPORT struct pw_protocol* pw_resource_get_protocol ( struct pw_resource resource)

Get the protocol used for this resource.

◆ pw_resource_get_type()

SPA_EXPORT 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()

SPA_EXPORT 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()

SPA_EXPORT int pw_resource_install_marshal ( struct pw_resource this,
bool  implementor 
)

◆ pw_resource_new()

SPA_EXPORT 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 id, NAME, pw_log::pw_log_debug, pw_log::pw_log_error, pw_map::pw_map_insert_at(), pw_resource_install_marshal(), res, and impl::this.

◆ pw_resource_ping()

SPA_EXPORT 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 NAME, pw_log::pw_log_debug, res, and seq.

◆ pw_resource_remove()

SPA_EXPORT 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()

SPA_EXPORT int pw_resource_set_bound_id ( struct pw_resource resource,
uint32_t  global_id 
)

Notify global id this resource is bound to.

References NAME, and pw_log::pw_log_debug.

Referenced by pw_global_add_resource().