mirror of
https://gitlab.freedesktop.org/pipewire/pipewire
synced 2024-09-20 00:11:31 +00:00
global: add the object.serial property for globals
Make sure the lower 32 bits of the serial are never SPA_ID_INVALID. This makes it possible for applications that need a unique 32 bits number to use the lower bits while still having an invalid 32 bit serial number.
This commit is contained in:
parent
59c4975750
commit
53548aee75
|
@ -135,7 +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;
|
global->serial = serial++;
|
||||||
|
if ((uint32_t)serial == SPA_ID_INVALID)
|
||||||
|
serial++;
|
||||||
|
|
||||||
|
pw_properties_setf(global->properties,
|
||||||
|
PW_KEY_OBJECT_SERIAL, "%"PRIu64, global->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);
|
||||||
|
|
|
@ -64,6 +64,10 @@ extern "C" {
|
||||||
/** object properties */
|
/** object properties */
|
||||||
#define PW_KEY_OBJECT_PATH "object.path" /**< unique path to construct the object */
|
#define PW_KEY_OBJECT_PATH "object.path" /**< unique path to construct the object */
|
||||||
#define PW_KEY_OBJECT_ID "object.id" /**< a global object id */
|
#define PW_KEY_OBJECT_ID "object.id" /**< a global object id */
|
||||||
|
#define PW_KEY_OBJECT_SERIAL "object.serial" /**< a 64 bit object serial number. This is a number
|
||||||
|
* incremented for each object that is created.
|
||||||
|
* The lower 32 bits are guaranteed to never be
|
||||||
|
* SPA_ID_INVALID. */
|
||||||
#define PW_KEY_OBJECT_LINGER "object.linger" /**< the object lives on even after the client
|
#define PW_KEY_OBJECT_LINGER "object.linger" /**< the object lives on even after the client
|
||||||
* that created it has been destroyed */
|
* that created it has been destroyed */
|
||||||
#define PW_KEY_OBJECT_REGISTER "object.register" /**< If the object should be registered. */
|
#define PW_KEY_OBJECT_REGISTER "object.register" /**< If the object should be registered. */
|
||||||
|
|
Loading…
Reference in a new issue