Blame libs/gst/helpers/gst-plugin-scanner.c

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