mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2024-12-30 11:02:31 -06:00
173 lines
5.8 KiB
Java
173 lines
5.8 KiB
Java
package androidx.media3.exoplayer.trackselection;
|
|
|
|
import android.os.SystemClock;
|
|
import androidx.media3.common.Format;
|
|
import androidx.media3.common.TrackGroup;
|
|
import androidx.media3.common.util.Assertions;
|
|
import androidx.media3.common.util.Util;
|
|
import androidx.media3.exoplayer.source.chunk.MediaChunk;
|
|
import java.util.Arrays;
|
|
import java.util.Comparator;
|
|
import java.util.List;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public abstract class BaseTrackSelection implements ExoTrackSelection {
|
|
private final long[] excludeUntilTimes;
|
|
private final Format[] formats;
|
|
protected final TrackGroup group;
|
|
private int hashCode;
|
|
protected final int length;
|
|
protected final int[] tracks;
|
|
private final int type;
|
|
|
|
@Override // androidx.media3.exoplayer.trackselection.ExoTrackSelection
|
|
public void disable() {
|
|
}
|
|
|
|
@Override // androidx.media3.exoplayer.trackselection.ExoTrackSelection
|
|
public void enable() {
|
|
}
|
|
|
|
@Override // androidx.media3.exoplayer.trackselection.TrackSelection
|
|
public final TrackGroup getTrackGroup() {
|
|
return this.group;
|
|
}
|
|
|
|
@Override // androidx.media3.exoplayer.trackselection.TrackSelection
|
|
public final int getType() {
|
|
return this.type;
|
|
}
|
|
|
|
@Override // androidx.media3.exoplayer.trackselection.ExoTrackSelection
|
|
public void onPlaybackSpeed(float f) {
|
|
}
|
|
|
|
public BaseTrackSelection(TrackGroup trackGroup, int... iArr) {
|
|
this(trackGroup, iArr, 0);
|
|
}
|
|
|
|
public BaseTrackSelection(TrackGroup trackGroup, int[] iArr, int i) {
|
|
int i2 = 0;
|
|
Assertions.checkState(iArr.length > 0);
|
|
this.type = i;
|
|
this.group = (TrackGroup) Assertions.checkNotNull(trackGroup);
|
|
int length = iArr.length;
|
|
this.length = length;
|
|
this.formats = new Format[length];
|
|
for (int i3 = 0; i3 < iArr.length; i3++) {
|
|
this.formats[i3] = trackGroup.getFormat(iArr[i3]);
|
|
}
|
|
Arrays.sort(this.formats, new Comparator() { // from class: androidx.media3.exoplayer.trackselection.BaseTrackSelection$$ExternalSyntheticLambda0
|
|
@Override // java.util.Comparator
|
|
public final int compare(Object obj, Object obj2) {
|
|
return BaseTrackSelection.lambda$new$0((Format) obj, (Format) obj2);
|
|
}
|
|
});
|
|
this.tracks = new int[this.length];
|
|
while (true) {
|
|
int i4 = this.length;
|
|
if (i2 < i4) {
|
|
this.tracks[i2] = trackGroup.indexOf(this.formats[i2]);
|
|
i2++;
|
|
} else {
|
|
this.excludeUntilTimes = new long[i4];
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public static /* synthetic */ int lambda$new$0(Format format, Format format2) {
|
|
return format2.bitrate - format.bitrate;
|
|
}
|
|
|
|
@Override // androidx.media3.exoplayer.trackselection.TrackSelection
|
|
public final int length() {
|
|
return this.tracks.length;
|
|
}
|
|
|
|
@Override // androidx.media3.exoplayer.trackselection.TrackSelection
|
|
public final Format getFormat(int i) {
|
|
return this.formats[i];
|
|
}
|
|
|
|
@Override // androidx.media3.exoplayer.trackselection.TrackSelection
|
|
public final int getIndexInTrackGroup(int i) {
|
|
return this.tracks[i];
|
|
}
|
|
|
|
@Override // androidx.media3.exoplayer.trackselection.TrackSelection
|
|
public final int indexOf(Format format) {
|
|
for (int i = 0; i < this.length; i++) {
|
|
if (this.formats[i] == format) {
|
|
return i;
|
|
}
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
@Override // androidx.media3.exoplayer.trackselection.TrackSelection
|
|
public final int indexOf(int i) {
|
|
for (int i2 = 0; i2 < this.length; i2++) {
|
|
if (this.tracks[i2] == i) {
|
|
return i2;
|
|
}
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
@Override // androidx.media3.exoplayer.trackselection.ExoTrackSelection
|
|
public final Format getSelectedFormat() {
|
|
return this.formats[getSelectedIndex()];
|
|
}
|
|
|
|
@Override // androidx.media3.exoplayer.trackselection.ExoTrackSelection
|
|
public final int getSelectedIndexInTrackGroup() {
|
|
return this.tracks[getSelectedIndex()];
|
|
}
|
|
|
|
@Override // androidx.media3.exoplayer.trackselection.ExoTrackSelection
|
|
public int evaluateQueueSize(long j, List<? extends MediaChunk> list) {
|
|
return list.size();
|
|
}
|
|
|
|
@Override // androidx.media3.exoplayer.trackselection.ExoTrackSelection
|
|
public boolean excludeTrack(int i, long j) {
|
|
long elapsedRealtime = SystemClock.elapsedRealtime();
|
|
boolean isTrackExcluded = isTrackExcluded(i, elapsedRealtime);
|
|
int i2 = 0;
|
|
while (i2 < this.length && !isTrackExcluded) {
|
|
isTrackExcluded = (i2 == i || isTrackExcluded(i2, elapsedRealtime)) ? false : true;
|
|
i2++;
|
|
}
|
|
if (!isTrackExcluded) {
|
|
return false;
|
|
}
|
|
long[] jArr = this.excludeUntilTimes;
|
|
jArr[i] = Math.max(jArr[i], Util.addWithOverflowDefault(elapsedRealtime, j, Long.MAX_VALUE));
|
|
return true;
|
|
}
|
|
|
|
@Override // androidx.media3.exoplayer.trackselection.ExoTrackSelection
|
|
public boolean isTrackExcluded(int i, long j) {
|
|
return this.excludeUntilTimes[i] > j;
|
|
}
|
|
|
|
public int hashCode() {
|
|
if (this.hashCode == 0) {
|
|
this.hashCode = (System.identityHashCode(this.group) * 31) + Arrays.hashCode(this.tracks);
|
|
}
|
|
return this.hashCode;
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
if (obj == null || getClass() != obj.getClass()) {
|
|
return false;
|
|
}
|
|
BaseTrackSelection baseTrackSelection = (BaseTrackSelection) obj;
|
|
return this.group == baseTrackSelection.group && Arrays.equals(this.tracks, baseTrackSelection.tracks);
|
|
}
|
|
}
|