290 lines
15 KiB
Java
290 lines
15 KiB
Java
package c.i.a.c.e2.u;
|
|
|
|
import android.text.TextUtils;
|
|
import c.i.a.c.e2.d;
|
|
import c.i.a.c.e2.f;
|
|
import c.i.a.c.i2.f0;
|
|
import c.i.a.c.i2.w;
|
|
import com.airbnb.lottie.parser.AnimatableValueParser;
|
|
import com.google.android.exoplayer2.ParserException;
|
|
import com.google.android.exoplayer2.text.SubtitleDecoderException;
|
|
import java.util.ArrayList;
|
|
import java.util.Arrays;
|
|
import java.util.HashSet;
|
|
import java.util.Objects;
|
|
import java.util.regex.Matcher;
|
|
import java.util.regex.Pattern;
|
|
/* compiled from: WebvttDecoder */
|
|
public final class i extends d {
|
|
public final w n = new w();
|
|
public final c o = new c();
|
|
|
|
public i() {
|
|
super("WebvttDecoder");
|
|
}
|
|
|
|
/* JADX WARNING: Code restructure failed: missing block: B:53:0x0110, code lost:
|
|
if (")".equals(c.i.a.c.e2.u.c.b(r10, r11)) == false) goto L_0x0112;
|
|
*/
|
|
/* JADX WARNING: Unknown variable types count: 1 */
|
|
@Override // c.i.a.c.e2.d
|
|
public f j(byte[] bArr, int i, boolean z2) throws SubtitleDecoderException {
|
|
ArrayList arrayList;
|
|
g gVar;
|
|
String str;
|
|
c cVar;
|
|
String str2;
|
|
String sb;
|
|
w wVar = this.n;
|
|
wVar.a = bArr;
|
|
wVar.f913c = i;
|
|
int i2 = 0;
|
|
wVar.b = 0;
|
|
ArrayList arrayList2 = new ArrayList();
|
|
try {
|
|
j.c(this.n);
|
|
do {
|
|
} while (!TextUtils.isEmpty(this.n.g()));
|
|
arrayList = new ArrayList();
|
|
} catch (ParserException e) {
|
|
throw new SubtitleDecoderException(e);
|
|
}
|
|
while (true) {
|
|
w wVar2 = this.n;
|
|
int i3 = -1;
|
|
?? r8 = 1;
|
|
char c2 = 65535;
|
|
int i4 = 0;
|
|
while (c2 == 65535) {
|
|
i4 = wVar2.b;
|
|
String g = wVar2.g();
|
|
c2 = g == null ? 0 : "STYLE".equals(g) ? 2 : g.startsWith("NOTE") ? (char) 1 : 3;
|
|
}
|
|
wVar2.D(i4);
|
|
if (c2 == 0) {
|
|
return new k(arrayList);
|
|
}
|
|
if (c2 == 1) {
|
|
do {
|
|
} while (!TextUtils.isEmpty(this.n.g()));
|
|
} else {
|
|
if (c2 == 2) {
|
|
if (arrayList.isEmpty()) {
|
|
this.n.g();
|
|
c cVar2 = this.o;
|
|
w wVar3 = this.n;
|
|
cVar2.f853c.setLength(i2);
|
|
int i5 = wVar3.b;
|
|
do {
|
|
} while (!TextUtils.isEmpty(wVar3.g()));
|
|
cVar2.b.B(wVar3.a, wVar3.b);
|
|
cVar2.b.D(i5);
|
|
ArrayList arrayList3 = new ArrayList();
|
|
while (true) {
|
|
w wVar4 = cVar2.b;
|
|
StringBuilder sb2 = cVar2.f853c;
|
|
c.c(wVar4);
|
|
if (wVar4.a() >= 5 && "::cue".equals(wVar4.p(5))) {
|
|
int i6 = wVar4.b;
|
|
String b = c.b(wVar4, sb2);
|
|
if (b != null) {
|
|
if ("{".equals(b)) {
|
|
wVar4.D(i6);
|
|
str = "";
|
|
} else if ("(".equals(b)) {
|
|
int i7 = wVar4.b;
|
|
int i8 = wVar4.f913c;
|
|
boolean z3 = false;
|
|
while (i7 < i8 && !z3) {
|
|
int i9 = i7 + 1;
|
|
boolean z4 = ((char) wVar4.a[i7]) == ')';
|
|
i7 = i9;
|
|
z3 = z4;
|
|
}
|
|
str = wVar4.p((i7 - 1) - wVar4.b).trim();
|
|
} else {
|
|
str = null;
|
|
}
|
|
if (str == null || !"{".equals(c.b(cVar2.b, cVar2.f853c))) {
|
|
break;
|
|
}
|
|
f fVar = new f();
|
|
if (!"".equals(str)) {
|
|
int indexOf = str.indexOf(91);
|
|
if (indexOf != i3) {
|
|
Matcher matcher = c.a.matcher(str.substring(indexOf));
|
|
if (matcher.matches()) {
|
|
String group = matcher.group((int) r8);
|
|
Objects.requireNonNull(group);
|
|
fVar.d = group;
|
|
}
|
|
str = str.substring(i2, indexOf);
|
|
}
|
|
String[] G = f0.G(str, "\\.");
|
|
String str3 = G[i2];
|
|
int indexOf2 = str3.indexOf(35);
|
|
if (indexOf2 != i3) {
|
|
fVar.b = str3.substring(i2, indexOf2);
|
|
fVar.a = str3.substring(indexOf2 + 1);
|
|
} else {
|
|
fVar.b = str3;
|
|
}
|
|
if (G.length > r8) {
|
|
int length = G.length;
|
|
AnimatableValueParser.k(r8);
|
|
AnimatableValueParser.k(length <= G.length);
|
|
int i10 = r8 == true ? 1 : 0;
|
|
int i11 = r8 == true ? 1 : 0;
|
|
int i12 = r8 == true ? 1 : 0;
|
|
fVar.f854c = new HashSet(Arrays.asList((String[]) Arrays.copyOfRange(G, i10, length)));
|
|
}
|
|
}
|
|
boolean z5 = false;
|
|
String str4 = null;
|
|
while (!z5) {
|
|
w wVar5 = cVar2.b;
|
|
int i13 = wVar5.b;
|
|
String b2 = c.b(wVar5, cVar2.f853c);
|
|
boolean z6 = b2 == null || "}".equals(b2);
|
|
if (!z6) {
|
|
cVar2.b.D(i13);
|
|
w wVar6 = cVar2.b;
|
|
StringBuilder sb3 = cVar2.f853c;
|
|
c.c(wVar6);
|
|
String a = c.a(wVar6, sb3);
|
|
if (!"".equals(a) && ":".equals(c.b(wVar6, sb3))) {
|
|
c.c(wVar6);
|
|
StringBuilder sb4 = new StringBuilder();
|
|
boolean z7 = false;
|
|
while (true) {
|
|
if (z7) {
|
|
str2 = b2;
|
|
cVar = cVar2;
|
|
sb = sb4.toString();
|
|
break;
|
|
}
|
|
str2 = b2;
|
|
int i14 = wVar6.b;
|
|
cVar = cVar2;
|
|
String b3 = c.b(wVar6, sb3);
|
|
if (b3 == null) {
|
|
sb = null;
|
|
break;
|
|
} else if ("}".equals(b3) || ";".equals(b3)) {
|
|
wVar6.D(i14);
|
|
b2 = str2;
|
|
cVar2 = cVar;
|
|
z7 = true;
|
|
} else {
|
|
sb4.append(b3);
|
|
b2 = str2;
|
|
cVar2 = cVar;
|
|
}
|
|
}
|
|
if (sb != null && !"".equals(sb)) {
|
|
int i15 = wVar6.b;
|
|
String b4 = c.b(wVar6, sb3);
|
|
if (!";".equals(b4)) {
|
|
if ("}".equals(b4)) {
|
|
wVar6.D(i15);
|
|
}
|
|
}
|
|
if ("color".equals(a)) {
|
|
fVar.f = c.i.a.c.i2.i.a(sb, true);
|
|
fVar.g = true;
|
|
} else if ("background-color".equals(a)) {
|
|
fVar.h = c.i.a.c.i2.i.a(sb, true);
|
|
fVar.i = true;
|
|
} else {
|
|
if ("ruby-position".equals(a)) {
|
|
if ("over".equals(sb)) {
|
|
fVar.o = 1;
|
|
} else if ("under".equals(sb)) {
|
|
fVar.o = 2;
|
|
}
|
|
} else if ("text-combine-upright".equals(a)) {
|
|
fVar.p = "all".equals(sb) || sb.startsWith("digits");
|
|
} else if ("text-decoration".equals(a)) {
|
|
if ("underline".equals(sb)) {
|
|
fVar.k = 1;
|
|
}
|
|
} else if ("font-family".equals(a)) {
|
|
fVar.e = f0.K(sb);
|
|
} else {
|
|
if ("font-weight".equals(a)) {
|
|
if ("bold".equals(sb)) {
|
|
fVar.l = 1;
|
|
}
|
|
} else if ("font-style".equals(a) && "italic".equals(sb)) {
|
|
fVar.m = 1;
|
|
}
|
|
z5 = z6;
|
|
str4 = str2;
|
|
cVar2 = cVar;
|
|
}
|
|
z5 = z6;
|
|
str4 = str2;
|
|
cVar2 = cVar;
|
|
}
|
|
}
|
|
z5 = z6;
|
|
str4 = str2;
|
|
cVar2 = cVar;
|
|
}
|
|
}
|
|
str2 = b2;
|
|
cVar = cVar2;
|
|
z5 = z6;
|
|
str4 = str2;
|
|
cVar2 = cVar;
|
|
}
|
|
if ("}".equals(str4)) {
|
|
arrayList3.add(fVar);
|
|
}
|
|
cVar2 = cVar2;
|
|
i2 = 0;
|
|
i3 = -1;
|
|
r8 = 1;
|
|
}
|
|
}
|
|
str = null;
|
|
if (str == null) {
|
|
break;
|
|
}
|
|
break;
|
|
}
|
|
arrayList2.addAll(arrayList3);
|
|
} else {
|
|
throw new SubtitleDecoderException("A style block was found after the first cue.");
|
|
}
|
|
} else if (c2 == 3) {
|
|
w wVar7 = this.n;
|
|
Pattern pattern = h.a;
|
|
String g2 = wVar7.g();
|
|
if (g2 == null) {
|
|
gVar = null;
|
|
} else {
|
|
Pattern pattern2 = h.a;
|
|
Matcher matcher2 = pattern2.matcher(g2);
|
|
if (matcher2.matches()) {
|
|
gVar = h.d(null, matcher2, wVar7, arrayList2);
|
|
} else {
|
|
String g3 = wVar7.g();
|
|
if (g3 != null) {
|
|
Matcher matcher3 = pattern2.matcher(g3);
|
|
if (matcher3.matches()) {
|
|
gVar = h.d(g2.trim(), matcher3, wVar7, arrayList2);
|
|
}
|
|
}
|
|
gVar = null;
|
|
}
|
|
}
|
|
if (gVar != null) {
|
|
arrayList.add(gVar);
|
|
}
|
|
}
|
|
i2 = 0;
|
|
}
|
|
}
|
|
}
|
|
}
|