- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
524 lines
20 KiB
Java
524 lines
20 KiB
Java
package com.applovin.impl;
|
|
|
|
import android.text.Layout;
|
|
import com.applovin.exoplayer2.common.base.Ascii;
|
|
import com.mbridge.msdk.playercommon.exoplayer2.C;
|
|
import com.mbridge.msdk.playercommon.exoplayer2.text.ttml.TtmlNode;
|
|
import csdk.gluads.Consts;
|
|
import java.io.ByteArrayInputStream;
|
|
import java.io.IOException;
|
|
import java.util.ArrayDeque;
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
import java.util.regex.Matcher;
|
|
import java.util.regex.Pattern;
|
|
import org.xmlpull.v1.XmlPullParser;
|
|
import org.xmlpull.v1.XmlPullParserException;
|
|
import org.xmlpull.v1.XmlPullParserFactory;
|
|
|
|
/* loaded from: classes.dex */
|
|
public final class fp extends ek {
|
|
private static final Pattern p = Pattern.compile("^([0-9][0-9]+):([0-9][0-9]):([0-9][0-9])(?:(\\.[0-9]+)|:([0-9][0-9])(?:\\.([0-9]+))?)?$");
|
|
private static final Pattern q = Pattern.compile("^([0-9]+(?:\\.[0-9]+)?)(h|m|s|ms|f|t)$");
|
|
private static final Pattern r = Pattern.compile("^(([0-9]*.)?[0-9]+)(px|em|%)$");
|
|
static final Pattern s = Pattern.compile("^([-+]?\\d+\\.?\\d*?)%$");
|
|
static final Pattern t = Pattern.compile("^(\\d+\\.?\\d*?)% (\\d+\\.?\\d*?)%$");
|
|
private static final Pattern u = Pattern.compile("^(\\d+\\.?\\d*?)px (\\d+\\.?\\d*?)px$");
|
|
private static final Pattern v = Pattern.compile("^(\\d+) (\\d+)$");
|
|
private static final b w = new b(30.0f, 1, 1);
|
|
private static final a x = new a(32, 15);
|
|
private final XmlPullParserFactory o;
|
|
|
|
private static float c(String str) {
|
|
Matcher matcher = s.matcher(str);
|
|
if (!matcher.matches()) {
|
|
pc.d("TtmlDecoder", "Invalid value for shear: " + str);
|
|
return Float.MAX_VALUE;
|
|
}
|
|
try {
|
|
return Math.min(100.0f, Math.max(-100.0f, Float.parseFloat((String) b1.a((Object) matcher.group(1)))));
|
|
} catch (NumberFormatException e) {
|
|
pc.c("TtmlDecoder", "Failed to parse shear: " + str, e);
|
|
return Float.MAX_VALUE;
|
|
}
|
|
}
|
|
|
|
public fp() {
|
|
super("TtmlDecoder");
|
|
try {
|
|
XmlPullParserFactory newInstance = XmlPullParserFactory.newInstance();
|
|
this.o = newInstance;
|
|
newInstance.setNamespaceAware(true);
|
|
} catch (XmlPullParserException e) {
|
|
throw new RuntimeException("Couldn't create XmlPullParserFactory instance", e);
|
|
}
|
|
}
|
|
|
|
private static String[] d(String str) {
|
|
String trim = str.trim();
|
|
return trim.isEmpty() ? new String[0] : xp.a(trim, "\\s+");
|
|
}
|
|
|
|
private static jp a(jp jpVar) {
|
|
return jpVar == null ? new jp() : jpVar;
|
|
}
|
|
|
|
private static Layout.Alignment b(String str) {
|
|
String lowerCase = Ascii.toLowerCase(str);
|
|
lowerCase.hashCode();
|
|
switch (lowerCase) {
|
|
case "center":
|
|
return Layout.Alignment.ALIGN_CENTER;
|
|
case "end":
|
|
case "right":
|
|
return Layout.Alignment.ALIGN_OPPOSITE;
|
|
case "left":
|
|
case "start":
|
|
return Layout.Alignment.ALIGN_NORMAL;
|
|
default:
|
|
return null;
|
|
}
|
|
}
|
|
|
|
@Override // com.applovin.impl.ek
|
|
public nl a(byte[] bArr, int i, boolean z) {
|
|
b bVar;
|
|
try {
|
|
XmlPullParser newPullParser = this.o.newPullParser();
|
|
HashMap hashMap = new HashMap();
|
|
HashMap hashMap2 = new HashMap();
|
|
HashMap hashMap3 = new HashMap();
|
|
hashMap2.put("", new hp(""));
|
|
c cVar = null;
|
|
newPullParser.setInput(new ByteArrayInputStream(bArr, 0, i), null);
|
|
ArrayDeque arrayDeque = new ArrayDeque();
|
|
b bVar2 = w;
|
|
a aVar = x;
|
|
int i2 = 0;
|
|
kp kpVar = null;
|
|
for (int eventType = newPullParser.getEventType(); eventType != 1; eventType = newPullParser.getEventType()) {
|
|
gp gpVar = (gp) arrayDeque.peek();
|
|
if (i2 == 0) {
|
|
String name = newPullParser.getName();
|
|
if (eventType == 2) {
|
|
if (TtmlNode.TAG_TT.equals(name)) {
|
|
bVar2 = a(newPullParser);
|
|
aVar = a(newPullParser, x);
|
|
cVar = b(newPullParser);
|
|
}
|
|
c cVar2 = cVar;
|
|
b bVar3 = bVar2;
|
|
a aVar2 = aVar;
|
|
if (a(name)) {
|
|
if (TtmlNode.TAG_HEAD.equals(name)) {
|
|
bVar = bVar3;
|
|
a(newPullParser, hashMap, aVar2, cVar2, hashMap2, hashMap3);
|
|
} else {
|
|
bVar = bVar3;
|
|
try {
|
|
gp a2 = a(newPullParser, gpVar, hashMap2, bVar);
|
|
arrayDeque.push(a2);
|
|
if (gpVar != null) {
|
|
gpVar.a(a2);
|
|
}
|
|
} catch (pl e) {
|
|
pc.c("TtmlDecoder", "Suppressing parser error", e);
|
|
}
|
|
}
|
|
bVar2 = bVar;
|
|
cVar = cVar2;
|
|
aVar = aVar2;
|
|
} else {
|
|
pc.c("TtmlDecoder", "Ignoring unsupported tag: " + newPullParser.getName());
|
|
bVar = bVar3;
|
|
}
|
|
bVar2 = bVar;
|
|
cVar = cVar2;
|
|
aVar = aVar2;
|
|
i2++;
|
|
} else if (eventType == 4) {
|
|
((gp) b1.a(gpVar)).a(gp.a(newPullParser.getText()));
|
|
} else if (eventType == 3) {
|
|
if (newPullParser.getName().equals(TtmlNode.TAG_TT)) {
|
|
kpVar = new kp((gp) b1.a((gp) arrayDeque.peek()), hashMap, hashMap2, hashMap3);
|
|
}
|
|
arrayDeque.pop();
|
|
}
|
|
newPullParser.next();
|
|
} else {
|
|
if (eventType != 2) {
|
|
if (eventType == 3) {
|
|
i2--;
|
|
}
|
|
newPullParser.next();
|
|
}
|
|
i2++;
|
|
newPullParser.next();
|
|
}
|
|
}
|
|
if (kpVar != null) {
|
|
return kpVar;
|
|
}
|
|
throw new pl("No TTML subtitles found");
|
|
} catch (IOException e2) {
|
|
throw new IllegalStateException("Unexpected error when reading input.", e2);
|
|
} catch (XmlPullParserException e3) {
|
|
throw new pl("Unable to decode source", e3);
|
|
}
|
|
}
|
|
|
|
public static final class b {
|
|
final float a;
|
|
final int b;
|
|
final int c;
|
|
|
|
public b(float f, int i, int i2) {
|
|
this.a = f;
|
|
this.b = i;
|
|
this.c = i2;
|
|
}
|
|
}
|
|
|
|
public static final class a {
|
|
final int a;
|
|
final int b;
|
|
|
|
public a(int i, int i2) {
|
|
this.a = i;
|
|
this.b = i2;
|
|
}
|
|
}
|
|
|
|
public static final class c {
|
|
final int a;
|
|
final int b;
|
|
|
|
public c(int i, int i2) {
|
|
this.a = i;
|
|
this.b = i2;
|
|
}
|
|
}
|
|
|
|
private static c b(XmlPullParser xmlPullParser) {
|
|
String a2 = gs.a(xmlPullParser, TtmlNode.ATTR_TTS_EXTENT);
|
|
if (a2 == null) {
|
|
return null;
|
|
}
|
|
Matcher matcher = u.matcher(a2);
|
|
if (!matcher.matches()) {
|
|
pc.d("TtmlDecoder", "Ignoring non-pixel tts extent: " + a2);
|
|
return null;
|
|
}
|
|
try {
|
|
return new c(Integer.parseInt((String) b1.a((Object) matcher.group(1))), Integer.parseInt((String) b1.a((Object) matcher.group(2))));
|
|
} catch (NumberFormatException unused) {
|
|
pc.d("TtmlDecoder", "Ignoring malformed tts extent: " + a2);
|
|
return null;
|
|
}
|
|
}
|
|
|
|
private static boolean a(String str) {
|
|
return str.equals(TtmlNode.TAG_TT) || str.equals(TtmlNode.TAG_HEAD) || str.equals("body") || str.equals(TtmlNode.TAG_DIV) || str.equals(TtmlNode.TAG_P) || str.equals(TtmlNode.TAG_SPAN) || str.equals(TtmlNode.TAG_BR) || str.equals("style") || str.equals(TtmlNode.TAG_STYLING) || str.equals(TtmlNode.TAG_LAYOUT) || str.equals(TtmlNode.TAG_REGION) || str.equals("metadata") || str.equals("image") || str.equals("data") || str.equals("information");
|
|
}
|
|
|
|
private static a a(XmlPullParser xmlPullParser, a aVar) {
|
|
String attributeValue = xmlPullParser.getAttributeValue("http://www.w3.org/ns/ttml#parameter", "cellResolution");
|
|
if (attributeValue == null) {
|
|
return aVar;
|
|
}
|
|
Matcher matcher = v.matcher(attributeValue);
|
|
if (!matcher.matches()) {
|
|
pc.d("TtmlDecoder", "Ignoring malformed cell resolution: " + attributeValue);
|
|
return aVar;
|
|
}
|
|
try {
|
|
int parseInt = Integer.parseInt((String) b1.a((Object) matcher.group(1)));
|
|
int parseInt2 = Integer.parseInt((String) b1.a((Object) matcher.group(2)));
|
|
if (parseInt != 0 && parseInt2 != 0) {
|
|
return new a(parseInt, parseInt2);
|
|
}
|
|
throw new pl("Invalid cell resolution " + parseInt + " " + parseInt2);
|
|
} catch (NumberFormatException unused) {
|
|
pc.d("TtmlDecoder", "Ignoring malformed cell resolution: " + attributeValue);
|
|
return aVar;
|
|
}
|
|
}
|
|
|
|
private static void a(String str, jp jpVar) {
|
|
Matcher matcher;
|
|
String str2;
|
|
String[] a2 = xp.a(str, "\\s+");
|
|
if (a2.length == 1) {
|
|
matcher = r.matcher(str);
|
|
} else if (a2.length == 2) {
|
|
matcher = r.matcher(a2[1]);
|
|
pc.d("TtmlDecoder", "Multiple values in fontSize attribute. Picking the second value for vertical font size and ignoring the first.");
|
|
} else {
|
|
throw new pl("Invalid number of entries for fontSize: " + a2.length + Consts.STRING_PERIOD);
|
|
}
|
|
if (matcher.matches()) {
|
|
str2 = (String) b1.a((Object) matcher.group(3));
|
|
str2.hashCode();
|
|
switch (str2) {
|
|
case "%":
|
|
jpVar.c(3);
|
|
break;
|
|
case "em":
|
|
jpVar.c(2);
|
|
break;
|
|
case "px":
|
|
jpVar.c(1);
|
|
break;
|
|
default:
|
|
throw new pl("Invalid unit for fontSize: '" + str2 + "'.");
|
|
}
|
|
jpVar.a(Float.parseFloat((String) b1.a((Object) matcher.group(1))));
|
|
return;
|
|
}
|
|
throw new pl("Invalid expression for fontSize: '" + str + "'.");
|
|
}
|
|
|
|
private static b a(XmlPullParser xmlPullParser) {
|
|
float f;
|
|
String attributeValue = xmlPullParser.getAttributeValue("http://www.w3.org/ns/ttml#parameter", "frameRate");
|
|
int parseInt = attributeValue != null ? Integer.parseInt(attributeValue) : 30;
|
|
String attributeValue2 = xmlPullParser.getAttributeValue("http://www.w3.org/ns/ttml#parameter", "frameRateMultiplier");
|
|
if (attributeValue2 != null) {
|
|
if (xp.a(attributeValue2, " ").length == 2) {
|
|
f = Integer.parseInt(r2[0]) / Integer.parseInt(r2[1]);
|
|
} else {
|
|
throw new pl("frameRateMultiplier doesn't have 2 parts");
|
|
}
|
|
} else {
|
|
f = 1.0f;
|
|
}
|
|
b bVar = w;
|
|
int i = bVar.b;
|
|
String attributeValue3 = xmlPullParser.getAttributeValue("http://www.w3.org/ns/ttml#parameter", "subFrameRate");
|
|
if (attributeValue3 != null) {
|
|
i = Integer.parseInt(attributeValue3);
|
|
}
|
|
int i2 = bVar.c;
|
|
String attributeValue4 = xmlPullParser.getAttributeValue("http://www.w3.org/ns/ttml#parameter", "tickRate");
|
|
if (attributeValue4 != null) {
|
|
i2 = Integer.parseInt(attributeValue4);
|
|
}
|
|
return new b(parseInt * f, i, i2);
|
|
}
|
|
|
|
private static Map a(XmlPullParser xmlPullParser, Map map, a aVar, c cVar, Map map2, Map map3) {
|
|
do {
|
|
xmlPullParser.next();
|
|
if (gs.c(xmlPullParser, "style")) {
|
|
String a2 = gs.a(xmlPullParser, "style");
|
|
jp a3 = a(xmlPullParser, new jp());
|
|
if (a2 != null) {
|
|
for (String str : d(a2)) {
|
|
a3.a((jp) map.get(str));
|
|
}
|
|
}
|
|
String f = a3.f();
|
|
if (f != null) {
|
|
map.put(f, a3);
|
|
}
|
|
} else if (gs.c(xmlPullParser, TtmlNode.TAG_REGION)) {
|
|
hp a4 = a(xmlPullParser, aVar, cVar);
|
|
if (a4 != null) {
|
|
map2.put(a4.a, a4);
|
|
}
|
|
} else if (gs.c(xmlPullParser, "metadata")) {
|
|
a(xmlPullParser, map3);
|
|
}
|
|
} while (!gs.b(xmlPullParser, TtmlNode.TAG_HEAD));
|
|
return map;
|
|
}
|
|
|
|
private static void a(XmlPullParser xmlPullParser, Map map) {
|
|
String a2;
|
|
do {
|
|
xmlPullParser.next();
|
|
if (gs.c(xmlPullParser, "image") && (a2 = gs.a(xmlPullParser, "id")) != null) {
|
|
map.put(a2, xmlPullParser.nextText());
|
|
}
|
|
} while (!gs.b(xmlPullParser, "metadata"));
|
|
}
|
|
|
|
/* JADX WARN: Can't fix incorrect switch cases order, some code will duplicate */
|
|
private static gp a(XmlPullParser xmlPullParser, gp gpVar, Map map, b bVar) {
|
|
long j;
|
|
long j2;
|
|
char c2;
|
|
int attributeCount = xmlPullParser.getAttributeCount();
|
|
jp a2 = a(xmlPullParser, (jp) null);
|
|
String[] strArr = null;
|
|
String str = null;
|
|
String str2 = "";
|
|
long j3 = C.TIME_UNSET;
|
|
long j4 = C.TIME_UNSET;
|
|
long j5 = C.TIME_UNSET;
|
|
for (int i = 0; i < attributeCount; i++) {
|
|
String attributeName = xmlPullParser.getAttributeName(i);
|
|
String attributeValue = xmlPullParser.getAttributeValue(i);
|
|
attributeName.hashCode();
|
|
switch (attributeName.hashCode()) {
|
|
case -934795532:
|
|
if (attributeName.equals(TtmlNode.TAG_REGION)) {
|
|
c2 = 0;
|
|
break;
|
|
}
|
|
c2 = 65535;
|
|
break;
|
|
case 99841:
|
|
if (attributeName.equals("dur")) {
|
|
c2 = 1;
|
|
break;
|
|
}
|
|
c2 = 65535;
|
|
break;
|
|
case 100571:
|
|
if (attributeName.equals(TtmlNode.END)) {
|
|
c2 = 2;
|
|
break;
|
|
}
|
|
c2 = 65535;
|
|
break;
|
|
case 93616297:
|
|
if (attributeName.equals("begin")) {
|
|
c2 = 3;
|
|
break;
|
|
}
|
|
c2 = 65535;
|
|
break;
|
|
case 109780401:
|
|
if (attributeName.equals("style")) {
|
|
c2 = 4;
|
|
break;
|
|
}
|
|
c2 = 65535;
|
|
break;
|
|
case 1292595405:
|
|
if (attributeName.equals("backgroundImage")) {
|
|
c2 = 5;
|
|
break;
|
|
}
|
|
c2 = 65535;
|
|
break;
|
|
default:
|
|
c2 = 65535;
|
|
break;
|
|
}
|
|
switch (c2) {
|
|
case 0:
|
|
if (!map.containsKey(attributeValue)) {
|
|
break;
|
|
} else {
|
|
str2 = attributeValue;
|
|
continue;
|
|
}
|
|
case 1:
|
|
j5 = a(attributeValue, bVar);
|
|
break;
|
|
case 2:
|
|
j4 = a(attributeValue, bVar);
|
|
break;
|
|
case 3:
|
|
j3 = a(attributeValue, bVar);
|
|
break;
|
|
case 4:
|
|
String[] d = d(attributeValue);
|
|
if (d.length > 0) {
|
|
strArr = d;
|
|
break;
|
|
}
|
|
break;
|
|
case 5:
|
|
if (attributeValue.startsWith("#")) {
|
|
str = attributeValue.substring(1);
|
|
break;
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
if (gpVar != null) {
|
|
long j6 = gpVar.d;
|
|
j = C.TIME_UNSET;
|
|
if (j6 != C.TIME_UNSET) {
|
|
if (j3 != C.TIME_UNSET) {
|
|
j3 += j6;
|
|
}
|
|
if (j4 != C.TIME_UNSET) {
|
|
j4 += j6;
|
|
}
|
|
}
|
|
} else {
|
|
j = C.TIME_UNSET;
|
|
}
|
|
long j7 = j3;
|
|
if (j4 == j) {
|
|
if (j5 != j) {
|
|
j2 = j7 + j5;
|
|
} else if (gpVar != null) {
|
|
long j8 = gpVar.e;
|
|
if (j8 != j) {
|
|
j2 = j8;
|
|
}
|
|
}
|
|
return gp.a(xmlPullParser.getName(), j7, j2, a2, strArr, str2, str, gpVar);
|
|
}
|
|
j2 = j4;
|
|
return gp.a(xmlPullParser.getName(), j7, j2, a2, strArr, str2, str, gpVar);
|
|
}
|
|
|
|
/* JADX WARN: Can't fix incorrect switch cases order, some code will duplicate */
|
|
/* JADX WARN: Code restructure failed: missing block: B:53:0x01a9, code lost:
|
|
|
|
if (r0.equals("tb") == false) goto L49;
|
|
*/
|
|
/* JADX WARN: Removed duplicated region for block: B:38:0x017c */
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct add '--show-bad-code' argument
|
|
*/
|
|
private static com.applovin.impl.hp a(org.xmlpull.v1.XmlPullParser r17, com.applovin.impl.fp.a r18, com.applovin.impl.fp.c r19) {
|
|
/*
|
|
Method dump skipped, instructions count: 568
|
|
To view this dump add '--comments-level debug' option
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: com.applovin.impl.fp.a(org.xmlpull.v1.XmlPullParser, com.applovin.impl.fp$a, com.applovin.impl.fp$c):com.applovin.impl.hp");
|
|
}
|
|
|
|
/* JADX WARN: Can't fix incorrect switch cases order, some code will duplicate */
|
|
/* JADX WARN: Code restructure failed: missing block: B:61:0x01e0, code lost:
|
|
|
|
if (r3.equals("text") == false) goto L100;
|
|
*/
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct add '--show-bad-code' argument
|
|
*/
|
|
private static com.applovin.impl.jp a(org.xmlpull.v1.XmlPullParser r12, com.applovin.impl.jp r13) {
|
|
/*
|
|
Method dump skipped, instructions count: 928
|
|
To view this dump add '--comments-level debug' option
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: com.applovin.impl.fp.a(org.xmlpull.v1.XmlPullParser, com.applovin.impl.jp):com.applovin.impl.jp");
|
|
}
|
|
|
|
/* JADX WARN: Can't fix incorrect switch cases order, some code will duplicate */
|
|
/* JADX WARN: Code restructure failed: missing block: B:33:0x00bc, code lost:
|
|
|
|
if (r13.equals("ms") == false) goto L21;
|
|
*/
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct add '--show-bad-code' argument
|
|
*/
|
|
private static long a(java.lang.String r13, com.applovin.impl.fp.b r14) {
|
|
/*
|
|
Method dump skipped, instructions count: 326
|
|
To view this dump add '--comments-level debug' option
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: com.applovin.impl.fp.a(java.lang.String, com.applovin.impl.fp$b):long");
|
|
}
|
|
}
|