discord-jadx/app/src/main/java/c/i/a/c/a2/i0/f.java

123 lines
3.4 KiB
Java

package c.i.a.c.a2.i0;
import c.i.a.c.a2.i;
import c.i.a.c.i2.w;
import com.airbnb.lottie.parser.AnimatableValueParser;
import com.google.android.exoplayer2.ParserException;
import java.io.EOFException;
import java.io.IOException;
/* compiled from: OggPageHeader */
public final class f {
public int a;
public int b;
/* renamed from: c reason: collision with root package name */
public long f710c;
public int d;
public int e;
public int f;
public final int[] g = new int[255];
public final w h = new w(255);
public boolean a(i iVar, boolean z2) throws IOException {
boolean z3;
b();
this.h.z(27);
try {
z3 = iVar.e(this.h.a, 0, 27, z2);
} catch (EOFException e) {
if (z2) {
z3 = false;
} else {
throw e;
}
}
if (!z3 || this.h.t() != 1332176723) {
return false;
}
int s2 = this.h.s();
this.a = s2;
if (s2 == 0) {
this.b = this.h.s();
w wVar = this.h;
byte[] bArr = wVar.a;
int i = wVar.b;
int i2 = i + 1;
wVar.b = i2;
int i3 = i2 + 1;
wVar.b = i3;
int i4 = i3 + 1;
wVar.b = i4;
int i5 = i4 + 1;
wVar.b = i5;
int i6 = i5 + 1;
wVar.b = i6;
int i7 = i6 + 1;
wVar.b = i7;
int i8 = i7 + 1;
wVar.b = i8;
wVar.b = i8 + 1;
this.f710c = ((((long) bArr[i8]) & 255) << 56) | (((long) bArr[i]) & 255) | ((((long) bArr[i2]) & 255) << 8) | ((((long) bArr[i3]) & 255) << 16) | ((((long) bArr[i4]) & 255) << 24) | ((((long) bArr[i5]) & 255) << 32) | ((((long) bArr[i6]) & 255) << 40) | ((((long) bArr[i7]) & 255) << 48);
wVar.j();
this.h.j();
this.h.j();
int s3 = this.h.s();
this.d = s3;
this.e = s3 + 27;
this.h.z(s3);
iVar.n(this.h.a, 0, this.d);
for (int i9 = 0; i9 < this.d; i9++) {
this.g[i9] = this.h.s();
this.f += this.g[i9];
}
return true;
} else if (z2) {
return false;
} else {
throw new ParserException("unsupported bit stream revision");
}
}
public void b() {
this.a = 0;
this.b = 0;
this.f710c = 0;
this.d = 0;
this.e = 0;
this.f = 0;
}
public boolean c(i iVar, long j) throws IOException {
int i;
boolean z2;
AnimatableValueParser.k(iVar.getPosition() == iVar.f());
this.h.z(4);
while (true) {
i = (j > -1 ? 1 : (j == -1 ? 0 : -1));
if (i != 0 && iVar.getPosition() + 4 >= j) {
break;
}
try {
z2 = iVar.e(this.h.a, 0, 4, true);
} catch (EOFException unused) {
z2 = false;
}
if (!z2) {
break;
}
this.h.D(0);
if (this.h.t() == 1332176723) {
iVar.k();
return true;
}
iVar.l(1);
}
do {
if (i != 0 && iVar.getPosition() >= j) {
break;
}
} while (iVar.h(1) != -1);
return false;
}
}