diff options
author | WeiChungChang <r97922153@gmail.com> | 2016-03-14 11:16:58 +0800 |
---|---|---|
committer | Thiago Santos <thiago@waltznetworks.com> | 2017-04-11 18:43:12 -0700 |
commit | d27b5367d9c9febb179aed0adf8b1cdf5b4f6434 (patch) | |
tree | 03a9508ff3510c79d5e125698b913611450c3ea8 | |
parent | 19a45fed5672167aa7363e6bdeaac26e560b5912 (diff) |
tests: dash: Create DASH MPD's segment inheritance check flowdash-wip
https://bugzilla.gnome.org/show_bug.cgi?id=763454
-rw-r--r-- | tests/check/elements/dash_mpd.c | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/tests/check/elements/dash_mpd.c b/tests/check/elements/dash_mpd.c index d074862e2..ab8865362 100644 --- a/tests/check/elements/dash_mpd.c +++ b/tests/check/elements/dash_mpd.c @@ -800,6 +800,84 @@ GST_START_TEST (dash_mpdparser_period_segmentList_segmentURL) GST_END_TEST; /* + * Test the inheritance from Period node to Representation node of SegmentTemplate attributes + * + */ +GST_START_TEST (dash_mpdparser_inherit_segmentTemplate_from_period) +{ + GstPeriodNode *periodNode; + GstAdaptationSetNode *adaptationSet; + GstRepresentationNode *representation; + + GstSegmentTemplateNode *segmentTemplate = NULL; + GstMultSegmentBaseType *multSegBaseType; + GstSegmentBaseType *segBaseType; + GstSegmentTimelineNode *segmentTimeline; + GstSNode *sNode; + + const gchar *xml = + "<?xml version=\"1.0\"?>" + "<MPD xmlns=\"urn:mpeg:dash:schema:mpd:2011\"" + " profiles=\"urn:mpeg:dash:profile:isoff-live:2011\"" + " type=\"static\"" + " mediaPresentationDuration=\"P0Y0M0DT0H5M0S\">" + " <Period start=\"PT0S\">" + " <SegmentTemplate media=\"TestMedia\"" + " initialization=\"TestInitialization\">" + " </SegmentTemplate>" + " <AdaptationSet mimeType=\"video/mp4\" codecs=\"TestCodecs\">" + " <Representation id=\"Test_Id\"" + " bandwidth=\"1000000\"" + " frameRate=\"25\"" + " width=\"320\"" + " height=\"240\">" + " <SegmentTemplate timescale=\"100\">" + " <SegmentTimeline>" + " <S t=\"0\" d=\"300\" r=\"100\"></S>" + " </SegmentTimeline>" + " </SegmentTemplate>" + " </Representation>" + " </AdaptationSet>" + " </Period></MPD>"; + + GstMpdClient *mpdclient = gst_mpd_client_new (); + + gst_mpd_parse (mpdclient, xml, (gint) strlen (xml)); + + periodNode = (GstPeriodNode *) mpdclient->mpd_node->Periods->data; + adaptationSet = (GstAdaptationSetNode *) periodNode->AdaptationSets->data; + representation = (GstRepresentationNode *) + adaptationSet->Representations->data; + + if (representation->SegmentTemplate != NULL) { + segmentTemplate = representation->SegmentTemplate; + } else if (adaptationSet->SegmentTemplate != NULL) { + segmentTemplate = adaptationSet->SegmentTemplate; + } else if (periodNode->SegmentTemplate != NULL) { + segmentTemplate = periodNode->SegmentTemplate; + } + + multSegBaseType = segmentTemplate->MultSegBaseType; + segBaseType = multSegBaseType->SegBaseType; + segmentTimeline = (GstSegmentTimelineNode *) multSegBaseType->SegmentTimeline; + sNode = (GstSNode *) g_queue_peek_head (&segmentTimeline->S); + + /*for this test case, we should insure that the segmentTemplate's media & initialization which should be inherited from period node should not be NULL*/ + assert_equals_string (segmentTemplate->media, "TestMedia"); + assert_equals_string (segmentTemplate->initialization, "TestInitialization"); + assert_equals_uint64 (segBaseType->timescale, 100); + + assert_equals_uint64 (sNode->t, 1); + assert_equals_uint64 (sNode->d, 2); + assert_equals_uint64 (sNode->r, 3); + + gst_mpd_client_free (mpdclient); +} + +GST_END_TEST; + + +/* * Test parsing Period SegmentTemplate attributes * */ @@ -5733,6 +5811,8 @@ dash_suite (void) tcase_add_test (tc_simpleMPD, dash_mpdparser_period_adaptationSet_segmentTemplate_inherit); tcase_add_test (tc_simpleMPD, + dash_mpdparser_inherit_segmentTemplate_from_period); + tcase_add_test (tc_simpleMPD, dash_mpdparser_period_adaptationSet_representation); tcase_add_test (tc_simpleMPD, dash_mpdparser_period_adaptationSet_representation_representationBase); |