diff options
author | Jan Schmidt <thaytan@mad.scientist.com> | 2003-11-02 14:09:39 +0000 |
---|---|---|
committer | Jan Schmidt <thaytan@mad.scientist.com> | 2003-11-02 14:09:39 +0000 |
commit | 75658894acd6eb4eb1d6ae9c808c20fde6154aec (patch) | |
tree | dcdf2b4c59bb80b0a57c826f199f4efb6e9a5250 | |
parent | bd4206da038fa8d66757777f33c6ffcb26f9e824 (diff) | |
download | gst-plugins-bad-75658894acd6eb4eb1d6ae9c808c20fde6154aec.tar.gz gst-plugins-bad-75658894acd6eb4eb1d6ae9c808c20fde6154aec.tar.bz2 gst-plugins-bad-75658894acd6eb4eb1d6ae9c808c20fde6154aec.zip |
Updated for the new plugin loading code
Original commit message from CVS:
Updated for the new plugin loading code
-rw-r--r-- | gst/filter/gstbpwsinc.c | 27 | ||||
-rw-r--r-- | gst/filter/gstfilter.c | 43 | ||||
-rw-r--r-- | gst/filter/gstfilter.h | 9 | ||||
-rw-r--r-- | gst/filter/gstiir.c | 28 | ||||
-rw-r--r-- | gst/filter/gstlpwsinc.c | 27 |
5 files changed, 80 insertions, 54 deletions
diff --git a/gst/filter/gstbpwsinc.c b/gst/filter/gstbpwsinc.c index be9feec7..fe721f39 100644 --- a/gst/filter/gstbpwsinc.c +++ b/gst/filter/gstbpwsinc.c @@ -39,15 +39,13 @@ #include <string.h> /* memmove */ /* elementfactory information */ -GstElementDetails gst_bpwsinc_details = { +static GstElementDetails gst_bpwsinc_details = GST_ELEMENT_DETAILS ( "BPWSinc", "Filter/Audio/Effect", - "LGPL", "Band-Pass Windowed sinc filter", - VERSION, - "Thomas <thomas@apestaart.org>", - "(C) 2002 Steven W. Smith", -}; + "Thomas <thomas@apestaart.org>, " + "Steven W. Smith" +); enum { /* FILL ME */ @@ -95,6 +93,7 @@ struct _GstBPWSincClass GstElementClass parent_class; }; +static void gst_bpwsinc_base_init (gpointer g_class); static void gst_bpwsinc_class_init (GstBPWSincClass * klass); static void gst_bpwsinc_init (GstBPWSinc * filter); @@ -117,7 +116,9 @@ GType gst_bpwsinc_get_type (void) if (!bpwsinc_type) { static const GTypeInfo bpwsinc_info = { - sizeof (GstBPWSincClass), NULL, NULL, + sizeof (GstBPWSincClass), + gst_bpwsinc_base_init, + NULL, (GClassInitFunc) gst_bpwsinc_class_init, NULL, NULL, sizeof (GstBPWSinc), 0, (GInstanceInitFunc) gst_bpwsinc_init, @@ -130,6 +131,18 @@ GType gst_bpwsinc_get_type (void) } static void +gst_bpwsinc_base_init (gpointer g_class) +{ + GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); + + /* register src pads */ + gst_element_class_add_pad_template (element_class, gst_filter_src_factory ()); + gst_element_class_add_pad_template (element_class, gst_filter_sink_factory ()); + + gst_element_class_set_details (element_class, &gst_bpwsinc_details); +} + +static void gst_bpwsinc_class_init (GstBPWSincClass * klass) { GObjectClass *gobject_class; diff --git a/gst/filter/gstfilter.c b/gst/filter/gstfilter.c index c5e6ccba..8b5a8cd9 100644 --- a/gst/filter/gstfilter.c +++ b/gst/filter/gstfilter.c @@ -20,6 +20,9 @@ * Boston, MA 02111-1307, USA. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include "gstfilter.h" #include <gst/audio/audio.h> @@ -27,14 +30,12 @@ struct _elements_entry { gchar *name; GType (*type) (void); - GstElementDetails *details; - gboolean (*factoryinit) (GstElementFactory *factory); }; static struct _elements_entry _elements[] = { - { "iir", gst_iir_get_type, &gst_iir_details, NULL }, - { "lpwsinc", gst_lpwsinc_get_type, &gst_lpwsinc_details, NULL }, - { "bpwsinc", gst_bpwsinc_get_type, &gst_bpwsinc_details, NULL }, + { "iir", gst_iir_get_type }, + { "lpwsinc", gst_lpwsinc_get_type }, + { "bpwsinc", gst_bpwsinc_get_type }, { NULL, 0 }, }; @@ -77,37 +78,29 @@ gst_filter_sink_factory (void) } static gboolean -plugin_init (GModule * module, GstPlugin * plugin) +plugin_init (GstPlugin * plugin) { - GstElementFactory *factory; gint i = 0; while (_elements[i].name) { - factory = gst_element_factory_new (_elements[i].name, - (_elements[i].type) (), - _elements[i].details); + if (!gst_element_register (plugin, _elements[i].name, GST_RANK_NONE, _elements[i].type())) + return FALSE; - if (!factory) { - g_warning ("gst_filter_new failed for `%s'", - _elements[i].name); - continue; - } - gst_element_factory_add_pad_template (factory, gst_filter_src_factory ()); - gst_element_factory_add_pad_template (factory, gst_filter_sink_factory ()); - - gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory)); - if (_elements[i].factoryinit) { - _elements[i].factoryinit (factory); - } i++; } return TRUE; } -GstPluginDesc plugin_desc = { +GST_PLUGIN_DEFINE ( GST_VERSION_MAJOR, GST_VERSION_MINOR, "filter", - plugin_init -}; + "IIR, lpwsinc and bpwsinc audio filter elements", + plugin_init, + VERSION, + "LGPL", + GST_COPYRIGHT, + GST_PACKAGE, + GST_ORIGIN +); diff --git a/gst/filter/gstfilter.h b/gst/filter/gstfilter.h index 48b19798..4669e554 100644 --- a/gst/filter/gstfilter.h +++ b/gst/filter/gstfilter.h @@ -26,15 +26,10 @@ #include <gst/gst.h> GType gst_iir_get_type (void); -extern GstElementDetails gst_iir_details; +GType gst_lpwsinc_get_type (void); +GType gst_bpwsinc_get_type (void); extern GstPadTemplate *gst_filter_sink_factory (); extern GstPadTemplate *gst_filter_src_factory (); -GType gst_lpwsinc_get_type (void); -extern GstElementDetails gst_lpwsinc_details; - -GType gst_bpwsinc_get_type (void); -extern GstElementDetails gst_bpwsinc_details; - #endif /* __GST_FILTER_H__ */ diff --git a/gst/filter/gstiir.c b/gst/filter/gstiir.c index 61fff92b..185b1522 100644 --- a/gst/filter/gstiir.c +++ b/gst/filter/gstiir.c @@ -25,16 +25,13 @@ #include "gstfilter.h" #include "iir.h" -GstElementDetails gst_iir_details = { +static GstElementDetails gst_iir_details = GST_ELEMENT_DETAILS ( "IIR", "Filter/Audio/Effect", - "LGPL", "IIR filter based on vorbis code", - VERSION, - "Monty <monty@xiph.org>, "\ - "Thomas <thomas@apestaart.org>", - "(C) 2001", -}; + "Monty <monty@xiph.org>, " + "Thomas <thomas@apestaart.org>" +); enum { /* FILL ME */ @@ -80,6 +77,7 @@ struct _GstIIRClass GstElementClass parent_class; }; +static void gst_iir_base_init (gpointer g_class); static void gst_iir_class_init (GstIIRClass * klass); static void gst_iir_init (GstIIR * filter); @@ -102,7 +100,9 @@ GType gst_iir_get_type (void) if (!iir_type) { static const GTypeInfo iir_info = { - sizeof (GstIIRClass), NULL, NULL, + sizeof (GstIIRClass), + gst_iir_base_init, + NULL, (GClassInitFunc) gst_iir_class_init, NULL, NULL, sizeof (GstIIR), 0, (GInstanceInitFunc) gst_iir_init, @@ -115,6 +115,18 @@ GType gst_iir_get_type (void) } static void +gst_iir_base_init (gpointer g_class) +{ + GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); + + /* register src pads */ + gst_element_class_add_pad_template (element_class, gst_filter_src_factory ()); + gst_element_class_add_pad_template (element_class, gst_filter_sink_factory ()); + + gst_element_class_set_details (element_class, &gst_iir_details); +} + +static void gst_iir_class_init (GstIIRClass * klass) { GObjectClass *gobject_class; diff --git a/gst/filter/gstlpwsinc.c b/gst/filter/gstlpwsinc.c index 18bebef7..1ed5078d 100644 --- a/gst/filter/gstlpwsinc.c +++ b/gst/filter/gstlpwsinc.c @@ -38,15 +38,13 @@ #include <math.h> /* M_PI */ #include <string.h> /* memmove */ -GstElementDetails gst_lpwsinc_details = { +static GstElementDetails gst_lpwsinc_details = GST_ELEMENT_DETAILS ( "LPWSinc", "Filter/Audio/Effect", - "LGPL", "Low-pass Windowed sinc filter", - VERSION, - "Thomas <thomas@apestaart.org>", - "(C) 2002 Steven W. Smith", -}; + "Thomas <thomas@apestaart.org>, " + "Steven W. Smith" +); enum { /* FILL ME */ @@ -92,6 +90,7 @@ struct _GstLPWSincClass GstElementClass parent_class; }; +static void gst_lpwsinc_base_init (gpointer g_class); static void gst_lpwsinc_class_init (GstLPWSincClass * klass); static void gst_lpwsinc_init (GstLPWSinc * filter); @@ -114,7 +113,9 @@ GType gst_lpwsinc_get_type (void) if (!lpwsinc_type) { static const GTypeInfo lpwsinc_info = { - sizeof (GstLPWSincClass), NULL, NULL, + sizeof (GstLPWSincClass), + gst_lpwsinc_base_init, + NULL, (GClassInitFunc) gst_lpwsinc_class_init, NULL, NULL, sizeof (GstLPWSinc), 0, (GInstanceInitFunc) gst_lpwsinc_init, @@ -127,6 +128,18 @@ GType gst_lpwsinc_get_type (void) } static void +gst_lpwsinc_base_init (gpointer g_class) +{ + GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); + + /* register src pads */ + gst_element_class_add_pad_template (element_class, gst_filter_src_factory ()); + gst_element_class_add_pad_template (element_class, gst_filter_sink_factory ()); + + gst_element_class_set_details (element_class, &gst_lpwsinc_details); +} + +static void gst_lpwsinc_class_init (GstLPWSincClass * klass) { GObjectClass *gobject_class; |