2 * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
3 * 2000 Wim Taymans <wtay@chello.be>
4 * 2005 David A. Schleef <ds@schleef.org>
6 * gstregistry.c: handle registry
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
18 * You should have received a copy of the GNU Library General Public
19 * License along with this library; if not, write to the
20 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 * Boston, MA 02111-1307, USA.
26 * @short_description: Abstract base class for management of #GstPlugin objects
27 * @see_also: #GstPlugin, #GstPluginFeature
29 * One registry holds the metadata of a set of plugins.
31 * <emphasis role="bold">Design:</emphasis>
33 * The #GstRegistry object is a list of plugins and some functions for dealing
34 * with them. Each #GstPlugin is matched 1-1 with a file on disk, and may or may
35 * not be loaded at a given time. There may be multiple #GstRegistry objects,
36 * but the "default registry" is the only object that has any meaning to the
39 * The registry file is actually a cache of plugin information. This is
40 * unlike versions prior to 0.10, where the registry file was the primary source
41 * of plugin information, and was created by the gst-register command.
43 * The primary source, at all times, of plugin information is each plugin file
44 * itself. Thus, if an application wants information about a particular plugin,
45 * or wants to search for a feature that satisfies given criteria, the primary
46 * means of doing so is to load every plugin and look at the resulting
47 * information that is gathered in the default registry. Clearly, this is a time
48 * consuming process, so we cache information in the registry file. The format
49 * and location of the cache file is internal to gstreamer.
51 * On startup, plugins are searched for in the plugin search path. The following
52 * locations are checked in this order:
55 * <para>location from --gst-plugin-path commandline option.</para>
58 * <para>the GST_PLUGIN_PATH environment variable.</para>
61 * <para>the GST_PLUGIN_SYSTEM_PATH environment variable.</para>
64 * <para>default locations (if GST_PLUGIN_SYSTEM_PATH is not set). Those
65 * default locations are:
66 * <filename>~/.gstreamer-$GST_MAJORMINOR/plugins/</filename>
67 * and <filename>$prefix/libs/gstreamer-$GST_MAJORMINOR/</filename>.
71 * The registry cache file is loaded from
72 * <filename>~/.gstreamer-$GST_MAJORMINOR/registry-$ARCH.bin</filename> or the
73 * file listed in the GST_REGISTRY env var. One reason to change the registry
74 * location is for testing.
76 * For each plugin that is found in the plugin search path, there could be 3
77 * possibilities for cached information:
80 * <para>the cache may not contain information about a given file.</para>
83 * <para>the cache may have stale information.</para>
86 * <para>the cache may have current information.</para>
90 * In the first two cases, the plugin is loaded and the cache updated. In
91 * addition to these cases, the cache may have entries for plugins that are not
92 * relevant to the current process. These are marked as not available to the
93 * current process. If the cache is updated for whatever reason, it is marked
96 * A dirty cache is written out at the end of initialization. Each entry is
97 * checked to make sure the information is minimally valid. If not, the entry is
100 * <emphasis role="bold">Implementation notes:</emphasis>
102 * The "cache" and "default registry" are different concepts and can represent
103 * different sets of plugins. For various reasons, at init time, the cache is
104 * stored in the default registry, and plugins not relevant to the current
105 * process are marked with the %GST_PLUGIN_FLAG_CACHED bit. These plugins are
106 * removed at the end of intitialization.
112 #include "gstconfig.h"
113 #include "gst_private.h"
115 #include <sys/types.h>
116 #include <sys/stat.h>
125 #include <glib/gstdio.h>
128 #include "gsterror.h"
129 #include "gstregistry.h"
130 #include "gstmarshal.h"
131 #include "gstfilter.h"
133 #include "gstpluginloader.h"
135 #include "gst-i18n-lib.h"
141 extern HMODULE _priv_gst_dll_handle;
144 #define GST_CAT_DEFAULT GST_CAT_REGISTRY
146 struct _GstRegistryPrivate
148 /* updated whenever the feature list changes */
150 /* speedup for searching features */
151 GList *element_factory_list;
153 GList *typefind_factory_list;
157 /* the one instance of the default registry and the mutex protecting the
159 static GStaticMutex _gst_registry_mutex = G_STATIC_MUTEX_INIT;
160 static GstRegistry *_gst_registry_default = NULL;
163 #define DEFAULT_FORK TRUE
165 /* control the behaviour of registry rebuild */
166 static gboolean _gst_enable_registry_fork = DEFAULT_FORK;
167 /* List of plugins that need preloading/reloading after scanning registry */
168 extern GSList *_priv_gst_preload_plugins;
170 #ifndef GST_DISABLE_REGISTRY
171 /*set to TRUE when registry needn't to be updated */
172 gboolean _priv_gst_disable_registry_update = FALSE;
173 extern GList *_priv_gst_plugin_paths;
175 /* Set to TRUE when the registry cache should be disabled */
176 gboolean _gst_disable_registry_cache = FALSE;
179 /* Element signals and args */
187 static void gst_registry_finalize (GObject * object);
189 static guint gst_registry_signals[LAST_SIGNAL] = { 0 };
191 static GstPluginFeature *gst_registry_lookup_feature_locked (GstRegistry *
192 registry, const char *name);
193 static GstPlugin *gst_registry_lookup_bn_locked (GstRegistry * registry,
194 const char *basename);
196 G_DEFINE_TYPE (GstRegistry, gst_registry, GST_TYPE_OBJECT);
197 static GstObjectClass *parent_class = NULL;
200 gst_registry_class_init (GstRegistryClass * klass)
202 GObjectClass *gobject_class;
204 gobject_class = (GObjectClass *) klass;
206 parent_class = g_type_class_peek_parent (klass);
207 g_type_class_add_private (klass, sizeof (GstRegistryPrivate));
210 * GstRegistry::plugin-added:
211 * @registry: the registry that emitted the signal
212 * @plugin: the plugin that has been added
214 * Signals that a plugin has been added to the registry (possibly
215 * replacing a previously-added one by the same name)
217 gst_registry_signals[PLUGIN_ADDED] =
218 g_signal_new ("plugin-added", G_TYPE_FROM_CLASS (klass),
219 G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstRegistryClass, plugin_added), NULL,
220 NULL, gst_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER);
223 * GstRegistry::feature-added:
224 * @registry: the registry that emitted the signal
225 * @feature: the feature that has been added
227 * Signals that a feature has been added to the registry (possibly
228 * replacing a previously-added one by the same name)
230 gst_registry_signals[FEATURE_ADDED] =
231 g_signal_new ("feature-added", G_TYPE_FROM_CLASS (klass),
232 G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstRegistryClass, feature_added),
233 NULL, NULL, gst_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER);
235 gobject_class->finalize = gst_registry_finalize;
239 gst_registry_init (GstRegistry * registry)
241 registry->feature_hash = g_hash_table_new (g_str_hash, g_str_equal);
242 registry->basename_hash = g_hash_table_new (g_str_hash, g_str_equal);
244 G_TYPE_INSTANCE_GET_PRIVATE (registry, GST_TYPE_REGISTRY,
249 gst_registry_finalize (GObject * object)
251 GstRegistry *registry = GST_REGISTRY (object);
255 plugins = registry->plugins;
256 registry->plugins = NULL;
258 GST_DEBUG_OBJECT (registry, "registry finalize");
261 GstPlugin *plugin = p->data;
264 GST_LOG_OBJECT (registry, "removing plugin %s",
265 gst_plugin_get_name (plugin));
266 gst_object_unref (plugin);
270 g_list_free (plugins);
272 features = registry->features;
273 registry->features = NULL;
277 GstPluginFeature *feature = f->data;
280 GST_LOG_OBJECT (registry, "removing feature %p (%s)",
281 feature, gst_plugin_feature_get_name (feature));
282 gst_object_unref (feature);
286 g_list_free (features);
288 g_hash_table_destroy (registry->feature_hash);
289 registry->feature_hash = NULL;
290 g_hash_table_destroy (registry->basename_hash);
291 registry->basename_hash = NULL;
293 if (registry->priv->element_factory_list) {
294 GST_DEBUG_OBJECT (registry, "Cleaning up cached element factory list");
295 gst_plugin_feature_list_free (registry->priv->element_factory_list);
298 if (registry->priv->typefind_factory_list) {
299 GST_DEBUG_OBJECT (registry, "Cleaning up cached typefind factory list");
300 gst_plugin_feature_list_free (registry->priv->typefind_factory_list);
303 G_OBJECT_CLASS (parent_class)->finalize (object);
307 * gst_registry_get_default:
309 * Retrieves the default registry. The caller does not own a reference on the
310 * registry, as it is alive as long as GStreamer is initialized.
312 * Returns: The default #GstRegistry.
315 gst_registry_get_default (void)
317 GstRegistry *registry;
319 g_static_mutex_lock (&_gst_registry_mutex);
320 if (G_UNLIKELY (!_gst_registry_default)) {
321 _gst_registry_default = g_object_newv (GST_TYPE_REGISTRY, 0, NULL);
322 gst_object_ref_sink (GST_OBJECT_CAST (_gst_registry_default));
324 registry = _gst_registry_default;
325 g_static_mutex_unlock (&_gst_registry_mutex);
331 * gst_registry_add_path:
332 * @registry: the registry to add the path to
333 * @path: the path to add to the registry
335 * Add the given path to the registry. The syntax of the
336 * path is specific to the registry. If the path has already been
340 gst_registry_add_path (GstRegistry * registry, const gchar * path)
342 g_return_if_fail (GST_IS_REGISTRY (registry));
343 g_return_if_fail (path != NULL);
345 if (strlen (path) == 0)
348 GST_OBJECT_LOCK (registry);
349 if (g_list_find_custom (registry->paths, path, (GCompareFunc) strcmp))
352 GST_INFO ("Adding plugin path: \"%s\"", path);
353 registry->paths = g_list_append (registry->paths, g_strdup (path));
354 GST_OBJECT_UNLOCK (registry);
360 GST_INFO ("Ignoring empty plugin path");
365 g_warning ("path %s already added to registry", path);
366 GST_OBJECT_UNLOCK (registry);
372 * gst_registry_get_path_list:
373 * @registry: the registry to get the pathlist of
375 * Get the list of paths for the given registry.
377 * Returns: A Glist of paths as strings. g_list_free after use.
382 gst_registry_get_path_list (GstRegistry * registry)
386 g_return_val_if_fail (GST_IS_REGISTRY (registry), NULL);
388 GST_OBJECT_LOCK (registry);
389 /* We don't need to copy the strings, because they won't be deleted
390 * as long as the GstRegistry is around */
391 list = g_list_copy (registry->paths);
392 GST_OBJECT_UNLOCK (registry);
399 * gst_registry_add_plugin:
400 * @registry: the registry to add the plugin to
401 * @plugin: the plugin to add
403 * Add the plugin to the registry. The plugin-added signal will be emitted.
404 * This function will sink @plugin.
406 * Returns: TRUE on success.
411 gst_registry_add_plugin (GstRegistry * registry, GstPlugin * plugin)
413 GstPlugin *existing_plugin;
415 g_return_val_if_fail (GST_IS_REGISTRY (registry), FALSE);
416 g_return_val_if_fail (GST_IS_PLUGIN (plugin), FALSE);
418 GST_OBJECT_LOCK (registry);
419 if (G_LIKELY (plugin->basename)) {
420 /* we have a basename, see if we find the plugin */
422 gst_registry_lookup_bn_locked (registry, plugin->basename);
423 if (existing_plugin) {
424 GST_DEBUG_OBJECT (registry,
425 "Replacing existing plugin %p with new plugin %p for filename \"%s\"",
426 existing_plugin, plugin, GST_STR_NULL (plugin->filename));
427 registry->plugins = g_list_remove (registry->plugins, existing_plugin);
428 if (G_LIKELY (existing_plugin->basename))
429 g_hash_table_remove (registry->basename_hash,
430 existing_plugin->basename);
431 gst_object_unref (existing_plugin);
435 GST_DEBUG_OBJECT (registry, "adding plugin %p for filename \"%s\"",
436 plugin, GST_STR_NULL (plugin->filename));
438 registry->plugins = g_list_prepend (registry->plugins, plugin);
439 if (G_LIKELY (plugin->basename))
440 g_hash_table_replace (registry->basename_hash, plugin->basename, plugin);
442 gst_object_ref_sink (plugin);
443 GST_OBJECT_UNLOCK (registry);
445 GST_LOG_OBJECT (registry, "emitting plugin-added for filename \"%s\"",
446 GST_STR_NULL (plugin->filename));
447 g_signal_emit (registry, gst_registry_signals[PLUGIN_ADDED], 0, plugin);
453 gst_registry_remove_features_for_plugin_unlocked (GstRegistry * registry,
459 g_return_if_fail (GST_IS_REGISTRY (registry));
460 g_return_if_fail (GST_IS_PLUGIN (plugin));
462 name = gst_plugin_get_name (plugin);
464 /* Remove all features for this plugin */
465 f = registry->features;
467 GList *next = g_list_next (f);
468 GstPluginFeature *feature = f->data;
470 if (G_UNLIKELY (feature && !strcmp (feature->plugin_name, name))) {
471 GST_DEBUG_OBJECT (registry, "removing feature %p (%s) for plugin %s",
472 feature, gst_plugin_feature_get_name (feature), name);
474 registry->features = g_list_delete_link (registry->features, f);
475 g_hash_table_remove (registry->feature_hash, feature->name);
476 gst_object_unref (feature);
480 registry->priv->cookie++;
484 * gst_registry_remove_plugin:
485 * @registry: the registry to remove the plugin from
486 * @plugin: the plugin to remove
488 * Remove the plugin from the registry.
493 gst_registry_remove_plugin (GstRegistry * registry, GstPlugin * plugin)
495 g_return_if_fail (GST_IS_REGISTRY (registry));
496 g_return_if_fail (GST_IS_PLUGIN (plugin));
498 GST_DEBUG_OBJECT (registry, "removing plugin %p (%s)",
499 plugin, gst_plugin_get_name (plugin));
501 GST_OBJECT_LOCK (registry);
502 registry->plugins = g_list_remove (registry->plugins, plugin);
503 if (G_LIKELY (plugin->basename))
504 g_hash_table_remove (registry->basename_hash, plugin->basename);
505 gst_registry_remove_features_for_plugin_unlocked (registry, plugin);
506 GST_OBJECT_UNLOCK (registry);
507 gst_object_unref (plugin);
511 * gst_registry_add_feature:
512 * @registry: the registry to add the plugin to
513 * @feature: the feature to add
515 * Add the feature to the registry. The feature-added signal will be emitted.
516 * This function sinks @feature.
518 * Returns: TRUE on success.
523 gst_registry_add_feature (GstRegistry * registry, GstPluginFeature * feature)
525 GstPluginFeature *existing_feature;
527 g_return_val_if_fail (GST_IS_REGISTRY (registry), FALSE);
528 g_return_val_if_fail (GST_IS_PLUGIN_FEATURE (feature), FALSE);
529 g_return_val_if_fail (feature->name != NULL, FALSE);
530 g_return_val_if_fail (feature->plugin_name != NULL, FALSE);
532 GST_OBJECT_LOCK (registry);
533 existing_feature = gst_registry_lookup_feature_locked (registry,
535 if (G_UNLIKELY (existing_feature)) {
536 GST_DEBUG_OBJECT (registry, "replacing existing feature %p (%s)",
537 existing_feature, feature->name);
538 /* Remove the existing feature from the list now, before we insert the new
539 * one, but don't unref yet because the hash is still storing a reference to
541 registry->features = g_list_remove (registry->features, existing_feature);
544 GST_DEBUG_OBJECT (registry, "adding feature %p (%s)", feature, feature->name);
546 registry->features = g_list_prepend (registry->features, feature);
547 g_hash_table_replace (registry->feature_hash, feature->name, feature);
549 if (G_UNLIKELY (existing_feature)) {
550 /* We unref now. No need to remove the feature name from the hash table, it
551 * got replaced by the new feature */
552 gst_object_unref (existing_feature);
555 gst_object_ref_sink (feature);
557 registry->priv->cookie++;
558 GST_OBJECT_UNLOCK (registry);
560 GST_LOG_OBJECT (registry, "emitting feature-added for %s", feature->name);
561 g_signal_emit (registry, gst_registry_signals[FEATURE_ADDED], 0, feature);
567 * gst_registry_remove_feature:
568 * @registry: the registry to remove the feature from
569 * @feature: the feature to remove
571 * Remove the feature from the registry.
576 gst_registry_remove_feature (GstRegistry * registry, GstPluginFeature * feature)
578 g_return_if_fail (GST_IS_REGISTRY (registry));
579 g_return_if_fail (GST_IS_PLUGIN_FEATURE (feature));
581 GST_DEBUG_OBJECT (registry, "removing feature %p (%s)",
582 feature, gst_plugin_feature_get_name (feature));
584 GST_OBJECT_LOCK (registry);
585 registry->features = g_list_remove (registry->features, feature);
586 g_hash_table_remove (registry->feature_hash, feature->name);
587 registry->priv->cookie++;
588 GST_OBJECT_UNLOCK (registry);
589 gst_object_unref (feature);
593 * gst_registry_plugin_filter:
594 * @registry: registry to query
595 * @filter: the filter to use
596 * @first: only return first match
597 * @user_data: user data passed to the filter function
599 * Runs a filter against all plugins in the registry and returns a #GList with
600 * the results. If the first flag is set, only the first match is
601 * returned (as a list with a single object).
602 * Every plugin is reffed; use gst_plugin_list_free() after use, which
605 * Returns: a #GList of #GstPlugin. Use gst_plugin_list_free() after usage.
610 gst_registry_plugin_filter (GstRegistry * registry,
611 GstPluginFilter filter, gboolean first, gpointer user_data)
616 g_return_val_if_fail (GST_IS_REGISTRY (registry), NULL);
618 GST_OBJECT_LOCK (registry);
619 list = gst_filter_run (registry->plugins, (GstFilterFunc) filter, first,
621 for (g = list; g; g = g->next) {
622 gst_object_ref (GST_PLUGIN_CAST (g->data));
624 GST_OBJECT_UNLOCK (registry);
629 /* returns TRUE if the list was changed
631 * Must be called with the object lock taken */
633 gst_registry_get_feature_list_or_create (GstRegistry * registry,
634 GList ** previous, guint32 * cookie, GType type)
636 gboolean res = FALSE;
637 GstRegistryPrivate *priv = registry->priv;
639 if (G_UNLIKELY (!*previous || priv->cookie != *cookie)) {
640 GstTypeNameData data;
643 gst_plugin_feature_list_free (*previous);
648 gst_filter_run (registry->features,
649 (GstFilterFunc) gst_plugin_feature_type_name_filter, FALSE, &data);
650 g_list_foreach (*previous, (GFunc) gst_object_ref, NULL);
651 *cookie = priv->cookie;
659 type_find_factory_rank_cmp (const GstPluginFeature * fac1,
660 const GstPluginFeature * fac2)
662 if (G_LIKELY (fac1->rank != fac2->rank))
663 return fac2->rank - fac1->rank;
665 /* to make the order in which things happen more deterministic,
666 * sort by name when the ranks are the same. */
667 return strcmp (fac1->name, fac2->name);
671 gst_registry_get_element_factory_list (GstRegistry * registry)
675 GST_OBJECT_LOCK (registry);
677 gst_registry_get_feature_list_or_create (registry,
678 ®istry->priv->element_factory_list, ®istry->priv->efl_cookie,
679 GST_TYPE_ELEMENT_FACTORY);
681 /* Return reffed copy */
682 list = gst_plugin_feature_list_copy (registry->priv->element_factory_list);
684 GST_OBJECT_UNLOCK (registry);
690 gst_registry_get_typefind_factory_list (GstRegistry * registry)
694 GST_OBJECT_LOCK (registry);
696 if (G_UNLIKELY (gst_registry_get_feature_list_or_create (registry,
697 ®istry->priv->typefind_factory_list,
698 ®istry->priv->tfl_cookie, GST_TYPE_TYPE_FIND_FACTORY)))
699 registry->priv->typefind_factory_list =
700 g_list_sort (registry->priv->typefind_factory_list,
701 (GCompareFunc) type_find_factory_rank_cmp);
703 /* Return reffed copy */
704 list = gst_plugin_feature_list_copy (registry->priv->typefind_factory_list);
706 GST_OBJECT_UNLOCK (registry);
712 * gst_registry_feature_filter:
713 * @registry: registry to query
714 * @filter: the filter to use
715 * @first: only return first match
716 * @user_data: user data passed to the filter function
718 * Runs a filter against all features of the plugins in the registry
719 * and returns a GList with the results.
720 * If the first flag is set, only the first match is
721 * returned (as a list with a single object).
723 * Returns: a #GList of #GstPluginFeature. Use gst_plugin_feature_list_free()
729 gst_registry_feature_filter (GstRegistry * registry,
730 GstPluginFeatureFilter filter, gboolean first, gpointer user_data)
735 g_return_val_if_fail (GST_IS_REGISTRY (registry), NULL);
737 GST_OBJECT_LOCK (registry);
738 list = gst_filter_run (registry->features, (GstFilterFunc) filter, first,
740 for (g = list; g; g = g->next) {
741 gst_object_ref (GST_PLUGIN_FEATURE_CAST (g->data));
743 GST_OBJECT_UNLOCK (registry);
749 * gst_registry_find_plugin:
750 * @registry: the registry to search
751 * @name: the plugin name to find
753 * Find the plugin with the given name in the registry.
754 * The plugin will be reffed; caller is responsible for unreffing.
756 * Returns: The plugin with the given name or NULL if the plugin was not found.
757 * gst_object_unref() after usage.
762 gst_registry_find_plugin (GstRegistry * registry, const gchar * name)
765 GstPlugin *result = NULL;
767 g_return_val_if_fail (GST_IS_REGISTRY (registry), NULL);
768 g_return_val_if_fail (name != NULL, NULL);
770 walk = gst_registry_plugin_filter (registry,
771 (GstPluginFilter) gst_plugin_name_filter, TRUE, (gpointer) name);
773 result = GST_PLUGIN_CAST (walk->data);
775 gst_object_ref (result);
776 gst_plugin_list_free (walk);
783 * gst_registry_find_feature:
784 * @registry: the registry to search
785 * @name: the pluginfeature name to find
786 * @type: the pluginfeature type to find
788 * Find the pluginfeature with the given name and type in the registry.
790 * Returns: The pluginfeature with the given name and type or NULL
791 * if the plugin was not found. gst_object_unref() after usage.
796 gst_registry_find_feature (GstRegistry * registry, const gchar * name,
799 GstPluginFeature *feature = NULL;
801 g_return_val_if_fail (GST_IS_REGISTRY (registry), NULL);
802 g_return_val_if_fail (name != NULL, NULL);
803 g_return_val_if_fail (g_type_is_a (type, GST_TYPE_PLUGIN_FEATURE), NULL);
805 feature = gst_registry_lookup_feature (registry, name);
806 if (feature && !g_type_is_a (G_TYPE_FROM_INSTANCE (feature), type)) {
807 gst_object_unref (feature);
815 * gst_registry_get_feature_list:
816 * @registry: a #GstRegistry
819 * Retrieves a #GList of #GstPluginFeature of @type.
821 * Returns: a #GList of #GstPluginFeature of @type. Use
822 * gst_plugin_feature_list_free() after usage.
827 gst_registry_get_feature_list (GstRegistry * registry, GType type)
829 GstTypeNameData data;
831 g_return_val_if_fail (GST_IS_REGISTRY (registry), NULL);
832 g_return_val_if_fail (g_type_is_a (type, GST_TYPE_PLUGIN_FEATURE), NULL);
835 if (type == GST_TYPE_ELEMENT_FACTORY)
836 return gst_registry_get_element_factory_list (registry);
837 else if (type == GST_TYPE_TYPE_FIND_FACTORY)
838 return gst_registry_get_typefind_factory_list (registry);
843 return gst_registry_feature_filter (registry,
844 (GstPluginFeatureFilter) gst_plugin_feature_type_name_filter,
849 * gst_registry_get_plugin_list:
850 * @registry: the registry to search
852 * Get a copy of all plugins registered in the given registry. The refcount
853 * of each element in the list in incremented.
855 * Returns: a #GList of #GstPlugin. Use gst_plugin_list_free() after usage.
860 gst_registry_get_plugin_list (GstRegistry * registry)
865 g_return_val_if_fail (GST_IS_REGISTRY (registry), NULL);
867 GST_OBJECT_LOCK (registry);
868 list = g_list_copy (registry->plugins);
869 for (g = list; g; g = g->next) {
870 gst_object_ref (GST_PLUGIN_CAST (g->data));
872 GST_OBJECT_UNLOCK (registry);
877 static GstPluginFeature *
878 gst_registry_lookup_feature_locked (GstRegistry * registry, const char *name)
880 return g_hash_table_lookup (registry->feature_hash, name);
884 * gst_registry_lookup_feature:
885 * @registry: a #GstRegistry
886 * @name: a #GstPluginFeature name
888 * Find a #GstPluginFeature with @name in @registry.
890 * Returns: a #GstPluginFeature with its refcount incremented, use
891 * gst_object_unref() after usage.
896 gst_registry_lookup_feature (GstRegistry * registry, const char *name)
898 GstPluginFeature *feature;
900 g_return_val_if_fail (GST_IS_REGISTRY (registry), NULL);
901 g_return_val_if_fail (name != NULL, NULL);
903 GST_OBJECT_LOCK (registry);
904 feature = gst_registry_lookup_feature_locked (registry, name);
906 gst_object_ref (feature);
907 GST_OBJECT_UNLOCK (registry);
913 gst_registry_lookup_bn_locked (GstRegistry * registry, const char *basename)
915 return g_hash_table_lookup (registry->basename_hash, basename);
919 gst_registry_lookup_bn (GstRegistry * registry, const char *basename)
923 GST_OBJECT_LOCK (registry);
924 plugin = gst_registry_lookup_bn_locked (registry, basename);
926 gst_object_ref (plugin);
927 GST_OBJECT_UNLOCK (registry);
933 * gst_registry_lookup:
934 * @registry: the registry to look up in
935 * @filename: the name of the file to look up
937 * Look up a plugin in the given registry with the given filename.
938 * If found, plugin is reffed.
940 * Returns: the #GstPlugin if found, or NULL if not. gst_object_unref()
944 gst_registry_lookup (GstRegistry * registry, const char *filename)
949 g_return_val_if_fail (GST_IS_REGISTRY (registry), NULL);
950 g_return_val_if_fail (filename != NULL, NULL);
952 basename = g_path_get_basename (filename);
953 if (G_UNLIKELY (basename == NULL))
956 plugin = gst_registry_lookup_bn (registry, basename);
965 REGISTRY_SCAN_HELPER_NOT_STARTED = 0,
966 REGISTRY_SCAN_HELPER_DISABLED,
967 REGISTRY_SCAN_HELPER_RUNNING
968 } GstRegistryScanHelperState;
972 GstRegistry *registry;
973 GstRegistryScanHelperState helper_state;
974 GstPluginLoader *helper;
976 } GstRegistryScanContext;
979 init_scan_context (GstRegistryScanContext * context, GstRegistry * registry)
983 context->registry = registry;
985 /* see if forking is enabled and set up the scan helper state accordingly */
986 do_fork = _gst_enable_registry_fork;
988 const gchar *fork_env;
990 /* forking enabled, see if it is disabled with an env var */
991 if ((fork_env = g_getenv ("GST_REGISTRY_FORK"))) {
992 /* fork enabled for any value different from "no" */
993 do_fork = strcmp (fork_env, "no") != 0;
998 context->helper_state = REGISTRY_SCAN_HELPER_NOT_STARTED;
1000 context->helper_state = REGISTRY_SCAN_HELPER_DISABLED;
1002 context->helper = NULL;
1003 context->changed = FALSE;
1007 clear_scan_context (GstRegistryScanContext * context)
1009 if (context->helper) {
1010 context->changed |= _priv_gst_plugin_loader_funcs.destroy (context->helper);
1011 context->helper = NULL;
1016 gst_registry_scan_plugin_file (GstRegistryScanContext * context,
1017 const gchar * filename, off_t file_size, time_t file_mtime)
1019 gboolean changed = FALSE;
1020 GstPlugin *newplugin = NULL;
1023 /* Disable external plugin loader on Windows until it is ported properly. */
1024 context->helper_state = REGISTRY_SCAN_HELPER_DISABLED;
1028 /* Have a plugin to load - see if the scan-helper needs starting */
1029 if (context->helper_state == REGISTRY_SCAN_HELPER_NOT_STARTED) {
1030 GST_DEBUG ("Starting plugin scanner for file %s", filename);
1031 context->helper = _priv_gst_plugin_loader_funcs.create (context->registry);
1032 if (context->helper != NULL)
1033 context->helper_state = REGISTRY_SCAN_HELPER_RUNNING;
1035 GST_WARNING ("Failed starting plugin scanner. Scanning in-process");
1036 context->helper_state = REGISTRY_SCAN_HELPER_DISABLED;
1040 if (context->helper_state == REGISTRY_SCAN_HELPER_RUNNING) {
1041 GST_DEBUG ("Using scan-helper to load plugin %s", filename);
1042 if (!_priv_gst_plugin_loader_funcs.load (context->helper,
1043 filename, file_size, file_mtime)) {
1044 g_warning ("External plugin loader failed. This most likely means that "
1045 "the plugin loader helper binary was not found or could not be run. "
1046 "%s", (g_getenv ("GST_PLUGIN_PATH") != NULL) ?
1047 "If you are running an uninstalled GStreamer setup, you might need "
1048 "to update your gst-uninstalled script so that the "
1049 "GST_PLUGIN_SCANNER environment variable gets set." : "");
1050 context->helper_state = REGISTRY_SCAN_HELPER_DISABLED;
1054 /* Check if the helper is disabled (or just got disabled above) */
1055 if (context->helper_state == REGISTRY_SCAN_HELPER_DISABLED) {
1056 /* Load plugin the old fashioned way... */
1058 /* We don't use a GError here because a failure to load some shared
1059 * objects as plugins is normal (particularly in the uninstalled case)
1061 newplugin = gst_plugin_load_file (filename, NULL);
1065 GST_DEBUG_OBJECT (context->registry, "marking new plugin %p as registered",
1067 newplugin->registered = TRUE;
1068 gst_object_unref (newplugin);
1076 gst_registry_scan_path_level (GstRegistryScanContext * context,
1077 const gchar * path, int level)
1080 const gchar *dirent;
1083 gboolean changed = FALSE;
1085 dir = g_dir_open (path, 0, NULL);
1089 while ((dirent = g_dir_read_name (dir))) {
1090 struct stat file_status;
1092 filename = g_build_filename (path, dirent, NULL);
1093 if (g_stat (filename, &file_status) < 0) {
1094 /* Plugin will be removed from cache after the scan completes if it
1095 * is still marked 'cached' */
1100 if (file_status.st_mode & S_IFDIR) {
1101 /* skip the .debug directory, these contain elf files that are not
1102 * useful or worse, can crash dlopen (). do a quick check for the . first
1103 * and then call the compare functions. */
1104 if (G_UNLIKELY (dirent[0] == '.' && (g_str_equal (dirent, ".debug")
1105 || g_str_equal (dirent, ".git")))) {
1106 GST_LOG_OBJECT (context->registry, "ignoring .debug or .git directory");
1110 /* FIXME 0.11: Don't recurse into directories, this behaviour
1111 * is inconsistent with other PATH environment variables
1114 GST_LOG_OBJECT (context->registry, "recursing into directory %s",
1116 changed |= gst_registry_scan_path_level (context, filename, level - 1);
1118 GST_LOG_OBJECT (context->registry, "not recursing into directory %s, "
1119 "recursion level too deep", filename);
1124 if (!(file_status.st_mode & S_IFREG)) {
1125 GST_LOG_OBJECT (context->registry, "%s is not a regular file, ignoring",
1130 if (!g_str_has_suffix (dirent, G_MODULE_SUFFIX)
1131 #ifdef GST_EXTRA_MODULE_SUFFIX
1132 && !g_str_has_suffix (dirent, GST_EXTRA_MODULE_SUFFIX)
1135 GST_LOG_OBJECT (context->registry,
1136 "extension is not recognized as module file, ignoring file %s",
1142 GST_LOG_OBJECT (context->registry, "file %s looks like a possible module",
1145 /* plug-ins are considered unique by basename; if the given name
1146 * was already seen by the registry, we ignore it */
1147 plugin = gst_registry_lookup_bn (context->registry, dirent);
1149 gboolean env_vars_changed, deps_changed = FALSE;
1151 if (plugin->registered) {
1152 GST_DEBUG_OBJECT (context->registry,
1153 "plugin already registered from path \"%s\"",
1154 GST_STR_NULL (plugin->filename));
1156 gst_object_unref (plugin);
1160 env_vars_changed = _priv_plugin_deps_env_vars_changed (plugin);
1162 /* If a file with a certain basename is seen on a different path,
1163 * update the plugin to ensure the registry cache will reflect up
1164 * to date information */
1166 if (plugin->file_mtime == file_status.st_mtime &&
1167 plugin->file_size == file_status.st_size && !env_vars_changed &&
1168 !(deps_changed = _priv_plugin_deps_files_changed (plugin)) &&
1169 !strcmp (plugin->filename, filename)) {
1170 GST_LOG_OBJECT (context->registry, "file %s cached", filename);
1171 plugin->flags &= ~GST_PLUGIN_FLAG_CACHED;
1172 GST_LOG_OBJECT (context->registry,
1173 "marking plugin %p as registered as %s", plugin, filename);
1174 plugin->registered = TRUE;
1176 GST_INFO_OBJECT (context->registry, "cached info for %s is stale",
1178 GST_DEBUG_OBJECT (context->registry, "mtime %ld != %ld or size %"
1179 G_GINT64_FORMAT " != %" G_GINT64_FORMAT " or external dependency "
1180 "env_vars changed: %d or external dependencies changed: %d"
1181 " or old path %s != new path %s",
1182 plugin->file_mtime, file_status.st_mtime,
1183 (gint64) plugin->file_size, (gint64) file_status.st_size,
1184 env_vars_changed, deps_changed, plugin->filename, filename);
1185 gst_registry_remove_plugin (context->registry, plugin);
1186 changed |= gst_registry_scan_plugin_file (context, filename,
1187 file_status.st_size, file_status.st_mtime);
1189 gst_object_unref (plugin);
1192 GST_DEBUG_OBJECT (context->registry, "file %s not yet in registry",
1194 changed |= gst_registry_scan_plugin_file (context, filename,
1195 file_status.st_size, file_status.st_mtime);
1207 gst_registry_scan_path_internal (GstRegistryScanContext * context,
1212 GST_DEBUG_OBJECT (context->registry, "scanning path %s", path);
1213 changed = gst_registry_scan_path_level (context, path, 10);
1215 GST_DEBUG_OBJECT (context->registry, "registry changed in path %s: %d", path,
1221 * gst_registry_scan_path:
1222 * @registry: the registry to add found plugins to
1223 * @path: the path to scan
1225 * Scan the given path for plugins to add to the registry. The syntax of the
1226 * path is specific to the registry.
1228 * Returns: %TRUE if registry changed
1231 gst_registry_scan_path (GstRegistry * registry, const gchar * path)
1233 GstRegistryScanContext context;
1236 g_return_val_if_fail (GST_IS_REGISTRY (registry), FALSE);
1237 g_return_val_if_fail (path != NULL, FALSE);
1239 init_scan_context (&context, registry);
1241 result = gst_registry_scan_path_internal (&context, path);
1243 clear_scan_context (&context);
1244 result |= context.changed;
1250 _gst_plugin_feature_filter_plugin_name (GstPluginFeature * feature,
1253 return (strcmp (feature->plugin_name, (gchar *) user_data) == 0);
1257 * gst_registry_get_feature_list_by_plugin:
1258 * @registry: a #GstRegistry.
1259 * @name: a plugin name.
1261 * Retrieves a #GList of features of the plugin with name @name.
1263 * Returns: a #GList of #GstPluginFeature. Use gst_plugin_feature_list_free()
1267 gst_registry_get_feature_list_by_plugin (GstRegistry * registry,
1270 g_return_val_if_fail (GST_IS_REGISTRY (registry), NULL);
1271 g_return_val_if_fail (name != NULL, NULL);
1273 return gst_registry_feature_filter (registry,
1274 _gst_plugin_feature_filter_plugin_name, FALSE, (gpointer) name);
1277 /* Unref and delete the default registry */
1279 _priv_gst_registry_cleanup (void)
1281 GstRegistry *registry;
1283 g_static_mutex_lock (&_gst_registry_mutex);
1284 if ((registry = _gst_registry_default) != NULL) {
1285 _gst_registry_default = NULL;
1287 g_static_mutex_unlock (&_gst_registry_mutex);
1289 /* unref outside of the lock because we can. */
1291 gst_object_unref (registry);
1295 * gst_default_registry_check_feature_version:
1296 * @feature_name: the name of the feature (e.g. "oggdemux")
1297 * @min_major: the minimum major version number
1298 * @min_minor: the minimum minor version number
1299 * @min_micro: the minimum micro version number
1301 * Checks whether a plugin feature by the given name exists in the
1302 * default registry and whether its version is at least the
1305 * Returns: #TRUE if the feature could be found and the version is
1306 * the same as the required version or newer, and #FALSE otherwise.
1309 gst_default_registry_check_feature_version (const gchar * feature_name,
1310 guint min_major, guint min_minor, guint min_micro)
1312 GstPluginFeature *feature;
1313 GstRegistry *registry;
1314 gboolean ret = FALSE;
1316 g_return_val_if_fail (feature_name != NULL, FALSE);
1318 GST_DEBUG ("Looking up plugin feature '%s'", feature_name);
1320 registry = gst_registry_get_default ();
1321 feature = gst_registry_lookup_feature (registry, feature_name);
1323 ret = gst_plugin_feature_check_version (feature, min_major, min_minor,
1325 gst_object_unref (feature);
1327 GST_DEBUG ("Could not find plugin feature '%s'", feature_name);
1334 load_plugin_func (gpointer data, gpointer user_data)
1337 const gchar *filename;
1340 filename = (const gchar *) data;
1341 GST_DEBUG ("Pre-loading plugin %s", filename);
1343 plugin = gst_plugin_load_file (filename, &err);
1346 GST_INFO ("Loaded plugin: \"%s\"", filename);
1348 gst_default_registry_add_plugin (plugin);
1351 /* Report error to user, and free error */
1352 GST_ERROR ("Failed to load plugin: %s", err->message);
1355 GST_WARNING ("Failed to load plugin: \"%s\"", filename);
1360 #ifndef GST_DISABLE_REGISTRY
1361 /* Unref all plugins marked 'cached', to clear old plugins that no
1362 * longer exist. Returns TRUE if any plugins were removed */
1364 gst_registry_remove_cache_plugins (GstRegistry * registry)
1369 gboolean changed = FALSE;
1371 g_return_val_if_fail (GST_IS_REGISTRY (registry), FALSE);
1373 GST_OBJECT_LOCK (registry);
1375 GST_DEBUG_OBJECT (registry, "removing cached plugins");
1376 g = registry->plugins;
1380 if (plugin->flags & GST_PLUGIN_FLAG_CACHED) {
1381 GST_DEBUG_OBJECT (registry, "removing cached plugin \"%s\"",
1382 GST_STR_NULL (plugin->filename));
1383 registry->plugins = g_list_delete_link (registry->plugins, g);
1384 if (G_LIKELY (plugin->basename))
1385 g_hash_table_remove (registry->basename_hash, plugin->basename);
1386 gst_registry_remove_features_for_plugin_unlocked (registry, plugin);
1387 gst_object_unref (plugin);
1393 GST_OBJECT_UNLOCK (registry);
1400 REGISTRY_SCAN_AND_UPDATE_FAILURE = 0,
1401 REGISTRY_SCAN_AND_UPDATE_SUCCESS_NOT_CHANGED,
1402 REGISTRY_SCAN_AND_UPDATE_SUCCESS_UPDATED
1403 } GstRegistryScanAndUpdateResult;
1406 * scan_and_update_registry:
1407 * @default_registry: the #GstRegistry
1408 * @registry_file: registry filename
1409 * @write_changes: write registry if it has changed?
1411 * Scans for registry changes and eventually updates the registry cache.
1413 * Return: %REGISTRY_SCAN_AND_UPDATE_FAILURE if the registry could not scanned
1414 * or updated, %REGISTRY_SCAN_AND_UPDATE_SUCCESS_NOT_CHANGED if the
1415 * registry is clean and %REGISTRY_SCAN_AND_UPDATE_SUCCESS_UPDATED if
1416 * it has been updated and the cache needs to be re-read.
1418 static GstRegistryScanAndUpdateResult
1419 scan_and_update_registry (GstRegistry * default_registry,
1420 const gchar * registry_file, gboolean write_changes, GError ** error)
1422 const gchar *plugin_path;
1423 gboolean changed = FALSE;
1425 GstRegistryScanContext context;
1427 GST_INFO ("Validating plugins from registry cache: %s", registry_file);
1429 init_scan_context (&context, default_registry);
1431 /* It sounds tempting to just compare the mtime of directories with the mtime
1432 * of the registry cache, but it does not work. It would not catch updated
1433 * plugins, which might bring more or less features.
1436 /* scan paths specified via --gst-plugin-path */
1437 GST_DEBUG ("scanning paths added via --gst-plugin-path");
1438 for (l = _priv_gst_plugin_paths; l != NULL; l = l->next) {
1439 GST_INFO ("Scanning plugin path: \"%s\"", (gchar *) l->data);
1440 changed |= gst_registry_scan_path_internal (&context, (gchar *) l->data);
1442 /* keep plugin_paths around in case a re-scan is forced later on */
1444 /* GST_PLUGIN_PATH specifies a list of directories to scan for
1445 * additional plugins. These take precedence over the system plugins */
1446 plugin_path = g_getenv ("GST_PLUGIN_PATH");
1451 GST_DEBUG ("GST_PLUGIN_PATH set to %s", plugin_path);
1452 list = g_strsplit (plugin_path, G_SEARCHPATH_SEPARATOR_S, 0);
1453 for (i = 0; list[i]; i++) {
1454 changed |= gst_registry_scan_path_internal (&context, list[i]);
1458 GST_DEBUG ("GST_PLUGIN_PATH not set");
1461 /* GST_PLUGIN_SYSTEM_PATH specifies a list of plugins that are always
1462 * loaded by default. If not set, this defaults to the system-installed
1463 * path, and the plugins installed in the user's home directory */
1464 plugin_path = g_getenv ("GST_PLUGIN_SYSTEM_PATH");
1465 if (plugin_path == NULL) {
1468 GST_DEBUG ("GST_PLUGIN_SYSTEM_PATH not set");
1470 /* plugins in the user's home directory take precedence over
1471 * system-installed ones */
1472 home_plugins = g_build_filename (g_get_home_dir (),
1473 ".gstreamer-" GST_MAJORMINOR, "plugins", NULL);
1474 GST_DEBUG ("scanning home plugins %s", home_plugins);
1475 changed |= gst_registry_scan_path_internal (&context, home_plugins);
1476 g_free (home_plugins);
1478 /* add the main (installed) library path */
1479 GST_DEBUG ("scanning main plugins %s", PLUGINDIR);
1480 changed |= gst_registry_scan_path_internal (&context, PLUGINDIR);
1488 g_win32_get_package_installation_directory_of_module
1489 (_priv_gst_dll_handle);
1491 dir = g_build_filename (base_dir, "lib", "gstreamer-0.10", NULL);
1492 GST_DEBUG ("scanning DLL dir %s", dir);
1494 changed |= gst_registry_scan_path_internal (&context, dir);
1504 GST_DEBUG ("GST_PLUGIN_SYSTEM_PATH set to %s", plugin_path);
1505 list = g_strsplit (plugin_path, G_SEARCHPATH_SEPARATOR_S, 0);
1506 for (i = 0; list[i]; i++) {
1507 changed |= gst_registry_scan_path_internal (&context, list[i]);
1512 clear_scan_context (&context);
1513 changed |= context.changed;
1515 /* Remove cached plugins so stale info is cleared. */
1516 changed |= gst_registry_remove_cache_plugins (default_registry);
1519 GST_INFO ("Registry cache has not changed");
1520 return REGISTRY_SCAN_AND_UPDATE_SUCCESS_NOT_CHANGED;
1523 if (!write_changes) {
1524 GST_INFO ("Registry cache changed, but writing is disabled. Not writing.");
1525 return REGISTRY_SCAN_AND_UPDATE_FAILURE;
1528 GST_INFO ("Registry cache changed. Writing new registry cache");
1529 if (!gst_registry_binary_write_cache (default_registry, registry_file)) {
1530 g_set_error (error, GST_CORE_ERROR, GST_CORE_ERROR_FAILED,
1531 _("Error writing registry cache to %s: %s"),
1532 registry_file, g_strerror (errno));
1533 return REGISTRY_SCAN_AND_UPDATE_FAILURE;
1536 GST_INFO ("Registry cache written successfully");
1537 return REGISTRY_SCAN_AND_UPDATE_SUCCESS_UPDATED;
1541 ensure_current_registry (GError ** error)
1543 gchar *registry_file;
1544 GstRegistry *default_registry;
1545 gboolean ret = TRUE;
1546 gboolean do_update = TRUE;
1547 gboolean have_cache = TRUE;
1549 default_registry = gst_registry_get_default ();
1550 registry_file = g_strdup (g_getenv ("GST_REGISTRY"));
1551 if (registry_file == NULL) {
1552 registry_file = g_build_filename (g_get_home_dir (),
1553 ".gstreamer-" GST_MAJORMINOR, "registry." HOST_CPU ".bin", NULL);
1556 if (!_gst_disable_registry_cache) {
1557 GST_INFO ("reading registry cache: %s", registry_file);
1558 have_cache = gst_registry_binary_read_cache (default_registry,
1560 /* Only ever read the registry cache once, then disable it for
1561 * subsequent updates during the program lifetime */
1562 _gst_disable_registry_cache = TRUE;
1566 do_update = !_priv_gst_disable_registry_update;
1568 const gchar *update_env;
1570 if ((update_env = g_getenv ("GST_REGISTRY_UPDATE"))) {
1571 /* do update for any value different from "no" */
1572 do_update = (strcmp (update_env, "no") != 0);
1578 /* now check registry */
1579 GST_DEBUG ("Updating registry cache");
1580 scan_and_update_registry (default_registry, registry_file, TRUE, error);
1582 GST_DEBUG ("Not updating registry cache (disabled)");
1585 g_free (registry_file);
1586 GST_INFO ("registry reading and updating done, result = %d", ret);
1590 #endif /* GST_DISABLE_REGISTRY */
1593 * gst_registry_fork_is_enabled:
1595 * By default GStreamer will perform scanning and rebuilding of the
1596 * registry file using a helper child process.
1598 * Applications might want to disable this behaviour with the
1599 * gst_registry_fork_set_enabled() function, in which case new plugins
1600 * are scanned (and loaded) into the application process.
1602 * Returns: %TRUE if GStreamer will use the child helper process when
1603 * rebuilding the registry.
1608 gst_registry_fork_is_enabled (void)
1610 return _gst_enable_registry_fork;
1614 * gst_registry_fork_set_enabled:
1615 * @enabled: whether rebuilding the registry can use a temporary child helper process.
1617 * Applications might want to disable/enable spawning of a child helper process
1618 * when rebuilding the registry. See gst_registry_fork_is_enabled() for more
1624 gst_registry_fork_set_enabled (gboolean enabled)
1626 _gst_enable_registry_fork = enabled;
1630 * gst_update_registry:
1632 * Forces GStreamer to re-scan its plugin paths and update the default
1635 * Applications will almost never need to call this function, it is only
1636 * useful if the application knows new plugins have been installed (or old
1637 * ones removed) since the start of the application (or, to be precise, the
1638 * first call to gst_init()) and the application wants to make use of any
1639 * newly-installed plugins without restarting the application.
1641 * Applications should assume that the registry update is neither atomic nor
1642 * thread-safe and should therefore not have any dynamic pipelines running
1643 * (including the playbin and decodebin elements) and should also not create
1644 * any elements or access the GStreamer registry while the update is in
1647 * Note that this function may block for a significant amount of time.
1649 * Returns: %TRUE if the registry has been updated successfully (does not
1650 * imply that there were changes), otherwise %FALSE.
1655 gst_update_registry (void)
1659 #ifndef GST_DISABLE_REGISTRY
1662 res = ensure_current_registry (&err);
1664 GST_WARNING ("registry update failed: %s", err->message);
1667 GST_LOG ("registry update succeeded");
1671 GST_WARNING ("registry update failed: %s", "registry disabled");
1673 #endif /* GST_DISABLE_REGISTRY */
1675 if (_priv_gst_preload_plugins) {
1676 GST_DEBUG ("Preloading indicated plugins...");
1677 g_slist_foreach (_priv_gst_preload_plugins, load_plugin_func, NULL);
1684 * gst_registry_get_feature_list_cookie:
1685 * @registry: the registry
1687 * Returns the registrys feature list cookie. This changes
1688 * every time a feature is added or removed from the registry.
1690 * Returns: the feature list cookie.
1695 gst_registry_get_feature_list_cookie (GstRegistry * registry)
1697 g_return_val_if_fail (GST_IS_REGISTRY (registry), 0);
1699 return registry->priv->cookie;