package defpackage;

import java.nio.ByteBuffer;
import java.nio.charset.CharacterCodingException;
import java.nio.charset.CharsetDecoder;
import java.nio.charset.StandardCharsets;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/* renamed from: ᵚᵗ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public final class C2674 extends ˁˈᵸ {

    /* renamed from: ˎˏʜʾ, reason: contains not printable characters */
    public static final Pattern f10377 = Pattern.compile("(.+?)='(.*?)';", 32);

    /* renamed from: ˇʼʤˎ, reason: contains not printable characters */
    public final CharsetDecoder f10378 = StandardCharsets.UTF_8.newDecoder();

    /* renamed from: ˏˋٴ, reason: contains not printable characters */
    public final CharsetDecoder f10379 = StandardCharsets.ISO_8859_1.newDecoder();

    /* renamed from: ᵡʠ, reason: contains not printable characters */
    public final C3034 m6673(C1304 c1304, ByteBuffer byteBuffer) {
        String string;
        CharsetDecoder charsetDecoder = this.f10379;
        CharsetDecoder charsetDecoder2 = this.f10378;
        String str = null;
        try {
            string = charsetDecoder2.decode(byteBuffer).toString();
        } catch (CharacterCodingException unused) {
            try {
                String string2 = charsetDecoder.decode(byteBuffer).toString();
                charsetDecoder.reset();
                byteBuffer.rewind();
                string = string2;
            } catch (CharacterCodingException unused2) {
                charsetDecoder.reset();
                byteBuffer.rewind();
                string = null;
            } catch (Throwable th) {
                charsetDecoder.reset();
                byteBuffer.rewind();
                throw th;
            }
        } finally {
            charsetDecoder2.reset();
            byteBuffer.rewind();
        }
        byte[] bArr = new byte[byteBuffer.limit()];
        byteBuffer.get(bArr);
        if (string == null) {
            return new C3034(new C0762(null, null, bArr));
        }
        Matcher matcher = f10377.matcher(string);
        String str2 = null;
        for (int iEnd = 0; matcher.find(iEnd); iEnd = matcher.end()) {
            String strGroup = matcher.group(1);
            String strGroup2 = matcher.group(2);
            if (strGroup != null) {
                String str3 = ᵿᵧ.ᵺʙ(strGroup);
                str3.getClass();
                if (str3.equals("streamurl")) {
                    str2 = strGroup2;
                } else if (str3.equals("streamtitle")) {
                    str = strGroup2;
                }
            }
        }
        return new C3034(new C0762(str, str2, bArr));
    }
}
