package p138.p176.p177.p190.p217.p224;

import com.google.android.exoplayer2.source.BehindLiveWindowException;
import java.io.IOException;
import java.util.Collections;
import java.util.List;
import p000.p001.p002.p003.p004.C0567;
import p138.p176.p177.p190.C3431;
import p138.p176.p177.p190.C3453;
import p138.p176.p177.p190.p198.p204.C3620;
import p138.p176.p177.p190.p198.p204.C3630;
import p138.p176.p177.p190.p217.p219.AbstractC3834;
import p138.p176.p177.p190.p217.p219.AbstractC3836;
import p138.p176.p177.p190.p217.p219.AbstractC3848;
import p138.p176.p177.p190.p217.p219.C3837;
import p138.p176.p177.p190.p217.p219.C3840;
import p138.p176.p177.p190.p217.p219.C3845;
import p138.p176.p177.p190.p217.p219.InterfaceC3849;
import p138.p176.p177.p190.p217.p224.InterfaceC3939;
import p138.p176.p177.p190.p217.p224.p225.C3942;
import p138.p176.p177.p190.p235.InterfaceC4036;
import p138.p176.p177.p190.p238.C4098;
import p138.p176.p177.p190.p238.InterfaceC4095;
import p138.p176.p177.p190.p238.InterfaceC4110;
import p138.p176.p177.p190.p238.InterfaceC4115;
import p138.p176.p177.p190.p239.C4150;

/* JADX INFO: renamed from: ދ.ހ.֏.ؠ.ໞ.ޠ.ؠ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public class C3936 implements InterfaceC3939 {

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final InterfaceC4110 f12317;

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public final int f12318;

    /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
    public final C3837[] f12319;

    /* JADX INFO: renamed from: ށ, reason: contains not printable characters */
    public final InterfaceC4095 f12320;

    /* JADX INFO: renamed from: ނ, reason: contains not printable characters */
    public InterfaceC4036 f12321;

    /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
    public C3942 f12322;

    /* JADX INFO: renamed from: ބ, reason: contains not printable characters */
    public int f12323;

    /* JADX INFO: renamed from: ޅ, reason: contains not printable characters */
    public IOException f12324;

    /* JADX INFO: renamed from: ދ.ހ.֏.ؠ.ໞ.ޠ.ؠ$֏, reason: contains not printable characters */
    public static final class C3937 implements InterfaceC3939.InterfaceC3940 {

        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public final InterfaceC4095.InterfaceC4096 f12325;

        public C3937(InterfaceC4095.InterfaceC4096 interfaceC4096) {
            this.f12325 = interfaceC4096;
        }

        @Override // p138.p176.p177.p190.p217.p224.InterfaceC3939.InterfaceC3940
        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public InterfaceC3939 mo6367(InterfaceC4110 interfaceC4110, C3942 c3942, int i, InterfaceC4036 interfaceC4036, InterfaceC4115 interfaceC4115) {
            InterfaceC4095 interfaceC4095Mo1286 = this.f12325.mo1286();
            if (interfaceC4115 != null) {
                interfaceC4095Mo1286.mo6121(interfaceC4115);
            }
            return new C3936(interfaceC4110, c3942, i, interfaceC4036, interfaceC4095Mo1286);
        }
    }

    /* JADX INFO: renamed from: ދ.ހ.֏.ؠ.ໞ.ޠ.ؠ$ؠ, reason: contains not printable characters */
    public static final class C3938 extends AbstractC3834 {
        public C3938(C3942.C3944 c3944, int i, int i2) {
            super(i2, c3944.f12361 - 1);
        }
    }

    public C3936(InterfaceC4110 interfaceC4110, C3942 c3942, int i, InterfaceC4036 interfaceC4036, InterfaceC4095 interfaceC4095) {
        this.f12317 = interfaceC4110;
        this.f12322 = c3942;
        this.f12318 = i;
        this.f12321 = interfaceC4036;
        this.f12320 = interfaceC4095;
        C3942.C3944 c3944 = c3942.f12345[i];
        this.f12319 = new C3837[interfaceC4036.length()];
        int i2 = 0;
        while (i2 < this.f12319.length) {
            int iMo6478 = interfaceC4036.mo6478(i2);
            C3431 c3431 = c3944.f12360[iMo6478];
            int i3 = i2;
            this.f12319[i3] = new C3837(new C3620(3, null, new C3630(iMo6478, c3944.f12351, c3944.f12353, -9223372036854775807L, c3942.f12346, c3431, 0, c3431.f10093 != null ? c3942.f12344.f12350 : null, c3944.f12351 == 2 ? 4 : 0, null, null), Collections.emptyList()), c3944.f12351, c3431);
            i2 = i3 + 1;
        }
    }

    @Override // p138.p176.p177.p190.p217.p219.InterfaceC3844
    /* JADX INFO: renamed from: ֏ */
    public int mo6227(long j, List<? extends AbstractC3848> list) {
        return (this.f12324 != null || this.f12321.length() < 2) ? list.size() : this.f12321.mo6470(j, list);
    }

    @Override // p138.p176.p177.p190.p217.p219.InterfaceC3844
    /* JADX INFO: renamed from: ֏ */
    public long mo6228(long j, C3453 c3453) {
        C3942.C3944 c3944 = this.f12322.f12345[this.f12318];
        int iM6787 = C4150.m6787(c3944.f12365, j, true, true);
        long[] jArr = c3944.f12365;
        long j2 = jArr[iM6787];
        return C4150.m6752(j, c3453, j2, (j2 >= j || iM6787 >= c3944.f12361 - 1) ? j2 : jArr[iM6787 + 1]);
    }

    @Override // p138.p176.p177.p190.p217.p219.InterfaceC3844
    /* JADX INFO: renamed from: ֏ */
    public void mo6229() throws IOException {
        IOException iOException = this.f12324;
        if (iOException != null) {
            throw iOException;
        }
        this.f12317.mo1233();
    }

    @Override // p138.p176.p177.p190.p217.p219.InterfaceC3844
    /* JADX INFO: renamed from: ֏ */
    public final void mo6230(long j, long j2, List<? extends AbstractC3848> list, C3840 c3840) {
        int iMo6233;
        long jM6369;
        if (this.f12324 != null) {
            return;
        }
        C3942.C3944 c3944 = this.f12322.f12345[this.f12318];
        if (c3944.f12361 == 0) {
            c3840.f11830 = !r1.f12343;
            return;
        }
        if (list.isEmpty()) {
            iMo6233 = C4150.m6787(c3944.f12365, j2, true, true);
        } else {
            iMo6233 = (int) (list.get(list.size() - 1).mo6233() - ((long) this.f12323));
            if (iMo6233 < 0) {
                this.f12324 = new BehindLiveWindowException();
                return;
            }
        }
        int i = iMo6233;
        if (i >= c3944.f12361) {
            c3840.f11830 = !this.f12322.f12343;
            return;
        }
        long j3 = j2 - j;
        C3942 c3942 = this.f12322;
        if (c3942.f12343) {
            C3942.C3944 c39442 = c3942.f12345[this.f12318];
            int i2 = c39442.f12361 - 1;
            jM6369 = (c39442.m6369(i2) + c39442.f12365[i2]) - j;
        } else {
            jM6369 = -9223372036854775807L;
        }
        int length = this.f12321.length();
        InterfaceC3849[] interfaceC3849Arr = new InterfaceC3849[length];
        for (int i3 = 0; i3 < length; i3++) {
            interfaceC3849Arr[i3] = new C3938(c3944, this.f12321.mo6478(i3), i);
        }
        this.f12321.mo6309(j, j3, jM6369, list, interfaceC3849Arr);
        long j4 = c3944.f12365[i];
        long jM63692 = c3944.m6369(i) + j4;
        long j5 = list.isEmpty() ? j2 : -9223372036854775807L;
        int i4 = i + this.f12323;
        int iMo6311 = this.f12321.mo6311();
        C3837 c3837 = this.f12319[iMo6311];
        int iMo6478 = this.f12321.mo6478(iMo6311);
        C0567.m1932(c3944.f12360 != null);
        C0567.m1932(c3944.f12364 != null);
        C0567.m1932(i < c3944.f12364.size());
        String string = Integer.toString(c3944.f12360[iMo6478].f10086);
        String string2 = c3944.f12364.get(i).toString();
        c3840.f11829 = new C3845(this.f12320, new C4098(C0567.m1934(c3944.f12362, c3944.f12363.replace("{bitrate}", string).replace("{Bitrate}", string).replace("{start time}", string2).replace("{start_time}", string2)), 0L, -1L, null), this.f12321.mo6483(), this.f12321.mo6310(), this.f12321.mo6312(), j4, jM63692, j5, -9223372036854775807L, i4, 1, j4, c3837);
    }

    @Override // p138.p176.p177.p190.p217.p219.InterfaceC3844
    /* JADX INFO: renamed from: ֏ */
    public void mo6231(AbstractC3836 abstractC3836) {
    }

    @Override // p138.p176.p177.p190.p217.p224.InterfaceC3939
    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public void mo6365(C3942 c3942) {
        C3942.C3944[] c3944Arr = this.f12322.f12345;
        int i = this.f12318;
        C3942.C3944 c3944 = c3944Arr[i];
        int i2 = c3944.f12361;
        C3942.C3944 c39442 = c3942.f12345[i];
        if (i2 == 0 || c39442.f12361 == 0) {
            this.f12323 += i2;
        } else {
            int i3 = i2 - 1;
            long jM6369 = c3944.m6369(i3) + c3944.f12365[i3];
            long j = c39442.f12365[0];
            if (jM6369 <= j) {
                this.f12323 += i2;
            } else {
                this.f12323 = c3944.m6368(j) + this.f12323;
            }
        }
        this.f12322 = c3942;
    }

    @Override // p138.p176.p177.p190.p217.p224.InterfaceC3939
    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public void mo6366(InterfaceC4036 interfaceC4036) {
        this.f12321 = interfaceC4036;
    }

    @Override // p138.p176.p177.p190.p217.p219.InterfaceC3844
    /* JADX INFO: renamed from: ֏ */
    public boolean mo6232(AbstractC3836 abstractC3836, boolean z, Exception exc, long j) {
        if (z && j != -9223372036854775807L) {
            InterfaceC4036 interfaceC4036 = this.f12321;
            if (interfaceC4036.mo6476(interfaceC4036.mo6474(abstractC3836.f11807), j)) {
                return true;
            }
        }
        return false;
    }
}
