Cyber Surfer v5.2.5版本的 MD5 值为:db13c5fce988de393e52d2679f934b22
以下内容为反编译后的 zv.java 源代码,内容仅作参考
package com.yandex.mobile.ads.impl;
import android.content.Context;
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.TextureView;
import com.monetization.ads.exo.metadata.Metadata;
import com.yandex.mobile.ads.impl.bw;
import com.yandex.mobile.ads.impl.eg0;
import com.yandex.mobile.ads.impl.fc0;
import com.yandex.mobile.ads.impl.hg0;
import com.yandex.mobile.ads.impl.nx0;
import com.yandex.mobile.ads.impl.rx0;
import com.yandex.mobile.ads.impl.sc1;
import com.yandex.mobile.ads.impl.sd1;
import com.yandex.mobile.ads.impl.uc;
import com.yandex.mobile.ads.impl.uf1;
import com.yandex.mobile.ads.impl.vf0;
import com.yandex.mobile.ads.impl.wv;
import com.yandex.mobile.ads.impl.xc;
import com.yandex.mobile.ads.impl.z91;
import com.yandex.mobile.ads.impl.zv;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.CopyOnWriteArraySet;
import java.util.concurrent.TimeoutException;
public final class zv extends of implements wv {
private int A;
private int B;
private boolean C;
private int D;
private g91 E;
private z91 F;
private nx0.a G;
private vf0 H;
private AudioTrack I;
private Object J;
private Surface K;
private TextureView L;
private int M;
private int N;
private int O;
private int P;
private tc Q;
private float R;
private boolean S;
private boolean T;
private boolean U;
private ks V;
private vf0 W;
private hx0 X;
private int Y;
private long Z;
final pg1 f15473b;
final nx0.a c;
private final pl d;
private final nx0 e;
private final d21[] f;
private final og1 g;
private final u10 h;
private final bw i;
private final fc0<nx0.b> j;
private final CopyOnWriteArraySet<wv.a> k;
private final uf1.b l;
private final ArrayList m;
private final boolean n;
private final eg0.a o;
private final q9 p;
private final Looper q;
private final zd r;
private final ne1 s;
private final b t;
private final uc u;
private final xc v;
private final sd1 w;
private final hr1 x;
private final ds1 y;
private final long z;
private static final class a {
public static qx0 a(Context context, zv zvVar, boolean z) {
wf0 a2 = wf0.a(context);
if (a2 == null) {
dd0.d("ExoPlayerImpl", "MediaMetricsService unavailable.");
return new qx0(LogSessionId.LOG_SESSION_ID_NONE);
}
if (z) {
zvVar.a(a2);
}
return new qx0(a2.b());
}
}
public final class b implements mo1, zc, hf1, xi0, SurfaceHolder.Callback, TextureView.SurfaceTextureListener, sc1.b, xc.b, uc.b, sd1.a, wv.a {
private b() {
}
b(zv zvVar, int i) {
this();
}
public void a(nx0.b bVar) {
bVar.a(zv.this.H);
}
@Override
public final void a() {
zv.this.a((Surface) null);
}
@Override
public final void a(int i, long j) {
zv.this.p.a(i, j);
}
@Override
public final void a(int i, long j, long j2) {
zv.this.p.a(i, j, j2);
}
@Override
public final void a(long j) {
zv.this.p.a(j);
}
@Override
public final void a(Surface surface) {
zv.this.a(surface);
}
@Override
public final void a(final Metadata metadata) {
zv zvVar = zv.this;
vf0 vf0Var = zvVar.W;
vf0Var.getClass();
vf0.a aVar = new vf0.a(vf0Var, 0);
for (int i = 0; i < metadata.c(); i++) {
metadata.a(i).a(aVar);
}
zvVar.W = new vf0(aVar, 0);
vf0 c = zv.c(zv.this);
if (!c.equals(zv.this.H)) {
zv.this.H = c;
zv.this.j.a(14, new fc0.a() {
@Override
public final void invoke(Object obj) {
zv.b.this.a((nx0.b) obj);
}
});
}
zv.this.j.a(28, new fc0.a() {
@Override
public final void invoke(Object obj) {
((nx0.b) obj).a(Metadata.this);
}
});
zv.this.j.a();
}
@Override
public final void a(dq dqVar) {
zv.this.getClass();
zv.this.p.a(dqVar);
}
@Override
public final void a(final fp fpVar) {
zv.this.getClass();
fc0 fc0Var = zv.this.j;
fc0Var.a(27, new fc0.a() {
@Override
public final void invoke(Object obj) {
((nx0.b) obj).a(fp.this);
}
});
fc0Var.a();
}
@Override
public final void a(nz nzVar, hq hqVar) {
zv.this.getClass();
zv.this.p.a(nzVar, hqVar);
}
@Override
public final void a(final qo1 qo1Var) {
zv.this.getClass();
fc0 fc0Var = zv.this.j;
fc0Var.a(25, new fc0.a() {
@Override
public final void invoke(Object obj) {
((nx0.b) obj).a(qo1.this);
}
});
fc0Var.a();
}
@Override
public final void a(Exception exc) {
zv.this.p.a(exc);
}
@Override
public final void a(Object obj, long j) {
zv.this.p.a(obj, j);
if (zv.this.J == obj) {
fc0 fc0Var = zv.this.j;
fc0Var.a(26, new fc0.a() {
@Override
public final void invoke(Object obj2) {
((nx0.b) obj2).onRenderedFirstFrame();
}
});
fc0Var.a();
}
}
@Override
public final void a(String str) {
zv.this.p.a(str);
}
@Override
public final void a(String str, long j, long j2) {
zv.this.p.a(str, j, j2);
}
public final void a(final boolean z, final int i) {
fc0 fc0Var = zv.this.j;
fc0Var.a(30, new fc0.a() {
@Override
public final void invoke(Object obj) {
nx0.b bVar = (nx0.b) obj;
bVar.a(z, i);
}
});
fc0Var.a();
}
@Override
public final void b() {
zv.h(zv.this);
}
@Override
public final void b(int i, long j) {
zv.this.p.b(i, j);
}
@Override
public final void b(dq dqVar) {
zv.this.p.b(dqVar);
zv.this.getClass();
zv.this.getClass();
}
@Override
public final void b(nz nzVar, hq hqVar) {
zv.this.getClass();
zv.this.p.b(nzVar, hqVar);
}
@Override
public final void b(Exception exc) {
zv.this.p.b(exc);
}
@Override
public final void b(String str) {
zv.this.p.b(str);
}
@Override
public final void b(String str, long j, long j2) {
zv.this.p.b(str, j, j2);
}
public final void c() {
final ks b2 = zv.b(zv.this.w);
if (b2.equals(zv.this.V)) {
return;
}
zv.this.V = b2;
fc0 fc0Var = zv.this.j;
fc0Var.a(29, new fc0.a() {
@Override
public final void invoke(Object obj) {
((nx0.b) obj).a(ks.this);
}
});
fc0Var.a();
}
@Override
public final void c(dq dqVar) {
zv.this.getClass();
zv.this.p.c(dqVar);
}
@Override
public final void c(Exception exc) {
zv.this.p.c(exc);
}
@Override
public final void d(dq dqVar) {
zv.this.p.d(dqVar);
zv.this.getClass();
zv.this.getClass();
}
@Override
public final void onCues(final List<dp> list) {
fc0 fc0Var = zv.this.j;
fc0Var.a(27, new fc0.a() {
@Override
public final void invoke(Object obj) {
((nx0.b) obj).onCues(list);
}
});
fc0Var.a();
}
@Override
public final void onSkipSilenceEnabledChanged(final boolean z) {
if (zv.this.S == z) {
return;
}
zv.this.S = z;
fc0 fc0Var = zv.this.j;
fc0Var.a(23, new fc0.a() {
@Override
public final void invoke(Object obj) {
((nx0.b) obj).onSkipSilenceEnabledChanged(z);
}
});
fc0Var.a();
}
@Override
public final void onSurfaceTextureAvailable(SurfaceTexture surfaceTexture, int i, int i2) {
zv.a(zv.this, surfaceTexture);
zv.this.a(i, i2);
}
@Override
public final boolean onSurfaceTextureDestroyed(SurfaceTexture surfaceTexture) {
zv.this.a((Surface) null);
zv.this.a(0, 0);
return true;
}
@Override
public final void onSurfaceTextureSizeChanged(SurfaceTexture surfaceTexture, int i, int i2) {
zv.this.a(i, i2);
}
@Override
public final void onSurfaceTextureUpdated(SurfaceTexture surfaceTexture) {
}
@Override
public final void surfaceChanged(SurfaceHolder surfaceHolder, int i, int i2, int i3) {
zv.this.a(i2, i3);
}
@Override
public final void surfaceCreated(SurfaceHolder surfaceHolder) {
zv.this.getClass();
}
@Override
public final void surfaceDestroyed(SurfaceHolder surfaceHolder) {
zv.this.getClass();
zv.this.a(0, 0);
}
}
private static final class c implements pn1, oi, rx0.b {
private pn1 f15475b;
private oi c;
private pn1 d;
private oi e;
private c() {
}
c(int i) {
this();
}
@Override
public final void a(int i, Object obj) {
if (i == 7) {
this.f15475b = (pn1) obj;
} else if (i == 8) {
this.c = (oi) obj;
} else if (i != 10000) {
} else {
sc1 sc1Var = (sc1) obj;
if (sc1Var == null) {
this.d = null;
this.e = null;
return;
}
this.d = sc1Var.b();
this.e = sc1Var.a();
}
}
@Override
public final void a(long j, long j2, nz nzVar, MediaFormat mediaFormat) {
pn1 pn1Var = this.d;
if (pn1Var != null) {
pn1Var.a(j, j2, nzVar, mediaFormat);
}
pn1 pn1Var2 = this.f15475b;
if (pn1Var2 != null) {
pn1Var2.a(j, j2, nzVar, mediaFormat);
}
}
@Override
public final void a(long j, float[] fArr) {
oi oiVar = this.e;
if (oiVar != null) {
oiVar.a(j, fArr);
}
oi oiVar2 = this.c;
if (oiVar2 != null) {
oiVar2.a(j, fArr);
}
}
@Override
public final void g() {
oi oiVar = this.e;
if (oiVar != null) {
oiVar.g();
}
oi oiVar2 = this.c;
if (oiVar2 != null) {
oiVar2.g();
}
}
}
public static final class d implements gg0 {
private final Object f15476a;
private uf1 f15477b;
public d(uf1 uf1Var, Object obj) {
this.f15476a = obj;
this.f15477b = uf1Var;
}
@Override
public final Object a() {
return this.f15476a;
}
@Override
public final uf1 b() {
return this.f15477b;
}
}
static {
cw.a("goog.exo.exoplayer");
}
public zv(wv.b bVar) {
Context applicationContext;
q9 apply;
b bVar2;
c cVar;
Handler handler;
d21[] a2;
og1 og1Var;
zd zdVar;
Looper looper;
ne1 ne1Var;
pg1 pg1Var;
bw.e eVar;
int i;
qx0 qx0Var;
hc0 hc0Var;
g91 g91Var;
final zv zvVar = this;
pl plVar = new pl();
zvVar.d = plVar;
try {
dd0.c("ExoPlayerImpl", "Init " + Integer.toHexString(System.identityHashCode(this)) + " [ExoPlayerLib/2.18.1] [" + zi1.e + "]");
applicationContext = bVar.f15055a.getApplicationContext();
apply = bVar.h.apply(bVar.f15056b);
zvVar.p = apply;
zvVar.Q = bVar.j;
zvVar.M = bVar.k;
zvVar.S = false;
zvVar.z = bVar.p;
bVar2 = new b(zvVar, 0);
zvVar.t = bVar2;
cVar = new c(0);
handler = new Handler(bVar.i);
a2 = bVar.c.get().a(handler, bVar2, bVar2, bVar2, bVar2);
zvVar.f = a2;
nb.b(a2.length > 0);
og1Var = bVar.e.get();
zvVar.g = og1Var;
zvVar.o = bVar.d.get();
zdVar = bVar.g.get();
zvVar.r = zdVar;
zvVar.n = bVar.l;
zvVar.E = bVar.m;
looper = bVar.i;
zvVar.q = looper;
ne1Var = bVar.f15056b;
zvVar.s = ne1Var;
zvVar.e = zvVar;
zvVar.j = new fc0<>(looper, ne1Var, new fc0.b() {
@Override
public final void a(Object obj, fz fzVar) {
zv.this.a((nx0.b) obj, fzVar);
}
});
zvVar.k = new CopyOnWriteArraySet<>();
zvVar.m = new ArrayList();
zvVar.F = new z91.a();
pg1Var = new pg1(new f21[a2.length], new mw[a2.length], eh1.f12375b, null);
zvVar.f15473b = pg1Var;
zvVar.l = new uf1.b();
nx0.a a3 = new nx0.a.C0442a().a(1, 2, 3, 13, 14, 15, 16, 17, 18, 19, 31, 20, 30, 21, 22, 23, 24, 25, 26, 27, 28).a(og1Var.c(), 29).a();
zvVar.c = a3;
zvVar.G = new nx0.a.C0442a().a(a3).a(4).a(10).a();
zvVar.h = ne1Var.a(looper, null);
eVar = new bw.e() {
@Override
public final void a(bw.d dVar) {
zv.this.b(dVar);
}
};
zvVar.X = hx0.a(pg1Var);
apply.a(zvVar, looper);
i = zi1.f15428a;
qx0Var = i < 31 ? new qx0() : a.a(applicationContext, zvVar, bVar.q);
hc0Var = bVar.f.get();
g91Var = zvVar.E;
} catch (Throwable th) {
th = th;
}
try {
zvVar = this;
zvVar.i = new bw(a2, og1Var, pg1Var, hc0Var, zdVar, 0, apply, g91Var, bVar.n, bVar.o, false, looper, ne1Var, eVar, qx0Var);
zvVar.R = 1.0f;
vf0 vf0Var = vf0.G;
zvVar.H = vf0Var;
zvVar.W = vf0Var;
zvVar.Y = -1;
if (i < 21) {
zvVar.P = f();
} else {
zvVar.P = zi1.a(applicationContext);
}
int i2 = fp.f12566a;
zvVar.T = true;
zvVar.b(apply);
zdVar.a(new Handler(looper), apply);
zvVar.a(bVar2);
uc ucVar = new uc(bVar.f15055a, handler, bVar2);
zvVar.u = ucVar;
ucVar.a();
xc xcVar = new xc(bVar.f15055a, handler, bVar2);
zvVar.v = xcVar;
xcVar.d();
sd1 sd1Var = new sd1(bVar.f15055a, handler, bVar2);
zvVar.w = sd1Var;
sd1Var.a(zi1.c(zvVar.Q.c));
hr1 hr1Var = new hr1(bVar.f15055a);
zvVar.x = hr1Var;
hr1Var.a();
ds1 ds1Var = new ds1(bVar.f15055a);
zvVar.y = ds1Var;
ds1Var.a();
zvVar.V = b(sd1Var);
int i3 = qo1.e;
og1Var.a(zvVar.Q);
zvVar.a(1, 10, Integer.valueOf(zvVar.P));
zvVar.a(2, 10, Integer.valueOf(zvVar.P));
zvVar.a(1, 3, zvVar.Q);
zvVar.a(2, 4, Integer.valueOf(zvVar.M));
zvVar.a(2, 5, (Object) 0);
zvVar.a(1, 9, Boolean.valueOf(zvVar.S));
zvVar.a(2, 7, cVar);
zvVar.a(6, 8, cVar);
plVar.e();
} catch (Throwable th2) {
th = th2;
zvVar = this;
zvVar.d.e();
throw th;
}
}
public static int a(boolean z, int i) {
return (!z || i == 1) ? 1 : 2;
}
private static long a(hx0 hx0Var) {
uf1.d dVar = new uf1.d();
uf1.b bVar = new uf1.b();
hx0Var.f12854a.a(hx0Var.f12855b.f11794a, bVar);
long j = hx0Var.c;
return j == -9223372036854775807L ? hx0Var.f12854a.a(bVar.c, dVar, 0L).m : bVar.e + j;
}
private Pair<Object, Long> a(uf1 uf1Var, int i, long j) {
if (uf1Var.c()) {
this.Y = i;
if (j == -9223372036854775807L) {
j = 0;
}
this.Z = j;
return null;
}
if (i == -1 || i >= uf1Var.b()) {
i = uf1Var.a(false);
j = zi1.b(uf1Var.a(i, this.f13769a, 0L).m);
}
return uf1Var.a(this.f13769a, this.l, i, zi1.a(j));
}
private hx0 a(hx0 hx0Var, uf1 uf1Var, Pair<Object, Long> pair) {
eg0.b bVar;
pg1 pg1Var;
int i;
hx0 a2;
nb.a(uf1Var.c() || pair != null);
uf1 uf1Var2 = hx0Var.f12854a;
hx0 a3 = hx0Var.a(uf1Var);
if (uf1Var.c()) {
eg0.b a4 = hx0.a();
long a5 = zi1.a(this.Z);
hx0 a6 = a3.a(a4, a5, a5, a5, 0L, ig1.d, this.f15473b, com.monetization.ads.embedded.guava.collect.p.i()).a(a4);
a6.p = a6.r;
return a6;
}
Object obj = a3.f12855b.f11794a;
int i2 = zi1.f15428a;
boolean z = !obj.equals(pair.first);
eg0.b bVar2 = z ? new eg0.b(pair.first) : a3.f12855b;
long longValue = ((Long) pair.second).longValue();
long a7 = zi1.a(getContentPosition());
if (!uf1Var2.c()) {
a7 -= uf1Var2.a(obj, this.l).e;
}
if (z || longValue < a7) {
nb.b(!bVar2.a());
ig1 ig1Var = z ? ig1.d : a3.h;
if (z) {
bVar = bVar2;
pg1Var = this.f15473b;
} else {
bVar = bVar2;
pg1Var = a3.i;
}
hx0 a8 = a3.a(bVar, longValue, longValue, longValue, 0L, ig1Var, pg1Var, z ? com.monetization.ads.embedded.guava.collect.p.i() : a3.j).a(bVar);
a8.p = longValue;
return a8;
}
if (i == 0) {
int a9 = uf1Var.a(a3.k.f11794a);
if (a9 != -1 && uf1Var.a(a9, this.l, false).c == uf1Var.a(bVar2.f11794a, this.l).c) {
return a3;
}
uf1Var.a(bVar2.f11794a, this.l);
long a10 = bVar2.a() ? this.l.a(bVar2.f11795b, bVar2.c) : this.l.d;
a2 = a3.a(bVar2, a3.r, a3.r, a3.d, a10 - a3.r, a3.h, a3.i, a3.j).a(bVar2);
a2.p = a10;
} else {
nb.b(!bVar2.a());
long max = Math.max(0L, a3.q - (longValue - a7));
long j = a3.p;
if (a3.k.equals(a3.f12855b)) {
j = longValue + max;
}
a2 = a3.a(bVar2, longValue, longValue, longValue, max, a3.h, a3.i, a3.j);
a2.p = j;
}
return a2;
}
public void a(final int i, final int i2) {
if (i == this.N && i2 == this.O) {
return;
}
this.N = i;
this.O = i2;
fc0<nx0.b> fc0Var = this.j;
fc0Var.a(24, new fc0.a() {
@Override
public final void invoke(Object obj) {
((nx0.b) obj).onSurfaceSizeChanged(i, i2);
}
});
fc0Var.a();
}
private void a(int i, int i2, Object obj) {
d21[] d21VarArr;
for (d21 d21Var : this.f) {
if (d21Var.o() == i) {
int c2 = c();
bw bwVar = this.i;
new rx0(bwVar, d21Var, this.X.f12854a, c2 == -1 ? 0 : c2, this.s, bwVar.d()).a(i2).a(obj).e();
}
}
}
public void a(int i, int i2, boolean z) {
int i3 = 0;
boolean z2 = z && i != -1;
if (z2 && i != 1) {
i3 = 1;
}
hx0 hx0Var = this.X;
if (hx0Var.l == z2 && hx0Var.m == i3) {
return;
}
this.A++;
hx0 hx0Var2 = new hx0(hx0Var.f12854a, hx0Var.f12855b, hx0Var.c, hx0Var.d, hx0Var.e, hx0Var.f, hx0Var.g, hx0Var.h, hx0Var.i, hx0Var.j, hx0Var.k, z2, i3, hx0Var.n, hx0Var.p, hx0Var.q, hx0Var.r, hx0Var.o);
this.i.a(z2, i3);
a(hx0Var2, 0, i2, false, 5, -9223372036854775807L);
}
public static void a(int i, nx0.c cVar, nx0.c cVar2, nx0.b bVar) {
bVar.c();
bVar.a(cVar, cVar2, i);
}
public void a(Surface surface) {
d21[] d21VarArr;
ArrayList arrayList = new ArrayList();
boolean z = false;
for (d21 d21Var : this.f) {
if (d21Var.o() == 2) {
int c2 = c();
bw bwVar = this.i;
arrayList.add(new rx0(bwVar, d21Var, this.X.f12854a, c2 == -1 ? 0 : c2, this.s, bwVar.d()).a(1).a(surface).e());
}
}
Object obj = this.J;
if (obj != null && obj != surface) {
try {
Iterator it = arrayList.iterator();
while (it.hasNext()) {
((rx0) it.next()).a(this.z);
}
} catch (InterruptedException unused) {
Thread.currentThread().interrupt();
} catch (TimeoutException unused2) {
z = true;
}
Object obj2 = this.J;
Surface surface2 = this.K;
if (obj2 == surface2) {
surface2.release();
this.K = null;
}
}
this.J = surface;
if (z) {
a(vv.a(new lw(3), 1003));
}
}
public void a(bw.d dVar) {
long j;
boolean z;
int i = this.A - dVar.c;
this.A = i;
boolean z2 = true;
if (dVar.d) {
this.B = dVar.e;
this.C = true;
}
if (dVar.f) {
this.D = dVar.g;
}
if (i == 0) {
uf1 uf1Var = dVar.f12016b.f12854a;
if (!this.X.f12854a.c() && uf1Var.c()) {
this.Y = -1;
this.Z = 0L;
}
if (!uf1Var.c()) {
List<uf1> d2 = ((fy0) uf1Var).d();
nb.b(d2.size() == this.m.size());
for (int i2 = 0; i2 < d2.size(); i2++) {
((d) this.m.get(i2)).f15477b = d2.get(i2);
}
}
long j2 = -9223372036854775807L;
if (this.C) {
if (dVar.f12016b.f12855b.equals(this.X.f12855b) && dVar.f12016b.d == this.X.r) {
z2 = false;
}
if (z2) {
if (uf1Var.c() || dVar.f12016b.f12855b.a()) {
j2 = dVar.f12016b.d;
} else {
hx0 hx0Var = dVar.f12016b;
eg0.b bVar = hx0Var.f12855b;
long j3 = hx0Var.d;
uf1Var.a(bVar.f11794a, this.l);
j2 = j3 + this.l.e;
}
}
z = z2;
j = j2;
} else {
j = -9223372036854775807L;
z = false;
}
this.C = false;
a(dVar.f12016b, 1, this.D, z, this.B, j);
}
}
private void a(final hx0 hx0Var, final int i, final int i2, boolean z, final int i3, long j) {
Pair pair;
int i4;
final sf0 sf0Var;
boolean z2;
boolean z3;
boolean z4;
Object obj;
int i5;
sf0 sf0Var2;
Object obj2;
int i6;
long j2;
long j3;
long j4;
long a2;
Object obj3;
sf0 sf0Var3;
Object obj4;
int i7;
hx0 hx0Var2 = this.X;
this.X = hx0Var;
boolean z5 = !hx0Var2.f12854a.equals(hx0Var.f12854a);
uf1 uf1Var = hx0Var2.f12854a;
uf1 uf1Var2 = hx0Var.f12854a;
if (uf1Var2.c() && uf1Var.c()) {
pair = new Pair(Boolean.FALSE, -1);
} else if (uf1Var2.c() != uf1Var.c()) {
pair = new Pair(Boolean.TRUE, 3);
} else if (uf1Var.a(uf1Var.a(hx0Var2.f12855b.f11794a, this.l).c, this.f13769a, 0L).f14743a.equals(uf1Var2.a(uf1Var2.a(hx0Var.f12855b.f11794a, this.l).c, this.f13769a, 0L).f14743a)) {
pair = (z && i3 == 0 && hx0Var2.f12855b.d < hx0Var.f12855b.d) ? new Pair(Boolean.TRUE, 0) : new Pair(Boolean.FALSE, -1);
} else {
if (z && i3 == 0) {
i4 = 1;
} else if (z && i3 == 1) {
i4 = 2;
} else if (!z5) {
throw new IllegalStateException();
} else {
i4 = 3;
}
pair = new Pair(Boolean.TRUE, Integer.valueOf(i4));
}
boolean booleanValue = ((Boolean) pair.first).booleanValue();
final int intValue = ((Integer) pair.second).intValue();
vf0 vf0Var = this.H;
if (booleanValue) {
sf0 sf0Var4 = !hx0Var.f12854a.c() ? hx0Var.f12854a.a(hx0Var.f12854a.a(hx0Var.f12855b.f11794a, this.l).c, this.f13769a, 0L).c : null;
this.W = vf0.G;
sf0Var = sf0Var4;
} else {
sf0Var = null;
}
if (booleanValue || !hx0Var2.j.equals(hx0Var.j)) {
vf0 vf0Var2 = this.W;
vf0Var2.getClass();
vf0.a aVar = new vf0.a(vf0Var2, 0);
List<Metadata> list = hx0Var.j;
for (int i8 = 0; i8 < list.size(); i8++) {
Metadata metadata = list.get(i8);
for (int i9 = 0; i9 < metadata.c(); i9++) {
metadata.a(i9).a(aVar);
}
}
this.W = new vf0(aVar, 0);
uf1 currentTimeline = getCurrentTimeline();
if (currentTimeline.c()) {
vf0Var = this.W;
} else {
sf0 sf0Var5 = currentTimeline.a(getCurrentMediaItemIndex(), this.f13769a, 0L).c;
vf0 vf0Var3 = this.W;
vf0Var3.getClass();
vf0Var = new vf0(new vf0.a(vf0Var3, 0).a(sf0Var5.d), 0);
}
}
boolean z6 = !vf0Var.equals(this.H);
this.H = vf0Var;
boolean z7 = hx0Var2.l != hx0Var.l;
boolean z8 = hx0Var2.e != hx0Var.e;
if (z8 || z7) {
int playbackState = getPlaybackState();
if (playbackState != 1) {
if (playbackState == 2 || playbackState == 3) {
i();
this.x.a(getPlayWhenReady() && !this.X.o);
this.y.a(getPlayWhenReady());
} else if (playbackState != 4) {
throw new IllegalStateException();
}
}
this.x.a(false);
this.y.a(false);
}
boolean z9 = hx0Var2.g != hx0Var.g;
if (!hx0Var2.f12854a.equals(hx0Var.f12854a)) {
this.j.a(0, new fc0.a() {
@Override
public final void invoke(Object obj5) {
zv.a(hx0.this, i, (nx0.b) obj5);
}
});
}
if (z) {
uf1.b bVar = new uf1.b();
if (hx0Var2.f12854a.c()) {
z2 = z7;
z3 = z9;
obj = null;
i5 = -1;
sf0Var2 = null;
obj2 = null;
i6 = -1;
} else {
Object obj5 = hx0Var2.f12855b.f11794a;
hx0Var2.f12854a.a(obj5, bVar);
int i10 = bVar.c;
int a3 = hx0Var2.f12854a.a(obj5);
z2 = z7;
z3 = z9;
obj2 = obj5;
obj = hx0Var2.f12854a.a(i10, this.f13769a, 0L).f14743a;
sf0Var2 = this.f13769a.c;
i5 = i10;
i6 = a3;
}
if (i3 == 0) {
if (hx0Var2.f12855b.a()) {
eg0.b bVar2 = hx0Var2.f12855b;
j4 = bVar.a(bVar2.f11795b, bVar2.c);
a2 = a(hx0Var2);
} else if (hx0Var2.f12855b.e != -1) {
j4 = a(this.X);
a2 = j4;
} else {
j2 = bVar.e;
j3 = bVar.d;
j4 = j2 + j3;
a2 = j4;
}
} else if (hx0Var2.f12855b.a()) {
j4 = hx0Var2.r;
a2 = a(hx0Var2);
} else {
j2 = bVar.e;
j3 = hx0Var2.r;
j4 = j2 + j3;
a2 = j4;
}
long b2 = zi1.b(j4);
long b3 = zi1.b(a2);
eg0.b bVar3 = hx0Var2.f12855b;
final nx0.c cVar = new nx0.c(obj, i5, sf0Var2, obj2, i6, b2, b3, bVar3.f11795b, bVar3.c);
int currentMediaItemIndex = getCurrentMediaItemIndex();
if (this.X.f12854a.c()) {
z4 = z8;
obj3 = null;
sf0Var3 = null;
obj4 = null;
i7 = -1;
} else {
hx0 hx0Var3 = this.X;
Object obj6 = hx0Var3.f12855b.f11794a;
hx0Var3.f12854a.a(obj6, this.l);
int a4 = this.X.f12854a.a(obj6);
z4 = z8;
Object obj7 = this.X.f12854a.a(currentMediaItemIndex, this.f13769a, 0L).f14743a;
i7 = a4;
sf0Var3 = this.f13769a.c;
obj3 = obj7;
obj4 = obj6;
}
long b4 = zi1.b(j);
long b5 = this.X.f12855b.a() ? zi1.b(a(this.X)) : b4;
eg0.b bVar4 = this.X.f12855b;
final nx0.c cVar2 = new nx0.c(obj3, currentMediaItemIndex, sf0Var3, obj4, i7, b4, b5, bVar4.f11795b, bVar4.c);
this.j.a(11, new fc0.a() {
@Override
public final void invoke(Object obj8) {
zv.a(i3, cVar, cVar2, (nx0.b) obj8);
}
});
} else {
z2 = z7;
z3 = z9;
z4 = z8;
}
if (booleanValue) {
this.j.a(1, new fc0.a() {
@Override
public final void invoke(Object obj8) {
((nx0.b) obj8).a(sf0.this, intValue);
}
});
}
if (hx0Var2.f != hx0Var.f) {
this.j.a(10, new fc0.a() {
@Override
public final void invoke(Object obj8) {
zv.a(hx0.this, (nx0.b) obj8);
}
});
if (hx0Var.f != null) {
this.j.a(10, new fc0.a() {
@Override
public final void invoke(Object obj8) {
zv.b(hx0.this, (nx0.b) obj8);
}
});
}
}
pg1 pg1Var = hx0Var2.i;
pg1 pg1Var2 = hx0Var.i;
if (pg1Var != pg1Var2) {
this.g.a(pg1Var2.e);
this.j.a(2, new fc0.a() {
@Override
public final void invoke(Object obj8) {
zv.c(hx0.this, (nx0.b) obj8);
}
});
}
if (z6) {
final vf0 vf0Var4 = this.H;
this.j.a(14, new fc0.a() {
@Override
public final void invoke(Object obj8) {
((nx0.b) obj8).a(vf0.this);
}
});
}
if (z3) {
this.j.a(3, new fc0.a() {
@Override
public final void invoke(Object obj8) {
zv.d(hx0.this, (nx0.b) obj8);
}
});
}
if (z4 || z2) {
this.j.a(-1, new fc0.a() {
@Override
public final void invoke(Object obj8) {
zv.e(hx0.this, (nx0.b) obj8);
}
});
}
if (z4) {
this.j.a(4, new fc0.a() {
@Override
public final void invoke(Object obj8) {
zv.f(hx0.this, (nx0.b) obj8);
}
});
}
if (z2) {
this.j.a(5, new fc0.a() {
@Override
public final void invoke(Object obj8) {
zv.b(hx0.this, i2, (nx0.b) obj8);
}
});
}
if (hx0Var2.m != hx0Var.m) {
this.j.a(6, new fc0.a() {
@Override
public final void invoke(Object obj8) {
zv.g(hx0.this, (nx0.b) obj8);
}
});
}
if ((hx0Var2.e == 3 && hx0Var2.l && hx0Var2.m == 0) != (hx0Var.e == 3 && hx0Var.l && hx0Var.m == 0)) {
this.j.a(7, new fc0.a() {
@Override
public final void invoke(Object obj8) {
zv.h(hx0.this, (nx0.b) obj8);
}
});
}
if (!hx0Var2.n.equals(hx0Var.n)) {
this.j.a(12, new fc0.a() {
@Override
public final void invoke(Object obj8) {
zv.i(hx0.this, (nx0.b) obj8);
}
});
}
h();
this.j.a();
if (hx0Var2.o != hx0Var.o) {
Iterator<wv.a> it = this.k.iterator();
while (it.hasNext()) {
it.next().b();
}
}
}
public static void a(hx0 hx0Var, int i, nx0.b bVar) {
uf1 uf1Var = hx0Var.f12854a;
bVar.a(i);
}
public static void a(hx0 hx0Var, nx0.b bVar) {
bVar.a(hx0Var.f);
}
public void a(nx0.b bVar, fz fzVar) {
bVar.a();
}
private void a(vv vvVar) {
long j;
long j2;
hx0 hx0Var = this.X;
hx0 a2 = hx0Var.a(hx0Var.f12855b);
a2.p = a2.r;
a2.q = 0L;
hx0 a3 = a2.a(1);
if (vvVar != null) {
a3 = a3.a(vvVar);
}
hx0 hx0Var2 = a3;
this.A++;
this.i.q();
boolean z = hx0Var2.f12854a.c() && !this.X.f12854a.c();
if (hx0Var2.f12854a.c()) {
j2 = zi1.a(this.Z);
} else if (!hx0Var2.f12855b.a()) {
uf1 uf1Var = hx0Var2.f12854a;
eg0.b bVar = hx0Var2.f12855b;
long j3 = hx0Var2.r;
uf1Var.a(bVar.f11794a, this.l);
j = j3 + this.l.e;
a(hx0Var2, 0, 1, z, 4, j);
} else {
j2 = hx0Var2.r;
}
j = j2;
a(hx0Var2, 0, 1, z, 4, j);
}
static void a(zv zvVar, SurfaceTexture surfaceTexture) {
zvVar.getClass();
Surface surface = new Surface(surfaceTexture);
zvVar.a(surface);
zvVar.K = surface;
}
public static ks b(sd1 sd1Var) {
return new ks(0, sd1Var.b(), sd1Var.a());
}
public void b(final bw.d dVar) {
this.h.a(new Runnable() {
@Override
public final void run() {
zv.this.a(dVar);
}
});
}
public static void b(hx0 hx0Var, int i, nx0.b bVar) {
bVar.onPlayWhenReadyChanged(hx0Var.l, i);
}
public static void b(hx0 hx0Var, nx0.b bVar) {
bVar.b(hx0Var.f);
}
private int c() {
if (this.X.f12854a.c()) {
return this.Y;
}
hx0 hx0Var = this.X;
return hx0Var.f12854a.a(hx0Var.f12855b.f11794a, this.l).c;
}
static vf0 c(zv zvVar) {
uf1 currentTimeline = zvVar.getCurrentTimeline();
if (currentTimeline.c()) {
return zvVar.W;
}
sf0 sf0Var = currentTimeline.a(zvVar.getCurrentMediaItemIndex(), zvVar.f13769a, 0L).c;
vf0 vf0Var = zvVar.W;
vf0Var.getClass();
return new vf0(new vf0.a(vf0Var, 0).a(sf0Var.d), 0);
}
public static void c(hx0 hx0Var, nx0.b bVar) {
bVar.a(hx0Var.i.d);
}
public static void c(nx0.b bVar) {
bVar.b(vv.a(new lw(1), 1003));
}
public static void d(hx0 hx0Var, nx0.b bVar) {
boolean z = hx0Var.g;
bVar.b();
bVar.onIsLoadingChanged(hx0Var.g);
}
public void d(nx0.b bVar) {
bVar.a(this.G);
}
public static void e(hx0 hx0Var, nx0.b bVar) {
bVar.onPlayerStateChanged(hx0Var.l, hx0Var.e);
}
public static void e(zv zvVar) {
zvVar.a(1, 2, Float.valueOf(zvVar.R * zvVar.v.b()));
}
private int f() {
AudioTrack audioTrack = this.I;
if (audioTrack != null && audioTrack.getAudioSessionId() != 0) {
this.I.release();
this.I = null;
}
if (this.I == null) {
this.I = new AudioTrack(3, 4000, 4, 2, 2, 0, 0);
}
return this.I.getAudioSessionId();
}
public static void f(hx0 hx0Var, nx0.b bVar) {
bVar.onPlaybackStateChanged(hx0Var.e);
}
private void g() {
TextureView textureView = this.L;
if (textureView != null) {
if (textureView.getSurfaceTextureListener() != this.t) {
dd0.d("ExoPlayerImpl", "SurfaceTextureListener already unset or replaced.");
} else {
this.L.setSurfaceTextureListener(null);
}
this.L = null;
}
}
public static void g(hx0 hx0Var, nx0.b bVar) {
bVar.onPlaybackSuppressionReasonChanged(hx0Var.m);
}
private void h() {
nx0.a aVar = this.G;
nx0 nx0Var = this.e;
nx0.a aVar2 = this.c;
int i = zi1.f15428a;
boolean isPlayingAd = nx0Var.isPlayingAd();
boolean isCurrentMediaItemSeekable = nx0Var.isCurrentMediaItemSeekable();
boolean hasPreviousMediaItem = nx0Var.hasPreviousMediaItem();
boolean hasNextMediaItem = nx0Var.hasNextMediaItem();
boolean isCurrentMediaItemLive = nx0Var.isCurrentMediaItemLive();
boolean isCurrentMediaItemDynamic = nx0Var.isCurrentMediaItemDynamic();
boolean c2 = nx0Var.getCurrentTimeline().c();
boolean z = !isPlayingAd;
boolean z2 = false;
nx0.a.C0442a a2 = new nx0.a.C0442a().a(aVar2).a(z, 4).a(isCurrentMediaItemSeekable && !isPlayingAd, 5).a(hasPreviousMediaItem && !isPlayingAd, 6).a(!c2 && (hasPreviousMediaItem || !isCurrentMediaItemLive || isCurrentMediaItemSeekable) && !isPlayingAd, 7).a(hasNextMediaItem && !isPlayingAd, 8).a(!c2 && (hasNextMediaItem || (isCurrentMediaItemLive && isCurrentMediaItemDynamic)) && !isPlayingAd, 9).a(z, 10).a(isCurrentMediaItemSeekable && !isPlayingAd, 11);
if (isCurrentMediaItemSeekable && !isPlayingAd) {
z2 = true;
}
nx0.a a3 = a2.a(z2, 12).a();
this.G = a3;
if (a3.equals(aVar)) {
return;
}
this.j.a(13, new fc0.a() {
@Override
public final void invoke(Object obj) {
zv.this.d((nx0.b) obj);
}
});
}
public static void h(hx0 hx0Var, nx0.b bVar) {
bVar.onIsPlayingChanged(hx0Var.e == 3 && hx0Var.l && hx0Var.m == 0);
}
static void h(zv zvVar) {
int playbackState = zvVar.getPlaybackState();
boolean z = true;
if (playbackState != 1) {
if (playbackState == 2 || playbackState == 3) {
zvVar.i();
zvVar.x.a((!zvVar.getPlayWhenReady() || zvVar.X.o) ? false : false);
zvVar.y.a(zvVar.getPlayWhenReady());
return;
} else if (playbackState != 4) {
throw new IllegalStateException();
}
}
zvVar.x.a(false);
zvVar.y.a(false);
}
private void i() {
this.d.b();
if (Thread.currentThread() != this.q.getThread()) {
Object[] objArr = {Thread.currentThread().getName(), this.q.getThread().getName()};
int i = zi1.f15428a;
String format = String.format(Locale.US, "Player is accessed on the wrong thread.\nCurrent thread: '%s'\nExpected thread: '%s'\nSee https://exoplayer.dev/issues/player-accessed-on-wrong-thread", objArr);
if (this.T) {
throw new IllegalStateException(format);
}
dd0.b("ExoPlayerImpl", format, this.U ? null : new IllegalStateException());
this.U = true;
}
}
public static void i(hx0 hx0Var, nx0.b bVar) {
bVar.a(hx0Var.n);
}
@Override
public final vv a() {
i();
return this.X.f;
}
@Override
public final void a(nx0.b bVar) {
bVar.getClass();
this.j.b(bVar);
}
@Override
public final void a(vz0 vz0Var) {
long j;
long j2;
i();
List singletonList = Collections.singletonList(vz0Var);
i();
i();
c();
getCurrentPosition();
this.A++;
if (!this.m.isEmpty()) {
int size = this.m.size();
for (int i = size - 1; i >= 0; i--) {
this.m.remove(i);
}
this.F = this.F.a(size);
}
ArrayList arrayList = new ArrayList();
for (int i2 = 0; i2 < singletonList.size(); i2++) {
hg0.c cVar = new hg0.c((eg0) singletonList.get(i2), this.n);
arrayList.add(cVar);
this.m.add(i2 + 0, new d(cVar.f12785a.f(), cVar.f12786b));
}
this.F = this.F.d(arrayList.size());
fy0 fy0Var = new fy0(this.m, this.F);
if (!fy0Var.c() && -1 >= fy0Var.b()) {
throw new c50();
}
int a2 = fy0Var.a(false);
hx0 a3 = a(this.X, fy0Var, a(fy0Var, a2, -9223372036854775807L));
int i3 = a3.e;
if (a2 != -1 && i3 != 1) {
i3 = (fy0Var.c() || a2 >= fy0Var.b()) ? 4 : 2;
}
hx0 a4 = a3.a(i3);
this.i.a(a2, zi1.a(-9223372036854775807L), this.F, arrayList);
boolean z = (this.X.f12855b.f11794a.equals(a4.f12855b.f11794a) || this.X.f12854a.c()) ? false : true;
if (a4.f12854a.c()) {
j2 = zi1.a(this.Z);
} else if (!a4.f12855b.a()) {
uf1 uf1Var = a4.f12854a;
eg0.b bVar = a4.f12855b;
long j3 = a4.r;
uf1Var.a(bVar.f11794a, this.l);
j = j3 + this.l.e;
a(a4, 0, 1, z, 4, j);
} else {
j2 = a4.r;
}
j = j2;
a(a4, 0, 1, z, 4, j);
}
public final void a(wf0 wf0Var) {
this.p.a(wf0Var);
}
public final void a(wv.a aVar) {
this.k.add(aVar);
}
@Override
public final void b(nx0.b bVar) {
bVar.getClass();
this.j.a((fc0<nx0.b>) bVar);
}
public final void d() {
i();
}
public final void e() {
i();
}
@Override
public final long getContentPosition() {
i();
if (isPlayingAd()) {
hx0 hx0Var = this.X;
hx0Var.f12854a.a(hx0Var.f12855b.f11794a, this.l);
hx0 hx0Var2 = this.X;
return hx0Var2.c == -9223372036854775807L ? zi1.b(hx0Var2.f12854a.a(getCurrentMediaItemIndex(), this.f13769a, 0L).m) : zi1.b(this.l.e) + zi1.b(this.X.c);
}
return getCurrentPosition();
}
@Override
public final int getCurrentAdGroupIndex() {
i();
if (isPlayingAd()) {
return this.X.f12855b.f11795b;
}
return -1;
}
@Override
public final int getCurrentAdIndexInAdGroup() {
i();
if (isPlayingAd()) {
return this.X.f12855b.c;
}
return -1;
}
@Override
public final int getCurrentMediaItemIndex() {
i();
int c2 = c();
if (c2 == -1) {
return 0;
}
return c2;
}
@Override
public final int getCurrentPeriodIndex() {
i();
if (this.X.f12854a.c()) {
return 0;
}
hx0 hx0Var = this.X;
return hx0Var.f12854a.a(hx0Var.f12855b.f11794a);
}
@Override
public final long getCurrentPosition() {
long j;
i();
hx0 hx0Var = this.X;
if (hx0Var.f12854a.c()) {
j = zi1.a(this.Z);
} else if (hx0Var.f12855b.a()) {
j = hx0Var.r;
} else {
uf1 uf1Var = hx0Var.f12854a;
eg0.b bVar = hx0Var.f12855b;
long j2 = hx0Var.r;
uf1Var.a(bVar.f11794a, this.l);
j = this.l.e + j2;
}
return zi1.b(j);
}
@Override
public final uf1 getCurrentTimeline() {
i();
return this.X.f12854a;
}
@Override
public final eh1 getCurrentTracks() {
i();
return this.X.i.d;
}
@Override
public final long getDuration() {
i();
if (isPlayingAd()) {
hx0 hx0Var = this.X;
eg0.b bVar = hx0Var.f12855b;
hx0Var.f12854a.a(bVar.f11794a, this.l);
return zi1.b(this.l.a(bVar.f11795b, bVar.c));
}
uf1 currentTimeline = getCurrentTimeline();
if (currentTimeline.c()) {
return -9223372036854775807L;
}
return zi1.b(currentTimeline.a(getCurrentMediaItemIndex(), this.f13769a, 0L).n);
}
@Override
public final boolean getPlayWhenReady() {
i();
return this.X.l;
}
@Override
public final int getPlaybackState() {
i();
return this.X.e;
}
@Override
public final int getPlaybackSuppressionReason() {
i();
return this.X.m;
}
@Override
public final long getTotalBufferedDuration() {
i();
return zi1.b(this.X.q);
}
@Override
public final float getVolume() {
i();
return this.R;
}
@Override
public final boolean isPlayingAd() {
i();
return this.X.f12855b.a();
}
@Override
public final void prepare() {
i();
boolean playWhenReady = getPlayWhenReady();
int a2 = this.v.a(playWhenReady, 2);
a(a2, (!playWhenReady || a2 == 1) ? 1 : 2, playWhenReady);
hx0 hx0Var = this.X;
if (hx0Var.e != 1) {
return;
}
hx0 a3 = hx0Var.a((vv) null);
hx0 a4 = a3.a(a3.f12854a.c() ? 4 : 2);
this.A++;
this.i.i();
a(a4, 1, 1, false, 5, -9223372036854775807L);
}
@Override
public final void release() {
AudioTrack audioTrack;
StringBuilder a2 = sf.a("Release ");
a2.append(Integer.toHexString(System.identityHashCode(this)));
a2.append(" [");
a2.append("ExoPlayerLib/2.18.1");
a2.append("] [");
a2.append(zi1.e);
a2.append("] [");
a2.append(cw.a());
a2.append("]");
dd0.c("ExoPlayerImpl", a2.toString());
i();
if (zi1.f15428a < 21 && (audioTrack = this.I) != null) {
audioTrack.release();
this.I = null;
}
this.u.a();
this.w.c();
this.x.a(false);
this.y.a(false);
this.v.c();
if (!this.i.k()) {
fc0<nx0.b> fc0Var = this.j;
fc0Var.a(10, new fc0.a() {
@Override
public final void invoke(Object obj) {
zv.c((nx0.b) obj);
}
});
fc0Var.a();
}
this.j.b();
this.h.c();
this.r.a(this.p);
hx0 a3 = this.X.a(1);
this.X = a3;
hx0 a4 = a3.a(a3.f12855b);
this.X = a4;
a4.p = a4.r;
this.X.q = 0L;
this.p.release();
this.g.d();
g();
Surface surface = this.K;
if (surface != null) {
surface.release();
this.K = null;
}
int i = fp.f12566a;
}
@Override
public final void setPlayWhenReady(boolean z) {
i();
int a2 = this.v.a(z, getPlaybackState());
int i = 1;
if (z && a2 != 1) {
i = 2;
}
a(a2, i, z);
}
@Override
public final void setVideoTextureView(TextureView textureView) {
i();
if (textureView == null) {
i();
g();
a((Surface) null);
a(0, 0);
return;
}
g();
this.L = textureView;
if (textureView.getSurfaceTextureListener() != null) {
dd0.d("ExoPlayerImpl", "Replacing existing SurfaceTextureListener.");
}
textureView.setSurfaceTextureListener(this.t);
SurfaceTexture surfaceTexture = textureView.isAvailable() ? textureView.getSurfaceTexture() : null;
if (surfaceTexture == null) {
a((Surface) null);
a(0, 0);
return;
}
Surface surface = new Surface(surfaceTexture);
a(surface);
this.K = surface;
a(textureView.getWidth(), textureView.getHeight());
}
@Override
public final void setVolume(float f) {
i();
int i = zi1.f15428a;
final float max = Math.max(0.0f, Math.min(f, 1.0f));
if (this.R == max) {
return;
}
this.R = max;
a(1, 2, Float.valueOf(this.v.b() * max));
fc0<nx0.b> fc0Var = this.j;
fc0Var.a(22, new fc0.a() {
@Override
public final void invoke(Object obj) {
((nx0.b) obj).onVolumeChanged(max);
}
});
fc0Var.a();
}
@Override
public final void stop() {
i();
i();
this.v.a(getPlayWhenReady(), 1);
a((vv) null);
int i = fp.f12566a;
}
}