187 lines
6.3 KiB
Java
187 lines
6.3 KiB
Java
package c.i.a.c.a2.j0;
|
|
|
|
import android.util.Log;
|
|
import androidx.annotation.Nullable;
|
|
import c.d.b.a.a;
|
|
import c.i.a.c.a2.j;
|
|
import c.i.a.c.a2.j0.i0;
|
|
import c.i.a.c.i2.e0;
|
|
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.ParserException;
|
|
/* compiled from: PesReader */
|
|
public final class y implements i0 {
|
|
public final o a;
|
|
public final v b = new v(new byte[10]);
|
|
|
|
/* renamed from: c reason: collision with root package name */
|
|
public int f746c = 0;
|
|
public int d;
|
|
public e0 e;
|
|
public boolean f;
|
|
public boolean g;
|
|
public boolean h;
|
|
public int i;
|
|
public int j;
|
|
public boolean k;
|
|
public long l;
|
|
|
|
public y(o oVar) {
|
|
this.a = oVar;
|
|
}
|
|
|
|
@Override // c.i.a.c.a2.j0.i0
|
|
public void a(e0 e0Var, j jVar, i0.d dVar) {
|
|
this.e = e0Var;
|
|
this.a.e(jVar, dVar);
|
|
}
|
|
|
|
@Override // c.i.a.c.a2.j0.i0
|
|
public final void b(w wVar, int i) throws ParserException {
|
|
boolean z2;
|
|
AnimatableValueParser.H(this.e);
|
|
int i2 = -1;
|
|
int i3 = 3;
|
|
if ((i & 1) != 0) {
|
|
int i4 = this.f746c;
|
|
if (!(i4 == 0 || i4 == 1)) {
|
|
if (i4 == 2) {
|
|
Log.w("PesReader", "Unexpected start indicator reading extended header");
|
|
} else if (i4 == 3) {
|
|
if (this.j != -1) {
|
|
StringBuilder L = a.L("Unexpected start indicator: expected ");
|
|
L.append(this.j);
|
|
L.append(" more bytes");
|
|
Log.w("PesReader", L.toString());
|
|
}
|
|
this.a.d();
|
|
} else {
|
|
throw new IllegalStateException();
|
|
}
|
|
}
|
|
e(1);
|
|
}
|
|
while (wVar.a() > 0) {
|
|
int i5 = this.f746c;
|
|
if (i5 != 0) {
|
|
int i6 = 0;
|
|
if (i5 != 1) {
|
|
if (i5 == 2) {
|
|
if (d(wVar, this.b.a, Math.min(10, this.i)) && d(wVar, null, this.i)) {
|
|
this.b.k(0);
|
|
this.l = -9223372036854775807L;
|
|
if (this.f) {
|
|
this.b.m(4);
|
|
this.b.m(1);
|
|
this.b.m(1);
|
|
long g = (((long) this.b.g(i3)) << 30) | ((long) (this.b.g(15) << 15)) | ((long) this.b.g(15));
|
|
this.b.m(1);
|
|
if (!this.h && this.g) {
|
|
this.b.m(4);
|
|
this.b.m(1);
|
|
this.b.m(1);
|
|
this.b.m(1);
|
|
this.e.b((((long) this.b.g(i3)) << 30) | ((long) (this.b.g(15) << 15)) | ((long) this.b.g(15)));
|
|
this.h = true;
|
|
}
|
|
this.l = this.e.b(g);
|
|
}
|
|
i |= this.k ? 4 : 0;
|
|
this.a.f(this.l, i);
|
|
e(3);
|
|
}
|
|
} else if (i5 == i3) {
|
|
int a = wVar.a();
|
|
int i7 = this.j;
|
|
if (i7 != i2) {
|
|
i6 = a - i7;
|
|
}
|
|
if (i6 > 0) {
|
|
a -= i6;
|
|
wVar.C(wVar.b + a);
|
|
}
|
|
this.a.b(wVar);
|
|
int i8 = this.j;
|
|
if (i8 != i2) {
|
|
int i9 = i8 - a;
|
|
this.j = i9;
|
|
if (i9 == 0) {
|
|
this.a.d();
|
|
e(1);
|
|
}
|
|
}
|
|
} else {
|
|
throw new IllegalStateException();
|
|
}
|
|
} else if (d(wVar, this.b.a, 9)) {
|
|
this.b.k(0);
|
|
int g2 = this.b.g(24);
|
|
if (g2 != 1) {
|
|
a.f0("Unexpected start code prefix: ", g2, "PesReader");
|
|
this.j = -1;
|
|
z2 = false;
|
|
} else {
|
|
this.b.m(8);
|
|
int g3 = this.b.g(16);
|
|
this.b.m(5);
|
|
this.k = this.b.f();
|
|
this.b.m(2);
|
|
this.f = this.b.f();
|
|
this.g = this.b.f();
|
|
this.b.m(6);
|
|
int g4 = this.b.g(8);
|
|
this.i = g4;
|
|
if (g3 == 0) {
|
|
this.j = -1;
|
|
} else {
|
|
int i10 = ((g3 + 6) - 9) - g4;
|
|
this.j = i10;
|
|
if (i10 < 0) {
|
|
StringBuilder L2 = a.L("Found negative packet payload size: ");
|
|
L2.append(this.j);
|
|
Log.w("PesReader", L2.toString());
|
|
this.j = -1;
|
|
}
|
|
}
|
|
z2 = true;
|
|
}
|
|
e(z2 ? 2 : 0);
|
|
}
|
|
} else {
|
|
wVar.E(wVar.a());
|
|
}
|
|
i2 = -1;
|
|
i3 = 3;
|
|
}
|
|
}
|
|
|
|
@Override // c.i.a.c.a2.j0.i0
|
|
public final void c() {
|
|
this.f746c = 0;
|
|
this.d = 0;
|
|
this.h = false;
|
|
this.a.c();
|
|
}
|
|
|
|
public final boolean d(w wVar, @Nullable byte[] bArr, int i) {
|
|
int min = Math.min(wVar.a(), i - this.d);
|
|
if (min <= 0) {
|
|
return true;
|
|
}
|
|
if (bArr == null) {
|
|
wVar.E(min);
|
|
} else {
|
|
System.arraycopy(wVar.a, wVar.b, bArr, this.d, min);
|
|
wVar.b += min;
|
|
}
|
|
int i2 = this.d + min;
|
|
this.d = i2;
|
|
return i2 == i;
|
|
}
|
|
|
|
public final void e(int i) {
|
|
this.f746c = i;
|
|
this.d = 0;
|
|
}
|
|
}
|