diff options
author | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2011-04-18 18:19:51 +0200 |
---|---|---|
committer | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2011-04-19 11:45:37 +0200 |
commit | 355dbdfa7e1e49187d5bb4034461265b24dfa61c (patch) | |
tree | 961d69ffbd836ed118f348b51ac74bd11b05df77 /tests | |
parent | 1cff66d5879a5f8ab12fb3d897ac2df21b9c9216 (diff) |
tests: Use G_DEFINE_TYPE instead of GST_BOILERPLATE
Diffstat (limited to 'tests')
-rw-r--r-- | tests/check/elements/fakesink.c | 20 | ||||
-rw-r--r-- | tests/check/gst/gstparamspecs.c | 9 | ||||
-rw-r--r-- | tests/check/gst/gsttagsetter.c | 21 | ||||
-rw-r--r-- | tests/check/libs/test_transform.c | 19 | ||||
-rw-r--r-- | tests/check/pipelines/parse-launch.c | 24 |
5 files changed, 27 insertions, 66 deletions
diff --git a/tests/check/elements/fakesink.c b/tests/check/elements/fakesink.c index dacf00eb8..7dbcd14fa 100644 --- a/tests/check/elements/fakesink.c +++ b/tests/check/elements/fakesink.c @@ -865,17 +865,7 @@ typedef GstPushSrc OOBSource; typedef GstPushSrcClass OOBSourceClass; GType oob_source_get_type (void); -GST_BOILERPLATE (OOBSource, oob_source, GstPushSrc, GST_TYPE_PUSH_SRC); - -static void -oob_source_base_init (gpointer g_class) -{ - static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("src", - GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS_ANY); - - gst_element_class_add_pad_template (GST_ELEMENT_CLASS (g_class), - gst_static_pad_template_get (&sinktemplate)); -} +G_DEFINE_TYPE (OOBSource, oob_source, GST_TYPE_PUSH_SRC); static GstFlowReturn oob_source_create (GstPushSrc * src, GstBuffer ** p_buf) @@ -891,13 +881,19 @@ oob_source_create (GstPushSrc * src, GstBuffer ** p_buf) static void oob_source_class_init (OOBSourceClass * klass) { + static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS_ANY); + GstElementClass *element_class = GST_ELEMENT_CLASS (klass); GstPushSrcClass *pushsrc_class = GST_PUSH_SRC_CLASS (klass); + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&sinktemplate)); + pushsrc_class->create = GST_DEBUG_FUNCPTR (oob_source_create); } static void -oob_source_init (OOBSource * src, OOBSourceClass * g_class) +oob_source_init (OOBSource * src) { /* nothing to do */ } diff --git a/tests/check/gst/gstparamspecs.c b/tests/check/gst/gstparamspecs.c index 545bce5a5..c6d3024b7 100644 --- a/tests/check/gst/gstparamspecs.c +++ b/tests/check/gst/gstparamspecs.c @@ -33,7 +33,7 @@ typedef struct typedef GstElementClass GstDummyObjClass; GType gst_dummy_obj_get_type (void); -GST_BOILERPLATE (GstDummyObj, gst_dummy_obj, GstElement, GST_TYPE_ELEMENT); +G_DEFINE_TYPE (GstDummyObj, gst_dummy_obj, GST_TYPE_ELEMENT); static void gst_dummy_obj_get_property (GObject * obj, guint prop_id, GValue * val, @@ -43,11 +43,6 @@ gst_dummy_obj_set_property (GObject * obj, guint prop_id, const GValue * val, GParamSpec * pspec); static void -gst_dummy_obj_base_init (gpointer g_class) -{ -} - -static void gst_dummy_obj_class_init (GstDummyObjClass * klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); @@ -71,7 +66,7 @@ gst_dummy_obj_class_init (GstDummyObjClass * klass) } static void -gst_dummy_obj_init (GstDummyObj * obj, GstDummyObjClass * klass) +gst_dummy_obj_init (GstDummyObj * obj) { /* nothing to do there */ } diff --git a/tests/check/gst/gsttagsetter.c b/tests/check/gst/gsttagsetter.c index 5802823f1..b25ea8d1f 100644 --- a/tests/check/gst/gsttagsetter.c +++ b/tests/check/gst/gsttagsetter.c @@ -27,24 +27,9 @@ typedef GstElement GstDummyEnc; typedef GstElementClass GstDummyEncClass; -static void gst_dummy_enc_add_interfaces (GType enc_type); - GType gst_dummy_enc_get_type (void); -GST_BOILERPLATE_FULL (GstDummyEnc, gst_dummy_enc, GstElement, - GST_TYPE_ELEMENT, gst_dummy_enc_add_interfaces); - -static void -gst_dummy_enc_add_interfaces (GType enc_type) -{ - static const GInterfaceInfo tag_setter_info = { NULL, NULL, NULL }; - - g_type_add_interface_static (enc_type, GST_TYPE_TAG_SETTER, &tag_setter_info); -} - -static void -gst_dummy_enc_base_init (gpointer g_class) -{ -} +G_DEFINE_TYPE_WITH_CODE (GstDummyEnc, gst_dummy_enc, + GST_TYPE_ELEMENT, G_IMPLEMENT_INTERFACE (GST_TYPE_TAG_SETTER, NULL)); static void gst_dummy_enc_class_init (GstDummyEncClass * klass) @@ -52,7 +37,7 @@ gst_dummy_enc_class_init (GstDummyEncClass * klass) } static void -gst_dummy_enc_init (GstDummyEnc * enc, GstDummyEncClass * klass) +gst_dummy_enc_init (GstDummyEnc * enc) { } diff --git a/tests/check/libs/test_transform.c b/tests/check/libs/test_transform.c index b0e611001..d3ba36393 100644 --- a/tests/check/libs/test_transform.c +++ b/tests/check/libs/test_transform.c @@ -57,8 +57,7 @@ struct _GstTestTransClass GType gst_test_trans_get_type (void); -GST_BOILERPLATE (GstTestTrans, gst_test_trans, GstBaseTransform, - GST_TYPE_BASE_TRANSFORM); +G_DEFINE_TYPE (GstTestTrans, gst_test_trans, GST_TYPE_BASE_TRANSFORM); static GstFlowReturn (*klass_transform) (GstBaseTransform * trans, GstBuffer * inbuf, GstBuffer * outbuf) = NULL; @@ -77,11 +76,13 @@ static GstStaticPadTemplate *sink_template = &gst_test_trans_sink_template; static GstStaticPadTemplate *src_template = &gst_test_trans_src_template; static void -gst_test_trans_base_init (gpointer g_class) +gst_test_trans_class_init (GstTestTransClass * klass) { GstElementClass *element_class; + GstBaseTransformClass *trans_class; - element_class = GST_ELEMENT_CLASS (g_class); + element_class = (GstElementClass *) klass; + trans_class = (GstBaseTransformClass *) klass; gst_element_class_set_details_simple (element_class, "TestTrans", "Filter/Test", "Test transform", "Wim Taymans <wim.taymans@gmail.com>"); @@ -90,14 +91,6 @@ gst_test_trans_base_init (gpointer g_class) gst_static_pad_template_get (sink_template)); gst_element_class_add_pad_template (element_class, gst_static_pad_template_get (src_template)); -} - -static void -gst_test_trans_class_init (GstTestTransClass * klass) -{ - GstBaseTransformClass *trans_class; - - trans_class = (GstBaseTransformClass *) klass; trans_class->passthrough_on_same_caps = klass_passthrough_on_same_caps; trans_class->transform_ip = klass_transform_ip; @@ -108,7 +101,7 @@ gst_test_trans_class_init (GstTestTransClass * klass) } static void -gst_test_trans_init (GstTestTrans * this, GstTestTransClass * g_class) +gst_test_trans_init (GstTestTrans * this) { } diff --git a/tests/check/pipelines/parse-launch.c b/tests/check/pipelines/parse-launch.c index 3c7fdf9f6..8dbe32fbd 100644 --- a/tests/check/pipelines/parse-launch.c +++ b/tests/check/pipelines/parse-launch.c @@ -480,26 +480,14 @@ typedef struct _GstParseTestElementClass static GstStaticPadTemplate test_element_pad_template = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_SOMETIMES, GST_STATIC_CAPS ("application/x-test-caps")); - -GST_BOILERPLATE (GstParseTestElement, gst_parse_test_element, GstBin, - GST_TYPE_BIN); +#define gst_parse_test_element_parent_class parent_class +G_DEFINE_TYPE (GstParseTestElement, gst_parse_test_element, GST_TYPE_BIN); static GstStateChangeReturn gst_parse_test_element_change_state (GstElement * element, GstStateChange transition); static void -gst_parse_test_element_base_init (gpointer g_class) -{ - GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); - - gst_element_class_set_details_simple (element_class, - "Test element for parse launch tests", "Source", - "Test element for parse launch tests in core", - "GStreamer Devel <gstreamer-devel@lists.sf.net>"); -} - -static void gst_parse_test_element_class_init (GstParseTestElementClass * klass) { GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass); @@ -507,12 +495,16 @@ gst_parse_test_element_class_init (GstParseTestElementClass * klass) gst_element_class_add_pad_template (gstelement_class, gst_static_pad_template_get (&test_element_pad_template)); + gst_element_class_set_details_simple (gstelement_class, + "Test element for parse launch tests", "Source", + "Test element for parse launch tests in core", + "GStreamer Devel <gstreamer-devel@lists.sf.net>"); + gstelement_class->change_state = gst_parse_test_element_change_state; } static void -gst_parse_test_element_init (GstParseTestElement * src, - GstParseTestElementClass * klass) +gst_parse_test_element_init (GstParseTestElement * src) { /* Create a fakesrc and add it to ourselves */ src->fakesrc = gst_element_factory_make ("fakesrc", NULL); |