Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Android 10 #361

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
Binary file added FFmpegAndroid/libs/armeabi/libffmpeg.so
Binary file not shown.
File renamed without changes.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
8 changes: 6 additions & 2 deletions FFmpegAndroid/src/main/AndroidManifest.xml
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<manifest package="com.github.hiteshsondhi88.libffmpeg">
<manifest xmlns:tools="http://schemas.android.com/tools"
package="com.github.hiteshsondhi88.libffmpeg"
xmlns:android="http://schemas.android.com/apk/res/android">

<application />
<application
android:extractNativeLibs = "true"
tools:targetApi="m" />

</manifest>
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
27 changes: 3 additions & 24 deletions ...Android/src/main/java/com/github/hiteshsondhi88/libffmpeg/FFmpegLoadLibraryAsyncTask.java
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,9 @@ class FFmpegLoadLibraryAsyncTask extends AsyncTask<Void, Void, Boolean> {
@Override
protected Boolean doInBackground(Void... params) {
File ffmpegFile = new File(FileUtils.getFFmpeg(context));
if (ffmpegFile.exists() && isDeviceFFmpegVersionOld() && !ffmpegFile.delete()) {
return false;
}
if (!ffmpegFile.exists()) {
boolean isFileCopied = FileUtils.copyBinaryFromAssetsToData(context,
cpuArchNameFromAssets + File.separator + FileUtils.ffmpegFileName,
FileUtils.ffmpegFileName);

// make file executable
if (isFileCopied) {
if(!ffmpegFile.canExecute()) {
Log.d("FFmpeg is not executable, trying to make it executable ...");
if (ffmpegFile.setExecutable(true)) {
return true;
}
} else {
Log.d("FFmpeg is executable");
return true;
}
}
}



return ffmpegFile.exists() && ffmpegFile.canExecute();
}

Expand All @@ -57,7 +39,4 @@ protected void onPostExecute(Boolean isSuccess) {
}
}

private boolean isDeviceFFmpegVersionOld() {
return CpuArch.fromString(FileUtils.SHA1(FileUtils.getFFmpeg(context))).equals(CpuArch.NONE);
}
}
20 changes: 13 additions & 7 deletions FFmpegAndroid/src/main/java/com/github/hiteshsondhi88/libffmpeg/FileUtils.java
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@

class FileUtils {

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

/*
static boolean copyBinaryFromAssetsToData(Context context, String fileNameFromAssets, String outputFileName) {

// create files directory under /data/data/package name
Expand All @@ -45,14 +46,19 @@ static boolean copyBinaryFromAssetsToData(Context context, String fileNameFromAs
}
return false;
}

static File getFilesDirectory(Context context) {
// creates files directory under data/data/package name
return context.getFilesDir();
}
*/

static String getFFmpeg(Context context) {
return getFilesDirectory(context).getAbsolutePath() + File.separator + FileUtils.ffmpegFileName;

String archFolder = "";

if (CpuArchHelper.getCpuArch() == CpuArch.x86){
archFolder = "x86";
} else if (CpuArchHelper.getCpuArch() == CpuArch.ARMv7){
archFolder = "arm";
}

return context.getPackageResourcePath().replaceAll("/([^/]+)$", "/lib/") + archFolder + "/" + ffmpegFileName;
}

static String getFFmpeg(Context context, Map<String,String> environmentVars) {
Expand Down
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file modified FFmpegAndroid/src/main/res/values/strings.xml
100644 → 100755
Empty file.
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ allprojects {
}

ext {
compileSdkVersion = 22
buildToolsVersion = '22.0.1'
targetSdkVersion = 22
compileSdkVersion = 26
buildToolsVersion = '26.0.3'
targetSdkVersion = 26
minSdkVersion = 16
versionCode = 28
versionName = "0.3.2"
Expand Down