tests/check/: Don't use GST_PLUGIN_DEFINE_STATIC, it is not portable and is going to be deprecated (see #498924).

Original commit message from CVS:
* tests/check/libs/controller.c:
* tests/check/libs/typefindhelper.c:
* tests/check/pipelines/parse-launch.c:
Don't use GST_PLUGIN_DEFINE_STATIC, it is not portable and is
going to be deprecated (see #498924).
This commit is contained in:
Tim-Philipp Müller 2007-12-21 21:17:32 +00:00
parent 94029e9d71
commit 55d6032d53
4 changed files with 34 additions and 69 deletions

View file

@ -1,3 +1,11 @@
2007-12-21 Tim-Philipp Müller <tim at centricular dot net>
* tests/check/libs/controller.c:
* tests/check/libs/typefindhelper.c:
* tests/check/pipelines/parse-launch.c:
Don't use GST_PLUGIN_DEFINE_STATIC, it is not portable and is
going to be deprecated (see #498924).
2007-12-21 Tim-Philipp Müller <tim at centricular dot net> 2007-12-21 Tim-Philipp Müller <tim at centricular dot net>
* gst/gsttypefind.c: (gst_type_find_register): * gst/gsttypefind.c: (gst_type_find_register):

View file

@ -68,7 +68,7 @@ struct _GstTestMonoSourceClass
GstElementClass parent_class; GstElementClass parent_class;
}; };
GType gst_test_mono_source_get_type (void); static GType gst_test_mono_source_get_type (void);
static void static void
gst_test_mono_source_get_property (GObject * object, gst_test_mono_source_get_property (GObject * object,
@ -187,7 +187,7 @@ gst_test_mono_source_base_init (GstTestMonoSourceClass * klass)
gst_element_class_set_details (element_class, &details); gst_element_class_set_details (element_class, &details);
} }
GType static GType
gst_test_mono_source_get_type (void) gst_test_mono_source_get_type (void)
{ {
static GType type = 0; static GType type = 0;
@ -212,42 +212,20 @@ gst_test_mono_source_get_type (void)
return type; return type;
} }
/* so we don't have to paste the gst_element_register into 50 places below */
static gboolean static gboolean
plugin_init (GstPlugin * plugin) local_gst_controller_init (int *argc, char ***argv)
{ {
gboolean res = TRUE; fail_unless (gst_controller_init (argc, argv));
res &= gst_element_register (plugin, "testmonosource", GST_RANK_NONE, fail_unless (gst_element_register (NULL, "testmonosource", GST_RANK_NONE,
GST_TYPE_TEST_MONO_SOURCE); GST_TYPE_TEST_MONO_SOURCE));
return res;
return TRUE;
} }
GST_PLUGIN_DEFINE_STATIC (GST_VERSION_MAJOR, #define gst_controller_init(a,b) local_gst_controller_init(a,b)
GST_VERSION_MINOR,
"gst-test",
"controller test plugin - several unit test support elements",
plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN);
/*
static void __attribute__ ((constructor))
_gst_plugin_static_init__plugin_init (void)
{
static GstPluginDesc plugin_desc_ = {
GST_VERSION_MAJOR,
GST_VERSION_MINOR,
"gst-test",
"controller test plugin - several unit test support elements",
plugin_init,
VERSION,
GST_LICENSE,
PACKAGE,
GST_PACKAGE,
GST_ORIGIN,
GST_PADDING_INIT
};
_gst_plugin_register_static (&plugin_desc_);
}
*/
/* TESTS */ /* TESTS */
/* double init should not harm */ /* double init should not harm */
GST_START_TEST (controller_init) GST_START_TEST (controller_init)

View file

@ -33,6 +33,8 @@ static const guint8 vorbisid[30] = { 0x01, 0x76, 0x6f, 0x72, 0x62, 0x69, 0x73,
0x00, 0x03, 0xf4, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb8, 0x01 0x00, 0x03, 0xf4, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb8, 0x01
}; };
static void foobar_typefind (GstTypeFind * tf, gpointer unused);
static GstStaticCaps foobar_caps = GST_STATIC_CAPS ("foo/x-bar"); static GstStaticCaps foobar_caps = GST_STATIC_CAPS ("foo/x-bar");
#define FOOBAR_CAPS (gst_static_caps_get (&foobar_caps)) #define FOOBAR_CAPS (gst_static_caps_get (&foobar_caps))
@ -40,10 +42,16 @@ static GstStaticCaps foobar_caps = GST_STATIC_CAPS ("foo/x-bar");
/* make sure the entire data in the buffer is available for peeking */ /* make sure the entire data in the buffer is available for peeking */
GST_START_TEST (test_buffer_range) GST_START_TEST (test_buffer_range)
{ {
static gchar *foobar_exts[] = { "foobar", NULL };
GstStructure *s; GstStructure *s;
GstBuffer *buf; GstBuffer *buf;
GstCaps *caps; GstCaps *caps;
fail_unless (gst_type_find_register (NULL, "foo/x-bar",
GST_RANK_PRIMARY + 50, foobar_typefind, foobar_exts, FOOBAR_CAPS,
NULL, NULL));
buf = gst_buffer_new (); buf = gst_buffer_new ();
fail_unless (buf != NULL); fail_unless (buf != NULL);
GST_BUFFER_DATA (buf) = (guint8 *) vorbisid; GST_BUFFER_DATA (buf) = (guint8 *) vorbisid;
@ -65,7 +73,7 @@ GST_START_TEST (test_buffer_range)
GST_END_TEST; GST_END_TEST;
Suite * static Suite *
gst_typefindhelper_suite (void) gst_typefindhelper_suite (void)
{ {
Suite *s = suite_create ("typefindhelper"); Suite *s = suite_create ("typefindhelper");
@ -114,22 +122,3 @@ foobar_typefind (GstTypeFind * tf, gpointer unused)
gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, FOOBAR_CAPS); gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, FOOBAR_CAPS);
} }
static gboolean
plugin_init (GstPlugin * plugin)
{
static gchar *foobar_exts[] = { "foobar", NULL };
if (!gst_type_find_register (plugin, "foo/x-bar", GST_RANK_PRIMARY + 50,
foobar_typefind, foobar_exts, FOOBAR_CAPS, NULL, NULL)) {
return FALSE;
}
return TRUE;
}
GST_PLUGIN_DEFINE_STATIC (GST_VERSION_MAJOR,
GST_VERSION_MINOR,
"dummy typefind functions",
"dummy typefind functions",
plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)

View file

@ -30,6 +30,9 @@
#include <gst/check/gstcheck.h> #include <gst/check/gstcheck.h>
#define GST_TYPE_PARSE_TEST_ELEMENT (gst_parse_test_element_get_type())
static GType gst_parse_test_element_get_type (void);
static GstElement * static GstElement *
setup_pipeline (const gchar * pipe_descr) setup_pipeline (const gchar * pipe_descr)
{ {
@ -416,6 +419,9 @@ run_delayed_test (const gchar * pipe_str, const gchar * peer,
GST_START_TEST (delayed_link) GST_START_TEST (delayed_link)
{ {
fail_unless (gst_element_register (NULL, "parsetestelement",
GST_RANK_NONE, GST_TYPE_PARSE_TEST_ELEMENT));
/* This tests the delayed linking support in parse_launch by creating /* This tests the delayed linking support in parse_launch by creating
* a test element based on bin, which contains a fakesrc and a sometimes * a test element based on bin, which contains a fakesrc and a sometimes
* pad-template, and trying to link to a fakesink. When the bin transitions * pad-template, and trying to link to a fakesink. When the bin transitions
@ -444,8 +450,6 @@ GST_START_TEST (delayed_link)
GST_END_TEST; GST_END_TEST;
#define GST_TYPE_PARSE_TEST_ELEMENT (gst_parse_test_element_get_type())
typedef struct _GstParseTestElement typedef struct _GstParseTestElement
{ {
GstBin parent; GstBin parent;
@ -532,21 +536,7 @@ gst_parse_test_element_change_state (GstElement * element,
return GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); return GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
} }
static gboolean static Suite *
gst_register_parse_element (GstPlugin * plugin)
{
if (!gst_element_register (plugin, "parsetestelement", GST_RANK_NONE,
GST_TYPE_PARSE_TEST_ELEMENT))
return FALSE;
return TRUE;
}
GST_PLUGIN_DEFINE_STATIC (GST_VERSION_MAJOR, GST_VERSION_MINOR,
"parsetestelement", "Test element for parse launch",
gst_register_parse_element, VERSION, GST_LICENSE, GST_PACKAGE_NAME,
GST_PACKAGE_ORIGIN);
Suite *
parse_suite (void) parse_suite (void)
{ {
Suite *s = suite_create ("Parse Launch syntax"); Suite *s = suite_create ("Parse Launch syntax");