APK反编译源代码展示 - 南明离火平台提供

应用版本信息
应用名称:Նվագարկիչ
版本号:9.9.9
包名称:com.iptv.player

MD5 校验值:d7f913ab91d7343430e85d5ce2e5aff0

反编译源代码说明

m1.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。


package i5;

import android.content.Context;
import android.graphics.Rect;
import android.graphics.SurfaceTexture;
import android.media.AudioManager;
import android.media.AudioTrack;
import android.media.MediaFormat;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import android.util.SparseBooleanArray;
import android.view.Surface;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.TextureView;
import com.google.android.exoplayer2.metadata.Metadata;
import i5.b;
import i5.c0;
import i5.c1;
import i5.d;
import i5.k0;
import i5.p1;
import i5.r;
import i5.x0;
import j5.r;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.CopyOnWriteArraySet;
import java.util.concurrent.TimeoutException;
import m7.w;
import o7.j;

@Deprecated
public class m1 extends e implements r {
    public int A;
    public k5.d B;
    public float C;
    public boolean D;
    public List<z6.a> E;
    public n7.j F;
    public boolean G;
    public boolean H;
    public boolean I;
    public o J;
    public n7.p K;

    public final g1[] f32508b;

    public final r6.f f32509c;

    public final z f32510d;

    public final b f32511e;

    public final c f32512f;

    public final CopyOnWriteArraySet<x0.e> f32513g;

    public final j5.q f32514h;

    public final i5.b f32515i;

    public final d f32516j;

    public final p1 f32517k;

    public final v1 f32518l;

    public final w1 f32519m;

    public final long f32520n;

    public f0 f32521o;

    public f0 f32522p;

    public AudioTrack f32523q;

    public Object f32524r;

    public Surface f32525s;

    public SurfaceHolder f32526t;

    public o7.j f32527u;

    public boolean f32528v;

    public TextureView f32529w;

    public int f32530x;

    public int f32531y;

    public int f32532z;

    public final class b implements n7.o, k5.l, z6.n, h6.e, SurfaceHolder.Callback, TextureView.SurfaceTextureListener, j.b, d.b, b.InterfaceC0174b, p1.b, x0.c, r.a {
        public b(a aVar) {
        }

        @Override
        public void A(int i10) {
            m1.i0(m1.this);
        }

        @Override
        public void B(f0 f0Var, l5.g gVar) {
            m1 m1Var = m1.this;
            m1Var.f32522p = f0Var;
            m1Var.f32514h.B(f0Var, gVar);
        }

        @Override
        public void C(String str) {
            m1.this.f32514h.C(str);
        }

        @Override
        public void D(boolean z10) {
            z0.p(this, z10);
        }

        @Override
        public void E(f0 f0Var) {
            k5.g.a(this, f0Var);
        }

        @Override
        public void F(l5.d dVar) {
            m1.this.f32514h.F(dVar);
            m1.this.f32521o = null;
        }

        @Override
        public void G(f0 f0Var, l5.g gVar) {
            m1 m1Var = m1.this;
            m1Var.f32521o = f0Var;
            m1Var.f32514h.G(f0Var, gVar);
        }

        @Override
        public void H(k0 k0Var) {
            z0.f(this, k0Var);
        }

        @Override
        public void I(t1 t1Var, int i10) {
            z0.q(this, t1Var, i10);
        }

        @Override
        public void J(boolean z10) {
            q.a(this, z10);
        }

        @Override
        public void M(Object obj, long j10) {
            m1.this.f32514h.M(obj, j10);
            m1 m1Var = m1.this;
            if (m1Var.f32524r == obj) {
                Iterator<x0.e> it = m1Var.f32513g.iterator();
                while (it.hasNext()) {
                    it.next().b();
                }
            }
        }

        @Override
        public void O(w0 w0Var) {
            z0.g(this, w0Var);
        }

        @Override
        public void P(u1 u1Var) {
            z0.s(this, u1Var);
        }

        @Override
        public void Q(long j10) {
            m1.this.f32514h.Q(j10);
        }

        @Override
        public void R(x0.b bVar) {
            z0.a(this, bVar);
        }

        @Override
        public void S(x0.f fVar, x0.f fVar2, int i10) {
            z0.m(this, fVar, fVar2, i10);
        }

        @Override
        public void U(Exception exc) {
            m1.this.f32514h.U(exc);
        }

        @Override
        public void W(Exception exc) {
            m1.this.f32514h.W(exc);
        }

        @Override
        public void X(boolean z10, int i10) {
            m1.i0(m1.this);
        }

        @Override
        public void Z(p6.i0 i0Var, j7.s sVar) {
            z0.r(this, i0Var, sVar);
        }

        @Override
        public void a() {
            z0.o(this);
        }

        @Override
        public void c(boolean z10) {
            m1 m1Var = m1.this;
            if (m1Var.D == z10) {
                return;
            }
            m1Var.D = z10;
            m1Var.f32514h.c(z10);
            Iterator<x0.e> it = m1Var.f32513g.iterator();
            while (it.hasNext()) {
                it.next().c(m1Var.D);
            }
        }

        @Override
        public void c0(j0 j0Var, int i10) {
            z0.e(this, j0Var, i10);
        }

        @Override
        public void d(boolean z10) {
            z0.d(this, z10);
        }

        @Override
        public void d0(u0 u0Var) {
            z0.i(this, u0Var);
        }

        @Override
        public void e(int i10) {
            z0.l(this, i10);
        }

        @Override
        public void e0(l5.d dVar) {
            Objects.requireNonNull(m1.this);
            m1.this.f32514h.e0(dVar);
        }

        @Override
        public void f(String str, long j10, long j11) {
            m1.this.f32514h.f(str, j10, j11);
        }

        @Override
        public void f0(int i10, long j10, long j11) {
            m1.this.f32514h.f0(i10, j10, j11);
        }

        @Override
        public void h(String str, long j10, long j11) {
            m1.this.f32514h.h(str, j10, j11);
        }

        @Override
        public void h0(long j10, int i10) {
            m1.this.f32514h.h0(j10, i10);
        }

        @Override
        public void i(Metadata metadata) {
            m1.this.f32514h.i(metadata);
            z zVar = m1.this.f32510d;
            k0.b b10 = zVar.E.b();
            int i10 = 0;
            int i11 = 0;
            while (true) {
                Metadata.Entry[] entryArr = metadata.f14951a;
                if (i11 >= entryArr.length) {
                    break;
                }
                entryArr[i11].p0(b10);
                i11++;
            }
            zVar.E = b10.a();
            k0 b11 = zVar.b();
            if (!b11.equals(zVar.D)) {
                zVar.D = b11;
                m7.l<x0.c> lVar = zVar.f32756i;
                lVar.b(14, new y(zVar, i10));
                lVar.a();
            }
            Iterator<x0.e> it = m1.this.f32513g.iterator();
            while (it.hasNext()) {
                it.next().i(metadata);
            }
        }

        @Override
        public void i0(u0 u0Var) {
            z0.j(this, u0Var);
        }

        @Override
        public void j(int i10, long j10) {
            m1.this.f32514h.j(i10, j10);
        }

        @Override
        public void j0(boolean z10) {
            z0.c(this, z10);
        }

        @Override
        public void k(Exception exc) {
            m1.this.f32514h.k(exc);
        }

        @Override
        public void l(boolean z10, int i10) {
            z0.k(this, z10, i10);
        }

        @Override
        public void m(boolean z10) {
            m1.i0(m1.this);
        }

        @Override
        public void n(String str) {
            m1.this.f32514h.n(str);
        }

        @Override
        public void o(List<z6.a> list) {
            m1 m1Var = m1.this;
            m1Var.E = list;
            Iterator<x0.e> it = m1Var.f32513g.iterator();
            while (it.hasNext()) {
                it.next().o(list);
            }
        }

        @Override
        public void onSurfaceTextureAvailable(SurfaceTexture surfaceTexture, int i10, int i11) {
            m1 m1Var = m1.this;
            Objects.requireNonNull(m1Var);
            Surface surface = new Surface(surfaceTexture);
            m1Var.r0(surface);
            m1Var.f32525s = surface;
            m1.this.m0(i10, i11);
        }

        @Override
        public boolean onSurfaceTextureDestroyed(SurfaceTexture surfaceTexture) {
            m1.this.r0(null);
            m1.this.m0(0, 0);
            return true;
        }

        @Override
        public void onSurfaceTextureSizeChanged(SurfaceTexture surfaceTexture, int i10, int i11) {
            m1.this.m0(i10, i11);
        }

        @Override
        public void onSurfaceTextureUpdated(SurfaceTexture surfaceTexture) {
        }

        @Override
        public void p(l5.d dVar) {
            Objects.requireNonNull(m1.this);
            m1.this.f32514h.p(dVar);
        }

        @Override
        public void q(Surface surface) {
            m1.this.r0(null);
        }

        @Override
        public void s(l5.d dVar) {
            m1.this.f32514h.s(dVar);
            m1.this.f32522p = null;
        }

        @Override
        public void s0(int i10) {
            z0.n(this, i10);
        }

        @Override
        public void surfaceChanged(SurfaceHolder surfaceHolder, int i10, int i11, int i12) {
            m1.this.m0(i11, i12);
        }

        @Override
        public void surfaceCreated(SurfaceHolder surfaceHolder) {
            m1 m1Var = m1.this;
            if (m1Var.f32528v) {
                m1Var.r0(surfaceHolder.getSurface());
            }
        }

        @Override
        public void surfaceDestroyed(SurfaceHolder surfaceHolder) {
            m1 m1Var = m1.this;
            if (m1Var.f32528v) {
                m1Var.r0(null);
            }
            m1.this.m0(0, 0);
        }

        @Override
        public void t(n7.p pVar) {
            m1 m1Var = m1.this;
            m1Var.K = pVar;
            m1Var.f32514h.t(pVar);
            Iterator<x0.e> it = m1.this.f32513g.iterator();
            while (it.hasNext()) {
                it.next().t(pVar);
            }
        }

        @Override
        public void u(int i10) {
            z0.h(this, i10);
        }

        @Override
        public void w(x0 x0Var, x0.d dVar) {
            z0.b(this, x0Var, dVar);
        }

        @Override
        public void x(boolean z10) {
            Objects.requireNonNull(m1.this);
        }

        @Override
        public void y(f0 f0Var) {
            n7.l.a(this, f0Var);
        }

        @Override
        public void z(Surface surface) {
            m1.this.r0(surface);
        }
    }

    public static final class c implements n7.j, o7.a, c1.b {

        public n7.j f32534a;

        public o7.a f32535b;

        public n7.j f32536c;

        public o7.a f32537d;

        public c(a aVar) {
        }

        @Override
        public void e(long j10, float[] fArr) {
            o7.a aVar = this.f32537d;
            if (aVar != null) {
                aVar.e(j10, fArr);
            }
            o7.a aVar2 = this.f32535b;
            if (aVar2 != null) {
                aVar2.e(j10, fArr);
            }
        }

        @Override
        public void f(long j10, long j11, f0 f0Var, MediaFormat mediaFormat) {
            n7.j jVar = this.f32536c;
            if (jVar != null) {
                jVar.f(j10, j11, f0Var, mediaFormat);
            }
            n7.j jVar2 = this.f32534a;
            if (jVar2 != null) {
                jVar2.f(j10, j11, f0Var, mediaFormat);
            }
        }

        @Override
        public void h() {
            o7.a aVar = this.f32537d;
            if (aVar != null) {
                aVar.h();
            }
            o7.a aVar2 = this.f32535b;
            if (aVar2 != null) {
                aVar2.h();
            }
        }

        @Override
        public void n(int i10, Object obj) {
            if (i10 == 7) {
                this.f32534a = (n7.j) obj;
                return;
            }
            if (i10 == 8) {
                this.f32535b = (o7.a) obj;
                return;
            }
            if (i10 != 10000) {
                return;
            }
            o7.j jVar = (o7.j) obj;
            if (jVar == null) {
                this.f32536c = null;
                this.f32537d = null;
            } else {
                this.f32536c = jVar.getVideoFrameMetadataListener();
                this.f32537d = jVar.getCameraMotionListener();
            }
        }
    }

    public m1(r.b bVar) {
        m1 m1Var;
        r6.f fVar = new r6.f(1);
        this.f32509c = fVar;
        try {
            Context applicationContext = bVar.f32611a.getApplicationContext();
            j5.q qVar = bVar.f32618h.get();
            this.f32514h = qVar;
            this.B = bVar.f32620j;
            this.f32530x = bVar.f32621k;
            this.D = false;
            this.f32520n = bVar.f32628r;
            b bVar2 = new b(null);
            this.f32511e = bVar2;
            c cVar = new c(null);
            this.f32512f = cVar;
            this.f32513g = new CopyOnWriteArraySet<>();
            Handler handler = new Handler(bVar.f32619i);
            g1[] a10 = bVar.f32613c.get().a(handler, bVar2, bVar2, bVar2, bVar2);
            this.f32508b = a10;
            this.C = 1.0f;
            if (m7.z.f36487a < 21) {
                AudioTrack audioTrack = this.f32523q;
                if (audioTrack != null && audioTrack.getAudioSessionId() != 0) {
                    this.f32523q.release();
                    this.f32523q = null;
                }
                if (this.f32523q == null) {
                    this.f32523q = new AudioTrack(3, 4000, 4, 2, 2, 0, 0);
                }
                this.A = this.f32523q.getAudioSessionId();
            } else {
                AudioManager audioManager = (AudioManager) applicationContext.getSystemService("audio");
                this.A = audioManager == null ? -1 : audioManager.generateAudioSessionId();
            }
            this.E = Collections.emptyList();
            this.G = true;
            SparseBooleanArray sparseBooleanArray = new SparseBooleanArray();
            int[] iArr = new int[8];
            iArr[0] = 21;
            iArr[1] = 22;
            iArr[2] = 23;
            iArr[3] = 24;
            iArr[4] = 25;
            iArr[5] = 26;
            try {
                iArr[6] = 27;
                iArr[7] = 28;
                for (int i10 = 0; i10 < 8; i10++) {
                    int i11 = iArr[i10];
                    c0.a.f(!false);
                    sparseBooleanArray.append(i11, true);
                }
                c0.a.f(!false);
                z zVar = new z(a10, bVar.f32615e.get(), bVar.f32614d.get(), bVar.f32616f.get(), bVar.f32617g.get(), qVar, bVar.f32622l, bVar.f32623m, bVar.f32624n, bVar.f32625o, bVar.f32626p, bVar.f32627q, false, bVar.f32612b, bVar.f32619i, this, new x0.b(new m7.i(sparseBooleanArray, null), null));
                m1Var = this;
                try {
                    m1Var.f32510d = zVar;
                    zVar.a(bVar2);
                    zVar.f32757j.add(bVar2);
                    i5.b bVar3 = new i5.b(bVar.f32611a, handler, bVar2);
                    m1Var.f32515i = bVar3;
                    bVar3.a(false);
                    d dVar = new d(bVar.f32611a, handler, bVar2);
                    m1Var.f32516j = dVar;
                    dVar.c(null);
                    p1 p1Var = new p1(bVar.f32611a, handler, bVar2);
                    m1Var.f32517k = p1Var;
                    p1Var.c(m7.z.C(m1Var.B.f34099c));
                    v1 v1Var = new v1(bVar.f32611a);
                    m1Var.f32518l = v1Var;
                    v1Var.f32713c = false;
                    v1Var.a();
                    w1 w1Var = new w1(bVar.f32611a);
                    m1Var.f32519m = w1Var;
                    w1Var.f32724c = false;
                    w1Var.a();
                    m1Var.J = k0(p1Var);
                    m1Var.K = n7.p.f36845e;
                    m1Var.o0(1, 10, Integer.valueOf(m1Var.A));
                    m1Var.o0(2, 10, Integer.valueOf(m1Var.A));
                    m1Var.o0(1, 3, m1Var.B);
                    m1Var.o0(2, 4, Integer.valueOf(m1Var.f32530x));
                    m1Var.o0(2, 5, 0);
                    m1Var.o0(1, 9, Boolean.valueOf(m1Var.D));
                    m1Var.o0(2, 7, cVar);
                    m1Var.o0(6, 8, cVar);
                    fVar.f();
                } catch (Throwable th2) {
                    th = th2;
                    m1Var.f32509c.f();
                    throw th;
                }
            } catch (Throwable th3) {
                th = th3;
                m1Var = this;
            }
        } catch (Throwable th4) {
            th = th4;
            m1Var = this;
        }
    }

    public static void i0(m1 m1Var) {
        int T = m1Var.T();
        if (T != 1) {
            if (T == 2 || T == 3) {
                m1Var.u0();
                boolean z10 = m1Var.f32510d.F.f32707p;
                v1 v1Var = m1Var.f32518l;
                v1Var.f32714d = m1Var.p() && !z10;
                v1Var.a();
                w1 w1Var = m1Var.f32519m;
                w1Var.f32725d = m1Var.p();
                w1Var.a();
                return;
            }
            if (T != 4) {
                throw new IllegalStateException();
            }
        }
        v1 v1Var2 = m1Var.f32518l;
        v1Var2.f32714d = false;
        v1Var2.a();
        w1 w1Var2 = m1Var.f32519m;
        w1Var2.f32725d = false;
        w1Var2.a();
    }

    public static o k0(p1 p1Var) {
        Objects.requireNonNull(p1Var);
        return new o(0, m7.z.f36487a >= 28 ? p1Var.f32574d.getStreamMinVolume(p1Var.f32576f) : 0, p1Var.f32574d.getStreamMaxVolume(p1Var.f32576f));
    }

    public static int l0(boolean z10, int i10) {
        return (!z10 || i10 == 1) ? 1 : 2;
    }

    @Override
    public void A(SurfaceView surfaceView) {
        u0();
        if (surfaceView instanceof n7.i) {
            n0();
            r0(surfaceView);
            q0(surfaceView.getHolder());
            return;
        }
        if (surfaceView instanceof o7.j) {
            n0();
            this.f32527u = (o7.j) surfaceView;
            c1 c10 = this.f32510d.c(this.f32512f);
            c10.f(10000);
            c10.e(this.f32527u);
            c10.d();
            this.f32527u.f37355a.add(this.f32511e);
            r0(this.f32527u.getVideoSurface());
            q0(surfaceView.getHolder());
            return;
        }
        SurfaceHolder holder = surfaceView == null ? null : surfaceView.getHolder();
        u0();
        if (holder == null) {
            j0();
            return;
        }
        n0();
        this.f32528v = true;
        this.f32526t = holder;
        holder.addCallback(this.f32511e);
        Surface surface = holder.getSurface();
        if (surface == null || !surface.isValid()) {
            r0(null);
            m0(0, 0);
        } else {
            r0(surface);
            Rect surfaceFrame = holder.getSurfaceFrame();
            m0(surfaceFrame.width(), surfaceFrame.height());
        }
    }

    @Override
    public void B(x0.e eVar) {
        Objects.requireNonNull(eVar);
        this.f32513g.remove(eVar);
        this.f32510d.f32756i.d(eVar);
    }

    @Override
    public int B0() {
        u0();
        return this.f32510d.f32769v;
    }

    @Override
    public void C(int i10, int i11) {
        u0();
        z zVar = this.f32510d;
        v0 q10 = zVar.q(i10, Math.min(i11, zVar.f32760m.size()));
        zVar.v(q10, 0, 1, false, !q10.f32693b.f38087a.equals(zVar.F.f32693b.f38087a), 4, zVar.h(q10), -1);
    }

    @Override
    public u0 E() {
        u0();
        return this.f32510d.F.f32697f;
    }

    @Override
    public void F(boolean z10) {
        u0();
        int e10 = this.f32516j.e(z10, T());
        t0(z10, e10, l0(z10, e10));
    }

    @Override
    public long H() {
        u0();
        return this.f32510d.f32767t;
    }

    @Override
    public long I() {
        u0();
        z zVar = this.f32510d;
        if (!zVar.m()) {
            return zVar.d();
        }
        v0 v0Var = zVar.F;
        return v0Var.f32702k.equals(v0Var.f32693b) ? m7.z.a0(zVar.F.f32708q) : zVar.j();
    }

    @Override
    public List<z6.a> M() {
        u0();
        return this.E;
    }

    @Override
    public int N() {
        u0();
        return this.f32510d.f();
    }

    @Override
    public void O() {
        u0();
        boolean p10 = p();
        int e10 = this.f32516j.e(p10, 2);
        t0(p10, e10, l0(p10, e10));
        z zVar = this.f32510d;
        v0 v0Var = zVar.F;
        if (v0Var.f32696e != 1) {
            return;
        }
        v0 e11 = v0Var.e(null);
        v0 g10 = e11.g(e11.f32692a.s() ? 4 : 2);
        zVar.f32771x++;
        ((w.b) zVar.f32755h.f32156h.c(0)).b();
        zVar.v(g10, 1, 1, false, false, 5, -9223372036854775807L, -1);
    }

    @Override
    public void R(SurfaceView surfaceView) {
        u0();
        SurfaceHolder holder = surfaceView == null ? null : surfaceView.getHolder();
        u0();
        if (holder == null || holder != this.f32526t) {
            return;
        }
        j0();
    }

    @Override
    public int T() {
        u0();
        return this.f32510d.F.f32696e;
    }

    @Override
    public int U() {
        u0();
        return this.f32510d.F.f32704m;
    }

    @Override
    public void W(int i10) {
        u0();
        z zVar = this.f32510d;
        if (zVar.f32769v != i10) {
            zVar.f32769v = i10;
            ((w.b) zVar.f32755h.f32156h.a(11, i10, 0)).b();
            zVar.f32756i.b(8, new t2.h(i10, 1));
            zVar.u();
            zVar.f32756i.a();
        }
    }

    @Override
    public u1 X() {
        u0();
        return this.f32510d.F.f32700i.f33443d;
    }

    @Override
    public Looper Y() {
        return this.f32510d.f32764q;
    }

    @Override
    public boolean Z() {
        u0();
        return this.f32510d.f32770w;
    }

    @Override
    public long a0() {
        u0();
        return this.f32510d.d();
    }

    @Override
    public void d0(TextureView textureView) {
        u0();
        if (textureView == null) {
            j0();
            return;
        }
        n0();
        this.f32529w = textureView;
        if (textureView.getSurfaceTextureListener() != null) {
            Log.w("SimpleExoPlayer", "Replacing existing SurfaceTextureListener.");
        }
        textureView.setSurfaceTextureListener(this.f32511e);
        SurfaceTexture surfaceTexture = textureView.isAvailable() ? textureView.getSurfaceTexture() : null;
        if (surfaceTexture == null) {
            r0(null);
            m0(0, 0);
        } else {
            Surface surface = new Surface(surfaceTexture);
            r0(surface);
            this.f32525s = surface;
            m0(textureView.getWidth(), textureView.getHeight());
        }
    }

    @Override
    public w0 e() {
        u0();
        return this.f32510d.F.f32705n;
    }

    @Override
    public void f(w0 w0Var) {
        u0();
        z zVar = this.f32510d;
        Objects.requireNonNull(zVar);
        if (zVar.F.f32705n.equals(w0Var)) {
            return;
        }
        v0 f10 = zVar.F.f(w0Var);
        zVar.f32771x++;
        ((w.b) zVar.f32755h.f32156h.j(4, w0Var)).b();
        zVar.v(f10, 0, 1, false, false, 5, -9223372036854775807L, -1);
    }

    @Override
    public k0 f0() {
        return this.f32510d.D;
    }

    @Override
    public long g() {
        u0();
        return m7.z.a0(this.f32510d.F.f32709r);
    }

    @Override
    public long g0() {
        u0();
        return this.f32510d.f32766s;
    }

    @Override
    public long getDuration() {
        u0();
        return this.f32510d.j();
    }

    @Override
    public int h() {
        u0();
        z zVar = this.f32510d;
        if (zVar.m()) {
            return zVar.F.f32693b.f38089c;
        }
        return -1;
    }

    @Override
    public long i() {
        u0();
        return this.f32510d.e();
    }

    @Override
    public int j() {
        u0();
        z zVar = this.f32510d;
        if (zVar.m()) {
            return zVar.F.f32693b.f38088b;
        }
        return -1;
    }

    public void j0() {
        u0();
        n0();
        r0(null);
        m0(0, 0);
    }

    @Override
    public t1 k() {
        u0();
        return this.f32510d.F.f32692a;
    }

    @Override
    public long l() {
        u0();
        return this.f32510d.g();
    }

    @Override
    public boolean m() {
        u0();
        return this.f32510d.m();
    }

    public final void m0(int i10, int i11) {
        if (i10 == this.f32531y && i11 == this.f32532z) {
            return;
        }
        this.f32531y = i10;
        this.f32532z = i11;
        this.f32514h.r(i10, i11);
        Iterator<x0.e> it = this.f32513g.iterator();
        while (it.hasNext()) {
            it.next().r(i10, i11);
        }
    }

    @Override
    public void n(int i10, long j10) {
        u0();
        j5.q qVar = this.f32514h;
        if (!qVar.f33237i) {
            r.a k02 = qVar.k0();
            qVar.f33237i = true;
            j5.k kVar = new j5.k(k02, 0);
            qVar.f33233e.put(-1, k02);
            m7.l<j5.r> lVar = qVar.f33234f;
            lVar.b(-1, kVar);
            lVar.a();
        }
        z zVar = this.f32510d;
        t1 t1Var = zVar.F.f32692a;
        if (i10 < 0 || (!t1Var.s() && i10 >= t1Var.r())) {
            throw new j1.p(t1Var, i10, j10);
        }
        zVar.f32771x++;
        if (zVar.m()) {
            Log.w("ExoPlayerImpl", "seekTo ignored because an ad is playing");
            c0.d dVar = new c0.d(zVar.F);
            dVar.a(1);
            z zVar2 = ((y) zVar.f32754g).f32742b;
            zVar2.f32753f.b(new y0.a(zVar2, dVar));
            return;
        }
        int i11 = zVar.F.f32696e != 1 ? 2 : 1;
        int f10 = zVar.f();
        v0 n10 = zVar.n(zVar.F.g(i11), t1Var, zVar.o(t1Var, i10, j10));
        ((w.b) zVar.f32755h.f32156h.j(3, new c0.g(t1Var, i10, m7.z.M(j10)))).b();
        zVar.v(n10, 0, 1, true, true, 1, zVar.h(n10), f10);
    }

    public final void n0() {
        if (this.f32527u != null) {
            c1 c10 = this.f32510d.c(this.f32512f);
            c10.f(10000);
            c10.e(null);
            c10.d();
            o7.j jVar = this.f32527u;
            jVar.f37355a.remove(this.f32511e);
            this.f32527u = null;
        }
        TextureView textureView = this.f32529w;
        if (textureView != null) {
            if (textureView.getSurfaceTextureListener() != this.f32511e) {
                Log.w("SimpleExoPlayer", "SurfaceTextureListener already unset or replaced.");
            } else {
                this.f32529w.setSurfaceTextureListener(null);
            }
            this.f32529w = null;
        }
        SurfaceHolder surfaceHolder = this.f32526t;
        if (surfaceHolder != null) {
            surfaceHolder.removeCallback(this.f32511e);
            this.f32526t = null;
        }
    }

    @Override
    public x0.b o() {
        u0();
        return this.f32510d.C;
    }

    public final void o0(int i10, int i11, Object obj) {
        for (g1 g1Var : this.f32508b) {
            if (g1Var.u() == i10) {
                c1 c10 = this.f32510d.c(g1Var);
                c0.a.f(!c10.f32209i);
                c10.f32205e = i11;
                c0.a.f(!c10.f32209i);
                c10.f32206f = obj;
                c10.d();
            }
        }
    }

    @Override
    public boolean p() {
        u0();
        return this.f32510d.F.f32703l;
    }

    public void p0(p6.s sVar) {
        u0();
        z zVar = this.f32510d;
        Objects.requireNonNull(zVar);
        zVar.s(Collections.singletonList(sVar), -1, -9223372036854775807L, true);
    }

    public final void q0(SurfaceHolder surfaceHolder) {
        this.f32528v = false;
        this.f32526t = surfaceHolder;
        surfaceHolder.addCallback(this.f32511e);
        Surface surface = this.f32526t.getSurface();
        if (surface == null || !surface.isValid()) {
            m0(0, 0);
        } else {
            Rect surfaceFrame = this.f32526t.getSurfaceFrame();
            m0(surfaceFrame.width(), surfaceFrame.height());
        }
    }

    public final void r0(Object obj) {
        boolean z10;
        ArrayList arrayList = new ArrayList();
        g1[] g1VarArr = this.f32508b;
        int length = g1VarArr.length;
        int i10 = 0;
        while (true) {
            z10 = true;
            if (i10 >= length) {
                break;
            }
            g1 g1Var = g1VarArr[i10];
            if (g1Var.u() == 2) {
                c1 c10 = this.f32510d.c(g1Var);
                c10.f(1);
                c0.a.f(true ^ c10.f32209i);
                c10.f32206f = obj;
                c10.d();
                arrayList.add(c10);
            }
            i10++;
        }
        Object obj2 = this.f32524r;
        if (obj2 == null || obj2 == obj) {
            z10 = false;
        } else {
            try {
                Iterator it = arrayList.iterator();
                while (it.hasNext()) {
                    ((c1) it.next()).a(this.f32520n);
                }
            } catch (InterruptedException unused) {
                Thread.currentThread().interrupt();
            } catch (TimeoutException unused2) {
            }
            z10 = false;
            Object obj3 = this.f32524r;
            Surface surface = this.f32525s;
            if (obj3 == surface) {
                surface.release();
                this.f32525s = null;
            }
        }
        this.f32524r = obj;
        if (z10) {
            this.f32510d.t(false, p.d(new e0(3), 1003));
        }
    }

    @Override
    public void s(boolean z10) {
        u0();
        z zVar = this.f32510d;
        if (zVar.f32770w != z10) {
            zVar.f32770w = z10;
            ((w.b) zVar.f32755h.f32156h.a(12, z10 ? 1 : 0, 0)).b();
            zVar.f32756i.b(9, new x(z10, 0));
            zVar.u();
            zVar.f32756i.a();
        }
    }

    public void s0(float f10) {
        u0();
        float h10 = m7.z.h(f10, 0.0f, 1.0f);
        if (this.C == h10) {
            return;
        }
        this.C = h10;
        o0(1, 2, Float.valueOf(this.f32516j.f32218g * h10));
        this.f32514h.g(h10);
        Iterator<x0.e> it = this.f32513g.iterator();
        while (it.hasNext()) {
            it.next().g(h10);
        }
    }

    @Override
    public void stop() {
        t(false);
    }

    @Override
    @Deprecated
    public void t(boolean z10) {
        u0();
        this.f32516j.e(p(), 1);
        this.f32510d.t(z10, null);
        this.E = Collections.emptyList();
    }

    public final void t0(boolean z10, int i10, int i11) {
        int i12 = 0;
        ?? r13 = (!z10 || i10 == -1) ? 0 : 1;
        if (r13 != 0 && i10 != 1) {
            i12 = 1;
        }
        z zVar = this.f32510d;
        v0 v0Var = zVar.F;
        if (v0Var.f32703l == r13 && v0Var.f32704m == i12) {
            return;
        }
        zVar.f32771x++;
        v0 d10 = v0Var.d(r13, i12);
        ((w.b) zVar.f32755h.f32156h.a(1, r13, i12)).b();
        zVar.v(d10, 0, i11, false, false, 5, -9223372036854775807L, -1);
    }

    @Override
    public long u() {
        u0();
        Objects.requireNonNull(this.f32510d);
        return 3000L;
    }

    public final void u0() {
        r6.f fVar = this.f32509c;
        synchronized (fVar) {
            boolean z10 = false;
            while (!fVar.f39736b) {
                try {
                    fVar.wait();
                } catch (InterruptedException unused) {
                    z10 = true;
                }
            }
            if (z10) {
                Thread.currentThread().interrupt();
            }
        }
        if (Thread.currentThread() != this.f32510d.f32764q.getThread()) {
            String n10 = m7.z.n("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(), this.f32510d.f32764q.getThread().getName());
            if (this.G) {
                throw new IllegalStateException(n10);
            }
            m7.m.d("SimpleExoPlayer", n10, this.H ? null : new IllegalStateException());
            this.H = true;
        }
    }

    @Override
    public int v() {
        u0();
        z zVar = this.f32510d;
        if (zVar.F.f32692a.s()) {
            return 0;
        }
        v0 v0Var = zVar.F;
        return v0Var.f32692a.d(v0Var.f32693b.f38087a);
    }

    @Override
    public void w(TextureView textureView) {
        u0();
        if (textureView == null || textureView != this.f32529w) {
            return;
        }
        j0();
    }

    @Override
    public n7.p x() {
        return this.K;
    }

    @Override
    public void y(x0.e eVar) {
        Objects.requireNonNull(eVar);
        this.f32513g.add(eVar);
        this.f32510d.a(eVar);
    }
}