gstreamer/libs/gst/helpers/gst-plugin-scanner.c
Mathieu Duponchelle 6cddce7663 plugin: API: GST_PLUGIN_DEPENDENCY_FLAG_PATHS_ARE_RELATIVE_TO_EXE
When a plugin declares a dependency using this flag, all the
relative paths are considered to be relative to the path of
the main executable.

We try to determine the path of the executable portably,
with implementations provided for Linux, Windows and Mac.

If retrieval of the path fails, we will not detect changes.

In order for the main executable path to be the same when
scanning a plugin in a child process, a new variable is
exposed in gst_private.h, _gst_executable_path

https://bugzilla.gnome.org/show_bug.cgi?id=788152
2017-09-26 13:12:00 +02:00

65 lines
1.7 KiB
C

/* GStreamer
* Copyright (C) 2008 Jan Schmidt <jan.schmidt@sun.com>
*
* gst-plugin-scanner.c: tool to load plugins out of process for scanning
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
* Helper binary that does plugin-loading out of process and feeds results
* back to the parent over fds.
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <gst/gst_private.h>
#include <gst/gst.h>
#include <string.h>
int
main (int argc, char *argv[])
{
gboolean res;
char **my_argv;
int my_argc;
if (argc != 3 || strcmp (argv[1], "-l"))
return 1;
my_argc = 2;
my_argv = g_malloc (my_argc * sizeof (char *));
my_argv[0] = argv[0];
my_argv[1] = (char *) "--gst-disable-registry-update";
#ifndef GST_DISABLE_REGISTRY
_gst_disable_registry_cache = TRUE;
#endif
_gst_executable_path = g_strdup (argv[2]);
res = gst_init_check (&my_argc, &my_argv, NULL);
g_free (my_argv);
if (!res)
return 1;
/* Create registry scanner listener and run */
if (!_gst_plugin_loader_client_run ())
return 1;
return 0;
}