From 907e3e97d932da8c943f83e65acadff55c8ab0e3 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Fri, 31 Oct 2003 19:32:47 +0000 Subject: [PATCH] update plugin initialization restructuring (see email for details Original commit message from CVS: update plugin initialization restructuring (see email for details --- configure.ac | 28 +- examples/plugins/example.c | 76 +++-- gst/autoplug/gstautoplugcache.c | 33 +- gst/autoplug/gstautoplugger.c | 33 +- gst/autoplug/gstsearchfuncs.c | 6 +- gst/autoplug/gstspider.c | 47 ++- gst/autoplug/gstspideridentity.c | 22 +- gst/autoplug/gstspideridentity.h | 3 - gst/autoplug/gststaticautoplug.c | 20 +- gst/autoplug/gststaticautoplugrender.c | 20 +- gst/elements/gstaggregator.c | 32 +- gst/elements/gstaggregator.h | 2 - gst/elements/gstbufferstore.c | 2 +- gst/elements/gstelements.c | 94 ++---- gst/elements/gstfakesink.c | 32 +- gst/elements/gstfakesink.h | 2 - gst/elements/gstfakesrc.c | 33 +- gst/elements/gstfakesrc.h | 2 - gst/elements/gstfdsink.c | 26 +- gst/elements/gstfdsink.h | 2 - gst/elements/gstfdsrc.c | 29 +- gst/elements/gstfdsrc.h | 2 - gst/elements/gstfilesink.c | 35 +- gst/elements/gstfilesink.h | 2 - gst/elements/gstfilesrc.c | 31 +- gst/elements/gstfilesrc.h | 2 - gst/elements/gstidentity.c | 28 +- gst/elements/gstidentity.h | 2 - gst/elements/gstmd5sink.c | 45 +-- gst/elements/gstmd5sink.h | 2 - gst/elements/gstmultidisksrc.c | 24 +- gst/elements/gstmultidisksrc.h | 2 - gst/elements/gstmultifilesrc.c | 24 +- gst/elements/gstmultifilesrc.h | 2 - gst/elements/gstpipefilter.c | 34 +- gst/elements/gstpipefilter.h | 2 - gst/elements/gstshaper.c | 34 +- gst/elements/gstshaper.h | 2 - gst/elements/gststatistics.c | 30 +- gst/elements/gststatistics.h | 2 - gst/elements/gsttee.c | 34 +- gst/elements/gsttee.h | 2 - gst/elements/gsttypefind.c | 24 +- gst/elements/gsttypefind.h | 2 - gst/elements/gsttypefindelement.c | 24 +- gst/elements/gsttypefindelement.h | 2 - gst/gst.c | 35 +- gst/gst_private.h | 1 - gst/gstbin.c | 20 +- gst/gstbin.h | 1 - gst/gstelement.c | 71 +++-- gst/gstelement.h | 84 ++--- gst/gstelementfactory.c | 295 ++++++++++------- gst/gstinfo.c | 4 - gst/gstpipeline.c | 45 +-- gst/gstpipeline.h | 2 - gst/gstplugin.c | 353 ++++++++++++++------- gst/gstplugin.h | 105 +++--- gst/gstpluginfeature.c | 2 +- gst/gstqueue.c | 59 ++-- gst/gstqueue.h | 3 - gst/gstthread.c | 54 ++-- gst/gstthread.h | 2 - gst/gsttypefind.c | 18 +- gst/gsttypefind.h | 2 +- gst/gsttypes.h | 7 + gst/indexers/gstfileindex.c | 3 +- gst/indexers/gstindexers.c | 23 +- gst/indexers/gstmemindex.c | 4 +- gst/registries/gstxmlregistry.c | 121 +++---- gst/schedulers/gstbasicscheduler.c | 16 +- gst/schedulers/gstoptimalscheduler.c | 16 +- libs/gst/bytestream/bytestream.c | 15 +- libs/gst/getbits/getbits.c | 16 +- plugins/elements/gstaggregator.c | 32 +- plugins/elements/gstaggregator.h | 2 - plugins/elements/gstbufferstore.c | 2 +- plugins/elements/gstelements.c | 94 ++---- plugins/elements/gstfakesink.c | 32 +- plugins/elements/gstfakesink.h | 2 - plugins/elements/gstfakesrc.c | 33 +- plugins/elements/gstfakesrc.h | 2 - plugins/elements/gstfdsink.c | 26 +- plugins/elements/gstfdsink.h | 2 - plugins/elements/gstfdsrc.c | 29 +- plugins/elements/gstfdsrc.h | 2 - plugins/elements/gstfilesink.c | 35 +- plugins/elements/gstfilesink.h | 2 - plugins/elements/gstfilesrc.c | 31 +- plugins/elements/gstfilesrc.h | 2 - plugins/elements/gstidentity.c | 28 +- plugins/elements/gstidentity.h | 2 - plugins/elements/gstmd5sink.c | 45 +-- plugins/elements/gstmd5sink.h | 2 - plugins/elements/gstmultidisksrc.c | 24 +- plugins/elements/gstmultidisksrc.h | 2 - plugins/elements/gstmultifilesrc.c | 24 +- plugins/elements/gstmultifilesrc.h | 2 - plugins/elements/gstpipefilter.c | 34 +- plugins/elements/gstpipefilter.h | 2 - plugins/elements/gstqueue.c | 59 ++-- plugins/elements/gstqueue.h | 3 - plugins/elements/gstshaper.c | 34 +- plugins/elements/gstshaper.h | 2 - plugins/elements/gststatistics.c | 30 +- plugins/elements/gststatistics.h | 2 - plugins/elements/gsttee.c | 34 +- plugins/elements/gsttee.h | 2 - plugins/elements/gsttypefind.c | 24 +- plugins/elements/gsttypefind.h | 2 - plugins/elements/gsttypefindelement.c | 24 +- plugins/elements/gsttypefindelement.h | 2 - plugins/indexers/gstfileindex.c | 3 +- plugins/indexers/gstindexers.c | 23 +- plugins/indexers/gstmemindex.c | 4 +- tests/old/examples/plugins/example.c | 76 +++-- tests/old/testsuite/bytestream/Makefile.am | 2 +- tests/old/testsuite/bytestream/gstbstest.c | 49 +-- tests/old/testsuite/plugin/static2.c | 4 +- tests/old/testsuite/plugin/testplugin.c | 16 +- tests/old/testsuite/plugin/testplugin2.c | 16 +- testsuite/bytestream/Makefile.am | 2 +- testsuite/bytestream/gstbstest.c | 49 +-- testsuite/plugin/static2.c | 4 +- testsuite/plugin/testplugin.c | 16 +- testsuite/plugin/testplugin2.c | 16 +- tools/gst-inspect.c | 54 ++-- tools/gst-register.c | 2 +- tools/gst-xmlinspect.c | 46 +-- 129 files changed, 1921 insertions(+), 1486 deletions(-) diff --git a/configure.ac b/configure.ac index aaa1870e8d..a28ea9cbc7 100644 --- a/configure.ac +++ b/configure.ac @@ -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 diff --git a/examples/plugins/example.c b/examples/plugins/example.c index 0bed8f605e..65e047d763 100644 --- a/examples/plugins/example.c +++ b/examples/plugins/example.c @@ -23,18 +23,16 @@ #include #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 ", - "(C) 2001", -}; + "your name " +); /* 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. */ +); diff --git a/gst/autoplug/gstautoplugcache.c b/gst/autoplug/gstautoplugcache.c index bf856662a6..50a977e2df 100644 --- a/gst/autoplug/gstautoplugcache.c +++ b/gst/autoplug/gstautoplugcache.c @@ -28,15 +28,12 @@ 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 ", - "(C) 2001 RidgeRun, Inc. (www.ridgerun.com)", -}; + "Erik Walthinsen " +); #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 +) diff --git a/gst/autoplug/gstautoplugger.c b/gst/autoplug/gstautoplugger.c index 7551dc30e9..4f76f05428 100644 --- a/gst/autoplug/gstautoplugger.c +++ b/gst/autoplug/gstautoplugger.c @@ -25,15 +25,12 @@ #include -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 ", - "(C) 2001 RidgeRun, Inc. (www.ridgerun.com)", -}; + "Erik Walthinsen " +); #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 +) diff --git a/gst/autoplug/gstsearchfuncs.c b/gst/autoplug/gstsearchfuncs.c index 4fd5bdb1b2..ac4a151010 100644 --- a/gst/autoplug/gstsearchfuncs.c +++ b/gst/autoplug/gstsearchfuncs.c @@ -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))) { diff --git a/gst/autoplug/gstspider.c b/gst/autoplug/gstspider.c index 2db44ba11c..650d0df6d4 100644 --- a/gst/autoplug/gstspider.c +++ b/gst/autoplug/gstspider.c @@ -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 ", - "(C) 2002", -}; + "Benjamin Otte " +); 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 +) diff --git a/gst/autoplug/gstspideridentity.c b/gst/autoplug/gstspideridentity.c index 15007e4028..a469762fa6 100644 --- a/gst/autoplug/gstspideridentity.c +++ b/gst/autoplug/gstspideridentity.c @@ -27,18 +27,15 @@ #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 ", - "(C) 2002", -}; + "Benjamin Otte " +); /* 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 diff --git a/gst/autoplug/gstspideridentity.h b/gst/autoplug/gstspideridentity.h index 5d1dbecc1b..47315536a5 100644 --- a/gst/autoplug/gstspideridentity.h +++ b/gst/autoplug/gstspideridentity.h @@ -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) \ diff --git a/gst/autoplug/gststaticautoplug.c b/gst/autoplug/gststaticautoplug.c index bde915dc84..0b2dcb1ca9 100644 --- a/gst/autoplug/gststaticautoplug.c +++ b/gst/autoplug/gststaticautoplug.c @@ -20,6 +20,10 @@ * Boston, MA 02111-1307, USA. */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include "gststaticautoplug.h" #include @@ -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) diff --git a/gst/autoplug/gststaticautoplugrender.c b/gst/autoplug/gststaticautoplugrender.c index 0b48bdaf74..246e40d228 100644 --- a/gst/autoplug/gststaticautoplugrender.c +++ b/gst/autoplug/gststaticautoplugrender.c @@ -20,6 +20,10 @@ * Boston, MA 02111-1307, USA. */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include "gststaticautoplugrender.h" #include @@ -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) diff --git a/gst/elements/gstaggregator.c b/gst/elements/gstaggregator.c index 3c3ba5d8a8..797d41a6f9 100644 --- a/gst/elements/gstaggregator.c +++ b/gst/elements/gstaggregator.c @@ -26,18 +26,15 @@ #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 ", - "(C) 2001", -}; + "Wim Taymans " +); /* 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,10 +114,19 @@ 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) { @@ -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; -} + diff --git a/gst/elements/gstaggregator.h b/gst/elements/gstaggregator.h index e53b8540c5..7e6105bf01 100644 --- a/gst/elements/gstaggregator.h +++ b/gst/elements/gstaggregator.h @@ -28,8 +28,6 @@ G_BEGIN_DECLS -extern GstElementDetails gst_aggregator_details; -GST_DEBUG_CATEGORY_EXTERN(gst_aggregator_debug); typedef enum { AGGREGATOR_LOOP = 1, diff --git a/gst/elements/gstbufferstore.c b/gst/elements/gstbufferstore.c index a91648b2dd..dd17216756 100644 --- a/gst/elements/gstbufferstore.c +++ b/gst/elements/gstbufferstore.c @@ -25,7 +25,7 @@ #include "gstbufferstore.h" #include -GST_DEBUG_CATEGORY (gst_buffer_store_debug); +GST_DEBUG_CATEGORY_STATIC (gst_buffer_store_debug); #define GST_CAT_DEFAULT gst_buffer_store_debug enum { diff --git a/gst/elements/gstelements.c b/gst/elements/gstelements.c index 7b769a0514..909b88392c 100644 --- a/gst/elements/gstelements.c +++ b/gst/elements/gstelements.c @@ -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 +) + diff --git a/gst/elements/gstfakesink.c b/gst/elements/gstfakesink.c index d9a94a5821..fa526061d7 100644 --- a/gst/elements/gstfakesink.c +++ b/gst/elements/gstfakesink.c @@ -27,18 +27,15 @@ #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 ", - "(C) 1999", -}; + "Erik Walthinsen " +); /* 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,10 +123,20 @@ 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) { @@ -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; -} diff --git a/gst/elements/gstfakesink.h b/gst/elements/gstfakesink.h index 95ee8be900..a8e7cd0673 100644 --- a/gst/elements/gstfakesink.h +++ b/gst/elements/gstfakesink.h @@ -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()) diff --git a/gst/elements/gstfakesrc.c b/gst/elements/gstfakesrc.c index 14287e347e..3a82dc0c9d 100644 --- a/gst/elements/gstfakesrc.c +++ b/gst/elements/gstfakesrc.c @@ -34,19 +34,16 @@ #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 \n" - "Wim Taymans ", - "(C) 1999", -}; + "Erik Walthinsen , " + "Wim Taymans " +); /* 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, @@ -198,6 +198,14 @@ gst_fakesrc_get_type (void) return fakesrc_type; } +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) { @@ -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; -} diff --git a/gst/elements/gstfakesrc.h b/gst/elements/gstfakesrc.h index 1dbb4f07ca..5b3b875494 100644 --- a/gst/elements/gstfakesrc.h +++ b/gst/elements/gstfakesrc.h @@ -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, diff --git a/gst/elements/gstfdsink.c b/gst/elements/gstfdsink.c index b3f2159123..b0ecc94d7f 100644 --- a/gst/elements/gstfdsink.c +++ b/gst/elements/gstfdsink.c @@ -27,18 +27,15 @@ #include "gstfdsink.h" #include -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 ", - "(C) 1999", -}; + "Erik Walthinsen " +); /* 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); diff --git a/gst/elements/gstfdsink.h b/gst/elements/gstfdsink.h index 4f6dfb69cc..838705a724 100644 --- a/gst/elements/gstfdsink.h +++ b/gst/elements/gstfdsink.h @@ -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()) diff --git a/gst/elements/gstfdsrc.c b/gst/elements/gstfdsrc.c index 9970399874..de7359c6e5 100644 --- a/gst/elements/gstfdsrc.c +++ b/gst/elements/gstfdsrc.c @@ -35,19 +35,15 @@ #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 ", - "(C) 1999", -}; + "Erik Walthinsen " +); /* 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, diff --git a/gst/elements/gstfdsrc.h b/gst/elements/gstfdsrc.h index a17b2d5805..b004e0ba4a 100644 --- a/gst/elements/gstfdsrc.h +++ b/gst/elements/gstfdsrc.h @@ -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()) diff --git a/gst/elements/gstfilesink.c b/gst/elements/gstfilesink.c index 88372f79ef..5c4c81c84f 100644 --- a/gst/elements/gstfilesink.c +++ b/gst/elements/gstfilesink.c @@ -33,18 +33,15 @@ #include #include -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 ", - "(C) 2001" -}; + "Thomas " +); /* 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_base_init (gpointer g_class) +{ + GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); + + 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; - GstElementClass *gstelement_class; + GObjectClass *gobject_class = G_OBJECT_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_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 diff --git a/gst/elements/gstfilesink.h b/gst/elements/gstfilesink.h index 99e38eb650..b72551bfe0 100644 --- a/gst/elements/gstfilesink.h +++ b/gst/elements/gstfilesink.h @@ -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()) diff --git a/gst/elements/gstfilesrc.c b/gst/elements/gstfilesrc.c index d3288d6b36..f243d97c27 100644 --- a/gst/elements/gstfilesrc.c +++ b/gst/elements/gstfilesrc.c @@ -72,18 +72,15 @@ */ -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 ", - "(C) 1999", -}; + "Erik Walthinsen " +); #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", diff --git a/gst/elements/gstfilesrc.h b/gst/elements/gstfilesrc.h index f1600c95d3..23b6ddeef5 100644 --- a/gst/elements/gstfilesrc.h +++ b/gst/elements/gstfilesrc.h @@ -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()) diff --git a/gst/elements/gstidentity.c b/gst/elements/gstidentity.c index b6b77d6f20..24021be6b1 100644 --- a/gst/elements/gstidentity.c +++ b/gst/elements/gstidentity.c @@ -29,18 +29,15 @@ #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 ", - "(C) 1999", -}; + "Erik Walthinsen " +); /* 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", diff --git a/gst/elements/gstidentity.h b/gst/elements/gstidentity.h index dd04364c9f..8e39b84248 100644 --- a/gst/elements/gstidentity.h +++ b/gst/elements/gstidentity.h @@ -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()) diff --git a/gst/elements/gstmd5sink.c b/gst/elements/gstmd5sink.c index 114d78daf0..181487d3ae 100644 --- a/gst/elements/gstmd5sink.c +++ b/gst/elements/gstmd5sink.c @@ -32,9 +32,16 @@ #include #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 " +); + /* 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,10 +400,20 @@ 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) { @@ -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 ", - "(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; -} diff --git a/gst/elements/gstmd5sink.h b/gst/elements/gstmd5sink.h index 5d24df69d5..fc847b2a21 100644 --- a/gst/elements/gstmd5sink.h +++ b/gst/elements/gstmd5sink.h @@ -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()) diff --git a/gst/elements/gstmultidisksrc.c b/gst/elements/gstmultidisksrc.c index c2a0e6fdb3..d3ca0d9e5a 100644 --- a/gst/elements/gstmultidisksrc.c +++ b/gst/elements/gstmultidisksrc.c @@ -33,18 +33,15 @@ #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 ", - "(C) 2001", -}; + "Dominic Ludlam " +); /* 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,10 +90,19 @@ 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) { diff --git a/gst/elements/gstmultidisksrc.h b/gst/elements/gstmultidisksrc.h index 07e83980d3..402cf4fc64 100644 --- a/gst/elements/gstmultidisksrc.h +++ b/gst/elements/gstmultidisksrc.h @@ -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()) diff --git a/gst/elements/gstmultifilesrc.c b/gst/elements/gstmultifilesrc.c index c2a0e6fdb3..d3ca0d9e5a 100644 --- a/gst/elements/gstmultifilesrc.c +++ b/gst/elements/gstmultifilesrc.c @@ -33,18 +33,15 @@ #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 ", - "(C) 2001", -}; + "Dominic Ludlam " +); /* 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,10 +90,19 @@ 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) { diff --git a/gst/elements/gstmultifilesrc.h b/gst/elements/gstmultifilesrc.h index 07e83980d3..402cf4fc64 100644 --- a/gst/elements/gstmultifilesrc.h +++ b/gst/elements/gstmultifilesrc.h @@ -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()) diff --git a/gst/elements/gstpipefilter.c b/gst/elements/gstpipefilter.c index e31e0e255b..611f9420eb 100644 --- a/gst/elements/gstpipefilter.c +++ b/gst/elements/gstpipefilter.c @@ -35,19 +35,16 @@ #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 \n" - "Wim Taymans ", - "(C) 1999", -}; + "Erik Walthinsen , " + "Wim Taymans " +); /* 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 diff --git a/gst/elements/gstpipefilter.h b/gst/elements/gstpipefilter.h index 9516482c18..08c3a47187 100644 --- a/gst/elements/gstpipefilter.h +++ b/gst/elements/gstpipefilter.h @@ -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()) diff --git a/gst/elements/gstshaper.c b/gst/elements/gstshaper.c index 57fcf561b3..5cf0686b1d 100644 --- a/gst/elements/gstshaper.c +++ b/gst/elements/gstshaper.c @@ -29,18 +29,15 @@ #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 ", - "(C) 2003", -}; + "Wim Taymans " +); /* 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; -} diff --git a/gst/elements/gstshaper.h b/gst/elements/gstshaper.h index 71995ae26d..2cbaf53367 100644 --- a/gst/elements/gstshaper.h +++ b/gst/elements/gstshaper.h @@ -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()) diff --git a/gst/elements/gststatistics.c b/gst/elements/gststatistics.c index 3cbcebc356..5c72fbe12c 100644 --- a/gst/elements/gststatistics.c +++ b/gst/elements/gststatistics.c @@ -27,18 +27,15 @@ #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 ", - "(C) 2001", -}; + "David I. Lehn " +); /* 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", diff --git a/gst/elements/gststatistics.h b/gst/elements/gststatistics.h index aedf00adf2..4c1ab57a3e 100644 --- a/gst/elements/gststatistics.h +++ b/gst/elements/gststatistics.h @@ -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()) diff --git a/gst/elements/gsttee.c b/gst/elements/gsttee.c index bfc4f8fa21..4f0249f20c 100644 --- a/gst/elements/gsttee.c +++ b/gst/elements/gsttee.c @@ -26,19 +26,16 @@ #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 \n" - "Wim Taymans ", - "(C) 1999, 2000", -}; + "Erik Walthinsen , " + "Wim Taymans " +); /* 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,10 +92,20 @@ 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) { @@ -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; -} diff --git a/gst/elements/gsttee.h b/gst/elements/gsttee.h index 0193bb0fa8..b58a6c0312 100644 --- a/gst/elements/gsttee.h +++ b/gst/elements/gsttee.h @@ -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()) diff --git a/gst/elements/gsttypefind.c b/gst/elements/gsttypefind.c index bd5e3d367b..7d38b0ffa9 100644 --- a/gst/elements/gsttypefind.c +++ b/gst/elements/gsttypefind.c @@ -43,18 +43,15 @@ #include -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 ", - "(C) 2003", -}; + "Benjamin Otte " +); /* 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; diff --git a/gst/elements/gsttypefind.h b/gst/elements/gsttypefind.h index 4b5e0cc40f..7f508ba5e6 100644 --- a/gst/elements/gsttypefind.h +++ b/gst/elements/gsttypefind.h @@ -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)) diff --git a/gst/elements/gsttypefindelement.c b/gst/elements/gsttypefindelement.c index bd5e3d367b..7d38b0ffa9 100644 --- a/gst/elements/gsttypefindelement.c +++ b/gst/elements/gsttypefindelement.c @@ -43,18 +43,15 @@ #include -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 ", - "(C) 2003", -}; + "Benjamin Otte " +); /* 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; diff --git a/gst/elements/gsttypefindelement.h b/gst/elements/gsttypefindelement.h index 4b5e0cc40f..7f508ba5e6 100644 --- a/gst/elements/gsttypefindelement.h +++ b/gst/elements/gsttypefindelement.h @@ -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)) diff --git a/gst/gst.c b/gst/gst.c index f06b11c6ed..dee3371b38 100644 --- 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 }; /* diff --git a/gst/gst_private.h b/gst/gst_private.h index caab5b0381..310df32f6a 100644 --- a/gst/gst_private.h +++ b/gst/gst_private.h @@ -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; diff --git a/gst/gstbin.c b/gst/gstbin.c index 390d5f5c8d..a012b4d709 100644 --- a/gst/gstbin.c +++ b/gst/gstbin.c @@ -31,15 +31,12 @@ #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 ", - "(C) 1999", -}; + "Erik Walthinsen " +); 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, @@ -113,6 +111,14 @@ gst_bin_get_type (void) return _gst_bin_type; } +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) { diff --git a/gst/gstbin.h b/gst/gstbin.h index 9fa4211ba7..d4246a7010 100644 --- a/gst/gstbin.h +++ b/gst/gstbin.h @@ -28,7 +28,6 @@ G_BEGIN_DECLS -extern GstElementDetails gst_bin_details; extern GType _gst_bin_type; #define GST_TYPE_BIN (_gst_bin_type) diff --git a/gst/gstelement.c b/gst/gstelement.c index 6795cfe10e..5c5263a025 100644 --- a/gst/gstelement.c +++ b/gst/gstelement.c @@ -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; @@ -156,6 +161,16 @@ gst_element_base_class_init (GstElementClass *klass) gobject_class->get_property = GST_DEBUG_FUNCPTR(gst_element_real_get_property); } +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) { @@ -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, @@ -1175,6 +1188,23 @@ gst_element_class_add_pad_template (GstElementClass *klass, klass->numpadtemplates++; } +/** + * gst_element_class_set_details: + * @klass: class to set details for + * @details: details to set + * + * Sets the detailed information for a #GstElementClass. + * This function is for use in _base_init functions only. + */ +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)); */ diff --git a/gst/gstelement.h b/gst/gstelement.h index 352391fe18..83fc301396 100644 --- a/gst/gstelement.h +++ b/gst/gstelement.h @@ -29,11 +29,29 @@ #include #include #include +#include #include #include 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); -GstElementFactory* gst_element_factory_find (const gchar *name); +gboolean gst_element_register (GstPlugin *plugin, + const gchar *elementname, + guint rank, + GType type); -void gst_element_factory_add_pad_template (GstElementFactory *elementfactory, - GstPadTemplate *templ); +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); + +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 diff --git a/gst/gstelementfactory.c b/gst/gstelementfactory.c index c222888d24..d3ba21fba0 100644 --- a/gst/gstelementfactory.c +++ b/gst/gstelementfactory.c @@ -1,6 +1,7 @@ /* GStreamer * Copyright (C) 1999,2000 Erik Walthinsen * 2000 Wim Taymans + * 2003 Benjamin Otte * * 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,48 +268,15 @@ 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; } - -/** - * gst_element_factory_make_or_warn: - * @factoryname: a named factory to instantiate - * @name: name of new element - * - * 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: new #GstElement (or NULL if unable to create element) - */ -GstElement* -gst_element_factory_make_or_warn (const gchar *factoryname, const gchar *name) -{ - GstElement *element; - - element = gst_element_factory_make (factoryname, name); - - if (element == NULL) - g_warning ("Could not create element from factory %s !\n", factoryname); - - return element; -} - -/** - * gst_element_factory_add_pad_template : - * @elementfactory: factory to add the src id to - * @templ: the padtemplate to add - * - * Add the given padtemplate to this elementfactory. - */ void -gst_element_factory_add_pad_template (GstElementFactory *factory, - GstPadTemplate *templ) +__gst_element_factory_add_pad_template (GstElementFactory *factory, + GstPadTemplate *templ) { g_return_if_fail (factory != NULL); g_return_if_fail (templ != NULL); @@ -339,7 +287,111 @@ gst_element_factory_add_pad_template (GstElementFactory *factory, factory->padtemplates = g_list_append (factory->padtemplates, templ); factory->numpadtemplates++; } +/** + * gst_element_factory_get_element_type: + * @factory: factory to get managed #GType from + * + * Get the #GType for elements managed by this factory + * + * 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: the longname + */ +G_CONST_RETURN gchar * +gst_element_factory_get_longname (GstElementFactory *factory) +{ + g_return_val_if_fail (GST_IS_ELEMENT_FACTORY (factory), NULL); + + 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 factory->details.klass; +} +/** + * gst_element_factory_get_description: + * @factory: a #GstElementFactory + * + * Gets the description for this factory. + * + * Returns: the description + */ +G_CONST_RETURN gchar * +gst_element_factory_get_description (GstElementFactory *factory) +{ + g_return_val_if_fail (GST_IS_ELEMENT_FACTORY (factory), NULL); + + 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); + + 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; + } } diff --git a/gst/gstinfo.c b/gst/gstinfo.c index 75a59c472b..843a31fdb9 100644 --- a/gst/gstinfo.c +++ b/gst/gstinfo.c @@ -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); diff --git a/gst/gstpipeline.c b/gst/gstpipeline.c index 0398a246b2..7338039266 100644 --- a/gst/gstpipeline.c +++ b/gst/gstpipeline.c @@ -26,15 +26,12 @@ #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 ", - "(C) 1999", -}; + "Erik Walthinsen " +); /* 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); diff --git a/gst/gstpipeline.h b/gst/gstpipeline.h index 99a4564509..b63419558c 100644 --- a/gst/gstpipeline.h +++ b/gst/gstpipeline.h @@ -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)) diff --git a/gst/gstplugin.c b/gst/gstplugin.c index e02a094b74..9e77f533ff 100644 --- a/gst/gstplugin.c +++ b/gst/gstplugin.c @@ -34,11 +34,28 @@ #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)); + + 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; + + 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_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); - - 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; + if (g_module_symbol (module, "gst_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; + 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,41 +349,7 @@ gst_plugin_get_name (GstPlugin *plugin) { g_return_val_if_fail (plugin != NULL, NULL); - return plugin->name; -} - -/** - * gst_plugin_set_name: - * @plugin: plugin to set name of - * @name: new name - * - * Sets the name (should be short) of the plugin. - */ -void -gst_plugin_set_name (GstPlugin *plugin, const gchar *name) -{ - g_return_if_fail (plugin != NULL); - - g_free (plugin->name); - - plugin->name = g_strdup (name); -} - -/** - * gst_plugin_set_longname: - * @plugin: plugin to set long name of - * @longname: new long name - * - * Sets the long name (should be descriptive) of the plugin. - */ -void -gst_plugin_set_longname (GstPlugin *plugin, const gchar *longname) -{ - g_return_if_fail(plugin != NULL); - - g_free(plugin->longname); - - plugin->longname = g_strdup(longname); + return plugin->desc.name; } /** @@ -310,12 +360,12 @@ gst_plugin_set_longname (GstPlugin *plugin, const gchar *longname) * * Returns: the long name of the plugin */ -const gchar* -gst_plugin_get_longname (GstPlugin *plugin) +G_CONST_RETURN gchar* +gst_plugin_get_description (GstPlugin *plugin) { g_return_val_if_fail (plugin != NULL, NULL); - return plugin->longname; + return plugin->desc.description; } /** @@ -326,14 +376,90 @@ gst_plugin_get_longname (GstPlugin *plugin) * * Returns: the filename of the plugin */ -const gchar* +G_CONST_RETURN gchar* gst_plugin_get_filename (GstPlugin *plugin) { g_return_val_if_fail (plugin != NULL, NULL); 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_copyright: + * @plugin: plugin to get the copyright of + * + * get the informal copyright notice of the plugin + * + * Returns: the copyright of the plugin + */ +G_CONST_RETURN gchar* +gst_plugin_get_copyright (GstPlugin *plugin) +{ + g_return_val_if_fail (plugin != NULL, NULL); + + 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_origin: + * @plugin: plugin to get the origin of + * + * get the URL where the plugin comes from + * + * Returns: the origin of the plugin + */ +G_CONST_RETURN gchar* +gst_plugin_get_origin (GstPlugin *plugin) +{ + g_return_val_if_fail (plugin != NULL, NULL); + + 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; } diff --git a/gst/gstplugin.h b/gst/gstplugin.h index 2bbe59385a..8b01d27d2b 100644 --- a/gst/gstplugin.h +++ b/gst/gstplugin.h @@ -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; +/* 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 +}; + struct _GstPlugin { - gchar *name; /* name of the plugin */ - gchar *longname; /* long name of plugin */ - gchar *filename; /* filename it came from */ + GstPluginDesc desc; - GList *features; /* list of features provided */ - gint numfeatures; + gchar * filename; + 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 */ + gpointer manager; /* managing registry */ + GModule * module; /* contains the module if the plugin is loaded */ GST_STRUCT_PADDING }; -/* Initialiser function: returns TRUE if plugin initialised successfully */ -typedef gboolean (*GstPluginInitFunc) (GModule *module, 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; /* name of plugin */ - GstPluginInitFunc plugin_init; /* pointer to plugin_init function */ -}; - #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); diff --git a/gst/gstpluginfeature.c b/gst/gstpluginfeature.c index 494075cd26..5c8afed0a2 100644 --- a/gst/gstpluginfeature.c +++ b/gst/gstpluginfeature.c @@ -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; diff --git a/gst/gstqueue.c b/gst/gstqueue.c index c1924242e7..5c22dc01de 100644 --- a/gst/gstqueue.c +++ b/gst/gstqueue.c @@ -29,15 +29,12 @@ #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 ", - "(C) 1999", -}; + "Erik Walthinsen " +); /* 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); - gobject_class = (GObjectClass*)klass; - gstelement_class = (GstElementClass*)klass; + gst_element_class_set_details (gstelement_class, &gst_queue_details); +} - parent_class = g_type_class_ref (GST_TYPE_ELEMENT); +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_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); diff --git a/gst/gstqueue.h b/gst/gstqueue.h index e7ee592837..c52d637730 100644 --- a/gst/gstqueue.h +++ b/gst/gstqueue.h @@ -30,9 +30,6 @@ G_BEGIN_DECLS -extern GstElementDetails gst_queue_details; - - #define GST_TYPE_QUEUE \ (gst_queue_get_type()) #define GST_QUEUE(obj) \ diff --git a/gst/gstthread.c b/gst/gstthread.c index b97a6bb673..d51ba7a52d 100644 --- a/gst/gstthread.c +++ b/gst/gstthread.c @@ -31,17 +31,13 @@ #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 , " - "Benjamin Otte 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 **********************************************/ diff --git a/gst/gsttypefind.h b/gst/gsttypefind.h index e8fa685921..5662133b38 100644 --- a/gst/gsttypefind.h +++ b/gst/gsttypefind.h @@ -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, diff --git a/gst/gsttypes.h b/gst/gsttypes.h index 81e4b87a64..ad4f029211 100644 --- a/gst/gsttypes.h +++ b/gst/gsttypes.h @@ -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__ */ diff --git a/gst/indexers/gstfileindex.c b/gst/indexers/gstfileindex.c index 3806aa700e..ccb969e78c 100644 --- a/gst/indexers/gstfileindex.c +++ b/gst/indexers/gstfileindex.c @@ -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", diff --git a/gst/indexers/gstindexers.c b/gst/indexers/gstindexers.c index e2f491e901..6894202a4d 100644 --- a/gst/indexers/gstindexers.c +++ b/gst/indexers/gstindexers.c @@ -21,24 +21,31 @@ #include #include -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 +) + diff --git a/gst/indexers/gstmemindex.c b/gst/indexers/gstmemindex.c index 80856c4637..bc5f210d99 100644 --- a/gst/indexers/gstmemindex.c +++ b/gst/indexers/gstmemindex.c @@ -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()); diff --git a/gst/registries/gstxmlregistry.c b/gst/registries/gstxmlregistry.c index 3f5493fb62..c0555a2c3c 100644 --- a/gst/registries/gstxmlregistry.c +++ b/gst/registries/gstxmlregistry.c @@ -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; diff --git a/gst/schedulers/gstbasicscheduler.c b/gst/schedulers/gstbasicscheduler.c index 3fd64b7544..06c80392f1 100644 --- a/gst/schedulers/gstbasicscheduler.c +++ b/gst/schedulers/gstbasicscheduler.c @@ -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) diff --git a/gst/schedulers/gstoptimalscheduler.c b/gst/schedulers/gstoptimalscheduler.c index a6d6ff7e07..4826f27736 100644 --- a/gst/schedulers/gstoptimalscheduler.c +++ b/gst/schedulers/gstoptimalscheduler.c @@ -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 diff --git a/libs/gst/bytestream/bytestream.c b/libs/gst/bytestream/bytestream.c index 8476806d13..352551a1b3 100644 --- a/libs/gst/bytestream/bytestream.c +++ b/libs/gst/bytestream/bytestream.c @@ -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 +) diff --git a/libs/gst/getbits/getbits.c b/libs/gst/getbits/getbits.c index b5644be3bb..419015cb87 100644 --- a/libs/gst/getbits/getbits.c +++ b/libs/gst/getbits/getbits.c @@ -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 +) + diff --git a/plugins/elements/gstaggregator.c b/plugins/elements/gstaggregator.c index 3c3ba5d8a8..797d41a6f9 100644 --- a/plugins/elements/gstaggregator.c +++ b/plugins/elements/gstaggregator.c @@ -26,18 +26,15 @@ #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 ", - "(C) 2001", -}; + "Wim Taymans " +); /* 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,10 +114,19 @@ 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) { @@ -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; -} + diff --git a/plugins/elements/gstaggregator.h b/plugins/elements/gstaggregator.h index e53b8540c5..7e6105bf01 100644 --- a/plugins/elements/gstaggregator.h +++ b/plugins/elements/gstaggregator.h @@ -28,8 +28,6 @@ G_BEGIN_DECLS -extern GstElementDetails gst_aggregator_details; -GST_DEBUG_CATEGORY_EXTERN(gst_aggregator_debug); typedef enum { AGGREGATOR_LOOP = 1, diff --git a/plugins/elements/gstbufferstore.c b/plugins/elements/gstbufferstore.c index a91648b2dd..dd17216756 100644 --- a/plugins/elements/gstbufferstore.c +++ b/plugins/elements/gstbufferstore.c @@ -25,7 +25,7 @@ #include "gstbufferstore.h" #include -GST_DEBUG_CATEGORY (gst_buffer_store_debug); +GST_DEBUG_CATEGORY_STATIC (gst_buffer_store_debug); #define GST_CAT_DEFAULT gst_buffer_store_debug enum { diff --git a/plugins/elements/gstelements.c b/plugins/elements/gstelements.c index 7b769a0514..909b88392c 100644 --- a/plugins/elements/gstelements.c +++ b/plugins/elements/gstelements.c @@ -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 +) + diff --git a/plugins/elements/gstfakesink.c b/plugins/elements/gstfakesink.c index d9a94a5821..fa526061d7 100644 --- a/plugins/elements/gstfakesink.c +++ b/plugins/elements/gstfakesink.c @@ -27,18 +27,15 @@ #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 ", - "(C) 1999", -}; + "Erik Walthinsen " +); /* 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,10 +123,20 @@ 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) { @@ -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; -} diff --git a/plugins/elements/gstfakesink.h b/plugins/elements/gstfakesink.h index 95ee8be900..a8e7cd0673 100644 --- a/plugins/elements/gstfakesink.h +++ b/plugins/elements/gstfakesink.h @@ -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()) diff --git a/plugins/elements/gstfakesrc.c b/plugins/elements/gstfakesrc.c index 14287e347e..3a82dc0c9d 100644 --- a/plugins/elements/gstfakesrc.c +++ b/plugins/elements/gstfakesrc.c @@ -34,19 +34,16 @@ #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 \n" - "Wim Taymans ", - "(C) 1999", -}; + "Erik Walthinsen , " + "Wim Taymans " +); /* 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, @@ -198,6 +198,14 @@ gst_fakesrc_get_type (void) return fakesrc_type; } +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) { @@ -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; -} diff --git a/plugins/elements/gstfakesrc.h b/plugins/elements/gstfakesrc.h index 1dbb4f07ca..5b3b875494 100644 --- a/plugins/elements/gstfakesrc.h +++ b/plugins/elements/gstfakesrc.h @@ -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, diff --git a/plugins/elements/gstfdsink.c b/plugins/elements/gstfdsink.c index b3f2159123..b0ecc94d7f 100644 --- a/plugins/elements/gstfdsink.c +++ b/plugins/elements/gstfdsink.c @@ -27,18 +27,15 @@ #include "gstfdsink.h" #include -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 ", - "(C) 1999", -}; + "Erik Walthinsen " +); /* 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); diff --git a/plugins/elements/gstfdsink.h b/plugins/elements/gstfdsink.h index 4f6dfb69cc..838705a724 100644 --- a/plugins/elements/gstfdsink.h +++ b/plugins/elements/gstfdsink.h @@ -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()) diff --git a/plugins/elements/gstfdsrc.c b/plugins/elements/gstfdsrc.c index 9970399874..de7359c6e5 100644 --- a/plugins/elements/gstfdsrc.c +++ b/plugins/elements/gstfdsrc.c @@ -35,19 +35,15 @@ #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 ", - "(C) 1999", -}; + "Erik Walthinsen " +); /* 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, diff --git a/plugins/elements/gstfdsrc.h b/plugins/elements/gstfdsrc.h index a17b2d5805..b004e0ba4a 100644 --- a/plugins/elements/gstfdsrc.h +++ b/plugins/elements/gstfdsrc.h @@ -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()) diff --git a/plugins/elements/gstfilesink.c b/plugins/elements/gstfilesink.c index 88372f79ef..5c4c81c84f 100644 --- a/plugins/elements/gstfilesink.c +++ b/plugins/elements/gstfilesink.c @@ -33,18 +33,15 @@ #include #include -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 ", - "(C) 2001" -}; + "Thomas " +); /* 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_base_init (gpointer g_class) +{ + GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); + + 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; - GstElementClass *gstelement_class; + GObjectClass *gobject_class = G_OBJECT_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_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 diff --git a/plugins/elements/gstfilesink.h b/plugins/elements/gstfilesink.h index 99e38eb650..b72551bfe0 100644 --- a/plugins/elements/gstfilesink.h +++ b/plugins/elements/gstfilesink.h @@ -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()) diff --git a/plugins/elements/gstfilesrc.c b/plugins/elements/gstfilesrc.c index d3288d6b36..f243d97c27 100644 --- a/plugins/elements/gstfilesrc.c +++ b/plugins/elements/gstfilesrc.c @@ -72,18 +72,15 @@ */ -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 ", - "(C) 1999", -}; + "Erik Walthinsen " +); #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", diff --git a/plugins/elements/gstfilesrc.h b/plugins/elements/gstfilesrc.h index f1600c95d3..23b6ddeef5 100644 --- a/plugins/elements/gstfilesrc.h +++ b/plugins/elements/gstfilesrc.h @@ -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()) diff --git a/plugins/elements/gstidentity.c b/plugins/elements/gstidentity.c index b6b77d6f20..24021be6b1 100644 --- a/plugins/elements/gstidentity.c +++ b/plugins/elements/gstidentity.c @@ -29,18 +29,15 @@ #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 ", - "(C) 1999", -}; + "Erik Walthinsen " +); /* 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", diff --git a/plugins/elements/gstidentity.h b/plugins/elements/gstidentity.h index dd04364c9f..8e39b84248 100644 --- a/plugins/elements/gstidentity.h +++ b/plugins/elements/gstidentity.h @@ -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()) diff --git a/plugins/elements/gstmd5sink.c b/plugins/elements/gstmd5sink.c index 114d78daf0..181487d3ae 100644 --- a/plugins/elements/gstmd5sink.c +++ b/plugins/elements/gstmd5sink.c @@ -32,9 +32,16 @@ #include #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 " +); + /* 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,10 +400,20 @@ 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) { @@ -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 ", - "(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; -} diff --git a/plugins/elements/gstmd5sink.h b/plugins/elements/gstmd5sink.h index 5d24df69d5..fc847b2a21 100644 --- a/plugins/elements/gstmd5sink.h +++ b/plugins/elements/gstmd5sink.h @@ -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()) diff --git a/plugins/elements/gstmultidisksrc.c b/plugins/elements/gstmultidisksrc.c index c2a0e6fdb3..d3ca0d9e5a 100644 --- a/plugins/elements/gstmultidisksrc.c +++ b/plugins/elements/gstmultidisksrc.c @@ -33,18 +33,15 @@ #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 ", - "(C) 2001", -}; + "Dominic Ludlam " +); /* 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,10 +90,19 @@ 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) { diff --git a/plugins/elements/gstmultidisksrc.h b/plugins/elements/gstmultidisksrc.h index 07e83980d3..402cf4fc64 100644 --- a/plugins/elements/gstmultidisksrc.h +++ b/plugins/elements/gstmultidisksrc.h @@ -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()) diff --git a/plugins/elements/gstmultifilesrc.c b/plugins/elements/gstmultifilesrc.c index c2a0e6fdb3..d3ca0d9e5a 100644 --- a/plugins/elements/gstmultifilesrc.c +++ b/plugins/elements/gstmultifilesrc.c @@ -33,18 +33,15 @@ #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 ", - "(C) 2001", -}; + "Dominic Ludlam " +); /* 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,10 +90,19 @@ 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) { diff --git a/plugins/elements/gstmultifilesrc.h b/plugins/elements/gstmultifilesrc.h index 07e83980d3..402cf4fc64 100644 --- a/plugins/elements/gstmultifilesrc.h +++ b/plugins/elements/gstmultifilesrc.h @@ -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()) diff --git a/plugins/elements/gstpipefilter.c b/plugins/elements/gstpipefilter.c index e31e0e255b..611f9420eb 100644 --- a/plugins/elements/gstpipefilter.c +++ b/plugins/elements/gstpipefilter.c @@ -35,19 +35,16 @@ #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 \n" - "Wim Taymans ", - "(C) 1999", -}; + "Erik Walthinsen , " + "Wim Taymans " +); /* 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 diff --git a/plugins/elements/gstpipefilter.h b/plugins/elements/gstpipefilter.h index 9516482c18..08c3a47187 100644 --- a/plugins/elements/gstpipefilter.h +++ b/plugins/elements/gstpipefilter.h @@ -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()) diff --git a/plugins/elements/gstqueue.c b/plugins/elements/gstqueue.c index c1924242e7..5c22dc01de 100644 --- a/plugins/elements/gstqueue.c +++ b/plugins/elements/gstqueue.c @@ -29,15 +29,12 @@ #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 ", - "(C) 1999", -}; + "Erik Walthinsen " +); /* 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); - gobject_class = (GObjectClass*)klass; - gstelement_class = (GstElementClass*)klass; + gst_element_class_set_details (gstelement_class, &gst_queue_details); +} - parent_class = g_type_class_ref (GST_TYPE_ELEMENT); +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_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); diff --git a/plugins/elements/gstqueue.h b/plugins/elements/gstqueue.h index e7ee592837..c52d637730 100644 --- a/plugins/elements/gstqueue.h +++ b/plugins/elements/gstqueue.h @@ -30,9 +30,6 @@ G_BEGIN_DECLS -extern GstElementDetails gst_queue_details; - - #define GST_TYPE_QUEUE \ (gst_queue_get_type()) #define GST_QUEUE(obj) \ diff --git a/plugins/elements/gstshaper.c b/plugins/elements/gstshaper.c index 57fcf561b3..5cf0686b1d 100644 --- a/plugins/elements/gstshaper.c +++ b/plugins/elements/gstshaper.c @@ -29,18 +29,15 @@ #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 ", - "(C) 2003", -}; + "Wim Taymans " +); /* 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; -} diff --git a/plugins/elements/gstshaper.h b/plugins/elements/gstshaper.h index 71995ae26d..2cbaf53367 100644 --- a/plugins/elements/gstshaper.h +++ b/plugins/elements/gstshaper.h @@ -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()) diff --git a/plugins/elements/gststatistics.c b/plugins/elements/gststatistics.c index 3cbcebc356..5c72fbe12c 100644 --- a/plugins/elements/gststatistics.c +++ b/plugins/elements/gststatistics.c @@ -27,18 +27,15 @@ #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 ", - "(C) 2001", -}; + "David I. Lehn " +); /* 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", diff --git a/plugins/elements/gststatistics.h b/plugins/elements/gststatistics.h index aedf00adf2..4c1ab57a3e 100644 --- a/plugins/elements/gststatistics.h +++ b/plugins/elements/gststatistics.h @@ -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()) diff --git a/plugins/elements/gsttee.c b/plugins/elements/gsttee.c index bfc4f8fa21..4f0249f20c 100644 --- a/plugins/elements/gsttee.c +++ b/plugins/elements/gsttee.c @@ -26,19 +26,16 @@ #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 \n" - "Wim Taymans ", - "(C) 1999, 2000", -}; + "Erik Walthinsen , " + "Wim Taymans " +); /* 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,10 +92,20 @@ 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) { @@ -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; -} diff --git a/plugins/elements/gsttee.h b/plugins/elements/gsttee.h index 0193bb0fa8..b58a6c0312 100644 --- a/plugins/elements/gsttee.h +++ b/plugins/elements/gsttee.h @@ -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()) diff --git a/plugins/elements/gsttypefind.c b/plugins/elements/gsttypefind.c index bd5e3d367b..7d38b0ffa9 100644 --- a/plugins/elements/gsttypefind.c +++ b/plugins/elements/gsttypefind.c @@ -43,18 +43,15 @@ #include -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 ", - "(C) 2003", -}; + "Benjamin Otte " +); /* 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; diff --git a/plugins/elements/gsttypefind.h b/plugins/elements/gsttypefind.h index 4b5e0cc40f..7f508ba5e6 100644 --- a/plugins/elements/gsttypefind.h +++ b/plugins/elements/gsttypefind.h @@ -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)) diff --git a/plugins/elements/gsttypefindelement.c b/plugins/elements/gsttypefindelement.c index bd5e3d367b..7d38b0ffa9 100644 --- a/plugins/elements/gsttypefindelement.c +++ b/plugins/elements/gsttypefindelement.c @@ -43,18 +43,15 @@ #include -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 ", - "(C) 2003", -}; + "Benjamin Otte " +); /* 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; diff --git a/plugins/elements/gsttypefindelement.h b/plugins/elements/gsttypefindelement.h index 4b5e0cc40f..7f508ba5e6 100644 --- a/plugins/elements/gsttypefindelement.h +++ b/plugins/elements/gsttypefindelement.h @@ -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)) diff --git a/plugins/indexers/gstfileindex.c b/plugins/indexers/gstfileindex.c index 3806aa700e..ccb969e78c 100644 --- a/plugins/indexers/gstfileindex.c +++ b/plugins/indexers/gstfileindex.c @@ -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", diff --git a/plugins/indexers/gstindexers.c b/plugins/indexers/gstindexers.c index e2f491e901..6894202a4d 100644 --- a/plugins/indexers/gstindexers.c +++ b/plugins/indexers/gstindexers.c @@ -21,24 +21,31 @@ #include #include -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 +) + diff --git a/plugins/indexers/gstmemindex.c b/plugins/indexers/gstmemindex.c index 80856c4637..bc5f210d99 100644 --- a/plugins/indexers/gstmemindex.c +++ b/plugins/indexers/gstmemindex.c @@ -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()); diff --git a/tests/old/examples/plugins/example.c b/tests/old/examples/plugins/example.c index 0bed8f605e..65e047d763 100644 --- a/tests/old/examples/plugins/example.c +++ b/tests/old/examples/plugins/example.c @@ -23,18 +23,16 @@ #include #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 ", - "(C) 2001", -}; + "your name " +); /* 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. */ +); diff --git a/tests/old/testsuite/bytestream/Makefile.am b/tests/old/testsuite/bytestream/Makefile.am index 317e3d46b0..c28cbb0d0e 100644 --- a/tests/old/testsuite/bytestream/Makefile.am +++ b/tests/old/testsuite/bytestream/Makefile.am @@ -4,5 +4,5 @@ tests_pass = tests_fail = test1 test1_SOURCES = test1.c gstbstest.c - +test1_LDFLAGS = -lgstbytestream -L$(top_srcdir)/libs/gst/bytestream diff --git a/tests/old/testsuite/bytestream/gstbstest.c b/tests/old/testsuite/bytestream/gstbstest.c index 9a718c461e..2e9598f1a9 100644 --- a/tests/old/testsuite/bytestream/gstbstest.c +++ b/tests/old/testsuite/bytestream/gstbstest.c @@ -27,7 +27,7 @@ #include #include -#include +#include #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 ," - "Wim Taymans ", - "(C) 2001", -}; + "Erik Walthinsen , " + "Wim Taymans " +); /* 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 +) diff --git a/tests/old/testsuite/plugin/static2.c b/tests/old/testsuite/plugin/static2.c index ec9229ed2e..baea7b8ab3 100644 --- a/tests/old/testsuite/plugin/static2.c +++ b/tests/old/testsuite/plugin/static2.c @@ -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", diff --git a/tests/old/testsuite/plugin/testplugin.c b/tests/old/testsuite/plugin/testplugin.c index 57c55220af..e834c8eeda 100644 --- a/tests/old/testsuite/plugin/testplugin.c +++ b/tests/old/testsuite/plugin/testplugin.c @@ -1,15 +1,25 @@ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include 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 ); diff --git a/tests/old/testsuite/plugin/testplugin2.c b/tests/old/testsuite/plugin/testplugin2.c index 08a14b7247..7af301b586 100644 --- a/tests/old/testsuite/plugin/testplugin2.c +++ b/tests/old/testsuite/plugin/testplugin2.c @@ -1,15 +1,25 @@ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include 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 ); diff --git a/testsuite/bytestream/Makefile.am b/testsuite/bytestream/Makefile.am index 317e3d46b0..c28cbb0d0e 100644 --- a/testsuite/bytestream/Makefile.am +++ b/testsuite/bytestream/Makefile.am @@ -4,5 +4,5 @@ tests_pass = tests_fail = test1 test1_SOURCES = test1.c gstbstest.c - +test1_LDFLAGS = -lgstbytestream -L$(top_srcdir)/libs/gst/bytestream diff --git a/testsuite/bytestream/gstbstest.c b/testsuite/bytestream/gstbstest.c index 9a718c461e..2e9598f1a9 100644 --- a/testsuite/bytestream/gstbstest.c +++ b/testsuite/bytestream/gstbstest.c @@ -27,7 +27,7 @@ #include #include -#include +#include #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 ," - "Wim Taymans ", - "(C) 2001", -}; + "Erik Walthinsen , " + "Wim Taymans " +); /* 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 +) diff --git a/testsuite/plugin/static2.c b/testsuite/plugin/static2.c index ec9229ed2e..baea7b8ab3 100644 --- a/testsuite/plugin/static2.c +++ b/testsuite/plugin/static2.c @@ -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", diff --git a/testsuite/plugin/testplugin.c b/testsuite/plugin/testplugin.c index 57c55220af..e834c8eeda 100644 --- a/testsuite/plugin/testplugin.c +++ b/testsuite/plugin/testplugin.c @@ -1,15 +1,25 @@ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include 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 ); diff --git a/testsuite/plugin/testplugin2.c b/testsuite/plugin/testplugin2.c index 08a14b7247..7af301b586 100644 --- a/testsuite/plugin/testplugin2.c +++ b/testsuite/plugin/testplugin2.c @@ -1,15 +1,25 @@ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include 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 ); diff --git a/tools/gst-inspect.c b/tools/gst-inspect.c index f0e4a7b509..92e4422171 100644 --- a/tools/gst-inspect.c +++ b/tools/gst-inspect.c @@ -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++; } diff --git a/tools/gst-register.c b/tools/gst-register.c index 087a0f8906..df4817b4d9 100644 --- a/tools/gst-register.c +++ b/tools/gst-register.c @@ -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; diff --git a/tools/gst-xmlinspect.c b/tools/gst-xmlinspect.c index dac74002cd..89d1c0393d 100644 --- a/tools/gst-xmlinspect.c +++ b/tools/gst-xmlinspect.c @@ -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)) {