package c.i.a.c; import androidx.annotation.Nullable; import c.i.a.c.d2.f0; import c.i.a.c.i2.r; import com.airbnb.lottie.parser.AnimatableValueParser; import com.google.android.exoplayer2.ExoPlaybackException; import com.google.android.exoplayer2.Format; import com.google.android.exoplayer2.decoder.DecoderInputBuffer; import java.io.IOException; import java.util.Objects; /* compiled from: BaseRenderer */ public abstract class g0 implements k1, l1 { public final int i; public final s0 j = new s0(); @Nullable public m1 k; public int l; public int m; @Nullable public f0 n; @Nullable public Format[] o; public long p; public long q = Long.MIN_VALUE; public boolean r; /* renamed from: s reason: collision with root package name */ public boolean f860s; public g0(int i) { this.i = i; } public final s0 A() { this.j.a(); return this.j; } public abstract void B(); public void C(boolean z2, boolean z3) throws ExoPlaybackException { } public abstract void D(long j, boolean z2) throws ExoPlaybackException; public void E() { } public void F() throws ExoPlaybackException { } public void G() { } public abstract void H(Format[] formatArr, long j, long j2) throws ExoPlaybackException; public final int I(s0 s0Var, DecoderInputBuffer decoderInputBuffer, boolean z2) { f0 f0Var = this.n; Objects.requireNonNull(f0Var); int a = f0Var.a(s0Var, decoderInputBuffer, z2); if (a == -4) { if (decoderInputBuffer.n()) { this.q = Long.MIN_VALUE; return this.r ? -4 : -3; } long j = decoderInputBuffer.m + this.p; decoderInputBuffer.m = j; this.q = Math.max(this.q, j); } else if (a == -5) { Format format = s0Var.b; Objects.requireNonNull(format); if (format.f2194x != Long.MAX_VALUE) { Format.b a2 = format.a(); a2.o = format.f2194x + this.p; s0Var.b = a2.a(); } } return a; } @Override // c.i.a.c.k1 public final void f(int i) { this.l = i; } @Override // c.i.a.c.k1 public final void g() { boolean z2 = true; if (this.m != 1) { z2 = false; } AnimatableValueParser.D(z2); this.j.a(); this.m = 0; this.n = null; this.o = null; this.r = false; B(); } @Override // c.i.a.c.k1 public final int getState() { return this.m; } @Override // c.i.a.c.k1 @Nullable public final f0 h() { return this.n; } @Override // c.i.a.c.k1 public final boolean i() { return this.q == Long.MIN_VALUE; } @Override // c.i.a.c.k1 public final void j(Format[] formatArr, f0 f0Var, long j, long j2) throws ExoPlaybackException { AnimatableValueParser.D(!this.r); this.n = f0Var; this.q = j2; this.o = formatArr; this.p = j2; H(formatArr, j, j2); } @Override // c.i.a.c.k1 public final void k() { this.r = true; } @Override // c.i.a.c.k1 public final l1 l() { return this; } @Override // c.i.a.c.k1 public /* synthetic */ void n(float f, float f2) { j1.a(this, f, f2); } @Override // c.i.a.c.k1 public final void o(m1 m1Var, Format[] formatArr, f0 f0Var, long j, boolean z2, boolean z3, long j2, long j3) throws ExoPlaybackException { AnimatableValueParser.D(this.m == 0); this.k = m1Var; this.m = 1; C(z2, z3); j(formatArr, f0Var, j2, j3); D(j, z2); } @Override // c.i.a.c.l1 public int p() throws ExoPlaybackException { return 0; } @Override // c.i.a.c.h1.b public void r(int i, @Nullable Object obj) throws ExoPlaybackException { } @Override // c.i.a.c.k1 public final void reset() { AnimatableValueParser.D(this.m == 0); this.j.a(); E(); } @Override // c.i.a.c.k1 public final void s() throws IOException { f0 f0Var = this.n; Objects.requireNonNull(f0Var); f0Var.b(); } @Override // c.i.a.c.k1 public final void start() throws ExoPlaybackException { boolean z2 = true; if (this.m != 1) { z2 = false; } AnimatableValueParser.D(z2); this.m = 2; F(); } @Override // c.i.a.c.k1 public final void stop() { AnimatableValueParser.D(this.m == 2); this.m = 1; G(); } @Override // c.i.a.c.k1 public final long t() { return this.q; } @Override // c.i.a.c.k1 public final void u(long j) throws ExoPlaybackException { this.r = false; this.q = j; D(j, false); } @Override // c.i.a.c.k1 public final boolean v() { return this.r; } @Override // c.i.a.c.k1 @Nullable public r w() { return null; } @Override // c.i.a.c.k1 public final int x() { return this.i; } public final ExoPlaybackException y(Throwable th, @Nullable Format format) { return z(th, format, false); } /* JADX WARNING: Removed duplicated region for block: B:16:0x0025 */ /* JADX WARNING: Removed duplicated region for block: B:17:0x0027 */ public final ExoPlaybackException z(Throwable th, @Nullable Format format, boolean z2) { int i; if (format != null && !this.f860s) { this.f860s = true; boolean z3 = false; try { i = a(format) & 7; } catch (ExoPlaybackException unused) { } finally { this.f860s = z3; } return new ExoPlaybackException(1, th, null, getName(), this.l, format, format != null ? 4 : i, z2); } i = 4; return new ExoPlaybackException(1, th, null, getName(), this.l, format, format != null ? 4 : i, z2); } }