Skip to content

Commit 0113d97

Browse files
committed
Fix for Android 10
1 parent 6fd8356 commit 0113d97

34 files changed

+25
-36
lines changed
17.6 MB
Binary file not shown.
File renamed without changes.

FFmpegAndroid/src/androidTest/java/com/github/hiteshsondhi88/libffmpeg/CommonInstrumentationTestCase.java

100644100755
File mode changed.

FFmpegAndroid/src/androidTest/java/com/github/hiteshsondhi88/libffmpeg/CommonTestCase.java

100644100755
File mode changed.

FFmpegAndroid/src/androidTest/java/com/github/hiteshsondhi88/libffmpeg/CpuArchHelperTest.java

100644100755
File mode changed.

FFmpegAndroid/src/androidTest/java/com/github/hiteshsondhi88/libffmpeg/CpuArchTest.java

100644100755
File mode changed.

FFmpegAndroid/src/androidTest/java/com/github/hiteshsondhi88/libffmpeg/LogTest.java

100644100755
File mode changed.

FFmpegAndroid/src/androidTest/java/com/github/hiteshsondhi88/libffmpeg/ShellCommandTest.java

100644100755
File mode changed.

FFmpegAndroid/src/androidTest/java/com/github/hiteshsondhi88/libffmpeg/UtilTest.java

100644100755
File mode changed.

FFmpegAndroid/src/androidTest/java/com/github/hiteshsondhi88/libffmpeg/utils/AssertionHelper.java

100644100755
File mode changed.

FFmpegAndroid/src/androidTest/java/com/github/hiteshsondhi88/libffmpeg/utils/StubInputStream.java

100644100755
File mode changed.

FFmpegAndroid/src/androidTest/java/com/github/hiteshsondhi88/libffmpeg/utils/StubOutputStream.java

100644100755
File mode changed.

FFmpegAndroid/src/main/AndroidManifest.xml

100644100755
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1-
<manifest package="com.github.hiteshsondhi88.libffmpeg">
1+
<manifest xmlns:tools="http://schemas.android.com/tools"
2+
package="com.github.hiteshsondhi88.libffmpeg"
3+
xmlns:android="http://schemas.android.com/apk/res/android">
24

3-
<application />
5+
<application
6+
android:extractNativeLibs = "true"
7+
tools:targetApi="m" />
48

59
</manifest>

FFmpegAndroid/src/main/java/com/github/hiteshsondhi88/libffmpeg/CommandResult.java

100644100755
File mode changed.

FFmpegAndroid/src/main/java/com/github/hiteshsondhi88/libffmpeg/CpuArch.java

100644100755
File mode changed.

FFmpegAndroid/src/main/java/com/github/hiteshsondhi88/libffmpeg/CpuArchHelper.java

100644100755
File mode changed.

FFmpegAndroid/src/main/java/com/github/hiteshsondhi88/libffmpeg/ExecuteBinaryResponseHandler.java

100644100755
File mode changed.

FFmpegAndroid/src/main/java/com/github/hiteshsondhi88/libffmpeg/FFmpeg.java

100644100755
File mode changed.

FFmpegAndroid/src/main/java/com/github/hiteshsondhi88/libffmpeg/FFmpegExecuteAsyncTask.java

100644100755
File mode changed.

FFmpegAndroid/src/main/java/com/github/hiteshsondhi88/libffmpeg/FFmpegExecuteResponseHandler.java

100644100755
File mode changed.

FFmpegAndroid/src/main/java/com/github/hiteshsondhi88/libffmpeg/FFmpegInterface.java

100644100755
File mode changed.

FFmpegAndroid/src/main/java/com/github/hiteshsondhi88/libffmpeg/FFmpegLoadBinaryResponseHandler.java

100644100755
File mode changed.

FFmpegAndroid/src/main/java/com/github/hiteshsondhi88/libffmpeg/FFmpegLoadLibraryAsyncTask.java

100644100755
Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,9 @@ class FFmpegLoadLibraryAsyncTask extends AsyncTask<Void, Void, Boolean> {
2020
@Override
2121
protected Boolean doInBackground(Void... params) {
2222
File ffmpegFile = new File(FileUtils.getFFmpeg(context));
23-
if (ffmpegFile.exists() && isDeviceFFmpegVersionOld() && !ffmpegFile.delete()) {
24-
return false;
25-
}
26-
if (!ffmpegFile.exists()) {
27-
boolean isFileCopied = FileUtils.copyBinaryFromAssetsToData(context,
28-
cpuArchNameFromAssets + File.separator + FileUtils.ffmpegFileName,
29-
FileUtils.ffmpegFileName);
30-
31-
// make file executable
32-
if (isFileCopied) {
33-
if(!ffmpegFile.canExecute()) {
34-
Log.d("FFmpeg is not executable, trying to make it executable ...");
35-
if (ffmpegFile.setExecutable(true)) {
36-
return true;
37-
}
38-
} else {
39-
Log.d("FFmpeg is executable");
40-
return true;
41-
}
42-
}
43-
}
23+
24+
25+
4426
return ffmpegFile.exists() && ffmpegFile.canExecute();
4527
}
4628

@@ -57,7 +39,4 @@ protected void onPostExecute(Boolean isSuccess) {
5739
}
5840
}
5941

60-
private boolean isDeviceFFmpegVersionOld() {
61-
return CpuArch.fromString(FileUtils.SHA1(FileUtils.getFFmpeg(context))).equals(CpuArch.NONE);
62-
}
6342
}

FFmpegAndroid/src/main/java/com/github/hiteshsondhi88/libffmpeg/FileUtils.java

100644100755
Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@
1515

1616
class FileUtils {
1717

18-
static final String ffmpegFileName = "ffmpeg";
18+
static final String ffmpegFileName = "libffmpeg.so";
1919
private static final int DEFAULT_BUFFER_SIZE = 1024 * 4;
2020
private static final int EOF = -1;
2121

22+
/*
2223
static boolean copyBinaryFromAssetsToData(Context context, String fileNameFromAssets, String outputFileName) {
2324
2425
// create files directory under /data/data/package name
@@ -45,14 +46,19 @@ static boolean copyBinaryFromAssetsToData(Context context, String fileNameFromAs
4546
}
4647
return false;
4748
}
48-
49-
static File getFilesDirectory(Context context) {
50-
// creates files directory under data/data/package name
51-
return context.getFilesDir();
52-
}
49+
*/
5350

5451
static String getFFmpeg(Context context) {
55-
return getFilesDirectory(context).getAbsolutePath() + File.separator + FileUtils.ffmpegFileName;
52+
53+
String archFolder = "";
54+
55+
if (CpuArchHelper.getCpuArch() == CpuArch.x86){
56+
archFolder = "x86";
57+
} else if (CpuArchHelper.getCpuArch() == CpuArch.ARMv7){
58+
archFolder = "arm";
59+
}
60+
61+
return context.getPackageResourcePath().replaceAll("/([^/]+)$", "/lib/") + archFolder + "/" + ffmpegFileName;
5662
}
5763

5864
static String getFFmpeg(Context context, Map<String,String> environmentVars) {

FFmpegAndroid/src/main/java/com/github/hiteshsondhi88/libffmpeg/LoadBinaryResponseHandler.java

100644100755
File mode changed.

FFmpegAndroid/src/main/java/com/github/hiteshsondhi88/libffmpeg/Log.java

100644100755
File mode changed.

FFmpegAndroid/src/main/java/com/github/hiteshsondhi88/libffmpeg/ResponseHandler.java

100644100755
File mode changed.

FFmpegAndroid/src/main/java/com/github/hiteshsondhi88/libffmpeg/ShellCommand.java

100644100755
File mode changed.

FFmpegAndroid/src/main/java/com/github/hiteshsondhi88/libffmpeg/Util.java

100644100755
File mode changed.

FFmpegAndroid/src/main/java/com/github/hiteshsondhi88/libffmpeg/exceptions/FFmpegCommandAlreadyRunningException.java

100644100755
File mode changed.

FFmpegAndroid/src/main/java/com/github/hiteshsondhi88/libffmpeg/exceptions/FFmpegNotSupportedException.java

100644100755
File mode changed.

FFmpegAndroid/src/main/res/values/strings.xml

100644100755
File mode changed.

build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ allprojects {
2121
}
2222

2323
ext {
24-
compileSdkVersion = 22
25-
buildToolsVersion = '22.0.1'
26-
targetSdkVersion = 22
24+
compileSdkVersion = 26
25+
buildToolsVersion = '26.0.3'
26+
targetSdkVersion = 26
2727
minSdkVersion = 16
2828
versionCode = 28
2929
versionName = "0.3.2"

0 commit comments

Comments
 (0)