fix for new plugin system

Original commit message from CVS:
fix for new plugin system
This commit is contained in:
Benjamin Otte 2003-11-02 22:34:11 +00:00
parent 1075f2109f
commit 309bd248b1
4 changed files with 65 additions and 57 deletions

View file

@ -25,15 +25,12 @@
#include "gstspectrum.h" #include "gstspectrum.h"
/* elementfactory information */ /* elementfactory information */
static GstElementDetails gst_spectrum_details = { static GstElementDetails gst_spectrum_details = GST_ELEMENT_DETAILS (
"Spectrum analyzer", "Spectrum analyzer",
"Filter/Audio/Analysis", "Filter/Audio/Analysis",
"LGPL",
"Run an FFT on the audio signal, output spectrum data", "Run an FFT on the audio signal, output spectrum data",
VERSION, "Erik Walthinsen <omega@cse.ogi.edu>"
"Erik Walthinsen <omega@cse.ogi.edu>", );
"(C) 1999",
};
/* Spectrum signals and args */ /* Spectrum signals and args */
enum { enum {
@ -47,6 +44,7 @@ enum {
}; };
static void gst_spectrum_base_init (gpointer g_class);
static void gst_spectrum_class_init (GstSpectrumClass *klass); static void gst_spectrum_class_init (GstSpectrumClass *klass);
static void gst_spectrum_init (GstSpectrum *spectrum); static void gst_spectrum_init (GstSpectrum *spectrum);
@ -70,7 +68,8 @@ gst_spectrum_get_type (void)
if (!spectrum_type) { if (!spectrum_type) {
static const GTypeInfo spectrum_info = { static const GTypeInfo spectrum_info = {
sizeof(GstSpectrumClass), NULL, sizeof(GstSpectrumClass),
gst_spectrum_base_init,
NULL, NULL,
(GClassInitFunc)gst_spectrum_class_init, (GClassInitFunc)gst_spectrum_class_init,
NULL, NULL,
@ -84,6 +83,13 @@ gst_spectrum_get_type (void)
return spectrum_type; return spectrum_type;
} }
static void
gst_spectrum_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_set_details (element_class, &gst_spectrum_details);
}
static void static void
gst_spectrum_class_init (GstSpectrumClass *klass) gst_spectrum_class_init (GstSpectrumClass *klass)
{ {
@ -193,23 +199,20 @@ gst_spectrum_chain (GstPad *pad, GstData *_data)
} }
static gboolean static gboolean
plugin_init (GModule *module, GstPlugin *plugin) plugin_init (GstPlugin *plugin)
{ {
GstElementFactory *factory; return gst_element_register (plugin, "spectrum", GST_RANK_NONE, GST_TYPE_SPECTRUM);
/* create an elementfactory for the spectrum element */
factory = gst_element_factory_new ("spectrum",GST_TYPE_SPECTRUM,
&gst_spectrum_details);
g_return_val_if_fail (factory != NULL, FALSE);
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
return TRUE;
} }
GstPluginDesc plugin_desc = { GST_PLUGIN_DEFINE (
GST_VERSION_MAJOR, GST_VERSION_MAJOR,
GST_VERSION_MINOR, GST_VERSION_MINOR,
"spectrum", "spectrum",
plugin_init "Run an FFT on the audio signal, output spectrum data",
}; plugin_init,
VERSION,
GST_LICENSE,
GST_COPYRIGHT,
GST_PACKAGE,
GST_ORIGIN
)

View file

@ -21,32 +21,27 @@
#include "gstudpsrc.h" #include "gstudpsrc.h"
#include "gstudpsink.h" #include "gstudpsink.h"
/* elementfactory information */
extern GstElementDetails gst_udpsrc_details;
extern GstElementDetails gst_udpsink_details;
static gboolean static gboolean
plugin_init (GModule *module, GstPlugin *plugin) plugin_init (GstPlugin *plugin)
{ {
GstElementFactory *src, *sink; if (!gst_element_register (plugin, "udpsink", GST_RANK_NONE, GST_TYPE_UDPSINK))
return FALSE;
/* create an elementfactory for the udpsrc element */
sink = gst_element_factory_new ("udpsink",GST_TYPE_UDPSINK, if (!gst_element_register (plugin, "udpsrc", GST_RANK_NONE, GST_TYPE_UDPSRC))
&gst_udpsink_details); return FALSE;
g_return_val_if_fail (sink != NULL, FALSE);
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (sink));
src = gst_element_factory_new ("udpsrc",GST_TYPE_UDPSRC,
&gst_udpsrc_details);
g_return_val_if_fail (src != NULL, FALSE);
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (src));
return TRUE; return TRUE;
} }
GstPluginDesc plugin_desc = { GST_PLUGIN_DEFINE (
GST_VERSION_MAJOR, GST_VERSION_MAJOR,
GST_VERSION_MINOR, GST_VERSION_MINOR,
"udp", "udp",
plugin_init "transfer data via UDP",
}; plugin_init,
VERSION,
GST_LICENSE,
GST_COPYRIGHT,
GST_PACKAGE,
GST_ORIGIN
)

View file

@ -28,15 +28,12 @@
#define UDP_DEFAULT_CONTROL 1 #define UDP_DEFAULT_CONTROL 1
/* elementfactory information */ /* elementfactory information */
GstElementDetails gst_udpsink_details = { GstElementDetails gst_udpsink_details = GST_ELEMENT_DETAILS (
"UDP packet sender", "UDP packet sender",
"Sink/Network", "Sink/Network",
"LGPL",
"Send data over the network via UDP", "Send data over the network via UDP",
VERSION, "Wim Taymans <wim.taymans@chello.be>"
"Wim Taymans <wim.taymans@chello.be>", );
"(C) 2001",
};
/* UDPSink signals and args */ /* UDPSink signals and args */
enum { enum {
@ -70,6 +67,7 @@ gst_udpsink_control_get_type(void) {
return udpsink_control_type; return udpsink_control_type;
} }
static void gst_udpsink_base_init (gpointer g_class);
static void gst_udpsink_class_init (GstUDPSink *klass); static void gst_udpsink_class_init (GstUDPSink *klass);
static void gst_udpsink_init (GstUDPSink *udpsink); static void gst_udpsink_init (GstUDPSink *udpsink);
@ -92,11 +90,10 @@ gst_udpsink_get_type (void)
{ {
static GType udpsink_type = 0; static GType udpsink_type = 0;
if (!udpsink_type) { if (!udpsink_type) {
static const GTypeInfo udpsink_info = { static const GTypeInfo udpsink_info = {
sizeof(GstUDPSinkClass), sizeof(GstUDPSinkClass),
NULL, gst_udpsink_base_init,
NULL, NULL,
(GClassInitFunc)gst_udpsink_class_init, (GClassInitFunc)gst_udpsink_class_init,
NULL, NULL,
@ -111,6 +108,14 @@ gst_udpsink_get_type (void)
return udpsink_type; return udpsink_type;
} }
static void
gst_udpsink_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_set_details (element_class, &gst_udpsink_details);
}
static void static void
gst_udpsink_class_init (GstUDPSink *klass) gst_udpsink_class_init (GstUDPSink *klass)
{ {

View file

@ -29,15 +29,12 @@
#define UDP_DEFAULT_MULTICAST_GROUP "0.0.0.0" #define UDP_DEFAULT_MULTICAST_GROUP "0.0.0.0"
/* elementfactory information */ /* elementfactory information */
GstElementDetails gst_udpsrc_details = { static GstElementDetails gst_udpsrc_details = GST_ELEMENT_DETAILS (
"UDP packet receiver", "UDP packet receiver",
"Source/Network", "Source/Network",
"LGPL",
"Receive data over the network via UDP", "Receive data over the network via UDP",
VERSION, "Wim Taymans <wim.taymans@chello.be>"
"Wim Taymans <wim.taymans@chello.be>", );
"(C) 2001",
};
/* UDPSrc signals and args */ /* UDPSrc signals and args */
enum { enum {
@ -69,6 +66,7 @@ gst_udpsrc_control_get_type(void) {
return udpsrc_control_type; return udpsrc_control_type;
} }
static void gst_udpsrc_base_init (gpointer g_class);
static void gst_udpsrc_class_init (GstUDPSrc *klass); static void gst_udpsrc_class_init (GstUDPSrc *klass);
static void gst_udpsrc_init (GstUDPSrc *udpsrc); static void gst_udpsrc_init (GstUDPSrc *udpsrc);
@ -90,11 +88,10 @@ gst_udpsrc_get_type (void)
{ {
static GType udpsrc_type = 0; static GType udpsrc_type = 0;
if (!udpsrc_type) { if (!udpsrc_type) {
static const GTypeInfo udpsrc_info = { static const GTypeInfo udpsrc_info = {
sizeof(GstUDPSrcClass), sizeof(GstUDPSrcClass),
NULL, gst_udpsrc_base_init,
NULL, NULL,
(GClassInitFunc)gst_udpsrc_class_init, (GClassInitFunc)gst_udpsrc_class_init,
NULL, NULL,
@ -109,6 +106,14 @@ gst_udpsrc_get_type (void)
return udpsrc_type; return udpsrc_type;
} }
static void
gst_udpsrc_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_set_details (element_class, &gst_udpsrc_details);
}
static void static void
gst_udpsrc_class_init (GstUDPSrc *klass) gst_udpsrc_class_init (GstUDPSrc *klass)
{ {