package p138.p176.p177.p190.p239;

import android.util.Pair;
import com.google.android.exoplayer2.ParserException;
import p000.p001.p002.p003.p004.C0567;
import p138.p139.p143.p144.C2803;

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

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public static final byte[] f13168 = {0, 0, 0, 1};

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public static final int[] f13169 = {96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350};

    /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
    public static final int[] f13170 = {0, 1, 2, 3, 4, 5, 6, 8, -1, -1, -1, 7, 8, -1, 8, -1};

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public static int m6620(C4139 c4139) {
        int iM6667 = c4139.m6667(4);
        if (iM6667 == 15) {
            return c4139.m6667(24);
        }
        C0567.m1896(iM6667 < 13);
        return f13169[iM6667];
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public static Pair<Integer, Integer> m6621(C4139 c4139, boolean z) throws ParserException {
        int iM6667 = c4139.m6667(5);
        if (iM6667 == 31) {
            iM6667 = c4139.m6667(6) + 32;
        }
        int iM6620 = m6620(c4139);
        int iM66672 = c4139.m6667(4);
        if (iM6667 == 5 || iM6667 == 29) {
            iM6620 = m6620(c4139);
            int iM66673 = c4139.m6667(5);
            if (iM66673 == 31) {
                iM66673 = c4139.m6667(6) + 32;
            }
            iM6667 = iM66673;
            if (iM6667 == 22) {
                iM66672 = c4139.m6667(4);
            }
        }
        if (z) {
            if (iM6667 != 1 && iM6667 != 2 && iM6667 != 3 && iM6667 != 4 && iM6667 != 6 && iM6667 != 7 && iM6667 != 17) {
                switch (iM6667) {
                    case 19:
                    case 20:
                    case 21:
                    case 22:
                    case 23:
                        break;
                    default:
                        throw new ParserException(C2803.m4871("Unsupported audio object type: ", iM6667));
                }
            }
            c4139.m6675(1);
            if (c4139.m6677()) {
                c4139.m6675(14);
            }
            boolean zM6677 = c4139.m6677();
            if (iM66672 == 0) {
                throw new UnsupportedOperationException();
            }
            if (iM6667 == 6 || iM6667 == 20) {
                c4139.m6675(3);
            }
            if (zM6677) {
                if (iM6667 == 22) {
                    c4139.m6675(16);
                }
                if (iM6667 == 17 || iM6667 == 19 || iM6667 == 20 || iM6667 == 23) {
                    c4139.m6675(3);
                }
                c4139.m6675(1);
            }
            switch (iM6667) {
                case 17:
                case 19:
                case 20:
                case 21:
                case 22:
                case 23:
                    int iM66674 = c4139.m6667(2);
                    if (iM66674 == 2 || iM66674 == 3) {
                        throw new ParserException(C2803.m4871("Unsupported epConfig: ", iM66674));
                    }
                    break;
            }
        }
        int i = f13170[iM66672];
        C0567.m1896(i != -1);
        return Pair.create(Integer.valueOf(iM6620), Integer.valueOf(i));
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public static Pair<Integer, Integer> m6622(byte[] bArr) {
        return m6621(new C4139(bArr), false);
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public static boolean m6623(byte[] bArr, int i) {
        if (bArr.length - i <= f13168.length) {
            return false;
        }
        int i2 = 0;
        while (true) {
            byte[] bArr2 = f13168;
            if (i2 >= bArr2.length) {
                return true;
            }
            if (bArr[i + i2] != bArr2[i2]) {
                return false;
            }
            i2++;
        }
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public static byte[] m6624(int i, int i2, int i3) {
        return new byte[]{(byte) (((i << 3) & 248) | ((i2 >> 1) & 7)), (byte) (((i2 << 7) & 128) | ((i3 << 3) & 120))};
    }
}
