せい v4.7.3版本的 MD5 值为:203275d28cdb30ff42801fbf3f03f780

以下内容为反编译后的 c.java 源代码,内容仅作参考


package n1;

import android.net.Uri;
import android.text.TextUtils;
import android.util.Base64;
import android.util.Log;
import android.util.Pair;
import android.util.Xml;
import androidx.annotation.Nullable;
import androidx.exifinterface.media.ExifInterface;
import com.bumptech.glide.load.Key;
import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.drm.DrmInitData;
import com.google.android.exoplayer2.metadata.emsg.EventMessage;
import com.just.agentweb.AgentWebPermissions;
import com.meizu.cloud.pushsdk.constants.PushConstants;
import d2.z;
import f2.d0;
import f2.m;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import l0.b0;
import n1.i;
import n1.j;
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;

public final class c extends DefaultHandler implements z.a<b> {

    public static final Pattern f13093b = Pattern.compile("(\\d+)(?:/(\\d+))?");

    public static final Pattern f13094c = Pattern.compile("CC([1-4])=.*");

    public static final Pattern f13095d = Pattern.compile("([1-9]|[1-5][0-9]|6[0-3])=.*");

    public final XmlPullParserFactory f13096a;

    public static final class a {

        public final Format f13097a;

        public final String f13098b;

        public final j f13099c;

        @Nullable
        public final String f13100d;

        public final ArrayList<DrmInitData.SchemeData> f13101e;

        public final ArrayList<d> f13102f;

        public final long f13103g = -1;

        public a(Format format, String str, j jVar, @Nullable String str2, ArrayList arrayList, ArrayList arrayList2) {
            this.f13097a = format;
            this.f13098b = str;
            this.f13099c = jVar;
            this.f13100d = str2;
            this.f13101e = arrayList;
            this.f13102f = arrayList2;
        }
    }

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

    public static long b(ArrayList arrayList, long j10, long j11, int i, long j12) {
        int i2;
        if (i >= 0) {
            i2 = i + 1;
        } else {
            int i10 = d0.f9489a;
            i2 = (int) ((((j12 - j10) + j11) - 1) / j11);
        }
        for (int i11 = 0; i11 < i2; i11++) {
            arrayList.add(new j.d(j10, j11));
            j10 += j11;
        }
        return j10;
    }

    public static void c(XmlPullParser xmlPullParser) throws IOException, XmlPullParserException {
        boolean z10;
        if (!f2.a.j(xmlPullParser)) {
            return;
        }
        int i = 1;
        while (i != 0) {
            xmlPullParser.next();
            if (f2.a.j(xmlPullParser)) {
                i++;
            } else {
                if (xmlPullParser.getEventType() == 3) {
                    z10 = true;
                } else {
                    z10 = false;
                }
                if (z10) {
                    i--;
                }
            }
        }
    }

    public static boolean d(@Nullable String str) {
        if (!m.i(str) && !"application/ttml+xml".equals(str) && !"application/x-mp4-vtt".equals(str) && !"application/cea-708".equals(str) && !"application/cea-608".equals(str)) {
            return false;
        }
        return true;
    }

    public static int e(XmlPullParser xmlPullParser) throws XmlPullParserException, IOException {
        String E;
        char c10;
        String attributeValue = xmlPullParser.getAttributeValue(null, "schemeIdUri");
        if (attributeValue == null) {
            attributeValue = null;
        }
        int i = -1;
        if ("urn:mpeg:dash:23003:3:audio_channel_configuration:2011".equals(attributeValue)) {
            i = l(xmlPullParser, "value", -1);
        } else if (("tag:dolby.com,2014:dash:audio_channel_configuration:2011".equals(attributeValue) || "urn:dolby:dash:audio_channel_configuration:2011".equals(attributeValue)) && (E = d0.E(xmlPullParser.getAttributeValue(null, "value"))) != null) {
            switch (E.hashCode()) {
                case 1596796:
                    if (E.equals("4000")) {
                        c10 = 0;
                        break;
                    }
                    c10 = 65535;
                    break;
                case 2937391:
                    if (E.equals("a000")) {
                        c10 = 1;
                        break;
                    }
                    c10 = 65535;
                    break;
                case 3094035:
                    if (E.equals("f801")) {
                        c10 = 2;
                        break;
                    }
                    c10 = 65535;
                    break;
                case 3133436:
                    if (E.equals("fa01")) {
                        c10 = 3;
                        break;
                    }
                    c10 = 65535;
                    break;
                default:
                    c10 = 65535;
                    break;
            }
            if (c10 != 0) {
                if (c10 != 1) {
                    if (c10 != 2) {
                        if (c10 == 3) {
                            i = 8;
                        }
                    } else {
                        i = 6;
                    }
                } else {
                    i = 2;
                }
            } else {
                i = 1;
            }
        }
        do {
            xmlPullParser.next();
        } while (!f2.a.i(xmlPullParser, "AudioChannelConfiguration"));
        return i;
    }

    public static Pair f(XmlPullParser xmlPullParser) throws XmlPullParserException, IOException {
        String str;
        UUID uuid;
        byte[] bArr;
        String str2;
        boolean z10;
        UUID b10;
        char c10;
        UUID uuid2;
        String str3;
        DrmInitData.SchemeData schemeData = null;
        String attributeValue = xmlPullParser.getAttributeValue(null, "schemeIdUri");
        if (attributeValue != null) {
            String E = d0.E(attributeValue);
            E.getClass();
            switch (E.hashCode()) {
                case 489446379:
                    if (E.equals("urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95")) {
                        c10 = 0;
                        break;
                    }
                    c10 = 65535;
                    break;
                case 755418770:
                    if (E.equals("urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed")) {
                        c10 = 1;
                        break;
                    }
                    c10 = 65535;
                    break;
                case 1812765994:
                    if (E.equals("urn:mpeg:dash:mp4protection:2011")) {
                        c10 = 2;
                        break;
                    }
                    c10 = 65535;
                    break;
                default:
                    c10 = 65535;
                    break;
            }
            switch (c10) {
                case 0:
                    uuid2 = l0.f.f11972e;
                    uuid = uuid2;
                    str = null;
                    bArr = null;
                    str2 = null;
                    break;
                case 1:
                    uuid2 = l0.f.f11971d;
                    uuid = uuid2;
                    str = null;
                    bArr = null;
                    str2 = null;
                    break;
                case 2:
                    str = xmlPullParser.getAttributeValue(null, "value");
                    int attributeCount = xmlPullParser.getAttributeCount();
                    int i = 0;
                    while (true) {
                        if (i < attributeCount) {
                            String attributeName = xmlPullParser.getAttributeName(i);
                            int indexOf = attributeName.indexOf(58);
                            if (indexOf != -1) {
                                attributeName = attributeName.substring(indexOf + 1);
                            }
                            if (attributeName.equals("default_KID")) {
                                str3 = xmlPullParser.getAttributeValue(i);
                            } else {
                                i++;
                            }
                        } else {
                            str3 = null;
                        }
                    }
                    if (!TextUtils.isEmpty(str3) && !"00000000-0000-0000-0000-000000000000".equals(str3)) {
                        String[] split = str3.split("\\s+");
                        UUID[] uuidArr = new UUID[split.length];
                        for (int i2 = 0; i2 < split.length; i2++) {
                            uuidArr[i2] = UUID.fromString(split[i2]);
                        }
                        uuid = l0.f.f11969b;
                        bArr = com.google.android.exoplayer2.extractor.mp4.g.a(uuid, uuidArr, null);
                        str2 = null;
                        break;
                    }
                    uuid = null;
                    bArr = null;
                    str2 = null;
                    break;
            }
            do {
                xmlPullParser.next();
                if (!f2.a.k(xmlPullParser, "ms:laurl")) {
                    str2 = xmlPullParser.getAttributeValue(null, "licenseUrl");
                } else {
                    if (bArr == null) {
                        if (f2.a.j(xmlPullParser)) {
                            String name = xmlPullParser.getName();
                            int indexOf2 = name.indexOf(58);
                            if (indexOf2 != -1) {
                                name = name.substring(indexOf2 + 1);
                            }
                            if (name.equals("pssh")) {
                                z10 = true;
                                if (z10 && xmlPullParser.next() == 4) {
                                    byte[] decode = Base64.decode(xmlPullParser.getText(), 0);
                                    b10 = com.google.android.exoplayer2.extractor.mp4.g.b(decode);
                                    if (b10 != null) {
                                        Log.w("MpdParser", "Skipping malformed cenc:pssh data");
                                        uuid = b10;
                                        bArr = null;
                                    } else {
                                        bArr = decode;
                                        uuid = b10;
                                    }
                                }
                            }
                        }
                        z10 = false;
                        if (z10) {
                            byte[] decode2 = Base64.decode(xmlPullParser.getText(), 0);
                            b10 = com.google.android.exoplayer2.extractor.mp4.g.b(decode2);
                            if (b10 != null) {
                            }
                        }
                    }
                    if (bArr == null) {
                        UUID uuid3 = l0.f.f11972e;
                        if (uuid3.equals(uuid) && f2.a.k(xmlPullParser, "mspr:pro") && xmlPullParser.next() == 4) {
                            bArr = com.google.android.exoplayer2.extractor.mp4.g.a(uuid3, null, Base64.decode(xmlPullParser.getText(), 0));
                        }
                    }
                    c(xmlPullParser);
                }
            } while (!f2.a.i(xmlPullParser, "ContentProtection"));
            if (uuid != null) {
                schemeData = new DrmInitData.SchemeData(uuid, str2, "video/mp4", bArr);
            }
            return Pair.create(str, schemeData);
        }
        str = null;
        uuid = null;
        bArr = null;
        str2 = null;
        do {
            xmlPullParser.next();
            if (!f2.a.k(xmlPullParser, "ms:laurl")) {
            }
        } while (!f2.a.i(xmlPullParser, "ContentProtection"));
        if (uuid != null) {
        }
        return Pair.create(str, schemeData);
    }

    public static int g(XmlPullParser xmlPullParser) {
        String attributeValue = xmlPullParser.getAttributeValue(null, "contentType");
        if (!TextUtils.isEmpty(attributeValue)) {
            if ("audio".equals(attributeValue)) {
                return 1;
            }
            if ("video".equals(attributeValue)) {
                return 2;
            }
            if ("text".equals(attributeValue)) {
                return 3;
            }
        }
        return -1;
    }

    public static int h(@Nullable String str) {
        if (str == null) {
            return 0;
        }
        char c10 = 65535;
        switch (str.hashCode()) {
            case -2060497896:
                if (str.equals("subtitle")) {
                    c10 = 0;
                    break;
                }
                break;
            case -1724546052:
                if (str.equals("description")) {
                    c10 = 1;
                    break;
                }
                break;
            case -1580883024:
                if (str.equals("enhanced-audio-intelligibility")) {
                    c10 = 2;
                    break;
                }
                break;
            case -1408024454:
                if (str.equals("alternate")) {
                    c10 = 3;
                    break;
                }
                break;
            case 99825:
                if (str.equals("dub")) {
                    c10 = 4;
                    break;
                }
                break;
            case 3343801:
                if (str.equals("main")) {
                    c10 = 5;
                    break;
                }
                break;
            case 3530173:
                if (str.equals("sign")) {
                    c10 = 6;
                    break;
                }
                break;
            case 552573414:
                if (str.equals("caption")) {
                    c10 = 7;
                    break;
                }
                break;
            case 899152809:
                if (str.equals("commentary")) {
                    c10 = '\b';
                    break;
                }
                break;
            case 1629013393:
                if (str.equals("emergency")) {
                    c10 = '\t';
                    break;
                }
                break;
            case 1855372047:
                if (str.equals("supplementary")) {
                    c10 = '\n';
                    break;
                }
                break;
        }
        switch (c10) {
            case 0:
                return 128;
            case 1:
                return 512;
            case 2:
                return 2048;
            case 3:
                return 2;
            case 4:
                return 16;
            case 5:
                return 1;
            case 6:
                return 256;
            case 7:
                return 64;
            case '\b':
                return 8;
            case '\t':
                return 32;
            case '\n':
                return 4;
            default:
                return 0;
        }
    }

    public static d i(XmlPullParser xmlPullParser, String str) throws XmlPullParserException, IOException {
        String str2 = null;
        String attributeValue = xmlPullParser.getAttributeValue(null, "schemeIdUri");
        if (attributeValue == null) {
            attributeValue = "";
        }
        String attributeValue2 = xmlPullParser.getAttributeValue(null, "value");
        if (attributeValue2 == null) {
            attributeValue2 = null;
        }
        String attributeValue3 = xmlPullParser.getAttributeValue(null, "id");
        if (attributeValue3 != null) {
            str2 = attributeValue3;
        }
        do {
            xmlPullParser.next();
        } while (!f2.a.i(xmlPullParser, str));
        return new d(attributeValue, attributeValue2, str2);
    }

    public static long j(XmlPullParser xmlPullParser, String str, long j10) {
        double d4;
        double d10;
        double d11;
        double d12;
        double d13;
        String attributeValue = xmlPullParser.getAttributeValue(null, str);
        if (attributeValue == null) {
            return j10;
        }
        Matcher matcher = d0.f9496h.matcher(attributeValue);
        if (matcher.matches()) {
            boolean isEmpty = true ^ TextUtils.isEmpty(matcher.group(1));
            String group = matcher.group(3);
            double d14 = 0.0d;
            if (group != null) {
                d4 = Double.parseDouble(group) * 3.1556908E7d;
            } else {
                d4 = 0.0d;
            }
            String group2 = matcher.group(5);
            if (group2 != null) {
                d10 = Double.parseDouble(group2) * 2629739.0d;
            } else {
                d10 = 0.0d;
            }
            double d15 = d4 + d10;
            String group3 = matcher.group(7);
            if (group3 != null) {
                d11 = Double.parseDouble(group3) * 86400.0d;
            } else {
                d11 = 0.0d;
            }
            double d16 = d15 + d11;
            String group4 = matcher.group(10);
            if (group4 != null) {
                d12 = Double.parseDouble(group4) * 3600.0d;
            } else {
                d12 = 0.0d;
            }
            double d17 = d16 + d12;
            String group5 = matcher.group(12);
            if (group5 != null) {
                d13 = Double.parseDouble(group5) * 60.0d;
            } else {
                d13 = 0.0d;
            }
            double d18 = d17 + d13;
            String group6 = matcher.group(14);
            if (group6 != null) {
                d14 = Double.parseDouble(group6);
            }
            long j11 = (long) ((d18 + d14) * 1000.0d);
            if (isEmpty) {
                return -j11;
            }
            return j11;
        }
        return (long) (Double.parseDouble(attributeValue) * 3600.0d * 1000.0d);
    }

    public static float k(XmlPullParser xmlPullParser, float f10) {
        String attributeValue = xmlPullParser.getAttributeValue(null, "frameRate");
        if (attributeValue != null) {
            Matcher matcher = f13093b.matcher(attributeValue);
            if (matcher.matches()) {
                int parseInt = Integer.parseInt(matcher.group(1));
                if (!TextUtils.isEmpty(matcher.group(2))) {
                    return parseInt / Integer.parseInt(r2);
                }
                return parseInt;
            }
            return f10;
        }
        return f10;
    }

    public static int l(XmlPullParser xmlPullParser, String str, int i) {
        String attributeValue = xmlPullParser.getAttributeValue(null, str);
        if (attributeValue != null) {
            return Integer.parseInt(attributeValue);
        }
        return i;
    }

    public static long m(XmlPullParser xmlPullParser, String str, long j10) {
        String attributeValue = xmlPullParser.getAttributeValue(null, str);
        if (attributeValue != null) {
            return Long.parseLong(attributeValue);
        }
        return j10;
    }

    public static h o(String str, String str2, XmlPullParser xmlPullParser) {
        long j10;
        long j11;
        String attributeValue = xmlPullParser.getAttributeValue(null, str);
        String attributeValue2 = xmlPullParser.getAttributeValue(null, str2);
        if (attributeValue2 != null) {
            String[] split = attributeValue2.split("-");
            j10 = Long.parseLong(split[0]);
            if (split.length == 2) {
                j11 = (Long.parseLong(split[1]) - j10) + 1;
                return new h(j10, attributeValue, j11);
            }
        } else {
            j10 = 0;
        }
        j11 = -1;
        return new h(j10, attributeValue, j11);
    }

    public static j.e p(XmlPullParser xmlPullParser, @Nullable j.e eVar) throws XmlPullParserException, IOException {
        long j10;
        long j11;
        long j12;
        long j13;
        long j14;
        if (eVar != null) {
            j10 = eVar.f13134b;
        } else {
            j10 = 1;
        }
        long m10 = m(xmlPullParser, "timescale", j10);
        long j15 = 0;
        if (eVar != null) {
            j11 = eVar.f13135c;
        } else {
            j11 = 0;
        }
        long m11 = m(xmlPullParser, "presentationTimeOffset", j11);
        if (eVar != null) {
            j12 = eVar.f13144d;
        } else {
            j12 = 0;
        }
        if (eVar != null) {
            j15 = eVar.f13145e;
        }
        h hVar = null;
        String attributeValue = xmlPullParser.getAttributeValue(null, "indexRange");
        if (attributeValue != null) {
            String[] split = attributeValue.split("-");
            long parseLong = Long.parseLong(split[0]);
            j13 = (Long.parseLong(split[1]) - parseLong) + 1;
            j14 = parseLong;
        } else {
            j13 = j15;
            j14 = j12;
        }
        if (eVar != null) {
            hVar = eVar.f13133a;
        }
        do {
            xmlPullParser.next();
            if (f2.a.k(xmlPullParser, "Initialization")) {
                hVar = o("sourceURL", "range", xmlPullParser);
            } else {
                c(xmlPullParser);
            }
        } while (!f2.a.i(xmlPullParser, "SegmentBase"));
        return new j.e(hVar, m10, m11, j14, j13);
    }

    public static j.b q(XmlPullParser xmlPullParser, @Nullable j.b bVar, long j10) throws XmlPullParserException, IOException {
        long j11;
        long j12;
        long j13;
        List list;
        long j14 = 1;
        if (bVar != null) {
            j11 = bVar.f13134b;
        } else {
            j11 = 1;
        }
        long m10 = m(xmlPullParser, "timescale", j11);
        if (bVar != null) {
            j12 = bVar.f13135c;
        } else {
            j12 = 0;
        }
        long m11 = m(xmlPullParser, "presentationTimeOffset", j12);
        if (bVar != null) {
            j13 = bVar.f13137e;
        } else {
            j13 = -9223372036854775807L;
        }
        long m12 = m(xmlPullParser, "duration", j13);
        if (bVar != null) {
            j14 = bVar.f13136d;
        }
        long m13 = m(xmlPullParser, "startNumber", j14);
        List list2 = null;
        h hVar = null;
        List list3 = null;
        do {
            xmlPullParser.next();
            if (f2.a.k(xmlPullParser, "Initialization")) {
                hVar = o("sourceURL", "range", xmlPullParser);
            } else if (f2.a.k(xmlPullParser, "SegmentTimeline")) {
                list3 = s(xmlPullParser, m10, j10);
            } else if (f2.a.k(xmlPullParser, "SegmentURL")) {
                if (list2 == null) {
                    list2 = new ArrayList();
                }
                list2.add(o("media", "mediaRange", xmlPullParser));
            } else {
                c(xmlPullParser);
            }
        } while (!f2.a.i(xmlPullParser, "SegmentList"));
        if (bVar != null) {
            if (hVar == null) {
                hVar = bVar.f13133a;
            }
            if (list3 == null) {
                list3 = bVar.f13138f;
            }
            if (list2 == null) {
                list = bVar.f13139g;
                return new j.b(hVar, m10, m11, m13, m12, list3, list);
            }
        }
        list = list2;
        return new j.b(hVar, m10, m11, m13, m12, list3, list);
    }

    public static j.c r(XmlPullParser xmlPullParser, @Nullable j.c cVar, List list, long j10) throws XmlPullParserException, IOException {
        long j11;
        long j12;
        long j13;
        long j14;
        k kVar;
        k kVar2;
        h hVar;
        List list2;
        long j15 = 1;
        if (cVar != null) {
            j11 = cVar.f13134b;
        } else {
            j11 = 1;
        }
        long m10 = m(xmlPullParser, "timescale", j11);
        if (cVar != null) {
            j12 = cVar.f13135c;
        } else {
            j12 = 0;
        }
        long m11 = m(xmlPullParser, "presentationTimeOffset", j12);
        if (cVar != null) {
            j13 = cVar.f13137e;
        } else {
            j13 = -9223372036854775807L;
        }
        long m12 = m(xmlPullParser, "duration", j13);
        if (cVar != null) {
            j15 = cVar.f13136d;
        }
        long m13 = m(xmlPullParser, "startNumber", j15);
        int i = 0;
        while (true) {
            if (i < list.size()) {
                d dVar = (d) list.get(i);
                if ("http://dashif.org/guidelines/last-segment-number".equalsIgnoreCase(dVar.f13104a)) {
                    j14 = Long.parseLong(dVar.f13105b);
                    break;
                }
                i++;
            } else {
                j14 = -1;
                break;
            }
        }
        long j16 = j14;
        h hVar2 = null;
        if (cVar != null) {
            kVar = cVar.f13141h;
        } else {
            kVar = null;
        }
        k t10 = t(xmlPullParser, "media", kVar);
        if (cVar != null) {
            kVar2 = cVar.f13140g;
        } else {
            kVar2 = null;
        }
        k t11 = t(xmlPullParser, "initialization", kVar2);
        List list3 = null;
        do {
            xmlPullParser.next();
            if (f2.a.k(xmlPullParser, "Initialization")) {
                hVar2 = o("sourceURL", "range", xmlPullParser);
            } else if (f2.a.k(xmlPullParser, "SegmentTimeline")) {
                list3 = s(xmlPullParser, m10, j10);
            } else {
                c(xmlPullParser);
            }
        } while (!f2.a.i(xmlPullParser, "SegmentTemplate"));
        if (cVar != null) {
            if (hVar2 == null) {
                hVar2 = cVar.f13133a;
            }
            if (list3 == null) {
                list2 = cVar.f13138f;
                hVar = hVar2;
                return new j.c(hVar, m10, m11, m13, j16, m12, list2, t11, t10);
            }
        }
        hVar = hVar2;
        list2 = list3;
        return new j.c(hVar, m10, m11, m13, j16, m12, list2, t11, t10);
    }

    public static ArrayList s(XmlPullParser xmlPullParser, long j10, long j11) throws XmlPullParserException, IOException {
        ArrayList arrayList = new ArrayList();
        long j12 = 0;
        long j13 = -9223372036854775807L;
        boolean z10 = false;
        int i = 0;
        do {
            xmlPullParser.next();
            if (f2.a.k(xmlPullParser, ExifInterface.LATITUDE_SOUTH)) {
                long m10 = m(xmlPullParser, "t", -9223372036854775807L);
                if (z10) {
                    j12 = b(arrayList, j12, j13, i, m10);
                }
                if (m10 == -9223372036854775807L) {
                    m10 = j12;
                }
                j13 = m(xmlPullParser, "d", -9223372036854775807L);
                i = l(xmlPullParser, "r", 0);
                j12 = m10;
                z10 = true;
            } else {
                c(xmlPullParser);
            }
        } while (!f2.a.i(xmlPullParser, "SegmentTimeline"));
        if (z10) {
            b(arrayList, j12, j13, i, d0.A(j11, j10, 1000L));
        }
        return arrayList;
    }

    @Nullable
    public static k t(XmlPullParser xmlPullParser, String str, @Nullable k kVar) {
        String str2;
        String attributeValue = xmlPullParser.getAttributeValue(null, str);
        if (attributeValue != null) {
            String[] strArr = new String[5];
            int[] iArr = new int[4];
            String[] strArr2 = new String[4];
            strArr[0] = "";
            int i = 0;
            int i2 = 0;
            while (i < attributeValue.length()) {
                int indexOf = attributeValue.indexOf("$", i);
                if (indexOf == -1) {
                    strArr[i2] = strArr[i2] + attributeValue.substring(i);
                    i = attributeValue.length();
                } else if (indexOf != i) {
                    strArr[i2] = strArr[i2] + attributeValue.substring(i, indexOf);
                    i = indexOf;
                } else if (attributeValue.startsWith("$$", i)) {
                    strArr[i2] = a9.f.h(new StringBuilder(), strArr[i2], "$");
                    i += 2;
                } else {
                    int i10 = i + 1;
                    int indexOf2 = attributeValue.indexOf("$", i10);
                    String substring = attributeValue.substring(i10, indexOf2);
                    if (substring.equals("RepresentationID")) {
                        iArr[i2] = 1;
                    } else {
                        int indexOf3 = substring.indexOf("%0");
                        if (indexOf3 != -1) {
                            str2 = substring.substring(indexOf3);
                            if (!str2.endsWith("d") && !str2.endsWith("x")) {
                                str2 = str2.concat("d");
                            }
                            substring = substring.substring(0, indexOf3);
                        } else {
                            str2 = "%01d";
                        }
                        substring.getClass();
                        substring.hashCode();
                        char c10 = 65535;
                        switch (substring.hashCode()) {
                            case -1950496919:
                                if (substring.equals("Number")) {
                                    c10 = 0;
                                    break;
                                }
                                break;
                            case 2606829:
                                if (substring.equals("Time")) {
                                    c10 = 1;
                                    break;
                                }
                                break;
                            case 38199441:
                                if (substring.equals("Bandwidth")) {
                                    c10 = 2;
                                    break;
                                }
                                break;
                        }
                    }
                    i2++;
                    strArr[i2] = "";
                    i = indexOf2 + 1;
                }
            }
            return new k(strArr, iArr, strArr2, i2);
        }
        return kVar;
    }

    @Override
    public final Object a(Uri uri, d2.k kVar) throws IOException {
        try {
            XmlPullParser newPullParser = this.f13096a.newPullParser();
            newPullParser.setInput(kVar, null);
            if (newPullParser.next() == 2 && "MPD".equals(newPullParser.getName())) {
                return n(newPullParser, uri.toString());
            }
            throw new b0("inputStream does not contain a valid media presentation description");
        } catch (XmlPullParserException e10) {
            throw new b0(e10);
        }
    }

    public final b n(XmlPullParser xmlPullParser, String str) throws XmlPullParserException, IOException {
        long x10;
        long j10;
        long j11;
        long j12;
        long x11;
        long j13;
        long j14;
        String str2;
        long j15;
        long j16;
        long j17;
        long j18;
        boolean z10;
        XmlPullParser xmlPullParser2;
        ArrayList arrayList;
        Object obj;
        ArrayList arrayList2;
        String str3;
        String str4;
        String str5;
        String str6;
        String str7;
        String str8;
        String str9;
        String str10;
        ArrayList arrayList3;
        ArrayList arrayList4;
        String str11;
        long j19;
        XmlPullParser xmlPullParser3;
        String str12;
        String str13;
        long j20;
        String str14;
        String str15;
        String str16;
        String str17;
        int i;
        String str18;
        ArrayList arrayList5;
        ArrayList arrayList6;
        int i2;
        String str19;
        ArrayList arrayList7;
        String str20;
        String str21;
        String str22;
        long j21;
        String str23;
        String str24;
        int i10;
        String str25;
        ArrayList arrayList8;
        int i11;
        String str26;
        XmlPullParser xmlPullParser4;
        String str27;
        ArrayList arrayList9;
        String str28;
        String str29;
        long j22;
        ArrayList arrayList10;
        ArrayList arrayList11;
        XmlPullParser xmlPullParser5;
        String str30;
        ArrayList arrayList12;
        ArrayList arrayList13;
        String str31;
        String str32;
        String str33;
        String str34;
        String str35;
        String str36;
        long j23;
        String str37;
        String str38;
        j r2;
        j jVar;
        String str39;
        String str40;
        String str41;
        int e10;
        String str42;
        String str43;
        int i12;
        String str44;
        String str45;
        ArrayList arrayList14;
        int i13;
        int i14;
        int i15;
        Format y10;
        j eVar;
        String str46;
        int i16;
        boolean z11;
        int i17;
        String str47;
        int parseInt;
        String str48;
        int i18;
        char c10;
        boolean z12;
        ArrayList arrayList15;
        ArrayList arrayList16;
        Object aVar;
        boolean z13;
        boolean z14;
        boolean z15;
        boolean z16;
        long j24;
        String str49;
        String str50;
        long j25;
        String str51;
        XmlPullParser xmlPullParser6 = xmlPullParser;
        String attributeValue = xmlPullParser6.getAttributeValue(null, "availabilityStartTime");
        if (attributeValue == null) {
            x10 = -9223372036854775807L;
        } else {
            x10 = d0.x(attributeValue);
        }
        long j26 = j(xmlPullParser6, "mediaPresentationDuration", -9223372036854775807L);
        long j27 = j(xmlPullParser6, "minBufferTime", -9223372036854775807L);
        boolean equals = "dynamic".equals(xmlPullParser6.getAttributeValue(null, "type"));
        if (equals) {
            j10 = j(xmlPullParser6, "minimumUpdatePeriod", -9223372036854775807L);
        } else {
            j10 = -9223372036854775807L;
        }
        if (equals) {
            j11 = j(xmlPullParser6, "timeShiftBufferDepth", -9223372036854775807L);
        } else {
            j11 = -9223372036854775807L;
        }
        if (equals) {
            j12 = j(xmlPullParser6, "suggestedPresentationDelay", -9223372036854775807L);
        } else {
            j12 = -9223372036854775807L;
        }
        String attributeValue2 = xmlPullParser6.getAttributeValue(null, "publishTime");
        if (attributeValue2 == null) {
            x11 = -9223372036854775807L;
        } else {
            x11 = d0.x(attributeValue2);
        }
        ArrayList arrayList17 = new ArrayList();
        if (equals) {
            j13 = -9223372036854775807L;
        } else {
            j13 = 0;
        }
        String str52 = str;
        XmlPullParser xmlPullParser7 = xmlPullParser6;
        g gVar = null;
        l lVar = null;
        Uri uri = null;
        long j28 = j13;
        boolean z17 = false;
        boolean z18 = false;
        while (true) {
            xmlPullParser.next();
            String str53 = "BaseURL";
            String str54 = "";
            if (f2.a.k(xmlPullParser7, "BaseURL")) {
                if (z17) {
                    j14 = j10;
                    j16 = j28;
                    j17 = j26;
                    j18 = x10;
                    str2 = str52;
                    j15 = j27;
                    z10 = equals;
                    xmlPullParser2 = xmlPullParser6;
                    arrayList = arrayList17;
                    obj = null;
                    str52 = str2;
                } else {
                    while (true) {
                        xmlPullParser7.next();
                        j14 = j10;
                        if (xmlPullParser7.getEventType() == 4) {
                            str51 = xmlPullParser7.getText();
                        } else {
                            c(xmlPullParser7);
                            str51 = str54;
                        }
                        if (f2.a.i(xmlPullParser7, "BaseURL")) {
                            str52 = f2.b0.c(str52, str51);
                            j15 = j27;
                            z17 = true;
                            j16 = j28;
                            j17 = j26;
                            j18 = x10;
                            z10 = equals;
                            xmlPullParser2 = xmlPullParser6;
                            arrayList = arrayList17;
                            obj = null;
                        } else {
                            str54 = str51;
                            j10 = j14;
                        }
                    }
                }
            } else {
                j14 = j10;
                str2 = str52;
                String str55 = "lang";
                if (f2.a.k(xmlPullParser7, "ProgramInformation")) {
                    String attributeValue3 = xmlPullParser7.getAttributeValue(null, "moreInformationURL");
                    if (attributeValue3 == null) {
                        str49 = null;
                    } else {
                        str49 = attributeValue3;
                    }
                    String attributeValue4 = xmlPullParser7.getAttributeValue(null, "lang");
                    if (attributeValue4 == null) {
                        str50 = null;
                    } else {
                        str50 = attributeValue4;
                    }
                    String str56 = null;
                    String str57 = null;
                    String str58 = null;
                    do {
                        xmlPullParser.next();
                        String str59 = str56;
                        if (f2.a.k(xmlPullParser7, "Title")) {
                            str56 = xmlPullParser.nextText();
                        } else {
                            if (f2.a.k(xmlPullParser7, "Source")) {
                                str57 = xmlPullParser.nextText();
                            } else if (f2.a.k(xmlPullParser7, ExifInterface.TAG_COPYRIGHT)) {
                                str58 = xmlPullParser.nextText();
                            } else {
                                c(xmlPullParser);
                            }
                            str56 = str59;
                        }
                    } while (!f2.a.i(xmlPullParser7, "ProgramInformation"));
                    gVar = new g(str56, str57, str58, str49, str50);
                    j15 = j27;
                } else {
                    String str60 = "value";
                    j15 = j27;
                    String str61 = "schemeIdUri";
                    if (f2.a.k(xmlPullParser7, "UTCTiming")) {
                        lVar = new l(xmlPullParser7.getAttributeValue(null, "schemeIdUri"), xmlPullParser7.getAttributeValue(null, "value"), 0);
                    } else if (f2.a.k(xmlPullParser7, AgentWebPermissions.ACTION_LOCATION)) {
                        uri = Uri.parse(xmlPullParser.nextText());
                    } else {
                        String str62 = "Period";
                        if (f2.a.k(xmlPullParser7, "Period") && !z18) {
                            String str63 = "id";
                            j18 = x10;
                            String attributeValue5 = xmlPullParser7.getAttributeValue(null, "id");
                            long j29 = j(xmlPullParser7, "start", j28);
                            String str64 = "duration";
                            j16 = j28;
                            j17 = j26;
                            long j30 = j(xmlPullParser7, "duration", -9223372036854775807L);
                            ArrayList arrayList18 = new ArrayList();
                            ArrayList arrayList19 = new ArrayList();
                            XmlPullParser xmlPullParser8 = xmlPullParser7;
                            String str65 = str2;
                            j jVar2 = null;
                            boolean z19 = false;
                            while (true) {
                                xmlPullParser.next();
                                if (f2.a.k(xmlPullParser7, str53)) {
                                    if (!z19) {
                                        String str66 = "";
                                        while (true) {
                                            xmlPullParser7.next();
                                            arrayList2 = arrayList17;
                                            z10 = equals;
                                            if (xmlPullParser7.getEventType() == 4) {
                                                str66 = xmlPullParser7.getText();
                                            } else {
                                                c(xmlPullParser7);
                                            }
                                            String str67 = str66;
                                            if (f2.a.i(xmlPullParser7, str53)) {
                                                String c11 = f2.b0.c(str65, str67);
                                                arrayList3 = arrayList18;
                                                str5 = str53;
                                                str7 = str55;
                                                str8 = str61;
                                                str11 = str63;
                                                str10 = str60;
                                                obj = null;
                                                z19 = true;
                                                xmlPullParser2 = xmlPullParser6;
                                                xmlPullParser3 = xmlPullParser8;
                                                str3 = c11;
                                                j19 = j30;
                                                arrayList4 = arrayList19;
                                                if (!f2.a.i(xmlPullParser7, str62)) {
                                                    Pair create = Pair.create(new f(attributeValue5, j29, arrayList3, arrayList4), Long.valueOf(j19));
                                                    f fVar = (f) create.first;
                                                    if (fVar.f13112b == -9223372036854775807L) {
                                                        if (z10) {
                                                            xmlPullParser7 = xmlPullParser3;
                                                            arrayList = arrayList2;
                                                            z18 = true;
                                                        } else {
                                                            throw new b0("Unable to determine start of period " + arrayList2.size());
                                                        }
                                                    } else {
                                                        long longValue = ((Long) create.second).longValue();
                                                        if (longValue == -9223372036854775807L) {
                                                            arrayList = arrayList2;
                                                            j24 = -9223372036854775807L;
                                                        } else {
                                                            j24 = fVar.f13112b + longValue;
                                                            arrayList = arrayList2;
                                                        }
                                                        arrayList.add(fVar);
                                                        xmlPullParser7 = xmlPullParser3;
                                                        j16 = j24;
                                                    }
                                                } else {
                                                    arrayList19 = arrayList4;
                                                    str63 = str11;
                                                    j30 = j19;
                                                    str65 = str3;
                                                    arrayList17 = arrayList2;
                                                    equals = z10;
                                                    str60 = str10;
                                                    str61 = str8;
                                                    str53 = str5;
                                                    str55 = str7;
                                                    xmlPullParser8 = xmlPullParser3;
                                                    xmlPullParser6 = xmlPullParser2;
                                                    arrayList18 = arrayList3;
                                                }
                                            } else {
                                                str66 = str67;
                                                arrayList17 = arrayList2;
                                                equals = z10;
                                            }
                                        }
                                    } else {
                                        arrayList2 = arrayList17;
                                        z10 = equals;
                                        str4 = str62;
                                        arrayList3 = arrayList18;
                                        str5 = str53;
                                        str7 = str55;
                                        str8 = str61;
                                        str11 = str63;
                                        str10 = str60;
                                        obj = null;
                                        xmlPullParser2 = xmlPullParser6;
                                        xmlPullParser3 = xmlPullParser8;
                                        str3 = str65;
                                        j19 = j30;
                                        arrayList4 = arrayList19;
                                    }
                                } else {
                                    arrayList2 = arrayList17;
                                    z10 = equals;
                                    str3 = str65;
                                    str4 = str62;
                                    ArrayList arrayList20 = arrayList19;
                                    if (f2.a.k(xmlPullParser7, "AdaptationSet")) {
                                        int l2 = l(xmlPullParser7, str63, -1);
                                        int g10 = g(xmlPullParser);
                                        String str68 = "mimeType";
                                        str6 = str64;
                                        String attributeValue6 = xmlPullParser7.getAttributeValue(null, "mimeType");
                                        str10 = str60;
                                        String str69 = "codecs";
                                        String attributeValue7 = xmlPullParser7.getAttributeValue(null, "codecs");
                                        String str70 = "width";
                                        arrayList3 = arrayList18;
                                        str8 = str61;
                                        int l10 = l(xmlPullParser7, "width", -1);
                                        String str71 = "AdaptationSet";
                                        String str72 = "height";
                                        int l11 = l(xmlPullParser7, "height", -1);
                                        float k10 = k(xmlPullParser7, -1.0f);
                                        String str73 = "SegmentTemplate";
                                        long j31 = j30;
                                        int l12 = l(xmlPullParser7, "audioSamplingRate", -1);
                                        String attributeValue8 = xmlPullParser7.getAttributeValue(null, str55);
                                        String str74 = "SegmentList";
                                        String attributeValue9 = xmlPullParser7.getAttributeValue(null, "label");
                                        ArrayList arrayList21 = new ArrayList();
                                        ArrayList arrayList22 = new ArrayList();
                                        String str75 = attributeValue9;
                                        ArrayList arrayList23 = new ArrayList();
                                        ArrayList arrayList24 = arrayList22;
                                        ArrayList arrayList25 = new ArrayList();
                                        String str76 = "SegmentBase";
                                        ArrayList arrayList26 = new ArrayList();
                                        int i19 = l12;
                                        int i20 = l11;
                                        ArrayList arrayList27 = new ArrayList();
                                        String str77 = "audioSamplingRate";
                                        j jVar3 = jVar2;
                                        String str78 = str3;
                                        int i21 = g10;
                                        String str79 = attributeValue8;
                                        int i22 = -1;
                                        String str80 = null;
                                        boolean z20 = false;
                                        XmlPullParser xmlPullParser9 = xmlPullParser;
                                        while (true) {
                                            xmlPullParser.next();
                                            if (f2.a.k(xmlPullParser9, str53)) {
                                                if (!z20) {
                                                    String str81 = "";
                                                    while (true) {
                                                        xmlPullParser9.next();
                                                        str17 = str72;
                                                        i = l10;
                                                        if (xmlPullParser9.getEventType() == 4) {
                                                            str81 = xmlPullParser9.getText();
                                                        } else {
                                                            c(xmlPullParser9);
                                                        }
                                                        String str82 = str81;
                                                        if (f2.a.i(xmlPullParser9, str53)) {
                                                            str78 = f2.b0.c(str78, str82);
                                                            z20 = true;
                                                            arrayList6 = arrayList26;
                                                            arrayList5 = arrayList21;
                                                            str19 = str79;
                                                            str7 = str55;
                                                            arrayList7 = arrayList25;
                                                            str9 = str63;
                                                            str20 = str68;
                                                            str21 = str69;
                                                            str22 = str73;
                                                            j21 = j31;
                                                            str23 = str74;
                                                            str24 = str76;
                                                            i10 = i20;
                                                            str25 = str77;
                                                            arrayList8 = arrayList23;
                                                            str5 = str53;
                                                            i11 = i19;
                                                            str26 = str17;
                                                            str27 = str70;
                                                            arrayList9 = arrayList27;
                                                            str18 = str78;
                                                            i2 = i21;
                                                            xmlPullParser5 = xmlPullParser9;
                                                            str30 = str71;
                                                            arrayList11 = arrayList24;
                                                            str28 = str23;
                                                            arrayList10 = arrayList6;
                                                            str29 = str22;
                                                            j22 = j21;
                                                        } else {
                                                            str81 = str82;
                                                            str72 = str17;
                                                            l10 = i;
                                                        }
                                                    }
                                                } else {
                                                    str17 = str72;
                                                    i = l10;
                                                    str18 = str78;
                                                    arrayList5 = arrayList21;
                                                    i2 = i21;
                                                    str19 = str79;
                                                    str7 = str55;
                                                    arrayList7 = arrayList25;
                                                    xmlPullParser5 = xmlPullParser9;
                                                    str9 = str63;
                                                    str20 = str68;
                                                    str21 = str69;
                                                    str28 = str74;
                                                    arrayList11 = arrayList24;
                                                    str24 = str76;
                                                    str25 = str77;
                                                    arrayList8 = arrayList23;
                                                    arrayList10 = arrayList26;
                                                    str29 = str73;
                                                    i11 = i19;
                                                    str26 = str17;
                                                    str5 = str53;
                                                    str27 = str70;
                                                    j22 = j31;
                                                    arrayList9 = arrayList27;
                                                    i10 = i20;
                                                    str30 = str71;
                                                }
                                            } else {
                                                str17 = str72;
                                                i = l10;
                                                String str83 = "ContentProtection";
                                                if (f2.a.k(xmlPullParser9, "ContentProtection")) {
                                                    Pair f10 = f(xmlPullParser);
                                                    Object obj2 = f10.first;
                                                    if (obj2 != null) {
                                                        str80 = (String) obj2;
                                                    }
                                                    Object obj3 = f10.second;
                                                    if (obj3 != null) {
                                                        arrayList21.add(obj3);
                                                    }
                                                } else {
                                                    if (f2.a.k(xmlPullParser9, "ContentComponent")) {
                                                        String attributeValue10 = xmlPullParser9.getAttributeValue(null, str55);
                                                        if (str79 == null) {
                                                            str79 = attributeValue10;
                                                        } else if (attributeValue10 != null) {
                                                            f2.a.e(str79.equals(attributeValue10));
                                                        }
                                                        int g11 = g(xmlPullParser);
                                                        if (i21 == -1) {
                                                            i21 = g11;
                                                        } else if (g11 != -1) {
                                                            if (i21 == g11) {
                                                                z12 = true;
                                                            } else {
                                                                z12 = false;
                                                            }
                                                            f2.a.e(z12);
                                                        }
                                                    } else if (f2.a.k(xmlPullParser9, "Role")) {
                                                        arrayList25.add(i(xmlPullParser9, "Role"));
                                                    } else {
                                                        String str84 = "AudioChannelConfiguration";
                                                        if (f2.a.k(xmlPullParser9, "AudioChannelConfiguration")) {
                                                            i22 = e(xmlPullParser);
                                                        } else {
                                                            str18 = str78;
                                                            if (f2.a.k(xmlPullParser9, "Accessibility")) {
                                                                arrayList23.add(i(xmlPullParser9, "Accessibility"));
                                                            } else {
                                                                String str85 = "SupplementalProperty";
                                                                if (f2.a.k(xmlPullParser9, "SupplementalProperty")) {
                                                                    arrayList26.add(i(xmlPullParser9, "SupplementalProperty"));
                                                                } else {
                                                                    str7 = str55;
                                                                    String str86 = "Representation";
                                                                    arrayList5 = arrayList21;
                                                                    if (f2.a.k(xmlPullParser9, "Representation")) {
                                                                        int i23 = i21;
                                                                        String attributeValue11 = xmlPullParser9.getAttributeValue(null, str63);
                                                                        str9 = str63;
                                                                        str19 = str79;
                                                                        int l13 = l(xmlPullParser9, "bandwidth", -1);
                                                                        String attributeValue12 = xmlPullParser9.getAttributeValue(null, str68);
                                                                        if (attributeValue12 == null) {
                                                                            attributeValue12 = attributeValue6;
                                                                        }
                                                                        String attributeValue13 = xmlPullParser9.getAttributeValue(null, str69);
                                                                        if (attributeValue13 == null) {
                                                                            attributeValue13 = attributeValue7;
                                                                        }
                                                                        int l14 = l(xmlPullParser9, str70, i);
                                                                        i = i;
                                                                        str27 = str70;
                                                                        int l15 = l(xmlPullParser9, str17, i20);
                                                                        float k11 = k(xmlPullParser9, k10);
                                                                        int i24 = i19;
                                                                        str26 = str17;
                                                                        String str87 = str77;
                                                                        int l16 = l(xmlPullParser9, str87, i24);
                                                                        i11 = i24;
                                                                        ArrayList arrayList28 = new ArrayList();
                                                                        str25 = str87;
                                                                        ArrayList arrayList29 = new ArrayList();
                                                                        XmlPullParser xmlPullParser10 = xmlPullParser9;
                                                                        ArrayList arrayList30 = new ArrayList();
                                                                        str20 = str68;
                                                                        str21 = str69;
                                                                        int i25 = i22;
                                                                        XmlPullParser xmlPullParser11 = xmlPullParser10;
                                                                        j jVar4 = jVar3;
                                                                        String str88 = str18;
                                                                        boolean z21 = false;
                                                                        String str89 = null;
                                                                        while (true) {
                                                                            xmlPullParser.next();
                                                                            if (f2.a.k(xmlPullParser11, str53)) {
                                                                                if (!z21) {
                                                                                    String str90 = "";
                                                                                    while (true) {
                                                                                        xmlPullParser11.next();
                                                                                        arrayList12 = arrayList23;
                                                                                        arrayList13 = arrayList25;
                                                                                        if (xmlPullParser11.getEventType() == 4) {
                                                                                            str90 = xmlPullParser11.getText();
                                                                                        } else {
                                                                                            c(xmlPullParser11);
                                                                                        }
                                                                                        String str91 = str90;
                                                                                        if (f2.a.i(xmlPullParser11, str53)) {
                                                                                            str88 = f2.b0.c(str88, str91);
                                                                                            z21 = true;
                                                                                        } else {
                                                                                            str90 = str91;
                                                                                            arrayList23 = arrayList12;
                                                                                            arrayList25 = arrayList13;
                                                                                        }
                                                                                    }
                                                                                } else {
                                                                                    arrayList12 = arrayList23;
                                                                                    arrayList13 = arrayList25;
                                                                                }
                                                                                str31 = str76;
                                                                            } else {
                                                                                arrayList12 = arrayList23;
                                                                                arrayList13 = arrayList25;
                                                                                if (f2.a.k(xmlPullParser11, str84)) {
                                                                                    str34 = attributeValue12;
                                                                                    str32 = str74;
                                                                                    str33 = str84;
                                                                                    str36 = str73;
                                                                                    str5 = str53;
                                                                                    jVar = jVar4;
                                                                                    String str92 = str89;
                                                                                    str39 = str85;
                                                                                    str40 = str86;
                                                                                    j23 = j31;
                                                                                    i10 = i20;
                                                                                    str38 = str83;
                                                                                    str37 = str88;
                                                                                    str41 = str92;
                                                                                    String str93 = str76;
                                                                                    e10 = e(xmlPullParser);
                                                                                    str31 = str93;
                                                                                    if (!f2.a.i(xmlPullParser11, str40)) {
                                                                                        if (m.h(str34)) {
                                                                                            str43 = m.a(attributeValue13);
                                                                                        } else if (m.j(str34)) {
                                                                                            str43 = m.g(attributeValue13);
                                                                                        } else if (d(str34)) {
                                                                                            str43 = str34;
                                                                                        } else {
                                                                                            arrayList6 = arrayList26;
                                                                                            str42 = str34;
                                                                                            if ("application/mp4".equals(str42)) {
                                                                                                if (attributeValue13 != null) {
                                                                                                    if (attributeValue13.startsWith("stpp")) {
                                                                                                        str43 = "application/ttml+xml";
                                                                                                    } else if (attributeValue13.startsWith("wvtt")) {
                                                                                                        str43 = "application/x-mp4-vtt";
                                                                                                    }
                                                                                                    str22 = str36;
                                                                                                    j21 = j23;
                                                                                                    i12 = 0;
                                                                                                    while (true) {
                                                                                                        str44 = "urn:mpeg:dash:role:2011";
                                                                                                        if (i12 < arrayList13.size()) {
                                                                                                            arrayList14 = arrayList13;
                                                                                                            str23 = str32;
                                                                                                            d dVar = (d) arrayList14.get(i12);
                                                                                                            str45 = str31;
                                                                                                            if ("urn:mpeg:dash:role:2011".equalsIgnoreCase(dVar.f13104a) && "main".equals(dVar.f13105b)) {
                                                                                                                i13 = 1;
                                                                                                            } else {
                                                                                                                i12++;
                                                                                                                str32 = str23;
                                                                                                                str31 = str45;
                                                                                                                arrayList13 = arrayList14;
                                                                                                            }
                                                                                                        } else {
                                                                                                            str45 = str31;
                                                                                                            arrayList14 = arrayList13;
                                                                                                            str23 = str32;
                                                                                                            i13 = 0;
                                                                                                        }
                                                                                                    }
                                                                                                    i14 = 0;
                                                                                                    int i26 = 0;
                                                                                                    while (i14 < arrayList14.size()) {
                                                                                                        d dVar2 = (d) arrayList14.get(i14);
                                                                                                        ArrayList arrayList31 = arrayList14;
                                                                                                        if ("urn:mpeg:dash:role:2011".equalsIgnoreCase(dVar2.f13104a)) {
                                                                                                            i26 |= h(dVar2.f13105b);
                                                                                                        }
                                                                                                        i14++;
                                                                                                        arrayList14 = arrayList31;
                                                                                                    }
                                                                                                    arrayList7 = arrayList14;
                                                                                                    i15 = 0;
                                                                                                    int i27 = 0;
                                                                                                    while (i15 < arrayList12.size()) {
                                                                                                        ArrayList arrayList32 = arrayList12;
                                                                                                        d dVar3 = (d) arrayList32.get(i15);
                                                                                                        ArrayList arrayList33 = arrayList29;
                                                                                                        boolean equalsIgnoreCase = str44.equalsIgnoreCase(dVar3.f13104a);
                                                                                                        String str94 = str44;
                                                                                                        String str95 = dVar3.f13105b;
                                                                                                        if (equalsIgnoreCase) {
                                                                                                            i18 = h(str95);
                                                                                                        } else if ("urn:tva:metadata:cs:AudioPurposeCS:2007".equalsIgnoreCase(dVar3.f13104a)) {
                                                                                                            if (str95 != null) {
                                                                                                                switch (str95.hashCode()) {
                                                                                                                    case 49:
                                                                                                                        if (str95.equals(PushConstants.PUSH_TYPE_THROUGH_MESSAGE)) {
                                                                                                                            c10 = 0;
                                                                                                                            break;
                                                                                                                        }
                                                                                                                        break;
                                                                                                                    case 50:
                                                                                                                        if (str95.equals("2")) {
                                                                                                                            c10 = 1;
                                                                                                                            break;
                                                                                                                        }
                                                                                                                        break;
                                                                                                                    case 51:
                                                                                                                        if (str95.equals("3")) {
                                                                                                                            c10 = 2;
                                                                                                                            break;
                                                                                                                        }
                                                                                                                        break;
                                                                                                                    case 52:
                                                                                                                        if (str95.equals(PushConstants.PUSH_TYPE_WITHDRAW_NOTIFICATION)) {
                                                                                                                            c10 = 3;
                                                                                                                            break;
                                                                                                                        }
                                                                                                                        break;
                                                                                                                    case 54:
                                                                                                                        if (str95.equals("6")) {
                                                                                                                            c10 = 4;
                                                                                                                            break;
                                                                                                                        }
                                                                                                                        break;
                                                                                                                }
                                                                                                                c10 = 65535;
                                                                                                                if (c10 != 0) {
                                                                                                                    if (c10 != 1) {
                                                                                                                        if (c10 != 2) {
                                                                                                                            if (c10 != 3) {
                                                                                                                                if (c10 == 4) {
                                                                                                                                    i18 = 1;
                                                                                                                                }
                                                                                                                            } else {
                                                                                                                                i18 = 8;
                                                                                                                            }
                                                                                                                        } else {
                                                                                                                            i18 = 4;
                                                                                                                        }
                                                                                                                    } else {
                                                                                                                        i18 = 2048;
                                                                                                                    }
                                                                                                                } else {
                                                                                                                    i18 = 512;
                                                                                                                }
                                                                                                            }
                                                                                                            i18 = 0;
                                                                                                        } else {
                                                                                                            i15++;
                                                                                                            arrayList12 = arrayList32;
                                                                                                            str44 = str94;
                                                                                                            arrayList29 = arrayList33;
                                                                                                        }
                                                                                                        i27 |= i18;
                                                                                                        i15++;
                                                                                                        arrayList12 = arrayList32;
                                                                                                        str44 = str94;
                                                                                                        arrayList29 = arrayList33;
                                                                                                    }
                                                                                                    ArrayList arrayList34 = arrayList29;
                                                                                                    arrayList8 = arrayList12;
                                                                                                    int i28 = i26 | i27;
                                                                                                    if (str43 != null) {
                                                                                                        if ("audio/eac3".equals(str43)) {
                                                                                                            for (int i29 = 0; i29 < arrayList30.size(); i29++) {
                                                                                                                d dVar4 = (d) arrayList30.get(i29);
                                                                                                                String str96 = dVar4.f13104a;
                                                                                                                boolean equals2 = "tag:dolby.com,2018:dash:EC3_ExtensionType:2018".equals(str96);
                                                                                                                String str97 = dVar4.f13105b;
                                                                                                                if ((equals2 && "JOC".equals(str97)) || ("tag:dolby.com,2014:dash:DolbyDigitalPlusExtensionType:2014".equals(str96) && "ec+3".equals(str97))) {
                                                                                                                    str43 = "audio/eac3-joc";
                                                                                                                }
                                                                                                            }
                                                                                                            str43 = "audio/eac3";
                                                                                                        }
                                                                                                        if (m.j(str43)) {
                                                                                                            y10 = Format.F(attributeValue11, null, str42, str43, attributeValue13, null, l13, l14, l15, k11, null, i13, i28);
                                                                                                        } else if (m.h(str43)) {
                                                                                                            y10 = Format.u(attributeValue11, null, str42, str43, attributeValue13, null, l13, e10, l16, null, i13, i28, str19);
                                                                                                        } else if (d(str43)) {
                                                                                                            if ("application/cea-608".equals(str43)) {
                                                                                                                for (int i30 = 0; i30 < arrayList8.size(); i30++) {
                                                                                                                    d dVar5 = (d) arrayList8.get(i30);
                                                                                                                    if ("urn:scte:dash:cc:cea-608:2015".equals(dVar5.f13104a) && (str48 = dVar5.f13105b) != null) {
                                                                                                                        Matcher matcher = f13094c.matcher(str48);
                                                                                                                        if (matcher.matches()) {
                                                                                                                            parseInt = Integer.parseInt(matcher.group(1));
                                                                                                                            i17 = parseInt;
                                                                                                                            y10 = Format.C(attributeValue11, null, str42, str43, attributeValue13, l13, i13, i28, str19, i17);
                                                                                                                        } else {
                                                                                                                            Log.w("MpdParser", "Unable to parse CEA-608 channel number from: ".concat(str48));
                                                                                                                        }
                                                                                                                    }
                                                                                                                }
                                                                                                                parseInt = -1;
                                                                                                                i17 = parseInt;
                                                                                                                y10 = Format.C(attributeValue11, null, str42, str43, attributeValue13, l13, i13, i28, str19, i17);
                                                                                                            } else if ("application/cea-708".equals(str43)) {
                                                                                                                for (int i31 = 0; i31 < arrayList8.size(); i31++) {
                                                                                                                    d dVar6 = (d) arrayList8.get(i31);
                                                                                                                    if ("urn:scte:dash:cc:cea-708:2015".equals(dVar6.f13104a) && (str47 = dVar6.f13105b) != null) {
                                                                                                                        Matcher matcher2 = f13095d.matcher(str47);
                                                                                                                        if (matcher2.matches()) {
                                                                                                                            parseInt = Integer.parseInt(matcher2.group(1));
                                                                                                                            i17 = parseInt;
                                                                                                                            y10 = Format.C(attributeValue11, null, str42, str43, attributeValue13, l13, i13, i28, str19, i17);
                                                                                                                        } else {
                                                                                                                            Log.w("MpdParser", "Unable to parse CEA-708 service block number from: ".concat(str47));
                                                                                                                        }
                                                                                                                    }
                                                                                                                }
                                                                                                                parseInt = -1;
                                                                                                                i17 = parseInt;
                                                                                                                y10 = Format.C(attributeValue11, null, str42, str43, attributeValue13, l13, i13, i28, str19, i17);
                                                                                                            } else {
                                                                                                                i17 = -1;
                                                                                                                y10 = Format.C(attributeValue11, null, str42, str43, attributeValue13, l13, i13, i28, str19, i17);
                                                                                                            }
                                                                                                            if (jVar != null) {
                                                                                                                eVar = jVar;
                                                                                                            } else {
                                                                                                                eVar = new j.e();
                                                                                                            }
                                                                                                            a aVar2 = new a(y10, str37, eVar, str41, arrayList28, arrayList34);
                                                                                                            str46 = y10.f3970m;
                                                                                                            if (!TextUtils.isEmpty(str46)) {
                                                                                                                if (m.j(str46)) {
                                                                                                                    i16 = 2;
                                                                                                                } else if (m.h(str46)) {
                                                                                                                    i16 = 1;
                                                                                                                } else if (d(str46)) {
                                                                                                                    i16 = 3;
                                                                                                                }
                                                                                                                if (i23 != -1) {
                                                                                                                    i21 = i16;
                                                                                                                } else {
                                                                                                                    if (i16 != -1) {
                                                                                                                        if (i23 == i16) {
                                                                                                                            z11 = true;
                                                                                                                        } else {
                                                                                                                            z11 = false;
                                                                                                                        }
                                                                                                                        f2.a.e(z11);
                                                                                                                    }
                                                                                                                    i21 = i23;
                                                                                                                }
                                                                                                                arrayList9 = arrayList27;
                                                                                                                arrayList9.add(aVar2);
                                                                                                                xmlPullParser4 = xmlPullParser;
                                                                                                                str24 = str45;
                                                                                                            }
                                                                                                            i16 = -1;
                                                                                                            if (i23 != -1) {
                                                                                                            }
                                                                                                            arrayList9 = arrayList27;
                                                                                                            arrayList9.add(aVar2);
                                                                                                            xmlPullParser4 = xmlPullParser;
                                                                                                            str24 = str45;
                                                                                                        }
                                                                                                        if (jVar != null) {
                                                                                                        }
                                                                                                        a aVar22 = new a(y10, str37, eVar, str41, arrayList28, arrayList34);
                                                                                                        str46 = y10.f3970m;
                                                                                                        if (!TextUtils.isEmpty(str46)) {
                                                                                                        }
                                                                                                        i16 = -1;
                                                                                                        if (i23 != -1) {
                                                                                                        }
                                                                                                        arrayList9 = arrayList27;
                                                                                                        arrayList9.add(aVar22);
                                                                                                        xmlPullParser4 = xmlPullParser;
                                                                                                        str24 = str45;
                                                                                                    }
                                                                                                    y10 = Format.y(attributeValue11, null, str42, str43, attributeValue13, l13, i13, i28, str19);
                                                                                                    if (jVar != null) {
                                                                                                    }
                                                                                                    a aVar222 = new a(y10, str37, eVar, str41, arrayList28, arrayList34);
                                                                                                    str46 = y10.f3970m;
                                                                                                    if (!TextUtils.isEmpty(str46)) {
                                                                                                    }
                                                                                                    i16 = -1;
                                                                                                    if (i23 != -1) {
                                                                                                    }
                                                                                                    arrayList9 = arrayList27;
                                                                                                    arrayList9.add(aVar222);
                                                                                                    xmlPullParser4 = xmlPullParser;
                                                                                                    str24 = str45;
                                                                                                }
                                                                                                str43 = null;
                                                                                                str22 = str36;
                                                                                                j21 = j23;
                                                                                                i12 = 0;
                                                                                                while (true) {
                                                                                                    str44 = "urn:mpeg:dash:role:2011";
                                                                                                    if (i12 < arrayList13.size()) {
                                                                                                    }
                                                                                                    i12++;
                                                                                                    str32 = str23;
                                                                                                    str31 = str45;
                                                                                                    arrayList13 = arrayList14;
                                                                                                }
                                                                                                i14 = 0;
                                                                                                int i262 = 0;
                                                                                                while (i14 < arrayList14.size()) {
                                                                                                }
                                                                                                arrayList7 = arrayList14;
                                                                                                i15 = 0;
                                                                                                int i272 = 0;
                                                                                                while (i15 < arrayList12.size()) {
                                                                                                }
                                                                                                ArrayList arrayList342 = arrayList29;
                                                                                                arrayList8 = arrayList12;
                                                                                                int i282 = i262 | i272;
                                                                                                if (str43 != null) {
                                                                                                }
                                                                                                y10 = Format.y(attributeValue11, null, str42, str43, attributeValue13, l13, i13, i282, str19);
                                                                                                if (jVar != null) {
                                                                                                }
                                                                                                a aVar2222 = new a(y10, str37, eVar, str41, arrayList28, arrayList342);
                                                                                                str46 = y10.f3970m;
                                                                                                if (!TextUtils.isEmpty(str46)) {
                                                                                                }
                                                                                                i16 = -1;
                                                                                                if (i23 != -1) {
                                                                                                }
                                                                                                arrayList9 = arrayList27;
                                                                                                arrayList9.add(aVar2222);
                                                                                                xmlPullParser4 = xmlPullParser;
                                                                                                str24 = str45;
                                                                                            } else {
                                                                                                if ("application/x-rawcc".equals(str42) && attributeValue13 != null) {
                                                                                                    if (attributeValue13.contains("cea708")) {
                                                                                                        str43 = "application/cea-708";
                                                                                                    } else if (attributeValue13.contains("eia608") || attributeValue13.contains("cea608")) {
                                                                                                        str43 = "application/cea-608";
                                                                                                    }
                                                                                                    str22 = str36;
                                                                                                    j21 = j23;
                                                                                                    i12 = 0;
                                                                                                    while (true) {
                                                                                                        str44 = "urn:mpeg:dash:role:2011";
                                                                                                        if (i12 < arrayList13.size()) {
                                                                                                        }
                                                                                                        i12++;
                                                                                                        str32 = str23;
                                                                                                        str31 = str45;
                                                                                                        arrayList13 = arrayList14;
                                                                                                    }
                                                                                                    i14 = 0;
                                                                                                    int i2622 = 0;
                                                                                                    while (i14 < arrayList14.size()) {
                                                                                                    }
                                                                                                    arrayList7 = arrayList14;
                                                                                                    i15 = 0;
                                                                                                    int i2722 = 0;
                                                                                                    while (i15 < arrayList12.size()) {
                                                                                                    }
                                                                                                    ArrayList arrayList3422 = arrayList29;
                                                                                                    arrayList8 = arrayList12;
                                                                                                    int i2822 = i2622 | i2722;
                                                                                                    if (str43 != null) {
                                                                                                    }
                                                                                                    y10 = Format.y(attributeValue11, null, str42, str43, attributeValue13, l13, i13, i2822, str19);
                                                                                                    if (jVar != null) {
                                                                                                    }
                                                                                                    a aVar22222 = new a(y10, str37, eVar, str41, arrayList28, arrayList3422);
                                                                                                    str46 = y10.f3970m;
                                                                                                    if (!TextUtils.isEmpty(str46)) {
                                                                                                    }
                                                                                                    i16 = -1;
                                                                                                    if (i23 != -1) {
                                                                                                    }
                                                                                                    arrayList9 = arrayList27;
                                                                                                    arrayList9.add(aVar22222);
                                                                                                    xmlPullParser4 = xmlPullParser;
                                                                                                    str24 = str45;
                                                                                                }
                                                                                                str43 = null;
                                                                                                str22 = str36;
                                                                                                j21 = j23;
                                                                                                i12 = 0;
                                                                                                while (true) {
                                                                                                    str44 = "urn:mpeg:dash:role:2011";
                                                                                                    if (i12 < arrayList13.size()) {
                                                                                                    }
                                                                                                    i12++;
                                                                                                    str32 = str23;
                                                                                                    str31 = str45;
                                                                                                    arrayList13 = arrayList14;
                                                                                                }
                                                                                                i14 = 0;
                                                                                                int i26222 = 0;
                                                                                                while (i14 < arrayList14.size()) {
                                                                                                }
                                                                                                arrayList7 = arrayList14;
                                                                                                i15 = 0;
                                                                                                int i27222 = 0;
                                                                                                while (i15 < arrayList12.size()) {
                                                                                                }
                                                                                                ArrayList arrayList34222 = arrayList29;
                                                                                                arrayList8 = arrayList12;
                                                                                                int i28222 = i26222 | i27222;
                                                                                                if (str43 != null) {
                                                                                                }
                                                                                                y10 = Format.y(attributeValue11, null, str42, str43, attributeValue13, l13, i13, i28222, str19);
                                                                                                if (jVar != null) {
                                                                                                }
                                                                                                a aVar222222 = new a(y10, str37, eVar, str41, arrayList28, arrayList34222);
                                                                                                str46 = y10.f3970m;
                                                                                                if (!TextUtils.isEmpty(str46)) {
                                                                                                }
                                                                                                i16 = -1;
                                                                                                if (i23 != -1) {
                                                                                                }
                                                                                                arrayList9 = arrayList27;
                                                                                                arrayList9.add(aVar222222);
                                                                                                xmlPullParser4 = xmlPullParser;
                                                                                                str24 = str45;
                                                                                            }
                                                                                            str18 = str78;
                                                                                            i2 = i21;
                                                                                            xmlPullParser5 = xmlPullParser9;
                                                                                            str30 = str71;
                                                                                            arrayList11 = arrayList24;
                                                                                            str28 = str23;
                                                                                            arrayList10 = arrayList6;
                                                                                            str29 = str22;
                                                                                            j22 = j21;
                                                                                        }
                                                                                        arrayList6 = arrayList26;
                                                                                        str42 = str34;
                                                                                        str22 = str36;
                                                                                        j21 = j23;
                                                                                        i12 = 0;
                                                                                        while (true) {
                                                                                            str44 = "urn:mpeg:dash:role:2011";
                                                                                            if (i12 < arrayList13.size()) {
                                                                                            }
                                                                                            i12++;
                                                                                            str32 = str23;
                                                                                            str31 = str45;
                                                                                            arrayList13 = arrayList14;
                                                                                        }
                                                                                        i14 = 0;
                                                                                        int i262222 = 0;
                                                                                        while (i14 < arrayList14.size()) {
                                                                                        }
                                                                                        arrayList7 = arrayList14;
                                                                                        i15 = 0;
                                                                                        int i272222 = 0;
                                                                                        while (i15 < arrayList12.size()) {
                                                                                        }
                                                                                        ArrayList arrayList342222 = arrayList29;
                                                                                        arrayList8 = arrayList12;
                                                                                        int i282222 = i262222 | i272222;
                                                                                        if (str43 != null) {
                                                                                        }
                                                                                        y10 = Format.y(attributeValue11, null, str42, str43, attributeValue13, l13, i13, i282222, str19);
                                                                                        if (jVar != null) {
                                                                                        }
                                                                                        a aVar2222222 = new a(y10, str37, eVar, str41, arrayList28, arrayList342222);
                                                                                        str46 = y10.f3970m;
                                                                                        if (!TextUtils.isEmpty(str46)) {
                                                                                        }
                                                                                        i16 = -1;
                                                                                        if (i23 != -1) {
                                                                                        }
                                                                                        arrayList9 = arrayList27;
                                                                                        arrayList9.add(aVar2222222);
                                                                                        xmlPullParser4 = xmlPullParser;
                                                                                        str24 = str45;
                                                                                    } else {
                                                                                        xmlPullParser11 = xmlPullParser;
                                                                                        jVar4 = jVar;
                                                                                        str53 = str5;
                                                                                        str88 = str37;
                                                                                        i25 = e10;
                                                                                        str76 = str31;
                                                                                        str73 = str36;
                                                                                        str84 = str33;
                                                                                        arrayList23 = arrayList12;
                                                                                        str74 = str32;
                                                                                        arrayList25 = arrayList13;
                                                                                        long j32 = j23;
                                                                                        str86 = str40;
                                                                                        str85 = str39;
                                                                                        attributeValue12 = str34;
                                                                                        str89 = str41;
                                                                                        str83 = str38;
                                                                                        i20 = i10;
                                                                                        j31 = j32;
                                                                                    }
                                                                                } else {
                                                                                    str31 = str76;
                                                                                    if (f2.a.k(xmlPullParser11, str31)) {
                                                                                        jVar4 = p(xmlPullParser11, (j.e) jVar4);
                                                                                    } else {
                                                                                        str32 = str74;
                                                                                        if (f2.a.k(xmlPullParser11, str32)) {
                                                                                            str33 = str84;
                                                                                            str34 = attributeValue12;
                                                                                            str35 = str86;
                                                                                            j23 = j31;
                                                                                            str37 = str88;
                                                                                            i10 = i20;
                                                                                            String str98 = str53;
                                                                                            r2 = q(xmlPullParser11, (j.b) jVar4, j23);
                                                                                            str36 = str73;
                                                                                            str5 = str98;
                                                                                        } else {
                                                                                            str33 = str84;
                                                                                            str34 = attributeValue12;
                                                                                            str35 = str86;
                                                                                            str36 = str73;
                                                                                            j23 = j31;
                                                                                            if (f2.a.k(xmlPullParser11, str36)) {
                                                                                                str5 = str53;
                                                                                                str37 = str88;
                                                                                                i10 = i20;
                                                                                                r2 = r(xmlPullParser, (j.c) jVar4, arrayList26, j23);
                                                                                            } else {
                                                                                                str5 = str53;
                                                                                                str37 = str88;
                                                                                                i10 = i20;
                                                                                                if (f2.a.k(xmlPullParser11, str83)) {
                                                                                                    Pair f11 = f(xmlPullParser);
                                                                                                    str38 = str83;
                                                                                                    Object obj4 = f11.first;
                                                                                                    if (obj4 != null) {
                                                                                                        str89 = (String) obj4;
                                                                                                    }
                                                                                                    Object obj5 = f11.second;
                                                                                                    if (obj5 != null) {
                                                                                                        arrayList28.add(obj5);
                                                                                                    }
                                                                                                } else {
                                                                                                    str38 = str83;
                                                                                                    if (f2.a.k(xmlPullParser11, "InbandEventStream")) {
                                                                                                        arrayList29.add(i(xmlPullParser11, "InbandEventStream"));
                                                                                                    } else if (f2.a.k(xmlPullParser11, str85)) {
                                                                                                        arrayList30.add(i(xmlPullParser11, str85));
                                                                                                    } else {
                                                                                                        c(xmlPullParser);
                                                                                                    }
                                                                                                }
                                                                                                str41 = str89;
                                                                                                jVar = jVar4;
                                                                                                str39 = str85;
                                                                                                str40 = str35;
                                                                                                e10 = i25;
                                                                                                if (!f2.a.i(xmlPullParser11, str40)) {
                                                                                                }
                                                                                            }
                                                                                        }
                                                                                        str38 = str83;
                                                                                        jVar4 = r2;
                                                                                        str41 = str89;
                                                                                        jVar = jVar4;
                                                                                        str39 = str85;
                                                                                        str40 = str35;
                                                                                        e10 = i25;
                                                                                        if (!f2.a.i(xmlPullParser11, str40)) {
                                                                                        }
                                                                                    }
                                                                                }
                                                                            }
                                                                            str34 = attributeValue12;
                                                                            str35 = str86;
                                                                            j23 = j31;
                                                                            str32 = str74;
                                                                            i10 = i20;
                                                                            str38 = str83;
                                                                            str33 = str84;
                                                                            str37 = str88;
                                                                            str36 = str73;
                                                                            str5 = str53;
                                                                            str41 = str89;
                                                                            jVar = jVar4;
                                                                            str39 = str85;
                                                                            str40 = str35;
                                                                            e10 = i25;
                                                                            if (!f2.a.i(xmlPullParser11, str40)) {
                                                                            }
                                                                        }
                                                                    } else {
                                                                        arrayList6 = arrayList26;
                                                                        i2 = i21;
                                                                        str19 = str79;
                                                                        arrayList7 = arrayList25;
                                                                        str9 = str63;
                                                                        str20 = str68;
                                                                        str21 = str69;
                                                                        str22 = str73;
                                                                        j21 = j31;
                                                                        str23 = str74;
                                                                        str24 = str76;
                                                                        i10 = i20;
                                                                        str25 = str77;
                                                                        arrayList8 = arrayList23;
                                                                        str5 = str53;
                                                                        i11 = i19;
                                                                        str26 = str17;
                                                                        xmlPullParser4 = xmlPullParser;
                                                                        str27 = str70;
                                                                        arrayList9 = arrayList27;
                                                                        if (f2.a.k(xmlPullParser4, str24)) {
                                                                            jVar3 = p(xmlPullParser4, (j.e) jVar3);
                                                                            i21 = i2;
                                                                        } else {
                                                                            str28 = str23;
                                                                            if (f2.a.k(xmlPullParser4, str28)) {
                                                                                j22 = j21;
                                                                                jVar3 = q(xmlPullParser4, (j.b) jVar3, j22);
                                                                                arrayList10 = arrayList6;
                                                                                str29 = str22;
                                                                            } else {
                                                                                str29 = str22;
                                                                                j22 = j21;
                                                                                if (f2.a.k(xmlPullParser4, str29)) {
                                                                                    arrayList10 = arrayList6;
                                                                                    jVar3 = r(xmlPullParser4, (j.c) jVar3, arrayList10, j22);
                                                                                } else {
                                                                                    arrayList10 = arrayList6;
                                                                                    if (f2.a.k(xmlPullParser4, "InbandEventStream")) {
                                                                                        arrayList11 = arrayList24;
                                                                                        arrayList11.add(i(xmlPullParser4, "InbandEventStream"));
                                                                                    } else {
                                                                                        arrayList11 = arrayList24;
                                                                                        if (f2.a.k(xmlPullParser4, "Label")) {
                                                                                            String str99 = "";
                                                                                            do {
                                                                                                xmlPullParser.next();
                                                                                                if (xmlPullParser.getEventType() == 4) {
                                                                                                    str99 = xmlPullParser.getText();
                                                                                                } else {
                                                                                                    c(xmlPullParser);
                                                                                                }
                                                                                            } while (!f2.a.i(xmlPullParser4, "Label"));
                                                                                            str75 = str99;
                                                                                        } else if (f2.a.j(xmlPullParser)) {
                                                                                            c(xmlPullParser);
                                                                                        }
                                                                                    }
                                                                                    xmlPullParser5 = xmlPullParser4;
                                                                                    str30 = str71;
                                                                                }
                                                                            }
                                                                            xmlPullParser5 = xmlPullParser4;
                                                                            str30 = str71;
                                                                            arrayList11 = arrayList24;
                                                                        }
                                                                    }
                                                                    xmlPullParser9 = xmlPullParser4;
                                                                    str78 = str18;
                                                                    str18 = str78;
                                                                    i2 = i21;
                                                                    xmlPullParser5 = xmlPullParser9;
                                                                    str30 = str71;
                                                                    arrayList11 = arrayList24;
                                                                    str28 = str23;
                                                                    arrayList10 = arrayList6;
                                                                    str29 = str22;
                                                                    j22 = j21;
                                                                }
                                                            }
                                                            arrayList5 = arrayList21;
                                                            i2 = i21;
                                                            str19 = str79;
                                                            str7 = str55;
                                                            arrayList7 = arrayList25;
                                                            xmlPullParser5 = xmlPullParser9;
                                                            str9 = str63;
                                                            str20 = str68;
                                                            str21 = str69;
                                                            str28 = str74;
                                                            arrayList11 = arrayList24;
                                                            str24 = str76;
                                                            str25 = str77;
                                                            arrayList8 = arrayList23;
                                                            arrayList10 = arrayList26;
                                                            str29 = str73;
                                                            i11 = i19;
                                                            str26 = str17;
                                                            str5 = str53;
                                                            str27 = str70;
                                                            j22 = j31;
                                                            arrayList9 = arrayList27;
                                                            i10 = i20;
                                                            str30 = str71;
                                                        }
                                                    }
                                                    str18 = str78;
                                                    arrayList5 = arrayList21;
                                                    i2 = i21;
                                                    str19 = str79;
                                                    str7 = str55;
                                                    arrayList7 = arrayList25;
                                                    xmlPullParser5 = xmlPullParser9;
                                                    str9 = str63;
                                                    str20 = str68;
                                                    str21 = str69;
                                                    str28 = str74;
                                                    arrayList11 = arrayList24;
                                                    str24 = str76;
                                                    str25 = str77;
                                                    arrayList8 = arrayList23;
                                                    arrayList10 = arrayList26;
                                                    str29 = str73;
                                                    i11 = i19;
                                                    str26 = str17;
                                                    str5 = str53;
                                                    str27 = str70;
                                                    j22 = j31;
                                                    arrayList9 = arrayList27;
                                                    i10 = i20;
                                                    str30 = str71;
                                                }
                                                arrayList6 = arrayList26;
                                                arrayList5 = arrayList21;
                                                str19 = str79;
                                                str7 = str55;
                                                arrayList7 = arrayList25;
                                                str9 = str63;
                                                str20 = str68;
                                                str21 = str69;
                                                str22 = str73;
                                                j21 = j31;
                                                str23 = str74;
                                                str24 = str76;
                                                i10 = i20;
                                                str25 = str77;
                                                arrayList8 = arrayList23;
                                                str5 = str53;
                                                i11 = i19;
                                                str26 = str17;
                                                str27 = str70;
                                                arrayList9 = arrayList27;
                                                str18 = str78;
                                                i2 = i21;
                                                xmlPullParser5 = xmlPullParser9;
                                                str30 = str71;
                                                arrayList11 = arrayList24;
                                                str28 = str23;
                                                arrayList10 = arrayList6;
                                                str29 = str22;
                                                j22 = j21;
                                            }
                                            if (f2.a.i(xmlPullParser5, str30)) {
                                                ArrayList arrayList35 = new ArrayList(arrayList9.size());
                                                int i32 = 0;
                                                while (i32 < arrayList9.size()) {
                                                    a aVar3 = (a) arrayList9.get(i32);
                                                    Format format = aVar3.f13097a;
                                                    if (str75 != null) {
                                                        arrayList15 = arrayList10;
                                                        format = new Format(format.f3962a, str75, format.f3964c, format.f3965d, format.f3966e, format.f3967f, format.f3968g, format.f3969h, format.f3970m, format.f3971n, format.f3972o, format.f3973p, format.q, format.f3974r, format.f3975s, format.f3976t, format.f3977u, format.f3978v, format.f3980x, format.f3979w, format.f3981y, format.f3982z, format.A, format.B, format.C, format.D, format.E, format.F, format.G);
                                                    } else {
                                                        arrayList15 = arrayList10;
                                                    }
                                                    String str100 = aVar3.f13100d;
                                                    if (str100 == null) {
                                                        str100 = str80;
                                                    }
                                                    ArrayList<DrmInitData.SchemeData> arrayList36 = aVar3.f13101e;
                                                    ArrayList arrayList37 = arrayList5;
                                                    arrayList36.addAll(arrayList37);
                                                    if (!arrayList36.isEmpty()) {
                                                        int size = arrayList36.size() - 1;
                                                        while (size >= 0) {
                                                            DrmInitData.SchemeData schemeData = arrayList36.get(size);
                                                            ArrayList arrayList38 = arrayList9;
                                                            if (schemeData.f3991e != null) {
                                                                z13 = true;
                                                            } else {
                                                                z13 = false;
                                                            }
                                                            ArrayList arrayList39 = arrayList37;
                                                            if (!z13) {
                                                                int i33 = 0;
                                                                while (true) {
                                                                    if (i33 < arrayList36.size()) {
                                                                        DrmInitData.SchemeData schemeData2 = arrayList36.get(i33);
                                                                        if (schemeData2.f3991e != null) {
                                                                            z14 = true;
                                                                        } else {
                                                                            z14 = false;
                                                                        }
                                                                        if (z14) {
                                                                            if (schemeData.f3991e != null) {
                                                                                z16 = true;
                                                                            } else {
                                                                                z16 = false;
                                                                            }
                                                                            if (!z16 && schemeData2.a(schemeData.f3988b)) {
                                                                                z15 = true;
                                                                                if (!z15) {
                                                                                    arrayList36.remove(size);
                                                                                } else {
                                                                                    i33++;
                                                                                }
                                                                            }
                                                                        }
                                                                        z15 = false;
                                                                        if (!z15) {
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                            size--;
                                                            arrayList9 = arrayList38;
                                                            arrayList37 = arrayList39;
                                                        }
                                                        arrayList16 = arrayList9;
                                                        arrayList5 = arrayList37;
                                                        format = format.a(new DrmInitData(str100, arrayList36), format.f3968g);
                                                    } else {
                                                        arrayList16 = arrayList9;
                                                        arrayList5 = arrayList37;
                                                    }
                                                    Format format2 = format;
                                                    ArrayList<d> arrayList40 = aVar3.f13102f;
                                                    arrayList40.addAll(arrayList11);
                                                    long j33 = aVar3.f13103g;
                                                    String str101 = aVar3.f13098b;
                                                    j jVar5 = aVar3.f13099c;
                                                    if (jVar5 instanceof j.e) {
                                                        aVar = new i.b(j33, format2, str101, (j.e) jVar5, arrayList40);
                                                    } else if (jVar5 instanceof j.a) {
                                                        aVar = new i.a(j33, format2, str101, (j.a) jVar5, arrayList40);
                                                    } else {
                                                        throw new IllegalArgumentException("segmentBase must be of type SingleSegmentBase or MultiSegmentBase");
                                                    }
                                                    arrayList35.add(aVar);
                                                    i32++;
                                                    arrayList9 = arrayList16;
                                                    arrayList10 = arrayList15;
                                                }
                                                arrayList3.add(new n1.a(l2, i2, arrayList35, arrayList8, arrayList10));
                                                xmlPullParser7 = xmlPullParser;
                                                j20 = j22;
                                                arrayList4 = arrayList20;
                                            } else {
                                                str74 = str28;
                                                str76 = str24;
                                                arrayList27 = arrayList9;
                                                arrayList23 = arrayList8;
                                                arrayList24 = arrayList11;
                                                str71 = str30;
                                                i20 = i10;
                                                str72 = str26;
                                                i19 = i11;
                                                str70 = str27;
                                                str78 = str18;
                                                str63 = str9;
                                                str79 = str19;
                                                str77 = str25;
                                                str68 = str20;
                                                str69 = str21;
                                                arrayList25 = arrayList7;
                                                xmlPullParser9 = xmlPullParser5;
                                                j31 = j22;
                                                str53 = str5;
                                                arrayList21 = arrayList5;
                                                i21 = i2;
                                                str73 = str29;
                                                arrayList26 = arrayList10;
                                                l10 = i;
                                                str55 = str7;
                                            }
                                        }
                                    } else {
                                        str5 = str53;
                                        str6 = str64;
                                        str7 = str55;
                                        XmlPullParser xmlPullParser12 = xmlPullParser7;
                                        str8 = str61;
                                        str9 = str63;
                                        str10 = str60;
                                        ArrayList arrayList41 = arrayList18;
                                        long j34 = j30;
                                        if (f2.a.k(xmlPullParser12, "EventStream")) {
                                            String str102 = str8;
                                            String attributeValue14 = xmlPullParser12.getAttributeValue(null, str102);
                                            if (attributeValue14 == null) {
                                                str12 = "";
                                            } else {
                                                str12 = attributeValue14;
                                            }
                                            String str103 = str10;
                                            String attributeValue15 = xmlPullParser12.getAttributeValue(null, str103);
                                            if (attributeValue15 == null) {
                                                str13 = "";
                                            } else {
                                                str13 = attributeValue15;
                                            }
                                            long m10 = m(xmlPullParser12, "timescale", 1L);
                                            ArrayList arrayList42 = new ArrayList();
                                            ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(512);
                                            while (true) {
                                                xmlPullParser.next();
                                                String str104 = "Event";
                                                if (f2.a.k(xmlPullParser12, "Event")) {
                                                    arrayList3 = arrayList41;
                                                    str8 = str102;
                                                    String str105 = str9;
                                                    long m11 = m(xmlPullParser12, str105, 0L);
                                                    String str106 = str6;
                                                    long m12 = m(xmlPullParser12, str106, -9223372036854775807L);
                                                    j20 = j34;
                                                    long m13 = m(xmlPullParser12, "presentationTime", 0L);
                                                    long A = d0.A(m12, 1000L, m10);
                                                    long A2 = d0.A(m13, 1000000L, m10);
                                                    String attributeValue16 = xmlPullParser12.getAttributeValue(null, "messageData");
                                                    if (attributeValue16 == null) {
                                                        attributeValue16 = null;
                                                    }
                                                    byteArrayOutputStream.reset();
                                                    XmlSerializer newSerializer = Xml.newSerializer();
                                                    str9 = str105;
                                                    newSerializer.setOutput(byteArrayOutputStream, Key.STRING_CHARSET_NAME);
                                                    xmlPullParser.nextToken();
                                                    while (!f2.a.i(xmlPullParser12, str104)) {
                                                        switch (xmlPullParser.getEventType()) {
                                                            case 0:
                                                                str14 = str104;
                                                                str15 = str106;
                                                                str16 = str103;
                                                                newSerializer.startDocument(null, Boolean.FALSE);
                                                                break;
                                                            case 1:
                                                                str14 = str104;
                                                                str15 = str106;
                                                                str16 = str103;
                                                                newSerializer.endDocument();
                                                                break;
                                                            case 2:
                                                                str14 = str104;
                                                                newSerializer.startTag(xmlPullParser.getNamespace(), xmlPullParser.getName());
                                                                int i34 = 0;
                                                                while (i34 < xmlPullParser.getAttributeCount()) {
                                                                    newSerializer.attribute(xmlPullParser12.getAttributeNamespace(i34), xmlPullParser12.getAttributeName(i34), xmlPullParser12.getAttributeValue(i34));
                                                                    i34++;
                                                                    str106 = str106;
                                                                    str103 = str103;
                                                                }
                                                                str15 = str106;
                                                                str16 = str103;
                                                                break;
                                                            case 3:
                                                                str14 = str104;
                                                                newSerializer.endTag(xmlPullParser.getNamespace(), xmlPullParser.getName());
                                                                str15 = str106;
                                                                str16 = str103;
                                                                break;
                                                            case 4:
                                                                newSerializer.text(xmlPullParser.getText());
                                                                str14 = str104;
                                                                str15 = str106;
                                                                str16 = str103;
                                                                break;
                                                            case 5:
                                                                newSerializer.cdsect(xmlPullParser.getText());
                                                                str14 = str104;
                                                                str15 = str106;
                                                                str16 = str103;
                                                                break;
                                                            case 6:
                                                                newSerializer.entityRef(xmlPullParser.getText());
                                                                str14 = str104;
                                                                str15 = str106;
                                                                str16 = str103;
                                                                break;
                                                            case 7:
                                                                newSerializer.ignorableWhitespace(xmlPullParser.getText());
                                                                str14 = str104;
                                                                str15 = str106;
                                                                str16 = str103;
                                                                break;
                                                            case 8:
                                                                newSerializer.processingInstruction(xmlPullParser.getText());
                                                                str14 = str104;
                                                                str15 = str106;
                                                                str16 = str103;
                                                                break;
                                                            case 9:
                                                                newSerializer.comment(xmlPullParser.getText());
                                                                str14 = str104;
                                                                str15 = str106;
                                                                str16 = str103;
                                                                break;
                                                            case 10:
                                                                newSerializer.docdecl(xmlPullParser.getText());
                                                                str14 = str104;
                                                                str15 = str106;
                                                                str16 = str103;
                                                                break;
                                                            default:
                                                                str14 = str104;
                                                                str15 = str106;
                                                                str16 = str103;
                                                                break;
                                                        }
                                                        xmlPullParser.nextToken();
                                                        str104 = str14;
                                                        str106 = str15;
                                                        str103 = str16;
                                                    }
                                                    str6 = str106;
                                                    str10 = str103;
                                                    newSerializer.flush();
                                                    byte[] byteArray = byteArrayOutputStream.toByteArray();
                                                    Long valueOf = Long.valueOf(A2);
                                                    if (attributeValue16 != null) {
                                                        byteArray = d0.q(attributeValue16);
                                                    }
                                                    arrayList42.add(Pair.create(valueOf, new EventMessage(str12, str13, A, m11, byteArray)));
                                                } else {
                                                    j20 = j34;
                                                    arrayList3 = arrayList41;
                                                    str8 = str102;
                                                    str10 = str103;
                                                    c(xmlPullParser);
                                                }
                                                if (f2.a.i(xmlPullParser12, "EventStream")) {
                                                    long[] jArr = new long[arrayList42.size()];
                                                    EventMessage[] eventMessageArr = new EventMessage[arrayList42.size()];
                                                    for (int i35 = 0; i35 < arrayList42.size(); i35++) {
                                                        Pair pair = (Pair) arrayList42.get(i35);
                                                        jArr[i35] = ((Long) pair.first).longValue();
                                                        eventMessageArr[i35] = (EventMessage) pair.second;
                                                    }
                                                    arrayList4 = arrayList20;
                                                    arrayList4.add(new e(str12, str13, jArr, eventMessageArr));
                                                    xmlPullParser7 = xmlPullParser12;
                                                } else {
                                                    str103 = str10;
                                                    str102 = str8;
                                                    arrayList41 = arrayList3;
                                                    j34 = j20;
                                                }
                                            }
                                        } else {
                                            arrayList3 = arrayList41;
                                            arrayList4 = arrayList20;
                                            str64 = str6;
                                            str11 = str9;
                                            if (f2.a.k(xmlPullParser12, "SegmentBase")) {
                                                obj = null;
                                                jVar2 = p(xmlPullParser12, null);
                                                xmlPullParser3 = xmlPullParser;
                                                xmlPullParser2 = xmlPullParser3;
                                                xmlPullParser7 = xmlPullParser12;
                                                j19 = j34;
                                            } else {
                                                obj = null;
                                                if (f2.a.k(xmlPullParser12, "SegmentList")) {
                                                    j19 = j34;
                                                    jVar2 = q(xmlPullParser12, null, j19);
                                                    xmlPullParser3 = xmlPullParser;
                                                    xmlPullParser2 = xmlPullParser3;
                                                    xmlPullParser7 = xmlPullParser12;
                                                } else {
                                                    j19 = j34;
                                                    if (f2.a.k(xmlPullParser12, "SegmentTemplate")) {
                                                        xmlPullParser2 = xmlPullParser;
                                                        jVar2 = r(xmlPullParser2, null, Collections.emptyList(), j19);
                                                    } else {
                                                        xmlPullParser2 = xmlPullParser;
                                                        c(xmlPullParser);
                                                    }
                                                    xmlPullParser7 = xmlPullParser12;
                                                    xmlPullParser3 = xmlPullParser2;
                                                }
                                            }
                                        }
                                    }
                                    xmlPullParser3 = xmlPullParser;
                                    xmlPullParser2 = xmlPullParser3;
                                    str64 = str6;
                                    str11 = str9;
                                    j19 = j20;
                                    obj = null;
                                }
                                str62 = str4;
                                if (!f2.a.i(xmlPullParser7, str62)) {
                                }
                            }
                        } else {
                            j16 = j28;
                            j17 = j26;
                            j18 = x10;
                            z10 = equals;
                            xmlPullParser2 = xmlPullParser6;
                            arrayList = arrayList17;
                            obj = null;
                            c(xmlPullParser);
                        }
                        str52 = str2;
                    }
                }
                str52 = str2;
                j16 = j28;
                j17 = j26;
                j18 = x10;
                z10 = equals;
                xmlPullParser2 = xmlPullParser6;
                arrayList = arrayList17;
                obj = null;
            }
            if (f2.a.i(xmlPullParser7, "MPD")) {
                if (j17 == -9223372036854775807L) {
                    if (j16 != -9223372036854775807L) {
                        j25 = j16;
                        if (arrayList.isEmpty()) {
                            return new b(j18, j25, j15, z10, j14, j11, j12, x11, gVar, lVar, uri, arrayList);
                        }
                        throw new b0("No periods found.");
                    }
                    if (!z10) {
                        throw new b0("Unable to determine duration of static manifest.");
                    }
                }
                j25 = j17;
                if (arrayList.isEmpty()) {
                }
            } else {
                xmlPullParser6 = xmlPullParser2;
                arrayList17 = arrayList;
                j10 = j14;
                j27 = j15;
                x10 = j18;
                j28 = j16;
                j26 = j17;
                equals = z10;
            }
        }
    }
}