package defpackage;

import androidx.media3.common.ParserException;
import j$.util.Objects;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;

/* JADX INFO: renamed from: ᵳـᵯ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes3.dex */
public final class C4583 implements InterfaceC4291 {

    /* JADX INFO: renamed from: ʽˈˋ, reason: contains not printable characters */
    public final int f17427;

    /* JADX INFO: renamed from: ʿٴˇ, reason: contains not printable characters */
    public C2568 f17428;

    /* JADX INFO: renamed from: ˈᵲᵢ, reason: contains not printable characters */
    public InterfaceC4550 f17429;

    /* JADX INFO: renamed from: ˉᵲ, reason: contains not printable characters */
    public int f17430;

    /* JADX INFO: renamed from: ˊᵙᵾᵲ, reason: contains not printable characters */
    public int f17431;

    /* JADX INFO: renamed from: ˊᵨᵧ, reason: contains not printable characters */
    public boolean f17432;

    /* JADX INFO: renamed from: ˊᵫᵗ, reason: contains not printable characters */
    public final ArrayDeque f17433;

    /* JADX INFO: renamed from: ˋˈ, reason: contains not printable characters */
    public long f17434;

    /* JADX INFO: renamed from: ˌᴵ, reason: contains not printable characters */
    public boolean f17435;

    /* JADX INFO: renamed from: ˌᵨʠᵫ, reason: contains not printable characters */
    public C4939[] f17436;

    /* JADX INFO: renamed from: ˏːˆ, reason: contains not printable characters */
    public int f17437;

    /* JADX INFO: renamed from: ːˏᵟᵯ, reason: contains not printable characters */
    public final boolean f17438;

    /* JADX INFO: renamed from: ˑˊᵲ, reason: contains not printable characters */
    public int f17439;

    /* JADX INFO: renamed from: ᵔᵖᵹᵫ, reason: contains not printable characters */
    public long f17440;

    /* JADX INFO: renamed from: ᵜᵪʾ, reason: contains not printable characters */
    public boolean f17441;

    /* JADX INFO: renamed from: ᵝᵶ, reason: contains not printable characters */
    public int f17442;

    /* JADX INFO: renamed from: ᵟᵹᵙ, reason: contains not printable characters */
    public C4545 f17443;

    /* JADX INFO: renamed from: ᵨᵣ, reason: contains not printable characters */
    public final C4545 f17444;

    /* JADX INFO: renamed from: ᵨᵼⁱ, reason: contains not printable characters */
    public boolean f17445;

    /* JADX INFO: renamed from: ᵪᵹᵥᵻ, reason: contains not printable characters */
    public int f17446;

    /* JADX INFO: renamed from: ᵮᵣᵗˈ, reason: contains not printable characters */
    public int f17447;

    /* JADX INFO: renamed from: ᵯᵷʽ, reason: contains not printable characters */
    public boolean f17448;

    /* JADX INFO: renamed from: ᵱʡˏ, reason: contains not printable characters */
    public int f17449;

    /* JADX INFO: renamed from: ᵱᵽʡᵚ, reason: contains not printable characters */
    public final ArrayList f17450;

    /* JADX INFO: renamed from: ᵲᵶᵳˈ, reason: contains not printable characters */
    public final InterfaceC1471 f17451;

    /* JADX INFO: renamed from: ᵵᵽ, reason: contains not printable characters */
    public final C4545 f17452;

    /* JADX INFO: renamed from: ᵶˇᵱ, reason: contains not printable characters */
    public long f17453;

    /* JADX INFO: renamed from: ᵶᵥᵝ, reason: contains not printable characters */
    public C2598 f17454;

    /* JADX INFO: renamed from: ᵷᵺʾᵖ, reason: contains not printable characters */
    public final C4545 f17455;

    /* JADX INFO: renamed from: ᵸˆˁ, reason: contains not printable characters */
    public long[][] f17456;

    /* JADX INFO: renamed from: ᵻʽᵯ, reason: contains not printable characters */
    public final C4701 f17457;

    /* JADX INFO: renamed from: ᵻˈᵦʼ, reason: contains not printable characters */
    public final C4545 f17458;

    public C4583(InterfaceC1471 interfaceC1471, int i) {
        this.f17451 = interfaceC1471;
        this.f17427 = i;
        this.f17438 = (i & 256) != 0;
        C2822 c2822 = AbstractC4509.f17159;
        this.f17454 = C2598.f10048;
        this.f17447 = (i & 4) != 0 ? 3 : 0;
        this.f17457 = new C4701();
        this.f17450 = new ArrayList();
        this.f17452 = new C4545(16);
        this.f17433 = new ArrayDeque();
        this.f17455 = new C4545(ᵥˇᵛˎ.ːˏᵟᵯ);
        this.f17444 = new C4545(6);
        this.f17458 = new C4545();
        this.f17449 = -1;
        this.f17429 = InterfaceC4550.f17293;
        this.f17436 = new C4939[0];
    }

    @Override // defpackage.InterfaceC4291
    /* JADX INFO: renamed from: ʽˈˋ */
    public final void mo1252(long j, long j2) {
        this.f17433.clear();
        this.f17446 = 0;
        this.f17449 = -1;
        this.f17431 = 0;
        this.f17430 = 0;
        this.f17437 = 0;
        this.f17432 = false;
        this.f17448 = false;
        if (j == 0) {
            if (this.f17447 != 3) {
                this.f17447 = 0;
                this.f17446 = 0;
                return;
            } else {
                C4701 c4701 = this.f17457;
                c4701.f17876.clear();
                c4701.f17874 = 0;
                this.f17450.clear();
                return;
            }
        }
        for (C4939 c4939 : this.f17436) {
            C0138 c0138 = c4939.f18758;
            int iM1251 = c0138.m1251(j2);
            if (iM1251 == -1) {
                iM1251 = c0138.m1250(j2);
            }
            c4939.f18760 = iM1251;
            C0246 c0246 = c4939.f18762;
            if (c0246 != null) {
                c0246.f1811 = false;
                c0246.f1812 = 0;
            }
        }
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Removed duplicated region for block: B:165:0x0334  */
    /* JADX WARN: Removed duplicated region for block: B:166:0x0344  */
    /* JADX WARN: Removed duplicated region for block: B:175:0x0360  */
    /* JADX WARN: Removed duplicated region for block: B:177:0x0364  */
    /* JADX WARN: Removed duplicated region for block: B:180:0x0387  */
    /* JADX WARN: Removed duplicated region for block: B:182:0x0390  */
    /* JADX WARN: Removed duplicated region for block: B:20:0x0072  */
    /* JADX WARN: Removed duplicated region for block: B:264:0x0148 A[EDGE_INSN: B:264:0x0148->B:75:0x0148 BREAK  A[LOOP:9: B:63:0x0114->B:73:0x013f], SYNTHETIC] */
    /* JADX WARN: Removed duplicated region for block: B:37:0x00b5  */
    /* JADX WARN: Removed duplicated region for block: B:73:0x013f A[LOOP:9: B:63:0x0114->B:73:0x013f, LOOP_END] */
    /* JADX INFO: renamed from: ˊᵫᵗ, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final void m9660(long j) {
        char c;
        int i;
        ArrayList arrayList;
        C1956 c1956M1520;
        ArrayDeque arrayDeque;
        boolean z;
        boolean z2;
        C1956 c1956;
        C1956 c19562;
        boolean z3;
        ArrayList arrayList2;
        String str;
        C1956 c19563;
        ArrayList arrayList3;
        int i2;
        long j2;
        int i3;
        C1956 c19564;
        ArrayList arrayList4;
        int i4;
        int i5;
        int i6;
        int i7;
        InterfaceC2223 interfaceC2223;
        InterfaceC2223 interfaceC22232;
        InterfaceC2223 interfaceC22233;
        while (true) {
            ArrayDeque arrayDeque2 = this.f17433;
            if (arrayDeque2.isEmpty() || ((C3152) arrayDeque2.peek()).f12000 != j) {
                break;
            }
            C3152 c3152 = (C3152) arrayDeque2.pop();
            if (c3152.f9866 == 1836019574) {
                C3152 c3152M7259 = c3152.m7259(1835365473);
                ArrayList arrayList5 = new ArrayList();
                char c2 = 3;
                long[][] jArr = null;
                boolean z4 = this.f17438;
                long j3 = 0;
                int i8 = this.f17427;
                if (c3152M7259 != null) {
                    c1956M1520 = AbstractC0285.m1520(c3152M7259);
                    if (this.f17445) {
                        c1956M1520.getClass();
                        InterfaceC2223[] interfaceC2223Arr = c1956M1520.f7784;
                        int length = interfaceC2223Arr.length;
                        int i9 = 0;
                        while (true) {
                            if (i9 >= length) {
                                i = 0;
                                interfaceC22232 = null;
                                break;
                            }
                            InterfaceC2223 interfaceC22234 = interfaceC2223Arr[i9];
                            i = 0;
                            if (C0409.class.isAssignableFrom(interfaceC22234.getClass())) {
                                interfaceC22232 = (InterfaceC2223) C0409.class.cast(interfaceC22234);
                                if (!((C0409) interfaceC22232).f2321.equals("auxiliary.tracks.interleaved")) {
                                    interfaceC22232 = null;
                                }
                                if (interfaceC22232 != null) {
                                    break;
                                } else {
                                    i9++;
                                }
                            }
                        }
                        C0409 c0409 = (C0409) interfaceC22232;
                        if (c0409 != null && c0409.f2319[i] == 0) {
                            this.f17453 = this.f17440 + 16;
                        }
                        int length2 = interfaceC2223Arr.length;
                        int i10 = i;
                        while (true) {
                            if (i10 >= length2) {
                                interfaceC22233 = null;
                                break;
                            }
                            InterfaceC2223 interfaceC22235 = interfaceC2223Arr[i10];
                            if (C0409.class.isAssignableFrom(interfaceC22235.getClass())) {
                                interfaceC22233 = (InterfaceC2223) C0409.class.cast(interfaceC22235);
                                if (!((C0409) interfaceC22233).f2321.equals("auxiliary.tracks.map")) {
                                    interfaceC22233 = null;
                                }
                                if (interfaceC22233 != null) {
                                    break;
                                } else {
                                    i10++;
                                }
                            }
                        }
                        C0409 c04092 = (C0409) interfaceC22233;
                        c04092.getClass();
                        ArrayList arrayListM1759 = c04092.m1759();
                        ArrayList arrayList6 = new ArrayList(arrayListM1759.size());
                        for (int i11 = i; i11 < arrayListM1759.size(); i11++) {
                            int iIntValue = ((Integer) arrayListM1759.get(i11)).intValue();
                            arrayList6.add(Integer.valueOf(iIntValue != 0 ? iIntValue != 1 ? iIntValue != 2 ? iIntValue != 3 ? i : 4 : 3 : 2 : 1));
                        }
                        arrayList = arrayList6;
                        c = 3;
                    } else {
                        i = 0;
                        if (c1956M1520 == null || (i8 & 64) == 0) {
                            c = 3;
                        } else {
                            InterfaceC2223[] interfaceC2223Arr2 = c1956M1520.f7784;
                            int length3 = interfaceC2223Arr2.length;
                            int i12 = 0;
                            while (true) {
                                if (i12 >= length3) {
                                    c = c2;
                                    interfaceC2223 = null;
                                    break;
                                }
                                InterfaceC2223 interfaceC22236 = interfaceC2223Arr2[i12];
                                if (C0409.class.isAssignableFrom(interfaceC22236.getClass())) {
                                    interfaceC2223 = (InterfaceC2223) C0409.class.cast(interfaceC22236);
                                    c = c2;
                                    if (!((C0409) interfaceC2223).f2321.equals("auxiliary.tracks.offset")) {
                                    }
                                    if (interfaceC2223 == null) {
                                        break;
                                    }
                                    i12++;
                                    c2 = c;
                                } else {
                                    c = c2;
                                }
                                interfaceC2223 = null;
                                if (interfaceC2223 == null) {
                                }
                            }
                            C0409 c04093 = (C0409) interfaceC2223;
                            if (c04093 != null) {
                                long jM9616 = new C4545(c04093.f2319).m9616();
                                if (jM9616 > 0) {
                                    this.f17440 = jM9616;
                                    this.f17441 = true;
                                    arrayDeque = arrayDeque2;
                                    z2 = z4;
                                    z = true;
                                    arrayDeque.clear();
                                    this.f17448 = z;
                                    if (this.f17441 && !z2) {
                                        this.f17447 = 2;
                                    }
                                }
                            }
                        }
                        arrayList = arrayList5;
                    }
                } else {
                    c = 3;
                    i = 0;
                    arrayList = arrayList5;
                    c1956M1520 = null;
                }
                ArrayList arrayList7 = new ArrayList();
                boolean z5 = this.f17439 == 1 ? 1 : i;
                C3716 c3716 = new C3716();
                C1488 c1488M7258 = c3152.m7258(1969517665);
                if (c1488M7258 != null) {
                    C1956 c1956M1517 = AbstractC0285.m1517(c1488M7258);
                    c3716.m8382(c1956M1517);
                    c1956 = c1956M1517;
                } else {
                    c1956 = null;
                }
                C1488 c1488M72582 = c3152.m7258(1836476516);
                c1488M72582.getClass();
                InterfaceC2223[] interfaceC2223Arr3 = new InterfaceC2223[1];
                interfaceC2223Arr3[i] = AbstractC0285.m1516(c1488M72582.f6025);
                C1956 c19565 = new C1956(interfaceC2223Arr3);
                if ((i8 & 1) != 0) {
                    c19562 = c19565;
                    z3 = 1;
                } else {
                    c19562 = c19565;
                    z3 = i;
                }
                C1956 c19566 = c19562;
                z2 = z4;
                ArrayList arrayListM1514 = AbstractC0285.m1514(c3152, c3716, -9223372036854775807L, null, z3, z5, new C3821(15), this.f17438);
                if (this.f17445) {
                    boolean z6 = arrayList.size() == arrayListM1514.size() ? 1 : i;
                    Locale locale = Locale.US;
                    ᵻᵪ.ˊᵨᵧ("The number of auxiliary track types from metadata (" + arrayList.size() + ") is not same as the number of auxiliary tracks (" + arrayListM1514.size() + ")", z6);
                }
                String str2 = ᵻᵪ.ˌᵨʠᵫ(arrayListM1514);
                int i13 = i;
                int i14 = i13;
                long j4 = -9223372036854775807L;
                int size = -1;
                while (i13 < arrayListM1514.size()) {
                    C0138 c0138 = (C0138) arrayListM1514.get(i13);
                    int i15 = c0138.f1479;
                    ArrayDeque arrayDeque3 = arrayDeque2;
                    long[] jArr2 = c0138.f1488;
                    C2476 c2476 = c0138.f1484;
                    if (i15 == 0) {
                        arrayList3 = arrayList;
                        arrayList2 = arrayListM1514;
                        str = str2;
                        i2 = i13;
                        arrayList4 = arrayList7;
                        c19563 = c1956;
                    } else {
                        arrayList2 = arrayListM1514;
                        str = str2;
                        InterfaceC4550 interfaceC4550 = this.f17429;
                        int i16 = i14 + 1;
                        c19563 = c1956;
                        int i17 = c2476.f9603;
                        ArrayList arrayList8 = arrayList7;
                        C5286 c5286 = c2476.f9610;
                        InterfaceC5226 interfaceC5226Mo2743 = interfaceC4550.mo2743(i14, i17);
                        C4939 c4939 = new C4939(c2476, c0138, interfaceC5226Mo2743);
                        long j5 = c2476.f9606;
                        if (j5 == -9223372036854775807L) {
                            j5 = c0138.f1487;
                        }
                        interfaceC5226Mo2743.mo1743(j5);
                        long jMax = Math.max(j4, j5);
                        String str3 = c5286.f19987;
                        String str4 = c5286.f19987;
                        boolean zEquals = "audio/true-hd".equals(str3);
                        int i18 = c0138.f1482;
                        int i19 = zEquals ? i18 * 16 : i18 + 30;
                        C4753 c4753M10878 = c5286.m10878();
                        c4753M10878.f18116 = i19;
                        if (i17 == 2) {
                            int i20 = c5286.f20000;
                            if ((i8 & 8) != 0) {
                                i20 |= size == -1 ? 1 : 2;
                            }
                            int i21 = i20;
                            if (this.f17445) {
                                i7 = i21 | 32768;
                                arrayList3 = arrayList;
                                c4753M10878.f18123 = ((Integer) arrayList.get(i13)).intValue();
                            } else {
                                arrayList3 = arrayList;
                                i7 = i21;
                            }
                            c4753M10878.f18129 = i7;
                        } else {
                            arrayList3 = arrayList;
                        }
                        int[] iArr = c0138.f1480;
                        boolean z7 = c0138.f1483;
                        if (!AbstractC4208.m9134(str4) || jArr2.length <= 0) {
                            i2 = i13;
                        } else {
                            int iMin = Math.min(z7 ? c0138.f1479 : iArr.length, 20);
                            ᵻᵪ.ˌᴵ(j5 != -9223372036854775807L ? 1 : i);
                            i2 = i13;
                            long jMin = Math.min(j5, 10000000L);
                            int i22 = i;
                            int i23 = i22;
                            int i24 = -1;
                            while (i22 < iMin) {
                                int i25 = z7 ? i22 : iArr[i22];
                                long j6 = jArr2[i25];
                                if (j6 > jMin) {
                                    break;
                                }
                                if (j6 >= 0) {
                                    i6 = iMin;
                                    int i26 = c0138.f1486[i25];
                                    if (i26 > i23) {
                                        i23 = i26;
                                        i24 = i25;
                                    }
                                } else {
                                    i6 = iMin;
                                }
                                i22++;
                                iMin = i6;
                            }
                            if (i24 != -1) {
                                j2 = jArr2[i24];
                            }
                            if (j2 == -9223372036854775807L) {
                                C3138 c3138 = new C3138(j2);
                                i3 = 1;
                                InterfaceC2223[] interfaceC2223Arr4 = new InterfaceC2223[1];
                                interfaceC2223Arr4[i] = c3138;
                                c19564 = new C1956(interfaceC2223Arr4);
                            } else {
                                i3 = 1;
                                c19564 = null;
                            }
                            if (i17 == i3 && (i4 = c3716.f14152) != -1 && (i5 = c3716.f14151) != -1) {
                                c4753M10878.f18092 = i4;
                                c4753M10878.f18091 = i5;
                            }
                            C1956 c19567 = c5286.f19988;
                            ArrayList arrayList9 = this.f17450;
                            C1956[] c1956Arr = new C1956[4];
                            c1956Arr[i] = !arrayList9.isEmpty() ? null : new C1956(arrayList9);
                            c1956Arr[i3] = c19563;
                            c1956Arr[2] = c19566;
                            c1956Arr[c] = c19564;
                            ᵹˊᵫˋ.ˌᴵ(i17, c1956M1520, c4753M10878, c19567, c1956Arr);
                            c4753M10878.f18111 = AbstractC4208.m9132(str);
                            if (Objects.equals(str4, "audio/mpeg")) {
                                AbstractC0659.m2415(c4753M10878, c4939.f18759);
                            } else {
                                c4939.f18763 = new C5286(c4753M10878);
                            }
                            if (i17 == 2 && size == -1) {
                                size = arrayList8.size();
                            }
                            arrayList4 = arrayList8;
                            arrayList4.add(c4939);
                            i14 = i16;
                            j4 = jMax;
                        }
                        j2 = -9223372036854775807L;
                        if (j2 == -9223372036854775807L) {
                        }
                        if (i17 == i3) {
                            c4753M10878.f18092 = i4;
                            c4753M10878.f18091 = i5;
                        }
                        C1956 c195672 = c5286.f19988;
                        ArrayList arrayList92 = this.f17450;
                        C1956[] c1956Arr2 = new C1956[4];
                        c1956Arr2[i] = !arrayList92.isEmpty() ? null : new C1956(arrayList92);
                        c1956Arr2[i3] = c19563;
                        c1956Arr2[2] = c19566;
                        c1956Arr2[c] = c19564;
                        ᵹˊᵫˋ.ˌᴵ(i17, c1956M1520, c4753M10878, c195672, c1956Arr2);
                        c4753M10878.f18111 = AbstractC4208.m9132(str);
                        if (Objects.equals(str4, "audio/mpeg")) {
                        }
                        if (i17 == 2) {
                            size = arrayList8.size();
                        }
                        arrayList4 = arrayList8;
                        arrayList4.add(c4939);
                        i14 = i16;
                        j4 = jMax;
                    }
                    i13 = i2 + 1;
                    arrayList7 = arrayList4;
                    arrayDeque2 = arrayDeque3;
                    arrayListM1514 = arrayList2;
                    str2 = str;
                    c1956 = c19563;
                    arrayList = arrayList3;
                }
                arrayDeque = arrayDeque2;
                int i27 = -1;
                boolean z8 = true;
                C4939[] c4939Arr = (C4939[]) arrayList7.toArray(new C4939[i]);
                this.f17436 = c4939Arr;
                if (!z2) {
                    long[][] jArr3 = new long[c4939Arr.length][];
                    int[] iArr2 = new int[c4939Arr.length];
                    long[] jArr4 = new long[c4939Arr.length];
                    boolean[] zArr = new boolean[c4939Arr.length];
                    for (int i28 = 0; i28 < c4939Arr.length; i28++) {
                        jArr3[i28] = new long[c4939Arr[i28].f18758.f1479];
                        jArr4[i28] = c4939Arr[i28].f18758.f1488[0];
                    }
                    int i29 = 0;
                    while (i29 < c4939Arr.length) {
                        long j7 = Long.MAX_VALUE;
                        int i30 = i27;
                        for (int i31 = 0; i31 < c4939Arr.length; i31++) {
                            if (!zArr[i31]) {
                                long j8 = jArr4[i31];
                                if (j8 <= j7) {
                                    i30 = i31;
                                    j7 = j8;
                                }
                            }
                        }
                        int i32 = iArr2[i30];
                        long[] jArr5 = jArr3[i30];
                        jArr5[i32] = j3;
                        C0138 c01382 = c4939Arr[i30].f18758;
                        boolean z9 = z8;
                        long[][] jArr6 = jArr3;
                        j3 += (long) c01382.f1486[i32];
                        int i33 = i32 + 1;
                        iArr2[i30] = i33;
                        if (i33 < jArr5.length) {
                            jArr4[i30] = c01382.f1488[i33];
                        } else {
                            zArr[i30] = z9;
                            i29++;
                        }
                        jArr3 = jArr6;
                        z8 = z9;
                        i27 = -1;
                    }
                    jArr = jArr3;
                }
                z = z8;
                this.f17456 = jArr;
                this.f17429.mo2740();
                this.f17429.mo2739(new C3373(j4, this.f17436, size));
                arrayDeque.clear();
                this.f17448 = z;
                if (this.f17441) {
                }
            } else if (!arrayDeque2.isEmpty()) {
                ((C3152) arrayDeque2.peek()).f12002.add(c3152);
            }
        }
        if (this.f17447 != 2) {
            this.f17447 = 0;
            this.f17446 = 0;
        }
    }

    @Override // defpackage.InterfaceC4291
    /* JADX INFO: renamed from: ːˏᵟᵯ */
    public final InterfaceC4291 mo1254() {
        return this;
    }

    @Override // defpackage.InterfaceC4291
    /* JADX INFO: renamed from: ᵨᵣ */
    public final boolean mo1255(InterfaceC5206 interfaceC5206) {
        C2598 c2598M9553;
        InterfaceC5444 interfaceC5444 = ᵟˌᵫ.ᵨˈʼﹶ(interfaceC5206, false, (this.f17427 & 2) != 0);
        if (interfaceC5444 != null) {
            c2598M9553 = AbstractC4509.m9553(interfaceC5444);
        } else {
            C2822 c2822 = AbstractC4509.f17159;
            c2598M9553 = C2598.f10048;
        }
        this.f17454 = c2598M9553;
        return interfaceC5444 == null;
    }

    @Override // defpackage.InterfaceC4291
    /* JADX INFO: renamed from: ᵲᵶᵳˈ */
    public final void mo1256() {
    }

    @Override // defpackage.InterfaceC4291
    /* JADX INFO: renamed from: ᵵᵽ */
    public final void mo1257(InterfaceC4550 interfaceC4550) {
        if ((this.f17427 & 16) == 0) {
            interfaceC4550 = new C0764(interfaceC4550, this.f17451);
        }
        this.f17429 = interfaceC4550;
    }

    /* JADX WARN: Can't fix incorrect switch cases order, some code will duplicate */
    /* JADX WARN: Failed to restore switch over string. Please report as a decompilation issue */
    /* JADX WARN: Removed duplicated region for block: B:26:0x008d  */
    /* JADX WARN: Removed duplicated region for block: B:277:0x0562  */
    /* JADX WARN: Removed duplicated region for block: B:278:0x056e  */
    @Override // defpackage.InterfaceC4291
    /* JADX INFO: renamed from: ᵷᵺʾᵖ */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final int mo1258(InterfaceC5206 interfaceC5206, C2669 c2669) throws ParserException {
        char c;
        char c2;
        int i;
        int i2;
        int i3;
        int i4;
        int i5;
        C4545 c4545;
        int i6;
        char c3;
        boolean z;
        boolean z2;
        C3152 c3152;
        if (!this.f17438 || !this.f17448) {
            while (true) {
                int i7 = this.f17447;
                ArrayDeque arrayDeque = this.f17433;
                int i8 = this.f17427;
                C4545 c45452 = this.f17458;
                int i9 = 4;
                int i10 = 0;
                char c4 = 2;
                if (i7 == 0) {
                    int i11 = this.f17446;
                    C4545 c45453 = this.f17452;
                    if (i11 == 0) {
                        if (interfaceC5206.mo4710(c45453.f17284, 0, 8, true)) {
                            this.f17446 = 8;
                            c45453.m9624(0);
                            this.f17434 = c45453.m9606();
                            this.f17442 = c45453.m9614();
                        } else if (this.f17439 == 2 && (i8 & 2) != 0) {
                            InterfaceC5226 interfaceC5226Mo2743 = this.f17429.mo2743(0, 4);
                            C2568 c2568 = this.f17428;
                            C1956 c1956 = c2568 == null ? null : new C1956(c2568);
                            C4753 c4753 = new C4753();
                            c4753.f18125 = c1956;
                            AbstractC0659.m2415(c4753, interfaceC5226Mo2743);
                            this.f17429.mo2740();
                            this.f17429.mo2739(new C3782(-9223372036854775807L));
                            return -1;
                        }
                    }
                    long j = this.f17434;
                    if (j == 1) {
                        interfaceC5206.readFully(c45453.f17284, 8, 8);
                        this.f17446 += 8;
                        this.f17434 = c45453.m9616();
                    } else if (j == 0) {
                        long length = interfaceC5206.getLength();
                        if (length == -1 && (c3152 = (C3152) arrayDeque.peek()) != null) {
                            length = c3152.f12000;
                        }
                        if (length != -1) {
                            this.f17434 = (length - interfaceC5206.getPosition()) + ((long) this.f17446);
                        }
                    }
                    long j2 = this.f17434;
                    int i12 = this.f17446;
                    long j3 = i12;
                    if (j2 < j3) {
                        if (this.f17442 != 1718773093 || i12 != 8) {
                            break;
                        }
                        this.f17434 = j3;
                    }
                    int i13 = this.f17442;
                    if (i13 == 1836019574 || i13 == 1953653099 || i13 == 1835297121 || i13 == 1835626086 || i13 == 1937007212 || i13 == 1701082227 || i13 == 1835365473 || i13 == 1635284069) {
                        long position = interfaceC5206.getPosition();
                        long j4 = this.f17434;
                        long j5 = this.f17446;
                        long j6 = (position + j4) - j5;
                        if (j4 != j5 && this.f17442 == 1835365473) {
                            c45452.m9603(8);
                            interfaceC5206.mo4701(c45452.f17284, 0, 8);
                            AbstractC0285.m1515(c45452);
                            interfaceC5206.mo4700(c45452.f17282);
                            interfaceC5206.mo4698();
                        }
                        arrayDeque.push(new C3152(j6, this.f17442));
                        if (this.f17434 == this.f17446) {
                            m9660(j6);
                        } else {
                            this.f17447 = 0;
                            this.f17446 = 0;
                        }
                    } else if (i13 == 1835296868 || i13 == 1836476516 || i13 == 1751411826 || i13 == 1937011556 || i13 == 1937011827 || i13 == 1937011571 || i13 == 1668576371 || i13 == 1701606260 || i13 == 1937011555 || i13 == 1937011578 || i13 == 1937013298 || i13 == 1937007471 || i13 == 1668232756 || i13 == 1953196132 || i13 == 1718909296 || i13 == 1969517665 || i13 == 1801812339 || i13 == 1768715124) {
                        ᵻᵪ.ˌᴵ(i12 == 8);
                        ᵻᵪ.ˌᴵ(this.f17434 <= 2147483647L);
                        C4545 c45454 = new C4545((int) this.f17434);
                        System.arraycopy(c45453.f17284, 0, c45454.f17284, 0, 8);
                        this.f17443 = c45454;
                        this.f17447 = 1;
                    } else {
                        long position2 = interfaceC5206.getPosition();
                        long j7 = this.f17446;
                        long j8 = position2 - j7;
                        if (this.f17442 == 1836086884) {
                            this.f17428 = new C2568(0L, j8, -9223372036854775807L, j8 + j7, this.f17434 - j7);
                        }
                        this.f17443 = null;
                        this.f17447 = 1;
                    }
                } else {
                    if (i7 != 1) {
                        if (i7 != 2) {
                            if (i7 != 3) {
                                ᵷᵝˎ.ᵱʡˏ();
                                return 0;
                            }
                            C4701 c4701 = this.f17457;
                            ArrayList arrayList = c4701.f17876;
                            int i14 = c4701.f17874;
                            if (i14 != 0) {
                                if (i14 != 1) {
                                    short s = 2817;
                                    short s2 = 2816;
                                    short s3 = 2192;
                                    if (i14 == 2) {
                                        long length2 = interfaceC5206.getLength();
                                        int i15 = c4701.f17875 - 20;
                                        C4545 c45455 = new C4545(i15);
                                        interfaceC5206.readFully(c45455.f17284, 0, i15);
                                        int i16 = 0;
                                        while (i16 < i15 / 12) {
                                            c45455.m9609(2);
                                            short sM9621 = c45455.m9621();
                                            if (sM9621 != s3 && sM9621 != s2 && sM9621 != s && sM9621 != 2819) {
                                                if (sM9621 != 2820) {
                                                    c45455.m9609(8);
                                                    c4545 = c45455;
                                                }
                                                i16++;
                                                c45455 = c4545;
                                                s = 2817;
                                                s3 = 2192;
                                                s2 = 2816;
                                            }
                                            c4545 = c45455;
                                            arrayList.add(new C4181((length2 - ((long) c4701.f17875)) - ((long) c45455.m9618()), c4545.m9618()));
                                            i16++;
                                            c45455 = c4545;
                                            s = 2817;
                                            s3 = 2192;
                                            s2 = 2816;
                                        }
                                        if (arrayList.isEmpty()) {
                                            c2669.f10317 = 0L;
                                        } else {
                                            c4701.f17874 = 3;
                                            c2669.f10317 = ((C4181) arrayList.get(0)).f15954;
                                        }
                                    } else {
                                        if (i14 != 3) {
                                            ᵷᵝˎ.ᵱʡˏ();
                                            return 0;
                                        }
                                        long position3 = interfaceC5206.getPosition();
                                        int length3 = (int) ((interfaceC5206.getLength() - interfaceC5206.getPosition()) - ((long) c4701.f17875));
                                        C4545 c45456 = new C4545(length3);
                                        interfaceC5206.readFully(c45456.f17284, 0, length3);
                                        int i17 = 0;
                                        while (i17 < arrayList.size()) {
                                            C4181 c4181 = (C4181) arrayList.get(i17);
                                            int i18 = i10;
                                            c45456.m9624((int) (c4181.f15954 - position3));
                                            c45456.m9609(i9);
                                            int iM9618 = c45456.m9618();
                                            Charset charset = StandardCharsets.UTF_8;
                                            int i19 = i18;
                                            String strM9617 = c45456.m9617(iM9618, charset);
                                            switch (strM9617.hashCode()) {
                                                case -1711564334:
                                                    i6 = !strM9617.equals("SlowMotion_Data") ? -1 : i19;
                                                    break;
                                                case -1332107749:
                                                    if (strM9617.equals("Super_SlowMotion_Edit_Data")) {
                                                        i6 = 1;
                                                        break;
                                                    }
                                                    break;
                                                case -1251387154:
                                                    if (strM9617.equals("Super_SlowMotion_Data")) {
                                                        i6 = 2;
                                                        break;
                                                    }
                                                    break;
                                                case -830665521:
                                                    if (strM9617.equals("Super_SlowMotion_Deflickering_On")) {
                                                        i6 = 3;
                                                        break;
                                                    }
                                                    break;
                                                case 1760745220:
                                                    if (strM9617.equals("Super_SlowMotion_BGM")) {
                                                        i6 = 4;
                                                        break;
                                                    }
                                                    break;
                                            }
                                            switch (i6) {
                                                case 0:
                                                    c3 = 2192;
                                                    break;
                                                case 1:
                                                    c3 = 2819;
                                                    break;
                                                case 2:
                                                    c3 = 2816;
                                                    break;
                                                case 3:
                                                    c3 = 2820;
                                                    break;
                                                case 4:
                                                    c3 = 2817;
                                                    break;
                                                default:
                                                    throw ParserException.m357("Invalid SEF name", null);
                                            }
                                            int i20 = c4181.f15953 - (iM9618 + 8);
                                            if (c3 == 2192) {
                                                ArrayList arrayList2 = new ArrayList();
                                                List listM5119 = C4701.f17872.m5119(c45456.m9617(i20, charset));
                                                int i21 = i19;
                                                while (i21 < listM5119.size()) {
                                                    List listM51192 = C4701.f17873.m5119((CharSequence) listM5119.get(i21));
                                                    if (listM51192.size() != 3) {
                                                        throw ParserException.m357(null, null);
                                                    }
                                                    try {
                                                        arrayList2.add(new C4969(Long.parseLong((String) listM51192.get(i19)), 1 << (Integer.parseInt((String) listM51192.get(2)) - 1), Long.parseLong((String) listM51192.get(1))));
                                                        i21++;
                                                        i19 = 0;
                                                    } catch (NumberFormatException e) {
                                                        throw ParserException.m357(null, e);
                                                    }
                                                }
                                                this.f17450.add(new C3019(arrayList2));
                                            } else if (c3 != 2816 && c3 != 2817 && c3 != 2819 && c3 != 2820) {
                                                ᵷᵝˎ.ᵱʡˏ();
                                                return i19;
                                            }
                                            i17++;
                                            i10 = 0;
                                            i9 = 4;
                                        }
                                        c2669.f10317 = 0L;
                                    }
                                } else {
                                    C4545 c45457 = new C4545(8);
                                    interfaceC5206.readFully(c45457.f17284, 0, 8);
                                    c4701.f17875 = c45457.m9618() + 8;
                                    if (c45457.m9614() != 1397048916) {
                                        c2669.f10317 = 0L;
                                    } else {
                                        c2669.f10317 = interfaceC5206.getPosition() - ((long) (c4701.f17875 - 12));
                                        c4701.f17874 = 2;
                                    }
                                }
                                i5 = 1;
                            } else {
                                long length4 = interfaceC5206.getLength();
                                c2669.f10317 = (length4 == -1 || length4 < 8) ? 0L : length4 - 8;
                                i5 = 1;
                                c4701.f17874 = 1;
                            }
                            if (c2669.f10317 != 0) {
                                return i5;
                            }
                            this.f17447 = 0;
                            this.f17446 = 0;
                            return i5;
                        }
                        long position4 = interfaceC5206.getPosition();
                        if (this.f17449 == -1) {
                            boolean z3 = true;
                            int i22 = 0;
                            int i23 = -1;
                            int i24 = -1;
                            boolean z4 = true;
                            long j9 = Long.MAX_VALUE;
                            long j10 = Long.MAX_VALUE;
                            long j11 = Long.MAX_VALUE;
                            while (true) {
                                C4939[] c4939Arr = this.f17436;
                                if (i22 >= c4939Arr.length) {
                                    break;
                                }
                                C4939 c4939 = c4939Arr[i22];
                                int i25 = c4939.f18760;
                                C0138 c0138 = c4939.f18758;
                                char c5 = c4;
                                if (i25 != c0138.f1479) {
                                    long j12 = c0138.f1481[i25];
                                    long[][] jArr = this.f17456;
                                    jArr.getClass();
                                    long j13 = jArr[i22][i25];
                                    long j14 = j12 - position4;
                                    boolean z5 = j14 < 0 || j14 >= 262144;
                                    if ((!z5 && z3) || (z5 == z3 && j14 < j11)) {
                                        z3 = z5;
                                        i24 = i22;
                                        j11 = j14;
                                        j10 = j13;
                                    }
                                    if (j13 < j9) {
                                        z4 = z5;
                                        i23 = i22;
                                        j9 = j13;
                                    }
                                }
                                i22++;
                                c4 = c5;
                            }
                            c = c4;
                            if (j9 == Long.MAX_VALUE || !z4 || j10 < j9 + 10485760) {
                                i23 = i24;
                            }
                            this.f17449 = i23;
                            if (i23 == -1) {
                                return -1;
                            }
                        } else {
                            c = 2;
                        }
                        C4939 c49392 = this.f17436[this.f17449];
                        InterfaceC5226 interfaceC5226 = c49392.f18759;
                        C0138 c01382 = c49392.f18758;
                        C2476 c2476 = c49392.f18761;
                        int i26 = c49392.f18760;
                        long[] jArr2 = c01382.f1481;
                        int[] iArr = c01382.f1486;
                        long j15 = jArr2[i26] + this.f17453;
                        int i27 = iArr[i26];
                        C0246 c0246 = c49392.f18762;
                        long j16 = (j15 - position4) + ((long) this.f17431);
                        if (j16 < 0 || j16 >= 262144) {
                            c2669.f10317 = j15;
                            return 1;
                        }
                        int i28 = c2476.f9604;
                        int i29 = c2476.f9611;
                        C5286 c5286 = c2476.f9610;
                        if (i28 == 1) {
                            j16 += 8;
                            i27 -= 8;
                        }
                        int i30 = i27;
                        interfaceC5206.mo4700((int) j16);
                        String str = c5286.f19987;
                        String str2 = c5286.f19987;
                        if (!Objects.equals(str, "video/avc") ? !Objects.equals(str2, "video/hevc") || (i8 & 128) == 0 : (i8 & 32) == 0) {
                            c2 = 1;
                            this.f17432 = true;
                        } else {
                            c2 = 1;
                        }
                        if (i29 != 0) {
                            C4545 c45458 = this.f17444;
                            byte[] bArr = c45458.f17284;
                            bArr[0] = 0;
                            bArr[c2] = 0;
                            bArr[c] = 0;
                            int i31 = 4 - i29;
                            int i32 = i30 + i31;
                            while (this.f17430 < i32) {
                                int i33 = this.f17437;
                                if (i33 == 0) {
                                    if (this.f17432 || ᵥˇᵛˎ.ˁʢᵛ(c5286) + i29 > iArr[i26] - this.f17431) {
                                        i3 = i29;
                                        i4 = 0;
                                    } else {
                                        i4 = ᵥˇᵛˎ.ˁʢᵛ(c5286);
                                        i3 = i29 + i4;
                                    }
                                    interfaceC5206.readFully(bArr, i31, i3);
                                    i2 = i32;
                                    this.f17431 += i3;
                                    c45458.m9624(0);
                                    int iM9614 = c45458.m9614();
                                    if (iM9614 < 0) {
                                        throw ParserException.m357("Invalid NAL length", null);
                                    }
                                    this.f17437 = iM9614 - i4;
                                    C4545 c45459 = this.f17455;
                                    c45459.m9624(0);
                                    int i34 = i4;
                                    interfaceC5226.mo1740(4, c45459);
                                    this.f17430 += 4;
                                    if (i34 > 0) {
                                        interfaceC5226.mo1740(i34, c45458);
                                        this.f17430 += i34;
                                        if (ᵥˇᵛˎ.ᵨˈʼﹶ(bArr, i34, c5286)) {
                                            this.f17432 = true;
                                        }
                                    }
                                } else {
                                    i2 = i32;
                                    int iMo1744 = interfaceC5226.mo1744(interfaceC5206, i33, false);
                                    this.f17431 += iMo1744;
                                    this.f17430 += iMo1744;
                                    this.f17437 -= iMo1744;
                                }
                                i32 = i2;
                            }
                            i = i32;
                        } else {
                            if ("audio/ac4".equals(str2)) {
                                if (this.f17430 == 0) {
                                    ˑᵕʾ.ˊᵙᵾᵲ(i30, c45452);
                                    interfaceC5226.mo1740(7, c45452);
                                    this.f17430 += 7;
                                }
                                i30 += 7;
                            } else if (c49392.f18763 != null && Objects.equals(str2, "audio/mpeg")) {
                                C5286 c52862 = c49392.f18763;
                                c45452.m9603(4);
                                interfaceC5206.mo4701(c45452.f17284, 0, 4);
                                interfaceC5206.mo4698();
                                C0272 c0272 = new C0272();
                                InterfaceC5226 interfaceC52262 = c49392.f18759;
                                if (c0272.m1496(c45452.m9614()) && !Objects.equals(c52862.f19987, (String) c0272.f1893)) {
                                    C4753 c4753M10878 = c52862.m10878();
                                    String str3 = (String) c0272.f1893;
                                    str3.getClass();
                                    c4753M10878.f18101 = AbstractC4208.m9132(str3);
                                    c52862 = new C5286(c4753M10878);
                                }
                                interfaceC52262.mo1742(c52862);
                                c49392.f18763 = null;
                            } else if (c0246 != null) {
                                c0246.m1461(interfaceC5206);
                            }
                            while (true) {
                                int i35 = this.f17430;
                                if (i35 >= i30) {
                                    break;
                                }
                                int iMo17442 = interfaceC5226.mo1744(interfaceC5206, i30 - i35, false);
                                this.f17431 += iMo17442;
                                this.f17430 += iMo17442;
                                this.f17437 -= iMo17442;
                            }
                            i = i30;
                        }
                        long j17 = c01382.f1488[i26];
                        int i36 = c01382.f1485[i26];
                        if (!this.f17432) {
                            i36 |= 67108864;
                        }
                        int i37 = i36;
                        if (c0246 != null) {
                            c0246.m1460(interfaceC5226, j17, i37, i, 0, null);
                            if (i26 + 1 == c01382.f1479) {
                                c0246.m1462(interfaceC5226, null);
                            }
                        } else {
                            interfaceC5226.mo1741(j17, i37, i, 0, null);
                        }
                        c49392.f18760++;
                        this.f17449 = -1;
                        this.f17431 = 0;
                        this.f17430 = 0;
                        this.f17437 = 0;
                        this.f17432 = false;
                        return 0;
                    }
                    long j18 = this.f17434 - ((long) this.f17446);
                    long position5 = interfaceC5206.getPosition() + j18;
                    C4545 c454510 = this.f17443;
                    if (c454510 != null) {
                        interfaceC5206.readFully(c454510.f17284, this.f17446, (int) j18);
                        if (this.f17442 == 1718909296) {
                            this.f17435 = true;
                            c454510.m9624(8);
                            int iM96142 = c454510.m9614();
                            int i38 = iM96142 != 1751476579 ? iM96142 != 1903435808 ? 0 : 1 : 2;
                            if (i38 == 0) {
                                c454510.m9609(4);
                                while (true) {
                                    if (c454510.m9623() <= 0) {
                                        i38 = 0;
                                        break;
                                    }
                                    int iM96143 = c454510.m9614();
                                    i38 = iM96143 != 1751476579 ? iM96143 != 1903435808 ? 0 : 1 : 2;
                                    if (i38 != 0) {
                                        break;
                                    }
                                }
                            }
                            this.f17439 = i38;
                        } else if (!arrayDeque.isEmpty()) {
                            ((C3152) arrayDeque.peek()).f12001.add(new C1488(this.f17442, c454510));
                        }
                    } else {
                        if (!this.f17435 && this.f17442 == 1835295092) {
                            this.f17439 = 1;
                        }
                        if (j18 < 262144) {
                            interfaceC5206.mo4700((int) j18);
                        } else {
                            c2669.f10317 = interfaceC5206.getPosition() + j18;
                            z = true;
                            m9660(position5);
                            if (this.f17441) {
                                z2 = z;
                            } else {
                                this.f17445 = true;
                                c2669.f10317 = this.f17440;
                                this.f17441 = false;
                                z2 = true;
                            }
                            if (z2 && this.f17447 != 2) {
                                return 1;
                            }
                        }
                    }
                    z = false;
                    m9660(position5);
                    if (this.f17441) {
                    }
                    if (z2) {
                        continue;
                    }
                }
            }
            throw ParserException.m356("Atom size less than header length (unsupported).");
        }
        return -1;
    }

    @Override // defpackage.InterfaceC4291
    /* JADX INFO: renamed from: ᵻˈᵦʼ */
    public final List mo1259() {
        return this.f17454;
    }
}
