Here's my attempt to do just that. :-)  

 
Compiled fine with:
 

 
configuration: --prefix=/data/data/com.termux/files/usr/local 
--enable-indev=alsa --enable-indev=xcbgrab --enable-libfreetype 
--enable-libfontconfig --cc=clang --cxx=clang++ --disable-libxcb-shm 
--enable-vulkan --enable-opencl --enable-opengl --enable-libass 
--enable-libopus --enable-libfribidi --enable-librsvg --disable-stripping 
--enable-logging --enable-debug --logfile=/dev/tty --enable-nonfree 
--enable-jni --enable-gpl --enable-version3 --host-os=android 
--target-os=android --enable-mediacodec
 
From 44d7cfe5d10b367b289549d90fabb3b985acb128 Mon Sep 17 00:00:00 2001
From: Fredrick Brennan <copypa...@kittens.ph>
Date: Fri, 24 Feb 2023 09:51:16 -0500
Subject: [PATCH] Prevent collisions between Android's asm-generic/termbits.h
 and ffmpeg

---
 libavcodec/aaccoder.c |  5 +++++
 libavcodec/faandct.c  | 15 +++++++++++++++
 libavcodec/hevcdec.h  |  9 +++++++++
 libavcodec/opus_pvq.h |  4 ++++
 4 files changed, 33 insertions(+)

diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c
index 6291c16123..de51fa80fb 100644
--- a/libavcodec/aaccoder.c
+++ b/libavcodec/aaccoder.c
@@ -52,6 +52,11 @@
 
 #include "libavcodec/aaccoder_twoloop.h"
 
+#ifdef __ANDROID__
+#undef B0
+#undef B1
+#endif
+
 /* Parameter of f(x) = a*(lambda/100), defines the maximum fourier spread
  * beyond which no PNS is used (since the SFBs contain tone rather than noise) */
 #define NOISE_SPREAD_THRESHOLD 0.9f
diff --git a/libavcodec/faandct.c b/libavcodec/faandct.c
index 38c392bbae..923fa9beda 100644
--- a/libavcodec/faandct.c
+++ b/libavcodec/faandct.c
@@ -37,6 +37,21 @@ for this approach). Unfortunately, long double is not always available correctly
 e.g ppc has issues.
 TODO: add L suffixes when ppc and toolchains sort out their stuff.
 */
+#ifdef __ANDROID__
+#undef B0
+#undef B1
+#undef B2
+#undef B3
+#undef B4
+#undef B5
+#undef B6
+#undef B7
+#undef A1
+#undef A2
+#undef A3
+#undef A4
+#undef A5
+#endif
 #define B0 1.000000000000000000000000000000000000
 #define B1 0.720959822006947913789091890943021267 // (cos(pi*1/16)sqrt(2))^-1
 #define B2 0.765366864730179543456919968060797734 // (cos(pi*2/16)sqrt(2))^-1
diff --git a/libavcodec/hevcdec.h b/libavcodec/hevcdec.h
index 9d3f4adbb3..4b500350c0 100644
--- a/libavcodec/hevcdec.h
+++ b/libavcodec/hevcdec.h
@@ -57,6 +57,15 @@
 #define L0 0
 #define L1 1
 
+#ifdef __ANDROID__
+#undef A0
+#undef A1
+#undef A2
+#undef B0
+#undef B1
+#undef B2
+#endif
+
 #define EPEL_EXTRA_BEFORE 1
 #define EPEL_EXTRA_AFTER  2
 #define EPEL_EXTRA        3
diff --git a/libavcodec/opus_pvq.h b/libavcodec/opus_pvq.h
index b71bc49034..91c59f2812 100644
--- a/libavcodec/opus_pvq.h
+++ b/libavcodec/opus_pvq.h
@@ -27,6 +27,10 @@
 
 #include "opus_celt.h"
 
+#ifdef __ANDROID__
+#undef B0
+#endif
+
 #define QUANT_FN(name) uint32_t (name)(struct CeltPVQ *pvq, CeltFrame *f,            \
                                        OpusRangeCoder *rc, const int band, float *X, \
                                        float *Y, int N, int b, uint32_t blocks,      \
-- 
2.39.2

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to