Initial commit
This commit is contained in:
43
sources/com/ubt/jimu/utils/videoUtil/CompressUtil.java
Normal file
43
sources/com/ubt/jimu/utils/videoUtil/CompressUtil.java
Normal file
@@ -0,0 +1,43 @@
|
||||
package com.ubt.jimu.utils.videoUtil;
|
||||
|
||||
import android.os.Environment;
|
||||
import android.util.Size;
|
||||
import com.ubt.jimu.blockly.feature.audio.AudioParams;
|
||||
import com.ubt.jimu.utils.Md5Utils;
|
||||
import java.io.File;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class CompressUtil {
|
||||
public static String a(String str, int i) {
|
||||
File file = new File(str);
|
||||
if (!file.exists()) {
|
||||
return "";
|
||||
}
|
||||
String a = a();
|
||||
File file2 = new File(a);
|
||||
if (!file2.exists()) {
|
||||
file2.mkdir();
|
||||
}
|
||||
return a + File.separator + "jimu_ubt_" + Md5Utils.a(file.getName() + i, 8) + ".mp4";
|
||||
}
|
||||
|
||||
public static Size b(String str) {
|
||||
Size c;
|
||||
if ((str.endsWith(".mp4") || str.endsWith(AudioParams.gpp)) && (c = VideoUtils.c(str)) != null && c.getWidth() * c.getHeight() > 921600) {
|
||||
return new Size(1280, 720);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String a() {
|
||||
return Environment.getExternalStorageDirectory() + "/ubt_jimu_photos";
|
||||
}
|
||||
|
||||
public static int a(String str) {
|
||||
int a = VideoUtils.a(str);
|
||||
if (a > 2097152) {
|
||||
return 2097152;
|
||||
}
|
||||
return a;
|
||||
}
|
||||
}
|
64
sources/com/ubt/jimu/utils/videoUtil/VideoUtils.java
Normal file
64
sources/com/ubt/jimu/utils/videoUtil/VideoUtils.java
Normal file
@@ -0,0 +1,64 @@
|
||||
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();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user