pluginloader: try scanner set via env var before using the installed one

If the GST_PLUGIN_SCANNER environment variable is set, we should try
the scanner specified there first, to make sure the right scanner binary
is used for uninstalled setups and builds from source when there's
already an installed version.
This commit is contained in:
Tim-Philipp Müller 2010-01-20 09:45:06 +00:00
parent f137d188cb
commit 8967604053

View file

@ -376,29 +376,32 @@ gst_plugin_loader_try_helper (GstPluginLoader * loader, gchar * location)
static gboolean
gst_plugin_loader_spawn (GstPluginLoader * loader)
{
const gchar *env;
char *helper_bin;
gboolean res;
gboolean res = FALSE;
if (loader->child_running)
return TRUE;
/* Find the gst-plugin-scanner, first try installed then by env-var */
helper_bin = g_strdup (GST_PLUGIN_SCANNER_INSTALLED);
res = gst_plugin_loader_try_helper (loader, helper_bin);
g_free (helper_bin);
/* Find the gst-plugin-scanner: first try the env-var if it is set,
* otherwise use the installed version */
env = g_getenv ("GST_PLUGIN_SCANNER");
if (env != NULL && *env != '\0') {
GST_LOG ("Trying GST_PLUGIN_SCANNER env var: %s", env);
helper_bin = g_strdup (env);
res = gst_plugin_loader_try_helper (loader, helper_bin);
g_free (helper_bin);
}
if (!res) {
/* Try the GST_PLUGIN_SCANNER env var */
const gchar *env = g_getenv ("GST_PLUGIN_SCANNER");
if (env != NULL) {
GST_LOG ("Installed plugin scanner failed. "
"Trying GST_PLUGIN_SCANNER env var: %s", env);
helper_bin = g_strdup (env);
res = gst_plugin_loader_try_helper (loader, helper_bin);
g_free (helper_bin);
} else {
GST_LOG ("Installed plugin scanner failed and GST_PLUGIN_SCANNER "
" env var not set. No gst-plugin-scanner available");
GST_LOG ("Trying installed plugin scanner");
helper_bin = g_strdup (GST_PLUGIN_SCANNER_INSTALLED);
res = gst_plugin_loader_try_helper (loader, helper_bin);
g_free (helper_bin);
if (!res) {
GST_INFO ("No gst-plugin-scanner available, or not working");
}
}