JavDB.apk(点击下载) / d.java


package u2;

import android.net.Uri;
import android.text.TextUtils;
import android.util.Base64;
import android.util.Pair;
import android.util.Xml;
import b2.l;
import com.google.android.exoplayer2.ParserException;
import com.google.android.exoplayer2.drm.h;
import com.google.android.exoplayer2.u0;
import com.google.android.exoplayer2.upstream.d;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.p1;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.UUID;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import k3.h0;
import k3.j0;
import k3.k0;
import k3.p;
import k3.t;
import n3.c;
import o1.b;
import org.xml.sax.helpers.DefaultHandler;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlPullParserFactory;
import org.xmlpull.v1.XmlSerializer;
import tv.danmaku.ijk.media.player.BuildConfig;
import tv.danmaku.ijk.media.player.IjkMediaMeta;
import u2.k;

public class d extends DefaultHandler implements d.a<c> {

    /* renamed from: b  reason: collision with root package name */
    private static final Pattern f11582b = Pattern.compile("(\\d+)(?:/(\\d+))?");

    /* renamed from: c  reason: collision with root package name */
    private static final Pattern f11583c = Pattern.compile("CC([1-4])=.*");

    /* renamed from: d  reason: collision with root package name */
    private static final Pattern f11584d = Pattern.compile("([1-9]|[1-5][0-9]|6[0-3])=.*");

    /* renamed from: e  reason: collision with root package name */
    private static final int[] f11585e = {-1, 1, 2, 3, 4, 5, 6, 8, 2, 3, 4, 7, 8, 24, 8, 12, 10, 12, 14, 12, 14};

    /* renamed from: a  reason: collision with root package name */
    private final XmlPullParserFactory f11586a;

    /* access modifiers changed from: protected */
    public static final class a {

        /* renamed from: a  reason: collision with root package name */
        public final u0 f11587a;

        /* renamed from: b  reason: collision with root package name */
        public final ImmutableList<b> f11588b;

        /* renamed from: c  reason: collision with root package name */
        public final k f11589c;

        /* renamed from: d  reason: collision with root package name */
        public final String f11590d;

        /* renamed from: e  reason: collision with root package name */
        public final ArrayList<h.b> f11591e;

        /* renamed from: f  reason: collision with root package name */
        public final ArrayList<e> f11592f;

        /* renamed from: g  reason: collision with root package name */
        public final long f11593g;

        /* renamed from: h  reason: collision with root package name */
        public final List<e> f11594h;

        /* renamed from: i  reason: collision with root package name */
        public final List<e> f11595i;

        public a(u0 u0Var, List<b> list, k kVar, String str, ArrayList<h.b> arrayList, ArrayList<e> arrayList2, List<e> list2, List<e> list3, long j7) {
            this.f11587a = u0Var;
            this.f11588b = ImmutableList.copyOf((Collection) list);
            this.f11589c = kVar;
            this.f11590d = str;
            this.f11591e = arrayList;
            this.f11592f = arrayList2;
            this.f11594h = list2;
            this.f11595i = list3;
            this.f11593g = j7;
        }
    }

    public d() {
        try {
            this.f11586a = XmlPullParserFactory.newInstance();
        } catch (XmlPullParserException e7) {
            throw new RuntimeException("Couldn't create XmlPullParserFactory instance", e7);
        }
    }

    protected static int D(List<e> list) {
        String str;
        for (int i7 = 0; i7 < list.size(); i7++) {
            e eVar = list.get(i7);
            if ("urn:scte:dash:cc:cea-608:2015".equals(eVar.f11596a) && (str = eVar.f11597b) != null) {
                Matcher matcher = f11583c.matcher(str);
                if (matcher.matches()) {
                    return Integer.parseInt(matcher.group(1));
                }
                p.i("MpdParser", "Unable to parse CEA-608 channel number from: " + eVar.f11597b);
            }
        }
        return -1;
    }

    protected static int E(List<e> list) {
        String str;
        for (int i7 = 0; i7 < list.size(); i7++) {
            e eVar = list.get(i7);
            if ("urn:scte:dash:cc:cea-708:2015".equals(eVar.f11596a) && (str = eVar.f11597b) != null) {
                Matcher matcher = f11584d.matcher(str);
                if (matcher.matches()) {
                    return Integer.parseInt(matcher.group(1));
                }
                p.i("MpdParser", "Unable to parse CEA-708 service block number from: " + eVar.f11597b);
            }
        }
        return -1;
    }

    protected static long H(XmlPullParser xmlPullParser, String str, long j7) throws ParserException {
        String attributeValue = xmlPullParser.getAttributeValue(null, str);
        if (attributeValue == null) {
            return j7;
        }
        return j0.H0(attributeValue);
    }

    protected static e I(XmlPullParser xmlPullParser, String str) throws XmlPullParserException, IOException {
        String r02 = r0(xmlPullParser, "schemeIdUri", BuildConfig.VERSION_NAME);
        String r03 = r0(xmlPullParser, "value", null);
        String r04 = r0(xmlPullParser, "id", null);
        do {
            xmlPullParser.next();
        } while (!k0.d(xmlPullParser, str));
        return new e(r02, r03, r04);
    }

    /* JADX INFO: Can't fix incorrect switch cases order, some code will duplicate */
    protected static int J(XmlPullParser xmlPullParser) {
        char c7;
        String attributeValue = xmlPullParser.getAttributeValue(null, "value");
        if (attributeValue == null) {
            return -1;
        }
        String e7 = n3.a.e(attributeValue);
        e7.hashCode();
        switch (e7.hashCode()) {
            case 1596796:
                if (e7.equals("4000")) {
                    c7 = 0;
                    break;
                }
                c7 = 65535;
                break;
            case 2937391:
                if (e7.equals("a000")) {
                    c7 = 1;
                    break;
                }
                c7 = 65535;
                break;
            case 3094035:
                if (e7.equals("f801")) {
                    c7 = 2;
                    break;
                }
                c7 = 65535;
                break;
            case 3133436:
                if (e7.equals("fa01")) {
                    c7 = 3;
                    break;
                }
                c7 = 65535;
                break;
            default:
                c7 = 65535;
                break;
        }
        switch (c7) {
            case 0:
                return 1;
            case 1:
                return 2;
            case 2:
                return 6;
            case 3:
                return 8;
            default:
                return -1;
        }
    }

    protected static int K(XmlPullParser xmlPullParser) {
        int U = U(xmlPullParser, "value", -1);
        if (U <= 0 || U >= 33) {
            return -1;
        }
        return U;
    }

    protected static int L(XmlPullParser xmlPullParser) {
        int bitCount;
        String attributeValue = xmlPullParser.getAttributeValue(null, "value");
        if (attributeValue == null || (bitCount = Integer.bitCount(Integer.parseInt(attributeValue, 16))) == 0) {
            return -1;
        }
        return bitCount;
    }

    protected static long M(XmlPullParser xmlPullParser, String str, long j7) {
        String attributeValue = xmlPullParser.getAttributeValue(null, str);
        if (attributeValue == null) {
            return j7;
        }
        return j0.I0(attributeValue);
    }

    protected static String N(List<e> list) {
        for (int i7 = 0; i7 < list.size(); i7++) {
            e eVar = list.get(i7);
            String str = eVar.f11596a;
            if ("tag:dolby.com,2018:dash:EC3_ExtensionType:2018".equals(str) && "JOC".equals(eVar.f11597b)) {
                return "audio/eac3-joc";
            }
            if ("tag:dolby.com,2014:dash:DolbyDigitalPlusExtensionType:2014".equals(str) && "ec+3".equals(eVar.f11597b)) {
                return "audio/eac3-joc";
            }
        }
        return "audio/eac3";
    }

    protected static float R(XmlPullParser xmlPullParser, String str, float f7) {
        String attributeValue = xmlPullParser.getAttributeValue(null, str);
        return attributeValue == null ? f7 : Float.parseFloat(attributeValue);
    }

    protected static float S(XmlPullParser xmlPullParser, float f7) {
        String attributeValue = xmlPullParser.getAttributeValue(null, "frameRate");
        if (attributeValue == null) {
            return f7;
        }
        Matcher matcher = f11582b.matcher(attributeValue);
        if (!matcher.matches()) {
            return f7;
        }
        int parseInt = Integer.parseInt(matcher.group(1));
        String group = matcher.group(2);
        return !TextUtils.isEmpty(group) ? ((float) parseInt) / ((float) Integer.parseInt(group)) : (float) parseInt;
    }

    protected static int U(XmlPullParser xmlPullParser, String str, int i7) {
        String attributeValue = xmlPullParser.getAttributeValue(null, str);
        return attributeValue == null ? i7 : Integer.parseInt(attributeValue);
    }

    protected static long W(List<e> list) {
        for (int i7 = 0; i7 < list.size(); i7++) {
            e eVar = list.get(i7);
            if (n3.a.a("http://dashif.org/guidelines/last-segment-number", eVar.f11596a)) {
                return Long.parseLong(eVar.f11597b);
            }
        }
        return -1;
    }

    protected static long X(XmlPullParser xmlPullParser, String str, long j7) {
        String attributeValue = xmlPullParser.getAttributeValue(null, str);
        return attributeValue == null ? j7 : Long.parseLong(attributeValue);
    }

    protected static int Z(XmlPullParser xmlPullParser) {
        int U = U(xmlPullParser, "value", -1);
        if (U < 0) {
            return -1;
        }
        int[] iArr = f11585e;
        if (U < iArr.length) {
            return iArr[U];
        }
        return -1;
    }

    private long b(List<k.d> list, long j7, long j8, int i7, long j9) {
        int m7 = i7 >= 0 ? i7 + 1 : (int) j0.m(j9 - j7, j8);
        for (int i8 = 0; i8 < m7; i8++) {
            list.add(m(j7, j8));
            j7 += j8;
        }
        return j7;
    }

    private static int p(int i7, int i8) {
        if (i7 == -1) {
            return i8;
        }
        if (i8 == -1) {
            return i7;
        }
        k3.a.f(i7 == i8);
        return i7;
    }

    private static String q(String str, String str2) {
        if (str == null) {
            return str2;
        }
        if (str2 == null) {
            return str;
        }
        k3.a.f(str.equals(str2));
        return str;
    }

    private static void r(ArrayList<h.b> arrayList) {
        String str;
        int i7 = 0;
        while (true) {
            if (i7 >= arrayList.size()) {
                str = null;
                break;
            }
            h.b bVar = arrayList.get(i7);
            if (b.f10008c.equals(bVar.f3964g) && (str = bVar.f3965h) != null) {
                arrayList.remove(i7);
                break;
            }
            i7++;
        }
        if (str != null) {
            for (int i8 = 0; i8 < arrayList.size(); i8++) {
                h.b bVar2 = arrayList.get(i8);
                if (b.f10007b.equals(bVar2.f3964g) && bVar2.f3965h == null) {
                    arrayList.set(i8, new h.b(b.f10008c, str, bVar2.f3966i, bVar2.f3967j));
                }
            }
        }
    }

    protected static String r0(XmlPullParser xmlPullParser, String str, String str2) {
        String attributeValue = xmlPullParser.getAttributeValue(null, str);
        return attributeValue == null ? str2 : attributeValue;
    }

    private static void s(ArrayList<h.b> arrayList) {
        for (int size = arrayList.size() - 1; size >= 0; size--) {
            h.b bVar = arrayList.get(size);
            if (!bVar.f()) {
                int i7 = 0;
                while (true) {
                    if (i7 >= arrayList.size()) {
                        break;
                    } else if (arrayList.get(i7).d(bVar)) {
                        arrayList.remove(size);
                        break;
                    } else {
                        i7++;
                    }
                }
            }
        }
    }

    protected static String s0(XmlPullParser xmlPullParser, String str) throws XmlPullParserException, IOException {
        String str2 = BuildConfig.VERSION_NAME;
        do {
            xmlPullParser.next();
            if (xmlPullParser.getEventType() == 4) {
                str2 = xmlPullParser.getText();
            } else {
                w(xmlPullParser);
            }
        } while (!k0.d(xmlPullParser, str));
        return str2;
    }

    private static long t(long j7, long j8) {
        if (j8 != -9223372036854775807L) {
            j7 = j8;
        }
        if (j7 == Long.MAX_VALUE) {
            return -9223372036854775807L;
        }
        return j7;
    }

    private static String u(String str, String str2) {
        if (t.o(str)) {
            return t.c(str2);
        }
        if (t.s(str)) {
            return t.n(str2);
        }
        if (t.r(str) || t.p(str)) {
            return str;
        }
        if (!"application/mp4".equals(str)) {
            return null;
        }
        String g7 = t.g(str2);
        return "text/vtt".equals(g7) ? "application/x-mp4-vtt" : g7;
    }

    private boolean v(String[] strArr) {
        for (String str : strArr) {
            if (str.startsWith("urn:dvb:dash:profile:dvb-dash:")) {
                return true;
            }
        }
        return false;
    }

    public static void w(XmlPullParser xmlPullParser) throws IOException, XmlPullParserException {
        if (k0.e(xmlPullParser)) {
            int i7 = 1;
            while (i7 != 0) {
                xmlPullParser.next();
                if (k0.e(xmlPullParser)) {
                    i7++;
                } else if (k0.c(xmlPullParser)) {
                    i7--;
                }
            }
        }
    }

    /* JADX INFO: Can't fix incorrect switch cases order, some code will duplicate */
    /* access modifiers changed from: protected */
    public int A(XmlPullParser xmlPullParser) throws XmlPullParserException, IOException {
        char c7;
        String r02 = r0(xmlPullParser, "schemeIdUri", null);
        r02.hashCode();
        int i7 = -1;
        switch (r02.hashCode()) {
            case -2128649360:
                if (r02.equals("urn:dts:dash:audio_channel_configuration:2012")) {
                    c7 = 0;
                    break;
                }
                c7 = 65535;
                break;
            case -1352850286:
                if (r02.equals("urn:mpeg:dash:23003:3:audio_channel_configuration:2011")) {
                    c7 = 1;
                    break;
                }
                c7 = 65535;
                break;
            case -1138141449:
                if (r02.equals("tag:dolby.com,2014:dash:audio_channel_configuration:2011")) {
                    c7 = 2;
                    break;
                }
                c7 = 65535;
                break;
            case -986633423:
                if (r02.equals("urn:mpeg:mpegB:cicp:ChannelConfiguration")) {
                    c7 = 3;
                    break;
                }
                c7 = 65535;
                break;
            case -79006963:
                if (r02.equals("tag:dts.com,2014:dash:audio_channel_configuration:2012")) {
                    c7 = 4;
                    break;
                }
                c7 = 65535;
                break;
            case 312179081:
                if (r02.equals("tag:dts.com,2018:uhd:audio_channel_configuration")) {
                    c7 = 5;
                    break;
                }
                c7 = 65535;
                break;
            case 2036691300:
                if (r02.equals("urn:dolby:dash:audio_channel_configuration:2011")) {
                    c7 = 6;
                    break;
                }
                c7 = 65535;
                break;
            default:
                c7 = 65535;
                break;
        }
        switch (c7) {
            case 0:
            case 4:
                i7 = K(xmlPullParser);
                break;
            case 1:
                i7 = U(xmlPullParser, "value", -1);
                break;
            case 2:
            case 6:
                i7 = J(xmlPullParser);
                break;
            case 3:
                i7 = Z(xmlPullParser);
                break;
            case 5:
                i7 = L(xmlPullParser);
                break;
        }
        do {
            xmlPullParser.next();
        } while (!k0.d(xmlPullParser, "AudioChannelConfiguration"));
        return i7;
    }

    /* access modifiers changed from: protected */
    public long B(XmlPullParser xmlPullParser, long j7) {
        String attributeValue = xmlPullParser.getAttributeValue(null, "availabilityTimeOffset");
        if (attributeValue == null) {
            return j7;
        }
        if ("INF".equals(attributeValue)) {
            return Long.MAX_VALUE;
        }
        return (long) (Float.parseFloat(attributeValue) * 1000000.0f);
    }

    /* access modifiers changed from: protected */
    public List<b> C(XmlPullParser xmlPullParser, List<b> list, boolean z6) throws XmlPullParserException, IOException {
        String attributeValue = xmlPullParser.getAttributeValue(null, "dvb:priority");
        int parseInt = attributeValue != null ? Integer.parseInt(attributeValue) : z6 ? 1 : Integer.MIN_VALUE;
        String attributeValue2 = xmlPullParser.getAttributeValue(null, "dvb:weight");
        int parseInt2 = attributeValue2 != null ? Integer.parseInt(attributeValue2) : 1;
        String attributeValue3 = xmlPullParser.getAttributeValue(null, "serviceLocation");
        String s02 = s0(xmlPullParser, "BaseURL");
        if (h0.b(s02)) {
            if (attributeValue3 == null) {
                attributeValue3 = s02;
            }
            return p1.k(new b(s02, attributeValue3, parseInt, parseInt2));
        }
        ArrayList arrayList = new ArrayList();
        for (int i7 = 0; i7 < list.size(); i7++) {
            b bVar = list.get(i7);
            String d7 = h0.d(bVar.f11565a, s02);
            String str = attributeValue3 == null ? d7 : attributeValue3;
            if (z6) {
                parseInt = bVar.f11567c;
                parseInt2 = bVar.f11568d;
                str = bVar.f11566b;
            }
            arrayList.add(new b(d7, str, parseInt, parseInt2));
        }
        return arrayList;
    }

    /* JADX DEBUG: Failed to insert an additional move for type inference into block B:68:0x0094 */
    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Type inference failed for: r4v0 */
    /* JADX WARN: Type inference failed for: r4v1 */
    /* JADX WARN: Type inference failed for: r4v2, types: [byte[]] */
    /* JADX WARN: Type inference failed for: r4v22 */
    /* JADX WARN: Type inference failed for: r4v23 */
    /* JADX WARN: Type inference failed for: r4v24 */
    /* access modifiers changed from: protected */
    /* JADX WARNING: Removed duplicated region for block: B:41:0x00b4  */
    /* JADX WARNING: Removed duplicated region for block: B:42:0x00bb  */
    /* JADX WARNING: Removed duplicated region for block: B:63:0x0119  */
    public Pair<String, h.b> F(XmlPullParser xmlPullParser) throws XmlPullParserException, IOException {
        String str;
        byte[] bArr;
        UUID uuid;
        String str2;
        UUID uuid2;
        h.b bVar = null;
        String attributeValue = xmlPullParser.getAttributeValue(null, "schemeIdUri");
        if (attributeValue != null) {
            String e7 = n3.a.e(attributeValue);
            e7.hashCode();
            char c7 = 65535;
            switch (e7.hashCode()) {
                case -1980789791:
                    if (e7.equals("urn:uuid:e2719d58-a985-b3c9-781a-b030af78d30e")) {
                        c7 = 0;
                        break;
                    }
                    break;
                case 489446379:
                    if (e7.equals("urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95")) {
                        c7 = 1;
                        break;
                    }
                    break;
                case 755418770:
                    if (e7.equals("urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed")) {
                        c7 = 2;
                        break;
                    }
                    break;
                case 1812765994:
                    if (e7.equals("urn:mpeg:dash:mp4protection:2011")) {
                        c7 = 3;
                        break;
                    }
                    break;
            }
            switch (c7) {
                case 0:
                    uuid = b.f10008c;
                    str2 = null;
                    uuid2 = null;
                    str = uuid2;
                    bArr = uuid2;
                    break;
                case 1:
                    uuid = b.f10010e;
                    str2 = null;
                    uuid2 = null;
                    str = uuid2;
                    bArr = uuid2;
                    break;
                case 2:
                    uuid = b.f10009d;
                    str2 = null;
                    uuid2 = null;
                    str = uuid2;
                    bArr = uuid2;
                    break;
                case 3:
                    str2 = xmlPullParser.getAttributeValue(null, "value");
                    String b7 = k0.b(xmlPullParser, "default_KID");
                    if (!TextUtils.isEmpty(b7) && !"00000000-0000-0000-0000-000000000000".equals(b7)) {
                        String[] split = b7.split("\\s+");
                        UUID[] uuidArr = new UUID[split.length];
                        for (int i7 = 0; i7 < split.length; i7++) {
                            uuidArr[i7] = UUID.fromString(split[i7]);
                        }
                        uuid = b.f10007b;
                        str = null;
                        bArr = l.b(uuid, uuidArr, null);
                        break;
                    } else {
                        uuid = null;
                        uuid2 = uuid;
                        str = uuid2;
                        bArr = uuid2;
                        break;
                    }
                    break;
            }
            do {
                xmlPullParser.next();
                if (!k0.f(xmlPullParser, "clearkey:Laurl") && xmlPullParser.next() == 4) {
                    str = xmlPullParser.getText();
                    bArr = bArr;
                } else if (!k0.f(xmlPullParser, "ms:laurl")) {
                    str = xmlPullParser.getAttributeValue(null, "licenseUrl");
                    bArr = bArr;
                } else if (bArr == 0 && k0.g(xmlPullParser, "pssh") && xmlPullParser.next() == 4) {
                    byte[] decode = Base64.decode(xmlPullParser.getText(), 0);
                    UUID f7 = l.f(decode);
                    if (f7 == null) {
                        p.i("MpdParser", "Skipping malformed cenc:pssh data");
                        uuid = f7;
                        bArr = null;
                    } else {
                        bArr = decode;
                        uuid = f7;
                    }
                } else {
                    if (bArr == 0) {
                        UUID uuid3 = b.f10010e;
                        if (uuid3.equals(uuid) && k0.f(xmlPullParser, "mspr:pro") && xmlPullParser.next() == 4) {
                            bArr = l.a(uuid3, Base64.decode(xmlPullParser.getText(), 0));
                        }
                    }
                    w(xmlPullParser);
                    bArr = bArr;
                }
            } while (!k0.d(xmlPullParser, "ContentProtection"));
            if (uuid != null) {
                bVar = new h.b(uuid, str, "video/mp4", bArr);
            }
            return Pair.create(str2, bVar);
        }
        str2 = null;
        uuid = null;
        uuid2 = uuid;
        str = uuid2;
        bArr = uuid2;
        do {
            xmlPullParser.next();
            if (!k0.f(xmlPullParser, "clearkey:Laurl")) {
            }
            if (!k0.f(xmlPullParser, "ms:laurl")) {
            }
        } while (!k0.d(xmlPullParser, "ContentProtection"));
        if (uuid != null) {
        }
        return Pair.create(str2, bVar);
    }

    /* access modifiers changed from: protected */
    public int G(XmlPullParser xmlPullParser) {
        String attributeValue = xmlPullParser.getAttributeValue(null, "contentType");
        if (TextUtils.isEmpty(attributeValue)) {
            return -1;
        }
        if ("audio".equals(attributeValue)) {
            return 1;
        }
        if ("video".equals(attributeValue)) {
            return 2;
        }
        if ("text".equals(attributeValue)) {
            return 3;
        }
        return -1;
    }

    /* access modifiers changed from: protected */
    public Pair<Long, i2.a> O(XmlPullParser xmlPullParser, String str, String str2, long j7, ByteArrayOutputStream byteArrayOutputStream) throws IOException, XmlPullParserException {
        long X = X(xmlPullParser, "id", 0);
        long X2 = X(xmlPullParser, "duration", -9223372036854775807L);
        long X3 = X(xmlPullParser, "presentationTime", 0);
        long M0 = j0.M0(X2, 1000, j7);
        long M02 = j0.M0(X3, 1000000, j7);
        String r02 = r0(xmlPullParser, "messageData", null);
        byte[] P = P(xmlPullParser, byteArrayOutputStream);
        Long valueOf = Long.valueOf(M02);
        if (r02 != null) {
            P = j0.l0(r02);
        }
        return Pair.create(valueOf, d(str, str2, X, M0, P));
    }

    /* access modifiers changed from: protected */
    public byte[] P(XmlPullParser xmlPullParser, ByteArrayOutputStream byteArrayOutputStream) throws XmlPullParserException, IOException {
        byteArrayOutputStream.reset();
        XmlSerializer newSerializer = Xml.newSerializer();
        newSerializer.setOutput(byteArrayOutputStream, c.f9923c.name());
        xmlPullParser.nextToken();
        while (!k0.d(xmlPullParser, "Event")) {
            switch (xmlPullParser.getEventType()) {
                case 0:
                    newSerializer.startDocument(null, Boolean.FALSE);
                    break;
                case 1:
                    newSerializer.endDocument();
                    break;
                case 2:
                    newSerializer.startTag(xmlPullParser.getNamespace(), xmlPullParser.getName());
                    for (int i7 = 0; i7 < xmlPullParser.getAttributeCount(); i7++) {
                        newSerializer.attribute(xmlPullParser.getAttributeNamespace(i7), xmlPullParser.getAttributeName(i7), xmlPullParser.getAttributeValue(i7));
                    }
                    break;
                case 3:
                    newSerializer.endTag(xmlPullParser.getNamespace(), xmlPullParser.getName());
                    break;
                case 4:
                    newSerializer.text(xmlPullParser.getText());
                    break;
                case 5:
                    newSerializer.cdsect(xmlPullParser.getText());
                    break;
                case 6:
                    newSerializer.entityRef(xmlPullParser.getText());
                    break;
                case 7:
                    newSerializer.ignorableWhitespace(xmlPullParser.getText());
                    break;
                case 8:
                    newSerializer.processingInstruction(xmlPullParser.getText());
                    break;
                case 9:
                    newSerializer.comment(xmlPullParser.getText());
                    break;
                case 10:
                    newSerializer.docdecl(xmlPullParser.getText());
                    break;
            }
            xmlPullParser.nextToken();
        }
        newSerializer.flush();
        return byteArrayOutputStream.toByteArray();
    }

    /* access modifiers changed from: protected */
    public f Q(XmlPullParser xmlPullParser) throws XmlPullParserException, IOException {
        String r02 = r0(xmlPullParser, "schemeIdUri", BuildConfig.VERSION_NAME);
        String r03 = r0(xmlPullParser, "value", BuildConfig.VERSION_NAME);
        long X = X(xmlPullParser, "timescale", 1);
        ArrayList arrayList = new ArrayList();
        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(IjkMediaMeta.FF_PROFILE_H264_CONSTRAINED);
        do {
            xmlPullParser.next();
            if (k0.f(xmlPullParser, "Event")) {
                arrayList.add(O(xmlPullParser, r02, r03, X, byteArrayOutputStream));
            } else {
                w(xmlPullParser);
            }
        } while (!k0.d(xmlPullParser, "EventStream"));
        long[] jArr = new long[arrayList.size()];
        i2.a[] aVarArr = new i2.a[arrayList.size()];
        for (int i7 = 0; i7 < arrayList.size(); i7++) {
            Pair pair = (Pair) arrayList.get(i7);
            jArr[i7] = ((Long) pair.first).longValue();
            aVarArr[i7] = (i2.a) pair.second;
        }
        return e(r02, r03, X, jArr, aVarArr);
    }

    /* access modifiers changed from: protected */
    public i T(XmlPullParser xmlPullParser) {
        return d0(xmlPullParser, "sourceURL", "range");
    }

    /* access modifiers changed from: protected */
    public String V(XmlPullParser xmlPullParser) throws XmlPullParserException, IOException {
        return s0(xmlPullParser, "Label");
    }

    /* access modifiers changed from: protected */
    /* JADX WARNING: Removed duplicated region for block: B:75:0x01bf  */
    /* JADX WARNING: Removed duplicated region for block: B:77:0x01df  */
    /* JADX WARNING: Removed duplicated region for block: B:79:0x01e6 A[LOOP:0: B:23:0x00a4->B:79:0x01e6, LOOP_END] */
    /* JADX WARNING: Removed duplicated region for block: B:81:0x01a2 A[SYNTHETIC] */
    public c Y(XmlPullParser xmlPullParser, Uri uri) throws XmlPullParserException, IOException {
        long j7;
        ArrayList arrayList;
        ArrayList arrayList2;
        Throwable th;
        ArrayList arrayList3;
        long j8;
        long j9;
        boolean z6;
        long j10;
        d dVar = this;
        boolean v6 = dVar.v(dVar.b0(xmlPullParser, "profiles", new String[0]));
        long j11 = -9223372036854775807L;
        long H = H(xmlPullParser, "availabilityStartTime", -9223372036854775807L);
        long M = M(xmlPullParser, "mediaPresentationDuration", -9223372036854775807L);
        long M2 = M(xmlPullParser, "minBufferTime", -9223372036854775807L);
        Throwable th2 = null;
        boolean equals = "dynamic".equals(xmlPullParser.getAttributeValue(null, IjkMediaMeta.IJKM_KEY_TYPE));
        long M3 = equals ? M(xmlPullParser, "minimumUpdatePeriod", -9223372036854775807L) : -9223372036854775807L;
        long M4 = equals ? M(xmlPullParser, "timeShiftBufferDepth", -9223372036854775807L) : -9223372036854775807L;
        long M5 = equals ? M(xmlPullParser, "suggestedPresentationDelay", -9223372036854775807L) : -9223372036854775807L;
        long H2 = H(xmlPullParser, "publishTime", -9223372036854775807L);
        long j12 = equals ? 0 : -9223372036854775807L;
        ArrayList k7 = p1.k(new b(uri.toString(), uri.toString(), v6 ? 1 : Integer.MIN_VALUE, 1));
        ArrayList arrayList4 = new ArrayList();
        ArrayList arrayList5 = new ArrayList();
        long j13 = equals ? -9223372036854775807L : 0;
        h hVar = null;
        o oVar = null;
        Uri uri2 = null;
        l lVar = null;
        boolean z7 = false;
        boolean z8 = false;
        while (true) {
            xmlPullParser.next();
            if (k0.f(xmlPullParser, "BaseURL")) {
                if (!z7) {
                    j12 = dVar.B(xmlPullParser, j12);
                    z7 = true;
                }
                arrayList5.addAll(dVar.C(xmlPullParser, k7, v6));
            } else if (k0.f(xmlPullParser, "ProgramInformation")) {
                hVar = c0(xmlPullParser);
            } else if (k0.f(xmlPullParser, "UTCTiming")) {
                oVar = v0(xmlPullParser);
            } else if (k0.f(xmlPullParser, "Location")) {
                uri2 = h0.e(uri.toString(), xmlPullParser.nextText());
            } else if (k0.f(xmlPullParser, "ServiceDescription")) {
                lVar = q0(xmlPullParser);
            } else {
                if (!k0.f(xmlPullParser, "Period") || z8) {
                    j9 = j12;
                    arrayList2 = arrayList5;
                    arrayList = k7;
                    j7 = j11;
                    th = th2;
                    arrayList3 = arrayList4;
                    w(xmlPullParser);
                } else {
                    j9 = j12;
                    arrayList2 = arrayList5;
                    arrayList = k7;
                    j7 = j11;
                    th = th2;
                    Pair<g, Long> a02 = a0(xmlPullParser, !arrayList5.isEmpty() ? arrayList5 : k7, j13, j9, H, M4, v6);
                    g gVar = (g) a02.first;
                    if (gVar.f11605b != j7) {
                        long longValue = ((Long) a02.second).longValue();
                        if (longValue == j7) {
                            arrayList3 = arrayList4;
                            j10 = j7;
                        } else {
                            j10 = gVar.f11605b + longValue;
                            arrayList3 = arrayList4;
                        }
                        arrayList3.add(gVar);
                        j13 = j10;
                        z6 = z8;
                    } else if (equals) {
                        arrayList3 = arrayList4;
                        z6 = true;
                    } else {
                        throw ParserException.createForMalformedManifest("Unable to determine start of period " + arrayList4.size(), th);
                    }
                    z8 = z6;
                }
                j12 = j9;
                if (!k0.d(xmlPullParser, "MPD")) {
                    if (M == j7) {
                        if (j13 != j7) {
                            j8 = j13;
                            if (arrayList3.isEmpty()) {
                                return g(H, j8, M2, equals, M3, M4, M5, H2, hVar, oVar, lVar, uri2, arrayList3);
                            }
                            throw ParserException.createForMalformedManifest("No periods found.", th);
                        } else if (!equals) {
                            throw ParserException.createForMalformedManifest("Unable to determine duration of static manifest.", th);
                        }
                    }
                    j8 = M;
                    if (arrayList3.isEmpty()) {
                    }
                } else {
                    arrayList4 = arrayList3;
                    th2 = th;
                    arrayList5 = arrayList2;
                    k7 = arrayList;
                    j11 = j7;
                    dVar = this;
                }
            }
            arrayList2 = arrayList5;
            arrayList = k7;
            j7 = j11;
            th = th2;
            arrayList3 = arrayList4;
            if (!k0.d(xmlPullParser, "MPD")) {
            }
        }
    }

    /* access modifiers changed from: protected */
    public Pair<g, Long> a0(XmlPullParser xmlPullParser, List<b> list, long j7, long j8, long j9, long j10, boolean z6) throws XmlPullParserException, IOException {
        long j11;
        ArrayList arrayList;
        Object obj;
        ArrayList arrayList2;
        ArrayList arrayList3;
        long j12;
        k l02;
        d dVar = this;
        XmlPullParser xmlPullParser2 = xmlPullParser;
        Object obj2 = null;
        String attributeValue = xmlPullParser2.getAttributeValue(null, "id");
        long M = M(xmlPullParser2, "start", j7);
        long j13 = -9223372036854775807L;
        long j14 = j9 != -9223372036854775807L ? j9 + M : -9223372036854775807L;
        long M2 = M(xmlPullParser2, "duration", -9223372036854775807L);
        ArrayList arrayList4 = new ArrayList();
        ArrayList arrayList5 = new ArrayList();
        ArrayList arrayList6 = new ArrayList();
        long j15 = j8;
        long j16 = -9223372036854775807L;
        k.e eVar = null;
        e eVar2 = null;
        boolean z7 = false;
        while (true) {
            xmlPullParser.next();
            if (k0.f(xmlPullParser2, "BaseURL")) {
                if (!z7) {
                    j15 = dVar.B(xmlPullParser2, j15);
                    z7 = true;
                }
                arrayList6.addAll(dVar.C(xmlPullParser2, list, z6));
                arrayList = arrayList5;
                arrayList2 = arrayList6;
                j11 = j13;
                obj = obj2;
                arrayList3 = arrayList4;
            } else {
                if (k0.f(xmlPullParser2, "AdaptationSet")) {
                    j12 = j15;
                    arrayList2 = arrayList6;
                    arrayList3 = arrayList4;
                    arrayList3.add(y(xmlPullParser, !arrayList6.isEmpty() ? arrayList6 : list, eVar, M2, j15, j16, j14, j10, z6));
                    xmlPullParser2 = xmlPullParser;
                    arrayList = arrayList5;
                } else {
                    j12 = j15;
                    arrayList2 = arrayList6;
                    arrayList3 = arrayList4;
                    xmlPullParser2 = xmlPullParser;
                    if (k0.f(xmlPullParser2, "EventStream")) {
                        arrayList5.add(Q(xmlPullParser));
                        arrayList = arrayList5;
                    } else if (k0.f(xmlPullParser2, "SegmentBase")) {
                        arrayList = arrayList5;
                        eVar = j0(xmlPullParser2, null);
                        obj = null;
                        j15 = j12;
                        j11 = -9223372036854775807L;
                    } else {
                        arrayList = arrayList5;
                        if (k0.f(xmlPullParser2, "SegmentList")) {
                            long B = B(xmlPullParser2, -9223372036854775807L);
                            obj = null;
                            l02 = k0(xmlPullParser, null, j14, M2, j12, B, j10);
                            j16 = B;
                            j15 = j12;
                            j11 = -9223372036854775807L;
                        } else {
                            obj = null;
                            if (k0.f(xmlPullParser2, "SegmentTemplate")) {
                                long B2 = B(xmlPullParser2, -9223372036854775807L);
                                j11 = -9223372036854775807L;
                                l02 = l0(xmlPullParser, null, ImmutableList.of(), j14, M2, j12, B2, j10);
                                j16 = B2;
                                j15 = j12;
                            } else {
                                j11 = -9223372036854775807L;
                                if (k0.f(xmlPullParser2, "AssetIdentifier")) {
                                    eVar2 = I(xmlPullParser2, "AssetIdentifier");
                                } else {
                                    w(xmlPullParser);
                                }
                                j15 = j12;
                            }
                        }
                        eVar = l02;
                    }
                }
                obj = null;
                j11 = -9223372036854775807L;
                j15 = j12;
            }
            if (k0.d(xmlPullParser2, "Period")) {
                return Pair.create(h(attributeValue, M, arrayList3, arrayList, eVar2), Long.valueOf(M2));
            }
            arrayList4 = arrayList3;
            arrayList6 = arrayList2;
            obj2 = obj;
            arrayList5 = arrayList;
            j13 = j11;
            dVar = this;
        }
    }

    /* access modifiers changed from: protected */
    public String[] b0(XmlPullParser xmlPullParser, String str, String[] strArr) {
        String attributeValue = xmlPullParser.getAttributeValue(null, str);
        if (attributeValue == null) {
            return strArr;
        }
        return attributeValue.split(",");
    }

    /* access modifiers changed from: protected */
    public a c(int i7, int i8, List<j> list, List<e> list2, List<e> list3, List<e> list4) {
        return new a(i7, i8, list, list2, list3, list4);
    }

    /* access modifiers changed from: protected */
    public h c0(XmlPullParser xmlPullParser) throws IOException, XmlPullParserException {
        String str = null;
        String r02 = r0(xmlPullParser, "moreInformationURL", null);
        String r03 = r0(xmlPullParser, "lang", null);
        String str2 = null;
        String str3 = null;
        while (true) {
            xmlPullParser.next();
            if (k0.f(xmlPullParser, "Title")) {
                str = xmlPullParser.nextText();
            } else if (k0.f(xmlPullParser, "Source")) {
                str2 = xmlPullParser.nextText();
            } else if (k0.f(xmlPullParser, "Copyright")) {
                str3 = xmlPullParser.nextText();
            } else {
                w(xmlPullParser);
            }
            if (k0.d(xmlPullParser, "ProgramInformation")) {
                return new h(str, str2, str3, r02, r03);
            }
            str3 = str3;
        }
    }

    /* access modifiers changed from: protected */
    public i2.a d(String str, String str2, long j7, long j8, byte[] bArr) {
        return new i2.a(str, str2, j8, j7, bArr);
    }

    /* access modifiers changed from: protected */
    public i d0(XmlPullParser xmlPullParser, String str, String str2) {
        long j7;
        long j8;
        String attributeValue = xmlPullParser.getAttributeValue(null, str);
        String attributeValue2 = xmlPullParser.getAttributeValue(null, str2);
        if (attributeValue2 != null) {
            String[] split = attributeValue2.split("-");
            j8 = Long.parseLong(split[0]);
            if (split.length == 2) {
                j7 = (Long.parseLong(split[1]) - j8) + 1;
                return i(attributeValue, j8, j7);
            }
        } else {
            j8 = 0;
        }
        j7 = -1;
        return i(attributeValue, j8, j7);
    }

    /* access modifiers changed from: protected */
    public f e(String str, String str2, long j7, long[] jArr, i2.a[] aVarArr) {
        return new f(str, str2, j7, jArr, aVarArr);
    }

    /* access modifiers changed from: protected */
    /* JADX WARNING: Removed duplicated region for block: B:53:0x01ee A[LOOP:0: B:1:0x006a->B:53:0x01ee, LOOP_END] */
    /* JADX WARNING: Removed duplicated region for block: B:54:0x0198 A[EDGE_INSN: B:54:0x0198->B:45:0x0198 ?: BREAK  , SYNTHETIC] */
    public a e0(XmlPullParser xmlPullParser, List<b> list, String str, String str2, int i7, int i8, float f7, int i9, int i10, String str3, List<e> list2, List<e> list3, List<e> list4, List<e> list5, k kVar, long j7, long j8, long j9, long j10, long j11, boolean z6) throws XmlPullParserException, IOException {
        ArrayList arrayList;
        k kVar2;
        ArrayList arrayList2;
        ArrayList arrayList3;
        ArrayList arrayList4;
        int i11;
        long j12;
        ArrayList arrayList5;
        ArrayList arrayList6;
        ArrayList arrayList7;
        long B;
        k.e eVar;
        d dVar = this;
        String attributeValue = xmlPullParser.getAttributeValue(null, "id");
        int U = U(xmlPullParser, "bandwidth", -1);
        String r02 = r0(xmlPullParser, "mimeType", str);
        String r03 = r0(xmlPullParser, "codecs", str2);
        int U2 = U(xmlPullParser, "width", i7);
        int U3 = U(xmlPullParser, "height", i8);
        float S = S(xmlPullParser, f7);
        int U4 = U(xmlPullParser, "audioSamplingRate", i10);
        ArrayList arrayList8 = new ArrayList();
        ArrayList arrayList9 = new ArrayList();
        ArrayList arrayList10 = new ArrayList(list4);
        ArrayList arrayList11 = new ArrayList(list5);
        ArrayList arrayList12 = new ArrayList();
        int i12 = i9;
        long j13 = j9;
        long j14 = j10;
        String str4 = null;
        boolean z7 = false;
        k kVar3 = kVar;
        while (true) {
            xmlPullParser.next();
            if (k0.f(xmlPullParser, "BaseURL")) {
                if (!z7) {
                    j13 = dVar.B(xmlPullParser, j13);
                    z7 = true;
                }
                arrayList12.addAll(dVar.C(xmlPullParser, list, z6));
                eVar = kVar3;
            } else if (k0.f(xmlPullParser, "AudioChannelConfiguration")) {
                kVar2 = kVar3;
                arrayList = arrayList12;
                arrayList2 = arrayList8;
                i11 = A(xmlPullParser);
                arrayList3 = arrayList9;
                arrayList4 = arrayList11;
                if (k0.d(xmlPullParser, "Representation")) {
                    break;
                }
                arrayList11 = arrayList4;
                arrayList9 = arrayList3;
                arrayList8 = arrayList2;
                kVar3 = kVar2;
                dVar = this;
                i12 = i11;
                arrayList12 = arrayList;
            } else if (k0.f(xmlPullParser, "SegmentBase")) {
                eVar = dVar.j0(xmlPullParser, (k.e) kVar3);
            } else {
                if (k0.f(xmlPullParser, "SegmentList")) {
                    B = dVar.B(xmlPullParser, j14);
                    j12 = j13;
                    arrayList = arrayList12;
                    arrayList5 = arrayList11;
                    arrayList6 = arrayList9;
                    arrayList7 = arrayList10;
                    kVar3 = k0(xmlPullParser, (k.b) kVar3, j7, j8, j12, B, j11);
                    arrayList2 = arrayList8;
                } else {
                    j12 = j13;
                    arrayList = arrayList12;
                    arrayList5 = arrayList11;
                    arrayList6 = arrayList9;
                    arrayList7 = arrayList10;
                    if (k0.f(xmlPullParser, "SegmentTemplate")) {
                        B = dVar.B(xmlPullParser, j14);
                        arrayList2 = arrayList8;
                        kVar3 = l0(xmlPullParser, (k.c) kVar3, list5, j7, j8, j12, B, j11);
                    } else {
                        arrayList2 = arrayList8;
                        if (k0.f(xmlPullParser, "ContentProtection")) {
                            Pair<String, h.b> F = F(xmlPullParser);
                            Object obj = F.first;
                            if (obj != null) {
                                str4 = (String) obj;
                            }
                            Object obj2 = F.second;
                            if (obj2 != null) {
                                arrayList2.add((h.b) obj2);
                            }
                            i11 = i12;
                            j13 = j12;
                            arrayList4 = arrayList5;
                            arrayList3 = arrayList6;
                            arrayList10 = arrayList7;
                            kVar2 = kVar3;
                            if (k0.d(xmlPullParser, "Representation")) {
                            }
                        } else {
                            if (k0.f(xmlPullParser, "InbandEventStream")) {
                                arrayList3 = arrayList6;
                                arrayList3.add(I(xmlPullParser, "InbandEventStream"));
                                arrayList4 = arrayList5;
                                arrayList10 = arrayList7;
                            } else {
                                arrayList3 = arrayList6;
                                if (k0.f(xmlPullParser, "EssentialProperty")) {
                                    arrayList10 = arrayList7;
                                    arrayList10.add(I(xmlPullParser, "EssentialProperty"));
                                    arrayList4 = arrayList5;
                                } else {
                                    arrayList10 = arrayList7;
                                    if (k0.f(xmlPullParser, "SupplementalProperty")) {
                                        arrayList4 = arrayList5;
                                        arrayList4.add(I(xmlPullParser, "SupplementalProperty"));
                                    } else {
                                        arrayList4 = arrayList5;
                                        w(xmlPullParser);
                                    }
                                }
                            }
                            i11 = i12;
                            j13 = j12;
                            kVar2 = kVar3;
                            if (k0.d(xmlPullParser, "Representation")) {
                            }
                        }
                    }
                }
                i11 = i12;
                j14 = B;
                j13 = j12;
                arrayList4 = arrayList5;
                arrayList3 = arrayList6;
                arrayList10 = arrayList7;
                kVar2 = kVar3;
                if (k0.d(xmlPullParser, "Representation")) {
                }
            }
            arrayList = arrayList12;
            arrayList2 = arrayList8;
            i11 = i12;
            kVar2 = eVar;
            arrayList3 = arrayList9;
            arrayList4 = arrayList11;
            if (k0.d(xmlPullParser, "Representation")) {
            }
        }
        u0 f8 = f(attributeValue, r02, U2, U3, S, i11, U4, U, str3, list2, list3, r03, arrayList10, arrayList4);
        k.e eVar2 = kVar2;
        if (kVar2 == null) {
            eVar2 = new k.e();
        }
        boolean isEmpty = arrayList.isEmpty();
        ArrayList arrayList13 = arrayList;
        if (isEmpty) {
            arrayList13 = list;
        }
        return new a(f8, arrayList13, eVar2, str4, arrayList2, arrayList3, arrayList10, arrayList4, -1);
    }

    /* access modifiers changed from: protected */
    public u0 f(String str, String str2, int i7, int i8, float f7, int i9, int i10, int i11, String str3, List<e> list, List<e> list2, String str4, List<e> list3, List<e> list4) {
        String str5 = str4;
        String u6 = u(str2, str5);
        if ("audio/eac3".equals(u6)) {
            u6 = N(list4);
            if ("audio/eac3-joc".equals(u6)) {
                str5 = "ec+3";
            }
        }
        int p02 = p0(list);
        u0.b V = new u0.b().S(str).K(str2).e0(u6).I(str5).Z(i11).g0(p02).c0(i0(list) | f0(list2) | h0(list3) | h0(list4)).V(str3);
        if (t.s(u6)) {
            V.j0(i7).Q(i8).P(f7);
        } else if (t.o(u6)) {
            V.H(i9).f0(i10);
        } else if (t.r(u6)) {
            int i12 = -1;
            if ("application/cea-608".equals(u6)) {
                i12 = D(list2);
            } else if ("application/cea-708".equals(u6)) {
                i12 = E(list2);
            }
            V.F(i12);
        } else if (t.p(u6)) {
            V.j0(i7).Q(i8);
        }
        return V.E();
    }

    /* access modifiers changed from: protected */
    public int f0(List<e> list) {
        int t02;
        int i7 = 0;
        for (int i8 = 0; i8 < list.size(); i8++) {
            e eVar = list.get(i8);
            if (n3.a.a("urn:mpeg:dash:role:2011", eVar.f11596a)) {
                t02 = g0(eVar.f11597b);
            } else if (n3.a.a("urn:tva:metadata:cs:AudioPurposeCS:2007", eVar.f11596a)) {
                t02 = t0(eVar.f11597b);
            }
            i7 |= t02;
        }
        return i7;
    }

    /* access modifiers changed from: protected */
    public c g(long j7, long j8, long j9, boolean z6, long j10, long j11, long j12, long j13, h hVar, o oVar, l lVar, Uri uri, List<g> list) {
        return new c(j7, j8, j9, z6, j10, j11, j12, j13, hVar, oVar, lVar, uri, list);
    }

    /* access modifiers changed from: protected */
    public int g0(String str) {
        if (str == null) {
            return 0;
        }
        char c7 = 65535;
        switch (str.hashCode()) {
            case -2060497896:
                if (str.equals("subtitle")) {
                    c7 = 0;
                    break;
                }
                break;
            case -1724546052:
                if (str.equals("description")) {
                    c7 = 1;
                    break;
                }
                break;
            case -1580883024:
                if (str.equals("enhanced-audio-intelligibility")) {
                    c7 = 2;
                    break;
                }
                break;
            case -1574842690:
                if (str.equals("forced_subtitle")) {
                    c7 = 3;
                    break;
                }
                break;
            case -1408024454:
                if (str.equals("alternate")) {
                    c7 = 4;
                    break;
                }
                break;
            case -1396432756:
                if (str.equals("forced-subtitle")) {
                    c7 = 5;
                    break;
                }
                break;
            case 99825:
                if (str.equals("dub")) {
                    c7 = 6;
                    break;
                }
                break;
            case 3343801:
                if (str.equals("main")) {
                    c7 = 7;
                    break;
                }
                break;
            case 3530173:
                if (str.equals("sign")) {
                    c7 = '\b';
                    break;
                }
                break;
            case 552573414:
                if (str.equals("caption")) {
                    c7 = '\t';
                    break;
                }
                break;
            case 899152809:
                if (str.equals("commentary")) {
                    c7 = '\n';
                    break;
                }
                break;
            case 1629013393:
                if (str.equals("emergency")) {
                    c7 = 11;
                    break;
                }
                break;
            case 1855372047:
                if (str.equals("supplementary")) {
                    c7 = '\f';
                    break;
                }
                break;
        }
        switch (c7) {
            case 0:
            case 3:
            case 5:
                return 128;
            case 1:
                return IjkMediaMeta.FF_PROFILE_H264_CONSTRAINED;
            case 2:
                return IjkMediaMeta.FF_PROFILE_H264_INTRA;
            case 4:
                return 2;
            case 6:
                return 16;
            case 7:
                return 1;
            case '\b':
                return 256;
            case '\t':
                return 64;
            case '\n':
                return 8;
            case 11:
                return 32;
            case '\f':
                return 4;
            default:
                return 0;
        }
    }

    /* access modifiers changed from: protected */
    public g h(String str, long j7, List<a> list, List<f> list2, e eVar) {
        return new g(str, j7, list, list2, eVar);
    }

    /* access modifiers changed from: protected */
    public int h0(List<e> list) {
        int i7 = 0;
        for (int i8 = 0; i8 < list.size(); i8++) {
            if (n3.a.a("http://dashif.org/guidelines/trickmode", list.get(i8).f11596a)) {
                i7 |= 16384;
            }
        }
        return i7;
    }

    /* access modifiers changed from: protected */
    public i i(String str, long j7, long j8) {
        return new i(str, j7, j8);
    }

    /* access modifiers changed from: protected */
    public int i0(List<e> list) {
        int i7 = 0;
        for (int i8 = 0; i8 < list.size(); i8++) {
            e eVar = list.get(i8);
            if (n3.a.a("urn:mpeg:dash:role:2011", eVar.f11596a)) {
                i7 |= g0(eVar.f11597b);
            }
        }
        return i7;
    }

    /* access modifiers changed from: protected */
    public j j(a aVar, String str, String str2, ArrayList<h.b> arrayList, ArrayList<e> arrayList2) {
        u0.b b7 = aVar.f11587a.b();
        if (str != null) {
            b7.U(str);
        }
        String str3 = aVar.f11590d;
        if (str3 != null) {
            str2 = str3;
        }
        ArrayList<h.b> arrayList3 = aVar.f11591e;
        arrayList3.addAll(arrayList);
        if (!arrayList3.isEmpty()) {
            r(arrayList3);
            s(arrayList3);
            b7.M(new h(str2, arrayList3));
        }
        ArrayList<e> arrayList4 = aVar.f11592f;
        arrayList4.addAll(arrayList2);
        return j.o(aVar.f11593g, b7.E(), aVar.f11588b, aVar.f11589c, arrayList4, aVar.f11594h, aVar.f11595i, null);
    }

    /* access modifiers changed from: protected */
    public k.e j0(XmlPullParser xmlPullParser, k.e eVar) throws XmlPullParserException, IOException {
        long j7;
        long j8;
        long X = X(xmlPullParser, "timescale", eVar != null ? eVar.f11633b : 1);
        long j9 = 0;
        long X2 = X(xmlPullParser, "presentationTimeOffset", eVar != null ? eVar.f11634c : 0);
        long j10 = eVar != null ? eVar.f11647d : 0;
        if (eVar != null) {
            j9 = eVar.f11648e;
        }
        i iVar = null;
        String attributeValue = xmlPullParser.getAttributeValue(null, "indexRange");
        if (attributeValue != null) {
            String[] split = attributeValue.split("-");
            long parseLong = Long.parseLong(split[0]);
            j7 = (Long.parseLong(split[1]) - parseLong) + 1;
            j8 = parseLong;
        } else {
            j7 = j9;
            j8 = j10;
        }
        if (eVar != null) {
            iVar = eVar.f11632a;
        }
        do {
            xmlPullParser.next();
            if (k0.f(xmlPullParser, "Initialization")) {
                iVar = T(xmlPullParser);
            } else {
                w(xmlPullParser);
            }
        } while (!k0.d(xmlPullParser, "SegmentBase"));
        return n(iVar, X, X2, j8, j7);
    }

    /* access modifiers changed from: protected */
    public k.b k(i iVar, long j7, long j8, long j9, long j10, List<k.d> list, long j11, List<i> list2, long j12, long j13) {
        return new k.b(iVar, j7, j8, j9, j10, list, j11, list2, j0.A0(j12), j0.A0(j13));
    }

    /* access modifiers changed from: protected */
    public k.b k0(XmlPullParser xmlPullParser, k.b bVar, long j7, long j8, long j9, long j10, long j11) throws XmlPullParserException, IOException {
        long j12 = 1;
        long X = X(xmlPullParser, "timescale", bVar != null ? bVar.f11633b : 1);
        long X2 = X(xmlPullParser, "presentationTimeOffset", bVar != null ? bVar.f11634c : 0);
        long X3 = X(xmlPullParser, "duration", bVar != null ? bVar.f11636e : -9223372036854775807L);
        if (bVar != null) {
            j12 = bVar.f11635d;
        }
        long X4 = X(xmlPullParser, "startNumber", j12);
        long t6 = t(j9, j10);
        List<k.d> list = null;
        List<i> list2 = null;
        i iVar = null;
        do {
            xmlPullParser.next();
            if (k0.f(xmlPullParser, "Initialization")) {
                iVar = T(xmlPullParser);
            } else if (k0.f(xmlPullParser, "SegmentTimeline")) {
                list = m0(xmlPullParser, X, j8);
            } else if (k0.f(xmlPullParser, "SegmentURL")) {
                if (list2 == null) {
                    list2 = new ArrayList<>();
                }
                list2.add(n0(xmlPullParser));
            } else {
                w(xmlPullParser);
            }
        } while (!k0.d(xmlPullParser, "SegmentList"));
        if (bVar != null) {
            if (iVar == null) {
                iVar = bVar.f11632a;
            }
            if (list == null) {
                list = bVar.f11637f;
            }
            if (list2 == null) {
                list2 = bVar.f11641j;
            }
        }
        return k(iVar, X, X2, X4, X3, list, t6, list2, j11, j7);
    }

    /* access modifiers changed from: protected */
    public k.c l(i iVar, long j7, long j8, long j9, long j10, long j11, List<k.d> list, long j12, n nVar, n nVar2, long j13, long j14) {
        return new k.c(iVar, j7, j8, j9, j10, j11, list, j12, nVar, nVar2, j0.A0(j13), j0.A0(j14));
    }

    /* access modifiers changed from: protected */
    public k.c l0(XmlPullParser xmlPullParser, k.c cVar, List<e> list, long j7, long j8, long j9, long j10, long j11) throws XmlPullParserException, IOException {
        long j12 = 1;
        long X = X(xmlPullParser, "timescale", cVar != null ? cVar.f11633b : 1);
        long X2 = X(xmlPullParser, "presentationTimeOffset", cVar != null ? cVar.f11634c : 0);
        long X3 = X(xmlPullParser, "duration", cVar != null ? cVar.f11636e : -9223372036854775807L);
        if (cVar != null) {
            j12 = cVar.f11635d;
        }
        long X4 = X(xmlPullParser, "startNumber", j12);
        long W = W(list);
        long t6 = t(j9, j10);
        List<k.d> list2 = null;
        n u02 = u0(xmlPullParser, "media", cVar != null ? cVar.f11643k : null);
        n u03 = u0(xmlPullParser, "initialization", cVar != null ? cVar.f11642j : null);
        i iVar = null;
        while (true) {
            xmlPullParser.next();
            if (k0.f(xmlPullParser, "Initialization")) {
                iVar = T(xmlPullParser);
            } else if (k0.f(xmlPullParser, "SegmentTimeline")) {
                list2 = m0(xmlPullParser, X, j8);
            } else {
                w(xmlPullParser);
            }
            if (k0.d(xmlPullParser, "SegmentTemplate")) {
                break;
            }
        }
        if (cVar != null) {
            if (iVar == null) {
                iVar = cVar.f11632a;
            }
            if (list2 == null) {
                list2 = cVar.f11637f;
            }
        }
        return l(iVar, X, X2, X4, W, X3, list2, t6, u03, u02, j11, j7);
    }

    /* access modifiers changed from: protected */
    public k.d m(long j7, long j8) {
        return new k.d(j7, j8);
    }

    /* access modifiers changed from: protected */
    public List<k.d> m0(XmlPullParser xmlPullParser, long j7, long j8) throws XmlPullParserException, IOException {
        ArrayList arrayList = new ArrayList();
        long j9 = 0;
        long j10 = -9223372036854775807L;
        boolean z6 = false;
        int i7 = 0;
        do {
            xmlPullParser.next();
            if (k0.f(xmlPullParser, "S")) {
                long X = X(xmlPullParser, "t", -9223372036854775807L);
                if (z6) {
                    j9 = b(arrayList, j9, j10, i7, X);
                }
                if (X == -9223372036854775807L) {
                    X = j9;
                }
                j10 = X(xmlPullParser, "d", -9223372036854775807L);
                i7 = U(xmlPullParser, "r", 0);
                j9 = X;
                z6 = true;
            } else {
                w(xmlPullParser);
            }
        } while (!k0.d(xmlPullParser, "SegmentTimeline"));
        if (z6) {
            b(arrayList, j9, j10, i7, j0.M0(j8, j7, 1000));
        }
        return arrayList;
    }

    /* access modifiers changed from: protected */
    public k.e n(i iVar, long j7, long j8, long j9, long j10) {
        return new k.e(iVar, j7, j8, j9, j10);
    }

    /* access modifiers changed from: protected */
    public i n0(XmlPullParser xmlPullParser) {
        return d0(xmlPullParser, "media", "mediaRange");
    }

    /* access modifiers changed from: protected */
    public o o(String str, String str2) {
        return new o(str, str2);
    }

    /* access modifiers changed from: protected */
    public int o0(String str) {
        if (str == null) {
            return 0;
        }
        return (str.equals("forced_subtitle") || str.equals("forced-subtitle")) ? 2 : 0;
    }

    /* access modifiers changed from: protected */
    public int p0(List<e> list) {
        int i7 = 0;
        for (int i8 = 0; i8 < list.size(); i8++) {
            e eVar = list.get(i8);
            if (n3.a.a("urn:mpeg:dash:role:2011", eVar.f11596a)) {
                i7 |= o0(eVar.f11597b);
            }
        }
        return i7;
    }

    /* access modifiers changed from: protected */
    public l q0(XmlPullParser xmlPullParser) throws XmlPullParserException, IOException {
        long j7 = -9223372036854775807L;
        long j8 = -9223372036854775807L;
        long j9 = -9223372036854775807L;
        float f7 = -3.4028235E38f;
        float f8 = -3.4028235E38f;
        while (true) {
            xmlPullParser.next();
            if (k0.f(xmlPullParser, "Latency")) {
                j7 = X(xmlPullParser, "target", -9223372036854775807L);
                j8 = X(xmlPullParser, "min", -9223372036854775807L);
                j9 = X(xmlPullParser, "max", -9223372036854775807L);
            } else if (k0.f(xmlPullParser, "PlaybackRate")) {
                f7 = R(xmlPullParser, "min", -3.4028235E38f);
                f8 = R(xmlPullParser, "max", -3.4028235E38f);
            }
            if (k0.d(xmlPullParser, "ServiceDescription")) {
                return new l(j7, j8, j9, f7, f8);
            }
            j7 = j7;
            j8 = j8;
            j9 = j9;
            f7 = f7;
            f8 = f8;
        }
    }

    /* access modifiers changed from: protected */
    public int t0(String str) {
        if (str == null) {
            return 0;
        }
        char c7 = 65535;
        switch (str.hashCode()) {
            case 49:
                if (str.equals("1")) {
                    c7 = 0;
                    break;
                }
                break;
            case 50:
                if (str.equals("2")) {
                    c7 = 1;
                    break;
                }
                break;
            case 51:
                if (str.equals("3")) {
                    c7 = 2;
                    break;
                }
                break;
            case 52:
                if (str.equals("4")) {
                    c7 = 3;
                    break;
                }
                break;
            case 54:
                if (str.equals("6")) {
                    c7 = 4;
                    break;
                }
                break;
        }
        switch (c7) {
            case 0:
                return IjkMediaMeta.FF_PROFILE_H264_CONSTRAINED;
            case 1:
                return IjkMediaMeta.FF_PROFILE_H264_INTRA;
            case 2:
                return 4;
            case 3:
                return 8;
            case 4:
                return 1;
            default:
                return 0;
        }
    }

    /* access modifiers changed from: protected */
    public n u0(XmlPullParser xmlPullParser, String str, n nVar) {
        String attributeValue = xmlPullParser.getAttributeValue(null, str);
        return attributeValue != null ? n.b(attributeValue) : nVar;
    }

    /* access modifiers changed from: protected */
    public o v0(XmlPullParser xmlPullParser) {
        return o(xmlPullParser.getAttributeValue(null, "schemeIdUri"), xmlPullParser.getAttributeValue(null, "value"));
    }

    /* renamed from: x */
    public c a(Uri uri, InputStream inputStream) throws IOException {
        try {
            XmlPullParser newPullParser = this.f11586a.newPullParser();
            newPullParser.setInput(inputStream, null);
            if (newPullParser.next() == 2 && "MPD".equals(newPullParser.getName())) {
                return Y(newPullParser, uri);
            }
            throw ParserException.createForMalformedManifest("inputStream does not contain a valid media presentation description", null);
        } catch (XmlPullParserException e7) {
            throw ParserException.createForMalformedManifest(null, e7);
        }
    }

    /* access modifiers changed from: protected */
    /* JADX WARNING: Removed duplicated region for block: B:69:0x030d A[LOOP:0: B:1:0x007c->B:69:0x030d, LOOP_END] */
    /* JADX WARNING: Removed duplicated region for block: B:70:0x02ce A[EDGE_INSN: B:70:0x02ce->B:63:0x02ce ?: BREAK  , SYNTHETIC] */
    public a y(XmlPullParser xmlPullParser, List<b> list, k kVar, long j7, long j8, long j9, long j10, long j11, boolean z6) throws XmlPullParserException, IOException {
        String str;
        Object obj;
        int i7;
        String str2;
        ArrayList<h.b> arrayList;
        ArrayList arrayList2;
        ArrayList arrayList3;
        ArrayList arrayList4;
        long j12;
        ArrayList arrayList5;
        ArrayList arrayList6;
        ArrayList arrayList7;
        ArrayList<e> arrayList8;
        long j13;
        ArrayList<e> arrayList9;
        long B;
        d dVar = this;
        XmlPullParser xmlPullParser2 = xmlPullParser;
        int U = U(xmlPullParser2, "id", -1);
        int G = G(xmlPullParser);
        String attributeValue = xmlPullParser2.getAttributeValue(null, "mimeType");
        String attributeValue2 = xmlPullParser2.getAttributeValue(null, "codecs");
        int U2 = U(xmlPullParser2, "width", -1);
        int U3 = U(xmlPullParser2, "height", -1);
        float S = S(xmlPullParser2, -1.0f);
        int U4 = U(xmlPullParser2, "audioSamplingRate", -1);
        String str3 = "lang";
        String attributeValue3 = xmlPullParser2.getAttributeValue(null, str3);
        String attributeValue4 = xmlPullParser2.getAttributeValue(null, "label");
        ArrayList<h.b> arrayList10 = new ArrayList<>();
        ArrayList<e> arrayList11 = new ArrayList<>();
        ArrayList arrayList12 = new ArrayList();
        ArrayList arrayList13 = new ArrayList();
        ArrayList arrayList14 = new ArrayList();
        ArrayList arrayList15 = new ArrayList();
        ArrayList arrayList16 = new ArrayList();
        ArrayList arrayList17 = new ArrayList();
        k.e eVar = kVar;
        int i8 = G;
        String str4 = attributeValue3;
        String str5 = attributeValue4;
        String str6 = null;
        int i9 = -1;
        boolean z7 = false;
        long j14 = j8;
        long j15 = j9;
        while (true) {
            xmlPullParser.next();
            if (k0.f(xmlPullParser2, "BaseURL")) {
                if (!z7) {
                    j14 = dVar.B(xmlPullParser2, j14);
                    z7 = true;
                }
                j13 = j15;
                arrayList9 = arrayList11;
                arrayList17.addAll(dVar.C(xmlPullParser2, list, z6));
            } else {
                j13 = j15;
                arrayList9 = arrayList11;
                if (k0.f(xmlPullParser2, "ContentProtection")) {
                    Pair<String, h.b> F = F(xmlPullParser);
                    Object obj2 = F.first;
                    if (obj2 != null) {
                        str6 = (String) obj2;
                    }
                    Object obj3 = F.second;
                    if (obj3 != null) {
                        arrayList10.add((h.b) obj3);
                    }
                } else {
                    if (k0.f(xmlPullParser2, "ContentComponent")) {
                        String q7 = q(str4, xmlPullParser2.getAttributeValue(null, str3));
                        int p7 = p(i8, G(xmlPullParser));
                        str = q7;
                        obj = null;
                        j12 = j14;
                        arrayList6 = arrayList17;
                        arrayList7 = arrayList16;
                        arrayList5 = arrayList15;
                        arrayList4 = arrayList14;
                        arrayList3 = arrayList13;
                        arrayList2 = arrayList12;
                        arrayList = arrayList10;
                        str2 = str3;
                        i7 = p7;
                        arrayList8 = arrayList9;
                    } else {
                        if (k0.f(xmlPullParser2, "Role")) {
                            arrayList13.add(I(xmlPullParser2, "Role"));
                        } else if (k0.f(xmlPullParser2, "AudioChannelConfiguration")) {
                            i9 = A(xmlPullParser);
                        } else if (k0.f(xmlPullParser2, "Accessibility")) {
                            arrayList12.add(I(xmlPullParser2, "Accessibility"));
                        } else if (k0.f(xmlPullParser2, "EssentialProperty")) {
                            arrayList14.add(I(xmlPullParser2, "EssentialProperty"));
                        } else if (k0.f(xmlPullParser2, "SupplementalProperty")) {
                            arrayList15.add(I(xmlPullParser2, "SupplementalProperty"));
                        } else if (k0.f(xmlPullParser2, "Representation")) {
                            j12 = j14;
                            arrayList6 = arrayList17;
                            arrayList5 = arrayList15;
                            arrayList4 = arrayList14;
                            arrayList3 = arrayList13;
                            arrayList2 = arrayList12;
                            arrayList = arrayList10;
                            str2 = str3;
                            obj = null;
                            str = str4;
                            a e02 = e0(xmlPullParser, !arrayList17.isEmpty() ? arrayList17 : list, attributeValue, attributeValue2, U2, U3, S, i9, U4, str4, arrayList3, arrayList2, arrayList4, arrayList5, eVar, j10, j7, j12, j13, j11, z6);
                            int p8 = p(i8, t.k(e02.f11587a.f4878q));
                            arrayList7 = arrayList16;
                            arrayList7.add(e02);
                            xmlPullParser2 = xmlPullParser;
                            i7 = p8;
                            arrayList8 = arrayList9;
                        } else {
                            obj = null;
                            j12 = j14;
                            arrayList6 = arrayList17;
                            arrayList5 = arrayList15;
                            arrayList4 = arrayList14;
                            arrayList3 = arrayList13;
                            arrayList2 = arrayList12;
                            arrayList = arrayList10;
                            str2 = str3;
                            str = str4;
                            arrayList7 = arrayList16;
                            if (k0.f(xmlPullParser, "SegmentBase")) {
                                eVar = j0(xmlPullParser, (k.e) eVar);
                                i7 = i8;
                                arrayList8 = arrayList9;
                                j15 = j13;
                                xmlPullParser2 = xmlPullParser;
                            } else {
                                if (k0.f(xmlPullParser, "SegmentList")) {
                                    B = B(xmlPullParser, j13);
                                    i7 = i8;
                                    eVar = k0(xmlPullParser, (k.b) eVar, j10, j7, j12, B, j11);
                                    xmlPullParser2 = xmlPullParser;
                                } else {
                                    j15 = j13;
                                    i7 = i8;
                                    if (k0.f(xmlPullParser, "SegmentTemplate")) {
                                        B = B(xmlPullParser, j15);
                                        xmlPullParser2 = xmlPullParser;
                                        eVar = l0(xmlPullParser, (k.c) eVar, arrayList5, j10, j7, j12, B, j11);
                                    } else {
                                        xmlPullParser2 = xmlPullParser;
                                        if (k0.f(xmlPullParser2, "InbandEventStream")) {
                                            arrayList8 = arrayList9;
                                            arrayList8.add(I(xmlPullParser2, "InbandEventStream"));
                                        } else {
                                            arrayList8 = arrayList9;
                                            if (k0.f(xmlPullParser2, "Label")) {
                                                str5 = V(xmlPullParser);
                                            } else if (k0.e(xmlPullParser)) {
                                                z(xmlPullParser);
                                            }
                                        }
                                    }
                                }
                                j15 = B;
                                arrayList8 = arrayList9;
                            }
                            if (!k0.d(xmlPullParser2, "AdaptationSet")) {
                                break;
                            }
                            arrayList11 = arrayList8;
                            arrayList16 = arrayList7;
                            arrayList17 = arrayList6;
                            arrayList15 = arrayList5;
                            j14 = j12;
                            arrayList14 = arrayList4;
                            arrayList13 = arrayList3;
                            arrayList12 = arrayList2;
                            arrayList10 = arrayList;
                            str3 = str2;
                            i8 = i7;
                            str4 = str;
                            dVar = this;
                        }
                        obj = null;
                        j12 = j14;
                        arrayList6 = arrayList17;
                        arrayList5 = arrayList15;
                        arrayList4 = arrayList14;
                        arrayList3 = arrayList13;
                        arrayList2 = arrayList12;
                        arrayList = arrayList10;
                        str2 = str3;
                        i7 = i8;
                        str = str4;
                        arrayList8 = arrayList9;
                        j15 = j13;
                        arrayList7 = arrayList16;
                        if (!k0.d(xmlPullParser2, "AdaptationSet")) {
                        }
                    }
                    j15 = j13;
                    if (!k0.d(xmlPullParser2, "AdaptationSet")) {
                    }
                }
            }
            j15 = j13;
            j12 = j14;
            arrayList7 = arrayList16;
            arrayList4 = arrayList14;
            arrayList3 = arrayList13;
            arrayList2 = arrayList12;
            arrayList = arrayList10;
            str2 = str3;
            arrayList8 = arrayList9;
            i7 = i8;
            str = str4;
            obj = null;
            arrayList6 = arrayList17;
            arrayList5 = arrayList15;
            if (!k0.d(xmlPullParser2, "AdaptationSet")) {
            }
        }
        ArrayList arrayList18 = new ArrayList(arrayList7.size());
        for (int i10 = 0; i10 < arrayList7.size(); i10++) {
            arrayList18.add(j((a) arrayList7.get(i10), str5, str6, arrayList, arrayList8));
        }
        return c(U, i7, arrayList18, arrayList2, arrayList4, arrayList5);
    }

    /* access modifiers changed from: protected */
    public void z(XmlPullParser xmlPullParser) throws XmlPullParserException, IOException {
        w(xmlPullParser);
    }
}