package defpackage;

import android.content.Context;
import android.os.Build;
import android.os.Looper;
import android.os.Trace;
import android.util.Pair;
import android.view.Surface;
import androidx.media3.common.VideoFrameProcessingException;
import androidx.media3.common.util.GlUtil$GlException;
import androidx.media3.exoplayer.video.VideoSink$VideoSinkException;
import java.util.List;
import java.util.Locale;

/* JADX INFO: renamed from: ˉᵺᵖ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes3.dex */
public final class C1269 implements InterfaceC3032 {

    /* JADX INFO: renamed from: ʽˈˋ, reason: contains not printable characters */
    public C5286 f5326;

    /* JADX INFO: renamed from: ːˏᵟᵯ, reason: contains not printable characters */
    public long f5327;

    /* JADX INFO: renamed from: ᵨᵣ, reason: contains not printable characters */
    public int f5328;

    /* JADX INFO: renamed from: ᵲᵶᵳˈ, reason: contains not printable characters */
    public AbstractC4509 f5329;

    /* JADX INFO: renamed from: ᵷᵺʾᵖ, reason: contains not printable characters */
    public long f5330;

    /* JADX INFO: renamed from: ᵻˈᵦʼ, reason: contains not printable characters */
    public final /* synthetic */ C4011 f5331;

    public C1269(C4011 c4011, Context context) {
        this.f5331 = c4011;
        AbstractC0956.m3248(context);
        C2822 c2822 = AbstractC4509.f17159;
        this.f5329 = C2598.f10048;
        this.f5330 = -9223372036854775807L;
    }

    @Override // defpackage.InterfaceC3032
    /* JADX INFO: renamed from: ʽˈˋ, reason: contains not printable characters */
    public final boolean mo3759() {
        return false;
    }

    @Override // defpackage.InterfaceC3032
    /* JADX INFO: renamed from: ˉᵲ, reason: contains not printable characters */
    public final void mo3760(boolean z) {
        C4011 c4011 = this.f5331;
        if (c4011.f15407) {
            c4011.f15400.mo3760(z);
        }
    }

    @Override // defpackage.InterfaceC3032
    /* JADX INFO: renamed from: ˊᵙᵾᵲ, reason: contains not printable characters */
    public final void mo3761(long j, long j2) throws VideoSink$VideoSinkException {
        this.f5331.f15400.mo3761(j + this.f5327, j2);
    }

    @Override // defpackage.InterfaceC3032
    /* JADX INFO: renamed from: ˊᵨᵧ, reason: contains not printable characters */
    public final void mo3762(InterfaceC0819 interfaceC0819) {
        this.f5331.f15400.f15940 = interfaceC0819;
    }

    @Override // defpackage.InterfaceC3032
    /* JADX INFO: renamed from: ˊᵫᵗ, reason: contains not printable characters */
    public final void mo3763(C5286 c5286, long j, int i, List list) {
        ᵻᵪ.ˌᴵ(false);
        this.f5329 = AbstractC4509.m9559(list);
        this.f5326 = c5286;
        C4753 c4753M10878 = c5286.m10878();
        C3281 c3281 = c5286.f19978;
        if (c3281 == null || !c3281.m7519()) {
            c3281 = C3281.f12573;
        }
        c4753M10878.f18127 = c3281;
        c4753M10878.m9934();
        throw null;
    }

    @Override // defpackage.InterfaceC3032
    /* JADX INFO: renamed from: ˋˈ, reason: contains not printable characters */
    public final boolean mo3764(long j, C4007 c4007) {
        int i;
        ᵻᵪ.ˌᴵ(false);
        long j2 = j + this.f5327;
        C4011 c4011 = this.f5331;
        C3449 c3449 = c4011.f15408;
        long j3 = c3449.f13297 == -9223372036854775807L ? -9223372036854775807L : (long) (((j2 - r3) * c3449.f13296) + c3449.f13295);
        if (j3 != -9223372036854775807L) {
            long j4 = c4011.f15395;
            if (j4 != -9223372036854775807L && j3 < j4 && (i = this.f5328) < 2) {
                this.f5328 = i + 1;
                ᵦʝᵛᵤ r9 = c4007.f15386;
                InterfaceC1595 interfaceC1595 = c4007.f15387;
                int i2 = c4007.f15385;
                Trace.beginSection("dropVideoBuffer");
                interfaceC1595.mo3045(i2);
                Trace.endSection();
                r9.ᵔﹳ(0, 1);
                return true;
            }
        }
        int i3 = c4011.f15399;
        if (i3 == -1 || i3 != 0) {
            return false;
        }
        throw null;
    }

    @Override // defpackage.InterfaceC3032
    /* JADX INFO: renamed from: ˌᴵ, reason: contains not printable characters */
    public final void mo3765() {
    }

    @Override // defpackage.InterfaceC3032
    /* JADX INFO: renamed from: ˏːˆ, reason: contains not printable characters */
    public final boolean mo3766(boolean z) {
        return this.f5331.f15400.f15941.m8071(false);
    }

    @Override // defpackage.InterfaceC3032
    /* JADX INFO: renamed from: ːˏᵟᵯ, reason: contains not printable characters */
    public final Surface mo3767() {
        ᵻᵪ.ˌᴵ(false);
        throw null;
    }

    @Override // defpackage.InterfaceC3032
    /* JADX INFO: renamed from: ᵔᵖᵹᵫ, reason: contains not printable characters */
    public final void mo3768() {
        C4011 c4011 = this.f5331;
        if (c4011.f15403.m2726() == 0) {
            c4011.f15400.mo3768();
            return;
        }
        C0760 c0760 = new C0760();
        if (c4011.f15403.m2726() <= 0) {
            c4011.f15403 = c0760;
        } else {
            ((AbstractC1475) c4011.f15403.m2733()).getClass();
            throw null;
        }
    }

    @Override // defpackage.InterfaceC3032
    /* JADX INFO: renamed from: ᵜᵪʾ, reason: contains not printable characters */
    public final boolean mo3769() {
        return false;
    }

    @Override // defpackage.InterfaceC3032
    /* JADX INFO: renamed from: ᵝᵶ, reason: contains not printable characters */
    public final void mo3770() {
        int i = C5567.f21019.f21021;
        this.f5331.f15402 = null;
    }

    @Override // defpackage.InterfaceC3032
    /* JADX INFO: renamed from: ᵟᵹᵙ, reason: contains not printable characters */
    public final void mo3771(boolean z) {
        C0760 c0760;
        this.f5330 = -9223372036854775807L;
        C4011 c4011 = this.f5331;
        C4178 c4178 = c4011.f15400;
        if (c4011.f15396 == 1) {
            c4011.f15398++;
            c4178.mo3771(z);
            while (true) {
                int iM2726 = c4011.f15403.m2726();
                c0760 = c4011.f15403;
                if (iM2726 <= 1) {
                    break;
                } else {
                    c0760.m2733();
                }
            }
            if (c0760.m2726() == 1) {
                ((AbstractC1475) c4011.f15403.m2733()).getClass();
                throw null;
            }
            c4011.f15401 = -9223372036854775807L;
            C3086 c3086 = c4011.f15406;
            c3086.getClass();
            c3086.m7175(new RunnableC4972(7, c4011));
        }
    }

    @Override // defpackage.InterfaceC3032
    /* JADX INFO: renamed from: ᵨᵣ, reason: contains not printable characters */
    public final void mo3772() {
        C4011 c4011 = this.f5331;
        if (c4011.f15407) {
            c4011.f15400.mo3772();
        }
    }

    /* 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.InterfaceC3032
    /* JADX INFO: renamed from: ᵪᵹᵥᵻ, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final boolean mo3773(C5286 c5286) throws VideoSink$VideoSinkException {
        C4011 c4011 = this.f5331;
        boolean z = true;
        ᵻᵪ.ˌᴵ(c4011.f15396 == 0);
        C3281 c3281 = c5286.f19978;
        if (c3281 == null || !c3281.m7519()) {
            c3281 = C3281.f12573;
        }
        int i = c3281.f12575;
        if (i == 7) {
            try {
                int i2 = Build.VERSION.SDK_INT;
                if (i2 >= 34) {
                    if (i != 6) {
                        if (Build.VERSION.SDK_INT < 33 || !ᵺᵘ.ᵯᵷʽ("EGL_EXT_gl_colorspace_bt2020_pq")) {
                            z = false;
                        }
                    } else if (i == 7) {
                        z = ᵺᵘ.ᵯᵷʽ("EGL_EXT_gl_colorspace_bt2020_hlg");
                    }
                    if (z && Build.VERSION.SDK_INT >= 29) {
                        Locale locale = Locale.US;
                        ˋˀᵧ.ʿٴˇ("Color transfer " + i + " is not supported. Falling back to OpenGl tone mapping.");
                        C3281 c32812 = C3281.f12573;
                    } else if (i != 2 || i == 10) {
                        C3281 c32813 = C3281.f12573;
                    }
                } else {
                    if (!(i2 >= 33 && ᵺᵘ.ᵯᵷʽ("EGL_EXT_gl_colorspace_bt2020_pq"))) {
                        if (i != 6) {
                        }
                        if (z) {
                            if (i != 2) {
                                C3281 c328132 = C3281.f12573;
                            }
                        }
                    }
                }
            } catch (GlUtil$GlException e) {
                throw new VideoSink$VideoSinkException(e, c5286);
            }
        }
        C2353 c2353 = c4011.f15409;
        Looper looperMyLooper = Looper.myLooper();
        looperMyLooper.getClass();
        c4011.f15406 = c2353.m6030(looperMyLooper, null);
        try {
            c4011.f15394.m1835();
            throw null;
        } catch (VideoFrameProcessingException e2) {
            throw new VideoSink$VideoSinkException(e2, c5286);
        }
    }

    @Override // defpackage.InterfaceC3032
    /* JADX INFO: renamed from: ᵮᵣᵗˈ, reason: contains not printable characters */
    public final void mo3774(float f) {
        C4011 c4011 = this.f5331;
        c4011.f15408.m7862(f);
        c4011.f15400.mo3774(f);
    }

    @Override // defpackage.InterfaceC3032
    /* JADX INFO: renamed from: ᵱʡˏ, reason: contains not printable characters */
    public final void mo3775(List list) {
        if (this.f5329.equals(list)) {
            return;
        }
        this.f5329 = AbstractC4509.m9559(list);
        C5286 c5286 = this.f5326;
        if (c5286 == null) {
            return;
        }
        C4753 c4753M10878 = c5286.m10878();
        C3281 c3281 = c5286.f19978;
        if (c3281 == null || !c3281.m7519()) {
            c3281 = C3281.f12573;
        }
        c4753M10878.f18127 = c3281;
        c4753M10878.m9934();
        throw null;
    }

    @Override // defpackage.InterfaceC3032
    /* JADX INFO: renamed from: ᵱᵽʡᵚ, reason: contains not printable characters */
    public final void mo3776() {
        long j = this.f5330;
        C4011 c4011 = this.f5331;
        if (c4011.f15401 >= j) {
            c4011.f15400.mo3776();
        }
    }

    @Override // defpackage.InterfaceC3032
    /* JADX INFO: renamed from: ᵲᵶᵳˈ, reason: contains not printable characters */
    public final void mo3777() {
        C4011 c4011 = this.f5331;
        if (c4011.f15396 == 2) {
            return;
        }
        C3086 c3086 = c4011.f15406;
        if (c3086 != null) {
            c3086.f11775.removeCallbacksAndMessages(null);
        }
        c4011.f15402 = null;
        c4011.f15396 = 2;
    }

    @Override // defpackage.InterfaceC3032
    /* JADX INFO: renamed from: ᵵᵽ, reason: contains not printable characters */
    public final void mo3778(ˈᵷᵵᵞ r1) {
    }

    @Override // defpackage.InterfaceC3032
    /* JADX INFO: renamed from: ᵶᵥᵝ, reason: contains not printable characters */
    public final void mo3779(int i) {
        this.f5331.f15400.mo3779(i);
    }

    @Override // defpackage.InterfaceC3032
    /* JADX INFO: renamed from: ᵷᵺʾᵖ, reason: contains not printable characters */
    public final void mo3780(Surface surface, C5567 c5567) {
        C4011 c4011 = this.f5331;
        Pair pair = c4011.f15402;
        if (pair != null && ((Surface) pair.first).equals(surface) && ((C5567) c4011.f15402.second).equals(c5567)) {
            return;
        }
        c4011.f15402 = Pair.create(surface, c5567);
        int i = c5567.f21021;
    }

    @Override // defpackage.InterfaceC3032
    /* JADX INFO: renamed from: ᵻʽᵯ, reason: contains not printable characters */
    public final void mo3781(long j) {
        this.f5327 = j;
    }

    @Override // defpackage.InterfaceC3032
    /* JADX INFO: renamed from: ᵻˈᵦʼ, reason: contains not printable characters */
    public final void mo3782() {
        C4011 c4011 = this.f5331;
        if (c4011.f15407) {
            c4011.f15400.mo3782();
        }
    }
}
