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 ()
0 commit comments