gst: Use G_DEFINE_TYPE instead of GST_BOILERPLATE

This commit is contained in:
Sebastian Dröge 2011-04-19 11:35:53 +02:00 committed by Tim-Philipp Müller
parent d33dd31fc7
commit 878caef597
2 changed files with 28 additions and 41 deletions

View file

@ -62,11 +62,11 @@ GST_STATIC_PAD_TEMPLATE ("src",
GST_DEBUG_CATEGORY_STATIC (gst_gdp_depay_debug);
#define GST_CAT_DEFAULT gst_gdp_depay_debug
#define _do_init(x) \
#define _do_init \
GST_DEBUG_CATEGORY_INIT (gst_gdp_depay_debug, "gdpdepay", 0, \
"GDP depayloader");
GST_BOILERPLATE_FULL (GstGDPDepay, gst_gdp_depay, GstElement,
#define gst_gdp_depay_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstGDPDepay, gst_gdp_depay,
GST_TYPE_ELEMENT, _do_init);
static gboolean gst_gdp_depay_sink_event (GstPad * pad, GstEvent * event);
@ -79,22 +79,6 @@ static GstStateChangeReturn gst_gdp_depay_change_state (GstElement *
static void gst_gdp_depay_finalize (GObject * object);
static void
gst_gdp_depay_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_set_details_simple (element_class,
"GDP Depayloader", "GDP/Depayloader",
"Depayloads GStreamer Data Protocol buffers",
"Thomas Vander Stichele <thomas at apestaart dot org>");
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gdp_depay_sink_template));
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gdp_depay_src_template));
}
static void
gst_gdp_depay_class_init (GstGDPDepayClass * klass)
{
@ -104,13 +88,23 @@ gst_gdp_depay_class_init (GstGDPDepayClass * klass)
gobject_class = (GObjectClass *) klass;
gstelement_class = (GstElementClass *) klass;
gst_element_class_set_details_simple (gstelement_class,
"GDP Depayloader", "GDP/Depayloader",
"Depayloads GStreamer Data Protocol buffers",
"Thomas Vander Stichele <thomas at apestaart dot org>");
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&gdp_depay_sink_template));
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&gdp_depay_src_template));
gstelement_class->change_state =
GST_DEBUG_FUNCPTR (gst_gdp_depay_change_state);
gobject_class->finalize = gst_gdp_depay_finalize;
}
static void
gst_gdp_depay_init (GstGDPDepay * gdpdepay, GstGDPDepayClass * g_class)
gst_gdp_depay_init (GstGDPDepay * gdpdepay)
{
gdpdepay->sinkpad =
gst_pad_new_from_static_template (&gdp_depay_sink_template, "sink");

View file

@ -67,12 +67,11 @@ enum
PROP_VERSION,
};
#define _do_init(x) \
#define _do_init \
GST_DEBUG_CATEGORY_INIT (gst_gdp_pay_debug, "gdppay", 0, \
"GDP payloader");
GST_BOILERPLATE_FULL (GstGDPPay, gst_gdp_pay, GstElement,
GST_TYPE_ELEMENT, _do_init);
#define gst_gdp_pay_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstGDPPay, gst_gdp_pay, GST_TYPE_ELEMENT, _do_init);
static void gst_gdp_pay_reset (GstGDPPay * this);
@ -90,22 +89,6 @@ static void gst_gdp_pay_get_property (GObject * object, guint prop_id,
static void gst_gdp_pay_finalize (GObject * gobject);
static void
gst_gdp_pay_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_set_details_simple (element_class,
"GDP Payloader", "GDP/Payloader",
"Payloads GStreamer Data Protocol buffers",
"Thomas Vander Stichele <thomas at apestaart dot org>");
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gdp_pay_sink_template));
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gdp_pay_src_template));
}
static void
gst_gdp_pay_class_init (GstGDPPayClass * klass)
{
@ -133,11 +116,21 @@ gst_gdp_pay_class_init (GstGDPPayClass * klass)
GST_TYPE_DP_VERSION, DEFAULT_VERSION,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
gst_element_class_set_details_simple (gstelement_class,
"GDP Payloader", "GDP/Payloader",
"Payloads GStreamer Data Protocol buffers",
"Thomas Vander Stichele <thomas at apestaart dot org>");
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&gdp_pay_sink_template));
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&gdp_pay_src_template));
gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_gdp_pay_change_state);
}
static void
gst_gdp_pay_init (GstGDPPay * gdppay, GstGDPPayClass * g_class)
gst_gdp_pay_init (GstGDPPay * gdppay)
{
gdppay->sinkpad =
gst_pad_new_from_static_template (&gdp_pay_sink_template, "sink");