diff --git a/ChangeLog b/ChangeLog index 1c3aa6ef96..e90df06a08 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,26 @@ +2004-01-08 Benjamin Otte + + * 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 * docs/gst/gstreamer-docs.sgml: remove props diff --git a/gst/elements/gstaggregator.c b/gst/elements/gstaggregator.c index 8d3523c63c..b4945b8a0c 100644 --- a/gst/elements/gstaggregator.c +++ b/gst/elements/gstaggregator.c @@ -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", diff --git a/gst/elements/gstbufferstore.c b/gst/elements/gstbufferstore.c index 8d38740da5..7a31f641fd 100644 --- a/gst/elements/gstbufferstore.c +++ b/gst/elements/gstbufferstore.c @@ -23,6 +23,7 @@ # include "config.h" #endif #include "gstbufferstore.h" +#include #include 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 diff --git a/gst/elements/gstfakesink.c b/gst/elements/gstfakesink.c index 5589f14df8..b402b9caa8 100644 --- a/gst/elements/gstfakesink.c +++ b/gst/elements/gstfakesink.c @@ -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", diff --git a/gst/elements/gstfakesrc.c b/gst/elements/gstfakesrc.c index a832f0ff39..f3a9100679 100644 --- a/gst/elements/gstfakesrc.c +++ b/gst/elements/gstfakesrc.c @@ -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", diff --git a/gst/elements/gstfdsink.c b/gst/elements/gstfdsink.c index b0ecc94d7f..70f358669c 100644 --- a/gst/elements/gstfdsink.c +++ b/gst/elements/gstfdsink.c @@ -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", diff --git a/gst/elements/gstfdsrc.c b/gst/elements/gstfdsrc.c index de7359c6e5..d45ff18f81 100644 --- a/gst/elements/gstfdsrc.c +++ b/gst/elements/gstfdsrc.c @@ -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", diff --git a/gst/elements/gstfilesink.c b/gst/elements/gstfilesink.c index 9a7bfbb8f0..97a04f3d6f 100644 --- a/gst/elements/gstfilesink.c +++ b/gst/elements/gstfilesink.c @@ -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", diff --git a/gst/elements/gstfilesrc.c b/gst/elements/gstfilesrc.c index f2789ec59f..adb2d81c71 100644 --- a/gst/elements/gstfilesrc.c +++ b/gst/elements/gstfilesrc.c @@ -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", diff --git a/gst/elements/gstidentity.c b/gst/elements/gstidentity.c index 6de0b6e5b1..f9bfdebbcd 100644 --- a/gst/elements/gstidentity.c +++ b/gst/elements/gstidentity.c @@ -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", diff --git a/gst/elements/gstmd5sink.c b/gst/elements/gstmd5sink.c index 2b7d63b7a7..a75ea075ee 100644 --- a/gst/elements/gstmd5sink.c +++ b/gst/elements/gstmd5sink.c @@ -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); diff --git a/gst/elements/gstmultidisksrc.c b/gst/elements/gstmultidisksrc.c index d3ca0d9e5a..df9a241b8b 100644 --- a/gst/elements/gstmultidisksrc.c +++ b/gst/elements/gstmultidisksrc.c @@ -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, diff --git a/gst/elements/gstmultifilesrc.c b/gst/elements/gstmultifilesrc.c index d3ca0d9e5a..df9a241b8b 100644 --- a/gst/elements/gstmultifilesrc.c +++ b/gst/elements/gstmultifilesrc.c @@ -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, diff --git a/gst/elements/gstpipefilter.c b/gst/elements/gstpipefilter.c index 2b61a67e86..8d43417614 100644 --- a/gst/elements/gstpipefilter.c +++ b/gst/elements/gstpipefilter.c @@ -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; diff --git a/gst/elements/gstshaper.c b/gst/elements/gstshaper.c index 5ec9873a99..34301f1a64 100644 --- a/gst/elements/gstshaper.c +++ b/gst/elements/gstshaper.c @@ -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", diff --git a/gst/elements/gststatistics.c b/gst/elements/gststatistics.c index 37b60b1a39..688727c123 100644 --- a/gst/elements/gststatistics.c +++ b/gst/elements/gststatistics.c @@ -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", diff --git a/gst/elements/gsttee.c b/gst/elements/gsttee.c index c2b1cf294e..186fa96fe2 100644 --- a/gst/elements/gsttee.c +++ b/gst/elements/gsttee.c @@ -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", diff --git a/gst/elements/gsttypefind.c b/gst/elements/gsttypefind.c index 91c6b58afa..5ba1cb9aa2 100644 --- a/gst/elements/gsttypefind.c +++ b/gst/elements/gsttypefind.c @@ -42,6 +42,7 @@ #include "gst/gst_private.h" #include +#include 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"); diff --git a/gst/elements/gsttypefindelement.c b/gst/elements/gsttypefindelement.c index 91c6b58afa..5ba1cb9aa2 100644 --- a/gst/elements/gsttypefindelement.c +++ b/gst/elements/gsttypefindelement.c @@ -42,6 +42,7 @@ #include "gst/gst_private.h" #include +#include 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"); diff --git a/gst/gstutils.h b/gst/gstutils.h index 2c164c0c09..c3f5e9c4a7 100644 --- a/gst/gstutils.h +++ b/gst/gstutils.h @@ -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__ */ diff --git a/plugins/elements/gstaggregator.c b/plugins/elements/gstaggregator.c index 8d3523c63c..b4945b8a0c 100644 --- a/plugins/elements/gstaggregator.c +++ b/plugins/elements/gstaggregator.c @@ -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", diff --git a/plugins/elements/gstbufferstore.c b/plugins/elements/gstbufferstore.c index 8d38740da5..7a31f641fd 100644 --- a/plugins/elements/gstbufferstore.c +++ b/plugins/elements/gstbufferstore.c @@ -23,6 +23,7 @@ # include "config.h" #endif #include "gstbufferstore.h" +#include #include 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 diff --git a/plugins/elements/gstfakesink.c b/plugins/elements/gstfakesink.c index 5589f14df8..b402b9caa8 100644 --- a/plugins/elements/gstfakesink.c +++ b/plugins/elements/gstfakesink.c @@ -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", diff --git a/plugins/elements/gstfakesrc.c b/plugins/elements/gstfakesrc.c index a832f0ff39..f3a9100679 100644 --- a/plugins/elements/gstfakesrc.c +++ b/plugins/elements/gstfakesrc.c @@ -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", diff --git a/plugins/elements/gstfdsink.c b/plugins/elements/gstfdsink.c index b0ecc94d7f..70f358669c 100644 --- a/plugins/elements/gstfdsink.c +++ b/plugins/elements/gstfdsink.c @@ -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", diff --git a/plugins/elements/gstfdsrc.c b/plugins/elements/gstfdsrc.c index de7359c6e5..d45ff18f81 100644 --- a/plugins/elements/gstfdsrc.c +++ b/plugins/elements/gstfdsrc.c @@ -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", diff --git a/plugins/elements/gstfilesink.c b/plugins/elements/gstfilesink.c index 9a7bfbb8f0..97a04f3d6f 100644 --- a/plugins/elements/gstfilesink.c +++ b/plugins/elements/gstfilesink.c @@ -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", diff --git a/plugins/elements/gstfilesrc.c b/plugins/elements/gstfilesrc.c index f2789ec59f..adb2d81c71 100644 --- a/plugins/elements/gstfilesrc.c +++ b/plugins/elements/gstfilesrc.c @@ -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", diff --git a/plugins/elements/gstidentity.c b/plugins/elements/gstidentity.c index 6de0b6e5b1..f9bfdebbcd 100644 --- a/plugins/elements/gstidentity.c +++ b/plugins/elements/gstidentity.c @@ -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", diff --git a/plugins/elements/gstmd5sink.c b/plugins/elements/gstmd5sink.c index 2b7d63b7a7..a75ea075ee 100644 --- a/plugins/elements/gstmd5sink.c +++ b/plugins/elements/gstmd5sink.c @@ -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); diff --git a/plugins/elements/gstmultidisksrc.c b/plugins/elements/gstmultidisksrc.c index d3ca0d9e5a..df9a241b8b 100644 --- a/plugins/elements/gstmultidisksrc.c +++ b/plugins/elements/gstmultidisksrc.c @@ -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, diff --git a/plugins/elements/gstmultifilesrc.c b/plugins/elements/gstmultifilesrc.c index d3ca0d9e5a..df9a241b8b 100644 --- a/plugins/elements/gstmultifilesrc.c +++ b/plugins/elements/gstmultifilesrc.c @@ -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, diff --git a/plugins/elements/gstpipefilter.c b/plugins/elements/gstpipefilter.c index 2b61a67e86..8d43417614 100644 --- a/plugins/elements/gstpipefilter.c +++ b/plugins/elements/gstpipefilter.c @@ -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; diff --git a/plugins/elements/gstshaper.c b/plugins/elements/gstshaper.c index 5ec9873a99..34301f1a64 100644 --- a/plugins/elements/gstshaper.c +++ b/plugins/elements/gstshaper.c @@ -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", diff --git a/plugins/elements/gststatistics.c b/plugins/elements/gststatistics.c index 37b60b1a39..688727c123 100644 --- a/plugins/elements/gststatistics.c +++ b/plugins/elements/gststatistics.c @@ -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", diff --git a/plugins/elements/gsttee.c b/plugins/elements/gsttee.c index c2b1cf294e..186fa96fe2 100644 --- a/plugins/elements/gsttee.c +++ b/plugins/elements/gsttee.c @@ -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", diff --git a/plugins/elements/gsttypefind.c b/plugins/elements/gsttypefind.c index 91c6b58afa..5ba1cb9aa2 100644 --- a/plugins/elements/gsttypefind.c +++ b/plugins/elements/gsttypefind.c @@ -42,6 +42,7 @@ #include "gst/gst_private.h" #include +#include 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"); diff --git a/plugins/elements/gsttypefindelement.c b/plugins/elements/gsttypefindelement.c index 91c6b58afa..5ba1cb9aa2 100644 --- a/plugins/elements/gsttypefindelement.c +++ b/plugins/elements/gsttypefindelement.c @@ -42,6 +42,7 @@ #include "gst/gst_private.h" #include +#include 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");