Search in sources :

Example 1 with SegmentTimelineElement

use of androidx.media3.exoplayer.dash.manifest.SegmentBase.SegmentTimelineElement in project media by androidx.

the class DashManifestParserTest method parseSegmentTimeline_timeOffsetsAndUndefinedRepeatCount.

@Test
public void parseSegmentTimeline_timeOffsetsAndUndefinedRepeatCount() throws Exception {
    DashManifestParser parser = new DashManifestParser();
    XmlPullParser xpp = XmlPullParserFactory.newInstance().newPullParser();
    xpp.setInput(new StringReader("<SegmentTimeline><S t=\"0\" " + "d=\"96000\" r=\"-1\"/><S t=\"192000\" d=\"48000\" r=\"-1\"/>" + "</SegmentTimeline>" + NEXT_TAG));
    xpp.next();
    List<SegmentTimelineElement> elements = parser.parseSegmentTimeline(xpp, /* timescale= */
    48000, /* periodDurationMs= */
    10000);
    assertThat(elements).containsExactly(new SegmentTimelineElement(/* startTime= */
    0, /* duration= */
    96000), new SegmentTimelineElement(/* startTime= */
    96000, /* duration= */
    96000), new SegmentTimelineElement(/* startTime= */
    192000, /* duration= */
    48000), new SegmentTimelineElement(/* startTime= */
    240000, /* duration= */
    48000), new SegmentTimelineElement(/* startTime= */
    288000, /* duration= */
    48000), new SegmentTimelineElement(/* startTime= */
    336000, /* duration= */
    48000), new SegmentTimelineElement(/* startTime= */
    384000, /* duration= */
    48000), new SegmentTimelineElement(/* startTime= */
    432000, /* duration= */
    48000)).inOrder();
    assertNextTag(xpp);
}
Also used : SegmentTimelineElement(androidx.media3.exoplayer.dash.manifest.SegmentBase.SegmentTimelineElement) XmlPullParser(org.xmlpull.v1.XmlPullParser) StringReader(java.io.StringReader) Test(org.junit.Test)

Example 2 with SegmentTimelineElement

use of androidx.media3.exoplayer.dash.manifest.SegmentBase.SegmentTimelineElement in project media by androidx.

the class DashManifestParserTest method parseSegmentTimeline_repeatCount.

@Test
public void parseSegmentTimeline_repeatCount() throws Exception {
    DashManifestParser parser = new DashManifestParser();
    XmlPullParser xpp = XmlPullParserFactory.newInstance().newPullParser();
    xpp.setInput(new StringReader("<SegmentTimeline><S d=\"96000\" r=\"2\"/><S d=\"48000\" r=\"0\"/></SegmentTimeline>" + NEXT_TAG));
    xpp.next();
    List<SegmentTimelineElement> elements = parser.parseSegmentTimeline(xpp, /* timescale= */
    48000, /* periodDurationMs= */
    10000);
    assertThat(elements).containsExactly(new SegmentTimelineElement(/* startTime= */
    0, /* duration= */
    96000), new SegmentTimelineElement(/* startTime= */
    96000, /* duration= */
    96000), new SegmentTimelineElement(/* startTime= */
    192000, /* duration= */
    96000), new SegmentTimelineElement(/* startTime= */
    288000, /* duration= */
    48000)).inOrder();
    assertNextTag(xpp);
}
Also used : SegmentTimelineElement(androidx.media3.exoplayer.dash.manifest.SegmentBase.SegmentTimelineElement) XmlPullParser(org.xmlpull.v1.XmlPullParser) StringReader(java.io.StringReader) Test(org.junit.Test)

Example 3 with SegmentTimelineElement

use of androidx.media3.exoplayer.dash.manifest.SegmentBase.SegmentTimelineElement in project media by androidx.

the class DashManifestParserTest method parseSegmentTimeline_singleUndefinedRepeatCount.

@Test
public void parseSegmentTimeline_singleUndefinedRepeatCount() throws Exception {
    DashManifestParser parser = new DashManifestParser();
    XmlPullParser xpp = XmlPullParserFactory.newInstance().newPullParser();
    xpp.setInput(new StringReader("<SegmentTimeline><S d=\"96000\" r=\"-1\"/></SegmentTimeline>" + NEXT_TAG));
    xpp.next();
    List<SegmentTimelineElement> elements = parser.parseSegmentTimeline(xpp, /* timescale= */
    48000, /* periodDurationMs= */
    10000);
    assertThat(elements).containsExactly(new SegmentTimelineElement(/* startTime= */
    0, /* duration= */
    96000), new SegmentTimelineElement(/* startTime= */
    96000, /* duration= */
    96000), new SegmentTimelineElement(/* startTime= */
    192000, /* duration= */
    96000), new SegmentTimelineElement(/* startTime= */
    288000, /* duration= */
    96000), new SegmentTimelineElement(/* startTime= */
    384000, /* duration= */
    96000)).inOrder();
    assertNextTag(xpp);
}
Also used : SegmentTimelineElement(androidx.media3.exoplayer.dash.manifest.SegmentBase.SegmentTimelineElement) XmlPullParser(org.xmlpull.v1.XmlPullParser) StringReader(java.io.StringReader) Test(org.junit.Test)

Aggregations

SegmentTimelineElement (androidx.media3.exoplayer.dash.manifest.SegmentBase.SegmentTimelineElement)3 StringReader (java.io.StringReader)3 Test (org.junit.Test)3 XmlPullParser (org.xmlpull.v1.XmlPullParser)3