导航菜单

页面标题

页面副标题

BetterTogether v3.0.0 - c0.java 源代码

正在查看: BetterTogether v3.0.0 应用的 c0.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package y9;

import android.content.Context;
import android.media.AudioManager;
import android.media.AudioTrack;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.util.Pair;
import android.view.Surface;
import android.view.TextureView;
import androidx.appcompat.widget.q3;
import com.appsamurai.storyly.exoplayer2.common.metadata.Metadata;
import com.google.common.collect.f0;
import com.google.common.collect.x0;
import com.onesignal.v;
import ek.g;
import f3.p;
import ga.p0;
import ga.r;
import ja.x;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Random;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.CopyOnWriteArraySet;
import java.util.concurrent.TimeoutException;
import kf.pB.YHRsBUu;
import l5.b;
import m5.f;
import o9.e;
import o9.e0;
import o9.g0;
import o9.h0;
import o9.i0;
import o9.l0;
import o9.n0;
import o9.o0;
import o9.r0;
import o9.w;
import o9.y;
import p9.c;
import v5.d0;
import w1.v2;
import w9.l;
import w9.q;
import w9.s;
import w9.u;
import z9.b0;

public final class c0 extends o9.a {
    public static final int d0 = 0;
    public final q3 A;
    public final long B;
    public int C;
    public int D;
    public boolean E;
    public int F;
    public final z0 G;
    public p0 H;
    public e0 I;
    public y J;
    public AudioTrack K;
    public Object L;
    public Surface M;
    public TextureView N;
    public final int O;
    public int P;
    public int Q;
    public final int R;
    public c S;
    public float T;
    public boolean U;
    public final boolean V;
    public boolean W;
    public boolean X;
    public e Y;
    public y Z;

    public t0 f1038a0;
    public final x b;
    public int b0;
    public final e0 c;
    public long c0;

    public final v f1039d = new v(4);

    public final Context f1040e;
    public final h0 f;
    public final d[] g;

    public final ja.v f1041h;
    public final s i;
    public final q j;

    public final i0 f1042k;
    public final b l;
    public final CopyOnWriteArraySet m;
    public final n0 n;
    public final ArrayList o;
    public final boolean p;
    public final z9.a q;
    public final Looper r;

    public final ka.c f1043s;
    public final q t;

    public final z f1044u;

    public final a0 f1045v;
    public final d0 w;
    public final f x;
    public final b1 y;
    public final q3 z;

    static {
        o9.f.a("goog.exo.exoplayer");
    }

    public c0(o oVar) {
        boolean z;
        try {
            l.e("ExoPlayerImpl", "Init " + Integer.toHexString(System.identityHashCode(this)) + " [ExoPlayerLib/2.18.1] [" + u.f980e + YHRsBUu.bDjYkEHwdCBNQ);
            Context context = oVar.a;
            Looper looper = oVar.i;
            this.f1040e = context.getApplicationContext();
            g gVar = oVar.h;
            q qVar = oVar.b;
            this.q = (z9.a) gVar.apply(qVar);
            this.S = oVar.j;
            this.O = oVar.k;
            this.U = false;
            this.B = oVar.p;
            z zVar = new z(this);
            this.f1044u = zVar;
            this.f1045v = new a0();
            Handler handler = new Handler(looper);
            d[] a = ((j) oVar.c.get()).a(handler, zVar, zVar, zVar, zVar);
            this.g = a;
            p.x(a.length > 0);
            this.f1041h = (ja.v) oVar.e.get();
            this.f1043s = (ka.c) oVar.g.get();
            this.p = oVar.l;
            this.G = oVar.m;
            this.r = looper;
            this.t = qVar;
            this.f = this;
            this.l = new b(looper, qVar, new q(this));
            this.m = new CopyOnWriteArraySet();
            this.o = new ArrayList();
            this.H = new p0();
            this.b = new x(new y0[a.length], new ja.s[a.length], r0.e, (ja.u) null);
            this.n = new n0();
            o9.d0 d0Var = new o9.d0();
            int[] iArr = {1, 2, 3, 13, 14, 15, 16, 17, 18, 19, 31, 20, 30, 21, 22, 23, 24, 25, 26, 27, 28};
            v vVar = d0Var.a;
            vVar.getClass();
            for (int i = 0; i < 21; i++) {
                vVar.a(iArr[i]);
            }
            this.f1041h.getClass();
            d0Var.a(29, true);
            e0 b = d0Var.b();
            this.c = b;
            o9.d0 d0Var2 = new o9.d0();
            w9.f fVar = b.d;
            v vVar2 = d0Var2.a;
            vVar2.getClass();
            for (int i2 = 0; i2 < fVar.b(); i2++) {
                vVar2.a(fVar.a(i2));
            }
            d0Var2.a.a(4);
            d0Var2.a.a(10);
            this.I = d0Var2.b();
            this.i = this.t.a(this.r, (Handler.Callback) null);
            q qVar2 = new q(this);
            this.j = qVar2;
            this.f1038a0 = t0.g(this.b);
            this.q.W(this.f, this.r);
            int i3 = u.a;
            this.f1042k = new i0(this.g, this.f1041h, this.b, (g) oVar.f.get(), this.f1043s, 0, this.q, this.G, oVar.n, oVar.o, false, this.r, this.t, qVar2, i3 < 31 ? new b0() : v.a(this.f1040e, this, oVar.q));
            this.T = 1.0f;
            y yVar = y.l0;
            this.J = yVar;
            this.Z = yVar;
            int i4 = -1;
            this.b0 = -1;
            if (i3 < 21) {
                AudioTrack audioTrack = this.K;
                if (audioTrack != null && audioTrack.getAudioSessionId() != 0) {
                    this.K.release();
                    this.K = null;
                }
                if (this.K == null) {
                    this.K = new AudioTrack(3, 4000, 4, 2, 2, 0, 0);
                }
                this.R = this.K.getAudioSessionId();
            } else {
                AudioManager audioManager = (AudioManager) this.f1040e.getSystemService("audio");
                if (audioManager != null) {
                    i4 = audioManager.generateAudioSessionId();
                }
                this.R = i4;
            }
            int i5 = s9.c.d;
            this.V = true;
            z9.a aVar = this.q;
            aVar.getClass();
            this.l.a(aVar);
            ka.c cVar = this.f1043s;
            Handler handler2 = new Handler(this.r);
            z9.a aVar2 = this.q;
            ka.g gVar2 = (ka.g) cVar;
            gVar2.getClass();
            aVar2.getClass();
            h.y yVar2 = gVar2.b;
            yVar2.getClass();
            yVar2.F(aVar2);
            ((CopyOnWriteArrayList) yVar2.f413d).add(new ka.b(handler2, aVar2));
            this.m.add(this.f1044u);
            d0 d0Var3 = new d0(context, handler, this.f1044u);
            this.w = d0Var3;
            d0Var3.k0(false);
            f fVar2 = new f(context, handler, this.f1044u);
            this.x = fVar2;
            fVar2.h((c) null);
            b1 b1Var = new b1(context, handler, this.f1044u);
            this.y = b1Var;
            b1Var.b(u.v(this.S.i));
            q3 q3Var = new q3(context, 2);
            this.z = q3Var;
            q3Var.f();
            q3 q3Var2 = new q3(context, 3);
            this.A = q3Var2;
            q3Var2.f();
            this.Y = c(b1Var);
            ja.v vVar3 = this.f1041h;
            c cVar2 = this.S;
            ja.p pVar = (ja.p) vVar3;
            synchronized (pVar.c) {
                z = !pVar.f507h.equals(cVar2);
                pVar.f507h = cVar2;
            }
            if (z) {
                pVar.f();
            }
            w(1, 10, Integer.valueOf(this.R));
            w(2, 10, Integer.valueOf(this.R));
            w(1, 3, this.S);
            w(2, 4, Integer.valueOf(this.O));
            w(2, 5, 0);
            w(1, 9, Boolean.valueOf(this.U));
            w(2, 7, this.f1045v);
            w(6, 8, this.f1045v);
        } finally {
            this.f1039d.d();
        }
    }

    public static e c(b1 b1Var) {
        b1Var.getClass();
        return new e(0, u.a >= 28 ? k3.c.b(b1Var.d, b1Var.f) : 0, b1Var.d.getStreamMaxVolume(b1Var.f));
    }

    public static long o(t0 t0Var) {
        o0 o0Var = new o0();
        n0 n0Var = new n0();
        t0Var.a.h(((q9.a) t0Var.b).a, n0Var);
        long j = t0Var.c;
        return j == -9223372036854775807L ? t0Var.a.n(n0Var.i, o0Var).R : n0Var.w + j;
    }

    public static boolean p(t0 t0Var) {
        return t0Var.e == 3 && t0Var.l && t0Var.m == 0;
    }

    public final void A(t0 t0Var, int i, int i2, boolean z, boolean z2, int i3, long j, int i4) {
        Pair pair;
        int i5;
        w wVar;
        int l;
        int i6;
        boolean z4;
        int e3;
        int i7;
        boolean z5;
        int i9;
        boolean z6;
        int i10;
        Object obj;
        w wVar2;
        Object obj2;
        int i11;
        long j3;
        long j4;
        long j5;
        long o;
        Object obj3;
        w wVar3;
        Object obj4;
        int i12;
        t0 t0Var2 = this.f1038a0;
        this.f1038a0 = t0Var;
        boolean z7 = !t0Var2.a.equals(t0Var.a);
        o9.p0 p0Var = t0Var2.a;
        o9.p0 p0Var2 = t0Var.a;
        if (p0Var2.q() && p0Var.q()) {
            pair = new Pair(Boolean.FALSE, -1);
        } else if (p0Var2.q() != p0Var.q()) {
            pair = new Pair(Boolean.TRUE, 3);
        } else {
            r rVar = t0Var2.b;
            Object obj5 = ((q9.a) rVar).a;
            n0 n0Var = this.n;
            int i13 = p0Var.h(obj5, n0Var).i;
            o0 o0Var = ((o9.a) this).a;
            Object obj6 = p0Var.n(i13, o0Var).d;
            r rVar2 = t0Var.b;
            if (obj6.equals(p0Var2.n(p0Var2.h(((q9.a) rVar2).a, n0Var).i, o0Var).d)) {
                pair = (z2 && i3 == 0 && ((q9.a) rVar).d < ((q9.a) rVar2).d) ? new Pair(Boolean.TRUE, 0) : new Pair(Boolean.FALSE, -1);
            } else {
                if (z2 && i3 == 0) {
                    i5 = 1;
                } else if (z2 && i3 == 1) {
                    i5 = 2;
                } else {
                    if (!z7) {
                        throw new IllegalStateException();
                    }
                    i5 = 3;
                }
                pair = new Pair(Boolean.TRUE, Integer.valueOf(i5));
            }
        }
        boolean booleanValue = ((Boolean) pair.first).booleanValue();
        int intValue = ((Integer) pair.second).intValue();
        y yVar = this.J;
        if (booleanValue) {
            wVar = !t0Var.a.q() ? t0Var.a.n(t0Var.a.h(((q9.a) t0Var.b).a, this.n).i, ((o9.a) this).a).i : null;
            this.Z = y.l0;
        } else {
            wVar = null;
        }
        if (booleanValue || !t0Var2.j.equals(t0Var.j)) {
            y yVar2 = this.Z;
            yVar2.getClass();
            o9.x xVar = new o9.x(yVar2);
            List list = t0Var.j;
            for (int i14 = 0; i14 < list.size(); i14++) {
                Metadata metadata = (Metadata) list.get(i14);
                int i15 = 0;
                while (true) {
                    Metadata.Entry[] entryArr = metadata.d;
                    if (i15 < entryArr.length) {
                        entryArr[i15].l0(xVar);
                        i15++;
                    }
                }
            }
            this.Z = new y(xVar);
            yVar = b();
        }
        boolean z10 = !yVar.equals(this.J);
        this.J = yVar;
        boolean z11 = t0Var2.l != t0Var.l;
        boolean z12 = t0Var2.e != t0Var.e;
        if (z12 || z11) {
            B();
        }
        boolean z13 = t0Var2.g != t0Var.g;
        if (!t0Var2.a.equals(t0Var.a)) {
            this.l.c(0, new s(i, 0, t0Var));
        }
        if (z2) {
            n0 n0Var2 = new n0();
            if (t0Var2.a.q()) {
                i10 = i4;
                obj = null;
                wVar2 = null;
                obj2 = null;
                i11 = -1;
            } else {
                Object obj7 = ((q9.a) t0Var2.b).a;
                t0Var2.a.h(obj7, n0Var2);
                int i16 = n0Var2.i;
                i11 = t0Var2.a.b(obj7);
                obj = t0Var2.a.n(i16, ((o9.a) this).a).d;
                wVar2 = ((o9.a) this).a.i;
                i10 = i16;
                obj2 = obj7;
            }
            if (i3 == 0) {
                if (t0Var2.b.a()) {
                    r rVar3 = t0Var2.b;
                    j5 = n0Var2.a(((q9.a) rVar3).b, ((q9.a) rVar3).c);
                    o = o(t0Var2);
                } else if (((q9.a) t0Var2.b).e != -1) {
                    j5 = o(this.f1038a0);
                    o = j5;
                } else {
                    j3 = n0Var2.w;
                    j4 = n0Var2.v;
                    j5 = j3 + j4;
                    o = j5;
                }
            } else if (t0Var2.b.a()) {
                j5 = t0Var2.r;
                o = o(t0Var2);
            } else {
                j3 = n0Var2.w;
                j4 = t0Var2.r;
                j5 = j3 + j4;
                o = j5;
            }
            long J = u.J(j5);
            long J2 = u.J(o);
            r rVar4 = t0Var2.b;
            g0 g0Var = new g0(obj, i10, wVar2, obj2, i11, J, J2, ((q9.a) rVar4).b, ((q9.a) rVar4).c);
            int g = g();
            if (this.f1038a0.a.q()) {
                obj3 = null;
                wVar3 = null;
                obj4 = null;
                i12 = -1;
            } else {
                t0 t0Var3 = this.f1038a0;
                Object obj8 = ((q9.a) t0Var3.b).a;
                t0Var3.a.h(obj8, this.n);
                int b = this.f1038a0.a.b(obj8);
                o9.p0 p0Var3 = this.f1038a0.a;
                o0 o0Var2 = ((o9.a) this).a;
                Object obj9 = p0Var3.n(g, o0Var2).d;
                i12 = b;
                wVar3 = o0Var2.i;
                obj4 = obj8;
                obj3 = obj9;
            }
            long J3 = u.J(j);
            long J4 = this.f1038a0.b.a() ? u.J(o(this.f1038a0)) : J3;
            r rVar5 = this.f1038a0.b;
            this.l.c(11, new u(i3, g0Var, new g0(obj3, g, wVar3, obj4, i12, J3, J4, ((q9.a) rVar5).b, ((q9.a) rVar5).c)));
        }
        if (booleanValue) {
            this.l.c(1, new s(intValue, 2, wVar));
        }
        if (t0Var2.f != t0Var.f) {
            this.l.c(10, new t(t0Var, 3));
            if (t0Var.f != null) {
                this.l.c(10, new t(t0Var, 4));
            }
        }
        x xVar2 = t0Var2.i;
        x xVar3 = t0Var.i;
        if (xVar2 != xVar3) {
            ja.v vVar = this.f1041h;
            Object obj10 = xVar3.e;
            vVar.getClass();
            this.l.c(2, new t(t0Var, 5));
        }
        int i17 = 8;
        if (z10) {
            this.l.c(14, new v2(this.J, i17));
        }
        if (z13) {
            this.l.c(3, new t(t0Var, 6));
        }
        if (z12 || z11) {
            this.l.c(-1, new t(t0Var, 7));
        }
        if (z12) {
            this.l.c(4, new t(t0Var, 8));
        }
        if (z11) {
            this.l.c(5, new s(i2, 1, t0Var));
        }
        if (t0Var2.m != t0Var.m) {
            this.l.c(6, new t(t0Var, 0));
        }
        if (p(t0Var2) != p(t0Var)) {
            this.l.c(7, new t(t0Var, 1));
        }
        if (!t0Var2.n.equals(t0Var.n)) {
            this.l.c(12, new t(t0Var, 2));
        }
        if (z) {
            this.l.c(-1, new l0(17));
        }
        e0 e0Var = this.I;
        int i18 = u.a;
        c0 c0Var = this.f;
        boolean q = c0Var.q();
        o9.p0 k2 = c0Var.k();
        boolean q2 = k2.q();
        o0 o0Var3 = ((o9.a) c0Var).a;
        boolean z14 = !q2 && k2.n(c0Var.g(), o0Var3).M;
        o9.p0 k4 = c0Var.k();
        if (k4.q()) {
            i6 = -1;
            l = -1;
        } else {
            int g4 = c0Var.g();
            c0Var.C();
            c0Var.C();
            l = k4.l(g4, 0, false);
            i6 = -1;
        }
        boolean z15 = l != i6;
        o9.p0 k7 = c0Var.k();
        if (k7.q()) {
            z4 = false;
            e3 = -1;
        } else {
            int g5 = c0Var.g();
            c0Var.C();
            c0Var.C();
            z4 = false;
            e3 = k7.e(g5, 0, false);
        }
        boolean z16 = e3 != -1 ? true : z4;
        o9.p0 k10 = c0Var.k();
        boolean z17 = !k10.q() && k10.n(c0Var.g(), o0Var3).a();
        o9.p0 k11 = c0Var.k();
        boolean z18 = !k11.q() && k11.n(c0Var.g(), o0Var3).N;
        boolean q3 = c0Var.k().q();
        o9.d0 d0Var = new o9.d0();
        w9.f fVar = this.c.d;
        v vVar2 = d0Var.a;
        vVar2.getClass();
        for (int i19 = 0; i19 < fVar.b(); i19++) {
            vVar2.a(fVar.a(i19));
        }
        boolean z19 = !q;
        d0Var.a(4, z19);
        d0Var.a(5, z14 && !q);
        d0Var.a(6, z15 && !q);
        d0Var.a(7, !q3 && (z15 || !z17 || z14) && !q);
        d0Var.a(8, z16 && !q);
        d0Var.a(9, !q3 && (z16 || (z17 && z18)) && !q);
        d0Var.a(10, z19);
        if (!z14 || q) {
            i7 = 11;
            z5 = false;
        } else {
            i7 = 11;
            z5 = true;
        }
        d0Var.a(i7, z5);
        if (!z14 || q) {
            i9 = 12;
            z6 = false;
        } else {
            i9 = 12;
            z6 = true;
        }
        d0Var.a(i9, z6);
        e0 b4 = d0Var.b();
        this.I = b4;
        if (!b4.equals(e0Var)) {
            this.l.c(13, new q(this));
        }
        this.l.b();
        if (t0Var2.o != t0Var.o) {
            Iterator it = this.m.iterator();
            while (it.hasNext()) {
                ((z) it.next()).d.B();
            }
        }
    }

    public final void B() {
        int n = n();
        q3 q3Var = this.A;
        q3 q3Var2 = this.z;
        if (n != 1) {
            if (n == 2 || n == 3) {
                C();
                q3Var2.g(m() && !this.f1038a0.o);
                q3Var.g(m());
                return;
            } else if (n != 4) {
                throw new IllegalStateException();
            }
        }
        q3Var2.g(false);
        q3Var.g(false);
    }

    public final void C() {
        v vVar = this.f1039d;
        synchronized (vVar) {
            boolean z = false;
            while (!vVar.d) {
                try {
                    vVar.wait();
                } catch (InterruptedException unused) {
                    z = true;
                }
            }
            if (z) {
                Thread.currentThread().interrupt();
            }
        }
        if (Thread.currentThread() != this.r.getThread()) {
            String l = u.l("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.r.getThread().getName());
            if (this.V) {
                throw new IllegalStateException(l);
            }
            l.g("ExoPlayerImpl", l, this.W ? null : new IllegalStateException());
            this.W = true;
        }
    }

    public final y b() {
        o9.p0 k2 = k();
        if (k2.q()) {
            return this.Z;
        }
        w wVar = k2.n(g(), ((o9.a) this).a).i;
        y yVar = this.Z;
        yVar.getClass();
        o9.x xVar = new o9.x(yVar);
        y yVar2 = wVar.v;
        if (yVar2 != null) {
            CharSequence charSequence = yVar2.d;
            if (charSequence != null) {
                xVar.a = charSequence;
            }
            CharSequence charSequence2 = yVar2.e;
            if (charSequence2 != null) {
                xVar.b = charSequence2;
            }
            CharSequence charSequence3 = yVar2.i;
            if (charSequence3 != null) {
                xVar.c = charSequence3;
            }
            CharSequence charSequence4 = yVar2.v;
            if (charSequence4 != null) {
                xVar.d = charSequence4;
            }
            CharSequence charSequence5 = yVar2.w;
            if (charSequence5 != null) {
                xVar.e = charSequence5;
            }
            CharSequence charSequence6 = yVar2.x;
            if (charSequence6 != null) {
                xVar.f = charSequence6;
            }
            CharSequence charSequence7 = yVar2.y;
            if (charSequence7 != null) {
                xVar.g = charSequence7;
            }
            i0 i0Var = yVar2.M;
            if (i0Var != null) {
                xVar.h = i0Var;
            }
            i0 i0Var2 = yVar2.N;
            if (i0Var2 != null) {
                xVar.i = i0Var2;
            }
            byte[] bArr = yVar2.O;
            if (bArr != null) {
                xVar.j = (byte[]) bArr.clone();
                xVar.k = yVar2.P;
            }
            Uri uri = yVar2.Q;
            if (uri != null) {
                xVar.l = uri;
            }
            Integer num = yVar2.R;
            if (num != null) {
                xVar.m = num;
            }
            Integer num2 = yVar2.S;
            if (num2 != null) {
                xVar.n = num2;
            }
            Integer num3 = yVar2.T;
            if (num3 != null) {
                xVar.o = num3;
            }
            Boolean bool = yVar2.U;
            if (bool != null) {
                xVar.p = bool;
            }
            Integer num4 = yVar2.V;
            if (num4 != null) {
                xVar.q = num4;
            }
            Integer num5 = yVar2.W;
            if (num5 != null) {
                xVar.q = num5;
            }
            Integer num6 = yVar2.X;
            if (num6 != null) {
                xVar.r = num6;
            }
            Integer num7 = yVar2.Y;
            if (num7 != null) {
                xVar.s = num7;
            }
            Integer num8 = yVar2.Z;
            if (num8 != null) {
                xVar.t = num8;
            }
            Integer num9 = yVar2.a0;
            if (num9 != null) {
                xVar.u = num9;
            }
            Integer num10 = yVar2.b0;
            if (num10 != null) {
                xVar.v = num10;
            }
            CharSequence charSequence8 = yVar2.c0;
            if (charSequence8 != null) {
                xVar.w = charSequence8;
            }
            CharSequence charSequence9 = yVar2.d0;
            if (charSequence9 != null) {
                xVar.x = charSequence9;
            }
            CharSequence charSequence10 = yVar2.e0;
            if (charSequence10 != null) {
                xVar.y = charSequence10;
            }
            Integer num11 = yVar2.f0;
            if (num11 != null) {
                xVar.z = num11;
            }
            Integer num12 = yVar2.g0;
            if (num12 != null) {
                xVar.A = num12;
            }
            CharSequence charSequence11 = yVar2.h0;
            if (charSequence11 != null) {
                xVar.B = charSequence11;
            }
            CharSequence charSequence12 = yVar2.i0;
            if (charSequence12 != null) {
                xVar.C = charSequence12;
            }
            CharSequence charSequence13 = yVar2.j0;
            if (charSequence13 != null) {
                xVar.D = charSequence13;
            }
            Bundle bundle = yVar2.k0;
            if (bundle != null) {
                xVar.E = bundle;
            }
        }
        return new y(xVar);
    }

    public final long d() {
        C();
        if (!q()) {
            return i();
        }
        t0 t0Var = this.f1038a0;
        o9.p0 p0Var = t0Var.a;
        Object obj = ((q9.a) t0Var.b).a;
        n0 n0Var = this.n;
        p0Var.h(obj, n0Var);
        t0 t0Var2 = this.f1038a0;
        if (t0Var2.c != -9223372036854775807L) {
            return u.J(n0Var.w) + u.J(this.f1038a0.c);
        }
        return u.J(t0Var2.a.n(g(), ((o9.a) this).a).R);
    }

    public final int e() {
        C();
        if (q()) {
            return ((q9.a) this.f1038a0.b).b;
        }
        return -1;
    }

    public final int f() {
        C();
        if (q()) {
            return ((q9.a) this.f1038a0.b).c;
        }
        return -1;
    }

    public final int g() {
        C();
        int l = l();
        if (l == -1) {
            return 0;
        }
        return l;
    }

    public final int h() {
        C();
        if (this.f1038a0.a.q()) {
            return 0;
        }
        t0 t0Var = this.f1038a0;
        return t0Var.a.b(((q9.a) t0Var.b).a);
    }

    public final long i() {
        C();
        return u.J(j(this.f1038a0));
    }

    public final long j(t0 t0Var) {
        if (t0Var.a.q()) {
            return u.C(this.c0);
        }
        if (t0Var.b.a()) {
            return t0Var.r;
        }
        o9.p0 p0Var = t0Var.a;
        r rVar = t0Var.b;
        long j = t0Var.r;
        Object obj = ((q9.a) rVar).a;
        n0 n0Var = this.n;
        p0Var.h(obj, n0Var);
        return j + n0Var.w;
    }

    public final o9.p0 k() {
        C();
        return this.f1038a0.a;
    }

    public final int l() {
        if (this.f1038a0.a.q()) {
            return this.b0;
        }
        t0 t0Var = this.f1038a0;
        return t0Var.a.h(((q9.a) t0Var.b).a, this.n).i;
    }

    public final boolean m() {
        C();
        return this.f1038a0.l;
    }

    public final int n() {
        C();
        return this.f1038a0.e;
    }

    public final boolean q() {
        C();
        return this.f1038a0.b.a();
    }

    public final t0 r(t0 t0Var, o9.p0 p0Var, Pair pair) {
        r rVar;
        x xVar;
        x0 x0Var;
        p.s(p0Var.q() || pair != null);
        o9.p0 p0Var2 = t0Var.a;
        t0 f = t0Var.f(p0Var);
        if (p0Var.q()) {
            r rVar2 = t0.s;
            long C = u.C(this.c0);
            t0 a = f.b(rVar2, C, C, C, 0L, ga.r0.v, this.b, x0.w).a(rVar2);
            a.p = a.r;
            return a;
        }
        Object obj = ((q9.a) f.b).a;
        int i = u.a;
        boolean z = !obj.equals(pair.first);
        r rVar3 = z ? new r(pair.first) : f.b;
        long longValue = ((Long) pair.second).longValue();
        long C2 = u.C(d());
        if (!p0Var2.q()) {
            C2 -= p0Var2.h(obj, this.n).w;
        }
        if (z || longValue < C2) {
            p.x(!rVar3.a());
            ga.r0 r0Var = z ? ga.r0.v : f.h;
            if (z) {
                rVar = rVar3;
                xVar = this.b;
            } else {
                rVar = rVar3;
                xVar = f.i;
            }
            x xVar2 = xVar;
            if (z) {
                com.google.common.collect.c0 c0Var = f0.e;
                x0Var = x0.w;
            } else {
                x0Var = f.j;
            }
            t0 a3 = f.b(rVar, longValue, longValue, longValue, 0L, r0Var, xVar2, x0Var).a(rVar);
            a3.p = longValue;
            return a3;
        }
        if (longValue == C2) {
            int b = p0Var.b(((q9.a) f.k).a);
            if (b == -1 || p0Var.g(b, this.n, false).i != p0Var.h(((q9.a) rVar3).a, this.n).i) {
                p0Var.h(((q9.a) rVar3).a, this.n);
                long a4 = rVar3.a() ? this.n.a(((q9.a) rVar3).b, ((q9.a) rVar3).c) : this.n.v;
                f = f.b(rVar3, f.r, f.r, f.d, a4 - f.r, f.h, f.i, f.j).a(rVar3);
                f.p = a4;
            }
        } else {
            p.x(!rVar3.a());
            long max = Math.max(0L, f.q - (longValue - C2));
            long j = f.p;
            if (f.k.equals(f.b)) {
                j = longValue + max;
            }
            f = f.b(rVar3, longValue, longValue, longValue, max, f.h, f.i, f.j);
            f.p = j;
        }
        return f;
    }

    public final Pair s(o9.p0 p0Var, int i, long j) {
        if (p0Var.q()) {
            this.b0 = i;
            if (j == -9223372036854775807L) {
                j = 0;
            }
            this.c0 = j;
            return null;
        }
        if (i == -1 || i >= p0Var.p()) {
            i = p0Var.a(false);
            j = u.J(p0Var.n(i, ((o9.a) this).a).R);
        }
        return p0Var.j(((o9.a) this).a, this.n, i, u.C(j));
    }

    public final void t(int i, int i2) {
        if (i == this.P && i2 == this.Q) {
            return;
        }
        this.P = i;
        this.Q = i2;
        this.l.e(24, new r(i, i2));
    }

    public final void u(int i) {
        for (int i2 = i - 1; i2 >= 0; i2--) {
            this.o.remove(i2);
        }
        p0 p0Var = this.H;
        int i3 = i + 0;
        int[] iArr = p0Var.b;
        int[] iArr2 = new int[iArr.length - i3];
        int i4 = 0;
        for (int i5 = 0; i5 < iArr.length; i5++) {
            int i6 = iArr[i5];
            if (i6 < 0 || i6 >= i) {
                int i7 = i5 - i4;
                if (i6 >= 0) {
                    i6 -= i3;
                }
                iArr2[i7] = i6;
            } else {
                i4++;
            }
        }
        this.H = new p0(iArr2, new Random(p0Var.a.nextLong()));
    }

    public final void v() {
        TextureView textureView = this.N;
        if (textureView != null) {
            if (textureView.getSurfaceTextureListener() != this.f1044u) {
                l.f("ExoPlayerImpl", "SurfaceTextureListener already unset or replaced.");
            } else {
                this.N.setSurfaceTextureListener(null);
            }
            this.N = null;
        }
    }

    public final void w(int i, int i2, Object obj) {
        for (d dVar : this.g) {
            if (dVar.d == i) {
                int l = l();
                o9.p0 p0Var = this.f1038a0.a;
                int i3 = l == -1 ? 0 : l;
                q qVar = this.t;
                i0 i0Var = this.f1042k;
                w0 w0Var = new w0(i0Var, dVar, p0Var, i3, qVar, i0Var.O);
                p.x(!w0Var.g);
                w0Var.d = i2;
                p.x(!w0Var.g);
                w0Var.e = obj;
                w0Var.c();
            }
        }
    }

    public final void x(Surface surface) {
        boolean z;
        ArrayList arrayList = new ArrayList();
        for (d dVar : this.g) {
            if (dVar.d == 2) {
                int l = l();
                o9.p0 p0Var = this.f1038a0.a;
                int i = l == -1 ? 0 : l;
                q qVar = this.t;
                i0 i0Var = this.f1042k;
                w0 w0Var = new w0(i0Var, dVar, p0Var, i, qVar, i0Var.O);
                p.x(!w0Var.g);
                w0Var.d = 1;
                p.x(!w0Var.g);
                w0Var.e = surface;
                w0Var.c();
                arrayList.add(w0Var);
            }
        }
        Object obj = this.L;
        if (obj == null || obj == surface) {
            z = false;
        } else {
            try {
                Iterator it = arrayList.iterator();
                while (it.hasNext()) {
                    ((w0) it.next()).a(this.B);
                }
            } catch (InterruptedException unused) {
                Thread.currentThread().interrupt();
            } catch (TimeoutException unused2) {
                z = true;
            }
            z = false;
            Object obj2 = this.L;
            Surface surface2 = this.M;
            if (obj2 == surface2) {
                surface2.release();
                this.M = null;
            }
        }
        this.L = surface;
        if (z) {
            y(new k(2, new j0(3), 1003));
        }
    }

    public final void y(k kVar) {
        t0 t0Var = this.f1038a0;
        t0 a = t0Var.a(t0Var.b);
        a.p = a.r;
        a.q = 0L;
        t0 e3 = a.e(1);
        if (kVar != null) {
            e3 = e3.d(kVar);
        }
        t0 t0Var2 = e3;
        this.C++;
        s sVar = this.f1042k.M;
        sVar.getClass();
        w9.r b = s.b();
        b.a = sVar.a.obtainMessage(6);
        b.a();
        A(t0Var2, 0, 1, false, t0Var2.a.q() && !this.f1038a0.a.q(), 4, j(t0Var2), -1);
    }

    public final void z(int i, int i2, boolean z) {
        int i3 = 0;
        ?? r3 = (!z || i == -1) ? 0 : 1;
        if (r3 != 0 && i != 1) {
            i3 = 1;
        }
        t0 t0Var = this.f1038a0;
        if (t0Var.l == r3 && t0Var.m == i3) {
            return;
        }
        this.C++;
        t0 c = t0Var.c(i3, (boolean) r3);
        s sVar = this.f1042k.M;
        sVar.getClass();
        w9.r b = s.b();
        b.a = sVar.a.obtainMessage(1, r3, i3);
        b.a();
        A(c, 0, i2, false, false, 5, -9223372036854775807L, -1);
    }
}