Cyber Surfer v5.2.5版本的 MD5 值为:db13c5fce988de393e52d2679f934b22

以下内容为反编译后的 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 com.applovin.exoplayer2.an;
import com.applovin.exoplayer2.ao;
import com.applovin.exoplayer2.ay;
import com.applovin.exoplayer2.b;
import com.applovin.exoplayer2.b.g;
import com.applovin.exoplayer2.c;
import com.applovin.exoplayer2.k;
import com.applovin.exoplayer2.m.a.i;
import com.applovin.exoplayer2.m.n;
import com.applovin.exoplayer2.q;
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 com.applovin.exoplayer2.b.d N;
    protected final ar[] bB;
    private final com.applovin.exoplayer2.a.a bM;
    private final bc hA;
    private final long hB;
    private v hC;
    private v hD;
    private AudioTrack hE;
    private Object hF;
    private Surface hG;
    private SurfaceHolder hH;
    private com.applovin.exoplayer2.m.a.i hI;
    private boolean hJ;
    private TextureView hK;
    private int hL;
    private int hM;
    private int hN;
    private int hO;
    private com.applovin.exoplayer2.c.e hP;
    private com.applovin.exoplayer2.c.e hQ;
    private int hR;
    private float hS;
    private boolean hT;
    private List<com.applovin.exoplayer2.i.a> hU;
    private boolean hV;
    private boolean hW;
    private com.applovin.exoplayer2.l.aa hX;
    private boolean hY;
    private boolean hZ;
    private final com.applovin.exoplayer2.l.g hq;
    private final Context hr;
    private final r hs;
    private final b ht;
    private final c hu;
    private final CopyOnWriteArraySet<an.d> hv;
    private final com.applovin.exoplayer2.b hw;
    private final com.applovin.exoplayer2.c hx;
    private final ay hy;
    private final bb hz;
    private o ia;
    private com.applovin.exoplayer2.m.o ib;

    @Deprecated
    public static final class a {
        private final Context E;
        private com.applovin.exoplayer2.b.d N;
        private com.applovin.exoplayer2.j.j bC;
        private boolean bK;
        private com.applovin.exoplayer2.h.r bL;
        private com.applovin.exoplayer2.a.a bM;
        private com.applovin.exoplayer2.k.d bO;
        private long bP;
        private long bQ;
        private com.applovin.exoplayer2.l.d bR;
        private av bY;
        private boolean bZ;
        private aa cl;
        private z ct;
        private long cu;
        private Looper gU;
        private long hB;
        private int hL;
        private int hM;
        private boolean hT;
        private com.applovin.exoplayer2.l.aa hX;
        private final au ic;
        private long id;
        private boolean ie;
        private int f0if;
        private boolean ig;
        private boolean ih;

        @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.i(context), new com.applovin.exoplayer2.a.a(com.applovin.exoplayer2.l.d.abJ));
        }

        @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.E = context;
            this.ic = auVar;
            this.bC = jVar;
            this.bL = rVar;
            this.cl = aaVar;
            this.bO = dVar;
            this.bM = aVar;
            this.gU = com.applovin.exoplayer2.l.ai.pZ();
            this.N = com.applovin.exoplayer2.b.d.jD;
            this.f0if = 0;
            this.hL = 1;
            this.hM = 0;
            this.bK = true;
            this.bY = av.hn;
            this.bP = 5000L;
            this.bQ = 15000L;
            this.ct = new k.a().ao();
            this.bR = com.applovin.exoplayer2.l.d.abJ;
            this.cu = 500L;
            this.hB = 2000L;
        }

        @Deprecated
        public aw cY() {
            com.applovin.exoplayer2.l.a.checkState(!this.ih);
            this.ih = true;
            return new aw(this);
        }
    }

    public final class b implements SurfaceHolder.Callback, TextureView.SurfaceTextureListener, an.b, ay.a, b.InterfaceC0024b, 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(boolean z) {
            if (aw.this.hT == z) {
                return;
            }
            aw.this.hT = z;
            aw.this.cV();
        }

        @Override
        public void Z(int i) {
            aw.this.cW();
        }

        @Override
        public void a(int i, long j, long j2) {
            aw.this.bM.a(i, j, j2);
        }

        @Override
        public void a(long j, int i) {
            aw.this.bM.a(j, i);
        }

        @Override
        public void a(Surface surface) {
            aw.this.i((Object) null);
        }

        @Override
        public void a(ab abVar, int i) {
            an.b.CC.$default$a(this, abVar, i);
        }

        @Override
        public void a(ac acVar) {
            an.b.CC.$default$a(this, acVar);
        }

        @Override
        public void a(ak akVar) {
            an.b.CC.$default$a(this, akVar);
        }

        @Override
        public void a(an.e eVar, an.e eVar2, int i) {
            an.b.CC.$default$a(this, eVar, eVar2, i);
        }

        @Override
        public void a(an anVar, an.c cVar) {
            an.b.CC.$default$a(this, anVar, cVar);
        }

        @Override
        public void a(com.applovin.exoplayer2.c.e eVar) {
            aw.this.hP = eVar;
            aw.this.bM.a(eVar);
        }

        @Override
        public void a(com.applovin.exoplayer2.g.a aVar) {
            aw.this.bM.a(aVar);
            aw.this.hs.a(aVar);
            Iterator it = aw.this.hv.iterator();
            while (it.hasNext()) {
                ((an.d) it.next()).a(aVar);
            }
        }

        @Override
        public void a(com.applovin.exoplayer2.h.ad adVar, com.applovin.exoplayer2.j.h hVar) {
            an.b.CC.$default$a(this, adVar, hVar);
        }

        @Override
        public void a(com.applovin.exoplayer2.m.o oVar) {
            aw.this.ib = oVar;
            aw.this.bM.a(oVar);
            Iterator it = aw.this.hv.iterator();
            while (it.hasNext()) {
                ((an.d) it.next()).a(oVar);
            }
        }

        @Override
        public void a(v vVar, com.applovin.exoplayer2.c.h hVar) {
            aw.this.hC = vVar;
            aw.this.bM.a(vVar, hVar);
        }

        @Override
        public void a(Exception exc) {
            aw.this.bM.a(exc);
        }

        @Override
        public void a(Object obj, long j) {
            aw.this.bM.a(obj, j);
            if (aw.this.hF == obj) {
                Iterator it = aw.this.hv.iterator();
                while (it.hasNext()) {
                    ((an.d) it.next()).cE();
                }
            }
        }

        @Override
        public void a(String str, long j, long j2) {
            aw.this.bM.a(str, j, j2);
        }

        @Override
        public void aa(int i) {
            an.b.CC.$default$aa(this, i);
        }

        @Override
        public void ab(int i) {
            an.b.CC.$default$ab(this, i);
        }

        @Override
        public void ac(int i) {
            an.b.CC.$default$ac(this, i);
        }

        @Override
        public void ai(int i) {
            o a2 = aw.a(aw.this.hy);
            if (a2.equals(aw.this.ia)) {
                return;
            }
            aw.this.ia = a2;
            Iterator it = aw.this.hv.iterator();
            while (it.hasNext()) {
                ((an.d) it.next()).a(a2);
            }
        }

        @Override
        public void b(float f) {
            aw.this.cU();
        }

        @Override
        public void b(int i, long j) {
            aw.this.bM.b(i, j);
        }

        @Override
        public void b(ak akVar) {
            an.b.CC.$default$b(this, akVar);
        }

        @Override
        public void b(am amVar) {
            an.b.CC.$default$b(this, amVar);
        }

        @Override
        public void b(ba baVar, int i) {
            an.b.CC.$default$b(this, baVar, i);
        }

        @Override
        public void b(com.applovin.exoplayer2.c.e eVar) {
            aw.this.bM.b(eVar);
            aw.this.hC = null;
            aw.this.hP = null;
        }

        @Override
        public void b(v vVar, com.applovin.exoplayer2.c.h hVar) {
            aw.this.hD = vVar;
            aw.this.bM.b(vVar, hVar);
        }

        @Override
        public void b(Exception exc) {
            aw.this.bM.b(exc);
        }

        @Override
        public void b(String str, long j, long j2) {
            aw.this.bM.b(str, j, j2);
        }

        @Override
        public void c(com.applovin.exoplayer2.c.e eVar) {
            aw.this.hQ = eVar;
            aw.this.bM.c(eVar);
        }

        @Override
        public void c(v vVar) {
            g.CC.$default$c(this, vVar);
        }

        @Override
        public void c(Exception exc) {
            aw.this.bM.c(exc);
        }

        @Override
        public void cD() {
            an.b.CC.$default$cD(this);
        }

        @Override
        public void d(an.a aVar) {
            an.b.CC.$default$d(this, aVar);
        }

        @Override
        public void d(com.applovin.exoplayer2.c.e eVar) {
            aw.this.bM.d(eVar);
            aw.this.hD = null;
            aw.this.hQ = null;
        }

        @Override
        public void d(boolean z, int i) {
            an.b.CC.$default$d(this, z, i);
        }

        @Override
        public void e(List<com.applovin.exoplayer2.i.a> list) {
            aw.this.hU = list;
            Iterator it = aw.this.hv.iterator();
            while (it.hasNext()) {
                ((an.d) it.next()).e(list);
            }
        }

        @Override
        public void e(boolean z, int i) {
            aw.this.cW();
        }

        @Override
        public void f(int i, boolean z) {
            Iterator it = aw.this.hv.iterator();
            while (it.hasNext()) {
                ((an.d) it.next()).e(i, z);
            }
        }

        @Override
        public void i(boolean z) {
            q.a.CC.$default$i(this, z);
        }

        @Override
        public void j(boolean z) {
            aw.this.cW();
        }

        @Override
        public void l(int i) {
            boolean aE = aw.this.aE();
            aw.this.b(aE, i, aw.f(aE, i));
        }

        @Override
        public void m() {
            aw.this.b(false, -1, 3);
        }

        @Override
        public void onSurfaceTextureAvailable(SurfaceTexture surfaceTexture, int i, int i2) {
            aw.this.a(surfaceTexture);
            aw.this.g(i, i2);
        }

        @Override
        public boolean onSurfaceTextureDestroyed(SurfaceTexture surfaceTexture) {
            aw.this.i((Object) null);
            aw.this.g(0, 0);
            return true;
        }

        @Override
        public void onSurfaceTextureSizeChanged(SurfaceTexture surfaceTexture, int i, int i2) {
            aw.this.g(i, i2);
        }

        @Override
        public void onSurfaceTextureUpdated(SurfaceTexture surfaceTexture) {
        }

        @Override
        public void r(String str) {
            aw.this.bM.r(str);
        }

        @Override
        public void s(String str) {
            aw.this.bM.s(str);
        }

        @Override
        public void surfaceChanged(SurfaceHolder surfaceHolder, int i, int i2, int i3) {
            aw.this.g(i2, i3);
        }

        @Override
        public void surfaceCreated(SurfaceHolder surfaceHolder) {
            if (aw.this.hJ) {
                aw.this.i(surfaceHolder.getSurface());
            }
        }

        @Override
        public void surfaceDestroyed(SurfaceHolder surfaceHolder) {
            if (aw.this.hJ) {
                aw.this.i((Object) null);
            }
            aw.this.g(0, 0);
        }

        @Override
        public void w(boolean z) {
            if (aw.this.hX != null) {
                if (z && !aw.this.hY) {
                    aw.this.hX.cR(0);
                    aw.this.hY = true;
                } else if (z || !aw.this.hY) {
                } else {
                    aw.this.hX.fF(0);
                    aw.this.hY = false;
                }
            }
        }

        @Override
        public void x(boolean z) {
            an.b.CC.$default$x(this, z);
        }

        @Override
        public void y(v vVar) {
            n.CC.$default$y(this, vVar);
        }

        @Override
        public void y(boolean z) {
            an.b.CC.$default$y(this, z);
        }

        @Override
        public void z(long j) {
            aw.this.bM.z(j);
        }

        @Override
        public void z(boolean z) {
            an.b.CC.$default$z(this, z);
        }
    }

    public static final class c implements ao.b, com.applovin.exoplayer2.m.a.a, com.applovin.exoplayer2.m.l {
        private com.applovin.exoplayer2.m.l ij;
        private com.applovin.exoplayer2.m.a.a ik;
        private com.applovin.exoplayer2.m.l il;
        private com.applovin.exoplayer2.m.a.a im;

        private c() {
        }

        @Override
        public void a(int i, Object obj) {
            if (i == 7) {
                this.ij = (com.applovin.exoplayer2.m.l) obj;
            } else if (i == 8) {
                this.ik = (com.applovin.exoplayer2.m.a.a) obj;
            } else if (i != 10000) {
            } else {
                com.applovin.exoplayer2.m.a.i iVar = (com.applovin.exoplayer2.m.a.i) obj;
                if (iVar == null) {
                    this.il = null;
                    this.im = null;
                    return;
                }
                this.il = iVar.getVideoFrameMetadataListener();
                this.im = iVar.getCameraMotionListener();
            }
        }

        @Override
        public void a(long j, long j2, v vVar, MediaFormat mediaFormat) {
            com.applovin.exoplayer2.m.l lVar = this.il;
            if (lVar != null) {
                lVar.a(j, j2, vVar, mediaFormat);
            }
            com.applovin.exoplayer2.m.l lVar2 = this.ij;
            if (lVar2 != null) {
                lVar2.a(j, j2, vVar, mediaFormat);
            }
        }

        @Override
        public void a(long j, float[] fArr) {
            com.applovin.exoplayer2.m.a.a aVar = this.im;
            if (aVar != null) {
                aVar.a(j, fArr);
            }
            com.applovin.exoplayer2.m.a.a aVar2 = this.ik;
            if (aVar2 != null) {
                aVar2.a(j, fArr);
            }
        }

        @Override
        public void cZ() {
            com.applovin.exoplayer2.m.a.a aVar = this.im;
            if (aVar != null) {
                aVar.cZ();
            }
            com.applovin.exoplayer2.m.a.a aVar2 = this.ik;
            if (aVar2 != null) {
                aVar2.cZ();
            }
        }
    }

    protected aw(a aVar) {
        aw awVar;
        com.applovin.exoplayer2.l.g gVar = new com.applovin.exoplayer2.l.g();
        this.hq = gVar;
        try {
            Context applicationContext = aVar.E.getApplicationContext();
            this.hr = applicationContext;
            com.applovin.exoplayer2.a.a aVar2 = aVar.bM;
            this.bM = aVar2;
            this.hX = aVar.hX;
            this.N = aVar.N;
            this.hL = aVar.hL;
            this.hM = aVar.hM;
            this.hT = aVar.hT;
            this.hB = aVar.hB;
            b bVar = new b();
            this.ht = bVar;
            c cVar = new c();
            this.hu = cVar;
            this.hv = new CopyOnWriteArraySet<>();
            Handler handler = new Handler(aVar.gU);
            ar[] a2 = aVar.ic.a(handler, bVar, bVar, bVar, bVar);
            this.bB = a2;
            this.hS = 1.0f;
            if (com.applovin.exoplayer2.l.ai.acV < 21) {
                this.hR = ah(0);
            } else {
                this.hR = h.c(applicationContext);
            }
            this.hU = Collections.emptyList();
            this.hV = true;
            try {
                r rVar = new r(a2, aVar.bC, aVar.bL, aVar.cl, aVar.bO, aVar2, aVar.bK, aVar.bY, aVar.bP, aVar.bQ, aVar.ct, aVar.cu, aVar.bZ, aVar.bR, aVar.gU, this, new an.a.C0022a().a(20, 21, 22, 23, 24, 25, 26, 27).cC());
                awVar = this;
                try {
                    awVar.hs = rVar;
                    rVar.a((an.b) bVar);
                    rVar.a((q.a) bVar);
                    if (aVar.id > 0) {
                        rVar.j(aVar.id);
                    }
                    com.applovin.exoplayer2.b bVar2 = new com.applovin.exoplayer2.b(aVar.E, handler, bVar);
                    awVar.hw = bVar2;
                    bVar2.setEnabled(aVar.ig);
                    com.applovin.exoplayer2.c cVar2 = new com.applovin.exoplayer2.c(aVar.E, handler, bVar);
                    awVar.hx = cVar2;
                    cVar2.a(aVar.ie ? awVar.N : null);
                    ay ayVar = new ay(aVar.E, handler, bVar);
                    awVar.hy = ayVar;
                    ayVar.aj(com.applovin.exoplayer2.l.ai.fM(awVar.N.jG));
                    bb bbVar = new bb(aVar.E);
                    awVar.hz = bbVar;
                    bbVar.setEnabled(aVar.f0if != 0);
                    bc bcVar = new bc(aVar.E);
                    awVar.hA = bcVar;
                    bcVar.setEnabled(aVar.f0if == 2);
                    awVar.ia = a(ayVar);
                    awVar.ib = com.applovin.exoplayer2.m.o.afk;
                    awVar.a(1, 10, Integer.valueOf(awVar.hR));
                    awVar.a(2, 10, Integer.valueOf(awVar.hR));
                    awVar.a(1, 3, awVar.N);
                    awVar.a(2, 4, Integer.valueOf(awVar.hL));
                    awVar.a(2, 5, Integer.valueOf(awVar.hM));
                    awVar.a(1, 9, Boolean.valueOf(awVar.hT));
                    awVar.a(2, 7, cVar);
                    awVar.a(6, 8, cVar);
                    gVar.oN();
                } catch (Throwable th) {
                    th = th;
                    awVar.hq.oN();
                    throw th;
                }
            } catch (Throwable th2) {
                th = th2;
                awVar = this;
            }
        } catch (Throwable th3) {
            th = th3;
            awVar = this;
        }
    }

    public static o a(ay ayVar) {
        return new o(0, ayVar.da(), ayVar.db());
    }

    private void a(int i, int i2, Object obj) {
        ar[] arVarArr;
        for (ar arVar : this.bB) {
            if (arVar.M() == i) {
                this.hs.a(arVar).ad(i2).h(obj).cM();
            }
        }
    }

    public void a(SurfaceTexture surfaceTexture) {
        Surface surface = new Surface(surfaceTexture);
        i(surface);
        this.hG = surface;
    }

    private int ah(int i) {
        AudioTrack audioTrack = this.hE;
        if (audioTrack != null && audioTrack.getAudioSessionId() != i) {
            this.hE.release();
            this.hE = null;
        }
        if (this.hE == null) {
            this.hE = new AudioTrack(3, 4000, 4, 2, 2, 0, i);
        }
        return this.hE.getAudioSessionId();
    }

    public void b(boolean z, int i, int i2) {
        int i3 = 0;
        boolean z2 = z && i != -1;
        if (z2 && i != 1) {
            i3 = 1;
        }
        this.hs.a(z2, i3, i2);
    }

    private void c(SurfaceHolder surfaceHolder) {
        this.hJ = false;
        this.hH = surfaceHolder;
        surfaceHolder.addCallback(this.ht);
        Surface surface = this.hH.getSurface();
        if (surface == null || !surface.isValid()) {
            g(0, 0);
            return;
        }
        Rect surfaceFrame = this.hH.getSurfaceFrame();
        g(surfaceFrame.width(), surfaceFrame.height());
    }

    private void cT() {
        if (this.hI != null) {
            this.hs.a(this.hu).ad(10000).h(null).cM();
            this.hI.b(this.ht);
            this.hI = null;
        }
        TextureView textureView = this.hK;
        if (textureView != null) {
            if (textureView.getSurfaceTextureListener() != this.ht) {
                com.applovin.exoplayer2.l.q.h("SimpleExoPlayer", "SurfaceTextureListener already unset or replaced.");
            } else {
                this.hK.setSurfaceTextureListener(null);
            }
            this.hK = null;
        }
        SurfaceHolder surfaceHolder = this.hH;
        if (surfaceHolder != null) {
            surfaceHolder.removeCallback(this.ht);
            this.hH = null;
        }
    }

    public void cU() {
        a(1, 2, Float.valueOf(this.hS * this.hx.n()));
    }

    public void cV() {
        this.bM.A(this.hT);
        Iterator<an.d> it = this.hv.iterator();
        while (it.hasNext()) {
            it.next().A(this.hT);
        }
    }

    public void cW() {
        int aB = aB();
        boolean z = true;
        if (aB != 1) {
            if (aB == 2 || aB == 3) {
                this.hz.C((!aE() || ay()) ? false : false);
                this.hA.C(aE());
                return;
            } else if (aB != 4) {
                throw new IllegalStateException();
            }
        }
        this.hz.C(false);
        this.hA.C(false);
    }

    private void cX() {
        this.hq.oQ();
        if (Thread.currentThread() != az().getThread()) {
            String a2 = 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(), az().getThread().getName());
            if (this.hV) {
                throw new IllegalStateException(a2);
            }
            com.applovin.exoplayer2.l.q.b("SimpleExoPlayer", a2, this.hW ? null : new IllegalStateException());
            this.hW = true;
        }
    }

    public static int f(boolean z, int i) {
        return (!z || i == 1) ? 1 : 2;
    }

    public void g(int i, int i2) {
        if (i == this.hN && i2 == this.hO) {
            return;
        }
        this.hN = i;
        this.hO = i2;
        this.bM.f(i, i2);
        Iterator<an.d> it = this.hv.iterator();
        while (it.hasNext()) {
            it.next().f(i, i2);
        }
    }

    public void i(Object obj) {
        boolean z;
        ArrayList<ao> arrayList = new ArrayList();
        ar[] arVarArr = this.bB;
        int length = arVarArr.length;
        int i = 0;
        while (true) {
            z = true;
            if (i >= length) {
                break;
            }
            ar arVar = arVarArr[i];
            if (arVar.M() == 2) {
                arrayList.add(this.hs.a(arVar).ad(1).h(obj).cM());
            }
            i++;
        }
        Object obj2 = this.hF;
        if (obj2 == null || obj2 == obj) {
            z = false;
        } else {
            try {
                for (ao aoVar : arrayList) {
                    aoVar.y(this.hB);
                }
            } catch (InterruptedException unused) {
                Thread.currentThread().interrupt();
            } catch (TimeoutException unused2) {
            }
            z = false;
            Object obj3 = this.hF;
            Surface surface = this.hG;
            if (obj3 == surface) {
                surface.release();
                this.hG = null;
            }
        }
        this.hF = obj;
        if (z) {
            this.hs.a(false, p.a(new u(3), 1003));
        }
    }

    @Override
    public void a(int i, long j) {
        cX();
        this.bM.dq();
        this.hs.a(i, j);
    }

    public void a(SurfaceHolder surfaceHolder) {
        cX();
        if (surfaceHolder == null) {
            cS();
            return;
        }
        cT();
        this.hJ = true;
        this.hH = surfaceHolder;
        surfaceHolder.addCallback(this.ht);
        Surface surface = surfaceHolder.getSurface();
        if (surface == null || !surface.isValid()) {
            i((Object) null);
            g(0, 0);
            return;
        }
        i(surface);
        Rect surfaceFrame = surfaceHolder.getSurfaceFrame();
        g(surfaceFrame.width(), surfaceFrame.height());
    }

    @Override
    public void a(SurfaceView surfaceView) {
        cX();
        if (surfaceView instanceof com.applovin.exoplayer2.m.k) {
            cT();
            i(surfaceView);
            c(surfaceView.getHolder());
        } else if (!(surfaceView instanceof com.applovin.exoplayer2.m.a.i)) {
            a(surfaceView == null ? null : surfaceView.getHolder());
        } else {
            cT();
            this.hI = (com.applovin.exoplayer2.m.a.i) surfaceView;
            this.hs.a(this.hu).ad(10000).h(this.hI).cM();
            this.hI.a(this.ht);
            i(this.hI.getVideoSurface());
            c(surfaceView.getHolder());
        }
    }

    @Override
    public void a(TextureView textureView) {
        cX();
        if (textureView == null) {
            cS();
            return;
        }
        cT();
        this.hK = textureView;
        if (textureView.getSurfaceTextureListener() != null) {
            com.applovin.exoplayer2.l.q.h("SimpleExoPlayer", "Replacing existing SurfaceTextureListener.");
        }
        textureView.setSurfaceTextureListener(this.ht);
        SurfaceTexture surfaceTexture = textureView.isAvailable() ? textureView.getSurfaceTexture() : null;
        if (surfaceTexture == null) {
            i((Object) null);
            g(0, 0);
            return;
        }
        a(surfaceTexture);
        g(textureView.getWidth(), textureView.getHeight());
    }

    @Override
    public void a(an.d dVar) {
        com.applovin.exoplayer2.l.a.checkNotNull(dVar);
        this.hv.add(dVar);
        f(dVar);
    }

    public void a(com.applovin.exoplayer2.h.p pVar) {
        cX();
        this.hs.a(pVar);
    }

    @Override
    public an.a aA() {
        cX();
        return this.hs.aA();
    }

    @Override
    public int aB() {
        cX();
        return this.hs.aB();
    }

    @Override
    public int aC() {
        cX();
        return this.hs.aC();
    }

    @Override
    public void aD() {
        cX();
        boolean aE = aE();
        int a2 = this.hx.a(aE, 2);
        b(aE, a2, f(aE, a2));
        this.hs.aD();
    }

    @Override
    public boolean aE() {
        cX();
        return this.hs.aE();
    }

    @Override
    public int aF() {
        cX();
        return this.hs.aF();
    }

    @Override
    public boolean aG() {
        cX();
        return this.hs.aG();
    }

    @Override
    public long aH() {
        cX();
        return this.hs.aH();
    }

    @Override
    public long aI() {
        cX();
        return this.hs.aI();
    }

    @Override
    public long aJ() {
        cX();
        return this.hs.aJ();
    }

    @Override
    public int aK() {
        cX();
        return this.hs.aK();
    }

    @Override
    public int aL() {
        cX();
        return this.hs.aL();
    }

    @Override
    public long aM() {
        cX();
        return this.hs.aM();
    }

    @Override
    public long aN() {
        cX();
        return this.hs.aN();
    }

    @Override
    public long aO() {
        cX();
        return this.hs.aO();
    }

    @Override
    public boolean aP() {
        cX();
        return this.hs.aP();
    }

    @Override
    public int aQ() {
        cX();
        return this.hs.aQ();
    }

    @Override
    public int aR() {
        cX();
        return this.hs.aR();
    }

    @Override
    public long aS() {
        cX();
        return this.hs.aS();
    }

    @Override
    public long aT() {
        cX();
        return this.hs.aT();
    }

    @Override
    public com.applovin.exoplayer2.h.ad aU() {
        cX();
        return this.hs.aU();
    }

    @Override
    public com.applovin.exoplayer2.j.h aV() {
        cX();
        return this.hs.aV();
    }

    @Override
    public ac aW() {
        return this.hs.aW();
    }

    @Override
    public ba aX() {
        cX();
        return this.hs.aX();
    }

    @Override
    public com.applovin.exoplayer2.m.o aY() {
        return this.ib;
    }

    @Override
    public am av() {
        cX();
        return this.hs.av();
    }

    @Override
    public p ax() {
        cX();
        return this.hs.ax();
    }

    public boolean ay() {
        cX();
        return this.hs.ay();
    }

    @Override
    public Looper az() {
        return this.hs.az();
    }

    public void b(SurfaceHolder surfaceHolder) {
        cX();
        if (surfaceHolder == null || surfaceHolder != this.hH) {
            return;
        }
        cS();
    }

    @Override
    public void b(SurfaceView surfaceView) {
        cX();
        b(surfaceView == null ? null : surfaceView.getHolder());
    }

    @Override
    public void b(TextureView textureView) {
        cX();
        if (textureView == null || textureView != this.hK) {
            return;
        }
        cS();
    }

    @Override
    public void b(an.d dVar) {
        com.applovin.exoplayer2.l.a.checkNotNull(dVar);
        this.hv.remove(dVar);
        g(dVar);
    }

    @Override
    public List<com.applovin.exoplayer2.i.a> bd() {
        cX();
        return this.hU;
    }

    public void cS() {
        cX();
        cT();
        i((Object) null);
        g(0, 0);
    }

    @Deprecated
    public void f(an.b bVar) {
        com.applovin.exoplayer2.l.a.checkNotNull(bVar);
        this.hs.a(bVar);
    }

    @Deprecated
    public void g(an.b bVar) {
        this.hs.b(bVar);
    }

    public void h(float f) {
        cX();
        float a2 = com.applovin.exoplayer2.l.ai.a(f, 0.0f, 1.0f);
        if (this.hS == a2) {
            return;
        }
        this.hS = a2;
        cU();
        this.bM.g(a2);
        Iterator<an.d> it = this.hv.iterator();
        while (it.hasNext()) {
            it.next().g(a2);
        }
    }

    @Override
    public void k(boolean z) {
        cX();
        int a2 = this.hx.a(z, aB());
        b(z, a2, f(z, a2));
    }

    @Override
    public void l(boolean z) {
        cX();
        this.hs.l(z);
    }

    public void release() {
        AudioTrack audioTrack;
        cX();
        if (com.applovin.exoplayer2.l.ai.acV < 21 && (audioTrack = this.hE) != null) {
            audioTrack.release();
            this.hE = null;
        }
        this.hw.setEnabled(false);
        this.hy.release();
        this.hz.C(false);
        this.hA.C(false);
        this.hx.release();
        this.hs.release();
        this.bM.release();
        cT();
        Surface surface = this.hG;
        if (surface != null) {
            surface.release();
            this.hG = null;
        }
        if (this.hY) {
            ((com.applovin.exoplayer2.l.aa) com.applovin.exoplayer2.l.a.checkNotNull(this.hX)).fF(0);
            this.hY = false;
        }
        this.hU = Collections.emptyList();
        this.hZ = true;
    }

    @Override
    public void u(int i) {
        cX();
        this.hs.u(i);
    }
}