热汗舞蹈 v1.24.1.0版本的 MD5 值为:f1dc6ef07903515a73f51f41f372123e

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


package d7;

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 com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.ParserException;
import com.google.android.exoplayer2.drm.DrmInitData;
import com.google.android.exoplayer2.l;
import com.google.android.exoplayer2.metadata.emsg.EventMessage;
import com.google.android.exoplayer2.upstream.f;
import com.google.android.exoplayer2.util.Log;
import com.google.common.collect.ImmutableList;
import com.qiyukf.module.log.entry.LogConstants;
import com.sensorsdata.analytics.android.sdk.data.adapter.DbParams;
import com.xiaomi.mipush.sdk.Constants;
import d7.k;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import 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 w7.i0;
import w7.k0;
import w7.l0;
import w7.u;
public class d extends DefaultHandler implements f.a<c> {
    public static final Pattern f29543b = Pattern.compile("(\\d+)(?:/(\\d+))?");
    public static final Pattern f29544c = Pattern.compile("CC([1-4])=.*");
    public static final Pattern f29545d = Pattern.compile("([1-9]|[1-5][0-9]|6[0-3])=.*");
    public static final int[] f29546e = {-1, 1, 2, 3, 4, 5, 6, 8, 2, 3, 4, 7, 8, 24, 8, 12, 10, 12, 14, 12, 14};
    public final XmlPullParserFactory f29547a;

    public static final class a {
        public final com.google.android.exoplayer2.l f29548a;
        public final ImmutableList<b> f29549b;
        public final k f29550c;
        @Nullable
        public final String f29551d;
        public final ArrayList<DrmInitData.SchemeData> f29552e;
        public final ArrayList<e> f29553f;
        public final long f29554g;
        public final List<e> f29555h;
        public final List<e> f29556i;

        public a(com.google.android.exoplayer2.l lVar, List<b> list, k kVar, @Nullable String str, ArrayList<DrmInitData.SchemeData> arrayList, ArrayList<e> arrayList2, List<e> list2, List<e> list3, long j10) {
            this.f29548a = lVar;
            this.f29549b = ImmutableList.s(list);
            this.f29550c = kVar;
            this.f29551d = str;
            this.f29552e = arrayList;
            this.f29553f = arrayList2;
            this.f29555h = list2;
            this.f29556i = list3;
            this.f29554g = j10;
        }
    }

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

    public static int C(List<e> list) {
        String str;
        for (int i10 = 0; i10 < list.size(); i10++) {
            e eVar = list.get(i10);
            if ("urn:scte:dash:cc:cea-608:2015".equals(eVar.f29557a) && (str = eVar.f29558b) != null) {
                Matcher matcher = f29544c.matcher(str);
                if (matcher.matches()) {
                    return Integer.parseInt(matcher.group(1));
                }
                String valueOf = String.valueOf(eVar.f29558b);
                Log.i("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 D(List<e> list) {
        String str;
        for (int i10 = 0; i10 < list.size(); i10++) {
            e eVar = list.get(i10);
            if ("urn:scte:dash:cc:cea-708:2015".equals(eVar.f29557a) && (str = eVar.f29558b) != null) {
                Matcher matcher = f29545d.matcher(str);
                if (matcher.matches()) {
                    return Integer.parseInt(matcher.group(1));
                }
                String valueOf = String.valueOf(eVar.f29558b);
                Log.i("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 G(XmlPullParser xmlPullParser, String str, long j10) throws ParserException {
        String attributeValue = xmlPullParser.getAttributeValue(null, str);
        return attributeValue == null ? j10 : k0.J0(attributeValue);
    }

    public static e H(XmlPullParser xmlPullParser, String str) throws XmlPullParserException, IOException {
        String o02 = o0(xmlPullParser, "schemeIdUri", "");
        String o03 = o0(xmlPullParser, DbParams.VALUE, null);
        String o04 = o0(xmlPullParser, "id", null);
        do {
            xmlPullParser.next();
        } while (!l0.d(xmlPullParser, str));
        return new e(o02, o03, o04);
    }

    public static int I(XmlPullParser xmlPullParser) {
        char c10;
        String attributeValue = xmlPullParser.getAttributeValue(null, DbParams.VALUE);
        if (attributeValue == null) {
            return -1;
        }
        String e10 = com.google.common.base.a.e(attributeValue);
        e10.hashCode();
        switch (e10.hashCode()) {
            case 1596796:
                if (e10.equals("4000")) {
                    c10 = 0;
                    break;
                }
                c10 = 65535;
                break;
            case 2937391:
                if (e10.equals("a000")) {
                    c10 = 1;
                    break;
                }
                c10 = 65535;
                break;
            case 3094035:
                if (e10.equals("f801")) {
                    c10 = 2;
                    break;
                }
                c10 = 65535;
                break;
            case 3133436:
                if (e10.equals("fa01")) {
                    c10 = 3;
                    break;
                }
                c10 = 65535;
                break;
            default:
                c10 = 65535;
                break;
        }
        switch (c10) {
            case 0:
                return 1;
            case 1:
                return 2;
            case 2:
                return 6;
            case 3:
                return 8;
            default:
                return -1;
        }
    }

    public static long J(XmlPullParser xmlPullParser, String str, long j10) {
        String attributeValue = xmlPullParser.getAttributeValue(null, str);
        return attributeValue == null ? j10 : k0.K0(attributeValue);
    }

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

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

    public static float P(XmlPullParser xmlPullParser, float f10) {
        String attributeValue = xmlPullParser.getAttributeValue(null, "frameRate");
        if (attributeValue != null) {
            Matcher matcher = f29543b.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 f10;
        }
        return f10;
    }

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

    public static long T(List<e> list) {
        for (int i10 = 0; i10 < list.size(); i10++) {
            e eVar = list.get(i10);
            if (com.google.common.base.a.a("http://dashif.org/guidelines/last-segment-number", eVar.f29557a)) {
                return Long.parseLong(eVar.f29558b);
            }
        }
        return -1L;
    }

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

    public static int W(XmlPullParser xmlPullParser) {
        int R = R(xmlPullParser, DbParams.VALUE, -1);
        if (R >= 0) {
            int[] iArr = f29546e;
            if (R < iArr.length) {
                return iArr[R];
            }
            return -1;
        }
        return -1;
    }

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

    public static int p(int i10, int i11) {
        if (i10 == -1) {
            return i11;
        }
        if (i11 == -1) {
            return i10;
        }
        w7.a.f(i10 == i11);
        return i10;
    }

    public static String p0(XmlPullParser xmlPullParser, String str) throws XmlPullParserException, IOException {
        String str2 = "";
        do {
            xmlPullParser.next();
            if (xmlPullParser.getEventType() == 4) {
                str2 = xmlPullParser.getText();
            } else {
                v(xmlPullParser);
            }
        } while (!l0.d(xmlPullParser, str));
        return str2;
    }

    @Nullable
    public static String q(@Nullable String str, @Nullable String str2) {
        if (str == null) {
            return str2;
        }
        if (str2 == null) {
            return str;
        }
        w7.a.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.d()) {
                int i10 = 0;
                while (true) {
                    if (i10 >= arrayList.size()) {
                        break;
                    } else if (arrayList.get(i10).b(schemeData)) {
                        arrayList.remove(size);
                        break;
                    } else {
                        i10++;
                    }
                }
            }
        }
    }

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

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

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

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

    public List<b> B(XmlPullParser xmlPullParser, List<b> list, boolean z10) throws XmlPullParserException, IOException {
        int i10;
        String attributeValue = xmlPullParser.getAttributeValue(null, "dvb:priority");
        if (attributeValue != null) {
            i10 = Integer.parseInt(attributeValue);
        } else {
            i10 = z10 ? 1 : Integer.MIN_VALUE;
        }
        String attributeValue2 = xmlPullParser.getAttributeValue(null, "dvb:weight");
        int parseInt = attributeValue2 != null ? Integer.parseInt(attributeValue2) : 1;
        String attributeValue3 = xmlPullParser.getAttributeValue(null, "serviceLocation");
        String p02 = p0(xmlPullParser, "BaseURL");
        if (i0.b(p02)) {
            if (attributeValue3 == null) {
                attributeValue3 = p02;
            }
            return com.google.common.collect.n.j(new b(p02, attributeValue3, i10, parseInt));
        }
        ArrayList arrayList = new ArrayList();
        for (int i11 = 0; i11 < list.size(); i11++) {
            b bVar = list.get(i11);
            String d10 = i0.d(bVar.f29526a, p02);
            String str = attributeValue3 == null ? d10 : attributeValue3;
            if (z10) {
                i10 = bVar.f29528c;
                parseInt = bVar.f29529d;
                str = bVar.f29527b;
            }
            arrayList.add(new b(d10, str, i10, parseInt));
        }
        return arrayList;
    }

    public Pair<String, DrmInitData.SchemeData> E(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 e10 = com.google.common.base.a.e(attributeValue);
            e10.hashCode();
            char c10 = 65535;
            switch (e10.hashCode()) {
                case 489446379:
                    if (e10.equals("urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95")) {
                        c10 = 0;
                        break;
                    }
                    break;
                case 755418770:
                    if (e10.equals("urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed")) {
                        c10 = 1;
                        break;
                    }
                    break;
                case 1812765994:
                    if (e10.equals("urn:mpeg:dash:mp4protection:2011")) {
                        c10 = 2;
                        break;
                    }
                    break;
            }
            switch (c10) {
                case 0:
                    uuid = C.f12746e;
                    str = null;
                    uuid2 = null;
                    bArr = uuid2;
                    bArr2 = uuid2;
                    break;
                case 1:
                    uuid = C.f12745d;
                    str = null;
                    uuid2 = null;
                    bArr = uuid2;
                    bArr2 = uuid2;
                    break;
                case 2:
                    str = xmlPullParser.getAttributeValue(null, DbParams.VALUE);
                    String b10 = l0.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 i10 = 0; i10 < split.length; i10++) {
                            uuidArr[i10] = UUID.fromString(split[i10]);
                        }
                        uuid = C.f12743b;
                        bArr = null;
                        bArr2 = l6.g.b(uuid, uuidArr, null);
                        break;
                    } else {
                        uuid = null;
                        uuid2 = uuid;
                        bArr = uuid2;
                        bArr2 = uuid2;
                        break;
                    }
            }
            do {
                xmlPullParser.next();
                if (!l0.f(xmlPullParser, "ms:laurl")) {
                    bArr = xmlPullParser.getAttributeValue(null, "licenseUrl");
                    bArr2 = bArr2;
                } else if (bArr2 == null && l0.g(xmlPullParser, "pssh") && xmlPullParser.next() == 4) {
                    byte[] decode = Base64.decode(xmlPullParser.getText(), 0);
                    UUID f10 = l6.g.f(decode);
                    if (f10 == null) {
                        Log.i("MpdParser", "Skipping malformed cenc:pssh data");
                        uuid = f10;
                        bArr2 = null;
                    } else {
                        bArr2 = decode;
                        uuid = f10;
                    }
                } else {
                    if (bArr2 == null) {
                        UUID uuid3 = C.f12746e;
                        if (uuid3.equals(uuid) && l0.f(xmlPullParser, "mspr:pro") && xmlPullParser.next() == 4) {
                            bArr2 = l6.g.a(uuid3, Base64.decode(xmlPullParser.getText(), 0));
                        }
                    }
                    v(xmlPullParser);
                    bArr2 = bArr2;
                }
            } while (!l0.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 (!l0.f(xmlPullParser, "ms:laurl")) {
            }
        } while (!l0.d(xmlPullParser, "ContentProtection"));
        return Pair.create(str, uuid != null ? new DrmInitData.SchemeData(uuid, bArr, "video/mp4", bArr2) : null);
    }

    public int F(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> L(XmlPullParser xmlPullParser, String str, String str2, long j10, ByteArrayOutputStream byteArrayOutputStream) throws IOException, XmlPullParserException {
        long U = U(xmlPullParser, "id", 0L);
        long U2 = U(xmlPullParser, TypedValues.TransitionType.S_DURATION, -9223372036854775807L);
        long U3 = U(xmlPullParser, "presentationTime", 0L);
        long O0 = k0.O0(U2, 1000L, j10);
        long O02 = k0.O0(U3, 1000000L, j10);
        String o02 = o0(xmlPullParser, "messageData", null);
        byte[] M = M(xmlPullParser, byteArrayOutputStream);
        Long valueOf = Long.valueOf(O02);
        if (o02 != null) {
            M = k0.n0(o02);
        }
        return Pair.create(valueOf, d(str, str2, U, O0, M));
    }

    public byte[] M(XmlPullParser xmlPullParser, ByteArrayOutputStream byteArrayOutputStream) throws XmlPullParserException, IOException {
        byteArrayOutputStream.reset();
        XmlSerializer newSerializer = Xml.newSerializer();
        newSerializer.setOutput(byteArrayOutputStream, com.google.common.base.c.f16438c.name());
        xmlPullParser.nextToken();
        while (!l0.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 i10 = 0; i10 < xmlPullParser.getAttributeCount(); i10++) {
                        newSerializer.attribute(xmlPullParser.getAttributeNamespace(i10), xmlPullParser.getAttributeName(i10), xmlPullParser.getAttributeValue(i10));
                    }
                    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 N(XmlPullParser xmlPullParser) throws XmlPullParserException, IOException {
        String o02 = o0(xmlPullParser, "schemeIdUri", "");
        String o03 = o0(xmlPullParser, DbParams.VALUE, "");
        long U = U(xmlPullParser, "timescale", 1L);
        ArrayList arrayList = new ArrayList();
        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(512);
        do {
            xmlPullParser.next();
            if (l0.f(xmlPullParser, "Event")) {
                arrayList.add(L(xmlPullParser, o02, o03, U, byteArrayOutputStream));
            } else {
                v(xmlPullParser);
            }
        } while (!l0.d(xmlPullParser, "EventStream"));
        long[] jArr = new long[arrayList.size()];
        EventMessage[] eventMessageArr = new EventMessage[arrayList.size()];
        for (int i10 = 0; i10 < arrayList.size(); i10++) {
            Pair pair = (Pair) arrayList.get(i10);
            jArr[i10] = ((Long) pair.first).longValue();
            eventMessageArr[i10] = (EventMessage) pair.second;
        }
        return e(o02, o03, U, jArr, eventMessageArr);
    }

    public i Q(XmlPullParser xmlPullParser) {
        return a0(xmlPullParser, "sourceURL", "range");
    }

    public String S(XmlPullParser xmlPullParser) throws XmlPullParserException, IOException {
        return p0(xmlPullParser, "Label");
    }

    public c V(XmlPullParser xmlPullParser, Uri uri) throws XmlPullParserException, IOException {
        long j10;
        ArrayList arrayList;
        ArrayList arrayList2;
        long j11;
        Throwable th;
        ArrayList arrayList3;
        long j12;
        boolean z10;
        long j13;
        d dVar = this;
        boolean u10 = dVar.u(dVar.Y(xmlPullParser, "profiles", new String[0]));
        long j14 = -9223372036854775807L;
        long G = G(xmlPullParser, "availabilityStartTime", -9223372036854775807L);
        long J = J(xmlPullParser, "mediaPresentationDuration", -9223372036854775807L);
        long J2 = J(xmlPullParser, "minBufferTime", -9223372036854775807L);
        Throwable th2 = null;
        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);
        long j15 = equals ? 0L : -9223372036854775807L;
        ArrayList j16 = com.google.common.collect.n.j(new b(uri.toString(), uri.toString(), u10 ? 1 : Integer.MIN_VALUE, 1));
        ArrayList arrayList4 = new ArrayList();
        ArrayList arrayList5 = new ArrayList();
        long j17 = equals ? -9223372036854775807L : 0L;
        h hVar = null;
        o oVar = null;
        Uri uri2 = null;
        l lVar = null;
        boolean z11 = false;
        boolean z12 = false;
        while (true) {
            xmlPullParser.next();
            if (l0.f(xmlPullParser, "BaseURL")) {
                if (!z11) {
                    j15 = dVar.A(xmlPullParser, j15);
                    z11 = true;
                }
                arrayList5.addAll(dVar.B(xmlPullParser, j16, u10));
            } else if (l0.f(xmlPullParser, "ProgramInformation")) {
                hVar = Z(xmlPullParser);
            } else if (l0.f(xmlPullParser, "UTCTiming")) {
                oVar = s0(xmlPullParser);
            } else if (l0.f(xmlPullParser, "Location")) {
                uri2 = i0.e(uri.toString(), xmlPullParser.nextText());
            } else if (l0.f(xmlPullParser, "ServiceDescription")) {
                lVar = n0(xmlPullParser);
            } else {
                if (l0.f(xmlPullParser, "Period") && !z12) {
                    j10 = j15;
                    ArrayList arrayList6 = arrayList4;
                    arrayList = arrayList5;
                    arrayList2 = j16;
                    j11 = j14;
                    th = th2;
                    Pair<g, Long> X = X(xmlPullParser, !arrayList5.isEmpty() ? arrayList5 : j16, j17, j10, G, J4, u10);
                    g gVar = (g) X.first;
                    if (gVar.f29566b != j11) {
                        long longValue = ((Long) X.second).longValue();
                        if (longValue == j11) {
                            arrayList3 = arrayList6;
                            j12 = j11;
                        } else {
                            j12 = gVar.f29566b + longValue;
                            arrayList3 = arrayList6;
                        }
                        arrayList3.add(gVar);
                        j17 = j12;
                        z10 = z12;
                    } else if (!equals) {
                        int size = arrayList6.size();
                        StringBuilder sb2 = new StringBuilder(47);
                        sb2.append("Unable to determine start of period ");
                        sb2.append(size);
                        throw ParserException.c(sb2.toString(), th);
                    } else {
                        arrayList3 = arrayList6;
                        z10 = true;
                    }
                    z12 = z10;
                } else {
                    j10 = j15;
                    arrayList = arrayList5;
                    arrayList2 = j16;
                    j11 = j14;
                    th = th2;
                    arrayList3 = arrayList4;
                    v(xmlPullParser);
                }
                j15 = j10;
                if (l0.d(xmlPullParser, "MPD")) {
                    arrayList4 = arrayList3;
                    th2 = th;
                    arrayList5 = arrayList;
                    j16 = arrayList2;
                    j14 = j11;
                    dVar = this;
                } else {
                    if (J == j11) {
                        if (j17 != j11) {
                            j13 = j17;
                            if (arrayList3.isEmpty()) {
                                return g(G, j13, J2, equals, J3, J4, J5, G2, hVar, oVar, lVar, uri2, arrayList3);
                            }
                            throw ParserException.c("No periods found.", th);
                        } else if (!equals) {
                            throw ParserException.c("Unable to determine duration of static manifest.", th);
                        }
                    }
                    j13 = J;
                    if (arrayList3.isEmpty()) {
                    }
                }
            }
            arrayList = arrayList5;
            arrayList2 = j16;
            j11 = j14;
            th = th2;
            arrayList3 = arrayList4;
            if (l0.d(xmlPullParser, "MPD")) {
            }
        }
    }

    public Pair<g, Long> X(XmlPullParser xmlPullParser, List<b> list, long j10, long j11, long j12, long j13, boolean z10) throws XmlPullParserException, IOException {
        long j14;
        ArrayList arrayList;
        ArrayList arrayList2;
        ArrayList arrayList3;
        Object obj;
        long j15;
        k i02;
        d dVar = this;
        XmlPullParser xmlPullParser2 = xmlPullParser;
        Object obj2 = null;
        String attributeValue = xmlPullParser2.getAttributeValue(null, "id");
        long J = J(xmlPullParser2, LogConstants.FIND_START, j10);
        long j16 = -9223372036854775807L;
        long j17 = j12 != -9223372036854775807L ? j12 + J : -9223372036854775807L;
        long J2 = J(xmlPullParser2, TypedValues.TransitionType.S_DURATION, -9223372036854775807L);
        ArrayList arrayList4 = new ArrayList();
        ArrayList arrayList5 = new ArrayList();
        ArrayList arrayList6 = new ArrayList();
        long j18 = j11;
        long j19 = -9223372036854775807L;
        k.e eVar = null;
        e eVar2 = null;
        boolean z11 = false;
        while (true) {
            xmlPullParser.next();
            if (l0.f(xmlPullParser2, "BaseURL")) {
                if (!z11) {
                    j18 = dVar.A(xmlPullParser2, j18);
                    z11 = true;
                }
                arrayList6.addAll(dVar.B(xmlPullParser2, list, z10));
                arrayList3 = arrayList5;
                arrayList = arrayList6;
                j15 = j16;
                obj = obj2;
                arrayList2 = arrayList4;
            } else {
                if (l0.f(xmlPullParser2, "AdaptationSet")) {
                    j14 = j18;
                    arrayList = arrayList6;
                    arrayList2 = arrayList4;
                    arrayList2.add(x(xmlPullParser, !arrayList6.isEmpty() ? arrayList6 : list, eVar, J2, j18, j19, j17, j13, z10));
                    xmlPullParser2 = xmlPullParser;
                    arrayList3 = arrayList5;
                } else {
                    j14 = j18;
                    ArrayList arrayList7 = arrayList5;
                    arrayList = arrayList6;
                    arrayList2 = arrayList4;
                    xmlPullParser2 = xmlPullParser;
                    if (l0.f(xmlPullParser2, "EventStream")) {
                        arrayList7.add(N(xmlPullParser));
                        arrayList3 = arrayList7;
                    } else if (l0.f(xmlPullParser2, "SegmentBase")) {
                        arrayList3 = arrayList7;
                        eVar = g0(xmlPullParser2, null);
                        obj = null;
                        j18 = j14;
                        j15 = -9223372036854775807L;
                    } else {
                        arrayList3 = arrayList7;
                        if (l0.f(xmlPullParser2, "SegmentList")) {
                            long A = A(xmlPullParser2, -9223372036854775807L);
                            obj = null;
                            i02 = h0(xmlPullParser, null, j17, J2, j14, A, j13);
                            j19 = A;
                            j18 = j14;
                            j15 = -9223372036854775807L;
                        } else {
                            obj = null;
                            if (l0.f(xmlPullParser2, "SegmentTemplate")) {
                                long A2 = A(xmlPullParser2, -9223372036854775807L);
                                j15 = -9223372036854775807L;
                                i02 = i0(xmlPullParser, null, ImmutableList.w(), j17, J2, j14, A2, j13);
                                j19 = A2;
                                j18 = j14;
                            } else {
                                j15 = -9223372036854775807L;
                                if (l0.f(xmlPullParser2, "AssetIdentifier")) {
                                    eVar2 = H(xmlPullParser2, "AssetIdentifier");
                                } else {
                                    v(xmlPullParser);
                                }
                                j18 = j14;
                            }
                        }
                        eVar = i02;
                    }
                }
                obj = null;
                j15 = -9223372036854775807L;
                j18 = j14;
            }
            if (l0.d(xmlPullParser2, "Period")) {
                return Pair.create(h(attributeValue, J, arrayList2, arrayList3, eVar2), Long.valueOf(J2));
            }
            arrayList4 = arrayList2;
            arrayList6 = arrayList;
            obj2 = obj;
            arrayList5 = arrayList3;
            j16 = j15;
            dVar = this;
        }
    }

    public String[] Y(XmlPullParser xmlPullParser, String str, String[] strArr) {
        String attributeValue = xmlPullParser.getAttributeValue(null, str);
        return attributeValue == null ? strArr : attributeValue.split(Constants.ACCEPT_TIME_SEPARATOR_SP);
    }

    public h Z(XmlPullParser xmlPullParser) throws IOException, XmlPullParserException {
        String str = null;
        String o02 = o0(xmlPullParser, "moreInformationURL", null);
        String o03 = o0(xmlPullParser, "lang", null);
        String str2 = null;
        String str3 = null;
        while (true) {
            xmlPullParser.next();
            if (l0.f(xmlPullParser, "Title")) {
                str = xmlPullParser.nextText();
            } else if (l0.f(xmlPullParser, "Source")) {
                str2 = xmlPullParser.nextText();
            } else if (l0.f(xmlPullParser, ExifInterface.TAG_COPYRIGHT)) {
                str3 = xmlPullParser.nextText();
            } else {
                v(xmlPullParser);
            }
            String str4 = str3;
            if (l0.d(xmlPullParser, "ProgramInformation")) {
                return new h(str, str2, str4, o02, o03);
            }
            str3 = str4;
        }
    }

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

    public final long b(List<k.d> list, long j10, long j11, int i10, long j12) {
        int m10 = i10 >= 0 ? i10 + 1 : (int) k0.m(j12 - j10, j11);
        for (int i11 = 0; i11 < m10; i11++) {
            list.add(m(j10, j11));
            j10 += j11;
        }
        return j10;
    }

    public a b0(XmlPullParser xmlPullParser, List<b> list, @Nullable String str, @Nullable String str2, int i10, int i11, float f10, int i12, int i13, @Nullable String str3, List<e> list2, List<e> list3, List<e> list4, List<e> list5, @Nullable k kVar, long j10, long j11, long j12, long j13, long j14, boolean z10) throws XmlPullParserException, IOException {
        long j15;
        ArrayList arrayList;
        ArrayList arrayList2;
        ArrayList arrayList3;
        ArrayList arrayList4;
        ArrayList arrayList5;
        ArrayList arrayList6;
        ArrayList arrayList7;
        int i14;
        long A;
        k kVar2;
        d dVar = this;
        String attributeValue = xmlPullParser.getAttributeValue(null, "id");
        int R = R(xmlPullParser, "bandwidth", -1);
        String o02 = o0(xmlPullParser, "mimeType", str);
        String o03 = o0(xmlPullParser, "codecs", str2);
        int R2 = R(xmlPullParser, "width", i10);
        int R3 = R(xmlPullParser, "height", i11);
        float P = P(xmlPullParser, f10);
        int R4 = R(xmlPullParser, "audioSamplingRate", i13);
        ArrayList arrayList8 = new ArrayList();
        ArrayList arrayList9 = new ArrayList();
        ArrayList arrayList10 = new ArrayList(list4);
        ArrayList arrayList11 = new ArrayList(list5);
        ArrayList arrayList12 = new ArrayList();
        int i15 = i12;
        long j16 = j12;
        long j17 = j13;
        String str4 = null;
        boolean z11 = false;
        k kVar3 = kVar;
        while (true) {
            xmlPullParser.next();
            if (l0.f(xmlPullParser, "BaseURL")) {
                if (!z11) {
                    j16 = dVar.A(xmlPullParser, j16);
                    z11 = true;
                }
                arrayList12.addAll(dVar.B(xmlPullParser, list, z10));
            } else if (l0.f(xmlPullParser, "AudioChannelConfiguration")) {
                kVar2 = kVar3;
                arrayList = arrayList12;
                arrayList5 = arrayList8;
                i14 = z(xmlPullParser);
                arrayList6 = arrayList9;
                arrayList7 = arrayList11;
                if (l0.d(xmlPullParser, "Representation")) {
                    break;
                }
                arrayList11 = arrayList7;
                arrayList9 = arrayList6;
                arrayList8 = arrayList5;
                kVar3 = kVar2;
                dVar = this;
                i15 = i14;
                arrayList12 = arrayList;
            } else if (l0.f(xmlPullParser, "SegmentBase")) {
                kVar3 = dVar.g0(xmlPullParser, (k.e) kVar3);
            } else {
                if (l0.f(xmlPullParser, "SegmentList")) {
                    A = dVar.A(xmlPullParser, j17);
                    j15 = j16;
                    arrayList = arrayList12;
                    arrayList2 = arrayList11;
                    arrayList3 = arrayList9;
                    arrayList4 = arrayList10;
                    kVar3 = h0(xmlPullParser, (k.b) kVar3, j10, j11, j15, A, j14);
                    arrayList5 = arrayList8;
                } else {
                    j15 = j16;
                    arrayList = arrayList12;
                    arrayList2 = arrayList11;
                    arrayList3 = arrayList9;
                    arrayList4 = arrayList10;
                    if (l0.f(xmlPullParser, "SegmentTemplate")) {
                        A = dVar.A(xmlPullParser, j17);
                        arrayList5 = arrayList8;
                        kVar3 = i0(xmlPullParser, (k.c) kVar3, list5, j10, j11, j15, A, j14);
                    } else {
                        arrayList5 = arrayList8;
                        if (l0.f(xmlPullParser, "ContentProtection")) {
                            Pair<String, DrmInitData.SchemeData> E = E(xmlPullParser);
                            Object obj = E.first;
                            if (obj != null) {
                                str4 = (String) obj;
                            }
                            Object obj2 = E.second;
                            if (obj2 != null) {
                                arrayList5.add((DrmInitData.SchemeData) obj2);
                            }
                            i14 = i15;
                            j16 = j15;
                            arrayList7 = arrayList2;
                            arrayList6 = arrayList3;
                            arrayList10 = arrayList4;
                            kVar2 = kVar3;
                            if (l0.d(xmlPullParser, "Representation")) {
                            }
                        } else {
                            if (l0.f(xmlPullParser, "InbandEventStream")) {
                                arrayList6 = arrayList3;
                                arrayList6.add(H(xmlPullParser, "InbandEventStream"));
                                arrayList7 = arrayList2;
                                arrayList10 = arrayList4;
                            } else {
                                arrayList6 = arrayList3;
                                if (l0.f(xmlPullParser, "EssentialProperty")) {
                                    arrayList10 = arrayList4;
                                    arrayList10.add(H(xmlPullParser, "EssentialProperty"));
                                    arrayList7 = arrayList2;
                                } else {
                                    arrayList10 = arrayList4;
                                    if (l0.f(xmlPullParser, "SupplementalProperty")) {
                                        arrayList7 = arrayList2;
                                        arrayList7.add(H(xmlPullParser, "SupplementalProperty"));
                                    } else {
                                        arrayList7 = arrayList2;
                                        v(xmlPullParser);
                                    }
                                }
                            }
                            i14 = i15;
                            j16 = j15;
                            kVar2 = kVar3;
                            if (l0.d(xmlPullParser, "Representation")) {
                            }
                        }
                    }
                }
                i14 = i15;
                j17 = A;
                j16 = j15;
                arrayList7 = arrayList2;
                arrayList6 = arrayList3;
                arrayList10 = arrayList4;
                kVar2 = kVar3;
                if (l0.d(xmlPullParser, "Representation")) {
                }
            }
            arrayList = arrayList12;
            arrayList5 = arrayList8;
            i14 = i15;
            kVar2 = kVar3;
            arrayList6 = arrayList9;
            arrayList7 = arrayList11;
            if (l0.d(xmlPullParser, "Representation")) {
            }
        }
        ArrayList arrayList13 = arrayList7;
        ArrayList arrayList14 = arrayList10;
        ArrayList arrayList15 = arrayList6;
        com.google.android.exoplayer2.l f11 = f(attributeValue, o02, R2, R3, P, i14, R4, R, str3, list2, list3, o03, arrayList14, arrayList13);
        k.e eVar = kVar2;
        if (kVar2 == null) {
            eVar = new k.e();
        }
        boolean isEmpty = arrayList.isEmpty();
        ArrayList arrayList16 = arrayList;
        if (isEmpty) {
            arrayList16 = list;
        }
        return new a(f11, arrayList16, eVar, str4, arrayList5, arrayList15, arrayList14, arrayList13, -1L);
    }

    public d7.a c(int i10, int i11, List<j> list, List<e> list2, List<e> list3, List<e> list4) {
        return new d7.a(i10, i11, list, list2, list3, list4);
    }

    public int c0(List<e> list) {
        int q02;
        int i10 = 0;
        for (int i11 = 0; i11 < list.size(); i11++) {
            e eVar = list.get(i11);
            if (com.google.common.base.a.a("urn:mpeg:dash:role:2011", eVar.f29557a)) {
                q02 = d0(eVar.f29558b);
            } else if (com.google.common.base.a.a("urn:tva:metadata:cs:AudioPurposeCS:2007", eVar.f29557a)) {
                q02 = q0(eVar.f29558b);
            }
            i10 |= q02;
        }
        return i10;
    }

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

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

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

    public int e0(List<e> list) {
        int i10 = 0;
        for (int i11 = 0; i11 < list.size(); i11++) {
            if (com.google.common.base.a.a("http://dashif.org/guidelines/trickmode", list.get(i11).f29557a)) {
                i10 |= 16384;
            }
        }
        return i10;
    }

    public com.google.android.exoplayer2.l f(@Nullable String str, @Nullable String str2, int i10, int i11, float f10, int i12, int i13, int i14, @Nullable String str3, List<e> list, List<e> list2, @Nullable String str4, List<e> list3, List<e> list4) {
        String str5 = str4;
        String t10 = t(str2, str5);
        if ("audio/eac3".equals(t10)) {
            t10 = K(list4);
            if ("audio/eac3-joc".equals(t10)) {
                str5 = "ec+3";
            }
        }
        int m02 = m0(list);
        l.b V = new l.b().S(str).K(str2).e0(t10).I(str5).Z(i14).g0(m02).c0(f0(list) | c0(list2) | e0(list3) | e0(list4)).V(str3);
        if (u.t(t10)) {
            V.j0(i10).Q(i11).P(f10);
        } else if (u.p(t10)) {
            V.H(i12).f0(i13);
        } else if (u.s(t10)) {
            int i15 = -1;
            if ("application/cea-608".equals(t10)) {
                i15 = C(list2);
            } else if ("application/cea-708".equals(t10)) {
                i15 = D(list2);
            }
            V.F(i15);
        } else if (u.q(t10)) {
            V.j0(i10).Q(i11);
        }
        return V.E();
    }

    public int f0(List<e> list) {
        int i10 = 0;
        for (int i11 = 0; i11 < list.size(); i11++) {
            e eVar = list.get(i11);
            if (com.google.common.base.a.a("urn:mpeg:dash:role:2011", eVar.f29557a)) {
                i10 |= d0(eVar.f29558b);
            }
        }
        return i10;
    }

    public c g(long j10, long j11, long j12, boolean z10, long j13, long j14, long j15, long j16, @Nullable h hVar, @Nullable o oVar, @Nullable l lVar, @Nullable Uri uri, List<g> list) {
        return new c(j10, j11, j12, z10, j13, j14, j15, j16, hVar, oVar, lVar, uri, list);
    }

    public k.e g0(XmlPullParser xmlPullParser, @Nullable k.e eVar) throws XmlPullParserException, IOException {
        long j10;
        long j11;
        long U = U(xmlPullParser, "timescale", eVar != null ? eVar.f29594b : 1L);
        long U2 = U(xmlPullParser, "presentationTimeOffset", eVar != null ? eVar.f29595c : 0L);
        long j12 = eVar != null ? eVar.f29608d : 0L;
        long j13 = eVar != null ? eVar.f29609e : 0L;
        String attributeValue = xmlPullParser.getAttributeValue(null, "indexRange");
        if (attributeValue != null) {
            String[] split = attributeValue.split(Constants.ACCEPT_TIME_SEPARATOR_SERVER);
            long parseLong = Long.parseLong(split[0]);
            j10 = (Long.parseLong(split[1]) - parseLong) + 1;
            j11 = parseLong;
        } else {
            j10 = j13;
            j11 = j12;
        }
        i iVar = eVar != null ? eVar.f29593a : null;
        do {
            xmlPullParser.next();
            if (l0.f(xmlPullParser, "Initialization")) {
                iVar = Q(xmlPullParser);
            } else {
                v(xmlPullParser);
            }
        } while (!l0.d(xmlPullParser, "SegmentBase"));
        return n(iVar, U, U2, j11, j10);
    }

    public g h(@Nullable String str, long j10, List<d7.a> list, List<f> list2, @Nullable e eVar) {
        return new g(str, j10, list, list2, eVar);
    }

    public k.b h0(XmlPullParser xmlPullParser, @Nullable k.b bVar, long j10, long j11, long j12, long j13, long j14) throws XmlPullParserException, IOException {
        long U = U(xmlPullParser, "timescale", bVar != null ? bVar.f29594b : 1L);
        long U2 = U(xmlPullParser, "presentationTimeOffset", bVar != null ? bVar.f29595c : 0L);
        long U3 = U(xmlPullParser, TypedValues.TransitionType.S_DURATION, bVar != null ? bVar.f29597e : -9223372036854775807L);
        long U4 = U(xmlPullParser, "startNumber", bVar != null ? bVar.f29596d : 1L);
        long s10 = s(j12, j13);
        List<k.d> list = null;
        List<i> list2 = null;
        i iVar = null;
        do {
            xmlPullParser.next();
            if (l0.f(xmlPullParser, "Initialization")) {
                iVar = Q(xmlPullParser);
            } else if (l0.f(xmlPullParser, "SegmentTimeline")) {
                list = j0(xmlPullParser, U, j11);
            } else if (l0.f(xmlPullParser, "SegmentURL")) {
                if (list2 == null) {
                    list2 = new ArrayList<>();
                }
                list2.add(k0(xmlPullParser));
            } else {
                v(xmlPullParser);
            }
        } while (!l0.d(xmlPullParser, "SegmentList"));
        if (bVar != null) {
            if (iVar == null) {
                iVar = bVar.f29593a;
            }
            if (list == null) {
                list = bVar.f29598f;
            }
            if (list2 == null) {
                list2 = bVar.f29602j;
            }
        }
        return k(iVar, U, U2, U4, U3, list, s10, list2, j14, j10);
    }

    public i i(String str, long j10, long j11) {
        return new i(str, j10, j11);
    }

    public k.c i0(XmlPullParser xmlPullParser, @Nullable k.c cVar, List<e> list, long j10, long j11, long j12, long j13, long j14) throws XmlPullParserException, IOException {
        long U = U(xmlPullParser, "timescale", cVar != null ? cVar.f29594b : 1L);
        long U2 = U(xmlPullParser, "presentationTimeOffset", cVar != null ? cVar.f29595c : 0L);
        long U3 = U(xmlPullParser, TypedValues.TransitionType.S_DURATION, cVar != null ? cVar.f29597e : -9223372036854775807L);
        long U4 = U(xmlPullParser, "startNumber", cVar != null ? cVar.f29596d : 1L);
        long T = T(list);
        long s10 = s(j12, j13);
        List<k.d> list2 = null;
        n r02 = r0(xmlPullParser, "media", cVar != null ? cVar.f29604k : null);
        n r03 = r0(xmlPullParser, "initialization", cVar != null ? cVar.f29603j : null);
        i iVar = null;
        while (true) {
            xmlPullParser.next();
            if (l0.f(xmlPullParser, "Initialization")) {
                iVar = Q(xmlPullParser);
            } else if (l0.f(xmlPullParser, "SegmentTimeline")) {
                list2 = j0(xmlPullParser, U, j11);
            } else {
                v(xmlPullParser);
            }
            if (l0.d(xmlPullParser, "SegmentTemplate")) {
                break;
            }
        }
        if (cVar != null) {
            if (iVar == null) {
                iVar = cVar.f29593a;
            }
            if (list2 == null) {
                list2 = cVar.f29598f;
            }
        }
        return l(iVar, U, U2, U4, T, U3, list2, s10, r03, r02, j14, j10);
    }

    public j j(a aVar, @Nullable String str, @Nullable String str2, ArrayList<DrmInitData.SchemeData> arrayList, ArrayList<e> arrayList2) {
        l.b c10 = aVar.f29548a.c();
        if (str != null) {
            c10.U(str);
        }
        String str3 = aVar.f29551d;
        if (str3 != null) {
            str2 = str3;
        }
        ArrayList<DrmInitData.SchemeData> arrayList3 = aVar.f29552e;
        arrayList3.addAll(arrayList);
        if (!arrayList3.isEmpty()) {
            r(arrayList3);
            c10.M(new DrmInitData(str2, arrayList3));
        }
        ArrayList<e> arrayList4 = aVar.f29553f;
        arrayList4.addAll(arrayList2);
        return j.o(aVar.f29554g, c10.E(), aVar.f29549b, aVar.f29550c, arrayList4, aVar.f29555h, aVar.f29556i, null);
    }

    public List<k.d> j0(XmlPullParser xmlPullParser, long j10, long j11) throws XmlPullParserException, IOException {
        ArrayList arrayList = new ArrayList();
        long j12 = 0;
        long j13 = -9223372036854775807L;
        boolean z10 = false;
        int i10 = 0;
        do {
            xmlPullParser.next();
            if (l0.f(xmlPullParser, ExifInterface.LATITUDE_SOUTH)) {
                long U = U(xmlPullParser, "t", -9223372036854775807L);
                if (z10) {
                    j12 = b(arrayList, j12, j13, i10, U);
                }
                if (U == -9223372036854775807L) {
                    U = j12;
                }
                j13 = U(xmlPullParser, "d", -9223372036854775807L);
                i10 = R(xmlPullParser, "r", 0);
                j12 = U;
                z10 = true;
            } else {
                v(xmlPullParser);
            }
        } while (!l0.d(xmlPullParser, "SegmentTimeline"));
        if (z10) {
            b(arrayList, j12, j13, i10, k0.O0(j11, j10, 1000L));
        }
        return arrayList;
    }

    public k.b k(i iVar, long j10, long j11, long j12, long j13, @Nullable List<k.d> list, long j14, @Nullable List<i> list2, long j15, long j16) {
        return new k.b(iVar, j10, j11, j12, j13, list, j14, list2, k0.C0(j15), k0.C0(j16));
    }

    public i k0(XmlPullParser xmlPullParser) {
        return a0(xmlPullParser, "media", "mediaRange");
    }

    public k.c l(i iVar, long j10, long j11, long j12, long j13, long j14, List<k.d> list, long j15, @Nullable n nVar, @Nullable n nVar2, long j16, long j17) {
        return new k.c(iVar, j10, j11, j12, j13, j14, list, j15, nVar, nVar2, k0.C0(j16), k0.C0(j17));
    }

    public int l0(@Nullable String str) {
        if (str == null) {
            return 0;
        }
        return (str.equals("forced_subtitle") || str.equals("forced-subtitle")) ? 2 : 0;
    }

    public k.d m(long j10, long j11) {
        return new k.d(j10, j11);
    }

    public int m0(List<e> list) {
        int i10 = 0;
        for (int i11 = 0; i11 < list.size(); i11++) {
            e eVar = list.get(i11);
            if (com.google.common.base.a.a("urn:mpeg:dash:role:2011", eVar.f29557a)) {
                i10 |= l0(eVar.f29558b);
            }
        }
        return i10;
    }

    public k.e n(i iVar, long j10, long j11, long j12, long j13) {
        return new k.e(iVar, j10, j11, j12, j13);
    }

    public l n0(XmlPullParser xmlPullParser) throws XmlPullParserException, IOException {
        long j10 = -9223372036854775807L;
        long j11 = -9223372036854775807L;
        long j12 = -9223372036854775807L;
        float f10 = -3.4028235E38f;
        float f11 = -3.4028235E38f;
        while (true) {
            xmlPullParser.next();
            if (l0.f(xmlPullParser, "Latency")) {
                j10 = U(xmlPullParser, TypedValues.AttributesType.S_TARGET, -9223372036854775807L);
                j11 = U(xmlPullParser, "min", -9223372036854775807L);
                j12 = U(xmlPullParser, "max", -9223372036854775807L);
            } else if (l0.f(xmlPullParser, "PlaybackRate")) {
                f10 = O(xmlPullParser, "min", -3.4028235E38f);
                f11 = O(xmlPullParser, "max", -3.4028235E38f);
            }
            long j13 = j10;
            long j14 = j11;
            long j15 = j12;
            float f12 = f10;
            float f13 = f11;
            if (l0.d(xmlPullParser, "ServiceDescription")) {
                return new l(j13, j14, j15, f12, f13);
            }
            j10 = j13;
            j11 = j14;
            j12 = j15;
            f10 = f12;
            f11 = f13;
        }
    }

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

    public int q0(@Nullable String str) {
        if (str == null) {
            return 0;
        }
        char c10 = 65535;
        switch (str.hashCode()) {
            case 49:
                if (str.equals("1")) {
                    c10 = 0;
                    break;
                }
                break;
            case 50:
                if (str.equals("2")) {
                    c10 = 1;
                    break;
                }
                break;
            case 51:
                if (str.equals(ExifInterface.GPS_MEASUREMENT_3D)) {
                    c10 = 2;
                    break;
                }
                break;
            case 52:
                if (str.equals("4")) {
                    c10 = 3;
                    break;
                }
                break;
            case 54:
                if (str.equals("6")) {
                    c10 = 4;
                    break;
                }
                break;
        }
        switch (c10) {
            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 r0(XmlPullParser xmlPullParser, String str, @Nullable n nVar) {
        String attributeValue = xmlPullParser.getAttributeValue(null, str);
        return attributeValue != null ? n.b(attributeValue) : nVar;
    }

    public o s0(XmlPullParser xmlPullParser) {
        return o(xmlPullParser.getAttributeValue(null, "schemeIdUri"), xmlPullParser.getAttributeValue(null, DbParams.VALUE));
    }

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

    @Override
    public c a(Uri uri, InputStream inputStream) throws IOException {
        try {
            XmlPullParser newPullParser = this.f29547a.newPullParser();
            newPullParser.setInput(inputStream, null);
            if (newPullParser.next() == 2 && "MPD".equals(newPullParser.getName())) {
                return V(newPullParser, uri);
            }
            throw ParserException.c("inputStream does not contain a valid media presentation description", null);
        } catch (XmlPullParserException e10) {
            throw ParserException.c(null, e10);
        }
    }

    public d7.a x(XmlPullParser xmlPullParser, List<b> list, @Nullable k kVar, long j10, long j11, long j12, long j13, long j14, boolean z10) throws XmlPullParserException, IOException {
        long j15;
        ArrayList<e> arrayList;
        Object obj;
        long j16;
        ArrayList arrayList2;
        ArrayList arrayList3;
        ArrayList arrayList4;
        ArrayList arrayList5;
        ArrayList arrayList6;
        ArrayList<DrmInitData.SchemeData> arrayList7;
        String str;
        String str2;
        ArrayList arrayList8;
        int i10;
        ArrayList<e> arrayList9;
        long A;
        d dVar = this;
        XmlPullParser xmlPullParser2 = xmlPullParser;
        int R = R(xmlPullParser2, "id", -1);
        int F = F(xmlPullParser);
        String attributeValue = xmlPullParser2.getAttributeValue(null, "mimeType");
        String attributeValue2 = xmlPullParser2.getAttributeValue(null, "codecs");
        int R2 = R(xmlPullParser2, "width", -1);
        int R3 = R(xmlPullParser2, "height", -1);
        float P = P(xmlPullParser2, -1.0f);
        int R4 = R(xmlPullParser2, "audioSamplingRate", -1);
        String str3 = "lang";
        String attributeValue3 = xmlPullParser2.getAttributeValue(null, "lang");
        String attributeValue4 = xmlPullParser2.getAttributeValue(null, "label");
        ArrayList<DrmInitData.SchemeData> arrayList10 = new ArrayList<>();
        ArrayList<e> arrayList11 = new ArrayList<>();
        ArrayList arrayList12 = new ArrayList();
        ArrayList arrayList13 = new ArrayList();
        ArrayList arrayList14 = new ArrayList();
        ArrayList arrayList15 = new ArrayList();
        ArrayList arrayList16 = new ArrayList();
        ArrayList arrayList17 = new ArrayList();
        k.e eVar = kVar;
        int i11 = F;
        String str4 = attributeValue3;
        String str5 = attributeValue4;
        String str6 = null;
        int i12 = -1;
        boolean z11 = false;
        long j17 = j11;
        long j18 = j12;
        while (true) {
            xmlPullParser.next();
            if (l0.f(xmlPullParser2, "BaseURL")) {
                if (!z11) {
                    j17 = dVar.A(xmlPullParser2, j17);
                    z11 = true;
                }
                j15 = j18;
                arrayList = arrayList11;
                arrayList17.addAll(dVar.B(xmlPullParser2, list, z10));
            } else {
                j15 = j18;
                arrayList = arrayList11;
                if (l0.f(xmlPullParser2, "ContentProtection")) {
                    Pair<String, DrmInitData.SchemeData> E = E(xmlPullParser);
                    Object obj2 = E.first;
                    if (obj2 != null) {
                        str6 = (String) obj2;
                    }
                    Object obj3 = E.second;
                    if (obj3 != null) {
                        arrayList10.add((DrmInitData.SchemeData) obj3);
                    }
                } else {
                    if (l0.f(xmlPullParser2, "ContentComponent")) {
                        str2 = q(str4, xmlPullParser2.getAttributeValue(null, str3));
                        obj = null;
                        j16 = j17;
                        arrayList2 = arrayList17;
                        arrayList8 = arrayList16;
                        arrayList3 = arrayList15;
                        arrayList4 = arrayList14;
                        arrayList5 = arrayList13;
                        arrayList6 = arrayList12;
                        arrayList7 = arrayList10;
                        str = str3;
                        i10 = p(i11, F(xmlPullParser));
                        arrayList9 = arrayList;
                    } else {
                        int i13 = i11;
                        String str7 = str4;
                        if (l0.f(xmlPullParser2, "Role")) {
                            arrayList13.add(H(xmlPullParser2, "Role"));
                        } else if (l0.f(xmlPullParser2, "AudioChannelConfiguration")) {
                            i12 = z(xmlPullParser);
                        } else if (l0.f(xmlPullParser2, "Accessibility")) {
                            arrayList12.add(H(xmlPullParser2, "Accessibility"));
                        } else if (l0.f(xmlPullParser2, "EssentialProperty")) {
                            arrayList14.add(H(xmlPullParser2, "EssentialProperty"));
                        } else if (l0.f(xmlPullParser2, "SupplementalProperty")) {
                            arrayList15.add(H(xmlPullParser2, "SupplementalProperty"));
                        } else if (l0.f(xmlPullParser2, "Representation")) {
                            j16 = j17;
                            arrayList2 = arrayList17;
                            arrayList3 = arrayList15;
                            arrayList4 = arrayList14;
                            arrayList5 = arrayList13;
                            arrayList6 = arrayList12;
                            arrayList7 = arrayList10;
                            str = str3;
                            obj = null;
                            str2 = str7;
                            a b02 = b0(xmlPullParser, !arrayList17.isEmpty() ? arrayList17 : list, attributeValue, attributeValue2, R2, R3, P, i12, R4, str7, arrayList5, arrayList6, arrayList4, arrayList3, eVar, j13, j10, j16, j15, j14, z10);
                            int p10 = p(i13, u.l(b02.f29548a.f13987l));
                            arrayList8 = arrayList16;
                            arrayList8.add(b02);
                            xmlPullParser2 = xmlPullParser;
                            i10 = p10;
                            arrayList9 = arrayList;
                        } else {
                            obj = null;
                            j16 = j17;
                            arrayList2 = arrayList17;
                            arrayList3 = arrayList15;
                            arrayList4 = arrayList14;
                            arrayList5 = arrayList13;
                            arrayList6 = arrayList12;
                            arrayList7 = arrayList10;
                            str = str3;
                            str2 = str7;
                            arrayList8 = arrayList16;
                            if (l0.f(xmlPullParser, "SegmentBase")) {
                                eVar = g0(xmlPullParser, (k.e) eVar);
                                i10 = i13;
                                arrayList9 = arrayList;
                                j18 = j15;
                                xmlPullParser2 = xmlPullParser;
                            } else {
                                if (l0.f(xmlPullParser, "SegmentList")) {
                                    A = A(xmlPullParser, j15);
                                    i10 = i13;
                                    eVar = h0(xmlPullParser, (k.b) eVar, j13, j10, j16, A, j14);
                                    xmlPullParser2 = xmlPullParser;
                                } else {
                                    j18 = j15;
                                    i10 = i13;
                                    if (l0.f(xmlPullParser, "SegmentTemplate")) {
                                        A = A(xmlPullParser, j18);
                                        xmlPullParser2 = xmlPullParser;
                                        eVar = i0(xmlPullParser, (k.c) eVar, arrayList3, j13, j10, j16, A, j14);
                                    } else {
                                        xmlPullParser2 = xmlPullParser;
                                        if (l0.f(xmlPullParser2, "InbandEventStream")) {
                                            arrayList9 = arrayList;
                                            arrayList9.add(H(xmlPullParser2, "InbandEventStream"));
                                        } else {
                                            arrayList9 = arrayList;
                                            if (l0.f(xmlPullParser2, "Label")) {
                                                str5 = S(xmlPullParser);
                                            } else if (l0.e(xmlPullParser)) {
                                                y(xmlPullParser);
                                            }
                                        }
                                    }
                                }
                                j18 = A;
                                arrayList9 = arrayList;
                            }
                            if (!l0.d(xmlPullParser2, "AdaptationSet")) {
                                break;
                            }
                            arrayList11 = arrayList9;
                            arrayList16 = arrayList8;
                            arrayList17 = arrayList2;
                            arrayList15 = arrayList3;
                            j17 = j16;
                            arrayList14 = arrayList4;
                            arrayList13 = arrayList5;
                            arrayList12 = arrayList6;
                            arrayList10 = arrayList7;
                            str3 = str;
                            i11 = i10;
                            str4 = str2;
                            dVar = this;
                        }
                        obj = null;
                        j16 = j17;
                        arrayList2 = arrayList17;
                        arrayList3 = arrayList15;
                        arrayList4 = arrayList14;
                        arrayList5 = arrayList13;
                        arrayList6 = arrayList12;
                        arrayList7 = arrayList10;
                        str = str3;
                        i10 = i13;
                        str2 = str7;
                        arrayList9 = arrayList;
                        j18 = j15;
                        arrayList8 = arrayList16;
                        if (!l0.d(xmlPullParser2, "AdaptationSet")) {
                        }
                    }
                    j18 = j15;
                    if (!l0.d(xmlPullParser2, "AdaptationSet")) {
                    }
                }
            }
            j18 = j15;
            j16 = j17;
            arrayList8 = arrayList16;
            arrayList4 = arrayList14;
            arrayList5 = arrayList13;
            arrayList6 = arrayList12;
            arrayList7 = arrayList10;
            str = str3;
            arrayList9 = arrayList;
            i10 = i11;
            str2 = str4;
            obj = null;
            arrayList2 = arrayList17;
            arrayList3 = arrayList15;
            if (!l0.d(xmlPullParser2, "AdaptationSet")) {
            }
        }
        ArrayList arrayList18 = new ArrayList(arrayList8.size());
        for (int i14 = 0; i14 < arrayList8.size(); i14++) {
            arrayList18.add(j((a) arrayList8.get(i14), str5, str6, arrayList7, arrayList9));
        }
        return c(R, i10, arrayList18, arrayList6, arrayList4, arrayList3);
    }

    public void y(XmlPullParser xmlPullParser) throws XmlPullParserException, IOException {
        v(xmlPullParser);
    }

    public int z(XmlPullParser xmlPullParser) throws XmlPullParserException, IOException {
        char c10;
        String o02 = o0(xmlPullParser, "schemeIdUri", null);
        o02.hashCode();
        int i10 = -1;
        switch (o02.hashCode()) {
            case -1352850286:
                if (o02.equals("urn:mpeg:dash:23003:3:audio_channel_configuration:2011")) {
                    c10 = 0;
                    break;
                }
                c10 = 65535;
                break;
            case -1138141449:
                if (o02.equals("tag:dolby.com,2014:dash:audio_channel_configuration:2011")) {
                    c10 = 1;
                    break;
                }
                c10 = 65535;
                break;
            case -986633423:
                if (o02.equals("urn:mpeg:mpegB:cicp:ChannelConfiguration")) {
                    c10 = 2;
                    break;
                }
                c10 = 65535;
                break;
            case 2036691300:
                if (o02.equals("urn:dolby:dash:audio_channel_configuration:2011")) {
                    c10 = 3;
                    break;
                }
                c10 = 65535;
                break;
            default:
                c10 = 65535;
                break;
        }
        switch (c10) {
            case 0:
                i10 = R(xmlPullParser, DbParams.VALUE, -1);
                break;
            case 1:
            case 3:
                i10 = I(xmlPullParser);
                break;
            case 2:
                i10 = W(xmlPullParser);
                break;
        }
        do {
            xmlPullParser.next();
        } while (!l0.d(xmlPullParser, "AudioChannelConfiguration"));
        return i10;
    }
}