253 lines
9.6 KiB
Java
253 lines
9.6 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 c.i.a.c.v1.k;
|
|
import com.airbnb.lottie.parser.AnimatableValueParser;
|
|
import com.google.android.exoplayer2.Format;
|
|
import com.google.android.exoplayer2.ParserException;
|
|
import java.util.Collections;
|
|
import java.util.Objects;
|
|
/* compiled from: LatmReader */
|
|
public final class u implements o {
|
|
@Nullable
|
|
public final String a;
|
|
public final w b;
|
|
|
|
/* renamed from: c reason: collision with root package name */
|
|
public final v f739c;
|
|
public c.i.a.c.a2.w d;
|
|
public String e;
|
|
public Format f;
|
|
public int g;
|
|
public int h;
|
|
public int i;
|
|
public int j;
|
|
public long k;
|
|
public boolean l;
|
|
public int m;
|
|
public int n;
|
|
public int o;
|
|
public boolean p;
|
|
public long q;
|
|
public int r;
|
|
|
|
/* renamed from: s reason: collision with root package name */
|
|
public long f740s;
|
|
public int t;
|
|
@Nullable
|
|
public String u;
|
|
|
|
public u(@Nullable String str) {
|
|
this.a = str;
|
|
w wVar = new w(1024);
|
|
this.b = wVar;
|
|
this.f739c = new v(wVar.a);
|
|
}
|
|
|
|
public static long a(v vVar) {
|
|
return (long) vVar.g((vVar.g(2) + 1) * 8);
|
|
}
|
|
|
|
/* JADX WARNING: Code restructure failed: missing block: B:64:0x014e, code lost:
|
|
if (r13.l == false) goto L_0x01a8;
|
|
*/
|
|
@Override // c.i.a.c.a2.j0.o
|
|
public void b(w wVar) throws ParserException {
|
|
int i;
|
|
boolean f;
|
|
AnimatableValueParser.H(this.d);
|
|
while (wVar.a() > 0) {
|
|
int i2 = this.g;
|
|
if (i2 != 0) {
|
|
if (i2 == 1) {
|
|
int s2 = wVar.s();
|
|
if ((s2 & 224) == 224) {
|
|
this.j = s2;
|
|
this.g = 2;
|
|
} else if (s2 != 86) {
|
|
this.g = 0;
|
|
}
|
|
} else if (i2 == 2) {
|
|
int s3 = ((this.j & -225) << 8) | wVar.s();
|
|
this.i = s3;
|
|
w wVar2 = this.b;
|
|
byte[] bArr = wVar2.a;
|
|
if (s3 > bArr.length) {
|
|
if (bArr.length < s3) {
|
|
bArr = new byte[s3];
|
|
}
|
|
wVar2.B(bArr, s3);
|
|
v vVar = this.f739c;
|
|
byte[] bArr2 = this.b.a;
|
|
Objects.requireNonNull(vVar);
|
|
int length = bArr2.length;
|
|
vVar.a = bArr2;
|
|
vVar.b = 0;
|
|
vVar.f907c = 0;
|
|
vVar.d = length;
|
|
}
|
|
this.h = 0;
|
|
this.g = 3;
|
|
} else if (i2 == 3) {
|
|
int min = Math.min(wVar.a(), this.i - this.h);
|
|
wVar.e(this.f739c.a, this.h, min);
|
|
int i3 = this.h + min;
|
|
this.h = i3;
|
|
if (i3 == this.i) {
|
|
this.f739c.k(0);
|
|
v vVar2 = this.f739c;
|
|
if (!vVar2.f()) {
|
|
this.l = true;
|
|
int g = vVar2.g(1);
|
|
int g2 = g == 1 ? vVar2.g(1) : 0;
|
|
this.m = g2;
|
|
if (g2 == 0) {
|
|
if (g == 1) {
|
|
a(vVar2);
|
|
}
|
|
if (vVar2.f()) {
|
|
this.n = vVar2.g(6);
|
|
int g3 = vVar2.g(4);
|
|
int g4 = vVar2.g(3);
|
|
if (g3 == 0 && g4 == 0) {
|
|
if (g == 0) {
|
|
int e = vVar2.e();
|
|
int g5 = g(vVar2);
|
|
vVar2.k(e);
|
|
byte[] bArr3 = new byte[((g5 + 7) / 8)];
|
|
vVar2.h(bArr3, 0, g5);
|
|
Format.b bVar = new Format.b();
|
|
bVar.a = this.e;
|
|
bVar.k = "audio/mp4a-latm";
|
|
bVar.h = this.u;
|
|
bVar.f2199x = this.t;
|
|
bVar.f2200y = this.r;
|
|
bVar.m = Collections.singletonList(bArr3);
|
|
bVar.f2197c = this.a;
|
|
Format a = bVar.a();
|
|
if (!a.equals(this.f)) {
|
|
this.f = a;
|
|
this.f740s = 1024000000 / ((long) a.H);
|
|
this.d.e(a);
|
|
}
|
|
} else {
|
|
vVar2.m(((int) a(vVar2)) - g(vVar2));
|
|
}
|
|
int g6 = vVar2.g(3);
|
|
this.o = g6;
|
|
if (g6 == 0) {
|
|
vVar2.m(8);
|
|
} else if (g6 == 1) {
|
|
vVar2.m(9);
|
|
} else if (g6 == 3 || g6 == 4 || g6 == 5) {
|
|
vVar2.m(6);
|
|
} else if (g6 == 6 || g6 == 7) {
|
|
vVar2.m(1);
|
|
} else {
|
|
throw new IllegalStateException();
|
|
}
|
|
boolean f2 = vVar2.f();
|
|
this.p = f2;
|
|
this.q = 0;
|
|
if (f2) {
|
|
if (g == 1) {
|
|
this.q = a(vVar2);
|
|
} else {
|
|
do {
|
|
f = vVar2.f();
|
|
this.q = (this.q << 8) + ((long) vVar2.g(8));
|
|
} while (f);
|
|
}
|
|
}
|
|
if (vVar2.f()) {
|
|
vVar2.m(8);
|
|
}
|
|
} else {
|
|
throw new ParserException();
|
|
}
|
|
} else {
|
|
throw new ParserException();
|
|
}
|
|
} else {
|
|
throw new ParserException();
|
|
}
|
|
}
|
|
if (this.m != 0) {
|
|
throw new ParserException();
|
|
} else if (this.n != 0) {
|
|
throw new ParserException();
|
|
} else if (this.o == 0) {
|
|
int i4 = 0;
|
|
while (true) {
|
|
int g7 = vVar2.g(8);
|
|
i = i4 + g7;
|
|
if (g7 != 255) {
|
|
break;
|
|
}
|
|
i4 = i;
|
|
}
|
|
int e2 = vVar2.e();
|
|
if ((e2 & 7) == 0) {
|
|
this.b.D(e2 >> 3);
|
|
} else {
|
|
vVar2.h(this.b.a, 0, i * 8);
|
|
this.b.D(0);
|
|
}
|
|
this.d.c(this.b, i);
|
|
this.d.d(this.k, 1, i, 0, null);
|
|
this.k += this.f740s;
|
|
if (this.p) {
|
|
vVar2.m((int) this.q);
|
|
}
|
|
this.g = 0;
|
|
} else {
|
|
throw new ParserException();
|
|
}
|
|
} else {
|
|
continue;
|
|
}
|
|
} else {
|
|
throw new IllegalStateException();
|
|
}
|
|
} else if (wVar.s() == 86) {
|
|
this.g = 1;
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // c.i.a.c.a2.j0.o
|
|
public void c() {
|
|
this.g = 0;
|
|
this.l = false;
|
|
}
|
|
|
|
@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.d = jVar.p(dVar.c(), 1);
|
|
this.e = dVar.b();
|
|
}
|
|
|
|
@Override // c.i.a.c.a2.j0.o
|
|
public void f(long j, int i) {
|
|
this.k = j;
|
|
}
|
|
|
|
public final int g(v vVar) throws ParserException {
|
|
int b = vVar.b();
|
|
k.b c2 = k.c(vVar, true);
|
|
this.u = c2.f986c;
|
|
this.r = c2.a;
|
|
this.t = c2.b;
|
|
return b - vVar.b();
|
|
}
|
|
}
|