Skip to content

Commit 81db8a6

Browse files
Merge pull request #57 from Shahar2k5/master
Add support for 64bit devices
2 parents 3ed9b5c + 64f7314 commit 81db8a6

File tree

2 files changed

+22
-9
lines changed

2 files changed

+22
-9
lines changed

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,18 @@
77
import static org.assertj.core.api.Assertions.assertThat;
88

99
public class CpuArchHelperTest extends TestCase {
10-
10+
1111
public void testGetCpuArch() throws Exception {
1212
CpuArch cpuArch = CpuArchHelper.getCpuArch();
1313
assertNotNull(cpuArch);
14-
if (Build.CPU_ABI.equals(CpuArchHelper.getx86CpuAbi())) {
14+
if (Build.CPU_ABI.equals(CpuArchHelper.getx86CpuAbi()) || Build.CPU_ABI.equals(CpuArchHelper.getx86_64CpuAbi())) {
1515
assertEquals(cpuArch, CpuArch.x86);
1616
} else if (Build.CPU_ABI.equals(CpuArchHelper.getArmeabiv7CpuAbi())) {
1717
assertThat(cpuArch == CpuArch.ARMv7 || cpuArch == CpuArch.ARMv7_NEON).isTrue();
18-
} else {
18+
} else if (Build.CPU_ABI.equals(CpuArchHelper.getArm64CpuAbi())) {
19+
assertEquals(cpuArch, CpuArch.ARMv7);
20+
}else {
1921
assertEquals(cpuArch, CpuArch.NONE);
2022
}
2123
}
22-
2324
}

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

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
import android.os.Build;
44

55
class CpuArchHelper {
6-
6+
77
static CpuArch getCpuArch() {
8-
// check if device is x86
9-
if (Build.CPU_ABI.equals(getx86CpuAbi())) {
8+
Log.d("Build.CPU_ABI : " + Build.CPU_ABI);
9+
// check if device is x86 or x86_64
10+
if (Build.CPU_ABI.equals(getx86CpuAbi()) || Build.CPU_ABI.equals(getx86_64CpuAbi())) {
1011
return CpuArch.x86;
1112
} else {
1213
// check if device is armeabi
@@ -21,15 +22,26 @@ static CpuArch getCpuArch() {
2122
}
2223
return CpuArch.ARMv7;
2324
}
25+
// check if device is arm64 which is supported by ARMV7
26+
} else if (Build.CPU_ABI.equals(getArm64CpuAbi())) {
27+
return CpuArch.ARMv7;
2428
}
2529
}
2630
return CpuArch.NONE;
2731
}
28-
32+
2933
static String getx86CpuAbi() {
3034
return "x86";
3135
}
32-
36+
37+
static String getx86_64CpuAbi() {
38+
return "x86_64";
39+
}
40+
41+
static String getArm64CpuAbi() {
42+
return "arm64-v8a";
43+
}
44+
3345
static String getArmeabiv7CpuAbi() {
3446
return "armeabi-v7a";
3547
}

0 commit comments

Comments
 (0)