package o; import android.graphics.Bitmap; import android.graphics.ImageDecoder; import android.graphics.drawable.AnimatedImageDrawable; import android.graphics.drawable.Drawable; import com.bumptech.glide.load.ImageHeaderParser; import java.io.IOException; import java.io.InputStream; import java.nio.ByteBuffer; import java.util.List; import o.hKF; /* loaded from: classes.dex */ public final class TnC { final Opg a; final List d; public TnC(List list, Opg opg) { this.d = list; this.a = opg; } static Ezi Fk_(ImageDecoder.Source source, int i, int i2, unA una) throws IOException { Drawable decodeDrawable = ImageDecoder.decodeDrawable(source, new C17158uQG(i, i2, una)); if (!(decodeDrawable instanceof AnimatedImageDrawable)) { throw new IOException("Received unexpected drawable type for animated webp, failing: ".concat(String.valueOf(decodeDrawable))); } return new RVV((AnimatedImageDrawable) decodeDrawable); } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes.dex */ public static final class RVV implements Ezi { private final AnimatedImageDrawable c; RVV(AnimatedImageDrawable animatedImageDrawable) { this.c = animatedImageDrawable; } @Override // o.Ezi public final Class d() { return Drawable.class; } @Override // o.Ezi public final int a() { return ((this.c.getIntrinsicWidth() * this.c.getIntrinsicHeight()) * FKd.FY_(Bitmap.Config.ARGB_8888)) << 1; } @Override // o.Ezi public final void b() { this.c.stop(); this.c.clearAnimationCallbacks(); } @Override // o.Ezi public final /* bridge */ /* synthetic */ Drawable e() { return this.c; } } /* loaded from: classes.dex */ public static final class IeS implements iYP { private final TnC d; @Override // o.iYP public final /* synthetic */ Ezi a(InputStream inputStream, int i, int i2, unA una) throws IOException { return TnC.Fk_(ImageDecoder.createSource(Qeb.a(inputStream)), i, i2, una); } @Override // o.iYP public final /* bridge */ /* synthetic */ boolean a(InputStream inputStream, unA una) throws IOException { TnC tnC = this.d; return hKF.a(tnC.d, inputStream, tnC.a) == ImageHeaderParser.ImageType.ANIMATED_WEBP; } public IeS(TnC tnC) { this.d = tnC; } } /* loaded from: classes.dex */ public static final class LWm implements iYP { private final TnC b; @Override // o.iYP public final /* synthetic */ Ezi a(ByteBuffer byteBuffer, int i, int i2, unA una) throws IOException { return TnC.Fk_(ImageDecoder.createSource(byteBuffer), i, i2, una); } @Override // o.iYP public final /* synthetic */ boolean a(ByteBuffer byteBuffer, unA una) throws IOException { ImageHeaderParser.ImageType e; ByteBuffer byteBuffer2 = byteBuffer; List list = this.b.d; if (byteBuffer2 == null) { e = ImageHeaderParser.ImageType.UNKNOWN; } else { e = hKF.e(list, new hKF.AnonymousClass2(byteBuffer2)); } return e == ImageHeaderParser.ImageType.ANIMATED_WEBP; } public LWm(TnC tnC) { this.b = tnC; } } }