Commit 086de421 authored by Wim Taymans's avatar Wim Taymans

Totally rewritten registry handling.

Original commit message from CVS:
Totally rewritten registry handling.
- move the registry save/load code into a gstregistry subclass, this
will make it possible to use other registries (flat file, web based,
RDBMS type, etc..)
- a simple GMarkup xml registry is implemented
- use standard statically linked plugins for core elements.
- GstPlugin has a very well defined set of functions now
A little bytestream hack..
Added more info to -inspect.
Some more debugging info for clocking.
Small cleanups

I use ./gst-register --gst-plugin-path=/opt/src/sourceforge/gst-plugins/gst-libs:/opt/src/sourceforge/gst-plugins/
to register core and gst-plugins now.
parent 4992f1c2
......@@ -401,6 +401,7 @@ gst/elements/Makefile
gst/parse/Makefile
gst/schedulers/Makefile
gst/types/Makefile
gst/registries/Makefile
libs/Makefile
libs/gst/Makefile
libs/gst/bytestream/Makefile
......
......@@ -44,7 +44,7 @@ endif
EXTRA_libgstreamer_la_SOURCES = gstcpuid_i386.s gstmarshal.list gstxml.c gsttypefind.c gstparse.c gstautoplug.c gsttrace.c
SUBDIRS = parse . $(GST_AUTOPLUG_DIRS) elements schedulers types
SUBDIRS = parse registries . $(GST_AUTOPLUG_DIRS) elements schedulers types
DIST_SUBDIRS = autoplug elements parse types schedulers
libcothreads_la_SOURCES = cothreads.c
......@@ -157,7 +157,7 @@ libgstreamer_la_CFLAGS = -D_GNU_SOURCE -DGST_CONFIG_DIR=\""$(GST_CONFIG_DIR)"\"
# the compiler shoots cothreads.c in the head at -O6
libcothreads_la_CFLAGS = $(libgstreamer_la_CFLAGS) -O2
libgstreamer_la_LIBADD = $(LIBGST_LIBS) parse/libgstparse.la
libgstreamer_la_LIBADD = $(LIBGST_LIBS) parse/libgstparse.la registries/libgstxmlregistry.la
libgstreamer_la_LDFLAGS = @GST_LT_LDFLAGS@ -version-info @GST_LIBVERSION@
EXTRA_DIST = ROADMAP
......@@ -237,6 +237,7 @@ gst_autoplugcache_loop (GstElement *element)
gst_object_ref (GST_OBJECT (cache));
GST_DEBUG(GST_CAT_AUTOPLUG, "state changed during signal, aborting");
gst_element_yield (GST_ELEMENT (cache));
return;
}
gst_object_unref (GST_OBJECT (cache));
}
......
......@@ -178,7 +178,8 @@ gst_spider_init (GstSpider *spider)
{
/* use only elements which have sources and sinks and where the sinks have caps */
/* FIXME: How do we handle factories that are added after the spider was constructed? */
spider->factories = gst_autoplug_factories_filters_with_sink_caps ((GList *) gst_element_factory_get_list ());
spider->factories = gst_autoplug_factories_filters_with_sink_caps ((GList *)
gst_registry_pool_feature_list (GST_TYPE_ELEMENT_FACTORY));
spider->connections = NULL;
}
......
......@@ -236,7 +236,7 @@ gst_autoplug_pads_autoplug (GstElement *src, GstElement *sink)
static const GList*
gst_autoplug_element_factory_get_list (gpointer data)
{
return gst_element_factory_get_list ();
return gst_registry_pool_feature_list (GST_TYPE_ELEMENT_FACTORY);
}
typedef struct {
......
......@@ -154,7 +154,7 @@ gst_autoplug_can_match (GstElementFactory *src, GstElementFactory *dest)
if (desttemp->direction == GST_PAD_SINK && desttemp->presence != GST_PAD_REQUEST) {
if (gst_caps_check_compatibility (GST_PAD_TEMPLATE_CAPS (srctemp), GST_PAD_TEMPLATE_CAPS (desttemp))) {
GST_DEBUG (GST_CAT_AUTOPLUG_ATTEMPT,
"factory \"%s\" can connect with factory \"%s\"\n",
"factory \"%s\" can connect with factory \"%s\"",
GST_OBJECT_NAME (src), GST_OBJECT_NAME (dest));
return TRUE;
}
......@@ -163,7 +163,7 @@ gst_autoplug_can_match (GstElementFactory *src, GstElementFactory *dest)
}
}
GST_DEBUG (GST_CAT_AUTOPLUG_ATTEMPT,
"factory \"%s\" cannot connect with factory \"%s\"\n",
"factory \"%s\" cannot connect with factory \"%s\"",
GST_OBJECT_NAME (src), GST_OBJECT_NAME (dest));
return FALSE;
}
......@@ -240,7 +240,7 @@ gst_autoplug_pads_autoplug (GstElement *src, GstElement *sink)
static GList*
gst_autoplug_element_factory_get_list (gpointer data)
{
return (GList *) gst_element_factory_get_list ();
return (GList *) gst_registry_pool_feature_list (GST_TYPE_ELEMENT_FACTORY);
}
typedef struct {
......
......@@ -569,15 +569,17 @@ gst_filesrc_open_file (GstFileSrc *src)
src->filename, strerror (errno), NULL);
return FALSE;
} else {
/* check if it is a regular file, otherwise bail out */
struct stat stat_results;
fstat(src->fd, &stat_results);
if (!S_ISREG(stat_results.st_mode)) {
gst_element_error (GST_ELEMENT (src), "opening file \"%s\" failed. it isn't a regular file",
src->filename, NULL);
close(src->fd);
return FALSE;
}
/* check if it is a regular file, otherwise bail out */
struct stat stat_results;
fstat(src->fd, &stat_results);
if (!S_ISREG(stat_results.st_mode)) {
gst_element_error (GST_ELEMENT (src), "opening file \"%s\" failed. it isn't a regular file",
src->filename, NULL);
close(src->fd);
return FALSE;
}
/* find the file length */
src->filelen = lseek (src->fd, 0, SEEK_END);
......
......@@ -30,15 +30,18 @@
#ifndef GST_DISABLE_TYPE_FIND
#include "gsttypefind.h"
#endif
#include "registries/gstxmlregistry.h"
#define MAX_PATH_SPLIT 16
#define GST_PLUGIN_SEPARATOR ","
gchar *_gst_progname;
gboolean _gst_registry_auto_load = TRUE;
static GstRegistry *_global_registry;
static GstRegistry *_user_registry;
extern gint _gst_trace_on;
extern gboolean _gst_plugin_spew;
static void load_plugin_func (gpointer data, gpointer user_data);
static void init_popt_callback (poptContext context, enum poptCallbackReason reason,
......@@ -141,14 +144,14 @@ gst_init_with_popt_table (int *argc, char **argv[], const struct poptOption *pop
const struct poptOption *options;
/* this is probably hacky, no? */
const struct poptOption options_with[] = {
{NULL, NUL, POPT_ARG_INCLUDE_TABLE, poptHelpOptions, 0, "Help options:", NULL},
{NULL, NUL, POPT_ARG_INCLUDE_TABLE, (struct poptOption *) gst_init_get_popt_table(), 0, "GStreamer options:", NULL},
{NULL, NUL, POPT_ARG_INCLUDE_TABLE, (struct poptOption *) popt_options, 0, "Application options:", NULL},
{NULL, NUL, POPT_ARG_INCLUDE_TABLE, poptHelpOptions, 0, "Help options:", NULL},
{NULL, NUL, POPT_ARG_INCLUDE_TABLE, (struct poptOption *) gst_init_get_popt_table(), 0, "GStreamer options:", NULL},
{NULL, NUL, POPT_ARG_INCLUDE_TABLE, (struct poptOption *) popt_options, 0, "Application options:", NULL},
POPT_TABLEEND
};
const struct poptOption options_without[] = {
{NULL, NUL, POPT_ARG_INCLUDE_TABLE, poptHelpOptions, 0, "Help options:", NULL},
{NULL, NUL, POPT_ARG_INCLUDE_TABLE, (struct poptOption *) gst_init_get_popt_table(), 0, "GStreamer options:", NULL},
{NULL, NUL, POPT_ARG_INCLUDE_TABLE, poptHelpOptions, 0, "Help options:", NULL},
{NULL, NUL, POPT_ARG_INCLUDE_TABLE, (struct poptOption *) gst_init_get_popt_table(), 0, "GStreamer options:", NULL},
POPT_TABLEEND
};
......@@ -199,8 +202,10 @@ gst_init_with_popt_table (int *argc, char **argv[], const struct poptOption *pop
static void
add_path_func (gpointer data, gpointer user_data)
{
GstRegistry *registry = GST_REGISTRY (user_data);
GST_INFO (GST_CAT_GST_INIT, "Adding plugin path: \"%s\"", (gchar *)data);
gst_plugin_add_path ((gchar *)data);
gst_registry_add_path (registry, (gchar *)data);
}
static void
......@@ -213,7 +218,9 @@ static void
load_plugin_func (gpointer data, gpointer user_data)
{
gboolean ret;
ret = gst_plugin_load ((gchar *)data);
//ret = gst_plugin_load ((gchar *)data);
ret = FALSE;
if (ret)
GST_INFO (GST_CAT_GST_INIT, "Loaded plugin: \"%s\"", (gchar *)data);
else
......@@ -234,7 +241,7 @@ parse_number (const gchar *number, guint32 *val)
}
static void
split_and_iterate (const gchar *stringlist, gchar *separator, GFunc iterator)
split_and_iterate (const gchar *stringlist, gchar *separator, GFunc iterator, gpointer user_data)
{
gchar **strings;
gint j = 0;
......@@ -246,7 +253,7 @@ split_and_iterate (const gchar *stringlist, gchar *separator, GFunc iterator)
lastlist = NULL;
while (strings[j]) {
iterator (strings[j], NULL);
iterator (strings[j], user_data);
if (++j == MAX_PATH_SPLIT) {
lastlist = g_strdup (strings[j]);
g_strfreev (strings);
......@@ -260,12 +267,67 @@ split_and_iterate (const gchar *stringlist, gchar *separator, GFunc iterator)
static void
init_pre (void)
{
const gchar *homedir;
gchar *user_reg;
if (!g_thread_supported ())
g_thread_init (NULL);
g_type_init();
_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_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/schedulers");
#else
/* add the main (installed) library path */
gst_registry_add_path (_global_registry, PLUGINS_DIR);
#endif /* PLUGINS_USE_BUILDDIR */
gst_registry_pool_add (_global_registry, 100);
homedir = g_get_home_dir ();
user_reg = g_strjoin ("/", homedir, LOCAL_REGISTRY_FILE, NULL);
_user_registry = gst_xml_registry_new ("user_registry", user_reg);
gst_registry_pool_add (_user_registry, 50);
g_free (user_reg);
}
static gboolean
gst_register_core_elements (GModule *module, GstPlugin *plugin)
{
GstElementFactory *factory;
/* register some standard builtin types */
factory = gst_element_factory_new ("bin", gst_bin_get_type (), &gst_bin_details);
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
factory = gst_element_factory_new ("pipeline", gst_pipeline_get_type (), &gst_pipeline_details);
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
factory = gst_element_factory_new ("thread", gst_thread_get_type (), &gst_thread_details);
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
factory = gst_element_factory_new ("queue", gst_queue_get_type (), &gst_queue_details);
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
#ifndef GST_DISABLE_TYPE_FIND
factory = gst_element_factory_new ("typefind", gst_type_find_get_type (), &gst_type_find_details);
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
#endif
return TRUE;
}
static GstPluginDesc plugin_desc = {
GST_VERSION_MAJOR,
GST_VERSION_MINOR,
"gst_core_plugins",
gst_register_core_elements
};
static void
init_post (void)
{
......@@ -294,8 +356,12 @@ init_post (void)
gst_autoplug_factory_get_type ();
#endif
plugin_path = g_getenv("GST_PLUGIN_PATH");
split_and_iterate (plugin_path, G_SEARCHPATH_SEPARATOR_S, add_path_func);
split_and_iterate (plugin_path, G_SEARCHPATH_SEPARATOR_S, add_path_func, _global_registry);
/* register core plugins */
_gst_plugin_register_static (&plugin_desc);
_gst_cpu_initialize ();
_gst_props_initialize ();
......@@ -305,6 +371,10 @@ init_post (void)
_gst_buffer_initialize ();
_gst_buffer_pool_initialize ();
if (_gst_registry_auto_load) {
gst_registry_pool_load_all ();
}
/* if we need to preload plugins */
if (preload_plugins) {
g_slist_foreach (preload_plugins, load_plugin_func, NULL);
......@@ -312,15 +382,6 @@ init_post (void)
preload_plugins = NULL;
}
/* register some standard builtin types */
gst_element_factory_new ("bin", gst_bin_get_type (), &gst_bin_details);
gst_element_factory_new ("pipeline", gst_pipeline_get_type (), &gst_pipeline_details);
gst_element_factory_new ("thread", gst_thread_get_type (), &gst_thread_details);
gst_element_factory_new ("queue", gst_queue_get_type (), &gst_queue_details);
#ifndef GST_DISABLE_TYPE_FIND
gst_element_factory_new ("typefind", gst_type_find_get_type (), &gst_type_find_details);
#endif
#ifndef GST_DISABLE_TRACE
_gst_trace_on = 0;
if (_gst_trace_on) {
......@@ -395,13 +456,12 @@ init_popt_callback (poptContext context, enum poptCallbackReason reason,
gst_mask_help ();
exit (0);
case ARG_PLUGIN_SPEW:
_gst_plugin_spew = TRUE;
break;
case ARG_PLUGIN_PATH:
split_and_iterate (arg, G_SEARCHPATH_SEPARATOR_S, add_path_func);
split_and_iterate (arg, G_SEARCHPATH_SEPARATOR_S, add_path_func, _user_registry);
break;
case ARG_PLUGIN_LOAD:
split_and_iterate (arg, ",", prepare_for_load_plugin_func);
split_and_iterate (arg, ",", prepare_for_load_plugin_func, NULL);
break;
case ARG_SCHEDULER:
gst_scheduler_factory_set_default_name (arg);
......
......@@ -62,12 +62,13 @@ extern "C" {
#endif /* __cplusplus */
/* initialize GST */
void gst_init (int *argc, char **argv[]);
void gst_init_with_popt_table (int *argc, char **argv[], const struct poptOption *popt_options);
const struct poptOption *gst_init_get_popt_table (void);
void gst_init (int *argc, char **argv[]);
void gst_init_with_popt_table (int *argc, char **argv[],
const struct poptOption *popt_options);
const struct poptOption* gst_init_get_popt_table (void);
void gst_main (void);
void gst_main_quit (void);
void gst_main (void);
void gst_main_quit (void);
#ifdef __cplusplus
}
......
......@@ -27,8 +27,7 @@
#include "gst_private.h"
#include "gstautoplug.h"
static GList* _gst_autoplugfactories;
#include "gstregistry.h"
enum {
NEW_OBJECT,
......@@ -171,11 +170,6 @@ gst_autoplug_to_renderers (GstAutoplug *autoplug, GstCaps *srccaps, GstElement *
static void gst_autoplug_factory_class_init (GstAutoplugFactoryClass *klass);
static void gst_autoplug_factory_init (GstAutoplugFactory *factory);
#ifndef GST_DISABLE_REGISTRY
static xmlNodePtr gst_autoplug_factory_save_thyself (GstObject *object, xmlNodePtr parent);
static void gst_autoplug_factory_restore_thyself (GstObject *object, xmlNodePtr parent);
#endif
static GstPluginFeatureClass *factory_parent_class = NULL;
/* static guint gst_autoplug_factory_signals[LAST_SIGNAL] = { 0 }; */
......@@ -215,19 +209,11 @@ gst_autoplug_factory_class_init (GstAutoplugFactoryClass *klass)
gstpluginfeature_class = (GstPluginFeatureClass*) klass;
factory_parent_class = g_type_class_ref (GST_TYPE_PLUGIN_FEATURE);
#ifndef GST_DISABLE_REGISTRY
gstobject_class->save_thyself = GST_DEBUG_FUNCPTR (gst_autoplug_factory_save_thyself);
gstobject_class->restore_thyself = GST_DEBUG_FUNCPTR (gst_autoplug_factory_restore_thyself);
#endif
_gst_autoplugfactories = NULL;
}
static void
gst_autoplug_factory_init (GstAutoplugFactory *factory)
{
_gst_autoplugfactories = g_list_prepend (_gst_autoplugfactories, factory);
}
......@@ -252,7 +238,7 @@ gst_autoplug_factory_new (const gchar *name, const gchar *longdesc, GType type)
factory = GST_AUTOPLUG_FACTORY (g_object_new (GST_TYPE_AUTOPLUG_FACTORY, NULL));
}
gst_object_set_name (GST_OBJECT (factory), name);
GST_PLUGIN_FEATURE_NAME (factory) = g_strdup (name);
if (factory->longdesc)
g_free (factory->longdesc);
factory->longdesc = g_strdup (longdesc);
......@@ -272,8 +258,6 @@ gst_autoplug_factory_destroy (GstAutoplugFactory *factory)
{
g_return_if_fail (factory != NULL);
_gst_autoplugfactories = g_list_remove (_gst_autoplugfactories, factory);
/* we don't free the struct bacause someone might have a handle to it.. */
}
......@@ -288,37 +272,19 @@ gst_autoplug_factory_destroy (GstAutoplugFactory *factory)
GstAutoplugFactory*
gst_autoplug_factory_find (const gchar *name)
{
GList *walk;
GstAutoplugFactory *factory;
GstPluginFeature *feature;
g_return_val_if_fail(name != NULL, NULL);
g_return_val_if_fail (name != NULL, NULL);
GST_DEBUG (0,"gstautoplug: find \"%s\"", name);
walk = _gst_autoplugfactories;
while (walk) {
factory = (GstAutoplugFactory *)(walk->data);
if (!strcmp (name, GST_OBJECT_NAME (factory)))
return factory;
walk = g_list_next (walk);
}
feature = gst_registry_pool_find_feature (name, GST_TYPE_AUTOPLUG_FACTORY);
if (feature)
return GST_AUTOPLUG_FACTORY (feature);
return NULL;
}
/**
* gst_autoplug_factory_get_list:
*
* Get the global list of autoplugfactories.
*
* Returns: GList of type #GstAutoplugFactory
*/
const GList*
gst_autoplug_factory_get_list (void)
{
return _gst_autoplugfactories;
}
/**
* gst_autoplug_factory_create:
* @factory: the factory used to create the instance
......@@ -367,52 +333,3 @@ gst_autoplug_factory_make (const gchar *name)
return gst_autoplug_factory_create (factory);
}
#ifndef GST_DISABLE_REGISTRY
static xmlNodePtr
gst_autoplug_factory_save_thyself (GstObject *object, xmlNodePtr parent)
{
GstAutoplugFactory *factory;
g_return_val_if_fail(GST_IS_AUTOPLUG_FACTORY (object), parent);
factory = GST_AUTOPLUG_FACTORY (object);
if (GST_OBJECT_CLASS (factory_parent_class)->save_thyself) {
GST_OBJECT_CLASS (factory_parent_class)->save_thyself (object, parent);
}
xmlNewChild(parent,NULL,"longdesc", factory->longdesc);
return parent;
}
/**
* gst_autoplug_factory_load_thyself:
* @parent: the parent XML node pointer
*
* Load an autoplugfactory from the given XML parent node.
*
* Returns: A new factory based on the XML node.
*/
static void
gst_autoplug_factory_restore_thyself (GstObject *object, xmlNodePtr parent)
{
GstAutoplugFactory *factory = GST_AUTOPLUG_FACTORY (object);
xmlNodePtr children = parent->xmlChildrenNode;
if (GST_OBJECT_CLASS (factory_parent_class)->restore_thyself) {
GST_OBJECT_CLASS (factory_parent_class)->restore_thyself (object, parent);
}
while (children) {
if (!strcmp(children->name, "name")) {
gst_object_set_name (GST_OBJECT (factory), xmlNodeGetContent(children));
}
if (!strcmp(children->name, "longdesc")) {
factory->longdesc = xmlNodeGetContent(children);
}
children = children->next;
}
}
#endif /* GST_DISABLE_REGISTRY */
......@@ -110,11 +110,10 @@ struct _GstAutoplugFactoryClass {
GType gst_autoplug_factory_get_type (void);
GstAutoplugFactory* gst_autoplug_factory_new (const gchar *name, const gchar *longdesc, GType type);
GstAutoplugFactory* gst_autoplug_factory_new (const gchar *name, const gchar *longdesc, GType type);
void gst_autoplug_factory_destroy (GstAutoplugFactory *factory);
GstAutoplugFactory* gst_autoplug_factory_find (const gchar *name);
const GList* gst_autoplug_factory_get_list (void);
GstAutoplug* gst_autoplug_factory_create (GstAutoplugFactory *factory);
GstAutoplug* gst_autoplug_factory_make (const gchar *name);
......
......@@ -330,6 +330,7 @@ gst_clock_wait_async_func (GstClock *clock, GstClockTime time,
g_return_val_if_fail (GST_IS_CLOCK (clock), NULL);
if (!clock->active) {
GST_DEBUG (GST_CAT_CLOCK, "blocking on clock\n");
g_mutex_lock (clock->active_mutex);
g_cond_wait (clock->active_cond, clock->active_mutex);
g_mutex_unlock (clock->active_mutex);
......@@ -478,7 +479,7 @@ gst_clock_wait_id (GstClock *clock, GstClockID id)
entry->func = gst_clock_unlock_func;
target = GST_CLOCK_ENTRY_TIME (entry) - current + current_real;
/* g_print ("%lld %lld %lld\n", target, current, current_real); */
GST_DEBUG (GST_CAT_CLOCK, "%llu %llu %llu\n", target, current, current_real);
if (target > current_real) {
timeval.tv_usec = target % 1000000;
......
......@@ -249,7 +249,7 @@ const gchar* gst_element_state_get_name (GstElementState state);
GstElementFactory* gst_element_get_factory (GstElement *element);
void gst_element_class_install_std_props (GstElementClass *klass,
const char *first_name, ...);
const char *first_name, ...);
GstBin* gst_element_get_managing_bin (GstElement *element);
......@@ -297,16 +297,14 @@ struct _GstElementFactoryClass {
GType gst_element_factory_get_type (void);
GstElementFactory* gst_element_factory_new (const gchar *name,GType type,
GstElementFactory* gst_element_factory_new (const gchar *name, GType type,
GstElementDetails *details);
GstElementFactory* gst_element_factory_find (const gchar *name);
const GList* gst_element_factory_get_list (void);
GstElementFactory* gst_element_factory_find (const gchar *name);
void gst_element_factory_add_pad_template (GstElementFactory *elementfactory,
GstPadTemplate *templ);
gboolean gst_element_factory_can_src_caps (GstElementFactory *factory,
gboolean gst_element_factory_can_src_caps (GstElementFactory *factory,
GstCaps *caps);
gboolean gst_element_factory_can_sink_caps (GstElementFactory *factory,
GstCaps *caps);
......@@ -314,7 +312,7 @@ gboolean gst_element_factory_can_sink_caps (GstElementFactory *factory,
GstElement* gst_element_factory_create (GstElementFactory *factory,
const gchar *name);
/* FIXME this name is wrong, probably so is the one above it */
GstElement* gst_element_factory_make (const gchar *factoryname, const gchar *name);
GstElement* gst_element_factory_make (const gchar *factoryname, const gchar *name);
#ifdef __cplusplus
}
......
......@@ -24,20 +24,13 @@
#include "gst_private.h"
#include "gstelement.h"
#include "gstregistry.h"
static void gst_element_factory_class_init (GstElementFactoryClass *klass);
static void gst_element_factory_init (GstElementFactory *factory);
#ifndef GST_DISABLE_REGISTRY
static void gst_element_factory_restore_thyself (GstObject *object, xmlNodePtr parent);
static xmlNodePtr gst_element_factory_save_thyself (GstObject *object, xmlNodePtr parent);
#endif
static void gst_element_factory_unload_thyself (GstPluginFeature *feature);
/* global list of registered elementfactories */
static GList* _gst_elementfactories;
static GstPluginFeatureClass *parent_class = NULL;
/* static guint gst_element_factory_signals[LAST_SIGNAL] = { 0 }; */
......@@ -78,14 +71,8 @@ gst_element_factory_class_init (GstElementFactoryClass *klass)
parent_class = g_type_class_ref (GST_TYPE_PLUGIN_FEATURE);
#ifndef GST_DISABLE_REGISTRY
gstobject_class->save_thyself = GST_DEBUG_FUNCPTR (gst_element_factory_save_thyself);
gstobject_class->restore_thyself = GST_DEBUG_FUNCPTR (gst_element_factory_restore_thyself);
#endif
gstpluginfeature_class->unload_thyself = GST_DEBUG_FUNCPTR (gst_element_factory_unload_thyself);
_gst_elementfactories = NULL;
}
static void
......@@ -93,8 +80,6 @@ gst_element_factory_init (GstElementFactory *factory)
{
factory->padtemplates = NULL;
factory->numpadtemplates = 0;
_gst_elementfactories = g_list_prepend (_gst_elementfactories, factory);
}
/**
......@@ -108,37 +93,19 @@ gst_element_factory_init (GstElementFactory *factory)
GstElementFactory*
gst_element_factory_find (const gchar *name)
{
GList *walk;
GstElementFactory *factory;
GstPluginFeature *feature;
g_return_val_if_fail(name != NULL, NULL);
walk = _gst_elementfactories;
while (walk) {
factory = (GstElementFactory *)(walk->data);
if (!strcmp(name, GST_OBJECT_NAME (factory)))
return factory;
walk = g_list_next(walk);
}
feature = gst_registry_pool_find_feature (name, GST_TYPE_ELEMENT_FACTORY);
if (feature)
return GST_ELEMENT_FACTORY (feature);
/* this should be an ERROR */
GST_DEBUG (GST_CAT_ELEMENT_FACTORY,"no such elementfactory \"%s\"", name);
return NULL;
}
/**
* gst_element_factory_get_list:
*
* Get the global list of element factories.
*
* Returns: GList of type #GstElementFactory
*/
const GList*
gst_element_factory_get_list (void)
{
return _gst_elementfactories;
}