gst/udp/gstudpsrc.c: Clean up with the boilerplate macro.
authorAndy Wingo <wingo@pobox.com>
Wed, 16 Nov 2005 10:43:44 +0000 (10:43 +0000)
committerAndy Wingo <wingo@pobox.com>
Wed, 16 Nov 2005 10:43:44 +0000 (10:43 +0000)
Original commit message from CVS:
2005-11-16  Andy Wingo  <wingo@pobox.com>

* gst/udp/gstudpsrc.c: Clean up with the boilerplate macro.

ChangeLog
gst/udp/gstudpsrc.c

index a495970..c905299 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2005-11-16  Andy Wingo  <wingo@pobox.com>
+
+       * gst/udp/gstudpsrc.c: Clean up with the boilerplate macro.
+
 2005-11-15  Vincent Torri  <torri at iecn dot u-nancy dot fr>
 
        Reviewed by: Tim-Philipp Müller  <tim at centricular dot net>
index 5505d6b..30b4b1d 100644 (file)
@@ -58,20 +58,12 @@ static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
     GST_PAD_ALWAYS,
     GST_STATIC_CAPS_ANY);
 
-/* elementfactory information */
 static GstElementDetails gst_udpsrc_details =
 GST_ELEMENT_DETAILS ("UDP packet receiver",
     "Source/Network",
     "Receive data over the network via UDP",
     "Wim Taymans <wim@fluendo.com>");
 
-/* UDPSrc signals and args */
-enum
-{
-  /* FILL ME */
-  LAST_SIGNAL
-};
-
 #define UDP_DEFAULT_PORT               4951
 #define UDP_DEFAULT_MULTICAST_GROUP    "0.0.0.0"
 #define UDP_DEFAULT_URI                        "udp://0.0.0.0:4951"
@@ -87,10 +79,6 @@ enum
   /* FILL ME */
 };
 
-static void gst_udpsrc_base_init (gpointer g_class);
-static void gst_udpsrc_class_init (GstUDPSrc * klass);
-static void gst_udpsrc_init (GstUDPSrc * udpsrc);
-
 static void gst_udpsrc_uri_handler_init (gpointer g_iface, gpointer iface_data);
 
 static GstCaps *gst_udpsrc_getcaps (GstBaseSrc * src);
@@ -104,44 +92,23 @@ static void gst_udpsrc_set_property (GObject * object, guint prop_id,
 static void gst_udpsrc_get_property (GObject * object, guint prop_id,
     GValue * value, GParamSpec * pspec);
 
-static GstElementClass *parent_class = NULL;
+static void
+_do_init (GType type)
+{
+  static const GInterfaceInfo urihandler_info = {
+    gst_udpsrc_uri_handler_init,
+    NULL,
+    NULL
+  };
 
-/*static guint gst_udpsrc_signals[LAST_SIGNAL] = { 0 }; */
+  g_type_add_interface_static (type, GST_TYPE_URI_HANDLER, &urihandler_info);
 
-GType
-gst_udpsrc_get_type (void)
-{
-  static GType udpsrc_type = 0;
-
-  if (!udpsrc_type) {
-    static const GTypeInfo udpsrc_info = {
-      sizeof (GstUDPSrcClass),
-      gst_udpsrc_base_init,
-      NULL,
-      (GClassInitFunc) gst_udpsrc_class_init,
-      NULL,
-      NULL,
-      sizeof (GstUDPSrc),
-      0,
-      (GInstanceInitFunc) gst_udpsrc_init,
-      NULL
-    };
-    static const GInterfaceInfo urihandler_info = {
-      gst_udpsrc_uri_handler_init,
-      NULL,
-      NULL
-    };
-
-    udpsrc_type =
-        g_type_register_static (GST_TYPE_PUSH_SRC, "GstUDPSrc", &udpsrc_info,
-        0);
-
-    g_type_add_interface_static (udpsrc_type, GST_TYPE_URI_HANDLER,
-        &urihandler_info);
-  }
-  return udpsrc_type;
+  GST_DEBUG_CATEGORY_INIT (udpsrc_debug, "udpsrc", 0, "UDP src");
 }
 
+GST_BOILERPLATE_FULL (GstUDPSrc, gst_udpsrc, GstPushSrc, GST_TYPE_PUSH_SRC,
+    _do_init);
+
 static void
 gst_udpsrc_base_init (gpointer g_class)
 {
@@ -154,20 +121,16 @@ gst_udpsrc_base_init (gpointer g_class)
 }
 
 static void
-gst_udpsrc_class_init (GstUDPSrc * klass)
+gst_udpsrc_class_init (GstUDPSrcClass * klass)
 {
   GObjectClass *gobject_class;
-  GstElementClass *gstelement_class;
   GstBaseSrcClass *gstbasesrc_class;
   GstPushSrcClass *gstpushsrc_class;
 
   gobject_class = (GObjectClass *) klass;
-  gstelement_class = (GstElementClass *) klass;
   gstbasesrc_class = (GstBaseSrcClass *) klass;
   gstpushsrc_class = (GstPushSrcClass *) klass;
 
-  parent_class = g_type_class_ref (GST_TYPE_PUSH_SRC);
-
   gobject_class->set_property = gst_udpsrc_set_property;
   gobject_class->get_property = gst_udpsrc_get_property;
 
@@ -193,12 +156,10 @@ gst_udpsrc_class_init (GstUDPSrc * klass)
   gstbasesrc_class->get_caps = gst_udpsrc_getcaps;
 
   gstpushsrc_class->create = gst_udpsrc_create;
-
-  GST_DEBUG_CATEGORY_INIT (udpsrc_debug, "udpsrc", 0, "UDP src");
 }
 
 static void
-gst_udpsrc_init (GstUDPSrc * udpsrc)
+gst_udpsrc_init (GstUDPSrc * udpsrc, GstUDPSrcClass * g_class)
 {
   gst_base_src_set_live (GST_BASE_SRC (udpsrc), TRUE);
   udpsrc->port = UDP_DEFAULT_PORT;
@@ -388,9 +349,7 @@ static void
 gst_udpsrc_set_property (GObject * object, guint prop_id, const GValue * value,
     GParamSpec * pspec)
 {
-  GstUDPSrc *udpsrc;
-
-  udpsrc = GST_UDPSRC (object);
+  GstUDPSrc *udpsrc = GST_UDPSRC (object);
 
   switch (prop_id) {
     case PROP_PORT:
@@ -436,9 +395,7 @@ static void
 gst_udpsrc_get_property (GObject * object, guint prop_id, GValue * value,
     GParamSpec * pspec)
 {
-  GstUDPSrc *udpsrc;
-
-  udpsrc = GST_UDPSRC (object);
+  GstUDPSrc *udpsrc = GST_UDPSRC (object);
 
   switch (prop_id) {
     case PROP_PORT: