From a5e168071c169bec7343b82267f02563f673b441 Mon Sep 17 00:00:00 2001 From: Mathieu Duponchelle Date: Tue, 26 Sep 2017 15:15:27 +0200 Subject: [PATCH] plugin dependencies: fix 6cddce7663cb4b6ee061950d20365f42cb755851 There were a few errors: * The plugin scanner now accepts executable path as an argument. In case it is NULL, argc == 2 * We find the executable path in init_pre instead of gst_init, allowing this to work when gst is initialized through the option group (eg gst-inspect) * There was a semi-colon missing in the __APPLE__ #ifdef --- gst/gst.c | 9 ++++----- libs/gst/helpers/gst-plugin-scanner.c | 10 ++++++++-- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/gst/gst.c b/gst/gst.c index 26948daf7b..c542766769 100644 --- a/gst/gst.c +++ b/gst/gst.c @@ -356,8 +356,8 @@ find_executable_path (void) pid = getpid (); ret = proc_pidpath (pid, pathbuf, sizeof (pathbuf)); if (ret > 0) - _gst_executable_path = g_strdup (pathbuf) - } + _gst_executable_path = g_strdup (pathbuf); +} #else static void find_executable_path (void) @@ -399,9 +399,6 @@ gst_init_check (int *argc, char **argv[], GError ** err) g_mutex_unlock (&init_lock); return TRUE; } - - find_executable_path (); - #ifndef GST_DISABLE_OPTION_PARSING ctx = g_option_context_new ("- GStreamer initialization"); g_option_context_set_ignore_unknown_options (ctx, TRUE); @@ -533,6 +530,8 @@ init_pre (GOptionContext * context, GOptionGroup * group, gpointer data, return TRUE; } + find_executable_path (); + _priv_gst_start_time = gst_util_get_timestamp (); #ifndef GST_DISABLE_GST_DEBUG diff --git a/libs/gst/helpers/gst-plugin-scanner.c b/libs/gst/helpers/gst-plugin-scanner.c index cda1ac9007..cbefb29e00 100644 --- a/libs/gst/helpers/gst-plugin-scanner.c +++ b/libs/gst/helpers/gst-plugin-scanner.c @@ -38,7 +38,11 @@ main (int argc, char *argv[]) char **my_argv; int my_argc; - if (argc != 3 || strcmp (argv[1], "-l")) + /* We may or may not have an executable path */ + if (argc != 2 && argc != 3) + return 1; + + if (strcmp (argv[1], "-l")) return 1; my_argc = 2; @@ -50,7 +54,9 @@ main (int argc, char *argv[]) _gst_disable_registry_cache = TRUE; #endif - _gst_executable_path = g_strdup (argv[2]); + if (argc == 3) + _gst_executable_path = g_strdup (argv[2]); + res = gst_init_check (&my_argc, &my_argv, NULL); g_free (my_argv);