plugin dependencies: fix 6cddce7663

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
This commit is contained in:
Mathieu Duponchelle 2017-09-26 15:15:27 +02:00
parent 6cddce7663
commit a5e168071c
2 changed files with 12 additions and 7 deletions

View file

@ -356,8 +356,8 @@ find_executable_path (void)
pid = getpid (); pid = getpid ();
ret = proc_pidpath (pid, pathbuf, sizeof (pathbuf)); ret = proc_pidpath (pid, pathbuf, sizeof (pathbuf));
if (ret > 0) if (ret > 0)
_gst_executable_path = g_strdup (pathbuf) _gst_executable_path = g_strdup (pathbuf);
} }
#else #else
static void static void
find_executable_path (void) find_executable_path (void)
@ -399,9 +399,6 @@ gst_init_check (int *argc, char **argv[], GError ** err)
g_mutex_unlock (&init_lock); g_mutex_unlock (&init_lock);
return TRUE; return TRUE;
} }
find_executable_path ();
#ifndef GST_DISABLE_OPTION_PARSING #ifndef GST_DISABLE_OPTION_PARSING
ctx = g_option_context_new ("- GStreamer initialization"); ctx = g_option_context_new ("- GStreamer initialization");
g_option_context_set_ignore_unknown_options (ctx, TRUE); g_option_context_set_ignore_unknown_options (ctx, TRUE);
@ -533,6 +530,8 @@ init_pre (GOptionContext * context, GOptionGroup * group, gpointer data,
return TRUE; return TRUE;
} }
find_executable_path ();
_priv_gst_start_time = gst_util_get_timestamp (); _priv_gst_start_time = gst_util_get_timestamp ();
#ifndef GST_DISABLE_GST_DEBUG #ifndef GST_DISABLE_GST_DEBUG

View file

@ -38,7 +38,11 @@ main (int argc, char *argv[])
char **my_argv; char **my_argv;
int my_argc; 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; return 1;
my_argc = 2; my_argc = 2;
@ -50,7 +54,9 @@ main (int argc, char *argv[])
_gst_disable_registry_cache = TRUE; _gst_disable_registry_cache = TRUE;
#endif #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); res = gst_init_check (&my_argc, &my_argv, NULL);
g_free (my_argv); g_free (my_argv);