mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
tests: Use G_DEFINE_TYPE instead of GST_BOILERPLATE
This commit is contained in:
parent
1cff66d587
commit
355dbdfa7e
5 changed files with 27 additions and 66 deletions
|
@ -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 */
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
@ -42,11 +42,6 @@ static void
|
|||
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)
|
||||
{
|
||||
|
@ -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 */
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -480,25 +480,13 @@ 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)
|
||||
{
|
||||
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue