package O0;

import C3.AbstractC0062y;
import C3.U;
import C3.V;
import C3.W;
import java.util.Objects;
import u0.C1579o;
import u0.T;

/* JADX INFO: loaded from: classes.dex */
public final class p extends o {

    /* JADX INFO: renamed from: A, reason: collision with root package name */
    public final int f4883A;

    /* JADX INFO: renamed from: B, reason: collision with root package name */
    public final int f4884B;

    /* JADX INFO: renamed from: C, reason: collision with root package name */
    public final int f4885C;
    public final int D;

    /* JADX INFO: renamed from: E, reason: collision with root package name */
    public final int f4886E;

    /* JADX INFO: renamed from: F, reason: collision with root package name */
    public final boolean f4887F;

    /* JADX INFO: renamed from: G, reason: collision with root package name */
    public final int f4888G;
    public final boolean H;

    /* JADX INFO: renamed from: I, reason: collision with root package name */
    public final int f4889I;

    /* JADX INFO: renamed from: J, reason: collision with root package name */
    public final boolean f4890J;

    /* JADX INFO: renamed from: K, reason: collision with root package name */
    public final boolean f4891K;

    /* JADX INFO: renamed from: L, reason: collision with root package name */
    public final int f4892L;

    /* JADX INFO: renamed from: u, reason: collision with root package name */
    public final boolean f4893u;

    /* JADX INFO: renamed from: v, reason: collision with root package name */
    public final k f4894v;

    /* JADX INFO: renamed from: w, reason: collision with root package name */
    public final boolean f4895w;

    /* JADX INFO: renamed from: x, reason: collision with root package name */
    public final boolean f4896x;

    /* JADX INFO: renamed from: y, reason: collision with root package name */
    public final boolean f4897y;

    /* JADX INFO: renamed from: z, reason: collision with root package name */
    public final int f4898z;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    /* JADX WARN: Removed duplicated region for block: B:124:0x016c  */
    /* JADX WARN: Removed duplicated region for block: B:131:0x017d  */
    /* JADX WARN: Removed duplicated region for block: B:25:0x0049  */
    /* JADX WARN: Removed duplicated region for block: B:42:0x006f  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public p(int i, T t6, int i5, k kVar, int i8, String str, int i9, boolean z8) {
        boolean z9;
        boolean z10;
        int i10;
        int iB;
        boolean z11;
        int i11;
        C1579o c1579o;
        int i12;
        int i13;
        int i14;
        C1579o c1579o2;
        int i15;
        int i16;
        int i17;
        super(i, t6, i5);
        int i18 = 4;
        int i19 = 2;
        this.f4894v = kVar;
        int i20 = kVar.f4864v ? 24 : 16;
        this.H = false;
        if (!z8 || (((i15 = (c1579o2 = this.f4882t).f17365u) != -1 && i15 > kVar.f17227a) || ((i16 = c1579o2.f17366v) != -1 && i16 > kVar.f17228b))) {
            z9 = false;
        } else {
            float f3 = c1579o2.f17367w;
            if ((f3 == -1.0f || f3 <= kVar.f17229c) && ((i17 = c1579o2.f17354j) == -1 || i17 <= kVar.f17230d)) {
                z9 = true;
            }
        }
        this.f4893u = z9;
        if (!z8 || (((i12 = (c1579o = this.f4882t).f17365u) != -1 && i12 < 0) || ((i13 = c1579o.f17366v) != -1 && i13 < 0))) {
            z10 = false;
        } else {
            float f7 = c1579o.f17367w;
            if ((f7 == -1.0f || f7 >= 0) && ((i14 = c1579o.f17354j) == -1 || i14 >= 0)) {
                z10 = true;
            }
        }
        this.f4895w = z10;
        this.f4896x = I1.a.g(i8, false);
        C1579o c1579o3 = this.f4882t;
        float f8 = c1579o3.f17367w;
        this.f4897y = f8 != -1.0f && f8 >= 10.0f;
        this.f4898z = c1579o3.f17354j;
        int i21 = c1579o3.f17365u;
        this.f4883A = (i21 == -1 || (i11 = c1579o3.f17366v) == -1) ? -1 : i21 * i11;
        int i22 = 0;
        while (true) {
            W w4 = kVar.f17235j;
            i10 = Integer.MAX_VALUE;
            if (i22 >= w4.f1227t) {
                iB = 0;
                i22 = Integer.MAX_VALUE;
                break;
            } else {
                iB = q.b(this.f4882t, (String) w4.get(i22), false);
                if (iB > 0) {
                    break;
                } else {
                    i22++;
                }
            }
        }
        this.f4885C = i22;
        this.D = iB;
        int i23 = this.f4882t.f17351f;
        V v7 = q.i;
        this.f4886E = (i23 == 0 || i23 != 0) ? Integer.bitCount(0) : Integer.MAX_VALUE;
        int i24 = this.f4882t.f17351f;
        this.f4887F = i24 == 0 || (i24 & 1) != 0;
        this.f4888G = q.b(this.f4882t, str, q.e(str) == null);
        int i25 = 0;
        while (true) {
            W w6 = kVar.i;
            if (i25 < w6.f1227t) {
                String str2 = this.f4882t.f17358n;
                if (str2 != null && str2.equals(w6.get(i25))) {
                    i10 = i25;
                    break;
                }
                i25++;
            } else {
                break;
            }
        }
        this.f4884B = i10;
        this.f4890J = (i8 & 384) == 128;
        this.f4891K = (i8 & 64) == 64;
        C1579o c1579o4 = this.f4882t;
        String str3 = c1579o4.f17358n;
        if (str3 != null) {
            switch (str3) {
                case "video/dolby-vision":
                    i18 = 5;
                    break;
                case "video/hevc":
                    i18 = 3;
                    break;
                case "video/avc":
                    i18 = 1;
                    break;
                case "video/x-vnd.on2.vp9":
                    i18 = 2;
                    break;
            }
        } else {
            i18 = 0;
        }
        this.f4892L = i18;
        if ((c1579o4.f17351f & 16384) != 0) {
            i19 = 0;
        } else {
            k kVar2 = this.f4894v;
            if (I1.a.g(i8, kVar2.f4868z) && ((z11 = this.f4893u) || kVar2.f4863u)) {
                if (!I1.a.g(i8, false) || !this.f4895w || !z11 || c1579o4.f17354j == -1 || (i20 & i8) == 0) {
                    i19 = 1;
                }
            }
        }
        this.f4889I = i19;
    }

    public static int c(p pVar, p pVar2) {
        AbstractC0062y abstractC0062yC = AbstractC0062y.f1316a.c(pVar.f4896x, pVar2.f4896x);
        Integer numValueOf = Integer.valueOf(pVar.f4885C);
        Integer numValueOf2 = Integer.valueOf(pVar2.f4885C);
        U u8 = U.f1223s;
        AbstractC0062y abstractC0062yB = abstractC0062yC.b(numValueOf, numValueOf2, u8).a(pVar.D, pVar2.D).a(pVar.f4886E, pVar2.f4886E).c(pVar.f4887F, pVar2.f4887F).a(pVar.f4888G, pVar2.f4888G).c(pVar.f4897y, pVar2.f4897y).c(pVar.f4893u, pVar2.f4893u).c(pVar.f4895w, pVar2.f4895w).b(Integer.valueOf(pVar.f4884B), Integer.valueOf(pVar2.f4884B), u8);
        boolean z8 = pVar2.f4890J;
        boolean z9 = pVar.f4890J;
        AbstractC0062y abstractC0062yC2 = abstractC0062yB.c(z9, z8);
        boolean z10 = pVar2.f4891K;
        boolean z11 = pVar.f4891K;
        AbstractC0062y abstractC0062yC3 = abstractC0062yC2.c(z11, z10);
        if (z9 && z11) {
            abstractC0062yC3 = abstractC0062yC3.a(pVar.f4892L, pVar2.f4892L);
        }
        return abstractC0062yC3.e();
    }

    @Override // O0.o
    public final int a() {
        return this.f4889I;
    }

    @Override // O0.o
    public final boolean b(o oVar) {
        p pVar = (p) oVar;
        if (!this.H && !Objects.equals(this.f4882t.f17358n, pVar.f4882t.f17358n)) {
            return false;
        }
        this.f4894v.getClass();
        return this.f4890J == pVar.f4890J && this.f4891K == pVar.f4891K;
    }
}
