fix for new plugin system
authorBenjamin Otte <otte@gnome.org>
Sun, 2 Nov 2003 22:34:11 +0000 (22:34 +0000)
committerBenjamin Otte <otte@gnome.org>
Sun, 2 Nov 2003 22:34:11 +0000 (22:34 +0000)
Original commit message from CVS:
fix for new plugin system

gst/spectrum/gstspectrum.c
gst/udp/gstudp.c
gst/udp/gstudpsink.c
gst/udp/gstudpsrc.c

index 5a2e8eb..eab15fe 100644 (file)
 #include "gstspectrum.h"
 
 /* elementfactory information */
-static GstElementDetails gst_spectrum_details = {
+static GstElementDetails gst_spectrum_details = GST_ELEMENT_DETAILS (
   "Spectrum analyzer",
   "Filter/Audio/Analysis",
-  "LGPL",
   "Run an FFT on the audio signal, output spectrum data",
-  VERSION,
-  "Erik Walthinsen <omega@cse.ogi.edu>",
-  "(C) 1999",
-};
+  "Erik Walthinsen <omega@cse.ogi.edu>"
+);
 
 /* Spectrum signals and args */
 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_init       (GstSpectrum *spectrum);
 
@@ -70,7 +68,8 @@ gst_spectrum_get_type (void)
 
   if (!spectrum_type) {
     static const GTypeInfo spectrum_info = {
-      sizeof(GstSpectrumClass),      NULL,
+      sizeof(GstSpectrumClass),
+      gst_spectrum_base_init,
       NULL,
       (GClassInitFunc)gst_spectrum_class_init,
       NULL,
@@ -85,6 +84,13 @@ gst_spectrum_get_type (void)
 }
 
 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
 gst_spectrum_class_init (GstSpectrumClass *klass)
 {
   GObjectClass *gobject_class;
@@ -193,23 +199,20 @@ gst_spectrum_chain (GstPad *pad, GstData *_data)
 }
 
 static gboolean
-plugin_init (GModule *module, GstPlugin *plugin)
+plugin_init (GstPlugin *plugin)
 {
-  GstElementFactory *factory;
-
-  /* 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;
+  return gst_element_register (plugin, "spectrum", GST_RANK_NONE, GST_TYPE_SPECTRUM);
 }
 
-GstPluginDesc plugin_desc = {
+GST_PLUGIN_DEFINE (
   GST_VERSION_MAJOR,
   GST_VERSION_MINOR,
   "spectrum",
-  plugin_init
-};
+  "Run an FFT on the audio signal, output spectrum data",
+  plugin_init,
+  VERSION,
+  GST_LICENSE,
+  GST_COPYRIGHT,
+  GST_PACKAGE,
+  GST_ORIGIN
+)
index 1a2f4a1..f74b4b2 100644 (file)
 #include "gstudpsrc.h"
 #include "gstudpsink.h"
 
-/* elementfactory information */
-extern GstElementDetails gst_udpsrc_details;
-extern GstElementDetails gst_udpsink_details;
-
 static gboolean
-plugin_init (GModule *module, GstPlugin *plugin)
+plugin_init (GstPlugin *plugin)
 {
-  GstElementFactory *src, *sink;
-
-  /* create an elementfactory for the udpsrc element */
-  sink = gst_element_factory_new ("udpsink",GST_TYPE_UDPSINK,
-                                   &gst_udpsink_details);
-  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));
+  if (!gst_element_register (plugin, "udpsink", GST_RANK_NONE, GST_TYPE_UDPSINK))
+    return FALSE;
+  
+  if (!gst_element_register (plugin, "udpsrc", GST_RANK_NONE, GST_TYPE_UDPSRC))
+    return FALSE;
 
   return TRUE;
 }
 
-GstPluginDesc plugin_desc = {
+GST_PLUGIN_DEFINE (
   GST_VERSION_MAJOR,
   GST_VERSION_MINOR,
   "udp",
-  plugin_init
-};
+  "transfer data via UDP",
+  plugin_init,
+  VERSION,
+  GST_LICENSE,
+  GST_COPYRIGHT,
+  GST_PACKAGE,
+  GST_ORIGIN
+)
index cae46e1..e3bdcb2 100644 (file)
 #define UDP_DEFAULT_CONTROL    1
 
 /* elementfactory information */
-GstElementDetails gst_udpsink_details = {
+GstElementDetails gst_udpsink_details = GST_ELEMENT_DETAILS (
   "UDP packet sender",
   "Sink/Network",
-  "LGPL",
   "Send data over the network via UDP",
-  VERSION,
-  "Wim Taymans <wim.taymans@chello.be>",
-  "(C) 2001",
-};
+  "Wim Taymans <wim.taymans@chello.be>"
+);
 
 /* UDPSink signals and args */
 enum {
@@ -70,6 +67,7 @@ gst_udpsink_control_get_type(void) {
   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_init                (GstUDPSink *udpsink);
 
@@ -92,11 +90,10 @@ gst_udpsink_get_type (void)
 {
   static GType udpsink_type = 0;
 
-
   if (!udpsink_type) {
     static const GTypeInfo udpsink_info = {
       sizeof(GstUDPSinkClass),
-      NULL,
+      gst_udpsink_base_init,
       NULL,
       (GClassInitFunc)gst_udpsink_class_init,
       NULL,
@@ -112,6 +109,14 @@ gst_udpsink_get_type (void)
 }
 
 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
 gst_udpsink_class_init (GstUDPSink *klass)
 {
   GObjectClass *gobject_class;
index d332b1c..ce6362e 100644 (file)
 #define UDP_DEFAULT_MULTICAST_GROUP    "0.0.0.0"
 
 /* elementfactory information */
-GstElementDetails gst_udpsrc_details = {
+static GstElementDetails gst_udpsrc_details = GST_ELEMENT_DETAILS (
   "UDP packet receiver",
   "Source/Network",
-  "LGPL",
   "Receive data over the network via UDP",
-  VERSION,
-  "Wim Taymans <wim.taymans@chello.be>",
-  "(C) 2001",
-};
+  "Wim Taymans <wim.taymans@chello.be>"
+);
 
 /* UDPSrc signals and args */
 enum {
@@ -69,6 +66,7 @@ gst_udpsrc_control_get_type(void) {
   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_init                 (GstUDPSrc *udpsrc);
 
@@ -90,11 +88,10 @@ gst_udpsrc_get_type (void)
 {
   static GType udpsrc_type = 0;
 
-
   if (!udpsrc_type) {
     static const GTypeInfo udpsrc_info = {
       sizeof(GstUDPSrcClass),
-      NULL,
+      gst_udpsrc_base_init,
       NULL,
       (GClassInitFunc)gst_udpsrc_class_init,
       NULL,
@@ -110,6 +107,14 @@ gst_udpsrc_get_type (void)
 }
 
 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
 gst_udpsrc_class_init (GstUDPSrc *klass)
 {
   GObjectClass *gobject_class;