package defpackage;

import java.io.EOFException;

/* JADX INFO: renamed from: ᵬᵢ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes3.dex */
public final class C4068 implements InterfaceC5226 {

    /* JADX INFO: renamed from: ʽˈˋ, reason: contains not printable characters */
    public final InterfaceC1471 f15625;

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

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

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

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

    /* JADX INFO: renamed from: ᵷᵺʾᵖ, reason: contains not printable characters */
    public int f15631 = 0;

    /* JADX INFO: renamed from: ᵨᵣ, reason: contains not printable characters */
    public int f15628 = 0;

    /* JADX INFO: renamed from: ᵻˈᵦʼ, reason: contains not printable characters */
    public byte[] f15633 = AbstractC0956.f4216;

    /* JADX INFO: renamed from: ːˏᵟᵯ, reason: contains not printable characters */
    public final C4545 f15627 = new C4545();

    public C4068(InterfaceC5226 interfaceC5226, InterfaceC1471 interfaceC1471) {
        this.f15629 = interfaceC5226;
        this.f15625 = interfaceC1471;
    }

    @Override // defpackage.InterfaceC5226
    /* JADX INFO: renamed from: ʽˈˋ */
    public final void mo1738(C4545 c4545, int i, int i2) {
        if (this.f15630 == null) {
            this.f15629.mo1738(c4545, i, i2);
            return;
        }
        m8928(i);
        c4545.m9627(this.f15633, this.f15628, i);
        this.f15628 += i;
    }

    /* JADX INFO: renamed from: ˊᵫᵗ, reason: contains not printable characters */
    public final void m8928(int i) {
        int length = this.f15633.length;
        int i2 = this.f15628;
        if (length - i2 >= i) {
            return;
        }
        int i3 = i2 - this.f15631;
        int iMax = Math.max(i3 * 2, i + i3);
        byte[] bArr = this.f15633;
        byte[] bArr2 = iMax <= bArr.length ? bArr : new byte[iMax];
        System.arraycopy(bArr, this.f15631, bArr2, 0, i3);
        this.f15631 = 0;
        this.f15628 = i3;
        this.f15633 = bArr2;
    }

    @Override // defpackage.InterfaceC5226
    /* JADX INFO: renamed from: ːˏᵟᵯ */
    public final int mo1739(InterfaceC0372 interfaceC0372, int i, boolean z) throws EOFException {
        if (this.f15630 == null) {
            return this.f15629.mo1739(interfaceC0372, i, z);
        }
        m8928(i);
        int i2 = interfaceC0372.read(this.f15633, this.f15628, i);
        if (i2 != -1) {
            this.f15628 += i2;
            return i2;
        }
        if (z) {
            return -1;
        }
        throw new EOFException();
    }

    @Override // defpackage.InterfaceC5226
    /* JADX INFO: renamed from: ᵨᵣ */
    public final /* synthetic */ void mo1740(int i, C4545 c4545) {
        AbstractC2704.m6541(this, c4545, i);
    }

    @Override // defpackage.InterfaceC5226
    /* JADX INFO: renamed from: ᵲᵶᵳˈ */
    public final void mo1741(long j, int i, int i2, int i3, C1688 c1688) {
        int i4;
        if (this.f15630 == null) {
            this.f15629.mo1741(j, i, i2, i3, c1688);
            return;
        }
        ᵻᵪ.ᵻʽᵯ("DRM on subtitles is not supported", c1688 == null);
        int i5 = (this.f15628 - i3) - i2;
        try {
            i4 = i5;
        } catch (RuntimeException e) {
            e = e;
            i4 = i5;
        }
        try {
            this.f15630.mo1086(this.f15633, i4, i2, C1589.f6384, new C0519(this, j, i));
        } catch (RuntimeException e2) {
            e = e2;
            RuntimeException runtimeException = e;
            if (!this.f15632) {
                throw runtimeException;
            }
            ˋˀᵧ.ᵠˏˏ("Parsing subtitles failed, ignoring sample.", runtimeException);
        }
        int i6 = i4 + i2;
        this.f15631 = i6;
        if (i6 == this.f15628) {
            this.f15631 = 0;
            this.f15628 = 0;
        }
    }

    @Override // defpackage.InterfaceC5226
    /* JADX INFO: renamed from: ᵵᵽ */
    public final void mo1742(C5286 c5286) {
        c5286.f19987.getClass();
        String str = c5286.f19987;
        ᵻᵪ.ᵱᵽʡᵚ(AbstractC4208.m9141(str) == 3);
        boolean zEquals = c5286.equals(this.f15626);
        InterfaceC1471 interfaceC1471 = this.f15625;
        if (!zEquals) {
            this.f15626 = c5286;
            this.f15630 = interfaceC1471.m4213(c5286) ? interfaceC1471.m4212(c5286) : null;
        }
        InterfaceC3971 interfaceC3971 = this.f15630;
        InterfaceC5226 interfaceC5226 = this.f15629;
        if (interfaceC3971 == null) {
            interfaceC5226.mo1742(c5286);
            return;
        }
        C4753 c4753M10878 = c5286.m10878();
        c4753M10878.f18101 = AbstractC4208.m9132("application/x-media3-cues");
        c4753M10878.f18120 = str;
        c4753M10878.f18094 = Long.MAX_VALUE;
        c4753M10878.f18097 = interfaceC1471.m4211(c5286);
        AbstractC0659.m2415(c4753M10878, interfaceC5226);
    }

    @Override // defpackage.InterfaceC5226
    /* JADX INFO: renamed from: ᵷᵺʾᵖ */
    public final /* synthetic */ void mo1743(long j) {
    }

    @Override // defpackage.InterfaceC5226
    /* JADX INFO: renamed from: ᵻˈᵦʼ */
    public final int mo1744(InterfaceC0372 interfaceC0372, int i, boolean z) {
        return mo1739(interfaceC0372, i, z);
    }
}
