update plugin initialization restructuring (see email for details
authorBenjamin Otte <otte@gnome.org>
Fri, 31 Oct 2003 19:32:47 +0000 (19:32 +0000)
committerBenjamin Otte <otte@gnome.org>
Fri, 31 Oct 2003 19:32:47 +0000 (19:32 +0000)
Original commit message from CVS:
update plugin initialization restructuring (see email for details

129 files changed:
configure.ac
examples/plugins/example.c
gst/autoplug/gstautoplugcache.c
gst/autoplug/gstautoplugger.c
gst/autoplug/gstsearchfuncs.c
gst/autoplug/gstspider.c
gst/autoplug/gstspideridentity.c
gst/autoplug/gstspideridentity.h
gst/autoplug/gststaticautoplug.c
gst/autoplug/gststaticautoplugrender.c
gst/elements/gstaggregator.c
gst/elements/gstaggregator.h
gst/elements/gstbufferstore.c
gst/elements/gstelements.c
gst/elements/gstfakesink.c
gst/elements/gstfakesink.h
gst/elements/gstfakesrc.c
gst/elements/gstfakesrc.h
gst/elements/gstfdsink.c
gst/elements/gstfdsink.h
gst/elements/gstfdsrc.c
gst/elements/gstfdsrc.h
gst/elements/gstfilesink.c
gst/elements/gstfilesink.h
gst/elements/gstfilesrc.c
gst/elements/gstfilesrc.h
gst/elements/gstidentity.c
gst/elements/gstidentity.h
gst/elements/gstmd5sink.c
gst/elements/gstmd5sink.h
gst/elements/gstmultidisksrc.c
gst/elements/gstmultidisksrc.h
gst/elements/gstmultifilesrc.c
gst/elements/gstmultifilesrc.h
gst/elements/gstpipefilter.c
gst/elements/gstpipefilter.h
gst/elements/gstshaper.c
gst/elements/gstshaper.h
gst/elements/gststatistics.c
gst/elements/gststatistics.h
gst/elements/gsttee.c
gst/elements/gsttee.h
gst/elements/gsttypefind.c
gst/elements/gsttypefind.h
gst/elements/gsttypefindelement.c
gst/elements/gsttypefindelement.h
gst/gst.c
gst/gst_private.h
gst/gstbin.c
gst/gstbin.h
gst/gstelement.c
gst/gstelement.h
gst/gstelementfactory.c
gst/gstinfo.c
gst/gstpipeline.c
gst/gstpipeline.h
gst/gstplugin.c
gst/gstplugin.h
gst/gstpluginfeature.c
gst/gstqueue.c
gst/gstqueue.h
gst/gstthread.c
gst/gstthread.h
gst/gsttypefind.c
gst/gsttypefind.h
gst/gsttypes.h
gst/indexers/gstfileindex.c
gst/indexers/gstindexers.c
gst/indexers/gstmemindex.c
gst/registries/gstxmlregistry.c
gst/schedulers/gstbasicscheduler.c
gst/schedulers/gstoptimalscheduler.c
libs/gst/bytestream/bytestream.c
libs/gst/getbits/getbits.c
plugins/elements/gstaggregator.c
plugins/elements/gstaggregator.h
plugins/elements/gstbufferstore.c
plugins/elements/gstelements.c
plugins/elements/gstfakesink.c
plugins/elements/gstfakesink.h
plugins/elements/gstfakesrc.c
plugins/elements/gstfakesrc.h
plugins/elements/gstfdsink.c
plugins/elements/gstfdsink.h
plugins/elements/gstfdsrc.c
plugins/elements/gstfdsrc.h
plugins/elements/gstfilesink.c
plugins/elements/gstfilesink.h
plugins/elements/gstfilesrc.c
plugins/elements/gstfilesrc.h
plugins/elements/gstidentity.c
plugins/elements/gstidentity.h
plugins/elements/gstmd5sink.c
plugins/elements/gstmd5sink.h
plugins/elements/gstmultidisksrc.c
plugins/elements/gstmultidisksrc.h
plugins/elements/gstmultifilesrc.c
plugins/elements/gstmultifilesrc.h
plugins/elements/gstpipefilter.c
plugins/elements/gstpipefilter.h
plugins/elements/gstqueue.c
plugins/elements/gstqueue.h
plugins/elements/gstshaper.c
plugins/elements/gstshaper.h
plugins/elements/gststatistics.c
plugins/elements/gststatistics.h
plugins/elements/gsttee.c
plugins/elements/gsttee.h
plugins/elements/gsttypefind.c
plugins/elements/gsttypefind.h
plugins/elements/gsttypefindelement.c
plugins/elements/gsttypefindelement.h
plugins/indexers/gstfileindex.c
plugins/indexers/gstindexers.c
plugins/indexers/gstmemindex.c
tests/old/examples/plugins/example.c
tests/old/testsuite/bytestream/Makefile.am
tests/old/testsuite/bytestream/gstbstest.c
tests/old/testsuite/plugin/static2.c
tests/old/testsuite/plugin/testplugin.c
tests/old/testsuite/plugin/testplugin2.c
testsuite/bytestream/Makefile.am
testsuite/bytestream/gstbstest.c
testsuite/plugin/static2.c
testsuite/plugin/testplugin.c
testsuite/plugin/testplugin2.c
tools/gst-inspect.c
tools/gst-register.c
tools/gst-xmlinspect.c

index aaa1870..a28ea9c 100644 (file)
@@ -464,9 +464,31 @@ dnl ############################
 dnl # Set up some more defines #
 dnl ############################
 
-dnl Set location of registry dir.
-AC_DEFINE_UNQUOTED(GST_CACHE_DIR, "$GST_CACHE_DIR", [Define the registry directory])
-AC_SUBST(GST_CACHE_DIR)
+dnl set license and copyright notice
+AC_DEFINE(GST_LICENSE, "LGPL", [GStreamer license])
+AC_DEFINE(GST_COPYRIGHT, "(c) 1999-2003 The GStreamer Team", [copyright message in plugins])
+dnl package name in plugins
+AC_ARG_WITH(package-name,
+AC_HELP_STRING([--with-package-name],[specify package name to use in plugins]),
+[case "${withval}" in
+  yes) AC_MSG_ERROR(bad value ${withval} for --with-package-name) ;;
+  no) AC_MSG_ERROR(bad value ${withval} for --with-package-name) ;;
+  *) GST_PACKAGE="${withval}" ;;
+esac], 
+[GST_PACKAGE="Gstreamer"]) dnl Default value
+AC_MSG_NOTICE(Using $GST_PACKAGE as package name)
+AC_DEFINE_UNQUOTED(GST_PACKAGE, "$GST_PACKAGE", [package name in plugins])
+dnl package origin URL
+AC_ARG_WITH(package-origin,
+AC_HELP_STRING([--with-package-origin],[specify package origin URL to use in plugins]),
+[case "${withval}" in
+  yes) AC_MSG_ERROR(bad value ${withval} for --with-package-origin) ;;
+  no) AC_MSG_ERROR(bad value ${withval} for --with-package-origin) ;;
+  *) GST_ORIGIN="${withval}" ;;
+esac], 
+[GST_ORIGIN="http://gstreamer.net"]) dnl Default value
+AC_MSG_NOTICE(Using $GST_ORIGIN as package origin)
+AC_DEFINE_UNQUOTED(GST_ORIGIN, "$GST_ORIGIN", [package origin])
 
 dnl Set location of plugin directory
 if test "x${prefix}" = "xNONE"; then
index 0bed8f6..65e047d 100644 (file)
 #include <string.h>
 #include "example.h"
 
-/* The ElementDetails structure gives a human-readable description
- * of the plugin, as well as author and version data.
+/* The ElementDetails structure gives a human-readable description of the
+ * plugin, as well as author and version data. Use the GST_ELEMENT_DETAILS
+ * macro when defining it.
  */
-static GstElementDetails example_details = {
+static GstElementDetails example_details = GST_ELEMENT_DETAILS (
   "An example plugin",
   "Example/FirstExample",
-  "LGPL",
   "Shows the basic structure of a plugin",
-  "0.1",
-  "your name <your.name@your.isp>",
-  "(C) 2001",
-};
+  "your name <your.name@your.isp>"
+);
 
 /* These are the signals that this element can fire.  They are zero-
  * based because the numbers themselves are private to the object.
@@ -186,6 +184,13 @@ gst_example_class_init (GstExampleClass *klass)
   /* we also override the default state change handler with our own
    * implementation */
   gstelement_class->change_state = gst_example_change_state;
+  /* We can now provide the details for this element, that we defined earlier. */
+  gst_element_class_set_details (gstelement_class, &example_details);
+  /* The pad templates can be easily generated from the factories above,
+   * and then added to the list of padtemplates for the class.
+   */
+  gst_element_class_add_pad_template (gstelement_class, GST_PAD_TEMPLATE_GET (sink_factory));
+  gst_element_class_add_pad_template (gstelement_class, GST_PAD_TEMPLATE_GET (src_factory));
 }
 
 /* This function is responsible for initializing a specific instance of
@@ -386,31 +391,20 @@ gst_example_change_state (GstElement *element)
  * this function is called to register everything that the plugin provides.
  */
 static gboolean
-plugin_init (GModule *module, GstPlugin *plugin)
+plugin_init (GstPlugin *plugin)
 {
-  GstElementFactory *factory;
-
-  /* We need to create an ElementFactory for each element we provide.
-   * This consists of the name of the element, the GType identifier,
-   * and a pointer to the details structure at the top of the file.
+  /* We need to register each element we provide with the plugin. This consists 
+   * of the name of the element, a rank that gives the importance of the element 
+   * when compared to similar plugins and the GType identifier.
    */
-  factory = gst_element_factory_new("example", GST_TYPE_EXAMPLE, &example_details);
-  g_return_val_if_fail(factory != NULL, FALSE);
-
-  /* The pad templates can be easily generated from the factories above,
-   * and then added to the list of padtemplates for the elementfactory.
-   */
-  gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (sink_factory));
-  gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (src_factory));
-
-  /* The very last thing is to register the elementfactory with the plugin. */
-  gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
+  if (!gst_element_register (plugin, "example", GST_RANK_MARGINAL, GST_TYPE_EXAMPLE))
+    return FALSE;
 
   /* Now we can return successfully. */
   return TRUE;
 
   /* At this point, the GStreamer core registers the plugin, its
-   * elementfactories, padtemplates, etc., for use in you application.
+   * elementfactories, padtemplates, etc., for use in your application.
    */
 }
 
@@ -421,12 +415,26 @@ plugin_init (GModule *module, GstPlugin *plugin)
  * The symbol pointing to this structure is the only symbol looked up when
  * loading the plugin.
  */
-GstPluginDesc plugin_desc = {
-  GST_VERSION_MAJOR, /* The major version of the core that this was built with */
-  GST_VERSION_MINOR, /* The minor version of the core that this was built with */
-  "example",         /* The name of the plugin.  This must be unique: plugins with
-                     * the same name will be assumed to be identical, and only
-                     * one will be loaded. */
-  plugin_init        /* Pointer to the initialisation function for the plugin. */
-};
+GST_PLUGIN_DEFINE (
+  GST_VERSION_MAJOR,   /* The major version of the core that this was built with */
+  GST_VERSION_MINOR,   /* The minor version of the core that this was built with */
+  "example",           /* The name of the plugin.  This must be unique: plugins with
+                        * the same name will be assumed to be identical, and only
+                        * one will be loaded. */
+  "an example plugin", /* a short description of the plugin in English */
+  plugin_init,         /* Pointer to the initialisation function for the plugin. */
+  "0.1",               /* The version number of the plugin */
+  "LGPL",              /* ieffective license the plugin can be shipped with. Must be 
+                        * valid for all libraries it links to, too. */
+  "(c) 2003 E. Xamplewriter",
+                       /* Copyright holder for this plugin. This does not include
+                        * the libraries it links to, contrary to the license. This
+                        * field should be considered informational and not legally
+                        * binding */
+  "my nifty plugin package",
+                       /* package this plugin belongs to. */
+  "http://www.mydomain.com"
+                       /* originating URL for this plugin. This is the place to look
+                        * for updates, information and so on. */
+);
 
index bf85666..50a977e 100644 (file)
 GST_DEBUG_CATEGORY_STATIC(debug_category);
 #define GST_CAT_DEFAULT debug_category
 
-GstElementDetails gst_autoplugcache_details = {
+GstElementDetails gst_autoplugcache_details = GST_ELEMENT_DETAILS (
   "AutoplugCache",
   "Generic",
-  "LGPL",
   "Data cache for the dynamic autoplugger",
-  VERSION,
-  "Erik Walthinsen <omega@temple-baptist.com>",
-  "(C) 2001 RidgeRun, Inc. (www.ridgerun.com)",
-};
+  "Erik Walthinsen <omega@temple-baptist.com>"
+);
 
 #define GST_TYPE_AUTOPLUGCACHE \
   (gst_autoplugcache_get_type())
@@ -162,6 +159,7 @@ gst_autoplugcache_class_init (GstAutoplugCacheClass *klass)
   gobject_class->get_property = gst_autoplugcache_get_property;
 
   gstelement_class->change_state = gst_autoplugcache_change_state;
+  gst_element_class_set_details (gstelement_class, &gst_autoplugcache_details);
 }
 
 static void
@@ -345,24 +343,25 @@ gst_autoplugcache_get_property (GObject *object, guint prop_id, GValue *value, G
 }
 
 static gboolean
-plugin_init (GModule *module, GstPlugin *plugin)
+plugin_init (GstPlugin *plugin)
 {
-  GstElementFactory *factory;
-
   GST_DEBUG_CATEGORY_INIT (debug_category, "AUTOPLUGCACHE", 0, "autoplugcache element");
 
-  factory = gst_element_factory_new ("autoplugcache", GST_TYPE_AUTOPLUGCACHE,
-                                    &gst_autoplugcache_details);
-  g_return_val_if_fail (factory != NULL, FALSE);
-
-  gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
+  if (!gst_element_register (plugin, "autoplugcache", GST_RANK_NONE, GST_TYPE_AUTOPLUGCACHE))
+    return FALSE;
 
   return TRUE;
 }
 
-GstPluginDesc plugin_desc = {
+GST_PLUGIN_DEFINE (
   GST_VERSION_MAJOR,
   GST_VERSION_MINOR,
   "autoplugcache",
-  plugin_init
-};
+  "an autoplug cache",
+  plugin_init,
+  VERSION,
+  GST_LICENSE,
+  GST_COPYRIGHT,
+  GST_PACKAGE,
+  GST_ORIGIN
+)
index 7551dc3..4f76f05 100644 (file)
                                                                                                                                                                          
 #include <gst/gst.h>
 
-GstElementDetails gst_autoplugger_details = {
+GstElementDetails gst_autoplugger_details = GST_ELEMENT_DETAILS (
   "Dynamic autoplugger",
   "Generic",
-  "LGPL",
   "Magic element that converts from any type to any other",
-  VERSION,
-  "Erik Walthinsen <omega@temple-baptist.com>",
-  "(C) 2001 RidgeRun, Inc. (www.ridgerun.com)",
-};
+  "Erik Walthinsen <omega@temple-baptist.com>"
+);
 
 #define GST_TYPE_AUTOPLUGGER \
   (gst_autoplugger_get_type())
@@ -164,6 +161,7 @@ gst_autoplugger_class_init (GstAutopluggerClass *klass)
   gobject_class->get_property = gst_autoplugger_get_property;
 
 /*  gstelement_class->change_state = gst_autoplugger_change_state; */
+  gst_element_class_set_details (gstelement_class, &gst_autoplugger_details);
 }
 
 static void
@@ -596,23 +594,24 @@ gst_autoplugger_get_property (GObject *object, guint prop_id, GValue *value, GPa
 }
 
 static gboolean
-plugin_init (GModule *module, GstPlugin *plugin)
+plugin_init (GstPlugin *plugin)
 {
-  GstElementFactory *factory;
-
-  factory = gst_element_factory_new ("autoplugger", GST_TYPE_AUTOPLUGGER,
-                                    &gst_autoplugger_details);
-  g_return_val_if_fail (factory != NULL, FALSE);
-
-  gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
+  if (!gst_element_register (plugin, "autoplugger", GST_RANK_NONE, GST_TYPE_AUTOPLUGGER))
+    return FALSE;
 
   return TRUE;
 }
 
-GstPluginDesc plugin_desc = {
+GST_PLUGIN_DEFINE (
   GST_VERSION_MAJOR,
   GST_VERSION_MINOR,
   "autoplugger",
-  plugin_init
-};
+  "magic element that converts from any type tom any other",
+  plugin_init,
+  VERSION,
+  GST_LICENSE,
+  GST_COPYRIGHT,
+  GST_PACKAGE,
+  GST_ORIGIN
+)
 
index 4fd5bdb..ac4a151 100644 (file)
@@ -352,17 +352,17 @@ gst_autoplug_sp (GstCaps *srccaps, GstCaps *sinkcaps, GList *factories)
     GstAutoplugNode *node = g_new0 (GstAutoplugNode, 1);
     node->prev = NULL;
     node->fac = (GstElementFactory *) factories->data;
-    GST_DEBUG ("trying with %s", node->fac->details->longname);
+    GST_DEBUG ("trying with %s", node->fac->details.longname);
     node->templ = gst_autoplug_can_connect_src (node->fac, srccaps);
     node->cost = (node->templ ? gst_autoplug_get_cost (node->fac) 
                              : GST_AUTOPLUG_MAX_COST);
     node->endpoint = gst_autoplug_can_connect_sink (node->fac, sinkcaps);
     if (node->templ && node->endpoint)
       GST_DEBUG ("%s makes connection possible",
-                node->fac->details->longname);
+                node->fac->details.longname);
     else
       GST_DEBUG ("direct connection with %s not possible",
-                node->fac->details->longname);
+                node->fac->details.longname);
     if ((node->endpoint != NULL) && 
        ((bestnode == NULL) || (node->cost < bestnode->cost)))
     {
index 2db44ba..650d0df 100644 (file)
@@ -153,6 +153,7 @@ gst_spider_class_init (GstSpiderClass *klass)
   gobject_class->dispose = gst_spider_dispose;
 
   gst_element_class_add_pad_template (gstelement_class, GST_PAD_TEMPLATE_GET (spider_src_factory));
+  gst_element_class_set_details (gstelement_class, &gst_spider_details);
   
   gstelement_class->request_new_pad = GST_DEBUG_FUNCPTR(gst_spider_request_new_pad);
 }
@@ -554,7 +555,8 @@ gst_spider_find_element_to_plug (GstElement *src, GstElementFactory *fac, GstPad
     {
       /* is the element the pad is linked to of the right type? */
       GstElement *element = GST_PAD_PARENT (pad);
-      if (GST_ELEMENT_CLASS (G_OBJECT_GET_CLASS (element))->elementfactory == fac) {
+      
+      if (G_TYPE_FROM_INSTANCE (element) == gst_element_factory_get_element_type (fac)) {
         return element;
       }
     }
@@ -632,44 +634,35 @@ gst_spider_plug_from_srcpad (GstSpiderConnection *conn, GstPad *srcpad)
   return result;  
 }
 
-GstElementDetails gst_spider_details = {
+GstElementDetails gst_spider_details = GST_ELEMENT_DETAILS (
   "Spider",
   "Generic",
-  "LGPL",
   "Automatically link sinks and sources",
-  VERSION,
-  "Benjamin Otte <in7y118@public.uni-hamburg.de>",
-  "(C) 2002",
-};
+  "Benjamin Otte <in7y118@public.uni-hamburg.de>"
+);
 
 static gboolean
-plugin_init (GModule *module, GstPlugin *plugin)
+plugin_init (GstPlugin *plugin)
 {
-  GstElementFactory *factory;
-
   GST_DEBUG_CATEGORY_INIT (gst_spider_debug, "spider", 0, "spider autoplugging element");
-  GST_DEBUG_CATEGORY_INIT (gst_spider_identity_debug, "spideridentity", 0, "spider autoplugging proxy element");
-
-  factory = gst_element_factory_new("spider", GST_TYPE_SPIDER,
-                                   &gst_spider_details);
-  gst_plugin_set_longname (plugin, "Spider autoplugging elements");
-  g_return_val_if_fail(factory != NULL, FALSE);
 
-  gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (spider_src_factory));
-
-  gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
-
-  /* add spideridentity */
-  factory = gst_element_factory_new ("spideridentity", GST_TYPE_SPIDER_IDENTITY,
-                                     &gst_spider_identity_details);
-  gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
+  if (!gst_element_register (plugin, "spider", GST_RANK_SECONDARY, GST_TYPE_SPIDER))
+    return FALSE;
+  if (!gst_element_register (plugin, "spideridentity", GST_RANK_NONE, GST_TYPE_SPIDER_IDENTITY))
+    return FALSE;
 
   return TRUE;
 }
 
-GstPluginDesc plugin_desc = {
+GST_PLUGIN_DEFINE (
   GST_VERSION_MAJOR,
   GST_VERSION_MINOR,
   "gstspider",
-  plugin_init
-};
+  "a 1:n autoplugger",
+  plugin_init,
+  VERSION,
+  GST_LICENSE,
+  GST_COPYRIGHT,
+  GST_PACKAGE,
+  GST_ORIGIN
+)
index 15007e4..a469762 100644 (file)
 #include "gstspideridentity.h"
 #include "gstspider.h"
 
-GST_DEBUG_CATEGORY (gst_spider_identity_debug);
+GST_DEBUG_CATEGORY_STATIC (gst_spider_identity_debug);
 #define GST_CAT_DEFAULT gst_spider_identity_debug
 
-GstElementDetails gst_spider_identity_details = {
+static GstElementDetails gst_spider_identity_details = GST_ELEMENT_DETAILS (
   "SpiderIdentity",
   "Generic",
-  "LGPL",
   "Link between spider and outside elements",
-  VERSION,
-  "Benjamin Otte <in7y118@public.uni-hamburg.de>",
-  "(C) 2002",
-};
+  "Benjamin Otte <in7y118@public.uni-hamburg.de>"
+);
 
 
 /* generic templates 
@@ -47,14 +44,14 @@ GstElementDetails gst_spider_identity_details = {
 GST_PAD_TEMPLATE_FACTORY (spider_src_factory,
   "src",
   GST_PAD_SRC,
-  GST_PAD_REQUEST,
+  GST_PAD_ALWAYS,
   NULL      /* no caps */
 );
 
 GST_PAD_TEMPLATE_FACTORY (spider_sink_factory,
   "sink",
   GST_PAD_SINK,
-  GST_PAD_REQUEST,
+  GST_PAD_ALWAYS,
   NULL      /* no caps */
 );
 
@@ -108,7 +105,10 @@ gst_spider_identity_get_type (void)
       0,
       (GInstanceInitFunc)gst_spider_identity_init,
     };
-    spider_identity_type = g_type_register_static (GST_TYPE_ELEMENT, "GstSpiderIdentity", &spider_identity_info, 0);
+    spider_identity_type = g_type_register_static (GST_TYPE_ELEMENT, "GstSpiderIdentity", 
+                                                  &spider_identity_info, 0);
+    GST_DEBUG_CATEGORY_INIT (gst_spider_identity_debug, "spideridentity", 
+                            0, "spider autoplugging proxy element");
   }
   return spider_identity_type;
 }
@@ -123,6 +123,7 @@ gst_spider_identity_class_init (GstSpiderIdentityClass *klass)
   /* add our two pad templates */
   gst_element_class_add_pad_template (gstelement_class, GST_PAD_TEMPLATE_GET (spider_src_factory));
   gst_element_class_add_pad_template (gstelement_class, GST_PAD_TEMPLATE_GET (spider_sink_factory));
+  gst_element_class_set_details (gstelement_class, &gst_spider_identity_details);
   
   gstelement_class->change_state = GST_DEBUG_FUNCPTR(gst_spider_identity_change_state);
   gstelement_class->request_new_pad = GST_DEBUG_FUNCPTR(gst_spider_identity_request_new_pad);
@@ -156,7 +157,6 @@ gst_spider_identity_init (GstSpiderIdentity *ident)
 
   /* variables */
   ident->plugged = FALSE;
-  
 }
 
 static void 
index 5d1dbec..4731553 100644 (file)
@@ -28,9 +28,6 @@
 
 G_BEGIN_DECLS
 
-extern GstElementDetails gst_spider_identity_details;
-GST_DEBUG_CATEGORY_EXTERN(gst_spider_identity_debug);
-
 #define GST_TYPE_SPIDER_IDENTITY \
   (gst_spider_identity_get_type())
 #define GST_SPIDER_IDENTITY(obj) \
index bde915d..0b2dcb1 100644 (file)
  * Boston, MA 02111-1307, USA.
  */
 
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
 #include "gststaticautoplug.h"
 
 #include <gst/gst.h>
@@ -85,14 +89,12 @@ static void gst_static_autoplug_init(GstStaticAutoplug *autoplug) {
 }
 
 static gboolean
-plugin_init (GModule *module, GstPlugin *plugin)
+plugin_init (GstPlugin *plugin)
 {
   GstAutoplugFactory *factory;
 
   GST_DEBUG_CATEGORY_INIT (debug_category, "STATIC_AUTOPLUG", 0, "static autoplugger element");
 
-  gst_plugin_set_longname (plugin, "A static autoplugger");
-
   factory = gst_autoplug_factory_new ("static",
                  "A static autoplugger, it constructs the complete element before running it",
                  gst_static_autoplug_get_type ());
@@ -103,12 +105,18 @@ plugin_init (GModule *module, GstPlugin *plugin)
   return TRUE;
 }
 
-GstPluginDesc plugin_desc = {
+GST_PLUGIN_DEFINE (
   GST_VERSION_MAJOR,
   GST_VERSION_MINOR,
   "gststaticautoplug",
-  plugin_init
-};
+  "a static autoplugger",
+  plugin_init,
+  VERSION,
+  GST_LICENSE,
+  GST_COPYRIGHT,
+  GST_PACKAGE,
+  GST_ORIGIN
+)
 
 static gboolean
 gst_autoplug_can_match (GstElementFactory *src, GstElementFactory *dest)
index 0b48bda..246e40d 100644 (file)
  * Boston, MA 02111-1307, USA.
  */
 
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
 #include "gststaticautoplugrender.h"
 
 #include <gst/gst.h>
@@ -85,12 +89,10 @@ static void gst_static_autoplug_render_init(GstStaticAutoplugRender *autoplug) {
 }
 
 static gboolean
-plugin_init (GModule *module, GstPlugin *plugin)
+plugin_init (GstPlugin *plugin)
 {
   GstAutoplugFactory *factory;
 
-  gst_plugin_set_longname (plugin, "A static autoplugger");
-
   GST_DEBUG_CATEGORY_INIT (debug_category, "STATIC_AUTOPLUG", 0, "static autoplug render element");
 
   factory = gst_autoplug_factory_new ("staticrender",
@@ -106,12 +108,18 @@ plugin_init (GModule *module, GstPlugin *plugin)
   return TRUE;
 }
 
-GstPluginDesc plugin_desc = {
+GST_PLUGIN_DEFINE (
   GST_VERSION_MAJOR,
   GST_VERSION_MINOR,
   "gststaticautoplugrender",
-  plugin_init
-};
+  "a static autoplugger",
+  plugin_init,
+  VERSION,
+  GST_LICENSE,
+  GST_COPYRIGHT,
+  GST_PACKAGE,
+  GST_ORIGIN
+)
 
 static GstPadTemplate*
 gst_autoplug_match_caps (GstElementFactory *factory, GstPadDirection direction, GstCaps *caps)
index 3c3ba5d..797d41a 100644 (file)
 
 #include "gstaggregator.h"
 
-GST_DEBUG_CATEGORY (gst_aggregator_debug);
+GST_DEBUG_CATEGORY_STATIC (gst_aggregator_debug);
 #define GST_CAT_DEFAULT gst_aggregator_debug
 
-GstElementDetails gst_aggregator_details = {
+GstElementDetails gst_aggregator_details = GST_ELEMENT_DETAILS (
   "Aggregator pipe fitting",
   "Generic",
-  "LGPL",
   "N-to-1 pipe fitting",
-  VERSION,
-  "Wim Taymans <wim.taymans@chello.be>",
-  "(C) 2001",
-};
+  "Wim Taymans <wim.taymans@chello.be>"
+);
 
 /* Aggregator signals and args */
 enum {
@@ -80,6 +77,7 @@ gst_aggregator_sched_get_type (void)
 
 #define AGGREGATOR_IS_LOOP_BASED(ag)   ((ag)->sched != AGGREGATOR_CHAIN)
 
+static void    gst_aggregator_base_init        (gpointer g_class);
 static void    gst_aggregator_class_init       (GstAggregatorClass *klass);
 static void    gst_aggregator_init             (GstAggregator *aggregator);
 
@@ -106,7 +104,7 @@ gst_aggregator_get_type (void)
   if (!aggregator_type) {
     static const GTypeInfo aggregator_info = {
       sizeof(GstAggregatorClass),      
-      NULL,
+      gst_aggregator_base_init,
       NULL,
       (GClassInitFunc)gst_aggregator_class_init,
       NULL,
@@ -116,11 +114,20 @@ gst_aggregator_get_type (void)
       (GInstanceInitFunc)gst_aggregator_init,
     };
     aggregator_type = g_type_register_static (GST_TYPE_ELEMENT, "GstAggregator", &aggregator_info, 0);
+
+    GST_DEBUG_CATEGORY_INIT (gst_aggregator_debug, "aggregator", 0, "aggregator element");
   }
   return aggregator_type;
 }
 
 static void
+gst_aggregator_base_init (gpointer g_class)
+{
+  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); 
+  gst_element_class_add_pad_template (gstelement_class, GST_PAD_TEMPLATE_GET (aggregator_src_factory));
+  gst_element_class_set_details (gstelement_class, &gst_aggregator_details);
+}
+static void
 gst_aggregator_class_init (GstAggregatorClass *klass) 
 {
   GObjectClass *gobject_class;
@@ -360,11 +367,4 @@ gst_aggregator_chain (GstPad *pad, GstData *_data)
 
   gst_aggregator_push (aggregator, pad, buf, "chain");
 }
-
-gboolean
-gst_aggregator_factory_init (GstElementFactory *factory)
-{
-  gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (aggregator_src_factory));
-
-  return TRUE;
-}
+  
index e53b854..7e6105b 100644 (file)
@@ -28,8 +28,6 @@
 
 G_BEGIN_DECLS
 
-extern GstElementDetails gst_aggregator_details;
-GST_DEBUG_CATEGORY_EXTERN(gst_aggregator_debug);
 
 typedef enum {
   AGGREGATOR_LOOP              = 1,
index a91648b..dd17216 100644 (file)
@@ -25,7 +25,7 @@
 #include "gstbufferstore.h"
 #include <string.h>
 
-GST_DEBUG_CATEGORY (gst_buffer_store_debug);
+GST_DEBUG_CATEGORY_STATIC (gst_buffer_store_debug);
 #define GST_CAT_DEFAULT gst_buffer_store_debug
 
 enum {
index 7b769a0..909b883 100644 (file)
@@ -46,9 +46,8 @@
 
 struct _elements_entry {
   gchar *name;
+  guint rank;
   GType (*type) (void);
-  GstElementDetails *details;
-  gboolean (*factoryinit) (GstElementFactory *factory);
 };
 
 
@@ -56,75 +55,48 @@ extern GType gst_filesrc_get_type(void);
 extern GstElementDetails gst_filesrc_details;
 
 static struct _elements_entry _elements[] = {
-  { "aggregator",   gst_aggregator_get_type,   &gst_aggregator_details,        gst_aggregator_factory_init },
-  { "fakesrc",             gst_fakesrc_get_type,       &gst_fakesrc_details,           gst_fakesrc_factory_init },
-  { "fakesink",     gst_fakesink_get_type,     &gst_fakesink_details,          gst_fakesink_factory_init },
-  { "fdsink",       gst_fdsink_get_type,       &gst_fdsink_details,            NULL },
-  { "fdsrc",       gst_fdsrc_get_type,         &gst_fdsrc_details,             NULL },
-  { "filesrc",             gst_filesrc_get_type,       &gst_filesrc_details,           NULL },
-  { "filesink",            gst_filesink_get_type,      &gst_filesink_details,          NULL },
-  { "identity",     gst_identity_get_type,     &gst_identity_details,          NULL },
-  { "md5sink",      gst_md5sink_get_type,      &gst_md5sink_details,           gst_md5sink_factory_init },
-  { "multidisksrc", gst_multidisksrc_get_type, &gst_multidisksrc_details,      NULL },
-  { "pipefilter",   gst_pipefilter_get_type,   &gst_pipefilter_details,        NULL },
-  { "shaper",       gst_shaper_get_type,       &gst_shaper_details,            gst_shaper_factory_init },
-  { "statistics",   gst_statistics_get_type,   &gst_statistics_details,        NULL },
-  { "tee",                 gst_tee_get_type,           &gst_tee_details,               gst_tee_factory_init },
-  { "typefind",     gst_type_find_element_get_type, &gst_type_find_element_details,    NULL },
+  { "aggregator",   GST_RANK_PRIMARY,  gst_aggregator_get_type         },
+  { "fakesrc",             GST_RANK_PRIMARY,   gst_fakesrc_get_type            },
+  { "fakesink",     GST_RANK_PRIMARY,  gst_fakesink_get_type           },
+  { "fdsink",       GST_RANK_PRIMARY,  gst_fdsink_get_type             },
+  { "fdsrc",       GST_RANK_PRIMARY,   gst_fdsrc_get_type              },
+  { "filesrc",             GST_RANK_PRIMARY,   gst_filesrc_get_type            },
+  { "filesink",            GST_RANK_PRIMARY,   gst_filesink_get_type           },
+  { "identity",     GST_RANK_PRIMARY,  gst_identity_get_type           },
+  { "md5sink",      GST_RANK_PRIMARY,  gst_md5sink_get_type            },
+  { "multidisksrc", GST_RANK_PRIMARY,  gst_multidisksrc_get_type       },
+  { "pipefilter",   GST_RANK_PRIMARY,  gst_pipefilter_get_type         },
+  { "shaper",       GST_RANK_PRIMARY,  gst_shaper_get_type             },
+  { "statistics",   GST_RANK_PRIMARY,  gst_statistics_get_type         },
+  { "tee",                 GST_RANK_PRIMARY,   gst_tee_get_type                },
+  { "typefind",     GST_RANK_PRIMARY,  gst_type_find_element_get_type  },
   { NULL, 0 },
 };
 
 static gboolean
-plugin_init (GModule *module, GstPlugin *plugin)
+plugin_init (GstPlugin *plugin)
 {
-  GstElementFactory *factory;
-  gint i = 0;
-
-  gst_plugin_set_longname (plugin, "Standard GST Elements");
-
-  GST_DEBUG_CATEGORY_INIT (gst_aggregator_debug, "aggregator", 0,      "aggregator element");
-  GST_DEBUG_CATEGORY_INIT (gst_fakesink_debug, "fakesink",     0,      "fakesink element");
-  GST_DEBUG_CATEGORY_INIT (gst_fakesrc_debug,  "fakesrc",      0,      "fakesrc element");
-  GST_DEBUG_CATEGORY_INIT (gst_fdsink_debug,   "fdsink",       0,      "fdsink element");
-  GST_DEBUG_CATEGORY_INIT (gst_fdsrc_debug,    "fdsrc",        0,      "fdsrc element");
-  GST_DEBUG_CATEGORY_INIT (gst_filesink_debug, "filesink",     0,      "filesink element");
-  GST_DEBUG_CATEGORY_INIT (gst_filesrc_debug,  "filesrc",      0,      "filesrc element");
-  GST_DEBUG_CATEGORY_INIT (gst_identity_debug, "identity",     0,      "identity element");
-  GST_DEBUG_CATEGORY_INIT (gst_md5sink_debug,  "md5sink",      0,      "md5sink element");
-  GST_DEBUG_CATEGORY_INIT (gst_multidisksrc_debug, "multidisksrc", 0,  "multidisksrc element");
-  GST_DEBUG_CATEGORY_INIT (gst_pipefilter_debug, "pipefilter", 0,      "pipefilter element");
-  GST_DEBUG_CATEGORY_INIT (gst_shaper_debug,   "shaper",       0,      "shaper element");
-  GST_DEBUG_CATEGORY_INIT (gst_statistics_debug, "statistics", 0,      "statistics element");
-  GST_DEBUG_CATEGORY_INIT (gst_tee_debug,      "tee",          0,      "tee element");
-  GST_DEBUG_CATEGORY_INIT (gst_type_find_element_debug,        "typefind", GST_DEBUG_BG_YELLOW | GST_DEBUG_FG_GREEN, "typefind element");
-
-  while (_elements[i].name) {  
-    factory = gst_element_factory_new (_elements[i].name,
-                                      (_elements[i].type) (),
-                                      _elements[i].details);
-
-    if (!factory)
-      {
-       g_warning ("gst_element_factory_new failed for `%s'",
-                  _elements[i].name);
-       continue;
-      }
-
-    gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
-    if (_elements[i].factoryinit) {
-      _elements[i].factoryinit (factory);
-    }
-/*      g_print("added factory '%s'\n",_elements[i].name); */
-    i++;
+  struct _elements_entry *my_elements = _elements;
+  
+  while ((*my_elements).name) {  
+    if (!gst_element_register (plugin, (*my_elements).name, (*my_elements).rank, ((*my_elements).type) ()))
+      return FALSE;
+    my_elements++;
   }
 
-/*  INFO (GST_INFO_PLUGIN_LOAD,"gstelements: loaded %d standard elements", i);*/
   return TRUE;
 }
 
-GstPluginDesc plugin_desc = {
+GST_PLUGIN_DEFINE (
   GST_VERSION_MAJOR,
   GST_VERSION_MINOR,
   "gstelements",
-  plugin_init
-};
+  "standard GStreamer elements",
+  plugin_init,
+  VERSION,
+  GST_LICENSE,
+  GST_COPYRIGHT,
+  GST_PACKAGE,
+  GST_ORIGIN
+)
+
index d9a94a5..fa52606 100644 (file)
 
 #include "gstfakesink.h"
 
-GST_DEBUG_CATEGORY (gst_fakesink_debug);
+GST_DEBUG_CATEGORY_STATIC (gst_fakesink_debug);
 #define GST_CAT_DEFAULT gst_fakesink_debug
 
-GstElementDetails gst_fakesink_details = {
+GstElementDetails gst_fakesink_details = GST_ELEMENT_DETAILS (
   "Fake Sink",
   "Sink",
-  "LGPL",
   "Black hole for data",
-  VERSION,
-  "Erik Walthinsen <omega@cse.ogi.edu>",
-  "(C) 1999",
-};
+  "Erik Walthinsen <omega@cse.ogi.edu>"
+);
 
 
 /* FakeSink signals and args */
@@ -87,6 +84,7 @@ gst_fakesink_state_error_get_type (void)
   return fakesink_state_error_type;
 }
 
+static void    gst_fakesink_base_init          (gpointer g_class);
 static void    gst_fakesink_class_init         (GstFakeSinkClass *klass);
 static void    gst_fakesink_init               (GstFakeSink *fakesink);
 
@@ -114,7 +112,8 @@ gst_fakesink_get_type (void)
 
   if (!fakesink_type) {
     static const GTypeInfo fakesink_info = {
-      sizeof(GstFakeSinkClass),      NULL,
+      sizeof(GstFakeSinkClass),
+      gst_fakesink_base_init,
       NULL,
       (GClassInitFunc)gst_fakesink_class_init,
       NULL,
@@ -124,11 +123,21 @@ gst_fakesink_get_type (void)
       (GInstanceInitFunc)gst_fakesink_init,
     };
     fakesink_type = g_type_register_static (GST_TYPE_ELEMENT, "GstFakeSink", &fakesink_info, 0);
+  
+    GST_DEBUG_CATEGORY_INIT (gst_fakesink_debug, "fakesink", 0, "fakesink element");
   }
   return fakesink_type;
 }
 
 static void
+gst_fakesink_base_init (gpointer g_class)
+{
+  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); 
+  
+  gst_element_class_set_details (gstelement_class, &gst_fakesink_details);
+  gst_element_class_add_pad_template (gstelement_class, GST_PAD_TEMPLATE_GET (fakesink_sink_factory));
+}
+static void
 gst_fakesink_class_init (GstFakeSinkClass *klass) 
 {
   GObjectClass *gobject_class;
@@ -411,10 +420,3 @@ error:
   return GST_STATE_FAILURE;
 }
 
-gboolean
-gst_fakesink_factory_init (GstElementFactory *factory)
-{
-  gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (fakesink_sink_factory));
-
-  return TRUE;
-}
index 95ee8be..a8e7cd0 100644 (file)
@@ -28,8 +28,6 @@
 
 G_BEGIN_DECLS
 
-extern GstElementDetails gst_fakesink_details;
-GST_DEBUG_CATEGORY_EXTERN(gst_fakesink_debug);
 
 #define GST_TYPE_FAKESINK \
   (gst_fakesink_get_type())
index 14287e3..3a82dc0 100644 (file)
 #define DEFAULT_SIZEMAX                4096
 #define DEFAULT_PARENTSIZE     4096*10
 
-GST_DEBUG_CATEGORY (gst_fakesrc_debug);
+GST_DEBUG_CATEGORY_STATIC (gst_fakesrc_debug);
 #define GST_CAT_DEFAULT gst_fakesrc_debug
 
-GstElementDetails gst_fakesrc_details = {
+GstElementDetails gst_fakesrc_details = GST_ELEMENT_DETAILS (
   "Fake Source",
   "Source",
-  "LGPL",
   "Push empty (no data) buffers around",
-  VERSION,
-  "Erik Walthinsen <omega@cse.ogi.edu>\n"
-  "Wim Taymans <wim.taymans@chello.be>",
-  "(C) 1999",
-};
+  "Erik Walthinsen <omega@cse.ogi.edu>, "
+  "Wim Taymans <wim.taymans@chello.be>"
+);
 
 
 /* FakeSrc signals and args */
@@ -101,6 +98,8 @@ gst_fakesrc_output_get_type (void)
   };
   if (!fakesrc_output_type) {
     fakesrc_output_type = g_enum_register_static ("GstFakeSrcOutput", fakesrc_output);
+  
+    GST_DEBUG_CATEGORY_INIT (gst_fakesrc_debug, "fakesrc", 0, "fakesrc element");
   }
   return fakesrc_output_type;
 }
@@ -158,6 +157,7 @@ gst_fakesrc_filltype_get_type (void)
   return fakesrc_filltype_type;
 }
 
+static void            gst_fakesrc_base_init           (gpointer g_class);
 static void            gst_fakesrc_class_init          (GstFakeSrcClass *klass);
 static void            gst_fakesrc_init                (GstFakeSrc *fakesrc);
 
@@ -184,7 +184,7 @@ gst_fakesrc_get_type (void)
   if (!fakesrc_type) {
     static const GTypeInfo fakesrc_info = {
       sizeof(GstFakeSrcClass),
-      NULL,
+      gst_fakesrc_base_init,
       NULL,
       (GClassInitFunc)gst_fakesrc_class_init,
       NULL,
@@ -199,6 +199,14 @@ gst_fakesrc_get_type (void)
 }
 
 static void
+gst_fakesrc_base_init (gpointer g_class)
+{
+  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); 
+  
+  gst_element_class_set_details (gstelement_class, &gst_fakesrc_details);
+  gst_element_class_add_pad_template (gstelement_class, GST_PAD_TEMPLATE_GET (fakesrc_src_factory));
+}
+static void
 gst_fakesrc_class_init (GstFakeSrcClass *klass) 
 {
   GObjectClass *gobject_class;
@@ -879,10 +887,3 @@ gst_fakesrc_change_state (GstElement *element)
   return GST_STATE_SUCCESS;
 }
 
-gboolean
-gst_fakesrc_factory_init (GstElementFactory *factory)
-{
-  gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (fakesrc_src_factory));
-
-  return TRUE;
-}
index 1dbb4f0..5b3b875 100644 (file)
@@ -28,8 +28,6 @@
 
 G_BEGIN_DECLS
 
-extern GstElementDetails gst_fakesrc_details;
-GST_DEBUG_CATEGORY_EXTERN(gst_fakesrc_debug);
 
 typedef enum {
   FAKESRC_FIRST_LAST_LOOP = 1,
index b3f2159..b0ecc94 100644 (file)
 #include "gstfdsink.h"
 #include <unistd.h>
 
-GST_DEBUG_CATEGORY (gst_fdsink_debug);
+GST_DEBUG_CATEGORY_STATIC (gst_fdsink_debug);
 #define GST_CAT_DEFAULT gst_fdsink_debug
 
-GstElementDetails gst_fdsink_details = {
+GstElementDetails gst_fdsink_details = GST_ELEMENT_DETAILS (
   "Filedescriptor Sink",
   "Sink/File",
-  "LGPL",
   "Write data to a file descriptor",
-  VERSION,
-  "Erik Walthinsen <omega@cse.ogi.edu>",
-  "(C) 1999",
-};
+  "Erik Walthinsen <omega@cse.ogi.edu>"
+);
 
 
 /* FdSink signals and args */
@@ -53,6 +50,7 @@ enum {
 };
 
 
+static void    gst_fdsink_base_init    (gpointer g_class);
 static void    gst_fdsink_class_init   (GstFdSinkClass *klass);
 static void    gst_fdsink_init         (GstFdSink *fdsink);
 
@@ -73,7 +71,8 @@ gst_fdsink_get_type (void)
 
   if (!fdsink_type) {
     static const GTypeInfo fdsink_info = {
-      sizeof(GstFdSinkClass),      NULL,
+      sizeof(GstFdSinkClass),
+      gst_fdsink_base_init,
       NULL,
       (GClassInitFunc)gst_fdsink_class_init,
       NULL,
@@ -83,16 +82,25 @@ gst_fdsink_get_type (void)
       (GInstanceInitFunc)gst_fdsink_init,
     };
     fdsink_type = g_type_register_static (GST_TYPE_ELEMENT, "GstFdSink", &fdsink_info, 0);
+  
+    GST_DEBUG_CATEGORY_INIT (gst_fdsink_debug, "fdsink", 0, "fdsink element");
   }
   return fdsink_type;
 }
 
 static void
+gst_fdsink_base_init (gpointer g_class)
+{
+  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+  
+  gst_element_class_set_details (gstelement_class, &gst_fdsink_details);
+}
+static void
 gst_fdsink_class_init (GstFdSinkClass *klass) 
 {
   GObjectClass *gobject_class;
 
-  gobject_class = (GObjectClass*)klass;
+  gobject_class = G_OBJECT_CLASS (klass);
 
   parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
 
index 4f6dfb6..838705a 100644 (file)
@@ -28,8 +28,6 @@
 
 G_BEGIN_DECLS
 
-extern GstElementDetails gst_fdsink_details;
-GST_DEBUG_CATEGORY_EXTERN(gst_fdsink_debug);
 
 #define GST_TYPE_FDSINK \
   (gst_fdsink_get_type())
index 9970399..de7359c 100644 (file)
 
 #define DEFAULT_BLOCKSIZE      4096
 
-GST_DEBUG_CATEGORY (gst_fdsrc_debug);
+GST_DEBUG_CATEGORY_STATIC (gst_fdsrc_debug);
 #define GST_CAT_DEFAULT gst_fdsrc_debug
 
-GstElementDetails gst_fdsrc_details = 
-{
+GstElementDetails gst_fdsrc_details = GST_ELEMENT_DETAILS (
   "Disk Source",
   "Source/File",
-  "LGPL",
   "Synchronous read from a file",
-  VERSION,
-  "Erik Walthinsen <omega@cse.ogi.edu>",
-  "(C) 1999",
-};
+  "Erik Walthinsen <omega@cse.ogi.edu>"
+);
 
 
 /* FdSrc signals and args */
@@ -62,7 +58,7 @@ enum {
   ARG_BLOCKSIZE,
 };
 
-
+static void            gst_fdsrc_base_init     (gpointer g_class);
 static void            gst_fdsrc_class_init    (GstFdSrcClass *klass);
 static void            gst_fdsrc_init          (GstFdSrc *fdsrc);
 
@@ -85,7 +81,7 @@ gst_fdsrc_get_type (void)
   if (!fdsrc_type) {
     static const GTypeInfo fdsrc_info = {
       sizeof(GstFdSrcClass),      
-      NULL,
+      gst_fdsrc_base_init,
       NULL,
       (GClassInitFunc)gst_fdsrc_class_init,
       NULL,
@@ -95,17 +91,26 @@ gst_fdsrc_get_type (void)
       (GInstanceInitFunc)gst_fdsrc_init,
     };
     fdsrc_type = g_type_register_static (GST_TYPE_ELEMENT, "GstFdSrc", &fdsrc_info, 0);
+  
+    GST_DEBUG_CATEGORY_INIT (gst_fdsrc_debug, "fdsrc", 0, "fdsrc element");
   }
   return fdsrc_type;
 }
 
 static void
+gst_fdsrc_base_init (gpointer g_class)
+{
+  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+  
+  gst_element_class_set_details (gstelement_class, &gst_fdsrc_details);
+}
+static void
 gst_fdsrc_class_init (GstFdSrcClass *klass) 
 {
   GObjectClass *gobject_class;
 
-  gobject_class = (GObjectClass*)klass;
-
+  gobject_class = G_OBJECT_CLASS (klass);
+  
   parent_class = g_type_class_ref(GST_TYPE_ELEMENT);
 
   g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FD,
index a17b2d5..b004e0b 100644 (file)
@@ -28,8 +28,6 @@
 
 G_BEGIN_DECLS
 
-extern GstElementDetails gst_fdsrc_details;
-GST_DEBUG_CATEGORY_EXTERN(gst_fdsrc_debug);
 
 #define GST_TYPE_FDSRC \
   (gst_fdsrc_get_type())
index 88372f7..5c4c81c 100644 (file)
 #include <sys/types.h>
 #include <unistd.h>
 
-GST_DEBUG_CATEGORY (gst_filesink_debug);
+GST_DEBUG_CATEGORY_STATIC (gst_filesink_debug);
 #define GST_CAT_DEFAULT gst_filesink_debug
 
-GstElementDetails gst_filesink_details = {
+GstElementDetails gst_filesink_details = GST_ELEMENT_DETAILS (
   "File Sink",
   "Sink/File",
-  "LGPL",
   "Write stream to a file",
-  VERSION,
-  "Thomas <thomas@apestaart.org>",
-  "(C) 2001"
-};
+  "Thomas <thomas@apestaart.org>"
+);
 
 
 /* FileSink signals and args */
@@ -69,6 +66,7 @@ GST_PAD_FORMATS_FUNCTION (gst_filesink_get_formats,
 )
 
 
+static void    gst_filesink_base_init          (gpointer g_class);
 static void    gst_filesink_class_init         (GstFileSinkClass *klass);
 static void    gst_filesink_init               (GstFileSink *filesink);
 
@@ -97,7 +95,8 @@ gst_filesink_get_type (void)
 
   if (!filesink_type) {
     static const GTypeInfo filesink_info = {
-      sizeof(GstFileSinkClass),      NULL,
+      sizeof(GstFileSinkClass),
+      gst_filesink_base_init,
       NULL,
       (GClassInitFunc)gst_filesink_class_init,
       NULL,
@@ -107,20 +106,26 @@ gst_filesink_get_type (void)
       (GInstanceInitFunc)gst_filesink_init,
     };
     filesink_type = g_type_register_static (GST_TYPE_ELEMENT, "GstFileSink", &filesink_info, 0);
+  
+    GST_DEBUG_CATEGORY_INIT (gst_filesink_debug, "filesink", 0, "filesink element");
   }
   return filesink_type;
 }
 
 static void
-gst_filesink_class_init (GstFileSinkClass *klass) 
+gst_filesink_base_init (gpointer g_class)
 {
-  GObjectClass *gobject_class;
-  GstElementClass *gstelement_class;
+  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
 
-  gobject_class = (GObjectClass*)klass;
-  gstelement_class = (GstElementClass*)klass;
+  gstelement_class->change_state = gst_filesink_change_state;
+  gst_element_class_set_details (gstelement_class, &gst_filesink_details);
+}
+static void
+gst_filesink_class_init (GstFileSinkClass *klass) 
+{
+  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
 
-  parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
+  parent_class = g_type_class_peek_parent (klass);
 
   g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LOCATION,
     g_param_spec_string ("location", "File Location", "Location of the file to write",
@@ -133,8 +138,6 @@ gst_filesink_class_init (GstFileSinkClass *klass)
 
   gobject_class->set_property = gst_filesink_set_property;
   gobject_class->get_property = gst_filesink_get_property;
-
-  gstelement_class->change_state = gst_filesink_change_state;
 }
 
 static void 
index 99e38eb..b72551b 100644 (file)
@@ -28,8 +28,6 @@
 
 G_BEGIN_DECLS
 
-extern GstElementDetails gst_filesink_details;
-GST_DEBUG_CATEGORY_EXTERN(gst_filesink_debug);
 
 #define GST_TYPE_FILESINK \
   (gst_filesink_get_type())
index d3288d6..f243d97 100644 (file)
  */
 
 
-GST_DEBUG_CATEGORY (gst_filesrc_debug);
+GST_DEBUG_CATEGORY_STATIC (gst_filesrc_debug);
 #define GST_CAT_DEFAULT gst_filesrc_debug
 
-GstElementDetails gst_filesrc_details = {
+GstElementDetails gst_filesrc_details = GST_ELEMENT_DETAILS (
   "File Source",
   "Source/File",
-  "LGPL",
   "Read from arbitrary point in a file",
-  VERSION,
-  "Erik Walthinsen <omega@cse.ogi.edu>",
-  "(C) 1999",
-};
+  "Erik Walthinsen <omega@cse.ogi.edu>"
+);
 
 #define DEFAULT_BLOCKSIZE      4*1024
 #define DEFAULT_MMAPSIZE       4*1024*1024
@@ -121,6 +118,7 @@ GST_PAD_FORMATS_FUNCTION (gst_filesrc_get_formats,
   GST_FORMAT_BYTES
 )
 
+static void            gst_filesrc_base_init           (gpointer g_class);
 static void            gst_filesrc_class_init          (GstFileSrcClass *klass);
 static void            gst_filesrc_init                (GstFileSrc *filesrc);
 static void            gst_filesrc_dispose             (GObject *object);
@@ -148,7 +146,8 @@ gst_filesrc_get_type(void)
 
   if (!filesrc_type) {
     static const GTypeInfo filesrc_info = {
-      sizeof(GstFileSrcClass),      NULL,
+      sizeof(GstFileSrcClass), 
+      gst_filesrc_base_init,
       NULL,
       (GClassInitFunc)gst_filesrc_class_init,
       NULL,
@@ -158,20 +157,28 @@ gst_filesrc_get_type(void)
       (GInstanceInitFunc)gst_filesrc_init,
     };
     filesrc_type = g_type_register_static (GST_TYPE_ELEMENT, "GstFileSrc", &filesrc_info, 0);
+
+    GST_DEBUG_CATEGORY_INIT (gst_filesrc_debug, "filesrc", 0, "filesrc element");
   }
   return filesrc_type;
 }
 
 static void
+gst_filesrc_base_init (gpointer g_class)
+{
+  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+
+  gst_element_class_set_details (gstelement_class, &gst_filesrc_details);
+}
+static void
 gst_filesrc_class_init (GstFileSrcClass *klass)
 {
-  GObjectClass *gobject_class;
-  GstElementClass *gstelement_class;
+  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
 
   gobject_class = (GObjectClass*)klass;
-  gstelement_class = (GstElementClass*)klass;
 
-  parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
+  parent_class = g_type_class_peek_parent (klass);
 
   g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FD,
     g_param_spec_int ("fd", "File-descriptor", "File-descriptor for the file being mmap()d",
index f1600c9..23b6dde 100644 (file)
@@ -30,8 +30,6 @@
 
 G_BEGIN_DECLS
 
-extern GstElementDetails gst_filesrc_details;
-GST_DEBUG_CATEGORY_EXTERN(gst_filesrc_debug);
 
 #define GST_TYPE_FILESRC \
   (gst_filesrc_get_type())
index b6b77d6..24021be 100644 (file)
 
 #include "gstidentity.h"
 
-GST_DEBUG_CATEGORY (gst_identity_debug);
+GST_DEBUG_CATEGORY_STATIC (gst_identity_debug);
 #define GST_CAT_DEFAULT gst_identity_debug
 
-GstElementDetails gst_identity_details = {
+GstElementDetails gst_identity_details = GST_ELEMENT_DETAILS (
   "Identity",
   "Generic",
-  "LGPL",
   "Pass data without modification",
-  VERSION,
-  "Erik Walthinsen <omega@cse.ogi.edu>",
-  "(C) 1999",
-};
+  "Erik Walthinsen <omega@cse.ogi.edu>"
+);
 
 
 /* Identity signals and args */
@@ -64,6 +61,7 @@ enum {
 };
 
 
+static void gst_identity_base_init     (gpointer g_class);
 static void gst_identity_class_init    (GstIdentityClass *klass);
 static void gst_identity_init          (GstIdentity *identity);
 
@@ -82,7 +80,8 @@ gst_identity_get_type (void)
 
   if (!identity_type) {
     static const GTypeInfo identity_info = {
-      sizeof(GstIdentityClass),      NULL,
+      sizeof(GstIdentityClass),
+      gst_identity_base_init,
       NULL,
       (GClassInitFunc)gst_identity_class_init,
       NULL,
@@ -92,18 +91,27 @@ gst_identity_get_type (void)
       (GInstanceInitFunc)gst_identity_init,
     };
     identity_type = g_type_register_static (GST_TYPE_ELEMENT, "GstIdentity", &identity_info, 0);
+  
+    GST_DEBUG_CATEGORY_INIT (gst_identity_debug, "identity", 0, "identity element");
   }
   return identity_type;
 }
 
+static void
+gst_identity_base_init (gpointer g_class)
+{
+  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+  
+  gst_element_class_set_details (gstelement_class, &gst_identity_details);
+}
 static void 
 gst_identity_class_init (GstIdentityClass *klass) 
 {
   GObjectClass *gobject_class;
 
-  gobject_class = (GObjectClass*)klass;
+  gobject_class = G_OBJECT_CLASS (klass);
 
-  parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
+  parent_class = g_type_class_peek_parent (klass);
 
   g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LOOP_BASED,
     g_param_spec_boolean ("loop-based", "Loop-based", 
index dd04364..8e39b84 100644 (file)
@@ -29,8 +29,6 @@
 
 G_BEGIN_DECLS
 
-extern GstElementDetails gst_identity_details;
-GST_DEBUG_CATEGORY_EXTERN(gst_identity_debug);
 
 #define GST_TYPE_IDENTITY \
   (gst_identity_get_type())
index 114d78d..181487d 100644 (file)
 #include <gst/gst.h>
 #include "gstmd5sink.h"
 
-GST_DEBUG_CATEGORY (gst_md5sink_debug);
+GST_DEBUG_CATEGORY_STATIC (gst_md5sink_debug);
 #define GST_CAT_DEFAULT gst_md5sink_debug
 
+GstElementDetails gst_md5sink_details = GST_ELEMENT_DETAILS (
+  "MD5 Sink",
+  "Sink",
+  "compute MD5 for incoming data",
+  "Benjamin Otte <in7y118@public.uni-hamburg.de>"
+);
+
 /* MD5Sink signals and args */
 enum {
   /* FILL ME */
@@ -55,6 +62,7 @@ GST_PAD_TEMPLATE_FACTORY (md5_sink_factory,
 );
 
 /* GObject stuff */
+static void                    gst_md5sink_base_init           (gpointer g_class);
 static void                    gst_md5sink_class_init          (GstMD5SinkClass *klass);
 static void                    gst_md5sink_init                (GstMD5Sink *md5sink);
 
@@ -381,7 +389,7 @@ gst_md5sink_get_type (void)
   if (!md5sink_type) {
     static const GTypeInfo md5sink_info = {
       sizeof(GstMD5SinkClass),
-      NULL,
+      gst_md5sink_base_init,
       NULL,
       (GClassInitFunc) gst_md5sink_class_init,
       NULL,
@@ -392,11 +400,21 @@ gst_md5sink_get_type (void)
     };
     md5sink_type = g_type_register_static (GST_TYPE_ELEMENT, "GstMD5Sink", 
                                           &md5sink_info, 0);
+  
+    GST_DEBUG_CATEGORY_INIT (gst_md5sink_debug, "md5sink", 0, "md5sink element");
   }
   return md5sink_type;
 }
 
 static void
+gst_md5sink_base_init (gpointer g_class)
+{
+  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+  
+  gst_element_class_set_details (gstelement_class, &gst_md5sink_details);
+  gst_element_class_add_pad_template (gstelement_class, GST_PAD_TEMPLATE_GET (md5_sink_factory));
+}
+static void
 gst_md5sink_class_init (GstMD5SinkClass *klass) 
 {
   GObjectClass *gobject_class;
@@ -405,15 +423,15 @@ gst_md5sink_class_init (GstMD5SinkClass *klass)
   gobject_class = (GObjectClass *) klass;
   gstelement_class = (GstElementClass *) klass;
 
-  parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
+  parent_class = g_type_class_peek_parent (klass);
+
+  gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_md5sink_get_property);
 
   g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MD5,
     g_param_spec_string ("md5", "md5", "current value of the md5 sum",
                          "", G_PARAM_READABLE)); 
 
   gstelement_class->change_state = GST_DEBUG_FUNCPTR(gst_md5sink_change_state);
-
-  gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_md5sink_get_property);
 }
 
 static void 
@@ -508,20 +526,3 @@ gst_md5sink_chain (GstPad *pad, GstData *_data)
   gst_buffer_unref (buf);
 }
 
-GstElementDetails gst_md5sink_details = {
-  "MD5 Sink",
-  "Sink",
-  "LGPL",
-  "compute MD5 for incoming data",
-  VERSION,
-  "Benjamin Otte <in7y118@public.uni-hamburg.de>",
-  "(C) 2002",
-};
-
-gboolean
-gst_md5sink_factory_init (GstElementFactory *factory)
-{
-  gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (md5_sink_factory));
-
-  return TRUE;
-}
index 5d24df6..fc847b2 100644 (file)
@@ -29,8 +29,6 @@
 
 G_BEGIN_DECLS
 
-extern GstElementDetails gst_md5sink_details;
-GST_DEBUG_CATEGORY_EXTERN(gst_md5sink_debug);
 
 #define GST_TYPE_MD5SINK \
   (gst_md5sink_get_type())
index c2a0e6f..d3ca0d9 100644 (file)
 
 #include "gstmultidisksrc.h"
 
-GST_DEBUG_CATEGORY (gst_multidisksrc_debug);
+GST_DEBUG_CATEGORY_STATIC (gst_multidisksrc_debug);
 #define GST_CAT_DEFAULT gst_multidisksrc_debug
 
-GstElementDetails gst_multidisksrc_details = {
+GstElementDetails gst_multidisksrc_details = GST_ELEMENT_DETAILS (
   "Multi Disk Source",
   "Source/File",
-  "LGPL",
   "Read from multiple files in order",
-  VERSION,
-  "Dominic Ludlam <dom@openfx.org>",
-  "(C) 2001",
-};
+  "Dominic Ludlam <dom@openfx.org>"
+);
 
 /* DiskSrc signals and args */
 enum {
@@ -57,6 +54,7 @@ enum {
   ARG_LOCATIONS,
 };
 
+static void            gst_multidiscsrc_base_init      (gpointer g_class);
 static void            gst_multidisksrc_class_init     (GstMultiDiskSrcClass *klass);
 static void            gst_multidisksrc_init           (GstMultiDiskSrc *disksrc);
 
@@ -81,7 +79,8 @@ gst_multidisksrc_get_type(void)
 
   if (!multidisksrc_type) {
     static const GTypeInfo multidisksrc_info = {
-      sizeof(GstMultiDiskSrcClass),      NULL,
+      sizeof(GstMultiDiskSrcClass),
+      gst_multidiscsrc_base_init,
       NULL,
       (GClassInitFunc)gst_multidisksrc_class_init,
       NULL,
@@ -91,11 +90,20 @@ gst_multidisksrc_get_type(void)
       (GInstanceInitFunc)gst_multidisksrc_init,
     };
     multidisksrc_type = g_type_register_static (GST_TYPE_ELEMENT, "GstMultiDiskSrc", &multidisksrc_info, 0);
+  
+    GST_DEBUG_CATEGORY_INIT (gst_multidisksrc_debug, "multidisksrc", 0, "multidisksrc element");
   }
   return multidisksrc_type;
 }
 
 static void
+gst_multidiscsrc_base_init (gpointer g_class)
+{
+  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+  
+  gst_element_class_set_details (gstelement_class, &gst_multidisksrc_details);
+}
+static void
 gst_multidisksrc_class_init (GstMultiDiskSrcClass *klass)
 {
   GObjectClass *gobject_class;
index 07e8398..402cf4f 100644 (file)
@@ -28,8 +28,6 @@
 
 G_BEGIN_DECLS
 
-extern GstElementDetails gst_multidisksrc_details;
-GST_DEBUG_CATEGORY_EXTERN(gst_multidisksrc_debug);
 
 #define GST_TYPE_MULTIDISKSRC \
   (gst_multidisksrc_get_type())
index c2a0e6f..d3ca0d9 100644 (file)
 
 #include "gstmultidisksrc.h"
 
-GST_DEBUG_CATEGORY (gst_multidisksrc_debug);
+GST_DEBUG_CATEGORY_STATIC (gst_multidisksrc_debug);
 #define GST_CAT_DEFAULT gst_multidisksrc_debug
 
-GstElementDetails gst_multidisksrc_details = {
+GstElementDetails gst_multidisksrc_details = GST_ELEMENT_DETAILS (
   "Multi Disk Source",
   "Source/File",
-  "LGPL",
   "Read from multiple files in order",
-  VERSION,
-  "Dominic Ludlam <dom@openfx.org>",
-  "(C) 2001",
-};
+  "Dominic Ludlam <dom@openfx.org>"
+);
 
 /* DiskSrc signals and args */
 enum {
@@ -57,6 +54,7 @@ enum {
   ARG_LOCATIONS,
 };
 
+static void            gst_multidiscsrc_base_init      (gpointer g_class);
 static void            gst_multidisksrc_class_init     (GstMultiDiskSrcClass *klass);
 static void            gst_multidisksrc_init           (GstMultiDiskSrc *disksrc);
 
@@ -81,7 +79,8 @@ gst_multidisksrc_get_type(void)
 
   if (!multidisksrc_type) {
     static const GTypeInfo multidisksrc_info = {
-      sizeof(GstMultiDiskSrcClass),      NULL,
+      sizeof(GstMultiDiskSrcClass),
+      gst_multidiscsrc_base_init,
       NULL,
       (GClassInitFunc)gst_multidisksrc_class_init,
       NULL,
@@ -91,11 +90,20 @@ gst_multidisksrc_get_type(void)
       (GInstanceInitFunc)gst_multidisksrc_init,
     };
     multidisksrc_type = g_type_register_static (GST_TYPE_ELEMENT, "GstMultiDiskSrc", &multidisksrc_info, 0);
+  
+    GST_DEBUG_CATEGORY_INIT (gst_multidisksrc_debug, "multidisksrc", 0, "multidisksrc element");
   }
   return multidisksrc_type;
 }
 
 static void
+gst_multidiscsrc_base_init (gpointer g_class)
+{
+  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+  
+  gst_element_class_set_details (gstelement_class, &gst_multidisksrc_details);
+}
+static void
 gst_multidisksrc_class_init (GstMultiDiskSrcClass *klass)
 {
   GObjectClass *gobject_class;
index 07e8398..402cf4f 100644 (file)
@@ -28,8 +28,6 @@
 
 G_BEGIN_DECLS
 
-extern GstElementDetails gst_multidisksrc_details;
-GST_DEBUG_CATEGORY_EXTERN(gst_multidisksrc_debug);
 
 #define GST_TYPE_MULTIDISKSRC \
   (gst_multidisksrc_get_type())
index e31e0e2..611f942 100644 (file)
 
 #include "gstpipefilter.h"
 
-GST_DEBUG_CATEGORY (gst_pipefilter_debug);
+GST_DEBUG_CATEGORY_STATIC (gst_pipefilter_debug);
 #define GST_CAT_DEFAULT gst_pipefilter_debug
 
-GstElementDetails gst_pipefilter_details = {
+GstElementDetails gst_pipefilter_details = GST_ELEMENT_DETAILS (
   "Pipefilter",
   "Filter",
-  "LGPL",
   "Interoperate with an external program using stdin and stdout",
-  VERSION,
-  "Erik Walthinsen <omega@cse.ogi.edu>\n"
-  "Wim Taymans <wim.taymans@chello.be>",
-  "(C) 1999",
-};
+  "Erik Walthinsen <omega@cse.ogi.edu>, "
+  "Wim Taymans <wim.taymans@chello.be>"
+);
 
 
 /* Pipefilter signals and args */
@@ -62,13 +59,14 @@ enum {
 };
 
 
+static void                    gst_pipefilter_base_init        (gpointer g_class);
 static void                    gst_pipefilter_class_init       (GstPipefilterClass *klass);
 static void                    gst_pipefilter_init             (GstPipefilter *pipefilter);
 
 static void                    gst_pipefilter_set_property     (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
 static void                    gst_pipefilter_get_property     (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
 
-static GstData*                gst_pipefilter_get              (GstPad *pad);
+static GstData*                        gst_pipefilter_get              (GstPad *pad);
 static void                    gst_pipefilter_chain            (GstPad *pad, GstData *_data);
 static gboolean                gst_pipefilter_handle_event     (GstPad *pad, GstEvent *event);
 
@@ -84,7 +82,8 @@ gst_pipefilter_get_type (void)
 
   if (!pipefilter_type) {
     static const GTypeInfo pipefilter_info = {
-      sizeof(GstPipefilterClass),      NULL,
+      sizeof(GstPipefilterClass),
+      gst_pipefilter_base_init,
       NULL,
       (GClassInitFunc)gst_pipefilter_class_init,
       NULL,
@@ -94,10 +93,19 @@ gst_pipefilter_get_type (void)
       (GInstanceInitFunc)gst_pipefilter_init,
     };
     pipefilter_type = g_type_register_static(GST_TYPE_ELEMENT, "GstPipefilter", &pipefilter_info, 0);
+  
+    GST_DEBUG_CATEGORY_INIT (gst_pipefilter_debug, "pipefilter", 0, "pipefilter element");
   }
   return pipefilter_type;
 }
 
+static void
+gst_pipefilter_base_init (gpointer g_class)
+{
+  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+  
+  gst_element_class_set_details (gstelement_class, &gst_pipefilter_details);
+}
 static void 
 gst_pipefilter_class_init (GstPipefilterClass *klass)
 {
@@ -109,14 +117,14 @@ gst_pipefilter_class_init (GstPipefilterClass *klass)
 
   parent_class = g_type_class_ref(GST_TYPE_ELEMENT);
 
-  gstelement_class->change_state = gst_pipefilter_change_state;
+  gobject_class->set_property = gst_pipefilter_set_property;  
+  gobject_class->get_property = gst_pipefilter_get_property;
 
   g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_COMMAND,
     g_param_spec_string("command","command","command",
                         NULL, G_PARAM_READWRITE)); /* CHECKME */
 
-  gobject_class->set_property = gst_pipefilter_set_property;  
-  gobject_class->get_property = gst_pipefilter_get_property;
+  gstelement_class->change_state = gst_pipefilter_change_state;
 }
 
 static void
index 9516482..08c3a47 100644 (file)
@@ -29,8 +29,6 @@
 
 G_BEGIN_DECLS
 
-extern GstElementDetails gst_pipefilter_details;
-GST_DEBUG_CATEGORY_EXTERN(gst_pipefilter_debug);
 
 #define GST_TYPE_PIPEFILTER \
   (gst_pipefilter_get_type())
index 57fcf56..5cf0686 100644 (file)
 
 #include "gstshaper.h"
 
-GST_DEBUG_CATEGORY (gst_shaper_debug);
+GST_DEBUG_CATEGORY_STATIC (gst_shaper_debug);
 #define GST_CAT_DEFAULT gst_shaper_debug
 
-GstElementDetails gst_shaper_details = {
+GstElementDetails gst_shaper_details = GST_ELEMENT_DETAILS (
   "Shaper",
   "Generic",
-  "LGPL",
   "Synchronizes streams on different pads",
-  VERSION,
-  "Wim Taymans <wim.taymans@chello.be>",
-  "(C) 2003",
-};
+  "Wim Taymans <wim.taymans@chello.be>"
+);
 
 
 /* Shaper signals and args */
@@ -93,6 +90,7 @@ gst_shaper_policy_get_type (void)
   return shaper_policy_type;
 }
 
+static void    gst_shaper_base_init            (gpointer g_class);
 static void    gst_shaper_class_init           (GstShaperClass *klass);
 static void    gst_shaper_init                 (GstShaper *shaper);
 
@@ -116,7 +114,8 @@ gst_shaper_get_type (void)
 
   if (!shaper_type) {
     static const GTypeInfo shaper_info = {
-      sizeof(GstShaperClass),      NULL,
+      sizeof(GstShaperClass),
+      gst_shaper_base_init,
       NULL,
       (GClassInitFunc)gst_shaper_class_init,
       NULL,
@@ -126,10 +125,21 @@ gst_shaper_get_type (void)
       (GInstanceInitFunc)gst_shaper_init,
     };
     shaper_type = g_type_register_static (GST_TYPE_ELEMENT, "GstShaper", &shaper_info, 0);
+  
+    GST_DEBUG_CATEGORY_INIT (gst_shaper_debug, "shaper", 0, "shaper element");
   }
   return shaper_type;
 }
 
+static void
+gst_shaper_base_init (gpointer g_class)
+{
+  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+  
+  gst_element_class_set_details (gstelement_class, &gst_shaper_details);
+  gst_element_class_add_pad_template (gstelement_class, GST_PAD_TEMPLATE_GET (shaper_src_factory));
+  gst_element_class_add_pad_template (gstelement_class, GST_PAD_TEMPLATE_GET (shaper_sink_factory));
+}
 static void 
 gst_shaper_class_init (GstShaperClass *klass) 
 {
@@ -380,11 +390,3 @@ static void gst_shaper_get_property(GObject *object, guint prop_id, GValue *valu
   }
 }
 
-gboolean
-gst_shaper_factory_init (GstElementFactory *factory)
-{
-  gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (shaper_src_factory));
-  gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (shaper_sink_factory));
-
-  return TRUE;
-}
index 71995ae..2cbaf53 100644 (file)
@@ -29,8 +29,6 @@
 
 G_BEGIN_DECLS
 
-extern GstElementDetails gst_shaper_details;
-GST_DEBUG_CATEGORY_EXTERN(gst_shaper_debug);
 
 #define GST_TYPE_SHAPER \
   (gst_shaper_get_type())
index 3cbcebc..5c72fbe 100644 (file)
 
 #include "gststatistics.h"
 
-GST_DEBUG_CATEGORY (gst_statistics_debug);
+GST_DEBUG_CATEGORY_STATIC (gst_statistics_debug);
 #define GST_CAT_DEFAULT gst_statistics_debug
 
-GstElementDetails gst_statistics_details = {
+GstElementDetails gst_statistics_details = GST_ELEMENT_DETAILS (
   "Statistics",
   "Generic",
-  "LGPL",
   "Statistics on buffers/bytes/events",
-  VERSION,
-  "David I. Lehn <dlehn@users.sourceforge.net>",
-  "(C) 2001",
-};
+  "David I. Lehn <dlehn@users.sourceforge.net>"
+);
 
 
 /* Statistics signals and args */
@@ -61,6 +58,7 @@ enum {
 };
 
 
+static void gst_statistics_base_init   (gpointer g_class);
 static void gst_statistics_class_init  (GstStatisticsClass *klass);
 static void gst_statistics_init                (GstStatistics *statistics);
 
@@ -83,7 +81,8 @@ gst_statistics_get_type (void)
 
   if (!statistics_type) {
     static const GTypeInfo statistics_info = {
-      sizeof(GstStatisticsClass),      NULL,
+      sizeof(GstStatisticsClass), 
+      gst_statistics_base_init,
       NULL,
       (GClassInitFunc)gst_statistics_class_init,
       NULL,
@@ -93,18 +92,27 @@ gst_statistics_get_type (void)
       (GInstanceInitFunc)gst_statistics_init,
     };
     statistics_type = g_type_register_static (GST_TYPE_ELEMENT, "GstStatistics", &statistics_info, 0);
+  
+    GST_DEBUG_CATEGORY_INIT (gst_statistics_debug, "statistics", 0, "statistics element");
   }
   return statistics_type;
 }
 
+static void
+gst_statistics_base_init (gpointer g_class)
+{
+  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+  
+  gst_element_class_set_details (gstelement_class, &gst_statistics_details);
+}
 static void 
 gst_statistics_class_init (GstStatisticsClass *klass) 
 {
   GObjectClass *gobject_class;
+  
+  gobject_class = G_OBJECT_CLASS (klass);
 
-  gobject_class = (GObjectClass*)klass;
-
-  parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
+  parent_class = g_type_class_peek_parent (klass);
 
   g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BUFFERS,
     g_param_spec_int64 ("buffers", "buffers", "total buffers count",
index aedf00a..4c1ab57 100644 (file)
@@ -28,8 +28,6 @@
 
 G_BEGIN_DECLS
 
-extern GstElementDetails gst_statistics_details;
-GST_DEBUG_CATEGORY_EXTERN(gst_statistics_debug);
 
 #define GST_TYPE_STATISTICS \
   (gst_statistics_get_type())
index bfc4f8f..4f0249f 100644 (file)
 
 #include "gsttee.h"
 
-GST_DEBUG_CATEGORY (gst_tee_debug);
+GST_DEBUG_CATEGORY_STATIC (gst_tee_debug);
 #define GST_CAT_DEFAULT gst_tee_debug
 
-GstElementDetails gst_tee_details = {
+GstElementDetails gst_tee_details = GST_ELEMENT_DETAILS (
   "Tee pipe fitting",
   "Generic",
-  "LGPL",
   "1-to-N pipe fitting",
-  VERSION,
-  "Erik Walthinsen <omega@cse.ogi.edu>\n"
-  "Wim Taymans <wim.taymans@chello.be>",
-  "(C) 1999, 2000",
-};
+  "Erik Walthinsen <omega@cse.ogi.edu>, "
+  "Wim Taymans <wim.taymans@chello.be>"
+);
 
 /* Tee signals and args */
 enum {
@@ -61,6 +58,7 @@ GST_PAD_TEMPLATE_FACTORY (tee_src_factory,
   GST_CAPS_ANY
 );
 
+static void    gst_tee_base_init       (gpointer g_class);
 static void    gst_tee_class_init      (GstTeeClass *klass);
 static void    gst_tee_init            (GstTee *tee);
 
@@ -83,7 +81,8 @@ gst_tee_get_type(void) {
 
   if (!tee_type) {
     static const GTypeInfo tee_info = {
-      sizeof(GstTeeClass),      NULL,
+      sizeof(GstTeeClass),
+      gst_tee_base_init,
       NULL,
       (GClassInitFunc)gst_tee_class_init,
       NULL,
@@ -93,11 +92,21 @@ gst_tee_get_type(void) {
       (GInstanceInitFunc)gst_tee_init,
     };
     tee_type = g_type_register_static (GST_TYPE_ELEMENT, "GstTee", &tee_info, 0);
+  
+    GST_DEBUG_CATEGORY_INIT (gst_tee_debug, "tee", 0, "tee element");
   }
   return tee_type;
 }
 
 static void
+gst_tee_base_init (gpointer g_class)
+{
+  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+  
+  gst_element_class_set_details (gstelement_class, &gst_tee_details);
+  gst_element_class_add_pad_template (gstelement_class, GST_PAD_TEMPLATE_GET (tee_src_factory));
+}
+static void
 gst_tee_class_init (GstTeeClass *klass) 
 {
   GObjectClass *gobject_class;
@@ -380,10 +389,3 @@ gst_tee_chain (GstPad *pad, GstData *_data)
   }
 }
 
-gboolean
-gst_tee_factory_init (GstElementFactory *factory)
-{
-  gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (tee_src_factory));
-
-  return TRUE;
-}
index 0193bb0..b58a6c0 100644 (file)
@@ -28,8 +28,6 @@
 
 G_BEGIN_DECLS
 
-extern GstElementDetails gst_tee_details;
-GST_DEBUG_CATEGORY_EXTERN(gst_tee_debug);
 
 #define GST_TYPE_TEE \
   (gst_tee_get_type())
index bd5e3d3..7d38b0f 100644 (file)
 
 #include <gst/gsttypefind.h>
 
-GST_DEBUG_CATEGORY (gst_type_find_element_debug);
+GST_DEBUG_CATEGORY_STATIC (gst_type_find_element_debug);
 #define GST_CAT_DEFAULT gst_type_find_element_debug
 
-GstElementDetails gst_type_find_element_details = {
+GstElementDetails gst_type_find_element_details = GST_ELEMENT_DETAILS (
   "TypeFind",
   "Generic",
-  "LGPL",
   "Finds the media type of a stream",
-  VERSION,
-  "Benjamin Otte <in7y118@public.uni-hamburg.de>",
-  "(C) 2003",
-};
+  "Benjamin Otte <in7y118@public.uni-hamburg.de>"
+);
 
 /* generic templates */
 GST_PAD_TEMPLATE_FACTORY (type_find_element_sink_factory,
@@ -87,6 +84,7 @@ enum {
 };
 
 
+static void    gst_type_find_element_base_init         (gpointer g_class);
 static void    gst_type_find_element_class_init        (gpointer       g_class,
                                                         gpointer       class_data);
 static void    gst_type_find_element_init              (GTypeInstance *instance,
@@ -122,7 +120,7 @@ gst_type_find_element_get_type (void)
   if (!typefind_type) {
     static const GTypeInfo typefind_info = {
       sizeof (GstTypeFindElementClass),
-      NULL,
+      gst_type_find_element_base_init,
       NULL,
       gst_type_find_element_class_init,
       NULL,
@@ -135,6 +133,9 @@ gst_type_find_element_get_type (void)
     typefind_type = g_type_register_static (GST_TYPE_ELEMENT,
                                            "GstTypeFindElement",
                                            &typefind_info, 0);
+
+    GST_DEBUG_CATEGORY_INIT (gst_type_find_element_debug, "typefind", 
+                            GST_DEBUG_BG_YELLOW | GST_DEBUG_FG_GREEN, "typefind element");
   }
   return typefind_type;
 }
@@ -155,6 +156,13 @@ gst_type_find_element_have_type (GstTypeFindElement *typefind, guint probability
   }
 }
 static void
+gst_type_find_element_base_init (gpointer g_class)
+{
+  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+  
+  gst_element_class_set_details (gstelement_class, &gst_type_find_element_details);
+}
+static void
 gst_type_find_element_class_init (gpointer g_class, gpointer class_data)
 {
   GObjectClass *gobject_class;
index 4b5e0cc..7f508ba 100644 (file)
@@ -30,9 +30,7 @@
 
 G_BEGIN_DECLS
 
-GST_DEBUG_CATEGORY_EXTERN(gst_type_find_element_debug);
 
-extern GstElementDetails gst_type_find_element_details;
 
 #define GST_TYPE_TYPE_FIND_ELEMENT             (gst_type_find_element_get_type ())
 #define GST_TYPE_FIND_ELEMENT(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_TYPE_FIND_ELEMENT, GstTypeFindElement))
index bd5e3d3..7d38b0f 100644 (file)
 
 #include <gst/gsttypefind.h>
 
-GST_DEBUG_CATEGORY (gst_type_find_element_debug);
+GST_DEBUG_CATEGORY_STATIC (gst_type_find_element_debug);
 #define GST_CAT_DEFAULT gst_type_find_element_debug
 
-GstElementDetails gst_type_find_element_details = {
+GstElementDetails gst_type_find_element_details = GST_ELEMENT_DETAILS (
   "TypeFind",
   "Generic",
-  "LGPL",
   "Finds the media type of a stream",
-  VERSION,
-  "Benjamin Otte <in7y118@public.uni-hamburg.de>",
-  "(C) 2003",
-};
+  "Benjamin Otte <in7y118@public.uni-hamburg.de>"
+);
 
 /* generic templates */
 GST_PAD_TEMPLATE_FACTORY (type_find_element_sink_factory,
@@ -87,6 +84,7 @@ enum {
 };
 
 
+static void    gst_type_find_element_base_init         (gpointer g_class);
 static void    gst_type_find_element_class_init        (gpointer       g_class,
                                                         gpointer       class_data);
 static void    gst_type_find_element_init              (GTypeInstance *instance,
@@ -122,7 +120,7 @@ gst_type_find_element_get_type (void)
   if (!typefind_type) {
     static const GTypeInfo typefind_info = {
       sizeof (GstTypeFindElementClass),
-      NULL,
+      gst_type_find_element_base_init,
       NULL,
       gst_type_find_element_class_init,
       NULL,
@@ -135,6 +133,9 @@ gst_type_find_element_get_type (void)
     typefind_type = g_type_register_static (GST_TYPE_ELEMENT,
                                            "GstTypeFindElement",
                                            &typefind_info, 0);
+
+    GST_DEBUG_CATEGORY_INIT (gst_type_find_element_debug, "typefind", 
+                            GST_DEBUG_BG_YELLOW | GST_DEBUG_FG_GREEN, "typefind element");
   }
   return typefind_type;
 }
@@ -155,6 +156,13 @@ gst_type_find_element_have_type (GstTypeFindElement *typefind, guint probability
   }
 }
 static void
+gst_type_find_element_base_init (gpointer g_class)
+{
+  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+  
+  gst_element_class_set_details (gstelement_class, &gst_type_find_element_details);
+}
+static void
 gst_type_find_element_class_init (gpointer g_class, gpointer class_data)
 {
   GObjectClass *gobject_class;
index 4b5e0cc..7f508ba 100644 (file)
@@ -30,9 +30,7 @@
 
 G_BEGIN_DECLS
 
-GST_DEBUG_CATEGORY_EXTERN(gst_type_find_element_debug);
 
-extern GstElementDetails gst_type_find_element_details;
 
 #define GST_TYPE_TYPE_FIND_ELEMENT             (gst_type_find_element_get_type ())
 #define GST_TYPE_FIND_ELEMENT(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_TYPE_FIND_ELEMENT, GstTypeFindElement))
index f06b11c..dee3371 100644 (file)
--- a/gst/gst.c
+++ b/gst/gst.c
@@ -330,16 +330,14 @@ parse_debug_list (const gchar *list)
 static void 
 load_plugin_func (gpointer data, gpointer user_data)
 {
-  gboolean ret;
   GstPlugin *plugin;
   const gchar *filename;
 
   filename = (const gchar *) data;
 
-  plugin = gst_plugin_new (filename);
-  ret = gst_plugin_load_plugin (plugin, NULL);
+  plugin = gst_plugin_load_file (filename, NULL);
 
-  if (ret) {
+  if (plugin) {
     GST_INFO ("Loaded plugin: \"%s\"", filename);
 
     gst_registry_pool_add_plugin (plugin);
@@ -445,19 +443,13 @@ init_pre (void)
 }
 
 static gboolean
-gst_register_core_elements (GModule *module, GstPlugin *plugin)
+gst_register_core_elements (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));
+  g_assert (gst_element_register (plugin, "bin", GST_RANK_PRIMARY, GST_TYPE_BIN));
+  g_assert (gst_element_register (plugin, "pipeline", GST_RANK_PRIMARY, GST_TYPE_PIPELINE));
+  g_assert (gst_element_register (plugin, "thread", GST_RANK_PRIMARY, GST_TYPE_THREAD));
+  g_assert (gst_element_register (plugin, "queue", GST_RANK_PRIMARY, GST_TYPE_QUEUE));
 
   return TRUE;
 }
@@ -465,8 +457,17 @@ gst_register_core_elements (GModule *module, GstPlugin *plugin)
 static GstPluginDesc plugin_desc = {
   GST_VERSION_MAJOR,           
   GST_VERSION_MINOR,  
-  "gst_core_plugins",
-  gst_register_core_elements
+  "gst_core_elements",
+  "core elements of the GStreamer library",
+  gst_register_core_elements,
+  NULL,
+  VERSION,
+  GST_LICENSE,
+  GST_COPYRIGHT,
+  GST_PACKAGE,
+  GST_ORIGIN,
+
+  GST_STRUCT_PADDING_INIT
 };                         
 
 /*
index caab5b0..310df32 100644 (file)
@@ -71,7 +71,6 @@ extern GstDebugCategory *GST_CAT_BUFFER;
 extern GstDebugCategory *GST_CAT_CAPS;
 extern GstDebugCategory *GST_CAT_CLOCK;
 extern GstDebugCategory *GST_CAT_ELEMENT_PADS;
-extern GstDebugCategory *GST_CAT_ELEMENT_FACTORY;
 extern GstDebugCategory *GST_CAT_PADS;
 extern GstDebugCategory *GST_CAT_PIPELINE;
 extern GstDebugCategory *GST_CAT_PLUGIN_LOADING;
index 390d5f5..a012b4d 100644 (file)
 #include "gstscheduler.h"
 #include "gstindex.h"
 
-GstElementDetails gst_bin_details = {
+static GstElementDetails gst_bin_details = GST_ELEMENT_DETAILS (
   "Generic bin",
   "Generic/Bin",
-  "LGPL",
   "Simple container object",
-  VERSION,
-  "Erik Walthinsen <omega@cse.ogi.edu>",
-  "(C) 1999",
-};
+  "Erik Walthinsen <omega@cse.ogi.edu>"
+);
 
 GType _gst_bin_type = 0;
 
@@ -85,6 +82,7 @@ enum
   /* FILL ME */
 };
 
+static void                    gst_bin_base_init               (gpointer g_class);
 static void                    gst_bin_class_init              (GstBinClass * klass);
 static void                    gst_bin_init                    (GstBin * bin);
 
@@ -97,7 +95,7 @@ gst_bin_get_type (void)
   if (!_gst_bin_type) {
     static const GTypeInfo bin_info = {
       sizeof (GstBinClass),
-      NULL,
+      gst_bin_base_init,
       NULL,
       (GClassInitFunc) gst_bin_class_init,
       NULL,
@@ -114,6 +112,14 @@ gst_bin_get_type (void)
 }
 
 static void
+gst_bin_base_init (gpointer g_class)
+{
+  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+  
+  gst_element_class_set_details (gstelement_class, &gst_bin_details);
+}
+
+static void
 gst_bin_class_init (GstBinClass * klass)
 {
   GObjectClass *gobject_class;
index 9fa4211..d4246a7 100644 (file)
@@ -28,7 +28,6 @@
 
 G_BEGIN_DECLS
 
-extern GstElementDetails gst_bin_details;
 extern GType _gst_bin_type;
 
 #define GST_TYPE_BIN             (_gst_bin_type)
index 6795cfe..5c5263a 100644 (file)
@@ -47,9 +47,14 @@ enum {
   /* FILL ME */
 };
 
+extern void                    __gst_element_details_clear     (GstElementDetails *dp);
+extern void                    __gst_element_details_set       (GstElementDetails *dest, 
+                                                                const GstElementDetails *src);
+
 static void                    gst_element_class_init          (GstElementClass *klass);
 static void                    gst_element_init                (GstElement *element);
-static void                    gst_element_base_class_init     (GstElementClass *klass);
+static void                    gst_element_base_class_init     (gpointer g_class);
+static void                    gst_element_base_class_finalize (gpointer g_class);
 
 static void                    gst_element_real_set_property   (GObject *object, guint prop_id, 
                                                                 const GValue *value, GParamSpec *pspec);
@@ -76,8 +81,8 @@ GType gst_element_get_type (void)
   if (!_gst_element_type) {
     static const GTypeInfo element_info = {
       sizeof(GstElementClass),
-      (GBaseInitFunc)gst_element_base_class_init,
-      NULL,
+      gst_element_base_class_init,
+      gst_element_base_class_finalize,
       (GClassInitFunc)gst_element_class_init,
       NULL,
       NULL,
@@ -140,14 +145,14 @@ gst_element_class_init (GstElementClass *klass)
 
   klass->change_state                  = GST_DEBUG_FUNCPTR (gst_element_change_state);
   klass->error                         = GST_DEBUG_FUNCPTR (gst_element_error_func);
-  klass->elementfactory                = NULL;
   klass->padtemplates                  = NULL;
   klass->numpadtemplates               = 0;
 }
 
 static void
-gst_element_base_class_init (GstElementClass *klass)
+gst_element_base_class_init (gpointer g_class)
 {
+  GstElementClass *klass = GST_ELEMENT_CLASS (klass);
   GObjectClass *gobject_class;
 
   gobject_class = (GObjectClass*) klass;
@@ -157,6 +162,16 @@ gst_element_base_class_init (GstElementClass *klass)
 }
 
 static void
+gst_element_base_class_finalize (gpointer g_class)
+{
+  GstElementClass *klass = GST_ELEMENT_CLASS (klass);
+
+  g_list_foreach (klass->padtemplates, (GFunc) g_object_unref, NULL);
+  g_list_free (klass->padtemplates);
+  __gst_element_details_clear (&klass->details);
+}
+
+static void
 gst_element_init (GstElement *element)
 {
   element->current_state = GST_STATE_NULL;
@@ -1157,10 +1172,8 @@ gst_element_get_pad_list (GstElement *element)
  * @klass: the #GstElementClass to add the pad template to.
  * @templ: a #GstPadTemplate to add to the element class.
  *
- * Adds a padtemplate to an element class. 
- * This is useful if you have derived a custom bin and wish to provide 
- * an on-request pad at runtime. Plug-in writers should use
- * gst_element_factory_add_pad_template instead.
+ * Adds a padtemplate to an element class. This is mainly used in the _base_init
+ * functions of classes.
  */
 void
 gst_element_class_add_pad_template (GstElementClass *klass, 
@@ -1176,6 +1189,23 @@ gst_element_class_add_pad_template (GstElementClass *klass,
 }
 
 /**
+ * gst_element_class_set_details:
+ * @klass: class to set details for
+ * @details: details to set
+ *
+ * Sets the detailed information for a #GstElementClass.
+ * <note>This function is for use in _base_init functions only.</note>
+ */
+void                    
+gst_element_class_set_details (GstElementClass *klass, GstElementDetails *details)
+{
+  g_return_if_fail (GST_IS_ELEMENT_CLASS (klass));
+  g_return_if_fail (GST_IS_ELEMENT_DETAILS (details));
+  
+  __gst_element_details_set (&klass->details, details);
+}
+
+/**
  * gst_element_get_pad_template_list:
  * @element: a #GstElement to get pad templates of.
  *
@@ -2522,22 +2552,6 @@ failure:
   return GST_STATE_FAILURE;
 }
 
-/**
- * gst_element_get_factory:
- * @element: a #GstElement to request the element factory of.
- *
- * Retrieves the factory that was used to create this element.
- *
- * Returns: the #GstElementFactory used for creating this element.
- */
-GstElementFactory*
-gst_element_get_factory (GstElement *element)
-{
-  g_return_val_if_fail (GST_IS_ELEMENT (element), NULL);
-
-  return GST_ELEMENT_GET_CLASS (element)->elementfactory;
-}
-
 static void
 gst_element_dispose (GObject *object)
 {
@@ -2617,13 +2631,6 @@ gst_element_save_thyself (GstObject *object,
 
   xmlNewChild(parent, NULL, "name", GST_ELEMENT_NAME(element));
 
-  if (oclass->elementfactory != NULL) {
-    GstElementFactory *factory = (GstElementFactory *)oclass->elementfactory;
-
-    xmlNewChild (parent, NULL, "type", GST_OBJECT_NAME (factory));
-    xmlNewChild (parent, NULL, "version", factory->details->version);
-  }
-
 /* FIXME: what is this? */  
 /*  if (element->manager) */
 /*    xmlNewChild(parent, NULL, "manager", GST_ELEMENT_NAME(element->manager)); */
index 352391f..83fc301 100644 (file)
 #include <gst/gstobject.h>
 #include <gst/gstpad.h>
 #include <gst/gstclock.h>
+#include <gst/gstplugin.h>
 #include <gst/gstpluginfeature.h>
 #include <gst/gstindex.h>
 
 G_BEGIN_DECLS
 
+typedef struct _GstElementDetails GstElementDetails;
+
+/* FIXME: need translatable stuff in here (how handle in registry)? */
+struct _GstElementDetails {
+  gchar *longname;              /* long, english name */
+  gchar *klass;                 /* type of element, as hierarchy */
+  gchar *description;           /* insights of one form or another */
+  gchar *author;                /* who wrote this thing? */
+
+  GST_STRUCT_PADDING
+};
+#define GST_ELEMENT_DETAILS(longname,klass,description,author)         \
+  { longname, klass, description, author, GST_STRUCT_PADDING_INIT }
+#define GST_IS_ELEMENT_DETAILS(details) (                                      \
+  (details) && ((details)->longname != NULL) && ((details)->klass != NULL)     \
+  && ((details)->description != NULL) && ((details)->author != NULL))
+
 #define GST_NUM_STATES 4
 
 /* NOTE: this probably should be done with an #ifdef to decide 
@@ -172,8 +190,8 @@ struct _GstElement {
 struct _GstElementClass {
   GstObjectClass       parent_class;
 
-  /* the elementfactory that created us */
-  GstElementFactory    *elementfactory;
+  /* the element details */
+  GstElementDetails    details;
   /* templates for our pads */
   GList                *padtemplates;
   gint                         numpadtemplates;
@@ -224,6 +242,8 @@ struct _GstElementClass {
 void                   gst_element_class_add_pad_template      (GstElementClass *klass, GstPadTemplate *templ);
 void                    gst_element_class_install_std_props    (GstElementClass *klass,
                                                                 const gchar      *first_name, ...);
+void                   gst_element_class_set_details           (GstElementClass *klass,
+                                                                GstElementDetails *details);
 
 #define                gst_element_default_deep_notify         gst_object_default_deep_notify
 
@@ -349,19 +369,6 @@ GstBin*                    gst_element_get_managing_bin    (GstElement *element);
  * factories stuff
  *
  **/
-typedef struct _GstElementDetails GstElementDetails;
-
-struct _GstElementDetails {
-  gchar *longname;              /* long, english name */
-  gchar *klass;                 /* type of element, as hierarchy */
-  gchar *license;               /* license element is under */
-  gchar *description;           /* insights of one form or another */
-  gchar *version;               /* version of the element */
-  gchar *author;                /* who wrote this thing? */
-  gchar *copyright;             /* copyright details (year, etc.) */
-
-  GST_STRUCT_PADDING
-};
 
 #define GST_TYPE_ELEMENT_FACTORY               (gst_element_factory_get_type())
 #define GST_ELEMENT_FACTORY(obj)               (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_ELEMENT_FACTORY,\
@@ -371,22 +378,15 @@ struct _GstElementDetails {
 #define GST_IS_ELEMENT_FACTORY(obj)            (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_ELEMENT_FACTORY))
 #define GST_IS_ELEMENT_FACTORY_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_ELEMENT_FACTORY))
 
-#define GST_ELEMENT_RANK_PRIMARY    256
-#define GST_ELEMENT_RANK_SECONDARY  128
-#define GST_ELEMENT_RANK_MARGINAL   64
-#define GST_ELEMENT_RANK_NONE       0
-
 struct _GstElementFactory {
-  GstPluginFeature feature;
+  GstPluginFeature     parent;
 
-  GType type;                  /* unique GType of element */
+  GType                        type;                   /* unique GType of element or 0 if not loaded */
 
-  guint details_dynamic : 1;
+  GstElementDetails    details;
 
-  GstElementDetails *details;  /* pointer to details struct */
-
-  GList *padtemplates;
-  guint16 numpadtemplates;
+  GList *              padtemplates;
+  guint                        numpadtemplates;
 
   GST_OBJECT_PADDING
 };
@@ -399,25 +399,33 @@ struct _GstElementFactoryClass {
 
 GType                  gst_element_factory_get_type            (void);
 
-GstElementFactory*     gst_element_factory_new                 (const gchar *name, GType type,
-                                                                 GstElementDetails *details);
+gboolean               gst_element_register                    (GstPlugin *plugin,
+                                                                const gchar *elementname,
+                                                                guint rank,
+                                                                GType type);
+
 GstElementFactory*     gst_element_factory_find                (const gchar *name);
+GType                  gst_element_factory_get_element_type    (GstElementFactory *factory);
+G_CONST_RETURN gchar * gst_element_factory_get_longname        (GstElementFactory *factory);
+G_CONST_RETURN gchar * gst_element_factory_get_klass           (GstElementFactory *factory);
+G_CONST_RETURN gchar * gst_element_factory_get_description     (GstElementFactory *factory);
+G_CONST_RETURN gchar * gst_element_factory_get_version         (GstElementFactory *factory);
+G_CONST_RETURN gchar * gst_element_factory_get_author          (GstElementFactory *factory);
+guint                  gst_element_factory_get_num_padtemplates (GstElementFactory *factory);
+G_CONST_RETURN GList * gst_element_factory_get_padtemplates    (GstElementFactory *factory);
 
-void                   gst_element_factory_add_pad_template    (GstElementFactory *elementfactory,
-                                                                GstPadTemplate *templ);
+GstElement*            gst_element_factory_create              (GstElementFactory *factory,
+                                                                const gchar *name);
+GstElement*            gst_element_factory_make                (const gchar *factoryname, const gchar *name);
 
 gboolean               gst_element_factory_can_src_caps        (GstElementFactory *factory,
                                                                 GstCaps *caps);
 gboolean               gst_element_factory_can_sink_caps       (GstElementFactory *factory,
                                                                 GstCaps *caps);
 
-GstElement*            gst_element_factory_create              (GstElementFactory *factory,
-                                                                const gchar *name);
-GstElement*            gst_element_factory_make                (const gchar *factoryname, const gchar *name);
-GstElement*            gst_element_factory_make_or_warn        (const gchar *factoryname, const gchar *name);
+void                   __gst_element_factory_add_pad_template  (GstElementFactory *elementfactory,
+                                                                GstPadTemplate *templ);
 
-#define                        gst_element_factory_set_rank(factory, rank) \
-                               gst_plugin_feature_set_rank (GST_PLUGIN_FEATURE (factory), rank)
 
 G_END_DECLS
 
index c222888..d3ba21f 100644 (file)
@@ -1,6 +1,7 @@
 /* GStreamer
  * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
  *                    2000 Wim Taymans <wtay@chello.be>
+ *                    2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
  *
  * gstelementfactory.c: GstElementFactory object, support routines
  *
@@ -26,7 +27,8 @@
 #include "gstregistrypool.h"
 #include "gstinfo.h"
 
-#define GST_CAT_DEFAULT GST_CAT_ELEMENT_FACTORY
+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);
@@ -56,10 +58,12 @@ gst_element_factory_get_type (void)
     };
     elementfactory_type = g_type_register_static (GST_TYPE_PLUGIN_FEATURE, 
                                                  "GstElementFactory", &elementfactory_info, 0);
+    GST_DEBUG_CATEGORY_INIT (element_factory_debug, "GST_ELEMENT_FACTORY", 
+           GST_DEBUG_BOLD | GST_DEBUG_FG_WHITE | GST_DEBUG_BG_RED,
+           "element factories keep information about installed elements");
   }
   return elementfactory_type;
 }
-
 static void
 gst_element_factory_class_init (GstElementFactoryClass *klass)
 {
@@ -71,19 +75,16 @@ gst_element_factory_class_init (GstElementFactoryClass *klass)
   gstobject_class = (GstObjectClass*)klass;
   gstpluginfeature_class = (GstPluginFeatureClass*) klass;
 
-  parent_class = g_type_class_ref (GST_TYPE_PLUGIN_FEATURE);
+  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)
 {
   factory->padtemplates = NULL;
   factory->numpadtemplates = 0;
 }
-
 /**
  * gst_element_factory_find:
  * @name: name of factory to find
@@ -107,96 +108,93 @@ gst_element_factory_find (const gchar *name)
   GST_DEBUG ("no such elementfactory \"%s\"", name);
   return NULL;
 }
-
-static void
-gst_element_details_free (GstElementDetails *dp)
+void
+__gst_element_details_clear (GstElementDetails *dp)
 {
   g_free (dp->longname);
+  dp->longname = NULL;
   g_free (dp->klass);
-  g_free (dp->license);
+  dp->klass = NULL;
   g_free (dp->description);
-  g_free (dp->version);
+  dp->description = NULL;
   g_free (dp->author);
-  g_free (dp->copyright);
-  g_free (dp);
+  dp->author = NULL;
+}
+void
+__gst_element_details_set (GstElementDetails *dest, const GstElementDetails *src)
+{
+  dest->longname = g_strdup (src->longname);
+  dest->klass = g_strdup (src->klass);
+  dest->description = g_strdup (src->description);
+  dest->author = g_strdup (src->author);
+}
+void
+__gst_element_details_copy (GstElementDetails *dest, const GstElementDetails *src)
+{
+  __gst_element_details_clear (dest);
+  __gst_element_details_set (dest, src);
 }
-
 static void
 gst_element_factory_cleanup (GstElementFactory *factory)
 {
-  GList *padtemplates;
-
-  if (factory->details_dynamic) {
-    gst_element_details_free (factory->details);
-    factory->details_dynamic = FALSE;
+  __gst_element_details_clear (&factory->details);
+  if (factory->type) {
+    g_type_class_unref (g_type_class_peek (factory->type));
+    factory->type = 0;
   }
 
-  padtemplates = factory->padtemplates;
-
-  while (padtemplates) {
-    GstPadTemplate *oldtempl = GST_PAD_TEMPLATE (padtemplates->data);
-     
-    gst_object_unref (GST_OBJECT (oldtempl));
-
-    padtemplates = g_list_next (padtemplates);
-  }
+  g_list_foreach (factory->padtemplates, (GFunc) g_object_unref, NULL);
   g_list_free (factory->padtemplates);
-
   factory->padtemplates = NULL;
   factory->numpadtemplates = 0;
-
-  g_free (GST_PLUGIN_FEATURE (factory)->name);
 }
-
 /**
- * gst_element_factory_new:
- * @name: name of new elementfactory
- * @type: GType of new element
- * @details: #GstElementDetails structure with element details
+ * gst_element_register:
+ * @plugin:
+ * @name: name of elements of this type
+ * @rank: rank of element (higher rank means more importance when autoplugging)
+ * @type: GType of element to register
  *
  * Create a new elementfactory capable of insantiating objects of the
  * given type.
  *
- * Returns: new elementfactory
+ * Returns: TRUE, if the registering succeeded, FALSE on error
  */
-GstElementFactory*
-gst_element_factory_new (const gchar *name, GType type,
-                        GstElementDetails *details)
+gboolean
+gst_element_register (GstPlugin *plugin, const gchar *name, guint rank, GType type)
 {
   GstElementFactory *factory;
+  GstElementClass *klass;
 
-  g_return_val_if_fail (name != NULL, NULL);
-  g_return_val_if_fail (type, NULL);
-  g_return_val_if_fail (details, NULL);
-  g_return_val_if_fail (details->longname, NULL);
-  g_return_val_if_fail (details->klass, NULL);
-  g_return_val_if_fail (details->license, NULL);
-  g_return_val_if_fail (details->description, NULL);
-  g_return_val_if_fail (details->version, NULL);
-  g_return_val_if_fail (details->author, NULL);
-  g_return_val_if_fail (details->copyright, NULL);
+  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)
+  if (!factory) {
+    klass = GST_ELEMENT_CLASS (g_type_class_ref (type));
     factory = GST_ELEMENT_FACTORY (g_object_new (GST_TYPE_ELEMENT_FACTORY, NULL));
-  else {
+    gst_plugin_feature_set_name (GST_PLUGIN_FEATURE (factory), name);
+    GST_LOG_OBJECT (factory, "Created new elementfactory for type %s", g_type_name (type));
+  } else {
+    g_return_val_if_fail (factory->type == 0, FALSE);
+    klass = GST_ELEMENT_CLASS (g_type_class_ref (type));
     gst_element_factory_cleanup (factory);
+    GST_LOG_OBJECT (factory, "Reuse existing elementfactory for type %s", g_type_name (type));
   }
 
-  factory->details = details;
-  factory->details_dynamic = FALSE;
+  factory->type = type;
+  __gst_element_details_copy (&factory->details, &klass->details);
+  factory->padtemplates = g_list_copy (klass->padtemplates);
+  g_list_foreach (factory->padtemplates, (GFunc) g_object_ref, NULL);
+  factory->numpadtemplates = klass->numpadtemplates;
 
-  if (!factory->type)
-    factory->type = type;
-  else if (factory->type != type)
-    g_critical ("`%s' requested type change (!)", name);
+  gst_plugin_feature_set_rank (GST_PLUGIN_FEATURE (factory), rank);
 
-  GST_PLUGIN_FEATURE (factory)->name = g_strdup (name);
+  gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
 
-  return factory;
+  return TRUE;
 }
-
 /**
  * gst_element_factory_create:
  * @factory: factory to instantiate
@@ -206,14 +204,13 @@ gst_element_factory_new (const gchar *name, GType type,
  * It will be given the name supplied, since all elements require a name as
  * their first argument.
  *
- * Returns: new #GstElement
+ * Returns: new #GstElement or NULL if the element couldn't be created
  */
 GstElement*
 gst_element_factory_create (GstElementFactory *factory,
                            const gchar *name)
 {
   GstElement *element;
-  GstElementClass *oclass;
 
   g_return_val_if_fail (factory != NULL, NULL);
 
@@ -222,8 +219,8 @@ gst_element_factory_create (GstElementFactory *factory,
     return NULL;
   }
 
-  GST_LOG ("creating element from factory \"%s\" (name \"%s\", type %d)", 
-           GST_PLUGIN_FEATURE_NAME (factory), GST_STR_NULL (name), (gint) factory->type);
+  GST_LOG_OBJECT (factory, "creating element (name \"%s\", type %d)", 
+           GST_STR_NULL (name), (gint) factory->type);
 
   if (factory->type == 0) {
       g_critical ("Factory for `%s' has no type",
@@ -231,30 +228,14 @@ gst_element_factory_create (GstElementFactory *factory,
       return NULL;
   }
 
-  /* attempt to set the elementfactory class pointer if necessary */
-  oclass = GST_ELEMENT_CLASS (g_type_class_ref (factory->type));
-  if (oclass->elementfactory == NULL) {
-    GST_DEBUG ("class %s", GST_PLUGIN_FEATURE_NAME (factory));
-    oclass->elementfactory = factory;
-
-    /* copy pad template pointers to the element class, 
-     * allow for custom padtemplates */
-    oclass->padtemplates = g_list_concat (oclass->padtemplates, 
-                                          g_list_copy (factory->padtemplates));
-    oclass->numpadtemplates += factory->numpadtemplates;
-  }
-
   /* create an instance of the element */
   element = GST_ELEMENT (g_object_new (factory->type, NULL));
   g_assert (element != NULL);
 
-  g_type_class_unref (oclass);
-
   gst_object_set_name (GST_OBJECT (element), name);
 
   return element;
 }
-
 /**
  * gst_element_factory_make:
  * @factoryname: a named factory to instantiate
@@ -265,7 +246,7 @@ gst_element_factory_create (GstElementFactory *factory,
  * consisting of the element factory name and a number.
  * If name is given, it will be given the name supplied.
  *
- * Returns: new #GstElement (or NULL if unable to create element)
+ * Returns: new #GstElement or NULL if unable to create element
  */
 GstElement*
 gst_element_factory_make (const gchar *factoryname, const gchar *name)
@@ -287,59 +268,130 @@ gst_element_factory_make (const gchar *factoryname, const gchar *name)
   }
   element = gst_element_factory_create (factory, name);
   if (element == NULL) {
-    GST_INFO ("couldn't create instance of element factory \"%s\"!",
-             factoryname);
+    GST_INFO_OBJECT (factory, "couldn't create instance!");
     return NULL;
   }
 
   return element;
 }
+void
+__gst_element_factory_add_pad_template (GstElementFactory *factory,
+                                       GstPadTemplate *templ)
+{
+  g_return_if_fail (factory != NULL);
+  g_return_if_fail (templ != NULL);
+
+  gst_object_ref (GST_OBJECT (templ));
+  gst_object_sink (GST_OBJECT (templ));
 
+  factory->padtemplates = g_list_append (factory->padtemplates, templ);
+  factory->numpadtemplates++;
+}
 /**
- * gst_element_factory_make_or_warn:
- * @factoryname: a named factory to instantiate
- * @name: name of new element
+ * gst_element_factory_get_element_type:
+ * @factory: factory to get managed #GType from
+ * 
+ * Get the #GType for elements managed by this factory
  *
- * Create a new element of the type defined by the given element factory
- * using #gst_element_factory_make.
- * Will use g_warning if the element could not be created.
+ * Returns: the #GType for elements managed by this factory
+ */
+GType
+gst_element_factory_get_element_type (GstElementFactory *factory)
+{
+  g_return_val_if_fail (GST_IS_ELEMENT_FACTORY (factory), 0);
+
+  return factory->type;
+}
+/**
+ * gst_element_factory_get_longname:
+ * @factory: a #GstElementFactory
+ * 
+ * Gets the longname for this factory
  *
- * Returns: new #GstElement (or NULL if unable to create element)
+ * Returns: the longname
  */
-GstElement*
-gst_element_factory_make_or_warn (const gchar *factoryname, const gchar *name)
+G_CONST_RETURN gchar *
+gst_element_factory_get_longname (GstElementFactory *factory)
 {
-  GstElement *element;
-  
-  element = gst_element_factory_make (factoryname, name);
+  g_return_val_if_fail (GST_IS_ELEMENT_FACTORY (factory), NULL);
 
-  if (element == NULL) 
-    g_warning ("Could not create element from factory %s !\n", factoryname);
+  return factory->details.longname;
+}
+/**
+ * gst_element_factory_get_class:
+ * @factory: a #GstElementFactory
+ * 
+ * Gets the class for this factory.
+ *
+ * Returns: the class
+ */
+G_CONST_RETURN gchar *
+gst_element_factory_get_class (GstElementFactory *factory)
+{
+  g_return_val_if_fail (GST_IS_ELEMENT_FACTORY (factory), NULL);
 
-  return element;
+  return factory->details.klass;
 }
-    
 /**
- * gst_element_factory_add_pad_template :
- * @elementfactory: factory to add the src id to
- * @templ: the padtemplate to add
+ * gst_element_factory_get_description:
+ * @factory: a #GstElementFactory
+ * 
+ * Gets the description for this factory.
  *
- * Add the given padtemplate to this elementfactory.
+ * Returns: the description
  */
-void
-gst_element_factory_add_pad_template (GstElementFactory *factory,
-                                     GstPadTemplate *templ)
+G_CONST_RETURN gchar *
+gst_element_factory_get_description (GstElementFactory *factory)
 {
-  g_return_if_fail (factory != NULL);
-  g_return_if_fail (templ != NULL);
+  g_return_val_if_fail (GST_IS_ELEMENT_FACTORY (factory), NULL);
 
-  gst_object_ref (GST_OBJECT (templ));
-  gst_object_sink (GST_OBJECT (templ));
+  return factory->details.description;
+}
+/**
+ * gst_element_factory_get_author:
+ * @factory: a #GstElementFactory
+ * 
+ * Gets the author for this factory.
+ *
+ * Returns: the author
+ */
+G_CONST_RETURN gchar *
+gst_element_factory_get_author (GstElementFactory *factory)
+{
+  g_return_val_if_fail (GST_IS_ELEMENT_FACTORY (factory), NULL);
 
-  factory->padtemplates = g_list_append (factory->padtemplates, templ);
-  factory->numpadtemplates++;
+  return factory->details.author;
+}
+/**
+ * gst_element_factory_get_num_padtemplates:
+ * @factory: a #GstElementFactory
+ * 
+ * Gets the number of padtemplates in this factory.
+ *
+ * Returns: the number of padtemplates
+ */
+guint
+gst_element_factory_get_num_padtemplates (GstElementFactory *factory)
+{
+  g_return_val_if_fail (GST_IS_ELEMENT_FACTORY (factory), 0);
+
+  return factory->numpadtemplates;
 }
+/**
+ * gst_element_factory_get_padtemplates:
+ * @factory: a #GstElementFactory
+ * 
+ * Gets the #Glist of padtemplates for this factory.
+ *
+ * Returns: the padtemplates
+ */
+G_CONST_RETURN GList *
+gst_element_factory_get_padtemplates (GstElementFactory *factory)
+{
+  g_return_val_if_fail (GST_IS_ELEMENT_FACTORY (factory), NULL);
 
+  return factory->padtemplates;
+}
 /**
  * gst_element_factory_can_src_caps :
  * @factory: factory to query
@@ -372,7 +424,6 @@ gst_element_factory_can_src_caps (GstElementFactory *factory,
 
   return FALSE;
 }
-
 /**
  * gst_element_factory_can_sink_caps :
  * @factory: factory to query
@@ -405,7 +456,6 @@ gst_element_factory_can_sink_caps (GstElementFactory *factory,
 
   return FALSE;
 }
-
 static void
 gst_element_factory_unload_thyself (GstPluginFeature *feature)
 {
@@ -413,5 +463,8 @@ gst_element_factory_unload_thyself (GstPluginFeature *feature)
 
   factory = GST_ELEMENT_FACTORY (feature);
 
-  factory->type = 0;
+  if (factory->type) {
+    g_type_class_unref (g_type_class_peek (factory->type));
+    factory->type = 0;
+  }
 }
index 75a59c4..843a31f 100644 (file)
@@ -112,7 +112,6 @@ GstDebugCategory *GST_CAT_BUFFER = NULL;
 GstDebugCategory *GST_CAT_CAPS = NULL;
 GstDebugCategory *GST_CAT_CLOCK = NULL;
 GstDebugCategory *GST_CAT_ELEMENT_PADS = NULL;
-GstDebugCategory *GST_CAT_ELEMENT_FACTORY = NULL;
 GstDebugCategory *GST_CAT_PADS = NULL;
 GstDebugCategory *GST_CAT_PIPELINE = NULL;
 GstDebugCategory *GST_CAT_PLUGIN_LOADING = NULL;
@@ -192,9 +191,6 @@ void _gst_debug_init (void)
   GST_CAT_ELEMENT_PADS = _gst_debug_category_new ("GST_ELEMENT_PADS",
                                GST_DEBUG_BOLD | GST_DEBUG_FG_WHITE | GST_DEBUG_BG_RED,
                                NULL);
-  GST_CAT_ELEMENT_FACTORY = _gst_debug_category_new ("GST_ELEMENT_FACTORY",
-                               GST_DEBUG_BOLD | GST_DEBUG_FG_WHITE | GST_DEBUG_BG_RED,
-                               NULL);
   GST_CAT_PADS         = _gst_debug_category_new ("GST_PADS",
                                GST_DEBUG_BOLD | GST_DEBUG_FG_WHITE | GST_DEBUG_BG_RED,
                                NULL);
index 0398a24..7338039 100644 (file)
 #include "gstinfo.h"
 #include "gstscheduler.h"
 
-GstElementDetails gst_pipeline_details = {
+static GstElementDetails gst_pipeline_details = GST_ELEMENT_DETAILS (
   "Pipeline object",
   "Generic/Bin",
-  "LGPL",
   "Complete pipeline object",
-  VERSION,
-  "Erik Walthinsen <omega@cse.ogi.edu>",
-  "(C) 1999",
-};
+  "Erik Walthinsen <omega@cse.ogi.edu>"
+);
 
 /* Pipeline signals and args */
 enum {
@@ -48,12 +45,15 @@ enum {
 };
 
 
-static void                    gst_pipeline_class_init         (GstPipelineClass *klass);
-static void                    gst_pipeline_init               (GstPipeline *pipeline);
+static void                    gst_pipeline_base_init          (gpointer       g_class);
+static void                    gst_pipeline_class_init         (gpointer       g_class, 
+                                                                gpointer       class_data);
+static void                    gst_pipeline_init               (GTypeInstance *instance, 
+                                                                gpointer       g_class);
 
-static void                     gst_pipeline_dispose           (GObject *object);
+static void                     gst_pipeline_dispose           (GObject *      object);
 
-static GstElementStateReturn   gst_pipeline_change_state       (GstElement *element);
+static GstElementStateReturn   gst_pipeline_change_state       (GstElement *   element);
 
 static GstBinClass *parent_class = NULL;
 /* static guint gst_pipeline_signals[LAST_SIGNAL] = { 0 }; */
@@ -65,14 +65,14 @@ gst_pipeline_get_type (void) {
   if (!pipeline_type) {
     static const GTypeInfo pipeline_info = {
       sizeof(GstPipelineClass),
-      NULL,
+      gst_pipeline_base_init,
       NULL,
       (GClassInitFunc)gst_pipeline_class_init,
       NULL,
       NULL,
       sizeof(GstPipeline),
       0,
-      (GInstanceInitFunc)gst_pipeline_init,
+      gst_pipeline_init,
       NULL
     };
     pipeline_type = g_type_register_static (GST_TYPE_BIN, "GstPipeline", &pipeline_info, 0);
@@ -81,15 +81,21 @@ gst_pipeline_get_type (void) {
 }
 
 static void
-gst_pipeline_class_init (GstPipelineClass *klass)
+gst_pipeline_base_init (gpointer g_class)
 {
-  GObjectClass *gobject_class;
   GstElementClass *gstelement_class;
+  
+  gst_element_class_set_details (gstelement_class, &gst_pipeline_details);
+}
 
-  gobject_class = (GObjectClass *)klass;
-  gstelement_class = (GstElementClass*)klass;
+static void
+gst_pipeline_class_init (gpointer g_class, gpointer class_data)
+{
+  GObjectClass *gobject_class = G_OBJECT_CLASS (g_class);
+  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+  GstPipelineClass *klass = GST_PIPELINE_CLASS (g_class);
 
-  parent_class = g_type_class_ref (gst_bin_get_type ());
+  parent_class = g_type_class_peek_parent (klass);
 
   gobject_class->dispose               = GST_DEBUG_FUNCPTR (gst_pipeline_dispose);
 
@@ -97,10 +103,11 @@ gst_pipeline_class_init (GstPipelineClass *klass)
 }
 
 static void
-gst_pipeline_init (GstPipeline *pipeline)
+gst_pipeline_init (GTypeInstance *instance, gpointer g_class)
 {
   GstScheduler *scheduler;
-
+  GstPipeline *pipeline = GST_PIPELINE (instance);
+  
   /* pipelines are managing bins */
   GST_FLAG_SET (pipeline, GST_BIN_FLAG_MANAGER);
 
index 99a4564..b634195 100644 (file)
@@ -28,8 +28,6 @@
 
 G_BEGIN_DECLS
 
-extern GstElementDetails gst_pipeline_details;
-
 #define GST_TYPE_PIPELINE              (gst_pipeline_get_type ())
 #define GST_PIPELINE(obj)              (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PIPELINE, GstPipeline))
 #define GST_IS_PIPELINE(obj)           (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PIPELINE))
index e02a094..9e77f53 100644 (file)
 #include "config.h"
 #include "gstfilter.h"
 
+#define GST_CAT_DEFAULT GST_CAT_PLUGIN_LOADING
+
 static GModule *main_module = NULL;
 static GList *_gst_plugin_static = NULL;
 
-static GstPlugin*      gst_plugin_register_func        (GstPluginDesc *desc, GstPlugin *plugin, 
-                                                        GModule *module);
+/* list of valid licenses.
+ * One of these must be specified or the plugin won't be loaded 
+ * Contact gstreamer-devel@lists.sourceforge.net if your license should be 
+ * added. */
+static gchar *valid_licenses[] = {
+  "LGPL",                      /* GNU Lesser General Public License */
+  "GPL",                       /* GNU General Public License */
+  GST_LICENSE_UNKNOWN,         /* some other license */
+  NULL
+};
+
+static void            gst_plugin_desc_copy            (GstPluginDesc *dest, 
+                                                        const GstPluginDesc *src);
+
+static GstPlugin *     gst_plugin_register_func        (GstPlugin *plugin, 
+                                                        GModule *module,
+                                                        GstPluginDesc *desc);
 GQuark 
 gst_plugin_error_quark (void)
 {
@@ -58,18 +75,16 @@ void
 _gst_plugin_register_static (GstPluginDesc *desc)
 {
   if (main_module == NULL) {
+    GST_LOG ("queueing static plugin \"%s\" for loading later on", desc->name);
     _gst_plugin_static = g_list_prepend (_gst_plugin_static, desc);
   }
   else {
     GstPlugin *plugin;
 
+    GST_LOG ("attempting to load static plugin \"%s\" now...", desc->name);
     plugin = g_new0 (GstPlugin, 1);
-    plugin->filename = NULL;
-    plugin->module = NULL;
-    plugin = gst_plugin_register_func (desc, plugin, main_module);
-
-    if (plugin) {
-      plugin->module = main_module;
+    if (gst_plugin_register_func (plugin, main_module, desc)) {
+      GST_INFO ("loaded static plugin \"%s\"", desc->name);
       gst_registry_pool_add_plugin (plugin);
     }
   }
@@ -84,6 +99,25 @@ _gst_plugin_initialize (void)
   g_list_foreach (_gst_plugin_static, (GFunc) _gst_plugin_register_static, NULL);
 }
 
+/* this function could be extended to check if the plugin license matches the 
+ * applications license (would require the app to register its license somehow).
+ * We'll wait for someone who's interested in it to code it :)
+ */
+static gboolean
+gst_plugin_check_license (const gchar *license)
+{
+  gchar **check_license = valid_licenses;
+
+  g_assert (check_license);
+  
+  while (*check_license) {
+    if (strcmp (license, *check_license) == 0)
+      return TRUE;
+    check_license++;
+  }
+  return FALSE;
+}
+
 static gboolean
 gst_plugin_check_version (gint major, gint minor)
 {
@@ -96,67 +130,61 @@ gst_plugin_check_version (gint major, gint minor)
 }
 
 static GstPlugin*
-gst_plugin_register_func (GstPluginDesc *desc, GstPlugin *plugin, GModule *module)
+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)) {
-    GST_CAT_INFO (GST_CAT_PLUGIN_LOADING,"plugin \"%s\" has incompatible version, not loading",
+    GST_INFO ("plugin \"%s\" has incompatible version, not loading",
        plugin->filename);
-    return NULL;
+    return FALSE;
   }
 
-  g_free (plugin->name);
-  plugin->name = g_strdup(desc->name);
-
-  if (!((desc->plugin_init) (module, plugin))) {
-    GST_CAT_INFO (GST_CAT_PLUGIN_LOADING,"plugin \"%s\" failed to initialise",
+  if (!desc->license || !desc->description || !desc->package ||
+      !desc->copyright || !desc->origin) {
+    GST_INFO ("plugin \"%s\" has incorrect GstPluginDesc, not loading",
        plugin->filename);
-    return NULL;
+    return FALSE;
   }
-  GST_CAT_INFO (GST_CAT_PLUGIN_LOADING,"plugin \"%s\" initialised", GST_STR_NULL (plugin->filename));
-
-  return plugin;
-}
+      
+  if (!gst_plugin_check_license (desc->license)) {
+    GST_INFO ("plugin \"%s\" has invalid license \"%s\", not loading",
+       plugin->filename, desc->license);
+    return FALSE;
+  }
+  
+  gst_plugin_desc_copy (&plugin->desc, desc);
+  plugin->module = module;
 
-/**
- * gst_plugin_new:
- * @filename: The filename of the plugin
- *
- * Creates a plugin from the given filename
- *
- * Returns: A new GstPlugin object
- */
-GstPlugin*
-gst_plugin_new (const gchar *filename)
-{
-  GstPlugin *plugin = g_new0 (GstPlugin, 1);
-  plugin->filename = g_strdup (filename);
+  if (!((desc->plugin_init) (plugin))) {
+    GST_INFO ("plugin \"%s\" failed to initialise", plugin->filename);
+    plugin->module = NULL;
+    return FALSE;
+  }
+  
+  GST_DEBUG ("plugin \"%s\" initialised", GST_STR_NULL (plugin->filename));
 
   return plugin;
 }
 
 /**
- * gst_plugin_load_plugin:
+ * gst_plugin_load_file:
  * @plugin: The plugin to load
  * @error: Pointer to a NULL-valued GError.
  *
  * Load the given plugin.
  *
- * Returns: whether or not the plugin loaded. Sets @error as appropriate.
+ * Returns: a new GstPlugin or NULL, if an error occured
  */
-gboolean
-gst_plugin_load_plugin (GstPlugin *plugin, GError **error)
+GstPlugin *
+gst_plugin_load_file (const gchar *filename, GError **error)
 {
+  GstPlugin *plugin;
   GModule *module;
   GstPluginDesc *desc;
   struct stat file_status;
-  gchar *filename;
 
-  g_return_val_if_fail (plugin != NULL, FALSE);
-
-  if (plugin->module) 
-    return TRUE;
-
-  filename = plugin->filename;
+  g_return_val_if_fail (filename != NULL, NULL);
 
   GST_CAT_DEBUG (GST_CAT_PLUGIN_LOADING, "attempt to load plugin \"%s\"", filename);
 
@@ -165,7 +193,7 @@ gst_plugin_load_plugin (GstPlugin *plugin, GError **error)
                  GST_PLUGIN_ERROR,
                  GST_PLUGIN_ERROR_MODULE,
                  "Dynamic loading not supported");
-    return FALSE;
+    return NULL;
   }
 
   if (stat (filename, &file_status)) {
@@ -173,7 +201,7 @@ gst_plugin_load_plugin (GstPlugin *plugin, GError **error)
                  GST_PLUGIN_ERROR,
                  GST_PLUGIN_ERROR_MODULE,
                  "Problem opening file %s (plugin %s)\n",
-                 filename, plugin->name); 
+                 filename, plugin->desc.name); 
     return FALSE;
   }
 
@@ -182,49 +210,105 @@ gst_plugin_load_plugin (GstPlugin *plugin, GError **error)
   if (module != NULL) {
     gpointer ptr;
 
-    if (g_module_symbol (module, "plugin_desc", &ptr)) {
-      desc = (GstPluginDesc *)ptr;
-
-      GST_CAT_DEBUG (GST_CAT_PLUGIN_LOADING, "plugin \"%s\" loaded, called entry function...", filename);
-
-      plugin->filename = g_strdup (filename);
-      plugin = gst_plugin_register_func (desc, plugin, module);
-
-      if (plugin != NULL) {
-        GST_CAT_INFO (GST_CAT_PLUGIN_LOADING, "plugin \"%s\" loaded", plugin->filename);
-        plugin->module = module;
-        return TRUE;
+    if (g_module_symbol (module, "gst_plugin_desc", &ptr)) {
+      desc = (GstPluginDesc *) ptr;
+
+      plugin = gst_registry_pool_find_plugin (desc->name);
+      if (!plugin) {
+       plugin = g_new0 (GstPlugin, 1);
+       plugin->filename = g_strdup (filename);
+       GST_DEBUG ("created new GstPlugin %p for file \"%s\"", plugin, filename);
+      } else {
+       if (gst_plugin_is_loaded (plugin)) {
+         if (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,
+                        "already a plugin with name \"%s\" loaded",
+                        desc->name);
+           return NULL;
+         }
+         GST_LOG ("Plugin %p for file \"%s\" already loaded, returning it now", plugin, filename);
+         return plugin;
+       }
       }
-      else {
+      GST_LOG ("Plugin %p for file \"%s\" prepared, called entry function...", plugin, filename);
+
+      if (gst_plugin_register_func (plugin, module, desc)) {
+        GST_INFO ("plugin \"%s\" loaded", plugin->filename);
+        return plugin;
+      } else {
+        GST_DEBUG ("gst_plugin_register_func failed for plugin \"%s\"", filename);
        /* plugin == NULL */
         g_set_error (error,
                      GST_PLUGIN_ERROR,
                      GST_PLUGIN_ERROR_MODULE,
                      "gst_plugin_register_func failed for plugin \"%s\"",
                      filename);
-        return FALSE;
+       g_free (plugin);
+        return NULL;
       }
-    }
-    else {
+    } else {
+      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_desc in \"%s\"",
+                   "Could not find plugin entry point in \"%s\"",
                    filename);
     }
-    return FALSE;
-  } 
-  else {
+    return NULL;
+  } else {
+    GST_DEBUG ("Error loading plugin %s, reason: %s\n", filename, g_module_error());
     g_set_error (error,
                  GST_PLUGIN_ERROR,
                  GST_PLUGIN_ERROR_MODULE,
                  "Error loading plugin %s, reason: %s\n",
                  filename, g_module_error());
-    return FALSE;
+    return NULL;
   }
 }
 
-
+static void
+gst_plugin_desc_copy (GstPluginDesc *dest, const GstPluginDesc *src)
+{
+  dest->major_version = src->major_version;
+  dest->minor_version = src->minor_version;
+  g_free (dest->name);
+  dest->name = g_strdup (src->name);
+  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);
+  dest->license = g_strdup (src->license);
+  g_free (dest->copyright);
+  dest->copyright = g_strdup (src->copyright);
+  g_free (dest->package);
+  dest->package = g_strdup (src->package);
+  g_free (dest->origin);
+  dest->origin = g_strdup (src->origin);
+}
+#if 0
+/* unused */
+static void
+gst_plugin_desc_free (GstPluginDesc *desc)
+{
+  g_free (desc->name);
+  g_free (desc->description);
+  g_free (desc->version);
+  g_free (desc->license);
+  g_free (desc->copyright);
+  g_free (desc->package);
+  g_free (desc->origin);
+
+  memset (desc, 0, sizeof (GstPluginDesc));
+}
+#endif
 /**
  * gst_plugin_unload_plugin:
  * @plugin: The plugin to unload
@@ -265,75 +349,117 @@ gst_plugin_get_name (GstPlugin *plugin)
 {
   g_return_val_if_fail (plugin != NULL, NULL);
 
-  return plugin->name;
+  return plugin->desc.name;
 }
 
 /**
- * gst_plugin_set_name:
- * @plugin: plugin to set name of
- * @name: new name
+ * gst_plugin_get_longname:
+ * @plugin: plugin to get long name of
  *
- * Sets the name (should be short) of the plugin.
+ * Get the long descriptive name of the plugin
+ *
+ * Returns: the long name of the plugin
  */
-void
-gst_plugin_set_name (GstPlugin *plugin, const gchar *name)
+G_CONST_RETURN gchar*
+gst_plugin_get_description (GstPlugin *plugin)
 {
-  g_return_if_fail (plugin != NULL);
-
-  g_free (plugin->name);
+  g_return_val_if_fail (plugin != NULL, NULL);
 
-  plugin->name = g_strdup (name);
+  return plugin->desc.description;
 }
 
 /**
- * gst_plugin_set_longname:
- * @plugin: plugin to set long name of
- * @longname: new long name
+ * gst_plugin_get_filename:
+ * @plugin: plugin to get the filename of
+ *
+ * get the filename of the plugin
  *
- * Sets the long name (should be descriptive) of the plugin.
+ * Returns: the filename of the plugin
  */
-void
-gst_plugin_set_longname (GstPlugin *plugin, const gchar *longname)
+G_CONST_RETURN gchar*
+gst_plugin_get_filename (GstPlugin *plugin)
 {
-  g_return_if_fail(plugin != NULL);
-
-  g_free(plugin->longname);
+  g_return_val_if_fail (plugin != NULL, NULL);
 
-  plugin->longname = g_strdup(longname);
+  return plugin->filename;
 }
+/**
+ * gst_plugin_get_license:
+ * @plugin: plugin to get the license of
+ *
+ * get the license of the plugin
+ *
+ * Returns: the license of the plugin
+ */
+G_CONST_RETURN gchar*
+gst_plugin_get_license (GstPlugin *plugin)
+{
+  g_return_val_if_fail (plugin != NULL, NULL);
 
+  return plugin->desc.license;
+}
 /**
- * gst_plugin_get_longname:
- * @plugin: plugin to get long name of
+ * gst_plugin_get_copyright:
+ * @plugin: plugin to get the copyright of
  *
- * Get the long descriptive name of the plugin
+ * get the informal copyright notice of the plugin
  *
- * Returns: the long name of the plugin
+ * Returns: the copyright of the plugin
  */
-const gchar*
-gst_plugin_get_longname (GstPlugin *plugin)
+G_CONST_RETURN gchar*
+gst_plugin_get_copyright (GstPlugin *plugin)
 {
   g_return_val_if_fail (plugin != NULL, NULL);
 
-  return plugin->longname;
+  return plugin->desc.copyright;
 }
+/**
+ * gst_plugin_get_package:
+ * @plugin: plugin to get the package of
+ *
+ * get the package the plugin belongs to.
+ *
+ * Returns: the package of the plugin
+ */
+G_CONST_RETURN gchar*
+gst_plugin_get_package (GstPlugin *plugin)
+{
+  g_return_val_if_fail (plugin != NULL, NULL);
 
+  return plugin->desc.package;
+}
 /**
- * gst_plugin_get_filename:
- * @plugin: plugin to get the filename of
+ * gst_plugin_get_origin:
+ * @plugin: plugin to get the origin of
  *
- * get the filename of the plugin
+ * get the URL where the plugin comes from
  *
- * Returns: the filename of the plugin
+ * Returns: the origin of the plugin
  */
-const gchar*
-gst_plugin_get_filename (GstPlugin *plugin)
+G_CONST_RETURN gchar*
+gst_plugin_get_origin (GstPlugin *plugin)
 {
   g_return_val_if_fail (plugin != NULL, NULL);
 
-  return plugin->filename;
+  return plugin->desc.origin;
 }
+/**
+ * gst_plugin_get_module:
+ * @plugin: plugin to query
+ *
+ * Gets the #GModule of the plugin. If the plugin isn't loaded yet, NULL is 
+ * returned.
+ *
+ * Returns: module belonging to the plugin or NULL if the plugin isn't 
+ *          loaded yet.
+ */
+GModule *
+gst_plugin_get_module (GstPlugin *plugin)
+{
+  g_return_val_if_fail (plugin != NULL, FALSE);
 
+  return plugin->module;
+}
 /**
  * gst_plugin_is_loaded:
  * @plugin: plugin to query
@@ -433,7 +559,7 @@ gst_plugin_list_feature_filter  (GList *list,
  * @plugin: the plugin to check
  * @name: the name of the plugin
  *
- * A standard filterthat returns TRUE when the plugin is of the
+ * A standard filter that returns TRUE when the plugin is of the
  * given name.
  *
  * Returns: TRUE if the plugin is of the given name.
@@ -441,7 +567,7 @@ gst_plugin_list_feature_filter  (GList *list,
 gboolean
 gst_plugin_name_filter (GstPlugin *plugin, const gchar *name)
 {
-  return (plugin->name && !strcmp (plugin->name, name));
+  return (plugin->desc.name && !strcmp (plugin->desc.name, name));
 }
 
 /**
@@ -536,18 +662,17 @@ gst_plugin_load (const gchar *name)
 
   plugin = gst_registry_pool_find_plugin (name);
   if (plugin) {
-    gboolean result = gst_plugin_load_plugin (plugin, &error);
+    gst_plugin_load_file (plugin->filename, &error);
     if (error) {
       GST_CAT_DEBUG (GST_CAT_PLUGIN_LOADING, "load_plugin error: %s\n",
                 error->message);
       g_error_free (error);
+      return FALSE;
     }
-    return result;
+    return TRUE;;
   }
 
-  GST_CAT_DEBUG (GST_CAT_PLUGIN_LOADING, "Could not find %s in registry pool",
-             name);
-
+  GST_DEBUG ("Could not find %s in registry pool", name);
   return FALSE;
 }
 
index 2bbe593..8b01d27 100644 (file)
@@ -38,7 +38,8 @@ GQuark gst_plugin_error_quark (void);
 typedef enum
 {
   GST_PLUGIN_ERROR_MODULE,
-  GST_PLUGIN_ERROR_DEPENDENCIES
+  GST_PLUGIN_ERROR_DEPENDENCIES,
+  GST_PLUGIN_ERROR_NAME_MISMATCH
 } GstPluginError;
 
 #define GST_PLUGIN(plugin)             ((GstPlugin *) (plugin))
@@ -46,58 +47,86 @@ typedef enum
 typedef struct _GstPlugin              GstPlugin;
 typedef struct _GstPluginDesc          GstPluginDesc;
 
-struct _GstPlugin {
-  gchar        *name;                  /* name of the plugin */
-  gchar        *longname;              /* long name of plugin */
-  gchar        *filename;              /* filename it came from */
-
-  GList        *features;              /* list of features provided */
-  gint                  numfeatures;
-
-  gpointer      manager;               /* managing registry */
-  GModule      *module;                /* contains the module if the plugin is loaded */
-  gboolean      init_called;           /* if the init function has been called */
+/* 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 */
+  gint minor_version;                  /* minor 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 exiting function */
+  gchar *version;                      /* version of the plugin */
+  gchar *license;                      /* effective license of plugin */
+  gchar *copyright;                    /* informal copyright notice */
+  gchar *package;                      /* package plugin belongs to */
+  gchar *origin;                       /* URL to provider of plugin */
+  
   GST_STRUCT_PADDING
 };
 
-/* Initialiser function: returns TRUE if plugin initialised successfully */
-typedef gboolean (*GstPluginInitFunc) (GModule *module, GstPlugin *plugin);
+struct _GstPlugin {
+  GstPluginDesc        desc;
 
-struct _GstPluginDesc {
-  gint major_version; /* major version of core that plugin was compiled for */
-  gint minor_version; /* minor version of core that plugin was compiled for */
-  gchar *name;        /* name of plugin */
-  GstPluginInitFunc plugin_init; /* pointer to plugin_init function */
+  gchar *      filename;
+  GList *      features;               /* list of features provided */
+  gint                 numfeatures;
+
+  gpointer     manager;                /* managing registry */
+  GModule *    module;                 /* contains the module if the plugin is loaded */
+
+  GST_STRUCT_PADDING
 };
 
 #ifndef GST_PLUGIN_STATIC                              
-#define GST_PLUGIN_DESC_DYNAMIC(major,minor,name,init) \
-GstPluginDesc plugin_desc = {                          \
+#define GST_PLUGIN_DEFINE_DYNAMIC(major,minor,name,description,init,version,license,copyright,package,origin)  \
+GstPluginDesc gst_plugin_desc = {                      \
   major,                                               \
   minor,                                               \
   name,                                                        \
-  init                                                 \
+  description,                                         \
+  init,                                                        \
+  NULL,                                                        \
+  version,                                             \
+  license,                                             \
+  copyright,                                           \
+  package,                                             \
+  origin,                                              \
+  GST_STRUCT_PADDING_INIT                              \
 };                                                     
+#define GST_PLUGIN_DEFINE_STATIC(major,minor,name,description,init,version,license,copyright,package,origin)
 #else
-#define GST_PLUGIN_DESC_DYNAMIC(major,minor,name,init)
-#endif
-#define GST_PLUGIN_DESC_STATIC(major,minor,name,init)  \
+#define GST_PLUGIN_DEFINE_DYNAMIC(major,minor,name,description,init,version,license,copyright,package,origin)
+#define GST_PLUGIN_DEFINE_STATIC(major,minor,name,description,init,version,license,copyright,package,origin)  \
 static void GST_GNUC_CONSTRUCTOR                       \
 _gst_plugin_static_init__ ##init (void)                        \
 {                                                      \
   static GstPluginDesc plugin_desc_ = {                        \
     major,                                             \
     minor,                                             \
-    name,                                              \
-    init                                               \
+    name,                                              \
+    description,                                       \
+    init,                                              \
+    NULL,                                              \
+    version,                                           \
+    license,                                           \
+    copyright,                                         \
+    package,                                           \
+    origin,                                            \
+    GST_STRUCT_PAD_ING_INIT                            \
   };                                                   \
   _gst_plugin_register_static (&plugin_desc_);         \
 }                      
+#endif
 
-#define GST_PLUGIN_DESC(major,minor,name,init)         \
-  GST_PLUGIN_DESC_DYNAMIC (major,minor,name,init)      \
-  GST_PLUGIN_DESC_STATIC (major,minor,name,init)       
+#define GST_PLUGIN_DEFINE(major,minor,name,description,init,version,license,copyright,package,origin)\
+  GST_PLUGIN_DEFINE_STATIC(major,minor,name,description,init,version,license,copyright,package,origin)\
+  GST_PLUGIN_DEFINE_DYNAMIC(major,minor,name,description,init,version,license,copyright,package,origin)
+  
+#define GST_LICENSE_UNKNOWN "unknown"
 
 /* function for filters */
 typedef gboolean        (*GstPluginFilter)              (GstPlugin *plugin,
@@ -106,13 +135,15 @@ typedef gboolean        (*GstPluginFilter)              (GstPlugin *plugin,
 void                   _gst_plugin_initialize          (void);
 void                   _gst_plugin_register_static     (GstPluginDesc *desc);
 
-GstPlugin*             gst_plugin_new                  (const gchar *filename);
-
-const gchar*           gst_plugin_get_name             (GstPlugin *plugin);
+G_CONST_RETURN gchar*  gst_plugin_get_name             (GstPlugin *plugin);
 void                   gst_plugin_set_name             (GstPlugin *plugin, const gchar *name);
-const gchar*           gst_plugin_get_longname         (GstPlugin *plugin);
-void                   gst_plugin_set_longname         (GstPlugin *plugin, const gchar *longname);
-const gchar*           gst_plugin_get_filename         (GstPlugin *plugin);
+G_CONST_RETURN gchar*  gst_plugin_get_longname         (GstPlugin *plugin);
+G_CONST_RETURN gchar*  gst_plugin_get_filename         (GstPlugin *plugin);
+G_CONST_RETURN gchar*  gst_plugin_get_license          (GstPlugin *plugin);
+G_CONST_RETURN gchar*  gst_plugin_get_copyright        (GstPlugin *plugin);
+G_CONST_RETURN gchar*  gst_plugin_get_package          (GstPlugin *plugin);
+G_CONST_RETURN gchar*  gst_plugin_get_origin           (GstPlugin *plugin);
+GModule *              gst_plugin_get_module           (GstPlugin *plugin);
 gboolean               gst_plugin_is_loaded            (GstPlugin *plugin);
 
 GList*                 gst_plugin_feature_filter       (GstPlugin *plugin, 
@@ -128,7 +159,7 @@ gboolean            gst_plugin_name_filter          (GstPlugin *plugin, const gchar *name);
 GList*                 gst_plugin_get_feature_list     (GstPlugin *plugin);
 GstPluginFeature*      gst_plugin_find_feature         (GstPlugin *plugin, const gchar *name, GType type);
 
-gboolean               gst_plugin_load_plugin          (GstPlugin *plugin, 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);
index 494075c..5c8afed 100644 (file)
@@ -98,7 +98,7 @@ gst_plugin_feature_ensure_loaded (GstPluginFeature *feature)
 #ifndef GST_DISABLE_REGISTRY 
     if (GST_IS_REGISTRY (plugin->manager)) {
       GST_CAT_DEBUG (GST_CAT_PLUGIN_LOADING, 
-                "loading plugin %s for feature", plugin->name);
+                "loading plugin %s for feature", plugin->desc.name);
 
       if (gst_registry_load_plugin (GST_REGISTRY (plugin->manager), plugin) != GST_REGISTRY_OK)
        return FALSE;
index c192424..5c22dc0 100644 (file)
 #include "gstevent.h"
 #include "gstinfo.h"
 
-GstElementDetails gst_queue_details = {
+static GstElementDetails gst_queue_details = GST_ELEMENT_DETAILS (
   "Queue",
   "Generic",
-  "LGPL",
   "Simple data queue",
-  VERSION,
-  "Erik Walthinsen <omega@cse.ogi.edu>",
-  "(C) 1999",
-};
+  "Erik Walthinsen <omega@cse.ogi.edu>"
+);
 
 
 /* Queue signals and args */
@@ -62,9 +59,11 @@ enum {
   ARG_BLOCK_TIMEOUT,
 };
 
-
-static void                    gst_queue_class_init            (GstQueueClass *klass);
-static void                    gst_queue_init                  (GstQueue *queue);
+static void                    gst_queue_base_init             (gpointer g_class);
+static void                    gst_queue_class_init            (gpointer g_class,
+                                                                gpointer class_data);
+static void                    gst_queue_init                  (GTypeInstance *instance,
+                                                                gpointer g_class);
 static void                    gst_queue_dispose               (GObject *object);
 
 static void                    gst_queue_set_property          (GObject *object, guint prop_id, 
@@ -112,14 +111,14 @@ gst_queue_get_type(void)
   if (!queue_type) {
     static const GTypeInfo queue_info = {
       sizeof(GstQueueClass),
+      gst_queue_base_init,
       NULL,
-      NULL,
-      (GClassInitFunc)gst_queue_class_init,
+      gst_queue_class_init,
       NULL,
       NULL,
       sizeof(GstQueue),
       4,
-      (GInstanceInitFunc)gst_queue_init,
+      gst_queue_init,
       NULL
     };
     queue_type = g_type_register_static (GST_TYPE_ELEMENT, "GstQueue", &queue_info, 0);
@@ -128,37 +127,43 @@ gst_queue_get_type(void)
 }
 
 static void
-gst_queue_class_init (GstQueueClass *klass)
+gst_queue_base_init (gpointer g_class)
 {
-  GObjectClass *gobject_class;
-  GstElementClass *gstelement_class;
+  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+
+  gst_element_class_set_details (gstelement_class, &gst_queue_details);
+}
 
-  gobject_class = (GObjectClass*)klass;
-  gstelement_class = (GstElementClass*)klass;
+static void
+gst_queue_class_init (gpointer g_class, gpointer class_data)
+{
+  GObjectClass *gobject_class = G_OBJECT_CLASS (g_class);
+  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+  GstQueueClass *gstqueue_class = GST_QUEUE_CLASS (g_class);
 
-  parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
+  parent_class = g_type_class_peek_parent (g_class);
 
   gst_queue_signals[FULL] =
-    g_signal_new ("full", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST,
+    g_signal_new ("full", G_TYPE_FROM_CLASS (gstqueue_class), G_SIGNAL_RUN_FIRST,
                   G_STRUCT_OFFSET (GstQueueClass, full), NULL, NULL,
                  g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
-  g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LEAKY,
+  g_object_class_install_property (G_OBJECT_CLASS (gstqueue_class), ARG_LEAKY,
     g_param_spec_enum ("leaky", "Leaky", "Where the queue leaks, if at all.",
                        GST_TYPE_QUEUE_LEAKY, GST_QUEUE_NO_LEAK, G_PARAM_READWRITE));
-  g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LEVEL,
+  g_object_class_install_property (G_OBJECT_CLASS (gstqueue_class), ARG_LEVEL,
     g_param_spec_int ("level", "Level", "How many buffers are in the queue.",
                       0, G_MAXINT, 0, G_PARAM_READABLE));
-  g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MAX_LEVEL,
+  g_object_class_install_property (G_OBJECT_CLASS (gstqueue_class), ARG_MAX_LEVEL,
     g_param_spec_int ("max_level", "Maximum Level", "How many buffers the queue holds.",
                       0, G_MAXINT, 100, G_PARAM_READWRITE));
-  g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MIN_THRESHOLD_BYTES,
+  g_object_class_install_property (G_OBJECT_CLASS (gstqueue_class), ARG_MIN_THRESHOLD_BYTES,
     g_param_spec_int ("min_threshold_bytes", "Minimum Threshold",
                       "Minimum bytes required before signalling not_empty to reader.",
                       0, G_MAXINT, 0, G_PARAM_READWRITE));
-  g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MAY_DEADLOCK,
+  g_object_class_install_property (G_OBJECT_CLASS (gstqueue_class), ARG_MAY_DEADLOCK,
     g_param_spec_boolean ("may_deadlock", "May Deadlock", "The queue may deadlock if it's full and not PLAYING",
                       TRUE, G_PARAM_READWRITE));
-  g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BLOCK_TIMEOUT,
+  g_object_class_install_property (G_OBJECT_CLASS (gstqueue_class), ARG_BLOCK_TIMEOUT,
     g_param_spec_int ("block_timeout", "Timeout for Block", 
                       "Microseconds until blocked queue times out and returns filler event. "
                       "Value of -1 disables timeout",
@@ -204,8 +209,10 @@ gst_queue_getcaps (GstPad *pad, GstCaps *caps)
 }
 
 static void
-gst_queue_init (GstQueue *queue)
+gst_queue_init (GTypeInstance *instance, gpointer g_class)
 {
+  GstQueue *queue = GST_QUEUE (instance);
+  
   /* scheduling on this kind of element is, well, interesting */
   GST_FLAG_SET (queue, GST_ELEMENT_DECOUPLED);
   GST_FLAG_SET (queue, GST_ELEMENT_EVENT_AWARE);
index e7ee592..c52d637 100644 (file)
@@ -30,9 +30,6 @@
 
 G_BEGIN_DECLS
 
-extern GstElementDetails gst_queue_details;
-
-
 #define GST_TYPE_QUEUE \
   (gst_queue_get_type())
 #define GST_QUEUE(obj) \
index b97a6bb..d51ba7a 100644 (file)
 #define GST_CAT_DEFAULT GST_CAT_THREAD
 #define STACK_SIZE 0x200000
 
-GstElementDetails gst_thread_details = {
+static GstElementDetails gst_thread_details = GST_ELEMENT_DETAILS (
   "Threaded container",
   "Generic/Bin",
-  "LGPL",
   "Container that creates/manages a thread",
-  VERSION,
   "Erik Walthinsen <omega@cse.ogi.edu>, "
-  "Benjamin Otte <in7y118@informatik.uni-hamburg.de",
-  "(C) 1999-2003",
-};
-
+  "Benjamin Otte <in7y118@informatik.uni-hamburg.de"
+);
 
 /* Thread signals and args */
 enum {
@@ -62,9 +58,9 @@ enum {
 };
 
 
-
-static void            gst_thread_class_init           (GstThreadClass *klass);
-static void            gst_thread_init                 (GstThread *thread);
+static void            gst_thread_base_init            (gpointer g_class);
+static void            gst_thread_class_init           (gpointer g_class, gpointer class_data);
+static void            gst_thread_init                 (GTypeInstance *instance, gpointer g_class);
 
 static void            gst_thread_dispose              (GObject *object);
 
@@ -117,11 +113,15 @@ gst_thread_get_type(void) {
 
   if (!thread_type) {
     static const GTypeInfo thread_info = {
-      sizeof (GstThreadClass), NULL, NULL,
-      (GClassInitFunc) gst_thread_class_init, NULL, NULL,
+      sizeof (GstThreadClass),
+      gst_thread_base_init, 
+      NULL,
+      gst_thread_class_init, 
+      NULL, 
+      NULL,
       sizeof (GstThread),
       4,
-      (GInstanceInitFunc) gst_thread_init,
+      gst_thread_init,
       NULL
     };
     thread_type = g_type_register_static (GST_TYPE_BIN, "GstThread",
@@ -130,24 +130,27 @@ gst_thread_get_type(void) {
   return thread_type;
 }
 
+static void
+gst_thread_base_init (gpointer g_class)
+{
+  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+
+  gst_element_class_set_details (gstelement_class, &gst_thread_details);
+}
 static void do_nothing (gpointer hi) {}
 static void
-gst_thread_class_init (GstThreadClass *klass)
+gst_thread_class_init (gpointer g_class, gpointer class_data)
 {
-  GObjectClass *gobject_class;
-  GstObjectClass *gstobject_class;
-  GstElementClass *gstelement_class;
-  GstBinClass *gstbin_class;
+  GObjectClass *gobject_class = G_OBJECT_CLASS (g_class);
+  GstObjectClass *gstobject_class = GST_OBJECT_CLASS (g_class);
+  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+  GstBinClass *gstbin_class = GST_BIN_CLASS (g_class);
+  GstThreadClass *klass = GST_THREAD_CLASS (g_class);
 
   /* setup gst_thread_current */
   gst_thread_current = g_private_new (do_nothing);
 
-  gobject_class =      (GObjectClass*)klass;
-  gstobject_class =    (GstObjectClass*)klass;
-  gstelement_class =   (GstElementClass*)klass;
-  gstbin_class =       (GstBinClass*)klass;
-
-  parent_class = g_type_class_ref (GST_TYPE_BIN);
+  parent_class = g_type_class_peek_parent (g_class);
 
   g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PRIORITY,
     g_param_spec_enum ("priority", "Scheduling Policy", "The scheduling priority of the thread",
@@ -174,9 +177,10 @@ gst_thread_class_init (GstThreadClass *klass)
 }
 
 static void
-gst_thread_init (GstThread *thread)
+gst_thread_init (GTypeInstance *instance, gpointer g_class)
 {
   GstScheduler *scheduler;
+  GstThread *thread = GST_THREAD (instance);
 
   GST_DEBUG ("initializing thread");
 
index 50aee24..3d554e2 100644 (file)
@@ -32,8 +32,6 @@
 G_BEGIN_DECLS
 
 extern GPrivate *gst_thread_current;
-extern GstElementDetails gst_thread_details;
-
 
 typedef enum {
   GST_THREAD_STATE_SPINNING    = GST_BIN_FLAG_LAST,
index b87d4fd..892b912 100644 (file)
@@ -193,7 +193,7 @@ gst_type_find_factory_call_function (const GstTypeFindFactory *factory, GstTypeF
   factory->function (find, factory->user_data);
 }
 /**
- * gst_type_find_factory_register:
+ * gst_type_find_register:
  * @plugin: the GstPlugin to register with
  * @name: the name for registering
  * @rank: rank (or importance) of this typefind function
@@ -209,16 +209,16 @@ gst_type_find_factory_call_function (const GstTypeFindFactory *factory, GstTypeF
  *
  * Returns: TRUE on success, FALSE otherwise
  */
-void
-gst_type_find_factory_register (GstPlugin *plugin, const gchar *name, guint rank,
-                               GstTypeFindFunction func, gchar **extensions, GstCaps *possible_caps,
-                               gpointer data)
+gboolean
+gst_type_find_register (GstPlugin *plugin, const gchar *name, guint rank,
+                       GstTypeFindFunction func, gchar **extensions, GstCaps *possible_caps,
+                       gpointer data)
 {
   GstTypeFindFactory *factory;
   
-  g_return_if_fail (plugin != NULL);
-  g_return_if_fail (name != NULL);
-  g_return_if_fail (func != NULL);
+  g_return_val_if_fail (plugin != NULL, FALSE);
+  g_return_val_if_fail (name != NULL, FALSE);
+  g_return_val_if_fail (func != NULL, FALSE);
 
   GST_INFO ("registering typefind function for %s", name);
   factory = GST_TYPE_FIND_FACTORY (gst_registry_pool_find_feature (name, GST_TYPE_TYPE_FIND_FACTORY));
@@ -241,6 +241,8 @@ gst_type_find_factory_register (GstPlugin *plugin, const gchar *name, guint rank
   factory->user_data = data;
 
   gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
+
+  return TRUE;
 }
 
 /*** typefind function interface **********************************************/
index e8fa685..5662133 100644 (file)
@@ -100,7 +100,7 @@ void                gst_type_find_suggest                   (GstTypeFind *          find,
 guint64                gst_type_find_get_length                (GstTypeFind *          find);
 
 /* registration interface */
-void           gst_type_find_factory_register          (GstPlugin *            plugin,
+gboolean       gst_type_find_register                  (GstPlugin *            plugin,
                                                         const gchar *          name, 
                                                         guint                  rank,
                                                         GstTypeFindFunction    func,
index 81e4b87..ad4f029 100644 (file)
@@ -58,10 +58,17 @@ typedef enum {
   GST_RESULT_NOT_IMPL
 } GstResult;
 
+#define GST_RANK_PRIMARY    256
+#define GST_RANK_SECONDARY  128
+#define GST_RANK_MARGINAL   64
+#define GST_RANK_NONE       0
+
 #define GST_STRUCT_PADDING  gpointer _gst_reserved[4];
 #define GST_CLASS_PADDING   gpointer _gst_reserved[4];
 #define GST_OBJECT_PADDING  gpointer _gst_reserved[4];
 
+#define GST_STRUCT_PADDING_INIT        {NULL, NULL, NULL, NULL}
+
 G_END_DECLS
 
 #endif /* __GST_TYPES_H__ */
index 3806aa7..ccb969e 100644 (file)
@@ -993,12 +993,11 @@ gst_file_index_get_assoc_entry (GstIndex *index,
 }
 
 gboolean
-gst_file_index_plugin_init (GModule *module, GstPlugin *plugin)
+gst_file_index_plugin_init (GstPlugin *plugin)
 {
   GstIndexFactory *factory;
 
   GST_DEBUG_CATEGORY_INIT(DC, "GST_FILEINDEX", 0, NULL);
-  gst_plugin_set_longname (plugin, "A file index");
 
   factory = gst_index_factory_new ("fileindex",
                                   "A index that stores entries in file",
index e2f491e..6894202 100644 (file)
 #include <gst/gstversion.h>
 #include <gst/gstplugin.h>
 
-extern gboolean gst_mem_index_plugin_init      (GModule *module, GstPlugin *plugin);
-extern gboolean gst_file_index_plugin_init     (GModule *module, GstPlugin *plugin);
+extern gboolean gst_mem_index_plugin_init      (GstPlugin *plugin);
+extern gboolean gst_file_index_plugin_init     (GstPlugin *plugin);
 
 static gboolean
-plugin_init (GModule *module, GstPlugin *plugin)
+plugin_init (GstPlugin *plugin)
 {
   gboolean res = TRUE;
 
-  res &= gst_mem_index_plugin_init (module, plugin);
-  res &= gst_file_index_plugin_init (module, plugin);
+  res &= gst_mem_index_plugin_init (plugin);
+  res &= gst_file_index_plugin_init (plugin);
   
   return res;
 }
 
-GstPluginDesc plugin_desc = {
+GST_PLUGIN_DEFINE (
   GST_VERSION_MAJOR,
   GST_VERSION_MINOR,
   "gstindexers",
-  plugin_init
-};
+  "Gstremaer core indexers",
+  plugin_init,
+  VERSION,
+  GST_LICENSE,
+  GST_COPYRIGHT,
+  GST_PACKAGE,
+  GST_ORIGIN
+)
+
 
index 80856c4..bc5f210 100644 (file)
@@ -397,12 +397,10 @@ gst_mem_index_get_assoc_entry (GstIndex *index, gint id,
 }
 
 gboolean
-gst_mem_index_plugin_init (GModule *module, GstPlugin *plugin)
+gst_mem_index_plugin_init (GstPlugin *plugin)
 {
   GstIndexFactory *factory;
 
-  gst_plugin_set_longname (plugin, "A memory index");
-
   factory = gst_index_factory_new ("memindex",
                                   "A index that stores entries in memory",
                                    gst_mem_index_get_type());
index 3f5493f..c0555a2 100644 (file)
@@ -398,8 +398,8 @@ gst_xml_registry_add_path_list_func (GstXMLRegistry *registry)
     g_markup_parse_context_parse (context, text, size, &error);
 
     if (error) {
-      fprintf (stderr, "ERROR: parsing registry %s: %s\n", 
-              registry->location, error->message);
+      GST_ERROR ("parsing registry %s: %s\n", 
+                registry->location, error->message);
       g_free (text);
       fclose (reg);
       return;
@@ -600,7 +600,7 @@ gst_xml_registry_load (GstRegistry *registry)
     g_markup_parse_context_parse (xmlregistry->context, text, size, &error);
 
     if (error) {
-      fprintf(stderr, "ERROR: parsing registry: %s\n", error->message);
+      GST_ERROR ("parsing registry: %s\n", error->message);
       g_free (text);
       CLASS (xmlregistry)->close_func (xmlregistry);
       return FALSE;
@@ -630,13 +630,17 @@ static GstRegistryReturn
 gst_xml_registry_load_plugin (GstRegistry *registry, GstPlugin *plugin)
 {
   GError *error = NULL;
+  GstPlugin *loaded_plugin;
 
   /* FIXME: add gerror support */
-  if (!gst_plugin_load_plugin (plugin, &error)) {
+  loaded_plugin = gst_plugin_load_file (plugin->filename, &error);
+  if (!plugin) {
     if (error) {
-      g_warning ("could not load plugin %s: %s", plugin->name, error->message);
+      g_warning ("could not load plugin %s: %s", plugin->desc.name, error->message);
     }
     return GST_REGISTRY_PLUGIN_LOAD_ERROR;
+  } else if (loaded_plugin != plugin) {
+    g_critical ("how to remove plugins?");
   }
 
   return GST_REGISTRY_OK;
@@ -649,14 +653,29 @@ gst_xml_registry_parse_plugin (GMarkupParseContext *context, const gchar *tag, c
   GstPlugin *plugin = registry->current_plugin;
   
   if (!strcmp (tag, "name")) {
-    plugin->name = g_strndup (text, text_len);
+    plugin->desc.name = g_strndup (text, text_len);
   }
-  else if (!strcmp (tag, "longname")) {
-    plugin->longname = g_strndup (text, text_len);
+  else if (!strcmp (tag, "description")) {
+    plugin->desc.description = g_strndup (text, text_len);
   }
   else if (!strcmp (tag, "filename")) {
     plugin->filename = g_strndup (text, text_len);
   }
+  else if (!strcmp (tag, "version")) {
+    plugin->desc.version = g_strndup (text, text_len);
+  }
+  else if (!strcmp (tag, "copyright")) {
+    plugin->desc.copyright = g_strndup (text, text_len);
+  }
+  else if (!strcmp (tag, "license")) {
+    plugin->desc.license = g_strndup (text, text_len);
+  }
+  else if (!strcmp (tag, "package")) {
+    plugin->desc.package = g_strndup (text, text_len);
+  }
+  else if (!strcmp (tag, "origin")) {
+    plugin->desc.origin = g_strndup (text, text_len);
+  }
   
   return TRUE;
 }
@@ -672,39 +691,27 @@ gst_xml_registry_parse_element_factory (GMarkupParseContext *context, const gcha
     registry->current_feature->name = g_strndup (text, text_len);
   }
   else if (!strcmp (tag, "longname")) {
-    g_free (factory->details->longname);
-    factory->details->longname = g_strndup (text, text_len);
+    g_free (factory->details.longname);
+    factory->details.longname = g_strndup (text, text_len);
   }
   else if (!strcmp(tag, "class")) {
-    g_free (factory->details->klass);
-    factory->details->klass = g_strndup (text, text_len);
+    g_free (factory->details.klass);
+    factory->details.klass = g_strndup (text, text_len);
   }
   else if (!strcmp(tag, "description")) {
-    g_free (factory->details->description);
-    factory->details->description = g_strndup (text, text_len);
-  }
-  else if (!strcmp(tag, "license")) {
-    g_free (factory->details->license);
-    factory->details->license = g_strndup (text, text_len);
-  }
-  else if (!strcmp(tag, "version")) {
-    g_free (factory->details->version);
-    factory->details->version = g_strndup (text, text_len);
+    g_free (factory->details.description);
+    factory->details.description = g_strndup (text, text_len);
   }
   else if (!strcmp(tag, "author")) {
-    g_free (factory->details->author);
-    factory->details->author = g_strndup (text, text_len);
-  }
-  else if (!strcmp(tag, "copyright")) {
-    g_free (factory->details->copyright);
-    factory->details->copyright = g_strndup (text, text_len);
+    g_free (factory->details.author);
+    factory->details.author = g_strndup (text, text_len);
   }
   else if (!strcmp(tag, "rank")) {
     gint rank;
     gchar *ret;
      rank = strtol (text, &ret, 0);
     if (ret == text + text_len) {
-     gst_element_factory_set_rank (factory, rank);
+     gst_plugin_feature_set_rank (GST_PLUGIN_FEATURE (factory), rank);
     }
   }
   
@@ -725,7 +732,7 @@ gst_xml_registry_parse_type_find_factory (GMarkupParseContext *context, const gc
     gchar *ret;
      rank = strtol (text, &ret, 0);
     if (ret == text + text_len) {
-     gst_element_factory_set_rank (factory, rank);
+     gst_plugin_feature_set_rank (GST_PLUGIN_FEATURE (factory), rank);
     }
   }
   /* FIXME!!
@@ -922,8 +929,6 @@ gst_xml_registry_start_element (GMarkupParseContext *context,
          if (GST_IS_ELEMENT_FACTORY (feature)) {
            GstElementFactory *factory = GST_ELEMENT_FACTORY (feature);
 
-           factory->details_dynamic = TRUE;
-           factory->details = g_new0(GstElementDetails, 1);
            factory->padtemplates = NULL;
            xmlregistry->parser = gst_xml_registry_parse_element_factory;
            break;
@@ -1129,7 +1134,7 @@ gst_xml_registry_end_element (GMarkupParseContext *context,
        xmlregistry->name_template = NULL;
        xmlregistry->caps = NULL;
 
-       gst_element_factory_add_pad_template (GST_ELEMENT_FACTORY (xmlregistry->current_feature),
+       __gst_element_factory_add_pad_template (GST_ELEMENT_FACTORY (xmlregistry->current_feature),
                                              template);
        xmlregistry->state = GST_XML_REGISTRY_FEATURE;
        xmlregistry->parser = gst_xml_registry_parse_element_factory;
@@ -1212,7 +1217,7 @@ static void
 gst_xml_registry_error (GMarkupParseContext *context, GError *error,
                         gpointer user_data)
 {
-  g_print ("error %s\n", error->message);
+  GST_ERROR ("%s\n", error->message);
 }
 
 static void
@@ -1461,13 +1466,10 @@ gst_xml_registry_save_feature (GstXMLRegistry *xmlregistry, GstPluginFeature *fe
     GstElementFactory *factory = GST_ELEMENT_FACTORY (feature);
     GList *templates;
 
-    PUT_ESCAPED ("longname", factory->details->longname);
-    PUT_ESCAPED ("class", factory->details->klass);
-    PUT_ESCAPED ("description", factory->details->description);
-    PUT_ESCAPED ("license", factory->details->license);
-    PUT_ESCAPED ("version", factory->details->version);
-    PUT_ESCAPED ("author", factory->details->author);
-    PUT_ESCAPED ("copyright", factory->details->copyright);
+    PUT_ESCAPED ("longname", factory->details.longname);
+    PUT_ESCAPED ("class", factory->details.klass);
+    PUT_ESCAPED ("description", factory->details.description);
+    PUT_ESCAPED ("author", factory->details.author);
     
     templates = factory->padtemplates;
 
@@ -1523,9 +1525,14 @@ gst_xml_registry_save_plugin (GstXMLRegistry *xmlregistry, GstPlugin *plugin)
 {
   GList *walk;
   
-  PUT_ESCAPED ("name", plugin->name);
-  PUT_ESCAPED ("longname", plugin->longname);
+  PUT_ESCAPED ("name", plugin->desc.name);
+  PUT_ESCAPED ("description", plugin->desc.description);
   PUT_ESCAPED ("filename", plugin->filename);
+  PUT_ESCAPED ("version", plugin->desc.version);
+  PUT_ESCAPED ("license", plugin->desc.license);
+  PUT_ESCAPED ("copyright", plugin->desc.copyright);
+  PUT_ESCAPED ("package", plugin->desc.package);
+  PUT_ESCAPED ("origin", plugin->desc.origin);
 
   walk = plugin->features;
 
@@ -1594,6 +1601,7 @@ gst_xml_registry_rebuild_recurse (GstXMLRegistry *registry,
                                   const gchar *directory)
 {
   GDir *dir;
+  gchar *temp;
   GList *ret = NULL;
 
   dir = g_dir_open (directory, 0, NULL);
@@ -1615,13 +1623,9 @@ gst_xml_registry_rebuild_recurse (GstXMLRegistry *registry,
     }
     g_dir_close (dir);
   } else {
-    if (strstr (directory, ".so")) {
-      gchar *temp;
-
-      if ((temp = strstr (directory, ".so")) &&
-          (!strcmp (temp, ".so"))) {
-        ret = g_list_prepend (ret, gst_plugin_new (directory));
-      }
+    if ((temp = strstr (directory, G_MODULE_SUFFIX)) &&
+        (!strcmp (temp, G_MODULE_SUFFIX))) {
+      ret = g_list_prepend (ret, g_strdup (directory));
     }
   }
 
@@ -1634,6 +1638,7 @@ gst_xml_registry_rebuild (GstRegistry *registry)
   GList *walk = NULL, *plugins = NULL, *prune = NULL;
   GError *error = NULL;
   guint length;
+  GstPlugin *plugin;
   GstXMLRegistry *xmlregistry = GST_XML_REGISTRY (registry);
  
   walk = registry->paths;
@@ -1659,9 +1664,10 @@ gst_xml_registry_rebuild (GstRegistry *registry)
     walk = plugins;
     while (walk) {
       g_assert (walk->data);
-      if (gst_plugin_load_plugin (GST_PLUGIN (walk->data), NULL)) {
+      plugin = gst_plugin_load_file ((gchar *) walk->data, NULL);
+      if (plugin) {
         prune = g_list_prepend (prune, walk->data);
-        gst_registry_add_plugin (registry, GST_PLUGIN (walk->data));
+        gst_registry_add_plugin (registry, plugin);
       }
 
       walk = g_list_next (walk);
@@ -1670,6 +1676,7 @@ gst_xml_registry_rebuild (GstRegistry *registry)
     walk = prune;
     while (walk) {
       plugins = g_list_remove (plugins, walk->data);
+      g_free (walk->data);
       walk = g_list_next (walk);
     }
     g_list_free (prune);
@@ -1678,16 +1685,14 @@ gst_xml_registry_rebuild (GstRegistry *registry)
   
   walk = plugins;
   while (walk) {
-    if (gst_plugin_load_plugin (GST_PLUGIN (walk->data), &error)) {
+    if ((plugin = gst_plugin_load_file ((gchar *) walk->data, &error))) {
       g_warning ("Bizarre behavior: plugin %s actually loaded", 
-                ((GstPlugin *) walk->data)->filename);
+                (gchar *) walk->data);
+      gst_registry_add_plugin (registry, plugin);
     } else {
       GST_CAT_INFO (GST_CAT_PLUGIN_LOADING, "Plugin %s failed to load: %s", 
-                ((GstPlugin *) walk->data)->filename, error->message);
-      g_print ("Plugin %s failed to load\n",
-                ((GstPlugin *) walk->data)->filename);
+                (gchar *) walk->data, error->message);
 
-      g_free (((GstPlugin *) walk->data)->filename);
       g_free (walk->data);
       g_error_free (error);
       error = NULL;
index 3fd64b7..06c8039 100644 (file)
@@ -246,15 +246,13 @@ gst_basic_scheduler_dispose (GObject *object)
 }
 
 static gboolean
-plugin_init (GModule *module, GstPlugin *plugin)
+plugin_init (GstPlugin *plugin)
 {
   GstSchedulerFactory *factory;
 
   GST_DEBUG_CATEGORY_INIT (debug_dataflow, "dataflow", 0, "basic scheduler dataflow");
   GST_DEBUG_CATEGORY_INIT (debug_scheduler, "scheduler", 0, "basic scheduler general information");
 
-  gst_plugin_set_longname (plugin, "A basic scheduler");
-
   factory = gst_scheduler_factory_new ("basic"COTHREADS_NAME,
                                      "A basic scheduler using "COTHREADS_NAME" cothreads",
                                      gst_basic_scheduler_get_type());
@@ -267,12 +265,18 @@ plugin_init (GModule *module, GstPlugin *plugin)
   return TRUE;
 }
 
-GstPluginDesc plugin_desc = {
+GST_PLUGIN_DEFINE (
   GST_VERSION_MAJOR,
   GST_VERSION_MINOR,
   "gstbasic"COTHREADS_NAME"scheduler",
-  plugin_init
-};
+  "a basic scheduler using "COTHREADS_NAME" cothreads",
+  plugin_init,
+  VERSION,
+  GST_LICENSE,
+  GST_COPYRIGHT,
+  GST_PACKAGE,
+  GST_ORIGIN
+)
 
 static int
 gst_basic_scheduler_loopfunc_wrapper (int argc, char **argv)
index a6d6ff7..4826f27 100644 (file)
@@ -345,14 +345,12 @@ gst_opt_scheduler_dispose (GObject *object)
 }
 
 static gboolean
-plugin_init (GModule *module, GstPlugin *plugin)
+plugin_init (GstPlugin *plugin)
 {
   GstSchedulerFactory *factory;
 
   GST_DEBUG_CATEGORY_INIT (debug_scheduler, "scheduler", 0, "optimal scheduler");
 
-  gst_plugin_set_longname (plugin, "An optimal scheduler");
-
 #ifdef USE_COTHREADS
   factory = gst_scheduler_factory_new ("opt"COTHREADS_NAME,
                                        "An optimal scheduler using "COTHREADS_NAME" cothreads",
@@ -372,12 +370,18 @@ plugin_init (GModule *module, GstPlugin *plugin)
   return TRUE;
 }
 
-GstPluginDesc plugin_desc = {
+GST_PLUGIN_DEFINE (
   GST_VERSION_MAJOR,
   GST_VERSION_MINOR,
   "gstopt"COTHREADS_NAME"scheduler",
-  plugin_init
-};
+  "An optimal scheduler using "COTHREADS_NAME" cothreads",
+  plugin_init,
+  VERSION,
+  GST_LICENSE,
+  GST_VERSION,
+  GST_PACKAGE,
+  GST_ORIGIN
+);
 
 
 static void
index 8476806..352551a 100644 (file)
@@ -746,17 +746,22 @@ gst_bytestream_print_status (GstByteStream * bs)
 }
 
 static gboolean
-plugin_init (GModule *module, GstPlugin *plugin)
+plugin_init (GstPlugin *plugin)
 {
   GST_DEBUG_CATEGORY_INIT (debug_bs, "bytestream", 0, "bytestream library");
 
-  gst_plugin_set_longname (plugin, "GstByteStream: a byte-oriented layer on top of buffer-passing");
   return TRUE;
 }
 
-GstPluginDesc plugin_desc = {
+GST_PLUGIN_DEFINE (
   GST_VERSION_MAJOR,
   GST_VERSION_MINOR,
   "gstbytestream",
-  plugin_init
-};
+  "a byte-oriented layer on top of buffer-passing",
+  plugin_init,
+  VERSION,
+  GST_LICENSE,
+  GST_COPYRIGHT,
+  GST_PACKAGE,
+  GST_ORIGIN
+)
index b5644be..419015c 100644 (file)
@@ -214,15 +214,21 @@ void gst_getbits_newbuf(gst_getbits_t *gb,unsigned char *buffer, unsigned long l
 
 
 static gboolean
-plugin_init (GModule *module, GstPlugin *plugin)
+plugin_init (GstPlugin *plugin)
 {
-  gst_plugin_set_longname (plugin, "Accelerated routines for getting bits from a data stream");
   return TRUE;
 }
 
-GstPluginDesc plugin_desc = {
+GST_PLUGIN_DEFINE (
   GST_VERSION_MAJOR,
   GST_VERSION_MINOR,
   "gstgetbits",
-  plugin_init
-};
+  "Accelerated routines for getting bits from a data stream",
+  plugin_init,
+  VERSION,
+  GST_LICENSE,
+  GST_COPYRIGHT,
+  GST_PACKAGE,
+  GST_ORIGIN
+)
+
index 3c3ba5d..797d41a 100644 (file)
 
 #include "gstaggregator.h"
 
-GST_DEBUG_CATEGORY (gst_aggregator_debug);
+GST_DEBUG_CATEGORY_STATIC (gst_aggregator_debug);
 #define GST_CAT_DEFAULT gst_aggregator_debug
 
-GstElementDetails gst_aggregator_details = {
+GstElementDetails gst_aggregator_details = GST_ELEMENT_DETAILS (
   "Aggregator pipe fitting",
   "Generic",
-  "LGPL",
   "N-to-1 pipe fitting",
-  VERSION,
-  "Wim Taymans <wim.taymans@chello.be>",
-  "(C) 2001",
-};
+  "Wim Taymans <wim.taymans@chello.be>"
+);
 
 /* Aggregator signals and args */
 enum {
@@ -80,6 +77,7 @@ gst_aggregator_sched_get_type (void)
 
 #define AGGREGATOR_IS_LOOP_BASED(ag)   ((ag)->sched != AGGREGATOR_CHAIN)
 
+static void    gst_aggregator_base_init        (gpointer g_class);
 static void    gst_aggregator_class_init       (GstAggregatorClass *klass);
 static void    gst_aggregator_init             (GstAggregator *aggregator);
 
@@ -106,7 +104,7 @@ gst_aggregator_get_type (void)
   if (!aggregator_type) {
     static const GTypeInfo aggregator_info = {
       sizeof(GstAggregatorClass),      
-      NULL,
+      gst_aggregator_base_init,
       NULL,
       (GClassInitFunc)gst_aggregator_class_init,
       NULL,
@@ -116,11 +114,20 @@ gst_aggregator_get_type (void)
       (GInstanceInitFunc)gst_aggregator_init,
     };
     aggregator_type = g_type_register_static (GST_TYPE_ELEMENT, "GstAggregator", &aggregator_info, 0);
+
+    GST_DEBUG_CATEGORY_INIT (gst_aggregator_debug, "aggregator", 0, "aggregator element");
   }
   return aggregator_type;
 }
 
 static void
+gst_aggregator_base_init (gpointer g_class)
+{
+  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); 
+  gst_element_class_add_pad_template (gstelement_class, GST_PAD_TEMPLATE_GET (aggregator_src_factory));
+  gst_element_class_set_details (gstelement_class, &gst_aggregator_details);
+}
+static void
 gst_aggregator_class_init (GstAggregatorClass *klass) 
 {
   GObjectClass *gobject_class;
@@ -360,11 +367,4 @@ gst_aggregator_chain (GstPad *pad, GstData *_data)
 
   gst_aggregator_push (aggregator, pad, buf, "chain");
 }
-
-gboolean
-gst_aggregator_factory_init (GstElementFactory *factory)
-{
-  gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (aggregator_src_factory));
-
-  return TRUE;
-}
+  
index e53b854..7e6105b 100644 (file)
@@ -28,8 +28,6 @@
 
 G_BEGIN_DECLS
 
-extern GstElementDetails gst_aggregator_details;
-GST_DEBUG_CATEGORY_EXTERN(gst_aggregator_debug);
 
 typedef enum {
   AGGREGATOR_LOOP              = 1,
index a91648b..dd17216 100644 (file)
@@ -25,7 +25,7 @@
 #include "gstbufferstore.h"
 #include <string.h>
 
-GST_DEBUG_CATEGORY (gst_buffer_store_debug);
+GST_DEBUG_CATEGORY_STATIC (gst_buffer_store_debug);
 #define GST_CAT_DEFAULT gst_buffer_store_debug
 
 enum {
index 7b769a0..909b883 100644 (file)
@@ -46,9 +46,8 @@
 
 struct _elements_entry {
   gchar *name;
+  guint rank;
   GType (*type) (void);
-  GstElementDetails *details;
-  gboolean (*factoryinit) (GstElementFactory *factory);
 };
 
 
@@ -56,75 +55,48 @@ extern GType gst_filesrc_get_type(void);
 extern GstElementDetails gst_filesrc_details;
 
 static struct _elements_entry _elements[] = {
-  { "aggregator",   gst_aggregator_get_type,   &gst_aggregator_details,        gst_aggregator_factory_init },
-  { "fakesrc",             gst_fakesrc_get_type,       &gst_fakesrc_details,           gst_fakesrc_factory_init },
-  { "fakesink",     gst_fakesink_get_type,     &gst_fakesink_details,          gst_fakesink_factory_init },
-  { "fdsink",       gst_fdsink_get_type,       &gst_fdsink_details,            NULL },
-  { "fdsrc",       gst_fdsrc_get_type,         &gst_fdsrc_details,             NULL },
-  { "filesrc",             gst_filesrc_get_type,       &gst_filesrc_details,           NULL },
-  { "filesink",            gst_filesink_get_type,      &gst_filesink_details,          NULL },
-  { "identity",     gst_identity_get_type,     &gst_identity_details,          NULL },
-  { "md5sink",      gst_md5sink_get_type,      &gst_md5sink_details,           gst_md5sink_factory_init },
-  { "multidisksrc", gst_multidisksrc_get_type, &gst_multidisksrc_details,      NULL },
-  { "pipefilter",   gst_pipefilter_get_type,   &gst_pipefilter_details,        NULL },
-  { "shaper",       gst_shaper_get_type,       &gst_shaper_details,            gst_shaper_factory_init },
-  { "statistics",   gst_statistics_get_type,   &gst_statistics_details,        NULL },
-  { "tee",                 gst_tee_get_type,           &gst_tee_details,               gst_tee_factory_init },
-  { "typefind",     gst_type_find_element_get_type, &gst_type_find_element_details,    NULL },
+  { "aggregator",   GST_RANK_PRIMARY,  gst_aggregator_get_type         },
+  { "fakesrc",             GST_RANK_PRIMARY,   gst_fakesrc_get_type            },
+  { "fakesink",     GST_RANK_PRIMARY,  gst_fakesink_get_type           },
+  { "fdsink",       GST_RANK_PRIMARY,  gst_fdsink_get_type             },
+  { "fdsrc",       GST_RANK_PRIMARY,   gst_fdsrc_get_type              },
+  { "filesrc",             GST_RANK_PRIMARY,   gst_filesrc_get_type            },
+  { "filesink",            GST_RANK_PRIMARY,   gst_filesink_get_type           },
+  { "identity",     GST_RANK_PRIMARY,  gst_identity_get_type           },
+  { "md5sink",      GST_RANK_PRIMARY,  gst_md5sink_get_type            },
+  { "multidisksrc", GST_RANK_PRIMARY,  gst_multidisksrc_get_type       },
+  { "pipefilter",   GST_RANK_PRIMARY,  gst_pipefilter_get_type         },
+  { "shaper",       GST_RANK_PRIMARY,  gst_shaper_get_type             },
+  { "statistics",   GST_RANK_PRIMARY,  gst_statistics_get_type         },
+  { "tee",                 GST_RANK_PRIMARY,   gst_tee_get_type                },
+  { "typefind",     GST_RANK_PRIMARY,  gst_type_find_element_get_type  },
   { NULL, 0 },
 };
 
 static gboolean
-plugin_init (GModule *module, GstPlugin *plugin)
+plugin_init (GstPlugin *plugin)
 {
-  GstElementFactory *factory;
-  gint i = 0;
-
-  gst_plugin_set_longname (plugin, "Standard GST Elements");
-
-  GST_DEBUG_CATEGORY_INIT (gst_aggregator_debug, "aggregator", 0,      "aggregator element");
-  GST_DEBUG_CATEGORY_INIT (gst_fakesink_debug, "fakesink",     0,      "fakesink element");
-  GST_DEBUG_CATEGORY_INIT (gst_fakesrc_debug,  "fakesrc",      0,      "fakesrc element");
-  GST_DEBUG_CATEGORY_INIT (gst_fdsink_debug,   "fdsink",       0,      "fdsink element");
-  GST_DEBUG_CATEGORY_INIT (gst_fdsrc_debug,    "fdsrc",        0,      "fdsrc element");
-  GST_DEBUG_CATEGORY_INIT (gst_filesink_debug, "filesink",     0,      "filesink element");
-  GST_DEBUG_CATEGORY_INIT (gst_filesrc_debug,  "filesrc",      0,      "filesrc element");
-  GST_DEBUG_CATEGORY_INIT (gst_identity_debug, "identity",     0,      "identity element");
-  GST_DEBUG_CATEGORY_INIT (gst_md5sink_debug,  "md5sink",      0,      "md5sink element");
-  GST_DEBUG_CATEGORY_INIT (gst_multidisksrc_debug, "multidisksrc", 0,  "multidisksrc element");
-  GST_DEBUG_CATEGORY_INIT (gst_pipefilter_debug, "pipefilter", 0,      "pipefilter element");
-  GST_DEBUG_CATEGORY_INIT (gst_shaper_debug,   "shaper",       0,      "shaper element");
-  GST_DEBUG_CATEGORY_INIT (gst_statistics_debug, "statistics", 0,      "statistics element");
-  GST_DEBUG_CATEGORY_INIT (gst_tee_debug,      "tee",          0,      "tee element");
-  GST_DEBUG_CATEGORY_INIT (gst_type_find_element_debug,        "typefind", GST_DEBUG_BG_YELLOW | GST_DEBUG_FG_GREEN, "typefind element");
-
-  while (_elements[i].name) {  
-    factory = gst_element_factory_new (_elements[i].name,
-                                      (_elements[i].type) (),
-                                      _elements[i].details);
-
-    if (!factory)
-      {
-       g_warning ("gst_element_factory_new failed for `%s'",
-                  _elements[i].name);
-       continue;
-      }
-
-    gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
-    if (_elements[i].factoryinit) {
-      _elements[i].factoryinit (factory);
-    }
-/*      g_print("added factory '%s'\n",_elements[i].name); */
-    i++;
+  struct _elements_entry *my_elements = _elements;
+  
+  while ((*my_elements).name) {  
+    if (!gst_element_register (plugin, (*my_elements).name, (*my_elements).rank, ((*my_elements).type) ()))
+      return FALSE;
+    my_elements++;
   }
 
-/*  INFO (GST_INFO_PLUGIN_LOAD,"gstelements: loaded %d standard elements", i);*/
   return TRUE;
 }
 
-GstPluginDesc plugin_desc = {
+GST_PLUGIN_DEFINE (
   GST_VERSION_MAJOR,
   GST_VERSION_MINOR,
   "gstelements",
-  plugin_init
-};
+  "standard GStreamer elements",
+  plugin_init,
+  VERSION,
+  GST_LICENSE,
+  GST_COPYRIGHT,
+  GST_PACKAGE,
+  GST_ORIGIN
+)
+
index d9a94a5..fa52606 100644 (file)
 
 #include "gstfakesink.h"
 
-GST_DEBUG_CATEGORY (gst_fakesink_debug);
+GST_DEBUG_CATEGORY_STATIC (gst_fakesink_debug);
 #define GST_CAT_DEFAULT gst_fakesink_debug
 
-GstElementDetails gst_fakesink_details = {
+GstElementDetails gst_fakesink_details = GST_ELEMENT_DETAILS (
   "Fake Sink",
   "Sink",
-  "LGPL",
   "Black hole for data",
-  VERSION,
-  "Erik Walthinsen <omega@cse.ogi.edu>",
-  "(C) 1999",
-};
+  "Erik Walthinsen <omega@cse.ogi.edu>"
+);
 
 
 /* FakeSink signals and args */
@@ -87,6 +84,7 @@ gst_fakesink_state_error_get_type (void)
   return fakesink_state_error_type;
 }
 
+static void    gst_fakesink_base_init          (gpointer g_class);
 static void    gst_fakesink_class_init         (GstFakeSinkClass *klass);
 static void    gst_fakesink_init               (GstFakeSink *fakesink);
 
@@ -114,7 +112,8 @@ gst_fakesink_get_type (void)
 
   if (!fakesink_type) {
     static const GTypeInfo fakesink_info = {
-      sizeof(GstFakeSinkClass),      NULL,
+      sizeof(GstFakeSinkClass),
+      gst_fakesink_base_init,
       NULL,
       (GClassInitFunc)gst_fakesink_class_init,
       NULL,
@@ -124,11 +123,21 @@ gst_fakesink_get_type (void)
       (GInstanceInitFunc)gst_fakesink_init,
     };
     fakesink_type = g_type_register_static (GST_TYPE_ELEMENT, "GstFakeSink", &fakesink_info, 0);
+  
+    GST_DEBUG_CATEGORY_INIT (gst_fakesink_debug, "fakesink", 0, "fakesink element");
   }
   return fakesink_type;
 }
 
 static void
+gst_fakesink_base_init (gpointer g_class)
+{
+  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); 
+  
+  gst_element_class_set_details (gstelement_class, &gst_fakesink_details);
+  gst_element_class_add_pad_template (gstelement_class, GST_PAD_TEMPLATE_GET (fakesink_sink_factory));
+}
+static void
 gst_fakesink_class_init (GstFakeSinkClass *klass) 
 {
   GObjectClass *gobject_class;
@@ -411,10 +420,3 @@ error:
   return GST_STATE_FAILURE;
 }
 
-gboolean
-gst_fakesink_factory_init (GstElementFactory *factory)
-{
-  gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (fakesink_sink_factory));
-
-  return TRUE;
-}
index 95ee8be..a8e7cd0 100644 (file)
@@ -28,8 +28,6 @@
 
 G_BEGIN_DECLS
 
-extern GstElementDetails gst_fakesink_details;
-GST_DEBUG_CATEGORY_EXTERN(gst_fakesink_debug);
 
 #define GST_TYPE_FAKESINK \
   (gst_fakesink_get_type())
index 14287e3..3a82dc0 100644 (file)
 #define DEFAULT_SIZEMAX                4096
 #define DEFAULT_PARENTSIZE     4096*10
 
-GST_DEBUG_CATEGORY (gst_fakesrc_debug);
+GST_DEBUG_CATEGORY_STATIC (gst_fakesrc_debug);
 #define GST_CAT_DEFAULT gst_fakesrc_debug
 
-GstElementDetails gst_fakesrc_details = {
+GstElementDetails gst_fakesrc_details = GST_ELEMENT_DETAILS (
   "Fake Source",
   "Source",
-  "LGPL",
   "Push empty (no data) buffers around",
-  VERSION,
-  "Erik Walthinsen <omega@cse.ogi.edu>\n"
-  "Wim Taymans <wim.taymans@chello.be>",
-  "(C) 1999",
-};
+  "Erik Walthinsen <omega@cse.ogi.edu>, "
+  "Wim Taymans <wim.taymans@chello.be>"
+);
 
 
 /* FakeSrc signals and args */
@@ -101,6 +98,8 @@ gst_fakesrc_output_get_type (void)
   };
   if (!fakesrc_output_type) {
     fakesrc_output_type = g_enum_register_static ("GstFakeSrcOutput", fakesrc_output);
+  
+    GST_DEBUG_CATEGORY_INIT (gst_fakesrc_debug, "fakesrc", 0, "fakesrc element");
   }
   return fakesrc_output_type;
 }
@@ -158,6 +157,7 @@ gst_fakesrc_filltype_get_type (void)
   return fakesrc_filltype_type;
 }
 
+static void            gst_fakesrc_base_init           (gpointer g_class);
 static void            gst_fakesrc_class_init          (GstFakeSrcClass *klass);
 static void            gst_fakesrc_init                (GstFakeSrc *fakesrc);
 
@@ -184,7 +184,7 @@ gst_fakesrc_get_type (void)
   if (!fakesrc_type) {
     static const GTypeInfo fakesrc_info = {
       sizeof(GstFakeSrcClass),
-      NULL,
+      gst_fakesrc_base_init,
       NULL,
       (GClassInitFunc)gst_fakesrc_class_init,
       NULL,
@@ -199,6 +199,14 @@ gst_fakesrc_get_type (void)
 }
 
 static void
+gst_fakesrc_base_init (gpointer g_class)
+{
+  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); 
+  
+  gst_element_class_set_details (gstelement_class, &gst_fakesrc_details);
+  gst_element_class_add_pad_template (gstelement_class, GST_PAD_TEMPLATE_GET (fakesrc_src_factory));
+}
+static void
 gst_fakesrc_class_init (GstFakeSrcClass *klass) 
 {
   GObjectClass *gobject_class;
@@ -879,10 +887,3 @@ gst_fakesrc_change_state (GstElement *element)
   return GST_STATE_SUCCESS;
 }
 
-gboolean
-gst_fakesrc_factory_init (GstElementFactory *factory)
-{
-  gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (fakesrc_src_factory));
-
-  return TRUE;
-}
index 1dbb4f0..5b3b875 100644 (file)
@@ -28,8 +28,6 @@
 
 G_BEGIN_DECLS
 
-extern GstElementDetails gst_fakesrc_details;
-GST_DEBUG_CATEGORY_EXTERN(gst_fakesrc_debug);
 
 typedef enum {
   FAKESRC_FIRST_LAST_LOOP = 1,
index b3f2159..b0ecc94 100644 (file)
 #include "gstfdsink.h"
 #include <unistd.h>
 
-GST_DEBUG_CATEGORY (gst_fdsink_debug);
+GST_DEBUG_CATEGORY_STATIC (gst_fdsink_debug);
 #define GST_CAT_DEFAULT gst_fdsink_debug
 
-GstElementDetails gst_fdsink_details = {
+GstElementDetails gst_fdsink_details = GST_ELEMENT_DETAILS (
   "Filedescriptor Sink",
   "Sink/File",
-  "LGPL",
   "Write data to a file descriptor",
-  VERSION,
-  "Erik Walthinsen <omega@cse.ogi.edu>",
-  "(C) 1999",
-};
+  "Erik Walthinsen <omega@cse.ogi.edu>"
+);
 
 
 /* FdSink signals and args */
@@ -53,6 +50,7 @@ enum {
 };
 
 
+static void    gst_fdsink_base_init    (gpointer g_class);
 static void    gst_fdsink_class_init   (GstFdSinkClass *klass);
 static void    gst_fdsink_init         (GstFdSink *fdsink);
 
@@ -73,7 +71,8 @@ gst_fdsink_get_type (void)
 
   if (!fdsink_type) {
     static const GTypeInfo fdsink_info = {
-      sizeof(GstFdSinkClass),      NULL,
+      sizeof(GstFdSinkClass),
+      gst_fdsink_base_init,
       NULL,
       (GClassInitFunc)gst_fdsink_class_init,
       NULL,
@@ -83,16 +82,25 @@ gst_fdsink_get_type (void)
       (GInstanceInitFunc)gst_fdsink_init,
     };
     fdsink_type = g_type_register_static (GST_TYPE_ELEMENT, "GstFdSink", &fdsink_info, 0);
+  
+    GST_DEBUG_CATEGORY_INIT (gst_fdsink_debug, "fdsink", 0, "fdsink element");
   }
   return fdsink_type;
 }
 
 static void
+gst_fdsink_base_init (gpointer g_class)
+{
+  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+  
+  gst_element_class_set_details (gstelement_class, &gst_fdsink_details);
+}
+static void
 gst_fdsink_class_init (GstFdSinkClass *klass) 
 {
   GObjectClass *gobject_class;
 
-  gobject_class = (GObjectClass*)klass;
+  gobject_class = G_OBJECT_CLASS (klass);
 
   parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
 
index 4f6dfb6..838705a 100644 (file)
@@ -28,8 +28,6 @@
 
 G_BEGIN_DECLS
 
-extern GstElementDetails gst_fdsink_details;
-GST_DEBUG_CATEGORY_EXTERN(gst_fdsink_debug);
 
 #define GST_TYPE_FDSINK \
   (gst_fdsink_get_type())
index 9970399..de7359c 100644 (file)
 
 #define DEFAULT_BLOCKSIZE      4096
 
-GST_DEBUG_CATEGORY (gst_fdsrc_debug);
+GST_DEBUG_CATEGORY_STATIC (gst_fdsrc_debug);
 #define GST_CAT_DEFAULT gst_fdsrc_debug
 
-GstElementDetails gst_fdsrc_details = 
-{
+GstElementDetails gst_fdsrc_details = GST_ELEMENT_DETAILS (
   "Disk Source",
   "Source/File",
-  "LGPL",
   "Synchronous read from a file",
-  VERSION,
-  "Erik Walthinsen <omega@cse.ogi.edu>",
-  "(C) 1999",
-};
+  "Erik Walthinsen <omega@cse.ogi.edu>"
+);
 
 
 /* FdSrc signals and args */
@@ -62,7 +58,7 @@ enum {
   ARG_BLOCKSIZE,
 };
 
-
+static void            gst_fdsrc_base_init     (gpointer g_class);
 static void            gst_fdsrc_class_init    (GstFdSrcClass *klass);
 static void            gst_fdsrc_init          (GstFdSrc *fdsrc);
 
@@ -85,7 +81,7 @@ gst_fdsrc_get_type (void)
   if (!fdsrc_type) {
     static const GTypeInfo fdsrc_info = {
       sizeof(GstFdSrcClass),      
-      NULL,
+      gst_fdsrc_base_init,
       NULL,
       (GClassInitFunc)gst_fdsrc_class_init,
       NULL,
@@ -95,17 +91,26 @@ gst_fdsrc_get_type (void)
       (GInstanceInitFunc)gst_fdsrc_init,
     };
     fdsrc_type = g_type_register_static (GST_TYPE_ELEMENT, "GstFdSrc", &fdsrc_info, 0);
+  
+    GST_DEBUG_CATEGORY_INIT (gst_fdsrc_debug, "fdsrc", 0, "fdsrc element");
   }
   return fdsrc_type;
 }
 
 static void
+gst_fdsrc_base_init (gpointer g_class)
+{
+  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+  
+  gst_element_class_set_details (gstelement_class, &gst_fdsrc_details);
+}
+static void
 gst_fdsrc_class_init (GstFdSrcClass *klass) 
 {
   GObjectClass *gobject_class;
 
-  gobject_class = (GObjectClass*)klass;
-
+  gobject_class = G_OBJECT_CLASS (klass);
+  
   parent_class = g_type_class_ref(GST_TYPE_ELEMENT);
 
   g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FD,
index a17b2d5..b004e0b 100644 (file)
@@ -28,8 +28,6 @@
 
 G_BEGIN_DECLS
 
-extern GstElementDetails gst_fdsrc_details;
-GST_DEBUG_CATEGORY_EXTERN(gst_fdsrc_debug);
 
 #define GST_TYPE_FDSRC \
   (gst_fdsrc_get_type())
index 88372f7..5c4c81c 100644 (file)
 #include <sys/types.h>
 #include <unistd.h>
 
-GST_DEBUG_CATEGORY (gst_filesink_debug);
+GST_DEBUG_CATEGORY_STATIC (gst_filesink_debug);
 #define GST_CAT_DEFAULT gst_filesink_debug
 
-GstElementDetails gst_filesink_details = {
+GstElementDetails gst_filesink_details = GST_ELEMENT_DETAILS (
   "File Sink",
   "Sink/File",
-  "LGPL",
   "Write stream to a file",
-  VERSION,
-  "Thomas <thomas@apestaart.org>",
-  "(C) 2001"
-};
+  "Thomas <thomas@apestaart.org>"
+);
 
 
 /* FileSink signals and args */
@@ -69,6 +66,7 @@ GST_PAD_FORMATS_FUNCTION (gst_filesink_get_formats,
 )
 
 
+static void    gst_filesink_base_init          (gpointer g_class);
 static void    gst_filesink_class_init         (GstFileSinkClass *klass);
 static void    gst_filesink_init               (GstFileSink *filesink);
 
@@ -97,7 +95,8 @@ gst_filesink_get_type (void)
 
   if (!filesink_type) {
     static const GTypeInfo filesink_info = {
-      sizeof(GstFileSinkClass),      NULL,
+      sizeof(GstFileSinkClass),
+      gst_filesink_base_init,
       NULL,
       (GClassInitFunc)gst_filesink_class_init,
       NULL,
@@ -107,20 +106,26 @@ gst_filesink_get_type (void)
       (GInstanceInitFunc)gst_filesink_init,
     };
     filesink_type = g_type_register_static (GST_TYPE_ELEMENT, "GstFileSink", &filesink_info, 0);
+  
+    GST_DEBUG_CATEGORY_INIT (gst_filesink_debug, "filesink", 0, "filesink element");
   }
   return filesink_type;
 }
 
 static void
-gst_filesink_class_init (GstFileSinkClass *klass) 
+gst_filesink_base_init (gpointer g_class)
 {
-  GObjectClass *gobject_class;
-  GstElementClass *gstelement_class;
+  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
 
-  gobject_class = (GObjectClass*)klass;
-  gstelement_class = (GstElementClass*)klass;
+  gstelement_class->change_state = gst_filesink_change_state;
+  gst_element_class_set_details (gstelement_class, &gst_filesink_details);
+}
+static void
+gst_filesink_class_init (GstFileSinkClass *klass) 
+{
+  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
 
-  parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
+  parent_class = g_type_class_peek_parent (klass);
 
   g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LOCATION,
     g_param_spec_string ("location", "File Location", "Location of the file to write",
@@ -133,8 +138,6 @@ gst_filesink_class_init (GstFileSinkClass *klass)
 
   gobject_class->set_property = gst_filesink_set_property;
   gobject_class->get_property = gst_filesink_get_property;
-
-  gstelement_class->change_state = gst_filesink_change_state;
 }
 
 static void 
index 99e38eb..b72551b 100644 (file)
@@ -28,8 +28,6 @@
 
 G_BEGIN_DECLS
 
-extern GstElementDetails gst_filesink_details;
-GST_DEBUG_CATEGORY_EXTERN(gst_filesink_debug);
 
 #define GST_TYPE_FILESINK \
   (gst_filesink_get_type())
index d3288d6..f243d97 100644 (file)
  */
 
 
-GST_DEBUG_CATEGORY (gst_filesrc_debug);
+GST_DEBUG_CATEGORY_STATIC (gst_filesrc_debug);
 #define GST_CAT_DEFAULT gst_filesrc_debug
 
-GstElementDetails gst_filesrc_details = {
+GstElementDetails gst_filesrc_details = GST_ELEMENT_DETAILS (
   "File Source",
   "Source/File",
-  "LGPL",
   "Read from arbitrary point in a file",
-  VERSION,
-  "Erik Walthinsen <omega@cse.ogi.edu>",
-  "(C) 1999",
-};
+  "Erik Walthinsen <omega@cse.ogi.edu>"
+);
 
 #define DEFAULT_BLOCKSIZE      4*1024
 #define DEFAULT_MMAPSIZE       4*1024*1024
@@ -121,6 +118,7 @@ GST_PAD_FORMATS_FUNCTION (gst_filesrc_get_formats,
   GST_FORMAT_BYTES
 )
 
+static void            gst_filesrc_base_init           (gpointer g_class);
 static void            gst_filesrc_class_init          (GstFileSrcClass *klass);
 static void            gst_filesrc_init                (GstFileSrc *filesrc);
 static void            gst_filesrc_dispose             (GObject *object);
@@ -148,7 +146,8 @@ gst_filesrc_get_type(void)
 
   if (!filesrc_type) {
     static const GTypeInfo filesrc_info = {
-      sizeof(GstFileSrcClass),      NULL,
+      sizeof(GstFileSrcClass), 
+      gst_filesrc_base_init,
       NULL,
       (GClassInitFunc)gst_filesrc_class_init,
       NULL,
@@ -158,20 +157,28 @@ gst_filesrc_get_type(void)
       (GInstanceInitFunc)gst_filesrc_init,
     };
     filesrc_type = g_type_register_static (GST_TYPE_ELEMENT, "GstFileSrc", &filesrc_info, 0);
+
+    GST_DEBUG_CATEGORY_INIT (gst_filesrc_debug, "filesrc", 0, "filesrc element");
   }
   return filesrc_type;
 }
 
 static void
+gst_filesrc_base_init (gpointer g_class)
+{
+  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+
+  gst_element_class_set_details (gstelement_class, &gst_filesrc_details);
+}
+static void
 gst_filesrc_class_init (GstFileSrcClass *klass)
 {
-  GObjectClass *gobject_class;
-  GstElementClass *gstelement_class;
+  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
 
   gobject_class = (GObjectClass*)klass;
-  gstelement_class = (GstElementClass*)klass;
 
-  parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
+  parent_class = g_type_class_peek_parent (klass);
 
   g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FD,
     g_param_spec_int ("fd", "File-descriptor", "File-descriptor for the file being mmap()d",
index f1600c9..23b6dde 100644 (file)
@@ -30,8 +30,6 @@
 
 G_BEGIN_DECLS
 
-extern GstElementDetails gst_filesrc_details;
-GST_DEBUG_CATEGORY_EXTERN(gst_filesrc_debug);
 
 #define GST_TYPE_FILESRC \
   (gst_filesrc_get_type())
index b6b77d6..24021be 100644 (file)
 
 #include "gstidentity.h"
 
-GST_DEBUG_CATEGORY (gst_identity_debug);
+GST_DEBUG_CATEGORY_STATIC (gst_identity_debug);
 #define GST_CAT_DEFAULT gst_identity_debug
 
-GstElementDetails gst_identity_details = {
+GstElementDetails gst_identity_details = GST_ELEMENT_DETAILS (
   "Identity",
   "Generic",
-  "LGPL",
   "Pass data without modification",
-  VERSION,
-  "Erik Walthinsen <omega@cse.ogi.edu>",
-  "(C) 1999",
-};
+  "Erik Walthinsen <omega@cse.ogi.edu>"
+);
 
 
 /* Identity signals and args */
@@ -64,6 +61,7 @@ enum {
 };
 
 
+static void gst_identity_base_init     (gpointer g_class);
 static void gst_identity_class_init    (GstIdentityClass *klass);
 static void gst_identity_init          (GstIdentity *identity);
 
@@ -82,7 +80,8 @@ gst_identity_get_type (void)
 
   if (!identity_type) {
     static const GTypeInfo identity_info = {
-      sizeof(GstIdentityClass),      NULL,
+      sizeof(GstIdentityClass),
+      gst_identity_base_init,
       NULL,
       (GClassInitFunc)gst_identity_class_init,
       NULL,
@@ -92,18 +91,27 @@ gst_identity_get_type (void)
       (GInstanceInitFunc)gst_identity_init,
     };
     identity_type = g_type_register_static (GST_TYPE_ELEMENT, "GstIdentity", &identity_info, 0);
+  
+    GST_DEBUG_CATEGORY_INIT (gst_identity_debug, "identity", 0, "identity element");
   }
   return identity_type;
 }
 
+static void
+gst_identity_base_init (gpointer g_class)
+{
+  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+  
+  gst_element_class_set_details (gstelement_class, &gst_identity_details);
+}
 static void 
 gst_identity_class_init (GstIdentityClass *klass) 
 {
   GObjectClass *gobject_class;
 
-  gobject_class = (GObjectClass*)klass;
+  gobject_class = G_OBJECT_CLASS (klass);
 
-  parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
+  parent_class = g_type_class_peek_parent (klass);
 
   g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LOOP_BASED,
     g_param_spec_boolean ("loop-based", "Loop-based", 
index dd04364..8e39b84 100644 (file)
@@ -29,8 +29,6 @@
 
 G_BEGIN_DECLS
 
-extern GstElementDetails gst_identity_details;
-GST_DEBUG_CATEGORY_EXTERN(gst_identity_debug);
 
 #define GST_TYPE_IDENTITY \
   (gst_identity_get_type())
index 114d78d..181487d 100644 (file)
 #include <gst/gst.h>
 #include "gstmd5sink.h"
 
-GST_DEBUG_CATEGORY (gst_md5sink_debug);
+GST_DEBUG_CATEGORY_STATIC (gst_md5sink_debug);
 #define GST_CAT_DEFAULT gst_md5sink_debug
 
+GstElementDetails gst_md5sink_details = GST_ELEMENT_DETAILS (
+  "MD5 Sink",
+  "Sink",
+  "compute MD5 for incoming data",
+  "Benjamin Otte <in7y118@public.uni-hamburg.de>"
+);
+
 /* MD5Sink signals and args */
 enum {
   /* FILL ME */
@@ -55,6 +62,7 @@ GST_PAD_TEMPLATE_FACTORY (md5_sink_factory,
 );
 
 /* GObject stuff */
+static void                    gst_md5sink_base_init           (gpointer g_class);
 static void                    gst_md5sink_class_init          (GstMD5SinkClass *klass);
 static void                    gst_md5sink_init                (GstMD5Sink *md5sink);
 
@@ -381,7 +389,7 @@ gst_md5sink_get_type (void)
   if (!md5sink_type) {
     static const GTypeInfo md5sink_info = {
       sizeof(GstMD5SinkClass),
-      NULL,
+      gst_md5sink_base_init,
       NULL,
       (GClassInitFunc) gst_md5sink_class_init,
       NULL,
@@ -392,11 +400,21 @@ gst_md5sink_get_type (void)
     };
     md5sink_type = g_type_register_static (GST_TYPE_ELEMENT, "GstMD5Sink", 
                                           &md5sink_info, 0);
+  
+    GST_DEBUG_CATEGORY_INIT (gst_md5sink_debug, "md5sink", 0, "md5sink element");
   }
   return md5sink_type;
 }
 
 static void
+gst_md5sink_base_init (gpointer g_class)
+{
+  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+  
+  gst_element_class_set_details (gstelement_class, &gst_md5sink_details);
+  gst_element_class_add_pad_template (gstelement_class, GST_PAD_TEMPLATE_GET (md5_sink_factory));
+}
+static void
 gst_md5sink_class_init (GstMD5SinkClass *klass) 
 {
   GObjectClass *gobject_class;
@@ -405,15 +423,15 @@ gst_md5sink_class_init (GstMD5SinkClass *klass)
   gobject_class = (GObjectClass *) klass;
   gstelement_class = (GstElementClass *) klass;
 
-  parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
+  parent_class = g_type_class_peek_parent (klass);
+
+  gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_md5sink_get_property);
 
   g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MD5,
     g_param_spec_string ("md5", "md5", "current value of the md5 sum",
                          "", G_PARAM_READABLE)); 
 
   gstelement_class->change_state = GST_DEBUG_FUNCPTR(gst_md5sink_change_state);
-
-  gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_md5sink_get_property);
 }
 
 static void 
@@ -508,20 +526,3 @@ gst_md5sink_chain (GstPad *pad, GstData *_data)
   gst_buffer_unref (buf);
 }
 
-GstElementDetails gst_md5sink_details = {
-  "MD5 Sink",
-  "Sink",
-  "LGPL",
-  "compute MD5 for incoming data",
-  VERSION,
-  "Benjamin Otte <in7y118@public.uni-hamburg.de>",
-  "(C) 2002",
-};
-
-gboolean
-gst_md5sink_factory_init (GstElementFactory *factory)
-{
-  gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (md5_sink_factory));
-
-  return TRUE;
-}
index 5d24df6..fc847b2 100644 (file)
@@ -29,8 +29,6 @@
 
 G_BEGIN_DECLS
 
-extern GstElementDetails gst_md5sink_details;
-GST_DEBUG_CATEGORY_EXTERN(gst_md5sink_debug);
 
 #define GST_TYPE_MD5SINK \
   (gst_md5sink_get_type())
index c2a0e6f..d3ca0d9 100644 (file)
 
 #include "gstmultidisksrc.h"
 
-GST_DEBUG_CATEGORY (gst_multidisksrc_debug);
+GST_DEBUG_CATEGORY_STATIC (gst_multidisksrc_debug);
 #define GST_CAT_DEFAULT gst_multidisksrc_debug
 
-GstElementDetails gst_multidisksrc_details = {
+GstElementDetails gst_multidisksrc_details = GST_ELEMENT_DETAILS (
   "Multi Disk Source",
   "Source/File",
-  "LGPL",
   "Read from multiple files in order",
-  VERSION,
-  "Dominic Ludlam <dom@openfx.org>",
-  "(C) 2001",
-};
+  "Dominic Ludlam <dom@openfx.org>"
+);
 
 /* DiskSrc signals and args */
 enum {
@@ -57,6 +54,7 @@ enum {
   ARG_LOCATIONS,
 };
 
+static void            gst_multidiscsrc_base_init      (gpointer g_class);
 static void            gst_multidisksrc_class_init     (GstMultiDiskSrcClass *klass);
 static void            gst_multidisksrc_init           (GstMultiDiskSrc *disksrc);
 
@@ -81,7 +79,8 @@ gst_multidisksrc_get_type(void)
 
   if (!multidisksrc_type) {
     static const GTypeInfo multidisksrc_info = {
-      sizeof(GstMultiDiskSrcClass),      NULL,
+      sizeof(GstMultiDiskSrcClass),
+      gst_multidiscsrc_base_init,
       NULL,
       (GClassInitFunc)gst_multidisksrc_class_init,
       NULL,
@@ -91,11 +90,20 @@ gst_multidisksrc_get_type(void)
       (GInstanceInitFunc)gst_multidisksrc_init,
     };
     multidisksrc_type = g_type_register_static (GST_TYPE_ELEMENT, "GstMultiDiskSrc", &multidisksrc_info, 0);
+  
+    GST_DEBUG_CATEGORY_INIT (gst_multidisksrc_debug, "multidisksrc", 0, "multidisksrc element");
   }
   return multidisksrc_type;
 }
 
 static void
+gst_multidiscsrc_base_init (gpointer g_class)
+{
+  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+  
+  gst_element_class_set_details (gstelement_class, &gst_multidisksrc_details);
+}
+static void
 gst_multidisksrc_class_init (GstMultiDiskSrcClass *klass)
 {
   GObjectClass *gobject_class;
index 07e8398..402cf4f 100644 (file)
@@ -28,8 +28,6 @@
 
 G_BEGIN_DECLS
 
-extern GstElementDetails gst_multidisksrc_details;
-GST_DEBUG_CATEGORY_EXTERN(gst_multidisksrc_debug);
 
 #define GST_TYPE_MULTIDISKSRC \
   (gst_multidisksrc_get_type())
index c2a0e6f..d3ca0d9 100644 (file)
 
 #include "gstmultidisksrc.h"
 
-GST_DEBUG_CATEGORY (gst_multidisksrc_debug);
+GST_DEBUG_CATEGORY_STATIC (gst_multidisksrc_debug);
 #define GST_CAT_DEFAULT gst_multidisksrc_debug
 
-GstElementDetails gst_multidisksrc_details = {
+GstElementDetails gst_multidisksrc_details = GST_ELEMENT_DETAILS (
   "Multi Disk Source",
   "Source/File",
-  "LGPL",
   "Read from multiple files in order",
-  VERSION,
-  "Dominic Ludlam <dom@openfx.org>",
-  "(C) 2001",
-};
+  "Dominic Ludlam <dom@openfx.org>"
+);
 
 /* DiskSrc signals and args */
 enum {
@@ -57,6 +54,7 @@ enum {
   ARG_LOCATIONS,
 };
 
+static void            gst_multidiscsrc_base_init      (gpointer g_class);
 static void            gst_multidisksrc_class_init     (GstMultiDiskSrcClass *klass);
 static void            gst_multidisksrc_init           (GstMultiDiskSrc *disksrc);
 
@@ -81,7 +79,8 @@ gst_multidisksrc_get_type(void)
 
   if (!multidisksrc_type) {
     static const GTypeInfo multidisksrc_info = {
-      sizeof(GstMultiDiskSrcClass),      NULL,
+      sizeof(GstMultiDiskSrcClass),
+      gst_multidiscsrc_base_init,
       NULL,
       (GClassInitFunc)gst_multidisksrc_class_init,
       NULL,
@@ -91,11 +90,20 @@ gst_multidisksrc_get_type(void)
       (GInstanceInitFunc)gst_multidisksrc_init,
     };
     multidisksrc_type = g_type_register_static (GST_TYPE_ELEMENT, "GstMultiDiskSrc", &multidisksrc_info, 0);
+  
+    GST_DEBUG_CATEGORY_INIT (gst_multidisksrc_debug, "multidisksrc", 0, "multidisksrc element");
   }
   return multidisksrc_type;
 }
 
 static void
+gst_multidiscsrc_base_init (gpointer g_class)
+{
+  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+  
+  gst_element_class_set_details (gstelement_class, &gst_multidisksrc_details);
+}
+static void
 gst_multidisksrc_class_init (GstMultiDiskSrcClass *klass)
 {
   GObjectClass *gobject_class;
index 07e8398..402cf4f 100644 (file)
@@ -28,8 +28,6 @@
 
 G_BEGIN_DECLS
 
-extern GstElementDetails gst_multidisksrc_details;
-GST_DEBUG_CATEGORY_EXTERN(gst_multidisksrc_debug);
 
 #define GST_TYPE_MULTIDISKSRC \
   (gst_multidisksrc_get_type())
index e31e0e2..611f942 100644 (file)
 
 #include "gstpipefilter.h"
 
-GST_DEBUG_CATEGORY (gst_pipefilter_debug);
+GST_DEBUG_CATEGORY_STATIC (gst_pipefilter_debug);
 #define GST_CAT_DEFAULT gst_pipefilter_debug
 
-GstElementDetails gst_pipefilter_details = {
+GstElementDetails gst_pipefilter_details = GST_ELEMENT_DETAILS (
   "Pipefilter",
   "Filter",
-  "LGPL",
   "Interoperate with an external program using stdin and stdout",
-  VERSION,
-  "Erik Walthinsen <omega@cse.ogi.edu>\n"
-  "Wim Taymans <wim.taymans@chello.be>",
-  "(C) 1999",
-};
+  "Erik Walthinsen <omega@cse.ogi.edu>, "
+  "Wim Taymans <wim.taymans@chello.be>"
+);
 
 
 /* Pipefilter signals and args */
@@ -62,13 +59,14 @@ enum {
 };
 
 
+static void                    gst_pipefilter_base_init        (gpointer g_class);
 static void                    gst_pipefilter_class_init       (GstPipefilterClass *klass);
 static void                    gst_pipefilter_init             (GstPipefilter *pipefilter);
 
 static void                    gst_pipefilter_set_property     (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
 static void                    gst_pipefilter_get_property     (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
 
-static GstData*                gst_pipefilter_get              (GstPad *pad);
+static GstData*                        gst_pipefilter_get              (GstPad *pad);
 static void                    gst_pipefilter_chain            (GstPad *pad, GstData *_data);
 static gboolean                gst_pipefilter_handle_event     (GstPad *pad, GstEvent *event);
 
@@ -84,7 +82,8 @@ gst_pipefilter_get_type (void)
 
   if (!pipefilter_type) {
     static const GTypeInfo pipefilter_info = {
-      sizeof(GstPipefilterClass),      NULL,
+      sizeof(GstPipefilterClass),
+      gst_pipefilter_base_init,
       NULL,
       (GClassInitFunc)gst_pipefilter_class_init,
       NULL,
@@ -94,10 +93,19 @@ gst_pipefilter_get_type (void)
       (GInstanceInitFunc)gst_pipefilter_init,
     };
     pipefilter_type = g_type_register_static(GST_TYPE_ELEMENT, "GstPipefilter", &pipefilter_info, 0);
+  
+    GST_DEBUG_CATEGORY_INIT (gst_pipefilter_debug, "pipefilter", 0, "pipefilter element");
   }
   return pipefilter_type;
 }
 
+static void
+gst_pipefilter_base_init (gpointer g_class)
+{
+  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+  
+  gst_element_class_set_details (gstelement_class, &gst_pipefilter_details);
+}
 static void 
 gst_pipefilter_class_init (GstPipefilterClass *klass)
 {
@@ -109,14 +117,14 @@ gst_pipefilter_class_init (GstPipefilterClass *klass)
 
   parent_class = g_type_class_ref(GST_TYPE_ELEMENT);
 
-  gstelement_class->change_state = gst_pipefilter_change_state;
+  gobject_class->set_property = gst_pipefilter_set_property;  
+  gobject_class->get_property = gst_pipefilter_get_property;
 
   g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_COMMAND,
     g_param_spec_string("command","command","command",
                         NULL, G_PARAM_READWRITE)); /* CHECKME */
 
-  gobject_class->set_property = gst_pipefilter_set_property;  
-  gobject_class->get_property = gst_pipefilter_get_property;
+  gstelement_class->change_state = gst_pipefilter_change_state;
 }
 
 static void
index 9516482..08c3a47 100644 (file)
@@ -29,8 +29,6 @@
 
 G_BEGIN_DECLS
 
-extern GstElementDetails gst_pipefilter_details;
-GST_DEBUG_CATEGORY_EXTERN(gst_pipefilter_debug);
 
 #define GST_TYPE_PIPEFILTER \
   (gst_pipefilter_get_type())
index c192424..5c22dc0 100644 (file)
 #include "gstevent.h"
 #include "gstinfo.h"
 
-GstElementDetails gst_queue_details = {
+static GstElementDetails gst_queue_details = GST_ELEMENT_DETAILS (
   "Queue",
   "Generic",
-  "LGPL",
   "Simple data queue",
-  VERSION,
-  "Erik Walthinsen <omega@cse.ogi.edu>",
-  "(C) 1999",
-};
+  "Erik Walthinsen <omega@cse.ogi.edu>"
+);
 
 
 /* Queue signals and args */
@@ -62,9 +59,11 @@ enum {
   ARG_BLOCK_TIMEOUT,
 };
 
-
-static void                    gst_queue_class_init            (GstQueueClass *klass);
-static void                    gst_queue_init                  (GstQueue *queue);
+static void                    gst_queue_base_init             (gpointer g_class);
+static void                    gst_queue_class_init            (gpointer g_class,
+                                                                gpointer class_data);
+static void                    gst_queue_init                  (GTypeInstance *instance,
+                                                                gpointer g_class);
 static void                    gst_queue_dispose               (GObject *object);
 
 static void                    gst_queue_set_property          (GObject *object, guint prop_id, 
@@ -112,14 +111,14 @@ gst_queue_get_type(void)
   if (!queue_type) {
     static const GTypeInfo queue_info = {
       sizeof(GstQueueClass),
+      gst_queue_base_init,
       NULL,
-      NULL,
-      (GClassInitFunc)gst_queue_class_init,
+      gst_queue_class_init,
       NULL,
       NULL,
       sizeof(GstQueue),
       4,
-      (GInstanceInitFunc)gst_queue_init,
+      gst_queue_init,
       NULL
     };
     queue_type = g_type_register_static (GST_TYPE_ELEMENT, "GstQueue", &queue_info, 0);
@@ -128,37 +127,43 @@ gst_queue_get_type(void)
 }
 
 static void
-gst_queue_class_init (GstQueueClass *klass)
+gst_queue_base_init (gpointer g_class)
 {
-  GObjectClass *gobject_class;
-  GstElementClass *gstelement_class;
+  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+
+  gst_element_class_set_details (gstelement_class, &gst_queue_details);
+}
 
-  gobject_class = (GObjectClass*)klass;
-  gstelement_class = (GstElementClass*)klass;
+static void
+gst_queue_class_init (gpointer g_class, gpointer class_data)
+{
+  GObjectClass *gobject_class = G_OBJECT_CLASS (g_class);
+  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+  GstQueueClass *gstqueue_class = GST_QUEUE_CLASS (g_class);
 
-  parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
+  parent_class = g_type_class_peek_parent (g_class);
 
   gst_queue_signals[FULL] =
-    g_signal_new ("full", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST,
+    g_signal_new ("full", G_TYPE_FROM_CLASS (gstqueue_class), G_SIGNAL_RUN_FIRST,
                   G_STRUCT_OFFSET (GstQueueClass, full), NULL, NULL,
                  g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
-  g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LEAKY,
+  g_object_class_install_property (G_OBJECT_CLASS (gstqueue_class), ARG_LEAKY,
     g_param_spec_enum ("leaky", "Leaky", "Where the queue leaks, if at all.",
                        GST_TYPE_QUEUE_LEAKY, GST_QUEUE_NO_LEAK, G_PARAM_READWRITE));
-  g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LEVEL,
+  g_object_class_install_property (G_OBJECT_CLASS (gstqueue_class), ARG_LEVEL,
     g_param_spec_int ("level", "Level", "How many buffers are in the queue.",
                       0, G_MAXINT, 0, G_PARAM_READABLE));
-  g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MAX_LEVEL,
+  g_object_class_install_property (G_OBJECT_CLASS (gstqueue_class), ARG_MAX_LEVEL,
     g_param_spec_int ("max_level", "Maximum Level", "How many buffers the queue holds.",
                       0, G_MAXINT, 100, G_PARAM_READWRITE));
-  g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MIN_THRESHOLD_BYTES,
+  g_object_class_install_property (G_OBJECT_CLASS (gstqueue_class), ARG_MIN_THRESHOLD_BYTES,
     g_param_spec_int ("min_threshold_bytes", "Minimum Threshold",
                       "Minimum bytes required before signalling not_empty to reader.",
                       0, G_MAXINT, 0, G_PARAM_READWRITE));
-  g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MAY_DEADLOCK,
+  g_object_class_install_property (G_OBJECT_CLASS (gstqueue_class), ARG_MAY_DEADLOCK,
     g_param_spec_boolean ("may_deadlock", "May Deadlock", "The queue may deadlock if it's full and not PLAYING",
                       TRUE, G_PARAM_READWRITE));
-  g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BLOCK_TIMEOUT,
+  g_object_class_install_property (G_OBJECT_CLASS (gstqueue_class), ARG_BLOCK_TIMEOUT,
     g_param_spec_int ("block_timeout", "Timeout for Block", 
                       "Microseconds until blocked queue times out and returns filler event. "
                       "Value of -1 disables timeout",
@@ -204,8 +209,10 @@ gst_queue_getcaps (GstPad *pad, GstCaps *caps)
 }
 
 static void
-gst_queue_init (GstQueue *queue)
+gst_queue_init (GTypeInstance *instance, gpointer g_class)
 {
+  GstQueue *queue = GST_QUEUE (instance);
+  
   /* scheduling on this kind of element is, well, interesting */
   GST_FLAG_SET (queue, GST_ELEMENT_DECOUPLED);
   GST_FLAG_SET (queue, GST_ELEMENT_EVENT_AWARE);
index e7ee592..c52d637 100644 (file)
@@ -30,9 +30,6 @@
 
 G_BEGIN_DECLS
 
-extern GstElementDetails gst_queue_details;
-
-
 #define GST_TYPE_QUEUE \
   (gst_queue_get_type())
 #define GST_QUEUE(obj) \
index 57fcf56..5cf0686 100644 (file)
 
 #include "gstshaper.h"
 
-GST_DEBUG_CATEGORY (gst_shaper_debug);
+GST_DEBUG_CATEGORY_STATIC (gst_shaper_debug);
 #define GST_CAT_DEFAULT gst_shaper_debug
 
-GstElementDetails gst_shaper_details = {
+GstElementDetails gst_shaper_details = GST_ELEMENT_DETAILS (
   "Shaper",
   "Generic",
-  "LGPL",
   "Synchronizes streams on different pads",
-  VERSION,
-  "Wim Taymans <wim.taymans@chello.be>",
-  "(C) 2003",
-};
+  "Wim Taymans <wim.taymans@chello.be>"
+);
 
 
 /* Shaper signals and args */
@@ -93,6 +90,7 @@ gst_shaper_policy_get_type (void)
   return shaper_policy_type;
 }
 
+static void    gst_shaper_base_init            (gpointer g_class);
 static void    gst_shaper_class_init           (GstShaperClass *klass);
 static void    gst_shaper_init                 (GstShaper *shaper);
 
@@ -116,7 +114,8 @@ gst_shaper_get_type (void)
 
   if (!shaper_type) {
     static const GTypeInfo shaper_info = {
-      sizeof(GstShaperClass),      NULL,
+      sizeof(GstShaperClass),
+      gst_shaper_base_init,
       NULL,
       (GClassInitFunc)gst_shaper_class_init,
       NULL,
@@ -126,10 +125,21 @@ gst_shaper_get_type (void)
       (GInstanceInitFunc)gst_shaper_init,
     };
     shaper_type = g_type_register_static (GST_TYPE_ELEMENT, "GstShaper", &shaper_info, 0);
+  
+    GST_DEBUG_CATEGORY_INIT (gst_shaper_debug, "shaper", 0, "shaper element");
   }
   return shaper_type;
 }
 
+static void
+gst_shaper_base_init (gpointer g_class)
+{
+  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+  
+  gst_element_class_set_details (gstelement_class, &gst_shaper_details);
+  gst_element_class_add_pad_template (gstelement_class, GST_PAD_TEMPLATE_GET (shaper_src_factory));
+  gst_element_class_add_pad_template (gstelement_class, GST_PAD_TEMPLATE_GET (shaper_sink_factory));
+}
 static void 
 gst_shaper_class_init (GstShaperClass *klass) 
 {
@@ -380,11 +390,3 @@ static void gst_shaper_get_property(GObject *object, guint prop_id, GValue *valu
   }
 }
 
-gboolean
-gst_shaper_factory_init (GstElementFactory *factory)
-{
-  gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (shaper_src_factory));
-  gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (shaper_sink_factory));
-
-  return TRUE;
-}
index 71995ae..2cbaf53 100644 (file)
@@ -29,8 +29,6 @@
 
 G_BEGIN_DECLS
 
-extern GstElementDetails gst_shaper_details;
-GST_DEBUG_CATEGORY_EXTERN(gst_shaper_debug);
 
 #define GST_TYPE_SHAPER \
   (gst_shaper_get_type())
index 3cbcebc..5c72fbe 100644 (file)
 
 #include "gststatistics.h"
 
-GST_DEBUG_CATEGORY (gst_statistics_debug);
+GST_DEBUG_CATEGORY_STATIC (gst_statistics_debug);
 #define GST_CAT_DEFAULT gst_statistics_debug
 
-GstElementDetails gst_statistics_details = {
+GstElementDetails gst_statistics_details = GST_ELEMENT_DETAILS (
   "Statistics",
   "Generic",
-  "LGPL",
   "Statistics on buffers/bytes/events",
-  VERSION,
-  "David I. Lehn <dlehn@users.sourceforge.net>",
-  "(C) 2001",
-};
+  "David I. Lehn <dlehn@users.sourceforge.net>"
+);
 
 
 /* Statistics signals and args */
@@ -61,6 +58,7 @@ enum {
 };
 
 
+static void gst_statistics_base_init   (gpointer g_class);
 static void gst_statistics_class_init  (GstStatisticsClass *klass);
 static void gst_statistics_init                (GstStatistics *statistics);
 
@@ -83,7 +81,8 @@ gst_statistics_get_type (void)
 
   if (!statistics_type) {
     static const GTypeInfo statistics_info = {
-      sizeof(GstStatisticsClass),      NULL,
+      sizeof(GstStatisticsClass), 
+      gst_statistics_base_init,
       NULL,
       (GClassInitFunc)gst_statistics_class_init,
       NULL,
@@ -93,18 +92,27 @@ gst_statistics_get_type (void)
       (GInstanceInitFunc)gst_statistics_init,
     };
     statistics_type = g_type_register_static (GST_TYPE_ELEMENT, "GstStatistics", &statistics_info, 0);
+  
+    GST_DEBUG_CATEGORY_INIT (gst_statistics_debug, "statistics", 0, "statistics element");
   }
   return statistics_type;
 }
 
+static void
+gst_statistics_base_init (gpointer g_class)
+{
+  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+  
+  gst_element_class_set_details (gstelement_class, &gst_statistics_details);
+}
 static void 
 gst_statistics_class_init (GstStatisticsClass *klass) 
 {
   GObjectClass *gobject_class;
+  
+  gobject_class = G_OBJECT_CLASS (klass);
 
-  gobject_class = (GObjectClass*)klass;
-
-  parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
+  parent_class = g_type_class_peek_parent (klass);
 
   g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BUFFERS,
     g_param_spec_int64 ("buffers", "buffers", "total buffers count",
index aedf00a..4c1ab57 100644 (file)
@@ -28,8 +28,6 @@
 
 G_BEGIN_DECLS
 
-extern GstElementDetails gst_statistics_details;
-GST_DEBUG_CATEGORY_EXTERN(gst_statistics_debug);
 
 #define GST_TYPE_STATISTICS \
   (gst_statistics_get_type())
index bfc4f8f..4f0249f 100644 (file)
 
 #include "gsttee.h"
 
-GST_DEBUG_CATEGORY (gst_tee_debug);
+GST_DEBUG_CATEGORY_STATIC (gst_tee_debug);
 #define GST_CAT_DEFAULT gst_tee_debug
 
-GstElementDetails gst_tee_details = {
+GstElementDetails gst_tee_details = GST_ELEMENT_DETAILS (
   "Tee pipe fitting",
   "Generic",
-  "LGPL",
   "1-to-N pipe fitting",
-  VERSION,
-  "Erik Walthinsen <omega@cse.ogi.edu>\n"
-  "Wim Taymans <wim.taymans@chello.be>",
-  "(C) 1999, 2000",
-};
+  "Erik Walthinsen <omega@cse.ogi.edu>, "
+  "Wim Taymans <wim.taymans@chello.be>"
+);
 
 /* Tee signals and args */
 enum {
@@ -61,6 +58,7 @@ GST_PAD_TEMPLATE_FACTORY (tee_src_factory,
   GST_CAPS_ANY
 );
 
+static void    gst_tee_base_init       (gpointer g_class);
 static void    gst_tee_class_init      (GstTeeClass *klass);
 static void    gst_tee_init            (GstTee *tee);
 
@@ -83,7 +81,8 @@ gst_tee_get_type(void) {
 
   if (!tee_type) {
     static const GTypeInfo tee_info = {
-      sizeof(GstTeeClass),      NULL,
+      sizeof(GstTeeClass),
+      gst_tee_base_init,
       NULL,
       (GClassInitFunc)gst_tee_class_init,
       NULL,
@@ -93,11 +92,21 @@ gst_tee_get_type(void) {
       (GInstanceInitFunc)gst_tee_init,
     };
     tee_type = g_type_register_static (GST_TYPE_ELEMENT, "GstTee", &tee_info, 0);
+  
+    GST_DEBUG_CATEGORY_INIT (gst_tee_debug, "tee", 0, "tee element");
   }
   return tee_type;
 }
 
 static void
+gst_tee_base_init (gpointer g_class)
+{
+  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+  
+  gst_element_class_set_details (gstelement_class, &gst_tee_details);
+  gst_element_class_add_pad_template (gstelement_class, GST_PAD_TEMPLATE_GET (tee_src_factory));
+}
+static void
 gst_tee_class_init (GstTeeClass *klass) 
 {
   GObjectClass *gobject_class;
@@ -380,10 +389,3 @@ gst_tee_chain (GstPad *pad, GstData *_data)
   }
 }
 
-gboolean
-gst_tee_factory_init (GstElementFactory *factory)
-{
-  gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (tee_src_factory));
-
-  return TRUE;
-}
index 0193bb0..b58a6c0 100644 (file)
@@ -28,8 +28,6 @@
 
 G_BEGIN_DECLS
 
-extern GstElementDetails gst_tee_details;
-GST_DEBUG_CATEGORY_EXTERN(gst_tee_debug);
 
 #define GST_TYPE_TEE \
   (gst_tee_get_type())
index bd5e3d3..7d38b0f 100644 (file)
 
 #include <gst/gsttypefind.h>
 
-GST_DEBUG_CATEGORY (gst_type_find_element_debug);
+GST_DEBUG_CATEGORY_STATIC (gst_type_find_element_debug);
 #define GST_CAT_DEFAULT gst_type_find_element_debug
 
-GstElementDetails gst_type_find_element_details = {
+GstElementDetails gst_type_find_element_details = GST_ELEMENT_DETAILS (
   "TypeFind",
   "Generic",
-  "LGPL",
   "Finds the media type of a stream",
-  VERSION,
-  "Benjamin Otte <in7y118@public.uni-hamburg.de>",
-  "(C) 2003",
-};
+  "Benjamin Otte <in7y118@public.uni-hamburg.de>"
+);
 
 /* generic templates */
 GST_PAD_TEMPLATE_FACTORY (type_find_element_sink_factory,
@@ -87,6 +84,7 @@ enum {
 };
 
 
+static void    gst_type_find_element_base_init         (gpointer g_class);
 static void    gst_type_find_element_class_init        (gpointer       g_class,
                                                         gpointer       class_data);
 static void    gst_type_find_element_init              (GTypeInstance *instance,
@@ -122,7 +120,7 @@ gst_type_find_element_get_type (void)
   if (!typefind_type) {
     static const GTypeInfo typefind_info = {
       sizeof (GstTypeFindElementClass),
-      NULL,
+      gst_type_find_element_base_init,
       NULL,
       gst_type_find_element_class_init,
       NULL,
@@ -135,6 +133,9 @@ gst_type_find_element_get_type (void)
     typefind_type = g_type_register_static (GST_TYPE_ELEMENT,
                                            "GstTypeFindElement",
                                            &typefind_info, 0);
+
+    GST_DEBUG_CATEGORY_INIT (gst_type_find_element_debug, "typefind", 
+                            GST_DEBUG_BG_YELLOW | GST_DEBUG_FG_GREEN, "typefind element");
   }
   return typefind_type;
 }
@@ -155,6 +156,13 @@ gst_type_find_element_have_type (GstTypeFindElement *typefind, guint probability
   }
 }
 static void
+gst_type_find_element_base_init (gpointer g_class)
+{
+  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+  
+  gst_element_class_set_details (gstelement_class, &gst_type_find_element_details);
+}
+static void
 gst_type_find_element_class_init (gpointer g_class, gpointer class_data)
 {
   GObjectClass *gobject_class;
index 4b5e0cc..7f508ba 100644 (file)
@@ -30,9 +30,7 @@
 
 G_BEGIN_DECLS
 
-GST_DEBUG_CATEGORY_EXTERN(gst_type_find_element_debug);
 
-extern GstElementDetails gst_type_find_element_details;
 
 #define GST_TYPE_TYPE_FIND_ELEMENT             (gst_type_find_element_get_type ())
 #define GST_TYPE_FIND_ELEMENT(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_TYPE_FIND_ELEMENT, GstTypeFindElement))
index bd5e3d3..7d38b0f 100644 (file)
 
 #include <gst/gsttypefind.h>
 
-GST_DEBUG_CATEGORY (gst_type_find_element_debug);
+GST_DEBUG_CATEGORY_STATIC (gst_type_find_element_debug);
 #define GST_CAT_DEFAULT gst_type_find_element_debug
 
-GstElementDetails gst_type_find_element_details = {
+GstElementDetails gst_type_find_element_details = GST_ELEMENT_DETAILS (
   "TypeFind",
   "Generic",
-  "LGPL",
   "Finds the media type of a stream",
-  VERSION,
-  "Benjamin Otte <in7y118@public.uni-hamburg.de>",
-  "(C) 2003",
-};
+  "Benjamin Otte <in7y118@public.uni-hamburg.de>"
+);
 
 /* generic templates */
 GST_PAD_TEMPLATE_FACTORY (type_find_element_sink_factory,
@@ -87,6 +84,7 @@ enum {
 };
 
 
+static void    gst_type_find_element_base_init         (gpointer g_class);
 static void    gst_type_find_element_class_init        (gpointer       g_class,
                                                         gpointer       class_data);
 static void    gst_type_find_element_init              (GTypeInstance *instance,
@@ -122,7 +120,7 @@ gst_type_find_element_get_type (void)
   if (!typefind_type) {
     static const GTypeInfo typefind_info = {
       sizeof (GstTypeFindElementClass),
-      NULL,
+      gst_type_find_element_base_init,
       NULL,
       gst_type_find_element_class_init,
       NULL,
@@ -135,6 +133,9 @@ gst_type_find_element_get_type (void)
     typefind_type = g_type_register_static (GST_TYPE_ELEMENT,
                                            "GstTypeFindElement",
                                            &typefind_info, 0);
+
+    GST_DEBUG_CATEGORY_INIT (gst_type_find_element_debug, "typefind", 
+                            GST_DEBUG_BG_YELLOW | GST_DEBUG_FG_GREEN, "typefind element");
   }
   return typefind_type;
 }
@@ -155,6 +156,13 @@ gst_type_find_element_have_type (GstTypeFindElement *typefind, guint probability
   }
 }
 static void
+gst_type_find_element_base_init (gpointer g_class)
+{
+  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+  
+  gst_element_class_set_details (gstelement_class, &gst_type_find_element_details);
+}
+static void
 gst_type_find_element_class_init (gpointer g_class, gpointer class_data)
 {
   GObjectClass *gobject_class;
index 4b5e0cc..7f508ba 100644 (file)
@@ -30,9 +30,7 @@
 
 G_BEGIN_DECLS
 
-GST_DEBUG_CATEGORY_EXTERN(gst_type_find_element_debug);
 
-extern GstElementDetails gst_type_find_element_details;
 
 #define GST_TYPE_TYPE_FIND_ELEMENT             (gst_type_find_element_get_type ())
 #define GST_TYPE_FIND_ELEMENT(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_TYPE_FIND_ELEMENT, GstTypeFindElement))
index 3806aa7..ccb969e 100644 (file)
@@ -993,12 +993,11 @@ gst_file_index_get_assoc_entry (GstIndex *index,
 }
 
 gboolean
-gst_file_index_plugin_init (GModule *module, GstPlugin *plugin)
+gst_file_index_plugin_init (GstPlugin *plugin)
 {
   GstIndexFactory *factory;
 
   GST_DEBUG_CATEGORY_INIT(DC, "GST_FILEINDEX", 0, NULL);
-  gst_plugin_set_longname (plugin, "A file index");
 
   factory = gst_index_factory_new ("fileindex",
                                   "A index that stores entries in file",
index e2f491e..6894202 100644 (file)
 #include <gst/gstversion.h>
 #include <gst/gstplugin.h>
 
-extern gboolean gst_mem_index_plugin_init      (GModule *module, GstPlugin *plugin);
-extern gboolean gst_file_index_plugin_init     (GModule *module, GstPlugin *plugin);
+extern gboolean gst_mem_index_plugin_init      (GstPlugin *plugin);
+extern gboolean gst_file_index_plugin_init     (GstPlugin *plugin);
 
 static gboolean
-plugin_init (GModule *module, GstPlugin *plugin)
+plugin_init (GstPlugin *plugin)
 {
   gboolean res = TRUE;
 
-  res &= gst_mem_index_plugin_init (module, plugin);
-  res &= gst_file_index_plugin_init (module, plugin);
+  res &= gst_mem_index_plugin_init (plugin);
+  res &= gst_file_index_plugin_init (plugin);
   
   return res;
 }
 
-GstPluginDesc plugin_desc = {
+GST_PLUGIN_DEFINE (
   GST_VERSION_MAJOR,
   GST_VERSION_MINOR,
   "gstindexers",
-  plugin_init
-};
+  "Gstremaer core indexers",
+  plugin_init,
+  VERSION,
+  GST_LICENSE,
+  GST_COPYRIGHT,
+  GST_PACKAGE,
+  GST_ORIGIN
+)
+
 
index 80856c4..bc5f210 100644 (file)
@@ -397,12 +397,10 @@ gst_mem_index_get_assoc_entry (GstIndex *index, gint id,
 }
 
 gboolean
-gst_mem_index_plugin_init (GModule *module, GstPlugin *plugin)
+gst_mem_index_plugin_init (GstPlugin *plugin)
 {
   GstIndexFactory *factory;
 
-  gst_plugin_set_longname (plugin, "A memory index");
-
   factory = gst_index_factory_new ("memindex",
                                   "A index that stores entries in memory",
                                    gst_mem_index_get_type());
index 0bed8f6..65e047d 100644 (file)
 #include <string.h>
 #include "example.h"
 
-/* The ElementDetails structure gives a human-readable description
- * of the plugin, as well as author and version data.
+/* The ElementDetails structure gives a human-readable description of the
+ * plugin, as well as author and version data. Use the GST_ELEMENT_DETAILS
+ * macro when defining it.
  */
-static GstElementDetails example_details = {
+static GstElementDetails example_details = GST_ELEMENT_DETAILS (
   "An example plugin",
   "Example/FirstExample",
-  "LGPL",
   "Shows the basic structure of a plugin",
-  "0.1",
-  "your name <your.name@your.isp>",
-  "(C) 2001",
-};
+  "your name <your.name@your.isp>"
+);
 
 /* These are the signals that this element can fire.  They are zero-
  * based because the numbers themselves are private to the object.
@@ -186,6 +184,13 @@ gst_example_class_init (GstExampleClass *klass)
   /* we also override the default state change handler with our own
    * implementation */
   gstelement_class->change_state = gst_example_change_state;
+  /* We can now provide the details for this element, that we defined earlier. */
+  gst_element_class_set_details (gstelement_class, &example_details);
+  /* The pad templates can be easily generated from the factories above,
+   * and then added to the list of padtemplates for the class.
+   */
+  gst_element_class_add_pad_template (gstelement_class, GST_PAD_TEMPLATE_GET (sink_factory));
+  gst_element_class_add_pad_template (gstelement_class, GST_PAD_TEMPLATE_GET (src_factory));
 }
 
 /* This function is responsible for initializing a specific instance of
@@ -386,31 +391,20 @@ gst_example_change_state (GstElement *element)
  * this function is called to register everything that the plugin provides.
  */
 static gboolean
-plugin_init (GModule *module, GstPlugin *plugin)
+plugin_init (GstPlugin *plugin)
 {
-  GstElementFactory *factory;
-
-  /* We need to create an ElementFactory for each element we provide.
-   * This consists of the name of the element, the GType identifier,
-   * and a pointer to the details structure at the top of the file.
+  /* We need to register each element we provide with the plugin. This consists 
+   * of the name of the element, a rank that gives the importance of the element 
+   * when compared to similar plugins and the GType identifier.
    */
-  factory = gst_element_factory_new("example", GST_TYPE_EXAMPLE, &example_details);
-  g_return_val_if_fail(factory != NULL, FALSE);
-
-  /* The pad templates can be easily generated from the factories above,
-   * and then added to the list of padtemplates for the elementfactory.
-   */
-  gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (sink_factory));
-  gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (src_factory));
-
-  /* The very last thing is to register the elementfactory with the plugin. */
-  gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
+  if (!gst_element_register (plugin, "example", GST_RANK_MARGINAL, GST_TYPE_EXAMPLE))
+    return FALSE;
 
   /* Now we can return successfully. */
   return TRUE;
 
   /* At this point, the GStreamer core registers the plugin, its
-   * elementfactories, padtemplates, etc., for use in you application.
+   * elementfactories, padtemplates, etc., for use in your application.
    */
 }
 
@@ -421,12 +415,26 @@ plugin_init (GModule *module, GstPlugin *plugin)
  * The symbol pointing to this structure is the only symbol looked up when
  * loading the plugin.
  */
-GstPluginDesc plugin_desc = {
-  GST_VERSION_MAJOR, /* The major version of the core that this was built with */
-  GST_VERSION_MINOR, /* The minor version of the core that this was built with */
-  "example",         /* The name of the plugin.  This must be unique: plugins with
-                     * the same name will be assumed to be identical, and only
-                     * one will be loaded. */
-  plugin_init        /* Pointer to the initialisation function for the plugin. */
-};
+GST_PLUGIN_DEFINE (
+  GST_VERSION_MAJOR,   /* The major version of the core that this was built with */
+  GST_VERSION_MINOR,   /* The minor version of the core that this was built with */
+  "example",           /* The name of the plugin.  This must be unique: plugins with
+                        * the same name will be assumed to be identical, and only
+                        * one will be loaded. */
+  "an example plugin", /* a short description of the plugin in English */
+  plugin_init,         /* Pointer to the initialisation function for the plugin. */
+  "0.1",               /* The version number of the plugin */
+  "LGPL",              /* ieffective license the plugin can be shipped with. Must be 
+                        * valid for all libraries it links to, too. */
+  "(c) 2003 E. Xamplewriter",
+                       /* Copyright holder for this plugin. This does not include
+                        * the libraries it links to, contrary to the license. This
+                        * field should be considered informational and not legally
+                        * binding */
+  "my nifty plugin package",
+                       /* package this plugin belongs to. */
+  "http://www.mydomain.com"
+                       /* originating URL for this plugin. This is the place to look
+                        * for updates, information and so on. */
+);
 
index 317e3d4..c28cbb0 100644 (file)
@@ -4,5 +4,5 @@ tests_pass =
 tests_fail = test1 
 
 test1_SOURCES = test1.c gstbstest.c
-
+test1_LDFLAGS = -lgstbytestream -L$(top_srcdir)/libs/gst/bytestream
 
index 9a718c4..2e9598f 100644 (file)
@@ -27,7 +27,7 @@
 #include <string.h>
 
 #include <gst/gst.h>
-#include <gst/gstbytestream.h>
+#include <gst/bytestream/bytestream.h>
 
 #define GST_TYPE_BSTEST                (gst_bstest_get_type())
 #define GST_BSTEST(obj)                (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BSTEST,GstBsTest))
@@ -64,16 +64,13 @@ struct _GstBsTestClass
 GType gst_bstest_get_type (void);
 
 
-GstElementDetails gst_bstest_details = {
+GstElementDetails gst_bstest_details = GST_ELEMENT_DETAILS (
   "ByteStreamTest",
   "Filter",
-  "LGPL",
   "Test for the GstByteStream code",
-  VERSION,
-  "Erik Walthinsen <omega@temple-baptist.com>,"
-    "Wim Taymans <wim.taymans@chello.be>",
-  "(C) 2001",
-};
+  "Erik Walthinsen <omega@temple-baptist.com>, "
+  "Wim Taymans <wim.taymans@chello.be>"
+);
 
 
 /* BsTest signals and args */
@@ -94,6 +91,7 @@ enum
 };
 
 
+static void    gst_bstest_base_init            (gpointer g_class);
 static void    gst_bstest_class_init           (GstBsTestClass * klass);
 static void    gst_bstest_init                 (GstBsTest * bstest);
 
@@ -116,7 +114,8 @@ gst_bstest_get_type (void)
 
   if (!bstest_type) {
     static const GTypeInfo bstest_info = {
-      sizeof (GstBsTestClass), NULL,
+      sizeof (GstBsTestClass),
+      gst_bstest_base_init,
       NULL,
       (GClassInitFunc) gst_bstest_class_init,
       NULL,
@@ -130,6 +129,13 @@ gst_bstest_get_type (void)
   }
   return bstest_type;
 }
+static void
+gst_bstest_base_init (gpointer g_class)
+{
+  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+
+  gst_element_class_set_details (gstelement_class, &gst_bstest_details);
+}
 
 static void
 gst_bstest_class_init (GstBsTestClass * klass)
@@ -380,21 +386,24 @@ gst_bstest_change_state (GstElement *element)
 }
 
 static gboolean
-plugin_init (GModule * module, GstPlugin * plugin)
+plugin_init (GstPlugin * plugin)
 {
-  GstElementFactory *factory;
-
   /* We need to create an ElementFactory for each element we provide.
    * This consists of the name of the element, the GType identifier,
    * and a pointer to the details structure at the top of the file.
    */
-  factory = gst_element_factory_new ("bstest", GST_TYPE_BSTEST, &gst_bstest_details);
-  g_return_val_if_fail (factory != NULL, FALSE);
-
-  /* The very last thing is to register the elementfactory with the plugin. */
-  gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
-
-  return TRUE;
+  return gst_element_register (plugin, "bstest", GST_RANK_PRIMARY, GST_TYPE_BSTEST);
 }
 
-GST_PLUGIN_DESC (GST_VERSION_MAJOR, GST_VERSION_MINOR, "bstest", plugin_init);
+GST_PLUGIN_DEFINE (
+  GST_VERSION_MAJOR, 
+  GST_VERSION_MINOR, 
+  "bstest", 
+  "test for the bytestream element",
+  plugin_init,
+  VERSION,
+  GST_LICENSE,
+  GST_COPYRIGHT,
+  GST_PACKAGE,
+  GST_ORIGIN
+)
index ec9229e..baea7b8 100644 (file)
@@ -9,7 +9,7 @@ plugin_init (GModule *module, GstPlugin *plugin)
   return TRUE;
 }
 
-GST_PLUGIN_DESC (
+GST_PLUGIN_DEFINE (
   GST_VERSION_MAJOR,
   GST_VERSION_MINOR,
   "testplugin",
@@ -22,7 +22,7 @@ plugin2_init (GModule *module, GstPlugin *plugin)
   return TRUE;
 }
 
-GST_PLUGIN_DESC (
+GST_PLUGIN_DEFINE (
   GST_VERSION_MAJOR,
   GST_VERSION_MINOR,
   "testplugin2",
index 57c5522..e834c8e 100644 (file)
@@ -1,15 +1,25 @@
 
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
 #include <gst/gst.h>
 
 static gboolean
-plugin_init (GModule *module, GstPlugin *plugin)
+plugin_init (GstPlugin *plugin)
 {
   return TRUE;
 }
 
-GST_PLUGIN_DESC (
+GST_PLUGIN_DEFINE (
   GST_VERSION_MAJOR,
   GST_VERSION_MINOR,
   "testplugin",
-  plugin_init
+  "a plugin for testing",
+  plugin_init,
+  VERSION,
+  GST_LICENSE,
+  GST_COPYRIGHT,
+  GST_PACKAGE,
+  GST_ORIGIN
 );
index 08a14b7..7af301b 100644 (file)
@@ -1,15 +1,25 @@
 
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
 #include <gst/gst.h>
 
 static gboolean
-plugin_init (GModule *module, GstPlugin *plugin)
+plugin_init (GstPlugin *plugin)
 {
   return TRUE;
 }
 
-GST_PLUGIN_DESC (
+GST_PLUGIN_DEFINE (
   GST_VERSION_MAJOR,
   GST_VERSION_MINOR,
   "testplugin2",
-  plugin_init
+  "another testplugin for testing",
+  plugin_init,
+  VERSION,
+  GST_LICENSE,
+  GST_COPYRIGHT,
+  GST_PACKAGE,
+  GST_ORIGIN
 );
index 317e3d4..c28cbb0 100644 (file)
@@ -4,5 +4,5 @@ tests_pass =
 tests_fail = test1 
 
 test1_SOURCES = test1.c gstbstest.c
-
+test1_LDFLAGS = -lgstbytestream -L$(top_srcdir)/libs/gst/bytestream
 
index 9a718c4..2e9598f 100644 (file)
@@ -27,7 +27,7 @@
 #include <string.h>
 
 #include <gst/gst.h>
-#include <gst/gstbytestream.h>
+#include <gst/bytestream/bytestream.h>
 
 #define GST_TYPE_BSTEST                (gst_bstest_get_type())
 #define GST_BSTEST(obj)                (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BSTEST,GstBsTest))
@@ -64,16 +64,13 @@ struct _GstBsTestClass
 GType gst_bstest_get_type (void);
 
 
-GstElementDetails gst_bstest_details = {
+GstElementDetails gst_bstest_details = GST_ELEMENT_DETAILS (
   "ByteStreamTest",
   "Filter",
-  "LGPL",
   "Test for the GstByteStream code",
-  VERSION,
-  "Erik Walthinsen <omega@temple-baptist.com>,"
-    "Wim Taymans <wim.taymans@chello.be>",
-  "(C) 2001",
-};
+  "Erik Walthinsen <omega@temple-baptist.com>, "
+  "Wim Taymans <wim.taymans@chello.be>"
+);
 
 
 /* BsTest signals and args */
@@ -94,6 +91,7 @@ enum
 };
 
 
+static void    gst_bstest_base_init            (gpointer g_class);
 static void    gst_bstest_class_init           (GstBsTestClass * klass);
 static void    gst_bstest_init                 (GstBsTest * bstest);
 
@@ -116,7 +114,8 @@ gst_bstest_get_type (void)
 
   if (!bstest_type) {
     static const GTypeInfo bstest_info = {
-      sizeof (GstBsTestClass), NULL,
+      sizeof (GstBsTestClass),
+      gst_bstest_base_init,
       NULL,
       (GClassInitFunc) gst_bstest_class_init,
       NULL,
@@ -130,6 +129,13 @@ gst_bstest_get_type (void)
   }
   return bstest_type;
 }
+static void
+gst_bstest_base_init (gpointer g_class)
+{
+  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+
+  gst_element_class_set_details (gstelement_class, &gst_bstest_details);
+}
 
 static void
 gst_bstest_class_init (GstBsTestClass * klass)
@@ -380,21 +386,24 @@ gst_bstest_change_state (GstElement *element)
 }
 
 static gboolean
-plugin_init (GModule * module, GstPlugin * plugin)
+plugin_init (GstPlugin * plugin)
 {
-  GstElementFactory *factory;
-
   /* We need to create an ElementFactory for each element we provide.
    * This consists of the name of the element, the GType identifier,
    * and a pointer to the details structure at the top of the file.
    */
-  factory = gst_element_factory_new ("bstest", GST_TYPE_BSTEST, &gst_bstest_details);
-  g_return_val_if_fail (factory != NULL, FALSE);
-
-  /* The very last thing is to register the elementfactory with the plugin. */
-  gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
-
-  return TRUE;
+  return gst_element_register (plugin, "bstest", GST_RANK_PRIMARY, GST_TYPE_BSTEST);
 }
 
-GST_PLUGIN_DESC (GST_VERSION_MAJOR, GST_VERSION_MINOR, "bstest", plugin_init);
+GST_PLUGIN_DEFINE (
+  GST_VERSION_MAJOR, 
+  GST_VERSION_MINOR, 
+  "bstest", 
+  "test for the bytestream element",
+  plugin_init,
+  VERSION,
+  GST_LICENSE,
+  GST_COPYRIGHT,
+  GST_PACKAGE,
+  GST_ORIGIN
+)
index ec9229e..baea7b8 100644 (file)
@@ -9,7 +9,7 @@ plugin_init (GModule *module, GstPlugin *plugin)
   return TRUE;
 }
 
-GST_PLUGIN_DESC (
+GST_PLUGIN_DEFINE (
   GST_VERSION_MAJOR,
   GST_VERSION_MINOR,
   "testplugin",
@@ -22,7 +22,7 @@ plugin2_init (GModule *module, GstPlugin *plugin)
   return TRUE;
 }
 
-GST_PLUGIN_DESC (
+GST_PLUGIN_DEFINE (
   GST_VERSION_MAJOR,
   GST_VERSION_MINOR,
   "testplugin2",
index 57c5522..e834c8e 100644 (file)
@@ -1,15 +1,25 @@
 
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
 #include <gst/gst.h>
 
 static gboolean
-plugin_init (GModule *module, GstPlugin *plugin)
+plugin_init (GstPlugin *plugin)
 {
   return TRUE;
 }
 
-GST_PLUGIN_DESC (
+GST_PLUGIN_DEFINE (
   GST_VERSION_MAJOR,
   GST_VERSION_MINOR,
   "testplugin",
-  plugin_init
+  "a plugin for testing",
+  plugin_init,
+  VERSION,
+  GST_LICENSE,
+  GST_COPYRIGHT,
+  GST_PACKAGE,
+  GST_ORIGIN
 );
index 08a14b7..7af301b 100644 (file)
@@ -1,15 +1,25 @@
 
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
 #include <gst/gst.h>
 
 static gboolean
-plugin_init (GModule *module, GstPlugin *plugin)
+plugin_init (GstPlugin *plugin)
 {
   return TRUE;
 }
 
-GST_PLUGIN_DESC (
+GST_PLUGIN_DEFINE (
   GST_VERSION_MAJOR,
   GST_VERSION_MINOR,
   "testplugin2",
-  plugin_init
+  "another testplugin for testing",
+  plugin_init,
+  VERSION,
+  GST_LICENSE,
+  GST_COPYRIGHT,
+  GST_PACKAGE,
+  GST_ORIGIN
 );
index f0e4a7b..92e4422 100644 (file)
@@ -445,13 +445,13 @@ static char *
 get_rank_name (gint rank)
 {
   switch(rank){
-    case GST_ELEMENT_RANK_NONE:
+    case GST_RANK_NONE:
       return "none";
-    case GST_ELEMENT_RANK_MARGINAL:
+    case GST_RANK_MARGINAL:
       return "marginal";
-    case GST_ELEMENT_RANK_SECONDARY:
+    case GST_RANK_SECONDARY:
       return "secondary";
-    case GST_ELEMENT_RANK_PRIMARY:
+    case GST_RANK_PRIMARY:
       return "primary";
     default:
       return "unknown";
@@ -483,13 +483,10 @@ print_element_info (GstElementFactory *factory)
   gstelement_class = GST_ELEMENT_CLASS (G_OBJECT_GET_CLASS (element));
 
   g_print ("Factory Details:\n");
-  g_print ("  Long name:\t%s\n",   factory->details->longname);
-  g_print ("  Class:\t%s\n",       factory->details->klass);
-  g_print ("  License:\t%s\n",     factory->details->license);
-  g_print ("  Description:\t%s\n", factory->details->description);
-  g_print ("  Version:\t%s\n",     factory->details->version);
-  g_print ("  Author(s):\t%s\n",   factory->details->author);
-  g_print ("  Copyright:\t%s\n",   factory->details->copyright);
+  g_print ("  Long name:\t%s\n",   factory->details.longname);
+  g_print ("  Class:\t%s\n",       factory->details.klass);
+  g_print ("  Description:\t%s\n", factory->details.description);
+  g_print ("  Author(s):\t%s\n",   factory->details.author);
   g_print ("  Rank:\t\t%s\n",      get_rank_name(GST_PLUGIN_FEATURE(factory)->rank));
   g_print ("\n");
 
@@ -835,15 +832,15 @@ print_element_list (void)
         GstElementFactory *factory;
 
         factory = GST_ELEMENT_FACTORY (feature);
-        g_print ("%s:  %s: %s\n", plugin->name,
-                GST_PLUGIN_FEATURE_NAME (factory) ,factory->details->longname);
+        g_print ("%s:  %s: %s\n", plugin->desc.name,
+                GST_PLUGIN_FEATURE_NAME (factory) ,factory->details.longname);
       }
 #ifndef GST_DISABLE_AUTOPLUG
       else if (GST_IS_AUTOPLUG_FACTORY (feature)) {
         GstAutoplugFactory *factory;
 
         factory = GST_AUTOPLUG_FACTORY (feature);
-        g_print ("%s:  %s: %s\n", plugin->name,
+        g_print ("%s:  %s: %s\n", plugin->desc.name,
                 GST_PLUGIN_FEATURE_NAME (factory), factory->longdesc);
       }
 #endif
@@ -852,7 +849,7 @@ print_element_list (void)
         GstIndexFactory *factory;
 
         factory = GST_INDEX_FACTORY (feature);
-        g_print ("%s:  %s: %s\n", plugin->name,
+        g_print ("%s:  %s: %s\n", plugin->desc.name,
                 GST_PLUGIN_FEATURE_NAME (factory), factory->longdesc);
       }
 #endif
@@ -862,19 +859,19 @@ print_element_list (void)
         factory = GST_TYPE_FIND_FACTORY (feature);
         if (factory->extensions) {
          guint i = 0;
-          g_print ("%s type: ", plugin->name);
+          g_print ("%s type: ", plugin->desc.name);
          while (factory->extensions[i]) {
            g_print ("%s%s", i > 0 ? ", " : "", factory->extensions[i]);
            i++;
          }
        } else
-          g_print ("%s type: N/A\n", plugin->name);
+          g_print ("%s type: N/A\n", plugin->desc.name);
       }
       else if (GST_IS_SCHEDULER_FACTORY (feature)) {
         GstSchedulerFactory *factory;
 
         factory = GST_SCHEDULER_FACTORY (feature);
-        g_print ("%s:  %s: %s\n", plugin->name,
+        g_print ("%s:  %s: %s\n", plugin->desc.name,
                 GST_PLUGIN_FEATURE_NAME (factory), factory->longdesc);
       }
 #ifndef GST_DISABLE_URI
@@ -883,12 +880,12 @@ print_element_list (void)
 
         handler = GST_URI_HANDLER (feature);
         g_print ("%s:  %s: \"%s\" (%s) element \"%s\" property \"%s\"\n",
-                plugin->name, GST_PLUGIN_FEATURE_NAME (handler), handler->uri,
+                plugin->desc.name, GST_PLUGIN_FEATURE_NAME (handler), handler->uri,
                 handler->longdesc, handler->element, handler->property);
       }
 #endif
       else {
-        g_print ("%s:  %s (%s)\n", plugin->name,
+        g_print ("%s:  %s (%s)\n", plugin->desc.name,
                 GST_PLUGIN_FEATURE_NAME (feature),
                 g_type_name (G_OBJECT_TYPE (feature)));
       }
@@ -911,9 +908,14 @@ print_plugin_info (GstPlugin *plugin)
   gint num_other = 0;
 
   g_print ("Plugin Details:\n");
-  g_print ("  Name:\t\t%s\n",    plugin->name);
-  g_print ("  Long Name:\t%s\n", plugin->longname);
-  g_print ("  Filename:\t%s\n",  plugin->filename);
+  g_print ("  Name:\t\t%s\n",      plugin->desc.name);
+  g_print ("  Description:\t%s\n",  plugin->desc.description);
+  g_print ("  Filename:\t%s\n",            plugin->filename);
+  g_print ("  Version:\t%s\n",     plugin->desc.version);
+  g_print ("  License:\t%s\n",     plugin->desc.license);
+  g_print ("  Copyright:\t%s\n",    plugin->desc.copyright);
+  g_print ("  Package:\t%s\n",     plugin->desc.package);
+  g_print ("  Origin URL:\t%s\n",   plugin->desc.origin);
   g_print ("\n");
 
   features = gst_plugin_get_feature_list (plugin);
@@ -928,7 +930,7 @@ print_plugin_info (GstPlugin *plugin)
 
       factory = GST_ELEMENT_FACTORY (feature);
       g_print ("  %s: %s\n", GST_OBJECT_NAME (factory),
-              factory->details->longname);
+              factory->details.longname);
       num_elements++;
     }
 #ifndef GST_DISABLE_AUTOPLUG
@@ -955,13 +957,13 @@ print_plugin_info (GstPlugin *plugin)
       factory = GST_TYPE_FIND_FACTORY (feature);
       if (factory->extensions) {
        guint i = 0;
-       g_print ("%s type: ", plugin->name);
+       g_print ("%s type: ", plugin->desc.name);
        while (factory->extensions[i]) {
          g_print ("%s%s", i > 0 ? ", " : "", factory->extensions[i]);
          i++;
        }
       } else
-       g_print ("%s type: N/A\n", plugin->name);
+       g_print ("%s type: N/A\n", plugin->desc.name);
 
       num_types++;
     }
index 087a0f8..df4817b 100644 (file)
@@ -42,7 +42,7 @@ static gint num_plugins = 0;
 static void
 plugin_added_func (GstRegistry *registry, GstPlugin *plugin, gpointer user_data)
 {
-  g_print ("added plugin %s with %d feature(s)\n", plugin->name,
+  g_print ("added plugin %s with %d feature(s)\n", plugin->desc.name,
            plugin->numfeatures);
 
   num_features += plugin->numfeatures;
index dac7400..89d1c03 100644 (file)
@@ -592,13 +592,10 @@ print_element_info (GstElementFactory *factory)
   gstelement_class = GST_ELEMENT_CLASS (G_OBJECT_GET_CLASS (element));
 
   PUT_START_TAG (1, "details");
-  PUT_ESCAPED (2, "long-name",  factory->details->longname);
-  PUT_ESCAPED (2, "class",              factory->details->klass);
-  PUT_ESCAPED (2, "license",    factory->details->license);
-  PUT_ESCAPED (2, "description",        factory->details->description);
-  PUT_ESCAPED (2, "version",    factory->details->version);
-  PUT_ESCAPED (2, "authors",    factory->details->author);
-  PUT_ESCAPED (2, "copyright",  factory->details->copyright);
+  PUT_ESCAPED (2, "long-name",  factory->details.longname);
+  PUT_ESCAPED (2, "class",      factory->details.klass);
+  PUT_ESCAPED (2, "description",factory->details.description);
+  PUT_ESCAPED (2, "authors",    factory->details.author);
   PUT_END_TAG (1, "details");
 
   output_hierarchy (G_OBJECT_TYPE (element), 0, &maxlevel);
@@ -828,15 +825,15 @@ print_element_list (void)
         GstElementFactory *factory;
 
         factory = GST_ELEMENT_FACTORY (feature);
-        g_print ("%s:  %s: %s\n", plugin->name,
-                GST_PLUGIN_FEATURE_NAME (factory) ,factory->details->longname);
+        g_print ("%s:  %s: %s\n", plugin->desc.name,
+                GST_PLUGIN_FEATURE_NAME (factory) ,factory->details.longname);
       }
 #ifndef GST_DISABLE_AUTOPLUG
       else if (GST_IS_AUTOPLUG_FACTORY (feature)) {
         GstAutoplugFactory *factory;
 
         factory = GST_AUTOPLUG_FACTORY (feature);
-        g_print ("%s:  %s: %s\n", plugin->name,
+        g_print ("%s:  %s: %s\n", plugin->desc.name,
                 GST_PLUGIN_FEATURE_NAME (factory), factory->longdesc);
       }
 #endif
@@ -845,7 +842,7 @@ print_element_list (void)
         GstIndexFactory *factory;
 
         factory = GST_INDEX_FACTORY (feature);
-        g_print ("%s:  %s: %s\n", plugin->name,
+        g_print ("%s:  %s: %s\n", plugin->desc.name,
                 GST_PLUGIN_FEATURE_NAME (factory), factory->longdesc);
       }
 #endif
@@ -855,19 +852,19 @@ print_element_list (void)
        factory = GST_TYPE_FIND_FACTORY (feature);
         if (factory->extensions) {
          guint i = 0;
-         g_print ("%s type: ", plugin->name);
+         g_print ("%s type: ", plugin->desc.name);
          while (factory->extensions[i]) {
            g_print ("%s%s", i > 0 ? ", " : "", factory->extensions[i]);
            i++;
          }
        } else
-         g_print ("%s type: N/A\n", plugin->name);
+         g_print ("%s type: N/A\n", plugin->desc.name);
       }
       else if (GST_IS_SCHEDULER_FACTORY (feature)) {
         GstSchedulerFactory *factory;
 
         factory = GST_SCHEDULER_FACTORY (feature);
-        g_print ("%s:  %s: %s\n", plugin->name,
+        g_print ("%s:  %s: %s\n", plugin->desc.name,
                 GST_PLUGIN_FEATURE_NAME (factory), factory->longdesc);
       }
 #ifndef GST_DISABLE_URI
@@ -876,12 +873,12 @@ print_element_list (void)
 
         handler = GST_URI_HANDLER (feature);
         g_print ("%s:  %s: \"%s\" (%s) element \"%s\" property \"%s\"\n",
-                 plugin->name, GST_PLUGIN_FEATURE_NAME (handler), handler->uri,
+                 plugin->desc.name, GST_PLUGIN_FEATURE_NAME (handler), handler->uri,
                  handler->longdesc, handler->element, handler->property);
       }
 #endif
       else {
-        g_print ("%s:  %s (%s)\n", plugin->name,
+        g_print ("%s:  %s (%s)\n", plugin->desc.name,
                 GST_PLUGIN_FEATURE_NAME (feature),
                 g_type_name (G_OBJECT_TYPE (feature)));
       }
@@ -904,9 +901,14 @@ print_plugin_info (GstPlugin *plugin)
   gint num_other = 0;
 
   g_print ("Plugin Details:\n");
-  g_print ("  Name:\t\t%s\n",    plugin->name);
-  g_print ("  Long Name:\t%s\n", plugin->longname);
-  g_print ("  Filename:\t%s\n",  plugin->filename);
+  g_print ("  Name:\t\t%s\n",      plugin->desc.name);
+  g_print ("  Description:\t%s\n",  plugin->desc.description);
+  g_print ("  Filename:\t%s\n",            plugin->filename);
+  g_print ("  Version:\t%s\n",     plugin->desc.version);
+  g_print ("  License:\t%s\n",     plugin->desc.license);
+  g_print ("  Copyright:\t%s\n",    plugin->desc.copyright);
+  g_print ("  Package:\t%s\n",     plugin->desc.package);
+  g_print ("  Origin URL:\t%s\n",   plugin->desc.origin);
   g_print ("\n");
 
   features = gst_plugin_get_feature_list (plugin);
@@ -921,7 +923,7 @@ print_plugin_info (GstPlugin *plugin)
 
       factory = GST_ELEMENT_FACTORY (feature);
       g_print ("  %s: %s\n", GST_OBJECT_NAME (factory),
-              factory->details->longname);
+              factory->details.longname);
       num_elements++;
     }
 #ifndef GST_DISABLE_AUTOPLUG
@@ -948,13 +950,13 @@ print_plugin_info (GstPlugin *plugin)
       factory = GST_TYPE_FIND_FACTORY (feature);
       if (factory->extensions) {
        guint i = 0;
-       g_print ("%s type: ", plugin->name);
+       g_print ("%s type: ", plugin->desc.name);
        while (factory->extensions[i]) {
          g_print ("%s%s", i > 0 ? ", " : "", factory->extensions[i]);
          i++;
        }
       } else
-       g_print ("%s type: N/A\n", plugin->name);
+       g_print ("%s type: N/A\n", plugin->desc.name);
       num_types++;
     }
     else if (GST_IS_SCHEDULER_FACTORY (feature)) {