package defpackage;

import android.net.Uri;
import androidx.media3.common.ParserException;
import java.util.Arrays;

/* renamed from: ˆᵺ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public final class C0901 {

    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public final Uri f4076;

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public final long f4077;

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public final int f4078;

    public C0901(int i, long j, Uri uri) {
        this.f4077 = j;
        this.f4078 = i;
        this.f4076 = uri;
    }

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public static C4471 m3022(Uri uri, String str) {
        ˏᵭᵔᵬ.ᵻᵢﹳᵰ(4, "initialCapacity");
        Object[] objArrCopyOf = new Object[4];
        String str2 = AbstractC3558.f13329;
        int i = -1;
        String[] strArrSplit = str.split(",", -1);
        int length = strArrSplit.length;
        int i2 = 0;
        int i3 = 0;
        while (i2 < length) {
            String str3 = strArrSplit[i2];
            String[] strArrSplit2 = str3.split(";", i);
            int length2 = strArrSplit2.length;
            int i4 = i;
            int i5 = i2;
            long j = -9223372036854775807L;
            int i6 = 0;
            Uri uriM3023 = null;
            while (i6 < length2) {
                String str4 = strArrSplit2[i6];
                try {
                    String[] strArrSplit3 = str4.split("=", 2);
                    String str5 = strArrSplit3[0];
                    String str6 = strArrSplit3[1];
                    int iHashCode = str5.hashCode();
                    String[] strArr = strArrSplit;
                    if (iHashCode != 113759) {
                        if (iHashCode != 116079) {
                            if (iHashCode != 1524180539 || !str5.equals("rtptime")) {
                                throw ParserException.m357(str5, null);
                            }
                            j = Long.parseLong(str6);
                            i6++;
                            strArrSplit = strArr;
                        } else {
                            if (!str5.equals("url")) {
                                throw ParserException.m357(str5, null);
                            }
                            uriM3023 = m3023(uri, str6);
                            i6++;
                            strArrSplit = strArr;
                        }
                    } else {
                        if (!str5.equals("seq")) {
                            throw ParserException.m357(str5, null);
                        }
                        i4 = Integer.parseInt(str6);
                        i6++;
                        strArrSplit = strArr;
                    }
                } catch (Exception e) {
                    throw ParserException.m357(str4, e);
                }
            }
            String[] strArr2 = strArrSplit;
            if (uriM3023 != null && uriM3023.getScheme() != null) {
                i = -1;
                if (i4 != -1 || j != -9223372036854775807L) {
                    C0901 c0901 = new C0901(i4, j, uriM3023);
                    int i7 = i3 + 1;
                    int iM7813 = AbstractC3435.m7813(objArrCopyOf.length, i7);
                    if (iM7813 > objArrCopyOf.length) {
                        objArrCopyOf = Arrays.copyOf(objArrCopyOf, iM7813);
                    }
                    objArrCopyOf[i3] = c0901;
                    i3 = i7;
                    strArrSplit = strArr2;
                    i2 = i5 + 1;
                }
            }
            throw ParserException.m357(str3, null);
        }
        return AbstractC2692.m6695(i3, objArrCopyOf);
    }

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public static Uri m3023(Uri uri, String str) {
        String scheme = uri.getScheme();
        scheme.getClass();
        ᵛᵾˏ.ᵯٴᵦ(scheme.equals("rtsp"));
        Uri uri2 = Uri.parse(str);
        if (uri2.isAbsolute()) {
            return uri2;
        }
        Uri uri3 = Uri.parse("rtsp://" + str);
        String string = uri.toString();
        String host = uri3.getHost();
        host.getClass();
        return host.equals(uri.getHost()) ? uri3 : string.endsWith("/") ? ˆᴵ.ᵿʗᵝʽ(string, str) : ˆᴵ.ᵿʗᵝʽ(string.concat("/"), str);
    }
}
