46 lines
1.3 KiB
Java
46 lines
1.3 KiB
Java
package c.i.a.c.e2.u;
|
|
|
|
import c.d.b.a.a;
|
|
import c.i.a.c.i2.f0;
|
|
import c.i.a.c.i2.w;
|
|
import com.google.android.exoplayer2.ParserException;
|
|
import java.util.regex.Pattern;
|
|
/* compiled from: WebvttParserUtil */
|
|
public final class j {
|
|
static {
|
|
Pattern.compile("^NOTE([ \t].*)?$");
|
|
}
|
|
|
|
public static float a(String str) throws NumberFormatException {
|
|
if (str.endsWith("%")) {
|
|
return Float.parseFloat(str.substring(0, str.length() - 1)) / 100.0f;
|
|
}
|
|
throw new NumberFormatException("Percentages must end with %");
|
|
}
|
|
|
|
public static long b(String str) throws NumberFormatException {
|
|
int i = f0.a;
|
|
String[] split = str.split("\\.", 2);
|
|
long j = 0;
|
|
for (String str2 : f0.G(split[0], ":")) {
|
|
j = (j * 60) + Long.parseLong(str2);
|
|
}
|
|
long j2 = j * 1000;
|
|
if (split.length == 2) {
|
|
j2 += Long.parseLong(split[1]);
|
|
}
|
|
return j2 * 1000;
|
|
}
|
|
|
|
public static void c(w wVar) throws ParserException {
|
|
int i = wVar.b;
|
|
String g = wVar.g();
|
|
if (!(g != null && g.startsWith("WEBVTT"))) {
|
|
wVar.D(i);
|
|
StringBuilder K = a.K("Expected WEBVTT. Got ");
|
|
K.append(wVar.g());
|
|
throw new ParserException(K.toString());
|
|
}
|
|
}
|
|
}
|