package defpackage;

import java.util.Collections;

/* renamed from: ᵶᵯː, reason: contains not printable characters */
/* loaded from: classes3.dex */
public final class C4828 implements InterfaceC4315 {

    /* renamed from: ˇʼʤˎ, reason: contains not printable characters */
    public boolean f17919;

    /* renamed from: ˌᵜᵹᵩ, reason: contains not printable characters */
    public long f17920;

    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public InterfaceC2154 f17923;

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public final C2901 f17925;

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public String f17928;

    /* renamed from: ᵻᵢﹳᵰ, reason: contains not printable characters */
    public C2887 f17932;

    /* renamed from: ˏˋٴ, reason: contains not printable characters */
    public final boolean[] f17922 = new boolean[3];

    /* renamed from: ˎˏʜʾ, reason: contains not printable characters */
    public final C3751 f17921 = new C3751(32);

    /* renamed from: ᵹᵝᵶ, reason: contains not printable characters */
    public final C3751 f17931 = new C3751(33);

    /* renamed from: ᵝᵵᵺ, reason: contains not printable characters */
    public final C3751 f17924 = new C3751(34);

    /* renamed from: ᵶᵷᵕ, reason: contains not printable characters */
    public final C3751 f17929 = new C3751(39);

    /* renamed from: ᵸˑ, reason: contains not printable characters */
    public final C3751 f17930 = new C3751(40);

    /* renamed from: ᵯٴᵦ, reason: contains not printable characters */
    public long f17927 = -9223372036854775807L;

    /* renamed from: ᵪʩ, reason: contains not printable characters */
    public final C3493 f17926 = new C3493();

    public C4828(C2901 c2901) {
        this.f17925 = c2901;
    }

    @Override // defpackage.InterfaceC4315
    /* renamed from: ˇʼʤˎ */
    public final void mo1771(long j, int i) {
        this.f17927 = j;
    }

    /* renamed from: ˎˏʜʾ, reason: contains not printable characters */
    public final void m10157(byte[] bArr, int i, int i2) {
        C2887 c2887 = this.f17932;
        if (c2887.f11191) {
            int i3 = c2887.f11200;
            int i4 = (i + 2) - i3;
            if (i4 < i2) {
                c2887.f11190 = (bArr[i4] & 128) != 0;
                c2887.f11191 = false;
            } else {
                c2887.f11200 = (i2 - i) + i3;
            }
        }
        if (!this.f17919) {
            this.f17921.m8376(bArr, i, i2);
            this.f17931.m8376(bArr, i, i2);
            this.f17924.m8376(bArr, i, i2);
        }
        this.f17929.m8376(bArr, i, i2);
        this.f17930.m8376(bArr, i, i2);
    }

    @Override // defpackage.InterfaceC4315
    /* renamed from: ˏˋٴ */
    public final void mo1772(InterfaceC1982 interfaceC1982, C4996 c4996) {
        c4996.m10451();
        c4996.m10452();
        this.f17928 = c4996.f18544;
        c4996.m10452();
        InterfaceC2154 interfaceC2154Mo4996 = interfaceC1982.mo4996(c4996.f18548, 2);
        this.f17923 = interfaceC2154Mo4996;
        this.f17932 = new C2887(interfaceC2154Mo4996);
        this.f17925.m7071(interfaceC1982, c4996);
    }

    @Override // defpackage.InterfaceC4315
    /* renamed from: ˏᵙ */
    public final void mo1773() {
        this.f17920 = 0L;
        this.f17927 = -9223372036854775807L;
        ˊˉʤﹳ.ᵹᵝᵶ(this.f17922);
        this.f17921.m8374();
        this.f17931.m8374();
        this.f17924.m8374();
        this.f17929.m8374();
        this.f17930.m8374();
        this.f17925.f11267.m4608(0);
        C2887 c2887 = this.f17932;
        if (c2887 != null) {
            c2887.f11191 = false;
            c2887.f11190 = false;
            c2887.f11199 = false;
            c2887.f11193 = false;
            c2887.f11197 = false;
        }
    }

    @Override // defpackage.InterfaceC4315
    /* renamed from: ᵥᵯˎ */
    public final void mo1774(C3493 c3493) {
        int i;
        this.f17923.getClass();
        String str = AbstractC3558.f13329;
        while (c3493.m7959() > 0) {
            int i2 = c3493.f13083;
            int i3 = c3493.f13081;
            byte[] bArr = c3493.f13082;
            this.f17920 += c3493.m7959();
            this.f17923.mo4406(c3493.m7959(), c3493);
            while (i2 < i3) {
                int i4 = ˊˉʤﹳ.ᵪʩ(bArr, i2, i3, this.f17922);
                if (i4 == i3) {
                    m10157(bArr, i2, i3);
                    return;
                }
                int i5 = (bArr[i4 + 3] & 126) >> 1;
                if (i4 <= 0 || bArr[i4 - 1] != 0) {
                    i = 3;
                } else {
                    i4--;
                    i = 4;
                }
                int i6 = i4;
                int i7 = i;
                int i8 = i6 - i2;
                if (i8 > 0) {
                    m10157(bArr, i2, i6);
                }
                int i9 = i3 - i6;
                long j = this.f17920 - i9;
                m10158(i9, i8 < 0 ? -i8 : 0, j, this.f17927);
                m10159(i9, i5, j, this.f17927);
                i2 = i6 + i7;
            }
        }
    }

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public final void m10158(int i, int i2, long j, long j2) {
        C1611 c1611 = this.f17925.f11267;
        C2887 c2887 = this.f17932;
        boolean z = this.f17919;
        if (c2887.f11197 && c2887.f11190) {
            c2887.f11195 = c2887.f11192;
            c2887.f11197 = false;
        } else if (c2887.f11199 || c2887.f11190) {
            if (z && c2887.f11193) {
                c2887.m7052(i + ((int) (j - c2887.f11196)));
            }
            c2887.f11198 = c2887.f11196;
            c2887.f11189 = c2887.f11188;
            c2887.f11195 = c2887.f11192;
            c2887.f11193 = true;
        }
        if (!this.f17919) {
            C3751 c3751 = this.f17921;
            c3751.m8378(i2);
            C3751 c37512 = this.f17931;
            c37512.m8378(i2);
            C3751 c37513 = this.f17924;
            c37513.m8378(i2);
            if (c3751.f13992 && c37512.f13992 && c37513.f13992) {
                String str = this.f17928;
                int i3 = c3751.f13994;
                byte[] bArr = new byte[c37512.f13994 + i3 + c37513.f13994];
                System.arraycopy((byte[]) c3751.f13993, 0, bArr, 0, i3);
                System.arraycopy((byte[]) c37512.f13993, 0, bArr, c3751.f13994, c37512.f13994);
                System.arraycopy((byte[]) c37513.f13993, 0, bArr, c3751.f13994 + c37512.f13994, c37513.f13994);
                C5039 c5039 = ˊˉʤﹳ.ˀᵗᵩ((byte[]) c37512.f13993, 3, c37512.f13994, (ᵮᵥٴ) null);
                C5310 c5310 = c5039.f18837;
                String strM8995 = c5310 != null ? AbstractC4109.m8995(c5310.f19876, c5310.f19877, c5310.f19875, c5310.f19878, c5310.f19873, c5310.f19874) : null;
                C2153 c2153 = new C2153();
                c2153.f8512 = str;
                c2153.f8518 = AbstractC2924.m7101("video/mp2t");
                c2153.f8516 = AbstractC2924.m7101("video/hevc");
                c2153.f8522 = strM8995;
                c2153.f8501 = c5039.f18829;
                c2153.f8514 = c5039.f18832;
                c2153.f8510 = c5039.f18831;
                c2153.f8529 = c5039.f18840;
                c2153.f8500 = new C0938(c5039.f18839, c5039.f18830, c5039.f18836, null, c5039.f18833 + 8, c5039.f18841 + 8);
                c2153.f8509 = c5039.f18834;
                c2153.f8493 = c5039.f18838;
                c2153.f8496 = c5039.f18835 + 1;
                c2153.f8506 = Collections.singletonList(bArr);
                C3446 c3446 = new C3446(c2153);
                this.f17923.mo4407(c3446);
                int i4 = c3446.f12916;
                ᵛᵾˏ.ᵿʗᵝʽ(i4 != -1);
                c1611.m4614(i4);
                this.f17919 = true;
            }
        }
        C3751 c37514 = this.f17929;
        boolean zM8378 = c37514.m8378(i2);
        C3493 c3493 = this.f17926;
        if (zM8378) {
            c3493.m7975(ˊˉʤﹳ.ˌᵹᵨˑ(c37514.f13994, (byte[]) c37514.f13993), (byte[]) c37514.f13993);
            c3493.m7946(5);
            c1611.m4613(j2, c3493);
        }
        C3751 c37515 = this.f17930;
        if (c37515.m8378(i2)) {
            c3493.m7975(ˊˉʤﹳ.ˌᵹᵨˑ(c37515.f13994, (byte[]) c37515.f13993), (byte[]) c37515.f13993);
            c3493.m7946(5);
            c1611.m4613(j2, c3493);
        }
    }

    /* renamed from: ᵹᵝᵶ, reason: contains not printable characters */
    public final void m10159(int i, int i2, long j, long j2) {
        C2887 c2887 = this.f17932;
        boolean z = this.f17919;
        c2887.f11190 = false;
        c2887.f11199 = false;
        c2887.f11188 = j2;
        c2887.f11200 = 0;
        c2887.f11196 = j;
        if (i2 >= 32 && i2 != 40) {
            if (c2887.f11193 && !c2887.f11197) {
                if (z) {
                    c2887.m7052(i);
                }
                c2887.f11193 = false;
            }
            if ((32 <= i2 && i2 <= 35) || i2 == 39) {
                c2887.f11199 = !c2887.f11197;
                c2887.f11197 = true;
            }
        }
        boolean z2 = i2 >= 16 && i2 <= 21;
        c2887.f11192 = z2;
        c2887.f11191 = z2 || i2 <= 9;
        if (!this.f17919) {
            this.f17921.m8373(i2);
            this.f17931.m8373(i2);
            this.f17924.m8373(i2);
        }
        this.f17929.m8373(i2);
        this.f17930.m8373(i2);
    }

    @Override // defpackage.InterfaceC4315
    /* renamed from: ᵻᵢﹳᵰ */
    public final void mo1775(boolean z) {
        this.f17923.getClass();
        String str = AbstractC3558.f13329;
        if (z) {
            this.f17925.f11267.m4608(0);
            m10158(0, 0, this.f17920, this.f17927);
            m10159(0, 48, this.f17920, this.f17927);
        }
    }
}
