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

import com.google.android.exoplayer2.ParserException;
import com.google.android.exoplayer2.extractor.flv.TagPayloadReader;
import p138.p139.p143.p144.C2803;
import p138.p176.p177.p190.C3431;
import p138.p176.p177.p190.p194.C3526;
import p138.p176.p177.p190.p198.InterfaceC3575;
import p138.p176.p177.p190.p239.C4136;
import p138.p176.p177.p190.p239.C4140;
import p138.p176.p177.p190.p240.C4158;

/* JADX INFO: renamed from: ދ.ހ.֏.ؠ.ೲ.ޗ.ށ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public final class C3590 extends TagPayloadReader {

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

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

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

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

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

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

    public C3590(InterfaceC3575 interfaceC3575) {
        super(interfaceC3575);
        this.f10674 = new C4140(C4136.f13203);
        this.f10675 = new C4140(4);
    }

    @Override // com.google.android.exoplayer2.extractor.flv.TagPayloadReader
    /* JADX INFO: renamed from: ֏ */
    public boolean mo1140(C4140 c4140) throws TagPayloadReader.UnsupportedFormatException {
        int iM6702 = c4140.m6702();
        int i = (iM6702 >> 4) & 15;
        int i2 = iM6702 & 15;
        if (i2 != 7) {
            throw new TagPayloadReader.UnsupportedFormatException(C2803.m4871("Video format not supported: ", i2));
        }
        this.f10679 = i;
        return i != 5;
    }

    @Override // com.google.android.exoplayer2.extractor.flv.TagPayloadReader
    /* JADX INFO: renamed from: ؠ */
    public boolean mo1142(C4140 c4140, long j) throws ParserException {
        int iM6702 = c4140.m6702();
        byte[] bArr = c4140.f13227;
        int i = c4140.f13228;
        int i2 = i + 1;
        c4140.f13228 = i2;
        int i3 = ((bArr[i] & 255) << 24) >> 8;
        int i4 = i2 + 1;
        c4140.f13228 = i4;
        int i5 = i3 | ((bArr[i2] & 255) << 8);
        c4140.f13228 = i4 + 1;
        long j2 = (((long) ((bArr[i4] & 255) | i5)) * 1000) + j;
        if (iM6702 == 0 && !this.f10677) {
            C4140 c41402 = new C4140(new byte[c4140.m6679()]);
            c4140.m6685(c41402.f13227, 0, c4140.m6679());
            C4158 c4158M6812 = C4158.m6812(c41402);
            this.f10676 = c4158M6812.f13293;
            this.f1666.mo5884(C3431.m5581((String) null, "video/avc", (String) null, -1, -1, c4158M6812.f13294, c4158M6812.f13295, -1.0f, c4158M6812.f13292, -1, c4158M6812.f13296, (C3526) null));
            this.f10677 = true;
            return false;
        }
        if (iM6702 != 1 || !this.f10677) {
            return false;
        }
        int i6 = this.f10679 == 1 ? 1 : 0;
        if (!this.f10678 && i6 == 0) {
            return false;
        }
        byte[] bArr2 = this.f10675.f13227;
        bArr2[0] = 0;
        bArr2[1] = 0;
        bArr2[2] = 0;
        int i7 = 4 - this.f10676;
        int i8 = 0;
        while (c4140.m6679() > 0) {
            c4140.m6685(this.f10675.f13227, i7, this.f10676);
            this.f10675.m6693(0);
            int iM6705 = this.f10675.m6705();
            this.f10674.m6693(0);
            this.f1666.mo5885(this.f10674, 4);
            this.f1666.mo5885(c4140, iM6705);
            i8 = i8 + 4 + iM6705;
        }
        this.f1666.mo5883(j2, i6, i8, 0, null);
        this.f10678 = true;
        return true;
    }
}
