package com.applovin.impl; import android.os.Handler; import android.os.Looper; import android.os.Message; import com.mbridge.msdk.playercommon.exoplayer2.C; import java.util.Collections; import java.util.List; /* loaded from: classes.dex */ public final class bo extends e2 implements Handler.Callback { private int A; private long B; private final Handler n; private final ao o; private final ql p; private final g9 q; private boolean r; private boolean s; private boolean t; private int u; private f9 v; private ol w; private rl x; private sl y; private sl z; @Override // com.applovin.impl.qi public boolean c() { return this.s; } @Override // com.applovin.impl.qi public boolean d() { return true; } @Override // com.applovin.impl.qi, com.applovin.impl.ri public String getName() { return "TextRenderer"; } public bo(ao aoVar, Looper looper) { this(aoVar, looper, ql.a); } public bo(ao aoVar, Looper looper, ql qlVar) { super(3); this.o = (ao) b1.a(aoVar); this.n = looper == null ? null : xp.a(looper, (Handler.Callback) this); this.p = qlVar; this.q = new g9(); this.B = C.TIME_UNSET; } @Override // com.applovin.impl.e2 public void v() { this.v = null; this.B = C.TIME_UNSET; z(); D(); } private void C() { this.x = null; this.A = -1; sl slVar = this.y; if (slVar != null) { slVar.g(); this.y = null; } sl slVar2 = this.z; if (slVar2 != null) { slVar2.g(); this.z = null; } } private void D() { C(); ((ol) b1.a(this.w)).a(); this.w = null; this.u = 0; } private void B() { this.t = true; this.w = this.p.b((f9) b1.a(this.v)); } private void E() { D(); B(); } private long A() { if (this.A == -1) { return Long.MAX_VALUE; } b1.a(this.y); if (this.A >= this.y.a()) { return Long.MAX_VALUE; } return this.y.a(this.A); } private void b(List list) { Handler handler = this.n; if (handler != null) { handler.obtainMessage(0, list).sendToTarget(); } else { a(list); } } private void z() { b(Collections.emptyList()); } @Override // android.os.Handler.Callback public boolean handleMessage(Message message) { if (message.what == 0) { a((List) message.obj); return true; } throw new IllegalStateException(); } private void a(pl plVar) { pc.a("TextRenderer", "Subtitle decoding failed. streamFormat=" + this.v, plVar); z(); E(); } public void c(long j) { b1.b(k()); this.B = j; } private void a(List list) { this.o.a(list); } @Override // com.applovin.impl.e2 public void a(long j, boolean z) { z(); this.r = false; this.s = false; this.B = C.TIME_UNSET; if (this.u != 0) { E(); } else { C(); ((ol) b1.a(this.w)).b(); } } @Override // com.applovin.impl.e2 public void a(f9[] f9VarArr, long j, long j2) { this.v = f9VarArr[0]; if (this.w != null) { this.u = 1; } else { B(); } } /* JADX WARN: Code restructure failed: missing block: B:98:0x00a7, code lost: if (r11 != false) goto L48; */ @Override // com.applovin.impl.qi /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ public void a(long r9, long r11) { /* Method dump skipped, instructions count: 312 To view this dump add '--comments-level debug' option */ throw new UnsupportedOperationException("Method not decompiled: com.applovin.impl.bo.a(long, long):void"); } @Override // com.applovin.impl.ri public int a(f9 f9Var) { if (this.p.a(f9Var)) { return ri.a(f9Var.F == 0 ? 4 : 2); } if (Cif.h(f9Var.m)) { return ri.a(1); } return ri.a(0); } }