package defpackage;

import android.graphics.Bitmap;
import android.os.Trace;
import androidx.media3.exoplayer.ExoPlaybackException;
import androidx.media3.exoplayer.image.ImageDecoderException;
import androidx.media3.exoplayer.image.ImageOutput;
import java.util.ArrayDeque;

/* renamed from: ᵪʧᵿʖ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public final class C3858 extends AbstractC4483 {

    /* renamed from: ʾᵻᵭٴ, reason: contains not printable characters */
    public C4395 f14335;

    /* renamed from: ˀˁᵨ, reason: contains not printable characters */
    public ImageOutput f14336;

    /* renamed from: ˀᵗᵩ, reason: contains not printable characters */
    public boolean f14337;

    /* renamed from: ˆᵼᵷˊ, reason: contains not printable characters */
    public boolean f14338;

    /* renamed from: ˊʽˎ, reason: contains not printable characters */
    public int f14339;

    /* renamed from: ˊʾˊ, reason: contains not printable characters */
    public C0899 f14340;

    /* renamed from: ˊᵸˊ, reason: contains not printable characters */
    public final ArrayDeque f14341;

    /* renamed from: ˌᵪ, reason: contains not printable characters */
    public long f14342;

    /* renamed from: ˌᵹᵨˑ, reason: contains not printable characters */
    public boolean f14343;

    /* renamed from: ˎᵬˀ, reason: contains not printable characters */
    public C3446 f14344;

    /* renamed from: ˑᵝﹳᵜ, reason: contains not printable characters */
    public final C2441 f14345;

    /* renamed from: ᵛˈᵤ, reason: contains not printable characters */
    public C1582 f14346;

    /* renamed from: ᵠᵿː, reason: contains not printable characters */
    public C4395 f14347;

    /* renamed from: ᵡᵘˎʽ, reason: contains not printable characters */
    public final C4081 f14348;

    /* renamed from: ᵡᵶᵡ, reason: contains not printable characters */
    public int f14349;

    /* renamed from: ᵤᵼˑʠ, reason: contains not printable characters */
    public boolean f14350;

    /* renamed from: ᵫᵮʾ, reason: contains not printable characters */
    public C1158 f14351;

    /* renamed from: ᵳᵹᵺˋ, reason: contains not printable characters */
    public long f14352;

    /* renamed from: ᵷᵱ, reason: contains not printable characters */
    public Bitmap f14353;

    /* renamed from: ᵺᵠ, reason: contains not printable characters */
    public int f14354;

    /* renamed from: ᵽʛ, reason: contains not printable characters */
    public C2441 f14355;

    public C3858(C4081 c4081) {
        super(4);
        this.f14348 = c4081;
        this.f14336 = ImageOutput.f646;
        this.f14345 = new C2441(0, 0);
        this.f14346 = C1582.f6267;
        this.f14341 = new ArrayDeque();
        this.f14352 = -9223372036854775807L;
        this.f14342 = -9223372036854775807L;
        this.f14349 = 0;
        this.f14339 = 1;
    }

    @Override // defpackage.AbstractC4483
    /* renamed from: ˀᵗᵝᵭ */
    public final int mo372(C3446 c3446) {
        this.f14348.getClass();
        return C4081.m8943(c3446);
    }

    @Override // defpackage.AbstractC4483
    /* renamed from: ˌʾˀ */
    public final void mo374(long j, boolean z, boolean z2) {
        this.f14339 = Math.min(this.f14339, 1);
        this.f14338 = false;
        this.f14337 = false;
        this.f14353 = null;
        this.f14347 = null;
        this.f14335 = null;
        this.f14343 = false;
        this.f14355 = null;
        C1158 c1158 = this.f14351;
        if (c1158 != null) {
            c1158.flush();
        }
        this.f14341.clear();
    }

    @Override // defpackage.AbstractC4483
    /* renamed from: ˌᵜᵹᵩ */
    public final boolean mo375() {
        return this.f14338;
    }

    /* JADX WARN: Removed duplicated region for block: B:45:0x008a  */
    /* JADX WARN: Removed duplicated region for block: B:51:0x00d9  */
    /* JADX WARN: Removed duplicated region for block: B:52:0x00db  */
    /* JADX WARN: Removed duplicated region for block: B:55:0x00e0  */
    /* JADX WARN: Removed duplicated region for block: B:62:0x00ed  */
    /* JADX WARN: Removed duplicated region for block: B:66:0x00f7  */
    /* JADX WARN: Removed duplicated region for block: B:72:0x012a  */
    /* JADX WARN: Removed duplicated region for block: B:77:0x0144  */
    /* JADX WARN: Removed duplicated region for block: B:79:0x015d  */
    /* renamed from: ˎˑː, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public final boolean m8503(long r13) throws androidx.media3.exoplayer.ExoPlaybackException, java.lang.InterruptedException {
        /*
            Method dump skipped, instructions count: 359
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: defpackage.C3858.m8503(long):boolean");
    }

    @Override // defpackage.AbstractC4483, defpackage.InterfaceC1822
    /* renamed from: ˏᵙ */
    public final void mo379(int i, Object obj) {
        if (i != 15) {
            if (i != 23) {
                return;
            }
            this.f14340 = (C0899) obj;
        } else {
            ImageOutput imageOutput = obj instanceof ImageOutput ? (ImageOutput) obj : null;
            if (imageOutput == null) {
                imageOutput = ImageOutput.f646;
            }
            this.f14336 = imageOutput;
        }
    }

    /* JADX WARN: Code restructure failed: missing block: B:11:0x0023, code lost:
    
        if (r2 >= r6) goto L15;
     */
    @Override // defpackage.AbstractC4483
    /* renamed from: ˑᵱ */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public final void mo380(defpackage.C3446[] r5, long r6, long r8, defpackage.C2477 r10) {
        /*
            r4 = this;
            ˌˇᵛ r5 = r4.f14346
            long r5 = r5.f6269
            r0 = -9223372036854775807(0x8000000000000001, double:-4.9E-324)
            int r5 = (r5 > r0 ? 1 : (r5 == r0 ? 0 : -1))
            if (r5 == 0) goto L31
            java.util.ArrayDeque r5 = r4.f14341
            boolean r6 = r5.isEmpty()
            if (r6 == 0) goto L26
            long r6 = r4.f14352
            int r10 = (r6 > r0 ? 1 : (r6 == r0 ? 0 : -1))
            if (r10 == 0) goto L31
            long r2 = r4.f14342
            int r10 = (r2 > r0 ? 1 : (r2 == r0 ? 0 : -1))
            if (r10 == 0) goto L26
            int r6 = (r2 > r6 ? 1 : (r2 == r6 ? 0 : -1))
            if (r6 < 0) goto L26
            goto L31
        L26:
            ˌˇᵛ r6 = new ˌˇᵛ
            long r0 = r4.f14352
            r6.<init>(r0, r8)
            r5.add(r6)
            return
        L31:
            ˌˇᵛ r5 = new ˌˇᵛ
            r5.<init>(r0, r8)
            r4.f14346 = r5
            return
        */
        throw new UnsupportedOperationException("Method not decompiled: defpackage.C3858.mo380(ᵤᵛᵖ[], long, long, ᵗᵱ):void");
    }

    @Override // defpackage.AbstractC4483
    /* renamed from: ᵡʠ, reason: contains not printable characters */
    public final void mo8504() throws InterruptedException {
        m8508();
    }

    /* renamed from: ᵧـˌᵎ, reason: contains not printable characters */
    public final void m8505() throws ExoPlaybackException, InterruptedException {
        if (this.f14350) {
            C3446 c3446 = this.f14344;
            c3446.getClass();
            C4081 c4081 = this.f14348;
            c4081.getClass();
            int iM8943 = C4081.m8943(c3446);
            if (iM8943 != AbstractC2990.m7325(4, 0, 0, 0) && iM8943 != AbstractC2990.m7325(3, 0, 0, 0)) {
                throw m9539(new ImageDecoderException("Provided decoder factory can't create decoder for format."), this.f14344, false, 4005);
            }
            C1158 c1158 = this.f14351;
            if (c1158 != null) {
                c1158.mo364();
            }
            this.f14351 = new C1158(c4081.f15268);
            this.f14350 = false;
        }
    }

    @Override // defpackage.AbstractC4483
    /* renamed from: ᵪʩ */
    public final void mo388() throws InterruptedException {
        this.f14344 = null;
        this.f14346 = C1582.f6267;
        this.f14341.clear();
        m8508();
        this.f14336.mo409();
    }

    /* JADX WARN: Removed duplicated region for block: B:19:0x002f  */
    /* JADX WARN: Removed duplicated region for block: B:38:0x007e  */
    /* JADX WARN: Removed duplicated region for block: B:80:0x010d  */
    /* renamed from: ᵮᵠـˌ, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public final boolean m8506(long r13) {
        /*
            Method dump skipped, instructions count: 338
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: defpackage.C3858.m8506(long):boolean");
    }

    @Override // defpackage.AbstractC4483
    /* renamed from: ᵯٴᵦ */
    public final boolean mo390() {
        int i = this.f14339;
        if (i != 3) {
            return i == 0 && this.f14343;
        }
        return true;
    }

    @Override // defpackage.AbstractC4483
    /* renamed from: ᵳٴᵶ */
    public final void mo391(boolean z, boolean z2) {
        this.f14339 = z2 ? 1 : 0;
    }

    @Override // defpackage.AbstractC4483
    /* renamed from: ᵶᵷᵕ */
    public final String mo394() {
        return "ImageRenderer";
    }

    @Override // defpackage.AbstractC4483
    /* renamed from: ᵸʓᵠ, reason: contains not printable characters */
    public final void mo8507() throws InterruptedException {
        m8508();
        this.f14339 = Math.min(this.f14339, 1);
    }

    /* renamed from: ᵺʙ, reason: contains not printable characters */
    public final void m8508() throws InterruptedException {
        this.f14355 = null;
        this.f14349 = 0;
        this.f14352 = -9223372036854775807L;
        C1158 c1158 = this.f14351;
        if (c1158 != null) {
            c1158.mo364();
            this.f14351 = null;
        }
    }

    @Override // defpackage.AbstractC4483
    /* renamed from: ᵿʗᵝʽ */
    public final void mo397(long j, long j2) throws ExoPlaybackException, InterruptedException {
        if (this.f14338) {
            return;
        }
        if (this.f14344 == null) {
            C2720 c2720 = this.f16732;
            c2720.m6736();
            C2441 c2441 = this.f14345;
            c2441.mo6221();
            int iM9535 = m9535(c2720, c2441, 2);
            if (iM9535 != -5) {
                if (iM9535 == -4) {
                    ᵛᵾˏ.ᵿʗᵝʽ(c2441.m9873(4));
                    this.f14337 = true;
                    this.f14338 = true;
                    return;
                }
                return;
            }
            C3446 c3446 = (C3446) c2720.f10550;
            c3446.getClass();
            this.f14344 = c3446;
            this.f14350 = true;
        }
        if (this.f14351 == null) {
            m8505();
        }
        try {
            Trace.beginSection("drainAndFeedDecoder");
            while (m8503(j)) {
            }
            while (m8506(j)) {
            }
            Trace.endSection();
        } catch (ImageDecoderException e) {
            throw m9539(e, null, false, 4003);
        }
    }
}
