mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2024-12-26 17:12:31 -06:00
58 lines
2 KiB
Java
58 lines
2 KiB
Java
package androidx.media3.extractor;
|
|
|
|
import androidx.media3.common.util.Util;
|
|
import androidx.media3.extractor.SeekMap;
|
|
import java.util.Arrays;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public final class ChunkIndex implements SeekMap {
|
|
private final long durationUs;
|
|
public final long[] durationsUs;
|
|
public final int length;
|
|
public final long[] offsets;
|
|
public final int[] sizes;
|
|
public final long[] timesUs;
|
|
|
|
@Override // androidx.media3.extractor.SeekMap
|
|
public long getDurationUs() {
|
|
return this.durationUs;
|
|
}
|
|
|
|
@Override // androidx.media3.extractor.SeekMap
|
|
public boolean isSeekable() {
|
|
return true;
|
|
}
|
|
|
|
public ChunkIndex(int[] iArr, long[] jArr, long[] jArr2, long[] jArr3) {
|
|
this.sizes = iArr;
|
|
this.offsets = jArr;
|
|
this.durationsUs = jArr2;
|
|
this.timesUs = jArr3;
|
|
int length = iArr.length;
|
|
this.length = length;
|
|
if (length > 0) {
|
|
this.durationUs = jArr2[length - 1] + jArr3[length - 1];
|
|
} else {
|
|
this.durationUs = 0L;
|
|
}
|
|
}
|
|
|
|
public int getChunkIndex(long j) {
|
|
return Util.binarySearchFloor(this.timesUs, j, true, true);
|
|
}
|
|
|
|
@Override // androidx.media3.extractor.SeekMap
|
|
public SeekMap.SeekPoints getSeekPoints(long j) {
|
|
int chunkIndex = getChunkIndex(j);
|
|
SeekPoint seekPoint = new SeekPoint(this.timesUs[chunkIndex], this.offsets[chunkIndex]);
|
|
if (seekPoint.timeUs >= j || chunkIndex == this.length - 1) {
|
|
return new SeekMap.SeekPoints(seekPoint);
|
|
}
|
|
int i = chunkIndex + 1;
|
|
return new SeekMap.SeekPoints(seekPoint, new SeekPoint(this.timesUs[i], this.offsets[i]));
|
|
}
|
|
|
|
public String toString() {
|
|
return "ChunkIndex(length=" + this.length + ", sizes=" + Arrays.toString(this.sizes) + ", offsets=" + Arrays.toString(this.offsets) + ", timeUs=" + Arrays.toString(this.timesUs) + ", durationsUs=" + Arrays.toString(this.durationsUs) + ")";
|
|
}
|
|
}
|