package defpackage;

import androidx.media3.common.ParserException;

/* renamed from: ˋᵣ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public final class C1514 implements InterfaceC1593 {

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

    /* renamed from: ˎˏʜʾ, reason: contains not printable characters */
    public long f6079;

    /* renamed from: ˏˋٴ, reason: contains not printable characters */
    public int f6080;

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

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

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public final int f6083;

    /* renamed from: ᵹᵝᵶ, reason: contains not printable characters */
    public long f6084;

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

    public C1514(C2419 c2419) {
        this.f6082 = c2419;
        try {
            this.f6083 = m4444(c2419.f9448);
            this.f6085 = -9223372036854775807L;
            this.f6078 = -1;
            this.f6080 = 0;
            this.f6079 = 0L;
            this.f6084 = -9223372036854775807L;
        } catch (ParserException e) {
            throw new IllegalArgumentException(e);
        }
    }

    /* renamed from: ˇʼʤˎ, reason: contains not printable characters */
    public static int m4444(AbstractC1530 abstractC1530) throws ParserException {
        String str = (String) abstractC1530.get("config");
        int i = 0;
        i = 0;
        if (str != null && str.length() % 2 == 0) {
            byte[] bArrM8140 = AbstractC3558.m8140(str);
            C4089 c4089 = new C4089(bArrM8140.length, bArrM8140);
            int iM8966 = c4089.m8966(1);
            if (iM8966 != 0) {
                throw new ParserException(AbstractC2990.m7313(iM8966, "unsupported audio mux version: "), null, true, 0);
            }
            ᵛᵾˏ.ˌᵜᵹᵩ("Only supports allStreamsSameTimeFraming.", c4089.m8966(1) == 1);
            int iM89662 = c4089.m8966(6);
            ᵛᵾˏ.ˌᵜᵹᵩ("Only suppors one program.", c4089.m8966(4) == 0);
            ᵛᵾˏ.ˌᵜᵹᵩ("Only suppors one layer.", c4089.m8966(3) == 0);
            i = iM89662;
        }
        return i + 1;
    }

    @Override // defpackage.InterfaceC1593
    /* renamed from: ˏᵙ */
    public final void mo2630(InterfaceC1982 interfaceC1982, int i) {
        InterfaceC2154 interfaceC2154Mo4996 = interfaceC1982.mo4996(i, 2);
        this.f6081 = interfaceC2154Mo4996;
        String str = AbstractC3558.f13329;
        interfaceC2154Mo4996.mo4407(this.f6082.f9445);
    }

    @Override // defpackage.InterfaceC1593
    /* renamed from: ᵥᵯˎ */
    public final void mo2631(long j) {
        ᵛᵾˏ.ᵿʗᵝʽ(this.f6085 == -9223372036854775807L);
        this.f6085 = j;
    }

    @Override // defpackage.InterfaceC1593
    /* renamed from: ᵴᵳ */
    public final void mo2632(long j, long j2) {
        this.f6085 = j;
        this.f6080 = 0;
        this.f6079 = j2;
    }

    @Override // defpackage.InterfaceC1593
    /* renamed from: ᵻᵢﹳᵰ */
    public final void mo2633(C3493 c3493, long j, int i, boolean z) {
        this.f6081.getClass();
        int iM10873 = C5228.m10873(this.f6078);
        if (this.f6080 > 0 && iM10873 < i) {
            InterfaceC2154 interfaceC2154 = this.f6081;
            interfaceC2154.getClass();
            interfaceC2154.mo4410(this.f6084, 1, this.f6080, 0, null);
            this.f6080 = 0;
            this.f6084 = -9223372036854775807L;
        }
        for (int i2 = 0; i2 < this.f6083; i2++) {
            int i3 = 0;
            while (c3493.f13083 < c3493.f13081) {
                int iM7956 = c3493.m7956();
                i3 += iM7956;
                if (iM7956 != 255) {
                    break;
                }
            }
            this.f6081.mo4406(i3, c3493);
            this.f6080 += i3;
        }
        this.f6084 = ˁˈᵸ.ᵡᵘˎʽ(this.f6082.f9447, this.f6079, j, this.f6085);
        if (z) {
            InterfaceC2154 interfaceC21542 = this.f6081;
            interfaceC21542.getClass();
            interfaceC21542.mo4410(this.f6084, 1, this.f6080, 0, null);
            this.f6080 = 0;
            this.f6084 = -9223372036854775807L;
        }
        this.f6078 = i;
    }
}
