package c.i.a.c.a2.j0; import c.i.a.c.a2.h; import c.i.a.c.a2.i; import c.i.a.c.a2.j0.i0; import c.i.a.c.a2.s; import c.i.a.c.a2.t; import c.i.a.c.i2.v; import c.i.a.c.i2.w; import com.airbnb.lottie.parser.AnimatableValueParser; import java.io.IOException; /* compiled from: AdtsExtractor */ public final class j implements h { public final k a = new k(true, null); public final w b = new w(2048); /* renamed from: c reason: collision with root package name */ public final w f728c; public final v d; public c.i.a.c.a2.j e; public long f; public long g = -1; public int h = -1; public boolean i; public boolean j; static { c cVar = c.a; } public j(int i) { w wVar = new w(10); this.f728c = wVar; this.d = new v(wVar.a); } public final int a(i iVar) throws IOException { int i = 0; while (true) { iVar.n(this.f728c.a, 0, 10); this.f728c.D(0); if (this.f728c.u() != 4801587) { break; } this.f728c.E(3); int r = this.f728c.r(); i += r + 10; iVar.g(r); } iVar.k(); iVar.g(i); if (this.g == -1) { this.g = (long) i; } return i; } /* JADX WARNING: Code restructure failed: missing block: B:4:0x0021, code lost: r9.k(); r3 = r3 + 1; */ /* JADX WARNING: Code restructure failed: missing block: B:5:0x002a, code lost: if ((r3 - r0) < 8192) goto L_0x002d; */ /* JADX WARNING: Code restructure failed: missing block: B:6:0x002c, code lost: return false; */ @Override // c.i.a.c.a2.h public boolean b(i iVar) throws IOException { int a = a(iVar); int i = a; while (true) { int i2 = 0; int i3 = 0; while (true) { iVar.n(this.f728c.a, 0, 2); this.f728c.D(0); if (!k.g(this.f728c.x())) { break; } i2++; if (i2 >= 4 && i3 > 188) { return true; } iVar.n(this.f728c.a, 0, 4); this.d.k(14); int g = this.d.g(13); if (g <= 6) { return false; } iVar.g(g - 6); i3 += g; } iVar.g(i); } } @Override // c.i.a.c.a2.h public int e(i iVar, s sVar) throws IOException { AnimatableValueParser.H(this.e); iVar.b(); int read = iVar.read(this.b.a, 0, 2048); boolean z2 = read == -1; if (!this.j) { this.e.a(new t.b(-9223372036854775807L, 0)); this.j = true; } if (z2) { return -1; } this.b.D(0); this.b.C(read); if (!this.i) { this.a.t = this.f; this.i = true; } this.a.b(this.b); return 0; } @Override // c.i.a.c.a2.h public void f(c.i.a.c.a2.j jVar) { this.e = jVar; this.a.e(jVar, new i0.d(Integer.MIN_VALUE, 0, 1)); jVar.j(); } @Override // c.i.a.c.a2.h public void g(long j, long j2) { this.i = false; this.a.c(); this.f = j2; } @Override // c.i.a.c.a2.h public void release() { } }