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

import android.util.Pair;
import com.google.android.exoplayer2.extractor.flv.TagPayloadReader;
import java.util.Collections;
import java.util.List;
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.C4121;
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 C3587 extends TagPayloadReader {

    /* JADX INFO: renamed from: ނ, reason: contains not printable characters */
    public static final int[] f10653 = {5512, 11025, 22050, 44100};

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

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

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

    public C3587(InterfaceC3575 interfaceC3575) {
        super(interfaceC3575);
    }

    @Override // com.google.android.exoplayer2.extractor.flv.TagPayloadReader
    /* JADX INFO: renamed from: ֏ */
    public boolean mo1140(C4140 c4140) throws TagPayloadReader.UnsupportedFormatException {
        if (this.f10654) {
            c4140.m6695(1);
        } else {
            int iM6702 = c4140.m6702();
            int i = (iM6702 >> 4) & 15;
            this.f10656 = i;
            if (i == 2) {
                this.f1666.mo5884(C3431.m5585(null, "audio/mpeg", null, -1, -1, 1, f10653[(iM6702 >> 2) & 3], null, null, 0, null));
                this.f10655 = true;
            } else if (i == 7 || i == 8) {
                this.f1666.mo5884(C3431.m5584((String) null, this.f10656 == 7 ? "audio/g711-alaw" : "audio/g711-mlaw", (String) null, -1, -1, 1, 8000, -1, (List<byte[]>) null, (C3526) null, 0, (String) null));
                this.f10655 = true;
            } else if (i != 10) {
                StringBuilder sbM4889 = C2803.m4889("Audio format not supported: ");
                sbM4889.append(this.f10656);
                throw new TagPayloadReader.UnsupportedFormatException(sbM4889.toString());
            }
            this.f10654 = true;
        }
        return true;
    }

    @Override // com.google.android.exoplayer2.extractor.flv.TagPayloadReader
    /* JADX INFO: renamed from: ؠ */
    public boolean mo1142(C4140 c4140, long j) {
        if (this.f10656 == 2) {
            int iM6679 = c4140.m6679();
            this.f1666.mo5885(c4140, iM6679);
            this.f1666.mo5883(j, 1, iM6679, 0, null);
            return true;
        }
        int iM6702 = c4140.m6702();
        if (iM6702 != 0 || this.f10655) {
            if (this.f10656 == 10 && iM6702 != 1) {
                return false;
            }
            int iM66792 = c4140.m6679();
            this.f1666.mo5885(c4140, iM66792);
            this.f1666.mo5883(j, 1, iM66792, 0, null);
            return true;
        }
        int iM66793 = c4140.m6679();
        byte[] bArr = new byte[iM66793];
        System.arraycopy(c4140.f13227, c4140.f13228, bArr, 0, iM66793);
        c4140.f13228 += iM66793;
        Pair<Integer, Integer> pairM6622 = C4121.m6622(bArr);
        this.f1666.mo5884(C3431.m5585(null, "audio/mp4a-latm", null, -1, -1, ((Integer) pairM6622.second).intValue(), ((Integer) pairM6622.first).intValue(), Collections.singletonList(bArr), null, 0, null));
        this.f10655 = true;
        return false;
    }
}
