FlixOlé v4.4.0版本的 MD5 值为:50e7f767ca3e8715936523e9ef089581
以下内容为反编译后的 t2.java 源代码,内容仅作参考
package i.d.a.b;
import andhook.lib.xposed.callbacks.XCallback;
import android.content.Context;
import android.graphics.Rect;
import android.graphics.SurfaceTexture;
import android.media.AudioTrack;
import android.media.MediaFormat;
import android.media.metrics.LogSessionId;
import android.os.Handler;
import android.os.Looper;
import android.util.Pair;
import android.view.Surface;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.TextureView;
import com.google.android.exoplayer2.video.spherical.SphericalGLSurfaceView;
import i.d.a.b.d4;
import i.d.a.b.e2;
import i.d.a.b.e3;
import i.d.a.b.f2;
import i.d.a.b.f4;
import i.d.a.b.j3;
import i.d.a.b.p3;
import i.d.a.b.r3;
import i.d.a.b.s2;
import i.d.a.b.s4.c0;
import i.d.a.b.s4.k0;
import i.d.a.b.t2;
import i.d.a.b.u2;
import i.d.a.b.x4.t;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.CopyOnWriteArraySet;
import java.util.concurrent.TimeoutException;
public final class t2 extends g2 implements s2 {
public final f2 A;
public final d4 B;
public final h4 C;
public final i4 D;
public final long E;
public int F;
public boolean G;
public int H;
public int I;
public boolean J;
public int K;
public a4 L;
public i.d.a.b.s4.k0 M;
public boolean N;
public p3.b O;
public e3 P;
public x2 Q;
public x2 R;
public AudioTrack S;
public Object T;
public Surface U;
public SurfaceHolder V;
public SphericalGLSurfaceView W;
public boolean X;
public TextureView Y;
public int Z;
public int a0;
public final i.d.a.b.u4.d0 b;
public i.d.a.b.x4.g0 b0;
public final p3.b c;
public i.d.a.b.l4.e c0;
public final i.d.a.b.x4.k d;
public i.d.a.b.l4.e d0;
public final Context e;
public int e0;
public final p3 f4920f;
public i.d.a.b.k4.q f0;
public final v3[] f4921g;
public float g0;
public final i.d.a.b.u4.c0 f4922h;
public boolean h0;
public final i.d.a.b.x4.s f4923i;
public i.d.a.b.t4.e i0;
public final u2.f f4924j;
public boolean j0;
public final u2 f4925k;
public boolean k0;
public final i.d.a.b.x4.t<p3.d> f4926l;
public i.d.a.b.x4.e0 l0;
public final CopyOnWriteArraySet<s2.a> f4927m;
public boolean m0;
public final f4.b f4928n;
public p2 n0;
public final List<e> f4929o;
public i.d.a.b.y4.a0 o0;
public final boolean f4930p;
public e3 p0;
public final c0.a f4931q;
public n3 q0;
public final i.d.a.b.j4.m1 r;
public int r0;
public final Looper s;
public int s0;
public final i.d.a.b.w4.l t;
public long t0;
public final long u;
public final long v;
public final i.d.a.b.x4.h w;
public final c x;
public final d y;
public final e2 z;
public static final class b {
public static i.d.a.b.j4.t1 a(Context context, t2 t2Var, boolean z) {
i.d.a.b.j4.r1 f2 = i.d.a.b.j4.r1.f(context);
if (f2 == null) {
i.d.a.b.x4.u.i("ExoPlayerImpl", "MediaMetricsService unavailable.");
return new i.d.a.b.j4.t1(LogSessionId.LOG_SESSION_ID_NONE);
}
if (z) {
t2Var.c(f2);
}
return new i.d.a.b.j4.t1(f2.m());
}
}
public final class c implements i.d.a.b.y4.z, i.d.a.b.k4.v, i.d.a.b.t4.n, i.d.a.b.q4.f, SurfaceHolder.Callback, TextureView.SurfaceTextureListener, SphericalGLSurfaceView.b, f2.b, e2.b, d4.b, s2.a {
public c() {
}
public void L(p3.d dVar) {
dVar.x0(t2.this.P);
}
@Override
public void A(long j2, int i2) {
t2.this.r.A(j2, i2);
}
@Override
public void B(int i2) {
boolean k2 = t2.this.k();
t2.this.n2(k2, i2, t2.i1(k2, i2));
}
@Override
public void C(Surface surface) {
t2.this.j2(null);
}
@Override
public void D(Surface surface) {
t2.this.j2(surface);
}
@Override
public void E(final int i2, final boolean z) {
t2.this.f4926l.k(30, new t.a() {
@Override
public final void invoke(Object obj) {
((p3.d) obj).N0(i2, z);
}
});
}
@Override
public void F(x2 x2Var) {
i.d.a.b.y4.y.a(this, x2Var);
}
@Override
public void G(x2 x2Var) {
i.d.a.b.k4.u.a(this, x2Var);
}
@Override
public void H(boolean z) {
r2.a(this, z);
}
@Override
public void a(int i2) {
final p2 a1 = t2.a1(t2.this.B);
if (a1.equals(t2.this.n0)) {
return;
}
t2.this.n0 = a1;
t2.this.f4926l.k(29, new t.a() {
@Override
public final void invoke(Object obj) {
((p3.d) obj).v0(p2.this);
}
});
}
@Override
public void b(final boolean z) {
if (t2.this.h0 == z) {
return;
}
t2.this.h0 = z;
t2.this.f4926l.k(23, new t.a() {
@Override
public final void invoke(Object obj) {
((p3.d) obj).b(z);
}
});
}
@Override
public void c(Exception exc) {
t2.this.r.c(exc);
}
@Override
public void d(i.d.a.b.l4.e eVar) {
t2.this.r.d(eVar);
t2.this.R = null;
t2.this.d0 = null;
}
@Override
public void e(String str) {
t2.this.r.e(str);
}
@Override
public void f(i.d.a.b.l4.e eVar) {
t2.this.d0 = eVar;
t2.this.r.f(eVar);
}
@Override
public void g(String str, long j2, long j3) {
t2.this.r.g(str, j2, j3);
}
@Override
public void h(final i.d.a.b.t4.e eVar) {
t2.this.i0 = eVar;
t2.this.f4926l.k(27, new t.a() {
@Override
public final void invoke(Object obj) {
((p3.d) obj).h(i.d.a.b.t4.e.this);
}
});
}
@Override
public void i(String str) {
t2.this.r.i(str);
}
@Override
public void j(String str, long j2, long j3) {
t2.this.r.j(str, j2, j3);
}
@Override
public void k(final i.d.a.b.q4.a aVar) {
t2 t2Var = t2.this;
e3.b a = t2Var.p0.a();
a.K(aVar);
t2Var.p0 = a.H();
e3 X0 = t2.this.X0();
if (!X0.equals(t2.this.P)) {
t2.this.P = X0;
t2.this.f4926l.h(14, new t.a() {
@Override
public final void invoke(Object obj) {
t2.c.this.L((p3.d) obj);
}
});
}
t2.this.f4926l.h(28, new t.a() {
@Override
public final void invoke(Object obj) {
((p3.d) obj).k(i.d.a.b.q4.a.this);
}
});
t2.this.f4926l.d();
}
@Override
public void l(int i2, long j2) {
t2.this.r.l(i2, j2);
}
@Override
public void m(x2 x2Var, i.d.a.b.l4.i iVar) {
t2.this.R = x2Var;
t2.this.r.m(x2Var, iVar);
}
@Override
public void n() {
t2.this.n2(false, -1, 3);
}
@Override
public void o(Object obj, long j2) {
t2.this.r.o(obj, j2);
if (t2.this.T == obj) {
t2.this.f4926l.k(26, new t.a() {
@Override
public final void invoke(Object obj2) {
((p3.d) obj2).g1();
}
});
}
}
@Override
public void onSurfaceTextureAvailable(SurfaceTexture surfaceTexture, int i2, int i3) {
t2.this.i2(surfaceTexture);
t2.this.V1(i2, i3);
}
@Override
public boolean onSurfaceTextureDestroyed(SurfaceTexture surfaceTexture) {
t2.this.j2(null);
t2.this.V1(0, 0);
return true;
}
@Override
public void onSurfaceTextureSizeChanged(SurfaceTexture surfaceTexture, int i2, int i3) {
t2.this.V1(i2, i3);
}
@Override
public void onSurfaceTextureUpdated(SurfaceTexture surfaceTexture) {
}
@Override
public void p(final List<i.d.a.b.t4.c> list) {
t2.this.f4926l.k(27, new t.a() {
@Override
public final void invoke(Object obj) {
((p3.d) obj).p(list);
}
});
}
@Override
public void q(i.d.a.b.l4.e eVar) {
t2.this.c0 = eVar;
t2.this.r.q(eVar);
}
@Override
public void r(x2 x2Var, i.d.a.b.l4.i iVar) {
t2.this.Q = x2Var;
t2.this.r.r(x2Var, iVar);
}
@Override
public void s(long j2) {
t2.this.r.s(j2);
}
@Override
public void surfaceChanged(SurfaceHolder surfaceHolder, int i2, int i3, int i4) {
t2.this.V1(i3, i4);
}
@Override
public void surfaceCreated(SurfaceHolder surfaceHolder) {
if (t2.this.X) {
t2.this.j2(surfaceHolder.getSurface());
}
}
@Override
public void surfaceDestroyed(SurfaceHolder surfaceHolder) {
if (t2.this.X) {
t2.this.j2(null);
}
t2.this.V1(0, 0);
}
@Override
public void t(Exception exc) {
t2.this.r.t(exc);
}
@Override
public void u(Exception exc) {
t2.this.r.u(exc);
}
@Override
public void v(final i.d.a.b.y4.a0 a0Var) {
t2.this.o0 = a0Var;
t2.this.f4926l.k(25, new t.a() {
@Override
public final void invoke(Object obj) {
((p3.d) obj).v(i.d.a.b.y4.a0.this);
}
});
}
@Override
public void w(i.d.a.b.l4.e eVar) {
t2.this.r.w(eVar);
t2.this.Q = null;
t2.this.c0 = null;
}
@Override
public void x(boolean z) {
t2.this.q2();
}
@Override
public void y(int i2, long j2, long j3) {
t2.this.r.y(i2, j2, j3);
}
@Override
public void z(float f2) {
t2.this.c2();
}
}
public static final class d implements i.d.a.b.y4.w, i.d.a.b.y4.b0.d, r3.b {
public i.d.a.b.y4.w f4933n;
public i.d.a.b.y4.b0.d f4934o;
public i.d.a.b.y4.w f4935p;
public i.d.a.b.y4.b0.d f4936q;
public d() {
}
@Override
public void b(long j2, float[] fArr) {
i.d.a.b.y4.b0.d dVar = this.f4936q;
if (dVar != null) {
dVar.b(j2, fArr);
}
i.d.a.b.y4.b0.d dVar2 = this.f4934o;
if (dVar2 != null) {
dVar2.b(j2, fArr);
}
}
@Override
public void e() {
i.d.a.b.y4.b0.d dVar = this.f4936q;
if (dVar != null) {
dVar.e();
}
i.d.a.b.y4.b0.d dVar2 = this.f4934o;
if (dVar2 != null) {
dVar2.e();
}
}
@Override
public void f(long j2, long j3, x2 x2Var, MediaFormat mediaFormat) {
i.d.a.b.y4.w wVar = this.f4935p;
if (wVar != null) {
wVar.f(j2, j3, x2Var, mediaFormat);
}
i.d.a.b.y4.w wVar2 = this.f4933n;
if (wVar2 != null) {
wVar2.f(j2, j3, x2Var, mediaFormat);
}
}
@Override
public void t(int i2, Object obj) {
i.d.a.b.y4.b0.d cameraMotionListener;
if (i2 == 7) {
this.f4933n = (i.d.a.b.y4.w) obj;
} else if (i2 == 8) {
this.f4934o = (i.d.a.b.y4.b0.d) obj;
} else if (i2 != 10000) {
} else {
SphericalGLSurfaceView sphericalGLSurfaceView = (SphericalGLSurfaceView) obj;
if (sphericalGLSurfaceView == null) {
cameraMotionListener = null;
this.f4935p = null;
} else {
this.f4935p = sphericalGLSurfaceView.getVideoFrameMetadataListener();
cameraMotionListener = sphericalGLSurfaceView.getCameraMotionListener();
}
this.f4936q = cameraMotionListener;
}
}
}
public static final class e implements i3 {
public final Object a;
public f4 b;
public e(Object obj, f4 f4Var) {
this.a = obj;
this.b = f4Var;
}
@Override
public Object a() {
return this.a;
}
@Override
public f4 b() {
return this.b;
}
}
static {
v2.a("goog.exo.exoplayer");
}
public t2(s2.b bVar, p3 p3Var) {
i.d.a.b.x4.k kVar = new i.d.a.b.x4.k();
this.d = kVar;
try {
i.d.a.b.x4.u.f("ExoPlayerImpl", "Init " + Integer.toHexString(System.identityHashCode(this)) + " [ExoPlayerLib/2.18.4] [" + i.d.a.b.x4.p0.e + "]");
Context applicationContext = bVar.a.getApplicationContext();
this.e = applicationContext;
i.d.a.b.j4.m1 apply = bVar.f4737i.apply(bVar.b);
this.r = apply;
this.l0 = bVar.f4739k;
this.f0 = bVar.f4740l;
this.Z = bVar.f4745q;
this.a0 = bVar.r;
this.h0 = bVar.f4744p;
this.E = bVar.y;
c cVar = new c();
this.x = cVar;
d dVar = new d();
this.y = dVar;
Handler handler = new Handler(bVar.f4738j);
v3[] a2 = bVar.d.get().a(handler, cVar, cVar, cVar, cVar);
this.f4921g = a2;
i.d.a.b.x4.e.g(a2.length > 0);
i.d.a.b.u4.c0 c0Var = bVar.f4734f.get();
this.f4922h = c0Var;
this.f4931q = bVar.e.get();
i.d.a.b.w4.l lVar = bVar.f4736h.get();
this.t = lVar;
this.f4930p = bVar.s;
this.L = bVar.t;
this.u = bVar.u;
this.v = bVar.v;
this.N = bVar.z;
Looper looper = bVar.f4738j;
this.s = looper;
i.d.a.b.x4.h hVar = bVar.b;
this.w = hVar;
t2 t2Var = p3Var == null ? this : p3Var;
this.f4920f = t2Var;
this.f4926l = new i.d.a.b.x4.t<>(looper, hVar, new t.b() {
@Override
public final void a(Object obj, i.d.a.b.x4.p pVar) {
t2.this.u1((p3.d) obj, pVar);
}
});
this.f4927m = new CopyOnWriteArraySet<>();
this.f4929o = new ArrayList();
this.M = new k0.a(0);
i.d.a.b.u4.d0 d0Var = new i.d.a.b.u4.d0(new y3[a2.length], new i.d.a.b.u4.v[a2.length], g4.f4216o, null);
this.b = d0Var;
this.f4928n = new f4.b();
p3.b.a aVar = new p3.b.a();
aVar.c(1, 2, 3, 13, 14, 15, 16, 17, 18, 19, 31, 20, 30, 21, 22, 23, 24, 25, 26, 27, 28);
aVar.d(29, c0Var.e());
p3.b e2 = aVar.e();
this.c = e2;
p3.b.a aVar2 = new p3.b.a();
aVar2.b(e2);
aVar2.a(4);
aVar2.a(10);
this.O = aVar2.e();
this.f4923i = hVar.d(looper, null);
u2.f fVar = new u2.f() {
@Override
public final void a(u2.e eVar) {
t2.this.y1(eVar);
}
};
this.f4924j = fVar;
this.q0 = n3.j(d0Var);
apply.K0(t2Var, looper);
int i2 = i.d.a.b.x4.p0.a;
u2 u2Var = new u2(a2, c0Var, d0Var, bVar.f4735g.get(), lVar, this.F, this.G, apply, this.L, bVar.w, bVar.x, this.N, looper, hVar, fVar, i2 < 31 ? new i.d.a.b.j4.t1() : b.a(applicationContext, this, bVar.A), bVar.B);
this.f4925k = u2Var;
this.g0 = 1.0f;
this.F = 0;
e3 e3Var = e3.V;
this.P = e3Var;
this.p0 = e3Var;
this.r0 = -1;
this.e0 = i2 < 21 ? q1(0) : i.d.a.b.x4.p0.y(applicationContext);
this.i0 = i.d.a.b.t4.e.f4955o;
this.j0 = true;
I(apply);
lVar.h(new Handler(looper), apply);
V0(cVar);
long j2 = bVar.c;
if (j2 > 0) {
u2Var.q(j2);
}
e2 e2Var = new e2(bVar.a, handler, cVar);
this.z = e2Var;
e2Var.b(bVar.f4743o);
f2 f2Var = new f2(bVar.a, handler, cVar);
this.A = f2Var;
f2Var.m(bVar.f4741m ? this.f0 : null);
d4 d4Var = new d4(bVar.a, handler, cVar);
this.B = d4Var;
d4Var.h(i.d.a.b.x4.p0.X(this.f0.f4379p));
h4 h4Var = new h4(bVar.a);
this.C = h4Var;
h4Var.a(bVar.f4742n != 0);
i4 i4Var = new i4(bVar.a);
this.D = i4Var;
i4Var.a(bVar.f4742n == 2);
this.n0 = a1(d4Var);
this.o0 = i.d.a.b.y4.a0.r;
this.b0 = i.d.a.b.x4.g0.c;
c0Var.i(this.f0);
b2(1, 10, Integer.valueOf(this.e0));
b2(2, 10, Integer.valueOf(this.e0));
b2(1, 3, this.f0);
b2(2, 4, Integer.valueOf(this.Z));
b2(2, 5, Integer.valueOf(this.a0));
b2(1, 9, Boolean.valueOf(this.h0));
b2(2, 7, dVar);
b2(6, 8, dVar);
kVar.e();
} catch (Throwable th) {
this.d.e();
throw th;
}
}
public void E1(p3.d dVar) {
dVar.a0(this.O);
}
public static void G1(int i2, p3.e eVar, p3.e eVar2, p3.d dVar) {
dVar.G(i2);
dVar.C(eVar, eVar2, i2);
}
public static void M1(n3 n3Var, p3.d dVar) {
dVar.E(n3Var.f4521g);
dVar.U(n3Var.f4521g);
}
public static p2 a1(d4 d4Var) {
return new p2(0, d4Var.d(), d4Var.c());
}
public static int i1(boolean z, int i2) {
return (!z || i2 == 1) ? 1 : 2;
}
public static long o1(n3 n3Var) {
f4.d dVar = new f4.d();
f4.b bVar = new f4.b();
n3Var.a.k(n3Var.b.a, bVar);
return n3Var.c == -9223372036854775807L ? n3Var.a.q(bVar.f4201p, dVar).d() : bVar.q() + n3Var.c;
}
public static boolean r1(n3 n3Var) {
return n3Var.e == 3 && n3Var.f4526l && n3Var.f4527m == 0;
}
public void u1(p3.d dVar, i.d.a.b.x4.p pVar) {
dVar.E0(this.f4920f, new p3.c(pVar));
}
public void y1(final u2.e eVar) {
this.f4923i.b(new Runnable() {
@Override
public final void run() {
t2.this.w1(eVar);
}
});
}
@Override
public void D(boolean z) {
r2();
int p2 = this.A.p(z, l());
n2(z, p2, i1(z, p2));
}
@Override
public void E(final int i2) {
r2();
if (this.F != i2) {
this.F = i2;
this.f4925k.T0(i2);
this.f4926l.h(8, new t.a() {
@Override
public final void invoke(Object obj) {
((p3.d) obj).B(i2);
}
});
m2();
this.f4926l.d();
}
}
@Override
public long F() {
r2();
return this.v;
}
@Override
public long G() {
r2();
if (g()) {
n3 n3Var = this.q0;
n3Var.a.k(n3Var.b.a, this.f4928n);
n3 n3Var2 = this.q0;
return n3Var2.c == -9223372036854775807L ? n3Var2.a.q(R(), this.a).c() : this.f4928n.p() + i.d.a.b.x4.p0.O0(this.q0.c);
}
return getCurrentPosition();
}
@Override
public int H() {
r2();
return this.F;
}
@Override
public void I(p3.d dVar) {
i.d.a.b.x4.t<p3.d> tVar = this.f4926l;
i.d.a.b.x4.e.e(dVar);
tVar.a(dVar);
}
@Override
public long K() {
r2();
if (g()) {
n3 n3Var = this.q0;
return n3Var.f4525k.equals(n3Var.b) ? i.d.a.b.x4.p0.O0(this.q0.f4530p) : getDuration();
}
return a0();
}
@Override
public void M(final i.d.a.b.u4.a0 a0Var) {
r2();
if (!this.f4922h.e() || a0Var.equals(this.f4922h.b())) {
return;
}
this.f4922h.j(a0Var);
this.f4926l.k(19, new t.a() {
@Override
public final void invoke(Object obj) {
((p3.d) obj).z1(i.d.a.b.u4.a0.this);
}
});
}
@Override
public g4 N() {
r2();
return this.q0.f4523i.d;
}
@Override
public i.d.a.b.t4.e P() {
r2();
return this.i0;
}
@Override
public int Q() {
r2();
if (g()) {
return this.q0.b.b;
}
return -1;
}
@Override
public int R() {
r2();
int g1 = g1();
if (g1 == -1) {
return 0;
}
return g1;
}
@Override
public void T(SurfaceView surfaceView) {
r2();
Z0(surfaceView == null ? null : surfaceView.getHolder());
}
public final n3 T1(n3 n3Var, f4 f4Var, Pair<Object, Long> pair) {
int i2;
long j2;
i.d.a.b.x4.e.a(f4Var.t() || pair != null);
f4 f4Var2 = n3Var.a;
n3 i3 = n3Var.i(f4Var);
if (f4Var.t()) {
c0.b k2 = n3.k();
long u0 = i.d.a.b.x4.p0.u0(this.t0);
n3 b2 = i3.c(k2, u0, u0, u0, 0L, i.d.a.b.s4.n0.f4796q, this.b, i.d.b.b.q.F()).b(k2);
b2.f4530p = b2.r;
return b2;
}
Object obj = i3.b.a;
i.d.a.b.x4.p0.h(pair);
boolean z = !obj.equals(pair.first);
c0.b bVar = z ? new c0.b(pair.first) : i3.b;
long longValue = ((Long) pair.second).longValue();
long u02 = i.d.a.b.x4.p0.u0(G());
if (!f4Var2.t()) {
u02 -= f4Var2.k(obj, this.f4928n).q();
}
if (z || longValue < u02) {
i.d.a.b.x4.e.g(!bVar.b());
n3 b3 = i3.c(bVar, longValue, longValue, longValue, 0L, z ? i.d.a.b.s4.n0.f4796q : i3.f4522h, z ? this.b : i3.f4523i, z ? i.d.b.b.q.F() : i3.f4524j).b(bVar);
b3.f4530p = longValue;
return b3;
}
if (i2 == 0) {
int e2 = f4Var.e(i3.f4525k.a);
if (e2 == -1 || f4Var.i(e2, this.f4928n).f4201p != f4Var.k(bVar.a, this.f4928n).f4201p) {
f4Var.k(bVar.a, this.f4928n);
j2 = bVar.b() ? this.f4928n.d(bVar.b, bVar.c) : this.f4928n.f4202q;
i3 = i3.c(bVar, i3.r, i3.r, i3.d, j2 - i3.r, i3.f4522h, i3.f4523i, i3.f4524j).b(bVar);
}
return i3;
}
i.d.a.b.x4.e.g(!bVar.b());
long max = Math.max(0L, i3.f4531q - (longValue - u02));
j2 = i3.f4530p;
if (i3.f4525k.equals(i3.b)) {
j2 = longValue + max;
}
i3 = i3.c(bVar, longValue, longValue, longValue, max, i3.f4522h, i3.f4523i, i3.f4524j);
i3.f4530p = j2;
return i3;
}
public final Pair<Object, Long> U1(f4 f4Var, int i2, long j2) {
if (f4Var.t()) {
this.r0 = i2;
if (j2 == -9223372036854775807L) {
j2 = 0;
}
this.t0 = j2;
this.s0 = 0;
return null;
}
if (i2 == -1 || i2 >= f4Var.s()) {
i2 = f4Var.d(this.G);
j2 = f4Var.q(i2, this.a).c();
}
return f4Var.m(this.a, this.f4928n, i2, i.d.a.b.x4.p0.u0(j2));
}
@Override
public int V() {
r2();
return this.q0.f4527m;
}
public void V0(s2.a aVar) {
this.f4927m.add(aVar);
}
public final void V1(final int i2, final int i3) {
if (i2 == this.b0.b() && i3 == this.b0.a()) {
return;
}
this.b0 = new i.d.a.b.x4.g0(i2, i3);
this.f4926l.k(24, new t.a() {
@Override
public final void invoke(Object obj) {
((p3.d) obj).A1(i2, i3);
}
});
}
@Override
public f4 W() {
r2();
return this.q0.a;
}
public final List<j3.c> W0(int i2, List<i.d.a.b.s4.c0> list) {
ArrayList arrayList = new ArrayList();
for (int i3 = 0; i3 < list.size(); i3++) {
j3.c cVar = new j3.c(list.get(i3), this.f4930p);
arrayList.add(cVar);
this.f4929o.add(i3 + i2, new e(cVar.b, cVar.a.U()));
}
this.M = this.M.f(i2, arrayList.size());
return arrayList;
}
public final long W1(f4 f4Var, c0.b bVar, long j2) {
f4Var.k(bVar.a, this.f4928n);
return j2 + this.f4928n.q();
}
@Override
public Looper X() {
return this.s;
}
public final e3 X0() {
f4 W = W();
if (W.t()) {
return this.p0;
}
d3 d3Var = W.q(R(), this.a).f4205p;
e3.b a2 = this.p0.a();
a2.J(d3Var.f4116q);
return a2.H();
}
public void X1() {
AudioTrack audioTrack;
i.d.a.b.x4.u.f("ExoPlayerImpl", "Release " + Integer.toHexString(System.identityHashCode(this)) + " [ExoPlayerLib/2.18.4] [" + i.d.a.b.x4.p0.e + "] [" + v2.b() + "]");
r2();
if (i.d.a.b.x4.p0.a < 21 && (audioTrack = this.S) != null) {
audioTrack.release();
this.S = null;
}
this.z.b(false);
this.B.g();
this.C.b(false);
this.D.b(false);
this.A.i();
if (!this.f4925k.j0()) {
this.f4926l.k(10, new t.a() {
@Override
public final void invoke(Object obj) {
((p3.d) obj).Y(q2.j(new w2(1), 1003));
}
});
}
this.f4926l.i();
this.f4923i.k(null);
this.t.e(this.r);
n3 g2 = this.q0.g(1);
this.q0 = g2;
n3 b2 = g2.b(g2.b);
this.q0 = b2;
b2.f4530p = b2.r;
this.q0.f4531q = 0L;
this.r.a();
this.f4922h.g();
a2();
Surface surface = this.U;
if (surface != null) {
surface.release();
this.U = null;
}
if (this.m0) {
i.d.a.b.x4.e0 e0Var = this.l0;
i.d.a.b.x4.e.e(e0Var);
e0Var.b(0);
this.m0 = false;
}
this.i0 = i.d.a.b.t4.e.f4955o;
}
@Override
public boolean Y() {
r2();
return this.G;
}
public void Y0() {
r2();
a2();
j2(null);
V1(0, 0);
}
public final n3 Y1(int i2, int i3) {
int R = R();
f4 W = W();
int size = this.f4929o.size();
boolean z = true;
this.H++;
Z1(i2, i3);
f4 b1 = b1();
n3 T1 = T1(this.q0, b1, h1(W, b1));
int i4 = T1.e;
if ((i4 == 1 || i4 == 4 || i2 >= i3 || i3 != size || R < T1.a.s()) ? false : false) {
T1 = T1.g(4);
}
this.f4925k.m0(i2, i3, this.M);
return T1;
}
@Override
public i.d.a.b.u4.a0 Z() {
r2();
return this.f4922h.b();
}
public void Z0(SurfaceHolder surfaceHolder) {
r2();
if (surfaceHolder == null || surfaceHolder != this.V) {
return;
}
Y0();
}
public final void Z1(int i2, int i3) {
for (int i4 = i3 - 1; i4 >= i2; i4--) {
this.f4929o.remove(i4);
}
this.M = this.M.b(i2, i3);
}
@Override
public void a(i.d.a.b.j4.o1 o1Var) {
r2();
i.d.a.b.j4.m1 m1Var = this.r;
i.d.a.b.x4.e.e(o1Var);
m1Var.n1(o1Var);
}
@Override
public long a0() {
r2();
if (this.q0.a.t()) {
return this.t0;
}
n3 n3Var = this.q0;
if (n3Var.f4525k.d != n3Var.b.d) {
return n3Var.a.q(R(), this.a).e();
}
long j2 = n3Var.f4530p;
if (this.q0.f4525k.b()) {
n3 n3Var2 = this.q0;
f4.b k2 = n3Var2.a.k(n3Var2.f4525k.a, this.f4928n);
long h2 = k2.h(this.q0.f4525k.b);
j2 = h2 == Long.MIN_VALUE ? k2.f4202q : h2;
}
n3 n3Var3 = this.q0;
return i.d.a.b.x4.p0.O0(W1(n3Var3.a, n3Var3.f4525k, j2));
}
public final void a2() {
if (this.W != null) {
r3 c1 = c1(this.y);
c1.n(XCallback.PRIORITY_HIGHEST);
c1.m(null);
c1.l();
this.W.i(this.x);
this.W = null;
}
TextureView textureView = this.Y;
if (textureView != null) {
if (textureView.getSurfaceTextureListener() != this.x) {
i.d.a.b.x4.u.i("ExoPlayerImpl", "SurfaceTextureListener already unset or replaced.");
} else {
this.Y.setSurfaceTextureListener(null);
}
this.Y = null;
}
SurfaceHolder surfaceHolder = this.V;
if (surfaceHolder != null) {
surfaceHolder.removeCallback(this.x);
this.V = null;
}
}
@Override
public i.d.a.b.s4.n0 b() {
r2();
return this.q0.f4522h;
}
public final f4 b1() {
return new s3(this.f4929o, this.M);
}
public final void b2(int i2, int i3, Object obj) {
v3[] v3VarArr;
for (v3 v3Var : this.f4921g) {
if (v3Var.i() == i2) {
r3 c1 = c1(v3Var);
c1.n(i3);
c1.m(obj);
c1.l();
}
}
}
@Override
public void c(i.d.a.b.j4.o1 o1Var) {
i.d.a.b.j4.m1 m1Var = this.r;
i.d.a.b.x4.e.e(o1Var);
m1Var.o1(o1Var);
}
public final r3 c1(r3.b bVar) {
int g1 = g1();
u2 u2Var = this.f4925k;
return new r3(u2Var, bVar, this.q0.a, g1 == -1 ? 0 : g1, this.w, u2Var.y());
}
public final void c2() {
b2(1, 2, Float.valueOf(this.g0 * this.A.g()));
}
@Override
public void d0(TextureView textureView) {
r2();
if (textureView == null) {
Y0();
return;
}
a2();
this.Y = textureView;
if (textureView.getSurfaceTextureListener() != null) {
i.d.a.b.x4.u.i("ExoPlayerImpl", "Replacing existing SurfaceTextureListener.");
}
textureView.setSurfaceTextureListener(this.x);
SurfaceTexture surfaceTexture = textureView.isAvailable() ? textureView.getSurfaceTexture() : null;
if (surfaceTexture == null) {
j2(null);
V1(0, 0);
return;
}
i2(surfaceTexture);
V1(textureView.getWidth(), textureView.getHeight());
}
public final Pair<Boolean, Integer> d1(n3 n3Var, n3 n3Var2, boolean z, int i2, boolean z2, boolean z3) {
f4 f4Var = n3Var2.a;
f4 f4Var2 = n3Var.a;
if (f4Var2.t() && f4Var.t()) {
return new Pair<>(Boolean.FALSE, -1);
}
int i3 = 3;
if (f4Var2.t() != f4Var.t()) {
return new Pair<>(Boolean.TRUE, 3);
}
if (f4Var.q(f4Var.k(n3Var2.b.a, this.f4928n).f4201p, this.a).f4203n.equals(f4Var2.q(f4Var2.k(n3Var.b.a, this.f4928n).f4201p, this.a).f4203n)) {
return (z && i2 == 0 && n3Var2.b.d < n3Var.b.d) ? new Pair<>(Boolean.TRUE, 0) : (z && i2 == 1 && z3) ? new Pair<>(Boolean.TRUE, 2) : new Pair<>(Boolean.FALSE, -1);
}
if (z && i2 == 0) {
i3 = 1;
} else if (z && i2 == 1) {
i3 = 2;
} else if (!z2) {
throw new IllegalStateException();
}
return new Pair<>(Boolean.TRUE, Integer.valueOf(i3));
}
public void d2(i.d.a.b.s4.c0 c0Var) {
r2();
e2(Collections.singletonList(c0Var));
}
@Override
public o3 e() {
r2();
return this.q0.f4528n;
}
public boolean e1() {
r2();
return this.q0.f4529o;
}
public void e2(List<i.d.a.b.s4.c0> list) {
r2();
f2(list, true);
}
@Override
public void f(o3 o3Var) {
r2();
if (o3Var == null) {
o3Var = o3.f4548q;
}
if (this.q0.f4528n.equals(o3Var)) {
return;
}
n3 f2 = this.q0.f(o3Var);
this.H++;
this.f4925k.R0(o3Var);
o2(f2, 0, 1, false, false, 5, -9223372036854775807L, -1, false);
}
@Override
public e3 f0() {
r2();
return this.P;
}
public final long f1(n3 n3Var) {
return n3Var.a.t() ? i.d.a.b.x4.p0.u0(this.t0) : n3Var.b.b() ? n3Var.r : W1(n3Var.a, n3Var.b, n3Var.r);
}
public void f2(List<i.d.a.b.s4.c0> list, boolean z) {
r2();
g2(list, -1, -9223372036854775807L, z);
}
@Override
public boolean g() {
r2();
return this.q0.b.b();
}
@Override
public long g0() {
r2();
return this.u;
}
public final int g1() {
if (this.q0.a.t()) {
return this.r0;
}
n3 n3Var = this.q0;
return n3Var.a.k(n3Var.b.a, this.f4928n).f4201p;
}
public final void g2(List<i.d.a.b.s4.c0> list, int i2, long j2, boolean z) {
int i3;
long j3;
int g1 = g1();
long currentPosition = getCurrentPosition();
boolean z2 = true;
this.H++;
if (!this.f4929o.isEmpty()) {
Z1(0, this.f4929o.size());
}
List<j3.c> W0 = W0(0, list);
f4 b1 = b1();
if (!b1.t() && i2 >= b1.s()) {
throw new a3(b1, i2, j2);
}
if (z) {
j3 = -9223372036854775807L;
i3 = b1.d(this.G);
} else if (i2 == -1) {
i3 = g1;
j3 = currentPosition;
} else {
i3 = i2;
j3 = j2;
}
n3 T1 = T1(this.q0, b1, U1(b1, i3, j3));
int i4 = T1.e;
if (i3 != -1 && i4 != 1) {
i4 = (b1.t() || i3 >= b1.s()) ? 4 : 2;
}
n3 g2 = T1.g(i4);
this.f4925k.M0(W0, i3, i.d.a.b.x4.p0.u0(j3), this.M);
o2(g2, 0, 1, false, (this.q0.b.a.equals(g2.b.a) || this.q0.a.t()) ? false : false, 4, f1(g2), -1, false);
}
@Override
public long getCurrentPosition() {
r2();
return i.d.a.b.x4.p0.O0(f1(this.q0));
}
@Override
public long getDuration() {
r2();
if (g()) {
n3 n3Var = this.q0;
c0.b bVar = n3Var.b;
n3Var.a.k(bVar.a, this.f4928n);
return i.d.a.b.x4.p0.O0(this.f4928n.d(bVar.b, bVar.c));
}
return p();
}
@Override
public long h() {
r2();
return i.d.a.b.x4.p0.O0(this.q0.f4531q);
}
public final Pair<Object, Long> h1(f4 f4Var, f4 f4Var2) {
long G = G();
if (f4Var.t() || f4Var2.t()) {
boolean z = !f4Var.t() && f4Var2.t();
int g1 = z ? -1 : g1();
if (z) {
G = -9223372036854775807L;
}
return U1(f4Var2, g1, G);
}
Pair<Object, Long> m2 = f4Var.m(this.a, this.f4928n, R(), i.d.a.b.x4.p0.u0(G));
i.d.a.b.x4.p0.h(m2);
Object obj = m2.first;
if (f4Var2.e(obj) != -1) {
return m2;
}
Object x0 = u2.x0(this.a, this.f4928n, this.F, this.G, obj, f4Var, f4Var2);
if (x0 != null) {
f4Var2.k(x0, this.f4928n);
int i2 = this.f4928n.f4201p;
return U1(f4Var2, i2, f4Var2.q(i2, this.a).c());
}
return U1(f4Var2, -1, -9223372036854775807L);
}
public final void h2(SurfaceHolder surfaceHolder) {
this.X = false;
this.V = surfaceHolder;
surfaceHolder.addCallback(this.x);
Surface surface = this.V.getSurface();
if (surface == null || !surface.isValid()) {
V1(0, 0);
return;
}
Rect surfaceFrame = this.V.getSurfaceFrame();
V1(surfaceFrame.width(), surfaceFrame.height());
}
public final void i2(SurfaceTexture surfaceTexture) {
Surface surface = new Surface(surfaceTexture);
j2(surface);
this.U = surface;
}
@Override
public p3.b j() {
r2();
return this.O;
}
@Override
public q2 C() {
r2();
return this.q0.f4520f;
}
public final void j2(Object obj) {
boolean z;
ArrayList<r3> arrayList = new ArrayList();
v3[] v3VarArr = this.f4921g;
int length = v3VarArr.length;
int i2 = 0;
while (true) {
z = true;
if (i2 >= length) {
break;
}
v3 v3Var = v3VarArr[i2];
if (v3Var.i() == 2) {
r3 c1 = c1(v3Var);
c1.n(1);
c1.m(obj);
c1.l();
arrayList.add(c1);
}
i2++;
}
Object obj2 = this.T;
if (obj2 == null || obj2 == obj) {
z = false;
} else {
try {
for (r3 r3Var : arrayList) {
r3Var.a(this.E);
}
} catch (InterruptedException unused) {
Thread.currentThread().interrupt();
} catch (TimeoutException unused2) {
}
z = false;
Object obj3 = this.T;
Surface surface = this.U;
if (obj3 == surface) {
surface.release();
this.U = null;
}
}
this.T = obj;
if (z) {
l2(false, q2.j(new w2(3), 1003));
}
}
@Override
public boolean k() {
r2();
return this.q0.f4526l;
}
public final p3.e k1(long j2) {
d3 d3Var;
Object obj;
int i2;
int R = R();
Object obj2 = null;
if (this.q0.a.t()) {
d3Var = null;
obj = null;
i2 = -1;
} else {
n3 n3Var = this.q0;
Object obj3 = n3Var.b.a;
n3Var.a.k(obj3, this.f4928n);
i2 = this.q0.a.e(obj3);
obj = obj3;
obj2 = this.q0.a.q(R, this.a).f4203n;
d3Var = this.a.f4205p;
}
long O0 = i.d.a.b.x4.p0.O0(j2);
long O02 = this.q0.b.b() ? i.d.a.b.x4.p0.O0(o1(this.q0)) : O0;
c0.b bVar = this.q0.b;
return new p3.e(obj2, R, d3Var, obj, i2, O0, O02, bVar.b, bVar.c);
}
public void k2(SurfaceHolder surfaceHolder) {
r2();
if (surfaceHolder == null) {
Y0();
return;
}
a2();
this.X = true;
this.V = surfaceHolder;
surfaceHolder.addCallback(this.x);
Surface surface = surfaceHolder.getSurface();
if (surface == null || !surface.isValid()) {
j2(null);
V1(0, 0);
return;
}
j2(surface);
Rect surfaceFrame = surfaceHolder.getSurfaceFrame();
V1(surfaceFrame.width(), surfaceFrame.height());
}
@Override
public int l() {
r2();
return this.q0.e;
}
public final p3.e l1(int i2, n3 n3Var, int i3) {
int i4;
Object obj;
d3 d3Var;
Object obj2;
int i5;
long j2;
long j3;
f4.b bVar = new f4.b();
if (n3Var.a.t()) {
i4 = i3;
obj = null;
d3Var = null;
obj2 = null;
i5 = -1;
} else {
Object obj3 = n3Var.b.a;
n3Var.a.k(obj3, bVar);
int i6 = bVar.f4201p;
i4 = i6;
obj2 = obj3;
i5 = n3Var.a.e(obj3);
obj = n3Var.a.q(i6, this.a).f4203n;
d3Var = this.a.f4205p;
}
boolean b2 = n3Var.b.b();
if (i2 == 0) {
if (b2) {
c0.b bVar2 = n3Var.b;
j2 = bVar.d(bVar2.b, bVar2.c);
j3 = o1(n3Var);
} else {
j2 = n3Var.b.e != -1 ? o1(this.q0) : bVar.r + bVar.f4202q;
j3 = j2;
}
} else if (b2) {
j2 = n3Var.r;
j3 = o1(n3Var);
} else {
j2 = bVar.r + n3Var.r;
j3 = j2;
}
long O0 = i.d.a.b.x4.p0.O0(j2);
long O02 = i.d.a.b.x4.p0.O0(j3);
c0.b bVar3 = n3Var.b;
return new p3.e(obj, i4, d3Var, obj2, i5, O0, O02, bVar3.b, bVar3.c);
}
public final void l2(boolean z, q2 q2Var) {
n3 b2;
if (z) {
b2 = Y1(0, this.f4929o.size()).e(null);
} else {
n3 n3Var = this.q0;
b2 = n3Var.b(n3Var.b);
b2.f4530p = b2.r;
b2.f4531q = 0L;
}
n3 g2 = b2.g(1);
if (q2Var != null) {
g2 = g2.e(q2Var);
}
n3 n3Var2 = g2;
this.H++;
this.f4925k.g1();
o2(n3Var2, 0, 1, false, n3Var2.a.t() && !this.q0.a.t(), 4, f1(n3Var2), -1, false);
}
public int m1() {
r2();
return this.f4921g.length;
}
public final void m2() {
p3.b bVar = this.O;
p3.b A = i.d.a.b.x4.p0.A(this.f4920f, this.c);
this.O = A;
if (A.equals(bVar)) {
return;
}
this.f4926l.h(13, new t.a() {
@Override
public final void invoke(Object obj) {
t2.this.E1((p3.d) obj);
}
});
}
@Override
public void n(final boolean z) {
r2();
if (this.G != z) {
this.G = z;
this.f4925k.W0(z);
this.f4926l.h(9, new t.a() {
@Override
public final void invoke(Object obj) {
((p3.d) obj).z0(z);
}
});
m2();
this.f4926l.d();
}
}
@Override
public void n0(int i2, long j2, int i3, boolean z) {
r2();
i.d.a.b.x4.e.a(i2 >= 0);
this.r.w0();
f4 f4Var = this.q0.a;
if (f4Var.t() || i2 < f4Var.s()) {
this.H++;
if (g()) {
i.d.a.b.x4.u.i("ExoPlayerImpl", "seekTo ignored because an ad is playing");
u2.e eVar = new u2.e(this.q0);
eVar.b(1);
this.f4924j.a(eVar);
return;
}
int i4 = l() != 1 ? 2 : 1;
int R = R();
n3 T1 = T1(this.q0.g(i4), f4Var, U1(f4Var, i2, j2));
this.f4925k.z0(f4Var, i2, i.d.a.b.x4.p0.u0(j2));
o2(T1, 0, 1, true, true, 1, f1(T1), R, z);
}
}
public int n1(int i2) {
r2();
return this.f4921g[i2].i();
}
public final void n2(boolean z, int i2, int i3) {
int i4 = 0;
boolean z2 = z && i2 != -1;
if (z2 && i2 != 1) {
i4 = 1;
}
n3 n3Var = this.q0;
if (n3Var.f4526l == z2 && n3Var.f4527m == i4) {
return;
}
this.H++;
n3 d2 = n3Var.d(z2, i4);
this.f4925k.P0(z2, i4);
o2(d2, 0, i3, false, false, 5, -9223372036854775807L, -1, false);
}
@Override
public long o() {
r2();
return 3000L;
}
public final void o2(final n3 n3Var, final int i2, final int i3, boolean z, boolean z2, final int i4, long j2, int i5, boolean z3) {
n3 n3Var2 = this.q0;
this.q0 = n3Var;
boolean z4 = !n3Var2.a.equals(n3Var.a);
Pair<Boolean, Integer> d1 = d1(n3Var, n3Var2, z2, i4, z4, z3);
boolean booleanValue = ((Boolean) d1.first).booleanValue();
final int intValue = ((Integer) d1.second).intValue();
e3 e3Var = this.P;
if (booleanValue) {
r3 = n3Var.a.t() ? null : n3Var.a.q(n3Var.a.k(n3Var.b.a, this.f4928n).f4201p, this.a).f4205p;
this.p0 = e3.V;
}
if (booleanValue || !n3Var2.f4524j.equals(n3Var.f4524j)) {
e3.b a2 = this.p0.a();
a2.L(n3Var.f4524j);
this.p0 = a2.H();
e3Var = X0();
}
boolean z5 = !e3Var.equals(this.P);
this.P = e3Var;
boolean z6 = n3Var2.f4526l != n3Var.f4526l;
boolean z7 = n3Var2.e != n3Var.e;
if (z7 || z6) {
q2();
}
boolean z8 = n3Var2.f4521g;
boolean z9 = n3Var.f4521g;
boolean z10 = z8 != z9;
if (z10) {
p2(z9);
}
if (z4) {
this.f4926l.h(0, new t.a() {
@Override
public final void invoke(Object obj) {
p3.d dVar = (p3.d) obj;
dVar.k0(n3.this.a, i2);
}
});
}
if (z2) {
final p3.e l1 = l1(i4, n3Var2, i5);
final p3.e k1 = k1(j2);
this.f4926l.h(11, new t.a() {
@Override
public final void invoke(Object obj) {
t2.G1(i4, l1, k1, (p3.d) obj);
}
});
}
if (booleanValue) {
this.f4926l.h(1, new t.a() {
@Override
public final void invoke(Object obj) {
((p3.d) obj).h1(d3.this, intValue);
}
});
}
if (n3Var2.f4520f != n3Var.f4520f) {
this.f4926l.h(10, new t.a() {
@Override
public final void invoke(Object obj) {
((p3.d) obj).F1(n3.this.f4520f);
}
});
if (n3Var.f4520f != null) {
this.f4926l.h(10, new t.a() {
@Override
public final void invoke(Object obj) {
((p3.d) obj).Y(n3.this.f4520f);
}
});
}
}
i.d.a.b.u4.d0 d0Var = n3Var2.f4523i;
i.d.a.b.u4.d0 d0Var2 = n3Var.f4523i;
if (d0Var != d0Var2) {
this.f4922h.f(d0Var2.e);
this.f4926l.h(2, new t.a() {
@Override
public final void invoke(Object obj) {
((p3.d) obj).Q(n3.this.f4523i.d);
}
});
}
if (z5) {
final e3 e3Var2 = this.P;
this.f4926l.h(14, new t.a() {
@Override
public final void invoke(Object obj) {
((p3.d) obj).x0(e3.this);
}
});
}
if (z10) {
this.f4926l.h(3, new t.a() {
@Override
public final void invoke(Object obj) {
t2.M1(n3.this, (p3.d) obj);
}
});
}
if (z7 || z6) {
this.f4926l.h(-1, new t.a() {
@Override
public final void invoke(Object obj) {
((p3.d) obj).n(r0.f4526l, n3.this.e);
}
});
}
if (z7) {
this.f4926l.h(4, new t.a() {
@Override
public final void invoke(Object obj) {
((p3.d) obj).q0(n3.this.e);
}
});
}
if (z6) {
this.f4926l.h(5, new t.a() {
@Override
public final void invoke(Object obj) {
p3.d dVar = (p3.d) obj;
dVar.r1(n3.this.f4526l, i3);
}
});
}
if (n3Var2.f4527m != n3Var.f4527m) {
this.f4926l.h(6, new t.a() {
@Override
public final void invoke(Object obj) {
((p3.d) obj).D(n3.this.f4527m);
}
});
}
if (r1(n3Var2) != r1(n3Var)) {
this.f4926l.h(7, new t.a() {
@Override
public final void invoke(Object obj) {
((p3.d) obj).K1(t2.r1(n3.this));
}
});
}
if (!n3Var2.f4528n.equals(n3Var.f4528n)) {
this.f4926l.h(12, new t.a() {
@Override
public final void invoke(Object obj) {
((p3.d) obj).x(n3.this.f4528n);
}
});
}
if (z) {
this.f4926l.h(-1, new t.a() {
@Override
public final void invoke(Object obj) {
((p3.d) obj).X();
}
});
}
m2();
this.f4926l.d();
if (n3Var2.f4529o != n3Var.f4529o) {
Iterator<s2.a> it = this.f4927m.iterator();
while (it.hasNext()) {
it.next().x(n3Var.f4529o);
}
}
}
public final void w1(u2.e eVar) {
long j2;
boolean z;
long j3;
int i2 = this.H - eVar.c;
this.H = i2;
boolean z2 = true;
if (eVar.d) {
this.I = eVar.e;
this.J = true;
}
if (eVar.f5130f) {
this.K = eVar.f5131g;
}
if (i2 == 0) {
f4 f4Var = eVar.b.a;
if (!this.q0.a.t() && f4Var.t()) {
this.r0 = -1;
this.t0 = 0L;
this.s0 = 0;
}
if (!f4Var.t()) {
List<f4> I = ((s3) f4Var).I();
i.d.a.b.x4.e.g(I.size() == this.f4929o.size());
for (int i3 = 0; i3 < I.size(); i3++) {
this.f4929o.get(i3).b = I.get(i3);
}
}
if (this.J) {
if (eVar.b.b.equals(this.q0.b) && eVar.b.d == this.q0.r) {
z2 = false;
}
if (z2) {
if (f4Var.t() || eVar.b.b.b()) {
j3 = eVar.b.d;
} else {
n3 n3Var = eVar.b;
j3 = W1(f4Var, n3Var.b, n3Var.d);
}
j2 = j3;
} else {
j2 = -9223372036854775807L;
}
z = z2;
} else {
j2 = -9223372036854775807L;
z = false;
}
this.J = false;
o2(eVar.b, 1, this.K, false, z, this.I, j2, -1, false);
}
}
public final void p2(boolean z) {
i.d.a.b.x4.e0 e0Var = this.l0;
if (e0Var != null) {
if (z && !this.m0) {
e0Var.a(0);
this.m0 = true;
} else if (z || !this.m0) {
} else {
e0Var.b(0);
this.m0 = false;
}
}
}
@Override
public int q() {
r2();
if (this.q0.a.t()) {
return this.s0;
}
n3 n3Var = this.q0;
return n3Var.a.e(n3Var.b.a);
}
public final int q1(int i2) {
AudioTrack audioTrack = this.S;
if (audioTrack != null && audioTrack.getAudioSessionId() != i2) {
this.S.release();
this.S = null;
}
if (this.S == null) {
this.S = new AudioTrack(3, 4000, 4, 2, 2, 0, i2);
}
return this.S.getAudioSessionId();
}
public final void q2() {
int l2 = l();
boolean z = true;
if (l2 != 1) {
if (l2 == 2 || l2 == 3) {
this.C.b((!k() || e1()) ? false : false);
this.D.b(k());
return;
} else if (l2 != 4) {
throw new IllegalStateException();
}
}
this.C.b(false);
this.D.b(false);
}
@Override
public void r() {
r2();
boolean k2 = k();
int p2 = this.A.p(k2, 2);
n2(k2, p2, i1(k2, p2));
n3 n3Var = this.q0;
if (n3Var.e != 1) {
return;
}
n3 e2 = n3Var.e(null);
n3 g2 = e2.g(e2.a.t() ? 4 : 2);
this.H++;
this.f4925k.h0();
o2(g2, 1, 1, false, false, 5, -9223372036854775807L, -1, false);
}
public final void r2() {
this.d.b();
if (Thread.currentThread() != X().getThread()) {
String v = i.d.a.b.x4.p0.v("Player is accessed on the wrong thread.\nCurrent thread: '%s'\nExpected thread: '%s'\nSee https://exoplayer.dev/issues/player-accessed-on-wrong-thread", Thread.currentThread().getName(), X().getThread().getName());
if (this.j0) {
throw new IllegalStateException(v);
}
i.d.a.b.x4.u.j("ExoPlayerImpl", v, this.k0 ? null : new IllegalStateException());
this.k0 = true;
}
}
@Override
public void t(TextureView textureView) {
r2();
if (textureView == null || textureView != this.Y) {
return;
}
Y0();
}
@Override
public i.d.a.b.y4.a0 u() {
r2();
return this.o0;
}
@Override
public void v(p3.d dVar) {
r2();
i.d.a.b.x4.t<p3.d> tVar = this.f4926l;
i.d.a.b.x4.e.e(dVar);
tVar.j(dVar);
}
@Override
public int y() {
r2();
if (g()) {
return this.q0.b.c;
}
return -1;
}
@Override
public void z(SurfaceView surfaceView) {
r2();
if (surfaceView instanceof i.d.a.b.y4.v) {
a2();
j2(surfaceView);
} else if (!(surfaceView instanceof SphericalGLSurfaceView)) {
k2(surfaceView == null ? null : surfaceView.getHolder());
return;
} else {
a2();
this.W = (SphericalGLSurfaceView) surfaceView;
r3 c1 = c1(this.y);
c1.n(XCallback.PRIORITY_HIGHEST);
c1.m(this.W);
c1.l();
this.W.b(this.x);
j2(this.W.getVideoSurface());
}
h2(surfaceView.getHolder());
}
}