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>
+
* gst/gsttypefind.c: (gst_type_find_register):
Make gst_type_find_register work for static typefind functions,
ie. allow passing plugin == NULL (prerequisite for #498924).
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,
gst_element_class_set_details (element_class, &details);
}
-GType
+static GType
gst_test_mono_source_get_type (void)
{
static GType type = 0;
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)
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))
/* 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;
GST_END_TEST;
-Suite *
+static Suite *
gst_typefindhelper_suite (void)
{
Suite *s = suite_create ("typefindhelper");
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)
#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 *
setup_pipeline (const gchar * pipe_descr)
{
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
GST_END_TEST;
-#define GST_TYPE_PARSE_TEST_ELEMENT (gst_parse_test_element_get_type())
-
typedef struct _GstParseTestElement
{
GstBin parent;
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");