package com.google.android.exoplayer2.source.ads; import android.net.Uri; import com.google.android.exoplayer2.Bundleable$Creator; import com.google.android.exoplayer2.MediaItem$$ExternalSyntheticLambda0; import com.google.android.exoplayer2.util.Assertions; import com.google.android.exoplayer2.util.Util; import com.mbridge.msdk.playercommon.exoplayer2.C; import java.util.Arrays; /* loaded from: classes2.dex */ public final class AdPlaybackState { public final int adGroupCount; public final AdGroup[] adGroups; public final long adResumePositionUs; public final Object adsId; public final long contentDurationUs; public final int removedAdGroupCount; public static final AdPlaybackState NONE = new AdPlaybackState(null, new AdGroup[0], 0, C.TIME_UNSET, 0); public static final AdGroup REMOVED_AD_GROUP = new AdGroup(0).withAdCount(0); public static final Bundleable$Creator CREATOR = new MediaItem$$ExternalSyntheticLambda0(); public static final class AdGroup { public static final Bundleable$Creator CREATOR = new MediaItem$$ExternalSyntheticLambda0(); public final long contentResumeOffsetUs; public final int count; public final long[] durationsUs; public final boolean isServerSideInserted; public final int[] states; public final long timeUs; public final Uri[] uris; public AdGroup(long j) { this(j, -1, new int[0], new Uri[0], new long[0], 0L, false); } public AdGroup(long j, int i, int[] iArr, Uri[] uriArr, long[] jArr, long j2, boolean z) { Assertions.checkArgument(iArr.length == uriArr.length); this.timeUs = j; this.count = i; this.states = iArr; this.uris = uriArr; this.durationsUs = jArr; this.contentResumeOffsetUs = j2; this.isServerSideInserted = z; } public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || AdGroup.class != obj.getClass()) { return false; } AdGroup adGroup = (AdGroup) obj; return this.timeUs == adGroup.timeUs && this.count == adGroup.count && Arrays.equals(this.uris, adGroup.uris) && Arrays.equals(this.states, adGroup.states) && Arrays.equals(this.durationsUs, adGroup.durationsUs) && this.contentResumeOffsetUs == adGroup.contentResumeOffsetUs && this.isServerSideInserted == adGroup.isServerSideInserted; } public int hashCode() { int i = this.count * 31; long j = this.timeUs; int hashCode = (((((((i + ((int) (j ^ (j >>> 32)))) * 31) + Arrays.hashCode(this.uris)) * 31) + Arrays.hashCode(this.states)) * 31) + Arrays.hashCode(this.durationsUs)) * 31; long j2 = this.contentResumeOffsetUs; return ((hashCode + ((int) (j2 ^ (j2 >>> 32)))) * 31) + (this.isServerSideInserted ? 1 : 0); } public AdGroup withAdCount(int i) { int[] copyStatesWithSpaceForAdCount = copyStatesWithSpaceForAdCount(this.states, i); long[] copyDurationsUsWithSpaceForAdCount = copyDurationsUsWithSpaceForAdCount(this.durationsUs, i); return new AdGroup(this.timeUs, i, copyStatesWithSpaceForAdCount, (Uri[]) Arrays.copyOf(this.uris, i), copyDurationsUsWithSpaceForAdCount, this.contentResumeOffsetUs, this.isServerSideInserted); } public static int[] copyStatesWithSpaceForAdCount(int[] iArr, int i) { int length = iArr.length; int max = Math.max(i, length); int[] copyOf = Arrays.copyOf(iArr, max); Arrays.fill(copyOf, length, max, 0); return copyOf; } public static long[] copyDurationsUsWithSpaceForAdCount(long[] jArr, int i) { int length = jArr.length; int max = Math.max(i, length); long[] copyOf = Arrays.copyOf(jArr, max); Arrays.fill(copyOf, length, max, C.TIME_UNSET); return copyOf; } } public AdPlaybackState(Object obj, AdGroup[] adGroupArr, long j, long j2, int i) { this.adsId = obj; this.adResumePositionUs = j; this.contentDurationUs = j2; this.adGroupCount = adGroupArr.length + i; this.adGroups = adGroupArr; this.removedAdGroupCount = i; } public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || AdPlaybackState.class != obj.getClass()) { return false; } AdPlaybackState adPlaybackState = (AdPlaybackState) obj; return Util.areEqual(this.adsId, adPlaybackState.adsId) && this.adGroupCount == adPlaybackState.adGroupCount && this.adResumePositionUs == adPlaybackState.adResumePositionUs && this.contentDurationUs == adPlaybackState.contentDurationUs && this.removedAdGroupCount == adPlaybackState.removedAdGroupCount && Arrays.equals(this.adGroups, adPlaybackState.adGroups); } public int hashCode() { int i = this.adGroupCount * 31; Object obj = this.adsId; return ((((((((i + (obj == null ? 0 : obj.hashCode())) * 31) + ((int) this.adResumePositionUs)) * 31) + ((int) this.contentDurationUs)) * 31) + this.removedAdGroupCount) * 31) + Arrays.hashCode(this.adGroups); } public String toString() { StringBuilder sb = new StringBuilder(); sb.append("AdPlaybackState(adsId="); sb.append(this.adsId); sb.append(", adResumePositionUs="); sb.append(this.adResumePositionUs); sb.append(", adGroups=["); for (int i = 0; i < this.adGroups.length; i++) { sb.append("adGroup(timeUs="); sb.append(this.adGroups[i].timeUs); sb.append(", ads=["); for (int i2 = 0; i2 < this.adGroups[i].states.length; i2++) { sb.append("ad(state="); int i3 = this.adGroups[i].states[i2]; if (i3 == 0) { sb.append('_'); } else if (i3 == 1) { sb.append('R'); } else if (i3 == 2) { sb.append('S'); } else if (i3 == 3) { sb.append('P'); } else if (i3 == 4) { sb.append('!'); } else { sb.append('?'); } sb.append(", durationUs="); sb.append(this.adGroups[i].durationsUs[i2]); sb.append(')'); if (i2 < this.adGroups[i].states.length - 1) { sb.append(", "); } } sb.append("])"); if (i < this.adGroups.length - 1) { sb.append(", "); } } sb.append("])"); return sb.toString(); } }