summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim.muller@collabora.co.uk>2012-10-24 13:41:00 +0100
committerTim-Philipp Müller <tim.muller@collabora.co.uk>2012-10-24 13:44:07 +0100
commitcf1f4871d7e39a926a00c9b22532a31204670999 (patch)
tree89c90738647497805af3c5f0759f6665c8d332d1
parent92118c0b11abf16bb1c3728f0340bf3202a0898e (diff)
downloadgstreamer-plugins-bad-cf1f4871d7e39a926a00c9b22532a31204670999.tar.gz
tests: fix up mpg123 test a little
- dist input files - fix sample leak - simplify check for elements - only run mpg123 test if mpg123 is available and selected - fix build in uninstalled setup https://bugzilla.gnome.org/show_bug.cgi?id=686595
-rw-r--r--tests/check/Makefile.am9
-rw-r--r--tests/check/elements/.gitignore1
-rw-r--r--tests/check/elements/mpg123audiodec.c61
-rw-r--r--tests/files/Makefile.am5
4 files changed, 24 insertions, 52 deletions
diff --git a/tests/check/Makefile.am b/tests/check/Makefile.am
index f9556a6c5..d10f2a268 100644
--- a/tests/check/Makefile.am
+++ b/tests/check/Makefile.am
@@ -81,6 +81,12 @@ else
check_mpeg2enc =
endif
+if USE_MPG123
+check_mpg123 = elements/mpg123audiodec
+else
+check_mpg123 =
+endif
+
if USE_MPLEX
check_mplex = elements/mplex
else
@@ -212,7 +218,7 @@ check_PROGRAMS = \
elements/mpegtsmux \
elements/mpegvideoparse \
elements/mpeg4videoparse \
- elements/mpg123audiodec \
+ $(check_mpg123) \
elements/mxfdemux \
elements/mxfmux \
elements/id3mux \
@@ -352,6 +358,7 @@ elements_assrender_LDADD = $(GST_PLUGINS_BASE_LIBS) -lgstvideo-$(GST_API_VERSION
elements_mpegtsmux_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(AM_CFLAGS)
elements_mpegtsmux_LDADD = $(GST_PLUGINS_BASE_LIBS) -lgstvideo-$(GST_API_VERSION) $(GST_BASE_LIBS) $(LDADD)
+elements_mpg123audiodec_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(AM_CFLAGS)
elements_mpg123audiodec_LDADD = \
$(GST_PLUGINS_BASE_LIBS) $(GST_BASE_LIBS) $(GST_LIBS) $(LDADD) \
-lgstaudio-@GST_API_VERSION@ -lgstfft-@GST_API_VERSION@ -lgstapp-@GST_API_VERSION@
diff --git a/tests/check/elements/.gitignore b/tests/check/elements/.gitignore
index 573814731..b40d49ca9 100644
--- a/tests/check/elements/.gitignore
+++ b/tests/check/elements/.gitignore
@@ -30,6 +30,7 @@ mpeg2enc
mpegvideoparse
mpeg4videoparse
mpegtsmux
+mpg123audiodec
mplex
mxfdemux
mxfmux
diff --git a/tests/check/elements/mpg123audiodec.c b/tests/check/elements/mpg123audiodec.c
index fd7c620e3..57567e53c 100644
--- a/tests/check/elements/mpg123audiodec.c
+++ b/tests/check/elements/mpg123audiodec.c
@@ -313,6 +313,8 @@ run_decoding_test (GstElement * mpg123audiodec, gchar const *filename)
fail_unless_equals_int (gst_pad_push (mysrcpad, input_buffer), GST_FLOW_OK);
++num_input_buffers;
+
+ gst_sample_unref (sample);
}
num_decoded_buffers = g_list_length (buffers);
@@ -507,43 +509,22 @@ is_test_file_available (gchar const *filename)
return ret;
}
-
static Suite *
mpg123audiodec_suite (void)
{
- gboolean has_necessary_elements = TRUE;
+ GstRegistry *registry;
Suite *s = suite_create ("mpg123audiodec");
TCase *tc_chain = tcase_create ("general");
- /* check if mpegaudioparse, appsink, and filesrc elments are available */
- {
- gchar const **element;
- gchar const *elements[] = { "filesrc", "mpegaudioparse", "appsink", NULL };
-
- for (element = elements; *element != NULL; ++element) {
- GstElement *e;
- GstStateChangeReturn ret;
-
- e = gst_element_factory_make (*element, NULL);
- if (e == NULL) {
- has_necessary_elements = FALSE;
- break;
- }
-
- ret = gst_element_set_state (e, GST_STATE_READY);
- if (ret == GST_STATE_CHANGE_SUCCESS) {
- gst_element_set_state (e, GST_STATE_NULL);
- gst_object_unref (GST_OBJECT (e));
- } else {
- gst_object_unref (GST_OBJECT (e));
- has_necessary_elements = FALSE;
- break;
- }
- }
- }
+ registry = gst_registry_get ();
suite_add_tcase (s, tc_chain);
- if (has_necessary_elements) {
+ if (gst_registry_check_feature_version (registry, "filesrc",
+ GST_VERSION_MAJOR, GST_VERSION_MINOR, 0) &&
+ gst_registry_check_feature_version (registry, "mpegaudioparse",
+ GST_VERSION_MAJOR, GST_VERSION_MINOR, 0) &&
+ gst_registry_check_feature_version (registry, "appsrc",
+ GST_VERSION_MAJOR, GST_VERSION_MINOR, 0)) {
if (is_test_file_available (MP2_STREAM_FILENAME))
tcase_add_test (tc_chain, test_decode_mpeg1layer2);
if (is_test_file_available (MP3_CBR_STREAM_FILENAME))
@@ -558,24 +539,4 @@ mpg123audiodec_suite (void)
}
-int
-main (int argc, char **argv)
-{
- int nf;
- Suite *s;
- SRunner *sr;
-
- gst_check_init (&argc, &argv);
-
- s = mpg123audiodec_suite ();
- if (s == NULL)
- return 0;
-
- sr = srunner_create (s);
-
- srunner_run_all (sr, CK_NORMAL);
- nf = srunner_ntests_failed (sr);
- srunner_free (sr);
-
- return nf;
-}
+GST_CHECK_MAIN (mpg123audiodec)
diff --git a/tests/files/Makefile.am b/tests/files/Makefile.am
index 2cf379830..d46c18e91 100644
--- a/tests/files/Makefile.am
+++ b/tests/files/Makefile.am
@@ -1,2 +1,5 @@
EXTRA_DIST = \
- barcode.png
+ barcode.png \
+ cbr_stream.mp3 \
+ stream.mp2 \
+ vbr_stream.mp3