mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 03:35:21 +00:00
dash: Add unit test for ISOBFF box header parsing
https://bugzilla.gnome.org/show_bug.cgi?id=741104
This commit is contained in:
parent
fff814bbe5
commit
e3805e4a96
2 changed files with 132 additions and 1 deletions
|
@ -41,7 +41,7 @@ check_assrender =
|
|||
endif
|
||||
|
||||
if USE_DASH
|
||||
check_dash = elements/dash_mpd
|
||||
check_dash = elements/dash_mpd elements/dash_isoff
|
||||
check_dash_demux = elements/dash_demux
|
||||
else
|
||||
check_dash =
|
||||
|
@ -465,6 +465,10 @@ elements_dash_mpd_LDADD = $(LDADD) $(LIBXML2_LIBS) \
|
|||
$(top_builddir)/gst-libs/gst/uridownloader/libgsturidownloader-@GST_API_VERSION@.la
|
||||
elements_dash_mpd_SOURCES = elements/dash_mpd.c
|
||||
|
||||
elements_dash_isoff_CFLAGS = $(AM_CFLAGS) $(GST_BASE_CFLAGS)
|
||||
elements_dash_isoff_LDADD = $(LDADD) $(GST_BASE_LIBS)
|
||||
elements_dash_isoff_SOURCES = elements/dash_isoff.c
|
||||
|
||||
elements_dash_demux_CFLAGS = $(AM_CFLAGS) $(LIBXML2_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) $(GST_PLUGINS_BAD_CFLAGS)
|
||||
elements_dash_demux_LDADD = \
|
||||
$(LDADD) $(LIBXML2_LIBS) $(GST_BASE_LIBS) \
|
||||
|
|
127
tests/check/elements/dash_isoff.c
Normal file
127
tests/check/elements/dash_isoff.c
Normal file
|
@ -0,0 +1,127 @@
|
|||
#include "../../ext/dash/gstisoff.c"
|
||||
#undef GST_CAT_DEFAULT
|
||||
|
||||
#include <gst/check/gstcheck.h>
|
||||
#include <gst/base/base.h>
|
||||
|
||||
GST_START_TEST (dash_isoff_box_header_minimal)
|
||||
{
|
||||
/* INDENT-OFF */
|
||||
static const guint8 data[] = {
|
||||
16, 32, 64, 128,
|
||||
't', 'e', 's', 't'
|
||||
};
|
||||
/* INDENT-ON */
|
||||
GstByteReader reader = GST_BYTE_READER_INIT (data, sizeof (data));
|
||||
guint32 type;
|
||||
guint8 extended_type[16];
|
||||
guint header_size;
|
||||
guint64 size;
|
||||
|
||||
fail_unless (gst_isoff_parse_box_header (&reader, &type, extended_type,
|
||||
&header_size, &size));
|
||||
fail_unless (type == GST_MAKE_FOURCC ('t', 'e', 's', 't'));
|
||||
fail_unless_equals_int (header_size, 8);
|
||||
fail_unless_equals_uint64 (size, 0x10204080);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
||||
GST_START_TEST (dash_isoff_box_header_long_size)
|
||||
{
|
||||
/* INDENT-OFF */
|
||||
static const guint8 data[] = {
|
||||
0, 0, 0, 1,
|
||||
't', 'e', 's', 't',
|
||||
1, 2, 4, 8, 16, 32, 64, 128
|
||||
};
|
||||
/* INDENT-ON */
|
||||
GstByteReader reader = GST_BYTE_READER_INIT (data, sizeof (data));
|
||||
guint32 type;
|
||||
guint8 extended_type[16];
|
||||
guint header_size;
|
||||
guint64 size;
|
||||
|
||||
fail_unless (gst_isoff_parse_box_header (&reader, &type, extended_type,
|
||||
&header_size, &size));
|
||||
fail_unless (type == GST_MAKE_FOURCC ('t', 'e', 's', 't'));
|
||||
fail_unless_equals_int (header_size, 16);
|
||||
fail_unless_equals_uint64 (size, G_GUINT64_CONSTANT (0x0102040810204080));
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
||||
GST_START_TEST (dash_isoff_box_header_uuid_type)
|
||||
{
|
||||
/* INDENT-OFF */
|
||||
static const guint8 data[] = {
|
||||
16, 32, 64, 128,
|
||||
'u', 'u', 'i', 'd',
|
||||
'a', 'b', 'c', 'd',
|
||||
'e', 'f', 'g', 'h',
|
||||
'i', 'j', 'k', 'l',
|
||||
'm', 'n', 'o', 'p'
|
||||
};
|
||||
/* INDENT-ON */
|
||||
GstByteReader reader = GST_BYTE_READER_INIT (data, sizeof (data));
|
||||
guint32 type;
|
||||
guint8 extended_type[16];
|
||||
guint header_size;
|
||||
guint64 size;
|
||||
|
||||
fail_unless (gst_isoff_parse_box_header (&reader, &type, extended_type,
|
||||
&header_size, &size));
|
||||
fail_unless (type == GST_MAKE_FOURCC ('u', 'u', 'i', 'd'));
|
||||
fail_unless_equals_int (header_size, 24);
|
||||
fail_unless_equals_uint64 (size, 0x10204080);
|
||||
fail_unless (memcmp (data + 8, extended_type, 16) == 0);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
||||
GST_START_TEST (dash_isoff_box_header_uuid_type_long_size)
|
||||
{
|
||||
/* INDENT-OFF */
|
||||
static const guint8 data[] = {
|
||||
0, 0, 0, 1,
|
||||
'u', 'u', 'i', 'd',
|
||||
1, 2, 4, 8, 16, 32, 64, 128,
|
||||
'a', 'b', 'c', 'd',
|
||||
'e', 'f', 'g', 'h',
|
||||
'i', 'j', 'k', 'l',
|
||||
'm', 'n', 'o', 'p'
|
||||
};
|
||||
/* INDENT-ON */
|
||||
GstByteReader reader = GST_BYTE_READER_INIT (data, sizeof (data));
|
||||
guint32 type;
|
||||
guint8 extended_type[16];
|
||||
guint header_size;
|
||||
guint64 size;
|
||||
|
||||
fail_unless (gst_isoff_parse_box_header (&reader, &type, extended_type,
|
||||
&header_size, &size));
|
||||
fail_unless (type == GST_MAKE_FOURCC ('u', 'u', 'i', 'd'));
|
||||
fail_unless_equals_int (header_size, 32);
|
||||
fail_unless_equals_uint64 (size, G_GUINT64_CONSTANT (0x0102040810204080));
|
||||
fail_unless (memcmp (data + 16, extended_type, 16) == 0);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
||||
static Suite *
|
||||
dash_isoff_suite (void)
|
||||
{
|
||||
Suite *s = suite_create ("dash-isoff");
|
||||
TCase *tc_isoff_box = tcase_create ("isoff-box-parsing");
|
||||
|
||||
tcase_add_test (tc_isoff_box, dash_isoff_box_header_minimal);
|
||||
tcase_add_test (tc_isoff_box, dash_isoff_box_header_long_size);
|
||||
tcase_add_test (tc_isoff_box, dash_isoff_box_header_uuid_type);
|
||||
tcase_add_test (tc_isoff_box, dash_isoff_box_header_uuid_type_long_size);
|
||||
|
||||
suite_add_tcase (s, tc_isoff_box);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
GST_CHECK_MAIN (dash_isoff);
|
Loading…
Reference in a new issue