use of com.google.android.exoplayer2.TracksInfo.TrackGroupInfo in project ExoPlayer by google.
the class DashMediaPeriod method buildManifestEventTrackGroupInfos.
private static void buildManifestEventTrackGroupInfos(List<EventStream> eventStreams, TrackGroup[] trackGroups, TrackGroupInfo[] trackGroupInfos, int existingTrackGroupCount) {
for (int i = 0; i < eventStreams.size(); i++) {
EventStream eventStream = eventStreams.get(i);
Format format = new Format.Builder().setId(eventStream.id()).setSampleMimeType(MimeTypes.APPLICATION_EMSG).build();
String uniqueTrackGroupId = eventStream.id() + ":" + i;
trackGroups[existingTrackGroupCount] = new TrackGroup(uniqueTrackGroupId, format);
trackGroupInfos[existingTrackGroupCount++] = TrackGroupInfo.mpdEventTrack(i);
}
}
use of com.google.android.exoplayer2.TracksInfo.TrackGroupInfo in project ExoPlayer by google.
the class MappingTrackSelectorTest method buildTrackInfos_withTestValues_isAsExpected.
@Test
public void buildTrackInfos_withTestValues_isAsExpected() {
MappingTrackSelector.MappedTrackInfo mappedTrackInfo = new MappingTrackSelector.MappedTrackInfo(new String[] { "1", "2" }, new int[] { C.TRACK_TYPE_AUDIO, C.TRACK_TYPE_VIDEO }, new TrackGroupArray[] { new TrackGroupArray(new TrackGroup("0", new Format.Builder().build()), new TrackGroup("1", new Format.Builder().build())), new TrackGroupArray(new TrackGroup("2", new Format.Builder().build(), new Format.Builder().build())) }, new int[] { RendererCapabilities.ADAPTIVE_SEAMLESS, RendererCapabilities.ADAPTIVE_NOT_SUPPORTED }, new int[][][] { new int[][] { new int[] { C.FORMAT_HANDLED }, new int[] { C.FORMAT_UNSUPPORTED_SUBTYPE } }, new int[][] { new int[] { C.FORMAT_UNSUPPORTED_DRM, C.FORMAT_EXCEEDS_CAPABILITIES } } }, new TrackGroupArray(new TrackGroup(new Format.Builder().build())));
TrackSelection[] selections = new TrackSelection[] { new FixedTrackSelection(mappedTrackInfo.getTrackGroups(0).get(1), 0), new FixedTrackSelection(mappedTrackInfo.getTrackGroups(1).get(0), 1) };
TracksInfo tracksInfo = MappingTrackSelector.buildTracksInfo(selections, mappedTrackInfo);
ImmutableList<TrackGroupInfo> trackGroupInfos = tracksInfo.getTrackGroupInfos();
assertThat(trackGroupInfos).hasSize(4);
assertThat(trackGroupInfos.get(0).getTrackGroup()).isEqualTo(mappedTrackInfo.getTrackGroups(0).get(0));
assertThat(trackGroupInfos.get(1).getTrackGroup()).isEqualTo(mappedTrackInfo.getTrackGroups(0).get(1));
assertThat(trackGroupInfos.get(2).getTrackGroup()).isEqualTo(mappedTrackInfo.getTrackGroups(1).get(0));
assertThat(trackGroupInfos.get(3).getTrackGroup()).isEqualTo(mappedTrackInfo.getUnmappedTrackGroups().get(0));
assertThat(trackGroupInfos.get(0).getTrackSupport(0)).isEqualTo(C.FORMAT_HANDLED);
assertThat(trackGroupInfos.get(1).getTrackSupport(0)).isEqualTo(C.FORMAT_UNSUPPORTED_SUBTYPE);
assertThat(trackGroupInfos.get(2).getTrackSupport(0)).isEqualTo(C.FORMAT_UNSUPPORTED_DRM);
assertThat(trackGroupInfos.get(2).getTrackSupport(1)).isEqualTo(C.FORMAT_EXCEEDS_CAPABILITIES);
assertThat(trackGroupInfos.get(3).getTrackSupport(0)).isEqualTo(C.FORMAT_UNSUPPORTED_TYPE);
assertThat(trackGroupInfos.get(0).isTrackSelected(0)).isFalse();
assertThat(trackGroupInfos.get(1).isTrackSelected(0)).isTrue();
assertThat(trackGroupInfos.get(2).isTrackSelected(0)).isFalse();
assertThat(trackGroupInfos.get(2).isTrackSelected(1)).isTrue();
assertThat(trackGroupInfos.get(3).isTrackSelected(0)).isFalse();
assertThat(trackGroupInfos.get(0).getTrackType()).isEqualTo(C.TRACK_TYPE_AUDIO);
assertThat(trackGroupInfos.get(1).getTrackType()).isEqualTo(C.TRACK_TYPE_AUDIO);
assertThat(trackGroupInfos.get(2).getTrackType()).isEqualTo(C.TRACK_TYPE_VIDEO);
assertThat(trackGroupInfos.get(3).getTrackType()).isEqualTo(C.TRACK_TYPE_UNKNOWN);
}
use of com.google.android.exoplayer2.TracksInfo.TrackGroupInfo in project ExoPlayer by google.
the class StyledPlayerControlView method gatherSupportedTrackInfosOfType.
private ImmutableList<TrackInformation> gatherSupportedTrackInfosOfType(TracksInfo tracksInfo, @C.TrackType int trackType) {
ImmutableList.Builder<TrackInformation> tracks = new ImmutableList.Builder<>();
List<TrackGroupInfo> trackGroupInfos = tracksInfo.getTrackGroupInfos();
for (int trackGroupIndex = 0; trackGroupIndex < trackGroupInfos.size(); trackGroupIndex++) {
TrackGroupInfo trackGroupInfo = trackGroupInfos.get(trackGroupIndex);
if (trackGroupInfo.getTrackType() != trackType) {
continue;
}
TrackGroup trackGroup = trackGroupInfo.getTrackGroup();
for (int trackIndex = 0; trackIndex < trackGroup.length; trackIndex++) {
if (!trackGroupInfo.isTrackSupported(trackIndex)) {
continue;
}
String trackName = trackNameProvider.getTrackName(trackGroup.getFormat(trackIndex));
tracks.add(new TrackInformation(tracksInfo, trackGroupIndex, trackIndex, trackName));
}
}
return tracks.build();
}
Aggregations