package p138.p176.p177.p190.p198.p206;

import com.google.android.exoplayer2.ParserException;
import java.io.IOException;
import p138.p139.p143.p144.C2803;
import p138.p176.p177.p190.C3431;
import p138.p176.p177.p190.p198.C3558;
import p138.p176.p177.p190.p198.C3570;
import p138.p176.p177.p190.p198.InterfaceC3561;
import p138.p176.p177.p190.p198.InterfaceC3562;
import p138.p176.p177.p190.p198.InterfaceC3571;
import p138.p176.p177.p190.p198.InterfaceC3575;
import p138.p176.p177.p190.p239.C4140;

/* JADX INFO: renamed from: ދ.ހ.֏.ؠ.ೲ.ޜ.֏, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public final class C3650 implements InterfaceC3561 {

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final C3431 f11053;

    /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
    public InterfaceC3575 f11055;

    /* JADX INFO: renamed from: ނ, reason: contains not printable characters */
    public int f11057;

    /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
    public long f11058;

    /* JADX INFO: renamed from: ބ, reason: contains not printable characters */
    public int f11059;

    /* JADX INFO: renamed from: ޅ, reason: contains not printable characters */
    public int f11060;

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public final C4140 f11054 = new C4140(9);

    /* JADX INFO: renamed from: ށ, reason: contains not printable characters */
    public int f11056 = 0;

    public C3650(C3431 c3431) {
        this.f11053 = c3431;
    }

    @Override // p138.p176.p177.p190.p198.InterfaceC3561
    /* JADX INFO: renamed from: ֏ */
    public int mo5886(C3558 c3558, C3570 c3570) throws InterruptedException, IOException {
        while (true) {
            int i = this.f11056;
            boolean z = false;
            boolean z2 = true;
            if (i == 0) {
                this.f11054.m6709();
                if (c3558.m5877(this.f11054.f13227, 0, 8, true)) {
                    if (this.f11054.m6688() != 1380139777) {
                        throw new IOException("Input not RawCC");
                    }
                    this.f11057 = this.f11054.m6702();
                    z = true;
                }
                if (!z) {
                    return -1;
                }
                this.f11056 = 1;
            } else {
                if (i != 1) {
                    if (i != 2) {
                        throw new IllegalStateException();
                    }
                    while (this.f11059 > 0) {
                        this.f11054.m6709();
                        c3558.m5877(this.f11054.f13227, 0, 3, false);
                        this.f11055.mo5885(this.f11054, 3);
                        this.f11060 += 3;
                        this.f11059--;
                    }
                    int i2 = this.f11060;
                    if (i2 > 0) {
                        this.f11055.mo5883(this.f11058, 1, i2, 0, null);
                    }
                    this.f11056 = 1;
                    return 0;
                }
                this.f11054.m6709();
                int i3 = this.f11057;
                if (i3 == 0) {
                    if (c3558.m5877(this.f11054.f13227, 0, 5, true)) {
                        this.f11058 = (this.f11054.m6703() * 1000) / 45;
                        this.f11059 = this.f11054.m6702();
                        this.f11060 = 0;
                    }
                    z2 = false;
                } else {
                    if (i3 != 1) {
                        StringBuilder sbM4889 = C2803.m4889("Unsupported version number: ");
                        sbM4889.append(this.f11057);
                        throw new ParserException(sbM4889.toString());
                    }
                    if (c3558.m5877(this.f11054.f13227, 0, 9, true)) {
                        this.f11058 = this.f11054.m6699();
                        this.f11059 = this.f11054.m6702();
                        this.f11060 = 0;
                    }
                    z2 = false;
                }
                if (!z2) {
                    this.f11056 = 0;
                    return -1;
                }
                this.f11056 = 2;
            }
        }
    }

    @Override // p138.p176.p177.p190.p198.InterfaceC3561
    /* JADX INFO: renamed from: ֏ */
    public void mo5887() {
    }

    @Override // p138.p176.p177.p190.p198.InterfaceC3561
    /* JADX INFO: renamed from: ֏ */
    public void mo5888(long j, long j2) {
        this.f11056 = 0;
    }

    @Override // p138.p176.p177.p190.p198.InterfaceC3561
    /* JADX INFO: renamed from: ֏ */
    public void mo5889(InterfaceC3562 interfaceC3562) {
        interfaceC3562.mo5893(new InterfaceC3571.C3573(-9223372036854775807L, 0L));
        this.f11055 = interfaceC3562.mo5891(0, 3);
        interfaceC3562.mo5892();
        this.f11055.mo5884(this.f11053);
    }

    @Override // p138.p176.p177.p190.p198.InterfaceC3561
    /* JADX INFO: renamed from: ֏ */
    public boolean mo5890(C3558 c3558) {
        this.f11054.m6709();
        c3558.m5875(this.f11054.f13227, 0, 8, false);
        return this.f11054.m6688() == 1380139777;
    }
}
