diff --git a/plugins/elements/gstcapsfilter.c b/plugins/elements/gstcapsfilter.c index 950df3f45c..59c7b73fdc 100644 --- a/plugins/elements/gstcapsfilter.c +++ b/plugins/elements/gstcapsfilter.c @@ -61,12 +61,12 @@ static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", GST_DEBUG_CATEGORY_STATIC (gst_capsfilter_debug); #define GST_CAT_DEFAULT gst_capsfilter_debug -#define _do_init(bla) \ +#define _do_init \ GST_DEBUG_CATEGORY_INIT (gst_capsfilter_debug, "capsfilter", 0, \ "capsfilter element"); - -GST_BOILERPLATE_FULL (GstCapsFilter, gst_capsfilter, GstBaseTransform, - GST_TYPE_BASE_TRANSFORM, _do_init); +#define gst_capsfilter_parent_class parent_class +G_DEFINE_TYPE_WITH_CODE (GstCapsFilter, gst_capsfilter, GST_TYPE_BASE_TRANSFORM, + _do_init); static void gst_capsfilter_set_property (GObject * object, guint prop_id, @@ -84,26 +84,11 @@ static GstFlowReturn gst_capsfilter_transform_ip (GstBaseTransform * base, static GstFlowReturn gst_capsfilter_prepare_buf (GstBaseTransform * trans, GstBuffer * input, gint size, GstCaps * caps, GstBuffer ** buf); -static void -gst_capsfilter_base_init (gpointer g_class) -{ - GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); - - gst_element_class_set_details_simple (gstelement_class, - "CapsFilter", - "Generic", - "Pass data without modification, limiting formats", - "David Schleef "); - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&srctemplate)); - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&sinktemplate)); -} - static void gst_capsfilter_class_init (GstCapsFilterClass * klass) { GObjectClass *gobject_class; + GstElementClass *gstelement_class; GstBaseTransformClass *trans_class; gobject_class = G_OBJECT_CLASS (klass); @@ -118,6 +103,17 @@ gst_capsfilter_class_init (GstCapsFilterClass * klass) "object."), GST_TYPE_CAPS, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + gstelement_class = GST_ELEMENT_CLASS (klass); + gst_element_class_set_details_simple (gstelement_class, + "CapsFilter", + "Generic", + "Pass data without modification, limiting formats", + "David Schleef "); + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&srctemplate)); + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&sinktemplate)); + trans_class = GST_BASE_TRANSFORM_CLASS (klass); trans_class->transform_caps = GST_DEBUG_FUNCPTR (gst_capsfilter_transform_caps); @@ -128,7 +124,7 @@ gst_capsfilter_class_init (GstCapsFilterClass * klass) } static void -gst_capsfilter_init (GstCapsFilter * filter, GstCapsFilterClass * g_class) +gst_capsfilter_init (GstCapsFilter * filter) { GstBaseTransform *trans = GST_BASE_TRANSFORM (filter); gst_base_transform_set_gap_aware (trans, TRUE); diff --git a/plugins/elements/gstfakesink.c b/plugins/elements/gstfakesink.c index 94ed3459ce..70e2fe1da6 100644 --- a/plugins/elements/gstfakesink.c +++ b/plugins/elements/gstfakesink.c @@ -111,11 +111,11 @@ gst_fake_sink_state_error_get_type (void) return fakesink_state_error_type; } -#define _do_init(bla) \ +#define _do_init \ GST_DEBUG_CATEGORY_INIT (gst_fake_sink_debug, "fakesink", 0, "fakesink element"); - -GST_BOILERPLATE_FULL (GstFakeSink, gst_fake_sink, GstBaseSink, - GST_TYPE_BASE_SINK, _do_init); +#define gst_fake_sink_parent_class parent_class +G_DEFINE_TYPE_WITH_CODE (GstFakeSink, gst_fake_sink, GST_TYPE_BASE_SINK, + _do_init); static void gst_fake_sink_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); @@ -164,22 +164,6 @@ marshal_VOID__MINIOBJECT_OBJECT (GClosure * closure, GValue * return_value, g_value_get_object (param_values + 2), data2); } -static void -gst_fake_sink_base_init (gpointer g_class) -{ - GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); - - gst_element_class_set_details_simple (gstelement_class, - "Fake Sink", - "Sink", - "Black hole for data", - "Erik Walthinsen , " - "Wim Taymans , " - "Mr. 'frag-me-more' Vanderwingo "); - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&sinktemplate)); -} - static void gst_fake_sink_class_init (GstFakeSinkClass * klass) { @@ -260,6 +244,16 @@ gst_fake_sink_class_init (GstFakeSinkClass * klass) NULL, NULL, marshal_VOID__MINIOBJECT_OBJECT, G_TYPE_NONE, 2, GST_TYPE_BUFFER, GST_TYPE_PAD); + gst_element_class_set_details_simple (gstelement_class, + "Fake Sink", + "Sink", + "Black hole for data", + "Erik Walthinsen , " + "Wim Taymans , " + "Mr. 'frag-me-more' Vanderwingo "); + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&sinktemplate)); + gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_fake_sink_change_state); @@ -269,7 +263,7 @@ gst_fake_sink_class_init (GstFakeSinkClass * klass) } static void -gst_fake_sink_init (GstFakeSink * fakesink, GstFakeSinkClass * g_class) +gst_fake_sink_init (GstFakeSink * fakesink) { fakesink->silent = DEFAULT_SILENT; fakesink->dump = DEFAULT_DUMP; diff --git a/plugins/elements/gstfakesrc.c b/plugins/elements/gstfakesrc.c index 6e2c2f3a50..27d80043e0 100644 --- a/plugins/elements/gstfakesrc.c +++ b/plugins/elements/gstfakesrc.c @@ -201,11 +201,10 @@ gst_fake_src_filltype_get_type (void) return fakesrc_filltype_type; } -#define _do_init(bla) \ +#define _do_init \ GST_DEBUG_CATEGORY_INIT (gst_fake_src_debug, "fakesrc", 0, "fakesrc element"); - -GST_BOILERPLATE_FULL (GstFakeSrc, gst_fake_src, GstBaseSrc, GST_TYPE_BASE_SRC, - _do_init); +#define gst_fake_src_parent_class parent_class +G_DEFINE_TYPE_WITH_CODE (GstFakeSrc, gst_fake_src, GST_TYPE_BASE_SRC, _do_init); static void gst_fake_src_finalize (GObject * object); static void gst_fake_src_set_property (GObject * object, guint prop_id, @@ -255,27 +254,15 @@ marshal_VOID__MINIOBJECT_OBJECT (GClosure * closure, GValue * return_value, g_value_get_object (param_values + 2), data2); } -static void -gst_fake_src_base_init (gpointer g_class) -{ - GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); - - gst_element_class_set_details_simple (gstelement_class, - "Fake Source", - "Source", - "Push empty (no data) buffers around", - "Erik Walthinsen , " "Wim Taymans "); - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&srctemplate)); -} - static void gst_fake_src_class_init (GstFakeSrcClass * klass) { GObjectClass *gobject_class; + GstElementClass *gstelement_class; GstBaseSrcClass *gstbase_src_class; gobject_class = G_OBJECT_CLASS (klass); + gstelement_class = GST_ELEMENT_CLASS (klass); gstbase_src_class = GST_BASE_SRC_CLASS (klass); gobject_class->finalize = gst_fake_src_finalize; @@ -379,6 +366,14 @@ gst_fake_src_class_init (GstFakeSrcClass * klass) marshal_VOID__MINIOBJECT_OBJECT, G_TYPE_NONE, 2, GST_TYPE_BUFFER, GST_TYPE_PAD); + gst_element_class_set_details_simple (gstelement_class, + "Fake Source", + "Source", + "Push empty (no data) buffers around", + "Erik Walthinsen , " "Wim Taymans "); + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&srctemplate)); + gstbase_src_class->is_seekable = GST_DEBUG_FUNCPTR (gst_fake_src_is_seekable); gstbase_src_class->start = GST_DEBUG_FUNCPTR (gst_fake_src_start); gstbase_src_class->stop = GST_DEBUG_FUNCPTR (gst_fake_src_stop); @@ -388,7 +383,7 @@ gst_fake_src_class_init (GstFakeSrcClass * klass) } static void -gst_fake_src_init (GstFakeSrc * fakesrc, GstFakeSrcClass * g_class) +gst_fake_src_init (GstFakeSrc * fakesrc) { fakesrc->output = FAKE_SRC_FIRST_LAST_LOOP; fakesrc->buffer_count = 0; diff --git a/plugins/elements/gstfdsink.c b/plugins/elements/gstfdsink.c index 1ff46bd12f..8990fe4640 100644 --- a/plugins/elements/gstfdsink.c +++ b/plugins/elements/gstfdsink.c @@ -94,23 +94,11 @@ enum static void gst_fd_sink_uri_handler_init (gpointer g_iface, gpointer iface_data); -static void -_do_init (GType gst_fd_sink_type) -{ - static const GInterfaceInfo urihandler_info = { - gst_fd_sink_uri_handler_init, - NULL, - NULL - }; - - g_type_add_interface_static (gst_fd_sink_type, GST_TYPE_URI_HANDLER, - &urihandler_info); - +#define _do_init \ + G_IMPLEMENT_INTERFACE (GST_TYPE_URI_HANDLER, gst_fd_sink_uri_handler_init); \ GST_DEBUG_CATEGORY_INIT (gst_fd_sink__debug, "fdsink", 0, "fdsink element"); -} - -GST_BOILERPLATE_FULL (GstFdSink, gst_fd_sink, GstBaseSink, GST_TYPE_BASE_SINK, - _do_init); +#define gst_fd_sink_parent_class parent_class +G_DEFINE_TYPE_WITH_CODE (GstFdSink, gst_fd_sink, GST_TYPE_BASE_SINK, _do_init); static void gst_fd_sink_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); @@ -130,9 +118,19 @@ static gboolean gst_fd_sink_event (GstBaseSink * sink, GstEvent * event); static gboolean gst_fd_sink_do_seek (GstFdSink * fdsink, guint64 new_offset); static void -gst_fd_sink_base_init (gpointer g_class) +gst_fd_sink_class_init (GstFdSinkClass * klass) { - GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); + GObjectClass *gobject_class; + GstElementClass *gstelement_class; + GstBaseSinkClass *gstbasesink_class; + + gobject_class = G_OBJECT_CLASS (klass); + gstelement_class = GST_ELEMENT_CLASS (klass); + gstbasesink_class = GST_BASE_SINK_CLASS (klass); + + gobject_class->set_property = gst_fd_sink_set_property; + gobject_class->get_property = gst_fd_sink_get_property; + gobject_class->dispose = gst_fd_sink_dispose; gst_element_class_set_details_simple (gstelement_class, "Filedescriptor Sink", @@ -140,20 +138,6 @@ gst_fd_sink_base_init (gpointer g_class) "Write data to a file descriptor", "Erik Walthinsen "); gst_element_class_add_pad_template (gstelement_class, gst_static_pad_template_get (&sinktemplate)); -} - -static void -gst_fd_sink_class_init (GstFdSinkClass * klass) -{ - GObjectClass *gobject_class; - GstBaseSinkClass *gstbasesink_class; - - gobject_class = G_OBJECT_CLASS (klass); - gstbasesink_class = GST_BASE_SINK_CLASS (klass); - - gobject_class->set_property = gst_fd_sink_set_property; - gobject_class->get_property = gst_fd_sink_get_property; - gobject_class->dispose = gst_fd_sink_dispose; gstbasesink_class->render = GST_DEBUG_FUNCPTR (gst_fd_sink_render); gstbasesink_class->start = GST_DEBUG_FUNCPTR (gst_fd_sink_start); @@ -168,7 +152,7 @@ gst_fd_sink_class_init (GstFdSinkClass * klass) } static void -gst_fd_sink_init (GstFdSink * fdsink, GstFdSinkClass * klass) +gst_fd_sink_init (GstFdSink * fdsink) { GstPad *pad; diff --git a/plugins/elements/gstfdsrc.c b/plugins/elements/gstfdsrc.c index e36a9cc449..e1180fade0 100644 --- a/plugins/elements/gstfdsrc.c +++ b/plugins/elements/gstfdsrc.c @@ -113,23 +113,11 @@ enum static void gst_fd_src_uri_handler_init (gpointer g_iface, gpointer iface_data); -static void -_do_init (GType fd_src_type) -{ - static const GInterfaceInfo urihandler_info = { - gst_fd_src_uri_handler_init, - NULL, - NULL - }; - - g_type_add_interface_static (fd_src_type, GST_TYPE_URI_HANDLER, - &urihandler_info); - +#define _do_init \ + G_IMPLEMENT_INTERFACE (GST_TYPE_URI_HANDLER, gst_fd_src_uri_handler_init); \ GST_DEBUG_CATEGORY_INIT (gst_fd_src_debug, "fdsrc", 0, "fdsrc element"); -} - -GST_BOILERPLATE_FULL (GstFdSrc, gst_fd_src, GstPushSrc, GST_TYPE_PUSH_SRC, - _do_init); +#define gst_fd_src_parent_class parent_class +G_DEFINE_TYPE_WITH_CODE (GstFdSrc, gst_fd_src, GST_TYPE_PUSH_SRC, _do_init); static void gst_fd_src_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); @@ -148,27 +136,16 @@ static gboolean gst_fd_src_query (GstBaseSrc * src, GstQuery * query); static GstFlowReturn gst_fd_src_create (GstPushSrc * psrc, GstBuffer ** outbuf); -static void -gst_fd_src_base_init (gpointer g_class) -{ - GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); - - gst_element_class_set_details_simple (gstelement_class, - "Filedescriptor Source", - "Source/File", - "Read from a file descriptor", "Erik Walthinsen "); - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&srctemplate)); -} - static void gst_fd_src_class_init (GstFdSrcClass * klass) { GObjectClass *gobject_class; + GstElementClass *gstelement_class; GstBaseSrcClass *gstbasesrc_class; GstPushSrcClass *gstpush_src_class; gobject_class = G_OBJECT_CLASS (klass); + gstelement_class = GST_ELEMENT_CLASS (klass); gstbasesrc_class = GST_BASE_SRC_CLASS (klass); gstpush_src_class = GST_PUSH_SRC_CLASS (klass); @@ -192,6 +169,13 @@ gst_fd_src_class_init (GstFdSrcClass * klass) G_MAXUINT64, DEFAULT_TIMEOUT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + gst_element_class_set_details_simple (gstelement_class, + "Filedescriptor Source", + "Source/File", + "Read from a file descriptor", "Erik Walthinsen "); + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&srctemplate)); + gstbasesrc_class->start = GST_DEBUG_FUNCPTR (gst_fd_src_start); gstbasesrc_class->stop = GST_DEBUG_FUNCPTR (gst_fd_src_stop); gstbasesrc_class->unlock = GST_DEBUG_FUNCPTR (gst_fd_src_unlock); @@ -205,7 +189,7 @@ gst_fd_src_class_init (GstFdSrcClass * klass) } static void -gst_fd_src_init (GstFdSrc * fdsrc, GstFdSrcClass * klass) +gst_fd_src_init (GstFdSrc * fdsrc) { fdsrc->new_fd = DEFAULT_FD; fdsrc->seekable_fd = FALSE; diff --git a/plugins/elements/gstfilesink.c b/plugins/elements/gstfilesink.c index 78f78e1208..19e5e9542c 100644 --- a/plugins/elements/gstfilesink.c +++ b/plugins/elements/gstfilesink.c @@ -173,42 +173,18 @@ static gboolean gst_file_sink_query (GstPad * pad, GstQuery * query); static void gst_file_sink_uri_handler_init (gpointer g_iface, gpointer iface_data); - -static void -_do_init (GType filesink_type) -{ - static const GInterfaceInfo urihandler_info = { - gst_file_sink_uri_handler_init, - NULL, - NULL - }; - - g_type_add_interface_static (filesink_type, GST_TYPE_URI_HANDLER, - &urihandler_info); - GST_DEBUG_CATEGORY_INIT (gst_file_sink_debug, "filesink", 0, - "filesink element"); -} - -GST_BOILERPLATE_FULL (GstFileSink, gst_file_sink, GstBaseSink, - GST_TYPE_BASE_SINK, _do_init); - -static void -gst_file_sink_base_init (gpointer g_class) -{ - GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); - - gst_element_class_set_details_simple (gstelement_class, - "File Sink", - "Sink/File", "Write stream to a file", - "Thomas Vander Stichele "); - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&sinktemplate)); -} +#define _do_init \ + G_IMPLEMENT_INTERFACE (GST_TYPE_URI_HANDLER, gst_file_sink_uri_handler_init); \ + GST_DEBUG_CATEGORY_INIT (gst_file_sink_debug, "filesink", 0, "filesink element"); +#define gst_file_sink_parent_class parent_class +G_DEFINE_TYPE_WITH_CODE (GstFileSink, gst_file_sink, GST_TYPE_BASE_SINK, + _do_init); static void gst_file_sink_class_init (GstFileSinkClass * klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); + GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass); GstBaseSinkClass *gstbasesink_class = GST_BASE_SINK_CLASS (klass); gobject_class->dispose = gst_file_sink_dispose; @@ -244,6 +220,13 @@ gst_file_sink_class_init (GstFileSinkClass * klass) "Append to an already existing file", DEFAULT_APPEND, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + gst_element_class_set_details_simple (gstelement_class, + "File Sink", + "Sink/File", "Write stream to a file", + "Thomas Vander Stichele "); + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&sinktemplate)); + gstbasesink_class->start = GST_DEBUG_FUNCPTR (gst_file_sink_start); gstbasesink_class->stop = GST_DEBUG_FUNCPTR (gst_file_sink_stop); gstbasesink_class->render = GST_DEBUG_FUNCPTR (gst_file_sink_render); @@ -256,7 +239,7 @@ gst_file_sink_class_init (GstFileSinkClass * klass) } static void -gst_file_sink_init (GstFileSink * filesink, GstFileSinkClass * g_class) +gst_file_sink_init (GstFileSink * filesink) { GstPad *pad; diff --git a/plugins/elements/gstfilesrc.c b/plugins/elements/gstfilesrc.c index c5fa9988f3..1a65a14be6 100644 --- a/plugins/elements/gstfilesrc.c +++ b/plugins/elements/gstfilesrc.c @@ -205,44 +205,21 @@ static gboolean gst_file_src_query (GstBaseSrc * src, GstQuery * query); static void gst_file_src_uri_handler_init (gpointer g_iface, gpointer iface_data); -static void -_do_init (GType filesrc_type) -{ - static const GInterfaceInfo urihandler_info = { - gst_file_src_uri_handler_init, - NULL, - NULL - }; - - g_type_add_interface_static (filesrc_type, GST_TYPE_URI_HANDLER, - &urihandler_info); +#define _do_init \ + G_IMPLEMENT_INTERFACE (GST_TYPE_URI_HANDLER, gst_file_src_uri_handler_init); \ GST_DEBUG_CATEGORY_INIT (gst_file_src_debug, "filesrc", 0, "filesrc element"); -} - -GST_BOILERPLATE_FULL (GstFileSrc, gst_file_src, GstBaseSrc, GST_TYPE_BASE_SRC, - _do_init); - -static void -gst_file_src_base_init (gpointer g_class) -{ - GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); - - gst_element_class_set_details_simple (gstelement_class, - "File Source", - "Source/File", - "Read from arbitrary point in a file", - "Erik Walthinsen "); - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&srctemplate)); -} +#define gst_file_src_parent_class parent_class +G_DEFINE_TYPE_WITH_CODE (GstFileSrc, gst_file_src, GST_TYPE_BASE_SRC, _do_init); static void gst_file_src_class_init (GstFileSrcClass * klass) { GObjectClass *gobject_class; + GstElementClass *gstelement_class; GstBaseSrcClass *gstbasesrc_class; gobject_class = G_OBJECT_CLASS (klass); + gstelement_class = GST_ELEMENT_CLASS (klass); gstbasesrc_class = GST_BASE_SRC_CLASS (klass); gobject_class->set_property = gst_file_src_set_property; @@ -300,6 +277,14 @@ gst_file_src_class_init (GstFileSrcClass * klass) gobject_class->finalize = gst_file_src_finalize; + gst_element_class_set_details_simple (gstelement_class, + "File Source", + "Source/File", + "Read from arbitrary point in a file", + "Erik Walthinsen "); + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&srctemplate)); + gstbasesrc_class->start = GST_DEBUG_FUNCPTR (gst_file_src_start); gstbasesrc_class->stop = GST_DEBUG_FUNCPTR (gst_file_src_stop); gstbasesrc_class->is_seekable = GST_DEBUG_FUNCPTR (gst_file_src_is_seekable); @@ -314,7 +299,7 @@ gst_file_src_class_init (GstFileSrcClass * klass) } static void -gst_file_src_init (GstFileSrc * src, GstFileSrcClass * g_class) +gst_file_src_init (GstFileSrc * src) { #ifdef HAVE_MMAP src->pagesize = getpagesize (); diff --git a/plugins/elements/gstfunnel.c b/plugins/elements/gstfunnel.c index 28eb8e8c7f..42f664a4cc 100644 --- a/plugins/elements/gstfunnel.c +++ b/plugins/elements/gstfunnel.c @@ -106,14 +106,10 @@ GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_ALWAYS, GST_STATIC_CAPS_ANY); -static void -_do_init (GType type) -{ +#define _do_init \ GST_DEBUG_CATEGORY_INIT (gst_funnel_debug, "funnel", 0, "funnel element"); -} - -GST_BOILERPLATE_FULL (GstFunnel, gst_funnel, GstElement, GST_TYPE_ELEMENT, - _do_init); +#define gst_funnel_parent_class parent_class +G_DEFINE_TYPE_WITH_CODE (GstFunnel, gst_funnel, GST_TYPE_ELEMENT, _do_init); static GstStateChangeReturn gst_funnel_change_state (GstElement * element, GstStateChange transition); @@ -129,21 +125,6 @@ static GstCaps *gst_funnel_sink_getcaps (GstPad * pad); static gboolean gst_funnel_src_event (GstPad * pad, GstEvent * event); -static void -gst_funnel_base_init (gpointer g_class) -{ - GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); - - gst_element_class_set_details_simple (gstelement_class, - "Funnel pipe fitting", "Generic", "N-to-1 pipe fitting", - "Olivier Crete "); - - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&funnel_sink_template)); - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&funnel_src_template)); -} - static void gst_funnel_dispose (GObject * object) { @@ -170,6 +151,15 @@ gst_funnel_class_init (GstFunnelClass * klass) gobject_class->dispose = GST_DEBUG_FUNCPTR (gst_funnel_dispose); + gst_element_class_set_details_simple (gstelement_class, + "Funnel pipe fitting", "Generic", "N-to-1 pipe fitting", + "Olivier Crete "); + + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&funnel_sink_template)); + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&funnel_src_template)); + gstelement_class->request_new_pad = GST_DEBUG_FUNCPTR (gst_funnel_request_new_pad); gstelement_class->release_pad = GST_DEBUG_FUNCPTR (gst_funnel_release_pad); @@ -177,7 +167,7 @@ gst_funnel_class_init (GstFunnelClass * klass) } static void -gst_funnel_init (GstFunnel * funnel, GstFunnelClass * g_class) +gst_funnel_init (GstFunnel * funnel) { funnel->srcpad = gst_pad_new_from_static_template (&funnel_src_template, "src"); diff --git a/plugins/elements/gstidentity.c b/plugins/elements/gstidentity.c index 5d72e557ed..ba4d77c49a 100644 --- a/plugins/elements/gstidentity.c +++ b/plugins/elements/gstidentity.c @@ -91,11 +91,11 @@ enum }; -#define _do_init(bla) \ +#define _do_init \ GST_DEBUG_CATEGORY_INIT (gst_identity_debug, "identity", 0, "identity element"); - -GST_BOILERPLATE_FULL (GstIdentity, gst_identity, GstBaseTransform, - GST_TYPE_BASE_TRANSFORM, _do_init); +#define gst_identity_parent_class parent_class +G_DEFINE_TYPE_WITH_CODE (GstIdentity, gst_identity, GST_TYPE_BASE_TRANSFORM, + _do_init); static void gst_identity_finalize (GObject * object); static void gst_identity_set_property (GObject * object, guint prop_id, @@ -116,21 +116,6 @@ static guint gst_identity_signals[LAST_SIGNAL] = { 0 }; static GParamSpec *pspec_last_message = NULL; -static void -gst_identity_base_init (gpointer g_class) -{ - GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); - - gst_element_class_set_details_simple (gstelement_class, - "Identity", - "Generic", - "Pass data without modification", "Erik Walthinsen "); - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&srctemplate)); - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&sinktemplate)); -} - static void gst_identity_finalize (GObject * object) { @@ -179,9 +164,11 @@ static void gst_identity_class_init (GstIdentityClass * klass) { GObjectClass *gobject_class; + GstElementClass *gstelement_class; GstBaseTransformClass *gstbasetrans_class; gobject_class = G_OBJECT_CLASS (klass); + gstelement_class = GST_ELEMENT_CLASS (klass); gstbasetrans_class = GST_BASE_TRANSFORM_CLASS (klass); gobject_class->set_property = gst_identity_set_property; @@ -271,6 +258,15 @@ gst_identity_class_init (GstIdentityClass * klass) gobject_class->finalize = gst_identity_finalize; + gst_element_class_set_details_simple (gstelement_class, + "Identity", + "Generic", + "Pass data without modification", "Erik Walthinsen "); + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&srctemplate)); + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&sinktemplate)); + gstbasetrans_class->event = GST_DEBUG_FUNCPTR (gst_identity_event); gstbasetrans_class->transform_ip = GST_DEBUG_FUNCPTR (gst_identity_transform_ip); @@ -281,7 +277,7 @@ gst_identity_class_init (GstIdentityClass * klass) } static void -gst_identity_init (GstIdentity * identity, GstIdentityClass * g_class) +gst_identity_init (GstIdentity * identity) { identity->sleep_time = DEFAULT_SLEEP_TIME; identity->error_after = DEFAULT_ERROR_AFTER; @@ -375,7 +371,7 @@ gst_identity_event (GstBaseTransform * trans, GstEvent * event) identity->prev_offset = identity->prev_offset_end = GST_BUFFER_OFFSET_NONE; } - ret = parent_class->event (trans, event); + ret = GST_BASE_TRANSFORM_CLASS (parent_class)->event (trans, event); if (identity->single_segment && (GST_EVENT_TYPE (event) == GST_EVENT_NEWSEGMENT)) { diff --git a/plugins/elements/gstinputselector.c b/plugins/elements/gstinputselector.c index f178a74336..b7aae2ffb3 100644 --- a/plugins/elements/gstinputselector.c +++ b/plugins/elements/gstinputselector.c @@ -163,16 +163,13 @@ struct _GstSelectorPadClass GstPadClass parent; }; -static void gst_selector_pad_class_init (GstSelectorPadClass * klass); -static void gst_selector_pad_init (GstSelectorPad * pad); +GType gst_selector_pad_get_type (void); static void gst_selector_pad_finalize (GObject * object); static void gst_selector_pad_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec); static void gst_selector_pad_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); -static GstPadClass *selector_pad_parent_class = NULL; - static gint64 gst_selector_pad_get_running_time (GstSelectorPad * pad); static void gst_selector_pad_reset (GstSelectorPad * pad); static gboolean gst_selector_pad_event (GstPad * pad, GstEvent * event); @@ -183,30 +180,7 @@ static GstFlowReturn gst_selector_pad_chain (GstPad * pad, GstBuffer * buf); static GstFlowReturn gst_selector_pad_bufferalloc (GstPad * pad, guint64 offset, guint size, GstCaps * caps, GstBuffer ** buf); -static GType -gst_selector_pad_get_type (void) -{ - static volatile gsize selector_pad_type = 0; - static const GTypeInfo selector_pad_info = { - sizeof (GstSelectorPadClass), - NULL, - NULL, - (GClassInitFunc) gst_selector_pad_class_init, - NULL, - NULL, - sizeof (GstSelectorPad), - 0, - (GInstanceInitFunc) gst_selector_pad_init, - }; - - if (g_once_init_enter (&selector_pad_type)) { - GType tmp = g_type_register_static (GST_TYPE_PAD, "GstSelectorPad", - &selector_pad_info, 0); - g_once_init_leave (&selector_pad_type, tmp); - } - - return (GType) selector_pad_type; -} +G_DEFINE_TYPE (GstSelectorPad, gst_selector_pad, GST_TYPE_PAD); static void gst_selector_pad_class_init (GstSelectorPadClass * klass) @@ -215,8 +189,6 @@ gst_selector_pad_class_init (GstSelectorPadClass * klass) gobject_class = (GObjectClass *) klass; - selector_pad_parent_class = g_type_class_peek_parent (klass); - gobject_class->finalize = gst_selector_pad_finalize; gobject_class->get_property = gst_selector_pad_get_property; @@ -258,7 +230,7 @@ gst_selector_pad_finalize (GObject * object) if (pad->tags) gst_tag_list_free (pad->tags); - G_OBJECT_CLASS (selector_pad_parent_class)->finalize (object); + G_OBJECT_CLASS (gst_selector_pad_parent_class)->finalize (object); } static void @@ -855,28 +827,12 @@ gst_input_selector_marshal_VOID__OBJECT_INT64_INT64 (GClosure * closure, g_marshal_value_peek_int64 (param_values + 3), data2); } -#define _do_init(bla) \ +#define _do_init \ GST_DEBUG_CATEGORY_INIT (input_selector_debug, \ "input-selector", 0, "An input stream selector element"); - -GST_BOILERPLATE_FULL (GstInputSelector, gst_input_selector, GstElement, - GST_TYPE_ELEMENT, _do_init); - -static void -gst_input_selector_base_init (gpointer g_class) -{ - GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); - - gst_element_class_set_details_simple (element_class, "Input selector", - "Generic", "N-to-1 input stream selector", - "Julien Moutte , " - "Jan Schmidt , " - "Wim Taymans "); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&gst_input_selector_sink_factory)); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&gst_input_selector_src_factory)); -} +#define gst_input_selector_parent_class parent_class +G_DEFINE_TYPE_WITH_CODE (GstInputSelector, gst_input_selector, GST_TYPE_ELEMENT, + _do_init); static void gst_input_selector_class_init (GstInputSelectorClass * klass) @@ -964,6 +920,16 @@ gst_input_selector_class_init (GstInputSelectorClass * klass) NULL, NULL, gst_input_selector_marshal_VOID__OBJECT_INT64_INT64, G_TYPE_NONE, 3, GST_TYPE_PAD, G_TYPE_INT64, G_TYPE_INT64); + gst_element_class_set_details_simple (gstelement_class, "Input selector", + "Generic", "N-to-1 input stream selector", + "Julien Moutte , " + "Jan Schmidt , " + "Wim Taymans "); + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&gst_input_selector_sink_factory)); + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&gst_input_selector_src_factory)); + gstelement_class->request_new_pad = gst_input_selector_request_new_pad; gstelement_class->release_pad = gst_input_selector_release_pad; gstelement_class->change_state = gst_input_selector_change_state; @@ -974,8 +940,7 @@ gst_input_selector_class_init (GstInputSelectorClass * klass) } static void -gst_input_selector_init (GstInputSelector * sel, - GstInputSelectorClass * g_class) +gst_input_selector_init (GstInputSelector * sel) { sel->srcpad = gst_pad_new ("src", GST_PAD_SRC); gst_pad_set_iterate_internal_links_function (sel->srcpad, diff --git a/plugins/elements/gstmultiqueue.c b/plugins/elements/gstmultiqueue.c index da9ea11388..eee31027e5 100644 --- a/plugins/elements/gstmultiqueue.c +++ b/plugins/elements/gstmultiqueue.c @@ -262,28 +262,14 @@ static GstStateChangeReturn gst_multi_queue_change_state (GstElement * static void gst_multi_queue_loop (GstPad * pad); -#define _do_init(bla) \ +#define _do_init \ GST_DEBUG_CATEGORY_INIT (multi_queue_debug, "multiqueue", 0, "multiqueue element"); - -GST_BOILERPLATE_FULL (GstMultiQueue, gst_multi_queue, GstElement, - GST_TYPE_ELEMENT, _do_init); +#define gst_multi_queue_parent_class parent_class +G_DEFINE_TYPE_WITH_CODE (GstMultiQueue, gst_multi_queue, GST_TYPE_ELEMENT, + _do_init); static guint gst_multi_queue_signals[LAST_SIGNAL] = { 0 }; -static void -gst_multi_queue_base_init (gpointer g_class) -{ - GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); - - gst_element_class_set_details_simple (gstelement_class, - "MultiQueue", - "Generic", "Multiple data queue", "Edward Hervey "); - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&sinktemplate)); - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&srctemplate)); -} - static void gst_multi_queue_class_init (GstMultiQueueClass * klass) { @@ -399,6 +385,14 @@ gst_multi_queue_class_init (GstMultiQueueClass * klass) gobject_class->finalize = gst_multi_queue_finalize; + gst_element_class_set_details_simple (gstelement_class, + "MultiQueue", + "Generic", "Multiple data queue", "Edward Hervey "); + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&sinktemplate)); + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&srctemplate)); + gstelement_class->request_new_pad = GST_DEBUG_FUNCPTR (gst_multi_queue_request_new_pad); gstelement_class->release_pad = @@ -408,7 +402,7 @@ gst_multi_queue_class_init (GstMultiQueueClass * klass) } static void -gst_multi_queue_init (GstMultiQueue * mqueue, GstMultiQueueClass * klass) +gst_multi_queue_init (GstMultiQueue * mqueue) { mqueue->nbqueues = 0; mqueue->queues = NULL; diff --git a/plugins/elements/gstoutputselector.c b/plugins/elements/gstoutputselector.c index f3ce6e295d..669be3c568 100644 --- a/plugins/elements/gstoutputselector.c +++ b/plugins/elements/gstoutputselector.c @@ -86,11 +86,11 @@ enum #define DEFAULT_PAD_NEGOTIATION_MODE GST_OUTPUT_SELECTOR_PAD_NEGOTIATION_MODE_ALL -#define _do_init(bla) \ +#define _do_init \ GST_DEBUG_CATEGORY_INIT (output_selector_debug, \ "output-selector", 0, "Output stream selector"); - -GST_BOILERPLATE_FULL (GstOutputSelector, gst_output_selector, GstElement, +#define gst_output_selector_parent_class parent_class +G_DEFINE_TYPE_WITH_CODE (GstOutputSelector, gst_output_selector, GST_TYPE_ELEMENT, _do_init); static void gst_output_selector_dispose (GObject * object); @@ -112,20 +112,6 @@ static gboolean gst_output_selector_handle_sink_event (GstPad * pad, static void gst_output_selector_switch_pad_negotiation_mode (GstOutputSelector * sel, gint mode); -static void -gst_output_selector_base_init (gpointer g_class) -{ - GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); - - gst_element_class_set_details_simple (element_class, "Output selector", - "Generic", "1-to-N output stream selector", - "Stefan Kost "); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&gst_output_selector_sink_factory)); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&gst_output_selector_src_factory)); -} - static void gst_output_selector_class_init (GstOutputSelectorClass * klass) { @@ -152,6 +138,14 @@ gst_output_selector_class_init (GstOutputSelectorClass * klass) DEFAULT_PAD_NEGOTIATION_MODE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + gst_element_class_set_details_simple (gstelement_class, "Output selector", + "Generic", "1-to-N output stream selector", + "Stefan Kost "); + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&gst_output_selector_sink_factory)); + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&gst_output_selector_src_factory)); + gstelement_class->request_new_pad = GST_DEBUG_FUNCPTR (gst_output_selector_request_new_pad); gstelement_class->release_pad = @@ -161,8 +155,7 @@ gst_output_selector_class_init (GstOutputSelectorClass * klass) } static void -gst_output_selector_init (GstOutputSelector * sel, - GstOutputSelectorClass * g_class) +gst_output_selector_init (GstOutputSelector * sel) { sel->sinkpad = gst_pad_new_from_static_template (&gst_output_selector_sink_factory, diff --git a/plugins/elements/gstqueue.c b/plugins/elements/gstqueue.c index 7e578bcf25..23a2bc6551 100644 --- a/plugins/elements/gstqueue.c +++ b/plugins/elements/gstqueue.c @@ -178,13 +178,12 @@ enum } \ } G_STMT_END -#define _do_init(bla) \ +#define _do_init \ GST_DEBUG_CATEGORY_INIT (queue_debug, "queue", 0, "queue element"); \ GST_DEBUG_CATEGORY_INIT (queue_dataflow, "queue_dataflow", 0, \ "dataflow inside the queue element"); - -GST_BOILERPLATE_FULL (GstQueue, gst_queue, GstElement, - GST_TYPE_ELEMENT, _do_init); +#define gst_queue_parent_class parent_class +G_DEFINE_TYPE_WITH_CODE (GstQueue, gst_queue, GST_TYPE_ELEMENT, _do_init); static void gst_queue_finalize (GObject * object); @@ -238,24 +237,11 @@ queue_leaky_get_type (void) static guint gst_queue_signals[LAST_SIGNAL] = { 0 }; -static void -gst_queue_base_init (gpointer g_class) -{ - GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); - - gst_element_class_set_details_simple (gstelement_class, - "Queue", - "Generic", "Simple data queue", "Erik Walthinsen "); - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&srctemplate)); - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&sinktemplate)); -} - static void gst_queue_class_init (GstQueueClass * klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); + GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass); gobject_class->set_property = gst_queue_set_property; gobject_class->get_property = gst_queue_get_property; @@ -374,6 +360,14 @@ gst_queue_class_init (GstQueueClass * klass) gobject_class->finalize = gst_queue_finalize; + gst_element_class_set_details_simple (gstelement_class, + "Queue", + "Generic", "Simple data queue", "Erik Walthinsen "); + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&srctemplate)); + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&sinktemplate)); + /* Registering debug symbols for function pointers */ GST_DEBUG_REGISTER_FUNCPTR (gst_queue_chain); GST_DEBUG_REGISTER_FUNCPTR (gst_queue_sink_activate_push); @@ -389,7 +383,7 @@ gst_queue_class_init (GstQueueClass * klass) } static void -gst_queue_init (GstQueue * queue, GstQueueClass * g_class) +gst_queue_init (GstQueue * queue) { queue->sinkpad = gst_pad_new_from_static_template (&sinktemplate, "sink"); diff --git a/plugins/elements/gstqueue2.c b/plugins/elements/gstqueue2.c index dfbc0da231..e189361d1c 100644 --- a/plugins/elements/gstqueue2.c +++ b/plugins/elements/gstqueue2.c @@ -209,13 +209,12 @@ enum } \ } G_STMT_END -#define _do_init(bla) \ +#define _do_init \ GST_DEBUG_CATEGORY_INIT (queue_debug, "queue2", 0, "queue element"); \ GST_DEBUG_CATEGORY_INIT (queue_dataflow, "queue2_dataflow", 0, \ "dataflow inside the queue element"); - -GST_BOILERPLATE_FULL (GstQueue2, gst_queue2, GstElement, GST_TYPE_ELEMENT, - _do_init); +#define gst_queue2_parent_class parent_class +G_DEFINE_TYPE_WITH_CODE (GstQueue2, gst_queue2, GST_TYPE_ELEMENT, _do_init); static void gst_queue2_finalize (GObject * object); @@ -255,26 +254,8 @@ static gboolean gst_queue2_is_filled (GstQueue2 * queue); static void update_cur_level (GstQueue2 * queue, GstQueue2Range * range); - /* static guint gst_queue2_signals[LAST_SIGNAL] = { 0 }; */ -static void -gst_queue2_base_init (gpointer g_class) -{ - GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); - - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&srctemplate)); - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&sinktemplate)); - - gst_element_class_set_details_simple (gstelement_class, "Queue 2", - "Generic", - "Simple data queue", - "Erik Walthinsen , " - "Wim Taymans "); -} - static void gst_queue2_class_init (GstQueue2Class * klass) { @@ -375,12 +356,23 @@ gst_queue2_class_init (GstQueue2Class * klass) /* set several parent class virtual functions */ gobject_class->finalize = gst_queue2_finalize; + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&srctemplate)); + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&sinktemplate)); + + gst_element_class_set_details_simple (gstelement_class, "Queue 2", + "Generic", + "Simple data queue", + "Erik Walthinsen , " + "Wim Taymans "); + gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_queue2_change_state); gstelement_class->query = GST_DEBUG_FUNCPTR (gst_queue2_handle_query); } static void -gst_queue2_init (GstQueue2 * queue, GstQueue2Class * g_class) +gst_queue2_init (GstQueue2 * queue) { queue->sinkpad = gst_pad_new_from_static_template (&sinktemplate, "sink"); diff --git a/plugins/elements/gsttee.c b/plugins/elements/gsttee.c index f1699b093d..88921184f0 100644 --- a/plugins/elements/gsttee.c +++ b/plugins/elements/gsttee.c @@ -105,14 +105,15 @@ static GstStaticPadTemplate tee_src_template = GST_STATIC_PAD_TEMPLATE ("src%d", GST_PAD_REQUEST, GST_STATIC_CAPS_ANY); -#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); - /* structure and quark to keep track of which pads have been pushed */ static GQuark push_data; +#define _do_init \ + GST_DEBUG_CATEGORY_INIT (gst_tee_debug, "tee", 0, "tee element"); \ + push_data = g_quark_from_static_string ("tee-push-data"); +#define gst_tee_parent_class parent_class +G_DEFINE_TYPE_WITH_CODE (GstTee, gst_tee, GST_TYPE_ELEMENT, _do_init); + static GParamSpec *pspec_last_message = NULL; static GParamSpec *pspec_alloc_pad = NULL; @@ -145,25 +146,6 @@ static gboolean gst_tee_src_activate_pull (GstPad * pad, gboolean active); static GstFlowReturn gst_tee_src_get_range (GstPad * pad, guint64 offset, guint length, GstBuffer ** buf); - -static void -gst_tee_base_init (gpointer g_class) -{ - GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); - - gst_element_class_set_details_simple (gstelement_class, - "Tee pipe fitting", - "Generic", - "1-to-N pipe fitting", - "Erik Walthinsen , " "Wim Taymans "); - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&sinktemplate)); - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&tee_src_template)); - - push_data = g_quark_from_static_string ("tee-push-data"); -} - static void gst_tee_dispose (GObject * object) { @@ -242,13 +224,23 @@ gst_tee_class_init (GstTeeClass * klass) g_object_class_install_property (gobject_class, PROP_ALLOC_PAD, pspec_alloc_pad); + gst_element_class_set_details_simple (gstelement_class, + "Tee pipe fitting", + "Generic", + "1-to-N pipe fitting", + "Erik Walthinsen , " "Wim Taymans "); + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&sinktemplate)); + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&tee_src_template)); + gstelement_class->request_new_pad = GST_DEBUG_FUNCPTR (gst_tee_request_new_pad); gstelement_class->release_pad = GST_DEBUG_FUNCPTR (gst_tee_release_pad); } static void -gst_tee_init (GstTee * tee, GstTeeClass * g_class) +gst_tee_init (GstTee * tee) { tee->dyn_lock = g_mutex_new (); diff --git a/plugins/elements/gsttypefindelement.c b/plugins/elements/gsttypefindelement.c index a671005ec9..cc542af2b2 100644 --- a/plugins/elements/gsttypefindelement.c +++ b/plugins/elements/gsttypefindelement.c @@ -123,11 +123,11 @@ enum }; -#define _do_init(bla) \ +#define _do_init \ 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, +#define gst_type_find_element_parent_class parent_class +G_DEFINE_TYPE_WITH_CODE (GstTypeFindElement, gst_type_find_element, GST_TYPE_ELEMENT, _do_init); static void gst_type_find_element_dispose (GObject * object); @@ -189,22 +189,6 @@ gst_type_find_element_have_type (GstTypeFindElement * typefind, gst_caps_unref (copy); } -static void -gst_type_find_element_base_init (gpointer g_class) -{ - GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); - - gst_element_class_set_details_simple (gstelement_class, - "TypeFind", - "Generic", - "Finds the media type of a stream", - "Benjamin Otte "); - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&type_find_element_src_template)); - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&type_find_element_sink_template)); -} - static void gst_type_find_element_class_init (GstTypeFindElementClass * typefind_class) { @@ -251,13 +235,22 @@ gst_type_find_element_class_init (GstTypeFindElementClass * typefind_class) typefind_class->have_type = GST_DEBUG_FUNCPTR (gst_type_find_element_have_type); + gst_element_class_set_details_simple (gstelement_class, + "TypeFind", + "Generic", + "Finds the media type of a stream", + "Benjamin Otte "); + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&type_find_element_src_template)); + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&type_find_element_sink_template)); + gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_type_find_element_change_state); } static void -gst_type_find_element_init (GstTypeFindElement * typefind, - GstTypeFindElementClass * g_class) +gst_type_find_element_init (GstTypeFindElement * typefind) { /* sinkpad */ typefind->sink = diff --git a/plugins/elements/gstvalve.c b/plugins/elements/gstvalve.c index d90f459292..d8ef3c438f 100644 --- a/plugins/elements/gstvalve.c +++ b/plugins/elements/gstvalve.c @@ -78,33 +78,19 @@ static GstFlowReturn gst_valve_buffer_alloc (GstPad * pad, guint64 offset, static GstFlowReturn gst_valve_chain (GstPad * pad, GstBuffer * buffer); static GstCaps *gst_valve_getcaps (GstPad * pad); -#define _do_init(bla) \ +#define _do_init \ GST_DEBUG_CATEGORY_INIT (valve_debug, "valve", 0, "Valve"); - -GST_BOILERPLATE_FULL (GstValve, gst_valve, GstElement, - GST_TYPE_ELEMENT, _do_init); - -static void -gst_valve_base_init (gpointer klass) -{ - GstElementClass *element_class = GST_ELEMENT_CLASS (klass); - - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&srctemplate)); - gst_element_class_add_pad_template (element_class, - gst_static_pad_template_get (&sinktemplate)); - - gst_element_class_set_details_simple (element_class, "Valve element", - "Filter", "Drops buffers and events or lets them through", - "Olivier Crete "); -} +#define gst_valve_parent_class parent_class +G_DEFINE_TYPE_WITH_CODE (GstValve, gst_valve, GST_TYPE_ELEMENT, _do_init); static void gst_valve_class_init (GstValveClass * klass) { GObjectClass *gobject_class; + GstElementClass *gstelement_class; gobject_class = (GObjectClass *) klass; + gstelement_class = (GstElementClass *) (klass); gobject_class->set_property = gst_valve_set_property; gobject_class->get_property = gst_valve_get_property; @@ -113,10 +99,19 @@ gst_valve_class_init (GstValveClass * klass) g_param_spec_boolean ("drop", "Drop buffers and events", "Whether to drop buffers and events or let them through", DEFAULT_DROP, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&srctemplate)); + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&sinktemplate)); + + gst_element_class_set_details_simple (gstelement_class, "Valve element", + "Filter", "Drops buffers and events or lets them through", + "Olivier Crete "); } static void -gst_valve_init (GstValve * valve, GstValveClass * klass) +gst_valve_init (GstValve * valve) { valve->drop = FALSE; valve->discont = FALSE;