Skip to content

Commit

Permalink
Merge pull request #3065 from DexerBR/bump_recipe_versions
Browse files Browse the repository at this point in the history
Bump `FFMpegRecipe` and `PyAVRecipe` versions
  • Loading branch information
AndreMiras authored Oct 17, 2024
2 parents 2a4dd96 + c4b3314 commit 9bfa3eb
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 13 deletions.
3 changes: 2 additions & 1 deletion pythonforandroid/recipes/av/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
class PyAVRecipe(CythonRecipe):

name = "av"
version = "10.0.0"
version = "13.1.0"
url = "https://github.com/PyAV-Org/PyAV/archive/v{version}.zip"

depends = ["python3", "cython", "ffmpeg", "av_codecs"]
opt_depends = ["openssl"]
patches = ['patches/compilation_syntax_errors.patch']

def get_recipe_env(self, arch, with_flags_in_cc=True):
env = super().get_recipe_env(arch)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
diff --git a/av/container/streams.pyx b/av/container/streams.pyx
index 17e4992..502ac5a 100644
--- a/av/container/streams.pyx
+++ b/av/container/streams.pyx
@@ -144,7 +144,7 @@ cdef class StreamContainer:

return stream_index

- def best(self, str type, /, Stream related = None):
+ def best(self, str type, Stream related=None):
"""best(type: Literal["video", "audio", "subtitle", "attachment", "data"], /, related: Stream | None)
Finds the "best" stream in the file. Wraps :ffmpeg:`av_find_best_stream`. Example::

diff --git a/av/filter/context.pyx b/av/filter/context.pyx
index b820d3d..8908b56 100644
--- a/av/filter/context.pyx
+++ b/av/filter/context.pyx
@@ -77,7 +77,8 @@ cdef class FilterContext:

@property
def graph(self):
- if (graph := self._graph()):
+ graph = self._graph()
+ if graph:
return graph
else:
raise RuntimeError("graph is unallocated")
15 changes: 8 additions & 7 deletions pythonforandroid/recipes/ffmpeg/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,17 @@


class FFMpegRecipe(Recipe):
version = 'n4.3.1'
version = 'n6.1.2'
# 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
opts_depends = ['openssl', 'ffpyplayer_codecs']
opts_depends = ['openssl', 'ffpyplayer_codecs', 'av_codecs']
patches = ['patches/configure.patch']

def should_build(self, arch):
build_dir = self.get_build_dir(arch.arch)
return not exists(join(build_dir, 'lib', 'libavcodec.so'))

def prebuild_arch(self, arch):
self.apply_patches(arch)

def get_recipe_env(self, arch):
env = super().get_recipe_env(arch)
env['NDK'] = self.ctx.ndk_dir
Expand All @@ -43,7 +40,9 @@ def build_arch(self, arch):
'-DOPENSSL_API_COMPAT=0x10002000L']
ldflags += ['-L' + build_dir]

if 'ffpyplayer_codecs' in self.ctx.recipe_build_order:
codecs_opts = {"ffpyplayer_codecs", "av_codecs"}
if codecs_opts.intersection(self.ctx.recipe_build_order):

# Enable GPL
flags += ['--enable-gpl']

Expand All @@ -52,7 +51,9 @@ def build_arch(self, arch):
build_dir = Recipe.get_recipe(
'libx264', self.ctx).get_build_dir(arch.arch)
cflags += ['-I' + build_dir + '/include/']
ldflags += ['-lx264', '-L' + build_dir + '/lib/']
# Newer versions of FFmpeg prioritize the dynamic library and ignore
# the static one, unless the static library path is explicitly set.
ldflags += [build_dir + '/lib/' + 'libx264.a']

# libshine
flags += ['--enable-libshine']
Expand Down
21 changes: 16 additions & 5 deletions pythonforandroid/recipes/ffmpeg/patches/configure.patch
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
--- ./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
diff --git a/configure b/configure
index 5af693c954..d1d0a4f0a2 100755
--- a/configure
+++ b/configure
@@ -6800,7 +6800,7 @@ enabled librsvg && require_pkg_config librsvg librsvg-2.0 librsvg-2.0/
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 libshaderc && require_pkg_config spirv_compiler "shaderc >= 2019.1" shaderc/shaderc.h shaderc_compiler_initialize
-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++
enabled libsnappy && require libsnappy snappy-c.h snappy_compress -lsnappy -lstdc++
@@ -6850,7 +6850,7 @@ enabled libvpx && {
enabled libwebp && {
enabled libwebp_encoder && require_pkg_config libwebp "libwebp >= 0.2.0" webp/encode.h WebPGetEncoderVersion
enabled libwebp_anim_encoder && check_pkg_config libwebp_anim_encoder "libwebpmux >= 0.4.0" webp/mux.h WebPAnimEncoderOptionsInit; }
-enabled libx264 && require_pkg_config libx264 x264 "stdint.h x264.h" x264_encoder_encode &&
+enabled libx264 && require "x264" "stdint.h x264.h" x264_encoder_encode &&
require_cpp_condition libx264 x264.h "X264_BUILD >= 122" && {
[ "$toolchain" != "msvc" ] ||
require_cpp_condition libx264 x264.h "X264_BUILD >= 158"; } &&

0 comments on commit 9bfa3eb

Please sign in to comment.