68 lines
2.2 KiB
Java
68 lines
2.2 KiB
Java
package c.i.a.c.c2.j;
|
|
|
|
import c.i.a.c.c2.d;
|
|
import c.i.a.c.c2.g;
|
|
import c.i.a.c.i2.f0;
|
|
import c.i.b.a.c;
|
|
import com.google.android.exoplayer2.metadata.Metadata;
|
|
import com.google.android.exoplayer2.metadata.icy.IcyInfo;
|
|
import java.nio.ByteBuffer;
|
|
import java.nio.charset.CharacterCodingException;
|
|
import java.nio.charset.CharsetDecoder;
|
|
import java.util.regex.Matcher;
|
|
import java.util.regex.Pattern;
|
|
/* compiled from: IcyDecoder */
|
|
public final class a extends g {
|
|
public static final Pattern a = Pattern.compile("(.+?)='(.*?)';", 32);
|
|
public final CharsetDecoder b = c.f1266c.newDecoder();
|
|
|
|
/* renamed from: c reason: collision with root package name */
|
|
public final CharsetDecoder f778c = c.b.newDecoder();
|
|
|
|
/* JADX INFO: finally extract failed */
|
|
@Override // c.i.a.c.c2.g
|
|
public Metadata b(d dVar, ByteBuffer byteBuffer) {
|
|
String str;
|
|
String str2 = null;
|
|
try {
|
|
str = this.b.decode(byteBuffer).toString();
|
|
} catch (CharacterCodingException unused) {
|
|
try {
|
|
str = this.f778c.decode(byteBuffer).toString();
|
|
this.f778c.reset();
|
|
byteBuffer.rewind();
|
|
} catch (CharacterCodingException unused2) {
|
|
this.f778c.reset();
|
|
byteBuffer.rewind();
|
|
str = null;
|
|
} catch (Throwable th) {
|
|
this.f778c.reset();
|
|
byteBuffer.rewind();
|
|
throw th;
|
|
}
|
|
} finally {
|
|
this.b.reset();
|
|
byteBuffer.rewind();
|
|
}
|
|
byte[] bArr = new byte[byteBuffer.limit()];
|
|
byteBuffer.get(bArr);
|
|
if (str == null) {
|
|
return new Metadata(new IcyInfo(bArr, null, null));
|
|
}
|
|
Matcher matcher = a.matcher(str);
|
|
String str3 = null;
|
|
for (int i = 0; matcher.find(i); i = matcher.end()) {
|
|
String K = f0.K(matcher.group(1));
|
|
String group = matcher.group(2);
|
|
if (K != null) {
|
|
if (K.equals("streamurl")) {
|
|
str3 = group;
|
|
} else if (K.equals("streamtitle")) {
|
|
str2 = group;
|
|
}
|
|
}
|
|
}
|
|
return new Metadata(new IcyInfo(bArr, str2, str3));
|
|
}
|
|
}
|