mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-06 13:30:01 -05:00
global: add serial number
Add a global serial number for each global object. We can use this to uniquely define each global.
This commit is contained in:
parent
dd62b12a1f
commit
59c4975750
2 changed files with 9 additions and 3 deletions
|
|
@ -36,6 +36,8 @@
|
||||||
PW_LOG_TOPIC_EXTERN(log_global);
|
PW_LOG_TOPIC_EXTERN(log_global);
|
||||||
#define PW_LOG_TOPIC_DEFAULT log_global
|
#define PW_LOG_TOPIC_DEFAULT log_global
|
||||||
|
|
||||||
|
static uint64_t serial = 0;
|
||||||
|
|
||||||
/** \cond */
|
/** \cond */
|
||||||
struct impl {
|
struct impl {
|
||||||
struct pw_global this;
|
struct pw_global this;
|
||||||
|
|
@ -133,10 +135,12 @@ int pw_global_register(struct pw_global *global)
|
||||||
|
|
||||||
spa_list_append(&context->global_list, &global->link);
|
spa_list_append(&context->global_list, &global->link);
|
||||||
global->registered = true;
|
global->registered = true;
|
||||||
|
global->serial = ++serial;
|
||||||
|
|
||||||
spa_list_for_each(registry, &context->registry_resource_list, link) {
|
spa_list_for_each(registry, &context->registry_resource_list, link) {
|
||||||
uint32_t permissions = pw_global_get_permissions(global, registry->client);
|
uint32_t permissions = pw_global_get_permissions(global, registry->client);
|
||||||
pw_log_debug("registry %p: global %d %08x", registry, global->id, permissions);
|
pw_log_debug("registry %p: global %d %08x serial:%"PRIu64,
|
||||||
|
registry, global->id, permissions, global->serial);
|
||||||
if (PW_PERM_IS_R(permissions))
|
if (PW_PERM_IS_R(permissions))
|
||||||
pw_registry_resource_global(registry,
|
pw_registry_resource_global(registry,
|
||||||
global->id,
|
global->id,
|
||||||
|
|
@ -337,8 +341,9 @@ int pw_global_update_permissions(struct pw_global *global, struct pw_impl_client
|
||||||
pw_registry_resource_global_remove(resource, global->id);
|
pw_registry_resource_global_remove(resource, global->id);
|
||||||
}
|
}
|
||||||
else if (do_show) {
|
else if (do_show) {
|
||||||
pw_log_debug("client %p: resource %p show global %d",
|
pw_log_debug("client %p: resource %p show global %d serial:%"PRIu64,
|
||||||
client, resource, global->id);
|
client, resource, global->id,
|
||||||
|
global->serial);
|
||||||
pw_registry_resource_global(resource,
|
pw_registry_resource_global(resource,
|
||||||
global->id,
|
global->id,
|
||||||
new_permissions,
|
new_permissions,
|
||||||
|
|
|
||||||
|
|
@ -330,6 +330,7 @@ struct pw_global {
|
||||||
|
|
||||||
pw_global_bind_func_t func; /**< bind function */
|
pw_global_bind_func_t func; /**< bind function */
|
||||||
void *object; /**< object associated with the interface */
|
void *object; /**< object associated with the interface */
|
||||||
|
uint64_t serial; /**< increasing serial number */
|
||||||
|
|
||||||
struct spa_list resource_list; /**< The list of resources of this global */
|
struct spa_list resource_list; /**< The list of resources of this global */
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue