diff --git a/src/modules/module-protocol-native/protocol-native.c b/src/modules/module-protocol-native/protocol-native.c index 86f134aeb..31c0ba351 100644 --- a/src/modules/module-protocol-native/protocol-native.c +++ b/src/modules/module-protocol-native/protocol-native.c @@ -188,6 +188,7 @@ static bool core_demarshal_info(void *object, void *data, size_t size) if (!spa_pod_iter_struct(&it, data, size) || !spa_pod_iter_get(&it, + SPA_POD_TYPE_INT, &info.id, SPA_POD_TYPE_LONG, &info.change_mask, SPA_POD_TYPE_STRING, &info.user_name, SPA_POD_TYPE_STRING, &info.host_name, @@ -287,6 +288,7 @@ static void core_marshal_info(void *object, struct pw_core_info *info) spa_pod_builder_add(b, SPA_POD_TYPE_STRUCT, &f, + SPA_POD_TYPE_INT, info->id, SPA_POD_TYPE_LONG, info->change_mask, SPA_POD_TYPE_STRING, info->user_name, SPA_POD_TYPE_STRING, info->host_name, @@ -585,6 +587,7 @@ static void module_marshal_info(void *object, struct pw_module_info *info) spa_pod_builder_add(b, SPA_POD_TYPE_STRUCT, &f, + SPA_POD_TYPE_INT, info->id, SPA_POD_TYPE_LONG, info->change_mask, SPA_POD_TYPE_STRING, info->name, SPA_POD_TYPE_STRING, info->filename, @@ -610,6 +613,7 @@ static bool module_demarshal_info(void *object, void *data, size_t size) if (!spa_pod_iter_struct(&it, data, size) || !spa_pod_iter_get(&it, + SPA_POD_TYPE_INT, &info.id, SPA_POD_TYPE_LONG, &info.change_mask, SPA_POD_TYPE_STRING, &info.name, SPA_POD_TYPE_STRING, &info.filename, @@ -639,6 +643,7 @@ static void node_marshal_info(void *object, struct pw_node_info *info) spa_pod_builder_add(b, SPA_POD_TYPE_STRUCT, &f, + SPA_POD_TYPE_INT, info->id, SPA_POD_TYPE_LONG, info->change_mask, SPA_POD_TYPE_STRING, info->name, SPA_POD_TYPE_INT, info->max_input_ports, @@ -682,6 +687,7 @@ static bool node_demarshal_info(void *object, void *data, size_t size) if (!spa_pod_iter_struct(&it, data, size) || !spa_pod_iter_get(&it, + SPA_POD_TYPE_INT, &info.id, SPA_POD_TYPE_LONG, &info.change_mask, SPA_POD_TYPE_STRING, &info.name, SPA_POD_TYPE_INT, &info.max_input_ports, @@ -736,6 +742,7 @@ static void client_marshal_info(void *object, struct pw_client_info *info) spa_pod_builder_add(b, SPA_POD_TYPE_STRUCT, &f, + SPA_POD_TYPE_INT, info->id, SPA_POD_TYPE_LONG, info->change_mask, SPA_POD_TYPE_INT, n_items, 0); @@ -759,6 +766,7 @@ static bool client_demarshal_info(void *object, void *data, size_t size) if (!spa_pod_iter_struct(&it, data, size) || !spa_pod_iter_get(&it, + SPA_POD_TYPE_INT, &info.id, SPA_POD_TYPE_LONG, &info.change_mask, SPA_POD_TYPE_INT, &props.n_items, 0)) return false; @@ -788,6 +796,7 @@ static void link_marshal_info(void *object, struct pw_link_info *info) spa_pod_builder_add(b, SPA_POD_TYPE_STRUCT, &f, + SPA_POD_TYPE_INT, info->id, SPA_POD_TYPE_LONG, info->change_mask, SPA_POD_TYPE_INT, info->output_node_id, SPA_POD_TYPE_INT, info->output_port_id, @@ -816,6 +825,7 @@ static bool link_demarshal_info(void *object, void *data, size_t size) if (!spa_pod_iter_struct(&it, data, size) || !spa_pod_iter_get(&it, + SPA_POD_TYPE_INT, &info.id, SPA_POD_TYPE_LONG, &info.change_mask, SPA_POD_TYPE_INT, &info.output_node_id, SPA_POD_TYPE_INT, &info.output_port_id, diff --git a/src/pipewire/client.c b/src/pipewire/client.c index c94f2f542..e450bff0e 100644 --- a/src/pipewire/client.c +++ b/src/pipewire/client.c @@ -138,6 +138,8 @@ struct pw_client *pw_client_new(struct pw_core *core, this->global = pw_core_add_global(core, NULL, parent, core->type.client, PW_VERSION_CLIENT, client_bind_func, this); + this->info.id = this->global->id; + return this; } diff --git a/src/pipewire/core.c b/src/pipewire/core.c index e0fa1f0af..26063b561 100644 --- a/src/pipewire/core.c +++ b/src/pipewire/core.c @@ -387,6 +387,8 @@ struct pw_core *pw_core_new(struct pw_loop *main_loop, struct pw_properties *pro PW_VERSION_CORE, core_bind_func, this); + this->info.id = this->global->id; + return this; no_mem: diff --git a/src/pipewire/introspect.c b/src/pipewire/introspect.c index 3524ac990..7eb5e99d5 100644 --- a/src/pipewire/introspect.c +++ b/src/pipewire/introspect.c @@ -126,6 +126,7 @@ struct pw_core_info *pw_core_info_update(struct pw_core_info *info, if (info == NULL) return NULL; } + info->id = update->id; info->change_mask = update->change_mask; if (update->change_mask & PW_CORE_CHANGE_MASK_USER_NAME) { @@ -186,6 +187,7 @@ struct pw_node_info *pw_node_info_update(struct pw_node_info *info, if (info == NULL) return NULL; } + info->id = update->id; info->change_mask = update->change_mask; if (update->change_mask & PW_NODE_CHANGE_MASK_NAME) { @@ -282,6 +284,7 @@ struct pw_module_info *pw_module_info_update(struct pw_module_info *info, if (info == NULL) return NULL; } + info->id = update->id; info->change_mask = update->change_mask; if (update->change_mask & PW_MODULE_CHANGE_MASK_NAME) { @@ -332,6 +335,7 @@ struct pw_client_info *pw_client_info_update(struct pw_client_info *info, if (info == NULL) return NULL; } + info->id = update->id; info->change_mask = update->change_mask; if (update->change_mask & PW_CLIENT_CHANGE_MASK_PROPS) { @@ -360,6 +364,7 @@ struct pw_link_info *pw_link_info_update(struct pw_link_info *info, if (info == NULL) return NULL; } + info->id = update->id; info->change_mask = update->change_mask; if (update->change_mask & PW_LINK_CHANGE_MASK_OUTPUT) { diff --git a/src/pipewire/introspect.h b/src/pipewire/introspect.h index 841382a4f..a46bf630c 100644 --- a/src/pipewire/introspect.h +++ b/src/pipewire/introspect.h @@ -74,6 +74,7 @@ const char * pw_link_state_as_string(enum pw_link_state state); /** The core information. Extra information can be added in later versions \memberof pw_introspect */ struct pw_core_info { + uint32_t id; /**< id of the global */ #define PW_CORE_CHANGE_MASK_USER_NAME (1 << 0) #define PW_CORE_CHANGE_MASK_HOST_NAME (1 << 1) #define PW_CORE_CHANGE_MASK_VERSION (1 << 2) @@ -100,6 +101,7 @@ void pw_core_info_free(struct pw_core_info *info); /** The module information. Extra information can be added in later versions \memberof pw_introspect */ struct pw_module_info { + uint32_t id; /**< id of the global */ #define PW_MODULE_CHANGE_MASK_NAME (1 << 0) #define PW_MODULE_CHANGE_MASK_FILENAME (1 << 1) #define PW_MODULE_CHANGE_MASK_ARGS (1 << 2) @@ -121,6 +123,7 @@ void pw_module_info_free(struct pw_module_info *info); /** The client information. Extra information can be added in later versions \memberof pw_introspect */ struct pw_client_info { + uint32_t id; /**< id of the global */ #define PW_CLIENT_CHANGE_MASK_PROPS (1 << 0) uint64_t change_mask; /**< bitfield of changed fields since last call */ struct spa_dict *props; /**< extra properties */ @@ -137,6 +140,7 @@ void pw_client_info_free(struct pw_client_info *info); /** The node information. Extra information can be added in later versions \memberof pw_introspect */ struct pw_node_info { + uint32_t id; /**< id of the global */ #define PW_NODE_CHANGE_MASK_NAME (1 << 0) #define PW_NODE_CHANGE_MASK_INPUT_PORTS (1 << 1) #define PW_NODE_CHANGE_MASK_INPUT_FORMATS (1 << 2) @@ -169,6 +173,7 @@ pw_node_info_free(struct pw_node_info *info); /** The link information. Extra information can be added in later versions \memberof pw_introspect */ struct pw_link_info { + uint32_t id; /**< id of the global */ #define PW_LINK_CHANGE_MASK_OUTPUT (1 << 0) #define PW_LINK_CHANGE_MASK_INPUT (1 << 1) #define PW_LINK_CHANGE_MASK_FORMAT (1 << 2) diff --git a/src/pipewire/link.c b/src/pipewire/link.c index 4034fe8f2..c42ccd3c3 100644 --- a/src/pipewire/link.c +++ b/src/pipewire/link.c @@ -1152,6 +1152,7 @@ struct pw_link *pw_link_new(struct pw_core *core, this->global = pw_core_add_global(core, NULL, parent, core->type.link, PW_VERSION_LINK, link_bind_func, this); + this->info.id = this->global->id; return this; diff --git a/src/pipewire/module.c b/src/pipewire/module.c index 6e0c35932..a4fdbf333 100644 --- a/src/pipewire/module.c +++ b/src/pipewire/module.c @@ -222,6 +222,8 @@ struct pw_module *pw_module_load(struct pw_core *core, const char *name, const c core->type.module, PW_VERSION_MODULE, module_bind_func, this); + this->info.id = this->global->id; + if (!init_func(this, (char *) args)) goto init_failed; diff --git a/src/pipewire/node.c b/src/pipewire/node.c index 63258fc4d..084c11df2 100644 --- a/src/pipewire/node.c +++ b/src/pipewire/node.c @@ -353,6 +353,7 @@ void pw_node_register(struct pw_node *this) core->type.node, PW_VERSION_NODE, node_bind_func, this); + this->info.id = this->global->id; impl->registered = true; spa_hook_list_call(&this->listener_list, struct pw_node_events, initialized);