package defpackage;

import android.net.Uri;
import android.os.Looper;
import androidx.media3.common.ParserException;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

/* renamed from: ᵥʦʨᵲ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public final class C3484 extends AbstractC3587 {

    /* renamed from: ˁˑᵰ, reason: contains not printable characters */
    public final long f13043;

    /* renamed from: ˎˑː, reason: contains not printable characters */
    public final ˉːᵡ f13044;

    /* renamed from: ˑᵥˁ, reason: contains not printable characters */
    public final C2931 f13045;

    /* renamed from: ᐧﾞ, reason: contains not printable characters */
    public final int f13046;

    /* renamed from: ᵙᵢᵨᵳ, reason: contains not printable characters */
    public C3873 f13047;

    /* renamed from: ᵡˎ, reason: contains not printable characters */
    public final C1733 f13048;

    /* renamed from: ᵡᵘˎʽ, reason: contains not printable characters */
    public C0346 f13049;

    /* renamed from: ᵧـˌᵎ, reason: contains not printable characters */
    public final C1899 f13050;

    /* renamed from: ᵮᵠـˌ, reason: contains not printable characters */
    public final InterfaceC0687 f13051;

    /* renamed from: ᵶʔᵢˊ, reason: contains not printable characters */
    public final C1105 f13052;

    /* renamed from: ᵺʙ, reason: contains not printable characters */
    public final boolean f13053;

    /* renamed from: ﾞⁱ, reason: contains not printable characters */
    public C0112 f13054;

    static {
        AbstractC2483.m6325("media3.exoplayer.hls");
    }

    public C3484(C0346 c0346, C2931 c2931, C1733 c1733, ˉːᵡ r4, InterfaceC0687 interfaceC0687, C1899 c1899, C1105 c1105, long j, boolean z, int i) {
        this.f13049 = c0346;
        this.f13054 = c0346.f2061;
        this.f13045 = c2931;
        this.f13048 = c1733;
        this.f13044 = r4;
        this.f13051 = interfaceC0687;
        this.f13050 = c1899;
        this.f13052 = c1105;
        this.f13043 = j;
        this.f13053 = z;
        this.f13046 = i;
    }

    /* renamed from: ᵾᵬ, reason: contains not printable characters */
    public static C2875 m7923(long j, List list) {
        C2875 c2875 = null;
        for (int i = 0; i < list.size(); i++) {
            C2875 c28752 = (C2875) list.get(i);
            long j2 = c28752.f1201;
            if (j2 > j || !c28752.f11141) {
                if (j2 > j) {
                    break;
                }
            } else {
                c2875 = c28752;
            }
        }
        return c2875;
    }

    @Override // defpackage.InterfaceC4865
    /* renamed from: ˎˏʜʾ */
    public final InterfaceC3757 mo2928(C2477 c2477, ᵧˉʙ r16, long j) {
        C4782 c4782M8200 = m8200(c2477);
        C2221 c2221 = new C2221(this.f13402.f8731, 0, c2477);
        C3873 c3873 = this.f13047;
        C1545 c1545 = this.f13397;
        c1545.getClass();
        return new C4946(this.f13048, this.f13052, this.f13045, c3873, this.f13051, c2221, this.f13050, c4782M8200, r16, this.f13044, this.f13053, this.f13046, c1545);
    }

    @Override // defpackage.AbstractC3587
    /* renamed from: ˑᵱ */
    public final void mo2929(C3873 c3873) {
        this.f13047 = c3873;
        Looper looperMyLooper = Looper.myLooper();
        looperMyLooper.getClass();
        C1545 c1545 = this.f13397;
        c1545.getClass();
        InterfaceC0687 interfaceC0687 = this.f13051;
        interfaceC0687.mo2673(looperMyLooper, c1545);
        interfaceC0687.mo2670();
        C4782 c4782M8200 = m8200(null);
        C4962 c4962 = mo2934().f2063;
        c4962.getClass();
        Uri uri = c4962.f18441;
        C1105 c1105 = this.f13052;
        c1105.getClass();
        c1105.f4758 = AbstractC3558.m8130(null);
        c1105.f4760 = c4782M8200;
        c1105.f4755 = this;
        Map map = Collections.EMPTY_MAP;
        ᵛᵾˏ.ᵨᵳʝ(uri, "The uri must be set.");
        C3934 c3934 = new C3934(((InterfaceC1731) c1105.f4764.f11366).mo4930(), new C4179(uri, 1, null, map, 0L, -1L, null, 1), 4, c1105.f4761.m5772());
        ᵛᵾˏ.ᵿʗᵝʽ(c1105.f4752 == null);
        ᵧˉʙ r14 = new ᵧˉʙ(2, "DefaultHlsPlaylistTracker:MultivariantPlaylist");
        c1105.f4752 = r14;
        r14.ᵡᵘˎʽ(c3934, c1105, c1105.f4769.m5319(c3934.f14856));
    }

    @Override // defpackage.AbstractC3587
    /* renamed from: ᵢˇᵭ */
    public final void mo2930() {
        C1105 c1105 = this.f13052;
        c1105.f4753 = null;
        c1105.f4770 = null;
        c1105.f4754 = null;
        c1105.f4763 = null;
        c1105.f4767 = null;
        c1105.f4756 = null;
        c1105.f4766 = null;
        c1105.f4765 = null;
        c1105.f4759 = -9223372036854775807L;
        c1105.f4752.ˁˑᵰ((InterfaceC2428) null);
        c1105.f4752 = null;
        HashMap map = c1105.f4768;
        Iterator it = map.values().iterator();
        while (it.hasNext()) {
            Iterator it2 = ((C5426) it.next()).f20340.values().iterator();
            while (it2.hasNext()) {
                ((C4333) it2.next()).f16225.ˁˑᵰ((InterfaceC2428) null);
            }
        }
        c1105.f4758.removeCallbacksAndMessages(null);
        c1105.f4758 = null;
        map.clear();
        this.f13051.mo2672();
    }

    /* renamed from: ᵤᵙᵷ, reason: contains not printable characters */
    public final void m7924(C1734 c1734) {
        long j;
        C4260 c4260;
        long j2;
        long jM8133;
        long j3;
        boolean z = c1734.f6911;
        boolean z2 = c1734.f6913;
        AbstractC2692 abstractC2692 = c1734.f6926;
        long j4 = c1734.f6915;
        long jM81332 = c1734.f6910;
        int i = c1734.f6929;
        long j5 = c1734.f6928;
        long jM8161 = z ? AbstractC3558.m8161(j5) : -9223372036854775807L;
        long j6 = (i == 2 || i == 1) ? jM8161 : -9223372036854775807L;
        C1105 c1105 = this.f13052;
        c1105.f4754.getClass();
        ᵼᵫᵧˀ r15 = new ᵼᵫᵧˀ(27);
        long j7 = 0;
        if (c1105.f4757) {
            C3143 c3143 = c1734.f6920;
            long j8 = j5 - c1105.f4759;
            boolean z3 = c1734.f6924;
            long j9 = z3 ? j8 + j4 : -9223372036854775807L;
            long jM81333 = c1734.f6911 ? AbstractC3558.m8133(AbstractC3558.m8117(this.f13043)) - (j5 + j4) : 0L;
            long j10 = this.f13054.f1416;
            if (j10 != -9223372036854775807L) {
                jM8133 = AbstractC3558.m8133(j10);
            } else {
                if (jM81332 != -9223372036854775807L) {
                    j2 = j4 - jM81332;
                } else {
                    j2 = c3143.f11950;
                    if (j2 == -9223372036854775807L || c1734.f6922 == -9223372036854775807L) {
                        j2 = c3143.f11947;
                        if (j2 == -9223372036854775807L) {
                            j2 = 3 * c1734.f6923;
                        }
                    }
                }
                jM8133 = j2 + jM81333;
            }
            long j11 = j4 + jM81333;
            long jM8153 = AbstractC3558.m8153(jM8133, jM81333, j11);
            C0112 c0112 = mo2934().f2061;
            boolean z4 = c0112.f1418 == -3.4028235E38f && c0112.f1414 == -3.4028235E38f && c3143.f11947 == -9223372036854775807L && c3143.f11950 == -9223372036854775807L;
            C2266 c2266M1213 = this.f13054.m1213();
            c2266M1213.f8852 = AbstractC3558.m8161(jM8153);
            c2266M1213.f8854 = z4 ? 1.0f : this.f13054.f1418;
            c2266M1213.f8850 = z4 ? 1.0f : this.f13054.f1414;
            C0112 c01122 = new C0112(c2266M1213);
            this.f13054 = c01122;
            if (jM81332 == -9223372036854775807L) {
                jM81332 = j11 - AbstractC3558.m8133(c01122.f1416);
            }
            if (z2) {
                j7 = jM81332;
            } else {
                C2875 c2875M7923 = m7923(jM81332, c1734.f6917);
                if (c2875M7923 != null) {
                    j3 = c2875M7923.f1201;
                } else if (!abstractC2692.isEmpty()) {
                    C1671 c1671 = (C1671) abstractC2692.get(AbstractC3558.m8120(abstractC2692, Long.valueOf(jM81332), true));
                    C2875 c2875M79232 = m7923(jM81332, c1671.f6665);
                    j3 = c2875M79232 != null ? c2875M79232.f1201 : c1671.f1201;
                }
                j7 = j3;
            }
            c4260 = new C4260(j6, jM8161, j9, c1734.f6915, j8, j7, true, !z3, i == 2 && c1734.f6914, r15, mo2934(), this.f13054);
        } else {
            if (jM81332 == -9223372036854775807L || abstractC2692.isEmpty()) {
                j = 0;
            } else {
                if (!z2 && jM81332 != j4) {
                    jM81332 = ((C1671) abstractC2692.get(AbstractC3558.m8120(abstractC2692, Long.valueOf(jM81332), true))).f1201;
                }
                j = jM81332;
            }
            long j12 = c1734.f6915;
            c4260 = new C4260(j6, jM8161, j12, j12, 0L, j, true, false, true, r15, mo2934(), null);
        }
        m8197(c4260);
    }

    @Override // defpackage.InterfaceC4865
    /* renamed from: ᵪʩ */
    public final synchronized void mo2931(C0346 c0346) {
        this.f13049 = c0346;
    }

    @Override // defpackage.InterfaceC4865
    /* renamed from: ᵳٴᵶ */
    public final void mo2932(InterfaceC3757 interfaceC3757) {
        C4946 c4946 = (C4946) interfaceC3757;
        c4946.f18390.f4762.remove(c4946);
        for (C1755 c1755 : c4946.f18382) {
            if (c1755.f7039) {
                for (C1665 c1665 : c1755.f7009) {
                    c1665.m4763();
                    InterfaceC1660 interfaceC1660 = c1665.f6628;
                    if (interfaceC1660 != null) {
                        interfaceC1660.mo4742(c1665.f6599);
                        c1665.f6628 = null;
                        c1665.f6602 = null;
                    }
                }
            }
            C1380 c1380 = c1755.f7050;
            int iMo5372 = c1380.f5679.mo5372();
            C1105 c1105 = c1380.f5667;
            Uri uriM10180 = c1380.f5664[iMo5372].m10180();
            C5426 c5426 = (C5426) c1105.f4768.get(uriM10180);
            if (c5426 != null) {
                C4333 c4333 = (C4333) AbstractC3915.m8585(c5426.f20340, uriM10180, uriM10180);
                c4333.getClass();
                c4333.f16220 = false;
            }
            c1380.f5674 = null;
            c1755.f7018.ˁˑᵰ(c1755);
            c1755.f7023.removeCallbacksAndMessages(null);
            c1755.f7045 = true;
            c1755.f7028.clear();
        }
        c4946.f18399 = null;
    }

    @Override // defpackage.InterfaceC4865
    /* renamed from: ᵸˑ */
    public final void mo2933() throws ParserException {
        C1105 c1105 = this.f13052;
        ᵧˉʙ r0 = c1105.f4752;
        if (r0 != null) {
            r0.ᵴᵳ();
        }
        ParserException parserException = c1105.f4765;
        if (parserException != null) {
            throw parserException;
        }
        Uri uri = c1105.f4753;
        if (uri != null) {
            c1105.m3516(uri);
        }
    }

    @Override // defpackage.InterfaceC4865
    /* renamed from: ᵹᵝᵶ */
    public final synchronized C0346 mo2934() {
        return this.f13049;
    }
}
