package defpackage;

import android.content.Context;
import android.graphics.Point;
import android.media.MediaCodecInfo;
import android.os.Build;
import android.util.Pair;
import android.util.Range;
import j$.util.Objects;

/* renamed from: ʿˁᵽ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public final class C0381 {

    /* renamed from: ˇʼʤˎ, reason: contains not printable characters */
    public final boolean f2179;

    /* renamed from: ˌᵜᵹᵩ, reason: contains not printable characters */
    public float f2180;

    /* renamed from: ˎˏʜʾ, reason: contains not printable characters */
    public final boolean f2181;

    /* renamed from: ˏˋٴ, reason: contains not printable characters */
    public final boolean f2182;

    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public final String f2183;

    /* renamed from: ᵝᵵᵺ, reason: contains not printable characters */
    public final boolean f2184;

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public final String f2185;

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public final String f2186;

    /* renamed from: ᵶᵷᵕ, reason: contains not printable characters */
    public int f2187;

    /* renamed from: ᵸˑ, reason: contains not printable characters */
    public int f2188;

    /* renamed from: ᵹᵝᵶ, reason: contains not printable characters */
    public final boolean f2189;

    /* renamed from: ᵻᵢﹳᵰ, reason: contains not printable characters */
    public final MediaCodecInfo.CodecCapabilities f2190;

    public C0381(String str, String str2, String str3, MediaCodecInfo.CodecCapabilities codecCapabilities, boolean z, boolean z2, boolean z3, boolean z4, boolean z5, boolean z6) {
        str.getClass();
        this.f2185 = str;
        this.f2186 = str2;
        this.f2183 = str3;
        this.f2190 = codecCapabilities;
        this.f2181 = z;
        this.f2179 = z4;
        this.f2182 = z5;
        this.f2189 = z6;
        this.f2184 = AbstractC2924.m7110(str2);
        this.f2180 = -3.4028235E38f;
        this.f2187 = -1;
        this.f2188 = -1;
    }

    /* JADX WARN: Removed duplicated region for block: B:34:0x006f  */
    /* renamed from: ᵝᵵᵺ, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public static defpackage.C0381 m1818(java.lang.String r11, java.lang.String r12, java.lang.String r13, android.media.MediaCodecInfo.CodecCapabilities r14, boolean r15, boolean r16, boolean r17, boolean r18) {
        /*
            ʿˁᵽ r0 = new ʿˁᵽ
            r1 = 0
            r2 = 1
            if (r14 == 0) goto L10
            java.lang.String r3 = "adaptive-playback"
            boolean r3 = r14.isFeatureSupported(r3)
            if (r3 == 0) goto L10
            r8 = r2
            goto L11
        L10:
            r8 = r1
        L11:
            if (r14 == 0) goto L19
            java.lang.String r3 = "tunneled-playback"
            boolean r3 = r14.isFeatureSupported(r3)
        L19:
            if (r18 != 0) goto L28
            if (r14 == 0) goto L26
            java.lang.String r3 = "secure-playback"
            boolean r3 = r14.isFeatureSupported(r3)
            if (r3 == 0) goto L26
            goto L28
        L26:
            r9 = r1
            goto L29
        L28:
            r9 = r2
        L29:
            int r3 = android.os.Build.VERSION.SDK_INT
            r4 = 35
            if (r3 < r4) goto L6f
            if (r14 == 0) goto L6f
            java.lang.String r3 = "detached-surface"
            boolean r3 = r14.isFeatureSupported(r3)
            if (r3 == 0) goto L6f
            java.lang.String r3 = android.os.Build.MANUFACTURER
            java.lang.String r4 = "Xiaomi"
            boolean r4 = r3.equals(r4)
            if (r4 != 0) goto L6f
            java.lang.String r4 = "OPPO"
            boolean r4 = r3.equals(r4)
            if (r4 != 0) goto L6f
            java.lang.String r4 = "realme"
            boolean r4 = r3.equals(r4)
            if (r4 != 0) goto L6f
            java.lang.String r4 = "motorola"
            boolean r4 = r3.equals(r4)
            if (r4 != 0) goto L6f
            java.lang.String r4 = "LENOVO"
            boolean r3 = r3.equals(r4)
            if (r3 == 0) goto L64
            goto L6f
        L64:
            r10 = r2
            r1 = r11
            r3 = r13
            r4 = r14
            r5 = r15
            r6 = r16
            r7 = r17
            r2 = r12
            goto L79
        L6f:
            r10 = r1
            r2 = r12
            r3 = r13
            r4 = r14
            r5 = r15
            r6 = r16
            r7 = r17
            r1 = r11
        L79:
            r0.<init>(r1, r2, r3, r4, r5, r6, r7, r8, r9, r10)
            return r0
        */
        throw new UnsupportedOperationException("Method not decompiled: defpackage.C0381.m1818(java.lang.String, java.lang.String, java.lang.String, android.media.MediaCodecInfo$CodecCapabilities, boolean, boolean, boolean, boolean):ʿˁᵽ");
    }

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public static boolean m1819(MediaCodecInfo.VideoCapabilities videoCapabilities, int i, int i2, double d) {
        Range<Double> achievableFrameRatesFor;
        int widthAlignment = videoCapabilities.getWidthAlignment();
        int heightAlignment = videoCapabilities.getHeightAlignment();
        Point point = new Point(AbstractC3558.m8116(i, widthAlignment) * widthAlignment, AbstractC3558.m8116(i2, heightAlignment) * heightAlignment);
        int i3 = point.x;
        int i4 = point.y;
        if (d == -1.0d || d < 1.0d) {
            return videoCapabilities.isSizeSupported(i3, i4);
        }
        double dFloor = Math.floor(d);
        if (videoCapabilities.areSizeAndRateSupported(i3, i4, dFloor)) {
            return Build.VERSION.SDK_INT < 24 || (achievableFrameRatesFor = videoCapabilities.getAchievableFrameRatesFor(i3, i4)) == null || dFloor <= ((Double) achievableFrameRatesFor.getUpper()).doubleValue();
        }
        return false;
    }

    public final String toString() {
        return this.f2185;
    }

    /* renamed from: ˇʼʤˎ, reason: contains not printable characters */
    public final boolean m1820(Context context, C3446 c3446) {
        int i;
        String str = c3446.f12929;
        String str2 = this.f2186;
        if ((!str2.equals(str) && !str2.equals(AbstractC5552.m11164(c3446))) || !m1823(context, c3446, true) || !m1826(c3446)) {
            return false;
        }
        if (this.f2184) {
            int i2 = c3446.f12924;
            if (i2 > 0 && (i = c3446.f12920) > 0) {
                return m1821(i2, i, c3446.f12921);
            }
        } else {
            int i3 = c3446.f12936;
            MediaCodecInfo.CodecCapabilities codecCapabilities = this.f2190;
            if (i3 != -1) {
                if (codecCapabilities == null) {
                    m1825("sampleRate.caps");
                    return false;
                }
                MediaCodecInfo.AudioCapabilities audioCapabilities = codecCapabilities.getAudioCapabilities();
                if (audioCapabilities == null) {
                    m1825("sampleRate.aCaps");
                    return false;
                }
                if (!audioCapabilities.isSampleRateSupported(i3)) {
                    m1825("sampleRate.support, " + i3);
                    return false;
                }
            }
            int i4 = c3446.f12923;
            if (i4 != -1) {
                if (codecCapabilities == null) {
                    m1825("channelCount.caps");
                    return false;
                }
                MediaCodecInfo.AudioCapabilities audioCapabilities2 = codecCapabilities.getAudioCapabilities();
                if (audioCapabilities2 == null) {
                    m1825("channelCount.aCaps");
                    return false;
                }
                int maxInputChannelCount = audioCapabilities2.getMaxInputChannelCount();
                if (maxInputChannelCount <= 1 && ((Build.VERSION.SDK_INT < 26 || maxInputChannelCount <= 0) && !"audio/mpeg".equals(str2) && !"audio/3gpp".equals(str2) && !"audio/amr-wb".equals(str2) && !"audio/mp4a-latm".equals(str2) && !"audio/vorbis".equals(str2) && !"audio/opus".equals(str2) && !"audio/raw".equals(str2) && !"audio/flac".equals(str2) && !"audio/g711-alaw".equals(str2) && !"audio/g711-mlaw".equals(str2) && !"audio/gsm".equals(str2))) {
                    int i5 = "audio/ac3".equals(str2) ? 6 : "audio/eac3".equals(str2) ? 16 : 30;
                    ᵳʿˉ.ᵶʔᵢˊ("AssumedMaxChannelAdjustment: " + this.f2185 + ", [" + maxInputChannelCount + " to " + i5 + "]");
                    maxInputChannelCount = i5;
                }
                if (maxInputChannelCount < i4) {
                    m1825("channelCount.support, " + i4);
                    return false;
                }
            }
        }
        return true;
    }

    /* JADX WARN: Removed duplicated region for block: B:28:0x0053  */
    /* renamed from: ˎˏʜʾ, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public final boolean m1821(int r9, int r10, double r11) {
        /*
            r8 = this;
            r0 = 0
            android.media.MediaCodecInfo$CodecCapabilities r1 = r8.f2190
            if (r1 != 0) goto Lb
            java.lang.String r9 = "sizeAndRate.caps"
            r8.m1825(r9)
            return r0
        Lb:
            android.media.MediaCodecInfo$VideoCapabilities r1 = r1.getVideoCapabilities()
            if (r1 != 0) goto L17
            java.lang.String r9 = "sizeAndRate.vCaps"
            r8.m1825(r9)
            return r0
        L17:
            int r2 = android.os.Build.VERSION.SDK_INT
            r3 = 29
            java.lang.String r4 = "@"
            java.lang.String r5 = "x"
            r6 = 1
            if (r2 < r3) goto L4d
            if (r2 < r3) goto L34
            java.lang.Boolean r2 = ᵳـᵔʤ.ˏˋٴ
            if (r2 == 0) goto L2f
            boolean r2 = r2.booleanValue()
            if (r2 == 0) goto L2f
            goto L34
        L2f:
            int r2 = defpackage.AbstractC5363.m11011(r1, r9, r10, r11)
            goto L35
        L34:
            r2 = r0
        L35:
            r3 = 2
            if (r2 != r3) goto L3a
            goto Lb3
        L3a:
            if (r2 != r6) goto L4d
            java.lang.String r1 = "sizeAndRate.cover, "
            java.lang.StringBuilder r9 = defpackage.AbstractC4486.m9555(r1, r9, r5, r10, r4)
            r9.append(r11)
            java.lang.String r9 = r9.toString()
            r8.m1825(r9)
            return r0
        L4d:
            boolean r2 = m1819(r1, r9, r10, r11)
            if (r2 != 0) goto Lb3
            if (r9 >= r10) goto La2
            java.lang.String r2 = "OMX.MTK.VIDEO.DECODER.HEVC"
            java.lang.String r3 = r8.f2185
            boolean r2 = r2.equals(r3)
            if (r2 == 0) goto L6a
            java.lang.String r2 = "mcv5a"
            java.lang.String r7 = android.os.Build.DEVICE
            boolean r2 = r2.equals(r7)
            if (r2 == 0) goto L6a
            goto La2
        L6a:
            boolean r1 = m1819(r1, r10, r9, r11)
            if (r1 != 0) goto L71
            goto La2
        L71:
            java.lang.String r0 = "sizeAndRate.rotated, "
            java.lang.StringBuilder r9 = defpackage.AbstractC4486.m9555(r0, r9, r5, r10, r4)
            r9.append(r11)
            java.lang.String r9 = r9.toString()
            java.lang.String r10 = ", "
            java.lang.String r11 = "AssumedSupport ["
            java.lang.String r12 = "] ["
            java.lang.StringBuilder r9 = defpackage.AbstractC1327.m4104(r11, r9, r12, r3, r10)
            java.lang.String r8 = r8.f2186
            r9.append(r8)
            r9.append(r12)
            java.lang.String r8 = defpackage.AbstractC3558.f13329
            r9.append(r8)
            java.lang.String r8 = "]"
            r9.append(r8)
            java.lang.String r8 = r9.toString()
            ᵳʿˉ.ᵝᵵᵺ(r8)
            return r6
        La2:
            java.lang.String r1 = "sizeAndRate.support, "
            java.lang.StringBuilder r9 = defpackage.AbstractC4486.m9555(r1, r9, r5, r10, r4)
            r9.append(r11)
            java.lang.String r9 = r9.toString()
            r8.m1825(r9)
            return r0
        Lb3:
            return r6
        */
        throw new UnsupportedOperationException("Method not decompiled: defpackage.C0381.m1821(int, int, double):boolean");
    }

    /* renamed from: ˏˋٴ, reason: contains not printable characters */
    public final boolean m1822(C3446 c3446) {
        if (this.f2184) {
            return this.f2179;
        }
        Pair pairM8993 = AbstractC4109.m8993(c3446);
        return pairM8993 != null && ((Integer) pairM8993.first).intValue() == 42;
    }

    /* JADX WARN: Removed duplicated region for block: B:113:0x01ab  */
    /* JADX WARN: Removed duplicated region for block: B:17:0x004e  */
    /* JADX WARN: Removed duplicated region for block: B:70:0x012a  */
    /* JADX WARN: Removed duplicated region for block: B:78:0x014c  */
    /* JADX WARN: Removed duplicated region for block: B:81:0x0153  */
    /* JADX WARN: Removed duplicated region for block: B:82:0x0156  */
    /* JADX WARN: Type inference failed for: r16v0 */
    /* JADX WARN: Type inference failed for: r16v1, types: [boolean] */
    /* JADX WARN: Type inference failed for: r16v2 */
    /* renamed from: ˏᵙ, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public final boolean m1823(android.content.Context r19, defpackage.C3446 r20, boolean r21) {
        /*
            Method dump skipped, instructions count: 522
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: defpackage.C0381.m1823(android.content.Context, ᵤᵛᵖ, boolean):boolean");
    }

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public final C3767 m1824(C3446 c3446, C3446 c34462) {
        C3446 c34463;
        C3446 c34464;
        int i;
        String str = c3446.f12929;
        C0938 c0938 = c3446.f12906;
        String str2 = c34462.f12929;
        C0938 c09382 = c34462.f12906;
        int i2 = !Objects.equals(str, str2) ? 8 : 0;
        if (this.f2184) {
            if (c3446.f12919 != c34462.f12919) {
                i2 |= 1024;
            }
            boolean z = (c3446.f12924 == c34462.f12924 && c3446.f12920 == c34462.f12920) ? false : true;
            if (!this.f2179 && z) {
                i2 |= 512;
            }
            if ((!C0938.m3187(c0938) || !C0938.m3187(c09382)) && !Objects.equals(c0938, c09382)) {
                i2 |= 2048;
            }
            if (Build.MODEL.startsWith("SM-T230") && "OMX.MARVELL.VIDEO.HW.CODA7542DECODER".equals(this.f2185) && !c3446.m7830(c34462)) {
                i2 |= 2;
            }
            int i3 = c3446.f12939;
            if (i3 != -1 && (i = c3446.f12938) != -1 && i3 == c34462.f12939 && i == c34462.f12938 && z) {
                i2 |= 2;
            }
            if (i2 == 0 && Objects.equals(c34462.f12929, "video/dolby-vision")) {
                Pair pairM8993 = AbstractC4109.m8993(c3446);
                Pair pairM89932 = AbstractC4109.m8993(c34462);
                if (pairM8993 == null || pairM89932 == null || !((Integer) pairM8993.first).equals(pairM89932.first)) {
                    i2 |= 2;
                }
            }
            if (i2 == 0) {
                return new C3767(this.f2185, c3446, c34462, c3446.m7830(c34462) ? 3 : 2, 0);
            }
            c34463 = c3446;
            c34464 = c34462;
        } else {
            c34463 = c3446;
            c34464 = c34462;
            if (c34463.f12923 != c34464.f12923) {
                i2 |= 4096;
            }
            if (c34463.f12936 != c34464.f12936) {
                i2 |= 8192;
            }
            if (c34463.f12912 != c34464.f12912) {
                i2 |= 16384;
            }
            String str3 = this.f2186;
            if (i2 == 0 && (str3.equals("audio/mp4a-latm") || str3.equals("audio/ac4"))) {
                Pair pairM89933 = AbstractC4109.m8993(c34463);
                Pair pairM89934 = AbstractC4109.m8993(c34464);
                if (pairM89933 != null && pairM89934 != null) {
                    int iIntValue = ((Integer) pairM89933.first).intValue();
                    int iIntValue2 = ((Integer) pairM89934.first).intValue();
                    if (iIntValue == 42 && iIntValue2 == 42) {
                        return new C3767(this.f2185, c34463, c34464, 3, 0);
                    }
                    if (str3.equals("audio/ac4") && pairM89933.equals(pairM89934)) {
                        return new C3767(this.f2185, c34463, c34464, 3, 0);
                    }
                }
            }
            if (i2 == 0 && (str3.equals("audio/eac3-joc") || str3.equals("audio/eac3"))) {
                return new C3767(this.f2185, c34463, c34464, 3, 0);
            }
            if (!c34463.m7830(c34464)) {
                i2 |= 32;
            }
            if ("audio/opus".equals(str3)) {
                i2 |= 2;
            }
            if (i2 == 0) {
                return new C3767(this.f2185, c34463, c34464, 1, 0);
            }
        }
        return new C3767(this.f2185, c34463, c34464, 0, i2);
    }

    /* renamed from: ᵹᵝᵶ, reason: contains not printable characters */
    public final void m1825(String str) {
        ᵳʿˉ.ᵝᵵᵺ("NoSupport [" + str + "] [" + this.f2185 + ", " + this.f2186 + "] [" + AbstractC3558.f13329 + "]");
    }

    /* renamed from: ᵻᵢﹳᵰ, reason: contains not printable characters */
    public final boolean m1826(C3446 c3446) {
        return (Objects.equals(c3446.f12929, "audio/flac") && c3446.f12912 == 22 && Build.VERSION.SDK_INT < 34 && this.f2185.equals("c2.android.flac.decoder")) ? false : true;
    }
}
