[vlc-commits] [Git][videolan/vlc][master] 2 commits: fluidsynth: look for fonts in installation prefix
Rémi Denis-Courmont (@Courmisch)
gitlab at videolan.org
Tue May 17 07:51:10 UTC 2022
Rémi Denis-Courmont pushed to branch master at VideoLAN / VLC
Commits:
176580cb by Rémi Denis-Courmont at 2022-05-17T07:35:24+00:00
fluidsynth: look for fonts in installation prefix
... in addition to /usr (unless the prefix happens to be /usr).
- - - - -
e079a56b by Rémi Denis-Courmont at 2022-05-17T07:35:24+00:00
fluidsynth: look for fonts in user data dir
Fixes #19795.
- - - - -
2 changed files:
- modules/codec/Makefile.am
- modules/codec/fluidsynth.c
Changes:
=====================================
modules/codec/Makefile.am
=====================================
@@ -51,6 +51,7 @@ libg711_plugin_la_SOURCES = codec/g711.c
codec_LTLIBRARIES += libg711_plugin.la
libfluidsynth_plugin_la_SOURCES = codec/fluidsynth.c
+libfluidsynth_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) -DDATADIR=\"$(datadir)\"
libfluidsynth_plugin_la_CFLAGS = $(AM_CFLAGS) $(FLUIDSYNTH_CFLAGS)
libfluidsynth_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(codecdir)'
libfluidsynth_plugin_la_LIBADD = $(FLUIDSYNTH_LIBS)
=====================================
modules/codec/fluidsynth.c
=====================================
@@ -127,10 +127,34 @@ static int Open (vlc_object_t *p_this)
else
{
glob_t gl;
+ int flags = GLOB_NOESCAPE;
- glob("/usr/share/sounds/sf2/*.sf2", GLOB_NOESCAPE, NULL, &gl);
- glob("/usr/share/soundfonts/*.sf2", GLOB_NOESCAPE | GLOB_APPEND, NULL,
- &gl);
+ char *udd = config_GetUserDir(VLC_USERDATA_DIR);
+ if (likely(udd != NULL))
+ {
+ char *path;
+ int len;
+
+ if (asprintf(&path, "%s/sound%ns/sf2/*.sf2", udd, &len) >= 0)
+ {
+ glob(path, flags, NULL, &gl);
+ flags |= GLOB_APPEND;
+ memcpy(path + len, "fonts", 5); /* "s/sf2" -> "fonts" */
+ glob(path, flags, NULL, &gl);
+ free(path);
+ }
+ free(udd);
+ }
+
+ glob(DATADIR "/sounds/sf2/*.sf2", flags, NULL, &gl);
+ flags |= GLOB_APPEND;
+ glob(DATADIR "/soundfonts/*.sf2", flags, NULL, &gl);
+
+ if (strcmp("/usr/share", DATADIR) != 0)
+ {
+ glob("/usr/share/sounds/sf2/*.sf2", flags, NULL, &gl);
+ glob("/usr/share/soundfonts/*.sf2", flags, NULL, &gl);
+ }
for (size_t i = 0; i < gl.gl_pathc; i++)
{
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/4bd922622bad08cd3cdc60742ed8fd8d36b40c72...e079a56bc9c983c5fbae2c34fc61174ff4a0615d
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/4bd922622bad08cd3cdc60742ed8fd8d36b40c72...e079a56bc9c983c5fbae2c34fc61174ff4a0615d
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list