Skip to content

ffmpeg and ffpyplayer improvements #2335

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

Merged
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
10 changes: 8 additions & 2 deletions pythonforandroid/recipes/ffmpeg/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


class FFMpegRecipe(Recipe):
version = '007e03348dbd8d3de3eb09022d72c734a8608144'
version = 'n4.3.1'
# Moved to github.com instead of ffmpeg.org to improve download speed
url = 'https://github.com/FFmpeg/FFmpeg/archive/{version}.zip'
depends = ['sdl2'] # Need this to build correct recipe order
Expand Down Expand Up @@ -44,6 +44,9 @@ def build_arch(self, arch):
ldflags += ['-L' + build_dir]

if 'ffpyplayer_codecs' in self.ctx.recipe_build_order:
# Enable GPL
flags += ['--enable-gpl']

# libx264
flags += ['--enable-libx264']
build_dir = Recipe.get_recipe(
Expand Down Expand Up @@ -93,7 +96,6 @@ def build_arch(self, arch):
'--enable-protocol=file,http,hls',
'--enable-small',
'--enable-hwaccels',
'--enable-gpl',
'--enable-pic',
'--disable-static',
'--disable-debug',
Expand All @@ -103,6 +105,10 @@ def build_arch(self, arch):
if 'arm64' in arch.arch:
cross_prefix = 'aarch64-linux-android-'
arch_flag = 'aarch64'
elif 'x86' in arch.arch:
cross_prefix = 'i686-linux-android-'
arch_flag = 'x86'
flags += ['--disable-asm']
else:
cross_prefix = 'arm-linux-androideabi-'
arch_flag = 'arm'
Expand Down
17 changes: 4 additions & 13 deletions pythonforandroid/recipes/ffmpeg/patches/configure.patch
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
--- ./configure 2019-07-21 18:36:31.000000000 +0200
+++ ./configure_new 2019-10-04 12:43:41.798448200 +0200
@@ -6222,7 +6222,7 @@
--- ./configure 2020-10-11 19:12:16.759760904 +0200
+++ ./configure.patch 2020-10-11 19:15:49.059533563 +0200
@@ -6361,7 +6361,7 @@
enabled librsvg && require_pkg_config librsvg librsvg-2.0 librsvg-2.0/librsvg/rsvg.h rsvg_handle_render_cairo
enabled librtmp && require_pkg_config librtmp librtmp librtmp/rtmp.h RTMP_Socket
enabled librubberband && require_pkg_config librubberband "rubberband >= 1.8.1" rubberband/rubberband-c.h rubberband_new -lstdc++ && append librubberband_extralibs "-lstdc++"
-enabled libshine && require_pkg_config libshine shine shine/layer3.h shine_encode_buffer
+enabled libshine && require "shine" shine/layer3.h shine_encode_buffer -lshine -lm
enabled libsmbclient && { check_pkg_config libsmbclient smbclient libsmbclient.h smbc_init ||
require libsmbclient libsmbclient.h smbc_init -lsmbclient; }
enabled libsnappy && require libsnappy snappy-c.h snappy_compress -lsnappy -lstdc++
@@ -6322,7 +6322,7 @@
die "ERROR: OpenMAX IL headers not found"; } && enable omx
enabled openssl && { check_pkg_config openssl openssl openssl/ssl.h OPENSSL_init_ssl ||
check_pkg_config openssl openssl openssl/ssl.h SSL_library_init ||
- check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto ||
+ check_lib openssl openssl/ssl.h OPENSSL_init_ssl -lssl -lcrypto ||
check_lib openssl openssl/ssl.h SSL_library_init -lssl32 -leay32 ||
check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||
die "ERROR: openssl not found"; }
enabled libsnappy && require libsnappy snappy-c.h snappy_compress -lsnappy -lstdc++
7 changes: 6 additions & 1 deletion pythonforandroid/recipes/ffpyplayer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


class FFPyPlayerRecipe(CythonRecipe):
version = 'c99913f2317bf3840eeacf1c1c3db3b3d1f78007'
version = 'v4.3.2'
url = 'https://github.com/matham/ffpyplayer/archive/{version}.zip'
depends = ['python3', 'sdl2', 'ffmpeg']
opt_depends = ['openssl', 'ffpyplayer_codecs']
Expand All @@ -22,6 +22,11 @@ def get_recipe_env(self, arch, with_flags_in_cc=True):
env["USE_SDL2_MIXER"] = '1'
env["SDL2_MIXER_INCLUDE_DIR"] = join(self.ctx.bootstrap.build_dir, 'jni', 'SDL2_mixer')

# ffmpeg recipe enables GPL components only if ffpyplayer_codecs recipe used.
# Therefor we need to disable libpostproc if skipped.
if 'ffpyplayer_codecs' not in self.ctx.recipe_build_order:
env["CONFIG_POSTPROC"] = '0'

return env


Expand Down