From 64f7314a99267eec2acbedbdfb128d197e4c8f7c Mon Sep 17 00:00:00 2001 From: Shahar Barsheshet Date: Tue, 8 Dec 2015 16:00:30 +0200 Subject: [PATCH] Add support for 64bit devices * x86_64 is supported by x86 * arm64-v8a is supported by armeabi-v7a --- .../libffmpeg/CpuArchHelperTest.java | 9 ++++---- .../libffmpeg/CpuArchHelper.java | 22 ++++++++++++++----- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/FFmpegAndroid/src/androidTest/java/com/github/hiteshsondhi88/libffmpeg/CpuArchHelperTest.java b/FFmpegAndroid/src/androidTest/java/com/github/hiteshsondhi88/libffmpeg/CpuArchHelperTest.java index cc587a8..5a19b61 100644 --- a/FFmpegAndroid/src/androidTest/java/com/github/hiteshsondhi88/libffmpeg/CpuArchHelperTest.java +++ b/FFmpegAndroid/src/androidTest/java/com/github/hiteshsondhi88/libffmpeg/CpuArchHelperTest.java @@ -7,17 +7,18 @@ import static org.assertj.core.api.Assertions.assertThat; public class CpuArchHelperTest extends TestCase { - + public void testGetCpuArch() throws Exception { CpuArch cpuArch = CpuArchHelper.getCpuArch(); assertNotNull(cpuArch); - if (Build.CPU_ABI.equals(CpuArchHelper.getx86CpuAbi())) { + if (Build.CPU_ABI.equals(CpuArchHelper.getx86CpuAbi()) || Build.CPU_ABI.equals(CpuArchHelper.getx86_64CpuAbi())) { assertEquals(cpuArch, CpuArch.x86); } else if (Build.CPU_ABI.equals(CpuArchHelper.getArmeabiv7CpuAbi())) { assertThat(cpuArch == CpuArch.ARMv7 || cpuArch == CpuArch.ARMv7_NEON).isTrue(); - } else { + } else if (Build.CPU_ABI.equals(CpuArchHelper.getArm64CpuAbi())) { + assertEquals(cpuArch, CpuArch.ARMv7); + }else { assertEquals(cpuArch, CpuArch.NONE); } } - } \ No newline at end of file diff --git a/FFmpegAndroid/src/main/java/com/github/hiteshsondhi88/libffmpeg/CpuArchHelper.java b/FFmpegAndroid/src/main/java/com/github/hiteshsondhi88/libffmpeg/CpuArchHelper.java index 069e8a9..ad5c6cb 100644 --- a/FFmpegAndroid/src/main/java/com/github/hiteshsondhi88/libffmpeg/CpuArchHelper.java +++ b/FFmpegAndroid/src/main/java/com/github/hiteshsondhi88/libffmpeg/CpuArchHelper.java @@ -3,10 +3,11 @@ import android.os.Build; class CpuArchHelper { - + static CpuArch getCpuArch() { - // check if device is x86 - if (Build.CPU_ABI.equals(getx86CpuAbi())) { + Log.d("Build.CPU_ABI : " + Build.CPU_ABI); + // check if device is x86 or x86_64 + if (Build.CPU_ABI.equals(getx86CpuAbi()) || Build.CPU_ABI.equals(getx86_64CpuAbi())) { return CpuArch.x86; } else { // check if device is armeabi @@ -21,15 +22,26 @@ static CpuArch getCpuArch() { } return CpuArch.ARMv7; } + // check if device is arm64 which is supported by ARMV7 + } else if (Build.CPU_ABI.equals(getArm64CpuAbi())) { + return CpuArch.ARMv7; } } return CpuArch.NONE; } - + static String getx86CpuAbi() { return "x86"; } - + + static String getx86_64CpuAbi() { + return "x86_64"; + } + + static String getArm64CpuAbi() { + return "arm64-v8a"; + } + static String getArmeabiv7CpuAbi() { return "armeabi-v7a"; }