summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiago Santos <thiagossantos@gmail.com>2017-04-15 18:17:29 -0700
committerThiago Santos <thiagossantos@gmail.com>2017-04-15 18:44:04 -0700
commit22c037df6c6511859e6dfa0c627a9e768151425e (patch)
treea8040cc7346b10504d7a23315fc671783a0011c1
parent68ac72431c3e68346ee918580bf41d7f0f90929d (diff)
downloadgstreamer-plugins-bad-22c037df6c6511859e6dfa0c627a9e768151425e.tar.gz
tests: dash_mpd: add some inheritance tests
Tests regarding inheritance of segment template attributes
-rw-r--r--tests/check/elements/dash_mpd.c141
1 files changed, 141 insertions, 0 deletions
diff --git a/tests/check/elements/dash_mpd.c b/tests/check/elements/dash_mpd.c
index d074862e2..3dc72e390 100644
--- a/tests/check/elements/dash_mpd.c
+++ b/tests/check/elements/dash_mpd.c
@@ -1980,6 +1980,141 @@ GST_START_TEST (dash_mpdparser_period_adaptationSet_segmentTemplate)
GST_END_TEST;
+GST_START_TEST
+ (dash_mpdparser_period_adaptationSet_representation_segmentTemplate_inherit)
+{
+ GstPeriodNode *periodNode;
+ GstAdaptationSetNode *adaptationSet;
+ GstRepresentationNode *representation;
+ GstSegmentTemplateNode *segmentTemplate;
+ const gchar *xml =
+ "<?xml version=\"1.0\"?>"
+ "<MPD xmlns=\"urn:mpeg:dash:schema:mpd:2011\""
+ " profiles=\"urn:mpeg:dash:profile:isoff-main:2011\">"
+ " <Period>"
+ " <SegmentTemplate media=\"ParentMedia\" duration=\"1\" "
+ " initialization=\"ParentInitialization\">"
+ " </SegmentTemplate>"
+ " <AdaptationSet>"
+ " <Representation id=\"1\" bandwidth=\"5000\">"
+ " <SegmentTemplate media=\"TestMedia\""
+ " index=\"TestIndex\""
+ " bitstreamSwitching=\"TestBitstreamSwitching\">"
+ " </SegmentTemplate></Representation></AdaptationSet></Period></MPD>";
+
+ gboolean ret;
+ GstMpdClient *mpdclient = gst_mpd_client_new ();
+
+ ret = gst_mpd_parse (mpdclient, xml, (gint) strlen (xml));
+ assert_equals_int (ret, TRUE);
+
+ periodNode = (GstPeriodNode *) mpdclient->mpd_node->Periods->data;
+ adaptationSet = (GstAdaptationSetNode *) periodNode->AdaptationSets->data;
+ representation =
+ (GstRepresentationNode *) adaptationSet->Representations->data;
+ segmentTemplate = representation->SegmentTemplate;
+ assert_equals_string (segmentTemplate->media, "TestMedia");
+ assert_equals_string (segmentTemplate->index, "TestIndex");
+ assert_equals_string (segmentTemplate->initialization,
+ "ParentInitialization");
+ assert_equals_string (segmentTemplate->bitstreamSwitching,
+ "TestBitstreamSwitching");
+
+ gst_mpd_client_free (mpdclient);
+}
+
+GST_END_TEST;
+
+GST_START_TEST
+ (dash_mpdparser_period_adaptationSet_representation_segmentBase_inherit) {
+ GstPeriodNode *periodNode;
+ GstAdaptationSetNode *adaptationSet;
+ GstRepresentationNode *representation;
+ GstSegmentBaseType *segmentBase;
+ const gchar *xml =
+ "<?xml version=\"1.0\"?>"
+ "<MPD xmlns=\"urn:mpeg:dash:schema:mpd:2011\""
+ " profiles=\"urn:mpeg:dash:profile:isoff-main:2011\">"
+ " <Period>"
+ " <SegmentBase timescale=\"123456\""
+ " presentationTimeOffset=\"123456789\""
+ " indexRange=\"100-200\""
+ " indexRangeExact=\"true\">"
+ " <Initialisation sourceURL=\"TestSourceURL\""
+ " range=\"100-200\" />"
+ " </SegmentBase>"
+ " <AdaptationSet>"
+ " <Representation id=\"1\" bandwidth=\"5000\">"
+ " <SegmentBase>"
+ " </SegmentBase></Representation></AdaptationSet></Period></MPD>";
+
+ gboolean ret;
+ GstMpdClient *mpdclient = gst_mpd_client_new ();
+
+ ret = gst_mpd_parse (mpdclient, xml, (gint) strlen (xml));
+ assert_equals_int (ret, TRUE);
+
+ periodNode = (GstPeriodNode *) mpdclient->mpd_node->Periods->data;
+ adaptationSet = (GstAdaptationSetNode *) periodNode->AdaptationSets->data;
+ representation =
+ (GstRepresentationNode *) adaptationSet->Representations->data;
+ segmentBase = representation->SegmentBase;
+ assert_equals_int (segmentBase->timescale, 123456);
+
+ gst_mpd_client_free (mpdclient);
+}
+
+GST_END_TEST;
+
+/*
+ * Test parsing Period AdaptationSet SegmentTemplate attributes with
+ * inheritance
+ */
+GST_START_TEST (dash_mpdparser_adapt_repr_segmentTemplate_inherit)
+{
+ GstPeriodNode *periodNode;
+ GstAdaptationSetNode *adaptationSet;
+ GstSegmentTemplateNode *segmentTemplate;
+ GstRepresentationNode *representation;
+ GstMultSegmentBaseType *multSegBaseType;
+ GstSegmentBaseType *segBaseType;
+ const gchar *xml =
+ "<?xml version=\"1.0\"?>"
+ "<MPD xmlns=\"urn:mpeg:dash:schema:mpd:2011\""
+ " profiles=\"urn:mpeg:dash:profile:isoff-main:2011\">"
+ " <Period duration=\"PT0H5M0.000S\">"
+ " <AdaptationSet maxWidth=\"1280\" maxHeight=\"720\" maxFrameRate=\"50\">"
+ " <SegmentTemplate initialization=\"set1_init.mp4\"/>"
+ " <Representation id=\"1\" mimeType=\"video/mp4\" codecs=\"avc1.640020\" "
+ " width=\"1280\" height=\"720\" frameRate=\"50\" bandwidth=\"30000\">"
+ " <SegmentTemplate timescale=\"12800\" media=\"track1_$Number$.m4s\" startNumber=\"1\" duration=\"25600\"/>"
+ " </Representation></AdaptationSet></Period></MPD>";
+
+ gboolean ret;
+ GstMpdClient *mpdclient = gst_mpd_client_new ();
+
+ ret = gst_mpd_parse (mpdclient, xml, (gint) strlen (xml));
+ assert_equals_int (ret, TRUE);
+
+ periodNode = (GstPeriodNode *) mpdclient->mpd_node->Periods->data;
+ adaptationSet = (GstAdaptationSetNode *) periodNode->AdaptationSets->data;
+ representation = (GstRepresentationNode *)
+ adaptationSet->Representations->data;
+ segmentTemplate = representation->SegmentTemplate;
+ fail_if (segmentTemplate == NULL);
+ multSegBaseType = segmentTemplate->MultSegBaseType;
+ segBaseType = multSegBaseType->SegBaseType;
+
+ assert_equals_uint64 (segBaseType->timescale, 12800);
+ assert_equals_uint64 (multSegBaseType->duration, 25600);
+ assert_equals_uint64 (multSegBaseType->startNumber, 1);
+ assert_equals_string (segmentTemplate->media, "track1_$Number$.m4s");
+ assert_equals_string (segmentTemplate->initialization, "set1_init.mp4");
+
+ gst_mpd_client_free (mpdclient);
+}
+
+GST_END_TEST;
/*
* Test parsing Period AdaptationSet SegmentTemplate attributes with
* inheritance
@@ -5698,6 +5833,8 @@ dash_suite (void)
tcase_add_test (tc_simpleMPD,
dash_mpdparser_period_adaptationSet_representationBase_framePacking);
tcase_add_test (tc_simpleMPD,
+ dash_mpdparser_adapt_repr_segmentTemplate_inherit);
+ tcase_add_test (tc_simpleMPD,
dash_mpdparser_period_adaptationSet_representationBase_audioChannelConfiguration);
tcase_add_test (tc_simpleMPD,
dash_mpdparser_period_adaptationSet_representationBase_contentProtection);
@@ -5748,6 +5885,10 @@ dash_suite (void)
dash_mpdparser_period_adaptationSet_representation_segmentList);
tcase_add_test (tc_simpleMPD,
dash_mpdparser_period_adaptationSet_representation_segmentTemplate);
+ tcase_add_test (tc_simpleMPD,
+ dash_mpdparser_period_adaptationSet_representation_segmentTemplate_inherit);
+ tcase_add_test (tc_simpleMPD,
+ dash_mpdparser_period_adaptationSet_representation_segmentBase_inherit);
tcase_add_test (tc_simpleMPD, dash_mpdparser_period_subset);
tcase_add_test (tc_simpleMPD, dash_mpdparser_utctiming);
tcase_add_test (tc_simpleMPD, dash_mpdparser_utctiming_invalid_value);