PipeWire: global.h File Reference

PipeWire 0.3.20

Data Structures | Macros | Typedefs | Functions
global.h File Reference
Include dependency graph for global.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Data Structures
struct | pw_global_events
| Global events, use pw_global_add_listener. More...

## Macros
#define | PW_VERSION_GLOBAL_EVENTS 0

## Typedefs
typedef int(* | pw_global_bind_func_t) (void *object, struct pw_impl_client *client, uint32_t permissions, uint32_t version, uint32_t id)

## Functions
struct pw_global * | pw_global_new (struct pw_context *context, const char *type, uint32_t version, struct pw_properties *properties, pw_global_bind_func_t func, void *object)
| Create a new global object. More...
int | pw_global_register (struct pw_global *global)
| Register a global object to the context registry. More...
void | pw_global_add_listener (struct pw_global *global, struct spa_hook *listener, const struct pw_global_events *events, void *data)
| Add an event listener on the global. More...
uint32_t | pw_global_get_permissions (struct pw_global *global, struct pw_impl_client *client)
| Get the permissions of the global for a given client. More...
struct pw_context * | pw_global_get_context (struct pw_global *global)
| Get the context object of this global. More...
const char * | pw_global_get_type (struct pw_global *global)
| Get the global type. More...
bool | pw_global_is_type (struct pw_global *global, const char *type)
| Check a global type. More...
uint32_t | pw_global_get_version (struct pw_global *global)
| Get the global version. More...
const struct pw_properties * | pw_global_get_properties (struct pw_global *global)
| Get the global properties. More...
int | pw_global_update_keys (struct pw_global *global, const struct spa_dict *dict, const char *keys[])
| Update the global properties, must be done when unregistered. More...
void * | pw_global_get_object (struct pw_global *global)
| Get the object associated with the global. More...
uint32_t | pw_global_get_id (struct pw_global *global)
| Get the unique id of the global. More...
int | pw_global_add_resource (struct pw_global *global, struct pw_resource *resource)
| Add a resource to a global. More...
int | pw_global_for_each_resource (struct pw_global *global, int(*callback)(void *data, struct pw_resource *resource), void *data)
| Iterate all resources added to the global The callback should return 0 to fetch the next item, any other value stops the iteration and returns the value. More...
int | pw_global_bind (struct pw_global *global, struct pw_impl_client *client, uint32_t permissions, uint32_t version, uint32_t id)
| Let a client bind to a global. More...
int | pw_global_update_permissions (struct pw_global *global, struct pw_impl_client *client, uint32_t old_permissions, uint32_t new_permissions)
void | pw_global_destroy (struct pw_global *global)
| Destroy a global. More...

## Macro Definition Documentation

## ◆ PW_VERSION_GLOBAL_EVENTS

#define PW_VERSION_GLOBAL_EVENTS 0

## Typedef Documentation

## ◆ pw_global_bind_func_t

typedef int(* pw_global_bind_func_t) (void *object, struct pw_impl_client *client, uint32_t permissions, uint32_t version, uint32_t id)

Parameters

  client | client that binds
  permissions | permissions for the bind
  version | client interface version
  id | client proxy id

## Function Documentation

## ◆ pw_global_add_listener()

void pw_global_add_listener | ( | struct pw_global * | global,
|  | struct spa_hook * | listener,
|  | const struct pw_global_events * | events,
|  | void * | data
| ) |  |

Add an event listener on the global.

## ◆ pw_global_add_resource()

int pw_global_add_resource | ( | struct pw_global * | global,
|  | struct pw_resource * | resource
| ) |  |

Add a resource to a global.

References NAME, pw_log::pw_log_debug, and pw_resource_set_bound_id().

## ◆ pw_global_bind()

int pw_global_bind | ( | struct pw_global * | global,
|  | struct pw_impl_client * | client,
|  | uint32_t | permissions,
|  | uint32_t | version,
|  | uint32_t | id
| ) |  |

Let a client bind to a global.

## ◆ pw_global_destroy()

void pw_global_destroy | ( | struct pw_global * | global | ) |

Destroy a global.

## ◆ pw_global_for_each_resource()

int pw_global_for_each_resource | ( | struct pw_global * | global,
|  | int(*)(void *data, struct pw_resource *resource) | callback,
|  | void * | data
| ) |  |

Iterate all resources added to the global The callback should return 0 to fetch the next item, any other value stops the iteration and returns the value.

When all callbacks return 0, this function returns 0 when all items are iterated.

References res.

## ◆ pw_global_get_context()

struct pw_context* pw_global_get_context | ( | struct pw_global * | global | ) |

Get the context object of this global.

## ◆ pw_global_get_id()

uint32_t pw_global_get_id | ( | struct pw_global * | global | ) |

Get the unique id of the global.

## ◆ pw_global_get_object()

void* pw_global_get_object | ( | struct pw_global * | global | ) |

Get the object associated with the global.

This depends on the type of the global

## ◆ pw_global_get_permissions()

uint32_t pw_global_get_permissions | ( | struct pw_global * | global,
|  | struct pw_impl_client * | client
| ) |  |

Get the permissions of the global for a given client.

References PW_PERM_ALL.

Referenced by pw_global::pw_global_register(), and pw_impl_client_check_permissions().

## ◆ pw_global_get_properties()

const struct pw_properties* pw_global_get_properties | ( | struct pw_global * | global | ) |

Get the global properties.

## ◆ pw_global_get_type()

const char* pw_global_get_type | ( | struct pw_global * | global | ) |

Get the global type.

## ◆ pw_global_get_version()

uint32_t pw_global_get_version | ( | struct pw_global * | global | ) |

Get the global version.

## ◆ pw_global_is_type()

bool pw_global_is_type | ( | struct pw_global * | global,
|  | const char * | type
| ) |  |

Check a global type.

## ◆ pw_global_new()

struct pw_global* pw_global_new | ( | struct pw_context * | context,
|  | const char * | type,
|  | uint32_t | version,
|  | struct pw_properties * | properties,
|  | pw_global_bind_func_t | func,
|  | void * | object
| ) |  |

Create a new global object.

Parameters

  context | the context
  type | the interface type of the global
  version | the interface version of the global
  properties | extra properties
  func | function to bind
  object | global object

## ◆ pw_global_register()

int pw_global_register | ( | struct pw_global * | global | ) |

Register a global object to the context registry.

## ◆ pw_global_update_keys()

int pw_global_update_keys | ( | struct pw_global * | global,
|  | const struct spa_dict * | dict,
|  | const char * | keys[]
| ) |  |

Update the global properties, must be done when unregistered.

References pw_properties::dict, and pw_properties::pw_properties_update_keys().

## ◆ pw_global_update_permissions()

int pw_global_update_permissions | ( | struct pw_global * | global,
|  | struct pw_impl_client * | client,
|  | uint32_t | old_permissions,
|  | uint32_t | new_permissions
| ) |  |

References NAME, PW_ID_CORE, pw_log::pw_log_debug, PW_PERM_IS_R, and pw_resource_destroy().

Referenced by pw_impl_client_update_permissions().