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

Update ffpyplayer recipe and it's dependencies #1134

Merged
merged 2 commits into from
Nov 12, 2017
Merged
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
41 changes: 18 additions & 23 deletions pythonforandroid/recipes/ffmpeg/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@
import os
import shutil

# TODO
# Recipe doesn't work with NDK r15c+ yet,
# see: https://github.com/android-ndk/ndk/issues/477


class FFMpegRecipe(Recipe):
version = '3.1.8' # 3.2+ works with bugs
version = '3.3.3'
url = 'http://ffmpeg.org/releases/ffmpeg-{version}.tar.bz2'
md5sum = 'f25a0cdd7f731cfbd8c0f7842b0d15b9'
depends = ['sdl2'] # Need this to build correct recipe order
opts_depends = ['openssl', 'ffpyplayer_codecs']
patches = ['patches/fix-libshine-configure.patch']
Expand All @@ -22,7 +25,7 @@ def should_build(self, arch):
def prebuild_arch(self, arch):
self.apply_patches(arch)

def get_recipe_env(self,arch):
def get_recipe_env(self, arch):
env = super(FFMpegRecipe, self).get_recipe_env(arch)
env['NDK'] = self.ctx.ndk_dir
return env
Expand Down Expand Up @@ -69,16 +72,10 @@ def build_arch(self, arch):
else:
# Enable codecs only for .mp4:
flags += [
'--enable-parser=h264,aac',
'--enable-decoder=h263,h264,aac',
]

# disable some unused algo
# note: "golomb" are the one used in our video test, so don't use --disable-golomb
# note: and for aac decoding: "rdft", "mdct", and "fft" are needed
flags += [
'--disable-dxva2 --disable-vdpau --disable-vaapi',
'--disable-dct',
'--enable-parser=aac,ac3,h261,h264,mpegaudio,mpeg4video,mpegvideo,vc1',
'--enable-decoder=aac,h264,mpeg4,mpegvideo',
'--enable-muxer=h264,mov,mp4,mpeg2video',
'--enable-demuxer=aac,h264,m4v,mov,mpegvideo,vc1',
]

# needed to prevent _ffmpeg.so: version node not found for symbol av_init_packet@LIBAVFORMAT_52
Expand All @@ -89,10 +86,10 @@ def build_arch(self, arch):

# disable binaries / doc
flags += [
'--disable-ffmpeg',
'--disable-ffplay',
'--disable-ffprobe',
'--disable-ffserver',
'--disable-ffmpeg',
'--disable-ffplay',
'--disable-ffprobe',
'--disable-ffserver',
'--disable-doc',
]

Expand All @@ -104,7 +101,7 @@ def build_arch(self, arch):
'--enable-hwaccels',
'--enable-gpl',
'--enable-pic',
'--disable-static',
'--disable-static',
'--enable-shared',
]

Expand All @@ -117,13 +114,11 @@ def build_arch(self, arch):
'--enable-neon',
'--prefix={}'.format(realpath('.')),
]
cflags = [
'-march=armv7-a',
cflags += [
'-mfpu=vfpv3-d16',
'-mfloat-abi=softfp',
'-fPIC',
'-DANDROID',
] + cflags
'-fPIC',
]

env['CFLAGS'] += ' ' + ' '.join(cflags)
env['LDFLAGS'] += ' ' + ' '.join(ldflags)
Expand Down
11 changes: 7 additions & 4 deletions pythonforandroid/recipes/ffpyplayer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,22 @@
class FFPyPlayerRecipe(CythonRecipe):
version = 'master'
url = 'https://github.com/matham/ffpyplayer/archive/{version}.zip'
depends = ['python2', 'sdl2', 'ffmpeg']
depends = [('python2', 'python3crystax'), 'sdl2', 'ffmpeg']
opt_depends = ['openssl', 'ffpyplayer_codecs']

def get_recipe_env(self, arch, with_flags_in_cc=True):
env = super(FFPyPlayerRecipe, self).get_recipe_env(arch)

env["SDL_INCLUDE_DIR"] = join(self.ctx.bootstrap.build_dir, 'jni', 'SDL', 'include')
env["SDL_LIB_DIR"] = join(self.ctx.bootstrap.build_dir, 'libs', arch.arch)

build_dir = Recipe.get_recipe('ffmpeg', self.ctx).get_build_dir(arch.arch)
env["FFMPEG_INCLUDE_DIR"] = join(build_dir, "include")
env["FFMPEG_LIB_DIR"] = join(build_dir, "lib")

env["SDL_INCLUDE_DIR"] = join(self.ctx.bootstrap.build_dir, 'jni', 'SDL', 'include')
env["SDL_LIB_DIR"] = join(self.ctx.bootstrap.build_dir, 'libs', arch.arch)

env["USE_SDL2_MIXER"] = '1'
env["SDL2_MIXER_INCLUDE_DIR"] = join(self.ctx.bootstrap.build_dir, 'jni', 'SDL2_mixer')

return env

recipe = FFPyPlayerRecipe()
3 changes: 1 addition & 2 deletions pythonforandroid/recipes/libshine/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@


class LibShineRecipe(Recipe):
version = '20aee967f67abefd065c196eec7ce21adbbe1549'
version = 'c72aba9031bde18a0995e7c01c9b53f2e08a0e46'
url = 'https://github.com/toots/shine/archive/{version}.zip'
md5sum = 'bbf1f657e6adccb5e79f59da9ecfac2d'

def should_build(self, arch):
build_dir = self.get_build_dir(arch.arch)
Expand Down
3 changes: 1 addition & 2 deletions pythonforandroid/recipes/libx264/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@


class LibX264Recipe(Recipe):
version = 'x264-snapshot-20170608-2245-stable' # using mirror url since can't use ftp
version = 'x264-snapshot-20170826-2245-stable' # using mirror url since can't use ftp
url = 'http://mirror.yandex.ru/mirrors/ftp.videolan.org/x264/snapshots/{version}.tar.bz2'
md5sum = 'adf3b87f759b5cc9f100f8cf99276f77'

def should_build(self, arch):
build_dir = self.get_build_dir(arch.arch)
Expand Down