2 * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
3 * 2000 Wim Taymans <wtay@chello.be>
5 * gstplugin.c: Plugin subsystem for loading elements, types, and libs
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public
18 * License along with this library; if not, write to the
19 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
25 * @short_description: Container for features loaded from a shared object module
26 * @see_also: #GstPluginFeature, #GstElementFactory
28 * GStreamer is extensible, so #GstElement instances can be loaded at runtime.
29 * A plugin system can provide one or more of the basic
30 * <application>GStreamer</application> #GstPluginFeature subclasses.
32 * A plugin should export a symbol <symbol>gst_plugin_desc</symbol> that is a
33 * struct of type #GstPluginDesc.
34 * the plugin loader will check the version of the core library the plugin was
35 * linked against and will create a new #GstPlugin. It will then call the
36 * #GstPluginInitFunc function that was provided in the
37 * <symbol>gst_plugin_desc</symbol>.
39 * Once you have a handle to a #GstPlugin (e.g. from the #GstRegistry), you
40 * can add any object that subclasses #GstPluginFeature.
42 * Usually plugins are always automaticlly loaded so you don't need to call
43 * gst_plugin_load() explicitly to bring it into memory. There are options to
44 * statically link plugins to an app or even use GStreamer without a plugin
45 * repository in which case gst_plugin_load() can be needed to bring the plugin
52 #include <glib/gstdio.h>
53 #include <sys/types.h>
63 #include "gst_private.h"
64 #include "glib-compat-private.h"
68 #define GST_CAT_DEFAULT GST_CAT_PLUGIN_LOADING
70 static guint _num_static_plugins; /* 0 */
71 static GstPluginDesc *_static_plugins; /* NULL */
72 static gboolean _gst_plugin_inited;
74 /* static variables for segfault handling of plugin loading */
75 static char *_gst_plugin_fault_handler_filename = NULL;
77 /* list of valid licenses.
78 * One of these must be specified or the plugin won't be loaded
79 * Contact gstreamer-devel@lists.sourceforge.net if your license should be
82 * GPL: http://www.gnu.org/copyleft/gpl.html
83 * LGPL: http://www.gnu.org/copyleft/lesser.html
84 * QPL: http://www.trolltech.com/licenses/qpl.html
85 * MPL: http://www.opensource.org/licenses/mozilla1.1.php
86 * MIT/X11: http://www.opensource.org/licenses/mit-license.php
87 * 3-clause BSD: http://www.opensource.org/licenses/bsd-license.php
89 static const gchar *valid_licenses[] = {
90 "LGPL", /* GNU Lesser General Public License */
91 "GPL", /* GNU General Public License */
92 "QPL", /* Trolltech Qt Public License */
93 "GPL/QPL", /* Combi-license of GPL + QPL */
94 "MPL", /* MPL 1.1 license */
95 "BSD", /* 3-clause BSD license */
96 "MIT/X11", /* MIT/X11 license */
97 "Proprietary", /* Proprietary license */
98 GST_LICENSE_UNKNOWN, /* some other license */
102 static GstPlugin *gst_plugin_register_func (GstPlugin * plugin,
103 const GstPluginDesc * desc, gpointer user_data);
104 static void gst_plugin_desc_copy (GstPluginDesc * dest,
105 const GstPluginDesc * src);
106 static void gst_plugin_desc_free (GstPluginDesc * desc);
108 static void gst_plugin_ext_dep_free (GstPluginDep * dep);
110 G_DEFINE_TYPE (GstPlugin, gst_plugin, GST_TYPE_OBJECT);
113 gst_plugin_init (GstPlugin * plugin)
116 G_TYPE_INSTANCE_GET_PRIVATE (plugin, GST_TYPE_PLUGIN, GstPluginPrivate);
120 gst_plugin_finalize (GObject * object)
122 GstPlugin *plugin = GST_PLUGIN_CAST (object);
123 GstRegistry *registry = gst_registry_get_default ();
126 GST_DEBUG ("finalizing plugin %p", plugin);
127 for (g = registry->plugins; g; g = g->next) {
128 if (g->data == (gpointer) plugin) {
129 g_warning ("removing plugin that is still in registry");
132 g_free (plugin->filename);
133 g_free (plugin->basename);
134 gst_plugin_desc_free (&plugin->desc);
136 g_list_foreach (plugin->priv->deps, (GFunc) gst_plugin_ext_dep_free, NULL);
137 g_list_free (plugin->priv->deps);
138 plugin->priv->deps = NULL;
140 if (plugin->priv->cache_data) {
141 gst_structure_free (plugin->priv->cache_data);
144 G_OBJECT_CLASS (gst_plugin_parent_class)->finalize (object);
148 gst_plugin_class_init (GstPluginClass * klass)
150 G_OBJECT_CLASS (klass)->finalize = GST_DEBUG_FUNCPTR (gst_plugin_finalize);
152 g_type_class_add_private (klass, sizeof (GstPluginPrivate));
156 gst_plugin_error_quark (void)
158 static GQuark quark = 0;
161 quark = g_quark_from_static_string ("gst_plugin_error");
165 #ifndef GST_REMOVE_DEPRECATED
166 /* this function can be called in the GCC constructor extension, before
167 * the _gst_plugin_initialize() was called. In that case, we store the
168 * plugin description in a list to initialize it when we open the main
170 * When the main module is known, we can register the plugin right away.
173 _gst_plugin_register_static (GstPluginDesc * desc)
175 g_return_if_fail (desc != NULL);
177 if (!_gst_plugin_inited) {
178 /* We can't use any GLib functions here, since g_thread_init hasn't been
179 * called yet, and we can't call it here either, or programs that don't
180 * guard their g_thread_init calls in main() will just abort */
181 ++_num_static_plugins;
183 realloc (_static_plugins, _num_static_plugins * sizeof (GstPluginDesc));
184 /* assume strings in the GstPluginDesc are static const or live forever */
185 _static_plugins[_num_static_plugins - 1] = *desc;
187 gst_plugin_register_static (desc->major_version, desc->minor_version,
188 desc->name, desc->description, desc->plugin_init, desc->version,
189 desc->license, desc->source, desc->package, desc->origin);
195 * gst_plugin_register_static:
196 * @major_version: the major version number of the GStreamer core that the
197 * plugin was compiled for, you can just use GST_VERSION_MAJOR here
198 * @minor_version: the minor version number of the GStreamer core that the
199 * plugin was compiled for, you can just use GST_VERSION_MINOR here
200 * @name: a unique name of the plugin (ideally prefixed with an application- or
201 * library-specific namespace prefix in order to avoid name conflicts in
202 * case a similar plugin with the same name ever gets added to GStreamer)
203 * @description: description of the plugin
204 * @init_func: pointer to the init function of this plugin.
205 * @version: version string of the plugin
206 * @license: effective license of plugin. Must be one of the approved licenses
207 * (see #GstPluginDesc above) or the plugin will not be registered.
208 * @source: source module plugin belongs to
209 * @package: shipped package plugin belongs to
210 * @origin: URL to provider of plugin
212 * Registers a static plugin, ie. a plugin which is private to an application
213 * or library and contained within the application or library (as opposed to
214 * being shipped as a separate module file).
216 * You must make sure that GStreamer has been initialised (with gst_init() or
217 * via gst_init_get_option_group()) before calling this function.
219 * Returns: TRUE if the plugin was registered correctly, otherwise FALSE.
224 gst_plugin_register_static (gint major_version, gint minor_version,
225 const gchar * name, gchar * description, GstPluginInitFunc init_func,
226 const gchar * version, const gchar * license, const gchar * source,
227 const gchar * package, const gchar * origin)
229 GstPluginDesc desc = { major_version, minor_version, name, description,
230 init_func, version, license, source, package, origin,
233 gboolean res = FALSE;
235 g_return_val_if_fail (name != NULL, FALSE);
236 g_return_val_if_fail (description != NULL, FALSE);
237 g_return_val_if_fail (init_func != NULL, FALSE);
238 g_return_val_if_fail (version != NULL, FALSE);
239 g_return_val_if_fail (license != NULL, FALSE);
240 g_return_val_if_fail (source != NULL, FALSE);
241 g_return_val_if_fail (package != NULL, FALSE);
242 g_return_val_if_fail (origin != NULL, FALSE);
244 /* make sure gst_init() has been called */
245 g_return_val_if_fail (_gst_plugin_inited != FALSE, FALSE);
247 GST_LOG ("attempting to load static plugin \"%s\" now...", name);
248 plugin = g_object_new (GST_TYPE_PLUGIN, NULL);
249 if (gst_plugin_register_func (plugin, &desc, NULL) != NULL) {
250 GST_INFO ("registered static plugin \"%s\"", name);
251 res = gst_default_registry_add_plugin (plugin);
252 GST_INFO ("added static plugin \"%s\", result: %d", name, res);
258 * gst_plugin_register_static_full:
259 * @major_version: the major version number of the GStreamer core that the
260 * plugin was compiled for, you can just use GST_VERSION_MAJOR here
261 * @minor_version: the minor version number of the GStreamer core that the
262 * plugin was compiled for, you can just use GST_VERSION_MINOR here
263 * @name: a unique name of the plugin (ideally prefixed with an application- or
264 * library-specific namespace prefix in order to avoid name conflicts in
265 * case a similar plugin with the same name ever gets added to GStreamer)
266 * @description: description of the plugin
267 * @init_full_func: pointer to the init function with user data of this plugin.
268 * @version: version string of the plugin
269 * @license: effective license of plugin. Must be one of the approved licenses
270 * (see #GstPluginDesc above) or the plugin will not be registered.
271 * @source: source module plugin belongs to
272 * @package: shipped package plugin belongs to
273 * @origin: URL to provider of plugin
274 * @user_data: gpointer to user data
276 * Registers a static plugin, ie. a plugin which is private to an application
277 * or library and contained within the application or library (as opposed to
278 * being shipped as a separate module file) with a #GstPluginInitFullFunc
279 * which allows user data to be passed to the callback function (useful
282 * You must make sure that GStreamer has been initialised (with gst_init() or
283 * via gst_init_get_option_group()) before calling this function.
285 * Returns: TRUE if the plugin was registered correctly, otherwise FALSE.
291 gst_plugin_register_static_full (gint major_version, gint minor_version,
292 const gchar * name, gchar * description,
293 GstPluginInitFullFunc init_full_func, const gchar * version,
294 const gchar * license, const gchar * source, const gchar * package,
295 const gchar * origin, gpointer user_data)
297 GstPluginDesc desc = { major_version, minor_version, name, description,
298 (GstPluginInitFunc) init_full_func, version, license, source, package,
302 gboolean res = FALSE;
304 g_return_val_if_fail (name != NULL, FALSE);
305 g_return_val_if_fail (description != NULL, FALSE);
306 g_return_val_if_fail (init_full_func != NULL, FALSE);
307 g_return_val_if_fail (version != NULL, FALSE);
308 g_return_val_if_fail (license != NULL, FALSE);
309 g_return_val_if_fail (source != NULL, FALSE);
310 g_return_val_if_fail (package != NULL, FALSE);
311 g_return_val_if_fail (origin != NULL, FALSE);
313 /* make sure gst_init() has been called */
314 g_return_val_if_fail (_gst_plugin_inited != FALSE, FALSE);
316 GST_LOG ("attempting to load static plugin \"%s\" now...", name);
317 plugin = g_object_new (GST_TYPE_PLUGIN, NULL);
318 if (gst_plugin_register_func (plugin, &desc, user_data) != NULL) {
319 GST_INFO ("registered static plugin \"%s\"", name);
320 res = gst_default_registry_add_plugin (plugin);
321 GST_INFO ("added static plugin \"%s\", result: %d", name, res);
327 _gst_plugin_initialize (void)
331 _gst_plugin_inited = TRUE;
333 /* now register all static plugins */
334 GST_INFO ("registering %u static plugins", _num_static_plugins);
335 for (i = 0; i < _num_static_plugins; ++i) {
336 gst_plugin_register_static (_static_plugins[i].major_version,
337 _static_plugins[i].minor_version, _static_plugins[i].name,
338 _static_plugins[i].description, _static_plugins[i].plugin_init,
339 _static_plugins[i].version, _static_plugins[i].license,
340 _static_plugins[i].source, _static_plugins[i].package,
341 _static_plugins[i].origin);
344 if (_static_plugins) {
345 free (_static_plugins);
346 _static_plugins = NULL;
347 _num_static_plugins = 0;
351 /* this function could be extended to check if the plugin license matches the
352 * applications license (would require the app to register its license somehow).
353 * We'll wait for someone who's interested in it to code it :)
356 gst_plugin_check_license (const gchar * license)
358 const gchar **check_license = valid_licenses;
360 g_assert (check_license);
362 while (*check_license) {
363 if (strcmp (license, *check_license) == 0)
371 gst_plugin_check_version (gint major, gint minor)
373 /* return NULL if the major and minor version numbers are not compatible */
375 if (major != GST_VERSION_MAJOR || minor != GST_VERSION_MINOR)
382 gst_plugin_register_func (GstPlugin * plugin, const GstPluginDesc * desc,
385 if (!gst_plugin_check_version (desc->major_version, desc->minor_version)) {
387 GST_WARNING ("plugin \"%s\" has incompatible version, not loading",
392 if (!desc->license || !desc->description || !desc->source ||
393 !desc->package || !desc->origin) {
395 GST_WARNING ("plugin \"%s\" has incorrect GstPluginDesc, not loading",
400 if (!gst_plugin_check_license (desc->license)) {
402 GST_WARNING ("plugin \"%s\" has invalid license \"%s\", not loading",
403 plugin->filename, desc->license);
408 GST_LOG ("plugin \"%s\" looks good", GST_STR_NULL (plugin->filename));
410 gst_plugin_desc_copy (&plugin->desc, desc);
413 if (!(((GstPluginInitFullFunc) (desc->plugin_init)) (plugin, user_data))) {
415 GST_WARNING ("plugin \"%s\" failed to initialise", plugin->filename);
416 plugin->module = NULL;
420 if (!((desc->plugin_init) (plugin))) {
422 GST_WARNING ("plugin \"%s\" failed to initialise", plugin->filename);
423 plugin->module = NULL;
429 GST_LOG ("plugin \"%s\" initialised", GST_STR_NULL (plugin->filename));
434 #ifdef HAVE_SIGACTION
435 static struct sigaction oldaction;
436 static gboolean _gst_plugin_fault_handler_is_setup = FALSE;
439 * _gst_plugin_fault_handler_restore:
440 * segfault handler restorer
443 _gst_plugin_fault_handler_restore (void)
445 if (!_gst_plugin_fault_handler_is_setup)
448 _gst_plugin_fault_handler_is_setup = FALSE;
450 sigaction (SIGSEGV, &oldaction, NULL);
454 * _gst_plugin_fault_handler_sighandler:
455 * segfault handler implementation
458 _gst_plugin_fault_handler_sighandler (int signum)
460 /* We need to restore the fault handler or we'll keep getting it */
461 _gst_plugin_fault_handler_restore ();
465 g_print ("\nERROR: ");
466 g_print ("Caught a segmentation fault while loading plugin file:\n");
467 g_print ("%s\n\n", _gst_plugin_fault_handler_filename);
468 g_print ("Please either:\n");
469 g_print ("- remove it and restart.\n");
470 g_print ("- run with --gst-disable-segtrap and debug.\n");
474 g_print ("Caught unhandled signal on plugin loading\n");
480 * _gst_plugin_fault_handler_setup:
481 * sets up the segfault handler
484 _gst_plugin_fault_handler_setup (void)
486 struct sigaction action;
488 /* if asked to leave segfaults alone, just return */
489 if (!gst_segtrap_is_enabled ())
492 if (_gst_plugin_fault_handler_is_setup)
495 _gst_plugin_fault_handler_is_setup = TRUE;
497 memset (&action, 0, sizeof (action));
498 action.sa_handler = _gst_plugin_fault_handler_sighandler;
500 sigaction (SIGSEGV, &action, &oldaction);
502 #else /* !HAVE_SIGACTION */
504 _gst_plugin_fault_handler_restore (void)
509 _gst_plugin_fault_handler_setup (void)
512 #endif /* HAVE_SIGACTION */
514 static void _gst_plugin_fault_handler_setup ();
516 static GStaticMutex gst_plugin_loading_mutex = G_STATIC_MUTEX_INIT;
518 #define CHECK_PLUGIN_DESC_FIELD(desc,field,fn) \
519 if (G_UNLIKELY ((desc)->field == NULL)) { \
520 GST_ERROR ("GstPluginDesc for '%s' has no %s", fn, G_STRINGIFY (field)); \
524 * gst_plugin_load_file:
525 * @filename: the plugin filename to load
526 * @error: pointer to a NULL-valued GError
528 * Loads the given plugin and refs it. Caller needs to unref after use.
530 * Returns: a reference to the existing loaded GstPlugin, a reference to the
531 * newly-loaded GstPlugin, or NULL if an error occurred.
534 gst_plugin_load_file (const gchar * filename, GError ** error)
540 struct stat file_status;
541 GstRegistry *registry;
542 gboolean new_plugin = TRUE;
544 g_return_val_if_fail (filename != NULL, NULL);
546 registry = gst_registry_get_default ();
547 g_static_mutex_lock (&gst_plugin_loading_mutex);
549 plugin = gst_registry_lookup (registry, filename);
551 if (plugin->module) {
553 g_static_mutex_unlock (&gst_plugin_loading_mutex);
556 /* load plugin and update fields */
561 GST_CAT_DEBUG (GST_CAT_PLUGIN_LOADING, "attempt to load plugin \"%s\"",
564 if (g_module_supported () == FALSE) {
565 GST_CAT_DEBUG (GST_CAT_PLUGIN_LOADING, "module loading not supported");
568 GST_PLUGIN_ERROR_MODULE, "Dynamic loading not supported");
572 if (g_stat (filename, &file_status)) {
573 GST_CAT_DEBUG (GST_CAT_PLUGIN_LOADING, "problem accessing file");
576 GST_PLUGIN_ERROR_MODULE, "Problem accessing file %s: %s", filename,
581 module = g_module_open (filename, G_MODULE_BIND_LOCAL);
582 if (module == NULL) {
583 GST_CAT_WARNING (GST_CAT_PLUGIN_LOADING, "module_open failed: %s",
586 GST_PLUGIN_ERROR, GST_PLUGIN_ERROR_MODULE, "Opening module failed: %s",
588 /* If we failed to open the shared object, then it's probably because a
589 * plugin is linked against the wrong libraries. Print out an easy-to-see
590 * message in this case. */
591 g_warning ("Failed to load plugin '%s': %s", filename, g_module_error ());
596 plugin = g_object_new (GST_TYPE_PLUGIN, NULL);
597 plugin->file_mtime = file_status.st_mtime;
598 plugin->file_size = file_status.st_size;
599 plugin->filename = g_strdup (filename);
600 plugin->basename = g_path_get_basename (filename);
602 plugin->module = module;
604 ret = g_module_symbol (module, "gst_plugin_desc", &ptr);
606 GST_DEBUG ("Could not find plugin entry point in \"%s\"", filename);
609 GST_PLUGIN_ERROR_MODULE,
610 "File \"%s\" is not a GStreamer plugin", filename);
611 g_module_close (module);
614 plugin->orig_desc = (GstPluginDesc *) ptr;
617 /* check plugin description: complain about bad values but accept them, to
618 * maintain backwards compatibility (FIXME: 0.11) */
619 CHECK_PLUGIN_DESC_FIELD (plugin->orig_desc, name, filename);
620 CHECK_PLUGIN_DESC_FIELD (plugin->orig_desc, description, filename);
621 CHECK_PLUGIN_DESC_FIELD (plugin->orig_desc, version, filename);
622 CHECK_PLUGIN_DESC_FIELD (plugin->orig_desc, license, filename);
623 CHECK_PLUGIN_DESC_FIELD (plugin->orig_desc, source, filename);
624 CHECK_PLUGIN_DESC_FIELD (plugin->orig_desc, package, filename);
625 CHECK_PLUGIN_DESC_FIELD (plugin->orig_desc, origin, filename);
627 /* this is overwritten by gst_plugin_register_func() */
628 g_free (plugin->desc.description);
631 GST_LOG ("Plugin %p for file \"%s\" prepared, calling entry function...",
634 /* this is where we load the actual .so, so let's trap SIGSEGV */
635 _gst_plugin_fault_handler_setup ();
636 _gst_plugin_fault_handler_filename = plugin->filename;
638 GST_LOG ("Plugin %p for file \"%s\" prepared, registering...",
641 if (!gst_plugin_register_func (plugin, plugin->orig_desc, NULL)) {
642 /* remove signal handler */
643 _gst_plugin_fault_handler_restore ();
644 GST_DEBUG ("gst_plugin_register_func failed for plugin \"%s\"", filename);
648 GST_PLUGIN_ERROR_MODULE,
649 "File \"%s\" appears to be a GStreamer plugin, but it failed to initialize",
651 g_module_close (module);
655 /* remove signal handler */
656 _gst_plugin_fault_handler_restore ();
657 _gst_plugin_fault_handler_filename = NULL;
658 GST_INFO ("plugin \"%s\" loaded", plugin->filename);
661 gst_object_ref (plugin);
662 gst_default_registry_add_plugin (plugin);
665 g_static_mutex_unlock (&gst_plugin_loading_mutex);
671 gst_object_unref (plugin);
672 g_static_mutex_unlock (&gst_plugin_loading_mutex);
678 gst_plugin_desc_copy (GstPluginDesc * dest, const GstPluginDesc * src)
680 dest->major_version = src->major_version;
681 dest->minor_version = src->minor_version;
682 dest->name = g_intern_string (src->name);
683 /* maybe intern the description too, just for convenience? */
684 dest->description = g_strdup (src->description);
685 dest->plugin_init = src->plugin_init;
686 dest->version = g_intern_string (src->version);
687 dest->license = g_intern_string (src->license);
688 dest->source = g_intern_string (src->source);
689 dest->package = g_intern_string (src->package);
690 dest->origin = g_intern_string (src->origin);
695 gst_plugin_desc_free (GstPluginDesc * desc)
697 g_free (desc->description);
698 memset (desc, 0, sizeof (GstPluginDesc));
702 * gst_plugin_get_name:
703 * @plugin: plugin to get the name of
705 * Get the short name of the plugin
707 * Returns: the name of the plugin
710 gst_plugin_get_name (GstPlugin * plugin)
712 g_return_val_if_fail (plugin != NULL, NULL);
714 return plugin->desc.name;
718 * gst_plugin_get_description:
719 * @plugin: plugin to get long name of
721 * Get the long descriptive name of the plugin
723 * Returns: the long name of the plugin
725 G_CONST_RETURN gchar *
726 gst_plugin_get_description (GstPlugin * plugin)
728 g_return_val_if_fail (plugin != NULL, NULL);
730 return plugin->desc.description;
734 * gst_plugin_get_filename:
735 * @plugin: plugin to get the filename of
737 * get the filename of the plugin
739 * Returns: the filename of the plugin
741 G_CONST_RETURN gchar *
742 gst_plugin_get_filename (GstPlugin * plugin)
744 g_return_val_if_fail (plugin != NULL, NULL);
746 return plugin->filename;
750 * gst_plugin_get_version:
751 * @plugin: plugin to get the version of
753 * get the version of the plugin
755 * Returns: the version of the plugin
757 G_CONST_RETURN gchar *
758 gst_plugin_get_version (GstPlugin * plugin)
760 g_return_val_if_fail (plugin != NULL, NULL);
762 return plugin->desc.version;
766 * gst_plugin_get_license:
767 * @plugin: plugin to get the license of
769 * get the license of the plugin
771 * Returns: the license of the plugin
773 G_CONST_RETURN gchar *
774 gst_plugin_get_license (GstPlugin * plugin)
776 g_return_val_if_fail (plugin != NULL, NULL);
778 return plugin->desc.license;
782 * gst_plugin_get_source:
783 * @plugin: plugin to get the source of
785 * get the source module the plugin belongs to.
787 * Returns: the source of the plugin
789 G_CONST_RETURN gchar *
790 gst_plugin_get_source (GstPlugin * plugin)
792 g_return_val_if_fail (plugin != NULL, NULL);
794 return plugin->desc.source;
798 * gst_plugin_get_package:
799 * @plugin: plugin to get the package of
801 * get the package the plugin belongs to.
803 * Returns: the package of the plugin
805 G_CONST_RETURN gchar *
806 gst_plugin_get_package (GstPlugin * plugin)
808 g_return_val_if_fail (plugin != NULL, NULL);
810 return plugin->desc.package;
814 * gst_plugin_get_origin:
815 * @plugin: plugin to get the origin of
817 * get the URL where the plugin comes from
819 * Returns: the origin of the plugin
821 G_CONST_RETURN gchar *
822 gst_plugin_get_origin (GstPlugin * plugin)
824 g_return_val_if_fail (plugin != NULL, NULL);
826 return plugin->desc.origin;
830 * gst_plugin_get_module:
831 * @plugin: plugin to query
833 * Gets the #GModule of the plugin. If the plugin isn't loaded yet, NULL is
836 * Returns: module belonging to the plugin or NULL if the plugin isn't
840 gst_plugin_get_module (GstPlugin * plugin)
842 g_return_val_if_fail (plugin != NULL, NULL);
844 return plugin->module;
848 * gst_plugin_is_loaded:
849 * @plugin: plugin to query
851 * queries if the plugin is loaded into memory
853 * Returns: TRUE is loaded, FALSE otherwise
856 gst_plugin_is_loaded (GstPlugin * plugin)
858 g_return_val_if_fail (plugin != NULL, FALSE);
860 return (plugin->module != NULL || plugin->filename == NULL);
864 * gst_plugin_get_cache_data:
867 * Gets the plugin specific data cache. If it is %NULL there is no cached data
868 * stored. This is the case when the registry is getting rebuild.
870 * Returns: The cached data as a #GstStructure or %NULL.
872 G_CONST_RETURN GstStructure *
873 gst_plugin_get_cache_data (GstPlugin * plugin)
875 g_return_val_if_fail (GST_IS_PLUGIN (plugin), NULL);
877 return plugin->priv->cache_data;
881 * gst_plugin_set_cache_data:
883 * @cache_data: a structure containing the data to cache
885 * Adds plugin specific data to cache. Passes the ownership of the structure to
888 * The cache is flushed every time the registry is rebuild.
891 gst_plugin_set_cache_data (GstPlugin * plugin, GstStructure * cache_data)
893 g_return_if_fail (GST_IS_PLUGIN (plugin));
894 g_return_if_fail (GST_IS_STRUCTURE (cache_data));
896 if (plugin->priv->cache_data) {
897 gst_structure_free (plugin->priv->cache_data);
899 plugin->priv->cache_data = cache_data;
904 * gst_plugin_feature_list:
905 * @plugin: plugin to query
906 * @filter: the filter to use
907 * @first: only return first match
908 * @user_data: user data passed to the filter function
910 * Runs a filter against all plugin features and returns a GList with
911 * the results. If the first flag is set, only the first match is
912 * returned (as a list with a single object).
914 * Returns: a GList of features, g_list_free after use.
917 gst_plugin_feature_filter (GstPlugin * plugin,
918 GstPluginFeatureFilter filter, gboolean first, gpointer user_data)
923 list = gst_filter_run (plugin->features, (GstFilterFunc) filter, first,
925 for (g = list; g; g = g->next) {
926 gst_object_ref (plugin);
934 GstPluginFeatureFilter filter;
942 _feature_filter (GstPlugin * plugin, gpointer user_data)
945 FeatureFilterData *data = (FeatureFilterData *) user_data;
947 result = gst_plugin_feature_filter (plugin, data->filter, data->first,
950 data->result = g_list_concat (data->result, result);
957 * gst_plugin_list_feature_filter:
958 * @list: a #GList of plugins to query
959 * @filter: the filter function to use
960 * @first: only return first match
961 * @user_data: user data passed to the filter function
963 * Runs a filter against all plugin features of the plugins in the given
964 * list and returns a GList with the results.
965 * If the first flag is set, only the first match is
966 * returned (as a list with a single object).
968 * Returns: a GList of features, g_list_free after use.
971 gst_plugin_list_feature_filter (GList * list,
972 GstPluginFeatureFilter filter, gboolean first, gpointer user_data)
974 FeatureFilterData data;
977 data.filter = filter;
979 data.user_data = user_data;
982 result = gst_filter_run (list, (GstFilterFunc) _feature_filter, first, &data);
983 g_list_free (result);
990 * gst_plugin_name_filter:
991 * @plugin: the plugin to check
992 * @name: the name of the plugin
994 * A standard filter that returns TRUE when the plugin is of the
997 * Returns: TRUE if the plugin is of the given name.
1000 gst_plugin_name_filter (GstPlugin * plugin, const gchar * name)
1002 return (plugin->desc.name && !strcmp (plugin->desc.name, name));
1007 * gst_plugin_find_feature:
1008 * @plugin: plugin to get the feature from
1009 * @name: The name of the feature to find
1010 * @type: The type of the feature to find
1012 * Find a feature of the given name and type in the given plugin.
1014 * Returns: a GstPluginFeature or NULL if the feature was not found.
1017 gst_plugin_find_feature (GstPlugin * plugin, const gchar * name, GType type)
1020 GstPluginFeature *result = NULL;
1021 GstTypeNameData data;
1023 g_return_val_if_fail (name != NULL, NULL);
1028 walk = gst_filter_run (plugin->features,
1029 (GstFilterFunc) gst_plugin_feature_type_name_filter, TRUE, &data);
1032 result = GST_PLUGIN_FEATURE (walk->data);
1034 gst_object_ref (result);
1035 gst_plugin_feature_list_free (walk);
1044 gst_plugin_feature_name_filter (GstPluginFeature * feature, const gchar * name)
1046 return !strcmp (name, GST_PLUGIN_FEATURE_NAME (feature));
1052 * gst_plugin_find_feature_by_name:
1053 * @plugin: plugin to get the feature from
1054 * @name: The name of the feature to find
1056 * Find a feature of the given name in the given plugin.
1058 * Returns: a GstPluginFeature or NULL if the feature was not found.
1061 gst_plugin_find_feature_by_name (GstPlugin * plugin, const gchar * name)
1064 GstPluginFeature *result = NULL;
1066 g_return_val_if_fail (name != NULL, NULL);
1068 walk = gst_filter_run (plugin->features,
1069 (GstFilterFunc) gst_plugin_feature_name_filter, TRUE, (void *) name);
1072 result = GST_PLUGIN_FEATURE (walk->data);
1074 gst_object_ref (result);
1075 gst_plugin_feature_list_free (walk);
1083 * gst_plugin_load_by_name:
1084 * @name: name of plugin to load
1086 * Load the named plugin. Refs the plugin.
1088 * Returns: A reference to a loaded plugin, or NULL on error.
1091 gst_plugin_load_by_name (const gchar * name)
1093 GstPlugin *plugin, *newplugin;
1094 GError *error = NULL;
1096 GST_DEBUG ("looking up plugin %s in default registry", name);
1097 plugin = gst_registry_find_plugin (gst_registry_get_default (), name);
1099 GST_DEBUG ("loading plugin %s from file %s", name, plugin->filename);
1100 newplugin = gst_plugin_load_file (plugin->filename, &error);
1101 gst_object_unref (plugin);
1104 GST_WARNING ("load_plugin error: %s", error->message);
1105 g_error_free (error);
1108 /* newplugin was reffed by load_file */
1112 GST_DEBUG ("Could not find plugin %s in registry", name);
1118 * @plugin: plugin to load
1120 * Loads @plugin. Note that the *return value* is the loaded plugin; @plugin is
1121 * untouched. The normal use pattern of this function goes like this:
1124 * GstPlugin *loaded_plugin;
1125 * loaded_plugin = gst_plugin_load (plugin);
1126 * // presumably, we're no longer interested in the potentially-unloaded plugin
1127 * gst_object_unref (plugin);
1128 * plugin = loaded_plugin;
1131 * Returns: A reference to a loaded plugin, or NULL on error.
1134 gst_plugin_load (GstPlugin * plugin)
1136 GError *error = NULL;
1137 GstPlugin *newplugin;
1139 if (gst_plugin_is_loaded (plugin)) {
1143 if (!(newplugin = gst_plugin_load_file (plugin->filename, &error)))
1150 GST_WARNING ("load_plugin error: %s", error->message);
1151 g_error_free (error);
1157 * gst_plugin_list_free:
1158 * @list: list of #GstPlugin
1160 * Unrefs each member of @list, then frees the list.
1163 gst_plugin_list_free (GList * list)
1167 for (g = list; g; g = g->next) {
1168 gst_object_unref (GST_PLUGIN_CAST (g->data));
1173 /* ===== plugin dependencies ===== */
1176 * ENV + xyz where ENV can contain multiple values separated by SEPARATOR
1177 * xyz may be "" (if ENV contains path to file rather than dir)
1178 * ENV + *xyz same as above, but xyz acts as suffix filter
1179 * ENV + xyz* same as above, but xyz acts as prefix filter (is this needed?)
1180 * ENV + *xyz* same as above, but xyz acts as strstr filter (is this needed?)
1182 * same as above, with additional paths hard-coded at compile-time:
1183 * - only check paths + ... if ENV is not set or yields not paths
1184 * - always check paths + ... in addition to ENV
1186 * When user specifies set of environment variables, he/she may also use e.g.
1187 * "HOME/.mystuff/plugins", and we'll expand the content of $HOME with the
1191 /* we store in registry:
1194 * - environment variables (array of strings)
1195 * - last hash of env variable contents (uint) (so we can avoid doing stats
1196 * if one of the env vars has changed; premature optimisation galore)
1197 * - hard-coded paths (array of strings)
1198 * - xyz filename/suffix/prefix strings (array of strings)
1200 * - last hash of file/dir stats (int)
1202 * (= struct GstPluginDep)
1206 gst_plugin_ext_dep_get_env_vars_hash (GstPlugin * plugin, GstPluginDep * dep)
1211 /* there's no deeper logic to what we do here; all we want to know (when
1212 * checking if the plugin needs to be rescanned) is whether the content of
1213 * one of the environment variables in the list is different from when it
1214 * was last scanned */
1216 for (e = dep->env_vars; e != NULL && *e != NULL; ++e) {
1220 /* order matters: "val",NULL needs to yield a different hash than
1221 * NULL,"val", so do a shift here whether the var is set or not */
1224 /* want environment variable at beginning of string */
1225 if (!g_ascii_isalnum (**e)) {
1226 GST_WARNING_OBJECT (plugin, "string prefix is not a valid environment "
1227 "variable string: %s", *e);
1231 /* user is allowed to specify e.g. "HOME/.pitivi/plugins" */
1232 g_strlcpy (env_var, *e, sizeof (env_var));
1233 g_strdelimit (env_var, "/\\", '\0');
1235 if ((val = g_getenv (env_var)))
1236 hash += g_str_hash (val);
1243 _priv_plugin_deps_env_vars_changed (GstPlugin * plugin)
1247 for (l = plugin->priv->deps; l != NULL; l = l->next) {
1248 GstPluginDep *dep = l->data;
1250 if (dep->env_hash != gst_plugin_ext_dep_get_env_vars_hash (plugin, dep))
1258 gst_plugin_ext_dep_extract_env_vars_paths (GstPlugin * plugin,
1262 GList *paths = NULL;
1264 for (evars = dep->env_vars; evars != NULL && *evars != NULL; ++evars) {
1268 /* want environment variable at beginning of string */
1269 if (!g_ascii_isalnum (**evars)) {
1270 GST_WARNING_OBJECT (plugin, "string prefix is not a valid environment "
1271 "variable string: %s", *evars);
1275 /* user is allowed to specify e.g. "HOME/.pitivi/plugins", which we want to
1276 * split into the env_var name component and the path component */
1277 components = g_strsplit_set (*evars, "/\\", 2);
1278 g_assert (components != NULL);
1280 e = g_getenv (components[0]);
1281 GST_LOG_OBJECT (plugin, "expanding %s = '%s' (path suffix: %s)",
1282 components[0], GST_STR_NULL (e), GST_STR_NULL (components[1]));
1284 if (components[1] != NULL) {
1285 g_strdelimit (components[1], "/\\", G_DIR_SEPARATOR);
1288 if (e != NULL && *e != '\0') {
1292 arr = g_strsplit (e, G_SEARCHPATH_SEPARATOR_S, -1);
1294 for (i = 0; arr != NULL && arr[i] != NULL; ++i) {
1297 if (!g_path_is_absolute (arr[i])) {
1298 GST_INFO_OBJECT (plugin, "ignoring environment variable content '%s'"
1299 ": either not an absolute path or not a path at all", arr[i]);
1303 if (components[1] != NULL) {
1304 full_path = g_build_filename (arr[i], components[1], NULL);
1306 full_path = g_strdup (arr[i]);
1309 if (!g_list_find_custom (paths, full_path, (GCompareFunc) strcmp)) {
1310 GST_LOG_OBJECT (plugin, "path: '%s'", full_path);
1311 paths = g_list_prepend (paths, full_path);
1314 GST_LOG_OBJECT (plugin, "path: '%s' (duplicate,ignoring)", full_path);
1322 g_strfreev (components);
1325 GST_LOG_OBJECT (plugin, "Extracted %d paths from environment",
1326 g_list_length (paths));
1332 gst_plugin_ext_dep_get_hash_from_stat_entry (struct stat *s)
1334 if (!(s->st_mode & (S_IFDIR | S_IFREG)))
1337 /* completely random formula */
1338 return ((s->st_size << 3) + (s->st_mtime << 5)) ^ s->st_ctime;
1342 gst_plugin_ext_dep_direntry_matches (GstPlugin * plugin, const gchar * entry,
1343 const gchar ** filenames, GstPluginDependencyFlags flags)
1345 /* no filenames specified, match all entries for now (could probably
1346 * optimise by just taking the dir stat hash or so) */
1347 if (filenames == NULL || *filenames == NULL || **filenames == '\0')
1350 while (*filenames != NULL) {
1352 if (((flags & GST_PLUGIN_DEPENDENCY_FLAG_FILE_NAME_IS_SUFFIX)) &&
1353 g_str_has_suffix (entry, *filenames)) {
1355 /* else it's an exact match that's needed */
1356 } else if (strcmp (entry, *filenames) == 0) {
1359 GST_LOG ("%s does not match %s, flags=0x%04x", entry, *filenames, flags);
1366 gst_plugin_ext_dep_scan_dir_and_match_names (GstPlugin * plugin,
1367 const gchar * path, const gchar ** filenames,
1368 GstPluginDependencyFlags flags, int depth)
1371 gboolean recurse_dirs;
1376 recurse_dirs = !!(flags & GST_PLUGIN_DEPENDENCY_FLAG_RECURSE);
1378 dir = g_dir_open (path, 0, &err);
1380 GST_DEBUG_OBJECT (plugin, "g_dir_open(%s) failed: %s", path, err->message);
1385 /* FIXME: we're assuming here that we always get the directory entries in
1386 * the same order, and not in a random order */
1387 while ((entry = g_dir_read_name (dir))) {
1388 gboolean have_match;
1394 gst_plugin_ext_dep_direntry_matches (plugin, entry, filenames, flags);
1396 /* avoid the stat if possible */
1397 if (!have_match && !recurse_dirs)
1400 full_path = g_build_filename (path, entry, NULL);
1401 if (g_stat (full_path, &s) < 0) {
1402 fhash = (guint) - 1;
1403 GST_LOG_OBJECT (plugin, "stat: %s (error: %s)", full_path,
1404 g_strerror (errno));
1405 } else if (have_match) {
1406 fhash = gst_plugin_ext_dep_get_hash_from_stat_entry (&s);
1407 GST_LOG_OBJECT (plugin, "stat: %s (result: %u)", full_path, fhash);
1408 } else if ((s.st_mode & (S_IFDIR))) {
1409 fhash = gst_plugin_ext_dep_scan_dir_and_match_names (plugin, full_path,
1410 filenames, flags, depth + 1);
1412 /* it's not a name match, we want to recurse, but it's not a directory */
1417 hash = (hash + fhash) << 1;
1426 gst_plugin_ext_dep_scan_path_with_filenames (GstPlugin * plugin,
1427 const gchar * path, const gchar ** filenames,
1428 GstPluginDependencyFlags flags)
1430 const gchar *empty_filenames[] = { "", NULL };
1431 gboolean recurse_into_dirs, partial_names;
1434 /* to avoid special-casing below (FIXME?) */
1435 if (filenames == NULL || *filenames == NULL)
1436 filenames = empty_filenames;
1438 recurse_into_dirs = !!(flags & GST_PLUGIN_DEPENDENCY_FLAG_RECURSE);
1439 partial_names = !!(flags & GST_PLUGIN_DEPENDENCY_FLAG_FILE_NAME_IS_SUFFIX);
1441 /* if we can construct the exact paths to check with the data we have, just
1442 * stat them one by one; this is more efficient than opening the directory
1443 * and going through each entry to see if it matches one of our filenames. */
1444 if (!recurse_into_dirs && !partial_names) {
1445 for (i = 0; filenames[i] != NULL; ++i) {
1450 full_path = g_build_filename (path, filenames[i], NULL);
1451 if (g_stat (full_path, &s) < 0) {
1452 fhash = (guint) - 1;
1453 GST_LOG_OBJECT (plugin, "stat: %s (error: %s)", full_path,
1454 g_strerror (errno));
1456 fhash = gst_plugin_ext_dep_get_hash_from_stat_entry (&s);
1457 GST_LOG_OBJECT (plugin, "stat: %s (result: %08x)", full_path, fhash);
1459 hash = (hash + fhash) << 1;
1463 hash = gst_plugin_ext_dep_scan_dir_and_match_names (plugin, path,
1464 filenames, flags, 0);
1471 gst_plugin_ext_dep_get_stat_hash (GstPlugin * plugin, GstPluginDep * dep)
1473 gboolean paths_are_default_only;
1475 guint scan_hash = 0;
1477 GST_LOG_OBJECT (plugin, "start");
1479 paths_are_default_only =
1480 dep->flags & GST_PLUGIN_DEPENDENCY_FLAG_PATHS_ARE_DEFAULT_ONLY;
1482 scan_paths = gst_plugin_ext_dep_extract_env_vars_paths (plugin, dep);
1484 if (scan_paths == NULL || !paths_are_default_only) {
1487 for (paths = dep->paths; paths != NULL && *paths != NULL; ++paths) {
1488 const gchar *path = *paths;
1490 if (!g_list_find_custom (scan_paths, path, (GCompareFunc) strcmp)) {
1491 GST_LOG_OBJECT (plugin, "path: '%s'", path);
1492 scan_paths = g_list_prepend (scan_paths, g_strdup (path));
1494 GST_LOG_OBJECT (plugin, "path: '%s' (duplicate, ignoring)", path);
1499 /* not that the order really matters, but it makes debugging easier */
1500 scan_paths = g_list_reverse (scan_paths);
1502 while (scan_paths != NULL) {
1503 const gchar *path = scan_paths->data;
1505 scan_hash += gst_plugin_ext_dep_scan_path_with_filenames (plugin, path,
1506 (const gchar **) dep->names, dep->flags);
1507 scan_hash = scan_hash << 1;
1509 g_free (scan_paths->data);
1510 scan_paths = g_list_delete_link (scan_paths, scan_paths);
1513 GST_LOG_OBJECT (plugin, "done, scan_hash: %08x", scan_hash);
1518 _priv_plugin_deps_files_changed (GstPlugin * plugin)
1522 for (l = plugin->priv->deps; l != NULL; l = l->next) {
1523 GstPluginDep *dep = l->data;
1525 if (dep->stat_hash != gst_plugin_ext_dep_get_stat_hash (plugin, dep))
1533 gst_plugin_ext_dep_free (GstPluginDep * dep)
1535 g_strfreev (dep->env_vars);
1536 g_strfreev (dep->paths);
1537 g_strfreev (dep->names);
1542 gst_plugin_ext_dep_strv_equal (gchar ** arr1, gchar ** arr2)
1546 if (arr1 == NULL || arr2 == NULL)
1548 for (; *arr1 != NULL && *arr2 != NULL; ++arr1, ++arr2) {
1549 if (strcmp (*arr1, *arr2) != 0)
1552 return (*arr1 == *arr2);
1556 gst_plugin_ext_dep_equals (GstPluginDep * dep, const gchar ** env_vars,
1557 const gchar ** paths, const gchar ** names, GstPluginDependencyFlags flags)
1559 if (dep->flags != flags)
1562 return gst_plugin_ext_dep_strv_equal (dep->env_vars, (gchar **) env_vars) &&
1563 gst_plugin_ext_dep_strv_equal (dep->paths, (gchar **) paths) &&
1564 gst_plugin_ext_dep_strv_equal (dep->names, (gchar **) names);
1568 * gst_plugin_add_dependency:
1569 * @plugin: a #GstPlugin
1570 * @env_vars: NULL-terminated array of environent variables affecting the
1571 * feature set of the plugin (e.g. an environment variable containing
1572 * paths where to look for additional modules/plugins of a library),
1573 * or NULL. Environment variable names may be followed by a path component
1574 * which will be added to the content of the environment variable, e.g.
1575 * "HOME/.mystuff/plugins".
1576 * @paths: NULL-terminated array of directories/paths where dependent files
1578 * @names: NULL-terminated array of file names (or file name suffixes,
1579 * depending on @flags) to be used in combination with the paths from
1580 * @paths and/or the paths extracted from the environment variables in
1581 * @env_vars, or NULL.
1582 * @flags: optional flags, or #GST_PLUGIN_DEPENDENCY_FLAG_NONE
1584 * Make GStreamer aware of external dependencies which affect the feature
1585 * set of this plugin (ie. the elements or typefinders associated with it).
1587 * GStreamer will re-inspect plugins with external dependencies whenever any
1588 * of the external dependencies change. This is useful for plugins which wrap
1589 * other plugin systems, e.g. a plugin which wraps a plugin-based visualisation
1590 * library and makes visualisations available as GStreamer elements, or a
1591 * codec loader which exposes elements and/or caps dependent on what external
1592 * codec libraries are currently installed.
1597 gst_plugin_add_dependency (GstPlugin * plugin, const gchar ** env_vars,
1598 const gchar ** paths, const gchar ** names, GstPluginDependencyFlags flags)
1603 g_return_if_fail (GST_IS_PLUGIN (plugin));
1604 g_return_if_fail (env_vars != NULL || paths != NULL);
1606 for (l = plugin->priv->deps; l != NULL; l = l->next) {
1607 if (gst_plugin_ext_dep_equals (l->data, env_vars, paths, names, flags)) {
1608 GST_LOG_OBJECT (plugin, "dependency already registered");
1613 dep = g_new0 (GstPluginDep, 1);
1615 dep->env_vars = g_strdupv ((gchar **) env_vars);
1616 dep->paths = g_strdupv ((gchar **) paths);
1617 dep->names = g_strdupv ((gchar **) names);
1620 dep->env_hash = gst_plugin_ext_dep_get_env_vars_hash (plugin, dep);
1621 dep->stat_hash = gst_plugin_ext_dep_get_stat_hash (plugin, dep);
1623 plugin->priv->deps = g_list_append (plugin->priv->deps, dep);
1625 GST_DEBUG_OBJECT (plugin, "added dependency:");
1626 for (; env_vars != NULL && *env_vars != NULL; ++env_vars)
1627 GST_DEBUG_OBJECT (plugin, " evar: %s", *env_vars);
1628 for (; paths != NULL && *paths != NULL; ++paths)
1629 GST_DEBUG_OBJECT (plugin, " path: %s", *paths);
1630 for (; names != NULL && *names != NULL; ++names)
1631 GST_DEBUG_OBJECT (plugin, " name: %s", *names);
1635 * gst_plugin_add_dependency_simple:
1636 * @plugin: the #GstPlugin
1637 * @env_vars: one or more environent variables (separated by ':', ';' or ','),
1638 * or NULL. Environment variable names may be followed by a path component
1639 * which will be added to the content of the environment variable, e.g.
1640 * "HOME/.mystuff/plugins:MYSTUFF_PLUGINS_PATH"
1641 * @paths: one ore more directory paths (separated by ':' or ';' or ','),
1642 * or NULL. Example: "/usr/lib/mystuff/plugins"
1643 * @names: one or more file names or file name suffixes (separated by commas),
1645 * @flags: optional flags, or #GST_PLUGIN_DEPENDENCY_FLAG_NONE
1647 * Make GStreamer aware of external dependencies which affect the feature
1648 * set of this plugin (ie. the elements or typefinders associated with it).
1650 * GStreamer will re-inspect plugins with external dependencies whenever any
1651 * of the external dependencies change. This is useful for plugins which wrap
1652 * other plugin systems, e.g. a plugin which wraps a plugin-based visualisation
1653 * library and makes visualisations available as GStreamer elements, or a
1654 * codec loader which exposes elements and/or caps dependent on what external
1655 * codec libraries are currently installed.
1657 * Convenience wrapper function for gst_plugin_add_dependency() which
1658 * takes simple strings as arguments instead of string arrays, with multiple
1659 * arguments separated by predefined delimiters (see above).
1664 gst_plugin_add_dependency_simple (GstPlugin * plugin,
1665 const gchar * env_vars, const gchar * paths, const gchar * names,
1666 GstPluginDependencyFlags flags)
1668 gchar **a_evars = NULL;
1669 gchar **a_paths = NULL;
1670 gchar **a_names = NULL;
1673 a_evars = g_strsplit_set (env_vars, ":;,", -1);
1675 a_paths = g_strsplit_set (paths, ":;,", -1);
1677 a_names = g_strsplit_set (names, ",", -1);
1679 gst_plugin_add_dependency (plugin, (const gchar **) a_evars,
1680 (const gchar **) a_paths, (const gchar **) a_names, flags);
1683 g_strfreev (a_evars);
1685 g_strfreev (a_paths);
1687 g_strfreev (a_names);