mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-17 07:00:03 -05:00
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:
parent
3cff30c651
commit
3d974d3256
1 changed files with 5 additions and 0 deletions
|
|
@ -47,6 +47,7 @@ struct plugin {
|
||||||
void *hnd;
|
void *hnd;
|
||||||
spa_handle_factory_enum_func_t enum_func;
|
spa_handle_factory_enum_func_t enum_func;
|
||||||
int ref;
|
int ref;
|
||||||
|
const struct spa_log_topic_enum *log_topic_enum;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct handle {
|
struct handle {
|
||||||
|
|
@ -131,9 +132,12 @@ open_plugin(struct registry *registry,
|
||||||
plugin->filename = strdup(filename);
|
plugin->filename = strdup(filename);
|
||||||
plugin->hnd = hnd;
|
plugin->hnd = hnd;
|
||||||
plugin->enum_func = enum_func;
|
plugin->enum_func = enum_func;
|
||||||
|
plugin->log_topic_enum = dlsym(hnd, SPA_LOG_TOPIC_ENUM_NAME);
|
||||||
|
|
||||||
spa_list_append(®istry->plugins, &plugin->link);
|
spa_list_append(®istry->plugins, &plugin->link);
|
||||||
|
|
||||||
|
pw_log_topic_register_enum(plugin->log_topic_enum);
|
||||||
|
|
||||||
return plugin;
|
return plugin;
|
||||||
|
|
||||||
error_dlclose:
|
error_dlclose:
|
||||||
|
|
@ -148,6 +152,7 @@ unref_plugin(struct plugin *plugin)
|
||||||
{
|
{
|
||||||
if (--plugin->ref == 0) {
|
if (--plugin->ref == 0) {
|
||||||
spa_list_remove(&plugin->link);
|
spa_list_remove(&plugin->link);
|
||||||
|
pw_log_topic_unregister_enum(plugin->log_topic_enum);
|
||||||
pw_log_debug("unloaded plugin:'%s'", plugin->filename);
|
pw_log_debug("unloaded plugin:'%s'", plugin->filename);
|
||||||
if (pw_should_dlclose())
|
if (pw_should_dlclose())
|
||||||
dlclose(plugin->hnd);
|
dlclose(plugin->hnd);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue