package p138.p176.p177.p190.p226.p234;

import com.google.android.exoplayer2.text.SubtitleDecoderException;
import java.util.ArrayList;
import java.util.Collections;
import p138.p176.p177.p190.p226.AbstractC3947;
import p138.p176.p177.p190.p226.InterfaceC3949;
import p138.p176.p177.p190.p226.p234.C4005;
import p138.p176.p177.p190.p239.C4140;
import p138.p176.p177.p190.p239.C4150;

/* JADX INFO: renamed from: ދ.ހ.֏.ؠ.ໟ.ސ.ؠ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public final class C4002 extends AbstractC3947 {

    /* JADX INFO: renamed from: ތ, reason: contains not printable characters */
    public final C4140 f12661;

    /* JADX INFO: renamed from: ލ, reason: contains not printable characters */
    public final C4005.C4007 f12662;

    public C4002() {
        super("Mp4WebvttDecoder");
        this.f12661 = new C4140();
        this.f12662 = new C4005.C4007();
    }

    @Override // p138.p176.p177.p190.p226.AbstractC3947
    /* JADX INFO: renamed from: ֏ */
    public InterfaceC3949 mo6372(byte[] bArr, int i, boolean z) throws SubtitleDecoderException {
        C4140 c4140 = this.f12661;
        c4140.f13227 = bArr;
        c4140.f13229 = i;
        c4140.f13228 = 0;
        ArrayList arrayList = new ArrayList();
        while (this.f12661.m6679() > 0) {
            if (this.f12661.m6679() < 8) {
                throw new SubtitleDecoderException("Incomplete Mp4Webvtt Top Level box header found.");
            }
            int iM6688 = this.f12661.m6688();
            if (this.f12661.m6688() == 1987343459) {
                C4140 c41402 = this.f12661;
                C4005.C4007 c4007 = this.f12662;
                int i2 = iM6688 - 8;
                c4007.m6457();
                while (i2 > 0) {
                    if (i2 < 8) {
                        throw new SubtitleDecoderException("Incomplete vtt cue box header found.");
                    }
                    int iM66882 = c41402.m6688();
                    int iM66883 = c41402.m6688();
                    int i3 = iM66882 - 8;
                    String strM6761 = C4150.m6761(c41402.f13227, c41402.f13228, i3);
                    c41402.m6695(i3);
                    i2 = (i2 - 8) - i3;
                    if (iM66883 == 1937011815) {
                        C4008.m6460(strM6761, c4007);
                    } else if (iM66883 == 1885436268) {
                        C4008.m6459(null, strM6761.trim(), c4007, Collections.emptyList());
                    }
                }
                arrayList.add(c4007.m6456());
            } else {
                this.f12661.m6695(iM6688 - 8);
            }
        }
        return new C4003(arrayList);
    }
}
