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
53 #include "gst_private.h"
55 #include <glib/gstdio.h>
56 #include <sys/types.h>
66 #include "glib-compat-private.h"
70 #define GST_CAT_DEFAULT GST_CAT_PLUGIN_LOADING
72 static guint _num_static_plugins; /* 0 */
73 static GstPluginDesc *_static_plugins; /* NULL */
74 static gboolean _gst_plugin_inited;
76 /* static variables for segfault handling of plugin loading */
77 static char *_gst_plugin_fault_handler_filename = NULL;
79 /* list of valid licenses.
80 * One of these must be specified or the plugin won't be loaded
81 * Contact gstreamer-devel@lists.sourceforge.net if your license should be
84 * GPL: http://www.gnu.org/copyleft/gpl.html
85 * LGPL: http://www.gnu.org/copyleft/lesser.html
86 * QPL: http://www.trolltech.com/licenses/qpl.html
87 * MPL: http://www.opensource.org/licenses/mozilla1.1.php
88 * MIT/X11: http://www.opensource.org/licenses/mit-license.php
89 * 3-clause BSD: http://www.opensource.org/licenses/bsd-license.php
91 static const gchar *valid_licenses[] = {
92 "LGPL", /* GNU Lesser General Public License */
93 "GPL", /* GNU General Public License */
94 "QPL", /* Trolltech Qt Public License */
95 "GPL/QPL", /* Combi-license of GPL + QPL */
96 "MPL", /* MPL 1.1 license */
97 "BSD", /* 3-clause BSD license */
98 "MIT/X11", /* MIT/X11 license */
99 "Proprietary", /* Proprietary license */
100 GST_LICENSE_UNKNOWN, /* some other license */
104 static GstPlugin *gst_plugin_register_func (GstPlugin * plugin,
105 const GstPluginDesc * desc, gpointer user_data);
106 static void gst_plugin_desc_copy (GstPluginDesc * dest,
107 const GstPluginDesc * src);
109 static void gst_plugin_ext_dep_free (GstPluginDep * dep);
111 G_DEFINE_TYPE (GstPlugin, gst_plugin, GST_TYPE_OBJECT);
114 gst_plugin_init (GstPlugin * plugin)
117 G_TYPE_INSTANCE_GET_PRIVATE (plugin, GST_TYPE_PLUGIN, GstPluginPrivate);
121 gst_plugin_finalize (GObject * object)
123 GstPlugin *plugin = GST_PLUGIN_CAST (object);
124 GstRegistry *registry = gst_registry_get_default ();
127 GST_DEBUG ("finalizing plugin %" GST_PTR_FORMAT, plugin);
128 for (g = registry->plugins; g; g = g->next) {
129 if (g->data == (gpointer) plugin) {
130 g_warning ("removing plugin that is still in registry");
133 g_free (plugin->filename);
134 g_free (plugin->basename);
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_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 #ifdef GST_DISABLE_DEPRECATED
167 void _gst_plugin_register_static (GstPluginDesc * desc);
169 /* this function can be called in the GCC constructor extension, before
170 * the _gst_plugin_initialize() was called. In that case, we store the
171 * plugin description in a list to initialize it when we open the main
173 * When the main module is known, we can register the plugin right away.
176 _gst_plugin_register_static (GstPluginDesc * desc)
178 g_return_if_fail (desc != NULL);
180 if (!_gst_plugin_inited) {
181 /* We can't use any GLib functions here, since g_thread_init hasn't been
182 * called yet, and we can't call it here either, or programs that don't
183 * guard their g_thread_init calls in main() will just abort */
184 ++_num_static_plugins;
186 realloc (_static_plugins, _num_static_plugins * sizeof (GstPluginDesc));
187 /* assume strings in the GstPluginDesc are static const or live forever */
188 _static_plugins[_num_static_plugins - 1] = *desc;
190 gst_plugin_register_static (desc->major_version, desc->minor_version,
191 desc->name, desc->description, desc->plugin_init, desc->version,
192 desc->license, desc->source, desc->package, desc->origin);
198 * gst_plugin_register_static:
199 * @major_version: the major version number of the GStreamer core that the
200 * plugin was compiled for, you can just use GST_VERSION_MAJOR here
201 * @minor_version: the minor version number of the GStreamer core that the
202 * plugin was compiled for, you can just use GST_VERSION_MINOR here
203 * @name: a unique name of the plugin (ideally prefixed with an application- or
204 * library-specific namespace prefix in order to avoid name conflicts in
205 * case a similar plugin with the same name ever gets added to GStreamer)
206 * @description: description of the plugin
207 * @init_func: pointer to the init function of this plugin.
208 * @version: version string of the plugin
209 * @license: effective license of plugin. Must be one of the approved licenses
210 * (see #GstPluginDesc above) or the plugin will not be registered.
211 * @source: source module plugin belongs to
212 * @package: shipped package plugin belongs to
213 * @origin: URL to provider of plugin
215 * Registers a static plugin, ie. a plugin which is private to an application
216 * or library and contained within the application or library (as opposed to
217 * being shipped as a separate module file).
219 * You must make sure that GStreamer has been initialised (with gst_init() or
220 * via gst_init_get_option_group()) before calling this function.
222 * Returns: TRUE if the plugin was registered correctly, otherwise FALSE.
227 gst_plugin_register_static (gint major_version, gint minor_version,
228 const gchar * name, const gchar * description, GstPluginInitFunc init_func,
229 const gchar * version, const gchar * license, const gchar * source,
230 const gchar * package, const gchar * origin)
232 GstPluginDesc desc = { major_version, minor_version, name, description,
233 init_func, version, license, source, package, origin,
236 gboolean res = FALSE;
238 g_return_val_if_fail (name != NULL, FALSE);
239 g_return_val_if_fail (description != NULL, FALSE);
240 g_return_val_if_fail (init_func != NULL, FALSE);
241 g_return_val_if_fail (version != NULL, FALSE);
242 g_return_val_if_fail (license != NULL, FALSE);
243 g_return_val_if_fail (source != NULL, FALSE);
244 g_return_val_if_fail (package != NULL, FALSE);
245 g_return_val_if_fail (origin != NULL, FALSE);
247 /* make sure gst_init() has been called */
248 g_return_val_if_fail (_gst_plugin_inited != FALSE, FALSE);
250 GST_LOG ("attempting to load static plugin \"%s\" now...", name);
251 plugin = g_object_newv (GST_TYPE_PLUGIN, 0, NULL);
252 if (gst_plugin_register_func (plugin, &desc, NULL) != NULL) {
253 GST_INFO ("registered static plugin \"%s\"", name);
254 res = gst_default_registry_add_plugin (plugin);
255 GST_INFO ("added static plugin \"%s\", result: %d", name, res);
261 * gst_plugin_register_static_full:
262 * @major_version: the major version number of the GStreamer core that the
263 * plugin was compiled for, you can just use GST_VERSION_MAJOR here
264 * @minor_version: the minor version number of the GStreamer core that the
265 * plugin was compiled for, you can just use GST_VERSION_MINOR here
266 * @name: a unique name of the plugin (ideally prefixed with an application- or
267 * library-specific namespace prefix in order to avoid name conflicts in
268 * case a similar plugin with the same name ever gets added to GStreamer)
269 * @description: description of the plugin
270 * @init_full_func: pointer to the init function with user data of this plugin.
271 * @version: version string of the plugin
272 * @license: effective license of plugin. Must be one of the approved licenses
273 * (see #GstPluginDesc above) or the plugin will not be registered.
274 * @source: source module plugin belongs to
275 * @package: shipped package plugin belongs to
276 * @origin: URL to provider of plugin
277 * @user_data: gpointer to user data
279 * Registers a static plugin, ie. a plugin which is private to an application
280 * or library and contained within the application or library (as opposed to
281 * being shipped as a separate module file) with a #GstPluginInitFullFunc
282 * which allows user data to be passed to the callback function (useful
285 * You must make sure that GStreamer has been initialised (with gst_init() or
286 * via gst_init_get_option_group()) before calling this function.
288 * Returns: TRUE if the plugin was registered correctly, otherwise FALSE.
294 gst_plugin_register_static_full (gint major_version, gint minor_version,
295 const gchar * name, const gchar * description,
296 GstPluginInitFullFunc init_full_func, const gchar * version,
297 const gchar * license, const gchar * source, const gchar * package,
298 const gchar * origin, gpointer user_data)
300 GstPluginDesc desc = { major_version, minor_version, name, description,
301 (GstPluginInitFunc) init_full_func, version, license, source, package,
305 gboolean res = FALSE;
307 g_return_val_if_fail (name != NULL, FALSE);
308 g_return_val_if_fail (description != NULL, FALSE);
309 g_return_val_if_fail (init_full_func != NULL, FALSE);
310 g_return_val_if_fail (version != NULL, FALSE);
311 g_return_val_if_fail (license != NULL, FALSE);
312 g_return_val_if_fail (source != NULL, FALSE);
313 g_return_val_if_fail (package != NULL, FALSE);
314 g_return_val_if_fail (origin != NULL, FALSE);
316 /* make sure gst_init() has been called */
317 g_return_val_if_fail (_gst_plugin_inited != FALSE, FALSE);
319 GST_LOG ("attempting to load static plugin \"%s\" now...", name);
320 plugin = g_object_newv (GST_TYPE_PLUGIN, 0, NULL);
321 if (gst_plugin_register_func (plugin, &desc, user_data) != NULL) {
322 GST_INFO ("registered static plugin \"%s\"", name);
323 res = gst_default_registry_add_plugin (plugin);
324 GST_INFO ("added static plugin \"%s\", result: %d", name, res);
330 _gst_plugin_initialize (void)
334 _gst_plugin_inited = TRUE;
336 /* now register all static plugins */
337 GST_INFO ("registering %u static plugins", _num_static_plugins);
338 for (i = 0; i < _num_static_plugins; ++i) {
339 gst_plugin_register_static (_static_plugins[i].major_version,
340 _static_plugins[i].minor_version, _static_plugins[i].name,
341 _static_plugins[i].description, _static_plugins[i].plugin_init,
342 _static_plugins[i].version, _static_plugins[i].license,
343 _static_plugins[i].source, _static_plugins[i].package,
344 _static_plugins[i].origin);
347 if (_static_plugins) {
348 free (_static_plugins);
349 _static_plugins = NULL;
350 _num_static_plugins = 0;
354 /* this function could be extended to check if the plugin license matches the
355 * applications license (would require the app to register its license somehow).
356 * We'll wait for someone who's interested in it to code it :)
359 gst_plugin_check_license (const gchar * license)
361 const gchar **check_license = valid_licenses;
363 g_assert (check_license);
365 while (*check_license) {
366 if (strcmp (license, *check_license) == 0)
374 gst_plugin_check_version (gint major, gint minor)
376 /* return NULL if the major and minor version numbers are not compatible */
378 if (major != GST_VERSION_MAJOR || minor != GST_VERSION_MINOR)
385 gst_plugin_register_func (GstPlugin * plugin, const GstPluginDesc * desc,
388 if (!gst_plugin_check_version (desc->major_version, desc->minor_version)) {
390 GST_WARNING ("plugin \"%s\" has incompatible version, not loading",
395 if (!desc->license || !desc->description || !desc->source ||
396 !desc->package || !desc->origin) {
398 GST_WARNING ("plugin \"%s\" has incorrect GstPluginDesc, not loading",
403 if (!gst_plugin_check_license (desc->license)) {
405 GST_WARNING ("plugin \"%s\" has invalid license \"%s\", not loading",
406 plugin->filename, desc->license);
411 GST_LOG ("plugin \"%s\" looks good", GST_STR_NULL (plugin->filename));
413 gst_plugin_desc_copy (&plugin->desc, desc);
416 if (!(((GstPluginInitFullFunc) (desc->plugin_init)) (plugin, user_data))) {
418 GST_WARNING ("plugin \"%s\" failed to initialise", plugin->filename);
419 plugin->module = NULL;
423 if (!((desc->plugin_init) (plugin))) {
425 GST_WARNING ("plugin \"%s\" failed to initialise", plugin->filename);
426 plugin->module = NULL;
432 GST_LOG ("plugin \"%s\" initialised", GST_STR_NULL (plugin->filename));
437 #ifdef HAVE_SIGACTION
438 static struct sigaction oldaction;
439 static gboolean _gst_plugin_fault_handler_is_setup = FALSE;
442 * _gst_plugin_fault_handler_restore:
443 * segfault handler restorer
446 _gst_plugin_fault_handler_restore (void)
448 if (!_gst_plugin_fault_handler_is_setup)
451 _gst_plugin_fault_handler_is_setup = FALSE;
453 sigaction (SIGSEGV, &oldaction, NULL);
457 * _gst_plugin_fault_handler_sighandler:
458 * segfault handler implementation
461 _gst_plugin_fault_handler_sighandler (int signum)
463 /* We need to restore the fault handler or we'll keep getting it */
464 _gst_plugin_fault_handler_restore ();
468 g_print ("\nERROR: ");
469 g_print ("Caught a segmentation fault while loading plugin file:\n");
470 g_print ("%s\n\n", _gst_plugin_fault_handler_filename);
471 g_print ("Please either:\n");
472 g_print ("- remove it and restart.\n");
473 g_print ("- run with --gst-disable-segtrap and debug.\n");
477 g_print ("Caught unhandled signal on plugin loading\n");
483 * _gst_plugin_fault_handler_setup:
484 * sets up the segfault handler
487 _gst_plugin_fault_handler_setup (void)
489 struct sigaction action;
491 /* if asked to leave segfaults alone, just return */
492 if (!gst_segtrap_is_enabled ())
495 if (_gst_plugin_fault_handler_is_setup)
498 _gst_plugin_fault_handler_is_setup = TRUE;
500 memset (&action, 0, sizeof (action));
501 action.sa_handler = _gst_plugin_fault_handler_sighandler;
503 sigaction (SIGSEGV, &action, &oldaction);
505 #else /* !HAVE_SIGACTION */
507 _gst_plugin_fault_handler_restore (void)
512 _gst_plugin_fault_handler_setup (void)
515 #endif /* HAVE_SIGACTION */
517 static GStaticMutex gst_plugin_loading_mutex = G_STATIC_MUTEX_INIT;
519 #define CHECK_PLUGIN_DESC_FIELD(desc,field,fn) \
520 if (G_UNLIKELY ((desc)->field == NULL)) { \
521 GST_ERROR ("GstPluginDesc for '%s' has no %s", fn, G_STRINGIFY (field)); \
525 * gst_plugin_load_file:
526 * @filename: the plugin filename to load
527 * @error: pointer to a NULL-valued GError
529 * Loads the given plugin and refs it. Caller needs to unref after use.
531 * Returns: a reference to the existing loaded GstPlugin, a reference to the
532 * newly-loaded GstPlugin, or NULL if an error occurred.
535 gst_plugin_load_file (const gchar * filename, GError ** error)
541 struct stat file_status;
542 GstRegistry *registry;
543 gboolean new_plugin = TRUE;
545 g_return_val_if_fail (filename != NULL, NULL);
547 registry = gst_registry_get_default ();
548 g_static_mutex_lock (&gst_plugin_loading_mutex);
550 plugin = gst_registry_lookup (registry, filename);
552 if (plugin->module) {
554 g_static_mutex_unlock (&gst_plugin_loading_mutex);
557 /* load plugin and update fields */
562 GST_CAT_DEBUG (GST_CAT_PLUGIN_LOADING, "attempt to load plugin \"%s\"",
565 if (g_module_supported () == FALSE) {
566 GST_CAT_DEBUG (GST_CAT_PLUGIN_LOADING, "module loading not supported");
569 GST_PLUGIN_ERROR_MODULE, "Dynamic loading not supported");
573 if (g_stat (filename, &file_status)) {
574 GST_CAT_DEBUG (GST_CAT_PLUGIN_LOADING, "problem accessing file");
577 GST_PLUGIN_ERROR_MODULE, "Problem accessing file %s: %s", filename,
582 module = g_module_open (filename, G_MODULE_BIND_LOCAL);
583 if (module == NULL) {
584 GST_CAT_WARNING (GST_CAT_PLUGIN_LOADING, "module_open failed: %s",
587 GST_PLUGIN_ERROR, GST_PLUGIN_ERROR_MODULE, "Opening module failed: %s",
589 /* If we failed to open the shared object, then it's probably because a
590 * plugin is linked against the wrong libraries. Print out an easy-to-see
591 * message in this case. */
592 g_warning ("Failed to load plugin '%s': %s", filename, g_module_error ());
597 plugin = g_object_newv (GST_TYPE_PLUGIN, 0, NULL);
598 plugin->file_mtime = file_status.st_mtime;
599 plugin->file_size = file_status.st_size;
600 plugin->filename = g_strdup (filename);
601 plugin->basename = g_path_get_basename (filename);
603 plugin->module = module;
605 ret = g_module_symbol (module, "gst_plugin_desc", &ptr);
607 GST_DEBUG ("Could not find plugin entry point in \"%s\"", filename);
610 GST_PLUGIN_ERROR_MODULE,
611 "File \"%s\" is not a GStreamer plugin", filename);
612 g_module_close (module);
615 plugin->orig_desc = (GstPluginDesc *) ptr;
618 /* check plugin description: complain about bad values but accept them, to
619 * maintain backwards compatibility (FIXME: 0.11) */
620 CHECK_PLUGIN_DESC_FIELD (plugin->orig_desc, name, filename);
621 CHECK_PLUGIN_DESC_FIELD (plugin->orig_desc, description, filename);
622 CHECK_PLUGIN_DESC_FIELD (plugin->orig_desc, version, filename);
623 CHECK_PLUGIN_DESC_FIELD (plugin->orig_desc, license, filename);
624 CHECK_PLUGIN_DESC_FIELD (plugin->orig_desc, source, filename);
625 CHECK_PLUGIN_DESC_FIELD (plugin->orig_desc, package, filename);
626 CHECK_PLUGIN_DESC_FIELD (plugin->orig_desc, origin, filename);
629 GST_LOG ("Plugin %p for file \"%s\" prepared, calling entry function...",
632 /* this is where we load the actual .so, so let's trap SIGSEGV */
633 _gst_plugin_fault_handler_setup ();
634 _gst_plugin_fault_handler_filename = plugin->filename;
636 GST_LOG ("Plugin %p for file \"%s\" prepared, registering...",
639 if (!gst_plugin_register_func (plugin, plugin->orig_desc, NULL)) {
640 /* remove signal handler */
641 _gst_plugin_fault_handler_restore ();
642 GST_DEBUG ("gst_plugin_register_func failed for plugin \"%s\"", filename);
646 GST_PLUGIN_ERROR_MODULE,
647 "File \"%s\" appears to be a GStreamer plugin, but it failed to initialize",
649 g_module_close (module);
653 /* remove signal handler */
654 _gst_plugin_fault_handler_restore ();
655 _gst_plugin_fault_handler_filename = NULL;
656 GST_INFO ("plugin \"%s\" loaded", plugin->filename);
659 gst_object_ref (plugin);
660 gst_default_registry_add_plugin (plugin);
663 g_static_mutex_unlock (&gst_plugin_loading_mutex);
669 gst_object_unref (plugin);
670 g_static_mutex_unlock (&gst_plugin_loading_mutex);
676 gst_plugin_desc_copy (GstPluginDesc * dest, const GstPluginDesc * src)
678 dest->major_version = src->major_version;
679 dest->minor_version = src->minor_version;
680 dest->name = g_intern_string (src->name);
681 dest->description = g_intern_string (src->description);
682 dest->plugin_init = src->plugin_init;
683 dest->version = g_intern_string (src->version);
684 dest->license = g_intern_string (src->license);
685 dest->source = g_intern_string (src->source);
686 dest->package = g_intern_string (src->package);
687 dest->origin = g_intern_string (src->origin);
691 * gst_plugin_get_name:
692 * @plugin: plugin to get the name of
694 * Get the short name of the plugin
696 * Returns: the name of the plugin
699 gst_plugin_get_name (GstPlugin * plugin)
701 g_return_val_if_fail (plugin != NULL, NULL);
703 return plugin->desc.name;
707 * gst_plugin_get_description:
708 * @plugin: plugin to get long name of
710 * Get the long descriptive name of the plugin
712 * Returns: the long name of the plugin
714 G_CONST_RETURN gchar *
715 gst_plugin_get_description (GstPlugin * plugin)
717 g_return_val_if_fail (plugin != NULL, NULL);
719 return plugin->desc.description;
723 * gst_plugin_get_filename:
724 * @plugin: plugin to get the filename of
726 * get the filename of the plugin
728 * Returns: the filename of the plugin
730 G_CONST_RETURN gchar *
731 gst_plugin_get_filename (GstPlugin * plugin)
733 g_return_val_if_fail (plugin != NULL, NULL);
735 return plugin->filename;
739 * gst_plugin_get_version:
740 * @plugin: plugin to get the version of
742 * get the version of the plugin
744 * Returns: the version of the plugin
746 G_CONST_RETURN gchar *
747 gst_plugin_get_version (GstPlugin * plugin)
749 g_return_val_if_fail (plugin != NULL, NULL);
751 return plugin->desc.version;
755 * gst_plugin_get_license:
756 * @plugin: plugin to get the license of
758 * get the license of the plugin
760 * Returns: the license of the plugin
762 G_CONST_RETURN gchar *
763 gst_plugin_get_license (GstPlugin * plugin)
765 g_return_val_if_fail (plugin != NULL, NULL);
767 return plugin->desc.license;
771 * gst_plugin_get_source:
772 * @plugin: plugin to get the source of
774 * get the source module the plugin belongs to.
776 * Returns: the source of the plugin
778 G_CONST_RETURN gchar *
779 gst_plugin_get_source (GstPlugin * plugin)
781 g_return_val_if_fail (plugin != NULL, NULL);
783 return plugin->desc.source;
787 * gst_plugin_get_package:
788 * @plugin: plugin to get the package of
790 * get the package the plugin belongs to.
792 * Returns: the package of the plugin
794 G_CONST_RETURN gchar *
795 gst_plugin_get_package (GstPlugin * plugin)
797 g_return_val_if_fail (plugin != NULL, NULL);
799 return plugin->desc.package;
803 * gst_plugin_get_origin:
804 * @plugin: plugin to get the origin of
806 * get the URL where the plugin comes from
808 * Returns: the origin of the plugin
810 G_CONST_RETURN gchar *
811 gst_plugin_get_origin (GstPlugin * plugin)
813 g_return_val_if_fail (plugin != NULL, NULL);
815 return plugin->desc.origin;
819 * gst_plugin_get_module:
820 * @plugin: plugin to query
822 * Gets the #GModule of the plugin. If the plugin isn't loaded yet, NULL is
825 * Returns: module belonging to the plugin or NULL if the plugin isn't
829 gst_plugin_get_module (GstPlugin * plugin)
831 g_return_val_if_fail (plugin != NULL, NULL);
833 return plugin->module;
837 * gst_plugin_is_loaded:
838 * @plugin: plugin to query
840 * queries if the plugin is loaded into memory
842 * Returns: TRUE is loaded, FALSE otherwise
845 gst_plugin_is_loaded (GstPlugin * plugin)
847 g_return_val_if_fail (plugin != NULL, FALSE);
849 return (plugin->module != NULL || plugin->filename == NULL);
853 * gst_plugin_get_cache_data:
856 * Gets the plugin specific data cache. If it is %NULL there is no cached data
857 * stored. This is the case when the registry is getting rebuilt.
859 * Returns: The cached data as a #GstStructure or %NULL.
863 G_CONST_RETURN GstStructure *
864 gst_plugin_get_cache_data (GstPlugin * plugin)
866 g_return_val_if_fail (GST_IS_PLUGIN (plugin), NULL);
868 return plugin->priv->cache_data;
872 * gst_plugin_set_cache_data:
874 * @cache_data: a structure containing the data to cache
876 * Adds plugin specific data to cache. Passes the ownership of the structure to
879 * The cache is flushed every time the registry is rebuilt.
884 gst_plugin_set_cache_data (GstPlugin * plugin, GstStructure * cache_data)
886 g_return_if_fail (GST_IS_PLUGIN (plugin));
887 g_return_if_fail (GST_IS_STRUCTURE (cache_data));
889 if (plugin->priv->cache_data) {
890 gst_structure_free (plugin->priv->cache_data);
892 plugin->priv->cache_data = cache_data;
897 * gst_plugin_feature_list:
898 * @plugin: plugin to query
899 * @filter: the filter to use
900 * @first: only return first match
901 * @user_data: user data passed to the filter function
903 * Runs a filter against all plugin features and returns a GList with
904 * the results. If the first flag is set, only the first match is
905 * returned (as a list with a single object).
907 * Returns: a GList of features, g_list_free after use.
910 gst_plugin_feature_filter (GstPlugin * plugin,
911 GstPluginFeatureFilter filter, gboolean first, gpointer user_data)
916 list = gst_filter_run (plugin->features, (GstFilterFunc) filter, first,
918 for (g = list; g; g = g->next) {
919 gst_object_ref (plugin);
927 GstPluginFeatureFilter filter;
935 _feature_filter (GstPlugin * plugin, gpointer user_data)
938 FeatureFilterData *data = (FeatureFilterData *) user_data;
940 result = gst_plugin_feature_filter (plugin, data->filter, data->first,
943 data->result = g_list_concat (data->result, result);
950 * gst_plugin_list_feature_filter:
951 * @list: a #GList of plugins to query
952 * @filter: the filter function to use
953 * @first: only return first match
954 * @user_data: user data passed to the filter function
956 * Runs a filter against all plugin features of the plugins in the given
957 * list and returns a GList with the results.
958 * If the first flag is set, only the first match is
959 * returned (as a list with a single object).
961 * Returns: a GList of features, g_list_free after use.
964 gst_plugin_list_feature_filter (GList * list,
965 GstPluginFeatureFilter filter, gboolean first, gpointer user_data)
967 FeatureFilterData data;
970 data.filter = filter;
972 data.user_data = user_data;
975 result = gst_filter_run (list, (GstFilterFunc) _feature_filter, first, &data);
976 g_list_free (result);
983 * gst_plugin_name_filter:
984 * @plugin: the plugin to check
985 * @name: the name of the plugin
987 * A standard filter that returns TRUE when the plugin is of the
990 * Returns: TRUE if the plugin is of the given name.
993 gst_plugin_name_filter (GstPlugin * plugin, const gchar * name)
995 return (plugin->desc.name && !strcmp (plugin->desc.name, name));
1000 * gst_plugin_find_feature:
1001 * @plugin: plugin to get the feature from
1002 * @name: The name of the feature to find
1003 * @type: The type of the feature to find
1005 * Find a feature of the given name and type in the given plugin.
1007 * Returns: a GstPluginFeature or NULL if the feature was not found.
1010 gst_plugin_find_feature (GstPlugin * plugin, const gchar * name, GType type)
1013 GstPluginFeature *result = NULL;
1014 GstTypeNameData data;
1016 g_return_val_if_fail (name != NULL, NULL);
1021 walk = gst_filter_run (plugin->features,
1022 (GstFilterFunc) gst_plugin_feature_type_name_filter, TRUE, &data);
1025 result = GST_PLUGIN_FEATURE (walk->data);
1027 gst_object_ref (result);
1028 gst_plugin_feature_list_free (walk);
1037 gst_plugin_feature_name_filter (GstPluginFeature * feature, const gchar * name)
1039 return !strcmp (name, GST_PLUGIN_FEATURE_NAME (feature));
1045 * gst_plugin_find_feature_by_name:
1046 * @plugin: plugin to get the feature from
1047 * @name: The name of the feature to find
1049 * Find a feature of the given name in the given plugin.
1051 * Returns: a GstPluginFeature or NULL if the feature was not found.
1054 gst_plugin_find_feature_by_name (GstPlugin * plugin, const gchar * name)
1057 GstPluginFeature *result = NULL;
1059 g_return_val_if_fail (name != NULL, NULL);
1061 walk = gst_filter_run (plugin->features,
1062 (GstFilterFunc) gst_plugin_feature_name_filter, TRUE, (void *) name);
1065 result = GST_PLUGIN_FEATURE (walk->data);
1067 gst_object_ref (result);
1068 gst_plugin_feature_list_free (walk);
1076 * gst_plugin_load_by_name:
1077 * @name: name of plugin to load
1079 * Load the named plugin. Refs the plugin.
1081 * Returns: A reference to a loaded plugin, or NULL on error.
1084 gst_plugin_load_by_name (const gchar * name)
1086 GstPlugin *plugin, *newplugin;
1087 GError *error = NULL;
1089 GST_DEBUG ("looking up plugin %s in default registry", name);
1090 plugin = gst_registry_find_plugin (gst_registry_get_default (), name);
1092 GST_DEBUG ("loading plugin %s from file %s", name, plugin->filename);
1093 newplugin = gst_plugin_load_file (plugin->filename, &error);
1094 gst_object_unref (plugin);
1097 GST_WARNING ("load_plugin error: %s", error->message);
1098 g_error_free (error);
1101 /* newplugin was reffed by load_file */
1105 GST_DEBUG ("Could not find plugin %s in registry", name);
1111 * @plugin: plugin to load
1113 * Loads @plugin. Note that the *return value* is the loaded plugin; @plugin is
1114 * untouched. The normal use pattern of this function goes like this:
1117 * GstPlugin *loaded_plugin;
1118 * loaded_plugin = gst_plugin_load (plugin);
1119 * // presumably, we're no longer interested in the potentially-unloaded plugin
1120 * gst_object_unref (plugin);
1121 * plugin = loaded_plugin;
1124 * Returns: A reference to a loaded plugin, or NULL on error.
1127 gst_plugin_load (GstPlugin * plugin)
1129 GError *error = NULL;
1130 GstPlugin *newplugin;
1132 if (gst_plugin_is_loaded (plugin)) {
1136 if (!(newplugin = gst_plugin_load_file (plugin->filename, &error)))
1143 GST_WARNING ("load_plugin error: %s", error->message);
1144 g_error_free (error);
1150 * gst_plugin_list_free:
1151 * @list: list of #GstPlugin
1153 * Unrefs each member of @list, then frees the list.
1156 gst_plugin_list_free (GList * list)
1160 for (g = list; g; g = g->next) {
1161 gst_object_unref (GST_PLUGIN_CAST (g->data));
1166 /* ===== plugin dependencies ===== */
1169 * ENV + xyz where ENV can contain multiple values separated by SEPARATOR
1170 * xyz may be "" (if ENV contains path to file rather than dir)
1171 * ENV + *xyz same as above, but xyz acts as suffix filter
1172 * ENV + xyz* same as above, but xyz acts as prefix filter (is this needed?)
1173 * ENV + *xyz* same as above, but xyz acts as strstr filter (is this needed?)
1175 * same as above, with additional paths hard-coded at compile-time:
1176 * - only check paths + ... if ENV is not set or yields not paths
1177 * - always check paths + ... in addition to ENV
1179 * When user specifies set of environment variables, he/she may also use e.g.
1180 * "HOME/.mystuff/plugins", and we'll expand the content of $HOME with the
1184 /* we store in registry:
1187 * - environment variables (array of strings)
1188 * - last hash of env variable contents (uint) (so we can avoid doing stats
1189 * if one of the env vars has changed; premature optimisation galore)
1190 * - hard-coded paths (array of strings)
1191 * - xyz filename/suffix/prefix strings (array of strings)
1193 * - last hash of file/dir stats (int)
1195 * (= struct GstPluginDep)
1199 gst_plugin_ext_dep_get_env_vars_hash (GstPlugin * plugin, GstPluginDep * dep)
1204 /* there's no deeper logic to what we do here; all we want to know (when
1205 * checking if the plugin needs to be rescanned) is whether the content of
1206 * one of the environment variables in the list is different from when it
1207 * was last scanned */
1209 for (e = dep->env_vars; e != NULL && *e != NULL; ++e) {
1213 /* order matters: "val",NULL needs to yield a different hash than
1214 * NULL,"val", so do a shift here whether the var is set or not */
1217 /* want environment variable at beginning of string */
1218 if (!g_ascii_isalnum (**e)) {
1219 GST_WARNING_OBJECT (plugin, "string prefix is not a valid environment "
1220 "variable string: %s", *e);
1224 /* user is allowed to specify e.g. "HOME/.pitivi/plugins" */
1225 g_strlcpy (env_var, *e, sizeof (env_var));
1226 g_strdelimit (env_var, "/\\", '\0');
1228 if ((val = g_getenv (env_var)))
1229 hash += g_str_hash (val);
1236 _priv_plugin_deps_env_vars_changed (GstPlugin * plugin)
1240 for (l = plugin->priv->deps; l != NULL; l = l->next) {
1241 GstPluginDep *dep = l->data;
1243 if (dep->env_hash != gst_plugin_ext_dep_get_env_vars_hash (plugin, dep))
1251 gst_plugin_ext_dep_extract_env_vars_paths (GstPlugin * plugin,
1255 GList *paths = NULL;
1257 for (evars = dep->env_vars; evars != NULL && *evars != NULL; ++evars) {
1261 /* want environment variable at beginning of string */
1262 if (!g_ascii_isalnum (**evars)) {
1263 GST_WARNING_OBJECT (plugin, "string prefix is not a valid environment "
1264 "variable string: %s", *evars);
1268 /* user is allowed to specify e.g. "HOME/.pitivi/plugins", which we want to
1269 * split into the env_var name component and the path component */
1270 components = g_strsplit_set (*evars, "/\\", 2);
1271 g_assert (components != NULL);
1273 e = g_getenv (components[0]);
1274 GST_LOG_OBJECT (plugin, "expanding %s = '%s' (path suffix: %s)",
1275 components[0], GST_STR_NULL (e), GST_STR_NULL (components[1]));
1277 if (components[1] != NULL) {
1278 g_strdelimit (components[1], "/\\", G_DIR_SEPARATOR);
1281 if (e != NULL && *e != '\0') {
1285 arr = g_strsplit (e, G_SEARCHPATH_SEPARATOR_S, -1);
1287 for (i = 0; arr != NULL && arr[i] != NULL; ++i) {
1290 if (!g_path_is_absolute (arr[i])) {
1291 GST_INFO_OBJECT (plugin, "ignoring environment variable content '%s'"
1292 ": either not an absolute path or not a path at all", arr[i]);
1296 if (components[1] != NULL) {
1297 full_path = g_build_filename (arr[i], components[1], NULL);
1299 full_path = g_strdup (arr[i]);
1302 if (!g_list_find_custom (paths, full_path, (GCompareFunc) strcmp)) {
1303 GST_LOG_OBJECT (plugin, "path: '%s'", full_path);
1304 paths = g_list_prepend (paths, full_path);
1307 GST_LOG_OBJECT (plugin, "path: '%s' (duplicate,ignoring)", full_path);
1315 g_strfreev (components);
1318 GST_LOG_OBJECT (plugin, "Extracted %d paths from environment",
1319 g_list_length (paths));
1325 gst_plugin_ext_dep_get_hash_from_stat_entry (struct stat *s)
1327 if (!(s->st_mode & (S_IFDIR | S_IFREG)))
1330 /* completely random formula */
1331 return ((s->st_size << 3) + (s->st_mtime << 5)) ^ s->st_ctime;
1335 gst_plugin_ext_dep_direntry_matches (GstPlugin * plugin, const gchar * entry,
1336 const gchar ** filenames, GstPluginDependencyFlags flags)
1338 /* no filenames specified, match all entries for now (could probably
1339 * optimise by just taking the dir stat hash or so) */
1340 if (filenames == NULL || *filenames == NULL || **filenames == '\0')
1343 while (*filenames != NULL) {
1345 if (((flags & GST_PLUGIN_DEPENDENCY_FLAG_FILE_NAME_IS_SUFFIX)) &&
1346 g_str_has_suffix (entry, *filenames)) {
1348 /* else it's an exact match that's needed */
1349 } else if (strcmp (entry, *filenames) == 0) {
1352 GST_LOG ("%s does not match %s, flags=0x%04x", entry, *filenames, flags);
1359 gst_plugin_ext_dep_scan_dir_and_match_names (GstPlugin * plugin,
1360 const gchar * path, const gchar ** filenames,
1361 GstPluginDependencyFlags flags, int depth)
1364 gboolean recurse_dirs;
1369 recurse_dirs = !!(flags & GST_PLUGIN_DEPENDENCY_FLAG_RECURSE);
1371 dir = g_dir_open (path, 0, &err);
1373 GST_DEBUG_OBJECT (plugin, "g_dir_open(%s) failed: %s", path, err->message);
1378 /* FIXME: we're assuming here that we always get the directory entries in
1379 * the same order, and not in a random order */
1380 while ((entry = g_dir_read_name (dir))) {
1381 gboolean have_match;
1387 gst_plugin_ext_dep_direntry_matches (plugin, entry, filenames, flags);
1389 /* avoid the stat if possible */
1390 if (!have_match && !recurse_dirs)
1393 full_path = g_build_filename (path, entry, NULL);
1394 if (g_stat (full_path, &s) < 0) {
1395 fhash = (guint) - 1;
1396 GST_LOG_OBJECT (plugin, "stat: %s (error: %s)", full_path,
1397 g_strerror (errno));
1398 } else if (have_match) {
1399 fhash = gst_plugin_ext_dep_get_hash_from_stat_entry (&s);
1400 GST_LOG_OBJECT (plugin, "stat: %s (result: %u)", full_path, fhash);
1401 } else if ((s.st_mode & (S_IFDIR))) {
1402 fhash = gst_plugin_ext_dep_scan_dir_and_match_names (plugin, full_path,
1403 filenames, flags, depth + 1);
1405 /* it's not a name match, we want to recurse, but it's not a directory */
1410 hash = (hash + fhash) << 1;
1419 gst_plugin_ext_dep_scan_path_with_filenames (GstPlugin * plugin,
1420 const gchar * path, const gchar ** filenames,
1421 GstPluginDependencyFlags flags)
1423 const gchar *empty_filenames[] = { "", NULL };
1424 gboolean recurse_into_dirs, partial_names;
1427 /* to avoid special-casing below (FIXME?) */
1428 if (filenames == NULL || *filenames == NULL)
1429 filenames = empty_filenames;
1431 recurse_into_dirs = !!(flags & GST_PLUGIN_DEPENDENCY_FLAG_RECURSE);
1432 partial_names = !!(flags & GST_PLUGIN_DEPENDENCY_FLAG_FILE_NAME_IS_SUFFIX);
1434 /* if we can construct the exact paths to check with the data we have, just
1435 * stat them one by one; this is more efficient than opening the directory
1436 * and going through each entry to see if it matches one of our filenames. */
1437 if (!recurse_into_dirs && !partial_names) {
1438 for (i = 0; filenames[i] != NULL; ++i) {
1443 full_path = g_build_filename (path, filenames[i], NULL);
1444 if (g_stat (full_path, &s) < 0) {
1445 fhash = (guint) - 1;
1446 GST_LOG_OBJECT (plugin, "stat: %s (error: %s)", full_path,
1447 g_strerror (errno));
1449 fhash = gst_plugin_ext_dep_get_hash_from_stat_entry (&s);
1450 GST_LOG_OBJECT (plugin, "stat: %s (result: %08x)", full_path, fhash);
1452 hash = (hash + fhash) << 1;
1456 hash = gst_plugin_ext_dep_scan_dir_and_match_names (plugin, path,
1457 filenames, flags, 0);
1464 gst_plugin_ext_dep_get_stat_hash (GstPlugin * plugin, GstPluginDep * dep)
1466 gboolean paths_are_default_only;
1468 guint scan_hash = 0;
1470 GST_LOG_OBJECT (plugin, "start");
1472 paths_are_default_only =
1473 dep->flags & GST_PLUGIN_DEPENDENCY_FLAG_PATHS_ARE_DEFAULT_ONLY;
1475 scan_paths = gst_plugin_ext_dep_extract_env_vars_paths (plugin, dep);
1477 if (scan_paths == NULL || !paths_are_default_only) {
1480 for (paths = dep->paths; paths != NULL && *paths != NULL; ++paths) {
1481 const gchar *path = *paths;
1483 if (!g_list_find_custom (scan_paths, path, (GCompareFunc) strcmp)) {
1484 GST_LOG_OBJECT (plugin, "path: '%s'", path);
1485 scan_paths = g_list_prepend (scan_paths, g_strdup (path));
1487 GST_LOG_OBJECT (plugin, "path: '%s' (duplicate, ignoring)", path);
1492 /* not that the order really matters, but it makes debugging easier */
1493 scan_paths = g_list_reverse (scan_paths);
1495 while (scan_paths != NULL) {
1496 const gchar *path = scan_paths->data;
1498 scan_hash += gst_plugin_ext_dep_scan_path_with_filenames (plugin, path,
1499 (const gchar **) dep->names, dep->flags);
1500 scan_hash = scan_hash << 1;
1502 g_free (scan_paths->data);
1503 scan_paths = g_list_delete_link (scan_paths, scan_paths);
1506 GST_LOG_OBJECT (plugin, "done, scan_hash: %08x", scan_hash);
1511 _priv_plugin_deps_files_changed (GstPlugin * plugin)
1515 for (l = plugin->priv->deps; l != NULL; l = l->next) {
1516 GstPluginDep *dep = l->data;
1518 if (dep->stat_hash != gst_plugin_ext_dep_get_stat_hash (plugin, dep))
1526 gst_plugin_ext_dep_free (GstPluginDep * dep)
1528 g_strfreev (dep->env_vars);
1529 g_strfreev (dep->paths);
1530 g_strfreev (dep->names);
1535 gst_plugin_ext_dep_strv_equal (gchar ** arr1, gchar ** arr2)
1539 if (arr1 == NULL || arr2 == NULL)
1541 for (; *arr1 != NULL && *arr2 != NULL; ++arr1, ++arr2) {
1542 if (strcmp (*arr1, *arr2) != 0)
1545 return (*arr1 == *arr2);
1549 gst_plugin_ext_dep_equals (GstPluginDep * dep, const gchar ** env_vars,
1550 const gchar ** paths, const gchar ** names, GstPluginDependencyFlags flags)
1552 if (dep->flags != flags)
1555 return gst_plugin_ext_dep_strv_equal (dep->env_vars, (gchar **) env_vars) &&
1556 gst_plugin_ext_dep_strv_equal (dep->paths, (gchar **) paths) &&
1557 gst_plugin_ext_dep_strv_equal (dep->names, (gchar **) names);
1561 * gst_plugin_add_dependency:
1562 * @plugin: a #GstPlugin
1563 * @env_vars: NULL-terminated array of environent variables affecting the
1564 * feature set of the plugin (e.g. an environment variable containing
1565 * paths where to look for additional modules/plugins of a library),
1566 * or NULL. Environment variable names may be followed by a path component
1567 * which will be added to the content of the environment variable, e.g.
1568 * "HOME/.mystuff/plugins".
1569 * @paths: NULL-terminated array of directories/paths where dependent files
1571 * @names: NULL-terminated array of file names (or file name suffixes,
1572 * depending on @flags) to be used in combination with the paths from
1573 * @paths and/or the paths extracted from the environment variables in
1574 * @env_vars, or NULL.
1575 * @flags: optional flags, or #GST_PLUGIN_DEPENDENCY_FLAG_NONE
1577 * Make GStreamer aware of external dependencies which affect the feature
1578 * set of this plugin (ie. the elements or typefinders associated with it).
1580 * GStreamer will re-inspect plugins with external dependencies whenever any
1581 * of the external dependencies change. This is useful for plugins which wrap
1582 * other plugin systems, e.g. a plugin which wraps a plugin-based visualisation
1583 * library and makes visualisations available as GStreamer elements, or a
1584 * codec loader which exposes elements and/or caps dependent on what external
1585 * codec libraries are currently installed.
1590 gst_plugin_add_dependency (GstPlugin * plugin, const gchar ** env_vars,
1591 const gchar ** paths, const gchar ** names, GstPluginDependencyFlags flags)
1596 g_return_if_fail (GST_IS_PLUGIN (plugin));
1598 if ((env_vars == NULL || env_vars[0] == NULL) &&
1599 (paths == NULL || paths[0] == NULL)) {
1600 GST_DEBUG_OBJECT (plugin,
1601 "plugin registered empty dependency set. Ignoring");
1605 for (l = plugin->priv->deps; l != NULL; l = l->next) {
1606 if (gst_plugin_ext_dep_equals (l->data, env_vars, paths, names, flags)) {
1607 GST_LOG_OBJECT (plugin, "dependency already registered");
1612 dep = g_new0 (GstPluginDep, 1);
1614 dep->env_vars = g_strdupv ((gchar **) env_vars);
1615 dep->paths = g_strdupv ((gchar **) paths);
1616 dep->names = g_strdupv ((gchar **) names);
1619 dep->env_hash = gst_plugin_ext_dep_get_env_vars_hash (plugin, dep);
1620 dep->stat_hash = gst_plugin_ext_dep_get_stat_hash (plugin, dep);
1622 plugin->priv->deps = g_list_append (plugin->priv->deps, dep);
1624 GST_DEBUG_OBJECT (plugin, "added dependency:");
1625 for (; env_vars != NULL && *env_vars != NULL; ++env_vars)
1626 GST_DEBUG_OBJECT (plugin, " evar: %s", *env_vars);
1627 for (; paths != NULL && *paths != NULL; ++paths)
1628 GST_DEBUG_OBJECT (plugin, " path: %s", *paths);
1629 for (; names != NULL && *names != NULL; ++names)
1630 GST_DEBUG_OBJECT (plugin, " name: %s", *names);
1634 * gst_plugin_add_dependency_simple:
1635 * @plugin: the #GstPlugin
1636 * @env_vars: one or more environent variables (separated by ':', ';' or ','),
1637 * or NULL. Environment variable names may be followed by a path component
1638 * which will be added to the content of the environment variable, e.g.
1639 * "HOME/.mystuff/plugins:MYSTUFF_PLUGINS_PATH"
1640 * @paths: one ore more directory paths (separated by ':' or ';' or ','),
1641 * or NULL. Example: "/usr/lib/mystuff/plugins"
1642 * @names: one or more file names or file name suffixes (separated by commas),
1644 * @flags: optional flags, or #GST_PLUGIN_DEPENDENCY_FLAG_NONE
1646 * Make GStreamer aware of external dependencies which affect the feature
1647 * set of this plugin (ie. the elements or typefinders associated with it).
1649 * GStreamer will re-inspect plugins with external dependencies whenever any
1650 * of the external dependencies change. This is useful for plugins which wrap
1651 * other plugin systems, e.g. a plugin which wraps a plugin-based visualisation
1652 * library and makes visualisations available as GStreamer elements, or a
1653 * codec loader which exposes elements and/or caps dependent on what external
1654 * codec libraries are currently installed.
1656 * Convenience wrapper function for gst_plugin_add_dependency() which
1657 * takes simple strings as arguments instead of string arrays, with multiple
1658 * arguments separated by predefined delimiters (see above).
1663 gst_plugin_add_dependency_simple (GstPlugin * plugin,
1664 const gchar * env_vars, const gchar * paths, const gchar * names,
1665 GstPluginDependencyFlags flags)
1667 gchar **a_evars = NULL;
1668 gchar **a_paths = NULL;
1669 gchar **a_names = NULL;
1672 a_evars = g_strsplit_set (env_vars, ":;,", -1);
1674 a_paths = g_strsplit_set (paths, ":;,", -1);
1676 a_names = g_strsplit_set (names, ",", -1);
1678 gst_plugin_add_dependency (plugin, (const gchar **) a_evars,
1679 (const gchar **) a_paths, (const gchar **) a_names, flags);
1682 g_strfreev (a_evars);
1684 g_strfreev (a_paths);
1686 g_strfreev (a_names);