Commit 2c989ef3 authored by Tim-Philipp Müller's avatar Tim-Philipp Müller

tests: add small unit test for AC3 vs. JPEG typefinding issue

parent 14d14a91
......@@ -953,6 +953,7 @@ tests/examples/volume/Makefile
tests/examples/snapshot/Makefile
tests/examples/gio/Makefile
tests/examples/v4l/Makefile
tests/files/Makefile
tests/icles/Makefile
docs/Makefile
docs/design/Makefile
......
......@@ -24,4 +24,5 @@ SUBDIRS = \
DIST_SUBDIRS = \
check \
examples \
files \
icles
include $(top_srcdir)/common/check.mak
CHECK_REGISTRY = $(top_builddir)/tests/check/test-registry.reg
TEST_FILES_DIRECTORY = $(top_srcdir)/tests/files
REGISTRY_ENVIRONMENT = \
GST_REGISTRY=$(CHECK_REGISTRY)
......@@ -136,7 +137,8 @@ VALGRIND_TO_FIX = \
# these tests don't even pass
noinst_PROGRAMS = $(check_libvisual)
AM_CFLAGS = $(GST_CFLAGS) $(GST_CHECK_CFLAGS)
AM_CFLAGS = $(GST_CFLAGS) $(GST_CHECK_CFLAGS) \
-DGST_TEST_FILES_PATH="\"$(TEST_FILES_DIRECTORY)\""
LDADD = $(GST_LIBS) $(GST_CHECK_LIBS)
# valgrind testing
......
......@@ -103,7 +103,40 @@ GST_START_TEST (test_broken_flac_in_ogg)
gst_buffer_unref (buf);
gst_caps_unref (caps);
}
GST_END_TEST;
GST_START_TEST (test_jpeg_not_ac3)
{
const gchar *type;
GstBuffer *buf;
GError *err = NULL;
GstCaps *caps = NULL;
gchar *path, *data = NULL;
gsize data_len;
path = g_build_filename (GST_TEST_FILES_PATH, "partialframe.mjpeg", NULL);
GST_LOG ("reading file '%s'", path);
if (!g_file_get_contents (path, &data, &data_len, &err)) {
g_error ("error loading test file: %s", err->message);
}
buf = gst_buffer_new ();
GST_BUFFER_DATA (buf) = (guint8 *) data;
GST_BUFFER_SIZE (buf) = data_len;
GST_BUFFER_OFFSET (buf) = 0;
caps = gst_type_find_helper_for_buffer (NULL, buf, NULL);
fail_unless (caps != NULL);
GST_LOG ("Found type: %" GST_PTR_FORMAT, caps);
type = gst_structure_get_name (gst_caps_get_structure (caps, 0));
fail_unless_equals_string (type, "image/jpeg");
gst_buffer_unref (buf);
gst_caps_unref (caps);
g_free (data);
}
GST_END_TEST;
......@@ -118,6 +151,7 @@ typefindfunctions_suite (void)
tcase_add_test (tc_chain, test_quicktime_mpeg4video);
tcase_add_test (tc_chain, test_broken_flac_in_ogg);
tcase_add_test (tc_chain, test_jpeg_not_ac3);
return s;
}
......
EXTRA_DIST = \
partialframe.mjpeg
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment