Пример #1
0
static gboolean
plugin_init (GstPlugin * plugin)
{
  GST_DEBUG_CATEGORY_INIT (ladspa_debug, "ladspa",
      GST_DEBUG_FG_GREEN | GST_DEBUG_BG_BLACK | GST_DEBUG_BOLD, "LADSPA");

  gst_plugin_add_dependency_simple (plugin,
      "LADSPA_PATH",
      GST_LADSPA_DEFAULT_PATH, NULL, GST_PLUGIN_DEPENDENCY_FLAG_NONE);

#ifdef HAVE_LRDF
  lrdf_init ();
#endif

  parent_class = g_type_class_ref (GST_TYPE_SIGNAL_PROCESSOR);

  ladspa_plugin = plugin;
  descriptor_quark = g_quark_from_static_string ("ladspa-descriptor");

  if (!ladspa_plugin_path_search ()) {
    GST_WARNING ("no ladspa plugins found, check LADSPA_PATH");
  }

  /* we don't want to fail, even if there are no elements registered */
  return TRUE;
}
Пример #2
0
static gboolean
plugin_init (GstPlugin * plugin)
{
  const gchar *homedir;
  gchar *path, *libdir_path;
  GHashTable *plugin_names;
  const gchar *frei0r_path;

  GST_DEBUG_CATEGORY_INIT (frei0r_debug, "frei0r", 0, "frei0r");

  gst_plugin_add_dependency_simple (plugin,
      "FREI0R_PATH:HOME/.frei0r-1/lib",
      LIBDIR "/frei0r-1:"
      "/usr/lib/frei0r-1:/usr/local/lib/frei0r-1:"
      "/usr/lib32/frei0r-1:/usr/local/lib32/frei0r-1:"
      "/usr/lib64/frei0r-1:/usr/local/lib64/frei0r-1",
      NULL, GST_PLUGIN_DEPENDENCY_FLAG_RECURSE);

  plugin_names =
      g_hash_table_new_full ((GHashFunc) g_str_hash, (GEqualFunc) g_str_equal,
      (GDestroyNotify) g_free, NULL);

  frei0r_path = g_getenv ("FREI0R_PATH");
  if (frei0r_path && *frei0r_path) {
    gchar **p, **paths = g_strsplit (frei0r_path, ":", -1);

    for (p = paths; *p; p++) {
      register_plugins (plugin, plugin_names, *p, *p);
    }

    g_strfreev (paths);
  } else {
#define register_plugins2(plugin, pn, p) register_plugins(plugin, pn, p, p)
    homedir = g_get_home_dir ();
    path = g_build_filename (homedir, ".frei0r-1", "lib", NULL);
    libdir_path = g_build_filename (LIBDIR, "frei0r-1", NULL);
    register_plugins2 (plugin, plugin_names, path);
    g_free (path);
    register_plugins2 (plugin, plugin_names, libdir_path);
    g_free (libdir_path);
    register_plugins2 (plugin, plugin_names, "/usr/local/lib/frei0r-1");
    register_plugins2 (plugin, plugin_names, "/usr/lib/frei0r-1");
    register_plugins2 (plugin, plugin_names, "/usr/local/lib32/frei0r-1");
    register_plugins2 (plugin, plugin_names, "/usr/lib32/frei0r-1");
    register_plugins2 (plugin, plugin_names, "/usr/local/lib64/frei0r-1");
    register_plugins2 (plugin, plugin_names, "/usr/lib64/frei0r-1");
#undef register_plugins2
  }

  g_hash_table_unref (plugin_names);

  return TRUE;
}
Пример #3
0
static gboolean
plugin_init (GstPlugin * p)
{
  if (!gst_element_register (p, "realvideodec", GST_RANK_MARGINAL,
          GST_TYPE_REAL_VIDEO_DEC))
    return FALSE;
  if (!gst_element_register (p, "realaudiodec", GST_RANK_MARGINAL,
          GST_TYPE_REAL_AUDIO_DEC))
    return FALSE;

  gst_plugin_add_dependency_simple (p, NULL, DEFAULT_REAL_CODECS_PATH, NULL,
      GST_PLUGIN_DEPENDENCY_FLAG_NONE);

  return TRUE;
}
static void
fetch_element_table (GstPlugin * plugin)
{
  gchar *path;
  gchar *config, *s;
  GstStructure *tmp, *element;

  element_table = gst_plugin_get_cache_data (plugin);

  if (element_table)
    return;

  path = get_config_path ();

  if (!g_file_get_contents (path, &config, NULL, NULL)) {
    g_warning ("could not find config file '%s'.. using defaults!", path);
    config = (gchar *) default_config;
  }

  gst_plugin_add_dependency_simple (plugin, "ONX_CONFIG", path, NULL,
      GST_PLUGIN_DEPENDENCY_FLAG_NONE);

  g_free (path);

  GST_DEBUG ("parsing config:\n%s", config);

  tmp = gst_structure_empty_new ("element_table");

  s = config;

  while ((element = gst_structure_from_string (s, &s))) {
    const gchar *element_name = gst_structure_get_name (element);
    gst_structure_set (tmp, element_name, GST_TYPE_STRUCTURE, element, NULL);
  }

  if (config != default_config)
    g_free (config);

  GST_DEBUG ("element_table=%" GST_PTR_FORMAT, tmp);

  gst_plugin_set_cache_data (plugin, tmp);

  element_table = tmp;
}
Пример #5
0
static gboolean
plugin_init (GstPlugin * plugin)
{
  const gchar *homedir;
  gchar *path;

  GST_DEBUG_CATEGORY_INIT (frei0r_debug, "frei0r", 0, "frei0r");

  gst_plugin_add_dependency_simple (plugin,
      "HOME/.frei0r-1/lib",
      "/usr/lib/frei0r-1:/usr/local/lib/frei0r-1",
      NULL, GST_PLUGIN_DEPENDENCY_FLAG_RECURSE);

  register_plugins (plugin, "/usr/lib/frei0r-1");
  register_plugins (plugin, "/usr/local/lib/frei0r-1");

  homedir = g_get_home_dir ();
  path = g_build_filename (homedir, ".frei0r-1", NULL);
  register_plugins (plugin, path);
  g_free (path);

  return TRUE;
}
Пример #6
0
static void
plugin_add_dependencies (GstPlugin * plugin)
{
  const gchar *envvars[] = { "GST_VAAPI_ALL_DRIVERS", "LIBVA_DRIVER_NAME",
    "DISPLAY", "WAYLAND_DISPLAY", NULL
  };
  const gchar *kernel_paths[] = { "/dev/dri", NULL };
  const gchar *kernel_names[] = { "card", "render", NULL };

  /* features get updated upon changes in /dev/dri/card* */
  gst_plugin_add_dependency (plugin, NULL, kernel_paths, kernel_names,
      GST_PLUGIN_DEPENDENCY_FLAG_FILE_NAME_IS_PREFIX);

  /* features get updated upon changes in VA environment variables */
  gst_plugin_add_dependency (plugin, envvars, NULL, NULL,
      GST_PLUGIN_DEPENDENCY_FLAG_NONE);

  /* features get updated upon changes in default VA drivers
   * directory */
  gst_plugin_add_dependency_simple (plugin, "LIBVA_DRIVERS_PATH",
      VA_DRIVERS_PATH, "_drv_video.so",
      GST_PLUGIN_DEPENDENCY_FLAG_FILE_NAME_IS_SUFFIX |
      GST_PLUGIN_DEPENDENCY_FLAG_PATHS_ARE_DEFAULT_ONLY);
}
Пример #7
0
static gboolean
plugin_init (GstPlugin * plugin)
{
  gboolean res = FALSE;
  gint n = 0;

  GST_DEBUG_CATEGORY_INIT (ladspa_debug, "ladspa", 0, "LADSPA plugins");

#ifdef ENABLE_NLS
  GST_DEBUG_OBJECT (plugin, "binding text domain %s to locale dir %s",
      GETTEXT_PACKAGE, LOCALEDIR);
  bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
#endif

  gst_plugin_add_dependency_simple (plugin,
      "LADSPA_PATH",
      GST_LADSPA_DEFAULT_PATH, NULL, GST_PLUGIN_DEPENDENCY_FLAG_NONE);

#ifdef HAVE_LRDF
  lrdf_init ();
#endif

  ladspa_meta_all = (GstStructure *) gst_plugin_get_cache_data (plugin);
  if (ladspa_meta_all) {
    n = gst_structure_n_fields (ladspa_meta_all);
  }
  GST_INFO_OBJECT (plugin, "%d entries in cache", n);
  if (!n) {
    ladspa_meta_all = gst_structure_new_empty ("ladspa");
    if ((res = ladspa_plugin_path_search (plugin))) {
      n = gst_structure_n_fields (ladspa_meta_all);
      GST_INFO_OBJECT (plugin, "%d entries after scanning", n);
      gst_plugin_set_cache_data (plugin, ladspa_meta_all);
    }
  } else {
    res = TRUE;
  }

  if (n) {
    gint i;
    const gchar *name;
    const GValue *value;

    GST_INFO_OBJECT (plugin, "register types");

    for (i = 0; i < n; i++) {
      name = gst_structure_nth_field_name (ladspa_meta_all, i);
      value = gst_structure_get_value (ladspa_meta_all, name);
      if (G_VALUE_TYPE (value) == GST_TYPE_STRUCTURE) {
        GstStructure *ladspa_meta = g_value_get_boxed (value);

        ladspa_plugin_register_element (plugin, ladspa_meta);
      }
    }
  }

  if (!res) {
    GST_WARNING_OBJECT (plugin, "no LADSPA plugins found, check LADSPA_PATH");
  }

  /* we don't want to fail, even if there are no elements registered */
  return TRUE;
}
Пример #8
0
static gboolean
plugin_init (GstPlugin * plugin)
{
  guint i, count;
  VisList *list;

  GST_DEBUG_CATEGORY_INIT (libvisual_debug, "libvisual", 0,
      "libvisual audio visualisations");

#ifdef LIBVISUAL_PLUGINSBASEDIR
  gst_plugin_add_dependency_simple (plugin, "HOME/.libvisual/actor",
      LIBVISUAL_PLUGINSBASEDIR "/actor", NULL, GST_PLUGIN_DEPENDENCY_FLAG_NONE);
#endif

  visual_log_set_verboseness (VISUAL_LOG_VERBOSENESS_LOW);
  visual_log_set_info_handler (libvisual_log_handler, (void *) GST_LEVEL_INFO);
  visual_log_set_warning_handler (libvisual_log_handler,
      (void *) GST_LEVEL_WARNING);
  visual_log_set_critical_handler (libvisual_log_handler,
      (void *) GST_LEVEL_ERROR);
  visual_log_set_error_handler (libvisual_log_handler,
      (void *) GST_LEVEL_ERROR);

  if (!visual_is_initialized ())
    if (visual_init (NULL, NULL) != 0)
      return FALSE;

  list = visual_actor_get_list ();

#if !defined(VISUAL_API_VERSION)
  count = visual_list_count (list);
#elif VISUAL_API_VERSION >= 4000 && VISUAL_API_VERSION < 5000
  count = visual_collection_size (VISUAL_COLLECTION (list));
#endif

  for (i = 0; i < count; i++) {
    VisPluginRef *ref = visual_list_get (list, i);
    VisPluginData *visplugin = NULL;
    gboolean skip = FALSE;
    GType type;
    gchar *name;
    GTypeInfo info = {
      sizeof (GstVisualClass),
      NULL,
      NULL,
      gst_visual_class_init,
      NULL,
      ref,
      sizeof (GstVisual),
      0,
      NULL
    };

    visplugin = visual_plugin_load (ref);

    if (ref->info->plugname == NULL)
      continue;

    /* Blacklist some plugins */
    if (strcmp (ref->info->plugname, "gstreamer") == 0 ||
        strcmp (ref->info->plugname, "gdkpixbuf") == 0) {
      skip = TRUE;
    } else {
      /* Ignore plugins that only support GL output for now */
      skip = gst_visual_actor_plugin_is_gl (visplugin->info->plugin,
          visplugin->info->plugname);
    }

    visual_plugin_unload (visplugin);

    if (!skip) {
      name = g_strdup_printf ("GstVisual%s", ref->info->plugname);
      make_valid_name (name);
      type = g_type_register_static (GST_TYPE_VISUAL, name, &info, 0);
      g_free (name);

      name = g_strdup_printf ("libvisual_%s", ref->info->plugname);
      make_valid_name (name);
      if (!gst_element_register (plugin, name, GST_RANK_NONE, type)) {
        g_free (name);
        return FALSE;
      }
      g_free (name);
    }
  }

  return TRUE;
}