8000 Merge pull request #725 from brussee/ffmpeg-recipe · Eternonq/python-for-android@1830608 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1830608

Browse files
committed
Merge pull request kivy#725 from brussee/ffmpeg-recipe
added ffmpeg recipe
2 parents abad0e4 + 0c9829e commit 1830608

File tree

2 files changed

+62
-0
lines changed

2 files changed

+62
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
from pythonforandroid.toolchain import Recipe, shprint, shutil, current_directory
2+
from os.path import join, exists
3+
import sh
4+
5+
"""
6+
FFmpeg for Android compiled with x264, libass, fontconfig, freetype, fribidi and lame (Supports Android 4.1+)
7+
8+
http://writingminds.github.io/ffmpeg-android/
9+
"""
10+
class FFMpegRecipe(Recipe):
11+
12+
version = 'master'
13+
url = 'git+https://github.com/WritingMinds/ffmpeg-android.git'
14+
patches = ['settings.patch']
15+
16+
17+
def should_build(self, arch):
18+
return not exists(self.get_build_bin(arch))
19+
20+
21+
def build_arch(self, arch):
22+
super(FFMpegRecipe, self).build_arch(arch)
23+
env = self.get_recipe_env(arch)
24+
build_dir = self.get_build_dir(arch.arch)
25+
with current_directory(build_dir):
26+
bash = sh.Command('bash')
27+
shprint(bash, 'init_update_libs.sh')
28+
shprint(bash, 'android_build.sh', _env=env)
29+
30+
31+
def get_build_bin(self, arch):
32+
build_dir = self.get_build_dir(arch.arch)
33+
return join(build_dir, 'build', arch.arch, 'bin', 'ffmpeg')
34+
35+
36+
def get_recipe_env(self, arch):
37+
env = super(FFMpegRecipe, self).get_recipe_env(arch)
38+
env['ANDROID_NDK'] = self.ctx.ndk_dir
39+
env['ANDROID_API'] = str(self.ctx.android_api)
40+
return env
41+
42+
43+
recipe = FFMpegRecipe()
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
--- ffmpeg/settings.sh 2016-04-27 18:50:16.294291099 +0200
2+
+++ ffmpeg-patch/settings.sh 2016-04-27 18:55:07.085398617 +0200
3+
@@ -1,13 +1,13 @@
4+
#!/bin/bash
5+
6+
-SUPPORTED_ARCHITECTURES=(armeabi-v7a armeabi-v7a-neon x86)
7+
+SUPPORTED_ARCHITECTURES=(${ARCH})
8+
ANDROID_NDK_ROOT_PATH=${ANDROID_NDK}
9+
if [[ -z "$ANDROID_NDK_ROOT_PATH" ]]; then
10+
echo "You need to set ANDROID_NDK environment variable, please check instructions"
11+
exit
12+
fi
13+
-ANDROID_API_VERSION=9
14+
-NDK_TOOLCHAIN_ABI_VERSION=4.8
15+
+ANDROID_API_VERSION=${ANDROID_API}
16+
+NDK_TOOLCHAIN_ABI_VERSION=${TOOLCHAIN_VERSION}
17+
18+
NUMBER_OF_CORES=$(nproc)
19+
HOST_UNAME=$(uname -m)

0 commit comments

Comments
 (0)
0