2021-08-09 22:50:52 +00:00
|
|
|
package c.f.j.p;
|
|
|
|
|
|
|
|
import android.content.ContentResolver;
|
|
|
|
import android.database.Cursor;
|
|
|
|
import android.graphics.Bitmap;
|
|
|
|
import android.media.MediaMetadataRetriever;
|
|
|
|
import android.media.ThumbnailUtils;
|
|
|
|
import android.net.Uri;
|
|
|
|
import android.os.ParcelFileDescriptor;
|
|
|
|
import android.provider.DocumentsContract;
|
|
|
|
import android.provider.MediaStore;
|
|
|
|
import c.f.d.d.f;
|
|
|
|
import c.f.j.d.e;
|
|
|
|
import c.f.j.j.c;
|
|
|
|
import c.f.j.j.d;
|
|
|
|
import c.f.j.j.h;
|
|
|
|
import com.facebook.common.references.CloseableReference;
|
|
|
|
import com.facebook.imagepipeline.request.ImageRequest;
|
|
|
|
import java.io.FileNotFoundException;
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.Objects;
|
|
|
|
import java.util.concurrent.Executor;
|
|
|
|
import org.webrtc.MediaStreamTrack;
|
|
|
|
/* compiled from: LocalVideoThumbnailProducer */
|
|
|
|
public class j0 implements v0<CloseableReference<c>> {
|
|
|
|
public final Executor a;
|
|
|
|
public final ContentResolver b;
|
|
|
|
|
|
|
|
/* compiled from: LocalVideoThumbnailProducer */
|
|
|
|
public class a extends d1<CloseableReference<c>> {
|
|
|
|
public final /* synthetic */ y0 n;
|
|
|
|
public final /* synthetic */ w0 o;
|
|
|
|
public final /* synthetic */ ImageRequest p;
|
|
|
|
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
|
|
public a(l lVar, y0 y0Var, w0 w0Var, String str, y0 y0Var2, w0 w0Var2, ImageRequest imageRequest) {
|
|
|
|
super(lVar, y0Var, w0Var, str);
|
|
|
|
this.n = y0Var2;
|
|
|
|
this.o = w0Var2;
|
|
|
|
this.p = imageRequest;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
|
|
|
|
@Override // c.f.j.p.d1
|
|
|
|
public void b(CloseableReference<c> closeableReference) {
|
|
|
|
CloseableReference<c> closeableReference2 = closeableReference;
|
|
|
|
Class<CloseableReference> cls = CloseableReference.i;
|
|
|
|
if (closeableReference2 != null) {
|
|
|
|
closeableReference2.close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
|
|
|
|
@Override // c.f.j.p.d1
|
|
|
|
public Map c(CloseableReference<c> closeableReference) {
|
|
|
|
return f.of("createdThumbnail", String.valueOf(closeableReference != null));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Return type fixed from 'java.lang.Object' to match base method */
|
|
|
|
@Override // c.f.j.p.d1
|
|
|
|
public CloseableReference<c> d() throws Exception {
|
|
|
|
String str;
|
|
|
|
Bitmap bitmap;
|
|
|
|
int i;
|
|
|
|
try {
|
|
|
|
str = j0.c(j0.this, this.p);
|
|
|
|
} catch (IllegalArgumentException unused) {
|
|
|
|
str = null;
|
|
|
|
}
|
|
|
|
if (str != null) {
|
|
|
|
e eVar = this.p.i;
|
|
|
|
int i2 = 2048;
|
|
|
|
if ((eVar != null ? eVar.a : 2048) <= 96) {
|
|
|
|
if (eVar != null) {
|
|
|
|
i2 = eVar.b;
|
|
|
|
}
|
|
|
|
if (i2 <= 96) {
|
|
|
|
i = 3;
|
|
|
|
bitmap = ThumbnailUtils.createVideoThumbnail(str, i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
i = 1;
|
|
|
|
bitmap = ThumbnailUtils.createVideoThumbnail(str, i);
|
|
|
|
} else {
|
|
|
|
try {
|
2021-09-07 07:54:21 +00:00
|
|
|
ParcelFileDescriptor openFileDescriptor = j0.this.b.openFileDescriptor(this.p.f2262c, "r");
|
2021-08-09 22:50:52 +00:00
|
|
|
MediaMetadataRetriever mediaMetadataRetriever = new MediaMetadataRetriever();
|
|
|
|
mediaMetadataRetriever.setDataSource(openFileDescriptor.getFileDescriptor());
|
|
|
|
bitmap = mediaMetadataRetriever.getFrameAtTime(-1);
|
|
|
|
} catch (FileNotFoundException unused2) {
|
|
|
|
bitmap = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (bitmap == null) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
d dVar = new d(bitmap, c.f.j.b.b.a(), h.a, 0);
|
|
|
|
this.o.d("image_format", "thumbnail");
|
|
|
|
dVar.e(this.o.a());
|
|
|
|
return CloseableReference.C(dVar);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // c.f.j.p.d1
|
|
|
|
public void f(Exception exc) {
|
|
|
|
super.f(exc);
|
|
|
|
this.n.c(this.o, "VideoThumbnailProducer", false);
|
|
|
|
this.o.n("local");
|
|
|
|
}
|
|
|
|
|
|
|
|
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
|
|
|
|
@Override // c.f.j.p.d1
|
|
|
|
public void g(CloseableReference<c> closeableReference) {
|
|
|
|
CloseableReference<c> closeableReference2 = closeableReference;
|
|
|
|
super.g(closeableReference2);
|
|
|
|
this.n.c(this.o, "VideoThumbnailProducer", closeableReference2 != null);
|
|
|
|
this.o.n("local");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: LocalVideoThumbnailProducer */
|
|
|
|
public class b extends e {
|
|
|
|
public final /* synthetic */ d1 a;
|
|
|
|
|
|
|
|
public b(j0 j0Var, d1 d1Var) {
|
|
|
|
this.a = d1Var;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // c.f.j.p.x0
|
|
|
|
public void a() {
|
|
|
|
this.a.a();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public j0(Executor executor, ContentResolver contentResolver) {
|
|
|
|
this.a = executor;
|
|
|
|
this.b = contentResolver;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static String c(j0 j0Var, ImageRequest imageRequest) {
|
|
|
|
String[] strArr;
|
|
|
|
String str;
|
|
|
|
Uri uri;
|
|
|
|
Objects.requireNonNull(j0Var);
|
2021-09-07 07:54:21 +00:00
|
|
|
Uri uri2 = imageRequest.f2262c;
|
2021-08-09 22:50:52 +00:00
|
|
|
if (c.f.d.l.b.d(uri2)) {
|
|
|
|
return imageRequest.a().getPath();
|
|
|
|
}
|
|
|
|
if (c.f.d.l.b.c(uri2)) {
|
|
|
|
if ("com.android.providers.media.documents".equals(uri2.getAuthority())) {
|
|
|
|
String documentId = DocumentsContract.getDocumentId(uri2);
|
|
|
|
str = "_id=?";
|
|
|
|
uri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI;
|
|
|
|
strArr = new String[]{documentId.split(":")[1]};
|
|
|
|
} else {
|
|
|
|
uri = uri2;
|
|
|
|
str = null;
|
|
|
|
strArr = null;
|
|
|
|
}
|
|
|
|
Cursor query = j0Var.b.query(uri, new String[]{"_data"}, str, strArr, null);
|
|
|
|
if (query != null) {
|
|
|
|
try {
|
|
|
|
if (query.moveToFirst()) {
|
|
|
|
return query.getString(query.getColumnIndexOrThrow("_data"));
|
|
|
|
}
|
|
|
|
} finally {
|
|
|
|
query.close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (query != null) {
|
|
|
|
query.close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // c.f.j.p.v0
|
|
|
|
public void b(l<CloseableReference<c>> lVar, w0 w0Var) {
|
|
|
|
y0 o = w0Var.o();
|
|
|
|
ImageRequest e = w0Var.e();
|
|
|
|
w0Var.i("local", MediaStreamTrack.VIDEO_TRACK_KIND);
|
|
|
|
a aVar = new a(lVar, o, w0Var, "VideoThumbnailProducer", o, w0Var, e);
|
|
|
|
w0Var.f(new b(this, aVar));
|
|
|
|
this.a.execute(aVar);
|
|
|
|
}
|
|
|
|
}
|