From 55d6032d539354ed87077187c3accebbbbea9a5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Fri, 21 Dec 2007 21:17:32 +0000 Subject: [PATCH] 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). --- ChangeLog | 8 ++++++ tests/check/libs/controller.c | 42 +++++++--------------------- tests/check/libs/typefindhelper.c | 29 ++++++------------- tests/check/pipelines/parse-launch.c | 24 +++++----------- 4 files changed, 34 insertions(+), 69 deletions(-) diff --git a/ChangeLog b/ChangeLog index 41d8d57bf0..af92fe5bdd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2007-12-21 Tim-Philipp Müller + + * 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 * gst/gsttypefind.c: (gst_type_find_register): diff --git a/tests/check/libs/controller.c b/tests/check/libs/controller.c index 36de8e1f33..f89ed4783c 100644 --- a/tests/check/libs/controller.c +++ b/tests/check/libs/controller.c @@ -68,7 +68,7 @@ struct _GstTestMonoSourceClass GstElementClass parent_class; }; -GType gst_test_mono_source_get_type (void); +static GType gst_test_mono_source_get_type (void); static void 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); } -GType +static GType gst_test_mono_source_get_type (void) { static GType type = 0; @@ -212,42 +212,20 @@ gst_test_mono_source_get_type (void) return type; } +/* so we don't have to paste the gst_element_register into 50 places below */ 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, - GST_TYPE_TEST_MONO_SOURCE); - return res; + fail_unless (gst_element_register (NULL, "testmonosource", GST_RANK_NONE, + GST_TYPE_TEST_MONO_SOURCE)); + + return TRUE; } -GST_PLUGIN_DEFINE_STATIC (GST_VERSION_MAJOR, - GST_VERSION_MINOR, - "gst-test", - "controller test plugin - several unit test support elements", - plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN); +#define gst_controller_init(a,b) local_gst_controller_init(a,b) -/* -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 */ /* double init should not harm */ GST_START_TEST (controller_init) diff --git a/tests/check/libs/typefindhelper.c b/tests/check/libs/typefindhelper.c index 29e5447e01..f23822b703 100644 --- a/tests/check/libs/typefindhelper.c +++ b/tests/check/libs/typefindhelper.c @@ -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 }; +static void foobar_typefind (GstTypeFind * tf, gpointer unused); + static GstStaticCaps foobar_caps = GST_STATIC_CAPS ("foo/x-bar"); #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 */ GST_START_TEST (test_buffer_range) { + static gchar *foobar_exts[] = { "foobar", NULL }; + GstStructure *s; GstBuffer *buf; 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 (); fail_unless (buf != NULL); GST_BUFFER_DATA (buf) = (guint8 *) vorbisid; @@ -65,7 +73,7 @@ GST_START_TEST (test_buffer_range) GST_END_TEST; -Suite * +static Suite * gst_typefindhelper_suite (void) { 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); } - -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) diff --git a/tests/check/pipelines/parse-launch.c b/tests/check/pipelines/parse-launch.c index 8b9a97c7f6..e90e051119 100644 --- a/tests/check/pipelines/parse-launch.c +++ b/tests/check/pipelines/parse-launch.c @@ -30,6 +30,9 @@ #include +#define GST_TYPE_PARSE_TEST_ELEMENT (gst_parse_test_element_get_type()) +static GType gst_parse_test_element_get_type (void); + static GstElement * 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) { + 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 * 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 @@ -444,8 +450,6 @@ GST_START_TEST (delayed_link) GST_END_TEST; -#define GST_TYPE_PARSE_TEST_ELEMENT (gst_parse_test_element_get_type()) - typedef struct _GstParseTestElement { GstBin parent; @@ -532,21 +536,7 @@ gst_parse_test_element_change_state (GstElement * element, return GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); } -static gboolean -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 * +static Suite * parse_suite (void) { Suite *s = suite_create ("Parse Launch syntax");