discord-jadx/app/src/main/java/c/i/a/c/a2/j0/m.java

283 lines
11 KiB
Java

package c.i.a.c.a2.j0;
import androidx.annotation.Nullable;
import c.i.a.c.a2.j;
import c.i.a.c.a2.j0.i0;
import c.i.a.c.i2.v;
import c.i.a.c.i2.w;
import com.airbnb.lottie.parser.AnimatableValueParser;
import com.google.android.exoplayer2.Format;
import java.util.Arrays;
/* compiled from: DtsReader */
public final class m implements o {
public final w a = new w(new byte[18]);
@Nullable
public final String b;
/* renamed from: c reason: collision with root package name */
public String f726c;
public c.i.a.c.a2.w d;
public int e = 0;
public int f;
public int g;
public long h;
public Format i;
public int j;
public long k;
public m(@Nullable String str) {
this.b = str;
}
/* JADX WARNING: Removed duplicated region for block: B:65:0x0217 */
/* JADX WARNING: Removed duplicated region for block: B:68:0x0225 */
/* JADX WARNING: Removed duplicated region for block: B:76:0x024d */
@Override // c.i.a.c.a2.j0.o
public void b(w wVar) {
boolean z2;
int i;
byte b;
int i2;
int i3;
byte b2;
byte b3;
int i4;
byte b4;
int i5;
byte b5;
int i6;
v vVar;
int i7;
int i8;
boolean z3;
boolean z4;
AnimatableValueParser.H(this.d);
while (wVar.a() > 0) {
int i9 = this.e;
int i10 = 8;
int i11 = 2;
if (i9 == 0) {
while (true) {
if (wVar.a() <= 0) {
z3 = false;
break;
}
int i12 = this.g << 8;
this.g = i12;
int s2 = i12 | wVar.s();
this.g = s2;
if (s2 == 2147385345 || s2 == -25230976 || s2 == 536864768 || s2 == -14745368) {
z4 = true;
continue;
} else {
z4 = false;
continue;
}
if (z4) {
byte[] bArr = this.a.a;
bArr[0] = (byte) ((s2 >> 24) & 255);
bArr[1] = (byte) ((s2 >> 16) & 255);
bArr[2] = (byte) ((s2 >> 8) & 255);
bArr[3] = (byte) (s2 & 255);
this.f = 4;
this.g = 0;
z3 = true;
break;
}
}
if (z3) {
this.e = 1;
}
} else if (i9 == 1) {
byte[] bArr2 = this.a.a;
int min = Math.min(wVar.a(), 18 - this.f);
System.arraycopy(wVar.a, wVar.b, bArr2, this.f, min);
wVar.b += min;
int i13 = this.f + min;
this.f = i13;
if (i13 == 18) {
byte[] bArr3 = this.a.a;
if (this.i == null) {
String str = this.f726c;
String str2 = this.b;
if (bArr3[0] == Byte.MAX_VALUE) {
vVar = new v(bArr3);
} else {
byte[] copyOf = Arrays.copyOf(bArr3, bArr3.length);
if (copyOf[0] == -2 || copyOf[0] == -1) {
for (int i14 = 0; i14 < copyOf.length - 1; i14 += 2) {
byte b6 = copyOf[i14];
int i15 = i14 + 1;
copyOf[i14] = copyOf[i15];
copyOf[i15] = b6;
}
}
v vVar2 = new v(copyOf);
if (copyOf[0] == 31) {
v vVar3 = new v(copyOf);
while (vVar3.b() >= 16) {
vVar3.m(i11);
int g = vVar3.g(14) & 16383;
int min2 = Math.min(8 - vVar2.f907c, 14);
int i16 = vVar2.f907c;
int i17 = (8 - i16) - min2;
byte[] bArr4 = vVar2.a;
int i18 = vVar2.b;
bArr4[i18] = (byte) (((65280 >> i16) | ((1 << i17) - 1)) & bArr4[i18]);
int i19 = 14 - min2;
bArr4[i18] = (byte) (((g >>> i19) << i17) | bArr4[i18]);
int i20 = i18 + 1;
while (i19 > i10) {
i19 -= 8;
vVar2.a[i20] = (byte) (g >>> i19);
i20++;
i10 = 8;
}
int i21 = 8 - i19;
byte[] bArr5 = vVar2.a;
bArr5[i20] = (byte) (bArr5[i20] & ((1 << i21) - 1));
bArr5[i20] = (byte) (((((1 << i19) - 1) & g) << i21) | bArr5[i20]);
vVar2.m(14);
vVar2.a();
i10 = 8;
i11 = 2;
}
}
int length = copyOf.length;
vVar2.a = copyOf;
vVar2.b = 0;
vVar2.f907c = 0;
vVar2.d = length;
vVar = vVar2;
}
vVar.m(60);
int i22 = c.i.a.c.v1.w.a[vVar.g(6)];
int i23 = c.i.a.c.v1.w.b[vVar.g(4)];
int g2 = vVar.g(5);
int[] iArr = c.i.a.c.v1.w.f999c;
if (g2 >= iArr.length) {
i8 = -1;
i7 = 2;
} else {
i7 = 2;
i8 = (iArr[g2] * 1000) / 2;
}
vVar.m(10);
int i24 = i22 + (vVar.g(i7) > 0 ? 1 : 0);
Format.b bVar = new Format.b();
bVar.a = str;
bVar.k = "audio/vnd.dts";
bVar.f = i8;
bVar.f2199x = i24;
bVar.f2200y = i23;
bVar.n = null;
bVar.f2197c = str2;
Format a = bVar.a();
this.i = a;
this.d.e(a);
}
byte b7 = bArr3[0];
if (b7 != -2) {
if (b7 == -1) {
i6 = ((3 & bArr3[7]) << 12) | ((bArr3[6] & 255) << 4);
b5 = bArr3[9];
} else if (b7 != 31) {
i4 = 4;
i5 = ((3 & bArr3[5]) << 12) | ((bArr3[6] & 255) << 4);
b4 = bArr3[7];
} else {
i6 = ((3 & bArr3[6]) << 12) | ((bArr3[7] & 255) << 4);
b5 = bArr3[8];
}
i = (i6 | ((b5 & 60) >> 2)) + 1;
z2 = true;
if (z2) {
i = (i * 16) / 14;
}
this.j = i;
b = bArr3[0];
if (b == -2) {
if (b == -1) {
b3 = bArr3[7];
i2 = (bArr3[4] & 7) << 4;
} else if (b != 31) {
i2 = (bArr3[4] & 1) << 6;
b2 = bArr3[5];
} else {
i2 = (7 & bArr3[5]) << 4;
b3 = bArr3[6];
}
i3 = b3 & 60;
this.h = (long) ((int) ((((long) ((((i3 >> 2) | i2) + 1) * 32)) * 1000000) / ((long) this.i.H)));
this.a.D(0);
this.d.c(this.a, 18);
this.e = 2;
} else {
i2 = (bArr3[5] & 1) << 6;
b2 = bArr3[4];
}
i3 = b2 & 252;
this.h = (long) ((int) ((((long) ((((i3 >> 2) | i2) + 1) * 32)) * 1000000) / ((long) this.i.H)));
this.a.D(0);
this.d.c(this.a, 18);
this.e = 2;
} else {
i4 = 4;
i5 = ((bArr3[4] & 3) << 12) | ((bArr3[7] & 255) << 4);
b4 = bArr3[6];
}
i = (i5 | ((b4 & 240) >> i4)) + 1;
z2 = false;
if (z2) {
}
this.j = i;
b = bArr3[0];
if (b == -2) {
}
i3 = b2 & 252;
this.h = (long) ((int) ((((long) ((((i3 >> 2) | i2) + 1) * 32)) * 1000000) / ((long) this.i.H)));
this.a.D(0);
this.d.c(this.a, 18);
this.e = 2;
}
} else if (i9 == 2) {
int min3 = Math.min(wVar.a(), this.j - this.f);
this.d.c(wVar, min3);
int i25 = this.f + min3;
this.f = i25;
int i26 = this.j;
if (i25 == i26) {
this.d.d(this.k, 1, i26, 0, null);
this.k += this.h;
this.e = 0;
}
} else {
throw new IllegalStateException();
}
}
}
@Override // c.i.a.c.a2.j0.o
public void c() {
this.e = 0;
this.f = 0;
this.g = 0;
}
@Override // c.i.a.c.a2.j0.o
public void d() {
}
@Override // c.i.a.c.a2.j0.o
public void e(j jVar, i0.d dVar) {
dVar.a();
this.f726c = dVar.b();
this.d = jVar.p(dVar.c(), 1);
}
@Override // c.i.a.c.a2.j0.o
public void f(long j, int i) {
this.k = j;
}
}