301 lines
11 KiB
Java
301 lines
11 KiB
Java
package o;
|
|
|
|
import android.content.res.AssetFileDescriptor;
|
|
import android.graphics.Bitmap;
|
|
import android.media.MediaDataSource;
|
|
import android.media.MediaMetadataRetriever;
|
|
import android.os.Build;
|
|
import android.os.ParcelFileDescriptor;
|
|
import java.io.IOException;
|
|
import java.nio.ByteBuffer;
|
|
import java.security.MessageDigest;
|
|
import java.util.Arrays;
|
|
import java.util.Collections;
|
|
import java.util.List;
|
|
import o.wrW;
|
|
|
|
/* loaded from: classes.dex */
|
|
public final class MzD<T> implements iYP<T, Bitmap> {
|
|
private final sqY c;
|
|
private final LWm<T> g;
|
|
private final IeS j;
|
|
public static final wrW<Long> d = wrW.a("com.bumptech.glide.load.resource.bitmap.VideoBitmapDecode.TargetFrame", -1L, new wrW.LWm<Long>() { // from class: o.MzD.3
|
|
private final ByteBuffer d = ByteBuffer.allocate(8);
|
|
|
|
@Override // o.wrW.LWm
|
|
public final /* synthetic */ void d(byte[] bArr, Long l, MessageDigest messageDigest) {
|
|
Long l2 = l;
|
|
messageDigest.update(bArr);
|
|
synchronized (this.d) {
|
|
this.d.position(0);
|
|
messageDigest.update(this.d.putLong(l2.longValue()).array());
|
|
}
|
|
}
|
|
});
|
|
private static wrW<Integer> e = wrW.a("com.bumptech.glide.load.resource.bitmap.VideoBitmapDecode.FrameOption", 2, new wrW.LWm<Integer>() { // from class: o.MzD.1
|
|
private final ByteBuffer b = ByteBuffer.allocate(4);
|
|
|
|
@Override // o.wrW.LWm
|
|
public final /* synthetic */ void d(byte[] bArr, Integer num, MessageDigest messageDigest) {
|
|
Integer num2 = num;
|
|
if (num2 != null) {
|
|
messageDigest.update(bArr);
|
|
synchronized (this.b) {
|
|
this.b.position(0);
|
|
messageDigest.update(this.b.putInt(num2.intValue()).array());
|
|
}
|
|
}
|
|
}
|
|
});
|
|
private static final IeS a = new IeS();
|
|
private static final List<String> b = Collections.unmodifiableList(Arrays.asList("TP1A", "TD1A.220804.031"));
|
|
|
|
/* loaded from: classes.dex */
|
|
interface LWm<T> {
|
|
void Fj_(MediaMetadataRetriever mediaMetadataRetriever, T t);
|
|
}
|
|
|
|
@Override // o.iYP
|
|
public final boolean a(T t, unA una) {
|
|
return true;
|
|
}
|
|
|
|
public static iYP<AssetFileDescriptor, Bitmap> c(sqY sqy) {
|
|
return new MzD(sqy, new RVV((byte) 0));
|
|
}
|
|
|
|
public static iYP<ParcelFileDescriptor, Bitmap> e(sqY sqy) {
|
|
return new MzD(sqy, new HBt());
|
|
}
|
|
|
|
public static iYP<ByteBuffer, Bitmap> b(sqY sqy) {
|
|
return new MzD(sqy, new Sts());
|
|
}
|
|
|
|
private MzD(sqY sqy, LWm<T> lWm) {
|
|
this(sqy, lWm, a);
|
|
}
|
|
|
|
private MzD(sqY sqy, LWm<T> lWm, IeS ieS) {
|
|
this.c = sqy;
|
|
this.g = lWm;
|
|
this.j = ieS;
|
|
}
|
|
|
|
@Override // o.iYP
|
|
public final Ezi<Bitmap> a(T t, int i, int i2, unA una) throws IOException {
|
|
wrW<Long> wrw = d;
|
|
long longValue = ((Long) (una.d.containsKey(wrw) ? una.d.get(wrw) : wrw.a)).longValue();
|
|
if (longValue < 0 && longValue != -1) {
|
|
throw new IllegalArgumentException("Requested frame must be non-negative, or DEFAULT_FRAME, given: ".concat(String.valueOf(longValue)));
|
|
}
|
|
wrW<Integer> wrw2 = e;
|
|
Integer num = (Integer) (una.d.containsKey(wrw2) ? una.d.get(wrw2) : wrw2.a);
|
|
if (num == null) {
|
|
num = 2;
|
|
}
|
|
wrW<RBw> wrw3 = RBw.i;
|
|
RBw rBw = (RBw) (una.d.containsKey(wrw3) ? una.d.get(wrw3) : wrw3.a);
|
|
if (rBw == null) {
|
|
rBw = RBw.b;
|
|
}
|
|
RBw rBw2 = rBw;
|
|
MediaMetadataRetriever mediaMetadataRetriever = new MediaMetadataRetriever();
|
|
try {
|
|
this.g.Fj_(mediaMetadataRetriever, t);
|
|
int intValue = num.intValue();
|
|
Bitmap Ff_ = (Build.VERSION.SDK_INT < 27 || i == Integer.MIN_VALUE || i2 == Integer.MIN_VALUE || rBw2 == RBw.f) ? null : Ff_(mediaMetadataRetriever, longValue, intValue, i, i2, rBw2);
|
|
if (Ff_ == null) {
|
|
Ff_ = mediaMetadataRetriever.getFrameAtTime(longValue, intValue);
|
|
}
|
|
Bitmap Fe_ = Fe_(mediaMetadataRetriever, Ff_);
|
|
if (Fe_ != null) {
|
|
mediaMetadataRetriever.release();
|
|
sqY sqy = this.c;
|
|
if (Fe_ == null) {
|
|
return null;
|
|
}
|
|
return new EQc(Fe_, sqy);
|
|
}
|
|
throw new jbe();
|
|
} catch (Throwable th) {
|
|
mediaMetadataRetriever.release();
|
|
throw th;
|
|
}
|
|
}
|
|
|
|
private static Bitmap Ff_(MediaMetadataRetriever mediaMetadataRetriever, long j, int i, int i2, int i3, RBw rBw) {
|
|
try {
|
|
int parseInt = Integer.parseInt(mediaMetadataRetriever.extractMetadata(18));
|
|
int parseInt2 = Integer.parseInt(mediaMetadataRetriever.extractMetadata(19));
|
|
int parseInt3 = Integer.parseInt(mediaMetadataRetriever.extractMetadata(24));
|
|
if (parseInt3 == 90 || parseInt3 == 270) {
|
|
parseInt2 = parseInt;
|
|
parseInt = parseInt2;
|
|
}
|
|
float a2 = rBw.a(parseInt, parseInt2, i2, i3);
|
|
return mediaMetadataRetriever.getScaledFrameAtTime(j, i, Math.round(parseInt * a2), Math.round(a2 * parseInt2));
|
|
} catch (Throwable unused) {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
/* loaded from: classes.dex */
|
|
static class IeS {
|
|
IeS() {
|
|
}
|
|
}
|
|
|
|
/* loaded from: classes.dex */
|
|
static final class RVV implements LWm<AssetFileDescriptor> {
|
|
private RVV() {
|
|
}
|
|
|
|
/* synthetic */ RVV(byte b) {
|
|
this();
|
|
}
|
|
|
|
@Override // o.MzD.LWm
|
|
public final /* synthetic */ void Fj_(MediaMetadataRetriever mediaMetadataRetriever, AssetFileDescriptor assetFileDescriptor) {
|
|
AssetFileDescriptor assetFileDescriptor2 = assetFileDescriptor;
|
|
mediaMetadataRetriever.setDataSource(assetFileDescriptor2.getFileDescriptor(), assetFileDescriptor2.getStartOffset(), assetFileDescriptor2.getLength());
|
|
}
|
|
}
|
|
|
|
/* loaded from: classes.dex */
|
|
static final class HBt implements LWm<ParcelFileDescriptor> {
|
|
HBt() {
|
|
}
|
|
|
|
@Override // o.MzD.LWm
|
|
public final /* synthetic */ void Fj_(MediaMetadataRetriever mediaMetadataRetriever, ParcelFileDescriptor parcelFileDescriptor) {
|
|
mediaMetadataRetriever.setDataSource(parcelFileDescriptor.getFileDescriptor());
|
|
}
|
|
}
|
|
|
|
/* loaded from: classes.dex */
|
|
static final class Sts implements LWm<ByteBuffer> {
|
|
@Override // o.MzD.LWm
|
|
public final /* synthetic */ void Fj_(MediaMetadataRetriever mediaMetadataRetriever, ByteBuffer byteBuffer) {
|
|
mediaMetadataRetriever.setDataSource(new MediaDataSource(this, byteBuffer) { // from class: o.MzD.Sts.1
|
|
private ByteBuffer d;
|
|
private Sts e;
|
|
|
|
@Override // java.io.Closeable, java.lang.AutoCloseable
|
|
public final void close() {
|
|
}
|
|
|
|
{
|
|
this.e = this;
|
|
this.d = byteBuffer;
|
|
}
|
|
|
|
@Override // android.media.MediaDataSource
|
|
public final int readAt(long j, byte[] bArr, int i, int i2) {
|
|
if (j >= this.d.limit()) {
|
|
return -1;
|
|
}
|
|
this.d.position((int) j);
|
|
int min = Math.min(i2, this.d.remaining());
|
|
this.d.get(bArr, i, min);
|
|
return min;
|
|
}
|
|
|
|
@Override // android.media.MediaDataSource
|
|
public final long getSize() {
|
|
return this.d.limit();
|
|
}
|
|
});
|
|
}
|
|
|
|
Sts() {
|
|
}
|
|
}
|
|
|
|
/* loaded from: classes.dex */
|
|
static final class jbe extends RuntimeException {
|
|
jbe() {
|
|
super("MediaMetadataRetriever failed to retrieve a frame without throwing, check the adb logs for .*MetadataRetriever.* prior to this exception for details");
|
|
}
|
|
}
|
|
|
|
/* JADX WARN: Can't wrap try/catch for region: R(7:1|(3:28|(1:30)|16)(4:5|(3:8|(1:10)(1:26)|6)|27|16)|11|12|13|(3:19|20|(2:22|23))|16) */
|
|
/* JADX WARN: Code restructure failed: missing block: B:31:0x0033, code lost:
|
|
|
|
if (android.os.Build.VERSION.SDK_INT < 33) goto L16;
|
|
*/
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct add '--show-bad-code' argument
|
|
*/
|
|
private static android.graphics.Bitmap Fe_(android.media.MediaMetadataRetriever r8, android.graphics.Bitmap r9) {
|
|
/*
|
|
java.lang.String r0 = android.os.Build.MODEL
|
|
java.lang.String r1 = "Pixel"
|
|
boolean r0 = r0.startsWith(r1)
|
|
r1 = 33
|
|
if (r0 == 0) goto L2b
|
|
int r0 = android.os.Build.VERSION.SDK_INT
|
|
if (r0 != r1) goto L2b
|
|
java.util.List<java.lang.String> r0 = o.MzD.b
|
|
java.util.Iterator r0 = r0.iterator()
|
|
L16:
|
|
boolean r1 = r0.hasNext()
|
|
if (r1 == 0) goto L8c
|
|
java.lang.Object r1 = r0.next()
|
|
java.lang.String r1 = (java.lang.String) r1
|
|
java.lang.String r2 = android.os.Build.ID
|
|
boolean r1 = r2.startsWith(r1)
|
|
if (r1 == 0) goto L16
|
|
goto L35
|
|
L2b:
|
|
int r0 = android.os.Build.VERSION.SDK_INT
|
|
r2 = 30
|
|
if (r0 < r2) goto L8c
|
|
int r0 = android.os.Build.VERSION.SDK_INT
|
|
if (r0 >= r1) goto L8c
|
|
L35:
|
|
r0 = 36
|
|
java.lang.String r0 = r8.extractMetadata(r0) // Catch: java.lang.NumberFormatException -> L8c
|
|
r1 = 35
|
|
java.lang.String r1 = r8.extractMetadata(r1) // Catch: java.lang.NumberFormatException -> L8c
|
|
int r0 = java.lang.Integer.parseInt(r0) // Catch: java.lang.NumberFormatException -> L8c
|
|
int r1 = java.lang.Integer.parseInt(r1) // Catch: java.lang.NumberFormatException -> L8c
|
|
r2 = 7
|
|
r3 = 6
|
|
if (r0 == r2) goto L4f
|
|
if (r0 != r3) goto L8c
|
|
L4f:
|
|
if (r1 != r3) goto L8c
|
|
r0 = 24
|
|
java.lang.String r8 = r8.extractMetadata(r0) // Catch: java.lang.NumberFormatException -> L8c
|
|
int r8 = java.lang.Integer.parseInt(r8) // Catch: java.lang.NumberFormatException -> L8c
|
|
int r8 = java.lang.Math.abs(r8) // Catch: java.lang.NumberFormatException -> L8c
|
|
r0 = 180(0xb4, float:2.52E-43)
|
|
if (r8 != r0) goto L8c
|
|
android.graphics.Matrix r6 = new android.graphics.Matrix
|
|
r6.<init>()
|
|
int r8 = r9.getWidth()
|
|
float r8 = (float) r8
|
|
r0 = 1073741824(0x40000000, float:2.0)
|
|
float r8 = r8 / r0
|
|
int r1 = r9.getHeight()
|
|
float r1 = (float) r1
|
|
float r1 = r1 / r0
|
|
r0 = 1127481344(0x43340000, float:180.0)
|
|
r6.postRotate(r0, r8, r1)
|
|
int r4 = r9.getWidth()
|
|
int r5 = r9.getHeight()
|
|
r2 = 0
|
|
r3 = 0
|
|
r7 = 1
|
|
r1 = r9
|
|
android.graphics.Bitmap r8 = android.graphics.Bitmap.createBitmap(r1, r2, r3, r4, r5, r6, r7)
|
|
return r8
|
|
L8c:
|
|
return r9
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: o.MzD.Fe_(android.media.MediaMetadataRetriever, android.graphics.Bitmap):android.graphics.Bitmap");
|
|
}
|
|
}
|