Initial commit

This commit is contained in:
2025-05-13 19:24:51 +02:00
commit a950f49678
10604 changed files with 932663 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
package com.ubt.jimu.video;
/* loaded from: classes2.dex */
public class Configuration {
public String a;
public String b;
public boolean c;
public CompressState d;
public String e;
public int f;
enum CompressState {
SUCCESS,
FAIL
}
}

View File

@@ -0,0 +1,16 @@
package com.ubt.jimu.video;
/* loaded from: classes2.dex */
public interface OnCompressListener {
void onAllCompressFail();
void onAllCompressSuccess();
void onFail(boolean z);
void onProgress(float f);
void onSuccess(Configuration configuration);
void prepareCompress();
}

View File

@@ -0,0 +1,151 @@
package com.ubt.jimu.video;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
/* loaded from: classes2.dex */
public class StartCompressMonitor implements Runnable {
private ExecutorService a;
private List<Callable<Configuration>> b;
private OnCompressListener c;
public StartCompressMonitor(ExecutorService executorService, List<Callable<Configuration>> list, OnCompressListener onCompressListener) {
this.b = list;
this.a = executorService;
this.c = onCompressListener;
}
/* JADX WARN: Code restructure failed: missing block: B:30:0x0068, code lost:
com.ubt.jimu.utils.LogUtils.c("任务被取消~~~~~~~~~~~~");
*/
/* JADX WARN: Removed duplicated region for block: B:44:0x00bc */
@Override // java.lang.Runnable
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
public void run() {
/*
r7 = this;
java.lang.StringBuilder r0 = new java.lang.StringBuilder
r0.<init>()
java.lang.String r1 = "33333333333333:"
r0.append(r1)
java.util.concurrent.ExecutorService r1 = r7.a
r0.append(r1)
java.lang.String r1 = " mCallables:"
r0.append(r1)
java.util.List<java.util.concurrent.Callable<com.ubt.jimu.video.Configuration>> r1 = r7.b
r0.append(r1)
java.lang.String r1 = " size:"
r0.append(r1)
java.util.List<java.util.concurrent.Callable<com.ubt.jimu.video.Configuration>> r1 = r7.b
int r1 = r1.size()
r0.append(r1)
java.lang.String r0 = r0.toString()
com.ubt.jimu.utils.LogUtils.c(r0)
java.util.concurrent.ExecutorService r0 = r7.a
r1 = 0
if (r0 == 0) goto Lc0
java.util.List<java.util.concurrent.Callable<com.ubt.jimu.video.Configuration>> r0 = r7.b
if (r0 == 0) goto Lc0
int r0 = r0.size()
if (r0 != 0) goto L3f
goto Lc0
L3f:
java.lang.String r0 = "4444444444"
com.ubt.jimu.utils.LogUtils.c(r0)
r0 = 1
java.util.concurrent.ExecutorService r2 = r7.a // Catch: java.lang.Throwable -> L8b java.util.concurrent.ExecutionException -> L8d java.lang.InterruptedException -> L99
java.util.List<java.util.concurrent.Callable<com.ubt.jimu.video.Configuration>> r3 = r7.b // Catch: java.lang.Throwable -> L8b java.util.concurrent.ExecutionException -> L8d java.lang.InterruptedException -> L99
r4 = 60000(0xea60, double:2.9644E-319)
java.util.concurrent.TimeUnit r6 = java.util.concurrent.TimeUnit.MILLISECONDS // Catch: java.lang.Throwable -> L8b java.util.concurrent.ExecutionException -> L8d java.lang.InterruptedException -> L99
java.util.List r2 = r2.invokeAll(r3, r4, r6) // Catch: java.lang.Throwable -> L8b java.util.concurrent.ExecutionException -> L8d java.lang.InterruptedException -> L99
java.util.Iterator r2 = r2.iterator() // Catch: java.lang.Throwable -> L8b java.util.concurrent.ExecutionException -> L8d java.lang.InterruptedException -> L99
L56:
boolean r3 = r2.hasNext() // Catch: java.lang.Throwable -> L8b java.util.concurrent.ExecutionException -> L8d java.lang.InterruptedException -> L99
if (r3 == 0) goto L7b
java.lang.Object r3 = r2.next() // Catch: java.lang.Throwable -> L8b java.util.concurrent.ExecutionException -> L8d java.lang.InterruptedException -> L99
java.util.concurrent.Future r3 = (java.util.concurrent.Future) r3 // Catch: java.lang.Throwable -> L8b java.util.concurrent.ExecutionException -> L8d java.lang.InterruptedException -> L99
boolean r4 = r3.isCancelled() // Catch: java.lang.Throwable -> L8b java.util.concurrent.ExecutionException -> L8d java.lang.InterruptedException -> L99
if (r4 == 0) goto L6e
java.lang.String r0 = "任务被取消~~~~~~~~~~~~"
com.ubt.jimu.utils.LogUtils.c(r0) // Catch: java.util.concurrent.ExecutionException -> L8d java.lang.InterruptedException -> L99 java.lang.Throwable -> Laa
goto L7c
L6e:
java.lang.Object r3 = r3.get() // Catch: java.lang.Throwable -> L8b java.util.concurrent.ExecutionException -> L8d java.lang.InterruptedException -> L99
com.ubt.jimu.video.Configuration r3 = (com.ubt.jimu.video.Configuration) r3 // Catch: java.lang.Throwable -> L8b java.util.concurrent.ExecutionException -> L8d java.lang.InterruptedException -> L99
com.ubt.jimu.video.Configuration$CompressState r3 = r3.d // Catch: java.lang.Throwable -> L8b java.util.concurrent.ExecutionException -> L8d java.lang.InterruptedException -> L99
com.ubt.jimu.video.Configuration$CompressState r4 = com.ubt.jimu.video.Configuration.CompressState.FAIL // Catch: java.lang.Throwable -> L8b java.util.concurrent.ExecutionException -> L8d java.lang.InterruptedException -> L99
if (r3 != r4) goto L56
goto L7c
L7b:
r1 = 1
L7c:
if (r1 == 0) goto L86
com.ubt.jimu.video.OnCompressListener r0 = r7.c
if (r0 == 0) goto L86
r0.onAllCompressSuccess()
goto La9
L86:
com.ubt.jimu.video.OnCompressListener r0 = r7.c
if (r0 == 0) goto La9
goto L95
L8b:
r1 = move-exception
goto Lad
L8d:
r0 = move-exception
r0.printStackTrace() // Catch: java.lang.Throwable -> Laa
com.ubt.jimu.video.OnCompressListener r0 = r7.c
if (r0 == 0) goto La9
L95:
r0.onAllCompressFail()
goto La9
L99:
r0 = move-exception
r0.printStackTrace() // Catch: java.lang.Throwable -> Laa
java.lang.Thread r0 = java.lang.Thread.currentThread() // Catch: java.lang.Throwable -> Laa
r0.interrupt() // Catch: java.lang.Throwable -> Laa
com.ubt.jimu.video.OnCompressListener r0 = r7.c
if (r0 == 0) goto La9
goto L95
La9:
return
Laa:
r0 = move-exception
r1 = r0
r0 = 0
Lad:
if (r0 == 0) goto Lb8
com.ubt.jimu.video.OnCompressListener r0 = r7.c
if (r0 != 0) goto Lb4
goto Lb8
Lb4:
r0.onAllCompressSuccess()
goto Lbf
Lb8:
com.ubt.jimu.video.OnCompressListener r0 = r7.c
if (r0 == 0) goto Lbf
r0.onAllCompressFail()
Lbf:
throw r1
Lc0:
com.ubt.jimu.video.OnCompressListener r0 = r7.c
if (r0 == 0) goto Lcf
com.ubt.jimu.video.Configuration r0 = new com.ubt.jimu.video.Configuration
r0.<init>()
com.ubt.jimu.video.OnCompressListener r0 = r7.c
r0.onFail(r1)
return
Lcf:
java.lang.NullPointerException r0 = new java.lang.NullPointerException
java.lang.String r1 = "mThreadPoolExecutor is null | Callable is null | Callables.size() is 0"
r0.<init>(r1)
throw r0
*/
throw new UnsupportedOperationException("Method not decompiled: com.ubt.jimu.video.StartCompressMonitor.run():void");
}
}

View File

@@ -0,0 +1,44 @@
package com.ubt.jimu.video;
import android.content.Context;
import java.util.concurrent.Callable;
/* loaded from: classes2.dex */
public class VideoCompressTask implements Callable<Configuration> {
private final Context a;
private final OnCompressListener b;
private Configuration c;
private float d;
public VideoCompressTask(Context context, Configuration configuration, OnCompressListener onCompressListener) {
this.c = configuration;
this.a = context;
this.b = onCompressListener;
}
/* JADX WARN: Can't rename method to resolve collision */
/* JADX WARN: Code restructure failed: missing block: B:32:0x00ef, code lost:
if (r0.exists() != false) goto L28;
*/
/* JADX WARN: Code restructure failed: missing block: B:33:0x00f1, code lost:
r0.delete();
*/
/* JADX WARN: Code restructure failed: missing block: B:52:0x013f, code lost:
if (r0.exists() != false) goto L28;
*/
@Override // java.util.concurrent.Callable
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
public com.ubt.jimu.video.Configuration call() throws java.lang.Exception {
/*
Method dump skipped, instructions count: 407
To view this dump change 'Code comments level' option to 'DEBUG'
*/
throw new UnsupportedOperationException("Method not decompiled: com.ubt.jimu.video.VideoCompressTask.call():com.ubt.jimu.video.Configuration");
}
}

View File

@@ -0,0 +1,181 @@
package com.ubt.jimu.video;
import android.content.Context;
import android.text.TextUtils;
import com.ubt.jimu.utils.LogUtils;
import com.ubt.jimu.video.Configuration;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;
/* loaded from: classes2.dex */
public class VideoCompressUtils implements OnCompressListener {
private static VideoCompressUtils h;
private ExecutorService a;
private ExecutorService b;
private final LinkedBlockingQueue c;
private Context d;
private OnCompressListener e;
private volatile boolean f;
private volatile float g;
private VideoCompressUtils(Context context) {
TimeUnit timeUnit = TimeUnit.MILLISECONDS;
this.c = new LinkedBlockingQueue();
if (context == null) {
throw new NullPointerException("Context 不能为null");
}
this.d = context;
}
private void a(int i) {
ExecutorService executorService = this.b;
if (executorService == null || executorService.isShutdown()) {
if (i >= 0) {
}
this.b = Executors.newSingleThreadExecutor();
LogUtils.c("创建请求线程");
}
}
private void b() {
ExecutorService executorService = this.a;
if (executorService == null || executorService.isShutdown()) {
this.a = Executors.newSingleThreadExecutor();
LogUtils.c("创建结果监听线程");
}
}
@Override // com.ubt.jimu.video.OnCompressListener
public void onAllCompressFail() {
a();
OnCompressListener onCompressListener = this.e;
if (onCompressListener != null) {
onCompressListener.onAllCompressFail();
}
}
@Override // com.ubt.jimu.video.OnCompressListener
public void onAllCompressSuccess() {
LogUtils.c("所有视频压缩成功");
OnCompressListener onCompressListener = this.e;
if (onCompressListener != null) {
onCompressListener.onAllCompressSuccess();
}
this.f = false;
}
@Override // com.ubt.jimu.video.OnCompressListener
public void onFail(boolean z) {
OnCompressListener onCompressListener = this.e;
if (onCompressListener != null) {
onCompressListener.onFail(z);
}
a();
}
@Override // com.ubt.jimu.video.OnCompressListener
public void onProgress(float f) {
if (this.e != null) {
this.g += f;
this.e.onProgress(this.g * 100.0f);
LogUtils.c(Thread.currentThread().getName() + " ~~~~~ " + Math.round(this.g * 100.0f));
}
}
@Override // com.ubt.jimu.video.OnCompressListener
public void onSuccess(Configuration configuration) {
LogUtils.c("压缩成功:" + configuration);
OnCompressListener onCompressListener = this.e;
if (onCompressListener != null) {
onCompressListener.onSuccess(configuration);
}
}
@Override // com.ubt.jimu.video.OnCompressListener
public void prepareCompress() {
LogUtils.c("准备压缩");
OnCompressListener onCompressListener = this.e;
if (onCompressListener != null) {
onCompressListener.prepareCompress();
}
}
public static synchronized VideoCompressUtils a(Context context) {
VideoCompressUtils videoCompressUtils;
synchronized (VideoCompressUtils.class) {
if (h == null) {
h = new VideoCompressUtils(context);
}
videoCompressUtils = h;
}
return videoCompressUtils;
}
public void a(List<Configuration> list, OnCompressListener onCompressListener) {
this.e = onCompressListener;
if (this.f) {
return;
}
this.f = true;
synchronized (this.c) {
prepareCompress();
ArrayList arrayList = new ArrayList();
this.g = 0.0f;
if (this.d != null) {
if (list != null && list.size() != 0) {
a(list.size());
for (int i = 0; i < list.size(); i++) {
Configuration configuration = list.get(i);
if (configuration != null) {
a(configuration, arrayList);
}
}
if (arrayList.size() == 0 && list.size() != 0 && onCompressListener != null) {
onCompressListener.onAllCompressSuccess();
return;
}
b();
StartCompressMonitor startCompressMonitor = new StartCompressMonitor(this.b, arrayList, this);
LogUtils.c("111111111111111");
this.a.submit(startCompressMonitor);
LogUtils.c("2222222222222222");
return;
}
return;
}
throw new NullPointerException("Context 不能为null");
}
}
private void a(Configuration configuration, List<Callable<Configuration>> list) {
if (!TextUtils.isEmpty(configuration.a) && !TextUtils.isEmpty(configuration.b)) {
list.add(new VideoCompressTask(this.d, configuration, this));
return;
}
OnCompressListener onCompressListener = this.e;
if (onCompressListener != null) {
configuration.d = Configuration.CompressState.FAIL;
configuration.e = "视频输入或者输出路径错误/为空";
onCompressListener.onFail(true);
}
}
public void a() {
ExecutorService executorService = this.b;
if (executorService != null && !executorService.isShutdown()) {
this.b.shutdownNow();
}
ExecutorService executorService2 = this.a;
if (executorService2 != null && !executorService2.isShutdown()) {
this.a.shutdownNow();
}
this.f = false;
this.b = null;
this.a = null;
}
}