Files
rr3-apk/decompiled/sources/com/applovin/impl/j9.java
Daniel Elliott f9d20bb3fc Add decompiled APK source code (JADX)
- 28,932 files
- Full Java source code
- Smali files
- Resources

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-02-18 14:52:23 -08:00

1255 lines
36 KiB
Java

package com.applovin.impl;
import android.util.Pair;
import android.util.SparseArray;
import com.applovin.exoplayer2.common.base.Ascii;
import com.applovin.exoplayer2.common.base.Function;
import com.applovin.impl.f9;
import com.applovin.impl.ij;
import com.applovin.impl.j1;
import com.applovin.impl.y6;
import com.mbridge.msdk.playercommon.exoplayer2.C;
import com.mbridge.msdk.playercommon.exoplayer2.extractor.ts.PsExtractor;
import com.mbridge.msdk.playercommon.exoplayer2.util.MimeTypes;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
/* loaded from: classes.dex */
public class j9 implements k8 {
public static final o8 I = new o8() { // from class: com.applovin.impl.j9$$ExternalSyntheticLambda1
@Override // com.applovin.impl.o8
public final k8[] a() {
k8[] d;
d = j9.d();
return d;
}
};
private static final byte[] J = {-94, 57, 79, 82, 90, -101, 79, Ascii.DC4, -94, 68, 108, 66, 124, 100, -115, -12};
private static final f9 K = new f9.b().f(MimeTypes.APPLICATION_EMSG).a();
private int A;
private int B;
private int C;
private boolean D;
private m8 E;
private qo[] F;
private qo[] G;
private boolean H;
private final int a;
private final lo b;
private final List c;
private final SparseArray d;
private final bh e;
private final bh f;
private final bh g;
private final byte[] h;
private final bh i;
private final ho j;
private final y7 k;
private final bh l;
private final ArrayDeque m;
private final ArrayDeque n;
private final qo o;
private int p;
private int q;
private long r;
private int s;
private bh t;
private long u;
private int v;
private long w;
private long x;
private long y;
private b z;
private void b() {
this.p = 0;
this.s = 0;
}
private static boolean b(int i) {
return i == 1836019574 || i == 1953653099 || i == 1835297121 || i == 1835626086 || i == 1937007212 || i == 1836019558 || i == 1953653094 || i == 1836475768 || i == 1701082227;
}
private static boolean c(int i) {
return i == 1751411826 || i == 1835296868 || i == 1836476516 || i == 1936286840 || i == 1937011556 || i == 1937011827 || i == 1668576371 || i == 1937011555 || i == 1937011578 || i == 1937013298 || i == 1937007471 || i == 1668232756 || i == 1937011571 || i == 1952867444 || i == 1952868452 || i == 1953196132 || i == 1953654136 || i == 1953658222 || i == 1886614376 || i == 1935763834 || i == 1935763823 || i == 1936027235 || i == 1970628964 || i == 1935828848 || i == 1936158820 || i == 1701606260 || i == 1835362404 || i == 1701671783;
}
public lo a(lo loVar) {
return loVar;
}
@Override // com.applovin.impl.k8
public void a() {
}
public j9() {
this(0);
}
public j9(int i) {
this(i, null);
}
public j9(int i, ho hoVar) {
this(i, hoVar, null, Collections.emptyList());
}
private void c() {
int i;
qo[] qoVarArr = new qo[2];
this.F = qoVarArr;
qo qoVar = this.o;
int i2 = 0;
if (qoVar != null) {
qoVarArr[0] = qoVar;
i = 1;
} else {
i = 0;
}
int i3 = 100;
if ((this.a & 4) != 0) {
qoVarArr[i] = this.E.a(100, 5);
i3 = 101;
i++;
}
qo[] qoVarArr2 = (qo[]) xp.a(this.F, i);
this.F = qoVarArr2;
for (qo qoVar2 : qoVarArr2) {
qoVar2.a(K);
}
this.G = new qo[this.c.size()];
while (i2 < this.G.length) {
qo a2 = this.E.a(i3, 3);
a2.a((f9) this.c.get(i2));
this.G[i2] = a2;
i2++;
i3++;
}
}
private static Pair d(bh bhVar) {
bhVar.f(12);
return Pair.create(Integer.valueOf(bhVar.j()), new l6(bhVar.j() - 1, bhVar.j(), bhVar.j(), bhVar.j()));
}
public j9(int i, ho hoVar, lo loVar, List list) {
this(i, hoVar, loVar, list, null);
}
private void b(j1.a aVar) {
a(aVar, this.d, this.b != null, this.a, this.h);
y6 a2 = a(aVar.c);
if (a2 != null) {
int size = this.d.size();
for (int i = 0; i < size; i++) {
((b) this.d.valueAt(i)).a(a2);
}
}
if (this.w != C.TIME_UNSET) {
int size2 = this.d.size();
for (int i2 = 0; i2 < size2; i2++) {
((b) this.d.valueAt(i2)).a(this.w);
}
this.w = C.TIME_UNSET;
}
}
public j9(int i, ho hoVar, lo loVar, List list, qo qoVar) {
this.a = i;
this.j = hoVar;
this.b = loVar;
this.c = Collections.unmodifiableList(list);
this.o = qoVar;
this.k = new y7();
this.l = new bh(16);
this.e = new bh(zf.a);
this.f = new bh(5);
this.g = new bh();
byte[] bArr = new byte[16];
this.h = bArr;
this.i = new bh(bArr);
this.m = new ArrayDeque();
this.n = new ArrayDeque();
this.d = new SparseArray();
this.x = C.TIME_UNSET;
this.w = C.TIME_UNSET;
this.y = C.TIME_UNSET;
this.E = m8.e;
this.F = new qo[0];
this.G = new qo[0];
}
private static int a(int i) {
if (i >= 0) {
return i;
}
throw dh.a("Unexpected negative value: " + i, null);
}
private void c(j1.a aVar) {
int i = 0;
b1.b(this.b == null, "Unexpected moov box.");
y6 a2 = a(aVar.c);
j1.a aVar2 = (j1.a) b1.a(aVar.d(1836475768));
SparseArray sparseArray = new SparseArray();
int size = aVar2.c.size();
long j = -9223372036854775807L;
for (int i2 = 0; i2 < size; i2++) {
j1.b bVar = (j1.b) aVar2.c.get(i2);
int i3 = bVar.a;
if (i3 == 1953654136) {
Pair d = d(bVar.b);
sparseArray.put(((Integer) d.first).intValue(), (l6) d.second);
} else if (i3 == 1835362404) {
j = b(bVar.b);
}
}
List a3 = k1.a(aVar, new z9(), j, a2, (this.a & 16) != 0, false, new Function() { // from class: com.applovin.impl.j9$$ExternalSyntheticLambda0
@Override // com.applovin.exoplayer2.common.base.Function
public final Object apply(Object obj) {
return j9.this.a((lo) obj);
}
});
int size2 = a3.size();
if (this.d.size() == 0) {
while (i < size2) {
ro roVar = (ro) a3.get(i);
lo loVar = roVar.a;
this.d.put(loVar.a, new b(this.E.a(i, loVar.b), roVar, a(sparseArray, loVar.a)));
this.x = Math.max(this.x, loVar.e);
i++;
}
this.E.c();
return;
}
b1.b(this.d.size() == size2);
while (i < size2) {
ro roVar2 = (ro) a3.get(i);
lo loVar2 = roVar2.a;
((b) this.d.get(loVar2.a)).a(roVar2, a(sparseArray, loVar2.a));
i++;
}
}
/* JADX WARN: Multi-variable type inference failed */
private boolean e(l8 l8Var) {
int a2;
b bVar = this.z;
Throwable th = null;
if (bVar == null) {
bVar = a(this.d);
if (bVar == null) {
int f = (int) (this.u - l8Var.f());
if (f >= 0) {
l8Var.a(f);
b();
return false;
}
throw dh.a("Offset to end of mdat was negative.", null);
}
int b2 = (int) (bVar.b() - l8Var.f());
if (b2 < 0) {
pc.d("FragmentedMp4Extractor", "Ignoring negative offset to sample data.");
b2 = 0;
}
l8Var.a(b2);
this.z = bVar;
}
int i = 4;
int i2 = 1;
if (this.p == 3) {
int d = bVar.d();
this.A = d;
if (bVar.f < bVar.i) {
l8Var.a(d);
bVar.h();
if (!bVar.f()) {
this.z = null;
}
this.p = 3;
return true;
}
if (bVar.d.a.g == 1) {
this.A = d - 8;
l8Var.a(8);
}
if ("audio/ac4".equals(bVar.d.a.f.m)) {
this.B = bVar.a(this.A, 7);
n.a(this.A, this.i);
bVar.a.a(this.i, 7);
this.B += 7;
} else {
this.B = bVar.a(this.A, 0);
}
this.A += this.B;
this.p = 4;
this.C = 0;
}
lo loVar = bVar.d.a;
qo qoVar = bVar.a;
long c = bVar.c();
ho hoVar = this.j;
if (hoVar != null) {
c = hoVar.a(c);
}
long j = c;
if (loVar.j == 0) {
while (true) {
int i3 = this.B;
int i4 = this.A;
if (i3 >= i4) {
break;
}
this.B += qoVar.a((g5) l8Var, i4 - i3, false);
}
} else {
byte[] c2 = this.f.c();
c2[0] = 0;
c2[1] = 0;
c2[2] = 0;
int i5 = loVar.j;
int i6 = i5 + 1;
int i7 = 4 - i5;
while (this.B < this.A) {
int i8 = this.C;
if (i8 == 0) {
l8Var.d(c2, i7, i6);
this.f.f(0);
int j2 = this.f.j();
if (j2 >= i2) {
this.C = j2 - 1;
this.e.f(0);
qoVar.a(this.e, i);
qoVar.a(this.f, i2);
this.D = (this.G.length <= 0 || !zf.a(loVar.f.m, c2[i])) ? 0 : i2;
this.B += 5;
this.A += i7;
} else {
throw dh.a("Invalid NAL length", th);
}
} else {
if (this.D) {
this.g.d(i8);
l8Var.d(this.g.c(), 0, this.C);
qoVar.a(this.g, this.C);
a2 = this.C;
int c3 = zf.c(this.g.c(), this.g.e());
this.g.f("video/hevc".equals(loVar.f.m) ? 1 : 0);
this.g.e(c3);
c3.a(j, this.g, this.G);
} else {
a2 = qoVar.a((g5) l8Var, i8, false);
}
this.B += a2;
this.C -= a2;
th = null;
i = 4;
i2 = 1;
}
}
}
int a3 = bVar.a();
mo e = bVar.e();
qoVar.a(j, a3, this.A, 0, e != null ? e.c : null);
a(j);
if (!bVar.f()) {
this.z = null;
}
this.p = 3;
return true;
}
public static final class a {
public final long a;
public final int b;
public a(long j, int i) {
this.a = j;
this.b = i;
}
}
public static final class b {
public final qo a;
public ro d;
public l6 e;
public int f;
public int g;
public int h;
public int i;
private boolean l;
public final no b = new no();
public final bh c = new bh();
private final bh j = new bh(1);
private final bh k = new bh();
public b(qo qoVar, ro roVar, l6 l6Var) {
this.a = qoVar;
this.d = roVar;
this.e = l6Var;
a(roVar, l6Var);
}
public void g() {
this.b.a();
this.f = 0;
this.h = 0;
this.g = 0;
this.i = 0;
this.l = false;
}
public long c() {
if (!this.l) {
return this.d.f[this.f];
}
return this.b.a(this.f);
}
public long b() {
if (!this.l) {
return this.d.c[this.f];
}
return this.b.g[this.h];
}
public int d() {
if (!this.l) {
return this.d.d[this.f];
}
return this.b.i[this.f];
}
public boolean f() {
this.f++;
if (!this.l) {
return false;
}
int i = this.g + 1;
this.g = i;
int[] iArr = this.b.h;
int i2 = this.h;
if (i != iArr[i2]) {
return true;
}
this.h = i2 + 1;
this.g = 0;
return false;
}
public void h() {
mo e = e();
if (e == null) {
return;
}
bh bhVar = this.b.p;
int i = e.d;
if (i != 0) {
bhVar.g(i);
}
if (this.b.c(this.f)) {
bhVar.g(bhVar.C() * 6);
}
}
public mo e() {
if (!this.l) {
return null;
}
int i = ((l6) xp.a(this.b.a)).a;
mo moVar = this.b.o;
if (moVar == null) {
moVar = this.d.a.a(i);
}
if (moVar == null || !moVar.a) {
return null;
}
return moVar;
}
public int a() {
int i;
if (!this.l) {
i = this.d.g[this.f];
} else {
i = this.b.l[this.f] ? 1 : 0;
}
return e() != null ? i | 1073741824 : i;
}
public int a(int i, int i2) {
bh bhVar;
mo e = e();
if (e == null) {
return 0;
}
int i3 = e.d;
if (i3 != 0) {
bhVar = this.b.p;
} else {
byte[] bArr = (byte[]) xp.a((Object) e.e);
this.k.a(bArr, bArr.length);
bh bhVar2 = this.k;
i3 = bArr.length;
bhVar = bhVar2;
}
boolean c = this.b.c(this.f);
boolean z = c || i2 != 0;
this.j.c()[0] = (byte) ((z ? 128 : 0) | i3);
this.j.f(0);
this.a.a(this.j, 1, 1);
this.a.a(bhVar, i3, 1);
if (!z) {
return i3 + 1;
}
if (!c) {
this.c.d(8);
byte[] c2 = this.c.c();
c2[0] = 0;
c2[1] = 1;
c2[2] = (byte) ((i2 >> 8) & 255);
c2[3] = (byte) (i2 & 255);
c2[4] = (byte) ((i >> 24) & 255);
c2[5] = (byte) ((i >> 16) & 255);
c2[6] = (byte) ((i >> 8) & 255);
c2[7] = (byte) (i & 255);
this.a.a(this.c, 8, 1);
return i3 + 9;
}
bh bhVar3 = this.b.p;
int C = bhVar3.C();
bhVar3.g(-2);
int i4 = (C * 6) + 2;
if (i2 != 0) {
this.c.d(i4);
byte[] c3 = this.c.c();
bhVar3.a(c3, 0, i4);
int i5 = (((c3[2] & 255) << 8) | (c3[3] & 255)) + i2;
c3[2] = (byte) ((i5 >> 8) & 255);
c3[3] = (byte) (i5 & 255);
bhVar3 = this.c;
}
this.a.a(bhVar3, i4, 1);
return i3 + 1 + i4;
}
public void a(ro roVar, l6 l6Var) {
this.d = roVar;
this.e = l6Var;
this.a.a(roVar.a.f);
g();
}
public void a(long j) {
int i = this.f;
while (true) {
no noVar = this.b;
if (i >= noVar.f || noVar.a(i) >= j) {
return;
}
if (this.b.l[i]) {
this.i = i;
}
i++;
}
}
public void a(y6 y6Var) {
mo a = this.d.a.a(((l6) xp.a(this.b.a)).a);
this.a.a(this.d.a.f.a().a(y6Var.a(a != null ? a.b : null)).a());
}
}
private l6 a(SparseArray sparseArray, int i) {
if (sparseArray.size() == 1) {
return (l6) sparseArray.valueAt(0);
}
return (l6) b1.a((l6) sparseArray.get(i));
}
private static long b(bh bhVar) {
bhVar.f(8);
return j1.c(bhVar.j()) == 0 ? bhVar.y() : bhVar.B();
}
private void d(l8 l8Var) {
int size = this.d.size();
long j = Long.MAX_VALUE;
b bVar = null;
for (int i = 0; i < size; i++) {
no noVar = ((b) this.d.valueAt(i)).b;
if (noVar.q) {
long j2 = noVar.d;
if (j2 < j) {
bVar = (b) this.d.valueAt(i);
j = j2;
}
}
}
if (bVar == null) {
this.p = 3;
return;
}
int f = (int) (j - l8Var.f());
if (f >= 0) {
l8Var.a(f);
bVar.b.a(l8Var);
return;
}
throw dh.a("Offset to encryption data was negative.", null);
}
/* JADX INFO: Access modifiers changed from: private */
public static /* synthetic */ k8[] d() {
return new k8[]{new j9()};
}
private static long c(bh bhVar) {
bhVar.f(8);
return j1.c(bhVar.j()) == 1 ? bhVar.B() : bhVar.y();
}
private void c(l8 l8Var) {
int i = ((int) this.r) - this.s;
bh bhVar = this.t;
if (bhVar != null) {
l8Var.d(bhVar.c(), 8, i);
a(new j1.b(this.q, bhVar), l8Var.f());
} else {
l8Var.a(i);
}
b(l8Var.f());
}
private static void b(bh bhVar, no noVar) {
a(bhVar, 0, noVar);
}
private static y6 a(List list) {
int size = list.size();
ArrayList arrayList = null;
for (int i = 0; i < size; i++) {
j1.b bVar = (j1.b) list.get(i);
if (bVar.a == 1886614376) {
if (arrayList == null) {
arrayList = new ArrayList();
}
byte[] c = bVar.b.c();
UUID c2 = ji.c(c);
if (c2 == null) {
pc.d("FragmentedMp4Extractor", "Skipped pssh atom (failed to extract uuid)");
} else {
arrayList.add(new y6.b(c2, MimeTypes.VIDEO_MP4, c));
}
}
}
if (arrayList == null) {
return null;
}
return new y6(arrayList);
}
private static void b(j1.a aVar, SparseArray sparseArray, boolean z, int i, byte[] bArr) {
b a2 = a(((j1.b) b1.a(aVar.e(1952868452))).b, sparseArray, z);
if (a2 == null) {
return;
}
no noVar = a2.b;
long j = noVar.r;
boolean z2 = noVar.s;
a2.g();
a2.l = true;
j1.b e = aVar.e(1952867444);
if (e != null && (i & 2) == 0) {
noVar.r = c(e.b);
noVar.s = true;
} else {
noVar.r = j;
noVar.s = z2;
}
a(aVar, a2, i);
mo a3 = a2.d.a.a(((l6) b1.a(noVar.a)).a);
j1.b e2 = aVar.e(1935763834);
if (e2 != null) {
a((mo) b1.a(a3), e2.b, noVar);
}
j1.b e3 = aVar.e(1935763823);
if (e3 != null) {
a(e3.b, noVar);
}
j1.b e4 = aVar.e(1936027235);
if (e4 != null) {
b(e4.b, noVar);
}
a(aVar, a3 != null ? a3.b : null, noVar);
int size = aVar.c.size();
for (int i2 = 0; i2 < size; i2++) {
j1.b bVar = (j1.b) aVar.c.get(i2);
if (bVar.a == 1970628964) {
a(bVar.b, noVar, bArr);
}
}
}
private void b(long j) {
while (!this.m.isEmpty() && ((j1.a) this.m.peek()).b == j) {
a((j1.a) this.m.pop());
}
b();
}
private boolean b(l8 l8Var) {
if (this.s == 0) {
if (!l8Var.a(this.l.c(), 0, 8, true)) {
return false;
}
this.s = 8;
this.l.f(0);
this.r = this.l.y();
this.q = this.l.j();
}
long j = this.r;
if (j == 1) {
l8Var.d(this.l.c(), 8, 8);
this.s += 8;
this.r = this.l.B();
} else if (j == 0) {
long a2 = l8Var.a();
if (a2 == -1 && !this.m.isEmpty()) {
a2 = ((j1.a) this.m.peek()).b;
}
if (a2 != -1) {
this.r = (a2 - l8Var.f()) + this.s;
}
}
if (this.r >= this.s) {
long f = l8Var.f() - this.s;
int i = this.q;
if ((i == 1836019558 || i == 1835295092) && !this.H) {
this.E.a(new ij.b(this.x, f));
this.H = true;
}
if (this.q == 1836019558) {
int size = this.d.size();
for (int i2 = 0; i2 < size; i2++) {
no noVar = ((b) this.d.valueAt(i2)).b;
noVar.b = f;
noVar.d = f;
noVar.c = f;
}
}
int i3 = this.q;
if (i3 == 1835295092) {
this.z = null;
this.u = f + this.r;
this.p = 2;
return true;
}
if (b(i3)) {
long f2 = (l8Var.f() + this.r) - 8;
this.m.push(new j1.a(this.q, f2));
if (this.r == this.s) {
b(f2);
} else {
b();
}
} else if (c(this.q)) {
if (this.s != 8) {
throw dh.a("Leaf atom defines extended atom size (unsupported).");
}
long j2 = this.r;
if (j2 <= 2147483647L) {
bh bhVar = new bh((int) j2);
System.arraycopy(this.l.c(), 0, bhVar.c(), 0, 8);
this.t = bhVar;
this.p = 1;
} else {
throw dh.a("Leaf atom with length > 2147483647 (unsupported).");
}
} else {
if (this.r > 2147483647L) {
throw dh.a("Skipping atom with length > 2147483647 (unsupported).");
}
this.t = null;
this.p = 1;
}
return true;
}
throw dh.a("Atom size less than header length (unsupported).");
}
private static b a(SparseArray sparseArray) {
int size = sparseArray.size();
b bVar = null;
long j = Long.MAX_VALUE;
for (int i = 0; i < size; i++) {
b bVar2 = (b) sparseArray.valueAt(i);
if ((bVar2.l || bVar2.f != bVar2.d.b) && (!bVar2.l || bVar2.h != bVar2.b.e)) {
long b2 = bVar2.b();
if (b2 < j) {
bVar = bVar2;
j = b2;
}
}
}
return bVar;
}
@Override // com.applovin.impl.k8
public void a(m8 m8Var) {
this.E = m8Var;
b();
c();
lo loVar = this.b;
if (loVar != null) {
this.d.put(0, new b(m8Var.a(0, loVar.b), new ro(this.b, new long[0], new int[0], 0, new long[0], new int[0], 0L), new l6(0, 0, 0, 0)));
this.E.c();
}
}
private void a(j1.a aVar) {
int i = aVar.a;
if (i == 1836019574) {
c(aVar);
} else if (i == 1836019558) {
b(aVar);
} else {
if (this.m.isEmpty()) {
return;
}
((j1.a) this.m.peek()).a(aVar);
}
}
private void a(bh bhVar) {
long c;
String str;
long c2;
String str2;
long y;
long j;
if (this.F.length == 0) {
return;
}
bhVar.f(8);
int c3 = j1.c(bhVar.j());
if (c3 != 0) {
if (c3 != 1) {
pc.d("FragmentedMp4Extractor", "Skipping unsupported emsg version: " + c3);
return;
}
long y2 = bhVar.y();
j = xp.c(bhVar.B(), 1000000L, y2);
long c4 = xp.c(bhVar.y(), 1000L, y2);
long y3 = bhVar.y();
str = (String) b1.a((Object) bhVar.t());
c2 = c4;
y = y3;
str2 = (String) b1.a((Object) bhVar.t());
c = -9223372036854775807L;
} else {
String str3 = (String) b1.a((Object) bhVar.t());
String str4 = (String) b1.a((Object) bhVar.t());
long y4 = bhVar.y();
c = xp.c(bhVar.y(), 1000000L, y4);
long j2 = this.y;
long j3 = j2 != C.TIME_UNSET ? j2 + c : -9223372036854775807L;
str = str3;
c2 = xp.c(bhVar.y(), 1000L, y4);
str2 = str4;
y = bhVar.y();
j = j3;
}
byte[] bArr = new byte[bhVar.a()];
bhVar.a(bArr, 0, bhVar.a());
bh bhVar2 = new bh(this.k.a(new w7(str, str2, c2, y, bArr)));
int a2 = bhVar2.a();
for (qo qoVar : this.F) {
bhVar2.f(0);
qoVar.a(bhVar2, a2);
}
if (j == C.TIME_UNSET) {
this.n.addLast(new a(c, a2));
this.v += a2;
return;
}
ho hoVar = this.j;
if (hoVar != null) {
j = hoVar.a(j);
}
for (qo qoVar2 : this.F) {
qoVar2.a(j, 1, a2, 0, null);
}
}
private void a(j1.b bVar, long j) {
if (!this.m.isEmpty()) {
((j1.a) this.m.peek()).a(bVar);
return;
}
int i = bVar.a;
if (i != 1936286840) {
if (i == 1701671783) {
a(bVar.b);
}
} else {
Pair a2 = a(bVar.b, j);
this.y = ((Long) a2.first).longValue();
this.E.a((ij) a2.second);
this.H = true;
}
}
private void a(long j) {
while (!this.n.isEmpty()) {
a aVar = (a) this.n.removeFirst();
this.v -= aVar.b;
long j2 = aVar.a + j;
ho hoVar = this.j;
if (hoVar != null) {
j2 = hoVar.a(j2);
}
for (qo qoVar : this.F) {
qoVar.a(j2, 1, aVar.b, this.v, null);
}
}
}
private static void a(j1.a aVar, SparseArray sparseArray, boolean z, int i, byte[] bArr) {
int size = aVar.d.size();
for (int i2 = 0; i2 < size; i2++) {
j1.a aVar2 = (j1.a) aVar.d.get(i2);
if (aVar2.a == 1953653094) {
b(aVar2, sparseArray, z, i, bArr);
}
}
}
private static void a(bh bhVar, no noVar) {
bhVar.f(8);
int j = bhVar.j();
if ((j1.b(j) & 1) == 1) {
bhVar.g(8);
}
int A = bhVar.A();
if (A == 1) {
noVar.d += j1.c(j) == 0 ? bhVar.y() : bhVar.B();
} else {
throw dh.a("Unexpected saio entry count: " + A, null);
}
}
private static void a(mo moVar, bh bhVar, no noVar) {
int i;
int i2 = moVar.d;
bhVar.f(8);
if ((j1.b(bhVar.j()) & 1) == 1) {
bhVar.g(8);
}
int w = bhVar.w();
int A = bhVar.A();
if (A <= noVar.f) {
if (w == 0) {
boolean[] zArr = noVar.n;
i = 0;
for (int i3 = 0; i3 < A; i3++) {
int w2 = bhVar.w();
i += w2;
zArr[i3] = w2 > i2;
}
} else {
i = w * A;
Arrays.fill(noVar.n, 0, A, w > i2);
}
Arrays.fill(noVar.n, A, noVar.f, false);
if (i > 0) {
noVar.b(i);
return;
}
return;
}
throw dh.a("Saiz sample count " + A + " is greater than fragment sample count" + noVar.f, null);
}
private static void a(j1.a aVar, String str, no noVar) {
byte[] bArr = null;
bh bhVar = null;
bh bhVar2 = null;
for (int i = 0; i < aVar.c.size(); i++) {
j1.b bVar = (j1.b) aVar.c.get(i);
bh bhVar3 = bVar.b;
int i2 = bVar.a;
if (i2 == 1935828848) {
bhVar3.f(12);
if (bhVar3.j() == 1936025959) {
bhVar = bhVar3;
}
} else if (i2 == 1936158820) {
bhVar3.f(12);
if (bhVar3.j() == 1936025959) {
bhVar2 = bhVar3;
}
}
}
if (bhVar == null || bhVar2 == null) {
return;
}
bhVar.f(8);
int c = j1.c(bhVar.j());
bhVar.g(4);
if (c == 1) {
bhVar.g(4);
}
if (bhVar.j() == 1) {
bhVar2.f(8);
int c2 = j1.c(bhVar2.j());
bhVar2.g(4);
if (c2 == 1) {
if (bhVar2.y() == 0) {
throw dh.a("Variable length description in sgpd found (unsupported)");
}
} else if (c2 >= 2) {
bhVar2.g(4);
}
if (bhVar2.y() == 1) {
bhVar2.g(1);
int w = bhVar2.w();
int i3 = (w & PsExtractor.VIDEO_STREAM_MASK) >> 4;
int i4 = w & 15;
boolean z = bhVar2.w() == 1;
if (z) {
int w2 = bhVar2.w();
byte[] bArr2 = new byte[16];
bhVar2.a(bArr2, 0, 16);
if (w2 == 0) {
int w3 = bhVar2.w();
bArr = new byte[w3];
bhVar2.a(bArr, 0, w3);
}
noVar.m = true;
noVar.o = new mo(z, str, w2, bArr2, i3, i4, bArr);
return;
}
return;
}
throw dh.a("Entry count in sgpd != 1 (unsupported).");
}
throw dh.a("Entry count in sbgp != 1 (unsupported).");
}
private static void a(bh bhVar, int i, no noVar) {
bhVar.f(i + 8);
int b2 = j1.b(bhVar.j());
if ((b2 & 1) == 0) {
boolean z = (b2 & 2) != 0;
int A = bhVar.A();
if (A == 0) {
Arrays.fill(noVar.n, 0, noVar.f, false);
return;
}
if (A == noVar.f) {
Arrays.fill(noVar.n, 0, A, z);
noVar.b(bhVar.a());
noVar.a(bhVar);
return;
} else {
throw dh.a("Senc sample count " + A + " is different from fragment sample count" + noVar.f, null);
}
}
throw dh.a("Overriding TrackEncryptionBox parameters is unsupported.");
}
private static Pair a(bh bhVar, long j) {
long B;
long B2;
bhVar.f(8);
int c = j1.c(bhVar.j());
bhVar.g(4);
long y = bhVar.y();
if (c == 0) {
B = bhVar.y();
B2 = bhVar.y();
} else {
B = bhVar.B();
B2 = bhVar.B();
}
long j2 = B;
long j3 = j + B2;
long c2 = xp.c(j2, 1000000L, y);
bhVar.g(2);
int C = bhVar.C();
int[] iArr = new int[C];
long[] jArr = new long[C];
long[] jArr2 = new long[C];
long[] jArr3 = new long[C];
long j4 = c2;
int i = 0;
long j5 = j2;
while (i < C) {
int j6 = bhVar.j();
if ((j6 & Integer.MIN_VALUE) == 0) {
long y2 = bhVar.y();
iArr[i] = j6 & Integer.MAX_VALUE;
jArr[i] = j3;
jArr3[i] = j4;
long j7 = j5 + y2;
long[] jArr4 = jArr2;
long[] jArr5 = jArr3;
int i2 = C;
long c3 = xp.c(j7, 1000000L, y);
jArr4[i] = c3 - jArr5[i];
bhVar.g(4);
j3 += r1[i];
i++;
iArr = iArr;
jArr3 = jArr5;
jArr2 = jArr4;
jArr = jArr;
C = i2;
j5 = j7;
j4 = c3;
} else {
throw dh.a("Unhandled indirect reference", null);
}
}
return Pair.create(Long.valueOf(c2), new g3(iArr, jArr, jArr2, jArr3));
}
private static b a(bh bhVar, SparseArray sparseArray, boolean z) {
int i;
int i2;
int i3;
int i4;
bhVar.f(8);
int b2 = j1.b(bhVar.j());
b bVar = (b) (z ? sparseArray.valueAt(0) : sparseArray.get(bhVar.j()));
if (bVar == null) {
return null;
}
if ((b2 & 1) != 0) {
long B = bhVar.B();
no noVar = bVar.b;
noVar.c = B;
noVar.d = B;
}
l6 l6Var = bVar.e;
if ((b2 & 2) != 0) {
i = bhVar.j() - 1;
} else {
i = l6Var.a;
}
if ((b2 & 8) != 0) {
i2 = bhVar.j();
} else {
i2 = l6Var.b;
}
if ((b2 & 16) != 0) {
i3 = bhVar.j();
} else {
i3 = l6Var.c;
}
if ((b2 & 32) != 0) {
i4 = bhVar.j();
} else {
i4 = l6Var.d;
}
bVar.b.a = new l6(i, i2, i3, i4);
return bVar;
}
/* JADX WARN: Removed duplicated region for block: B:36:0x00bd */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
private static int a(com.applovin.impl.j9.b r36, int r37, int r38, com.applovin.impl.bh r39, int r40) {
/*
Method dump skipped, instructions count: 356
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: com.applovin.impl.j9.a(com.applovin.impl.j9$b, int, int, com.applovin.impl.bh, int):int");
}
private static void a(j1.a aVar, b bVar, int i) {
List list = aVar.c;
int size = list.size();
int i2 = 0;
int i3 = 0;
for (int i4 = 0; i4 < size; i4++) {
j1.b bVar2 = (j1.b) list.get(i4);
if (bVar2.a == 1953658222) {
bh bhVar = bVar2.b;
bhVar.f(12);
int A = bhVar.A();
if (A > 0) {
i3 += A;
i2++;
}
}
}
bVar.h = 0;
bVar.g = 0;
bVar.f = 0;
bVar.b.a(i2, i3);
int i5 = 0;
int i6 = 0;
for (int i7 = 0; i7 < size; i7++) {
j1.b bVar3 = (j1.b) list.get(i7);
if (bVar3.a == 1953658222) {
i6 = a(bVar, i5, i, bVar3.b, i6);
i5++;
}
}
}
private static void a(bh bhVar, no noVar, byte[] bArr) {
bhVar.f(8);
bhVar.a(bArr, 0, 16);
if (Arrays.equals(bArr, J)) {
a(bhVar, 16, noVar);
}
}
@Override // com.applovin.impl.k8
public int a(l8 l8Var, th thVar) {
while (true) {
int i = this.p;
if (i != 0) {
if (i == 1) {
c(l8Var);
} else if (i != 2) {
if (e(l8Var)) {
return 0;
}
} else {
d(l8Var);
}
} else if (!b(l8Var)) {
return -1;
}
}
}
@Override // com.applovin.impl.k8
public void a(long j, long j2) {
int size = this.d.size();
for (int i = 0; i < size; i++) {
((b) this.d.valueAt(i)).g();
}
this.n.clear();
this.v = 0;
this.w = j2;
this.m.clear();
b();
}
@Override // com.applovin.impl.k8
public boolean a(l8 l8Var) {
return lk.a(l8Var);
}
}