mirror of
https://github.com/VibedByKaKi/alexandroid.git
synced 2026-12-06 12:29:32 +01:00
445 lines
16 KiB
Java
445 lines
16 KiB
Java
package com.google.android.exoplayer2;
|
|
|
|
import android.net.Uri;
|
|
import android.util.Pair;
|
|
import androidx.annotation.Nullable;
|
|
import com.facebook.imageutils.JfifUtil;
|
|
import com.google.android.exoplayer2.MediaItem;
|
|
import com.google.android.exoplayer2.source.ads.AdPlaybackState;
|
|
import com.google.android.exoplayer2.util.Assertions;
|
|
import com.google.android.exoplayer2.util.Util;
|
|
import com.here.time.Duration$$ExternalSyntheticBUOutline0;
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
/* loaded from: classes7.dex */
|
|
public abstract class Timeline {
|
|
public static final Timeline EMPTY = new Timeline() { // from class: com.google.android.exoplayer2.Timeline.1
|
|
@Override // com.google.android.exoplayer2.Timeline
|
|
public int getIndexOfPeriod(Object obj) {
|
|
return -1;
|
|
}
|
|
|
|
@Override // com.google.android.exoplayer2.Timeline
|
|
public Period getPeriod(int i, Period period, boolean z) {
|
|
throw new IndexOutOfBoundsException();
|
|
}
|
|
|
|
@Override // com.google.android.exoplayer2.Timeline
|
|
public int getPeriodCount() {
|
|
return 0;
|
|
}
|
|
|
|
@Override // com.google.android.exoplayer2.Timeline
|
|
public Object getUidOfPeriod(int i) {
|
|
throw new IndexOutOfBoundsException();
|
|
}
|
|
|
|
@Override // com.google.android.exoplayer2.Timeline
|
|
public Window getWindow(int i, Window window, long j) {
|
|
throw new IndexOutOfBoundsException();
|
|
}
|
|
|
|
@Override // com.google.android.exoplayer2.Timeline
|
|
public int getWindowCount() {
|
|
return 0;
|
|
}
|
|
};
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
public static final class Window {
|
|
public long defaultPositionUs;
|
|
public long durationUs;
|
|
public long elapsedRealtimeEpochOffsetMs;
|
|
public int firstPeriodIndex;
|
|
public boolean isDynamic;
|
|
|
|
@Deprecated
|
|
public boolean isLive;
|
|
public boolean isPlaceholder;
|
|
public boolean isSeekable;
|
|
public int lastPeriodIndex;
|
|
|
|
@Nullable
|
|
public MediaItem.LiveConfiguration liveConfiguration;
|
|
|
|
@Nullable
|
|
public Object manifest;
|
|
public long positionInFirstPeriodUs;
|
|
public long presentationStartTimeMs;
|
|
|
|
@Nullable
|
|
@Deprecated
|
|
public Object tag;
|
|
public long windowStartTimeMs;
|
|
public static final Object SINGLE_WINDOW_UID = new Object();
|
|
private static final MediaItem EMPTY_MEDIA_ITEM = new MediaItem.Builder().setMediaId("com.google.android.exoplayer2.Timeline").setUri(Uri.EMPTY).build();
|
|
public Object uid = SINGLE_WINDOW_UID;
|
|
public MediaItem mediaItem = EMPTY_MEDIA_ITEM;
|
|
|
|
public boolean equals(@Nullable Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
if (obj != null && Window.class.equals(obj.getClass())) {
|
|
Window window = (Window) obj;
|
|
if (Util.areEqual(this.uid, window.uid) && Util.areEqual(this.mediaItem, window.mediaItem) && Util.areEqual(this.manifest, window.manifest) && Util.areEqual(this.liveConfiguration, window.liveConfiguration) && this.presentationStartTimeMs == window.presentationStartTimeMs && this.windowStartTimeMs == window.windowStartTimeMs && this.elapsedRealtimeEpochOffsetMs == window.elapsedRealtimeEpochOffsetMs && this.isSeekable == window.isSeekable && this.isDynamic == window.isDynamic && this.isPlaceholder == window.isPlaceholder && this.defaultPositionUs == window.defaultPositionUs && this.durationUs == window.durationUs && this.firstPeriodIndex == window.firstPeriodIndex && this.lastPeriodIndex == window.lastPeriodIndex && this.positionInFirstPeriodUs == window.positionInFirstPeriodUs) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public long getCurrentUnixTimeMs() {
|
|
return Util.getNowUnixTimeMs(this.elapsedRealtimeEpochOffsetMs);
|
|
}
|
|
|
|
public long getDefaultPositionMs() {
|
|
return C.usToMs(this.defaultPositionUs);
|
|
}
|
|
|
|
public long getDefaultPositionUs() {
|
|
return this.defaultPositionUs;
|
|
}
|
|
|
|
public long getDurationMs() {
|
|
return C.usToMs(this.durationUs);
|
|
}
|
|
|
|
public long getDurationUs() {
|
|
return this.durationUs;
|
|
}
|
|
|
|
public long getPositionInFirstPeriodMs() {
|
|
return C.usToMs(this.positionInFirstPeriodUs);
|
|
}
|
|
|
|
public long getPositionInFirstPeriodUs() {
|
|
return this.positionInFirstPeriodUs;
|
|
}
|
|
|
|
public int hashCode() {
|
|
int hashCode = (this.mediaItem.hashCode() + ((this.uid.hashCode() + JfifUtil.MARKER_EOI) * 31)) * 31;
|
|
Object obj = this.manifest;
|
|
int hashCode2 = (hashCode + (obj == null ? 0 : obj.hashCode())) * 31;
|
|
MediaItem.LiveConfiguration liveConfiguration = this.liveConfiguration;
|
|
int hashCode3 = (hashCode2 + (liveConfiguration != null ? liveConfiguration.hashCode() : 0)) * 31;
|
|
long j = this.presentationStartTimeMs;
|
|
int i = (hashCode3 + ((int) (j ^ (j >>> 32)))) * 31;
|
|
long j2 = this.windowStartTimeMs;
|
|
int i2 = (i + ((int) (j2 ^ (j2 >>> 32)))) * 31;
|
|
long j3 = this.elapsedRealtimeEpochOffsetMs;
|
|
int i3 = (((((((i2 + ((int) (j3 ^ (j3 >>> 32)))) * 31) + (this.isSeekable ? 1 : 0)) * 31) + (this.isDynamic ? 1 : 0)) * 31) + (this.isPlaceholder ? 1 : 0)) * 31;
|
|
long j4 = this.defaultPositionUs;
|
|
int i4 = (i3 + ((int) (j4 ^ (j4 >>> 32)))) * 31;
|
|
long j5 = this.durationUs;
|
|
int i5 = (((((i4 + ((int) (j5 ^ (j5 >>> 32)))) * 31) + this.firstPeriodIndex) * 31) + this.lastPeriodIndex) * 31;
|
|
long j6 = this.positionInFirstPeriodUs;
|
|
return i5 + ((int) (j6 ^ (j6 >>> 32)));
|
|
}
|
|
|
|
public boolean isLive() {
|
|
Assertions.checkState(this.isLive == (this.liveConfiguration != null));
|
|
return this.liveConfiguration != null;
|
|
}
|
|
|
|
public Window set(Object obj, @Nullable MediaItem mediaItem, @Nullable Object obj2, long j, long j2, long j3, boolean z, boolean z2, @Nullable MediaItem.LiveConfiguration liveConfiguration, long j4, long j5, int i, int i2, long j6) {
|
|
MediaItem.PlaybackProperties playbackProperties;
|
|
this.uid = obj;
|
|
this.mediaItem = mediaItem != null ? mediaItem : EMPTY_MEDIA_ITEM;
|
|
this.tag = (mediaItem == null || (playbackProperties = mediaItem.playbackProperties) == null) ? null : playbackProperties.tag;
|
|
this.manifest = obj2;
|
|
this.presentationStartTimeMs = j;
|
|
this.windowStartTimeMs = j2;
|
|
this.elapsedRealtimeEpochOffsetMs = j3;
|
|
this.isSeekable = z;
|
|
this.isDynamic = z2;
|
|
this.isLive = liveConfiguration != null;
|
|
this.liveConfiguration = liveConfiguration;
|
|
this.defaultPositionUs = j4;
|
|
this.durationUs = j5;
|
|
this.firstPeriodIndex = i;
|
|
this.lastPeriodIndex = i2;
|
|
this.positionInFirstPeriodUs = j6;
|
|
this.isPlaceholder = false;
|
|
return this;
|
|
}
|
|
}
|
|
|
|
public boolean equals(@Nullable Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
if (!(obj instanceof Timeline)) {
|
|
return false;
|
|
}
|
|
Timeline timeline = (Timeline) obj;
|
|
if (timeline.getWindowCount() != getWindowCount() || timeline.getPeriodCount() != getPeriodCount()) {
|
|
return false;
|
|
}
|
|
Window window = new Window();
|
|
Period period = new Period();
|
|
Window window2 = new Window();
|
|
Period period2 = new Period();
|
|
for (int i = 0; i < getWindowCount(); i++) {
|
|
if (!getWindow(i, window).equals(timeline.getWindow(i, window2))) {
|
|
return false;
|
|
}
|
|
}
|
|
for (int i2 = 0; i2 < getPeriodCount(); i2++) {
|
|
if (!getPeriod(i2, period, true).equals(timeline.getPeriod(i2, period2, true))) {
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public int getFirstWindowIndex(boolean z) {
|
|
return isEmpty() ? -1 : 0;
|
|
}
|
|
|
|
public abstract int getIndexOfPeriod(Object obj);
|
|
|
|
public int getLastWindowIndex(boolean z) {
|
|
if (isEmpty()) {
|
|
return -1;
|
|
}
|
|
return getWindowCount() - 1;
|
|
}
|
|
|
|
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 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;
|
|
}
|
|
Duration$$ExternalSyntheticBUOutline0.m$1();
|
|
return 0;
|
|
}
|
|
|
|
public final Period getPeriod(int i, Period period) {
|
|
return getPeriod(i, period, false);
|
|
}
|
|
|
|
public abstract Period getPeriod(int i, Period period, boolean z);
|
|
|
|
public Period getPeriodByUid(Object obj, Period period) {
|
|
return getPeriod(getIndexOfPeriod(obj), period, true);
|
|
}
|
|
|
|
public abstract int getPeriodCount();
|
|
|
|
@Nullable
|
|
public final Pair<Object, Long> getPeriodPosition(Window window, Period period, int i, long j, long j2) {
|
|
Assertions.checkIndex(i, 0, getWindowCount());
|
|
getWindow(i, window, j2);
|
|
if (j == -9223372036854775807L) {
|
|
j = window.getDefaultPositionUs();
|
|
if (j == -9223372036854775807L) {
|
|
return null;
|
|
}
|
|
}
|
|
int i2 = window.firstPeriodIndex;
|
|
long positionInFirstPeriodUs = window.getPositionInFirstPeriodUs() + j;
|
|
long durationUs = getPeriod(i2, period, true).getDurationUs();
|
|
while (durationUs != -9223372036854775807L && positionInFirstPeriodUs >= durationUs && i2 < window.lastPeriodIndex) {
|
|
positionInFirstPeriodUs -= durationUs;
|
|
i2++;
|
|
durationUs = getPeriod(i2, period, true).getDurationUs();
|
|
}
|
|
return Pair.create(Assertions.checkNotNull(period.uid), Long.valueOf(positionInFirstPeriodUs));
|
|
}
|
|
|
|
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;
|
|
}
|
|
Duration$$ExternalSyntheticBUOutline0.m$1();
|
|
return 0;
|
|
}
|
|
|
|
public abstract Object getUidOfPeriod(int i);
|
|
|
|
public final Window getWindow(int i, Window window) {
|
|
return getWindow(i, window, 0L);
|
|
}
|
|
|
|
public abstract Window getWindow(int i, Window window, long j);
|
|
|
|
public abstract int getWindowCount();
|
|
|
|
public int hashCode() {
|
|
Window window = new Window();
|
|
Period period = new Period();
|
|
int windowCount = getWindowCount() + JfifUtil.MARKER_EOI;
|
|
for (int i = 0; i < getWindowCount(); i++) {
|
|
windowCount = (windowCount * 31) + getWindow(i, window).hashCode();
|
|
}
|
|
int periodCount = getPeriodCount() + (windowCount * 31);
|
|
for (int i2 = 0; i2 < getPeriodCount(); i2++) {
|
|
periodCount = (periodCount * 31) + getPeriod(i2, period, true).hashCode();
|
|
}
|
|
return periodCount;
|
|
}
|
|
|
|
public final boolean isEmpty() {
|
|
return getWindowCount() == 0;
|
|
}
|
|
|
|
public final boolean isLastPeriod(int i, Period period, Window window, int i2, boolean z) {
|
|
return getNextPeriodIndex(i, period, window, i2, z) == -1;
|
|
}
|
|
|
|
@Deprecated
|
|
public final Window getWindow(int i, Window window, boolean z) {
|
|
return getWindow(i, window, 0L);
|
|
}
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
public static final class Period {
|
|
private AdPlaybackState adPlaybackState = AdPlaybackState.NONE;
|
|
public long durationUs;
|
|
|
|
@Nullable
|
|
public Object id;
|
|
private long positionInWindowUs;
|
|
|
|
@Nullable
|
|
public Object uid;
|
|
public int windowIndex;
|
|
|
|
public boolean equals(@Nullable Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
if (obj != null && Period.class.equals(obj.getClass())) {
|
|
Period period = (Period) obj;
|
|
if (Util.areEqual(this.id, period.id) && Util.areEqual(this.uid, period.uid) && this.windowIndex == period.windowIndex && this.durationUs == period.durationUs && this.positionInWindowUs == period.positionInWindowUs && Util.areEqual(this.adPlaybackState, period.adPlaybackState)) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public int getAdCountInAdGroup(int i) {
|
|
return this.adPlaybackState.adGroups[i].count;
|
|
}
|
|
|
|
public long getAdDurationUs(int i, int i2) {
|
|
AdPlaybackState.AdGroup adGroup = this.adPlaybackState.adGroups[i];
|
|
if (adGroup.count != -1) {
|
|
return adGroup.durationsUs[i2];
|
|
}
|
|
return -9223372036854775807L;
|
|
}
|
|
|
|
public int getAdGroupCount() {
|
|
return this.adPlaybackState.adGroupCount;
|
|
}
|
|
|
|
public int getAdGroupIndexAfterPositionUs(long j) {
|
|
return this.adPlaybackState.getAdGroupIndexAfterPositionUs(j, this.durationUs);
|
|
}
|
|
|
|
public int getAdGroupIndexForPositionUs(long j) {
|
|
return this.adPlaybackState.getAdGroupIndexForPositionUs(j, this.durationUs);
|
|
}
|
|
|
|
public long getAdGroupTimeUs(int i) {
|
|
return this.adPlaybackState.adGroupTimesUs[i];
|
|
}
|
|
|
|
public long getAdResumePositionUs() {
|
|
return this.adPlaybackState.adResumePositionUs;
|
|
}
|
|
|
|
@Nullable
|
|
public Object getAdsId() {
|
|
return this.adPlaybackState.adsId;
|
|
}
|
|
|
|
public long getDurationMs() {
|
|
return C.usToMs(this.durationUs);
|
|
}
|
|
|
|
public long getDurationUs() {
|
|
return this.durationUs;
|
|
}
|
|
|
|
public int getFirstAdIndexToPlay(int i) {
|
|
return this.adPlaybackState.adGroups[i].getFirstAdIndexToPlay();
|
|
}
|
|
|
|
public int getNextAdIndexToPlay(int i, int i2) {
|
|
return this.adPlaybackState.adGroups[i].getNextAdIndexToPlay(i2);
|
|
}
|
|
|
|
public long getPositionInWindowMs() {
|
|
return C.usToMs(this.positionInWindowUs);
|
|
}
|
|
|
|
public long getPositionInWindowUs() {
|
|
return this.positionInWindowUs;
|
|
}
|
|
|
|
public boolean hasPlayedAdGroup(int i) {
|
|
return !this.adPlaybackState.adGroups[i].hasUnplayedAds();
|
|
}
|
|
|
|
public int hashCode() {
|
|
Object obj = this.id;
|
|
int hashCode = (JfifUtil.MARKER_EOI + (obj == null ? 0 : obj.hashCode())) * 31;
|
|
Object obj2 = this.uid;
|
|
int hashCode2 = (((hashCode + (obj2 != null ? obj2.hashCode() : 0)) * 31) + this.windowIndex) * 31;
|
|
long j = this.durationUs;
|
|
int i = (hashCode2 + ((int) (j ^ (j >>> 32)))) * 31;
|
|
long j2 = this.positionInWindowUs;
|
|
return this.adPlaybackState.hashCode() + ((i + ((int) (j2 ^ (j2 >>> 32)))) * 31);
|
|
}
|
|
|
|
public Period set(@Nullable Object obj, @Nullable Object obj2, int i, long j, long j2) {
|
|
return set(obj, obj2, i, j, j2, AdPlaybackState.NONE);
|
|
}
|
|
|
|
public Period set(@Nullable Object obj, @Nullable 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 Pair<Object, Long> getPeriodPosition(Window window, Period period, int i, long j) {
|
|
return (Pair) Assertions.checkNotNull(getPeriodPosition(window, period, i, j, 0L));
|
|
}
|
|
}
|