support android ndk 26.x, fixes #850 #909 #937

development
Taner Sener 1 year ago
parent c6e08c09ac
commit 154ef20443
  1. 4
      .github/workflows/android-build-scripts.yml
  2. 2
      .github/workflows/periodic-builds-android.yml
  3. 2
      android/ffmpeg-kit-android-lib/src/main/cpp/ffmpegkit.c
  4. 2
      android/ffmpeg-kit-android-lib/src/main/cpp/fftools_ffmpeg_demux.c
  5. 6
      android/ffmpeg-kit-android-lib/src/main/cpp/fftools_ffmpeg_mux_init.c
  6. 2
      apple/src/fftools_ffmpeg_demux.c
  7. 6
      apple/src/fftools_ffmpeg_mux_init.c
  8. 2
      linux/src/fftools_ffmpeg_demux.c
  9. 6
      linux/src/fftools_ffmpeg_mux_init.c
  10. 4
      scripts/android/ffmpeg.sh
  11. 31
      scripts/function-android.sh

@ -30,7 +30,7 @@ jobs:
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
strategy: strategy:
matrix: matrix:
ndk-version: [ 'r22b-linux-x86_64', 'r23b-linux', 'r24-linux', 'r25b-linux' ] ndk-version: [ 'r22b-linux-x86_64', 'r23b-linux', 'r24-linux', 'r25c-linux', 'r26d-linux' ]
defaults: defaults:
run: run:
shell: bash shell: bash
@ -92,7 +92,7 @@ jobs:
runs-on: macos-12 runs-on: macos-12
strategy: strategy:
matrix: matrix:
ndk-version: [ 'r22b-darwin-x86_64', 'r23b-darwin', 'r24-darwin', 'r25b-darwin' ] ndk-version: [ 'r22b-darwin-x86_64', 'r23b-darwin', 'r24-darwin', 'r25c-darwin', 'r26d-darwin' ]
defaults: defaults:
run: run:
shell: bash shell: bash

@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
strategy: strategy:
matrix: matrix:
ndk-version: [ 'r22b-linux-x86_64', 'r23b-linux', 'r24-linux', 'r25b-linux' ] ndk-version: [ 'r22b-linux-x86_64', 'r23b-linux', 'r24-linux', 'r25c-linux', 'r26d-linux' ]
branches: [ 'main', 'development' ] branches: [ 'main', 'development' ]
defaults: defaults:
run: run:

@ -723,8 +723,10 @@ jint JNI_OnLoad(JavaVM *vm, void *reserved) {
redirectionEnabled = 0; redirectionEnabled = 0;
#ifdef _USES_FFMPEG_KIT_PROTOCOLS
av_set_saf_open(saf_open); av_set_saf_open(saf_open);
av_set_saf_close(saf_close); av_set_saf_close(saf_close);
#endif
enableNativeRedirection(); enableNativeRedirection();

@ -987,7 +987,9 @@ int ifile_open(const OptionsContext *o, const char *filename)
if (scan_all_pmts_set) if (scan_all_pmts_set)
av_dict_set(&o->g->format_opts, "scan_all_pmts", NULL, AV_DICT_MATCH_CASE); av_dict_set(&o->g->format_opts, "scan_all_pmts", NULL, AV_DICT_MATCH_CASE);
remove_avoptions(&o->g->format_opts, o->g->codec_opts); remove_avoptions(&o->g->format_opts, o->g->codec_opts);
#ifndef _USES_FFMPEG_KIT_PROTOCOLS
assert_avoptions(o->g->format_opts); assert_avoptions(o->g->format_opts);
#endif
/* apply forced codec ids */ /* apply forced codec ids */
for (i = 0; i < ic->nb_streams; i++) for (i = 0; i < ic->nb_streams; i++)

@ -284,9 +284,9 @@ static int enc_stats_init(OutputStream *ost, EncStats *es, int pre,
static const struct { static const struct {
enum EncStatsType type; enum EncStatsType type;
const char *str; const char *str;
int pre_only:1; unsigned pre_only:1;
int post_only:1; unsigned post_only:1;
int need_input_data:1; unsigned need_input_data:1;
} fmt_specs[] = { } fmt_specs[] = {
{ ENC_STATS_FILE_IDX, "fidx" }, { ENC_STATS_FILE_IDX, "fidx" },
{ ENC_STATS_STREAM_IDX, "sidx" }, { ENC_STATS_STREAM_IDX, "sidx" },

@ -987,7 +987,9 @@ int ifile_open(const OptionsContext *o, const char *filename)
if (scan_all_pmts_set) if (scan_all_pmts_set)
av_dict_set(&o->g->format_opts, "scan_all_pmts", NULL, AV_DICT_MATCH_CASE); av_dict_set(&o->g->format_opts, "scan_all_pmts", NULL, AV_DICT_MATCH_CASE);
remove_avoptions(&o->g->format_opts, o->g->codec_opts); remove_avoptions(&o->g->format_opts, o->g->codec_opts);
#ifndef _USES_FFMPEG_KIT_PROTOCOLS
assert_avoptions(o->g->format_opts); assert_avoptions(o->g->format_opts);
#endif
/* apply forced codec ids */ /* apply forced codec ids */
for (i = 0; i < ic->nb_streams; i++) for (i = 0; i < ic->nb_streams; i++)

@ -284,9 +284,9 @@ static int enc_stats_init(OutputStream *ost, EncStats *es, int pre,
static const struct { static const struct {
enum EncStatsType type; enum EncStatsType type;
const char *str; const char *str;
int pre_only:1; unsigned pre_only:1;
int post_only:1; unsigned post_only:1;
int need_input_data:1; unsigned need_input_data:1;
} fmt_specs[] = { } fmt_specs[] = {
{ ENC_STATS_FILE_IDX, "fidx" }, { ENC_STATS_FILE_IDX, "fidx" },
{ ENC_STATS_STREAM_IDX, "sidx" }, { ENC_STATS_STREAM_IDX, "sidx" },

@ -987,7 +987,9 @@ int ifile_open(const OptionsContext *o, const char *filename)
if (scan_all_pmts_set) if (scan_all_pmts_set)
av_dict_set(&o->g->format_opts, "scan_all_pmts", NULL, AV_DICT_MATCH_CASE); av_dict_set(&o->g->format_opts, "scan_all_pmts", NULL, AV_DICT_MATCH_CASE);
remove_avoptions(&o->g->format_opts, o->g->codec_opts); remove_avoptions(&o->g->format_opts, o->g->codec_opts);
#ifndef _USES_FFMPEG_KIT_PROTOCOLS
assert_avoptions(o->g->format_opts); assert_avoptions(o->g->format_opts);
#endif
/* apply forced codec ids */ /* apply forced codec ids */
for (i = 0; i < ic->nb_streams; i++) for (i = 0; i < ic->nb_streams; i++)

@ -284,9 +284,9 @@ static int enc_stats_init(OutputStream *ost, EncStats *es, int pre,
static const struct { static const struct {
enum EncStatsType type; enum EncStatsType type;
const char *str; const char *str;
int pre_only:1; unsigned pre_only:1;
int post_only:1; unsigned post_only:1;
int need_input_data:1; unsigned need_input_data:1;
} fmt_specs[] = { } fmt_specs[] = {
{ ENC_STATS_FILE_IDX, "fidx" }, { ENC_STATS_FILE_IDX, "fidx" },
{ ENC_STATS_STREAM_IDX, "sidx" }, { ENC_STATS_STREAM_IDX, "sidx" },

@ -390,8 +390,6 @@ ulimit -n 2048 1>>"${BASEDIR}"/build.log 2>&1
########################### CUSTOMIZATIONS ####################### ########################### CUSTOMIZATIONS #######################
cd "${BASEDIR}" 1>>"${BASEDIR}"/build.log 2>&1 || return 1 cd "${BASEDIR}" 1>>"${BASEDIR}"/build.log 2>&1 || return 1
git checkout android/ffmpeg-kit-android-lib/src/main/cpp/fftools_ffmpeg_demux.c 1>>"${BASEDIR}"/build.log 2>&1
git checkout android/ffmpeg-kit-android-lib/src/main/cpp/ffmpegkit.c 1>>"${BASEDIR}"/build.log 2>&1
cd "${BASEDIR}"/src/"${LIB_NAME}" 1>>"${BASEDIR}"/build.log 2>&1 || return 1 cd "${BASEDIR}"/src/"${LIB_NAME}" 1>>"${BASEDIR}"/build.log 2>&1 || return 1
git checkout libavformat/file.c 1>>"${BASEDIR}"/build.log 2>&1 git checkout libavformat/file.c 1>>"${BASEDIR}"/build.log 2>&1
git checkout libavformat/hls.c 1>>"${BASEDIR}"/build.log 2>&1 git checkout libavformat/hls.c 1>>"${BASEDIR}"/build.log 2>&1
@ -403,7 +401,6 @@ ${SED_INLINE} 's/static int av_log_level/__thread int av_log_level/g' "${BASEDIR
# 2. Enable ffmpeg-kit protocols # 2. Enable ffmpeg-kit protocols
if [[ ${NO_FFMPEG_KIT_PROTOCOLS} == "1" ]]; then if [[ ${NO_FFMPEG_KIT_PROTOCOLS} == "1" ]]; then
${SED_INLINE} "s| av_set_saf|//av_set_saf|g" "${BASEDIR}"/android/ffmpeg-kit-android-lib/src/main/cpp/ffmpegkit.c 1>>"${BASEDIR}"/build.log 2>&1
echo -e "\nINFO: Disabled custom ffmpeg-kit protocols\n" 1>>"${BASEDIR}"/build.log 2>&1 echo -e "\nINFO: Disabled custom ffmpeg-kit protocols\n" 1>>"${BASEDIR}"/build.log 2>&1
else else
cat ../../tools/protocols/libavformat_file.c >> libavformat/file.c cat ../../tools/protocols/libavformat_file.c >> libavformat/file.c
@ -412,7 +409,6 @@ else
awk '{gsub(/ff_file_protocol;/,"ff_file_protocol;\nextern const URLProtocol ff_saf_protocol;")}1' libavformat/protocols.c > libavformat/protocols.c.tmp awk '{gsub(/ff_file_protocol;/,"ff_file_protocol;\nextern const URLProtocol ff_saf_protocol;")}1' libavformat/protocols.c > libavformat/protocols.c.tmp
cat libavformat/protocols.c.tmp > libavformat/protocols.c cat libavformat/protocols.c.tmp > libavformat/protocols.c
${SED_INLINE} "s|av_strstart(proto_name, \"file\", NULL))|av_strstart(proto_name, \"file\", NULL) \|\| av_strstart(proto_name, \"saf\", NULL))|g" libavformat/hls.c 1>>"${BASEDIR}"/build.log 2>&1 ${SED_INLINE} "s|av_strstart(proto_name, \"file\", NULL))|av_strstart(proto_name, \"file\", NULL) \|\| av_strstart(proto_name, \"saf\", NULL))|g" libavformat/hls.c 1>>"${BASEDIR}"/build.log 2>&1
${SED_INLINE} "s| assert_avoptions|//assert_avoptions|g" "${BASEDIR}"/android/ffmpeg-kit-android-lib/src/main/cpp/fftools_ffmpeg_demux.c 1>>"${BASEDIR}"/build.log 2>&1
echo -e "\nINFO: Enabled custom ffmpeg-kit protocols\n" 1>>"${BASEDIR}"/build.log 2>&1 echo -e "\nINFO: Enabled custom ffmpeg-kit protocols\n" 1>>"${BASEDIR}"/build.log 2>&1
fi fi

@ -77,6 +77,9 @@ build_application_mk() {
fi fi
local BUILD_DATE="-DFFMPEG_KIT_BUILD_DATE=$(date +%Y%m%d 2>>"${BASEDIR}"/build.log)" local BUILD_DATE="-DFFMPEG_KIT_BUILD_DATE=$(date +%Y%m%d 2>>"${BASEDIR}"/build.log)"
if [[ -z ${NO_FFMPEG_KIT_PROTOCOLS} ]]; then
local USES_FFMPEG_KIT_PROTOCOLS="-D_USES_FFMPEG_KIT_PROTOCOLS"
fi
rm -f "${BASEDIR}/android/jni/Application.mk" rm -f "${BASEDIR}/android/jni/Application.mk"
@ -87,9 +90,11 @@ APP_ABI := ${ANDROID_ARCHITECTURES}
APP_STL := ${APP_STL} APP_STL := ${APP_STL}
APP_ALLOW_MISSING_DEPS := true
APP_PLATFORM := android-${API} APP_PLATFORM := android-${API}
APP_CFLAGS := -O3 -DANDROID ${LTS_BUILD_FLAG}${BUILD_DATE} -Wall -Wno-deprecated-declarations -Wno-pointer-sign -Wno-switch -Wno-unused-result -Wno-unused-variable APP_CFLAGS := -O3 -DANDROID ${LTS_BUILD_FLAG}${BUILD_DATE} -Wall -Wno-deprecated-declarations -Wno-pointer-sign -Wno-switch -Wno-unused-result -Wno-unused-variable ${USES_FFMPEG_KIT_PROTOCOLS}
APP_LDFLAGS := -Wl,--hash-style=both APP_LDFLAGS := -Wl,--hash-style=both
EOF EOF
@ -219,7 +224,7 @@ get_android_arch() {
} }
get_common_includes() { get_common_includes() {
echo "" echo "-I${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/sysroot/usr/include"
} }
get_common_cflags() { get_common_cflags() {
@ -311,9 +316,6 @@ get_size_optimization_cflags() {
get_app_specific_cflags() { get_app_specific_cflags() {
local APP_FLAGS="" local APP_FLAGS=""
case $1 in case $1 in
xvidcore)
APP_FLAGS=""
;;
ffmpeg) ffmpeg)
APP_FLAGS="-Wno-unused-function -DBIONIC_IOCTL_NO_SIGNEDNESS_OVERLOAD" APP_FLAGS="-Wno-unused-function -DBIONIC_IOCTL_NO_SIGNEDNESS_OVERLOAD"
;; ;;
@ -323,18 +325,30 @@ get_app_specific_cflags() {
kvazaar) kvazaar)
APP_FLAGS="-std=gnu99 -Wno-unused-function" APP_FLAGS="-std=gnu99 -Wno-unused-function"
;; ;;
libaom)
APP_FLAGS="-std=gnu99 -Wno-unused-function -Wno-implicit-function-declaration"
;;
libuuid)
APP_FLAGS="-std=gnu99 -Wno-unused-function -DHAVE_SYS_FILE_H=1"
;;
libvpx | openssl | shine | srt)
APP_FLAGS="-Wno-unused-function"
;;
openh264) openh264)
APP_FLAGS="-std=gnu99 -Wno-unused-function -fstack-protector-all" APP_FLAGS="-std=gnu99 -Wno-unused-function -fstack-protector-all"
;; ;;
rubberband) rubberband)
APP_FLAGS="-std=c99 -Wno-unused-function" APP_FLAGS="-std=c99 -Wno-unused-function"
;; ;;
libvpx | openssl | shine | srt) sdl)
APP_FLAGS="-Wno-unused-function" APP_FLAGS="-std=c99 -Wno-unused-function -Wno-incompatible-function-pointer-types"
;; ;;
soxr | snappy | libwebp) soxr | snappy | libwebp)
APP_FLAGS="-std=gnu99 -Wno-unused-function -DPIC" APP_FLAGS="-std=gnu99 -Wno-unused-function -DPIC"
;; ;;
xvidcore)
APP_FLAGS=""
;;
*) *)
APP_FLAGS="-std=c99 -Wno-unused-function" APP_FLAGS="-std=c99 -Wno-unused-function"
;; ;;
@ -352,6 +366,7 @@ get_cflags() {
else else
local OPTIMIZATION_FLAGS="${FFMPEG_KIT_DEBUG}" local OPTIMIZATION_FLAGS="${FFMPEG_KIT_DEBUG}"
fi fi
local COMMON_INCLUDES=$(get_common_includes) local COMMON_INCLUDES=$(get_common_includes)
echo "${ARCH_FLAGS} ${APP_FLAGS} ${COMMON_FLAGS} ${OPTIMIZATION_FLAGS} ${COMMON_INCLUDES}" echo "${ARCH_FLAGS} ${APP_FLAGS} ${COMMON_FLAGS} ${OPTIMIZATION_FLAGS} ${COMMON_INCLUDES}"
@ -397,7 +412,7 @@ get_cxxflags() {
} }
get_common_linked_libraries() { get_common_linked_libraries() {
local COMMON_LIBRARY_PATHS="-L${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/${HOST}/lib -L${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/sysroot/usr/lib/${HOST}/${API} -L${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/lib" local COMMON_LIBRARY_PATHS="-L${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/${HOST}/lib -L${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/sysroot/usr/lib/${HOST}/${API}"
case $1 in case $1 in
ffmpeg) ffmpeg)

Loading…
Cancel
Save