package defpackage;

import android.content.Context;
import android.os.Trace;
import android.util.Pair;
import android.view.Surface;
import androidx.media3.exoplayer.video.VideoSink$VideoSinkException;
import java.util.List;

/* renamed from: ˎᵢ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public final class C1760 implements InterfaceC1418 {

    /* renamed from: ˇʼʤˎ, reason: contains not printable characters */
    public int f7083;

    /* renamed from: ˏˋٴ, reason: contains not printable characters */
    public final /* synthetic */ C1707 f7084;

    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public long f7085;

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public AbstractC2692 f7086;

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public C3446 f7087;

    /* renamed from: ᵻᵢﹳᵰ, reason: contains not printable characters */
    public long f7088;

    public C1760(C1707 c1707, Context context) {
        this.f7084 = c1707;
        AbstractC3558.m8126(context);
        C4421 c4421 = AbstractC2692.f10429;
        this.f7086 = C4471.f16684;
        this.f7088 = -9223372036854775807L;
    }

    @Override // defpackage.InterfaceC1418
    /* renamed from: ˇʼʤˎ */
    public final void mo4304() {
        C1707 c1707 = this.f7084;
        if (c1707.f6809) {
            c1707.f6794.mo4304();
        }
    }

    @Override // defpackage.InterfaceC1418
    /* renamed from: ˌʾˀ */
    public final void mo4305(List list) {
        if (this.f7086.equals(list)) {
            return;
        }
        this.f7086 = AbstractC2692.m6700(list);
        C3446 c3446 = this.f7087;
        if (c3446 == null) {
            return;
        }
        C2153 c2153M7829 = c3446.m7829();
        C0938 c0938 = c3446.f12906;
        if (c0938 == null || !c0938.m3193()) {
            c0938 = C0938.f4236;
        }
        c2153M7829.f8500 = c0938;
        c2153M7829.m5781();
        throw null;
    }

    @Override // defpackage.InterfaceC1418
    /* renamed from: ˌᵜᵹᵩ */
    public final void mo4306() {
        int i = C5004.f18581.f18582;
        this.f7084.f6796 = null;
    }

    @Override // defpackage.InterfaceC1418
    /* renamed from: ˎˏʜʾ */
    public final void mo4307(C3446 c3446, long j, int i, List list) {
        ᵛᵾˏ.ᵿʗᵝʽ(false);
        this.f7086 = AbstractC2692.m6700(list);
        this.f7087 = c3446;
        C2153 c2153M7829 = c3446.m7829();
        C0938 c0938 = c3446.f12906;
        if (c0938 == null || !c0938.m3193()) {
            c0938 = C0938.f4236;
        }
        c2153M7829.f8500 = c0938;
        c2153M7829.m5781();
        throw null;
    }

    @Override // defpackage.InterfaceC1418
    /* renamed from: ˏˋٴ */
    public final void mo4308() {
        C1707 c1707 = this.f7084;
        if (c1707.f6809) {
            c1707.f6794.mo4308();
        }
    }

    @Override // defpackage.InterfaceC1418
    /* renamed from: ˏᵙ */
    public final Surface mo4309() {
        ᵛᵾˏ.ᵿʗᵝʽ(false);
        throw null;
    }

    @Override // defpackage.InterfaceC1418
    /* renamed from: ˑᵱ */
    public final void mo4310(InterfaceC4325 interfaceC4325) {
        this.f7084.f6794.f8887 = interfaceC4325;
    }

    @Override // defpackage.InterfaceC1418
    /* renamed from: ᵝᵵᵺ */
    public final void mo4311() {
        long j = this.f7088;
        C1707 c1707 = this.f7084;
        if (c1707.f6804 >= j) {
            c1707.f6794.mo4311();
        }
    }

    @Override // defpackage.InterfaceC1418
    /* renamed from: ᵞʡ */
    public final void mo4312(boolean z) {
        C1707 c1707 = this.f7084;
        if (c1707.f6809) {
            c1707.f6794.mo4312(z);
        }
    }

    @Override // defpackage.InterfaceC1418
    /* renamed from: ᵡʠ */
    public final void mo4313(ˑᵽʾʦ r1) {
    }

    @Override // defpackage.InterfaceC1418
    /* renamed from: ᵢˇᵭ */
    public final boolean mo4314() {
        return false;
    }

    @Override // defpackage.InterfaceC1418
    /* renamed from: ᵥᵯˎ */
    public final void mo4315() {
        C1707 c1707 = this.f7084;
        if (c1707.f6802 == 2) {
            return;
        }
        C5073 c5073 = c1707.f6807;
        if (c5073 != null) {
            c5073.f18953.removeCallbacksAndMessages(null);
        }
        c1707.f6796 = null;
        c1707.f6802 = 2;
    }

    @Override // defpackage.InterfaceC1418
    /* renamed from: ᵧᵾˀˈ */
    public final void mo4316() {
    }

    @Override // defpackage.InterfaceC1418
    /* renamed from: ᵨᵳʝ */
    public final boolean mo4317(boolean z) {
        return this.f7084.f6794.f8885.m5643(false);
    }

    /* JADX WARN: Removed duplicated region for block: B:26:0x0040  */
    /* JADX WARN: Removed duplicated region for block: B:28:0x0043 A[Catch: GlUtil$GlException -> 0x0036, TryCatch #1 {GlUtil$GlException -> 0x0036, blocks: (B:14:0x0026, B:17:0x002e, B:25:0x003d, B:28:0x0043, B:30:0x0047, B:37:0x005a, B:40:0x0061, B:45:0x0081, B:35:0x0052), top: B:56:0x0026 }] */
    /* JADX WARN: Removed duplicated region for block: B:34:0x0050  */
    /* JADX WARN: Removed duplicated region for block: B:41:0x007a  */
    /* JADX WARN: Removed duplicated region for block: B:45:0x0081 A[Catch: GlUtil$GlException -> 0x0036, TRY_LEAVE, TryCatch #1 {GlUtil$GlException -> 0x0036, blocks: (B:14:0x0026, B:17:0x002e, B:25:0x003d, B:28:0x0043, B:30:0x0047, B:37:0x005a, B:40:0x0061, B:45:0x0081, B:35:0x0052), top: B:56:0x0026 }] */
    @Override // defpackage.InterfaceC1418
    /* renamed from: ᵪʩ */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public final boolean mo4318(defpackage.C3446 r10) throws androidx.media3.exoplayer.video.VideoSink$VideoSinkException {
        /*
            r9 = this;
            java.lang.String r0 = "Color transfer "
            ˎˊ r9 = r9.f7084
            int r1 = r9.f6802
            r2 = 1
            r3 = 0
            if (r1 != 0) goto Lc
            r1 = r2
            goto Ld
        Lc:
            r1 = r3
        Ld:
            ᵛᵾˏ.ᵿʗᵝʽ(r1)
            ˇˈʖ r1 = r10.f12906
            if (r1 == 0) goto L1b
            boolean r4 = r1.m3193()
            if (r4 == 0) goto L1b
            goto L1d
        L1b:
            ˇˈʖ r1 = defpackage.C0938.f4236
        L1d:
            int r1 = r1.f4240
            java.lang.String r4 = "EGL_EXT_gl_colorspace_bt2020_pq"
            r5 = 33
            r6 = 7
            if (r1 != r6) goto L40
            int r7 = android.os.Build.VERSION.SDK_INT     // Catch: androidx.media3.common.util.GlUtil$GlException -> L36
            r8 = 34
            if (r7 >= r8) goto L40
            if (r7 < r5) goto L39
            boolean r7 = ˉˇʨ.ᵧᵾˀˈ(r4)     // Catch: androidx.media3.common.util.GlUtil$GlException -> L36
            if (r7 == 0) goto L39
            r7 = r2
            goto L3a
        L36:
            r9 = move-exception
            goto La0
        L39:
            r7 = r3
        L3a:
            if (r7 != 0) goto L3d
            goto L40
        L3d:
            ˇˈʖ r0 = new ˇˈʖ     // Catch: androidx.media3.common.util.GlUtil$GlException -> L36
            goto L83
        L40:
            r7 = 6
            if (r1 != r7) goto L50
            int r6 = android.os.Build.VERSION.SDK_INT     // Catch: androidx.media3.common.util.GlUtil$GlException -> L36
            if (r6 < r5) goto L4e
            boolean r4 = ˉˇʨ.ᵧᵾˀˈ(r4)     // Catch: androidx.media3.common.util.GlUtil$GlException -> L36
            if (r4 == 0) goto L4e
            goto L58
        L4e:
            r2 = r3
            goto L58
        L50:
            if (r1 != r6) goto L58
            java.lang.String r2 = "EGL_EXT_gl_colorspace_bt2020_hlg"
            boolean r2 = ˉˇʨ.ᵧᵾˀˈ(r2)     // Catch: androidx.media3.common.util.GlUtil$GlException -> L36
        L58:
            if (r2 != 0) goto L7a
            int r2 = android.os.Build.VERSION.SDK_INT     // Catch: androidx.media3.common.util.GlUtil$GlException -> L36
            r3 = 29
            if (r2 >= r3) goto L61
            goto L7a
        L61:
            java.util.Locale r2 = java.util.Locale.US     // Catch: androidx.media3.common.util.GlUtil$GlException -> L36
            java.lang.StringBuilder r2 = new java.lang.StringBuilder     // Catch: androidx.media3.common.util.GlUtil$GlException -> L36
            r2.<init>(r0)     // Catch: androidx.media3.common.util.GlUtil$GlException -> L36
            r2.append(r1)     // Catch: androidx.media3.common.util.GlUtil$GlException -> L36
            java.lang.String r0 = " is not supported. Falling back to OpenGl tone mapping."
            r2.append(r0)     // Catch: androidx.media3.common.util.GlUtil$GlException -> L36
            java.lang.String r0 = r2.toString()     // Catch: androidx.media3.common.util.GlUtil$GlException -> L36
            ᵳʿˉ.ᵶʔᵢˊ(r0)     // Catch: androidx.media3.common.util.GlUtil$GlException -> L36
            ˇˈʖ r0 = defpackage.C0938.f4236     // Catch: androidx.media3.common.util.GlUtil$GlException -> L36
            goto L83
        L7a:
            r0 = 2
            if (r1 == r0) goto L81
            r0 = 10
            if (r1 != r0) goto L83
        L81:
            ˇˈʖ r0 = defpackage.C0938.f4236     // Catch: androidx.media3.common.util.GlUtil$GlException -> L36
        L83:
            ˏᵡʽ r0 = r9.f6798
            android.os.Looper r1 = android.os.Looper.myLooper()
            r1.getClass()
            r2 = 0
            ᵹᵫᵽ r0 = r0.m5287(r1, r2)
            r9.f6807 = r0
            ᵼᵮᵡ r9 = r9.f6805     // Catch: androidx.media3.common.VideoFrameProcessingException -> L99
            r9.m10954()     // Catch: androidx.media3.common.VideoFrameProcessingException -> L99
            throw r2
        L99:
            r9 = move-exception
            androidx.media3.exoplayer.video.VideoSink$VideoSinkException r0 = new androidx.media3.exoplayer.video.VideoSink$VideoSinkException
            r0.<init>(r9, r10)
            throw r0
        La0:
            androidx.media3.exoplayer.video.VideoSink$VideoSinkException r0 = new androidx.media3.exoplayer.video.VideoSink$VideoSinkException
            r0.<init>(r9, r10)
            throw r0
        */
        throw new UnsupportedOperationException("Method not decompiled: defpackage.C1760.mo4318(ᵤᵛᵖ):boolean");
    }

    @Override // defpackage.InterfaceC1418
    /* renamed from: ᵯٴᵦ */
    public final boolean mo4319(long j, C5149 c5149) {
        int i;
        ᵛᵾˏ.ᵿʗᵝʽ(false);
        long j2 = j + this.f7085;
        C1707 c1707 = this.f7084;
        C1258 c1258 = c1707.f6800;
        long j3 = c1258.f5245 == -9223372036854775807L ? -9223372036854775807L : (long) (((j2 - r3) * c1258.f5244) + c1258.f5246);
        if (j3 != -9223372036854775807L) {
            long j4 = c1707.f6808;
            if (j4 != -9223372036854775807L && j3 < j4 && (i = this.f7083) < 2) {
                this.f7083 = i + 1;
                ᵞᵞᵧ r9 = c5149.f19165;
                InterfaceC4316 interfaceC4316 = c5149.f19166;
                int i2 = c5149.f19167;
                Trace.beginSection("dropVideoBuffer");
                interfaceC4316.mo5745(i2);
                Trace.endSection();
                r9.ᵠᵳ(0, 1);
                return true;
            }
        }
        int i3 = c1707.f6795;
        if (i3 == -1 || i3 != 0) {
            return false;
        }
        throw null;
    }

    @Override // defpackage.InterfaceC1418
    /* renamed from: ᵳٴᵶ */
    public final void mo4320(boolean z) {
        C3959 c3959;
        this.f7088 = -9223372036854775807L;
        C1707 c1707 = this.f7084;
        C2273 c2273 = c1707.f6794;
        if (c1707.f6802 == 1) {
            c1707.f6803++;
            c2273.mo4320(z);
            while (true) {
                int iM8751 = c1707.f6806.m8751();
                c3959 = c1707.f6806;
                if (iM8751 <= 1) {
                    break;
                } else {
                    c3959.m8753();
                }
            }
            if (c3959.m8751() == 1) {
                ((AbstractC1034) c1707.f6806.m8753()).getClass();
                throw null;
            }
            c1707.f6804 = -9223372036854775807L;
            C5073 c5073 = c1707.f6807;
            c5073.getClass();
            c5073.m10539(new RunnableC1600(7, c1707));
        }
    }

    @Override // defpackage.InterfaceC1418
    /* renamed from: ᵴᵳ */
    public final boolean mo4321() {
        return false;
    }

    @Override // defpackage.InterfaceC1418
    /* renamed from: ᵶᵷᵕ */
    public final void mo4322(int i) {
        this.f7084.f6794.mo4322(i);
    }

    @Override // defpackage.InterfaceC1418
    /* renamed from: ᵸʓᵠ */
    public final void mo4323(long j, long j2) throws VideoSink$VideoSinkException {
        this.f7084.f6794.mo4323(j + this.f7085, j2);
    }

    @Override // defpackage.InterfaceC1418
    /* renamed from: ᵸˑ */
    public final void mo4324(float f) {
        C1707 c1707 = this.f7084;
        c1707.f6800.m3806(f);
        c1707.f6794.mo4324(f);
    }

    @Override // defpackage.InterfaceC1418
    /* renamed from: ᵹᵝᵶ */
    public final void mo4325(long j) {
        this.f7085 = j;
    }

    @Override // defpackage.InterfaceC1418
    /* renamed from: ᵻᵢﹳᵰ */
    public final void mo4326(Surface surface, C5004 c5004) {
        C1707 c1707 = this.f7084;
        Pair pair = c1707.f6796;
        if (pair != null && ((Surface) pair.first).equals(surface) && ((C5004) c1707.f6796.second).equals(c5004)) {
            return;
        }
        c1707.f6796 = Pair.create(surface, c5004);
        int i = c5004.f18582;
    }

    @Override // defpackage.InterfaceC1418
    /* renamed from: ᵿʗᵝʽ */
    public final void mo4327() {
        C1707 c1707 = this.f7084;
        if (c1707.f6806.m8751() == 0) {
            c1707.f6794.mo4327();
            return;
        }
        C3959 c3959 = new C3959();
        if (c1707.f6806.m8751() <= 0) {
            c1707.f6806 = c3959;
        } else {
            ((AbstractC1034) c1707.f6806.m8753()).getClass();
            throw null;
        }
    }
}
