| 1 |
/* GStreamer |
| 2 |
* Copyright (C) 2008 Jan Schmidt <[email protected]> |
| 3 |
* |
| 4 |
* gst-plugin-scanner.c: tool to load plugins out of process for scanning |
| 5 |
* |
| 6 |
* This library is free software; you can redistribute it and/or |
| 7 |
* modify it under the terms of the GNU Library General Public |
| 8 |
* License as published by the Free Software Foundation; either |
| 9 |
* version 2 of the License, or (at your option) any later version. |
| 10 |
* |
| 11 |
* This library is distributed in the hope that it will be useful, |
| 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 |
* Library General Public License for more details. |
| 15 |
* |
| 16 |
* You should have received a copy of the GNU Library General Public |
| 17 |
* License along with this library; if not, write to the |
| 18 |
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, |
| 19 |
* Boston, MA 02110-1301, USA. |
| 20 |
* |
| 21 |
* Helper binary that does plugin-loading out of process and feeds results |
| 22 |
* back to the parent over fds. |
| 23 |
*/ |
| 24 |
|
| 25 |
#ifdef HAVE_CONFIG_H |
| 26 |
# include "config.h" |
| 27 |
#endif |
| 28 |
|
| 29 |
#include <gst/gst_private.h> |
| 30 |
#include <gst/gst.h> |
| 31 |
|
| 32 |
#include <string.h> |
| 33 |
|
| 34 |
int |
| 35 |
main (int argc, char *argv[]) |
| 36 |
{ |
| 37 |
gboolean res; |
| 38 |
char **my_argv; |
| 39 |
int my_argc; |
| 40 |
char *pipe_name = NULL; |
| 41 |
|
| 42 |
#ifdef G_OS_WIN32 |
| 43 |
/* On Windows, we need pipe name |
| 44 |
* arg0: exe path |
| 45 |
* arg1: -l |
| 46 |
* arg2: parent process exe path |
| 47 |
* arg3: pipe name */ |
| 48 |
if (argc != 4) |
| 49 |
return 1; |
| 50 |
|
| 51 |
_gst_executable_path = g_strdup (argv[2]); |
| 52 |
pipe_name = argv[3]; |
| 53 |
#else |
| 54 |
/* We may or may not have an executable path */ |
| 55 |
if (argc != 2 && argc != 3) |
| 56 |
return 1; |
| 57 |
|
| 58 |
if (argc == 3) |
| 59 |
_gst_executable_path = g_strdup (argv[2]); |
| 60 |
#endif |
| 61 |
|
| 62 |
if (strcmp (argv[1], "-l")) |
| 63 |
return 1; |
| 64 |
|
| 65 |
my_argc = 2; |
| 66 |
my_argv = g_malloc (my_argc * sizeof (char *)); |
| 67 |
my_argv[0] = argv[0]; |
| 68 |
my_argv[1] = (char *) "--gst-disable-registry-update"; |
| 69 |
|
| 70 |
g_unsetenv ("GST_TRACERS"); |
| 71 |
|
| 72 |
#ifndef GST_DISABLE_REGISTRY |
| 73 |
_gst_disable_registry_cache = TRUE; |
| 74 |
#endif |
| 75 |
|
| 76 |
res = gst_init_check (&my_argc, &my_argv, NULL); |
| 77 |
|
| 78 |
g_free (my_argv); |
| 79 |
if (!res) |
| 80 |
return 1; |
| 81 |
|
| 82 |
/* Create registry scanner listener and run */ |
| 83 |
if (!_gst_plugin_loader_client_run (pipe_name)) |
| 84 |
return 1; |
| 85 |
|
| 86 |
return 0; |
| 87 |
} |