mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-04-07 08:21:11 -04:00
filter-graph: improve debug when loading fails
List the path name and the plugin search path when we can't load an error.
This commit is contained in:
parent
785bf36b9b
commit
57299da899
1 changed files with 20 additions and 13 deletions
|
|
@ -233,20 +233,25 @@ static inline const char *split_walk(const char *str, const char *delimiter, siz
|
|||
return s;
|
||||
}
|
||||
|
||||
static int load_ladspa_plugin(struct plugin *impl, const char *path)
|
||||
static void make_search_paths(const char **path, const char **search_dirs)
|
||||
{
|
||||
const char *p;
|
||||
|
||||
while ((p = strstr(*path, "../")) != NULL)
|
||||
*path = p + 3;
|
||||
|
||||
*search_dirs = getenv("LADSPA_PATH");
|
||||
if (!*search_dirs)
|
||||
*search_dirs = "/usr/lib64/ladspa:/usr/lib/ladspa:" LIBDIR;
|
||||
}
|
||||
|
||||
static int load_ladspa_plugin(struct plugin *impl, const char *path, const char *search_dirs)
|
||||
{
|
||||
int res = -ENOENT;
|
||||
const char *search_dirs, *p, *state = NULL;
|
||||
const char *p, *state = NULL;
|
||||
char filename[PATH_MAX];
|
||||
size_t len;
|
||||
|
||||
while ((p = strstr(path, "../")) != NULL)
|
||||
path = p + 3;
|
||||
|
||||
search_dirs = getenv("LADSPA_PATH");
|
||||
if (!search_dirs)
|
||||
search_dirs = "/usr/lib64/ladspa:/usr/lib/ladspa:" LIBDIR;
|
||||
|
||||
/*
|
||||
* set the errno for the case when `ladspa_handle_load_by_path()`
|
||||
* is never called, which can only happen if the supplied
|
||||
|
|
@ -314,7 +319,7 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
struct plugin *impl;
|
||||
uint32_t i;
|
||||
int res;
|
||||
const char *path = NULL;
|
||||
const char *path = NULL, *search_dirs;
|
||||
|
||||
handle->get_interface = impl_get_interface;
|
||||
handle->clear = impl_clear;
|
||||
|
|
@ -332,9 +337,11 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
if (path == NULL)
|
||||
return -EINVAL;
|
||||
|
||||
if ((res = load_ladspa_plugin(impl, path)) < 0) {
|
||||
spa_log_error(impl->log, "failed to load plugin '%s': %s",
|
||||
path, spa_strerror(res));
|
||||
make_search_paths(&path, &search_dirs);
|
||||
|
||||
if ((res = load_ladspa_plugin(impl, path, search_dirs)) < 0) {
|
||||
spa_log_error(impl->log, "failed to load plugin '%s.so' in '%s': %s",
|
||||
path, search_dirs, spa_strerror(res));
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue