summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorFlorin Apostol <florin.apostol@oregan.net>2015-10-30 15:55:19 +0000
committerVincent Penquerc'h <vincent.penquerch@collabora.co.uk>2015-10-30 15:58:36 +0000
commitd6e805a283b36c38f9718a0ebd5089d335749888 (patch)
treee1b58c35271f5e14a0b38c08eb1e5e1283bf4e17 /tests
parentfe6adec7028dfe966423128a2940f3f5775d09d0 (diff)
downloadgstreamer-plugins-bad-d6e805a283b36c38f9718a0ebd5089d335749888.tar.gz
dashdemux: inherit bitstreamSwitching from Period to AdaptationSet
https://bugzilla.gnome.org/show_bug.cgi?id=752340
Diffstat (limited to 'tests')
-rw-r--r--tests/check/elements/dash_mpd.c111
1 files changed, 111 insertions, 0 deletions
diff --git a/tests/check/elements/dash_mpd.c b/tests/check/elements/dash_mpd.c
index 545ee97b7..b6ab30e80 100644
--- a/tests/check/elements/dash_mpd.c
+++ b/tests/check/elements/dash_mpd.c
@@ -2586,6 +2586,114 @@ GST_START_TEST (dash_mpdparser_GstDateTime)
GST_END_TEST;
/*
+ * Test bitstreamSwitching inheritance from Period to AdaptationSet
+ *
+ * Description of bistreamSwitching attribute in Period:
+ * "When set to ‘true’, this is equivalent as if the
+ * AdaptationSet@bitstreamSwitching for each Adaptation Set contained in this
+ * Period is set to 'true'. In this case, the AdaptationSet@bitstreamSwitching
+ * attribute shall not be set to 'false' for any Adaptation Set in this Period"
+ *
+ */
+GST_START_TEST (dash_mpdparser_bitstreamSwitching_inheritance)
+{
+ GList *adaptationSets;
+ GstAdaptationSetNode *adapt_set;
+ guint activeStreams;
+ GstActiveStream *activeStream;
+ GstCaps *caps;
+ GstStructure *s;
+ gboolean bitstreamSwitchingFlag;
+
+ const gchar *xml =
+ "<?xml version=\"1.0\"?>"
+ "<MPD xmlns=\"urn:mpeg:dash:schema:mpd:2011\""
+ " profiles=\"urn:mpeg:dash:profile:isoff-main:2011\">"
+ " <Period id=\"Period0\""
+ " duration=\"P0Y0M1DT1H1M1S\""
+ " bitstreamSwitching=\"true\">"
+ " <AdaptationSet id=\"1\""
+ " mimeType=\"video/mp4\">"
+ " <Representation>"
+ " </Representation>"
+ " </AdaptationSet>"
+ " <AdaptationSet id=\"2\""
+ " mimeType=\"audio\""
+ " bitstreamSwitching=\"false\">"
+ " <Representation>"
+ " </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);
+
+ /* process the xml data */
+ ret = gst_mpd_client_setup_media_presentation (mpdclient, GST_CLOCK_TIME_NONE,
+ -1, NULL);
+ assert_equals_int (ret, TRUE);
+
+ /* get the list of adaptation sets of the first period */
+ adaptationSets = gst_mpd_client_get_adaptation_sets (mpdclient);
+ fail_if (adaptationSets == NULL);
+
+ /* setup streaming from the first adaptation set */
+ adapt_set = (GstAdaptationSetNode *) g_list_nth_data (adaptationSets, 0);
+ fail_if (adapt_set == NULL);
+ ret = gst_mpd_client_setup_streaming (mpdclient, adapt_set);
+ assert_equals_int (ret, TRUE);
+
+ /* setup streaming from the second adaptation set */
+ adapt_set = (GstAdaptationSetNode *) g_list_nth_data (adaptationSets, 1);
+ fail_if (adapt_set == NULL);
+ ret = gst_mpd_client_setup_streaming (mpdclient, adapt_set);
+ assert_equals_int (ret, TRUE);
+
+ /* 2 active streams */
+ activeStreams = gst_mpdparser_get_nb_active_stream (mpdclient);
+ assert_equals_int (activeStreams, 2);
+
+ /* get details of the first active stream */
+ activeStream = gst_mpdparser_get_active_stream_by_index (mpdclient, 0);
+ fail_if (activeStream == NULL);
+
+ assert_equals_int (activeStream->mimeType, GST_STREAM_VIDEO);
+ caps = gst_mpd_client_get_stream_caps (activeStream);
+ fail_unless (caps != NULL);
+ s = gst_caps_get_structure (caps, 0);
+ assert_equals_string (gst_structure_get_name (s), "video/quicktime");
+ gst_caps_unref (caps);
+
+ /* inherited from Period's bitstreamSwitching */
+ bitstreamSwitchingFlag =
+ gst_mpd_client_get_bitstream_switching_flag (activeStream);
+ assert_equals_int (bitstreamSwitchingFlag, TRUE);
+
+ /* get details of the second active stream */
+ activeStream = gst_mpdparser_get_active_stream_by_index (mpdclient, 1);
+ fail_if (activeStream == NULL);
+
+ assert_equals_int (activeStream->mimeType, GST_STREAM_AUDIO);
+ caps = gst_mpd_client_get_stream_caps (activeStream);
+ fail_unless (caps != NULL);
+ s = gst_caps_get_structure (caps, 0);
+ assert_equals_string (gst_structure_get_name (s), "audio");
+ gst_caps_unref (caps);
+
+ /* set to FALSE in our example, but overwritten to TRUE by Period's
+ * bitstreamSwitching
+ */
+ bitstreamSwitchingFlag =
+ gst_mpd_client_get_bitstream_switching_flag (activeStream);
+ assert_equals_int (bitstreamSwitchingFlag, TRUE);
+
+ gst_mpd_client_free (mpdclient);
+}
+
+GST_END_TEST;
+
+/*
* Test various duration formats
*/
GST_START_TEST (dash_mpdparser_various_duration_formats)
@@ -5074,6 +5182,8 @@ GST_START_TEST (dash_mpdparser_default_presentation_delay)
gst_mpd_client_parse_default_presentation_delay (mpdclient,
"not a number");
assert_equals_int64 (value, 0);
+
+ gst_mpd_client_free (mpdclient);
}
GST_END_TEST;
@@ -5198,6 +5308,7 @@ dash_suite (void)
tcase_add_test (tc_simpleMPD, dash_mpdparser_template_parsing);
tcase_add_test (tc_simpleMPD, dash_mpdparser_isoff_ondemand_profile);
tcase_add_test (tc_simpleMPD, dash_mpdparser_GstDateTime);
+ tcase_add_test (tc_simpleMPD, dash_mpdparser_bitstreamSwitching_inheritance);
tcase_add_test (tc_simpleMPD, dash_mpdparser_various_duration_formats);
tcase_add_test (tc_simpleMPD, dash_mpdparser_default_presentation_delay);