Commit 143c9a08 authored by Sebastian Dröge's avatar Sebastian Dröge
Browse files

tests: Use G_DEFINE_TYPE instead of GST_BOILERPLATE

parent 353186ae
......@@ -31,7 +31,7 @@ typedef GstElement TestInjector;
typedef GstElementClass TestInjectorClass;
GType test_injector_get_type (void);
GST_BOILERPLATE (TestInjector, test_injector, GstElement, GST_TYPE_ELEMENT);
G_DEFINE_TYPE (TestInjector, test_injector, GST_TYPE_ELEMENT);
#define INJECTOR_CAPS \
"audio/x-raw-float, " \
......@@ -58,9 +58,9 @@ static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
GST_STATIC_CAPS (INJECTOR_CAPS));
static void
test_injector_base_init (gpointer g_class)
test_injector_class_init (TestInjectorClass * klass)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&src_template));
......@@ -68,12 +68,6 @@ test_injector_base_init (gpointer g_class)
gst_static_pad_template_get (&sink_template));
}
static void
test_injector_class_init (TestInjectorClass * klass)
{
/* nothing to do here */
}
static GstFlowReturn
test_injector_chain (GstPad * pad, GstBuffer * buf)
{
......@@ -146,7 +140,7 @@ test_injector_chain (GstPad * pad, GstBuffer * buf)
}
static void
test_injector_init (TestInjector * injector, TestInjectorClass * klass)
test_injector_init (TestInjector * injector)
{
GstPad *pad;
......
......@@ -447,23 +447,8 @@ gst_red_video_src_init_type (GType type)
typedef GstPushSrc GstRedVideoSrc;
typedef GstPushSrcClass GstRedVideoSrcClass;
GST_BOILERPLATE_FULL (GstRedVideoSrc, gst_red_video_src, GstPushSrc,
GST_TYPE_PUSH_SRC, gst_red_video_src_init_type);
static void
gst_red_video_src_base_init (gpointer klass)
{
static GstStaticPadTemplate src_templ = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC, GST_PAD_ALWAYS,
GST_STATIC_CAPS ("video/x-raw-yuv, format=(fourcc)I420")
);
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&src_templ));
gst_element_class_set_details_simple (element_class,
"Red Video Src", "Source/Video", "yep", "me");
}
G_DEFINE_TYPE_WITH_CODE (GstRedVideoSrc, gst_red_video_src,
GST_TYPE_PUSH_SRC, gst_red_video_src_init_type (g_define_type_id));
static GstFlowReturn
gst_red_video_src_create (GstPushSrc * src, GstBuffer ** p_buf)
......@@ -496,12 +481,22 @@ static void
gst_red_video_src_class_init (GstRedVideoSrcClass * klass)
{
GstPushSrcClass *pushsrc_class = GST_PUSH_SRC_CLASS (klass);
static GstStaticPadTemplate src_templ = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC, GST_PAD_ALWAYS,
GST_STATIC_CAPS ("video/x-raw-yuv, format=(fourcc)I420")
);
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&src_templ));
gst_element_class_set_details_simple (element_class,
"Red Video Src", "Source/Video", "yep", "me");
pushsrc_class->create = gst_red_video_src_create;
}
static void
gst_red_video_src_init (GstRedVideoSrc * src, GstRedVideoSrcClass * klass)
gst_red_video_src_init (GstRedVideoSrc * src)
{
}
......@@ -560,23 +555,8 @@ gst_codec_src_init_type (GType type)
typedef GstPushSrc GstCodecSrc;
typedef GstPushSrcClass GstCodecSrcClass;
GST_BOILERPLATE_FULL (GstCodecSrc, gst_codec_src, GstPushSrc,
GST_TYPE_PUSH_SRC, gst_codec_src_init_type);
static void
gst_codec_src_base_init (gpointer klass)
{
static GstStaticPadTemplate src_templ = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC, GST_PAD_ALWAYS,
GST_STATIC_CAPS ("application/x-codec")
);
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&src_templ));
gst_element_class_set_details_simple (element_class,
"Codec Src", "Source/Video", "yep", "me");
}
G_DEFINE_TYPE_WITH_CODE (GstCodecSrc, gst_codec_src,
GST_TYPE_PUSH_SRC, gst_codec_src_init_type (g_define_type_id));
static GstFlowReturn
gst_codec_src_create (GstPushSrc * src, GstBuffer ** p_buf)
......@@ -602,12 +582,22 @@ static void
gst_codec_src_class_init (GstCodecSrcClass * klass)
{
GstPushSrcClass *pushsrc_class = GST_PUSH_SRC_CLASS (klass);
static GstStaticPadTemplate src_templ = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC, GST_PAD_ALWAYS,
GST_STATIC_CAPS ("application/x-codec")
);
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&src_templ));
gst_element_class_set_details_simple (element_class,
"Codec Src", "Source/Video", "yep", "me");
pushsrc_class->create = gst_codec_src_create;
}
static void
gst_codec_src_init (GstCodecSrc * src, GstCodecSrcClass * klass)
gst_codec_src_init (GstCodecSrc * src)
{
}
......
......@@ -559,23 +559,8 @@ gst_red_video_src_init_type (GType type)
typedef GstPushSrc GstRedVideoSrc;
typedef GstPushSrcClass GstRedVideoSrcClass;
GST_BOILERPLATE_FULL (GstRedVideoSrc, gst_red_video_src, GstPushSrc,
GST_TYPE_PUSH_SRC, gst_red_video_src_init_type);
static void
gst_red_video_src_base_init (gpointer klass)
{
static GstStaticPadTemplate src_templ = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC, GST_PAD_ALWAYS,
GST_STATIC_CAPS ("video/x-raw-yuv, format=(fourcc)I420")
);
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&src_templ));
gst_element_class_set_details_simple (element_class,
"Red Video Src", "Source/Video", "yep", "me");
}
G_DEFINE_TYPE_WITH_CODE (GstRedVideoSrc, gst_red_video_src,
GST_TYPE_PUSH_SRC, gst_red_video_src_init_type (g_define_type_id));
static GstFlowReturn
gst_red_video_src_create (GstPushSrc * src, GstBuffer ** p_buf)
......@@ -608,12 +593,22 @@ static void
gst_red_video_src_class_init (GstRedVideoSrcClass * klass)
{
GstPushSrcClass *pushsrc_class = GST_PUSH_SRC_CLASS (klass);
static GstStaticPadTemplate src_templ = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC, GST_PAD_ALWAYS,
GST_STATIC_CAPS ("video/x-raw-yuv, format=(fourcc)I420")
);
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&src_templ));
gst_element_class_set_details_simple (element_class,
"Red Video Src", "Source/Video", "yep", "me");
pushsrc_class->create = gst_red_video_src_create;
}
static void
gst_red_video_src_init (GstRedVideoSrc * src, GstRedVideoSrcClass * klass)
gst_red_video_src_init (GstRedVideoSrc * src)
{
}
......@@ -672,23 +667,8 @@ gst_codec_src_init_type (GType type)
typedef GstPushSrc GstCodecSrc;
typedef GstPushSrcClass GstCodecSrcClass;
GST_BOILERPLATE_FULL (GstCodecSrc, gst_codec_src, GstPushSrc,
GST_TYPE_PUSH_SRC, gst_codec_src_init_type);
static void
gst_codec_src_base_init (gpointer klass)
{
static GstStaticPadTemplate src_templ = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC, GST_PAD_ALWAYS,
GST_STATIC_CAPS ("application/x-codec")
);
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&src_templ));
gst_element_class_set_details_simple (element_class,
"Codec Src", "Source/Video", "yep", "me");
}
G_DEFINE_TYPE_WITH_CODE (GstCodecSrc, gst_codec_src,
GST_TYPE_PUSH_SRC, gst_codec_src_init_type (g_define_type_id));
static GstFlowReturn
gst_codec_src_create (GstPushSrc * src, GstBuffer ** p_buf)
......@@ -714,12 +694,22 @@ static void
gst_codec_src_class_init (GstCodecSrcClass * klass)
{
GstPushSrcClass *pushsrc_class = GST_PUSH_SRC_CLASS (klass);
static GstStaticPadTemplate src_templ = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC, GST_PAD_ALWAYS,
GST_STATIC_CAPS ("application/x-codec")
);
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&src_templ));
gst_element_class_set_details_simple (element_class,
"Codec Src", "Source/Video", "yep", "me");
pushsrc_class->create = gst_codec_src_create;
}
static void
gst_codec_src_init (GstCodecSrc * src, GstCodecSrcClass * klass)
gst_codec_src_init (GstCodecSrc * src)
{
}
......
......@@ -568,8 +568,8 @@ struct _GstTestReverseNegotiationSinkClass
GType gst_test_reverse_negotiation_sink_get_type (void);
GST_BOILERPLATE (GstTestReverseNegotiationSink,
gst_test_reverse_negotiation_sink, GstBaseSink, GST_TYPE_BASE_SINK);
G_DEFINE_TYPE (GstTestReverseNegotiationSink,
gst_test_reverse_negotiation_sink, GST_TYPE_BASE_SINK);
static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
......@@ -639,19 +639,6 @@ gst_test_reverse_negotiation_sink_render (GstBaseSink * bsink,
return GST_FLOW_OK;
}
static void
gst_test_reverse_negotiation_sink_base_init (gpointer g_class)
{
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_set_details_simple (gstelement_class,
"Test Reverse Negotiation Sink",
"Sink",
"Some test sink", "Sebastian Dröge <sebastian.droege@collabora.co.uk>");
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&sinktemplate));
}
static void
gst_test_reverse_negotiation_sink_class_init (GstTestReverseNegotiationSinkClass
* klass)
......@@ -664,6 +651,13 @@ gst_test_reverse_negotiation_sink_class_init (GstTestReverseNegotiationSinkClass
gstelement_class = GST_ELEMENT_CLASS (klass);
gstbase_sink_class = GST_BASE_SINK_CLASS (klass);
gst_element_class_set_details_simple (gstelement_class,
"Test Reverse Negotiation Sink",
"Sink",
"Some test sink", "Sebastian Dröge <sebastian.droege@collabora.co.uk>");
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&sinktemplate));
gstbase_sink_class->buffer_alloc =
GST_DEBUG_FUNCPTR (gst_test_reverse_negotiation_sink_buffer_alloc);
gstbase_sink_class->render =
......@@ -671,8 +665,7 @@ gst_test_reverse_negotiation_sink_class_init (GstTestReverseNegotiationSinkClass
}
static void
gst_test_reverse_negotiation_sink_init (GstTestReverseNegotiationSink * sink,
GstTestReverseNegotiationSinkClass * g_class)
gst_test_reverse_negotiation_sink_init (GstTestReverseNegotiationSink * sink)
{
sink->nbuffers = 0;
}
......
......@@ -183,8 +183,7 @@ struct _GstCdFooSrcClass
};
GType gst_cd_foo_src_get_type (void);
GST_BOILERPLATE (GstCdFooSrc, gst_cd_foo_src, GstCddaBaseSrc,
GST_TYPE_CDDA_BASE_SRC);
G_DEFINE_TYPE (GstCdFooSrc, gst_cd_foo_src, GST_TYPE_CDDA_BASE_SRC);
static GstBuffer *gst_cd_foo_src_read_sector (GstCddaBaseSrc * src,
gint sector);
......@@ -193,17 +192,7 @@ static gboolean gst_cd_foo_src_open (GstCddaBaseSrc * src,
static void gst_cd_foo_src_close (GstCddaBaseSrc * src);
static void
gst_cd_foo_src_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_set_details_simple (element_class,
"CD Audio (cdda) Source, FooBar", "Source/File",
"Read audio from CD", "Foo Bar <foo@bar.com>");
}
static void
gst_cd_foo_src_init (GstCdFooSrc * src, GstCdFooSrcClass * klass)
gst_cd_foo_src_init (GstCdFooSrc * src)
{
src->cur_disc = 0;
}
......@@ -212,6 +201,11 @@ static void
gst_cd_foo_src_class_init (GstCdFooSrcClass * klass)
{
GstCddaBaseSrcClass *cddabasesrc_class = GST_CDDA_BASE_SRC_CLASS (klass);
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_set_details_simple (element_class,
"CD Audio (cdda) Source, FooBar", "Source/File",
"Read audio from CD", "Foo Bar <foo@bar.com>");
cddabasesrc_class->open = gst_cd_foo_src_open;
cddabasesrc_class->close = gst_cd_foo_src_close;
......
......@@ -50,8 +50,8 @@ GType test_element_get_type (void);
static void init_interface (GType type);
static void gst_implements_interface_init (GstImplementsInterfaceClass * klass);
GST_BOILERPLATE_FULL (TestElement, test_element, GstElement, GST_TYPE_ELEMENT,
init_interface);
G_DEFINE_TYPE_WITH_CODE (TestElement, test_element, GST_TYPE_ELEMENT,
init_interface (g_define_type_id));
static void
test_element_mixer_interface_init (GstMixerClass * klass)
......@@ -78,11 +78,6 @@ init_interface (GType type)
g_type_add_interface_static (type, GST_TYPE_MIXER, &mixer_iface_info);
}
static void
test_element_base_init (gpointer klass)
{
}
static void
test_element_class_init (TestElementClass * klass)
{
......@@ -105,7 +100,7 @@ gst_implements_interface_init (GstImplementsInterfaceClass * klass)
}
static void
test_element_init (TestElement * this, TestElementClass * klass)
test_element_init (TestElement * this)
{
}
......
......@@ -58,8 +58,8 @@ static void gst_implements_interface_init (GstImplementsInterfaceClass * klass);
static void nav_send_event (GstNavigation * navigation,
GstStructure * structure);
GST_BOILERPLATE_FULL (TestElement, test_element, GstElement, GST_TYPE_ELEMENT,
init_interface);
G_DEFINE_TYPE_WITH_CODE (TestElement, test_element, GST_TYPE_ELEMENT,
init_interface (g_define_type_id));
static void
test_element_navigation_interface_init (GstNavigationInterface * klass)
......@@ -87,11 +87,6 @@ init_interface (GType type)
&navigation_iface_info);
}
static void
test_element_base_init (gpointer klass)
{
}
static void
test_element_class_init (TestElementClass * klass)
{
......@@ -114,7 +109,7 @@ gst_implements_interface_init (GstImplementsInterfaceClass * klass)
}
static void
test_element_init (TestElement * this, TestElementClass * klass)
test_element_init (TestElement * this)
{
}
......
......@@ -50,8 +50,8 @@ GType test_element_get_type (void);
static void init_interface (GType type);
GST_BOILERPLATE_FULL (TestElement, test_element, GstElement, GST_TYPE_ELEMENT,
init_interface);
G_DEFINE_TYPE_WITH_CODE (TestElement, test_element, GST_TYPE_ELEMENT,
init_interface (g_define_type_id));
static void
init_interface (GType type)
......@@ -66,18 +66,13 @@ init_interface (GType type)
&tagxmpwriter_info);
}
static void
test_element_base_init (gpointer klass)
{
}
static void
test_element_class_init (TestElementClass * klass)
{
}
static void
test_element_init (TestElement * this, TestElementClass * klass)
test_element_init (TestElement * this)
{
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment