1
Fork 0

pipewire: register/unregister log topics from SPA plugins

Register enumerated log topics from SPA plugins on plugin load, and
unregister them on plugin unload.
This commit is contained in:
Pauli Virtanen 2023-12-23 21:12:11 +02:00 committed by Wim Taymans
parent 3cff30c651
commit 3d974d3256
1 changed files with 5 additions and 0 deletions

View File

@ -47,6 +47,7 @@ struct plugin {
void *hnd;
spa_handle_factory_enum_func_t enum_func;
int ref;
const struct spa_log_topic_enum *log_topic_enum;
};
struct handle {
@ -131,9 +132,12 @@ open_plugin(struct registry *registry,
plugin->filename = strdup(filename);
plugin->hnd = hnd;
plugin->enum_func = enum_func;
plugin->log_topic_enum = dlsym(hnd, SPA_LOG_TOPIC_ENUM_NAME);
spa_list_append(&registry->plugins, &plugin->link);
pw_log_topic_register_enum(plugin->log_topic_enum);
return plugin;
error_dlclose:
@ -148,6 +152,7 @@ unref_plugin(struct plugin *plugin)
{
if (--plugin->ref == 0) {
spa_list_remove(&plugin->link);
pw_log_topic_unregister_enum(plugin->log_topic_enum);
pw_log_debug("unloaded plugin:'%s'", plugin->filename);
if (pw_should_dlclose())
dlclose(plugin->hnd);