package defpackage;

import android.net.Uri;
import android.text.TextUtils;
import androidx.media3.common.ParserException;
import java.io.IOException;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.List;
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;

/* renamed from: ᵥᵡﾞ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public final class C3525 extends DefaultHandler implements InterfaceC4068 {

    /* renamed from: ᵧᵾˀˈ, reason: contains not printable characters */
    public final XmlPullParserFactory f13241;

    /* renamed from: ᵢˇᵭ, reason: contains not printable characters */
    public static final Pattern f13237 = Pattern.compile("(\\d+)(?:/(\\d+))?");

    /* renamed from: ᵿʗᵝʽ, reason: contains not printable characters */
    public static final Pattern f13240 = Pattern.compile("CC([1-4])=.*");

    /* renamed from: ᵾᵬ, reason: contains not printable characters */
    public static final Pattern f13239 = Pattern.compile("([1-9]|[1-5][0-9]|6[0-3])=.*");

    /* renamed from: ᵤᵙᵷ, reason: contains not printable characters */
    public static final int[] f13238 = {2, 1, 2, 2, 2, 2, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, 2, 2, 2};

    /* renamed from: ᵡⁱᵥ, reason: contains not printable characters */
    public static final int[] f13236 = {-1, 1, 2, 3, 4, 5, 6, 8, 2, 3, 4, 7, 8, 24, 8, 12, 10, 12, 14, 12, 14};

    public C3525() {
        try {
            this.f13241 = XmlPullParserFactory.newInstance();
        } catch (XmlPullParserException e) {
            ᵨᴵᵺ.ᵪʩ("Couldn't create XmlPullParserFactory instance", e);
            throw null;
        }
    }

    /* renamed from: ˇʼʤˎ, reason: contains not printable characters */
    public static ArrayList m8053(XmlPullParser xmlPullParser, ArrayList arrayList, boolean z) throws XmlPullParserException, IOException {
        String attributeValue = xmlPullParser.getAttributeValue(null, "dvb:priority");
        int i = attributeValue != null ? Integer.parseInt(attributeValue) : z ? 1 : Integer.MIN_VALUE;
        String attributeValue2 = xmlPullParser.getAttributeValue(null, "dvb:weight");
        int i2 = attributeValue2 != null ? Integer.parseInt(attributeValue2) : 1;
        String attributeValue3 = xmlPullParser.getAttributeValue(null, "serviceLocation");
        String text = "";
        do {
            xmlPullParser.next();
            if (xmlPullParser.getEventType() == 4) {
                text = xmlPullParser.getText();
            } else {
                m8066(xmlPullParser);
            }
        } while (!ᵳʿˉ.ᵡⁱᵥ(xmlPullParser, "BaseURL"));
        if (text != null && ˆᴵ.ᵳٴᵶ(text)[0] != -1) {
            if (attributeValue3 == null) {
                attributeValue3 = text;
            }
            return ˀʾˀᵛ.ˑᵱ(new C2241[]{new C2241(i, i2, text, attributeValue3)});
        }
        ArrayList arrayList2 = new ArrayList();
        for (int i3 = 0; i3 < arrayList.size(); i3++) {
            C2241 c2241 = (C2241) arrayList.get(i3);
            String str = ˆᴵ.ᵢˇᵭ(c2241.f8784, text);
            String str2 = attributeValue3 == null ? str : attributeValue3;
            if (z) {
                i = c2241.f8783;
                i2 = c2241.f8786;
                str2 = c2241.f8785;
            }
            arrayList2.add(new C2241(i, i2, str, str2));
        }
        return arrayList2;
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Type inference failed for: r0v1, types: [java.util.List] */
    /* JADX WARN: Type inference failed for: r0v2, types: [java.util.List] */
    /* renamed from: ˌʾˀ, reason: contains not printable characters */
    public static C3890 m8054(XmlPullParser xmlPullParser, C3890 c3890, long j, long j2, long j3, long j4, long j5) throws XmlPullParserException, IOException, NumberFormatException {
        long j6 = c3890 != null ? c3890.f11660 : 1L;
        ArrayList arrayList = null;
        String attributeValue = xmlPullParser.getAttributeValue(null, "timescale");
        if (attributeValue != null) {
            j6 = Long.parseLong(attributeValue);
        }
        long j7 = j6;
        long j8 = c3890 != null ? c3890.f11658 : 0L;
        String attributeValue2 = xmlPullParser.getAttributeValue(null, "presentationTimeOffset");
        if (attributeValue2 != null) {
            j8 = Long.parseLong(attributeValue2);
        }
        long j9 = j8;
        long j10 = c3890 != null ? c3890.f14420 : -9223372036854775807L;
        String attributeValue3 = xmlPullParser.getAttributeValue(null, "duration");
        if (attributeValue3 != null) {
            j10 = Long.parseLong(attributeValue3);
        }
        long j11 = j10;
        long j12 = c3890 != null ? c3890.f14425 : 1L;
        String attributeValue4 = xmlPullParser.getAttributeValue(null, "startNumber");
        if (attributeValue4 != null) {
            j12 = Long.parseLong(attributeValue4);
        }
        long j13 = j12;
        long j14 = j4 == -9223372036854775807L ? j3 : j4;
        long j15 = j14 == Long.MAX_VALUE ? -9223372036854775807L : j14;
        C0624 c0624M8055 = null;
        ArrayList arrayListM8068 = null;
        do {
            xmlPullParser.next();
            if (ᵳʿˉ.ˀᵗᵝᵭ(xmlPullParser, "Initialization")) {
                c0624M8055 = m8055(xmlPullParser, "sourceURL", "range");
            } else if (ᵳʿˉ.ˀᵗᵝᵭ(xmlPullParser, "SegmentTimeline")) {
                arrayListM8068 = m8068(xmlPullParser, j7, j2);
            } else if (ᵳʿˉ.ˀᵗᵝᵭ(xmlPullParser, "SegmentURL")) {
                if (arrayList == null) {
                    arrayList = new ArrayList();
                }
                arrayList.add(m8055(xmlPullParser, "media", "mediaRange"));
            } else {
                m8066(xmlPullParser);
            }
        } while (!ᵳʿˉ.ᵡⁱᵥ(xmlPullParser, "SegmentList"));
        if (c3890 != null) {
            if (c0624M8055 == null) {
                c0624M8055 = c3890.f11659;
            }
            if (arrayListM8068 == null) {
                arrayListM8068 = c3890.f14422;
            }
            if (arrayList == null) {
                arrayList = c3890.f14499;
            }
        }
        return new C3890(c0624M8055, j7, j9, j13, j11, arrayListM8068, j15, arrayList, AbstractC3558.m8133(j5), AbstractC3558.m8133(j));
    }

    /* renamed from: ˌᵜᵹᵩ, reason: contains not printable characters */
    public static C0624 m8055(XmlPullParser xmlPullParser, String str, String str2) throws NumberFormatException {
        long j;
        long j2;
        String attributeValue = xmlPullParser.getAttributeValue(null, str);
        String attributeValue2 = xmlPullParser.getAttributeValue(null, str2);
        if (attributeValue2 != null) {
            String[] strArrSplit = attributeValue2.split("-");
            j = Long.parseLong(strArrSplit[0]);
            if (strArrSplit.length == 2) {
                j2 = (Long.parseLong(strArrSplit[1]) - j) + 1;
            }
            return new C0624(j, j2, attributeValue);
        }
        j = 0;
        j2 = -1;
        return new C0624(j, j2, attributeValue);
    }

    /* renamed from: ˎˏʜʾ, reason: contains not printable characters */
    public static int m8056(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;
        }
        if ("text".equals(attributeValue)) {
            return 3;
        }
        return "image".equals(attributeValue) ? 4 : -1;
    }

    /* JADX WARN: Can't fix incorrect switch cases order, some code will duplicate */
    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Removed duplicated region for block: B:49:0x00b1  */
    /* JADX WARN: Removed duplicated region for block: B:6:0x001c  */
    /* JADX WARN: Removed duplicated region for block: B:78:0x012e  */
    /* JADX WARN: Removed duplicated region for block: B:86:0x0153  */
    /* JADX WARN: Type inference failed for: r7v12 */
    /* JADX WARN: Type inference failed for: r7v13 */
    /* JADX WARN: Type inference failed for: r7v2 */
    /* JADX WARN: Type inference failed for: r7v24 */
    /* JADX WARN: Type inference failed for: r7v25 */
    /* JADX WARN: Type inference failed for: r7v26 */
    /* JADX WARN: Type inference failed for: r7v27 */
    /* JADX WARN: Type inference failed for: r7v28 */
    /* JADX WARN: Type inference failed for: r7v29 */
    /* JADX WARN: Type inference failed for: r7v3 */
    /* JADX WARN: Type inference failed for: r7v4, types: [byte[]] */
    /* renamed from: ˏˋٴ, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public static android.util.Pair m8057(org.xmlpull.v1.XmlPullParser r13) throws org.xmlpull.v1.XmlPullParserException, java.io.IOException {
        /*
            Method dump skipped, instructions count: 394
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: defpackage.C3525.m8057(org.xmlpull.v1.XmlPullParser):android.util.Pair");
    }

    /* JADX WARN: Can't fix incorrect switch cases order, some code will duplicate */
    /* JADX WARN: Failed to restore switch over string. Please report as a decompilation issue */
    /* JADX WARN: Removed duplicated region for block: B:49:0x0093 A[PHI: r13
      0x0093: PHI (r13v30 int) = (r13v5 int), (r13v8 int), (r13v33 int) binds: [B:128:0x01a3, B:120:0x0190, B:47:0x008f] A[DONT_GENERATE, DONT_INLINE]] */
    /* JADX WARN: Removed duplicated region for block: B:60:0x00b3  */
    /* JADX WARN: Removed duplicated region for block: B:63:0x00c4  */
    /* JADX WARN: Removed duplicated region for block: B:7:0x001c  */
    /* renamed from: ˏᵙ, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public static int m8058(org.xmlpull.v1.XmlPullParser r12, java.lang.String r13) throws org.xmlpull.v1.XmlPullParserException, java.lang.NumberFormatException, java.io.IOException {
        /*
            Method dump skipped, instructions count: 526
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: defpackage.C3525.m8058(org.xmlpull.v1.XmlPullParser, java.lang.String):int");
    }

    /* renamed from: ᵝᵵᵺ, reason: contains not printable characters */
    public static long m8059(XmlPullParser xmlPullParser, String str, long j) {
        String attributeValue = xmlPullParser.getAttributeValue(null, str);
        if (attributeValue == null) {
            return j;
        }
        Matcher matcher = AbstractC3558.f13323.matcher(attributeValue);
        if (!matcher.matches()) {
            return (long) (Double.parseDouble(attributeValue) * 3600.0d * 1000.0d);
        }
        boolean zIsEmpty = TextUtils.isEmpty(matcher.group(1));
        String strGroup = matcher.group(3);
        double d = strGroup != null ? Double.parseDouble(strGroup) * 3.1556908E7d : 0.0d;
        String strGroup2 = matcher.group(5);
        double d2 = d + (strGroup2 != null ? Double.parseDouble(strGroup2) * 2629739.0d : 0.0d);
        String strGroup3 = matcher.group(7);
        double d3 = d2 + (strGroup3 != null ? Double.parseDouble(strGroup3) * 86400.0d : 0.0d);
        String strGroup4 = matcher.group(10);
        double d4 = d3 + (strGroup4 != null ? Double.parseDouble(strGroup4) * 3600.0d : 0.0d);
        String strGroup5 = matcher.group(12);
        double d5 = d4 + (strGroup5 != null ? Double.parseDouble(strGroup5) * 60.0d : 0.0d);
        String strGroup6 = matcher.group(14);
        long j2 = (long) ((d5 + (strGroup6 != null ? Double.parseDouble(strGroup6) : 0.0d)) * 1000.0d);
        return !zIsEmpty ? -j2 : j2;
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Type inference failed for: r0v1, types: [java.util.List] */
    /* renamed from: ᵡʠ, reason: contains not printable characters */
    public static C4770 m8060(XmlPullParser xmlPullParser, C4770 c4770, List list, long j, long j2, long j3, long j4, long j5) throws XmlPullParserException, NumberFormatException, IOException {
        long j6;
        long j7 = c4770 != null ? c4770.f11660 : 1L;
        C0624 c0624M8055 = null;
        String attributeValue = xmlPullParser.getAttributeValue(null, "timescale");
        if (attributeValue != null) {
            j7 = Long.parseLong(attributeValue);
        }
        long j8 = j7;
        long j9 = c4770 != null ? c4770.f11658 : 0L;
        String attributeValue2 = xmlPullParser.getAttributeValue(null, "presentationTimeOffset");
        if (attributeValue2 != null) {
            j9 = Long.parseLong(attributeValue2);
        }
        long j10 = j9;
        long j11 = c4770 != null ? c4770.f14420 : -9223372036854775807L;
        String attributeValue3 = xmlPullParser.getAttributeValue(null, "duration");
        if (attributeValue3 != null) {
            j11 = Long.parseLong(attributeValue3);
        }
        long j12 = j11;
        long j13 = c4770 != null ? c4770.f14425 : 1L;
        String attributeValue4 = xmlPullParser.getAttributeValue(null, "startNumber");
        if (attributeValue4 != null) {
            j13 = Long.parseLong(attributeValue4);
        }
        long j14 = j13;
        int i = 0;
        while (true) {
            if (i >= list.size()) {
                j6 = -1;
                break;
            }
            C3466 c3466 = (C3466) list.get(i);
            if (ᵿᵧ.ᵶᵷᵕ("http://dashif.org/guidelines/last-segment-number", c3466.f13001)) {
                j6 = Long.parseLong(c3466.f13002);
                break;
            }
            i++;
        }
        long j15 = j6;
        long j16 = j4 == -9223372036854775807L ? j3 : j4;
        long j17 = j16 == Long.MAX_VALUE ? -9223372036854775807L : j16;
        C1570 c1570M8062 = m8062(xmlPullParser, "media", c4770 != null ? c4770.f17723 : null);
        C1570 c1570M80622 = m8062(xmlPullParser, "initialization", c4770 != null ? c4770.f17722 : null);
        ArrayList arrayListM8068 = null;
        do {
            xmlPullParser.next();
            if (ᵳʿˉ.ˀᵗᵝᵭ(xmlPullParser, "Initialization")) {
                c0624M8055 = m8055(xmlPullParser, "sourceURL", "range");
            } else if (ᵳʿˉ.ˀᵗᵝᵭ(xmlPullParser, "SegmentTimeline")) {
                arrayListM8068 = m8068(xmlPullParser, j8, j2);
            } else {
                m8066(xmlPullParser);
            }
        } while (!ᵳʿˉ.ᵡⁱᵥ(xmlPullParser, "SegmentTemplate"));
        if (c4770 != null) {
            if (c0624M8055 == null) {
                c0624M8055 = c4770.f11659;
            }
            if (arrayListM8068 == null) {
                arrayListM8068 = c4770.f14422;
            }
        }
        return new C4770(c0624M8055, j8, j10, j14, j15, j12, arrayListM8068, j17, c1570M80622, c1570M8062, AbstractC3558.m8133(j5), AbstractC3558.m8133(j));
    }

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public static long m8061(ArrayList arrayList, long j, long j2, int i, long j3) {
        int i2;
        if (i >= 0) {
            i2 = i + 1;
        } else {
            String str = AbstractC3558.f13329;
            i2 = (int) ((((j3 - j) + j2) - 1) / j2);
        }
        for (int i3 = 0; i3 < i2; i3++) {
            arrayList.add(new C2295(j, j2));
            j += j2;
        }
        return j;
    }

    /* JADX WARN: Failed to find 'out' block for switch in B:30:0x00fc. Please report as an issue. */
    /* renamed from: ᵨᵳʝ, reason: contains not printable characters */
    public static C1570 m8062(XmlPullParser xmlPullParser, String str, C1570 c1570) {
        String strSubstring;
        String attributeValue = xmlPullParser.getAttributeValue(null, str);
        if (attributeValue == null) {
            return c1570;
        }
        ArrayList arrayList = new ArrayList();
        ArrayList arrayList2 = new ArrayList();
        ArrayList arrayList3 = new ArrayList();
        arrayList.add("");
        int length = 0;
        while (length < attributeValue.length()) {
            int iIndexOf = attributeValue.indexOf("$", length);
            if (iIndexOf == -1) {
                arrayList.set(arrayList2.size(), ((String) arrayList.get(arrayList2.size())) + attributeValue.substring(length));
                length = attributeValue.length();
            } else if (iIndexOf != length) {
                arrayList.set(arrayList2.size(), ((String) arrayList.get(arrayList2.size())) + attributeValue.substring(length, iIndexOf));
                length = iIndexOf;
            } else if (attributeValue.startsWith("$$", length)) {
                arrayList.set(arrayList2.size(), ((String) arrayList.get(arrayList2.size())) + "$");
                length += 2;
            } else {
                arrayList3.add("");
                int i = length + 1;
                int iIndexOf2 = attributeValue.indexOf("$", i);
                String strSubstring2 = attributeValue.substring(i, iIndexOf2);
                if (strSubstring2.equals("RepresentationID")) {
                    arrayList2.add(1);
                } else {
                    int iIndexOf3 = strSubstring2.indexOf("%0");
                    if (iIndexOf3 != -1) {
                        strSubstring = strSubstring2.substring(iIndexOf3);
                        if (!strSubstring.endsWith("d") && !strSubstring.endsWith("x") && !strSubstring.endsWith("X")) {
                            strSubstring = strSubstring.concat("d");
                        }
                        strSubstring2 = strSubstring2.substring(0, iIndexOf3);
                    } else {
                        strSubstring = "%01d";
                    }
                    switch (strSubstring2) {
                        case "Number":
                            arrayList2.add(2);
                            break;
                        case "Time":
                            arrayList2.add(4);
                            break;
                        case "Bandwidth":
                            arrayList2.add(3);
                            break;
                        default:
                            ᵹˉᵞ.ˌᵜᵹᵩ("Invalid template: ".concat(attributeValue));
                            return null;
                    }
                    arrayList3.set(arrayList2.size() - 1, strSubstring);
                }
                arrayList.add("");
                length = iIndexOf2 + 1;
            }
        }
        return new C1570(arrayList, arrayList2, arrayList3, 5);
    }

    /* renamed from: ᵪʩ, reason: contains not printable characters */
    public static int m8063(ArrayList arrayList) {
        int i = 0;
        for (int i2 = 0; i2 < arrayList.size(); i2++) {
            if (ᵿᵧ.ᵶᵷᵕ("http://dashif.org/guidelines/trickmode", ((C3466) arrayList.get(i2)).f13001)) {
                i = 16384;
            }
        }
        return i;
    }

    /* renamed from: ᵯٴᵦ, reason: contains not printable characters */
    public static int m8064(String str) {
        if (str != null) {
            switch (str) {
                case "subtitle":
                case "forced_subtitle":
                case "forced-subtitle":
                    return 128;
                case "description":
                    return 512;
                case "enhanced-audio-intelligibility":
                    return 2048;
                case "alternate":
                    return 2;
                case "dub":
                    return 16;
                case "main":
                    return 1;
                case "sign":
                    return 256;
                case "caption":
                    return 64;
                case "commentary":
                    return 8;
                case "emergency":
                    return 32;
                case "supplementary":
                    return 4;
            }
        }
        return 0;
    }

    /* renamed from: ᵳٴᵶ, reason: contains not printable characters */
    public static C1826 m8065(XmlPullParser xmlPullParser, C1826 c1826) throws XmlPullParserException, NumberFormatException, IOException {
        long j = c1826 != null ? c1826.f11660 : 1L;
        String attributeValue = xmlPullParser.getAttributeValue(null, "timescale");
        if (attributeValue != null) {
            j = Long.parseLong(attributeValue);
        }
        long j2 = j;
        long j3 = c1826 != null ? c1826.f11658 : 0L;
        String attributeValue2 = xmlPullParser.getAttributeValue(null, "presentationTimeOffset");
        if (attributeValue2 != null) {
            j3 = Long.parseLong(attributeValue2);
        }
        long j4 = j3;
        long j5 = c1826 != null ? c1826.f7419 : 0L;
        long j6 = c1826 != null ? c1826.f7418 : 0L;
        String attributeValue3 = xmlPullParser.getAttributeValue(null, "indexRange");
        if (attributeValue3 != null) {
            String[] strArrSplit = attributeValue3.split("-");
            j5 = Long.parseLong(strArrSplit[0]);
            j6 = (Long.parseLong(strArrSplit[1]) - j5) + 1;
        }
        long j7 = j6;
        long j8 = j5;
        C0624 c0624M8055 = c1826 != null ? c1826.f11659 : null;
        while (true) {
            xmlPullParser.next();
            if (ᵳʿˉ.ˀᵗᵝᵭ(xmlPullParser, "Initialization")) {
                c0624M8055 = m8055(xmlPullParser, "sourceURL", "range");
            } else {
                m8066(xmlPullParser);
            }
            C0624 c0624 = c0624M8055;
            if (ᵳʿˉ.ᵡⁱᵥ(xmlPullParser, "SegmentBase")) {
                return new C1826(c0624, j2, j4, j8, j7);
            }
            c0624M8055 = c0624;
        }
    }

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public static void m8066(XmlPullParser xmlPullParser) throws XmlPullParserException, IOException {
        if (xmlPullParser.getEventType() == 2) {
            int i = 1;
            while (i != 0) {
                xmlPullParser.next();
                if (xmlPullParser.getEventType() == 2) {
                    i++;
                } else if (xmlPullParser.getEventType() == 3) {
                    i--;
                }
            }
        }
    }

    /* renamed from: ᵶᵷᵕ, reason: contains not printable characters */
    public static float m8067(XmlPullParser xmlPullParser, float f) throws NumberFormatException {
        String attributeValue = xmlPullParser.getAttributeValue(null, "frameRate");
        if (attributeValue != null) {
            Matcher matcher = f13237.matcher(attributeValue);
            if (matcher.matches()) {
                int i = Integer.parseInt(matcher.group(1));
                return !TextUtils.isEmpty(matcher.group(2)) ? i / Integer.parseInt(r2) : i;
            }
        }
        return f;
    }

    /* renamed from: ᵸʓᵠ, reason: contains not printable characters */
    public static ArrayList m8068(XmlPullParser xmlPullParser, long j, long j2) throws XmlPullParserException, IOException {
        long j3;
        ArrayList arrayList = new ArrayList();
        long jM8061 = 0;
        long j4 = -9223372036854775807L;
        boolean z = false;
        int i = 0;
        do {
            xmlPullParser.next();
            if (ᵳʿˉ.ˀᵗᵝᵭ(xmlPullParser, "S")) {
                String attributeValue = xmlPullParser.getAttributeValue(null, "t");
                long j5 = attributeValue == null ? -9223372036854775807L : Long.parseLong(attributeValue);
                if (z) {
                    int i2 = i;
                    j3 = j5;
                    jM8061 = m8061(arrayList, jM8061, j4, i2, j3);
                } else {
                    j3 = j5;
                }
                if (j3 != -9223372036854775807L) {
                    jM8061 = j3;
                }
                String attributeValue2 = xmlPullParser.getAttributeValue(null, "d");
                j4 = attributeValue2 == null ? -9223372036854775807L : Long.parseLong(attributeValue2);
                String attributeValue3 = xmlPullParser.getAttributeValue(null, "r");
                i = attributeValue3 == null ? 0 : Integer.parseInt(attributeValue3);
                z = true;
            } else {
                m8066(xmlPullParser);
            }
        } while (!ᵳʿˉ.ᵡⁱᵥ(xmlPullParser, "SegmentTimeline"));
        if (z) {
            String str = AbstractC3558.f13329;
            m8061(arrayList, jM8061, j4, i, AbstractC3558.m8115(j2, j, 1000L, RoundingMode.DOWN));
        }
        return arrayList;
    }

    /* JADX WARN: Can't fix incorrect switch cases order, some code will duplicate */
    /* JADX WARN: Failed to restore switch over string. Please report as a decompilation issue */
    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Removed duplicated region for block: B:318:0x0960  */
    /* JADX WARN: Removed duplicated region for block: B:334:0x09a8  */
    /* JADX WARN: Removed duplicated region for block: B:336:0x09b1  */
    /* JADX WARN: Removed duplicated region for block: B:339:0x09ba  */
    /* JADX WARN: Removed duplicated region for block: B:344:0x09cf  */
    /* JADX WARN: Removed duplicated region for block: B:348:0x09dd  */
    /* JADX WARN: Removed duplicated region for block: B:378:0x0a74  */
    /* JADX WARN: Removed duplicated region for block: B:381:0x0a7e  */
    /* JADX WARN: Removed duplicated region for block: B:493:0x0cb6 A[LOOP:11: B:252:0x06b7->B:493:0x0cb6, LOOP_END] */
    /* JADX WARN: Removed duplicated region for block: B:590:0x0fc8 A[LOOP:5: B:159:0x0411->B:590:0x0fc8, LOOP_END] */
    /* JADX WARN: Removed duplicated region for block: B:716:0x13aa A[LOOP:1: B:45:0x00cd->B:716:0x13aa, LOOP_END] */
    /* JADX WARN: Removed duplicated region for block: B:724:0x1376 A[SYNTHETIC] */
    /* JADX WARN: Removed duplicated region for block: B:728:0x0e61 A[SYNTHETIC] */
    /* JADX WARN: Removed duplicated region for block: B:747:0x0915 A[SYNTHETIC] */
    /* JADX WARN: Removed duplicated region for block: B:753:0x0a12 A[SYNTHETIC] */
    /* renamed from: ᵸˑ, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public static defpackage.C5361 m8069(org.xmlpull.v1.XmlPullParser r156, android.net.Uri r157) throws org.xmlpull.v1.XmlPullParserException, java.lang.IllegalStateException, java.io.IOException, java.lang.IllegalArgumentException {
        /*
            Method dump skipped, instructions count: 5110
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: defpackage.C3525.m8069(org.xmlpull.v1.XmlPullParser, android.net.Uri):ᵽᵠʾʾ");
    }

    /* renamed from: ᵹᵝᵶ, reason: contains not printable characters */
    public static C3466 m8070(XmlPullParser xmlPullParser, String str) throws XmlPullParserException, IOException {
        String attributeValue = xmlPullParser.getAttributeValue(null, "schemeIdUri");
        if (attributeValue == null) {
            attributeValue = "";
        }
        String attributeValue2 = xmlPullParser.getAttributeValue(null, "value");
        if (attributeValue2 == null) {
            attributeValue2 = null;
        }
        String attributeValue3 = xmlPullParser.getAttributeValue(null, "id");
        String str2 = attributeValue3 != null ? attributeValue3 : null;
        do {
            xmlPullParser.next();
        } while (!ᵳʿˉ.ᵡⁱᵥ(xmlPullParser, str));
        return new C3466(attributeValue, attributeValue2, str2);
    }

    /* renamed from: ᵻᵢﹳᵰ, reason: contains not printable characters */
    public static long m8071(XmlPullParser xmlPullParser, long j) {
        String attributeValue = xmlPullParser.getAttributeValue(null, "availabilityTimeOffset");
        if (attributeValue == null) {
            return j;
        }
        if ("INF".equals(attributeValue)) {
            return Long.MAX_VALUE;
        }
        return (long) (Float.parseFloat(attributeValue) * 1000000.0f);
    }

    @Override // defpackage.InterfaceC4068
    /* renamed from: ᵞʡ */
    public final Object mo2519(Uri uri, C1779 c1779) throws XmlPullParserException, IOException {
        try {
            XmlPullParser xmlPullParserNewPullParser = this.f13241.newPullParser();
            xmlPullParserNewPullParser.setInput(c1779, null);
            if (xmlPullParserNewPullParser.next() == 2 && "MPD".equals(xmlPullParserNewPullParser.getName())) {
                return m8069(xmlPullParserNewPullParser, uri);
            }
            throw ParserException.m357("inputStream does not contain a valid media presentation description", null);
        } catch (XmlPullParserException e) {
            if (e.getDetail() instanceof IOException) {
                throw ((IOException) e.getDetail());
            }
            throw ParserException.m357(null, e);
        }
    }
}
