PipeWire: Client Object

PipeWire 0.3.34

Data Structures | Functions
Client Object

PipeWire client object class. More...

## Data Structures
struct | pw_impl_client_events
| The events that a client can emit. More...

## Functions
struct pw_impl_client * | pw_context_create_client (struct pw_impl_core *core, struct pw_protocol *protocol, struct pw_properties *properties, size_t user_data_size)
| Create a new client. More...
void | pw_impl_client_destroy (struct pw_impl_client *client)
| Destroy a previously created client. More...
int | pw_impl_client_register (struct pw_impl_client *client, struct pw_properties *properties)
| Finish configuration and register a client. More...
void * | pw_impl_client_get_user_data (struct pw_impl_client *client)
| Get the client user data. More...
const struct pw_client_info * | pw_impl_client_get_info (struct pw_impl_client *client)
| Get the client information. More...
int | pw_impl_client_update_properties (struct pw_impl_client *client, const struct spa_dict *dict)
| Update the client properties. More...
int | pw_impl_client_update_permissions (struct pw_impl_client *client, uint32_t n_permissions, const struct pw_permission *permissions)
| Update the client permissions. More...
int | pw_impl_client_check_permissions (struct pw_impl_client *client, uint32_t global_id, uint32_t permissions)
| check if a client has permissions for global_id, Since 0.3.9 More...
const struct pw_properties * | pw_impl_client_get_properties (struct pw_impl_client *client)
| Get the client properties. More...
struct pw_context * | pw_impl_client_get_context (struct pw_impl_client *client)
| Get the context used to create this client. More...
struct pw_protocol * | pw_impl_client_get_protocol (struct pw_impl_client *client)
| Get the protocol used to create this client. More...
struct pw_resource * | pw_impl_client_get_core_resource (struct pw_impl_client *client)
| Get the client core resource. More...
struct pw_resource * | pw_impl_client_find_resource (struct pw_impl_client *client, uint32_t id)
| Get a resource with the given id. More...
struct pw_global * | pw_impl_client_get_global (struct pw_impl_client *client)
| Get the global associated with this client. More...
void | pw_impl_client_add_listener (struct pw_impl_client *client, struct spa_hook *listener, const struct pw_impl_client_events *events, void *data)
| listen to events from this client More...
void | pw_impl_client_set_busy (struct pw_impl_client *client, bool busy)
| Mark the client busy. More...

## Detailed Description

PipeWire client object class.

The client object represents a client connection with the PipeWire server.

Each client has its own list of resources it is bound to along with a mapping between the client types and server types.

## Function Documentation

## ◆ pw_context_create_client()

struct pw_impl_client* pw_context_create_client | ( | struct pw_impl_core * | core,
|  | struct pw_protocol * | protocol,
|  | struct pw_properties * | properties,
|  | size_t | user_data_size
| ) |  |

Create a new client.

This is mainly used by protocols.

Create a new client.

Parameters

  core | a PipeWire Context object to register the client with
  properties | optional client properties, ownership is taken

Returns
  a newly allocated client object

Parameters

  core | the core object
  protocol | the client protocol
  properties | client properties
  user_data_size | extra user data size

References NAME, pw_log_debug, pw_properties_new(), and impl::this.

## ◆ pw_impl_client_add_listener()

void pw_impl_client_add_listener | ( | struct pw_impl_client * | client,
|  | struct spa_hook * | listener,
|  | const struct pw_impl_client_events * | events,
|  | void * | data
| ) |  |

listen to events from this client

References impl::listener, and spa_hook_list_append().

## ◆ pw_impl_client_check_permissions()

int pw_impl_client_check_permissions | ( | struct pw_impl_client * | client,
|  | uint32_t | global_id,
|  | uint32_t | permissions
| ) |  |

check if a client has permissions for global_id, Since 0.3.9

References client::context, pw_context_find_global(), and pw_global_get_permissions().

## ◆ pw_impl_client_destroy()

void pw_impl_client_destroy | ( | struct pw_impl_client * | client | ) |

Destroy a previously created client.

Destroy a previously created client.

Parameters

  client | the client to destroy

References impl::context_listener, client::link, NAME, pw_log_debug, SPA_CONTAINER_OF, spa_hook_remove(), and spa_list_remove().

Referenced by pw_context_destroy().

## ◆ pw_impl_client_find_resource()

struct pw_resource* pw_impl_client_find_resource | ( | struct pw_impl_client * | client,
|  | uint32_t | id
| ) |  |

Get a resource with the given id.

## ◆ pw_impl_client_get_context()

struct pw_context* pw_impl_client_get_context | ( | struct pw_impl_client * | client | ) |

Get the context used to create this client.

References client::core.

## ◆ pw_impl_client_get_core_resource()

struct pw_resource* pw_impl_client_get_core_resource | ( | struct pw_impl_client * | client | ) |

Get the client core resource.

## ◆ pw_impl_client_get_global()

struct pw_global* pw_impl_client_get_global | ( | struct pw_impl_client * | client | ) |

Get the global associated with this client.

## ◆ pw_impl_client_get_info()

const struct pw_client_info* pw_impl_client_get_info | ( | struct pw_impl_client * | client | ) |

Get the client information.

## ◆ pw_impl_client_get_properties()

const struct pw_properties* pw_impl_client_get_properties | ( | struct pw_impl_client * | client | ) |

Get the client properties.

## ◆ pw_impl_client_get_protocol()

struct pw_protocol* pw_impl_client_get_protocol | ( | struct pw_impl_client * | client | ) |

Get the protocol used to create this client.

## ◆ pw_impl_client_get_user_data()

void* pw_impl_client_get_user_data | ( | struct pw_impl_client * | client | ) |

Get the client user data.

## ◆ pw_impl_client_register()

int pw_impl_client_register | ( | struct pw_impl_client * | client,
|  | struct pw_properties * | properties
| ) |  |

Finish configuration and register a client.

Parameters

  client | the client to register
  properties | extra properties

References client::context, NAME, pw_global_new(), PW_KEY_MODULE_ID, PW_KEY_PROTOCOL, PW_KEY_SEC_GID, PW_KEY_SEC_LABEL, PW_KEY_SEC_PID, PW_KEY_SEC_UID, pw_log_debug, PW_TYPE_INTERFACE_Client, and PW_VERSION_CLIENT.

## ◆ pw_impl_client_set_busy()

void pw_impl_client_set_busy | ( | struct pw_impl_client * | client,
|  | bool | busy
| ) |  |

Mark the client busy.

This can be used when an asynchronous operation is started and no further processing is allowed to happen for the client

References NAME, and pw_log_debug.

## ◆ pw_impl_client_update_permissions()

int pw_impl_client_update_permissions | ( | struct pw_impl_client * | client,
|  | uint32_t | n_permissions,
|  | const struct pw_permission * | permissions
| ) |  |

Update the client permissions.

References client::core, client::id, pw_permission::id, NAME, pw_permission::permissions, pw_context_find_global(), pw_global_update_permissions(), PW_ID_ANY, pw_log_debug, pw_log_warn, PW_PERM_INVALID, and spa_list_for_each.

## ◆ pw_impl_client_update_properties()

int pw_impl_client_update_properties | ( | struct pw_impl_client * | client,
|  | const struct spa_dict * | dict
| ) |  |

Update the client properties.

Update the client properties.

Parameters

  client | the client
  dict | a struct spa_dict with properties

Add all properties in dict to the client properties. Existing properties are overwritten. Items can be removed by setting the value to NULL.