65 lines
2.5 KiB
Java
65 lines
2.5 KiB
Java
package com.ubt.jimu.utils.videoUtil;
|
|
|
|
import android.graphics.Bitmap;
|
|
import android.media.MediaMetadataRetriever;
|
|
import android.media.ThumbnailUtils;
|
|
import android.text.TextUtils;
|
|
import android.util.Size;
|
|
import com.ubt.jimu.utils.LogUtils;
|
|
import java.io.File;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public class VideoUtils {
|
|
public static Bitmap a(String str, int i, int i2, int i3) {
|
|
Bitmap createVideoThumbnail = ThumbnailUtils.createVideoThumbnail(str, i3);
|
|
return createVideoThumbnail != null ? ThumbnailUtils.extractThumbnail(createVideoThumbnail, i, i2, 2) : createVideoThumbnail;
|
|
}
|
|
|
|
public static double b(String str) {
|
|
if (TextUtils.isEmpty(str)) {
|
|
return 0.0d;
|
|
}
|
|
File file = new File(str);
|
|
LogUtils.c("filePath:" + file);
|
|
if (file.exists() && file.isFile()) {
|
|
return (file.length() / 1024.00001d) / 1024.00001d;
|
|
}
|
|
return 0.0d;
|
|
}
|
|
|
|
public static Size c(String str) {
|
|
MediaMetadataRetriever mediaMetadataRetriever = new MediaMetadataRetriever();
|
|
mediaMetadataRetriever.setDataSource(str);
|
|
String extractMetadata = mediaMetadataRetriever.extractMetadata(19);
|
|
String extractMetadata2 = mediaMetadataRetriever.extractMetadata(18);
|
|
String extractMetadata3 = mediaMetadataRetriever.extractMetadata(24);
|
|
int intValue = Integer.valueOf(extractMetadata).intValue();
|
|
int intValue2 = Integer.valueOf(extractMetadata2).intValue();
|
|
Integer.valueOf(extractMetadata3).intValue();
|
|
Size size = new Size(intValue, intValue2);
|
|
mediaMetadataRetriever.release();
|
|
return size;
|
|
}
|
|
|
|
public static boolean d(String str) {
|
|
if (str.endsWith(".avi")) {
|
|
return true;
|
|
}
|
|
MediaMetadataRetriever mediaMetadataRetriever = new MediaMetadataRetriever();
|
|
try {
|
|
mediaMetadataRetriever.setDataSource(str);
|
|
return mediaMetadataRetriever.getFrameAtTime().getWidth() > mediaMetadataRetriever.getFrameAtTime().getHeight();
|
|
} catch (IllegalArgumentException unused) {
|
|
return true;
|
|
}
|
|
}
|
|
|
|
public static int a(String str) {
|
|
MediaMetadataRetriever mediaMetadataRetriever = new MediaMetadataRetriever();
|
|
mediaMetadataRetriever.setDataSource(str);
|
|
String extractMetadata = mediaMetadataRetriever.extractMetadata(20);
|
|
mediaMetadataRetriever.release();
|
|
return Integer.valueOf(extractMetadata).intValue();
|
|
}
|
|
}
|