Commit 85488575 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

fluidsynth: deal with glob() error cases correctly (and add debug)

glob() sets the result structure also in case of error. The results
may be incomplete.
parent be906d52
......@@ -105,6 +105,7 @@ static int Open (vlc_object_t *p_this)
{
const char *lpath = ToLocale (font_path);
msg_Dbg (p_this, "loading sound fonts file %s", font_path);
p_sys->soundfont = fluid_synth_sfload (p_sys->synth, font_path, 1);
LocaleFree (lpath);
if (p_sys->soundfont == -1)
......@@ -116,19 +117,18 @@ static int Open (vlc_object_t *p_this)
{
glob_t gl;
if (!glob ("/usr/share/sounds/sf2/*.sf2", GLOB_NOESCAPE, NULL, &gl))
glob ("/usr/share/sounds/sf2/*.sf2", GLOB_NOESCAPE, NULL, &gl);
for (size_t i = 0; i < gl.gl_pathc; i++)
{
for (size_t i = 0; i < gl.gl_pathc; i++)
{
const char *path = gl.gl_pathv[i];
p_sys->soundfont = fluid_synth_sfload (p_sys->synth, path, 1);
if (p_sys->soundfont != -1)
break; /* it worked! */
msg_Err (p_this, "cannot load sound fonts file %s", path);
}
globfree (&gl);
const char *path = gl.gl_pathv[i];
msg_Dbg (p_this, "loading sound fonts file %s", path);
p_sys->soundfont = fluid_synth_sfload (p_sys->synth, path, 1);
if (p_sys->soundfont != -1)
break; /* it worked! */
msg_Err (p_this, "cannot load sound fonts file %s", path);
}
globfree (&gl);
}
#endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment