package com.applovin.impl; import android.util.Pair; import android.util.SparseArray; import androidx.work.WorkRequest; import com.applovin.impl.ij; import com.applovin.impl.qo; import com.applovin.impl.y6; import com.firemint.realracing.Platform; import com.google.android.gms.drive.DriveFile; import com.mbridge.msdk.playercommon.exoplayer2.C; import com.mbridge.msdk.playercommon.exoplayer2.util.MimeTypes; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Locale; import java.util.Map; import java.util.UUID; import kotlin.jvm.internal.ByteCompanionObject; /* loaded from: classes.dex */ public class yc implements k8 { public static final o8 b0 = new o8() { // from class: com.applovin.impl.yc$$ExternalSyntheticLambda0 @Override // com.applovin.impl.o8 public final k8[] a() { k8[] g; g = yc.g(); return g; } }; private static final byte[] c0 = {49, 10, 48, 48, 58, 48, 48, 58, 48, 48, 44, 48, 48, 48, 32, 45, 45, 62, 32, 48, 48, 58, 48, 48, 58, 48, 48, 44, 48, 48, 48, 10}; private static final byte[] d0 = xp.c("Format: Start, End, ReadOrder, Layer, Style, Name, MarginL, MarginR, MarginV, Effect, Text"); private static final byte[] e0 = {68, 105, 97, 108, 111, 103, 117, 101, 58, 32, 48, 58, 48, 48, 58, 48, 48, 58, 48, 48, 44, 48, 58, 48, 48, 58, 48, 48, 58, 48, 48, 44}; private static final UUID f0 = new UUID(72057594037932032L, -9223371306706625679L); private static final Map g0; private long A; private long B; private rc C; private rc D; private boolean E; private boolean F; private int G; private long H; private long I; private int J; private int K; private int[] L; private int M; private int N; private int O; private int P; private boolean Q; private int R; private int S; private int T; private boolean U; private boolean V; private boolean W; private int X; private byte Y; private boolean Z; private final p7 a; private m8 a0; private final zp b; private final SparseArray c; private final boolean d; private final bh e; private final bh f; private final bh g; private final bh h; private final bh i; private final bh j; private final bh k; private final bh l; private final bh m; private final bh n; private ByteBuffer o; private long p; private long q; private long r; private long s; private long t; private c u; private boolean v; private int w; private long x; private boolean y; private long z; static { HashMap hashMap = new HashMap(); hashMap.put("htc_video_rotA-000", 0); hashMap.put("htc_video_rotA-090", 90); hashMap.put("htc_video_rotA-180", 180); hashMap.put("htc_video_rotA-270", 270); g0 = Collections.unmodifiableMap(hashMap); } /* JADX INFO: Access modifiers changed from: private */ public static /* synthetic */ k8[] g() { return new k8[]{new yc()}; } @Override // com.applovin.impl.k8 public final void a() { } @Override // com.applovin.impl.k8 public final void a(m8 m8Var) { this.a0 = m8Var; } public int e(int i) { switch (i) { case 131: case 136: case 155: case 159: case 176: case 179: case 186: case 215: case 231: case 238: case 241: case 251: case 16871: case 16980: case 17029: case 17143: case 18401: case 18408: case 20529: case 20530: case 21420: case 21432: case 21680: case 21682: case 21690: case 21930: case 21945: case 21946: case 21947: case 21948: case 21949: case 21998: case 22186: case 22203: case 25188: case 30321: case 2352003: case 2807729: return 2; case 134: case 17026: case 21358: case 2274716: return 3; case 160: case 166: case 174: case 183: case 187: case 224: case 225: case 16868: case 18407: case 19899: case 20532: case 20533: case 21936: case 21968: case 25152: case 28032: case 30113: case 30320: case 290298740: case 357149030: case 374648427: case 408125543: case 440786851: case 475249515: case 524531317: return 1; case 161: case 163: case 165: case 16877: case 16981: case 18402: case 21419: case 25506: case 30322: return 4; case 181: case 17545: case 21969: case 21970: case 21971: case 21972: case 21973: case 21974: case 21975: case 21976: case 21977: case 21978: case 30323: case 30324: case 30325: return 5; default: return 0; } } public boolean f(int i) { return i == 357149030 || i == 524531317 || i == 475249515 || i == 374648427; } public yc() { this(0); } public void c(int i) { e(); if (i == 160) { if (this.G != 2) { return; } int i2 = 0; for (int i3 = 0; i3 < this.K; i3++) { i2 += this.L[i3]; } c cVar = (c) this.c.get(this.M); cVar.a(); for (int i4 = 0; i4 < this.K; i4++) { long j = ((cVar.e * i4) / 1000) + this.H; int i5 = this.O; if (i4 == 0 && !this.Q) { i5 |= 1; } int i6 = this.L[i4]; i2 -= i6; a(cVar, j, i5, i6, i2); } this.G = 0; return; } if (i == 174) { c cVar2 = (c) b1.b(this.u); String str = cVar2.b; if (str != null) { if (a(str)) { cVar2.a(this.a0, cVar2.c); this.c.put(cVar2.c, cVar2); } this.u = null; return; } throw dh.a("CodecId is missing in TrackEntry element", null); } if (i == 19899) { int i7 = this.w; if (i7 != -1) { long j2 = this.x; if (j2 != -1) { if (i7 == 475249515) { this.z = j2; return; } return; } } throw dh.a("Mandatory element SeekID or SeekPosition not found", null); } if (i == 25152) { b(i); c cVar3 = this.u; if (cVar3.h) { if (cVar3.j != null) { cVar3.l = new y6(new y6.b(t2.a, "video/webm", this.u.j.b)); return; } throw dh.a("Encrypted Track found but ContentEncKeyID was not found", null); } return; } if (i == 28032) { b(i); c cVar4 = this.u; if (cVar4.h && cVar4.i != null) { throw dh.a("Combining encryption and compression is not supported", null); } return; } if (i == 357149030) { if (this.r == C.TIME_UNSET) { this.r = 1000000L; } long j3 = this.s; if (j3 != C.TIME_UNSET) { this.t = a(j3); return; } return; } if (i == 374648427) { if (this.c.size() != 0) { this.a0.c(); return; } throw dh.a("No valid tracks were found", null); } if (i != 475249515) { return; } if (!this.v) { this.a0.a(a(this.C, this.D)); this.v = true; } this.C = null; this.D = null; } public yc(int i) { this(new a6(), i); } public yc(p7 p7Var, int i) { this.q = -1L; this.r = C.TIME_UNSET; this.s = C.TIME_UNSET; this.t = C.TIME_UNSET; this.z = -1L; this.A = -1L; this.B = C.TIME_UNSET; this.a = p7Var; p7Var.a(new b()); this.d = (i & 1) == 0; this.b = new zp(); this.c = new SparseArray(); this.g = new bh(4); this.h = new bh(ByteBuffer.allocate(4).putInt(-1).array()); this.i = new bh(4); this.e = new bh(zf.a); this.f = new bh(4); this.j = new bh(); this.k = new bh(); this.l = new bh(8); this.m = new bh(); this.n = new bh(); this.L = new int[1]; } private void b(int i) { if (this.u != null) { return; } throw dh.a("Element " + i + " must be in a TrackEntry", null); } private void a(int i) { if (this.C == null || this.D == null) { throw dh.a("Element " + i + " must be in a Cues", null); } } private c d(int i) { b(i); return this.u; } private int f() { int i = this.S; h(); return i; } private void h() { this.R = 0; this.S = 0; this.T = 0; this.U = false; this.V = false; this.W = false; this.X = 0; this.Y = (byte) 0; this.Z = false; this.j.d(0); } private void e() { b1.b(this.a0); } public final class b implements o7 { private b() { } @Override // com.applovin.impl.o7 public int b(int i) { return yc.this.e(i); } @Override // com.applovin.impl.o7 public boolean c(int i) { return yc.this.f(i); } @Override // com.applovin.impl.o7 public void a(int i, int i2, l8 l8Var) { yc.this.a(i, i2, l8Var); } @Override // com.applovin.impl.o7 public void a(int i) { yc.this.c(i); } @Override // com.applovin.impl.o7 public void a(int i, double d) { yc.this.a(i, d); } @Override // com.applovin.impl.o7 public void a(int i, long j) { yc.this.a(i, j); } @Override // com.applovin.impl.o7 public void a(int i, long j, long j2) { yc.this.a(i, j, j2); } @Override // com.applovin.impl.o7 public void a(int i, String str) { yc.this.a(i, str); } } public static final class d { private final byte[] a = new byte[10]; private boolean b; private int c; private long d; private int e; private int f; private int g; public void a() { this.b = false; this.c = 0; } public void a(c cVar) { if (this.c > 0) { cVar.X.a(this.d, this.e, this.f, this.g, cVar.j); this.c = 0; } } public void a(c cVar, long j, int i, int i2, int i3) { if (this.b) { int i4 = this.c; int i5 = i4 + 1; this.c = i5; if (i4 == 0) { this.d = j; this.e = i; this.f = 0; } this.f += i2; this.g = i3; if (i5 >= 16) { a(cVar); } } } public void a(l8 l8Var) { if (this.b) { return; } l8Var.c(this.a, 0, 10); l8Var.b(); if (k.b(this.a) == 0) { return; } this.b = true; } } public static final class c { public int A; public int B; public int C; public float D; public float E; public float F; public float G; public float H; public float I; public float J; public float K; public float L; public float M; public byte[] N; public int O; public int P; public int Q; public long R; public long S; public d T; public boolean U; public boolean V; private String W; public qo X; public int Y; public String a; public String b; public int c; public int d; public int e; public int f; private int g; public boolean h; public byte[] i; public qo.a j; public byte[] k; public y6 l; public int m; public int n; public int o; public int p; public int q; public int r; public float s; public float t; public float u; public byte[] v; public int w; public boolean x; public int y; public int z; private c() { this.m = -1; this.n = -1; this.o = -1; this.p = -1; this.q = 0; this.r = -1; this.s = 0.0f; this.t = 0.0f; this.u = 0.0f; this.v = null; this.w = -1; this.x = false; this.y = -1; this.z = -1; this.A = -1; this.B = 1000; this.C = 200; this.D = -1.0f; this.E = -1.0f; this.F = -1.0f; this.G = -1.0f; this.H = -1.0f; this.I = -1.0f; this.J = -1.0f; this.K = -1.0f; this.L = -1.0f; this.M = -1.0f; this.O = 1; this.P = -1; this.Q = 8000; this.R = 0L; this.S = 0L; this.V = true; this.W = "eng"; } public void c() { d dVar = this.T; if (dVar != null) { dVar.a(this); } } public void d() { d dVar = this.T; if (dVar != null) { dVar.a(); } } private byte[] b() { if (this.D == -1.0f || this.E == -1.0f || this.F == -1.0f || this.G == -1.0f || this.H == -1.0f || this.I == -1.0f || this.J == -1.0f || this.K == -1.0f || this.L == -1.0f || this.M == -1.0f) { return null; } byte[] bArr = new byte[25]; ByteBuffer order = ByteBuffer.wrap(bArr).order(ByteOrder.LITTLE_ENDIAN); order.put((byte) 0); order.putShort((short) ((this.D * 50000.0f) + 0.5f)); order.putShort((short) ((this.E * 50000.0f) + 0.5f)); order.putShort((short) ((this.F * 50000.0f) + 0.5f)); order.putShort((short) ((this.G * 50000.0f) + 0.5f)); order.putShort((short) ((this.H * 50000.0f) + 0.5f)); order.putShort((short) ((this.I * 50000.0f) + 0.5f)); order.putShort((short) ((this.J * 50000.0f) + 0.5f)); order.putShort((short) ((this.K * 50000.0f) + 0.5f)); order.putShort((short) (this.L + 0.5f)); order.putShort((short) (this.M + 0.5f)); order.putShort((short) this.B); order.putShort((short) this.C); return bArr; } private static boolean b(bh bhVar) { try { int r = bhVar.r(); if (r == 1) { return true; } if (r != 65534) { return false; } bhVar.f(24); if (bhVar.s() == yc.f0.getMostSignificantBits()) { if (bhVar.s() == yc.f0.getLeastSignificantBits()) { return true; } } return false; } catch (ArrayIndexOutOfBoundsException unused) { throw dh.a("Error parsing MS/ACM codec private", null); } } /* JADX INFO: Access modifiers changed from: private */ public void a() { b1.a(this.X); } private byte[] a(String str) { byte[] bArr = this.k; if (bArr != null) { return bArr; } throw dh.a("Missing CodecPrivate for codec " + str, null); } /* JADX WARN: Can't fix incorrect switch cases order, some code will duplicate */ /* JADX WARN: Removed duplicated region for block: B:14:0x03fe */ /* JADX WARN: Removed duplicated region for block: B:19:0x0413 */ /* JADX WARN: Removed duplicated region for block: B:22:0x0422 */ /* JADX WARN: Removed duplicated region for block: B:25:0x0539 */ /* JADX WARN: Removed duplicated region for block: B:30:0x0434 */ /* JADX WARN: Removed duplicated region for block: B:89:0x0415 */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ public void a(com.applovin.impl.m8 r20, int r21) { /* Method dump skipped, instructions count: 1608 To view this dump add '--comments-level debug' option */ throw new UnsupportedOperationException("Method not decompiled: com.applovin.impl.yc.c.a(com.applovin.impl.m8, int):void"); } private static Pair a(bh bhVar) { try { bhVar.g(16); long p = bhVar.p(); if (p == 1482049860) { return new Pair("video/divx", null); } if (p == 859189832) { return new Pair(MimeTypes.VIDEO_H263, null); } if (p == 826496599) { byte[] c = bhVar.c(); for (int d = bhVar.d() + 20; d < c.length - 4; d++) { if (c[d] == 0 && c[d + 1] == 0 && c[d + 2] == 1 && c[d + 3] == 15) { return new Pair(MimeTypes.VIDEO_VC1, Collections.singletonList(Arrays.copyOfRange(c, d, c.length))); } } throw dh.a("Failed to find FourCC VC1 initialization data", null); } pc.d("MatroskaExtractor", "Unknown FourCC. Setting mimeType to video/x-unknown"); return new Pair(MimeTypes.VIDEO_UNKNOWN, null); } catch (ArrayIndexOutOfBoundsException unused) { throw dh.a("Error parsing FourCC private data", null); } } private static List a(byte[] bArr) { int i; int i2; try { if (bArr[0] == 2) { int i3 = 0; int i4 = 1; while (true) { i = bArr[i4] & 255; if (i != 255) { break; } i3 += 255; i4++; } int i5 = i4 + 1; int i6 = i3 + i; int i7 = 0; while (true) { i2 = bArr[i5] & 255; if (i2 != 255) { break; } i7 += 255; i5++; } int i8 = i5 + 1; int i9 = i7 + i2; if (bArr[i8] == 1) { byte[] bArr2 = new byte[i6]; System.arraycopy(bArr, i8, bArr2, 0, i6); int i10 = i8 + i6; if (bArr[i10] == 3) { int i11 = i10 + i9; if (bArr[i11] == 5) { byte[] bArr3 = new byte[bArr.length - i11]; System.arraycopy(bArr, i11, bArr3, 0, bArr.length - i11); ArrayList arrayList = new ArrayList(2); arrayList.add(bArr2); arrayList.add(bArr3); return arrayList; } throw dh.a("Error parsing vorbis codec private", null); } throw dh.a("Error parsing vorbis codec private", null); } throw dh.a("Error parsing vorbis codec private", null); } throw dh.a("Error parsing vorbis codec private", null); } catch (ArrayIndexOutOfBoundsException unused) { throw dh.a("Error parsing vorbis codec private", null); } } } /* JADX WARN: Code restructure failed: missing block: B:118:0x022c, code lost: throw com.applovin.impl.dh.a("EBML lacing sample size out of range.", null); */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ public void a(int r20, int r21, com.applovin.impl.l8 r22) { /* Method dump skipped, instructions count: 741 To view this dump add '--comments-level debug' option */ throw new UnsupportedOperationException("Method not decompiled: com.applovin.impl.yc.a(int, int, com.applovin.impl.l8):void"); } private ij a(rc rcVar, rc rcVar2) { int i; if (this.q != -1 && this.t != C.TIME_UNSET && rcVar != null && rcVar.a() != 0 && rcVar2 != null && rcVar2.a() == rcVar.a()) { int a2 = rcVar.a(); int[] iArr = new int[a2]; long[] jArr = new long[a2]; long[] jArr2 = new long[a2]; long[] jArr3 = new long[a2]; int i2 = 0; for (int i3 = 0; i3 < a2; i3++) { jArr3[i3] = rcVar.a(i3); jArr[i3] = this.q + rcVar2.a(i3); } while (true) { i = a2 - 1; if (i2 >= i) { break; } int i4 = i2 + 1; iArr[i2] = (int) (jArr[i4] - jArr[i2]); jArr2[i2] = jArr3[i4] - jArr3[i2]; i2 = i4; } iArr[i] = (int) ((this.q + this.p) - jArr[i]); long j = this.t - jArr3[i]; jArr2[i] = j; if (j <= 0) { pc.d("MatroskaExtractor", "Discarding last cue point with unexpected duration: " + j); iArr = Arrays.copyOf(iArr, i); jArr = Arrays.copyOf(jArr, i); jArr2 = Arrays.copyOf(jArr2, i); jArr3 = Arrays.copyOf(jArr3, i); } return new g3(iArr, jArr, jArr2, jArr3); } return new ij.b(this.t); } private void a(c cVar, long j, int i, int i2, int i3) { d dVar = cVar.T; if (dVar != null) { dVar.a(cVar, j, i, i2, i3); } else { if ("S_TEXT/UTF8".equals(cVar.b) || "S_TEXT/ASS".equals(cVar.b)) { if (this.K > 1) { pc.d("MatroskaExtractor", "Skipping subtitle sample in laced block."); } else { long j2 = this.I; if (j2 == C.TIME_UNSET) { pc.d("MatroskaExtractor", "Skipping subtitle sample with no duration."); } else { a(cVar.b, j2, this.k.c()); int d2 = this.k.d(); while (true) { if (d2 >= this.k.e()) { break; } if (this.k.c()[d2] == 0) { this.k.e(d2); break; } d2++; } qo qoVar = cVar.X; bh bhVar = this.k; qoVar.a(bhVar, bhVar.e()); i2 += this.k.e(); } } } if ((268435456 & i) != 0) { if (this.K > 1) { i &= -268435457; } else { int e = this.n.e(); cVar.X.a(this.n, e, 2); i2 += e; } } cVar.X.a(j, i, i2, i3, cVar.j); } this.F = true; } private static int[] a(int[] iArr, int i) { if (iArr == null) { return new int[i]; } return iArr.length >= i ? iArr : new int[Math.max(iArr.length * 2, i)]; } public void a(int i, double d2) { if (i == 181) { d(i).Q = (int) d2; } if (i == 17545) { this.s = (long) d2; return; } switch (i) { case 21969: d(i).D = (float) d2; break; case 21970: d(i).E = (float) d2; break; case 21971: d(i).F = (float) d2; break; case 21972: d(i).G = (float) d2; break; case 21973: d(i).H = (float) d2; break; case 21974: d(i).I = (float) d2; break; case 21975: d(i).J = (float) d2; break; case 21976: d(i).K = (float) d2; break; case 21977: d(i).L = (float) d2; break; case 21978: d(i).M = (float) d2; break; default: switch (i) { case 30323: d(i).s = (float) d2; break; case 30324: d(i).t = (float) d2; break; case 30325: d(i).u = (float) d2; break; } } } private static byte[] a(long j, String str, long j2) { b1.a(j != C.TIME_UNSET); int i = (int) (j / 3600000000L); long j3 = j - ((i * Platform.INTERNET_CONNECTION_DELAY) * 1000000); int i2 = (int) (j3 / 60000000); long j4 = j3 - ((i2 * 60) * 1000000); int i3 = (int) (j4 / 1000000); return xp.c(String.format(Locale.US, str, Integer.valueOf(i), Integer.valueOf(i2), Integer.valueOf(i3), Integer.valueOf((int) ((j4 - (i3 * 1000000)) / j2)))); } public void a(c cVar, l8 l8Var, int i) { if (cVar.g != 1685485123 && cVar.g != 1685480259) { l8Var.a(i); return; } byte[] bArr = new byte[i]; cVar.N = bArr; l8Var.d(bArr, 0, i); } public void a(c cVar, int i, l8 l8Var, int i2) { if (i == 4 && "V_VP9".equals(cVar.b)) { this.n.d(i2); l8Var.d(this.n.c(), 0, i2); } else { l8Var.a(i2); } } public void a(int i, long j) { if (i == 20529) { if (j == 0) { return; } throw dh.a("ContentEncodingOrder " + j + " not supported", null); } if (i == 20530) { if (j == 1) { return; } throw dh.a("ContentEncodingScope " + j + " not supported", null); } switch (i) { case 131: d(i).d = (int) j; return; case 136: d(i).V = j == 1; return; case 155: this.I = a(j); return; case 159: d(i).O = (int) j; return; case 176: d(i).m = (int) j; return; case 179: a(i); this.C.a(a(j)); return; case 186: d(i).n = (int) j; return; case 215: d(i).c = (int) j; return; case 231: this.B = a(j); return; case 238: this.P = (int) j; return; case 241: if (this.E) { return; } a(i); this.D.a(j); this.E = true; return; case 251: this.Q = true; return; case 16871: d(i).g = (int) j; return; case 16980: if (j == 3) { return; } throw dh.a("ContentCompAlgo " + j + " not supported", null); case 17029: if (j < 1 || j > 2) { throw dh.a("DocTypeReadVersion " + j + " not supported", null); } return; case 17143: if (j == 1) { return; } throw dh.a("EBMLReadVersion " + j + " not supported", null); case 18401: if (j == 5) { return; } throw dh.a("ContentEncAlgo " + j + " not supported", null); case 18408: if (j == 1) { return; } throw dh.a("AESSettingsCipherMode " + j + " not supported", null); case 21420: this.x = j + this.q; return; case 21432: int i2 = (int) j; b(i); if (i2 == 0) { this.u.w = 0; return; } if (i2 == 1) { this.u.w = 2; return; } else if (i2 == 3) { this.u.w = 1; return; } else { if (i2 != 15) { return; } this.u.w = 3; return; } case 21680: d(i).o = (int) j; return; case 21682: d(i).q = (int) j; return; case 21690: d(i).p = (int) j; return; case 21930: d(i).U = j == 1; return; case 21998: d(i).f = (int) j; return; case 22186: d(i).R = j; return; case 22203: d(i).S = j; return; case 25188: d(i).P = (int) j; return; case 30321: b(i); int i3 = (int) j; if (i3 == 0) { this.u.r = 0; return; } if (i3 == 1) { this.u.r = 1; return; } else if (i3 == 2) { this.u.r = 2; return; } else { if (i3 != 3) { return; } this.u.r = 3; return; } case 2352003: d(i).e = (int) j; return; case 2807729: this.r = j; return; default: switch (i) { case 21945: b(i); int i4 = (int) j; if (i4 == 1) { this.u.A = 2; return; } else { if (i4 != 2) { return; } this.u.A = 1; return; } case 21946: b(i); int b2 = r3.b((int) j); if (b2 != -1) { this.u.z = b2; return; } return; case 21947: b(i); this.u.x = true; int a2 = r3.a((int) j); if (a2 != -1) { this.u.y = a2; return; } return; case 21948: d(i).B = (int) j; return; case 21949: d(i).C = (int) j; return; default: return; } } } private static boolean a(String str) { str.hashCode(); switch (str) { case "V_MPEG4/ISO/AP": case "V_MPEG4/ISO/SP": case "A_MS/ACM": case "A_TRUEHD": case "A_VORBIS": case "A_MPEG/L2": case "A_MPEG/L3": case "V_MS/VFW/FOURCC": case "S_DVBSUB": case "V_MPEG4/ISO/ASP": case "V_MPEG4/ISO/AVC": case "S_VOBSUB": case "A_DTS/LOSSLESS": case "A_AAC": case "A_AC3": case "A_DTS": case "V_AV1": case "V_VP8": case "V_VP9": case "S_HDMV/PGS": case "V_THEORA": case "A_DTS/EXPRESS": case "A_PCM/FLOAT/IEEE": case "A_PCM/INT/BIG": case "A_PCM/INT/LIT": case "S_TEXT/ASS": case "V_MPEGH/ISO/HEVC": case "S_TEXT/UTF8": case "V_MPEG2": case "A_EAC3": case "A_FLAC": case "A_OPUS": return true; default: return false; } } private boolean a(th thVar, long j) { if (this.y) { this.A = j; thVar.a = this.z; this.y = false; return true; } if (this.v) { long j2 = this.A; if (j2 != -1) { thVar.a = j2; this.A = -1L; return true; } } return false; } @Override // com.applovin.impl.k8 public final int a(l8 l8Var, th thVar) { this.F = false; boolean z = true; while (z && !this.F) { z = this.a.a(l8Var); if (z && a(thVar, l8Var.f())) { return 1; } } if (z) { return 0; } for (int i = 0; i < this.c.size(); i++) { c cVar = (c) this.c.valueAt(i); cVar.a(); cVar.c(); } return -1; } private void a(l8 l8Var, int i) { if (this.g.e() >= i) { return; } if (this.g.b() < i) { bh bhVar = this.g; bhVar.a(Math.max(bhVar.b() * 2, i)); } l8Var.d(this.g.c(), this.g.e(), i - this.g.e()); this.g.e(i); } private long a(long j) { long j2 = this.r; if (j2 != C.TIME_UNSET) { return xp.c(j, j2, 1000L); } throw dh.a("Can't scale timecode prior to timecodeScale being set.", null); } @Override // com.applovin.impl.k8 public void a(long j, long j2) { this.B = C.TIME_UNSET; this.G = 0; this.a.reset(); this.b.b(); h(); for (int i = 0; i < this.c.size(); i++) { ((c) this.c.valueAt(i)).d(); } } private static void a(String str, long j, byte[] bArr) { byte[] a2; int i; str.hashCode(); if (str.equals("S_TEXT/ASS")) { a2 = a(j, "%01d:%02d:%02d:%02d", WorkRequest.MIN_BACKOFF_MILLIS); i = 21; } else if (str.equals("S_TEXT/UTF8")) { a2 = a(j, "%02d:%02d:%02d,%03d", 1000L); i = 19; } else { throw new IllegalArgumentException(); } System.arraycopy(a2, 0, bArr, i, a2.length); } public void a(int i, long j, long j2) { e(); if (i == 160) { this.Q = false; return; } if (i == 174) { this.u = new c(); return; } if (i == 187) { this.E = false; return; } if (i == 19899) { this.w = -1; this.x = -1L; return; } if (i == 20533) { d(i).h = true; return; } if (i == 21968) { d(i).x = true; return; } if (i == 408125543) { long j3 = this.q; if (j3 != -1 && j3 != j) { throw dh.a("Multiple Segment elements not supported", null); } this.q = j; this.p = j2; return; } if (i == 475249515) { this.C = new rc(); this.D = new rc(); } else if (i == 524531317 && !this.v) { if (this.d && this.z != -1) { this.y = true; } else { this.a0.a(new ij.b(this.t)); this.v = true; } } } public void a(int i, String str) { if (i == 134) { d(i).b = str; return; } if (i != 17026) { if (i == 21358) { d(i).a = str; return; } else { if (i != 2274716) { return; } d(i).W = str; return; } } if ("webm".equals(str) || "matroska".equals(str)) { return; } throw dh.a("DocType " + str + " not supported", null); } private int a(l8 l8Var, c cVar, int i) { int i2; if ("S_TEXT/UTF8".equals(cVar.b)) { a(l8Var, c0, i); return f(); } if ("S_TEXT/ASS".equals(cVar.b)) { a(l8Var, e0, i); return f(); } qo qoVar = cVar.X; if (!this.U) { if (cVar.h) { this.O &= -1073741825; if (!this.V) { l8Var.d(this.g.c(), 0, 1); this.R++; if ((this.g.c()[0] & ByteCompanionObject.MIN_VALUE) != 128) { this.Y = this.g.c()[0]; this.V = true; } else { throw dh.a("Extension bit is set in signal byte", null); } } byte b2 = this.Y; if ((b2 & 1) == 1) { boolean z = (b2 & 2) == 2; this.O |= 1073741824; if (!this.Z) { l8Var.d(this.l.c(), 0, 8); this.R += 8; this.Z = true; this.g.c()[0] = (byte) ((z ? 128 : 0) | 8); this.g.f(0); qoVar.a(this.g, 1, 1); this.S++; this.l.f(0); qoVar.a(this.l, 8, 1); this.S += 8; } if (z) { if (!this.W) { l8Var.d(this.g.c(), 0, 1); this.R++; this.g.f(0); this.X = this.g.w(); this.W = true; } int i3 = this.X * 4; this.g.d(i3); l8Var.d(this.g.c(), 0, i3); this.R += i3; short s = (short) ((this.X / 2) + 1); int i4 = (s * 6) + 2; ByteBuffer byteBuffer = this.o; if (byteBuffer == null || byteBuffer.capacity() < i4) { this.o = ByteBuffer.allocate(i4); } this.o.position(0); this.o.putShort(s); int i5 = 0; int i6 = 0; while (true) { i2 = this.X; if (i5 >= i2) { break; } int A = this.g.A(); if (i5 % 2 == 0) { this.o.putShort((short) (A - i6)); } else { this.o.putInt(A - i6); } i5++; i6 = A; } int i7 = (i - this.R) - i6; if (i2 % 2 == 1) { this.o.putInt(i7); } else { this.o.putShort((short) i7); this.o.putInt(0); } this.m.a(this.o.array(), i4); qoVar.a(this.m, i4, 1); this.S += i4; } } } else { byte[] bArr = cVar.i; if (bArr != null) { this.j.a(bArr, bArr.length); } } if (cVar.f > 0) { this.O |= DriveFile.MODE_READ_ONLY; this.n.d(0); this.g.d(4); this.g.c()[0] = (byte) ((i >> 24) & 255); this.g.c()[1] = (byte) ((i >> 16) & 255); this.g.c()[2] = (byte) ((i >> 8) & 255); this.g.c()[3] = (byte) (i & 255); qoVar.a(this.g, 4, 2); this.S += 4; } this.U = true; } int e = i + this.j.e(); if (!"V_MPEG4/ISO/AVC".equals(cVar.b) && !"V_MPEGH/ISO/HEVC".equals(cVar.b)) { if (cVar.T != null) { b1.b(this.j.e() == 0); cVar.T.a(l8Var); } while (true) { int i8 = this.R; if (i8 >= e) { break; } int a2 = a(l8Var, qoVar, e - i8); this.R += a2; this.S += a2; } } else { byte[] c2 = this.f.c(); c2[0] = 0; c2[1] = 0; c2[2] = 0; int i9 = cVar.Y; int i10 = 4 - i9; while (this.R < e) { int i11 = this.T; if (i11 == 0) { a(l8Var, c2, i10, i9); this.R += i9; this.f.f(0); this.T = this.f.A(); this.e.f(0); qoVar.a(this.e, 4); this.S += 4; } else { int a3 = a(l8Var, qoVar, i11); this.R += a3; this.S += a3; this.T -= a3; } } } if ("A_VORBIS".equals(cVar.b)) { this.h.f(0); qoVar.a(this.h, 4); this.S += 4; } return f(); } private void a(l8 l8Var, byte[] bArr, int i) { int length = bArr.length + i; if (this.k.b() < length) { this.k.a(Arrays.copyOf(bArr, length + i)); } else { System.arraycopy(bArr, 0, this.k.c(), 0, bArr.length); } l8Var.d(this.k.c(), bArr.length, i); this.k.f(0); this.k.e(length); } private int a(l8 l8Var, qo qoVar, int i) { int a2 = this.j.a(); if (a2 > 0) { int min = Math.min(i, a2); qoVar.a(this.j, min); return min; } return qoVar.a((g5) l8Var, i, false); } private void a(l8 l8Var, byte[] bArr, int i, int i2) { int min = Math.min(i2, this.j.a()); l8Var.d(bArr, i + min, i2 - min); if (min > 0) { this.j.a(bArr, i, min); } } @Override // com.applovin.impl.k8 public final boolean a(l8 l8Var) { return new mk().b(l8Var); } }