package defpackage;

import android.content.Context;
import android.graphics.Point;
import androidx.media3.common.ParserException;
import androidx.media3.decoder.DecoderException;
import androidx.media3.exoplayer.image.ImageDecoderException;
import java.io.IOException;
import java.nio.ByteBuffer;

/* renamed from: ˉˆˉ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public final class C1158 extends AbstractC0588 {

    /* renamed from: ˌʾˀ, reason: contains not printable characters */
    public final int f4939;

    /* renamed from: ᵳٴᵶ, reason: contains not printable characters */
    public final Context f4940;

    public C1158(Context context) {
        super(new C2441[1], new C0439[1]);
        this.f4940 = context;
        this.f4939 = -1;
    }

    @Override // defpackage.AbstractC0588
    /* renamed from: ˎˏʜʾ */
    public final C2441 mo362() {
        return new C2441(1, 0);
    }

    @Override // defpackage.AbstractC0588
    /* renamed from: ᵝᵵᵺ */
    public final DecoderException mo363(Throwable th) {
        return new ImageDecoderException("Unexpected decode error", th);
    }

    @Override // defpackage.AbstractC0588
    /* renamed from: ᵶᵷᵕ */
    public final DecoderException mo365(C2441 c2441, AbstractC0554 abstractC0554, boolean z) throws NumberFormatException {
        C0439 c0439 = (C0439) abstractC0554;
        ByteBuffer byteBuffer = c2441.f9517;
        byteBuffer.getClass();
        ᵛᵾˏ.ᵿʗᵝʽ(byteBuffer.hasArray());
        ᵛᵾˏ.ᵯٴᵦ(byteBuffer.arrayOffset() == 0);
        try {
            int iMax = this.f4939;
            if (iMax == -1) {
                Context context = this.f4940;
                if (context != null) {
                    Point pointM8136 = AbstractC3558.m8136(context);
                    int i = pointM8136.x;
                    int i2 = pointM8136.y;
                    C3446 c3446 = c2441.f9519;
                    if (c3446 != null) {
                        int i3 = c3446.f12918;
                        if (i3 != -1) {
                            i *= i3;
                        }
                        int i4 = c3446.f12909;
                        if (i4 != -1) {
                            i2 *= i4;
                        }
                    }
                    iMax = (Math.max(i, i2) * 2) - 1;
                } else {
                    iMax = 4096;
                }
            }
            c0439.f2476 = ᵭʝʜ.ᵶᵷᵕ(byteBuffer.array(), byteBuffer.remaining(), iMax);
            c0439.f2897 = c2441.f9512;
            return null;
        } catch (ParserException e) {
            return new ImageDecoderException("Could not decode image data with BitmapFactory.", e);
        } catch (IOException e2) {
            return new ImageDecoderException(e2);
        }
    }

    @Override // defpackage.AbstractC0588
    /* renamed from: ᵹᵝᵶ */
    public final AbstractC0554 mo366() {
        return new C0439(this);
    }
}
