preset: Add a GST_PRESET_PATH env variable for presets to be usable uninstalled

And start setting the various uninstalled presets paths.
This commit is contained in:
Thibault Saunier 2015-11-06 12:05:18 +01:00
parent f468eb7db0
commit ca08af1f17
2 changed files with 39 additions and 6 deletions

View file

@ -42,8 +42,9 @@
* application specific directory and in the users home directory. When getting
* a list of presets individual presets are read and overlaid in 1) system,
* 2) application and 3) user order. Whenever an earlier entry is newer, the
* later entries will be updated.
*
* later entries will be updated. Since 1.8 you can also provide extra paths
* where to find presets through the GST_PRESET_PATH environment variable.
* Presets found in those paths will be concidered as "app presets".
*/
/* FIXME:
* - non racyness
@ -367,13 +368,35 @@ preset_get_keyfile (GstPreset * preset)
gboolean merged = FALSE;
GKeyFile *in_user, *in_app = NULL, *in_system;
preset_get_paths (preset, &preset_user_path, &preset_app_path,
&preset_system_path);
const gchar *envvar;
/* try to load the user, app and system presets, we do this to get the
* versions of all files. */
in_user = preset_open_and_parse_header (preset, preset_user_path,
&version_user);
envvar = g_getenv ("GST_PRESET_PATH");
if (envvar) {
gint i;
gchar **preset_dirs = g_strsplit (envvar, G_SEARCHPATH_SEPARATOR_S, -1);
for (i = 0; preset_dirs[i]; i++) {
gchar *preset_path = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "%s.prs",
preset_dirs[i], G_OBJECT_TYPE_NAME (preset));
in_user = preset_open_and_parse_header (preset, preset_path,
&version_user);
g_free (preset_path);
if (in_user)
break;
}
g_strfreev (preset_dirs);
}
preset_get_paths (preset, &preset_user_path, &preset_app_path,
&preset_system_path);
if (!in_user) {
in_user = preset_open_and_parse_header (preset, preset_user_path,
&version_user);
}
if (preset_app_path) {
in_app = preset_open_and_parse_header (preset, preset_app_path,
&version_app);

View file

@ -169,6 +169,16 @@ $GST/gstreamer/plugins\
:$GST/gst-editing-services/plugins/nle/.libs\
${GST_PLUGIN_PATH:+:$GST_PLUGIN_PATH}"
export GST_PRESET_PATH="\
$GST/gst-plugins-good/gst/equalizer/\
:$GST/gst-plugins-good/gst/equalizer\
:$GST/gst-plugins-good/ext/vpx/\
:$GST/gst-plugins-ugly/ext/x264\
:$GST/gst-plugins-ugly/ext/amrnb\
:$GST/gst-plugins-bad/gst/freeverb\
:$GST/gst-plugins-bad/ext/voamrwbenc\
${GST_PRESET_PATH:+:$GST_PRESET_PATH}"
# don't use any system-installed plug-ins at all
export GST_PLUGIN_SYSTEM_PATH=
# set our registry somewhere else so we don't mess up the registry generated