mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 01:00:37 +00:00
dash: Add test for parsing a moof box
https://bugzilla.gnome.org/show_bug.cgi?id=741104
This commit is contained in:
parent
e3805e4a96
commit
6dbfb1133c
3 changed files with 193 additions and 1 deletions
|
@ -300,7 +300,7 @@ check_PROGRAMS = \
|
|||
$(check_player) \
|
||||
$(EXPERIMENTAL_CHECKS)
|
||||
|
||||
noinst_HEADERS = elements/mxfdemux.h
|
||||
noinst_HEADERS = elements/mxfdemux.h elements/dash_isoff.h
|
||||
|
||||
TESTS = $(check_PROGRAMS)
|
||||
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
#include <gst/check/gstcheck.h>
|
||||
#include <gst/base/base.h>
|
||||
|
||||
#include "dash_isoff.h"
|
||||
|
||||
GST_START_TEST (dash_isoff_box_header_minimal)
|
||||
{
|
||||
/* INDENT-OFF */
|
||||
|
@ -108,11 +110,84 @@ GST_START_TEST (dash_isoff_box_header_uuid_type_long_size)
|
|||
|
||||
GST_END_TEST;
|
||||
|
||||
GST_START_TEST (dash_isoff_moof_parse)
|
||||
{
|
||||
/* INDENT-ON */
|
||||
GstByteReader reader = GST_BYTE_READER_INIT (moof1, sizeof (moof1));
|
||||
guint32 type;
|
||||
guint8 extended_type[16];
|
||||
guint header_size;
|
||||
guint64 size;
|
||||
GstMoofBox *moof;
|
||||
GstTrafBox *traf;
|
||||
GstTrunBox *trun;
|
||||
guint i;
|
||||
|
||||
fail_unless (gst_isoff_parse_box_header (&reader, &type, extended_type,
|
||||
&header_size, &size));
|
||||
fail_unless (type == GST_MAKE_FOURCC ('m', 'o', 'o', 'f'));
|
||||
fail_unless_equals_int (header_size, 8);
|
||||
fail_unless_equals_uint64 (size, sizeof (moof1));
|
||||
|
||||
moof = gst_isoff_moof_box_parse (&reader);
|
||||
fail_unless (moof != NULL);
|
||||
|
||||
fail_unless_equals_int (moof->mfhd.sequence_number, 1);
|
||||
fail_unless_equals_int (moof->traf->len, 1);
|
||||
|
||||
traf = &g_array_index (moof->traf, GstTrafBox, 0);
|
||||
fail_unless_equals_int (traf->tfhd.version, 0);
|
||||
fail_unless_equals_int (traf->tfhd.flags,
|
||||
GST_TFHD_FLAGS_DEFAULT_SAMPLE_DURATION_PRESENT);
|
||||
fail_unless_equals_int (traf->tfhd.track_id, 1);
|
||||
fail_unless_equals_uint64 (traf->tfhd.base_data_offset, 0);
|
||||
fail_unless_equals_int (traf->tfhd.sample_description_index, 0);
|
||||
fail_unless_equals_int (traf->tfhd.default_sample_duration, 8);
|
||||
fail_unless_equals_int (traf->tfhd.default_sample_size, 0);
|
||||
fail_unless_equals_int (traf->tfhd.default_sample_flags, 0);
|
||||
|
||||
fail_unless_equals_int (traf->trun->len, 1);
|
||||
trun = &g_array_index (traf->trun, GstTrunBox, 0);
|
||||
|
||||
fail_unless_equals_int (trun->version, 1);
|
||||
fail_unless_equals_int (trun->flags,
|
||||
GST_TRUN_FLAGS_SAMPLE_COMPOSITION_TIME_OFFSETS_PRESENT |
|
||||
GST_TRUN_FLAGS_SAMPLE_FLAGS_PRESENT | GST_TRUN_FLAGS_SAMPLE_SIZE_PRESENT |
|
||||
GST_TRUN_FLAGS_DATA_OFFSET_PRESENT);
|
||||
fail_unless_equals_int (trun->sample_count, 96);
|
||||
fail_unless_equals_int (trun->data_offset, size + header_size);
|
||||
fail_unless_equals_int (trun->first_sample_flags, 0);
|
||||
|
||||
fail_unless_equals_int (trun->samples->len, 96);
|
||||
|
||||
for (i = 0; i < 96; i++) {
|
||||
GstTrunSample *sample = &g_array_index (trun->samples, GstTrunSample, i);
|
||||
|
||||
fail_unless_equals_int (sample->sample_duration, 0);
|
||||
if (i == 0) {
|
||||
/* sample_depends_on = 2 => I-frame */
|
||||
/* sample_is_non_sync_sample = 0 */
|
||||
fail_unless_equals_int (sample->sample_flags, 0x02000000);
|
||||
} else {
|
||||
/* sample_depends_on = 1 => non-I-frame */
|
||||
/* sample_is_non_sync_sample = 1 */
|
||||
fail_unless_equals_int (sample->sample_flags, 0x01010000);
|
||||
}
|
||||
|
||||
/* sample size and CTO is changing for each sample */
|
||||
}
|
||||
|
||||
gst_isoff_moof_box_free (moof);
|
||||
}
|
||||
|
||||
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 *tc_moof = tcase_create ("moof");
|
||||
|
||||
tcase_add_test (tc_isoff_box, dash_isoff_box_header_minimal);
|
||||
tcase_add_test (tc_isoff_box, dash_isoff_box_header_long_size);
|
||||
|
@ -121,6 +196,10 @@ dash_isoff_suite (void)
|
|||
|
||||
suite_add_tcase (s, tc_isoff_box);
|
||||
|
||||
|
||||
tcase_add_test (tc_moof, dash_isoff_moof_parse);
|
||||
suite_add_tcase (s, tc_moof);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
|
|
113
tests/check/elements/dash_isoff.h
Normal file
113
tests/check/elements/dash_isoff.h
Normal file
|
@ -0,0 +1,113 @@
|
|||
#ifndef __DASH_ISOFF_H__
|
||||
#define __DASH_ISOFF_H__
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
static const guint8 moof1[] = {
|
||||
0x00, 0x00, 0x04, 0xdc, 0x6d, 0x6f, 0x6f, 0x66, 0x00, 0x00, 0x00, 0x10,
|
||||
0x6d, 0x66, 0x68, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
|
||||
0x00, 0x00, 0x04, 0xc4, 0x74, 0x72, 0x61, 0x66, 0x00, 0x00, 0x00, 0x14,
|
||||
0x74, 0x66, 0x68, 0x64, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01,
|
||||
0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x14, 0x74, 0x66, 0x64, 0x74,
|
||||
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x04, 0x94, 0x74, 0x72, 0x75, 0x6e, 0x01, 0x00, 0x0e, 0x01,
|
||||
0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x04, 0xe4, 0x00, 0x00, 0x00, 0xd1,
|
||||
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x29,
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x05, 0xa5,
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x09, 0x47,
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x07, 0xdd,
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x0a, 0x70,
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x06, 0xb4,
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x08, 0x92,
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d, 0x9b,
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x8f,
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Reference in a new issue