]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/gstreamer0-10.git/commitdiff
gst/gstutils.h: GST_PARENT_CALL and
authorBenjamin Otte <otte@gnome.org>
Thu, 8 Jan 2004 04:10:18 +0000 (04:10 +0000)
committerBenjamin Otte <otte@gnome.org>
Thu, 8 Jan 2004 04:10:18 +0000 (04:10 +0000)
Original commit message from CVS:
2004-01-08  Benjamin Otte  <in7y118@public.uni-hamburg.de>

* gst/gstutils.h:
Add GST_BOILERPLATE(_FULL), GST_PARENT_CALL and
GST_PARENT_CALL_WITH_DEFAULT
* gst/elements/gstaggregator.c:
* gst/elements/gstbufferstore.c:
* gst/elements/gstfakesink.c:
* gst/elements/gstfakesrc.c:
* gst/elements/gstfdsink.c:
* gst/elements/gstfdsrc.c:
* gst/elements/gstfilesink.c:
* gst/elements/gstfilesrc.c:
* gst/elements/gstidentity.c:
* gst/elements/gstmd5sink.c:
* gst/elements/gstmultidisksrc.c:
* gst/elements/gstpipefilter.c:
* gst/elements/gstshaper.c:
* gst/elements/gststatistics.c:
* gst/elements/gsttee.c:
* gst/elements/gsttypefindelement.c:
use them.

38 files changed:
ChangeLog
gst/elements/gstaggregator.c
gst/elements/gstbufferstore.c
gst/elements/gstfakesink.c
gst/elements/gstfakesrc.c
gst/elements/gstfdsink.c
gst/elements/gstfdsrc.c
gst/elements/gstfilesink.c
gst/elements/gstfilesrc.c
gst/elements/gstidentity.c
gst/elements/gstmd5sink.c
gst/elements/gstmultidisksrc.c
gst/elements/gstmultifilesrc.c
gst/elements/gstpipefilter.c
gst/elements/gstshaper.c
gst/elements/gststatistics.c
gst/elements/gsttee.c
gst/elements/gsttypefind.c
gst/elements/gsttypefindelement.c
gst/gstutils.h
plugins/elements/gstaggregator.c
plugins/elements/gstbufferstore.c
plugins/elements/gstfakesink.c
plugins/elements/gstfakesrc.c
plugins/elements/gstfdsink.c
plugins/elements/gstfdsrc.c
plugins/elements/gstfilesink.c
plugins/elements/gstfilesrc.c
plugins/elements/gstidentity.c
plugins/elements/gstmd5sink.c
plugins/elements/gstmultidisksrc.c
plugins/elements/gstmultifilesrc.c
plugins/elements/gstpipefilter.c
plugins/elements/gstshaper.c
plugins/elements/gststatistics.c
plugins/elements/gsttee.c
plugins/elements/gsttypefind.c
plugins/elements/gsttypefindelement.c

index 1c3aa6ef96e91dff5450dea5cc0183d3461d6419..e90df06a084918377eb192391d4e6ff6ff688ce2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,26 @@
+2004-01-08  Benjamin Otte  <in7y118@public.uni-hamburg.de>
+
+       * gst/gstutils.h:
+         Add GST_BOILERPLATE(_FULL), GST_PARENT_CALL and
+         GST_PARENT_CALL_WITH_DEFAULT
+       * gst/elements/gstaggregator.c: 
+       * gst/elements/gstbufferstore.c: 
+       * gst/elements/gstfakesink.c: 
+       * gst/elements/gstfakesrc.c: 
+       * gst/elements/gstfdsink.c: 
+       * gst/elements/gstfdsrc.c: 
+       * gst/elements/gstfilesink.c: 
+       * gst/elements/gstfilesrc.c: 
+       * gst/elements/gstidentity.c: 
+       * gst/elements/gstmd5sink.c: 
+       * gst/elements/gstmultidisksrc.c:
+       * gst/elements/gstpipefilter.c: 
+       * gst/elements/gstshaper.c:
+       * gst/elements/gststatistics.c:
+       * gst/elements/gsttee.c:
+       * gst/elements/gsttypefindelement.c:
+         use them.
+
 2004-01-07  Thomas Vander Stichele  <thomas at apestaart dot org>
 
        * docs/gst/gstreamer-docs.sgml: remove props
index 8d3523c63c3785b41889b2a955c758cc9dd49ba6..b4945b8a0c522fd1208105858b32845cceb90d0f 100644 (file)
@@ -77,10 +77,6 @@ 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);
-
 static GstPad*         gst_aggregator_request_new_pad  (GstElement *element, GstPadTemplate *temp, const
                                                  gchar *unused);
 static void    gst_aggregator_update_functions (GstAggregator *aggregator);
@@ -93,32 +89,10 @@ static void         gst_aggregator_get_property     (GObject *object, guint prop_id,
 static void    gst_aggregator_chain            (GstPad *pad, GstData *_data);
 static void    gst_aggregator_loop             (GstElement *element);
 
-static GstElementClass *parent_class = NULL;
-/*static guint gst_aggregator_signals[LAST_SIGNAL] = { 0 };*/
+#define _do_init(bla) \
+  GST_DEBUG_CATEGORY_INIT (gst_aggregator_debug, "aggregator", 0, "aggregator element");
 
-GType
-gst_aggregator_get_type (void) 
-{
-  static GType aggregator_type = 0;
-
-  if (!aggregator_type) {
-    static const GTypeInfo aggregator_info = {
-      sizeof(GstAggregatorClass),      
-      gst_aggregator_base_init,
-      NULL,
-      (GClassInitFunc)gst_aggregator_class_init,
-      NULL,
-      NULL,
-      sizeof(GstAggregator),
-      0,
-      (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;
-}
+GST_BOILERPLATE_FULL (GstAggregator, gst_aggregator, GstElement, GST_TYPE_ELEMENT, _do_init);
 
 static void
 gst_aggregator_base_init (gpointer g_class)
@@ -137,7 +111,6 @@ gst_aggregator_class_init (GstAggregatorClass *klass)
   gobject_class = (GObjectClass*) klass;
   gstelement_class = (GstElementClass*) klass;
 
-  parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
 
   g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NUM_PADS,
     g_param_spec_int ("num_pads", "Num pads", "The number of source pads",
index 8d38740da5d5011fcb23e43b2a4d1bbdfeda0360..7a31f641fddb2fba15230d7df951a9242cad746d 100644 (file)
@@ -23,6 +23,7 @@
 #  include "config.h"
 #endif
 #include "gstbufferstore.h"
+#include <gst/gstutils.h>
 #include <string.h>
 
 GST_DEBUG_CATEGORY_STATIC (gst_buffer_store_debug);
@@ -38,19 +39,17 @@ enum {
 };
 
 
-static void    gst_buffer_store_class_init     (gpointer               g_class,
-                                                 gpointer              class_data);
-static void    gst_buffer_store_init           (GTypeInstance *        instance,
-                                                gpointer               g_class);
 static void    gst_buffer_store_dispose        (GObject *              object);
 
 static gboolean        gst_buffer_store_add_buffer_func (GstBufferStore *      store, 
                                                 GstBuffer *            buffer);
 static void    gst_buffer_store_cleared_func   (GstBufferStore *       store);
   
-static GObjectClass *parent_class = NULL;
 static guint gst_buffer_store_signals[LAST_SIGNAL] = { 0 };
 
+GST_BOILERPLATE (GstBufferStore, gst_buffer_store, GObject, G_TYPE_OBJECT);
+
+
 G_GNUC_UNUSED static void
 debug_buffers (GstBufferStore *store)
 {
@@ -63,33 +62,6 @@ debug_buffers (GstBufferStore *store)
   }
   g_printerr ("\n");
 }
-GType
-gst_buffer_store_get_type (void)
-{
-  static GType store_type = 0;
-
-  if (!store_type) {
-    static const GTypeInfo store_info = {
-      sizeof (GstBufferStoreClass),
-      NULL,
-      NULL,
-      gst_buffer_store_class_init,
-      NULL,
-      NULL,
-      sizeof (GstBufferStore),
-      0,
-      gst_buffer_store_init,
-      NULL
-    };
-    store_type = g_type_register_static (G_TYPE_OBJECT,
-                                           "GstBufferStore",
-                                           &store_info, 0);
-  
-    /* FIXME: better description anyone? */
-    GST_DEBUG_CATEGORY_INIT (gst_buffer_store_debug, "bufferstore", 0, "store all data");
-  }
-  return store_type;
-}
 static gboolean
 continue_accu (GSignalInvocationHint *ihint, GValue *return_accu, 
               const GValue *handler_return, gpointer data)
@@ -100,24 +72,22 @@ continue_accu (GSignalInvocationHint *ihint, GValue *return_accu,
   return do_continue;
 }
 static void
-gst_buffer_store_class_init (gpointer g_class, gpointer class_data)
+gst_buffer_store_base_init (gpointer g_class)
 {
-  GObjectClass *gobject_class;
-  GstBufferStoreClass *store_class;
-
-  gobject_class = G_OBJECT_CLASS (g_class);
-  store_class = GST_BUFFER_STORE_CLASS (g_class);
-
-  parent_class = g_type_class_peek_parent (g_class);
+}
+static void
+gst_buffer_store_class_init (GstBufferStoreClass *store_class)
+{
+  GObjectClass *gobject_class = G_OBJECT_CLASS (store_class);
 
   gobject_class->dispose = gst_buffer_store_dispose;
   
   gst_buffer_store_signals[CLEARED] = g_signal_new ("cleared", 
-         G_TYPE_FROM_CLASS (g_class), G_SIGNAL_RUN_LAST,
+         G_TYPE_FROM_CLASS (store_class), G_SIGNAL_RUN_LAST,
           G_STRUCT_OFFSET (GstBufferStoreClass, cleared), NULL, NULL,
           gst_marshal_VOID__VOID, G_TYPE_NONE, 0);
   gst_buffer_store_signals[BUFFER_ADDED] = g_signal_new ("buffer-added", 
-         G_TYPE_FROM_CLASS (g_class), G_SIGNAL_RUN_LAST,
+         G_TYPE_FROM_CLASS (store_class), G_SIGNAL_RUN_LAST,
           G_STRUCT_OFFSET (GstBufferStoreClass, buffer_added), continue_accu, NULL,
           gst_marshal_BOOLEAN__POINTER, G_TYPE_BOOLEAN, 1, GST_TYPE_BUFFER);
 
@@ -125,10 +95,8 @@ gst_buffer_store_class_init (gpointer g_class, gpointer class_data)
   store_class->buffer_added = gst_buffer_store_add_buffer_func;
 }
 static void
-gst_buffer_store_init (GTypeInstance *instance, gpointer g_class)
+gst_buffer_store_init (GstBufferStore *store)
 {
-  GstBufferStore *store = GST_BUFFER_STORE (instance);
-  
   store->buffers = NULL;
 }
 static void
index 5589f14df821ca567665a32f1f8e4d8465e90b37..b402b9caa8f3a51ba2bf2756d7c708848724ff44 100644 (file)
@@ -84,9 +84,10 @@ 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);
+#define _do_init(bla) \
+    GST_DEBUG_CATEGORY_INIT (gst_fakesink_debug, "fakesink", 0, "fakesink element");
+
+GST_BOILERPLATE_FULL (GstFakeSink, gst_fakesink, GstElement, GST_TYPE_ELEMENT, _do_init);
 
 static void    gst_fakesink_set_clock          (GstElement *element, GstClock *clock);
 static GstPad*         gst_fakesink_request_new_pad    (GstElement *element, GstPadTemplate *templ, const
@@ -102,33 +103,8 @@ static GstElementStateReturn
 
 static void    gst_fakesink_chain              (GstPad *pad, GstData *_data);
 
-static GstElementClass *parent_class = NULL;
 static guint gst_fakesink_signals[LAST_SIGNAL] = { 0 };
 
-GType
-gst_fakesink_get_type (void) 
-{
-  static GType fakesink_type = 0;
-
-  if (!fakesink_type) {
-    static const GTypeInfo fakesink_info = {
-      sizeof(GstFakeSinkClass),
-      gst_fakesink_base_init,
-      NULL,
-      (GClassInitFunc)gst_fakesink_class_init,
-      NULL,
-      NULL,
-      sizeof(GstFakeSink),
-      0,
-      (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)
 {
@@ -148,7 +124,6 @@ gst_fakesink_class_init (GstFakeSinkClass *klass)
   gobject_class = (GObjectClass*)klass;
   gstelement_class = (GstElementClass*)klass;
 
-  parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
 
   g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NUM_SINKS,
     g_param_spec_int ("num_sinks", "Number of sinks", "The number of sinkpads",
index a832f0ff39c7d94abf2794605ce2aab901d23698..f3a9100679edfdf39ea59858a425fe9fb32050cf 100644 (file)
@@ -98,8 +98,6 @@ 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;
 }
@@ -156,9 +154,10 @@ 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);
+#define _do_init(bla) \
+    GST_DEBUG_CATEGORY_INIT (gst_fakesrc_debug, "fakesrc", 0, "fakesrc element");
+
+GST_BOILERPLATE_FULL (GstFakeSrc, gst_fakesrc, GstElement, GST_TYPE_ELEMENT, _do_init);
 
 static GstPad*                 gst_fakesrc_request_new_pad     (GstElement *element, GstPadTemplate *templ,const gchar *unused);
 static void            gst_fakesrc_update_functions    (GstFakeSrc *src);
@@ -172,31 +171,8 @@ static GstElementStateReturn gst_fakesrc_change_state      (GstElement *element);
 static GstData*        gst_fakesrc_get                 (GstPad *pad);
 static void            gst_fakesrc_loop                (GstElement *element);
 
-static GstElementClass *parent_class = NULL;
 static guint gst_fakesrc_signals[LAST_SIGNAL] = { 0 };
 
-GType
-gst_fakesrc_get_type (void) 
-{
-  static GType fakesrc_type = 0;
-
-  if (!fakesrc_type) {
-    static const GTypeInfo fakesrc_info = {
-      sizeof(GstFakeSrcClass),
-      gst_fakesrc_base_init,
-      NULL,
-      (GClassInitFunc)gst_fakesrc_class_init,
-      NULL,
-      NULL,
-      sizeof(GstFakeSrc),
-      0,
-      (GInstanceInitFunc)gst_fakesrc_init,
-    };
-    fakesrc_type = g_type_register_static (GST_TYPE_ELEMENT, "GstFakeSrc", &fakesrc_info, 0);
-  }
-  return fakesrc_type;
-}
-
 static void
 gst_fakesrc_base_init (gpointer g_class)
 {
@@ -216,7 +192,6 @@ gst_fakesrc_class_init (GstFakeSrcClass *klass)
   gobject_class = (GObjectClass*)klass;
   gstelement_class = (GstElementClass*)klass;
 
-  parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
 
   g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NUM_SOURCES,
     g_param_spec_int ("num-sources", "num-sources", "Number of sources",
index b0ecc94d7f7d9deb6e6408537fdb680145fda52e..70f358669cf211e8db28649d179b1a882e692b02 100644 (file)
@@ -50,9 +50,10 @@ 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);
+#define _do_init(bla) \
+    GST_DEBUG_CATEGORY_INIT (gst_fdsink_debug, "fdsink", 0, "fdsink element");
+
+GST_BOILERPLATE_FULL (GstFdSink, gst_fdsink, GstElement, GST_TYPE_ELEMENT, _do_init);
 
 static void    gst_fdsink_set_property (GObject *object, guint prop_id, 
                                         const GValue *value, GParamSpec *pspec);
@@ -61,32 +62,6 @@ static void  gst_fdsink_get_property (GObject *object, guint prop_id,
 
 static void    gst_fdsink_chain        (GstPad *pad,GstData *_data);
 
-static GstElementClass *parent_class = NULL;
-/*static guint gst_fdsink_signals[LAST_SIGNAL] = { 0 };*/
-
-GType
-gst_fdsink_get_type (void) 
-{
-  static GType fdsink_type = 0;
-
-  if (!fdsink_type) {
-    static const GTypeInfo fdsink_info = {
-      sizeof(GstFdSinkClass),
-      gst_fdsink_base_init,
-      NULL,
-      (GClassInitFunc)gst_fdsink_class_init,
-      NULL,
-      NULL,
-      sizeof(GstFdSink),
-      0,
-      (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)
@@ -102,7 +77,6 @@ gst_fdsink_class_init (GstFdSinkClass *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,
     g_param_spec_int ("fd", "fd", "An open file descriptor to write to",
index de7359c6e56297d0349f9c7ec033aeef1dbdda9a..d45ff18f8156fb055a385dd704109b001bf51415 100644 (file)
@@ -58,9 +58,10 @@ 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);
+#define _do_init(bla) \
+    GST_DEBUG_CATEGORY_INIT (gst_fdsrc_debug, "fdsrc", 0, "fdsrc element");
+
+GST_BOILERPLATE_FULL (GstFdSrc, gst_fdsrc, GstElement, GST_TYPE_ELEMENT, _do_init);
 
 static void            gst_fdsrc_set_property  (GObject *object, guint prop_id, 
                                                 const GValue *value, GParamSpec *pspec);
@@ -70,33 +71,6 @@ static void          gst_fdsrc_get_property  (GObject *object, guint prop_id,
 static GstData *       gst_fdsrc_get           (GstPad *pad);
 
 
-static GstElementClass *parent_class = NULL;
-/*static guint gst_fdsrc_signals[LAST_SIGNAL] = { 0 };*/
-
-GType
-gst_fdsrc_get_type (void) 
-{
-  static GType fdsrc_type = 0;
-
-  if (!fdsrc_type) {
-    static const GTypeInfo fdsrc_info = {
-      sizeof(GstFdSrcClass),      
-      gst_fdsrc_base_init,
-      NULL,
-      (GClassInitFunc)gst_fdsrc_class_init,
-      NULL,
-      NULL,
-      sizeof(GstFdSrc),
-      0,
-      (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)
 {
@@ -111,7 +85,6 @@ gst_fdsrc_class_init (GstFdSrcClass *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,
     g_param_spec_int ("fd", "fd", "An open file descriptor to read from",
index 9a7bfbb8f0a340fa2acfbe8cd92eb5a2a5f5df11..97a04f3d6f9a1d218271f1a9ab83ecf81f5590c9 100644 (file)
@@ -66,9 +66,6 @@ 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);
 static void    gst_filesink_dispose            (GObject *object);
 
 static void    gst_filesink_set_property       (GObject *object, guint prop_id, 
@@ -88,40 +85,23 @@ static void gst_filesink_uri_handler_init   (gpointer g_iface, gpointer iface_data
   
 static GstElementStateReturn gst_filesink_change_state (GstElement *element);
 
-static GstElementClass *parent_class = NULL;
 static guint gst_filesink_signals[LAST_SIGNAL] = { 0 };
 
-GType
-gst_filesink_get_type (void) 
+static void
+_do_init (GType filesink_type)
 {
-  static GType filesink_type = 0;
-
-  if (!filesink_type) {
-    static const GTypeInfo filesink_info = {
-      sizeof(GstFileSinkClass),
-      gst_filesink_base_init,
-      NULL,
-      (GClassInitFunc)gst_filesink_class_init,
-      NULL,
-      NULL,
-      sizeof(GstFileSink),
-      0,
-      (GInstanceInitFunc)gst_filesink_init,
-    };
-    static const GInterfaceInfo urihandler_info = {
-      gst_filesink_uri_handler_init,
-      NULL,
-      NULL
-    };
-    filesink_type = g_type_register_static (GST_TYPE_ELEMENT, "GstFileSink", &filesink_info, 0);
-    
-    g_type_add_interface_static (filesink_type, GST_TYPE_URI_HANDLER, &urihandler_info);
-  
-    GST_DEBUG_CATEGORY_INIT (gst_filesink_debug, "filesink", 0, "filesink element");
-  }
-  return filesink_type;
+  static const GInterfaceInfo urihandler_info = {
+    gst_filesink_uri_handler_init,
+    NULL,
+    NULL
+  };
+  g_type_add_interface_static (filesink_type, GST_TYPE_URI_HANDLER, &urihandler_info);
+  GST_DEBUG_CATEGORY_INIT (gst_filesink_debug, "filesink", 0, "filesink element");
 }
 
+GST_BOILERPLATE_FULL (GstFileSink, gst_filesink, GstElement, GST_TYPE_ELEMENT, _do_init);
+    
+
 static void
 gst_filesink_base_init (gpointer g_class)
 {
@@ -135,7 +115,6 @@ gst_filesink_class_init (GstFileSinkClass *klass)
 {
   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
 
-  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",
index f2789ec59f450a7f41cec68c724a49c0aa13c54c..adb2d81c71472bb88117fc9b3a5358e9b3649029 100644 (file)
@@ -118,9 +118,6 @@ 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);
 
 static void            gst_filesrc_set_property        (GObject *object, guint prop_id, 
@@ -138,41 +135,20 @@ static GstElementStateReturn      gst_filesrc_change_state        (GstElement *element);
 
 static void            gst_filesrc_uri_handler_init    (gpointer g_iface, gpointer iface_data);
 
-
-static GstElementClass *parent_class = NULL;
-/*static guint gst_filesrc_signals[LAST_SIGNAL] = { 0 };*/
-
-GType
-gst_filesrc_get_type(void)
+static void
+_do_init (GType filesrc_type)
 {
-  static GType filesrc_type = 0;
-
-  if (!filesrc_type) {
-    static const GTypeInfo filesrc_info = {
-      sizeof(GstFileSrcClass), 
-      gst_filesrc_base_init,
-      NULL,
-      (GClassInitFunc)gst_filesrc_class_init,
-      NULL,
-      NULL,
-      sizeof(GstFileSrc),
-      0,
-      (GInstanceInitFunc)gst_filesrc_init,
-    };
-    static const GInterfaceInfo urihandler_info = {
-      gst_filesrc_uri_handler_init,
-      NULL,
-      NULL
-    };
-    filesrc_type = g_type_register_static (GST_TYPE_ELEMENT, "GstFileSrc", &filesrc_info, 0);
-    
-    g_type_add_interface_static (filesrc_type, GST_TYPE_URI_HANDLER, &urihandler_info);
-    
-    GST_DEBUG_CATEGORY_INIT (gst_filesrc_debug, "filesrc", 0, "filesrc element");
-  }
-  return filesrc_type;
+  static const GInterfaceInfo urihandler_info = {
+    gst_filesrc_uri_handler_init,
+    NULL,
+    NULL
+  };
+  g_type_add_interface_static (filesrc_type, GST_TYPE_URI_HANDLER, &urihandler_info);
+  GST_DEBUG_CATEGORY_INIT (gst_filesrc_debug, "filesrc", 0, "filesrc element");
 }
 
+GST_BOILERPLATE_FULL (GstFileSrc, gst_filesrc, GstElement, GST_TYPE_ELEMENT, _do_init);
+    
 static void
 gst_filesrc_base_init (gpointer g_class)
 {
@@ -188,7 +164,6 @@ gst_filesrc_class_init (GstFileSrcClass *klass)
 
   gobject_class = (GObjectClass*)klass;
 
-  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",
index 6de0b6e5b15b1ce6914dd3edf5c0d2465b5088e7..f9bfdebbcda4d327d20075e358cf2e14a59ff741 100644 (file)
@@ -60,42 +60,18 @@ 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);
+#define _do_init(bla) \
+    GST_DEBUG_CATEGORY_INIT (gst_identity_debug, "identity", 0, "identity element");
+
+GST_BOILERPLATE_FULL (GstIdentity, gst_identity, GstElement, GST_TYPE_ELEMENT, _do_init);
 
 static void gst_identity_set_property  (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
 static void gst_identity_get_property  (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
 
 static void gst_identity_chain         (GstPad *pad, GstData *_data);
 
-static GstElementClass *parent_class = NULL;
 static guint gst_identity_signals[LAST_SIGNAL] = { 0 };
 
-GType
-gst_identity_get_type (void) 
-{
-  static GType identity_type = 0;
-
-  if (!identity_type) {
-    static const GTypeInfo identity_info = {
-      sizeof(GstIdentityClass),
-      gst_identity_base_init,
-      NULL,
-      (GClassInitFunc)gst_identity_class_init,
-      NULL,
-      NULL,
-      sizeof(GstIdentity),
-      0,
-      (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)
 {
@@ -110,7 +86,6 @@ gst_identity_class_init (GstIdentityClass *klass)
 
   gobject_class = G_OBJECT_CLASS (klass);
 
-  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", 
index 2b7d63b7a74ce5666eb02d8c3dec6a7d0c4a69b7..a75ea075ee96132ebcef80c1cfcf889babdbe947 100644 (file)
@@ -61,11 +61,12 @@ GstStaticPadTemplate md5_sink_template = GST_STATIC_PAD_TEMPLATE (
   GST_STATIC_CAPS_ANY
 );
 
-/* 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);
+#define _do_init(bla) \
+    GST_DEBUG_CATEGORY_INIT (gst_md5sink_debug, "md5sink", 0, "md5sink element");
+
+GST_BOILERPLATE_FULL (GstMD5Sink, gst_md5sink, GstElement, GST_TYPE_ELEMENT, _do_init);
 
+/* GObject stuff */
 /*static void                  gst_md5sink_set_property        (GObject *object, guint prop_id, 
                                                         const GValue *value, GParamSpec *pspec);*/
 static void                    gst_md5sink_get_property        (GObject *object, guint prop_id, 
@@ -74,11 +75,6 @@ static void                  gst_md5sink_get_property        (GObject *object, guint prop_id,
 static void                    gst_md5sink_chain               (GstPad *pad, GstData *_data);
 static GstElementStateReturn   gst_md5sink_change_state        (GstElement *element);
 
-/* variables */
-static GstElementClass                 *parent_class = NULL;
-/* no signals 
-static guint                   gst_md5sink_signals[LAST_SIGNAL] = { 0 }; */
-
 
 /* MD5 stuff */
 static void                    md5_init_ctx                    (GstMD5Sink *ctx);
@@ -381,31 +377,6 @@ md5_process_block (const void *buffer, size_t len, GstMD5Sink *ctx)
   ctx->D = D;
 }
 
-GType
-gst_md5sink_get_type (void) 
-{
-  static GType md5sink_type = 0;
-
-  if (!md5sink_type) {
-    static const GTypeInfo md5sink_info = {
-      sizeof(GstMD5SinkClass),
-      gst_md5sink_base_init,
-      NULL,
-      (GClassInitFunc) gst_md5sink_class_init,
-      NULL,
-      NULL,
-      sizeof (GstMD5Sink),
-      0,
-      (GInstanceInitFunc) gst_md5sink_init,
-    };
-    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)
 {
@@ -425,7 +396,6 @@ gst_md5sink_class_init (GstMD5SinkClass *klass)
   gobject_class = (GObjectClass *) klass;
   gstelement_class = (GstElementClass *) klass;
 
-  parent_class = g_type_class_peek_parent (klass);
 
   gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_md5sink_get_property);
 
index d3ca0d9e5af39e7db6df39fba5ccca8744d84418..df9a241b8bf51e8321e42343aaed48df214a036c 100644 (file)
@@ -54,9 +54,10 @@ 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);
+#define _do_init(bla) \
+    GST_DEBUG_CATEGORY_INIT (gst_multidisksrc_debug, "multidisksrc", 0, "multidisksrc element");
+
+GST_BOILERPLATE_FULL (GstMultiDiskSrc, gst_multidisksrc, GstElement, GST_TYPE_ELEMENT, _do_init);
 
 static void            gst_multidisksrc_set_property   (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
 static void            gst_multidisksrc_get_property   (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
@@ -69,35 +70,10 @@ static GstElementStateReturn        gst_multidisksrc_change_state   (GstElement *element)
 static gboolean                gst_multidisksrc_open_file      (GstMultiDiskSrc *src, GstPad *srcpad);
 static void            gst_multidisksrc_close_file     (GstMultiDiskSrc *src);
 
-static GstElementClass *parent_class = NULL;
 static guint gst_multidisksrc_signals[LAST_SIGNAL] = { 0 };
 
-GType
-gst_multidisksrc_get_type(void)
-{
-  static GType multidisksrc_type = 0;
-
-  if (!multidisksrc_type) {
-    static const GTypeInfo multidisksrc_info = {
-      sizeof(GstMultiDiskSrcClass),
-      gst_multidiscsrc_base_init,
-      NULL,
-      (GClassInitFunc)gst_multidisksrc_class_init,
-      NULL,
-      NULL,
-      sizeof(GstMultiDiskSrc),
-      0,
-      (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)
+gst_multidisksrc_base_init (gpointer g_class)
 {
   GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
   
@@ -112,7 +88,6 @@ gst_multidisksrc_class_init (GstMultiDiskSrcClass *klass)
   gobject_class = (GObjectClass*)klass;
   gstelement_class = (GstElementClass*)klass;
 
-  parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
 
   gst_multidisksrc_signals[NEW_FILE] =
     g_signal_new ("new_file", G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST,
index d3ca0d9e5af39e7db6df39fba5ccca8744d84418..df9a241b8bf51e8321e42343aaed48df214a036c 100644 (file)
@@ -54,9 +54,10 @@ 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);
+#define _do_init(bla) \
+    GST_DEBUG_CATEGORY_INIT (gst_multidisksrc_debug, "multidisksrc", 0, "multidisksrc element");
+
+GST_BOILERPLATE_FULL (GstMultiDiskSrc, gst_multidisksrc, GstElement, GST_TYPE_ELEMENT, _do_init);
 
 static void            gst_multidisksrc_set_property   (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
 static void            gst_multidisksrc_get_property   (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
@@ -69,35 +70,10 @@ static GstElementStateReturn        gst_multidisksrc_change_state   (GstElement *element)
 static gboolean                gst_multidisksrc_open_file      (GstMultiDiskSrc *src, GstPad *srcpad);
 static void            gst_multidisksrc_close_file     (GstMultiDiskSrc *src);
 
-static GstElementClass *parent_class = NULL;
 static guint gst_multidisksrc_signals[LAST_SIGNAL] = { 0 };
 
-GType
-gst_multidisksrc_get_type(void)
-{
-  static GType multidisksrc_type = 0;
-
-  if (!multidisksrc_type) {
-    static const GTypeInfo multidisksrc_info = {
-      sizeof(GstMultiDiskSrcClass),
-      gst_multidiscsrc_base_init,
-      NULL,
-      (GClassInitFunc)gst_multidisksrc_class_init,
-      NULL,
-      NULL,
-      sizeof(GstMultiDiskSrc),
-      0,
-      (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)
+gst_multidisksrc_base_init (gpointer g_class)
 {
   GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
   
@@ -112,7 +88,6 @@ gst_multidisksrc_class_init (GstMultiDiskSrcClass *klass)
   gobject_class = (GObjectClass*)klass;
   gstelement_class = (GstElementClass*)klass;
 
-  parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
 
   gst_multidisksrc_signals[NEW_FILE] =
     g_signal_new ("new_file", G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST,
index 2b61a67e8639d16dd2130ec29c5c7ce6816f9c5f..8d43417614daeee8c945d910d0e3f315d702e8bb 100644 (file)
@@ -59,9 +59,10 @@ 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);
+#define _do_init(bla) \
+    GST_DEBUG_CATEGORY_INIT (gst_pipefilter_debug, "pipefilter", 0, "pipefilter element");
+
+GST_BOILERPLATE_FULL (GstPipefilter, gst_pipefilter, GstElement, GST_TYPE_ELEMENT, _do_init);
 
 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);
@@ -72,33 +73,6 @@ static gboolean              gst_pipefilter_handle_event     (GstPad *pad, GstEvent *event);
 
 static GstElementStateReturn   gst_pipefilter_change_state     (GstElement *element);
 
-static GstElementClass *parent_class = NULL;
-/*static guint gst_pipefilter_signals[LAST_SIGNAL] = { 0 };*/
-
-GType
-gst_pipefilter_get_type (void)
-{
-  static GType pipefilter_type = 0;
-
-  if (!pipefilter_type) {
-    static const GTypeInfo pipefilter_info = {
-      sizeof(GstPipefilterClass),
-      gst_pipefilter_base_init,
-      NULL,
-      (GClassInitFunc)gst_pipefilter_class_init,
-      NULL,
-      NULL,
-      sizeof(GstPipefilter),
-      0,
-      (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)
 {
@@ -115,7 +89,6 @@ gst_pipefilter_class_init (GstPipefilterClass *klass)
   gobject_class = (GObjectClass*)klass;
   gstelement_class = (GstElementClass*)klass;
 
-  parent_class = g_type_class_ref(GST_TYPE_ELEMENT);
 
   gobject_class->set_property = gst_pipefilter_set_property;  
   gobject_class->get_property = gst_pipefilter_get_property;
index 5ec9873a9920ed818cbf2ef0c43a00e22b4f18cf..34301f1a64b563f7be10d317df2d5307f52a0c91 100644 (file)
@@ -90,9 +90,10 @@ 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);
+#define _do_init(bla) \
+    GST_DEBUG_CATEGORY_INIT (gst_shaper_debug, "shaper", 0, "shaper element");
+
+GST_BOILERPLATE_FULL (GstShaper, gst_shaper, GstElement, GST_TYPE_ELEMENT, _do_init);
 
 static void    gst_shaper_set_property         (GObject *object, guint prop_id, 
                                                 const GValue *value, GParamSpec *pspec);
@@ -104,32 +105,6 @@ static GstPad*     gst_shaper_request_new_pad      (GstElement *element, GstPadTemplate
 
 static void    gst_shaper_loop                 (GstElement *element);
 
-static GstElementClass *parent_class = NULL;
-/* static guint gst_shaper_signals[LAST_SIGNAL] = { 0 }; */
-
-GType
-gst_shaper_get_type (void) 
-{
-  static GType shaper_type = 0;
-
-  if (!shaper_type) {
-    static const GTypeInfo shaper_info = {
-      sizeof(GstShaperClass),
-      gst_shaper_base_init,
-      NULL,
-      (GClassInitFunc)gst_shaper_class_init,
-      NULL,
-      NULL,
-      sizeof(GstShaper),
-      0,
-      (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)
@@ -152,7 +127,6 @@ gst_shaper_class_init (GstShaperClass *klass)
   gobject_class = (GObjectClass*) klass;
   gstelement_class = (GstElementClass*) klass;
 
-  parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
 
   g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_POLICY,
     g_param_spec_enum ("policy", "Policy", "Shaper policy",
index 37b60b1a39c0675e94107d2dd594b48855beb892..688727c123d2e9e8d5b9598749f880fae724fafa 100644 (file)
@@ -58,9 +58,10 @@ 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);
+#define _do_init(bla) \
+    GST_DEBUG_CATEGORY_INIT (gst_statistics_debug, "statistics", 0, "statistics element");
+
+GST_BOILERPLATE_FULL (GstStatistics, gst_statistics, GstElement, GST_TYPE_ELEMENT, _do_init);
 
 static void gst_statistics_set_property        (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
 static void gst_statistics_get_property        (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
@@ -69,34 +70,10 @@ static void gst_statistics_chain            (GstPad *pad, GstData *_data);
 static void gst_statistics_reset               (GstStatistics *statistics);
 static void gst_statistics_print               (GstStatistics *statistics);
 
-static GstElementClass *parent_class = NULL;
 static guint gst_statistics_signals[LAST_SIGNAL] = { 0, };
 
 static stats zero_stats = { 0, };
 
-GType
-gst_statistics_get_type (void) 
-{
-  static GType statistics_type = 0;
-
-  if (!statistics_type) {
-    static const GTypeInfo statistics_info = {
-      sizeof(GstStatisticsClass), 
-      gst_statistics_base_init,
-      NULL,
-      (GClassInitFunc)gst_statistics_class_init,
-      NULL,
-      NULL,
-      sizeof(GstStatistics),
-      0,
-      (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)
@@ -112,7 +89,6 @@ gst_statistics_class_init (GstStatisticsClass *klass)
   
   gobject_class = G_OBJECT_CLASS (klass);
 
-  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",
index c2b1cf294e6527ebc3238716bc4524c45f97d5c3..186fa96fe2d7929dc722202fed7332717ba29741 100644 (file)
@@ -60,9 +60,10 @@ GstStaticPadTemplate tee_src_template = GST_STATIC_PAD_TEMPLATE (
   GST_STATIC_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);
+#define _do_init(bla) \
+    GST_DEBUG_CATEGORY_INIT (gst_tee_debug, "tee", 0, "tee element");
+
+GST_BOILERPLATE_FULL (GstTee, gst_tee, GstElement, GST_TYPE_ELEMENT, _do_init);
 
 static GstPad*         gst_tee_request_new_pad (GstElement *element, GstPadTemplate *temp, const gchar *unused);
 
@@ -74,32 +75,6 @@ static void  gst_tee_get_property    (GObject *object, guint prop_id,
 static void    gst_tee_chain           (GstPad *pad, GstData *_data);
 
 
-static GstElementClass *parent_class = NULL;
-/*static guint gst_tee_signals[LAST_SIGNAL] = { 0 };*/
-
-GType
-gst_tee_get_type(void) {
-  static GType tee_type = 0;
-
-  if (!tee_type) {
-    static const GTypeInfo tee_info = {
-      sizeof(GstTeeClass),
-      gst_tee_base_init,
-      NULL,
-      (GClassInitFunc)gst_tee_class_init,
-      NULL,
-      NULL,
-      sizeof(GstTee),
-      0,
-      (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)
 {
@@ -118,7 +93,6 @@ gst_tee_class_init (GstTeeClass *klass)
   gobject_class = (GObjectClass*)klass;
   gstelement_class = (GstElementClass*)klass;
 
-  parent_class = g_type_class_ref(GST_TYPE_ELEMENT);
 
   g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NUM_PADS,
     g_param_spec_int ("num_pads", "num_pads", "num_pads",
index 91c6b58afa0c5bc8e39eb630e900266db618dfe0..5ba1cb9aa2bd27adf1923357739eb7cd638bb954 100644 (file)
@@ -42,6 +42,7 @@
 #include "gst/gst_private.h"
 
 #include <gst/gsttypefind.h>
+#include <gst/gstutils.h>
 
 GST_DEBUG_CATEGORY_STATIC (gst_type_find_element_debug);
 #define GST_CAT_DEFAULT gst_type_find_element_debug
@@ -85,11 +86,12 @@ 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,
-                                                        gpointer       g_class);
+#define _do_init(bla) \
+    GST_DEBUG_CATEGORY_INIT (gst_type_find_element_debug, "typefind",          \
+       GST_DEBUG_BG_YELLOW | GST_DEBUG_FG_GREEN, "type finding element");
+
+GST_BOILERPLATE_FULL (GstTypeFindElement, gst_type_find_element, GstElement, GST_TYPE_ELEMENT, _do_init);
+
 static void    gst_type_find_element_dispose           (GObject *      object);
 static void    gst_type_find_element_set_property      (GObject *      object, 
                                                         guint          prop_id,
@@ -110,36 +112,8 @@ static void        gst_type_find_element_chain             (GstPad *       sinkpad,
 static GstElementStateReturn
                gst_type_find_element_change_state      (GstElement *   element);
 
-static GstElementClass *parent_class = NULL;
 static guint gst_type_find_element_signals[LAST_SIGNAL] = { 0 };
 
-GType
-gst_type_find_element_get_type (void)
-{
-  static GType typefind_type = 0;
-
-  if (!typefind_type) {
-    static const GTypeInfo typefind_info = {
-      sizeof (GstTypeFindElementClass),
-      gst_type_find_element_base_init,
-      NULL,
-      gst_type_find_element_class_init,
-      NULL,
-      NULL,
-      sizeof (GstTypeFindElement),
-      0,
-      gst_type_find_element_init,
-      NULL
-    };
-    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;
-}
 static void
 gst_type_find_element_have_type (GstTypeFindElement *typefind, guint probability, const GstCaps *caps)
 {
@@ -162,17 +136,10 @@ gst_type_find_element_base_init (gpointer 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)
+gst_type_find_element_class_init (GstTypeFindElementClass *typefind_class)
 {
-  GObjectClass *gobject_class;
-  GstElementClass *gstelement_class;
-  GstTypeFindElementClass *typefind_class;
-
-  gobject_class = G_OBJECT_CLASS (g_class);
-  gstelement_class = GST_ELEMENT_CLASS (g_class);
-  typefind_class = GST_TYPE_FIND_ELEMENT_CLASS (g_class);
-
-  parent_class = g_type_class_peek_parent (g_class);
+  GObjectClass *gobject_class = G_OBJECT_CLASS (typefind_class);
+  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (typefind_class);
 
   gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_type_find_element_set_property);
   gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_type_find_element_get_property);
@@ -191,7 +158,7 @@ gst_type_find_element_class_init (gpointer g_class, gpointer class_data)
          GST_TYPE_FIND_MINIMUM, GST_TYPE_FIND_MAXIMUM, GST_TYPE_FIND_MAXIMUM, G_PARAM_READWRITE));
 
   gst_type_find_element_signals[HAVE_TYPE] = g_signal_new ("have_type", 
-         G_TYPE_FROM_CLASS (g_class), G_SIGNAL_RUN_LAST,
+         G_TYPE_FROM_CLASS (typefind_class), G_SIGNAL_RUN_LAST,
           G_STRUCT_OFFSET (GstTypeFindElementClass, have_type), NULL, NULL,
           gst_marshal_VOID__UINT_POINTER, G_TYPE_NONE, 2,
           G_TYPE_UINT, G_TYPE_POINTER);
@@ -199,10 +166,8 @@ gst_type_find_element_class_init (gpointer g_class, gpointer class_data)
   gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_type_find_element_change_state);
 }
 static void
-gst_type_find_element_init (GTypeInstance *instance, gpointer g_class)
+gst_type_find_element_init (GstTypeFindElement *typefind)
 {
-  GstTypeFindElement *typefind = GST_TYPE_FIND_ELEMENT (instance);
-  
   /* sinkpad */
   typefind->sink = gst_pad_new_from_template (
       gst_static_pad_template_get (&type_find_element_sink_template), "sink");
index 91c6b58afa0c5bc8e39eb630e900266db618dfe0..5ba1cb9aa2bd27adf1923357739eb7cd638bb954 100644 (file)
@@ -42,6 +42,7 @@
 #include "gst/gst_private.h"
 
 #include <gst/gsttypefind.h>
+#include <gst/gstutils.h>
 
 GST_DEBUG_CATEGORY_STATIC (gst_type_find_element_debug);
 #define GST_CAT_DEFAULT gst_type_find_element_debug
@@ -85,11 +86,12 @@ 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,
-                                                        gpointer       g_class);
+#define _do_init(bla) \
+    GST_DEBUG_CATEGORY_INIT (gst_type_find_element_debug, "typefind",          \
+       GST_DEBUG_BG_YELLOW | GST_DEBUG_FG_GREEN, "type finding element");
+
+GST_BOILERPLATE_FULL (GstTypeFindElement, gst_type_find_element, GstElement, GST_TYPE_ELEMENT, _do_init);
+
 static void    gst_type_find_element_dispose           (GObject *      object);
 static void    gst_type_find_element_set_property      (GObject *      object, 
                                                         guint          prop_id,
@@ -110,36 +112,8 @@ static void        gst_type_find_element_chain             (GstPad *       sinkpad,
 static GstElementStateReturn
                gst_type_find_element_change_state      (GstElement *   element);
 
-static GstElementClass *parent_class = NULL;
 static guint gst_type_find_element_signals[LAST_SIGNAL] = { 0 };
 
-GType
-gst_type_find_element_get_type (void)
-{
-  static GType typefind_type = 0;
-
-  if (!typefind_type) {
-    static const GTypeInfo typefind_info = {
-      sizeof (GstTypeFindElementClass),
-      gst_type_find_element_base_init,
-      NULL,
-      gst_type_find_element_class_init,
-      NULL,
-      NULL,
-      sizeof (GstTypeFindElement),
-      0,
-      gst_type_find_element_init,
-      NULL
-    };
-    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;
-}
 static void
 gst_type_find_element_have_type (GstTypeFindElement *typefind, guint probability, const GstCaps *caps)
 {
@@ -162,17 +136,10 @@ gst_type_find_element_base_init (gpointer 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)
+gst_type_find_element_class_init (GstTypeFindElementClass *typefind_class)
 {
-  GObjectClass *gobject_class;
-  GstElementClass *gstelement_class;
-  GstTypeFindElementClass *typefind_class;
-
-  gobject_class = G_OBJECT_CLASS (g_class);
-  gstelement_class = GST_ELEMENT_CLASS (g_class);
-  typefind_class = GST_TYPE_FIND_ELEMENT_CLASS (g_class);
-
-  parent_class = g_type_class_peek_parent (g_class);
+  GObjectClass *gobject_class = G_OBJECT_CLASS (typefind_class);
+  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (typefind_class);
 
   gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_type_find_element_set_property);
   gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_type_find_element_get_property);
@@ -191,7 +158,7 @@ gst_type_find_element_class_init (gpointer g_class, gpointer class_data)
          GST_TYPE_FIND_MINIMUM, GST_TYPE_FIND_MAXIMUM, GST_TYPE_FIND_MAXIMUM, G_PARAM_READWRITE));
 
   gst_type_find_element_signals[HAVE_TYPE] = g_signal_new ("have_type", 
-         G_TYPE_FROM_CLASS (g_class), G_SIGNAL_RUN_LAST,
+         G_TYPE_FROM_CLASS (typefind_class), G_SIGNAL_RUN_LAST,
           G_STRUCT_OFFSET (GstTypeFindElementClass, have_type), NULL, NULL,
           gst_marshal_VOID__UINT_POINTER, G_TYPE_NONE, 2,
           G_TYPE_UINT, G_TYPE_POINTER);
@@ -199,10 +166,8 @@ gst_type_find_element_class_init (gpointer g_class, gpointer class_data)
   gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_type_find_element_change_state);
 }
 static void
-gst_type_find_element_init (GTypeInstance *instance, gpointer g_class)
+gst_type_find_element_init (GstTypeFindElement *typefind)
 {
-  GstTypeFindElement *typefind = GST_TYPE_FIND_ELEMENT (instance);
-  
   /* sinkpad */
   typefind->sink = gst_pad_new_from_template (
       gst_static_pad_template_get (&type_find_element_sink_template), "sink");
index 2c164c0c09ef222e95e76d79f07fdd1035af2169..c3f5e9c4a78d45929697605cc08517593dfd307b 100644 (file)
@@ -37,6 +37,73 @@ void                 gst_util_dump_mem               (guchar *mem, guint size);
 void           gst_print_pad_caps              (GString *buf, gint indent, GstPad *pad);
 void           gst_print_element_args          (GString *buf, gint indent, GstElement *element);
 
+
+/* Macros for defining classes.  Ideas taken from Bonobo, which took theirs 
+   from Nautilus and GOB. */
+
+/* Define the boilerplate type stuff to reduce typos and code size.  Defines
+   the get_type method and the parent_class static variable.
+   void additional_initializations (GType type) is for initializing interfaces
+   and stuff like that */
+
+#define GST_BOILERPLATE_FULL(type, type_as_function, parent_type,              \
+    parent_type_macro, additional_initializations)                                     \
+                                                                               \
+static void type_as_function ## _base_init     (gpointer      g_class);                \
+static void type_as_function ## _class_init    (type ## Class *g_class);       \
+static void type_as_function ## _init         (type          *object);         \
+static parent_type ## Class *parent_class = NULL;                              \
+static void                                                                    \
+type_as_function ## _class_init_trampoline (gpointer g_class,                  \
+                                           gpointer data)                      \
+{                                                                              \
+  parent_class = (parent_type ## Class *) g_type_class_peek_parent (g_class);  \
+  type_as_function ## _class_init ((type ## Class *)g_class);                  \
+}                                                                              \
+                                                                               \
+GType                                                                          \
+type_as_function ## _get_type (void)                                           \
+{                                                                              \
+  static GType object_type = 0;                                                        \
+  if (object_type == 0) {                                                      \
+    static const GTypeInfo object_info = {                                     \
+      sizeof (type ## Class),                                                  \
+      type_as_function ## _base_init,                                          \
+      NULL,              /* base_finalize */                                   \
+      type_as_function ## _class_init_trampoline,                              \
+      NULL,              /* class_finalize */                                  \
+      NULL,               /* class_data */                                     \
+      sizeof (type),                                                           \
+      0,                  /* n_preallocs */                                    \
+      (GInstanceInitFunc) type_as_function ## _init                            \
+    };                                                                         \
+    object_type = g_type_register_static (parent_type_macro, #type,            \
+       &object_info, 0);                                                       \
+    additional_initializations (object_type);                                  \
+  }                                                                            \
+  return object_type;                                                          \
+}
+
+#define __GST_DO_NOTHING(type) /* NOP */
+#define GST_BOILERPLATE(type,type_as_function,parent_type,parent_type_macro)   \
+  GST_BOILERPLATE_FULL (type, type_as_function, parent_type, parent_type_macro,        \
+      __GST_DO_NOTHING)
+
+/* Just call the parent handler.  This assumes that there is a variable
+ * named parent_class that points to the (duh!) parent class.  Note that
+ * this macro is not to be used with things that return something, use
+ * the _WITH_DEFAULT version for that */
+#define GST_CALL_PARENT(parent_class_cast, name, args)                         \
+       ((parent_class_cast(parent_class)->name != NULL) ?                      \
+        parent_class_cast(parent_class)->name args : (void) 0)
+
+/* Same as above, but in case there is no implementation, it evaluates
+ * to def_return */
+#define GST_CALL_PARENT_WITH_DEFAULT(parent_class_cast, name, args, def_return)        \
+       ((parent_class_cast(parent_class)->name != NULL) ?                      \
+        parent_class_cast(parent_class)->name args : def_return)
+
+
 G_END_DECLS
 
 #endif /* __GST_UTILS_H__ */
index 8d3523c63c3785b41889b2a955c758cc9dd49ba6..b4945b8a0c522fd1208105858b32845cceb90d0f 100644 (file)
@@ -77,10 +77,6 @@ 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);
-
 static GstPad*         gst_aggregator_request_new_pad  (GstElement *element, GstPadTemplate *temp, const
                                                  gchar *unused);
 static void    gst_aggregator_update_functions (GstAggregator *aggregator);
@@ -93,32 +89,10 @@ static void         gst_aggregator_get_property     (GObject *object, guint prop_id,
 static void    gst_aggregator_chain            (GstPad *pad, GstData *_data);
 static void    gst_aggregator_loop             (GstElement *element);
 
-static GstElementClass *parent_class = NULL;
-/*static guint gst_aggregator_signals[LAST_SIGNAL] = { 0 };*/
+#define _do_init(bla) \
+  GST_DEBUG_CATEGORY_INIT (gst_aggregator_debug, "aggregator", 0, "aggregator element");
 
-GType
-gst_aggregator_get_type (void) 
-{
-  static GType aggregator_type = 0;
-
-  if (!aggregator_type) {
-    static const GTypeInfo aggregator_info = {
-      sizeof(GstAggregatorClass),      
-      gst_aggregator_base_init,
-      NULL,
-      (GClassInitFunc)gst_aggregator_class_init,
-      NULL,
-      NULL,
-      sizeof(GstAggregator),
-      0,
-      (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;
-}
+GST_BOILERPLATE_FULL (GstAggregator, gst_aggregator, GstElement, GST_TYPE_ELEMENT, _do_init);
 
 static void
 gst_aggregator_base_init (gpointer g_class)
@@ -137,7 +111,6 @@ gst_aggregator_class_init (GstAggregatorClass *klass)
   gobject_class = (GObjectClass*) klass;
   gstelement_class = (GstElementClass*) klass;
 
-  parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
 
   g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NUM_PADS,
     g_param_spec_int ("num_pads", "Num pads", "The number of source pads",
index 8d38740da5d5011fcb23e43b2a4d1bbdfeda0360..7a31f641fddb2fba15230d7df951a9242cad746d 100644 (file)
@@ -23,6 +23,7 @@
 #  include "config.h"
 #endif
 #include "gstbufferstore.h"
+#include <gst/gstutils.h>
 #include <string.h>
 
 GST_DEBUG_CATEGORY_STATIC (gst_buffer_store_debug);
@@ -38,19 +39,17 @@ enum {
 };
 
 
-static void    gst_buffer_store_class_init     (gpointer               g_class,
-                                                 gpointer              class_data);
-static void    gst_buffer_store_init           (GTypeInstance *        instance,
-                                                gpointer               g_class);
 static void    gst_buffer_store_dispose        (GObject *              object);
 
 static gboolean        gst_buffer_store_add_buffer_func (GstBufferStore *      store, 
                                                 GstBuffer *            buffer);
 static void    gst_buffer_store_cleared_func   (GstBufferStore *       store);
   
-static GObjectClass *parent_class = NULL;
 static guint gst_buffer_store_signals[LAST_SIGNAL] = { 0 };
 
+GST_BOILERPLATE (GstBufferStore, gst_buffer_store, GObject, G_TYPE_OBJECT);
+
+
 G_GNUC_UNUSED static void
 debug_buffers (GstBufferStore *store)
 {
@@ -63,33 +62,6 @@ debug_buffers (GstBufferStore *store)
   }
   g_printerr ("\n");
 }
-GType
-gst_buffer_store_get_type (void)
-{
-  static GType store_type = 0;
-
-  if (!store_type) {
-    static const GTypeInfo store_info = {
-      sizeof (GstBufferStoreClass),
-      NULL,
-      NULL,
-      gst_buffer_store_class_init,
-      NULL,
-      NULL,
-      sizeof (GstBufferStore),
-      0,
-      gst_buffer_store_init,
-      NULL
-    };
-    store_type = g_type_register_static (G_TYPE_OBJECT,
-                                           "GstBufferStore",
-                                           &store_info, 0);
-  
-    /* FIXME: better description anyone? */
-    GST_DEBUG_CATEGORY_INIT (gst_buffer_store_debug, "bufferstore", 0, "store all data");
-  }
-  return store_type;
-}
 static gboolean
 continue_accu (GSignalInvocationHint *ihint, GValue *return_accu, 
               const GValue *handler_return, gpointer data)
@@ -100,24 +72,22 @@ continue_accu (GSignalInvocationHint *ihint, GValue *return_accu,
   return do_continue;
 }
 static void
-gst_buffer_store_class_init (gpointer g_class, gpointer class_data)
+gst_buffer_store_base_init (gpointer g_class)
 {
-  GObjectClass *gobject_class;
-  GstBufferStoreClass *store_class;
-
-  gobject_class = G_OBJECT_CLASS (g_class);
-  store_class = GST_BUFFER_STORE_CLASS (g_class);
-
-  parent_class = g_type_class_peek_parent (g_class);
+}
+static void
+gst_buffer_store_class_init (GstBufferStoreClass *store_class)
+{
+  GObjectClass *gobject_class = G_OBJECT_CLASS (store_class);
 
   gobject_class->dispose = gst_buffer_store_dispose;
   
   gst_buffer_store_signals[CLEARED] = g_signal_new ("cleared", 
-         G_TYPE_FROM_CLASS (g_class), G_SIGNAL_RUN_LAST,
+         G_TYPE_FROM_CLASS (store_class), G_SIGNAL_RUN_LAST,
           G_STRUCT_OFFSET (GstBufferStoreClass, cleared), NULL, NULL,
           gst_marshal_VOID__VOID, G_TYPE_NONE, 0);
   gst_buffer_store_signals[BUFFER_ADDED] = g_signal_new ("buffer-added", 
-         G_TYPE_FROM_CLASS (g_class), G_SIGNAL_RUN_LAST,
+         G_TYPE_FROM_CLASS (store_class), G_SIGNAL_RUN_LAST,
           G_STRUCT_OFFSET (GstBufferStoreClass, buffer_added), continue_accu, NULL,
           gst_marshal_BOOLEAN__POINTER, G_TYPE_BOOLEAN, 1, GST_TYPE_BUFFER);
 
@@ -125,10 +95,8 @@ gst_buffer_store_class_init (gpointer g_class, gpointer class_data)
   store_class->buffer_added = gst_buffer_store_add_buffer_func;
 }
 static void
-gst_buffer_store_init (GTypeInstance *instance, gpointer g_class)
+gst_buffer_store_init (GstBufferStore *store)
 {
-  GstBufferStore *store = GST_BUFFER_STORE (instance);
-  
   store->buffers = NULL;
 }
 static void
index 5589f14df821ca567665a32f1f8e4d8465e90b37..b402b9caa8f3a51ba2bf2756d7c708848724ff44 100644 (file)
@@ -84,9 +84,10 @@ 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);
+#define _do_init(bla) \
+    GST_DEBUG_CATEGORY_INIT (gst_fakesink_debug, "fakesink", 0, "fakesink element");
+
+GST_BOILERPLATE_FULL (GstFakeSink, gst_fakesink, GstElement, GST_TYPE_ELEMENT, _do_init);
 
 static void    gst_fakesink_set_clock          (GstElement *element, GstClock *clock);
 static GstPad*         gst_fakesink_request_new_pad    (GstElement *element, GstPadTemplate *templ, const
@@ -102,33 +103,8 @@ static GstElementStateReturn
 
 static void    gst_fakesink_chain              (GstPad *pad, GstData *_data);
 
-static GstElementClass *parent_class = NULL;
 static guint gst_fakesink_signals[LAST_SIGNAL] = { 0 };
 
-GType
-gst_fakesink_get_type (void) 
-{
-  static GType fakesink_type = 0;
-
-  if (!fakesink_type) {
-    static const GTypeInfo fakesink_info = {
-      sizeof(GstFakeSinkClass),
-      gst_fakesink_base_init,
-      NULL,
-      (GClassInitFunc)gst_fakesink_class_init,
-      NULL,
-      NULL,
-      sizeof(GstFakeSink),
-      0,
-      (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)
 {
@@ -148,7 +124,6 @@ gst_fakesink_class_init (GstFakeSinkClass *klass)
   gobject_class = (GObjectClass*)klass;
   gstelement_class = (GstElementClass*)klass;
 
-  parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
 
   g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NUM_SINKS,
     g_param_spec_int ("num_sinks", "Number of sinks", "The number of sinkpads",
index a832f0ff39c7d94abf2794605ce2aab901d23698..f3a9100679edfdf39ea59858a425fe9fb32050cf 100644 (file)
@@ -98,8 +98,6 @@ 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;
 }
@@ -156,9 +154,10 @@ 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);
+#define _do_init(bla) \
+    GST_DEBUG_CATEGORY_INIT (gst_fakesrc_debug, "fakesrc", 0, "fakesrc element");
+
+GST_BOILERPLATE_FULL (GstFakeSrc, gst_fakesrc, GstElement, GST_TYPE_ELEMENT, _do_init);
 
 static GstPad*                 gst_fakesrc_request_new_pad     (GstElement *element, GstPadTemplate *templ,const gchar *unused);
 static void            gst_fakesrc_update_functions    (GstFakeSrc *src);
@@ -172,31 +171,8 @@ static GstElementStateReturn gst_fakesrc_change_state      (GstElement *element);
 static GstData*        gst_fakesrc_get                 (GstPad *pad);
 static void            gst_fakesrc_loop                (GstElement *element);
 
-static GstElementClass *parent_class = NULL;
 static guint gst_fakesrc_signals[LAST_SIGNAL] = { 0 };
 
-GType
-gst_fakesrc_get_type (void) 
-{
-  static GType fakesrc_type = 0;
-
-  if (!fakesrc_type) {
-    static const GTypeInfo fakesrc_info = {
-      sizeof(GstFakeSrcClass),
-      gst_fakesrc_base_init,
-      NULL,
-      (GClassInitFunc)gst_fakesrc_class_init,
-      NULL,
-      NULL,
-      sizeof(GstFakeSrc),
-      0,
-      (GInstanceInitFunc)gst_fakesrc_init,
-    };
-    fakesrc_type = g_type_register_static (GST_TYPE_ELEMENT, "GstFakeSrc", &fakesrc_info, 0);
-  }
-  return fakesrc_type;
-}
-
 static void
 gst_fakesrc_base_init (gpointer g_class)
 {
@@ -216,7 +192,6 @@ gst_fakesrc_class_init (GstFakeSrcClass *klass)
   gobject_class = (GObjectClass*)klass;
   gstelement_class = (GstElementClass*)klass;
 
-  parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
 
   g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NUM_SOURCES,
     g_param_spec_int ("num-sources", "num-sources", "Number of sources",
index b0ecc94d7f7d9deb6e6408537fdb680145fda52e..70f358669cf211e8db28649d179b1a882e692b02 100644 (file)
@@ -50,9 +50,10 @@ 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);
+#define _do_init(bla) \
+    GST_DEBUG_CATEGORY_INIT (gst_fdsink_debug, "fdsink", 0, "fdsink element");
+
+GST_BOILERPLATE_FULL (GstFdSink, gst_fdsink, GstElement, GST_TYPE_ELEMENT, _do_init);
 
 static void    gst_fdsink_set_property (GObject *object, guint prop_id, 
                                         const GValue *value, GParamSpec *pspec);
@@ -61,32 +62,6 @@ static void  gst_fdsink_get_property (GObject *object, guint prop_id,
 
 static void    gst_fdsink_chain        (GstPad *pad,GstData *_data);
 
-static GstElementClass *parent_class = NULL;
-/*static guint gst_fdsink_signals[LAST_SIGNAL] = { 0 };*/
-
-GType
-gst_fdsink_get_type (void) 
-{
-  static GType fdsink_type = 0;
-
-  if (!fdsink_type) {
-    static const GTypeInfo fdsink_info = {
-      sizeof(GstFdSinkClass),
-      gst_fdsink_base_init,
-      NULL,
-      (GClassInitFunc)gst_fdsink_class_init,
-      NULL,
-      NULL,
-      sizeof(GstFdSink),
-      0,
-      (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)
@@ -102,7 +77,6 @@ gst_fdsink_class_init (GstFdSinkClass *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,
     g_param_spec_int ("fd", "fd", "An open file descriptor to write to",
index de7359c6e56297d0349f9c7ec033aeef1dbdda9a..d45ff18f8156fb055a385dd704109b001bf51415 100644 (file)
@@ -58,9 +58,10 @@ 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);
+#define _do_init(bla) \
+    GST_DEBUG_CATEGORY_INIT (gst_fdsrc_debug, "fdsrc", 0, "fdsrc element");
+
+GST_BOILERPLATE_FULL (GstFdSrc, gst_fdsrc, GstElement, GST_TYPE_ELEMENT, _do_init);
 
 static void            gst_fdsrc_set_property  (GObject *object, guint prop_id, 
                                                 const GValue *value, GParamSpec *pspec);
@@ -70,33 +71,6 @@ static void          gst_fdsrc_get_property  (GObject *object, guint prop_id,
 static GstData *       gst_fdsrc_get           (GstPad *pad);
 
 
-static GstElementClass *parent_class = NULL;
-/*static guint gst_fdsrc_signals[LAST_SIGNAL] = { 0 };*/
-
-GType
-gst_fdsrc_get_type (void) 
-{
-  static GType fdsrc_type = 0;
-
-  if (!fdsrc_type) {
-    static const GTypeInfo fdsrc_info = {
-      sizeof(GstFdSrcClass),      
-      gst_fdsrc_base_init,
-      NULL,
-      (GClassInitFunc)gst_fdsrc_class_init,
-      NULL,
-      NULL,
-      sizeof(GstFdSrc),
-      0,
-      (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)
 {
@@ -111,7 +85,6 @@ gst_fdsrc_class_init (GstFdSrcClass *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,
     g_param_spec_int ("fd", "fd", "An open file descriptor to read from",
index 9a7bfbb8f0a340fa2acfbe8cd92eb5a2a5f5df11..97a04f3d6f9a1d218271f1a9ab83ecf81f5590c9 100644 (file)
@@ -66,9 +66,6 @@ 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);
 static void    gst_filesink_dispose            (GObject *object);
 
 static void    gst_filesink_set_property       (GObject *object, guint prop_id, 
@@ -88,40 +85,23 @@ static void gst_filesink_uri_handler_init   (gpointer g_iface, gpointer iface_data
   
 static GstElementStateReturn gst_filesink_change_state (GstElement *element);
 
-static GstElementClass *parent_class = NULL;
 static guint gst_filesink_signals[LAST_SIGNAL] = { 0 };
 
-GType
-gst_filesink_get_type (void) 
+static void
+_do_init (GType filesink_type)
 {
-  static GType filesink_type = 0;
-
-  if (!filesink_type) {
-    static const GTypeInfo filesink_info = {
-      sizeof(GstFileSinkClass),
-      gst_filesink_base_init,
-      NULL,
-      (GClassInitFunc)gst_filesink_class_init,
-      NULL,
-      NULL,
-      sizeof(GstFileSink),
-      0,
-      (GInstanceInitFunc)gst_filesink_init,
-    };
-    static const GInterfaceInfo urihandler_info = {
-      gst_filesink_uri_handler_init,
-      NULL,
-      NULL
-    };
-    filesink_type = g_type_register_static (GST_TYPE_ELEMENT, "GstFileSink", &filesink_info, 0);
-    
-    g_type_add_interface_static (filesink_type, GST_TYPE_URI_HANDLER, &urihandler_info);
-  
-    GST_DEBUG_CATEGORY_INIT (gst_filesink_debug, "filesink", 0, "filesink element");
-  }
-  return filesink_type;
+  static const GInterfaceInfo urihandler_info = {
+    gst_filesink_uri_handler_init,
+    NULL,
+    NULL
+  };
+  g_type_add_interface_static (filesink_type, GST_TYPE_URI_HANDLER, &urihandler_info);
+  GST_DEBUG_CATEGORY_INIT (gst_filesink_debug, "filesink", 0, "filesink element");
 }
 
+GST_BOILERPLATE_FULL (GstFileSink, gst_filesink, GstElement, GST_TYPE_ELEMENT, _do_init);
+    
+
 static void
 gst_filesink_base_init (gpointer g_class)
 {
@@ -135,7 +115,6 @@ gst_filesink_class_init (GstFileSinkClass *klass)
 {
   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
 
-  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",
index f2789ec59f450a7f41cec68c724a49c0aa13c54c..adb2d81c71472bb88117fc9b3a5358e9b3649029 100644 (file)
@@ -118,9 +118,6 @@ 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);
 
 static void            gst_filesrc_set_property        (GObject *object, guint prop_id, 
@@ -138,41 +135,20 @@ static GstElementStateReturn      gst_filesrc_change_state        (GstElement *element);
 
 static void            gst_filesrc_uri_handler_init    (gpointer g_iface, gpointer iface_data);
 
-
-static GstElementClass *parent_class = NULL;
-/*static guint gst_filesrc_signals[LAST_SIGNAL] = { 0 };*/
-
-GType
-gst_filesrc_get_type(void)
+static void
+_do_init (GType filesrc_type)
 {
-  static GType filesrc_type = 0;
-
-  if (!filesrc_type) {
-    static const GTypeInfo filesrc_info = {
-      sizeof(GstFileSrcClass), 
-      gst_filesrc_base_init,
-      NULL,
-      (GClassInitFunc)gst_filesrc_class_init,
-      NULL,
-      NULL,
-      sizeof(GstFileSrc),
-      0,
-      (GInstanceInitFunc)gst_filesrc_init,
-    };
-    static const GInterfaceInfo urihandler_info = {
-      gst_filesrc_uri_handler_init,
-      NULL,
-      NULL
-    };
-    filesrc_type = g_type_register_static (GST_TYPE_ELEMENT, "GstFileSrc", &filesrc_info, 0);
-    
-    g_type_add_interface_static (filesrc_type, GST_TYPE_URI_HANDLER, &urihandler_info);
-    
-    GST_DEBUG_CATEGORY_INIT (gst_filesrc_debug, "filesrc", 0, "filesrc element");
-  }
-  return filesrc_type;
+  static const GInterfaceInfo urihandler_info = {
+    gst_filesrc_uri_handler_init,
+    NULL,
+    NULL
+  };
+  g_type_add_interface_static (filesrc_type, GST_TYPE_URI_HANDLER, &urihandler_info);
+  GST_DEBUG_CATEGORY_INIT (gst_filesrc_debug, "filesrc", 0, "filesrc element");
 }
 
+GST_BOILERPLATE_FULL (GstFileSrc, gst_filesrc, GstElement, GST_TYPE_ELEMENT, _do_init);
+    
 static void
 gst_filesrc_base_init (gpointer g_class)
 {
@@ -188,7 +164,6 @@ gst_filesrc_class_init (GstFileSrcClass *klass)
 
   gobject_class = (GObjectClass*)klass;
 
-  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",
index 6de0b6e5b15b1ce6914dd3edf5c0d2465b5088e7..f9bfdebbcda4d327d20075e358cf2e14a59ff741 100644 (file)
@@ -60,42 +60,18 @@ 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);
+#define _do_init(bla) \
+    GST_DEBUG_CATEGORY_INIT (gst_identity_debug, "identity", 0, "identity element");
+
+GST_BOILERPLATE_FULL (GstIdentity, gst_identity, GstElement, GST_TYPE_ELEMENT, _do_init);
 
 static void gst_identity_set_property  (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
 static void gst_identity_get_property  (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
 
 static void gst_identity_chain         (GstPad *pad, GstData *_data);
 
-static GstElementClass *parent_class = NULL;
 static guint gst_identity_signals[LAST_SIGNAL] = { 0 };
 
-GType
-gst_identity_get_type (void) 
-{
-  static GType identity_type = 0;
-
-  if (!identity_type) {
-    static const GTypeInfo identity_info = {
-      sizeof(GstIdentityClass),
-      gst_identity_base_init,
-      NULL,
-      (GClassInitFunc)gst_identity_class_init,
-      NULL,
-      NULL,
-      sizeof(GstIdentity),
-      0,
-      (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)
 {
@@ -110,7 +86,6 @@ gst_identity_class_init (GstIdentityClass *klass)
 
   gobject_class = G_OBJECT_CLASS (klass);
 
-  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", 
index 2b7d63b7a74ce5666eb02d8c3dec6a7d0c4a69b7..a75ea075ee96132ebcef80c1cfcf889babdbe947 100644 (file)
@@ -61,11 +61,12 @@ GstStaticPadTemplate md5_sink_template = GST_STATIC_PAD_TEMPLATE (
   GST_STATIC_CAPS_ANY
 );
 
-/* 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);
+#define _do_init(bla) \
+    GST_DEBUG_CATEGORY_INIT (gst_md5sink_debug, "md5sink", 0, "md5sink element");
+
+GST_BOILERPLATE_FULL (GstMD5Sink, gst_md5sink, GstElement, GST_TYPE_ELEMENT, _do_init);
 
+/* GObject stuff */
 /*static void                  gst_md5sink_set_property        (GObject *object, guint prop_id, 
                                                         const GValue *value, GParamSpec *pspec);*/
 static void                    gst_md5sink_get_property        (GObject *object, guint prop_id, 
@@ -74,11 +75,6 @@ static void                  gst_md5sink_get_property        (GObject *object, guint prop_id,
 static void                    gst_md5sink_chain               (GstPad *pad, GstData *_data);
 static GstElementStateReturn   gst_md5sink_change_state        (GstElement *element);
 
-/* variables */
-static GstElementClass                 *parent_class = NULL;
-/* no signals 
-static guint                   gst_md5sink_signals[LAST_SIGNAL] = { 0 }; */
-
 
 /* MD5 stuff */
 static void                    md5_init_ctx                    (GstMD5Sink *ctx);
@@ -381,31 +377,6 @@ md5_process_block (const void *buffer, size_t len, GstMD5Sink *ctx)
   ctx->D = D;
 }
 
-GType
-gst_md5sink_get_type (void) 
-{
-  static GType md5sink_type = 0;
-
-  if (!md5sink_type) {
-    static const GTypeInfo md5sink_info = {
-      sizeof(GstMD5SinkClass),
-      gst_md5sink_base_init,
-      NULL,
-      (GClassInitFunc) gst_md5sink_class_init,
-      NULL,
-      NULL,
-      sizeof (GstMD5Sink),
-      0,
-      (GInstanceInitFunc) gst_md5sink_init,
-    };
-    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)
 {
@@ -425,7 +396,6 @@ gst_md5sink_class_init (GstMD5SinkClass *klass)
   gobject_class = (GObjectClass *) klass;
   gstelement_class = (GstElementClass *) klass;
 
-  parent_class = g_type_class_peek_parent (klass);
 
   gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_md5sink_get_property);
 
index d3ca0d9e5af39e7db6df39fba5ccca8744d84418..df9a241b8bf51e8321e42343aaed48df214a036c 100644 (file)
@@ -54,9 +54,10 @@ 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);
+#define _do_init(bla) \
+    GST_DEBUG_CATEGORY_INIT (gst_multidisksrc_debug, "multidisksrc", 0, "multidisksrc element");
+
+GST_BOILERPLATE_FULL (GstMultiDiskSrc, gst_multidisksrc, GstElement, GST_TYPE_ELEMENT, _do_init);
 
 static void            gst_multidisksrc_set_property   (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
 static void            gst_multidisksrc_get_property   (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
@@ -69,35 +70,10 @@ static GstElementStateReturn        gst_multidisksrc_change_state   (GstElement *element)
 static gboolean                gst_multidisksrc_open_file      (GstMultiDiskSrc *src, GstPad *srcpad);
 static void            gst_multidisksrc_close_file     (GstMultiDiskSrc *src);
 
-static GstElementClass *parent_class = NULL;
 static guint gst_multidisksrc_signals[LAST_SIGNAL] = { 0 };
 
-GType
-gst_multidisksrc_get_type(void)
-{
-  static GType multidisksrc_type = 0;
-
-  if (!multidisksrc_type) {
-    static const GTypeInfo multidisksrc_info = {
-      sizeof(GstMultiDiskSrcClass),
-      gst_multidiscsrc_base_init,
-      NULL,
-      (GClassInitFunc)gst_multidisksrc_class_init,
-      NULL,
-      NULL,
-      sizeof(GstMultiDiskSrc),
-      0,
-      (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)
+gst_multidisksrc_base_init (gpointer g_class)
 {
   GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
   
@@ -112,7 +88,6 @@ gst_multidisksrc_class_init (GstMultiDiskSrcClass *klass)
   gobject_class = (GObjectClass*)klass;
   gstelement_class = (GstElementClass*)klass;
 
-  parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
 
   gst_multidisksrc_signals[NEW_FILE] =
     g_signal_new ("new_file", G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST,
index d3ca0d9e5af39e7db6df39fba5ccca8744d84418..df9a241b8bf51e8321e42343aaed48df214a036c 100644 (file)
@@ -54,9 +54,10 @@ 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);
+#define _do_init(bla) \
+    GST_DEBUG_CATEGORY_INIT (gst_multidisksrc_debug, "multidisksrc", 0, "multidisksrc element");
+
+GST_BOILERPLATE_FULL (GstMultiDiskSrc, gst_multidisksrc, GstElement, GST_TYPE_ELEMENT, _do_init);
 
 static void            gst_multidisksrc_set_property   (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
 static void            gst_multidisksrc_get_property   (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
@@ -69,35 +70,10 @@ static GstElementStateReturn        gst_multidisksrc_change_state   (GstElement *element)
 static gboolean                gst_multidisksrc_open_file      (GstMultiDiskSrc *src, GstPad *srcpad);
 static void            gst_multidisksrc_close_file     (GstMultiDiskSrc *src);
 
-static GstElementClass *parent_class = NULL;
 static guint gst_multidisksrc_signals[LAST_SIGNAL] = { 0 };
 
-GType
-gst_multidisksrc_get_type(void)
-{
-  static GType multidisksrc_type = 0;
-
-  if (!multidisksrc_type) {
-    static const GTypeInfo multidisksrc_info = {
-      sizeof(GstMultiDiskSrcClass),
-      gst_multidiscsrc_base_init,
-      NULL,
-      (GClassInitFunc)gst_multidisksrc_class_init,
-      NULL,
-      NULL,
-      sizeof(GstMultiDiskSrc),
-      0,
-      (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)
+gst_multidisksrc_base_init (gpointer g_class)
 {
   GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
   
@@ -112,7 +88,6 @@ gst_multidisksrc_class_init (GstMultiDiskSrcClass *klass)
   gobject_class = (GObjectClass*)klass;
   gstelement_class = (GstElementClass*)klass;
 
-  parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
 
   gst_multidisksrc_signals[NEW_FILE] =
     g_signal_new ("new_file", G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST,
index 2b61a67e8639d16dd2130ec29c5c7ce6816f9c5f..8d43417614daeee8c945d910d0e3f315d702e8bb 100644 (file)
@@ -59,9 +59,10 @@ 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);
+#define _do_init(bla) \
+    GST_DEBUG_CATEGORY_INIT (gst_pipefilter_debug, "pipefilter", 0, "pipefilter element");
+
+GST_BOILERPLATE_FULL (GstPipefilter, gst_pipefilter, GstElement, GST_TYPE_ELEMENT, _do_init);
 
 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);
@@ -72,33 +73,6 @@ static gboolean              gst_pipefilter_handle_event     (GstPad *pad, GstEvent *event);
 
 static GstElementStateReturn   gst_pipefilter_change_state     (GstElement *element);
 
-static GstElementClass *parent_class = NULL;
-/*static guint gst_pipefilter_signals[LAST_SIGNAL] = { 0 };*/
-
-GType
-gst_pipefilter_get_type (void)
-{
-  static GType pipefilter_type = 0;
-
-  if (!pipefilter_type) {
-    static const GTypeInfo pipefilter_info = {
-      sizeof(GstPipefilterClass),
-      gst_pipefilter_base_init,
-      NULL,
-      (GClassInitFunc)gst_pipefilter_class_init,
-      NULL,
-      NULL,
-      sizeof(GstPipefilter),
-      0,
-      (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)
 {
@@ -115,7 +89,6 @@ gst_pipefilter_class_init (GstPipefilterClass *klass)
   gobject_class = (GObjectClass*)klass;
   gstelement_class = (GstElementClass*)klass;
 
-  parent_class = g_type_class_ref(GST_TYPE_ELEMENT);
 
   gobject_class->set_property = gst_pipefilter_set_property;  
   gobject_class->get_property = gst_pipefilter_get_property;
index 5ec9873a9920ed818cbf2ef0c43a00e22b4f18cf..34301f1a64b563f7be10d317df2d5307f52a0c91 100644 (file)
@@ -90,9 +90,10 @@ 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);
+#define _do_init(bla) \
+    GST_DEBUG_CATEGORY_INIT (gst_shaper_debug, "shaper", 0, "shaper element");
+
+GST_BOILERPLATE_FULL (GstShaper, gst_shaper, GstElement, GST_TYPE_ELEMENT, _do_init);
 
 static void    gst_shaper_set_property         (GObject *object, guint prop_id, 
                                                 const GValue *value, GParamSpec *pspec);
@@ -104,32 +105,6 @@ static GstPad*     gst_shaper_request_new_pad      (GstElement *element, GstPadTemplate
 
 static void    gst_shaper_loop                 (GstElement *element);
 
-static GstElementClass *parent_class = NULL;
-/* static guint gst_shaper_signals[LAST_SIGNAL] = { 0 }; */
-
-GType
-gst_shaper_get_type (void) 
-{
-  static GType shaper_type = 0;
-
-  if (!shaper_type) {
-    static const GTypeInfo shaper_info = {
-      sizeof(GstShaperClass),
-      gst_shaper_base_init,
-      NULL,
-      (GClassInitFunc)gst_shaper_class_init,
-      NULL,
-      NULL,
-      sizeof(GstShaper),
-      0,
-      (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)
@@ -152,7 +127,6 @@ gst_shaper_class_init (GstShaperClass *klass)
   gobject_class = (GObjectClass*) klass;
   gstelement_class = (GstElementClass*) klass;
 
-  parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
 
   g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_POLICY,
     g_param_spec_enum ("policy", "Policy", "Shaper policy",
index 37b60b1a39c0675e94107d2dd594b48855beb892..688727c123d2e9e8d5b9598749f880fae724fafa 100644 (file)
@@ -58,9 +58,10 @@ 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);
+#define _do_init(bla) \
+    GST_DEBUG_CATEGORY_INIT (gst_statistics_debug, "statistics", 0, "statistics element");
+
+GST_BOILERPLATE_FULL (GstStatistics, gst_statistics, GstElement, GST_TYPE_ELEMENT, _do_init);
 
 static void gst_statistics_set_property        (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
 static void gst_statistics_get_property        (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
@@ -69,34 +70,10 @@ static void gst_statistics_chain            (GstPad *pad, GstData *_data);
 static void gst_statistics_reset               (GstStatistics *statistics);
 static void gst_statistics_print               (GstStatistics *statistics);
 
-static GstElementClass *parent_class = NULL;
 static guint gst_statistics_signals[LAST_SIGNAL] = { 0, };
 
 static stats zero_stats = { 0, };
 
-GType
-gst_statistics_get_type (void) 
-{
-  static GType statistics_type = 0;
-
-  if (!statistics_type) {
-    static const GTypeInfo statistics_info = {
-      sizeof(GstStatisticsClass), 
-      gst_statistics_base_init,
-      NULL,
-      (GClassInitFunc)gst_statistics_class_init,
-      NULL,
-      NULL,
-      sizeof(GstStatistics),
-      0,
-      (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)
@@ -112,7 +89,6 @@ gst_statistics_class_init (GstStatisticsClass *klass)
   
   gobject_class = G_OBJECT_CLASS (klass);
 
-  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",
index c2b1cf294e6527ebc3238716bc4524c45f97d5c3..186fa96fe2d7929dc722202fed7332717ba29741 100644 (file)
@@ -60,9 +60,10 @@ GstStaticPadTemplate tee_src_template = GST_STATIC_PAD_TEMPLATE (
   GST_STATIC_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);
+#define _do_init(bla) \
+    GST_DEBUG_CATEGORY_INIT (gst_tee_debug, "tee", 0, "tee element");
+
+GST_BOILERPLATE_FULL (GstTee, gst_tee, GstElement, GST_TYPE_ELEMENT, _do_init);
 
 static GstPad*         gst_tee_request_new_pad (GstElement *element, GstPadTemplate *temp, const gchar *unused);
 
@@ -74,32 +75,6 @@ static void  gst_tee_get_property    (GObject *object, guint prop_id,
 static void    gst_tee_chain           (GstPad *pad, GstData *_data);
 
 
-static GstElementClass *parent_class = NULL;
-/*static guint gst_tee_signals[LAST_SIGNAL] = { 0 };*/
-
-GType
-gst_tee_get_type(void) {
-  static GType tee_type = 0;
-
-  if (!tee_type) {
-    static const GTypeInfo tee_info = {
-      sizeof(GstTeeClass),
-      gst_tee_base_init,
-      NULL,
-      (GClassInitFunc)gst_tee_class_init,
-      NULL,
-      NULL,
-      sizeof(GstTee),
-      0,
-      (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)
 {
@@ -118,7 +93,6 @@ gst_tee_class_init (GstTeeClass *klass)
   gobject_class = (GObjectClass*)klass;
   gstelement_class = (GstElementClass*)klass;
 
-  parent_class = g_type_class_ref(GST_TYPE_ELEMENT);
 
   g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NUM_PADS,
     g_param_spec_int ("num_pads", "num_pads", "num_pads",
index 91c6b58afa0c5bc8e39eb630e900266db618dfe0..5ba1cb9aa2bd27adf1923357739eb7cd638bb954 100644 (file)
@@ -42,6 +42,7 @@
 #include "gst/gst_private.h"
 
 #include <gst/gsttypefind.h>
+#include <gst/gstutils.h>
 
 GST_DEBUG_CATEGORY_STATIC (gst_type_find_element_debug);
 #define GST_CAT_DEFAULT gst_type_find_element_debug
@@ -85,11 +86,12 @@ 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,
-                                                        gpointer       g_class);
+#define _do_init(bla) \
+    GST_DEBUG_CATEGORY_INIT (gst_type_find_element_debug, "typefind",          \
+       GST_DEBUG_BG_YELLOW | GST_DEBUG_FG_GREEN, "type finding element");
+
+GST_BOILERPLATE_FULL (GstTypeFindElement, gst_type_find_element, GstElement, GST_TYPE_ELEMENT, _do_init);
+
 static void    gst_type_find_element_dispose           (GObject *      object);
 static void    gst_type_find_element_set_property      (GObject *      object, 
                                                         guint          prop_id,
@@ -110,36 +112,8 @@ static void        gst_type_find_element_chain             (GstPad *       sinkpad,
 static GstElementStateReturn
                gst_type_find_element_change_state      (GstElement *   element);
 
-static GstElementClass *parent_class = NULL;
 static guint gst_type_find_element_signals[LAST_SIGNAL] = { 0 };
 
-GType
-gst_type_find_element_get_type (void)
-{
-  static GType typefind_type = 0;
-
-  if (!typefind_type) {
-    static const GTypeInfo typefind_info = {
-      sizeof (GstTypeFindElementClass),
-      gst_type_find_element_base_init,
-      NULL,
-      gst_type_find_element_class_init,
-      NULL,
-      NULL,
-      sizeof (GstTypeFindElement),
-      0,
-      gst_type_find_element_init,
-      NULL
-    };
-    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;
-}
 static void
 gst_type_find_element_have_type (GstTypeFindElement *typefind, guint probability, const GstCaps *caps)
 {
@@ -162,17 +136,10 @@ gst_type_find_element_base_init (gpointer 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)
+gst_type_find_element_class_init (GstTypeFindElementClass *typefind_class)
 {
-  GObjectClass *gobject_class;
-  GstElementClass *gstelement_class;
-  GstTypeFindElementClass *typefind_class;
-
-  gobject_class = G_OBJECT_CLASS (g_class);
-  gstelement_class = GST_ELEMENT_CLASS (g_class);
-  typefind_class = GST_TYPE_FIND_ELEMENT_CLASS (g_class);
-
-  parent_class = g_type_class_peek_parent (g_class);
+  GObjectClass *gobject_class = G_OBJECT_CLASS (typefind_class);
+  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (typefind_class);
 
   gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_type_find_element_set_property);
   gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_type_find_element_get_property);
@@ -191,7 +158,7 @@ gst_type_find_element_class_init (gpointer g_class, gpointer class_data)
          GST_TYPE_FIND_MINIMUM, GST_TYPE_FIND_MAXIMUM, GST_TYPE_FIND_MAXIMUM, G_PARAM_READWRITE));
 
   gst_type_find_element_signals[HAVE_TYPE] = g_signal_new ("have_type", 
-         G_TYPE_FROM_CLASS (g_class), G_SIGNAL_RUN_LAST,
+         G_TYPE_FROM_CLASS (typefind_class), G_SIGNAL_RUN_LAST,
           G_STRUCT_OFFSET (GstTypeFindElementClass, have_type), NULL, NULL,
           gst_marshal_VOID__UINT_POINTER, G_TYPE_NONE, 2,
           G_TYPE_UINT, G_TYPE_POINTER);
@@ -199,10 +166,8 @@ gst_type_find_element_class_init (gpointer g_class, gpointer class_data)
   gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_type_find_element_change_state);
 }
 static void
-gst_type_find_element_init (GTypeInstance *instance, gpointer g_class)
+gst_type_find_element_init (GstTypeFindElement *typefind)
 {
-  GstTypeFindElement *typefind = GST_TYPE_FIND_ELEMENT (instance);
-  
   /* sinkpad */
   typefind->sink = gst_pad_new_from_template (
       gst_static_pad_template_get (&type_find_element_sink_template), "sink");
index 91c6b58afa0c5bc8e39eb630e900266db618dfe0..5ba1cb9aa2bd27adf1923357739eb7cd638bb954 100644 (file)
@@ -42,6 +42,7 @@
 #include "gst/gst_private.h"
 
 #include <gst/gsttypefind.h>
+#include <gst/gstutils.h>
 
 GST_DEBUG_CATEGORY_STATIC (gst_type_find_element_debug);
 #define GST_CAT_DEFAULT gst_type_find_element_debug
@@ -85,11 +86,12 @@ 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,
-                                                        gpointer       g_class);
+#define _do_init(bla) \
+    GST_DEBUG_CATEGORY_INIT (gst_type_find_element_debug, "typefind",          \
+       GST_DEBUG_BG_YELLOW | GST_DEBUG_FG_GREEN, "type finding element");
+
+GST_BOILERPLATE_FULL (GstTypeFindElement, gst_type_find_element, GstElement, GST_TYPE_ELEMENT, _do_init);
+
 static void    gst_type_find_element_dispose           (GObject *      object);
 static void    gst_type_find_element_set_property      (GObject *      object, 
                                                         guint          prop_id,
@@ -110,36 +112,8 @@ static void        gst_type_find_element_chain             (GstPad *       sinkpad,
 static GstElementStateReturn
                gst_type_find_element_change_state      (GstElement *   element);
 
-static GstElementClass *parent_class = NULL;
 static guint gst_type_find_element_signals[LAST_SIGNAL] = { 0 };
 
-GType
-gst_type_find_element_get_type (void)
-{
-  static GType typefind_type = 0;
-
-  if (!typefind_type) {
-    static const GTypeInfo typefind_info = {
-      sizeof (GstTypeFindElementClass),
-      gst_type_find_element_base_init,
-      NULL,
-      gst_type_find_element_class_init,
-      NULL,
-      NULL,
-      sizeof (GstTypeFindElement),
-      0,
-      gst_type_find_element_init,
-      NULL
-    };
-    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;
-}
 static void
 gst_type_find_element_have_type (GstTypeFindElement *typefind, guint probability, const GstCaps *caps)
 {
@@ -162,17 +136,10 @@ gst_type_find_element_base_init (gpointer 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)
+gst_type_find_element_class_init (GstTypeFindElementClass *typefind_class)
 {
-  GObjectClass *gobject_class;
-  GstElementClass *gstelement_class;
-  GstTypeFindElementClass *typefind_class;
-
-  gobject_class = G_OBJECT_CLASS (g_class);
-  gstelement_class = GST_ELEMENT_CLASS (g_class);
-  typefind_class = GST_TYPE_FIND_ELEMENT_CLASS (g_class);
-
-  parent_class = g_type_class_peek_parent (g_class);
+  GObjectClass *gobject_class = G_OBJECT_CLASS (typefind_class);
+  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (typefind_class);
 
   gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_type_find_element_set_property);
   gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_type_find_element_get_property);
@@ -191,7 +158,7 @@ gst_type_find_element_class_init (gpointer g_class, gpointer class_data)
          GST_TYPE_FIND_MINIMUM, GST_TYPE_FIND_MAXIMUM, GST_TYPE_FIND_MAXIMUM, G_PARAM_READWRITE));
 
   gst_type_find_element_signals[HAVE_TYPE] = g_signal_new ("have_type", 
-         G_TYPE_FROM_CLASS (g_class), G_SIGNAL_RUN_LAST,
+         G_TYPE_FROM_CLASS (typefind_class), G_SIGNAL_RUN_LAST,
           G_STRUCT_OFFSET (GstTypeFindElementClass, have_type), NULL, NULL,
           gst_marshal_VOID__UINT_POINTER, G_TYPE_NONE, 2,
           G_TYPE_UINT, G_TYPE_POINTER);
@@ -199,10 +166,8 @@ gst_type_find_element_class_init (gpointer g_class, gpointer class_data)
   gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_type_find_element_change_state);
 }
 static void
-gst_type_find_element_init (GTypeInstance *instance, gpointer g_class)
+gst_type_find_element_init (GstTypeFindElement *typefind)
 {
-  GstTypeFindElement *typefind = GST_TYPE_FIND_ELEMENT (instance);
-  
   /* sinkpad */
   typefind->sink = gst_pad_new_from_template (
       gst_static_pad_template_get (&type_find_element_sink_template), "sink");