345 lines
12 KiB
Java
345 lines
12 KiB
Java
package c.i.a.c.a2.k0;
|
|
|
|
import android.util.Log;
|
|
import android.util.Pair;
|
|
import c.c.a.a0.d;
|
|
import c.i.a.c.a2.h;
|
|
import c.i.a.c.a2.i;
|
|
import c.i.a.c.a2.j;
|
|
import c.i.a.c.a2.s;
|
|
import c.i.a.c.a2.w;
|
|
import c.i.a.c.i2.f0;
|
|
import com.google.android.exoplayer2.Format;
|
|
import com.google.android.exoplayer2.ParserException;
|
|
import java.io.IOException;
|
|
import java.util.Objects;
|
|
/* compiled from: WavExtractor */
|
|
public final class b implements h {
|
|
public j a;
|
|
public w b;
|
|
|
|
/* renamed from: c reason: collision with root package name */
|
|
public AbstractC0089b f799c;
|
|
public int d = -1;
|
|
public long e = -1;
|
|
|
|
/* compiled from: WavExtractor */
|
|
public static final class a implements AbstractC0089b {
|
|
public static final int[] a = {-1, -1, -1, -1, 2, 4, 6, 8, -1, -1, -1, -1, 2, 4, 6, 8};
|
|
public static final int[] b = {7, 8, 9, 10, 11, 12, 13, 14, 16, 17, 19, 21, 23, 25, 28, 31, 34, 37, 41, 45, 50, 55, 60, 66, 73, 80, 88, 97, 107, 118, 130, 143, 157, 173, 190, 209, 230, 253, 279, 307, 337, 371, 408, 449, 494, 544, 598, 658, 724, 796, 876, 963, 1060, 1166, 1282, 1411, 1552, 1707, 1878, 2066, 2272, 2499, 2749, 3024, 3327, 3660, 4026, 4428, 4871, 5358, 5894, 6484, 7132, 7845, 8630, 9493, 10442, 11487, 12635, 13899, 15289, 16818, 18500, 20350, 22385, 24623, 27086, 29794, 32767};
|
|
|
|
/* renamed from: c reason: collision with root package name */
|
|
public final j f800c;
|
|
public final w d;
|
|
public final c e;
|
|
public final int f;
|
|
public final byte[] g;
|
|
public final c.i.a.c.i2.w h;
|
|
public final int i;
|
|
public final Format j;
|
|
public int k;
|
|
public long l;
|
|
public int m;
|
|
public long n;
|
|
|
|
public a(j jVar, w wVar, c cVar) throws ParserException {
|
|
this.f800c = jVar;
|
|
this.d = wVar;
|
|
this.e = cVar;
|
|
int max = Math.max(1, cVar.f802c / 10);
|
|
this.i = max;
|
|
byte[] bArr = cVar.f;
|
|
int length = bArr.length;
|
|
byte b2 = bArr[0];
|
|
byte b3 = bArr[1];
|
|
int i = ((bArr[3] & 255) << 8) | (bArr[2] & 255);
|
|
this.f = i;
|
|
int i2 = cVar.b;
|
|
int i3 = (((cVar.d - (i2 * 4)) * 8) / (cVar.e * i2)) + 1;
|
|
if (i == i3) {
|
|
int f = f0.f(max, i);
|
|
this.g = new byte[(cVar.d * f)];
|
|
this.h = new c.i.a.c.i2.w(i * 2 * i2 * f);
|
|
int i4 = cVar.f802c;
|
|
int i5 = ((cVar.d * i4) * 8) / i;
|
|
Format.b bVar = new Format.b();
|
|
bVar.k = "audio/raw";
|
|
bVar.f = i5;
|
|
bVar.g = i5;
|
|
bVar.l = max * 2 * i2;
|
|
bVar.f2702x = cVar.b;
|
|
bVar.f2703y = i4;
|
|
bVar.f2704z = 2;
|
|
this.j = bVar.a();
|
|
return;
|
|
}
|
|
throw new ParserException(c.d.b.a.a.o("Expected frames per block: ", i3, "; got: ", i));
|
|
}
|
|
|
|
@Override // c.i.a.c.a2.k0.b.AbstractC0089b
|
|
public void a(long j) {
|
|
this.k = 0;
|
|
this.l = j;
|
|
this.m = 0;
|
|
this.n = 0;
|
|
}
|
|
|
|
@Override // c.i.a.c.a2.k0.b.AbstractC0089b
|
|
public void b(int i, long j) {
|
|
this.f800c.a(new e(this.e, this.f, (long) i, j));
|
|
this.d.e(this.j);
|
|
}
|
|
|
|
/* JADX ERROR: JadxOverflowException in pass: RegionMakerVisitor
|
|
jadx.core.utils.exceptions.JadxOverflowException: Regions count limit reached
|
|
at jadx.core.utils.ErrorsCounter.addError(ErrorsCounter.java:57)
|
|
at jadx.core.utils.ErrorsCounter.error(ErrorsCounter.java:31)
|
|
at jadx.core.dex.attributes.nodes.NotificationAttrNode.addError(NotificationAttrNode.java:15)
|
|
*/
|
|
/* JADX WARNING: Removed duplicated region for block: B:41:0x0049 A[ADDED_TO_REGION, EDGE_INSN: B:41:0x0049->B:12:0x0049 ?: BREAK , SYNTHETIC] */
|
|
/* JADX WARNING: Removed duplicated region for block: B:6:0x002b */
|
|
@Override // c.i.a.c.a2.k0.b.AbstractC0089b
|
|
public boolean c(c.i.a.c.a2.i r19, long r20) throws java.io.IOException {
|
|
/*
|
|
// Method dump skipped, instructions count: 364
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: c.i.a.c.a2.k0.b.a.c(c.i.a.c.a2.i, long):boolean");
|
|
}
|
|
|
|
public final int d(int i) {
|
|
return i / (this.e.b * 2);
|
|
}
|
|
|
|
public final void e(int i) {
|
|
long E = this.l + f0.E(this.n, 1000000, (long) this.e.f802c);
|
|
int i2 = i * 2 * this.e.b;
|
|
this.d.d(E, 1, i2, this.m - i2, null);
|
|
this.n += (long) i;
|
|
this.m -= i2;
|
|
}
|
|
}
|
|
|
|
/* compiled from: WavExtractor */
|
|
/* renamed from: c.i.a.c.a2.k0.b$b reason: collision with other inner class name */
|
|
public interface AbstractC0089b {
|
|
void a(long j);
|
|
|
|
void b(int i, long j) throws ParserException;
|
|
|
|
boolean c(i iVar, long j) throws IOException;
|
|
}
|
|
|
|
/* compiled from: WavExtractor */
|
|
public static final class c implements AbstractC0089b {
|
|
public final j a;
|
|
public final w b;
|
|
|
|
/* renamed from: c reason: collision with root package name */
|
|
public final c f801c;
|
|
public final Format d;
|
|
public final int e;
|
|
public long f;
|
|
public int g;
|
|
public long h;
|
|
|
|
public c(j jVar, w wVar, c cVar, String str, int i) throws ParserException {
|
|
this.a = jVar;
|
|
this.b = wVar;
|
|
this.f801c = cVar;
|
|
int i2 = (cVar.b * cVar.e) / 8;
|
|
if (cVar.d == i2) {
|
|
int i3 = cVar.f802c * i2;
|
|
int i4 = i3 * 8;
|
|
int max = Math.max(i2, i3 / 10);
|
|
this.e = max;
|
|
Format.b bVar = new Format.b();
|
|
bVar.k = str;
|
|
bVar.f = i4;
|
|
bVar.g = i4;
|
|
bVar.l = max;
|
|
bVar.f2702x = cVar.b;
|
|
bVar.f2703y = cVar.f802c;
|
|
bVar.f2704z = i;
|
|
this.d = bVar.a();
|
|
return;
|
|
}
|
|
StringBuilder P = c.d.b.a.a.P("Expected block size: ", i2, "; got: ");
|
|
P.append(cVar.d);
|
|
throw new ParserException(P.toString());
|
|
}
|
|
|
|
@Override // c.i.a.c.a2.k0.b.AbstractC0089b
|
|
public void a(long j) {
|
|
this.f = j;
|
|
this.g = 0;
|
|
this.h = 0;
|
|
}
|
|
|
|
@Override // c.i.a.c.a2.k0.b.AbstractC0089b
|
|
public void b(int i, long j) {
|
|
this.a.a(new e(this.f801c, 1, (long) i, j));
|
|
this.b.e(this.d);
|
|
}
|
|
|
|
@Override // c.i.a.c.a2.k0.b.AbstractC0089b
|
|
public boolean c(i iVar, long j) throws IOException {
|
|
int i;
|
|
int i2;
|
|
int i3;
|
|
long j2 = j;
|
|
while (true) {
|
|
i = (j2 > 0 ? 1 : (j2 == 0 ? 0 : -1));
|
|
if (i <= 0 || (i2 = this.g) >= (i3 = this.e)) {
|
|
break;
|
|
}
|
|
int b = this.b.b(iVar, (int) Math.min((long) (i3 - i2), j2), true);
|
|
if (b == -1) {
|
|
j2 = 0;
|
|
} else {
|
|
this.g += b;
|
|
j2 -= (long) b;
|
|
}
|
|
}
|
|
c cVar = this.f801c;
|
|
int i4 = cVar.d;
|
|
int i5 = this.g / i4;
|
|
if (i5 > 0) {
|
|
int i6 = i5 * i4;
|
|
int i7 = this.g - i6;
|
|
this.b.d(this.f + f0.E(this.h, 1000000, (long) cVar.f802c), 1, i6, i7, null);
|
|
this.h += (long) i5;
|
|
this.g = i7;
|
|
}
|
|
return i <= 0;
|
|
}
|
|
}
|
|
|
|
static {
|
|
a aVar = a.a;
|
|
}
|
|
|
|
@Override // c.i.a.c.a2.h
|
|
public boolean b(i iVar) throws IOException {
|
|
return d.x1(iVar) != null;
|
|
}
|
|
|
|
/* JADX WARNING: Removed duplicated region for block: B:27:0x006a */
|
|
/* JADX WARNING: Removed duplicated region for block: B:28:0x0079 */
|
|
@Override // c.i.a.c.a2.h
|
|
public int e(i iVar, s sVar) throws IOException {
|
|
int i;
|
|
int i2;
|
|
d.H(this.b);
|
|
int i3 = f0.a;
|
|
boolean z2 = true;
|
|
if (this.f799c == null) {
|
|
c x1 = d.x1(iVar);
|
|
if (x1 != null) {
|
|
int i4 = x1.a;
|
|
if (i4 == 17) {
|
|
this.f799c = new a(this.a, this.b, x1);
|
|
} else if (i4 == 6) {
|
|
this.f799c = new c(this.a, this.b, x1, "audio/g711-alaw", -1);
|
|
} else if (i4 == 7) {
|
|
this.f799c = new c(this.a, this.b, x1, "audio/g711-mlaw", -1);
|
|
} else {
|
|
int i5 = x1.e;
|
|
if (i4 != 1) {
|
|
if (i4 == 3) {
|
|
i2 = i5 == 32 ? 4 : 0;
|
|
i = i2;
|
|
if (i != 0) {
|
|
}
|
|
} else if (i4 != 65534) {
|
|
i = 0;
|
|
if (i != 0) {
|
|
this.f799c = new c(this.a, this.b, x1, "audio/raw", i);
|
|
} else {
|
|
StringBuilder O = c.d.b.a.a.O("Unsupported WAV format type: ");
|
|
O.append(x1.a);
|
|
throw new ParserException(O.toString());
|
|
}
|
|
}
|
|
}
|
|
i2 = f0.r(i5);
|
|
i = i2;
|
|
if (i != 0) {
|
|
}
|
|
}
|
|
} else {
|
|
throw new ParserException("Unsupported or unrecognized wav header.");
|
|
}
|
|
}
|
|
if (this.d == -1) {
|
|
Objects.requireNonNull(iVar);
|
|
iVar.k();
|
|
c.i.a.c.i2.w wVar = new c.i.a.c.i2.w(8);
|
|
d a2 = d.a(iVar, wVar);
|
|
while (true) {
|
|
int i6 = a2.a;
|
|
if (i6 != 1684108385) {
|
|
if (!(i6 == 1380533830 || i6 == 1718449184)) {
|
|
StringBuilder O2 = c.d.b.a.a.O("Ignoring unknown WAV chunk: ");
|
|
O2.append(a2.a);
|
|
Log.w("WavHeaderReader", O2.toString());
|
|
}
|
|
long j = a2.b + 8;
|
|
if (a2.a == 1380533830) {
|
|
j = 12;
|
|
}
|
|
if (j <= 2147483647L) {
|
|
iVar.l((int) j);
|
|
a2 = d.a(iVar, wVar);
|
|
} else {
|
|
StringBuilder O3 = c.d.b.a.a.O("Chunk is too large (~2GB+) to skip; id: ");
|
|
O3.append(a2.a);
|
|
throw new ParserException(O3.toString());
|
|
}
|
|
} else {
|
|
iVar.l(8);
|
|
long position = iVar.getPosition();
|
|
long j2 = a2.b + position;
|
|
long b = iVar.b();
|
|
if (b != -1 && j2 > b) {
|
|
StringBuilder R = c.d.b.a.a.R("Data exceeds input length: ", j2, ", ");
|
|
R.append(b);
|
|
Log.w("WavHeaderReader", R.toString());
|
|
j2 = b;
|
|
}
|
|
Pair create = Pair.create(Long.valueOf(position), Long.valueOf(j2));
|
|
this.d = ((Long) create.first).intValue();
|
|
long longValue = ((Long) create.second).longValue();
|
|
this.e = longValue;
|
|
this.f799c.b(this.d, longValue);
|
|
}
|
|
}
|
|
} else if (iVar.getPosition() == 0) {
|
|
iVar.l(this.d);
|
|
}
|
|
if (this.e == -1) {
|
|
z2 = false;
|
|
}
|
|
d.D(z2);
|
|
return this.f799c.c(iVar, this.e - iVar.getPosition()) ? -1 : 0;
|
|
}
|
|
|
|
@Override // c.i.a.c.a2.h
|
|
public void f(j jVar) {
|
|
this.a = jVar;
|
|
this.b = jVar.p(0, 1);
|
|
jVar.j();
|
|
}
|
|
|
|
@Override // c.i.a.c.a2.h
|
|
public void g(long j, long j2) {
|
|
AbstractC0089b bVar = this.f799c;
|
|
if (bVar != null) {
|
|
bVar.a(j2);
|
|
}
|
|
}
|
|
|
|
@Override // c.i.a.c.a2.h
|
|
public void release() {
|
|
}
|
|
}
|