package u0;

import d5.AbstractC0844a;
import java.util.Arrays;
import x0.AbstractC1709a;

/* JADX INFO: loaded from: classes.dex */
public final class T {

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

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final String f17201b;

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

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final C1579o[] f17203d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public int f17204e;

    static {
        x0.v.G(0);
        x0.v.G(1);
    }

    public T(String str, C1579o... c1579oArr) {
        AbstractC1709a.d(c1579oArr.length > 0);
        this.f17201b = str;
        this.f17203d = c1579oArr;
        this.f17200a = c1579oArr.length;
        int iH = E.h(c1579oArr[0].f17358n);
        this.f17202c = iH == -1 ? E.h(c1579oArr[0].f17357m) : iH;
        String str2 = c1579oArr[0].f17349d;
        str2 = (str2 == null || str2.equals("und")) ? "" : str2;
        int i = c1579oArr[0].f17351f | 16384;
        for (int i5 = 1; i5 < c1579oArr.length; i5++) {
            String str3 = c1579oArr[i5].f17349d;
            if (!str2.equals((str3 == null || str3.equals("und")) ? "" : str3)) {
                b("languages", c1579oArr[0].f17349d, c1579oArr[i5].f17349d, i5);
                return;
            } else {
                if (i != (c1579oArr[i5].f17351f | 16384)) {
                    b("role flags", Integer.toBinaryString(c1579oArr[0].f17351f), Integer.toBinaryString(c1579oArr[i5].f17351f), i5);
                    return;
                }
            }
        }
    }

    public static void b(String str, String str2, String str3, int i) {
        AbstractC1709a.p("TrackGroup", "", new IllegalStateException("Different " + str + " combined in one TrackGroup: '" + str2 + "' (track 0) and '" + str3 + "' (track " + i + ")"));
    }

    public final int a(C1579o c1579o) {
        int i = 0;
        while (true) {
            C1579o[] c1579oArr = this.f17203d;
            if (i >= c1579oArr.length) {
                return -1;
            }
            if (c1579o == c1579oArr[i]) {
                return i;
            }
            i++;
        }
    }

    public final boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj != null && T.class == obj.getClass()) {
            T t6 = (T) obj;
            if (this.f17201b.equals(t6.f17201b) && Arrays.equals(this.f17203d, t6.f17203d)) {
                return true;
            }
        }
        return false;
    }

    public final int hashCode() {
        if (this.f17204e == 0) {
            this.f17204e = Arrays.hashCode(this.f17203d) + AbstractC0844a.g(527, 31, this.f17201b);
        }
        return this.f17204e;
    }

    public final String toString() {
        return this.f17201b + ": " + Arrays.toString(this.f17203d);
    }
}
