package defpackage;

import androidx.media3.common.ParserException;
import java.math.RoundingMode;

/* renamed from: ᵼᵣ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public final class C5285 implements InterfaceC2043 {

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

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

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

    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public int f19785;

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public int f19786;

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public long f19787;

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

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

    public C5285(InterfaceC1982 interfaceC1982, InterfaceC2154 interfaceC2154, C2942 c2942, String str, int i) throws ParserException {
        this.f19782 = interfaceC1982;
        this.f19784 = interfaceC2154;
        this.f19783 = c2942;
        int i2 = c2942.f11403;
        int i3 = c2942.f11404;
        int i4 = (c2942.f11405 * i2) / 8;
        int i5 = c2942.f11402;
        if (i5 != i4) {
            throw ParserException.m356("Expected block size: " + i4 + "; got: " + i5, null);
        }
        int i6 = i3 * i4;
        int i7 = i6 * 8;
        int iMax = Math.max(i4, i6 / 10);
        this.f19786 = iMax;
        C2153 c2153 = new C2153();
        c2153.f8518 = AbstractC2924.m7101("audio/wav");
        c2153.f8516 = AbstractC2924.m7101(str);
        c2153.f8525 = i7;
        c2153.f8504 = i7;
        c2153.f8519 = iMax;
        c2153.f8517 = i2;
        c2153.f8513 = i3;
        c2153.f8526 = i;
        this.f19788 = new C3446(c2153);
    }

    @Override // defpackage.InterfaceC2043
    /* renamed from: ˏᵙ */
    public void mo1105(long j, int i) {
        C4037 c4037 = new C4037((C2942) this.f19783, 1, i, j);
        ((InterfaceC1982) this.f19782).mo4987(c4037);
        InterfaceC2154 interfaceC2154 = (InterfaceC2154) this.f19784;
        interfaceC2154.mo4407((C3446) this.f19788);
        interfaceC2154.mo4412(c4037.f15168);
    }

    @Override // defpackage.InterfaceC2043
    /* renamed from: ᵥᵯˎ */
    public void mo1106(long j) {
        this.f19787 = j;
        this.f19785 = 0;
        this.f19789 = 0L;
    }

    @Override // defpackage.InterfaceC2043
    /* renamed from: ᵴᵳ */
    public boolean mo1107(InterfaceC1383 interfaceC1383, long j) {
        int i;
        int i2;
        long j2 = j;
        while (j2 > 0 && (i = this.f19785) < (i2 = this.f19786)) {
            int iMo4408 = ((InterfaceC2154) this.f19784).mo4408(interfaceC1383, (int) Math.min(i2 - i, j2), true);
            if (iMo4408 == -1) {
                j2 = 0;
            } else {
                this.f19785 += iMo4408;
                j2 -= iMo4408;
            }
        }
        C2942 c2942 = (C2942) this.f19783;
        int i3 = c2942.f11402;
        int i4 = this.f19785 / i3;
        if (i4 > 0) {
            long j3 = this.f19787;
            long j4 = this.f19789;
            long j5 = c2942.f11404;
            String str = AbstractC3558.f13329;
            long jM8115 = j3 + AbstractC3558.m8115(j4, 1000000L, j5, RoundingMode.DOWN);
            int i5 = i4 * i3;
            int i6 = this.f19785 - i5;
            ((InterfaceC2154) this.f19784).mo4410(jM8115, 1, i5, i6, null);
            this.f19789 += i4;
            this.f19785 = i6;
        }
        return j2 <= 0;
    }
}
