MEGA STAR IPTV v3.4版本的 MD5 值为:f68c82adeb6c1166a42c50cbe0c3cfa6

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


package y3;

import android.net.Uri;
import android.text.TextUtils;
import android.util.Base64;
import android.util.Pair;
import android.util.Xml;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
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 me.jessyan.autosize.BuildConfig;
import org.videolan.libvlc.MediaList;
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 s4.e0;
import u4.l0;
import u4.o;
import u4.p0;
import u4.q0;
import u4.r;
import v2.g0;
import v2.n0;
import y3.j;
import z2.k;
public class c extends DefaultHandler implements e0.a<b> {
    private static final Pattern f12840b = Pattern.compile("(\\d+)(?:/(\\d+))?");
    private static final Pattern f12841c = Pattern.compile("CC([1-4])=.*");
    private static final Pattern f12842d = Pattern.compile("([1-9]|[1-5][0-9]|6[0-3])=.*");
    private final XmlPullParserFactory f12843a;

    public static final class a {
        public final g0 f12844a;
        public final String f12845b;
        public final j f12846c;
        public final String f12847d;
        public final ArrayList<k.b> f12848e;
        public final ArrayList<d> f12849f;
        public final long f12850g;

        public a(g0 g0Var, String str, j jVar, String str2, ArrayList<k.b> arrayList, ArrayList<d> arrayList2, long j9) {
            this.f12844a = g0Var;
            this.f12845b = str;
            this.f12846c = jVar;
            this.f12847d = str2;
            this.f12848e = arrayList;
            this.f12849f = arrayList2;
            this.f12850g = j9;
        }
    }

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

    protected static int B(List<d> list) {
        String str;
        for (int i9 = 0; i9 < list.size(); i9++) {
            d dVar = list.get(i9);
            if ("urn:scte:dash:cc:cea-608:2015".equals(dVar.f12851a) && (str = dVar.f12852b) != null) {
                Matcher matcher = f12841c.matcher(str);
                if (matcher.matches()) {
                    return Integer.parseInt(matcher.group(1));
                }
                o.h("MpdParser", "Unable to parse CEA-608 channel number from: " + dVar.f12852b);
            }
        }
        return -1;
    }

    protected static int C(List<d> list) {
        String str;
        for (int i9 = 0; i9 < list.size(); i9++) {
            d dVar = list.get(i9);
            if ("urn:scte:dash:cc:cea-708:2015".equals(dVar.f12851a) && (str = dVar.f12852b) != null) {
                Matcher matcher = f12842d.matcher(str);
                if (matcher.matches()) {
                    return Integer.parseInt(matcher.group(1));
                }
                o.h("MpdParser", "Unable to parse CEA-708 service block number from: " + dVar.f12852b);
            }
        }
        return -1;
    }

    protected static long G(XmlPullParser xmlPullParser, String str, long j9) throws n0 {
        String attributeValue = xmlPullParser.getAttributeValue(null, str);
        return attributeValue == null ? j9 : p0.u0(attributeValue);
    }

    protected static d H(XmlPullParser xmlPullParser, String str) throws XmlPullParserException, IOException {
        String i02 = i0(xmlPullParser, "schemeIdUri", BuildConfig.FLAVOR);
        String i03 = i0(xmlPullParser, "value", null);
        String i04 = i0(xmlPullParser, "id", null);
        do {
            xmlPullParser.next();
        } while (!q0.d(xmlPullParser, str));
        return new d(i02, i03, i04);
    }

    protected static int I(XmlPullParser xmlPullParser) {
        char c9;
        String L0 = p0.L0(xmlPullParser.getAttributeValue(null, "value"));
        if (L0 == null) {
            return -1;
        }
        switch (L0.hashCode()) {
            case 1596796:
                if (L0.equals("4000")) {
                    c9 = 0;
                    break;
                }
                c9 = 65535;
                break;
            case 2937391:
                if (L0.equals("a000")) {
                    c9 = 1;
                    break;
                }
                c9 = 65535;
                break;
            case 3094035:
                if (L0.equals("f801")) {
                    c9 = 2;
                    break;
                }
                c9 = 65535;
                break;
            case 3133436:
                if (L0.equals("fa01")) {
                    c9 = 3;
                    break;
                }
                c9 = 65535;
                break;
            default:
                c9 = 65535;
                break;
        }
        switch (c9) {
            case 0:
                return 1;
            case 1:
                return 2;
            case 2:
                return 6;
            case 3:
                return 8;
            default:
                return -1;
        }
    }

    protected static long J(XmlPullParser xmlPullParser, String str, long j9) {
        String attributeValue = xmlPullParser.getAttributeValue(null, str);
        return attributeValue == null ? j9 : p0.v0(attributeValue);
    }

    protected static String K(List<d> list) {
        for (int i9 = 0; i9 < list.size(); i9++) {
            d dVar = list.get(i9);
            String str = dVar.f12851a;
            if ("tag:dolby.com,2018:dash:EC3_ExtensionType:2018".equals(str) && "JOC".equals(dVar.f12852b)) {
                return "audio/eac3-joc";
            }
            if ("tag:dolby.com,2014:dash:DolbyDigitalPlusExtensionType:2014".equals(str) && "ec+3".equals(dVar.f12852b)) {
                return "audio/eac3-joc";
            }
        }
        return "audio/eac3";
    }

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

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

    protected static long S(List<d> list) {
        for (int i9 = 0; i9 < list.size(); i9++) {
            d dVar = list.get(i9);
            if ("http://dashif.org/guidelines/last-segment-number".equalsIgnoreCase(dVar.f12851a)) {
                return Long.parseLong(dVar.f12852b);
            }
        }
        return -1L;
    }

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

    private long b(List<j.d> list, long j9, long j10, int i9, long j11) {
        int k9 = i9 >= 0 ? i9 + 1 : (int) p0.k(j11 - j9, j10);
        for (int i10 = 0; i10 < k9; i10++) {
            list.add(m(j9, j10));
            j9 += j10;
        }
        return j9;
    }

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

    protected static String j0(XmlPullParser xmlPullParser, String str) throws XmlPullParserException, IOException {
        String str2 = BuildConfig.FLAVOR;
        do {
            xmlPullParser.next();
            if (xmlPullParser.getEventType() == 4) {
                str2 = xmlPullParser.getText();
            } else {
                u(xmlPullParser);
            }
        } while (!q0.d(xmlPullParser, str));
        return str2;
    }

    private static int p(int i9, int i10) {
        if (i9 == -1) {
            return i10;
        }
        if (i10 == -1) {
            return i9;
        }
        u4.a.f(i9 == i10);
        return i9;
    }

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

    private static void r(ArrayList<k.b> arrayList) {
        for (int size = arrayList.size() - 1; size >= 0; size--) {
            k.b bVar = arrayList.get(size);
            if (!bVar.o()) {
                int i9 = 0;
                while (true) {
                    if (i9 >= arrayList.size()) {
                        break;
                    } else if (arrayList.get(i9).j(bVar)) {
                        arrayList.remove(size);
                        break;
                    } else {
                        i9++;
                    }
                }
            }
        }
    }

    private static String t(String str, String str2) {
        if (r.l(str)) {
            return r.b(str2);
        }
        if (r.n(str)) {
            return r.k(str2);
        }
        if (v(str)) {
            return str;
        }
        if ("application/mp4".equals(str)) {
            if (str2 != null) {
                if (str2.startsWith("stpp")) {
                    return "application/ttml+xml";
                }
                if (str2.startsWith("wvtt")) {
                    return "application/x-mp4-vtt";
                }
            }
        } else if ("application/x-rawcc".equals(str) && str2 != null) {
            if (str2.contains("cea708")) {
                return "application/cea-708";
            }
            if (str2.contains("eia608") || str2.contains("cea608")) {
                return "application/cea-608";
            }
        }
        return null;
    }

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

    private static boolean v(String str) {
        return r.m(str) || "application/ttml+xml".equals(str) || "application/x-mp4-vtt".equals(str) || "application/cea-708".equals(str) || "application/cea-608".equals(str);
    }

    protected String A(XmlPullParser xmlPullParser, String str) throws XmlPullParserException, IOException {
        return l0.c(str, j0(xmlPullParser, "BaseURL"));
    }

    protected Pair<String, k.b> D(XmlPullParser xmlPullParser) throws XmlPullParserException, IOException {
        String str;
        UUID uuid;
        UUID uuid2;
        byte[] bArr;
        byte[] bArr2;
        String attributeValue = xmlPullParser.getAttributeValue(null, "schemeIdUri");
        if (attributeValue != null) {
            String L0 = p0.L0(attributeValue);
            L0.hashCode();
            char c9 = 65535;
            switch (L0.hashCode()) {
                case 489446379:
                    if (L0.equals("urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95")) {
                        c9 = 0;
                        break;
                    }
                    break;
                case 755418770:
                    if (L0.equals("urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed")) {
                        c9 = 1;
                        break;
                    }
                    break;
                case 1812765994:
                    if (L0.equals("urn:mpeg:dash:mp4protection:2011")) {
                        c9 = 2;
                        break;
                    }
                    break;
            }
            switch (c9) {
                case 0:
                    uuid = v2.h.f11572e;
                    str = null;
                    uuid2 = null;
                    bArr = uuid2;
                    bArr2 = uuid2;
                    break;
                case 1:
                    uuid = v2.h.f11571d;
                    str = null;
                    uuid2 = null;
                    bArr = uuid2;
                    bArr2 = uuid2;
                    break;
                case 2:
                    str = xmlPullParser.getAttributeValue(null, "value");
                    String b10 = q0.b(xmlPullParser, "default_KID");
                    if (!TextUtils.isEmpty(b10) && !"00000000-0000-0000-0000-000000000000".equals(b10)) {
                        String[] split = b10.split("\\s+");
                        UUID[] uuidArr = new UUID[split.length];
                        for (int i9 = 0; i9 < split.length; i9++) {
                            uuidArr[i9] = UUID.fromString(split[i9]);
                        }
                        uuid = v2.h.f11569b;
                        bArr = null;
                        bArr2 = g3.k.b(uuid, uuidArr, null);
                        break;
                    } else {
                        uuid = null;
                        uuid2 = uuid;
                        bArr = uuid2;
                        bArr2 = uuid2;
                        break;
                    }
            }
            do {
                xmlPullParser.next();
                if (!q0.f(xmlPullParser, "ms:laurl")) {
                    bArr = xmlPullParser.getAttributeValue(null, "licenseUrl");
                    bArr2 = bArr2;
                } else if (bArr2 == null && q0.g(xmlPullParser, "pssh") && xmlPullParser.next() == 4) {
                    byte[] decode = Base64.decode(xmlPullParser.getText(), 0);
                    UUID d9 = g3.k.d(decode);
                    if (d9 == null) {
                        o.h("MpdParser", "Skipping malformed cenc:pssh data");
                        uuid = d9;
                        bArr2 = null;
                    } else {
                        bArr2 = decode;
                        uuid = d9;
                    }
                } else {
                    if (bArr2 == null) {
                        UUID uuid3 = v2.h.f11572e;
                        if (uuid3.equals(uuid) && q0.f(xmlPullParser, "mspr:pro") && xmlPullParser.next() == 4) {
                            bArr2 = g3.k.a(uuid3, Base64.decode(xmlPullParser.getText(), 0));
                        }
                    }
                    u(xmlPullParser);
                    bArr2 = bArr2;
                }
            } while (!q0.d(xmlPullParser, "ContentProtection"));
            return Pair.create(str, uuid != null ? new k.b(uuid, bArr, "video/mp4", bArr2) : null);
        }
        str = null;
        uuid = null;
        uuid2 = uuid;
        bArr = uuid2;
        bArr2 = uuid2;
        do {
            xmlPullParser.next();
            if (!q0.f(xmlPullParser, "ms:laurl")) {
            }
        } while (!q0.d(xmlPullParser, "ContentProtection"));
        return Pair.create(str, uuid != null ? new k.b(uuid, bArr, "video/mp4", bArr2) : null);
    }

    protected 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;
    }

    protected int F(String str) {
        if (str == null) {
            return 0;
        }
        char c9 = 65535;
        switch (str.hashCode()) {
            case -2060497896:
                if (str.equals("subtitle")) {
                    c9 = 0;
                    break;
                }
                break;
            case -1724546052:
                if (str.equals("description")) {
                    c9 = 1;
                    break;
                }
                break;
            case -1580883024:
                if (str.equals("enhanced-audio-intelligibility")) {
                    c9 = 2;
                    break;
                }
                break;
            case -1408024454:
                if (str.equals("alternate")) {
                    c9 = 3;
                    break;
                }
                break;
            case 99825:
                if (str.equals("dub")) {
                    c9 = 4;
                    break;
                }
                break;
            case 3343801:
                if (str.equals("main")) {
                    c9 = 5;
                    break;
                }
                break;
            case 3530173:
                if (str.equals("sign")) {
                    c9 = 6;
                    break;
                }
                break;
            case 552573414:
                if (str.equals("caption")) {
                    c9 = 7;
                    break;
                }
                break;
            case 899152809:
                if (str.equals("commentary")) {
                    c9 = '\b';
                    break;
                }
                break;
            case 1629013393:
                if (str.equals("emergency")) {
                    c9 = '\t';
                    break;
                }
                break;
            case 1855372047:
                if (str.equals("supplementary")) {
                    c9 = '\n';
                    break;
                }
                break;
        }
        switch (c9) {
            case 0:
                return 128;
            case 1:
                return MediaList.Event.ItemAdded;
            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;
        }
    }

    protected Pair<Long, n3.a> L(XmlPullParser xmlPullParser, String str, String str2, long j9, ByteArrayOutputStream byteArrayOutputStream) throws IOException, XmlPullParserException {
        long T = T(xmlPullParser, "id", 0L);
        long T2 = T(xmlPullParser, "duration", -9223372036854775807L);
        long T3 = T(xmlPullParser, "presentationTime", 0L);
        long z02 = p0.z0(T2, 1000L, j9);
        long z03 = p0.z0(T3, 1000000L, j9);
        String i02 = i0(xmlPullParser, "messageData", null);
        byte[] M = M(xmlPullParser, byteArrayOutputStream);
        Long valueOf = Long.valueOf(z03);
        if (i02 != null) {
            M = p0.c0(i02);
        }
        return Pair.create(valueOf, d(str, str2, T, z02, M));
    }

    protected byte[] M(XmlPullParser xmlPullParser, ByteArrayOutputStream byteArrayOutputStream) throws XmlPullParserException, IOException {
        byteArrayOutputStream.reset();
        XmlSerializer newSerializer = Xml.newSerializer();
        newSerializer.setOutput(byteArrayOutputStream, "UTF-8");
        while (true) {
            xmlPullParser.nextToken();
            if (q0.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 i9 = 0; i9 < xmlPullParser.getAttributeCount(); i9++) {
                        newSerializer.attribute(xmlPullParser.getAttributeNamespace(i9), xmlPullParser.getAttributeName(i9), xmlPullParser.getAttributeValue(i9));
                    }
                    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;
            }
        }
    }

    protected e N(XmlPullParser xmlPullParser) throws XmlPullParserException, IOException {
        String i02 = i0(xmlPullParser, "schemeIdUri", BuildConfig.FLAVOR);
        String i03 = i0(xmlPullParser, "value", BuildConfig.FLAVOR);
        long T = T(xmlPullParser, "timescale", 1L);
        ArrayList arrayList = new ArrayList();
        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(MediaList.Event.ItemAdded);
        do {
            xmlPullParser.next();
            if (q0.f(xmlPullParser, "Event")) {
                arrayList.add(L(xmlPullParser, i02, i03, T, byteArrayOutputStream));
            } else {
                u(xmlPullParser);
            }
        } while (!q0.d(xmlPullParser, "EventStream"));
        long[] jArr = new long[arrayList.size()];
        n3.a[] aVarArr = new n3.a[arrayList.size()];
        for (int i9 = 0; i9 < arrayList.size(); i9++) {
            Pair pair = (Pair) arrayList.get(i9);
            jArr[i9] = ((Long) pair.first).longValue();
            aVarArr[i9] = (n3.a) pair.second;
        }
        return e(i02, i03, T, jArr, aVarArr);
    }

    protected h P(XmlPullParser xmlPullParser) {
        return X(xmlPullParser, "sourceURL", "range");
    }

    protected String R(XmlPullParser xmlPullParser) throws XmlPullParserException, IOException {
        return j0(xmlPullParser, "Label");
    }

    protected b U(XmlPullParser xmlPullParser, String str) throws XmlPullParserException, IOException {
        String str2;
        long j9;
        c cVar = this;
        long G = G(xmlPullParser, "availabilityStartTime", -9223372036854775807L);
        long J = J(xmlPullParser, "mediaPresentationDuration", -9223372036854775807L);
        long J2 = J(xmlPullParser, "minBufferTime", -9223372036854775807L);
        boolean equals = "dynamic".equals(xmlPullParser.getAttributeValue(null, "type"));
        long J3 = equals ? J(xmlPullParser, "minimumUpdatePeriod", -9223372036854775807L) : -9223372036854775807L;
        long J4 = equals ? J(xmlPullParser, "timeShiftBufferDepth", -9223372036854775807L) : -9223372036854775807L;
        long J5 = equals ? J(xmlPullParser, "suggestedPresentationDelay", -9223372036854775807L) : -9223372036854775807L;
        long G2 = G(xmlPullParser, "publishTime", -9223372036854775807L);
        ArrayList arrayList = new ArrayList();
        Uri uri = null;
        long j10 = equals ? -9223372036854775807L : 0L;
        boolean z9 = false;
        boolean z10 = false;
        String str3 = str;
        g gVar = null;
        m mVar = null;
        while (true) {
            xmlPullParser.next();
            long j11 = J4;
            if (q0.f(xmlPullParser, "BaseURL")) {
                if (z9) {
                    str2 = str3;
                    j9 = j10;
                    str3 = str2;
                    j10 = j9;
                } else {
                    str3 = cVar.A(xmlPullParser, str3);
                    z9 = true;
                }
            } else if (q0.f(xmlPullParser, "ProgramInformation")) {
                gVar = W(xmlPullParser);
            } else if (q0.f(xmlPullParser, "UTCTiming")) {
                mVar = m0(xmlPullParser);
            } else if (q0.f(xmlPullParser, "Location")) {
                uri = Uri.parse(xmlPullParser.nextText());
            } else if (!q0.f(xmlPullParser, "Period") || z10) {
                str2 = str3;
                j9 = j10;
                u(xmlPullParser);
                str3 = str2;
                j10 = j9;
            } else {
                Pair<f, Long> V = cVar.V(xmlPullParser, str3, j10);
                String str4 = str3;
                f fVar = (f) V.first;
                long j12 = j10;
                if (fVar.f12860b != -9223372036854775807L) {
                    long longValue = ((Long) V.second).longValue();
                    j10 = longValue == -9223372036854775807L ? -9223372036854775807L : fVar.f12860b + longValue;
                    arrayList.add(fVar);
                } else if (!equals) {
                    throw new n0("Unable to determine start of period " + arrayList.size());
                } else {
                    j10 = j12;
                    z10 = true;
                }
                str3 = str4;
            }
            if (q0.d(xmlPullParser, "MPD")) {
                if (J == -9223372036854775807L) {
                    if (j10 != -9223372036854775807L) {
                        J = j10;
                    } else if (!equals) {
                        throw new n0("Unable to determine duration of static manifest.");
                    }
                }
                if (arrayList.isEmpty()) {
                    throw new n0("No periods found.");
                }
                return g(G, J, J2, equals, J3, j11, J5, G2, gVar, mVar, uri, arrayList);
            }
            cVar = this;
            J4 = j11;
        }
    }

    protected Pair<f, Long> V(XmlPullParser xmlPullParser, String str, long j9) throws XmlPullParserException, IOException {
        String str2;
        String attributeValue = xmlPullParser.getAttributeValue(null, "id");
        long J = J(xmlPullParser, "start", j9);
        long J2 = J(xmlPullParser, "duration", -9223372036854775807L);
        ArrayList arrayList = new ArrayList();
        ArrayList arrayList2 = new ArrayList();
        String str3 = str;
        j jVar = null;
        d dVar = null;
        boolean z9 = false;
        do {
            xmlPullParser.next();
            if (q0.f(xmlPullParser, "BaseURL")) {
                if (z9) {
                    str2 = str3;
                } else {
                    str3 = A(xmlPullParser, str3);
                    z9 = true;
                }
            } else if (q0.f(xmlPullParser, "AdaptationSet")) {
                str2 = str3;
                arrayList.add(x(xmlPullParser, str3, jVar, J2));
            } else {
                str2 = str3;
                if (q0.f(xmlPullParser, "EventStream")) {
                    arrayList2.add(N(xmlPullParser));
                } else if (q0.f(xmlPullParser, "SegmentBase")) {
                    jVar = c0(xmlPullParser, null);
                } else if (q0.f(xmlPullParser, "SegmentList")) {
                    jVar = d0(xmlPullParser, null, J2);
                } else if (q0.f(xmlPullParser, "SegmentTemplate")) {
                    jVar = e0(xmlPullParser, null, Collections.emptyList(), J2);
                } else if (q0.f(xmlPullParser, "AssetIdentifier")) {
                    dVar = H(xmlPullParser, "AssetIdentifier");
                } else {
                    u(xmlPullParser);
                }
            }
            str3 = str2;
        } while (!q0.d(xmlPullParser, "Period"));
        return Pair.create(h(attributeValue, J, arrayList, arrayList2, dVar), Long.valueOf(J2));
    }

    protected g W(XmlPullParser xmlPullParser) throws IOException, XmlPullParserException {
        String str = null;
        String i02 = i0(xmlPullParser, "moreInformationURL", null);
        String i03 = i0(xmlPullParser, "lang", null);
        String str2 = null;
        String str3 = null;
        while (true) {
            xmlPullParser.next();
            if (q0.f(xmlPullParser, "Title")) {
                str = xmlPullParser.nextText();
            } else if (q0.f(xmlPullParser, "Source")) {
                str2 = xmlPullParser.nextText();
            } else if (q0.f(xmlPullParser, "Copyright")) {
                str3 = xmlPullParser.nextText();
            } else {
                u(xmlPullParser);
            }
            String str4 = str3;
            if (q0.d(xmlPullParser, "ProgramInformation")) {
                return new g(str, str2, str4, i02, i03);
            }
            str3 = str4;
        }
    }

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

    protected a Y(XmlPullParser xmlPullParser, String str, String str2, String str3, int i9, int i10, float f9, int i11, int i12, String str4, List<d> list, List<d> list2, List<d> list3, List<d> list4, j jVar, long j9) throws XmlPullParserException, IOException {
        int i13;
        int i14;
        String str5;
        j e02;
        int i15;
        String str6;
        String attributeValue = xmlPullParser.getAttributeValue(null, "id");
        int Q = Q(xmlPullParser, "bandwidth", -1);
        String i02 = i0(xmlPullParser, "mimeType", str2);
        String i03 = i0(xmlPullParser, "codecs", str3);
        int Q2 = Q(xmlPullParser, "width", i9);
        int Q3 = Q(xmlPullParser, "height", i10);
        float O = O(xmlPullParser, f9);
        int Q4 = Q(xmlPullParser, "audioSamplingRate", i12);
        ArrayList arrayList = new ArrayList();
        ArrayList arrayList2 = new ArrayList();
        ArrayList arrayList3 = new ArrayList(list3);
        ArrayList arrayList4 = new ArrayList(list4);
        int i16 = i11;
        j.e eVar = jVar;
        String str7 = null;
        boolean z9 = false;
        String str8 = str;
        while (true) {
            xmlPullParser.next();
            if (q0.f(xmlPullParser, "BaseURL")) {
                if (z9) {
                    str5 = str8;
                    i13 = Q4;
                    i14 = Q;
                    i15 = i16;
                    str6 = str5;
                    if (!q0.d(xmlPullParser, "Representation")) {
                    }
                } else {
                    str8 = A(xmlPullParser, str8);
                    i13 = Q4;
                    i14 = Q;
                    i15 = i16;
                    z9 = true;
                    eVar = eVar;
                    str6 = str8;
                    if (!q0.d(xmlPullParser, "Representation")) {
                        break;
                    }
                    Q4 = i13;
                    str8 = str6;
                    Q = i14;
                    i16 = i15;
                }
            } else if (q0.f(xmlPullParser, "AudioChannelConfiguration")) {
                i15 = z(xmlPullParser);
                str6 = str8;
                i13 = Q4;
                i14 = Q;
                if (!q0.d(xmlPullParser, "Representation")) {
                }
            } else if (q0.f(xmlPullParser, "SegmentBase")) {
                i13 = Q4;
                i14 = Q;
                eVar = c0(xmlPullParser, (j.e) eVar);
                i15 = i16;
                str6 = str8;
                if (!q0.d(xmlPullParser, "Representation")) {
                }
            } else {
                if (q0.f(xmlPullParser, "SegmentList")) {
                    i13 = Q4;
                    i14 = Q;
                    e02 = d0(xmlPullParser, (j.b) eVar, j9);
                } else {
                    i13 = Q4;
                    i14 = Q;
                    if (q0.f(xmlPullParser, "SegmentTemplate")) {
                        e02 = e0(xmlPullParser, (j.c) eVar, list4, j9);
                    } else {
                        if (q0.f(xmlPullParser, "ContentProtection")) {
                            Pair<String, k.b> D = D(xmlPullParser);
                            str5 = str8;
                            Object obj = D.first;
                            if (obj != null) {
                                str7 = (String) obj;
                            }
                            Object obj2 = D.second;
                            if (obj2 != null) {
                                arrayList.add((k.b) obj2);
                            }
                        } else {
                            str5 = str8;
                            if (q0.f(xmlPullParser, "InbandEventStream")) {
                                arrayList2.add(H(xmlPullParser, "InbandEventStream"));
                            } else if (q0.f(xmlPullParser, "EssentialProperty")) {
                                arrayList3.add(H(xmlPullParser, "EssentialProperty"));
                            } else if (q0.f(xmlPullParser, "SupplementalProperty")) {
                                arrayList4.add(H(xmlPullParser, "SupplementalProperty"));
                            } else {
                                u(xmlPullParser);
                            }
                        }
                        i15 = i16;
                        str6 = str5;
                        if (!q0.d(xmlPullParser, "Representation")) {
                        }
                    }
                }
                eVar = e02;
                i15 = i16;
                str6 = str8;
                if (!q0.d(xmlPullParser, "Representation")) {
                }
            }
        }
        return new a(f(attributeValue, i02, Q2, Q3, O, i15, i13, i14, str4, list, list2, i03, arrayList3, arrayList4), str6, eVar != null ? eVar : new j.e(), str7, arrayList, arrayList2, -1L);
    }

    protected int Z(List<d> list) {
        int k02;
        int i9 = 0;
        for (int i10 = 0; i10 < list.size(); i10++) {
            d dVar = list.get(i10);
            if ("urn:mpeg:dash:role:2011".equalsIgnoreCase(dVar.f12851a)) {
                k02 = F(dVar.f12852b);
            } else if ("urn:tva:metadata:cs:AudioPurposeCS:2007".equalsIgnoreCase(dVar.f12851a)) {
                k02 = k0(dVar.f12852b);
            }
            i9 |= k02;
        }
        return i9;
    }

    protected int a0(List<d> list) {
        int i9 = 0;
        for (int i10 = 0; i10 < list.size(); i10++) {
            if ("http://dashif.org/guidelines/trickmode".equalsIgnoreCase(list.get(i10).f12851a)) {
                i9 |= 16384;
            }
        }
        return i9;
    }

    protected int b0(List<d> list) {
        int i9 = 0;
        for (int i10 = 0; i10 < list.size(); i10++) {
            d dVar = list.get(i10);
            if ("urn:mpeg:dash:role:2011".equalsIgnoreCase(dVar.f12851a)) {
                i9 |= F(dVar.f12852b);
            }
        }
        return i9;
    }

    protected y3.a c(int i9, int i10, List<i> list, List<d> list2, List<d> list3, List<d> list4) {
        return new y3.a(i9, i10, list, list2, list3, list4);
    }

    protected j.e c0(XmlPullParser xmlPullParser, j.e eVar) throws XmlPullParserException, IOException {
        long j9;
        long j10;
        long T = T(xmlPullParser, "timescale", eVar != null ? eVar.f12886b : 1L);
        long T2 = T(xmlPullParser, "presentationTimeOffset", eVar != null ? eVar.f12887c : 0L);
        long j11 = eVar != null ? eVar.f12897d : 0L;
        long j12 = eVar != null ? eVar.f12898e : 0L;
        String attributeValue = xmlPullParser.getAttributeValue(null, "indexRange");
        if (attributeValue != null) {
            String[] split = attributeValue.split("-");
            long parseLong = Long.parseLong(split[0]);
            j9 = (Long.parseLong(split[1]) - parseLong) + 1;
            j10 = parseLong;
        } else {
            j9 = j12;
            j10 = j11;
        }
        h hVar = eVar != null ? eVar.f12885a : null;
        do {
            xmlPullParser.next();
            if (q0.f(xmlPullParser, "Initialization")) {
                hVar = P(xmlPullParser);
            } else {
                u(xmlPullParser);
            }
        } while (!q0.d(xmlPullParser, "SegmentBase"));
        return n(hVar, T, T2, j10, j9);
    }

    protected n3.a d(String str, String str2, long j9, long j10, byte[] bArr) {
        return new n3.a(str, str2, j10, j9, bArr);
    }

    protected j.b d0(XmlPullParser xmlPullParser, j.b bVar, long j9) throws XmlPullParserException, IOException {
        long T = T(xmlPullParser, "timescale", bVar != null ? bVar.f12886b : 1L);
        long T2 = T(xmlPullParser, "presentationTimeOffset", bVar != null ? bVar.f12887c : 0L);
        long T3 = T(xmlPullParser, "duration", bVar != null ? bVar.f12889e : -9223372036854775807L);
        long T4 = T(xmlPullParser, "startNumber", bVar != null ? bVar.f12888d : 1L);
        List<j.d> list = null;
        List<h> list2 = null;
        h hVar = null;
        do {
            xmlPullParser.next();
            if (q0.f(xmlPullParser, "Initialization")) {
                hVar = P(xmlPullParser);
            } else if (q0.f(xmlPullParser, "SegmentTimeline")) {
                list = f0(xmlPullParser, T, j9);
            } else if (q0.f(xmlPullParser, "SegmentURL")) {
                if (list2 == null) {
                    list2 = new ArrayList<>();
                }
                list2.add(g0(xmlPullParser));
            } else {
                u(xmlPullParser);
            }
        } while (!q0.d(xmlPullParser, "SegmentList"));
        if (bVar != null) {
            if (hVar == null) {
                hVar = bVar.f12885a;
            }
            if (list == null) {
                list = bVar.f12890f;
            }
            if (list2 == null) {
                list2 = bVar.f12891g;
            }
        }
        return k(hVar, T, T2, T4, T3, list, list2);
    }

    protected e e(String str, String str2, long j9, long[] jArr, n3.a[] aVarArr) {
        return new e(str, str2, j9, jArr, aVarArr);
    }

    protected j.c e0(XmlPullParser xmlPullParser, j.c cVar, List<d> list, long j9) throws XmlPullParserException, IOException {
        long T = T(xmlPullParser, "timescale", cVar != null ? cVar.f12886b : 1L);
        long T2 = T(xmlPullParser, "presentationTimeOffset", cVar != null ? cVar.f12887c : 0L);
        long T3 = T(xmlPullParser, "duration", cVar != null ? cVar.f12889e : -9223372036854775807L);
        long T4 = T(xmlPullParser, "startNumber", cVar != null ? cVar.f12888d : 1L);
        long S = S(list);
        List<j.d> list2 = null;
        l l02 = l0(xmlPullParser, "media", cVar != null ? cVar.f12893h : null);
        l l03 = l0(xmlPullParser, "initialization", cVar != null ? cVar.f12892g : null);
        h hVar = null;
        do {
            xmlPullParser.next();
            if (q0.f(xmlPullParser, "Initialization")) {
                hVar = P(xmlPullParser);
            } else if (q0.f(xmlPullParser, "SegmentTimeline")) {
                list2 = f0(xmlPullParser, T, j9);
            } else {
                u(xmlPullParser);
            }
        } while (!q0.d(xmlPullParser, "SegmentTemplate"));
        if (cVar != null) {
            if (hVar == null) {
                hVar = cVar.f12885a;
            }
            if (list2 == null) {
                list2 = cVar.f12890f;
            }
        }
        return l(hVar, T, T2, T4, S, T3, list2, l03, l02);
    }

    protected g0 f(String str, String str2, int i9, int i10, float f9, int i11, int i12, int i13, String str3, List<d> list, List<d> list2, String str4, List<d> list3, List<d> list4) {
        String str5;
        int i14;
        int C;
        String t9 = t(str2, str4);
        int h02 = h0(list);
        int b02 = b0(list) | Z(list2) | a0(list3) | a0(list4);
        if (t9 != null) {
            String K = "audio/eac3".equals(t9) ? K(list4) : t9;
            if (r.n(K)) {
                return g0.L(str, null, str2, K, str4, null, i13, i9, i10, f9, null, h02, b02);
            }
            if (r.l(K)) {
                return g0.x(str, null, str2, K, str4, null, i13, i11, i12, null, h02, b02, str3);
            }
            if (v(K)) {
                if ("application/cea-608".equals(K)) {
                    C = B(list2);
                } else if (!"application/cea-708".equals(K)) {
                    i14 = -1;
                    return g0.G(str, null, str2, K, str4, i13, h02, b02, str3, i14);
                } else {
                    C = C(list2);
                }
                i14 = C;
                return g0.G(str, null, str2, K, str4, i13, h02, b02, str3, i14);
            }
            str5 = K;
        } else {
            str5 = t9;
        }
        return g0.B(str, null, str2, str5, str4, i13, h02, b02, str3);
    }

    protected List<j.d> f0(XmlPullParser xmlPullParser, long j9, long j10) throws XmlPullParserException, IOException {
        ArrayList arrayList = new ArrayList();
        long j11 = 0;
        long j12 = -9223372036854775807L;
        boolean z9 = false;
        int i9 = 0;
        do {
            xmlPullParser.next();
            if (q0.f(xmlPullParser, "S")) {
                long T = T(xmlPullParser, "t", -9223372036854775807L);
                if (z9) {
                    j11 = b(arrayList, j11, j12, i9, T);
                }
                if (T == -9223372036854775807L) {
                    T = j11;
                }
                j12 = T(xmlPullParser, "d", -9223372036854775807L);
                i9 = Q(xmlPullParser, "r", 0);
                j11 = T;
                z9 = true;
            } else {
                u(xmlPullParser);
            }
        } while (!q0.d(xmlPullParser, "SegmentTimeline"));
        if (z9) {
            b(arrayList, j11, j12, i9, p0.z0(j10, j9, 1000L));
        }
        return arrayList;
    }

    protected b g(long j9, long j10, long j11, boolean z9, long j12, long j13, long j14, long j15, g gVar, m mVar, Uri uri, List<f> list) {
        return new b(j9, j10, j11, z9, j12, j13, j14, j15, gVar, mVar, uri, list);
    }

    protected h g0(XmlPullParser xmlPullParser) {
        return X(xmlPullParser, "media", "mediaRange");
    }

    protected f h(String str, long j9, List<y3.a> list, List<e> list2, d dVar) {
        return new f(str, j9, list, list2, dVar);
    }

    protected int h0(List<d> list) {
        for (int i9 = 0; i9 < list.size(); i9++) {
            d dVar = list.get(i9);
            if ("urn:mpeg:dash:role:2011".equalsIgnoreCase(dVar.f12851a) && "main".equals(dVar.f12852b)) {
                return 1;
            }
        }
        return 0;
    }

    protected h i(String str, long j9, long j10) {
        return new h(str, j9, j10);
    }

    protected i j(a aVar, String str, String str2, ArrayList<k.b> arrayList, ArrayList<d> arrayList2) {
        g0 g0Var = aVar.f12844a;
        if (str != null) {
            g0Var = g0Var.s(str);
        }
        String str3 = aVar.f12847d;
        if (str3 != null) {
            str2 = str3;
        }
        ArrayList<k.b> arrayList3 = aVar.f12848e;
        arrayList3.addAll(arrayList);
        if (!arrayList3.isEmpty()) {
            r(arrayList3);
            g0Var = g0Var.o(new z2.k(str2, arrayList3));
        }
        ArrayList<d> arrayList4 = aVar.f12849f;
        arrayList4.addAll(arrayList2);
        return i.l(aVar.f12850g, g0Var, aVar.f12845b, aVar.f12846c, arrayList4);
    }

    protected j.b k(h hVar, long j9, long j10, long j11, long j12, List<j.d> list, List<h> list2) {
        return new j.b(hVar, j9, j10, j11, j12, list, list2);
    }

    protected int k0(String str) {
        if (str == null) {
            return 0;
        }
        char c9 = 65535;
        switch (str.hashCode()) {
            case 49:
                if (str.equals("1")) {
                    c9 = 0;
                    break;
                }
                break;
            case 50:
                if (str.equals("2")) {
                    c9 = 1;
                    break;
                }
                break;
            case 51:
                if (str.equals("3")) {
                    c9 = 2;
                    break;
                }
                break;
            case 52:
                if (str.equals("4")) {
                    c9 = 3;
                    break;
                }
                break;
            case 54:
                if (str.equals("6")) {
                    c9 = 4;
                    break;
                }
                break;
        }
        switch (c9) {
            case 0:
                return MediaList.Event.ItemAdded;
            case 1:
                return 2048;
            case 2:
                return 4;
            case 3:
                return 8;
            case 4:
                return 1;
            default:
                return 0;
        }
    }

    protected j.c l(h hVar, long j9, long j10, long j11, long j12, long j13, List<j.d> list, l lVar, l lVar2) {
        return new j.c(hVar, j9, j10, j11, j12, j13, list, lVar, lVar2);
    }

    protected l l0(XmlPullParser xmlPullParser, String str, l lVar) {
        String attributeValue = xmlPullParser.getAttributeValue(null, str);
        return attributeValue != null ? l.b(attributeValue) : lVar;
    }

    protected j.d m(long j9, long j10) {
        return new j.d(j9, j10);
    }

    protected m m0(XmlPullParser xmlPullParser) {
        return o(xmlPullParser.getAttributeValue(null, "schemeIdUri"), xmlPullParser.getAttributeValue(null, "value"));
    }

    protected j.e n(h hVar, long j9, long j10, long j11, long j12) {
        return new j.e(hVar, j9, j10, j11, j12);
    }

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

    protected int s(g0 g0Var) {
        String str = g0Var.f11551j;
        if (TextUtils.isEmpty(str)) {
            return -1;
        }
        if (r.n(str)) {
            return 2;
        }
        if (r.l(str)) {
            return 1;
        }
        return v(str) ? 3 : -1;
    }

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

    protected y3.a x(XmlPullParser xmlPullParser, String str, j jVar, long j9) throws XmlPullParserException, IOException {
        String str2;
        String str3;
        ArrayList arrayList;
        ArrayList arrayList2;
        ArrayList arrayList3;
        ArrayList arrayList4;
        ArrayList<d> arrayList5;
        ArrayList<k.b> arrayList6;
        String str4;
        String str5;
        c cVar;
        int i9;
        ArrayList arrayList7;
        XmlPullParser xmlPullParser2;
        ArrayList<d> arrayList8;
        j e02;
        c cVar2 = this;
        XmlPullParser xmlPullParser3 = xmlPullParser;
        int Q = Q(xmlPullParser3, "id", -1);
        int E = E(xmlPullParser);
        String str6 = null;
        String attributeValue = xmlPullParser3.getAttributeValue(null, "mimeType");
        String attributeValue2 = xmlPullParser3.getAttributeValue(null, "codecs");
        int Q2 = Q(xmlPullParser3, "width", -1);
        int Q3 = Q(xmlPullParser3, "height", -1);
        float O = O(xmlPullParser3, -1.0f);
        int Q4 = Q(xmlPullParser3, "audioSamplingRate", -1);
        String str7 = "lang";
        String attributeValue3 = xmlPullParser3.getAttributeValue(null, "lang");
        String attributeValue4 = xmlPullParser3.getAttributeValue(null, "label");
        ArrayList<k.b> arrayList9 = new ArrayList<>();
        ArrayList<d> arrayList10 = new ArrayList<>();
        ArrayList arrayList11 = new ArrayList();
        ArrayList arrayList12 = new ArrayList();
        ArrayList arrayList13 = new ArrayList();
        ArrayList arrayList14 = new ArrayList();
        ArrayList arrayList15 = new ArrayList();
        String str8 = str;
        j jVar2 = jVar;
        String str9 = attributeValue4;
        String str10 = null;
        int i10 = -1;
        boolean z9 = false;
        int i11 = E;
        while (true) {
            xmlPullParser.next();
            if (q0.f(xmlPullParser3, "BaseURL")) {
                if (!z9) {
                    z9 = true;
                    str8 = cVar2.A(xmlPullParser3, str8);
                    arrayList = arrayList14;
                    arrayList2 = arrayList13;
                    arrayList3 = arrayList12;
                    arrayList4 = arrayList11;
                    arrayList6 = arrayList9;
                    str4 = str7;
                    str5 = str6;
                    xmlPullParser2 = xmlPullParser3;
                    cVar = cVar2;
                    i9 = i11;
                    arrayList7 = arrayList15;
                    arrayList8 = arrayList10;
                }
                str2 = attributeValue3;
                str3 = str8;
                arrayList = arrayList14;
                arrayList2 = arrayList13;
                arrayList3 = arrayList12;
                arrayList4 = arrayList11;
                arrayList6 = arrayList9;
                str4 = str7;
                str5 = str6;
                xmlPullParser2 = xmlPullParser3;
                cVar = cVar2;
                i9 = i11;
                arrayList7 = arrayList15;
                arrayList8 = arrayList10;
                attributeValue3 = str2;
                str8 = str3;
            } else {
                if (q0.f(xmlPullParser3, "ContentProtection")) {
                    Pair<String, k.b> D = D(xmlPullParser);
                    Object obj = D.first;
                    if (obj != null) {
                        str10 = (String) obj;
                    }
                    Object obj2 = D.second;
                    if (obj2 != null) {
                        arrayList9.add((k.b) obj2);
                    }
                } else if (q0.f(xmlPullParser3, "ContentComponent")) {
                    attributeValue3 = q(attributeValue3, xmlPullParser3.getAttributeValue(str6, str7));
                    arrayList = arrayList14;
                    arrayList2 = arrayList13;
                    arrayList3 = arrayList12;
                    arrayList4 = arrayList11;
                    arrayList6 = arrayList9;
                    str4 = str7;
                    str5 = str6;
                    xmlPullParser2 = xmlPullParser3;
                    cVar = cVar2;
                    i9 = p(i11, E(xmlPullParser));
                    arrayList7 = arrayList15;
                    arrayList8 = arrayList10;
                } else {
                    if (q0.f(xmlPullParser3, "Role")) {
                        arrayList12.add(H(xmlPullParser3, "Role"));
                    } else if (q0.f(xmlPullParser3, "AudioChannelConfiguration")) {
                        i10 = z(xmlPullParser);
                    } else if (q0.f(xmlPullParser3, "Accessibility")) {
                        arrayList11.add(H(xmlPullParser3, "Accessibility"));
                    } else if (q0.f(xmlPullParser3, "EssentialProperty")) {
                        arrayList13.add(H(xmlPullParser3, "EssentialProperty"));
                    } else if (q0.f(xmlPullParser3, "SupplementalProperty")) {
                        arrayList14.add(H(xmlPullParser3, "SupplementalProperty"));
                    } else {
                        if (q0.f(xmlPullParser3, "Representation")) {
                            str2 = attributeValue3;
                            str3 = str8;
                            arrayList = arrayList14;
                            arrayList2 = arrayList13;
                            arrayList3 = arrayList12;
                            arrayList4 = arrayList11;
                            arrayList5 = arrayList10;
                            arrayList6 = arrayList9;
                            str4 = str7;
                            str5 = str6;
                            a Y = Y(xmlPullParser, str8, attributeValue, attributeValue2, Q2, Q3, O, i10, Q4, str2, arrayList3, arrayList4, arrayList2, arrayList, jVar2, j9);
                            cVar = this;
                            int p9 = p(i11, cVar.s(Y.f12844a));
                            arrayList7 = arrayList15;
                            arrayList7.add(Y);
                            xmlPullParser2 = xmlPullParser;
                            i9 = p9;
                        } else {
                            str2 = attributeValue3;
                            str3 = str8;
                            arrayList = arrayList14;
                            arrayList2 = arrayList13;
                            arrayList3 = arrayList12;
                            arrayList4 = arrayList11;
                            arrayList5 = arrayList10;
                            arrayList6 = arrayList9;
                            str4 = str7;
                            str5 = str6;
                            cVar = cVar2;
                            i9 = i11;
                            arrayList7 = arrayList15;
                            xmlPullParser2 = xmlPullParser;
                            if (q0.f(xmlPullParser2, "SegmentBase")) {
                                e02 = cVar.c0(xmlPullParser2, (j.e) jVar2);
                            } else if (q0.f(xmlPullParser2, "SegmentList")) {
                                e02 = cVar.d0(xmlPullParser2, (j.b) jVar2, j9);
                            } else if (q0.f(xmlPullParser2, "SegmentTemplate")) {
                                e02 = e0(xmlPullParser, (j.c) jVar2, arrayList, j9);
                            } else {
                                if (q0.f(xmlPullParser2, "InbandEventStream")) {
                                    arrayList8 = arrayList5;
                                    arrayList8.add(H(xmlPullParser2, "InbandEventStream"));
                                } else {
                                    arrayList8 = arrayList5;
                                    if (q0.f(xmlPullParser2, "Label")) {
                                        str9 = R(xmlPullParser);
                                    } else if (q0.e(xmlPullParser)) {
                                        y(xmlPullParser);
                                    }
                                }
                                attributeValue3 = str2;
                                str8 = str3;
                            }
                            jVar2 = e02;
                        }
                        attributeValue3 = str2;
                        str8 = str3;
                        arrayList8 = arrayList5;
                    }
                    str2 = attributeValue3;
                    str3 = str8;
                    arrayList = arrayList14;
                    arrayList2 = arrayList13;
                    arrayList3 = arrayList12;
                    arrayList4 = arrayList11;
                    arrayList6 = arrayList9;
                    str4 = str7;
                    str5 = str6;
                    xmlPullParser2 = xmlPullParser3;
                    cVar = cVar2;
                    i9 = i11;
                    arrayList7 = arrayList15;
                    arrayList8 = arrayList10;
                    attributeValue3 = str2;
                    str8 = str3;
                }
                arrayList = arrayList14;
                arrayList2 = arrayList13;
                arrayList3 = arrayList12;
                arrayList4 = arrayList11;
                arrayList6 = arrayList9;
                str4 = str7;
                str5 = str6;
                xmlPullParser2 = xmlPullParser3;
                cVar = cVar2;
                i9 = i11;
                arrayList7 = arrayList15;
                arrayList8 = arrayList10;
            }
            if (q0.d(xmlPullParser2, "AdaptationSet")) {
                break;
            }
            i11 = i9;
            cVar2 = cVar;
            arrayList15 = arrayList7;
            xmlPullParser3 = xmlPullParser2;
            arrayList10 = arrayList8;
            arrayList14 = arrayList;
            arrayList13 = arrayList2;
            arrayList12 = arrayList3;
            arrayList11 = arrayList4;
            arrayList9 = arrayList6;
            str7 = str4;
            str6 = str5;
        }
        ArrayList arrayList16 = new ArrayList(arrayList7.size());
        for (int i12 = 0; i12 < arrayList7.size(); i12++) {
            arrayList16.add(j((a) arrayList7.get(i12), str9, str10, arrayList6, arrayList8));
        }
        return c(Q, i9, arrayList16, arrayList4, arrayList2, arrayList);
    }

    protected void y(XmlPullParser xmlPullParser) throws XmlPullParserException, IOException {
        u(xmlPullParser);
    }

    protected int z(XmlPullParser xmlPullParser) throws XmlPullParserException, IOException {
        String i02 = i0(xmlPullParser, "schemeIdUri", null);
        int i9 = -1;
        if ("urn:mpeg:dash:23003:3:audio_channel_configuration:2011".equals(i02)) {
            i9 = Q(xmlPullParser, "value", -1);
        } else if ("tag:dolby.com,2014:dash:audio_channel_configuration:2011".equals(i02) || "urn:dolby:dash:audio_channel_configuration:2011".equals(i02)) {
            i9 = I(xmlPullParser);
        }
        do {
            xmlPullParser.next();
        } while (!q0.d(xmlPullParser, "AudioChannelConfiguration"));
        return i9;
    }
}