package p138.p176.p177.p190.p239;

import java.util.ArrayList;
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.p210.C3710;
import p138.p176.p177.p190.p210.p212.C3724;
import p138.p176.p177.p190.p210.p212.C3726;

/* JADX INFO: renamed from: ދ.ހ.֏.ؠ.ဢ.ވ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public final class C4128 {

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

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

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

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

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

    /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
    public final int f13185;

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

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

    /* JADX INFO: renamed from: ކ, reason: contains not printable characters */
    public final int f13188;

    /* JADX INFO: renamed from: އ, reason: contains not printable characters */
    public final long f13189;

    /* JADX INFO: renamed from: ވ, reason: contains not printable characters */
    public final C4129 f13190;

    /* JADX INFO: renamed from: މ, reason: contains not printable characters */
    public final C3710 f13191;

    /* JADX INFO: renamed from: ދ.ހ.֏.ؠ.ဢ.ވ$֏, reason: contains not printable characters */
    public static class C4129 {

        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public final long[] f13192;

        /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
        public final long[] f13193;

        public C4129(long[] jArr, long[] jArr2) {
            this.f13192 = jArr;
            this.f13193 = jArr2;
        }
    }

    public C4128(int i, int i2, int i3, int i4, int i5, int i6, int i7, long j, C4129 c4129, C3710 c3710) {
        this.f13180 = i;
        this.f13181 = i2;
        this.f13182 = i3;
        this.f13183 = i4;
        this.f13184 = i5;
        this.f13185 = m6637(i5);
        this.f13186 = i6;
        this.f13187 = i7;
        this.f13188 = m6635(i7);
        this.f13189 = j;
        this.f13190 = c4129;
        this.f13191 = c3710;
    }

    public C4128(byte[] bArr, int i) {
        C4139 c4139 = new C4139(bArr);
        c4139.m6672(i * 8);
        this.f13180 = c4139.m6667(16);
        this.f13181 = c4139.m6667(16);
        this.f13182 = c4139.m6667(24);
        this.f13183 = c4139.m6667(24);
        int iM6667 = c4139.m6667(20);
        this.f13184 = iM6667;
        this.f13185 = m6637(iM6667);
        this.f13186 = c4139.m6667(3) + 1;
        int iM66672 = c4139.m6667(5) + 1;
        this.f13187 = iM66672;
        this.f13188 = m6635(iM66672);
        this.f13189 = (C4150.m6807(c4139.m6667(4)) << 32) | C4150.m6807(c4139.m6667(32));
        this.f13190 = null;
        this.f13191 = null;
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public static int m6635(int i) {
        if (i == 8) {
            return 1;
        }
        if (i == 12) {
            return 2;
        }
        if (i == 16) {
            return 4;
        }
        if (i != 20) {
            return i != 24 ? -1 : 6;
        }
        return 5;
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public static C3710 m6636(List<String> list, List<C3724> list2) {
        if (list.isEmpty() && list2.isEmpty()) {
            return null;
        }
        ArrayList arrayList = new ArrayList();
        for (int i = 0; i < list.size(); i++) {
            String str = list.get(i);
            String[] strArrM6795 = C4150.m6795(str, "=");
            if (strArrM6795.length != 2) {
                C2803.m4901("Failed to parse Vorbis comment: ", str, "FlacStreamMetadata");
            } else {
                arrayList.add(new C3726(strArrM6795[0], strArrM6795[1]));
            }
        }
        arrayList.addAll(list2);
        if (arrayList.isEmpty()) {
            return null;
        }
        return new C3710(arrayList);
    }

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public static int m6637(int i) {
        switch (i) {
            case 8000:
                return 4;
            case 16000:
                return 5;
            case 22050:
                return 6;
            case 24000:
                return 7;
            case 32000:
                return 8;
            case 44100:
                return 9;
            case 48000:
                return 10;
            case 88200:
                return 1;
            case 96000:
                return 11;
            case 176400:
                return 2;
            case 192000:
                return 3;
            default:
                return -1;
        }
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public long m6638() {
        long j = this.f13189;
        if (j == 0) {
            return -9223372036854775807L;
        }
        return (j * 1000000) / ((long) this.f13184);
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public long m6639(long j) {
        return C4150.m6789((j * ((long) this.f13184)) / 1000000, 0L, this.f13189 - 1);
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public C3431 m6640(byte[] bArr, C3710 c3710) {
        bArr[4] = -128;
        int i = this.f13183;
        int i2 = i > 0 ? i : -1;
        C3710 c37102 = this.f13191;
        C3710 c3710M6056 = c37102 == null ? c3710 : c37102.m6056(c3710);
        int i3 = this.f13187;
        int i4 = this.f13184;
        int i5 = this.f13186;
        return C3431.m5583((String) null, "audio/flac", (String) null, i3 * i4 * i5, i2, i5, i4, -1, 0, 0, (List<byte[]>) Collections.singletonList(bArr), (C3526) null, 0, (String) null, c3710M6056);
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public C3710 m6641(C3710 c3710) {
        C3710 c37102 = this.f13191;
        return c37102 == null ? c3710 : c37102.m6056(c3710);
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public C4128 m6642(C4129 c4129) {
        return new C4128(this.f13180, this.f13181, this.f13182, this.f13183, this.f13184, this.f13186, this.f13187, this.f13189, c4129, this.f13191);
    }
}
