use of com.google.android.exoplayer2.source.dash.manifest.AdaptationSet in project ExoPlayer by google.
the class DashManifestParserTest method parseMediaPresentationDescription_images.
@Test
public void parseMediaPresentationDescription_images() throws IOException {
DashManifestParser parser = new DashManifestParser();
DashManifest manifest = parser.parse(Uri.parse("https://example.com/test.mpd"), TestUtil.getInputStream(ApplicationProvider.getApplicationContext(), SAMPLE_MPD_IMAGES));
AdaptationSet adaptationSet = manifest.getPeriod(0).adaptationSets.get(0);
Format format = adaptationSet.representations.get(0).format;
assertThat(format.sampleMimeType).isEqualTo("image/jpeg");
assertThat(format.width).isEqualTo(320);
assertThat(format.height).isEqualTo(180);
}
use of com.google.android.exoplayer2.source.dash.manifest.AdaptationSet in project ExoPlayer by google.
the class DashManifestParserTest method parseMediaPresentationDescription_segmentTemplate.
@Test
public void parseMediaPresentationDescription_segmentTemplate() throws IOException {
DashManifestParser parser = new DashManifestParser();
DashManifest manifest = parser.parse(Uri.parse("https://example.com/test.mpd"), TestUtil.getInputStream(ApplicationProvider.getApplicationContext(), SAMPLE_MPD_SEGMENT_TEMPLATE));
assertThat(manifest.getPeriodCount()).isEqualTo(1);
Period period = manifest.getPeriod(0);
assertThat(period).isNotNull();
assertThat(period.adaptationSets).hasSize(2);
for (AdaptationSet adaptationSet : period.adaptationSets) {
assertThat(adaptationSet).isNotNull();
for (Representation representation : adaptationSet.representations) {
if (representation instanceof Representation.MultiSegmentRepresentation) {
Representation.MultiSegmentRepresentation multiSegmentRepresentation = (Representation.MultiSegmentRepresentation) representation;
long firstSegmentIndex = multiSegmentRepresentation.getFirstSegmentNum();
RangedUri uri = multiSegmentRepresentation.getSegmentUrl(firstSegmentIndex);
assertThat(uri.resolveUriString(representation.baseUrls.get(0).url)).contains("redirector.googlevideo.com");
}
}
}
}
use of com.google.android.exoplayer2.source.dash.manifest.AdaptationSet in project ExoPlayer by google.
the class DashManifestParserTest method getAvailabilityTimeOffsetUs.
private static long getAvailabilityTimeOffsetUs(AdaptationSet adaptationSet) {
assertThat(adaptationSet.representations).isNotEmpty();
Representation representation = adaptationSet.representations.get(0);
assertThat(representation).isInstanceOf(Representation.MultiSegmentRepresentation.class);
SegmentBase.MultiSegmentBase segmentBase = ((Representation.MultiSegmentRepresentation) representation).segmentBase;
return segmentBase.availabilityTimeOffsetUs;
}
use of com.google.android.exoplayer2.source.dash.manifest.AdaptationSet in project ExoPlayer by google.
the class DashMediaPeriodTest method cea708AccessibilityDescriptor_createsCea708TrackGroup.
@Test
public void cea708AccessibilityDescriptor_createsCea708TrackGroup() throws IOException {
DashManifest manifest = parseManifest("media/mpd/sample_mpd_cea_708_accessibility");
DashMediaPeriod dashMediaPeriod = createDashMediaPeriod(manifest, 0);
List<AdaptationSet> adaptationSets = manifest.getPeriod(0).adaptationSets;
// We expect two adaptation sets. The first containing the video representations, and the second
// containing the embedded CEA-708 tracks.
Format.Builder cea608FormatBuilder = new Format.Builder().setSampleMimeType(MimeTypes.APPLICATION_CEA708);
TrackGroupArray expectedTrackGroups = new TrackGroupArray(new TrackGroup(/* id= */
"123", adaptationSets.get(0).representations.get(0).format, adaptationSets.get(0).representations.get(1).format), new TrackGroup(/* id= */
"123:cc", cea608FormatBuilder.setId("123:cea708:1").setLanguage("eng").setAccessibilityChannel(1).build(), cea608FormatBuilder.setId("123:cea708:2").setLanguage("deu").setAccessibilityChannel(2).build()));
MediaPeriodAsserts.assertTrackGroups(dashMediaPeriod, expectedTrackGroups);
}
use of com.google.android.exoplayer2.source.dash.manifest.AdaptationSet in project ExoPlayer by google.
the class DashMediaPeriodTest method adaptationSetSwitchingProperty_mergesTrackGroups.
@Test
public void adaptationSetSwitchingProperty_mergesTrackGroups() throws IOException {
DashManifest manifest = parseManifest("media/mpd/sample_mpd_switching_property");
DashMediaPeriod dashMediaPeriod = createDashMediaPeriod(manifest, 0);
List<AdaptationSet> adaptationSets = manifest.getPeriod(0).adaptationSets;
// We expect the three adaptation sets with the switch descriptor to be merged, retaining the
// representations in their original order.
TrackGroupArray expectedTrackGroups = new TrackGroupArray(new TrackGroup(/* id= */
"0", adaptationSets.get(0).representations.get(0).format, adaptationSets.get(0).representations.get(1).format, adaptationSets.get(2).representations.get(0).format, adaptationSets.get(2).representations.get(1).format, adaptationSets.get(3).representations.get(0).format), new TrackGroup(/* id= */
"3", adaptationSets.get(1).representations.get(0).format));
MediaPeriodAsserts.assertTrackGroups(dashMediaPeriod, expectedTrackGroups);
}
Aggregations