use of com.google.android.exoplayer2.TracksInfo 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