package b0;

import androidx.media3.decoder.midi.MidiDecoder;
import com.mstar.android.tv.TvLanguage;
import com.mstar.android.tv.TvPvrManager;
import com.seewo.sdk.model.SDKKeyboardCode;
import java.nio.ByteBuffer;

/* JADX INFO: renamed from: b0.b, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public abstract class AbstractC0397b {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    private static final int[] f2978a = {1, 2, 3, 6};

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    private static final int[] f2979b = {48000, MidiDecoder.DEFAULT_SAMPLE_RATE, TvPvrManager.PVR_PLAYBACK_SPEED_FF_32X};

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    private static final int[] f2980c = {24000, 22050, 16000};

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    private static final int[] f2981d = {2, 1, 2, 3, 3, 4, 4, 5};

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    private static final int[] f2982e = {32, 40, 48, 56, 64, 80, 96, 112, 128, 160, TvLanguage.GORONTALO, TvLanguage.INTERLINGUA, 256, TvLanguage.MOSSI, TvLanguage.LULESAMI, TvLanguage.KLINGON, 512, 576, 640};

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    private static final int[] f2983f = {69, 87, 104, 121, TvLanguage.CRIMEANTATAR, TvLanguage.FILIPINO, TvLanguage.HERERO, TvLanguage.KAREN, TvLanguage.LINGALA, TvLanguage.OJIBWA, TvLanguage.WALLOON, TvLanguage.YIDDISH, 557, 696, 835, 975, 1114, 1253, 1393};

    public static int a() {
        return 1536;
    }

    private static int b(int i2, int i3) {
        int i4 = f2979b[i2];
        if (i4 == 44100) {
            return (f2983f[i3 / 2] + (i3 % 2)) * 2;
        }
        int i5 = f2982e[i3 / 2];
        return i4 == 32000 ? i5 * 6 : i5 * 4;
    }

    public static n.x c(t tVar, String str, long j2, String str2) {
        int i2 = f2979b[(tVar.q() & TvLanguage.GORONTALO) >> 6];
        int iQ = tVar.q();
        int i3 = f2981d[(iQ & 56) >> 3];
        if ((iQ & 4) != 0) {
            i3++;
        }
        return n.x.h(str, "audio/ac3", -1, -1, j2, i3, i2, null, str2);
    }

    public static n.x d(s sVar, String str, long j2, String str2) {
        sVar.l(32);
        int iE = sVar.e(2);
        sVar.l(14);
        int iE2 = sVar.e(3);
        if ((iE2 & 1) != 0 && iE2 != 1) {
            sVar.l(2);
        }
        if ((iE2 & 4) != 0) {
            sVar.l(2);
        }
        if (iE2 == 2) {
            sVar.l(2);
        }
        return n.x.h(str, "audio/ac3", -1, -1, j2, f2981d[iE2] + (sVar.d() ? 1 : 0), f2979b[iE], null, str2);
    }

    public static int e(byte[] bArr) {
        byte b2 = bArr[4];
        return b((b2 & 192) >> 6, b2 & SDKKeyboardCode.FUNCTION_KEY_BOARD_F6);
    }

    public static n.x f(t tVar, String str, long j2, String str2) {
        tVar.C(2);
        int i2 = f2979b[(tVar.q() & TvLanguage.GORONTALO) >> 6];
        int iQ = tVar.q();
        int i3 = f2981d[(iQ & 14) >> 1];
        if ((iQ & 1) != 0) {
            i3++;
        }
        return n.x.h(str, "audio/eac3", -1, -1, j2, i3, i2, null, str2);
    }

    public static int g(ByteBuffer byteBuffer) {
        return (((byteBuffer.get(byteBuffer.position() + 4) & 192) >> 6) != 3 ? f2978a[(byteBuffer.get(byteBuffer.position() + 4) & SDKKeyboardCode.FUNCTION_KEY_BOARD_RIGHT_SQUARE_BRACKET) >> 4] : 6) * 256;
    }

    public static int h(byte[] bArr) {
        byte b2 = bArr[4];
        return (((b2 & 192) >> 6) != 3 ? f2978a[(b2 & SDKKeyboardCode.FUNCTION_KEY_BOARD_RIGHT_SQUARE_BRACKET) >> 4] : 6) * 256;
    }

    public static int i(byte[] bArr) {
        return (((bArr[2] & 7) << 8) + (bArr[3] & 255) + 1) * 2;
    }

    public static n.x j(s sVar, String str, long j2, String str2) {
        int i2;
        sVar.l(32);
        int iE = sVar.e(2);
        if (iE == 3) {
            i2 = f2980c[sVar.e(2)];
        } else {
            sVar.l(2);
            i2 = f2979b[iE];
        }
        return n.x.h(str, "audio/eac3", -1, -1, j2, f2981d[sVar.e(3)] + (sVar.d() ? 1 : 0), i2, null, str2);
    }
}
