tests/check/: Don't use GST_PLUGIN_DEFINE_STATIC, it's not portable and will be deprecated in the future (see #498924).

Original commit message from CVS:
* tests/check/elements/playbin.c: (test_sink_usage_video_only_stream),
(test_suburi_error_unknowntype), (test_suburi_error_invalidfile),
(test_suburi_error_wrongproto), (test_missing_primary_decoder):
* tests/check/libs/cddabasesrc.c: (GST_START_TEST), (GST_START_TEST),
(cddabasesrc_suite):
Don't use GST_PLUGIN_DEFINE_STATIC, it's not portable and will be
deprecated in the future (see #498924).
This commit is contained in:
Tim-Philipp Müller 2007-12-21 22:46:56 +00:00
parent 032e064516
commit 5850d56021
3 changed files with 35 additions and 54 deletions

View file

@ -1,3 +1,13 @@
2007-12-21 Tim-Philipp Müller <tim at centricular dot net>
* tests/check/elements/playbin.c: (test_sink_usage_video_only_stream),
(test_suburi_error_unknowntype), (test_suburi_error_invalidfile),
(test_suburi_error_wrongproto), (test_missing_primary_decoder):
* tests/check/libs/cddabasesrc.c: (GST_START_TEST), (GST_START_TEST),
(cddabasesrc_suite):
Don't use GST_PLUGIN_DEFINE_STATIC, it's not portable and will be
deprecated in the future (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/playback/gststreamselector.c: (gst_selector_pad_event): * gst/playback/gststreamselector.c: (gst_selector_pad_event):

View file

@ -28,6 +28,9 @@
#ifndef GST_DISABLE_REGISTRY #ifndef GST_DISABLE_REGISTRY
static GType gst_red_video_src_get_type (void);
static GType gst_codec_src_get_type (void);
#define DEFINE_TEST(func) \ #define DEFINE_TEST(func) \
static void func (void); \ static void func (void); \
\ \
@ -47,6 +50,9 @@ DEFINE_TEST (test_sink_usage_video_only_stream)
GstElement *playbin, *fakevideosink, *fakeaudiosink; GstElement *playbin, *fakevideosink, *fakeaudiosink;
GstState cur_state, pending_state; GstState cur_state, pending_state;
fail_unless (gst_element_register (NULL, "redvideosrc", GST_RANK_PRIMARY,
gst_red_video_src_get_type ()));
playbin = gst_element_factory_make ("playbin", "playbin"); playbin = gst_element_factory_make ("playbin", "playbin");
fail_unless (playbin != NULL, "Failed to create playbin element"); fail_unless (playbin != NULL, "Failed to create playbin element");
@ -96,6 +102,9 @@ DEFINE_TEST (test_suburi_error_unknowntype)
{ {
GstElement *playbin, *fakesink; GstElement *playbin, *fakesink;
fail_unless (gst_element_register (NULL, "redvideosrc", GST_RANK_PRIMARY,
gst_red_video_src_get_type ()));
playbin = gst_element_factory_make ("playbin", "playbin"); playbin = gst_element_factory_make ("playbin", "playbin");
fail_unless (playbin != NULL, "Failed to create playbin element"); fail_unless (playbin != NULL, "Failed to create playbin element");
@ -127,6 +136,9 @@ DEFINE_TEST (test_suburi_error_invalidfile)
{ {
GstElement *playbin, *fakesink; GstElement *playbin, *fakesink;
fail_unless (gst_element_register (NULL, "redvideosrc", GST_RANK_PRIMARY,
gst_red_video_src_get_type ()));
playbin = gst_element_factory_make ("playbin", "playbin"); playbin = gst_element_factory_make ("playbin", "playbin");
fail_unless (playbin != NULL, "Failed to create playbin element"); fail_unless (playbin != NULL, "Failed to create playbin element");
@ -157,6 +169,9 @@ DEFINE_TEST (test_suburi_error_wrongproto)
{ {
GstElement *playbin, *fakesink; GstElement *playbin, *fakesink;
fail_unless (gst_element_register (NULL, "redvideosrc", GST_RANK_PRIMARY,
gst_red_video_src_get_type ()));
playbin = gst_element_factory_make ("playbin", "playbin"); playbin = gst_element_factory_make ("playbin", "playbin");
fail_unless (playbin != NULL, "Failed to create playbin element"); fail_unless (playbin != NULL, "Failed to create playbin element");
@ -319,6 +334,9 @@ DEFINE_TEST (test_missing_primary_decoder)
GError *err = NULL; GError *err = NULL;
GstBus *bus; GstBus *bus;
fail_unless (gst_element_register (NULL, "codecsrc", GST_RANK_PRIMARY,
gst_codec_src_get_type ()));
playbin = create_playbin ("codec://"); playbin = create_playbin ("codec://");
fail_unless_equals_int (gst_element_set_state (playbin, GST_STATE_READY), fail_unless_equals_int (gst_element_set_state (playbin, GST_STATE_READY),
@ -570,27 +588,6 @@ gst_codec_src_init (GstCodecSrc * src, GstCodecSrcClass * klass)
{ {
} }
static gboolean
plugin_init (GstPlugin * plugin)
{
if (!gst_element_register (plugin, "redvideosrc", GST_RANK_PRIMARY,
gst_red_video_src_get_type ())) {
return FALSE;
}
if (!gst_element_register (plugin, "codecsrc", GST_RANK_PRIMARY,
gst_codec_src_get_type ())) {
return FALSE;
}
return TRUE;
}
GST_PLUGIN_DEFINE_STATIC
(GST_VERSION_MAJOR,
GST_VERSION_MINOR,
"playbin-test-elements",
"static elements for the playbin unit test",
plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN);
#endif /* GST_DISABLE_REGISTRY */ #endif /* GST_DISABLE_REGISTRY */

View file

@ -270,28 +270,14 @@ gst_cd_foo_src_read_sector (GstCddaBaseSrc * cddabasesrc, gint sector)
return buf; return buf;
} }
static gboolean
plugin_init (GstPlugin * plugin)
{
if (!gst_element_register (plugin, "cdfoosrc", GST_RANK_SECONDARY,
GST_TYPE_CD_FOO_SRC))
return FALSE;
return TRUE;
}
GST_PLUGIN_DEFINE_STATIC (GST_VERSION_MAJOR,
GST_VERSION_MINOR,
"cdfoosrc",
"Read audio from CD",
plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN);
GST_START_TEST (test_discid_calculations) GST_START_TEST (test_discid_calculations)
{ {
GstElement *foosrc; GstElement *foosrc;
gint i; gint i;
fail_unless (gst_element_register (NULL, "cdfoosrc", GST_RANK_SECONDARY,
GST_TYPE_CD_FOO_SRC));
foosrc = gst_element_factory_make ("cdfoosrc", "cdfoosrc"); foosrc = gst_element_factory_make ("cdfoosrc", "cdfoosrc");
for (i = 0; i < G_N_ELEMENTS (test_discs); ++i) { for (i = 0; i < G_N_ELEMENTS (test_discs); ++i) {
@ -316,6 +302,9 @@ GST_START_TEST (test_buffer_timestamps)
GstPad *sinkpad; GstPad *sinkpad;
gint i; gint i;
fail_unless (gst_element_register (NULL, "cdfoosrc", GST_RANK_SECONDARY,
GST_TYPE_CD_FOO_SRC));
pipeline = gst_pipeline_new ("pipeline"); pipeline = gst_pipeline_new ("pipeline");
foosrc = gst_element_factory_make ("cdfoosrc", "cdfoosrc"); foosrc = gst_element_factory_make ("cdfoosrc", "cdfoosrc");
fakesink = gst_element_factory_make ("fakesink", "fakesink"); fakesink = gst_element_factory_make ("fakesink", "fakesink");
@ -372,19 +361,4 @@ cddabasesrc_suite (void)
return s; return s;
} }
int GST_CHECK_MAIN (cddabasesrc)
main (int argc, char **argv)
{
int nf;
Suite *s = cddabasesrc_suite ();
SRunner *sr = srunner_create (s);
gst_check_init (&argc, &argv);
srunner_run_all (sr, CK_NORMAL);
nf = srunner_ntests_failed (sr);
srunner_free (sr);
return nf;
}