暗网解密 v2.0.4版本的 MD5 值为:d3a04548fef88e775cbe4c3c6e7d81ad

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


package c.g.a.a.z2.u0.m;

import android.net.Uri;
import android.text.TextUtils;
import android.util.Base64;
import android.util.Pair;
import android.util.Xml;
import androidx.annotation.Nullable;
import androidx.constraintlayout.core.motion.utils.TypedValues;
import androidx.core.app.NotificationCompat;
import androidx.exifinterface.media.ExifInterface;
import androidx.recyclerview.widget.RecyclerView;
import c.g.a.a.d3.a0;
import c.g.a.a.e3.q0;
import c.g.a.a.e3.r0;
import c.g.a.a.e3.s0;
import c.g.a.a.e3.v;
import c.g.a.a.e3.z;
import c.g.a.a.w0;
import c.g.a.a.z2.u0.m.k;
import c.g.b.b.d0;
import c.g.b.b.v0;
import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.ParserException;
import com.google.android.exoplayer2.drm.DrmInitData;
import com.google.android.exoplayer2.metadata.emsg.EventMessage;
import com.lzy.okgo.model.HttpHeaders;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.UUID;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import okhttp3.internal.cache.DiskLruCache;
import org.xml.sax.helpers.DefaultHandler;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlPullParserFactory;
import org.xmlpull.v1.XmlSerializer;
public class d extends DefaultHandler implements a0.a<c> {
    public static final Pattern f4080a = Pattern.compile("(\\d+)(?:/(\\d+))?");
    public static final Pattern f4081b = Pattern.compile("CC([1-4])=.*");
    public static final Pattern f4082c = Pattern.compile("([1-9]|[1-5][0-9]|6[0-3])=.*");
    public static final int[] f4083d = {-1, 1, 2, 3, 4, 5, 6, 8, 2, 3, 4, 7, 8, 24, 8, 12, 10, 12, 14, 12, 14};
    public final XmlPullParserFactory f4084e;

    public static final class a {
        public final Format f4085a;
        public final d0<b> f4086b;
        public final k f4087c;
        @Nullable
        public final String f4088d;
        public final ArrayList<DrmInitData.SchemeData> f4089e;
        public final ArrayList<e> f4090f;
        public final long f4091g;

        public a(Format format, List<b> list, k kVar, @Nullable String str, ArrayList<DrmInitData.SchemeData> arrayList, ArrayList<e> arrayList2, long j) {
            this.f4085a = format;
            this.f4086b = d0.copyOf((Collection) list);
            this.f4087c = kVar;
            this.f4088d = str;
            this.f4089e = arrayList;
            this.f4090f = arrayList2;
            this.f4091g = j;
        }
    }

    public d() {
        try {
            this.f4084e = 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 i = 0; i < list.size(); i++) {
            e eVar = list.get(i);
            if ("urn:scte:dash:cc:cea-608:2015".equals(eVar.f4092a) && (str = eVar.f4093b) != null) {
                Matcher matcher = f4081b.matcher(str);
                if (matcher.matches()) {
                    return Integer.parseInt(matcher.group(1));
                }
                String valueOf = String.valueOf(eVar.f4093b);
                v.h("MpdParser", valueOf.length() != 0 ? "Unable to parse CEA-608 channel number from: ".concat(valueOf) : new String("Unable to parse CEA-608 channel number from: "));
            }
        }
        return -1;
    }

    public static int C(List<e> list) {
        String str;
        for (int i = 0; i < list.size(); i++) {
            e eVar = list.get(i);
            if ("urn:scte:dash:cc:cea-708:2015".equals(eVar.f4092a) && (str = eVar.f4093b) != null) {
                Matcher matcher = f4082c.matcher(str);
                if (matcher.matches()) {
                    return Integer.parseInt(matcher.group(1));
                }
                String valueOf = String.valueOf(eVar.f4093b);
                v.h("MpdParser", valueOf.length() != 0 ? "Unable to parse CEA-708 service block number from: ".concat(valueOf) : new String("Unable to parse CEA-708 service block number from: "));
            }
        }
        return -1;
    }

    public static long F(XmlPullParser xmlPullParser, String str, long j) {
        String attributeValue = xmlPullParser.getAttributeValue(null, str);
        return attributeValue == null ? j : r0.C0(attributeValue);
    }

    public static e G(XmlPullParser xmlPullParser, String str) {
        String m0 = m0(xmlPullParser, "schemeIdUri", "");
        String m02 = m0(xmlPullParser, "value", null);
        String m03 = m0(xmlPullParser, "id", null);
        do {
            xmlPullParser.next();
        } while (!s0.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.g.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 j) {
        String attributeValue = xmlPullParser.getAttributeValue(null, str);
        return attributeValue == null ? j : r0.D0(attributeValue);
    }

    public static String J(List<e> list) {
        for (int i = 0; i < list.size(); i++) {
            e eVar = list.get(i);
            String str = eVar.f4092a;
            if ("tag:dolby.com,2018:dash:EC3_ExtensionType:2018".equals(str) && "JOC".equals(eVar.f4093b)) {
                return "audio/eac3-joc";
            }
            if ("tag:dolby.com,2014:dash:DolbyDigitalPlusExtensionType:2014".equals(str) && "ec+3".equals(eVar.f4093b)) {
                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 attributeValue = xmlPullParser.getAttributeValue(null, "frameRate");
        if (attributeValue != null) {
            Matcher matcher = f4080a.matcher(attributeValue);
            if (matcher.matches()) {
                int parseInt = Integer.parseInt(matcher.group(1));
                String group = matcher.group(2);
                return !TextUtils.isEmpty(group) ? parseInt / Integer.parseInt(group) : parseInt;
            }
            return f2;
        }
        return f2;
    }

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

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

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

    public static int V(XmlPullParser xmlPullParser) {
        int Q = Q(xmlPullParser, "value", -1);
        if (Q >= 0) {
            int[] iArr = f4083d;
            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 = "";
        do {
            xmlPullParser.next();
            if (xmlPullParser.getEventType() == 4) {
                str2 = xmlPullParser.getText();
            } else {
                u(xmlPullParser);
            }
        } while (!s0.d(xmlPullParser, str));
        return str2;
    }

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

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

    public static void r(ArrayList<DrmInitData.SchemeData> arrayList) {
        for (int size = arrayList.size() - 1; size >= 0; size--) {
            DrmInitData.SchemeData schemeData = arrayList.get(size);
            if (!schemeData.f()) {
                int i = 0;
                while (true) {
                    if (i >= arrayList.size()) {
                        break;
                    } else if (arrayList.get(i).d(schemeData)) {
                        arrayList.remove(size);
                        break;
                    } else {
                        i++;
                    }
                }
            }
        }
    }

    public static long s(long j, long j2) {
        if (j2 != -9223372036854775807L) {
            j = j2;
        }
        if (j == RecyclerView.FOREVER_NS) {
            return -9223372036854775807L;
        }
        return j;
    }

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

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

    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 (q0.b(n0)) {
            return v0.l(new b(n0, attributeValue3, parseInt, parseInt2));
        }
        ArrayList arrayList = new ArrayList();
        for (int i = 0; i < list.size(); i++) {
            b bVar = list.get(i);
            arrayList.add(new b(q0.d(bVar.f4068a, n0), bVar.f4069b, bVar.f4070c, bVar.f4071d));
        }
        return arrayList;
    }

    public Pair<String, DrmInitData.SchemeData> 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.g.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 = w0.f3708e;
                    str = null;
                    uuid2 = null;
                    bArr = uuid2;
                    bArr2 = uuid2;
                    break;
                case 1:
                    uuid = w0.f3707d;
                    str = null;
                    uuid2 = null;
                    bArr = uuid2;
                    bArr2 = uuid2;
                    break;
                case 2:
                    str = xmlPullParser.getAttributeValue(null, "value");
                    String b2 = s0.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 i = 0; i < split.length; i++) {
                            uuidArr[i] = UUID.fromString(split[i]);
                        }
                        uuid = w0.f3705b;
                        bArr = null;
                        bArr2 = c.g.a.a.u2.k0.l.b(uuid, uuidArr, null);
                        break;
                    } else {
                        uuid = null;
                        uuid2 = uuid;
                        bArr = uuid2;
                        bArr2 = uuid2;
                        break;
                    }
            }
            do {
                xmlPullParser.next();
                if (!s0.f(xmlPullParser, "ms:laurl")) {
                    bArr = xmlPullParser.getAttributeValue(null, "licenseUrl");
                    bArr2 = bArr2;
                } else if (bArr2 == null && s0.g(xmlPullParser, "pssh") && xmlPullParser.next() == 4) {
                    byte[] decode = Base64.decode(xmlPullParser.getText(), 0);
                    UUID f2 = c.g.a.a.u2.k0.l.f(decode);
                    if (f2 == null) {
                        v.h("MpdParser", "Skipping malformed cenc:pssh data");
                        uuid = f2;
                        bArr2 = null;
                    } else {
                        bArr2 = decode;
                        uuid = f2;
                    }
                } else {
                    if (bArr2 == null) {
                        UUID uuid3 = w0.f3708e;
                        if (uuid3.equals(uuid) && s0.f(xmlPullParser, "mspr:pro") && xmlPullParser.next() == 4) {
                            bArr2 = c.g.a.a.u2.k0.l.a(uuid3, Base64.decode(xmlPullParser.getText(), 0));
                        }
                    }
                    u(xmlPullParser);
                    bArr2 = bArr2;
                }
            } while (!s0.d(xmlPullParser, "ContentProtection"));
            return Pair.create(str, uuid != null ? new DrmInitData.SchemeData(uuid, bArr, "video/mp4", bArr2) : null);
        }
        str = null;
        uuid = null;
        uuid2 = uuid;
        bArr = uuid2;
        bArr2 = uuid2;
        do {
            xmlPullParser.next();
            if (!s0.f(xmlPullParser, "ms:laurl")) {
            }
        } while (!s0.d(xmlPullParser, "ContentProtection"));
        return Pair.create(str, uuid != null ? new DrmInitData.SchemeData(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 NotificationCompat.MessagingStyle.Message.KEY_TEXT.equals(attributeValue) ? 3 : -1;
    }

    public Pair<Long, EventMessage> K(XmlPullParser xmlPullParser, String str, String str2, long j, ByteArrayOutputStream byteArrayOutputStream) {
        long T = T(xmlPullParser, "id", 0L);
        long T2 = T(xmlPullParser, "duration", -9223372036854775807L);
        long T3 = T(xmlPullParser, "presentationTime", 0L);
        long H0 = r0.H0(T2, 1000L, j);
        long H02 = r0.H0(T3, 1000000L, j);
        String m0 = m0(xmlPullParser, "messageData", null);
        byte[] L = L(xmlPullParser, byteArrayOutputStream);
        Long valueOf = Long.valueOf(H02);
        if (m0 != null) {
            L = r0.i0(m0);
        }
        return Pair.create(valueOf, d(str, str2, T, H0, L));
    }

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

    public f M(XmlPullParser xmlPullParser) {
        String m0 = m0(xmlPullParser, "schemeIdUri", "");
        String m02 = m0(xmlPullParser, "value", "");
        long T = T(xmlPullParser, "timescale", 1L);
        ArrayList arrayList = new ArrayList();
        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(512);
        do {
            xmlPullParser.next();
            if (s0.f(xmlPullParser, "Event")) {
                arrayList.add(K(xmlPullParser, m0, m02, T, byteArrayOutputStream));
            } else {
                u(xmlPullParser);
            }
        } while (!s0.d(xmlPullParser, "EventStream"));
        long[] jArr = new long[arrayList.size()];
        EventMessage[] eventMessageArr = new EventMessage[arrayList.size()];
        for (int i = 0; i < arrayList.size(); i++) {
            Pair pair = (Pair) arrayList.get(i);
            jArr[i] = ((Long) pair.first).longValue();
            eventMessageArr[i] = (EventMessage) pair.second;
        }
        return e(m0, m02, T, jArr, eventMessageArr);
    }

    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 j;
        ArrayList arrayList;
        ArrayList arrayList2;
        ArrayList arrayList3;
        Throwable th;
        long j2;
        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 j3 = equals ? 0L : -9223372036854775807L;
        ArrayList l = v0.l(bVar);
        ArrayList arrayList4 = new ArrayList();
        ArrayList arrayList5 = new ArrayList();
        long j4 = equals ? -9223372036854775807L : 0L;
        long j5 = j3;
        h hVar = null;
        o oVar = null;
        Uri uri = null;
        l lVar = null;
        boolean z = false;
        boolean z2 = false;
        while (true) {
            xmlPullParser.next();
            if (s0.f(xmlPullParser, "BaseURL")) {
                if (!z) {
                    j5 = dVar.z(xmlPullParser, j5);
                    z = true;
                }
                arrayList5.addAll(dVar.A(xmlPullParser, l));
            } else if (s0.f(xmlPullParser, "ProgramInformation")) {
                hVar = X(xmlPullParser);
            } else if (s0.f(xmlPullParser, "UTCTiming")) {
                oVar = q0(xmlPullParser);
            } else if (s0.f(xmlPullParser, HttpHeaders.HEAD_KEY_LOCATION)) {
                uri = Uri.parse(xmlPullParser.nextText());
            } else if (s0.f(xmlPullParser, "ServiceDescription")) {
                lVar = l0(xmlPullParser);
            } else {
                if (s0.f(xmlPullParser, "Period") && !z2) {
                    j = j5;
                    arrayList = arrayList5;
                    arrayList2 = l;
                    ArrayList arrayList6 = arrayList4;
                    Pair<g, Long> W = W(xmlPullParser, !arrayList5.isEmpty() ? arrayList5 : l, j4, j, F, I4);
                    g gVar = (g) W.first;
                    if (gVar.f4101b != -9223372036854775807L) {
                        th = null;
                        long longValue = ((Long) W.second).longValue();
                        if (longValue == -9223372036854775807L) {
                            arrayList3 = arrayList6;
                            j4 = -9223372036854775807L;
                        } else {
                            arrayList3 = arrayList6;
                            j4 = gVar.f4101b + longValue;
                        }
                        arrayList3.add(gVar);
                    } else if (!equals) {
                        int size = arrayList6.size();
                        StringBuilder sb = new StringBuilder(47);
                        sb.append("Unable to determine start of period ");
                        sb.append(size);
                        throw ParserException.createForMalformedManifest(sb.toString(), null);
                    } else {
                        arrayList3 = arrayList6;
                        th = null;
                        z2 = true;
                    }
                } else {
                    j = j5;
                    arrayList = arrayList5;
                    arrayList2 = l;
                    arrayList3 = arrayList4;
                    th = th2;
                    u(xmlPullParser);
                }
                j5 = j;
                if (s0.d(xmlPullParser, "MPD")) {
                    dVar = this;
                    th2 = th;
                    arrayList4 = arrayList3;
                    arrayList5 = arrayList;
                    l = arrayList2;
                } else {
                    if (I == -9223372036854775807L) {
                        if (j4 != -9223372036854775807L) {
                            j2 = j4;
                            if (arrayList3.isEmpty()) {
                                return g(F, j2, I2, equals, I3, I4, I5, F2, hVar, oVar, lVar, uri, arrayList3);
                            }
                            throw ParserException.createForMalformedManifest("No periods found.", th);
                        } else if (!equals) {
                            throw ParserException.createForMalformedManifest("Unable to determine duration of static manifest.", th);
                        }
                    }
                    j2 = I;
                    if (arrayList3.isEmpty()) {
                    }
                }
            }
            arrayList = arrayList5;
            arrayList2 = l;
            arrayList3 = arrayList4;
            th = th2;
            if (s0.d(xmlPullParser, "MPD")) {
            }
        }
    }

    public Pair<g, Long> W(XmlPullParser xmlPullParser, List<b> list, long j, long j2, long j3, long j4) {
        long j5;
        ArrayList arrayList;
        ArrayList arrayList2;
        ArrayList arrayList3;
        Object obj;
        long j6;
        k g0;
        d dVar = this;
        Object obj2 = null;
        String attributeValue = xmlPullParser.getAttributeValue(null, "id");
        long I = I(xmlPullParser, "start", j);
        long j7 = -9223372036854775807L;
        long j8 = j3 != -9223372036854775807L ? j3 + I : -9223372036854775807L;
        long I2 = I(xmlPullParser, "duration", -9223372036854775807L);
        ArrayList arrayList4 = new ArrayList();
        ArrayList arrayList5 = new ArrayList();
        ArrayList arrayList6 = new ArrayList();
        long j9 = j2;
        long j10 = -9223372036854775807L;
        k.e eVar = null;
        e eVar2 = null;
        boolean z = false;
        while (true) {
            xmlPullParser.next();
            if (s0.f(xmlPullParser, "BaseURL")) {
                if (!z) {
                    j9 = dVar.z(xmlPullParser, j9);
                    z = true;
                }
                arrayList6.addAll(A(xmlPullParser, list));
                arrayList3 = arrayList5;
                arrayList = arrayList6;
                j6 = j7;
                obj = obj2;
                arrayList2 = arrayList4;
            } else {
                if (s0.f(xmlPullParser, "AdaptationSet")) {
                    j5 = j9;
                    arrayList = arrayList6;
                    arrayList2 = arrayList4;
                    arrayList2.add(w(xmlPullParser, !arrayList6.isEmpty() ? arrayList6 : list, eVar, I2, j9, j10, j8, j4));
                    arrayList3 = arrayList5;
                } else {
                    j5 = j9;
                    ArrayList arrayList7 = arrayList5;
                    arrayList = arrayList6;
                    arrayList2 = arrayList4;
                    if (s0.f(xmlPullParser, "EventStream")) {
                        arrayList7.add(M(xmlPullParser));
                        arrayList3 = arrayList7;
                    } else if (s0.f(xmlPullParser, "SegmentBase")) {
                        arrayList3 = arrayList7;
                        eVar = e0(xmlPullParser, null);
                        obj = null;
                        j9 = j5;
                        j6 = -9223372036854775807L;
                    } else {
                        arrayList3 = arrayList7;
                        if (s0.f(xmlPullParser, "SegmentList")) {
                            long z2 = z(xmlPullParser, -9223372036854775807L);
                            obj = null;
                            g0 = f0(xmlPullParser, null, j8, I2, j5, z2, j4);
                            j10 = z2;
                            j9 = j5;
                            j6 = -9223372036854775807L;
                        } else {
                            obj = null;
                            if (s0.f(xmlPullParser, "SegmentTemplate")) {
                                long z3 = z(xmlPullParser, -9223372036854775807L);
                                j6 = -9223372036854775807L;
                                g0 = g0(xmlPullParser, null, d0.of(), j8, I2, j5, z3, j4);
                                j10 = z3;
                                j9 = j5;
                            } else {
                                j6 = -9223372036854775807L;
                                if (s0.f(xmlPullParser, "AssetIdentifier")) {
                                    eVar2 = G(xmlPullParser, "AssetIdentifier");
                                } else {
                                    u(xmlPullParser);
                                }
                                j9 = j5;
                            }
                        }
                        eVar = g0;
                    }
                }
                obj = null;
                j6 = -9223372036854775807L;
                j9 = j5;
            }
            if (s0.d(xmlPullParser, "Period")) {
                return Pair.create(h(attributeValue, I, arrayList2, arrayList3, eVar2), Long.valueOf(I2));
            }
            arrayList4 = arrayList2;
            arrayList6 = arrayList;
            obj2 = obj;
            arrayList5 = arrayList3;
            j7 = j6;
            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 (s0.f(xmlPullParser, "Title")) {
                str = xmlPullParser.nextText();
            } else if (s0.f(xmlPullParser, "Source")) {
                str2 = xmlPullParser.nextText();
            } else if (s0.f(xmlPullParser, ExifInterface.TAG_COPYRIGHT)) {
                str3 = xmlPullParser.nextText();
            } else {
                u(xmlPullParser);
            }
            String str4 = str3;
            if (s0.d(xmlPullParser, "ProgramInformation")) {
                return new h(str, str2, str4, m0, m02);
            }
            str3 = str4;
        }
    }

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

    public a Z(XmlPullParser xmlPullParser, List<b> list, @Nullable String str, @Nullable String str2, int i, int i2, float f2, int i3, int i4, @Nullable String str3, List<e> list2, List<e> list3, List<e> list4, List<e> list5, @Nullable k kVar, long j, long j2, long j3, long j4, long j5) {
        long j6;
        ArrayList arrayList;
        ArrayList arrayList2;
        ArrayList arrayList3;
        ArrayList arrayList4;
        ArrayList arrayList5;
        ArrayList arrayList6;
        ArrayList arrayList7;
        int i5;
        long z;
        k kVar2;
        d dVar = this;
        String attributeValue = xmlPullParser.getAttributeValue(null, "id");
        int Q = Q(xmlPullParser, "bandwidth", -1);
        String m0 = m0(xmlPullParser, "mimeType", str);
        String m02 = m0(xmlPullParser, "codecs", str2);
        int Q2 = Q(xmlPullParser, "width", i);
        int Q3 = Q(xmlPullParser, "height", i2);
        float O = O(xmlPullParser, f2);
        int Q4 = Q(xmlPullParser, "audioSamplingRate", i4);
        ArrayList arrayList8 = new ArrayList();
        ArrayList arrayList9 = new ArrayList();
        ArrayList arrayList10 = new ArrayList(list4);
        ArrayList arrayList11 = new ArrayList(list5);
        ArrayList arrayList12 = new ArrayList();
        int i6 = i3;
        long j7 = j3;
        long j8 = j4;
        String str4 = null;
        boolean z2 = false;
        k kVar3 = kVar;
        while (true) {
            xmlPullParser.next();
            if (s0.f(xmlPullParser, "BaseURL")) {
                if (!z2) {
                    j7 = dVar.z(xmlPullParser, j7);
                    z2 = true;
                }
                arrayList12.addAll(A(xmlPullParser, list));
            } else if (s0.f(xmlPullParser, "AudioChannelConfiguration")) {
                kVar2 = kVar3;
                arrayList = arrayList12;
                arrayList5 = arrayList8;
                i5 = y(xmlPullParser);
                arrayList6 = arrayList9;
                arrayList7 = arrayList11;
                if (s0.d(xmlPullParser, "Representation")) {
                    break;
                }
                arrayList11 = arrayList7;
                arrayList9 = arrayList6;
                arrayList8 = arrayList5;
                kVar3 = kVar2;
                dVar = this;
                i6 = i5;
                arrayList12 = arrayList;
            } else if (s0.f(xmlPullParser, "SegmentBase")) {
                kVar3 = dVar.e0(xmlPullParser, (k.e) kVar3);
            } else {
                if (s0.f(xmlPullParser, "SegmentList")) {
                    z = dVar.z(xmlPullParser, j8);
                    j6 = j7;
                    arrayList = arrayList12;
                    arrayList2 = arrayList11;
                    arrayList3 = arrayList9;
                    arrayList4 = arrayList10;
                    kVar3 = f0(xmlPullParser, (k.b) kVar3, j, j2, j6, z, j5);
                    arrayList5 = arrayList8;
                } else {
                    j6 = j7;
                    arrayList = arrayList12;
                    arrayList2 = arrayList11;
                    arrayList3 = arrayList9;
                    arrayList4 = arrayList10;
                    if (s0.f(xmlPullParser, "SegmentTemplate")) {
                        z = dVar.z(xmlPullParser, j8);
                        arrayList5 = arrayList8;
                        kVar3 = g0(xmlPullParser, (k.c) kVar3, list5, j, j2, j6, z, j5);
                    } else {
                        arrayList5 = arrayList8;
                        if (s0.f(xmlPullParser, "ContentProtection")) {
                            Pair<String, DrmInitData.SchemeData> D = D(xmlPullParser);
                            Object obj = D.first;
                            if (obj != null) {
                                str4 = (String) obj;
                            }
                            Object obj2 = D.second;
                            if (obj2 != null) {
                                arrayList5.add((DrmInitData.SchemeData) obj2);
                            }
                            i5 = i6;
                            j7 = j6;
                            arrayList7 = arrayList2;
                            arrayList6 = arrayList3;
                            arrayList10 = arrayList4;
                            kVar2 = kVar3;
                            if (s0.d(xmlPullParser, "Representation")) {
                            }
                        } else {
                            if (s0.f(xmlPullParser, "InbandEventStream")) {
                                arrayList6 = arrayList3;
                                arrayList6.add(G(xmlPullParser, "InbandEventStream"));
                                arrayList7 = arrayList2;
                                arrayList10 = arrayList4;
                            } else {
                                arrayList6 = arrayList3;
                                if (s0.f(xmlPullParser, "EssentialProperty")) {
                                    arrayList10 = arrayList4;
                                    arrayList10.add(G(xmlPullParser, "EssentialProperty"));
                                    arrayList7 = arrayList2;
                                } else {
                                    arrayList10 = arrayList4;
                                    if (s0.f(xmlPullParser, "SupplementalProperty")) {
                                        arrayList7 = arrayList2;
                                        arrayList7.add(G(xmlPullParser, "SupplementalProperty"));
                                    } else {
                                        arrayList7 = arrayList2;
                                        u(xmlPullParser);
                                    }
                                }
                            }
                            i5 = i6;
                            j7 = j6;
                            kVar2 = kVar3;
                            if (s0.d(xmlPullParser, "Representation")) {
                            }
                        }
                    }
                }
                i5 = i6;
                j8 = z;
                j7 = j6;
                arrayList7 = arrayList2;
                arrayList6 = arrayList3;
                arrayList10 = arrayList4;
                kVar2 = kVar3;
                if (s0.d(xmlPullParser, "Representation")) {
                }
            }
            arrayList = arrayList12;
            arrayList5 = arrayList8;
            i5 = i6;
            kVar2 = kVar3;
            arrayList6 = arrayList9;
            arrayList7 = arrayList11;
            if (s0.d(xmlPullParser, "Representation")) {
            }
        }
        ArrayList arrayList13 = arrayList6;
        Format f3 = f(attributeValue, m0, Q2, Q3, O, i5, 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 i = 0;
        for (int i2 = 0; i2 < list.size(); i2++) {
            e eVar = list.get(i2);
            if (c.g.b.a.b.a("urn:mpeg:dash:role:2011", eVar.f4092a)) {
                o0 = b0(eVar.f4093b);
            } else if (c.g.b.a.b.a("urn:tva:metadata:cs:AudioPurposeCS:2007", eVar.f4092a)) {
                o0 = o0(eVar.f4093b);
            }
            i |= o0;
        }
        return i;
    }

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

    public int b0(@Nullable 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 512;
            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.g.a.a.z2.u0.m.a c(int i, int i2, List<j> list, List<e> list2, List<e> list3, List<e> list4) {
        return new c.g.a.a.z2.u0.m.a(i, i2, list, list2, list3, list4);
    }

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

    public EventMessage d(String str, String str2, long j, long j2, byte[] bArr) {
        return new EventMessage(str, str2, j2, j, bArr);
    }

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

    public f e(String str, String str2, long j, long[] jArr, EventMessage[] eventMessageArr) {
        return new f(str, str2, j, jArr, eventMessageArr);
    }

    public k.e e0(XmlPullParser xmlPullParser, @Nullable k.e eVar) {
        long j;
        long j2;
        long T = T(xmlPullParser, "timescale", eVar != null ? eVar.f4124b : 1L);
        long T2 = T(xmlPullParser, "presentationTimeOffset", eVar != null ? eVar.f4125c : 0L);
        long j3 = eVar != null ? eVar.f4133d : 0L;
        long j4 = eVar != null ? eVar.f4134e : 0L;
        String attributeValue = xmlPullParser.getAttributeValue(null, "indexRange");
        if (attributeValue != null) {
            String[] split = attributeValue.split("-");
            long parseLong = Long.parseLong(split[0]);
            j = (Long.parseLong(split[1]) - parseLong) + 1;
            j2 = parseLong;
        } else {
            j = j4;
            j2 = j3;
        }
        i iVar = eVar != null ? eVar.f4123a : null;
        do {
            xmlPullParser.next();
            if (s0.f(xmlPullParser, "Initialization")) {
                iVar = P(xmlPullParser);
            } else {
                u(xmlPullParser);
            }
        } while (!s0.d(xmlPullParser, "SegmentBase"));
        return n(iVar, T, T2, j2, j);
    }

    public Format f(@Nullable String str, @Nullable String str2, int i, int i2, float f2, int i3, int i4, int i5, @Nullable String str3, List<e> list, List<e> list2, @Nullable 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);
        Format.b V = new Format.b().S(str).K(str2).e0(t).I(str5).Z(i5).g0(k0).c0(d0(list) | a0(list2) | c0(list3) | c0(list4)).V(str3);
        if (z.s(t)) {
            V.j0(i).Q(i2).P(f2);
        } else if (z.p(t)) {
            V.H(i3).f0(i4);
        } else if (z.r(t)) {
            int i6 = -1;
            if ("application/cea-608".equals(t)) {
                i6 = B(list2);
            } else if ("application/cea-708".equals(t)) {
                i6 = C(list2);
            }
            V.F(i6);
        }
        return V.E();
    }

    public k.b f0(XmlPullParser xmlPullParser, @Nullable k.b bVar, long j, long j2, long j3, long j4, long j5) {
        long T = T(xmlPullParser, "timescale", bVar != null ? bVar.f4124b : 1L);
        long T2 = T(xmlPullParser, "presentationTimeOffset", bVar != null ? bVar.f4125c : 0L);
        long T3 = T(xmlPullParser, "duration", bVar != null ? bVar.f4127e : -9223372036854775807L);
        long T4 = T(xmlPullParser, "startNumber", bVar != null ? bVar.f4126d : 1L);
        long s = s(j3, j4);
        List<k.d> list = null;
        List<i> list2 = null;
        i iVar = null;
        do {
            xmlPullParser.next();
            if (s0.f(xmlPullParser, "Initialization")) {
                iVar = P(xmlPullParser);
            } else if (s0.f(xmlPullParser, "SegmentTimeline")) {
                list = h0(xmlPullParser, T, j2);
            } else if (s0.f(xmlPullParser, "SegmentURL")) {
                if (list2 == null) {
                    list2 = new ArrayList<>();
                }
                list2.add(i0(xmlPullParser));
            } else {
                u(xmlPullParser);
            }
        } while (!s0.d(xmlPullParser, "SegmentList"));
        if (bVar != null) {
            if (iVar == null) {
                iVar = bVar.f4123a;
            }
            if (list == null) {
                list = bVar.f4128f;
            }
            if (list2 == null) {
                list2 = bVar.j;
            }
        }
        return k(iVar, T, T2, T4, T3, list, s, list2, j5, j);
    }

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

    public k.c g0(XmlPullParser xmlPullParser, @Nullable k.c cVar, List<e> list, long j, long j2, long j3, long j4, long j5) {
        long T = T(xmlPullParser, "timescale", cVar != null ? cVar.f4124b : 1L);
        long T2 = T(xmlPullParser, "presentationTimeOffset", cVar != null ? cVar.f4125c : 0L);
        long T3 = T(xmlPullParser, "duration", cVar != null ? cVar.f4127e : -9223372036854775807L);
        long T4 = T(xmlPullParser, "startNumber", cVar != null ? cVar.f4126d : 1L);
        long S = S(list);
        long s = s(j3, j4);
        List<k.d> list2 = null;
        n p0 = p0(xmlPullParser, "media", cVar != null ? cVar.k : null);
        n p02 = p0(xmlPullParser, "initialization", cVar != null ? cVar.j : null);
        i iVar = null;
        while (true) {
            xmlPullParser.next();
            if (s0.f(xmlPullParser, "Initialization")) {
                iVar = P(xmlPullParser);
            } else if (s0.f(xmlPullParser, "SegmentTimeline")) {
                list2 = h0(xmlPullParser, T, j2);
            } else {
                u(xmlPullParser);
            }
            if (s0.d(xmlPullParser, "SegmentTemplate")) {
                break;
            }
        }
        if (cVar != null) {
            if (iVar == null) {
                iVar = cVar.f4123a;
            }
            if (list2 == null) {
                list2 = cVar.f4128f;
            }
        }
        return l(iVar, T, T2, T4, S, T3, list2, s, p02, p0, j5, j);
    }

    public g h(@Nullable String str, long j, List<c.g.a.a.z2.u0.m.a> list, List<f> list2, @Nullable e eVar) {
        return new g(str, j, list, list2, eVar);
    }

    public List<k.d> h0(XmlPullParser xmlPullParser, long j, long j2) {
        ArrayList arrayList = new ArrayList();
        long j3 = 0;
        long j4 = -9223372036854775807L;
        boolean z = false;
        int i = 0;
        do {
            xmlPullParser.next();
            if (s0.f(xmlPullParser, ExifInterface.LATITUDE_SOUTH)) {
                long T = T(xmlPullParser, "t", -9223372036854775807L);
                if (z) {
                    j3 = b(arrayList, j3, j4, i, T);
                }
                if (T == -9223372036854775807L) {
                    T = j3;
                }
                j4 = T(xmlPullParser, c.o.a.h.d.f6208a, -9223372036854775807L);
                i = Q(xmlPullParser, "r", 0);
                j3 = T;
                z = true;
            } else {
                u(xmlPullParser);
            }
        } while (!s0.d(xmlPullParser, "SegmentTimeline"));
        if (z) {
            b(arrayList, j3, j4, i, r0.H0(j2, j, 1000L));
        }
        return arrayList;
    }

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

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

    public j j(a aVar, @Nullable String str, @Nullable String str2, ArrayList<DrmInitData.SchemeData> arrayList, ArrayList<e> arrayList2) {
        Format.b d2 = aVar.f4085a.d();
        if (str != null) {
            d2.U(str);
        }
        String str3 = aVar.f4088d;
        if (str3 != null) {
            str2 = str3;
        }
        ArrayList<DrmInitData.SchemeData> arrayList3 = aVar.f4089e;
        arrayList3.addAll(arrayList);
        if (!arrayList3.isEmpty()) {
            r(arrayList3);
            d2.L(new DrmInitData(str2, arrayList3));
        }
        ArrayList<e> arrayList4 = aVar.f4090f;
        arrayList4.addAll(arrayList2);
        return j.o(aVar.f4091g, d2.E(), aVar.f4086b, aVar.f4087c, arrayList4);
    }

    public int j0(@Nullable 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 j, long j2, long j3, long j4, @Nullable List<k.d> list, long j5, @Nullable List<i> list2, long j6, long j7) {
        return new k.b(iVar, j, j2, j3, j4, list, j5, list2, w0.d(j6), w0.d(j7));
    }

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

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

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

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

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

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

    public int o0(@Nullable String str) {
        if (str == null) {
            return 0;
        }
        char c2 = 65535;
        switch (str.hashCode()) {
            case 49:
                if (str.equals(DiskLruCache.VERSION_1)) {
                    c2 = 0;
                    break;
                }
                break;
            case 50:
                if (str.equals(ExifInterface.GPS_MEASUREMENT_2D)) {
                    c2 = 1;
                    break;
                }
                break;
            case 51:
                if (str.equals(ExifInterface.GPS_MEASUREMENT_3D)) {
                    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 512;
            case 1:
                return 2048;
            case 2:
                return 4;
            case 3:
                return 8;
            case 4:
                return 1;
            default:
                return 0;
        }
    }

    @Nullable
    public n p0(XmlPullParser xmlPullParser, String str, @Nullable 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.f4084e.newPullParser();
            newPullParser.setInput(inputStream, null);
            if (newPullParser.next() == 2 && "MPD".equals(newPullParser.getName())) {
                return U(newPullParser, new b(uri.toString()));
            }
            throw ParserException.createForMalformedManifest("inputStream does not contain a valid media presentation description", null);
        } catch (XmlPullParserException e2) {
            throw ParserException.createForMalformedManifest(null, e2);
        }
    }

    public c.g.a.a.z2.u0.m.a w(XmlPullParser xmlPullParser, List<b> list, @Nullable k kVar, long j, long j2, long j3, long j4, long j5) {
        String str;
        long j6;
        ArrayList arrayList;
        ArrayList arrayList2;
        ArrayList arrayList3;
        ArrayList arrayList4;
        ArrayList arrayList5;
        ArrayList<DrmInitData.SchemeData> arrayList6;
        String str2;
        Object obj;
        ArrayList arrayList7;
        int i;
        ArrayList<e> arrayList8;
        long z;
        String str3;
        d dVar = this;
        XmlPullParser xmlPullParser2 = xmlPullParser;
        int Q = Q(xmlPullParser2, "id", -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<DrmInitData.SchemeData> 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 i2 = E;
        String str5 = attributeValue3;
        String str6 = attributeValue4;
        String str7 = null;
        int i3 = -1;
        boolean z2 = false;
        long j7 = j2;
        long j8 = j3;
        while (true) {
            xmlPullParser.next();
            if (s0.f(xmlPullParser2, "BaseURL")) {
                if (!z2) {
                    j7 = dVar.z(xmlPullParser2, j7);
                    z2 = true;
                }
                arrayList16.addAll(A(xmlPullParser, list));
            } else if (s0.f(xmlPullParser2, "ContentProtection")) {
                Pair<String, DrmInitData.SchemeData> D = D(xmlPullParser);
                long j9 = j8;
                Object obj2 = D.first;
                if (obj2 != null) {
                    str7 = (String) obj2;
                }
                Object obj3 = D.second;
                if (obj3 != null) {
                    arrayList9.add((DrmInitData.SchemeData) obj3);
                }
                j8 = j9;
            } else {
                long j10 = j8;
                if (s0.f(xmlPullParser2, "ContentComponent")) {
                    String q = q(str5, xmlPullParser2.getAttributeValue(null, str4));
                    i2 = p(i2, E(xmlPullParser));
                    j6 = j7;
                    arrayList = arrayList16;
                    arrayList7 = arrayList15;
                    arrayList2 = arrayList14;
                    arrayList3 = arrayList13;
                    arrayList4 = arrayList12;
                    arrayList5 = arrayList11;
                    arrayList8 = arrayList10;
                    arrayList6 = arrayList9;
                    str2 = str4;
                    obj = null;
                    str3 = q;
                } else {
                    int i4 = i2;
                    String str8 = str5;
                    if (s0.f(xmlPullParser2, "Role")) {
                        arrayList12.add(G(xmlPullParser2, "Role"));
                    } else if (s0.f(xmlPullParser2, "AudioChannelConfiguration")) {
                        i3 = y(xmlPullParser);
                        j6 = j7;
                        arrayList = arrayList16;
                        arrayList2 = arrayList14;
                        arrayList3 = arrayList13;
                        arrayList4 = arrayList12;
                        arrayList5 = arrayList11;
                        arrayList8 = arrayList10;
                        arrayList6 = arrayList9;
                        str2 = str4;
                        obj = null;
                        i2 = i4;
                        str3 = str8;
                        arrayList7 = arrayList15;
                    } else if (s0.f(xmlPullParser2, "Accessibility")) {
                        arrayList11.add(G(xmlPullParser2, "Accessibility"));
                    } else if (s0.f(xmlPullParser2, "EssentialProperty")) {
                        arrayList13.add(G(xmlPullParser2, "EssentialProperty"));
                    } else if (s0.f(xmlPullParser2, "SupplementalProperty")) {
                        arrayList14.add(G(xmlPullParser2, "SupplementalProperty"));
                    } else if (s0.f(xmlPullParser2, "Representation")) {
                        j6 = j7;
                        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, i3, Q4, str8, arrayList4, arrayList5, arrayList3, arrayList2, eVar, j4, j, j6, j10, j5);
                        int p = p(i4, z.l(Z.f4085a.m));
                        arrayList7 = arrayList15;
                        arrayList7.add(Z);
                        xmlPullParser2 = xmlPullParser;
                        str3 = str8;
                        arrayList8 = arrayList10;
                        i2 = p;
                    } else {
                        str = str8;
                        j6 = j7;
                        arrayList = arrayList16;
                        arrayList2 = arrayList14;
                        arrayList3 = arrayList13;
                        arrayList4 = arrayList12;
                        arrayList5 = arrayList11;
                        ArrayList<e> arrayList17 = arrayList10;
                        arrayList6 = arrayList9;
                        str2 = str4;
                        obj = null;
                        arrayList7 = arrayList15;
                        if (s0.f(xmlPullParser, "SegmentBase")) {
                            eVar = e0(xmlPullParser, (k.e) eVar);
                            str3 = str;
                            arrayList8 = arrayList17;
                            j8 = j10;
                            i2 = i4;
                            xmlPullParser2 = xmlPullParser;
                            if (!s0.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;
                            j7 = j6;
                        } else {
                            if (s0.f(xmlPullParser, "SegmentList")) {
                                z = z(xmlPullParser, j10);
                                i = i4;
                                eVar = f0(xmlPullParser, (k.b) eVar, j4, j, j6, z, j5);
                                xmlPullParser2 = xmlPullParser;
                            } else {
                                j8 = j10;
                                i = i4;
                                if (s0.f(xmlPullParser, "SegmentTemplate")) {
                                    z = z(xmlPullParser, j8);
                                    xmlPullParser2 = xmlPullParser;
                                    eVar = g0(xmlPullParser, (k.c) eVar, arrayList2, j4, j, j6, z, j5);
                                } else {
                                    xmlPullParser2 = xmlPullParser;
                                    if (s0.f(xmlPullParser2, "InbandEventStream")) {
                                        arrayList8 = arrayList17;
                                        arrayList8.add(G(xmlPullParser2, "InbandEventStream"));
                                    } else {
                                        arrayList8 = arrayList17;
                                        if (s0.f(xmlPullParser2, "Label")) {
                                            str6 = R(xmlPullParser);
                                        } else if (s0.e(xmlPullParser)) {
                                            x(xmlPullParser);
                                        }
                                    }
                                    str3 = str;
                                    i2 = i;
                                    if (!s0.d(xmlPullParser2, "AdaptationSet")) {
                                    }
                                }
                            }
                            j8 = z;
                            str3 = str;
                            arrayList8 = arrayList17;
                            i2 = i;
                            if (!s0.d(xmlPullParser2, "AdaptationSet")) {
                            }
                        }
                    }
                    str = str8;
                    j6 = j7;
                    arrayList = arrayList16;
                    arrayList2 = arrayList14;
                    arrayList3 = arrayList13;
                    arrayList4 = arrayList12;
                    arrayList5 = arrayList11;
                    arrayList8 = arrayList10;
                    arrayList6 = arrayList9;
                    str2 = str4;
                    obj = null;
                    i = i4;
                    j8 = j10;
                    arrayList7 = arrayList15;
                    str3 = str;
                    i2 = i;
                    if (!s0.d(xmlPullParser2, "AdaptationSet")) {
                    }
                }
                j8 = j10;
                if (!s0.d(xmlPullParser2, "AdaptationSet")) {
                }
            }
            j6 = j7;
            arrayList7 = arrayList15;
            arrayList2 = arrayList14;
            arrayList3 = arrayList13;
            arrayList4 = arrayList12;
            arrayList5 = arrayList11;
            arrayList8 = arrayList10;
            arrayList6 = arrayList9;
            str2 = str4;
            str3 = str5;
            obj = null;
            arrayList = arrayList16;
            if (!s0.d(xmlPullParser2, "AdaptationSet")) {
            }
        }
        ArrayList arrayList18 = new ArrayList(arrayList7.size());
        for (int i5 = 0; i5 < arrayList7.size(); i5++) {
            arrayList18.add(j((a) arrayList7.get(i5), str6, str7, arrayList6, arrayList8));
        }
        return c(Q, i2, 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 i = -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:
                i = Q(xmlPullParser, "value", -1);
                break;
            case 1:
            case 3:
                i = H(xmlPullParser);
                break;
            case 2:
                i = V(xmlPullParser);
                break;
        }
        do {
            xmlPullParser.next();
        } while (!s0.d(xmlPullParser, "AudioChannelConfiguration"));
        return i;
    }

    public long z(XmlPullParser xmlPullParser, long j) {
        String attributeValue = xmlPullParser.getAttributeValue(null, "availabilityTimeOffset");
        return attributeValue == null ? j : "INF".equals(attributeValue) ? RecyclerView.FOREVER_NS : Float.parseFloat(attributeValue) * 1000000.0f;
    }
}