2002-04-12 09:53:00 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
|
|
|
* 2000 Wim Taymans <wtay@chello.be>
|
2005-09-15 00:13:26 +00:00
|
|
|
* 2005 David A. Schleef <ds@schleef.org>
|
2002-04-12 09:53:00 +00:00
|
|
|
*
|
|
|
|
* gstregistry.c: handle registry
|
2004-03-15 15:16:04 +00:00
|
|
|
*
|
2002-04-12 09:53:00 +00:00
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
2005-10-15 16:01:57 +00:00
|
|
|
|
2005-09-02 16:17:23 +00:00
|
|
|
/**
|
|
|
|
* SECTION:gstregistry
|
|
|
|
* @short_description: Abstract base class for management of #GstPlugin objects
|
|
|
|
* @see_also: #GstPlugin, #GstPluginFeature
|
|
|
|
*
|
|
|
|
* One registry holds the metadata of a set of plugins.
|
2007-05-11 08:29:10 +00:00
|
|
|
*
|
2006-07-26 20:30:55 +00:00
|
|
|
* <emphasis role="bold">Design:</emphasis>
|
2005-09-15 00:13:26 +00:00
|
|
|
*
|
2006-07-26 20:30:55 +00:00
|
|
|
* The #GstRegistry object is a list of plugins and some functions for dealing
|
|
|
|
* with them. #GstPlugins are matched 1-1 with a file on disk, and may or may
|
|
|
|
* not be loaded at a given time. There may be multiple #GstRegistry objects,
|
|
|
|
* but the "default registry" is the only object that has any meaning to the
|
|
|
|
* core.
|
2006-01-17 12:08:43 +00:00
|
|
|
*
|
|
|
|
* The registry.xml file is actually a cache of plugin information. This is
|
|
|
|
* unlike versions prior to 0.10, where the registry file was the primary source
|
|
|
|
* of plugin information, and was created by the gst-register command.
|
|
|
|
*
|
|
|
|
* The primary source, at all times, of plugin information is each plugin file
|
|
|
|
* itself. Thus, if an application wants information about a particular plugin,
|
|
|
|
* or wants to search for a feature that satisfies given criteria, the primary
|
|
|
|
* means of doing so is to load every plugin and look at the resulting
|
|
|
|
* information that is gathered in the default registry. Clearly, this is a time
|
|
|
|
* consuming process, so we cache information in the registry.xml file.
|
|
|
|
*
|
|
|
|
* On startup, plugins are searched for in the plugin search path. This path can
|
2006-07-26 20:30:55 +00:00
|
|
|
* be set directly using the %GST_PLUGIN_PATH environment variable. The registry
|
2006-01-17 12:08:43 +00:00
|
|
|
* file is loaded from ~/.gstreamer-$GST_MAJORMINOR/registry-$ARCH.xml or the
|
2006-07-26 20:30:55 +00:00
|
|
|
* file listed in the %GST_REGISTRY env var. The only reason to change the
|
2006-01-17 12:08:43 +00:00
|
|
|
* registry location is for testing.
|
|
|
|
*
|
|
|
|
* For each plugin that is found in the plugin search path, there could be 3
|
|
|
|
* possibilities for cached information:
|
2006-07-26 20:30:55 +00:00
|
|
|
* <itemizedlist>
|
|
|
|
* <listitem>
|
|
|
|
* <para>the cache may not contain information about a given file.</para>
|
|
|
|
* </listitem>
|
|
|
|
* <listitem>
|
|
|
|
* <para>the cache may have stale information.</para>
|
|
|
|
* </listitem>
|
|
|
|
* <listitem>
|
|
|
|
* <para>the cache may have current information.</para>
|
|
|
|
* </listitem>
|
|
|
|
* </itemizedlist>
|
2005-09-15 00:13:26 +00:00
|
|
|
*
|
2006-01-17 12:08:43 +00:00
|
|
|
* In the first two cases, the plugin is loaded and the cache updated. In
|
|
|
|
* addition to these cases, the cache may have entries for plugins that are not
|
|
|
|
* relevant to the current process. These are marked as not available to the
|
|
|
|
* current process. If the cache is updated for whatever reason, it is marked
|
|
|
|
* dirty.
|
|
|
|
*
|
|
|
|
* A dirty cache is written out at the end of initialization. Each entry is
|
|
|
|
* checked to make sure the information is minimally valid. If not, the entry is
|
|
|
|
* simply dropped.
|
2005-09-15 00:13:26 +00:00
|
|
|
*
|
2006-07-26 20:30:55 +00:00
|
|
|
* <emphasis role="bold">Implementation notes:</emphasis>
|
2005-09-15 00:13:26 +00:00
|
|
|
*
|
2006-01-17 12:08:43 +00:00
|
|
|
* The "cache" and "default registry" are different concepts and can represent
|
|
|
|
* different sets of plugins. For various reasons, at init time, the cache is
|
|
|
|
* stored in the default registry, and plugins not relevant to the current
|
2006-07-26 20:30:55 +00:00
|
|
|
* process are marked with the %GST_PLUGIN_FLAG_CACHED bit. These plugins are
|
2006-01-17 12:08:43 +00:00
|
|
|
* removed at the end of intitialization.
|
2005-09-15 00:13:26 +00:00
|
|
|
*/
|
2005-06-29 12:25:05 +00:00
|
|
|
|
2006-07-26 20:30:55 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
#include "gst_private.h"
|
|
|
|
#include <glib.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
#include <unistd.h>
|
|
|
|
#endif
|
|
|
|
#include <errno.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
2008-11-24 09:59:07 +00:00
|
|
|
/* For g_stat () */
|
|
|
|
#include <glib/gstdio.h>
|
2006-07-26 20:30:55 +00:00
|
|
|
|
|
|
|
#include "gstinfo.h"
|
|
|
|
#include "gstregistry.h"
|
|
|
|
#include "gstmarshal.h"
|
|
|
|
#include "gstfilter.h"
|
|
|
|
|
|
|
|
#define GST_CAT_DEFAULT GST_CAT_REGISTRY
|
|
|
|
|
2007-05-11 08:29:10 +00:00
|
|
|
/* the one instance of the default registry and the mutex protecting the
|
2006-07-26 20:30:55 +00:00
|
|
|
* variable. */
|
|
|
|
static GStaticMutex _gst_registry_mutex = G_STATIC_MUTEX_INIT;
|
|
|
|
static GstRegistry *_gst_registry_default = NULL;
|
|
|
|
|
2002-05-08 20:40:48 +00:00
|
|
|
/* Element signals and args */
|
2004-03-13 15:27:01 +00:00
|
|
|
enum
|
|
|
|
{
|
2002-05-08 20:40:48 +00:00
|
|
|
PLUGIN_ADDED,
|
2005-09-18 06:59:25 +00:00
|
|
|
FEATURE_ADDED,
|
2002-05-08 20:40:48 +00:00
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
2005-09-18 21:24:55 +00:00
|
|
|
static void gst_registry_finalize (GObject * object);
|
2002-05-08 20:40:48 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
static guint gst_registry_signals[LAST_SIGNAL] = { 0 };
|
2002-05-08 20:40:48 +00:00
|
|
|
|
2005-09-18 06:59:25 +00:00
|
|
|
static GstPluginFeature *gst_registry_lookup_feature_locked (GstRegistry *
|
|
|
|
registry, const char *name);
|
2005-09-15 23:51:24 +00:00
|
|
|
static GstPlugin *gst_registry_lookup_locked (GstRegistry * registry,
|
|
|
|
const char *filename);
|
|
|
|
|
|
|
|
G_DEFINE_TYPE (GstRegistry, gst_registry, GST_TYPE_OBJECT);
|
2005-09-18 21:24:55 +00:00
|
|
|
static GstObjectClass *parent_class = NULL;
|
2002-05-08 20:40:48 +00:00
|
|
|
|
|
|
|
static void
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_registry_class_init (GstRegistryClass * klass)
|
2002-05-08 20:40:48 +00:00
|
|
|
{
|
|
|
|
GObjectClass *gobject_class;
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
gobject_class = (GObjectClass *) klass;
|
2002-05-08 20:40:48 +00:00
|
|
|
|
2006-04-08 20:57:31 +00:00
|
|
|
parent_class = g_type_class_peek_parent (klass);
|
2005-09-18 21:24:55 +00:00
|
|
|
|
2007-01-27 18:44:11 +00:00
|
|
|
/**
|
|
|
|
* GstRegistry::plugin-added:
|
|
|
|
* @registry: the registry that emitted the signal
|
|
|
|
* @plugin: the plugin that has been added
|
|
|
|
*
|
|
|
|
* Signals that a plugin has been added to the registry (possibly
|
|
|
|
* replacing a previously-added one by the same name)
|
|
|
|
*/
|
2002-05-08 20:40:48 +00:00
|
|
|
gst_registry_signals[PLUGIN_ADDED] =
|
2004-03-13 15:27:01 +00:00
|
|
|
g_signal_new ("plugin-added", G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstRegistryClass, plugin_added), NULL,
|
|
|
|
NULL, gst_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER);
|
2007-01-27 18:44:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* GstRegistry::feature-added:
|
|
|
|
* @registry: the registry that emitted the signal
|
|
|
|
* @feature: the feature that has been added
|
|
|
|
*
|
|
|
|
* Signals that a feature has been added to the registry (possibly
|
|
|
|
* replacing a previously-added one by the same name)
|
|
|
|
*/
|
2005-09-18 06:59:25 +00:00
|
|
|
gst_registry_signals[FEATURE_ADDED] =
|
|
|
|
g_signal_new ("feature-added", G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstRegistryClass, feature_added),
|
|
|
|
NULL, NULL, gst_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER);
|
2002-05-08 20:40:48 +00:00
|
|
|
|
2005-09-18 21:24:55 +00:00
|
|
|
gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_registry_finalize);
|
2002-05-08 20:40:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_registry_init (GstRegistry * registry)
|
2002-05-08 20:40:48 +00:00
|
|
|
{
|
2007-07-23 11:42:12 +00:00
|
|
|
registry->feature_hash = g_hash_table_new (g_str_hash, g_str_equal);
|
2005-09-18 21:24:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_registry_finalize (GObject * object)
|
|
|
|
{
|
|
|
|
GstRegistry *registry = GST_REGISTRY (object);
|
|
|
|
GList *plugins, *p;
|
|
|
|
GList *features, *f;
|
|
|
|
|
|
|
|
plugins = registry->plugins;
|
|
|
|
registry->plugins = NULL;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (registry, "registry finalize");
|
|
|
|
p = plugins;
|
|
|
|
while (p) {
|
|
|
|
GstPlugin *plugin = p->data;
|
|
|
|
|
|
|
|
if (plugin) {
|
2007-02-09 13:41:24 +00:00
|
|
|
GST_LOG_OBJECT (registry, "removing plugin %s",
|
2005-09-18 21:24:55 +00:00
|
|
|
gst_plugin_get_name (plugin));
|
gst/: Re-commit the registry changes, along with an extra fix:
Original commit message from CVS:
* gst/gst.c: (init_pre), (scan_and_update_registry),
(ensure_current_registry_nonforking),
(ensure_current_registry_forking), (ensure_current_registry),
(init_post), (gst_debug_help), (gst_deinit):
* gst/gst_private.h:
* gst/gstregistry.c: (gst_registry_finalize),
(gst_registry_remove_features_for_plugin_unlocked),
(gst_registry_remove_plugin), (gst_registry_scan_path_level),
(gst_registry_scan_path),
(_priv_gst_registry_remove_cache_plugins),
(_priv_gst_registry_cleanup):
* gst/gstregistry.h:
Re-commit the registry changes, along with an extra fix:
When a cached plugin is encountered at a different file path,
update the stored path in the registry cache so that the parent
process knows where it actually is now when it re-reads the registry
cache. Fixes the thing that broke distcheck with the previous commit.
* tests/check/Makefile.am:
Clean up files named 'core' too when running make clean.
* tests/examples/manual/Makefile.am:
Set up a registry path for running these tests, and clean it properly
for distcheck.
2006-09-28 14:00:43 +00:00
|
|
|
gst_object_unref (plugin);
|
2005-09-18 21:24:55 +00:00
|
|
|
}
|
|
|
|
p = g_list_next (p);
|
|
|
|
}
|
|
|
|
g_list_free (plugins);
|
|
|
|
|
|
|
|
features = registry->features;
|
|
|
|
registry->features = NULL;
|
2002-12-19 21:31:03 +00:00
|
|
|
|
2005-09-18 21:24:55 +00:00
|
|
|
f = features;
|
|
|
|
while (f) {
|
|
|
|
GstPluginFeature *feature = f->data;
|
|
|
|
|
|
|
|
if (feature) {
|
2007-02-09 13:41:24 +00:00
|
|
|
GST_LOG_OBJECT (registry, "removing feature %p (%s)",
|
gst/: Re-commit the registry changes, along with an extra fix:
Original commit message from CVS:
* gst/gst.c: (init_pre), (scan_and_update_registry),
(ensure_current_registry_nonforking),
(ensure_current_registry_forking), (ensure_current_registry),
(init_post), (gst_debug_help), (gst_deinit):
* gst/gst_private.h:
* gst/gstregistry.c: (gst_registry_finalize),
(gst_registry_remove_features_for_plugin_unlocked),
(gst_registry_remove_plugin), (gst_registry_scan_path_level),
(gst_registry_scan_path),
(_priv_gst_registry_remove_cache_plugins),
(_priv_gst_registry_cleanup):
* gst/gstregistry.h:
Re-commit the registry changes, along with an extra fix:
When a cached plugin is encountered at a different file path,
update the stored path in the registry cache so that the parent
process knows where it actually is now when it re-reads the registry
cache. Fixes the thing that broke distcheck with the previous commit.
* tests/check/Makefile.am:
Clean up files named 'core' too when running make clean.
* tests/examples/manual/Makefile.am:
Set up a registry path for running these tests, and clean it properly
for distcheck.
2006-09-28 14:00:43 +00:00
|
|
|
feature, gst_plugin_feature_get_name (feature));
|
|
|
|
gst_object_unref (feature);
|
2005-09-18 21:24:55 +00:00
|
|
|
}
|
|
|
|
f = g_list_next (f);
|
|
|
|
}
|
|
|
|
g_list_free (features);
|
|
|
|
|
2007-07-23 11:42:12 +00:00
|
|
|
g_hash_table_destroy (registry->feature_hash);
|
|
|
|
registry->feature_hash = NULL;
|
2005-09-18 21:24:55 +00:00
|
|
|
|
|
|
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
2002-05-08 20:40:48 +00:00
|
|
|
}
|
|
|
|
|
2005-09-22 12:05:05 +00:00
|
|
|
/**
|
|
|
|
* gst_registry_get_default:
|
|
|
|
*
|
|
|
|
* Retrieves the default registry. The caller does not own a reference on the
|
|
|
|
* registry, as it is alive as long as GStreamer is initialized.
|
2005-12-02 12:34:47 +00:00
|
|
|
*
|
|
|
|
* Returns: The default #GstRegistry.
|
2005-09-22 12:05:05 +00:00
|
|
|
*/
|
2005-09-15 00:13:26 +00:00
|
|
|
GstRegistry *
|
|
|
|
gst_registry_get_default (void)
|
2002-05-08 20:40:48 +00:00
|
|
|
{
|
2006-02-14 16:15:05 +00:00
|
|
|
GstRegistry *registry;
|
|
|
|
|
|
|
|
g_static_mutex_lock (&_gst_registry_mutex);
|
|
|
|
if (G_UNLIKELY (!_gst_registry_default)) {
|
2005-09-15 00:13:26 +00:00
|
|
|
_gst_registry_default = g_object_new (GST_TYPE_REGISTRY, NULL);
|
2009-05-02 12:36:50 +00:00
|
|
|
gst_object_ref_sink (GST_OBJECT_CAST (_gst_registry_default));
|
2005-09-15 00:13:26 +00:00
|
|
|
}
|
2006-02-14 16:15:05 +00:00
|
|
|
registry = _gst_registry_default;
|
|
|
|
g_static_mutex_unlock (&_gst_registry_mutex);
|
|
|
|
|
|
|
|
return registry;
|
2002-05-08 20:40:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_registry_add_path:
|
|
|
|
* @registry: the registry to add the path to
|
2004-03-15 15:16:04 +00:00
|
|
|
* @path: the path to add to the registry
|
2002-05-08 20:40:48 +00:00
|
|
|
*
|
2002-05-11 20:30:05 +00:00
|
|
|
* Add the given path to the registry. The syntax of the
|
|
|
|
* path is specific to the registry. If the path has already been
|
|
|
|
* added, do nothing.
|
2002-05-08 20:40:48 +00:00
|
|
|
*/
|
|
|
|
void
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_registry_add_path (GstRegistry * registry, const gchar * path)
|
2002-05-08 20:40:48 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (GST_IS_REGISTRY (registry));
|
|
|
|
g_return_if_fail (path != NULL);
|
|
|
|
|
2005-12-02 12:34:47 +00:00
|
|
|
if (strlen (path) == 0)
|
|
|
|
goto empty_path;
|
|
|
|
|
|
|
|
GST_OBJECT_LOCK (registry);
|
|
|
|
if (g_list_find_custom (registry->paths, path, (GCompareFunc) strcmp))
|
|
|
|
goto was_added;
|
|
|
|
|
|
|
|
GST_INFO ("Adding plugin path: \"%s\"", path);
|
|
|
|
registry->paths = g_list_append (registry->paths, g_strdup (path));
|
|
|
|
GST_OBJECT_UNLOCK (registry);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
empty_path:
|
|
|
|
{
|
2005-06-29 12:25:05 +00:00
|
|
|
GST_INFO ("Ignoring empty plugin path");
|
|
|
|
return;
|
|
|
|
}
|
2005-12-02 12:34:47 +00:00
|
|
|
was_added:
|
|
|
|
{
|
2004-03-13 15:27:01 +00:00
|
|
|
g_warning ("path %s already added to registry", path);
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_UNLOCK (registry);
|
2003-04-14 18:53:03 +00:00
|
|
|
return;
|
2002-05-11 20:30:05 +00:00
|
|
|
}
|
2002-05-08 20:40:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_registry_get_path_list:
|
|
|
|
* @registry: the registry to get the pathlist of
|
|
|
|
*
|
|
|
|
* Get the list of paths for the given registry.
|
|
|
|
*
|
|
|
|
* Returns: A Glist of paths as strings. g_list_free after use.
|
2005-12-02 12:34:47 +00:00
|
|
|
*
|
|
|
|
* MT safe.
|
2002-05-08 20:40:48 +00:00
|
|
|
*/
|
2004-03-13 15:27:01 +00:00
|
|
|
GList *
|
|
|
|
gst_registry_get_path_list (GstRegistry * registry)
|
2002-05-08 20:40:48 +00:00
|
|
|
{
|
2005-09-15 23:51:24 +00:00
|
|
|
GList *list;
|
2002-05-08 20:40:48 +00:00
|
|
|
|
2005-09-15 23:51:24 +00:00
|
|
|
g_return_val_if_fail (GST_IS_REGISTRY (registry), NULL);
|
2002-05-08 20:40:48 +00:00
|
|
|
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_LOCK (registry);
|
2005-09-15 23:51:24 +00:00
|
|
|
/* We don't need to copy the strings, because they won't be deleted
|
|
|
|
* as long as the GstRegistry is around */
|
|
|
|
list = g_list_copy (registry->paths);
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_UNLOCK (registry);
|
2002-05-08 20:40:48 +00:00
|
|
|
|
2005-09-15 23:51:24 +00:00
|
|
|
return list;
|
2002-05-08 20:40:48 +00:00
|
|
|
}
|
|
|
|
|
2005-09-15 23:51:24 +00:00
|
|
|
|
2002-05-08 20:40:48 +00:00
|
|
|
/**
|
|
|
|
* gst_registry_add_plugin:
|
|
|
|
* @registry: the registry to add the plugin to
|
|
|
|
* @plugin: the plugin to add
|
|
|
|
*
|
2004-03-15 15:16:04 +00:00
|
|
|
* Add the plugin to the registry. The plugin-added signal will be emitted.
|
2005-12-02 12:34:47 +00:00
|
|
|
* This function will sink @plugin.
|
2002-05-08 20:40:48 +00:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
2005-12-02 12:34:47 +00:00
|
|
|
*
|
|
|
|
* MT safe.
|
2002-05-08 20:40:48 +00:00
|
|
|
*/
|
2004-03-13 15:27:01 +00:00
|
|
|
gboolean
|
|
|
|
gst_registry_add_plugin (GstRegistry * registry, GstPlugin * plugin)
|
2002-05-08 20:40:48 +00:00
|
|
|
{
|
2005-09-15 00:13:26 +00:00
|
|
|
GstPlugin *existing_plugin;
|
|
|
|
|
2002-05-08 20:40:48 +00:00
|
|
|
g_return_val_if_fail (GST_IS_REGISTRY (registry), FALSE);
|
2006-01-17 12:08:43 +00:00
|
|
|
g_return_val_if_fail (GST_IS_PLUGIN (plugin), FALSE);
|
2005-09-15 00:13:26 +00:00
|
|
|
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_LOCK (registry);
|
2005-09-15 23:51:24 +00:00
|
|
|
existing_plugin = gst_registry_lookup_locked (registry, plugin->filename);
|
gst/: Use _CAST macros to avoid unneeded type checking.
Original commit message from CVS:
* gst/gst.c: (gst_debug_help):
* gst/gstplugin.c: (gst_plugin_finalize), (gst_plugin_list_free):
* gst/gstpluginfeature.c: (gst_plugin_feature_finalize),
(gst_plugin_feature_list_free):
* gst/gstregistry.c: (gst_registry_add_plugin),
(gst_registry_add_feature), (gst_registry_plugin_filter),
(gst_registry_feature_filter), (gst_registry_find_plugin),
(gst_registry_find_feature), (gst_registry_get_plugin_list),
(gst_registry_lookup_feature_locked), (gst_registry_lookup_locked):
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache), (gst_registry_xml_write_cache):
* gst/gstminiobject.c: (gst_mini_object_unref),
(gst_mini_object_replace), (gst_value_mini_object_free),
(gst_value_mini_object_copy):
Use _CAST macros to avoid unneeded type checking.
Added some more G_UNLIKELY.
2006-06-12 09:17:44 +00:00
|
|
|
if (G_UNLIKELY (existing_plugin)) {
|
2005-10-08 06:49:09 +00:00
|
|
|
GST_DEBUG_OBJECT (registry,
|
|
|
|
"Replacing existing plugin %p with new plugin %p for filename \"%s\"",
|
2005-10-11 16:05:16 +00:00
|
|
|
existing_plugin, plugin, GST_STR_NULL (plugin->filename));
|
2005-09-15 00:13:26 +00:00
|
|
|
registry->plugins = g_list_remove (registry->plugins, existing_plugin);
|
2005-09-18 06:59:25 +00:00
|
|
|
gst_object_unref (existing_plugin);
|
2004-05-10 00:35:59 +00:00
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2005-10-08 06:49:09 +00:00
|
|
|
GST_DEBUG_OBJECT (registry, "adding plugin %p for filename \"%s\"",
|
2005-10-11 16:05:16 +00:00
|
|
|
plugin, GST_STR_NULL (plugin->filename));
|
2005-09-15 23:51:24 +00:00
|
|
|
|
2002-05-08 20:40:48 +00:00
|
|
|
registry->plugins = g_list_prepend (registry->plugins, plugin);
|
|
|
|
|
2009-05-02 12:36:50 +00:00
|
|
|
gst_object_ref_sink (plugin);
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_UNLOCK (registry);
|
2005-09-15 20:56:30 +00:00
|
|
|
|
2007-02-09 13:41:24 +00:00
|
|
|
GST_LOG_OBJECT (registry, "emitting plugin-added for filename \"%s\"",
|
2005-10-11 16:05:16 +00:00
|
|
|
GST_STR_NULL (plugin->filename));
|
2009-05-02 12:43:11 +00:00
|
|
|
g_signal_emit (registry, gst_registry_signals[PLUGIN_ADDED], 0, plugin);
|
2002-05-08 20:40:48 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
gst/: Re-commit the registry changes, along with an extra fix:
Original commit message from CVS:
* gst/gst.c: (init_pre), (scan_and_update_registry),
(ensure_current_registry_nonforking),
(ensure_current_registry_forking), (ensure_current_registry),
(init_post), (gst_debug_help), (gst_deinit):
* gst/gst_private.h:
* gst/gstregistry.c: (gst_registry_finalize),
(gst_registry_remove_features_for_plugin_unlocked),
(gst_registry_remove_plugin), (gst_registry_scan_path_level),
(gst_registry_scan_path),
(_priv_gst_registry_remove_cache_plugins),
(_priv_gst_registry_cleanup):
* gst/gstregistry.h:
Re-commit the registry changes, along with an extra fix:
When a cached plugin is encountered at a different file path,
update the stored path in the registry cache so that the parent
process knows where it actually is now when it re-reads the registry
cache. Fixes the thing that broke distcheck with the previous commit.
* tests/check/Makefile.am:
Clean up files named 'core' too when running make clean.
* tests/examples/manual/Makefile.am:
Set up a registry path for running these tests, and clean it properly
for distcheck.
2006-09-28 14:00:43 +00:00
|
|
|
static void
|
|
|
|
gst_registry_remove_features_for_plugin_unlocked (GstRegistry * registry,
|
|
|
|
GstPlugin * plugin)
|
|
|
|
{
|
|
|
|
GList *f;
|
2009-05-02 12:39:48 +00:00
|
|
|
const gchar *name;
|
gst/: Re-commit the registry changes, along with an extra fix:
Original commit message from CVS:
* gst/gst.c: (init_pre), (scan_and_update_registry),
(ensure_current_registry_nonforking),
(ensure_current_registry_forking), (ensure_current_registry),
(init_post), (gst_debug_help), (gst_deinit):
* gst/gst_private.h:
* gst/gstregistry.c: (gst_registry_finalize),
(gst_registry_remove_features_for_plugin_unlocked),
(gst_registry_remove_plugin), (gst_registry_scan_path_level),
(gst_registry_scan_path),
(_priv_gst_registry_remove_cache_plugins),
(_priv_gst_registry_cleanup):
* gst/gstregistry.h:
Re-commit the registry changes, along with an extra fix:
When a cached plugin is encountered at a different file path,
update the stored path in the registry cache so that the parent
process knows where it actually is now when it re-reads the registry
cache. Fixes the thing that broke distcheck with the previous commit.
* tests/check/Makefile.am:
Clean up files named 'core' too when running make clean.
* tests/examples/manual/Makefile.am:
Set up a registry path for running these tests, and clean it properly
for distcheck.
2006-09-28 14:00:43 +00:00
|
|
|
|
|
|
|
g_return_if_fail (GST_IS_REGISTRY (registry));
|
|
|
|
g_return_if_fail (GST_IS_PLUGIN (plugin));
|
|
|
|
|
2009-05-02 12:39:48 +00:00
|
|
|
name = gst_plugin_get_name (plugin);
|
|
|
|
|
gst/: Re-commit the registry changes, along with an extra fix:
Original commit message from CVS:
* gst/gst.c: (init_pre), (scan_and_update_registry),
(ensure_current_registry_nonforking),
(ensure_current_registry_forking), (ensure_current_registry),
(init_post), (gst_debug_help), (gst_deinit):
* gst/gst_private.h:
* gst/gstregistry.c: (gst_registry_finalize),
(gst_registry_remove_features_for_plugin_unlocked),
(gst_registry_remove_plugin), (gst_registry_scan_path_level),
(gst_registry_scan_path),
(_priv_gst_registry_remove_cache_plugins),
(_priv_gst_registry_cleanup):
* gst/gstregistry.h:
Re-commit the registry changes, along with an extra fix:
When a cached plugin is encountered at a different file path,
update the stored path in the registry cache so that the parent
process knows where it actually is now when it re-reads the registry
cache. Fixes the thing that broke distcheck with the previous commit.
* tests/check/Makefile.am:
Clean up files named 'core' too when running make clean.
* tests/examples/manual/Makefile.am:
Set up a registry path for running these tests, and clean it properly
for distcheck.
2006-09-28 14:00:43 +00:00
|
|
|
/* Remove all features for this plugin */
|
|
|
|
f = registry->features;
|
|
|
|
while (f != NULL) {
|
|
|
|
GList *next = g_list_next (f);
|
|
|
|
GstPluginFeature *feature = f->data;
|
|
|
|
|
2009-05-02 12:39:48 +00:00
|
|
|
if (feature && !strcmp (feature->plugin_name, name)) {
|
gst/: Re-commit the registry changes, along with an extra fix:
Original commit message from CVS:
* gst/gst.c: (init_pre), (scan_and_update_registry),
(ensure_current_registry_nonforking),
(ensure_current_registry_forking), (ensure_current_registry),
(init_post), (gst_debug_help), (gst_deinit):
* gst/gst_private.h:
* gst/gstregistry.c: (gst_registry_finalize),
(gst_registry_remove_features_for_plugin_unlocked),
(gst_registry_remove_plugin), (gst_registry_scan_path_level),
(gst_registry_scan_path),
(_priv_gst_registry_remove_cache_plugins),
(_priv_gst_registry_cleanup):
* gst/gstregistry.h:
Re-commit the registry changes, along with an extra fix:
When a cached plugin is encountered at a different file path,
update the stored path in the registry cache so that the parent
process knows where it actually is now when it re-reads the registry
cache. Fixes the thing that broke distcheck with the previous commit.
* tests/check/Makefile.am:
Clean up files named 'core' too when running make clean.
* tests/examples/manual/Makefile.am:
Set up a registry path for running these tests, and clean it properly
for distcheck.
2006-09-28 14:00:43 +00:00
|
|
|
GST_DEBUG_OBJECT (registry, "removing feature %p (%s) for plugin %s",
|
2009-05-02 12:39:48 +00:00
|
|
|
feature, gst_plugin_feature_get_name (feature), name);
|
gst/: Re-commit the registry changes, along with an extra fix:
Original commit message from CVS:
* gst/gst.c: (init_pre), (scan_and_update_registry),
(ensure_current_registry_nonforking),
(ensure_current_registry_forking), (ensure_current_registry),
(init_post), (gst_debug_help), (gst_deinit):
* gst/gst_private.h:
* gst/gstregistry.c: (gst_registry_finalize),
(gst_registry_remove_features_for_plugin_unlocked),
(gst_registry_remove_plugin), (gst_registry_scan_path_level),
(gst_registry_scan_path),
(_priv_gst_registry_remove_cache_plugins),
(_priv_gst_registry_cleanup):
* gst/gstregistry.h:
Re-commit the registry changes, along with an extra fix:
When a cached plugin is encountered at a different file path,
update the stored path in the registry cache so that the parent
process knows where it actually is now when it re-reads the registry
cache. Fixes the thing that broke distcheck with the previous commit.
* tests/check/Makefile.am:
Clean up files named 'core' too when running make clean.
* tests/examples/manual/Makefile.am:
Set up a registry path for running these tests, and clean it properly
for distcheck.
2006-09-28 14:00:43 +00:00
|
|
|
|
|
|
|
registry->features = g_list_delete_link (registry->features, f);
|
2007-07-23 11:42:12 +00:00
|
|
|
g_hash_table_remove (registry->feature_hash, feature->name);
|
gst/: Re-commit the registry changes, along with an extra fix:
Original commit message from CVS:
* gst/gst.c: (init_pre), (scan_and_update_registry),
(ensure_current_registry_nonforking),
(ensure_current_registry_forking), (ensure_current_registry),
(init_post), (gst_debug_help), (gst_deinit):
* gst/gst_private.h:
* gst/gstregistry.c: (gst_registry_finalize),
(gst_registry_remove_features_for_plugin_unlocked),
(gst_registry_remove_plugin), (gst_registry_scan_path_level),
(gst_registry_scan_path),
(_priv_gst_registry_remove_cache_plugins),
(_priv_gst_registry_cleanup):
* gst/gstregistry.h:
Re-commit the registry changes, along with an extra fix:
When a cached plugin is encountered at a different file path,
update the stored path in the registry cache so that the parent
process knows where it actually is now when it re-reads the registry
cache. Fixes the thing that broke distcheck with the previous commit.
* tests/check/Makefile.am:
Clean up files named 'core' too when running make clean.
* tests/examples/manual/Makefile.am:
Set up a registry path for running these tests, and clean it properly
for distcheck.
2006-09-28 14:00:43 +00:00
|
|
|
gst_object_unref (feature);
|
|
|
|
}
|
|
|
|
f = next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-05-08 20:40:48 +00:00
|
|
|
/**
|
|
|
|
* gst_registry_remove_plugin:
|
|
|
|
* @registry: the registry to remove the plugin from
|
|
|
|
* @plugin: the plugin to remove
|
|
|
|
*
|
|
|
|
* Remove the plugin from the registry.
|
2005-12-02 12:34:47 +00:00
|
|
|
*
|
|
|
|
* MT safe.
|
2002-05-08 20:40:48 +00:00
|
|
|
*/
|
|
|
|
void
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_registry_remove_plugin (GstRegistry * registry, GstPlugin * plugin)
|
2002-05-08 20:40:48 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (GST_IS_REGISTRY (registry));
|
2006-01-17 12:08:43 +00:00
|
|
|
g_return_if_fail (GST_IS_PLUGIN (plugin));
|
2002-05-08 20:40:48 +00:00
|
|
|
|
gst/: Re-commit the registry changes, along with an extra fix:
Original commit message from CVS:
* gst/gst.c: (init_pre), (scan_and_update_registry),
(ensure_current_registry_nonforking),
(ensure_current_registry_forking), (ensure_current_registry),
(init_post), (gst_debug_help), (gst_deinit):
* gst/gst_private.h:
* gst/gstregistry.c: (gst_registry_finalize),
(gst_registry_remove_features_for_plugin_unlocked),
(gst_registry_remove_plugin), (gst_registry_scan_path_level),
(gst_registry_scan_path),
(_priv_gst_registry_remove_cache_plugins),
(_priv_gst_registry_cleanup):
* gst/gstregistry.h:
Re-commit the registry changes, along with an extra fix:
When a cached plugin is encountered at a different file path,
update the stored path in the registry cache so that the parent
process knows where it actually is now when it re-reads the registry
cache. Fixes the thing that broke distcheck with the previous commit.
* tests/check/Makefile.am:
Clean up files named 'core' too when running make clean.
* tests/examples/manual/Makefile.am:
Set up a registry path for running these tests, and clean it properly
for distcheck.
2006-09-28 14:00:43 +00:00
|
|
|
GST_DEBUG_OBJECT (registry, "removing plugin %p (%s)",
|
|
|
|
plugin, gst_plugin_get_name (plugin));
|
|
|
|
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_LOCK (registry);
|
2002-05-08 20:40:48 +00:00
|
|
|
registry->plugins = g_list_remove (registry->plugins, plugin);
|
gst/: Re-commit the registry changes, along with an extra fix:
Original commit message from CVS:
* gst/gst.c: (init_pre), (scan_and_update_registry),
(ensure_current_registry_nonforking),
(ensure_current_registry_forking), (ensure_current_registry),
(init_post), (gst_debug_help), (gst_deinit):
* gst/gst_private.h:
* gst/gstregistry.c: (gst_registry_finalize),
(gst_registry_remove_features_for_plugin_unlocked),
(gst_registry_remove_plugin), (gst_registry_scan_path_level),
(gst_registry_scan_path),
(_priv_gst_registry_remove_cache_plugins),
(_priv_gst_registry_cleanup):
* gst/gstregistry.h:
Re-commit the registry changes, along with an extra fix:
When a cached plugin is encountered at a different file path,
update the stored path in the registry cache so that the parent
process knows where it actually is now when it re-reads the registry
cache. Fixes the thing that broke distcheck with the previous commit.
* tests/check/Makefile.am:
Clean up files named 'core' too when running make clean.
* tests/examples/manual/Makefile.am:
Set up a registry path for running these tests, and clean it properly
for distcheck.
2006-09-28 14:00:43 +00:00
|
|
|
gst_registry_remove_features_for_plugin_unlocked (registry, plugin);
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_UNLOCK (registry);
|
2005-09-18 06:59:25 +00:00
|
|
|
gst_object_unref (plugin);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_registry_add_feature:
|
|
|
|
* @registry: the registry to add the plugin to
|
|
|
|
* @feature: the feature to add
|
|
|
|
*
|
|
|
|
* Add the feature to the registry. The feature-added signal will be emitted.
|
2005-12-02 12:34:47 +00:00
|
|
|
* This function sinks @feature.
|
2005-09-18 06:59:25 +00:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
2005-12-02 12:34:47 +00:00
|
|
|
*
|
|
|
|
* MT safe.
|
2005-09-18 06:59:25 +00:00
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
gst_registry_add_feature (GstRegistry * registry, GstPluginFeature * feature)
|
|
|
|
{
|
|
|
|
GstPluginFeature *existing_feature;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GST_IS_REGISTRY (registry), FALSE);
|
|
|
|
g_return_val_if_fail (GST_IS_PLUGIN_FEATURE (feature), FALSE);
|
|
|
|
g_return_val_if_fail (feature->name != NULL, FALSE);
|
|
|
|
g_return_val_if_fail (feature->plugin_name != NULL, FALSE);
|
|
|
|
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_LOCK (registry);
|
2005-09-18 06:59:25 +00:00
|
|
|
existing_feature = gst_registry_lookup_feature_locked (registry,
|
|
|
|
feature->name);
|
gst/: Use _CAST macros to avoid unneeded type checking.
Original commit message from CVS:
* gst/gst.c: (gst_debug_help):
* gst/gstplugin.c: (gst_plugin_finalize), (gst_plugin_list_free):
* gst/gstpluginfeature.c: (gst_plugin_feature_finalize),
(gst_plugin_feature_list_free):
* gst/gstregistry.c: (gst_registry_add_plugin),
(gst_registry_add_feature), (gst_registry_plugin_filter),
(gst_registry_feature_filter), (gst_registry_find_plugin),
(gst_registry_find_feature), (gst_registry_get_plugin_list),
(gst_registry_lookup_feature_locked), (gst_registry_lookup_locked):
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache), (gst_registry_xml_write_cache):
* gst/gstminiobject.c: (gst_mini_object_unref),
(gst_mini_object_replace), (gst_value_mini_object_free),
(gst_value_mini_object_copy):
Use _CAST macros to avoid unneeded type checking.
Added some more G_UNLIKELY.
2006-06-12 09:17:44 +00:00
|
|
|
if (G_UNLIKELY (existing_feature)) {
|
2007-07-23 11:42:12 +00:00
|
|
|
GST_DEBUG_OBJECT (registry, "replacing existing feature %p (%s)",
|
2005-09-18 06:59:25 +00:00
|
|
|
existing_feature, feature->name);
|
2007-07-31 11:51:38 +00:00
|
|
|
/* Remove the existing feature from the list now, before we insert the new
|
|
|
|
* one, but don't unref yet because the hash is still storing a reference to * it. */
|
2005-09-18 06:59:25 +00:00
|
|
|
registry->features = g_list_remove (registry->features, existing_feature);
|
|
|
|
}
|
|
|
|
|
2005-09-19 14:09:54 +00:00
|
|
|
GST_DEBUG_OBJECT (registry, "adding feature %p (%s)", feature, feature->name);
|
2005-09-18 06:59:25 +00:00
|
|
|
|
|
|
|
registry->features = g_list_prepend (registry->features, feature);
|
2007-07-31 11:51:38 +00:00
|
|
|
g_hash_table_replace (registry->feature_hash, feature->name, feature);
|
|
|
|
|
|
|
|
if (G_UNLIKELY (existing_feature)) {
|
|
|
|
/* We unref now. No need to remove the feature name from the hash table, it * got replaced by the new feature */
|
|
|
|
gst_object_unref (existing_feature);
|
|
|
|
}
|
2005-09-18 06:59:25 +00:00
|
|
|
|
2009-05-02 12:36:50 +00:00
|
|
|
gst_object_ref_sink (feature);
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_UNLOCK (registry);
|
2005-09-18 06:59:25 +00:00
|
|
|
|
2007-02-09 13:41:24 +00:00
|
|
|
GST_LOG_OBJECT (registry, "emitting feature-added for %s", feature->name);
|
2009-05-02 12:43:11 +00:00
|
|
|
g_signal_emit (registry, gst_registry_signals[FEATURE_ADDED], 0, feature);
|
2005-09-18 06:59:25 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_registry_remove_feature:
|
|
|
|
* @registry: the registry to remove the feature from
|
|
|
|
* @feature: the feature to remove
|
|
|
|
*
|
|
|
|
* Remove the feature from the registry.
|
2005-12-02 12:34:47 +00:00
|
|
|
*
|
|
|
|
* MT safe.
|
2005-09-18 06:59:25 +00:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_registry_remove_feature (GstRegistry * registry, GstPluginFeature * feature)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GST_IS_REGISTRY (registry));
|
2006-01-17 12:08:43 +00:00
|
|
|
g_return_if_fail (GST_IS_PLUGIN_FEATURE (feature));
|
|
|
|
|
2005-09-19 14:09:54 +00:00
|
|
|
GST_DEBUG_OBJECT (registry, "removing feature %p (%s)",
|
|
|
|
feature, gst_plugin_feature_get_name (feature));
|
2005-09-18 06:59:25 +00:00
|
|
|
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_LOCK (registry);
|
2005-09-18 06:59:25 +00:00
|
|
|
registry->features = g_list_remove (registry->features, feature);
|
2007-07-23 11:42:12 +00:00
|
|
|
g_hash_table_remove (registry->feature_hash, feature->name);
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_UNLOCK (registry);
|
2005-09-18 06:59:25 +00:00
|
|
|
gst_object_unref (feature);
|
2002-05-08 20:40:48 +00:00
|
|
|
}
|
|
|
|
|
2003-05-06 22:10:29 +00:00
|
|
|
/**
|
|
|
|
* gst_registry_plugin_filter:
|
|
|
|
* @registry: registry to query
|
|
|
|
* @filter: the filter to use
|
|
|
|
* @first: only return first match
|
|
|
|
* @user_data: user data passed to the filter function
|
|
|
|
*
|
2005-12-02 12:34:47 +00:00
|
|
|
* Runs a filter against all plugins in the registry and returns a #GList with
|
2004-03-15 15:16:04 +00:00
|
|
|
* the results. If the first flag is set, only the first match is
|
2003-05-06 22:10:29 +00:00
|
|
|
* returned (as a list with a single object).
|
2005-09-19 14:09:54 +00:00
|
|
|
* Every plugin is reffed; use gst_plugin_list_free() after use, which
|
|
|
|
* will unref again.
|
2003-05-06 22:10:29 +00:00
|
|
|
*
|
2005-12-02 12:34:47 +00:00
|
|
|
* Returns: a #GList of #GstPlugin. Use gst_plugin_list_free() after usage.
|
|
|
|
*
|
|
|
|
* MT safe.
|
2003-05-06 22:10:29 +00:00
|
|
|
*/
|
2004-03-13 15:27:01 +00:00
|
|
|
GList *
|
|
|
|
gst_registry_plugin_filter (GstRegistry * registry,
|
|
|
|
GstPluginFilter filter, gboolean first, gpointer user_data)
|
2003-04-14 18:53:03 +00:00
|
|
|
{
|
2005-09-15 23:51:24 +00:00
|
|
|
GList *list;
|
|
|
|
GList *g;
|
|
|
|
|
2003-04-14 18:53:03 +00:00
|
|
|
g_return_val_if_fail (GST_IS_REGISTRY (registry), NULL);
|
|
|
|
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_LOCK (registry);
|
2005-09-15 23:51:24 +00:00
|
|
|
list = gst_filter_run (registry->plugins, (GstFilterFunc) filter, first,
|
2004-03-13 15:27:01 +00:00
|
|
|
user_data);
|
2005-09-15 23:51:24 +00:00
|
|
|
for (g = list; g; g = g->next) {
|
gst/: Use _CAST macros to avoid unneeded type checking.
Original commit message from CVS:
* gst/gst.c: (gst_debug_help):
* gst/gstplugin.c: (gst_plugin_finalize), (gst_plugin_list_free):
* gst/gstpluginfeature.c: (gst_plugin_feature_finalize),
(gst_plugin_feature_list_free):
* gst/gstregistry.c: (gst_registry_add_plugin),
(gst_registry_add_feature), (gst_registry_plugin_filter),
(gst_registry_feature_filter), (gst_registry_find_plugin),
(gst_registry_find_feature), (gst_registry_get_plugin_list),
(gst_registry_lookup_feature_locked), (gst_registry_lookup_locked):
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache), (gst_registry_xml_write_cache):
* gst/gstminiobject.c: (gst_mini_object_unref),
(gst_mini_object_replace), (gst_value_mini_object_free),
(gst_value_mini_object_copy):
Use _CAST macros to avoid unneeded type checking.
Added some more G_UNLIKELY.
2006-06-12 09:17:44 +00:00
|
|
|
gst_object_ref (GST_PLUGIN_CAST (g->data));
|
2005-09-15 23:51:24 +00:00
|
|
|
}
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_UNLOCK (registry);
|
2005-09-15 23:51:24 +00:00
|
|
|
|
|
|
|
return list;
|
2003-04-14 18:53:03 +00:00
|
|
|
}
|
|
|
|
|
2003-05-06 22:10:29 +00:00
|
|
|
/**
|
|
|
|
* gst_registry_feature_filter:
|
|
|
|
* @registry: registry to query
|
|
|
|
* @filter: the filter to use
|
|
|
|
* @first: only return first match
|
|
|
|
* @user_data: user data passed to the filter function
|
|
|
|
*
|
2004-03-15 15:16:04 +00:00
|
|
|
* Runs a filter against all features of the plugins in the registry
|
|
|
|
* and returns a GList with the results.
|
|
|
|
* If the first flag is set, only the first match is
|
2003-05-06 22:10:29 +00:00
|
|
|
* returned (as a list with a single object).
|
|
|
|
*
|
2008-04-24 06:46:54 +00:00
|
|
|
* Returns: a #GList of #GstPluginFeature. Use gst_plugin_feature_list_free()
|
|
|
|
* after usage.
|
2005-12-02 12:34:47 +00:00
|
|
|
*
|
|
|
|
* MT safe.
|
2003-05-06 22:10:29 +00:00
|
|
|
*/
|
2004-03-13 15:27:01 +00:00
|
|
|
GList *
|
|
|
|
gst_registry_feature_filter (GstRegistry * registry,
|
|
|
|
GstPluginFeatureFilter filter, gboolean first, gpointer user_data)
|
2003-04-14 18:53:03 +00:00
|
|
|
{
|
2005-09-15 23:51:24 +00:00
|
|
|
GList *list;
|
2005-09-18 06:59:25 +00:00
|
|
|
GList *g;
|
2005-09-15 23:51:24 +00:00
|
|
|
|
2003-04-14 18:53:03 +00:00
|
|
|
g_return_val_if_fail (GST_IS_REGISTRY (registry), NULL);
|
|
|
|
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_LOCK (registry);
|
2005-09-18 06:59:25 +00:00
|
|
|
list = gst_filter_run (registry->features, (GstFilterFunc) filter, first,
|
2004-03-13 15:27:01 +00:00
|
|
|
user_data);
|
2005-09-18 06:59:25 +00:00
|
|
|
for (g = list; g; g = g->next) {
|
gst/: Use _CAST macros to avoid unneeded type checking.
Original commit message from CVS:
* gst/gst.c: (gst_debug_help):
* gst/gstplugin.c: (gst_plugin_finalize), (gst_plugin_list_free):
* gst/gstpluginfeature.c: (gst_plugin_feature_finalize),
(gst_plugin_feature_list_free):
* gst/gstregistry.c: (gst_registry_add_plugin),
(gst_registry_add_feature), (gst_registry_plugin_filter),
(gst_registry_feature_filter), (gst_registry_find_plugin),
(gst_registry_find_feature), (gst_registry_get_plugin_list),
(gst_registry_lookup_feature_locked), (gst_registry_lookup_locked):
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache), (gst_registry_xml_write_cache):
* gst/gstminiobject.c: (gst_mini_object_unref),
(gst_mini_object_replace), (gst_value_mini_object_free),
(gst_value_mini_object_copy):
Use _CAST macros to avoid unneeded type checking.
Added some more G_UNLIKELY.
2006-06-12 09:17:44 +00:00
|
|
|
gst_object_ref (GST_PLUGIN_FEATURE_CAST (g->data));
|
2005-09-18 06:59:25 +00:00
|
|
|
}
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_UNLOCK (registry);
|
2005-09-15 23:51:24 +00:00
|
|
|
|
|
|
|
return list;
|
2003-04-14 18:53:03 +00:00
|
|
|
}
|
|
|
|
|
2002-05-10 19:23:18 +00:00
|
|
|
/**
|
|
|
|
* gst_registry_find_plugin:
|
|
|
|
* @registry: the registry to search
|
|
|
|
* @name: the plugin name to find
|
|
|
|
*
|
|
|
|
* Find the plugin with the given name in the registry.
|
2005-09-19 14:09:54 +00:00
|
|
|
* The plugin will be reffed; caller is responsible for unreffing.
|
2002-05-10 19:23:18 +00:00
|
|
|
*
|
|
|
|
* Returns: The plugin with the given name or NULL if the plugin was not found.
|
2005-12-02 12:34:47 +00:00
|
|
|
* gst_object_unref() after usage.
|
|
|
|
*
|
|
|
|
* MT safe.
|
2002-05-10 19:23:18 +00:00
|
|
|
*/
|
2004-03-13 15:27:01 +00:00
|
|
|
GstPlugin *
|
|
|
|
gst_registry_find_plugin (GstRegistry * registry, const gchar * name)
|
2002-05-10 19:23:18 +00:00
|
|
|
{
|
2003-04-14 18:53:03 +00:00
|
|
|
GList *walk;
|
|
|
|
GstPlugin *result = NULL;
|
2003-02-10 20:32:32 +00:00
|
|
|
|
2002-05-10 19:23:18 +00:00
|
|
|
g_return_val_if_fail (GST_IS_REGISTRY (registry), NULL);
|
|
|
|
g_return_val_if_fail (name != NULL, NULL);
|
2003-02-10 20:32:32 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
walk = gst_registry_plugin_filter (registry,
|
|
|
|
(GstPluginFilter) gst_plugin_name_filter, TRUE, (gpointer) name);
|
2005-09-16 00:02:27 +00:00
|
|
|
if (walk) {
|
gst/: Use _CAST macros to avoid unneeded type checking.
Original commit message from CVS:
* gst/gst.c: (gst_debug_help):
* gst/gstplugin.c: (gst_plugin_finalize), (gst_plugin_list_free):
* gst/gstpluginfeature.c: (gst_plugin_feature_finalize),
(gst_plugin_feature_list_free):
* gst/gstregistry.c: (gst_registry_add_plugin),
(gst_registry_add_feature), (gst_registry_plugin_filter),
(gst_registry_feature_filter), (gst_registry_find_plugin),
(gst_registry_find_feature), (gst_registry_get_plugin_list),
(gst_registry_lookup_feature_locked), (gst_registry_lookup_locked):
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache), (gst_registry_xml_write_cache):
* gst/gstminiobject.c: (gst_mini_object_unref),
(gst_mini_object_replace), (gst_value_mini_object_free),
(gst_value_mini_object_copy):
Use _CAST macros to avoid unneeded type checking.
Added some more G_UNLIKELY.
2006-06-12 09:17:44 +00:00
|
|
|
result = GST_PLUGIN_CAST (walk->data);
|
2003-02-10 20:32:32 +00:00
|
|
|
|
2005-09-16 00:02:27 +00:00
|
|
|
gst_object_ref (result);
|
|
|
|
gst_plugin_list_free (walk);
|
|
|
|
}
|
2003-04-14 18:53:03 +00:00
|
|
|
|
|
|
|
return result;
|
2002-05-10 19:23:18 +00:00
|
|
|
}
|
|
|
|
|
2002-05-08 20:40:48 +00:00
|
|
|
/**
|
|
|
|
* gst_registry_find_feature:
|
|
|
|
* @registry: the registry to search
|
|
|
|
* @name: the pluginfeature name to find
|
|
|
|
* @type: the pluginfeature type to find
|
|
|
|
*
|
|
|
|
* Find the pluginfeature with the given name and type in the registry.
|
|
|
|
*
|
2004-03-15 15:16:04 +00:00
|
|
|
* Returns: The pluginfeature with the given name and type or NULL
|
2005-12-02 12:34:47 +00:00
|
|
|
* if the plugin was not found. gst_object_unref() after usage.
|
|
|
|
*
|
|
|
|
* MT safe.
|
2002-05-08 20:40:48 +00:00
|
|
|
*/
|
2004-03-13 15:27:01 +00:00
|
|
|
GstPluginFeature *
|
|
|
|
gst_registry_find_feature (GstRegistry * registry, const gchar * name,
|
|
|
|
GType type)
|
2002-05-08 20:40:48 +00:00
|
|
|
{
|
2003-02-10 20:32:32 +00:00
|
|
|
GstPluginFeature *feature = NULL;
|
2003-04-14 18:53:03 +00:00
|
|
|
GList *walk;
|
|
|
|
GstTypeNameData data;
|
2003-02-10 20:32:32 +00:00
|
|
|
|
2002-05-08 20:40:48 +00:00
|
|
|
g_return_val_if_fail (GST_IS_REGISTRY (registry), NULL);
|
|
|
|
g_return_val_if_fail (name != NULL, NULL);
|
2006-01-17 12:08:43 +00:00
|
|
|
g_return_val_if_fail (g_type_is_a (type, GST_TYPE_PLUGIN_FEATURE), NULL);
|
2003-02-10 20:32:32 +00:00
|
|
|
|
2003-04-14 18:53:03 +00:00
|
|
|
data.name = name;
|
|
|
|
data.type = type;
|
2003-02-10 20:32:32 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
walk = gst_registry_feature_filter (registry,
|
|
|
|
(GstPluginFeatureFilter) gst_plugin_feature_type_name_filter,
|
|
|
|
TRUE, &data);
|
2003-04-14 18:53:03 +00:00
|
|
|
|
2005-09-16 00:02:27 +00:00
|
|
|
if (walk) {
|
gst/: Use _CAST macros to avoid unneeded type checking.
Original commit message from CVS:
* gst/gst.c: (gst_debug_help):
* gst/gstplugin.c: (gst_plugin_finalize), (gst_plugin_list_free):
* gst/gstpluginfeature.c: (gst_plugin_feature_finalize),
(gst_plugin_feature_list_free):
* gst/gstregistry.c: (gst_registry_add_plugin),
(gst_registry_add_feature), (gst_registry_plugin_filter),
(gst_registry_feature_filter), (gst_registry_find_plugin),
(gst_registry_find_feature), (gst_registry_get_plugin_list),
(gst_registry_lookup_feature_locked), (gst_registry_lookup_locked):
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache), (gst_registry_xml_write_cache):
* gst/gstminiobject.c: (gst_mini_object_unref),
(gst_mini_object_replace), (gst_value_mini_object_free),
(gst_value_mini_object_copy):
Use _CAST macros to avoid unneeded type checking.
Added some more G_UNLIKELY.
2006-06-12 09:17:44 +00:00
|
|
|
feature = GST_PLUGIN_FEATURE_CAST (walk->data);
|
2003-04-14 18:53:03 +00:00
|
|
|
|
2005-09-18 06:59:25 +00:00
|
|
|
gst_object_ref (feature);
|
2005-09-16 00:02:27 +00:00
|
|
|
gst_plugin_feature_list_free (walk);
|
|
|
|
}
|
2003-02-10 20:32:32 +00:00
|
|
|
|
|
|
|
return feature;
|
2002-05-08 20:40:48 +00:00
|
|
|
}
|
|
|
|
|
2005-12-02 12:34:47 +00:00
|
|
|
/**
|
|
|
|
* gst_registry_get_feature_list:
|
|
|
|
* @registry: a #GstRegistry
|
|
|
|
* @type: a #GType.
|
|
|
|
*
|
|
|
|
* Retrieves a #GList of #GstPluginFeature of @type.
|
|
|
|
*
|
2008-04-23 13:55:01 +00:00
|
|
|
* Returns: a #GList of #GstPluginFeature of @type. Use
|
|
|
|
* gst_plugin_feature_list_free() after usage.
|
2005-12-02 12:34:47 +00:00
|
|
|
*
|
|
|
|
* MT safe.
|
|
|
|
*/
|
2005-09-15 00:13:26 +00:00
|
|
|
GList *
|
|
|
|
gst_registry_get_feature_list (GstRegistry * registry, GType type)
|
2002-05-08 20:40:48 +00:00
|
|
|
{
|
2005-09-15 14:21:08 +00:00
|
|
|
GstTypeNameData data;
|
2002-12-19 21:31:03 +00:00
|
|
|
|
2006-01-17 12:08:43 +00:00
|
|
|
g_return_val_if_fail (GST_IS_REGISTRY (registry), NULL);
|
|
|
|
g_return_val_if_fail (g_type_is_a (type, GST_TYPE_PLUGIN_FEATURE), NULL);
|
|
|
|
|
2005-09-15 14:21:08 +00:00
|
|
|
data.type = type;
|
|
|
|
data.name = NULL;
|
|
|
|
|
|
|
|
return gst_registry_feature_filter (registry,
|
|
|
|
(GstPluginFeatureFilter) gst_plugin_feature_type_name_filter,
|
|
|
|
FALSE, &data);
|
2005-09-15 00:13:26 +00:00
|
|
|
}
|
2002-05-08 20:40:48 +00:00
|
|
|
|
2005-11-04 15:02:48 +00:00
|
|
|
/**
|
|
|
|
* gst_registry_get_plugin_list:
|
|
|
|
* @registry: the registry to search
|
|
|
|
*
|
2005-12-02 12:34:47 +00:00
|
|
|
* Get a copy of all plugins registered in the given registry. The refcount
|
|
|
|
* of each element in the list in incremented.
|
2005-11-04 15:02:48 +00:00
|
|
|
*
|
2008-04-23 13:55:01 +00:00
|
|
|
* Returns: a #GList of #GstPlugin. Use gst_plugin_list_free() after usage.
|
2005-12-02 12:34:47 +00:00
|
|
|
*
|
|
|
|
* MT safe.
|
2005-11-04 15:02:48 +00:00
|
|
|
*/
|
2005-09-15 00:13:26 +00:00
|
|
|
GList *
|
|
|
|
gst_registry_get_plugin_list (GstRegistry * registry)
|
|
|
|
{
|
2005-09-15 23:51:24 +00:00
|
|
|
GList *list;
|
|
|
|
GList *g;
|
|
|
|
|
2006-01-17 12:08:43 +00:00
|
|
|
g_return_val_if_fail (GST_IS_REGISTRY (registry), NULL);
|
|
|
|
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_LOCK (registry);
|
2005-09-15 23:51:24 +00:00
|
|
|
list = g_list_copy (registry->plugins);
|
|
|
|
for (g = list; g; g = g->next) {
|
gst/: Use _CAST macros to avoid unneeded type checking.
Original commit message from CVS:
* gst/gst.c: (gst_debug_help):
* gst/gstplugin.c: (gst_plugin_finalize), (gst_plugin_list_free):
* gst/gstpluginfeature.c: (gst_plugin_feature_finalize),
(gst_plugin_feature_list_free):
* gst/gstregistry.c: (gst_registry_add_plugin),
(gst_registry_add_feature), (gst_registry_plugin_filter),
(gst_registry_feature_filter), (gst_registry_find_plugin),
(gst_registry_find_feature), (gst_registry_get_plugin_list),
(gst_registry_lookup_feature_locked), (gst_registry_lookup_locked):
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache), (gst_registry_xml_write_cache):
* gst/gstminiobject.c: (gst_mini_object_unref),
(gst_mini_object_replace), (gst_value_mini_object_free),
(gst_value_mini_object_copy):
Use _CAST macros to avoid unneeded type checking.
Added some more G_UNLIKELY.
2006-06-12 09:17:44 +00:00
|
|
|
gst_object_ref (GST_PLUGIN_CAST (g->data));
|
2005-09-15 23:51:24 +00:00
|
|
|
}
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_UNLOCK (registry);
|
2005-09-15 23:51:24 +00:00
|
|
|
|
|
|
|
return list;
|
2005-09-15 00:13:26 +00:00
|
|
|
}
|
2002-12-19 21:31:03 +00:00
|
|
|
|
2005-09-18 06:59:25 +00:00
|
|
|
static GstPluginFeature *
|
|
|
|
gst_registry_lookup_feature_locked (GstRegistry * registry, const char *name)
|
|
|
|
{
|
gst/: Use _CAST macros to avoid unneeded type checking.
Original commit message from CVS:
* gst/gst.c: (gst_debug_help):
* gst/gstplugin.c: (gst_plugin_finalize), (gst_plugin_list_free):
* gst/gstpluginfeature.c: (gst_plugin_feature_finalize),
(gst_plugin_feature_list_free):
* gst/gstregistry.c: (gst_registry_add_plugin),
(gst_registry_add_feature), (gst_registry_plugin_filter),
(gst_registry_feature_filter), (gst_registry_find_plugin),
(gst_registry_find_feature), (gst_registry_get_plugin_list),
(gst_registry_lookup_feature_locked), (gst_registry_lookup_locked):
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache), (gst_registry_xml_write_cache):
* gst/gstminiobject.c: (gst_mini_object_unref),
(gst_mini_object_replace), (gst_value_mini_object_free),
(gst_value_mini_object_copy):
Use _CAST macros to avoid unneeded type checking.
Added some more G_UNLIKELY.
2006-06-12 09:17:44 +00:00
|
|
|
if (G_UNLIKELY (name == NULL))
|
2005-09-18 06:59:25 +00:00
|
|
|
return NULL;
|
|
|
|
|
2007-07-23 11:42:12 +00:00
|
|
|
return g_hash_table_lookup (registry->feature_hash, name);
|
2005-09-18 06:59:25 +00:00
|
|
|
}
|
|
|
|
|
2005-12-02 12:34:47 +00:00
|
|
|
/**
|
|
|
|
* gst_registry_lookup_feature:
|
|
|
|
* @registry: a #GstRegistry
|
|
|
|
* @name: a #GstPluginFeature name
|
|
|
|
*
|
|
|
|
* Find a #GstPluginFeature with @name in @registry.
|
2007-05-11 08:29:10 +00:00
|
|
|
*
|
2005-12-02 12:34:47 +00:00
|
|
|
* Returns: a #GstPluginFeature with its refcount incremented, use
|
|
|
|
* gst_object_unref() after usage.
|
|
|
|
*
|
|
|
|
* MT safe.
|
|
|
|
*/
|
2005-09-18 06:59:25 +00:00
|
|
|
GstPluginFeature *
|
|
|
|
gst_registry_lookup_feature (GstRegistry * registry, const char *name)
|
|
|
|
{
|
|
|
|
GstPluginFeature *feature;
|
|
|
|
|
2006-01-17 12:08:43 +00:00
|
|
|
g_return_val_if_fail (GST_IS_REGISTRY (registry), NULL);
|
|
|
|
g_return_val_if_fail (name != NULL, NULL);
|
|
|
|
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_LOCK (registry);
|
2005-09-18 06:59:25 +00:00
|
|
|
feature = gst_registry_lookup_feature_locked (registry, name);
|
|
|
|
if (feature)
|
|
|
|
gst_object_ref (feature);
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_UNLOCK (registry);
|
2005-09-18 06:59:25 +00:00
|
|
|
|
|
|
|
return feature;
|
|
|
|
}
|
|
|
|
|
2005-09-15 23:51:24 +00:00
|
|
|
static GstPlugin *
|
|
|
|
gst_registry_lookup_locked (GstRegistry * registry, const char *filename)
|
2005-09-15 00:13:26 +00:00
|
|
|
{
|
|
|
|
GList *g;
|
|
|
|
GstPlugin *plugin;
|
2005-10-08 13:57:17 +00:00
|
|
|
gchar *basename;
|
2005-09-15 00:13:26 +00:00
|
|
|
|
gst/: Use _CAST macros to avoid unneeded type checking.
Original commit message from CVS:
* gst/gst.c: (gst_debug_help):
* gst/gstplugin.c: (gst_plugin_finalize), (gst_plugin_list_free):
* gst/gstpluginfeature.c: (gst_plugin_feature_finalize),
(gst_plugin_feature_list_free):
* gst/gstregistry.c: (gst_registry_add_plugin),
(gst_registry_add_feature), (gst_registry_plugin_filter),
(gst_registry_feature_filter), (gst_registry_find_plugin),
(gst_registry_find_feature), (gst_registry_get_plugin_list),
(gst_registry_lookup_feature_locked), (gst_registry_lookup_locked):
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache), (gst_registry_xml_write_cache):
* gst/gstminiobject.c: (gst_mini_object_unref),
(gst_mini_object_replace), (gst_value_mini_object_free),
(gst_value_mini_object_copy):
Use _CAST macros to avoid unneeded type checking.
Added some more G_UNLIKELY.
2006-06-12 09:17:44 +00:00
|
|
|
if (G_UNLIKELY (filename == NULL))
|
2005-09-15 23:51:24 +00:00
|
|
|
return NULL;
|
|
|
|
|
2005-10-08 13:57:17 +00:00
|
|
|
basename = g_path_get_basename (filename);
|
commit binary registry (disabled by default, see #359653)
Original commit message from CVS:
* configure.ac:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstregistry.c: (gst_registry_lookup_feature_locked),
(gst_registry_lookup_locked):
* gst/gstregistry.h:
* gst/gstregistrybinary.c: (gst_registry_binary_write),
(gst_registry_binary_initialize_magic),
(gst_registry_binary_save_string),
(gst_registry_binary_save_pad_template),
(gst_registry_binary_save_feature),
(gst_registry_binary_save_plugin),
(gst_registry_binary_write_cache),
(gst_registry_binary_check_magic),
(gst_registry_binary_load_pad_template),
(gst_registry_binary_load_feature),
(gst_registry_binary_load_plugin),
(gst_registry_binary_read_cache):
* gst/gstregistrybinary.h:
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache):
commit binary registry (disabled by default, see #359653)
2007-01-11 13:45:51 +00:00
|
|
|
/* FIXME: use GTree speed up lookups */
|
2005-09-15 00:13:26 +00:00
|
|
|
for (g = registry->plugins; g; g = g_list_next (g)) {
|
gst/: Use _CAST macros to avoid unneeded type checking.
Original commit message from CVS:
* gst/gst.c: (gst_debug_help):
* gst/gstplugin.c: (gst_plugin_finalize), (gst_plugin_list_free):
* gst/gstpluginfeature.c: (gst_plugin_feature_finalize),
(gst_plugin_feature_list_free):
* gst/gstregistry.c: (gst_registry_add_plugin),
(gst_registry_add_feature), (gst_registry_plugin_filter),
(gst_registry_feature_filter), (gst_registry_find_plugin),
(gst_registry_find_feature), (gst_registry_get_plugin_list),
(gst_registry_lookup_feature_locked), (gst_registry_lookup_locked):
* gst/gstregistryxml.c: (load_feature),
(gst_registry_xml_read_cache), (gst_registry_xml_write_cache):
* gst/gstminiobject.c: (gst_mini_object_unref),
(gst_mini_object_replace), (gst_value_mini_object_free),
(gst_value_mini_object_copy):
Use _CAST macros to avoid unneeded type checking.
Added some more G_UNLIKELY.
2006-06-12 09:17:44 +00:00
|
|
|
plugin = GST_PLUGIN_CAST (g->data);
|
2005-10-08 13:57:17 +00:00
|
|
|
if (plugin->basename && strcmp (basename, plugin->basename) == 0) {
|
|
|
|
g_free (basename);
|
2005-09-15 00:13:26 +00:00
|
|
|
return plugin;
|
|
|
|
}
|
|
|
|
}
|
2002-05-08 20:40:48 +00:00
|
|
|
|
2005-10-08 13:57:17 +00:00
|
|
|
g_free (basename);
|
2005-09-15 00:13:26 +00:00
|
|
|
return NULL;
|
2002-05-08 20:40:48 +00:00
|
|
|
}
|
|
|
|
|
2005-09-19 14:09:54 +00:00
|
|
|
/**
|
|
|
|
* gst_registry_lookup:
|
|
|
|
* @registry: the registry to look up in
|
|
|
|
* @filename: the name of the file to look up
|
|
|
|
*
|
|
|
|
* Look up a plugin in the given registry with the given filename.
|
2005-12-02 12:34:47 +00:00
|
|
|
* If found, plugin is reffed.
|
2005-09-19 14:09:54 +00:00
|
|
|
*
|
2005-12-02 12:34:47 +00:00
|
|
|
* Returns: the #GstPlugin if found, or NULL if not. gst_object_unref()
|
|
|
|
* after usage.
|
2005-09-19 14:09:54 +00:00
|
|
|
*/
|
2005-09-15 23:51:24 +00:00
|
|
|
GstPlugin *
|
|
|
|
gst_registry_lookup (GstRegistry * registry, const char *filename)
|
|
|
|
{
|
|
|
|
GstPlugin *plugin;
|
|
|
|
|
2006-01-17 12:08:43 +00:00
|
|
|
g_return_val_if_fail (GST_IS_REGISTRY (registry), NULL);
|
|
|
|
g_return_val_if_fail (filename != NULL, NULL);
|
|
|
|
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_LOCK (registry);
|
2005-09-15 23:51:24 +00:00
|
|
|
plugin = gst_registry_lookup_locked (registry, filename);
|
2005-09-18 06:59:25 +00:00
|
|
|
if (plugin)
|
|
|
|
gst_object_ref (plugin);
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_UNLOCK (registry);
|
2005-09-15 23:51:24 +00:00
|
|
|
|
|
|
|
return plugin;
|
|
|
|
}
|
|
|
|
|
2006-04-28 20:47:23 +00:00
|
|
|
static gboolean
|
2005-09-15 00:13:26 +00:00
|
|
|
gst_registry_scan_path_level (GstRegistry * registry, const gchar * path,
|
|
|
|
int level)
|
2002-05-08 20:40:48 +00:00
|
|
|
{
|
2005-09-15 00:13:26 +00:00
|
|
|
GDir *dir;
|
|
|
|
const gchar *dirent;
|
|
|
|
gchar *filename;
|
|
|
|
GstPlugin *plugin;
|
2005-09-18 06:59:25 +00:00
|
|
|
GstPlugin *newplugin;
|
2006-04-28 20:47:23 +00:00
|
|
|
gboolean changed = FALSE;
|
2002-05-08 20:40:48 +00:00
|
|
|
|
2005-09-15 00:13:26 +00:00
|
|
|
dir = g_dir_open (path, 0, NULL);
|
|
|
|
if (!dir)
|
2006-04-28 20:47:23 +00:00
|
|
|
return FALSE;
|
2002-12-19 21:31:03 +00:00
|
|
|
|
2005-09-15 00:13:26 +00:00
|
|
|
while ((dirent = g_dir_read_name (dir))) {
|
2008-11-24 09:59:07 +00:00
|
|
|
struct stat file_status;
|
|
|
|
|
2005-09-15 00:13:26 +00:00
|
|
|
filename = g_strjoin ("/", path, dirent, NULL);
|
2008-11-24 09:59:07 +00:00
|
|
|
if (g_stat (filename, &file_status) < 0) {
|
|
|
|
/* Plugin will be removed from cache after the scan completes if it
|
|
|
|
* is still marked 'cached' */
|
|
|
|
g_free (filename);
|
|
|
|
continue;
|
|
|
|
}
|
2005-09-15 00:13:26 +00:00
|
|
|
|
2008-11-24 09:59:07 +00:00
|
|
|
if (file_status.st_mode & S_IFDIR) {
|
2008-05-30 07:36:17 +00:00
|
|
|
/* skip the .debug directory, these contain elf files that are not
|
|
|
|
* useful or worse, can crash dlopen () */
|
2009-03-26 14:44:04 +00:00
|
|
|
if (g_str_equal (dirent, ".debug") || g_str_equal (dirent, ".git")) {
|
|
|
|
GST_LOG_OBJECT (registry, "ignoring .debug or .git directory");
|
2008-05-30 07:36:17 +00:00
|
|
|
g_free (filename);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
/* FIXME 0.11: Don't recurse into directories, this behaviour
|
|
|
|
* is inconsistent with other PATH environment variables
|
|
|
|
*/
|
2005-09-15 00:13:26 +00:00
|
|
|
if (level > 0) {
|
2008-05-03 19:13:47 +00:00
|
|
|
GST_LOG_OBJECT (registry, "recursing into directory %s", filename);
|
2006-04-28 20:47:23 +00:00
|
|
|
changed |= gst_registry_scan_path_level (registry, filename, level - 1);
|
2005-09-15 00:13:26 +00:00
|
|
|
} else {
|
2008-05-03 19:13:47 +00:00
|
|
|
GST_LOG_OBJECT (registry, "not recursing into directory %s, "
|
|
|
|
"recursion level too deep", filename);
|
2005-09-15 00:13:26 +00:00
|
|
|
}
|
|
|
|
g_free (filename);
|
|
|
|
continue;
|
|
|
|
}
|
2008-11-24 09:59:07 +00:00
|
|
|
if (!(file_status.st_mode & S_IFREG)) {
|
2008-05-03 19:13:47 +00:00
|
|
|
GST_LOG_OBJECT (registry, "%s is not a regular file, ignoring", filename);
|
2005-09-15 00:13:26 +00:00
|
|
|
g_free (filename);
|
|
|
|
continue;
|
|
|
|
}
|
2008-05-01 13:03:51 +00:00
|
|
|
if (!g_str_has_suffix (dirent, G_MODULE_SUFFIX)
|
2008-03-31 13:47:22 +00:00
|
|
|
#ifdef GST_EXTRA_MODULE_SUFFIX
|
2008-05-01 13:03:51 +00:00
|
|
|
&& !g_str_has_suffix (dirent, GST_EXTRA_MODULE_SUFFIX)
|
2008-03-31 13:47:22 +00:00
|
|
|
#endif
|
|
|
|
) {
|
2008-05-03 19:13:47 +00:00
|
|
|
GST_LOG_OBJECT (registry, "extension is not recognized as module file, "
|
|
|
|
"ignoring file %s", filename);
|
2005-09-15 00:13:26 +00:00
|
|
|
g_free (filename);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2008-05-03 19:13:47 +00:00
|
|
|
GST_LOG_OBJECT (registry, "file %s looks like a possible module", filename);
|
|
|
|
|
2005-10-08 13:57:17 +00:00
|
|
|
/* plug-ins are considered unique by basename; if the given name
|
|
|
|
* was already seen by the registry, we ignore it */
|
2005-09-15 00:13:26 +00:00
|
|
|
plugin = gst_registry_lookup (registry, filename);
|
|
|
|
if (plugin) {
|
Add API for making a GStreamer plugin 'dependent' on external files, directories or environment variables, so that GS...
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt::
* gst/gst_private.h: (GstPluginDep), (_GstPluginPrivate):
* gst/gstplugin.c: (gst_plugin_init), (gst_plugin_finalize),
(gst_plugin_class_init), (gst_plugin_list_free),
(gst_plugin_ext_dep_get_env_vars_hash),
(_priv_plugin_deps_env_vars_changed),
(gst_plugin_ext_dep_extract_env_vars_paths),
(gst_plugin_ext_dep_get_hash_from_stat_entry),
(gst_plugin_ext_dep_direntry_matches),
(gst_plugin_ext_dep_scan_dir_and_match_names),
(gst_plugin_ext_dep_scan_path_with_filenames),
(gst_plugin_ext_dep_get_stat_hash),
(_priv_plugin_deps_files_changed), (gst_plugin_ext_dep_free),
(gst_plugin_ext_dep_strv_equal), (gst_plugin_ext_dep_equals),
(gst_plugin_add_dependency), (gst_plugin_add_dependency_simple):
* gst/gstplugin.h: (GstPluginPrivate), (GstPluginFlags),
(GST_PLUGIN_DEPENDENCY_FLAG_NONE),
(GST_PLUGIN_DEPENDENCY_FLAG_RECURSE),
(GST_PLUGIN_DEPENDENCY_FLAG_PATHS_ARE_DEFAULT_ONLY),
(GST_PLUGIN_DEPENDENCY_FLAG_FILE_NAME_IS_SUFFIX),
(GstPluginDependencyFlags), (GstPluginFilter):
* gst/gstregistry.c: (gst_registry_scan_path_level):
* gst/gstregistrybinary.c: (gst_registry_binary_save_feature),
(gst_registry_binary_save_plugin_dep),
(gst_registry_binary_save_plugin),
(gst_registry_binary_load_feature),
(gst_registry_binary_load_plugin_dep_strv),
(gst_registry_binary_load_plugin_dep),
(gst_registry_binary_load_plugin):
* gst/gstregistrybinary.h: (GST_MAGIC_BINARY_VERSION_STR),
(GstBinaryPluginElement), (_GstBinaryDep), (GstBinaryDep):
* gst/gstregistryxml.c: (gst_registry_xml_save_plugin):
Add API for making a GStreamer plugin 'dependent' on external files,
directories or environment variables, so that GStreamer knows when
it needs to re-load GStreamer plugins that wrap other plugin systems.
Fixes bug #350477.
API: add gst_plugin_add_dependency()
API: add gst_plugin_add_dependency_simple()
2009-01-06 17:58:59 +00:00
|
|
|
gboolean env_vars_changed, deps_changed = FALSE;
|
|
|
|
|
2005-10-08 13:57:17 +00:00
|
|
|
if (plugin->registered) {
|
2005-10-11 16:05:16 +00:00
|
|
|
GST_DEBUG_OBJECT (registry,
|
|
|
|
"plugin already registered from path \"%s\"",
|
|
|
|
GST_STR_NULL (plugin->filename));
|
2005-10-08 14:41:56 +00:00
|
|
|
g_free (filename);
|
2005-10-18 07:13:25 +00:00
|
|
|
gst_object_unref (plugin);
|
2005-10-08 13:57:17 +00:00
|
|
|
continue;
|
|
|
|
}
|
Add API for making a GStreamer plugin 'dependent' on external files, directories or environment variables, so that GS...
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt::
* gst/gst_private.h: (GstPluginDep), (_GstPluginPrivate):
* gst/gstplugin.c: (gst_plugin_init), (gst_plugin_finalize),
(gst_plugin_class_init), (gst_plugin_list_free),
(gst_plugin_ext_dep_get_env_vars_hash),
(_priv_plugin_deps_env_vars_changed),
(gst_plugin_ext_dep_extract_env_vars_paths),
(gst_plugin_ext_dep_get_hash_from_stat_entry),
(gst_plugin_ext_dep_direntry_matches),
(gst_plugin_ext_dep_scan_dir_and_match_names),
(gst_plugin_ext_dep_scan_path_with_filenames),
(gst_plugin_ext_dep_get_stat_hash),
(_priv_plugin_deps_files_changed), (gst_plugin_ext_dep_free),
(gst_plugin_ext_dep_strv_equal), (gst_plugin_ext_dep_equals),
(gst_plugin_add_dependency), (gst_plugin_add_dependency_simple):
* gst/gstplugin.h: (GstPluginPrivate), (GstPluginFlags),
(GST_PLUGIN_DEPENDENCY_FLAG_NONE),
(GST_PLUGIN_DEPENDENCY_FLAG_RECURSE),
(GST_PLUGIN_DEPENDENCY_FLAG_PATHS_ARE_DEFAULT_ONLY),
(GST_PLUGIN_DEPENDENCY_FLAG_FILE_NAME_IS_SUFFIX),
(GstPluginDependencyFlags), (GstPluginFilter):
* gst/gstregistry.c: (gst_registry_scan_path_level):
* gst/gstregistrybinary.c: (gst_registry_binary_save_feature),
(gst_registry_binary_save_plugin_dep),
(gst_registry_binary_save_plugin),
(gst_registry_binary_load_feature),
(gst_registry_binary_load_plugin_dep_strv),
(gst_registry_binary_load_plugin_dep),
(gst_registry_binary_load_plugin):
* gst/gstregistrybinary.h: (GST_MAGIC_BINARY_VERSION_STR),
(GstBinaryPluginElement), (_GstBinaryDep), (GstBinaryDep):
* gst/gstregistryxml.c: (gst_registry_xml_save_plugin):
Add API for making a GStreamer plugin 'dependent' on external files,
directories or environment variables, so that GStreamer knows when
it needs to re-load GStreamer plugins that wrap other plugin systems.
Fixes bug #350477.
API: add gst_plugin_add_dependency()
API: add gst_plugin_add_dependency_simple()
2009-01-06 17:58:59 +00:00
|
|
|
|
|
|
|
env_vars_changed = _priv_plugin_deps_env_vars_changed (plugin);
|
|
|
|
|
2005-09-15 00:13:26 +00:00
|
|
|
if (plugin->file_mtime == file_status.st_mtime &&
|
Add API for making a GStreamer plugin 'dependent' on external files, directories or environment variables, so that GS...
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt::
* gst/gst_private.h: (GstPluginDep), (_GstPluginPrivate):
* gst/gstplugin.c: (gst_plugin_init), (gst_plugin_finalize),
(gst_plugin_class_init), (gst_plugin_list_free),
(gst_plugin_ext_dep_get_env_vars_hash),
(_priv_plugin_deps_env_vars_changed),
(gst_plugin_ext_dep_extract_env_vars_paths),
(gst_plugin_ext_dep_get_hash_from_stat_entry),
(gst_plugin_ext_dep_direntry_matches),
(gst_plugin_ext_dep_scan_dir_and_match_names),
(gst_plugin_ext_dep_scan_path_with_filenames),
(gst_plugin_ext_dep_get_stat_hash),
(_priv_plugin_deps_files_changed), (gst_plugin_ext_dep_free),
(gst_plugin_ext_dep_strv_equal), (gst_plugin_ext_dep_equals),
(gst_plugin_add_dependency), (gst_plugin_add_dependency_simple):
* gst/gstplugin.h: (GstPluginPrivate), (GstPluginFlags),
(GST_PLUGIN_DEPENDENCY_FLAG_NONE),
(GST_PLUGIN_DEPENDENCY_FLAG_RECURSE),
(GST_PLUGIN_DEPENDENCY_FLAG_PATHS_ARE_DEFAULT_ONLY),
(GST_PLUGIN_DEPENDENCY_FLAG_FILE_NAME_IS_SUFFIX),
(GstPluginDependencyFlags), (GstPluginFilter):
* gst/gstregistry.c: (gst_registry_scan_path_level):
* gst/gstregistrybinary.c: (gst_registry_binary_save_feature),
(gst_registry_binary_save_plugin_dep),
(gst_registry_binary_save_plugin),
(gst_registry_binary_load_feature),
(gst_registry_binary_load_plugin_dep_strv),
(gst_registry_binary_load_plugin_dep),
(gst_registry_binary_load_plugin):
* gst/gstregistrybinary.h: (GST_MAGIC_BINARY_VERSION_STR),
(GstBinaryPluginElement), (_GstBinaryDep), (GstBinaryDep):
* gst/gstregistryxml.c: (gst_registry_xml_save_plugin):
Add API for making a GStreamer plugin 'dependent' on external files,
directories or environment variables, so that GStreamer knows when
it needs to re-load GStreamer plugins that wrap other plugin systems.
Fixes bug #350477.
API: add gst_plugin_add_dependency()
API: add gst_plugin_add_dependency_simple()
2009-01-06 17:58:59 +00:00
|
|
|
plugin->file_size == file_status.st_size && !env_vars_changed &&
|
|
|
|
!(deps_changed = _priv_plugin_deps_files_changed (plugin))) {
|
2007-02-09 13:41:24 +00:00
|
|
|
GST_LOG_OBJECT (registry, "file %s cached", filename);
|
2005-09-15 00:13:26 +00:00
|
|
|
plugin->flags &= ~GST_PLUGIN_FLAG_CACHED;
|
2007-02-09 13:41:24 +00:00
|
|
|
GST_LOG_OBJECT (registry, "marking plugin %p as registered as %s",
|
gst/: Re-commit the registry changes, along with an extra fix:
Original commit message from CVS:
* gst/gst.c: (init_pre), (scan_and_update_registry),
(ensure_current_registry_nonforking),
(ensure_current_registry_forking), (ensure_current_registry),
(init_post), (gst_debug_help), (gst_deinit):
* gst/gst_private.h:
* gst/gstregistry.c: (gst_registry_finalize),
(gst_registry_remove_features_for_plugin_unlocked),
(gst_registry_remove_plugin), (gst_registry_scan_path_level),
(gst_registry_scan_path),
(_priv_gst_registry_remove_cache_plugins),
(_priv_gst_registry_cleanup):
* gst/gstregistry.h:
Re-commit the registry changes, along with an extra fix:
When a cached plugin is encountered at a different file path,
update the stored path in the registry cache so that the parent
process knows where it actually is now when it re-reads the registry
cache. Fixes the thing that broke distcheck with the previous commit.
* tests/check/Makefile.am:
Clean up files named 'core' too when running make clean.
* tests/examples/manual/Makefile.am:
Set up a registry path for running these tests, and clean it properly
for distcheck.
2006-09-28 14:00:43 +00:00
|
|
|
plugin, filename);
|
2005-11-02 15:34:23 +00:00
|
|
|
plugin->registered = TRUE;
|
2007-05-11 08:29:10 +00:00
|
|
|
/* Update the file path on which we've seen this cached plugin
|
gst/: Re-commit the registry changes, along with an extra fix:
Original commit message from CVS:
* gst/gst.c: (init_pre), (scan_and_update_registry),
(ensure_current_registry_nonforking),
(ensure_current_registry_forking), (ensure_current_registry),
(init_post), (gst_debug_help), (gst_deinit):
* gst/gst_private.h:
* gst/gstregistry.c: (gst_registry_finalize),
(gst_registry_remove_features_for_plugin_unlocked),
(gst_registry_remove_plugin), (gst_registry_scan_path_level),
(gst_registry_scan_path),
(_priv_gst_registry_remove_cache_plugins),
(_priv_gst_registry_cleanup):
* gst/gstregistry.h:
Re-commit the registry changes, along with an extra fix:
When a cached plugin is encountered at a different file path,
update the stored path in the registry cache so that the parent
process knows where it actually is now when it re-reads the registry
cache. Fixes the thing that broke distcheck with the previous commit.
* tests/check/Makefile.am:
Clean up files named 'core' too when running make clean.
* tests/examples/manual/Makefile.am:
Set up a registry path for running these tests, and clean it properly
for distcheck.
2006-09-28 14:00:43 +00:00
|
|
|
* to ensure the registry cache will reflect up to date information */
|
|
|
|
if (strcmp (plugin->filename, filename) != 0) {
|
|
|
|
g_free (plugin->filename);
|
|
|
|
plugin->filename = g_strdup (filename);
|
|
|
|
changed = TRUE;
|
|
|
|
}
|
2005-09-15 00:13:26 +00:00
|
|
|
} else {
|
2005-10-08 06:49:09 +00:00
|
|
|
GST_INFO_OBJECT (registry, "cached info for %s is stale", filename);
|
|
|
|
GST_DEBUG_OBJECT (registry, "mtime %ld != %ld or size %"
|
Add API for making a GStreamer plugin 'dependent' on external files, directories or environment variables, so that GS...
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt::
* gst/gst_private.h: (GstPluginDep), (_GstPluginPrivate):
* gst/gstplugin.c: (gst_plugin_init), (gst_plugin_finalize),
(gst_plugin_class_init), (gst_plugin_list_free),
(gst_plugin_ext_dep_get_env_vars_hash),
(_priv_plugin_deps_env_vars_changed),
(gst_plugin_ext_dep_extract_env_vars_paths),
(gst_plugin_ext_dep_get_hash_from_stat_entry),
(gst_plugin_ext_dep_direntry_matches),
(gst_plugin_ext_dep_scan_dir_and_match_names),
(gst_plugin_ext_dep_scan_path_with_filenames),
(gst_plugin_ext_dep_get_stat_hash),
(_priv_plugin_deps_files_changed), (gst_plugin_ext_dep_free),
(gst_plugin_ext_dep_strv_equal), (gst_plugin_ext_dep_equals),
(gst_plugin_add_dependency), (gst_plugin_add_dependency_simple):
* gst/gstplugin.h: (GstPluginPrivate), (GstPluginFlags),
(GST_PLUGIN_DEPENDENCY_FLAG_NONE),
(GST_PLUGIN_DEPENDENCY_FLAG_RECURSE),
(GST_PLUGIN_DEPENDENCY_FLAG_PATHS_ARE_DEFAULT_ONLY),
(GST_PLUGIN_DEPENDENCY_FLAG_FILE_NAME_IS_SUFFIX),
(GstPluginDependencyFlags), (GstPluginFilter):
* gst/gstregistry.c: (gst_registry_scan_path_level):
* gst/gstregistrybinary.c: (gst_registry_binary_save_feature),
(gst_registry_binary_save_plugin_dep),
(gst_registry_binary_save_plugin),
(gst_registry_binary_load_feature),
(gst_registry_binary_load_plugin_dep_strv),
(gst_registry_binary_load_plugin_dep),
(gst_registry_binary_load_plugin):
* gst/gstregistrybinary.h: (GST_MAGIC_BINARY_VERSION_STR),
(GstBinaryPluginElement), (_GstBinaryDep), (GstBinaryDep):
* gst/gstregistryxml.c: (gst_registry_xml_save_plugin):
Add API for making a GStreamer plugin 'dependent' on external files,
directories or environment variables, so that GStreamer knows when
it needs to re-load GStreamer plugins that wrap other plugin systems.
Fixes bug #350477.
API: add gst_plugin_add_dependency()
API: add gst_plugin_add_dependency_simple()
2009-01-06 17:58:59 +00:00
|
|
|
G_GINT64_FORMAT " != %" G_GINT64_FORMAT " or external dependency "
|
|
|
|
"env_vars changed: %d or external dependencies changed: %d",
|
|
|
|
plugin->file_mtime, file_status.st_mtime,
|
|
|
|
(gint64) plugin->file_size, (gint64) file_status.st_size,
|
|
|
|
env_vars_changed, deps_changed);
|
2005-09-15 00:13:26 +00:00
|
|
|
gst_registry_remove_plugin (gst_registry_get_default (), plugin);
|
2007-05-11 10:56:48 +00:00
|
|
|
/* We don't use a GError here because a failure to load some shared
|
|
|
|
* objects as plugins is normal (particularly in the uninstalled case)
|
|
|
|
*/
|
|
|
|
newplugin = gst_plugin_load_file (filename, NULL);
|
2005-11-02 15:34:23 +00:00
|
|
|
if (newplugin) {
|
|
|
|
GST_DEBUG_OBJECT (registry, "marking new plugin %p as registered",
|
|
|
|
newplugin);
|
|
|
|
newplugin->registered = TRUE;
|
2005-09-18 09:15:10 +00:00
|
|
|
gst_object_unref (newplugin);
|
2005-11-02 15:34:23 +00:00
|
|
|
}
|
2006-04-28 20:47:23 +00:00
|
|
|
changed = TRUE;
|
2005-09-15 00:13:26 +00:00
|
|
|
}
|
2005-09-18 06:59:25 +00:00
|
|
|
gst_object_unref (plugin);
|
2005-09-15 00:13:26 +00:00
|
|
|
|
|
|
|
} else {
|
2005-10-08 13:57:17 +00:00
|
|
|
GST_DEBUG_OBJECT (registry, "file %s not yet in registry", filename);
|
2007-05-11 10:56:48 +00:00
|
|
|
newplugin = gst_plugin_load_file (filename, NULL);
|
2005-10-08 13:57:17 +00:00
|
|
|
if (newplugin) {
|
|
|
|
newplugin->registered = TRUE;
|
2005-09-18 09:15:10 +00:00
|
|
|
gst_object_unref (newplugin);
|
2006-04-28 20:47:23 +00:00
|
|
|
changed = TRUE;
|
2005-10-08 13:57:17 +00:00
|
|
|
}
|
2005-09-15 00:13:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
g_free (filename);
|
|
|
|
}
|
2002-05-08 20:40:48 +00:00
|
|
|
|
2005-09-15 00:13:26 +00:00
|
|
|
g_dir_close (dir);
|
2006-04-28 20:47:23 +00:00
|
|
|
|
|
|
|
return changed;
|
2002-05-08 20:40:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2005-09-15 00:13:26 +00:00
|
|
|
* gst_registry_scan_path:
|
|
|
|
* @registry: the registry to add the path to
|
|
|
|
* @path: the path to add to the registry
|
2002-05-08 20:40:48 +00:00
|
|
|
*
|
2005-09-15 00:13:26 +00:00
|
|
|
* Add the given path to the registry. The syntax of the
|
|
|
|
* path is specific to the registry. If the path has already been
|
|
|
|
* added, do nothing.
|
2006-04-28 20:47:23 +00:00
|
|
|
*
|
|
|
|
* Returns: %TRUE if registry changed
|
2002-05-08 20:40:48 +00:00
|
|
|
*/
|
2006-04-28 20:47:23 +00:00
|
|
|
gboolean
|
2005-09-15 00:13:26 +00:00
|
|
|
gst_registry_scan_path (GstRegistry * registry, const gchar * path)
|
2002-05-08 20:40:48 +00:00
|
|
|
{
|
2006-04-28 20:47:23 +00:00
|
|
|
gboolean changed;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GST_IS_REGISTRY (registry), FALSE);
|
|
|
|
g_return_val_if_fail (path != NULL, FALSE);
|
2006-01-17 12:08:43 +00:00
|
|
|
|
2005-10-08 06:49:09 +00:00
|
|
|
GST_DEBUG_OBJECT (registry, "scanning path %s", path);
|
2006-04-28 20:47:23 +00:00
|
|
|
changed = gst_registry_scan_path_level (registry, path, 10);
|
|
|
|
|
gst/: Re-commit the registry changes, along with an extra fix:
Original commit message from CVS:
* gst/gst.c: (init_pre), (scan_and_update_registry),
(ensure_current_registry_nonforking),
(ensure_current_registry_forking), (ensure_current_registry),
(init_post), (gst_debug_help), (gst_deinit):
* gst/gst_private.h:
* gst/gstregistry.c: (gst_registry_finalize),
(gst_registry_remove_features_for_plugin_unlocked),
(gst_registry_remove_plugin), (gst_registry_scan_path_level),
(gst_registry_scan_path),
(_priv_gst_registry_remove_cache_plugins),
(_priv_gst_registry_cleanup):
* gst/gstregistry.h:
Re-commit the registry changes, along with an extra fix:
When a cached plugin is encountered at a different file path,
update the stored path in the registry cache so that the parent
process knows where it actually is now when it re-reads the registry
cache. Fixes the thing that broke distcheck with the previous commit.
* tests/check/Makefile.am:
Clean up files named 'core' too when running make clean.
* tests/examples/manual/Makefile.am:
Set up a registry path for running these tests, and clean it properly
for distcheck.
2006-09-28 14:00:43 +00:00
|
|
|
GST_DEBUG_OBJECT (registry, "registry changed in path %s: %d", path, changed);
|
2006-04-28 20:47:23 +00:00
|
|
|
|
|
|
|
return changed;
|
2005-09-15 00:13:26 +00:00
|
|
|
}
|
2002-05-08 20:40:48 +00:00
|
|
|
|
gst/: Re-commit the registry changes, along with an extra fix:
Original commit message from CVS:
* gst/gst.c: (init_pre), (scan_and_update_registry),
(ensure_current_registry_nonforking),
(ensure_current_registry_forking), (ensure_current_registry),
(init_post), (gst_debug_help), (gst_deinit):
* gst/gst_private.h:
* gst/gstregistry.c: (gst_registry_finalize),
(gst_registry_remove_features_for_plugin_unlocked),
(gst_registry_remove_plugin), (gst_registry_scan_path_level),
(gst_registry_scan_path),
(_priv_gst_registry_remove_cache_plugins),
(_priv_gst_registry_cleanup):
* gst/gstregistry.h:
Re-commit the registry changes, along with an extra fix:
When a cached plugin is encountered at a different file path,
update the stored path in the registry cache so that the parent
process knows where it actually is now when it re-reads the registry
cache. Fixes the thing that broke distcheck with the previous commit.
* tests/check/Makefile.am:
Clean up files named 'core' too when running make clean.
* tests/examples/manual/Makefile.am:
Set up a registry path for running these tests, and clean it properly
for distcheck.
2006-09-28 14:00:43 +00:00
|
|
|
/* Unref all plugins marked 'cached', to clear old plugins that no
|
|
|
|
* longer exist. Returns TRUE if any plugins were removed */
|
|
|
|
gboolean
|
|
|
|
_priv_gst_registry_remove_cache_plugins (GstRegistry * registry)
|
2005-09-15 00:13:26 +00:00
|
|
|
{
|
|
|
|
GList *g;
|
|
|
|
GList *g_next;
|
|
|
|
GstPlugin *plugin;
|
gst/: Re-commit the registry changes, along with an extra fix:
Original commit message from CVS:
* gst/gst.c: (init_pre), (scan_and_update_registry),
(ensure_current_registry_nonforking),
(ensure_current_registry_forking), (ensure_current_registry),
(init_post), (gst_debug_help), (gst_deinit):
* gst/gst_private.h:
* gst/gstregistry.c: (gst_registry_finalize),
(gst_registry_remove_features_for_plugin_unlocked),
(gst_registry_remove_plugin), (gst_registry_scan_path_level),
(gst_registry_scan_path),
(_priv_gst_registry_remove_cache_plugins),
(_priv_gst_registry_cleanup):
* gst/gstregistry.h:
Re-commit the registry changes, along with an extra fix:
When a cached plugin is encountered at a different file path,
update the stored path in the registry cache so that the parent
process knows where it actually is now when it re-reads the registry
cache. Fixes the thing that broke distcheck with the previous commit.
* tests/check/Makefile.am:
Clean up files named 'core' too when running make clean.
* tests/examples/manual/Makefile.am:
Set up a registry path for running these tests, and clean it properly
for distcheck.
2006-09-28 14:00:43 +00:00
|
|
|
gboolean changed = FALSE;
|
2005-09-15 00:13:26 +00:00
|
|
|
|
gst/: Re-commit the registry changes, along with an extra fix:
Original commit message from CVS:
* gst/gst.c: (init_pre), (scan_and_update_registry),
(ensure_current_registry_nonforking),
(ensure_current_registry_forking), (ensure_current_registry),
(init_post), (gst_debug_help), (gst_deinit):
* gst/gst_private.h:
* gst/gstregistry.c: (gst_registry_finalize),
(gst_registry_remove_features_for_plugin_unlocked),
(gst_registry_remove_plugin), (gst_registry_scan_path_level),
(gst_registry_scan_path),
(_priv_gst_registry_remove_cache_plugins),
(_priv_gst_registry_cleanup):
* gst/gstregistry.h:
Re-commit the registry changes, along with an extra fix:
When a cached plugin is encountered at a different file path,
update the stored path in the registry cache so that the parent
process knows where it actually is now when it re-reads the registry
cache. Fixes the thing that broke distcheck with the previous commit.
* tests/check/Makefile.am:
Clean up files named 'core' too when running make clean.
* tests/examples/manual/Makefile.am:
Set up a registry path for running these tests, and clean it properly
for distcheck.
2006-09-28 14:00:43 +00:00
|
|
|
g_return_val_if_fail (GST_IS_REGISTRY (registry), FALSE);
|
2006-01-17 12:08:43 +00:00
|
|
|
|
2006-01-17 12:53:07 +00:00
|
|
|
GST_OBJECT_LOCK (registry);
|
|
|
|
|
2005-09-19 14:09:54 +00:00
|
|
|
GST_DEBUG_OBJECT (registry, "removing cached plugins");
|
2005-09-15 00:13:26 +00:00
|
|
|
g = registry->plugins;
|
|
|
|
while (g) {
|
|
|
|
g_next = g->next;
|
|
|
|
plugin = g->data;
|
|
|
|
if (plugin->flags & GST_PLUGIN_FLAG_CACHED) {
|
2005-10-11 16:05:16 +00:00
|
|
|
GST_DEBUG_OBJECT (registry, "removing cached plugin \"%s\"",
|
|
|
|
GST_STR_NULL (plugin->filename));
|
gst/: Re-commit the registry changes, along with an extra fix:
Original commit message from CVS:
* gst/gst.c: (init_pre), (scan_and_update_registry),
(ensure_current_registry_nonforking),
(ensure_current_registry_forking), (ensure_current_registry),
(init_post), (gst_debug_help), (gst_deinit):
* gst/gst_private.h:
* gst/gstregistry.c: (gst_registry_finalize),
(gst_registry_remove_features_for_plugin_unlocked),
(gst_registry_remove_plugin), (gst_registry_scan_path_level),
(gst_registry_scan_path),
(_priv_gst_registry_remove_cache_plugins),
(_priv_gst_registry_cleanup):
* gst/gstregistry.h:
Re-commit the registry changes, along with an extra fix:
When a cached plugin is encountered at a different file path,
update the stored path in the registry cache so that the parent
process knows where it actually is now when it re-reads the registry
cache. Fixes the thing that broke distcheck with the previous commit.
* tests/check/Makefile.am:
Clean up files named 'core' too when running make clean.
* tests/examples/manual/Makefile.am:
Set up a registry path for running these tests, and clean it properly
for distcheck.
2006-09-28 14:00:43 +00:00
|
|
|
registry->plugins = g_list_delete_link (registry->plugins, g);
|
2006-12-09 18:48:57 +00:00
|
|
|
gst_registry_remove_features_for_plugin_unlocked (registry, plugin);
|
2005-09-19 14:09:54 +00:00
|
|
|
gst_object_unref (plugin);
|
gst/: Re-commit the registry changes, along with an extra fix:
Original commit message from CVS:
* gst/gst.c: (init_pre), (scan_and_update_registry),
(ensure_current_registry_nonforking),
(ensure_current_registry_forking), (ensure_current_registry),
(init_post), (gst_debug_help), (gst_deinit):
* gst/gst_private.h:
* gst/gstregistry.c: (gst_registry_finalize),
(gst_registry_remove_features_for_plugin_unlocked),
(gst_registry_remove_plugin), (gst_registry_scan_path_level),
(gst_registry_scan_path),
(_priv_gst_registry_remove_cache_plugins),
(_priv_gst_registry_cleanup):
* gst/gstregistry.h:
Re-commit the registry changes, along with an extra fix:
When a cached plugin is encountered at a different file path,
update the stored path in the registry cache so that the parent
process knows where it actually is now when it re-reads the registry
cache. Fixes the thing that broke distcheck with the previous commit.
* tests/check/Makefile.am:
Clean up files named 'core' too when running make clean.
* tests/examples/manual/Makefile.am:
Set up a registry path for running these tests, and clean it properly
for distcheck.
2006-09-28 14:00:43 +00:00
|
|
|
changed = TRUE;
|
2005-09-15 00:13:26 +00:00
|
|
|
}
|
|
|
|
g = g_next;
|
|
|
|
}
|
2006-01-17 12:53:07 +00:00
|
|
|
|
|
|
|
GST_OBJECT_UNLOCK (registry);
|
gst/: Re-commit the registry changes, along with an extra fix:
Original commit message from CVS:
* gst/gst.c: (init_pre), (scan_and_update_registry),
(ensure_current_registry_nonforking),
(ensure_current_registry_forking), (ensure_current_registry),
(init_post), (gst_debug_help), (gst_deinit):
* gst/gst_private.h:
* gst/gstregistry.c: (gst_registry_finalize),
(gst_registry_remove_features_for_plugin_unlocked),
(gst_registry_remove_plugin), (gst_registry_scan_path_level),
(gst_registry_scan_path),
(_priv_gst_registry_remove_cache_plugins),
(_priv_gst_registry_cleanup):
* gst/gstregistry.h:
Re-commit the registry changes, along with an extra fix:
When a cached plugin is encountered at a different file path,
update the stored path in the registry cache so that the parent
process knows where it actually is now when it re-reads the registry
cache. Fixes the thing that broke distcheck with the previous commit.
* tests/check/Makefile.am:
Clean up files named 'core' too when running make clean.
* tests/examples/manual/Makefile.am:
Set up a registry path for running these tests, and clean it properly
for distcheck.
2006-09-28 14:00:43 +00:00
|
|
|
|
|
|
|
return changed;
|
2002-05-08 20:40:48 +00:00
|
|
|
}
|
2005-09-18 06:59:25 +00:00
|
|
|
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
_gst_plugin_feature_filter_plugin_name (GstPluginFeature * feature,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
return (strcmp (feature->plugin_name, (gchar *) user_data) == 0);
|
|
|
|
}
|
|
|
|
|
2005-12-02 12:34:47 +00:00
|
|
|
/**
|
|
|
|
* gst_registry_get_feature_list_by_plugin:
|
|
|
|
* @registry: a #GstRegistry.
|
|
|
|
* @name: a plugin name.
|
|
|
|
*
|
|
|
|
* Retrieves a #GList of features of the plugin with name @name.
|
|
|
|
*
|
2008-04-23 13:55:01 +00:00
|
|
|
* Returns: a #GList of #GstPluginFeature. Use gst_plugin_feature_list_free()
|
|
|
|
* after usage.
|
2005-12-02 12:34:47 +00:00
|
|
|
*/
|
2005-09-18 06:59:25 +00:00
|
|
|
GList *
|
|
|
|
gst_registry_get_feature_list_by_plugin (GstRegistry * registry,
|
|
|
|
const gchar * name)
|
|
|
|
{
|
2006-01-17 12:08:43 +00:00
|
|
|
g_return_val_if_fail (GST_IS_REGISTRY (registry), NULL);
|
|
|
|
g_return_val_if_fail (name != NULL, NULL);
|
|
|
|
|
2005-09-18 06:59:25 +00:00
|
|
|
return gst_registry_feature_filter (registry,
|
|
|
|
_gst_plugin_feature_filter_plugin_name, FALSE, (gpointer) name);
|
|
|
|
}
|
2005-09-18 21:24:55 +00:00
|
|
|
|
gst/: Re-commit the registry changes, along with an extra fix:
Original commit message from CVS:
* gst/gst.c: (init_pre), (scan_and_update_registry),
(ensure_current_registry_nonforking),
(ensure_current_registry_forking), (ensure_current_registry),
(init_post), (gst_debug_help), (gst_deinit):
* gst/gst_private.h:
* gst/gstregistry.c: (gst_registry_finalize),
(gst_registry_remove_features_for_plugin_unlocked),
(gst_registry_remove_plugin), (gst_registry_scan_path_level),
(gst_registry_scan_path),
(_priv_gst_registry_remove_cache_plugins),
(_priv_gst_registry_cleanup):
* gst/gstregistry.h:
Re-commit the registry changes, along with an extra fix:
When a cached plugin is encountered at a different file path,
update the stored path in the registry cache so that the parent
process knows where it actually is now when it re-reads the registry
cache. Fixes the thing that broke distcheck with the previous commit.
* tests/check/Makefile.am:
Clean up files named 'core' too when running make clean.
* tests/examples/manual/Makefile.am:
Set up a registry path for running these tests, and clean it properly
for distcheck.
2006-09-28 14:00:43 +00:00
|
|
|
/* Unref and delete the default registry */
|
2005-09-18 21:24:55 +00:00
|
|
|
void
|
gst/: Re-commit the registry changes, along with an extra fix:
Original commit message from CVS:
* gst/gst.c: (init_pre), (scan_and_update_registry),
(ensure_current_registry_nonforking),
(ensure_current_registry_forking), (ensure_current_registry),
(init_post), (gst_debug_help), (gst_deinit):
* gst/gst_private.h:
* gst/gstregistry.c: (gst_registry_finalize),
(gst_registry_remove_features_for_plugin_unlocked),
(gst_registry_remove_plugin), (gst_registry_scan_path_level),
(gst_registry_scan_path),
(_priv_gst_registry_remove_cache_plugins),
(_priv_gst_registry_cleanup):
* gst/gstregistry.h:
Re-commit the registry changes, along with an extra fix:
When a cached plugin is encountered at a different file path,
update the stored path in the registry cache so that the parent
process knows where it actually is now when it re-reads the registry
cache. Fixes the thing that broke distcheck with the previous commit.
* tests/check/Makefile.am:
Clean up files named 'core' too when running make clean.
* tests/examples/manual/Makefile.am:
Set up a registry path for running these tests, and clean it properly
for distcheck.
2006-09-28 14:00:43 +00:00
|
|
|
_priv_gst_registry_cleanup ()
|
2005-09-18 21:24:55 +00:00
|
|
|
{
|
2006-02-14 16:15:05 +00:00
|
|
|
GstRegistry *registry;
|
|
|
|
|
|
|
|
g_static_mutex_lock (&_gst_registry_mutex);
|
|
|
|
if ((registry = _gst_registry_default) != NULL) {
|
|
|
|
_gst_registry_default = NULL;
|
|
|
|
}
|
|
|
|
g_static_mutex_unlock (&_gst_registry_mutex);
|
2005-09-18 21:24:55 +00:00
|
|
|
|
2006-02-14 16:15:05 +00:00
|
|
|
/* unref outside of the lock because we can. */
|
|
|
|
if (registry)
|
|
|
|
gst_object_unref (registry);
|
2005-09-18 21:24:55 +00:00
|
|
|
}
|
2005-10-14 11:09:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_default_registry_check_feature_version:
|
|
|
|
* @feature_name: the name of the feature (e.g. "oggdemux")
|
|
|
|
* @min_major: the minimum major version number
|
|
|
|
* @min_minor: the minimum minor version number
|
|
|
|
* @min_micro: the minimum micro version number
|
|
|
|
*
|
|
|
|
* Checks whether a plugin feature by the given name exists in the
|
|
|
|
* default registry and whether its version is at least the
|
|
|
|
* version required.
|
|
|
|
*
|
|
|
|
* Returns: #TRUE if the feature could be found and the version is
|
|
|
|
* the same as the required version or newer, and #FALSE otherwise.
|
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
gst_default_registry_check_feature_version (const gchar * feature_name,
|
|
|
|
guint min_major, guint min_minor, guint min_micro)
|
|
|
|
{
|
|
|
|
GstPluginFeature *feature;
|
|
|
|
GstRegistry *registry;
|
|
|
|
gboolean ret = FALSE;
|
|
|
|
|
|
|
|
g_return_val_if_fail (feature_name != NULL, FALSE);
|
|
|
|
|
|
|
|
GST_DEBUG ("Looking up plugin feature '%s'", feature_name);
|
|
|
|
|
|
|
|
registry = gst_registry_get_default ();
|
|
|
|
feature = gst_registry_lookup_feature (registry, feature_name);
|
|
|
|
if (feature) {
|
|
|
|
ret = gst_plugin_feature_check_version (feature, min_major, min_minor,
|
|
|
|
min_micro);
|
|
|
|
gst_object_unref (feature);
|
|
|
|
} else {
|
|
|
|
GST_DEBUG ("Could not find plugin feature '%s'", feature_name);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|