Rabbit-R1/android (non root)/java/sources/androidx/media3/extractor/mp4/TrackSampleTable.java

53 lines
1.9 KiB
Java
Raw Normal View History

2024-05-21 16:08:36 -05:00
package androidx.media3.extractor.mp4;
import androidx.media3.common.util.Assertions;
import androidx.media3.common.util.Util;
/* loaded from: classes2.dex */
final class TrackSampleTable {
public final long durationUs;
public final int[] flags;
public final int maximumSize;
public final long[] offsets;
public final int sampleCount;
public final int[] sizes;
public final long[] timestampsUs;
public final Track track;
public TrackSampleTable(Track track, long[] jArr, int[] iArr, int i, long[] jArr2, int[] iArr2, long j) {
Assertions.checkArgument(iArr.length == jArr2.length);
Assertions.checkArgument(jArr.length == jArr2.length);
Assertions.checkArgument(iArr2.length == jArr2.length);
this.track = track;
this.offsets = jArr;
this.sizes = iArr;
this.maximumSize = i;
this.timestampsUs = jArr2;
this.flags = iArr2;
this.durationUs = j;
this.sampleCount = jArr.length;
if (iArr2.length > 0) {
int length = iArr2.length - 1;
iArr2[length] = iArr2[length] | 536870912;
}
}
public int getIndexOfEarlierOrEqualSynchronizationSample(long j) {
for (int binarySearchFloor = Util.binarySearchFloor(this.timestampsUs, j, true, false); binarySearchFloor >= 0; binarySearchFloor--) {
if ((this.flags[binarySearchFloor] & 1) != 0) {
return binarySearchFloor;
}
}
return -1;
}
public int getIndexOfLaterOrEqualSynchronizationSample(long j) {
for (int binarySearchCeil = Util.binarySearchCeil(this.timestampsUs, j, true, false); binarySearchCeil < this.timestampsUs.length; binarySearchCeil++) {
if ((this.flags[binarySearchCeil] & 1) != 0) {
return binarySearchCeil;
}
}
return -1;
}
}