package defpackage;

import java.util.Arrays;
import java.util.Collections;

/* JADX INFO: renamed from: ᵻˎ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes3.dex */
public final class C5193 implements InterfaceC2750 {

    /* JADX INFO: renamed from: ᵔᵖᵹᵫ, reason: contains not printable characters */
    public static final byte[] f19536 = {73, 68, 51};

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

    /* JADX INFO: renamed from: ˊᵫᵗ, reason: contains not printable characters */
    public InterfaceC5226 f19541;

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

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

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

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

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

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

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

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

    /* JADX INFO: renamed from: ᵵᵽ, reason: contains not printable characters */
    public String f19555;

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

    /* JADX INFO: renamed from: ᵻʽᵯ, reason: contains not printable characters */
    public InterfaceC5226 f19558;

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

    /* JADX INFO: renamed from: ʽˈˋ, reason: contains not printable characters */
    public final C3180 f19537 = new C3180(7, new byte[7]);

    /* JADX INFO: renamed from: ːˏᵟᵯ, reason: contains not printable characters */
    public final C4545 f19545 = new C4545(Arrays.copyOf(f19536, 10));

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

    /* JADX INFO: renamed from: ᵟᵹᵙ, reason: contains not printable characters */
    public int f19548 = -1;

    /* JADX INFO: renamed from: ˉᵲ, reason: contains not printable characters */
    public long f19538 = -9223372036854775807L;

    /* JADX INFO: renamed from: ˊᵨᵧ, reason: contains not printable characters */
    public long f19540 = -9223372036854775807L;

    /* JADX INFO: renamed from: ᵱᵽʡᵚ, reason: contains not printable characters */
    public int f19553 = 0;

    /* JADX INFO: renamed from: ᵶᵥᵝ, reason: contains not printable characters */
    public int f19556 = 0;

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

    public C5193(int i, String str, String str2, boolean z) {
        this.f19554 = z;
        this.f19557 = str;
        this.f19549 = i;
        this.f19559 = str2;
    }

    @Override // defpackage.InterfaceC2750
    /* JADX INFO: renamed from: ːˏᵟᵯ */
    public final void mo2659() {
        this.f19540 = -9223372036854775807L;
        this.f19542 = false;
        this.f19553 = 0;
        this.f19556 = 0;
        this.f19551 = 256;
    }

    @Override // defpackage.InterfaceC2750
    /* JADX INFO: renamed from: ᵨᵣ */
    public final void mo2660(long j, int i) {
        this.f19540 = j;
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Removed duplicated region for block: B:62:0x01f0  */
    /* JADX WARN: Type inference fix 'apply assigned field type' failed
    java.lang.UnsupportedOperationException: ArgType.getObject(), call class: class jadx.core.dex.instructions.args.ArgType$PrimitiveArg
    	at jadx.core.dex.instructions.args.ArgType.getObject(ArgType.java:593)
    	at jadx.core.dex.attributes.nodes.ClassTypeVarsAttr.getTypeVarsMapFor(ClassTypeVarsAttr.java:35)
    	at jadx.core.dex.nodes.utils.TypeUtils.replaceClassGenerics(TypeUtils.java:177)
    	at jadx.core.dex.visitors.typeinference.FixTypesVisitor.insertExplicitUseCast(FixTypesVisitor.java:397)
    	at jadx.core.dex.visitors.typeinference.FixTypesVisitor.tryFieldTypeWithNewCasts(FixTypesVisitor.java:359)
    	at jadx.core.dex.visitors.typeinference.FixTypesVisitor.applyFieldType(FixTypesVisitor.java:309)
    	at jadx.core.dex.visitors.typeinference.FixTypesVisitor.visit(FixTypesVisitor.java:94)
     */
    @Override // defpackage.InterfaceC2750
    /* JADX INFO: renamed from: ᵲᵶᵳˈ */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final void mo2661(C4545 c4545) {
        int i;
        int i2;
        byte b;
        byte b2;
        int i3;
        int i4;
        char c;
        int i5;
        char c2;
        int i6;
        int i7;
        int i8;
        this.f19541.getClass();
        String str = AbstractC0956.f4222;
        while (c4545.m9623() > 0) {
            int i9 = this.f19553;
            byte b3 = -1;
            C4545 c45452 = this.f19545;
            int i10 = 3;
            C3180 c3180 = this.f19537;
            int i11 = 0;
            int i12 = 4;
            int i13 = 1;
            if (i9 == 0) {
                byte[] bArr = c4545.f17284;
                int i14 = c4545.f17282;
                int i15 = c4545.f17283;
                while (true) {
                    if (i14 >= i15) {
                        c4545.m9624(i14);
                        break;
                    }
                    i = i14 + 1;
                    i2 = i10;
                    b = bArr[i14];
                    int i16 = b & 255;
                    if (this.f19551 != 512 || ((65280 | (((byte) i16) & 255 ? 1 : 0) ? 1 : 0) & 65526) != 65520) {
                        b2 = b3;
                        i3 = i13;
                    } else {
                        if (this.f19542) {
                            break;
                        }
                        int i17 = i14 - 1;
                        c4545.m9624(i14);
                        byte[] bArr2 = c3180.f12075;
                        if (c4545.m9623() < i13) {
                            b2 = -1;
                            i3 = 1;
                        } else {
                            c4545.m9627(bArr2, i11, i13);
                            c3180.m7298(i12);
                            int iM7302 = c3180.m7302(i13);
                            int i18 = this.f19550;
                            if (i18 == -1 || iM7302 == i18) {
                                if (this.f19548 != -1) {
                                    byte[] bArr3 = c3180.f12075;
                                    if (c4545.m9623() < i13) {
                                        break;
                                    }
                                    c4545.m9627(bArr3, i11, i13);
                                    c3180.m7298(2);
                                    i6 = 4;
                                    if (c3180.m7302(4) == this.f19548) {
                                        c4545.m9624(i);
                                    }
                                    b2 = -1;
                                } else {
                                    i6 = 4;
                                }
                                byte[] bArr4 = c3180.f12075;
                                if (c4545.m9623() >= i6) {
                                    c4545.m9627(bArr4, i11, i6);
                                    c3180.m7298(14);
                                    int iM73022 = c3180.m7302(13);
                                    if (iM73022 >= 7) {
                                        byte[] bArr5 = c4545.f17284;
                                        int i19 = c4545.f17283;
                                        int i20 = i17 + iM73022;
                                        if (i20 < i19) {
                                            byte b4 = bArr5[i20];
                                            b2 = -1;
                                            if (b4 != -1) {
                                                if (b4 == 73 && ((i7 = i20 + 1) == i19 || (bArr5[i7] == 68 && ((i8 = i20 + 2) == i19 || bArr5[i8] == 51)))) {
                                                    break;
                                                }
                                            } else {
                                                int i21 = i20 + 1;
                                                if (i21 != i19) {
                                                    byte b5 = bArr5[i21];
                                                    if (((65280 | (b5 & 255 ? 1 : 0) ? 1 : 0) & 65526) == 65520 && ((b5 & 8) >> 3) == iM7302) {
                                                        break;
                                                    }
                                                } else {
                                                    break;
                                                }
                                            }
                                        } else {
                                            break;
                                        }
                                    }
                                } else {
                                    break;
                                }
                            } else {
                                b2 = -1;
                            }
                            i3 = 1;
                        }
                    }
                    int i22 = this.f19551;
                    int i23 = i16 | i22;
                    if (i23 == 329) {
                        i4 = 3;
                        c = 256;
                        i5 = 0;
                        c2 = 2;
                        this.f19551 = 768;
                    } else if (i23 == 511) {
                        i4 = 3;
                        c = 256;
                        i5 = 0;
                        c2 = 2;
                        this.f19551 = 512;
                    } else if (i23 == 836) {
                        i4 = 3;
                        c = 256;
                        i5 = 0;
                        c2 = 2;
                        this.f19551 = 1024;
                    } else {
                        if (i23 == 1075) {
                            this.f19553 = 2;
                            this.f19556 = 3;
                            this.f19544 = 0;
                            c45452.m9624(0);
                            c4545.m9624(i);
                            break;
                        }
                        c = 256;
                        if (i22 != 256) {
                            this.f19551 = 256;
                            i4 = 3;
                            i5 = 0;
                            c2 = 2;
                            i13 = i3;
                            b3 = b2;
                            i12 = 4;
                            i11 = i5;
                            i10 = i4;
                        } else {
                            i4 = 3;
                            i5 = 0;
                            c2 = 2;
                        }
                    }
                    i14 = i;
                    i13 = i3;
                    b3 = b2;
                    i12 = 4;
                    i11 = i5;
                    i10 = i4;
                }
                this.f19552 = (b & 8) >> 3;
                this.f19547 = (b & 1) == 0;
                if (this.f19542) {
                    this.f19553 = i2;
                    this.f19556 = 0;
                } else {
                    this.f19553 = 1;
                    this.f19556 = 0;
                }
                c4545.m9624(i);
            } else if (i9 != 1) {
                if (i9 == 2) {
                    byte[] bArr6 = c45452.f17284;
                    int iMin = Math.min(c4545.m9623(), 10 - this.f19556);
                    c4545.m9627(bArr6, this.f19556, iMin);
                    int i24 = this.f19556 + iMin;
                    this.f19556 = i24;
                    if (i24 == 10) {
                        this.f19558.mo1740(10, c45452);
                        c45452.m9624(6);
                        InterfaceC5226 interfaceC5226 = this.f19558;
                        int iM9620 = c45452.m9620() + 10;
                        this.f19553 = 4;
                        this.f19556 = 10;
                        this.f19543 = interfaceC5226;
                        this.f19546 = 0L;
                        this.f19544 = iM9620;
                    }
                } else if (i9 == 3) {
                    int i25 = this.f19547 ? 7 : 5;
                    byte[] bArr7 = c3180.f12075;
                    int iMin2 = Math.min(c4545.m9623(), i25 - this.f19556);
                    c4545.m9627(bArr7, this.f19556, iMin2);
                    int i26 = this.f19556 + iMin2;
                    this.f19556 = i26;
                    if (i26 == i25) {
                        c3180.m7298(0);
                        if (this.f19539) {
                            c3180.m7287(10);
                        } else {
                            int iM73023 = c3180.m7302(2) + 1;
                            if (iM73023 != 2) {
                                ˋˀᵧ.ʿٴˇ("Detected audio object type: " + iM73023 + ", but assuming AAC LC.");
                                iM73023 = 2;
                            }
                            c3180.m7287(5);
                            byte[] bArr8 = ᵱˉˈ.ˊᵫᵗ(iM73023, this.f19548, c3180.m7302(3));
                            C1260 c1260 = ᵱˉˈ.ˑˊᵲ(new C3180(2, bArr8), false);
                            C4753 c4753 = new C4753();
                            c4753.f18121 = this.f19555;
                            c4753.f18111 = AbstractC4208.m9132(this.f19559);
                            c4753.f18101 = AbstractC4208.m9132("audio/mp4a-latm");
                            c4753.f18120 = c1260.f5307;
                            c4753.f18090 = c1260.f5306;
                            c4753.f18113 = c1260.f5308;
                            c4753.f18119 = Collections.singletonList(bArr8);
                            c4753.f18126 = this.f19557;
                            c4753.f18129 = this.f19549;
                            C5286 c5286 = new C5286(c4753);
                            this.f19538 = 1024000000 / ((long) c5286.f19966);
                            this.f19541.mo1742(c5286);
                            this.f19539 = true;
                        }
                        c3180.m7287(4);
                        int iM73024 = c3180.m7302(13);
                        int i27 = iM73024 - 7;
                        if (this.f19547) {
                            i27 = iM73024 - 9;
                        }
                        InterfaceC5226 interfaceC52262 = this.f19541;
                        long j = this.f19538;
                        this.f19553 = 4;
                        this.f19556 = 0;
                        this.f19543 = interfaceC52262;
                        this.f19546 = j;
                        this.f19544 = i27;
                    }
                } else {
                    if (i9 != 4) {
                        ᵷᵝˎ.ᵱʡˏ();
                        return;
                    }
                    int iMin3 = Math.min(c4545.m9623(), this.f19544 - this.f19556);
                    this.f19543.mo1740(iMin3, c4545);
                    int i28 = this.f19556 + iMin3;
                    this.f19556 = i28;
                    if (i28 == this.f19544) {
                        ᵻᵪ.ˌᴵ(this.f19540 != -9223372036854775807L);
                        this.f19543.mo1741(this.f19540, 1, this.f19544, 0, null);
                        this.f19540 += this.f19546;
                        this.f19553 = 0;
                        this.f19556 = 0;
                        this.f19551 = 256;
                    }
                }
            } else if (c4545.m9623() != 0) {
                c3180.f12075[0] = c4545.f17284[c4545.f17282];
                c3180.m7298(2);
                int iM73025 = c3180.m7302(4);
                int i29 = this.f19548;
                if (i29 == -1 || iM73025 == i29) {
                    if (!this.f19542) {
                        this.f19542 = true;
                        this.f19550 = this.f19552;
                        this.f19548 = iM73025;
                    }
                    this.f19553 = 3;
                    this.f19556 = 0;
                } else {
                    this.f19542 = false;
                    this.f19553 = 0;
                    this.f19556 = 0;
                    this.f19551 = 256;
                }
            }
        }
    }

    @Override // defpackage.InterfaceC2750
    /* JADX INFO: renamed from: ᵷᵺʾᵖ */
    public final void mo2662(boolean z) {
    }

    @Override // defpackage.InterfaceC2750
    /* JADX INFO: renamed from: ᵻˈᵦʼ */
    public final void mo2663(InterfaceC4550 interfaceC4550, C4173 c4173) {
        c4173.m9112();
        c4173.m9111();
        this.f19555 = c4173.f15926;
        c4173.m9111();
        InterfaceC5226 interfaceC5226Mo2743 = interfaceC4550.mo2743(c4173.f15928, 1);
        this.f19541 = interfaceC5226Mo2743;
        this.f19543 = interfaceC5226Mo2743;
        if (!this.f19554) {
            this.f19558 = new C0406();
            return;
        }
        c4173.m9112();
        c4173.m9111();
        InterfaceC5226 interfaceC5226Mo27432 = interfaceC4550.mo2743(c4173.f15928, 5);
        this.f19558 = interfaceC5226Mo27432;
        C4753 c4753 = new C4753();
        c4173.m9111();
        c4753.f18121 = c4173.f15926;
        c4753.f18111 = AbstractC4208.m9132(this.f19559);
        c4753.f18101 = AbstractC4208.m9132("application/id3");
        AbstractC0659.m2415(c4753, interfaceC5226Mo27432);
    }
}
