- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
284 lines
9.1 KiB
Java
284 lines
9.1 KiB
Java
package com.mbridge.msdk.playercommon.exoplayer2;
|
|
|
|
import android.util.Pair;
|
|
import androidx.annotation.Nullable;
|
|
import com.mbridge.msdk.playercommon.exoplayer2.source.ads.AdPlaybackState;
|
|
import com.mbridge.msdk.playercommon.exoplayer2.util.Assertions;
|
|
|
|
/* loaded from: classes4.dex */
|
|
public abstract class Timeline {
|
|
public static final Timeline EMPTY = new Timeline() { // from class: com.mbridge.msdk.playercommon.exoplayer2.Timeline.1
|
|
@Override // com.mbridge.msdk.playercommon.exoplayer2.Timeline
|
|
public int getIndexOfPeriod(Object obj) {
|
|
return -1;
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.playercommon.exoplayer2.Timeline
|
|
public int getPeriodCount() {
|
|
return 0;
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.playercommon.exoplayer2.Timeline
|
|
public int getWindowCount() {
|
|
return 0;
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.playercommon.exoplayer2.Timeline
|
|
public Window getWindow(int i, Window window, boolean z, long j) {
|
|
throw new IndexOutOfBoundsException();
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.playercommon.exoplayer2.Timeline
|
|
public Period getPeriod(int i, Period period, boolean z) {
|
|
throw new IndexOutOfBoundsException();
|
|
}
|
|
};
|
|
|
|
public abstract int getIndexOfPeriod(Object obj);
|
|
|
|
public abstract Period getPeriod(int i, Period period, boolean z);
|
|
|
|
public abstract int getPeriodCount();
|
|
|
|
public abstract Window getWindow(int i, Window window, boolean z, long j);
|
|
|
|
public abstract int getWindowCount();
|
|
|
|
public static final class Window {
|
|
public long defaultPositionUs;
|
|
public long durationUs;
|
|
public int firstPeriodIndex;
|
|
public boolean isDynamic;
|
|
public boolean isSeekable;
|
|
public int lastPeriodIndex;
|
|
public long positionInFirstPeriodUs;
|
|
public long presentationStartTimeMs;
|
|
|
|
@Nullable
|
|
public Object tag;
|
|
public long windowStartTimeMs;
|
|
|
|
public final long getDefaultPositionUs() {
|
|
return this.defaultPositionUs;
|
|
}
|
|
|
|
public final long getDurationUs() {
|
|
return this.durationUs;
|
|
}
|
|
|
|
public final long getPositionInFirstPeriodUs() {
|
|
return this.positionInFirstPeriodUs;
|
|
}
|
|
|
|
public final Window set(@Nullable Object obj, long j, long j2, boolean z, boolean z2, long j3, long j4, int i, int i2, long j5) {
|
|
this.tag = obj;
|
|
this.presentationStartTimeMs = j;
|
|
this.windowStartTimeMs = j2;
|
|
this.isSeekable = z;
|
|
this.isDynamic = z2;
|
|
this.defaultPositionUs = j3;
|
|
this.durationUs = j4;
|
|
this.firstPeriodIndex = i;
|
|
this.lastPeriodIndex = i2;
|
|
this.positionInFirstPeriodUs = j5;
|
|
return this;
|
|
}
|
|
|
|
public final long getDefaultPositionMs() {
|
|
return C.usToMs(this.defaultPositionUs);
|
|
}
|
|
|
|
public final long getDurationMs() {
|
|
return C.usToMs(this.durationUs);
|
|
}
|
|
|
|
public final long getPositionInFirstPeriodMs() {
|
|
return C.usToMs(this.positionInFirstPeriodUs);
|
|
}
|
|
}
|
|
|
|
public static final class Period {
|
|
private AdPlaybackState adPlaybackState;
|
|
public long durationUs;
|
|
public Object id;
|
|
private long positionInWindowUs;
|
|
public Object uid;
|
|
public int windowIndex;
|
|
|
|
public final long getDurationUs() {
|
|
return this.durationUs;
|
|
}
|
|
|
|
public final long getPositionInWindowUs() {
|
|
return this.positionInWindowUs;
|
|
}
|
|
|
|
public final Period set(Object obj, Object obj2, int i, long j, long j2, AdPlaybackState adPlaybackState) {
|
|
this.id = obj;
|
|
this.uid = obj2;
|
|
this.windowIndex = i;
|
|
this.durationUs = j;
|
|
this.positionInWindowUs = j2;
|
|
this.adPlaybackState = adPlaybackState;
|
|
return this;
|
|
}
|
|
|
|
public final Period set(Object obj, Object obj2, int i, long j, long j2) {
|
|
return set(obj, obj2, i, j, j2, AdPlaybackState.NONE);
|
|
}
|
|
|
|
public final long getDurationMs() {
|
|
return C.usToMs(this.durationUs);
|
|
}
|
|
|
|
public final long getPositionInWindowMs() {
|
|
return C.usToMs(this.positionInWindowUs);
|
|
}
|
|
|
|
public final int getAdGroupCount() {
|
|
return this.adPlaybackState.adGroupCount;
|
|
}
|
|
|
|
public final long getAdGroupTimeUs(int i) {
|
|
return this.adPlaybackState.adGroupTimesUs[i];
|
|
}
|
|
|
|
public final int getFirstAdIndexToPlay(int i) {
|
|
return this.adPlaybackState.adGroups[i].getFirstAdIndexToPlay();
|
|
}
|
|
|
|
public final int getNextAdIndexToPlay(int i, int i2) {
|
|
return this.adPlaybackState.adGroups[i].getNextAdIndexToPlay(i2);
|
|
}
|
|
|
|
public final boolean hasPlayedAdGroup(int i) {
|
|
return !this.adPlaybackState.adGroups[i].hasUnplayedAds();
|
|
}
|
|
|
|
public final int getAdGroupIndexForPositionUs(long j) {
|
|
return this.adPlaybackState.getAdGroupIndexForPositionUs(j);
|
|
}
|
|
|
|
public final int getAdGroupIndexAfterPositionUs(long j) {
|
|
return this.adPlaybackState.getAdGroupIndexAfterPositionUs(j);
|
|
}
|
|
|
|
public final int getAdCountInAdGroup(int i) {
|
|
return this.adPlaybackState.adGroups[i].count;
|
|
}
|
|
|
|
public final boolean isAdAvailable(int i, int i2) {
|
|
AdPlaybackState.AdGroup adGroup = this.adPlaybackState.adGroups[i];
|
|
return (adGroup.count == -1 || adGroup.states[i2] == 0) ? false : true;
|
|
}
|
|
|
|
public final long getAdDurationUs(int i, int i2) {
|
|
AdPlaybackState.AdGroup adGroup = this.adPlaybackState.adGroups[i];
|
|
return adGroup.count != -1 ? adGroup.durationsUs[i2] : C.TIME_UNSET;
|
|
}
|
|
|
|
public final long getAdResumePositionUs() {
|
|
return this.adPlaybackState.adResumePositionUs;
|
|
}
|
|
}
|
|
|
|
public final boolean isEmpty() {
|
|
return getWindowCount() == 0;
|
|
}
|
|
|
|
public int getNextWindowIndex(int i, int i2, boolean z) {
|
|
if (i2 == 0) {
|
|
if (i == getLastWindowIndex(z)) {
|
|
return -1;
|
|
}
|
|
return i + 1;
|
|
}
|
|
if (i2 == 1) {
|
|
return i;
|
|
}
|
|
if (i2 == 2) {
|
|
return i == getLastWindowIndex(z) ? getFirstWindowIndex(z) : i + 1;
|
|
}
|
|
throw new IllegalStateException();
|
|
}
|
|
|
|
public int getPreviousWindowIndex(int i, int i2, boolean z) {
|
|
if (i2 == 0) {
|
|
if (i == getFirstWindowIndex(z)) {
|
|
return -1;
|
|
}
|
|
return i - 1;
|
|
}
|
|
if (i2 == 1) {
|
|
return i;
|
|
}
|
|
if (i2 == 2) {
|
|
return i == getFirstWindowIndex(z) ? getLastWindowIndex(z) : i - 1;
|
|
}
|
|
throw new IllegalStateException();
|
|
}
|
|
|
|
public int getLastWindowIndex(boolean z) {
|
|
if (isEmpty()) {
|
|
return -1;
|
|
}
|
|
return getWindowCount() - 1;
|
|
}
|
|
|
|
public int getFirstWindowIndex(boolean z) {
|
|
return isEmpty() ? -1 : 0;
|
|
}
|
|
|
|
public final Window getWindow(int i, Window window) {
|
|
return getWindow(i, window, false);
|
|
}
|
|
|
|
public final Window getWindow(int i, Window window, boolean z) {
|
|
return getWindow(i, window, z, 0L);
|
|
}
|
|
|
|
public final int getNextPeriodIndex(int i, Period period, Window window, int i2, boolean z) {
|
|
int i3 = getPeriod(i, period).windowIndex;
|
|
if (getWindow(i3, window).lastPeriodIndex != i) {
|
|
return i + 1;
|
|
}
|
|
int nextWindowIndex = getNextWindowIndex(i3, i2, z);
|
|
if (nextWindowIndex == -1) {
|
|
return -1;
|
|
}
|
|
return getWindow(nextWindowIndex, window).firstPeriodIndex;
|
|
}
|
|
|
|
public final boolean isLastPeriod(int i, Period period, Window window, int i2, boolean z) {
|
|
return getNextPeriodIndex(i, period, window, i2, z) == -1;
|
|
}
|
|
|
|
public final Pair<Integer, Long> getPeriodPosition(Window window, Period period, int i, long j) {
|
|
return getPeriodPosition(window, period, i, j, 0L);
|
|
}
|
|
|
|
public final Pair<Integer, Long> getPeriodPosition(Window window, Period period, int i, long j, long j2) {
|
|
Assertions.checkIndex(i, 0, getWindowCount());
|
|
getWindow(i, window, false, j2);
|
|
if (j == C.TIME_UNSET) {
|
|
j = window.getDefaultPositionUs();
|
|
if (j == C.TIME_UNSET) {
|
|
return null;
|
|
}
|
|
}
|
|
int i2 = window.firstPeriodIndex;
|
|
long positionInFirstPeriodUs = window.getPositionInFirstPeriodUs() + j;
|
|
long durationUs = getPeriod(i2, period).getDurationUs();
|
|
while (durationUs != C.TIME_UNSET && positionInFirstPeriodUs >= durationUs && i2 < window.lastPeriodIndex) {
|
|
positionInFirstPeriodUs -= durationUs;
|
|
i2++;
|
|
durationUs = getPeriod(i2, period).getDurationUs();
|
|
}
|
|
return Pair.create(Integer.valueOf(i2), Long.valueOf(positionInFirstPeriodUs));
|
|
}
|
|
|
|
public final Period getPeriod(int i, Period period) {
|
|
return getPeriod(i, period, false);
|
|
}
|
|
}
|