- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
143 lines
3.6 KiB
Java
143 lines
3.6 KiB
Java
package com.applovin.impl;
|
|
|
|
import com.mbridge.msdk.playercommon.exoplayer2.C;
|
|
|
|
/* loaded from: classes.dex */
|
|
final class hi {
|
|
private boolean c;
|
|
private boolean d;
|
|
private boolean e;
|
|
private final ho a = new ho(0);
|
|
private long f = C.TIME_UNSET;
|
|
private long g = C.TIME_UNSET;
|
|
private long h = C.TIME_UNSET;
|
|
private final bh b = new bh();
|
|
|
|
public long a() {
|
|
return this.h;
|
|
}
|
|
|
|
public ho b() {
|
|
return this.a;
|
|
}
|
|
|
|
public boolean c() {
|
|
return this.c;
|
|
}
|
|
|
|
private int b(l8 l8Var, th thVar) {
|
|
int min = (int) Math.min(20000L, l8Var.a());
|
|
long j = 0;
|
|
if (l8Var.f() != j) {
|
|
thVar.a = j;
|
|
return 1;
|
|
}
|
|
this.b.d(min);
|
|
l8Var.b();
|
|
l8Var.c(this.b.c(), 0, min);
|
|
this.f = a(this.b);
|
|
this.d = true;
|
|
return 0;
|
|
}
|
|
|
|
private static boolean a(byte[] bArr) {
|
|
return (bArr[0] & 196) == 68 && (bArr[2] & 4) == 4 && (bArr[4] & 4) == 4 && (bArr[5] & 1) == 1 && (bArr[8] & 3) == 3;
|
|
}
|
|
|
|
private int c(l8 l8Var, th thVar) {
|
|
long a = l8Var.a();
|
|
int min = (int) Math.min(20000L, a);
|
|
long j = a - min;
|
|
if (l8Var.f() != j) {
|
|
thVar.a = j;
|
|
return 1;
|
|
}
|
|
this.b.d(min);
|
|
l8Var.b();
|
|
l8Var.c(this.b.c(), 0, min);
|
|
this.g = b(this.b);
|
|
this.e = true;
|
|
return 0;
|
|
}
|
|
|
|
private int a(l8 l8Var) {
|
|
this.b.a(xp.f);
|
|
this.c = true;
|
|
l8Var.b();
|
|
return 0;
|
|
}
|
|
|
|
public static long c(bh bhVar) {
|
|
int d = bhVar.d();
|
|
if (bhVar.a() < 9) {
|
|
return C.TIME_UNSET;
|
|
}
|
|
byte[] bArr = new byte[9];
|
|
bhVar.a(bArr, 0, 9);
|
|
bhVar.f(d);
|
|
return !a(bArr) ? C.TIME_UNSET : b(bArr);
|
|
}
|
|
|
|
private long b(bh bhVar) {
|
|
int d = bhVar.d();
|
|
for (int e = bhVar.e() - 4; e >= d; e--) {
|
|
if (a(bhVar.c(), e) == 442) {
|
|
bhVar.f(e + 4);
|
|
long c = c(bhVar);
|
|
if (c != C.TIME_UNSET) {
|
|
return c;
|
|
}
|
|
}
|
|
}
|
|
return C.TIME_UNSET;
|
|
}
|
|
|
|
private static long b(byte[] bArr) {
|
|
long j = bArr[0];
|
|
long j2 = ((j & 3) << 28) | (((56 & j) >> 3) << 30) | ((bArr[1] & 255) << 20);
|
|
long j3 = bArr[2];
|
|
return j2 | (((j3 & 248) >> 3) << 15) | ((j3 & 3) << 13) | ((bArr[3] & 255) << 5) | ((bArr[4] & 248) >> 3);
|
|
}
|
|
|
|
private int a(byte[] bArr, int i) {
|
|
return (bArr[i + 3] & 255) | ((bArr[i] & 255) << 24) | ((bArr[i + 1] & 255) << 16) | ((bArr[i + 2] & 255) << 8);
|
|
}
|
|
|
|
public int a(l8 l8Var, th thVar) {
|
|
if (!this.e) {
|
|
return c(l8Var, thVar);
|
|
}
|
|
if (this.g == C.TIME_UNSET) {
|
|
return a(l8Var);
|
|
}
|
|
if (!this.d) {
|
|
return b(l8Var, thVar);
|
|
}
|
|
long j = this.f;
|
|
if (j == C.TIME_UNSET) {
|
|
return a(l8Var);
|
|
}
|
|
long b = this.a.b(this.g) - this.a.b(j);
|
|
this.h = b;
|
|
if (b < 0) {
|
|
pc.d("PsDurationReader", "Invalid duration: " + this.h + ". Using TIME_UNSET instead.");
|
|
this.h = C.TIME_UNSET;
|
|
}
|
|
return a(l8Var);
|
|
}
|
|
|
|
private long a(bh bhVar) {
|
|
int e = bhVar.e();
|
|
for (int d = bhVar.d(); d < e - 3; d++) {
|
|
if (a(bhVar.c(), d) == 442) {
|
|
bhVar.f(d + 4);
|
|
long c = c(bhVar);
|
|
if (c != C.TIME_UNSET) {
|
|
return c;
|
|
}
|
|
}
|
|
}
|
|
return C.TIME_UNSET;
|
|
}
|
|
}
|