-
Notifications
You must be signed in to change notification settings - Fork 831
/
Copy pathFFmpegLoadLibraryAsyncTask.java
executable file
·42 lines (31 loc) · 1.3 KB
/
FFmpegLoadLibraryAsyncTask.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package com.github.hiteshsondhi88.libffmpeg;
import android.content.Context;
import android.os.AsyncTask;
import java.io.File;
class FFmpegLoadLibraryAsyncTask extends AsyncTask<Void, Void, Boolean> {
private final String cpuArchNameFromAssets;
private final FFmpegLoadBinaryResponseHandler ffmpegLoadBinaryResponseHandler;
private final Context context;
FFmpegLoadLibraryAsyncTask(Context context, String cpuArchNameFromAssets, FFmpegLoadBinaryResponseHandler ffmpegLoadBinaryResponseHandler) {
this.context = context;
this.cpuArchNameFromAssets = cpuArchNameFromAssets;
this.ffmpegLoadBinaryResponseHandler = ffmpegLoadBinaryResponseHandler;
}
@Override
protected Boolean doInBackground(Void... params) {
File ffmpegFile = new File(FileUtils.getFFmpeg(context));
return ffmpegFile.exists() && ffmpegFile.canExecute();
}
@Override
protected void onPostExecute(Boolean isSuccess) {
super.onPostExecute(isSuccess);
if (ffmpegLoadBinaryResponseHandler != null) {
if (isSuccess) {
ffmpegLoadBinaryResponseHandler.onSuccess();
} else {
ffmpegLoadBinaryResponseHandler.onFailure();
}
ffmpegLoadBinaryResponseHandler.onFinish();
}
}
}