314 lines
11 KiB
Java
314 lines
11 KiB
Java
package c.i.a.c.a2.j0;
|
|
|
|
import android.util.Log;
|
|
import androidx.annotation.Nullable;
|
|
import c.i.a.c.a2.g;
|
|
import c.i.a.c.a2.j;
|
|
import c.i.a.c.a2.j0.i0;
|
|
import c.i.a.c.i2.f0;
|
|
import c.i.a.c.i2.v;
|
|
import c.i.a.c.i2.w;
|
|
import c.i.a.c.v1.k;
|
|
import com.google.android.exoplayer2.Format;
|
|
import com.google.android.exoplayer2.ParserException;
|
|
import java.util.Arrays;
|
|
import java.util.Collections;
|
|
import java.util.Objects;
|
|
/* compiled from: AdtsReader */
|
|
public final class k implements o {
|
|
public static final byte[] a = {73, 68, 51};
|
|
public final boolean b;
|
|
|
|
/* renamed from: c reason: collision with root package name */
|
|
public final v f729c = new v(new byte[7]);
|
|
public final w d = new w(Arrays.copyOf(a, 10));
|
|
@Nullable
|
|
public final String e;
|
|
public String f;
|
|
public c.i.a.c.a2.w g;
|
|
public c.i.a.c.a2.w h;
|
|
public int i;
|
|
public int j;
|
|
public int k;
|
|
public boolean l;
|
|
public boolean m;
|
|
public int n;
|
|
public int o;
|
|
public int p;
|
|
public boolean q;
|
|
public long r;
|
|
|
|
/* renamed from: s reason: collision with root package name */
|
|
public int f730s;
|
|
public long t;
|
|
public c.i.a.c.a2.w u;
|
|
public long v;
|
|
|
|
public k(boolean z2, @Nullable String str) {
|
|
h();
|
|
this.n = -1;
|
|
this.o = -1;
|
|
this.r = -9223372036854775807L;
|
|
this.b = z2;
|
|
this.e = str;
|
|
}
|
|
|
|
public static boolean g(int i) {
|
|
return (i & 65526) == 65520;
|
|
}
|
|
|
|
public final boolean a(w wVar, byte[] bArr, int i) {
|
|
int min = Math.min(wVar.a(), i - this.j);
|
|
System.arraycopy(wVar.a, wVar.b, bArr, this.j, min);
|
|
wVar.b += min;
|
|
int i2 = this.j + min;
|
|
this.j = i2;
|
|
return i2 == i;
|
|
}
|
|
|
|
/* JADX WARNING: Removed duplicated region for block: B:141:0x026a A[EDGE_INSN: B:141:0x026a->B:92:0x026a ?: BREAK , SYNTHETIC] */
|
|
@Override // c.i.a.c.a2.j0.o
|
|
public void b(w wVar) throws ParserException {
|
|
int i;
|
|
int i2;
|
|
boolean z2;
|
|
Objects.requireNonNull(this.g);
|
|
int i3 = f0.a;
|
|
while (wVar.a() > 0) {
|
|
int i4 = this.i;
|
|
int i5 = 13;
|
|
int i6 = 2;
|
|
if (i4 == 0) {
|
|
byte[] bArr = wVar.a;
|
|
int i7 = wVar.b;
|
|
int i8 = wVar.f913c;
|
|
while (true) {
|
|
if (i7 >= i8) {
|
|
wVar.D(i7);
|
|
break;
|
|
}
|
|
i = i7 + 1;
|
|
i2 = bArr[i7] & 255;
|
|
if (this.k == 512 && g((((byte) i2) & 255) | 65280)) {
|
|
if (this.m) {
|
|
break;
|
|
}
|
|
int i9 = i - 2;
|
|
wVar.D(i9 + 1);
|
|
if (i(wVar, this.f729c.a, 1)) {
|
|
this.f729c.k(4);
|
|
int g = this.f729c.g(1);
|
|
int i10 = this.n;
|
|
if (i10 == -1 || g == i10) {
|
|
if (this.o != -1) {
|
|
if (i(wVar, this.f729c.a, 1)) {
|
|
this.f729c.k(i6);
|
|
if (this.f729c.g(4) == this.o) {
|
|
wVar.D(i9 + 2);
|
|
}
|
|
}
|
|
z2 = true;
|
|
if (z2) {
|
|
break;
|
|
}
|
|
}
|
|
if (i(wVar, this.f729c.a, 4)) {
|
|
this.f729c.k(14);
|
|
int g2 = this.f729c.g(i5);
|
|
if (g2 >= 7) {
|
|
byte[] bArr2 = wVar.a;
|
|
int i11 = wVar.f913c;
|
|
int i12 = i9 + g2;
|
|
if (i12 < i11) {
|
|
if (bArr2[i12] == -1) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
z2 = true;
|
|
if (z2) {
|
|
}
|
|
}
|
|
}
|
|
z2 = false;
|
|
if (z2) {
|
|
}
|
|
}
|
|
int i13 = this.k;
|
|
int i14 = i2 | i13;
|
|
if (i14 == 329) {
|
|
this.k = 768;
|
|
} else if (i14 == 511) {
|
|
this.k = 512;
|
|
} else if (i14 != 836) {
|
|
if (i14 == 1075) {
|
|
this.i = 2;
|
|
this.j = a.length;
|
|
this.f730s = 0;
|
|
this.d.D(0);
|
|
wVar.D(i);
|
|
break;
|
|
} else if (i13 != 256) {
|
|
this.k = 256;
|
|
i7 = i - 1;
|
|
i5 = 13;
|
|
i6 = 2;
|
|
}
|
|
} else {
|
|
this.k = 1024;
|
|
}
|
|
i7 = i;
|
|
i5 = 13;
|
|
i6 = 2;
|
|
}
|
|
this.p = (i2 & 8) >> 3;
|
|
this.l = (i2 & 1) == 0;
|
|
if (!this.m) {
|
|
this.i = 1;
|
|
this.j = 0;
|
|
} else {
|
|
this.i = 3;
|
|
this.j = 0;
|
|
}
|
|
wVar.D(i);
|
|
} else if (i4 != 1) {
|
|
if (i4 != 2) {
|
|
if (i4 == 3) {
|
|
if (a(wVar, this.f729c.a, this.l ? 7 : 5)) {
|
|
this.f729c.k(0);
|
|
if (!this.q) {
|
|
int g3 = this.f729c.g(2) + 1;
|
|
if (g3 != 2) {
|
|
Log.w("AdtsReader", "Detected audio object type: " + g3 + ", but assuming AAC LC.");
|
|
g3 = 2;
|
|
}
|
|
this.f729c.m(5);
|
|
int g4 = this.f729c.g(3);
|
|
int i15 = this.o;
|
|
byte[] bArr3 = {(byte) (((g3 << 3) & 248) | ((i15 >> 1) & 7)), (byte) (((i15 << 7) & 128) | ((g4 << 3) & 120))};
|
|
k.b c2 = c.i.a.c.v1.k.c(new v(bArr3), false);
|
|
Format.b bVar = new Format.b();
|
|
bVar.a = this.f;
|
|
bVar.k = "audio/mp4a-latm";
|
|
bVar.h = c2.f991c;
|
|
bVar.f2218x = c2.b;
|
|
bVar.f2219y = c2.a;
|
|
bVar.m = Collections.singletonList(bArr3);
|
|
bVar.f2216c = this.e;
|
|
Format a2 = bVar.a();
|
|
this.r = 1024000000 / ((long) a2.H);
|
|
this.g.e(a2);
|
|
this.q = true;
|
|
} else {
|
|
this.f729c.m(10);
|
|
}
|
|
this.f729c.m(4);
|
|
int g5 = (this.f729c.g(13) - 2) - 5;
|
|
if (this.l) {
|
|
g5 -= 2;
|
|
}
|
|
c.i.a.c.a2.w wVar2 = this.g;
|
|
long j = this.r;
|
|
this.i = 4;
|
|
this.j = 0;
|
|
this.u = wVar2;
|
|
this.v = j;
|
|
this.f730s = g5;
|
|
}
|
|
} else if (i4 == 4) {
|
|
int min = Math.min(wVar.a(), this.f730s - this.j);
|
|
this.u.c(wVar, min);
|
|
int i16 = this.j + min;
|
|
this.j = i16;
|
|
int i17 = this.f730s;
|
|
if (i16 == i17) {
|
|
this.u.d(this.t, 1, i17, 0, null);
|
|
this.t += this.v;
|
|
h();
|
|
}
|
|
} else {
|
|
throw new IllegalStateException();
|
|
}
|
|
} else if (a(wVar, this.d.a, 10)) {
|
|
this.h.c(this.d, 10);
|
|
this.d.D(6);
|
|
c.i.a.c.a2.w wVar3 = this.h;
|
|
this.i = 4;
|
|
this.j = 10;
|
|
this.u = wVar3;
|
|
this.v = 0;
|
|
this.f730s = this.d.r() + 10;
|
|
}
|
|
} else if (wVar.a() != 0) {
|
|
v vVar = this.f729c;
|
|
vVar.a[0] = wVar.a[wVar.b];
|
|
vVar.k(2);
|
|
int g6 = this.f729c.g(4);
|
|
int i18 = this.o;
|
|
if (i18 == -1 || g6 == i18) {
|
|
if (!this.m) {
|
|
this.m = true;
|
|
this.n = this.p;
|
|
this.o = g6;
|
|
}
|
|
this.i = 3;
|
|
this.j = 0;
|
|
} else {
|
|
this.m = false;
|
|
h();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // c.i.a.c.a2.j0.o
|
|
public void c() {
|
|
this.m = false;
|
|
h();
|
|
}
|
|
|
|
@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.f = dVar.b();
|
|
c.i.a.c.a2.w p = jVar.p(dVar.c(), 1);
|
|
this.g = p;
|
|
this.u = p;
|
|
if (this.b) {
|
|
dVar.a();
|
|
c.i.a.c.a2.w p2 = jVar.p(dVar.c(), 5);
|
|
this.h = p2;
|
|
Format.b bVar = new Format.b();
|
|
bVar.a = dVar.b();
|
|
bVar.k = "application/id3";
|
|
p2.e(bVar.a());
|
|
return;
|
|
}
|
|
this.h = new g();
|
|
}
|
|
|
|
@Override // c.i.a.c.a2.j0.o
|
|
public void f(long j, int i) {
|
|
this.t = j;
|
|
}
|
|
|
|
public final void h() {
|
|
this.i = 0;
|
|
this.j = 0;
|
|
this.k = 256;
|
|
}
|
|
|
|
public final boolean i(w wVar, byte[] bArr, int i) {
|
|
if (wVar.a() < i) {
|
|
return false;
|
|
}
|
|
System.arraycopy(wVar.a, wVar.b, bArr, 0, i);
|
|
wVar.b += i;
|
|
return true;
|
|
}
|
|
}
|