package defpackage;

import android.util.Pair;
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 C4439 implements InterfaceC2750 {

    /* JADX INFO: renamed from: ˊᵙᵾᵲ, reason: contains not printable characters */
    public static final double[] f16916 = {23.976023976023978d, 24.0d, 25.0d, 29.97002997002997d, 30.0d, 50.0d, 59.94005994005994d, 60.0d};

    /* JADX INFO: renamed from: ʽˈˋ, reason: contains not printable characters */
    public InterfaceC5226 f16917;

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

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

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

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

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

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

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

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

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

    /* JADX INFO: renamed from: ᵱᵽʡᵚ, reason: contains not printable characters */
    public boolean f16927;

    /* JADX INFO: renamed from: ᵲᵶᵳˈ, reason: contains not printable characters */
    public String f16928;

    /* JADX INFO: renamed from: ᵵᵽ, reason: contains not printable characters */
    public final boolean[] f16929 = new boolean[4];

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

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

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

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

    public C4439(C3735 c3735, String str) {
        this.f16920 = c3735;
        this.f16931 = str;
        C0625 c0625 = new C0625();
        c0625.f2970 = new byte[128];
        this.f16918 = c0625;
        if (c3735 != null) {
            this.f16933 = new C4048(178);
            this.f16923 = new C4545();
        } else {
            this.f16933 = null;
            this.f16923 = null;
        }
        this.f16921 = -9223372036854775807L;
        this.f16924 = -9223372036854775807L;
    }

    @Override // defpackage.InterfaceC2750
    /* JADX INFO: renamed from: ːˏᵟᵯ */
    public final void mo2659() {
        ᵥˇᵛˎ.ᵨᵣ(this.f16929);
        C0625 c0625 = this.f16918;
        c0625.f2969 = false;
        c0625.f2967 = 0;
        c0625.f2968 = 0;
        C4048 c4048 = this.f16933;
        if (c4048 != null) {
            c4048.m8858();
        }
        this.f16932 = 0L;
        this.f16927 = false;
        this.f16921 = -9223372036854775807L;
        this.f16924 = -9223372036854775807L;
    }

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

    /* JADX WARN: Removed duplicated region for block: B:45:0x0125  */
    /* JADX WARN: Removed duplicated region for block: B:64:0x0197  */
    /* JADX WARN: Removed duplicated region for block: B:79:0x01d0  */
    /* JADX WARN: Removed duplicated region for block: B:86:0x01de  */
    /* JADX WARN: Removed duplicated region for block: B:89:0x01eb  */
    /* JADX WARN: Removed duplicated region for block: B:95:0x0205  */
    /* JADX WARN: Removed duplicated region for block: B:96:0x0207  */
    /* 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) {
        C0625 c0625;
        C4048 c4048;
        int i;
        boolean z;
        long j;
        long j2;
        boolean z2;
        boolean z3;
        int i2;
        float f;
        int i3;
        float f2;
        int i4;
        long j3;
        this.f16917.getClass();
        int i5 = c4545.f17282;
        int i6 = c4545.f17283;
        byte[] bArr = c4545.f17284;
        this.f16932 += (long) c4545.m9623();
        this.f16917.mo1740(c4545.m9623(), c4545);
        while (true) {
            int i7 = ᵥˇᵛˎ.ˊᵨᵧ(bArr, i5, i6, this.f16929);
            c0625 = this.f16918;
            c4048 = this.f16933;
            if (i7 == i6) {
                break;
            }
            int i8 = i7 + 3;
            int i9 = c4545.f17284[i8] & 255;
            int i10 = i7 - i5;
            if (this.f16930) {
                i = i6;
            } else {
                if (i10 > 0) {
                    c0625.m2287(bArr, i5, i7);
                }
                int i11 = i10 < 0 ? -i10 : 0;
                if (c0625.f2969) {
                    int i12 = c0625.f2967 - i11;
                    c0625.f2967 = i12;
                    if (c0625.f2968 == 0 && i9 == 181) {
                        c0625.f2968 = i12;
                        i = i6;
                    } else {
                        c0625.f2969 = false;
                        String str = this.f16928;
                        str.getClass();
                        byte[] bArrCopyOf = Arrays.copyOf((byte[]) c0625.f2970, c0625.f2967);
                        int i13 = bArrCopyOf[4] & 255;
                        byte b = bArrCopyOf[5];
                        i = i6;
                        int i14 = ((b & 255) >> 4) | (i13 << 4);
                        int i15 = (bArrCopyOf[6] & 255) | ((b & 15) << 8);
                        int i16 = (bArrCopyOf[7] & 240) >> 4;
                        if (i16 == 2) {
                            f = i15 * 4;
                            i3 = i14 * 3;
                        } else if (i16 == 3) {
                            f = i15 * 16;
                            i3 = i14 * 9;
                        } else if (i16 != 4) {
                            f2 = 1.0f;
                            C4753 c4753 = new C4753();
                            c4753.f18121 = str;
                            c4753.f18111 = AbstractC4208.m9132(this.f16931);
                            c4753.f18101 = AbstractC4208.m9132("video/mpeg2");
                            c4753.f18098 = i14;
                            c4753.f18102 = i15;
                            c4753.f18124 = f2;
                            c4753.f18119 = Collections.singletonList(bArrCopyOf);
                            C5286 c5286 = new C5286(c4753);
                            i4 = (bArrCopyOf[7] & 15) - 1;
                            if (i4 >= 0 || i4 >= 8) {
                                j3 = 0;
                            } else {
                                double d = f16916[i4];
                                byte b2 = bArrCopyOf[c0625.f2968 + 9];
                                int i17 = (b2 & 96) >> 5;
                                int i18 = b2 & 31;
                                if (i17 != i18) {
                                    d = ((((double) i17) + 1.0d) / ((double) (i18 + 1))) * d;
                                }
                                j3 = (long) (1000000.0d / d);
                            }
                            Pair pairCreate = Pair.create(c5286, Long.valueOf(j3));
                            this.f16917.mo1742((C5286) pairCreate.first);
                            this.f16925 = ((Long) pairCreate.second).longValue();
                            this.f16930 = true;
                        } else {
                            f = i15 * 121;
                            i3 = i14 * 100;
                        }
                        f2 = f / i3;
                        C4753 c47532 = new C4753();
                        c47532.f18121 = str;
                        c47532.f18111 = AbstractC4208.m9132(this.f16931);
                        c47532.f18101 = AbstractC4208.m9132("video/mpeg2");
                        c47532.f18098 = i14;
                        c47532.f18102 = i15;
                        c47532.f18124 = f2;
                        c47532.f18119 = Collections.singletonList(bArrCopyOf);
                        C5286 c52862 = new C5286(c47532);
                        i4 = (bArrCopyOf[7] & 15) - 1;
                        if (i4 >= 0) {
                            j3 = 0;
                            Pair pairCreate2 = Pair.create(c52862, Long.valueOf(j3));
                            this.f16917.mo1742((C5286) pairCreate2.first);
                            this.f16925 = ((Long) pairCreate2.second).longValue();
                            this.f16930 = true;
                        }
                    }
                } else {
                    i = i6;
                    if (i9 == 179) {
                        c0625.f2969 = true;
                    }
                }
                c0625.m2287(C0625.f2966, 0, 3);
            }
            if (c4048 == null) {
                z = true;
            } else {
                if (i10 > 0) {
                    c4048.m8855(bArr, i5, i7);
                    i2 = 0;
                } else {
                    i2 = -i10;
                }
                if (c4048.m8857(i2)) {
                    int i19 = ᵥˇᵛˎ.ᵚᵹᵔᵜ(c4048.f15537, (byte[]) c4048.f15541);
                    String str2 = AbstractC0956.f4222;
                    byte[] bArr2 = (byte[]) c4048.f15541;
                    C4545 c45452 = this.f16923;
                    c45452.m9600(i19, bArr2);
                    this.f16920.m8405(this.f16924, c45452);
                }
                if (i9 == 178) {
                    z = true;
                    if (c4545.f17284[i7 + 2] == 1) {
                        c4048.m8856(i9);
                    }
                }
            }
            if (i9 == 0 || i9 == 179) {
                int i20 = i - i7;
                if (this.f16926 && this.f16930) {
                    long j4 = this.f16924;
                    if (j4 != -9223372036854775807L) {
                        j = -9223372036854775807L;
                        this.f16917.mo1741(j4, this.f16922 ? 1 : 0, ((int) (this.f16932 - this.f16919)) - i20, i20, null);
                    }
                    if (this.f16927) {
                        this.f16919 = this.f16932 - ((long) i20);
                        j2 = this.f16921;
                        if (j2 == j) {
                        }
                        this.f16924 = j2;
                        z2 = false;
                        this.f16922 = false;
                        this.f16921 = j;
                        z3 = true;
                        this.f16927 = true;
                        this.f16926 = i9 != 0 ? z3 : z2;
                    }
                } else {
                    j = -9223372036854775807L;
                    if (this.f16927 || this.f16926) {
                        this.f16919 = this.f16932 - ((long) i20);
                        j2 = this.f16921;
                        if (j2 == j) {
                            long j5 = this.f16924;
                            j2 = j5 != j ? j5 + this.f16925 : j;
                        }
                        this.f16924 = j2;
                        z2 = false;
                        this.f16922 = false;
                        this.f16921 = j;
                        z3 = true;
                        this.f16927 = true;
                    } else {
                        z3 = true;
                        z2 = false;
                    }
                    this.f16926 = i9 != 0 ? z3 : z2;
                }
            } else if (i9 == 184) {
                this.f16922 = z;
            }
            i5 = i8;
            i6 = i;
        }
        if (!this.f16930) {
            c0625.m2287(bArr, i5, i6);
        }
        if (c4048 != null) {
            c4048.m8855(bArr, i5, i6);
        }
    }

    /* 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: ᵷᵺʾᵖ */
    public final void mo2662(boolean z) {
        this.f16917.getClass();
        if (z) {
            boolean z2 = this.f16922;
            this.f16917.mo1741(this.f16924, z2 ? 1 : 0, (int) (this.f16932 - this.f16919), 0, null);
        }
    }

    @Override // defpackage.InterfaceC2750
    /* JADX INFO: renamed from: ᵻˈᵦʼ */
    public final void mo2663(InterfaceC4550 interfaceC4550, C4173 c4173) {
        c4173.m9112();
        c4173.m9111();
        this.f16928 = c4173.f15926;
        c4173.m9111();
        this.f16917 = interfaceC4550.mo2743(c4173.f15928, 2);
        C3735 c3735 = this.f16920;
        if (c3735 != null) {
            c3735.m8404(interfaceC4550, c4173);
        }
    }
}
