CheetahGram v8.5.4版本的 MD5 值为:3d14e79cc242c314d3933620ff3ab030
以下内容为反编译后的 ds0.java 源代码,内容仅作参考
package org.telegram.messenger.p110;
import android.net.Uri;
import android.text.TextUtils;
import android.util.Base64;
import android.util.Pair;
import android.util.Xml;
import com.batch.android.localcampaigns.b;
import com.google.android.exoplayer2.drm.e;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.telegram.messenger.p110.tp4;
import org.telegram.messenger.p110.yo3;
import org.telegram.tgnet.ConnectionsManager;
import org.webrtc.MediaStreamTrack;
import org.xml.sax.helpers.DefaultHandler;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlPullParserFactory;
import org.xmlpull.v1.XmlSerializer;
import uk.co.chrisjenx.calligraphy.BuildConfig;
public class ds0 extends DefaultHandler implements yo3.a<cs0> {
private static final Pattern b = Pattern.compile("(\\d+)(?:/(\\d+))?");
private static final Pattern c = Pattern.compile("CC([1-4])=.*");
private static final Pattern d = Pattern.compile("([1-9]|[1-5][0-9]|6[0-3])=.*");
private final XmlPullParserFactory a;
public static final class a {
public final yh1 a;
public final String b;
public final tp4 c;
public final String d;
public final ArrayList<e.b> e;
public final ArrayList<nw0> f;
public final long g;
public a(yh1 yh1Var, String str, tp4 tp4Var, String str2, ArrayList<e.b> arrayList, ArrayList<nw0> arrayList2, long j) {
this.a = yh1Var;
this.b = str;
this.c = tp4Var;
this.d = str2;
this.e = arrayList;
this.f = arrayList2;
this.g = j;
}
}
public ds0() {
try {
this.a = XmlPullParserFactory.newInstance();
} catch (XmlPullParserException e) {
throw new RuntimeException("Couldn't create XmlPullParserFactory instance", e);
}
}
protected static int B(List<nw0> list) {
String str;
for (int i = 0; i < list.size(); i++) {
nw0 nw0Var = list.get(i);
if ("urn:scte:dash:cc:cea-608:2015".equals(nw0Var.a) && (str = nw0Var.b) != null) {
Matcher matcher = c.matcher(str);
if (matcher.matches()) {
return Integer.parseInt(matcher.group(1));
}
cc2.h("MpdParser", "Unable to parse CEA-608 channel number from: " + nw0Var.b);
}
}
return -1;
}
protected static int C(List<nw0> list) {
String str;
for (int i = 0; i < list.size(); i++) {
nw0 nw0Var = list.get(i);
if ("urn:scte:dash:cc:cea-708:2015".equals(nw0Var.a) && (str = nw0Var.b) != null) {
Matcher matcher = d.matcher(str);
if (matcher.matches()) {
return Integer.parseInt(matcher.group(1));
}
cc2.h("MpdParser", "Unable to parse CEA-708 service block number from: " + nw0Var.b);
}
}
return -1;
}
protected static long G(XmlPullParser xmlPullParser, String str, long j) {
String attributeValue = xmlPullParser.getAttributeValue(null, str);
return attributeValue == null ? j : kn7.l0(attributeValue);
}
protected static nw0 H(XmlPullParser xmlPullParser, String str) {
String i0 = i0(xmlPullParser, "schemeIdUri", BuildConfig.FLAVOR);
String i02 = i0(xmlPullParser, "value", null);
String i03 = i0(xmlPullParser, b.a.b, null);
do {
xmlPullParser.next();
} while (!q08.d(xmlPullParser, str));
return new nw0(i0, i02, i03);
}
protected static int I(XmlPullParser xmlPullParser) {
char c2;
String z0 = kn7.z0(xmlPullParser.getAttributeValue(null, "value"));
if (z0 == null) {
return -1;
}
switch (z0.hashCode()) {
case 1596796:
if (z0.equals("4000")) {
c2 = 0;
break;
}
c2 = 65535;
break;
case 2937391:
if (z0.equals("a000")) {
c2 = 1;
break;
}
c2 = 65535;
break;
case 3094035:
if (z0.equals("f801")) {
c2 = 2;
break;
}
c2 = 65535;
break;
case 3133436:
if (z0.equals("fa01")) {
c2 = 3;
break;
}
c2 = 65535;
break;
default:
c2 = 65535;
break;
}
switch (c2) {
case 0:
return 1;
case 1:
return 2;
case 2:
return 6;
case 3:
return 8;
default:
return -1;
}
}
protected static long J(XmlPullParser xmlPullParser, String str, long j) {
String attributeValue = xmlPullParser.getAttributeValue(null, str);
return attributeValue == null ? j : kn7.m0(attributeValue);
}
protected static String K(List<nw0> list) {
for (int i = 0; i < list.size(); i++) {
nw0 nw0Var = list.get(i);
String str = nw0Var.a;
if ("tag:dolby.com,2018:dash:EC3_ExtensionType:2018".equals(str) && "JOC".equals(nw0Var.b)) {
return "audio/eac3-joc";
}
if ("tag:dolby.com,2014:dash:DolbyDigitalPlusExtensionType:2014".equals(str) && "ec+3".equals(nw0Var.b)) {
return "audio/eac3-joc";
}
}
return "audio/eac3";
}
protected static float O(XmlPullParser xmlPullParser, float f) {
String attributeValue = xmlPullParser.getAttributeValue(null, "frameRate");
if (attributeValue == null) {
return f;
}
Matcher matcher = b.matcher(attributeValue);
if (!matcher.matches()) {
return f;
}
int parseInt = Integer.parseInt(matcher.group(1));
float f2 = parseInt;
return !TextUtils.isEmpty(matcher.group(2)) ? f2 / Integer.parseInt(r2) : f2;
}
protected static int Q(XmlPullParser xmlPullParser, String str, int i) {
String attributeValue = xmlPullParser.getAttributeValue(null, str);
return attributeValue == null ? i : Integer.parseInt(attributeValue);
}
protected static long S(List<nw0> list) {
for (int i = 0; i < list.size(); i++) {
nw0 nw0Var = list.get(i);
if ("http://dashif.org/guidelines/last-segment-number".equalsIgnoreCase(nw0Var.a)) {
return Long.parseLong(nw0Var.b);
}
}
return -1L;
}
protected static long T(XmlPullParser xmlPullParser, String str, long j) {
String attributeValue = xmlPullParser.getAttributeValue(null, str);
return attributeValue == null ? j : Long.parseLong(attributeValue);
}
private long b(List<tp4.d> list, long j, long j2, int i, long j3) {
int k = i >= 0 ? i + 1 : (int) kn7.k(j3 - j, j2);
for (int i2 = 0; i2 < k; i2++) {
list.add(m(j, j2));
j += j2;
}
return j;
}
protected static String i0(XmlPullParser xmlPullParser, String str, String str2) {
String attributeValue = xmlPullParser.getAttributeValue(null, str);
return attributeValue == null ? str2 : attributeValue;
}
protected static String j0(XmlPullParser xmlPullParser, String str) {
String str2 = BuildConfig.FLAVOR;
do {
xmlPullParser.next();
if (xmlPullParser.getEventType() == 4) {
str2 = xmlPullParser.getText();
} else {
u(xmlPullParser);
}
} while (!q08.d(xmlPullParser, str));
return str2;
}
private static int p(int i, int i2) {
if (i == -1) {
return i2;
}
if (i2 == -1) {
return i;
}
ub.f(i == i2);
return i;
}
private static String q(String str, String str2) {
if (str == null) {
return str2;
}
if (str2 == null) {
return str;
}
ub.f(str.equals(str2));
return str;
}
private static void r(ArrayList<e.b> arrayList) {
for (int size = arrayList.size() - 1; size >= 0; size--) {
e.b bVar = arrayList.get(size);
if (!bVar.d()) {
int i = 0;
while (true) {
if (i >= arrayList.size()) {
break;
}
if (arrayList.get(i).b(bVar)) {
arrayList.remove(size);
break;
}
i++;
}
}
}
}
private static String t(String str, String str2) {
if (gg3.l(str)) {
return gg3.b(str2);
}
if (gg3.n(str)) {
return gg3.k(str2);
}
if (v(str)) {
return str;
}
if ("application/mp4".equals(str)) {
if (str2 != null) {
if (str2.startsWith("stpp")) {
return "application/ttml+xml";
}
if (str2.startsWith("wvtt")) {
return "application/x-mp4-vtt";
}
}
} else if ("application/x-rawcc".equals(str) && str2 != null) {
if (str2.contains("cea708")) {
return "application/cea-708";
}
if (str2.contains("eia608") || str2.contains("cea608")) {
return "application/cea-608";
}
}
return null;
}
public static void u(XmlPullParser xmlPullParser) {
if (q08.e(xmlPullParser)) {
int i = 1;
while (i != 0) {
xmlPullParser.next();
if (q08.e(xmlPullParser)) {
i++;
} else if (q08.c(xmlPullParser)) {
i--;
}
}
}
}
private static boolean v(String str) {
return gg3.m(str) || "application/ttml+xml".equals(str) || "application/x-mp4-vtt".equals(str) || "application/cea-708".equals(str) || "application/cea-608".equals(str);
}
protected String A(XmlPullParser xmlPullParser, String str) {
return sm7.c(str, j0(xmlPullParser, "BaseURL"));
}
protected Pair<String, e.b> D(XmlPullParser xmlPullParser) {
String str;
?? r3;
String str2;
String str3;
?? r4;
String attributeValue = xmlPullParser.getAttributeValue(null, "schemeIdUri");
if (attributeValue != null) {
String z0 = kn7.z0(attributeValue);
z0.hashCode();
char c2 = 65535;
switch (z0.hashCode()) {
case 489446379:
if (z0.equals("urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95")) {
c2 = 0;
break;
}
break;
case 755418770:
if (z0.equals("urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed")) {
c2 = 1;
break;
}
break;
case 1812765994:
if (z0.equals("urn:mpeg:dash:mp4protection:2011")) {
c2 = 2;
break;
}
break;
}
switch (c2) {
case 0:
r3 = ql.e;
str = null;
str2 = null;
str3 = str2;
r4 = str2;
break;
case 1:
r3 = ql.d;
str = null;
str2 = null;
str3 = str2;
r4 = str2;
break;
case 2:
str = xmlPullParser.getAttributeValue(null, "value");
String b2 = q08.b(xmlPullParser, "default_KID");
if (!TextUtils.isEmpty(b2) && !"00000000-0000-0000-0000-000000000000".equals(b2)) {
String[] split = b2.split("\\s+");
UUID[] uuidArr = new UUID[split.length];
for (int i = 0; i < split.length; i++) {
uuidArr[i] = UUID.fromString(split[i]);
}
r3 = ql.b;
str3 = null;
r4 = fb4.b(r3, uuidArr, null);
break;
} else {
r3 = null;
str2 = r3;
str3 = str2;
r4 = str2;
break;
}
}
do {
xmlPullParser.next();
if (!q08.f(xmlPullParser, "ms:laurl")) {
str3 = xmlPullParser.getAttributeValue(null, "licenseUrl");
r4 = r4;
} else if (r4 == 0 && q08.g(xmlPullParser, "pssh") && xmlPullParser.next() == 4) {
byte[] decode = Base64.decode(xmlPullParser.getText(), 0);
UUID d2 = fb4.d(decode);
if (d2 == null) {
cc2.h("MpdParser", "Skipping malformed cenc:pssh data");
r3 = d2;
r4 = 0;
} else {
r4 = decode;
r3 = d2;
}
} else {
if (r4 == 0) {
?? r7 = ql.e;
if (r7.equals(r3) && q08.f(xmlPullParser, "mspr:pro") && xmlPullParser.next() == 4) {
r4 = fb4.a(r7, Base64.decode(xmlPullParser.getText(), 0));
}
}
u(xmlPullParser);
r4 = r4;
}
} while (!q08.d(xmlPullParser, "ContentProtection"));
return Pair.create(str, r3 != null ? new e.b(r3, str3, "video/mp4", r4) : null);
}
str = null;
r3 = null;
str2 = r3;
str3 = str2;
r4 = str2;
do {
xmlPullParser.next();
if (!q08.f(xmlPullParser, "ms:laurl")) {
}
} while (!q08.d(xmlPullParser, "ContentProtection"));
return Pair.create(str, r3 != null ? new e.b(r3, str3, "video/mp4", r4) : null);
}
protected int E(XmlPullParser xmlPullParser) {
String attributeValue = xmlPullParser.getAttributeValue(null, "contentType");
if (TextUtils.isEmpty(attributeValue)) {
return -1;
}
if (MediaStreamTrack.AUDIO_TRACK_KIND.equals(attributeValue)) {
return 1;
}
if (MediaStreamTrack.VIDEO_TRACK_KIND.equals(attributeValue)) {
return 2;
}
return "text".equals(attributeValue) ? 3 : -1;
}
protected int F(String str) {
if (str == null) {
return 0;
}
char c2 = 65535;
switch (str.hashCode()) {
case -2060497896:
if (str.equals("subtitle")) {
c2 = 0;
break;
}
break;
case -1724546052:
if (str.equals("description")) {
c2 = 1;
break;
}
break;
case -1580883024:
if (str.equals("enhanced-audio-intelligibility")) {
c2 = 2;
break;
}
break;
case -1408024454:
if (str.equals("alternate")) {
c2 = 3;
break;
}
break;
case 99825:
if (str.equals("dub")) {
c2 = 4;
break;
}
break;
case 3343801:
if (str.equals("main")) {
c2 = 5;
break;
}
break;
case 3530173:
if (str.equals("sign")) {
c2 = 6;
break;
}
break;
case 552573414:
if (str.equals("caption")) {
c2 = 7;
break;
}
break;
case 899152809:
if (str.equals("commentary")) {
c2 = '\b';
break;
}
break;
case 1629013393:
if (str.equals("emergency")) {
c2 = '\t';
break;
}
break;
case 1855372047:
if (str.equals("supplementary")) {
c2 = '\n';
break;
}
break;
}
switch (c2) {
case 0:
return ConnectionsManager.RequestFlagNeedQuickAck;
case 1:
return 512;
case 2:
return 2048;
case 3:
return 2;
case 4:
return 16;
case 5:
return 1;
case 6:
return 256;
case 7:
return 64;
case '\b':
return 8;
case '\t':
return 32;
case '\n':
return 4;
default:
return 0;
}
}
protected Pair<Long, p61> L(XmlPullParser xmlPullParser, String str, String str2, long j, ByteArrayOutputStream byteArrayOutputStream) {
long T = T(xmlPullParser, b.a.b, 0L);
long T2 = T(xmlPullParser, "duration", -9223372036854775807L);
long T3 = T(xmlPullParser, "presentationTime", 0L);
long q0 = kn7.q0(T2, 1000L, j);
long q02 = kn7.q0(T3, 1000000L, j);
String i0 = i0(xmlPullParser, "messageData", null);
byte[] M = M(xmlPullParser, byteArrayOutputStream);
Long valueOf = Long.valueOf(q02);
if (i0 != null) {
M = kn7.V(i0);
}
return Pair.create(valueOf, d(str, str2, T, q0, M));
}
protected byte[] M(XmlPullParser xmlPullParser, ByteArrayOutputStream byteArrayOutputStream) {
byteArrayOutputStream.reset();
XmlSerializer newSerializer = Xml.newSerializer();
newSerializer.setOutput(byteArrayOutputStream, com.batch.android.core.a.a);
while (true) {
xmlPullParser.nextToken();
if (q08.d(xmlPullParser, "Event")) {
newSerializer.flush();
return byteArrayOutputStream.toByteArray();
}
switch (xmlPullParser.getEventType()) {
case 0:
newSerializer.startDocument(null, Boolean.FALSE);
break;
case 1:
newSerializer.endDocument();
break;
case 2:
newSerializer.startTag(xmlPullParser.getNamespace(), xmlPullParser.getName());
for (int i = 0; i < xmlPullParser.getAttributeCount(); i++) {
newSerializer.attribute(xmlPullParser.getAttributeNamespace(i), xmlPullParser.getAttributeName(i), xmlPullParser.getAttributeValue(i));
}
break;
case 3:
newSerializer.endTag(xmlPullParser.getNamespace(), xmlPullParser.getName());
break;
case 4:
newSerializer.text(xmlPullParser.getText());
break;
case 5:
newSerializer.cdsect(xmlPullParser.getText());
break;
case 6:
newSerializer.entityRef(xmlPullParser.getText());
break;
case 7:
newSerializer.ignorableWhitespace(xmlPullParser.getText());
break;
case 8:
newSerializer.processingInstruction(xmlPullParser.getText());
break;
case 9:
newSerializer.comment(xmlPullParser.getText());
break;
case 10:
newSerializer.docdecl(xmlPullParser.getText());
break;
}
}
}
protected z61 N(XmlPullParser xmlPullParser) {
String i0 = i0(xmlPullParser, "schemeIdUri", BuildConfig.FLAVOR);
String i02 = i0(xmlPullParser, "value", BuildConfig.FLAVOR);
long T = T(xmlPullParser, "timescale", 1L);
ArrayList arrayList = new ArrayList();
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(512);
do {
xmlPullParser.next();
if (q08.f(xmlPullParser, "Event")) {
arrayList.add(L(xmlPullParser, i0, i02, T, byteArrayOutputStream));
} else {
u(xmlPullParser);
}
} while (!q08.d(xmlPullParser, "EventStream"));
long[] jArr = new long[arrayList.size()];
p61[] p61VarArr = new p61[arrayList.size()];
for (int i = 0; i < arrayList.size(); i++) {
Pair pair = (Pair) arrayList.get(i);
jArr[i] = ((Long) pair.first).longValue();
p61VarArr[i] = (p61) pair.second;
}
return e(i0, i02, T, jArr, p61VarArr);
}
protected ue4 P(XmlPullParser xmlPullParser) {
return X(xmlPullParser, "sourceURL", "range");
}
protected String R(XmlPullParser xmlPullParser) {
return j0(xmlPullParser, "Label");
}
protected cs0 U(XmlPullParser xmlPullParser, String str) {
String str2;
long j;
ds0 ds0Var = this;
long G = G(xmlPullParser, "availabilityStartTime", -9223372036854775807L);
long J = J(xmlPullParser, "mediaPresentationDuration", -9223372036854775807L);
long J2 = J(xmlPullParser, "minBufferTime", -9223372036854775807L);
boolean equals = "dynamic".equals(xmlPullParser.getAttributeValue(null, "type"));
long J3 = equals ? J(xmlPullParser, "minimumUpdatePeriod", -9223372036854775807L) : -9223372036854775807L;
long J4 = equals ? J(xmlPullParser, "timeShiftBufferDepth", -9223372036854775807L) : -9223372036854775807L;
long J5 = equals ? J(xmlPullParser, "suggestedPresentationDelay", -9223372036854775807L) : -9223372036854775807L;
long G2 = G(xmlPullParser, "publishTime", -9223372036854775807L);
ArrayList arrayList = new ArrayList();
Uri uri = null;
long j2 = equals ? -9223372036854775807L : 0L;
boolean z = false;
boolean z2 = false;
String str3 = str;
z84 z84Var = null;
fn7 fn7Var = null;
while (true) {
xmlPullParser.next();
long j3 = J4;
if (q08.f(xmlPullParser, "BaseURL")) {
if (z) {
str2 = str3;
j = j2;
str3 = str2;
j2 = j;
} else {
str3 = ds0Var.A(xmlPullParser, str3);
z = true;
}
} else if (q08.f(xmlPullParser, "ProgramInformation")) {
z84Var = W(xmlPullParser);
} else if (q08.f(xmlPullParser, "UTCTiming")) {
fn7Var = m0(xmlPullParser);
} else if (q08.f(xmlPullParser, "Location")) {
uri = Uri.parse(xmlPullParser.nextText());
} else if (!q08.f(xmlPullParser, "Period") || z2) {
str2 = str3;
j = j2;
u(xmlPullParser);
str3 = str2;
j2 = j;
} else {
Pair<bw3, Long> V = ds0Var.V(xmlPullParser, str3, j2);
String str4 = str3;
bw3 bw3Var = (bw3) V.first;
long j4 = j2;
if (bw3Var.b != -9223372036854775807L) {
long longValue = ((Long) V.second).longValue();
j2 = longValue == -9223372036854775807L ? -9223372036854775807L : bw3Var.b + longValue;
arrayList.add(bw3Var);
} else {
if (!equals) {
throw new xo3("Unable to determine start of period " + arrayList.size());
}
j2 = j4;
z2 = true;
}
str3 = str4;
}
if (q08.d(xmlPullParser, "MPD")) {
if (J == -9223372036854775807L) {
if (j2 != -9223372036854775807L) {
J = j2;
} else if (!equals) {
throw new xo3("Unable to determine duration of static manifest.");
}
}
if (arrayList.isEmpty()) {
throw new xo3("No periods found.");
}
return g(G, J, J2, equals, J3, j3, J5, G2, z84Var, fn7Var, uri, arrayList);
}
ds0Var = this;
J4 = j3;
}
}
protected Pair<bw3, Long> V(XmlPullParser xmlPullParser, String str, long j) {
String str2;
String attributeValue = xmlPullParser.getAttributeValue(null, b.a.b);
long J = J(xmlPullParser, "start", j);
long J2 = J(xmlPullParser, "duration", -9223372036854775807L);
ArrayList arrayList = new ArrayList();
ArrayList arrayList2 = new ArrayList();
String str3 = str;
tp4 tp4Var = null;
nw0 nw0Var = null;
boolean z = false;
do {
xmlPullParser.next();
if (q08.f(xmlPullParser, "BaseURL")) {
if (z) {
str2 = str3;
} else {
str3 = A(xmlPullParser, str3);
z = true;
}
} else if (q08.f(xmlPullParser, "AdaptationSet")) {
str2 = str3;
arrayList.add(x(xmlPullParser, str3, tp4Var, J2));
} else {
str2 = str3;
if (q08.f(xmlPullParser, "EventStream")) {
arrayList2.add(N(xmlPullParser));
} else if (q08.f(xmlPullParser, "SegmentBase")) {
tp4Var = c0(xmlPullParser, null);
} else if (q08.f(xmlPullParser, "SegmentList")) {
tp4Var = d0(xmlPullParser, null, J2);
} else if (q08.f(xmlPullParser, "SegmentTemplate")) {
tp4Var = e0(xmlPullParser, null, Collections.emptyList(), J2);
} else if (q08.f(xmlPullParser, "AssetIdentifier")) {
nw0Var = H(xmlPullParser, "AssetIdentifier");
} else {
u(xmlPullParser);
}
}
str3 = str2;
} while (!q08.d(xmlPullParser, "Period"));
return Pair.create(h(attributeValue, J, arrayList, arrayList2, nw0Var), Long.valueOf(J2));
}
protected z84 W(XmlPullParser xmlPullParser) {
String str = null;
String i0 = i0(xmlPullParser, "moreInformationURL", null);
String i02 = i0(xmlPullParser, "lang", null);
String str2 = null;
String str3 = null;
while (true) {
xmlPullParser.next();
if (q08.f(xmlPullParser, "Title")) {
str = xmlPullParser.nextText();
} else if (q08.f(xmlPullParser, "Source")) {
str2 = xmlPullParser.nextText();
} else if (q08.f(xmlPullParser, "Copyright")) {
str3 = xmlPullParser.nextText();
} else {
u(xmlPullParser);
}
String str4 = str3;
if (q08.d(xmlPullParser, "ProgramInformation")) {
return new z84(str, str2, str4, i0, i02);
}
str3 = str4;
}
}
protected ue4 X(XmlPullParser xmlPullParser, String str, String str2) {
long j;
long j2;
String attributeValue = xmlPullParser.getAttributeValue(null, str);
String attributeValue2 = xmlPullParser.getAttributeValue(null, str2);
if (attributeValue2 != null) {
String[] split = attributeValue2.split("-");
j = Long.parseLong(split[0]);
if (split.length == 2) {
j2 = (Long.parseLong(split[1]) - j) + 1;
return i(attributeValue, j, j2);
}
} else {
j = 0;
}
j2 = -1;
return i(attributeValue, j, j2);
}
protected a Y(XmlPullParser xmlPullParser, String str, String str2, String str3, int i, int i2, float f, int i3, int i4, String str4, List<nw0> list, List<nw0> list2, List<nw0> list3, List<nw0> list4, tp4 tp4Var, long j) {
int i5;
int i6;
String str5;
tp4 e0;
int i7;
String str6;
String attributeValue = xmlPullParser.getAttributeValue(null, b.a.b);
int Q = Q(xmlPullParser, "bandwidth", -1);
String i0 = i0(xmlPullParser, "mimeType", str2);
String i02 = i0(xmlPullParser, "codecs", str3);
int Q2 = Q(xmlPullParser, "width", i);
int Q3 = Q(xmlPullParser, "height", i2);
float O = O(xmlPullParser, f);
int Q4 = Q(xmlPullParser, "audioSamplingRate", i4);
ArrayList arrayList = new ArrayList();
ArrayList arrayList2 = new ArrayList();
ArrayList arrayList3 = new ArrayList(list3);
ArrayList arrayList4 = new ArrayList(list4);
int i8 = i3;
tp4 tp4Var2 = tp4Var;
String str7 = null;
boolean z = false;
String str8 = str;
while (true) {
xmlPullParser.next();
if (q08.f(xmlPullParser, "BaseURL")) {
if (z) {
str5 = str8;
i5 = Q4;
i6 = Q;
i7 = i8;
str6 = str5;
if (!q08.d(xmlPullParser, "Representation")) {
}
} else {
str8 = A(xmlPullParser, str8);
i5 = Q4;
i6 = Q;
i7 = i8;
z = true;
str6 = str8;
if (!q08.d(xmlPullParser, "Representation")) {
break;
}
Q4 = i5;
str8 = str6;
Q = i6;
i8 = i7;
}
} else if (q08.f(xmlPullParser, "AudioChannelConfiguration")) {
i7 = z(xmlPullParser);
str6 = str8;
i5 = Q4;
i6 = Q;
if (!q08.d(xmlPullParser, "Representation")) {
}
} else if (q08.f(xmlPullParser, "SegmentBase")) {
i5 = Q4;
i6 = Q;
tp4Var2 = c0(xmlPullParser, (tp4.e) tp4Var2);
i7 = i8;
str6 = str8;
if (!q08.d(xmlPullParser, "Representation")) {
}
} else {
if (q08.f(xmlPullParser, "SegmentList")) {
i5 = Q4;
i6 = Q;
e0 = d0(xmlPullParser, (tp4.b) tp4Var2, j);
} else {
i5 = Q4;
i6 = Q;
if (q08.f(xmlPullParser, "SegmentTemplate")) {
e0 = e0(xmlPullParser, (tp4.c) tp4Var2, list4, j);
} else {
if (q08.f(xmlPullParser, "ContentProtection")) {
Pair<String, e.b> D = D(xmlPullParser);
str5 = str8;
Object obj = D.first;
if (obj != null) {
str7 = (String) obj;
}
Object obj2 = D.second;
if (obj2 != null) {
arrayList.add((e.b) obj2);
}
} else {
str5 = str8;
if (q08.f(xmlPullParser, "InbandEventStream")) {
arrayList2.add(H(xmlPullParser, "InbandEventStream"));
} else if (q08.f(xmlPullParser, "EssentialProperty")) {
arrayList3.add(H(xmlPullParser, "EssentialProperty"));
} else if (q08.f(xmlPullParser, "SupplementalProperty")) {
arrayList4.add(H(xmlPullParser, "SupplementalProperty"));
} else {
u(xmlPullParser);
}
}
i7 = i8;
str6 = str5;
if (!q08.d(xmlPullParser, "Representation")) {
}
}
}
tp4Var2 = e0;
i7 = i8;
str6 = str8;
if (!q08.d(xmlPullParser, "Representation")) {
}
}
}
return new a(f(attributeValue, i0, Q2, Q3, O, i7, i5, i6, str4, list, list2, i02, arrayList3, arrayList4), str6, tp4Var2 != null ? tp4Var2 : new tp4.e(), str7, arrayList, arrayList2, -1L);
}
protected int Z(List<nw0> list) {
int k0;
int i = 0;
for (int i2 = 0; i2 < list.size(); i2++) {
nw0 nw0Var = list.get(i2);
if ("urn:mpeg:dash:role:2011".equalsIgnoreCase(nw0Var.a)) {
k0 = F(nw0Var.b);
} else if ("urn:tva:metadata:cs:AudioPurposeCS:2007".equalsIgnoreCase(nw0Var.a)) {
k0 = k0(nw0Var.b);
}
i |= k0;
}
return i;
}
protected int a0(List<nw0> list) {
int i = 0;
for (int i2 = 0; i2 < list.size(); i2++) {
if ("http://dashif.org/guidelines/trickmode".equalsIgnoreCase(list.get(i2).a)) {
i |= 16384;
}
}
return i;
}
protected int b0(List<nw0> list) {
int i = 0;
for (int i2 = 0; i2 < list.size(); i2++) {
nw0 nw0Var = list.get(i2);
if ("urn:mpeg:dash:role:2011".equalsIgnoreCase(nw0Var.a)) {
i |= F(nw0Var.b);
}
}
return i;
}
protected m2 c(int i, int i2, List<xh4> list, List<nw0> list2, List<nw0> list3, List<nw0> list4) {
return new m2(i, i2, list, list2, list3, list4);
}
protected tp4.e c0(XmlPullParser xmlPullParser, tp4.e eVar) {
long j;
long j2;
long T = T(xmlPullParser, "timescale", eVar != null ? eVar.b : 1L);
long T2 = T(xmlPullParser, "presentationTimeOffset", eVar != null ? eVar.c : 0L);
long j3 = eVar != null ? eVar.d : 0L;
long j4 = eVar != null ? eVar.e : 0L;
String attributeValue = xmlPullParser.getAttributeValue(null, "indexRange");
if (attributeValue != null) {
String[] split = attributeValue.split("-");
long parseLong = Long.parseLong(split[0]);
j = (Long.parseLong(split[1]) - parseLong) + 1;
j2 = parseLong;
} else {
j = j4;
j2 = j3;
}
ue4 ue4Var = eVar != null ? eVar.a : null;
do {
xmlPullParser.next();
if (q08.f(xmlPullParser, "Initialization")) {
ue4Var = P(xmlPullParser);
} else {
u(xmlPullParser);
}
} while (!q08.d(xmlPullParser, "SegmentBase"));
return n(ue4Var, T, T2, j2, j);
}
protected p61 d(String str, String str2, long j, long j2, byte[] bArr) {
return new p61(str, str2, j2, j, bArr);
}
protected tp4.b d0(XmlPullParser xmlPullParser, tp4.b bVar, long j) {
long T = T(xmlPullParser, "timescale", bVar != null ? bVar.b : 1L);
long T2 = T(xmlPullParser, "presentationTimeOffset", bVar != null ? bVar.c : 0L);
long T3 = T(xmlPullParser, "duration", bVar != null ? bVar.e : -9223372036854775807L);
long T4 = T(xmlPullParser, "startNumber", bVar != null ? bVar.d : 1L);
List<tp4.d> list = null;
List<ue4> list2 = null;
ue4 ue4Var = null;
do {
xmlPullParser.next();
if (q08.f(xmlPullParser, "Initialization")) {
ue4Var = P(xmlPullParser);
} else if (q08.f(xmlPullParser, "SegmentTimeline")) {
list = f0(xmlPullParser, T, j);
} else if (q08.f(xmlPullParser, "SegmentURL")) {
if (list2 == null) {
list2 = new ArrayList<>();
}
list2.add(g0(xmlPullParser));
} else {
u(xmlPullParser);
}
} while (!q08.d(xmlPullParser, "SegmentList"));
if (bVar != null) {
if (ue4Var == null) {
ue4Var = bVar.a;
}
if (list == null) {
list = bVar.f;
}
if (list2 == null) {
list2 = bVar.g;
}
}
return k(ue4Var, T, T2, T4, T3, list, list2);
}
protected z61 e(String str, String str2, long j, long[] jArr, p61[] p61VarArr) {
return new z61(str, str2, j, jArr, p61VarArr);
}
protected tp4.c e0(XmlPullParser xmlPullParser, tp4.c cVar, List<nw0> list, long j) {
long T = T(xmlPullParser, "timescale", cVar != null ? cVar.b : 1L);
long T2 = T(xmlPullParser, "presentationTimeOffset", cVar != null ? cVar.c : 0L);
long T3 = T(xmlPullParser, "duration", cVar != null ? cVar.e : -9223372036854775807L);
long T4 = T(xmlPullParser, "startNumber", cVar != null ? cVar.d : 1L);
long S = S(list);
List<tp4.d> list2 = null;
um7 l0 = l0(xmlPullParser, "media", cVar != null ? cVar.h : null);
um7 l02 = l0(xmlPullParser, "initialization", cVar != null ? cVar.g : null);
ue4 ue4Var = null;
do {
xmlPullParser.next();
if (q08.f(xmlPullParser, "Initialization")) {
ue4Var = P(xmlPullParser);
} else if (q08.f(xmlPullParser, "SegmentTimeline")) {
list2 = f0(xmlPullParser, T, j);
} else {
u(xmlPullParser);
}
} while (!q08.d(xmlPullParser, "SegmentTemplate"));
if (cVar != null) {
if (ue4Var == null) {
ue4Var = cVar.a;
}
if (list2 == null) {
list2 = cVar.f;
}
}
return l(ue4Var, T, T2, T4, S, T3, list2, l02, l0);
}
protected yh1 f(String str, String str2, int i, int i2, float f, int i3, int i4, int i5, String str3, List<nw0> list, List<nw0> list2, String str4, List<nw0> list3, List<nw0> list4) {
String str5;
int i6;
int C;
String t = t(str2, str4);
int h0 = h0(list);
int b0 = b0(list) | Z(list2) | a0(list3) | a0(list4);
if (t != null) {
String K = "audio/eac3".equals(t) ? K(list4) : t;
if (gg3.n(K)) {
return yh1.A(str, null, str2, K, str4, null, i5, i, i2, f, null, h0, b0);
}
if (gg3.l(K)) {
return yh1.m(str, null, str2, K, str4, null, i5, i3, i4, null, h0, b0, str3);
}
if (v(K)) {
if ("application/cea-608".equals(K)) {
C = B(list2);
} else {
if (!"application/cea-708".equals(K)) {
i6 = -1;
return yh1.v(str, null, str2, K, str4, i5, h0, b0, str3, i6);
}
C = C(list2);
}
i6 = C;
return yh1.v(str, null, str2, K, str4, i5, h0, b0, str3, i6);
}
str5 = K;
} else {
str5 = t;
}
return yh1.q(str, null, str2, str5, str4, i5, h0, b0, str3);
}
protected List<tp4.d> f0(XmlPullParser xmlPullParser, long j, long j2) {
ArrayList arrayList = new ArrayList();
long j3 = 0;
long j4 = -9223372036854775807L;
boolean z = false;
int i = 0;
do {
xmlPullParser.next();
if (q08.f(xmlPullParser, "S")) {
long T = T(xmlPullParser, "t", -9223372036854775807L);
if (z) {
j3 = b(arrayList, j3, j4, i, T);
}
if (T == -9223372036854775807L) {
T = j3;
}
j4 = T(xmlPullParser, "d", -9223372036854775807L);
i = Q(xmlPullParser, "r", 0);
j3 = T;
z = true;
} else {
u(xmlPullParser);
}
} while (!q08.d(xmlPullParser, "SegmentTimeline"));
if (z) {
b(arrayList, j3, j4, i, kn7.q0(j2, j, 1000L));
}
return arrayList;
}
protected cs0 g(long j, long j2, long j3, boolean z, long j4, long j5, long j6, long j7, z84 z84Var, fn7 fn7Var, Uri uri, List<bw3> list) {
return new cs0(j, j2, j3, z, j4, j5, j6, j7, z84Var, fn7Var, uri, list);
}
protected ue4 g0(XmlPullParser xmlPullParser) {
return X(xmlPullParser, "media", "mediaRange");
}
protected bw3 h(String str, long j, List<m2> list, List<z61> list2, nw0 nw0Var) {
return new bw3(str, j, list, list2, nw0Var);
}
protected int h0(List<nw0> list) {
for (int i = 0; i < list.size(); i++) {
nw0 nw0Var = list.get(i);
if ("urn:mpeg:dash:role:2011".equalsIgnoreCase(nw0Var.a) && "main".equals(nw0Var.b)) {
return 1;
}
}
return 0;
}
protected ue4 i(String str, long j, long j2) {
return new ue4(str, j, j2);
}
protected xh4 j(a aVar, String str, String str2, ArrayList<e.b> arrayList, ArrayList<nw0> arrayList2) {
yh1 yh1Var = aVar.a;
if (str != null) {
yh1Var = yh1Var.h(str);
}
String str3 = aVar.d;
if (str3 != null) {
str2 = str3;
}
ArrayList<e.b> arrayList3 = aVar.e;
arrayList3.addAll(arrayList);
if (!arrayList3.isEmpty()) {
r(arrayList3);
yh1Var = yh1Var.d(new com.google.android.exoplayer2.drm.e(str2, arrayList3));
}
ArrayList<nw0> arrayList4 = aVar.f;
arrayList4.addAll(arrayList2);
return xh4.l(aVar.g, yh1Var, aVar.b, aVar.c, arrayList4);
}
protected tp4.b k(ue4 ue4Var, long j, long j2, long j3, long j4, List<tp4.d> list, List<ue4> list2) {
return new tp4.b(ue4Var, j, j2, j3, j4, list, list2);
}
protected int k0(String str) {
if (str == null) {
return 0;
}
char c2 = 65535;
switch (str.hashCode()) {
case 49:
if (str.equals("1")) {
c2 = 0;
break;
}
break;
case 50:
if (str.equals("2")) {
c2 = 1;
break;
}
break;
case 51:
if (str.equals("3")) {
c2 = 2;
break;
}
break;
case 52:
if (str.equals("4")) {
c2 = 3;
break;
}
break;
case 54:
if (str.equals("6")) {
c2 = 4;
break;
}
break;
}
switch (c2) {
case 0:
return 512;
case 1:
return 2048;
case 2:
return 4;
case 3:
return 8;
case 4:
return 1;
default:
return 0;
}
}
protected tp4.c l(ue4 ue4Var, long j, long j2, long j3, long j4, long j5, List<tp4.d> list, um7 um7Var, um7 um7Var2) {
return new tp4.c(ue4Var, j, j2, j3, j4, j5, list, um7Var, um7Var2);
}
protected um7 l0(XmlPullParser xmlPullParser, String str, um7 um7Var) {
String attributeValue = xmlPullParser.getAttributeValue(null, str);
return attributeValue != null ? um7.b(attributeValue) : um7Var;
}
protected tp4.d m(long j, long j2) {
return new tp4.d(j, j2);
}
protected fn7 m0(XmlPullParser xmlPullParser) {
return o(xmlPullParser.getAttributeValue(null, "schemeIdUri"), xmlPullParser.getAttributeValue(null, "value"));
}
protected tp4.e n(ue4 ue4Var, long j, long j2, long j3, long j4) {
return new tp4.e(ue4Var, j, j2, j3, j4);
}
protected fn7 o(String str, String str2) {
return new fn7(str, str2);
}
protected int s(yh1 yh1Var) {
String str = yh1Var.i;
if (TextUtils.isEmpty(str)) {
return -1;
}
if (gg3.n(str)) {
return 2;
}
if (gg3.l(str)) {
return 1;
}
return v(str) ? 3 : -1;
}
@Override
public cs0 a(Uri uri, InputStream inputStream) {
try {
XmlPullParser newPullParser = this.a.newPullParser();
newPullParser.setInput(inputStream, null);
if (newPullParser.next() == 2 && "MPD".equals(newPullParser.getName())) {
return U(newPullParser, uri.toString());
}
throw new xo3("inputStream does not contain a valid media presentation description");
} catch (XmlPullParserException e) {
throw new xo3(e);
}
}
protected m2 x(XmlPullParser xmlPullParser, String str, tp4 tp4Var, long j) {
String str2;
String str3;
ArrayList arrayList;
ArrayList arrayList2;
ArrayList arrayList3;
ArrayList arrayList4;
ArrayList<nw0> arrayList5;
ArrayList<e.b> arrayList6;
String str4;
String str5;
ds0 ds0Var;
int i;
ArrayList arrayList7;
XmlPullParser xmlPullParser2;
ArrayList<nw0> arrayList8;
tp4 e0;
ds0 ds0Var2 = this;
XmlPullParser xmlPullParser3 = xmlPullParser;
int Q = Q(xmlPullParser3, b.a.b, -1);
int E = E(xmlPullParser);
String str6 = null;
String attributeValue = xmlPullParser3.getAttributeValue(null, "mimeType");
String attributeValue2 = xmlPullParser3.getAttributeValue(null, "codecs");
int Q2 = Q(xmlPullParser3, "width", -1);
int Q3 = Q(xmlPullParser3, "height", -1);
float O = O(xmlPullParser3, -1.0f);
int Q4 = Q(xmlPullParser3, "audioSamplingRate", -1);
String str7 = "lang";
String attributeValue3 = xmlPullParser3.getAttributeValue(null, "lang");
String attributeValue4 = xmlPullParser3.getAttributeValue(null, com.batch.android.module.k.f);
ArrayList<e.b> arrayList9 = new ArrayList<>();
ArrayList<nw0> arrayList10 = new ArrayList<>();
ArrayList arrayList11 = new ArrayList();
ArrayList arrayList12 = new ArrayList();
ArrayList arrayList13 = new ArrayList();
ArrayList arrayList14 = new ArrayList();
ArrayList arrayList15 = new ArrayList();
String str8 = str;
tp4 tp4Var2 = tp4Var;
String str9 = attributeValue4;
String str10 = null;
int i2 = -1;
boolean z = false;
int i3 = E;
while (true) {
xmlPullParser.next();
if (q08.f(xmlPullParser3, "BaseURL")) {
if (!z) {
z = true;
str8 = ds0Var2.A(xmlPullParser3, str8);
arrayList = arrayList14;
arrayList2 = arrayList13;
arrayList3 = arrayList12;
arrayList4 = arrayList11;
arrayList6 = arrayList9;
str4 = str7;
str5 = str6;
xmlPullParser2 = xmlPullParser3;
ds0Var = ds0Var2;
i = i3;
arrayList7 = arrayList15;
arrayList8 = arrayList10;
}
str2 = attributeValue3;
str3 = str8;
arrayList = arrayList14;
arrayList2 = arrayList13;
arrayList3 = arrayList12;
arrayList4 = arrayList11;
arrayList6 = arrayList9;
str4 = str7;
str5 = str6;
xmlPullParser2 = xmlPullParser3;
ds0Var = ds0Var2;
i = i3;
arrayList7 = arrayList15;
arrayList8 = arrayList10;
attributeValue3 = str2;
str8 = str3;
} else {
if (q08.f(xmlPullParser3, "ContentProtection")) {
Pair<String, e.b> D = D(xmlPullParser);
Object obj = D.first;
if (obj != null) {
str10 = (String) obj;
}
Object obj2 = D.second;
if (obj2 != null) {
arrayList9.add((e.b) obj2);
}
} else if (q08.f(xmlPullParser3, "ContentComponent")) {
attributeValue3 = q(attributeValue3, xmlPullParser3.getAttributeValue(str6, str7));
arrayList = arrayList14;
arrayList2 = arrayList13;
arrayList3 = arrayList12;
arrayList4 = arrayList11;
arrayList6 = arrayList9;
str4 = str7;
str5 = str6;
xmlPullParser2 = xmlPullParser3;
ds0Var = ds0Var2;
i = p(i3, E(xmlPullParser));
arrayList7 = arrayList15;
arrayList8 = arrayList10;
} else {
if (q08.f(xmlPullParser3, "Role")) {
arrayList12.add(H(xmlPullParser3, "Role"));
} else if (q08.f(xmlPullParser3, "AudioChannelConfiguration")) {
i2 = z(xmlPullParser);
} else if (q08.f(xmlPullParser3, "Accessibility")) {
arrayList11.add(H(xmlPullParser3, "Accessibility"));
} else if (q08.f(xmlPullParser3, "EssentialProperty")) {
arrayList13.add(H(xmlPullParser3, "EssentialProperty"));
} else if (q08.f(xmlPullParser3, "SupplementalProperty")) {
arrayList14.add(H(xmlPullParser3, "SupplementalProperty"));
} else {
if (q08.f(xmlPullParser3, "Representation")) {
str2 = attributeValue3;
str3 = str8;
arrayList = arrayList14;
arrayList2 = arrayList13;
arrayList3 = arrayList12;
arrayList4 = arrayList11;
arrayList5 = arrayList10;
arrayList6 = arrayList9;
str4 = str7;
str5 = str6;
a Y = Y(xmlPullParser, str8, attributeValue, attributeValue2, Q2, Q3, O, i2, Q4, str2, arrayList3, arrayList4, arrayList2, arrayList, tp4Var2, j);
ds0Var = this;
int p = p(i3, ds0Var.s(Y.a));
arrayList7 = arrayList15;
arrayList7.add(Y);
xmlPullParser2 = xmlPullParser;
i = p;
} else {
str2 = attributeValue3;
str3 = str8;
arrayList = arrayList14;
arrayList2 = arrayList13;
arrayList3 = arrayList12;
arrayList4 = arrayList11;
arrayList5 = arrayList10;
arrayList6 = arrayList9;
str4 = str7;
str5 = str6;
ds0Var = ds0Var2;
i = i3;
arrayList7 = arrayList15;
xmlPullParser2 = xmlPullParser;
if (q08.f(xmlPullParser2, "SegmentBase")) {
e0 = ds0Var.c0(xmlPullParser2, (tp4.e) tp4Var2);
} else if (q08.f(xmlPullParser2, "SegmentList")) {
e0 = ds0Var.d0(xmlPullParser2, (tp4.b) tp4Var2, j);
} else if (q08.f(xmlPullParser2, "SegmentTemplate")) {
e0 = e0(xmlPullParser, (tp4.c) tp4Var2, arrayList, j);
} else {
if (q08.f(xmlPullParser2, "InbandEventStream")) {
arrayList8 = arrayList5;
arrayList8.add(H(xmlPullParser2, "InbandEventStream"));
} else {
arrayList8 = arrayList5;
if (q08.f(xmlPullParser2, "Label")) {
str9 = R(xmlPullParser);
} else if (q08.e(xmlPullParser)) {
y(xmlPullParser);
}
}
attributeValue3 = str2;
str8 = str3;
}
tp4Var2 = e0;
}
attributeValue3 = str2;
str8 = str3;
arrayList8 = arrayList5;
}
str2 = attributeValue3;
str3 = str8;
arrayList = arrayList14;
arrayList2 = arrayList13;
arrayList3 = arrayList12;
arrayList4 = arrayList11;
arrayList6 = arrayList9;
str4 = str7;
str5 = str6;
xmlPullParser2 = xmlPullParser3;
ds0Var = ds0Var2;
i = i3;
arrayList7 = arrayList15;
arrayList8 = arrayList10;
attributeValue3 = str2;
str8 = str3;
}
arrayList = arrayList14;
arrayList2 = arrayList13;
arrayList3 = arrayList12;
arrayList4 = arrayList11;
arrayList6 = arrayList9;
str4 = str7;
str5 = str6;
xmlPullParser2 = xmlPullParser3;
ds0Var = ds0Var2;
i = i3;
arrayList7 = arrayList15;
arrayList8 = arrayList10;
}
if (q08.d(xmlPullParser2, "AdaptationSet")) {
break;
}
i3 = i;
ds0Var2 = ds0Var;
arrayList15 = arrayList7;
xmlPullParser3 = xmlPullParser2;
arrayList10 = arrayList8;
arrayList14 = arrayList;
arrayList13 = arrayList2;
arrayList12 = arrayList3;
arrayList11 = arrayList4;
arrayList9 = arrayList6;
str7 = str4;
str6 = str5;
}
ArrayList arrayList16 = new ArrayList(arrayList7.size());
for (int i4 = 0; i4 < arrayList7.size(); i4++) {
arrayList16.add(j((a) arrayList7.get(i4), str9, str10, arrayList6, arrayList8));
}
return c(Q, i, arrayList16, arrayList4, arrayList2, arrayList);
}
protected void y(XmlPullParser xmlPullParser) {
u(xmlPullParser);
}
protected int z(XmlPullParser xmlPullParser) {
String i0 = i0(xmlPullParser, "schemeIdUri", null);
int i = -1;
if ("urn:mpeg:dash:23003:3:audio_channel_configuration:2011".equals(i0)) {
i = Q(xmlPullParser, "value", -1);
} else if ("tag:dolby.com,2014:dash:audio_channel_configuration:2011".equals(i0) || "urn:dolby:dash:audio_channel_configuration:2011".equals(i0)) {
i = I(xmlPullParser);
}
do {
xmlPullParser.next();
} while (!q08.d(xmlPullParser, "AudioChannelConfiguration"));
return i;
}
}