package defpackage;

import android.net.Uri;
import androidx.media3.common.ParserException;
import j$.util.Objects;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/* JADX INFO: renamed from: ᵔˇ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes3.dex */
public abstract class AbstractC2234 {

    /* JADX INFO: renamed from: ᵲᵶᵳˈ, reason: contains not printable characters */
    public static final Pattern f8843 = Pattern.compile("([a-z])=\\s?((?:.|\f)++)");

    /* JADX INFO: renamed from: ʽˈˋ, reason: contains not printable characters */
    public static final Pattern f8841 = Pattern.compile("^([a-z])=$");

    /* JADX INFO: renamed from: ːˏᵟᵯ, reason: contains not printable characters */
    public static final Pattern f8842 = Pattern.compile("([\\x21\\x23-\\x27\\x2a\\x2b\\x2d\\x2e\\x30-\\x39\\x41-\\x5a\\x5e-\\x7e]+)(?::((?:.|\f)*+))?");

    /* JADX INFO: renamed from: ᵷᵺʾᵖ, reason: contains not printable characters */
    public static final Pattern f8844 = Pattern.compile("(\\S+)\\s(\\S+)\\s(\\S+)\\s(\\S+)");

    /* JADX WARN: Code restructure failed: missing block: B:185:0x0216, code lost:
    
        continue;
     */
    /* JADX WARN: Code restructure failed: missing block: B:20:0x0062, code lost:
    
        throw androidx.media3.common.ParserException.m355("Malformed SDP line: ".concat(r10), null);
     */
    /* JADX INFO: renamed from: ᵲᵶᵳˈ, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public static C4521 m5819(String str) throws ParserException {
        String str2;
        C3956 c3956 = new C3956();
        String str3 = AbstractC0208.f1679;
        if (!str.contains(str3)) {
            str3 = AbstractC0208.f1683;
        }
        String str4 = AbstractC0956.f4222;
        String[] strArrSplit = str.split(str3, -1);
        int length = strArrSplit.length;
        C1999 c1999 = null;
        int i = 0;
        boolean z = false;
        while (true) {
            C3975 c3975 = c3956.f15112;
            if (i >= length) {
                if (c1999 != null) {
                    try {
                        c3975.m7406(c1999.m5374());
                    } catch (IllegalArgumentException | IllegalStateException e) {
                        throw ParserException.m355(null, e);
                    }
                }
                try {
                    return new C4521(c3956);
                } catch (IllegalArgumentException | IllegalStateException e2) {
                    throw ParserException.m355(null, e2);
                }
            }
            String strTrim = strArrSplit[i].trim();
            if (!strTrim.isEmpty()) {
                Matcher matcher = f8843.matcher(strTrim);
                if (matcher.matches()) {
                    String strGroup = matcher.group(1);
                    strGroup.getClass();
                    String strGroup2 = matcher.group(2);
                    strGroup2.getClass();
                    switch (strGroup.hashCode()) {
                        case 97:
                            if (!strGroup.equals("a")) {
                                continue;
                            } else if (z) {
                                continue;
                            } else {
                                Matcher matcher2 = f8842.matcher(strGroup2);
                                if (!matcher2.matches()) {
                                    throw ParserException.m355("Malformed Attribute line: ".concat(strTrim), null);
                                }
                                String strGroup3 = matcher2.group(1);
                                strGroup3.getClass();
                                String strGroup4 = matcher2.group(2);
                                if (strGroup4 == null) {
                                    strGroup4 = "";
                                }
                                if (c1999 != null) {
                                    c1999.f7912.put(strGroup3, strGroup4);
                                } else {
                                    c3956.f15118.put(strGroup3, strGroup4);
                                }
                            }
                            break;
                        case 98:
                            if (!strGroup.equals("b")) {
                                continue;
                            } else if (!z) {
                                String[] strArrSplit2 = strGroup2.split(":\\s?", -1);
                                ᵻᵪ.ᵱᵽʡᵚ(strArrSplit2.length == 2);
                                int i2 = Integer.parseInt(strArrSplit2[1]);
                                if (c1999 != null) {
                                    c1999.f7917 = i2 * 1000;
                                } else {
                                    c3956.f15114 = i2 * 1000;
                                }
                            }
                            break;
                        case 99:
                            if (!strGroup.equals("c")) {
                                continue;
                            } else if (!z) {
                                if (c1999 != null) {
                                    c1999.f7910 = strGroup2;
                                } else {
                                    c3956.f15113 = strGroup2;
                                }
                            }
                            break;
                        case 101:
                            if (!strGroup.equals("e")) {
                                continue;
                            } else {
                                c3956.f15120 = strGroup2;
                            }
                            break;
                        case 105:
                            if (!strGroup.equals("i")) {
                                continue;
                            } else if (!z) {
                                if (c1999 != null) {
                                    c1999.f7914 = strGroup2;
                                } else {
                                    c3956.f15117 = strGroup2;
                                }
                            }
                            break;
                        case 107:
                            if (!strGroup.equals("k")) {
                                continue;
                            } else if (!z) {
                                if (c1999 != null) {
                                    c1999.f7916 = strGroup2;
                                } else {
                                    c3956.f15122 = strGroup2;
                                }
                            }
                            break;
                        case 109:
                            if (!strGroup.equals("m")) {
                                continue;
                            } else {
                                if (c1999 != null) {
                                    try {
                                        c3975.m7406(c1999.m5374());
                                    } catch (IllegalArgumentException | IllegalStateException e3) {
                                        throw ParserException.m355(null, e3);
                                    }
                                }
                                Matcher matcher3 = f8844.matcher(strGroup2);
                                if (!matcher3.matches()) {
                                    throw ParserException.m355("Malformed SDP media description line: ".concat(strGroup2), null);
                                }
                                String strGroup5 = matcher3.group(1);
                                strGroup5.getClass();
                                String strGroup6 = matcher3.group(2);
                                strGroup6.getClass();
                                String strGroup7 = matcher3.group(3);
                                strGroup7.getClass();
                                String strGroup8 = matcher3.group(4);
                                strGroup8.getClass();
                                try {
                                    c1999 = new C1999(Integer.parseInt(strGroup6), Integer.parseInt(strGroup8), strGroup5, strGroup7);
                                } catch (NumberFormatException e4) {
                                    ˋˀᵧ.ᵠˏˏ("Malformed SDP media description line: ".concat(strGroup2), e4);
                                    c1999 = null;
                                }
                                z = c1999 == null;
                            }
                            break;
                        case 111:
                            if (!strGroup.equals("o")) {
                                continue;
                            } else {
                                c3956.f15115 = strGroup2;
                            }
                            break;
                        case 112:
                            if (!strGroup.equals("p")) {
                                continue;
                            } else {
                                c3956.f15116 = strGroup2;
                            }
                            break;
                        case 114:
                            str2 = "r";
                            break;
                        case 115:
                            if (!strGroup.equals("s")) {
                                continue;
                            } else {
                                c3956.f15121 = strGroup2;
                            }
                            break;
                        case 116:
                            if (!strGroup.equals("t")) {
                                continue;
                            } else {
                                c3956.f15123 = strGroup2;
                            }
                            break;
                        case 117:
                            if (!strGroup.equals("u")) {
                                continue;
                            } else {
                                c3956.f15119 = Uri.parse(strGroup2);
                            }
                            break;
                        case 118:
                            if (!strGroup.equals("v")) {
                                continue;
                            } else {
                                if (!"0".equals(strGroup2)) {
                                    throw ParserException.m355("SDP version " + strGroup2 + " is not supported.", null);
                                }
                            }
                            break;
                        case 122:
                            str2 = "z";
                            break;
                    }
                    strGroup.equals(str2);
                } else {
                    Matcher matcher4 = f8841.matcher(strTrim);
                    if (!matcher4.matches() || !Objects.equals(matcher4.group(1), "i")) {
                    }
                }
            }
            i++;
        }
    }
}
