summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d587018)
raw | patch | inline | side by side (parent: d587018)
author | David Schleef <ds@schleef.org> | |
Thu, 15 Sep 2005 00:13:26 +0000 (00:13 +0000) | ||
committer | David Schleef <ds@schleef.org> | |
Thu, 15 Sep 2005 00:13:26 +0000 (00:13 +0000) |
Original commit message from CVS:
* check/Makefile.am:
* check/generic/states.c:
* gst/Makefile.am:
* gst/gst.c:
* gst/gst.h:
* gst/gst_private.h:
* gst/gstelementfactory.c:
* gst/gstindex.c:
* gst/gstinfo.c:
* gst/gstplugin.c:
* gst/gstplugin.h:
* gst/gstpluginfeature.c:
* gst/gstpluginfeature.h:
* gst/gstregistry.c:
* gst/gstregistry.h:
* gst/gstregistrypool.c: remove
* gst/gstregistrypool.h: remove
* gst/gsttypefind.c:
* gst/gsttypefindfactory.c:
* gst/gsturi.c:
* tools/Makefile.am:
* tools/gst-compprep.c:
* tools/gst-inspect.c:
* tools/gst-register.c: remove
* tools/gst-xmlinspect.c:
Registry rewrite. Changes registry from being a file created
by a tool into a simple cache file created automatically by
libgstreamer. Removed gst-register (because it's no longer
needed). Remove registry pools, because we only have one
registry implementation (XML). Fix up other subsystems as
necessary.
* check/Makefile.am:
* check/generic/states.c:
* gst/Makefile.am:
* gst/gst.c:
* gst/gst.h:
* gst/gst_private.h:
* gst/gstelementfactory.c:
* gst/gstindex.c:
* gst/gstinfo.c:
* gst/gstplugin.c:
* gst/gstplugin.h:
* gst/gstpluginfeature.c:
* gst/gstpluginfeature.h:
* gst/gstregistry.c:
* gst/gstregistry.h:
* gst/gstregistrypool.c: remove
* gst/gstregistrypool.h: remove
* gst/gsttypefind.c:
* gst/gsttypefindfactory.c:
* gst/gsturi.c:
* tools/Makefile.am:
* tools/gst-compprep.c:
* tools/gst-inspect.c:
* tools/gst-register.c: remove
* tools/gst-xmlinspect.c:
Registry rewrite. Changes registry from being a file created
by a tool into a simple cache file created automatically by
libgstreamer. Removed gst-register (because it's no longer
needed). Remove registry pools, because we only have one
registry implementation (XML). Fix up other subsystems as
necessary.
28 files changed:
diff --git a/ChangeLog b/ChangeLog
index d19fa73bad71cdc70135d28df7c98d91bfeab7fb..d2dae3fc7c2edd514aed5ff74db409b9cdd7f082 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
+2005-09-14 David Schleef <ds@schleef.org>
+
+ * check/Makefile.am:
+ * check/generic/states.c:
+ * gst/Makefile.am:
+ * gst/gst.c:
+ * gst/gst.h:
+ * gst/gst_private.h:
+ * gst/gstelementfactory.c:
+ * gst/gstindex.c:
+ * gst/gstinfo.c:
+ * gst/gstplugin.c:
+ * gst/gstplugin.h:
+ * gst/gstpluginfeature.c:
+ * gst/gstpluginfeature.h:
+ * gst/gstregistry.c:
+ * gst/gstregistry.h:
+ * gst/gstregistrypool.c: remove
+ * gst/gstregistrypool.h: remove
+ * gst/gsttypefind.c:
+ * gst/gsttypefindfactory.c:
+ * gst/gsturi.c:
+ * tools/Makefile.am:
+ * tools/gst-compprep.c:
+ * tools/gst-inspect.c:
+ * tools/gst-register.c: remove
+ * tools/gst-xmlinspect.c:
+ Registry rewrite. Changes registry from being a file created
+ by a tool into a simple cache file created automatically by
+ libgstreamer. Removed gst-register (because it's no longer
+ needed). Remove registry pools, because we only have one
+ registry implementation (XML). Fix up other subsystems as
+ necessary.
+
2005-09-13 Michael Smith <msmith@fluendo.com>
* gst/gstconfig.h.in:
diff --git a/check/Makefile.am b/check/Makefile.am
index ca7b60c2fa88bef8c7b451c5d7a227d060a65bc0..14e02f8cbf1d94dafc1ac41af1954b23468d40e1 100644 (file)
--- a/check/Makefile.am
+++ b/check/Makefile.am
TESTS_ENVIRONMENT = \
$(REGISTRY_ENVIRONMENT) \
GST_PLUGIN_PATH_ONLY=yes \
- GST_PLUGIN_PATH=$(top_builddir)/gst
+ GST_PLUGIN_PATH=$(top_builddir)/gst/elements/.libs:$(top_builddir)/gst/indexers/.libs
plugindir = $(libdir)/gstreamer-@GST_MAJORMINOR@
-# rebuild gst-register-@GST_MAJORMINOR@ if needed
-$(top_builddir)/tools/gst-register-@GST_MAJORMINOR@$(EXEEXT):
- cd $(top_builddir)/tools && make
-
# override to _not_ install the test plugins
install-pluginLTLIBRARIES:
clean-local: clean-local-check
-$(CHECK_REGISTRY):
- $(TESTS_ENVIRONMENT) \
- $(top_builddir)/tools/gst-register-@GST_MAJORMINOR@
-
check_PROGRAMS = \
gst/gst \
gst/gstbin \
gst-libs/controller \
gst-libs/gdp
-TESTS = $(top_builddir)/tools/gst-register-@GST_MAJORMINOR@ \
- $(check_PROGRAMS)
+TESTS = $(check_PROGRAMS)
noinst_HEADERS = gst/capslist.h
gst/gstobject
VALGRIND_TESTS_DISABLE = \
- $(top_builddir)/tools/gst-register-@GST_MAJORMINOR@ \
$(TESTS_THREADED) \
$(TESTS_TO_FIX)
diff --git a/check/generic/states.c b/check/generic/states.c
index 41d8fba730547280a21c7fe7e1aaa900a9747185..1531c4f6ff72828337bf2a4c4ad6c938e3041a45 100644 (file)
--- a/check/generic/states.c
+++ b/check/generic/states.c
GstElement *element;
GList *features, *f;
- features = gst_registry_pool_feature_list (GST_TYPE_ELEMENT_FACTORY);
+ features = gst_registry_get_feature_list (gst_registry_get_default (),
+ GST_TYPE_ELEMENT_FACTORY);
for (f = features; f; f = f->next) {
GstPluginFeature *feature = f->data;
diff --git a/gst/Makefile.am b/gst/Makefile.am
index 91860fc8e36463025789ff6c5ad38642a6fa951f..b8b11a7131ce121659fe0173e33479ce0666cfdb 100644 (file)
--- a/gst/Makefile.am
+++ b/gst/Makefile.am
GST_TRACE_SRC = gsttrace.c
endif
-if GST_DISABLE_REGISTRY
-GST_REGISTRY_SRC =
-SUBDIRS_REGISTRY =
-GST_REGISTRY_LA =
-else
-GST_REGISTRY_SRC = gstregistry.c
-SUBDIRS_REGISTRY = registries
-GST_REGISTRY_LA = registries/libgstxmlregistry.la
-endif
-
if GST_DISABLE_ENUMTYPES
GST_ENUMTYPES_SRC =
else
GST_URI_SRC = gsturi.c
endif
-SUBDIRS = $(SUBDIRS_PARSE) $(SUBDIRS_REGISTRY) . base elements $(SUBDIRS_INDEX) $(SUBDIRS_CHECK)
-DIST_SUBDIRS = base elements parse registries indexers check
+SUBDIRS = $(SUBDIRS_PARSE) . base elements $(SUBDIRS_INDEX) $(SUBDIRS_CHECK)
+DIST_SUBDIRS = base elements parse indexers check
# make variables for all generated source and header files to make the
# distinction clear
gstquery.c \
gstqueryutils.c \
gstqueue.c \
+ gstregistry.c \
+ gstregistryxml.c \
gststructure.c \
gstsystemclock.c \
gsttaglist.c \
gsturitype.c \
gstutils.c \
gstvalue.c \
- $(GST_REGISTRY_SRC) \
- gstregistrypool.c \
$(GST_PARSE_SRC) \
$(GSTARCH_SRCS) \
$(GST_LOADSAVE_SRC)
-DG_LOG_DOMAIN=g_log_domain_gstreamer \
-DGST_MAJORMINOR=\""$(GST_MAJORMINOR)"\"
libgstreamer_@GST_MAJORMINOR@_la_LIBADD = \
- $(GST_LIB_LIBS) $(GST_PARSE_LA) $(GST_REGISTRY_LA)
+ $(GST_LIB_LIBS) $(GST_PARSE_LA)
libgstreamer_@GST_MAJORMINOR@_la_LDFLAGS = \
@GST_LT_LDFLAGS@ -version-info @GST_LIBVERSION@ \
- -export-symbols-regex [_]*\(gst_\|Gst\|GST_\).*
+ -export-symbols-regex [_]*\(gst_\|Gst\|GST_\).* \
+ -no-undefined
libgstreamer_@GST_MAJORMINOR@includedir = $(includedir)/gstreamer-@GST_MAJORMINOR@/gst
gstutils.h \
gstvalue.h \
gstregistry.h \
- gstregistrypool.h \
gstparse.h \
gstxml.h
diff --git a/gst/gst.c b/gst/gst.c
index a61c6e52f5b32e7e3ede4d04fc9796c74ade6731..11ee8d6f6fcefbe290a2e4eec932ae3183af59be 100644 (file)
--- a/gst/gst.c
+++ b/gst/gst.c
#include "gst.h"
#include "gstqueue.h"
-#ifndef GST_DISABLE_REGISTRY
-#include "registries/gstxmlregistry.h"
-#endif /* GST_DISABLE_REGISTRY */
-#include "gstregistrypool.h"
#define GST_CAT_DEFAULT GST_CAT_GST_INIT
#ifndef GST_DISABLE_REGISTRY
gboolean _gst_registry_auto_load = TRUE;
-static GstRegistry *_global_registry;
-static GstRegistry *_user_registry;
-static gboolean _gst_registry_fixed = FALSE;
#endif
static gboolean gst_initialized = FALSE;
ARG_PLUGIN_SPEW,
ARG_PLUGIN_PATH,
ARG_PLUGIN_LOAD,
- ARG_SEGTRAP_DISABLE,
- ARG_REGISTRY
+ ARG_SEGTRAP_DISABLE
};
/* debug-spec ::= category-spec [, category-spec]*
ARG_SEGTRAP_DISABLE,
N_("Disable trapping of segmentation faults during plugin loading"),
NULL},
- {"gst-registry", NUL, POPT_ARG_STRING | POPT_ARGFLAG_STRIP, NULL,
- ARG_REGISTRY, N_("Registry to use"), N_("REGISTRY")},
POPT_TABLEEND
};
static gboolean inited = FALSE;
static void
add_path_func (gpointer data, gpointer user_data)
{
- GstRegistry *registry = GST_REGISTRY (user_data);
-
- gst_registry_add_path (registry, (gchar *) data);
+ GST_INFO ("Adding plugin path: \"%s\"", (gchar *) data);
+ gst_registry_scan_path (gst_registry_get_default (), (gchar *) data);
}
#endif
if (plugin) {
GST_INFO ("Loaded plugin: \"%s\"", filename);
- gst_registry_pool_add_plugin (plugin);
+ gst_default_registry_add_plugin (plugin);
} else {
if (err) {
/* Report error to user, and free error */
static gboolean
init_pre (void)
{
- const gchar *plugin_path;
-
g_type_init ();
if (g_thread_supported ()) {
GST_INFO ("Initializing GStreamer Core Library version %s", VERSION);
GST_INFO ("Using library from %s", LIBDIR);
-#ifndef GST_DISABLE_REGISTRY
- {
- gchar *user_reg;
- const gchar *homedir;
-
- _global_registry =
- gst_xml_registry_new ("global_registry", GLOBAL_REGISTRY_FILE);
-
-#ifdef PLUGINS_USE_BUILDDIR
- /* location libgstelements.so */
- gst_registry_add_path (_global_registry, PLUGINS_BUILDDIR "/libs/gst");
- gst_registry_add_path (_global_registry, PLUGINS_BUILDDIR "/gst/elements");
- gst_registry_add_path (_global_registry, PLUGINS_BUILDDIR "/gst/types");
- gst_registry_add_path (_global_registry, PLUGINS_BUILDDIR "/gst/autoplug");
- gst_registry_add_path (_global_registry, PLUGINS_BUILDDIR "/gst/indexers");
-#endif /* PLUGINS_USE_BUILDDIR */
-
- plugin_path = g_getenv ("GST_PLUGIN_PATH");
-#ifndef GST_DISABLE_REGISTRY
- split_and_iterate (plugin_path, G_SEARCHPATH_SEPARATOR_S, add_path_func,
- _global_registry);
-#endif /* GST_DISABLE_REGISTRY */
-
-
-#ifndef PLUGINS_USE_BUILDDIR
- /* add the main (installed) library path as the last path
- * if GST_PLUGIN_PATH_ONLY not set */
- if (g_getenv ("GST_PLUGIN_PATH_ONLY") == NULL) {
- gst_registry_add_path (_global_registry, PLUGINS_DIR);
- }
-#endif
-
- if (g_getenv ("GST_REGISTRY")) {
- user_reg = g_strdup (g_getenv ("GST_REGISTRY"));
- } else {
- homedir = g_get_home_dir ();
- user_reg = g_strjoin ("/", homedir, LOCAL_REGISTRY_FILE, NULL);
- }
- _user_registry = gst_xml_registry_new ("user_registry", user_reg);
-
- g_free (user_reg);
- }
-#endif /* GST_DISABLE_REGISTRY */
-
return TRUE;
}
"gstcoreelements",
"core elements of the GStreamer library",
gst_register_core_elements,
- NULL,
VERSION,
GST_LICENSE,
PACKAGE,
_gst_tag_initialize ();
#ifndef GST_DISABLE_REGISTRY
- if (!_gst_registry_fixed) {
- /* don't override command-line options */
- if (g_getenv ("GST_REGISTRY")) {
- g_object_set (_global_registry, "location", g_getenv ("GST_REGISTRY"),
- NULL);
- _gst_registry_fixed = TRUE;
+ {
+ char *registry_file;
+ const char *plugin_path;
+ GstRegistry *default_registry;
+
+ default_registry = gst_registry_get_default ();
+ registry_file = g_strdup (g_getenv ("GST_REGISTRY"));
+ if (registry_file == NULL) {
+ registry_file = g_build_filename (g_get_home_dir (),
+ ".gstreamer-0.9", "registry.xml", NULL);
}
- }
+ gst_registry_xml_read_cache (default_registry, registry_file);
- if (!_gst_registry_fixed) {
- gst_registry_pool_add (_global_registry, 100);
- gst_registry_pool_add (_user_registry, 50);
- } else {
+ plugin_path = g_getenv ("GST_PLUGIN_SYSTEM_PATH");
+ if (plugin_path == NULL) {
+#ifdef PLUGINS_USE_BUILDDIR
+ /* location libgstelements.so */
+ gst_registry_scan_path (default_registry,
+ PLUGINS_BUILDDIR "/gst/elements/.libs");
+ gst_registry_scan_path (default_registry,
+ PLUGINS_BUILDDIR "/gst/indexers/.libs");
+#else
+ char *home_plugins;
+
+ /* add the main (installed) library path */
+ gst_registry_scan_path (default_registry, PLUGINS_DIR);
+
+ home_plugins = g_build_filename (g_get_home_dir (),
+ ".gstreamer-0.9", "plugins", NULL);
+ gst_registry_scan_path (default_registry, home_plugins);
+ g_free (home_plugins);
+#endif /* PLUGINS_USE_BUILDDIR */
+ } else {
+ char **list;
+ int i;
- gst_registry_pool_add (_global_registry, 100);
- }
+ /* FIXME this doesn't split paths correctly on windows */
+ list = g_strsplit (plugin_path, ":", 0);
+ for (i = 0; list[i]; i++) {
+ gst_registry_scan_path (default_registry, list[i]);
+ }
+ }
+
+ plugin_path = g_getenv ("GST_PLUGIN_PATH");
+ if (plugin_path) {
+ char **list;
+ int i;
+
+ /* FIXME this doesn't split paths correctly on windows */
+ list = g_strsplit (plugin_path, ":", 0);
+ for (i = 0; list[i]; i++) {
+ gst_registry_scan_path (default_registry, list[i]);
+ }
+ }
+
+ gst_registry_xml_write_cache (default_registry, registry_file);
- if (_gst_registry_auto_load) {
- gst_registry_pool_load_all ();
+ _gst_registry_remove_cache_plugins (default_registry);
+
+ g_free (registry_file);
}
#endif /* GST_DISABLE_REGISTRY */
}
#ifndef GST_DISABLE_GST_DEBUG
+static gboolean
+select_all (GstPlugin * plugin, gpointer user_data)
+{
+ return TRUE;
+}
+
static gint
sort_by_category_name (gconstpointer a, gconstpointer b)
{
gst_debug_help (void)
{
GSList *list, *walk;
- GList *list2, *walk2;
+ GList *list2, *g;
if (!init_post ())
exit (1);
- walk2 = list2 = gst_registry_pool_plugin_list ();
- while (walk2) {
- GstPlugin *plugin = GST_PLUGIN (walk2->data);
+ list2 = gst_registry_plugin_filter (gst_registry_get_default (),
+ select_all, FALSE, NULL);
- walk2 = g_list_next (walk2);
+ /* FIXME this is gross. why don't debug have categories PluginFeatures? */
+ for (g = list2; g; g = g_list_next (g)) {
+ GstPlugin *plugin = GST_PLUGIN (g->data);
- if (!gst_plugin_is_loaded (plugin)) {
-#ifndef GST_DISABLE_REGISTRY
- if (GST_IS_REGISTRY (plugin->manager)) {
- GST_CAT_LOG (GST_CAT_PLUGIN_LOADING, "loading plugin %s",
- plugin->desc.name);
- if (gst_registry_load_plugin (GST_REGISTRY (plugin->manager),
- plugin) != GST_REGISTRY_OK)
- GST_CAT_WARNING (GST_CAT_PLUGIN_LOADING, "loading plugin %s failed",
- plugin->desc.name);
- }
-#endif /* GST_DISABLE_REGISTRY */
- }
+ gst_plugin_load (plugin);
}
g_list_free (list2);
case ARG_PLUGIN_PATH:
#ifndef GST_DISABLE_REGISTRY
split_and_iterate (arg, G_SEARCHPATH_SEPARATOR_S, add_path_func,
- _user_registry);
+ NULL);
#endif /* GST_DISABLE_REGISTRY */
break;
case ARG_PLUGIN_LOAD:
case ARG_SEGTRAP_DISABLE:
_gst_disable_segtrap = TRUE;
break;
- case ARG_REGISTRY:
-#ifndef GST_DISABLE_REGISTRY
- g_object_set (G_OBJECT (_user_registry), "location", arg, NULL);
- _gst_registry_fixed = TRUE;
-#endif /* GST_DISABLE_REGISTRY */
- break;
default:
g_warning ("option %d not recognized", option->val);
break;
diff --git a/gst/gst.h b/gst/gst.h
index 1d0eb47b0f8b1a98eaf628410dadf70b7e3d8687..1067ffd2d81751da125d30189bcb113c4d845d47 100644 (file)
--- a/gst/gst.h
+++ b/gst/gst.h
#include <gst/gstparse.h>
#include <gst/gstregistry.h>
-#include <gst/gstregistrypool.h>
/* API compatibility stuff */
#include <gst/gstcompat.h>
diff --git a/gst/gst_private.h b/gst/gst_private.h
index 97fe87862afa0a929d5d207a60547a2e546428f0..a707c143a22674b87ce1a78a6799780cf427c892 100644 (file)
--- a/gst/gst_private.h
+++ b/gst/gst_private.h
extern GstDebugCategory *GST_CAT_CALL_TRACE;
extern GstDebugCategory *GST_CAT_SIGNAL;
extern GstDebugCategory *GST_CAT_PROBE;
+extern GstDebugCategory *GST_CAT_REGISTRY;
#else
#define GST_CAT_CALL_TRACE NULL
#define GST_CAT_SIGNAL NULL
#define GST_CAT_PROBE NULL
+#define GST_CAT_REGISTRY NULL
#endif
index 934a4fdd8b5a982902c34f7ec723e16d02a1bf61..123e3a1e4216802dbee00c3b6404b95d52e1efdd 100644 (file)
--- a/gst/gstelementfactory.c
+++ b/gst/gstelementfactory.c
#include "gst_private.h"
#include "gstelement.h"
-#include "gstregistrypool.h"
#include "gstinfo.h"
#include "gsturi.h"
-#ifndef GST_DISABLE_REGISTRY
-#include "registries/gstxmlregistry.h" /* g_critical in gst_element_factory_create */
-#endif
+#include "gstregistry.h"
GST_DEBUG_CATEGORY_STATIC (element_factory_debug);
#define GST_CAT_DEFAULT element_factory_debug
static void gst_element_factory_class_init (GstElementFactoryClass * klass);
static void gst_element_factory_init (GstElementFactory * factory);
-static void gst_element_factory_unload_thyself (GstPluginFeature * feature);
-
static GstPluginFeatureClass *parent_class = NULL;
/* static guint gst_element_factory_signals[LAST_SIGNAL] = { 0 }; */
parent_class = g_type_class_peek_parent (klass);
- gstpluginfeature_class->unload_thyself =
- GST_DEBUG_FUNCPTR (gst_element_factory_unload_thyself);
}
static void
gst_element_factory_init (GstElementFactory * factory)
g_return_val_if_fail (name != NULL, NULL);
- feature = gst_registry_pool_find_feature (name, GST_TYPE_ELEMENT_FACTORY);
+ feature = gst_registry_find_feature (gst_registry_get_default (), name,
+ GST_TYPE_ELEMENT_FACTORY);
if (feature)
return GST_ELEMENT_FACTORY (feature);
g_return_val_if_fail (name != NULL, FALSE);
g_return_val_if_fail (g_type_is_a (type, GST_TYPE_ELEMENT), FALSE);
- factory = gst_element_factory_find (name);
-
- if (!factory) {
- factory =
- GST_ELEMENT_FACTORY (g_object_new (GST_TYPE_ELEMENT_FACTORY, NULL));
- gst_plugin_feature_set_name (GST_PLUGIN_FEATURE (factory), name);
- GST_LOG_OBJECT (factory, "Created new elementfactory for type %s",
- g_type_name (type));
- gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
- } else {
- g_return_val_if_fail (factory->type == 0, FALSE);
- gst_element_factory_cleanup (factory);
- GST_LOG_OBJECT (factory, "Reuse existing elementfactory for type %s",
- g_type_name (type));
- }
+ factory = GST_ELEMENT_FACTORY (g_object_new (GST_TYPE_ELEMENT_FACTORY, NULL));
+ gst_plugin_feature_set_name (GST_PLUGIN_FEATURE (factory), name);
+ GST_LOG_OBJECT (factory, "Created new elementfactory for type %s",
+ g_type_name (type));
+ gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
klass = GST_ELEMENT_CLASS (g_type_class_ref (type));
factory->type = type;
g_return_val_if_fail (factory != NULL, NULL);
- if (!gst_plugin_feature_ensure_loaded (GST_PLUGIN_FEATURE (factory))) {
- GST_INFO ("could not load element factory for element \"%s\"", name);
+ factory =
+ GST_ELEMENT_FACTORY (gst_plugin_feature_load (GST_PLUGIN_FEATURE
+ (factory)));
+ if (factory == NULL) {
return NULL;
}
GST_INFO ("creating \"%s\"", GST_PLUGIN_FEATURE_NAME (factory));
if (factory->type == 0) {
-#ifndef GST_DISABLE_REGISTRY
- GstPlugin *plugin = GST_PLUGIN_FEATURE (factory)->manager;
-
- g_critical
- ("Factory for `%s' has no type. This probably means the plugin wasn't found because the registry is broken. The plugin GStreamer was looking for is named '%s' and is expected in file '%s'. The registry for this plugin is located at '%s'",
- GST_PLUGIN_FEATURE_NAME (factory),
- gst_plugin_get_name (plugin), gst_plugin_get_filename (plugin),
- GST_IS_XML_REGISTRY (plugin->manager) ? GST_XML_REGISTRY (plugin->
- manager)->location : "Unknown");
-#else
- g_critical ("Factory for `%s' has no type",
- GST_PLUGIN_FEATURE_NAME (factory));
-#endif
+ g_critical ("Plugin didn't set object type in feature.");
+
return NULL;
}
return factory->uri_protocols;
}
-
-static void
-gst_element_factory_unload_thyself (GstPluginFeature * feature)
-{
- GstElementFactory *factory;
-
- factory = GST_ELEMENT_FACTORY (feature);
-
- if (factory->type) {
- g_type_class_unref (g_type_class_peek (factory->type));
- factory->type = 0;
- }
-}
diff --git a/gst/gstindex.c b/gst/gstindex.c
index 1a9d8d27c11e0897e321cc3615fb20b4c9d9379d..983d03e71419f8bf8f116e801507a4c76419b346 100644 (file)
--- a/gst/gstindex.c
+++ b/gst/gstindex.c
#include "gst_private.h"
#include "gstinfo.h"
-#include "gstregistrypool.h"
#include "gstindex.h"
#include "gstmarshal.h"
+#include "gstregistry.h"
/* for constructing an entry name */
#include "gstelement.h"
#include "gstpad.h"
GST_DEBUG ("gstindex: find \"%s\"", name);
- feature = gst_registry_pool_find_feature (name, GST_TYPE_INDEX_FACTORY);
+ feature = gst_registry_find_feature (gst_registry_get_default (), name,
+ GST_TYPE_INDEX_FACTORY);
if (feature)
return GST_INDEX_FACTORY (feature);
g_return_val_if_fail (factory != NULL, NULL);
- if (gst_plugin_feature_ensure_loaded (GST_PLUGIN_FEATURE (factory))) {
- g_return_val_if_fail (factory->type != 0, NULL);
+ factory =
+ GST_INDEX_FACTORY (gst_plugin_feature_load (GST_PLUGIN_FEATURE
+ (factory)));
+ if (factory == NULL)
+ return NULL;
- new = GST_INDEX (g_object_new (factory->type, NULL));
- }
+ new = GST_INDEX (g_object_new (factory->type, NULL));
return new;
}
diff --git a/gst/gstinfo.c b/gst/gstinfo.c
index dc20093a36e91771a9a13bd39287f807548d08f8..b11be2f97639d230f2ca2972dc018bebbe16cf99 100644 (file)
--- a/gst/gstinfo.c
+++ b/gst/gstinfo.c
GstDebugCategory *GST_CAT_CALL_TRACE = NULL;
GstDebugCategory *GST_CAT_SIGNAL = NULL;
GstDebugCategory *GST_CAT_PROBE = NULL;
+GstDebugCategory *GST_CAT_REGISTRY = NULL;
/* FIXME: export this? */
gboolean
GST_DEBUG_BOLD | GST_DEBUG_FG_WHITE | GST_DEBUG_BG_RED, NULL);
GST_CAT_PROBE = _gst_debug_category_new ("GST_PROBE",
GST_DEBUG_BOLD | GST_DEBUG_FG_GREEN, "pad probes");
+ GST_CAT_REGISTRY = _gst_debug_category_new ("GST_REGISTRY", 0, "registry");
/* print out the valgrind message if we're in valgrind */
diff --git a/gst/gstplugin.c b/gst/gstplugin.c
index a18f1c7bbce0e1daf2fec0bd9d7d39490fca0b76..688abfee0aab90d6fcf0bbd70d9401131f4256d4 100644 (file)
--- a/gst/gstplugin.c
+++ b/gst/gstplugin.c
#include "gstplugin.h"
#include "gstversion.h"
-#include "gstregistrypool.h"
#include "gstinfo.h"
#include "gstfilter.h"
+#include "gstregistry.h"
#define GST_CAT_DEFAULT GST_CAT_PLUGIN_LOADING
NULL
};
-static void gst_plugin_desc_copy (GstPluginDesc * dest,
- const GstPluginDesc * src);
-
static GstPlugin *gst_plugin_register_func (GstPlugin * plugin,
GModule * module, GstPluginDesc * desc);
+static void
+gst_plugin_desc_copy (GstPluginDesc * dest, const GstPluginDesc * src);
-static GstPlugin *
-gst_plugin_copy (GstPlugin * plugin)
+
+G_DEFINE_TYPE (GstPlugin, gst_plugin, G_TYPE_OBJECT);
+
+static void
+gst_plugin_init (GstPlugin * plugin)
{
- return g_memdup (plugin, sizeof (*plugin));
+
}
-GType
-gst_plugin_get_type (void)
+static void
+gst_plugin_class_init (GstPluginClass * klass)
{
- static GType plugin_type;
-
- if (plugin_type == 0) {
- plugin_type = g_boxed_type_register_static ("GstPlugin",
- (GBoxedCopyFunc) gst_plugin_copy, g_free);
- }
- return plugin_type;
}
+
GQuark
gst_plugin_error_quark (void)
{
if (GST_CAT_DEFAULT)
GST_LOG ("attempting to load static plugin \"%s\" now...", desc->name);
- plugin = g_new0 (GstPlugin, 1);
+ plugin = g_object_new (GST_TYPE_PLUGIN, NULL);
if (gst_plugin_register_func (plugin, main_module, desc)) {
if (GST_CAT_DEFAULT)
GST_INFO ("loaded static plugin \"%s\"", desc->name);
- gst_registry_pool_add_plugin (plugin);
+ gst_default_registry_add_plugin (plugin);
}
}
}
gst_plugin_register_func (GstPlugin * plugin, GModule * module,
GstPluginDesc * desc)
{
- g_assert (plugin->module == NULL);
-
if (!gst_plugin_check_version (desc->major_version, desc->minor_version)) {
if (GST_CAT_DEFAULT)
GST_INFO ("plugin \"%s\" has incompatible version, not loading",
GST_LOG ("plugin \"%s\" looks good", GST_STR_NULL (plugin->filename));
gst_plugin_desc_copy (&plugin->desc, desc);
- plugin->module = module;
if (!((desc->plugin_init) (plugin))) {
if (GST_CAT_DEFAULT)
static void _gst_plugin_fault_handler_setup ();
/**
- * gst_plugin_check_module:
- * @module: GModule handle to check for pluginness
+ * gst_plugin_load_file:
+ * @filename: the plugin filename to load
* @error: pointer to a NULL-valued GError
- * @pptr: pointer to a gpointer used to return the gst_plugin_desc symbol
- * (can be NULL)
*
- * Checks if the given module is a GStreamer plugin
+ * Loads the given plugin.
*
- * Returns: TRUE if the given module is a GStreamer plugin
+ * Returns: a new GstPlugin or NULL, if an error occurred.
*/
-static gboolean
-gst_plugin_check_module (GModule * module, const char *filename,
- GError ** error, gpointer * pptr)
+GstPlugin *
+gst_plugin_load_file (const gchar * filename, GError ** error)
{
+ GstPlugin *plugin;
+ GModule *module;
+ gboolean ret;
gpointer ptr;
+ struct stat file_status;
- if (pptr == NULL)
- pptr = &ptr;
-
- if (module == NULL) {
- GST_DEBUG ("Error loading plugin %s, reason: %s", filename,
- g_module_error ());
- g_set_error (error, GST_PLUGIN_ERROR, GST_PLUGIN_ERROR_MODULE,
- "Error loading plugin %s, reason: %s", filename, g_module_error ());
- return FALSE;
- }
+ g_return_val_if_fail (filename != NULL, NULL);
- if (!g_module_symbol (module, "gst_plugin_desc", pptr)) {
- GST_DEBUG ("Could not find plugin entry point in \"%s\"", filename);
- g_set_error (error,
- GST_PLUGIN_ERROR,
- GST_PLUGIN_ERROR_MODULE,
- "Could not find plugin entry point in \"%s\"", filename);
- return FALSE;
+ plugin = gst_registry_lookup (gst_registry_get_default (), filename);
+ if (plugin && plugin->module) {
+ return plugin;
}
- return TRUE;
-}
-
-/**
- * gst_plugin_check_file:
- * @filename: the plugin filename to check for pluginness
- * @error: pointer to a NULL-valued GError
- *
- * Checks if the given path represents a GStreamer plugin.
- *
- * Returns: TRUE if the given path is a GStreamer plugin.
- */
-gboolean
-gst_plugin_check_file (const gchar * filename, GError ** error)
-{
- GModule *module;
- struct stat file_status;
- gboolean check;
-
- g_return_val_if_fail (filename != NULL, FALSE);
+ GST_CAT_DEBUG (GST_CAT_PLUGIN_LOADING, "attempt to load plugin \"%s\"",
+ filename);
if (g_module_supported () == FALSE) {
+ GST_CAT_DEBUG (GST_CAT_PLUGIN_LOADING, "module loading not supported");
g_set_error (error,
GST_PLUGIN_ERROR,
GST_PLUGIN_ERROR_MODULE, "Dynamic loading not supported");
- return FALSE;
+ return NULL;
}
if (stat (filename, &file_status)) {
+ GST_CAT_DEBUG (GST_CAT_PLUGIN_LOADING, "problem accessing file");
g_set_error (error,
GST_PLUGIN_ERROR,
GST_PLUGIN_ERROR_MODULE, "Problem accessing file %s: %s\n", filename,
strerror (errno));
- return FALSE;
+ return NULL;
}
- module = g_module_open (filename, G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL);
- if (!module) {
- check = FALSE;
- goto beach;
+ module = g_module_open (filename, G_MODULE_BIND_LOCAL);
+ if (module == NULL) {
+ GST_CAT_ERROR (GST_CAT_PLUGIN_LOADING, "module_open failed: %s",
+ g_module_error ());
+ g_set_error (error,
+ GST_PLUGIN_ERROR, GST_PLUGIN_ERROR_MODULE, "Opening module failed");
+ return NULL;
}
- check = gst_plugin_check_module (module, filename, error, NULL);
- g_module_close (module);
-beach:
- GST_INFO ("file \"%s\" %s look like a gst plugin", filename,
- check ? "does" : "doesn't");
- return check;
+ plugin = g_object_new (GST_TYPE_PLUGIN, NULL);
-}
-
-/**
- * gst_plugin_load_file:
- * @filename: the plugin filename to load
- * @error: pointer to a NULL-valued GError
- *
- * Loads the given plugin.
- *
- * Returns: a new GstPlugin or NULL, if an error occurred.
- */
-GstPlugin *
-gst_plugin_load_file (const gchar * filename, GError ** error)
-{
- GstPlugin *plugin;
- GModule *module;
- GstPluginDesc *desc;
- gboolean free_plugin;
- gpointer ptr;
-
- g_return_val_if_fail (filename != NULL, NULL);
-
- GST_CAT_DEBUG (GST_CAT_PLUGIN_LOADING, "attempt to load plugin \"%s\"",
- filename);
-
- module = g_module_open (filename, G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL);
+ plugin->module = module;
+ plugin->filename = strdup (filename);
+ plugin->file_mtime = file_status.st_mtime;
+ plugin->file_size = file_status.st_size;
- /* gst_plugin_check_module handles module == NULL case */
- if (!gst_plugin_check_module (module, filename, error, &ptr)) {
- if (module != NULL)
- g_module_close (module);
+ ret = g_module_symbol (module, "gst_plugin_desc", &ptr);
+ if (!ret) {
+ GST_DEBUG ("Could not find plugin entry point in \"%s\"", filename);
+ g_set_error (error,
+ GST_PLUGIN_ERROR,
+ GST_PLUGIN_ERROR_MODULE,
+ "Could not find plugin entry point in \"%s\"", filename);
+ g_object_unref (plugin);
return NULL;
}
+ plugin->orig_desc = (GstPluginDesc *) ptr;
- desc = (GstPluginDesc *) ptr;
-
- plugin = gst_registry_pool_find_plugin (desc->name);
- if (!plugin) {
- free_plugin = TRUE;
- plugin = g_new0 (GstPlugin, 1);
- plugin->filename = g_strdup (filename);
- GST_DEBUG ("created new GstPlugin %p for file \"%s\"", plugin, filename);
- } else {
- free_plugin = FALSE;
- if (gst_plugin_is_loaded (plugin)) {
- g_module_close (module);
- if (plugin->filename && strcmp (plugin->filename, filename) != 0) {
- GST_WARNING
- ("plugin %p from file \"%s\" with same name %s is already "
- "loaded, aborting loading of \"%s\"", plugin, plugin->filename,
- plugin->desc.name, filename);
- g_set_error (error, GST_PLUGIN_ERROR,
- GST_PLUGIN_ERROR_NAME_MISMATCH,
- "plugin %p from file \"%s\" with same name %s is already "
- "loaded, aborting loading of \"%s\"", plugin, plugin->filename,
- plugin->desc.name, filename);
- if (free_plugin)
- g_free (plugin);
- return NULL;
- }
- GST_LOG ("Plugin %p for file \"%s\" already loaded, returning it now",
- plugin, filename);
- return plugin;
- }
- }
GST_LOG ("Plugin %p for file \"%s\" prepared, calling entry function...",
plugin, filename);
- if (g_module_symbol (module, "plugin_init", &ptr)) {
- GST_WARNING
- ("plugin %p from file \"%s\" exports a symbol named plugin_init\n",
- plugin, plugin->filename);
- g_set_error (error, GST_PLUGIN_ERROR, GST_PLUGIN_ERROR_NAME_MISMATCH,
- "plugin \"%s\" exports a symbol named plugin_init", desc->name);
- }
-
/* this is where we load the actual .so, so let's trap SIGSEGV */
_gst_plugin_fault_handler_setup ();
_gst_plugin_fault_handler_filename = plugin->filename;
GST_LOG ("Plugin %p for file \"%s\" prepared, registering...",
plugin, filename);
- if (gst_plugin_register_func (plugin, module, desc)) {
- /* remove signal handler */
- _gst_plugin_fault_handler_restore ();
- _gst_plugin_fault_handler_filename = NULL;
- GST_INFO ("plugin \"%s\" loaded", plugin->filename);
- return plugin;
- } else {
+ if (!gst_plugin_register_func (plugin, module, plugin->orig_desc)) {
/* remove signal handler */
_gst_plugin_fault_handler_restore ();
GST_DEBUG ("gst_plugin_register_func failed for plugin \"%s\"", filename);
GST_PLUGIN_ERROR_MODULE,
"gst_plugin_register_func failed for plugin \"%s\"", filename);
g_module_close (module);
- if (free_plugin)
- g_free (plugin);
return NULL;
}
+
+ /* remove signal handler */
+ _gst_plugin_fault_handler_restore ();
+ _gst_plugin_fault_handler_filename = NULL;
+ GST_INFO ("plugin \"%s\" loaded", plugin->filename);
+
+ gst_default_registry_add_plugin (plugin);
+
+ return plugin;
}
static void
g_free (dest->description);
dest->description = g_strdup (src->description);
dest->plugin_init = src->plugin_init;
- dest->plugin_exit = src->plugin_exit;
g_free (dest->version);
dest->version = g_strdup (src->version);
g_free (dest->license);
if (walk)
result = GST_PLUGIN_FEATURE (walk->data);
+ g_list_free (walk);
+
+ return result;
+}
+
+static gboolean
+gst_plugin_feature_name_filter (GstPluginFeature * feature, const gchar * name)
+{
+ return !strcmp (name, GST_PLUGIN_FEATURE_NAME (feature));
+}
+
+/**
+ * gst_plugin_find_feature_by_name:
+ * @plugin: plugin to get the feature from
+ * @name: The name of the feature to find
+ *
+ * Find a feature of the given name in the given plugin.
+ *
+ * Returns: a GstPluginFeature or NULL if the feature was not found.
+ */
+GstPluginFeature *
+gst_plugin_find_feature_by_name (GstPlugin * plugin, const gchar * name)
+{
+ GList *walk;
+ GstPluginFeature *result = NULL;
+
+ g_return_val_if_fail (name != NULL, NULL);
+
+ walk = gst_filter_run (plugin->features,
+ (GstFilterFunc) gst_plugin_feature_name_filter, TRUE, (void *) name);
+
+ if (walk)
+ result = GST_PLUGIN_FEATURE (walk->data);
+
+ g_list_free (walk);
+
return result;
}
GST_PLUGIN_FEATURE_NAME (feature));
/* g_object_unref (feature); */
} else {
- feature->manager = plugin;
+ feature->plugin = plugin;
plugin->features = g_list_prepend (plugin->features, feature);
plugin->numfeatures++;
}
}
/**
- * gst_plugin_load:
+ * gst_plugin_load_1:
* @name: name of plugin to load
*
* Load the named plugin.
* Returns: whether the plugin was loaded or not
*/
gboolean
-gst_plugin_load (const gchar * name)
+gst_plugin_load_1 (const gchar * name)
{
GstPlugin *plugin;
GError *error = NULL;
- plugin = gst_registry_pool_find_plugin (name);
+ plugin = gst_registry_find_plugin (gst_registry_get_default (), name);
if (plugin) {
plugin = gst_plugin_load_file (plugin->filename, &error);
if (!plugin) {
GST_DEBUG ("Could not find %s in registry pool", name);
return FALSE;
}
+
+GstPlugin *
+gst_plugin_load (GstPlugin * plugin)
+{
+ GError *error = NULL;
+
+ if (gst_plugin_is_loaded (plugin)) {
+ return plugin;
+ }
+
+ if (!plugin->filename) {
+ return plugin;
+ }
+
+ plugin = gst_plugin_load_file (plugin->filename, &error);
+ if (!plugin) {
+ GST_WARNING ("load_plugin error: %s\n", error->message);
+ g_error_free (error);
+ return NULL;
+ }
+
+ return plugin;
+}
diff --git a/gst/gstplugin.h b/gst/gstplugin.h
index fe20d2c8f57c64d4378ba118f99130ef7c66ab42..0298acc8758d65f6bafeb1a8a9b376ebd9b1c5eb 100644 (file)
--- a/gst/gstplugin.h
+++ b/gst/gstplugin.h
G_BEGIN_DECLS
+typedef struct _GstPlugin GstPlugin;
+typedef struct _GstPluginClass GstPluginClass;
+typedef struct _GstPluginDesc GstPluginDesc;
+
GQuark gst_plugin_error_quark (void);
#define GST_PLUGIN_ERROR gst_plugin_error_quark ()
GST_PLUGIN_ERROR_NAME_MISMATCH
} GstPluginError;
-#define GST_PLUGIN(plugin) ((GstPlugin *) (plugin))
-
-typedef struct _GstPlugin GstPlugin;
-typedef struct _GstPluginDesc GstPluginDesc;
+typedef enum
+{
+ GST_PLUGIN_FLAG_CACHED = (1<<0),
+} GstPluginFlags;
/* Initialiser function: returns TRUE if plugin initialised successfully */
typedef gboolean (*GstPluginInitFunc) (GstPlugin *plugin);
-/* exiting function when plugin is unloaded */
-typedef void (*GstPluginExitFunc) (GstPlugin *plugin);
struct _GstPluginDesc {
gint major_version; /* major version of core that plugin was compiled for */
gchar *name; /* unique name of plugin */
gchar *description; /* description of plugin */
GstPluginInitFunc plugin_init; /* pointer to plugin_init function */
- GstPluginExitFunc plugin_exit; /* pointer to plugin_exit function */
gchar *version; /* version of the plugin */
gchar *license; /* effective license of plugin */
gchar *source; /* source module plugin belongs to */
gpointer _gst_reserved[GST_PADDING];
};
+
+#define GST_TYPE_PLUGIN (gst_plugin_get_type())
+#define GST_IS_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PLUGIN))
+#define GST_IS_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_PLUGIN))
+#define GST_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_PLUGIN, GstPluginClass))
+#define GST_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PLUGIN, GstPlugin))
+#define GST_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_PLUGIN, GstPluginClass))
+
+
struct _GstPlugin {
+ GObject object;
+
GstPluginDesc desc;
+ GstPluginDesc *orig_desc;
+
+ unsigned int flags;
+
gchar * filename;
GList * features; /* list of features provided */
gint numfeatures;
- gpointer manager; /* managing registry */
GModule * module; /* contains the module if plugin is loaded */
+ size_t file_size;
+ time_t file_mtime;
+
gpointer _gst_reserved[GST_PADDING];
};
+struct _GstPluginClass {
+ GObjectClass object_class;
+
+};
+
+
#define GST_PLUGIN_DEFINE(major,minor,name,description,init,version,license,package,origin) \
GST_PLUGIN_EXPORT GstPluginDesc gst_plugin_desc = { \
major, \
name, \
description, \
init, \
- NULL, \
version, \
license, \
PACKAGE, \
name, \
description, \
init, \
- NULL, \
version, \
license, \
PACKAGE, \
typedef gboolean (*GstPluginFilter) (GstPlugin *plugin,
gpointer user_data);
-#define GST_TYPE_PLUGIN (gst_plugin_get_type())
GType gst_plugin_get_type (void);
+
+GstPlugin * gst_plugin_new (void);
+void gst_plugin_free (GstPlugin *plugin);
+
void _gst_plugin_initialize (void);
void _gst_plugin_register_static (GstPluginDesc *desc);
GList* gst_plugin_get_feature_list (GstPlugin *plugin);
GstPluginFeature* gst_plugin_find_feature (GstPlugin *plugin, const gchar *name, GType type);
+GstPluginFeature* gst_plugin_find_feature_by_name (GstPlugin *plugin, const gchar *name);
gboolean gst_plugin_check_file (const gchar *filename, GError** error);
GstPlugin * gst_plugin_load_file (const gchar *filename, GError** error);
-gboolean gst_plugin_unload_plugin (GstPlugin *plugin);
void gst_plugin_add_feature (GstPlugin *plugin, GstPluginFeature *feature);
+GstPlugin * gst_plugin_load (GstPlugin *plugin);
+
/* shortcuts to load from the registry pool */
-gboolean gst_plugin_load (const gchar *name);
+gboolean gst_plugin_load_1 (const gchar *name);
G_END_DECLS
diff --git a/gst/gstpluginfeature.c b/gst/gstpluginfeature.c
index 9fa2b234a7121679ff0b111cd0d7776401c3354d..28c850967d8b01aaa7eaa703e4d55efecbbfc418 100644 (file)
--- a/gst/gstpluginfeature.c
+++ b/gst/gstpluginfeature.c
static void
gst_plugin_feature_init (GstPluginFeature * feature)
{
- feature->manager = NULL;
+ feature->plugin = NULL;
}
/**
- * gst_plugin_feature_ensure_loaded:
+ * gst_plugin_feature_load:
* @feature: the plugin feature to check
*
* Check if the plugin containing the feature is loaded,
* if not, the plugin will be loaded.
*
- * Returns: a boolean indicating the feature is loaded.
+ * Returns: The new feature
*/
-gboolean
-gst_plugin_feature_ensure_loaded (GstPluginFeature * feature)
+GstPluginFeature *
+gst_plugin_feature_load (GstPluginFeature * feature)
{
GstPlugin *plugin;
- static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
+ GstPluginFeature *real_feature;
g_return_val_if_fail (feature != NULL, FALSE);
g_return_val_if_fail (GST_IS_PLUGIN_FEATURE (feature), FALSE);
- plugin = (GstPlugin *) (feature->manager);
- g_static_mutex_lock (&mutex);
-
- if (plugin && !gst_plugin_is_loaded (plugin)) {
-#ifndef GST_DISABLE_REGISTRY
- if (GST_IS_REGISTRY (plugin->manager)) {
- GST_CAT_DEBUG (GST_CAT_PLUGIN_LOADING,
- "loading plugin %s for feature", plugin->desc.name);
-
- if (gst_registry_load_plugin (GST_REGISTRY (plugin->manager),
- plugin) != GST_REGISTRY_OK) {
- g_static_mutex_unlock (&mutex);
- return FALSE;
- }
- } else {
- g_static_mutex_unlock (&mutex);
- return FALSE;
- }
-#else /* GST_DISABLE_REGISTRY */
- g_static_mutex_unlock (&mutex);
- return FALSE;
-#endif
+ plugin = gst_plugin_load (feature->plugin);
+ if (!plugin) {
+ g_critical ("Failed to load plugin containing feature '%s'.",
+ GST_PLUGIN_FEATURE_NAME (feature));
+ return NULL;
+ }
+ if (plugin == feature->plugin) {
+ return feature;
}
- g_static_mutex_unlock (&mutex);
- return TRUE;
-}
-
-/**
- * gst_plugin_feature_unload_thyself:
- * @feature: the plugin feature to check
- *
- * Unload the given feature. This will decrease the refcount
- * in the plugin and will eventually unload the plugin
- */
-void
-gst_plugin_feature_unload_thyself (GstPluginFeature * feature)
-{
- GstPluginFeatureClass *oclass;
-
- g_return_if_fail (feature != NULL);
- g_return_if_fail (GST_IS_PLUGIN_FEATURE (feature));
+ real_feature = gst_plugin_find_feature_by_name (plugin, feature->name);
- oclass = GST_PLUGIN_FEATURE_GET_CLASS (feature);
+ if (real_feature == NULL) {
+ g_critical
+ ("Loaded plugin containing feature '%s', but feature disappeared.",
+ feature->name);
+ return NULL;
+ }
- if (oclass->unload_thyself)
- oclass->unload_thyself (feature);
+ return real_feature;
}
gboolean
diff --git a/gst/gstpluginfeature.h b/gst/gstpluginfeature.h
index eaf4ab434edb79e71934de5cf5c4727b2087bcb3..c85d0f7a885524c2b01ad3709756bafd1fc7d3f4 100644 (file)
--- a/gst/gstpluginfeature.h
+++ b/gst/gstpluginfeature.h
gchar *name;
guint rank;
- gpointer manager;
+ struct _GstPlugin *plugin;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
struct _GstPluginFeatureClass {
GObjectClass parent_class;
- void (*unload_thyself) (GstPluginFeature *feature);
-
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
/* normal GObject stuff */
GType gst_plugin_feature_get_type (void);
-gboolean gst_plugin_feature_ensure_loaded (GstPluginFeature *feature);
-void gst_plugin_feature_unload_thyself (GstPluginFeature *feature);
+GstPluginFeature *
+ gst_plugin_feature_load (GstPluginFeature *feature);
gboolean gst_plugin_feature_type_name_filter (GstPluginFeature *feature,
GstTypeNameData *data);
diff --git a/gst/gstregistry.c b/gst/gstregistry.c
index 611ec7c4c53f90bc81d60644c317f191e46f3d27..4f3124b69b59f9b12310bce2d355ab72e1bb85bb 100644 (file)
--- a/gst/gstregistry.c
+++ b/gst/gstregistry.c
/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2000 Wim Taymans <wtay@chello.be>
+ * 2005 David A. Schleef <ds@schleef.org>
*
* gstregistry.c: handle registry
*
#include "gstinfo.h"
#include "gstregistry.h"
-#include "gstregistrypool.h"
#include "gstmarshal.h"
#include "gstfilter.h"
-#define GST_CAT_DEFAULT GST_CAT_GST_INIT
+#define GST_CAT_DEFAULT GST_CAT_REGISTRY
+
+/*
+ * Design:
+ *
+ * The GstRegistry object is a list of plugins and some functions
+ * for dealing with them. Plugins 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.
+ *
+ * The registry.xml file in 0.9 is actually a cache of plugin
+ * information. This is unlike previous versions, where the registry
+ * file was the primary source of plugin information, and was created
+ * by the gst-register command.
+ *
+ * In 0.9, 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 be set directly using the GST_PLUGIN_PATH
+ * environment variable. The registry file is loaded from
+ * ~/.gstreamer-0.9/registry.xml or the file listed in the
+ * GST_REGISTRY env var. The only reason to change the registry
+ * location is for testing.
+ *
+ * For each plugin that is found in the plugin search path, there
+ * could be 3 possibilities for cached information:
+ * - the cache may not contain information about a given file.
+ * - the cache may have stale information.
+ * - the cache may have current information.
+ * 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.
+ *
+ * Implementation notes:
+ *
+ * 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 process are marked with the
+ * GST_PLUGIN_FLAG_CACHED bit. These plugins are removed at the
+ * end of intitialization.
+ *
+ */
/* Element signals and args */
enum
};
registry_type = g_type_register_static (G_TYPE_OBJECT, "GstRegistry",
- ®istry_info, G_TYPE_FLAG_ABSTRACT);
+ ®istry_info, 0);
}
return registry_type;
}
static void
gst_registry_init (GstRegistry * registry)
{
- registry->priority = 0;
- registry->loaded = FALSE;
- registry->paths = NULL;
-}
-
-/**
- * gst_registry_load:
- * @registry: the registry to load
- *
- * Load the given registry
- *
- * Returns: TRUE on success.
- */
-gboolean
-gst_registry_load (GstRegistry * registry)
-{
- GstRegistryClass *rclass;
-
- g_return_val_if_fail (GST_IS_REGISTRY (registry), FALSE);
-
- rclass = GST_REGISTRY_GET_CLASS (registry);
-
- if (rclass->load)
- return rclass->load (registry);
-
- return FALSE;
-}
-
-/**
- * gst_registry_is_loaded:
- * @registry: the registry to check
- *
- * Check if the given registry is loaded
- *
- * Returns: TRUE if loaded.
- */
-gboolean
-gst_registry_is_loaded (GstRegistry * registry)
-{
- g_return_val_if_fail (GST_IS_REGISTRY (registry), FALSE);
-
- return registry->loaded;
-}
-
-/**
- * gst_registry_save:
- * @registry: the registry to save
- *
- * Save the contents of the given registry
- *
- * Returns: TRUE on success
- */
-gboolean
-gst_registry_save (GstRegistry * registry)
-{
- GstRegistryClass *rclass;
-
- g_return_val_if_fail (GST_IS_REGISTRY (registry), FALSE);
-
- rclass = GST_REGISTRY_GET_CLASS (registry);
-
- if (rclass->save)
- return rclass->save (registry);
-
- return FALSE;
-}
-
-/**
- * gst_registry_rebuild:
- * @registry: the registry to rebuild
- *
- * Rebuild the given registry
- *
- * Returns: TRUE on success
- */
-gboolean
-gst_registry_rebuild (GstRegistry * registry)
-{
- GstRegistryClass *rclass;
-
- g_return_val_if_fail (GST_IS_REGISTRY (registry), FALSE);
-
- rclass = GST_REGISTRY_GET_CLASS (registry);
- if (rclass->rebuild)
- return rclass->rebuild (registry);
-
- return FALSE;
}
-/**
- * gst_registry_unload:
- * @registry: the registry to unload
- *
- * Unload the given registry
- *
- * Returns: TRUE on success
- */
-gboolean
-gst_registry_unload (GstRegistry * registry)
+GstRegistry *
+gst_registry_get_default (void)
{
- GstRegistryClass *rclass;
-
- g_return_val_if_fail (GST_IS_REGISTRY (registry), FALSE);
+ static GstRegistry *_gst_registry_default;
- rclass = GST_REGISTRY_GET_CLASS (registry);
-
- if (rclass->unload)
- return rclass->unload (registry);
-
- return FALSE;
+ if (!_gst_registry_default) {
+ _gst_registry_default = g_object_new (GST_TYPE_REGISTRY, NULL);
+ }
+ return _gst_registry_default;
}
/**
gboolean
gst_registry_add_plugin (GstRegistry * registry, GstPlugin * plugin)
{
+ GstPlugin *existing_plugin;
+
g_return_val_if_fail (GST_IS_REGISTRY (registry), FALSE);
- if (gst_registry_pool_find_plugin (gst_plugin_get_name (plugin))) {
- GST_WARNING_OBJECT (registry, "Not adding plugin %s, "
- "because a plugin with same name already exists",
- gst_plugin_get_name (plugin));
- return FALSE;
+
+ existing_plugin = gst_registry_lookup (registry, plugin->filename);
+ if (existing_plugin) {
+ GST_DEBUG ("Replacing existing plugin for filename \"%s\"",
+ plugin->filename);
+ registry->plugins = g_list_remove (registry->plugins, existing_plugin);
+ g_object_unref (existing_plugin);
}
- plugin->manager = registry;
registry->plugins = g_list_prepend (registry->plugins, plugin);
GST_DEBUG ("emitting plugin-added for filename %s", plugin->filename);
}
-/**
- * gst_registry_load_plugin:
- * @registry: the registry to load the plugin from
- * @plugin: the plugin to load
- *
- * Bring the plugin from the registry into memory.
- *
- * Returns: a value indicating the result
- */
-GstRegistryReturn
-gst_registry_load_plugin (GstRegistry * registry, GstPlugin * plugin)
+GList *
+gst_registry_get_feature_list (GstRegistry * registry, GType type)
{
- GstRegistryClass *rclass;
+ /* FIXME */
- g_return_val_if_fail (GST_IS_REGISTRY (registry),
- GST_REGISTRY_PLUGIN_LOAD_ERROR);
+ return NULL;
+}
- rclass = GST_REGISTRY_GET_CLASS (registry);
+GList *
+gst_registry_get_plugin_list (GstRegistry * registry)
+{
+ return g_list_copy (registry->plugins);
+}
- if (rclass->load_plugin)
- return rclass->load_plugin (registry, plugin);
+GstPlugin *
+gst_registry_lookup (GstRegistry * registry, const char *filename)
+{
+ GList *g;
+ GstPlugin *plugin;
+
+ for (g = registry->plugins; g; g = g_list_next (g)) {
+ plugin = GST_PLUGIN (g->data);
+ if (plugin->filename && strcmp (filename, plugin->filename) == 0) {
+ return plugin;
+ }
+ }
- return GST_REGISTRY_PLUGIN_LOAD_ERROR;
+ return NULL;
}
-/**
- * gst_registry_unload_plugin:
- * @registry: the registry to unload the plugin from
- * @plugin: the plugin to unload
- *
- * Unload the plugin from the given registry.
- *
- * Returns: a value indicating the result
- */
-GstRegistryReturn
-gst_registry_unload_plugin (GstRegistry * registry, GstPlugin * plugin)
+static void
+gst_registry_scan_path_level (GstRegistry * registry, const gchar * path,
+ int level)
{
- GstRegistryClass *rclass;
-
- g_return_val_if_fail (GST_IS_REGISTRY (registry),
- GST_REGISTRY_PLUGIN_LOAD_ERROR);
+ GDir *dir;
+ const gchar *dirent;
+ gchar *filename;
+ GstPlugin *plugin;
- rclass = GST_REGISTRY_GET_CLASS (registry);
+ dir = g_dir_open (path, 0, NULL);
+ if (!dir)
+ return;
- if (rclass->unload_plugin)
- return rclass->unload_plugin (registry, plugin);
+ while ((dirent = g_dir_read_name (dir))) {
+ filename = g_strjoin ("/", path, dirent, NULL);
+
+ GST_DEBUG ("examining file: %s", filename);
+
+ if (g_file_test (filename, G_FILE_TEST_IS_DIR)) {
+ if (level > 0) {
+ GST_DEBUG ("found directory, recursing");
+ gst_registry_scan_path_level (registry, filename, level - 1);
+ } else {
+ GST_DEBUG ("found directory, but recursion level is too deep");
+ }
+ g_free (filename);
+ continue;
+ }
+ if (!g_file_test (filename, G_FILE_TEST_IS_REGULAR)) {
+ GST_DEBUG ("not a regular file, ignoring");
+ g_free (filename);
+ continue;
+ }
+ if (!g_str_has_suffix (filename, ".so") &&
+ !g_str_has_suffix (filename, ".dll") &&
+ !g_str_has_suffix (filename, ".dynlib")) {
+ GST_DEBUG ("extension is not recognized as module file, ignoring");
+ g_free (filename);
+ continue;
+ }
+
+ plugin = gst_registry_lookup (registry, filename);
+ if (plugin) {
+ struct stat file_status;
+
+ if (stat (filename, &file_status)) {
+ /* FIXME remove from cache */
+ g_free (filename);
+ continue;
+ }
+
+ if (plugin->file_mtime == file_status.st_mtime &&
+ plugin->file_size == file_status.st_size) {
+ GST_DEBUG ("file %s cached", filename);
+ plugin->flags &= ~GST_PLUGIN_FLAG_CACHED;
+ } else {
+ GST_DEBUG ("cached info for %s is stale", filename);
+ GST_DEBUG ("mtime %ld != %ld or size %" G_GSIZE_FORMAT " != %"
+ G_GSIZE_FORMAT, plugin->file_mtime, file_status.st_mtime,
+ plugin->file_size, file_status.st_size);
+ gst_registry_remove_plugin (gst_registry_get_default (), plugin);
+ gst_plugin_load_file (filename, NULL);
+ }
+
+ } else {
+ gst_plugin_load_file (filename, NULL);
+ }
+
+ g_free (filename);
+ }
- return GST_REGISTRY_PLUGIN_LOAD_ERROR;
+ g_dir_close (dir);
}
/**
- * gst_registry_update_plugin:
- * @registry: the registry to update
- * @plugin: the plugin to update
- *
- * Update the plugin in the given registry.
+ * gst_registry_scan_path:
+ * @registry: the registry to add the path to
+ * @path: the path to add to the registry
*
- * Returns: a value indicating the result
+ * 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.
*/
-GstRegistryReturn
-gst_registry_update_plugin (GstRegistry * registry, GstPlugin * plugin)
+void
+gst_registry_scan_path (GstRegistry * registry, const gchar * path)
{
- GstRegistryClass *rclass;
-
- g_return_val_if_fail (GST_IS_REGISTRY (registry),
- GST_REGISTRY_PLUGIN_LOAD_ERROR);
-
- rclass = GST_REGISTRY_GET_CLASS (registry);
-
- if (rclass->update_plugin)
- return rclass->update_plugin (registry, plugin);
+ gst_registry_scan_path_level (registry, path, 10);
+}
- return GST_REGISTRY_PLUGIN_LOAD_ERROR;
+void
+_gst_registry_remove_cache_plugins (GstRegistry * registry)
+{
+ GList *g;
+ GList *g_next;
+ GstPlugin *plugin;
+
+ g = registry->plugins;
+ while (g) {
+ g_next = g->next;
+ plugin = g->data;
+ if (plugin->flags & GST_PLUGIN_FLAG_CACHED) {
+ registry->plugins = g_list_remove (registry->plugins, plugin);
+ g_object_unref (plugin);
+ }
+ g = g_next;
+ }
}
diff --git a/gst/gstregistry.h b/gst/gstregistry.h
index f4676df63a1b50003d7e9bc61b695525ce4c91a3..c22659d6e4d95ed1dcb807dc5c47a8cad9312963 100644 (file)
--- a/gst/gstregistry.h
+++ b/gst/gstregistry.h
#include <gst/gstplugin.h>
-#define GLOBAL_REGISTRY_DIR GST_CACHE_DIR
-#define GLOBAL_REGISTRY_FILE GLOBAL_REGISTRY_DIR"/registry.xml"
-#define GLOBAL_REGISTRY_FILE_TMP GLOBAL_REGISTRY_DIR"/.registry.xml.tmp"
-
-#define LOCAL_REGISTRY_DIR ".gstreamer-"GST_MAJORMINOR
-#define LOCAL_REGISTRY_FILE LOCAL_REGISTRY_DIR"/registry.xml"
-#define LOCAL_REGISTRY_FILE_TMP LOCAL_REGISTRY_DIR"/.registry.xml.tmp"
-
-/* compatibility for pre-POSIX defines */
-#ifdef S_IRUSR
-#if defined(_WIN32) && defined(__MINGW32__)
-#define REGISTRY_DIR_PERMS (S_ISGID | \
- S_IRUSR | S_IWUSR | S_IXUSR)
-#else
-#define REGISTRY_DIR_PERMS (S_ISGID | \
- S_IRUSR | S_IWUSR | S_IXUSR | \
- S_IRGRP | S_IXGRP | \
- S_IROTH | S_IXOTH)
-#endif
-#define REGISTRY_TMPFILE_PERMS (S_IRUSR | S_IWUSR)
-#if defined(_WIN32) && defined(__MINGW32__)
-#define REGISTRY_FILE_PERMS (S_IRUSR | S_IWUSR
-#else
-#define REGISTRY_FILE_PERMS (S_IRUSR | S_IWUSR | \
- S_IRGRP | S_IWGRP | \
- S_IROTH | S_IWOTH)
-#endif
-#else
-#define REGISTRY_DIR_PERMS (S_ISGID | \
- S_IREAD | S_IWRITE | S_IEXEC)
-#define REGISTRY_TMPFILE_PERMS (S_IREAD | S_IWRITE)
-#define REGISTRY_FILE_PERMS (S_IREAD | S_IWRITE)
-#endif
-
G_BEGIN_DECLS
-typedef enum {
- GST_REGISTRY_OK = (0),
- GST_REGISTRY_LOAD_ERROR = (1 << 1),
- GST_REGISTRY_SAVE_ERROR = (1 << 2),
- GST_REGISTRY_PLUGIN_LOAD_ERROR = (1 << 3),
- GST_REGISTRY_PLUGIN_SIGNATURE_ERROR = (1 << 4)
-} GstRegistryReturn;
-
-typedef enum {
- GST_REGISTRY_READABLE = (1 << 1),
- GST_REGISTRY_WRITABLE = (1 << 2),
- GST_REGISTRY_EXISTS = (1 << 3),
- GST_REGISTRY_REMOTE = (1 << 4),
- GST_REGISTRY_DELAYED_LOADING = (1 << 5)
-} GstRegistryFlags;
-
-
#define GST_TYPE_REGISTRY (gst_registry_get_type ())
#define GST_REGISTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_REGISTRY, GstRegistry))
#define GST_IS_REGISTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_REGISTRY))
struct _GstRegistry {
GObject object;
- gint priority;
- GstRegistryFlags flags;
-
- gchar *name;
- gchar *details;
-
- gboolean loaded;
GList *plugins;
GList *paths;
+ /* FIXME move elsewhere */
+ FILE *cache_file;
+
gpointer _gst_reserved[GST_PADDING];
};
struct _GstRegistryClass {
GObjectClass parent_class;
- /* vtable */
- gboolean (*load) (GstRegistry *registry);
- gboolean (*save) (GstRegistry *registry);
- gboolean (*rebuild) (GstRegistry *registry);
- gboolean (*unload) (GstRegistry *registry);
-
- GstRegistryReturn (*load_plugin) (GstRegistry *registry, GstPlugin *plugin);
- GstRegistryReturn (*unload_plugin) (GstRegistry *registry, GstPlugin *plugin);
- GstRegistryReturn (*update_plugin) (GstRegistry *registry, GstPlugin *plugin);
-
/* signals */
void (*plugin_added) (GstRegistry *registry, GstPlugin *plugin);
/* normal GObject stuff */
GType gst_registry_get_type (void);
-gboolean gst_registry_load (GstRegistry *registry);
-gboolean gst_registry_is_loaded (GstRegistry *registry);
-gboolean gst_registry_save (GstRegistry *registry);
-gboolean gst_registry_rebuild (GstRegistry *registry);
-gboolean gst_registry_unload (GstRegistry *registry);
+GstRegistry * gst_registry_get_default (void);
-void gst_registry_add_path (GstRegistry *registry, const gchar *path);
+void gst_registry_scan_path (GstRegistry *registry, const gchar *path);
GList* gst_registry_get_path_list (GstRegistry *registry);
void gst_registry_clear_paths (GstRegistry *registry);
gboolean gst_registry_add_plugin (GstRegistry *registry, GstPlugin *plugin);
void gst_registry_remove_plugin (GstRegistry *registry, GstPlugin *plugin);
+GList* gst_registry_get_plugin_list (GstRegistry *registry);
GList* gst_registry_plugin_filter (GstRegistry *registry,
GstPluginFilter filter,
gboolean first,
GstPluginFeatureFilter filter,
gboolean first,
gpointer user_data);
+GList * gst_registry_get_feature_list (GstRegistry *registry,
+ GType type);
GstPlugin* gst_registry_find_plugin (GstRegistry *registry, const gchar *name);
GstPluginFeature* gst_registry_find_feature (GstRegistry *registry, const gchar *name, GType type);
-
-GstRegistryReturn gst_registry_load_plugin (GstRegistry *registry, GstPlugin *plugin);
-GstRegistryReturn gst_registry_unload_plugin (GstRegistry *registry, GstPlugin *plugin);
-GstRegistryReturn gst_registry_update_plugin (GstRegistry *registry, GstPlugin *plugin);
+GstPlugin * gst_registry_lookup (GstRegistry *registry, const char *filename);
+
+gboolean gst_registry_xml_read_cache (GstRegistry * registry, const char *location);
+gboolean gst_registry_xml_write_cache (GstRegistry * registry, const char *location);
+
+void gst_registry_scan_paths (GstRegistry *registry);
+void _gst_registry_remove_cache_plugins (GstRegistry *registry);
+
+#define gst_default_registry_add_plugin(plugin) \
+ gst_registry_add_plugin (gst_registry_get_default(), plugin)
+#define gst_default_registry_add_path(path) \
+ gst_registry_add_path (gst_registry_get_default(), path)
+#define gst_default_registry_get_path_list() \
+ gst_registry_get_path_list (gst_registry_get_default())
+#define gst_default_registry_get_plugin_list() \
+ gst_registry_get_plugin_list (gst_registry_get_default())
+#define gst_default_registry_find_feature(name,type) \
+ gst_registry_find_feature (gst_registry_get_default(),name,type)
+#define gst_default_registry_find_plugin(name) \
+ gst_registry_find_plugin (gst_registry_get_default(),name)
+#define gst_default_registry_feature_filter(filter,first,user_data) \
+ gst_registry_feature_filter (gst_registry_get_default(),filter,first,user_data)
G_END_DECLS
#endif /* __GST_REGISTRY_H__ */
+
diff --git a/gst/gstregistrypool.c b/gst/gstregistrypool.c
--- a/gst/gstregistrypool.c
+++ /dev/null
@@ -1,350 +0,0 @@
-/* GStreamer
- * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
- * 2000 Wim Taymans <wtay@chello.be>
- *
- * gstregistry.c: handle registry
- *
- * 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.
- */
-/**
- * SECTION:gstregistrypool
- * @short_description: Management of a group of #GstRegistry objects
- * @see_also: #GstRegistry
- *
- * The registry pool manages the available registries and plugins in the system.
- */
-
-#include <string.h>
-
-#include "gst_private.h"
-
-#include "gstinfo.h"
-#include "gstregistrypool.h"
-#include "gstfilter.h"
-
-/* list of registries in the pool */
-static GList *_gst_registry_pool = NULL;
-
-/* list of plugins without a registry, like statically linked
- * plugins */
-static GList *_gst_registry_pool_plugins = NULL;
-
-/**
- * gst_registry_pool_list:
- *
- * Get a list of all registries in the pool
- *
- * Returns: a Glist of GstRegistries, g_list_free after use.
- */
-GList *
-gst_registry_pool_list (void)
-{
- return g_list_copy (_gst_registry_pool);
-}
-
-#ifndef GST_DISABLE_REGISTRY
-static gint
-gst_registry_compare_func (gconstpointer a, gconstpointer b)
-{
- return GST_REGISTRY (a)->priority - GST_REGISTRY (b)->priority;
-}
-
-/**
- * gst_registry_pool_add:
- * @registry: the registry to add
- * @priority: the priority of the registry
- *
- * Add the registry to the pool with the given priority.
- */
-void
-gst_registry_pool_add (GstRegistry * registry, guint priority)
-{
- g_return_if_fail (GST_IS_REGISTRY (registry));
-
- registry->priority = priority;
-
- _gst_registry_pool =
- g_list_insert_sorted (_gst_registry_pool, registry,
- gst_registry_compare_func);
-}
-
-/**
- * gst_registry_pool_remove:
- * @registry: the registry to remove
- *
- * Remove the registry from the pool.
- */
-void
-gst_registry_pool_remove (GstRegistry * registry)
-{
- g_return_if_fail (GST_IS_REGISTRY (registry));
-
- _gst_registry_pool = g_list_remove (_gst_registry_pool, registry);
-}
-#endif /* GST_DISABLE_REGISTRY */
-
-/**
- * gst_registry_pool_add_plugin:
- * @plugin: the plugin to add
- *
- * Add the plugin to the global pool of plugins.
- */
-void
-gst_registry_pool_add_plugin (GstPlugin * plugin)
-{
- _gst_registry_pool_plugins =
- g_list_prepend (_gst_registry_pool_plugins, plugin);
-}
-
-#ifndef GST_DISABLE_REGISTRY
-static void
-_registry_load_func (GstRegistry * registry, gpointer user_data)
-{
- if (!(registry->flags & GST_REGISTRY_DELAYED_LOADING)) {
- gst_registry_load (registry);
- }
-}
-#endif /* GST_DISABLE_REGISTRY */
-
-/**
- * gst_registry_pool_load_all:
- *
- * Load all the registries in the pool. Registries with the
- * GST_REGISTRY_DELAYED_LOADING will not be loaded.
- */
-void
-gst_registry_pool_load_all (void)
-{
-#ifndef GST_DISABLE_REGISTRY
- g_list_foreach (_gst_registry_pool, (GFunc) _registry_load_func, NULL);
-#endif /* GST_DISABLE_REGISTRY */
-}
-
-/**
- * gst_registry_pool_plugin_list:
- *
- * Get a list of all plugins in the pool.
- *
- * Returns: a newly allocated GList of #GstPlugin.
- */
-GList *
-gst_registry_pool_plugin_list (void)
-{
- return gst_registry_pool_plugin_filter (NULL, FALSE, NULL);
-}
-
-/**
- * gst_registry_pool_plugin_filter:
- * @filter: the filter to use
- * @first: only return first match
- * @user_data: user data passed to the filter function
- *
- * Runs a filter against all plugins in all registries and returns a GList with
- * the results. If the first flag is set, only the first match is
- * returned (as a list with a single object).
- *
- * Returns: a newly allocated GList of #GstPlugin.
- */
-GList *
-gst_registry_pool_plugin_filter (GstPluginFilter filter, gboolean first,
- gpointer user_data)
-{
- GList *result = NULL;
- GList *temp;
-
-#ifndef GST_DISABLE_REGISTRY
- GList *walk;
-
- walk = _gst_registry_pool;
-
- while (walk) {
- GstRegistry *registry = GST_REGISTRY (walk->data);
-
- temp = gst_registry_plugin_filter (registry, filter, first, user_data);
- if (temp && first)
- return temp;
-
- result = g_list_concat (result, temp);
-
- walk = g_list_next (walk);
- }
-#endif /* GST_DISABLE_REGISTRY */
-
- temp =
- gst_filter_run (_gst_registry_pool_plugins, (GstFilterFunc) filter, first,
- user_data);
-
- result = g_list_concat (result, temp);
-
- return result;
-}
-
-/**
- * gst_registry_pool_feature_list:
- * @type: the type of the features to list.
- *
- * Get a list of all pluginfeatures of the given type in the pool.
- *
- * Returns: a newly allocated #GList of #GstPluginFeature.
- */
-GList *
-gst_registry_pool_feature_list (GType type)
-{
- GstTypeNameData data;
-
- data.name = NULL;
- data.type = type;
-
- return gst_registry_pool_feature_filter (
- (GstPluginFeatureFilter) gst_plugin_feature_type_name_filter,
- FALSE, &data);
-}
-
-/**
- * gst_registry_pool_feature_filter:
- * @filter: the filter to apply to the feature list
- * @first: return the first matching feature
- * @user_data: data passed to the filter function
- *
- * Apply the filter function to all features and return a list
- * of those features that satisfy the filter. If the first flag
- * is TRUE, only the first match is returned in a GList with
- * one element.
- *
- * Returns: a GList of pluginfeatures, g_list_free after use.
- */
-GList *
-gst_registry_pool_feature_filter (GstPluginFeatureFilter filter, gboolean first,
- gpointer user_data)
-{
- GList *result = NULL;
- GList *temp;
-
-#ifndef GST_DISABLE_REGISTRY
- GList *walk;
-
- walk = _gst_registry_pool;
-
- while (walk) {
- GstRegistry *registry = GST_REGISTRY (walk->data);
-
- temp = gst_registry_feature_filter (registry, filter, first, user_data);
- if (temp && first)
- return temp;
-
- result = g_list_concat (result, temp);
-
- walk = g_list_next (walk);
- }
-#endif /* GST_DISABLE_REGISTRY */
-
- temp =
- gst_plugin_list_feature_filter (_gst_registry_pool_plugins, filter, first,
- user_data);
-
- result = g_list_concat (result, temp);
-
- return result;
-}
-
-/**
- * gst_registry_pool_find_plugin:
- * @name: the name of the plugin to find
- *
- * Get the named plugin from the registry pool
- *
- * Returns: The plugin with the given name or NULL if the plugin
- * was not found.
- */
-GstPlugin *
-gst_registry_pool_find_plugin (const gchar * name)
-{
- GstPlugin *result = NULL;
- GList *walk;
-
- g_return_val_if_fail (name != NULL, NULL);
-
- walk =
- gst_registry_pool_plugin_filter ((GstPluginFilter) gst_plugin_name_filter,
- TRUE, (gpointer) name);
-
- if (walk)
- result = GST_PLUGIN (walk->data);
-
- g_list_free (walk);
-
- return result;
-}
-
-/**
- * gst_registry_pool_find_feature:
- * @name: the name of the pluginfeature to find
- * @type: the type of the pluginfeature to find
- *
- * Get the pluginfeature with the given name and type from the pool of
- * registries.
- *
- * Returns: A pluginfeature with the given name and type or NULL if the feature
- * was not found.
- */
-GstPluginFeature *
-gst_registry_pool_find_feature (const gchar * name, GType type)
-{
- GstPluginFeature *result = NULL;
- GList *walk;
- GstTypeNameData data;
-
- g_return_val_if_fail (name != NULL, NULL);
-
- data.type = type;
- data.name = name;
-
- walk = gst_registry_pool_feature_filter ((GstPluginFeatureFilter)
- gst_plugin_feature_type_name_filter, TRUE, &data);
-
- if (walk)
- result = GST_PLUGIN_FEATURE (walk->data);
-
- g_list_free (walk);
-
- return result;
-}
-
-/**
- * gst_registry_pool_get_prefered:
- * @flags: The flags for the prefered registry
- *
- * Get the prefered registry with the given flags
- *
- * Returns: The registry with the flags.
- */
-GstRegistry *
-gst_registry_pool_get_prefered (GstRegistryFlags flags)
-{
-#ifndef GST_DISABLE_REGISTRY
- GList *walk = _gst_registry_pool;
-
- while (walk) {
- GstRegistry *registry = GST_REGISTRY (walk->data);
-
- if (registry->flags & flags)
- return registry;
-
- walk = g_list_next (walk);
- }
-#endif /* GST_DISABLE_REGISTRY */
- return NULL;
-}
diff --git a/gst/gstregistrypool.h b/gst/gstregistrypool.h
--- a/gst/gstregistrypool.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* GStreamer
- * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
- * 2000 Wim Taymans <wim.taymans@chello.be>
- *
- * gstregistrypool.h: maintain list of registries and plugins
- *
- * 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.
- */
-
-
-#ifndef __GST_REGISTRY_POOL_H__
-#define __GST_REGISTRY_POOL_H__
-
-G_BEGIN_DECLS
-
-#include <gst/gstplugin.h>
-#include <gst/gstregistry.h>
-
-/* the pool of registries */
-GList* gst_registry_pool_list (void);
-
-void gst_registry_pool_add (GstRegistry *registry, guint priority);
-void gst_registry_pool_remove (GstRegistry *registry);
-
-void gst_registry_pool_add_plugin (GstPlugin *plugin);
-
-void gst_registry_pool_load_all (void);
-
-/* query the plugins/features */
-GList* gst_registry_pool_plugin_filter (GstPluginFilter filter,
- gboolean first, gpointer user_data);
-GList* gst_registry_pool_feature_filter (GstPluginFeatureFilter filter,
- gboolean first, gpointer user_data);
-
-/* some predefined filters */
-GList* gst_registry_pool_plugin_list (void);
-GList* gst_registry_pool_feature_list (GType type);
-
-GstPlugin* gst_registry_pool_find_plugin (const gchar *name);
-GstPluginFeature* gst_registry_pool_find_feature (const gchar *name, GType type);
-
-GstRegistry* gst_registry_pool_get_prefered (GstRegistryFlags flags);
-
-G_END_DECLS
-
-#endif /* __GST_REGISTRY_POOL_H__ */
diff --git a/gst/gsttypefind.c b/gst/gsttypefind.c
index 02862363b81c534d1e5e7fa2c684f1678cb661bd..9c7b46578a4a8b78a3a5056aa2ccca52e2cb4ea3 100644 (file)
--- a/gst/gsttypefind.c
+++ b/gst/gsttypefind.c
#include "gst_private.h"
#include "gstinfo.h"
#include "gsttypefind.h"
+#include "gstregistry.h"
#include "gsttypefindfactory.h"
-#include "gstregistrypool.h"
GST_DEBUG_CATEGORY_EXTERN (gst_type_find_debug);
#define GST_CAT_DEFAULT gst_type_find_debug
GST_INFO ("registering typefind function for %s", name);
factory =
- GST_TYPE_FIND_FACTORY (gst_registry_pool_find_feature (name,
- GST_TYPE_TYPE_FIND_FACTORY));
+ GST_TYPE_FIND_FACTORY (gst_registry_find_feature (gst_registry_get_default
+ (), name, GST_TYPE_TYPE_FIND_FACTORY));
if (!factory) {
factory = g_object_new (GST_TYPE_TYPE_FIND_FACTORY, NULL);
GST_DEBUG_OBJECT (factory, "using new typefind factory for %s", name);
index c15d180c33cac4d03caa97218be406cd79989e4a..18b7573f6bbed9ec6b7cc95d5582fb0057fc1c4d 100644 (file)
--- a/gst/gsttypefindfactory.c
+++ b/gst/gsttypefindfactory.c
#include "gstinfo.h"
#include "gsttypefind.h"
#include "gsttypefindfactory.h"
-#include "gstregistrypool.h"
+#include "gstregistry.h"
GST_DEBUG_CATEGORY (gst_type_find_debug);
#define GST_CAT_DEFAULT gst_type_find_debug
gpointer g_class);
static void gst_type_find_factory_dispose (GObject * object);
-static void gst_type_find_factory_unload_thyself (GstPluginFeature * feature);
-
static void gst_type_find_load_plugin (GstTypeFind * find, gpointer data);
static GstPluginFeatureClass *parent_class = NULL;
static void
gst_type_find_factory_class_init (gpointer g_class, gpointer class_data)
{
- GstPluginFeatureClass *gstpluginfeature_class =
- GST_PLUGIN_FEATURE_CLASS (g_class);
GObjectClass *object_class = G_OBJECT_CLASS (g_class);
parent_class = g_type_class_peek_parent (g_class);
object_class->dispose = gst_type_find_factory_dispose;
-
- gstpluginfeature_class->unload_thyself =
- GST_DEBUG_FUNCPTR (gst_type_find_factory_unload_thyself);
}
static void
gst_type_find_factory_init (GTypeInstance * instance, gpointer g_class)
}
}
static void
-gst_type_find_factory_unload_thyself (GstPluginFeature * feature)
-{
- GstTypeFindFactory *factory = GST_TYPE_FIND_FACTORY (feature);
-
- factory->function = gst_type_find_load_plugin;
- factory->user_data = factory;
-}
-static void
gst_type_find_load_plugin (GstTypeFind * find, gpointer data)
{
GstTypeFindFactory *factory = GST_TYPE_FIND_FACTORY (data);
GST_DEBUG_OBJECT (factory, "need to load typefind function %s",
GST_PLUGIN_FEATURE_NAME (factory));
- if (gst_plugin_feature_ensure_loaded (GST_PLUGIN_FEATURE (factory))) {
+ factory =
+ GST_TYPE_FIND_FACTORY (gst_plugin_feature_load (GST_PLUGIN_FEATURE
+ (factory)));
+ if (factory) {
if (factory->function == gst_type_find_load_plugin) {
/* looks like we didn't get a real typefind function */
g_warning ("could not load valid typefind function for feature '%s'\n",
GList *
gst_type_find_factory_get_list (void)
{
- return gst_registry_pool_feature_list (GST_TYPE_TYPE_FIND_FACTORY);
+ return gst_registry_get_feature_list (gst_registry_get_default (),
+ GST_TYPE_TYPE_FIND_FACTORY);
}
/**
diff --git a/gst/gsturi.c b/gst/gsturi.c
index 4dd51c0ddc3fe6e9ef19824df801ee8ca59f3cc2..31c47e21fabb3308b329105515b2305024c933f4 100644 (file)
--- a/gst/gsturi.c
+++ b/gst/gsturi.c
#include "gst_private.h"
#include "gsturi.h"
#include "gstinfo.h"
-#include "gstregistrypool.h"
#include "gstmarshal.h"
+#include "gstregistry.h"
#include <string.h>
entry.type = type;
entry.protocol = gst_uri_get_protocol (uri);
- possibilities =
- gst_registry_pool_feature_filter (search_by_entry, FALSE, &entry);
+ possibilities = gst_registry_feature_filter (gst_registry_get_default (),
+ search_by_entry, FALSE, &entry);
g_free (entry.protocol);
if (!possibilities) {
index ca7b60c2fa88bef8c7b451c5d7a227d060a65bc0..14e02f8cbf1d94dafc1ac41af1954b23468d40e1 100644 (file)
--- a/tests/check/Makefile.am
+++ b/tests/check/Makefile.am
TESTS_ENVIRONMENT = \
$(REGISTRY_ENVIRONMENT) \
GST_PLUGIN_PATH_ONLY=yes \
- GST_PLUGIN_PATH=$(top_builddir)/gst
+ GST_PLUGIN_PATH=$(top_builddir)/gst/elements/.libs:$(top_builddir)/gst/indexers/.libs
plugindir = $(libdir)/gstreamer-@GST_MAJORMINOR@
-# rebuild gst-register-@GST_MAJORMINOR@ if needed
-$(top_builddir)/tools/gst-register-@GST_MAJORMINOR@$(EXEEXT):
- cd $(top_builddir)/tools && make
-
# override to _not_ install the test plugins
install-pluginLTLIBRARIES:
clean-local: clean-local-check
-$(CHECK_REGISTRY):
- $(TESTS_ENVIRONMENT) \
- $(top_builddir)/tools/gst-register-@GST_MAJORMINOR@
-
check_PROGRAMS = \
gst/gst \
gst/gstbin \
gst-libs/controller \
gst-libs/gdp
-TESTS = $(top_builddir)/tools/gst-register-@GST_MAJORMINOR@ \
- $(check_PROGRAMS)
+TESTS = $(check_PROGRAMS)
noinst_HEADERS = gst/capslist.h
gst/gstobject
VALGRIND_TESTS_DISABLE = \
- $(top_builddir)/tools/gst-register-@GST_MAJORMINOR@ \
$(TESTS_THREADED) \
$(TESTS_TO_FIX)
index 41d8fba730547280a21c7fe7e1aaa900a9747185..1531c4f6ff72828337bf2a4c4ad6c938e3041a45 100644 (file)
GstElement *element;
GList *features, *f;
- features = gst_registry_pool_feature_list (GST_TYPE_ELEMENT_FACTORY);
+ features = gst_registry_get_feature_list (gst_registry_get_default (),
+ GST_TYPE_ELEMENT_FACTORY);
for (f = features; f; f = f->next) {
GstPluginFeature *feature = f->data;
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 7fa04e85d2472915453cbb3b2041745350144887..fa53d6c1f62e93dc0e0f6024b9e1ceb21280dcc2 100644 (file)
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
### assemble a list of programs we want to build and install
-if GST_DISABLE_REGISTRY
-GST_REGISTRY_SRC =
-GST_REGISTRY_SRC_V =
-else
-GST_REGISTRY_SRC = gst-register
-GST_REGISTRY_SRC_V = gst-register-@GST_MAJORMINOR@
-endif
if GST_DISABLE_LOADSAVE
GST_LOADSAVE_SRC =
### so all of the programs we want to build
bin_PROGRAMS = \
- $(GST_REGISTRY_SRC) $(GST_REGISTRY_SRC_V) \
$(GST_LOADSAVE_SRC) $(GST_LOADSAVE_SRC_V) \
$(GST_OTHER_SRC) $(GST_OTHER_SRC_V)
bin_SCRIPTS = gst-feedback-@GST_MAJORMINOR@
# make sure each versioned tool has the right source file and flags
-if !GST_DISABLE_REGISTRY
-gst_register_@GST_MAJORMINOR@_SOURCES = gst-register.c
-gst_register_@GST_MAJORMINOR@_CFLAGS = $(GST_OBJ_CFLAGS)
-gst_register_@GST_MAJORMINOR@_LDFLAGS = $(GST_OBJ_LIBS)
-endif
if !GST_DISABLE_LOADSAVE
gst_complete_@GST_MAJORMINOR@_SOURCES = gst-complete.c
gst_complete_@GST_MAJORMINOR@_CFLAGS = $(GST_OBJ_CFLAGS)
chmod +x $@
# make sure each unversioned tool comes from gst-run.c
-if !GST_DISABLE_REGISTRY
-gst_register_SOURCES = gst-run.c
-endif
if !GST_DISABLE_LOADSAVE
gst_complete_SOURCES = gst-run.c
gst_compprep_SOURCES = gst-run.c
AM_CPPFLAGS = $(GLIB_ONLY_CFLAGS) $(POPT_CFLAGS)
### man pages we want to install
-if GST_DISABLE_REGISTRY
-GST_REGISTRY_MAN=
-else
-GST_REGISTRY_MAN = gst-register-@GST_MAJORMINOR@.1
-endif
-
if GST_DISABLE_LOADSAVE
GST_LOADSAVE_MAN=
else
gst-typefind-@GST_MAJORMINOR@.1 \
gst-xmlinspect-@GST_MAJORMINOR@.1
-manpages = $(GST_REGISTRY_MAN) $(GST_LOADSAVE_MAN) $(GST_OTHER_MAN)
+manpages = $(GST_LOADSAVE_MAN) $(GST_OTHER_MAN)
CLEANFILES = $(manpages) $(bin_SCRIPTS)
man_MANS = $(manpages)
gst-inspect.1.in \
gst-launch.1.in \
gst-md5sum.1.in \
- gst-register.1.in \
gst-typefind.1.in \
gst-xmlinspect.1.in \
gst-xmllaunch.1.in \
-e s,gst-inspect,gst-inspect-@GST_MAJORMINOR@,g \
-e s,gst-launch,gst-launch-@GST_MAJORMINOR@,g \
-e s,gst-md5sum,gst-md5sum-@GST_MAJORMINOR@,g \
- -e s,gst-register,gst-register-@GST_MAJORMINOR@,g \
-e s,gst-typefind,gst-typefind-@GST_MAJORMINOR@,g \
-e s,gst-xmlinspect,gst-xmlinspect-@GST_MAJORMINOR@,g \
-e s,gst-xmllaunch,gst-xmllaunch-@GST_MAJORMINOR@,g \
diff --git a/tools/gst-compprep.c b/tools/gst-compprep.c
index 93f8b9372dd52096f6df754330280a86e0433888..c74e52310ae347a989c5aa59843f45d6165d6aa5 100644 (file)
--- a/tools/gst-compprep.c
+++ b/tools/gst-compprep.c
{
xmlDocPtr doc;
xmlNodePtr factorynode, padnode, argnode, optionnode;
- GList *plugins, *features, *padtemplates;
+ GList *element_factories, *padtemplates, *g;
const GList *pads;
GstElement *element;
GstPad *pad;
doc->xmlRootNode = xmlNewDocNode (doc, NULL,
(xmlChar *) "GST-CompletionRegistry", NULL);
- plugins = g_list_copy (gst_registry_pool_plugin_list ());
- while (plugins) {
- GstPlugin *plugin;
-
- plugin = (GstPlugin *) (plugins->data);
- plugins = g_list_next (plugins);
-
- features = g_list_copy (gst_plugin_get_feature_list (plugin));
- while (features) {
- GstPluginFeature *feature;
- GstElementFactory *factory;
-
- feature = GST_PLUGIN_FEATURE (features->data);
- features = g_list_next (features);
-
- if (!GST_IS_ELEMENT_FACTORY (feature))
- continue;
-
- factory = GST_ELEMENT_FACTORY (feature);
-
- factorynode = xmlNewChild (doc->xmlRootNode, NULL, (xmlChar *) "element",
- NULL);
- xmlNewChild (factorynode, NULL, (xmlChar *) "name",
- (xmlChar *) GST_PLUGIN_FEATURE_NAME (factory));
-
- element = gst_element_factory_create (factory, NULL);
- GST_DEBUG ("adding factory %s", GST_PLUGIN_FEATURE_NAME (factory));
- if (element == NULL) {
- GST_ERROR ("couldn't construct element from factory %s\n",
- gst_object_get_name (GST_OBJECT (factory)));
- return 1;
- }
+ element_factories =
+ gst_registry_get_feature_list (gst_registry_get_default (),
+ GST_TYPE_ELEMENT_FACTORY);
+ for (g = element_factories; g; g = g_list_next (g)) {
+ GstElementFactory *factory;
+
+ factory = GST_ELEMENT_FACTORY (g->data);
+
+ factorynode = xmlNewChild (doc->xmlRootNode, NULL, (xmlChar *) "element",
+ NULL);
+ xmlNewChild (factorynode, NULL, (xmlChar *) "name",
+ (xmlChar *) GST_PLUGIN_FEATURE_NAME (factory));
+
+ element = gst_element_factory_create (factory, NULL);
+ GST_DEBUG ("adding factory %s", GST_PLUGIN_FEATURE_NAME (factory));
+ if (element == NULL) {
+ GST_ERROR ("couldn't construct element from factory %s\n",
+ gst_object_get_name (GST_OBJECT (factory)));
+ return 1;
+ }
- /* write out the padtemplates */
- padtemplates = factory->staticpadtemplates;
- while (padtemplates) {
- padtemplate = (GstStaticPadTemplate *) (padtemplates->data);
- padtemplates = g_list_next (padtemplates);
-
- if (padtemplate->direction == GST_PAD_SRC)
- padnode =
- xmlNewChild (factorynode, NULL, (xmlChar *) "srcpadtemplate",
- (xmlChar *) padtemplate->name_template);
- else if (padtemplate->direction == GST_PAD_SINK)
- padnode =
- xmlNewChild (factorynode, NULL, (xmlChar *) "sinkpadtemplate",
- (xmlChar *) padtemplate->name_template);
- }
+ /* write out the padtemplates */
+ padtemplates = factory->staticpadtemplates;
+ while (padtemplates) {
+ padtemplate = (GstStaticPadTemplate *) (padtemplates->data);
+ padtemplates = g_list_next (padtemplates);
+
+ if (padtemplate->direction == GST_PAD_SRC)
+ padnode =
+ xmlNewChild (factorynode, NULL, (xmlChar *) "srcpadtemplate",
+ (xmlChar *) padtemplate->name_template);
+ else if (padtemplate->direction == GST_PAD_SINK)
+ padnode =
+ xmlNewChild (factorynode, NULL, (xmlChar *) "sinkpadtemplate",
+ (xmlChar *) padtemplate->name_template);
+ }
- pads = element->pads;
- while (pads) {
- pad = (GstPad *) (pads->data);
- pads = g_list_next (pads);
-
- if (GST_PAD_DIRECTION (pad) == GST_PAD_SRC)
- padnode = xmlNewChild (factorynode, NULL, (xmlChar *) "srcpad",
- (xmlChar *) GST_PAD_NAME (pad));
- else if (GST_PAD_DIRECTION (pad) == GST_PAD_SINK)
- padnode = xmlNewChild (factorynode, NULL, (xmlChar *) "sinkpad",
- (xmlChar *) GST_PAD_NAME (pad));
- }
+ pads = element->pads;
+ while (pads) {
+ pad = (GstPad *) (pads->data);
+ pads = g_list_next (pads);
+
+ if (GST_PAD_DIRECTION (pad) == GST_PAD_SRC)
+ padnode = xmlNewChild (factorynode, NULL, (xmlChar *) "srcpad",
+ (xmlChar *) GST_PAD_NAME (pad));
+ else if (GST_PAD_DIRECTION (pad) == GST_PAD_SINK)
+ padnode = xmlNewChild (factorynode, NULL, (xmlChar *) "sinkpad",
+ (xmlChar *) GST_PAD_NAME (pad));
+ }
- /* write out the args */
- property_specs =
- g_object_class_list_properties (G_OBJECT_GET_CLASS (element),
- &num_properties);
- for (i = 0; i < num_properties; i++) {
- GParamSpec *param = property_specs[i];
-
- argnode = xmlNewChild (factorynode, NULL, (xmlChar *) "argument",
- (xmlChar *) param->name);
- if (param->value_type == GST_TYPE_URI) {
- xmlNewChild (argnode, NULL, (xmlChar *) "filename", NULL);
- } else if (G_IS_PARAM_SPEC_ENUM (param) == G_TYPE_ENUM) {
- GEnumValue *values;
- gint j;
-
- values = G_ENUM_CLASS (g_type_class_ref (param->value_type))->values;
- for (j = 0; values[j].value_name; j++) {
- gchar *value = g_strdup_printf ("%d", values[j].value);
-
- optionnode = xmlNewChild (argnode, NULL, (xmlChar *) "option",
- (xmlChar *) value);
- xmlNewChild (optionnode, NULL, (xmlChar *) "value_nick",
- (xmlChar *) values[j].value_nick);
- g_free (value);
- }
+ /* write out the args */
+ property_specs =
+ g_object_class_list_properties (G_OBJECT_GET_CLASS (element),
+ &num_properties);
+ for (i = 0; i < num_properties; i++) {
+ GParamSpec *param = property_specs[i];
+
+ argnode = xmlNewChild (factorynode, NULL, (xmlChar *) "argument",
+ (xmlChar *) param->name);
+ if (param->value_type == GST_TYPE_URI) {
+ xmlNewChild (argnode, NULL, (xmlChar *) "filename", NULL);
+ } else if (G_IS_PARAM_SPEC_ENUM (param) == G_TYPE_ENUM) {
+ GEnumValue *values;
+ gint j;
+
+ values = G_ENUM_CLASS (g_type_class_ref (param->value_type))->values;
+ for (j = 0; values[j].value_name; j++) {
+ gchar *value = g_strdup_printf ("%d", values[j].value);
+
+ optionnode = xmlNewChild (argnode, NULL, (xmlChar *) "option",
+ (xmlChar *) value);
+ xmlNewChild (optionnode, NULL, (xmlChar *) "value_nick",
+ (xmlChar *) values[j].value_nick);
+ g_free (value);
}
}
g_free (property_specs);
diff --git a/tools/gst-inspect.c b/tools/gst-inspect.c
index d2d4b1df0a6e46390b0775dd53c6eed6a4fffc65..43c4ff119d92bcdf8c5a27ad7aee3d16b247af9c 100644 (file)
--- a/tools/gst-inspect.c
+++ b/tools/gst-inspect.c
{
GList *plugins;
- plugins = gst_registry_pool_plugin_list ();
+ plugins = gst_default_registry_get_plugin_list ();
while (plugins) {
GList *features;
GstPlugin *plugin;
/* FIXME implement other pretty print function for these */
#ifndef GST_DISABLE_INDEX
- feature = gst_registry_pool_find_feature (element_name,
+ feature = gst_default_registry_find_feature (element_name,
GST_TYPE_INDEX_FACTORY);
if (feature) {
n_print ("%s: an index\n", element_name);
return 0;
}
#endif
- feature = gst_registry_pool_find_feature (element_name,
+ feature = gst_default_registry_find_feature (element_name,
GST_TYPE_TYPE_FIND_FACTORY);
if (feature) {
n_print ("%s: a typefind function\n", element_name);
return 0;
}
#ifndef GST_DISABLE_URI
- feature = gst_registry_pool_find_feature (element_name, GST_TYPE_URI_HANDLER);
+ feature = gst_default_registry_find_feature (element_name,
+ GST_TYPE_URI_HANDLER);
if (feature) {
n_print ("%s: an uri handler\n", element_name);
return 0;
GstElement *element;
gint maxlevel = 0;
+ factory =
+ GST_ELEMENT_FACTORY (gst_plugin_feature_load (GST_PLUGIN_FEATURE
+ (factory)));
+
element = gst_element_factory_create (factory, NULL);
if (!element) {
g_print ("couldn't construct element for some reason\n");
_name = "";
print_factory_details_info (factory);
- if (GST_PLUGIN_FEATURE (factory)->manager) {
- GstPlugin *plugin = (GstPlugin *) GST_PLUGIN_FEATURE (factory)->manager;
+ if (GST_PLUGIN_FEATURE (factory)->plugin) {
+ GstPlugin *plugin = (GstPlugin *) GST_PLUGIN_FEATURE (factory)->plugin;
print_plugin_info (plugin);
}
/* otherwise check if it's a plugin */
if (retval) {
- plugin = gst_registry_pool_find_plugin (arg);
+ plugin = gst_default_registry_find_plugin (arg);
/* if there is such a plugin, print out info */
if (plugin) {
diff --git a/tools/gst-register.c b/tools/gst-register.c
--- a/tools/gst-register.c
+++ /dev/null
@@ -1,172 +0,0 @@
-/* GStreamer
- * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
- * 2000 Wim Taymans <wtay@chello.be>
- *
- * gst-register.c: Plugin subsystem for loading elements, types, and libs
- *
- * 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.
- */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <gst/gst.h>
-
-#include <stdlib.h>
-#include <stdio.h>
-
-#include <fcntl.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <string.h>
-#include <errno.h>
-#include <locale.h>
-
-#include "gst/gst-i18n-app.h"
-
-static gint num_features = 0;
-static gint num_plugins = 0;
-
-static void
-plugin_added_func (GstRegistry * registry, GstPlugin * plugin,
- gpointer user_data)
-{
- g_print (_("Added plugin %s with %d %s.\n"), plugin->desc.name,
- plugin->numfeatures,
- ngettext ("feature", "features", plugin->numfeatures));
-
- num_features += plugin->numfeatures;
- num_plugins++;
-}
-
-static void
-spawn_all_in_dir (const char *dirname)
-{
- char *argv[2] = { NULL, NULL };
- GDir *dir;
- const char *file;
-
- /* g_print("spawning all in %s\n", dirname); */
-
- dir = g_dir_open (dirname, 0, NULL);
- if (dir == NULL)
- return;
-
- while ((file = g_dir_read_name (dir))) {
- argv[0] = g_build_filename (dirname, file, NULL);
- g_print ("running %s\n", argv[0]);
- g_spawn_sync (NULL, argv, NULL, G_SPAWN_FILE_AND_ARGV_ZERO, NULL, NULL,
- NULL, NULL, NULL, NULL);
- g_free (argv[0]);
- }
- g_dir_close (dir);
-}
-
-int
-main (int argc, char *argv[])
-{
- GList *registries;
- GList *path_spill = NULL; /* used for path spill from failing registries */
-
-#ifdef GETTEXT_PACKAGE
- bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
- textdomain (GETTEXT_PACKAGE);
-#endif
-
- /* Init gst */
- _gst_registry_auto_load = FALSE;
- gst_init (&argc, &argv);
-
- registries = gst_registry_pool_list ();
- registries = g_list_reverse (registries);
-
- while (registries) {
- GstRegistry *registry = GST_REGISTRY (registries->data);
- GList *dir_list;
- GList *iter;
- char *dir;
-
- if (path_spill) {
- GList *iter;
-
- /* add spilled paths to this registry;
- * since they're spilled they probably weren't loaded correctly
- * so we should give a lower priority registry the chance to do them */
- for (iter = path_spill; iter; iter = iter->next) {
- g_print (_("Added path %s to %s \n"),
- (const char *) iter->data, registry->name);
- gst_registry_add_path (registry, (const gchar *) iter->data);
- }
- g_list_free (path_spill);
- path_spill = NULL;
- }
-
- g_signal_connect (G_OBJECT (registry), "plugin_added",
- G_CALLBACK (plugin_added_func), NULL);
-
- if (registry->flags & GST_REGISTRY_WRITABLE) {
- char *location;
-
- g_object_get (registry, "location", &location, NULL);
- g_print (_("Rebuilding %s (%s) ...\n"), registry->name, location);
- g_free (location);
- gst_registry_rebuild (registry);
- gst_registry_save (registry);
- } else {
- g_print (_("Trying to load %s ...\n"), registry->name);
- if (!gst_registry_load (registry)) {
- g_print (_("Error loading %s\n"), registry->name);
- /* move over paths from this registry to the next one */
- path_spill = g_list_concat (path_spill,
- gst_registry_get_path_list (registry));
- /* this assertion triggers for a non-readable/writable user registry,
- * see #148283 */
- /* g_assert (path_spill != NULL); */
- }
- /* also move over paths if the registry wasn't writable
- * FIXME: we should check if the paths that were loaded from this
- registry get removed from the path_list so we only try to
- spill paths that could not be registered */
- /* Until that is done, don't spill paths when registry is not writable
- (e.g. case of user running gst-register and sysreg not writable) */
-
- /*
- path_spill = g_list_concat (path_spill,
- gst_registry_get_path_list (registry));
- */
- }
-
- dir_list = gst_registry_get_path_list (registry);
- for (iter = dir_list; iter; iter = iter->next) {
- dir =
- g_build_filename ((const char *) iter->data, "register-scripts",
- NULL);
- spawn_all_in_dir (dir);
- g_free (dir);
- }
- g_list_free (dir_list);
-
- registries = g_list_next (registries);
- }
-
- g_print (_("Loaded %d plugins with %d %s.\n"), num_plugins, num_features,
- ngettext ("feature", "features", num_features));
-
- return (0);
-}
diff --git a/tools/gst-xmlinspect.c b/tools/gst-xmlinspect.c
index ab68a6ad1e4e7939c45002b6ef07b7fc17a5702e..1acbbf32f3382d742b8ef49ae376d3f525016ebc 100644 (file)
--- a/tools/gst-xmlinspect.c
+++ b/tools/gst-xmlinspect.c
{
GList *plugins;
- plugins = gst_registry_pool_plugin_list ();
+ plugins = gst_default_registry_get_plugin_list ();
while (plugins) {
GList *features;
GstPlugin *plugin;
/* FIXME implement other pretty print function for these */
#ifndef GST_DISABLE_INDEX
- feature = gst_registry_pool_find_feature (argv[1],
+ feature = gst_default_registry_find_feature (argv[1],
GST_TYPE_INDEX_FACTORY);
if (feature) {
g_print ("%s: an index\n", argv[1]);
return 0;
}
#endif
- feature = gst_registry_pool_find_feature (argv[1],
+ feature = gst_default_registry_find_feature (argv[1],
GST_TYPE_TYPE_FIND_FACTORY);
if (feature) {
g_print ("%s: a type find function\n", argv[1]);
return 0;
}
#ifndef GST_DISABLE_URI
- feature = gst_registry_pool_find_feature (argv[1],
+ feature = gst_default_registry_find_feature (argv[1],
GST_TYPE_URI_HANDLER);
if (feature) {
g_print ("%s: an uri handler\n", argv[1]);
}
/* otherwise assume it's a plugin */
- plugin = gst_registry_pool_find_plugin (argv[1]);
+ plugin = gst_default_registry_find_plugin (argv[1]);
/* if there is such a plugin, print out info */