Kufar v3.2.0版本的 MD5 值为:6a4d203db1c561c7e3bcd50d23fed59f
以下内容为反编译后的 aw.java 源代码,内容仅作参考
package com.applovin.exoplayer2;
import android.content.Context;
import android.graphics.Rect;
import android.graphics.SurfaceTexture;
import android.media.AudioTrack;
import android.media.MediaFormat;
import android.os.Handler;
import android.os.Looper;
import android.view.Surface;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.TextureView;
import androidx.annotation.Nullable;
import com.applovin.exoplayer2.an;
import com.applovin.exoplayer2.ao;
import com.applovin.exoplayer2.ay;
import com.applovin.exoplayer2.b;
import com.applovin.exoplayer2.c;
import com.applovin.exoplayer2.k;
import com.applovin.exoplayer2.m.a.i;
import com.applovin.exoplayer2.q;
import com.bytedance.sdk.openadsdk.api.init.PAGSdk;
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 class aw extends d implements q {
private int A;
private int B;
@Nullable
private com.applovin.exoplayer2.c.e C;
@Nullable
private com.applovin.exoplayer2.c.e D;
private int E;
private com.applovin.exoplayer2.b.d F;
private float G;
private boolean H;
private List<com.applovin.exoplayer2.i.a> I;
private boolean J;
private boolean K;
@Nullable
private com.applovin.exoplayer2.l.aa L;
private boolean M;
private boolean N;
private o O;
private com.applovin.exoplayer2.m.o P;
protected final ar[] f25533b;
private final com.applovin.exoplayer2.l.g f25534c;
private final Context f25535d;
private final r f25536e;
private final b f25537f;
private final c f25538g;
private final CopyOnWriteArraySet<an.d> f25539h;
private final com.applovin.exoplayer2.a.a f25540i;
private final com.applovin.exoplayer2.b f25541j;
private final com.applovin.exoplayer2.c f25542k;
private final ay f25543l;
private final bb f25544m;
private final bc f25545n;
private final long f25546o;
@Nullable
private v f25547p;
@Nullable
private v f25548q;
@Nullable
private AudioTrack f25549r;
@Nullable
private Object f25550s;
@Nullable
private Surface f25551t;
@Nullable
private SurfaceHolder f25552u;
@Nullable
private com.applovin.exoplayer2.m.a.i f25553v;
private boolean f25554w;
@Nullable
private TextureView f25555x;
private int f25556y;
private int f25557z;
@Deprecated
public static final class a {
private boolean A;
private final Context f25558a;
private final au f25559b;
private com.applovin.exoplayer2.l.d f25560c;
private long f25561d;
private com.applovin.exoplayer2.j.j f25562e;
private com.applovin.exoplayer2.h.r f25563f;
private aa f25564g;
private com.applovin.exoplayer2.k.d f25565h;
private com.applovin.exoplayer2.a.a f25566i;
private Looper f25567j;
@Nullable
private com.applovin.exoplayer2.l.aa f25568k;
private com.applovin.exoplayer2.b.d f25569l;
private boolean f25570m;
private int f25571n;
private boolean f25572o;
private boolean f25573p;
private int f25574q;
private int f25575r;
private boolean f25576s;
private av f25577t;
private long f25578u;
private long f25579v;
private z f25580w;
private long f25581x;
private long f25582y;
private boolean f25583z;
@Deprecated
public a(Context context) {
this(context, new n(context), new com.applovin.exoplayer2.e.f());
}
@Deprecated
public a(Context context, au auVar, com.applovin.exoplayer2.e.l lVar) {
this(context, auVar, new com.applovin.exoplayer2.j.c(context), new com.applovin.exoplayer2.h.f(context, lVar), new l(), com.applovin.exoplayer2.k.n.a(context), new com.applovin.exoplayer2.a.a(com.applovin.exoplayer2.l.d.f28834a));
}
@Deprecated
public aw a() {
com.applovin.exoplayer2.l.a.b(!this.A);
this.A = true;
return new aw(this);
}
@Deprecated
public a(Context context, au auVar, com.applovin.exoplayer2.j.j jVar, com.applovin.exoplayer2.h.r rVar, aa aaVar, com.applovin.exoplayer2.k.d dVar, com.applovin.exoplayer2.a.a aVar) {
this.f25558a = context;
this.f25559b = auVar;
this.f25562e = jVar;
this.f25563f = rVar;
this.f25564g = aaVar;
this.f25565h = dVar;
this.f25566i = aVar;
this.f25567j = com.applovin.exoplayer2.l.ai.c();
this.f25569l = com.applovin.exoplayer2.b.d.f25633a;
this.f25571n = 0;
this.f25574q = 1;
this.f25575r = 0;
this.f25576s = true;
this.f25577t = av.f25530e;
this.f25578u = 5000L;
this.f25579v = 15000L;
this.f25580w = new k.a().a();
this.f25560c = com.applovin.exoplayer2.l.d.f28834a;
this.f25581x = 500L;
this.f25582y = 2000L;
}
}
public final class b implements SurfaceHolder.Callback, TextureView.SurfaceTextureListener, an.b, ay.a, b.InterfaceC0488b, com.applovin.exoplayer2.b.g, c.b, com.applovin.exoplayer2.g.e, com.applovin.exoplayer2.i.l, i.a, com.applovin.exoplayer2.m.n, q.a {
private b() {
}
@Override
public void a(ab abVar, int i11) {
k0.a(this, abVar, i11);
}
@Override
public void a_(v vVar) {
com.applovin.exoplayer2.m.s.j(this, vVar);
}
@Override
public void b() {
k0.k(this);
}
@Override
public void b_(boolean z11) {
if (aw.this.L != null) {
if (z11 && !aw.this.M) {
aw.this.L.a(0);
aw.this.M = true;
} else if (!z11 && aw.this.M) {
aw.this.L.b(0);
aw.this.M = false;
}
}
}
@Override
public void c(int i11) {
k0.p(this, i11);
}
@Override
public void d(int i11) {
k0.r(this, i11);
}
@Override
public void e(int i11) {
k0.t(this, i11);
}
@Override
public void f(int i11) {
o b11 = aw.b(aw.this.f25543l);
if (!b11.equals(aw.this.O)) {
aw.this.O = b11;
Iterator it = aw.this.f25539h.iterator();
while (it.hasNext()) {
((an.d) it.next()).a(b11);
}
}
}
@Override
public void onSurfaceTextureAvailable(SurfaceTexture surfaceTexture, int i11, int i12) {
aw.this.a(surfaceTexture);
aw.this.a(i11, i12);
}
@Override
public boolean onSurfaceTextureDestroyed(SurfaceTexture surfaceTexture) {
aw.this.a((Object) null);
aw.this.a(0, 0);
return true;
}
@Override
public void onSurfaceTextureSizeChanged(SurfaceTexture surfaceTexture, int i11, int i12) {
aw.this.a(i11, i12);
}
@Override
public void surfaceChanged(SurfaceHolder surfaceHolder, int i11, int i12, int i13) {
aw.this.a(i12, i13);
}
@Override
public void surfaceCreated(SurfaceHolder surfaceHolder) {
if (aw.this.f25554w) {
aw.this.a(surfaceHolder.getSurface());
}
}
@Override
public void surfaceDestroyed(SurfaceHolder surfaceHolder) {
if (aw.this.f25554w) {
aw.this.a((Object) null);
}
aw.this.a(0, 0);
}
@Override
public void a(ac acVar) {
k0.b(this, acVar);
}
@Override
public void a_(boolean z11) {
if (aw.this.H == z11) {
return;
}
aw.this.H = z11;
aw.this.X();
}
@Override
public void b(ak akVar) {
k0.m(this, akVar);
}
@Override
public void c(boolean z11) {
k0.q(this, z11);
}
@Override
public void d(boolean z11) {
k0.s(this, z11);
}
@Override
public void e(boolean z11) {
k0.u(this, z11);
}
@Override
public void a(ak akVar) {
k0.c(this, akVar);
}
@Override
public void b(com.applovin.exoplayer2.c.e eVar) {
aw.this.f25540i.b(eVar);
aw.this.f25547p = null;
aw.this.C = null;
}
@Override
public void c(com.applovin.exoplayer2.c.e eVar) {
aw.this.D = eVar;
aw.this.f25540i.c(eVar);
}
@Override
public void d(com.applovin.exoplayer2.c.e eVar) {
aw.this.f25540i.d(eVar);
aw.this.f25548q = null;
aw.this.D = null;
}
@Override
public void a(am amVar) {
k0.d(this, amVar);
}
@Override
public void a(an.a aVar) {
k0.e(this, aVar);
}
@Override
public void c(Exception exc) {
aw.this.f25540i.c(exc);
}
@Override
public void a(an.e eVar, an.e eVar2, int i11) {
k0.f(this, eVar, eVar2, i11);
}
@Override
public void b(String str, long j11, long j12) {
aw.this.f25540i.b(str, j11, j12);
}
@Override
public void a(an anVar, an.c cVar) {
k0.g(this, anVar, cVar);
}
@Override
public void b(v vVar, @Nullable com.applovin.exoplayer2.c.h hVar) {
aw.this.f25548q = vVar;
aw.this.f25540i.b(vVar, hVar);
}
@Override
public void a(ba baVar, int i11) {
k0.h(this, baVar, i11);
}
@Override
public void a(com.applovin.exoplayer2.h.ad adVar, com.applovin.exoplayer2.j.h hVar) {
k0.i(this, adVar, hVar);
}
@Override
public void b(String str) {
aw.this.f25540i.b(str);
}
@Override
public void a(v vVar) {
com.applovin.exoplayer2.b.c0.c(this, vVar);
}
@Override
public void b(Exception exc) {
aw.this.f25540i.b(exc);
}
@Override
public void a(boolean z11) {
m1.a(this, z11);
}
@Override
public void b(int i11) {
aw.this.Y();
}
@Override
public void a(boolean z11, int i11) {
k0.j(this, z11, i11);
}
@Override
public void b(boolean z11, int i11) {
aw.this.Y();
}
@Override
public void a(com.applovin.exoplayer2.c.e eVar) {
aw.this.C = eVar;
aw.this.f25540i.a(eVar);
}
@Override
public void b(boolean z11) {
aw.this.Y();
}
@Override
public void a(String str, long j11, long j12) {
aw.this.f25540i.a(str, j11, j12);
}
@Override
public void a(v vVar, @Nullable com.applovin.exoplayer2.c.h hVar) {
aw.this.f25547p = vVar;
aw.this.f25540i.a(vVar, hVar);
}
@Override
public void a(int i11, long j11) {
aw.this.f25540i.a(i11, j11);
}
@Override
public void a(com.applovin.exoplayer2.m.o oVar) {
aw.this.P = oVar;
aw.this.f25540i.a(oVar);
Iterator it = aw.this.f25539h.iterator();
while (it.hasNext()) {
((an.d) it.next()).a(oVar);
}
}
@Override
public void a(Object obj, long j11) {
aw.this.f25540i.a(obj, j11);
if (aw.this.f25550s == obj) {
Iterator it = aw.this.f25539h.iterator();
while (it.hasNext()) {
((an.d) it.next()).a();
}
}
}
@Override
public void onSurfaceTextureUpdated(SurfaceTexture surfaceTexture) {
}
@Override
public void a(String str) {
aw.this.f25540i.a(str);
}
@Override
public void a(long j11, int i11) {
aw.this.f25540i.a(j11, i11);
}
@Override
public void a(Exception exc) {
aw.this.f25540i.a(exc);
}
@Override
public void a(long j11) {
aw.this.f25540i.a(j11);
}
@Override
public void a(int i11, long j11, long j12) {
aw.this.f25540i.a(i11, j11, j12);
}
@Override
public void a(List<com.applovin.exoplayer2.i.a> list) {
aw.this.I = list;
Iterator it = aw.this.f25539h.iterator();
while (it.hasNext()) {
((an.d) it.next()).a(list);
}
}
@Override
public void a(com.applovin.exoplayer2.g.a aVar) {
aw.this.f25540i.a(aVar);
aw.this.f25536e.a(aVar);
Iterator it = aw.this.f25539h.iterator();
while (it.hasNext()) {
((an.d) it.next()).a(aVar);
}
}
@Override
public void a(Surface surface) {
aw.this.a((Object) null);
}
@Override
public void a(float f11) {
aw.this.W();
}
@Override
public void a(int i11) {
boolean x11 = aw.this.x();
aw.this.a(x11, i11, aw.b(x11, i11));
}
@Override
public void a() {
aw.this.a(false, -1, 3);
}
@Override
public void a(int i11, boolean z11) {
Iterator it = aw.this.f25539h.iterator();
while (it.hasNext()) {
((an.d) it.next()).a(i11, z11);
}
}
}
public aw(a aVar) {
aw awVar;
com.applovin.exoplayer2.b.d dVar;
boolean z11;
boolean z12;
com.applovin.exoplayer2.l.g gVar = new com.applovin.exoplayer2.l.g();
this.f25534c = gVar;
try {
Context applicationContext = aVar.f25558a.getApplicationContext();
this.f25535d = applicationContext;
com.applovin.exoplayer2.a.a aVar2 = aVar.f25566i;
this.f25540i = aVar2;
this.L = aVar.f25568k;
this.F = aVar.f25569l;
this.f25556y = aVar.f25574q;
this.f25557z = aVar.f25575r;
this.H = aVar.f25573p;
this.f25546o = aVar.f25582y;
b bVar = new b();
this.f25537f = bVar;
c cVar = new c();
this.f25538g = cVar;
this.f25539h = new CopyOnWriteArraySet<>();
Handler handler = new Handler(aVar.f25567j);
ar[] a11 = aVar.f25559b.a(handler, bVar, bVar, bVar, bVar);
this.f25533b = a11;
this.G = 1.0f;
if (com.applovin.exoplayer2.l.ai.f28818a < 21) {
this.E = d(0);
} else {
this.E = h.a(applicationContext);
}
this.I = Collections.emptyList();
this.J = true;
try {
r rVar = new r(a11, aVar.f25562e, aVar.f25563f, aVar.f25564g, aVar.f25565h, aVar2, aVar.f25576s, aVar.f25577t, aVar.f25578u, aVar.f25579v, aVar.f25580w, aVar.f25581x, aVar.f25583z, aVar.f25560c, aVar.f25567j, this, new an.a.C0486a().a(20, 21, 22, 23, 24, 25, 26, 27).a());
awVar = this;
try {
awVar.f25536e = rVar;
rVar.a((an.b) bVar);
rVar.a((q.a) bVar);
if (aVar.f25561d > 0) {
rVar.b(aVar.f25561d);
}
com.applovin.exoplayer2.b bVar2 = new com.applovin.exoplayer2.b(aVar.f25558a, handler, bVar);
awVar.f25541j = bVar2;
bVar2.a(aVar.f25572o);
com.applovin.exoplayer2.c cVar2 = new com.applovin.exoplayer2.c(aVar.f25558a, handler, bVar);
awVar.f25542k = cVar2;
if (aVar.f25570m) {
dVar = awVar.F;
} else {
dVar = null;
}
cVar2.a(dVar);
ay ayVar = new ay(aVar.f25558a, handler, bVar);
awVar.f25543l = ayVar;
ayVar.a(com.applovin.exoplayer2.l.ai.g(awVar.F.f25637d));
bb bbVar = new bb(aVar.f25558a);
awVar.f25544m = bbVar;
if (aVar.f25571n != 0) {
z11 = true;
} else {
z11 = false;
}
bbVar.a(z11);
bc bcVar = new bc(aVar.f25558a);
awVar.f25545n = bcVar;
if (aVar.f25571n == 2) {
z12 = true;
} else {
z12 = false;
}
bcVar.a(z12);
awVar.O = b(ayVar);
awVar.P = com.applovin.exoplayer2.m.o.f29118a;
awVar.a(1, 10, Integer.valueOf(awVar.E));
awVar.a(2, 10, Integer.valueOf(awVar.E));
awVar.a(1, 3, awVar.F);
awVar.a(2, 4, Integer.valueOf(awVar.f25556y));
awVar.a(2, 5, Integer.valueOf(awVar.f25557z));
awVar.a(1, 9, Boolean.valueOf(awVar.H));
awVar.a(2, 7, cVar);
awVar.a(6, 8, cVar);
gVar.a();
} catch (Throwable th2) {
th = th2;
awVar.f25534c.a();
throw th;
}
} catch (Throwable th3) {
th = th3;
awVar = this;
}
} catch (Throwable th4) {
th = th4;
awVar = this;
}
}
private void U() {
if (this.f25553v != null) {
this.f25536e.a(this.f25538g).a(10000).a((Object) null).i();
this.f25553v.b(this.f25537f);
this.f25553v = null;
}
TextureView textureView = this.f25555x;
if (textureView != null) {
if (textureView.getSurfaceTextureListener() != this.f25537f) {
com.applovin.exoplayer2.l.q.c("SimpleExoPlayer", "SurfaceTextureListener already unset or replaced.");
} else {
this.f25555x.setSurfaceTextureListener(null);
}
this.f25555x = null;
}
SurfaceHolder surfaceHolder = this.f25552u;
if (surfaceHolder != null) {
surfaceHolder.removeCallback(this.f25537f);
this.f25552u = null;
}
}
public void W() {
a(1, 2, Float.valueOf(this.G * this.f25542k.a()));
}
public void X() {
this.f25540i.a_(this.H);
Iterator<an.d> it = this.f25539h.iterator();
while (it.hasNext()) {
it.next().a_(this.H);
}
}
public void Y() {
int t11 = t();
boolean z11 = true;
if (t11 != 1) {
if (t11 != 2 && t11 != 3) {
if (t11 != 4) {
throw new IllegalStateException();
}
} else {
boolean q11 = q();
bb bbVar = this.f25544m;
if (!x() || q11) {
z11 = false;
}
bbVar.b(z11);
this.f25545n.b(x());
return;
}
}
this.f25544m.b(false);
this.f25545n.b(false);
}
private void Z() {
IllegalStateException illegalStateException;
this.f25534c.d();
if (Thread.currentThread() != r().getThread()) {
String a11 = com.applovin.exoplayer2.l.ai.a("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(), r().getThread().getName());
if (!this.J) {
if (this.K) {
illegalStateException = null;
} else {
illegalStateException = new IllegalStateException();
}
com.applovin.exoplayer2.l.q.b("SimpleExoPlayer", a11, illegalStateException);
this.K = true;
return;
}
throw new IllegalStateException(a11);
}
}
public static int b(boolean z11, int i11) {
return (!z11 || i11 == 1) ? 1 : 2;
}
@Override
public long A() {
Z();
return this.f25536e.A();
}
@Override
public long B() {
Z();
return this.f25536e.B();
}
@Override
public long C() {
Z();
return this.f25536e.C();
}
@Override
public am D() {
Z();
return this.f25536e.D();
}
public void E() {
AudioTrack audioTrack;
Z();
if (com.applovin.exoplayer2.l.ai.f28818a < 21 && (audioTrack = this.f25549r) != null) {
audioTrack.release();
this.f25549r = null;
}
this.f25541j.a(false);
this.f25543l.c();
this.f25544m.b(false);
this.f25545n.b(false);
this.f25542k.b();
this.f25536e.E();
this.f25540i.c();
U();
Surface surface = this.f25551t;
if (surface != null) {
surface.release();
this.f25551t = null;
}
if (this.M) {
((com.applovin.exoplayer2.l.aa) com.applovin.exoplayer2.l.a.b(this.L)).b(0);
this.M = false;
}
this.I = Collections.emptyList();
this.N = true;
}
@Override
public int F() {
Z();
return this.f25536e.F();
}
@Override
public int G() {
Z();
return this.f25536e.G();
}
@Override
public long H() {
Z();
return this.f25536e.H();
}
@Override
public long I() {
Z();
return this.f25536e.I();
}
@Override
public long J() {
Z();
return this.f25536e.J();
}
@Override
public boolean K() {
Z();
return this.f25536e.K();
}
@Override
public int L() {
Z();
return this.f25536e.L();
}
@Override
public int M() {
Z();
return this.f25536e.M();
}
@Override
public long N() {
Z();
return this.f25536e.N();
}
@Override
public long O() {
Z();
return this.f25536e.O();
}
@Override
public com.applovin.exoplayer2.h.ad P() {
Z();
return this.f25536e.P();
}
@Override
public com.applovin.exoplayer2.j.h Q() {
Z();
return this.f25536e.Q();
}
@Override
public ac R() {
return this.f25536e.R();
}
@Override
public ba S() {
Z();
return this.f25536e.S();
}
@Override
public com.applovin.exoplayer2.m.o T() {
return this.P;
}
@Override
public List<com.applovin.exoplayer2.i.a> V() {
Z();
return this.I;
}
public boolean q() {
Z();
return this.f25536e.q();
}
@Override
public Looper r() {
return this.f25536e.r();
}
@Override
public an.a s() {
Z();
return this.f25536e.s();
}
@Override
public int t() {
Z();
return this.f25536e.t();
}
@Override
public int u() {
Z();
return this.f25536e.u();
}
public void v() {
Z();
U();
a((Object) null);
a(0, 0);
}
@Override
public void w() {
Z();
boolean x11 = x();
int a11 = this.f25542k.a(x11, 2);
a(x11, a11, b(x11, a11));
this.f25536e.w();
}
@Override
public boolean x() {
Z();
return this.f25536e.x();
}
@Override
public int y() {
Z();
return this.f25536e.y();
}
@Override
public boolean z() {
Z();
return this.f25536e.z();
}
private int d(int i11) {
AudioTrack audioTrack = this.f25549r;
if (audioTrack != null && audioTrack.getAudioSessionId() != i11) {
this.f25549r.release();
this.f25549r = null;
}
if (this.f25549r == null) {
this.f25549r = new AudioTrack(3, PAGSdk.INIT_LOCAL_FAIL_CODE, 4, 2, 2, 0, i11);
}
return this.f25549r.getAudioSessionId();
}
@Override
public void c(int i11) {
Z();
this.f25536e.c(i11);
}
private void c(SurfaceHolder surfaceHolder) {
this.f25554w = false;
this.f25552u = surfaceHolder;
surfaceHolder.addCallback(this.f25537f);
Surface surface = this.f25552u.getSurface();
if (surface != null && surface.isValid()) {
Rect surfaceFrame = this.f25552u.getSurfaceFrame();
a(surfaceFrame.width(), surfaceFrame.height());
} else {
a(0, 0);
}
}
public void b(@Nullable SurfaceHolder surfaceHolder) {
Z();
if (surfaceHolder == null || surfaceHolder != this.f25552u) {
return;
}
v();
}
public static final class c implements ao.b, com.applovin.exoplayer2.m.a.a, com.applovin.exoplayer2.m.l {
@Nullable
private com.applovin.exoplayer2.m.l f25585a;
@Nullable
private com.applovin.exoplayer2.m.a.a f25586b;
@Nullable
private com.applovin.exoplayer2.m.l f25587c;
@Nullable
private com.applovin.exoplayer2.m.a.a f25588d;
private c() {
}
@Override
public void a(int i11, @Nullable Object obj) {
if (i11 == 7) {
this.f25585a = (com.applovin.exoplayer2.m.l) obj;
return;
}
if (i11 == 8) {
this.f25586b = (com.applovin.exoplayer2.m.a.a) obj;
return;
}
if (i11 != 10000) {
return;
}
com.applovin.exoplayer2.m.a.i iVar = (com.applovin.exoplayer2.m.a.i) obj;
if (iVar == null) {
this.f25587c = null;
this.f25588d = null;
} else {
this.f25587c = iVar.getVideoFrameMetadataListener();
this.f25588d = iVar.getCameraMotionListener();
}
}
@Override
public void a(long j11, long j12, v vVar, @Nullable MediaFormat mediaFormat) {
com.applovin.exoplayer2.m.l lVar = this.f25587c;
if (lVar != null) {
lVar.a(j11, j12, vVar, mediaFormat);
}
com.applovin.exoplayer2.m.l lVar2 = this.f25585a;
if (lVar2 != null) {
lVar2.a(j11, j12, vVar, mediaFormat);
}
}
@Override
public void a(long j11, float[] fArr) {
com.applovin.exoplayer2.m.a.a aVar = this.f25588d;
if (aVar != null) {
aVar.a(j11, fArr);
}
com.applovin.exoplayer2.m.a.a aVar2 = this.f25586b;
if (aVar2 != null) {
aVar2.a(j11, fArr);
}
}
@Override
public void a() {
com.applovin.exoplayer2.m.a.a aVar = this.f25588d;
if (aVar != null) {
aVar.a();
}
com.applovin.exoplayer2.m.a.a aVar2 = this.f25586b;
if (aVar2 != null) {
aVar2.a();
}
}
}
@Override
public void b(@Nullable SurfaceView surfaceView) {
Z();
b(surfaceView == null ? null : surfaceView.getHolder());
}
@Override
public void b(@Nullable TextureView textureView) {
Z();
if (textureView == null || textureView != this.f25555x) {
return;
}
v();
}
public void a(@Nullable SurfaceHolder surfaceHolder) {
Z();
if (surfaceHolder == null) {
v();
return;
}
U();
this.f25554w = true;
this.f25552u = surfaceHolder;
surfaceHolder.addCallback(this.f25537f);
Surface surface = surfaceHolder.getSurface();
if (surface != null && surface.isValid()) {
a(surface);
Rect surfaceFrame = surfaceHolder.getSurfaceFrame();
a(surfaceFrame.width(), surfaceFrame.height());
} else {
a((Object) null);
a(0, 0);
}
}
@Override
public void b(an.d dVar) {
com.applovin.exoplayer2.l.a.b(dVar);
this.f25539h.remove(dVar);
b((an.b) dVar);
}
@Deprecated
public void b(an.b bVar) {
this.f25536e.b(bVar);
}
@Override
@Nullable
public p e() {
Z();
return this.f25536e.e();
}
@Override
public void b(boolean z11) {
Z();
this.f25536e.b(z11);
}
public static o b(ay ayVar) {
return new o(0, ayVar.a(), ayVar.b());
}
@Override
public void a(@Nullable SurfaceView surfaceView) {
Z();
if (surfaceView instanceof com.applovin.exoplayer2.m.k) {
U();
a((Object) surfaceView);
c(surfaceView.getHolder());
} else {
if (surfaceView instanceof com.applovin.exoplayer2.m.a.i) {
U();
this.f25553v = (com.applovin.exoplayer2.m.a.i) surfaceView;
this.f25536e.a(this.f25538g).a(10000).a(this.f25553v).i();
this.f25553v.a(this.f25537f);
a(this.f25553v.getVideoSurface());
c(surfaceView.getHolder());
return;
}
a(surfaceView == null ? null : surfaceView.getHolder());
}
}
@Override
public void a(@Nullable TextureView textureView) {
Z();
if (textureView == null) {
v();
return;
}
U();
this.f25555x = textureView;
if (textureView.getSurfaceTextureListener() != null) {
com.applovin.exoplayer2.l.q.c("SimpleExoPlayer", "Replacing existing SurfaceTextureListener.");
}
textureView.setSurfaceTextureListener(this.f25537f);
SurfaceTexture surfaceTexture = textureView.isAvailable() ? textureView.getSurfaceTexture() : null;
if (surfaceTexture == null) {
a((Object) null);
a(0, 0);
} else {
a(surfaceTexture);
a(textureView.getWidth(), textureView.getHeight());
}
}
public void a(float f11) {
Z();
float a11 = com.applovin.exoplayer2.l.ai.a(f11, 0.0f, 1.0f);
if (this.G == a11) {
return;
}
this.G = a11;
W();
this.f25540i.a(a11);
Iterator<an.d> it = this.f25539h.iterator();
while (it.hasNext()) {
it.next().a(a11);
}
}
@Override
public void a(an.d dVar) {
com.applovin.exoplayer2.l.a.b(dVar);
this.f25539h.add(dVar);
a((an.b) dVar);
}
@Deprecated
public void a(an.b bVar) {
com.applovin.exoplayer2.l.a.b(bVar);
this.f25536e.a(bVar);
}
public void a(com.applovin.exoplayer2.h.p pVar) {
Z();
this.f25536e.a(pVar);
}
@Override
public void a(boolean z11) {
Z();
int a11 = this.f25542k.a(z11, t());
a(z11, a11, b(z11, a11));
}
@Override
public void a(int i11, long j11) {
Z();
this.f25540i.d();
this.f25536e.a(i11, j11);
}
public void a(SurfaceTexture surfaceTexture) {
Surface surface = new Surface(surfaceTexture);
a(surface);
this.f25551t = surface;
}
public void a(@Nullable Object obj) {
boolean z11;
ArrayList arrayList = new ArrayList();
ar[] arVarArr = this.f25533b;
int length = arVarArr.length;
int i11 = 0;
while (true) {
z11 = true;
if (i11 >= length) {
break;
}
ar arVar = arVarArr[i11];
if (arVar.a() == 2) {
arrayList.add(this.f25536e.a(arVar).a(1).a(obj).i());
}
i11++;
}
Object obj2 = this.f25550s;
if (obj2 == null || obj2 == obj) {
z11 = false;
} else {
try {
Iterator it = arrayList.iterator();
while (it.hasNext()) {
((ao) it.next()).a(this.f25546o);
}
} catch (InterruptedException unused) {
Thread.currentThread().interrupt();
} catch (TimeoutException unused2) {
}
z11 = false;
Object obj3 = this.f25550s;
Surface surface = this.f25551t;
if (obj3 == surface) {
surface.release();
this.f25551t = null;
}
}
this.f25550s = obj;
if (z11) {
this.f25536e.a(false, p.a(new u(3), 1003));
}
}
public void a(int i11, int i12) {
if (i11 == this.A && i12 == this.B) {
return;
}
this.A = i11;
this.B = i12;
this.f25540i.a(i11, i12);
Iterator<an.d> it = this.f25539h.iterator();
while (it.hasNext()) {
it.next().a(i11, i12);
}
}
public void a(boolean z11, int i11, int i12) {
int i13 = 0;
boolean z12 = z11 && i11 != -1;
if (z12 && i11 != 1) {
i13 = 1;
}
this.f25536e.a(z12, i13, i12);
}
private void a(int i11, int i12, @Nullable Object obj) {
for (ar arVar : this.f25533b) {
if (arVar.a() == i11) {
this.f25536e.a(arVar).a(i12).a(obj).i();
}
}
}
}