package c.i.a.c.a2.j0; import c.i.a.c.a2.j; import c.i.a.c.a2.j0.i0; import c.i.a.c.a2.w; import com.google.android.exoplayer2.Format; import java.util.Collections; import java.util.List; /* compiled from: DvbSubtitleReader */ public final class n implements o { public final List a; public final w[] b; /* renamed from: c reason: collision with root package name */ public boolean f732c; public int d; public int e; public long f; public n(List list) { this.a = list; this.b = new w[list.size()]; } public final boolean a(c.i.a.c.i2.w wVar, int i) { if (wVar.a() == 0) { return false; } if (wVar.s() != i) { this.f732c = false; } this.d--; return this.f732c; } @Override // c.i.a.c.a2.j0.o public void b(c.i.a.c.i2.w wVar) { if (!this.f732c) { return; } if (this.d != 2 || a(wVar, 32)) { if (this.d != 1 || a(wVar, 0)) { int i = wVar.b; int a = wVar.a(); w[] wVarArr = this.b; for (w wVar2 : wVarArr) { wVar.D(i); wVar2.c(wVar, a); } this.e += a; } } } @Override // c.i.a.c.a2.j0.o public void c() { this.f732c = false; } @Override // c.i.a.c.a2.j0.o public void d() { if (this.f732c) { for (w wVar : this.b) { wVar.d(this.f, 1, this.e, 0, null); } this.f732c = false; } } @Override // c.i.a.c.a2.j0.o public void e(j jVar, i0.d dVar) { for (int i = 0; i < this.b.length; i++) { i0.a aVar = this.a.get(i); dVar.a(); w p = jVar.p(dVar.c(), 3); Format.b bVar = new Format.b(); bVar.a = dVar.b(); bVar.k = "application/dvbsubs"; bVar.m = Collections.singletonList(aVar.b); bVar.f2216c = aVar.a; p.e(bVar.a()); this.b[i] = p; } } @Override // c.i.a.c.a2.j0.o public void f(long j, int i) { if ((i & 4) != 0) { this.f732c = true; this.f = j; this.e = 0; this.d = 2; } } }