TopTV v3.0.1版本的 MD5 值为:0fc1b9ce94885bc92edd11a6ee3e5932

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


package c.f.a.b.e3.e1.p;

import android.net.Uri;
import android.text.TextUtils;
import android.util.Base64;
import android.util.Pair;
import android.util.Xml;
import c.f.a.b.e3.e1.p.k;
import c.f.a.b.i3.i0;
import c.f.a.b.j3.d0;
import c.f.a.b.j3.w0;
import c.f.a.b.j3.x0;
import c.f.a.b.j3.y0;
import c.f.a.b.j3.z;
import c.f.a.b.k1;
import c.f.a.b.w1;
import c.f.a.b.x2.w;
import c.f.b.b.b0;
import c.f.b.b.t;
import com.amazonaws.http.HttpHeader;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import me.zhanghai.android.materialprogressbar.BuildConfig;
import org.simpleframework.xml.strategy.Name;
import org.xml.sax.helpers.DefaultHandler;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlPullParserFactory;
import org.xmlpull.v1.XmlSerializer;
import tv.danmaku.ijk.media.player.IjkMediaMeta;
public class d extends DefaultHandler implements i0.a<c> {
    public static final Pattern f6877b = Pattern.compile("(\\d+)(?:/(\\d+))?");
    public static final Pattern f6878c = Pattern.compile("CC([1-4])=.*");
    public static final Pattern f6879d = Pattern.compile("([1-9]|[1-5][0-9]|6[0-3])=.*");
    public static final int[] f6880e = {-1, 1, 2, 3, 4, 5, 6, 8, 2, 3, 4, 7, 8, 24, 8, 12, 10, 12, 14, 12, 14};
    public final XmlPullParserFactory f6881f;

    public static final class a {
        public final k1 f6882a;
        public final t<b> f6883b;
        public final k f6884c;
        public final String f6885d;
        public final ArrayList<w.b> f6886e;
        public final ArrayList<e> f6887f;
        public final long f6888g;

        public a(k1 k1Var, List<b> list, k kVar, String str, ArrayList<w.b> arrayList, ArrayList<e> arrayList2, long j2) {
            this.f6882a = k1Var;
            this.f6883b = t.D(list);
            this.f6884c = kVar;
            this.f6885d = str;
            this.f6886e = arrayList;
            this.f6887f = arrayList2;
            this.f6888g = j2;
        }
    }

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

    public static int B(List<e> list) {
        String str;
        for (int i2 = 0; i2 < list.size(); i2++) {
            e eVar = list.get(i2);
            if ("urn:scte:dash:cc:cea-608:2015".equals(eVar.f6889a) && (str = eVar.f6890b) != null) {
                Matcher matcher = f6878c.matcher(str);
                if (matcher.matches()) {
                    return Integer.parseInt(matcher.group(1));
                }
                z.i("MpdParser", "Unable to parse CEA-608 channel number from: " + eVar.f6890b);
            }
        }
        return -1;
    }

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

    public static long F(XmlPullParser xmlPullParser, String str, long j2) {
        String attributeValue = xmlPullParser.getAttributeValue(null, str);
        return attributeValue == null ? j2 : x0.I0(attributeValue);
    }

    public static e G(XmlPullParser xmlPullParser, String str) {
        String m0 = m0(xmlPullParser, "schemeIdUri", BuildConfig.FLAVOR);
        String m02 = m0(xmlPullParser, "value", null);
        String m03 = m0(xmlPullParser, Name.MARK, null);
        do {
            xmlPullParser.next();
        } while (!y0.d(xmlPullParser, str));
        return new e(m0, m02, m03);
    }

    public static int H(XmlPullParser xmlPullParser) {
        char c2;
        String attributeValue = xmlPullParser.getAttributeValue(null, "value");
        if (attributeValue == null) {
            return -1;
        }
        String e2 = c.f.b.a.b.e(attributeValue);
        e2.hashCode();
        switch (e2.hashCode()) {
            case 1596796:
                if (e2.equals("4000")) {
                    c2 = 0;
                    break;
                }
                c2 = 65535;
                break;
            case 2937391:
                if (e2.equals("a000")) {
                    c2 = 1;
                    break;
                }
                c2 = 65535;
                break;
            case 3094035:
                if (e2.equals("f801")) {
                    c2 = 2;
                    break;
                }
                c2 = 65535;
                break;
            case 3133436:
                if (e2.equals("fa01")) {
                    c2 = 3;
                    break;
                }
                c2 = 65535;
                break;
            default:
                c2 = 65535;
                break;
        }
        switch (c2) {
            case 0:
                return 1;
            case 1:
                return 2;
            case 2:
                return 6;
            case 3:
                return 8;
            default:
                return -1;
        }
    }

    public static long I(XmlPullParser xmlPullParser, String str, long j2) {
        String attributeValue = xmlPullParser.getAttributeValue(null, str);
        return attributeValue == null ? j2 : x0.J0(attributeValue);
    }

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

    public static float N(XmlPullParser xmlPullParser, String str, float f2) {
        String attributeValue = xmlPullParser.getAttributeValue(null, str);
        return attributeValue == null ? f2 : Float.parseFloat(attributeValue);
    }

    public static float O(XmlPullParser xmlPullParser, float f2) {
        String group;
        String attributeValue = xmlPullParser.getAttributeValue(null, "frameRate");
        if (attributeValue != null) {
            Matcher matcher = f6877b.matcher(attributeValue);
            if (matcher.matches()) {
                int parseInt = Integer.parseInt(matcher.group(1));
                float f3 = parseInt;
                return !TextUtils.isEmpty(matcher.group(2)) ? f3 / Integer.parseInt(group) : f3;
            }
            return f2;
        }
        return f2;
    }

    public static int Q(XmlPullParser xmlPullParser, String str, int i2) {
        String attributeValue = xmlPullParser.getAttributeValue(null, str);
        return attributeValue == null ? i2 : Integer.parseInt(attributeValue);
    }

    public static long S(List<e> list) {
        for (int i2 = 0; i2 < list.size(); i2++) {
            e eVar = list.get(i2);
            if (c.f.b.a.b.a("http://dashif.org/guidelines/last-segment-number", eVar.f6889a)) {
                return Long.parseLong(eVar.f6890b);
            }
        }
        return -1L;
    }

    public static long T(XmlPullParser xmlPullParser, String str, long j2) {
        String attributeValue = xmlPullParser.getAttributeValue(null, str);
        return attributeValue == null ? j2 : Long.parseLong(attributeValue);
    }

    public static int V(XmlPullParser xmlPullParser) {
        int Q = Q(xmlPullParser, "value", -1);
        if (Q >= 0) {
            int[] iArr = f6880e;
            if (Q < iArr.length) {
                return iArr[Q];
            }
            return -1;
        }
        return -1;
    }

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

    public static String n0(XmlPullParser xmlPullParser, String str) {
        String str2 = BuildConfig.FLAVOR;
        do {
            xmlPullParser.next();
            if (xmlPullParser.getEventType() == 4) {
                str2 = xmlPullParser.getText();
            } else {
                u(xmlPullParser);
            }
        } while (!y0.d(xmlPullParser, str));
        return str2;
    }

    public static int p(int i2, int i3) {
        if (i2 == -1) {
            return i3;
        }
        if (i3 == -1) {
            return i2;
        }
        c.f.a.b.j3.g.g(i2 == i3);
        return i2;
    }

    public static String q(String str, String str2) {
        if (str == null) {
            return str2;
        }
        if (str2 == null) {
            return str;
        }
        c.f.a.b.j3.g.g(str.equals(str2));
        return str;
    }

    public static void r(ArrayList<w.b> arrayList) {
        for (int size = arrayList.size() - 1; size >= 0; size--) {
            w.b bVar = arrayList.get(size);
            if (!bVar.d()) {
                int i2 = 0;
                while (true) {
                    if (i2 >= arrayList.size()) {
                        break;
                    } else if (arrayList.get(i2).b(bVar)) {
                        arrayList.remove(size);
                        break;
                    } else {
                        i2++;
                    }
                }
            }
        }
    }

    public static long s(long j2, long j3) {
        if (j3 != -9223372036854775807L) {
            j2 = j3;
        }
        if (j2 == Long.MAX_VALUE) {
            return -9223372036854775807L;
        }
        return j2;
    }

    public static String t(String str, String str2) {
        if (d0.p(str)) {
            return d0.c(str2);
        }
        if (d0.s(str)) {
            return d0.o(str2);
        }
        if (d0.r(str)) {
            return "application/x-rawcc".equals(str) ? d0.j(str2) : str;
        } else if ("application/mp4".equals(str)) {
            String g2 = d0.g(str2);
            return "text/vtt".equals(g2) ? "application/x-mp4-vtt" : g2;
        } else {
            return null;
        }
    }

    public static void u(XmlPullParser xmlPullParser) {
        if (y0.e(xmlPullParser)) {
            int i2 = 1;
            while (i2 != 0) {
                xmlPullParser.next();
                if (y0.e(xmlPullParser)) {
                    i2++;
                } else if (y0.c(xmlPullParser)) {
                    i2--;
                }
            }
        }
    }

    public List<b> A(XmlPullParser xmlPullParser, List<b> list) {
        String attributeValue = xmlPullParser.getAttributeValue(null, "dvb:priority");
        int parseInt = attributeValue != null ? Integer.parseInt(attributeValue) : 1;
        String attributeValue2 = xmlPullParser.getAttributeValue(null, "dvb:weight");
        int parseInt2 = attributeValue2 != null ? Integer.parseInt(attributeValue2) : 1;
        String attributeValue3 = xmlPullParser.getAttributeValue(null, "serviceLocation");
        String n0 = n0(xmlPullParser, "BaseURL");
        if (attributeValue3 == null) {
            attributeValue3 = n0;
        }
        if (w0.b(n0)) {
            return b0.k(new b(n0, attributeValue3, parseInt, parseInt2));
        }
        ArrayList arrayList = new ArrayList();
        for (int i2 = 0; i2 < list.size(); i2++) {
            b bVar = list.get(i2);
            arrayList.add(new b(w0.d(bVar.f6860a, n0), bVar.f6861b, bVar.f6862c, bVar.f6863d));
        }
        return arrayList;
    }

    public Pair<String, w.b> D(XmlPullParser xmlPullParser) {
        String str;
        UUID uuid;
        UUID uuid2;
        byte[] bArr;
        byte[] bArr2;
        String attributeValue = xmlPullParser.getAttributeValue(null, "schemeIdUri");
        if (attributeValue != null) {
            String e2 = c.f.b.a.b.e(attributeValue);
            e2.hashCode();
            char c2 = 65535;
            switch (e2.hashCode()) {
                case 489446379:
                    if (e2.equals("urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95")) {
                        c2 = 0;
                        break;
                    }
                    break;
                case 755418770:
                    if (e2.equals("urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed")) {
                        c2 = 1;
                        break;
                    }
                    break;
                case 1812765994:
                    if (e2.equals("urn:mpeg:dash:mp4protection:2011")) {
                        c2 = 2;
                        break;
                    }
                    break;
            }
            switch (c2) {
                case 0:
                    uuid = c.f.a.b.w0.f9950e;
                    str = null;
                    uuid2 = null;
                    bArr = uuid2;
                    bArr2 = uuid2;
                    break;
                case 1:
                    uuid = c.f.a.b.w0.f9949d;
                    str = null;
                    uuid2 = null;
                    bArr = uuid2;
                    bArr2 = uuid2;
                    break;
                case 2:
                    str = xmlPullParser.getAttributeValue(null, "value");
                    String b2 = y0.b(xmlPullParser, "default_KID");
                    if (!TextUtils.isEmpty(b2) && !"00000000-0000-0000-0000-000000000000".equals(b2)) {
                        String[] split = b2.split("\\s+");
                        UUID[] uuidArr = new UUID[split.length];
                        for (int i2 = 0; i2 < split.length; i2++) {
                            uuidArr[i2] = UUID.fromString(split[i2]);
                        }
                        uuid = c.f.a.b.w0.f9947b;
                        bArr = null;
                        bArr2 = c.f.a.b.z2.j0.l.b(uuid, uuidArr, null);
                        break;
                    } else {
                        uuid = null;
                        uuid2 = uuid;
                        bArr = uuid2;
                        bArr2 = uuid2;
                        break;
                    }
            }
            do {
                xmlPullParser.next();
                if (!y0.f(xmlPullParser, "ms:laurl")) {
                    bArr = xmlPullParser.getAttributeValue(null, "licenseUrl");
                    bArr2 = bArr2;
                } else if (bArr2 == null && y0.g(xmlPullParser, "pssh") && xmlPullParser.next() == 4) {
                    byte[] decode = Base64.decode(xmlPullParser.getText(), 0);
                    UUID f2 = c.f.a.b.z2.j0.l.f(decode);
                    if (f2 == null) {
                        z.i("MpdParser", "Skipping malformed cenc:pssh data");
                        uuid = f2;
                        bArr2 = null;
                    } else {
                        bArr2 = decode;
                        uuid = f2;
                    }
                } else {
                    if (bArr2 == null) {
                        UUID uuid3 = c.f.a.b.w0.f9950e;
                        if (uuid3.equals(uuid) && y0.f(xmlPullParser, "mspr:pro") && xmlPullParser.next() == 4) {
                            bArr2 = c.f.a.b.z2.j0.l.a(uuid3, Base64.decode(xmlPullParser.getText(), 0));
                        }
                    }
                    u(xmlPullParser);
                    bArr2 = bArr2;
                }
            } while (!y0.d(xmlPullParser, "ContentProtection"));
            return Pair.create(str, uuid != null ? new w.b(uuid, bArr, "video/mp4", bArr2) : null);
        }
        str = null;
        uuid = null;
        uuid2 = uuid;
        bArr = uuid2;
        bArr2 = uuid2;
        do {
            xmlPullParser.next();
            if (!y0.f(xmlPullParser, "ms:laurl")) {
            }
        } while (!y0.d(xmlPullParser, "ContentProtection"));
        return Pair.create(str, uuid != null ? new w.b(uuid, bArr, "video/mp4", bArr2) : null);
    }

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

    public Pair<Long, c.f.a.b.b3.j.a> K(XmlPullParser xmlPullParser, String str, String str2, long j2, ByteArrayOutputStream byteArrayOutputStream) {
        long T = T(xmlPullParser, Name.MARK, 0L);
        long T2 = T(xmlPullParser, "duration", -9223372036854775807L);
        long T3 = T(xmlPullParser, "presentationTime", 0L);
        long P0 = x0.P0(T2, 1000L, j2);
        long P02 = x0.P0(T3, 1000000L, j2);
        String m0 = m0(xmlPullParser, "messageData", null);
        byte[] L = L(xmlPullParser, byteArrayOutputStream);
        Long valueOf = Long.valueOf(P02);
        if (m0 != null) {
            L = x0.k0(m0);
        }
        return Pair.create(valueOf, d(str, str2, T, P0, L));
    }

    public byte[] L(XmlPullParser xmlPullParser, ByteArrayOutputStream byteArrayOutputStream) {
        byteArrayOutputStream.reset();
        XmlSerializer newSerializer = Xml.newSerializer();
        newSerializer.setOutput(byteArrayOutputStream, c.f.b.a.d.f15291c.name());
        while (true) {
            xmlPullParser.nextToken();
            if (y0.d(xmlPullParser, "Event")) {
                newSerializer.flush();
                return byteArrayOutputStream.toByteArray();
            }
            switch (xmlPullParser.getEventType()) {
                case 0:
                    newSerializer.startDocument(null, Boolean.FALSE);
                    break;
                case 1:
                    newSerializer.endDocument();
                    break;
                case 2:
                    newSerializer.startTag(xmlPullParser.getNamespace(), xmlPullParser.getName());
                    for (int i2 = 0; i2 < xmlPullParser.getAttributeCount(); i2++) {
                        newSerializer.attribute(xmlPullParser.getAttributeNamespace(i2), xmlPullParser.getAttributeName(i2), xmlPullParser.getAttributeValue(i2));
                    }
                    break;
                case 3:
                    newSerializer.endTag(xmlPullParser.getNamespace(), xmlPullParser.getName());
                    break;
                case 4:
                    newSerializer.text(xmlPullParser.getText());
                    break;
                case 5:
                    newSerializer.cdsect(xmlPullParser.getText());
                    break;
                case 6:
                    newSerializer.entityRef(xmlPullParser.getText());
                    break;
                case 7:
                    newSerializer.ignorableWhitespace(xmlPullParser.getText());
                    break;
                case 8:
                    newSerializer.processingInstruction(xmlPullParser.getText());
                    break;
                case 9:
                    newSerializer.comment(xmlPullParser.getText());
                    break;
                case 10:
                    newSerializer.docdecl(xmlPullParser.getText());
                    break;
            }
        }
    }

    public f M(XmlPullParser xmlPullParser) {
        String m0 = m0(xmlPullParser, "schemeIdUri", BuildConfig.FLAVOR);
        String m02 = m0(xmlPullParser, "value", BuildConfig.FLAVOR);
        long T = T(xmlPullParser, "timescale", 1L);
        ArrayList arrayList = new ArrayList();
        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(IjkMediaMeta.FF_PROFILE_H264_CONSTRAINED);
        do {
            xmlPullParser.next();
            if (y0.f(xmlPullParser, "Event")) {
                arrayList.add(K(xmlPullParser, m0, m02, T, byteArrayOutputStream));
            } else {
                u(xmlPullParser);
            }
        } while (!y0.d(xmlPullParser, "EventStream"));
        long[] jArr = new long[arrayList.size()];
        c.f.a.b.b3.j.a[] aVarArr = new c.f.a.b.b3.j.a[arrayList.size()];
        for (int i2 = 0; i2 < arrayList.size(); i2++) {
            Pair pair = (Pair) arrayList.get(i2);
            jArr[i2] = ((Long) pair.first).longValue();
            aVarArr[i2] = (c.f.a.b.b3.j.a) pair.second;
        }
        return e(m0, m02, T, jArr, aVarArr);
    }

    public i P(XmlPullParser xmlPullParser) {
        return Y(xmlPullParser, "sourceURL", "range");
    }

    public String R(XmlPullParser xmlPullParser) {
        return n0(xmlPullParser, "Label");
    }

    public c U(XmlPullParser xmlPullParser, b bVar) {
        long j2;
        ArrayList arrayList;
        ArrayList arrayList2;
        ArrayList arrayList3;
        Throwable th;
        long j3;
        d dVar = this;
        long F = F(xmlPullParser, "availabilityStartTime", -9223372036854775807L);
        long I = I(xmlPullParser, "mediaPresentationDuration", -9223372036854775807L);
        long I2 = I(xmlPullParser, "minBufferTime", -9223372036854775807L);
        Throwable th2 = null;
        boolean equals = "dynamic".equals(xmlPullParser.getAttributeValue(null, "type"));
        long I3 = equals ? I(xmlPullParser, "minimumUpdatePeriod", -9223372036854775807L) : -9223372036854775807L;
        long I4 = equals ? I(xmlPullParser, "timeShiftBufferDepth", -9223372036854775807L) : -9223372036854775807L;
        long I5 = equals ? I(xmlPullParser, "suggestedPresentationDelay", -9223372036854775807L) : -9223372036854775807L;
        long F2 = F(xmlPullParser, "publishTime", -9223372036854775807L);
        long j4 = equals ? 0L : -9223372036854775807L;
        ArrayList k2 = b0.k(bVar);
        ArrayList arrayList4 = new ArrayList();
        ArrayList arrayList5 = new ArrayList();
        long j5 = equals ? -9223372036854775807L : 0L;
        long j6 = j4;
        h hVar = null;
        o oVar = null;
        Uri uri = null;
        l lVar = null;
        boolean z = false;
        boolean z2 = false;
        while (true) {
            xmlPullParser.next();
            if (y0.f(xmlPullParser, "BaseURL")) {
                if (!z) {
                    j6 = dVar.z(xmlPullParser, j6);
                    z = true;
                }
                arrayList5.addAll(dVar.A(xmlPullParser, k2));
            } else if (y0.f(xmlPullParser, "ProgramInformation")) {
                hVar = X(xmlPullParser);
            } else if (y0.f(xmlPullParser, "UTCTiming")) {
                oVar = q0(xmlPullParser);
            } else if (y0.f(xmlPullParser, HttpHeader.LOCATION)) {
                uri = Uri.parse(xmlPullParser.nextText());
            } else if (y0.f(xmlPullParser, "ServiceDescription")) {
                lVar = l0(xmlPullParser);
            } else {
                if (!y0.f(xmlPullParser, "Period") || z2) {
                    j2 = j6;
                    arrayList = arrayList5;
                    arrayList2 = k2;
                    arrayList3 = arrayList4;
                    th = th2;
                    u(xmlPullParser);
                } else {
                    j2 = j6;
                    arrayList = arrayList5;
                    arrayList2 = k2;
                    ArrayList arrayList6 = arrayList4;
                    Pair<g, Long> W = W(xmlPullParser, !arrayList5.isEmpty() ? arrayList5 : k2, j5, j2, F, I4);
                    g gVar = (g) W.first;
                    if (gVar.f6898b != -9223372036854775807L) {
                        th = null;
                        long longValue = ((Long) W.second).longValue();
                        if (longValue == -9223372036854775807L) {
                            arrayList3 = arrayList6;
                            j5 = -9223372036854775807L;
                        } else {
                            arrayList3 = arrayList6;
                            j5 = gVar.f6898b + longValue;
                        }
                        arrayList3.add(gVar);
                    } else if (!equals) {
                        throw w1.c("Unable to determine start of period " + arrayList6.size(), null);
                    } else {
                        arrayList3 = arrayList6;
                        th = null;
                        z2 = true;
                    }
                }
                j6 = j2;
                if (y0.d(xmlPullParser, "MPD")) {
                    dVar = this;
                    th2 = th;
                    arrayList4 = arrayList3;
                    arrayList5 = arrayList;
                    k2 = arrayList2;
                } else {
                    if (I == -9223372036854775807L) {
                        if (j5 != -9223372036854775807L) {
                            j3 = j5;
                            if (arrayList3.isEmpty()) {
                                return g(F, j3, I2, equals, I3, I4, I5, F2, hVar, oVar, lVar, uri, arrayList3);
                            }
                            throw w1.c("No periods found.", th);
                        } else if (!equals) {
                            throw w1.c("Unable to determine duration of static manifest.", th);
                        }
                    }
                    j3 = I;
                    if (arrayList3.isEmpty()) {
                    }
                }
            }
            arrayList = arrayList5;
            arrayList2 = k2;
            arrayList3 = arrayList4;
            th = th2;
            if (y0.d(xmlPullParser, "MPD")) {
            }
        }
    }

    public Pair<g, Long> W(XmlPullParser xmlPullParser, List<b> list, long j2, long j3, long j4, long j5) {
        long j6;
        ArrayList arrayList;
        ArrayList arrayList2;
        ArrayList arrayList3;
        Object obj;
        long j7;
        k g0;
        d dVar = this;
        Object obj2 = null;
        String attributeValue = xmlPullParser.getAttributeValue(null, Name.MARK);
        long I = I(xmlPullParser, "start", j2);
        long j8 = -9223372036854775807L;
        long j9 = j4 != -9223372036854775807L ? j4 + I : -9223372036854775807L;
        long I2 = I(xmlPullParser, "duration", -9223372036854775807L);
        ArrayList arrayList4 = new ArrayList();
        ArrayList arrayList5 = new ArrayList();
        ArrayList arrayList6 = new ArrayList();
        long j10 = j3;
        long j11 = -9223372036854775807L;
        k.e eVar = null;
        e eVar2 = null;
        boolean z = false;
        while (true) {
            xmlPullParser.next();
            if (y0.f(xmlPullParser, "BaseURL")) {
                if (!z) {
                    j10 = dVar.z(xmlPullParser, j10);
                    z = true;
                }
                arrayList6.addAll(A(xmlPullParser, list));
                arrayList3 = arrayList5;
                arrayList = arrayList6;
                j7 = j8;
                obj = obj2;
                arrayList2 = arrayList4;
            } else {
                if (y0.f(xmlPullParser, "AdaptationSet")) {
                    j6 = j10;
                    arrayList = arrayList6;
                    arrayList2 = arrayList4;
                    arrayList2.add(w(xmlPullParser, !arrayList6.isEmpty() ? arrayList6 : list, eVar, I2, j10, j11, j9, j5));
                    arrayList3 = arrayList5;
                } else {
                    j6 = j10;
                    ArrayList arrayList7 = arrayList5;
                    arrayList = arrayList6;
                    arrayList2 = arrayList4;
                    if (y0.f(xmlPullParser, "EventStream")) {
                        arrayList7.add(M(xmlPullParser));
                        arrayList3 = arrayList7;
                    } else {
                        arrayList3 = arrayList7;
                        if (y0.f(xmlPullParser, "SegmentBase")) {
                            eVar = e0(xmlPullParser, null);
                            obj = null;
                            j10 = j6;
                            j7 = -9223372036854775807L;
                        } else {
                            if (y0.f(xmlPullParser, "SegmentList")) {
                                long z2 = z(xmlPullParser, -9223372036854775807L);
                                obj = null;
                                g0 = f0(xmlPullParser, null, j9, I2, j6, z2, j5);
                                j11 = z2;
                                j10 = j6;
                                j7 = -9223372036854775807L;
                            } else {
                                obj = null;
                                if (y0.f(xmlPullParser, "SegmentTemplate")) {
                                    long z3 = z(xmlPullParser, -9223372036854775807L);
                                    j7 = -9223372036854775807L;
                                    g0 = g0(xmlPullParser, null, t.J(), j9, I2, j6, z3, j5);
                                    j11 = z3;
                                    j10 = j6;
                                } else {
                                    j7 = -9223372036854775807L;
                                    if (y0.f(xmlPullParser, "AssetIdentifier")) {
                                        eVar2 = G(xmlPullParser, "AssetIdentifier");
                                    } else {
                                        u(xmlPullParser);
                                    }
                                    j10 = j6;
                                }
                            }
                            eVar = g0;
                        }
                    }
                }
                obj = null;
                j7 = -9223372036854775807L;
                j10 = j6;
            }
            if (y0.d(xmlPullParser, "Period")) {
                return Pair.create(h(attributeValue, I, arrayList2, arrayList3, eVar2), Long.valueOf(I2));
            }
            arrayList4 = arrayList2;
            arrayList6 = arrayList;
            obj2 = obj;
            arrayList5 = arrayList3;
            j8 = j7;
            dVar = this;
        }
    }

    public h X(XmlPullParser xmlPullParser) {
        String str = null;
        String m0 = m0(xmlPullParser, "moreInformationURL", null);
        String m02 = m0(xmlPullParser, "lang", null);
        String str2 = null;
        String str3 = null;
        while (true) {
            xmlPullParser.next();
            if (y0.f(xmlPullParser, "Title")) {
                str = xmlPullParser.nextText();
            } else if (y0.f(xmlPullParser, "Source")) {
                str2 = xmlPullParser.nextText();
            } else if (y0.f(xmlPullParser, "Copyright")) {
                str3 = xmlPullParser.nextText();
            } else {
                u(xmlPullParser);
            }
            String str4 = str3;
            if (y0.d(xmlPullParser, "ProgramInformation")) {
                return new h(str, str2, str4, m0, m02);
            }
            str3 = str4;
        }
    }

    public i Y(XmlPullParser xmlPullParser, String str, String str2) {
        long j2;
        long j3;
        String attributeValue = xmlPullParser.getAttributeValue(null, str);
        String attributeValue2 = xmlPullParser.getAttributeValue(null, str2);
        if (attributeValue2 != null) {
            String[] split = attributeValue2.split("-");
            j2 = Long.parseLong(split[0]);
            if (split.length == 2) {
                j3 = (Long.parseLong(split[1]) - j2) + 1;
                return i(attributeValue, j2, j3);
            }
        } else {
            j2 = 0;
        }
        j3 = -1;
        return i(attributeValue, j2, j3);
    }

    public a Z(XmlPullParser xmlPullParser, List<b> list, String str, String str2, int i2, int i3, float f2, int i4, int i5, String str3, List<e> list2, List<e> list3, List<e> list4, List<e> list5, k kVar, long j2, long j3, long j4, long j5, long j6) {
        long j7;
        ArrayList arrayList;
        ArrayList arrayList2;
        ArrayList arrayList3;
        ArrayList arrayList4;
        ArrayList arrayList5;
        ArrayList arrayList6;
        ArrayList arrayList7;
        int i6;
        long z;
        k kVar2;
        d dVar = this;
        String attributeValue = xmlPullParser.getAttributeValue(null, Name.MARK);
        int Q = Q(xmlPullParser, "bandwidth", -1);
        String m0 = m0(xmlPullParser, "mimeType", str);
        String m02 = m0(xmlPullParser, "codecs", str2);
        int Q2 = Q(xmlPullParser, "width", i2);
        int Q3 = Q(xmlPullParser, "height", i3);
        float O = O(xmlPullParser, f2);
        int Q4 = Q(xmlPullParser, "audioSamplingRate", i5);
        ArrayList arrayList8 = new ArrayList();
        ArrayList arrayList9 = new ArrayList();
        ArrayList arrayList10 = new ArrayList(list4);
        ArrayList arrayList11 = new ArrayList(list5);
        ArrayList arrayList12 = new ArrayList();
        int i7 = i4;
        long j8 = j4;
        long j9 = j5;
        String str4 = null;
        boolean z2 = false;
        k kVar3 = kVar;
        while (true) {
            xmlPullParser.next();
            if (y0.f(xmlPullParser, "BaseURL")) {
                if (!z2) {
                    j8 = dVar.z(xmlPullParser, j8);
                    z2 = true;
                }
                arrayList12.addAll(A(xmlPullParser, list));
            } else if (y0.f(xmlPullParser, "AudioChannelConfiguration")) {
                kVar2 = kVar3;
                arrayList = arrayList12;
                arrayList5 = arrayList8;
                i6 = y(xmlPullParser);
                arrayList6 = arrayList9;
                arrayList7 = arrayList11;
                if (y0.d(xmlPullParser, "Representation")) {
                    break;
                }
                arrayList11 = arrayList7;
                arrayList9 = arrayList6;
                arrayList8 = arrayList5;
                kVar3 = kVar2;
                dVar = this;
                i7 = i6;
                arrayList12 = arrayList;
            } else if (y0.f(xmlPullParser, "SegmentBase")) {
                kVar3 = dVar.e0(xmlPullParser, (k.e) kVar3);
            } else {
                if (y0.f(xmlPullParser, "SegmentList")) {
                    z = dVar.z(xmlPullParser, j9);
                    j7 = j8;
                    arrayList = arrayList12;
                    arrayList2 = arrayList11;
                    arrayList3 = arrayList9;
                    arrayList4 = arrayList10;
                    kVar3 = f0(xmlPullParser, (k.b) kVar3, j2, j3, j7, z, j6);
                    arrayList5 = arrayList8;
                } else {
                    j7 = j8;
                    arrayList = arrayList12;
                    arrayList2 = arrayList11;
                    arrayList3 = arrayList9;
                    arrayList4 = arrayList10;
                    if (y0.f(xmlPullParser, "SegmentTemplate")) {
                        z = dVar.z(xmlPullParser, j9);
                        arrayList5 = arrayList8;
                        kVar3 = g0(xmlPullParser, (k.c) kVar3, list5, j2, j3, j7, z, j6);
                    } else {
                        arrayList5 = arrayList8;
                        if (y0.f(xmlPullParser, "ContentProtection")) {
                            Pair<String, w.b> D = D(xmlPullParser);
                            Object obj = D.first;
                            if (obj != null) {
                                str4 = (String) obj;
                            }
                            Object obj2 = D.second;
                            if (obj2 != null) {
                                arrayList5.add(obj2);
                            }
                            i6 = i7;
                            j8 = j7;
                            arrayList7 = arrayList2;
                            arrayList6 = arrayList3;
                            arrayList10 = arrayList4;
                            kVar2 = kVar3;
                            if (y0.d(xmlPullParser, "Representation")) {
                            }
                        } else {
                            if (y0.f(xmlPullParser, "InbandEventStream")) {
                                arrayList6 = arrayList3;
                                arrayList6.add(G(xmlPullParser, "InbandEventStream"));
                                arrayList7 = arrayList2;
                                arrayList10 = arrayList4;
                            } else {
                                arrayList6 = arrayList3;
                                if (y0.f(xmlPullParser, "EssentialProperty")) {
                                    arrayList10 = arrayList4;
                                    arrayList10.add(G(xmlPullParser, "EssentialProperty"));
                                    arrayList7 = arrayList2;
                                } else {
                                    arrayList10 = arrayList4;
                                    if (y0.f(xmlPullParser, "SupplementalProperty")) {
                                        arrayList7 = arrayList2;
                                        arrayList7.add(G(xmlPullParser, "SupplementalProperty"));
                                    } else {
                                        arrayList7 = arrayList2;
                                        u(xmlPullParser);
                                    }
                                }
                            }
                            i6 = i7;
                            j8 = j7;
                            kVar2 = kVar3;
                            if (y0.d(xmlPullParser, "Representation")) {
                            }
                        }
                    }
                }
                i6 = i7;
                j9 = z;
                j8 = j7;
                arrayList7 = arrayList2;
                arrayList6 = arrayList3;
                arrayList10 = arrayList4;
                kVar2 = kVar3;
                if (y0.d(xmlPullParser, "Representation")) {
                }
            }
            arrayList = arrayList12;
            arrayList5 = arrayList8;
            i6 = i7;
            kVar2 = kVar3;
            arrayList6 = arrayList9;
            arrayList7 = arrayList11;
            if (y0.d(xmlPullParser, "Representation")) {
            }
        }
        ArrayList arrayList13 = arrayList6;
        k1 f3 = f(attributeValue, m0, Q2, Q3, O, i6, Q4, Q, str3, list2, list3, m02, arrayList10, arrayList7);
        k.e eVar = kVar2;
        if (kVar2 == null) {
            eVar = new k.e();
        }
        boolean isEmpty = arrayList.isEmpty();
        ArrayList arrayList14 = arrayList;
        if (isEmpty) {
            arrayList14 = list;
        }
        return new a(f3, arrayList14, eVar, str4, arrayList5, arrayList13, -1L);
    }

    public int a0(List<e> list) {
        int o0;
        int i2 = 0;
        for (int i3 = 0; i3 < list.size(); i3++) {
            e eVar = list.get(i3);
            if (c.f.b.a.b.a("urn:mpeg:dash:role:2011", eVar.f6889a)) {
                o0 = b0(eVar.f6890b);
            } else if (c.f.b.a.b.a("urn:tva:metadata:cs:AudioPurposeCS:2007", eVar.f6889a)) {
                o0 = o0(eVar.f6890b);
            }
            i2 |= o0;
        }
        return i2;
    }

    public final long b(List<k.d> list, long j2, long j3, int i2, long j4) {
        int l2 = i2 >= 0 ? i2 + 1 : (int) x0.l(j4 - j2, j3);
        for (int i3 = 0; i3 < l2; i3++) {
            list.add(m(j2, j3));
            j2 += j3;
        }
        return j2;
    }

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

    public c.f.a.b.e3.e1.p.a c(int i2, int i3, List<j> list, List<e> list2, List<e> list3, List<e> list4) {
        return new c.f.a.b.e3.e1.p.a(i2, i3, list, list2, list3, list4);
    }

    public int c0(List<e> list) {
        int i2 = 0;
        for (int i3 = 0; i3 < list.size(); i3++) {
            if (c.f.b.a.b.a("http://dashif.org/guidelines/trickmode", list.get(i3).f6889a)) {
                i2 |= 16384;
            }
        }
        return i2;
    }

    public c.f.a.b.b3.j.a d(String str, String str2, long j2, long j3, byte[] bArr) {
        return new c.f.a.b.b3.j.a(str, str2, j3, j2, bArr);
    }

    public int d0(List<e> list) {
        int i2 = 0;
        for (int i3 = 0; i3 < list.size(); i3++) {
            e eVar = list.get(i3);
            if (c.f.b.a.b.a("urn:mpeg:dash:role:2011", eVar.f6889a)) {
                i2 |= b0(eVar.f6890b);
            }
        }
        return i2;
    }

    public f e(String str, String str2, long j2, long[] jArr, c.f.a.b.b3.j.a[] aVarArr) {
        return new f(str, str2, j2, jArr, aVarArr);
    }

    public k.e e0(XmlPullParser xmlPullParser, k.e eVar) {
        long j2;
        long j3;
        long T = T(xmlPullParser, "timescale", eVar != null ? eVar.f6924b : 1L);
        long T2 = T(xmlPullParser, "presentationTimeOffset", eVar != null ? eVar.f6925c : 0L);
        long j4 = eVar != null ? eVar.f6938d : 0L;
        long j5 = eVar != null ? eVar.f6939e : 0L;
        String attributeValue = xmlPullParser.getAttributeValue(null, "indexRange");
        if (attributeValue != null) {
            String[] split = attributeValue.split("-");
            long parseLong = Long.parseLong(split[0]);
            j2 = (Long.parseLong(split[1]) - parseLong) + 1;
            j3 = parseLong;
        } else {
            j2 = j5;
            j3 = j4;
        }
        i iVar = eVar != null ? eVar.f6923a : null;
        do {
            xmlPullParser.next();
            if (y0.f(xmlPullParser, "Initialization")) {
                iVar = P(xmlPullParser);
            } else {
                u(xmlPullParser);
            }
        } while (!y0.d(xmlPullParser, "SegmentBase"));
        return n(iVar, T, T2, j3, j2);
    }

    public k1 f(String str, String str2, int i2, int i3, float f2, int i4, int i5, int i6, String str3, List<e> list, List<e> list2, String str4, List<e> list3, List<e> list4) {
        String str5 = str4;
        String t = t(str2, str5);
        if ("audio/eac3".equals(t)) {
            t = J(list4);
            if ("audio/eac3-joc".equals(t)) {
                str5 = "ec+3";
            }
        }
        int k0 = k0(list);
        k1.b V = new k1.b().S(str).K(str2).e0(t).I(str5).Z(i6).g0(k0).c0(d0(list) | a0(list2) | c0(list3) | c0(list4)).V(str3);
        if (d0.s(t)) {
            V.j0(i2).Q(i3).P(f2);
        } else if (d0.p(t)) {
            V.H(i4).f0(i5);
        } else if (d0.r(t)) {
            int i7 = -1;
            if ("application/cea-608".equals(t)) {
                i7 = B(list2);
            } else if ("application/cea-708".equals(t)) {
                i7 = C(list2);
            }
            V.F(i7);
        }
        return V.E();
    }

    public k.b f0(XmlPullParser xmlPullParser, k.b bVar, long j2, long j3, long j4, long j5, long j6) {
        long T = T(xmlPullParser, "timescale", bVar != null ? bVar.f6924b : 1L);
        long T2 = T(xmlPullParser, "presentationTimeOffset", bVar != null ? bVar.f6925c : 0L);
        long T3 = T(xmlPullParser, "duration", bVar != null ? bVar.f6927e : -9223372036854775807L);
        long T4 = T(xmlPullParser, "startNumber", bVar != null ? bVar.f6926d : 1L);
        long s = s(j4, j5);
        List<k.d> list = null;
        List<i> list2 = null;
        i iVar = null;
        do {
            xmlPullParser.next();
            if (y0.f(xmlPullParser, "Initialization")) {
                iVar = P(xmlPullParser);
            } else if (y0.f(xmlPullParser, "SegmentTimeline")) {
                list = h0(xmlPullParser, T, j3);
            } else if (y0.f(xmlPullParser, "SegmentURL")) {
                if (list2 == null) {
                    list2 = new ArrayList<>();
                }
                list2.add(i0(xmlPullParser));
            } else {
                u(xmlPullParser);
            }
        } while (!y0.d(xmlPullParser, "SegmentList"));
        if (bVar != null) {
            if (iVar == null) {
                iVar = bVar.f6923a;
            }
            if (list == null) {
                list = bVar.f6928f;
            }
            if (list2 == null) {
                list2 = bVar.f6932j;
            }
        }
        return k(iVar, T, T2, T4, T3, list, s, list2, j6, j2);
    }

    public c g(long j2, long j3, long j4, boolean z, long j5, long j6, long j7, long j8, h hVar, o oVar, l lVar, Uri uri, List<g> list) {
        return new c(j2, j3, j4, z, j5, j6, j7, j8, hVar, oVar, lVar, uri, list);
    }

    public k.c g0(XmlPullParser xmlPullParser, k.c cVar, List<e> list, long j2, long j3, long j4, long j5, long j6) {
        long T = T(xmlPullParser, "timescale", cVar != null ? cVar.f6924b : 1L);
        long T2 = T(xmlPullParser, "presentationTimeOffset", cVar != null ? cVar.f6925c : 0L);
        long T3 = T(xmlPullParser, "duration", cVar != null ? cVar.f6927e : -9223372036854775807L);
        long T4 = T(xmlPullParser, "startNumber", cVar != null ? cVar.f6926d : 1L);
        long S = S(list);
        long s = s(j4, j5);
        List<k.d> list2 = null;
        n p0 = p0(xmlPullParser, "media", cVar != null ? cVar.f6934k : null);
        n p02 = p0(xmlPullParser, "initialization", cVar != null ? cVar.f6933j : null);
        i iVar = null;
        while (true) {
            xmlPullParser.next();
            if (y0.f(xmlPullParser, "Initialization")) {
                iVar = P(xmlPullParser);
            } else if (y0.f(xmlPullParser, "SegmentTimeline")) {
                list2 = h0(xmlPullParser, T, j3);
            } else {
                u(xmlPullParser);
            }
            if (y0.d(xmlPullParser, "SegmentTemplate")) {
                break;
            }
        }
        if (cVar != null) {
            if (iVar == null) {
                iVar = cVar.f6923a;
            }
            if (list2 == null) {
                list2 = cVar.f6928f;
            }
        }
        return l(iVar, T, T2, T4, S, T3, list2, s, p02, p0, j6, j2);
    }

    public g h(String str, long j2, List<c.f.a.b.e3.e1.p.a> list, List<f> list2, e eVar) {
        return new g(str, j2, list, list2, eVar);
    }

    public List<k.d> h0(XmlPullParser xmlPullParser, long j2, long j3) {
        ArrayList arrayList = new ArrayList();
        long j4 = 0;
        long j5 = -9223372036854775807L;
        boolean z = false;
        int i2 = 0;
        do {
            xmlPullParser.next();
            if (y0.f(xmlPullParser, "S")) {
                long T = T(xmlPullParser, "t", -9223372036854775807L);
                if (z) {
                    j4 = b(arrayList, j4, j5, i2, T);
                }
                if (T == -9223372036854775807L) {
                    T = j4;
                }
                j5 = T(xmlPullParser, "d", -9223372036854775807L);
                i2 = Q(xmlPullParser, "r", 0);
                j4 = T;
                z = true;
            } else {
                u(xmlPullParser);
            }
        } while (!y0.d(xmlPullParser, "SegmentTimeline"));
        if (z) {
            b(arrayList, j4, j5, i2, x0.P0(j3, j2, 1000L));
        }
        return arrayList;
    }

    public i i(String str, long j2, long j3) {
        return new i(str, j2, j3);
    }

    public i i0(XmlPullParser xmlPullParser) {
        return Y(xmlPullParser, "media", "mediaRange");
    }

    public j j(a aVar, String str, String str2, ArrayList<w.b> arrayList, ArrayList<e> arrayList2) {
        k1.b b2 = aVar.f6882a.b();
        if (str != null) {
            b2.U(str);
        }
        String str3 = aVar.f6885d;
        if (str3 != null) {
            str2 = str3;
        }
        ArrayList<w.b> arrayList3 = aVar.f6886e;
        arrayList3.addAll(arrayList);
        if (!arrayList3.isEmpty()) {
            r(arrayList3);
            b2.L(new w(str2, arrayList3));
        }
        ArrayList<e> arrayList4 = aVar.f6887f;
        arrayList4.addAll(arrayList2);
        return j.o(aVar.f6888g, b2.E(), aVar.f6883b, aVar.f6884c, arrayList4);
    }

    public int j0(String str) {
        if (str == null) {
            return 0;
        }
        if (str.equals("forced_subtitle")) {
            return 2;
        }
        return !str.equals("main") ? 0 : 1;
    }

    public k.b k(i iVar, long j2, long j3, long j4, long j5, List<k.d> list, long j6, List<i> list2, long j7, long j8) {
        return new k.b(iVar, j2, j3, j4, j5, list, j6, list2, c.f.a.b.w0.d(j7), c.f.a.b.w0.d(j8));
    }

    public int k0(List<e> list) {
        int i2 = 0;
        for (int i3 = 0; i3 < list.size(); i3++) {
            e eVar = list.get(i3);
            if (c.f.b.a.b.a("urn:mpeg:dash:role:2011", eVar.f6889a)) {
                i2 |= j0(eVar.f6890b);
            }
        }
        return i2;
    }

    public k.c l(i iVar, long j2, long j3, long j4, long j5, long j6, List<k.d> list, long j7, n nVar, n nVar2, long j8, long j9) {
        return new k.c(iVar, j2, j3, j4, j5, j6, list, j7, nVar, nVar2, c.f.a.b.w0.d(j8), c.f.a.b.w0.d(j9));
    }

    public l l0(XmlPullParser xmlPullParser) {
        long j2 = -9223372036854775807L;
        long j3 = -9223372036854775807L;
        long j4 = -9223372036854775807L;
        float f2 = -3.4028235E38f;
        float f3 = -3.4028235E38f;
        while (true) {
            xmlPullParser.next();
            if (y0.f(xmlPullParser, "Latency")) {
                j2 = T(xmlPullParser, "target", -9223372036854775807L);
                j3 = T(xmlPullParser, "min", -9223372036854775807L);
                j4 = T(xmlPullParser, "max", -9223372036854775807L);
            } else if (y0.f(xmlPullParser, "PlaybackRate")) {
                f2 = N(xmlPullParser, "min", -3.4028235E38f);
                f3 = N(xmlPullParser, "max", -3.4028235E38f);
            }
            long j5 = j2;
            long j6 = j3;
            long j7 = j4;
            float f4 = f2;
            float f5 = f3;
            if (y0.d(xmlPullParser, "ServiceDescription")) {
                return new l(j5, j6, j7, f4, f5);
            }
            j2 = j5;
            j3 = j6;
            j4 = j7;
            f2 = f4;
            f3 = f5;
        }
    }

    public k.d m(long j2, long j3) {
        return new k.d(j2, j3);
    }

    public k.e n(i iVar, long j2, long j3, long j4, long j5) {
        return new k.e(iVar, j2, j3, j4, j5);
    }

    public o o(String str, String str2) {
        return new o(str, str2);
    }

    public int o0(String str) {
        if (str == null) {
            return 0;
        }
        char c2 = 65535;
        switch (str.hashCode()) {
            case 49:
                if (str.equals("1")) {
                    c2 = 0;
                    break;
                }
                break;
            case 50:
                if (str.equals("2")) {
                    c2 = 1;
                    break;
                }
                break;
            case 51:
                if (str.equals("3")) {
                    c2 = 2;
                    break;
                }
                break;
            case 52:
                if (str.equals("4")) {
                    c2 = 3;
                    break;
                }
                break;
            case 54:
                if (str.equals("6")) {
                    c2 = 4;
                    break;
                }
                break;
        }
        switch (c2) {
            case 0:
                return IjkMediaMeta.FF_PROFILE_H264_CONSTRAINED;
            case 1:
                return 2048;
            case 2:
                return 4;
            case 3:
                return 8;
            case 4:
                return 1;
            default:
                return 0;
        }
    }

    public n p0(XmlPullParser xmlPullParser, String str, n nVar) {
        String attributeValue = xmlPullParser.getAttributeValue(null, str);
        return attributeValue != null ? n.b(attributeValue) : nVar;
    }

    public o q0(XmlPullParser xmlPullParser) {
        return o(xmlPullParser.getAttributeValue(null, "schemeIdUri"), xmlPullParser.getAttributeValue(null, "value"));
    }

    @Override
    public c a(Uri uri, InputStream inputStream) {
        try {
            XmlPullParser newPullParser = this.f6881f.newPullParser();
            newPullParser.setInput(inputStream, null);
            if (newPullParser.next() == 2 && "MPD".equals(newPullParser.getName())) {
                return U(newPullParser, new b(uri.toString()));
            }
            throw w1.c("inputStream does not contain a valid media presentation description", null);
        } catch (XmlPullParserException e2) {
            throw w1.c(null, e2);
        }
    }

    public c.f.a.b.e3.e1.p.a w(XmlPullParser xmlPullParser, List<b> list, k kVar, long j2, long j3, long j4, long j5, long j6) {
        String str;
        long j7;
        ArrayList arrayList;
        ArrayList arrayList2;
        ArrayList arrayList3;
        ArrayList arrayList4;
        ArrayList arrayList5;
        ArrayList<w.b> arrayList6;
        String str2;
        Object obj;
        ArrayList arrayList7;
        int i2;
        ArrayList<e> arrayList8;
        long z;
        String str3;
        d dVar = this;
        XmlPullParser xmlPullParser2 = xmlPullParser;
        int Q = Q(xmlPullParser2, Name.MARK, -1);
        int E = E(xmlPullParser);
        String attributeValue = xmlPullParser2.getAttributeValue(null, "mimeType");
        String attributeValue2 = xmlPullParser2.getAttributeValue(null, "codecs");
        int Q2 = Q(xmlPullParser2, "width", -1);
        int Q3 = Q(xmlPullParser2, "height", -1);
        float O = O(xmlPullParser2, -1.0f);
        int Q4 = Q(xmlPullParser2, "audioSamplingRate", -1);
        String str4 = "lang";
        String attributeValue3 = xmlPullParser2.getAttributeValue(null, "lang");
        String attributeValue4 = xmlPullParser2.getAttributeValue(null, "label");
        ArrayList<w.b> arrayList9 = new ArrayList<>();
        ArrayList<e> arrayList10 = new ArrayList<>();
        ArrayList arrayList11 = new ArrayList();
        ArrayList arrayList12 = new ArrayList();
        ArrayList arrayList13 = new ArrayList();
        ArrayList arrayList14 = new ArrayList();
        ArrayList arrayList15 = new ArrayList();
        ArrayList arrayList16 = new ArrayList();
        k.e eVar = kVar;
        int i3 = E;
        String str5 = attributeValue3;
        String str6 = attributeValue4;
        String str7 = null;
        int i4 = -1;
        boolean z2 = false;
        long j8 = j3;
        long j9 = j4;
        while (true) {
            xmlPullParser.next();
            if (y0.f(xmlPullParser2, "BaseURL")) {
                if (!z2) {
                    j8 = dVar.z(xmlPullParser2, j8);
                    z2 = true;
                }
                arrayList16.addAll(A(xmlPullParser, list));
            } else if (y0.f(xmlPullParser2, "ContentProtection")) {
                Pair<String, w.b> D = D(xmlPullParser);
                long j10 = j9;
                Object obj2 = D.first;
                if (obj2 != null) {
                    str7 = (String) obj2;
                }
                ?? r0 = D.second;
                if (r0 != 0) {
                    arrayList9.add(r0);
                }
                j9 = j10;
            } else {
                long j11 = j9;
                if (y0.f(xmlPullParser2, "ContentComponent")) {
                    String q = q(str5, xmlPullParser2.getAttributeValue(null, str4));
                    i3 = p(i3, E(xmlPullParser));
                    j7 = j8;
                    arrayList = arrayList16;
                    arrayList7 = arrayList15;
                    arrayList2 = arrayList14;
                    arrayList3 = arrayList13;
                    arrayList4 = arrayList12;
                    arrayList5 = arrayList11;
                    arrayList8 = arrayList10;
                    arrayList6 = arrayList9;
                    str2 = str4;
                    obj = null;
                    str3 = q;
                } else {
                    int i5 = i3;
                    String str8 = str5;
                    if (y0.f(xmlPullParser2, "Role")) {
                        arrayList12.add(G(xmlPullParser2, "Role"));
                    } else if (y0.f(xmlPullParser2, "AudioChannelConfiguration")) {
                        i4 = y(xmlPullParser);
                        j7 = j8;
                        arrayList = arrayList16;
                        arrayList2 = arrayList14;
                        arrayList3 = arrayList13;
                        arrayList4 = arrayList12;
                        arrayList5 = arrayList11;
                        arrayList8 = arrayList10;
                        arrayList6 = arrayList9;
                        str2 = str4;
                        obj = null;
                        i3 = i5;
                        str3 = str8;
                        arrayList7 = arrayList15;
                    } else if (y0.f(xmlPullParser2, "Accessibility")) {
                        arrayList11.add(G(xmlPullParser2, "Accessibility"));
                    } else if (y0.f(xmlPullParser2, "EssentialProperty")) {
                        arrayList13.add(G(xmlPullParser2, "EssentialProperty"));
                    } else if (y0.f(xmlPullParser2, "SupplementalProperty")) {
                        arrayList14.add(G(xmlPullParser2, "SupplementalProperty"));
                    } else if (y0.f(xmlPullParser2, "Representation")) {
                        j7 = j8;
                        arrayList = arrayList16;
                        arrayList2 = arrayList14;
                        arrayList3 = arrayList13;
                        arrayList4 = arrayList12;
                        arrayList5 = arrayList11;
                        arrayList6 = arrayList9;
                        str2 = str4;
                        obj = null;
                        a Z = Z(xmlPullParser, !arrayList16.isEmpty() ? arrayList16 : list, attributeValue, attributeValue2, Q2, Q3, O, i4, Q4, str8, arrayList4, arrayList5, arrayList3, arrayList2, eVar, j5, j2, j7, j11, j6);
                        int p = p(i5, d0.l(Z.f6882a.f8980m));
                        arrayList7 = arrayList15;
                        arrayList7.add(Z);
                        xmlPullParser2 = xmlPullParser;
                        str3 = str8;
                        arrayList8 = arrayList10;
                        i3 = p;
                    } else {
                        str = str8;
                        j7 = j8;
                        arrayList = arrayList16;
                        arrayList2 = arrayList14;
                        arrayList3 = arrayList13;
                        arrayList4 = arrayList12;
                        arrayList5 = arrayList11;
                        ArrayList<e> arrayList17 = arrayList10;
                        arrayList6 = arrayList9;
                        str2 = str4;
                        obj = null;
                        arrayList7 = arrayList15;
                        if (y0.f(xmlPullParser, "SegmentBase")) {
                            eVar = e0(xmlPullParser, (k.e) eVar);
                            str3 = str;
                            arrayList8 = arrayList17;
                            j9 = j11;
                            i3 = i5;
                            xmlPullParser2 = xmlPullParser;
                            if (!y0.d(xmlPullParser2, "AdaptationSet")) {
                                break;
                            }
                            arrayList10 = arrayList8;
                            arrayList15 = arrayList7;
                            arrayList16 = arrayList;
                            arrayList14 = arrayList2;
                            arrayList13 = arrayList3;
                            arrayList12 = arrayList4;
                            arrayList11 = arrayList5;
                            arrayList9 = arrayList6;
                            str4 = str2;
                            dVar = this;
                            str5 = str3;
                            j8 = j7;
                        } else {
                            if (y0.f(xmlPullParser, "SegmentList")) {
                                z = z(xmlPullParser, j11);
                                i2 = i5;
                                eVar = f0(xmlPullParser, (k.b) eVar, j5, j2, j7, z, j6);
                                xmlPullParser2 = xmlPullParser;
                            } else {
                                j9 = j11;
                                i2 = i5;
                                if (y0.f(xmlPullParser, "SegmentTemplate")) {
                                    z = z(xmlPullParser, j9);
                                    xmlPullParser2 = xmlPullParser;
                                    eVar = g0(xmlPullParser, (k.c) eVar, arrayList2, j5, j2, j7, z, j6);
                                } else {
                                    xmlPullParser2 = xmlPullParser;
                                    if (y0.f(xmlPullParser2, "InbandEventStream")) {
                                        arrayList8 = arrayList17;
                                        arrayList8.add(G(xmlPullParser2, "InbandEventStream"));
                                    } else {
                                        arrayList8 = arrayList17;
                                        if (y0.f(xmlPullParser2, "Label")) {
                                            str6 = R(xmlPullParser);
                                        } else if (y0.e(xmlPullParser)) {
                                            x(xmlPullParser);
                                        }
                                    }
                                    str3 = str;
                                    i3 = i2;
                                    eVar = eVar;
                                    if (!y0.d(xmlPullParser2, "AdaptationSet")) {
                                    }
                                }
                            }
                            j9 = z;
                            str3 = str;
                            arrayList8 = arrayList17;
                            i3 = i2;
                            eVar = eVar;
                            if (!y0.d(xmlPullParser2, "AdaptationSet")) {
                            }
                        }
                    }
                    str = str8;
                    j7 = j8;
                    arrayList = arrayList16;
                    arrayList2 = arrayList14;
                    arrayList3 = arrayList13;
                    arrayList4 = arrayList12;
                    arrayList5 = arrayList11;
                    arrayList8 = arrayList10;
                    arrayList6 = arrayList9;
                    str2 = str4;
                    obj = null;
                    i2 = i5;
                    j9 = j11;
                    arrayList7 = arrayList15;
                    str3 = str;
                    i3 = i2;
                    eVar = eVar;
                    if (!y0.d(xmlPullParser2, "AdaptationSet")) {
                    }
                }
                j9 = j11;
                eVar = eVar;
                if (!y0.d(xmlPullParser2, "AdaptationSet")) {
                }
            }
            j7 = j8;
            arrayList7 = arrayList15;
            arrayList2 = arrayList14;
            arrayList3 = arrayList13;
            arrayList4 = arrayList12;
            arrayList5 = arrayList11;
            arrayList8 = arrayList10;
            arrayList6 = arrayList9;
            str2 = str4;
            str3 = str5;
            obj = null;
            arrayList = arrayList16;
            eVar = eVar;
            if (!y0.d(xmlPullParser2, "AdaptationSet")) {
            }
        }
        ArrayList arrayList18 = new ArrayList(arrayList7.size());
        for (int i6 = 0; i6 < arrayList7.size(); i6++) {
            arrayList18.add(j((a) arrayList7.get(i6), str6, str7, arrayList6, arrayList8));
        }
        return c(Q, i3, arrayList18, arrayList5, arrayList3, arrayList2);
    }

    public void x(XmlPullParser xmlPullParser) {
        u(xmlPullParser);
    }

    public int y(XmlPullParser xmlPullParser) {
        char c2;
        String m0 = m0(xmlPullParser, "schemeIdUri", null);
        m0.hashCode();
        int i2 = -1;
        switch (m0.hashCode()) {
            case -1352850286:
                if (m0.equals("urn:mpeg:dash:23003:3:audio_channel_configuration:2011")) {
                    c2 = 0;
                    break;
                }
                c2 = 65535;
                break;
            case -1138141449:
                if (m0.equals("tag:dolby.com,2014:dash:audio_channel_configuration:2011")) {
                    c2 = 1;
                    break;
                }
                c2 = 65535;
                break;
            case -986633423:
                if (m0.equals("urn:mpeg:mpegB:cicp:ChannelConfiguration")) {
                    c2 = 2;
                    break;
                }
                c2 = 65535;
                break;
            case 2036691300:
                if (m0.equals("urn:dolby:dash:audio_channel_configuration:2011")) {
                    c2 = 3;
                    break;
                }
                c2 = 65535;
                break;
            default:
                c2 = 65535;
                break;
        }
        switch (c2) {
            case 0:
                i2 = Q(xmlPullParser, "value", -1);
                break;
            case 1:
            case 3:
                i2 = H(xmlPullParser);
                break;
            case 2:
                i2 = V(xmlPullParser);
                break;
        }
        do {
            xmlPullParser.next();
        } while (!y0.d(xmlPullParser, "AudioChannelConfiguration"));
        return i2;
    }

    public long z(XmlPullParser xmlPullParser, long j2) {
        String attributeValue = xmlPullParser.getAttributeValue(null, "availabilityTimeOffset");
        if (attributeValue == null) {
            return j2;
        }
        if ("INF".equals(attributeValue)) {
            return Long.MAX_VALUE;
        }
        return Float.parseFloat(attributeValue) * 1000000.0f;
    }
}