Skip to content

Commit

Permalink
Disable libfdk_aac when building Android
Browse files Browse the repository at this point in the history
Signed-off-by: Uilian Ries <uilianries@gmail.com>
  • Loading branch information
uilianries committed Aug 7, 2024
1 parent 235e7c4 commit 8234aba
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions recipes/ffmpeg/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,12 +262,16 @@ def config_options(self):
del self.options.with_mediacodec
if not self._version_supports_libsvtav1:
self.options.rm_safe("with_libsvtav1")
if self.settings.os == "Android":
del self.options.with_libfdk_aac

def configure(self):
if self.options.shared:
self.options.rm_safe("fPIC")
self.settings.rm_safe("compiler.cppstd")
self.settings.rm_safe("compiler.libcxx")
if self.settings.os == "Android" and self.options.shared and self.options.with_libvpx:
self.options["libvpx"].shared = False

def layout(self):
basic_layout(self, src_folder="src")
Expand All @@ -286,7 +290,7 @@ def requirements(self):
if self.options.with_openjpeg:
self.requires("openjpeg/2.5.2")
if self.options.with_openh264:
self.requires("openh264/2.3.1")
self.requires("openh264/2.4.1")
if self.options.with_vorbis:
self.requires("vorbis/1.3.7")
if self.options.with_opus:
Expand All @@ -296,14 +300,14 @@ def requirements(self):
if self.options.with_sdl:
self.requires("sdl/2.28.5")
if self.options.with_libx264:
self.requires("libx264/cci.20220602")
self.requires("libx264/cci.20240224")
if self.options.with_libx265:
self.requires("libx265/3.4")
if self.options.with_libvpx:
self.requires("libvpx/1.13.1")
self.requires("libvpx/1.14.0")
if self.options.with_libmp3lame:
self.requires("libmp3lame/3.100")
if self.options.with_libfdk_aac:
if self.options.get_safe("with_libfdk_aac"):
self.requires("libfdk_aac/2.0.3")
if self.options.with_libwebp:
self.requires("libwebp/1.3.2")
Expand All @@ -322,11 +326,11 @@ def requirements(self):
if self.options.get_safe("with_vulkan"):
self.requires("vulkan-loader/1.3.243.0")
if self.options.get_safe("with_libsvtav1"):
self.requires("libsvtav1/1.6.0")
self.requires("libsvtav1/2.1.0")
if self.options.with_libaom:
self.requires("libaom-av1/3.6.1")
if self.options.get_safe("with_libdav1d"):
self.requires("dav1d/1.2.1")
self.requires("dav1d/1.4.3")

def validate(self):
if self.options.with_ssl == "securetransport" and not is_apple_os(self):
Expand Down Expand Up @@ -354,6 +358,10 @@ def validate(self):
# May be related https://github.com/ffvvc/FFmpeg/issues/234
raise ConanInvalidConfiguration(f"{self.ref} Conan recipe does not support build_type=Debug. Contributions are welcome to fix this issue.")

if self.settings.os == "Android" and self.options.shared and self.dependencies["libvpx"].options.shared:
# https://github.com/conan-io/conan-center-index/pull/24861
raise ConanInvalidConfiguration(f"{self.ref} shared build with libvpx:shared=True is not supported on Android. Use -o 'libvpx/*:shared=False'")

def build_requirements(self):
if self.settings.arch in ("x86", "x86_64"):
if Version(self.version) >= "7.0":
Expand Down Expand Up @@ -496,7 +504,7 @@ def opt_append_disable_if_set(args, what, v):
opt_enable_disable("libx265", self.options.with_libx265),
opt_enable_disable("libvpx", self.options.with_libvpx),
opt_enable_disable("libmp3lame", self.options.with_libmp3lame),
opt_enable_disable("libfdk-aac", self.options.with_libfdk_aac),
opt_enable_disable("libfdk-aac", self.options.get_safe("with_libfdk_aac")),
opt_enable_disable("libwebp", self.options.with_libwebp),
opt_enable_disable("libaom", self.options.with_libaom),
opt_enable_disable("openssl", self.options.with_ssl == "openssl"),
Expand All @@ -521,7 +529,7 @@ def opt_append_disable_if_set(args, what, v):
"--disable-cuda", # FIXME: CUDA support
"--disable-cuvid", # FIXME: CUVID support
# Licenses
opt_enable_disable("nonfree", self.options.with_libfdk_aac or (self.options.with_ssl and (
opt_enable_disable("nonfree", self.options.get_safe("with_libfdk_aac") or (self.options.with_ssl and (
self.options.with_libx264 or self.options.with_libx265 or self.options.postproc))),
opt_enable_disable("gpl", self.options.with_libx264 or self.options.with_libx265 or self.options.postproc)
]
Expand Down Expand Up @@ -841,6 +849,8 @@ def _add_component(name, dependencies):
avdevice.frameworks.append("AVFoundation")
if self.options.get_safe("with_audiotoolbox"):
avdevice.frameworks.append("CoreAudio")
if self.settings.os == "Android" and not self.options.shared:
avdevice.system_libs.extend(["android", "camera2ndk", "mediandk"])

if self.options.avcodec:
if self.options.with_zlib:
Expand All @@ -865,7 +875,7 @@ def _add_component(name, dependencies):
avcodec.requires.append("libvpx::libvpx")
if self.options.with_libmp3lame:
avcodec.requires.append("libmp3lame::libmp3lame")
if self.options.with_libfdk_aac:
if self.options.get_safe("with_libfdk_aac"):
avcodec.requires.append("libfdk_aac::libfdk_aac")
if self.options.with_libwebp:
avcodec.requires.append("libwebp::libwebp")
Expand Down

0 comments on commit 8234aba

Please sign in to comment.