From bd51c93a691c15b7c86cd73027e8a25f5edc0821 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Fri, 21 Mar 2025 09:58:00 +0800 Subject: [PATCH 001/359] rollback ffmpeg to n6.1.1 --- configs/libs/ffmpeg.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configs/libs/ffmpeg.sh b/configs/libs/ffmpeg.sh index bc883d81d..151e43e86 100644 --- a/configs/libs/ffmpeg.sh +++ b/configs/libs/ffmpeg.sh @@ -35,8 +35,8 @@ if [[ "$GIT_FFMPEG_COMMIT" != "" ]] ;then export GIT_COMMIT="$GIT_FFMPEG_COMMIT" export GIT_REPO_VERSION="$GIT_FFMPEG_COMMIT" else - export GIT_COMMIT=n6.1.2 #origin/release/5.1 - export GIT_REPO_VERSION=6.1.2 + export GIT_COMMIT=n6.1.1 #origin/release/5.1 + export GIT_REPO_VERSION=6.1.1 fi # pre compiled From 1846e83e9b889c40b587ce325f8cce8dc4e20fb4 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Fri, 21 Mar 2025 18:11:10 +0800 Subject: [PATCH 002/359] format patch name --- patches/bluray/0002-add-bd_open_fs-function.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patches/bluray/0002-add-bd_open_fs-function.patch b/patches/bluray/0002-add-bd_open_fs-function.patch index feab0bcc5..19c04e18b 100644 --- a/patches/bluray/0002-add-bd_open_fs-function.patch +++ b/patches/bluray/0002-add-bd_open_fs-function.patch @@ -1,7 +1,7 @@ From 9e37c2db7c233b4696437a8921125920d4e7594c Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Fri, 11 Oct 2024 11:48:11 +0800 -Subject: [PATCH] add bd_open_fs function +Subject: [PATCH 2] add bd_open_fs function --- Makefile.am | 1 + From bb34854d89f579101e8d1c953dab03cfb5f94414 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Fri, 21 Mar 2025 18:29:53 +0800 Subject: [PATCH 003/359] bluray protocol add dvd fallback --- ...transfer-get-wrong-size-cause-av_re.patch} | 2 +- ...-only-available-on-iOS-13.0-or-newe.patch} | 2 +- ...-built-in-smb2-protocol-via-libsmb2.patch} | 2 +- ...-http_seek-redirect-authentication-.patch} | 2 +- ...-16.patch => 0021-Adapt-to-clang-16.patch} | 2 +- ...-00-00-bug-baidu-neddisk-hls-start_.patch} | 2 +- .../0022-support-probe-bluray-video.patch | 104 ------------------ ...-http-add-reconnect_first_delay-opt.patch} | 2 +- ...r-and-Demuxer-but-av3a-Decoder-is-a.patch} | 2 +- ...add-4-dummy-ijkplaceholder-demuxers.patch} | 2 +- ...tp-protocols-and-use-selected_http-.patch} | 2 +- ...s-for-network-Blu-ray-Disc-and-BDMV.patch} | 0 ...028-bluray-protocol-add-dvd-fallback.patch | 54 +++++++++ ...ind-the-right-m2ts-then-read-seek-i.patch} | 0 14 files changed, 64 insertions(+), 114 deletions(-) rename patches/ffmpeg-n6.1/{0018-fix-http-chunked-transfer-get-wrong-size-cause-av_re.patch => 0017-fix-http-chunked-transfer-get-wrong-size-cause-av_re.patch} (93%) rename patches/ffmpeg-n6.1/{0019-supportsFamily-is-only-available-on-iOS-13.0-or-newe.patch => 0018-supportsFamily-is-only-available-on-iOS-13.0-or-newe.patch} (94%) rename patches/ffmpeg-n6.1/{0020-add-built-in-smb2-protocol-via-libsmb2.patch => 0019-add-built-in-smb2-protocol-via-libsmb2.patch} (99%) rename patches/ffmpeg-n6.1/{0023-fix-http-open-and-http_seek-redirect-authentication-.patch => 0020-fix-http-open-and-http_seek-redirect-authentication-.patch} (98%) rename patches/ffmpeg-n6.1/{0024-Adapt-to-clang-16.patch => 0021-Adapt-to-clang-16.patch} (97%) rename patches/ffmpeg-n6.1/{0025-fix-can-t-seek-to-00-00-bug-baidu-neddisk-hls-start_.patch => 0022-fix-can-t-seek-to-00-00-bug-baidu-neddisk-hls-start_.patch} (92%) delete mode 100644 patches/ffmpeg-n6.1/0022-support-probe-bluray-video.patch rename patches/ffmpeg-n6.1/{0026-http-add-reconnect_first_delay-opt.patch => 0023-http-add-reconnect_first_delay-opt.patch} (97%) rename patches/ffmpeg-n6.1/{0027-Audio-Vivid-Parser-and-Demuxer-but-av3a-Decoder-is-a.patch => 0024-Audio-Vivid-Parser-and-Demuxer-but-av3a-Decoder-is-a.patch} (99%) rename patches/ffmpeg-n6.1/{0028-add-4-dummy-ijkplaceholder-demuxers.patch => 0025-add-4-dummy-ijkplaceholder-demuxers.patch} (95%) rename patches/ffmpeg-n6.1/{0029-add-3-dummy-ijkhttp-protocols-and-use-selected_http-.patch => 0026-add-3-dummy-ijkhttp-protocols-and-use-selected_http-.patch} (99%) rename patches/ffmpeg-n6.1/{0021-custom-bluray-fs-for-network-Blu-ray-Disc-and-BDMV.patch => 0027-custom-bluray-fs-for-network-Blu-ray-Disc-and-BDMV.patch} (100%) create mode 100644 patches/ffmpeg-n6.1/0028-bluray-protocol-add-dvd-fallback.patch rename patches/ffmpeg-n6.1/{0017-bluray-open-and-find-the-right-m2ts-then-read-seek-i.patch => 0029-bluray-open-and-find-the-right-m2ts-then-read-seek-i.patch} (100%) diff --git a/patches/ffmpeg-n6.1/0018-fix-http-chunked-transfer-get-wrong-size-cause-av_re.patch b/patches/ffmpeg-n6.1/0017-fix-http-chunked-transfer-get-wrong-size-cause-av_re.patch similarity index 93% rename from patches/ffmpeg-n6.1/0018-fix-http-chunked-transfer-get-wrong-size-cause-av_re.patch rename to patches/ffmpeg-n6.1/0017-fix-http-chunked-transfer-get-wrong-size-cause-av_re.patch index 381916567..bff847552 100644 --- a/patches/ffmpeg-n6.1/0018-fix-http-chunked-transfer-get-wrong-size-cause-av_re.patch +++ b/patches/ffmpeg-n6.1/0017-fix-http-chunked-transfer-get-wrong-size-cause-av_re.patch @@ -1,7 +1,7 @@ From 2155673117b3d8377311b59a33b1afeae511554b Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Thu, 27 Jun 2024 18:31:15 +0800 -Subject: [PATCH 18] fix http chunked transfer get wrong size cause av_read_frame +Subject: [PATCH 17] fix http chunked transfer get wrong size cause av_read_frame can not return eof bug --- diff --git a/patches/ffmpeg-n6.1/0019-supportsFamily-is-only-available-on-iOS-13.0-or-newe.patch b/patches/ffmpeg-n6.1/0018-supportsFamily-is-only-available-on-iOS-13.0-or-newe.patch similarity index 94% rename from patches/ffmpeg-n6.1/0019-supportsFamily-is-only-available-on-iOS-13.0-or-newe.patch rename to patches/ffmpeg-n6.1/0018-supportsFamily-is-only-available-on-iOS-13.0-or-newe.patch index 905b7462a..1e5a4a6c8 100644 --- a/patches/ffmpeg-n6.1/0019-supportsFamily-is-only-available-on-iOS-13.0-or-newe.patch +++ b/patches/ffmpeg-n6.1/0018-supportsFamily-is-only-available-on-iOS-13.0-or-newe.patch @@ -1,7 +1,7 @@ From 1ebd4c062a886049f3c3255c50fe56f6621b9844 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Fri, 26 Jul 2024 16:11:14 +0800 -Subject: [PATCH 19] 'supportsFamily:' is only available on iOS 13.0 or newer +Subject: [PATCH 18] 'supportsFamily:' is only available on iOS 13.0 or newer --- libavfilter/metal/utils.m | 2 +- diff --git a/patches/ffmpeg-n6.1/0020-add-built-in-smb2-protocol-via-libsmb2.patch b/patches/ffmpeg-n6.1/0019-add-built-in-smb2-protocol-via-libsmb2.patch similarity index 99% rename from patches/ffmpeg-n6.1/0020-add-built-in-smb2-protocol-via-libsmb2.patch rename to patches/ffmpeg-n6.1/0019-add-built-in-smb2-protocol-via-libsmb2.patch index 348b2fc08..006417084 100644 --- a/patches/ffmpeg-n6.1/0020-add-built-in-smb2-protocol-via-libsmb2.patch +++ b/patches/ffmpeg-n6.1/0019-add-built-in-smb2-protocol-via-libsmb2.patch @@ -1,7 +1,7 @@ From 229f417012635accc6506d0c179343654b984f38 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Thu, 27 Feb 2025 14:49:42 +0800 -Subject: [PATCH 20] add built-in smb2 protocol via libsmb2 +Subject: [PATCH 19] add built-in smb2 protocol via libsmb2 --- configure | 5 + diff --git a/patches/ffmpeg-n6.1/0023-fix-http-open-and-http_seek-redirect-authentication-.patch b/patches/ffmpeg-n6.1/0020-fix-http-open-and-http_seek-redirect-authentication-.patch similarity index 98% rename from patches/ffmpeg-n6.1/0023-fix-http-open-and-http_seek-redirect-authentication-.patch rename to patches/ffmpeg-n6.1/0020-fix-http-open-and-http_seek-redirect-authentication-.patch index 1a90a7c35..d1ea452cb 100644 --- a/patches/ffmpeg-n6.1/0023-fix-http-open-and-http_seek-redirect-authentication-.patch +++ b/patches/ffmpeg-n6.1/0020-fix-http-open-and-http_seek-redirect-authentication-.patch @@ -1,7 +1,7 @@ From 29b3f4f302406cc546d87e5e8d26a20417bfcb63 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Tue, 12 Nov 2024 16:00:23 +0800 -Subject: [PATCH 23] fix http open and http_seek (redirect) authentication bug +Subject: [PATCH 20] fix http open and http_seek (redirect) authentication bug --- libavformat/http.c | 25 ++++++++++++++++++++++++- diff --git a/patches/ffmpeg-n6.1/0024-Adapt-to-clang-16.patch b/patches/ffmpeg-n6.1/0021-Adapt-to-clang-16.patch similarity index 97% rename from patches/ffmpeg-n6.1/0024-Adapt-to-clang-16.patch rename to patches/ffmpeg-n6.1/0021-Adapt-to-clang-16.patch index 56bd49bc7..a1c792743 100644 --- a/patches/ffmpeg-n6.1/0024-Adapt-to-clang-16.patch +++ b/patches/ffmpeg-n6.1/0021-Adapt-to-clang-16.patch @@ -1,7 +1,7 @@ From 338d6fb305a992bc2a24347e4d7793e02b54345d Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Thu, 31 Oct 2024 10:55:33 +0800 -Subject: [PATCH 24] Adapt to clang 16 +Subject: [PATCH 21] Adapt to clang 16 --- configure | 8 +++++++- diff --git a/patches/ffmpeg-n6.1/0025-fix-can-t-seek-to-00-00-bug-baidu-neddisk-hls-start_.patch b/patches/ffmpeg-n6.1/0022-fix-can-t-seek-to-00-00-bug-baidu-neddisk-hls-start_.patch similarity index 92% rename from patches/ffmpeg-n6.1/0025-fix-can-t-seek-to-00-00-bug-baidu-neddisk-hls-start_.patch rename to patches/ffmpeg-n6.1/0022-fix-can-t-seek-to-00-00-bug-baidu-neddisk-hls-start_.patch index 641d9e7e5..ec79fad6b 100644 --- a/patches/ffmpeg-n6.1/0025-fix-can-t-seek-to-00-00-bug-baidu-neddisk-hls-start_.patch +++ b/patches/ffmpeg-n6.1/0022-fix-can-t-seek-to-00-00-bug-baidu-neddisk-hls-start_.patch @@ -1,7 +1,7 @@ From 411a7fc1b4be73f655ca2881cc8e16a862bfe194 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Fri, 1 Nov 2024 16:56:53 +0800 -Subject: [PATCH 25] fix can't seek to 00:00 bug, baidu neddisk hls start_time is +Subject: [PATCH 22] fix can't seek to 00:00 bug, baidu neddisk hls start_time is less than first_timestamp --- diff --git a/patches/ffmpeg-n6.1/0022-support-probe-bluray-video.patch b/patches/ffmpeg-n6.1/0022-support-probe-bluray-video.patch deleted file mode 100644 index cc24e639a..000000000 --- a/patches/ffmpeg-n6.1/0022-support-probe-bluray-video.patch +++ /dev/null @@ -1,104 +0,0 @@ -From b3f5a8272c73164325f4c9f3847926012c51e99e Mon Sep 17 00:00:00 2001 -From: qianlongxu -Date: Sat, 12 Oct 2024 18:04:29 +0800 -Subject: [PATCH 22] support probe bluray video - ---- - libavformat/Makefile | 1 + - libavformat/bluray.c | 28 +++++++++++++++++++++++++++- - libavformat/bluray_util.h | 27 +++++++++++++++++++++++++++ - 3 files changed, 55 insertions(+), 1 deletion(-) - create mode 100644 libavformat/bluray_util.h - -diff --git a/libavformat/Makefile b/libavformat/Makefile -index ffc32b9..dbdc5b9 100644 ---- a/libavformat/Makefile -+++ b/libavformat/Makefile -@@ -15,6 +15,7 @@ HEADERS = avformat.h \ - metadata.h \ - application.h \ - dns_cache.h \ -+ bluray_util.h \ - - OBJS = allformats.o \ - avformat.o \ -diff --git a/libavformat/bluray.c b/libavformat/bluray.c -index 62c7727..f4de84d 100644 ---- a/libavformat/bluray.c -+++ b/libavformat/bluray.c -@@ -28,7 +28,7 @@ - #include "libavutil/dict.h" - #include "libavformat/avformat.h" - #include "bluray_custom_fs.h" -- -+#include "bluray_util.h" - #define BLURAY_PROTO_PREFIX "bluray://" - #define MIN_PLAYLIST_LENGTH 180 /* 3 min */ - -@@ -345,3 +345,29 @@ const URLProtocol ff_bluray_protocol = { - .priv_data_size = sizeof(BlurayContext), - .priv_data_class = &bluray_context_class, - }; -+ -+int ff_is_bluray_video(const char *path, AVDictionary **options) -+{ -+#ifdef DEBUG_BLURAY -+ bd_set_debug_mask(BLURAY_DEBUG_MASK); -+ bd_set_debug_handler(bluray_DebugHandler); -+#endif -+ -+ fs_access *access = NULL; -+ -+ if (av_strstart(path, "file://", NULL) || av_strstart(path, "/", NULL)) { -+ access = NULL; -+ } else { -+ access = create_bluray_custom_access(path, options); -+ } -+ -+ BLURAY *bd = bd_open_fs(path, NULL, access); -+ if (!bd) { -+ destroy_bluray_custom_access(&access); -+ av_log(NULL, AV_LOG_ERROR, "bd_open() failed\n"); -+ return 0; -+ } -+ bd_close(bd); -+ destroy_bluray_custom_access(&access); -+ return 1; -+} -diff --git a/libavformat/bluray_util.h b/libavformat/bluray_util.h -new file mode 100644 -index 0000000..62301b2 ---- /dev/null -+++ b/libavformat/bluray_util.h -@@ -0,0 +1,27 @@ -+// -+// bluray_custom_fs.h -+// -+// Created by Reach Matt on 2024/9/13. -+// -+// -+// Copyright (C) 2021 Matt Reach// -+// Licensed under the Apache License, Version 2.0 (the "License"); -+// you may not use this file except in compliance with the License. -+// You may obtain a copy of the License at -+// -+// http://www.apache.org/licenses/LICENSE-2.0 -+// -+// Unless required by applicable law or agreed to in writing, software -+// distributed under the License is distributed on an "AS IS" BASIS, -+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -+// See the License for the specific language governing permissions and -+// limitations under the License. -+ -+#ifndef bluray_util_h -+#define bluray_util_h -+ -+typedef struct AVDictionary AVDictionary; -+ -+int ff_is_bluray_video(const char *path, AVDictionary **options); -+ -+#endif -\ No newline at end of file --- -2.39.3 (Apple Git-146) - diff --git a/patches/ffmpeg-n6.1/0026-http-add-reconnect_first_delay-opt.patch b/patches/ffmpeg-n6.1/0023-http-add-reconnect_first_delay-opt.patch similarity index 97% rename from patches/ffmpeg-n6.1/0026-http-add-reconnect_first_delay-opt.patch rename to patches/ffmpeg-n6.1/0023-http-add-reconnect_first_delay-opt.patch index 4f4b0879a..3ff28c6b7 100644 --- a/patches/ffmpeg-n6.1/0026-http-add-reconnect_first_delay-opt.patch +++ b/patches/ffmpeg-n6.1/0023-http-add-reconnect_first_delay-opt.patch @@ -1,7 +1,7 @@ From 18f90d0efc60ba8bee97bbe1c7c1a6f139b9ff24 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Tue, 12 Nov 2024 14:42:37 +0800 -Subject: [PATCH 26] http add reconnect_first_delay opt +Subject: [PATCH 23] http add reconnect_first_delay opt --- libavformat/http.c | 4 +++- diff --git a/patches/ffmpeg-n6.1/0027-Audio-Vivid-Parser-and-Demuxer-but-av3a-Decoder-is-a.patch b/patches/ffmpeg-n6.1/0024-Audio-Vivid-Parser-and-Demuxer-but-av3a-Decoder-is-a.patch similarity index 99% rename from patches/ffmpeg-n6.1/0027-Audio-Vivid-Parser-and-Demuxer-but-av3a-Decoder-is-a.patch rename to patches/ffmpeg-n6.1/0024-Audio-Vivid-Parser-and-Demuxer-but-av3a-Decoder-is-a.patch index e86f90a88..c81701948 100644 --- a/patches/ffmpeg-n6.1/0027-Audio-Vivid-Parser-and-Demuxer-but-av3a-Decoder-is-a.patch +++ b/patches/ffmpeg-n6.1/0024-Audio-Vivid-Parser-and-Demuxer-but-av3a-Decoder-is-a.patch @@ -1,7 +1,7 @@ From f73942871770f5e268178c886b7d6100e1c5faba Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Mon, 18 Nov 2024 17:12:20 +0800 -Subject: [PATCH 27] Audio Vivid Parser and Demuxer, but av3a Decoder is absent +Subject: [PATCH 24] Audio Vivid Parser and Demuxer, but av3a Decoder is absent --- libavcodec/Makefile | 1 + diff --git a/patches/ffmpeg-n6.1/0028-add-4-dummy-ijkplaceholder-demuxers.patch b/patches/ffmpeg-n6.1/0025-add-4-dummy-ijkplaceholder-demuxers.patch similarity index 95% rename from patches/ffmpeg-n6.1/0028-add-4-dummy-ijkplaceholder-demuxers.patch rename to patches/ffmpeg-n6.1/0025-add-4-dummy-ijkplaceholder-demuxers.patch index d034c13de..6ae8e8b83 100644 --- a/patches/ffmpeg-n6.1/0028-add-4-dummy-ijkplaceholder-demuxers.patch +++ b/patches/ffmpeg-n6.1/0025-add-4-dummy-ijkplaceholder-demuxers.patch @@ -1,7 +1,7 @@ From 6d78475920216bbc66a63d6aa7484b7ad57f7ff8 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Thu, 28 Nov 2024 11:28:43 +0800 -Subject: [PATCH 28] add 4 dummy ijkplaceholder demuxers +Subject: [PATCH 25] add 4 dummy ijkplaceholder demuxers --- libavformat/allformats.c | 5 +++++ diff --git a/patches/ffmpeg-n6.1/0029-add-3-dummy-ijkhttp-protocols-and-use-selected_http-.patch b/patches/ffmpeg-n6.1/0026-add-3-dummy-ijkhttp-protocols-and-use-selected_http-.patch similarity index 99% rename from patches/ffmpeg-n6.1/0029-add-3-dummy-ijkhttp-protocols-and-use-selected_http-.patch rename to patches/ffmpeg-n6.1/0026-add-3-dummy-ijkhttp-protocols-and-use-selected_http-.patch index 9cb5bb883..4464e3bf5 100644 --- a/patches/ffmpeg-n6.1/0029-add-3-dummy-ijkhttp-protocols-and-use-selected_http-.patch +++ b/patches/ffmpeg-n6.1/0026-add-3-dummy-ijkhttp-protocols-and-use-selected_http-.patch @@ -1,7 +1,7 @@ From ab8fe6d0c2de932980f6f1e9d31e24f25750da37 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Fri, 14 Mar 2025 17:41:28 +0800 -Subject: [PATCH 29] add 3 dummy ijkhttp protocols and use selected_http option +Subject: [PATCH 26] add 3 dummy ijkhttp protocols and use selected_http option choose --- diff --git a/patches/ffmpeg-n6.1/0021-custom-bluray-fs-for-network-Blu-ray-Disc-and-BDMV.patch b/patches/ffmpeg-n6.1/0027-custom-bluray-fs-for-network-Blu-ray-Disc-and-BDMV.patch similarity index 100% rename from patches/ffmpeg-n6.1/0021-custom-bluray-fs-for-network-Blu-ray-Disc-and-BDMV.patch rename to patches/ffmpeg-n6.1/0027-custom-bluray-fs-for-network-Blu-ray-Disc-and-BDMV.patch diff --git a/patches/ffmpeg-n6.1/0028-bluray-protocol-add-dvd-fallback.patch b/patches/ffmpeg-n6.1/0028-bluray-protocol-add-dvd-fallback.patch new file mode 100644 index 000000000..de95a10c0 --- /dev/null +++ b/patches/ffmpeg-n6.1/0028-bluray-protocol-add-dvd-fallback.patch @@ -0,0 +1,54 @@ +From b5176510c15322f2223c5e16af20e65be98db163 Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Wed, 19 Mar 2025 13:22:27 +0800 +Subject: [PATCH 28] bluray protocol add dvd fallback + +--- + libavformat/demux.c | 24 +++++++++++++++++++++--- + 1 file changed, 21 insertions(+), 3 deletions(-) + +diff --git a/libavformat/demux.c b/libavformat/demux.c +index 51fff7b..05e02db 100644 +--- a/libavformat/demux.c ++++ b/libavformat/demux.c +@@ -158,7 +158,10 @@ static int init_input(AVFormatContext *s, const char *filename, + int ret; + AVProbeData pd = { filename, NULL, 0 }; + int score = AVPROBE_SCORE_RETRY; +- ++ AVDictionary *tmp_opts = NULL; ++ if (options && (av_stristart(filename, "bluray://", NULL) || av_stristart(filename, "dvd://", NULL))) { ++ av_dict_copy(&tmp_opts, *options, 0); ++ } + if (s->pb) { + s->flags |= AVFMT_FLAG_CUSTOM_IO; + if (!s->iformat) +@@ -174,8 +177,23 @@ static int init_input(AVFormatContext *s, const char *filename, + (!s->iformat && (s->iformat = av_probe_input_format2(&pd, 0, &score)))) + return score; + +- if ((ret = s->io_open(s, &s->pb, filename, AVIO_FLAG_READ | s->avio_flags, options)) < 0) +- return ret; ++ if ((ret = s->io_open(s, &s->pb, filename, AVIO_FLAG_READ | s->avio_flags, ++ options)) < 0) { ++ if (av_stristart(filename, "bluray://", NULL)) { ++ const char *dvd_name = ++ av_strireplace(filename, "bluray://", "dvd://"); ++ ret = init_input(s, dvd_name, &tmp_opts); ++ av_dict_free(&tmp_opts); ++ return ret; ++ } else if (av_stristart(filename, "dvd://", NULL)) { ++ const char *a_name = av_strireplace(filename, "dvd://", ""); ++ ret = init_input(s, a_name, &tmp_opts); ++ av_dict_free(&tmp_opts); ++ return ret; ++ } else { ++ return ret; ++ } ++ } + + if (s->iformat) + return 0; +-- +2.39.5 (Apple Git-154) + diff --git a/patches/ffmpeg-n6.1/0017-bluray-open-and-find-the-right-m2ts-then-read-seek-i.patch b/patches/ffmpeg-n6.1/0029-bluray-open-and-find-the-right-m2ts-then-read-seek-i.patch similarity index 100% rename from patches/ffmpeg-n6.1/0017-bluray-open-and-find-the-right-m2ts-then-read-seek-i.patch rename to patches/ffmpeg-n6.1/0029-bluray-open-and-find-the-right-m2ts-then-read-seek-i.patch From 12295a44a70841e798de279f27e7c31b88bb97b9 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Mon, 24 Mar 2025 09:43:08 +0800 Subject: [PATCH 004/359] update patches --- ...fs-for-network-Blu-ray-Disc-and-BDMV.patch | 184 +++++++++++++---- ...find-the-right-m2ts-then-read-seek-i.patch | 70 +++++++ ...find-the-right-m2ts-then-read-seek-i.patch | 195 ------------------ ...29-bluray-protocol-add-dvd-fallback.patch} | 2 +- 4 files changed, 214 insertions(+), 237 deletions(-) create mode 100644 patches/ffmpeg-n6.1/0028-bluray-open-and-find-the-right-m2ts-then-read-seek-i.patch delete mode 100644 patches/ffmpeg-n6.1/0029-bluray-open-and-find-the-right-m2ts-then-read-seek-i.patch rename patches/ffmpeg-n6.1/{0028-bluray-protocol-add-dvd-fallback.patch => 0029-bluray-protocol-add-dvd-fallback.patch} (97%) diff --git a/patches/ffmpeg-n6.1/0027-custom-bluray-fs-for-network-Blu-ray-Disc-and-BDMV.patch b/patches/ffmpeg-n6.1/0027-custom-bluray-fs-for-network-Blu-ray-Disc-and-BDMV.patch index 8dcbb90c3..31ca25bd6 100644 --- a/patches/ffmpeg-n6.1/0027-custom-bluray-fs-for-network-Blu-ray-Disc-and-BDMV.patch +++ b/patches/ffmpeg-n6.1/0027-custom-bluray-fs-for-network-Blu-ray-Disc-and-BDMV.patch @@ -1,22 +1,22 @@ -From e6fdbabaf8902e834a745705c851db193b8d553f Mon Sep 17 00:00:00 2001 +From 22d3925e8fec79ca0dd23dbdb7eb6f9a9d53ee96 Mon Sep 17 00:00:00 2001 From: qianlongxu -Date: Tue, 17 Dec 2024 18:59:49 +0800 -Subject: [PATCH 21] custom bluray fs for network Blu-ray Disc and BDMV +Date: Mon, 24 Mar 2025 09:31:42 +0800 +Subject: [PATCH 27] custom bluray fs for network Blu-ray Disc and BDMV --- libavformat/Makefile | 2 +- - libavformat/bluray.c | 32 ++- + libavformat/bluray.c | 118 +++++++++- libavformat/bluray_custom_fs.c | 413 +++++++++++++++++++++++++++++++++ libavformat/bluray_custom_fs.h | 29 +++ - 4 files changed, 468 insertions(+), 8 deletions(-) + 4 files changed, 553 insertions(+), 9 deletions(-) create mode 100644 libavformat/bluray_custom_fs.c create mode 100644 libavformat/bluray_custom_fs.h diff --git a/libavformat/Makefile b/libavformat/Makefile -index 427c45a..ffc32b9 100644 +index 19ba54e..9ad6d87 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile -@@ -666,7 +666,7 @@ OBJS-$(CONFIG_VAPOURSYNTH_DEMUXER) += vapoursynth.o +@@ -667,7 +667,7 @@ OBJS-$(CONFIG_VAPOURSYNTH_DEMUXER) += vapoursynth.o # protocols I/O OBJS-$(CONFIG_ASYNC_PROTOCOL) += async.o OBJS-$(CONFIG_APPLEHTTP_PROTOCOL) += hlsproto.o @@ -26,10 +26,10 @@ index 427c45a..ffc32b9 100644 OBJS-$(CONFIG_CONCAT_PROTOCOL) += concat.o OBJS-$(CONFIG_CONCATF_PROTOCOL) += concat.o diff --git a/libavformat/bluray.c b/libavformat/bluray.c -index bf5b88d..96a799a 100644 +index 1845551..cd50523 100644 --- a/libavformat/bluray.c +++ b/libavformat/bluray.c -@@ -21,21 +21,22 @@ +@@ -21,23 +21,27 @@ */ #include @@ -38,9 +38,9 @@ index bf5b88d..96a799a 100644 #include "libavutil/avstring.h" #include "libavformat/url.h" #include "libavutil/opt.h" - #include "libavutil/dict.h" - #include "libavformat/avformat.h" +#include "bluray_custom_fs.h" ++#include "libavutil/dict.h" ++#include "libavformat/avformat.h" -#define BLURAY_PROTO_PREFIX "bluray:" +#define BLURAY_PROTO_PREFIX "bluray://" @@ -55,7 +55,12 @@ index bf5b88d..96a799a 100644 int playlist; int angle; int chapter; -@@ -110,7 +111,7 @@ static int bluray_close(URLContext *h) + /*int region;*/ ++ int title_idx; + } BlurayContext; + + #define OFFSET(x) offsetof(BlurayContext, x) +@@ -106,23 +110,58 @@ static int bluray_close(URLContext *h) if (bd->bd) { bd_close(bd->bd); } @@ -64,16 +69,30 @@ index bf5b88d..96a799a 100644 return 0; } -@@ -126,7 +127,7 @@ static void bluray_DebugHandler(const char *psz) - } - #endif - -static int bluray_open(URLContext *h, const char *path, int flags) -+static int bluray_open(URLContext *h, const char *path, int flags, AVDictionary **options) ++#ifdef DEBUG_BLURAY ++#include ++#define BLURAY_DEBUG_MASK 0xFFFFF //(0xFFFFF & ~DBG_STREAM) ++ ++static void bluray_DebugHandler(const char *psz) { - #ifdef DEBUG_BLURAY - bd_set_debug_mask(BLURAY_DEBUG_MASK); -@@ -138,11 +139,28 @@ static int bluray_open(URLContext *h, const char *path, int flags) ++ size_t len = strlen(psz); ++ if(len < 1) return; ++ av_log(NULL, AV_LOG_INFO, "[bluray] %s\n",psz); ++} ++#endif ++ ++ ++static int bluray_open(URLContext *h, const char *path, int flags, AVDictionary **options) ++{ ++#ifdef DEBUG_BLURAY ++ bd_set_debug_mask(BLURAY_DEBUG_MASK); ++ bd_set_debug_handler(bluray_DebugHandler); ++#endif ++ + BlurayContext *bd = h->priv_data; + int num_title_idx; + const char *diskname = path; av_strstart(path, BLURAY_PROTO_PREFIX, &diskname); @@ -81,7 +100,7 @@ index bf5b88d..96a799a 100644 + fs_access *access = NULL; + + diskname = ff_urldecode(diskname, 0); -+ ++ + if (av_strstart(diskname, "file://", NULL) || av_strstart(diskname, "/", NULL)) { + access = NULL; + } else { @@ -103,7 +122,87 @@ index bf5b88d..96a799a 100644 /* check if disc can be played */ if (check_disc_info(h) < 0) { -@@ -321,7 +339,7 @@ fail: +@@ -159,12 +198,13 @@ static int bluray_open(URLContext *h, const char *path, int flags) + + if (info->duration > duration) { + bd->playlist = info->playlist; ++ bd->title_idx = i; + duration = info->duration; + } + + bd_free_title_info(info); + } +- av_log(h, AV_LOG_INFO, "selected %05d.mpls\n", bd->playlist); ++ av_log(h, AV_LOG_INFO, "select longest playlist: %05d.mpls\n", bd->playlist); + } + + /* select playlist */ +@@ -222,13 +262,75 @@ static int64_t bluray_seek(URLContext *h, int64_t pos, int whence) + return AVERROR(EINVAL); + } + ++static int bluray_parse_priv(AVFormatContext *ic, URLContext *h) ++{ ++ BlurayContext *bd = h->priv_data; ++ BLURAY_TITLE_INFO *title_info = NULL; ++ BLURAY_CLIP_INFO clip_info; ++ ++ int v_idx = 0; ++ int a_idx = 0; ++ int s_idx = 0; ++ int ret = 0; ++ ++ if (!bd || !bd->bd) { ++ return AVERROR(EFAULT); ++ } ++ ++ title_info = bd_get_title_info(bd->bd, bd->title_idx, 0); ++ if (!title_info) { ++ return AVERROR(EFAULT); ++ } ++ ++ if (title_info->clip_count <= 0) { ++ ret = EFAULT; ++ goto fail; ++ } ++ clip_info = title_info->clips[0]; ++ ++ for (int i = 0; i < ic->nb_streams; i++) { ++ if (ic->streams[i] && ic->streams[i]->codecpar) { ++ switch (ic->streams[i]->codecpar->codec_type) { ++ case AVMEDIA_TYPE_VIDEO: ++ if (v_idx < clip_info.video_stream_count) { ++ av_log(h, AV_LOG_INFO, "video stream %d lang = %s\n", v_idx, clip_info.video_streams[v_idx].lang); ++ av_dict_set(&ic->streams[i]->metadata, "language", clip_info.video_streams[v_idx].lang, AV_DICT_DONT_OVERWRITE); ++ v_idx++; ++ } ++ break; ++ case AVMEDIA_TYPE_AUDIO: ++ if (a_idx < clip_info.audio_stream_count) { ++ av_log(h, AV_LOG_INFO, "audio stream %d lang = %s\n", a_idx, clip_info.audio_streams[a_idx].lang); ++ av_dict_set(&ic->streams[i]->metadata, "language", clip_info.audio_streams[a_idx].lang, AV_DICT_DONT_OVERWRITE); ++ a_idx++; ++ } ++ break; ++ case AVMEDIA_TYPE_SUBTITLE: ++ if (s_idx < clip_info.pg_stream_count) { ++ av_log(h, AV_LOG_INFO, "subtitle stream %d lang = %s\n", s_idx, clip_info.pg_streams[s_idx].lang); ++ av_dict_set(&ic->streams[i]->metadata, "language", clip_info.pg_streams[s_idx].lang, AV_DICT_DONT_OVERWRITE); ++ s_idx++; ++ } ++ break; ++ default: ++ break; ++ } ++ } ++ } ++ ++fail: ++ bd_free_title_info(title_info); ++ ++ return ret != 0 ? AVERROR(ret) : 0; ++} + const URLProtocol ff_bluray_protocol = { .name = "bluray", .url_close = bluray_close, @@ -111,10 +210,13 @@ index bf5b88d..96a799a 100644 + .url_open2 = bluray_open, .url_read = bluray_read, .url_seek = bluray_seek, - .url_parse_priv = bluray_parse_priv, ++ .url_parse_priv = bluray_parse_priv, + .priv_data_size = sizeof(BlurayContext), + .priv_data_class = &bluray_context_class, + }; diff --git a/libavformat/bluray_custom_fs.c b/libavformat/bluray_custom_fs.c new file mode 100644 -index 0000000..9062a2b +index 0000000..bdf2451 --- /dev/null +++ b/libavformat/bluray_custom_fs.c @@ -0,0 +1,413 @@ @@ -181,7 +283,7 @@ index 0000000..9062a2b + if (!io) { + return -1; + } -+ ++ + ff_builtin_io * app = av_mallocz(sizeof(ff_builtin_io)); + if (!app) { + return -2; @@ -215,7 +317,7 @@ index 0000000..9062a2b + if (is_dir) { + flags |= AVIO_FLAG_DIRECT; + } -+ ++ + int ret = ffurl_open_whitelist(&app->url_context, + url, + flags, @@ -226,8 +328,8 @@ index 0000000..9062a2b + NULL); + + av_application_did_http_open(app->app_ctx, (void*)app->url_context, url, ret < 0 ? AVERROR(errno) : 0, ret < 0 ? 500 : 200, 0); -+ -+ if (ret < 0) { ++ ++ if (ret < 0) { + close_builtin_io(app); + av_freep(&app); + } @@ -246,11 +348,11 @@ index 0000000..9062a2b + } + + av_application_will_http_seek(io->app_ctx, (void*)io->url_context, io->url_context->filename, offset); -+ ++ + int64_t pos = io->url_context->prot->url_seek(io->url_context, offset, origin); + if (pos < 0) { + av_application_did_http_seek(io->app_ctx, (void*)io->url_context, io->url_context->filename, offset, AVERROR(errno), 500); -+ return AVERROR(errno); ++ return AVERROR(errno); + } + io->offset = pos; + @@ -282,7 +384,7 @@ index 0000000..9062a2b + + int bytes = buf_size - buf_size1; + if (bytes == 0 && read == AVERROR_EOF) { -+ return AVERROR_EOF; ++ return AVERROR_EOF; + } else { + av_application_did_io_tcp_read(io->app_ctx, (void*)io->url_context, bytes); + return bytes; @@ -404,12 +506,12 @@ index 0000000..9062a2b + } + AVDictionary *opts = NULL; + av_dict_copy(&opts, access->opts, 0); -+ ++ + ff_builtin_io *io = NULL; + int ret = create_builtin_io(&io, url, &opts, 0); + av_dict_free(&opts); + av_free(url); -+ ++ + if (0 != ret) { + av_log(NULL, AV_LOG_ERROR, "can't open url %s,error:%s", url, av_err2str(ret)); + return NULL; @@ -455,11 +557,11 @@ index 0000000..9062a2b + } + + AVIODirEntry *next = NULL; -+ ++ + if (io->url_context->prot->url_read_dir(io->url_context, &next) < 0 || !next) { + return -2; + } -+ ++ + strncpy(entry->d_name, next->name, sizeof(entry->d_name)); + entry->d_name[sizeof(entry->d_name) - 1] = 0; + @@ -477,12 +579,12 @@ index 0000000..9062a2b + } + AVDictionary *opts = NULL; + av_dict_copy(&opts, access->opts, 0); -+ ++ + ff_builtin_io *io = NULL; + int ret = create_builtin_io(&io, url, &opts, 1); + av_dict_free(&opts); + av_free(url); -+ ++ + if (0 != ret) { + av_log(NULL, AV_LOG_ERROR, "can't open dir %s,error:%s", url, av_err2str(ret)); + return NULL; @@ -498,7 +600,7 @@ index 0000000..9062a2b + dir->internal = io; + dir->close = _dir_close; + dir->read = _dir_read; -+ ++ + return dir; +} + @@ -513,9 +615,9 @@ index 0000000..9062a2b + if (opaque) { + opaque->url = av_strdup(url); + if (options) { -+ av_dict_copy(&opaque->opts, *options, 0); ++ av_dict_copy(&opaque->opts, *options, 0); + } -+ ++ + int ret = create_builtin_io(&opaque->io, url, options, 0); + if (0 != ret) { + av_log(NULL, AV_LOG_ERROR, "can't open file %s,error:%s", url, av_err2str(ret)); @@ -526,7 +628,7 @@ index 0000000..9062a2b + access->read_blocks = read_blocks; + access->open_file = open_file; + access->open_dir = open_dir; -+ ++ + return access; + } + return NULL; diff --git a/patches/ffmpeg-n6.1/0028-bluray-open-and-find-the-right-m2ts-then-read-seek-i.patch b/patches/ffmpeg-n6.1/0028-bluray-open-and-find-the-right-m2ts-then-read-seek-i.patch new file mode 100644 index 000000000..7fc334fcc --- /dev/null +++ b/patches/ffmpeg-n6.1/0028-bluray-open-and-find-the-right-m2ts-then-read-seek-i.patch @@ -0,0 +1,70 @@ +From 28cdd2169e400e113ef6f681d2e1eee8ebc83afa Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Fri, 21 Mar 2025 19:00:43 +0800 +Subject: [PATCH 28] bluray open and find the right m2ts, then read\seek it + direactly instread of bluray logic. + +--- + libavformat/bluray.c | 24 +++++++++++++++++++----- + 1 file changed, 19 insertions(+), 5 deletions(-) + +diff --git a/libavformat/bluray.c b/libavformat/bluray.c +index c3cdc03..628693d 100644 +--- a/libavformat/bluray.c ++++ b/libavformat/bluray.c +@@ -42,6 +42,7 @@ typedef struct { + int chapter; + /*int region;*/ + int title_idx; ++ int stream_opened; + } BlurayContext; + + #define OFFSET(x) offsetof(BlurayContext, x) +@@ -222,7 +223,7 @@ static int bluray_open(URLContext *h, const char *path, int flags, AVDictionary + if (bd->chapter > 1) { + bd_seek_chapter(bd->bd, bd->chapter - 1); + } +- ++ bd->stream_opened = 1; + return 0; + } + +@@ -234,7 +235,13 @@ static int bluray_read(URLContext *h, unsigned char *buf, int size) + if (!bd || !bd->bd) { + return AVERROR(EFAULT); + } +- ++ if (bd->stream_opened) { ++ int read = (int)bd_file_read(bd->bd, buf, size); ++ if (read == 0) { ++ return AVERROR_EOF; ++ } ++ return read; ++ } + len = bd_read(bd->bd, buf, size); + + return len == 0 ? AVERROR_EOF : len; +@@ -252,10 +259,17 @@ static int64_t bluray_seek(URLContext *h, int64_t pos, int whence) + case SEEK_SET: + case SEEK_CUR: + case SEEK_END: +- return bd_seek(bd->bd, pos); +- ++ if (bd->stream_opened) { ++ return bd_file_seek(bd->bd, pos, whence); ++ } else { ++ return bd_seek(bd->bd, pos); ++ } + case AVSEEK_SIZE: +- return bd_get_title_size(bd->bd); ++ if (bd->stream_opened) { ++ return bd_file_size(bd->bd); ++ } else { ++ return bd_get_title_size(bd->bd); ++ } + } + + av_log(h, AV_LOG_ERROR, "Unsupported whence operation %d\n", whence); +-- +2.39.5 (Apple Git-154) + diff --git a/patches/ffmpeg-n6.1/0029-bluray-open-and-find-the-right-m2ts-then-read-seek-i.patch b/patches/ffmpeg-n6.1/0029-bluray-open-and-find-the-right-m2ts-then-read-seek-i.patch deleted file mode 100644 index 19cf1c65f..000000000 --- a/patches/ffmpeg-n6.1/0029-bluray-open-and-find-the-right-m2ts-then-read-seek-i.patch +++ /dev/null @@ -1,195 +0,0 @@ -From c8e0c7ab3cccbf6b7093b38830c4f51ad9eefa38 Mon Sep 17 00:00:00 2001 -From: qianlongxu -Date: Mon, 22 Jul 2024 15:24:00 +0800 -Subject: [PATCH 17] bluray open and find the right m2ts, then read\seek it - direactly instread of bluray logic. - ---- - libavformat/bluray.c | 108 ++++++++++++++++++++++++++++++++++++++++--- - 1 file changed, 102 insertions(+), 6 deletions(-) - -diff --git a/libavformat/bluray.c b/libavformat/bluray.c -index 1845551..bf5b88d 100644 ---- a/libavformat/bluray.c -+++ b/libavformat/bluray.c -@@ -25,6 +25,8 @@ - #include "libavutil/avstring.h" - #include "libavformat/url.h" - #include "libavutil/opt.h" -+#include "libavutil/dict.h" -+#include "libavformat/avformat.h" - - #define BLURAY_PROTO_PREFIX "bluray:" - #define MIN_PLAYLIST_LENGTH 180 /* 3 min */ -@@ -38,6 +40,8 @@ typedef struct { - int angle; - int chapter; - /*int region;*/ -+ int title_idx; -+ int stream_opened; - } BlurayContext; - - #define OFFSET(x) offsetof(BlurayContext, x) -@@ -110,8 +114,24 @@ static int bluray_close(URLContext *h) - return 0; - } - -+#ifdef DEBUG_BLURAY -+#include -+#define BLURAY_DEBUG_MASK 0xFFFFF //(0xFFFFF & ~DBG_STREAM) -+ -+static void bluray_DebugHandler(const char *psz) -+{ -+ size_t len = strlen(psz); -+ if(len < 1) return; -+ av_log(NULL, AV_LOG_INFO, "[bluray] %s\n",psz); -+} -+#endif -+ - static int bluray_open(URLContext *h, const char *path, int flags) - { -+#ifdef DEBUG_BLURAY -+ bd_set_debug_mask(BLURAY_DEBUG_MASK); -+ bd_set_debug_handler(bluray_DebugHandler); -+#endif - BlurayContext *bd = h->priv_data; - int num_title_idx; - const char *diskname = path; -@@ -159,12 +179,13 @@ static int bluray_open(URLContext *h, const char *path, int flags) - - if (info->duration > duration) { - bd->playlist = info->playlist; -+ bd->title_idx = i; - duration = info->duration; - } - - bd_free_title_info(info); - } -- av_log(h, AV_LOG_INFO, "selected %05d.mpls\n", bd->playlist); -+ av_log(h, AV_LOG_INFO, "select longest playlist: %05d.mpls\n", bd->playlist); - } - - /* select playlist */ -@@ -182,7 +203,7 @@ static int bluray_open(URLContext *h, const char *path, int flags) - if (bd->chapter > 1) { - bd_seek_chapter(bd->bd, bd->chapter - 1); - } -- -+ bd->stream_opened = 1; - return 0; - } - -@@ -194,7 +215,13 @@ static int bluray_read(URLContext *h, unsigned char *buf, int size) - if (!bd || !bd->bd) { - return AVERROR(EFAULT); - } -- -+ if (bd->stream_opened) { -+ int read = (int)bd_file_read(bd->bd, buf, size); -+ if (read == 0) { -+ return AVERROR_EOF; -+ } -+ return read; -+ } - len = bd_read(bd->bd, buf, size); - - return len == 0 ? AVERROR_EOF : len; -@@ -212,16 +239,84 @@ static int64_t bluray_seek(URLContext *h, int64_t pos, int whence) - case SEEK_SET: - case SEEK_CUR: - case SEEK_END: -- return bd_seek(bd->bd, pos); -- -+ if (bd->stream_opened) { -+ return bd_file_seek(bd->bd, pos, whence); -+ } else { -+ return bd_seek(bd->bd, pos); -+ } - case AVSEEK_SIZE: -- return bd_get_title_size(bd->bd); -+ if (bd->stream_opened) { -+ return bd_file_size(bd->bd); -+ } else { -+ return bd_get_title_size(bd->bd); -+ } - } - - av_log(h, AV_LOG_ERROR, "Unsupported whence operation %d\n", whence); - return AVERROR(EINVAL); - } - -+static int bluray_parse_priv(AVFormatContext *ic, URLContext *h) -+{ -+ BlurayContext *bd = h->priv_data; -+ BLURAY_TITLE_INFO *title_info = NULL; -+ BLURAY_CLIP_INFO clip_info; -+ -+ int v_idx = 0; -+ int a_idx = 0; -+ int s_idx = 0; -+ int ret = 0; -+ -+ if (!bd || !bd->bd) { -+ return AVERROR(EFAULT); -+ } -+ -+ title_info = bd_get_title_info(bd->bd, bd->title_idx, 0); -+ if (!title_info) { -+ return AVERROR(EFAULT); -+ } -+ -+ if (title_info->clip_count <= 0) { -+ ret = EFAULT; -+ goto fail; -+ } -+ clip_info = title_info->clips[0]; -+ -+ for (int i = 0; i < ic->nb_streams; i++) { -+ if (ic->streams[i] && ic->streams[i]->codecpar) { -+ switch (ic->streams[i]->codecpar->codec_type) { -+ case AVMEDIA_TYPE_VIDEO: -+ if (v_idx < clip_info.video_stream_count) { -+ av_log(h, AV_LOG_INFO, "video stream %d lang = %s\n", v_idx, clip_info.video_streams[v_idx].lang); -+ av_dict_set(&ic->streams[i]->metadata, "language", clip_info.video_streams[v_idx].lang, AV_DICT_DONT_OVERWRITE); -+ v_idx++; -+ } -+ break; -+ case AVMEDIA_TYPE_AUDIO: -+ if (a_idx < clip_info.audio_stream_count) { -+ av_log(h, AV_LOG_INFO, "audio stream %d lang = %s\n", a_idx, clip_info.audio_streams[a_idx].lang); -+ av_dict_set(&ic->streams[i]->metadata, "language", clip_info.audio_streams[a_idx].lang, AV_DICT_DONT_OVERWRITE); -+ a_idx++; -+ } -+ break; -+ case AVMEDIA_TYPE_SUBTITLE: -+ if (s_idx < clip_info.pg_stream_count) { -+ av_log(h, AV_LOG_INFO, "subtitle stream %d lang = %s\n", s_idx, clip_info.pg_streams[s_idx].lang); -+ av_dict_set(&ic->streams[i]->metadata, "language", clip_info.pg_streams[s_idx].lang, AV_DICT_DONT_OVERWRITE); -+ s_idx++; -+ } -+ break; -+ default: -+ break; -+ } -+ } -+ } -+ -+fail: -+ bd_free_title_info(title_info); -+ -+ return ret != 0 ? AVERROR(ret) : 0; -+} - - const URLProtocol ff_bluray_protocol = { - .name = "bluray", -@@ -229,6 +324,7 @@ const URLProtocol ff_bluray_protocol = { - .url_open = bluray_open, - .url_read = bluray_read, - .url_seek = bluray_seek, -+ .url_parse_priv = bluray_parse_priv, - .priv_data_size = sizeof(BlurayContext), - .priv_data_class = &bluray_context_class, - }; --- -2.39.3 (Apple Git-146) - diff --git a/patches/ffmpeg-n6.1/0028-bluray-protocol-add-dvd-fallback.patch b/patches/ffmpeg-n6.1/0029-bluray-protocol-add-dvd-fallback.patch similarity index 97% rename from patches/ffmpeg-n6.1/0028-bluray-protocol-add-dvd-fallback.patch rename to patches/ffmpeg-n6.1/0029-bluray-protocol-add-dvd-fallback.patch index de95a10c0..f358d95a8 100644 --- a/patches/ffmpeg-n6.1/0028-bluray-protocol-add-dvd-fallback.patch +++ b/patches/ffmpeg-n6.1/0029-bluray-protocol-add-dvd-fallback.patch @@ -1,7 +1,7 @@ From b5176510c15322f2223c5e16af20e65be98db163 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Wed, 19 Mar 2025 13:22:27 +0800 -Subject: [PATCH 28] bluray protocol add dvd fallback +Subject: [PATCH 29] bluray protocol add dvd fallback --- libavformat/demux.c | 24 +++++++++++++++++++++--- From ed9341320354b9c3320fa5ae7f466f7796efb371 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Mon, 24 Mar 2025 09:44:20 +0800 Subject: [PATCH 005/359] curl add retry and filter wrong http code --- do-install/download-uncompress.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/do-install/download-uncompress.sh b/do-install/download-uncompress.sh index 7ce21938a..af375d14a 100755 --- a/do-install/download-uncompress.sh +++ b/do-install/download-uncompress.sh @@ -35,10 +35,12 @@ function download() { mkdir -p $(dirname "$dst") local tname="${dst}.tmp" - curl -L "$MR_DOWNLOAD_URL" -o "$tname" + curl -fL --retry 3 --retry-delay 5 --retry-max-time 30 "$MR_DOWNLOAD_URL" -o "$tname" if [[ $? -eq 0 ]];then mv "$tname" "${dst}" + else + rm -f "$tname" fi } From 94c51b6098b3f38ebd8ee2fdaf34f1ae51c3dbf3 Mon Sep 17 00:00:00 2001 From: Anka Date: Mon, 24 Mar 2025 02:10:15 +0000 Subject: [PATCH 006/359] upgrade ffmpeg to ffmpeg-6.1.1-250324094642 for apple by cd --- configs/libs/ffmpeg.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configs/libs/ffmpeg.sh b/configs/libs/ffmpeg.sh index 151e43e86..6f51ecd5d 100644 --- a/configs/libs/ffmpeg.sh +++ b/configs/libs/ffmpeg.sh @@ -41,8 +41,8 @@ fi # pre compiled export PRE_COMPILE_TAG=ffmpeg-6.1.2-250227145407 -export PRE_COMPILE_TAG_TVOS=ffmpeg-6.1.2-250314152040 -export PRE_COMPILE_TAG_MACOS=ffmpeg-6.1.2-250314174518 -export PRE_COMPILE_TAG_IOS=ffmpeg-6.1.2-250314152040 +export PRE_COMPILE_TAG_TVOS=ffmpeg-6.1.1-250324094642 +export PRE_COMPILE_TAG_MACOS=ffmpeg-6.1.1-250324094642 +export PRE_COMPILE_TAG_IOS=ffmpeg-6.1.1-250324094642 export PRE_COMPILE_TAG_ANDROID=ffmpeg-6.1.2-250310113110 From 0c1224941f389ffc8c46ef4cedd50665eda83a09 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Fri, 28 Mar 2025 11:18:32 +0800 Subject: [PATCH 007/359] fix AVDictionary memory leak --- ...27-bluray-protocol-add-dvd-fallback.patch} | 33 +++++++++++-------- ...s-for-network-Blu-ray-Disc-and-BDMV.patch} | 2 +- ...ind-the-right-m2ts-then-read-seek-i.patch} | 2 +- 3 files changed, 22 insertions(+), 15 deletions(-) rename patches/ffmpeg-n6.1/{0029-bluray-protocol-add-dvd-fallback.patch => 0027-bluray-protocol-add-dvd-fallback.patch} (69%) rename patches/ffmpeg-n6.1/{0027-custom-bluray-fs-for-network-Blu-ray-Disc-and-BDMV.patch => 0028-custom-bluray-fs-for-network-Blu-ray-Disc-and-BDMV.patch} (99%) rename patches/ffmpeg-n6.1/{0028-bluray-open-and-find-the-right-m2ts-then-read-seek-i.patch => 0029-bluray-open-and-find-the-right-m2ts-then-read-seek-i.patch} (96%) diff --git a/patches/ffmpeg-n6.1/0029-bluray-protocol-add-dvd-fallback.patch b/patches/ffmpeg-n6.1/0027-bluray-protocol-add-dvd-fallback.patch similarity index 69% rename from patches/ffmpeg-n6.1/0029-bluray-protocol-add-dvd-fallback.patch rename to patches/ffmpeg-n6.1/0027-bluray-protocol-add-dvd-fallback.patch index f358d95a8..51f688757 100644 --- a/patches/ffmpeg-n6.1/0029-bluray-protocol-add-dvd-fallback.patch +++ b/patches/ffmpeg-n6.1/0027-bluray-protocol-add-dvd-fallback.patch @@ -1,34 +1,39 @@ -From b5176510c15322f2223c5e16af20e65be98db163 Mon Sep 17 00:00:00 2001 +From 7f96723900b9103059abc487f57aa34e049e8e9c Mon Sep 17 00:00:00 2001 From: qianlongxu -Date: Wed, 19 Mar 2025 13:22:27 +0800 -Subject: [PATCH 29] bluray protocol add dvd fallback +Date: Fri, 28 Mar 2025 11:15:04 +0800 +Subject: [PATCH 27] bluray protocol add dvd fallback --- - libavformat/demux.c | 24 +++++++++++++++++++++--- - 1 file changed, 21 insertions(+), 3 deletions(-) + libavformat/demux.c | 31 ++++++++++++++++++++++++++----- + 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/libavformat/demux.c b/libavformat/demux.c -index 51fff7b..05e02db 100644 +index 3c8f194..5620e0f 100644 --- a/libavformat/demux.c +++ b/libavformat/demux.c -@@ -158,7 +158,10 @@ static int init_input(AVFormatContext *s, const char *filename, +@@ -158,7 +158,8 @@ static int init_input(AVFormatContext *s, const char *filename, int ret; AVProbeData pd = { filename, NULL, 0 }; int score = AVPROBE_SCORE_RETRY; - + AVDictionary *tmp_opts = NULL; -+ if (options && (av_stristart(filename, "bluray://", NULL) || av_stristart(filename, "dvd://", NULL))) { -+ av_dict_copy(&tmp_opts, *options, 0); -+ } ++ if (s->pb) { s->flags |= AVFMT_FLAG_CUSTOM_IO; if (!s->iformat) -@@ -174,8 +177,23 @@ static int init_input(AVFormatContext *s, const char *filename, +@@ -173,10 +174,30 @@ static int init_input(AVFormatContext *s, const char *filename, + if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) || (!s->iformat && (s->iformat = av_probe_input_format2(&pd, 0, &score)))) return score; - +- - if ((ret = s->io_open(s, &s->pb, filename, AVIO_FLAG_READ | s->avio_flags, options)) < 0) - return ret; +- ++ ++ if (options && (av_stristart(filename, "bluray://", NULL) || av_stristart(filename, "dvd://", NULL))) { ++ av_dict_copy(&tmp_opts, *options, 0); ++ } ++ + if ((ret = s->io_open(s, &s->pb, filename, AVIO_FLAG_READ | s->avio_flags, + options)) < 0) { + if (av_stristart(filename, "bluray://", NULL)) { @@ -43,12 +48,14 @@ index 51fff7b..05e02db 100644 + av_dict_free(&tmp_opts); + return ret; + } else { ++ av_dict_free(&tmp_opts); + return ret; + } + } - ++ av_dict_free(&tmp_opts); if (s->iformat) return 0; + return av_probe_input_buffer2(s->pb, &s->iformat, filename, -- 2.39.5 (Apple Git-154) diff --git a/patches/ffmpeg-n6.1/0027-custom-bluray-fs-for-network-Blu-ray-Disc-and-BDMV.patch b/patches/ffmpeg-n6.1/0028-custom-bluray-fs-for-network-Blu-ray-Disc-and-BDMV.patch similarity index 99% rename from patches/ffmpeg-n6.1/0027-custom-bluray-fs-for-network-Blu-ray-Disc-and-BDMV.patch rename to patches/ffmpeg-n6.1/0028-custom-bluray-fs-for-network-Blu-ray-Disc-and-BDMV.patch index 31ca25bd6..db78c2610 100644 --- a/patches/ffmpeg-n6.1/0027-custom-bluray-fs-for-network-Blu-ray-Disc-and-BDMV.patch +++ b/patches/ffmpeg-n6.1/0028-custom-bluray-fs-for-network-Blu-ray-Disc-and-BDMV.patch @@ -1,7 +1,7 @@ From 22d3925e8fec79ca0dd23dbdb7eb6f9a9d53ee96 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Mon, 24 Mar 2025 09:31:42 +0800 -Subject: [PATCH 27] custom bluray fs for network Blu-ray Disc and BDMV +Subject: [PATCH 28] custom bluray fs for network Blu-ray Disc and BDMV --- libavformat/Makefile | 2 +- diff --git a/patches/ffmpeg-n6.1/0028-bluray-open-and-find-the-right-m2ts-then-read-seek-i.patch b/patches/ffmpeg-n6.1/0029-bluray-open-and-find-the-right-m2ts-then-read-seek-i.patch similarity index 96% rename from patches/ffmpeg-n6.1/0028-bluray-open-and-find-the-right-m2ts-then-read-seek-i.patch rename to patches/ffmpeg-n6.1/0029-bluray-open-and-find-the-right-m2ts-then-read-seek-i.patch index 7fc334fcc..9a0e1bdae 100644 --- a/patches/ffmpeg-n6.1/0028-bluray-open-and-find-the-right-m2ts-then-read-seek-i.patch +++ b/patches/ffmpeg-n6.1/0029-bluray-open-and-find-the-right-m2ts-then-read-seek-i.patch @@ -1,7 +1,7 @@ From 28cdd2169e400e113ef6f681d2e1eee8ebc83afa Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Fri, 21 Mar 2025 19:00:43 +0800 -Subject: [PATCH 28] bluray open and find the right m2ts, then read\seek it +Subject: [PATCH 29] bluray open and find the right m2ts, then read\seek it direactly instread of bluray logic. --- From 8a7df705aa9007074999650f331393dae84248d3 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Wed, 9 Apr 2025 17:45:56 +0800 Subject: [PATCH 008/359] copy private header for hls --- do-compile/apple/ffmpeg.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/do-compile/apple/ffmpeg.sh b/do-compile/apple/ffmpeg.sh index 7f9b3741c..d4e664da4 100755 --- a/do-compile/apple/ffmpeg.sh +++ b/do-compile/apple/ffmpeg.sh @@ -99,4 +99,8 @@ cp -f $MR_BUILD_SOURCE/libavcodec/mathops.h $MR_BUILD_PREFIX/include/libavcodec/ mkdir -p $MR_BUILD_PREFIX/include/libavcodec/x86/ cp -f $MR_BUILD_SOURCE/libavcodec/x86/mathops.h $MR_BUILD_PREFIX/include/libavcodec/x86/ mkdir -p $MR_BUILD_PREFIX/include/libavutil/x86/ -cp -f $MR_BUILD_SOURCE/libavutil/x86/asm.h $MR_BUILD_PREFIX/include/libavutil/x86/ \ No newline at end of file +cp -f $MR_BUILD_SOURCE/libavutil/x86/asm.h $MR_BUILD_PREFIX/include/libavutil/x86/ +#copy private header for hls.c +cp -f $MR_BUILD_SOURCE/libavformat/demux.h $MR_BUILD_PREFIX/include/libavformat/ +cp -f $MR_BUILD_SOURCE/libavformat/http.h $MR_BUILD_PREFIX/include/libavformat/ +cp -f $MR_BUILD_SOURCE/libavformat/hls_sample_encryption.h $MR_BUILD_PREFIX/include/libavformat/ \ No newline at end of file From 088b993fa857d025ade2e1eb22cc108458f295d9 Mon Sep 17 00:00:00 2001 From: Anka Date: Wed, 9 Apr 2025 10:07:04 +0000 Subject: [PATCH 009/359] upgrade ffmpeg to ffmpeg-6.1.1-250409175104 for apple by cd --- configs/libs/ffmpeg.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configs/libs/ffmpeg.sh b/configs/libs/ffmpeg.sh index 6f51ecd5d..008512877 100644 --- a/configs/libs/ffmpeg.sh +++ b/configs/libs/ffmpeg.sh @@ -41,8 +41,8 @@ fi # pre compiled export PRE_COMPILE_TAG=ffmpeg-6.1.2-250227145407 -export PRE_COMPILE_TAG_TVOS=ffmpeg-6.1.1-250324094642 -export PRE_COMPILE_TAG_MACOS=ffmpeg-6.1.1-250324094642 -export PRE_COMPILE_TAG_IOS=ffmpeg-6.1.1-250324094642 +export PRE_COMPILE_TAG_TVOS=ffmpeg-6.1.1-250409175104 +export PRE_COMPILE_TAG_MACOS=ffmpeg-6.1.1-250409175104 +export PRE_COMPILE_TAG_IOS=ffmpeg-6.1.1-250409175104 export PRE_COMPILE_TAG_ANDROID=ffmpeg-6.1.2-250310113110 From 4984f98664ffdf6d26c63d8619d402b5b03a77ff Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Thu, 10 Apr 2025 17:23:14 +0800 Subject: [PATCH 010/359] disable transpose_vt filter --- configs/ffconfig/module-full.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configs/ffconfig/module-full.sh b/configs/ffconfig/module-full.sh index 38d24e72f..0a8896101 100755 --- a/configs/ffconfig/module-full.sh +++ b/configs/ffconfig/module-full.sh @@ -444,6 +444,8 @@ export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-protocol=unix" # export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-devices" export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-filters" +# transpose_vt available macos(13.0), ios(16.0), tvos(16.0), visionos(1.0) +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-filter=transpose_vt" # External library support: export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-audiotoolbox" From 055038aea0ddec8369640df9ad544751b96063f5 Mon Sep 17 00:00:00 2001 From: debugly Date: Sun, 13 Apr 2025 16:37:32 +0800 Subject: [PATCH 011/359] add fftutorial --- .github/workflows/apple-android-common.yml | 1 + .github/workflows/install-dependencies.sh | 14 +++ configs/libs/fftutorial.sh | 48 +++++++++ do-compile/apple/fftutorial.sh | 108 +++++++++++++++++++++ 4 files changed, 171 insertions(+) create mode 100644 configs/libs/fftutorial.sh create mode 100755 do-compile/apple/fftutorial.sh diff --git a/.github/workflows/apple-android-common.yml b/.github/workflows/apple-android-common.yml index 6bd60ce01..81f9a8e26 100644 --- a/.github/workflows/apple-android-common.yml +++ b/.github/workflows/apple-android-common.yml @@ -46,6 +46,7 @@ on: - dvdread - ffmpeg - ijkffmpeg + - fftutorial - harfbuzz - fontconfig - freetype diff --git a/.github/workflows/install-dependencies.sh b/.github/workflows/install-dependencies.sh index 2b7adcbaf..21e095538 100755 --- a/.github/workflows/install-dependencies.sh +++ b/.github/workflows/install-dependencies.sh @@ -67,6 +67,20 @@ case $LIB_NAME in ./main.sh install -l 'openssl' -p $PLAT fi ;; + fftutorial) + if [[ $PLAT == all ]];then + ./main.sh install -l 'openssl' -p ios + ./main.sh install -l 'openssl' -p tvos + ./main.sh install -l 'openssl' -p macos + ./main.sh install -l 'openssl' -p android + elif [[ $PLAT == apple ]];then + ./main.sh install -l 'openssl' -p ios + ./main.sh install -l 'openssl' -p tvos + ./main.sh install -l 'openssl' -p macos + else + ./main.sh install -l 'openssl' -p $PLAT + fi + ;; harfbuzz) if [[ $PLAT == all ]];then ./main.sh install -l 'freetype' -p ios diff --git a/configs/libs/fftutorial.sh b/configs/libs/fftutorial.sh new file mode 100644 index 000000000..7c97424f1 --- /dev/null +++ b/configs/libs/fftutorial.sh @@ -0,0 +1,48 @@ +#! /usr/bin/env bash +# +# Copyright (C) 2021 Matt Reach + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# +# brew install nasm +# If you really want to compile without asm, configure with --disable-asm. + +export LIB_NAME='fftutorial' +export LIPO_LIBS="libavcodec libavformat libavutil libswscale libswresample" +export LIB_DEPENDS_BIN="nasm pkg-config" +export GIT_LOCAL_REPO=extra/ffmpeg +export REPO_DIR=ffmpeg + +# you can export GIT_FFMPEG_UPSTREAM=git@xx:yy/FFmpeg.git use your mirror +if [[ "$GIT_FFMPEG_UPSTREAM" != "" ]] ;then + export GIT_UPSTREAM="$GIT_FFMPEG_UPSTREAM" +else + export GIT_UPSTREAM=https://github.com/FFmpeg/FFmpeg.git +fi + +if [[ "$GIT_FFMPEG_COMMIT" != "" ]] ;then + export GIT_COMMIT="$GIT_FFMPEG_COMMIT" + export GIT_REPO_VERSION="$GIT_FFMPEG_COMMIT" +else + export GIT_COMMIT=n6.1.1 #origin/release/5.1 + export GIT_REPO_VERSION=6.1.1 +fi + +# pre compiled +export PRE_COMPILE_TAG= +export PRE_COMPILE_TAG_TVOS= +export PRE_COMPILE_TAG_MACOS= +export PRE_COMPILE_TAG_IOS= +export PRE_COMPILE_TAG_ANDROID= + diff --git a/do-compile/apple/fftutorial.sh b/do-compile/apple/fftutorial.sh new file mode 100755 index 000000000..0aa34d81d --- /dev/null +++ b/do-compile/apple/fftutorial.sh @@ -0,0 +1,108 @@ +#! /usr/bin/env bash +# +# Copyright (C) 2021 Matt Reach + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# This script is based on projects below +# https://github.com/bilibili/ijkplayer + +set -e + +error_handler() { + echo "An error occurred!" + tail -n20 ${MR_BUILD_SOURCE}/ffbuild/config.log +} + +trap 'error_handler' ERR + +THIS_DIR=$(DIRNAME=$(dirname "$0"); cd "$DIRNAME"; pwd) +cd "$THIS_DIR" + +# ffmpeg config options +source $MR_SHELL_CONFIGS_DIR/ffconfig/module.sh +source $MR_SHELL_CONFIGS_DIR/ffconfig/auto-detect-third-libs.sh + +CFG_FLAGS= +CFG_FLAGS="$CFG_FLAGS $COMMON_FF_CFG_FLAGS" +CFG_FLAGS="$CFG_FLAGS $THIRD_CFG_FLAGS" +CFG_FLAGS="$CFG_FLAGS --disable-avfilter" +CFG_FLAGS="$CFG_FLAGS --disable-avdevice" + +C_FLAGS="$MR_DEFAULT_CFLAGS" +EXTRA_LDFLAGS= +LDFLAGS="$C_FLAGS $EXTRA_LDFLAGS" +# C_FLAGS="$C_FLAGS -I/Users/matt/GitWorkspace/MoltenVK/Package/Release/MoltenVK/include" +# use system xml2 lib +# C_FLAGS="$C_FLAGS $(xml2-config --prefix=${MR_SYS_ROOT}/usr --cflags)" +# LDFLAGS="$C_FLAGS $(xml2-config --prefix=${MR_SYS_ROOT}/usr --libs)" + +# LDFLAGS="$LDFLAGS -framework IOKit -framework Metal -framework IOSurface -framework CoreGraphics -framework QuartzCore -framework AppKit -framework Foundation -lc++ /Users/matt/GitWorkspace/MoltenVK/Package/Release/MoltenVK/static/MoltenVK.xcframework/macos-arm64_x86_64/libMoltenVK.a" +echo "----------------------" +echo "[*] configure" + +if [[ ! -d $MR_BUILD_SOURCE ]]; then + echo "" + echo "!! ERROR" + echo "!! Can not find $MR_BUILD_SOURCE directory for $MR_BUILD_NAME" + echo "!! Run 'init-*.sh' first" + echo "" + exit 1 +fi + +cd $MR_BUILD_SOURCE +if [[ -f "./config.h" ]]; then + echo 'reuse configure' +else + echo + echo "CC: $MR_CC" + echo "CFLAGS: $C_FLAGS" + echo "LDFLAG:$LDFLAGS" + echo "FF_CFG_FLAGS: $CFG_FLAGS" + echo + ./configure \ + $CFG_FLAGS \ + --cc="$MR_CC" \ + --as="perl ${MR_GAS_PERL} -arch ${MR_ARCH} -- $MR_CC" \ + --extra-cflags="$C_FLAGS" \ + --extra-cxxflags="$C_FLAGS" \ + --extra-ldflags="$LDFLAGS" +fi + +#---------------------- +echo "----------------------" +echo "[*] compile" + +make -j$MR_HOST_NPROC >/dev/null + +cp config.* $MR_BUILD_PREFIX +make install >/dev/null +mkdir -p $MR_BUILD_PREFIX/include/libffmpeg +cp -f config.h $MR_BUILD_PREFIX/include/libffmpeg/ +[ -e config_components.h ] && cp -f config_components.h $MR_BUILD_PREFIX/include/libffmpeg/ +# copy private header for ffmpeg-kit. +[ -e $MR_BUILD_SOURCE/libavutil/getenv_utf8.h ] && cp -f $MR_BUILD_SOURCE/libavutil/getenv_utf8.h $MR_BUILD_PREFIX/include/libavutil/ +cp -f $MR_BUILD_SOURCE/libavutil/internal.h $MR_BUILD_PREFIX/include/libavutil/ +cp -f $MR_BUILD_SOURCE/libavutil/libm.h $MR_BUILD_PREFIX/include/libavutil/ +[ -e $MR_BUILD_SOURCE/libavutil/attributes_internal.h ] && cp -f $MR_BUILD_SOURCE/libavutil/attributes_internal.h $MR_BUILD_PREFIX/include/libavutil/ +cp -f $MR_BUILD_SOURCE/libavcodec/mathops.h $MR_BUILD_PREFIX/include/libavcodec/ + +mkdir -p $MR_BUILD_PREFIX/include/libavcodec/x86/ +cp -f $MR_BUILD_SOURCE/libavcodec/x86/mathops.h $MR_BUILD_PREFIX/include/libavcodec/x86/ +mkdir -p $MR_BUILD_PREFIX/include/libavutil/x86/ +cp -f $MR_BUILD_SOURCE/libavutil/x86/asm.h $MR_BUILD_PREFIX/include/libavutil/x86/ +#copy private header for hls.c +cp -f $MR_BUILD_SOURCE/libavformat/demux.h $MR_BUILD_PREFIX/include/libavformat/ +cp -f $MR_BUILD_SOURCE/libavformat/http.h $MR_BUILD_PREFIX/include/libavformat/ +cp -f $MR_BUILD_SOURCE/libavformat/hls_sample_encryption.h $MR_BUILD_PREFIX/include/libavformat/ From 7621c64b9517e6292fd28fd49383d42829e8deac Mon Sep 17 00:00:00 2001 From: debugly Date: Sun, 13 Apr 2025 16:53:19 +0800 Subject: [PATCH 012/359] fix REPO_DIR not equal to LIB_NAME case --- tools/export-android-build-env.sh | 2 +- tools/export-apple-build-env.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/export-android-build-env.sh b/tools/export-android-build-env.sh index 2e12a633a..9d4e8d18b 100755 --- a/tools/export-android-build-env.sh +++ b/tools/export-android-build-env.sh @@ -50,7 +50,7 @@ esac # x86_64 export MR_ARCH="$_MR_ARCH" # openssl-armv7a -export MR_BUILD_NAME="${LIB_NAME}-${_MR_ARCH}" +export MR_BUILD_NAME="${REPO_DIR}-${_MR_ARCH}" # android/ffmpeg-x86_64 export MR_BUILD_SOURCE="${MR_SRC_ROOT}/${MR_BUILD_NAME}" # android/ffmpeg-x86_64 diff --git a/tools/export-apple-build-env.sh b/tools/export-apple-build-env.sh index 3a929bc20..58bb85fa4 100755 --- a/tools/export-apple-build-env.sh +++ b/tools/export-apple-build-env.sh @@ -93,7 +93,7 @@ export MR_ARCH="${_MR_ARCH/_simulator/}" export MR_FF_ARCH="${MR_ARCH}" # ffmpeg-x86_64 -export MR_BUILD_NAME="${LIB_NAME}-${_MR_ARCH}" +export MR_BUILD_NAME="${REPO_DIR}-${_MR_ARCH}" # ios/ffmpeg-x86_64 export MR_BUILD_SOURCE="${MR_SRC_ROOT}/${MR_BUILD_NAME}" # ios/ffmpeg-x86_64 From a84682ec9a92174a7fa6eb5934e9bcfd4248ae7c Mon Sep 17 00:00:00 2001 From: debugly Date: Sun, 13 Apr 2025 17:17:40 +0800 Subject: [PATCH 013/359] delete MR_BUILD_NAME,fix can't find the arm64 arch libavcodec --- do-compile/android/any.sh | 2 +- do-compile/android/ffmpeg.sh | 2 +- do-compile/apple/any.sh | 2 +- do-compile/apple/ffmpeg.sh | 2 +- do-compile/apple/fftutorial.sh | 2 +- tools/export-android-build-env.sh | 10 +++++----- tools/export-apple-build-env.sh | 9 +++------ 7 files changed, 13 insertions(+), 16 deletions(-) diff --git a/do-compile/android/any.sh b/do-compile/android/any.sh index a825089de..4a7d42884 100755 --- a/do-compile/android/any.sh +++ b/do-compile/android/any.sh @@ -57,7 +57,7 @@ function do_compile() { if [ ! -d $MR_BUILD_SOURCE ]; then echo "" echo "!! ERROR" - echo "!! Can not find $MR_BUILD_SOURCE directory for $MR_BUILD_NAME" + echo "!! Can not find lib source: $MR_BUILD_SOURCE" echo "!! Run init-any.sh ${LIB_NAME} first" echo "" exit 1 diff --git a/do-compile/android/ffmpeg.sh b/do-compile/android/ffmpeg.sh index f731b7eb0..28ab3cc3e 100755 --- a/do-compile/android/ffmpeg.sh +++ b/do-compile/android/ffmpeg.sh @@ -52,7 +52,7 @@ echo "[*] configure" if [[ ! -d $MR_BUILD_SOURCE ]]; then echo "" echo "!! ERROR" - echo "!! Can not find $MR_BUILD_SOURCE directory for $MR_BUILD_NAME" + echo "!! Can not find lib source: $MR_BUILD_SOURCE" echo "!! Run 'init-*.sh' first" echo "" exit 1 diff --git a/do-compile/apple/any.sh b/do-compile/apple/any.sh index 2a96bcc62..45ae909da 100755 --- a/do-compile/apple/any.sh +++ b/do-compile/apple/any.sh @@ -147,7 +147,7 @@ function do_compile() { if [ ! -d $MR_BUILD_SOURCE ]; then echo "" echo "!! ERROR" - echo "!! Can not find $MR_BUILD_SOURCE directory for $MR_BUILD_NAME" + echo "!! Can not find lib source: $MR_BUILD_SOURCE" echo "!! Run init-any.sh ${LIB_NAME} first" echo "" exit 1 diff --git a/do-compile/apple/ffmpeg.sh b/do-compile/apple/ffmpeg.sh index d4e664da4..4fc825a78 100755 --- a/do-compile/apple/ffmpeg.sh +++ b/do-compile/apple/ffmpeg.sh @@ -53,7 +53,7 @@ echo "[*] configure" if [[ ! -d $MR_BUILD_SOURCE ]]; then echo "" echo "!! ERROR" - echo "!! Can not find $MR_BUILD_SOURCE directory for $MR_BUILD_NAME" + echo "!! Can not find lib source: $MR_BUILD_SOURCE" echo "!! Run 'init-*.sh' first" echo "" exit 1 diff --git a/do-compile/apple/fftutorial.sh b/do-compile/apple/fftutorial.sh index 0aa34d81d..a0a76daed 100755 --- a/do-compile/apple/fftutorial.sh +++ b/do-compile/apple/fftutorial.sh @@ -55,7 +55,7 @@ echo "[*] configure" if [[ ! -d $MR_BUILD_SOURCE ]]; then echo "" echo "!! ERROR" - echo "!! Can not find $MR_BUILD_SOURCE directory for $MR_BUILD_NAME" + echo "!! Can not find lib source: $MR_BUILD_SOURCE" echo "!! Run 'init-*.sh' first" echo "" exit 1 diff --git a/tools/export-android-build-env.sh b/tools/export-android-build-env.sh index 9d4e8d18b..d3c514ed2 100755 --- a/tools/export-android-build-env.sh +++ b/tools/export-android-build-env.sh @@ -50,11 +50,12 @@ esac # x86_64 export MR_ARCH="$_MR_ARCH" # openssl-armv7a -export MR_BUILD_NAME="${REPO_DIR}-${_MR_ARCH}" -# android/ffmpeg-x86_64 -export MR_BUILD_SOURCE="${MR_SRC_ROOT}/${MR_BUILD_NAME}" + # android/ffmpeg-x86_64 -export MR_BUILD_PREFIX="${MR_PRODUCT_ROOT}/${MR_BUILD_NAME}" +export MR_BUILD_SOURCE="${MR_SRC_ROOT}/${REPO_DIR}-${_MR_ARCH}" +# android/fftutorial-x86_64 +LIB_NAME +export MR_BUILD_PREFIX="${MR_PRODUCT_ROOT}/${LIB_NAME}-${_MR_ARCH}" if [ -z "$ANDROID_NDK_HOME" ]; then echo "You must define ANDROID_NDK_HOME before starting." @@ -104,7 +105,6 @@ echo "MR_ARCH : [$MR_ARCH]" echo "MR_TRIPLE : [$MR_TRIPLE]" echo "MR_ANDROID_API : [$MR_ANDROID_API]" echo "MR_ANDROID_NDK : [$MR_NDK_REL]" -echo "MR_BUILD_NAME : [$MR_BUILD_NAME]" echo "MR_BUILD_SOURCE : [$MR_BUILD_SOURCE]" echo "MR_BUILD_PREFIX : [$MR_BUILD_PREFIX]" echo "MR_DEFAULT_CFLAGS : [$MR_DEFAULT_CFLAGS]" diff --git a/tools/export-apple-build-env.sh b/tools/export-apple-build-env.sh index 58bb85fa4..0e47bdc85 100755 --- a/tools/export-apple-build-env.sh +++ b/tools/export-apple-build-env.sh @@ -92,17 +92,14 @@ export MR_SYS_ROOT=`xcrun -sdk $XCRUN_SDK --show-sdk-path` export MR_ARCH="${_MR_ARCH/_simulator/}" export MR_FF_ARCH="${MR_ARCH}" -# ffmpeg-x86_64 -export MR_BUILD_NAME="${REPO_DIR}-${_MR_ARCH}" # ios/ffmpeg-x86_64 -export MR_BUILD_SOURCE="${MR_SRC_ROOT}/${MR_BUILD_NAME}" -# ios/ffmpeg-x86_64 -export MR_BUILD_PREFIX="${MR_PRODUCT_ROOT}/${MR_BUILD_NAME}" +export MR_BUILD_SOURCE="${MR_SRC_ROOT}/${REPO_DIR}-${_MR_ARCH}" +# ios/fftutorial-x86_64 +export MR_BUILD_PREFIX="${MR_PRODUCT_ROOT}/${LIB_NAME}-${_MR_ARCH}" # -arch x86_64 -mios-simulator-version-min=11.0 export MR_DEFAULT_CFLAGS="-arch $MR_ARCH $MR_INIT_CFLAGS $DEPLOYMENT_TARGET -D__APPLE__" echo "MR_ARCH : [$MR_ARCH]" -echo "MR_BUILD_NAME : [$MR_BUILD_NAME]" echo "MR_BUILD_SOURCE : [$MR_BUILD_SOURCE]" echo "MR_BUILD_PREFIX : [$MR_BUILD_PREFIX]" echo "MR_DEFAULT_CFLAGS: [$MR_DEFAULT_CFLAGS]" From 2c37bf89d9753ea481ef2161d449e5cf078c3960 Mon Sep 17 00:00:00 2001 From: Anka Date: Sun, 13 Apr 2025 09:32:43 +0000 Subject: [PATCH 014/359] upgrade fftutorial to fftutorial-6.1.1-250413171857 for apple by cd --- configs/libs/fftutorial.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configs/libs/fftutorial.sh b/configs/libs/fftutorial.sh index 7c97424f1..a3a8814c8 100644 --- a/configs/libs/fftutorial.sh +++ b/configs/libs/fftutorial.sh @@ -41,8 +41,8 @@ fi # pre compiled export PRE_COMPILE_TAG= -export PRE_COMPILE_TAG_TVOS= -export PRE_COMPILE_TAG_MACOS= -export PRE_COMPILE_TAG_IOS= +export PRE_COMPILE_TAG_TVOS=fftutorial-6.1.1-250413171857 +export PRE_COMPILE_TAG_MACOS=fftutorial-6.1.1-250413171857 +export PRE_COMPILE_TAG_IOS=fftutorial-6.1.1-250413171857 export PRE_COMPILE_TAG_ANDROID= From fa3fd2d9b5f0904a73e1ae2e7e73b8507b14d6c4 Mon Sep 17 00:00:00 2001 From: debugly Date: Sun, 13 Apr 2025 18:25:25 +0800 Subject: [PATCH 015/359] delete MR_PRE_ROOT --- do-install/download-uncompress.sh | 3 +-- tools/prepare-build-workspace.sh | 2 -- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/do-install/download-uncompress.sh b/do-install/download-uncompress.sh index af375d14a..c34210c8e 100755 --- a/do-install/download-uncompress.sh +++ b/do-install/download-uncompress.sh @@ -22,7 +22,6 @@ cd "$THIS_DIR" echo "=== [$0] check env begin===" env_assert "MR_WORKSPACE" -env_assert "MR_PRE_ROOT" env_assert "MR_DOWNLOAD_URL" env_assert "MR_DOWNLOAD_ONAME" env_assert "MR_UNCOMPRESS_DIR" @@ -57,7 +56,7 @@ function extract(){ } function install() { - local dst="${MR_PRE_ROOT}/${MR_DOWNLOAD_ONAME}" + local dst="${MR_WORKSPACE}/pre/${MR_DOWNLOAD_ONAME}" if [[ -f "$dst" ]];then echo "$dst already exist,skip download." else diff --git a/tools/prepare-build-workspace.sh b/tools/prepare-build-workspace.sh index ae1c757d3..3ff84077c 100644 --- a/tools/prepare-build-workspace.sh +++ b/tools/prepare-build-workspace.sh @@ -39,13 +39,11 @@ export MR_XCFRMK_DIR="${MR_WORKSPACE}/product/xcframework" export MR_IOS_PRODUCT_ROOT="${MR_WORKSPACE}/product/ios" export MR_MACOS_PRODUCT_ROOT="${MR_WORKSPACE}/product/macos" export MR_TVOS_PRODUCT_ROOT="${MR_WORKSPACE}/product/tvos" -export MR_PRE_ROOT="${MR_WORKSPACE}/pre" export MR_UNI_PROD_DIR="${MR_PRODUCT_ROOT}/universal" export MR_UNI_SIM_PROD_DIR="${MR_PRODUCT_ROOT}/universal-simulator" echo "MR_SRC_ROOT : [$MR_SRC_ROOT]" -echo "MR_PRE_ROOT : [$MR_PRE_ROOT]" echo "MR_PRODUCT_ROOT: [$MR_PRODUCT_ROOT]" echo "MR_UNI_PROD_DIR: [$MR_UNI_PROD_DIR]" echo "MR_UNI_SIM_PROD_DIR: [$MR_UNI_SIM_PROD_DIR]" From 09e4723be9035be4b038721275ee403624c9c253 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Thu, 17 Apr 2025 10:40:48 +0800 Subject: [PATCH 016/359] add two ffmpeg patches --- ...-not-very-useful-log-use-trace-level.patch | 76 +++++++++++++++++++ ...ry-when-avio-encounter-error-but-not.patch | 28 +++++++ 2 files changed, 104 insertions(+) create mode 100644 patches/ffmpeg-n6.1/0030-not-very-useful-log-use-trace-level.patch create mode 100644 patches/ffmpeg-n6.1/0031-let-avio-can-retry-when-avio-encounter-error-but-not.patch diff --git a/patches/ffmpeg-n6.1/0030-not-very-useful-log-use-trace-level.patch b/patches/ffmpeg-n6.1/0030-not-very-useful-log-use-trace-level.patch new file mode 100644 index 000000000..7df5d2a9f --- /dev/null +++ b/patches/ffmpeg-n6.1/0030-not-very-useful-log-use-trace-level.patch @@ -0,0 +1,76 @@ +From 4a89fee5b4793c8a116d3d33b712601fb6abddcf Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Thu, 17 Apr 2025 10:21:12 +0800 +Subject: [PATCH 30] not very useful log use trace level + +--- + libavcodec/h2645_parse.c | 6 +++--- + libavcodec/h2645_vui.c | 2 +- + libavformat/demux.c | 4 ++-- + 3 files changed, 6 insertions(+), 6 deletions(-) + +diff --git a/libavcodec/h2645_parse.c b/libavcodec/h2645_parse.c +index 28db465..ac9e151 100644 +--- a/libavcodec/h2645_parse.c ++++ b/libavcodec/h2645_parse.c +@@ -353,7 +353,7 @@ static int vvc_parse_nal_header(H2645NAL *nal, void *logctx) + if ((nal->type >= VVC_IDR_W_RADL && nal->type <= VVC_RSV_IRAP_11) && nal->temporal_id) + return AVERROR_INVALIDDATA; + +- av_log(logctx, AV_LOG_DEBUG, ++ av_log(logctx, AV_LOG_TRACE, + "nal_unit_type: %d(%s), nuh_layer_id: %d, temporal_id: %d\n", + nal->type, vvc_nal_unit_name(nal->type), nal->nuh_layer_id, nal->temporal_id); + +@@ -374,7 +374,7 @@ static int hevc_parse_nal_header(H2645NAL *nal, void *logctx) + if (nal->temporal_id < 0) + return AVERROR_INVALIDDATA; + +- av_log(logctx, AV_LOG_DEBUG, ++ av_log(logctx, AV_LOG_TRACE, + "nal_unit_type: %d(%s), nuh_layer_id: %d, temporal_id: %d\n", + nal->type, hevc_nal_unit_name(nal->type), nal->nuh_layer_id, nal->temporal_id); + +@@ -391,7 +391,7 @@ static int h264_parse_nal_header(H2645NAL *nal, void *logctx) + nal->ref_idc = get_bits(gb, 2); + nal->type = get_bits(gb, 5); + +- av_log(logctx, AV_LOG_DEBUG, ++ av_log(logctx, AV_LOG_TRACE, + "nal_unit_type: %d(%s), nal_ref_idc: %d\n", + nal->type, h264_nal_unit_name(nal->type), nal->ref_idc); + +diff --git a/libavcodec/h2645_vui.c b/libavcodec/h2645_vui.c +index e5c7bf4..8301492 100644 +--- a/libavcodec/h2645_vui.c ++++ b/libavcodec/h2645_vui.c +@@ -36,7 +36,7 @@ + + void ff_h2645_decode_common_vui_params(GetBitContext *gb, H2645VUI *vui, void *logctx) + { +- av_log(logctx, AV_LOG_DEBUG, "Decoding VUI\n"); ++ av_log(logctx, AV_LOG_TRACE, "Decoding VUI\n"); + + vui->aspect_ratio_info_present_flag = get_bits1(gb); + if (vui->aspect_ratio_info_present_flag) { +diff --git a/libavformat/demux.c b/libavformat/demux.c +index 15807f6..535acaf 100644 +--- a/libavformat/demux.c ++++ b/libavformat/demux.c +@@ -1979,11 +1979,11 @@ static void estimate_timings(AVFormatContext *ic, int64_t old_offset) + for (unsigned i = 0; i < ic->nb_streams; i++) { + AVStream *const st = ic->streams[i]; + if (st->time_base.den) +- av_log(ic, AV_LOG_TRACE, "stream %u: start_time: %s duration: %s\n", i, ++ av_log(ic, AV_LOG_DEBUG, "stream %u: start_time: %s duration: %s\n", i, + av_ts2timestr(st->start_time, &st->time_base), + av_ts2timestr(st->duration, &st->time_base)); + } +- av_log(ic, AV_LOG_TRACE, ++ av_log(ic, AV_LOG_DEBUG, + "format: start_time: %s duration: %s (estimate from %s) bitrate=%"PRId64" kb/s\n", + av_ts2timestr(ic->start_time, &AV_TIME_BASE_Q), + av_ts2timestr(ic->duration, &AV_TIME_BASE_Q), +-- +2.39.5 (Apple Git-154) + diff --git a/patches/ffmpeg-n6.1/0031-let-avio-can-retry-when-avio-encounter-error-but-not.patch b/patches/ffmpeg-n6.1/0031-let-avio-can-retry-when-avio-encounter-error-but-not.patch new file mode 100644 index 000000000..7b4f226c9 --- /dev/null +++ b/patches/ffmpeg-n6.1/0031-let-avio-can-retry-when-avio-encounter-error-but-not.patch @@ -0,0 +1,28 @@ +From 3f0966825de7bf6ff6cb858c70f197fbeafe3419 Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Thu, 17 Apr 2025 10:36:54 +0800 +Subject: [PATCH 31] let avio can retry when avio encounter error but not eof + +--- + libavformat/aviobuf.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c +index 2899c75..06012b7 100644 +--- a/libavformat/aviobuf.c ++++ b/libavformat/aviobuf.c +@@ -569,7 +569,10 @@ static void fill_buffer(AVIOContext *s) + s->eof_reached = 1; + + /* no need to do anything if EOF already reached */ +- if (s->eof_reached) ++ /* when "len = read_packet_wrapper(s, dst, len);" has error, eof_reached marked to 1 ++ * in effect the stream not eof but encounter network error ++ */ ++ if (s->eof_reached && !s->error) + return; + + if (s->update_checksum && dst == s->buffer) { +-- +2.39.5 (Apple Git-154) + From e11d729eb652b216e3ef546d241c4dc9075c8e00 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Sat, 19 Apr 2025 17:00:41 +0800 Subject: [PATCH 017/359] fix android build shell --- tools/export-android-build-env.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/export-android-build-env.sh b/tools/export-android-build-env.sh index d3c514ed2..96babb9be 100755 --- a/tools/export-android-build-env.sh +++ b/tools/export-android-build-env.sh @@ -54,7 +54,6 @@ export MR_ARCH="$_MR_ARCH" # android/ffmpeg-x86_64 export MR_BUILD_SOURCE="${MR_SRC_ROOT}/${REPO_DIR}-${_MR_ARCH}" # android/fftutorial-x86_64 -LIB_NAME export MR_BUILD_PREFIX="${MR_PRODUCT_ROOT}/${LIB_NAME}-${_MR_ARCH}" if [ -z "$ANDROID_NDK_HOME" ]; then From 84abe868cadb7f464192332f81e61c509a9aa2b2 Mon Sep 17 00:00:00 2001 From: Matt Reach Date: Thu, 24 Apr 2025 14:51:18 +0800 Subject: [PATCH 018/359] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0757c832d..8de0d2eab 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,9 @@ **What's MRFFToolChain?** -MRFFToolChain products was built for ijkplayer : [https://github.com/debugly/ijkplayer](https://github.com/debugly/ijkplayer). +MRFFToolChain products was built for [fsplayer](https://github.com/debugly/fsplayer) 、 [ijkplayer](https://github.com/debugly/ijkplayer) 、[FFmpegTutorial](https://github.com/debugly/FFmpegTutorial). -At present MRFFToolChain contained `ass、bluray、dav1d、dvdread、ffmpeg、freetype、fribidi、harfbuzz、openssl、opus、unibreak、uavs3d、smb2、yuv、soundtouch`. +At present MRFFToolChain contained `ass、bluray、dav1d、dvdread、ffmpeg、freetype、fribidi、harfbuzz、openssl、opus、unibreak、uavs3d、smb2、yuv、soundtouch、xml2`. ## Supported Plat From 351d7cc57438b1108dcf4029ad05c8f624aca89a Mon Sep 17 00:00:00 2001 From: Matt Reach Date: Sun, 27 Apr 2025 19:47:37 +0800 Subject: [PATCH 019/359] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 8de0d2eab..aa3039e65 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ ## MRFFToolChain Build Shell +![](https://img.shields.io/github/downloads/debugly/MRFFToolChainBuildShell/total) + **What's MRFFToolChain?** MRFFToolChain products was built for [fsplayer](https://github.com/debugly/fsplayer) 、 [ijkplayer](https://github.com/debugly/ijkplayer) 、[FFmpegTutorial](https://github.com/debugly/FFmpegTutorial). From acf23f6ee331aba10b07e4ea76cb2849151fa6a8 Mon Sep 17 00:00:00 2001 From: Matt Reach Date: Sun, 27 Apr 2025 20:32:10 +0800 Subject: [PATCH 020/359] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index aa3039e65..00156ac53 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ## MRFFToolChain Build Shell -![](https://img.shields.io/github/downloads/debugly/MRFFToolChainBuildShell/total) +![](https://img.shields.io/github/downloads/debugly/MRFFToolChainBuildShell/total) **What's MRFFToolChain?** From 6b454007c3ee9133d36ab7ed662a86556851f597 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Mon, 28 Apr 2025 09:25:37 +0800 Subject: [PATCH 021/359] android force use SOUNDTOUCH_INTEGER_SAMPLES --- ...force-use-SOUNDTOUCH_INTEGER_SAMPLES.patch | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 patches/soundtouch/0001-android-force-use-SOUNDTOUCH_INTEGER_SAMPLES.patch diff --git a/patches/soundtouch/0001-android-force-use-SOUNDTOUCH_INTEGER_SAMPLES.patch b/patches/soundtouch/0001-android-force-use-SOUNDTOUCH_INTEGER_SAMPLES.patch new file mode 100644 index 000000000..647385c29 --- /dev/null +++ b/patches/soundtouch/0001-android-force-use-SOUNDTOUCH_INTEGER_SAMPLES.patch @@ -0,0 +1,25 @@ +From 3238587c53c2910877c8954433f46e59f18e6d12 Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Sat, 26 Apr 2025 15:03:15 +0800 +Subject: [PATCH] android force use SOUNDTOUCH_INTEGER_SAMPLES + +--- + include/STTypes.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/include/STTypes.h b/include/STTypes.h +index 03dea9e..78ac3e6 100644 +--- a/include/STTypes.h ++++ b/include/STTypes.h +@@ -71,7 +71,7 @@ namespace soundtouch + /// runtime performance so recommendation is to keep this off. + // #define USE_MULTICH_ALWAYS + +- #if (defined(__SOFTFP__) && defined(ANDROID)) ++ #if (defined(ANDROID)) + // For Android compilation: Force use of Integer samples in case that + // compilation uses soft-floating point emulation - soft-fp is way too slow + #undef SOUNDTOUCH_FLOAT_SAMPLES +-- +2.39.5 (Apple Git-154) + From 57941c14de32575dd2738a8ebe08dc7ddcb95a36 Mon Sep 17 00:00:00 2001 From: Anka Date: Mon, 28 Apr 2025 01:27:30 +0000 Subject: [PATCH 022/359] upgrade soundtouch to soundtouch-2.3.3-250428092710 for android by cd --- configs/libs/soundtouch.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/libs/soundtouch.sh b/configs/libs/soundtouch.sh index 7c5c980c9..a8409f14a 100644 --- a/configs/libs/soundtouch.sh +++ b/configs/libs/soundtouch.sh @@ -43,4 +43,4 @@ export PRE_COMPILE_TAG=soundtouch-2.3.3-250225223556 export PRE_COMPILE_TAG_TVOS=soundtouch-2.3.3-250226212055 export PRE_COMPILE_TAG_MACOS=soundtouch-2.3.3-250226210026 export PRE_COMPILE_TAG_IOS=soundtouch-2.3.3-250226175330 -export PRE_COMPILE_TAG_ANDROID=soundtouch-2.3.3-250310112314 +export PRE_COMPILE_TAG_ANDROID=soundtouch-2.3.3-250428092710 From fd5ffbf6751fe77f6f2f2457eb1b491d2cca84dd Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Mon, 28 Apr 2025 09:33:25 +0800 Subject: [PATCH 023/359] ijkffmpeg enable rtsp --- configs/ijk-ffmpeg-config/module-lite.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/configs/ijk-ffmpeg-config/module-lite.sh b/configs/ijk-ffmpeg-config/module-lite.sh index 6dbecfac2..df340a811 100755 --- a/configs/ijk-ffmpeg-config/module-lite.sh +++ b/configs/ijk-ffmpeg-config/module-lite.sh @@ -102,6 +102,7 @@ export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-demuxer=mpegvideo" export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-demuxer=flac" export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-demuxer=hevc" export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-demuxer=webm_dash_manifest" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-demuxer=rtsp" # ./configure --list-parsers export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-parsers" @@ -148,9 +149,9 @@ export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-protocol=mmst" export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-protocol=rtmp*" export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-protocol=rtmp" export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-protocol=rtmpt" -export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-protocol=rtp" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-protocol=rtp" export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-protocol=sctp" -export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-protocol=srtp" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-protocol=srtp" export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-protocol=subfile" export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-protocol=unix" From 0120c617c359faed2b1d1c393e48dce8d8f4f79f Mon Sep 17 00:00:00 2001 From: Anka Date: Mon, 28 Apr 2025 01:41:06 +0000 Subject: [PATCH 024/359] upgrade ijkffmpeg to ijkffmpeg-4.0-250428093705 for android by cd --- configs/libs/ijkffmpeg.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/libs/ijkffmpeg.sh b/configs/libs/ijkffmpeg.sh index cbc08a8c1..7a22f89fd 100644 --- a/configs/libs/ijkffmpeg.sh +++ b/configs/libs/ijkffmpeg.sh @@ -41,7 +41,7 @@ fi # pre compiled export PRE_COMPILE_TAG=ijkffmpeg-4.0-250311090211 -export PRE_COMPILE_TAG_ANDROID=ijkffmpeg-4.0-250311173526 +export PRE_COMPILE_TAG_ANDROID=ijkffmpeg-4.0-250428093705 export PRE_COMPILE_TAG_TVOS=ijkffmpeg-4.0-250311090211 export PRE_COMPILE_TAG_MACOS=ijkffmpeg-4.0-250311090211 export PRE_COMPILE_TAG_IOS=ijkffmpeg-4.0-250318094347 From c0034736b55834979887d295d2aa3d5b6279bb99 Mon Sep 17 00:00:00 2001 From: Anka Date: Tue, 29 Apr 2025 07:25:22 +0000 Subject: [PATCH 025/359] upgrade ijkffmpeg to ijkffmpeg-4.0-250429152137 for ios by cd --- configs/libs/ijkffmpeg.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/libs/ijkffmpeg.sh b/configs/libs/ijkffmpeg.sh index 7a22f89fd..1ceba85a6 100644 --- a/configs/libs/ijkffmpeg.sh +++ b/configs/libs/ijkffmpeg.sh @@ -44,5 +44,5 @@ export PRE_COMPILE_TAG=ijkffmpeg-4.0-250311090211 export PRE_COMPILE_TAG_ANDROID=ijkffmpeg-4.0-250428093705 export PRE_COMPILE_TAG_TVOS=ijkffmpeg-4.0-250311090211 export PRE_COMPILE_TAG_MACOS=ijkffmpeg-4.0-250311090211 -export PRE_COMPILE_TAG_IOS=ijkffmpeg-4.0-250318094347 +export PRE_COMPILE_TAG_IOS=ijkffmpeg-4.0-250429152137 From db6d712c1556128962415996695ac81ef8f3cb44 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Thu, 1 May 2025 10:48:49 +0800 Subject: [PATCH 026/359] rm a ffmpeg patch --- ...ry-when-avio-encounter-error-but-not.patch | 28 ------------------- 1 file changed, 28 deletions(-) delete mode 100644 patches/ffmpeg-n6.1/0031-let-avio-can-retry-when-avio-encounter-error-but-not.patch diff --git a/patches/ffmpeg-n6.1/0031-let-avio-can-retry-when-avio-encounter-error-but-not.patch b/patches/ffmpeg-n6.1/0031-let-avio-can-retry-when-avio-encounter-error-but-not.patch deleted file mode 100644 index 7b4f226c9..000000000 --- a/patches/ffmpeg-n6.1/0031-let-avio-can-retry-when-avio-encounter-error-but-not.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 3f0966825de7bf6ff6cb858c70f197fbeafe3419 Mon Sep 17 00:00:00 2001 -From: qianlongxu -Date: Thu, 17 Apr 2025 10:36:54 +0800 -Subject: [PATCH 31] let avio can retry when avio encounter error but not eof - ---- - libavformat/aviobuf.c | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c -index 2899c75..06012b7 100644 ---- a/libavformat/aviobuf.c -+++ b/libavformat/aviobuf.c -@@ -569,7 +569,10 @@ static void fill_buffer(AVIOContext *s) - s->eof_reached = 1; - - /* no need to do anything if EOF already reached */ -- if (s->eof_reached) -+ /* when "len = read_packet_wrapper(s, dst, len);" has error, eof_reached marked to 1 -+ * in effect the stream not eof but encounter network error -+ */ -+ if (s->eof_reached && !s->error) - return; - - if (s->update_checksum && dst == s->buffer) { --- -2.39.5 (Apple Git-154) - From 748acfccb22dcacda19064820cecd9a9640dce24 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Tue, 6 May 2025 17:50:47 +0800 Subject: [PATCH 027/359] fix dash unterminated entity reference: https://github.com/debugly/fsplayer/issues/7 --- ...ror-unterminated-entity-reference-du.patch | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 patches/ffmpeg-n6.1/0031-fix-dash-file-error-unterminated-entity-reference-du.patch diff --git a/patches/ffmpeg-n6.1/0031-fix-dash-file-error-unterminated-entity-reference-du.patch b/patches/ffmpeg-n6.1/0031-fix-dash-file-error-unterminated-entity-reference-du.patch new file mode 100644 index 000000000..d9fe1788c --- /dev/null +++ b/patches/ffmpeg-n6.1/0031-fix-dash-file-error-unterminated-entity-reference-du.patch @@ -0,0 +1,29 @@ +From aa792f13138a726d80df869f62ebf4769a851fef Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Tue, 6 May 2025 17:49:09 +0800 +Subject: [PATCH] fix dash file error "unterminated entity reference" due to + ampersand in tag + +--- + libavformat/dashdec.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c +index 1215407..0a6c46b 100644 +--- a/libavformat/dashdec.c ++++ b/libavformat/dashdec.c +@@ -804,8 +804,10 @@ static int resolve_content_path(AVFormatContext *s, const char *url, int *max_ur + memset(p + 1, 0, strlen(p)); + } + av_strlcat(tmp_str, text + start, tmp_max_url_size); +- xmlNodeSetContent(baseurl_nodes[i], tmp_str); ++ xmlChar *escaped = xmlEncodeSpecialChars(NULL, tmp_str); ++ xmlNodeSetContent(baseurl_nodes[i], escaped); + updated = 1; ++ xmlFree(escaped); + xmlFree(text); + } + } +-- +2.39.5 (Apple Git-154) + From a88f2b01f527b878b60d1e69a5bba529f6476909 Mon Sep 17 00:00:00 2001 From: Anka Date: Tue, 6 May 2025 10:08:51 +0000 Subject: [PATCH 028/359] upgrade ffmpeg to ffmpeg-6.1.1-250506175256 for apple by cd --- configs/libs/ffmpeg.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configs/libs/ffmpeg.sh b/configs/libs/ffmpeg.sh index 008512877..1e972fc90 100644 --- a/configs/libs/ffmpeg.sh +++ b/configs/libs/ffmpeg.sh @@ -41,8 +41,8 @@ fi # pre compiled export PRE_COMPILE_TAG=ffmpeg-6.1.2-250227145407 -export PRE_COMPILE_TAG_TVOS=ffmpeg-6.1.1-250409175104 -export PRE_COMPILE_TAG_MACOS=ffmpeg-6.1.1-250409175104 -export PRE_COMPILE_TAG_IOS=ffmpeg-6.1.1-250409175104 +export PRE_COMPILE_TAG_TVOS=ffmpeg-6.1.1-250506175256 +export PRE_COMPILE_TAG_MACOS=ffmpeg-6.1.1-250506175256 +export PRE_COMPILE_TAG_IOS=ffmpeg-6.1.1-250506175256 export PRE_COMPILE_TAG_ANDROID=ffmpeg-6.1.2-250310113110 From a39c894b6e8c0e4dc2fabc84a6bb60993de527fd Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Tue, 13 May 2025 16:03:25 +0800 Subject: [PATCH 029/359] enable flv,mkv,avi,webm muxer, enable bsf by default --- configs/ffconfig/module-full.sh | 40 +++++++++++++++------------------ 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/configs/ffconfig/module-full.sh b/configs/ffconfig/module-full.sh index 0a8896101..01c49b3b6 100755 --- a/configs/ffconfig/module-full.sh +++ b/configs/ffconfig/module-full.sh @@ -334,19 +334,15 @@ export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-demuxer=srt" export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-demuxer=vobsub" # ./configure --list-muxers export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-muxers" -# mp4 muxer depends below: export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-muxer=mov" -export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-bsf=vp9_superframe" -export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-bsf=aac_adtstoasc" -export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-parser=ac3" export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-muxer=mp4" export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-muxer=gif" -# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-muxer=flv" -# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-muxer=mkv" -# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-muxer=webm" -# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-muxer=avi" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-muxer=flv" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-muxer=matroska" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-muxer=avi" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-muxer=webm" + # export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-muxer=rm" -# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-muxer=mov" # export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-muxer=mpegts" # export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-muxer=image2" # export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-muxer=asf" @@ -402,22 +398,22 @@ export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-demuxer=dsf" #for .dsf # ./configure --list-bsf export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-bsfs" -export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-bsf=chomp" -export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-bsf=dca_core" -export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-bsf=dump_extradata" -export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-bsf=imx_dump_header" -export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-bsf=mjpeg2jpeg" -export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-bsf=mjpega_dump_header" -export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-bsf=mov2textsub" -export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-bsf=mp3_header_decompress" -export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-bsf=mpeg4_unpack_bframes" -export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-bsf=noise" -export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-bsf=remove_extradata" -export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-bsf=text2movsub" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-bsf=chomp" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-bsf=dca_core" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-bsf=dump_extradata" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-bsf=imx_dump_header" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-bsf=mjpeg2jpeg" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-bsf=mjpega_dump_header" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-bsf=mov2textsub" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-bsf=mp3_header_decompress" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-bsf=mpeg4_unpack_bframes" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-bsf=noise" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-bsf=remove_extradata" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-bsf=text2movsub" # Undefined symbols for architecture x86_64: # "_ff_ac3_parse_header", referenced from: # _eac3_core_filter in libavcodec.a(eac3_core_bsf.o) -export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-bsf=eac3_core" +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-bsf=eac3_core" # ./configure --list-protocols export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-protocols" export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-protocol=async" From f6e144271dd125fc7f3b558c18439f18fea48ab6 Mon Sep 17 00:00:00 2001 From: vinayhvaghamshi Date: Tue, 13 May 2025 21:46:11 +0530 Subject: [PATCH 030/359] Minor updates and code cleanup --- configs/default.sh | 4 +++- do-compile/android/any.sh | 9 +++++++-- do-init/copy-local-repo.sh | 4 ++-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/configs/default.sh b/configs/default.sh index 3882ea9cd..f57c7631d 100644 --- a/configs/default.sh +++ b/configs/default.sh @@ -18,7 +18,9 @@ # when '-l all' will use blew default config: apple_default_libs="openssl opus dav1d dvdread freetype fribidi harfbuzz unibreak ass ffmpeg smb2 bluray" +android_default_libs="openssl opus dav1d dvdread xml2 freetype fribidi harfbuzz unibreak fontconfig ass ffmpeg smb2 bluray" + export ios_default_libs="$apple_default_libs" export macos_default_libs="$apple_default_libs" export tvos_default_libs="$apple_default_libs" -export android_default_libs="$apple_default_libs" \ No newline at end of file +export android_default_libs="$android_default_libs" diff --git a/do-compile/android/any.sh b/do-compile/android/any.sh index 4a7d42884..d5ace043d 100755 --- a/do-compile/android/any.sh +++ b/do-compile/android/any.sh @@ -29,8 +29,13 @@ do_lipo_lib() { for arch in $archs; do local lib_dir="$MR_PRODUCT_ROOT/$LIB_NAME-$arch" - sed -i "" "s|-lpthread|-pthread|" "$lib_dir"/lib/pkgconfig/*.pc + if [ -d "$lib_dir" ]; then + # Fix .pc files + sed -i.bak 's|-lpthread|-pthread|' "$lib_dir"/lib/pkgconfig/*.pc + find "$lib_dir"/lib/pkgconfig -name "*.bak" -delete + + # Copy the directory mkdir -p "$MR_UNI_PROD_DIR/$LIB_NAME" cp -Rf "$lib_dir" "$MR_UNI_PROD_DIR/$LIB_NAME" else @@ -136,4 +141,4 @@ function main() { esac } -main \ No newline at end of file +main diff --git a/do-init/copy-local-repo.sh b/do-init/copy-local-repo.sh index 6f4986bfc..702fd7b37 100755 --- a/do-init/copy-local-repo.sh +++ b/do-init/copy-local-repo.sh @@ -26,7 +26,7 @@ function main() { local dest_repo=$2 cd $src_repo - local full_src_repo_path="file://"$(PWD) + local full_src_repo_path="file://$(PWD)" cd - >/dev/null if [[ -d $dest_repo ]]; then @@ -37,4 +37,4 @@ function main() { git clone -b localBranch "$full_src_repo_path" $dest_repo --depth=1 } -main $* \ No newline at end of file +main $* From 0507f48e6a8bd8828b9f4793d9cc5ada8d4ec359 Mon Sep 17 00:00:00 2001 From: vinayhvaghamshi Date: Tue, 13 May 2025 22:53:02 +0530 Subject: [PATCH 031/359] Fix minor typo and formatting issues --- do-compile/android/ass.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/do-compile/android/ass.sh b/do-compile/android/ass.sh index 0e5862fab..5f1ce351e 100755 --- a/do-compile/android/ass.sh +++ b/do-compile/android/ass.sh @@ -37,6 +37,7 @@ check_lib 'freetype2' check_lib 'fribidi' check_lib 'harfbuzz' check_lib 'libunibreak' +check_lib 'fontconfig' echo "----------------------" -./meson-compatible.sh "-Dtest=false -Dprofile=false -Dfontconfig=enabled -Dcoretext=disabled -Dasm=disabled -Dlibunibreak=enabled" \ No newline at end of file +./meson-compatible.sh "-Dtest=false -Dprofile=false -Dfontconfig=enabled -Dcoretext=disabled -Dasm=disabled -Dlibunibreak=enabled" From eb5a4fd01aa33ca3a83db70122269f32088ddf87 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Tue, 20 May 2025 10:43:16 +0800 Subject: [PATCH 032/359] update android default libs --- configs/default.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configs/default.sh b/configs/default.sh index f57c7631d..dacf0eeff 100644 --- a/configs/default.sh +++ b/configs/default.sh @@ -16,9 +16,9 @@ # # when '-l all' will use blew default config: -apple_default_libs="openssl opus dav1d dvdread freetype fribidi harfbuzz unibreak ass ffmpeg smb2 bluray" +apple_default_libs="openssl opus dav1d dvdread xml2 freetype fribidi harfbuzz unibreak ass ffmpeg smb2 bluray" -android_default_libs="openssl opus dav1d dvdread xml2 freetype fribidi harfbuzz unibreak fontconfig ass ffmpeg smb2 bluray" +android_default_libs="openssl opus dav1d dvdread xml2 freetype fribidi harfbuzz unibreak fontconfig ass ffmpeg smb2 bluray soundtouch" export ios_default_libs="$apple_default_libs" export macos_default_libs="$apple_default_libs" From ea60866787a050149a06bd5c566ed51019ab0978 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Tue, 20 May 2025 11:02:13 +0800 Subject: [PATCH 033/359] fix sed cmd --- do-compile/android/any.sh | 5 +---- tools/export-android-host-env.sh | 13 +++++++++++++ tools/export-apple-host-env.sh | 14 +++++++++++++- tools/parse-arguments.sh | 16 ++++++++-------- 4 files changed, 35 insertions(+), 13 deletions(-) diff --git a/do-compile/android/any.sh b/do-compile/android/any.sh index d5ace043d..9071cc055 100755 --- a/do-compile/android/any.sh +++ b/do-compile/android/any.sh @@ -31,10 +31,7 @@ do_lipo_lib() { local lib_dir="$MR_PRODUCT_ROOT/$LIB_NAME-$arch" if [ -d "$lib_dir" ]; then - # Fix .pc files - sed -i.bak 's|-lpthread|-pthread|' "$lib_dir"/lib/pkgconfig/*.pc - find "$lib_dir"/lib/pkgconfig -name "*.bak" -delete - + my_sed_i "s|-lpthread|-pthread|" "$lib_dir"/lib/pkgconfig/*.pc # Copy the directory mkdir -p "$MR_UNI_PROD_DIR/$LIB_NAME" cp -Rf "$lib_dir" "$MR_UNI_PROD_DIR/$LIB_NAME" diff --git a/tools/export-android-host-env.sh b/tools/export-android-host-env.sh index afc7a6b3b..335782676 100644 --- a/tools/export-android-host-env.sh +++ b/tools/export-android-host-env.sh @@ -27,6 +27,19 @@ function install_depends() { echo "[✅] ${name}: $(eval $name --version)" } +# 定义跨平台sed函数 +my_sed_i() { + if [[ "$(uname)" == "Darwin" ]]; then + # macOS系统 + sed -i '' "$@" + else + # Linux系统及其他系统 + sed -i "$@" + fi +} + +export -f my_sed_i + case "$OSTYPE" in darwin*) HOST_TAG="darwin-x86_64"; export -f install_depends ;; linux*) HOST_TAG="linux-x86_64" ;; diff --git a/tools/export-apple-host-env.sh b/tools/export-apple-host-env.sh index a5dbedfd2..692f54e59 100644 --- a/tools/export-apple-host-env.sh +++ b/tools/export-apple-host-env.sh @@ -43,4 +43,16 @@ function install_depends() { echo "[✅] ${name}: $(eval $name --version)" } -export -f install_depends \ No newline at end of file +# 定义跨平台sed函数 +my_sed_i() { + if [[ "$(uname)" == "Darwin" ]]; then + # macOS系统 + sed -i '' "$@" + else + # Linux系统及其他系统 + sed -i "$@" + fi +} + +export -f install_depends +export -f my_sed_i \ No newline at end of file diff --git a/tools/parse-arguments.sh b/tools/parse-arguments.sh index a018a69a5..281de2fa3 100644 --- a/tools/parse-arguments.sh +++ b/tools/parse-arguments.sh @@ -92,7 +92,7 @@ function correct_pc_file(){ echo "fix pc files in folder: $fix_path" cd "$fix_path" - + for pc in `find . -type f -name "*.pc"` ; do local pkgconfig=$(cd $(dirname "$pc"); pwd) @@ -100,13 +100,13 @@ function correct_pc_file(){ local base_dir=$(cd $(dirname "$lib_dir"); pwd) local include_dir="${base_dir}/include" local bin_dir="${base_dir}/bin" - - sed -i "" "s|^prefix=.*|prefix=$base_dir|" "$pc" - sed -i "" "s|^exec_prefix=[^$].*|exec_prefix=$bin_dir|" $pc - sed -i "" "s|^libdir=[^$].*|libdir=$lib_dir|" "$pc" - sed -i "" "s|^includedir=[^$].*include|includedir=$include_dir|" "$pc" - sed -i "" "s|-L/[^ ]*lib|-L$lib_dir|" "$pc" - sed -i "" "s|-I/[^ ]*include|-I$include_dir|" "$pc" + + my_sed_i "s|^prefix=.*|prefix=$base_dir|" "$pc" + my_sed_i "s|^exec_prefix=[^$].*|exec_prefix=$bin_dir|" $pc + my_sed_i "s|^libdir=[^$].*|libdir=$lib_dir|" "$pc" + my_sed_i "s|^includedir=[^$].*include|includedir=$include_dir|" "$pc" + my_sed_i "s|-L/[^ ]*lib|-L$lib_dir|" "$pc" + my_sed_i "s|-I/[^ ]*include|-I$include_dir|" "$pc" done cd "$dir" From 0e37d5aa0d255e81075f2916374b9d7089422115 Mon Sep 17 00:00:00 2001 From: Anka Date: Tue, 20 May 2025 03:41:17 +0000 Subject: [PATCH 034/359] upgrade ffmpeg to ffmpeg-6.1.1-250520112635 for apple by cd --- configs/libs/ffmpeg.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configs/libs/ffmpeg.sh b/configs/libs/ffmpeg.sh index 1e972fc90..70c038a0f 100644 --- a/configs/libs/ffmpeg.sh +++ b/configs/libs/ffmpeg.sh @@ -41,8 +41,8 @@ fi # pre compiled export PRE_COMPILE_TAG=ffmpeg-6.1.2-250227145407 -export PRE_COMPILE_TAG_TVOS=ffmpeg-6.1.1-250506175256 -export PRE_COMPILE_TAG_MACOS=ffmpeg-6.1.1-250506175256 -export PRE_COMPILE_TAG_IOS=ffmpeg-6.1.1-250506175256 +export PRE_COMPILE_TAG_TVOS=ffmpeg-6.1.1-250520112635 +export PRE_COMPILE_TAG_MACOS=ffmpeg-6.1.1-250520112635 +export PRE_COMPILE_TAG_IOS=ffmpeg-6.1.1-250520112635 export PRE_COMPILE_TAG_ANDROID=ffmpeg-6.1.2-250310113110 From a968c67fa454b8767fca5d5884446ce26d879ed4 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Tue, 20 May 2025 11:44:00 +0800 Subject: [PATCH 035/359] update readme --- README.md | 147 +++++++++++++++++++----------------------------------- 1 file changed, 51 insertions(+), 96 deletions(-) diff --git a/README.md b/README.md index 00156ac53..159daf79e 100644 --- a/README.md +++ b/README.md @@ -10,12 +10,12 @@ At present MRFFToolChain contained `ass、bluray、dav1d、dvdread、ffmpeg、fr ## Supported Plat -| platform | architectures | minimum deployment target | -| ----- | -------------------------------------- |----- | -| iOS | arm64、arm64_simulator、x86_64_simulator | 11.0 | -| tvOS | arm64、arm64_simulator、x86_64_simulator | 12.0 | -| macOS | arm64、x86_64 | 10.11 | -| Android | arm64、armv7a、x86_64、x86 | 21 | +| platform | architectures | minimum deployment target | +| ----- | --------------------------------------|---------------------------- | +| iOS | arm64、arm64_simulator、x86_64_simulator | 11.0 | +| tvOS | arm64、arm64_simulator、x86_64_simulator | 12.0 | +| macOS | arm64、x86_64 | 10.11 | +| Android | arm64、armv7a、x86_64、x86 | 21 | ## News @@ -37,128 +37,83 @@ At present MRFFToolChain contained `ass、bluray、dav1d、dvdread、ffmpeg、fr Tips: ``` -1、FFmpeg is not denpendent on Ass. -2、ijkplayer is denpendent on FFmpeg and Ass. -3、when install pre-compiled lib, will containes it's denpendencies. +1、ffmpeg is not denpendent on ass. +2、fsplayer is denpendent on ffmpeg and ass. +3、ijkplayer is denpendent on ijkffmpeg. +4、FFmpegTutorial is denpendent on fftutorial. +4、when install pre-compiled lib, will containes it's denpendencies. ``` -## Folder structure +## Download/Install Pre-compiled Libs -``` -├── README.md -├── build #编译目录 -│   ├── extra #源码仓库 -│   ├── pre #下载的预编译库 -│   ├── product #编译产物 -│   └── src #构建时源码仓库 -├── configs #三方库配置信息 -│   ├── default.sh -│   ├── ffconfig #FFmpeg功能裁剪选项 -│   ├── libs #三方库具体配置,包括库名,git仓库地址等信息 -│   └── meson-crossfiles -├── do-compile #三方库编译过程 -│   ├── android #安卓平台 -│   └── apple #苹果平台 -├── do-init #初始化三方库仓库 -│   ├── copy-local-repo.sh -│   ├── init-repo.sh -│   └── main.sh -├── do-install #下载安装预编译的三方库 -│   ├── download-uncompress.sh -│   ├── install-pre-lib.sh -│   ├── install-pre-xcf.sh -│   └── main.sh -├── main.sh #脚本入口 -├── patches #给三方库打的补丁 -│   ├── bluray -│   ├── ffmpeg -> ffmpeg-n6.1 -│   ├── ffmpeg-n4.0 -│   ├── ffmpeg-n5.1 -│   ├── ffmpeg-n6.1 -│   ├── ffmpeg-release-5.1 -│   ├── smb2 -│   ├── smb2-4.0.0 -│   ├── uavs3d -│   └── yuv -└── tools #通用工具方法 - ├── export-android-build-env.sh - ├── export-android-host-env.sh - ├── export-android-pkg-config-dir.sh - ├── export-apple-build-env.sh - ├── export-apple-host-env.sh - ├── export-apple-pkg-config-dir.sh - ├── gas-preprocessor.pl - ├── ios.toolchain.cmake - ├── parse-arguments.sh - └── prepare-build-workspace.sh -``` - -## Download/Install Pre-compiled libs - -直接从 github 下载我预编译好的库,这种方式可节省大量时间。 - -预编译库已经将 patches 目录下的补丁全部打上了。 +Save yourself a great deal of time by directly downloading the pre-compiled libraries from GitHub. -安装方法: +These pre-compiled libraries already applied patches which in the patches directory. ```bash -#查看帮助是个好习惯 +#Check the help first ./main.sh install --help -# 使用方式随便举例: +# Examples of usage: ./main.sh install -p macos -l ffmpeg ./main.sh install -p ios -l 'ass ffmpeg' ./main.sh install -p tvos -l all ./main.sh install -p android -l all ``` -## Compile by yourself +## Compile by Yourself -### Init lib repos +### Initialize Library Repositories -不要浪费自己的时间去编译这些库,除非你修改了源码! -直接下载我白嫖 github 预先编译好的库不好么! +Don't waste your time compiling these libraries unless you've modified the source code! +Why not just download the pre-compiled libraries I've prepared using GitHub actions? -脚本参数比较灵活,可根据需要搭配使用,常用方式举例: +The script parameters are flexible and can be combined as needed. Here are some common examples: ``` -#查看帮助是个好习惯 +# Check the help first ./main.sh init --help -#准备 iOS 平台源码所有库的源码 +# Prepare source code for all libraries for the iOS platform ./main.sh init -p ios -l all -#准备 iOS 平台x86架构下所有库的源码 +# Prepare source code for all libraries for the x86 architecture on iOS ./main.sh init -p ios -l all -a x86_64_simulator -#准备 macOS 平台源码所有库的源码 +# Prepare source code for all libraries for the macOS platform ./main.sh init -p macos -l all -#准备 iOS 平台的某些库的源码 +# Prepare source code for specific libraries for the iOS platform ./main.sh init -p ios -l "openssl ffmpeg" -#准备 Android 平台的某些库的源码 -./main.sh init -p anroid -l "openssl ffmpeg" +# Prepare source code for specific libraries for the Android platform +./main.sh init -p android -l "openssl ffmpeg" ``` ### Compile -查看帮助是个好习惯 +Once the source code repository initialization is complete, you can start the compilation process. ``` +# Check the help first ./main.sh compile --help -# 根据帮助可知 -p 参数指定平台;-c 参数指定行为,比如:build是编译,rebuild是重编等; -l 指定要编译的库;-a 指定 cpu 架构。 +# As shown in the help: +# -p specifies the platform +# -c specifies the action (e.g., build for compilation, rebuild for recompilation) +# -l specifies the libraries to compile +# -a specifies the CPU architecture ``` -使用方式随便举例: + +Examples of usage: ``` -#比如编译 ios 平台所有依赖库 + Compile all dependencies for the iOS platform ./main.sh compile -c build -p ios -l all -#比如编译 ios 平台 arm64 架构下的 libass 库 +# Compile the libass library for the arm64 architecture on iOS ./main.sh compile -c build -p ios -a arm64 -l ass ``` -脚本对于这些参数的顺序没有要求,可以随意摆放。 +The order of these parameters does not matter; they can be arranged in any sequence. ### Support Mirror -如果 github 上的仓库克隆较慢,或者需要使用内网私有仓库,可在执行编译脚本前声明对应的环境变量! +If cloning repositories from GitHub is slow, or if you need to use an internal private repository, you can declare the corresponding environment variables before running the compilation script! -| 名称 | 当前版本| 仓库地址 | 使用镜像 | +| Lib Name | Current Version | Repository URL | Mirror Repository URL | | ----------- | -------| ------------------------------------------------------- | -------------------------------------------------------- | | FFmpeg | 6.1.2 | https://github.com/FFmpeg/FFmpeg.git | export GIT_FFMPEG_UPSTREAM = git@xx:yy/FFmpeg.git | | ass | 0.17.3 | https://github.com/libass/libass.git | export GIT_ASS_UPSTREAM = git@xx:yy/libass.git | @@ -180,6 +135,12 @@ Tips: ## Tips +- To download pre-compiled xcframework libraries, add the --fmwk parameter when using the install command. +- To skip pulling remote repositories during initialization, add the --skip-pull-base parameter when using the init command. +- To skip applying FFmpeg patches during initialization, add the --skip-patches parameter when using the init command. +- Currently, FFmpeg uses the module-full.sh configuration, resulting in slightly larger package sizes. +- You can download all pre-compiled GitHub libraries to your own server and specify your server address using MR_DOWNLOAD_BASEURL before running the install command. + - 可下载预编译的 xcframework 库,只需要在 install 时加上 --fmwk 参数 - 初始化仓库时,可跳过拉取远端到本地,只需要在 init 时加上 --skip-pull-base 参数 - 初始化仓库时,可跳过应用 FFmpeg 的补丁,只需要在 init 时加上 --skip-patches 参数 @@ -188,14 +149,8 @@ Tips: ## Donate -编译三方库很费时间,本人想为开源社区贡献一份微薄的力量,因此将 debugly/ijkplayer 依赖的三方库,全部预编成静态库和 xcframework 供大家使用。 - -如果您想要为开源社区贡献一份力量,请买杯咖啡给我提提神儿。 - -![donate.jpg](https://i.postimg.cc/xdVqnBLp/IMG-7481.jpg) +Compiling third-party libraries is time-consuming. I aim to contribute to the open-source community by pre-compiling all third-party libraries required by debugly/ijkplayer into static libraries and xcframeworks for public use. -感谢以下朋友对 debugly/MRFFToolChainBuildShell 的支持: +If you'd like to contribute to the open-source community, consider buying me a coffee to keep me energized. -- 海阔天也空 -- 小猪猪 -- 1996GJ +![donate.jpg](https://i.postimg.cc/xdVqnBLp/IMG-7481.jpg) \ No newline at end of file From 51481ce5e91bad391e4b7da8aba1cacac5576112 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Tue, 20 May 2025 11:45:24 +0800 Subject: [PATCH 036/359] update readme --- README.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/README.md b/README.md index 159daf79e..c286b0695 100644 --- a/README.md +++ b/README.md @@ -141,12 +141,6 @@ If cloning repositories from GitHub is slow, or if you need to use an internal p - Currently, FFmpeg uses the module-full.sh configuration, resulting in slightly larger package sizes. - You can download all pre-compiled GitHub libraries to your own server and specify your server address using MR_DOWNLOAD_BASEURL before running the install command. -- 可下载预编译的 xcframework 库,只需要在 install 时加上 --fmwk 参数 -- 初始化仓库时,可跳过拉取远端到本地,只需要在 init 时加上 --skip-pull-base 参数 -- 初始化仓库时,可跳过应用 FFmpeg 的补丁,只需要在 init 时加上 --skip-patches 参数 -- 目前 FFmpeg 使用的是 module-full.sh 配置选项,所以包体积略大 -- 可以自己把 Github 预编译的库全部下载放到自己的服务器上,在 install 前使用 MR_DOWNLOAD_BASEURL 指定自己的服务器地址 - ## Donate Compiling third-party libraries is time-consuming. I aim to contribute to the open-source community by pre-compiling all third-party libraries required by debugly/ijkplayer into static libraries and xcframeworks for public use. From c98a0f480e6b99be710ae2cf4fe011687a61a29a Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Thu, 29 May 2025 14:38:48 +0800 Subject: [PATCH 037/359] ffmpeg use 7.1.1 --- configs/ffconfig/auto-detect-third-libs.sh | 87 +- configs/libs/ffmpeg.sh | 4 +- patches/ffmpeg | 2 +- ...k-h264_ps-null-pointer-fault-toleran.patch | 52 + ...re-ijk-hls-support-discontinuity-tag.patch | 145 ++ ...k-avformat-add-application-and-dns_c.patch | 670 ++++++++ .../0004-restore-ijk-http-event-hooks.patch | 287 ++++ .../0005-restore-ijk-tcp-dns-cache.patch | 404 +++++ ...ijk-custom-protocols-except-long-url.patch | 282 ++++ ...ict_get-that-converts-the-value-to-a.patch | 90 ++ ...-add-4-dummy-ijkplaceholder-demuxers.patch | 41 + .../0009-add-3-dummy-ijkhttp-protocols.patch | 42 + ...tp-impl-was-used-by-set-selected_htt.patch | 128 ++ ...kable-value-range-0-means-streamed-c.patch | 26 + ...0012-fix-lrcdec-read-line-bug-on-osx.patch | 43 + ...index-only-keyframes-to-ensure-accur.patch | 47 + .../0014-support-inherit-hls-opts.patch | 113 ++ ...o-00-00-bug-baidu-neddisk-hls-start_.patch | 29 + ...g-codecpar-codec_id-which-read-from-.patch | 60 + ...-to-detect-if-stream-position-has-be.patch | 74 + ...-transfer-get-wrong-size-cause-av_re.patch | 32 + ...-not-very-useful-log-use-trace-level.patch | 76 + ...ror-unterminated-entity-reference-du.patch | 29 + ...er-and-Demuxer-but-av3a-Decoder-is-a.patch | 1359 +++++++++++++++++ ...2-http-add-reconnect_first_delay-opt.patch | 41 + ...d-http_seek-redirect-authentication-.patch | 92 ++ ...s-only-available-on-iOS-13.0-or-newe.patch | 25 + ...structed-wrong-avcc-for-videotoolbox.patch | 58 + ...d-built-in-smb2-protocol-via-libsmb2.patch | 495 ++++++ ...-add-url_parse_priv-function-pointer.patch | 55 + ...028-bluray-protocol-add-dvd-fallback.patch | 54 + ...fs-for-network-Blu-ray-Disc-and-BDMV.patch | 673 ++++++++ ...find-the-right-m2ts-then-read-seek-i.patch | 70 + ...-demuxer-https-github.com-bluez-sh-F.patch | 648 ++++++++ ...l-https-ffmpeg.org-pipermail-ffmpeg-.patch | 519 +++++++ .../todo/0042-Adapt-to-clang-16.patch | 31 + 36 files changed, 6872 insertions(+), 11 deletions(-) create mode 100644 patches/ffmpeg-n7.1.1/0001-restore-ijk-h264_ps-null-pointer-fault-toleran.patch create mode 100644 patches/ffmpeg-n7.1.1/0002-restore-ijk-hls-support-discontinuity-tag.patch create mode 100644 patches/ffmpeg-n7.1.1/0003-restore-ijk-avformat-add-application-and-dns_c.patch create mode 100644 patches/ffmpeg-n7.1.1/0004-restore-ijk-http-event-hooks.patch create mode 100644 patches/ffmpeg-n7.1.1/0005-restore-ijk-tcp-dns-cache.patch create mode 100644 patches/ffmpeg-n7.1.1/0006-restore-ijk-custom-protocols-except-long-url.patch create mode 100644 patches/ffmpeg-n7.1.1/0007-restore-ijk-av_dict_get-that-converts-the-value-to-a.patch create mode 100644 patches/ffmpeg-n7.1.1/0008-add-4-dummy-ijkplaceholder-demuxers.patch create mode 100644 patches/ffmpeg-n7.1.1/0009-add-3-dummy-ijkhttp-protocols.patch create mode 100644 patches/ffmpeg-n7.1.1/0010-control-which-http-impl-was-used-by-set-selected_htt.patch create mode 100644 patches/ffmpeg-n7.1.1/0011-correct-file-seekable-value-range-0-means-streamed-c.patch create mode 100644 patches/ffmpeg-n7.1.1/0012-fix-lrcdec-read-line-bug-on-osx.patch create mode 100644 patches/ffmpeg-n7.1.1/0013-avformat-mpegts-index-only-keyframes-to-ensure-accur.patch create mode 100644 patches/ffmpeg-n7.1.1/0014-support-inherit-hls-opts.patch create mode 100644 patches/ffmpeg-n7.1.1/0015-fix-can-t-seek-to-00-00-bug-baidu-neddisk-hls-start_.patch create mode 100644 patches/ffmpeg-n7.1.1/0016-Correct-the-wrong-codecpar-codec_id-which-read-from-.patch create mode 100644 patches/ffmpeg-n7.1.1/0017-avformat-mov-fix-to-detect-if-stream-position-has-be.patch create mode 100644 patches/ffmpeg-n7.1.1/0018-fix-http-chunked-transfer-get-wrong-size-cause-av_re.patch create mode 100644 patches/ffmpeg-n7.1.1/0019-not-very-useful-log-use-trace-level.patch create mode 100644 patches/ffmpeg-n7.1.1/0020-fix-dash-file-error-unterminated-entity-reference-du.patch create mode 100644 patches/ffmpeg-n7.1.1/0021-Audio-Vivid-Parser-and-Demuxer-but-av3a-Decoder-is-a.patch create mode 100644 patches/ffmpeg-n7.1.1/0022-http-add-reconnect_first_delay-opt.patch create mode 100644 patches/ffmpeg-n7.1.1/0023-fix-http-open-and-http_seek-redirect-authentication-.patch create mode 100644 patches/ffmpeg-n7.1.1/0024-supportsFamily-is-only-available-on-iOS-13.0-or-newe.patch create mode 100644 patches/ffmpeg-n7.1.1/0025-fix-ffmpeg-constructed-wrong-avcc-for-videotoolbox.patch create mode 100644 patches/ffmpeg-n7.1.1/0026-add-built-in-smb2-protocol-via-libsmb2.patch create mode 100644 patches/ffmpeg-n7.1.1/0027-URLProtocol-add-url_parse_priv-function-pointer.patch create mode 100644 patches/ffmpeg-n7.1.1/0028-bluray-protocol-add-dvd-fallback.patch create mode 100644 patches/ffmpeg-n7.1.1/0029-custom-bluray-fs-for-network-Blu-ray-Disc-and-BDMV.patch create mode 100644 patches/ffmpeg-n7.1.1/0030-bluray-open-and-find-the-right-m2ts-then-read-seek-i.patch create mode 100644 patches/ffmpeg-n7.1.1/todo/0009-mov-support-heic-demuxer-https-github.com-bluez-sh-F.patch create mode 100644 patches/ffmpeg-n7.1.1/todo/0015-Adds-DVD-protocol-https-ffmpeg.org-pipermail-ffmpeg-.patch create mode 100644 patches/ffmpeg-n7.1.1/todo/0042-Adapt-to-clang-16.patch diff --git a/configs/ffconfig/auto-detect-third-libs.sh b/configs/ffconfig/auto-detect-third-libs.sh index 29f773e63..1ef361ab4 100644 --- a/configs/ffconfig/auto-detect-third-libs.sh +++ b/configs/ffconfig/auto-detect-third-libs.sh @@ -57,6 +57,55 @@ THIRD_CFG_FLAGS= # echo "[❌] --disable-libmp3lame" # fi + +# Function to compare two version numbers +# Returns: +# 1 if v1 == v2 or if v1 > v2 +# 0 if v1 < v2 +gt_or_equal() { + local v1=$1 + local v2=$2 + local IFS=. + # 将版本字符串按 "." 分割成数组 + # 例如 "7..1" 会变成 (7 "" 1) + local v1_parts=($v1) v2_parts=($v2) + local i + + # 确定两个版本号数组中的最大长度 + local len_v1=${#v1_parts[@]} + local len_v2=${#v2_parts[@]} + local max_len=$((len_v1 > len_v2 ? len_v1 : len_v2)) + + for ((i=0; i<$max_len; i++)); do + # 获取版本号的对应部分,如果部分缺失或为空字符串,则默认为 "0" + local p1_val=${v1_parts[i]:-0} + local p2_val=${v2_parts[i]:-0} + + # 进一步确保 p1_val 和 p2_val 是纯数字;如果不是,则视为 0 + # 这能处理像 "7.a.1" 这样包含非数字部分的情况 + if ! [[ "$p1_val" =~ ^[0-9]+$ ]]; then + p1_val=0 + fi + if ! [[ "$p2_val" =~ ^[0-9]+$ ]]; then + p2_val=0 + fi + + # 进行数字比较 + # 使用 10# 前缀确保按十进制处理 (例如 "08" 被视为 8 而不是八进制) + if ((10#$p1_val > 10#$p2_val)); then + echo 1 # v1 > v2 + return 0 + fi + if ((10#$p1_val < 10#$p2_val)); then + echo # v1 < v2 + return 0 + fi + done + + echo 1 # v1 == v2 (所有部分都相等) + return 0 +} + echo "----------------------" # use pkg-config fix ff4.0--ijk0.8.8--20210426--001 use openssl 1_1_1m occur can't find openssl error. @@ -81,10 +130,19 @@ else fi echo "----------------------" + # FFmpeg 4.2 支持AV1、AVS2等格式 # dav1d由VideoLAN,VLC和FFmpeg联合开发,项目由AOM联盟赞助,和libaom相比,dav1d性能普遍提升100%,最高提升400% -#just wait videotoolbox support decode av1 -# THIRD_CFG_FLAGS="$THIRD_CFG_FLAGS --enable-decoder=av1" +#从FFmpeg7.1.1开始支持硬解av1,苹果需要M3芯片 +result=$(gt_or_equal "$GIT_REPO_VERSION" "7.1.1") +if [[ $result ]]; then + echo "[✅] --enable hw av1 decoder" + THIRD_CFG_FLAGS="$THIRD_CFG_FLAGS --enable-decoder=av1" +else + echo "[❌] --disable hw av1 decoder" +fi + +echo "----------------------" pkg-config --libs dav1d --silence-errors >/dev/null && enable_dav1d=1 @@ -118,13 +176,26 @@ else fi echo "----------------------" -pkg-config --libs dvdread --silence-errors >/dev/null && enable_dvdread=1 - -if [[ $enable_dvdread ]];then - echo "[✅] --enable-libdvdread : $(pkg-config --modversion dvdread)" - THIRD_CFG_FLAGS="$THIRD_CFG_FLAGS --enable-libdvdread --enable-protocol=dvd" +#不确定7代之前的版本是否支持dvdvideo +result=$(gt_or_equal "$GIT_REPO_VERSION" "7.1.1") +if [[ $result ]]; then + pkg-config --libs dvdread --silence-errors >/dev/null && enable_dvdread=1 + pkg-config --libs dvdnav --silence-errors >/dev/null && enable_dvdnav=1 + if [[ $enable_dvdread && $enable_dvdnav ]];then + echo "[✅] --enable-demuxer=dvdvideo --enable-gpl --enable-libdvdread : $(pkg-config --modversion dvdread)" + #libdvdread is gpl and --enable-gpl is not specified. + THIRD_CFG_FLAGS="$THIRD_CFG_FLAGS --enable-libdvdread --enable-libdvdnav --enable-demuxer=dvdvideo --enable-gpl" + else + echo "[❌] --disable-dvdvideo" + fi else - echo "[❌] --disable-libdvdread --disable-protocol=dvd" + pkg-config --libs dvdread --silence-errors >/dev/null && enable_dvdread=1 + if [[ $enable_dvdread ]];then + echo "[✅] --enable-libdvdread : $(pkg-config --modversion dvdread)" + THIRD_CFG_FLAGS="$THIRD_CFG_FLAGS --enable-libdvdread --enable-protocol=dvd" + else + echo "[❌] --disable-dvd protocol" + fi fi echo "----------------------" diff --git a/configs/libs/ffmpeg.sh b/configs/libs/ffmpeg.sh index 70c038a0f..44cb515c9 100644 --- a/configs/libs/ffmpeg.sh +++ b/configs/libs/ffmpeg.sh @@ -35,8 +35,8 @@ if [[ "$GIT_FFMPEG_COMMIT" != "" ]] ;then export GIT_COMMIT="$GIT_FFMPEG_COMMIT" export GIT_REPO_VERSION="$GIT_FFMPEG_COMMIT" else - export GIT_COMMIT=n6.1.1 #origin/release/5.1 - export GIT_REPO_VERSION=6.1.1 + export GIT_COMMIT=n7.1.1 #origin/release/5.1 + export GIT_REPO_VERSION=7.1.1 fi # pre compiled diff --git a/patches/ffmpeg b/patches/ffmpeg index 76e66e0b1..25fd4ffeb 120000 --- a/patches/ffmpeg +++ b/patches/ffmpeg @@ -1 +1 @@ -ffmpeg-n6.1 \ No newline at end of file +ffmpeg-n7.1.1 \ No newline at end of file diff --git a/patches/ffmpeg-n7.1.1/0001-restore-ijk-h264_ps-null-pointer-fault-toleran.patch b/patches/ffmpeg-n7.1.1/0001-restore-ijk-h264_ps-null-pointer-fault-toleran.patch new file mode 100644 index 000000000..ce2c0934b --- /dev/null +++ b/patches/ffmpeg-n7.1.1/0001-restore-ijk-h264_ps-null-pointer-fault-toleran.patch @@ -0,0 +1,52 @@ +From 393e5aabe3e0726210ec906fcec1f8208ce66ffa Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Wed, 28 May 2025 17:28:22 +0800 +Subject: [PATCH] restore ijk h264_ps null pointer fault tolerant + +--- + libavcodec/h264_ps.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/libavcodec/h264_ps.c b/libavcodec/h264_ps.c +index 3c8fc33..9c0dc50 100644 +--- a/libavcodec/h264_ps.c ++++ b/libavcodec/h264_ps.c +@@ -437,7 +437,7 @@ int ff_h264_decode_seq_parameter_set(GetBitContext *gb, AVCodecContext *avctx, + } + + sps->ref_frame_count = get_ue_golomb_31(gb); +- if (avctx->codec_tag == MKTAG('S', 'M', 'V', '2')) ++ if (avctx && avctx->codec_tag == MKTAG('S', 'M', 'V', '2')) + sps->ref_frame_count = FFMAX(2, sps->ref_frame_count); + if (sps->ref_frame_count > H264_MAX_DPB_FRAMES) { + av_log(avctx, AV_LOG_ERROR, +@@ -480,7 +480,7 @@ int ff_h264_decode_seq_parameter_set(GetBitContext *gb, AVCodecContext *avctx, + int width = 16 * sps->mb_width; + int height = 16 * sps->mb_height; + +- if (avctx->flags2 & AV_CODEC_FLAG2_IGNORE_CROP) { ++ if (avctx && avctx->flags2 & AV_CODEC_FLAG2_IGNORE_CROP) { + av_log(avctx, AV_LOG_DEBUG, "discarding sps cropping, original " + "values are l:%d r:%d t:%d b:%d\n", + crop_left, crop_right, crop_top, crop_bottom); +@@ -552,7 +552,7 @@ int ff_h264_decode_seq_parameter_set(GetBitContext *gb, AVCodecContext *avctx, + if (!sps->vui.sar.den) + sps->vui.sar.den = 1; + +- if (avctx->debug & FF_DEBUG_PICT_INFO) { ++ if (avctx && avctx->debug & FF_DEBUG_PICT_INFO) { + static const char csp[4][5] = { "Gray", "420", "422", "444" }; + av_log(avctx, AV_LOG_DEBUG, + "sps:%u profile:%d/%d poc:%d ref:%d %dx%d %s %s crop:%u/%u/%u/%u %s %s %"PRId32"/%"PRId32" b%d reo:%d\n", +@@ -819,7 +819,7 @@ int ff_h264_decode_picture_parameter_set(GetBitContext *gb, AVCodecContext *avct + if (pps->chroma_qp_index_offset[0] != pps->chroma_qp_index_offset[1]) + pps->chroma_qp_diff = 1; + +- if (avctx->debug & FF_DEBUG_PICT_INFO) { ++ if (avctx && avctx->debug & FF_DEBUG_PICT_INFO) { + av_log(avctx, AV_LOG_DEBUG, + "pps:%u sps:%u %s slice_groups:%d ref:%u/%u %s qp:%d/%d/%d/%d %s %s %s %s\n", + pps_id, pps->sps_id, +-- +2.39.5 (Apple Git-154) + diff --git a/patches/ffmpeg-n7.1.1/0002-restore-ijk-hls-support-discontinuity-tag.patch b/patches/ffmpeg-n7.1.1/0002-restore-ijk-hls-support-discontinuity-tag.patch new file mode 100644 index 000000000..066602274 --- /dev/null +++ b/patches/ffmpeg-n7.1.1/0002-restore-ijk-hls-support-discontinuity-tag.patch @@ -0,0 +1,145 @@ +From 2a82e6a5d412189c243cac24b3c9352e5c80e240 Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Wed, 28 May 2025 17:34:08 +0800 +Subject: [PATCH] restore ijk hls support discontinuity tag + +--- + libavformat/hls.c | 59 +++++++++++++++++++++++++++++++++++++++++------ + 1 file changed, 52 insertions(+), 7 deletions(-) + +diff --git a/libavformat/hls.c b/libavformat/hls.c +index b96c5ab..12b49c8 100644 +--- a/libavformat/hls.c ++++ b/libavformat/hls.c +@@ -75,6 +75,8 @@ enum KeyType { + }; + + struct segment { ++ int64_t previous_duration; ++ int64_t start_time; + int64_t duration; + int64_t url_offset; + int64_t size; +@@ -775,6 +777,8 @@ static int test_segment(AVFormatContext *s, const AVInputFormat *in_fmt, struct + static int parse_playlist(HLSContext *c, const char *url, + struct playlist *pls, AVIOContext *in) + { ++ int64_t previous_duration1 = 0, previous_duration = 0, total_duration = 0; ++ + int ret = 0, is_segment = 0, is_variant = 0; + int64_t duration = 0; + enum KeyType key_type = KEY_NONE; +@@ -846,6 +850,7 @@ static int parse_playlist(HLSContext *c, const char *url, + pls->finished = 0; + pls->type = PLS_TYPE_UNSPECIFIED; + } ++ int start_seq_no = -1; + while (!avio_feof(in)) { + ff_get_chomp_line(in, line, sizeof(line)); + if (av_strstart(line, "#EXT-X-STREAM-INF:", &ptr)) { +@@ -895,7 +900,11 @@ static int parse_playlist(HLSContext *c, const char *url, + "INT64_MAX/2, mask out the highest bit\n"); + seq_no &= INT64_MAX/2; + } +- pls->start_seq_no = seq_no; ++ /* Some buggy HLS servers write #EXT-X-MEDIA-SEQUENCE more than once */ ++ if (start_seq_no < 0) { ++ start_seq_no = seq_no; ++ pls->start_seq_no = seq_no; ++ } + } else if (av_strstart(line, "#EXT-X-PLAYLIST-TYPE:", &ptr)) { + ret = ensure_playlist(c, &pls, url); + if (ret < 0) +@@ -960,6 +969,8 @@ static int parse_playlist(HLSContext *c, const char *url, + } else if (av_strstart(line, "#EXT-X-ENDLIST", &ptr)) { + if (pls) + pls->finished = 1; ++ } else if (av_strstart(line, "#EXT-X-DISCONTINUITY", &ptr)) { ++ previous_duration = previous_duration1; + } else if (av_strstart(line, "#EXTINF:", &ptr)) { + is_segment = 1; + duration = atof(ptr) * AV_TIME_BASE; +@@ -1043,6 +1054,11 @@ static int parse_playlist(HLSContext *c, const char *url, + " set to default value to 1ms.\n", seg->url); + duration = 0.001 * AV_TIME_BASE; + } ++ previous_duration1 += duration; ++ seg->previous_duration = previous_duration; ++ seg->start_time = total_duration; ++ total_duration += duration; ++ + seg->duration = duration; + seg->key_type = key_type; + dynarray_add(&pls->segments, &pls->n_segments, seg); +@@ -2360,6 +2376,7 @@ static int hls_read_packet(AVFormatContext *s, AVPacket *pkt) + * stream */ + if (pls->needed && !pls->pkt->data) { + while (1) { ++ int64_t pkt_ts = AV_NOPTS_VALUE; + int64_t ts_diff; + AVRational tb; + struct segment *seg = NULL; +@@ -2373,12 +2390,40 @@ static int hls_read_packet(AVFormatContext *s, AVPacket *pkt) + if (pls->is_id3_timestamped && pls->pkt->stream_index == 0) { + /* audio elementary streams are id3 timestamped */ + fill_timing_for_id3_timestamped_stream(pls); ++ } else { ++ //discontinuity:ts pts need add up. ++ if (pls->finished) { ++ int seq_no = pls->cur_seq_no - pls->start_seq_no; ++ if (seq_no < pls->n_segments && s->streams[pkt->stream_index]) { ++ struct segment *seg = pls->segments[seq_no]; ++ if (seg->previous_duration > 0) { ++ int64_t pred = av_rescale_q(seg->previous_duration, ++ AV_TIME_BASE_Q, ++ s->streams[pkt->stream_index]->time_base); ++ int64_t max_ts = av_rescale_q(seg->start_time + seg->duration, ++ AV_TIME_BASE_Q, ++ s->streams[pkt->stream_index]->time_base); ++ /* EXTINF duration is not precise enough */ ++ max_ts += 2 * AV_TIME_BASE; ++ if (s->start_time > 0) { ++ max_ts += av_rescale_q(s->start_time, ++ AV_TIME_BASE_Q, ++ s->streams[pkt->stream_index]->time_base); ++ } ++ if (pls->pkt->dts != AV_NOPTS_VALUE && pls->pkt->dts + pred < max_ts) pls->pkt->dts += pred; ++ if (pls->pkt->pts != AV_NOPTS_VALUE && pls->pkt->pts + pred < max_ts) pls->pkt->pts += pred; ++ } ++ } ++ } + } + +- if (c->first_timestamp == AV_NOPTS_VALUE && +- pls->pkt->dts != AV_NOPTS_VALUE) +- c->first_timestamp = av_rescale_q(pls->pkt->dts, +- get_timebase(pls), AV_TIME_BASE_Q); ++ if (pls->pkt->pts != AV_NOPTS_VALUE) ++ pkt_ts = pls->pkt->pts; ++ else if (pls->pkt->dts != AV_NOPTS_VALUE) ++ pkt_ts = pls->pkt->dts; ++ ++ if (c->first_timestamp == AV_NOPTS_VALUE && pkt_ts != AV_NOPTS_VALUE) ++ c->first_timestamp = av_rescale_q(pkt_ts, get_timebase(pls), AV_TIME_BASE_Q); + } + + seg = current_segment(pls); +@@ -2395,13 +2440,13 @@ static int hls_read_packet(AVFormatContext *s, AVPacket *pkt) + if (pls->seek_stream_index < 0 || + pls->seek_stream_index == pls->pkt->stream_index) { + +- if (pls->pkt->dts == AV_NOPTS_VALUE) { ++ if (pkt_ts == AV_NOPTS_VALUE) { + pls->seek_timestamp = AV_NOPTS_VALUE; + break; + } + + tb = get_timebase(pls); +- ts_diff = av_rescale_rnd(pls->pkt->dts, AV_TIME_BASE, ++ ts_diff = av_rescale_rnd(pkt_ts, AV_TIME_BASE, + tb.den, AV_ROUND_DOWN) - + pls->seek_timestamp; + if (ts_diff >= 0 && (pls->seek_flags & AVSEEK_FLAG_ANY || +-- +2.39.5 (Apple Git-154) + diff --git a/patches/ffmpeg-n7.1.1/0003-restore-ijk-avformat-add-application-and-dns_c.patch b/patches/ffmpeg-n7.1.1/0003-restore-ijk-avformat-add-application-and-dns_c.patch new file mode 100644 index 000000000..c63420159 --- /dev/null +++ b/patches/ffmpeg-n7.1.1/0003-restore-ijk-avformat-add-application-and-dns_c.patch @@ -0,0 +1,670 @@ +From 00151c6634864504f71858aa015428294c6584bb Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Wed, 28 May 2025 17:37:31 +0800 +Subject: [PATCH] restore ijk avformat add application and dns_cache + +--- + libavformat/Makefile | 4 + + libavformat/application.c | 213 ++++++++++++++++++++++++++++++++++ + libavformat/application.h | 120 ++++++++++++++++++++ + libavformat/dns_cache.c | 232 ++++++++++++++++++++++++++++++++++++++ + libavformat/dns_cache.h | 39 +++++++ + 5 files changed, 608 insertions(+) + create mode 100644 libavformat/application.c + create mode 100644 libavformat/application.h + create mode 100644 libavformat/dns_cache.c + create mode 100644 libavformat/dns_cache.h + +diff --git a/libavformat/Makefile b/libavformat/Makefile +index 7ca68a7..e5934e9 100644 +--- a/libavformat/Makefile ++++ b/libavformat/Makefile +@@ -5,6 +5,8 @@ HEADERS = avformat.h \ + avio.h \ + version.h \ + version_major.h \ ++ application.h \ ++ dns_cache.h \ + + OBJS = allformats.o \ + avformat.o \ +@@ -30,6 +32,8 @@ OBJS = allformats.o \ + url.o \ + utils.o \ + version.o \ ++ application.o \ ++ dns_cache.o \ + + OBJS-$(HAVE_LIBC_MSVCRT) += file_open.o + +diff --git a/libavformat/application.c b/libavformat/application.c +new file mode 100644 +index 0000000..de093b9 +--- /dev/null ++++ b/libavformat/application.c +@@ -0,0 +1,213 @@ ++/* ++ * copyright (c) 2016 Zhang Rui ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#include "application.h" ++#include "libavformat/network.h" ++#include "libavutil/avstring.h" ++#include "libavutil/mem.h" ++ ++static int av_application_alloc(AVApplicationContext **ph, void *opaque) ++{ ++ AVApplicationContext *h = NULL; ++ ++ h = av_mallocz(sizeof(AVApplicationContext)); ++ if (!h) ++ return AVERROR(ENOMEM); ++ ++ h->opaque = opaque; ++ ++ *ph = h; ++ return 0; ++} ++ ++int av_application_open(AVApplicationContext **ph, void *opaque) ++{ ++ int ret = av_application_alloc(ph, opaque); ++ if (ret) ++ return ret; ++ ++ return 0; ++} ++ ++static void av_application_close(AVApplicationContext *h) ++{ ++ av_free(h); ++} ++ ++void av_application_closep(AVApplicationContext **ph) ++{ ++ if (!ph || !*ph) ++ return; ++ ++ av_application_close(*ph); ++ *ph = NULL; ++} ++ ++void av_application_on_http_event(AVApplicationContext *h, int event_type, AVAppHttpEvent *event) ++{ ++ if (h && h->func_on_app_event) ++ h->func_on_app_event(h, event_type, (void *)event, sizeof(AVAppHttpEvent)); ++} ++ ++void av_application_will_http_open(AVApplicationContext *h, void *obj, const char *url) ++{ ++ AVAppHttpEvent event = {0}; ++ ++ if (!h || !obj || !url) ++ return; ++ ++ event.obj = obj; ++ av_strlcpy(event.url, url, sizeof(event.url)); ++ ++ av_application_on_http_event(h, AVAPP_EVENT_WILL_HTTP_OPEN, &event); ++} ++ ++void av_application_did_http_open(AVApplicationContext *h, void *obj, const char *url, int error, int http_code, int64_t filesize) ++{ ++ AVAppHttpEvent event = {0}; ++ ++ if (!h || !obj || !url) ++ return; ++ ++ event.obj = obj; ++ av_strlcpy(event.url, url, sizeof(event.url)); ++ event.error = error; ++ event.http_code = http_code; ++ event.filesize = filesize; ++ ++ av_application_on_http_event(h, AVAPP_EVENT_DID_HTTP_OPEN, &event); ++} ++ ++void av_application_will_http_seek(AVApplicationContext *h, void *obj, const char *url, int64_t offset) ++{ ++ AVAppHttpEvent event = {0}; ++ ++ if (!h || !obj || !url) ++ return; ++ ++ event.obj = obj; ++ event.offset = offset; ++ av_strlcpy(event.url, url, sizeof(event.url)); ++ ++ av_application_on_http_event(h, AVAPP_EVENT_WILL_HTTP_SEEK, &event); ++} ++ ++void av_application_did_http_seek(AVApplicationContext *h, void *obj, const char *url, int64_t offset, int error, int http_code) ++{ ++ AVAppHttpEvent event = {0}; ++ ++ if (!h || !obj || !url) ++ return; ++ ++ event.obj = obj; ++ event.offset = offset; ++ av_strlcpy(event.url, url, sizeof(event.url)); ++ event.error = error; ++ event.http_code = http_code; ++ ++ av_application_on_http_event(h, AVAPP_EVENT_DID_HTTP_SEEK, &event); ++} ++ ++static void av_application_on_io_traffic(AVApplicationContext *h, AVAppIOTraffic *event) ++{ ++ if (h && h->func_on_app_event) ++ h->func_on_app_event(h, AVAPP_EVENT_IO_TRAFFIC, (void *)event, sizeof(AVAppIOTraffic)); ++} ++ ++int av_application_on_io_control(AVApplicationContext *h, int event_type, AVAppIOControl *control) ++{ ++ if (h && h->func_on_app_event) ++ return h->func_on_app_event(h, event_type, (void *)control, sizeof(AVAppIOControl)); ++ return 0; ++} ++ ++int av_application_on_tcp_will_open(AVApplicationContext *h) ++{ ++ if (h && h->func_on_app_event) { ++ AVAppTcpIOControl control = {0}; ++ return h->func_on_app_event(h, AVAPP_CTRL_WILL_TCP_OPEN, (void *)&control, sizeof(AVAppTcpIOControl)); ++ } ++ return 0; ++} ++ ++// only callback returns error ++int av_application_on_tcp_did_open(AVApplicationContext *h, int error, int fd, AVAppTcpIOControl *control) ++{ ++ struct sockaddr_storage so_stg; ++ int ret = 0; ++ socklen_t so_len = sizeof(so_stg); ++ int so_family; ++ char *so_ip_name = control->ip; ++ ++ if (!h || !h->func_on_app_event || fd <= 0) ++ return 0; ++ ++ ret = getpeername(fd, (struct sockaddr *)&so_stg, &so_len); ++ if (ret) ++ return 0; ++ control->error = error; ++ control->fd = fd; ++ ++ so_family = ((struct sockaddr*)&so_stg)->sa_family; ++ switch (so_family) { ++ case AF_INET: { ++ struct sockaddr_in* in4 = (struct sockaddr_in*)&so_stg; ++ if (inet_ntop(AF_INET, &(in4->sin_addr), so_ip_name, sizeof(control->ip))) { ++ control->family = AF_INET; ++ control->port = in4->sin_port; ++ } ++ break; ++ } ++ case AF_INET6: { ++ struct sockaddr_in6* in6 = (struct sockaddr_in6*)&so_stg; ++ if (inet_ntop(AF_INET6, &(in6->sin6_addr), so_ip_name, sizeof(control->ip))) { ++ control->family = AF_INET6; ++ control->port = in6->sin6_port; ++ } ++ break; ++ } ++ } ++ ++ return h->func_on_app_event(h, AVAPP_CTRL_DID_TCP_OPEN, (void *)control, sizeof(AVAppTcpIOControl)); ++} ++ ++void av_application_on_async_statistic(AVApplicationContext *h, AVAppAsyncStatistic *statistic) ++{ ++ if (h && h->func_on_app_event) ++ h->func_on_app_event(h, AVAPP_EVENT_ASYNC_STATISTIC, (void *)statistic, sizeof(AVAppAsyncStatistic)); ++} ++ ++void av_application_on_async_read_speed(AVApplicationContext *h, AVAppAsyncReadSpeed *speed) ++{ ++ if (h && h->func_on_app_event) ++ h->func_on_app_event(h, AVAPP_EVENT_ASYNC_READ_SPEED, (void *)speed, sizeof(AVAppAsyncReadSpeed)); ++} ++ ++void av_application_did_io_tcp_read(AVApplicationContext *h, void *obj, int bytes) ++{ ++ AVAppIOTraffic event = {0}; ++ if (!h || !obj || bytes <= 0) ++ return; ++ ++ event.obj = obj; ++ event.bytes = bytes; ++ ++ av_application_on_io_traffic(h, &event); ++} +diff --git a/libavformat/application.h b/libavformat/application.h +new file mode 100644 +index 0000000..b9e7f5b +--- /dev/null ++++ b/libavformat/application.h +@@ -0,0 +1,120 @@ ++/* ++ * copyright (c) 2016 Zhang Rui ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#ifndef AVUTIL_APPLICATION_H ++#define AVUTIL_APPLICATION_H ++ ++#include ++ ++#define AVAPP_EVENT_WILL_HTTP_OPEN 1 //AVAppHttpEvent ++#define AVAPP_EVENT_DID_HTTP_OPEN 2 //AVAppHttpEvent ++#define AVAPP_EVENT_WILL_HTTP_SEEK 3 //AVAppHttpEvent ++#define AVAPP_EVENT_DID_HTTP_SEEK 4 //AVAppHttpEvent ++ ++#define AVAPP_EVENT_ASYNC_STATISTIC 0x11000 //AVAppAsyncStatistic ++#define AVAPP_EVENT_ASYNC_READ_SPEED 0x11001 //AVAppAsyncReadSpeed ++#define AVAPP_EVENT_IO_TRAFFIC 0x12204 //AVAppIOTraffic ++ ++#define AVAPP_CTRL_WILL_TCP_OPEN 0x20001 //AVAppTcpIOControl ++#define AVAPP_CTRL_DID_TCP_OPEN 0x20002 //AVAppTcpIOControl ++ ++#define AVAPP_CTRL_WILL_HTTP_OPEN 0x20003 //AVAppIOControl ++#define AVAPP_CTRL_WILL_LIVE_OPEN 0x20005 //AVAppIOControl ++ ++#define AVAPP_CTRL_WILL_CONCAT_SEGMENT_OPEN 0x20007 //AVAppIOControl ++ ++typedef struct AVAppIOControl { ++ size_t size; ++ char url[4096]; /* in, out */ ++ int segment_index; /* in, default = 0 */ ++ int retry_counter; /* in */ ++ ++ int is_handled; /* out, default = false */ ++ int is_url_changed; /* out, default = false */ ++} AVAppIOControl; ++ ++typedef struct AVAppTcpIOControl { ++ int error; ++ int family; ++ char ip[96]; ++ int port; ++ int fd; ++} AVAppTcpIOControl; ++ ++typedef struct AVAppAsyncStatistic { ++ size_t size; ++ int64_t buf_backwards; ++ int64_t buf_forwards; ++ int64_t buf_capacity; ++} AVAppAsyncStatistic; ++ ++typedef struct AVAppAsyncReadSpeed { ++ size_t size; ++ int is_full_speed; ++ int64_t io_bytes; ++ int64_t elapsed_milli; ++} AVAppAsyncReadSpeed; ++ ++typedef struct AVAppHttpEvent ++{ ++ void *obj; ++ char url[4096]; ++ int64_t offset; ++ int error; ++ int http_code; ++ int64_t filesize; ++} AVAppHttpEvent; ++ ++typedef struct AVAppIOTraffic ++{ ++ void *obj; ++ int bytes; ++} AVAppIOTraffic; ++ ++typedef struct AVApplicationContext AVApplicationContext; ++typedef struct AVClass AVClass; ++struct AVApplicationContext { ++ const AVClass *av_class; /**< information for av_log(). Set by av_application_open(). */ ++ void *opaque; /**< user data. */ ++ int (*func_on_app_event)(AVApplicationContext *h, int event_type ,void *obj, size_t size); ++}; ++ ++// open/close ++int av_application_open(AVApplicationContext **ph, void *opaque); ++void av_application_closep(AVApplicationContext **ph); ++ ++// custom protocol invoke ++void av_application_on_http_event(AVApplicationContext *h, int event_type, AVAppHttpEvent *event); ++int av_application_on_io_control(AVApplicationContext *h, int event_type, AVAppIOControl *control); ++void av_application_on_async_statistic(AVApplicationContext *h, AVAppAsyncStatistic *statistic); ++void av_application_on_async_read_speed(AVApplicationContext *h, AVAppAsyncReadSpeed *speed); ++ ++// http event ++void av_application_will_http_open(AVApplicationContext *h, void *obj, const char *url); ++void av_application_did_http_open(AVApplicationContext *h, void *obj, const char *url, int error, int http_code, int64_t filesize); ++void av_application_will_http_seek(AVApplicationContext *h, void *obj, const char *url, int64_t offset); ++void av_application_did_http_seek(AVApplicationContext *h, void *obj, const char *url, int64_t offset, int error, int http_code); ++//tcp event ++int av_application_on_tcp_will_open(AVApplicationContext *h); ++int av_application_on_tcp_did_open(AVApplicationContext *h, int error, int fd, AVAppTcpIOControl *control); ++//tcp speed ++void av_application_did_io_tcp_read(AVApplicationContext *h, void *obj, int bytes); ++ ++#endif /* AVUTIL_APPLICATION_H */ +diff --git a/libavformat/dns_cache.c b/libavformat/dns_cache.c +new file mode 100644 +index 0000000..aab2435 +--- /dev/null ++++ b/libavformat/dns_cache.c +@@ -0,0 +1,232 @@ ++/* ++ * copyright (c) 2017 Raymond Zheng ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#include "dns_cache.h" ++#include "libavutil/time.h" ++#include "libavutil/mem.h" ++#include "libavformat/network.h" ++#include ++#include ++ ++#if HAVE_PTHREADS ++#include ++#endif ++ ++typedef struct DnsCacheContext DnsCacheContext; ++typedef struct DnsCacheContext { ++ AVDictionary *dns_dictionary; ++ pthread_mutex_t dns_dictionary_mutex; ++ int initialized; ++} DnsCacheContext; ++ ++static DnsCacheContext *context = NULL; ++static pthread_once_t key_once = PTHREAD_ONCE_INIT; ++ ++static void inner_init(void) { ++ int ret = 0; ++ context = (DnsCacheContext *) av_mallocz(sizeof(DnsCacheContext)); ++ if (context) { ++ ret = pthread_mutex_init(&context->dns_dictionary_mutex, NULL); ++ if (!ret) { ++ context->initialized = 1; ++ } else { ++ av_freep(&context); ++ } ++ } ++} ++ ++static void free_private_addrinfo(struct addrinfo **p_ai) { ++ struct addrinfo *ai = *p_ai; ++ ++ if (ai) { ++ if (ai->ai_addr) { ++ av_freep(&ai->ai_addr); ++ } ++ av_freep(p_ai); ++ } ++} ++ ++static int inner_remove_dns_cache(const char *uri, DnsCacheEntry *dns_cache_entry) { ++ if (context && dns_cache_entry) { ++ if (dns_cache_entry->ref_count == 0) { ++ av_dict_set_int(&context->dns_dictionary, uri, 0, 0); ++ free_private_addrinfo(&dns_cache_entry->res); ++ av_freep(&dns_cache_entry); ++ } else { ++ dns_cache_entry->delete_flag = 1; ++ } ++ } ++ ++ return 0; ++} ++ ++static DnsCacheEntry *new_dns_cache_entry(const char *uri, struct addrinfo *cur_ai, int64_t timeout) { ++ DnsCacheEntry *new_entry = NULL; ++ int64_t cur_time = av_gettime_relative(); ++ ++ if (cur_time < 0) { ++ goto fail; ++ } ++ ++ new_entry = (DnsCacheEntry *) av_mallocz(sizeof(struct DnsCacheEntry)); ++ if (!new_entry) { ++ goto fail; ++ } ++ ++ new_entry->res = (struct addrinfo *) av_mallocz(sizeof(struct addrinfo)); ++ if (!new_entry->res) { ++ av_freep(&new_entry); ++ goto fail; ++ } ++ ++ memcpy(new_entry->res, cur_ai, sizeof(struct addrinfo)); ++ ++ new_entry->res->ai_addr = (struct sockaddr *) av_mallocz(sizeof(struct sockaddr)); ++ if (!new_entry->res->ai_addr) { ++ av_freep(&new_entry->res); ++ av_freep(&new_entry); ++ goto fail; ++ } ++ ++ memcpy(new_entry->res->ai_addr, cur_ai->ai_addr, sizeof(struct sockaddr)); ++ new_entry->res->ai_canonname = NULL; ++ new_entry->res->ai_next = NULL; ++ new_entry->ref_count = 0; ++ new_entry->delete_flag = 0; ++ new_entry->expired_time = cur_time + timeout * 1000; ++ ++ return new_entry; ++ ++fail: ++ return NULL; ++} ++ ++DnsCacheEntry *get_dns_cache_reference(const char *uri) { ++ AVDictionaryEntry *elem = NULL; ++ DnsCacheEntry *dns_cache_entry = NULL; ++ int64_t cur_time = av_gettime_relative(); ++ ++ if (cur_time < 0 || !uri || strlen(uri) == 0) { ++ return NULL; ++ } ++ ++ if (!context || !context->initialized) { ++#if HAVE_PTHREADS ++ pthread_once(&key_once, inner_init); ++#endif ++ } ++ ++ if (context && context->initialized) { ++ pthread_mutex_lock(&context->dns_dictionary_mutex); ++ elem = av_dict_get(context->dns_dictionary, uri, NULL, AV_DICT_MATCH_CASE); ++ if (elem) { ++ dns_cache_entry = (DnsCacheEntry *) (intptr_t) strtoll(elem->value, NULL, 10); ++ if (dns_cache_entry) { ++ if (dns_cache_entry->expired_time < cur_time) { ++ inner_remove_dns_cache(uri, dns_cache_entry); ++ dns_cache_entry = NULL; ++ } else { ++ dns_cache_entry->ref_count++; ++ } ++ } ++ } ++ pthread_mutex_unlock(&context->dns_dictionary_mutex); ++ } ++ ++ return dns_cache_entry; ++} ++ ++int release_dns_cache_reference(const char *uri, DnsCacheEntry **p_entry) { ++ DnsCacheEntry *entry = *p_entry; ++ ++ if (!uri || strlen(uri) == 0) { ++ return -1; ++ } ++ ++ if (context && context->initialized && entry) { ++ pthread_mutex_lock(&context->dns_dictionary_mutex); ++ entry->ref_count--; ++ if (entry->delete_flag && entry->ref_count == 0) { ++ inner_remove_dns_cache(uri, entry); ++ entry = NULL; ++ } ++ pthread_mutex_unlock(&context->dns_dictionary_mutex); ++ } ++ return 0; ++} ++ ++int remove_dns_cache_entry(const char *uri) { ++ AVDictionaryEntry *elem = NULL; ++ DnsCacheEntry *dns_cache_entry = NULL; ++ ++ if (!uri || strlen(uri) == 0) { ++ return -1; ++ } ++ ++ if (context && context->initialized) { ++ pthread_mutex_lock(&context->dns_dictionary_mutex); ++ elem = av_dict_get(context->dns_dictionary, uri, NULL, AV_DICT_MATCH_CASE); ++ if (elem) { ++ dns_cache_entry = (DnsCacheEntry *) (intptr_t) strtoll(elem->value, NULL, 10); ++ if (dns_cache_entry) { ++ inner_remove_dns_cache(uri, dns_cache_entry); ++ } ++ } ++ pthread_mutex_unlock(&context->dns_dictionary_mutex); ++ } ++ ++ return 0; ++} ++ ++int add_dns_cache_entry(const char *uri, struct addrinfo *cur_ai, int64_t timeout) { ++ DnsCacheEntry *new_entry = NULL; ++ DnsCacheEntry *old_entry = NULL; ++ AVDictionaryEntry *elem = NULL; ++ ++ if (!uri || strlen(uri) == 0 || timeout <= 0) { ++ goto fail; ++ } ++ ++ if (cur_ai == NULL || cur_ai->ai_addr == NULL) { ++ goto fail; ++ } ++ ++ if (context && context->initialized) { ++ pthread_mutex_lock(&context->dns_dictionary_mutex); ++ elem = av_dict_get(context->dns_dictionary, uri, NULL, AV_DICT_MATCH_CASE); ++ if (elem) { ++ old_entry = (DnsCacheEntry *) (intptr_t) strtoll(elem->value, NULL, 10); ++ if (old_entry) { ++ pthread_mutex_unlock(&context->dns_dictionary_mutex); ++ goto fail; ++ } ++ } ++ new_entry = new_dns_cache_entry(uri, cur_ai, timeout); ++ if (new_entry) { ++ av_dict_set_int(&context->dns_dictionary, uri, (int64_t) (intptr_t) new_entry, 0); ++ } ++ pthread_mutex_unlock(&context->dns_dictionary_mutex); ++ ++ return 0; ++ } ++ ++fail: ++ return -1; ++} +diff --git a/libavformat/dns_cache.h b/libavformat/dns_cache.h +new file mode 100644 +index 0000000..23c695e +--- /dev/null ++++ b/libavformat/dns_cache.h +@@ -0,0 +1,39 @@ ++/* ++ * copyright (c) 2017 Raymond Zheng ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#ifndef AVUTIL_DNS_CACHE_H ++#define AVUTIL_DNS_CACHE_H ++ ++#include "libavutil/log.h" ++#include ++ ++typedef struct DnsCacheEntry { ++ volatile int ref_count; ++ volatile int delete_flag; ++ int64_t expired_time; ++ struct addrinfo *res; // construct by private function, not support ai_next and ai_canonname, can only be released using free_private_addrinfo ++} DnsCacheEntry; ++ ++DnsCacheEntry *get_dns_cache_reference(const char *uri); ++int release_dns_cache_reference(const char *uri, DnsCacheEntry **p_entry); ++int remove_dns_cache_entry(const char *uri); ++int add_dns_cache_entry(const char *uri, struct addrinfo *cur_ai, int64_t timeout); ++ ++#endif /* AVUTIL_DNS_CACHE_H */ +-- +2.39.5 (Apple Git-154) + diff --git a/patches/ffmpeg-n7.1.1/0004-restore-ijk-http-event-hooks.patch b/patches/ffmpeg-n7.1.1/0004-restore-ijk-http-event-hooks.patch new file mode 100644 index 000000000..e98614b61 --- /dev/null +++ b/patches/ffmpeg-n7.1.1/0004-restore-ijk-http-event-hooks.patch @@ -0,0 +1,287 @@ +From 3c47c2eaf11d33b44b1bf0e082969f654b48dcd1 Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Wed, 28 May 2025 18:01:07 +0800 +Subject: [PATCH] restore ijk http event hooks + +--- + libavformat/http.c | 32 +++++++++++++++++++++++-- + libavformat/tcp.c | 60 ++++++++++++++++++++++++++++++++++++++++++---- + libavutil/error.h | 4 ++++ + 3 files changed, 89 insertions(+), 7 deletions(-) + +diff --git a/libavformat/http.c b/libavformat/http.c +index ec60bc0..1228735 100644 +--- a/libavformat/http.c ++++ b/libavformat/http.c +@@ -45,6 +45,7 @@ + #include "os_support.h" + #include "url.h" + #include "version.h" ++#include "application.h" + + /* XXX: POST protocol is not completely implemented because ffmpeg uses + * only a subset of it. */ +@@ -143,6 +144,9 @@ typedef struct HTTPContext { + unsigned int retry_after; + int reconnect_max_retries; + int reconnect_delay_total_max; ++ char *tcp_hook; ++ char *app_ctx_intptr; ++ AVApplicationContext *app_ctx; + } HTTPContext; + + #define OFFSET(x) offsetof(HTTPContext, x) +@@ -188,6 +192,8 @@ static const AVOption options[] = { + { "resource", "The resource requested by a client", OFFSET(resource), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, E }, + { "reply_code", "The http status code to return to a client", OFFSET(reply_code), AV_OPT_TYPE_INT, { .i64 = 200}, INT_MIN, 599, E}, + { "short_seek_size", "Threshold to favor readahead over seek.", OFFSET(short_seek_size), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, D }, ++ { "http-tcp-hook", "hook protocol on tcp", OFFSET(tcp_hook), AV_OPT_TYPE_STRING, { .str = "tcp" }, 0, 0, D | E }, ++ { "ijkapplication", "AVApplicationContext", OFFSET(app_ctx_intptr), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, .flags = D }, + { NULL } + }; + +@@ -218,6 +224,7 @@ static int http_open_cnx_internal(URLContext *h, AVDictionary **options) + char buf[1024], urlbuf[MAX_URL_SIZE]; + int port, use_proxy, err = 0; + HTTPContext *s = h->priv_data; ++ lower_proto = s->tcp_hook; + + av_url_split(proto, sizeof(proto), auth, sizeof(auth), + hostname, sizeof(hostname), &port, +@@ -273,6 +280,13 @@ static int http_open_cnx_internal(URLContext *h, AVDictionary **options) + ff_url_join(buf, sizeof(buf), lower_proto, NULL, hostname, port, NULL); + + if (!s->hd) { ++ av_dict_set_intptr(options, "ijkapplication", (uintptr_t)s->app_ctx, 0); ++ ++ // AVDictionaryEntry *t = NULL; ++ // while ((t = av_dict_get(*options, "", t, AV_DICT_IGNORE_SUFFIX))) { ++ // av_log(NULL, AV_LOG_INFO, "%-*s: %-*s = %s\n", 12, "http open tcp", 28, t->key, t->value); ++ // } ++ + err = ffurl_open_whitelist(&s->hd, buf, AVIO_FLAG_READ_WRITE, + &h->interrupt_callback, options, + h->protocol_whitelist, h->protocol_blacklist, h); +@@ -713,6 +727,7 @@ static int http_open(URLContext *h, const char *uri, int flags, + { + HTTPContext *s = h->priv_data; + int ret; ++ s->app_ctx = (AVApplicationContext *)av_dict_strtoptr(s->app_ctx_intptr); + + if( s->seekable == 1 ) + h->is_streamed = 0; +@@ -749,7 +764,9 @@ static int http_open(URLContext *h, const char *uri, int flags, + if (s->listen) { + return http_listen(h, uri, flags, options); + } ++ av_application_will_http_open(s->app_ctx, (void*)h, uri); + ret = http_open_cnx(h, options); ++ av_application_did_http_open(s->app_ctx, (void*)h, uri, ret, s->http_code, s->filesize); + bail_out: + if (ret < 0) { + av_dict_free(&s->chained_options); +@@ -1667,7 +1684,14 @@ static int http_buf_read(URLContext *h, uint8_t *buf, int size) + uint64_t target_end = s->end_off ? s->end_off : s->filesize; + if ((!s->willclose || s->chunksize == UINT64_MAX) && s->off >= target_end) + return AVERROR_EOF; +- len = ffurl_read(s->hd, buf, size); ++ len = size; ++ if (s->filesize > 0 && s->filesize != UINT64_MAX && s->filesize != INT32_MAX) { ++ int64_t unread = s->filesize - s->off; ++ if (len > unread) ++ len = (int)unread; ++ } ++ if (len > 0) ++ len = ffurl_read(s->hd, buf, len); + if ((!len || len == AVERROR_EOF) && + (!s->willclose || s->chunksize == UINT64_MAX) && s->off < target_end) { + av_log(h, AV_LOG_ERROR, +@@ -2011,7 +2035,9 @@ static int64_t http_seek_internal(URLContext *h, int64_t off, int whence, int fo + s->hd = NULL; + + /* if it fails, continue on old connection */ ++ av_application_will_http_seek(s->app_ctx, (void*)h, s->location, off); + if ((ret = http_open_cnx(h, &options)) < 0) { ++ av_application_did_http_seek(s->app_ctx, (void*)h, s->location, off, ret, s->http_code); + av_dict_free(&options); + memcpy(s->buffer, old_buf, old_buf_size); + s->buf_ptr = s->buffer; +@@ -2020,6 +2046,7 @@ static int64_t http_seek_internal(URLContext *h, int64_t off, int whence, int fo + s->off = old_off; + return ret; + } ++ av_application_did_http_seek(s->app_ctx, (void*)h, s->location, off, ret, s->http_code); + av_dict_free(&options); + ffurl_close(old_hd); + return off; +@@ -2113,6 +2140,7 @@ static int http_proxy_open(URLContext *h, const char *uri, int flags) + HTTPAuthType cur_auth_type; + char *authstr; + ++ s->app_ctx = (AVApplicationContext *)av_dict_strtoptr(s->app_ctx_intptr); + if( s->seekable == 1 ) + h->is_streamed = 0; + else +@@ -2125,7 +2153,7 @@ static int http_proxy_open(URLContext *h, const char *uri, int flags) + if (*path == '/') + path++; + +- ff_url_join(lower_url, sizeof(lower_url), "tcp", NULL, hostname, port, ++ ff_url_join(lower_url, sizeof(lower_url), s->tcp_hook, NULL, hostname, port, + NULL); + redo: + ret = ffurl_open_whitelist(&s->hd, lower_url, AVIO_FLAG_READ_WRITE, +diff --git a/libavformat/tcp.c b/libavformat/tcp.c +index 755e3af..da8a350 100644 +--- a/libavformat/tcp.c ++++ b/libavformat/tcp.c +@@ -24,6 +24,8 @@ + #include "libavutil/parseutils.h" + #include "libavutil/opt.h" + #include "libavutil/time.h" ++#include "libavutil/avstring.h" ++#include "application.h" + + #include "network.h" + #include "os_support.h" +@@ -47,6 +49,9 @@ typedef struct TCPContext { + #if !HAVE_WINSOCK2_H + int tcp_mss; + #endif /* !HAVE_WINSOCK2_H */ ++ ++ char * app_ctx_intptr; ++ AVApplicationContext *app_ctx; + } TCPContext; + + #define OFFSET(x) offsetof(TCPContext, x) +@@ -64,6 +69,8 @@ static const AVOption options[] = { + #if !HAVE_WINSOCK2_H + { "tcp_mss", "Maximum segment size for outgoing TCP packets", OFFSET(tcp_mss), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, .flags = D|E }, + #endif /* !HAVE_WINSOCK2_H */ ++ { "ijkapplication", "AVApplicationContext", OFFSET(app_ctx_intptr), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, .flags = D }, ++ { "connect_timeout", "set connect timeout (in microseconds) of socket", OFFSET(open_timeout), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, .flags = D|E }, + { NULL } + }; + +@@ -147,7 +154,21 @@ static int tcp_open(URLContext *h, const char *uri, int flags) + int ret; + char hostname[1024],proto[1024],path[1024]; + char portstr[10]; +- s->open_timeout = 5000000; ++ AVAppTcpIOControl control = {0}; ++ ++ int ret2; ++ if (s->open_timeout < 0) { ++ s->open_timeout = 15000000; ++ } ++ // av_log(NULL, AV_LOG_INFO, "xql tcp_open uri %s", uri); ++ // av_log(NULL, AV_LOG_INFO, "%-*s: %-*s = %s\n", 12, "xql tcp_open verify", 28, "ijkapplication", s->app_ctx_intptr); ++ // av_log(NULL, AV_LOG_INFO, "%-*s: %-*s = %d\n", 12, "xql tcp_open verify", 28, "connect_timeout", s->open_timeout); ++ // av_log(NULL, AV_LOG_INFO, "%-*s: %-*s = %d\n", 12, "xql tcp_open verify", 28, "addrinfo_one_by_one", s->addrinfo_one_by_one); ++ // av_log(NULL, AV_LOG_INFO, "%-*s: %-*s = %d\n", 12, "xql tcp_open verify", 28, "addrinfo_timeout", s->addrinfo_timeout); ++ // av_log(NULL, AV_LOG_INFO, "%-*s: %-*s = %d\n", 12, "xql tcp_open verify", 28, "dns_cache_timeout", s->dns_cache_timeout); ++ // av_log(NULL, AV_LOG_INFO, "%-*s: %-*s = %d\n", 12, "xql tcp_open verify", 28, "dns_cache_clear", s->dns_cache_clear); ++ ++ s->app_ctx = (AVApplicationContext *)av_dict_strtoptr(s->app_ctx_intptr); + + av_url_split(proto, sizeof(proto), NULL, 0, hostname, sizeof(hostname), + &port, path, sizeof(path), uri); +@@ -180,6 +201,9 @@ static int tcp_open(URLContext *h, const char *uri, int flags) + } + if (av_find_info_tag(buf, sizeof(buf), "timeout", p)) { + s->rw_timeout = strtol(buf, NULL, 10); ++ if (s->rw_timeout >= 0) { ++ s->open_timeout = s->rw_timeout; ++ } + } + if (av_find_info_tag(buf, sizeof(buf), "listen_timeout", p)) { + s->listen_timeout = strtol(buf, NULL, 10); +@@ -189,7 +213,7 @@ static int tcp_open(URLContext *h, const char *uri, int flags) + } + } + if (s->rw_timeout >= 0) { +- s->open_timeout = ++ //s->open_timeout = + h->rw_timeout = s->rw_timeout; + } + hints.ai_family = AF_UNSPEC; +@@ -247,9 +271,24 @@ static int tcp_open(URLContext *h, const char *uri, int flags) + // Socket descriptor already closed here. Safe to overwrite to client one. + fd = ret; + } else { +- ret = ff_connect_parallel(ai, s->open_timeout / 1000, 3, h, &fd, customize_fd, s); ++ ret = av_application_on_tcp_will_open(s->app_ctx); ++ if (ret) { ++ av_log(NULL, AV_LOG_WARNING, "terminated by application in AVAPP_CTRL_WILL_TCP_OPEN"); ++ goto fail1; ++ } ++ ret = ff_connect_parallel(cur_ai, s->open_timeout / 1000, 3, h, &fd, customize_fd, s); ++ ++ ret2 = av_application_on_tcp_did_open(s->app_ctx, ret, fd, &control); ++ + if (ret < 0) + goto fail1; ++ ++ if (ret2) { ++ av_log(NULL, AV_LOG_WARNING, "terminated by application in AVAPP_CTRL_DID_TCP_OPEN"); ++ ret = ret2; ++ goto fail1; ++ } ++ av_log(NULL, AV_LOG_INFO, "tcp did open uri = %s, ip = %s\n", uri , control.ip); + } + + h->is_streamed = 1; +@@ -290,12 +329,18 @@ static int tcp_read(URLContext *h, uint8_t *buf, int size) + + if (!(h->flags & AVIO_FLAG_NONBLOCK)) { + ret = ff_network_wait_fd_timeout(s->fd, 0, h->rw_timeout, &h->interrupt_callback); +- if (ret) ++ if (ret) { ++ if (ret == AVERROR(ETIMEDOUT)) { ++ ret = AVERROR_TCP_READ_TIMEOUT; ++ } + return ret; ++ } + } + ret = recv(s->fd, buf, size, 0); + if (ret == 0) + return AVERROR_EOF; ++ if (ret > 0) ++ av_application_did_io_tcp_read(s->app_ctx, (void*)h, ret); + return ret < 0 ? ff_neterrno() : ret; + } + +@@ -306,9 +351,14 @@ static int tcp_write(URLContext *h, const uint8_t *buf, int size) + + if (!(h->flags & AVIO_FLAG_NONBLOCK)) { + ret = ff_network_wait_fd_timeout(s->fd, 1, h->rw_timeout, &h->interrupt_callback); +- if (ret) ++ if (ret) { ++ if (ret == AVERROR(ETIMEDOUT)) { ++ ret = AVERROR_TCP_WRITE_TIMEOUT; ++ } + return ret; ++ } + } ++ + ret = send(s->fd, buf, size, MSG_NOSIGNAL); + return ret < 0 ? ff_neterrno() : ret; + } +diff --git a/libavutil/error.h b/libavutil/error.h +index 1efa86c..9dee755 100644 +--- a/libavutil/error.h ++++ b/libavutil/error.h +@@ -85,6 +85,10 @@ + + #define AV_ERROR_MAX_STRING_SIZE 64 + ++#define AVERROR_TCP_CONNECT_TIMEOUT -1001 ++#define AVERROR_TCP_READ_TIMEOUT -1002 ++#define AVERROR_TCP_WRITE_TIMEOUT -1003 ++ + /** + * Put a description of the AVERROR code errnum in errbuf. + * In case of failure the global variable errno is set to indicate the +-- +2.39.5 (Apple Git-154) + diff --git a/patches/ffmpeg-n7.1.1/0005-restore-ijk-tcp-dns-cache.patch b/patches/ffmpeg-n7.1.1/0005-restore-ijk-tcp-dns-cache.patch new file mode 100644 index 000000000..ef9840ff9 --- /dev/null +++ b/patches/ffmpeg-n7.1.1/0005-restore-ijk-tcp-dns-cache.patch @@ -0,0 +1,404 @@ +From 38ea0fc06f40c42cd8aaf6e864095284272274ad Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Wed, 28 May 2025 18:06:03 +0800 +Subject: [PATCH] restore ijk tcp dns cache + +--- + libavformat/tcp.c | 325 +++++++++++++++++++++++++++++++++++++++++++--- + 1 file changed, 310 insertions(+), 15 deletions(-) + +diff --git a/libavformat/tcp.c b/libavformat/tcp.c +index da8a350..5896949 100644 +--- a/libavformat/tcp.c ++++ b/libavformat/tcp.c +@@ -26,13 +26,16 @@ + #include "libavutil/time.h" + #include "libavutil/avstring.h" + #include "application.h" +- ++#include "dns_cache.h" + #include "network.h" + #include "os_support.h" + #include "url.h" + #if HAVE_POLL_H + #include + #endif ++#if HAVE_PTHREADS ++#include ++#endif + + typedef struct TCPContext { + const AVClass *class; +@@ -51,6 +54,10 @@ typedef struct TCPContext { + #endif /* !HAVE_WINSOCK2_H */ + + char * app_ctx_intptr; ++ int addrinfo_one_by_one; ++ int addrinfo_timeout; ++ int64_t dns_cache_timeout; ++ int dns_cache_clear; + AVApplicationContext *app_ctx; + } TCPContext; + +@@ -71,9 +78,261 @@ static const AVOption options[] = { + #endif /* !HAVE_WINSOCK2_H */ + { "ijkapplication", "AVApplicationContext", OFFSET(app_ctx_intptr), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, .flags = D }, + { "connect_timeout", "set connect timeout (in microseconds) of socket", OFFSET(open_timeout), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, .flags = D|E }, ++ { "addrinfo_one_by_one", "parse addrinfo one by one in getaddrinfo()", OFFSET(addrinfo_one_by_one), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, .flags = D|E }, ++ { "addrinfo_timeout", "set timeout (in microseconds) for getaddrinfo()", OFFSET(addrinfo_timeout), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, .flags = D|E }, ++ { "dns_cache_timeout", "dns cache TTL (in microseconds)", OFFSET(dns_cache_timeout), AV_OPT_TYPE_INT, { .i64 = 0 }, -1, INT64_MAX, .flags = D|E }, ++ { "dns_cache_clear", "clear dns cache", OFFSET(dns_cache_clear), AV_OPT_TYPE_INT, { .i64 = 0}, -1, INT_MAX, .flags = D|E }, + { NULL } + }; + ++int ijk_tcp_getaddrinfo_nonblock(const char *hostname, const char *servname, ++ const struct addrinfo *hints, struct addrinfo **res, ++ int64_t timeout, ++ const AVIOInterruptCB *int_cb, int one_by_one); ++#ifdef HAVE_PTHREADS ++ ++typedef struct TCPAddrinfoRequest ++{ ++ AVBufferRef *buffer; ++ ++ pthread_mutex_t mutex; ++ pthread_cond_t cond; ++ ++ AVIOInterruptCB interrupt_callback; ++ ++ char *hostname; ++ char *servname; ++ struct addrinfo hints; ++ struct addrinfo *res; ++ ++ volatile int finished; ++ int last_error; ++} TCPAddrinfoRequest; ++ ++static void tcp_getaddrinfo_request_free(TCPAddrinfoRequest *req) ++{ ++ av_assert0(req); ++ if (req->res) { ++ freeaddrinfo(req->res); ++ req->res = NULL; ++ } ++ ++ av_freep(&req->servname); ++ av_freep(&req->hostname); ++ pthread_cond_destroy(&req->cond); ++ pthread_mutex_destroy(&req->mutex); ++ av_freep(&req); ++} ++ ++static void tcp_getaddrinfo_request_free_buffer(void *opaque, uint8_t *data) ++{ ++ av_assert0(opaque); ++ TCPAddrinfoRequest *req = (TCPAddrinfoRequest *)opaque; ++ tcp_getaddrinfo_request_free(req); ++} ++ ++static int tcp_getaddrinfo_request_create(TCPAddrinfoRequest **request, ++ const char *hostname, ++ const char *servname, ++ const struct addrinfo *hints, ++ const AVIOInterruptCB *int_cb) ++{ ++ TCPAddrinfoRequest *req = (TCPAddrinfoRequest *) av_mallocz(sizeof(TCPAddrinfoRequest)); ++ if (!req) ++ return AVERROR(ENOMEM); ++ ++ if (pthread_mutex_init(&req->mutex, NULL)) { ++ av_freep(&req); ++ return AVERROR(ENOMEM); ++ } ++ ++ if (pthread_cond_init(&req->cond, NULL)) { ++ pthread_mutex_destroy(&req->mutex); ++ av_freep(&req); ++ return AVERROR(ENOMEM); ++ } ++ ++ if (int_cb) ++ req->interrupt_callback = *int_cb; ++ ++ if (hostname) { ++ req->hostname = av_strdup(hostname); ++ if (!req->hostname) ++ goto fail; ++ } ++ ++ if (servname) { ++ req->servname = av_strdup(servname); ++ if (!req->hostname) ++ goto fail; ++ } ++ ++ if (hints) { ++ req->hints.ai_family = hints->ai_family; ++ req->hints.ai_socktype = hints->ai_socktype; ++ req->hints.ai_protocol = hints->ai_protocol; ++ req->hints.ai_flags = hints->ai_flags; ++ } ++ ++ req->buffer = av_buffer_create(NULL, 0, tcp_getaddrinfo_request_free_buffer, req, 0); ++ if (!req->buffer) ++ goto fail; ++ ++ *request = req; ++ return 0; ++fail: ++ tcp_getaddrinfo_request_free(req); ++ return AVERROR(ENOMEM); ++} ++ ++static void *tcp_getaddrinfo_worker(void *arg) ++{ ++ TCPAddrinfoRequest *req = arg; ++ ++ getaddrinfo(req->hostname, req->servname, &req->hints, &req->res); ++ pthread_mutex_lock(&req->mutex); ++ req->finished = 1; ++ pthread_cond_signal(&req->cond); ++ pthread_mutex_unlock(&req->mutex); ++ av_buffer_unref(&req->buffer); ++ return NULL; ++} ++ ++static void *tcp_getaddrinfo_one_by_one_worker(void *arg) ++{ ++ struct addrinfo *temp_addrinfo = NULL; ++ struct addrinfo *cur = NULL; ++ int ret = EAI_FAIL; ++ int i = 0; ++ int option_length = 0; ++ ++ TCPAddrinfoRequest *req = (TCPAddrinfoRequest *)arg; ++ ++ int family_option[2] = {AF_INET, AF_INET6}; ++ ++ option_length = sizeof(family_option) / sizeof(family_option[0]); ++ ++ for (; i < option_length; ++i) { ++ struct addrinfo *hint = &req->hints; ++ hint->ai_family = family_option[i]; ++ ret = getaddrinfo(req->hostname, req->servname, hint, &temp_addrinfo); ++ if (ret) { ++ req->last_error = ret; ++ continue; ++ } ++ pthread_mutex_lock(&req->mutex); ++ if (!req->res) { ++ req->res = temp_addrinfo; ++ } else { ++ cur = req->res; ++ while (cur->ai_next) ++ cur = cur->ai_next; ++ cur->ai_next = temp_addrinfo; ++ } ++ pthread_mutex_unlock(&req->mutex); ++ } ++ pthread_mutex_lock(&req->mutex); ++ req->finished = 1; ++ pthread_cond_signal(&req->cond); ++ pthread_mutex_unlock(&req->mutex); ++ av_buffer_unref(&req->buffer); ++ return NULL; ++} ++ ++int ijk_tcp_getaddrinfo_nonblock(const char *hostname, const char *servname, ++ const struct addrinfo *hints, struct addrinfo **res, ++ int64_t timeout, ++ const AVIOInterruptCB *int_cb, int one_by_one) ++{ ++ int ret; ++ int64_t start; ++ int64_t now; ++ AVBufferRef *req_ref = NULL; ++ TCPAddrinfoRequest *req = NULL; ++ pthread_t work_thread; ++ ++ if (hostname && !hostname[0]) ++ hostname = NULL; ++ av_log(NULL, AV_LOG_DEBUG, "dns getaddrinfo uri = %s\n", hostname); ++ if (timeout <= 0) ++ return getaddrinfo(hostname, servname, hints, res); ++ av_log(NULL, AV_LOG_DEBUG, "dns tcp_getaddrinfo_request_create uri = %s\n", hostname); ++ ret = tcp_getaddrinfo_request_create(&req, hostname, servname, hints, int_cb); ++ if (ret) ++ goto fail; ++ ++ req_ref = av_buffer_ref(req->buffer); ++ if (req_ref == NULL) { ++ ret = AVERROR(ENOMEM); ++ goto fail; ++ } ++ ++ /* FIXME: using a thread pool would be better. */ ++ if (one_by_one) ++ ret = pthread_create(&work_thread, NULL, tcp_getaddrinfo_one_by_one_worker, req); ++ else ++ ret = pthread_create(&work_thread, NULL, tcp_getaddrinfo_worker, req); ++ ++ if (ret) { ++ ret = AVERROR(ret); ++ goto fail; ++ } ++ ++ pthread_detach(work_thread); ++ ++ start = av_gettime(); ++ now = start; ++ ++ pthread_mutex_lock(&req->mutex); ++ while (1) { ++ int64_t wait_time = now + 100000; ++ struct timespec tv = { .tv_sec = wait_time / 1000000, ++ .tv_nsec = (wait_time % 1000000) * 1000 }; ++ ++ if (req->finished || (start + timeout < now)) { ++ if (req->res) { ++ ret = 0; ++ *res = req->res; ++ req->res = NULL; ++ } else { ++ ret = req->last_error ? req->last_error : AVERROR_EXIT; ++ } ++ break; ++ } ++#if defined(__ANDROID__) && defined(HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC) ++ ret = pthread_cond_timedwait_monotonic_np(&req->cond, &req->mutex, &tv); ++#else ++ ret = pthread_cond_timedwait(&req->cond, &req->mutex, &tv); ++#endif ++ if (ret != 0 && ret != ETIMEDOUT) { ++ av_log(NULL, AV_LOG_ERROR, "pthread_cond_timedwait failed: %d\n", ret); ++ ret = AVERROR_EXIT; ++ break; ++ } ++ ++ if (ff_check_interrupt(&req->interrupt_callback)) { ++ ret = AVERROR_EXIT; ++ break; ++ } ++ ++ now = av_gettime(); ++ } ++ pthread_mutex_unlock(&req->mutex); ++fail: ++ av_buffer_unref(&req_ref); ++ return ret; ++} ++ ++#else ++int ijk_tcp_getaddrinfo_nonblock(const char *hostname, const char *servname, ++ const struct addrinfo *hints, struct addrinfo **res, ++ int64_t timeout, ++ const AVIOInterruptCB *int_cb) ++{ ++ return getaddrinfo(hostname, servname, hints, res); ++} ++#endif ++ + static const AVClass tcp_class = { + .class_name = "tcp", + .item_name = av_default_item_name, +@@ -155,7 +414,7 @@ static int tcp_open(URLContext *h, const char *uri, int flags) + char hostname[1024],proto[1024],path[1024]; + char portstr[10]; + AVAppTcpIOControl control = {0}; +- ++ DnsCacheEntry *dns_entry = NULL; + int ret2; + if (s->open_timeout < 0) { + s->open_timeout = 15000000; +@@ -221,18 +480,37 @@ static int tcp_open(URLContext *h, const char *uri, int flags) + snprintf(portstr, sizeof(portstr), "%d", port); + if (s->listen) + hints.ai_flags |= AI_PASSIVE; +- if (!hostname[0]) +- ret = getaddrinfo(NULL, portstr, &hints, &ai); +- else +- ret = getaddrinfo(hostname, portstr, &hints, &ai); +- if (ret) { +- av_log(h, AV_LOG_ERROR, +- "Failed to resolve hostname %s: %s\n", +- hostname, gai_strerror(ret)); +- return AVERROR(EIO); ++ if (s->dns_cache_timeout > 0) { ++ if (s->dns_cache_clear) { ++ remove_dns_cache_entry(uri); ++ } else { ++ dns_entry = get_dns_cache_reference(uri); ++ } + } + +- cur_ai = ai; ++ if (!dns_entry) { ++#ifdef HAVE_PTHREADS ++ ret = ijk_tcp_getaddrinfo_nonblock(hostname, portstr, &hints, &ai, s->addrinfo_timeout, &h->interrupt_callback, s->addrinfo_one_by_one); ++#else ++ if (s->addrinfo_timeout > 0) ++ av_log(h, AV_LOG_WARNING, "Ignore addrinfo_timeout without pthreads support.\n"); ++ if (!hostname[0]) ++ ret = getaddrinfo(NULL, portstr, &hints, &ai); ++ else ++ ret = getaddrinfo(hostname, portstr, &hints, &ai); ++#endif ++ if (ret) { ++ av_log(h, AV_LOG_ERROR, ++ "Failed to resolve hostname %s: %s\n", ++ hostname, gai_strerror(ret)); ++ return AVERROR(EIO); ++ } ++ ++ cur_ai = ai; ++ } else { ++ av_log(NULL, AV_LOG_DEBUG, "hit dns cache uri = %s\n", uri); ++ cur_ai = dns_entry->res; ++ } + + #if HAVE_STRUCT_SOCKADDR_IN6 + // workaround for IOS9 getaddrinfo in IPv6 only network use hardcode IPv4 address can not resolve port number. +@@ -288,19 +566,36 @@ static int tcp_open(URLContext *h, const char *uri, int flags) + ret = ret2; + goto fail1; + } +- av_log(NULL, AV_LOG_INFO, "tcp did open uri = %s, ip = %s\n", uri , control.ip); ++ ++ if (!dns_entry && !strstr(uri, control.ip) && s->dns_cache_timeout > 0) { ++ add_dns_cache_entry(uri, cur_ai, s->dns_cache_timeout); ++ av_log(NULL, AV_LOG_DEBUG, "add dns cache uri = %s, ip = %s\n", uri , control.ip); ++ } ++ av_log(NULL, AV_LOG_DEBUG, "tcp did open uri = %s, ip = %s\n", uri , control.ip); + } + + h->is_streamed = 1; + s->fd = fd; + +- freeaddrinfo(ai); ++ if (dns_entry) { ++ release_dns_cache_reference(uri, &dns_entry); ++ } else { ++ freeaddrinfo(ai); ++ } + return 0; + + fail1: + if (fd >= 0) + closesocket(fd); +- freeaddrinfo(ai); ++ ++ if (dns_entry) { ++ av_log(NULL, AV_LOG_ERROR, "hit dns cache but connect fail uri = %s, ip = %s\n", uri , control.ip); ++ release_dns_cache_reference(uri, &dns_entry); ++ remove_dns_cache_entry(uri); ++ } else { ++ freeaddrinfo(cur_ai); ++ } ++ + return ret; + } + +-- +2.39.5 (Apple Git-154) + diff --git a/patches/ffmpeg-n7.1.1/0006-restore-ijk-custom-protocols-except-long-url.patch b/patches/ffmpeg-n7.1.1/0006-restore-ijk-custom-protocols-except-long-url.patch new file mode 100644 index 000000000..b41b51093 --- /dev/null +++ b/patches/ffmpeg-n7.1.1/0006-restore-ijk-custom-protocols-except-long-url.patch @@ -0,0 +1,282 @@ +From fc20f37d242895412029521935804a96d9d0bf0c Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Thu, 29 May 2025 10:57:48 +0800 +Subject: [PATCH] restore ijk custom protocols except long url + +--- + libavcodec/Makefile | 1 + + libavformat/Makefile | 9 ++++ + libavformat/allformats.c | 4 ++ + libavformat/async.c | 2 +- + libavformat/demux.c | 13 +++++ + libavformat/demux.h | 2 + + libavformat/ijkutils.c | 101 +++++++++++++++++++++++++++++++++++++++ + libavformat/protocols.c | 6 +++ + libavutil/Makefile | 1 + + 9 files changed, 138 insertions(+), 1 deletion(-) + create mode 100644 libavformat/ijkutils.c + +diff --git a/libavcodec/Makefile b/libavcodec/Makefile +index a4fcce3..ed5c705 100644 +--- a/libavcodec/Makefile ++++ b/libavcodec/Makefile +@@ -25,6 +25,7 @@ HEADERS = ac3_parser.h \ + version_major.h \ + videotoolbox.h \ + vorbis_parser.h \ ++ packet_internal.h \ + + OBJS = ac3_parser.o \ + adts_parser.o \ +diff --git a/libavformat/Makefile b/libavformat/Makefile +index e5934e9..359781b 100644 +--- a/libavformat/Makefile ++++ b/libavformat/Makefile +@@ -7,6 +7,14 @@ HEADERS = avformat.h \ + version_major.h \ + application.h \ + dns_cache.h \ ++ avc.h \ ++ url.h \ ++ internal.h \ ++ avio_internal.h \ ++ flv.h \ ++ id3v2.h \ ++ os_support.h \ ++ metadata.h \ + + OBJS = allformats.o \ + avformat.o \ +@@ -34,6 +42,7 @@ OBJS = allformats.o \ + version.o \ + application.o \ + dns_cache.o \ ++ ijkutils.o \ + + OBJS-$(HAVE_LIBC_MSVCRT) += file_open.o + +diff --git a/libavformat/allformats.c b/libavformat/allformats.c +index 305fa46..063be70 100644 +--- a/libavformat/allformats.c ++++ b/libavformat/allformats.c +@@ -576,6 +576,10 @@ extern const FFInputFormat ff_libmodplug_demuxer; + extern const FFInputFormat ff_libopenmpt_demuxer; + extern const FFInputFormat ff_vapoursynth_demuxer; + ++// ijk ++extern AVInputFormat ff_ijklivehook_demuxer; ++extern AVInputFormat ff_ijklas_demuxer; ++ + #include "libavformat/muxer_list.c" + #include "libavformat/demuxer_list.c" + +diff --git a/libavformat/async.c b/libavformat/async.c +index e0329e2..e5ee519 100644 +--- a/libavformat/async.c ++++ b/libavformat/async.c +@@ -489,7 +489,7 @@ static const AVClass async_context_class = { + .version = LIBAVUTIL_VERSION_INT, + }; + +-const URLProtocol ff_async_protocol = { ++URLProtocol ff_async_protocol = { + .name = "async", + .url_open2 = async_open, + .url_read = async_read, +diff --git a/libavformat/demux.c b/libavformat/demux.c +index 4fd22c4..ff62292 100644 +--- a/libavformat/demux.c ++++ b/libavformat/demux.c +@@ -218,6 +218,7 @@ int avformat_open_input(AVFormatContext **ps, const char *filename, + AVFormatContext *s = *ps; + FFFormatContext *si; + AVDictionary *tmp = NULL; ++ AVDictionary *tmp2 = NULL; + ID3v2ExtraMeta *id3v2_extra_meta = NULL; + int ret = 0; + +@@ -301,6 +302,16 @@ int avformat_open_input(AVFormatContext **ps, const char *filename, + if (s->pb) + ff_id3v2_read_dict(s->pb, &si->id3v2_meta, ID3v2_DEFAULT_MAGIC, &id3v2_extra_meta); + ++ if (ffifmt(s->iformat)->read_header2) { ++ if (options) ++ av_dict_copy(&tmp2,*options, 0); ++ if ((ret = ffifmt(s->iformat)->read_header2(s, &tmp2)) < 0) { ++ if (ffifmt(s->iformat)->flags_internal & FF_INFMT_FLAG_INIT_CLEANUP) ++ goto close; ++ goto fail; ++ } ++ } else ++ + if (ffifmt(s->iformat)->read_header) + if ((ret = ffifmt(s->iformat)->read_header(s)) < 0) { + if (ffifmt(s->iformat)->flags_internal & FF_INFMT_FLAG_INIT_CLEANUP) +@@ -343,6 +354,7 @@ int avformat_open_input(AVFormatContext **ps, const char *filename, + if (options) { + av_dict_free(options); + *options = tmp; ++ av_dict_free(&tmp2); + } + *ps = s; + return 0; +@@ -353,6 +365,7 @@ close: + fail: + ff_id3v2_free_extra_meta(&id3v2_extra_meta); + av_dict_free(&tmp); ++ av_dict_free(&tmp2); + if (s->pb && !(s->flags & AVFMT_FLAG_CUSTOM_IO)) + avio_closep(&s->pb); + avformat_free_context(s); +diff --git a/libavformat/demux.h b/libavformat/demux.h +index 9c76095..8b0af4c 100644 +--- a/libavformat/demux.h ++++ b/libavformat/demux.h +@@ -69,6 +69,8 @@ typedef struct FFInputFormat { + */ + int (*read_header)(struct AVFormatContext *); + ++ int (*read_header2)(struct AVFormatContext *, AVDictionary **options); ++ + /** + * Read one packet and put it in 'pkt'. pts and flags are also + * set. 'avformat_new_stream' can be called only if the flag +diff --git a/libavformat/ijkutils.c b/libavformat/ijkutils.c +new file mode 100644 +index 0000000..107b238 +--- /dev/null ++++ b/libavformat/ijkutils.c +@@ -0,0 +1,101 @@ ++/* ++ * utils.c ++ * ++ * Copyright (c) 2003 Fabrice Bellard ++ * Copyright (c) 2013 Zhang Rui ++ * ++ * This file is part of ijkPlayer. ++ * ++ * ijkPlayer is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * ijkPlayer is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with ijkPlayer; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#include ++#include "url.h" ++#include "avformat.h" ++ ++ ++#define IJK_FF_PROTOCOL(x) \ ++extern URLProtocol ff_##x##_protocol; \ ++int ijkav_register_##x##_protocol(URLProtocol *protocol, int protocol_size); \ ++int ijkav_register_##x##_protocol(URLProtocol *protocol, int protocol_size) \ ++{ \ ++ if (protocol_size != sizeof(URLProtocol)) { \ ++ av_log(NULL, AV_LOG_ERROR, "ijkav_register_##x##_protocol: ABI mismatch.\n"); \ ++ return -1; \ ++ } \ ++ memcpy(&ff_##x##_protocol, protocol, protocol_size); \ ++ return 0; \ ++} ++ ++#define IJK_DUMMY_PROTOCOL(x) \ ++IJK_FF_PROTOCOL(x); \ ++static const AVClass ijk_##x##_context_class = { \ ++ .class_name = #x, \ ++ .item_name = av_default_item_name, \ ++ .version = LIBAVUTIL_VERSION_INT, \ ++ }; \ ++ \ ++URLProtocol ff_##x##_protocol = { \ ++ .name = #x, \ ++ .url_open2 = ijkdummy_open, \ ++ .priv_data_size = 1, \ ++ .priv_data_class = &ijk_##x##_context_class, \ ++}; ++ ++static int ijkdummy_open(URLContext *h, const char *arg, int flags, AVDictionary **options) ++{ ++ return -1; ++} ++ ++IJK_FF_PROTOCOL(async); ++IJK_DUMMY_PROTOCOL(ijkmediadatasource); ++IJK_DUMMY_PROTOCOL(ijkhttphook); ++IJK_DUMMY_PROTOCOL(ijksegment); ++IJK_DUMMY_PROTOCOL(ijktcphook); ++IJK_DUMMY_PROTOCOL(ijkio); ++ ++#define IJK_FF_DEMUXER(x) \ ++extern AVInputFormat ff_##x##_demuxer; \ ++int ijkav_register_##x##_demuxer(AVInputFormat *demuxer, int demuxer_size); \ ++int ijkav_register_##x##_demuxer(AVInputFormat *demuxer, int demuxer_size) \ ++{ \ ++ if (demuxer_size != sizeof(AVInputFormat)) { \ ++ av_log(NULL, AV_LOG_ERROR, "ijkav_register_##x##_demuxer: ABI mismatch.\n"); \ ++ return -1; \ ++ } \ ++ memcpy(&ff_##x##_demuxer, demuxer, demuxer_size); \ ++ return 0; \ ++} ++ ++#define IJK_DUMMY_DEMUXER(x) \ ++IJK_FF_DEMUXER(x); \ ++static const AVClass ijk_##x##_demuxer_class = { \ ++ .class_name = #x, \ ++ .item_name = av_default_item_name, \ ++ .version = LIBAVUTIL_VERSION_INT, \ ++ }; \ ++ \ ++AVInputFormat ff_##x##_demuxer = { \ ++ .name = #x, \ ++ .priv_class = &ijk_##x##_demuxer_class, \ ++}; ++ ++/* ++ libavformat/ijkutils.c:99:1: error: field designator 'priv_data_size' does not refer to any field in type 'AVInputFormat' (aka 'struct AVInputFormat') ++ 99 | IJK_DUMMY_DEMUXER(ijklivehook); ++ ++ */ ++IJK_DUMMY_DEMUXER(ijklivehook); ++IJK_DUMMY_DEMUXER(ijklas); +diff --git a/libavformat/protocols.c b/libavformat/protocols.c +index 93a6d67..719caf8 100644 +--- a/libavformat/protocols.c ++++ b/libavformat/protocols.c +@@ -79,6 +79,12 @@ extern const URLProtocol ff_libzmq_protocol; + extern const URLProtocol ff_ipfs_gateway_protocol; + extern const URLProtocol ff_ipns_gateway_protocol; + ++extern const URLProtocol ff_ijkhttphook_protocol; ++extern const URLProtocol ff_ijkmediadatasource_protocol; ++extern const URLProtocol ff_ijksegment_protocol; ++extern const URLProtocol ff_ijktcphook_protocol; ++extern const URLProtocol ff_ijkio_protocol; ++ + #include "libavformat/protocol_list.c" + + const AVClass *ff_urlcontext_child_class_iterate(void **iter) +diff --git a/libavutil/Makefile b/libavutil/Makefile +index 6e6fa8d..5f47b20 100644 +--- a/libavutil/Makefile ++++ b/libavutil/Makefile +@@ -82,6 +82,7 @@ HEADERS = adler32.h \ + spherical.h \ + stereo3d.h \ + threadmessage.h \ ++ thread.h \ + time.h \ + timecode.h \ + timestamp.h \ +-- +2.39.5 (Apple Git-154) + diff --git a/patches/ffmpeg-n7.1.1/0007-restore-ijk-av_dict_get-that-converts-the-value-to-a.patch b/patches/ffmpeg-n7.1.1/0007-restore-ijk-av_dict_get-that-converts-the-value-to-a.patch new file mode 100644 index 000000000..ec2ecedf7 --- /dev/null +++ b/patches/ffmpeg-n7.1.1/0007-restore-ijk-av_dict_get-that-converts-the-value-to-a.patch @@ -0,0 +1,90 @@ +From 83e6a1aa986fef7a5c44f008baae36e2e0059cac Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Wed, 28 May 2025 18:33:27 +0800 +Subject: [PATCH] restore ijk av_dict_get that converts the value to a pointer + +--- + libavutil/dict.c | 39 ++++++++++++++++++++++++++++++++++++++- + libavutil/dict.h | 9 +++++++++ + 2 files changed, 47 insertions(+), 1 deletion(-) + +diff --git a/libavutil/dict.c b/libavutil/dict.c +index 6fb0939..3727187 100644 +--- a/libavutil/dict.c ++++ b/libavutil/dict.c +@@ -65,7 +65,7 @@ AVDictionaryEntry *av_dict_get(const AVDictionary *m, const char *key, + const AVDictionaryEntry *entry = prev; + unsigned int j; + +- if (!key) ++ if (!m || !key) + return NULL; + + while ((entry = av_dict_iterate(m, entry))) { +@@ -173,6 +173,43 @@ int av_dict_set_int(AVDictionary **pm, const char *key, int64_t value, + return av_dict_set(pm, key, valuestr, flags); + } + ++int av_dict_set_intptr(AVDictionary **pm, const char *key, uintptr_t value, ++ int flags) ++{ ++ char valuestr[22]; ++ snprintf(valuestr, sizeof(valuestr), "%p", value); ++ flags &= ~AV_DICT_DONT_STRDUP_VAL; ++ return av_dict_set(pm, key, valuestr, flags); ++} ++ ++uintptr_t av_dict_get_intptr(const AVDictionary *m, const char* key) { ++ uintptr_t ptr = NULL; ++ AVDictionaryEntry *t = NULL; ++ if ((t = av_dict_get(m, key, NULL, 0))) { ++ return av_dict_strtoptr(t->value); ++ } ++ return NULL; ++} ++ ++uintptr_t av_dict_strtoptr(char * value) { ++ uintptr_t ptr = NULL; ++ char *next = NULL; ++ if(!value || value[0] !='0' || (value[1]|0x20)!='x') { ++ return NULL; ++ } ++ ptr = strtoull(value, &next, 16); ++ if (next == value) { ++ return NULL; ++ } ++ return ptr; ++} ++ ++char * av_dict_ptrtostr(uintptr_t value) { ++ char valuestr[22] = {0}; ++ snprintf(valuestr, sizeof(valuestr), "%p", value); ++ return av_strdup(valuestr); ++} ++ + static int parse_key_value_pair(AVDictionary **pm, const char **buf, + const char *key_val_sep, const char *pairs_sep, + int flags) +diff --git a/libavutil/dict.h b/libavutil/dict.h +index 713c9e3..fdcc167 100644 +--- a/libavutil/dict.h ++++ b/libavutil/dict.h +@@ -172,6 +172,15 @@ int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags + */ + int av_dict_set_int(AVDictionary **pm, const char *key, int64_t value, int flags); + ++/** ++ * Convenience wrapper for av_dict_get that converts the value to a pointer ++ * and stores it. ++ */ ++int av_dict_set_intptr(AVDictionary **pm, const char *key, uintptr_t value, int flags); ++uintptr_t av_dict_get_intptr(const AVDictionary *m, const char* key); ++uintptr_t av_dict_strtoptr(char * value); ++char * av_dict_ptrtostr(uintptr_t value); ++ + /** + * Parse the key/value pairs list and add the parsed entries to a dictionary. + * +-- +2.39.5 (Apple Git-154) + diff --git a/patches/ffmpeg-n7.1.1/0008-add-4-dummy-ijkplaceholder-demuxers.patch b/patches/ffmpeg-n7.1.1/0008-add-4-dummy-ijkplaceholder-demuxers.patch new file mode 100644 index 000000000..7a635660f --- /dev/null +++ b/patches/ffmpeg-n7.1.1/0008-add-4-dummy-ijkplaceholder-demuxers.patch @@ -0,0 +1,41 @@ +From b5b783a51493598c60536cbaf65614f27c3f29dd Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Thu, 29 May 2025 11:03:35 +0800 +Subject: [PATCH] add 4 dummy ijkplaceholder demuxers + +--- + libavformat/allformats.c | 5 +++++ + libavformat/ijkutils.c | 4 ++++ + 2 files changed, 9 insertions(+) + +diff --git a/libavformat/allformats.c b/libavformat/allformats.c +index 063be70..dbae42e 100644 +--- a/libavformat/allformats.c ++++ b/libavformat/allformats.c +@@ -580,6 +580,11 @@ extern const FFInputFormat ff_vapoursynth_demuxer; + extern AVInputFormat ff_ijklivehook_demuxer; + extern AVInputFormat ff_ijklas_demuxer; + ++extern AVInputFormat ff_ijkplaceholder1_demuxer; ++extern AVInputFormat ff_ijkplaceholder2_demuxer; ++extern AVInputFormat ff_ijkplaceholder3_demuxer; ++extern AVInputFormat ff_ijkplaceholder4_demuxer; ++ + #include "libavformat/muxer_list.c" + #include "libavformat/demuxer_list.c" + +diff --git a/libavformat/ijkutils.c b/libavformat/ijkutils.c +index 107b238..0534757 100644 +--- a/libavformat/ijkutils.c ++++ b/libavformat/ijkutils.c +@@ -99,3 +99,7 @@ AVInputFormat ff_##x##_demuxer = { \ + */ + IJK_DUMMY_DEMUXER(ijklivehook); + IJK_DUMMY_DEMUXER(ijklas); ++IJK_DUMMY_DEMUXER(ijkplaceholder1); ++IJK_DUMMY_DEMUXER(ijkplaceholder2); ++IJK_DUMMY_DEMUXER(ijkplaceholder3); ++IJK_DUMMY_DEMUXER(ijkplaceholder4); +-- +2.39.5 (Apple Git-154) + diff --git a/patches/ffmpeg-n7.1.1/0009-add-3-dummy-ijkhttp-protocols.patch b/patches/ffmpeg-n7.1.1/0009-add-3-dummy-ijkhttp-protocols.patch new file mode 100644 index 000000000..3251c8be7 --- /dev/null +++ b/patches/ffmpeg-n7.1.1/0009-add-3-dummy-ijkhttp-protocols.patch @@ -0,0 +1,42 @@ +From d49f164f790a3ed23e9701fa72e5720535bec901 Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Wed, 28 May 2025 18:23:51 +0800 +Subject: [PATCH] add 3 dummy ijkhttp protocols + +--- + libavformat/ijkutils.c | 3 +++ + libavformat/protocols.c | 4 ++++ + 2 files changed, 7 insertions(+) + +diff --git a/libavformat/ijkutils.c b/libavformat/ijkutils.c +index 5999101..18b81af 100644 +--- a/libavformat/ijkutils.c ++++ b/libavformat/ijkutils.c +@@ -65,6 +65,9 @@ IJK_DUMMY_PROTOCOL(ijkhttphook); + IJK_DUMMY_PROTOCOL(ijksegment); + IJK_DUMMY_PROTOCOL(ijktcphook); + IJK_DUMMY_PROTOCOL(ijkio); ++IJK_DUMMY_PROTOCOL(ijkhttp1); ++IJK_DUMMY_PROTOCOL(ijkhttp2); ++IJK_DUMMY_PROTOCOL(ijkhttp3); + + #define IJK_FF_DEMUXER(x) \ + extern AVInputFormat ff_##x##_demuxer; \ +diff --git a/libavformat/protocols.c b/libavformat/protocols.c +index 719caf8..f5eb0db 100644 +--- a/libavformat/protocols.c ++++ b/libavformat/protocols.c +@@ -85,6 +85,10 @@ extern const URLProtocol ff_ijksegment_protocol; + extern const URLProtocol ff_ijktcphook_protocol; + extern const URLProtocol ff_ijkio_protocol; + ++extern const URLProtocol ff_ijkhttp1_protocol; ++extern const URLProtocol ff_ijkhttp2_protocol; ++extern const URLProtocol ff_ijkhttp3_protocol; ++ + #include "libavformat/protocol_list.c" + + const AVClass *ff_urlcontext_child_class_iterate(void **iter) +-- +2.39.5 (Apple Git-154) + diff --git a/patches/ffmpeg-n7.1.1/0010-control-which-http-impl-was-used-by-set-selected_htt.patch b/patches/ffmpeg-n7.1.1/0010-control-which-http-impl-was-used-by-set-selected_htt.patch new file mode 100644 index 000000000..e36c9bdb6 --- /dev/null +++ b/patches/ffmpeg-n7.1.1/0010-control-which-http-impl-was-used-by-set-selected_htt.patch @@ -0,0 +1,128 @@ +From 32393a823175ffadba9d635b86f8836c503b837e Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Wed, 28 May 2025 18:25:51 +0800 +Subject: [PATCH] control which http impl was used by set selected_http option + +--- + libavformat/avio.c | 63 ++++++++++++++++++++++++++++++++++++++++++++-- + libavformat/url.h | 16 ++++++++++++ + 2 files changed, 77 insertions(+), 2 deletions(-) + +diff --git a/libavformat/avio.c b/libavformat/avio.c +index d109f3a..8c6b769 100644 +--- a/libavformat/avio.c ++++ b/libavformat/avio.c +@@ -359,6 +359,65 @@ int ffurl_alloc(URLContext **puc, const char *filename, int flags, + return AVERROR_PROTOCOL_NOT_FOUND; + } + ++ ++static const struct URLProtocol *url_find_the_protocol(const char *proto_str) ++{ ++ const URLProtocol **protocols = ffurl_get_protocols(NULL, NULL); ++ if (!protocols) ++ return NULL; ++ for (int i = 0; protocols[i]; i++) { ++ const URLProtocol *up = protocols[i]; ++ if (!strcmp(proto_str, up->name)) { ++ av_freep(&protocols); ++ return up; ++ } ++ } ++ av_freep(&protocols); ++ return NULL; ++} ++ ++int ffurl_alloc2(URLContext **puc, const char *filename, int flags, ++ const AVIOInterruptCB *int_cb, AVDictionary **options) ++{ ++ if (options && *options) { ++ AVDictionaryEntry *e = av_dict_get(*options, "selected_http", NULL, 0); ++ const char *selected_http; ++ if (e && (selected_http = e->value)) { ++ ++ char proto_str[128] = {0}; ++ size_t proto_len = strspn(filename, URL_SCHEME_CHARS); ++ if (filename[proto_len] != ':' && ++ (strncmp(filename, "subfile,", 8) || !strchr(filename + proto_len + 1, ':')) || ++ is_dos_path(filename)) ++ strcpy(proto_str, "file"); ++ else ++ av_strlcpy(proto_str, filename, ++ FFMIN(proto_len + 1, sizeof(proto_str))); ++ //only apply http protocol ++ if (!strcmp(proto_str, "http") || !strcmp(proto_str, "https")) { ++ if (!strcmp(selected_http, "ijkhttp1") || !strcmp(selected_http, "ijkhttp2") || !strcmp(selected_http, "ijkhttp3")) { ++ const URLProtocol *p = url_find_the_protocol(selected_http); ++ if (p) { ++ av_log(NULL, AV_LOG_DEBUG, "%s use %s send request\n",proto_str,selected_http); ++ return url_alloc_for_protocol(puc, p, filename, flags, int_cb); ++ } ++ *puc = NULL; ++ av_log(NULL, AV_LOG_ERROR, "some thing is fault,check %s protocol\n", selected_http); ++ return AVERROR_PROTOCOL_NOT_FOUND; ++ } else { ++ av_log(NULL, AV_LOG_ERROR, "invalid selected_http value: %s\n", selected_http); ++ av_assert0(0); ++ return AVERROR_PROTOCOL_NOT_FOUND; ++ } ++ } else { ++ av_log(NULL, AV_LOG_DEBUG, "%s not use %s\n",proto_str,selected_http); ++ } ++ } ++ } ++ ++ return ffurl_alloc(puc, filename, flags, int_cb); ++} ++ + int ffurl_open_whitelist(URLContext **puc, const char *filename, int flags, + const AVIOInterruptCB *int_cb, AVDictionary **options, + const char *whitelist, const char* blacklist, +@@ -366,7 +425,7 @@ int ffurl_open_whitelist(URLContext **puc, const char *filename, int flags, + { + AVDictionary *tmp_opts = NULL; + AVDictionaryEntry *e; +- int ret = ffurl_alloc(puc, filename, flags, int_cb); ++ int ret = ffurl_alloc2(puc, filename, flags, int_cb, options); + if (ret < 0) + return ret; + if (parent) { +@@ -735,7 +794,7 @@ int avio_open_dir(AVIODirContext **s, const char *url, AVDictionary **options) + goto fail; + } + +- if ((ret = ffurl_alloc(&h, url, AVIO_FLAG_READ, NULL)) < 0) ++ if ((ret = ffurl_alloc2(&h, url, AVIO_FLAG_READ, NULL, options)) < 0) + goto fail; + + if (h->prot->url_open_dir && h->prot->url_read_dir && h->prot->url_close_dir) { +diff --git a/libavformat/url.h b/libavformat/url.h +index 0784d77..53c6f13 100644 +--- a/libavformat/url.h ++++ b/libavformat/url.h +@@ -112,6 +112,22 @@ typedef struct URLProtocol { + int ffurl_alloc(URLContext **puc, const char *filename, int flags, + const AVIOInterruptCB *int_cb); + ++ /** ++ * Create a URLContext for accessing to the resource indicated by ++ * url, but do not initiate the connection yet. ++ * ++ * @param puc pointer to the location where, in case of success, the ++ * function puts the pointer to the created URLContext ++ * @param flags flags which control how the resource indicated by url ++ * is to be opened ++ * @param int_cb interrupt callback to use for the URLContext, may be ++ * NULL ++ * @param options A dictionary filled with options for replace http protocol ++ * @return >= 0 in case of success, a negative value corresponding to an ++ * AVERROR code in case of failure ++ */ ++int ffurl_alloc2(URLContext **puc, const char *filename, int flags, ++ const AVIOInterruptCB *int_cb, AVDictionary **options); + /** + * Connect an URLContext that has been allocated by ffurl_alloc + * +-- +2.39.5 (Apple Git-154) + diff --git a/patches/ffmpeg-n7.1.1/0011-correct-file-seekable-value-range-0-means-streamed-c.patch b/patches/ffmpeg-n7.1.1/0011-correct-file-seekable-value-range-0-means-streamed-c.patch new file mode 100644 index 000000000..f7a29f093 --- /dev/null +++ b/patches/ffmpeg-n7.1.1/0011-correct-file-seekable-value-range-0-means-streamed-c.patch @@ -0,0 +1,26 @@ +From 4980d45cd1a6c31f4b81b70818b6aa409f23d71e Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Wed, 28 May 2025 18:37:38 +0800 +Subject: [PATCH] correct file seekable value range, 0 means streamed can't + seek, 1 means not streamed can seek. + +--- + libavformat/file.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libavformat/file.c b/libavformat/file.c +index 6a66040..c1d3ce7 100644 +--- a/libavformat/file.c ++++ b/libavformat/file.c +@@ -105,7 +105,7 @@ static const AVOption file_options[] = { + { "truncate", "truncate existing files on write", offsetof(FileContext, trunc), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, AV_OPT_FLAG_ENCODING_PARAM }, + { "blocksize", "set I/O operation maximum block size", offsetof(FileContext, blocksize), AV_OPT_TYPE_INT, { .i64 = INT_MAX }, 1, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM }, + { "follow", "Follow a file as it is being written", offsetof(FileContext, follow), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, AV_OPT_FLAG_DECODING_PARAM }, +- { "seekable", "Sets if the file is seekable", offsetof(FileContext, seekable), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 0, AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_ENCODING_PARAM }, ++ { "seekable", "Sets if the file is seekable", offsetof(FileContext, seekable), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_ENCODING_PARAM }, + { NULL } + }; + +-- +2.39.5 (Apple Git-154) + diff --git a/patches/ffmpeg-n7.1.1/0012-fix-lrcdec-read-line-bug-on-osx.patch b/patches/ffmpeg-n7.1.1/0012-fix-lrcdec-read-line-bug-on-osx.patch new file mode 100644 index 000000000..ad4b7733e --- /dev/null +++ b/patches/ffmpeg-n7.1.1/0012-fix-lrcdec-read-line-bug-on-osx.patch @@ -0,0 +1,43 @@ +From 30f20ff3ec0de99847be4da379f497bbacc61501 Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Wed, 28 May 2025 18:39:38 +0800 +Subject: [PATCH] fix lrcdec read line bug on osx + +--- + libavformat/lrcdec.c | 20 +++++++++++--------- + 1 file changed, 11 insertions(+), 9 deletions(-) + +diff --git a/libavformat/lrcdec.c b/libavformat/lrcdec.c +index 68c44bc..2bea1e1 100644 +--- a/libavformat/lrcdec.c ++++ b/libavformat/lrcdec.c +@@ -105,15 +105,17 @@ static int64_t read_line(AVBPrint *buf, AVIOContext *pb) + int64_t pos = avio_tell(pb); + + av_bprint_clear(buf); +- while(!avio_feof(pb)) { +- int c = avio_r8(pb); +- if(c != '\r') { +- av_bprint_chars(buf, c, 1); +- } +- if(c == '\n') { +- break; +- } +- } ++ ff_read_line_to_bprint_overwrite(pb, buf); ++ ++ // while(!avio_feof(pb)) { ++ // int c = avio_r8(pb); ++ // if(c != '\r') { ++ // av_bprint_chars(buf, c, 1); ++ // } ++ // if(c == '\n') { ++ // break; ++ // } ++ // } + return pos; + } + +-- +2.39.5 (Apple Git-154) + diff --git a/patches/ffmpeg-n7.1.1/0013-avformat-mpegts-index-only-keyframes-to-ensure-accur.patch b/patches/ffmpeg-n7.1.1/0013-avformat-mpegts-index-only-keyframes-to-ensure-accur.patch new file mode 100644 index 000000000..7eeef4b94 --- /dev/null +++ b/patches/ffmpeg-n7.1.1/0013-avformat-mpegts-index-only-keyframes-to-ensure-accur.patch @@ -0,0 +1,47 @@ +From 72aa2e8ec05cd35a3cb2b4629220b0d37c9538ee Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Wed, 28 May 2025 18:48:39 +0800 +Subject: [PATCH] avformat/mpegts: index only keyframes to ensure accurate + seeks by default + +--- + libavformat/mpegts.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c +index 86b7c8e..58b50cb 100644 +--- a/libavformat/mpegts.c ++++ b/libavformat/mpegts.c +@@ -157,6 +157,7 @@ struct MpegTSContext { + + int skip_changes; + int skip_clear; ++ int seek_flag_keyframe; + int skip_unknown_pmt; + + int scan_all_pmts; +@@ -210,6 +211,8 @@ static const AVOption options[] = { + {.i64 = 0}, 0, 1, 0 }, + {"max_packet_size", "maximum size of emitted packet", offsetof(MpegTSContext, max_packet_size), AV_OPT_TYPE_INT, + {.i64 = 204800}, 1, INT_MAX/2, AV_OPT_FLAG_DECODING_PARAM }, ++ {"seek_flag_keyframe", "seek use keyframe mode", offsetof(MpegTSContext, seek_flag_keyframe), AV_OPT_TYPE_BOOL, ++ {.i64 = 1}, 0, 1, AV_OPT_FLAG_DECODING_PARAM }, + { NULL }, + }; + +@@ -3363,9 +3366,10 @@ static int64_t mpegts_get_dts(AVFormatContext *s, int stream_index, + av_packet_free(&pkt); + return AV_NOPTS_VALUE; + } +- if (pkt->dts != AV_NOPTS_VALUE && pkt->pos >= 0) { ++ ++ if (pkt->dts != AV_NOPTS_VALUE && pkt->pos >= 0 && (!ts->seek_flag_keyframe || (pkt->flags & AV_PKT_FLAG_KEY))) { + ff_reduce_index(s, pkt->stream_index); +- av_add_index_entry(s->streams[pkt->stream_index], pkt->pos, pkt->dts, 0, 0, AVINDEX_KEYFRAME /* FIXME keyframe? */); ++ av_add_index_entry(s->streams[pkt->stream_index], pkt->pos, pkt->dts, 0, 0, AVINDEX_KEYFRAME); + if (pkt->stream_index == stream_index && pkt->pos >= *ppos) { + int64_t dts = pkt->dts; + *ppos = pkt->pos; +-- +2.39.5 (Apple Git-154) + diff --git a/patches/ffmpeg-n7.1.1/0014-support-inherit-hls-opts.patch b/patches/ffmpeg-n7.1.1/0014-support-inherit-hls-opts.patch new file mode 100644 index 000000000..4d2be51a5 --- /dev/null +++ b/patches/ffmpeg-n7.1.1/0014-support-inherit-hls-opts.patch @@ -0,0 +1,113 @@ +From 887954a624271b7139f202c6f1336c74df4c3e9e Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Wed, 28 May 2025 18:49:10 +0800 +Subject: [PATCH] support inherit hls opts + +--- + libavformat/hls.c | 45 +++++++++++++++++++++++++++++++++++++++++---- + 1 file changed, 41 insertions(+), 4 deletions(-) + +diff --git a/libavformat/hls.c b/libavformat/hls.c +index 12b49c8..069db99 100644 +--- a/libavformat/hls.c ++++ b/libavformat/hls.c +@@ -233,6 +233,7 @@ typedef struct HLSContext { + int seg_max_retry; + AVIOContext *playlist_pb; + HLSCryptoContext crypto_ctx; ++ char *seg_inherit_opts; + } HLSContext; + + static void free_segment_dynarray(struct segment **segments, int n_segments) +@@ -1992,7 +1993,32 @@ static int hls_close(AVFormatContext *s) + return 0; + } + +-static int hls_read_header(AVFormatContext *s) ++static int copy_hls_headers_for_http(AVDictionary **dst, const AVDictionary *src, const char *opts) ++{ ++ if (!opts) ++ return 0; ++ ++ char *my_opts = opts; ++ char *saved = NULL; ++ char *opt = NULL; ++ int ret = 0; ++ ++ while ((opt = av_strtok(my_opts, ",", &saved))) { ++ AVDictionaryEntry *t = NULL; ++ while ((t = av_dict_get(src, "", t, AV_DICT_IGNORE_SUFFIX))) { ++ if (t->key && !strcmp(t->key, opt)) { ++ ret = av_dict_set(dst, t->key, t->value, 0); ++ if (ret < 0) ++ return ret; ++ } ++ } ++ my_opts = saved; ++ } ++ ++ return ret; ++} ++ ++static int hls_read_header2(AVFormatContext *s, AVDictionary **a_options) + { + HLSContext *c = s->priv_data; + int ret = 0, i; +@@ -2005,9 +2031,20 @@ static int hls_read_header(AVFormatContext *s) + c->first_timestamp = AV_NOPTS_VALUE; + c->cur_timestamp = AV_NOPTS_VALUE; + ++ //pb only include keys which in hls_options list. + if ((ret = ffio_copy_url_options(s->pb, &c->avio_opts)) < 0) + return ret; + ++ //current a_options is original options,you can filter special keys ++ copy_hls_headers_for_http(&c->avio_opts, *a_options, c->seg_inherit_opts); ++ //use segment format options override inherit options. ++ av_dict_copy(&c->avio_opts, c->seg_format_opts, 0); ++ ++ // AVDictionaryEntry *t = NULL; ++ // while ((t = av_dict_get(c->avio_opts, "", t, AV_DICT_IGNORE_SUFFIX))) { ++ // av_log(NULL, AV_LOG_INFO, "%-*s: %-*s = %s\n", 12, "hls_read_header2", 28, t->key, t->value); ++ // } ++ + /* XXX: Some HLS servers don't like being sent the range header, + in this case, need to setting http_seekable = 0 to disable + the range header */ +@@ -2104,6 +2141,7 @@ static int hls_read_header(AVFormatContext *s) + pls->needed = 1; + pls->parent = s; + ++ av_dict_copy(&options, c->avio_opts, 0); + /* + * If this is a live stream and this playlist looks like it is one segment + * behind, try to sync it up so that every substream starts at the same +@@ -2221,8 +2259,6 @@ static int hls_read_header(AVFormatContext *s) + if ((ret = ff_copy_whiteblacklists(pls->ctx, s)) < 0) + return ret; + +- av_dict_copy(&options, c->seg_format_opts, 0); +- + ret = avformat_open_input(&pls->ctx, pls->segments[0]->url, in_fmt, &options); + av_dict_free(&options); + if (ret < 0) +@@ -2691,6 +2727,7 @@ static const AVOption hls_options[] = { + OFFSET(seg_format_opts), AV_OPT_TYPE_DICT, {.str = NULL}, 0, 0, FLAGS}, + {"seg_max_retry", "Maximum number of times to reload a segment on error.", + OFFSET(seg_max_retry), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, FLAGS}, ++ {"seg_inherit_options", "Special keys inherit form options,apply for segment demuxer", OFFSET(seg_inherit_opts), AV_OPT_TYPE_STRING, {.str = NULL}, INT_MIN, INT_MAX, FLAGS}, + {NULL} + }; + +@@ -2709,7 +2746,7 @@ const FFInputFormat ff_hls_demuxer = { + .priv_data_size = sizeof(HLSContext), + .flags_internal = FF_INFMT_FLAG_INIT_CLEANUP, + .read_probe = hls_probe, +- .read_header = hls_read_header, ++ .read_header2 = hls_read_header2, + .read_packet = hls_read_packet, + .read_close = hls_close, + .read_seek = hls_read_seek, +-- +2.39.5 (Apple Git-154) + diff --git a/patches/ffmpeg-n7.1.1/0015-fix-can-t-seek-to-00-00-bug-baidu-neddisk-hls-start_.patch b/patches/ffmpeg-n7.1.1/0015-fix-can-t-seek-to-00-00-bug-baidu-neddisk-hls-start_.patch new file mode 100644 index 000000000..7a02382ca --- /dev/null +++ b/patches/ffmpeg-n7.1.1/0015-fix-can-t-seek-to-00-00-bug-baidu-neddisk-hls-start_.patch @@ -0,0 +1,29 @@ +From 6b759eeb996340b07fe1caa1846b48d722da34d6 Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Wed, 28 May 2025 18:49:48 +0800 +Subject: [PATCH] fix can't seek to 00:00 bug, baidu neddisk hls start_time is + less than first_timestamp + +--- + libavformat/hls.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/libavformat/hls.c b/libavformat/hls.c +index 069db99..098307b 100644 +--- a/libavformat/hls.c ++++ b/libavformat/hls.c +@@ -1775,7 +1775,10 @@ static int find_timestamp_in_playlist(HLSContext *c, struct playlist *pls, + + if (timestamp < pos) { + *seq_no = pls->start_seq_no; +- return 0; ++ if (seg_start_ts) { ++ *seg_start_ts = pos; ++ } ++ return 1; + } + + for (i = 0; i < pls->n_segments; i++) { +-- +2.39.5 (Apple Git-154) + diff --git a/patches/ffmpeg-n7.1.1/0016-Correct-the-wrong-codecpar-codec_id-which-read-from-.patch b/patches/ffmpeg-n7.1.1/0016-Correct-the-wrong-codecpar-codec_id-which-read-from-.patch new file mode 100644 index 000000000..11901040b --- /dev/null +++ b/patches/ffmpeg-n7.1.1/0016-Correct-the-wrong-codecpar-codec_id-which-read-from-.patch @@ -0,0 +1,60 @@ +From 5cf9674b9c26494264cb4c41f7b813985d9c5cfe Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Wed, 28 May 2025 18:52:01 +0800 +Subject: [PATCH] Correct the wrong codecpar->codec_id which read from MIME of + ID3tags, but the real data was encoded in PNG/JPEG/TIFF + +--- + libavformat/id3v2.c | 7 ++++++- + libavformat/img2dec.c | 2 +- + libavformat/mov.c | 2 +- + 3 files changed, 8 insertions(+), 3 deletions(-) + +diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c +index 3507885..cfbedd8 100644 +--- a/libavformat/id3v2.c ++++ b/libavformat/id3v2.c +@@ -1178,8 +1178,13 @@ int ff_id3v2_parse_apic(AVFormatContext *s, ID3v2ExtraMeta *extra_meta) + st = s->streams[s->nb_streams - 1]; + st->codecpar->codec_id = apic->id; + +- if (AV_RB64(st->attached_pic.data) == PNGSIG) ++ if (AV_RB64(st->attached_pic.data) == PNGSIG || AV_RB64(st->attached_pic.data) == MNGSIG) { + st->codecpar->codec_id = AV_CODEC_ID_PNG; ++ } else if (AV_RB24(st->attached_pic.data) == 0xffd8ff) { ++ st->codecpar->codec_id = AV_CODEC_ID_MJPEG; ++ } else if (AV_RB32(st->attached_pic.data) == 0x49492a00 || AV_RB32(st->attached_pic.data) == 0x4D4D002a) { ++ st->codecpar->codec_id = AV_CODEC_ID_TIFF; ++ } + + if (apic->description[0]) + av_dict_set(&st->metadata, "title", apic->description, 0); +diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c +index 3389fa8..3c24955 100644 +--- a/libavformat/img2dec.c ++++ b/libavformat/img2dec.c +@@ -914,7 +914,7 @@ static int png_probe(const AVProbeData *p) + { + const uint8_t *b = p->buf; + +- if (AV_RB64(b) == 0x89504e470d0a1a0a) ++ if (AV_RB64(b) == 0x89504e470d0a1a0a || AV_RB64(b) == 0x8a4d4e470d0a1a0a) + return AVPROBE_SCORE_MAX - 1; + return 0; + } +diff --git a/libavformat/mov.c b/libavformat/mov.c +index 41ca280..7319202 100644 +--- a/libavformat/mov.c ++++ b/libavformat/mov.c +@@ -259,7 +259,7 @@ static int mov_read_covr(MOVContext *c, AVIOContext *pb, int type, int len) + sc->refcount = 1; + + if (st->attached_pic.size >= 8 && id != AV_CODEC_ID_BMP) { +- if (AV_RB64(st->attached_pic.data) == 0x89504e470d0a1a0a) { ++ if (AV_RB64(st->attached_pic.data) == 0x89504e470d0a1a0a || AV_RB64(st->attached_pic.data) == 0x8a4d4e470d0a1a0a) { + id = AV_CODEC_ID_PNG; + } else { + id = AV_CODEC_ID_MJPEG; +-- +2.39.5 (Apple Git-154) + diff --git a/patches/ffmpeg-n7.1.1/0017-avformat-mov-fix-to-detect-if-stream-position-has-be.patch b/patches/ffmpeg-n7.1.1/0017-avformat-mov-fix-to-detect-if-stream-position-has-be.patch new file mode 100644 index 000000000..3c28e5809 --- /dev/null +++ b/patches/ffmpeg-n7.1.1/0017-avformat-mov-fix-to-detect-if-stream-position-has-be.patch @@ -0,0 +1,74 @@ +From af0bfbe05ce031e3d602b2abb7595ece26a45a3a Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Wed, 28 May 2025 18:52:46 +0800 +Subject: [PATCH] avformat mov fix to detect if stream position has been reset + (https://patchwork.ffmpeg.org/project/ffmpeg/patch/20200424152042.29383-3-hello.vectronic@gmail.com/) + +--- + libavformat/mov.c | 35 ++++++++++++++++++++++++++++++++--- + 1 file changed, 32 insertions(+), 3 deletions(-) + +diff --git a/libavformat/mov.c b/libavformat/mov.c +index 7319202..d9d7b80 100644 +--- a/libavformat/mov.c ++++ b/libavformat/mov.c +@@ -10473,15 +10473,15 @@ static int mov_switch_root(AVFormatContext *s, int64_t target, int index) + + if (index >= 0 && index < mov->frag_index.nb_items) + target = mov->frag_index.item[index].moof_offset; +- if (avio_seek(s->pb, target, SEEK_SET) != target) { ++ if (target >= 0 && avio_seek(s->pb, target, SEEK_SET) != target) { + av_log(mov->fc, AV_LOG_ERROR, "root atom offset 0x%"PRIx64": partial file\n", target); + return AVERROR_INVALIDDATA; + } + + mov->next_root_atom = 0; +- if (index < 0 || index >= mov->frag_index.nb_items) ++ if ((index < 0 && target >= 0) || index >= mov->frag_index.nb_items) + index = search_frag_moof_offset(&mov->frag_index, target); +- if (index < mov->frag_index.nb_items && ++ if (index >= 0 && index < mov->frag_index.nb_items && + mov->frag_index.item[index].moof_offset == target) { + if (index + 1 < mov->frag_index.nb_items) + mov->next_root_atom = mov->frag_index.item[index + 1].moof_offset; +@@ -10661,8 +10661,37 @@ static int mov_read_packet(AVFormatContext *s, AVPacket *pkt) + AVStream *st = NULL; + int64_t current_index; + int ret; ++ int i; + mov->fc = s; + retry: ++ if (s->pb->pos == 0) { ++ // Discard current fragment index ++ if (mov->frag_index.allocated_size > 0) { ++ av_freep(&mov->frag_index.item); ++ mov->frag_index.nb_items = 0; ++ mov->frag_index.allocated_size = 0; ++ mov->frag_index.current = -1; ++ mov->frag_index.complete = 0; ++ } ++ ++ for (i = 0; i < s->nb_streams; i++) { ++ AVStream *avst = s->streams[i]; ++ MOVStreamContext *msc = avst->priv_data; ++ ++ // Clear current sample ++ mov_current_sample_set(msc, 0); ++ ++ // Discard current index entries ++ if (ffstream(avst)->index_entries_allocated_size > 0) { ++ av_freep(&ffstream(avst)->index_entries); ++ ffstream(avst)->index_entries_allocated_size = 0; ++ ffstream(avst)->nb_index_entries = 0; ++ } ++ } ++ ++ if ((ret = mov_switch_root(s, -1, -1)) < 0) ++ return ret; ++ } + sample = mov_find_next_sample(s, &st); + if (!sample || (mov->next_root_atom && sample->pos > mov->next_root_atom)) { + if (!mov->next_root_atom) +-- +2.39.5 (Apple Git-154) + diff --git a/patches/ffmpeg-n7.1.1/0018-fix-http-chunked-transfer-get-wrong-size-cause-av_re.patch b/patches/ffmpeg-n7.1.1/0018-fix-http-chunked-transfer-get-wrong-size-cause-av_re.patch new file mode 100644 index 000000000..049129f04 --- /dev/null +++ b/patches/ffmpeg-n7.1.1/0018-fix-http-chunked-transfer-get-wrong-size-cause-av_re.patch @@ -0,0 +1,32 @@ +From 005c1138ee841a98639b6a8cdcf361c09db18a5a Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Thu, 29 May 2025 08:56:02 +0800 +Subject: [PATCH] fix http chunked transfer get wrong size cause av_read_frame + can not return eof bug + +--- + libavformat/img2dec.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c +index 3c24955..b443602 100644 +--- a/libavformat/img2dec.c ++++ b/libavformat/img2dec.c +@@ -491,7 +491,13 @@ int ff_img_read_packet(AVFormatContext *s1, AVPacket *pkt) + if (s->frame_size > 0) { + size[0] = s->frame_size; + } else if (!ffstream(s1->streams[0])->parser) { +- size[0] = avio_size(s1->pb); ++ //http Transfer-Encoding: chunked the size is -78; ++ int64_t s = avio_size(s1->pb); ++ if (s < 0) { ++ size[0] = 4096; ++ } else { ++ size[0] = s; ++ } + } else { + size[0] = 4096; + } +-- +2.39.5 (Apple Git-154) + diff --git a/patches/ffmpeg-n7.1.1/0019-not-very-useful-log-use-trace-level.patch b/patches/ffmpeg-n7.1.1/0019-not-very-useful-log-use-trace-level.patch new file mode 100644 index 000000000..b758e878f --- /dev/null +++ b/patches/ffmpeg-n7.1.1/0019-not-very-useful-log-use-trace-level.patch @@ -0,0 +1,76 @@ +From 2ebc057a63774ca24a98c3cfbda7fc183da1082f Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Thu, 29 May 2025 09:02:16 +0800 +Subject: [PATCH] not very useful log use trace level + +--- + libavcodec/h2645_parse.c | 6 +++--- + libavcodec/h2645_vui.c | 2 +- + libavformat/demux.c | 4 ++-- + 3 files changed, 6 insertions(+), 6 deletions(-) + +diff --git a/libavcodec/h2645_parse.c b/libavcodec/h2645_parse.c +index 8281699..0aded68 100644 +--- a/libavcodec/h2645_parse.c ++++ b/libavcodec/h2645_parse.c +@@ -355,7 +355,7 @@ static int vvc_parse_nal_header(H2645NAL *nal, void *logctx) + if ((nal->type >= VVC_IDR_W_RADL && nal->type <= VVC_RSV_IRAP_11) && nal->temporal_id) + return AVERROR_INVALIDDATA; + +- av_log(logctx, AV_LOG_DEBUG, ++ av_log(logctx, AV_LOG_TRACE, + "nal_unit_type: %d(%s), nuh_layer_id: %d, temporal_id: %d\n", + nal->type, vvc_nal_unit_name(nal->type), nal->nuh_layer_id, nal->temporal_id); + +@@ -376,7 +376,7 @@ static int hevc_parse_nal_header(H2645NAL *nal, void *logctx) + if (nal->temporal_id < 0) + return AVERROR_INVALIDDATA; + +- av_log(logctx, AV_LOG_DEBUG, ++ av_log(logctx, AV_LOG_TRACE, + "nal_unit_type: %d(%s), nuh_layer_id: %d, temporal_id: %d\n", + nal->type, hevc_nal_unit_name(nal->type), nal->nuh_layer_id, nal->temporal_id); + +@@ -393,7 +393,7 @@ static int h264_parse_nal_header(H2645NAL *nal, void *logctx) + nal->ref_idc = get_bits(gb, 2); + nal->type = get_bits(gb, 5); + +- av_log(logctx, AV_LOG_DEBUG, ++ av_log(logctx, AV_LOG_TRACE, + "nal_unit_type: %d(%s), nal_ref_idc: %d\n", + nal->type, h264_nal_unit_name(nal->type), nal->ref_idc); + +diff --git a/libavcodec/h2645_vui.c b/libavcodec/h2645_vui.c +index e5c7bf4..8301492 100644 +--- a/libavcodec/h2645_vui.c ++++ b/libavcodec/h2645_vui.c +@@ -36,7 +36,7 @@ + + void ff_h2645_decode_common_vui_params(GetBitContext *gb, H2645VUI *vui, void *logctx) + { +- av_log(logctx, AV_LOG_DEBUG, "Decoding VUI\n"); ++ av_log(logctx, AV_LOG_TRACE, "Decoding VUI\n"); + + vui->aspect_ratio_info_present_flag = get_bits1(gb); + if (vui->aspect_ratio_info_present_flag) { +diff --git a/libavformat/demux.c b/libavformat/demux.c +index ff62292..c0d744d 100644 +--- a/libavformat/demux.c ++++ b/libavformat/demux.c +@@ -2024,11 +2024,11 @@ static void estimate_timings(AVFormatContext *ic, int64_t old_offset) + for (unsigned i = 0; i < ic->nb_streams; i++) { + AVStream *const st = ic->streams[i]; + if (st->time_base.den) +- av_log(ic, AV_LOG_TRACE, "stream %u: start_time: %s duration: %s\n", i, ++ av_log(ic, AV_LOG_DEBUG, "stream %u: start_time: %s duration: %s\n", i, + av_ts2timestr(st->start_time, &st->time_base), + av_ts2timestr(st->duration, &st->time_base)); + } +- av_log(ic, AV_LOG_TRACE, ++ av_log(ic, AV_LOG_DEBUG, + "format: start_time: %s duration: %s (estimate from %s) bitrate=%"PRId64" kb/s\n", + av_ts2timestr(ic->start_time, &AV_TIME_BASE_Q), + av_ts2timestr(ic->duration, &AV_TIME_BASE_Q), +-- +2.39.5 (Apple Git-154) + diff --git a/patches/ffmpeg-n7.1.1/0020-fix-dash-file-error-unterminated-entity-reference-du.patch b/patches/ffmpeg-n7.1.1/0020-fix-dash-file-error-unterminated-entity-reference-du.patch new file mode 100644 index 000000000..faeaec17b --- /dev/null +++ b/patches/ffmpeg-n7.1.1/0020-fix-dash-file-error-unterminated-entity-reference-du.patch @@ -0,0 +1,29 @@ +From 147a176cf02538367918d931959dbb5071202777 Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Thu, 29 May 2025 09:45:39 +0800 +Subject: [PATCH] fix dash file error "unterminated entity reference" due to + ampersand in tag + +--- + libavformat/dashdec.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c +index 71d7906..4540ee3 100644 +--- a/libavformat/dashdec.c ++++ b/libavformat/dashdec.c +@@ -805,8 +805,10 @@ static int resolve_content_path(AVFormatContext *s, const char *url, int *max_ur + memset(p + 1, 0, strlen(p)); + } + av_strlcat(tmp_str, text + start, tmp_max_url_size); +- xmlNodeSetContent(baseurl_nodes[i], tmp_str); ++ xmlChar *escaped = xmlEncodeSpecialChars(NULL, tmp_str); ++ xmlNodeSetContent(baseurl_nodes[i], escaped); + updated = 1; ++ xmlFree(escaped); + xmlFree(text); + } + } +-- +2.39.5 (Apple Git-154) + diff --git a/patches/ffmpeg-n7.1.1/0021-Audio-Vivid-Parser-and-Demuxer-but-av3a-Decoder-is-a.patch b/patches/ffmpeg-n7.1.1/0021-Audio-Vivid-Parser-and-Demuxer-but-av3a-Decoder-is-a.patch new file mode 100644 index 000000000..5585e97fc --- /dev/null +++ b/patches/ffmpeg-n7.1.1/0021-Audio-Vivid-Parser-and-Demuxer-but-av3a-Decoder-is-a.patch @@ -0,0 +1,1359 @@ +From 5b534548ec28b006ca8ebf07c0cad8fe07b80833 Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Thu, 29 May 2025 10:53:30 +0800 +Subject: [PATCH] Audio Vivid Parser and Demuxer, but av3a Decoder is absent + +--- + libavcodec/Makefile | 1 + + libavcodec/av3a.h | 314 +++++++++++++++++++++++ + libavcodec/av3a_parser.c | 218 ++++++++++++++++ + libavcodec/codec_desc.c | 7 + + libavcodec/codec_id.h | 1 + + libavcodec/parsers.c | 1 + + libavcodec/utils.c | 1 + + libavformat/Makefile | 1 + + libavformat/allformats.c.rej | 9 + + libavformat/av3adec.c | 472 +++++++++++++++++++++++++++++++++++ + libavformat/isom_tags.c | 1 + + libavformat/mov.c.rej | 158 ++++++++++++ + libavformat/mpegts.c | 6 + + libavformat/mpegts.h | 2 +- + 14 files changed, 1191 insertions(+), 1 deletion(-) + create mode 100644 libavcodec/av3a.h + create mode 100644 libavcodec/av3a_parser.c + create mode 100644 libavformat/allformats.c.rej + create mode 100644 libavformat/av3adec.c + create mode 100644 libavformat/mov.c.rej + +diff --git a/libavcodec/Makefile b/libavcodec/Makefile +index ed5c705..03e80a2 100644 +--- a/libavcodec/Makefile ++++ b/libavcodec/Makefile +@@ -1185,6 +1185,7 @@ OBJS-$(CONFIG_AMR_PARSER) += amr_parser.o + OBJS-$(CONFIG_AV1_PARSER) += av1_parser.o av1_parse.o + OBJS-$(CONFIG_AVS2_PARSER) += avs2.o avs2_parser.o + OBJS-$(CONFIG_AVS3_PARSER) += avs3_parser.o ++OBJS-$(CONFIG_AV3A_PARSER) += av3a_parser.o + OBJS-$(CONFIG_BMP_PARSER) += bmp_parser.o + OBJS-$(CONFIG_CAVSVIDEO_PARSER) += cavs_parser.o + OBJS-$(CONFIG_COOK_PARSER) += cook_parser.o +diff --git a/libavcodec/av3a.h b/libavcodec/av3a.h +new file mode 100644 +index 0000000..14dc349 +--- /dev/null ++++ b/libavcodec/av3a.h +@@ -0,0 +1,314 @@ ++/* ++ * AV3A Common Header File ++ * ++ * Copyright (c) 2024 Shuai Liu ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#ifndef AVCODEC_AV3A_H ++#define AVCODEC_AV3A_H ++ ++#include "libavutil/samplefmt.h" ++#include "libavutil/channel_layout.h" ++ ++/* AATF header */ ++#define AV3A_MAX_NBYTES_HEADER 9 ++#define AV3A_AUDIO_SYNC_WORD 0xFFF ++#define AV3A_AUDIO_FRAME_SIZE 1024 ++#define AV3A_CHANNEL_LAYOUT_SIZE 15 ++#define AV3A_BITRATE_TABLE_SIZE 16 ++#define AV3A_FS_TABLE_SIZE 9 ++#define AV3A_RESOLUTION_TABLE_SIZE 3 ++#define AV3A_DCA3_BOX_MIN_SIZE 5 ++ ++/* Channel Layout */ ++#define AV3A_CH_LAYOUT_MONO (AV_CH_LAYOUT_MONO) ++#define AV3A_CH_LAYOUT_STEREO (AV_CH_LAYOUT_STEREO) ++#define AV3A_CH_LAYOUT_4POINT0 (AV3A_CH_LAYOUT_STEREO|AV_CH_FRONT_CENTER|AV_CH_BACK_CENTER) ++#define AV3A_CH_LAYOUT_5POINT1 (AV_CH_LAYOUT_5POINT1) ++#define AV3A_CH_LAYOUT_7POINT1 (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT) ++#define AV3A_CH_LAYOUT_5POINT1POINT2 (AV_CH_LAYOUT_5POINT1|AV_CH_TOP_SIDE_LEFT|AV_CH_TOP_SIDE_RIGHT) ++#define AV3A_CH_LAYOUT_7POINT1POINT2 (AV3A_CH_LAYOUT_7POINT1|AV_CH_TOP_SIDE_LEFT|AV_CH_TOP_SIDE_RIGHT) ++#define AV3A_CH_LAYOUT_5POINT1POINT4 (AV_CH_LAYOUT_5POINT1|AV_CH_TOP_FRONT_LEFT|AV_CH_TOP_FRONT_RIGHT|AV_CH_TOP_BACK_LEFT|AV_CH_TOP_BACK_RIGHT) ++#define AV3A_CH_LAYOUT_7POINT1POINT4 (AV3A_CH_LAYOUT_7POINT1|AV_CH_TOP_FRONT_LEFT|AV_CH_TOP_FRONT_RIGHT|AV_CH_TOP_BACK_LEFT|AV_CH_TOP_BACK_RIGHT) ++#define AV3A_CH_AUDIO_OBJECT (AV_CHAN_UNKNOWN) ++ ++/* AV3A Codec ID */ ++typedef enum { ++ AV3A_LOSSLESS_CODEC_ID = 1, ++ AV3A_LOSSY_CODEC_ID = 2 ++} Av3aCodecId; ++ ++/* Content Type */ ++typedef enum { ++ AV3A_CHANNEL_BASED_TYPE = 0, ++ AV3A_OBJECT_BASED_TYPE = 1, ++ AV3A_CHANNEL_OBJECT_TYPE = 2, ++ AV3A_AMBISONIC_TYPE = 3 ++} Av3aContentType; ++ ++/* Internal Coding Profile */ ++typedef enum { ++ AV3A_BASE_PROFILE = 0, ++ AV3A_OBJECT_METADATA_PROFILE = 1, ++ AV3A_AMBISONIC_PROFILE = 2 ++} Av3aCodingProfile; ++ ++/* NN Type */ ++typedef enum { ++ AV3A_BASELINE_NN_TYPE = 0, ++ AV3A_LC_NN_TYPE = 1 ++} Av3aNeuralNetworkType; ++ ++/* AV3A Channel Configuration */ ++typedef enum { ++ CHANNEL_CONFIG_MONO = 0, /* Mono = 0 */ ++ CHANNEL_CONFIG_STEREO = 1, /* Stereo = 1 */ ++ CHANNEL_CONFIG_MC_5_1 = 2, /* 5.1 = 2 */ ++ CHANNEL_CONFIG_MC_7_1 = 3, /* 7.1 = 3 */ ++ CHANNEL_CONFIG_MC_10_2 = 4, /* 10.2 = 4 */ ++ CHANNEL_CONFIG_MC_22_2 = 5, /* 22.2 = 5 */ ++ CHANNEL_CONFIG_MC_4_0 = 6, /* 4.0 = 6 */ ++ CHANNEL_CONFIG_MC_5_1_2 = 7, /* 5.1.2 = 7 */ ++ CHANNEL_CONFIG_MC_5_1_4 = 8, /* 5.1.4 = 8 */ ++ CHANNEL_CONFIG_MC_7_1_2 = 9, /* 7.1.2 = 9 */ ++ CHANNEL_CONFIG_MC_7_1_4 = 10, /* 7.1.4 = 10 */ ++ CHANNEL_CONFIG_HOA_ORDER1 = 11, /* HOA1 = 11 */ ++ CHANNEL_CONFIG_HOA_ORDER2 = 12, /* HOA2 = 12 */ ++ CHANNEL_CONFIG_HOA_ORDER3 = 13, /* HOA3 = 13 */ ++ CHANNEL_CONFIG_UNKNOWN = 14 /* UNKNOWN = 14 */ ++} Av3aChannelConfig; ++ ++typedef enum { ++ AV3A_AMBISONIC_FIRST_ORDER = 1, ++ AV3A_AMBISONIC_SECOND_ORDER = 2, ++ AV3A_AMBISONIC_THIRD_ORDER = 3 ++} Av3aAmbisonicOrder; ++ ++typedef struct { ++ int16_t sync_word; /* sync word */ ++ int16_t audio_codec_id; /* audio codec id */ ++ int16_t anc_data; /* anc data */ ++ int16_t nn_type; /* neural network type */ ++ int16_t coding_profile; /* coding profile */ ++ int16_t sampling_frequency_index; /* sampling frequency index */ ++ int16_t channel_number_index; /* channel number index */ ++ int16_t bitrate_index; /* bitrate index */ ++ int16_t soundbed_type; /* soundbed type */ ++ int16_t object_channel_number; /* object channel number */ ++ int16_t bitrate_index_per_channel; /* bitrate per object */ ++ int16_t order; /* ambisonics order */ ++ int16_t resolution_index; /* resolution index */ ++ ++ int32_t sampling_rate; /* sampling rate */ ++ int64_t total_bitrate; /* total bitrate */ ++ int16_t sample_format; /* sample format */ ++ int16_t resolution; /* resolution */ ++ int16_t content_type; /* internal content type */ ++ int16_t nb_channels; /* number of channels (channel configuration) */ ++ int16_t nb_objects; /* number of objects (object_channel_number + 1) */ ++ int16_t total_channels; /* total channels */ ++ int16_t hoa_order; /* ambisonic order (order + 1) */ ++ int32_t ch_layout_mask; /* channel layout mask */ ++} AATFHeaderInfo; ++ ++/* bitrate table for mono */ ++static const int64_t ff_av3a_mono_bitrate_table[AV3A_BITRATE_TABLE_SIZE] = { ++ 16000, 32000, 44000, 56000, 64000, 72000, 80000, 96000, 128000, 144000, ++ 164000, 192000, 0, 0, 0, 0 ++}; ++ ++/* bitrate table for stereo */ ++static const int64_t ff_av3a_stereo_bitrate_table[AV3A_BITRATE_TABLE_SIZE] = { ++ 24000, 32000, 48000, 64000, 80000, 96000, 128000, 144000, 192000, 256000, ++ 320000, 0, 0, 0, 0, 0 ++}; ++ ++/* bitrate table for MC 5.1 */ ++static const int64_t ff_av3a_mc5p1_bitrate_table[AV3A_BITRATE_TABLE_SIZE] = { ++ 192000, 256000, 320000, 384000, 448000, 512000, 640000, 720000, 144000, 96000, ++ 128000, 160000, 0, 0, 0, 0 ++}; ++ ++/* bitrate table for MC 7.1 */ ++static const int64_t ff_av3a_mc7p1_bitrate_table[AV3A_BITRATE_TABLE_SIZE] = { ++ 192000, 480000, 256000, 384000, 576000, 640000, 128000, 160000, 0, 0, ++ 0, 0, 0, 0, 0, 0 ++}; ++ ++/* bitrate table for MC 4.0 */ ++static const int64_t ff_av3a_mc4p0_bitrate_table[AV3A_BITRATE_TABLE_SIZE] = { ++ 48000, 96000, 128000, 192000, 256000, 0, 0, 0, 0, 0, ++ 0, 0, 0, 0, 0, 0 ++}; ++ ++/* bitrate table for MC 5.1.2 */ ++static const int64_t ff_av3a_mc5p1p2_bitrate_table[AV3A_BITRATE_TABLE_SIZE] = { ++ 152000, 320000, 480000, 576000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ++}; ++ ++/* bitrate table for MC 5.1.4 */ ++static const int64_t ff_av3a_mc5p1p4_bitrate_table[AV3A_BITRATE_TABLE_SIZE] = { ++ 176000, 384000, 576000, 704000, 256000, 448000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ++}; ++ ++/* bitrate table for MC 7.1.2 */ ++static const int64_t ff_av3a_mc7p1p2_bitrate_table[AV3A_BITRATE_TABLE_SIZE] = { ++ 216000, 480000, 576000, 384000, 768000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ++}; ++ ++/* bitrate table for MC 7.1.4 */ ++static const int64_t ff_av3a_mc7p1p4_bitrate_table[AV3A_BITRATE_TABLE_SIZE] = { ++ 240000, 608000, 384000, 512000, 832000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ++}; ++ ++/* bitrate table for FOA */ ++static const int64_t ff_av3a_foa_bitrate_table[AV3A_BITRATE_TABLE_SIZE] = { ++ 48000, 96000, 128000, 192000, 256000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ++}; ++ ++/* bitrate table for HOA2 */ ++static const int64_t ff_av3a_hoa2_bitrate_table[AV3A_BITRATE_TABLE_SIZE] = { ++ 192000, 256000, 320000, 384000, 480000, 512000, 640000, 0, 0, 0, 0, 0, 0, 0, 0, 0 ++}; ++ ++/* bitrate table for HOA3 */ ++static const int64_t ff_av3a_hoa3_bitrate_table[AV3A_BITRATE_TABLE_SIZE] = { ++ 256000, 320000, 384000, 512000, 640000, 896000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; ++ ++static const int32_t ff_av3a_sampling_rate_table[AV3A_FS_TABLE_SIZE] = { ++ 192000, 96000, 48000, 44100, 32000, 24000, 22050, 16000, 8000 ++}; ++ ++typedef struct { ++ int16_t resolution; ++ enum AVSampleFormat sample_format; ++} Av3aSampleFormatMap; ++ ++static const Av3aSampleFormatMap ff_av3a_sample_format_map_table[AV3A_RESOLUTION_TABLE_SIZE] = { ++ {8, AV_SAMPLE_FMT_U8 }, /* 0: 8 bits */ ++ {16, AV_SAMPLE_FMT_S16}, /* 1: 16 bits */ ++ {24, AV_SAMPLE_FMT_S32}, /* 2: 24 bits */ ++}; ++ ++typedef struct { ++ Av3aChannelConfig channel_number_index; ++ int16_t channels; ++ const enum AVChannel* channel_layout; ++ uint64_t mask; ++} Av3aChannelConfigMap; ++ ++static const enum AVChannel ff_av3a_default_channel_layout_mono[1] = { ++ AV_CHAN_FRONT_CENTER ++}; ++ ++static const enum AVChannel ff_av3a_default_channel_layout_stereo[2] = { ++ AV_CHAN_FRONT_LEFT, AV_CHAN_FRONT_RIGHT ++}; ++ ++static const enum AVChannel ff_av3a_channel_layout_mc_4_0[4] = { ++ AV_CHAN_FRONT_LEFT, AV_CHAN_FRONT_RIGHT, ++ AV_CHAN_FRONT_CENTER, AV_CHAN_BACK_CENTER ++}; ++ ++static const enum AVChannel ff_av3a_default_channel_layout_mc_5_1[6] = { ++ AV_CHAN_FRONT_LEFT, AV_CHAN_FRONT_RIGHT, AV_CHAN_FRONT_CENTER, ++ AV_CHAN_LOW_FREQUENCY, ++ AV_CHAN_SIDE_LEFT, AV_CHAN_SIDE_RIGHT ++}; ++ ++static const enum AVChannel ff_av3a_default_channel_layout_mc_5_1_2[8] = { ++ AV_CHAN_FRONT_LEFT, AV_CHAN_FRONT_RIGHT, AV_CHAN_FRONT_CENTER, ++ AV_CHAN_LOW_FREQUENCY, ++ AV_CHAN_SIDE_LEFT, AV_CHAN_SIDE_RIGHT, ++ AV_CHAN_TOP_SIDE_LEFT, AV_CHAN_TOP_SIDE_RIGHT ++}; ++ ++static const enum AVChannel ff_av3a_default_channel_layout_mc_7_1[8] = { ++ AV_CHAN_FRONT_LEFT, AV_CHAN_FRONT_RIGHT, AV_CHAN_FRONT_CENTER, ++ AV_CHAN_LOW_FREQUENCY, ++ AV_CHAN_SIDE_LEFT, AV_CHAN_SIDE_RIGHT, ++ AV_CHAN_BACK_LEFT, AV_CHAN_BACK_RIGHT ++}; ++ ++static const enum AVChannel ff_av3a_default_channel_layout_mc_5_1_4[10] = { ++ AV_CHAN_FRONT_LEFT, AV_CHAN_FRONT_RIGHT, AV_CHAN_FRONT_CENTER, ++ AV_CHAN_LOW_FREQUENCY, ++ AV_CHAN_SIDE_LEFT, AV_CHAN_SIDE_RIGHT, ++ AV_CHAN_TOP_FRONT_LEFT, AV_CHAN_TOP_FRONT_RIGHT, ++ AV_CHAN_TOP_BACK_LEFT, AV_CHAN_TOP_BACK_RIGHT ++}; ++ ++static const enum AVChannel ff_av3a_default_channel_layout_mc_7_1_2[10] = { ++ AV_CHAN_FRONT_LEFT, AV_CHAN_FRONT_RIGHT, AV_CHAN_FRONT_CENTER, ++ AV_CHAN_LOW_FREQUENCY, ++ AV_CHAN_SIDE_LEFT, AV_CHAN_SIDE_RIGHT, ++ AV_CHAN_BACK_LEFT, AV_CHAN_BACK_RIGHT, ++ AV_CHAN_TOP_SIDE_LEFT, AV_CHAN_TOP_SIDE_RIGHT ++}; ++ ++static const enum AVChannel ff_av3a_default_channel_layout_mc_7_1_4[12] = { ++ AV_CHAN_FRONT_LEFT, AV_CHAN_FRONT_RIGHT, AV_CHAN_FRONT_CENTER, ++ AV_CHAN_LOW_FREQUENCY, ++ AV_CHAN_SIDE_LEFT, AV_CHAN_SIDE_RIGHT, ++ AV_CHAN_BACK_LEFT, AV_CHAN_BACK_RIGHT, ++ AV_CHAN_TOP_FRONT_LEFT, AV_CHAN_TOP_FRONT_RIGHT, ++ AV_CHAN_TOP_BACK_LEFT, AV_CHAN_TOP_BACK_RIGHT ++}; ++ ++static const Av3aChannelConfigMap ff_av3a_channels_map_table[AV3A_CHANNEL_LAYOUT_SIZE] = { ++ { CHANNEL_CONFIG_MONO, 1, ff_av3a_default_channel_layout_mono, AV3A_CH_LAYOUT_MONO }, ++ { CHANNEL_CONFIG_STEREO, 2, ff_av3a_default_channel_layout_stereo, AV3A_CH_LAYOUT_STEREO }, ++ { CHANNEL_CONFIG_MC_5_1, 6, ff_av3a_default_channel_layout_mc_5_1, AV3A_CH_LAYOUT_5POINT1 }, ++ { CHANNEL_CONFIG_MC_7_1, 8, ff_av3a_default_channel_layout_mc_7_1, AV3A_CH_LAYOUT_7POINT1 }, ++ { CHANNEL_CONFIG_MC_10_2, 12, NULL, 0L }, /* reserved */ ++ { CHANNEL_CONFIG_MC_22_2, 24, NULL, 0L }, /* reserved */ ++ { CHANNEL_CONFIG_MC_4_0, 4, ff_av3a_channel_layout_mc_4_0, AV3A_CH_LAYOUT_4POINT0 }, ++ { CHANNEL_CONFIG_MC_5_1_2, 8, ff_av3a_default_channel_layout_mc_5_1_2, AV3A_CH_LAYOUT_5POINT1POINT2 }, ++ { CHANNEL_CONFIG_MC_5_1_4, 10, ff_av3a_default_channel_layout_mc_5_1_4, AV3A_CH_LAYOUT_5POINT1POINT4 }, ++ { CHANNEL_CONFIG_MC_7_1_2, 10, ff_av3a_default_channel_layout_mc_7_1_2, AV3A_CH_LAYOUT_7POINT1POINT2 }, ++ { CHANNEL_CONFIG_MC_7_1_4, 12, ff_av3a_default_channel_layout_mc_7_1_4, AV3A_CH_LAYOUT_7POINT1POINT4 }, ++ { CHANNEL_CONFIG_HOA_ORDER1, 4, NULL, 0L }, ++ { CHANNEL_CONFIG_HOA_ORDER2, 9, NULL, 0L }, ++ { CHANNEL_CONFIG_HOA_ORDER3, 16, NULL, 0L }, ++ { CHANNEL_CONFIG_UNKNOWN, 0, NULL, 0L }, ++}; ++ ++typedef struct { ++ Av3aChannelConfig channel_number_index; ++ const int64_t *bitrate_table; ++} Av3aBitrateMap; ++ ++static const Av3aBitrateMap ff_av3a_bitrate_map_table[15] = { ++ {CHANNEL_CONFIG_MONO, ff_av3a_mono_bitrate_table }, ++ {CHANNEL_CONFIG_STEREO, ff_av3a_stereo_bitrate_table }, ++ {CHANNEL_CONFIG_MC_5_1, ff_av3a_mc5p1_bitrate_table }, ++ {CHANNEL_CONFIG_MC_7_1, ff_av3a_mc7p1_bitrate_table }, ++ {CHANNEL_CONFIG_MC_10_2, NULL }, /* reserved */ ++ {CHANNEL_CONFIG_MC_22_2, NULL }, /* reserved */ ++ {CHANNEL_CONFIG_MC_4_0, ff_av3a_mc4p0_bitrate_table }, ++ {CHANNEL_CONFIG_MC_5_1_2, ff_av3a_mc5p1p2_bitrate_table }, ++ {CHANNEL_CONFIG_MC_5_1_4, ff_av3a_mc5p1p4_bitrate_table }, ++ {CHANNEL_CONFIG_MC_7_1_2, ff_av3a_mc7p1p2_bitrate_table }, ++ {CHANNEL_CONFIG_MC_7_1_4, ff_av3a_mc7p1p4_bitrate_table }, ++ {CHANNEL_CONFIG_HOA_ORDER1, ff_av3a_foa_bitrate_table }, ++ {CHANNEL_CONFIG_HOA_ORDER2, ff_av3a_hoa2_bitrate_table }, ++ {CHANNEL_CONFIG_HOA_ORDER3, ff_av3a_hoa3_bitrate_table }, ++ {CHANNEL_CONFIG_UNKNOWN, NULL }, ++}; ++#endif /* AVCODEC_AV3A_H */ +diff --git a/libavcodec/av3a_parser.c b/libavcodec/av3a_parser.c +new file mode 100644 +index 0000000..a563b55 +--- /dev/null ++++ b/libavcodec/av3a_parser.c +@@ -0,0 +1,218 @@ ++/* ++ * AV3A Parser ++ * ++ * Copyright (c) 2024 Shuai Liu ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#include ++#include ++#include "libavutil/intreadwrite.h" ++#include "parser.h" ++#include "get_bits.h" ++#include "av3a.h" ++ ++typedef struct { ++ int16_t audio_codec_id; ++ int16_t nn_type; ++ int16_t frame_size; ++ int16_t resolution; ++ int32_t sample_rate; ++ int64_t bit_rate; ++ ++ int16_t content_type; ++ int16_t channel_number_index; ++ int16_t nb_channels; ++ int16_t nb_objects; ++ int16_t total_channels; ++} Av3aParseContext; ++ ++static int ff_read_av3a_header_parse(GetBitContext *gb, AATFHeaderInfo *hdf) ++{ ++ int64_t soundbed_bitrate = 0L; ++ int64_t object_bitrate = 0L; ++ ++ hdf->nb_channels = 0; ++ hdf->nb_objects = 0; ++ ++ hdf->sync_word = get_bits(gb, 12); ++ if (hdf->sync_word != AV3A_AUDIO_SYNC_WORD) { ++ return AVERROR_INVALIDDATA; ++ } ++ ++ hdf->audio_codec_id = get_bits(gb, 4); ++ if (hdf->audio_codec_id != AV3A_LOSSY_CODEC_ID) { ++ return AVERROR_INVALIDDATA; ++ } ++ ++ skip_bits(gb, 1); /* skip anc_data 1 bit */ ++ ++ hdf->nn_type = get_bits(gb, 3); ++ if ((hdf->nn_type > AV3A_LC_NN_TYPE) || (hdf->nn_type < AV3A_BASELINE_NN_TYPE)) { ++ return AVERROR_INVALIDDATA; ++ } ++ ++ hdf->coding_profile = get_bits(gb, 3); ++ ++ hdf->sampling_frequency_index = get_bits(gb, 4); ++ if ((hdf->sampling_frequency_index >= AV3A_FS_TABLE_SIZE) || (hdf->sampling_frequency_index < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ hdf->sampling_rate = ff_av3a_sampling_rate_table[hdf->sampling_frequency_index]; ++ ++ skip_bits(gb, 8); /* skip CRC 8 bits */ ++ ++ if (hdf->coding_profile == AV3A_BASE_PROFILE) { ++ hdf->content_type = AV3A_CHANNEL_BASED_TYPE; ++ hdf->channel_number_index = get_bits(gb, 7); ++ if ((hdf->channel_number_index >= CHANNEL_CONFIG_UNKNOWN) || ++ (hdf->channel_number_index == CHANNEL_CONFIG_MC_10_2) || ++ (hdf->channel_number_index == CHANNEL_CONFIG_MC_22_2) || ++ (hdf->channel_number_index < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ hdf->nb_channels = ff_av3a_channels_map_table[hdf->channel_number_index].channels; ++ } else if (hdf->coding_profile == AV3A_OBJECT_METADATA_PROFILE) { ++ hdf->soundbed_type = get_bits(gb, 2); ++ if (hdf->soundbed_type == 0) { ++ hdf->content_type = AV3A_OBJECT_BASED_TYPE; ++ hdf->object_channel_number = get_bits(gb, 7); ++ if (hdf->object_channel_number < 0) { ++ return AVERROR_INVALIDDATA; ++ } ++ hdf->nb_objects = hdf->object_channel_number + 1; ++ ++ hdf->bitrate_index_per_channel = get_bits(gb, 4); ++ if ((hdf->bitrate_index_per_channel >= AV3A_BITRATE_TABLE_SIZE) || (hdf->bitrate_index_per_channel < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ object_bitrate = ff_av3a_bitrate_map_table[CHANNEL_CONFIG_MONO].bitrate_table[hdf->bitrate_index_per_channel]; ++ hdf->total_bitrate = object_bitrate * hdf->nb_objects; ++ } else if (hdf->soundbed_type == 1) { ++ hdf->content_type = AV3A_CHANNEL_OBJECT_TYPE; ++ hdf->channel_number_index = get_bits(gb, 7); ++ if ((hdf->channel_number_index >= CHANNEL_CONFIG_UNKNOWN) || ++ (hdf->channel_number_index == CHANNEL_CONFIG_MC_10_2) || ++ (hdf->channel_number_index == CHANNEL_CONFIG_MC_22_2) || ++ (hdf->channel_number_index < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ ++ hdf->bitrate_index = get_bits(gb, 4); ++ if ((hdf->bitrate_index >= AV3A_BITRATE_TABLE_SIZE) || (hdf->bitrate_index < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ hdf->nb_channels = ff_av3a_channels_map_table[hdf->channel_number_index].channels; ++ soundbed_bitrate = ff_av3a_bitrate_map_table[hdf->channel_number_index].bitrate_table[hdf->bitrate_index]; ++ ++ hdf->object_channel_number = get_bits(gb, 7); ++ if (hdf->object_channel_number < 0) { ++ return AVERROR_INVALIDDATA; ++ } ++ hdf->bitrate_index_per_channel = get_bits(gb, 4); ++ if ((hdf->bitrate_index_per_channel >= AV3A_BITRATE_TABLE_SIZE) || (hdf->bitrate_index_per_channel < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ hdf->nb_objects = hdf->object_channel_number + 1; ++ object_bitrate = ff_av3a_bitrate_map_table[CHANNEL_CONFIG_MONO].bitrate_table[hdf->bitrate_index_per_channel]; ++ hdf->total_bitrate = soundbed_bitrate + (object_bitrate * hdf->nb_objects); ++ } else { ++ return AVERROR_INVALIDDATA; ++ } ++ } else if (hdf->coding_profile == AV3A_AMBISONIC_PROFILE) { ++ hdf->content_type = AV3A_AMBISONIC_TYPE; ++ hdf->order = get_bits(gb, 4); ++ hdf->hoa_order = hdf->order + 1; ++ ++ switch (hdf->hoa_order) { ++ case AV3A_AMBISONIC_FIRST_ORDER: ++ hdf->channel_number_index = CHANNEL_CONFIG_HOA_ORDER1; ++ break; ++ case AV3A_AMBISONIC_SECOND_ORDER: ++ hdf->channel_number_index = CHANNEL_CONFIG_HOA_ORDER2; ++ break; ++ case AV3A_AMBISONIC_THIRD_ORDER: ++ hdf->channel_number_index = CHANNEL_CONFIG_HOA_ORDER3; ++ break; ++ default: ++ return AVERROR_INVALIDDATA; ++ } ++ hdf->nb_channels = ff_av3a_channels_map_table[hdf->channel_number_index].channels; ++ } else { ++ return AVERROR_INVALIDDATA; ++ } ++ hdf->total_channels = hdf->nb_channels + hdf->nb_objects; ++ ++ hdf->resolution_index = get_bits(gb, 2); ++ if ((hdf->resolution_index >= AV3A_RESOLUTION_TABLE_SIZE) || (hdf->resolution_index < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ hdf->resolution = ff_av3a_sample_format_map_table[hdf->resolution_index].resolution; ++ hdf->sample_format = ff_av3a_sample_format_map_table[hdf->resolution_index].sample_format; ++ ++ if (hdf->coding_profile != AV3A_OBJECT_METADATA_PROFILE) { ++ hdf->bitrate_index = get_bits(gb, 4); ++ if ((hdf->bitrate_index >= AV3A_BITRATE_TABLE_SIZE) || (hdf->bitrate_index < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ hdf->total_bitrate = ff_av3a_bitrate_map_table[hdf->channel_number_index].bitrate_table[hdf->bitrate_index]; ++ } ++ ++ skip_bits(gb, 8); /* skip CRC 8 bits */ ++ ++ return 0; ++} ++ ++static int raw_av3a_parse(AVCodecParserContext *s, AVCodecContext *avctx, const uint8_t **poutbuf, ++ int32_t *poutbuf_size, const uint8_t *buf, int32_t buf_size) ++{ ++ int ret = 0; ++ uint8_t header[AV3A_MAX_NBYTES_HEADER]; ++ AATFHeaderInfo hdf; ++ GetBitContext gb; ++ ++ if (buf_size < AV3A_MAX_NBYTES_HEADER) { ++ return buf_size; ++ } ++ memcpy(header, buf, AV3A_MAX_NBYTES_HEADER); ++ ++ init_get_bits8(&gb, buf, AV3A_MAX_NBYTES_HEADER); ++ if ((ret = ff_read_av3a_header_parse(&gb, &hdf)) != 0) { ++ return ret; ++ } ++ ++ avctx->codec_id = AV_CODEC_ID_AVS3DA; ++ avctx->frame_size = AV3A_AUDIO_FRAME_SIZE; ++ avctx->bits_per_raw_sample = hdf.resolution; ++ avctx->sample_rate = hdf.sampling_rate; ++ avctx->bit_rate = hdf.total_bitrate; ++ ++ avctx->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC; ++ avctx->ch_layout.nb_channels = hdf.total_channels; ++ ++ *poutbuf = buf; ++ *poutbuf_size = buf_size; ++ ++ return buf_size; ++} ++ ++const AVCodecParser ff_av3a_parser = { ++ .codec_ids = { AV_CODEC_ID_AVS3DA }, ++ .priv_data_size = sizeof(Av3aParseContext), ++ .parser_parse = raw_av3a_parse, ++}; +\ No newline at end of file +diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c +index d58c3d8..38cab26 100644 +--- a/libavcodec/codec_desc.c ++++ b/libavcodec/codec_desc.c +@@ -3728,6 +3728,13 @@ static const AVCodecDescriptor codec_descriptors[] = { + .name = "anull", + .long_name = NULL_IF_CONFIG_SMALL("Null audio codec"), + }, ++ { ++ .id = AV_CODEC_ID_AVS3DA, ++ .type = AVMEDIA_TYPE_AUDIO, ++ .name = "av3a", ++ .long_name = NULL_IF_CONFIG_SMALL("Audio Vivid"), ++ .props = AV_CODEC_PROP_LOSSY, ++ }, + }; + + static int descriptor_compare(const void *key, const void *member) +diff --git a/libavcodec/codec_id.h b/libavcodec/codec_id.h +index 0a8d3be..8c724a0 100644 +--- a/libavcodec/codec_id.h ++++ b/libavcodec/codec_id.h +@@ -590,6 +590,7 @@ enum AVCodecID { + AV_CODEC_ID_BIN_DATA, + AV_CODEC_ID_SMPTE_2038, + AV_CODEC_ID_LCEVC, ++ AV_CODEC_ID_AVS3DA, + + + AV_CODEC_ID_PROBE = 0x19000, ///< codec_id is not known (like AV_CODEC_ID_NONE) but lavf should attempt to identify it +diff --git a/libavcodec/parsers.c b/libavcodec/parsers.c +index 5128009..ad49461 100644 +--- a/libavcodec/parsers.c ++++ b/libavcodec/parsers.c +@@ -28,6 +28,7 @@ extern const AVCodecParser ff_amr_parser; + extern const AVCodecParser ff_av1_parser; + extern const AVCodecParser ff_avs2_parser; + extern const AVCodecParser ff_avs3_parser; ++extern const AVCodecParser ff_av3a_parser; + extern const AVCodecParser ff_bmp_parser; + extern const AVCodecParser ff_cavsvideo_parser; + extern const AVCodecParser ff_cook_parser; +diff --git a/libavcodec/utils.c b/libavcodec/utils.c +index 6909a5b..51074ba 100644 +--- a/libavcodec/utils.c ++++ b/libavcodec/utils.c +@@ -602,6 +602,7 @@ static int get_audio_frame_duration(enum AVCodecID id, int sr, int ch, int ba, + case AV_CODEC_ID_MP2: + case AV_CODEC_ID_MUSEPACK7: return 1152; + case AV_CODEC_ID_AC3: return 1536; ++ case AV_CODEC_ID_AVS3DA: return 1024; + case AV_CODEC_ID_FTR: return 1024; + } + +diff --git a/libavformat/Makefile b/libavformat/Makefile +index 359781b..17222ee 100644 +--- a/libavformat/Makefile ++++ b/libavformat/Makefile +@@ -158,6 +158,7 @@ OBJS-$(CONFIG_AVS2_DEMUXER) += avs2dec.o rawdec.o + OBJS-$(CONFIG_AVS2_MUXER) += rawenc.o + OBJS-$(CONFIG_AVS3_DEMUXER) += avs3dec.o rawdec.o + OBJS-$(CONFIG_AVS3_MUXER) += rawenc.o ++OBJS-$(CONFIG_AV3A_DEMUXER) += av3adec.o + OBJS-$(CONFIG_BETHSOFTVID_DEMUXER) += bethsoftvid.o + OBJS-$(CONFIG_BFI_DEMUXER) += bfi.o + OBJS-$(CONFIG_BINK_DEMUXER) += bink.o +diff --git a/libavformat/allformats.c.rej b/libavformat/allformats.c.rej +new file mode 100644 +index 0000000..623b4c4 +--- /dev/null ++++ b/libavformat/allformats.c.rej +@@ -0,0 +1,9 @@ ++diff a/libavformat/allformats.c b/libavformat/allformats.c (rejected hunks) ++@@ -86,6 +86,7 @@ extern const FFOutputFormat ff_asf_stream_muxer; ++ extern const AVInputFormat ff_au_demuxer; ++ extern const FFOutputFormat ff_au_muxer; ++ extern const AVInputFormat ff_av1_demuxer; +++extern const AVInputFormat ff_av3a_demuxer; ++ extern const AVInputFormat ff_avi_demuxer; ++ extern const FFOutputFormat ff_avi_muxer; ++ extern const FFOutputFormat ff_avif_muxer; +diff --git a/libavformat/av3adec.c b/libavformat/av3adec.c +new file mode 100644 +index 0000000..51f7ec9 +--- /dev/null ++++ b/libavformat/av3adec.c +@@ -0,0 +1,472 @@ ++/* ++ * AV3A Demuxer ++ * ++ * Copyright (c) 2024 Shuai Liu ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++#include "avformat.h" ++#include "avio_internal.h" ++#include "internal.h" ++#include "rawdec.h" ++#include "libavutil/opt.h" ++#include "libavutil/avassert.h" ++#include "libavutil/intreadwrite.h" ++#include "libavutil/channel_layout.h" ++#include "libavcodec/get_bits.h" ++#include "libavcodec/av3a.h" ++#include ++ ++typedef struct { ++ uint8_t audio_codec_id; ++ uint8_t sampling_frequency_index; ++ uint8_t nn_type; ++ uint8_t content_type; ++ uint8_t channel_number_index; ++ uint8_t number_objects; ++ uint8_t hoa_order; ++ uint8_t resolution_index; ++ uint16_t total_bitrate_kbps; ++} Av3aFormatContext; ++ ++static int av3a_read_aatf_frame_header(AATFHeaderInfo *hdf, const uint8_t *buf) ++{ ++ int16_t sync_word; ++ GetBitContext gb; ++ ++ hdf->nb_channels = 0; ++ hdf->nb_objects = 0; ++ ++ init_get_bits8(&gb, buf, AV3A_MAX_NBYTES_HEADER); ++ ++ sync_word = get_bits(&gb, 12); ++ if (sync_word != AV3A_AUDIO_SYNC_WORD) { ++ return AVERROR_INVALIDDATA; ++ } ++ ++ /* codec id */ ++ hdf->audio_codec_id = get_bits(&gb, 4); ++ if (hdf->audio_codec_id != AV3A_LOSSY_CODEC_ID) { ++ return AVERROR_INVALIDDATA; ++ } ++ ++ /* anc data */ ++ hdf->anc_data = get_bits(&gb, 1); ++ if (hdf->anc_data) { ++ return AVERROR_INVALIDDATA; ++ } ++ ++ /* neural network type */ ++ hdf->nn_type = get_bits(&gb, 3); ++ if ((hdf->nn_type > AV3A_LC_NN_TYPE) || (hdf->nn_type < AV3A_BASELINE_NN_TYPE)) { ++ return AVERROR_INVALIDDATA; ++ } ++ ++ /* coding profile */ ++ hdf->coding_profile = get_bits(&gb, 3); ++ ++ /* sampling rate */ ++ hdf->sampling_frequency_index = get_bits(&gb, 4); ++ if ((hdf->sampling_frequency_index >= AV3A_FS_TABLE_SIZE) || (hdf->sampling_frequency_index < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ hdf->sampling_rate = ff_av3a_sampling_rate_table[hdf->sampling_frequency_index]; ++ ++ skip_bits(&gb, 8); ++ ++ if (hdf->coding_profile == AV3A_BASE_PROFILE) { ++ hdf->content_type = AV3A_CHANNEL_BASED_TYPE; ++ hdf->channel_number_index = get_bits(&gb, 7); ++ if ((hdf->channel_number_index >= CHANNEL_CONFIG_UNKNOWN) || ++ (hdf->channel_number_index == CHANNEL_CONFIG_MC_10_2) || ++ (hdf->channel_number_index == CHANNEL_CONFIG_MC_22_2) || ++ (hdf->channel_number_index < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ hdf->nb_channels = ff_av3a_channels_map_table[hdf->channel_number_index].channels; ++ } else if (hdf->coding_profile == AV3A_OBJECT_METADATA_PROFILE) { ++ hdf->soundbed_type = get_bits(&gb, 2); ++ if (hdf->soundbed_type == 0) { ++ hdf->content_type = AV3A_OBJECT_BASED_TYPE; ++ hdf->object_channel_number = get_bits(&gb, 7); ++ if (hdf->object_channel_number < 0) { ++ return AVERROR_INVALIDDATA; ++ } ++ hdf->bitrate_index_per_channel = get_bits(&gb, 4); ++ if ((hdf->bitrate_index_per_channel >= AV3A_BITRATE_TABLE_SIZE) || (hdf->bitrate_index_per_channel < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ hdf->nb_objects = hdf->object_channel_number + 1; ++ hdf->total_bitrate = ff_av3a_bitrate_map_table[CHANNEL_CONFIG_MONO].bitrate_table[hdf->bitrate_index_per_channel] * hdf->nb_objects; ++ } else if (hdf->soundbed_type == 1) { ++ hdf->content_type = AV3A_CHANNEL_OBJECT_TYPE; ++ hdf->channel_number_index = get_bits(&gb, 7); ++ if ((hdf->channel_number_index >= CHANNEL_CONFIG_UNKNOWN) || ++ (hdf->channel_number_index == CHANNEL_CONFIG_MC_10_2) || ++ (hdf->channel_number_index == CHANNEL_CONFIG_MC_22_2) || ++ (hdf->channel_number_index < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ hdf->nb_channels = ff_av3a_channels_map_table[hdf->channel_number_index].channels; ++ hdf->bitrate_index = get_bits(&gb, 4); ++ if ((hdf->bitrate_index >= AV3A_BITRATE_TABLE_SIZE) || (hdf->bitrate_index < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ ++ hdf->object_channel_number = get_bits(&gb, 7); ++ if (hdf->object_channel_number < 0) { ++ return AVERROR_INVALIDDATA; ++ } ++ hdf->nb_objects = hdf->object_channel_number + 1; ++ hdf->bitrate_index_per_channel = get_bits(&gb, 4); ++ if ((hdf->bitrate_index_per_channel >= AV3A_BITRATE_TABLE_SIZE) || (hdf->bitrate_index_per_channel < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ ++ hdf->total_bitrate = ff_av3a_bitrate_map_table[hdf->channel_number_index].bitrate_table[hdf->bitrate_index] + ++ ff_av3a_bitrate_map_table[CHANNEL_CONFIG_MONO].bitrate_table[hdf->bitrate_index_per_channel] * hdf->nb_objects; ++ } else { ++ return AVERROR_INVALIDDATA; ++ } ++ } else if (hdf->coding_profile == AV3A_AMBISONIC_PROFILE) { ++ hdf->content_type = AV3A_AMBISONIC_TYPE; ++ hdf->order = get_bits(&gb, 4); ++ hdf->hoa_order = hdf->order + 1; ++ ++ switch (hdf->hoa_order) { ++ case AV3A_AMBISONIC_FIRST_ORDER: ++ hdf->channel_number_index = CHANNEL_CONFIG_HOA_ORDER1; ++ break; ++ case AV3A_AMBISONIC_SECOND_ORDER: ++ hdf->channel_number_index = CHANNEL_CONFIG_HOA_ORDER2; ++ break; ++ case AV3A_AMBISONIC_THIRD_ORDER: ++ hdf->channel_number_index = CHANNEL_CONFIG_HOA_ORDER3; ++ break; ++ default: ++ return AVERROR_INVALIDDATA; ++ } ++ hdf->nb_channels = ff_av3a_channels_map_table[hdf->channel_number_index].channels; ++ } else { ++ return AVERROR_INVALIDDATA; ++ } ++ ++ hdf->total_channels = hdf->nb_channels + hdf->nb_objects; ++ ++ /* resolution */ ++ hdf->resolution_index = get_bits(&gb, 2); ++ if ((hdf->resolution_index >= AV3A_RESOLUTION_TABLE_SIZE) || (hdf->resolution_index < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ hdf->resolution = ff_av3a_sample_format_map_table[hdf->resolution_index].resolution; ++ hdf->sample_format = ff_av3a_sample_format_map_table[hdf->resolution_index].sample_format; ++ ++ if (hdf->coding_profile != AV3A_OBJECT_METADATA_PROFILE) { ++ hdf->bitrate_index = get_bits(&gb, 4); ++ if ((hdf->bitrate_index >= AV3A_BITRATE_TABLE_SIZE) || (hdf->bitrate_index < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ hdf->total_bitrate = ff_av3a_bitrate_map_table[hdf->channel_number_index].bitrate_table[hdf->bitrate_index]; ++ } ++ ++ skip_bits(&gb, 8); ++ ++ return 0; ++} ++ ++static int av3a_get_packet_size(AVFormatContext *s) ++{ ++ int ret = 0; ++ int read_bytes = 0; ++ uint16_t sync_word = 0; ++ int payload_bytes = 0; ++ int payloud_bits = 0; ++ uint8_t header[AV3A_MAX_NBYTES_HEADER]; ++ GetBitContext gb; ++ int32_t sampling_rate; ++ int16_t coding_profile, sampling_frequency_index, channel_number_index; ++ int16_t bitrate_index, bitrate_index_per_channel; ++ int16_t objects, hoa_order; ++ int64_t total_bitrate; ++ ++ if (!s) { ++ return AVERROR(ENOMEM); ++ } ++ ++ if (!s->pb) { ++ return AVERROR(ENOMEM); ++ } ++ ++ read_bytes = avio_read(s->pb, header, AV3A_MAX_NBYTES_HEADER); ++ if (read_bytes != AV3A_MAX_NBYTES_HEADER) { ++ return (read_bytes < 0) ? read_bytes : AVERROR_EOF; ++ } ++ ++ init_get_bits8(&gb, header, AV3A_MAX_NBYTES_HEADER); ++ ++ sync_word = get_bits(&gb, 12); ++ if (sync_word != AV3A_AUDIO_SYNC_WORD) { ++ return AVERROR_INVALIDDATA; ++ } ++ ++ skip_bits(&gb, 8); ++ ++ coding_profile = get_bits(&gb, 3); ++ sampling_frequency_index = get_bits(&gb, 4); ++ if ((sampling_frequency_index >= AV3A_FS_TABLE_SIZE) || (sampling_frequency_index < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ sampling_rate = ff_av3a_sampling_rate_table[sampling_frequency_index]; ++ ++ skip_bits(&gb, 8); ++ ++ if (coding_profile == AV3A_BASE_PROFILE) { ++ channel_number_index = get_bits(&gb, 7); ++ if ((channel_number_index >= CHANNEL_CONFIG_UNKNOWN) || ++ (channel_number_index == CHANNEL_CONFIG_MC_10_2) || ++ (channel_number_index == CHANNEL_CONFIG_MC_22_2) || ++ (channel_number_index < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ } else if (coding_profile == AV3A_OBJECT_METADATA_PROFILE) { ++ int64_t soundbed_bitrate, objects_bitrate; ++ int16_t soundbed_type = get_bits(&gb, 2); ++ if (soundbed_type == 0) { ++ objects = get_bits(&gb, 7); ++ if (objects < 0) { ++ return AVERROR_INVALIDDATA; ++ } ++ objects += 1; ++ ++ bitrate_index_per_channel = get_bits(&gb, 4); ++ if ((bitrate_index_per_channel >= AV3A_BITRATE_TABLE_SIZE) || (bitrate_index_per_channel < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ total_bitrate = ff_av3a_bitrate_map_table[CHANNEL_CONFIG_MONO].bitrate_table[bitrate_index_per_channel] * objects; ++ } else if (soundbed_type == 1) { ++ channel_number_index = get_bits(&gb, 7); ++ if ((channel_number_index >= CHANNEL_CONFIG_UNKNOWN) || ++ (channel_number_index == CHANNEL_CONFIG_MC_10_2) || ++ (channel_number_index == CHANNEL_CONFIG_MC_22_2) || ++ (channel_number_index < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ ++ bitrate_index = get_bits(&gb, 4); ++ if ((bitrate_index >= AV3A_BITRATE_TABLE_SIZE) || (bitrate_index < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ soundbed_bitrate = ff_av3a_bitrate_map_table[channel_number_index].bitrate_table[bitrate_index]; ++ ++ objects = get_bits(&gb, 7); ++ if (objects < 0) { ++ return AVERROR_INVALIDDATA; ++ } ++ objects += 1; ++ bitrate_index_per_channel = get_bits(&gb, 4); ++ if ((bitrate_index_per_channel >= AV3A_BITRATE_TABLE_SIZE) || (bitrate_index_per_channel < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ ++ objects_bitrate = ff_av3a_bitrate_map_table[CHANNEL_CONFIG_MONO].bitrate_table[bitrate_index_per_channel]; ++ total_bitrate = soundbed_bitrate + (objects_bitrate * objects); ++ } else { ++ return AVERROR_INVALIDDATA; ++ } ++ } else if (coding_profile == AV3A_AMBISONIC_PROFILE) { ++ hoa_order = get_bits(&gb, 4); ++ hoa_order += 1; ++ ++ switch (hoa_order) { ++ case AV3A_AMBISONIC_FIRST_ORDER: ++ channel_number_index = CHANNEL_CONFIG_HOA_ORDER1; ++ break; ++ case AV3A_AMBISONIC_SECOND_ORDER: ++ channel_number_index = CHANNEL_CONFIG_HOA_ORDER2; ++ break; ++ case AV3A_AMBISONIC_THIRD_ORDER: ++ channel_number_index = CHANNEL_CONFIG_HOA_ORDER3; ++ break; ++ default: ++ return AVERROR_INVALIDDATA; ++ } ++ } else { ++ return AVERROR_INVALIDDATA; ++ } ++ ++ skip_bits(&gb, 2); ++ if (coding_profile != AV3A_OBJECT_METADATA_PROFILE) { ++ bitrate_index = get_bits(&gb, 4); ++ if ((bitrate_index >= AV3A_BITRATE_TABLE_SIZE) || (bitrate_index < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ total_bitrate = ff_av3a_bitrate_map_table[channel_number_index].bitrate_table[bitrate_index]; ++ } ++ ++ skip_bits(&gb, 8); ++ ++ if (sampling_rate == 44100) { ++ payloud_bits = (int)floor(((float) (total_bitrate) / sampling_rate) * AV3A_AUDIO_FRAME_SIZE); ++ payload_bytes = (int)ceil((float)payloud_bits / 8); ++ } else { ++ payload_bytes = (int)ceil((((float) (total_bitrate) / sampling_rate) * AV3A_AUDIO_FRAME_SIZE) / 8); ++ } ++ ++ if ((ret = avio_seek(s->pb, -read_bytes, SEEK_CUR)) < 0) { ++ return ret; ++ } ++ ++ return payload_bytes; ++} ++ ++static int av3a_probe(const AVProbeData *p) ++{ ++ uint16_t frame_sync_word; ++ uint16_t lval = ((uint16_t)(p->buf[0])); ++ uint16_t rval = ((uint16_t)(p->buf[1])); ++ frame_sync_word = ((lval << 8) | rval) >> 4; ++ ++ if (frame_sync_word == AV3A_AUDIO_SYNC_WORD && av_match_ext(p->filename, "av3a")) { ++ return AVPROBE_SCORE_MAX; ++ } ++ ++ return 0; ++} ++ ++static int av3a_read_header(AVFormatContext *s) ++{ ++ int ret = 0; ++ uint8_t header[AV3A_MAX_NBYTES_HEADER]; ++ AVStream *stream = NULL; ++ Av3aFormatContext av3afmtctx; ++ AATFHeaderInfo hdf; ++ ++ if (!s) { ++ return AVERROR(ENOMEM); ++ } ++ ++ if (!(stream = avformat_new_stream(s, NULL))) { ++ return AVERROR(ENOMEM); ++ } ++ ++ stream->start_time = 0; ++ ffstream(stream)->need_parsing = AVSTREAM_PARSE_FULL_RAW; ++ stream->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; ++ stream->codecpar->codec_id = s->iformat->raw_codec_id; ++ stream->codecpar->codec_tag = MKTAG('a', 'v', '3', 'a'); ++ ++ if ((ret = avio_read(s->pb, header, AV3A_MAX_NBYTES_HEADER)) != AV3A_MAX_NBYTES_HEADER) { ++ return (ret < 0) ? ret : AVERROR_EOF; ++ } ++ ++ ret = av3a_read_aatf_frame_header(&hdf, header); ++ if (ret) { ++ return ret; ++ } ++ ++ /* stream parameters */ ++ stream->codecpar->format = hdf.sample_format; ++ stream->codecpar->bits_per_raw_sample = hdf.resolution; ++ stream->codecpar->bit_rate = hdf.total_bitrate; ++ stream->codecpar->sample_rate = (int) (hdf.sampling_rate); ++ stream->codecpar->frame_size = AV3A_AUDIO_FRAME_SIZE; ++ stream->codecpar->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC; ++ stream->codecpar->ch_layout.nb_channels = hdf.total_channels; ++ ++ /* extradata */ ++ av3afmtctx.audio_codec_id = hdf.audio_codec_id; ++ av3afmtctx.sampling_frequency_index = hdf.sampling_frequency_index; ++ av3afmtctx.nn_type = hdf.nn_type; ++ av3afmtctx.content_type = hdf.content_type; ++ av3afmtctx.channel_number_index = hdf.channel_number_index; ++ av3afmtctx.number_objects = hdf.nb_objects; ++ av3afmtctx.hoa_order = hdf.hoa_order; ++ av3afmtctx.resolution_index = hdf.resolution_index; ++ av3afmtctx.total_bitrate_kbps = (int) (hdf.total_bitrate / 1000); ++ ++ if ((ret = ff_alloc_extradata(stream->codecpar, sizeof(Av3aFormatContext))) < 0) { ++ return ret; ++ } ++ memcpy(stream->codecpar->extradata, &av3afmtctx, sizeof(Av3aFormatContext)); ++ ++ if ((ret = avio_seek(s->pb, -AV3A_MAX_NBYTES_HEADER, SEEK_CUR)) < 0) { ++ return ret; ++ } ++ ++ return 0; ++} ++ ++static int av3a_read_packet(AVFormatContext *s, AVPacket *pkt) ++{ ++ int64_t pos; ++ int packet_size = 0; ++ int read_bytes = 0; ++ int ret = 0; ++ ++ if (!s) { ++ return AVERROR(ENOMEM); ++ } ++ ++ if (avio_feof(s->pb)) { ++ return AVERROR_EOF; ++ } ++ pos = avio_tell(s->pb); ++ ++ if (!(packet_size = av3a_get_packet_size(s))) { ++ return AVERROR_EOF; ++ } ++ ++ if (packet_size < 0) { ++ return packet_size; ++ } ++ ++ if ((ret = av_new_packet(pkt, packet_size)) < 0) { ++ return ret; ++ } ++ ++ if (!s->streams[0]) { ++ return AVERROR(ENOMEM); ++ } ++ ++ if (!s->streams[0]->codecpar) { ++ return AVERROR(ENOMEM); ++ } ++ ++ pkt->stream_index = 0; ++ pkt->pos = pos; ++ pkt->duration = s->streams[0]->codecpar->frame_size; ++ ++ read_bytes = avio_read(s->pb, pkt->data, packet_size); ++ if (read_bytes != packet_size) { ++ return (read_bytes < 0) ? read_bytes : AVERROR_EOF; ++ } ++ ++ return 0; ++} ++ ++const AVInputFormat ff_av3a_demuxer = { ++ .name = "av3a", ++ .long_name = NULL_IF_CONFIG_SMALL("Audio Vivid"), ++ .raw_codec_id = AV_CODEC_ID_AVS3DA, ++ .priv_data_size = sizeof(FFRawDemuxerContext), ++ .read_probe = av3a_probe, ++ .read_header = av3a_read_header, ++ .read_packet = av3a_read_packet, ++ .flags = AVFMT_GENERIC_INDEX, ++ .extensions = "av3a", ++ .mime_type = "audio/av3a", ++}; +diff --git a/libavformat/isom_tags.c b/libavformat/isom_tags.c +index 5dd72d5..1c52d7c 100644 +--- a/libavformat/isom_tags.c ++++ b/libavformat/isom_tags.c +@@ -353,6 +353,7 @@ const AVCodecTag ff_codec_movaudio_tags[] = { + { AV_CODEC_ID_TRUEHD, MKTAG('m', 'l', 'p', 'a') }, /* mp4ra.org */ + { AV_CODEC_ID_OPUS, MKTAG('O', 'p', 'u', 's') }, /* mp4ra.org */ + { AV_CODEC_ID_MPEGH_3D_AUDIO, MKTAG('m', 'h', 'm', '1') }, /* MPEG-H 3D Audio bitstream */ ++ { AV_CODEC_ID_AVS3DA, MKTAG('a', 'v', '3', 'a') }, /* AVS3 Audio */ + { AV_CODEC_ID_NONE, 0 }, + }; + +diff --git a/libavformat/mov.c.rej b/libavformat/mov.c.rej +new file mode 100644 +index 0000000..db8f10c +--- /dev/null ++++ b/libavformat/mov.c.rej +@@ -0,0 +1,158 @@ ++diff a/libavformat/mov.c b/libavformat/mov.c (rejected hunks) ++@@ -69,7 +69,9 @@ ++ #include "libavutil/imgutils.h" ++ #include "libavutil/display.h" ++ #include "libavcodec/avcodec.h" ++- +++#if CONFIG_AV3A_DEMUXER +++#include "libavcodec/av3a.h" +++#endif ++ #if CONFIG_ZLIB ++ #include ++ #endif ++@@ -8105,6 +8107,135 @@ static int mov_read_iloc(MOVContext *c, AVIOContext *pb, MOVAtom atom) ++ return atom.size; ++ } ++ +++#if CONFIG_AV3A_DEMUXER +++static int mov_read_dca3(MOVContext *c, AVIOContext *pb, MOVAtom atom) +++{ +++ int ret = 0; +++ int i = 0; +++ int nb_channels = 0; +++ int nb_objects = 0; +++ AVStream *st = NULL; +++ GetBitContext gb; +++ uint8_t buffer[7]; +++ int audio_codec_id, sampling_frequency_index; +++ int nn_type, content_type, channel_number_index, number_objects; +++ int hoa_order, resolution_index, reserved; +++ int bitrate_kbps; +++ +++ if (atom.size < AV3A_DCA3_BOX_MIN_SIZE) { +++ return AVERROR_INVALIDDATA; +++ } +++ +++ init_get_bits8(&gb, buffer, sizeof(buffer)); +++ +++ if (c->fc->nb_streams < 1) { +++ return 0; +++ } +++ st = c->fc->streams[c->fc->nb_streams - 1]; +++ +++ if ((ret = avio_read(pb, buffer, sizeof(buffer))) < 0) { +++ return ret; +++ } +++ +++ audio_codec_id = get_bits(&gb, 4); +++ if (audio_codec_id != AV3A_LOSSY_CODEC_ID) { +++ return AVERROR_INVALIDDATA; +++ } +++ +++ st->codecpar->frame_size = AV3A_AUDIO_FRAME_SIZE; +++ sampling_frequency_index = get_bits(&gb, 4); +++ if ((sampling_frequency_index >= AV3A_FS_TABLE_SIZE) || (sampling_frequency_index < 0)) { +++ return AVERROR_INVALIDDATA; +++ } +++ st->codecpar->sample_rate = ff_av3a_sampling_rate_table[sampling_frequency_index]; +++ +++ nn_type = get_bits(&gb, 3); +++ if ((nn_type > AV3A_LC_NN_TYPE) || (nn_type < AV3A_BASELINE_NN_TYPE)) { +++ return AVERROR_INVALIDDATA; +++ } +++ +++ reserved = get_bits(&gb, 1); +++ content_type = get_bits(&gb, 4); +++ if (content_type == AV3A_CHANNEL_BASED_TYPE) { +++ channel_number_index = get_bits(&gb, 7); +++ reserved = get_bits(&gb, 1); +++ if ((channel_number_index >= CHANNEL_CONFIG_UNKNOWN) || +++ (channel_number_index == CHANNEL_CONFIG_MC_10_2) || +++ (channel_number_index == CHANNEL_CONFIG_MC_22_2) || +++ (channel_number_index < 0)) { +++ return AVERROR_INVALIDDATA; +++ } +++ nb_channels = ff_av3a_channels_map_table[channel_number_index].channels; +++ } else if (content_type == AV3A_OBJECT_BASED_TYPE) { +++ number_objects = get_bits(&gb, 7); +++ reserved = get_bits(&gb, 1); +++ nb_objects = number_objects; +++ if (nb_objects < 1) { +++ return AVERROR_INVALIDDATA; +++ } +++ } else if (content_type == AV3A_CHANNEL_OBJECT_TYPE) { +++ channel_number_index = get_bits(&gb, 7); +++ reserved = get_bits(&gb, 1); +++ if ((channel_number_index >= CHANNEL_CONFIG_UNKNOWN) || +++ (channel_number_index == CHANNEL_CONFIG_MC_10_2) || +++ (channel_number_index == CHANNEL_CONFIG_MC_22_2) || +++ (channel_number_index < 0)) { +++ return AVERROR_INVALIDDATA; +++ } +++ number_objects = get_bits(&gb, 7); +++ reserved = get_bits(&gb, 1); +++ nb_channels = ff_av3a_channels_map_table[channel_number_index].channels; +++ nb_objects = number_objects; +++ if (nb_objects < 1) { +++ return AVERROR_INVALIDDATA; +++ } +++ } else if (content_type == AV3A_AMBISONIC_TYPE) { +++ hoa_order = get_bits(&gb, 4); +++ if ((hoa_order < AV3A_AMBISONIC_FIRST_ORDER) || (hoa_order > AV3A_AMBISONIC_THIRD_ORDER)) { +++ return AVERROR_INVALIDDATA; +++ } +++ nb_channels = (hoa_order + 1) * (hoa_order + 1); +++ } else { +++ return AVERROR_INVALIDDATA; +++ } +++ +++ bitrate_kbps = get_bits(&gb, 16); +++ st->codecpar->bit_rate = bitrate_kbps * 1000; +++ +++ resolution_index = get_bits(&gb, 2); +++ if ((resolution_index >= AV3A_RESOLUTION_TABLE_SIZE) || (resolution_index < 0)) { +++ return AVERROR_INVALIDDATA; +++ } +++ st->codecpar->format = ff_av3a_sample_format_map_table[resolution_index].sample_format; +++ st->codecpar->bits_per_raw_sample = ff_av3a_sample_format_map_table[resolution_index].resolution; +++ +++ av_channel_layout_uninit(&st->codecpar->ch_layout); +++ if (content_type != AV3A_AMBISONIC_TYPE) { +++ st->codecpar->ch_layout.order = AV_CHANNEL_ORDER_CUSTOM; +++ st->codecpar->ch_layout.nb_channels = (nb_channels + nb_objects); +++ st->codecpar->ch_layout.u.map = av_calloc(st->codecpar->ch_layout.nb_channels, sizeof(AVChannelCustom)); +++ if (!st->codecpar->ch_layout.u.map) { +++ return AVERROR(ENOMEM); +++ } +++ +++ if (content_type != AV3A_OBJECT_BASED_TYPE) { +++ for (i = 0; i < nb_channels; i ++) { +++ st->codecpar->ch_layout.u.map[i].id = ff_av3a_channels_map_table[channel_number_index].channel_layout[i]; +++ } +++ } +++ +++ for (i = nb_channels; i < st->codecpar->ch_layout.nb_channels; i++) { +++ st->codecpar->ch_layout.u.map[i].id = AV3A_CH_AUDIO_OBJECT; +++ } +++ } else { +++ st->codecpar->ch_layout.order = AV_CHANNEL_ORDER_AMBISONIC; +++ st->codecpar->ch_layout.nb_channels = nb_channels; +++ } +++ +++ return 0; +++} +++#endif +++ ++ static const MOVParseTableEntry mov_default_parse_table[] = { ++ { MKTAG('A','C','L','R'), mov_read_aclr }, ++ { MKTAG('A','P','R','G'), mov_read_avid }, ++@@ -8212,6 +8343,9 @@ static const MOVParseTableEntry mov_default_parse_table[] = { ++ { MKTAG('p','c','m','C'), mov_read_pcmc }, /* PCM configuration box */ ++ { MKTAG('p','i','t','m'), mov_read_pitm }, ++ { MKTAG('e','v','c','C'), mov_read_glbl }, +++#if CONFIG_AV3A_DEMUXER +++{ MKTAG('d','c','a','3'), mov_read_dca3 }, +++#endif ++ { 0, NULL } ++ }; ++ +diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c +index 58b50cb..59039ed 100644 +--- a/libavformat/mpegts.c ++++ b/libavformat/mpegts.c +@@ -822,6 +822,9 @@ static const StreamType ISO_types[] = { + { 0xd1, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_DIRAC }, + { 0xd2, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_AVS2 }, + { 0xd4, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_AVS3 }, ++#if CONFIG_AV3A_DEMUXER ++ { 0xd5, AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_AVS3DA }, /* avs3 audio */ ++#endif + { 0xea, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_VC1 }, + { 0 }, + }; +@@ -879,6 +882,9 @@ static const StreamType REGD_types[] = { + { MKTAG('I', 'D', '3', ' '), AVMEDIA_TYPE_DATA, AV_CODEC_ID_TIMED_ID3 }, + { MKTAG('V', 'C', '-', '1'), AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_VC1 }, + { MKTAG('O', 'p', 'u', 's'), AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_OPUS }, ++#if CONFIG_AV3A_DEMUXER ++ { MKTAG('a', 'v', '3', 'a'), AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_AVS3DA}, ++#endif + { 0 }, + }; + +diff --git a/libavformat/mpegts.h b/libavformat/mpegts.h +index 14ae312..8a45eef 100644 +--- a/libavformat/mpegts.h ++++ b/libavformat/mpegts.h +@@ -134,7 +134,7 @@ + #define STREAM_TYPE_VIDEO_AVS3 0xd4 + #define STREAM_TYPE_VIDEO_VC1 0xea + #define STREAM_TYPE_VIDEO_DIRAC 0xd1 +- ++#define STREAM_TYPE_AUDIO_AV3A 0xd5 + #define STREAM_TYPE_AUDIO_AC3 0x81 + #define STREAM_TYPE_AUDIO_DTS 0x82 + #define STREAM_TYPE_AUDIO_TRUEHD 0x83 +-- +2.39.5 (Apple Git-154) + diff --git a/patches/ffmpeg-n7.1.1/0022-http-add-reconnect_first_delay-opt.patch b/patches/ffmpeg-n7.1.1/0022-http-add-reconnect_first_delay-opt.patch new file mode 100644 index 000000000..3f6b9ce14 --- /dev/null +++ b/patches/ffmpeg-n7.1.1/0022-http-add-reconnect_first_delay-opt.patch @@ -0,0 +1,41 @@ +From 8984a891f4bf976a3ab311591c7c6de499b434df Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Thu, 29 May 2025 09:57:28 +0800 +Subject: [PATCH] http add reconnect_first_delay opt + +--- + libavformat/http.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/libavformat/http.c b/libavformat/http.c +index 1228735..6e96aaa 100644 +--- a/libavformat/http.c ++++ b/libavformat/http.c +@@ -128,6 +128,7 @@ typedef struct HTTPContext { + int reconnect_on_network_error; + int reconnect_streamed; + int reconnect_delay_max; ++ int reconnect_first_delay; + char *reconnect_on_http_error; + int listen; + char *resource; +@@ -188,6 +189,7 @@ static const AVOption options[] = { + { "reconnect_max_retries", "the max number of times to retry a connection", OFFSET(reconnect_max_retries), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, D }, + { "reconnect_delay_total_max", "max total reconnect delay in seconds after which to give up", OFFSET(reconnect_delay_total_max), AV_OPT_TYPE_INT, { .i64 = 256 }, 0, UINT_MAX/1000/1000, D }, + { "respect_retry_after", "respect the Retry-After header when retrying connections", OFFSET(respect_retry_after), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, D }, ++ { "reconnect_first_delay", "first reconnect delay in seconds", OFFSET(reconnect_first_delay), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, UINT_MAX/1000/1000, D }, + { "listen", "listen on HTTP", OFFSET(listen), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 2, D | E }, + { "resource", "The resource requested by a client", OFFSET(resource), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, E }, + { "reply_code", "The http status code to return to a client", OFFSET(reply_code), AV_OPT_TYPE_INT, { .i64 = 200}, INT_MIN, 599, E}, +@@ -379,7 +381,7 @@ static int http_open_cnx(URLContext *h, AVDictionary **options) + HTTPAuthType cur_auth_type, cur_proxy_auth_type; + HTTPContext *s = h->priv_data; + int ret, conn_attempts = 1, auth_attempts = 0, redirects = 0; +- int reconnect_delay = 0; ++ int reconnect_delay = s->reconnect_first_delay; + int reconnect_delay_total = 0; + uint64_t off; + char *cached; +-- +2.39.5 (Apple Git-154) + diff --git a/patches/ffmpeg-n7.1.1/0023-fix-http-open-and-http_seek-redirect-authentication-.patch b/patches/ffmpeg-n7.1.1/0023-fix-http-open-and-http_seek-redirect-authentication-.patch new file mode 100644 index 000000000..f15291901 --- /dev/null +++ b/patches/ffmpeg-n7.1.1/0023-fix-http-open-and-http_seek-redirect-authentication-.patch @@ -0,0 +1,92 @@ +From 8e8699cf879e1bfcd2bc659d5022e33900fc6069 Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Thu, 29 May 2025 10:00:04 +0800 +Subject: [PATCH] fix http open and http_seek (redirect) authentication bug + +--- + libavformat/http.c | 25 ++++++++++++++++++++++++- + 1 file changed, 24 insertions(+), 1 deletion(-) + +diff --git a/libavformat/http.c b/libavformat/http.c +index 6e96aaa..87a2eb3 100644 +--- a/libavformat/http.c ++++ b/libavformat/http.c +@@ -80,6 +80,7 @@ typedef struct HTTPContext { + char *uri; + char *location; + HTTPAuthState auth_state; ++ int auth_type2; + HTTPAuthState proxy_auth_state; + char *http_proxy; + char *headers; +@@ -173,6 +174,7 @@ static const AVOption options[] = { + { "icy_metadata_packet", "return current ICY metadata packet", OFFSET(icy_metadata_packet), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, AV_OPT_FLAG_EXPORT }, + { "metadata", "metadata read from the bitstream", OFFSET(metadata), AV_OPT_TYPE_DICT, {0}, 0, 0, AV_OPT_FLAG_EXPORT }, + { "auth_type", "HTTP authentication type", OFFSET(auth_state.auth_type), AV_OPT_TYPE_INT, { .i64 = HTTP_AUTH_NONE }, HTTP_AUTH_NONE, HTTP_AUTH_BASIC, D | E, .unit = "auth_type"}, ++ { "auth_type2", "backup HTTP authentication type for seek request", OFFSET(auth_type2), AV_OPT_TYPE_INT, { .i64 = HTTP_AUTH_NONE }, HTTP_AUTH_NONE, HTTP_AUTH_BASIC, D | E, "auth_type"}, + { "none", "No auth method set, autodetect", 0, AV_OPT_TYPE_CONST, { .i64 = HTTP_AUTH_NONE }, 0, 0, D | E, .unit = "auth_type"}, + { "basic", "HTTP basic authentication", 0, AV_OPT_TYPE_CONST, { .i64 = HTTP_AUTH_BASIC }, 0, 0, D | E, .unit = "auth_type"}, + { "send_expect_100", "Force sending an Expect: 100-continue header for POST", OFFSET(send_expect_100), AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, E }, +@@ -731,6 +733,11 @@ static int http_open(URLContext *h, const char *uri, int flags, + int ret; + s->app_ctx = (AVApplicationContext *)av_dict_strtoptr(s->app_ctx_intptr); + ++ if (s->auth_type2 == HTTP_AUTH_NONE) { ++ //backup the init auth_type, when not assign. ++ s->auth_type2 = s->auth_state.auth_type; ++ } ++ + if( s->seekable == 1 ) + h->is_streamed = 0; + else +@@ -1483,6 +1490,7 @@ static int http_connect(URLContext *h, const char *path, const char *local_path, + uint64_t off = s->off; + const char *method; + int send_expect_100 = 0; ++ int cur_auth_type = s->auth_state.auth_type; + + av_bprint_init_for_buffer(&request, s->buffer, sizeof(s->buffer)); + +@@ -1624,9 +1632,19 @@ static int http_connect(URLContext *h, const char *path, const char *local_path, + + if (s->new_location) + s->off = off; +- + err = (off == s->off) ? 0 : -1; ++ ++ //in http_seek_internal func reverted to the original uri,but the s->off is not zero,so err is -1,cause can't goto the 401 authenticate logic. ++ if (err != 0 && cur_auth_type != s->auth_state.auth_type && s->http_code == 401) { ++ //reverte the off,otherwise can't seek the target position. ++ s->off = off; ++ av_log(NULL, AV_LOG_ERROR, "http 401 error,need authenticate:%s,at:%llu\n", s->buffer, s->off); ++ err = 0; ++ } + done: ++ if (err != 0) { ++ av_log(NULL, AV_LOG_ERROR, "http error %d,%s\n", s->http_code,s->buffer); ++ } + av_freep(&authstr); + av_freep(&proxyauthstr); + return err; +@@ -2021,6 +2039,8 @@ static int64_t http_seek_internal(URLContext *h, int64_t off, int whence, int fo + return s->off; + } + ++ // http_seek use lasest redirect location, because after redirect, reset the auth_state: `memset(&s->auth_state, 0, sizeof(s->auth_state));` ++ + /* if the location changed (redirect), revert to the original uri */ + if (strcmp(s->uri, s->location)) { + char *new_uri; +@@ -2029,6 +2049,9 @@ static int64_t http_seek_internal(URLContext *h, int64_t off, int whence, int fo + return AVERROR(ENOMEM); + av_free(s->location); + s->location = new_uri; ++ if (s->auth_type2 != HTTP_AUTH_NONE) { ++ s->auth_state.auth_type = s->auth_type2; ++ } + } + + /* we save the old context in case the seek fails */ +-- +2.39.5 (Apple Git-154) + diff --git a/patches/ffmpeg-n7.1.1/0024-supportsFamily-is-only-available-on-iOS-13.0-or-newe.patch b/patches/ffmpeg-n7.1.1/0024-supportsFamily-is-only-available-on-iOS-13.0-or-newe.patch new file mode 100644 index 000000000..a1b64b8cb --- /dev/null +++ b/patches/ffmpeg-n7.1.1/0024-supportsFamily-is-only-available-on-iOS-13.0-or-newe.patch @@ -0,0 +1,25 @@ +From 5f2599819cafddaa5010462db07db7efbd05907e Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Thu, 29 May 2025 11:13:10 +0800 +Subject: [PATCH] 'supportsFamily:' is only available on iOS 13.0 or newer + +--- + libavfilter/metal/utils.m | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libavfilter/metal/utils.m b/libavfilter/metal/utils.m +index f365d3c..bb1825a 100644 +--- a/libavfilter/metal/utils.m ++++ b/libavfilter/metal/utils.m +@@ -31,7 +31,7 @@ void ff_metal_compute_encoder_dispatch(id device, + BOOL fallback = YES; + // MAC_OS_X_VERSION_10_15 is only defined on SDKs new enough to include its functionality (including iOS, tvOS, etc) + #ifdef MAC_OS_X_VERSION_10_15 +- if (@available(macOS 10.15, iOS 11, tvOS 14.5, *)) { ++ if (@available(macOS 10.15, iOS 13, tvOS 14.5, *)) { + if ([device supportsFamily:MTLGPUFamilyCommon3]) { + MTLSize threadsPerGrid = MTLSizeMake(width, height, 1); + [encoder dispatchThreads:threadsPerGrid threadsPerThreadgroup:threadsPerThreadgroup]; +-- +2.39.5 (Apple Git-154) + diff --git a/patches/ffmpeg-n7.1.1/0025-fix-ffmpeg-constructed-wrong-avcc-for-videotoolbox.patch b/patches/ffmpeg-n7.1.1/0025-fix-ffmpeg-constructed-wrong-avcc-for-videotoolbox.patch new file mode 100644 index 000000000..139f3267f --- /dev/null +++ b/patches/ffmpeg-n7.1.1/0025-fix-ffmpeg-constructed-wrong-avcc-for-videotoolbox.patch @@ -0,0 +1,58 @@ +From 182364b5b9adb60cf07bd67c0712b5dae36dde79 Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Thu, 29 May 2025 11:13:47 +0800 +Subject: [PATCH] fix ffmpeg constructed wrong avcc for videotoolbox + +--- + libavcodec/videotoolbox.c | 35 ++++++++++++++++++++++++++++++++++- + 1 file changed, 34 insertions(+), 1 deletion(-) + +diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c +index 505483e..525d455 100644 +--- a/libavcodec/videotoolbox.c ++++ b/libavcodec/videotoolbox.c +@@ -224,7 +224,40 @@ CFDataRef ff_videotoolbox_avcc_extradata_create(AVCodecContext *avctx) + if (vtctx) + memcpy(vtctx->sps, h->ps.sps->data + 1, 3); + +- data = CFDataCreate(kCFAllocatorDefault, vt_extradata, vt_extradata_size); ++ /* ++ ffmpeg constructed avcc is wrong,but i dont't why;eg: ++ ff constructed avcc: ++ 014d401effe1001b674d401eec806c1ef3fff8140013f88000000080000019078b16cb01000468ebec4c ++ avctx->extradata avcc: ++ 014d401effe1001c674d401eec806c1ef3fff8140013f8800000030080000019078b16cb01000568ebec4c80 ++ */ ++ if (avctx->extradata_size != vt_extradata_size) { ++ char msg[256]; ++ { ++ char buffer[128]; ++ sprintf(buffer, "%s", "ff avcc maybe wrong:"); ++ int len = (int)strlen(buffer); ++ int size = FFMIN(vt_extradata_size, 127 - len) / 2; ++ for (int i = 0; i < size; i++) { ++ len += sprintf(buffer + len, "%02X", vt_extradata[i]); ++ } ++ sprintf(msg, "%s", buffer); ++ } ++ { ++ char buffer[128]; ++ sprintf(buffer, "%s", "\nuse origin avcc:"); ++ int len = (int)strlen(buffer); ++ int size = FFMIN(avctx->extradata_size, 127 - len) / 2; ++ for (int i = 0; i < size; i++) { ++ len += sprintf(buffer + len, "%02X", avctx->extradata[i]); ++ } ++ sprintf(msg + strlen(msg), "%s", buffer); ++ } ++ av_log(avctx, AV_LOG_INFO, "%s\n", msg); ++ data = CFDataCreate(kCFAllocatorDefault, avctx->extradata, avctx->extradata_size); ++ } else { ++ data = CFDataCreate(kCFAllocatorDefault, vt_extradata, vt_extradata_size); ++ } + av_free(vt_extradata); + return data; + } +-- +2.39.5 (Apple Git-154) + diff --git a/patches/ffmpeg-n7.1.1/0026-add-built-in-smb2-protocol-via-libsmb2.patch b/patches/ffmpeg-n7.1.1/0026-add-built-in-smb2-protocol-via-libsmb2.patch new file mode 100644 index 000000000..fafd0d303 --- /dev/null +++ b/patches/ffmpeg-n7.1.1/0026-add-built-in-smb2-protocol-via-libsmb2.patch @@ -0,0 +1,495 @@ +From a9fb97ec6c7623c584f19411cf7def836ad72796 Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Thu, 29 May 2025 10:49:16 +0800 +Subject: [PATCH] add built-in smb2 protocol via libsmb2 + +--- + configure | 5 + + libavformat/Makefile | 1 + + libavformat/libsmb2.c | 412 ++++++++++++++++++++++++++++++++++++++++ + libavformat/protocols.c | 1 + + 4 files changed, 419 insertions(+) + create mode 100644 libavformat/libsmb2.c + +diff --git a/configure b/configure +index ffa407d..f74d4de 100755 +--- a/configure ++++ b/configure +@@ -272,6 +272,7 @@ External library support: + --enable-libshaderc enable GLSL->SPIRV compilation via libshaderc [no] + --enable-libshine enable fixed-point MP3 encoding via libshine [no] + --enable-libsmbclient enable Samba protocol via libsmbclient [no] ++ --enable-libsmb2 enable Samba protocol via libsmb2 [no] + --enable-libsnappy enable Snappy compression, needed for hap encoding [no] + --enable-libsoxr enable Include libsoxr resampling [no] + --enable-libspeex enable Speex de/encoding via libspeex [no] +@@ -1953,6 +1954,7 @@ EXTERNAL_LIBRARY_LIST=" + libshaderc + libshine + libsmbclient ++ libsmb2 + libsnappy + libsoxr + libspeex +@@ -3816,6 +3818,7 @@ librtmps_protocol_deps="librtmp" + librtmpt_protocol_deps="librtmp" + librtmpte_protocol_deps="librtmp" + libsmbclient_protocol_deps="libsmbclient gplv3" ++libsmb2_protocol_deps="libsmb2" + libsrt_protocol_deps="libsrt" + libsrt_protocol_select="network" + libssh_protocol_deps="libssh" +@@ -6991,6 +6994,8 @@ enabled libshaderc && require_pkg_config spirv_compiler "shaderc >= 2019. + enabled libshine && require_pkg_config libshine shine shine/layer3.h shine_encode_buffer + enabled libsmbclient && { check_pkg_config libsmbclient smbclient libsmbclient.h smbc_init || + require libsmbclient libsmbclient.h smbc_init -lsmbclient; } ++enabled libsmb2 && { check_pkg_config libsmb2 libsmb2 smb2/smb2-errors.h SMB2_STATUS_SUCCESS || ++ require libsmb2 smb2/smb2-errors.h SMB2_STATUS_SUCCESS -lsmb2; } + enabled libsnappy && require libsnappy snappy-c.h snappy_compress -lsnappy -lstdc++ + enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr + enabled libssh && require_pkg_config libssh "libssh >= 0.6.0" libssh/sftp.h sftp_init +diff --git a/libavformat/Makefile b/libavformat/Makefile +index 17222ee..155dbe1 100644 +--- a/libavformat/Makefile ++++ b/libavformat/Makefile +@@ -735,6 +735,7 @@ OBJS-$(CONFIG_LIBRTMPS_PROTOCOL) += librtmp.o + OBJS-$(CONFIG_LIBRTMPT_PROTOCOL) += librtmp.o + OBJS-$(CONFIG_LIBRTMPTE_PROTOCOL) += librtmp.o + OBJS-$(CONFIG_LIBSMBCLIENT_PROTOCOL) += libsmbclient.o ++OBJS-$(CONFIG_LIBSMB2_PROTOCOL) += libsmb2.o + OBJS-$(CONFIG_LIBSRT_PROTOCOL) += libsrt.o urldecode.o + OBJS-$(CONFIG_LIBSSH_PROTOCOL) += libssh.o + OBJS-$(CONFIG_LIBZMQ_PROTOCOL) += libzmq.o +diff --git a/libavformat/libsmb2.c b/libavformat/libsmb2.c +new file mode 100644 +index 0000000..408f9e1 +--- /dev/null ++++ b/libavformat/libsmb2.c +@@ -0,0 +1,412 @@ ++/* ++ * Copyright (c) 2014 Lukasz Marek ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++ ++#include ++#include ++#include "libavutil/avstring.h" ++#include "libavutil/opt.h" ++#include "libavutil/mem.h" ++#include "application.h" ++#include "url.h" ++#include "urldecode.h" ++//smb2.h:37:9: error: unknown type name 'time_t'; ++#include ++#include ++#include ++#include ++ ++typedef struct ++{ ++ const AVClass *class; ++ ++ struct smb2_context *ctx; ++ struct smb2_url *url; ++ struct smb2fh *fh; ++ struct smb2dir *dir; ++ ++ uint64_t filesize; ++ char *app_ctx_intptr; ++ AVApplicationContext *app_ctx; ++ int smb2_seal; ++} LIBSMB2Context; ++ ++static void destroy_smb2(LIBSMB2Context *libsmb2) ++{ ++ if (libsmb2->fh && libsmb2->ctx) { ++ smb2_close(libsmb2->ctx, libsmb2->fh); ++ } ++ ++ if (libsmb2->ctx) { ++ smb2_disconnect_share(libsmb2->ctx); ++ smb2_destroy_context(libsmb2->ctx); ++ } ++ ++ if (libsmb2->url) { ++ smb2_destroy_url(libsmb2->url); ++ } ++ libsmb2->fh = NULL; ++ libsmb2->ctx = NULL; ++ libsmb2->url = NULL; ++} ++ ++static av_cold int libsmb2_close(URLContext *h) ++{ ++ LIBSMB2Context *libsmb2 = h->priv_data; ++ destroy_smb2(libsmb2); ++ return 0; ++} ++ ++static av_cold int libsmb2_open(URLContext *h, const char *uri, int flags) ++{ ++ int ret = 0; ++ LIBSMB2Context *libsmb2 = h->priv_data; ++ libsmb2->filesize = -1; ++ libsmb2->ctx = smb2_init_context(); ++ libsmb2->app_ctx = (AVApplicationContext *)av_dict_strtoptr(libsmb2->app_ctx_intptr); ++ ++ av_application_will_http_open(libsmb2->app_ctx, (void *)h, uri); ++ ++ if (!libsmb2->ctx) { ++ av_log(h, AV_LOG_ERROR, "smb2 create context failed: %s.\n", smb2_get_error(libsmb2->ctx)); ++ ret = AVERROR(ENOMEM); ++ goto failed; ++ } ++ ++ const char *smb_url = av_strireplace(uri, "smb2", "smb"); ++ struct smb2_url *url = smb2_parse_url(libsmb2->ctx, smb_url); ++ ++ if (url == NULL) { ++ av_log(h, AV_LOG_ERROR, "smb2 parse url failed: %s\n", smb2_get_error(libsmb2->ctx)); ++ ret = AVERROR(ENOMEM); ++ goto failed; ++ } else { ++ if (url->user) { ++ char *user = strchr(url->user, ':'); ++ if (user) { ++ *user = '\0'; ++ char *password = user + 1; ++ if (strlen(password) > 0) { ++ password = ff_urldecode(password, 0); ++ smb2_set_password(libsmb2->ctx, password); ++ } ++ } ++ } ++ ++ if (url->domain) { ++ smb2_set_domain(libsmb2->ctx, url->domain); ++ } ++ ++ if (url->share) { ++ char *share = ff_urldecode(url->share, 0); ++ memset(url->share, 0, strlen(url->share)); ++ memcpy(url->share, share, strlen(share)); ++ } ++ ++ if (url->path) { ++ char *path = ff_urldecode(url->path, 0); ++ memset(url->path, 0, strlen(url->path)); ++ memcpy(url->path, path, strlen(path)); ++ } ++ ++ libsmb2->url = url; ++ } ++ ++ //https://github.com/sahlberg/libsmb2/issues/271 ++ //fix Very slow performance w/MacOS SMB server ++ //smb2_set_security_mode(libsmb2->ctx, SMB2_NEGOTIATE_SIGNING_ENABLED); ++ smb2_set_seal(libsmb2->ctx, libsmb2->smb2_seal); ++ smb2_set_authentication(libsmb2->ctx, 1);//SMB2_SEC_NTLMSSP ++ smb2_set_timeout(libsmb2->ctx, 60); ++ ++ if (smb2_connect_share(libsmb2->ctx, url->server, url->share, url->user) != 0) { ++ av_log(h, AV_LOG_ERROR, "smb2 connect share failed: %s\n", smb2_get_error(libsmb2->ctx)); ++ ret = AVERROR(ECONNREFUSED); ++ goto failed; ++ } ++ ++ int access; ++ if ((flags & AVIO_FLAG_WRITE) && (flags & AVIO_FLAG_READ)) { ++ access = O_CREAT | O_RDWR; ++ } else if (flags & AVIO_FLAG_WRITE) { ++ access = O_CREAT | O_WRONLY; ++ } else { ++ access = O_RDONLY; ++ } ++ ++ if (flags & AVIO_FLAG_DIRECT) { ++ if ((libsmb2->dir = smb2_opendir(libsmb2->ctx, url->path)) == NULL) { ++ av_log(h, AV_LOG_ERROR, "smb2 open dir failed: %s, error: %s\n", url->path, smb2_get_error(libsmb2->ctx)); ++ ret = AVERROR(ENOTDIR); ++ goto failed; ++ } ++ } else { ++ if ((libsmb2->fh = smb2_open(libsmb2->ctx, url->path, access)) == NULL) { ++ av_log(h, AV_LOG_ERROR, "smb2 open file failed: %s, error: %s\n", url->path, smb2_get_error(libsmb2->ctx)); ++ ret = AVERROR(ENOENT); ++ goto failed; ++ } ++ } ++ ++ struct smb2_stat_64 st = {0}; ++ ++ if (smb2_stat(libsmb2->ctx, url->path, &st) < 0) ++ av_log(h, AV_LOG_WARNING, "Cannot stat file: %s\n", smb2_get_error(libsmb2->ctx)); ++ else ++ libsmb2->filesize = st.smb2_size; ++ av_application_did_http_open(libsmb2->app_ctx, (void *)h, uri, 0, 200, libsmb2->filesize); ++ return 0; ++failed: ++ av_application_did_http_open(libsmb2->app_ctx, (void *)h, uri, ret, 500, 0); ++ if (libsmb2->fh && libsmb2->ctx) { ++ smb2_close(libsmb2->ctx, libsmb2->fh); ++ } ++ if (libsmb2->ctx) { ++ smb2_disconnect_share(libsmb2->ctx); ++ smb2_destroy_context(libsmb2->ctx); ++ } ++ if (libsmb2->url) { ++ smb2_destroy_url(libsmb2->url); ++ } ++ libsmb2->fh = NULL; ++ libsmb2->ctx = NULL; ++ libsmb2->url = NULL; ++ return -1; ++} ++ ++static int64_t libsmb2_seek(URLContext *h, int64_t pos, int whence) ++{ ++ LIBSMB2Context *libsmb2 = h->priv_data; ++ int64_t newpos; ++ ++ if (whence == AVSEEK_SIZE) { ++ if (libsmb2->filesize == -1) { ++ av_log(h, AV_LOG_ERROR, "smb2 seek failed,filesize is unknown.\n"); ++ return AVERROR(EIO); ++ } else { ++ return libsmb2->filesize; ++ } ++ } ++ ++ av_application_will_http_seek(libsmb2->app_ctx, (void *)h, h->filename, pos); ++ ++ if ((newpos = smb2_lseek(libsmb2->ctx, libsmb2->fh, pos, whence, NULL)) < 0) { ++ av_log(h, AV_LOG_ERROR, "smb2 seek failed: %s\n", smb2_get_error(libsmb2->ctx)); ++ av_application_did_http_seek(libsmb2->app_ctx, (void *)h, h->filename, pos, AVERROR(errno), 500); ++ return AVERROR(errno); ++ } ++ av_application_did_http_seek(libsmb2->app_ctx, (void *)h, h->filename, pos, 0, 200); ++ return newpos; ++} ++ ++static int libsmb2_read(URLContext *h, unsigned char *buf, int size) ++{ ++ LIBSMB2Context *libsmb2 = h->priv_data; ++ ++ uint8_t *buf1 = buf; ++ int buf_size1 = size; ++ int has_error = 0; ++ ++ while (buf_size1 > 0) { ++ int read = smb2_read(libsmb2->ctx, libsmb2->fh, buf1, buf_size1); ++ if (read < 0) { ++ av_log(h, AV_LOG_ERROR, "smb2 read file failed: %s\n", ++ smb2_get_error(libsmb2->ctx)); ++ has_error = 1; ++ break; ++ } ++ if (read == 0) { ++ // eof ++ break; ++ } ++ buf1 += read; ++ buf_size1 -= read; ++ } ++ ++ int bytes_read = size - buf_size1; ++ if (bytes_read > 0) ++ av_application_did_io_tcp_read(libsmb2->app_ctx, (void*)h, bytes_read); ++ ++ return bytes_read ? bytes_read : (has_error ? AVERROR(ENOTCONN) : AVERROR_EOF); ++} ++ ++static int libsmb2_write(URLContext *h, const unsigned char *buf, int size) ++{ ++ LIBSMB2Context *libsmb2 = h->priv_data; ++ int bytes_written; ++ ++ if ((bytes_written = smb2_write(libsmb2->ctx, libsmb2->fh, buf, size)) < 0) { ++ int ret = AVERROR(errno); ++ av_log(h, AV_LOG_ERROR, "smb2 write failed: %s\n", strerror(errno)); ++ return ret; ++ } ++ ++ return bytes_written; ++} ++ ++static int libsmb2_delete(URLContext *h) ++{ ++ LIBSMB2Context *libsmb2 = h->priv_data; ++ ++ struct smb2_url *url = smb2_parse_url(libsmb2->ctx, h->filename); ++ if (url == NULL) { ++ av_log(h, AV_LOG_ERROR, "smb2 parse url failed: %s\n", ++ smb2_get_error(libsmb2->ctx)); ++ return -1; ++ } else { ++ char *path = ff_urldecode(url->path, 0); ++ return smb2_unlink(libsmb2->ctx, path); ++ } ++} ++ ++static int libsmb2_move(URLContext *h_src, URLContext *h_dst) ++{ ++ LIBSMB2Context *libsmb2 = h_src->priv_data; ++ if (!libsmb2) ++ { ++ return -1; ++ } ++ ++ struct smb2_url *src_url = smb2_parse_url(libsmb2->ctx, h_src->filename); ++ struct smb2_url *dst_url = smb2_parse_url(libsmb2->ctx, h_dst->filename); ++ ++ if (src_url == NULL || dst_url == NULL) { ++ av_log(h_src, AV_LOG_ERROR, "smb2 parse url failed: %s\n", smb2_get_error(libsmb2->ctx)); ++ return -2; ++ } else { ++ char *src_path = ff_urldecode(src_url->path, 0); ++ char *dst_path = ff_urldecode(dst_url->path, 0); ++ return smb2_rename(libsmb2->ctx, src_path, dst_path); ++ } ++} ++ ++static int libsmb2_open_dir(URLContext *h) ++{ ++ LIBSMB2Context *libsmb2 = h->priv_data; ++ struct smb2_url *url = smb2_parse_url(libsmb2->ctx, h->filename); ++ if (url == NULL) { ++ av_log(h, AV_LOG_ERROR, "smb2 parse url failed: %s\n", smb2_get_error(libsmb2->ctx)); ++ return -1; ++ } else { ++ char *path = ff_urldecode(url->path, 0); ++ libsmb2->dir = smb2_opendir(libsmb2->ctx, path); ++ if (!libsmb2->dir){ ++ av_log(h, AV_LOG_ERROR, "smb2 open dir failed: %s\n", smb2_get_error(libsmb2->ctx)); ++ return 0; ++ } ++ return AVERROR(ENOTDIR); ++ } ++} ++ ++static int libsmb2_read_dir(URLContext *h, AVIODirEntry **next) ++{ ++ LIBSMB2Context *libsmb2 = h->priv_data; ++ AVIODirEntry *entry; ++ struct smb2dirent *dirent = NULL; ++ int skip_entry; ++ ++ *next = entry = ff_alloc_dir_entry(); ++ if (!entry) ++ return AVERROR(ENOMEM); ++ do { ++ skip_entry = 0; ++ dirent = smb2_readdir(libsmb2->ctx, libsmb2->dir); ++ if (!dirent) { ++ av_freep(next); ++ return 0; ++ } ++ } while (skip_entry || !strcmp(dirent->name, ".") || ++ !strcmp(dirent->name, "..")); ++ ++ entry->name = av_strdup(dirent->name); ++ if (!entry->name) { ++ av_freep(next); ++ return AVERROR(ENOMEM); ++ } ++ ++ struct smb2_stat_64 st = dirent->st; ++ switch (st.smb2_type) { ++ case SMB2_TYPE_DIRECTORY: ++ entry->type = AVIO_ENTRY_DIRECTORY; ++ break; ++ case SMB2_TYPE_FILE: ++ entry->type = AVIO_ENTRY_FILE; ++ break; ++ case SMB2_TYPE_LINK: ++ entry->type = AVIO_ENTRY_SYMBOLIC_LINK; ++ break; ++ default: ++ entry->type = AVIO_ENTRY_UNKNOWN; ++ break; ++ } ++ ++ entry->group_id = -1; ++ entry->user_id = -1; ++ entry->filemode = -1; ++ entry->size = st.smb2_size; ++ entry->modification_timestamp = INT64_C(1000000) * st.smb2_mtime; ++ entry->access_timestamp = INT64_C(1000000) * st.smb2_atime; ++ entry->status_change_timestamp = INT64_C(1000000) * st.smb2_ctime; ++ ++ return 0; ++} ++ ++static int libsmb2_close_dir(URLContext *h) ++{ ++ LIBSMB2Context *libsmb2 = h->priv_data; ++ if (libsmb2->dir) { ++ smb2_closedir(libsmb2->ctx, libsmb2->dir); ++ libsmb2->dir = NULL; ++ } ++ return 0; ++} ++ ++#define OFFSET(x) offsetof(LIBSMB2Context, x) ++#define D AV_OPT_FLAG_DECODING_PARAM ++#define E AV_OPT_FLAG_ENCODING_PARAM ++static const AVOption options[] = { ++ { "ijkapplication", "AVApplicationContext", OFFSET(app_ctx_intptr), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, .flags = D }, ++ { "smb2_seal", "enable smb3 encrypted connection", OFFSET(smb2_seal), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, .flags = D }, ++ {NULL} ++}; ++ ++static const AVClass libsmb2lient_context_class = { ++ .class_name = "libsmb2", ++ .item_name = av_default_item_name, ++ .option = options, ++ .version = LIBAVUTIL_VERSION_INT, ++}; ++ ++const URLProtocol ff_libsmb2_protocol = { ++ .name = "smb2", ++ .flags = URL_PROTOCOL_FLAG_NETWORK, ++ .priv_data_size = sizeof(LIBSMB2Context), ++ .priv_data_class = &libsmb2lient_context_class, ++ .url_open = libsmb2_open, ++ .url_read = libsmb2_read, ++ .url_write = libsmb2_write, ++ .url_seek = libsmb2_seek, ++ .url_close = libsmb2_close, ++ .url_delete = libsmb2_delete, ++ .url_move = libsmb2_move, ++ .url_open_dir = libsmb2_open_dir, ++ .url_read_dir = libsmb2_read_dir, ++ .url_close_dir = libsmb2_close_dir, ++}; +diff --git a/libavformat/protocols.c b/libavformat/protocols.c +index f5eb0db..ba08718 100644 +--- a/libavformat/protocols.c ++++ b/libavformat/protocols.c +@@ -75,6 +75,7 @@ extern const URLProtocol ff_librtmpte_protocol; + extern const URLProtocol ff_libsrt_protocol; + extern const URLProtocol ff_libssh_protocol; + extern const URLProtocol ff_libsmbclient_protocol; ++extern const URLProtocol ff_libsmb2_protocol; + extern const URLProtocol ff_libzmq_protocol; + extern const URLProtocol ff_ipfs_gateway_protocol; + extern const URLProtocol ff_ipns_gateway_protocol; +-- +2.39.5 (Apple Git-154) + diff --git a/patches/ffmpeg-n7.1.1/0027-URLProtocol-add-url_parse_priv-function-pointer.patch b/patches/ffmpeg-n7.1.1/0027-URLProtocol-add-url_parse_priv-function-pointer.patch new file mode 100644 index 000000000..723c819bd --- /dev/null +++ b/patches/ffmpeg-n7.1.1/0027-URLProtocol-add-url_parse_priv-function-pointer.patch @@ -0,0 +1,55 @@ +From e9eb133958e3c646b8e4232e0a05a96bfea4d56e Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Thu, 29 May 2025 11:14:13 +0800 +Subject: [PATCH] URLProtocol add url_parse_priv function pointer + +--- + libavformat/demux.c | 11 +++++++++++ + libavformat/url.h | 2 ++ + 2 files changed, 13 insertions(+) + +diff --git a/libavformat/demux.c b/libavformat/demux.c +index c0d744d..9ce4525 100644 +--- a/libavformat/demux.c ++++ b/libavformat/demux.c +@@ -341,6 +341,17 @@ int avformat_open_input(AVFormatContext **ps, const char *filename, + ff_id3v2_free_extra_meta(&id3v2_extra_meta); + } + ++ //fill stream info ++ if (s->pb) { ++ URLContext *url_context = ffio_geturlcontext(s->pb); ++ if (url_context && url_context->prot) { ++ URLProtocol *prot = url_context->prot; ++ if (prot->url_parse_priv) { ++ prot->url_parse_priv(s, url_context); ++ } ++ } ++ } ++ + if ((ret = avformat_queue_attached_pictures(s)) < 0) + goto close; + +diff --git a/libavformat/url.h b/libavformat/url.h +index 53c6f13..f7e5bb2 100644 +--- a/libavformat/url.h ++++ b/libavformat/url.h +@@ -48,6 +48,7 @@ typedef struct URLContext { + int min_packet_size; /**< if non zero, the stream is packetized with this min packet size */ + } URLContext; + ++typedef struct AVFormatContext AVFormatContext; + typedef struct URLProtocol { + const char *name; + int (*url_open)( URLContext *h, const char *url, int flags); +@@ -93,6 +94,7 @@ typedef struct URLProtocol { + int (*url_close_dir)(URLContext *h); + int (*url_delete)(URLContext *h); + int (*url_move)(URLContext *h_src, URLContext *h_dst); ++ int (*url_parse_priv)(AVFormatContext *ic, URLContext *h); + const char *default_whitelist; + } URLProtocol; + +-- +2.39.5 (Apple Git-154) + diff --git a/patches/ffmpeg-n7.1.1/0028-bluray-protocol-add-dvd-fallback.patch b/patches/ffmpeg-n7.1.1/0028-bluray-protocol-add-dvd-fallback.patch new file mode 100644 index 000000000..4fcfdec5b --- /dev/null +++ b/patches/ffmpeg-n7.1.1/0028-bluray-protocol-add-dvd-fallback.patch @@ -0,0 +1,54 @@ +From f57d809f553431b46a023a69035c30b0485d207d Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Thu, 29 May 2025 11:15:16 +0800 +Subject: [PATCH] bluray protocol add dvd fallback + +--- + libavformat/demux.c | 23 +++++++++++++++++++---- + 1 file changed, 19 insertions(+), 4 deletions(-) + +diff --git a/libavformat/demux.c b/libavformat/demux.c +index 9ce4525..d8aa824 100644 +--- a/libavformat/demux.c ++++ b/libavformat/demux.c +@@ -159,7 +159,8 @@ static int init_input(AVFormatContext *s, const char *filename, + int ret; + AVProbeData pd = { filename, NULL, 0 }; + int score = AVPROBE_SCORE_RETRY; +- ++ AVDictionary *tmp_opts = NULL; ++ + if (s->pb) { + s->flags |= AVFMT_FLAG_CUSTOM_IO; + if (!s->iformat) +@@ -174,10 +175,24 @@ static int init_input(AVFormatContext *s, const char *filename, + if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) || + (!s->iformat && (s->iformat = av_probe_input_format2(&pd, 0, &score)))) + return score; ++ ++ if (options && av_stristart(filename, "bluray://", NULL)) { ++ av_dict_copy(&tmp_opts, *options, 0); ++ } + +- if ((ret = s->io_open(s, &s->pb, filename, AVIO_FLAG_READ | s->avio_flags, options)) < 0) +- return ret; +- ++ if ((ret = s->io_open(s, &s->pb, filename, AVIO_FLAG_READ | s->avio_flags, ++ options)) < 0) { ++ if (av_stristart(filename, "bluray://", NULL)) { ++ const char *a_name = av_strireplace(filename, "bluray://", ""); ++ ret = init_input(s, a_name, &tmp_opts); ++ av_dict_free(&tmp_opts); ++ return ret; ++ } else { ++ av_dict_free(&tmp_opts); ++ return ret; ++ } ++ } ++ av_dict_free(&tmp_opts); + if (s->iformat) + return 0; + return av_probe_input_buffer2(s->pb, &s->iformat, filename, +-- +2.39.5 (Apple Git-154) + diff --git a/patches/ffmpeg-n7.1.1/0029-custom-bluray-fs-for-network-Blu-ray-Disc-and-BDMV.patch b/patches/ffmpeg-n7.1.1/0029-custom-bluray-fs-for-network-Blu-ray-Disc-and-BDMV.patch new file mode 100644 index 000000000..8e02b5182 --- /dev/null +++ b/patches/ffmpeg-n7.1.1/0029-custom-bluray-fs-for-network-Blu-ray-Disc-and-BDMV.patch @@ -0,0 +1,673 @@ +From a0019b9ae6f4f9e2722f63dee3fc71170aadc251 Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Thu, 29 May 2025 11:16:11 +0800 +Subject: [PATCH] custom bluray fs for network Blu-ray Disc and BDMV + +--- + libavformat/Makefile | 2 +- + libavformat/bluray.c | 118 +++++++++- + libavformat/bluray_custom_fs.c | 413 +++++++++++++++++++++++++++++++++ + libavformat/bluray_custom_fs.h | 29 +++ + 4 files changed, 553 insertions(+), 9 deletions(-) + create mode 100644 libavformat/bluray_custom_fs.c + create mode 100644 libavformat/bluray_custom_fs.h + +diff --git a/libavformat/Makefile b/libavformat/Makefile +index 17222ee..08dc08c 100644 +--- a/libavformat/Makefile ++++ b/libavformat/Makefile +@@ -678,7 +678,7 @@ OBJS-$(CONFIG_VAPOURSYNTH_DEMUXER) += vapoursynth.o + OBJS-$(CONFIG_ANDROID_CONTENT_PROTOCOL) += file.o + OBJS-$(CONFIG_ASYNC_PROTOCOL) += async.o + OBJS-$(CONFIG_APPLEHTTP_PROTOCOL) += hlsproto.o +-OBJS-$(CONFIG_BLURAY_PROTOCOL) += bluray.o ++OBJS-$(CONFIG_BLURAY_PROTOCOL) += bluray.o bluray_custom_fs.o + OBJS-$(CONFIG_CACHE_PROTOCOL) += cache.o + OBJS-$(CONFIG_CONCAT_PROTOCOL) += concat.o + OBJS-$(CONFIG_CONCATF_PROTOCOL) += concat.o +diff --git a/libavformat/bluray.c b/libavformat/bluray.c +index 1845551..cd50523 100644 +--- a/libavformat/bluray.c ++++ b/libavformat/bluray.c +@@ -21,23 +21,27 @@ + */ + + #include +- ++#include "libavformat/urldecode.h" + #include "libavutil/avstring.h" + #include "libavformat/url.h" + #include "libavutil/opt.h" ++#include "bluray_custom_fs.h" ++#include "libavutil/dict.h" ++#include "libavformat/avformat.h" + +-#define BLURAY_PROTO_PREFIX "bluray:" ++#define BLURAY_PROTO_PREFIX "bluray://" + #define MIN_PLAYLIST_LENGTH 180 /* 3 min */ + + typedef struct { + const AVClass *class; + + BLURAY *bd; +- ++ fs_access *access; + int playlist; + int angle; + int chapter; + /*int region;*/ ++ int title_idx; + } BlurayContext; + + #define OFFSET(x) offsetof(BlurayContext, x) +@@ -106,23 +110,58 @@ static int bluray_close(URLContext *h) + if (bd->bd) { + bd_close(bd->bd); + } +- ++ destroy_bluray_custom_access(&bd->access); + return 0; + } + +-static int bluray_open(URLContext *h, const char *path, int flags) ++#ifdef DEBUG_BLURAY ++#include ++#define BLURAY_DEBUG_MASK 0xFFFFF //(0xFFFFF & ~DBG_STREAM) ++ ++static void bluray_DebugHandler(const char *psz) + { ++ size_t len = strlen(psz); ++ if(len < 1) return; ++ av_log(NULL, AV_LOG_INFO, "[bluray] %s\n",psz); ++} ++#endif ++ ++ ++static int bluray_open(URLContext *h, const char *path, int flags, AVDictionary **options) ++{ ++#ifdef DEBUG_BLURAY ++ bd_set_debug_mask(BLURAY_DEBUG_MASK); ++ bd_set_debug_handler(bluray_DebugHandler); ++#endif ++ + BlurayContext *bd = h->priv_data; + int num_title_idx; + const char *diskname = path; + + av_strstart(path, BLURAY_PROTO_PREFIX, &diskname); + +- bd->bd = bd_open(diskname, NULL); ++ fs_access *access = NULL; ++ ++ diskname = ff_urldecode(diskname, 0); ++ ++ if (av_strstart(diskname, "file://", NULL) || av_strstart(diskname, "/", NULL)) { ++ access = NULL; ++ } else { ++ //set read packet buffer size is important! the default packet size is 32768, when use smb2 protocol, download speed is limited to 2MB; but when set the size to 1048576, download speed is 16MB; ++ h->max_packet_size = 1048576; ++ access = create_bluray_custom_access(diskname, options); ++ } ++ ++ bd->bd = bd_open_fs(diskname, NULL, access); ++ + if (!bd->bd) { + av_log(h, AV_LOG_ERROR, "bd_open() failed\n"); ++ if (access) { ++ destroy_bluray_custom_access(&access); ++ } + return AVERROR(EIO); + } ++ bd->access = access; + + /* check if disc can be played */ + if (check_disc_info(h) < 0) { +@@ -159,12 +198,13 @@ static int bluray_open(URLContext *h, const char *path, int flags) + + if (info->duration > duration) { + bd->playlist = info->playlist; ++ bd->title_idx = i; + duration = info->duration; + } + + bd_free_title_info(info); + } +- av_log(h, AV_LOG_INFO, "selected %05d.mpls\n", bd->playlist); ++ av_log(h, AV_LOG_INFO, "select longest playlist: %05d.mpls\n", bd->playlist); + } + + /* select playlist */ +@@ -222,13 +262,75 @@ static int64_t bluray_seek(URLContext *h, int64_t pos, int whence) + return AVERROR(EINVAL); + } + ++static int bluray_parse_priv(AVFormatContext *ic, URLContext *h) ++{ ++ BlurayContext *bd = h->priv_data; ++ BLURAY_TITLE_INFO *title_info = NULL; ++ BLURAY_CLIP_INFO clip_info; ++ ++ int v_idx = 0; ++ int a_idx = 0; ++ int s_idx = 0; ++ int ret = 0; ++ ++ if (!bd || !bd->bd) { ++ return AVERROR(EFAULT); ++ } ++ ++ title_info = bd_get_title_info(bd->bd, bd->title_idx, 0); ++ if (!title_info) { ++ return AVERROR(EFAULT); ++ } ++ ++ if (title_info->clip_count <= 0) { ++ ret = EFAULT; ++ goto fail; ++ } ++ clip_info = title_info->clips[0]; ++ ++ for (int i = 0; i < ic->nb_streams; i++) { ++ if (ic->streams[i] && ic->streams[i]->codecpar) { ++ switch (ic->streams[i]->codecpar->codec_type) { ++ case AVMEDIA_TYPE_VIDEO: ++ if (v_idx < clip_info.video_stream_count) { ++ av_log(h, AV_LOG_INFO, "video stream %d lang = %s\n", v_idx, clip_info.video_streams[v_idx].lang); ++ av_dict_set(&ic->streams[i]->metadata, "language", clip_info.video_streams[v_idx].lang, AV_DICT_DONT_OVERWRITE); ++ v_idx++; ++ } ++ break; ++ case AVMEDIA_TYPE_AUDIO: ++ if (a_idx < clip_info.audio_stream_count) { ++ av_log(h, AV_LOG_INFO, "audio stream %d lang = %s\n", a_idx, clip_info.audio_streams[a_idx].lang); ++ av_dict_set(&ic->streams[i]->metadata, "language", clip_info.audio_streams[a_idx].lang, AV_DICT_DONT_OVERWRITE); ++ a_idx++; ++ } ++ break; ++ case AVMEDIA_TYPE_SUBTITLE: ++ if (s_idx < clip_info.pg_stream_count) { ++ av_log(h, AV_LOG_INFO, "subtitle stream %d lang = %s\n", s_idx, clip_info.pg_streams[s_idx].lang); ++ av_dict_set(&ic->streams[i]->metadata, "language", clip_info.pg_streams[s_idx].lang, AV_DICT_DONT_OVERWRITE); ++ s_idx++; ++ } ++ break; ++ default: ++ break; ++ } ++ } ++ } ++ ++fail: ++ bd_free_title_info(title_info); ++ ++ return ret != 0 ? AVERROR(ret) : 0; ++} + + const URLProtocol ff_bluray_protocol = { + .name = "bluray", + .url_close = bluray_close, +- .url_open = bluray_open, ++ .url_open2 = bluray_open, + .url_read = bluray_read, + .url_seek = bluray_seek, ++ .url_parse_priv = bluray_parse_priv, + .priv_data_size = sizeof(BlurayContext), + .priv_data_class = &bluray_context_class, + }; +diff --git a/libavformat/bluray_custom_fs.c b/libavformat/bluray_custom_fs.c +new file mode 100644 +index 0000000..bdf2451 +--- /dev/null ++++ b/libavformat/bluray_custom_fs.c +@@ -0,0 +1,413 @@ ++// ++// bluray_custom_fs_smb2.c ++// ++// Created by Reach Matt on 2024/9/13. ++// ++// ++// Copyright (C) 2021 Matt Reach// ++// Licensed under the Apache License, Version 2.0 (the "License"); ++// you may not use this file except in compliance with the License. ++// You may obtain a copy of the License at ++// ++// http://www.apache.org/licenses/LICENSE-2.0 ++// ++// Unless required by applicable law or agreed to in writing, software ++// distributed under the License is distributed on an "AS IS" BASIS, ++// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++// See the License for the specific language governing permissions and ++// limitations under the License. ++ ++#include "bluray_custom_fs.h" ++#include "url.h" ++#include "application.h" ++#include "libavutil/mem.h" ++#include "libavutil/error.h" ++#include "libavutil/avstring.h" ++#include ++#include ++ ++#ifndef UDF_BLOCK_SIZE ++# define UDF_BLOCK_SIZE 2048 ++#endif ++ ++typedef struct ff_builtin_io { ++ URLContext *url_context; ++ int64_t offset; ++ AVApplicationContext *app_ctx; ++} ff_builtin_io; ++ ++typedef struct ff_bluray_access { ++ const char *url; ++ AVDictionary *opts; ++ ff_builtin_io *io; ++} ff_bluray_access; ++ ++static int interrupt_cb(void *ctx) ++{ ++ return 0; ++} ++ ++static void close_builtin_io(ff_builtin_io *io) { ++ if (!io) { ++ return; ++ } ++ if (io->url_context) { ++ ffurl_closep(&io->url_context); ++ } ++} ++ ++static int create_builtin_io(ff_builtin_io **io, const char *url, AVDictionary **opts, int is_dir) ++{ ++ if (!io) { ++ return -1; ++ } ++ ++ ff_builtin_io * app = av_mallocz(sizeof(ff_builtin_io)); ++ if (!app) { ++ return -2; ++ } ++ ++ char *protocol_whitelist = NULL; ++ ++ if (opts) { ++ const AVDictionary *dict = *opts; ++ ++ if (!av_strstart(url, "http", NULL) && !av_strstart(url, "smb2", NULL)) { ++ AVDictionaryEntry *app_dict = av_dict_get(dict, "ijkapplication", NULL, 0); ++ if (app_dict) { ++ app->app_ctx = (AVApplicationContext *)av_dict_strtoptr(app_dict->value); ++ av_application_will_http_open(app->app_ctx, NULL, url); ++ } ++ } ++ ++ AVDictionaryEntry *proto_dict = av_dict_get(dict, "protocol_whitelist", NULL, 0); ++ if (proto_dict) { ++ protocol_whitelist = av_strdup(proto_dict->value); ++ } ++ } ++ ++ if (protocol_whitelist == NULL || strlen(protocol_whitelist) == 0) { ++ protocol_whitelist = "ijkio,ijkhttphook,http,tcp,https,tls,file,smb2"; ++ } ++ ++ AVIOInterruptCB cb = {&interrupt_cb, app}; ++ int flags = AVIO_FLAG_READ; ++ if (is_dir) { ++ flags |= AVIO_FLAG_DIRECT; ++ } ++ ++ int ret = ffurl_open_whitelist(&app->url_context, ++ url, ++ flags, ++ &cb, ++ opts, ++ protocol_whitelist, ++ NULL, ++ NULL); ++ ++ av_application_did_http_open(app->app_ctx, (void*)app->url_context, url, ret < 0 ? AVERROR(errno) : 0, ret < 0 ? 500 : 200, 0); ++ ++ if (ret < 0) { ++ close_builtin_io(app); ++ av_freep(&app); ++ } ++ *io = app; ++ return ret; ++} ++ ++static int64_t seek_builtin_io(ff_builtin_io *io, int64_t offset, int origin) ++{ ++ if (!io) { ++ return 0; ++ } ++ ++ if (io->offset == offset && origin == SEEK_SET) { ++ return offset; ++ } ++ ++ av_application_will_http_seek(io->app_ctx, (void*)io->url_context, io->url_context->filename, offset); ++ ++ int64_t pos = io->url_context->prot->url_seek(io->url_context, offset, origin); ++ if (pos < 0) { ++ av_application_did_http_seek(io->app_ctx, (void*)io->url_context, io->url_context->filename, offset, AVERROR(errno), 500); ++ return AVERROR(errno); ++ } ++ io->offset = pos; ++ ++ av_application_did_http_seek(io->app_ctx, (void*)io->url_context, io->url_context->filename, offset, 0, 200); ++ return pos; ++} ++ ++static int read_builtin_io(ff_builtin_io *io, uint8_t *buf, int buf_size) ++{ ++ if (!io) { ++ return 0; ++ } ++ ++ uint8_t *buf1 = buf; ++ int buf_size1 = buf_size; ++ int read = 0; ++ ++ while (buf_size1 > 0) { ++ read = io->url_context->prot->url_read(io->url_context, buf1, buf_size1); ++ if (read <= 0) { ++ //maybe AVERROR_EOF ++ break; ++ } ++ ++ io->offset += read; ++ buf1 += read; ++ buf_size1 -= read; ++ } ++ ++ int bytes = buf_size - buf_size1; ++ if (bytes == 0 && read == AVERROR_EOF) { ++ return AVERROR_EOF; ++ } else { ++ av_application_did_io_tcp_read(io->app_ctx, (void*)io->url_context, bytes); ++ return bytes; ++ } ++} ++ ++static int write_builtin_io(ff_builtin_io *io, uint8_t *buf, int buf_size) ++{ ++ if (!io) { ++ return 0; ++ } ++ ++ return io->url_context->prot->url_write(io->url_context, buf, buf_size); ++} ++ ++static int read_blocks(void * fs_handle, void *buf, int lba, int num_blocks) ++{ ++ ff_bluray_access *access = fs_handle; ++ ff_builtin_io *io = access->io; ++ if (!io) { ++ return -1; ++ } ++ int got = -1; ++ int64_t pos = (int64_t)lba * UDF_BLOCK_SIZE; ++ ++ seek_builtin_io(io, pos, SEEK_SET); ++ int bytes = read_builtin_io(io, (uint8_t*)buf, num_blocks * UDF_BLOCK_SIZE); ++ if (bytes > 0) { ++ got = (int)(bytes / UDF_BLOCK_SIZE); ++ } ++ return got; ++} ++ ++void destroy_bluray_custom_access(fs_access **p) ++{ ++ if (p) { ++ fs_access *access = *p; ++ if (access) { ++ ff_bluray_access* ba = access->fs_handle; ++ ff_builtin_io *io = ba->io; ++ if (io) { ++ close_builtin_io(io); ++ av_freep(&io); ++ } ++ av_free(ba->url); ++ av_dict_free(&ba->opts); ++ } ++ av_freep(p); ++ } ++} ++ ++// ------------------------------------------------------------------------------------------- ++// open_file for bdmv ++ ++static void _file_close(BD_FILE_H *file) ++{ ++ if (file) { ++ ff_builtin_io *io = file->internal; ++ if (io) { ++ close_builtin_io(io); ++ av_free(io); ++ file->internal = NULL; ++ } ++ av_freep(&file); ++ } ++} ++ ++static int64_t _file_read(BD_FILE_H *file, uint8_t *buf, int64_t size) ++{ ++ if (size <= 0) { ++ return 0; ++ } ++ ff_builtin_io *io = file->internal; ++ if (!io) { ++ return -1; ++ } ++ return read_builtin_io(io, buf, size); ++} ++ ++static int64_t _file_write(BD_FILE_H *file, const uint8_t *buf, int64_t size) ++{ ++ if (size <= 0) { ++ return 0; ++ } ++ ff_builtin_io *io = file->internal; ++ if (!io) { ++ return -1; ++ } ++ return write_builtin_io(io, buf, size); ++} ++ ++// origin: SEEK_SET, SEEK_CUR or SEEK_END ++static int64_t _file_seek(BD_FILE_H *file, int64_t offset, int32_t origin) ++{ ++ ff_builtin_io *io = file->internal; ++ if (!io) { ++ return -1; ++ } ++ return seek_builtin_io(io, offset, origin); ++} ++ ++static int64_t _file_tell(BD_FILE_H *file) ++{ ++ ff_builtin_io *io = file->internal; ++ if (!io) { ++ return -1; ++ } ++ return seek_builtin_io(io, 0, SEEK_CUR); ++} ++ ++static struct bd_file_s* open_file(void *fs_handle, const char *rel_path) ++{ ++ ff_bluray_access *access = fs_handle; ++ ++ char *url = NULL; ++ url = av_append_path_component(access->url, rel_path); ++ if (!url) { ++ return NULL; ++ } ++ AVDictionary *opts = NULL; ++ av_dict_copy(&opts, access->opts, 0); ++ ++ ff_builtin_io *io = NULL; ++ int ret = create_builtin_io(&io, url, &opts, 0); ++ av_dict_free(&opts); ++ av_free(url); ++ ++ if (0 != ret) { ++ av_log(NULL, AV_LOG_ERROR, "can't open url %s,error:%s", url, av_err2str(ret)); ++ return NULL; ++ } ++ ++ BD_FILE_H *file = av_malloc(sizeof(BD_FILE_H)); ++ if (!file) { ++ close_builtin_io(io); ++ av_free(io); ++ return NULL; ++ } ++ ++ file->internal = io; ++ file->close = _file_close; ++ file->seek = _file_seek; ++ file->read = _file_read; ++ file->write = _file_write; ++ file->tell = _file_tell; ++ ++ return file; ++} ++ ++// open_dir for bdmv ++static void _dir_close(BD_DIR_H *dir) ++{ ++ if (dir) { ++ ff_builtin_io *io = dir->internal; ++ if (!io) { ++ return; ++ } ++ close_builtin_io(io); ++ av_free(io); ++ dir->internal = NULL; ++ av_freep(&dir); ++ } ++} ++ ++static int _dir_read(BD_DIR_H *dir, BD_DIRENT *entry) ++{ ++ ff_builtin_io *io = dir->internal; ++ if (!io) { ++ return -1; ++ } ++ ++ AVIODirEntry *next = NULL; ++ ++ if (io->url_context->prot->url_read_dir(io->url_context, &next) < 0 || !next) { ++ return -2; ++ } ++ ++ strncpy(entry->d_name, next->name, sizeof(entry->d_name)); ++ entry->d_name[sizeof(entry->d_name) - 1] = 0; ++ ++ return 0; ++} ++ ++static struct bd_dir_s* open_dir (void *fs_handle, const char *rel_path) ++{ ++ ff_bluray_access *access = fs_handle; ++ ++ char *url = NULL; ++ url = av_append_path_component(access->url, rel_path); ++ if (!url) { ++ return NULL; ++ } ++ AVDictionary *opts = NULL; ++ av_dict_copy(&opts, access->opts, 0); ++ ++ ff_builtin_io *io = NULL; ++ int ret = create_builtin_io(&io, url, &opts, 1); ++ av_dict_free(&opts); ++ av_free(url); ++ ++ if (0 != ret) { ++ av_log(NULL, AV_LOG_ERROR, "can't open dir %s,error:%s", url, av_err2str(ret)); ++ return NULL; ++ } ++ ++ BD_DIR_H *dir = av_malloc(sizeof(BD_DIR_H)); ++ if (!dir) { ++ close_builtin_io(io); ++ av_free(io); ++ return NULL; ++ } ++ ++ dir->internal = io; ++ dir->close = _dir_close; ++ dir->read = _dir_read; ++ ++ return dir; ++} ++ ++// 构建fs_access结构体 ++fs_access * create_bluray_custom_access(const char *url, AVDictionary **options) ++{ ++ ff_bluray_access * opaque = av_mallocz(sizeof(ff_bluray_access)); ++ if (!opaque) { ++ return NULL; ++ } ++ ++ if (opaque) { ++ opaque->url = av_strdup(url); ++ if (options) { ++ av_dict_copy(&opaque->opts, *options, 0); ++ } ++ ++ int ret = create_builtin_io(&opaque->io, url, options, 0); ++ if (0 != ret) { ++ av_log(NULL, AV_LOG_ERROR, "can't open file %s,error:%s", url, av_err2str(ret)); ++ } ++ ++ fs_access *access = av_malloc(sizeof(fs_access)); ++ access->fs_handle = opaque; ++ access->read_blocks = read_blocks; ++ access->open_file = open_file; ++ access->open_dir = open_dir; ++ ++ return access; ++ } ++ return NULL; ++} +diff --git a/libavformat/bluray_custom_fs.h b/libavformat/bluray_custom_fs.h +new file mode 100644 +index 0000000..806fe29 +--- /dev/null ++++ b/libavformat/bluray_custom_fs.h +@@ -0,0 +1,29 @@ ++// ++// bluray_custom_fs.h ++// ++// Created by Reach Matt on 2024/9/13. ++// ++// ++// Copyright (C) 2021 Matt Reach// ++// Licensed under the Apache License, Version 2.0 (the "License"); ++// you may not use this file except in compliance with the License. ++// You may obtain a copy of the License at ++// ++// http://www.apache.org/licenses/LICENSE-2.0 ++// ++// Unless required by applicable law or agreed to in writing, software ++// distributed under the License is distributed on an "AS IS" BASIS, ++// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++// See the License for the specific language governing permissions and ++// limitations under the License. ++ ++#ifndef bluray_custom_fs_h ++#define bluray_custom_fs_h ++ ++#include ++ ++typedef struct fs_access fs_access; ++typedef struct AVDictionary AVDictionary; ++void destroy_bluray_custom_access(fs_access **p); ++fs_access * create_bluray_custom_access(const char *url, AVDictionary **options); ++#endif /* bluray_custom_fs_smb2_h */ +-- +2.39.5 (Apple Git-154) + diff --git a/patches/ffmpeg-n7.1.1/0030-bluray-open-and-find-the-right-m2ts-then-read-seek-i.patch b/patches/ffmpeg-n7.1.1/0030-bluray-open-and-find-the-right-m2ts-then-read-seek-i.patch new file mode 100644 index 000000000..8ea78466d --- /dev/null +++ b/patches/ffmpeg-n7.1.1/0030-bluray-open-and-find-the-right-m2ts-then-read-seek-i.patch @@ -0,0 +1,70 @@ +From 7346d485a6b495b6d46abc8b31ef7d2df56018ab Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Thu, 29 May 2025 11:16:41 +0800 +Subject: [PATCH] bluray open and find the right m2ts, then read\seek it + direactly instread of bluray logic. + +--- + libavformat/bluray.c | 24 +++++++++++++++++++----- + 1 file changed, 19 insertions(+), 5 deletions(-) + +diff --git a/libavformat/bluray.c b/libavformat/bluray.c +index cd50523..465ea9b 100644 +--- a/libavformat/bluray.c ++++ b/libavformat/bluray.c +@@ -42,6 +42,7 @@ typedef struct { + int chapter; + /*int region;*/ + int title_idx; ++ int stream_opened; + } BlurayContext; + + #define OFFSET(x) offsetof(BlurayContext, x) +@@ -222,7 +223,7 @@ static int bluray_open(URLContext *h, const char *path, int flags, AVDictionary + if (bd->chapter > 1) { + bd_seek_chapter(bd->bd, bd->chapter - 1); + } +- ++ bd->stream_opened = 1; + return 0; + } + +@@ -234,7 +235,13 @@ static int bluray_read(URLContext *h, unsigned char *buf, int size) + if (!bd || !bd->bd) { + return AVERROR(EFAULT); + } +- ++ if (bd->stream_opened) { ++ int read = (int)bd_file_read(bd->bd, buf, size); ++ if (read == 0) { ++ return AVERROR_EOF; ++ } ++ return read; ++ } + len = bd_read(bd->bd, buf, size); + + return len == 0 ? AVERROR_EOF : len; +@@ -252,10 +259,17 @@ static int64_t bluray_seek(URLContext *h, int64_t pos, int whence) + case SEEK_SET: + case SEEK_CUR: + case SEEK_END: +- return bd_seek(bd->bd, pos); +- ++ if (bd->stream_opened) { ++ return bd_file_seek(bd->bd, pos, whence); ++ } else { ++ return bd_seek(bd->bd, pos); ++ } + case AVSEEK_SIZE: +- return bd_get_title_size(bd->bd); ++ if (bd->stream_opened) { ++ return bd_file_size(bd->bd); ++ } else { ++ return bd_get_title_size(bd->bd); ++ } + } + + av_log(h, AV_LOG_ERROR, "Unsupported whence operation %d\n", whence); +-- +2.39.5 (Apple Git-154) + diff --git a/patches/ffmpeg-n7.1.1/todo/0009-mov-support-heic-demuxer-https-github.com-bluez-sh-F.patch b/patches/ffmpeg-n7.1.1/todo/0009-mov-support-heic-demuxer-https-github.com-bluez-sh-F.patch new file mode 100644 index 000000000..a659150a8 --- /dev/null +++ b/patches/ffmpeg-n7.1.1/todo/0009-mov-support-heic-demuxer-https-github.com-bluez-sh-F.patch @@ -0,0 +1,648 @@ +From 402459f6420e72c383c428af20c5d9b087ee71fc Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Mon, 22 Jul 2024 15:30:55 +0800 +Subject: [PATCH 09] mov support heic demuxer + (https://github.com/bluez-sh/FFmpeg/commit/9a885cddb3550ab863a60d02c5fb78e4ae206cf1) + +--- + libavcodec/packet.h | 15 ++ + libavformat/isom.h | 31 +++ + libavformat/mov.c | 483 +++++++++++++++++++++++++++++++++++++++++++- + 3 files changed, 525 insertions(+), 4 deletions(-) + +diff --git a/libavcodec/packet.h b/libavcodec/packet.h +index b19409b..094d457 100644 +--- a/libavcodec/packet.h ++++ b/libavcodec/packet.h +@@ -299,6 +299,21 @@ enum AVPacketSideDataType { + */ + AV_PKT_DATA_DYNAMIC_HDR10_PLUS, + ++ /** ++ * Tile info for image reconstruction ++ * @code ++ * u32le current_tile (current tile number in row major order) [0..nb_tiles-1] ++ * u32le nb_tiles ++ * u32le grid_rows (rows in the final image grid) ++ * u32le grid_cols (cols in the final image grid) ++ * u32le tile_width ++ * u32le tile_height ++ * u32le output_width (cropped width of the final image) ++ * u32le output_height (cropped height of the final image) ++ * @encode ++ */ ++ AV_PKT_DATA_TILE_INFO, ++ + /** + * The number of side data types. + * This is not part of the public API/ABI in the sense that it may +diff --git a/libavformat/isom.h b/libavformat/isom.h +index 3d375d7..020b892 100644 +--- a/libavformat/isom.h ++++ b/libavformat/isom.h +@@ -163,6 +163,16 @@ typedef struct MOVIndexRange { + int64_t end; + } MOVIndexRange; + ++typedef struct HEICItem { ++ int item_id; ++ uint64_t pos; ++ uint64_t size; ++ uint32_t width; ++ uint32_t height; ++ int is_idat_relative; ++ int type; ++} HEICItem; ++ + typedef struct MOVStreamContext { + AVIOContext *pb; + int pb_is_copied; +@@ -328,6 +338,27 @@ typedef struct MOVContext { + } *avif_info; + int avif_info_size; + int interleaved_read; ++ ++ int found_iloc; ///< 'iloc' atom has been found ++ uint64_t idat_offset; ///< offset of 'idat' atom (non-zero if found) ++ int disable_avformat_decoding; ++ struct AVCodecContext *dec_ctx; ++ AVFrame *frame; ///< final decoded frame in HEIF/HEIC ++ AVFrame *tile; ++ HEICItem *item_list; ///< list of items in HEIF/HEIC ++ int nb_items; ++ int *tile_id_list; ///< list containing item IDs of all tiles ++ int nb_tiles; ++ int cur_item_id; ++ int grid_item_id; ++ //int primary_item_id; ++ int primary_rot; ///< rotation angle for primary item ++ uint8_t grid_rows; ++ uint8_t grid_cols; ++ uint32_t tile_width; ++ uint32_t tile_height; ++ uint32_t output_width; ++ uint32_t output_height; + } MOVContext; + + int ff_mp4_read_descr_len(AVIOContext *pb); +diff --git a/libavformat/mov.c b/libavformat/mov.c +index 833db70..c795923 100644 +--- a/libavformat/mov.c ++++ b/libavformat/mov.c +@@ -66,6 +66,10 @@ + #include "mov_chan.h" + #include "replaygain.h" + ++#include "libavutil/imgutils.h" ++#include "libavutil/display.h" ++#include "libavcodec/avcodec.h" ++ + #if CONFIG_ZLIB + #include + #endif +@@ -744,6 +748,24 @@ static int mov_read_hdlr(MOVContext *c, AVIOContext *pb, MOVAtom atom) + av_log(c->fc, AV_LOG_TRACE, "ctype=%s\n", av_fourcc2str(ctype)); + av_log(c->fc, AV_LOG_TRACE, "stype=%s\n", av_fourcc2str(type)); + ++ if (type == MKTAG('p','i','c','t')) { ++ MOVStreamContext *sc; ++ st = avformat_new_stream(c->fc, NULL); ++ if (!st) ++ return AVERROR(ENOMEM); ++ sc = av_mallocz(sizeof(*sc)); ++ if (!sc) ++ return AVERROR(ENOMEM); ++ st->priv_data = sc; ++ st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO; ++ sc->pb = c->fc->pb; ++ sc->pb_is_copied = 1; ++ sc->time_scale = 1; ++ ++ avpriv_set_pts_info(st, 32, 1, sc->time_scale); ++ return 0; ++ } ++ + if (c->trak_index < 0) { // meta not inside a trak + if (type == MKTAG('m','d','t','a')) { + c->found_hdlr_mdta = 1; +@@ -2124,6 +2146,10 @@ static int mov_read_glbl(MOVContext *c, AVIOContext *pb, MOVAtom atom) + if ((uint64_t)atom.size > (1<<30)) + return AVERROR_INVALIDDATA; + ++ /* if iloc is already found, assuming non-tiled image (unless dimg found) */ ++ if (!c->nb_tiles && c->found_iloc && c->cur_item_id != c->primary_item_id) ++ return 0; ++ + if (atom.size >= 10) { + // Broken files created by legacy versions of libavformat will + // wrap a whole fiel atom inside of a glbl atom. +@@ -7790,6 +7816,226 @@ static int mov_read_pitm(MOVContext *c, AVIOContext *pb, MOVAtom atom) + return atom.size; + } + ++static int mov_read_iinf(MOVContext *c, AVIOContext *pb, MOVAtom atom) ++{ ++ int entry_count; ++ int version = avio_r8(pb); ++ avio_rb24(pb); /* flags */ ++ atom.size -= 4; ++ if (!version) { ++ entry_count = avio_rb16(pb); ++ atom.size -= 2; ++ } else { ++ entry_count = avio_rb32(pb); ++ atom.size -= 4; ++ } ++ if (!c->item_list) { ++ c->item_list = av_calloc(entry_count, sizeof(HEICItem)); ++ if (!c->item_list) ++ return AVERROR(ENOMEM); ++ c->nb_items = entry_count; ++ } ++ c->cur_item_id = 0; ++ return mov_read_default(c, pb, atom); ++} ++ ++static int mov_read_infe(MOVContext *c, AVIOContext *pb, MOVAtom atom) ++{ ++ int item_id, item_type; ++ int version = avio_r8(pb); ++ avio_rb24(pb); /* flags */ ++ ++ if (!c->fc->nb_streams) { ++ av_log(c->fc, AV_LOG_ERROR, "hdlr box not found\n"); ++ return AVERROR_INVALIDDATA; ++ } ++ ++ item_id = (version >= 3) ? avio_rb32(pb) : avio_rb16(pb); ++ if (avio_rb16(pb) != 0) { ++ avpriv_request_sample(c->fc, "Protected HEIC"); ++ return AVERROR_PATCHWELCOME; ++ } ++ item_type = avio_rl32(pb); ++ avio_r8(pb); /* null terminated tag */ ++ ++ if (item_type == MKTAG('h','v','c','1')) { ++ AVStream *st = c->fc->streams[c->fc->nb_streams-1]; ++ st->codecpar->codec_id = mov_codec_id(st, item_type); ++ } else if (item_type == MKTAG('g','r','i','d')) { ++ c->grid_item_id = item_id; ++ } ++ ++ if (c->cur_item_id < c->nb_items) { ++ c->item_list[c->cur_item_id].item_id = item_id; ++ c->item_list[c->cur_item_id].type = item_type; ++ c->cur_item_id++; ++ } ++ return 0; ++} ++ ++static int mov_read_iref(MOVContext *c, AVIOContext *pb, MOVAtom atom) ++{ ++ avio_rb32(pb); /* version and flags */ ++ atom.size -= 4; ++ return mov_read_default(c, pb, atom); ++} ++ ++static int mov_read_dimg(MOVContext *c, AVIOContext *pb, MOVAtom atom) ++{ ++ int entries, i; ++ int from_item_id = avio_rb16(pb); ++ ++ if (from_item_id != c->grid_item_id) { ++ avpriv_request_sample(c->fc, "Derived item of type other than 'grid'"); ++ return AVERROR_PATCHWELCOME; ++ } ++ entries = avio_rb16(pb); ++ c->tile_id_list = av_malloc_array(entries, sizeof(int)); ++ if (!c->tile_id_list) ++ return AVERROR(ENOMEM); ++ /* 'to' item ids */ ++ for (i = 0; i < entries; i++) ++ c->tile_id_list[i] = avio_rb16(pb); ++ c->nb_tiles = entries; ++ return 0; ++} ++ ++static int mov_read_ispe(MOVContext *c, AVIOContext *pb, MOVAtom atom) ++{ ++ uint32_t width, height; ++ avio_rb32(pb); /* version and flags */ ++ width = avio_rb32(pb); ++ height = avio_rb32(pb); ++ ++ for (int i = 0; i < c->nb_items; i++) { ++ if (c->item_list[i].item_id == c->cur_item_id) { ++ c->item_list[i].width = width; ++ c->item_list[i].height = height; ++ break; ++ } ++ } ++ return 0; ++} ++ ++static int mov_read_irot(MOVContext *c, AVIOContext *pb, MOVAtom atom) ++{ ++ if (c->cur_item_id != c->primary_item_id) ++ return 0; ++ c->primary_rot = - (90 * (avio_r8(pb) & 0x3)); ++ return 0; ++} ++ ++static int mov_read_iprp(MOVContext *c, AVIOContext *pb, MOVAtom atom) ++{ ++ typedef struct AtomPos { ++ int64_t pos, size; ++ } AtomPos; ++ AtomPos *atoms = NULL; ++ int nb_atoms = 0; ++ int version, flags; ++ unsigned count, i, j; ++ int64_t old_pos, ret = 0; ++ MOVAtom a; ++ ++ if (!c->fc->nb_streams) { ++ av_log(c->fc, AV_LOG_ERROR, "hdlr box not found\n"); ++ return AVERROR_INVALIDDATA; ++ } ++ ++ a.size = avio_rb32(pb); ++ a.type = avio_rl32(pb); ++ ++ if (a.size < 8 || a.type != MKTAG('i','p','c','o')) ++ return AVERROR_INVALIDDATA; ++ a.size -= 8; ++ ++ while (a.size >= 8) { ++ AtomPos *ref = av_dynarray2_add((void**)&atoms, &nb_atoms, sizeof(AtomPos), NULL); ++ if (!ref) { ++ ret = AVERROR(ENOMEM); ++ goto fail; ++ } ++ ref->pos = avio_tell(pb); ++ ref->size = avio_rb32(pb); ++ if (ref->size > a.size || ref->size < 8) ++ break; ++ if ((ret = avio_seek(pb, ref->pos + ref->size, SEEK_SET)) < 0) ++ goto fail; ++ a.size -= ref->size; ++ } ++ ++ if (a.size) { ++ ret = AVERROR_INVALIDDATA; ++ goto fail; ++ } ++ ++ a.size = avio_rb32(pb); ++ a.type = avio_rl32(pb); ++ ++ if (a.size < 8 || a.type != MKTAG('i','p','m','a')) { ++ ret = AVERROR_INVALIDDATA; ++ goto fail; ++ } ++ ++ version = avio_r8(pb); ++ flags = avio_rb24(pb); ++ count = avio_rb32(pb); ++ ++ for (i = 0; i < count; i++) { ++ int item_id = (version >= 1) ? avio_rb32(pb) : avio_rb16(pb); ++ int assoc_count = avio_r8(pb); ++ ++ for (j = 0; j < assoc_count; j++) { ++ MOVAtom parentAtom; ++ AtomPos *atom; ++ int index = avio_r8(pb) & 0x7f; ++ if (flags & 1) { ++ index <<= 8; ++ index |= avio_r8(pb); ++ } ++ if (index > nb_atoms || index <= 0) { ++ ret = AVERROR_INVALIDDATA; ++ goto fail; ++ } ++ ++ atom = &atoms[--index]; ++ c->cur_item_id = item_id; ++ parentAtom = (MOVAtom){ .size = atom->size, .type = MKTAG('i','p','c','o') }; ++ ++ old_pos = avio_tell(pb); ++ if ((ret = avio_seek(pb, atom->pos, SEEK_SET)) < 0) ++ goto fail; ++ if ((ret = mov_read_default(c, pb, parentAtom)) < 0) ++ goto fail; ++ if ((ret = avio_seek(pb, old_pos, SEEK_SET)) < 0) ++ goto fail; ++ } ++ } ++ ret = 0; ++ ++fail: ++ av_free(atoms); ++ return ret; ++} ++ ++static int mov_read_idat(MOVContext *c, AVIOContext *pb, MOVAtom atom) ++{ ++ c->idat_offset = avio_tell(pb); ++ return 0; ++} ++ ++static int read_image_grid(MOVContext *c, AVIOContext *pb) { ++ uint8_t flags; ++ avio_r8(pb); /* version */ ++ flags = avio_r8(pb); ++ c->grid_rows = avio_r8(pb) + 1; ++ c->grid_cols = avio_r8(pb) + 1; ++ /* actual width and height of output image */ ++ c->output_width = (flags & 1) ? avio_rb32(pb) : avio_rb16(pb); ++ c->output_height = (flags & 1) ? avio_rb32(pb) : avio_rb16(pb); ++ return 0; ++} ++ + static int mov_read_iloc(MOVContext *c, AVIOContext *pb, MOVAtom atom) + { + int version, offset_size, length_size, base_offset_size, index_size; +@@ -8619,6 +8865,9 @@ static int mov_read_header(AVFormatContext *s) + + mov->fc = s; + mov->trak_index = -1; ++ mov->grid_item_id = -1; ++ mov->primary_item_id = -1; ++ + /* .mov and .mp4 aren't streamable anyway (only progressive download if moov is before mdat) */ + if (pb->seekable & AVIO_SEEKABLE_NORMAL) + atom.size = avio_size(pb); +@@ -8633,13 +8882,106 @@ static int mov_read_header(AVFormatContext *s) + av_log(s, AV_LOG_ERROR, "error reading header\n"); + return err; + } +- } while ((pb->seekable & AVIO_SEEKABLE_NORMAL) && !mov->found_moov && !mov->moov_retry++); +- if (!mov->found_moov) { ++ } while ((pb->seekable & AVIO_SEEKABLE_NORMAL) && !mov->found_moov && !mov->found_iloc && !mov->moov_retry++); ++ if (!mov->found_moov && !mov->found_iloc) { + av_log(s, AV_LOG_ERROR, "moov atom not found\n"); + return AVERROR_INVALIDDATA; + } + av_log(mov->fc, AV_LOG_TRACE, "on_parse_exit_offset=%"PRId64"\n", avio_tell(pb)); + ++ if (mov->found_iloc) { ++ /* For HEIF/HEIC pictures */ ++ AVStream *st = s->streams[s->nb_streams-1]; ++ MOVStreamContext *sc = st->priv_data; ++ int i, j, ret; ++ ++ if (mov->nb_tiles) { ++ ++ for (i = 0; i < mov->nb_tiles; i++) { ++ int tile_id = mov->tile_id_list[i]; ++ for (j = 0; j < mov->nb_items; j++) { ++ HEICItem *item = &mov->item_list[j]; ++ if (item->item_id == tile_id) { ++ if (item->is_idat_relative) ++ item->pos += mov->idat_offset; ++ if (add_index_entry(st, item->pos, i, item->size, 0, AVINDEX_KEYFRAME) < 0) ++ return AVERROR(ENOMEM); ++ if (!mov->tile_width || !mov->tile_height) { ++ mov->tile_width = item->width; ++ mov->tile_height = item->height; ++ } ++ break; ++ } ++ } ++ } ++ ++ for (i = 0; i < mov->nb_items; i++) { ++ HEICItem *item = &mov->item_list[i]; ++ if (item->item_id == mov->grid_item_id) { ++ if (item->is_idat_relative) ++ item->pos += mov->idat_offset; ++ if ((ret = avio_seek(pb, item->pos, SEEK_SET)) < 0) ++ return ret; ++ if ((ret = read_image_grid(mov, pb)) < 0) ++ return ret; ++ break; ++ } ++ } ++ ++ av_log(s, AV_LOG_INFO, "tile res %dx%d, grid res %dx%d, output res %dx%d\n", ++ mov->tile_width, mov->tile_height, mov->tile_width * mov->grid_cols, ++ mov->tile_height * mov->grid_rows, mov->output_width, mov->output_height); ++ ++ } else { ++ for (i = 0; i < mov->nb_items; i++) { ++ HEICItem *item = &mov->item_list[i]; ++ if (item->item_id == mov->primary_item_id) { ++ if (item->is_idat_relative) ++ item->pos += mov->idat_offset; ++ if (add_index_entry(st, item->pos, i, item->size, 0, AVINDEX_KEYFRAME) < 0) ++ return AVERROR(ENOMEM); ++ break; ++ } ++ } ++ } ++ ++ if (mov->nb_tiles && !mov->disable_avformat_decoding) { ++ const AVCodec *codec = avcodec_find_decoder(st->codecpar->codec_id); ++ mov->dec_ctx = avcodec_alloc_context3(codec); ++ if (!mov->dec_ctx) ++ return AVERROR(ENOMEM); ++ ret = avcodec_parameters_to_context(mov->dec_ctx, st->codecpar); ++ if (ret < 0) ++ return ret; ++ ret = avcodec_open2(mov->dec_ctx, codec, NULL); ++ if (ret < 0) { ++ av_log(s, AV_LOG_ERROR, "Error opening codec\n"); ++ return ret; ++ } ++ ++ if (mov->primary_rot) { ++ sc->display_matrix = av_malloc(sizeof(int32_t) * 9); ++ if (!sc->display_matrix) ++ return AVERROR(ENOMEM); ++ av_display_rotation_set(sc->display_matrix, mov->primary_rot); ++ } ++ ++ st->codecpar->width = mov->output_width; ++ st->codecpar->height = mov->output_height; ++ st->codecpar->format = AV_PIX_FMT_YUV420P; ++ st->codecpar->color_range = AVCOL_RANGE_JPEG; ++ st->codecpar->codec_id = AV_CODEC_ID_RAWVIDEO; ++ st->codecpar->codec_tag = 0; ++ } else if (!mov->nb_tiles) { ++ if (mov->primary_rot) { ++ sc->display_matrix = av_malloc(sizeof(int32_t) * 9); ++ if (!sc->display_matrix) ++ return AVERROR(ENOMEM); ++ av_display_rotation_set(sc->display_matrix, mov->primary_rot); ++ } ++ } ++ } ++ + if (pb->seekable & AVIO_SEEKABLE_NORMAL) { + if (mov->nb_chapter_tracks > 0 && !mov->ignore_chapters) + mov_read_chapters(s); +@@ -8926,6 +9268,98 @@ static int get_eia608_packet(AVIOContext *pb, AVPacket *pkt, int size) + return 0; + } + ++static int heic_decode_tile(MOVContext *c, AVPacket *pkt, int index) ++{ ++ const AVPixFmtDescriptor *desc; ++ unsigned plane, nb_planes = 0; ++ int ret; ++ ++ if (!c->tile) c->tile = av_frame_alloc(); ++ ++ ret = avcodec_send_packet(c->dec_ctx, pkt); ++ if (ret < 0) { ++ av_log(c->fc, AV_LOG_ERROR, "Error sending tile for decoding\n"); ++ return ret; ++ } ++ ++ ret = avcodec_receive_frame(c->dec_ctx, c->tile); ++ if (ret < 0) { ++ av_log(c->fc, AV_LOG_ERROR, "Error decoding tile\n"); ++ return ret; ++ } ++ ++ if (c->tile->format != AV_PIX_FMT_YUVJ420P && ++ c->tile->format != AV_PIX_FMT_YUV420P) { ++ avpriv_request_sample(c->fc, ++ "Unsupported pixel format '%d' for direct decoding heif/heic tiles", c->tile->format); ++ return AVERROR_PATCHWELCOME; ++ } ++ ++ if (!c->frame) { ++ c->frame = av_frame_alloc(); ++ av_frame_copy_props(c->frame, c->tile); ++ c->frame->width = c->tile_width * c->grid_cols; ++ c->frame->height = c->tile_height * c->grid_rows; ++ c->frame->format = c->tile->format; ++ ret = av_frame_get_buffer(c->frame, 1); ++ if (ret < 0) ++ return ret; ++ } ++ ++ desc = av_pix_fmt_desc_get(c->frame->format); ++ nb_planes = av_pix_fmt_count_planes(c->frame->format); ++ ++ for (plane = 0; plane < nb_planes; plane++) { ++ uint8_t *p, *q; ++ unsigned x, y, line, wp, hp; ++ hp = plane == 1 || plane == 2 ? ++ AV_CEIL_RSHIFT(c->tile->height, desc->log2_chroma_h) ++ : c->tile->height; ++ wp = plane == 1 || plane == 2 ? ++ AV_CEIL_RSHIFT(c->tile->width, desc->log2_chroma_w) ++ : c->tile->width; ++ x = (index % c->grid_cols) * wp; ++ y = (index / c->grid_cols) * hp; ++ p = &c->tile ->data[plane][0]; ++ q = &c->frame->data[plane][y * c->frame->linesize[plane] + x]; ++ for (line = 0; line < hp; line++) { ++ memcpy(q, p, wp); ++ p += c->tile ->linesize[plane]; ++ q += c->frame->linesize[plane]; ++ } ++ } ++ ++ return 0; ++} ++ ++static int heic_copy_frame_to_buffer(MOVContext *c, AVPacket *pkt, AVFrame *frame) ++{ ++ unsigned grid_width = c->tile_width * c->grid_cols; ++ unsigned grid_height = c->tile_height * c->grid_rows; ++ unsigned size; ++ int ret; ++ ++ frame->crop_right = grid_width - c->output_width; ++ frame->crop_bottom = grid_height - c->output_height; ++ av_frame_apply_cropping(frame, 0); ++ ++ size = av_image_get_buffer_size(frame->format, frame->width, ++ frame->height, 1); ++ ++ ret = av_new_packet(pkt, size); ++ if (ret < 0) ++ return ret; ++ ++ ret = av_image_copy_to_buffer(pkt->data, size, ++ (const uint8_t **)frame->data, ++ frame->linesize, frame->format, ++ frame->width, frame->height, 1); ++ if (ret < 0) ++ return ret; ++ ++ return size; ++} ++ + static int mov_read_packet(AVFormatContext *s, AVPacket *pkt) + { + MOVContext *mov = s->priv_data; +@@ -8978,6 +9412,47 @@ static int mov_read_packet(AVFormatContext *s, AVPacket *pkt) + current_index = sc->current_index; + mov_current_sample_inc(sc); + ++ if (mov->nb_tiles && !mov->disable_avformat_decoding) { ++ AVPacket avpkt; ++ ++ int64_t ret64 = avio_seek(sc->pb, sample->pos, SEEK_SET); ++ if (ret64 != sample->pos) { ++ av_log(mov->fc, AV_LOG_ERROR, "stream %d, offset 0x%"PRIx64": partial file\n", ++ sc->ffindex, sample->pos); ++ return AVERROR_INVALIDDATA; ++ } ++ ++ ret = av_get_packet(sc->pb, &avpkt, sample->size); ++ if (ret < 0) ++ return ret; ++ ++ ret = heic_decode_tile(mov, &avpkt, current_index); ++ av_packet_unref(&avpkt); ++ ++ if (ret < 0) ++ return ret; ++ ++ if (current_index == mov->nb_tiles-1) ++ return heic_copy_frame_to_buffer(mov, pkt, mov->frame); ++ ++ return 0; ++ } ++ ++ if (mov->nb_tiles) { ++ const uint32_t tile_info[8] = { current_index, mov->nb_tiles, ++ mov->grid_rows, mov->grid_cols, ++ mov->tile_width, mov->tile_height, ++ mov->output_width, mov->output_height }; ++ uint8_t *sd = av_packet_new_side_data(pkt, AV_PKT_DATA_TILE_INFO, sizeof(tile_info)); ++ if (!sd) ++ return AVERROR(ENOMEM); ++ memcpy(sd, tile_info, sizeof(tile_info)); ++ ++ av_log(mov->fc, AV_LOG_INFO, "frame %ld, tile %ld of %ld in row %ld\n", ++ (current_index+1), (current_index % mov->grid_cols)+1, (long)mov->grid_cols, ++ (current_index / mov->grid_cols)+1); ++ } ++ + if (mov->next_root_atom) { + sample->pos = FFMIN(sample->pos, mov->next_root_atom); + sample->size = FFMIN(sample->size, (mov->next_root_atom - sample->pos)); +@@ -9361,11 +9836,11 @@ static const AVClass mov_class = { + }; + + const AVInputFormat ff_mov_demuxer = { +- .name = "mov,mp4,m4a,3gp,3g2,mj2", ++ .name = "mov,mp4,m4a,3gp,3g2,mj2,heic,heif", + .long_name = NULL_IF_CONFIG_SMALL("QuickTime / MOV"), + .priv_class = &mov_class, + .priv_data_size = sizeof(MOVContext), +- .extensions = "mov,mp4,m4a,3gp,3g2,mj2,psp,m4b,ism,ismv,isma,f4v,avif", ++ .extensions = "mov,mp4,m4a,3gp,3g2,mj2,psp,m4b,ism,ismv,isma,f4v,avif,heic,heif", + .flags_internal = FF_FMT_INIT_CLEANUP, + .read_probe = mov_probe, + .read_header = mov_read_header, +-- +2.39.3 (Apple Git-146) + diff --git a/patches/ffmpeg-n7.1.1/todo/0015-Adds-DVD-protocol-https-ffmpeg.org-pipermail-ffmpeg-.patch b/patches/ffmpeg-n7.1.1/todo/0015-Adds-DVD-protocol-https-ffmpeg.org-pipermail-ffmpeg-.patch new file mode 100644 index 000000000..7741710f9 --- /dev/null +++ b/patches/ffmpeg-n7.1.1/todo/0015-Adds-DVD-protocol-https-ffmpeg.org-pipermail-ffmpeg-.patch @@ -0,0 +1,519 @@ +From 8e39b2302f903277cf2d1e31726dd82823b1427e Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Mon, 22 Jul 2024 14:38:12 +0800 +Subject: [PATCH 15] Adds DVD protocol + (https://ffmpeg.org/pipermail/ffmpeg-devel/2022-January/290879.html) + +--- + configure | 5 + + libavformat/Makefile | 1 + + libavformat/dvd.c | 433 ++++++++++++++++++++++++++++++++++++++++ + libavformat/protocols.c | 2 + + 4 files changed, 441 insertions(+) + create mode 100644 libavformat/dvd.c + +diff --git a/configure b/configure +index a89cfa6..3f2fd2d 100755 +--- a/configure ++++ b/configure +@@ -218,6 +218,7 @@ External library support: + --enable-libass enable libass subtitles rendering, + needed for subtitles and ass filter [no] + --enable-libbluray enable BluRay reading using libbluray [no] ++ --enable-libdvdread enable DVD reading using libdvdread [no] + --enable-libbs2b enable bs2b DSP library [no] + --enable-libcaca enable textual display using libcaca [no] + --enable-libcelt enable CELT decoding via libcelt [no] +@@ -1852,6 +1853,7 @@ EXTERNAL_LIBRARY_LIST=" + libdav1d + libdc1394 + libdrm ++ libdvdread + libflite + libfontconfig + libfreetype +@@ -3615,6 +3617,7 @@ xv_outdev_deps="xlib_xv xlib_x11 xlib_xext" + # protocols + async_protocol_deps="threads" + bluray_protocol_deps="libbluray" ++dvd_protocol_deps="libdvdread" + ffrtmpcrypt_protocol_conflict="librtmp_protocol" + ffrtmpcrypt_protocol_deps_any="gcrypt gmp openssl mbedtls" + ffrtmpcrypt_protocol_select="tcp_protocol" +@@ -6694,6 +6697,8 @@ enabled libdav1d && require_pkg_config libdav1d "dav1d >= 0.5.0" "dav1d + enabled libdavs2 && require_pkg_config libdavs2 "davs2 >= 1.6.0" davs2.h davs2_decoder_open + enabled libdc1394 && require_pkg_config libdc1394 libdc1394-2 dc1394/dc1394.h dc1394_new + enabled libdrm && require_pkg_config libdrm libdrm xf86drm.h drmGetVersion ++enabled libdvdread && enable dvdread ++enabled dvdread && require_pkg_config libdvdread dvdread "dvdread/dvd_reader.h" DVDOpen2 + enabled libfdk_aac && { check_pkg_config libfdk_aac fdk-aac "fdk-aac/aacenc_lib.h" aacEncOpen || + { require libfdk_aac fdk-aac/aacenc_lib.h aacEncOpen -lfdk-aac && + warn "using libfdk without pkg-config"; } } +diff --git a/libavformat/Makefile b/libavformat/Makefile +index 586aacd..dfcec9f 100644 +--- a/libavformat/Makefile ++++ b/libavformat/Makefile +@@ -668,6 +668,7 @@ OBJS-$(CONFIG_CONCAT_PROTOCOL) += concat.o + OBJS-$(CONFIG_CONCATF_PROTOCOL) += concat.o + OBJS-$(CONFIG_CRYPTO_PROTOCOL) += crypto.o + OBJS-$(CONFIG_DATA_PROTOCOL) += data_uri.o ++OBJS-$(CONFIG_DVD_PROTOCOL) += dvd.o + OBJS-$(CONFIG_FFRTMPCRYPT_PROTOCOL) += rtmpcrypt.o rtmpdigest.o rtmpdh.o + OBJS-$(CONFIG_FFRTMPHTTP_PROTOCOL) += rtmphttp.o + OBJS-$(CONFIG_FILE_PROTOCOL) += file.o +diff --git a/libavformat/dvd.c b/libavformat/dvd.c +new file mode 100644 +index 0000000..4f79064 +--- /dev/null ++++ b/libavformat/dvd.c +@@ -0,0 +1,433 @@ ++/* ++ * DVD (libdvdread) protocol ++ * Copyright (c) 2023 Stan Ionascu ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#include ++#include ++#include ++ ++#include "libavformat/avformat.h" ++#include "libavformat/url.h" ++#include "libavutil/avstring.h" ++#include "libavutil/opt.h" ++ ++#define DVD_PROTO_PREFIX "dvd:" ++#define DVD_SECTOR_SIZE 2048 ++ ++typedef struct ++{ ++ const AVClass *class; ++ ++ dvd_reader_t *dvd; ++ dvd_logger_cb dvd_logger; ++ ++ int title_nr; ++ int angle_nr; ++ dvd_file_t *dvd_title_file; ++ ifo_handle_t *vmg_ifo; ++ ifo_handle_t *vts_ifo; ++ pgc_t *current_pgc; ++ int current_cell; ++ ++ int start_sector; ++ int current_sector; ++ int end_sector; ++ ++ int duration; ++} DvdProtocolContext; ++ ++static int bcd2int(int bcd) ++{ ++ return (((bcd & 0xf0) >> 4) * 10 + (bcd & 0x0f)); ++} ++ ++static void dvd_logger_ff(void *opaque, dvd_logger_level_t dvd_level, const char *fmt, va_list args) ++{ ++ int level = AV_LOG_TRACE; ++ if (dvd_level == DVD_LOGGER_LEVEL_ERROR) ++ { ++ level = AV_LOG_ERROR; ++ } ++ else if (dvd_level == DVD_LOGGER_LEVEL_WARN) ++ { ++ level = AV_LOG_WARNING; ++ } ++ else if (dvd_level == DVD_LOGGER_LEVEL_INFO) ++ { ++ level = AV_LOG_INFO; ++ } ++ else if (dvd_level == DVD_LOGGER_LEVEL_DEBUG) ++ { ++ level = AV_LOG_DEBUG; ++ } ++ av_vlog(opaque, level, fmt, args); ++ /* add new line */ ++ av_log(opaque, level, "\n"); ++} ++ ++static int ff_dvd_get_title_set_length(ifo_handle_t *vts_ifo, tt_srpt_t *tt_srpt, int title_nr) ++{ ++ /* reindex 1 => 0 */ ++ int vts_title_number = tt_srpt->title[title_nr].vts_ttn - 1; ++ int pgc_number = vts_ifo->vts_ptt_srpt->title[vts_title_number].ptt[0].pgcn; ++ dvd_time_t *playback_time = &vts_ifo->vts_pgcit->pgci_srp[pgc_number - 1].pgc->playback_time; ++ ++ return (bcd2int(playback_time->hour) * 3600 + ++ bcd2int(playback_time->minute) * 60 + ++ bcd2int(playback_time->second)) * ++ 1000; ++} ++ ++static void ff_dvd_set_program_chain_info(DvdProtocolContext *ctx, int title_nr, int ptt_nr) ++{ ++ /* reindex 1 => 0 */ ++ int vts_title_number = ctx->vmg_ifo->tt_srpt->title[title_nr].vts_ttn - 1; ++ ptt_info_t *ptt = &ctx->vts_ifo->vts_ptt_srpt->title[vts_title_number].ptt[ptt_nr]; ++ int pgc_id = ptt->pgcn; ++ int pgn = ptt->pgn; ++ ++ ctx->current_pgc = ctx->vts_ifo->vts_pgcit->pgci_srp[pgc_id - 1].pgc; ++ ctx->current_cell = ctx->current_pgc->program_map[pgn - 1] - 1; ++ ++ /* change angle */ ++ if (ctx->current_pgc->cell_playback[ctx->current_cell].block_type == BLOCK_TYPE_ANGLE_BLOCK) ++ { ++ ctx->current_cell += ctx->angle_nr; ++ } ++ ++ ctx->current_sector = ctx->start_sector = ctx->current_pgc->cell_playback[ctx->current_cell].first_sector; ++ ctx->end_sector = ctx->current_pgc->cell_playback[ctx->current_cell].last_sector; ++} ++ ++static int ff_dvd_get_next_cell(DvdProtocolContext *ctx) ++{ ++ int next_cell = ctx->current_cell; ++ ++ /* fast-forward until last-cell */ ++ if (ctx->current_pgc->cell_playback[next_cell].block_type == BLOCK_TYPE_ANGLE_BLOCK) ++ { ++ ctx->current_cell += ctx->angle_nr; ++ while (next_cell < ctx->current_pgc->nr_of_cells && ++ ctx->current_pgc->cell_playback[next_cell].block_type != BLOCK_MODE_LAST_CELL) ++ { ++ next_cell++; ++ } ++ } ++ ++ /* take next cell */ ++ next_cell++; ++ if (next_cell >= ctx->current_pgc->nr_of_cells) ++ { ++ return -1; ++ } ++ ++ return next_cell; ++} ++ ++static int dvd_url_close(URLContext *h) ++{ ++ DvdProtocolContext *ctx = h->priv_data; ++ ifoClose(ctx->vts_ifo); ++ ifoClose(ctx->vmg_ifo); ++ DVDCloseFile(ctx->dvd_title_file); ++ DVDClose(ctx->dvd); ++ return 0; ++} ++ ++static int dvd_url_open(URLContext *h, const char *path, int flags) ++{ ++ DvdProtocolContext *ctx = h->priv_data; ++ const char *dvd_path = path; ++ ifo_handle_t *vmg_ifo, *vts_ifo; ++ tt_srpt_t *tt_srpt; ++ int num_vts, num_titles; ++ int longest_title_nr; ++ int64_t longest_title_length_ms = 0; ++ int vts_nr; ++ int title_set_nr; ++ char disc_volume_id[32]; ++ ++ ctx->vmg_ifo = ctx->vts_ifo = NULL; ++ ctx->dvd_logger.pf_log = &dvd_logger_ff; ++ ++ /* strip protocol from path */ ++ av_strstart(path, DVD_PROTO_PREFIX, &dvd_path); ++ ++ /* open dvd folder or disc */ ++ if ((ctx->dvd = DVDOpen2(h, &ctx->dvd_logger, dvd_path)) == NULL) ++ { ++ av_log(h, AV_LOG_ERROR, "DVDOpen(%s) failed\n", dvd_path); ++ return AVERROR(EIO); ++ } ++ ++ if (DVDUDFVolumeInfo(ctx->dvd, &disc_volume_id[0], 32, NULL, 0) == 0) ++ { ++ av_log(h, AV_LOG_INFO, "opened disc-volume-id: %s\n", disc_volume_id); ++ } ++ ++ /* read toc */ ++ if ((vmg_ifo = ifoOpen(ctx->dvd, 0)) == NULL) ++ { ++ av_log(h, AV_LOG_ERROR, "ifoOpen(0) failed\n"); ++ return AVERROR(EIO); ++ } ++ ++ /* read titles */ ++ num_vts = vmg_ifo->vts_atrt->nr_of_vtss; ++ num_titles = vmg_ifo->tt_srpt->nr_of_srpts; ++ av_log(h, AV_LOG_INFO, "there are %d usable titles\n", num_titles); ++ ++ /* get title-set info(s) */ ++ tt_srpt = vmg_ifo->tt_srpt; ++ if (ctx->title_nr >= num_titles) ++ { ++ av_log(h, AV_LOG_ERROR, "invalid title id %d\n", ctx->title_nr); ++ return AVERROR(EINVAL); ++ } ++ ++ for (vts_nr = 1; vts_nr <= num_vts; vts_nr++) ++ { ++ int title_nr; ++ for (title_nr = 0; title_nr < num_titles; title_nr++) ++ { ++ int title_length_ms; ++ ++ if (tt_srpt->title[title_nr].title_set_nr != vts_nr) ++ { ++ continue; ++ } ++ ++ /* describe the title(s) info */ ++ if ((vts_ifo = ifoOpen(ctx->dvd, vts_nr)) == NULL) ++ { ++ av_log(h, AV_LOG_ERROR, "ifoOpen(%d) failed\n", title_nr); ++ return AVERROR(ENOMEM); ++ } ++ ++ /* skip if video title set or program chain info is missing */ ++ if (vts_ifo->vtsi_mat == NULL || vts_ifo->vts_pgcit == NULL) ++ { ++ ifoClose(vts_ifo); ++ av_log(h, AV_LOG_TRACE, "skip title %d as no vts or pgc info is present\n", ++ title_nr); ++ continue; ++ } ++ ++ /* skip if vts_ttn is incorrect */ ++ if (tt_srpt->title[title_nr].vts_ttn < 1 || ++ tt_srpt->title[title_nr].vts_ttn > num_titles) ++ { ++ ifoClose(vts_ifo); ++ av_log(h, AV_LOG_WARNING, "skip title %d as vts_ttn is out of bounds\n", ++ title_nr); ++ continue; ++ } ++ ++ title_length_ms = ff_dvd_get_title_set_length(vts_ifo, tt_srpt, title_nr); ++ av_log(h, AV_LOG_INFO, "title %03d : (%d:%02d:%02d) and %d chapter(s)\n", ++ title_nr, ++ (title_length_ms / 3600000), ++ (title_length_ms % 3600000) / 60000, ++ (title_length_ms % 60000) / 1000, ++ tt_srpt->title[title_nr].nr_of_ptts); ++ ++ if (longest_title_length_ms <= title_length_ms) ++ { ++ longest_title_nr = title_nr; ++ longest_title_length_ms = title_length_ms; ++ } ++ ++ ifoClose(vts_ifo); ++ } ++ } ++ ++ if (ctx->title_nr < 0) ++ { ++ ctx->title_nr = longest_title_nr; ++ ctx->duration = longest_title_length_ms; ++ } ++ ++ av_log(NULL, AV_LOG_ERROR, "dvd dvd_url_open %lld\n", ctx->duration); ++ ++ /* check if title selection is valid */ ++ if (tt_srpt->title[ctx->title_nr].vts_ttn < 1 || ++ tt_srpt->title[ctx->title_nr].vts_ttn > num_titles) ++ { ++ av_log(h, AV_LOG_INFO, "selected title %d is not valid, vts_ttn is out of bounds\n", ++ ctx->title_nr); ++ ifoClose(vmg_ifo); ++ return AVERROR(EIO); ++ } ++ ++ av_log(h, AV_LOG_INFO, "selected title %d\n", ctx->title_nr); ++ ++ if (ctx->angle_nr > 0 && ctx->angle_nr >= tt_srpt->title[ctx->title_nr].nr_of_angles) ++ { ++ av_log(h, AV_LOG_ERROR, "incorrect angle selected %d out of %d angle(s)\n", ++ ctx->angle_nr, ++ tt_srpt->title[ctx->title_nr].nr_of_angles); ++ } ++ ++ /* open request title_set info */ ++ title_set_nr = tt_srpt->title[ctx->title_nr].title_set_nr; ++ if ((vts_ifo = ifoOpen(ctx->dvd, title_set_nr)) == NULL) ++ { ++ av_log(h, AV_LOG_INFO, "ifoOpen(%d) failed\n", title_set_nr); ++ return AVERROR(ENOMEM); ++ } ++ ++ /* open file */ ++ if ((ctx->dvd_title_file = DVDOpenFile(ctx->dvd, title_set_nr, DVD_READ_TITLE_VOBS)) == NULL) ++ { ++ av_log(h, AV_LOG_ERROR, "DVDOpenFile(%d) failed\n", title_set_nr); ++ return AVERROR(EIO); ++ } ++ ++ ctx->vmg_ifo = vmg_ifo; ++ ctx->vts_ifo = vts_ifo; ++ ++ ff_dvd_set_program_chain_info(ctx, ctx->title_nr, 0); ++ ++ //ifo_print(ctx->dvd, title_set_nr); ++ return 0; ++} ++ ++static int dvd_url_read(URLContext *h, unsigned char *buf, int size) ++{ ++ DvdProtocolContext *ctx = h->priv_data; ++ ssize_t blocks_got; ++ int num_blocks = size / DVD_SECTOR_SIZE; ++ ++ //av_log(h, AV_LOG_ERROR, "dvd_url_read start/current/end sector:%lld/%lld/%lld\n", ctx->start_sector, ctx->current_sector, ctx->end_sector); ++ if (ctx->current_sector >= ctx->end_sector) ++ { ++ int next_cell = ff_dvd_get_next_cell(ctx); ++ if (next_cell < 0) ++ { ++ return AVERROR_EOF; ++ } ++ ++ ctx->current_cell = next_cell; ++ ctx->start_sector = ctx->current_pgc->cell_playback[ctx->current_cell].first_sector; ++ ctx->end_sector = ctx->current_pgc->cell_playback[ctx->current_cell].last_sector; ++ ctx->current_sector = ctx->start_sector; ++ ++ av_log(h, AV_LOG_ERROR, "dvd_url_read reset to cell:%lld\n", ctx->current_cell); ++ av_log(h, AV_LOG_ERROR, "dvd_url_read reset start/current/end sector:%lld/%lld/%lld\n", ctx->start_sector, ctx->current_sector, ctx->end_sector); ++ } ++ ++ /* read all sectors that fit into buf */ ++ blocks_got = DVDReadBlocks(ctx->dvd_title_file, ctx->current_sector, num_blocks, buf); ++ if (blocks_got <= 0) ++ { ++ av_log(h, AV_LOG_ERROR, "failed to DVDReadBlocks() %d blocks at offset %d\n", ++ num_blocks, ctx->current_sector); ++ return AVERROR(EIO); ++ } ++ ctx->current_sector += blocks_got; ++ return blocks_got <= 0 ? AVERROR_EOF : blocks_got * DVD_SECTOR_SIZE; ++} ++ ++static int64_t dvd_url_seek(URLContext *h, int64_t pos, int whence) ++{ ++ DvdProtocolContext *ctx = h->priv_data; ++ if (!ctx || !ctx->dvd) ++ { ++ return AVERROR(EFAULT); ++ } ++ ++ switch (whence) ++ { ++ case SEEK_SET: ++ case SEEK_CUR: ++ case SEEK_END: ++ { ++ int32_t blocks = pos / DVD_SECTOR_SIZE; ++ av_log(h, AV_LOG_ERROR, "dvd seek blocks: %ld\n", blocks); ++ ++ int sum = 0; ++ cell_playback_t *cell_playback = ctx->current_pgc->cell_playback; ++ int i; ++ for (i = 0; i < ctx->current_pgc->nr_of_cells; i++) ++ { ++ int this_sector = cell_playback[i].last_sector - cell_playback[i].first_sector; ++ if (this_sector + sum > blocks) ++ { ++ break; ++ } ++ sum += this_sector; ++ } ++ if (i >= ctx->current_pgc->nr_of_cells) ++ { ++ i = ctx->current_pgc->nr_of_cells - 1; ++ } ++ ctx->current_cell = i; ++ ctx->start_sector = cell_playback[i].first_sector; ++ ctx->end_sector = cell_playback[i].last_sector; ++ ctx->current_sector = ctx->start_sector + (blocks - sum); ++ ++ av_log(h, AV_LOG_ERROR, "dvd_url_read seek to cell:%lld\n", ctx->current_cell); ++ av_log(h, AV_LOG_ERROR, "dvd_url_read seek start/current/end sector:%lld/%lld/%lld\n", ctx->start_sector, ctx->current_sector, ctx->end_sector); ++ ++ return DVDFileSeek(ctx->dvd_title_file, pos); ++ } ++ case AVSEEK_SIZE: ++ { ++ int64_t sum = 0; ++ cell_playback_t *cell_playback = ctx->current_pgc->cell_playback; ++ for (int i = 0; i < ctx->current_pgc->nr_of_cells; i++) ++ { ++ sum += cell_playback[i].last_sector - cell_playback[i].first_sector; ++ } ++ // 1534280 ++ // int64_t size = DVDFileSize(ctx->dvd_title_file) * DVD_SECTOR_SIZE; ++ int64_t size = sum * DVD_SECTOR_SIZE; ++ av_log(h, AV_LOG_ERROR, "dvd total blocks: %lld\n", sum); ++ return size; ++ } ++ } ++ ++ av_log(h, AV_LOG_ERROR, "dvd Unsupported whence operation %d\n", whence); ++ return AVERROR(EINVAL); ++} ++ ++#define OFFSET(x) offsetof(DvdProtocolContext, x) ++static const AVOption options[] = { ++ {"title", "", OFFSET(title_nr), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 9999, AV_OPT_FLAG_DECODING_PARAM}, ++ {"angle", "", OFFSET(angle_nr), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 256, AV_OPT_FLAG_DECODING_PARAM}, ++ {NULL}, ++}; ++static const AVClass dvd_context_class = { ++ .class_name = "dvd", ++ .item_name = av_default_item_name, ++ .option = options, ++ .version = LIBAVUTIL_VERSION_INT, ++}; ++ ++const URLProtocol ff_dvd_protocol = { ++ .name = "dvd", ++ .url_close = dvd_url_close, ++ .url_open = dvd_url_open, ++ .url_read = dvd_url_read, ++ .url_seek = dvd_url_seek, ++ .priv_data_size = sizeof(DvdProtocolContext), ++ .priv_data_class = &dvd_context_class, ++ .default_whitelist = "dvd" ++}; +\ No newline at end of file +diff --git a/libavformat/protocols.c b/libavformat/protocols.c +index fd64780..73df344 100644 +--- a/libavformat/protocols.c ++++ b/libavformat/protocols.c +@@ -84,6 +84,8 @@ extern const URLProtocol ff_ijksegment_protocol; + extern const URLProtocol ff_ijktcphook_protocol; + extern const URLProtocol ff_ijkio_protocol; + ++extern const URLProtocol ff_dvd_protocol; ++ + #include "libavformat/protocol_list.c" + + const AVClass *ff_urlcontext_child_class_iterate(void **iter) +-- +2.39.3 (Apple Git-146) + diff --git a/patches/ffmpeg-n7.1.1/todo/0042-Adapt-to-clang-16.patch b/patches/ffmpeg-n7.1.1/todo/0042-Adapt-to-clang-16.patch new file mode 100644 index 000000000..a1c792743 --- /dev/null +++ b/patches/ffmpeg-n7.1.1/todo/0042-Adapt-to-clang-16.patch @@ -0,0 +1,31 @@ +From 338d6fb305a992bc2a24347e4d7793e02b54345d Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Thu, 31 Oct 2024 10:55:33 +0800 +Subject: [PATCH 21] Adapt to clang 16 + +--- + configure | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/configure b/configure +index 16d0177..edbb925 100755 +--- a/configure ++++ b/configure +@@ -5623,7 +5623,13 @@ case $target_os in + enabled x86_32 && append SHFLAGS -Wl,-read_only_relocs,suppress + strip="${strip} -x" + add_ldflags -Wl,-dynamic,-search_paths_first +- check_cflags -Werror=partial-availability ++ # https://gitlab.gnome.org/GNOME/gimp/-/issues/8649 ++ # from clang 15 int <-> pointer conversions now defaults as an error ++ check_cflags -Wno-int-conversion ++ # from clang 16 VTPixelTransferSessionCreate' has been marked as being introduced in tvOS 16.0 here, but the deployment target is tvOS 12.0.0 ++ check_cflags -Wno-unguarded-availability -Wno-unguarded-availability-new ++ ++ # check_cflags -Werror=partial-availability + SLIBSUF=".dylib" + SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)' + SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)' +-- +2.39.5 (Apple Git-154) + From a06fe219f0d613e7ed0ca1436ce15f663e111396 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Thu, 29 May 2025 14:40:10 +0800 Subject: [PATCH 038/359] fix syntax error #8 --- do-init/copy-local-repo.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/do-init/copy-local-repo.sh b/do-init/copy-local-repo.sh index 702fd7b37..adf91b041 100755 --- a/do-init/copy-local-repo.sh +++ b/do-init/copy-local-repo.sh @@ -26,7 +26,7 @@ function main() { local dest_repo=$2 cd $src_repo - local full_src_repo_path="file://$(PWD)" + local full_src_repo_path="file://$(pwd)" cd - >/dev/null if [[ -d $dest_repo ]]; then From 7f8aa25e9d61fc1b15811bdeef16bd7a6af7bf1f Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Thu, 29 May 2025 15:03:14 +0800 Subject: [PATCH 039/359] add libdvdnav --- README.md | 54 +++++++++++++++-------------- configs/libs/dvdnav.sh | 45 ++++++++++++++++++++++++ do-compile/apple/dvdnav.sh | 70 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 143 insertions(+), 26 deletions(-) create mode 100644 configs/libs/dvdnav.sh create mode 100755 do-compile/apple/dvdnav.sh diff --git a/README.md b/README.md index c286b0695..435bbaecf 100644 --- a/README.md +++ b/README.md @@ -6,16 +6,16 @@ MRFFToolChain products was built for [fsplayer](https://github.com/debugly/fsplayer) 、 [ijkplayer](https://github.com/debugly/ijkplayer) 、[FFmpegTutorial](https://github.com/debugly/FFmpegTutorial). -At present MRFFToolChain contained `ass、bluray、dav1d、dvdread、ffmpeg、freetype、fribidi、harfbuzz、openssl、opus、unibreak、uavs3d、smb2、yuv、soundtouch、xml2`. +At present MRFFToolChain contained `ass、bluray、dav1d、dvdread、dvdnav、ffmpeg、freetype、fribidi、harfbuzz、openssl、opus、unibreak、uavs3d、smb2、yuv、soundtouch、xml2`. ## Supported Plat -| platform | architectures | minimum deployment target | -| ----- | --------------------------------------|---------------------------- | -| iOS | arm64、arm64_simulator、x86_64_simulator | 11.0 | -| tvOS | arm64、arm64_simulator、x86_64_simulator | 12.0 | -| macOS | arm64、x86_64 | 10.11 | -| Android | arm64、armv7a、x86_64、x86 | 21 | +| platform | architectures | minimum deployment target | +| -------- | -------------------------------------- | ------------------------- | +| iOS | arm64、arm64_simulator、x86_64_simulator | 11.0 | +| tvOS | arm64、arm64_simulator、x86_64_simulator | 12.0 | +| macOS | arm64、x86_64 | 10.11 | +| Android | arm64、armv7a、x86_64、x86 | 21 | ## News @@ -33,6 +33,7 @@ At present MRFFToolChain contained `ass、bluray、dav1d、dvdread、ffmpeg、fr - Ass for Android: harfbuzz,fribidi,unibreak,fontconfig - FFmpeg for Appple: openssl,opus,dav1d,dvdread,uavs3d,smb2 - FFmpeg for Android: openssl,opus,dav1d,dvdread,uavs3d,smb2,soundtouch +- FFmpeg7 for Appple: openssl,opus,dav1d,dvdread,dvdnav,uavs3d,smb2 Tips: @@ -113,25 +114,26 @@ The order of these parameters does not matter; they can be arranged in any seque If cloning repositories from GitHub is slow, or if you need to use an internal private repository, you can declare the corresponding environment variables before running the compilation script! -| Lib Name | Current Version | Repository URL | Mirror Repository URL | -| ----------- | -------| ------------------------------------------------------- | -------------------------------------------------------- | -| FFmpeg | 6.1.2 | https://github.com/FFmpeg/FFmpeg.git | export GIT_FFMPEG_UPSTREAM = git@xx:yy/FFmpeg.git | -| ass | 0.17.3 | https://github.com/libass/libass.git | export GIT_ASS_UPSTREAM = git@xx:yy/libass.git | -| bluray | 1.3.4 | https://code.videolan.org/videolan/libbluray.git | export GIT_BLURAY_UPSTREAM = git@xx:yy/libbluray.git | -| dav1d | 1.5.1 | https://code.videolan.org/videolan/dav1d.git | export GIT_DAV1D_UPSTREAM = git@xx:yy/dav1d.git | -| dvdread | 6.1.3 | https://code.videolan.org/videolan/libdvdread.git | export GIT_DVDREAD_UPSTREAM = git@xx:yy/libdvdread.git | -| fontconfig | 2.16.0 | https://gitlab.freedesktop.org/fontconfig/fontconfig.git| export GIT_FONTCONFIG_UPSTREAM=git@xx:yy/fontconfig.git | -| freetype | 2.13.3 | https://gitlab.freedesktop.org/freetype/freetype.git | export GIT_FREETYPE_UPSTREAM = git@xx:yy/freetype.git | -| fribidi | 1.0.16 | https://github.com/fribidi/fribidi.git | export GIT_FRIBIDI_UPSTREAM = git@xx:yy/fribidi.git | -| harfbuzz | 10.2.0 | https://github.com/harfbuzz/harfbuzz.git | export GIT_HARFBUZZ_UPSTREAM = git@xx:yy/harfbuzz.git | -| openssl | 1.1.1w | https://github.com/openssl/openssl.git | export GIT_OPENSSL_UPSTREAM = git@xx:yy/openssl.git | -| opus | 1.5.2 | https://gitlab.xiph.org/xiph/opus.git | export GIT_OPUS_UPSTREAM = git@xx:yy/opus.git | -| smb2 | 6.2 | https://github.com/sahlberg/libsmb2.git | export GIT_SMB2_UPSTREAM=git@xx:yy/libsmb2.git | -| soundtouch | 2.3.3 | https://codeberg.org/soundtouch/soundtouch.git | export GIT_SOUNDTOUCH_UPSTREAM=git@xx:yy/soundtouch.git | -| unibreak | 6.1 | https://github.com/adah1972/libunibreak.git | export GIT_UNIBREAK_UPSTREAM = git@xx:yy/libunibreak.git | -| uavs3d | 1.2.1 | https://github.com/uavs3/uavs3d.git | export GIT_UAVS3D_UPSTREAM=git@xx:yy/UAVS3D.git | -| xml2 | 2.13.6 | https://github.com/GNOME/libxml2.git | export GIT_FONTCONFIG_UPSTREAM=git@xx:yy/fontconfig.git | -| yuv | stable-eb6e7bb | https://github.com/debugly/libyuv.git | export GIT_YUV_UPSTREAM=git@xx:yy/yuv.git | +| Lib Name | Current Version | Repository URL | Mirror Repository URL | +| ---------- | --------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| FFmpeg | 6.1.2 | https://github.com/FFmpeg/FFmpeg.git | export GIT_FFMPEG_UPSTREAM = git@xx:yy/FFmpeg.git | +| ass | 0.17.3 | https://github.com/libass/libass.git | export GIT_ASS_UPSTREAM = git@xx:yy/libass.git | +| bluray | 1.3.4 | https://code.videolan.org/videolan/libbluray.git | export GIT_BLURAY_UPSTREAM = git@xx:yy/libbluray.git | +| dav1d | 1.5.1 | https://code.videolan.org/videolan/dav1d.git | export GIT_DAV1D_UPSTREAM = git@xx:yy/dav1d.git | +| dvdread | 6.1.3 | https://code.videolan.org/videolan/libdvdread.git | export GIT_DVDREAD_UPSTREAM = git@xx:yy/libdvdread.git | +| dvdnav | master-9831fe01 | https://code.videolan.org/videolan/libdvdnav.git | export GIT_DVDNAV_UPSTREAM = git@xx:yy/libdvdnav.git | +| fontconfig | 2.16.0 | https://gitlab.freedesktop.org/fontconfig/fontconfig.git | export GIT_FONTCONFIG_UPSTREAM=git@xx:yy/fontconfig.git | +| freetype | 2.13.3 | https://gitlab.freedesktop.org/freetype/freetype.git | export GIT_FREETYPE_UPSTREAM = git@xx:yy/freetype.git | +| fribidi | 1.0.16 | https://github.com/fribidi/fribidi.git | export GIT_FRIBIDI_UPSTREAM = git@xx:yy/fribidi.git | +| harfbuzz | 10.2.0 | https://github.com/harfbuzz/harfbuzz.git | export GIT_HARFBUZZ_UPSTREAM = git@xx:yy/harfbuzz.git | +| openssl | 1.1.1w | https://github.com/openssl/openssl.git | export GIT_OPENSSL_UPSTREAM = git@xx:yy/openssl.git | +| opus | 1.5.2 | https://gitlab.xiph.org/xiph/opus.git | export GIT_OPUS_UPSTREAM = git@xx:yy/opus.git | +| smb2 | 6.2 | https://github.com/sahlberg/libsmb2.git | export GIT_SMB2_UPSTREAM=git@xx:yy/libsmb2.git | +| soundtouch | 2.3.3 | https://codeberg.org/soundtouch/soundtouch.git | export GIT_SOUNDTOUCH_UPSTREAM=git@xx:yy/soundtouch.git | +| unibreak | 6.1 | https://github.com/adah1972/libunibreak.git | export GIT_UNIBREAK_UPSTREAM = git@xx:yy/libunibreak.git | +| uavs3d | 1.2.1 | https://github.com/uavs3/uavs3d.git | export GIT_UAVS3D_UPSTREAM=git@xx:yy/UAVS3D.git | +| xml2 | 2.13.6 | https://github.com/GNOME/libxml2.git | export GIT_FONTCONFIG_UPSTREAM=git@xx:yy/fontconfig.git | +| yuv | stable-eb6e7bb | https://github.com/debugly/libyuv.git | export GIT_YUV_UPSTREAM=git@xx:yy/yuv.git | ## Tips diff --git a/configs/libs/dvdnav.sh b/configs/libs/dvdnav.sh new file mode 100644 index 000000000..c036524c5 --- /dev/null +++ b/configs/libs/dvdnav.sh @@ -0,0 +1,45 @@ +#! /usr/bin/env bash +# +# Copyright (C) 2021 Matt Reach + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# +# +# brew install nasm +# If you really want to compile without asm, configure with --disable-asm. + +# LIB_DEPENDS_BIN using string because bash can't export array chttps://stackoverflow.com/questions/5564418/exporting-an-array-in-bash-script +# configure: error: Package requirements (openssl) were not met + +export LIB_NAME='dvdnav' +export LIPO_LIBS="libdvdnav" +export LIB_DEPENDS_BIN="automake autoconf libtool" +export REPO_DIR=dvdnav +export GIT_LOCAL_REPO=extra/$REPO_DIR +export GIT_COMMIT=9831fe01 +export GIT_REPO_VERSION=9831fe01 + +# you can export GIT_DVDNAV_UPSTREAM=git@xx:yy/opusfile.git use your mirror +if [[ "$GIT_DVDNAV_UPSTREAM" != "" ]] ;then + export GIT_UPSTREAM="$GIT_DVDNAV_UPSTREAM" +else + export GIT_UPSTREAM=https://code.videolan.org/videolan/libdvdnav.git +fi + +# pre compiled +export PRE_COMPILE_TAG= +export PRE_COMPILE_TAG_TVOS= +export PRE_COMPILE_TAG_MACOS= +export PRE_COMPILE_TAG_IOS= +export PRE_COMPILE_TAG_ANDROID= diff --git a/do-compile/apple/dvdnav.sh b/do-compile/apple/dvdnav.sh new file mode 100755 index 000000000..88ba20b0a --- /dev/null +++ b/do-compile/apple/dvdnav.sh @@ -0,0 +1,70 @@ +#! /usr/bin/env bash +# +# Copyright (C) 2021 Matt Reach + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +set -e + +THIS_DIR=$(DIRNAME=$(dirname "$0"); cd "$DIRNAME"; pwd) +cd "$THIS_DIR" + +# prepare build config +CFG_FLAGS="--prefix=$MR_BUILD_PREFIX --disable-dependency-tracking --disable-silent-rules --disable-apidoc --enable-static --disable-shared" +CFLAGS="$MR_DEFAULT_CFLAGS" + +if [[ "$MR_DEBUG" == "debug" ]];then + CFG_FLAGS="${CFG_FLAGS} use_examples=yes" +fi + +# for cross compile +if [[ $(uname -m) != "$MR_ARCH" || "$MR_FORCE_CROSS" ]];then + echo "[*] cross compile, on $(uname -m) compile $MR_PLAT $MR_ARCH." + # https://www.gnu.org/software/automake/manual/html_node/Cross_002dCompilation.html + CFLAGS="$CFLAGS -isysroot $MR_SYS_ROOT" + CFG_FLAGS="$CFG_FLAGS --host=$MR_ARCH-apple-darwin --with-sysroot=$MR_SYS_ROOT" +fi + +echo "----------------------" +echo "[*] configurate $LIB_NAME" +echo "----------------------" + +cd $MR_BUILD_SOURCE + +if [[ -f 'configure' ]]; then + echo "reuse configure" +else + echo "auto generate configure" + autoreconf -if >/dev/null +fi + + +echo +echo "CC: $MR_CC" +echo "CFG_FLAGS: $CFG_FLAGS" +echo "CFLAGS: $CFLAGS" +echo + +./configure $CFG_FLAGS \ + CC="$MR_CC" \ + CFLAGS="$CFLAGS" \ + LDFLAGS="$CFLAGS" \ + >/dev/null + +#---------------------- +echo "----------------------" +echo "[*] compile $LIB_NAME" +echo "----------------------" + +make install -j$MR_HOST_NPROC >/dev/null \ No newline at end of file From 143c9741edc0b54c47b65c7f1823641074046b6e Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Thu, 29 May 2025 15:12:19 +0800 Subject: [PATCH 040/359] add dvdnav workflow --- .github/workflows/all.yml | 3 ++ .github/workflows/apple-android-common.yml | 7 +++-- .github/workflows/install-dependencies.sh | 34 +++++----------------- README.md | 6 ++-- 4 files changed, 17 insertions(+), 33 deletions(-) diff --git a/.github/workflows/all.yml b/.github/workflows/all.yml index 1ccbb9bf2..5377cdb91 100644 --- a/.github/workflows/all.yml +++ b/.github/workflows/all.yml @@ -92,6 +92,9 @@ jobs: echo '------compile dvdread------------------------------------' rm -rf build || git reset --hard || git pull origin .github/workflows/onestep.sh dvdread ${{ inputs.platform }} ${{ inputs.dryrun }} + echo '------compile dvdnav------------------------------------' + rm -rf build || git reset --hard || git pull origin + .github/workflows/onestep.sh dvdnav ${{ inputs.platform }} ${{ inputs.dryrun }} echo '------compile bluray------------------------------------' rm -rf build || git reset --hard || git pull origin .github/workflows/install-dependencies.sh bluray ${{ inputs.platform }} diff --git a/.github/workflows/apple-android-common.yml b/.github/workflows/apple-android-common.yml index 81f9a8e26..f57aca4b3 100644 --- a/.github/workflows/apple-android-common.yml +++ b/.github/workflows/apple-android-common.yml @@ -40,13 +40,14 @@ on: type: choice default: 'ffmpeg' options: + - ffmpeg + - ijkffmpeg + - fftutorial - ass - bluray - dav1d - dvdread - - ffmpeg - - ijkffmpeg - - fftutorial + - dvdnav - harfbuzz - fontconfig - freetype diff --git a/.github/workflows/install-dependencies.sh b/.github/workflows/install-dependencies.sh index 21e095538..9b1abe6c4 100755 --- a/.github/workflows/install-dependencies.sh +++ b/.github/workflows/install-dependencies.sh @@ -35,20 +35,16 @@ case $LIB_NAME in ./main.sh install -l 'xml2' -p $PLAT fi ;; - dav1d) - ;; - dvdread) - ;; ffmpeg) if [[ $PLAT == all ]];then - ./main.sh install -l 'openssl opus dav1d dvdread uavs3d smb2 bluray' -p ios - ./main.sh install -l 'openssl opus dav1d dvdread uavs3d smb2 bluray' -p tvos - ./main.sh install -l 'openssl opus dav1d dvdread uavs3d smb2 bluray' -p macos + ./main.sh install -l 'openssl opus dav1d dvdread dvdnav uavs3d smb2 bluray' -p ios + ./main.sh install -l 'openssl opus dav1d dvdread dvdnav uavs3d smb2 bluray' -p tvos + ./main.sh install -l 'openssl opus dav1d dvdread dvdnav uavs3d smb2 bluray' -p macos ./main.sh install -l 'openssl opus dav1d dvdread uavs3d smb2 bluray' -p android elif [[ $PLAT == apple ]];then - ./main.sh install -l 'openssl opus dav1d dvdread uavs3d smb2 bluray' -p ios - ./main.sh install -l 'openssl opus dav1d dvdread uavs3d smb2 bluray' -p tvos - ./main.sh install -l 'openssl opus dav1d dvdread uavs3d smb2 bluray' -p macos + ./main.sh install -l 'openssl opus dav1d dvdread dvdnav uavs3d smb2 bluray' -p ios + ./main.sh install -l 'openssl opus dav1d dvdread dvdnav uavs3d smb2 bluray' -p tvos + ./main.sh install -l 'openssl opus dav1d dvdread dvdnav uavs3d smb2 bluray' -p macos else ./main.sh install -l 'openssl opus dav1d dvdread uavs3d smb2 bluray' -p $PLAT fi @@ -112,22 +108,6 @@ case $LIB_NAME in ./main.sh install -p android -l 'freetype' fi ;; - freetype) - ;; - fribidi) - ;; - openssl) - ;; - opus) - ;; - smb2) - ;; - soundtouch) - ;; - uavs3d) - ;; - unibreak) - ;; - yuv) + *) ;; esac diff --git a/README.md b/README.md index 435bbaecf..d9c76f5e4 100644 --- a/README.md +++ b/README.md @@ -29,10 +29,10 @@ At present MRFFToolChain contained `ass、bluray、dav1d、dvdread、dvdnav、ff - Fontconfig: xml2,freetype - Bluray: xml2 - Harfbuzz: freetype -- Ass for Appple: harfbuzz,fribidi,unibreak +- Ass for Appple: harfbuzz,fribidi,unibreak - Ass for Android: harfbuzz,fribidi,unibreak,fontconfig -- FFmpeg for Appple: openssl,opus,dav1d,dvdread,uavs3d,smb2 -- FFmpeg for Android: openssl,opus,dav1d,dvdread,uavs3d,smb2,soundtouch +- FFmpeg for Appple: openssl,opus,dav1d,dvdread,uavs3d,smb2 +- FFmpeg for Android: openssl,opus,dav1d,dvdread,uavs3d,smb2 - FFmpeg7 for Appple: openssl,opus,dav1d,dvdread,dvdnav,uavs3d,smb2 Tips: From c790a1b87fe96d94388fb4bcad8fec1496e9682d Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Thu, 29 May 2025 15:21:57 +0800 Subject: [PATCH 041/359] dvdnav depends on dvdread --- .github/workflows/install-dependencies.sh | 19 +++++++++++-------- README.md | 3 ++- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/.github/workflows/install-dependencies.sh b/.github/workflows/install-dependencies.sh index 9b1abe6c4..5866fc8e5 100755 --- a/.github/workflows/install-dependencies.sh +++ b/.github/workflows/install-dependencies.sh @@ -37,16 +37,16 @@ case $LIB_NAME in ;; ffmpeg) if [[ $PLAT == all ]];then - ./main.sh install -l 'openssl opus dav1d dvdread dvdnav uavs3d smb2 bluray' -p ios - ./main.sh install -l 'openssl opus dav1d dvdread dvdnav uavs3d smb2 bluray' -p tvos - ./main.sh install -l 'openssl opus dav1d dvdread dvdnav uavs3d smb2 bluray' -p macos - ./main.sh install -l 'openssl opus dav1d dvdread uavs3d smb2 bluray' -p android + ./main.sh install -l 'openssl opus dav1d dvdnav uavs3d smb2 bluray' -p ios + ./main.sh install -l 'openssl opus dav1d dvdnav uavs3d smb2 bluray' -p tvos + ./main.sh install -l 'openssl opus dav1d dvdnav uavs3d smb2 bluray' -p macos + ./main.sh install -l 'openssl opus dav1d dvdnav uavs3d smb2 bluray' -p android elif [[ $PLAT == apple ]];then - ./main.sh install -l 'openssl opus dav1d dvdread dvdnav uavs3d smb2 bluray' -p ios - ./main.sh install -l 'openssl opus dav1d dvdread dvdnav uavs3d smb2 bluray' -p tvos - ./main.sh install -l 'openssl opus dav1d dvdread dvdnav uavs3d smb2 bluray' -p macos + ./main.sh install -l 'openssl opus dav1d dvdnav uavs3d smb2 bluray' -p ios + ./main.sh install -l 'openssl opus dav1d dvdnav uavs3d smb2 bluray' -p tvos + ./main.sh install -l 'openssl opus dav1d dvdnav uavs3d smb2 bluray' -p macos else - ./main.sh install -l 'openssl opus dav1d dvdread uavs3d smb2 bluray' -p $PLAT + ./main.sh install -l 'openssl opus dav1d dvdnav uavs3d smb2 bluray' -p $PLAT fi ;; ijkffmpeg) @@ -108,6 +108,9 @@ case $LIB_NAME in ./main.sh install -p android -l 'freetype' fi ;; + dvdnav) + ./main.sh install -l 'dvdread' -p $PLAT + ;; *) ;; esac diff --git a/README.md b/README.md index d9c76f5e4..3b499f13e 100644 --- a/README.md +++ b/README.md @@ -29,11 +29,12 @@ At present MRFFToolChain contained `ass、bluray、dav1d、dvdread、dvdnav、ff - Fontconfig: xml2,freetype - Bluray: xml2 - Harfbuzz: freetype +- dvdnav: dvdread - Ass for Appple: harfbuzz,fribidi,unibreak - Ass for Android: harfbuzz,fribidi,unibreak,fontconfig - FFmpeg for Appple: openssl,opus,dav1d,dvdread,uavs3d,smb2 - FFmpeg for Android: openssl,opus,dav1d,dvdread,uavs3d,smb2 -- FFmpeg7 for Appple: openssl,opus,dav1d,dvdread,dvdnav,uavs3d,smb2 +- FFmpeg7 for Appple: openssl,opus,dav1d,dvdnav,uavs3d,smb2 Tips: From c3c01c7d6b497b5d5752b4ab22b7e5d3e5e33073 Mon Sep 17 00:00:00 2001 From: Anka Date: Thu, 29 May 2025 07:24:52 +0000 Subject: [PATCH 042/359] upgrade dvdnav to dvdnav-9831fe01-250529152421 for macos by cd --- configs/libs/dvdnav.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/libs/dvdnav.sh b/configs/libs/dvdnav.sh index c036524c5..225ee675b 100644 --- a/configs/libs/dvdnav.sh +++ b/configs/libs/dvdnav.sh @@ -40,6 +40,6 @@ fi # pre compiled export PRE_COMPILE_TAG= export PRE_COMPILE_TAG_TVOS= -export PRE_COMPILE_TAG_MACOS= +export PRE_COMPILE_TAG_MACOS=dvdnav-9831fe01-250529152421 export PRE_COMPILE_TAG_IOS= export PRE_COMPILE_TAG_ANDROID= From c6e9ba7bcebcae2cd587b9647b1a994d893ab51d Mon Sep 17 00:00:00 2001 From: Anka Date: Thu, 29 May 2025 07:31:53 +0000 Subject: [PATCH 043/359] upgrade ffmpeg to ffmpeg-7.1.1-250529152651 for macos by cd --- configs/libs/ffmpeg.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/libs/ffmpeg.sh b/configs/libs/ffmpeg.sh index 44cb515c9..ffa77a390 100644 --- a/configs/libs/ffmpeg.sh +++ b/configs/libs/ffmpeg.sh @@ -42,7 +42,7 @@ fi # pre compiled export PRE_COMPILE_TAG=ffmpeg-6.1.2-250227145407 export PRE_COMPILE_TAG_TVOS=ffmpeg-6.1.1-250520112635 -export PRE_COMPILE_TAG_MACOS=ffmpeg-6.1.1-250520112635 +export PRE_COMPILE_TAG_MACOS=ffmpeg-7.1.1-250529152651 export PRE_COMPILE_TAG_IOS=ffmpeg-6.1.1-250520112635 export PRE_COMPILE_TAG_ANDROID=ffmpeg-6.1.2-250310113110 From 48e3b2cbdd036837dfc2fb984ef32cf46d0bc30a Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Fri, 30 May 2025 09:30:17 +0800 Subject: [PATCH 044/359] update patches --- configs/ffconfig/auto-detect-third-libs.sh | 1 - ...m-protocols-and-demuxers-except-lon.patch} | 57 ++++++++----------- .../0009-add-3-dummy-ijkhttp-protocols.patch | 23 ++++---- 3 files changed, 34 insertions(+), 47 deletions(-) rename patches/ffmpeg-n7.1.1/{0006-restore-ijk-custom-protocols-except-long-url.patch => 0006-restore-ijk-custom-protocols-and-demuxers-except-lon.patch} (88%) diff --git a/configs/ffconfig/auto-detect-third-libs.sh b/configs/ffconfig/auto-detect-third-libs.sh index 1ef361ab4..9964c5225 100644 --- a/configs/ffconfig/auto-detect-third-libs.sh +++ b/configs/ffconfig/auto-detect-third-libs.sh @@ -244,7 +244,6 @@ echo "----------------------" echo "[✅] --enable-parser=av3a" THIRD_CFG_FLAGS="$THIRD_CFG_FLAGS --enable-parser=av3a --enable-demuxer=av3a" -echo "----------------------" # -------------------------------------------------------------- THIRD_CFG_FLAGS="$THIRD_CFG_FLAGS --pkg-config-flags=--static" diff --git a/patches/ffmpeg-n7.1.1/0006-restore-ijk-custom-protocols-except-long-url.patch b/patches/ffmpeg-n7.1.1/0006-restore-ijk-custom-protocols-and-demuxers-except-lon.patch similarity index 88% rename from patches/ffmpeg-n7.1.1/0006-restore-ijk-custom-protocols-except-long-url.patch rename to patches/ffmpeg-n7.1.1/0006-restore-ijk-custom-protocols-and-demuxers-except-lon.patch index b41b51093..3be5228ee 100644 --- a/patches/ffmpeg-n7.1.1/0006-restore-ijk-custom-protocols-except-long-url.patch +++ b/patches/ffmpeg-n7.1.1/0006-restore-ijk-custom-protocols-and-demuxers-except-lon.patch @@ -1,19 +1,19 @@ -From fc20f37d242895412029521935804a96d9d0bf0c Mon Sep 17 00:00:00 2001 +From a8dc36d3060372153fe0cc93b2a9af3a50271aba Mon Sep 17 00:00:00 2001 From: qianlongxu -Date: Thu, 29 May 2025 10:57:48 +0800 -Subject: [PATCH] restore ijk custom protocols except long url +Date: Fri, 30 May 2025 09:15:11 +0800 +Subject: [PATCH] restore ijk custom protocols and demuxers except long url and + async --- libavcodec/Makefile | 1 + - libavformat/Makefile | 9 ++++ + libavformat/Makefile | 10 ++++ libavformat/allformats.c | 4 ++ - libavformat/async.c | 2 +- libavformat/demux.c | 13 +++++ libavformat/demux.h | 2 + - libavformat/ijkutils.c | 101 +++++++++++++++++++++++++++++++++++++++ + libavformat/ijkutils.c | 102 +++++++++++++++++++++++++++++++++++++++ libavformat/protocols.c | 6 +++ libavutil/Makefile | 1 + - 9 files changed, 138 insertions(+), 1 deletion(-) + 8 files changed, 139 insertions(+) create mode 100644 libavformat/ijkutils.c diff --git a/libavcodec/Makefile b/libavcodec/Makefile @@ -29,13 +29,14 @@ index a4fcce3..ed5c705 100644 OBJS = ac3_parser.o \ adts_parser.o \ diff --git a/libavformat/Makefile b/libavformat/Makefile -index e5934e9..359781b 100644 +index e5934e9..5e88060 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile -@@ -7,6 +7,14 @@ HEADERS = avformat.h \ +@@ -7,6 +7,15 @@ HEADERS = avformat.h \ version_major.h \ application.h \ dns_cache.h \ ++ demux.h \ + avc.h \ + url.h \ + internal.h \ @@ -47,7 +48,7 @@ index e5934e9..359781b 100644 OBJS = allformats.o \ avformat.o \ -@@ -34,6 +42,7 @@ OBJS = allformats.o \ +@@ -34,6 +43,7 @@ OBJS = allformats.o \ version.o \ application.o \ dns_cache.o \ @@ -70,19 +71,6 @@ index 305fa46..063be70 100644 #include "libavformat/muxer_list.c" #include "libavformat/demuxer_list.c" -diff --git a/libavformat/async.c b/libavformat/async.c -index e0329e2..e5ee519 100644 ---- a/libavformat/async.c -+++ b/libavformat/async.c -@@ -489,7 +489,7 @@ static const AVClass async_context_class = { - .version = LIBAVUTIL_VERSION_INT, - }; - --const URLProtocol ff_async_protocol = { -+URLProtocol ff_async_protocol = { - .name = "async", - .url_open2 = async_open, - .url_read = async_read, diff --git a/libavformat/demux.c b/libavformat/demux.c index 4fd22c4..ff62292 100644 --- a/libavformat/demux.c @@ -143,10 +131,10 @@ index 9c76095..8b0af4c 100644 * set. 'avformat_new_stream' can be called only if the flag diff --git a/libavformat/ijkutils.c b/libavformat/ijkutils.c new file mode 100644 -index 0000000..107b238 +index 0000000..42cc77c --- /dev/null +++ b/libavformat/ijkutils.c -@@ -0,0 +1,101 @@ +@@ -0,0 +1,102 @@ +/* + * utils.c + * @@ -172,7 +160,7 @@ index 0000000..107b238 + +#include +#include "url.h" -+#include "avformat.h" ++#include "demux.h" + + +#define IJK_FF_PROTOCOL(x) \ @@ -208,7 +196,6 @@ index 0000000..107b238 + return -1; +} + -+IJK_FF_PROTOCOL(async); +IJK_DUMMY_PROTOCOL(ijkmediadatasource); +IJK_DUMMY_PROTOCOL(ijkhttphook); +IJK_DUMMY_PROTOCOL(ijksegment); @@ -216,11 +203,11 @@ index 0000000..107b238 +IJK_DUMMY_PROTOCOL(ijkio); + +#define IJK_FF_DEMUXER(x) \ -+extern AVInputFormat ff_##x##_demuxer; \ -+int ijkav_register_##x##_demuxer(AVInputFormat *demuxer, int demuxer_size); \ -+int ijkav_register_##x##_demuxer(AVInputFormat *demuxer, int demuxer_size) \ ++extern FFInputFormat ff_##x##_demuxer; \ ++int ijkav_register_##x##_demuxer(FFInputFormat *demuxer, int demuxer_size); \ ++int ijkav_register_##x##_demuxer(FFInputFormat *demuxer, int demuxer_size) \ +{ \ -+ if (demuxer_size != sizeof(AVInputFormat)) { \ ++ if (demuxer_size != sizeof(FFInputFormat)) { \ + av_log(NULL, AV_LOG_ERROR, "ijkav_register_##x##_demuxer: ABI mismatch.\n"); \ + return -1; \ + } \ @@ -236,9 +223,11 @@ index 0000000..107b238 + .version = LIBAVUTIL_VERSION_INT, \ + }; \ + \ -+AVInputFormat ff_##x##_demuxer = { \ -+ .name = #x, \ -+ .priv_class = &ijk_##x##_demuxer_class, \ ++FFInputFormat ff_##x##_demuxer = { \ ++ .p.name = #x, \ ++ .p.priv_class = &ijk_##x##_demuxer_class, \ ++ .priv_data_size = 1, \ ++ .flags_internal = FF_INFMT_FLAG_INIT_CLEANUP, \ +}; + +/* diff --git a/patches/ffmpeg-n7.1.1/0009-add-3-dummy-ijkhttp-protocols.patch b/patches/ffmpeg-n7.1.1/0009-add-3-dummy-ijkhttp-protocols.patch index 3251c8be7..0828024d7 100644 --- a/patches/ffmpeg-n7.1.1/0009-add-3-dummy-ijkhttp-protocols.patch +++ b/patches/ffmpeg-n7.1.1/0009-add-3-dummy-ijkhttp-protocols.patch @@ -1,18 +1,18 @@ -From d49f164f790a3ed23e9701fa72e5720535bec901 Mon Sep 17 00:00:00 2001 +From 8fe7e70aa2feb98f199e1d3c91afb435f6db25aa Mon Sep 17 00:00:00 2001 From: qianlongxu -Date: Wed, 28 May 2025 18:23:51 +0800 +Date: Fri, 30 May 2025 09:24:42 +0800 Subject: [PATCH] add 3 dummy ijkhttp protocols --- libavformat/ijkutils.c | 3 +++ - libavformat/protocols.c | 4 ++++ - 2 files changed, 7 insertions(+) + libavformat/protocols.c | 3 +++ + 2 files changed, 6 insertions(+) diff --git a/libavformat/ijkutils.c b/libavformat/ijkutils.c -index 5999101..18b81af 100644 +index 604e725..2f36c69 100644 --- a/libavformat/ijkutils.c +++ b/libavformat/ijkutils.c -@@ -65,6 +65,9 @@ IJK_DUMMY_PROTOCOL(ijkhttphook); +@@ -64,6 +64,9 @@ IJK_DUMMY_PROTOCOL(ijkhttphook); IJK_DUMMY_PROTOCOL(ijksegment); IJK_DUMMY_PROTOCOL(ijktcphook); IJK_DUMMY_PROTOCOL(ijkio); @@ -21,22 +21,21 @@ index 5999101..18b81af 100644 +IJK_DUMMY_PROTOCOL(ijkhttp3); #define IJK_FF_DEMUXER(x) \ - extern AVInputFormat ff_##x##_demuxer; \ + extern FFInputFormat ff_##x##_demuxer; \ diff --git a/libavformat/protocols.c b/libavformat/protocols.c -index 719caf8..f5eb0db 100644 +index 719caf8..b291b9f 100644 --- a/libavformat/protocols.c +++ b/libavformat/protocols.c -@@ -85,6 +85,10 @@ extern const URLProtocol ff_ijksegment_protocol; +@@ -84,6 +84,9 @@ extern const URLProtocol ff_ijkmediadatasource_protocol; + extern const URLProtocol ff_ijksegment_protocol; extern const URLProtocol ff_ijktcphook_protocol; extern const URLProtocol ff_ijkio_protocol; - +extern const URLProtocol ff_ijkhttp1_protocol; +extern const URLProtocol ff_ijkhttp2_protocol; +extern const URLProtocol ff_ijkhttp3_protocol; -+ + #include "libavformat/protocol_list.c" - const AVClass *ff_urlcontext_child_class_iterate(void **iter) -- 2.39.5 (Apple Git-154) From f9d7baf5a71844559cbdbc6aaa37355d07bc99d6 Mon Sep 17 00:00:00 2001 From: Anka Date: Fri, 30 May 2025 01:36:50 +0000 Subject: [PATCH 045/359] upgrade ffmpeg to ffmpeg-7.1.1-250530093148 for macos by cd --- configs/libs/ffmpeg.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/libs/ffmpeg.sh b/configs/libs/ffmpeg.sh index ffa77a390..879ff9f25 100644 --- a/configs/libs/ffmpeg.sh +++ b/configs/libs/ffmpeg.sh @@ -42,7 +42,7 @@ fi # pre compiled export PRE_COMPILE_TAG=ffmpeg-6.1.2-250227145407 export PRE_COMPILE_TAG_TVOS=ffmpeg-6.1.1-250520112635 -export PRE_COMPILE_TAG_MACOS=ffmpeg-7.1.1-250529152651 +export PRE_COMPILE_TAG_MACOS=ffmpeg-7.1.1-250530093148 export PRE_COMPILE_TAG_IOS=ffmpeg-6.1.1-250520112635 export PRE_COMPILE_TAG_ANDROID=ffmpeg-6.1.2-250310113110 From e078d0c8166fc28a195ba8addedeb7a92ee6e2aa Mon Sep 17 00:00:00 2001 From: Anka Date: Tue, 3 Jun 2025 01:46:35 +0000 Subject: [PATCH 046/359] upgrade dvdnav to dvdnav-9831fe01-250603094547 for ios by cd --- configs/libs/dvdnav.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/libs/dvdnav.sh b/configs/libs/dvdnav.sh index 225ee675b..e0db0a54c 100644 --- a/configs/libs/dvdnav.sh +++ b/configs/libs/dvdnav.sh @@ -41,5 +41,5 @@ fi export PRE_COMPILE_TAG= export PRE_COMPILE_TAG_TVOS= export PRE_COMPILE_TAG_MACOS=dvdnav-9831fe01-250529152421 -export PRE_COMPILE_TAG_IOS= +export PRE_COMPILE_TAG_IOS=dvdnav-9831fe01-250603094547 export PRE_COMPILE_TAG_ANDROID= From 7f7cb1801a79df07752926b48bdc8cfc34e0cf9a Mon Sep 17 00:00:00 2001 From: Anka Date: Tue, 3 Jun 2025 01:49:48 +0000 Subject: [PATCH 047/359] upgrade dvdnav to dvdnav-9831fe01-250603094852 for tvos by cd --- configs/libs/dvdnav.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/libs/dvdnav.sh b/configs/libs/dvdnav.sh index e0db0a54c..ea80002be 100644 --- a/configs/libs/dvdnav.sh +++ b/configs/libs/dvdnav.sh @@ -39,7 +39,7 @@ fi # pre compiled export PRE_COMPILE_TAG= -export PRE_COMPILE_TAG_TVOS= +export PRE_COMPILE_TAG_TVOS=dvdnav-9831fe01-250603094852 export PRE_COMPILE_TAG_MACOS=dvdnav-9831fe01-250529152421 export PRE_COMPILE_TAG_IOS=dvdnav-9831fe01-250603094547 export PRE_COMPILE_TAG_ANDROID= From d0ca6f5b61c9e4c366b7bb8f87bd7e6528173fa0 Mon Sep 17 00:00:00 2001 From: Anka Date: Tue, 3 Jun 2025 01:58:28 +0000 Subject: [PATCH 048/359] upgrade ffmpeg to ffmpeg-7.1.1-250603095151 for ios by cd --- configs/libs/ffmpeg.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/libs/ffmpeg.sh b/configs/libs/ffmpeg.sh index 879ff9f25..4e66579f8 100644 --- a/configs/libs/ffmpeg.sh +++ b/configs/libs/ffmpeg.sh @@ -43,6 +43,6 @@ fi export PRE_COMPILE_TAG=ffmpeg-6.1.2-250227145407 export PRE_COMPILE_TAG_TVOS=ffmpeg-6.1.1-250520112635 export PRE_COMPILE_TAG_MACOS=ffmpeg-7.1.1-250530093148 -export PRE_COMPILE_TAG_IOS=ffmpeg-6.1.1-250520112635 +export PRE_COMPILE_TAG_IOS=ffmpeg-7.1.1-250603095151 export PRE_COMPILE_TAG_ANDROID=ffmpeg-6.1.2-250310113110 From 9712fa3dc57123bb234f17941b1b4bc572431d48 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Tue, 3 Jun 2025 10:00:49 +0800 Subject: [PATCH 049/359] FFmpeg 7.1.1 is already in use --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3b499f13e..495eb09fe 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ At present MRFFToolChain contained `ass、bluray、dav1d、dvdread、dvdnav、ff ## News +- FFmpeg 7.1.1 is already in use - upgrade all libs to lastest,Improved optimizations - using macOS 14, remove bitcode support @@ -117,7 +118,7 @@ If cloning repositories from GitHub is slow, or if you need to use an internal p | Lib Name | Current Version | Repository URL | Mirror Repository URL | | ---------- | --------------- | -------------------------------------------------------- | -------------------------------------------------------- | -| FFmpeg | 6.1.2 | https://github.com/FFmpeg/FFmpeg.git | export GIT_FFMPEG_UPSTREAM = git@xx:yy/FFmpeg.git | +| FFmpeg | 7.1.1 | https://github.com/FFmpeg/FFmpeg.git | export GIT_FFMPEG_UPSTREAM = git@xx:yy/FFmpeg.git | | ass | 0.17.3 | https://github.com/libass/libass.git | export GIT_ASS_UPSTREAM = git@xx:yy/libass.git | | bluray | 1.3.4 | https://code.videolan.org/videolan/libbluray.git | export GIT_BLURAY_UPSTREAM = git@xx:yy/libbluray.git | | dav1d | 1.5.1 | https://code.videolan.org/videolan/dav1d.git | export GIT_DAV1D_UPSTREAM = git@xx:yy/dav1d.git | From 8fc72a5a5f9cd03c5d2a4a1dae99f89ad2907118 Mon Sep 17 00:00:00 2001 From: Anka Date: Tue, 3 Jun 2025 02:09:15 +0000 Subject: [PATCH 050/359] upgrade ffmpeg to ffmpeg-7.1.1-250603100217 for tvos by cd --- configs/libs/ffmpeg.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/libs/ffmpeg.sh b/configs/libs/ffmpeg.sh index 4e66579f8..8acb90912 100644 --- a/configs/libs/ffmpeg.sh +++ b/configs/libs/ffmpeg.sh @@ -41,7 +41,7 @@ fi # pre compiled export PRE_COMPILE_TAG=ffmpeg-6.1.2-250227145407 -export PRE_COMPILE_TAG_TVOS=ffmpeg-6.1.1-250520112635 +export PRE_COMPILE_TAG_TVOS=ffmpeg-7.1.1-250603100217 export PRE_COMPILE_TAG_MACOS=ffmpeg-7.1.1-250530093148 export PRE_COMPILE_TAG_IOS=ffmpeg-7.1.1-250603095151 export PRE_COMPILE_TAG_ANDROID=ffmpeg-6.1.2-250310113110 From c5988f262e96d6643957501b32b3d02801c1e6ce Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Thu, 5 Jun 2025 15:31:45 +0800 Subject: [PATCH 051/359] openssl upgrade to 3.5.0 --- configs/libs/openssl3.sh | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 configs/libs/openssl3.sh diff --git a/configs/libs/openssl3.sh b/configs/libs/openssl3.sh new file mode 100644 index 000000000..74c3c85a0 --- /dev/null +++ b/configs/libs/openssl3.sh @@ -0,0 +1,37 @@ +#! /usr/bin/env bash +# +# Copyright (C) 2021 Matt Reach + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +export LIB_NAME='openssl' +export LIPO_LIBS="libssl libcrypto" +export GIT_LOCAL_REPO=extra/openssl +export GIT_COMMIT=openssl-3.5.0 +export REPO_DIR=openssl +export GIT_REPO_VERSION=3.5.0 + +# you can export GIT_OPUS_UPSTREAM=git@xx:yy/openssl.git use your mirror +if [[ "$GIT_OPENSSL_UPSTREAM" != "" ]] ;then + export GIT_UPSTREAM="$GIT_OPENSSL_UPSTREAM" +else + export GIT_UPSTREAM=https://github.com/openssl/openssl.git +fi + +# pre compiled +export PRE_COMPILE_TAG= +export PRE_COMPILE_TAG_TVOS= +export PRE_COMPILE_TAG_MACOS= +export PRE_COMPILE_TAG_IOS= +export PRE_COMPILE_TAG_ANDROID= From 29e91e092fa513881006c2c09f02b6f677a93254 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Thu, 5 Jun 2025 15:35:35 +0800 Subject: [PATCH 052/359] update workflow --- .github/workflows/all.yml | 4 ++-- .github/workflows/apple-android-common.yml | 1 + .github/workflows/install-dependencies.sh | 16 ++++++++-------- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.github/workflows/all.yml b/.github/workflows/all.yml index 5377cdb91..fd66f97dd 100644 --- a/.github/workflows/all.yml +++ b/.github/workflows/all.yml @@ -86,9 +86,9 @@ jobs: echo '------compile opus------------------------------------' rm -rf build || git reset --hard || git pull origin .github/workflows/onestep.sh opus ${{ inputs.platform }} ${{ inputs.dryrun }} - echo '------compile openssl------------------------------------' + echo '------compile openssl3------------------------------------' rm -rf build || git reset --hard || git pull origin - .github/workflows/onestep.sh openssl ${{ inputs.platform }} ${{ inputs.dryrun }} + .github/workflows/onestep.sh openssl3 ${{ inputs.platform }} ${{ inputs.dryrun }} echo '------compile dvdread------------------------------------' rm -rf build || git reset --hard || git pull origin .github/workflows/onestep.sh dvdread ${{ inputs.platform }} ${{ inputs.dryrun }} diff --git a/.github/workflows/apple-android-common.yml b/.github/workflows/apple-android-common.yml index f57aca4b3..bf040fb37 100644 --- a/.github/workflows/apple-android-common.yml +++ b/.github/workflows/apple-android-common.yml @@ -52,6 +52,7 @@ on: - fontconfig - freetype - fribidi + - openssl3 - openssl - opus - smb2 diff --git a/.github/workflows/install-dependencies.sh b/.github/workflows/install-dependencies.sh index 5866fc8e5..f5cbaa0d5 100755 --- a/.github/workflows/install-dependencies.sh +++ b/.github/workflows/install-dependencies.sh @@ -37,16 +37,16 @@ case $LIB_NAME in ;; ffmpeg) if [[ $PLAT == all ]];then - ./main.sh install -l 'openssl opus dav1d dvdnav uavs3d smb2 bluray' -p ios - ./main.sh install -l 'openssl opus dav1d dvdnav uavs3d smb2 bluray' -p tvos - ./main.sh install -l 'openssl opus dav1d dvdnav uavs3d smb2 bluray' -p macos - ./main.sh install -l 'openssl opus dav1d dvdnav uavs3d smb2 bluray' -p android + ./main.sh install -l 'openssl3 opus dav1d dvdnav uavs3d smb2 bluray' -p ios + ./main.sh install -l 'openssl3 opus dav1d dvdnav uavs3d smb2 bluray' -p tvos + ./main.sh install -l 'openssl3 opus dav1d dvdnav uavs3d smb2 bluray' -p macos + ./main.sh install -l 'openssl3 opus dav1d dvdnav uavs3d smb2 bluray' -p android elif [[ $PLAT == apple ]];then - ./main.sh install -l 'openssl opus dav1d dvdnav uavs3d smb2 bluray' -p ios - ./main.sh install -l 'openssl opus dav1d dvdnav uavs3d smb2 bluray' -p tvos - ./main.sh install -l 'openssl opus dav1d dvdnav uavs3d smb2 bluray' -p macos + ./main.sh install -l 'openssl3 opus dav1d dvdnav uavs3d smb2 bluray' -p ios + ./main.sh install -l 'openssl3 opus dav1d dvdnav uavs3d smb2 bluray' -p tvos + ./main.sh install -l 'openssl3 opus dav1d dvdnav uavs3d smb2 bluray' -p macos else - ./main.sh install -l 'openssl opus dav1d dvdnav uavs3d smb2 bluray' -p $PLAT + ./main.sh install -l 'openssl3 opus dav1d dvdnav uavs3d smb2 bluray' -p $PLAT fi ;; ijkffmpeg) From ef402b3be89be77c7b7fc16bbbad8846b6266236 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Thu, 5 Jun 2025 15:50:33 +0800 Subject: [PATCH 053/359] openssl not compile app, tvos failed: [apps/lib/libapps-lib-http_server.o] Error 1 --- do-compile/apple/openssl.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/do-compile/apple/openssl.sh b/do-compile/apple/openssl.sh index d2a0f0449..996b4ea00 100755 --- a/do-compile/apple/openssl.sh +++ b/do-compile/apple/openssl.sh @@ -42,7 +42,7 @@ echo "CROSS_TOP:$CROSS_TOP" echo "CROSS_SDK:$CROSS_SDK" # no-hw no-asm -CFG_FLAGS="no-shared no-engine no-dynamic-engine no-static-engine \ +CFG_FLAGS="no-shared no-engine no-apps no-dynamic-engine no-static-engine \ no-dso no-ui-console no-tests \ --prefix=$MR_BUILD_PREFIX \ --openssldir=$MR_BUILD_PREFIX \ From 4f2ccd7f6bbf68a0d38314bf743abf00dfcc089d Mon Sep 17 00:00:00 2001 From: Anka Date: Thu, 5 Jun 2025 08:01:00 +0000 Subject: [PATCH 054/359] upgrade openssl3 to openssl3-3.5.0-250605155209 for apple by cd --- configs/libs/openssl3.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configs/libs/openssl3.sh b/configs/libs/openssl3.sh index 74c3c85a0..aea82da3f 100644 --- a/configs/libs/openssl3.sh +++ b/configs/libs/openssl3.sh @@ -31,7 +31,7 @@ fi # pre compiled export PRE_COMPILE_TAG= -export PRE_COMPILE_TAG_TVOS= -export PRE_COMPILE_TAG_MACOS= -export PRE_COMPILE_TAG_IOS= +export PRE_COMPILE_TAG_TVOS=openssl3-3.5.0-250605155209 +export PRE_COMPILE_TAG_MACOS=openssl3-3.5.0-250605155209 +export PRE_COMPILE_TAG_IOS=openssl3-3.5.0-250605155209 export PRE_COMPILE_TAG_ANDROID= From b7b6da65966f9f5133b961241d617ebe8be2e454 Mon Sep 17 00:00:00 2001 From: Matt Reach Date: Thu, 5 Jun 2025 16:27:01 +0800 Subject: [PATCH 055/359] Update README.md --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 495eb09fe..aa3924ad6 100644 --- a/README.md +++ b/README.md @@ -33,9 +33,9 @@ At present MRFFToolChain contained `ass、bluray、dav1d、dvdread、dvdnav、ff - dvdnav: dvdread - Ass for Appple: harfbuzz,fribidi,unibreak - Ass for Android: harfbuzz,fribidi,unibreak,fontconfig -- FFmpeg for Appple: openssl,opus,dav1d,dvdread,uavs3d,smb2 +- FFmpeg for Appple: openssl3,opus,dav1d,dvdread,uavs3d,smb2 - FFmpeg for Android: openssl,opus,dav1d,dvdread,uavs3d,smb2 -- FFmpeg7 for Appple: openssl,opus,dav1d,dvdnav,uavs3d,smb2 +- FFmpeg7 for Appple: openssl3,opus,dav1d,dvdnav,uavs3d,smb2 Tips: @@ -50,7 +50,6 @@ Tips: ## Download/Install Pre-compiled Libs Save yourself a great deal of time by directly downloading the pre-compiled libraries from GitHub. - These pre-compiled libraries already applied patches which in the patches directory. ```bash @@ -129,6 +128,7 @@ If cloning repositories from GitHub is slow, or if you need to use an internal p | fribidi | 1.0.16 | https://github.com/fribidi/fribidi.git | export GIT_FRIBIDI_UPSTREAM = git@xx:yy/fribidi.git | | harfbuzz | 10.2.0 | https://github.com/harfbuzz/harfbuzz.git | export GIT_HARFBUZZ_UPSTREAM = git@xx:yy/harfbuzz.git | | openssl | 1.1.1w | https://github.com/openssl/openssl.git | export GIT_OPENSSL_UPSTREAM = git@xx:yy/openssl.git | +| openssl3 | 3.5.0 | https://github.com/openssl/openssl.git | export GIT_OPENSSL_UPSTREAM = git@xx:yy/openssl.git | | opus | 1.5.2 | https://gitlab.xiph.org/xiph/opus.git | export GIT_OPUS_UPSTREAM = git@xx:yy/opus.git | | smb2 | 6.2 | https://github.com/sahlberg/libsmb2.git | export GIT_SMB2_UPSTREAM=git@xx:yy/libsmb2.git | | soundtouch | 2.3.3 | https://codeberg.org/soundtouch/soundtouch.git | export GIT_SOUNDTOUCH_UPSTREAM=git@xx:yy/soundtouch.git | @@ -151,4 +151,4 @@ Compiling third-party libraries is time-consuming. I aim to contribute to the op If you'd like to contribute to the open-source community, consider buying me a coffee to keep me energized. -![donate.jpg](https://i.postimg.cc/xdVqnBLp/IMG-7481.jpg) \ No newline at end of file +![donate.jpg](https://i.postimg.cc/xdVqnBLp/IMG-7481.jpg) From dc051f15ddf8dab9f6f03efc01f6226e8a2d7e88 Mon Sep 17 00:00:00 2001 From: Anka Date: Thu, 5 Jun 2025 09:08:36 +0000 Subject: [PATCH 056/359] upgrade ffmpeg to ffmpeg-7.1.1-250605164908 for apple by cd --- configs/libs/ffmpeg.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configs/libs/ffmpeg.sh b/configs/libs/ffmpeg.sh index 8acb90912..7cf8df4b1 100644 --- a/configs/libs/ffmpeg.sh +++ b/configs/libs/ffmpeg.sh @@ -41,8 +41,8 @@ fi # pre compiled export PRE_COMPILE_TAG=ffmpeg-6.1.2-250227145407 -export PRE_COMPILE_TAG_TVOS=ffmpeg-7.1.1-250603100217 -export PRE_COMPILE_TAG_MACOS=ffmpeg-7.1.1-250530093148 -export PRE_COMPILE_TAG_IOS=ffmpeg-7.1.1-250603095151 +export PRE_COMPILE_TAG_TVOS=ffmpeg-7.1.1-250605164908 +export PRE_COMPILE_TAG_MACOS=ffmpeg-7.1.1-250605164908 +export PRE_COMPILE_TAG_IOS=ffmpeg-7.1.1-250605164908 export PRE_COMPILE_TAG_ANDROID=ffmpeg-6.1.2-250310113110 From 3ab7df870f06cbe4f97dfe248421c7bbb61f00c0 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Thu, 5 Jun 2025 18:50:04 +0800 Subject: [PATCH 057/359] use PATCH_DIR specify patch dir --- configs/libs/bluray.sh | 1 + configs/libs/smb2.sh | 1 + configs/libs/soundtouch.sh | 1 + configs/libs/uavs3d.sh | 1 + configs/libs/yuv.sh | 1 + do-init/init-repo.sh | 5 +++-- 6 files changed, 8 insertions(+), 2 deletions(-) diff --git a/configs/libs/bluray.sh b/configs/libs/bluray.sh index 000ea02c5..43841a1f8 100644 --- a/configs/libs/bluray.sh +++ b/configs/libs/bluray.sh @@ -30,6 +30,7 @@ export GIT_COMMIT=1.3.4 export GIT_WITH_SUBMODULE=1 export REPO_DIR=bluray export GIT_REPO_VERSION=1.3.4 +export PATCH_DIR=bluray # you can export GIT_BLURAY_UPSTREAM=git@xx:yy/libbluray.git use your mirror if [[ "$GIT_BLURAY_UPSTREAM" != "" ]] ;then diff --git a/configs/libs/smb2.sh b/configs/libs/smb2.sh index db6f200bf..e8752866b 100644 --- a/configs/libs/smb2.sh +++ b/configs/libs/smb2.sh @@ -30,6 +30,7 @@ export GIT_LOCAL_REPO=extra/smb2 export GIT_COMMIT=libsmb2-6.2 export REPO_DIR=smb2 export GIT_REPO_VERSION=6.2 +export PATCH_DIR=smb2-6.2 # you can export GIT_SMB2_UPSTREAM=git@xx:yy/libsmb2.git use your mirror if [[ "$GIT_SMB2_UPSTREAM" != "" ]] ;then diff --git a/configs/libs/soundtouch.sh b/configs/libs/soundtouch.sh index a8409f14a..2893c1120 100644 --- a/configs/libs/soundtouch.sh +++ b/configs/libs/soundtouch.sh @@ -30,6 +30,7 @@ export GIT_LOCAL_REPO=extra/soundtouch export REPO_DIR=soundtouch export GIT_COMMIT=2.3.3 export GIT_REPO_VERSION=2.3.3 +export PATCH_DIR=soundtouch # you can export GIT_SOUNDTOUCH_UPSTREAM=git@xx:yy/soundtouch.git use your mirror if [[ "$GIT_SOUNDTOUCH_UPSTREAM" != "" ]] ;then diff --git a/configs/libs/uavs3d.sh b/configs/libs/uavs3d.sh index 768b72f6b..3cc62e698 100644 --- a/configs/libs/uavs3d.sh +++ b/configs/libs/uavs3d.sh @@ -28,6 +28,7 @@ export GIT_LOCAL_REPO=extra/uavs3d export GIT_COMMIT=1fd0491 export REPO_DIR=uavs3d export GIT_REPO_VERSION=1.2.1 +export PATCH_DIR=uavs3d # you can export GIT_UAVS3D_UPSTREAM=git@xx:yy/UAVS3D.git use your mirror if [[ "$GIT_UAVS3D_UPSTREAM" != "" ]] ;then diff --git a/configs/libs/yuv.sh b/configs/libs/yuv.sh index b3c7cb1f7..f766b4004 100644 --- a/configs/libs/yuv.sh +++ b/configs/libs/yuv.sh @@ -25,6 +25,7 @@ export GIT_LOCAL_REPO=extra/yuv export GIT_COMMIT=eb6e7bb export REPO_DIR=yuv export GIT_REPO_VERSION=stable-eb6e7bb +export PATCH_DIR=yuv # you can export GIT_YUV_UPSTREAM=git@xx:yy/yuv.git use your mirror if [[ "$GIT_YUV_UPSTREAM" != "" ]] ;then diff --git a/do-init/init-repo.sh b/do-init/init-repo.sh index 787377849..2a456e0b2 100755 --- a/do-init/init-repo.sh +++ b/do-init/init-repo.sh @@ -66,17 +66,18 @@ function pull_common() { } function apply_patches() { - if [[ "$SKIP_FFMPEG_PATHCHES" && $REPO_DIR == 'ffmpeg' ]]; then + if [[ "$SKIP_FFMPEG_PATHCHES" && $LIB_NAME == ffmpeg* ]]; then echo "⚠️ skip apply $REPO_DIR patches,because you set SKIP_FFMPEG_PATHCHES env." return fi local plat="$MR_PLAT" - local patch_dir="${THIS_DIR}/../patches/$REPO_DIR" + local patch_dir="${THIS_DIR}/../patches/$PATCH_DIR" if [[ -d "${patch_dir}_${plat}" ]]; then patch_dir="${patch_dir}_${plat}" fi + if [[ -d "$patch_dir" ]]; then echo echo "== Applying patches: $(basename $patch_dir) → $(basename $PWD) ==" From 382ef824e387e75a01e6acd7adcb67c346ac508b Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Thu, 5 Jun 2025 18:50:55 +0800 Subject: [PATCH 058/359] rm module.sh --- configs/ffconfig/module.sh | 1 - configs/ijk-ffmpeg-config/module.sh | 1 - do-compile/android/ffmpeg.sh | 2 +- do-compile/android/ijkffmpeg.sh | 2 +- do-compile/apple/ffmpeg.sh | 2 +- do-compile/apple/ijkffmpeg.sh | 2 +- 6 files changed, 4 insertions(+), 6 deletions(-) delete mode 120000 configs/ffconfig/module.sh delete mode 120000 configs/ijk-ffmpeg-config/module.sh diff --git a/configs/ffconfig/module.sh b/configs/ffconfig/module.sh deleted file mode 120000 index 7e9493d70..000000000 --- a/configs/ffconfig/module.sh +++ /dev/null @@ -1 +0,0 @@ -module-full.sh \ No newline at end of file diff --git a/configs/ijk-ffmpeg-config/module.sh b/configs/ijk-ffmpeg-config/module.sh deleted file mode 120000 index 0f16f539b..000000000 --- a/configs/ijk-ffmpeg-config/module.sh +++ /dev/null @@ -1 +0,0 @@ -module-lite.sh \ No newline at end of file diff --git a/do-compile/android/ffmpeg.sh b/do-compile/android/ffmpeg.sh index 28ab3cc3e..33e71e2f5 100755 --- a/do-compile/android/ffmpeg.sh +++ b/do-compile/android/ffmpeg.sh @@ -31,7 +31,7 @@ THIS_DIR=$(DIRNAME=$(dirname "$0"); cd "$DIRNAME"; pwd) cd "$THIS_DIR" # ffmpeg config options -source $MR_SHELL_CONFIGS_DIR/ffconfig/module.sh +source $MR_SHELL_CONFIGS_DIR/ffconfig/module-full.sh source $MR_SHELL_CONFIGS_DIR/ffconfig/auto-detect-third-libs.sh CFG_FLAGS= diff --git a/do-compile/android/ijkffmpeg.sh b/do-compile/android/ijkffmpeg.sh index 386e71148..9c3932c49 100755 --- a/do-compile/android/ijkffmpeg.sh +++ b/do-compile/android/ijkffmpeg.sh @@ -34,7 +34,7 @@ FFMPEG_CFG_FLAGS= FFMPEG_EXTRA_CFLAGS= export COMMON_FF_CFG_FLAGS= # use ijk ffmpeg config options -source $MR_SHELL_CONFIGS_DIR/ijk-ffmpeg-config/module.sh +source $MR_SHELL_CONFIGS_DIR/ijk-ffmpeg-config/module-lite.sh FFMPEG_CFG_FLAGS="$FFMPEG_CFG_FLAGS $COMMON_FF_CFG_FLAGS" # Advanced options (experts only): diff --git a/do-compile/apple/ffmpeg.sh b/do-compile/apple/ffmpeg.sh index 4fc825a78..6704cd81d 100755 --- a/do-compile/apple/ffmpeg.sh +++ b/do-compile/apple/ffmpeg.sh @@ -31,7 +31,7 @@ THIS_DIR=$(DIRNAME=$(dirname "$0"); cd "$DIRNAME"; pwd) cd "$THIS_DIR" # ffmpeg config options -source $MR_SHELL_CONFIGS_DIR/ffconfig/module.sh +source $MR_SHELL_CONFIGS_DIR/ffconfig/module-full.sh source $MR_SHELL_CONFIGS_DIR/ffconfig/auto-detect-third-libs.sh CFG_FLAGS= diff --git a/do-compile/apple/ijkffmpeg.sh b/do-compile/apple/ijkffmpeg.sh index 293a4b24f..676e70878 100755 --- a/do-compile/apple/ijkffmpeg.sh +++ b/do-compile/apple/ijkffmpeg.sh @@ -34,7 +34,7 @@ FFMPEG_CFG_FLAGS= FFMPEG_EXTRA_CFLAGS= export COMMON_FF_CFG_FLAGS= # use ijk ffmpeg config options -source $MR_SHELL_CONFIGS_DIR/ijk-ffmpeg-config/module.sh +source $MR_SHELL_CONFIGS_DIR/ijk-ffmpeg-config/module-lite.sh FFMPEG_CFG_FLAGS="$FFMPEG_CFG_FLAGS $COMMON_FF_CFG_FLAGS" # Advanced options (experts only): From b49db3440cc60809d007321228e3857c65a555ac Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Thu, 5 Jun 2025 18:51:24 +0800 Subject: [PATCH 059/359] =?UTF-8?q?add=20ffmpeg4=E3=80=815=E3=80=816?= =?UTF-8?q?=E3=80=817?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- configs/ffconfig/auto-detect-third-libs.sh | 86 +++++++++++++--------- configs/libs/ffmpeg4.sh | 47 ++++++++++++ configs/libs/ffmpeg5.sh | 47 ++++++++++++ configs/libs/ffmpeg6.sh | 48 ++++++++++++ configs/libs/{ffmpeg.sh => ffmpeg7.sh} | 6 +- do-compile/apple/ffmpeg.sh | 12 +-- 6 files changed, 203 insertions(+), 43 deletions(-) create mode 100644 configs/libs/ffmpeg4.sh create mode 100644 configs/libs/ffmpeg5.sh create mode 100644 configs/libs/ffmpeg6.sh rename configs/libs/{ffmpeg.sh => ffmpeg7.sh} (92%) diff --git a/configs/ffconfig/auto-detect-third-libs.sh b/configs/ffconfig/auto-detect-third-libs.sh index 9964c5225..6fbd337e2 100644 --- a/configs/ffconfig/auto-detect-third-libs.sh +++ b/configs/ffconfig/auto-detect-third-libs.sh @@ -22,6 +22,7 @@ # pkg-config --libs dav1d # pkg-config --cflags --libs libbluray + THIRD_CFG_FLAGS= # echo "----------------------" @@ -133,6 +134,21 @@ echo "----------------------" # FFmpeg 4.2 支持AV1、AVS2等格式 # dav1d由VideoLAN,VLC和FFmpeg联合开发,项目由AOM联盟赞助,和libaom相比,dav1d性能普遍提升100%,最高提升400% + +result=$(gt_or_equal "$GIT_REPO_VERSION" "4.2") +if [[ $result ]]; then + + pkg-config --libs dav1d --silence-errors >/dev/null && enable_dav1d=1 + + if [[ $enable_dav1d ]];then + echo "[✅] --enable-libdav1d : $(pkg-config --modversion dav1d)" + THIRD_CFG_FLAGS="$THIRD_CFG_FLAGS --enable-libdav1d --enable-decoder=libdav1d" + else + echo "[❌] --disable-libdav1d --disable-decoder=libdav1d" + fi + echo "----------------------" +fi + #从FFmpeg7.1.1开始支持硬解av1,苹果需要M3芯片 result=$(gt_or_equal "$GIT_REPO_VERSION" "7.1.1") if [[ $result ]]; then @@ -144,28 +160,25 @@ fi echo "----------------------" -pkg-config --libs dav1d --silence-errors >/dev/null && enable_dav1d=1 - -if [[ $enable_dav1d ]];then - echo "[✅] --enable-libdav1d : $(pkg-config --modversion dav1d)" - THIRD_CFG_FLAGS="$THIRD_CFG_FLAGS --enable-libdav1d --enable-decoder=libdav1d" -else - echo "[❌] --disable-libdav1d --disable-decoder=libdav1d" -fi +# 从6开始支持的 smb2 协议 +result=$(gt_or_equal "$GIT_REPO_VERSION" "6") +if [[ $result ]]; then + pkg-config --libs libsmb2 --silence-errors >/dev/null && enable_smb2=1 -echo "----------------------" + if [[ $enable_smb2 ]];then + echo "[✅] --enable-libsmb2 : $(pkg-config --modversion libsmb2)" + THIRD_CFG_FLAGS="$THIRD_CFG_FLAGS --enable-libsmb2 --enable-protocol=libsmb2" + else + echo "[❌] --disable-libsmb2 --disable-protocol=libsmb2" + fi -pkg-config --libs libsmb2 --silence-errors >/dev/null && enable_smb2=1 + echo "----------------------" -if [[ $enable_smb2 ]];then - echo "[✅] --enable-libsmb2 : $(pkg-config --modversion libsmb2)" - THIRD_CFG_FLAGS="$THIRD_CFG_FLAGS --enable-libsmb2 --enable-protocol=libsmb2" -else - echo "[❌] --disable-libsmb2 --disable-protocol=libsmb2" + echo "[✅] --enable-parser=av3a" + THIRD_CFG_FLAGS="$THIRD_CFG_FLAGS --enable-parser=av3a --enable-demuxer=av3a" + echo "----------------------" fi -echo "----------------------" - pkg-config --libs libbluray --silence-errors >/dev/null && enable_bluray=1 if [[ $enable_bluray ]];then @@ -174,6 +187,7 @@ if [[ $enable_bluray ]];then else echo "[❌] --disable-libbluray --disable-protocol=bluray" fi + echo "----------------------" #不确定7代之前的版本是否支持dvdvideo @@ -188,29 +202,35 @@ if [[ $result ]]; then else echo "[❌] --disable-dvdvideo" fi + echo "----------------------" else - pkg-config --libs dvdread --silence-errors >/dev/null && enable_dvdread=1 - if [[ $enable_dvdread ]];then - echo "[✅] --enable-libdvdread : $(pkg-config --modversion dvdread)" - THIRD_CFG_FLAGS="$THIRD_CFG_FLAGS --enable-libdvdread --enable-protocol=dvd" - else - echo "[❌] --disable-dvd protocol" + result=$(gt_or_equal "$GIT_REPO_VERSION" "5") + if [[ $result ]]; then + pkg-config --libs dvdread --silence-errors >/dev/null && enable_dvdread=1 + if [[ $enable_dvdread ]];then + echo "[✅] --enable-libdvdread : $(pkg-config --modversion dvdread)" + THIRD_CFG_FLAGS="$THIRD_CFG_FLAGS --enable-libdvdread --enable-protocol=dvd" + else + echo "[❌] --disable-dvd protocol" + fi + echo "----------------------" fi fi -echo "----------------------" +result=$(gt_or_equal "$GIT_REPO_VERSION" "5") +if [[ $result ]]; then + pkg-config --libs uavs3d --silence-errors >/dev/null && enable_uavs3d=1 -pkg-config --libs uavs3d --silence-errors >/dev/null && enable_uavs3d=1 + if [[ $enable_uavs3d ]];then + echo "[✅] --enable-libuavs3d : $(pkg-config --modversion uavs3d)" + THIRD_CFG_FLAGS="$THIRD_CFG_FLAGS --enable-libuavs3d --enable-decoder=libuavs3d" + else + echo "[❌] --disable-libuavs3d --disable-decoder=libuavs3d" + fi -if [[ $enable_uavs3d ]];then - echo "[✅] --enable-libuavs3d : $(pkg-config --modversion uavs3d)" - THIRD_CFG_FLAGS="$THIRD_CFG_FLAGS --enable-libuavs3d --enable-decoder=libuavs3d" -else - echo "[❌] --disable-libuavs3d --disable-decoder=libuavs3d" + echo "----------------------" fi -echo "----------------------" - pkg-config --libs libxml-2.0 --silence-errors >/dev/null && enable_xml2=1 if [[ $enable_xml2 ]];then @@ -242,8 +262,6 @@ echo "----------------------" # echo "[❌] --disable-decoder=av3a" # fi -echo "[✅] --enable-parser=av3a" -THIRD_CFG_FLAGS="$THIRD_CFG_FLAGS --enable-parser=av3a --enable-demuxer=av3a" # -------------------------------------------------------------- THIRD_CFG_FLAGS="$THIRD_CFG_FLAGS --pkg-config-flags=--static" diff --git a/configs/libs/ffmpeg4.sh b/configs/libs/ffmpeg4.sh new file mode 100644 index 000000000..19a468c3f --- /dev/null +++ b/configs/libs/ffmpeg4.sh @@ -0,0 +1,47 @@ +#! /usr/bin/env bash +# +# Copyright (C) 2021 Matt Reach + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# +# brew install nasm +# If you really want to compile without asm, configure with --disable-asm. + +export LIB_NAME='ffmpeg' +export LIPO_LIBS="libavcodec libavformat libavutil libswscale libswresample libavfilter libavdevice" +export LIB_DEPENDS_BIN="nasm pkg-config" +export GIT_LOCAL_REPO=extra/ffmpeg +export REPO_DIR=ffmpeg4 +export PATCH_DIR=ffmpeg-n4.0 + +# you can export GIT_FFMPEG_UPSTREAM=git@xx:yy/FFmpeg.git use your mirror +if [[ "$GIT_FFMPEG_UPSTREAM" != "" ]] ;then + export GIT_UPSTREAM="$GIT_FFMPEG_UPSTREAM" +else + export GIT_UPSTREAM=https://github.com/FFmpeg/FFmpeg.git +fi + +if [[ "$GIT_FFMPEG_COMMIT" != "" ]] ;then + export GIT_COMMIT="$GIT_FFMPEG_COMMIT" + export GIT_REPO_VERSION="$GIT_FFMPEG_COMMIT" +else + export GIT_COMMIT=n4.0.5 + export GIT_REPO_VERSION=4.0.5 +fi + +# pre compiled +export PRE_COMPILE_TAG_TVOS= +export PRE_COMPILE_TAG_MACOS= +export PRE_COMPILE_TAG_IOS= +export PRE_COMPILE_TAG_ANDROID= \ No newline at end of file diff --git a/configs/libs/ffmpeg5.sh b/configs/libs/ffmpeg5.sh new file mode 100644 index 000000000..e6124f86e --- /dev/null +++ b/configs/libs/ffmpeg5.sh @@ -0,0 +1,47 @@ +#! /usr/bin/env bash +# +# Copyright (C) 2021 Matt Reach + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# +# brew install nasm +# If you really want to compile without asm, configure with --disable-asm. + +export LIB_NAME='ffmpeg' +export LIPO_LIBS="libavcodec libavformat libavutil libswscale libswresample libavfilter libavdevice" +export LIB_DEPENDS_BIN="nasm pkg-config" +export GIT_LOCAL_REPO=extra/ffmpeg +export REPO_DIR=ffmpeg5 +export PATCH_DIR=ffmpeg-n5.1 + +# you can export GIT_FFMPEG_UPSTREAM=git@xx:yy/FFmpeg.git use your mirror +if [[ "$GIT_FFMPEG_UPSTREAM" != "" ]] ;then + export GIT_UPSTREAM="$GIT_FFMPEG_UPSTREAM" +else + export GIT_UPSTREAM=https://github.com/FFmpeg/FFmpeg.git +fi + +if [[ "$GIT_FFMPEG_COMMIT" != "" ]] ;then + export GIT_COMMIT="$GIT_FFMPEG_COMMIT" + export GIT_REPO_VERSION="$GIT_FFMPEG_COMMIT" +else + export GIT_COMMIT=n5.1.6 + export GIT_REPO_VERSION=5.1.6 +fi + +# pre compiled +export PRE_COMPILE_TAG_TVOS= +export PRE_COMPILE_TAG_MACOS= +export PRE_COMPILE_TAG_IOS= +export PRE_COMPILE_TAG_ANDROID= \ No newline at end of file diff --git a/configs/libs/ffmpeg6.sh b/configs/libs/ffmpeg6.sh new file mode 100644 index 000000000..de40f7edc --- /dev/null +++ b/configs/libs/ffmpeg6.sh @@ -0,0 +1,48 @@ +#! /usr/bin/env bash +# +# Copyright (C) 2021 Matt Reach + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# +# brew install nasm +# If you really want to compile without asm, configure with --disable-asm. + +export LIB_NAME='ffmpeg' +export LIPO_LIBS="libavcodec libavformat libavutil libswscale libswresample libavfilter libavdevice" +export LIB_DEPENDS_BIN="nasm pkg-config" +export GIT_LOCAL_REPO=extra/ffmpeg +export REPO_DIR=ffmpeg6 +export PATCH_DIR=ffmpeg-n6.1 + +# you can export GIT_FFMPEG_UPSTREAM=git@xx:yy/FFmpeg.git use your mirror +if [[ "$GIT_FFMPEG_UPSTREAM" != "" ]] ;then + export GIT_UPSTREAM="$GIT_FFMPEG_UPSTREAM" +else + export GIT_UPSTREAM=https://github.com/FFmpeg/FFmpeg.git +fi + +if [[ "$GIT_FFMPEG_COMMIT" != "" ]] ;then + export GIT_COMMIT="$GIT_FFMPEG_COMMIT" + export GIT_REPO_VERSION="$GIT_FFMPEG_COMMIT" +else + export GIT_COMMIT=n6.1.1 #origin/release/5.1 + export GIT_REPO_VERSION=6.1.1 +fi + +# pre compiled +export PRE_COMPILE_TAG=ffmpeg-6.1.2-250227145407 +export PRE_COMPILE_TAG_TVOS=ffmpeg-6.1.1-250520112635 +export PRE_COMPILE_TAG_MACOS=ffmpeg-6.1.1-250520112635 +export PRE_COMPILE_TAG_IOS=ffmpeg-6.1.1-250520112635 +export PRE_COMPILE_TAG_ANDROID=ffmpeg-6.1.2-250310113110 \ No newline at end of file diff --git a/configs/libs/ffmpeg.sh b/configs/libs/ffmpeg7.sh similarity index 92% rename from configs/libs/ffmpeg.sh rename to configs/libs/ffmpeg7.sh index 7cf8df4b1..df8bb8eaf 100644 --- a/configs/libs/ffmpeg.sh +++ b/configs/libs/ffmpeg7.sh @@ -22,7 +22,8 @@ export LIB_NAME='ffmpeg' export LIPO_LIBS="libavcodec libavformat libavutil libswscale libswresample libavfilter libavdevice" export LIB_DEPENDS_BIN="nasm pkg-config" export GIT_LOCAL_REPO=extra/ffmpeg -export REPO_DIR=ffmpeg +export REPO_DIR=ffmpeg7 +export PATCH_DIR=ffmpeg-n7.1.1 # you can export GIT_FFMPEG_UPSTREAM=git@xx:yy/FFmpeg.git use your mirror if [[ "$GIT_FFMPEG_UPSTREAM" != "" ]] ;then @@ -40,9 +41,8 @@ else fi # pre compiled -export PRE_COMPILE_TAG=ffmpeg-6.1.2-250227145407 + export PRE_COMPILE_TAG_TVOS=ffmpeg-7.1.1-250605164908 export PRE_COMPILE_TAG_MACOS=ffmpeg-7.1.1-250605164908 export PRE_COMPILE_TAG_IOS=ffmpeg-7.1.1-250605164908 -export PRE_COMPILE_TAG_ANDROID=ffmpeg-6.1.2-250310113110 diff --git a/do-compile/apple/ffmpeg.sh b/do-compile/apple/ffmpeg.sh index 6704cd81d..4a5564dc7 100755 --- a/do-compile/apple/ffmpeg.sh +++ b/do-compile/apple/ffmpeg.sh @@ -88,12 +88,12 @@ cp config.* $MR_BUILD_PREFIX make install >/dev/null mkdir -p $MR_BUILD_PREFIX/include/libffmpeg cp -f config.h $MR_BUILD_PREFIX/include/libffmpeg/ -[ -e config_components.h ] && cp -f config_components.h $MR_BUILD_PREFIX/include/libffmpeg/ +cp -f config_components.h $MR_BUILD_PREFIX/include/libffmpeg/ &> /dev/null || true # copy private header for ffmpeg-kit. -[ -e $MR_BUILD_SOURCE/libavutil/getenv_utf8.h ] && cp -f $MR_BUILD_SOURCE/libavutil/getenv_utf8.h $MR_BUILD_PREFIX/include/libavutil/ +cp -f $MR_BUILD_SOURCE/libavutil/getenv_utf8.h $MR_BUILD_PREFIX/include/libavutil/ &> /dev/null || true cp -f $MR_BUILD_SOURCE/libavutil/internal.h $MR_BUILD_PREFIX/include/libavutil/ cp -f $MR_BUILD_SOURCE/libavutil/libm.h $MR_BUILD_PREFIX/include/libavutil/ -[ -e $MR_BUILD_SOURCE/libavutil/attributes_internal.h ] && cp -f $MR_BUILD_SOURCE/libavutil/attributes_internal.h $MR_BUILD_PREFIX/include/libavutil/ +cp -f $MR_BUILD_SOURCE/libavutil/attributes_internal.h $MR_BUILD_PREFIX/include/libavutil/ &> /dev/null || true cp -f $MR_BUILD_SOURCE/libavcodec/mathops.h $MR_BUILD_PREFIX/include/libavcodec/ mkdir -p $MR_BUILD_PREFIX/include/libavcodec/x86/ @@ -101,6 +101,6 @@ cp -f $MR_BUILD_SOURCE/libavcodec/x86/mathops.h $MR_BUILD_PREFIX/include/libavco mkdir -p $MR_BUILD_PREFIX/include/libavutil/x86/ cp -f $MR_BUILD_SOURCE/libavutil/x86/asm.h $MR_BUILD_PREFIX/include/libavutil/x86/ #copy private header for hls.c -cp -f $MR_BUILD_SOURCE/libavformat/demux.h $MR_BUILD_PREFIX/include/libavformat/ -cp -f $MR_BUILD_SOURCE/libavformat/http.h $MR_BUILD_PREFIX/include/libavformat/ -cp -f $MR_BUILD_SOURCE/libavformat/hls_sample_encryption.h $MR_BUILD_PREFIX/include/libavformat/ \ No newline at end of file +cp -f $MR_BUILD_SOURCE/libavformat/demux.h $MR_BUILD_PREFIX/include/libavformat/ &> /dev/null || true +cp -f $MR_BUILD_SOURCE/libavformat/http.h $MR_BUILD_PREFIX/include/libavformat/ &> /dev/null || true +cp -f $MR_BUILD_SOURCE/libavformat/hls_sample_encryption.h $MR_BUILD_PREFIX/include/libavformat/ &> /dev/null || true \ No newline at end of file From 980db8fbb4ad339e35b4ae7ba3320808eed4d657 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Thu, 5 Jun 2025 18:59:22 +0800 Subject: [PATCH 060/359] update dependencies --- .github/workflows/all.yml | 6 +-- .github/workflows/apple-android-common.yml | 7 +++- .github/workflows/install-dependencies.sh | 44 +++++++++++++++++++++- 3 files changed, 51 insertions(+), 6 deletions(-) diff --git a/.github/workflows/all.yml b/.github/workflows/all.yml index fd66f97dd..fc78a6784 100644 --- a/.github/workflows/all.yml +++ b/.github/workflows/all.yml @@ -108,9 +108,9 @@ jobs: echo '------compile smb2------------------------------------' rm -rf build || git reset --hard || git pull origin .github/workflows/onestep.sh smb2 ${{ inputs.platform }} ${{ inputs.dryrun }} - echo '------compile ffmpeg------------------------------------' + echo '------compile ffmpeg7------------------------------------' rm -rf build || git reset --hard || git pull origin - .github/workflows/install-dependencies.sh ffmpeg ${{ inputs.platform }} - .github/workflows/onestep.sh ffmpeg ${{ inputs.platform }} ${{ inputs.dryrun }} + .github/workflows/install-dependencies.sh ffmpeg7 ${{ inputs.platform }} + .github/workflows/onestep.sh ffmpeg7 ${{ inputs.platform }} ${{ inputs.dryrun }} env: ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} diff --git a/.github/workflows/apple-android-common.yml b/.github/workflows/apple-android-common.yml index bf040fb37..363607af9 100644 --- a/.github/workflows/apple-android-common.yml +++ b/.github/workflows/apple-android-common.yml @@ -38,9 +38,12 @@ on: description: 'choose a lib for compile' required: true type: choice - default: 'ffmpeg' + default: 'ffmpeg7' options: - - ffmpeg + - ffmpeg7 + - ffmpeg6 + - ffmpeg5 + - ffmpeg4 - ijkffmpeg - fftutorial - ass diff --git a/.github/workflows/install-dependencies.sh b/.github/workflows/install-dependencies.sh index f5cbaa0d5..bf1f57a38 100755 --- a/.github/workflows/install-dependencies.sh +++ b/.github/workflows/install-dependencies.sh @@ -35,7 +35,7 @@ case $LIB_NAME in ./main.sh install -l 'xml2' -p $PLAT fi ;; - ffmpeg) + ffmpeg7) if [[ $PLAT == all ]];then ./main.sh install -l 'openssl3 opus dav1d dvdnav uavs3d smb2 bluray' -p ios ./main.sh install -l 'openssl3 opus dav1d dvdnav uavs3d smb2 bluray' -p tvos @@ -49,6 +49,48 @@ case $LIB_NAME in ./main.sh install -l 'openssl3 opus dav1d dvdnav uavs3d smb2 bluray' -p $PLAT fi ;; + ffmpeg6) + if [[ $PLAT == all ]];then + ./main.sh install -l 'openssl3 opus dav1d dvdread uavs3d smb2 bluray' -p ios + ./main.sh install -l 'openssl3 opus dav1d dvdread uavs3d smb2 bluray' -p tvos + ./main.sh install -l 'openssl3 opus dav1d dvdread uavs3d smb2 bluray' -p macos + ./main.sh install -l 'openssl3 opus dav1d dvdread uavs3d smb2 bluray' -p android + elif [[ $PLAT == apple ]];then + ./main.sh install -l 'openssl3 opus dav1d dvdread uavs3d smb2 bluray' -p ios + ./main.sh install -l 'openssl3 opus dav1d dvdread uavs3d smb2 bluray' -p tvos + ./main.sh install -l 'openssl3 opus dav1d dvdread uavs3d smb2 bluray' -p macos + else + ./main.sh install -l 'openssl3 opus dav1d dvdread uavs3d smb2 bluray' -p $PLAT + fi + ;; + ffmpeg5) + if [[ $PLAT == all ]];then + ./main.sh install -l 'openssl3 opus dav1d dvdread uavs3d bluray' -p ios + ./main.sh install -l 'openssl3 opus dav1d dvdread uavs3d bluray' -p tvos + ./main.sh install -l 'openssl3 opus dav1d dvdread uavs3d bluray' -p macos + ./main.sh install -l 'openssl3 opus dav1d dvdread uavs3d bluray' -p android + elif [[ $PLAT == apple ]];then + ./main.sh install -l 'openssl3 opus dav1d dvdread uavs3d bluray' -p ios + ./main.sh install -l 'openssl3 opus dav1d dvdread uavs3d bluray' -p tvos + ./main.sh install -l 'openssl3 opus dav1d dvdread uavs3d bluray' -p macos + else + ./main.sh install -l 'openssl3 opus dav1d dvdread uavs3d bluray' -p $PLAT + fi + ;; + ffmpeg4) + if [[ $PLAT == all ]];then + ./main.sh install -l 'openssl3 opus bluray' -p ios + ./main.sh install -l 'openssl3 opus bluray' -p tvos + ./main.sh install -l 'openssl3 opus bluray' -p macos + ./main.sh install -l 'openssl3 opus bluray' -p android + elif [[ $PLAT == apple ]];then + ./main.sh install -l 'openssl3 opus bluray' -p ios + ./main.sh install -l 'openssl3 opus bluray' -p tvos + ./main.sh install -l 'openssl3 opus bluray' -p macos + else + ./main.sh install -l 'openssl3 opus bluray' -p $PLAT + fi + ;; ijkffmpeg) if [[ $PLAT == all ]];then ./main.sh install -l 'openssl' -p ios From fdf403448f93b72e13f301704f31d7f0aeb8f62b Mon Sep 17 00:00:00 2001 From: Anka Date: Thu, 5 Jun 2025 11:15:42 +0000 Subject: [PATCH 061/359] upgrade ffmpeg4 to ffmpeg4-4.0.5-250605190152 for apple by cd --- configs/libs/ffmpeg4.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configs/libs/ffmpeg4.sh b/configs/libs/ffmpeg4.sh index 19a468c3f..83d4e4620 100644 --- a/configs/libs/ffmpeg4.sh +++ b/configs/libs/ffmpeg4.sh @@ -41,7 +41,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS= -export PRE_COMPILE_TAG_MACOS= -export PRE_COMPILE_TAG_IOS= +export PRE_COMPILE_TAG_TVOS=ffmpeg4-4.0.5-250605190152 +export PRE_COMPILE_TAG_MACOS=ffmpeg4-4.0.5-250605190152 +export PRE_COMPILE_TAG_IOS=ffmpeg4-4.0.5-250605190152 export PRE_COMPILE_TAG_ANDROID= \ No newline at end of file From 21fc3bf28d6631e3b7ee7a709f3b25ef59f03e97 Mon Sep 17 00:00:00 2001 From: Anka Date: Thu, 5 Jun 2025 11:19:06 +0000 Subject: [PATCH 062/359] upgrade ffmpeg6 to ffmpeg6-6.1.1-250605190133 for apple by cd --- configs/libs/ffmpeg6.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configs/libs/ffmpeg6.sh b/configs/libs/ffmpeg6.sh index de40f7edc..87c19668e 100644 --- a/configs/libs/ffmpeg6.sh +++ b/configs/libs/ffmpeg6.sh @@ -42,7 +42,7 @@ fi # pre compiled export PRE_COMPILE_TAG=ffmpeg-6.1.2-250227145407 -export PRE_COMPILE_TAG_TVOS=ffmpeg-6.1.1-250520112635 -export PRE_COMPILE_TAG_MACOS=ffmpeg-6.1.1-250520112635 -export PRE_COMPILE_TAG_IOS=ffmpeg-6.1.1-250520112635 +export PRE_COMPILE_TAG_TVOS=ffmpeg6-6.1.1-250605190133 +export PRE_COMPILE_TAG_MACOS=ffmpeg6-6.1.1-250605190133 +export PRE_COMPILE_TAG_IOS=ffmpeg6-6.1.1-250605190133 export PRE_COMPILE_TAG_ANDROID=ffmpeg-6.1.2-250310113110 \ No newline at end of file From 49b14620b220d116b538707b1dee843e190158a3 Mon Sep 17 00:00:00 2001 From: Anka Date: Thu, 5 Jun 2025 11:24:06 +0000 Subject: [PATCH 063/359] upgrade ffmpeg7 to ffmpeg7-7.1.1-250605190134 for apple by cd --- configs/libs/ffmpeg7.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configs/libs/ffmpeg7.sh b/configs/libs/ffmpeg7.sh index df8bb8eaf..4ed404a1a 100644 --- a/configs/libs/ffmpeg7.sh +++ b/configs/libs/ffmpeg7.sh @@ -42,7 +42,7 @@ fi # pre compiled -export PRE_COMPILE_TAG_TVOS=ffmpeg-7.1.1-250605164908 -export PRE_COMPILE_TAG_MACOS=ffmpeg-7.1.1-250605164908 -export PRE_COMPILE_TAG_IOS=ffmpeg-7.1.1-250605164908 +export PRE_COMPILE_TAG_TVOS=ffmpeg7-7.1.1-250605190134 +export PRE_COMPILE_TAG_MACOS=ffmpeg7-7.1.1-250605190134 +export PRE_COMPILE_TAG_IOS=ffmpeg7-7.1.1-250605190134 From 190217939f8ece6f233bc98a0f3ce2d22d1518b3 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Fri, 6 Jun 2025 09:08:26 +0800 Subject: [PATCH 064/359] add patch for ffmpeg5 --- ...s-only-available-on-iOS-13.0-or-newe.patch | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 patches/ffmpeg-n5.1/0020-supportsFamily-is-only-available-on-iOS-13.0-or-newe.patch diff --git a/patches/ffmpeg-n5.1/0020-supportsFamily-is-only-available-on-iOS-13.0-or-newe.patch b/patches/ffmpeg-n5.1/0020-supportsFamily-is-only-available-on-iOS-13.0-or-newe.patch new file mode 100644 index 000000000..e0b83f798 --- /dev/null +++ b/patches/ffmpeg-n5.1/0020-supportsFamily-is-only-available-on-iOS-13.0-or-newe.patch @@ -0,0 +1,25 @@ +From 1ebd4c062a886049f3c3255c50fe56f6621b9844 Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Fri, 26 Jul 2024 16:11:14 +0800 +Subject: [PATCH 20] 'supportsFamily:' is only available on iOS 13.0 or newer + +--- + libavfilter/metal/utils.m | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libavfilter/metal/utils.m b/libavfilter/metal/utils.m +index f365d3c..bb1825a 100644 +--- a/libavfilter/metal/utils.m ++++ b/libavfilter/metal/utils.m +@@ -31,7 +31,7 @@ void ff_metal_compute_encoder_dispatch(id device, + BOOL fallback = YES; + // MAC_OS_X_VERSION_10_15 is only defined on SDKs new enough to include its functionality (including iOS, tvOS, etc) + #ifdef MAC_OS_X_VERSION_10_15 +- if (@available(macOS 10.15, iOS 11, tvOS 14.5, *)) { ++ if (@available(macOS 10.15, iOS 13, tvOS 14.5, *)) { + if ([device supportsFamily:MTLGPUFamilyCommon3]) { + MTLSize threadsPerGrid = MTLSizeMake(width, height, 1); + [encoder dispatchThreads:threadsPerGrid threadsPerThreadgroup:threadsPerThreadgroup]; +-- +2.39.3 (Apple Git-146) + From 28d6004135385e7d7745b3be93e138f07c47634a Mon Sep 17 00:00:00 2001 From: Anka Date: Fri, 6 Jun 2025 01:25:00 +0000 Subject: [PATCH 065/359] upgrade ffmpeg5 to ffmpeg5-5.1.6-250606091027 for apple by cd --- configs/libs/ffmpeg5.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configs/libs/ffmpeg5.sh b/configs/libs/ffmpeg5.sh index e6124f86e..c5c5bdae9 100644 --- a/configs/libs/ffmpeg5.sh +++ b/configs/libs/ffmpeg5.sh @@ -41,7 +41,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS= -export PRE_COMPILE_TAG_MACOS= -export PRE_COMPILE_TAG_IOS= +export PRE_COMPILE_TAG_TVOS=ffmpeg5-5.1.6-250606091027 +export PRE_COMPILE_TAG_MACOS=ffmpeg5-5.1.6-250606091027 +export PRE_COMPILE_TAG_IOS=ffmpeg5-5.1.6-250606091027 export PRE_COMPILE_TAG_ANDROID= \ No newline at end of file From 82b2533e3783ede7b6e9c9f4e6c5beeb13f7581c Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Fri, 6 Jun 2025 10:24:25 +0800 Subject: [PATCH 066/359] android add soudtouch --- .github/workflows/install-dependencies.sh | 68 +++++++++++++++-------- README.md | 39 +++++++------ 2 files changed, 65 insertions(+), 42 deletions(-) diff --git a/.github/workflows/install-dependencies.sh b/.github/workflows/install-dependencies.sh index bf1f57a38..1ee7f853a 100755 --- a/.github/workflows/install-dependencies.sh +++ b/.github/workflows/install-dependencies.sh @@ -37,44 +37,56 @@ case $LIB_NAME in ;; ffmpeg7) if [[ $PLAT == all ]];then - ./main.sh install -l 'openssl3 opus dav1d dvdnav uavs3d smb2 bluray' -p ios - ./main.sh install -l 'openssl3 opus dav1d dvdnav uavs3d smb2 bluray' -p tvos - ./main.sh install -l 'openssl3 opus dav1d dvdnav uavs3d smb2 bluray' -p macos - ./main.sh install -l 'openssl3 opus dav1d dvdnav uavs3d smb2 bluray' -p android + ./main.sh install -l 'openssl3 opus bluray dav1d dvdnav uavs3d smb2' -p ios + ./main.sh install -l 'openssl3 opus bluray dav1d dvdnav uavs3d smb2' -p tvos + ./main.sh install -l 'openssl3 opus bluray dav1d dvdnav uavs3d smb2' -p macos + ./main.sh install -l 'openssl3 opus bluray dav1d dvdnav uavs3d smb2' -p android elif [[ $PLAT == apple ]];then - ./main.sh install -l 'openssl3 opus dav1d dvdnav uavs3d smb2 bluray' -p ios - ./main.sh install -l 'openssl3 opus dav1d dvdnav uavs3d smb2 bluray' -p tvos - ./main.sh install -l 'openssl3 opus dav1d dvdnav uavs3d smb2 bluray' -p macos + ./main.sh install -l 'openssl3 opus bluray dav1d dvdnav uavs3d smb2' -p ios + ./main.sh install -l 'openssl3 opus bluray dav1d dvdnav uavs3d smb2' -p tvos + ./main.sh install -l 'openssl3 opus bluray dav1d dvdnav uavs3d smb2' -p macos else - ./main.sh install -l 'openssl3 opus dav1d dvdnav uavs3d smb2 bluray' -p $PLAT + ./main.sh install -l 'openssl3 opus bluray dav1d dvdnav uavs3d smb2' -p $PLAT + fi + + if [[ $PLAT == android ]];then + ./main.sh install -l 'soundtouch' -p android fi ;; ffmpeg6) if [[ $PLAT == all ]];then - ./main.sh install -l 'openssl3 opus dav1d dvdread uavs3d smb2 bluray' -p ios - ./main.sh install -l 'openssl3 opus dav1d dvdread uavs3d smb2 bluray' -p tvos - ./main.sh install -l 'openssl3 opus dav1d dvdread uavs3d smb2 bluray' -p macos - ./main.sh install -l 'openssl3 opus dav1d dvdread uavs3d smb2 bluray' -p android + ./main.sh install -l 'openssl3 opus bluray dav1d dvdread uavs3d smb2' -p ios + ./main.sh install -l 'openssl3 opus bluray dav1d dvdread uavs3d smb2' -p tvos + ./main.sh install -l 'openssl3 opus bluray dav1d dvdread uavs3d smb2' -p macos + ./main.sh install -l 'openssl3 opus bluray dav1d dvdread uavs3d smb2' -p android elif [[ $PLAT == apple ]];then - ./main.sh install -l 'openssl3 opus dav1d dvdread uavs3d smb2 bluray' -p ios - ./main.sh install -l 'openssl3 opus dav1d dvdread uavs3d smb2 bluray' -p tvos - ./main.sh install -l 'openssl3 opus dav1d dvdread uavs3d smb2 bluray' -p macos + ./main.sh install -l 'openssl3 opus bluray dav1d dvdread uavs3d smb2' -p ios + ./main.sh install -l 'openssl3 opus bluray dav1d dvdread uavs3d smb2' -p tvos + ./main.sh install -l 'openssl3 opus bluray dav1d dvdread uavs3d smb2' -p macos else - ./main.sh install -l 'openssl3 opus dav1d dvdread uavs3d smb2 bluray' -p $PLAT + ./main.sh install -l 'openssl3 opus bluray dav1d dvdread uavs3d smb2' -p $PLAT + fi + + if [[ $PLAT == android ]];then + ./main.sh install -l 'soundtouch' -p android fi ;; ffmpeg5) if [[ $PLAT == all ]];then - ./main.sh install -l 'openssl3 opus dav1d dvdread uavs3d bluray' -p ios - ./main.sh install -l 'openssl3 opus dav1d dvdread uavs3d bluray' -p tvos - ./main.sh install -l 'openssl3 opus dav1d dvdread uavs3d bluray' -p macos - ./main.sh install -l 'openssl3 opus dav1d dvdread uavs3d bluray' -p android + ./main.sh install -l 'openssl3 opus bluray dav1d dvdread uavs3d' -p ios + ./main.sh install -l 'openssl3 opus bluray dav1d dvdread uavs3d' -p tvos + ./main.sh install -l 'openssl3 opus bluray dav1d dvdread uavs3d' -p macos + ./main.sh install -l 'openssl3 opus bluray dav1d dvdread uavs3d' -p android elif [[ $PLAT == apple ]];then - ./main.sh install -l 'openssl3 opus dav1d dvdread uavs3d bluray' -p ios - ./main.sh install -l 'openssl3 opus dav1d dvdread uavs3d bluray' -p tvos - ./main.sh install -l 'openssl3 opus dav1d dvdread uavs3d bluray' -p macos + ./main.sh install -l 'openssl3 opus bluray dav1d dvdread uavs3d' -p ios + ./main.sh install -l 'openssl3 opus bluray dav1d dvdread uavs3d' -p tvos + ./main.sh install -l 'openssl3 opus bluray dav1d dvdread uavs3d' -p macos else - ./main.sh install -l 'openssl3 opus dav1d dvdread uavs3d bluray' -p $PLAT + ./main.sh install -l 'openssl3 opus bluray dav1d dvdread uavs3d' -p $PLAT + fi + + if [[ $PLAT == android ]];then + ./main.sh install -l 'soundtouch' -p android fi ;; ffmpeg4) @@ -90,6 +102,10 @@ case $LIB_NAME in else ./main.sh install -l 'openssl3 opus bluray' -p $PLAT fi + + if [[ $PLAT == android ]];then + ./main.sh install -l 'soundtouch' -p android + fi ;; ijkffmpeg) if [[ $PLAT == all ]];then @@ -104,6 +120,10 @@ case $LIB_NAME in else ./main.sh install -l 'openssl' -p $PLAT fi + + if [[ $PLAT == android ]];then + ./main.sh install -l 'soundtouch' -p android + fi ;; fftutorial) if [[ $PLAT == all ]];then diff --git a/README.md b/README.md index aa3924ad6..ff1438392 100644 --- a/README.md +++ b/README.md @@ -33,9 +33,14 @@ At present MRFFToolChain contained `ass、bluray、dav1d、dvdread、dvdnav、ff - dvdnav: dvdread - Ass for Appple: harfbuzz,fribidi,unibreak - Ass for Android: harfbuzz,fribidi,unibreak,fontconfig -- FFmpeg for Appple: openssl3,opus,dav1d,dvdread,uavs3d,smb2 -- FFmpeg for Android: openssl,opus,dav1d,dvdread,uavs3d,smb2 -- FFmpeg7 for Appple: openssl3,opus,dav1d,dvdnav,uavs3d,smb2 +- FFmpeg4 for Appple: openssl3,opus,bluray +- FFmpeg5 for Appple: openssl3,opus,bluray,dav1d,dvdread,uavs3d +- FFmpeg6 for Appple: openssl3,opus,bluray,dav1d,dvdread,uavs3d,smb2 +- FFmpeg7 for Appple: openssl3,opus,bluray,dav1d,dvdnav,uavs3d,smb2 +- FFmpeg4 for Android: openssl3,opus,bluray,soundtouch +- FFmpeg5 for Android: openssl3,opus,bluray,dav1d,dvdread,uavs3d,soundtouch +- FFmpeg6 for Android: openssl3,opus,bluray,dav1d,dvdread,uavs3d,smb2,soundtouch +- FFmpeg7 for Android: openssl3,opus,bluray,dav1d,dvdnav,uavs3d,smb2,soundtouch Tips: @@ -58,8 +63,7 @@ These pre-compiled libraries already applied patches which in the patches direct # Examples of usage: ./main.sh install -p macos -l ffmpeg ./main.sh install -p ios -l 'ass ffmpeg' -./main.sh install -p tvos -l all -./main.sh install -p android -l all +./main.sh install -p android -l openssl3 ``` ## Compile by Yourself @@ -74,14 +78,10 @@ The script parameters are flexible and can be combined as needed. Here are some ``` # Check the help first ./main.sh init --help -# Prepare source code for all libraries for the iOS platform -./main.sh init -p ios -l all -# Prepare source code for all libraries for the x86 architecture on iOS -./main.sh init -p ios -l all -a x86_64_simulator -# Prepare source code for all libraries for the macOS platform -./main.sh init -p macos -l all -# Prepare source code for specific libraries for the iOS platform -./main.sh init -p ios -l "openssl ffmpeg" +# Prepare libass source code for the iOS platform +./main.sh init -p ios -l ass +# Prepare ffmpeg7 source code for the x86 architecture on iOS +./main.sh init -p ios -l ffmpeg7 -a x86_64_simulator # Prepare source code for specific libraries for the Android platform ./main.sh init -p android -l "openssl ffmpeg" ``` @@ -100,13 +100,16 @@ Once the source code repository initialization is complete, you can start the co # -a specifies the CPU architecture ``` -Examples of usage: +The following code demonstrates how to compile FFmpeg 7 for the iOS platform: ``` - Compile all dependencies for the iOS platform -./main.sh compile -c build -p ios -l all -# Compile the libass library for the arm64 architecture on iOS -./main.sh compile -c build -p ios -a arm64 -l ass +# install FFmpeg7's dependencies has two choices +# recommend choice (because ffmpeg7 was pre-compiled,it contained all dependencies) +./main.sh install -p ios -l ffmpeg7 +# other choice (you must know ffmpeg7's dependent lib name) +./main.sh install -p ios -l "openssl3 opus bluray dav1d dvdnav uavs3d,smb2" +# Compile FFmpeg7 for the arm64 architecture on iOS +./main.sh compile -p ios -a arm64 -l ffmepg7 --skip-fmwk ``` The order of these parameters does not matter; they can be arranged in any sequence. From 10485bb58c90f3aca444dba05276cfd39703aef1 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Fri, 6 Jun 2025 10:36:38 +0800 Subject: [PATCH 067/359] fix PATCH_DIR is nil --- README.md | 2 +- do-init/init-repo.sh | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ff1438392..0ea099de2 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ## MRFFToolChain Build Shell -![](https://img.shields.io/github/downloads/debugly/MRFFToolChainBuildShell/total) +![](https://img.shields.io/github/downloads/debugly/MRFFToolChainBuildShell/total) **What's MRFFToolChain?** diff --git a/do-init/init-repo.sh b/do-init/init-repo.sh index 2a456e0b2..b8653b22f 100755 --- a/do-init/init-repo.sh +++ b/do-init/init-repo.sh @@ -71,6 +71,11 @@ function apply_patches() { return fi + if [[ -z "$PATCH_DIR" ]]; then + echo "$REPO_DIR hasn't any patch" + return + fi + local plat="$MR_PLAT" local patch_dir="${THIS_DIR}/../patches/$PATCH_DIR" From f381d32634bcca8bb0f46f70d3727ee9509b30cc Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Fri, 6 Jun 2025 11:02:26 +0800 Subject: [PATCH 068/359] try fix no NDK arm-linux-androideabi-gcc on $PATH at (eval 10) line 143. --- do-compile/android/openssl.sh | 6 +++++- tools/export-android-build-env.sh | 13 +++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/do-compile/android/openssl.sh b/do-compile/android/openssl.sh index 894682648..31e9ee4c7 100755 --- a/do-compile/android/openssl.sh +++ b/do-compile/android/openssl.sh @@ -50,7 +50,7 @@ case $_MR_ARCH in ;; esac -CFG_FLAGS="no-shared no-engine no-dynamic-engine no-static-engine \ +CFG_FLAGS="no-shared no-engine no-apps no-dynamic-engine no-static-engine \ no-dso no-ui-console no-tests \ --prefix=$MR_BUILD_PREFIX \ --openssldir=$MR_BUILD_PREFIX \ @@ -74,6 +74,7 @@ else echo "[*] configurate" echo "C_FLAGS: $C_FLAGS" echo "Openssl CFG: $CFG_FLAGS" + echo "PATH: $PATH" echo "----------------------" export C_FLAGS="$C_FLAGS" @@ -83,6 +84,9 @@ else export AS="$MR_AS" export RANLIB="$MR_RANLIB" export STRIP="$MR_STRIP" + export ANDROID_NDK_ROOT="$MR_ANDROID_NDK_HOME" + + ./Configure $CFG_FLAGS fi diff --git a/tools/export-android-build-env.sh b/tools/export-android-build-env.sh index 96babb9be..7f3f259be 100755 --- a/tools/export-android-build-env.sh +++ b/tools/export-android-build-env.sh @@ -56,15 +56,20 @@ export MR_BUILD_SOURCE="${MR_SRC_ROOT}/${REPO_DIR}-${_MR_ARCH}" # android/fftutorial-x86_64 export MR_BUILD_PREFIX="${MR_PRODUCT_ROOT}/${LIB_NAME}-${_MR_ARCH}" -if [ -z "$ANDROID_NDK_HOME" ]; then +if [[ -n "$ANDROID_NDK_HOME" ]];then + export MR_ANDROID_NDK_HOME="$ANDROID_NDK_HOME" +elif [[ -n "$ANDROID_NDK_ROOT" ]]; then + export MR_ANDROID_NDK_HOME="$ANDROID_NDK_ROOT" +elif [[ -n "$ANDROID_NDK" ]]; then + export MR_ANDROID_NDK_HOME="$ANDROID_NDK" +else echo "You must define ANDROID_NDK_HOME before starting." echo "They must point to your NDK directories.\n" exit 1 -else - export MR_NDK_REL=$(grep -m 1 -o '^## r[0-9]*.*' $ANDROID_NDK_HOME/CHANGELOG.md | awk '{print $2}') fi -export MR_ANDROID_NDK_HOME="$ANDROID_NDK_HOME" +export MR_NDK_REL=$(grep -m 1 -o '^## r[0-9]*.*' $MR_ANDROID_NDK_HOME/CHANGELOG.md | awk '{print $2}') + export MR_TOOLCHAIN_ROOT="$MR_ANDROID_NDK_HOME/toolchains/llvm/prebuilt/${MR_HOST_TAG}" export PATH="${MR_TOOLCHAIN_ROOT}/bin:$PATH" export MR_SYS_ROOT="${MR_TOOLCHAIN_ROOT}/sysroot" From 99a67a62fdbf7af299a04d8dc236c905b4ce4887 Mon Sep 17 00:00:00 2001 From: Anka Date: Fri, 6 Jun 2025 03:06:56 +0000 Subject: [PATCH 069/359] upgrade openssl3 to openssl3-3.5.0-250606110346 for android by cd --- configs/libs/openssl3.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/libs/openssl3.sh b/configs/libs/openssl3.sh index aea82da3f..95fae1c64 100644 --- a/configs/libs/openssl3.sh +++ b/configs/libs/openssl3.sh @@ -34,4 +34,4 @@ export PRE_COMPILE_TAG= export PRE_COMPILE_TAG_TVOS=openssl3-3.5.0-250605155209 export PRE_COMPILE_TAG_MACOS=openssl3-3.5.0-250605155209 export PRE_COMPILE_TAG_IOS=openssl3-3.5.0-250605155209 -export PRE_COMPILE_TAG_ANDROID= +export PRE_COMPILE_TAG_ANDROID=openssl3-3.5.0-250606110346 From a21704bf808d74c4536c00f94771138e6afd72b5 Mon Sep 17 00:00:00 2001 From: Anka Date: Fri, 6 Jun 2025 03:13:33 +0000 Subject: [PATCH 070/359] upgrade ijkffmpeg to ijkffmpeg-4.0-250606110858 for android by cd --- configs/libs/ijkffmpeg.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/libs/ijkffmpeg.sh b/configs/libs/ijkffmpeg.sh index 1ceba85a6..3856416ed 100644 --- a/configs/libs/ijkffmpeg.sh +++ b/configs/libs/ijkffmpeg.sh @@ -41,7 +41,7 @@ fi # pre compiled export PRE_COMPILE_TAG=ijkffmpeg-4.0-250311090211 -export PRE_COMPILE_TAG_ANDROID=ijkffmpeg-4.0-250428093705 +export PRE_COMPILE_TAG_ANDROID=ijkffmpeg-4.0-250606110858 export PRE_COMPILE_TAG_TVOS=ijkffmpeg-4.0-250311090211 export PRE_COMPILE_TAG_MACOS=ijkffmpeg-4.0-250311090211 export PRE_COMPILE_TAG_IOS=ijkffmpeg-4.0-250429152137 From 1b88f04864483e98df44f2a4c347f8591f5428ca Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Fri, 6 Jun 2025 11:19:22 +0800 Subject: [PATCH 071/359] format code --- do-compile/android/openssl.sh | 3 +-- tools/export-android-build-env.sh | 29 +++++------------------------ tools/export-android-host-env.sh | 20 +++++++++++++++++++- 3 files changed, 25 insertions(+), 27 deletions(-) diff --git a/do-compile/android/openssl.sh b/do-compile/android/openssl.sh index 31e9ee4c7..cdab62edd 100755 --- a/do-compile/android/openssl.sh +++ b/do-compile/android/openssl.sh @@ -65,6 +65,7 @@ fi C_FLAGS="$MR_DEFAULT_CFLAGS" cd $MR_BUILD_SOURCE + if [ -f "./Makefile" ]; then echo 'reuse configure' echo "----------------------" @@ -74,7 +75,6 @@ else echo "[*] configurate" echo "C_FLAGS: $C_FLAGS" echo "Openssl CFG: $CFG_FLAGS" - echo "PATH: $PATH" echo "----------------------" export C_FLAGS="$C_FLAGS" @@ -86,7 +86,6 @@ else export STRIP="$MR_STRIP" export ANDROID_NDK_ROOT="$MR_ANDROID_NDK_HOME" - ./Configure $CFG_FLAGS fi diff --git a/tools/export-android-build-env.sh b/tools/export-android-build-env.sh index 7f3f259be..8d2d6f3e8 100755 --- a/tools/export-android-build-env.sh +++ b/tools/export-android-build-env.sh @@ -49,30 +49,6 @@ esac # x86_64 export MR_ARCH="$_MR_ARCH" -# openssl-armv7a - -# android/ffmpeg-x86_64 -export MR_BUILD_SOURCE="${MR_SRC_ROOT}/${REPO_DIR}-${_MR_ARCH}" -# android/fftutorial-x86_64 -export MR_BUILD_PREFIX="${MR_PRODUCT_ROOT}/${LIB_NAME}-${_MR_ARCH}" - -if [[ -n "$ANDROID_NDK_HOME" ]];then - export MR_ANDROID_NDK_HOME="$ANDROID_NDK_HOME" -elif [[ -n "$ANDROID_NDK_ROOT" ]]; then - export MR_ANDROID_NDK_HOME="$ANDROID_NDK_ROOT" -elif [[ -n "$ANDROID_NDK" ]]; then - export MR_ANDROID_NDK_HOME="$ANDROID_NDK" -else - echo "You must define ANDROID_NDK_HOME before starting." - echo "They must point to your NDK directories.\n" - exit 1 -fi - -export MR_NDK_REL=$(grep -m 1 -o '^## r[0-9]*.*' $MR_ANDROID_NDK_HOME/CHANGELOG.md | awk '{print $2}') - -export MR_TOOLCHAIN_ROOT="$MR_ANDROID_NDK_HOME/toolchains/llvm/prebuilt/${MR_HOST_TAG}" -export PATH="${MR_TOOLCHAIN_ROOT}/bin:$PATH" -export MR_SYS_ROOT="${MR_TOOLCHAIN_ROOT}/sysroot" # Common prefix for ld, as, etc. CROSS_PREFIX_WITH_PATH=${MR_TOOLCHAIN_ROOT}/bin/llvm- @@ -104,6 +80,11 @@ export MR_YASM=${MR_TOOLCHAIN_ROOT}/bin/yasm export MR_DEFAULT_CFLAGS="$MR_INIT_CFLAGS -D__ANDROID__" +# openssl-armv7a +# android/ffmpeg-x86_64 +export MR_BUILD_SOURCE="${MR_SRC_ROOT}/${REPO_DIR}-${_MR_ARCH}" +# android/fftutorial-x86_64 +export MR_BUILD_PREFIX="${MR_PRODUCT_ROOT}/${LIB_NAME}-${_MR_ARCH}" echo "MR_ARCH : [$MR_ARCH]" echo "MR_TRIPLE : [$MR_TRIPLE]" diff --git a/tools/export-android-host-env.sh b/tools/export-android-host-env.sh index 335782676..28dd54c42 100644 --- a/tools/export-android-host-env.sh +++ b/tools/export-android-host-env.sh @@ -66,7 +66,25 @@ export MR_HOST_NPROC="$HOST_NPROC" export MR_TAGET_OS="android" # export MR_PLAT="android" +if [[ -n "$ANDROID_NDK_HOME" ]];then + export MR_ANDROID_NDK_HOME="$ANDROID_NDK_HOME" +elif [[ -n "$ANDROID_NDK_ROOT" ]]; then + export MR_ANDROID_NDK_HOME="$ANDROID_NDK_ROOT" +elif [[ -n "$ANDROID_NDK" ]]; then + export MR_ANDROID_NDK_HOME="$ANDROID_NDK" +else + echo "You must define ANDROID_NDK_HOME or ANDROID_NDK_ROOT or ANDROID_NDK before starting." + echo "They must point to your NDK directories.\n" + exit 1 +fi + +export MR_NDK_REL=$(grep -m 1 -o '^## r[0-9]*.*' $MR_ANDROID_NDK_HOME/CHANGELOG.md | awk '{print $2}') + +export MR_TOOLCHAIN_ROOT="$MR_ANDROID_NDK_HOME/toolchains/llvm/prebuilt/${MR_HOST_TAG}" +export PATH="${MR_TOOLCHAIN_ROOT}/bin:$PATH" +export MR_SYS_ROOT="${MR_TOOLCHAIN_ROOT}/sysroot" + # Using Make from the Android SDK -export MR_MAKE_EXECUTABLE=${ANDROID_NDK_HOME}/prebuilt/${MR_HOST_TAG}/bin/make +export MR_MAKE_EXECUTABLE=${MR_ANDROID_NDK_HOME}/prebuilt/${MR_HOST_TAG}/bin/make # Init Android plat env export MR_DEFAULT_ARCHS="armv7a arm64 x86 x86_64" \ No newline at end of file From 24c26524a44ac8ad4e90aa7f44e457789851cfea Mon Sep 17 00:00:00 2001 From: Anka Date: Fri, 6 Jun 2025 03:24:46 +0000 Subject: [PATCH 072/359] upgrade ijkffmpeg to ijkffmpeg-4.0-250606112050 for ios by cd --- configs/libs/ijkffmpeg.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/libs/ijkffmpeg.sh b/configs/libs/ijkffmpeg.sh index 3856416ed..69eefd21f 100644 --- a/configs/libs/ijkffmpeg.sh +++ b/configs/libs/ijkffmpeg.sh @@ -44,5 +44,5 @@ export PRE_COMPILE_TAG=ijkffmpeg-4.0-250311090211 export PRE_COMPILE_TAG_ANDROID=ijkffmpeg-4.0-250606110858 export PRE_COMPILE_TAG_TVOS=ijkffmpeg-4.0-250311090211 export PRE_COMPILE_TAG_MACOS=ijkffmpeg-4.0-250311090211 -export PRE_COMPILE_TAG_IOS=ijkffmpeg-4.0-250429152137 +export PRE_COMPILE_TAG_IOS=ijkffmpeg-4.0-250606112050 From 108d3c84496c0c8684838017ae6efee83a1ff105 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Fri, 6 Jun 2025 13:06:12 +0800 Subject: [PATCH 073/359] format ffmpeg4 patches --- .../ffmpeg-n4.0/0001-h264_ps-null-pointer-fault-tolerant.patch | 2 +- patches/ffmpeg-n4.0/0002-flv-support-hevc.patch | 2 +- patches/ffmpeg-n4.0/0003-dict-add-more-util-method.patch | 2 +- patches/ffmpeg-n4.0/0004-file-use-file_seek.patch | 2 +- patches/ffmpeg-n4.0/0005-avio-cache-about.patch | 2 +- .../ffmpeg-n4.0/0006-mov-add-allow_multi_extradata-opt.patch | 2 +- patches/ffmpeg-n4.0/0007-hls-read_header2.patch | 2 +- patches/ffmpeg-n4.0/0008-add-AV_PKT_FLAG_NEW_SEG.patch | 2 +- patches/ffmpeg-n4.0/0009-network-ff_sendto.patch | 2 +- patches/ffmpeg-n4.0/0010-tcp-hook.patch | 2 +- patches/ffmpeg-n4.0/0011-update-make-file.patch | 2 +- ...2-fix-ffmpeg-constructed-wrong-avcc-for-videotoolbox-h.patch | 2 +- patches/ffmpeg-n4.0/0013-fix-lrcdec-read-line-bug-on-osx.patch | 2 +- ...4-Correct-the-wrong-codecpar-codec_id-which-read-from-.patch | 2 +- ...5-support-to-parse-all-tracks-language-meta-when-open-.patch | 2 +- patches/ffmpeg-n4.0/0016-lavf-mov-add-heic-demuxer.patch | 2 +- 16 files changed, 16 insertions(+), 16 deletions(-) diff --git a/patches/ffmpeg-n4.0/0001-h264_ps-null-pointer-fault-tolerant.patch b/patches/ffmpeg-n4.0/0001-h264_ps-null-pointer-fault-tolerant.patch index 44c016fc0..8355fea12 100644 --- a/patches/ffmpeg-n4.0/0001-h264_ps-null-pointer-fault-tolerant.patch +++ b/patches/ffmpeg-n4.0/0001-h264_ps-null-pointer-fault-tolerant.patch @@ -1,7 +1,7 @@ From 396e4f1c0021145ee42866a302930dbb1e812838 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Fri, 29 Jul 2022 12:48:33 +0800 -Subject: [PATCH 01/16] h264_ps null pointer fault tolerant +Subject: [PATCH 01] h264_ps null pointer fault tolerant --- libavcodec/h264_ps.c | 8 ++++---- diff --git a/patches/ffmpeg-n4.0/0002-flv-support-hevc.patch b/patches/ffmpeg-n4.0/0002-flv-support-hevc.patch index 38939a954..cdb98540a 100644 --- a/patches/ffmpeg-n4.0/0002-flv-support-hevc.patch +++ b/patches/ffmpeg-n4.0/0002-flv-support-hevc.patch @@ -1,7 +1,7 @@ From 8dd266cd98e193b467774a50bb1cb648aeefa3e0 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Fri, 29 Jul 2022 14:19:54 +0800 -Subject: [PATCH] flv support hevc +Subject: [PATCH 02] flv support hevc --- libavformat/flv.h | 1 + diff --git a/patches/ffmpeg-n4.0/0003-dict-add-more-util-method.patch b/patches/ffmpeg-n4.0/0003-dict-add-more-util-method.patch index f0a22be43..a93326e63 100644 --- a/patches/ffmpeg-n4.0/0003-dict-add-more-util-method.patch +++ b/patches/ffmpeg-n4.0/0003-dict-add-more-util-method.patch @@ -1,7 +1,7 @@ From 77387f8a47c69225f336a7aeaf6a3e6298ebe2c3 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Fri, 29 Jul 2022 12:50:10 +0800 -Subject: [PATCH 03/16] dict add more util method +Subject: [PATCH 03] dict add more util method --- libavutil/dict.c | 39 ++++++++++++++++++++++++++++++++++++++- diff --git a/patches/ffmpeg-n4.0/0004-file-use-file_seek.patch b/patches/ffmpeg-n4.0/0004-file-use-file_seek.patch index a8b8532a6..512cef796 100644 --- a/patches/ffmpeg-n4.0/0004-file-use-file_seek.patch +++ b/patches/ffmpeg-n4.0/0004-file-use-file_seek.patch @@ -1,7 +1,7 @@ From 3fe418f1962704b301d68d9898b6102ec04dcde0 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Fri, 29 Jul 2022 12:54:09 +0800 -Subject: [PATCH 04/16] file use file_seek +Subject: [PATCH 04] file use file_seek --- libavformat/file.c | 3 ++- diff --git a/patches/ffmpeg-n4.0/0005-avio-cache-about.patch b/patches/ffmpeg-n4.0/0005-avio-cache-about.patch index e1a5bdc19..ef7bea66c 100644 --- a/patches/ffmpeg-n4.0/0005-avio-cache-about.patch +++ b/patches/ffmpeg-n4.0/0005-avio-cache-about.patch @@ -1,7 +1,7 @@ From 05b73eb2c510fc25f82cfc136f51a06031e6af44 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Fri, 29 Jul 2022 12:57:13 +0800 -Subject: [PATCH 05/16] avio cache about +Subject: [PATCH 05] avio cache about --- libavformat/avio.c | 6 ++---- diff --git a/patches/ffmpeg-n4.0/0006-mov-add-allow_multi_extradata-opt.patch b/patches/ffmpeg-n4.0/0006-mov-add-allow_multi_extradata-opt.patch index 44d8ea873..150bcc934 100644 --- a/patches/ffmpeg-n4.0/0006-mov-add-allow_multi_extradata-opt.patch +++ b/patches/ffmpeg-n4.0/0006-mov-add-allow_multi_extradata-opt.patch @@ -1,7 +1,7 @@ From 871fff7c5c8e7e702dccc2129e1ae64d7fe3f33b Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Fri, 29 Jul 2022 12:59:12 +0800 -Subject: [PATCH 06/16] mov add allow_multi_extradata opt +Subject: [PATCH 06] mov add allow_multi_extradata opt --- libavformat/isom.h | 2 ++ diff --git a/patches/ffmpeg-n4.0/0007-hls-read_header2.patch b/patches/ffmpeg-n4.0/0007-hls-read_header2.patch index df135a334..e7b528786 100644 --- a/patches/ffmpeg-n4.0/0007-hls-read_header2.patch +++ b/patches/ffmpeg-n4.0/0007-hls-read_header2.patch @@ -1,7 +1,7 @@ From b91fad7c8957a9eb97b9d383142b272f35f7778e Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Fri, 29 Jul 2022 12:59:58 +0800 -Subject: [PATCH 07/16] hls read_header2 +Subject: [PATCH 07] hls read_header2 --- libavformat/avformat.h | 5 ++ diff --git a/patches/ffmpeg-n4.0/0008-add-AV_PKT_FLAG_NEW_SEG.patch b/patches/ffmpeg-n4.0/0008-add-AV_PKT_FLAG_NEW_SEG.patch index c11cb57ff..f6a4c7f55 100644 --- a/patches/ffmpeg-n4.0/0008-add-AV_PKT_FLAG_NEW_SEG.patch +++ b/patches/ffmpeg-n4.0/0008-add-AV_PKT_FLAG_NEW_SEG.patch @@ -1,7 +1,7 @@ From 717083123cc79ab41c69629af584f89547797072 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Fri, 29 Jul 2022 12:57:50 +0800 -Subject: [PATCH 08/16] add AV_PKT_FLAG_NEW_SEG +Subject: [PATCH 08] add AV_PKT_FLAG_NEW_SEG --- libavcodec/avcodec.h | 1 + diff --git a/patches/ffmpeg-n4.0/0009-network-ff_sendto.patch b/patches/ffmpeg-n4.0/0009-network-ff_sendto.patch index d65a16465..83e53cc93 100644 --- a/patches/ffmpeg-n4.0/0009-network-ff_sendto.patch +++ b/patches/ffmpeg-n4.0/0009-network-ff_sendto.patch @@ -1,7 +1,7 @@ From 134e70adfd4add1ffb8ebfcc4cfb4f13ba2944ed Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Fri, 29 Jul 2022 13:00:17 +0800 -Subject: [PATCH 09/16] network ff_sendto +Subject: [PATCH 09] network ff_sendto --- libavformat/network.c | 46 +++++++++++++++++++++++++++++++++++++++++++ diff --git a/patches/ffmpeg-n4.0/0010-tcp-hook.patch b/patches/ffmpeg-n4.0/0010-tcp-hook.patch index fe97ab21d..d15e7784d 100644 --- a/patches/ffmpeg-n4.0/0010-tcp-hook.patch +++ b/patches/ffmpeg-n4.0/0010-tcp-hook.patch @@ -1,7 +1,7 @@ From 391125a7c250b027bded465ca88da11caaee8231 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Fri, 29 Jul 2022 13:01:01 +0800 -Subject: [PATCH 10/16] tcp hook +Subject: [PATCH 10] tcp hook --- libavformat/http.c | 53 +++- diff --git a/patches/ffmpeg-n4.0/0011-update-make-file.patch b/patches/ffmpeg-n4.0/0011-update-make-file.patch index 6cccb1033..cddd5c48a 100644 --- a/patches/ffmpeg-n4.0/0011-update-make-file.patch +++ b/patches/ffmpeg-n4.0/0011-update-make-file.patch @@ -1,7 +1,7 @@ From 0dc8f7a7858d66dd17d65614189c640dab2f68a8 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Fri, 29 Jul 2022 13:01:10 +0800 -Subject: [PATCH 11/16] update make file +Subject: [PATCH 11] update make file --- libavformat/Makefile | 9 +++++++++ diff --git a/patches/ffmpeg-n4.0/0012-fix-ffmpeg-constructed-wrong-avcc-for-videotoolbox-h.patch b/patches/ffmpeg-n4.0/0012-fix-ffmpeg-constructed-wrong-avcc-for-videotoolbox-h.patch index de661f940..6b79df05c 100644 --- a/patches/ffmpeg-n4.0/0012-fix-ffmpeg-constructed-wrong-avcc-for-videotoolbox-h.patch +++ b/patches/ffmpeg-n4.0/0012-fix-ffmpeg-constructed-wrong-avcc-for-videotoolbox-h.patch @@ -1,7 +1,7 @@ From 86fccbeadf36bcee5a800d63d51dba8560434298 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Mon, 16 May 2022 16:15:10 +0800 -Subject: [PATCH 12/16] fix ffmpeg constructed wrong avcc for videotoolbox +Subject: [PATCH 12] fix ffmpeg constructed wrong avcc for videotoolbox hwaccel. --- diff --git a/patches/ffmpeg-n4.0/0013-fix-lrcdec-read-line-bug-on-osx.patch b/patches/ffmpeg-n4.0/0013-fix-lrcdec-read-line-bug-on-osx.patch index 68a383c7e..afeeb81d3 100644 --- a/patches/ffmpeg-n4.0/0013-fix-lrcdec-read-line-bug-on-osx.patch +++ b/patches/ffmpeg-n4.0/0013-fix-lrcdec-read-line-bug-on-osx.patch @@ -1,7 +1,7 @@ From 015c7279c0e3580be66fe87063dcf48298191199 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Wed, 27 Apr 2022 17:01:17 +0800 -Subject: [PATCH 13/16] fix lrcdec read line bug on osx. +Subject: [PATCH 13] fix lrcdec read line bug on osx. --- libavformat/lrcdec.c | 20 +++++++++++--------- diff --git a/patches/ffmpeg-n4.0/0014-Correct-the-wrong-codecpar-codec_id-which-read-from-.patch b/patches/ffmpeg-n4.0/0014-Correct-the-wrong-codecpar-codec_id-which-read-from-.patch index 3ffc0f1da..cf0bfae73 100644 --- a/patches/ffmpeg-n4.0/0014-Correct-the-wrong-codecpar-codec_id-which-read-from-.patch +++ b/patches/ffmpeg-n4.0/0014-Correct-the-wrong-codecpar-codec_id-which-read-from-.patch @@ -1,7 +1,7 @@ From 3f27485e4d79e17ff598c0aabecd24d0d9381e43 Mon Sep 17 00:00:00 2001 From: YoushiQian Date: Mon, 9 May 2022 09:53:18 +0800 -Subject: [PATCH 14/16] Correct the wrong codecpar->codec_id which read from +Subject: [PATCH 14] Correct the wrong codecpar->codec_id which read from MIME of ID3tags, but the real data was encoded in PNG/JPEG/TIFF --- diff --git a/patches/ffmpeg-n4.0/0015-support-to-parse-all-tracks-language-meta-when-open-.patch b/patches/ffmpeg-n4.0/0015-support-to-parse-all-tracks-language-meta-when-open-.patch index 7f1ead3e0..3ff2af72a 100644 --- a/patches/ffmpeg-n4.0/0015-support-to-parse-all-tracks-language-meta-when-open-.patch +++ b/patches/ffmpeg-n4.0/0015-support-to-parse-all-tracks-language-meta-when-open-.patch @@ -1,7 +1,7 @@ From d8265ca339e8549f481d470e7a3943820a5ac44a Mon Sep 17 00:00:00 2001 From: YoushiQian Date: Wed, 8 Jun 2022 14:07:32 +0800 -Subject: [PATCH 15/16] support to parse all tracks' language meta when open +Subject: [PATCH 15] support to parse all tracks' language meta when open the bluray input --- diff --git a/patches/ffmpeg-n4.0/0016-lavf-mov-add-heic-demuxer.patch b/patches/ffmpeg-n4.0/0016-lavf-mov-add-heic-demuxer.patch index 6ce1f7e35..f558742de 100644 --- a/patches/ffmpeg-n4.0/0016-lavf-mov-add-heic-demuxer.patch +++ b/patches/ffmpeg-n4.0/0016-lavf-mov-add-heic-demuxer.patch @@ -1,7 +1,7 @@ From 509423fcdd289709d5ff30b17ef69499ae7492c1 Mon Sep 17 00:00:00 2001 From: youshiqian Date: Wed, 31 Aug 2022 11:44:24 +0800 -Subject: [PATCH] lavf/mov: add heic demuxer +Subject: [PATCH 16] lavf/mov: add heic demuxer (https://github.com/bluez-sh/FFmpeg/commit/9a885cddb3550ab863a60d02c5fb78e4ae206cf1). refer to below links for details: https://trac.ffmpeg.org/ticket/6521 https://trac.ffmpeg.org/ticket/7621#comment:10 From c319bec09336586eb5dd3133941810da73b22111 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Fri, 6 Jun 2025 13:07:10 +0800 Subject: [PATCH 074/359] andorid needn't enable dash again --- README.md | 2 +- do-compile/android/ffmpeg.sh | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 0ea099de2..5b080b6fb 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ## MRFFToolChain Build Shell -![](https://img.shields.io/github/downloads/debugly/MRFFToolChainBuildShell/total) +![](https://img.shields.io/github/downloads/debugly/MRFFToolChainBuildShell/total) **What's MRFFToolChain?** diff --git a/do-compile/android/ffmpeg.sh b/do-compile/android/ffmpeg.sh index 33e71e2f5..6b148f51d 100755 --- a/do-compile/android/ffmpeg.sh +++ b/do-compile/android/ffmpeg.sh @@ -37,7 +37,6 @@ source $MR_SHELL_CONFIGS_DIR/ffconfig/auto-detect-third-libs.sh CFG_FLAGS= CFG_FLAGS="$CFG_FLAGS $COMMON_FF_CFG_FLAGS" CFG_FLAGS="$CFG_FLAGS $THIRD_CFG_FLAGS" -CFG_FLAGS="$CFG_FLAGS --enable-demuxer=dash --enable-libxml2" # Android 15 with 16 kb page size support # https://developer.android.com/guide/practices/page-sizes#compile-r27 From 1749e158ec67214be1b53b8a76330751c23e6f1d Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Fri, 6 Jun 2025 13:09:04 +0800 Subject: [PATCH 075/359] fix test.c:1:10: fatal error: 'libxml2/libxml/xmlversion.h' --- ...fatal-error-libxml2-libxml-xmlversio.patch | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 patches/ffmpeg-n4.0/0017-fix-test.c-1-10-fatal-error-libxml2-libxml-xmlversio.patch diff --git a/patches/ffmpeg-n4.0/0017-fix-test.c-1-10-fatal-error-libxml2-libxml-xmlversio.patch b/patches/ffmpeg-n4.0/0017-fix-test.c-1-10-fatal-error-libxml2-libxml-xmlversio.patch new file mode 100644 index 000000000..88463abaa --- /dev/null +++ b/patches/ffmpeg-n4.0/0017-fix-test.c-1-10-fatal-error-libxml2-libxml-xmlversio.patch @@ -0,0 +1,26 @@ +From 0ca2211639dcef90bdf463998d6124b1eff86e8e Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Fri, 6 Jun 2025 13:08:04 +0800 +Subject: [PATCH 17] fix test.c:1:10: fatal error: 'libxml2/libxml/xmlversion.h' + file not found + +--- + configure | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/configure b/configure +index 15e6c32..3b25725 100755 +--- a/configure ++++ b/configure +@@ -6112,7 +6112,7 @@ enabled libzmq && require_pkg_config libzmq libzmq zmq.h zmq_ctx_new + enabled libzvbi && require_pkg_config libzvbi zvbi-0.2 libzvbi.h vbi_decoder_new && + { test_cpp_condition libzvbi.h "VBI_VERSION_MAJOR > 0 || VBI_VERSION_MINOR > 2 || VBI_VERSION_MINOR == 2 && VBI_VERSION_MICRO >= 28" || + enabled gpl || die "ERROR: libzvbi requires version 0.2.28 or --enable-gpl."; } +-enabled libxml2 && require_pkg_config libxml2 libxml-2.0 libxml2/libxml/xmlversion.h xmlCheckVersion ++enabled libxml2 && require_pkg_config libxml2 libxml-2.0 libxml/xmlversion.h xmlCheckVersion + enabled mediacodec && { enabled jni || die "ERROR: mediacodec requires --enable-jni"; } + enabled mmal && { check_lib mmal interface/mmal/mmal.h mmal_port_connect -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host || + { ! enabled cross_compile && +-- +2.39.5 (Apple Git-154) + From 706d6f50488381eaf74f0446cbf7013649bffd22 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Fri, 6 Jun 2025 13:11:04 +0800 Subject: [PATCH 076/359] android support dvdnav --- do-compile/android/dvdnav.sh | 75 ++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100755 do-compile/android/dvdnav.sh diff --git a/do-compile/android/dvdnav.sh b/do-compile/android/dvdnav.sh new file mode 100755 index 000000000..3cee4d28e --- /dev/null +++ b/do-compile/android/dvdnav.sh @@ -0,0 +1,75 @@ +#! /usr/bin/env bash +# +# Copyright (C) 2021 Matt Reach + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +set -e + +THIS_DIR=$(DIRNAME=$(dirname "$0"); cd "$DIRNAME"; pwd) +cd "$THIS_DIR" + +# prepare build config +CFG_FLAGS="--prefix=$MR_BUILD_PREFIX --disable-dependency-tracking --disable-silent-rules --disable-apidoc --enable-static --disable-shared" +CFLAGS="$MR_DEFAULT_CFLAGS" + +if [[ "$MR_DEBUG" == "debug" ]];then + CFG_FLAGS="${CFG_FLAGS} use_examples=yes" +fi + +# for cross compile +if [[ $(uname -m) != "$MR_ARCH" || "$MR_FORCE_CROSS" ]];then + echo "[*] cross compile, on $(uname -m) compile $MR_PLAT $MR_ARCH." + # https://www.gnu.org/software/automake/manual/html_node/Cross_002dCompilation.html + # aarch64-linux-android21 + CFG_FLAGS="$CFG_FLAGS --host=$MR_FF_ARCH-linux-android$MR_ANDROID_API --with-sysroot=$MR_SYS_ROOT" +fi + +echo "----------------------" +echo "[*] configurate $LIB_NAME" +echo "----------------------" + +cd $MR_BUILD_SOURCE + +if [[ -f 'configure' ]]; then + echo "reuse configure" +else + echo "auto generate configure" + autoreconf -if >/dev/null +fi + + +echo +echo "CC: $MR_TRIPLE_CC" +echo "CFG_FLAGS: $CFG_FLAGS" +echo "CFLAGS: $CFLAGS" +echo + +export CFLAGS="$CFLAGS" +export LDFLAGS="$CFLAGS" +export STRIP="$MR_STRIP" +export CC="$MR_TRIPLE_CC" +export CXX="$MR_TRIPLE_CXX" +export AR="$MR_AR" +export AS="$MR_AS" +export RANLIB="$MR_RANLIB" + +./configure $CFG_FLAGS + +#---------------------- +echo "----------------------" +echo "[*] compile $LIB_NAME" +echo "----------------------" + +make install -j$MR_HOST_NPROC >/dev/null \ No newline at end of file From 329c5a8847a70609276f03d0ff1a29b8b4cc6b26 Mon Sep 17 00:00:00 2001 From: Anka Date: Fri, 6 Jun 2025 05:13:06 +0000 Subject: [PATCH 077/359] upgrade dvdnav to dvdnav-9831fe01-250606131218 for android by cd --- configs/libs/dvdnav.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/libs/dvdnav.sh b/configs/libs/dvdnav.sh index ea80002be..bcbe223f4 100644 --- a/configs/libs/dvdnav.sh +++ b/configs/libs/dvdnav.sh @@ -42,4 +42,4 @@ export PRE_COMPILE_TAG= export PRE_COMPILE_TAG_TVOS=dvdnav-9831fe01-250603094852 export PRE_COMPILE_TAG_MACOS=dvdnav-9831fe01-250529152421 export PRE_COMPILE_TAG_IOS=dvdnav-9831fe01-250603094547 -export PRE_COMPILE_TAG_ANDROID= +export PRE_COMPILE_TAG_ANDROID=dvdnav-9831fe01-250606131218 From 02108743d6374b328fdb9105747884e5e6ad4948 Mon Sep 17 00:00:00 2001 From: Anka Date: Fri, 6 Jun 2025 05:17:30 +0000 Subject: [PATCH 078/359] upgrade ffmpeg4 to ffmpeg4-4.0.5-250606131114 for android by cd --- configs/libs/ffmpeg4.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/libs/ffmpeg4.sh b/configs/libs/ffmpeg4.sh index 83d4e4620..a58c90e06 100644 --- a/configs/libs/ffmpeg4.sh +++ b/configs/libs/ffmpeg4.sh @@ -44,4 +44,4 @@ fi export PRE_COMPILE_TAG_TVOS=ffmpeg4-4.0.5-250605190152 export PRE_COMPILE_TAG_MACOS=ffmpeg4-4.0.5-250605190152 export PRE_COMPILE_TAG_IOS=ffmpeg4-4.0.5-250605190152 -export PRE_COMPILE_TAG_ANDROID= \ No newline at end of file +export PRE_COMPILE_TAG_ANDROID=ffmpeg4-4.0.5-250606131114 \ No newline at end of file From 0db4238c10a90315696b871eb0cf2b33b6d208d1 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Fri, 6 Jun 2025 14:05:28 +0800 Subject: [PATCH 079/359] fix android ffmpeg5 test.c:1:10: fatal error: 'libxml2/libxml/xmlversion.h' --- ...eg5-test.c-1-10-fatal-error-libxml2-.patch | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 patches/ffmpeg-n5.1/0021-fix-android-ffmpeg5-test.c-1-10-fatal-error-libxml2-.patch diff --git a/patches/ffmpeg-n5.1/0021-fix-android-ffmpeg5-test.c-1-10-fatal-error-libxml2-.patch b/patches/ffmpeg-n5.1/0021-fix-android-ffmpeg5-test.c-1-10-fatal-error-libxml2-.patch new file mode 100644 index 000000000..1572dc5e2 --- /dev/null +++ b/patches/ffmpeg-n5.1/0021-fix-android-ffmpeg5-test.c-1-10-fatal-error-libxml2-.patch @@ -0,0 +1,26 @@ +From ef9366b55686e04b680471a21b2d51829962fa30 Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Fri, 6 Jun 2025 14:04:00 +0800 +Subject: [PATCH 21] fix android ffmpeg5 test.c:1:10: fatal error: + 'libxml2/libxml/xmlversion.h' + +--- + configure | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/configure b/configure +index 231b18d..4fe7922 100755 +--- a/configure ++++ b/configure +@@ -6688,7 +6688,7 @@ enabled libzmq && require_pkg_config libzmq "libzmq >= 4.2.1" zmq.h z + enabled libzvbi && require_pkg_config libzvbi zvbi-0.2 libzvbi.h vbi_decoder_new && + { test_cpp_condition libzvbi.h "VBI_VERSION_MAJOR > 0 || VBI_VERSION_MINOR > 2 || VBI_VERSION_MINOR == 2 && VBI_VERSION_MICRO >= 28" || + enabled gpl || die "ERROR: libzvbi requires version 0.2.28 or --enable-gpl."; } +-enabled libxml2 && require_pkg_config libxml2 libxml-2.0 libxml2/libxml/xmlversion.h xmlCheckVersion ++enabled libxml2 && require_pkg_config libxml2 libxml-2.0 libxml/xmlversion.h xmlCheckVersion + enabled mbedtls && { check_pkg_config mbedtls mbedtls mbedtls/x509_crt.h mbedtls_x509_crt_init || + check_pkg_config mbedtls mbedtls mbedtls/ssl.h mbedtls_ssl_init || + check_lib mbedtls mbedtls/ssl.h mbedtls_ssl_init -lmbedtls -lmbedx509 -lmbedcrypto || +-- +2.39.5 (Apple Git-154) + From 1a4f60672e90440197c25567517f96c7e1302e10 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Fri, 6 Jun 2025 14:08:04 +0800 Subject: [PATCH 080/359] fix android ffmpeg6 test.c:1:10: fatal error: 'libxml2/libxml/xmlversion.h' --- ...eg6-test.c-1-10-fatal-error-libxml2-.patch | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 patches/ffmpeg-n6.1/0032-fix-android-ffmpeg6-test.c-1-10-fatal-error-libxml2-.patch diff --git a/patches/ffmpeg-n6.1/0032-fix-android-ffmpeg6-test.c-1-10-fatal-error-libxml2-.patch b/patches/ffmpeg-n6.1/0032-fix-android-ffmpeg6-test.c-1-10-fatal-error-libxml2-.patch new file mode 100644 index 000000000..f309f9c71 --- /dev/null +++ b/patches/ffmpeg-n6.1/0032-fix-android-ffmpeg6-test.c-1-10-fatal-error-libxml2-.patch @@ -0,0 +1,26 @@ +From 57d11e82ad725d7c598378b70c6288bb96cc9e58 Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Fri, 6 Jun 2025 14:07:11 +0800 +Subject: [PATCH 32] fix android ffmpeg6 test.c:1:10: fatal error: + 'libxml2/libxml/xmlversion.h' + +--- + configure | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/configure b/configure +index fb18d97..2cd5e11 100755 +--- a/configure ++++ b/configure +@@ -6871,7 +6871,7 @@ enabled libzmq && require_pkg_config libzmq "libzmq >= 4.2.1" zmq.h z + enabled libzvbi && require_pkg_config libzvbi zvbi-0.2 libzvbi.h vbi_decoder_new && + { test_cpp_condition libzvbi.h "VBI_VERSION_MAJOR > 0 || VBI_VERSION_MINOR > 2 || VBI_VERSION_MINOR == 2 && VBI_VERSION_MICRO >= 28" || + enabled gpl || die "ERROR: libzvbi requires version 0.2.28 or --enable-gpl."; } +-enabled libxml2 && require_pkg_config libxml2 libxml-2.0 libxml2/libxml/xmlversion.h xmlCheckVersion ++enabled libxml2 && require_pkg_config libxml2 libxml-2.0 libxml/xmlversion.h xmlCheckVersion + enabled mbedtls && { check_pkg_config mbedtls mbedtls mbedtls/x509_crt.h mbedtls_x509_crt_init || + check_pkg_config mbedtls mbedtls mbedtls/ssl.h mbedtls_ssl_init || + check_lib mbedtls mbedtls/ssl.h mbedtls_ssl_init -lmbedtls -lmbedx509 -lmbedcrypto || +-- +2.39.5 (Apple Git-154) + From 5d155dfda194e1918e221e3d6944ac4826f1cbb5 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Fri, 6 Jun 2025 14:11:22 +0800 Subject: [PATCH 081/359] fix android ffmpeg7 test.c:1:10: fatal error: 'libxml2/libxml/xmlversion.h' --- ...eg7-test.c-1-10-fatal-error-libxml2-.patch | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 patches/ffmpeg-n7.1.1/0031-fix-android-ffmpeg7-test.c-1-10-fatal-error-libxml2-.patch diff --git a/patches/ffmpeg-n7.1.1/0031-fix-android-ffmpeg7-test.c-1-10-fatal-error-libxml2-.patch b/patches/ffmpeg-n7.1.1/0031-fix-android-ffmpeg7-test.c-1-10-fatal-error-libxml2-.patch new file mode 100644 index 000000000..6b3c9421f --- /dev/null +++ b/patches/ffmpeg-n7.1.1/0031-fix-android-ffmpeg7-test.c-1-10-fatal-error-libxml2-.patch @@ -0,0 +1,26 @@ +From 9c71daf077d488023f72d1d27eb1283bfecce00f Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Fri, 6 Jun 2025 14:09:50 +0800 +Subject: [PATCH] fix android ffmpeg7 test.c:1:10: fatal error: + 'libxml2/libxml/xmlversion.h' + +--- + configure | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/configure b/configure +index f74d4de..7daa9ff 100755 +--- a/configure ++++ b/configure +@@ -7063,7 +7063,7 @@ enabled libzmq && require_pkg_config libzmq "libzmq >= 4.2.1" zmq.h z + enabled libzvbi && require_pkg_config libzvbi zvbi-0.2 libzvbi.h vbi_decoder_new && + { test_cpp_condition libzvbi.h "VBI_VERSION_MAJOR > 0 || VBI_VERSION_MINOR > 2 || VBI_VERSION_MINOR == 2 && VBI_VERSION_MICRO >= 28" || + enabled gpl || die "ERROR: libzvbi requires version 0.2.28 or --enable-gpl."; } +-enabled libxml2 && require_pkg_config libxml2 libxml-2.0 libxml2/libxml/xmlversion.h xmlCheckVersion ++enabled libxml2 && require_pkg_config libxml2 libxml-2.0 libxml/xmlversion.h xmlCheckVersion + enabled mbedtls && { check_pkg_config mbedtls mbedtls mbedtls/x509_crt.h mbedtls_x509_crt_init || + check_pkg_config mbedtls mbedtls mbedtls/ssl.h mbedtls_ssl_init || + check_lib mbedtls mbedtls/ssl.h mbedtls_ssl_init -lmbedtls -lmbedx509 -lmbedcrypto || +-- +2.39.5 (Apple Git-154) + From ba71c6f4e5a96b198565cad5acfd1d95d991de91 Mon Sep 17 00:00:00 2001 From: Anka Date: Fri, 6 Jun 2025 06:13:08 +0000 Subject: [PATCH 082/359] upgrade ffmpeg5 to ffmpeg5-5.1.6-250606140646 for android by cd --- configs/libs/ffmpeg5.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/libs/ffmpeg5.sh b/configs/libs/ffmpeg5.sh index c5c5bdae9..a3faab9e1 100644 --- a/configs/libs/ffmpeg5.sh +++ b/configs/libs/ffmpeg5.sh @@ -44,4 +44,4 @@ fi export PRE_COMPILE_TAG_TVOS=ffmpeg5-5.1.6-250606091027 export PRE_COMPILE_TAG_MACOS=ffmpeg5-5.1.6-250606091027 export PRE_COMPILE_TAG_IOS=ffmpeg5-5.1.6-250606091027 -export PRE_COMPILE_TAG_ANDROID= \ No newline at end of file +export PRE_COMPILE_TAG_ANDROID=ffmpeg5-5.1.6-250606140646 \ No newline at end of file From 26d49df3999f0300a80129da23697b2c3412106d Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Fri, 6 Jun 2025 14:22:03 +0800 Subject: [PATCH 083/359] rm PRE_COMPILE_TAG --- .github/workflows/onestep.sh | 12 ++---------- configs/libs/ass.sh | 1 - configs/libs/bluray.sh | 1 - configs/libs/dav1d.sh | 1 - configs/libs/dvdnav.sh | 1 - configs/libs/dvdread.sh | 1 - configs/libs/ffmpeg6.sh | 1 - configs/libs/fftutorial.sh | 1 - configs/libs/fontconfig.sh | 4 +++- configs/libs/freetype.sh | 1 - configs/libs/fribidi.sh | 1 - configs/libs/harfbuzz.sh | 1 - configs/libs/ijkffmpeg.sh | 1 - configs/libs/openssl.sh | 1 - configs/libs/openssl3.sh | 1 - configs/libs/opus.sh | 1 - configs/libs/smb2.sh | 1 - configs/libs/soundtouch.sh | 1 - configs/libs/test.sh | 1 - configs/libs/uavs3d.sh | 1 - configs/libs/unibreak.sh | 1 - configs/libs/xml2.sh | 5 ++++- configs/libs/yuv.sh | 1 - do-install/main.sh | 6 ------ 24 files changed, 9 insertions(+), 38 deletions(-) diff --git a/.github/workflows/onestep.sh b/.github/workflows/onestep.sh index fd9ed7675..b50b71e0c 100755 --- a/.github/workflows/onestep.sh +++ b/.github/workflows/onestep.sh @@ -98,15 +98,8 @@ function replace_tag() # replace PRE_COMPILE_TAG_IOS=new_tag sed -i "" "s/^export $key=.*/export $key=$TAG/" $file else - # PRE_COMPILE_TAG_IOS not found, check PRE_COMPILE_TAG - if grep -q "PRE_COMPILE_TAG" "$file"; then - # insert PRE_COMPILE_TAG_IOS=new_tag after PRE_COMPILE_TAG -sed -i "" "/PRE_COMPILE_TAG=/a\\ -export $key=$TAG -" "$file" - else - echo "can't find PRE_COMPILE_TAG in $file" - fi + # PRE_COMPILE_TAG_IOS not found, append PRE_COMPILE_TAG_IOS + echo "export $key=$TAG" >> $file fi } @@ -132,7 +125,6 @@ function upgrade() replace_tag $file PRE_COMPILE_TAG_ANDROID ;; all) - replace_tag $file PRE_COMPILE_TAG replace_tag $file PRE_COMPILE_TAG_IOS replace_tag $file PRE_COMPILE_TAG_MACOS replace_tag $file PRE_COMPILE_TAG_TVOS diff --git a/configs/libs/ass.sh b/configs/libs/ass.sh index 15bd7918e..ddf307524 100644 --- a/configs/libs/ass.sh +++ b/configs/libs/ass.sh @@ -38,7 +38,6 @@ else fi # pre compiled -export PRE_COMPILE_TAG=ass-0.17.3-250226075040 export PRE_COMPILE_TAG_TVOS=ass-0.17.3-250226211935 export PRE_COMPILE_TAG_MACOS=ass-0.17.3-250226205926 export PRE_COMPILE_TAG_IOS=ass-0.17.3-250226175156 diff --git a/configs/libs/bluray.sh b/configs/libs/bluray.sh index 43841a1f8..b8cff4645 100644 --- a/configs/libs/bluray.sh +++ b/configs/libs/bluray.sh @@ -40,7 +40,6 @@ else fi # pre compiled -export PRE_COMPILE_TAG=bluray-1.3.4-250226080029 export PRE_COMPILE_TAG_TVOS=bluray-1.3.4-250226212622 export PRE_COMPILE_TAG_MACOS=bluray-1.3.4-250226210447 export PRE_COMPILE_TAG_IOS=bluray-1.3.4-250226175920 diff --git a/configs/libs/dav1d.sh b/configs/libs/dav1d.sh index 07232d233..b64871464 100644 --- a/configs/libs/dav1d.sh +++ b/configs/libs/dav1d.sh @@ -33,7 +33,6 @@ else fi # pre compiled -export PRE_COMPILE_TAG=dav1d-1.5.1-250226080235 export PRE_COMPILE_TAG_TVOS=dav1d-1.5.1-250226212720 export PRE_COMPILE_TAG_MACOS=dav1d-1.5.1-250226210526 export PRE_COMPILE_TAG_IOS=dav1d-1.5.1-250226180013 diff --git a/configs/libs/dvdnav.sh b/configs/libs/dvdnav.sh index bcbe223f4..fad3308cf 100644 --- a/configs/libs/dvdnav.sh +++ b/configs/libs/dvdnav.sh @@ -38,7 +38,6 @@ else fi # pre compiled -export PRE_COMPILE_TAG= export PRE_COMPILE_TAG_TVOS=dvdnav-9831fe01-250603094852 export PRE_COMPILE_TAG_MACOS=dvdnav-9831fe01-250529152421 export PRE_COMPILE_TAG_IOS=dvdnav-9831fe01-250603094547 diff --git a/configs/libs/dvdread.sh b/configs/libs/dvdread.sh index 573cbd068..115dee5ef 100644 --- a/configs/libs/dvdread.sh +++ b/configs/libs/dvdread.sh @@ -38,7 +38,6 @@ else fi # pre compiled -export PRE_COMPILE_TAG=dvdread-6.1.3-250226075913 export PRE_COMPILE_TAG_TVOS=dvdread-6.1.3-250226212540 export PRE_COMPILE_TAG_MACOS=dvdread-6.1.3-250226210420 export PRE_COMPILE_TAG_IOS=dvdread-6.1.3-250226175845 diff --git a/configs/libs/ffmpeg6.sh b/configs/libs/ffmpeg6.sh index 87c19668e..a2676194a 100644 --- a/configs/libs/ffmpeg6.sh +++ b/configs/libs/ffmpeg6.sh @@ -41,7 +41,6 @@ else fi # pre compiled -export PRE_COMPILE_TAG=ffmpeg-6.1.2-250227145407 export PRE_COMPILE_TAG_TVOS=ffmpeg6-6.1.1-250605190133 export PRE_COMPILE_TAG_MACOS=ffmpeg6-6.1.1-250605190133 export PRE_COMPILE_TAG_IOS=ffmpeg6-6.1.1-250605190133 diff --git a/configs/libs/fftutorial.sh b/configs/libs/fftutorial.sh index a3a8814c8..13c63340b 100644 --- a/configs/libs/fftutorial.sh +++ b/configs/libs/fftutorial.sh @@ -40,7 +40,6 @@ else fi # pre compiled -export PRE_COMPILE_TAG= export PRE_COMPILE_TAG_TVOS=fftutorial-6.1.1-250413171857 export PRE_COMPILE_TAG_MACOS=fftutorial-6.1.1-250413171857 export PRE_COMPILE_TAG_IOS=fftutorial-6.1.1-250413171857 diff --git a/configs/libs/fontconfig.sh b/configs/libs/fontconfig.sh index 885e5f05b..5a3f03555 100644 --- a/configs/libs/fontconfig.sh +++ b/configs/libs/fontconfig.sh @@ -33,5 +33,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG=fontconfig-2.16.0-250226074147 +export PRE_COMPILE_TAG_IOS=fontconfig-2.16.0-250226074147 +export PRE_COMPILE_TAG_TVOS=fontconfig-2.16.0-250226074147 +export PRE_COMPILE_TAG_MACOS=fontconfig-2.16.0-250226074147 export PRE_COMPILE_TAG_ANDROID=fontconfig-2.16.0-250310111812 diff --git a/configs/libs/freetype.sh b/configs/libs/freetype.sh index 240dffbab..d87140d92 100644 --- a/configs/libs/freetype.sh +++ b/configs/libs/freetype.sh @@ -36,7 +36,6 @@ else fi # pre compiled -export PRE_COMPILE_TAG=freetype-2.13.3-250225223932 export PRE_COMPILE_TAG_TVOS=freetype-2.13.3-250226211539 export PRE_COMPILE_TAG_MACOS=freetype-2.13.3-250226205646 export PRE_COMPILE_TAG_IOS=freetype-2.13.3-250226174825 diff --git a/configs/libs/fribidi.sh b/configs/libs/fribidi.sh index 483d4357f..6d6f6288b 100644 --- a/configs/libs/fribidi.sh +++ b/configs/libs/fribidi.sh @@ -38,7 +38,6 @@ else fi # pre compiled -export PRE_COMPILE_TAG=fribidi-1.0.16-250225223849 export PRE_COMPILE_TAG_TVOS=fribidi-1.0.16-250226211508 export PRE_COMPILE_TAG_MACOS=fribidi-1.0.16-250226205618 export PRE_COMPILE_TAG_IOS=fribidi-1.0.16-250226174802 diff --git a/configs/libs/harfbuzz.sh b/configs/libs/harfbuzz.sh index fbbd18f92..332332a58 100644 --- a/configs/libs/harfbuzz.sh +++ b/configs/libs/harfbuzz.sh @@ -38,7 +38,6 @@ else fi # pre compiled -export PRE_COMPILE_TAG=harfbuzz-10.2.0-250226074405 export PRE_COMPILE_TAG_TVOS=harfbuzz-10.2.0-250226211621 export PRE_COMPILE_TAG_MACOS=harfbuzz-10.2.0-250226205723 export PRE_COMPILE_TAG_IOS=harfbuzz-10.2.0-250226174909 diff --git a/configs/libs/ijkffmpeg.sh b/configs/libs/ijkffmpeg.sh index 69eefd21f..17f903ca7 100644 --- a/configs/libs/ijkffmpeg.sh +++ b/configs/libs/ijkffmpeg.sh @@ -40,7 +40,6 @@ else fi # pre compiled -export PRE_COMPILE_TAG=ijkffmpeg-4.0-250311090211 export PRE_COMPILE_TAG_ANDROID=ijkffmpeg-4.0-250606110858 export PRE_COMPILE_TAG_TVOS=ijkffmpeg-4.0-250311090211 export PRE_COMPILE_TAG_MACOS=ijkffmpeg-4.0-250311090211 diff --git a/configs/libs/openssl.sh b/configs/libs/openssl.sh index 4fe200e46..2cc8d26da 100644 --- a/configs/libs/openssl.sh +++ b/configs/libs/openssl.sh @@ -30,7 +30,6 @@ else fi # pre compiled -export PRE_COMPILE_TAG=openssl-1.1.1w-250306132030 export PRE_COMPILE_TAG_TVOS=openssl-1.1.1w-250318092610 export PRE_COMPILE_TAG_MACOS=openssl-1.1.1w-250318092610 export PRE_COMPILE_TAG_IOS=openssl-1.1.1w-250318092610 diff --git a/configs/libs/openssl3.sh b/configs/libs/openssl3.sh index 95fae1c64..c1587a8f0 100644 --- a/configs/libs/openssl3.sh +++ b/configs/libs/openssl3.sh @@ -30,7 +30,6 @@ else fi # pre compiled -export PRE_COMPILE_TAG= export PRE_COMPILE_TAG_TVOS=openssl3-3.5.0-250605155209 export PRE_COMPILE_TAG_MACOS=openssl3-3.5.0-250605155209 export PRE_COMPILE_TAG_IOS=openssl3-3.5.0-250605155209 diff --git a/configs/libs/opus.sh b/configs/libs/opus.sh index 8a58435f5..5f6d0a453 100644 --- a/configs/libs/opus.sh +++ b/configs/libs/opus.sh @@ -39,7 +39,6 @@ else fi # pre compiled -export PRE_COMPILE_TAG=opus-1.5.2-250226075128 export PRE_COMPILE_TAG_TVOS=opus-1.5.2-250226212130 export PRE_COMPILE_TAG_MACOS=opus-1.5.2-250226210054 export PRE_COMPILE_TAG_IOS=opus-1.5.2-250226175406 diff --git a/configs/libs/smb2.sh b/configs/libs/smb2.sh index e8752866b..aa54956ca 100644 --- a/configs/libs/smb2.sh +++ b/configs/libs/smb2.sh @@ -40,7 +40,6 @@ else fi # pre compiled -export PRE_COMPILE_TAG=smb2-6.2-250226080535 export PRE_COMPILE_TAG_TVOS=smb2-6.2-250226212919 export PRE_COMPILE_TAG_MACOS=smb2-6.2-250226210647 export PRE_COMPILE_TAG_IOS=smb2-6.2-250226180157 diff --git a/configs/libs/soundtouch.sh b/configs/libs/soundtouch.sh index 2893c1120..979090df1 100644 --- a/configs/libs/soundtouch.sh +++ b/configs/libs/soundtouch.sh @@ -40,7 +40,6 @@ else fi # pre compiled -export PRE_COMPILE_TAG=soundtouch-2.3.3-250225223556 export PRE_COMPILE_TAG_TVOS=soundtouch-2.3.3-250226212055 export PRE_COMPILE_TAG_MACOS=soundtouch-2.3.3-250226210026 export PRE_COMPILE_TAG_IOS=soundtouch-2.3.3-250226175330 diff --git a/configs/libs/test.sh b/configs/libs/test.sh index 9416245e5..2af621806 100644 --- a/configs/libs/test.sh +++ b/configs/libs/test.sh @@ -38,7 +38,6 @@ else fi # pre compiled -export PRE_COMPILE_TAG=test-1.4-250312130817 export PRE_COMPILE_TAG_ANDROID=test-1.4-250312130817 export PRE_COMPILE_TAG_TVOS=test-1.4-250312130817 export PRE_COMPILE_TAG_MACOS=test-1.4-250312130817 diff --git a/configs/libs/uavs3d.sh b/configs/libs/uavs3d.sh index 3cc62e698..d707b474c 100644 --- a/configs/libs/uavs3d.sh +++ b/configs/libs/uavs3d.sh @@ -38,7 +38,6 @@ else fi # pre compiled -export PRE_COMPILE_TAG=uavs3d-1.2.1-250226151333 export PRE_COMPILE_TAG_ANDROID=uavs3d-1.2.1-250310113007 export PRE_COMPILE_TAG_TVOS=uavs3d-1.2.1-250226212827 export PRE_COMPILE_TAG_MACOS=uavs3d-1.2.1-250226210618 diff --git a/configs/libs/unibreak.sh b/configs/libs/unibreak.sh index 289ae24de..0196a45a4 100644 --- a/configs/libs/unibreak.sh +++ b/configs/libs/unibreak.sh @@ -38,7 +38,6 @@ else fi # pre compiled -export PRE_COMPILE_TAG=unibreak-6.1-250225223657 export PRE_COMPILE_TAG_TVOS=unibreak-6.1-250226211354 export PRE_COMPILE_TAG_MACOS=unibreak-6.1-250226205523 export PRE_COMPILE_TAG_IOS=unibreak-6.1-250226174658 diff --git a/configs/libs/xml2.sh b/configs/libs/xml2.sh index f6380e221..fdff88324 100644 --- a/configs/libs/xml2.sh +++ b/configs/libs/xml2.sh @@ -38,4 +38,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG=xml2-2.13.6-250225111236 +export PRE_COMPILE_TAG_TVOS=xml2-2.13.6-250225111236 +export PRE_COMPILE_TAG_MACOS=xml2-2.13.6-250225111236 +export PRE_COMPILE_TAG_IOS=xml2-2.13.6-250225111236 +export PRE_COMPILE_TAG_ANDROID=xml2-2.13.6-250225111236 diff --git a/configs/libs/yuv.sh b/configs/libs/yuv.sh index f766b4004..a12476ab7 100644 --- a/configs/libs/yuv.sh +++ b/configs/libs/yuv.sh @@ -35,7 +35,6 @@ else fi # pre compiled -export PRE_COMPILE_TAG=yuv-stable-eb6e7bb-250226150059 export PRE_COMPILE_TAG_TVOS=yuv-stable-eb6e7bb-250226212002 export PRE_COMPILE_TAG_MACOS=yuv-stable-eb6e7bb-250226205944 export PRE_COMPILE_TAG_IOS=yuv-stable-eb6e7bb-250226175227 diff --git a/do-install/main.sh b/do-install/main.sh index bd1ced0ff..d85cec5b6 100755 --- a/do-install/main.sh +++ b/do-install/main.sh @@ -27,12 +27,6 @@ function parse_lib_config() { local t=$(echo "PRE_COMPILE_TAG_$MR_PLAT" | tr '[:lower:]' '[:upper:]') local vt=$(eval echo "\$$t") - if test -z $vt ;then - TAG="$PRE_COMPILE_TAG" - else - TAG="$vt" - fi - if test -z $TAG ;then echo "tag can't be nil" usage From a11ff708350c1c2ef627ee8a0d4d2fe3f1a9c260 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Fri, 6 Jun 2025 14:24:42 +0800 Subject: [PATCH 084/359] update README --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5b080b6fb..a65b95584 100644 --- a/README.md +++ b/README.md @@ -120,7 +120,10 @@ If cloning repositories from GitHub is slow, or if you need to use an internal p | Lib Name | Current Version | Repository URL | Mirror Repository URL | | ---------- | --------------- | -------------------------------------------------------- | -------------------------------------------------------- | -| FFmpeg | 7.1.1 | https://github.com/FFmpeg/FFmpeg.git | export GIT_FFMPEG_UPSTREAM = git@xx:yy/FFmpeg.git | +| ffmpeg7 | 7.1.1 | https://github.com/FFmpeg/FFmpeg.git | export GIT_FFMPEG_UPSTREAM = git@xx:yy/FFmpeg.git | +| ffmpeg6 | 6.1.1 | https://github.com/FFmpeg/FFmpeg.git | export GIT_FFMPEG_UPSTREAM = git@xx:yy/FFmpeg.git | +| ffmpeg5 | 5.1.6 | https://github.com/FFmpeg/FFmpeg.git | export GIT_FFMPEG_UPSTREAM = git@xx:yy/FFmpeg.git | +| ffmpeg4 | 4.0.5 | https://github.com/FFmpeg/FFmpeg.git | export GIT_FFMPEG_UPSTREAM = git@xx:yy/FFmpeg.git | | ass | 0.17.3 | https://github.com/libass/libass.git | export GIT_ASS_UPSTREAM = git@xx:yy/libass.git | | bluray | 1.3.4 | https://code.videolan.org/videolan/libbluray.git | export GIT_BLURAY_UPSTREAM = git@xx:yy/libbluray.git | | dav1d | 1.5.1 | https://code.videolan.org/videolan/dav1d.git | export GIT_DAV1D_UPSTREAM = git@xx:yy/dav1d.git | From 55f2c7baf9e6b7b37687baa3e6d5e8dff084bfd1 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Fri, 6 Jun 2025 14:33:23 +0800 Subject: [PATCH 085/359] fix install bug --- do-install/main.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/do-install/main.sh b/do-install/main.sh index d85cec5b6..40c1bf4e3 100755 --- a/do-install/main.sh +++ b/do-install/main.sh @@ -27,12 +27,12 @@ function parse_lib_config() { local t=$(echo "PRE_COMPILE_TAG_$MR_PLAT" | tr '[:lower:]' '[:upper:]') local vt=$(eval echo "\$$t") - if test -z $TAG ;then - echo "tag can't be nil" - usage + if test -z $vt ;then + echo "$t can't be nil" exit fi - + + export TAG=$vt # opus-1.3.1-231124151836 # yuv-stable-eb6e7bb-250225223408 LIB_NAME=$(echo $TAG | awk -F - '{print $1}') @@ -44,7 +44,6 @@ function parse_lib_config() { VER=${temp%$suffix} export VER - export TAG export LIB_NAME } From 0633f3ee845422357dd1a7c18c83c500b5518a5e Mon Sep 17 00:00:00 2001 From: Anka Date: Fri, 6 Jun 2025 06:40:48 +0000 Subject: [PATCH 086/359] upgrade ffmpeg6 to ffmpeg6-6.1.1-250606143448 for android by cd --- configs/libs/ffmpeg6.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/libs/ffmpeg6.sh b/configs/libs/ffmpeg6.sh index a2676194a..430f19794 100644 --- a/configs/libs/ffmpeg6.sh +++ b/configs/libs/ffmpeg6.sh @@ -44,4 +44,4 @@ fi export PRE_COMPILE_TAG_TVOS=ffmpeg6-6.1.1-250605190133 export PRE_COMPILE_TAG_MACOS=ffmpeg6-6.1.1-250605190133 export PRE_COMPILE_TAG_IOS=ffmpeg6-6.1.1-250605190133 -export PRE_COMPILE_TAG_ANDROID=ffmpeg-6.1.2-250310113110 \ No newline at end of file +export PRE_COMPILE_TAG_ANDROID=ffmpeg6-6.1.1-250606143448 \ No newline at end of file From 12c9a66f09f89e3e771c676f6cf2015791329cc7 Mon Sep 17 00:00:00 2001 From: Anka Date: Fri, 6 Jun 2025 06:43:37 +0000 Subject: [PATCH 087/359] upgrade ffmpeg7 to ffmpeg7-7.1.1-250606143631 for android by cd --- configs/libs/ffmpeg7.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/libs/ffmpeg7.sh b/configs/libs/ffmpeg7.sh index 4ed404a1a..08f6420af 100644 --- a/configs/libs/ffmpeg7.sh +++ b/configs/libs/ffmpeg7.sh @@ -46,3 +46,4 @@ export PRE_COMPILE_TAG_TVOS=ffmpeg7-7.1.1-250605190134 export PRE_COMPILE_TAG_MACOS=ffmpeg7-7.1.1-250605190134 export PRE_COMPILE_TAG_IOS=ffmpeg7-7.1.1-250605190134 +export PRE_COMPILE_TAG_ANDROID=ffmpeg7-7.1.1-250606143631 From 2c59be58aad18ce123f779fff75ba6dc5ab9b560 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Fri, 6 Jun 2025 14:44:37 +0800 Subject: [PATCH 088/359] skip-fmwk and record compile log --- .github/workflows/onestep.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/onestep.sh b/.github/workflows/onestep.sh index b50b71e0c..d0278815c 100755 --- a/.github/workflows/onestep.sh +++ b/.github/workflows/onestep.sh @@ -33,14 +33,15 @@ function init_platform echo "---generate src log--------------------------------------" cd build/src/$plat - ls | awk -F ' ' '{printf "echo %s\n echo -------------\ngit -C %s log -n 1 | cat\n",$0,$0}' | bash > $DIST_DIR/$plat-src-log-$RELEASE_VERSION.md + ls | awk -F ' ' '{printf "echo %s\n echo -------------\ngit -C %s log -n 1 | cat\n",$0,$0}' | bash > $DIST_DIR/$plat-compile-log-$RELEASE_VERSION.md cd $ROOT_DIR } function compile_ios_platform { echo "---do compile ios libs--------------------------------------" - ./main.sh compile -p ios -c build -l ${LIB_NAME} + ./main.sh compile -p ios -c build -l ${LIB_NAME} --skip-fmwk >> $DIST_DIR/ios-compile-log-$RELEASE_VERSION.md + cd build/product/ios/universal zip -ryq $DIST_DIR/${LIB_NAME}-ios-universal-${RELEASE_VERSION}.zip ./* @@ -52,7 +53,8 @@ function compile_ios_platform function compile_macos_platform { echo "---do compile macos libs--------------------------------------" - ./main.sh compile -p macos -c build -l ${LIB_NAME} + ./main.sh compile -p macos -c build -l ${LIB_NAME} --skip-fmwk >> $DIST_DIR/macos-compile-log-$RELEASE_VERSION.md + cd build/product/macos/universal zip -ryq $DIST_DIR/${LIB_NAME}-macos-universal-${RELEASE_VERSION}.zip ./* cd $ROOT_DIR @@ -61,7 +63,8 @@ function compile_macos_platform function compile_tvos_platform { echo "---do compile tvos libs--------------------------------------" - ./main.sh compile -p tvos -c build -l ${LIB_NAME} + ./main.sh compile -p tvos -c build -l ${LIB_NAME} --skip-fmwk >> $DIST_DIR/android-compile-log-$RELEASE_VERSION.md + cd build/product/tvos/universal zip -ryq $DIST_DIR/${LIB_NAME}-tvos-universal-${RELEASE_VERSION}.zip ./* @@ -74,7 +77,7 @@ function compile_tvos_platform function compile_android_platform { echo "---do compile android libs--------------------------------------" - ./main.sh compile -p android -c build -l ${LIB_NAME} + ./main.sh compile -p android -c build -l ${LIB_NAME} >> $DIST_DIR/android-compile-log-$RELEASE_VERSION.md cd build/product/android/universal zip -ryq $DIST_DIR/${LIB_NAME}-android-universal-${RELEASE_VERSION}.zip ./* cd $ROOT_DIR From 411f4ccb1d8e97a3caa2ce6cfebac86c0f9a0af3 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Fri, 6 Jun 2025 14:52:14 +0800 Subject: [PATCH 089/359] -l stop support all --- .github/workflows/all.yml | 2 +- configs/default.sh | 26 -------------------------- tools/parse-arguments.sh | 10 +--------- 3 files changed, 2 insertions(+), 36 deletions(-) delete mode 100644 configs/default.sh diff --git a/.github/workflows/all.yml b/.github/workflows/all.yml index fc78a6784..17cda3d53 100644 --- a/.github/workflows/all.yml +++ b/.github/workflows/all.yml @@ -20,10 +20,10 @@ on: options: - apple - android - - all - ios - tvos - macos + - all dryrun: description: 'just run workflow,but not deploy' required: false diff --git a/configs/default.sh b/configs/default.sh deleted file mode 100644 index dacf0eeff..000000000 --- a/configs/default.sh +++ /dev/null @@ -1,26 +0,0 @@ -#! /usr/bin/env bash -# -# Copyright (C) 2021 Matt Reach - -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# when '-l all' will use blew default config: -apple_default_libs="openssl opus dav1d dvdread xml2 freetype fribidi harfbuzz unibreak ass ffmpeg smb2 bluray" - -android_default_libs="openssl opus dav1d dvdread xml2 freetype fribidi harfbuzz unibreak fontconfig ass ffmpeg smb2 bluray soundtouch" - -export ios_default_libs="$apple_default_libs" -export macos_default_libs="$apple_default_libs" -export tvos_default_libs="$apple_default_libs" -export android_default_libs="$android_default_libs" diff --git a/tools/parse-arguments.sh b/tools/parse-arguments.sh index 281de2fa3..f90237217 100644 --- a/tools/parse-arguments.sh +++ b/tools/parse-arguments.sh @@ -42,7 +42,7 @@ Clone vendor library git repository,Checkout specify commit,Apply patches OPTIONS: -p Specify platform (ios,macos,tvos,android), can't be nil -a Specify archs (x86_64,arm64,x86_64_simulator,arm64_simulator,all) all="x86_64,arm64,x86_64_simulator,arm64_simulator" - -l Specify which libs need init (all|libyuv|openssl|opus|bluray|dav1d|dvdread|freetype|fribidi|harfbuzz|unibreak|ass|ffmpeg), can't be nil + -l Specify which libs need init (libyuv|openssl|openssl3|opus|bluray|dav1d|dvdread|freetype|fribidi|harfbuzz|unibreak|ass|ijkffmpeg|fftutorial|ffmpeg4|ffmpeg5|ffmpeg6|ffmpeg7), can't be nil -s Specify workspace dir --help Show help banner of init command --skip-pull-base Skip pull base repo @@ -293,14 +293,6 @@ else done fi -if [[ "$MR_VENDOR_LIBS" == "all" ]]; then - cfg_dir=$(DIRNAME=$(dirname "${BASH_SOURCE[0]}"); cd "${DIRNAME}/../configs"; pwd) - source "${cfg_dir}/default.sh" - - eval libs='$'"${MR_PLAT}_default_libs" - export MR_VENDOR_LIBS="$libs" -fi - echo "MR_ACTION : [$MR_ACTION]" echo "MR_PLAT : [$MR_PLAT]" echo "MR_CMD : [$MR_CMD]" From a425539c17ce48d55f04e2ed835aab7e61fdaa76 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Fri, 6 Jun 2025 16:17:18 +0800 Subject: [PATCH 090/359] ffmpeg -> ffmpeg7 --- configs/libs/ffmpeg.sh | 1 + 1 file changed, 1 insertion(+) create mode 120000 configs/libs/ffmpeg.sh diff --git a/configs/libs/ffmpeg.sh b/configs/libs/ffmpeg.sh new file mode 120000 index 000000000..d35f71de2 --- /dev/null +++ b/configs/libs/ffmpeg.sh @@ -0,0 +1 @@ +ffmpeg7.sh \ No newline at end of file From a318393a42a28e6c5f30bc4e09cba36448860f3b Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Tue, 10 Jun 2025 10:58:37 +0800 Subject: [PATCH 091/359] constructed avcc for videotoolbox was already right from ffmpeg5 --- ...ffmpeg-constructed-wrong-avcc-for-vi.patch | 59 ------------------- ...ructed-wrong-avcc-for-videotoolbox-h.patch | 59 ------------------- ...-built-in-smb2-protocol-via-libsmb2.patch} | 0 ...add-url_parse_priv-function-pointer.patch} | 0 ...27-bluray-protocol-add-dvd-fallback.patch} | 0 ...s-for-network-Blu-ray-Disc-and-BDMV.patch} | 0 ...ind-the-right-m2ts-then-read-seek-i.patch} | 0 ...g7-test.c-1-10-fatal-error-libxml2-.patch} | 0 ...-demuxer-https-github.com-bluez-sh-F.patch | 0 ...l-https-ffmpeg.org-pipermail-ffmpeg-.patch | 0 ...structed-wrong-avcc-for-videotoolbox.patch | 0 .../0042-Adapt-to-clang-16.patch | 0 12 files changed, 118 deletions(-) delete mode 100644 patches/ffmpeg-n5.1/0006-fix-ffmpeg-constructed-wrong-avcc-for-vi.patch delete mode 100644 patches/ffmpeg-n6.1/0005-fix-ffmpeg-constructed-wrong-avcc-for-videotoolbox-h.patch rename patches/ffmpeg-n7.1.1/{0026-add-built-in-smb2-protocol-via-libsmb2.patch => 0025-add-built-in-smb2-protocol-via-libsmb2.patch} (100%) rename patches/ffmpeg-n7.1.1/{0027-URLProtocol-add-url_parse_priv-function-pointer.patch => 0026-URLProtocol-add-url_parse_priv-function-pointer.patch} (100%) rename patches/ffmpeg-n7.1.1/{0028-bluray-protocol-add-dvd-fallback.patch => 0027-bluray-protocol-add-dvd-fallback.patch} (100%) rename patches/ffmpeg-n7.1.1/{0029-custom-bluray-fs-for-network-Blu-ray-Disc-and-BDMV.patch => 0028-custom-bluray-fs-for-network-Blu-ray-Disc-and-BDMV.patch} (100%) rename patches/ffmpeg-n7.1.1/{0030-bluray-open-and-find-the-right-m2ts-then-read-seek-i.patch => 0029-bluray-open-and-find-the-right-m2ts-then-read-seek-i.patch} (100%) rename patches/ffmpeg-n7.1.1/{0031-fix-android-ffmpeg7-test.c-1-10-fatal-error-libxml2-.patch => 0030-fix-android-ffmpeg7-test.c-1-10-fatal-error-libxml2-.patch} (100%) rename patches/ffmpeg-n7.1.1/{todo => draft}/0009-mov-support-heic-demuxer-https-github.com-bluez-sh-F.patch (100%) rename patches/ffmpeg-n7.1.1/{todo => draft}/0015-Adds-DVD-protocol-https-ffmpeg.org-pipermail-ffmpeg-.patch (100%) rename patches/ffmpeg-n7.1.1/{ => draft}/0025-fix-ffmpeg-constructed-wrong-avcc-for-videotoolbox.patch (100%) rename patches/ffmpeg-n7.1.1/{todo => draft}/0042-Adapt-to-clang-16.patch (100%) diff --git a/patches/ffmpeg-n5.1/0006-fix-ffmpeg-constructed-wrong-avcc-for-vi.patch b/patches/ffmpeg-n5.1/0006-fix-ffmpeg-constructed-wrong-avcc-for-vi.patch deleted file mode 100644 index a5f843676..000000000 --- a/patches/ffmpeg-n5.1/0006-fix-ffmpeg-constructed-wrong-avcc-for-vi.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 742d238b20c760356ece1e23522e740fcfd8737f Mon Sep 17 00:00:00 2001 -From: qianlongxu -Date: Mon, 16 May 2022 16:15:10 +0800 -Subject: [PATCH 06] fix ffmpeg constructed wrong avcc for - videotoolbox hwaccel. - ---- - libavcodec/videotoolbox.c | 35 ++++++++++++++++++++++++++++++++++- - 1 file changed, 34 insertions(+), 1 deletion(-) - -diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c -index d61d310..82fa993 100644 ---- a/libavcodec/videotoolbox.c -+++ b/libavcodec/videotoolbox.c -@@ -222,7 +222,40 @@ CFDataRef ff_videotoolbox_avcc_extradata_create(AVCodecContext *avctx) - if (vtctx) - memcpy(vtctx->sps, h->ps.sps->data + 1, 3); - -- data = CFDataCreate(kCFAllocatorDefault, vt_extradata, vt_extradata_size); -+ /* -+ ffmpeg constructed avcc is wrong,but i dont't why;eg: -+ ff constructed avcc: -+ 014d401effe1001b674d401eec806c1ef3fff8140013f88000000080000019078b16cb01000468ebec4c -+ avctx->extradata avcc: -+ 014d401effe1001c674d401eec806c1ef3fff8140013f8800000030080000019078b16cb01000568ebec4c80 -+ */ -+ if (avctx->extradata_size != vt_extradata_size) { -+ char msg[256]; -+ { -+ char buffer[128]; -+ sprintf(buffer, "%s", "ff avcc maybe wrong:"); -+ int len = (int)strlen(buffer); -+ int size = FFMIN(vt_extradata_size, 127 - len) / 2; -+ for (int i = 0; i < size; i++) { -+ len += sprintf(buffer + len, "%02X", vt_extradata[i]); -+ } -+ sprintf(msg, "%s", buffer); -+ } -+ { -+ char buffer[128]; -+ sprintf(buffer, "%s", "\nuse origin avcc:"); -+ int len = (int)strlen(buffer); -+ int size = FFMIN(avctx->extradata_size, 127 - len) / 2; -+ for (int i = 0; i < size; i++) { -+ len += sprintf(buffer + len, "%02X", avctx->extradata[i]); -+ } -+ sprintf(msg + strlen(msg), "%s", buffer); -+ } -+ av_log(avctx, AV_LOG_INFO, "%s\n", msg); -+ data = CFDataCreate(kCFAllocatorDefault, avctx->extradata, avctx->extradata_size); -+ } else { -+ data = CFDataCreate(kCFAllocatorDefault, vt_extradata, vt_extradata_size); -+ } - av_free(vt_extradata); - return data; - } --- -2.39.3 (Apple Git-145) - diff --git a/patches/ffmpeg-n6.1/0005-fix-ffmpeg-constructed-wrong-avcc-for-videotoolbox-h.patch b/patches/ffmpeg-n6.1/0005-fix-ffmpeg-constructed-wrong-avcc-for-videotoolbox-h.patch deleted file mode 100644 index 774710dbe..000000000 --- a/patches/ffmpeg-n6.1/0005-fix-ffmpeg-constructed-wrong-avcc-for-videotoolbox-h.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 71216d65ff98b8a36fd4ae7bb85106aa875c7f0a Mon Sep 17 00:00:00 2001 -From: qianlongxu -Date: Mon, 16 May 2022 16:15:10 +0800 -Subject: [PATCH 05] fix ffmpeg constructed wrong avcc for videotoolbox - hwaccel. - ---- - libavcodec/videotoolbox.c | 35 ++++++++++++++++++++++++++++++++++- - 1 file changed, 34 insertions(+), 1 deletion(-) - -diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c -index 43fd2e3..2411309 100644 ---- a/libavcodec/videotoolbox.c -+++ b/libavcodec/videotoolbox.c -@@ -223,7 +223,40 @@ CFDataRef ff_videotoolbox_avcc_extradata_create(AVCodecContext *avctx) - if (vtctx) - memcpy(vtctx->sps, h->ps.sps->data + 1, 3); - -- data = CFDataCreate(kCFAllocatorDefault, vt_extradata, vt_extradata_size); -+ /* -+ ffmpeg constructed avcc is wrong,but i dont't why;eg: -+ ff constructed avcc: -+ 014d401effe1001b674d401eec806c1ef3fff8140013f88000000080000019078b16cb01000468ebec4c -+ avctx->extradata avcc: -+ 014d401effe1001c674d401eec806c1ef3fff8140013f8800000030080000019078b16cb01000568ebec4c80 -+ */ -+ if (avctx->extradata_size != vt_extradata_size) { -+ char msg[256]; -+ { -+ char buffer[128]; -+ sprintf(buffer, "%s", "ff avcc maybe wrong:"); -+ int len = (int)strlen(buffer); -+ int size = FFMIN(vt_extradata_size, 127 - len) / 2; -+ for (int i = 0; i < size; i++) { -+ len += sprintf(buffer + len, "%02X", vt_extradata[i]); -+ } -+ sprintf(msg, "%s", buffer); -+ } -+ { -+ char buffer[128]; -+ sprintf(buffer, "%s", "\nuse origin avcc:"); -+ int len = (int)strlen(buffer); -+ int size = FFMIN(avctx->extradata_size, 127 - len) / 2; -+ for (int i = 0; i < size; i++) { -+ len += sprintf(buffer + len, "%02X", avctx->extradata[i]); -+ } -+ sprintf(msg + strlen(msg), "%s", buffer); -+ } -+ av_log(avctx, AV_LOG_INFO, "%s\n", msg); -+ data = CFDataCreate(kCFAllocatorDefault, avctx->extradata, avctx->extradata_size); -+ } else { -+ data = CFDataCreate(kCFAllocatorDefault, vt_extradata, vt_extradata_size); -+ } - av_free(vt_extradata); - return data; - } --- -2.39.3 (Apple Git-146) - diff --git a/patches/ffmpeg-n7.1.1/0026-add-built-in-smb2-protocol-via-libsmb2.patch b/patches/ffmpeg-n7.1.1/0025-add-built-in-smb2-protocol-via-libsmb2.patch similarity index 100% rename from patches/ffmpeg-n7.1.1/0026-add-built-in-smb2-protocol-via-libsmb2.patch rename to patches/ffmpeg-n7.1.1/0025-add-built-in-smb2-protocol-via-libsmb2.patch diff --git a/patches/ffmpeg-n7.1.1/0027-URLProtocol-add-url_parse_priv-function-pointer.patch b/patches/ffmpeg-n7.1.1/0026-URLProtocol-add-url_parse_priv-function-pointer.patch similarity index 100% rename from patches/ffmpeg-n7.1.1/0027-URLProtocol-add-url_parse_priv-function-pointer.patch rename to patches/ffmpeg-n7.1.1/0026-URLProtocol-add-url_parse_priv-function-pointer.patch diff --git a/patches/ffmpeg-n7.1.1/0028-bluray-protocol-add-dvd-fallback.patch b/patches/ffmpeg-n7.1.1/0027-bluray-protocol-add-dvd-fallback.patch similarity index 100% rename from patches/ffmpeg-n7.1.1/0028-bluray-protocol-add-dvd-fallback.patch rename to patches/ffmpeg-n7.1.1/0027-bluray-protocol-add-dvd-fallback.patch diff --git a/patches/ffmpeg-n7.1.1/0029-custom-bluray-fs-for-network-Blu-ray-Disc-and-BDMV.patch b/patches/ffmpeg-n7.1.1/0028-custom-bluray-fs-for-network-Blu-ray-Disc-and-BDMV.patch similarity index 100% rename from patches/ffmpeg-n7.1.1/0029-custom-bluray-fs-for-network-Blu-ray-Disc-and-BDMV.patch rename to patches/ffmpeg-n7.1.1/0028-custom-bluray-fs-for-network-Blu-ray-Disc-and-BDMV.patch diff --git a/patches/ffmpeg-n7.1.1/0030-bluray-open-and-find-the-right-m2ts-then-read-seek-i.patch b/patches/ffmpeg-n7.1.1/0029-bluray-open-and-find-the-right-m2ts-then-read-seek-i.patch similarity index 100% rename from patches/ffmpeg-n7.1.1/0030-bluray-open-and-find-the-right-m2ts-then-read-seek-i.patch rename to patches/ffmpeg-n7.1.1/0029-bluray-open-and-find-the-right-m2ts-then-read-seek-i.patch diff --git a/patches/ffmpeg-n7.1.1/0031-fix-android-ffmpeg7-test.c-1-10-fatal-error-libxml2-.patch b/patches/ffmpeg-n7.1.1/0030-fix-android-ffmpeg7-test.c-1-10-fatal-error-libxml2-.patch similarity index 100% rename from patches/ffmpeg-n7.1.1/0031-fix-android-ffmpeg7-test.c-1-10-fatal-error-libxml2-.patch rename to patches/ffmpeg-n7.1.1/0030-fix-android-ffmpeg7-test.c-1-10-fatal-error-libxml2-.patch diff --git a/patches/ffmpeg-n7.1.1/todo/0009-mov-support-heic-demuxer-https-github.com-bluez-sh-F.patch b/patches/ffmpeg-n7.1.1/draft/0009-mov-support-heic-demuxer-https-github.com-bluez-sh-F.patch similarity index 100% rename from patches/ffmpeg-n7.1.1/todo/0009-mov-support-heic-demuxer-https-github.com-bluez-sh-F.patch rename to patches/ffmpeg-n7.1.1/draft/0009-mov-support-heic-demuxer-https-github.com-bluez-sh-F.patch diff --git a/patches/ffmpeg-n7.1.1/todo/0015-Adds-DVD-protocol-https-ffmpeg.org-pipermail-ffmpeg-.patch b/patches/ffmpeg-n7.1.1/draft/0015-Adds-DVD-protocol-https-ffmpeg.org-pipermail-ffmpeg-.patch similarity index 100% rename from patches/ffmpeg-n7.1.1/todo/0015-Adds-DVD-protocol-https-ffmpeg.org-pipermail-ffmpeg-.patch rename to patches/ffmpeg-n7.1.1/draft/0015-Adds-DVD-protocol-https-ffmpeg.org-pipermail-ffmpeg-.patch diff --git a/patches/ffmpeg-n7.1.1/0025-fix-ffmpeg-constructed-wrong-avcc-for-videotoolbox.patch b/patches/ffmpeg-n7.1.1/draft/0025-fix-ffmpeg-constructed-wrong-avcc-for-videotoolbox.patch similarity index 100% rename from patches/ffmpeg-n7.1.1/0025-fix-ffmpeg-constructed-wrong-avcc-for-videotoolbox.patch rename to patches/ffmpeg-n7.1.1/draft/0025-fix-ffmpeg-constructed-wrong-avcc-for-videotoolbox.patch diff --git a/patches/ffmpeg-n7.1.1/todo/0042-Adapt-to-clang-16.patch b/patches/ffmpeg-n7.1.1/draft/0042-Adapt-to-clang-16.patch similarity index 100% rename from patches/ffmpeg-n7.1.1/todo/0042-Adapt-to-clang-16.patch rename to patches/ffmpeg-n7.1.1/draft/0042-Adapt-to-clang-16.patch From 95815143596aeda5497c2c676d50c9e37dab1580 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Tue, 10 Jun 2025 11:24:16 +0800 Subject: [PATCH 092/359] fix zip xcfmwk bug --- .github/workflows/onestep.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/onestep.sh b/.github/workflows/onestep.sh index d0278815c..b902dc6fd 100755 --- a/.github/workflows/onestep.sh +++ b/.github/workflows/onestep.sh @@ -85,10 +85,11 @@ function compile_android_platform function make_xcfmwk_bundle() { - echo "---Zip apple xcframework--------------------------------------" - cd build/product/xcframework - zip -ryq $DIST_DIR/${LIB_NAME}-apple-xcframework-${RELEASE_VERSION}.zip ./* - cd $ROOT_DIR + echo "---skip apple xcframework--------------------------------------" + # echo "---Zip apple xcframework--------------------------------------" + # cd build/product/xcframework + # zip -ryq $DIST_DIR/${LIB_NAME}-apple-xcframework-${RELEASE_VERSION}.zip ./* + # cd $ROOT_DIR } function replace_tag() From 66c16f3404e5a4b7bd1bb07120e1bfe076693624 Mon Sep 17 00:00:00 2001 From: Anka Date: Tue, 10 Jun 2025 03:38:46 +0000 Subject: [PATCH 093/359] upgrade ffmpeg5 to ffmpeg5-5.1.6-250610112554 for apple by cd --- configs/libs/ffmpeg5.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configs/libs/ffmpeg5.sh b/configs/libs/ffmpeg5.sh index a3faab9e1..1d8378955 100644 --- a/configs/libs/ffmpeg5.sh +++ b/configs/libs/ffmpeg5.sh @@ -41,7 +41,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=ffmpeg5-5.1.6-250606091027 -export PRE_COMPILE_TAG_MACOS=ffmpeg5-5.1.6-250606091027 -export PRE_COMPILE_TAG_IOS=ffmpeg5-5.1.6-250606091027 +export PRE_COMPILE_TAG_TVOS=ffmpeg5-5.1.6-250610112554 +export PRE_COMPILE_TAG_MACOS=ffmpeg5-5.1.6-250610112554 +export PRE_COMPILE_TAG_IOS=ffmpeg5-5.1.6-250610112554 export PRE_COMPILE_TAG_ANDROID=ffmpeg5-5.1.6-250606140646 \ No newline at end of file From 4752b8b1c2bac9e81a28d89a2e455117e9147eda Mon Sep 17 00:00:00 2001 From: Anka Date: Tue, 10 Jun 2025 04:07:24 +0000 Subject: [PATCH 094/359] upgrade ffmpeg6 to ffmpeg6-6.1.1-250610115223 for apple by cd --- configs/libs/ffmpeg6.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configs/libs/ffmpeg6.sh b/configs/libs/ffmpeg6.sh index 430f19794..684caeaa8 100644 --- a/configs/libs/ffmpeg6.sh +++ b/configs/libs/ffmpeg6.sh @@ -41,7 +41,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=ffmpeg6-6.1.1-250605190133 -export PRE_COMPILE_TAG_MACOS=ffmpeg6-6.1.1-250605190133 -export PRE_COMPILE_TAG_IOS=ffmpeg6-6.1.1-250605190133 +export PRE_COMPILE_TAG_TVOS=ffmpeg6-6.1.1-250610115223 +export PRE_COMPILE_TAG_MACOS=ffmpeg6-6.1.1-250610115223 +export PRE_COMPILE_TAG_IOS=ffmpeg6-6.1.1-250610115223 export PRE_COMPILE_TAG_ANDROID=ffmpeg6-6.1.1-250606143448 \ No newline at end of file From ba5d3aad45dfe08b776b78110a6cb4a32cfa8f3b Mon Sep 17 00:00:00 2001 From: Anka Date: Tue, 10 Jun 2025 04:10:14 +0000 Subject: [PATCH 095/359] upgrade ffmpeg7 to ffmpeg7-7.1.1-250610115224 for apple by cd --- configs/libs/ffmpeg7.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configs/libs/ffmpeg7.sh b/configs/libs/ffmpeg7.sh index 08f6420af..b6e9bd0da 100644 --- a/configs/libs/ffmpeg7.sh +++ b/configs/libs/ffmpeg7.sh @@ -42,8 +42,8 @@ fi # pre compiled -export PRE_COMPILE_TAG_TVOS=ffmpeg7-7.1.1-250605190134 -export PRE_COMPILE_TAG_MACOS=ffmpeg7-7.1.1-250605190134 -export PRE_COMPILE_TAG_IOS=ffmpeg7-7.1.1-250605190134 +export PRE_COMPILE_TAG_TVOS=ffmpeg7-7.1.1-250610115224 +export PRE_COMPILE_TAG_MACOS=ffmpeg7-7.1.1-250610115224 +export PRE_COMPILE_TAG_IOS=ffmpeg7-7.1.1-250610115224 export PRE_COMPILE_TAG_ANDROID=ffmpeg7-7.1.1-250606143631 From b7cce3deeec20e77e2dbd368ed017204fb97f34d Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Tue, 10 Jun 2025 18:26:33 +0800 Subject: [PATCH 096/359] fix ffmpeg4 constructed wrong avcc for videotoolbox --- ...ructed-wrong-avcc-for-videotoolbox-h.patch | 59 --------- ...structed-wrong-avcc-for-videotoolbox.patch | 122 ++++++++++++++++++ 2 files changed, 122 insertions(+), 59 deletions(-) delete mode 100644 patches/ffmpeg-n4.0/0012-fix-ffmpeg-constructed-wrong-avcc-for-videotoolbox-h.patch create mode 100644 patches/ffmpeg-n4.0/0012-fix-ffmpeg4-constructed-wrong-avcc-for-videotoolbox.patch diff --git a/patches/ffmpeg-n4.0/0012-fix-ffmpeg-constructed-wrong-avcc-for-videotoolbox-h.patch b/patches/ffmpeg-n4.0/0012-fix-ffmpeg-constructed-wrong-avcc-for-videotoolbox-h.patch deleted file mode 100644 index 6b79df05c..000000000 --- a/patches/ffmpeg-n4.0/0012-fix-ffmpeg-constructed-wrong-avcc-for-videotoolbox-h.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 86fccbeadf36bcee5a800d63d51dba8560434298 Mon Sep 17 00:00:00 2001 -From: qianlongxu -Date: Mon, 16 May 2022 16:15:10 +0800 -Subject: [PATCH 12] fix ffmpeg constructed wrong avcc for videotoolbox - hwaccel. - ---- - libavcodec/videotoolbox.c | 35 ++++++++++++++++++++++++++++++++++- - 1 file changed, 34 insertions(+), 1 deletion(-) - -diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c -index 57b6698..79ab799 100644 ---- a/libavcodec/videotoolbox.c -+++ b/libavcodec/videotoolbox.c -@@ -152,7 +152,40 @@ CFDataRef ff_videotoolbox_avcc_extradata_create(AVCodecContext *avctx) - if (vtctx) - memcpy(vtctx->sps, h->ps.sps->data + 1, 3); - -- data = CFDataCreate(kCFAllocatorDefault, vt_extradata, vt_extradata_size); -+ /* -+ ffmpeg constructed avcc is wrong,but i dont't why;eg: -+ ff constructed avcc: -+ 014d401effe1001b674d401eec806c1ef3fff8140013f88000000080000019078b16cb01000468ebec4c -+ avctx->extradata avcc: -+ 014d401effe1001c674d401eec806c1ef3fff8140013f8800000030080000019078b16cb01000568ebec4c80 -+ */ -+ if (avctx->extradata_size != vt_extradata_size) { -+ char msg[256]; -+ { -+ char buffer[128]; -+ sprintf(buffer, "%s", "ff avcc maybe wrong:"); -+ int len = (int)strlen(buffer); -+ int size = FFMIN(vt_extradata_size, 127 - len) / 2; -+ for (int i = 0; i < size; i++) { -+ len += sprintf(buffer + len, "%02X", vt_extradata[i]); -+ } -+ sprintf(msg, "%s", buffer); -+ } -+ { -+ char buffer[128]; -+ sprintf(buffer, "%s", "\nuse origin avcc:"); -+ int len = (int)strlen(buffer); -+ int size = FFMIN(avctx->extradata_size, 127 - len) / 2; -+ for (int i = 0; i < size; i++) { -+ len += sprintf(buffer + len, "%02X", avctx->extradata[i]); -+ } -+ sprintf(msg + strlen(msg), "%s", buffer); -+ } -+ av_log(avctx, AV_LOG_INFO, "%s\n", msg); -+ data = CFDataCreate(kCFAllocatorDefault, avctx->extradata, avctx->extradata_size); -+ } else { -+ data = CFDataCreate(kCFAllocatorDefault, vt_extradata, vt_extradata_size); -+ } - av_free(vt_extradata); - return data; - } --- -2.30.1 (Apple Git-130) - diff --git a/patches/ffmpeg-n4.0/0012-fix-ffmpeg4-constructed-wrong-avcc-for-videotoolbox.patch b/patches/ffmpeg-n4.0/0012-fix-ffmpeg4-constructed-wrong-avcc-for-videotoolbox.patch new file mode 100644 index 000000000..0eff09a42 --- /dev/null +++ b/patches/ffmpeg-n4.0/0012-fix-ffmpeg4-constructed-wrong-avcc-for-videotoolbox.patch @@ -0,0 +1,122 @@ +From e662624b224ae76d275e2628664e6c91ded296c1 Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Tue, 10 Jun 2025 18:24:40 +0800 +Subject: [PATCH 12] fix ffmpeg4 constructed wrong avcc for videotoolbox + +--- + libavcodec/h264_ps.c | 4 +++ + libavcodec/videotoolbox.c | 61 ++++++++++++++++++++++++++++++++++----- + 2 files changed, 57 insertions(+), 8 deletions(-) + +diff --git a/libavcodec/h264_ps.c b/libavcodec/h264_ps.c +index 15fb8b6..8cdb93c 100644 +--- a/libavcodec/h264_ps.c ++++ b/libavcodec/h264_ps.c +@@ -752,6 +752,10 @@ int ff_h264_decode_picture_parameter_set(GetBitContext *gb, AVCodecContext *avct + } + memcpy(pps->data, gb->buffer, pps->data_size); + ++ // Re-add the removed stop bit (may be used by hwaccels). ++ if (!(bit_length & 7) && pps->data_size < sizeof(pps->data)) ++ pps->data[pps->data_size++] = 0x80; ++ + pps->sps_id = get_ue_golomb_31(gb); + if ((unsigned)pps->sps_id >= MAX_SPS_COUNT || + !ps->sps_list[pps->sps_id]) { +diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c +index 57b6698..064efe0 100644 +--- a/libavcodec/videotoolbox.c ++++ b/libavcodec/videotoolbox.c +@@ -118,14 +118,49 @@ int ff_videotoolbox_alloc_frame(AVCodecContext *avctx, AVFrame *frame) + + #define AV_W8(p, v) *(p) = (v) + ++static int escape_ps(uint8_t* dst, const uint8_t* src, int src_size) ++{ ++ int i; ++ int size = src_size; ++ uint8_t* p = dst; ++ ++ for (i = 0; i < src_size; i++) { ++ if (i + 2 < src_size && ++ src[i] == 0x00 && ++ src[i + 1] == 0x00 && ++ src[i + 2] <= 0x03) { ++ if (dst) { ++ *p++ = src[i++]; ++ *p++ = src[i]; ++ *p++ = 0x03; ++ } else { ++ i++; ++ } ++ size++; ++ } else if (dst) ++ *p++ = src[i]; ++ } ++ ++ if (dst) ++ av_assert0((p - dst) == size); ++ ++ return size; ++} ++ + CFDataRef ff_videotoolbox_avcc_extradata_create(AVCodecContext *avctx) + { + VTContext *vtctx = avctx->internal->hwaccel_priv_data; + H264Context *h = avctx->priv_data; + CFDataRef data = NULL; + uint8_t *p; +- int vt_extradata_size = 6 + 2 + h->ps.sps->data_size + 3 + h->ps.pps->data_size; +- uint8_t *vt_extradata = av_malloc(vt_extradata_size); ++ int sps_size = escape_ps(NULL, h->ps.sps->data, h->ps.sps->data_size); ++ int pps_size = escape_ps(NULL, h->ps.pps->data, h->ps.pps->data_size); ++ int vt_extradata_size; ++ uint8_t *vt_extradata; ++ ++ vt_extradata_size = 6 + 2 + sps_size + 3 + pps_size; ++ vt_extradata = av_malloc(vt_extradata_size); ++ + if (!vt_extradata) + return NULL; + +@@ -137,14 +172,14 @@ CFDataRef ff_videotoolbox_avcc_extradata_create(AVCodecContext *avctx) + AV_W8(p + 3, h->ps.sps->data[3]); /* level */ + AV_W8(p + 4, 0xff); /* 6 bits reserved (111111) + 2 bits nal size length - 3 (11) */ + AV_W8(p + 5, 0xe1); /* 3 bits reserved (111) + 5 bits number of sps (00001) */ +- AV_WB16(p + 6, h->ps.sps->data_size); +- memcpy(p + 8, h->ps.sps->data, h->ps.sps->data_size); +- p += 8 + h->ps.sps->data_size; ++ AV_WB16(p + 6, sps_size); ++ p += 8; ++ p += escape_ps(p, h->ps.sps->data, h->ps.sps->data_size); + AV_W8(p + 0, 1); /* number of pps */ +- AV_WB16(p + 1, h->ps.pps->data_size); +- memcpy(p + 3, h->ps.pps->data, h->ps.pps->data_size); ++ AV_WB16(p + 1, pps_size); ++ p += 3; ++ p += escape_ps(p, h->ps.pps->data, h->ps.pps->data_size); + +- p += 3 + h->ps.pps->data_size; + av_assert0(p - vt_extradata == vt_extradata_size); + + // save sps header (profile/level) used to create decoder session, +@@ -152,6 +187,16 @@ CFDataRef ff_videotoolbox_avcc_extradata_create(AVCodecContext *avctx) + if (vtctx) + memcpy(vtctx->sps, h->ps.sps->data + 1, 3); + ++// { ++// char buffer[128]; ++// sprintf(buffer, "%s", "\nnew avcc:"); ++// int len = (int)strlen(buffer); ++// for (int i = 0; i < vt_extradata_size; i++) { ++// len += sprintf(buffer + len, "%02x", avctx->extradata[i]); ++// } ++// av_log(avctx, AV_LOG_INFO, "%s\n", buffer); ++// } ++ + data = CFDataCreate(kCFAllocatorDefault, vt_extradata, vt_extradata_size); + av_free(vt_extradata); + return data; +-- +2.39.5 (Apple Git-154) + From 92d86b5da05387b26e41c0d5c15b30b24364de63 Mon Sep 17 00:00:00 2001 From: Anka Date: Tue, 10 Jun 2025 10:42:18 +0000 Subject: [PATCH 097/359] upgrade ffmpeg4 to ffmpeg4-4.0.5-250610182859 for apple by cd --- configs/libs/ffmpeg4.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configs/libs/ffmpeg4.sh b/configs/libs/ffmpeg4.sh index a58c90e06..c3766fb6d 100644 --- a/configs/libs/ffmpeg4.sh +++ b/configs/libs/ffmpeg4.sh @@ -41,7 +41,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=ffmpeg4-4.0.5-250605190152 -export PRE_COMPILE_TAG_MACOS=ffmpeg4-4.0.5-250605190152 -export PRE_COMPILE_TAG_IOS=ffmpeg4-4.0.5-250605190152 +export PRE_COMPILE_TAG_TVOS=ffmpeg4-4.0.5-250610182859 +export PRE_COMPILE_TAG_MACOS=ffmpeg4-4.0.5-250610182859 +export PRE_COMPILE_TAG_IOS=ffmpeg4-4.0.5-250610182859 export PRE_COMPILE_TAG_ANDROID=ffmpeg4-4.0.5-250606131114 \ No newline at end of file From a70e294b868a1e811dde7d552103eb57b0067e5b Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Tue, 17 Jun 2025 16:56:23 +0800 Subject: [PATCH 098/359] mv correct_pc to install module --- do-install/correct-pc.sh | 49 ++++++++++++++++++++++++++++++++++++++++ do-install/main.sh | 46 +++++++++++++++++++++---------------- tools/parse-arguments.sh | 40 ++++++++------------------------ 3 files changed, 85 insertions(+), 50 deletions(-) create mode 100755 do-install/correct-pc.sh diff --git a/do-install/correct-pc.sh b/do-install/correct-pc.sh new file mode 100755 index 000000000..e4d1f6b1b --- /dev/null +++ b/do-install/correct-pc.sh @@ -0,0 +1,49 @@ +#! /usr/bin/env bash +# +# Copyright (C) 2022 Matt Reach + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +set -e + +THIS_DIR=$(DIRNAME=$(dirname "$0"); cd "$DIRNAME"; pwd) +cd "$THIS_DIR" + +function correct_pc_file(){ + local fix_path="$1" + local dir=${PWD} + + echo "fix pc files in folder: $fix_path" + cd "$fix_path" + + for pc in `find . -type f -name "*.pc"` ; + do + local pkgconfig=$(cd $(dirname "$pc"); pwd) + local lib_dir=$(cd $(dirname "$pkgconfig"); pwd) + local base_dir=$(cd $(dirname "$lib_dir"); pwd) + local include_dir="${base_dir}/include" + local bin_dir="${base_dir}/bin" + + my_sed_i "s|^prefix=.*|prefix=$base_dir|" "$pc" + my_sed_i "s|^exec_prefix=[^$].*|exec_prefix=$bin_dir|" $pc + my_sed_i "s|^libdir=[^$].*|libdir=$lib_dir|" "$pc" + my_sed_i "s|^includedir=[^$].*include|includedir=$include_dir|" "$pc" + my_sed_i "s|-L/[^ ]*lib|-L$lib_dir|" "$pc" + my_sed_i "s|-I/[^ ]*include|-I$include_dir|" "$pc" + done + + cd "$dir" +} + +correct_pc_file "$1" \ No newline at end of file diff --git a/do-install/main.sh b/do-install/main.sh index 40c1bf4e3..9a1c70acd 100755 --- a/do-install/main.sh +++ b/do-install/main.sh @@ -23,10 +23,10 @@ THIS_DIR=$(DIRNAME=$(dirname "$0"); cd "$DIRNAME"; pwd) cd "$THIS_DIR" function parse_lib_config() { - + local t=$(echo "PRE_COMPILE_TAG_$MR_PLAT" | tr '[:lower:]' '[:upper:]') local vt=$(eval echo "\$$t") - + if test -z $vt ;then echo "$t can't be nil" exit @@ -42,28 +42,36 @@ function parse_lib_config() { local temp=${TAG#$prefix} # 去掉后缀 VER=${temp%$suffix} - + export VER export LIB_NAME } -# 循环编译所有的库 -for lib in $MR_VENDOR_LIBS -do - [[ ! -f "$MR_SHELL_CONFIGS_DIR/libs/${lib}.sh" ]] && (echo "❌$lib config not exist,install will stop.";exit 1;) +function install_libs() +{ + # 循环安装所有的库 + for lib in $MR_VENDOR_LIBS + do + [[ ! -f "$MR_SHELL_CONFIGS_DIR/libs/${lib}.sh" ]] && (echo "❌$lib config not exist,install will stop.";exit 1;) + + echo "===[install $lib]====================" + source "$MR_SHELL_CONFIGS_DIR/libs/${lib}.sh" + parse_lib_config + if [[ $FORCE_XCFRAMEWORK ]];then + ./install-pre-xcf.sh + else + ./install-pre-lib.sh + fi + echo "====================================" + done - echo "===[install $lib]====================" - source "$MR_SHELL_CONFIGS_DIR/libs/${lib}.sh" - parse_lib_config - if [[ $FORCE_XCFRAMEWORK ]];then - ./install-pre-xcf.sh - else - ./install-pre-lib.sh + if [[ ! "$FORCE_XCFRAMEWORK" ]];then + ./correct-pc.sh "$MR_WORKSPACE/product/$MR_PLAT" fi - echo "====================================" -done +} -if [[ ! "$FORCE_XCFRAMEWORK" ]];then - correct_pc_file "$MR_WORKSPACE/product/$MR_PLAT" +if [[ -n $MR_PC_FILE_DIR ]];then + ./correct-pc.sh "$MR_PC_FILE_DIR" +else + install_libs fi - diff --git a/tools/parse-arguments.sh b/tools/parse-arguments.sh index f90237217..15f43a8d5 100644 --- a/tools/parse-arguments.sh +++ b/tools/parse-arguments.sh @@ -86,32 +86,6 @@ OPTIONS: EOF } -function correct_pc_file(){ - local fix_path="$1" - local dir=${PWD} - - echo "fix pc files in folder: $fix_path" - cd "$fix_path" - - for pc in `find . -type f -name "*.pc"` ; - do - local pkgconfig=$(cd $(dirname "$pc"); pwd) - local lib_dir=$(cd $(dirname "$pkgconfig"); pwd) - local base_dir=$(cd $(dirname "$lib_dir"); pwd) - local include_dir="${base_dir}/include" - local bin_dir="${base_dir}/bin" - - my_sed_i "s|^prefix=.*|prefix=$base_dir|" "$pc" - my_sed_i "s|^exec_prefix=[^$].*|exec_prefix=$bin_dir|" $pc - my_sed_i "s|^libdir=[^$].*|libdir=$lib_dir|" "$pc" - my_sed_i "s|^includedir=[^$].*include|includedir=$include_dir|" "$pc" - my_sed_i "s|-L/[^ ]*lib|-L$lib_dir|" "$pc" - my_sed_i "s|-I/[^ ]*include|-I$include_dir|" "$pc" - done - - cd "$dir" -} - function parse_path() { local p="$1" @@ -149,6 +123,7 @@ arch= libs= workspace= debug= +pc_file_dir= case $1 in init | install) @@ -166,7 +141,6 @@ case $1 in ;; esac -export -f correct_pc_file export MR_ACTION=$action while [[ $# -gt 0 ]]; do @@ -213,8 +187,7 @@ while [[ $# -gt 0 ]]; do ;; -correct-pc) shift - correct_pc_file "$1" - exit 0 + pc_file_dir="$1" ;; **) echo "unkonwn option:$1" @@ -224,6 +197,7 @@ while [[ $# -gt 0 ]]; do done if [[ -z "$platform" ]];then + echo "platform can't empty" help exit 1 fi @@ -233,7 +207,9 @@ if [[ "$platform" != 'ios' && "$platform" != 'macos' && "$platform" != 'tvos' && exit 1 fi -if [[ -z "$libs" ]];then +export MR_PC_FILE_DIR="$pc_file_dir" + +if [[ -z "$MR_PC_FILE_DIR" && -z "$libs" ]];then echo "libs can't be nil, use -l specify libs" exit 1 fi @@ -293,6 +269,7 @@ else done fi + echo "MR_ACTION : [$MR_ACTION]" echo "MR_PLAT : [$MR_PLAT]" echo "MR_CMD : [$MR_CMD]" @@ -304,5 +281,6 @@ echo "MR_INIT_CFLAGS : [$MR_INIT_CFLAGS]" echo "SKIP_PULL_BASE : [$SKIP_PULL_BASE]" echo "SKIP_FFMPEG_PATHCHES : [$SKIP_FFMPEG_PATHCHES]" echo "MR_SKIP_MAKE_XCFRAMEWORK" : [$MR_SKIP_MAKE_XCFRAMEWORK] +[[ -n $MR_PC_FILE_DIR ]] && echo "MR_PC_FILE_DIR : [$MR_PC_FILE_DIR]" -unset platform cmd arch libs workspace debug action cflags +unset platform cmd arch libs workspace debug action cflags pc_file_dir From 2fcc0b484e609c620ff984fd27d7d038951a38ab Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Fri, 20 Jun 2025 17:40:10 +0800 Subject: [PATCH 099/359] format --- README.md | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index a65b95584..66a2ae277 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ At present MRFFToolChain contained `ass、bluray、dav1d、dvdread、dvdnav、ff - FFmpeg 7.1.1 is already in use - upgrade all libs to lastest,Improved optimizations -- using macOS 14, remove bitcode support +- using macOS 14,Xcode_15.4,remove bitcode support [https://developer.apple.com/documentation/xcode-release-notes/xcode-14-release-notes#Deprecations](https://developer.apple.com/documentation/xcode-release-notes/xcode-14-release-notes#Deprecations) @@ -49,7 +49,7 @@ Tips: 2、fsplayer is denpendent on ffmpeg and ass. 3、ijkplayer is denpendent on ijkffmpeg. 4、FFmpegTutorial is denpendent on fftutorial. -4、when install pre-compiled lib, will containes it's denpendencies. +5、when install pre-compiled lib, will containes it's denpendencies. ``` ## Download/Install Pre-compiled Libs @@ -95,7 +95,7 @@ Once the source code repository initialization is complete, you can start the co ./main.sh compile --help # As shown in the help: # -p specifies the platform -# -c specifies the action (e.g., build for compilation, rebuild for recompilation) +# -c specifies the action (e.g build for compilation, rebuild for recompilation) # -l specifies the libraries to compile # -a specifies the CPU architecture ``` @@ -107,7 +107,7 @@ The following code demonstrates how to compile FFmpeg 7 for the iOS platform: # recommend choice (because ffmpeg7 was pre-compiled,it contained all dependencies) ./main.sh install -p ios -l ffmpeg7 # other choice (you must know ffmpeg7's dependent lib name) -./main.sh install -p ios -l "openssl3 opus bluray dav1d dvdnav uavs3d,smb2" +./main.sh install -p ios -l "openssl3 opus bluray dav1d dvdnav uavs3d smb2" # Compile FFmpeg7 for the arm64 architecture on iOS ./main.sh compile -p ios -a arm64 -l ffmepg7 --skip-fmwk ``` @@ -120,25 +120,25 @@ If cloning repositories from GitHub is slow, or if you need to use an internal p | Lib Name | Current Version | Repository URL | Mirror Repository URL | | ---------- | --------------- | -------------------------------------------------------- | -------------------------------------------------------- | -| ffmpeg7 | 7.1.1 | https://github.com/FFmpeg/FFmpeg.git | export GIT_FFMPEG_UPSTREAM = git@xx:yy/FFmpeg.git | -| ffmpeg6 | 6.1.1 | https://github.com/FFmpeg/FFmpeg.git | export GIT_FFMPEG_UPSTREAM = git@xx:yy/FFmpeg.git | -| ffmpeg5 | 5.1.6 | https://github.com/FFmpeg/FFmpeg.git | export GIT_FFMPEG_UPSTREAM = git@xx:yy/FFmpeg.git | -| ffmpeg4 | 4.0.5 | https://github.com/FFmpeg/FFmpeg.git | export GIT_FFMPEG_UPSTREAM = git@xx:yy/FFmpeg.git | -| ass | 0.17.3 | https://github.com/libass/libass.git | export GIT_ASS_UPSTREAM = git@xx:yy/libass.git | -| bluray | 1.3.4 | https://code.videolan.org/videolan/libbluray.git | export GIT_BLURAY_UPSTREAM = git@xx:yy/libbluray.git | -| dav1d | 1.5.1 | https://code.videolan.org/videolan/dav1d.git | export GIT_DAV1D_UPSTREAM = git@xx:yy/dav1d.git | -| dvdread | 6.1.3 | https://code.videolan.org/videolan/libdvdread.git | export GIT_DVDREAD_UPSTREAM = git@xx:yy/libdvdread.git | -| dvdnav | master-9831fe01 | https://code.videolan.org/videolan/libdvdnav.git | export GIT_DVDNAV_UPSTREAM = git@xx:yy/libdvdnav.git | +| ffmpeg7 | 7.1.1 | https://github.com/FFmpeg/FFmpeg.git | export GIT_FFMPEG_UPSTREAM=git@xx:yy/FFmpeg.git | +| ffmpeg6 | 6.1.1 | https://github.com/FFmpeg/FFmpeg.git | export GIT_FFMPEG_UPSTREAM=git@xx:yy/FFmpeg.git | +| ffmpeg5 | 5.1.6 | https://github.com/FFmpeg/FFmpeg.git | export GIT_FFMPEG_UPSTREAM=git@xx:yy/FFmpeg.git | +| ffmpeg4 | 4.0.5 | https://github.com/FFmpeg/FFmpeg.git | export GIT_FFMPEG_UPSTREAM=git@xx:yy/FFmpeg.git | +| ass | 0.17.3 | https://github.com/libass/libass.git | export GIT_ASS_UPSTREAM=git@xx:yy/libass.git | +| bluray | 1.3.4 | https://code.videolan.org/videolan/libbluray.git | export GIT_BLURAY_UPSTREAM=git@xx:yy/libbluray.git | +| dav1d | 1.5.1 | https://code.videolan.org/videolan/dav1d.git | export GIT_DAV1D_UPSTREAM=git@xx:yy/dav1d.git | +| dvdread | 6.1.3 | https://code.videolan.org/videolan/libdvdread.git | export GIT_DVDREAD_UPSTREAM=git@xx:yy/libdvdread.git | +| dvdnav | master-9831fe01 | https://code.videolan.org/videolan/libdvdnav.git | export GIT_DVDNAV_UPSTREAM=git@xx:yy/libdvdnav.git | | fontconfig | 2.16.0 | https://gitlab.freedesktop.org/fontconfig/fontconfig.git | export GIT_FONTCONFIG_UPSTREAM=git@xx:yy/fontconfig.git | -| freetype | 2.13.3 | https://gitlab.freedesktop.org/freetype/freetype.git | export GIT_FREETYPE_UPSTREAM = git@xx:yy/freetype.git | -| fribidi | 1.0.16 | https://github.com/fribidi/fribidi.git | export GIT_FRIBIDI_UPSTREAM = git@xx:yy/fribidi.git | -| harfbuzz | 10.2.0 | https://github.com/harfbuzz/harfbuzz.git | export GIT_HARFBUZZ_UPSTREAM = git@xx:yy/harfbuzz.git | -| openssl | 1.1.1w | https://github.com/openssl/openssl.git | export GIT_OPENSSL_UPSTREAM = git@xx:yy/openssl.git | -| openssl3 | 3.5.0 | https://github.com/openssl/openssl.git | export GIT_OPENSSL_UPSTREAM = git@xx:yy/openssl.git | -| opus | 1.5.2 | https://gitlab.xiph.org/xiph/opus.git | export GIT_OPUS_UPSTREAM = git@xx:yy/opus.git | +| freetype | 2.13.3 | https://gitlab.freedesktop.org/freetype/freetype.git | export GIT_FREETYPE_UPSTREAM=git@xx:yy/freetype.git | +| fribidi | 1.0.16 | https://github.com/fribidi/fribidi.git | export GIT_FRIBIDI_UPSTREAM=git@xx:yy/fribidi.git | +| harfbuzz | 10.2.0 | https://github.com/harfbuzz/harfbuzz.git | export GIT_HARFBUZZ_UPSTREAM=git@xx:yy/harfbuzz.git | +| openssl | 1.1.1w | https://github.com/openssl/openssl.git | export GIT_OPENSSL_UPSTREAM=git@xx:yy/openssl.git | +| openssl3 | 3.5.0 | https://github.com/openssl/openssl.git | export GIT_OPENSSL_UPSTREAM=git@xx:yy/openssl.git | +| opus | 1.5.2 | https://gitlab.xiph.org/xiph/opus.git | export GIT_OPUS_UPSTREAM=git@xx:yy/opus.git | | smb2 | 6.2 | https://github.com/sahlberg/libsmb2.git | export GIT_SMB2_UPSTREAM=git@xx:yy/libsmb2.git | | soundtouch | 2.3.3 | https://codeberg.org/soundtouch/soundtouch.git | export GIT_SOUNDTOUCH_UPSTREAM=git@xx:yy/soundtouch.git | -| unibreak | 6.1 | https://github.com/adah1972/libunibreak.git | export GIT_UNIBREAK_UPSTREAM = git@xx:yy/libunibreak.git | +| unibreak | 6.1 | https://github.com/adah1972/libunibreak.git | export GIT_UNIBREAK_UPSTREAM=git@xx:yy/libunibreak.git | | uavs3d | 1.2.1 | https://github.com/uavs3/uavs3d.git | export GIT_UAVS3D_UPSTREAM=git@xx:yy/UAVS3D.git | | xml2 | 2.13.6 | https://github.com/GNOME/libxml2.git | export GIT_FONTCONFIG_UPSTREAM=git@xx:yy/fontconfig.git | | yuv | stable-eb6e7bb | https://github.com/debugly/libyuv.git | export GIT_YUV_UPSTREAM=git@xx:yy/yuv.git | From 7afdcd9a4a47dc2dc9aa1f2d22f4b6cbaf1831a0 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Mon, 23 Jun 2025 10:09:25 +0800 Subject: [PATCH 100/359] ffmpeg 5 add dash patches --- ...ragment-url-is-invalid-truncated-bug.patch | 43 +++++++++++++++++++ ...ror-unterminated-entity-reference-du.patch | 29 +++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 patches/ffmpeg-n5.1/0030-fix-dash-init-fragment-url-is-invalid-truncated-bug.patch create mode 100644 patches/ffmpeg-n5.1/0031-fix-dash-file-error-unterminated-entity-reference-du.patch diff --git a/patches/ffmpeg-n5.1/0030-fix-dash-init-fragment-url-is-invalid-truncated-bug.patch b/patches/ffmpeg-n5.1/0030-fix-dash-init-fragment-url-is-invalid-truncated-bug.patch new file mode 100644 index 000000000..3d4cb7d3c --- /dev/null +++ b/patches/ffmpeg-n5.1/0030-fix-dash-init-fragment-url-is-invalid-truncated-bug.patch @@ -0,0 +1,43 @@ +From ca6bf697d914be79fcc4d4314c06101d279b6ef3 Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Wed, 21 May 2025 18:05:52 +0800 +Subject: [PATCH] fix dash init fragment url is "invalid:truncated" bug + +--- + libavformat/dashdec.c | 12 +++++++++++- + 1 file changed, 11 insertions(+), 1 deletion(-) + +diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c +index 0a6c46b..616187f 100644 +--- a/libavformat/dashdec.c ++++ b/libavformat/dashdec.c +@@ -477,6 +477,10 @@ static char *get_content_url(xmlNodePtr *baseurl_nodes, + int i; + char *text; + char *url = NULL; ++ ++ if (strlen(val) >= max_url_size) { ++ max_url_size += 256; ++ } + char *tmp_str = av_mallocz(max_url_size); + + if (!tmp_str) +@@ -495,8 +499,14 @@ static char *get_content_url(xmlNodePtr *baseurl_nodes, + } + } + +- if (val) ++ if (val) { ++ int tmp_max_url_size = strlen(tmp_str) + strlen(val) + 1; ++ if (tmp_max_url_size > max_url_size) { ++ max_url_size = tmp_max_url_size; ++ tmp_str = av_realloc(tmp_str, max_url_size); ++ } + ff_make_absolute_url(tmp_str, max_url_size, tmp_str, val); ++ } + + if (rep_id_val) { + url = av_strireplace(tmp_str, "$RepresentationID$", rep_id_val); +-- +2.39.5 (Apple Git-154) + diff --git a/patches/ffmpeg-n5.1/0031-fix-dash-file-error-unterminated-entity-reference-du.patch b/patches/ffmpeg-n5.1/0031-fix-dash-file-error-unterminated-entity-reference-du.patch new file mode 100644 index 000000000..faeaec17b --- /dev/null +++ b/patches/ffmpeg-n5.1/0031-fix-dash-file-error-unterminated-entity-reference-du.patch @@ -0,0 +1,29 @@ +From 147a176cf02538367918d931959dbb5071202777 Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Thu, 29 May 2025 09:45:39 +0800 +Subject: [PATCH] fix dash file error "unterminated entity reference" due to + ampersand in tag + +--- + libavformat/dashdec.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c +index 71d7906..4540ee3 100644 +--- a/libavformat/dashdec.c ++++ b/libavformat/dashdec.c +@@ -805,8 +805,10 @@ static int resolve_content_path(AVFormatContext *s, const char *url, int *max_ur + memset(p + 1, 0, strlen(p)); + } + av_strlcat(tmp_str, text + start, tmp_max_url_size); +- xmlNodeSetContent(baseurl_nodes[i], tmp_str); ++ xmlChar *escaped = xmlEncodeSpecialChars(NULL, tmp_str); ++ xmlNodeSetContent(baseurl_nodes[i], escaped); + updated = 1; ++ xmlFree(escaped); + xmlFree(text); + } + } +-- +2.39.5 (Apple Git-154) + From 8d16a75279294fc715984a46e277e65663ed884d Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Mon, 23 Jun 2025 10:09:48 +0800 Subject: [PATCH 101/359] ffmpeg 6 add dash patch --- ...ragment-url-is-invalid-truncated-bug.patch | 43 +++++++++++++++++++ ...or-unterminated-entity-reference-du.patch} | 2 +- ...g6-test.c-1-10-fatal-error-libxml2-.patch} | 2 +- 3 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 patches/ffmpeg-n6.1/0031-fix-dash-init-fragment-url-is-invalid-truncated-bug.patch rename patches/ffmpeg-n6.1/{0031-fix-dash-file-error-unterminated-entity-reference-du.patch => 0032-fix-dash-file-error-unterminated-entity-reference-du.patch} (92%) rename patches/ffmpeg-n6.1/{0032-fix-android-ffmpeg6-test.c-1-10-fatal-error-libxml2-.patch => 0033-fix-android-ffmpeg6-test.c-1-10-fatal-error-libxml2-.patch} (95%) diff --git a/patches/ffmpeg-n6.1/0031-fix-dash-init-fragment-url-is-invalid-truncated-bug.patch b/patches/ffmpeg-n6.1/0031-fix-dash-init-fragment-url-is-invalid-truncated-bug.patch new file mode 100644 index 000000000..83f0d8dbb --- /dev/null +++ b/patches/ffmpeg-n6.1/0031-fix-dash-init-fragment-url-is-invalid-truncated-bug.patch @@ -0,0 +1,43 @@ +From ca6bf697d914be79fcc4d4314c06101d279b6ef3 Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Wed, 21 May 2025 18:05:52 +0800 +Subject: [PATCH 31] fix dash init fragment url is "invalid:truncated" bug + +--- + libavformat/dashdec.c | 12 +++++++++++- + 1 file changed, 11 insertions(+), 1 deletion(-) + +diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c +index 0a6c46b..616187f 100644 +--- a/libavformat/dashdec.c ++++ b/libavformat/dashdec.c +@@ -477,6 +477,10 @@ static char *get_content_url(xmlNodePtr *baseurl_nodes, + int i; + char *text; + char *url = NULL; ++ ++ if (strlen(val) >= max_url_size) { ++ max_url_size += 256; ++ } + char *tmp_str = av_mallocz(max_url_size); + + if (!tmp_str) +@@ -495,8 +499,14 @@ static char *get_content_url(xmlNodePtr *baseurl_nodes, + } + } + +- if (val) ++ if (val) { ++ int tmp_max_url_size = strlen(tmp_str) + strlen(val) + 1; ++ if (tmp_max_url_size > max_url_size) { ++ max_url_size = tmp_max_url_size; ++ tmp_str = av_realloc(tmp_str, max_url_size); ++ } + ff_make_absolute_url(tmp_str, max_url_size, tmp_str, val); ++ } + + if (rep_id_val) { + url = av_strireplace(tmp_str, "$RepresentationID$", rep_id_val); +-- +2.39.5 (Apple Git-154) + diff --git a/patches/ffmpeg-n6.1/0031-fix-dash-file-error-unterminated-entity-reference-du.patch b/patches/ffmpeg-n6.1/0032-fix-dash-file-error-unterminated-entity-reference-du.patch similarity index 92% rename from patches/ffmpeg-n6.1/0031-fix-dash-file-error-unterminated-entity-reference-du.patch rename to patches/ffmpeg-n6.1/0032-fix-dash-file-error-unterminated-entity-reference-du.patch index d9fe1788c..c433a2222 100644 --- a/patches/ffmpeg-n6.1/0031-fix-dash-file-error-unterminated-entity-reference-du.patch +++ b/patches/ffmpeg-n6.1/0032-fix-dash-file-error-unterminated-entity-reference-du.patch @@ -1,7 +1,7 @@ From aa792f13138a726d80df869f62ebf4769a851fef Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Tue, 6 May 2025 17:49:09 +0800 -Subject: [PATCH] fix dash file error "unterminated entity reference" due to +Subject: [PATCH 32] fix dash file error "unterminated entity reference" due to ampersand in tag --- diff --git a/patches/ffmpeg-n6.1/0032-fix-android-ffmpeg6-test.c-1-10-fatal-error-libxml2-.patch b/patches/ffmpeg-n6.1/0033-fix-android-ffmpeg6-test.c-1-10-fatal-error-libxml2-.patch similarity index 95% rename from patches/ffmpeg-n6.1/0032-fix-android-ffmpeg6-test.c-1-10-fatal-error-libxml2-.patch rename to patches/ffmpeg-n6.1/0033-fix-android-ffmpeg6-test.c-1-10-fatal-error-libxml2-.patch index f309f9c71..afa3593c0 100644 --- a/patches/ffmpeg-n6.1/0032-fix-android-ffmpeg6-test.c-1-10-fatal-error-libxml2-.patch +++ b/patches/ffmpeg-n6.1/0033-fix-android-ffmpeg6-test.c-1-10-fatal-error-libxml2-.patch @@ -1,7 +1,7 @@ From 57d11e82ad725d7c598378b70c6288bb96cc9e58 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Fri, 6 Jun 2025 14:07:11 +0800 -Subject: [PATCH 32] fix android ffmpeg6 test.c:1:10: fatal error: +Subject: [PATCH 33] fix android ffmpeg6 test.c:1:10: fatal error: 'libxml2/libxml/xmlversion.h' --- From a1db389cd54f1644bcb85d36db656bf12f9e7432 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Mon, 23 Jun 2025 10:10:01 +0800 Subject: [PATCH 102/359] ffmpeg 7 add a dash patch --- ...r-and-Demuxer-but-av3a-Decoder-is-a.patch} | 0 ...-http-add-reconnect_first_delay-opt.patch} | 0 ...-http_seek-redirect-authentication-.patch} | 0 ...-only-available-on-iOS-13.0-or-newe.patch} | 0 ...-built-in-smb2-protocol-via-libsmb2.patch} | 0 ...add-url_parse_priv-function-pointer.patch} | 0 ...26-bluray-protocol-add-dvd-fallback.patch} | 0 ...s-for-network-Blu-ray-Disc-and-BDMV.patch} | 0 ...ind-the-right-m2ts-then-read-seek-i.patch} | 0 ...g7-test.c-1-10-fatal-error-libxml2-.patch} | 0 ...ragment-url-is-invalid-truncated-bug.patch | 43 +++++++++++++++++++ ...or-unterminated-entity-reference-du.patch} | 0 12 files changed, 43 insertions(+) rename patches/ffmpeg-n7.1.1/{0021-Audio-Vivid-Parser-and-Demuxer-but-av3a-Decoder-is-a.patch => 0020-Audio-Vivid-Parser-and-Demuxer-but-av3a-Decoder-is-a.patch} (100%) rename patches/ffmpeg-n7.1.1/{0022-http-add-reconnect_first_delay-opt.patch => 0021-http-add-reconnect_first_delay-opt.patch} (100%) rename patches/ffmpeg-n7.1.1/{0023-fix-http-open-and-http_seek-redirect-authentication-.patch => 0022-fix-http-open-and-http_seek-redirect-authentication-.patch} (100%) rename patches/ffmpeg-n7.1.1/{0024-supportsFamily-is-only-available-on-iOS-13.0-or-newe.patch => 0023-supportsFamily-is-only-available-on-iOS-13.0-or-newe.patch} (100%) rename patches/ffmpeg-n7.1.1/{0025-add-built-in-smb2-protocol-via-libsmb2.patch => 0024-add-built-in-smb2-protocol-via-libsmb2.patch} (100%) rename patches/ffmpeg-n7.1.1/{0026-URLProtocol-add-url_parse_priv-function-pointer.patch => 0025-URLProtocol-add-url_parse_priv-function-pointer.patch} (100%) rename patches/ffmpeg-n7.1.1/{0027-bluray-protocol-add-dvd-fallback.patch => 0026-bluray-protocol-add-dvd-fallback.patch} (100%) rename patches/ffmpeg-n7.1.1/{0028-custom-bluray-fs-for-network-Blu-ray-Disc-and-BDMV.patch => 0027-custom-bluray-fs-for-network-Blu-ray-Disc-and-BDMV.patch} (100%) rename patches/ffmpeg-n7.1.1/{0029-bluray-open-and-find-the-right-m2ts-then-read-seek-i.patch => 0028-bluray-open-and-find-the-right-m2ts-then-read-seek-i.patch} (100%) rename patches/ffmpeg-n7.1.1/{0030-fix-android-ffmpeg7-test.c-1-10-fatal-error-libxml2-.patch => 0029-fix-android-ffmpeg7-test.c-1-10-fatal-error-libxml2-.patch} (100%) create mode 100644 patches/ffmpeg-n7.1.1/0030-fix-dash-init-fragment-url-is-invalid-truncated-bug.patch rename patches/ffmpeg-n7.1.1/{0020-fix-dash-file-error-unterminated-entity-reference-du.patch => 0031-fix-dash-file-error-unterminated-entity-reference-du.patch} (100%) diff --git a/patches/ffmpeg-n7.1.1/0021-Audio-Vivid-Parser-and-Demuxer-but-av3a-Decoder-is-a.patch b/patches/ffmpeg-n7.1.1/0020-Audio-Vivid-Parser-and-Demuxer-but-av3a-Decoder-is-a.patch similarity index 100% rename from patches/ffmpeg-n7.1.1/0021-Audio-Vivid-Parser-and-Demuxer-but-av3a-Decoder-is-a.patch rename to patches/ffmpeg-n7.1.1/0020-Audio-Vivid-Parser-and-Demuxer-but-av3a-Decoder-is-a.patch diff --git a/patches/ffmpeg-n7.1.1/0022-http-add-reconnect_first_delay-opt.patch b/patches/ffmpeg-n7.1.1/0021-http-add-reconnect_first_delay-opt.patch similarity index 100% rename from patches/ffmpeg-n7.1.1/0022-http-add-reconnect_first_delay-opt.patch rename to patches/ffmpeg-n7.1.1/0021-http-add-reconnect_first_delay-opt.patch diff --git a/patches/ffmpeg-n7.1.1/0023-fix-http-open-and-http_seek-redirect-authentication-.patch b/patches/ffmpeg-n7.1.1/0022-fix-http-open-and-http_seek-redirect-authentication-.patch similarity index 100% rename from patches/ffmpeg-n7.1.1/0023-fix-http-open-and-http_seek-redirect-authentication-.patch rename to patches/ffmpeg-n7.1.1/0022-fix-http-open-and-http_seek-redirect-authentication-.patch diff --git a/patches/ffmpeg-n7.1.1/0024-supportsFamily-is-only-available-on-iOS-13.0-or-newe.patch b/patches/ffmpeg-n7.1.1/0023-supportsFamily-is-only-available-on-iOS-13.0-or-newe.patch similarity index 100% rename from patches/ffmpeg-n7.1.1/0024-supportsFamily-is-only-available-on-iOS-13.0-or-newe.patch rename to patches/ffmpeg-n7.1.1/0023-supportsFamily-is-only-available-on-iOS-13.0-or-newe.patch diff --git a/patches/ffmpeg-n7.1.1/0025-add-built-in-smb2-protocol-via-libsmb2.patch b/patches/ffmpeg-n7.1.1/0024-add-built-in-smb2-protocol-via-libsmb2.patch similarity index 100% rename from patches/ffmpeg-n7.1.1/0025-add-built-in-smb2-protocol-via-libsmb2.patch rename to patches/ffmpeg-n7.1.1/0024-add-built-in-smb2-protocol-via-libsmb2.patch diff --git a/patches/ffmpeg-n7.1.1/0026-URLProtocol-add-url_parse_priv-function-pointer.patch b/patches/ffmpeg-n7.1.1/0025-URLProtocol-add-url_parse_priv-function-pointer.patch similarity index 100% rename from patches/ffmpeg-n7.1.1/0026-URLProtocol-add-url_parse_priv-function-pointer.patch rename to patches/ffmpeg-n7.1.1/0025-URLProtocol-add-url_parse_priv-function-pointer.patch diff --git a/patches/ffmpeg-n7.1.1/0027-bluray-protocol-add-dvd-fallback.patch b/patches/ffmpeg-n7.1.1/0026-bluray-protocol-add-dvd-fallback.patch similarity index 100% rename from patches/ffmpeg-n7.1.1/0027-bluray-protocol-add-dvd-fallback.patch rename to patches/ffmpeg-n7.1.1/0026-bluray-protocol-add-dvd-fallback.patch diff --git a/patches/ffmpeg-n7.1.1/0028-custom-bluray-fs-for-network-Blu-ray-Disc-and-BDMV.patch b/patches/ffmpeg-n7.1.1/0027-custom-bluray-fs-for-network-Blu-ray-Disc-and-BDMV.patch similarity index 100% rename from patches/ffmpeg-n7.1.1/0028-custom-bluray-fs-for-network-Blu-ray-Disc-and-BDMV.patch rename to patches/ffmpeg-n7.1.1/0027-custom-bluray-fs-for-network-Blu-ray-Disc-and-BDMV.patch diff --git a/patches/ffmpeg-n7.1.1/0029-bluray-open-and-find-the-right-m2ts-then-read-seek-i.patch b/patches/ffmpeg-n7.1.1/0028-bluray-open-and-find-the-right-m2ts-then-read-seek-i.patch similarity index 100% rename from patches/ffmpeg-n7.1.1/0029-bluray-open-and-find-the-right-m2ts-then-read-seek-i.patch rename to patches/ffmpeg-n7.1.1/0028-bluray-open-and-find-the-right-m2ts-then-read-seek-i.patch diff --git a/patches/ffmpeg-n7.1.1/0030-fix-android-ffmpeg7-test.c-1-10-fatal-error-libxml2-.patch b/patches/ffmpeg-n7.1.1/0029-fix-android-ffmpeg7-test.c-1-10-fatal-error-libxml2-.patch similarity index 100% rename from patches/ffmpeg-n7.1.1/0030-fix-android-ffmpeg7-test.c-1-10-fatal-error-libxml2-.patch rename to patches/ffmpeg-n7.1.1/0029-fix-android-ffmpeg7-test.c-1-10-fatal-error-libxml2-.patch diff --git a/patches/ffmpeg-n7.1.1/0030-fix-dash-init-fragment-url-is-invalid-truncated-bug.patch b/patches/ffmpeg-n7.1.1/0030-fix-dash-init-fragment-url-is-invalid-truncated-bug.patch new file mode 100644 index 000000000..3d4cb7d3c --- /dev/null +++ b/patches/ffmpeg-n7.1.1/0030-fix-dash-init-fragment-url-is-invalid-truncated-bug.patch @@ -0,0 +1,43 @@ +From ca6bf697d914be79fcc4d4314c06101d279b6ef3 Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Wed, 21 May 2025 18:05:52 +0800 +Subject: [PATCH] fix dash init fragment url is "invalid:truncated" bug + +--- + libavformat/dashdec.c | 12 +++++++++++- + 1 file changed, 11 insertions(+), 1 deletion(-) + +diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c +index 0a6c46b..616187f 100644 +--- a/libavformat/dashdec.c ++++ b/libavformat/dashdec.c +@@ -477,6 +477,10 @@ static char *get_content_url(xmlNodePtr *baseurl_nodes, + int i; + char *text; + char *url = NULL; ++ ++ if (strlen(val) >= max_url_size) { ++ max_url_size += 256; ++ } + char *tmp_str = av_mallocz(max_url_size); + + if (!tmp_str) +@@ -495,8 +499,14 @@ static char *get_content_url(xmlNodePtr *baseurl_nodes, + } + } + +- if (val) ++ if (val) { ++ int tmp_max_url_size = strlen(tmp_str) + strlen(val) + 1; ++ if (tmp_max_url_size > max_url_size) { ++ max_url_size = tmp_max_url_size; ++ tmp_str = av_realloc(tmp_str, max_url_size); ++ } + ff_make_absolute_url(tmp_str, max_url_size, tmp_str, val); ++ } + + if (rep_id_val) { + url = av_strireplace(tmp_str, "$RepresentationID$", rep_id_val); +-- +2.39.5 (Apple Git-154) + diff --git a/patches/ffmpeg-n7.1.1/0020-fix-dash-file-error-unterminated-entity-reference-du.patch b/patches/ffmpeg-n7.1.1/0031-fix-dash-file-error-unterminated-entity-reference-du.patch similarity index 100% rename from patches/ffmpeg-n7.1.1/0020-fix-dash-file-error-unterminated-entity-reference-du.patch rename to patches/ffmpeg-n7.1.1/0031-fix-dash-file-error-unterminated-entity-reference-du.patch From ee4009b8757356f041bd35e4d7ca3593550d764c Mon Sep 17 00:00:00 2001 From: Anka Date: Mon, 23 Jun 2025 02:25:51 +0000 Subject: [PATCH 103/359] upgrade ffmpeg5 to ffmpeg5-5.1.6-250623101211 for apple by cd --- configs/libs/ffmpeg5.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configs/libs/ffmpeg5.sh b/configs/libs/ffmpeg5.sh index 1d8378955..2b37e2f17 100644 --- a/configs/libs/ffmpeg5.sh +++ b/configs/libs/ffmpeg5.sh @@ -41,7 +41,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=ffmpeg5-5.1.6-250610112554 -export PRE_COMPILE_TAG_MACOS=ffmpeg5-5.1.6-250610112554 -export PRE_COMPILE_TAG_IOS=ffmpeg5-5.1.6-250610112554 +export PRE_COMPILE_TAG_TVOS=ffmpeg5-5.1.6-250623101211 +export PRE_COMPILE_TAG_MACOS=ffmpeg5-5.1.6-250623101211 +export PRE_COMPILE_TAG_IOS=ffmpeg5-5.1.6-250623101211 export PRE_COMPILE_TAG_ANDROID=ffmpeg5-5.1.6-250606140646 \ No newline at end of file From caf7af6be562b28599c47f19fcd1b201f817f85b Mon Sep 17 00:00:00 2001 From: Anka Date: Mon, 23 Jun 2025 02:43:09 +0000 Subject: [PATCH 104/359] upgrade ffmpeg6 to ffmpeg6-6.1.1-250623102829 for apple by cd --- configs/libs/ffmpeg6.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configs/libs/ffmpeg6.sh b/configs/libs/ffmpeg6.sh index 684caeaa8..3054a351e 100644 --- a/configs/libs/ffmpeg6.sh +++ b/configs/libs/ffmpeg6.sh @@ -41,7 +41,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=ffmpeg6-6.1.1-250610115223 -export PRE_COMPILE_TAG_MACOS=ffmpeg6-6.1.1-250610115223 -export PRE_COMPILE_TAG_IOS=ffmpeg6-6.1.1-250610115223 +export PRE_COMPILE_TAG_TVOS=ffmpeg6-6.1.1-250623102829 +export PRE_COMPILE_TAG_MACOS=ffmpeg6-6.1.1-250623102829 +export PRE_COMPILE_TAG_IOS=ffmpeg6-6.1.1-250623102829 export PRE_COMPILE_TAG_ANDROID=ffmpeg6-6.1.1-250606143448 \ No newline at end of file From 5772f8b51a80a91cbf9cdb0abc45f736437e2cde Mon Sep 17 00:00:00 2001 From: Anka Date: Mon, 23 Jun 2025 02:47:40 +0000 Subject: [PATCH 105/359] upgrade ffmpeg7 to ffmpeg7-7.1.1-250623102840 for apple by cd --- configs/libs/ffmpeg7.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configs/libs/ffmpeg7.sh b/configs/libs/ffmpeg7.sh index b6e9bd0da..0a156d85b 100644 --- a/configs/libs/ffmpeg7.sh +++ b/configs/libs/ffmpeg7.sh @@ -42,8 +42,8 @@ fi # pre compiled -export PRE_COMPILE_TAG_TVOS=ffmpeg7-7.1.1-250610115224 -export PRE_COMPILE_TAG_MACOS=ffmpeg7-7.1.1-250610115224 -export PRE_COMPILE_TAG_IOS=ffmpeg7-7.1.1-250610115224 +export PRE_COMPILE_TAG_TVOS=ffmpeg7-7.1.1-250623102840 +export PRE_COMPILE_TAG_MACOS=ffmpeg7-7.1.1-250623102840 +export PRE_COMPILE_TAG_IOS=ffmpeg7-7.1.1-250623102840 export PRE_COMPILE_TAG_ANDROID=ffmpeg7-7.1.1-250606143631 From 0d86d46228f004213d1587ac316375783ccea2d7 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Tue, 24 Jun 2025 16:28:44 +0800 Subject: [PATCH 106/359] rm GIT_FFMPEG_COMMIT --- configs/libs/ffmpeg4.sh | 9 ++------- configs/libs/ffmpeg5.sh | 9 ++------- configs/libs/ffmpeg6.sh | 9 ++------- configs/libs/ffmpeg7.sh | 9 ++------- configs/libs/fftutorial.sh | 9 ++------- 5 files changed, 10 insertions(+), 35 deletions(-) diff --git a/configs/libs/ffmpeg4.sh b/configs/libs/ffmpeg4.sh index c3766fb6d..32c614371 100644 --- a/configs/libs/ffmpeg4.sh +++ b/configs/libs/ffmpeg4.sh @@ -32,13 +32,8 @@ else export GIT_UPSTREAM=https://github.com/FFmpeg/FFmpeg.git fi -if [[ "$GIT_FFMPEG_COMMIT" != "" ]] ;then - export GIT_COMMIT="$GIT_FFMPEG_COMMIT" - export GIT_REPO_VERSION="$GIT_FFMPEG_COMMIT" -else - export GIT_COMMIT=n4.0.5 - export GIT_REPO_VERSION=4.0.5 -fi +export GIT_COMMIT=n4.0.5 +export GIT_REPO_VERSION=4.0.5 # pre compiled export PRE_COMPILE_TAG_TVOS=ffmpeg4-4.0.5-250610182859 diff --git a/configs/libs/ffmpeg5.sh b/configs/libs/ffmpeg5.sh index 2b37e2f17..9c98463c4 100644 --- a/configs/libs/ffmpeg5.sh +++ b/configs/libs/ffmpeg5.sh @@ -32,13 +32,8 @@ else export GIT_UPSTREAM=https://github.com/FFmpeg/FFmpeg.git fi -if [[ "$GIT_FFMPEG_COMMIT" != "" ]] ;then - export GIT_COMMIT="$GIT_FFMPEG_COMMIT" - export GIT_REPO_VERSION="$GIT_FFMPEG_COMMIT" -else - export GIT_COMMIT=n5.1.6 - export GIT_REPO_VERSION=5.1.6 -fi +export GIT_COMMIT=n5.1.6 +export GIT_REPO_VERSION=5.1.6 # pre compiled export PRE_COMPILE_TAG_TVOS=ffmpeg5-5.1.6-250623101211 diff --git a/configs/libs/ffmpeg6.sh b/configs/libs/ffmpeg6.sh index 3054a351e..1e43a11fa 100644 --- a/configs/libs/ffmpeg6.sh +++ b/configs/libs/ffmpeg6.sh @@ -32,13 +32,8 @@ else export GIT_UPSTREAM=https://github.com/FFmpeg/FFmpeg.git fi -if [[ "$GIT_FFMPEG_COMMIT" != "" ]] ;then - export GIT_COMMIT="$GIT_FFMPEG_COMMIT" - export GIT_REPO_VERSION="$GIT_FFMPEG_COMMIT" -else - export GIT_COMMIT=n6.1.1 #origin/release/5.1 - export GIT_REPO_VERSION=6.1.1 -fi +export GIT_COMMIT=n6.1.1 #origin/release/5.1 +export GIT_REPO_VERSION=6.1.1 # pre compiled export PRE_COMPILE_TAG_TVOS=ffmpeg6-6.1.1-250623102829 diff --git a/configs/libs/ffmpeg7.sh b/configs/libs/ffmpeg7.sh index 0a156d85b..7d13fca6d 100644 --- a/configs/libs/ffmpeg7.sh +++ b/configs/libs/ffmpeg7.sh @@ -32,13 +32,8 @@ else export GIT_UPSTREAM=https://github.com/FFmpeg/FFmpeg.git fi -if [[ "$GIT_FFMPEG_COMMIT" != "" ]] ;then - export GIT_COMMIT="$GIT_FFMPEG_COMMIT" - export GIT_REPO_VERSION="$GIT_FFMPEG_COMMIT" -else - export GIT_COMMIT=n7.1.1 #origin/release/5.1 - export GIT_REPO_VERSION=7.1.1 -fi +export GIT_COMMIT=n7.1.1 #origin/release/5.1 +export GIT_REPO_VERSION=7.1.1 # pre compiled diff --git a/configs/libs/fftutorial.sh b/configs/libs/fftutorial.sh index 13c63340b..5b14a96ff 100644 --- a/configs/libs/fftutorial.sh +++ b/configs/libs/fftutorial.sh @@ -31,13 +31,8 @@ else export GIT_UPSTREAM=https://github.com/FFmpeg/FFmpeg.git fi -if [[ "$GIT_FFMPEG_COMMIT" != "" ]] ;then - export GIT_COMMIT="$GIT_FFMPEG_COMMIT" - export GIT_REPO_VERSION="$GIT_FFMPEG_COMMIT" -else - export GIT_COMMIT=n6.1.1 #origin/release/5.1 - export GIT_REPO_VERSION=6.1.1 -fi +export GIT_COMMIT=n6.1.1 #origin/release/5.1 +export GIT_REPO_VERSION=6.1.1 # pre compiled export PRE_COMPILE_TAG_TVOS=fftutorial-6.1.1-250413171857 From 39a0c6e082f1c8710130cd55e3bee5f4fc97fbbe Mon Sep 17 00:00:00 2001 From: runner Date: Wed, 25 Jun 2025 05:59:18 +0000 Subject: [PATCH 107/359] upgrade smb2 to smb2-6.2-250625135623 for macos by cd --- configs/libs/smb2.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/libs/smb2.sh b/configs/libs/smb2.sh index aa54956ca..5e64b017c 100644 --- a/configs/libs/smb2.sh +++ b/configs/libs/smb2.sh @@ -41,6 +41,6 @@ fi # pre compiled export PRE_COMPILE_TAG_TVOS=smb2-6.2-250226212919 -export PRE_COMPILE_TAG_MACOS=smb2-6.2-250226210647 +export PRE_COMPILE_TAG_MACOS=smb2-6.2-250625135623 export PRE_COMPILE_TAG_IOS=smb2-6.2-250226180157 export PRE_COMPILE_TAG_ANDROID=smb2-6.2-250310113032 From 9f4e8b062ec8a2c7a258130f35756508cb9bab61 Mon Sep 17 00:00:00 2001 From: Anka Date: Wed, 25 Jun 2025 06:20:53 +0000 Subject: [PATCH 108/359] upgrade smb2 to smb2-6.2-250625141918 for macos by cd --- configs/libs/smb2.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/libs/smb2.sh b/configs/libs/smb2.sh index 5e64b017c..36c2ff7c4 100644 --- a/configs/libs/smb2.sh +++ b/configs/libs/smb2.sh @@ -41,6 +41,6 @@ fi # pre compiled export PRE_COMPILE_TAG_TVOS=smb2-6.2-250226212919 -export PRE_COMPILE_TAG_MACOS=smb2-6.2-250625135623 +export PRE_COMPILE_TAG_MACOS=smb2-6.2-250625141918 export PRE_COMPILE_TAG_IOS=smb2-6.2-250226180157 export PRE_COMPILE_TAG_ANDROID=smb2-6.2-250310113032 From 4bfb74e931ac951442733cf779b381acfbff322d Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Mon, 21 Jul 2025 11:16:34 +0800 Subject: [PATCH 109/359] add zh_CN readme --- README.md | 2 +- README_zh-CN.md | 162 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 163 insertions(+), 1 deletion(-) create mode 100644 README_zh-CN.md diff --git a/README.md b/README.md index 66a2ae277..b09eb2aae 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -## MRFFToolChain Build Shell +## MRFFToolChain Build Shell [[中文版](./README_zh-CN.md)] ![](https://img.shields.io/github/downloads/debugly/MRFFToolChainBuildShell/total) diff --git a/README_zh-CN.md b/README_zh-CN.md new file mode 100644 index 000000000..c7e97c765 --- /dev/null +++ b/README_zh-CN.md @@ -0,0 +1,162 @@ +## MRFFToolChain 构建脚本 + +![](https://img.shields.io/github/downloads/debugly/MRFFToolChainBuildShell/total) + +**MRFFToolChain 是什么?** + +MRFFToolChain 的构建产物是为 [fsplayer](https://github.com/debugly/fsplayer) 、 [ijkplayer](https://github.com/debugly/ijkplayer) 、[FFmpegTutorial](https://github.com/debugly/FFmpegTutorial) 服务的. + +目前包含了这些库:`ass、bluray、dav1d、dvdread、dvdnav、ffmpeg、freetype、fribidi、harfbuzz、openssl、opus、unibreak、uavs3d、smb2、yuv、soundtouch、xml2`. + +## 支持的平台 + +| 平台 | 架构 | 最低部署目标版本 | +| -------- | -------------------------------------- | ------------------------- | +| iOS | arm64、arm64_simulator、x86_64_simulator | 11.0 | +| tvOS | arm64、arm64_simulator、x86_64_simulator | 12.0 | +| macOS | arm64、x86_64 | 10.11 | +| Android | arm64、armv7a、x86_64、x86 | 21 | + +## 最新动态 + +- FFmpeg **7.1.1** 已投入使用 +- 将所有库升级至最新版本,不少库提升了性能 +- 使用 macOS 14,Xcode_15.4构建,移除了 bitcode 支持 + +[https://developer.apple.com/documentation/xcode-release-notes/xcode-14-release-notes#Deprecations](https://developer.apple.com/documentation/xcode-release-notes/xcode-14-release-notes#Deprecations) + +## 依赖关系 + +编译了适用于安卓和 iOS 平台的 FFmpeg4,FFmpeg5,FFmpeg6,FFmpeg7。 + +- Fontconfig:xml2、freetype +- Bluray:xml2 +- Harfbuzz:freetype +- dvdnav:dvdread +- 适用于苹果的 Ass:harfbuzz、fribidi、unibreak +- 适用于安卓的 Ass:harfbuzz、fribidi、unibreak、fontconfig +- 适用于苹果的 FFmpeg4:openssl3、opus、bluray +- 适用于苹果的 FFmpeg5:openssl3、opus、bluray、dav1d、dvdread、uavs3d +- 适用于苹果的 FFmpeg6:openssl3、opus、bluray、dav1d、dvdread、uavs3d、smb2 +- 适用于苹果的 FFmpeg7:openssl3、opus、bluray、dav1d、dvdnav、uavs3d、smb2 +- 适用于安卓的 FFmpeg4:openssl3、opus、bluray、soundtouch +- 适用于安卓的 FFmpeg5:openssl3、opus、bluray、dav1d、dvdread、uavs3d、soundtouch +- 适用于安卓的 FFmpeg6:openssl3、opus、bluray、dav1d、dvdread、uavs3d、smb2、soundtouch +- 适用于安卓的 FFmpeg7:openssl3、opus、bluray、dav1d、dvdnav、uavs3d、smb2、soundtouch + +提示: + +``` +1、ffmpeg 不依赖 ass +2、fsplayer 依赖 ffmpeg 和 ass +3、ijkplayer 依赖 ijkffmpeg +4、FFmpegTutorial 依赖 fftutorial +5、安装预编译库时,会包含其所有依赖项 +``` + +## 下载 / 安装预编译库 + +直接从 GitHub 下载预编译库可以为您节省大量时间。 + +这些预编译库已经应用了 patches 目录下的补丁。 + +```bash +# 先查看帮助 +./main.sh install --help +# 使用示例 +./main.sh install -p macos -l ffmpeg +./main.sh install -p ios -l 'ass ffmpeg' +./main.sh install -p android -l openssl3 +``` + +## 自行编译 + +### 初始化目标库仓库 + +除非您修改了源代码,否则不要浪费时间编译这些库! +何不直接下载我通过 GitHub 动作准备好的预编译库呢? +脚本参数灵活,可根据需要组合使用。以下是一些常见示例: + +``` +# 先查看帮助 +./main.sh init --help +# 为 iOS 平台准备 libass 源代码 +./main.sh init -p ios -l ass +# 为 iOS 的 x86 架构准备 ffmpeg7 源代码 +./main.sh init -p ios -l ffmpeg7 -a x86_64_simulator +# 为 Android 平台准备特定库的源代码 +./main.sh init -p android -l "openssl ffmpeg" +``` + +### 编译 + +当源代码仓库初始化完成后,就可以开始编译了。 + +``` +# 先查看帮助 +./main.sh compile --help +# 如帮助所示: +# -p 指定平台 +# -c 指定操作(例如 build 用于编译,rebuild 用于重新编译) +# -l 指定要编译的库 +# -a 指定 CPU 架构 +``` + +以下代码演示如何为 iOS 平台编译 FFmpeg 7: + +``` +# 安装 FFmpeg7 的依赖有两种选择 +# 推荐选择安装预编译方式(因为预编译的 FFmpeg7 已经包含所有依赖项) +./main.sh install -p ios -l ffmpeg7 +# 另外一个选择,自己选择性地安装 FFmpeg7 的依赖库 +./main.sh install -p ios -l "openssl3 opus bluray dav1d dvdnav uavs3d smb2" +# 编译 iOS 平台 arm64 架构的 FFmpeg7,并且跳过生成 xcframework +./main.sh compile -p ios -a arm64 -l ffmepg7 --skip-fmwk +``` + +这些参数的顺序无关紧要,可以按任意顺序排列。 + +### 支持镜像 + +如果从 GitHub 克隆仓库速度较慢,或者需要使用内部私有仓库,可以在运行编译脚本之前声明相应的环境变量! + +| 库名称 | 当前版本 | 仓库 URL | 镜像仓库 URL | +| --------------- |----------- | ----------- | ------------ | +| ffmpeg7 | 7.1.1 | https://github.com/FFmpeg/FFmpeg.git | export GIT_FFMPEG_UPSTREAM=git@xx:yy/FFmpeg.git | +| ffmpeg6 | 6.1.1 | https://github.com/FFmpeg/FFmpeg.git | export GIT_FFMPEG_UPSTREAM=git@xx:yy/FFmpeg.git | +| ffmpeg5 | 5.1.6 | https://github.com/FFmpeg/FFmpeg.git | export GIT_FFMPEG_UPSTREAM=git@xx:yy/FFmpeg.git | +| ffmpeg4 | 4.0.5 | https://github.com/FFmpeg/FFmpeg.git | export GIT_FFMPEG_UPSTREAM=git@xx:yy/FFmpeg.git | +| ass | 0.17.3 | https://github.com/libass/libass.git | export GIT_ASS_UPSTREAM=git@xx:yy/libass.git | +| bluray | 1.3.4 | https://code.videolan.org/videolan/libbluray.git | export GIT_BLURAY_UPSTREAM=git@xx:yy/libbluray.git | +| dav1d | 1.5.1 | https://code.videolan.org/videolan/dav1d.git | export GIT_DAV1D_UPSTREAM=git@xx:yy/dav1d.git | +| dvdread | 6.1.3 | https://code.videolan.org/videolan/libdvdread.git | export GIT_DVDREAD_UPSTREAM=git@xx:yy/libdvdread.git | +| dvdnav | master-9831fe01 | https://code.videolan.org/videolan/libdvdnav.git | export GIT_DVDNAV_UPSTREAM=git@xx:yy/libdvdnav.git | +| fontconfig | 2.16.0 | https://gitlab.freedesktop.org/fontconfig/fontconfig.git | export GIT_FONTCONFIG_UPSTREAM=git@xx:yy/fontconfig.git | +| freetype | 2.13.3 | https://gitlab.freedesktop.org/freetype/freetype.git | export GIT_FREETYPE_UPSTREAM=git@xx:yy/freetype.git | +| fribidi | 1.0.16 | https://github.com/fribidi/fribidi.git | export GIT_FRIBIDI_UPSTREAM=git@xx:yy/fribidi.git | +| harfbuzz | 10.2.0 | https://github.com/harfbuzz/harfbuzz.git | export GIT_HARFBUZZ_UPSTREAM=git@xx:yy/harfbuzz.git | +| openssl | 1.1.1w | https://github.com/openssl/openssl.git | export GIT_OPENSSL_UPSTREAM=git@xx:yy/openssl.git | +| openssl3 | 3.5.0 | https://github.com/openssl/openssl.git | export GIT_OPENSSL_UPSTREAM=git@xx:yy/openssl.git | +| opus | 1.5.2 | https://gitlab.xiph.org/xiph/opus.git | export GIT_OPUS_UPSTREAM=git@xx:yy/opus.git | +| smb2 | 6.2 | https://github.com/sahlberg/libsmb2.git | export GIT_SMB2_UPSTREAM=git@xx:yy/libsmb2.git | +| soundtouch | 2.3.3 | https://codeberg.org/soundtouch/soundtouch.git | export GIT_SOUNDTOUCH_UPSTREAM=git@xx:yy/soundtouch.git | +| unibreak | 6.1 | https://github.com/adah1972/libunibreak.git | export GIT_UNIBREAK_UPSTREAM=git@xx:yy/libunibreak.git | +| uavs3d | 1.2.1 | https://github.com/uavs3/uavs3d.git | export GIT_UAVS3D_UPSTREAM=git@xx:yy/UAVS3D.git | +| xml2 | 2.13.6 | https://github.com/GNOME/libxml2.git | export GIT_FONTCONFIG_UPSTREAM=git@xx:yy/fontconfig.git | +| yuv | stable-eb6e7bb | https://github.com/debugly/libyuv.git | export GIT_YUV_UPSTREAM=git@xx:yy/yuv.git | + +## 提示 + +- 要下载预编译的 xcframework 库,使用 install 命令时添加 --fmwk 参数 +- 初始化时要跳过拉取远程仓库,使用 init 命令时添加 --skip-pull-base 参数 +- 初始化时要跳过应用 FFmpeg 补丁,使用 init 命令时添加 --skip-patches 参数 +- 目前 FFmpeg 使用 module-full.sh 配置,功能全但同时导致包体积略大 +- 您可以将所有预编译的 GitHub 库下载到自己的服务器,并在运行 install 命令前通过 MR\_DOWNLOAD\_BASEURL 指定您的服务器地址 + +## 捐赠 + +编译第三方库非常耗时,我将 debugly/fsplayer 所需的所有第三方库预编译为静态库供公众使用,希望为开源社区贡献微薄之力。 + +如果屏幕前的你也想为开源社区贡献一份力量,不妨请我喝杯咖啡提提神儿。 + +![donate.jpg](https://i.postimg.cc/xdVqnBLp/IMG-7481.jpg) From 9bb1f4b6d364309f70e750d7aa93e3615817bfbb Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Thu, 24 Jul 2025 14:21:13 +0800 Subject: [PATCH 110/359] readme add ijkffmpeg version --- README.md | 2 ++ README_zh-CN.md | 2 ++ 2 files changed, 4 insertions(+) diff --git a/README.md b/README.md index b09eb2aae..60298e031 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,7 @@ At present MRFFToolChain contained `ass、bluray、dav1d、dvdread、dvdnav、ff - dvdnav: dvdread - Ass for Appple: harfbuzz,fribidi,unibreak - Ass for Android: harfbuzz,fribidi,unibreak,fontconfig +- IJKFFmpeg: openssl - FFmpeg4 for Appple: openssl3,opus,bluray - FFmpeg5 for Appple: openssl3,opus,bluray,dav1d,dvdread,uavs3d - FFmpeg6 for Appple: openssl3,opus,bluray,dav1d,dvdread,uavs3d,smb2 @@ -124,6 +125,7 @@ If cloning repositories from GitHub is slow, or if you need to use an internal p | ffmpeg6 | 6.1.1 | https://github.com/FFmpeg/FFmpeg.git | export GIT_FFMPEG_UPSTREAM=git@xx:yy/FFmpeg.git | | ffmpeg5 | 5.1.6 | https://github.com/FFmpeg/FFmpeg.git | export GIT_FFMPEG_UPSTREAM=git@xx:yy/FFmpeg.git | | ffmpeg4 | 4.0.5 | https://github.com/FFmpeg/FFmpeg.git | export GIT_FFMPEG_UPSTREAM=git@xx:yy/FFmpeg.git | +| ijkffmpeg | ff4.0--ijk0.8.8--20210426--001 | https://github.com/bilibili/FFmpeg.git | export GIT_IJKFFMPEG_UPSTREAM=git@xx:yy/FFmpeg.git | | ass | 0.17.3 | https://github.com/libass/libass.git | export GIT_ASS_UPSTREAM=git@xx:yy/libass.git | | bluray | 1.3.4 | https://code.videolan.org/videolan/libbluray.git | export GIT_BLURAY_UPSTREAM=git@xx:yy/libbluray.git | | dav1d | 1.5.1 | https://code.videolan.org/videolan/dav1d.git | export GIT_DAV1D_UPSTREAM=git@xx:yy/dav1d.git | diff --git a/README_zh-CN.md b/README_zh-CN.md index c7e97c765..d063698c6 100644 --- a/README_zh-CN.md +++ b/README_zh-CN.md @@ -33,6 +33,7 @@ MRFFToolChain 的构建产物是为 [fsplayer](https://github.com/debugly/fsplay - Bluray:xml2 - Harfbuzz:freetype - dvdnav:dvdread +- 适用于 ijkplayer 的 FFmpeg: openssl - 适用于苹果的 Ass:harfbuzz、fribidi、unibreak - 适用于安卓的 Ass:harfbuzz、fribidi、unibreak、fontconfig - 适用于苹果的 FFmpeg4:openssl3、opus、bluray @@ -126,6 +127,7 @@ MRFFToolChain 的构建产物是为 [fsplayer](https://github.com/debugly/fsplay | ffmpeg6 | 6.1.1 | https://github.com/FFmpeg/FFmpeg.git | export GIT_FFMPEG_UPSTREAM=git@xx:yy/FFmpeg.git | | ffmpeg5 | 5.1.6 | https://github.com/FFmpeg/FFmpeg.git | export GIT_FFMPEG_UPSTREAM=git@xx:yy/FFmpeg.git | | ffmpeg4 | 4.0.5 | https://github.com/FFmpeg/FFmpeg.git | export GIT_FFMPEG_UPSTREAM=git@xx:yy/FFmpeg.git | +| ijkffmpeg | ff4.0--ijk0.8.8--20210426--001 | https://github.com/bilibili/FFmpeg.git | export GIT_IJKFFMPEG_UPSTREAM=git@xx:yy/FFmpeg.git | | ass | 0.17.3 | https://github.com/libass/libass.git | export GIT_ASS_UPSTREAM=git@xx:yy/libass.git | | bluray | 1.3.4 | https://code.videolan.org/videolan/libbluray.git | export GIT_BLURAY_UPSTREAM=git@xx:yy/libbluray.git | | dav1d | 1.5.1 | https://code.videolan.org/videolan/dav1d.git | export GIT_DAV1D_UPSTREAM=git@xx:yy/dav1d.git | From e8d69e681cd08127980e63f6d895cffbf3d7a1d3 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Mon, 8 Sep 2025 11:28:23 +0800 Subject: [PATCH 111/359] cmake compatible support multiple targets --- configs/libs/opus.sh | 2 +- configs/libs/smb2.sh | 2 +- configs/libs/soundtouch.sh | 2 +- configs/libs/uavs3d.sh | 2 +- configs/libs/yuv.sh | 2 +- do-compile/android/cmake-compatible.sh | 17 +++++++++++++++-- do-compile/apple/cmake-compatible.sh | 19 +++++++++++++++++-- 7 files changed, 37 insertions(+), 9 deletions(-) diff --git a/configs/libs/opus.sh b/configs/libs/opus.sh index 5f6d0a453..deb032bf8 100644 --- a/configs/libs/opus.sh +++ b/configs/libs/opus.sh @@ -25,7 +25,7 @@ export LIB_NAME='opus' export LIPO_LIBS="libopus" export LIB_DEPENDS_BIN="cmake" -export CMAKE_TARGET_NAME=opus +export CMAKE_TARGETS_NAME=opus export GIT_LOCAL_REPO=extra/opus export GIT_COMMIT=v1.5.2 export REPO_DIR=opus diff --git a/configs/libs/smb2.sh b/configs/libs/smb2.sh index 36c2ff7c4..0f45b52ff 100644 --- a/configs/libs/smb2.sh +++ b/configs/libs/smb2.sh @@ -25,7 +25,7 @@ export LIB_NAME='smb2' export LIPO_LIBS="libsmb2" export LIB_DEPENDS_BIN="cmake" -export CMAKE_TARGET_NAME=smb2 +export CMAKE_TARGETS_NAME=smb2 export GIT_LOCAL_REPO=extra/smb2 export GIT_COMMIT=libsmb2-6.2 export REPO_DIR=smb2 diff --git a/configs/libs/soundtouch.sh b/configs/libs/soundtouch.sh index 979090df1..d3c91ed49 100644 --- a/configs/libs/soundtouch.sh +++ b/configs/libs/soundtouch.sh @@ -25,7 +25,7 @@ export LIB_NAME='soundtouch' export LIPO_LIBS="libsoundtouch" export LIB_DEPENDS_BIN="cmake" -export CMAKE_TARGET_NAME=SoundTouch +export CMAKE_TARGETS_NAME=SoundTouch export GIT_LOCAL_REPO=extra/soundtouch export REPO_DIR=soundtouch export GIT_COMMIT=2.3.3 diff --git a/configs/libs/uavs3d.sh b/configs/libs/uavs3d.sh index d707b474c..6747330ca 100644 --- a/configs/libs/uavs3d.sh +++ b/configs/libs/uavs3d.sh @@ -23,7 +23,7 @@ export LIB_NAME='uavs3d' export LIPO_LIBS="libuavs3d" export LIB_DEPENDS_BIN="cmake" -export CMAKE_TARGET_NAME=uavs3d +export CMAKE_TARGETS_NAME=uavs3d export GIT_LOCAL_REPO=extra/uavs3d export GIT_COMMIT=1fd0491 export REPO_DIR=uavs3d diff --git a/configs/libs/yuv.sh b/configs/libs/yuv.sh index a12476ab7..560bf0abb 100644 --- a/configs/libs/yuv.sh +++ b/configs/libs/yuv.sh @@ -20,7 +20,7 @@ export LIB_NAME='yuv' export LIPO_LIBS="libyuv" export LIB_DEPENDS_BIN="cmake" -export CMAKE_TARGET_NAME=yuv +export CMAKE_TARGETS_NAME=yuv export GIT_LOCAL_REPO=extra/yuv export GIT_COMMIT=eb6e7bb export REPO_DIR=yuv diff --git a/do-compile/android/cmake-compatible.sh b/do-compile/android/cmake-compatible.sh index bc464d6c5..51d5099ed 100755 --- a/do-compile/android/cmake-compatible.sh +++ b/do-compile/android/cmake-compatible.sh @@ -58,12 +58,25 @@ echo "----------------------" echo "[*] compile $LIB_NAME" echo "----------------------" +# 初始化构建命令 +camke_cmd="cmake --build ." + +# 以逗号分割目标名称,并为每个目标添加 --target 参数 +IFS=',' read -ra targets <<< "$CMAKE_TARGETS_NAME" +for target in "${targets[@]}"; do + camke_cmd="$camke_cmd --target $target" +done + + if [[ "$MR_DEBUG" == "debug" ]];then - cmake --build . --target $CMAKE_TARGET_NAME --config Debug -- CODE_SIGNING_ALLOWED=NO + camke_cmd="$camke_cmd --config Debug -- CODE_SIGNING_ALLOWED=NO" else - cmake --build . --target $CMAKE_TARGET_NAME --config Release -- CODE_SIGNING_ALLOWED=NO + camke_cmd="$camke_cmd --config Release -- CODE_SIGNING_ALLOWED=NO" fi +# 执行构建命令 +eval "$camke_cmd" + if [[ -n $CMAKE_COMPONENT ]];then cmake --install . --strip --component "$CMAKE_COMPONENT" else diff --git a/do-compile/apple/cmake-compatible.sh b/do-compile/apple/cmake-compatible.sh index 0f6566f5b..012dff9fc 100755 --- a/do-compile/apple/cmake-compatible.sh +++ b/do-compile/apple/cmake-compatible.sh @@ -72,12 +72,27 @@ echo "----------------------" echo "[*] compile $LIB_NAME" echo "----------------------" + +# 初始化构建命令 +camke_cmd="cmake --build ." + +# 以逗号分割目标名称,并为每个目标添加 --target 参数 +IFS=',' read -ra targets <<< "$CMAKE_TARGETS_NAME" +for target in "${targets[@]}"; do + camke_cmd="$camke_cmd --target $target" +done + + if [[ "$MR_DEBUG" == "debug" ]];then - cmake --build . --target $CMAKE_TARGET_NAME --config Debug -- CODE_SIGNING_ALLOWED=NO + camke_cmd="$camke_cmd --config Debug -- CODE_SIGNING_ALLOWED=NO" else - cmake --build . --target $CMAKE_TARGET_NAME --config Release -- CODE_SIGNING_ALLOWED=NO + camke_cmd="$camke_cmd --config Release -- CODE_SIGNING_ALLOWED=NO" fi + +# 执行构建命令 +eval "$camke_cmd" + if [[ -n $CMAKE_COMPONENT ]];then cmake --install . --component "$CMAKE_COMPONENT" else From 99602f869c1ae018ed39778fd48a83b815dd00f6 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Mon, 8 Sep 2025 11:28:44 +0800 Subject: [PATCH 112/359] fix wrong word --- do-compile/android/cmake-compatible.sh | 2 +- do-compile/apple/cmake-compatible.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/do-compile/android/cmake-compatible.sh b/do-compile/android/cmake-compatible.sh index 51d5099ed..ba07ee728 100755 --- a/do-compile/android/cmake-compatible.sh +++ b/do-compile/android/cmake-compatible.sh @@ -34,7 +34,7 @@ echo "[*] cmake options: $CMAKE_OTHER_OPTS" echo "[*] cmake component: $CMAKE_COMPONENT" echo "----------------------" -build="${MR_BUILD_SOURCE}/camke_wksp" +build="${MR_BUILD_SOURCE}/cmake_wksp" rm -rf "$build" mkdir -p "$build" diff --git a/do-compile/apple/cmake-compatible.sh b/do-compile/apple/cmake-compatible.sh index 012dff9fc..f8d6acf44 100755 --- a/do-compile/apple/cmake-compatible.sh +++ b/do-compile/apple/cmake-compatible.sh @@ -30,7 +30,7 @@ echo "[*] cmake options: $CMAKE_OTHER_OPTS" echo "[*] cmake component: $CMAKE_COMPONENT" echo "----------------------" -build="${MR_BUILD_SOURCE}/camke_wksp" +build="${MR_BUILD_SOURCE}/cmake_wksp" rm -rf "$build" mkdir -p "$build" From fb614571e495a13e6b716dca54f5f835fc055c5f Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Mon, 8 Sep 2025 11:30:36 +0800 Subject: [PATCH 113/359] add libwebp for apple --- README.md | 9 +-------- README_zh-CN.md | 11 ++--------- configs/libs/webp.sh | 40 ++++++++++++++++++++++++++++++++++++++++ do-compile/apple/webp.sh | 27 +++++++++++++++++++++++++++ 4 files changed, 70 insertions(+), 17 deletions(-) create mode 100644 configs/libs/webp.sh create mode 100755 do-compile/apple/webp.sh diff --git a/README.md b/README.md index 60298e031..7295832c7 100644 --- a/README.md +++ b/README.md @@ -144,6 +144,7 @@ If cloning repositories from GitHub is slow, or if you need to use an internal p | uavs3d | 1.2.1 | https://github.com/uavs3/uavs3d.git | export GIT_UAVS3D_UPSTREAM=git@xx:yy/UAVS3D.git | | xml2 | 2.13.6 | https://github.com/GNOME/libxml2.git | export GIT_FONTCONFIG_UPSTREAM=git@xx:yy/fontconfig.git | | yuv | stable-eb6e7bb | https://github.com/debugly/libyuv.git | export GIT_YUV_UPSTREAM=git@xx:yy/yuv.git | +| webp | v1.6.0 | https://github.com/debugly/libwebp.git | export GIT_WEBP_UPSTREAM=git@xx:yy/webp.git | ## Tips @@ -152,11 +153,3 @@ If cloning repositories from GitHub is slow, or if you need to use an internal p - To skip applying FFmpeg patches during initialization, add the --skip-patches parameter when using the init command. - Currently, FFmpeg uses the module-full.sh configuration, resulting in slightly larger package sizes. - You can download all pre-compiled GitHub libraries to your own server and specify your server address using MR_DOWNLOAD_BASEURL before running the install command. - -## Donate - -Compiling third-party libraries is time-consuming. I aim to contribute to the open-source community by pre-compiling all third-party libraries required by debugly/ijkplayer into static libraries and xcframeworks for public use. - -If you'd like to contribute to the open-source community, consider buying me a coffee to keep me energized. - -![donate.jpg](https://i.postimg.cc/xdVqnBLp/IMG-7481.jpg) diff --git a/README_zh-CN.md b/README_zh-CN.md index d063698c6..9aed598d2 100644 --- a/README_zh-CN.md +++ b/README_zh-CN.md @@ -146,6 +146,7 @@ MRFFToolChain 的构建产物是为 [fsplayer](https://github.com/debugly/fsplay | uavs3d | 1.2.1 | https://github.com/uavs3/uavs3d.git | export GIT_UAVS3D_UPSTREAM=git@xx:yy/UAVS3D.git | | xml2 | 2.13.6 | https://github.com/GNOME/libxml2.git | export GIT_FONTCONFIG_UPSTREAM=git@xx:yy/fontconfig.git | | yuv | stable-eb6e7bb | https://github.com/debugly/libyuv.git | export GIT_YUV_UPSTREAM=git@xx:yy/yuv.git | +| webp | v1.6.0 | https://github.com/debugly/libwebp.git | export GIT_WEBP_UPSTREAM=git@xx:yy/webp.git | ## 提示 @@ -153,12 +154,4 @@ MRFFToolChain 的构建产物是为 [fsplayer](https://github.com/debugly/fsplay - 初始化时要跳过拉取远程仓库,使用 init 命令时添加 --skip-pull-base 参数 - 初始化时要跳过应用 FFmpeg 补丁,使用 init 命令时添加 --skip-patches 参数 - 目前 FFmpeg 使用 module-full.sh 配置,功能全但同时导致包体积略大 -- 您可以将所有预编译的 GitHub 库下载到自己的服务器,并在运行 install 命令前通过 MR\_DOWNLOAD\_BASEURL 指定您的服务器地址 - -## 捐赠 - -编译第三方库非常耗时,我将 debugly/fsplayer 所需的所有第三方库预编译为静态库供公众使用,希望为开源社区贡献微薄之力。 - -如果屏幕前的你也想为开源社区贡献一份力量,不妨请我喝杯咖啡提提神儿。 - -![donate.jpg](https://i.postimg.cc/xdVqnBLp/IMG-7481.jpg) +- 可以将所有预编译的 GitHub 库下载到自己的服务器,并在运行 install 命令前通过 MR\_DOWNLOAD\_BASEURL 指定你的服务器地址 diff --git a/configs/libs/webp.sh b/configs/libs/webp.sh new file mode 100644 index 000000000..177f70c4b --- /dev/null +++ b/configs/libs/webp.sh @@ -0,0 +1,40 @@ +#! /usr/bin/env bash +# +# Copyright (C) 2021 Matt Reach + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# +# + +export LIB_NAME='webp' +export LIPO_LIBS="libwebp" +export LIB_DEPENDS_BIN="cmake" +export CMAKE_TARGETS_NAME=webpdecoder,webpdemux +export GIT_LOCAL_REPO=extra/webp +export GIT_COMMIT=v1.6.0 +export REPO_DIR=webp +export GIT_REPO_VERSION=v1.6.0 + +# you can export GIT_WEBP_UPSTREAM=git@xx:yy/webp.git use your mirror +if [[ "$GIT_WEBP_UPSTREAM" != "" ]] ;then + export GIT_UPSTREAM="$GIT_WEBP_UPSTREAM" +else + export GIT_UPSTREAM=https://github.com/debugly/libwebp.git +fi + +# pre compiled +export PRE_COMPILE_TAG_TVOS= +export PRE_COMPILE_TAG_MACOS= +export PRE_COMPILE_TAG_IOS= +export PRE_COMPILE_TAG_ANDROID= \ No newline at end of file diff --git a/do-compile/apple/webp.sh b/do-compile/apple/webp.sh new file mode 100755 index 000000000..829e10359 --- /dev/null +++ b/do-compile/apple/webp.sh @@ -0,0 +1,27 @@ +#! /usr/bin/env bash +# +# Copyright (C) 2021 Matt Reach + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# append "-DCMAKE_MACOSX_BUNDLE=NO" fix compile error: + +# CMake Error at CMakeLists.txt:537 (install): +# install TARGETS given no BUNDLE DESTINATION for MACOSX_BUNDLE executable +# target "dwebp". + +# call common cmake build shell +./cmake-compatible.sh "-DBUILD_SHARED_LIBS=OFF -DWEBP_LINK_STATIC=ON -DCMAKE_MACOSX_BUNDLE=NO -DWEBP_ENABLE_SIMD=ON -DWEBP_BUILD_ANIM_UTILS=OFF -DWEBP_BUILD_CWEBP=OFF -DWEBP_BUILD_DWEBP=OFF -DWEBP_BUILD_GIF2WEBP=OFF -DWEBP_BUILD_IMG2WEBP=OFF -DWEBP_BUILD_VWEBP=OFF -DWEBP_BUILD_WEBPINFO=OFF -DWEBP_BUILD_LIBWEBPMUX=OFF -DWEBP_BUILD_WEBPMUX=OFF -DWEBP_BUILD_EXTRAS=OFF -DWEBP_NEAR_LOSSLESS=OFF" + +# clean cmake +rm -rf ${MR_BUILD_PREFIX}/share \ No newline at end of file From a60abe3801ff87f1e29e64eca4de2f72bc5d9e3e Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Mon, 8 Sep 2025 11:33:14 +0800 Subject: [PATCH 114/359] github action add webp --- .github/workflows/all.yml | 3 +++ .github/workflows/apple-android-common.yml | 1 + 2 files changed, 4 insertions(+) diff --git a/.github/workflows/all.yml b/.github/workflows/all.yml index 17cda3d53..15ea73015 100644 --- a/.github/workflows/all.yml +++ b/.github/workflows/all.yml @@ -108,6 +108,9 @@ jobs: echo '------compile smb2------------------------------------' rm -rf build || git reset --hard || git pull origin .github/workflows/onestep.sh smb2 ${{ inputs.platform }} ${{ inputs.dryrun }} + echo '------compile webp------------------------------------' + rm -rf build || git reset --hard || git pull origin + .github/workflows/onestep.sh webp ${{ inputs.platform }} ${{ inputs.dryrun }} echo '------compile ffmpeg7------------------------------------' rm -rf build || git reset --hard || git pull origin .github/workflows/install-dependencies.sh ffmpeg7 ${{ inputs.platform }} diff --git a/.github/workflows/apple-android-common.yml b/.github/workflows/apple-android-common.yml index 363607af9..845cbe3a9 100644 --- a/.github/workflows/apple-android-common.yml +++ b/.github/workflows/apple-android-common.yml @@ -64,6 +64,7 @@ on: - unibreak - yuv - xml2 + - webp pull_request: branches: [master] From 4c2072fdc361539d1c677eb5ee0aa9544fc76651 Mon Sep 17 00:00:00 2001 From: Anka Date: Mon, 8 Sep 2025 03:37:27 +0000 Subject: [PATCH 115/359] upgrade webp to webp-v1.6.0-250908113432 for macos by cd --- configs/libs/webp.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/libs/webp.sh b/configs/libs/webp.sh index 177f70c4b..dda4c8dd9 100644 --- a/configs/libs/webp.sh +++ b/configs/libs/webp.sh @@ -35,6 +35,6 @@ fi # pre compiled export PRE_COMPILE_TAG_TVOS= -export PRE_COMPILE_TAG_MACOS= +export PRE_COMPILE_TAG_MACOS=webp-v1.6.0-250908113432 export PRE_COMPILE_TAG_IOS= export PRE_COMPILE_TAG_ANDROID= \ No newline at end of file From a4f435e169c351f9999dc1483b63f78dead59e51 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Mon, 8 Sep 2025 14:04:19 +0800 Subject: [PATCH 116/359] ffmpeg7 support webp animation --- .github/workflows/install-dependencies.sh | 2 + configs/ffconfig/auto-detect-third-libs.sh | 10 + ...add-webp-demuxer-and-libwebp-decoder.patch | 799 ++++++++++++++++++ 3 files changed, 811 insertions(+) create mode 100644 patches/ffmpeg-n7.1.1/0032-add-webp-demuxer-and-libwebp-decoder.patch diff --git a/.github/workflows/install-dependencies.sh b/.github/workflows/install-dependencies.sh index 1ee7f853a..f8b36acfb 100755 --- a/.github/workflows/install-dependencies.sh +++ b/.github/workflows/install-dependencies.sh @@ -51,6 +51,8 @@ case $LIB_NAME in if [[ $PLAT == android ]];then ./main.sh install -l 'soundtouch' -p android + else + ./main.sh install -l 'webp' -p $PLAT fi ;; ffmpeg6) diff --git a/configs/ffconfig/auto-detect-third-libs.sh b/configs/ffconfig/auto-detect-third-libs.sh index 6fbd337e2..073d8f8bb 100644 --- a/configs/ffconfig/auto-detect-third-libs.sh +++ b/configs/ffconfig/auto-detect-third-libs.sh @@ -242,6 +242,16 @@ fi echo "----------------------" +pkg-config --libs libwebp --silence-errors >/dev/null && enable_webp=1 +if [[ $enable_webp ]];then + echo "[✅] --enable-libwebp --enable-decoder=webp : $(pkg-config --modversion libwebp)" + THIRD_CFG_FLAGS="$THIRD_CFG_FLAGS --enable-libwebp --enable-demuxer=webp --enable-decoder=libwebp" +else + echo "[❌] --disable-libwebp --disable-decoder=libwebp" +fi + +echo "----------------------" + # export PKG_CONFIG_LIBDIR=$PKG_CONFIG_LIBDIR:/opt/homebrew/Cellar/shaderc/2024.0/lib/pkgconfig:/opt/homebrew/Cellar/little-cms2/2.16/lib/pkgconfig # pkg-config --libs libplacebo --silence-errors >/dev/null && enable_placebo=1 diff --git a/patches/ffmpeg-n7.1.1/0032-add-webp-demuxer-and-libwebp-decoder.patch b/patches/ffmpeg-n7.1.1/0032-add-webp-demuxer-and-libwebp-decoder.patch new file mode 100644 index 000000000..fb15f0b15 --- /dev/null +++ b/patches/ffmpeg-n7.1.1/0032-add-webp-demuxer-and-libwebp-decoder.patch @@ -0,0 +1,799 @@ +From 21d88e28b8834fae08fcd3a337faf1ac209a4a4f Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Mon, 8 Sep 2025 13:59:17 +0800 +Subject: [PATCH] add webp demuxer and libwebp decoder + +--- + configure | 7 +- + libavcodec/Makefile | 1 + + libavcodec/allcodecs.c | 2 +- + libavcodec/codec_desc.c | 11 +- + libavcodec/codec_id.h | 2 +- + libavcodec/libwebpdec.c | 350 +++++++++++++++++++++++++++++++++++++++ + libavformat/Makefile | 1 + + libavformat/allformats.c | 3 + + libavformat/webpdec.c | 290 ++++++++++++++++++++++++++++++++ + 9 files changed, 663 insertions(+), 4 deletions(-) + create mode 100644 libavcodec/libwebpdec.c + create mode 100644 libavformat/webpdec.c + +diff --git a/configure b/configure +index 7daa9ff..fc5e423 100755 +--- a/configure ++++ b/configure +@@ -7044,7 +7044,12 @@ enabled libvpx && { + enabled libvvenc && require_pkg_config libvvenc "libvvenc >= 1.6.1" "vvenc/vvenc.h" vvenc_get_version + 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 libwebp_anim_encoder && check_pkg_config libwebp_anim_encoder "libwebpmux >= 0.4.0" webp/mux.h WebPAnimEncoderOptionsInit ++ check_pkg_config libwebpdemux "libwebpdemux >= 1.0.0" webp/demux.h WebPDemux ++ if enabled libwebpdemux; then ++ enable webp_demuxer ++ enable libwebp_decoder ++ fi } + enabled libx264 && require_pkg_config libx264 x264 "stdint.h x264.h" x264_encoder_encode && + require_cpp_condition libx264 x264.h "X264_BUILD >= 155" && { + [ "$toolchain" != "msvc" ] || +diff --git a/libavcodec/Makefile b/libavcodec/Makefile +index 03e80a2..441d4ee 100644 +--- a/libavcodec/Makefile ++++ b/libavcodec/Makefile +@@ -812,6 +812,7 @@ OBJS-$(CONFIG_WBMP_DECODER) += wbmpdec.o + OBJS-$(CONFIG_WBMP_ENCODER) += wbmpenc.o + OBJS-$(CONFIG_WCMV_DECODER) += wcmv.o + OBJS-$(CONFIG_WEBP_DECODER) += webp.o ++OBJS-$(CONFIG_LIBWEBP_DECODER) += libwebpdec.o + OBJS-$(CONFIG_WEBVTT_DECODER) += webvttdec.o ass.o + OBJS-$(CONFIG_WEBVTT_ENCODER) += webvttenc.o ass_split.o + OBJS-$(CONFIG_WMALOSSLESS_DECODER) += wmalosslessdec.o wma_common.o +diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c +index aa0fc47..7098f1d 100644 +--- a/libavcodec/allcodecs.c ++++ b/libavcodec/allcodecs.c +@@ -900,7 +900,7 @@ extern const FFCodec ff_vnull_decoder; + extern const FFCodec ff_vnull_encoder; + extern const FFCodec ff_anull_decoder; + extern const FFCodec ff_anull_encoder; +- ++extern const FFCodec ff_libwebp_decoder; + // The iterate API is not usable with ossfuzz due to the excessive size of binaries created + #if CONFIG_OSSFUZZ + const FFCodec * codec_list[] = { +diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c +index 38cab26..30af1ac 100644 +--- a/libavcodec/codec_desc.c ++++ b/libavcodec/codec_desc.c +@@ -1959,6 +1959,15 @@ static const AVCodecDescriptor codec_descriptors[] = { + .long_name = NULL_IF_CONFIG_SMALL("LEAD MCMP"), + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, + }, ++ { ++ .id = AV_CODEC_ID_LIBWEBP, ++ .type = AVMEDIA_TYPE_VIDEO, ++ .name = "libwebp", ++ .long_name = NULL_IF_CONFIG_SMALL("libWebP"), ++ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY | ++ AV_CODEC_PROP_LOSSLESS, ++ .mime_types= MT("image/webp"), ++ }, + + /* various PCM "codecs" */ + { +@@ -3734,7 +3743,7 @@ static const AVCodecDescriptor codec_descriptors[] = { + .name = "av3a", + .long_name = NULL_IF_CONFIG_SMALL("Audio Vivid"), + .props = AV_CODEC_PROP_LOSSY, +- }, ++ } + }; + + static int descriptor_compare(const void *key, const void *member) +diff --git a/libavcodec/codec_id.h b/libavcodec/codec_id.h +index 8c724a0..041015e 100644 +--- a/libavcodec/codec_id.h ++++ b/libavcodec/codec_id.h +@@ -323,6 +323,7 @@ enum AVCodecID { + AV_CODEC_ID_VMIX, + AV_CODEC_ID_LEAD, + ++ AV_CODEC_ID_LIBWEBP, + /* various PCM "codecs" */ + AV_CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs + AV_CODEC_ID_PCM_S16LE = 0x10000, +@@ -592,7 +593,6 @@ enum AVCodecID { + AV_CODEC_ID_LCEVC, + AV_CODEC_ID_AVS3DA, + +- + AV_CODEC_ID_PROBE = 0x19000, ///< codec_id is not known (like AV_CODEC_ID_NONE) but lavf should attempt to identify it + + AV_CODEC_ID_MPEG2TS = 0x20000, /**< _FAKE_ codec to indicate a raw MPEG-2 TS +diff --git a/libavcodec/libwebpdec.c b/libavcodec/libwebpdec.c +new file mode 100644 +index 0000000..c2884c0 +--- /dev/null ++++ b/libavcodec/libwebpdec.c +@@ -0,0 +1,350 @@ ++/* ++ * WebP decoder using libwebp for FFmpeg 7.x ++ * Copyright (c) 2024 ++ * ++ * This file is part of FFmpeg. ++ */ ++ ++#include "codec_internal.h" ++#include "decode.h" ++#include "internal.h" ++#include "libavutil/common.h" ++#include "libavutil/imgutils.h" ++#include "libavutil/mem.h" ++#include "libavutil/opt.h" ++#include "libavutil/pixdesc.h" ++#include ++#include ++ ++typedef struct MyImageRef { ++ int width; ++ int height; ++ uint8_t *data; ++} MyImageRef; ++ ++typedef struct MyRect { ++ int x; ++ int y; ++ int w; ++ int h; ++} MyRect; ++ ++typedef struct LibWebPDecoderContext { ++ AVClass *class; ++ MyImageRef *canvas; // The main compositing canvas ++} LibWebPDecoderContext; ++ ++static void release_image(MyImageRef *img) ++{ ++ if (img) { ++ if (img->data) ++ av_free(img->data); ++ free(img); ++ } ++} ++ ++static int alloc_image(MyImageRef **img, int width, int height) ++{ ++ if (!img || width <= 0 || height <= 0) ++ return AVERROR(EINVAL); ++ ++ *img = malloc(sizeof(MyImageRef)); ++ if (!*img) ++ return AVERROR(ENOMEM); ++ ++ (*img)->width = width; ++ (*img)->height = height; ++ (*img)->data = av_malloc(width * height * 4); // RGBA ++ if (!(*img)->data) { ++ free(*img); ++ *img = NULL; ++ return AVERROR(ENOMEM); ++ } ++ ++ memset((*img)->data, 0, width * height * 4); // 初始化为透明 ++ return 0; ++} ++ ++static void clear_rect(MyImageRef *img, MyRect rect) ++{ ++ if (!img || !img->data) ++ return; ++ ++ int img_width = img->width; ++ int img_height = img->height; ++ uint8_t *data = img->data; ++ ++ // 确保矩形在图像范围内 ++ int start_x = FFMAX(0, rect.x); ++ int start_y = FFMAX(0, rect.y); ++ int end_x = FFMIN(img_width, rect.x + rect.w); ++ int end_y = FFMIN(img_height, rect.y + rect.h); ++ ++ for (int y = start_y; y < end_y; y++) { ++ uint8_t *row = data + y * img_width * 4; ++ memset(row + start_x * 4, 0, (end_x - start_x) * 4); ++ } ++} ++ ++static void blend_pixel(uint8_t *dst, const uint8_t *src) ++{ ++ uint8_t sa = src[3]; ++ if (sa == 0) { ++ return; // 源像素完全透明,直接返回 ++ } else if (sa == 255) { ++ // 源像素完全不透明,直接覆盖 ++ memcpy(dst, src, 4); ++ return; ++ } ++ ++ uint8_t da = dst[3]; ++ uint8_t out_a = sa + ((da * (255 - sa)) / 255); ++ ++ if (out_a == 0) { ++ memset(dst, 0, 4); ++ return; ++ } ++ ++ dst[0] = (src[0] * sa + dst[0] * da * (255 - sa) / 255) / out_a; ++ dst[1] = (src[1] * sa + dst[1] * da * (255 - sa) / 255) / out_a; ++ dst[2] = (src[2] * sa + dst[2] * da * (255 - sa) / 255) / out_a; ++ dst[3] = out_a; ++} ++ ++static void draw_image(MyImageRef *canvas, MyImageRef *image, MyRect rect) ++{ ++ if (!canvas || !canvas->data || !image || !image->data) ++ return; ++ ++ int canvas_width = canvas->width; ++ int canvas_height = canvas->height; ++ uint8_t *canvas_data = canvas->data; ++ ++ int image_width = image->width; ++ int image_height = image->height; ++ uint8_t *image_data = image->data; ++ ++ // 计算绘制区域 ++ int start_x = FFMAX(0, rect.x); ++ int start_y = FFMAX(0, rect.y); ++ int end_x = FFMIN(canvas_width, rect.x + rect.w); ++ int end_y = FFMIN(canvas_height, rect.y + rect.h); ++ ++ for (int y = start_y; y < end_y; y++) { ++ uint8_t *canvas_row = canvas_data + y * canvas_width * 4; ++ uint8_t *image_row = image_data + (y - rect.y) * image_width * 4; ++ for (int x = start_x; x < end_x; x++) { ++ uint8_t *canvas_pixel = canvas_row + x * 4; ++ uint8_t *image_pixel = image_row + (x - rect.x) * 4; ++ ++ blend_pixel(canvas_pixel, image_pixel); ++ } ++ } ++} ++ ++static av_cold int libwebp_decode_init(AVCodecContext *avctx) ++{ ++ LibWebPDecoderContext *s = avctx->priv_data; ++ int canvas_size; ++ ++ if (avctx->width <= 0 || avctx->height <= 0) { ++ av_log(avctx, AV_LOG_ERROR, ++ "Invalid canvas dimensions from avctx: %dx%d\n", avctx->width, ++ avctx->height); ++ return AVERROR_INVALIDDATA; ++ } ++ ++ if (alloc_image(&s->canvas, avctx->width, avctx->height)) { ++ av_log(avctx, AV_LOG_ERROR, "Failed to allocate canvas buffer\n"); ++ return AVERROR(ENOMEM); ++ } ++ ++ avctx->pix_fmt = AV_PIX_FMT_RGBA; ++ ++ return 0; ++} ++ ++static int get_origin_from_pkt_side_data(AVPacket *pkt, int *offsetx, ++ int *offsety, int *blend, int *dispose) ++{ ++ if (!pkt || !offsetx || !offsety) { ++ return AVERROR(EINVAL); ++ } ++ ++ // 初始化输出参数 ++ *offsetx = 0; ++ *offsety = 0; ++ *blend = 0; ++ *dispose = 0; ++ ++ // 获取元数据 ++ size_t metadata_len = 0; ++ uint8_t *metadata_data = av_packet_get_side_data( ++ pkt, AV_PKT_DATA_STRINGS_METADATA, &metadata_len); ++ ++ if (!metadata_data || metadata_len == 0) { ++ return -1; // ++ } ++ ++ // 解包元数据到AVDictionary ++ AVDictionary *dict = NULL; ++ int ret = av_packet_unpack_dictionary(metadata_data, metadata_len, &dict); ++ if (ret < 0) { ++ av_log(NULL, AV_LOG_ERROR, "Failed to unpack metadata: %d\n", ret); ++ return ret; ++ } ++ ++ // 解析offsetx和offsety和blend ++ AVDictionaryEntry *entry = NULL; ++ entry = av_dict_get(dict, "offsetx", NULL, 0); ++ if (entry && entry->value) { ++ *offsetx = atoi(entry->value); // 转换字符串为整数 ++ } ++ ++ entry = av_dict_get(dict, "offsety", NULL, 0); ++ if (entry && entry->value) { ++ *offsety = atoi(entry->value); ++ } ++ ++ entry = av_dict_get(dict, "blend", NULL, 0); ++ if (entry && entry->value) { ++ *blend = atoi(entry->value); ++ } ++ ++ entry = av_dict_get(dict, "dispose", NULL, 0); ++ if (entry && entry->value) { ++ *dispose = atoi(entry->value); ++ } ++ ++ // 释放字典 ++ av_dict_free(&dict); ++ return 0; ++} ++ ++static int libwebp_do_decode_frame(AVPacket *pkt, MyImageRef **imgp) ++{ ++ WebPDecoderConfig config; ++ // 1. 解码当前帧并获取其属性 ++ if (!WebPInitDecoderConfig(&config)) ++ return AVERROR_UNKNOWN; ++ ++ if (WebPGetFeatures(pkt->data, pkt->size, &config.input) != VP8_STATUS_OK) ++ return AVERROR_INVALIDDATA; ++ ++ int hasAlpha = config.input.has_alpha; ++ int input_width = config.input.width; ++ int input_height = config.input.height; ++ if (input_width <= 0 || input_height <= 0) ++ return AVERROR_INVALIDDATA; ++ ++ config.output.colorspace = MODE_RGBA; ++ config.output.is_external_memory = 1; ++ ++ MyImageRef *img; ++ ++ if (alloc_image(&img, input_width, input_height)) { ++ return AVERROR(ENOMEM); ++ } ++ ++ int rgba_stride = img->width * 4; ++ uint8_t *rgba = img->data; ++ config.output.u.RGBA.rgba = rgba; ++ config.output.u.RGBA.stride = rgba_stride; ++ config.output.u.RGBA.size = input_height * rgba_stride; ++ ++ if (WebPDecode(pkt->data, pkt->size, &config) != VP8_STATUS_OK) { ++ release_image(img); ++ return AVERROR_INVALIDDATA; ++ } ++ *imgp = img; ++ return 0; ++} ++ ++static int libwebp_decode_frame(AVCodecContext *avctx, AVFrame *frame, ++ int *got_frame, const AVPacket *pkt) ++{ ++ LibWebPDecoderContext *s = avctx->priv_data; ++ ++ int offsetx, offsety, blend, dispose; ++ if (get_origin_from_pkt_side_data(pkt, &offsetx, &offsety, &blend, ++ &dispose) < 0) { ++ return AVERROR_INVALIDDATA; ++ } ++ ++ // 使用 libwebp 解码当前帧 ++ MyImageRef *img = NULL; ++ int ret = libwebp_do_decode_frame((AVPacket *)pkt, &img); ++ if (ret < 0) { ++ av_log(avctx, AV_LOG_ERROR, "Failed to decode WebP frame: %d\n", ret); ++ return ret; ++ } ++ ++ // 将当前帧渲染到已准备好的画布上 ++ MyRect rect = {offsetx, offsety, img->width, img->height}; ++ draw_image(s->canvas, img, rect); ++ release_image(img); ++ ++ frame->width = avctx->width; ++ frame->height = avctx->height; ++ frame->format = avctx->pix_fmt; ++ ++ // 为 frame 申请内存 ++ if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { ++ return ret; ++ } ++ ++ // 将合成好的画布复制到输出帧 ++ int canvas_linesize = s->canvas->width * 4; ++ av_image_copy_plane(frame->data[0], frame->linesize[0], s->canvas->data, ++ s->canvas->width * 4, s->canvas->width * 4, ++ s->canvas->height); ++ ++ // av_image_copy(frame->data, frame->linesize, ++ // (const uint8_t **)&s->canvas->data, &canvas_linesize, ++ // avctx->pix_fmt, output_width, output_height); ++ ++ // 执行 dispose 操作 ++ if (dispose == WEBP_MUX_DISPOSE_BACKGROUND) { ++ clear_rect(s->canvas, rect); ++ } ++ ++ *got_frame = 1; ++ ret = pkt->size; ++ ++ return ret; ++} ++ ++static av_cold int libwebp_decode_close(AVCodecContext *avctx) ++{ ++ LibWebPDecoderContext *s = avctx->priv_data; ++ release_image(s->canvas); ++ s->canvas = NULL; ++ return 0; ++} ++ ++#define OFFSET(x) offsetof(LibWebPDecoderContext, x) ++#define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM ++ ++static const AVOption options[] = {{NULL}}; ++ ++static const AVClass libwebp_decoder_class = { ++ .class_name = "libwebp decoder", ++ .item_name = av_default_item_name, ++ .option = options, ++ .version = LIBAVUTIL_VERSION_INT, ++}; ++ ++const FFCodec ff_libwebp_decoder = { ++ .p.name = "libwebp", ++ .p.long_name = NULL_IF_CONFIG_SMALL("libwebp WebP image decoder"), ++ .p.type = AVMEDIA_TYPE_VIDEO, ++ .p.id = AV_CODEC_ID_LIBWEBP, ++ .priv_data_size = sizeof(LibWebPDecoderContext), ++ .init = libwebp_decode_init, ++ .cb.decode = libwebp_decode_frame, ++ .close = libwebp_decode_close, ++ .p.capabilities = AV_CODEC_CAP_DR1, ++ .p.priv_class = &libwebp_decoder_class, ++ .p.wrapper_name = "libwebp", ++ .caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE, ++}; +diff --git a/libavformat/Makefile b/libavformat/Makefile +index 1f32e4c..90aef47 100644 +--- a/libavformat/Makefile ++++ b/libavformat/Makefile +@@ -644,6 +644,7 @@ OBJS-$(CONFIG_WEBM_MUXER) += matroskaenc.o matroska.o \ + OBJS-$(CONFIG_WEBM_DASH_MANIFEST_MUXER) += webmdashenc.o + OBJS-$(CONFIG_WEBM_CHUNK_MUXER) += webm_chunk.o + OBJS-$(CONFIG_WEBP_MUXER) += webpenc.o ++OBJS-$(CONFIG_WEBP_DEMUXER) += webpdec.o + OBJS-$(CONFIG_WEBVTT_DEMUXER) += webvttdec.o subtitles.o + OBJS-$(CONFIG_WEBVTT_MUXER) += webvttenc.o + OBJS-$(CONFIG_WSAUD_DEMUXER) += westwood_aud.o +diff --git a/libavformat/allformats.c b/libavformat/allformats.c +index dbae42e..d736732 100644 +--- a/libavformat/allformats.c ++++ b/libavformat/allformats.c +@@ -564,6 +564,7 @@ extern const FFInputFormat ff_image_svg_pipe_demuxer; + extern const FFInputFormat ff_image_sunrast_pipe_demuxer; + extern const FFInputFormat ff_image_tiff_pipe_demuxer; + extern const FFInputFormat ff_image_vbn_pipe_demuxer; ++extern const FFInputFormat ff_webp_demuxer; + extern const FFInputFormat ff_image_webp_pipe_demuxer; + extern const FFInputFormat ff_image_xbm_pipe_demuxer; + extern const FFInputFormat ff_image_xpm_pipe_demuxer; +@@ -585,6 +586,8 @@ extern AVInputFormat ff_ijkplaceholder2_demuxer; + extern AVInputFormat ff_ijkplaceholder3_demuxer; + extern AVInputFormat ff_ijkplaceholder4_demuxer; + ++ ++ + #include "libavformat/muxer_list.c" + #include "libavformat/demuxer_list.c" + +diff --git a/libavformat/webpdec.c b/libavformat/webpdec.c +new file mode 100644 +index 0000000..4fbe410 +--- /dev/null ++++ b/libavformat/webpdec.c +@@ -0,0 +1,290 @@ ++/* ++ * WebP demuxer for FFmpeg 7.x and libwebp 1.5.0+ ++ * Copyright (c) 2024 ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ */ ++ ++#include "internal.h" ++#include "demux.h" ++#include "libavutil/intreadwrite.h" ++#include "libavutil/mem.h" // 内存管理函数 ++#include "libavutil/common.h" // 其他工具函数 ++#include ++#include ++ ++typedef struct WebPDemuxContext { ++ const AVClass *class; ++ WebPDemuxer *demuxer; ++ WebPIterator iter; // 帧迭代器 ++ int current_frame; // 当前帧索引 ++ int frame_count; // 总帧数 ++ int loop_count; // ++ int has_animation; ++ int has_alpha; ++ uint32_t canvas_width; // 画布宽度 ++ uint32_t canvas_height; // 画布高度 ++ int64_t duration; // 总时长(ms) ++ uint8_t *data; // 文件数据缓冲区 ++ size_t data_size; // 数据大小 ++ int64_t *frame_timestamps; // 帧时间戳数组(ms) ++ int *frame_durations; // 帧时长数组(ms) ++} WebPDemuxContext; ++ ++// 释放迭代器资源 ++static void webp_release_iterator(WebPIterator *iter) { ++ if (iter->fragment.bytes) { ++ WebPDemuxReleaseIterator(iter); ++ memset(iter, 0, sizeof(*iter)); ++ } ++} ++ ++// 探测WebP格式 ++static int webp_read_probe(const AVProbeData *p) { ++ // WebP文件格式以"RIFF"开头,后面跟着4字节大小和"WEBP"标识 ++ if (p->buf_size < 12) ++ return 0; ++ ++ // 检查RIFF标识和WEBP格式标识 ++ if (AV_RL32(p->buf) == MKTAG('R', 'I', 'F', 'F') && ++ AV_RL32(p->buf + 8) == MKTAG('W', 'E', 'B', 'P')) { ++ // 确定是WebP文件,返回较高的探测分数 ++ return AVPROBE_SCORE_MAX; ++ } ++ ++ return 0; ++} ++ ++static int webp_read_header(AVFormatContext *s) { ++ WebPDemuxContext *wp = s->priv_data; ++ AVIOContext *pb = s->pb; ++ AVStream *st; ++ int ret, i; ++ ++ // 读取文件到内存 ++ wp->data_size = avio_size(pb); ++ if (wp->data_size <= 0) { ++ av_log(s, AV_LOG_ERROR, "Invalid file size\n"); ++ return AVERROR_INVALIDDATA; ++ } ++ ++ wp->data = av_malloc(wp->data_size); ++ if (!wp->data) ++ return AVERROR(ENOMEM); ++ ++ if (avio_read(pb, wp->data, wp->data_size) != wp->data_size) { ++ av_log(s, AV_LOG_ERROR, "Failed to read file\n"); ++ ret = AVERROR(EIO); ++ goto fail; ++ } ++ ++ // 初始化WebP解复用器 ++ WebPData webp_data; ++ WebPDataInit(&webp_data); ++ webp_data.bytes = wp->data; ++ webp_data.size = wp->data_size; ++ ++ wp->demuxer = WebPDemux(&webp_data); ++ if (!wp->demuxer) { ++ av_log(s, AV_LOG_ERROR, "Failed to create WebP demuxer\n"); ++ ret = AVERROR_INVALIDDATA; ++ goto fail; ++ } ++ ++ // 获取画布尺寸 ++ wp->canvas_width = WebPDemuxGetI(wp->demuxer, WEBP_FF_CANVAS_WIDTH); ++ wp->canvas_height = WebPDemuxGetI(wp->demuxer, WEBP_FF_CANVAS_HEIGHT); ++ wp->frame_count = WebPDemuxGetI(wp->demuxer, WEBP_FF_FRAME_COUNT); ++ wp->loop_count = WebPDemuxGetI(wp->demuxer, WEBP_FF_LOOP_COUNT); ++ uint32_t flags = WebPDemuxGetI(wp->demuxer, WEBP_FF_FORMAT_FLAGS); ++ ++ wp->has_animation = flags & ANIMATION_FLAG; ++ wp->has_alpha = flags & ALPHA_FLAG; ++ ++ // 分配帧时间戳和时长数组 ++ wp->frame_timestamps = av_malloc_array(wp->frame_count, sizeof(int64_t)); ++ wp->frame_durations = av_malloc_array(wp->frame_count, sizeof(int)); ++ if (!wp->frame_timestamps || !wp->frame_durations) { ++ ret = AVERROR(ENOMEM); ++ goto fail; ++ } ++ ++ memset(&wp->iter, 0, sizeof(wp->iter)); ++ // libwebp's index start with 1 ++ if (!WebPDemuxGetFrame(wp->demuxer, 1, &wp->iter)) { ++ av_log(s, AV_LOG_ERROR, "Failed to get first frame\n"); ++ ret = AVERROR_INVALIDDATA; ++ goto fail; ++ } ++ ++ wp->duration = 0; ++ for (i = 0; i < wp->frame_count; i++) { ++ int duration = wp->iter.duration; ++ if (duration <= 10) { ++ // WebP standard says 0 duration is used for canvas updating but not showing image, but actually Chrome and other implementations set it to 100ms if duration is lower or equal than 10ms ++ // Some animated WebP images also created without duration, we should keep compatibility ++ duration = 100; ++ } ++ wp->frame_durations[i] = duration; ++ wp->frame_timestamps[i] = wp->duration; ++ wp->duration += wp->frame_durations[i]; ++ if (i < wp->frame_count - 1) ++ WebPDemuxNextFrame(&wp->iter); ++ } ++ ++ // 重置迭代器到第一帧 ++ webp_release_iterator(&wp->iter); ++ if (!WebPDemuxGetFrame(wp->demuxer, 1, &wp->iter)) { ++ av_log(s, AV_LOG_ERROR, "Failed to reset to first frame\n"); ++ ret = AVERROR_INVALIDDATA; ++ goto fail; ++ } ++ ++ // 创建视频流 ++ st = avformat_new_stream(s, NULL); ++ if (!st) { ++ ret = AVERROR(ENOMEM); ++ goto fail; ++ } ++ ++ // 设置流参数 ++ st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO; ++ st->codecpar->codec_id = AV_CODEC_ID_LIBWEBP; ++ st->codecpar->width = wp->canvas_width; ++ st->codecpar->height = wp->canvas_height; ++ st->duration = wp->duration; ++ avpriv_set_pts_info(st, 64, 1, 1000); // 时基:1ms ++ ++ wp->current_frame = 0; ++ return 0; ++ ++fail: ++ webp_release_iterator(&wp->iter); ++ WebPDemuxDelete(wp->demuxer); ++ av_free(wp->data); ++ av_free(wp->frame_timestamps); ++ av_free(wp->frame_durations); ++ return ret; ++} ++ ++/** ++ * Add this frame's source path and basename to packet's sidedata ++ * as a dictionary, so it can be used by filters like 'drawtext'. ++ */ ++static int add_origin_as_pkt_side_data(int offsetx, int offsety, int blend, int dispose, AVPacket *pkt) { ++ AVDictionary *d = NULL; ++ char *packed_metadata = NULL; ++ size_t metadata_len; ++ int ret; ++ ++ av_dict_set_int(&d, "offsetx", offsetx, 0); ++ av_dict_set_int(&d, "offsety", offsety, 0); ++ av_dict_set_int(&d, "blend", blend, 0); ++ av_dict_set_int(&d, "dispose", dispose, 0); ++ ++ packed_metadata = av_packet_pack_dictionary(d, &metadata_len); ++ av_dict_free(&d); ++ if (!packed_metadata) ++ return AVERROR(ENOMEM); ++ ret = av_packet_add_side_data(pkt, AV_PKT_DATA_STRINGS_METADATA, ++ packed_metadata, metadata_len); ++ if (ret < 0) { ++ av_freep(&packed_metadata); ++ return ret; ++ } ++ return 0; ++} ++ ++static int webp_read_packet(AVFormatContext *s, AVPacket *pkt) { ++ WebPDemuxContext *wp = s->priv_data; ++ int ret; ++ ++ if (wp->current_frame >= wp->frame_count) ++ return AVERROR_EOF; ++ ++ // 分配并填充数据包 ++ if ((ret = av_new_packet(pkt, wp->iter.fragment.size)) < 0) ++ return ret; ++ memcpy(pkt->data, wp->iter.fragment.bytes, wp->iter.fragment.size); ++ ++ add_origin_as_pkt_side_data(wp->iter.x_offset, wp->iter.y_offset, wp->iter.blend_method == WEBP_MUX_BLEND, wp->iter.dispose_method == WEBP_MUX_DISPOSE_BACKGROUND, pkt); ++ // 设置数据包参数 ++ pkt->stream_index = 0; ++ pkt->pts = wp->frame_timestamps[wp->current_frame]; ++ pkt->duration = wp->frame_durations[wp->current_frame]; ++ pkt->flags |= AV_PKT_FLAG_KEY; ++ ++ // 准备下一帧 ++ wp->current_frame++; ++ if (wp->current_frame < wp->frame_count && !WebPDemuxNextFrame(&wp->iter)) ++ av_log(s, AV_LOG_WARNING, "Unexpected end of frames\n"); ++ ++ return 0; ++} ++ ++static int webp_read_seek(AVFormatContext *s, int stream_index, ++ int64_t timestamp, int flags) { ++ WebPDemuxContext *wp = s->priv_data; ++ int target_frame; ++ ++ if (stream_index != 0) ++ return -1; ++ ++ // 计算目标帧索引 ++ target_frame = av_rescale_rnd(timestamp, wp->frame_count, ++ wp->duration, flags & AVSEEK_FLAG_BACKWARD ? AV_ROUND_DOWN : AV_ROUND_UP); ++ ++ // 手动实现范围限制(替代av_clamp) ++ if (target_frame < 0) { ++ target_frame = 0; ++ } else if (target_frame >= wp->frame_count) { ++ target_frame = wp->frame_count - 1; ++ } ++ ++ // 定位到目标帧 ++ webp_release_iterator(&wp->iter); ++ if (!WebPDemuxGetFrame(wp->demuxer, target_frame + 1, &wp->iter)) { ++ av_log(s, AV_LOG_ERROR, "Failed to seek to frame %d\n", target_frame); ++ return AVERROR_INVALIDDATA; ++ } ++ ++ wp->current_frame = target_frame; ++ return 0; ++} ++ ++static int webp_read_close(AVFormatContext *s) { ++ WebPDemuxContext *wp = s->priv_data; ++ ++ webp_release_iterator(&wp->iter); ++ WebPDemuxDelete(wp->demuxer); ++ av_free(wp->data); ++ av_free(wp->frame_timestamps); ++ av_free(wp->frame_durations); ++ return 0; ++} ++ ++static const AVClass webp_demuxer_class = { ++ .class_name = "WebP demuxer", ++ .item_name = av_default_item_name, ++ .version = LIBAVUTIL_VERSION_INT, ++}; ++ ++// FFmpeg 7.x输入解复用器标准声明 ++const FFInputFormat ff_webp_demuxer = { ++ .p.name = "webp", ++ .p.long_name = NULL_IF_CONFIG_SMALL("WebP image format (libwebp 1.5.0+)"), ++ .p.flags = AVFMT_GENERIC_INDEX, ++ .p.extensions = "webp", ++ .read_probe = webp_read_probe, // 新增的探测函数 ++ .read_header = webp_read_header, ++ .read_packet = webp_read_packet, ++ .read_seek = webp_read_seek, ++ .read_close = webp_read_close, ++ .priv_data_size = sizeof(WebPDemuxContext), ++ .p.priv_class = &webp_demuxer_class, ++}; +-- +2.39.5 (Apple Git-154) + From 211c81a3fe924499091b9e263f64bd0f8450e9fa Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Mon, 8 Sep 2025 14:36:04 +0800 Subject: [PATCH 117/359] webp need lipo more libs --- configs/libs/webp.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/libs/webp.sh b/configs/libs/webp.sh index dda4c8dd9..2bc1969c2 100644 --- a/configs/libs/webp.sh +++ b/configs/libs/webp.sh @@ -18,7 +18,7 @@ # export LIB_NAME='webp' -export LIPO_LIBS="libwebp" +export LIPO_LIBS="libwebp libsharpyuv libwebpdecoder libwebpdemux" export LIB_DEPENDS_BIN="cmake" export CMAKE_TARGETS_NAME=webpdecoder,webpdemux export GIT_LOCAL_REPO=extra/webp From 8f866968188c1ea4263ecd5eb47e2684423bbd93 Mon Sep 17 00:00:00 2001 From: Anka Date: Mon, 8 Sep 2025 06:40:18 +0000 Subject: [PATCH 118/359] upgrade webp to webp-v1.6.0-250908143832 for macos by cd --- configs/libs/webp.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/libs/webp.sh b/configs/libs/webp.sh index 2bc1969c2..e5e44805e 100644 --- a/configs/libs/webp.sh +++ b/configs/libs/webp.sh @@ -35,6 +35,6 @@ fi # pre compiled export PRE_COMPILE_TAG_TVOS= -export PRE_COMPILE_TAG_MACOS=webp-v1.6.0-250908113432 +export PRE_COMPILE_TAG_MACOS=webp-v1.6.0-250908143832 export PRE_COMPILE_TAG_IOS= export PRE_COMPILE_TAG_ANDROID= \ No newline at end of file From bfcd3ace1a7f74805c7ac30da67449ce24a55606 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Mon, 8 Sep 2025 15:26:30 +0800 Subject: [PATCH 119/359] webp decoder impl flush func --- ...add-webp-demuxer-and-libwebp-decoder.patch | 102 ++++++++++++------ 1 file changed, 67 insertions(+), 35 deletions(-) diff --git a/patches/ffmpeg-n7.1.1/0032-add-webp-demuxer-and-libwebp-decoder.patch b/patches/ffmpeg-n7.1.1/0032-add-webp-demuxer-and-libwebp-decoder.patch index fb15f0b15..2acc4d5d2 100644 --- a/patches/ffmpeg-n7.1.1/0032-add-webp-demuxer-and-libwebp-decoder.patch +++ b/patches/ffmpeg-n7.1.1/0032-add-webp-demuxer-and-libwebp-decoder.patch @@ -1,6 +1,6 @@ -From 21d88e28b8834fae08fcd3a337faf1ac209a4a4f Mon Sep 17 00:00:00 2001 +From c00008ca039260f7dca9d8c06f599197a96a75cf Mon Sep 17 00:00:00 2001 From: qianlongxu -Date: Mon, 8 Sep 2025 13:59:17 +0800 +Date: Mon, 8 Sep 2025 15:24:55 +0800 Subject: [PATCH] add webp demuxer and libwebp decoder --- @@ -9,11 +9,11 @@ Subject: [PATCH] add webp demuxer and libwebp decoder libavcodec/allcodecs.c | 2 +- libavcodec/codec_desc.c | 11 +- libavcodec/codec_id.h | 2 +- - libavcodec/libwebpdec.c | 350 +++++++++++++++++++++++++++++++++++++++ + libavcodec/libwebpdec.c | 376 +++++++++++++++++++++++++++++++++++++++ libavformat/Makefile | 1 + libavformat/allformats.c | 3 + - libavformat/webpdec.c | 290 ++++++++++++++++++++++++++++++++ - 9 files changed, 663 insertions(+), 4 deletions(-) + libavformat/webpdec.c | 296 ++++++++++++++++++++++++++++++ + 9 files changed, 695 insertions(+), 4 deletions(-) create mode 100644 libavcodec/libwebpdec.c create mode 100644 libavformat/webpdec.c @@ -111,15 +111,30 @@ index 8c724a0..041015e 100644 AV_CODEC_ID_MPEG2TS = 0x20000, /**< _FAKE_ codec to indicate a raw MPEG-2 TS diff --git a/libavcodec/libwebpdec.c b/libavcodec/libwebpdec.c new file mode 100644 -index 0000000..c2884c0 +index 0000000..17b69d0 --- /dev/null +++ b/libavcodec/libwebpdec.c -@@ -0,0 +1,350 @@ +@@ -0,0 +1,376 @@ +/* -+ * WebP decoder using libwebp for FFmpeg 7.x -+ * Copyright (c) 2024 ++ * libwebpdec.c + * -+ * This file is part of FFmpeg. ++ * Copyright (c) 2025 debugly ++ * ++ * This file is part of FSPlayer. ++ * ++ * FSPlayer is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 3 of the License, or (at your option) any later version. ++ * ++ * FSPlayer is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FSPlayer; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "codec_internal.h" @@ -431,6 +446,16 @@ index 0000000..c2884c0 + return ret; +} + ++static int libwebp_decode_flush(AVCodecContext *avctx) ++{ ++ LibWebPDecoderContext *s = avctx->priv_data; ++ if (s->canvas && s->canvas->data) { ++ memset(s->canvas->data, 0, s->canvas->width * s->canvas->height * 4); ++ } ++ return 0; ++} ++ ++//when seek or seek to zero for loop,clear then canvas +static av_cold int libwebp_decode_close(AVCodecContext *avctx) +{ + LibWebPDecoderContext *s = avctx->priv_data; @@ -459,6 +484,7 @@ index 0000000..c2884c0 + .priv_data_size = sizeof(LibWebPDecoderContext), + .init = libwebp_decode_init, + .cb.decode = libwebp_decode_frame, ++ .flush = libwebp_decode_flush, + .close = libwebp_decode_close, + .p.capabilities = AV_CODEC_CAP_DR1, + .p.priv_class = &libwebp_decoder_class, @@ -500,29 +526,38 @@ index dbae42e..d736732 100644 diff --git a/libavformat/webpdec.c b/libavformat/webpdec.c new file mode 100644 -index 0000000..4fbe410 +index 0000000..df4a3af --- /dev/null +++ b/libavformat/webpdec.c -@@ -0,0 +1,290 @@ +@@ -0,0 +1,296 @@ +/* -+ * WebP demuxer for FFmpeg 7.x and libwebp 1.5.0+ -+ * Copyright (c) 2024 ++ * webpdec.c ++ * ++ * Copyright (c) 2025 debugly + * -+ * This file is part of FFmpeg. ++ * This file is part of FSPlayer. + * -+ * FFmpeg is free software; you can redistribute it and/or ++ * FSPlayer is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. ++ * version 3 of the License, or (at your option) any later version. ++ * ++ * FSPlayer is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FSPlayer; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "internal.h" +#include "demux.h" +#include "libavutil/intreadwrite.h" -+#include "libavutil/mem.h" // 内存管理函数 -+#include "libavutil/common.h" // 其他工具函数 ++#include "libavutil/mem.h" ++#include "libavutil/common.h" +#include -+#include + +typedef struct WebPDemuxContext { + const AVClass *class; @@ -530,11 +565,6 @@ index 0000000..4fbe410 + WebPIterator iter; // 帧迭代器 + int current_frame; // 当前帧索引 + int frame_count; // 总帧数 -+ int loop_count; // -+ int has_animation; -+ int has_alpha; -+ uint32_t canvas_width; // 画布宽度 -+ uint32_t canvas_height; // 画布高度 + int64_t duration; // 总时长(ms) + uint8_t *data; // 文件数据缓冲区 + size_t data_size; // 数据大小 @@ -602,15 +632,16 @@ index 0000000..4fbe410 + goto fail; + } + -+ // 获取画布尺寸 -+ wp->canvas_width = WebPDemuxGetI(wp->demuxer, WEBP_FF_CANVAS_WIDTH); -+ wp->canvas_height = WebPDemuxGetI(wp->demuxer, WEBP_FF_CANVAS_HEIGHT); + wp->frame_count = WebPDemuxGetI(wp->demuxer, WEBP_FF_FRAME_COUNT); -+ wp->loop_count = WebPDemuxGetI(wp->demuxer, WEBP_FF_LOOP_COUNT); -+ uint32_t flags = WebPDemuxGetI(wp->demuxer, WEBP_FF_FORMAT_FLAGS); ++ // 获取画布尺寸 ++ int canvas_width = WebPDemuxGetI(wp->demuxer, WEBP_FF_CANVAS_WIDTH); ++ int canvas_height = WebPDemuxGetI(wp->demuxer, WEBP_FF_CANVAS_HEIGHT); ++ ++ // int loop_count = WebPDemuxGetI(wp->demuxer, WEBP_FF_LOOP_COUNT); ++ // uint32_t flags = WebPDemuxGetI(wp->demuxer, WEBP_FF_FORMAT_FLAGS); + -+ wp->has_animation = flags & ANIMATION_FLAG; -+ wp->has_alpha = flags & ALPHA_FLAG; ++ // int has_animation = flags & ANIMATION_FLAG; ++ // int has_alpha = flags & ALPHA_FLAG; + + // 分配帧时间戳和时长数组 + wp->frame_timestamps = av_malloc_array(wp->frame_count, sizeof(int64_t)); @@ -660,9 +691,10 @@ index 0000000..4fbe410 + + // 设置流参数 + st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO; ++ // 使用自定义解码器 + st->codecpar->codec_id = AV_CODEC_ID_LIBWEBP; -+ st->codecpar->width = wp->canvas_width; -+ st->codecpar->height = wp->canvas_height; ++ st->codecpar->width = canvas_width; ++ st->codecpar->height = canvas_height; + st->duration = wp->duration; + avpriv_set_pts_info(st, 64, 1, 1000); // 时基:1ms + @@ -786,7 +818,7 @@ index 0000000..4fbe410 + .p.long_name = NULL_IF_CONFIG_SMALL("WebP image format (libwebp 1.5.0+)"), + .p.flags = AVFMT_GENERIC_INDEX, + .p.extensions = "webp", -+ .read_probe = webp_read_probe, // 新增的探测函数 ++ .read_probe = webp_read_probe, + .read_header = webp_read_header, + .read_packet = webp_read_packet, + .read_seek = webp_read_seek, From e7d68f3b6b90513de6cb001750bafdb98974e5b9 Mon Sep 17 00:00:00 2001 From: Anka Date: Mon, 8 Sep 2025 07:34:01 +0000 Subject: [PATCH 120/359] upgrade ffmpeg7 to ffmpeg7-7.1.1-250908152824 for macos by cd --- configs/libs/ffmpeg7.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/libs/ffmpeg7.sh b/configs/libs/ffmpeg7.sh index 7d13fca6d..a6a1ddaf8 100644 --- a/configs/libs/ffmpeg7.sh +++ b/configs/libs/ffmpeg7.sh @@ -38,7 +38,7 @@ export GIT_REPO_VERSION=7.1.1 # pre compiled export PRE_COMPILE_TAG_TVOS=ffmpeg7-7.1.1-250623102840 -export PRE_COMPILE_TAG_MACOS=ffmpeg7-7.1.1-250623102840 +export PRE_COMPILE_TAG_MACOS=ffmpeg7-7.1.1-250908152824 export PRE_COMPILE_TAG_IOS=ffmpeg7-7.1.1-250623102840 export PRE_COMPILE_TAG_ANDROID=ffmpeg7-7.1.1-250606143631 From ea78a22e3a392dc114f71ac64511670542b640bd Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Thu, 11 Sep 2025 15:30:36 +0800 Subject: [PATCH 121/359] fix add dummy demuxer bug --- .../0009-add-3-dummy-ijkhttp-protocols.patch | 70 +++++++++++++++++-- 1 file changed, 63 insertions(+), 7 deletions(-) diff --git a/patches/ffmpeg-n7.1.1/0009-add-3-dummy-ijkhttp-protocols.patch b/patches/ffmpeg-n7.1.1/0009-add-3-dummy-ijkhttp-protocols.patch index 0828024d7..1443067f7 100644 --- a/patches/ffmpeg-n7.1.1/0009-add-3-dummy-ijkhttp-protocols.patch +++ b/patches/ffmpeg-n7.1.1/0009-add-3-dummy-ijkhttp-protocols.patch @@ -1,18 +1,53 @@ -From 8fe7e70aa2feb98f199e1d3c91afb435f6db25aa Mon Sep 17 00:00:00 2001 +From 7393491965cf7d321c16cd8409de1e51956e6ff7 Mon Sep 17 00:00:00 2001 From: qianlongxu -Date: Fri, 30 May 2025 09:24:42 +0800 +Date: Thu, 11 Sep 2025 15:27:28 +0800 Subject: [PATCH] add 3 dummy ijkhttp protocols --- - libavformat/ijkutils.c | 3 +++ - libavformat/protocols.c | 3 +++ - 2 files changed, 6 insertions(+) + libavformat/allformats.c | 14 +++++++------- + libavformat/ijkutils.c | 11 +++++++++++ + libavformat/protocols.c | 3 +++ + 3 files changed, 21 insertions(+), 7 deletions(-) +diff --git a/libavformat/allformats.c b/libavformat/allformats.c +index dbae42e..31a9509 100644 +--- a/libavformat/allformats.c ++++ b/libavformat/allformats.c +@@ -576,14 +576,14 @@ extern const FFInputFormat ff_libmodplug_demuxer; + extern const FFInputFormat ff_libopenmpt_demuxer; + extern const FFInputFormat ff_vapoursynth_demuxer; + +-// ijk +-extern AVInputFormat ff_ijklivehook_demuxer; +-extern AVInputFormat ff_ijklas_demuxer; ++// ijk custom demuxers ++extern FFInputFormat ff_ijklivehook_demuxer; ++extern FFInputFormat ff_ijklas_demuxer; + +-extern AVInputFormat ff_ijkplaceholder1_demuxer; +-extern AVInputFormat ff_ijkplaceholder2_demuxer; +-extern AVInputFormat ff_ijkplaceholder3_demuxer; +-extern AVInputFormat ff_ijkplaceholder4_demuxer; ++extern FFInputFormat ff_ijkplaceholder1_demuxer; ++extern FFInputFormat ff_ijkplaceholder2_demuxer; ++extern FFInputFormat ff_ijkplaceholder3_demuxer; ++extern FFInputFormat ff_ijkplaceholder4_demuxer; + + #include "libavformat/muxer_list.c" + #include "libavformat/demuxer_list.c" diff --git a/libavformat/ijkutils.c b/libavformat/ijkutils.c -index 604e725..2f36c69 100644 +index 604e725..ddecc30 100644 --- a/libavformat/ijkutils.c +++ b/libavformat/ijkutils.c -@@ -64,6 +64,9 @@ IJK_DUMMY_PROTOCOL(ijkhttphook); +@@ -56,6 +56,7 @@ URLProtocol ff_##x##_protocol = { \ + + static int ijkdummy_open(URLContext *h, const char *arg, int flags, AVDictionary **options) + { ++ av_log(NULL, AV_LOG_ERROR, "you called a dummp protocol:%s\n", h->prot->name); + return -1; + } + +@@ -64,6 +65,9 @@ IJK_DUMMY_PROTOCOL(ijkhttphook); IJK_DUMMY_PROTOCOL(ijksegment); IJK_DUMMY_PROTOCOL(ijktcphook); IJK_DUMMY_PROTOCOL(ijkio); @@ -22,6 +57,27 @@ index 604e725..2f36c69 100644 #define IJK_FF_DEMUXER(x) \ extern FFInputFormat ff_##x##_demuxer; \ +@@ -78,6 +82,12 @@ int ijkav_register_##x##_demuxer(FFInputFormat *demuxer, int demuxer_size) + return 0; \ + } + ++static int ijkdummy_probe(const AVProbeData *p) ++{ ++ av_log(NULL, AV_LOG_ERROR, "you called a dummp demuxer\n"); ++ return AVERROR_INVALIDDATA; ++} ++ + #define IJK_DUMMY_DEMUXER(x) \ + IJK_FF_DEMUXER(x); \ + static const AVClass ijk_##x##_demuxer_class = { \ +@@ -91,6 +101,7 @@ FFInputFormat ff_##x##_demuxer = { \ + .p.priv_class = &ijk_##x##_demuxer_class, \ + .priv_data_size = 1, \ + .flags_internal = FF_INFMT_FLAG_INIT_CLEANUP, \ ++ .read_probe = ijkdummy_probe, \ + }; + + /* diff --git a/libavformat/protocols.c b/libavformat/protocols.c index 719caf8..b291b9f 100644 --- a/libavformat/protocols.c From adae9262180144a7a2789f62a8d16a87f2d93a75 Mon Sep 17 00:00:00 2001 From: debugly Date: Fri, 19 Sep 2025 22:31:08 +0800 Subject: [PATCH 122/359] fix build err: platform must be: [ios|macos|tvos|android] --- .github/workflows/install-dependencies.sh | 25 +++++++++++------------ 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/.github/workflows/install-dependencies.sh b/.github/workflows/install-dependencies.sh index f8b36acfb..35700beb2 100755 --- a/.github/workflows/install-dependencies.sh +++ b/.github/workflows/install-dependencies.sh @@ -37,22 +37,21 @@ case $LIB_NAME in ;; ffmpeg7) if [[ $PLAT == all ]];then - ./main.sh install -l 'openssl3 opus bluray dav1d dvdnav uavs3d smb2' -p ios - ./main.sh install -l 'openssl3 opus bluray dav1d dvdnav uavs3d smb2' -p tvos - ./main.sh install -l 'openssl3 opus bluray dav1d dvdnav uavs3d smb2' -p macos - ./main.sh install -l 'openssl3 opus bluray dav1d dvdnav uavs3d smb2' -p android + ./main.sh install -l 'openssl3 opus bluray dav1d dvdnav uavs3d smb2 webp' -p ios + ./main.sh install -l 'openssl3 opus bluray dav1d dvdnav uavs3d smb2 webp' -p tvos + ./main.sh install -l 'openssl3 opus bluray dav1d dvdnav uavs3d smb2 webp' -p macos + ./main.sh install -l 'openssl3 opus bluray dav1d dvdnav uavs3d smb2 soundtouch' -p android elif [[ $PLAT == apple ]];then - ./main.sh install -l 'openssl3 opus bluray dav1d dvdnav uavs3d smb2' -p ios - ./main.sh install -l 'openssl3 opus bluray dav1d dvdnav uavs3d smb2' -p tvos - ./main.sh install -l 'openssl3 opus bluray dav1d dvdnav uavs3d smb2' -p macos + ./main.sh install -l 'openssl3 opus bluray dav1d dvdnav uavs3d smb2 webp' -p ios + ./main.sh install -l 'openssl3 opus bluray dav1d dvdnav uavs3d smb2 webp' -p tvos + ./main.sh install -l 'openssl3 opus bluray dav1d dvdnav uavs3d smb2 webp' -p macos else ./main.sh install -l 'openssl3 opus bluray dav1d dvdnav uavs3d smb2' -p $PLAT - fi - - if [[ $PLAT == android ]];then - ./main.sh install -l 'soundtouch' -p android - else - ./main.sh install -l 'webp' -p $PLAT + if [[ $PLAT == android ]];then + ./main.sh install -l 'soundtouch' -p android + else + ./main.sh install -l 'webp' -p $PLAT + fi fi ;; ffmpeg6) From bd8a30f4eceea915b9870e9f1553daea489ec7c3 Mon Sep 17 00:00:00 2001 From: Anka Date: Fri, 19 Sep 2025 14:59:13 +0000 Subject: [PATCH 123/359] upgrade webp to webp-v1.6.0-250919225145 for apple by cd --- configs/libs/webp.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configs/libs/webp.sh b/configs/libs/webp.sh index e5e44805e..977692181 100644 --- a/configs/libs/webp.sh +++ b/configs/libs/webp.sh @@ -34,7 +34,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS= -export PRE_COMPILE_TAG_MACOS=webp-v1.6.0-250908143832 -export PRE_COMPILE_TAG_IOS= +export PRE_COMPILE_TAG_TVOS=webp-v1.6.0-250919225145 +export PRE_COMPILE_TAG_MACOS=webp-v1.6.0-250919225145 +export PRE_COMPILE_TAG_IOS=webp-v1.6.0-250919225145 export PRE_COMPILE_TAG_ANDROID= \ No newline at end of file From 3ff9a302474b32b4db3570ac958d77aa6190bbb5 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Thu, 9 Oct 2025 15:42:59 +0800 Subject: [PATCH 124/359] fix conflict when applying patch 0032 to ffmepg7 #16 --- ...add-webp-demuxer-and-libwebp-decoder.patch | 90 +++++++++---------- 1 file changed, 40 insertions(+), 50 deletions(-) diff --git a/patches/ffmpeg-n7.1.1/0032-add-webp-demuxer-and-libwebp-decoder.patch b/patches/ffmpeg-n7.1.1/0032-add-webp-demuxer-and-libwebp-decoder.patch index 2acc4d5d2..74fbc1d72 100644 --- a/patches/ffmpeg-n7.1.1/0032-add-webp-demuxer-and-libwebp-decoder.patch +++ b/patches/ffmpeg-n7.1.1/0032-add-webp-demuxer-and-libwebp-decoder.patch @@ -1,20 +1,22 @@ -From c00008ca039260f7dca9d8c06f599197a96a75cf Mon Sep 17 00:00:00 2001 +From 83a84dc1fc30d9e48f486489299feb9be4cde432 Mon Sep 17 00:00:00 2001 From: qianlongxu -Date: Mon, 8 Sep 2025 15:24:55 +0800 +Date: Thu, 9 Oct 2025 14:28:49 +0800 Subject: [PATCH] add webp demuxer and libwebp decoder --- - configure | 7 +- - libavcodec/Makefile | 1 + - libavcodec/allcodecs.c | 2 +- - libavcodec/codec_desc.c | 11 +- - libavcodec/codec_id.h | 2 +- - libavcodec/libwebpdec.c | 376 +++++++++++++++++++++++++++++++++++++++ - libavformat/Makefile | 1 + - libavformat/allformats.c | 3 + - libavformat/webpdec.c | 296 ++++++++++++++++++++++++++++++ - 9 files changed, 695 insertions(+), 4 deletions(-) + configure | 7 +- + libavcodec/Makefile | 1 + + libavcodec/allcodecs.c | 1 + + libavcodec/codec_desc.c | 9 + + libavcodec/codec_id.h | 1 + + libavcodec/libwebpdec.c | 376 +++++++++++++++++++++++++++++++++++ + libavformat/Makefile | 1 + + libavformat/allformats.c | 1 + + libavformat/allformats.c.rej | 9 - + libavformat/webpdec.c | 296 +++++++++++++++++++++++++++ + 10 files changed, 692 insertions(+), 10 deletions(-) create mode 100644 libavcodec/libwebpdec.c + delete mode 100644 libavformat/allformats.c.rej create mode 100644 libavformat/webpdec.c diff --git a/configure b/configure @@ -48,20 +50,19 @@ index 03e80a2..441d4ee 100644 OBJS-$(CONFIG_WEBVTT_ENCODER) += webvttenc.o ass_split.o OBJS-$(CONFIG_WMALOSSLESS_DECODER) += wmalosslessdec.o wma_common.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c -index aa0fc47..7098f1d 100644 +index aa0fc47..fa448b8 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c -@@ -900,7 +900,7 @@ extern const FFCodec ff_vnull_decoder; - extern const FFCodec ff_vnull_encoder; - extern const FFCodec ff_anull_decoder; - extern const FFCodec ff_anull_encoder; -- +@@ -416,6 +416,7 @@ extern const FFCodec ff_zlib_encoder; + extern const FFCodec ff_zlib_decoder; + extern const FFCodec ff_zmbv_encoder; + extern const FFCodec ff_zmbv_decoder; +extern const FFCodec ff_libwebp_decoder; - // The iterate API is not usable with ossfuzz due to the excessive size of binaries created - #if CONFIG_OSSFUZZ - const FFCodec * codec_list[] = { + + /* audio codecs */ + extern const FFCodec ff_aac_encoder; diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c -index 38cab26..30af1ac 100644 +index 38cab26..9a56d7c 100644 --- a/libavcodec/codec_desc.c +++ b/libavcodec/codec_desc.c @@ -1959,6 +1959,15 @@ static const AVCodecDescriptor codec_descriptors[] = { @@ -80,17 +81,8 @@ index 38cab26..30af1ac 100644 /* various PCM "codecs" */ { -@@ -3734,7 +3743,7 @@ static const AVCodecDescriptor codec_descriptors[] = { - .name = "av3a", - .long_name = NULL_IF_CONFIG_SMALL("Audio Vivid"), - .props = AV_CODEC_PROP_LOSSY, -- }, -+ } - }; - - static int descriptor_compare(const void *key, const void *member) diff --git a/libavcodec/codec_id.h b/libavcodec/codec_id.h -index 8c724a0..041015e 100644 +index 8c724a0..b0a9274 100644 --- a/libavcodec/codec_id.h +++ b/libavcodec/codec_id.h @@ -323,6 +323,7 @@ enum AVCodecID { @@ -101,14 +93,6 @@ index 8c724a0..041015e 100644 /* various PCM "codecs" */ AV_CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs AV_CODEC_ID_PCM_S16LE = 0x10000, -@@ -592,7 +593,6 @@ enum AVCodecID { - AV_CODEC_ID_LCEVC, - AV_CODEC_ID_AVS3DA, - -- - AV_CODEC_ID_PROBE = 0x19000, ///< codec_id is not known (like AV_CODEC_ID_NONE) but lavf should attempt to identify it - - AV_CODEC_ID_MPEG2TS = 0x20000, /**< _FAKE_ codec to indicate a raw MPEG-2 TS diff --git a/libavcodec/libwebpdec.c b/libavcodec/libwebpdec.c new file mode 100644 index 0000000..17b69d0 @@ -504,7 +488,7 @@ index 1f32e4c..90aef47 100644 OBJS-$(CONFIG_WEBVTT_MUXER) += webvttenc.o OBJS-$(CONFIG_WSAUD_DEMUXER) += westwood_aud.o diff --git a/libavformat/allformats.c b/libavformat/allformats.c -index dbae42e..d736732 100644 +index 31a9509..fbe7967 100644 --- a/libavformat/allformats.c +++ b/libavformat/allformats.c @@ -564,6 +564,7 @@ extern const FFInputFormat ff_image_svg_pipe_demuxer; @@ -515,15 +499,21 @@ index dbae42e..d736732 100644 extern const FFInputFormat ff_image_webp_pipe_demuxer; extern const FFInputFormat ff_image_xbm_pipe_demuxer; extern const FFInputFormat ff_image_xpm_pipe_demuxer; -@@ -585,6 +586,8 @@ extern AVInputFormat ff_ijkplaceholder2_demuxer; - extern AVInputFormat ff_ijkplaceholder3_demuxer; - extern AVInputFormat ff_ijkplaceholder4_demuxer; - -+ -+ - #include "libavformat/muxer_list.c" - #include "libavformat/demuxer_list.c" - +diff --git a/libavformat/allformats.c.rej b/libavformat/allformats.c.rej +deleted file mode 100644 +index 623b4c4..0000000 +--- a/libavformat/allformats.c.rej ++++ /dev/null +@@ -1,9 +0,0 @@ +-diff a/libavformat/allformats.c b/libavformat/allformats.c (rejected hunks) +-@@ -86,6 +86,7 @@ extern const FFOutputFormat ff_asf_stream_muxer; +- extern const AVInputFormat ff_au_demuxer; +- extern const FFOutputFormat ff_au_muxer; +- extern const AVInputFormat ff_av1_demuxer; +-+extern const AVInputFormat ff_av3a_demuxer; +- extern const AVInputFormat ff_avi_demuxer; +- extern const FFOutputFormat ff_avi_muxer; +- extern const FFOutputFormat ff_avif_muxer; diff --git a/libavformat/webpdec.c b/libavformat/webpdec.c new file mode 100644 index 0000000..df4a3af From f736bd32d4d2f672cb3b1000788294b8980028ea Mon Sep 17 00:00:00 2001 From: Anka Date: Thu, 9 Oct 2025 08:06:05 +0000 Subject: [PATCH 125/359] upgrade ffmpeg7 to ffmpeg7-7.1.1-251009154600 for apple by cd --- configs/libs/ffmpeg7.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configs/libs/ffmpeg7.sh b/configs/libs/ffmpeg7.sh index a6a1ddaf8..2fb2c745e 100644 --- a/configs/libs/ffmpeg7.sh +++ b/configs/libs/ffmpeg7.sh @@ -37,8 +37,8 @@ export GIT_REPO_VERSION=7.1.1 # pre compiled -export PRE_COMPILE_TAG_TVOS=ffmpeg7-7.1.1-250623102840 -export PRE_COMPILE_TAG_MACOS=ffmpeg7-7.1.1-250908152824 -export PRE_COMPILE_TAG_IOS=ffmpeg7-7.1.1-250623102840 +export PRE_COMPILE_TAG_TVOS=ffmpeg7-7.1.1-251009154600 +export PRE_COMPILE_TAG_MACOS=ffmpeg7-7.1.1-251009154600 +export PRE_COMPILE_TAG_IOS=ffmpeg7-7.1.1-251009154600 export PRE_COMPILE_TAG_ANDROID=ffmpeg7-7.1.1-250606143631 From a798d6ba5a5d65b6633b9c8f475df5c22399242f Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Fri, 10 Oct 2025 12:59:22 +0800 Subject: [PATCH 126/359] update README --- README.md | 12 ++++++------ README_zh-CN.md | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 7295832c7..9ad6e32b8 100644 --- a/README.md +++ b/README.md @@ -4,17 +4,17 @@ **What's MRFFToolChain?** -MRFFToolChain products was built for [fsplayer](https://github.com/debugly/fsplayer) 、 [ijkplayer](https://github.com/debugly/ijkplayer) 、[FFmpegTutorial](https://github.com/debugly/FFmpegTutorial). +MRFFToolChain is a mature set of compilation tools specifically designed for compiling third-party libraries for iOS, macOS, tvOS, and Android platforms. It's products was built for [fsplayer](https://github.com/debugly/fsplayer) 、[ijkplayer](https://github.com/debugly/ijkplayer) 、[FFmpegTutorial](https://github.com/debugly/FFmpegTutorial). -At present MRFFToolChain contained `ass、bluray、dav1d、dvdread、dvdnav、ffmpeg、freetype、fribidi、harfbuzz、openssl、opus、unibreak、uavs3d、smb2、yuv、soundtouch、xml2`. +At present MRFFToolChain contained `ass、bluray、dav1d、dvdread、dvdnav、ffmpeg、freetype、fribidi、harfbuzz、openssl、opus、unibreak、uavs3d、smb2、yuv、soundtouch、xml2、webp`. ## Supported Plat -| platform | architectures | minimum deployment target | -| -------- | -------------------------------------- | ------------------------- | +| platform | architectures | minimum deployment target | +| -------- | --------------------------------------- | ------------------------- | | iOS | arm64、arm64_simulator、x86_64_simulator | 11.0 | | tvOS | arm64、arm64_simulator、x86_64_simulator | 12.0 | -| macOS | arm64、x86_64 | 10.11 | +| macOS | arm64、x86_64 | 10.11 | | Android | arm64、armv7a、x86_64、x86 | 21 | ## News @@ -37,7 +37,7 @@ At present MRFFToolChain contained `ass、bluray、dav1d、dvdread、dvdnav、ff - FFmpeg4 for Appple: openssl3,opus,bluray - FFmpeg5 for Appple: openssl3,opus,bluray,dav1d,dvdread,uavs3d - FFmpeg6 for Appple: openssl3,opus,bluray,dav1d,dvdread,uavs3d,smb2 -- FFmpeg7 for Appple: openssl3,opus,bluray,dav1d,dvdnav,uavs3d,smb2 +- FFmpeg7 for Appple: openssl3,opus,bluray,dav1d,dvdnav,uavs3d,smb2,webp - FFmpeg4 for Android: openssl3,opus,bluray,soundtouch - FFmpeg5 for Android: openssl3,opus,bluray,dav1d,dvdread,uavs3d,soundtouch - FFmpeg6 for Android: openssl3,opus,bluray,dav1d,dvdread,uavs3d,smb2,soundtouch diff --git a/README_zh-CN.md b/README_zh-CN.md index 9aed598d2..b1ae389cd 100644 --- a/README_zh-CN.md +++ b/README_zh-CN.md @@ -4,9 +4,9 @@ **MRFFToolChain 是什么?** -MRFFToolChain 的构建产物是为 [fsplayer](https://github.com/debugly/fsplayer) 、 [ijkplayer](https://github.com/debugly/ijkplayer) 、[FFmpegTutorial](https://github.com/debugly/FFmpegTutorial) 服务的. +MRFFToolChain 是一套成熟的编译工具,专门用来编译 iOS、macOS、tvOS、Android 平台的三方库,其构建产物为 [fsplayer](https://github.com/debugly/fsplayer) 、 [ijkplayer](https://github.com/debugly/ijkplayer) 、[FFmpegTutorial](https://github.com/debugly/FFmpegTutorial) 所用. -目前包含了这些库:`ass、bluray、dav1d、dvdread、dvdnav、ffmpeg、freetype、fribidi、harfbuzz、openssl、opus、unibreak、uavs3d、smb2、yuv、soundtouch、xml2`. +目前包含了这些库:`ass、bluray、dav1d、dvdread、dvdnav、ffmpeg、freetype、fribidi、harfbuzz、openssl、opus、unibreak、uavs3d、smb2、yuv、soundtouch、xml2、webp`. ## 支持的平台 @@ -39,7 +39,7 @@ MRFFToolChain 的构建产物是为 [fsplayer](https://github.com/debugly/fsplay - 适用于苹果的 FFmpeg4:openssl3、opus、bluray - 适用于苹果的 FFmpeg5:openssl3、opus、bluray、dav1d、dvdread、uavs3d - 适用于苹果的 FFmpeg6:openssl3、opus、bluray、dav1d、dvdread、uavs3d、smb2 -- 适用于苹果的 FFmpeg7:openssl3、opus、bluray、dav1d、dvdnav、uavs3d、smb2 +- 适用于苹果的 FFmpeg7:openssl3、opus、bluray、dav1d、dvdnav、uavs3d、smb2、webp - 适用于安卓的 FFmpeg4:openssl3、opus、bluray、soundtouch - 适用于安卓的 FFmpeg5:openssl3、opus、bluray、dav1d、dvdread、uavs3d、soundtouch - 适用于安卓的 FFmpeg6:openssl3、opus、bluray、dav1d、dvdread、uavs3d、smb2、soundtouch From 078e84e03b75cae3468309518c9b41f32644b650 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Fri, 10 Oct 2025 13:29:40 +0800 Subject: [PATCH 127/359] get the developer directory using xcode-select -p #14 --- .../arm64-ios-simulator.meson | 14 +++++------ configs/meson-crossfiles/arm64-ios.meson | 14 +++++------ configs/meson-crossfiles/arm64-macos.meson | 2 +- .../arm64-tvos-simulator.meson | 14 +++++------ configs/meson-crossfiles/arm64-tvos.meson | 14 +++++------ .../x86_64-ios-simulator.meson | 14 +++++------ configs/meson-crossfiles/x86_64-macos.meson | 2 +- .../x86_64-tvos-simulator.meson | 14 +++++------ do-compile/apple/meson-compatible.sh | 25 +++++++++++++------ tools/export-apple-build-env.sh | 11 +++++--- 10 files changed, 68 insertions(+), 56 deletions(-) diff --git a/configs/meson-crossfiles/arm64-ios-simulator.meson b/configs/meson-crossfiles/arm64-ios-simulator.meson index 157dbba8d..0c22c5c91 100644 --- a/configs/meson-crossfiles/arm64-ios-simulator.meson +++ b/configs/meson-crossfiles/arm64-ios-simulator.meson @@ -11,15 +11,15 @@ strip = 'strip' pkgconfig = 'pkg-config' [built-in options] -c_args = ['-arch', 'arm64', '-mios-simulator-version-min=9.0', '-Os', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk'] -cpp_args = ['-arch', 'arm64', '-mios-simulator-version-min=9.0', '-Os', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk'] -c_link_args = ['-arch', 'arm64', '-mios-simulator-version-min=9.0', '-Os', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk'] -cpp_link_args = ['-arch', 'arm64', '-mios-simulator-version-min=9.0', '-Os', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk'] -objc_args = ['-arch', 'arm64', '-mios-simulator-version-min=9.0', '-Os', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk'] -objcpp_args = ['-arch', 'arm64', '-mios-simulator-version-min=9.0', '-Os', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk'] +c_args = ['-arch', 'arm64', '-mios-simulator-version-min=9.0', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk'] +cpp_args = ['-arch', 'arm64', '-mios-simulator-version-min=9.0', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk'] +c_link_args = ['-arch', 'arm64', '-mios-simulator-version-min=9.0', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk'] +cpp_link_args = ['-arch', 'arm64', '-mios-simulator-version-min=9.0', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk'] +objc_args = ['-arch', 'arm64', '-mios-simulator-version-min=9.0', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk'] +objcpp_args = ['-arch', 'arm64', '-mios-simulator-version-min=9.0', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk'] [properties] -root = '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer' +root = '__XCODE_DEVELOPER/Platforms/iPhoneSimulator.platform/Developer' has_function_printf = true has_function_hfkerhisadf = false has_function_posix_memalign = true diff --git a/configs/meson-crossfiles/arm64-ios.meson b/configs/meson-crossfiles/arm64-ios.meson index 22e1278e0..daf9dc712 100644 --- a/configs/meson-crossfiles/arm64-ios.meson +++ b/configs/meson-crossfiles/arm64-ios.meson @@ -10,15 +10,15 @@ strip = 'strip' pkgconfig = 'pkg-config' [built-in options] -c_args = ['-arch', 'arm64', '-miphoneos-version-min=9.0', '-Os', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk'] -cpp_args = ['-arch', 'arm64', '-miphoneos-version-min=9.0', '-Os', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk'] -c_link_args = ['-arch', 'arm64', '-miphoneos-version-min=9.0', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk'] -cpp_link_args = ['-arch', 'arm64', '-miphoneos-version-min=9.0', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk'] -objc_args = ['-arch', 'arm64', '-miphoneos-version-min=9.0', '-Os', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk'] -objcpp_args = ['-arch', 'arm64', '-miphoneos-version-min=9.0', '-Os', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk'] +c_args = ['-arch', 'arm64', '-miphoneos-version-min=9.0', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk'] +cpp_args = ['-arch', 'arm64', '-miphoneos-version-min=9.0', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk'] +c_link_args = ['-arch', 'arm64', '-miphoneos-version-min=9.0', '-isysroot', '__XCODE_DEVELOPER/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk'] +cpp_link_args = ['-arch', 'arm64', '-miphoneos-version-min=9.0', '-isysroot', '__XCODE_DEVELOPER/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk'] +objc_args = ['-arch', 'arm64', '-miphoneos-version-min=9.0', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk'] +objcpp_args = ['-arch', 'arm64', '-miphoneos-version-min=9.0', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk'] [properties] -root = '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer' +root = '__XCODE_DEVELOPER/Platforms/iPhoneOS.platform/Developer' has_function_printf = true has_function_hfkerhisadf = false has_function_posix_memalign = true diff --git a/configs/meson-crossfiles/arm64-macos.meson b/configs/meson-crossfiles/arm64-macos.meson index 7badcb922..5ebc26c10 100644 --- a/configs/meson-crossfiles/arm64-macos.meson +++ b/configs/meson-crossfiles/arm64-macos.meson @@ -18,7 +18,7 @@ objc_args = ['-arch', 'arm64', '-mmacosx-version-min=10.11', '-Os'] objcpp_args = ['-arch', 'arm64', '-mmacosx-version-min=10.11', '-Os'] [properties] -root = '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer' +root = '__XCODE_DEVELOPER/Platforms/MacOSX.platform/Developer' has_function_printf = true has_function_hfkerhisadf = false has_function_posix_memalign = true diff --git a/configs/meson-crossfiles/arm64-tvos-simulator.meson b/configs/meson-crossfiles/arm64-tvos-simulator.meson index 8bec47b41..560da2f96 100644 --- a/configs/meson-crossfiles/arm64-tvos-simulator.meson +++ b/configs/meson-crossfiles/arm64-tvos-simulator.meson @@ -10,15 +10,15 @@ strip = 'strip' pkgconfig = 'pkg-config' [built-in options] -c_args = ['-arch', 'arm64', '-mtvos-simulator-version-min=12.0', '-Os', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk'] -cpp_args = ['-arch', 'arm64', '-mtvos-simulator-version-min=12.0', '-Os', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk'] -c_link_args = ['-arch', 'arm64', '-mtvos-simulator-version-min=12.0', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk'] -cpp_link_args = ['-arch', 'arm64', '-mtvos-simulator-version-min=12.0', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk'] -objc_args = ['-arch', 'arm64', '-mtvos-simulator-version-min=12.0', '-Os', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk'] -objcpp_args = ['-arch', 'arm64', '-mtvos-simulator-version-min=12.0', '-Os', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk'] +c_args = ['-arch', 'arm64', '-mtvos-simulator-version-min=12.0', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk'] +cpp_args = ['-arch', 'arm64', '-mtvos-simulator-version-min=12.0', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk'] +c_link_args = ['-arch', 'arm64', '-mtvos-simulator-version-min=12.0', '-isysroot', '__XCODE_DEVELOPER/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk'] +cpp_link_args = ['-arch', 'arm64', '-mtvos-simulator-version-min=12.0', '-isysroot', '__XCODE_DEVELOPER/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk'] +objc_args = ['-arch', 'arm64', '-mtvos-simulator-version-min=12.0', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk'] +objcpp_args = ['-arch', 'arm64', '-mtvos-simulator-version-min=12.0', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk'] [properties] -root = '/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer' +root = '__XCODE_DEVELOPER/Platforms/AppleTVSimulator.platform/Developer' has_function_printf = true has_function_hfkerhisadf = false has_function_posix_memalign = true diff --git a/configs/meson-crossfiles/arm64-tvos.meson b/configs/meson-crossfiles/arm64-tvos.meson index 460b78cb6..fc7a82cf0 100644 --- a/configs/meson-crossfiles/arm64-tvos.meson +++ b/configs/meson-crossfiles/arm64-tvos.meson @@ -10,15 +10,15 @@ strip = 'strip' pkgconfig = 'pkg-config' [built-in options] -c_args = ['-arch', 'arm64', '-mtvos-version-min=12.0', '-Os', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk'] -cpp_args = ['-arch', 'arm64', '-mtvos-version-min=12.0', '-Os', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk'] -c_link_args = ['-arch', 'arm64', '-mtvos-version-min=12.0', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk'] -cpp_link_args = ['-arch', 'arm64', '-mtvos-version-min=12.0', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk'] -objc_args = ['-arch', 'arm64', '-mtvos-version-min=12.0', '-Os', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk'] -objcpp_args = ['-arch', 'arm64', '-mtvos-version-min=12.0', '-Os', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk'] +c_args = ['-arch', 'arm64', '-mtvos-version-min=12.0', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk'] +cpp_args = ['-arch', 'arm64', '-mtvos-version-min=12.0', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk'] +c_link_args = ['-arch', 'arm64', '-mtvos-version-min=12.0', '-isysroot', '__XCODE_DEVELOPER/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk'] +cpp_link_args = ['-arch', 'arm64', '-mtvos-version-min=12.0', '-isysroot', '__XCODE_DEVELOPER/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk'] +objc_args = ['-arch', 'arm64', '-mtvos-version-min=12.0', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk'] +objcpp_args = ['-arch', 'arm64', '-mtvos-version-min=12.0', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk'] [properties] -root = '/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer' +root = '__XCODE_DEVELOPER/Platforms/AppleTVOS.platform/Developer' has_function_printf = true has_function_hfkerhisadf = false has_function_posix_memalign = true diff --git a/configs/meson-crossfiles/x86_64-ios-simulator.meson b/configs/meson-crossfiles/x86_64-ios-simulator.meson index eb5786482..205dd0998 100644 --- a/configs/meson-crossfiles/x86_64-ios-simulator.meson +++ b/configs/meson-crossfiles/x86_64-ios-simulator.meson @@ -10,15 +10,15 @@ strip = 'strip' pkgconfig = 'pkg-config' [built-in options] -c_args = ['-arch', 'x86_64', '-mios-simulator-version-min=9.0', '-Os', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk'] -cpp_args = ['-arch', 'x86_64', '-mios-simulator-version-min=9.0', '-Os', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk'] -c_link_args = ['-arch', 'x86_64', '-mios-simulator-version-min=9.0', '-Os', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk'] -cpp_link_args = ['-arch', 'x86_64', '-mios-simulator-version-min=9.0', '-Os', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk'] -objc_args = ['-arch', 'x86_64', '-mios-simulator-version-min=9.0', '-Os', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk'] -objcpp_args = ['-arch', 'x86_64', '-mios-simulator-version-min=9.0', '-Os', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk'] +c_args = ['-arch', 'x86_64', '-mios-simulator-version-min=9.0', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk'] +cpp_args = ['-arch', 'x86_64', '-mios-simulator-version-min=9.0', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk'] +c_link_args = ['-arch', 'x86_64', '-mios-simulator-version-min=9.0', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk'] +cpp_link_args = ['-arch', 'x86_64', '-mios-simulator-version-min=9.0', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk'] +objc_args = ['-arch', 'x86_64', '-mios-simulator-version-min=9.0', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk'] +objcpp_args = ['-arch', 'x86_64', '-mios-simulator-version-min=9.0', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk'] [properties] -root = '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer' +root = '__XCODE_DEVELOPER/Platforms/iPhoneSimulator.platform/Developer' has_function_printf = true has_function_hfkerhisadf = false has_function_posix_memalign = true diff --git a/configs/meson-crossfiles/x86_64-macos.meson b/configs/meson-crossfiles/x86_64-macos.meson index e16585d42..6920d2555 100644 --- a/configs/meson-crossfiles/x86_64-macos.meson +++ b/configs/meson-crossfiles/x86_64-macos.meson @@ -18,7 +18,7 @@ objc_args = ['-arch', 'x86_64', '-mmacosx-version-min=10.11', '-Os'] objcpp_args = ['-arch', 'x86_64', '-mmacosx-version-min=10.11', '-Os'] [properties] -root = '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer' +root = '__XCODE_DEVELOPER/Platforms/MacOSX.platform/Developer' has_function_printf = true has_function_hfkerhisadf = false has_function_posix_memalign = true diff --git a/configs/meson-crossfiles/x86_64-tvos-simulator.meson b/configs/meson-crossfiles/x86_64-tvos-simulator.meson index a4afe59f5..e4089ad00 100644 --- a/configs/meson-crossfiles/x86_64-tvos-simulator.meson +++ b/configs/meson-crossfiles/x86_64-tvos-simulator.meson @@ -10,15 +10,15 @@ strip = 'strip' pkgconfig = 'pkg-config' [built-in options] -c_args = ['-arch', 'x86_64', '-mtvos-simulator-version-min=12.0', '-Os', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk'] -cpp_args = ['-arch', 'x86_64', '-mtvos-simulator-version-min=12.0', '-Os', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk'] -c_link_args = ['-arch', 'x86_64', '-mtvos-simulator-version-min=12.0', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk'] -cpp_link_args = ['-arch', 'x86_64', '-mtvos-simulator-version-min=12.0', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk'] -objc_args = ['-arch', 'x86_64', '-mtvos-simulator-version-min=12.0', '-Os', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk'] -objcpp_args = ['-arch', 'x86_64', '-mtvos-simulator-version-min=12.0', '-Os', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk'] +c_args = ['-arch', 'x86_64', '-mtvos-simulator-version-min=12.0', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk'] +cpp_args = ['-arch', 'x86_64', '-mtvos-simulator-version-min=12.0', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk'] +c_link_args = ['-arch', 'x86_64', '-mtvos-simulator-version-min=12.0', '-isysroot', '__XCODE_DEVELOPER/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk'] +cpp_link_args = ['-arch', 'x86_64', '-mtvos-simulator-version-min=12.0', '-isysroot', '__XCODE_DEVELOPER/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk'] +objc_args = ['-arch', 'x86_64', '-mtvos-simulator-version-min=12.0', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk'] +objcpp_args = ['-arch', 'x86_64', '-mtvos-simulator-version-min=12.0', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk'] [properties] -root = '/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer' +root = '__XCODE_DEVELOPER/Platforms/AppleTVSimulator.platform/Developer' has_function_printf = true has_function_hfkerhisadf = false has_function_posix_memalign = true diff --git a/do-compile/apple/meson-compatible.sh b/do-compile/apple/meson-compatible.sh index 67ae2919c..97240c71c 100755 --- a/do-compile/apple/meson-compatible.sh +++ b/do-compile/apple/meson-compatible.sh @@ -39,14 +39,27 @@ fi export CC="$MR_CC" export CXX="$MR_CXX" +cd $MR_BUILD_SOURCE +build=./meson_wksp +rm -rf $build +mkdir -p $build + +cross_file= if [[ $(uname -m) != "$MR_ARCH" || "$MR_FORCE_CROSS" ]]; then if [[ $MR_IS_SIMULATOR == 1 ]]; then - echo "[*] cross compile, on $(uname -m) compile $MR_PLAT $MR_ARCH simulator." - CFG_FLAGS="$CFG_FLAGS --cross-file $MR_SHELL_CONFIGS_DIR/meson-crossfiles/$MR_ARCH-$MR_PLAT-simulator.meson" + raw_cross_file="$MR_SHELL_CONFIGS_DIR/meson-crossfiles/$MR_ARCH-$MR_PLAT-simulator.meson" else - echo "[*] cross compile, on $(uname -m) compile $MR_PLAT $MR_ARCH." - CFG_FLAGS="$CFG_FLAGS --cross-file $MR_SHELL_CONFIGS_DIR/meson-crossfiles/$MR_ARCH-$MR_PLAT.meson" + raw_cross_file="$MR_SHELL_CONFIGS_DIR/meson-crossfiles/$MR_ARCH-$MR_PLAT.meson" fi + + cross_file=$build/meson-crossfile.meson + touch "$cross_file" + cat "$raw_cross_file" > "$cross_file" + + my_sed_i "s|__XCODE_DEVELOPER|$MR_XCODE_DEVELOPER|" "$cross_file" + + echo "[*] using cross compile, cross file: $cross_file" + CFG_FLAGS="$CFG_FLAGS --cross-file $cross_file" fi CFG_FLAGS="$CFG_FLAGS $MESON_OTHER_FLAGS" @@ -58,10 +71,6 @@ echo "CFG_FLAGS: $CFG_FLAGS" echo "----------------------" echo -cd $MR_BUILD_SOURCE -build=./meson_wksp -rm -rf $build - meson setup $build $CFG_FLAGS cd $build diff --git a/tools/export-apple-build-env.sh b/tools/export-apple-build-env.sh index 0e47bdc85..3a4eb6329 100755 --- a/tools/export-apple-build-env.sh +++ b/tools/export-apple-build-env.sh @@ -16,9 +16,9 @@ # #https://stackoverflow.com/questions/59895/how-do-i-get-the-directory-where-a-bash-script-is-located-from-within-the-script -XCRUN_DEVELOPER=`xcode-select -print-path` -if [ ! -d "$XCRUN_DEVELOPER" ]; then - echo "xcode path is not set correctly $XCRUN_DEVELOPER does not exist (most likely because of xcode > 4.3)" +XCODE_DEVELOPER=`xcode-select -print-path` +if [ ! -d "$XCODE_DEVELOPER" ]; then + echo "xcode path is not set correctly $XCODE_DEVELOPER does not exist (most likely because of xcode > 4.3)" echo "run" echo "sudo xcode-select -switch " echo "for default installation:" @@ -26,13 +26,16 @@ if [ ! -d "$XCRUN_DEVELOPER" ]; then exit 1 fi -case $XCRUN_DEVELOPER in +case $XCODE_DEVELOPER in *\ * ) echo "Your Xcode path contains whitespaces, which is not supported." exit 1 ;; esac +# /Applications/Xcode.app/Contents/Developer +export MR_XCODE_DEVELOPER="$XCODE_DEVELOPER" + echo $(xcodebuild -version) if [[ "$MR_PLAT" == 'ios' ]]; then From 4b1b72b1a9a340d96854989c2bccae2558892189 Mon Sep 17 00:00:00 2001 From: Mark Borazio Date: Thu, 16 Oct 2025 11:38:47 +1100 Subject: [PATCH 128/359] Add g726le and g726be decoders --- configs/ffconfig/module-full.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configs/ffconfig/module-full.sh b/configs/ffconfig/module-full.sh index 01c49b3b6..fc93d54ad 100755 --- a/configs/ffconfig/module-full.sh +++ b/configs/ffconfig/module-full.sh @@ -202,6 +202,8 @@ export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-decoder=adpcm_ea_r2" export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-decoder=adpcm_ea_r3" export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-decoder=adpcm_ea_xas" export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-decoder=adpcm_g726" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-decoder=adpcm_g726le" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-decoder=adpcm_g726be" export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-decoder=adpcm_ima_amv" export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-decoder=adpcm_ima_apc" export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-decoder=adpcm_ima_dat4" From cc0ce95fb1c0e7a8cc9995e9494aac4d8cf68793 Mon Sep 17 00:00:00 2001 From: Anka Date: Sun, 19 Oct 2025 03:25:03 +0000 Subject: [PATCH 129/359] upgrade ffmpeg7 to ffmpeg7-7.1.1-251019110740 for apple by cd --- configs/libs/ffmpeg7.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configs/libs/ffmpeg7.sh b/configs/libs/ffmpeg7.sh index 2fb2c745e..805b21b64 100644 --- a/configs/libs/ffmpeg7.sh +++ b/configs/libs/ffmpeg7.sh @@ -37,8 +37,8 @@ export GIT_REPO_VERSION=7.1.1 # pre compiled -export PRE_COMPILE_TAG_TVOS=ffmpeg7-7.1.1-251009154600 -export PRE_COMPILE_TAG_MACOS=ffmpeg7-7.1.1-251009154600 -export PRE_COMPILE_TAG_IOS=ffmpeg7-7.1.1-251009154600 +export PRE_COMPILE_TAG_TVOS=ffmpeg7-7.1.1-251019110740 +export PRE_COMPILE_TAG_MACOS=ffmpeg7-7.1.1-251019110740 +export PRE_COMPILE_TAG_IOS=ffmpeg7-7.1.1-251019110740 export PRE_COMPILE_TAG_ANDROID=ffmpeg7-7.1.1-250606143631 From 97c017b53f690fdab916a8f8cf7fad40133bf763 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Wed, 3 Dec 2025 12:38:02 +0800 Subject: [PATCH 130/359] libyuv use latest main branch --- configs/libs/yuv.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configs/libs/yuv.sh b/configs/libs/yuv.sh index 560bf0abb..dcee34b1c 100644 --- a/configs/libs/yuv.sh +++ b/configs/libs/yuv.sh @@ -22,9 +22,9 @@ export LIPO_LIBS="libyuv" export LIB_DEPENDS_BIN="cmake" export CMAKE_TARGETS_NAME=yuv export GIT_LOCAL_REPO=extra/yuv -export GIT_COMMIT=eb6e7bb +export GIT_COMMIT=4825d9b export REPO_DIR=yuv -export GIT_REPO_VERSION=stable-eb6e7bb +export GIT_REPO_VERSION=main-4825d9b export PATCH_DIR=yuv # you can export GIT_YUV_UPSTREAM=git@xx:yy/yuv.git use your mirror From 7aa4c24486a40031d94d5d904cd242324da1b5d1 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Wed, 3 Dec 2025 14:21:58 +0800 Subject: [PATCH 131/359] add patch for libyuv --- configs/libs/yuv.sh | 2 +- ...-skip-binary-and-shared-lib-and-jpeg.patch | 67 +++++++++++++++++++ 2 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 patches/yuv-main/0001-skip-binary-and-shared-lib-and-jpeg.patch diff --git a/configs/libs/yuv.sh b/configs/libs/yuv.sh index dcee34b1c..975625298 100644 --- a/configs/libs/yuv.sh +++ b/configs/libs/yuv.sh @@ -25,7 +25,7 @@ export GIT_LOCAL_REPO=extra/yuv export GIT_COMMIT=4825d9b export REPO_DIR=yuv export GIT_REPO_VERSION=main-4825d9b -export PATCH_DIR=yuv +export PATCH_DIR=yuv-main # you can export GIT_YUV_UPSTREAM=git@xx:yy/yuv.git use your mirror if [[ "$GIT_YUV_UPSTREAM" != "" ]] ;then diff --git a/patches/yuv-main/0001-skip-binary-and-shared-lib-and-jpeg.patch b/patches/yuv-main/0001-skip-binary-and-shared-lib-and-jpeg.patch new file mode 100644 index 000000000..44468dbda --- /dev/null +++ b/patches/yuv-main/0001-skip-binary-and-shared-lib-and-jpeg.patch @@ -0,0 +1,67 @@ +From b8d80e06d1a36cce5b807dac82b479d6cfe5f760 Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Wed, 3 Dec 2025 12:50:07 +0800 +Subject: [PATCH] skip binary and shared lib and jpeg + +--- + CMakeLists.txt | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 77e0527..ef5af28 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -5,6 +5,7 @@ + cmake_minimum_required( VERSION 3.16 ) + project ( YUV C CXX ) # "C" is required even for C++ projects + option( UNIT_TEST "Built unit tests" OFF ) ++OPTION( BINARY "Built binary" OFF ) + + include(CheckCSourceCompiles) + +@@ -172,6 +173,7 @@ endif() + # this creates the static library (.a) + add_library( ${ly_lib_static} STATIC ${ly_lib_parts}) + ++if(BUILD_SHARED_LIBS) + # this creates the shared library (.so) + add_library( ${ly_lib_shared} SHARED ${ly_lib_parts}) + set_target_properties( ${ly_lib_shared} PROPERTIES OUTPUT_NAME "${ly_lib_name}" ) +@@ -179,7 +181,9 @@ set_target_properties( ${ly_lib_shared} PROPERTIES PREFIX "lib" ) + if(WIN32) + set_target_properties( ${ly_lib_shared} PROPERTIES IMPORT_PREFIX "lib" ) + endif() ++endif() + ++if(BINARY) + # this creates the cpuid tool + add_executable ( cpuid ${ly_base_dir}/util/cpuid.c ) + target_link_libraries ( cpuid ${ly_lib_static} ) +@@ -198,6 +202,7 @@ if (JPEG_FOUND) + target_link_libraries( ${ly_lib_shared} ${JPEG_LIBRARY} ) + add_definitions( -DHAVE_JPEG ) + endif() ++endif() + + if(UNIT_TEST) + find_library(GTEST_LIBRARY gtest) +@@ -241,10 +246,16 @@ if(UNIT_TEST) + endif() + + ++if(BINARY) ++message("The BINARY option is enabled.") + # install the conversion tool, .so, .a, and all the header files + install ( TARGETS yuvconvert DESTINATION bin ) ++endif() + install ( TARGETS ${ly_lib_static} DESTINATION lib ) ++if(BUILD_SHARED_LIBS) ++message("The BUILD_SHARED_LIBS option is enabled.") + install ( TARGETS ${ly_lib_shared} LIBRARY DESTINATION lib RUNTIME DESTINATION bin ARCHIVE DESTINATION lib ) ++endif() + install ( DIRECTORY ${PROJECT_SOURCE_DIR}/include/ DESTINATION include ) + + # create the .deb and .rpm packages using cpack +-- +2.50.1 (Apple Git-155) + From 64a190e76cabcf69ca2f8e2328e0e8f7330cd0e3 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Thu, 4 Dec 2025 09:14:05 +0800 Subject: [PATCH 132/359] add ffmpeg7 draft patch --- .../0033-add-AV1-hardware-acceleration.patch | 271 ++++++++++++++++++ 1 file changed, 271 insertions(+) create mode 100644 patches/ffmpeg-n7.1.1/draft/0033-add-AV1-hardware-acceleration.patch diff --git a/patches/ffmpeg-n7.1.1/draft/0033-add-AV1-hardware-acceleration.patch b/patches/ffmpeg-n7.1.1/draft/0033-add-AV1-hardware-acceleration.patch new file mode 100644 index 000000000..ba9e30430 --- /dev/null +++ b/patches/ffmpeg-n7.1.1/draft/0033-add-AV1-hardware-acceleration.patch @@ -0,0 +1,271 @@ +From a9770e475398405ad4e91cb73369bf0e6a929e9f Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Mon, 13 Oct 2025 14:17:36 +0800 +Subject: [PATCH] add AV1 hardware acceleration + +--- + configure | 4 ++ + libavcodec/Makefile | 1 + + libavcodec/av1dec.c | 10 ++++ + libavcodec/hwaccels.h | 1 + + libavcodec/videotoolbox.c | 14 +++++ + libavcodec/videotoolbox_av1.c | 99 +++++++++++++++++++++++++++++++++++ + libavcodec/vt_internal.h | 1 + + 7 files changed, 130 insertions(+) + create mode 100644 libavcodec/videotoolbox_av1.c + +diff --git a/configure b/configure +index fc5e423..9c56a4c 100755 +--- a/configure ++++ b/configure +@@ -2463,6 +2463,7 @@ TYPES_LIST=" + kCMVideoCodecType_HEVC + kCMVideoCodecType_HEVCWithAlpha + kCMVideoCodecType_VP9 ++ kCMVideoCodecType_AV1 + kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange + kCVPixelFormatType_422YpCbCr8BiPlanarVideoRange + kCVPixelFormatType_422YpCbCr10BiPlanarVideoRange +@@ -3168,6 +3169,8 @@ av1_vaapi_hwaccel_deps="vaapi VADecPictureParameterBufferAV1_bit_depth_idx" + av1_vaapi_hwaccel_select="av1_decoder" + av1_vdpau_hwaccel_deps="vdpau VdpPictureInfoAV1" + av1_vdpau_hwaccel_select="av1_decoder" ++av1_videotoolbox_hwaccel_deps="videotoolbox" ++av1_videotoolbox_hwaccel_select="av1_decoder" + av1_vulkan_hwaccel_deps="vulkan" + av1_vulkan_hwaccel_select="av1_decoder" + h263_vaapi_hwaccel_deps="vaapi" +@@ -6700,6 +6703,7 @@ enabled videotoolbox && { + check_func_headers CoreMedia/CMFormatDescription.h kCMVideoCodecType_HEVC "-framework CoreMedia" + check_func_headers CoreMedia/CMFormatDescription.h kCMVideoCodecType_HEVCWithAlpha "-framework CoreMedia" + check_func_headers CoreMedia/CMFormatDescription.h kCMVideoCodecType_VP9 "-framework CoreMedia" ++ check_func_headers CoreMedia/CMFormatDescription.h kCMVideoCodecType_AV1 "-framework CoreMedia" + check_func_headers CoreVideo/CVPixelBuffer.h kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange "-framework CoreVideo" + check_func_headers CoreVideo/CVPixelBuffer.h kCVPixelFormatType_422YpCbCr8BiPlanarVideoRange "-framework CoreVideo" + check_func_headers CoreVideo/CVPixelBuffer.h kCVPixelFormatType_422YpCbCr10BiPlanarVideoRange "-framework CoreVideo" +diff --git a/libavcodec/Makefile b/libavcodec/Makefile +index 441d4ee..d74c06b 100644 +--- a/libavcodec/Makefile ++++ b/libavcodec/Makefile +@@ -1010,6 +1010,7 @@ OBJS-$(CONFIG_AV1_D3D12VA_HWACCEL) += dxva2_av1.o d3d12va_av1.o + OBJS-$(CONFIG_AV1_NVDEC_HWACCEL) += nvdec_av1.o + OBJS-$(CONFIG_AV1_VAAPI_HWACCEL) += vaapi_av1.o + OBJS-$(CONFIG_AV1_VDPAU_HWACCEL) += vdpau_av1.o ++OBJS-$(CONFIG_AV1_VIDEOTOOLBOX_HWACCEL) += videotoolbox_av1.o + OBJS-$(CONFIG_AV1_VULKAN_HWACCEL) += vulkan_decode.o vulkan_av1.o + OBJS-$(CONFIG_H263_VAAPI_HWACCEL) += vaapi_mpeg4.o + OBJS-$(CONFIG_H263_VIDEOTOOLBOX_HWACCEL) += videotoolbox.o +diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c +index 1d5b9ef..0fad09a 100644 +--- a/libavcodec/av1dec.c ++++ b/libavcodec/av1dec.c +@@ -541,6 +541,7 @@ static int get_pixel_format(AVCodecContext *avctx) + CONFIG_AV1_NVDEC_HWACCEL + \ + CONFIG_AV1_VAAPI_HWACCEL + \ + CONFIG_AV1_VDPAU_HWACCEL + \ ++ CONFIG_AV1_VIDEOTOOLBOX_HWACCEL + \ + CONFIG_AV1_VULKAN_HWACCEL) + enum AVPixelFormat pix_fmts[HWACCEL_MAX + 2], *fmtp = pix_fmts; + +@@ -568,6 +569,9 @@ static int get_pixel_format(AVCodecContext *avctx) + #if CONFIG_AV1_VDPAU_HWACCEL + *fmtp++ = AV_PIX_FMT_VDPAU; + #endif ++#if CONFIG_AV1_VIDEOTOOLBOX_HWACCEL ++ *fmtp++ = AV_PIX_FMT_VIDEOTOOLBOX; ++#endif + #if CONFIG_AV1_VULKAN_HWACCEL + *fmtp++ = AV_PIX_FMT_VULKAN; + #endif +@@ -592,6 +596,9 @@ static int get_pixel_format(AVCodecContext *avctx) + #if CONFIG_AV1_VDPAU_HWACCEL + *fmtp++ = AV_PIX_FMT_VDPAU; + #endif ++#if CONFIG_AV1_VIDEOTOOLBOX_HWACCEL ++ *fmtp++ = AV_PIX_FMT_VIDEOTOOLBOX; ++#endif + #if CONFIG_AV1_VULKAN_HWACCEL + *fmtp++ = AV_PIX_FMT_VULKAN; + #endif +@@ -1594,6 +1601,9 @@ const FFCodec ff_av1_decoder = { + #if CONFIG_AV1_VDPAU_HWACCEL + HWACCEL_VDPAU(av1), + #endif ++#if CONFIG_AV1_VIDEOTOOLBOX_HWACCEL ++ HWACCEL_VIDEOTOOLBOX(av1), ++#endif + #if CONFIG_AV1_VULKAN_HWACCEL + HWACCEL_VULKAN(av1), + #endif +diff --git a/libavcodec/hwaccels.h b/libavcodec/hwaccels.h +index 5171e4c..2b9bdc8 100644 +--- a/libavcodec/hwaccels.h ++++ b/libavcodec/hwaccels.h +@@ -26,6 +26,7 @@ extern const struct FFHWAccel ff_av1_dxva2_hwaccel; + extern const struct FFHWAccel ff_av1_nvdec_hwaccel; + extern const struct FFHWAccel ff_av1_vaapi_hwaccel; + extern const struct FFHWAccel ff_av1_vdpau_hwaccel; ++extern const struct FFHWAccel ff_av1_videotoolbox_hwaccel; + extern const struct FFHWAccel ff_av1_vulkan_hwaccel; + extern const struct FFHWAccel ff_h263_vaapi_hwaccel; + extern const struct FFHWAccel ff_h263_videotoolbox_hwaccel; +diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c +index 505483e..392d7fb 100644 +--- a/libavcodec/videotoolbox.c ++++ b/libavcodec/videotoolbox.c +@@ -56,6 +56,10 @@ enum { kCMVideoCodecType_HEVC = 'hvc1' }; + enum { kCMVideoCodecType_VP9 = 'vp09' }; + #endif + ++#if !HAVE_KCMVIDEOCODECTYPE_AV1 ++enum { kCMVideoCodecType_AV1 = 'av01' }; ++#endif ++ + #define VIDEOTOOLBOX_ESDS_EXTRADATA_PADDING 12 + + typedef struct VTHWFrame { +@@ -846,6 +850,13 @@ static CFDictionaryRef videotoolbox_decoder_config_create(CMVideoCodecType codec + if (data) + CFDictionarySetValue(avc_info, CFSTR("vpcC"), data); + break; ++#endif ++#if CONFIG_AV1_VIDEOTOOLBOX_HWACCEL ++ case kCMVideoCodecType_AV1 : ++ data = ff_videotoolbox_av1c_extradata_create(avctx); ++ if (data) ++ CFDictionarySetValue(avc_info, CFSTR("av1C"), data); ++ break; + #endif + default: + break; +@@ -912,6 +923,9 @@ static int videotoolbox_start(AVCodecContext *avctx) + case AV_CODEC_ID_VP9 : + videotoolbox->cm_codec_type = kCMVideoCodecType_VP9; + break; ++ case AV_CODEC_ID_AV1 : ++ videotoolbox->cm_codec_type = kCMVideoCodecType_AV1; ++ break; + default : + break; + } +diff --git a/libavcodec/videotoolbox_av1.c b/libavcodec/videotoolbox_av1.c +new file mode 100644 +index 0000000..4bf0c73 +--- /dev/null ++++ b/libavcodec/videotoolbox_av1.c +@@ -0,0 +1,99 @@ ++/* ++ * Videotoolbox hardware acceleration for AV1 ++ * Copyright (c) 2023 Jan Ekström ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#include "libavformat/avio.h" ++#include "libavformat/avio_internal.h" ++#define CALLED_FROM_AVCODEC 1 ++#include "libavformat/av1.c" ++#undef CALLED_FROM_AVCODEC ++ ++#include "libavutil/avutil.h" ++#include "libavutil/frame.h" ++#include "libavutil/pixfmt.h" ++ ++#include "av1dec.h" ++#include "codec_id.h" ++#include "hwaccel_internal.h" ++#include "internal.h" ++#include "vt_internal.h" ++ ++CFDataRef ff_videotoolbox_av1c_extradata_create(AVCodecContext *avctx) ++{ ++ AVIOContext *pb; ++ uint8_t *buf; ++ CFDataRef data = NULL; ++ int buf_size = 0; ++ int ret = avio_open_dyn_buf(&pb); ++ if (ret < 0) ++ return NULL; ++ ++ ret = ff_isom_write_av1c(pb, avctx->extradata, avctx->extradata_size, 1); ++ if (ret < 0) ++ goto fail; ++ ++ buf_size = avio_get_dyn_buf(pb, &buf); ++ if (buf_size) ++ data = CFDataCreate(kCFAllocatorDefault, buf, buf_size); ++ ++fail: ++ ffio_free_dyn_buf(&pb); ++ ++ return data; ++} ++ ++static int videotoolbox_av1_start_frame(AVCodecContext *avctx, ++ const uint8_t *buffer, ++ uint32_t size) ++{ ++ return 0; ++} ++ ++static int videotoolbox_av1_decode_slice(AVCodecContext *avctx, ++ const uint8_t *buffer, ++ uint32_t size) ++{ ++ VTContext *vtctx = avctx->internal->hwaccel_priv_data; ++ ++ return ff_videotoolbox_buffer_copy(vtctx, buffer, size); ++} ++ ++static int videotoolbox_av1_end_frame(AVCodecContext *avctx) ++{ ++ const AV1DecContext *s = avctx->priv_data; ++ AVFrame *frame = s->cur_frame.f; ++ ++ return ff_videotoolbox_common_end_frame(avctx, frame); ++} ++ ++const FFHWAccel ff_av1_videotoolbox_hwaccel = { ++ .p.name = "av1_videotoolbox", ++ .p.type = AVMEDIA_TYPE_VIDEO, ++ .p.id = AV_CODEC_ID_AV1, ++ .p.pix_fmt = AV_PIX_FMT_VIDEOTOOLBOX, ++ .alloc_frame = ff_videotoolbox_alloc_frame, ++ .start_frame = videotoolbox_av1_start_frame, ++ .decode_slice = videotoolbox_av1_decode_slice, ++ .end_frame = videotoolbox_av1_end_frame, ++ .frame_params = ff_videotoolbox_frame_params, ++ .init = ff_videotoolbox_common_init, ++ .uninit = ff_videotoolbox_uninit, ++ .priv_data_size = sizeof(VTContext), ++}; +\ No newline at end of file +diff --git a/libavcodec/vt_internal.h b/libavcodec/vt_internal.h +index 9502d7c..427348f 100644 +--- a/libavcodec/vt_internal.h ++++ b/libavcodec/vt_internal.h +@@ -64,6 +64,7 @@ int ff_videotoolbox_h264_decode_slice(AVCodecContext *avctx, + const uint8_t *buffer, + uint32_t size); + int ff_videotoolbox_common_end_frame(AVCodecContext *avctx, AVFrame *frame); ++CFDataRef ff_videotoolbox_av1c_extradata_create(AVCodecContext *avctx); + CFDataRef ff_videotoolbox_avcc_extradata_create(AVCodecContext *avctx); + CFDataRef ff_videotoolbox_hvcc_extradata_create(AVCodecContext *avctx); + CFDataRef ff_videotoolbox_vpcc_extradata_create(AVCodecContext *avctx); +-- +2.39.5 (Apple Git-154) + From e4424cc294627e7fa95fa1a28a32b3a19758dbb6 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Mon, 8 Dec 2025 09:06:50 +0800 Subject: [PATCH 133/359] upgrade libyuv build patch --- configs/libs/yuv.sh | 16 ++++- ...-skip-binary-and-shared-lib-and-jpeg.patch | 67 ------------------- ...-skip-binary-and-shared-lib-and-jpeg.patch | 55 +++++++-------- 3 files changed, 38 insertions(+), 100 deletions(-) delete mode 100644 patches/yuv-main/0001-skip-binary-and-shared-lib-and-jpeg.patch diff --git a/configs/libs/yuv.sh b/configs/libs/yuv.sh index 975625298..ccd316b97 100644 --- a/configs/libs/yuv.sh +++ b/configs/libs/yuv.sh @@ -22,10 +22,20 @@ export LIPO_LIBS="libyuv" export LIB_DEPENDS_BIN="cmake" export CMAKE_TARGETS_NAME=yuv export GIT_LOCAL_REPO=extra/yuv -export GIT_COMMIT=4825d9b + +# ✅---------------- +# 4e8a843b 2024年4月1日 使用单个.a +# f94b8cf7 2024年4月8日 使用单个.a +# ❌---------------- +# b5a18f9d 2024年12月30日 使用多个.a +# efd164d6 2024年6月18日 使用多个.a +# 3af6cafe 2024年4月11日 使用多个.a +# e52007ef 2024年4月9日 中间编译报错 + +export GIT_COMMIT=f94b8cf7 export REPO_DIR=yuv -export GIT_REPO_VERSION=main-4825d9b -export PATCH_DIR=yuv-main +export GIT_REPO_VERSION=main-f94b8cf7 +export PATCH_DIR=yuv # you can export GIT_YUV_UPSTREAM=git@xx:yy/yuv.git use your mirror if [[ "$GIT_YUV_UPSTREAM" != "" ]] ;then diff --git a/patches/yuv-main/0001-skip-binary-and-shared-lib-and-jpeg.patch b/patches/yuv-main/0001-skip-binary-and-shared-lib-and-jpeg.patch deleted file mode 100644 index 44468dbda..000000000 --- a/patches/yuv-main/0001-skip-binary-and-shared-lib-and-jpeg.patch +++ /dev/null @@ -1,67 +0,0 @@ -From b8d80e06d1a36cce5b807dac82b479d6cfe5f760 Mon Sep 17 00:00:00 2001 -From: qianlongxu -Date: Wed, 3 Dec 2025 12:50:07 +0800 -Subject: [PATCH] skip binary and shared lib and jpeg - ---- - CMakeLists.txt | 11 +++++++++++ - 1 file changed, 11 insertions(+) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 77e0527..ef5af28 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -5,6 +5,7 @@ - cmake_minimum_required( VERSION 3.16 ) - project ( YUV C CXX ) # "C" is required even for C++ projects - option( UNIT_TEST "Built unit tests" OFF ) -+OPTION( BINARY "Built binary" OFF ) - - include(CheckCSourceCompiles) - -@@ -172,6 +173,7 @@ endif() - # this creates the static library (.a) - add_library( ${ly_lib_static} STATIC ${ly_lib_parts}) - -+if(BUILD_SHARED_LIBS) - # this creates the shared library (.so) - add_library( ${ly_lib_shared} SHARED ${ly_lib_parts}) - set_target_properties( ${ly_lib_shared} PROPERTIES OUTPUT_NAME "${ly_lib_name}" ) -@@ -179,7 +181,9 @@ set_target_properties( ${ly_lib_shared} PROPERTIES PREFIX "lib" ) - if(WIN32) - set_target_properties( ${ly_lib_shared} PROPERTIES IMPORT_PREFIX "lib" ) - endif() -+endif() - -+if(BINARY) - # this creates the cpuid tool - add_executable ( cpuid ${ly_base_dir}/util/cpuid.c ) - target_link_libraries ( cpuid ${ly_lib_static} ) -@@ -198,6 +202,7 @@ if (JPEG_FOUND) - target_link_libraries( ${ly_lib_shared} ${JPEG_LIBRARY} ) - add_definitions( -DHAVE_JPEG ) - endif() -+endif() - - if(UNIT_TEST) - find_library(GTEST_LIBRARY gtest) -@@ -241,10 +246,16 @@ if(UNIT_TEST) - endif() - - -+if(BINARY) -+message("The BINARY option is enabled.") - # install the conversion tool, .so, .a, and all the header files - install ( TARGETS yuvconvert DESTINATION bin ) -+endif() - install ( TARGETS ${ly_lib_static} DESTINATION lib ) -+if(BUILD_SHARED_LIBS) -+message("The BUILD_SHARED_LIBS option is enabled.") - install ( TARGETS ${ly_lib_shared} LIBRARY DESTINATION lib RUNTIME DESTINATION bin ARCHIVE DESTINATION lib ) -+endif() - install ( DIRECTORY ${PROJECT_SOURCE_DIR}/include/ DESTINATION include ) - - # create the .deb and .rpm packages using cpack --- -2.50.1 (Apple Git-155) - diff --git a/patches/yuv/0001-skip-binary-and-shared-lib-and-jpeg.patch b/patches/yuv/0001-skip-binary-and-shared-lib-and-jpeg.patch index 89f419861..c2c0aa233 100644 --- a/patches/yuv/0001-skip-binary-and-shared-lib-and-jpeg.patch +++ b/patches/yuv/0001-skip-binary-and-shared-lib-and-jpeg.patch @@ -1,71 +1,66 @@ -From adaf7690b34ade92e3cfb0af812ec8c534381b12 Mon Sep 17 00:00:00 2001 +From ec40a559327d80f3333c17a1f9e9c516bb073753 Mon Sep 17 00:00:00 2001 From: qianlongxu -Date: Tue, 14 Jan 2025 17:53:31 +0800 +Date: Thu, 4 Dec 2025 10:11:52 +0800 Subject: [PATCH] skip binary and shared lib and jpeg --- - CMakeLists.txt | 17 +++++++++++++++-- - 1 file changed, 15 insertions(+), 2 deletions(-) + CMakeLists.txt | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt -index 636531e..47b9759 100644 +index 9abfa74..898a6be 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,6 +5,7 @@ PROJECT ( YUV C CXX ) # "C" is required even for C++ projects - CMAKE_MINIMUM_REQUIRED( VERSION 2.8 ) - OPTION( TEST "Built unit tests" OFF ) + CMAKE_MINIMUM_REQUIRED( VERSION 2.8.12 ) + OPTION( UNIT_TEST "Built unit tests" OFF ) +OPTION( BINARY "Built binary" OFF ) SET ( ly_base_dir ${PROJECT_SOURCE_DIR} ) SET ( ly_src_dir ${ly_base_dir}/source ) -@@ -25,22 +26,26 @@ INCLUDE_DIRECTORIES( BEFORE ${ly_inc_dir} ) +@@ -29,6 +30,7 @@ endif() # this creates the static library (.a) ADD_LIBRARY ( ${ly_lib_static} STATIC ${ly_source_files} ) +if(BUILD_SHARED_LIBS) # this creates the shared library (.so) ADD_LIBRARY ( ${ly_lib_shared} SHARED ${ly_source_files} ) -+ SET_TARGET_PROPERTIES ( ${ly_lib_shared} PROPERTIES OUTPUT_NAME "${ly_lib_name}" ) - SET_TARGET_PROPERTIES ( ${ly_lib_shared} PROPERTIES PREFIX "lib" ) +@@ -36,7 +38,9 @@ SET_TARGET_PROPERTIES ( ${ly_lib_shared} PROPERTIES PREFIX "lib" ) + if(WIN32) + SET_TARGET_PROPERTIES ( ${ly_lib_shared} PROPERTIES IMPORT_PREFIX "lib" ) + endif() +endif() - # this creates the conversion tool +if(BINARY) - ADD_EXECUTABLE ( yuvconvert ${ly_base_dir}/util/yuvconvert.cc ) - TARGET_LINK_LIBRARIES ( yuvconvert ${ly_lib_static} ) - -- - INCLUDE ( FindJPEG ) - if (JPEG_FOUND) - include_directories( ${JPEG_INCLUDE_DIR} ) - target_link_libraries( yuvconvert ${JPEG_LIBRARY} ) + # this creates the cpuid tool + ADD_EXECUTABLE ( cpuid ${ly_base_dir}/util/cpuid.c ) + TARGET_LINK_LIBRARIES ( cpuid ${ly_lib_static} ) +@@ -55,6 +59,7 @@ if (JPEG_FOUND) + target_link_libraries( ${ly_lib_shared} ${JPEG_LIBRARY} ) add_definitions( -DHAVE_JPEG ) endif() +endif() - if(TEST) + if(UNIT_TEST) find_library(GTEST_LIBRARY gtest) -@@ -75,9 +80,17 @@ endif() +@@ -97,10 +102,14 @@ if(UNIT_TEST) + endif() - # install the conversion tool, .so, .a, and all the header files +if(BINARY) -+message("The BINARY option is enabled.") - INSTALL ( PROGRAMS ${CMAKE_BINARY_DIR}/yuvconvert DESTINATION bin ) --INSTALL ( TARGETS ${ly_lib_static} DESTINATION lib ) + # install the conversion tool, .so, .a, and all the header files +-INSTALL ( PROGRAMS ${CMAKE_BINARY_DIR}/yuvconvert DESTINATION bin ) ++INSTALL ( PROGRAMS ${CMAKE_BINARY_DIR}/yuvconvert DESTINATION bin ) +endif() -+ + INSTALL ( TARGETS ${ly_lib_static} DESTINATION lib ) +if(BUILD_SHARED_LIBS) -+message("The BUILD_SHARED_LIBS option is enabled.") INSTALL ( TARGETS ${ly_lib_shared} LIBRARY DESTINATION lib RUNTIME DESTINATION bin ) +endif() -+ -+INSTALL ( TARGETS ${ly_lib_static} DESTINATION lib ) INSTALL ( DIRECTORY ${PROJECT_SOURCE_DIR}/include/ DESTINATION include ) # create the .deb and .rpm packages using cpack -- -2.39.5 (Apple Git-154) +2.50.1 (Apple Git-155) From 7c9ce2b37550c06d3a61391e47be78eb8c248914 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Mon, 8 Dec 2025 09:07:05 +0800 Subject: [PATCH 134/359] fix convert odd height cvpixelbuffer to bgra crash --- ...d-height-cvpixelbuffer-to-bgra-crash.patch | 219 ++++++++++++++++++ 1 file changed, 219 insertions(+) create mode 100644 patches/yuv/0002-fix-convert-odd-height-cvpixelbuffer-to-bgra-crash.patch diff --git a/patches/yuv/0002-fix-convert-odd-height-cvpixelbuffer-to-bgra-crash.patch b/patches/yuv/0002-fix-convert-odd-height-cvpixelbuffer-to-bgra-crash.patch new file mode 100644 index 000000000..c1d63eff3 --- /dev/null +++ b/patches/yuv/0002-fix-convert-odd-height-cvpixelbuffer-to-bgra-crash.patch @@ -0,0 +1,219 @@ +From c253f0b58f86597d7e020076454fbf8c63847f8d Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Fri, 5 Dec 2025 16:07:06 +0800 +Subject: [PATCH] fix convert odd height cvpixelbuffer to bgra crash + +--- + include/libyuv/convert_argb.h | 44 +++++++++++ + source/convert_argb.cc | 140 ++++++++++++++++++++++++++++++++++ + 2 files changed, 184 insertions(+) + +diff --git a/include/libyuv/convert_argb.h b/include/libyuv/convert_argb.h +index 5b50567..2bcfda8 100644 +--- a/include/libyuv/convert_argb.h ++++ b/include/libyuv/convert_argb.h +@@ -1856,6 +1856,50 @@ int NV12ToARGBMatrix(const uint8_t* src_y, + int width, + int height); + ++ /* ++Convert NV12 to ARGB with matrix safely ++itu_matrix 1: BT.709 ++ 2: BT.601 ++ 3: BT.2020 ++full_range 0: limited range ++ 1: full range ++*/ ++ ++LIBYUV_API ++int NV12ToARGBMatrixRangeSafely(const uint8_t* src_y, ++ int src_stride_y, ++ const uint8_t* src_uv, ++ int src_stride_uv, ++ uint8_t* dst_argb, ++ int dst_stride_argb, ++ int width, ++ int height, ++ int uv_height, ++ int itu_matrix, ++ int full_range); ++ ++ ++ /* ++convert nv12 to argb with matrix,uv height safely ++because cvpixelbuffer uv height is y_height/2 ++libyuv need uv height is y_height/2 + 1 ++for example: ++y height is 615 ++uv height is 307 ++libyuv need uv height is 308 ++*/ ++LIBYUV_API ++int NV12ToARGBMatrixSafely(const uint8_t* src_y, ++ int src_stride_y, ++ const uint8_t* src_uv, ++ int src_stride_uv, ++ uint8_t* dst_argb, ++ int dst_stride_argb, ++ const struct YuvConstants* yuvconstants, ++ int width, ++ int height, ++ int uv_height); ++ + // Convert NV21 to ARGB with matrix. + LIBYUV_API + int NV21ToARGBMatrix(const uint8_t* src_y, +diff --git a/source/convert_argb.cc b/source/convert_argb.cc +index 3655e30..eaff1e9 100644 +--- a/source/convert_argb.cc ++++ b/source/convert_argb.cc +@@ -4060,6 +4060,146 @@ int NV12ToARGBMatrix(const uint8_t* src_y, + return 0; + } + ++/* ++convert nv12 to argb with matrix,uv height safe ++because cvpixelbuffer uv height is y_height/2 ++libyuv need uv height is y_height/2 + 1 ++for example: ++y height is 615 ++uv height is 307 ++libyuv need uv height is 308 ++*/ ++LIBYUV_API ++int NV12ToARGBMatrixSafely(const uint8_t* src_y, ++ int src_stride_y, ++ const uint8_t* src_uv, ++ int src_stride_uv, ++ uint8_t* dst_argb, ++ int dst_stride_argb, ++ const struct YuvConstants* yuvconstants, ++ int width, ++ int height, ++ int uv_height) { ++ int y; ++ void (*NV12ToARGBRow)( ++ const uint8_t* y_buf, const uint8_t* uv_buf, uint8_t* rgb_buf, ++ const struct YuvConstants* yuvconstants, int width) = NV12ToARGBRow_C; ++ assert(yuvconstants); ++ if (!src_y || !src_uv || !dst_argb || width <= 0 || height == 0) { ++ return -1; ++ } ++ // Negative height means invert the image. ++ if (height < 0) { ++ height = -height; ++ dst_argb = dst_argb + (height - 1) * dst_stride_argb; ++ dst_stride_argb = -dst_stride_argb; ++ } ++#if defined(HAS_NV12TOARGBROW_SSSE3) ++ if (TestCpuFlag(kCpuHasSSSE3)) { ++ NV12ToARGBRow = NV12ToARGBRow_Any_SSSE3; ++ if (IS_ALIGNED(width, 8)) { ++ NV12ToARGBRow = NV12ToARGBRow_SSSE3; ++ } ++ } ++#endif ++#if defined(HAS_NV12TOARGBROW_AVX2) ++ if (TestCpuFlag(kCpuHasAVX2)) { ++ NV12ToARGBRow = NV12ToARGBRow_Any_AVX2; ++ if (IS_ALIGNED(width, 16)) { ++ NV12ToARGBRow = NV12ToARGBRow_AVX2; ++ } ++ } ++#endif ++#if defined(HAS_NV12TOARGBROW_NEON) ++ if (TestCpuFlag(kCpuHasNEON)) { ++ NV12ToARGBRow = NV12ToARGBRow_Any_NEON; ++ if (IS_ALIGNED(width, 8)) { ++ NV12ToARGBRow = NV12ToARGBRow_NEON; ++ } ++ } ++#endif ++#if defined(HAS_NV12TOARGBROW_MSA) ++ if (TestCpuFlag(kCpuHasMSA)) { ++ NV12ToARGBRow = NV12ToARGBRow_Any_MSA; ++ if (IS_ALIGNED(width, 8)) { ++ NV12ToARGBRow = NV12ToARGBRow_MSA; ++ } ++ } ++#endif ++#if defined(HAS_NV12TOARGBROW_LSX) ++ if (TestCpuFlag(kCpuHasLSX)) { ++ NV12ToARGBRow = NV12ToARGBRow_Any_LSX; ++ if (IS_ALIGNED(width, 8)) { ++ NV12ToARGBRow = NV12ToARGBRow_LSX; ++ } ++ } ++#endif ++#if defined(HAS_NV12TOARGBROW_LASX) ++ if (TestCpuFlag(kCpuHasLASX)) { ++ NV12ToARGBRow = NV12ToARGBRow_Any_LASX; ++ if (IS_ALIGNED(width, 16)) { ++ NV12ToARGBRow = NV12ToARGBRow_LASX; ++ } ++ } ++#endif ++#if defined(HAS_NV12TOARGBROW_RVV) ++ if (TestCpuFlag(kCpuHasRVV)) { ++ NV12ToARGBRow = NV12ToARGBRow_RVV; ++ } ++#endif ++ ++ //because src_uv will add src_stride_uv,so after added src_uv should not exceed uv_height ++ uv_height--; ++ ++ for (y = 0; y < height; ++y) { ++ NV12ToARGBRow(src_y, src_uv, dst_argb, yuvconstants, width); ++ dst_argb += dst_stride_argb; ++ src_y += src_stride_y; ++ //cvpixelbuffer may have different uv height: height >> 1 - 1 ++ if (y & 1 && (y >> 1) < uv_height) { ++ src_uv += src_stride_uv; ++ } ++ } ++ return 0; ++} ++ ++/* ++Convert NV12 to ARGB with matrix. ++itu_matrix 1: BT.709 ++ 2: BT.601 ++ 3: BT.2020 ++full_range 0: limited range ++ 1: full range ++*/ ++ ++LIBYUV_API ++int NV12ToARGBMatrixRangeSafely(const uint8_t* src_y, ++ int src_stride_y, ++ const uint8_t* src_uv, ++ int src_stride_uv, ++ uint8_t* dst_argb, ++ int dst_stride_argb, ++ int width, ++ int height, ++ int uv_height, ++ int itu_matrix, ++ int full_range) ++ { ++const struct YuvConstants* yuvconstants; ++ ++ if (itu_matrix == 2) { ++ yuvconstants = full_range ? &kYuvJPEGConstants : &kYuvI601Constants; ++ } else if (itu_matrix == 3) { ++ yuvconstants = full_range ? &kYuvV2020Constants : &kYuv2020Constants; ++ } else { ++ yuvconstants = full_range ? &kYuvF709Constants : &kYuvH709Constants; ++ } ++ return NV12ToARGBMatrixSafely(src_y, src_stride_y, src_uv, src_stride_uv, ++ dst_argb, dst_stride_argb, ++ yuvconstants, ++ width, height,uv_height); ++} ++ + // Convert NV21 to ARGB with matrix. + LIBYUV_API + int NV21ToARGBMatrix(const uint8_t* src_y, +-- +2.50.1 (Apple Git-155) + From 30da88ba481338abaa8aba4722647e0094530481 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Mon, 8 Dec 2025 11:13:58 +0800 Subject: [PATCH 135/359] =?UTF-8?q?=E3=80=90libyuv=E3=80=91update=20patch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...patch => 0001-fix-cmake-build-error.patch} | 27 ++-- tools/ios.toolchain.cmake | 117 +++++++++++++----- 2 files changed, 102 insertions(+), 42 deletions(-) rename patches/yuv/{0001-skip-binary-and-shared-lib-and-jpeg.patch => 0001-fix-cmake-build-error.patch} (74%) diff --git a/patches/yuv/0001-skip-binary-and-shared-lib-and-jpeg.patch b/patches/yuv/0001-fix-cmake-build-error.patch similarity index 74% rename from patches/yuv/0001-skip-binary-and-shared-lib-and-jpeg.patch rename to patches/yuv/0001-fix-cmake-build-error.patch index c2c0aa233..d2257dc3e 100644 --- a/patches/yuv/0001-skip-binary-and-shared-lib-and-jpeg.patch +++ b/patches/yuv/0001-fix-cmake-build-error.patch @@ -1,19 +1,22 @@ -From ec40a559327d80f3333c17a1f9e9c516bb073753 Mon Sep 17 00:00:00 2001 +From 9d49b6da04e66e8fcc27cc809474fe6460007c74 Mon Sep 17 00:00:00 2001 From: qianlongxu -Date: Thu, 4 Dec 2025 10:11:52 +0800 -Subject: [PATCH] skip binary and shared lib and jpeg +Date: Mon, 8 Dec 2025 11:12:10 +0800 +Subject: [PATCH] fix cmake build error --- - CMakeLists.txt | 11 ++++++++++- - 1 file changed, 10 insertions(+), 1 deletion(-) + CMakeLists.txt | 13 +++++++++++-- + 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt -index 9abfa74..898a6be 100644 +index 9abfa74..fcebbdb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -5,6 +5,7 @@ +@@ -3,8 +3,9 @@ + # Run with -DTEST=ON to build unit tests + PROJECT ( YUV C CXX ) # "C" is required even for C++ projects - CMAKE_MINIMUM_REQUIRED( VERSION 2.8.12 ) +-CMAKE_MINIMUM_REQUIRED( VERSION 2.8.12 ) ++CMAKE_MINIMUM_REQUIRED( VERSION 3...4 ) OPTION( UNIT_TEST "Built unit tests" OFF ) +OPTION( BINARY "Built binary" OFF ) @@ -45,14 +48,13 @@ index 9abfa74..898a6be 100644 if(UNIT_TEST) find_library(GTEST_LIBRARY gtest) -@@ -97,10 +102,14 @@ if(UNIT_TEST) +@@ -97,12 +102,16 @@ if(UNIT_TEST) endif() +if(BINARY) # install the conversion tool, .so, .a, and all the header files --INSTALL ( PROGRAMS ${CMAKE_BINARY_DIR}/yuvconvert DESTINATION bin ) -+INSTALL ( PROGRAMS ${CMAKE_BINARY_DIR}/yuvconvert DESTINATION bin ) + INSTALL ( PROGRAMS ${CMAKE_BINARY_DIR}/yuvconvert DESTINATION bin ) +endif() INSTALL ( TARGETS ${ly_lib_static} DESTINATION lib ) +if(BUILD_SHARED_LIBS) @@ -61,6 +63,9 @@ index 9abfa74..898a6be 100644 INSTALL ( DIRECTORY ${PROJECT_SOURCE_DIR}/include/ DESTINATION include ) # create the .deb and .rpm packages using cpack +-INCLUDE ( CM_linux_packages.cmake ) ++# INCLUDE ( CM_linux_packages.cmake ) + -- 2.50.1 (Apple Git-155) diff --git a/tools/ios.toolchain.cmake b/tools/ios.toolchain.cmake index 45c563663..6ea7d3cde 100644 --- a/tools/ios.toolchain.cmake +++ b/tools/ios.toolchain.cmake @@ -74,6 +74,7 @@ # WATCHOSCOMBINED = Build for armv7k arm64_32 x86_64 watchOS + watchOS Simulator. Combined into FAT STATIC lib (only supported on 3.14+ of CMake with "-G Xcode" argument in combination with the "cmake --install" CMake build step) # SIMULATOR_WATCHOS = Build for x86_64 for watchOS Simulator. # SIMULATORARM64_WATCHOS = Build for arm64 for watchOS Simulator. +# SIMULATOR_WATCHOSCOMBINED = Build for arm64 x86_64 for watchOS Simulator. Combined into FAT STATIC lib (supported on 3.14+ of CMakewith "-G Xcode" argument ONLY) # MAC = Build for x86_64 macOS. # MAC_ARM64 = Build for Apple Silicon macOS. # MAC_UNIVERSAL = Combined build for x86_64 and Apple Silicon on macOS. @@ -98,6 +99,7 @@ # ON (default) = Will require "enable_language(OBJC) and/or enable_language(OBJCXX)" for full OBJC|OBJCXX support # OFF = Will embed the OBJC and OBJCXX flags into the CMAKE_C_FLAGS and CMAKE_CXX_FLAGS (legacy behavior, CMake version < 3.16) # +# ENABLE_BITCODE: (ON|OFF) Enables or disables bitcode support. Default OFF # # ENABLE_ARC: (ON|OFF) Enables or disables ARC support. Default ON (ARC enabled by default) # @@ -165,9 +167,9 @@ set(ENV{_IOS_TOOLCHAIN_HAS_RUN} true) list(APPEND _supported_platforms "OS" "OS64" "OS64COMBINED" "SIMULATOR" "SIMULATOR64" "SIMULATORARM64" "SIMULATOR64COMBINED" "TVOS" "TVOSCOMBINED" "SIMULATOR_TVOS" "SIMULATORARM64_TVOS" - "WATCHOS" "WATCHOSCOMBINED" "SIMULATOR_WATCHOS" "SIMULATORARM64_WATCHOS" + "WATCHOS" "WATCHOSCOMBINED" "SIMULATOR_WATCHOS" "SIMULATORARM64_WATCHOS" "SIMULATOR_WATCHOSCOMBINED" "MAC" "MAC_ARM64" "MAC_UNIVERSAL" - "VISIONOS" "SIMULATOR_VISIONOS" "VISIONOSCOMBINED" + "VISIONOS" "SIMULATOR_VISIONOS" "VISIONOSCOMBINED" "MAC_CATALYST" "MAC_CATALYST_ARM64" "MAC_CATALYST_UNIVERSAL") # Cache what generator is used @@ -263,28 +265,28 @@ set(NAMED_LANGUAGE_SUPPORT_INT ${NAMED_LANGUAGE_SUPPORT} CACHE BOOL # Specify the minimum version of the deployment target. if(NOT DEFINED DEPLOYMENT_TARGET) if (PLATFORM MATCHES "WATCHOS") - # Unless specified, SDK version 4.0 is used by default as minimum target version (watchOS). + # Unless specified, SDK version 6.0 is used by default as minimum target version (watchOS). set(DEPLOYMENT_TARGET "6.0") elseif(PLATFORM STREQUAL "MAC") # Unless specified, SDK version 10.13 (High Sierra) is used by default as the minimum target version (macos). - set(DEPLOYMENT_TARGET "10.11") + set(DEPLOYMENT_TARGET "10.13") elseif(PLATFORM STREQUAL "VISIONOS" OR PLATFORM STREQUAL "SIMULATOR_VISIONOS" OR PLATFORM STREQUAL "VISIONOSCOMBINED") # Unless specified, SDK version 1.0 is used by default as minimum target version (visionOS). set(DEPLOYMENT_TARGET "1.0") elseif(PLATFORM STREQUAL "MAC_ARM64") # Unless specified, SDK version 11.0 (Big Sur) is used by default as the minimum target version (macOS on arm). - set(DEPLOYMENT_TARGET "10.11") + set(DEPLOYMENT_TARGET "11.0") elseif(PLATFORM STREQUAL "MAC_UNIVERSAL") - # Unless specified, SDK version 11.0 (Big Sur) is used by default as minimum target version for universal builds. - set(DEPLOYMENT_TARGET "10.11") + # Unless specified, SDK version 10.13 (High Sierra) is used by default as minimum target version for universal builds. + set(DEPLOYMENT_TARGET "10.13") elseif(PLATFORM STREQUAL "MAC_CATALYST" OR PLATFORM STREQUAL "MAC_CATALYST_ARM64" OR PLATFORM STREQUAL "MAC_CATALYST_UNIVERSAL") - # Unless specified, SDK version 13.0 is used by default as the minimum target version (mac catalyst minimum requirement). + # Unless specified, SDK version 13.1 is used by default as the minimum target version (mac catalyst minimum requirement). set(DEPLOYMENT_TARGET "13.1") else() - # Unless specified, SDK version 11.0 is used by default as the minimum target version (iOS, tvOS). - set(DEPLOYMENT_TARGET "11.0") + # Unless specified, SDK version 13.0 is used by default as the minimum target version (iOS, tvOS). + set(DEPLOYMENT_TARGET "13.0") endif() - message(STATUS "[DEFAULTS] Using the default min-version (${DEPLOYMENT_TARGET}) since DEPLOYMENT_TARGET not provided!") + message(STATUS "[DEFAULTS] Using the default min-version since DEPLOYMENT_TARGET not provided!") elseif(DEFINED DEPLOYMENT_TARGET AND PLATFORM MATCHES "^MAC_CATALYST" AND ${DEPLOYMENT_TARGET} VERSION_LESS "13.1") message(FATAL_ERROR "Mac Catalyst builds requires a minimum deployment target of 13.1!") endif() @@ -315,13 +317,13 @@ if(PLATFORM_INT STREQUAL "OS") set(ARCHS armv7 armv7s arm64) set(APPLE_TARGET_TRIPLE_INT arm-apple-ios${DEPLOYMENT_TARGET}) else() - set(APPLE_TARGET_TRIPLE_INT ${ARCHS_SPLIT}-apple-ios${DEPLOYMENT_TARGET}) + set(APPLE_TARGET_TRIPLE_INT ${ARCHS_SPLIT}-apple-ios${DEPLOYMENT_TARGET}) endif() elseif(PLATFORM_INT STREQUAL "OS64") set(SDK_NAME iphoneos) if(NOT ARCHS) if (XCODE_VERSION_INT VERSION_GREATER 10.0) - set(ARCHS arm64) # FIXME: Add arm64e when Apple has fixed the integration issues with it + set(ARCHS arm64) # FIXME: Add arm64e when Apple has fixed the integration issues with it, libarclite_iphoneos.a is currently missing bitcode markers for example else() set(ARCHS arm64) endif() @@ -358,7 +360,7 @@ elseif(PLATFORM_INT STREQUAL "SIMULATOR64COMBINED") if(MODERN_CMAKE) if(NOT ARCHS) if (XCODE_VERSION_INT VERSION_GREATER 12.0) - set(ARCHS arm64 x86_64) # FIXME: Add arm64e when Apple have fixed the integration issues with it + set(ARCHS arm64 x86_64) # FIXME: Add arm64e when Apple have fixed the integration issues with it, libarclite_iphoneos.a is currently missing bitcode markers for example set(CMAKE_XCODE_ATTRIBUTE_ARCHS[sdk=iphoneos*] "") set(CMAKE_XCODE_ATTRIBUTE_ARCHS[sdk=iphonesimulator*] "x86_64 arm64") set(CMAKE_XCODE_ATTRIBUTE_VALID_ARCHS[sdk=iphoneos*] "") @@ -460,12 +462,12 @@ elseif(PLATFORM_INT STREQUAL "WATCHOSCOMBINED") if(MODERN_CMAKE) if(NOT ARCHS) if (XCODE_VERSION_INT VERSION_GREATER 10.0) - set(ARCHS armv7k arm64_32 i386) - set(APPLE_TARGET_TRIPLE_INT arm64_32-i386-apple-watchos${DEPLOYMENT_TARGET}) + set(ARCHS armv7k arm64_32 x86_64) + set(APPLE_TARGET_TRIPLE_INT arm64_32-x86_64-apple-watchos${DEPLOYMENT_TARGET}) set(CMAKE_XCODE_ATTRIBUTE_ARCHS[sdk=watchos*] "armv7k arm64_32") - set(CMAKE_XCODE_ATTRIBUTE_ARCHS[sdk=watchsimulator*] "i386") + set(CMAKE_XCODE_ATTRIBUTE_ARCHS[sdk=watchsimulator*] "x86_64") set(CMAKE_XCODE_ATTRIBUTE_VALID_ARCHS[sdk=watchos*] "armv7k arm64_32") - set(CMAKE_XCODE_ATTRIBUTE_VALID_ARCHS[sdk=watchsimulator*] "i386") + set(CMAKE_XCODE_ATTRIBUTE_VALID_ARCHS[sdk=watchsimulator*] "x86_64") else() set(ARCHS armv7k i386) set(APPLE_TARGET_TRIPLE_INT arm-i386-apple-watchos${DEPLOYMENT_TARGET}) @@ -483,8 +485,13 @@ elseif(PLATFORM_INT STREQUAL "WATCHOSCOMBINED") elseif(PLATFORM_INT STREQUAL "SIMULATOR_WATCHOS") set(SDK_NAME watchsimulator) if(NOT ARCHS) - set(ARCHS i386) - set(APPLE_TARGET_TRIPLE_INT i386-apple-watchos${DEPLOYMENT_TARGET}-simulator) + if (XCODE_VERSION_INT VERSION_GREATER 10.0) + set(ARCHS x86_64) + set(APPLE_TARGET_TRIPLE_INT x86_64-apple-watchos${DEPLOYMENT_TARGET}-simulator) + else() + set(ARCHS i386) + set(APPLE_TARGET_TRIPLE_INT i386-apple-watchos${DEPLOYMENT_TARGET}-simulator) + endif() else() set(APPLE_TARGET_TRIPLE_INT ${ARCHS_SPLIT}-apple-watchos${DEPLOYMENT_TARGET}-simulator) endif() @@ -496,6 +503,31 @@ elseif(PLATFORM_INT STREQUAL "SIMULATORARM64_WATCHOS") else() set(APPLE_TARGET_TRIPLE_INT ${ARCHS_SPLIT}-apple-watchos${DEPLOYMENT_TARGET}-simulator) endif() +elseif(PLATFORM_INT STREQUAL "SIMULATOR_WATCHOSCOMBINED") + set(SDK_NAME watchsimulator) + if(MODERN_CMAKE) + if(NOT ARCHS) + if (XCODE_VERSION_INT VERSION_GREATER 12.0) + set(ARCHS arm64 x86_64) + set(CMAKE_XCODE_ATTRIBUTE_ARCHS[sdk=watchos*] "") + set(CMAKE_XCODE_ATTRIBUTE_ARCHS[sdk=watchsimulator*] "arm64 x86_64") + set(CMAKE_XCODE_ATTRIBUTE_VALID_ARCHS[sdk=watchos*] "") + set(CMAKE_XCODE_ATTRIBUTE_VALID_ARCHS[sdk=watchsimulator*] "arm64 x86_64") + set(APPLE_TARGET_TRIPLE_INT arm64_x86_64-apple-watchos${DEPLOYMENT_TARGET}-simulator) + else() + set(ARCHS arm64 i386) + set(CMAKE_XCODE_ATTRIBUTE_ARCHS[sdk=watchos*] "") + set(CMAKE_XCODE_ATTRIBUTE_ARCHS[sdk=watchsimulator*] "i386") + set(CMAKE_XCODE_ATTRIBUTE_VALID_ARCHS[sdk=watchos*] "") + set(CMAKE_XCODE_ATTRIBUTE_VALID_ARCHS[sdk=watchsimulator*] "i386") + set(APPLE_TARGET_TRIPLE_INT arm64_i386-apple-watchos${DEPLOYMENT_TARGET}-simulator) + endif() + else() + set(APPLE_TARGET_TRIPLE_INT ${ARCHS_SPLIT}-apple-watchos${DEPLOYMENT_TARGET}-simulator) + endif() + else() + message(FATAL_ERROR "Please make sure that you are running CMake 3.14+ to make the SIMULATOR_WATCHOSCOMBINED setting work") + endif() elseif(PLATFORM_INT STREQUAL "SIMULATOR_VISIONOS") set(SDK_NAME xrsimulator) if(NOT ARCHS) @@ -553,15 +585,16 @@ elseif(PLATFORM_INT STREQUAL "MAC_UNIVERSAL") if(NOT ARCHS) set(ARCHS "x86_64;arm64") endif() - string(REPLACE ";" "-" ARCHS_SPLIT "${ARCHS}") - set(APPLE_TARGET_TRIPLE_INT ${ARCHS_SPLIT}-apple-macosx${DEPLOYMENT_TARGET}) + # For universal builds, don't set target triple - let CMake handle it + # string(REPLACE ";" "-" ARCHS_SPLIT "${ARCHS}") + # set(APPLE_TARGET_TRIPLE_INT ${ARCHS_SPLIT}-apple-macosx${DEPLOYMENT_TARGET}) elseif(PLATFORM_INT STREQUAL "MAC_CATALYST_UNIVERSAL") set(SDK_NAME macosx) if(NOT ARCHS) set(ARCHS "x86_64;arm64") endif() string(REPLACE ";" "-" ARCHS_SPLIT "${ARCHS}") - set(APPLE_TARGET_TRIPLE_INT ${ARCHS_SPLIT}-apple-ios${DEPLOYMENT_TARGET}-macabi) + set(APPLE_TARGET_TRIPLE_INT apple-ios${DEPLOYMENT_TARGET}-macabi) else() message(FATAL_ERROR "Invalid PLATFORM: ${PLATFORM_INT}") endif() @@ -616,6 +649,13 @@ elseif(DEFINED CMAKE_OSX_SYSROOT_INT) set(CMAKE_OSX_SYSROOT "${CMAKE_OSX_SYSROOT_INT}" CACHE INTERNAL "") endif() +# Use bitcode or not +if(NOT DEFINED ENABLE_BITCODE) + message(STATUS "[DEFAULTS] Disabling bitcode support by default. ENABLE_BITCODE not provided for override!") + set(ENABLE_BITCODE OFF) +endif() +set(ENABLE_BITCODE_INT ${ENABLE_BITCODE} CACHE BOOL + "Whether or not to enable bitcode" FORCE) # Use ARC or not if(NOT DEFINED ENABLE_ARC) # Unless specified, enable ARC support by default @@ -869,6 +909,15 @@ if(PLATFORM_INT MATCHES "^MAC_CATALYST") set(C_TARGET_FLAGS "-isystem ${CMAKE_OSX_SYSROOT_INT}/System/iOSSupport/usr/include -iframework ${CMAKE_OSX_SYSROOT_INT}/System/iOSSupport/System/Library/Frameworks") endif() +if(ENABLE_BITCODE_INT) + set(BITCODE "-fembed-bitcode") + set(CMAKE_XCODE_ATTRIBUTE_BITCODE_GENERATION_MODE "bitcode") + set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "YES") +else() + set(BITCODE "") + set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "NO") +endif() + if(ENABLE_ARC_INT) set(FOBJC_ARC "-fobjc-arc") set(CMAKE_XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_ARC "YES") @@ -907,26 +956,26 @@ endif() if(CMAKE_GENERATOR MATCHES "Xcode") message(STATUS "Not setting any manual command-line buildflags, since Xcode is selected as the generator. Modifying the Xcode build-settings directly instead.") else() - set(CMAKE_C_FLAGS "${C_TARGET_FLAGS} ${APPLE_TARGET_TRIPLE_FLAG} ${SDK_NAME_VERSION_FLAGS} ${OBJC_LEGACY_VARS} ${VISIBILITY} ${CMAKE_C_FLAGS}" CACHE INTERNAL + set(CMAKE_C_FLAGS "${C_TARGET_FLAGS} ${APPLE_TARGET_TRIPLE_FLAG} ${SDK_NAME_VERSION_FLAGS} ${OBJC_LEGACY_VARS} ${BITCODE} ${VISIBILITY} ${CMAKE_C_FLAGS}" CACHE INTERNAL "Flags used by the compiler during all C build types.") set(CMAKE_C_FLAGS_DEBUG "-O0 -g ${CMAKE_C_FLAGS_DEBUG}") set(CMAKE_C_FLAGS_MINSIZEREL "-DNDEBUG -Os ${CMAKE_C_FLAGS_MINSIZEREL}") set(CMAKE_C_FLAGS_RELWITHDEBINFO "-DNDEBUG -O2 -g ${CMAKE_C_FLAGS_RELWITHDEBINFO}") set(CMAKE_C_FLAGS_RELEASE "-DNDEBUG -O3 ${CMAKE_C_FLAGS_RELEASE}") - set(CMAKE_CXX_FLAGS "${C_TARGET_FLAGS} ${APPLE_TARGET_TRIPLE_FLAG} ${SDK_NAME_VERSION_FLAGS} ${OBJC_LEGACY_VARS} ${VISIBILITY} ${CMAKE_CXX_FLAGS}" CACHE INTERNAL + set(CMAKE_CXX_FLAGS "${C_TARGET_FLAGS} ${APPLE_TARGET_TRIPLE_FLAG} ${SDK_NAME_VERSION_FLAGS} ${OBJC_LEGACY_VARS} ${BITCODE} ${VISIBILITY} ${CMAKE_CXX_FLAGS}" CACHE INTERNAL "Flags used by the compiler during all CXX build types.") set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g ${CMAKE_CXX_FLAGS_DEBUG}") set(CMAKE_CXX_FLAGS_MINSIZEREL "-DNDEBUG -Os ${CMAKE_CXX_FLAGS_MINSIZEREL}") set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-DNDEBUG -O2 -g ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -O3 ${CMAKE_CXX_FLAGS_RELEASE}") if(NAMED_LANGUAGE_SUPPORT_INT) - set(CMAKE_OBJC_FLAGS "${C_TARGET_FLAGS} ${APPLE_TARGET_TRIPLE_FLAG} ${SDK_NAME_VERSION_FLAGS} ${VISIBILITY} ${FOBJC_ARC} ${OBJC_VARS} ${CMAKE_OBJC_FLAGS}" CACHE INTERNAL + set(CMAKE_OBJC_FLAGS "${C_TARGET_FLAGS} ${APPLE_TARGET_TRIPLE_FLAG} ${SDK_NAME_VERSION_FLAGS} ${BITCODE} ${VISIBILITY} ${FOBJC_ARC} ${OBJC_VARS} ${CMAKE_OBJC_FLAGS}" CACHE INTERNAL "Flags used by the compiler during all OBJC build types.") set(CMAKE_OBJC_FLAGS_DEBUG "-O0 -g ${CMAKE_OBJC_FLAGS_DEBUG}") set(CMAKE_OBJC_FLAGS_MINSIZEREL "-DNDEBUG -Os ${CMAKE_OBJC_FLAGS_MINSIZEREL}") set(CMAKE_OBJC_FLAGS_RELWITHDEBINFO "-DNDEBUG -O2 -g ${CMAKE_OBJC_FLAGS_RELWITHDEBINFO}") set(CMAKE_OBJC_FLAGS_RELEASE "-DNDEBUG -O3 ${CMAKE_OBJC_FLAGS_RELEASE}") - set(CMAKE_OBJCXX_FLAGS "${C_TARGET_FLAGS} ${APPLE_TARGET_TRIPLE_FLAG} ${SDK_NAME_VERSION_FLAGS} ${VISIBILITY} ${FOBJC_ARC} ${OBJC_VARS} ${CMAKE_OBJCXX_FLAGS}" CACHE INTERNAL + set(CMAKE_OBJCXX_FLAGS "${C_TARGET_FLAGS} ${APPLE_TARGET_TRIPLE_FLAG} ${SDK_NAME_VERSION_FLAGS} ${BITCODE} ${VISIBILITY} ${FOBJC_ARC} ${OBJC_VARS} ${CMAKE_OBJCXX_FLAGS}" CACHE INTERNAL "Flags used by the compiler during all OBJCXX build types.") set(CMAKE_OBJCXX_FLAGS_DEBUG "-O0 -g ${CMAKE_OBJCXX_FLAGS_DEBUG}") set(CMAKE_OBJCXX_FLAGS_MINSIZEREL "-DNDEBUG -Os ${CMAKE_OBJCXX_FLAGS_MINSIZEREL}") @@ -943,7 +992,7 @@ else() set(CMAKE_OBJCXX_LINK_FLAGS "${C_TARGET_FLAGS} ${SDK_NAME_VERSION_FLAGS} -Wl,-search_paths_first ${CMAKE_OBJCXX_LINK_FLAGS}" CACHE INTERNAL "Flags used by the compiler for all OBJCXX link types.") endif() - set(CMAKE_ASM_FLAGS "${CMAKE_C_FLAGS} -x assembler-with-cpp -arch ${CMAKE_OSX_ARCHITECTURES} ${APPLE_TARGET_TRIPLE_FLAG}" CACHE INTERNAL + set(CMAKE_ASM_FLAGS "${CMAKE_C_FLAGS} -x assembler-with-cpp" CACHE INTERNAL "Flags used by the compiler for all ASM build types.") endif() @@ -973,6 +1022,11 @@ if(DEFINED SDK_NAME_VERSION_FLAGS) message(STATUS "Using version flags: ${SDK_NAME_VERSION_FLAGS}") endif() message(STATUS "Using a data_ptr size of: ${CMAKE_CXX_SIZEOF_DATA_PTR}") +if(ENABLE_BITCODE_INT) + message(STATUS "Bitcode: Enabled") +else() + message(STATUS "Bitcode: Disabled") +endif() if(ENABLE_ARC_INT) message(STATUS "ARC: Enabled") @@ -1002,6 +1056,7 @@ set(CMAKE_TRY_COMPILE_PLATFORM_VARIABLES DEPLOYMENT_TARGET CMAKE_DEVELOPER_ROOT CMAKE_OSX_SYSROOT_INT + ENABLE_BITCODE ENABLE_ARC CMAKE_ASM_COMPILER CMAKE_C_COMPILER @@ -1026,7 +1081,7 @@ set(CMAKE_TRY_COMPILE_PLATFORM_VARIABLES ) if(NAMED_LANGUAGE_SUPPORT_INT) - list(APPEND CMAKE_TRY_COMPILE_PLATFORM_VARIABLES + list(APPEND CMAKE_TRY_COMPILE_PLATFORM_VARIABLES CMAKE_OBJC_FLAGS CMAKE_OBJC_DEBUG CMAKE_OBJC_MINSIZEREL @@ -1064,7 +1119,7 @@ IF(NOT DEFINED CMAKE_FIND_FRAMEWORK) ENDIF(NOT DEFINED CMAKE_FIND_FRAMEWORK) # Set up the default search directories for frameworks. -if(PLATFORM_INT MATCHES "^MAC_CATALYST") +if(PLATFORM_INT MATCHES "^MAC_CATALYST") set(CMAKE_FRAMEWORK_PATH ${CMAKE_DEVELOPER_ROOT}/Library/PrivateFrameworks ${CMAKE_OSX_SYSROOT_INT}/System/Library/Frameworks @@ -1119,4 +1174,4 @@ macro(find_host_package) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH) set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE BOTH) -endmacro(find_host_package) +endmacro(find_host_package) \ No newline at end of file From cb3bf39dfd329daecabb79c0fe968e13e1fd8536 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Mon, 8 Dec 2025 12:49:15 +0800 Subject: [PATCH 136/359] cmake minimum required 3.10 --- ...ke-build-error.patch => 0001-fix-build-error.patch} | 10 +++++----- tools/ios.toolchain.cmake | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) rename patches/yuv/{0001-fix-cmake-build-error.patch => 0001-fix-build-error.patch} (90%) diff --git a/patches/yuv/0001-fix-cmake-build-error.patch b/patches/yuv/0001-fix-build-error.patch similarity index 90% rename from patches/yuv/0001-fix-cmake-build-error.patch rename to patches/yuv/0001-fix-build-error.patch index d2257dc3e..2e28e8201 100644 --- a/patches/yuv/0001-fix-cmake-build-error.patch +++ b/patches/yuv/0001-fix-build-error.patch @@ -1,14 +1,14 @@ -From 9d49b6da04e66e8fcc27cc809474fe6460007c74 Mon Sep 17 00:00:00 2001 +From 55f90bbd61881edaef80f0751264b8ca4d0cec43 Mon Sep 17 00:00:00 2001 From: qianlongxu -Date: Mon, 8 Dec 2025 11:12:10 +0800 -Subject: [PATCH] fix cmake build error +Date: Mon, 8 Dec 2025 12:48:09 +0800 +Subject: [PATCH] fix build error --- CMakeLists.txt | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt -index 9abfa74..fcebbdb 100644 +index 9abfa74..b0feb35 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,8 +3,9 @@ @@ -16,7 +16,7 @@ index 9abfa74..fcebbdb 100644 PROJECT ( YUV C CXX ) # "C" is required even for C++ projects -CMAKE_MINIMUM_REQUIRED( VERSION 2.8.12 ) -+CMAKE_MINIMUM_REQUIRED( VERSION 3...4 ) ++CMAKE_MINIMUM_REQUIRED( VERSION 3.10) OPTION( UNIT_TEST "Built unit tests" OFF ) +OPTION( BINARY "Built binary" OFF ) diff --git a/tools/ios.toolchain.cmake b/tools/ios.toolchain.cmake index 6ea7d3cde..1e447e7f6 100644 --- a/tools/ios.toolchain.cmake +++ b/tools/ios.toolchain.cmake @@ -154,7 +154,7 @@ # command. # -cmake_minimum_required(VERSION 3.8.0) +cmake_minimum_required(VERSION 3.10) # CMake invokes the toolchain file twice during the first build, but only once during subsequent rebuilds. # NOTE: To improve single-library build-times, provide the flag "OS_SINGLE_BUILD" as a build argument. From f5187c94446ea96d9f7862d79e2d950aa43cba4c Mon Sep 17 00:00:00 2001 From: Anka Date: Mon, 8 Dec 2025 04:54:19 +0000 Subject: [PATCH 137/359] upgrade yuv to yuv-main-f94b8cf7-251208125130 for apple by cd --- configs/libs/yuv.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configs/libs/yuv.sh b/configs/libs/yuv.sh index ccd316b97..1925b1a35 100644 --- a/configs/libs/yuv.sh +++ b/configs/libs/yuv.sh @@ -45,7 +45,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=yuv-stable-eb6e7bb-250226212002 -export PRE_COMPILE_TAG_MACOS=yuv-stable-eb6e7bb-250226205944 -export PRE_COMPILE_TAG_IOS=yuv-stable-eb6e7bb-250226175227 +export PRE_COMPILE_TAG_TVOS=yuv-main-f94b8cf7-251208125130 +export PRE_COMPILE_TAG_MACOS=yuv-main-f94b8cf7-251208125130 +export PRE_COMPILE_TAG_IOS=yuv-main-f94b8cf7-251208125130 export PRE_COMPILE_TAG_ANDROID=yuv-stable-eb6e7bb-250310112252 \ No newline at end of file From 4a729c1ca3f8d3d759bb025a3aa88e050a70165d Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Mon, 8 Dec 2025 13:01:55 +0800 Subject: [PATCH 138/359] update README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9ad6e32b8..0c0093786 100644 --- a/README.md +++ b/README.md @@ -143,7 +143,7 @@ If cloning repositories from GitHub is slow, or if you need to use an internal p | unibreak | 6.1 | https://github.com/adah1972/libunibreak.git | export GIT_UNIBREAK_UPSTREAM=git@xx:yy/libunibreak.git | | uavs3d | 1.2.1 | https://github.com/uavs3/uavs3d.git | export GIT_UAVS3D_UPSTREAM=git@xx:yy/UAVS3D.git | | xml2 | 2.13.6 | https://github.com/GNOME/libxml2.git | export GIT_FONTCONFIG_UPSTREAM=git@xx:yy/fontconfig.git | -| yuv | stable-eb6e7bb | https://github.com/debugly/libyuv.git | export GIT_YUV_UPSTREAM=git@xx:yy/yuv.git | +| yuv | main-f94b8cf7 | https://github.com/debugly/libyuv.git | export GIT_YUV_UPSTREAM=git@xx:yy/yuv.git | | webp | v1.6.0 | https://github.com/debugly/libwebp.git | export GIT_WEBP_UPSTREAM=git@xx:yy/webp.git | ## Tips From 123e752ef2cb12eb2918b6b0809f11e8a8642866 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Mon, 8 Dec 2025 13:04:01 +0800 Subject: [PATCH 139/359] update README --- README_zh-CN.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README_zh-CN.md b/README_zh-CN.md index b1ae389cd..b714f066d 100644 --- a/README_zh-CN.md +++ b/README_zh-CN.md @@ -145,7 +145,7 @@ MRFFToolChain 是一套成熟的编译工具,专门用来编译 iOS、macOS、 | unibreak | 6.1 | https://github.com/adah1972/libunibreak.git | export GIT_UNIBREAK_UPSTREAM=git@xx:yy/libunibreak.git | | uavs3d | 1.2.1 | https://github.com/uavs3/uavs3d.git | export GIT_UAVS3D_UPSTREAM=git@xx:yy/UAVS3D.git | | xml2 | 2.13.6 | https://github.com/GNOME/libxml2.git | export GIT_FONTCONFIG_UPSTREAM=git@xx:yy/fontconfig.git | -| yuv | stable-eb6e7bb | https://github.com/debugly/libyuv.git | export GIT_YUV_UPSTREAM=git@xx:yy/yuv.git | +| yuv | main-f94b8cf7 | https://github.com/debugly/libyuv.git | export GIT_YUV_UPSTREAM=git@xx:yy/yuv.git | | webp | v1.6.0 | https://github.com/debugly/libwebp.git | export GIT_WEBP_UPSTREAM=git@xx:yy/webp.git | ## 提示 From 3467483b5bd36fa3eb71f19702e71c5140a03dd5 Mon Sep 17 00:00:00 2001 From: Anka Date: Wed, 10 Dec 2025 14:06:04 +0000 Subject: [PATCH 140/359] upgrade unibreak to unibreak-6.1-251210220106 for apple by cd --- configs/libs/unibreak.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configs/libs/unibreak.sh b/configs/libs/unibreak.sh index 0196a45a4..f45f5b6ff 100644 --- a/configs/libs/unibreak.sh +++ b/configs/libs/unibreak.sh @@ -38,7 +38,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=unibreak-6.1-250226211354 -export PRE_COMPILE_TAG_MACOS=unibreak-6.1-250226205523 -export PRE_COMPILE_TAG_IOS=unibreak-6.1-250226174658 +export PRE_COMPILE_TAG_TVOS=unibreak-6.1-251210220106 +export PRE_COMPILE_TAG_MACOS=unibreak-6.1-251210220106 +export PRE_COMPILE_TAG_IOS=unibreak-6.1-251210220106 export PRE_COMPILE_TAG_ANDROID=unibreak-6.1-250310111549 From dbd5f762ffe7fb6e82ff50acd4c96f185742bdd1 Mon Sep 17 00:00:00 2001 From: Anka Date: Wed, 10 Dec 2025 14:07:21 +0000 Subject: [PATCH 141/359] upgrade fribidi to fribidi-1.0.16-251210220611 for apple by cd --- configs/libs/fribidi.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configs/libs/fribidi.sh b/configs/libs/fribidi.sh index 6d6f6288b..3f83d97e8 100644 --- a/configs/libs/fribidi.sh +++ b/configs/libs/fribidi.sh @@ -38,7 +38,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=fribidi-1.0.16-250226211508 -export PRE_COMPILE_TAG_MACOS=fribidi-1.0.16-250226205618 -export PRE_COMPILE_TAG_IOS=fribidi-1.0.16-250226174802 +export PRE_COMPILE_TAG_TVOS=fribidi-1.0.16-251210220611 +export PRE_COMPILE_TAG_MACOS=fribidi-1.0.16-251210220611 +export PRE_COMPILE_TAG_IOS=fribidi-1.0.16-251210220611 export PRE_COMPILE_TAG_ANDROID=fribidi-1.0.16-250310111706 From 1436765113f8cf6d8fe8b73c07e530f6916eaac7 Mon Sep 17 00:00:00 2001 From: Anka Date: Wed, 10 Dec 2025 14:09:11 +0000 Subject: [PATCH 142/359] upgrade freetype to freetype-2.13.3-251210220726 for apple by cd --- configs/libs/freetype.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configs/libs/freetype.sh b/configs/libs/freetype.sh index d87140d92..072ee3f94 100644 --- a/configs/libs/freetype.sh +++ b/configs/libs/freetype.sh @@ -36,7 +36,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=freetype-2.13.3-250226211539 -export PRE_COMPILE_TAG_MACOS=freetype-2.13.3-250226205646 -export PRE_COMPILE_TAG_IOS=freetype-2.13.3-250226174825 +export PRE_COMPILE_TAG_TVOS=freetype-2.13.3-251210220726 +export PRE_COMPILE_TAG_MACOS=freetype-2.13.3-251210220726 +export PRE_COMPILE_TAG_IOS=freetype-2.13.3-251210220726 export PRE_COMPILE_TAG_ANDROID=freetype-2.13.3-250310111735 From 4234185b8e6a585a9d90e135e0b143030b4d84c9 Mon Sep 17 00:00:00 2001 From: Anka Date: Wed, 10 Dec 2025 14:18:19 +0000 Subject: [PATCH 143/359] upgrade harfbuzz to harfbuzz-10.2.0-251210220921 for apple by cd --- configs/libs/harfbuzz.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configs/libs/harfbuzz.sh b/configs/libs/harfbuzz.sh index 332332a58..d6ba565b1 100644 --- a/configs/libs/harfbuzz.sh +++ b/configs/libs/harfbuzz.sh @@ -38,7 +38,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=harfbuzz-10.2.0-250226211621 -export PRE_COMPILE_TAG_MACOS=harfbuzz-10.2.0-250226205723 -export PRE_COMPILE_TAG_IOS=harfbuzz-10.2.0-250226174909 +export PRE_COMPILE_TAG_TVOS=harfbuzz-10.2.0-251210220921 +export PRE_COMPILE_TAG_MACOS=harfbuzz-10.2.0-251210220921 +export PRE_COMPILE_TAG_IOS=harfbuzz-10.2.0-251210220921 export PRE_COMPILE_TAG_ANDROID=harfbuzz-10.2.0-250310111849 From 40e3bf16ead35ce69639513913d29854e45486e2 Mon Sep 17 00:00:00 2001 From: Anka Date: Wed, 10 Dec 2025 14:20:00 +0000 Subject: [PATCH 144/359] upgrade ass to ass-0.17.3-251210221847 for apple by cd --- configs/libs/ass.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configs/libs/ass.sh b/configs/libs/ass.sh index ddf307524..96e5c5f74 100644 --- a/configs/libs/ass.sh +++ b/configs/libs/ass.sh @@ -38,7 +38,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=ass-0.17.3-250226211935 -export PRE_COMPILE_TAG_MACOS=ass-0.17.3-250226205926 -export PRE_COMPILE_TAG_IOS=ass-0.17.3-250226175156 +export PRE_COMPILE_TAG_TVOS=ass-0.17.3-251210221847 +export PRE_COMPILE_TAG_MACOS=ass-0.17.3-251210221847 +export PRE_COMPILE_TAG_IOS=ass-0.17.3-251210221847 export PRE_COMPILE_TAG_ANDROID=ass-0.17.3-250310112227 From f68f435ffcc2a16fad5c6d5a54d70cd8223ce096 Mon Sep 17 00:00:00 2001 From: Anka Date: Wed, 10 Dec 2025 14:22:34 +0000 Subject: [PATCH 145/359] upgrade yuv to yuv-main-f94b8cf7-251210222006 for apple by cd --- configs/libs/yuv.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configs/libs/yuv.sh b/configs/libs/yuv.sh index 1925b1a35..d9a2bf77b 100644 --- a/configs/libs/yuv.sh +++ b/configs/libs/yuv.sh @@ -45,7 +45,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=yuv-main-f94b8cf7-251208125130 -export PRE_COMPILE_TAG_MACOS=yuv-main-f94b8cf7-251208125130 -export PRE_COMPILE_TAG_IOS=yuv-main-f94b8cf7-251208125130 +export PRE_COMPILE_TAG_TVOS=yuv-main-f94b8cf7-251210222006 +export PRE_COMPILE_TAG_MACOS=yuv-main-f94b8cf7-251210222006 +export PRE_COMPILE_TAG_IOS=yuv-main-f94b8cf7-251210222006 export PRE_COMPILE_TAG_ANDROID=yuv-stable-eb6e7bb-250310112252 \ No newline at end of file From 0d6e59c7cba3bc057a1277c8ff7b253f55a3d9e7 Mon Sep 17 00:00:00 2001 From: Matt Reach Date: Thu, 11 Dec 2025 12:46:49 +0800 Subject: [PATCH 146/359] Update SoundTouch version to 2.4.0 --- configs/libs/soundtouch.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configs/libs/soundtouch.sh b/configs/libs/soundtouch.sh index d3c91ed49..613b46380 100644 --- a/configs/libs/soundtouch.sh +++ b/configs/libs/soundtouch.sh @@ -28,8 +28,8 @@ export LIB_DEPENDS_BIN="cmake" export CMAKE_TARGETS_NAME=SoundTouch export GIT_LOCAL_REPO=extra/soundtouch export REPO_DIR=soundtouch -export GIT_COMMIT=2.3.3 -export GIT_REPO_VERSION=2.3.3 +export GIT_COMMIT=2.4.0 +export GIT_REPO_VERSION=2.4.0 export PATCH_DIR=soundtouch # you can export GIT_SOUNDTOUCH_UPSTREAM=git@xx:yy/soundtouch.git use your mirror From 81a678ed0c5eebe2125ee006d452a6d3161a530a Mon Sep 17 00:00:00 2001 From: Anka Date: Thu, 11 Dec 2025 04:52:44 +0000 Subject: [PATCH 147/359] upgrade soundtouch to soundtouch-2.4.0-251211125010 for apple by cd --- configs/libs/soundtouch.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configs/libs/soundtouch.sh b/configs/libs/soundtouch.sh index 613b46380..d8696f25f 100644 --- a/configs/libs/soundtouch.sh +++ b/configs/libs/soundtouch.sh @@ -40,7 +40,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=soundtouch-2.3.3-250226212055 -export PRE_COMPILE_TAG_MACOS=soundtouch-2.3.3-250226210026 -export PRE_COMPILE_TAG_IOS=soundtouch-2.3.3-250226175330 +export PRE_COMPILE_TAG_TVOS=soundtouch-2.4.0-251211125010 +export PRE_COMPILE_TAG_MACOS=soundtouch-2.4.0-251211125010 +export PRE_COMPILE_TAG_IOS=soundtouch-2.4.0-251211125010 export PRE_COMPILE_TAG_ANDROID=soundtouch-2.3.3-250428092710 From 509d85c19a705e6cf9590f178c2b138b501aed29 Mon Sep 17 00:00:00 2001 From: Anka Date: Thu, 11 Dec 2025 04:57:58 +0000 Subject: [PATCH 148/359] upgrade soundtouch to soundtouch-2.4.0-251211125721 for android by cd --- configs/libs/soundtouch.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/libs/soundtouch.sh b/configs/libs/soundtouch.sh index d8696f25f..0a0bc5878 100644 --- a/configs/libs/soundtouch.sh +++ b/configs/libs/soundtouch.sh @@ -43,4 +43,4 @@ fi export PRE_COMPILE_TAG_TVOS=soundtouch-2.4.0-251211125010 export PRE_COMPILE_TAG_MACOS=soundtouch-2.4.0-251211125010 export PRE_COMPILE_TAG_IOS=soundtouch-2.4.0-251211125010 -export PRE_COMPILE_TAG_ANDROID=soundtouch-2.3.3-250428092710 +export PRE_COMPILE_TAG_ANDROID=soundtouch-2.4.0-251211125721 From e557e94375d611bcf4357125820aefd27dbd5bad Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Thu, 11 Dec 2025 13:14:24 +0800 Subject: [PATCH 149/359] choose the first library for compile --- .github/workflows/all.yml | 134 +++++++++++++++++++++----------------- 1 file changed, 75 insertions(+), 59 deletions(-) diff --git a/.github/workflows/all.yml b/.github/workflows/all.yml index 15ea73015..1b9b23883 100644 --- a/.github/workflows/all.yml +++ b/.github/workflows/all.yml @@ -24,6 +24,30 @@ on: - tvos - macos - all + first_library: + description: 'choose the first library for compile' + required: true + type: choice + default: 'unibreak' + options: + - unibreak + - fribidi + - freetype + - fontconfig + - harfbuzz + - ass + - yuv + - soundtouch + - opus + - openssl3 + - dvdread + - dvdnav + - bluray + - dav1d + - uavs3d + - smb2 + - webp + - ffmpeg7 dryrun: description: 'just run workflow,but not deploy' required: false @@ -54,66 +78,58 @@ jobs: uses: actions/checkout@v4 - name: One Step run: | - echo '------compile unibreak------------------------------------' - rm -rf build || git reset --hard || git pull origin - .github/workflows/onestep.sh unibreak ${{ inputs.platform }} ${{ inputs.dryrun }} - echo '------compile fribidi------------------------------------' - rm -rf build || git reset --hard || git pull origin - .github/workflows/onestep.sh fribidi ${{ inputs.platform }} ${{ inputs.dryrun }} - echo '------compile freetype------------------------------------' - rm -rf build || git reset --hard || git pull origin - .github/workflows/onestep.sh freetype ${{ inputs.platform }} ${{ inputs.dryrun }} - if [[ ${{ inputs.platform }} == android ]]; then - echo '------compile android fontconfig------------------------------------' + compile_lib() { + local lib_name=$1 + local platform=${{ inputs.platform }} + local dryrun=${{ inputs.dryrun }} + + echo "------compile $lib_name------------------------------------" rm -rf build || git reset --hard || git pull origin - .github/workflows/install-dependencies.sh fontconfig android - .github/workflows/onestep.sh fontconfig android ${{ inputs.dryrun }} + .github/workflows/install-dependencies.sh $lib_name $platform # 补全依赖安装步骤 + .github/workflows/onestep.sh $lib_name $platform $dryrun + } + + libs=( + "unibreak" + "fribidi" + "freetype" + "fontconfig" + "harfbuzz" + "ass" + "yuv" + "soundtouch" + "opus" + "openssl3" + "dvdread" + "dvdnav" + "bluray" + "dav1d" + "uavs3d" + "smb2" + "webp" + "ffmpeg7" + ) + + first=${{ inputs.first_library }} + echo "------compile from $first------------------------------------" + # 找到first_library在数组中的索引 + start_index=-1 + for i in "${!libs[@]}"; do + if [[ "${libs[$i]}" == "$first" ]]; then + start_index=$i + break + fi + done + # 如果找到了first_library,则调整数组顺序 + if [[ $start_index -ne -1 ]]; then + libs=("${libs[@]:$start_index}" "${libs[@]:0:$start_index}") + else + echo "Warning: first_library $first not found in the library list." fi - echo '------compile harfbuzz------------------------------------' - rm -rf build || git reset --hard || git pull origin - .github/workflows/install-dependencies.sh harfbuzz ${{ inputs.platform }} - .github/workflows/onestep.sh harfbuzz ${{ inputs.platform }} ${{ inputs.dryrun }} - echo '------compile ass------------------------------------' - rm -rf build || git reset --hard || git pull origin - .github/workflows/install-dependencies.sh ass ${{ inputs.platform }} - .github/workflows/onestep.sh ass ${{ inputs.platform }} ${{ inputs.dryrun }} - echo '------compile yuv------------------------------------' - rm -rf build || git reset --hard || git pull origin - .github/workflows/onestep.sh yuv ${{ inputs.platform }} ${{ inputs.dryrun }} - echo '------compile soundtouch------------------------------------' - rm -rf build || git reset --hard || git pull origin - .github/workflows/onestep.sh soundtouch ${{ inputs.platform }} ${{ inputs.dryrun }} - echo '------compile opus------------------------------------' - rm -rf build || git reset --hard || git pull origin - .github/workflows/onestep.sh opus ${{ inputs.platform }} ${{ inputs.dryrun }} - echo '------compile openssl3------------------------------------' - rm -rf build || git reset --hard || git pull origin - .github/workflows/onestep.sh openssl3 ${{ inputs.platform }} ${{ inputs.dryrun }} - echo '------compile dvdread------------------------------------' - rm -rf build || git reset --hard || git pull origin - .github/workflows/onestep.sh dvdread ${{ inputs.platform }} ${{ inputs.dryrun }} - echo '------compile dvdnav------------------------------------' - rm -rf build || git reset --hard || git pull origin - .github/workflows/onestep.sh dvdnav ${{ inputs.platform }} ${{ inputs.dryrun }} - echo '------compile bluray------------------------------------' - rm -rf build || git reset --hard || git pull origin - .github/workflows/install-dependencies.sh bluray ${{ inputs.platform }} - .github/workflows/onestep.sh bluray ${{ inputs.platform }} ${{ inputs.dryrun }} - echo '------compile dav1d------------------------------------' - rm -rf build || git reset --hard || git pull origin - .github/workflows/onestep.sh dav1d ${{ inputs.platform }} ${{ inputs.dryrun }} - echo '------compile uavs3d------------------------------------' - rm -rf build || git reset --hard || git pull origin - .github/workflows/onestep.sh uavs3d ${{ inputs.platform }} ${{ inputs.dryrun }} - echo '------compile smb2------------------------------------' - rm -rf build || git reset --hard || git pull origin - .github/workflows/onestep.sh smb2 ${{ inputs.platform }} ${{ inputs.dryrun }} - echo '------compile webp------------------------------------' - rm -rf build || git reset --hard || git pull origin - .github/workflows/onestep.sh webp ${{ inputs.platform }} ${{ inputs.dryrun }} - echo '------compile ffmpeg7------------------------------------' - rm -rf build || git reset --hard || git pull origin - .github/workflows/install-dependencies.sh ffmpeg7 ${{ inputs.platform }} - .github/workflows/onestep.sh ffmpeg7 ${{ inputs.platform }} ${{ inputs.dryrun }} + + # 循环遍历所有库执行编译 + for lib in "${libs[@]}"; do + compile_lib "$lib" + done env: ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} From 38bcbf5c15833161a66f8869125cb4ce46a969c5 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Thu, 11 Dec 2025 13:15:33 +0800 Subject: [PATCH 150/359] soundtouch upgrade to 2.4.0 --- README.md | 2 +- README_zh-CN.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0c0093786..03769f1ff 100644 --- a/README.md +++ b/README.md @@ -139,7 +139,7 @@ If cloning repositories from GitHub is slow, or if you need to use an internal p | openssl3 | 3.5.0 | https://github.com/openssl/openssl.git | export GIT_OPENSSL_UPSTREAM=git@xx:yy/openssl.git | | opus | 1.5.2 | https://gitlab.xiph.org/xiph/opus.git | export GIT_OPUS_UPSTREAM=git@xx:yy/opus.git | | smb2 | 6.2 | https://github.com/sahlberg/libsmb2.git | export GIT_SMB2_UPSTREAM=git@xx:yy/libsmb2.git | -| soundtouch | 2.3.3 | https://codeberg.org/soundtouch/soundtouch.git | export GIT_SOUNDTOUCH_UPSTREAM=git@xx:yy/soundtouch.git | +| soundtouch | 2.4.0 | https://codeberg.org/soundtouch/soundtouch.git | export GIT_SOUNDTOUCH_UPSTREAM=git@xx:yy/soundtouch.git | | unibreak | 6.1 | https://github.com/adah1972/libunibreak.git | export GIT_UNIBREAK_UPSTREAM=git@xx:yy/libunibreak.git | | uavs3d | 1.2.1 | https://github.com/uavs3/uavs3d.git | export GIT_UAVS3D_UPSTREAM=git@xx:yy/UAVS3D.git | | xml2 | 2.13.6 | https://github.com/GNOME/libxml2.git | export GIT_FONTCONFIG_UPSTREAM=git@xx:yy/fontconfig.git | diff --git a/README_zh-CN.md b/README_zh-CN.md index b714f066d..b78e2f9b4 100644 --- a/README_zh-CN.md +++ b/README_zh-CN.md @@ -141,7 +141,7 @@ MRFFToolChain 是一套成熟的编译工具,专门用来编译 iOS、macOS、 | openssl3 | 3.5.0 | https://github.com/openssl/openssl.git | export GIT_OPENSSL_UPSTREAM=git@xx:yy/openssl.git | | opus | 1.5.2 | https://gitlab.xiph.org/xiph/opus.git | export GIT_OPUS_UPSTREAM=git@xx:yy/opus.git | | smb2 | 6.2 | https://github.com/sahlberg/libsmb2.git | export GIT_SMB2_UPSTREAM=git@xx:yy/libsmb2.git | -| soundtouch | 2.3.3 | https://codeberg.org/soundtouch/soundtouch.git | export GIT_SOUNDTOUCH_UPSTREAM=git@xx:yy/soundtouch.git | +| soundtouch | 2.4.0 | https://codeberg.org/soundtouch/soundtouch.git | export GIT_SOUNDTOUCH_UPSTREAM=git@xx:yy/soundtouch.git | | unibreak | 6.1 | https://github.com/adah1972/libunibreak.git | export GIT_UNIBREAK_UPSTREAM=git@xx:yy/libunibreak.git | | uavs3d | 1.2.1 | https://github.com/uavs3/uavs3d.git | export GIT_UAVS3D_UPSTREAM=git@xx:yy/UAVS3D.git | | xml2 | 2.13.6 | https://github.com/GNOME/libxml2.git | export GIT_FONTCONFIG_UPSTREAM=git@xx:yy/fontconfig.git | From 2ac0dab8e9f58f03085f61e65ea676edebd079a7 Mon Sep 17 00:00:00 2001 From: Anka Date: Thu, 11 Dec 2025 05:23:59 +0000 Subject: [PATCH 151/359] upgrade opus to opus-1.5.2-251211131634 for all by cd --- configs/libs/opus.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/opus.sh b/configs/libs/opus.sh index deb032bf8..2ec1427de 100644 --- a/configs/libs/opus.sh +++ b/configs/libs/opus.sh @@ -39,7 +39,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=opus-1.5.2-250226212130 -export PRE_COMPILE_TAG_MACOS=opus-1.5.2-250226210054 -export PRE_COMPILE_TAG_IOS=opus-1.5.2-250226175406 -export PRE_COMPILE_TAG_ANDROID=opus-1.5.2-250310112341 +export PRE_COMPILE_TAG_TVOS=opus-1.5.2-251211131634 +export PRE_COMPILE_TAG_MACOS=opus-1.5.2-251211131634 +export PRE_COMPILE_TAG_IOS=opus-1.5.2-251211131634 +export PRE_COMPILE_TAG_ANDROID=opus-1.5.2-251211131634 From e8fd91a8ce77e9927408fb22b95aa9c780061286 Mon Sep 17 00:00:00 2001 From: Anka Date: Thu, 11 Dec 2025 05:41:41 +0000 Subject: [PATCH 152/359] upgrade openssl3 to openssl3-3.5.0-251211132408 for all by cd --- configs/libs/openssl3.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/openssl3.sh b/configs/libs/openssl3.sh index c1587a8f0..b82b6de3a 100644 --- a/configs/libs/openssl3.sh +++ b/configs/libs/openssl3.sh @@ -30,7 +30,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=openssl3-3.5.0-250605155209 -export PRE_COMPILE_TAG_MACOS=openssl3-3.5.0-250605155209 -export PRE_COMPILE_TAG_IOS=openssl3-3.5.0-250605155209 -export PRE_COMPILE_TAG_ANDROID=openssl3-3.5.0-250606110346 +export PRE_COMPILE_TAG_TVOS=openssl3-3.5.0-251211132408 +export PRE_COMPILE_TAG_MACOS=openssl3-3.5.0-251211132408 +export PRE_COMPILE_TAG_IOS=openssl3-3.5.0-251211132408 +export PRE_COMPILE_TAG_ANDROID=openssl3-3.5.0-251211132408 From 2aefb4bee68e412fe12f1916d284ca3044889f0a Mon Sep 17 00:00:00 2001 From: Anka Date: Thu, 11 Dec 2025 05:44:13 +0000 Subject: [PATCH 153/359] upgrade dvdread to dvdread-6.1.3-251211134153 for all by cd --- configs/libs/dvdread.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/dvdread.sh b/configs/libs/dvdread.sh index 115dee5ef..833cb448c 100644 --- a/configs/libs/dvdread.sh +++ b/configs/libs/dvdread.sh @@ -38,7 +38,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=dvdread-6.1.3-250226212540 -export PRE_COMPILE_TAG_MACOS=dvdread-6.1.3-250226210420 -export PRE_COMPILE_TAG_IOS=dvdread-6.1.3-250226175845 -export PRE_COMPILE_TAG_ANDROID=dvdread-6.1.3-250310112649 +export PRE_COMPILE_TAG_TVOS=dvdread-6.1.3-251211134153 +export PRE_COMPILE_TAG_MACOS=dvdread-6.1.3-251211134153 +export PRE_COMPILE_TAG_IOS=dvdread-6.1.3-251211134153 +export PRE_COMPILE_TAG_ANDROID=dvdread-6.1.3-251211134153 From 39c3c3300a8a003ed0ac053f879e282b0618d35c Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Thu, 11 Dec 2025 14:04:20 +0800 Subject: [PATCH 154/359] add licence --- LICENCE | 21 +++++++++++++++++++++ README.md | 8 +++----- README_zh-CN.md | 6 ++---- 3 files changed, 26 insertions(+), 9 deletions(-) create mode 100644 LICENCE diff --git a/LICENCE b/LICENCE new file mode 100644 index 000000000..d8cc959d7 --- /dev/null +++ b/LICENCE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) [2020] [debugly] + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md index 03769f1ff..d54215807 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ## MRFFToolChain Build Shell [[中文版](./README_zh-CN.md)] -![](https://img.shields.io/github/downloads/debugly/MRFFToolChainBuildShell/total) +![](https://img.shields.io/github/downloads/debugly/MRFFToolChainBuildShell/total) **What's MRFFToolChain?** @@ -19,11 +19,9 @@ At present MRFFToolChain contained `ass、bluray、dav1d、dvdread、dvdnav、ff ## News -- FFmpeg 7.1.1 is already in use +- FFmpeg **7.1.1** is already in use - upgrade all libs to lastest,Improved optimizations -- using macOS 14,Xcode_15.4,remove bitcode support - -[https://developer.apple.com/documentation/xcode-release-notes/xcode-14-release-notes#Deprecations](https://developer.apple.com/documentation/xcode-release-notes/xcode-14-release-notes#Deprecations) +- using macOS 15,Xcode_16.4 ## Denpendency diff --git a/README_zh-CN.md b/README_zh-CN.md index b78e2f9b4..9aeaff0eb 100644 --- a/README_zh-CN.md +++ b/README_zh-CN.md @@ -1,6 +1,6 @@ ## MRFFToolChain 构建脚本 -![](https://img.shields.io/github/downloads/debugly/MRFFToolChainBuildShell/total) +![](https://img.shields.io/github/downloads/debugly/MRFFToolChainBuildShell/total) **MRFFToolChain 是什么?** @@ -21,9 +21,7 @@ MRFFToolChain 是一套成熟的编译工具,专门用来编译 iOS、macOS、 - FFmpeg **7.1.1** 已投入使用 - 将所有库升级至最新版本,不少库提升了性能 -- 使用 macOS 14,Xcode_15.4构建,移除了 bitcode 支持 - -[https://developer.apple.com/documentation/xcode-release-notes/xcode-14-release-notes#Deprecations](https://developer.apple.com/documentation/xcode-release-notes/xcode-14-release-notes#Deprecations) +- 使用 macOS 15,Xcode_16.4构建 ## 依赖关系 From 0639f6504d62fa7be226dc4414d438115a10e011 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Thu, 11 Dec 2025 14:06:56 +0800 Subject: [PATCH 155/359] update shell --- .github/workflows/all.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/all.yml b/.github/workflows/all.yml index 1b9b23883..66387d35d 100644 --- a/.github/workflows/all.yml +++ b/.github/workflows/all.yml @@ -78,12 +78,14 @@ jobs: uses: actions/checkout@v4 - name: One Step run: | + + local platform=${{ inputs.platform }} + local dryrun=${{ inputs.dryrun }} + compile_lib() { local lib_name=$1 - local platform=${{ inputs.platform }} - local dryrun=${{ inputs.dryrun }} - - echo "------compile $lib_name------------------------------------" + + echo "------compile $platform $lib_name------------------------------------" rm -rf build || git reset --hard || git pull origin .github/workflows/install-dependencies.sh $lib_name $platform # 补全依赖安装步骤 .github/workflows/onestep.sh $lib_name $platform $dryrun From 7447f91c666e8ed7d1e6ea00fa47b4d9a41c93c4 Mon Sep 17 00:00:00 2001 From: Matt Reach Date: Thu, 11 Dec 2025 14:22:16 +0800 Subject: [PATCH 156/359] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20all.yml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/all.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/all.yml b/.github/workflows/all.yml index 66387d35d..d973250d2 100644 --- a/.github/workflows/all.yml +++ b/.github/workflows/all.yml @@ -79,16 +79,16 @@ jobs: - name: One Step run: | - local platform=${{ inputs.platform }} - local dryrun=${{ inputs.dryrun }} + Platform=${{ inputs.platform }} + DryRun=${{ inputs.dryrun }} compile_lib() { local lib_name=$1 - echo "------compile $platform $lib_name------------------------------------" + echo "------compile $Platform $lib_name------------------------------------" rm -rf build || git reset --hard || git pull origin - .github/workflows/install-dependencies.sh $lib_name $platform # 补全依赖安装步骤 - .github/workflows/onestep.sh $lib_name $platform $dryrun + .github/workflows/install-dependencies.sh $lib_name $Platform # 补全依赖安装步骤 + .github/workflows/onestep.sh $lib_name $platform $DryRun } libs=( From 61bf64faaf57bdba3d14c27030430bec5faa5938 Mon Sep 17 00:00:00 2001 From: Matt Reach Date: Thu, 11 Dec 2025 14:23:08 +0800 Subject: [PATCH 157/359] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20all.yml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/all.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/all.yml b/.github/workflows/all.yml index d973250d2..60039a13c 100644 --- a/.github/workflows/all.yml +++ b/.github/workflows/all.yml @@ -88,7 +88,7 @@ jobs: echo "------compile $Platform $lib_name------------------------------------" rm -rf build || git reset --hard || git pull origin .github/workflows/install-dependencies.sh $lib_name $Platform # 补全依赖安装步骤 - .github/workflows/onestep.sh $lib_name $platform $DryRun + .github/workflows/onestep.sh $lib_name $Platform $DryRun } libs=( From db74af35c966e67f29c7c73e5074b6ca6bd8dcb6 Mon Sep 17 00:00:00 2001 From: debugly Date: Mon, 15 Dec 2025 22:41:35 +0800 Subject: [PATCH 158/359] fix "platform must be: [ios|macos|tvos|android]" --- .github/workflows/install-dependencies.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/install-dependencies.sh b/.github/workflows/install-dependencies.sh index 35700beb2..e444be075 100755 --- a/.github/workflows/install-dependencies.sh +++ b/.github/workflows/install-dependencies.sh @@ -172,7 +172,18 @@ case $LIB_NAME in fi ;; dvdnav) - ./main.sh install -l 'dvdread' -p $PLAT + if [[ $PLAT == all ]];then + ./main.sh install -l 'dvdread' -p ios + ./main.sh install -l 'dvdread' -p tvos + ./main.sh install -l 'dvdread' -p macos + ./main.sh install -l 'dvdread' -p android + elif [[ $PLAT == apple ]];then + ./main.sh install -l 'dvdread' -p ios + ./main.sh install -l 'dvdread' -p tvos + ./main.sh install -l 'dvdread' -p macos + else + ./main.sh install -l 'dvdread' -p $PLAT + fi ;; *) ;; From 65595d163035b88398b549642adb608a1f45e67d Mon Sep 17 00:00:00 2001 From: Anka Date: Mon, 15 Dec 2025 14:46:34 +0000 Subject: [PATCH 159/359] upgrade dvdnav to dvdnav-9831fe01-251215224306 for all by cd --- configs/libs/dvdnav.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/dvdnav.sh b/configs/libs/dvdnav.sh index fad3308cf..e31f92b32 100644 --- a/configs/libs/dvdnav.sh +++ b/configs/libs/dvdnav.sh @@ -38,7 +38,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=dvdnav-9831fe01-250603094852 -export PRE_COMPILE_TAG_MACOS=dvdnav-9831fe01-250529152421 -export PRE_COMPILE_TAG_IOS=dvdnav-9831fe01-250603094547 -export PRE_COMPILE_TAG_ANDROID=dvdnav-9831fe01-250606131218 +export PRE_COMPILE_TAG_TVOS=dvdnav-9831fe01-251215224306 +export PRE_COMPILE_TAG_MACOS=dvdnav-9831fe01-251215224306 +export PRE_COMPILE_TAG_IOS=dvdnav-9831fe01-251215224306 +export PRE_COMPILE_TAG_ANDROID=dvdnav-9831fe01-251215224306 From f01cd6a8028201afdb7058bcd969ec76bfb7caec Mon Sep 17 00:00:00 2001 From: debugly Date: Mon, 15 Dec 2025 22:56:22 +0800 Subject: [PATCH 160/359] add more libs --- .github/workflows/all.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/all.yml b/.github/workflows/all.yml index 60039a13c..4a444b9d8 100644 --- a/.github/workflows/all.yml +++ b/.github/workflows/all.yml @@ -7,7 +7,7 @@ on: description: 'macos version' required: false type: choice - default: 'macos-14' + default: 'macos-15' options: - macos-13 - macos-14 @@ -30,6 +30,7 @@ on: type: choice default: 'unibreak' options: + - xml2 - unibreak - fribidi - freetype @@ -47,6 +48,11 @@ on: - uavs3d - smb2 - webp + - ijkffmpeg + - fftutorial + - ffmpeg4 + - ffmpeg5 + - ffmpeg6 - ffmpeg7 dryrun: description: 'just run workflow,but not deploy' From 47d351d9d320ae0e22388423f9779c56eb6262b7 Mon Sep 17 00:00:00 2001 From: debugly Date: Mon, 15 Dec 2025 23:02:57 +0800 Subject: [PATCH 161/359] add more libs --- .github/workflows/all.yml | 42 ++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/.github/workflows/all.yml b/.github/workflows/all.yml index 4a444b9d8..6f751ab9d 100644 --- a/.github/workflows/all.yml +++ b/.github/workflows/all.yml @@ -28,7 +28,7 @@ on: description: 'choose the first library for compile' required: true type: choice - default: 'unibreak' + default: 'xml2' options: - xml2 - unibreak @@ -98,23 +98,29 @@ jobs: } libs=( - "unibreak" - "fribidi" - "freetype" - "fontconfig" - "harfbuzz" - "ass" - "yuv" - "soundtouch" - "opus" - "openssl3" - "dvdread" - "dvdnav" - "bluray" - "dav1d" - "uavs3d" - "smb2" - "webp" + "xml2", + "unibreak", + "fribidi", + "freetype", + "fontconfig", + "harfbuzz", + "ass", + "yuv", + "soundtouch", + "opus", + "openssl3", + "dvdread", + "dvdnav", + "bluray", + "dav1d", + "uavs3d", + "smb2", + "webp", + "ijkffmpeg", + "fftutorial", + "ffmpeg4", + "ffmpeg5", + "ffmpeg6", "ffmpeg7" ) From 78e4609851eaa0211357ebafc017ebe781e8a842 Mon Sep 17 00:00:00 2001 From: debugly Date: Mon, 15 Dec 2025 23:06:14 +0800 Subject: [PATCH 162/359] fix mistake --- .github/workflows/all.yml | 46 +++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/.github/workflows/all.yml b/.github/workflows/all.yml index 6f751ab9d..17dc55441 100644 --- a/.github/workflows/all.yml +++ b/.github/workflows/all.yml @@ -98,29 +98,29 @@ jobs: } libs=( - "xml2", - "unibreak", - "fribidi", - "freetype", - "fontconfig", - "harfbuzz", - "ass", - "yuv", - "soundtouch", - "opus", - "openssl3", - "dvdread", - "dvdnav", - "bluray", - "dav1d", - "uavs3d", - "smb2", - "webp", - "ijkffmpeg", - "fftutorial", - "ffmpeg4", - "ffmpeg5", - "ffmpeg6", + "xml2" + "unibreak" + "fribidi" + "freetype" + "fontconfig" + "harfbuzz" + "ass" + "yuv" + "soundtouch" + "opus" + "openssl3" + "dvdread" + "dvdnav" + "bluray" + "dav1d" + "uavs3d" + "smb2" + "webp" + "ijkffmpeg" + "fftutorial" + "ffmpeg4" + "ffmpeg5" + "ffmpeg6" "ffmpeg7" ) From f64a290972e6240a831afbd4db22c7e98ee7d6bd Mon Sep 17 00:00:00 2001 From: Anka Date: Mon, 15 Dec 2025 15:13:53 +0000 Subject: [PATCH 163/359] upgrade xml2 to xml2-2.13.6-251215230743 for all by cd --- configs/libs/xml2.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/xml2.sh b/configs/libs/xml2.sh index fdff88324..557ae0651 100644 --- a/configs/libs/xml2.sh +++ b/configs/libs/xml2.sh @@ -38,7 +38,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=xml2-2.13.6-250225111236 -export PRE_COMPILE_TAG_MACOS=xml2-2.13.6-250225111236 -export PRE_COMPILE_TAG_IOS=xml2-2.13.6-250225111236 -export PRE_COMPILE_TAG_ANDROID=xml2-2.13.6-250225111236 +export PRE_COMPILE_TAG_TVOS=xml2-2.13.6-251215230743 +export PRE_COMPILE_TAG_MACOS=xml2-2.13.6-251215230743 +export PRE_COMPILE_TAG_IOS=xml2-2.13.6-251215230743 +export PRE_COMPILE_TAG_ANDROID=xml2-2.13.6-251215230743 From 7e032a5873e749b3679fdc7b4c723b1dcf44c053 Mon Sep 17 00:00:00 2001 From: Anka Date: Mon, 15 Dec 2025 15:17:33 +0000 Subject: [PATCH 164/359] upgrade unibreak to unibreak-6.1-251215231407 for all by cd --- configs/libs/unibreak.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/unibreak.sh b/configs/libs/unibreak.sh index f45f5b6ff..4ff26e66e 100644 --- a/configs/libs/unibreak.sh +++ b/configs/libs/unibreak.sh @@ -38,7 +38,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=unibreak-6.1-251210220106 -export PRE_COMPILE_TAG_MACOS=unibreak-6.1-251210220106 -export PRE_COMPILE_TAG_IOS=unibreak-6.1-251210220106 -export PRE_COMPILE_TAG_ANDROID=unibreak-6.1-250310111549 +export PRE_COMPILE_TAG_TVOS=unibreak-6.1-251215231407 +export PRE_COMPILE_TAG_MACOS=unibreak-6.1-251215231407 +export PRE_COMPILE_TAG_IOS=unibreak-6.1-251215231407 +export PRE_COMPILE_TAG_ANDROID=unibreak-6.1-251215231407 From 2d4e21c09e3d63aadc7f47b0384dedbdf3b93938 Mon Sep 17 00:00:00 2001 From: Anka Date: Mon, 15 Dec 2025 15:18:55 +0000 Subject: [PATCH 165/359] upgrade fribidi to fribidi-1.0.16-251215231739 for all by cd --- configs/libs/fribidi.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/fribidi.sh b/configs/libs/fribidi.sh index 3f83d97e8..436f3bdfc 100644 --- a/configs/libs/fribidi.sh +++ b/configs/libs/fribidi.sh @@ -38,7 +38,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=fribidi-1.0.16-251210220611 -export PRE_COMPILE_TAG_MACOS=fribidi-1.0.16-251210220611 -export PRE_COMPILE_TAG_IOS=fribidi-1.0.16-251210220611 -export PRE_COMPILE_TAG_ANDROID=fribidi-1.0.16-250310111706 +export PRE_COMPILE_TAG_TVOS=fribidi-1.0.16-251215231739 +export PRE_COMPILE_TAG_MACOS=fribidi-1.0.16-251215231739 +export PRE_COMPILE_TAG_IOS=fribidi-1.0.16-251215231739 +export PRE_COMPILE_TAG_ANDROID=fribidi-1.0.16-251215231739 From 680c2c28441352c3f8d85727994c9ab6217923c9 Mon Sep 17 00:00:00 2001 From: Anka Date: Mon, 15 Dec 2025 15:21:28 +0000 Subject: [PATCH 166/359] upgrade freetype to freetype-2.13.3-251215231901 for all by cd --- configs/libs/freetype.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/freetype.sh b/configs/libs/freetype.sh index 072ee3f94..32ee12c47 100644 --- a/configs/libs/freetype.sh +++ b/configs/libs/freetype.sh @@ -36,7 +36,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=freetype-2.13.3-251210220726 -export PRE_COMPILE_TAG_MACOS=freetype-2.13.3-251210220726 -export PRE_COMPILE_TAG_IOS=freetype-2.13.3-251210220726 -export PRE_COMPILE_TAG_ANDROID=freetype-2.13.3-250310111735 +export PRE_COMPILE_TAG_TVOS=freetype-2.13.3-251215231901 +export PRE_COMPILE_TAG_MACOS=freetype-2.13.3-251215231901 +export PRE_COMPILE_TAG_IOS=freetype-2.13.3-251215231901 +export PRE_COMPILE_TAG_ANDROID=freetype-2.13.3-251215231901 From 58b76c018eb4adc8772e1a236fd43193583948ca Mon Sep 17 00:00:00 2001 From: Anka Date: Mon, 15 Dec 2025 23:25:54 +0000 Subject: [PATCH 167/359] upgrade harfbuzz to harfbuzz-10.2.0-251216071221 for all by cd --- configs/libs/harfbuzz.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/harfbuzz.sh b/configs/libs/harfbuzz.sh index d6ba565b1..3938a44a0 100644 --- a/configs/libs/harfbuzz.sh +++ b/configs/libs/harfbuzz.sh @@ -38,7 +38,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=harfbuzz-10.2.0-251210220921 -export PRE_COMPILE_TAG_MACOS=harfbuzz-10.2.0-251210220921 -export PRE_COMPILE_TAG_IOS=harfbuzz-10.2.0-251210220921 -export PRE_COMPILE_TAG_ANDROID=harfbuzz-10.2.0-250310111849 +export PRE_COMPILE_TAG_TVOS=harfbuzz-10.2.0-251216071221 +export PRE_COMPILE_TAG_MACOS=harfbuzz-10.2.0-251216071221 +export PRE_COMPILE_TAG_IOS=harfbuzz-10.2.0-251216071221 +export PRE_COMPILE_TAG_ANDROID=harfbuzz-10.2.0-251216071221 From f0371e18202a1d01328a6aa455f994e6c8c83dab Mon Sep 17 00:00:00 2001 From: Anka Date: Mon, 15 Dec 2025 23:27:46 +0000 Subject: [PATCH 168/359] upgrade ass to ass-0.17.3-251216072625 for all by cd --- configs/libs/ass.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/ass.sh b/configs/libs/ass.sh index 96e5c5f74..bd00b1172 100644 --- a/configs/libs/ass.sh +++ b/configs/libs/ass.sh @@ -38,7 +38,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=ass-0.17.3-251210221847 -export PRE_COMPILE_TAG_MACOS=ass-0.17.3-251210221847 -export PRE_COMPILE_TAG_IOS=ass-0.17.3-251210221847 -export PRE_COMPILE_TAG_ANDROID=ass-0.17.3-250310112227 +export PRE_COMPILE_TAG_TVOS=ass-0.17.3-251216072625 +export PRE_COMPILE_TAG_MACOS=ass-0.17.3-251216072625 +export PRE_COMPILE_TAG_IOS=ass-0.17.3-251216072625 +export PRE_COMPILE_TAG_ANDROID=ass-0.17.3-251216072625 From 2bd37d74675e1e4f6a532253876dc145e42e533e Mon Sep 17 00:00:00 2001 From: Anka Date: Mon, 15 Dec 2025 23:30:34 +0000 Subject: [PATCH 169/359] upgrade yuv to yuv-main-f94b8cf7-251216072752 for all by cd --- configs/libs/yuv.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/yuv.sh b/configs/libs/yuv.sh index d9a2bf77b..d467ca348 100644 --- a/configs/libs/yuv.sh +++ b/configs/libs/yuv.sh @@ -45,7 +45,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=yuv-main-f94b8cf7-251210222006 -export PRE_COMPILE_TAG_MACOS=yuv-main-f94b8cf7-251210222006 -export PRE_COMPILE_TAG_IOS=yuv-main-f94b8cf7-251210222006 -export PRE_COMPILE_TAG_ANDROID=yuv-stable-eb6e7bb-250310112252 \ No newline at end of file +export PRE_COMPILE_TAG_TVOS=yuv-main-f94b8cf7-251216072752 +export PRE_COMPILE_TAG_MACOS=yuv-main-f94b8cf7-251216072752 +export PRE_COMPILE_TAG_IOS=yuv-main-f94b8cf7-251216072752 +export PRE_COMPILE_TAG_ANDROID=yuv-main-f94b8cf7-251216072752 \ No newline at end of file From 4ac63ee5c6eff0dd4d0f9d687401e13dd5402555 Mon Sep 17 00:00:00 2001 From: Anka Date: Mon, 15 Dec 2025 23:33:35 +0000 Subject: [PATCH 170/359] upgrade soundtouch to soundtouch-2.4.0-251216073041 for all by cd --- configs/libs/soundtouch.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/soundtouch.sh b/configs/libs/soundtouch.sh index 0a0bc5878..ece0f8498 100644 --- a/configs/libs/soundtouch.sh +++ b/configs/libs/soundtouch.sh @@ -40,7 +40,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=soundtouch-2.4.0-251211125010 -export PRE_COMPILE_TAG_MACOS=soundtouch-2.4.0-251211125010 -export PRE_COMPILE_TAG_IOS=soundtouch-2.4.0-251211125010 -export PRE_COMPILE_TAG_ANDROID=soundtouch-2.4.0-251211125721 +export PRE_COMPILE_TAG_TVOS=soundtouch-2.4.0-251216073041 +export PRE_COMPILE_TAG_MACOS=soundtouch-2.4.0-251216073041 +export PRE_COMPILE_TAG_IOS=soundtouch-2.4.0-251216073041 +export PRE_COMPILE_TAG_ANDROID=soundtouch-2.4.0-251216073041 From 5b785f3e46ae150130a0f3fa40efecdd3cd3845a Mon Sep 17 00:00:00 2001 From: Anka Date: Mon, 15 Dec 2025 23:42:47 +0000 Subject: [PATCH 171/359] upgrade opus to opus-1.5.2-251216073342 for all by cd --- configs/libs/opus.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/opus.sh b/configs/libs/opus.sh index 2ec1427de..1306de527 100644 --- a/configs/libs/opus.sh +++ b/configs/libs/opus.sh @@ -39,7 +39,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=opus-1.5.2-251211131634 -export PRE_COMPILE_TAG_MACOS=opus-1.5.2-251211131634 -export PRE_COMPILE_TAG_IOS=opus-1.5.2-251211131634 -export PRE_COMPILE_TAG_ANDROID=opus-1.5.2-251211131634 +export PRE_COMPILE_TAG_TVOS=opus-1.5.2-251216073342 +export PRE_COMPILE_TAG_MACOS=opus-1.5.2-251216073342 +export PRE_COMPILE_TAG_IOS=opus-1.5.2-251216073342 +export PRE_COMPILE_TAG_ANDROID=opus-1.5.2-251216073342 From 393b45abb13d85d43d6a35af86405ad88f8c0d58 Mon Sep 17 00:00:00 2001 From: Anka Date: Tue, 16 Dec 2025 00:04:24 +0000 Subject: [PATCH 172/359] upgrade openssl3 to openssl3-3.5.0-251216074256 for all by cd --- configs/libs/openssl3.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/openssl3.sh b/configs/libs/openssl3.sh index b82b6de3a..1c42cda54 100644 --- a/configs/libs/openssl3.sh +++ b/configs/libs/openssl3.sh @@ -30,7 +30,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=openssl3-3.5.0-251211132408 -export PRE_COMPILE_TAG_MACOS=openssl3-3.5.0-251211132408 -export PRE_COMPILE_TAG_IOS=openssl3-3.5.0-251211132408 -export PRE_COMPILE_TAG_ANDROID=openssl3-3.5.0-251211132408 +export PRE_COMPILE_TAG_TVOS=openssl3-3.5.0-251216074256 +export PRE_COMPILE_TAG_MACOS=openssl3-3.5.0-251216074256 +export PRE_COMPILE_TAG_IOS=openssl3-3.5.0-251216074256 +export PRE_COMPILE_TAG_ANDROID=openssl3-3.5.0-251216074256 From 1f260abd63ff27328879393e95a4845016cd2366 Mon Sep 17 00:00:00 2001 From: Anka Date: Tue, 16 Dec 2025 00:07:02 +0000 Subject: [PATCH 173/359] upgrade dvdread to dvdread-6.1.3-251216080439 for all by cd --- configs/libs/dvdread.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/dvdread.sh b/configs/libs/dvdread.sh index 833cb448c..d33c23e64 100644 --- a/configs/libs/dvdread.sh +++ b/configs/libs/dvdread.sh @@ -38,7 +38,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=dvdread-6.1.3-251211134153 -export PRE_COMPILE_TAG_MACOS=dvdread-6.1.3-251211134153 -export PRE_COMPILE_TAG_IOS=dvdread-6.1.3-251211134153 -export PRE_COMPILE_TAG_ANDROID=dvdread-6.1.3-251211134153 +export PRE_COMPILE_TAG_TVOS=dvdread-6.1.3-251216080439 +export PRE_COMPILE_TAG_MACOS=dvdread-6.1.3-251216080439 +export PRE_COMPILE_TAG_IOS=dvdread-6.1.3-251216080439 +export PRE_COMPILE_TAG_ANDROID=dvdread-6.1.3-251216080439 From 4fef91f18bf93c9b11b2ab912ce02b588ba08cbe Mon Sep 17 00:00:00 2001 From: Anka Date: Tue, 16 Dec 2025 00:09:32 +0000 Subject: [PATCH 174/359] upgrade dvdnav to dvdnav-9831fe01-251216080712 for all by cd --- configs/libs/dvdnav.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/dvdnav.sh b/configs/libs/dvdnav.sh index e31f92b32..790abecf6 100644 --- a/configs/libs/dvdnav.sh +++ b/configs/libs/dvdnav.sh @@ -38,7 +38,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=dvdnav-9831fe01-251215224306 -export PRE_COMPILE_TAG_MACOS=dvdnav-9831fe01-251215224306 -export PRE_COMPILE_TAG_IOS=dvdnav-9831fe01-251215224306 -export PRE_COMPILE_TAG_ANDROID=dvdnav-9831fe01-251215224306 +export PRE_COMPILE_TAG_TVOS=dvdnav-9831fe01-251216080712 +export PRE_COMPILE_TAG_MACOS=dvdnav-9831fe01-251216080712 +export PRE_COMPILE_TAG_IOS=dvdnav-9831fe01-251216080712 +export PRE_COMPILE_TAG_ANDROID=dvdnav-9831fe01-251216080712 From fd14671f9b92d76f367be43c26c1775b8ae0b8d7 Mon Sep 17 00:00:00 2001 From: Anka Date: Tue, 16 Dec 2025 00:14:18 +0000 Subject: [PATCH 175/359] upgrade bluray to bluray-1.3.4-251216080943 for all by cd --- configs/libs/bluray.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/bluray.sh b/configs/libs/bluray.sh index b8cff4645..956cb95fa 100644 --- a/configs/libs/bluray.sh +++ b/configs/libs/bluray.sh @@ -40,7 +40,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=bluray-1.3.4-250226212622 -export PRE_COMPILE_TAG_MACOS=bluray-1.3.4-250226210447 -export PRE_COMPILE_TAG_IOS=bluray-1.3.4-250226175920 -export PRE_COMPILE_TAG_ANDROID=bluray-1.3.4-250310112732 +export PRE_COMPILE_TAG_TVOS=bluray-1.3.4-251216080943 +export PRE_COMPILE_TAG_MACOS=bluray-1.3.4-251216080943 +export PRE_COMPILE_TAG_IOS=bluray-1.3.4-251216080943 +export PRE_COMPILE_TAG_ANDROID=bluray-1.3.4-251216080943 From 24df6f82d3eeb80dfedb91e40649e324f4edd31d Mon Sep 17 00:00:00 2001 From: Anka Date: Tue, 16 Dec 2025 00:21:55 +0000 Subject: [PATCH 176/359] upgrade dav1d to dav1d-1.5.1-251216081428 for all by cd --- configs/libs/dav1d.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/dav1d.sh b/configs/libs/dav1d.sh index b64871464..5b4fb4092 100644 --- a/configs/libs/dav1d.sh +++ b/configs/libs/dav1d.sh @@ -33,7 +33,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=dav1d-1.5.1-250226212720 -export PRE_COMPILE_TAG_MACOS=dav1d-1.5.1-250226210526 -export PRE_COMPILE_TAG_IOS=dav1d-1.5.1-250226180013 -export PRE_COMPILE_TAG_ANDROID=dav1d-1.5.1-250310112840 +export PRE_COMPILE_TAG_TVOS=dav1d-1.5.1-251216081428 +export PRE_COMPILE_TAG_MACOS=dav1d-1.5.1-251216081428 +export PRE_COMPILE_TAG_IOS=dav1d-1.5.1-251216081428 +export PRE_COMPILE_TAG_ANDROID=dav1d-1.5.1-251216081428 From 33f232eecaf77ac2000dbaa24b098a87c10480df Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Tue, 16 Dec 2025 09:29:29 +0800 Subject: [PATCH 177/359] Compatibility with CMake < 3.5 has been removed from CMake --- ...th-CMake-3.5-has-been-removed-from-C.patch | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 patches/uavs3d/0003-Compatibility-with-CMake-3.5-has-been-removed-from-C.patch diff --git a/patches/uavs3d/0003-Compatibility-with-CMake-3.5-has-been-removed-from-C.patch b/patches/uavs3d/0003-Compatibility-with-CMake-3.5-has-been-removed-from-C.patch new file mode 100644 index 000000000..89b902ca6 --- /dev/null +++ b/patches/uavs3d/0003-Compatibility-with-CMake-3.5-has-been-removed-from-C.patch @@ -0,0 +1,22 @@ +From 0ac257f96d3f48f1decd2c8e211bc9fef7fc760c Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Tue, 16 Dec 2025 09:28:45 +0800 +Subject: [PATCH] Compatibility with CMake < 3.5 has been removed from CMake + +--- + CMakeLists.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 46458c7..da6c82e 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,4 +1,4 @@ +-cmake_minimum_required(VERSION 3.1) ++cmake_minimum_required(VERSION 3.10) + + project(uavs3d) + +-- +2.50.1 (Apple Git-155) + From 8b2b8d0a9ff8e79c537450fe435eda3149600013 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Tue, 16 Dec 2025 09:31:12 +0800 Subject: [PATCH 178/359] run image add macos-26, use macos-15 by default --- .github/workflows/all.yml | 1 + .github/workflows/apple-android-common.yml | 3 ++- .github/workflows/test.yml | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/all.yml b/.github/workflows/all.yml index 17dc55441..d0e03eafb 100644 --- a/.github/workflows/all.yml +++ b/.github/workflows/all.yml @@ -12,6 +12,7 @@ on: - macos-13 - macos-14 - macos-15 + - macos-26 platform: description: 'choose a platform for compile' required: false diff --git a/.github/workflows/apple-android-common.yml b/.github/workflows/apple-android-common.yml index 845cbe3a9..70fbdf095 100644 --- a/.github/workflows/apple-android-common.yml +++ b/.github/workflows/apple-android-common.yml @@ -9,11 +9,12 @@ on: description: 'macos version' required: false type: choice - default: 'macos-14' + default: 'macos-15' options: - macos-13 - macos-14 - macos-15 + - macos-26 platform: description: 'choose a platform for compile' required: false diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 064ebf81b..6e3de1b6b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,7 +10,7 @@ name: Test Release jobs: build: name: compile none then deploy - runs-on: macos-14 + runs-on: macos-15 env: GH_TOKEN: ${{ github.token }} steps: From bb7b0a9d20692ed827a58c1b44f01ca69314865f Mon Sep 17 00:00:00 2001 From: Anka Date: Tue, 16 Dec 2025 01:36:28 +0000 Subject: [PATCH 179/359] upgrade uavs3d to uavs3d-1.2.1-251216093159 for all by cd --- configs/libs/uavs3d.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/uavs3d.sh b/configs/libs/uavs3d.sh index 6747330ca..90e3ecb10 100644 --- a/configs/libs/uavs3d.sh +++ b/configs/libs/uavs3d.sh @@ -38,7 +38,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_ANDROID=uavs3d-1.2.1-250310113007 -export PRE_COMPILE_TAG_TVOS=uavs3d-1.2.1-250226212827 -export PRE_COMPILE_TAG_MACOS=uavs3d-1.2.1-250226210618 -export PRE_COMPILE_TAG_IOS=uavs3d-1.2.1-250226180112 +export PRE_COMPILE_TAG_ANDROID=uavs3d-1.2.1-251216093159 +export PRE_COMPILE_TAG_TVOS=uavs3d-1.2.1-251216093159 +export PRE_COMPILE_TAG_MACOS=uavs3d-1.2.1-251216093159 +export PRE_COMPILE_TAG_IOS=uavs3d-1.2.1-251216093159 From 08a6c71894b83eef12f9180da08d20904f4a6fb6 Mon Sep 17 00:00:00 2001 From: Anka Date: Tue, 16 Dec 2025 01:51:52 +0000 Subject: [PATCH 180/359] upgrade smb2 to smb2-6.2-251216093637 for all by cd --- configs/libs/smb2.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/smb2.sh b/configs/libs/smb2.sh index 0f45b52ff..d8e144327 100644 --- a/configs/libs/smb2.sh +++ b/configs/libs/smb2.sh @@ -40,7 +40,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=smb2-6.2-250226212919 -export PRE_COMPILE_TAG_MACOS=smb2-6.2-250625141918 -export PRE_COMPILE_TAG_IOS=smb2-6.2-250226180157 -export PRE_COMPILE_TAG_ANDROID=smb2-6.2-250310113032 +export PRE_COMPILE_TAG_TVOS=smb2-6.2-251216093637 +export PRE_COMPILE_TAG_MACOS=smb2-6.2-251216093637 +export PRE_COMPILE_TAG_IOS=smb2-6.2-251216093637 +export PRE_COMPILE_TAG_ANDROID=smb2-6.2-251216093637 From 7078419d2258d737e7caff70d0b8cd06d7aa3623 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Tue, 16 Dec 2025 13:29:36 +0800 Subject: [PATCH 181/359] skip webp for android --- .github/workflows/all.yml | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/.github/workflows/all.yml b/.github/workflows/all.yml index d0e03eafb..8867ae5ff 100644 --- a/.github/workflows/all.yml +++ b/.github/workflows/all.yml @@ -91,7 +91,27 @@ jobs: compile_lib() { local lib_name=$1 - + + if [[ "$lib_name" == "fontconfig" ]]; then + if [[ "$Platform" == "all" ]]; then + echo "force Platform to android for fontconfig" + Platform='android' + elif [[ "$Platform" != "android" ]]; then + echo "Skip fontconfig for $Platform" + return + fi + fi + + if [[ "$lib_name" == "webp" ]]; then + if [[ "$Platform" == "android" ]]; then + echo "Skip webp for android" + return + elif [[ "$Platform" == "all" ]]; then + echo "Skip webp for android" + Platform='apple' + fi + fi + echo "------compile $Platform $lib_name------------------------------------" rm -rf build || git reset --hard || git pull origin .github/workflows/install-dependencies.sh $lib_name $Platform # 补全依赖安装步骤 From 732566f51530fc9fa62cf06b788477ca4cc61927 Mon Sep 17 00:00:00 2001 From: Anka Date: Tue, 16 Dec 2025 05:40:39 +0000 Subject: [PATCH 182/359] upgrade webp to webp-v1.6.0-251216133036 for apple by cd --- configs/libs/webp.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configs/libs/webp.sh b/configs/libs/webp.sh index 977692181..74bdd6862 100644 --- a/configs/libs/webp.sh +++ b/configs/libs/webp.sh @@ -34,7 +34,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=webp-v1.6.0-250919225145 -export PRE_COMPILE_TAG_MACOS=webp-v1.6.0-250919225145 -export PRE_COMPILE_TAG_IOS=webp-v1.6.0-250919225145 +export PRE_COMPILE_TAG_TVOS=webp-v1.6.0-251216133036 +export PRE_COMPILE_TAG_MACOS=webp-v1.6.0-251216133036 +export PRE_COMPILE_TAG_IOS=webp-v1.6.0-251216133036 export PRE_COMPILE_TAG_ANDROID= \ No newline at end of file From 6d250f40d2e14c11b4d4457c020c0dd54399ac6c Mon Sep 17 00:00:00 2001 From: Anka Date: Tue, 16 Dec 2025 05:53:34 +0000 Subject: [PATCH 183/359] upgrade ijkffmpeg to ijkffmpeg-4.0-251216134050 for apple by cd --- configs/libs/ijkffmpeg.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configs/libs/ijkffmpeg.sh b/configs/libs/ijkffmpeg.sh index 17f903ca7..5b6d8ec95 100644 --- a/configs/libs/ijkffmpeg.sh +++ b/configs/libs/ijkffmpeg.sh @@ -41,7 +41,7 @@ fi # pre compiled export PRE_COMPILE_TAG_ANDROID=ijkffmpeg-4.0-250606110858 -export PRE_COMPILE_TAG_TVOS=ijkffmpeg-4.0-250311090211 -export PRE_COMPILE_TAG_MACOS=ijkffmpeg-4.0-250311090211 -export PRE_COMPILE_TAG_IOS=ijkffmpeg-4.0-250606112050 +export PRE_COMPILE_TAG_TVOS=ijkffmpeg-4.0-251216134050 +export PRE_COMPILE_TAG_MACOS=ijkffmpeg-4.0-251216134050 +export PRE_COMPILE_TAG_IOS=ijkffmpeg-4.0-251216134050 From c56026b413213c48ae72ae2b590b4eefbef18ab0 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Tue, 16 Dec 2025 18:11:53 +0800 Subject: [PATCH 184/359] fix fftutorial build error --- do-compile/apple/fftutorial.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/do-compile/apple/fftutorial.sh b/do-compile/apple/fftutorial.sh index a0a76daed..6ee6607fa 100755 --- a/do-compile/apple/fftutorial.sh +++ b/do-compile/apple/fftutorial.sh @@ -31,7 +31,7 @@ THIS_DIR=$(DIRNAME=$(dirname "$0"); cd "$DIRNAME"; pwd) cd "$THIS_DIR" # ffmpeg config options -source $MR_SHELL_CONFIGS_DIR/ffconfig/module.sh +source $MR_SHELL_CONFIGS_DIR/ffconfig/module-lite.sh source $MR_SHELL_CONFIGS_DIR/ffconfig/auto-detect-third-libs.sh CFG_FLAGS= From e5d85ec573eb1a04ddab3432d5ca2cbfca57d86c Mon Sep 17 00:00:00 2001 From: Anka Date: Tue, 16 Dec 2025 11:15:08 +0000 Subject: [PATCH 185/359] upgrade ffmpeg4 to ffmpeg4-4.0.5-251216184429 for all by cd --- configs/libs/ffmpeg4.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/ffmpeg4.sh b/configs/libs/ffmpeg4.sh index 32c614371..c55f7248a 100644 --- a/configs/libs/ffmpeg4.sh +++ b/configs/libs/ffmpeg4.sh @@ -36,7 +36,7 @@ export GIT_COMMIT=n4.0.5 export GIT_REPO_VERSION=4.0.5 # pre compiled -export PRE_COMPILE_TAG_TVOS=ffmpeg4-4.0.5-250610182859 -export PRE_COMPILE_TAG_MACOS=ffmpeg4-4.0.5-250610182859 -export PRE_COMPILE_TAG_IOS=ffmpeg4-4.0.5-250610182859 -export PRE_COMPILE_TAG_ANDROID=ffmpeg4-4.0.5-250606131114 \ No newline at end of file +export PRE_COMPILE_TAG_TVOS=ffmpeg4-4.0.5-251216184429 +export PRE_COMPILE_TAG_MACOS=ffmpeg4-4.0.5-251216184429 +export PRE_COMPILE_TAG_IOS=ffmpeg4-4.0.5-251216184429 +export PRE_COMPILE_TAG_ANDROID=ffmpeg4-4.0.5-251216184429 \ No newline at end of file From e2df8894fc034e492d63d38ec1d17cdc8ec85a5d Mon Sep 17 00:00:00 2001 From: Anka Date: Tue, 16 Dec 2025 11:43:42 +0000 Subject: [PATCH 186/359] upgrade ffmpeg5 to ffmpeg5-5.1.6-251216191558 for all by cd --- configs/libs/ffmpeg5.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/ffmpeg5.sh b/configs/libs/ffmpeg5.sh index 9c98463c4..dc401cd85 100644 --- a/configs/libs/ffmpeg5.sh +++ b/configs/libs/ffmpeg5.sh @@ -36,7 +36,7 @@ export GIT_COMMIT=n5.1.6 export GIT_REPO_VERSION=5.1.6 # pre compiled -export PRE_COMPILE_TAG_TVOS=ffmpeg5-5.1.6-250623101211 -export PRE_COMPILE_TAG_MACOS=ffmpeg5-5.1.6-250623101211 -export PRE_COMPILE_TAG_IOS=ffmpeg5-5.1.6-250623101211 -export PRE_COMPILE_TAG_ANDROID=ffmpeg5-5.1.6-250606140646 \ No newline at end of file +export PRE_COMPILE_TAG_TVOS=ffmpeg5-5.1.6-251216191558 +export PRE_COMPILE_TAG_MACOS=ffmpeg5-5.1.6-251216191558 +export PRE_COMPILE_TAG_IOS=ffmpeg5-5.1.6-251216191558 +export PRE_COMPILE_TAG_ANDROID=ffmpeg5-5.1.6-251216191558 \ No newline at end of file From 2b606035b7bceac0c1631a2e2e0d73a2f6edea56 Mon Sep 17 00:00:00 2001 From: Anka Date: Tue, 16 Dec 2025 12:06:52 +0000 Subject: [PATCH 187/359] upgrade ffmpeg6 to ffmpeg6-6.1.1-251216194428 for all by cd --- configs/libs/ffmpeg6.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/ffmpeg6.sh b/configs/libs/ffmpeg6.sh index 1e43a11fa..0f52650c1 100644 --- a/configs/libs/ffmpeg6.sh +++ b/configs/libs/ffmpeg6.sh @@ -36,7 +36,7 @@ export GIT_COMMIT=n6.1.1 #origin/release/5.1 export GIT_REPO_VERSION=6.1.1 # pre compiled -export PRE_COMPILE_TAG_TVOS=ffmpeg6-6.1.1-250623102829 -export PRE_COMPILE_TAG_MACOS=ffmpeg6-6.1.1-250623102829 -export PRE_COMPILE_TAG_IOS=ffmpeg6-6.1.1-250623102829 -export PRE_COMPILE_TAG_ANDROID=ffmpeg6-6.1.1-250606143448 \ No newline at end of file +export PRE_COMPILE_TAG_TVOS=ffmpeg6-6.1.1-251216194428 +export PRE_COMPILE_TAG_MACOS=ffmpeg6-6.1.1-251216194428 +export PRE_COMPILE_TAG_IOS=ffmpeg6-6.1.1-251216194428 +export PRE_COMPILE_TAG_ANDROID=ffmpeg6-6.1.1-251216194428 \ No newline at end of file From fcf73ffd9c179c38591690ea1bd4895dc6a28370 Mon Sep 17 00:00:00 2001 From: Anka Date: Tue, 16 Dec 2025 12:58:55 +0000 Subject: [PATCH 188/359] upgrade ffmpeg7 to ffmpeg7-7.1.1-251216203909 for apple by cd --- configs/libs/ffmpeg7.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configs/libs/ffmpeg7.sh b/configs/libs/ffmpeg7.sh index 805b21b64..1490f9b49 100644 --- a/configs/libs/ffmpeg7.sh +++ b/configs/libs/ffmpeg7.sh @@ -37,8 +37,8 @@ export GIT_REPO_VERSION=7.1.1 # pre compiled -export PRE_COMPILE_TAG_TVOS=ffmpeg7-7.1.1-251019110740 -export PRE_COMPILE_TAG_MACOS=ffmpeg7-7.1.1-251019110740 -export PRE_COMPILE_TAG_IOS=ffmpeg7-7.1.1-251019110740 +export PRE_COMPILE_TAG_TVOS=ffmpeg7-7.1.1-251216203909 +export PRE_COMPILE_TAG_MACOS=ffmpeg7-7.1.1-251216203909 +export PRE_COMPILE_TAG_IOS=ffmpeg7-7.1.1-251216203909 export PRE_COMPILE_TAG_ANDROID=ffmpeg7-7.1.1-250606143631 From 0558180175ce321b98f48e69a137a1d6e1e3131d Mon Sep 17 00:00:00 2001 From: Anka Date: Tue, 16 Dec 2025 13:17:45 +0000 Subject: [PATCH 189/359] upgrade ijkffmpeg to ijkffmpeg-4.0-251216211157 for android by cd --- configs/libs/ijkffmpeg.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/libs/ijkffmpeg.sh b/configs/libs/ijkffmpeg.sh index 5b6d8ec95..d62b05bff 100644 --- a/configs/libs/ijkffmpeg.sh +++ b/configs/libs/ijkffmpeg.sh @@ -40,7 +40,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_ANDROID=ijkffmpeg-4.0-250606110858 +export PRE_COMPILE_TAG_ANDROID=ijkffmpeg-4.0-251216211157 export PRE_COMPILE_TAG_TVOS=ijkffmpeg-4.0-251216134050 export PRE_COMPILE_TAG_MACOS=ijkffmpeg-4.0-251216134050 export PRE_COMPILE_TAG_IOS=ijkffmpeg-4.0-251216134050 From 6774c611c976b278d122d96a05b1aa3eebd14090 Mon Sep 17 00:00:00 2001 From: Matt Reach Date: Thu, 18 Dec 2025 07:20:23 +0800 Subject: [PATCH 190/359] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20README.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d54215807..155cb667f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ## MRFFToolChain Build Shell [[中文版](./README_zh-CN.md)] -![](https://img.shields.io/github/downloads/debugly/MRFFToolChainBuildShell/total) +![](https://img.shields.io/github/downloads/debugly/MRFFToolChainBuildShell/total) **What's MRFFToolChain?** From 88e3d29bad34c721e278770435450e2b8bd680b7 Mon Sep 17 00:00:00 2001 From: Matt Reach Date: Thu, 18 Dec 2025 07:20:42 +0800 Subject: [PATCH 191/359] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20README=5Fzh-CN.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README_zh-CN.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README_zh-CN.md b/README_zh-CN.md index 9aeaff0eb..d0f3a5960 100644 --- a/README_zh-CN.md +++ b/README_zh-CN.md @@ -1,6 +1,6 @@ ## MRFFToolChain 构建脚本 -![](https://img.shields.io/github/downloads/debugly/MRFFToolChainBuildShell/total) +![](https://img.shields.io/github/downloads/debugly/MRFFToolChainBuildShell/total) **MRFFToolChain 是什么?** From 27d7aff2a0dadb312fc044e6fe05f60cc442d600 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Mon, 19 Jan 2026 18:23:47 +0800 Subject: [PATCH 192/359] rm ffmpeg7 draft patches --- ...-demuxer-https-github.com-bluez-sh-F.patch | 648 ------------------ ...l-https-ffmpeg.org-pipermail-ffmpeg-.patch | 519 -------------- ...structed-wrong-avcc-for-videotoolbox.patch | 58 -- .../0033-add-AV1-hardware-acceleration.patch | 271 -------- .../draft/0042-Adapt-to-clang-16.patch | 31 - 5 files changed, 1527 deletions(-) delete mode 100644 patches/ffmpeg-n7.1.1/draft/0009-mov-support-heic-demuxer-https-github.com-bluez-sh-F.patch delete mode 100644 patches/ffmpeg-n7.1.1/draft/0015-Adds-DVD-protocol-https-ffmpeg.org-pipermail-ffmpeg-.patch delete mode 100644 patches/ffmpeg-n7.1.1/draft/0025-fix-ffmpeg-constructed-wrong-avcc-for-videotoolbox.patch delete mode 100644 patches/ffmpeg-n7.1.1/draft/0033-add-AV1-hardware-acceleration.patch delete mode 100644 patches/ffmpeg-n7.1.1/draft/0042-Adapt-to-clang-16.patch diff --git a/patches/ffmpeg-n7.1.1/draft/0009-mov-support-heic-demuxer-https-github.com-bluez-sh-F.patch b/patches/ffmpeg-n7.1.1/draft/0009-mov-support-heic-demuxer-https-github.com-bluez-sh-F.patch deleted file mode 100644 index a659150a8..000000000 --- a/patches/ffmpeg-n7.1.1/draft/0009-mov-support-heic-demuxer-https-github.com-bluez-sh-F.patch +++ /dev/null @@ -1,648 +0,0 @@ -From 402459f6420e72c383c428af20c5d9b087ee71fc Mon Sep 17 00:00:00 2001 -From: qianlongxu -Date: Mon, 22 Jul 2024 15:30:55 +0800 -Subject: [PATCH 09] mov support heic demuxer - (https://github.com/bluez-sh/FFmpeg/commit/9a885cddb3550ab863a60d02c5fb78e4ae206cf1) - ---- - libavcodec/packet.h | 15 ++ - libavformat/isom.h | 31 +++ - libavformat/mov.c | 483 +++++++++++++++++++++++++++++++++++++++++++- - 3 files changed, 525 insertions(+), 4 deletions(-) - -diff --git a/libavcodec/packet.h b/libavcodec/packet.h -index b19409b..094d457 100644 ---- a/libavcodec/packet.h -+++ b/libavcodec/packet.h -@@ -299,6 +299,21 @@ enum AVPacketSideDataType { - */ - AV_PKT_DATA_DYNAMIC_HDR10_PLUS, - -+ /** -+ * Tile info for image reconstruction -+ * @code -+ * u32le current_tile (current tile number in row major order) [0..nb_tiles-1] -+ * u32le nb_tiles -+ * u32le grid_rows (rows in the final image grid) -+ * u32le grid_cols (cols in the final image grid) -+ * u32le tile_width -+ * u32le tile_height -+ * u32le output_width (cropped width of the final image) -+ * u32le output_height (cropped height of the final image) -+ * @encode -+ */ -+ AV_PKT_DATA_TILE_INFO, -+ - /** - * The number of side data types. - * This is not part of the public API/ABI in the sense that it may -diff --git a/libavformat/isom.h b/libavformat/isom.h -index 3d375d7..020b892 100644 ---- a/libavformat/isom.h -+++ b/libavformat/isom.h -@@ -163,6 +163,16 @@ typedef struct MOVIndexRange { - int64_t end; - } MOVIndexRange; - -+typedef struct HEICItem { -+ int item_id; -+ uint64_t pos; -+ uint64_t size; -+ uint32_t width; -+ uint32_t height; -+ int is_idat_relative; -+ int type; -+} HEICItem; -+ - typedef struct MOVStreamContext { - AVIOContext *pb; - int pb_is_copied; -@@ -328,6 +338,27 @@ typedef struct MOVContext { - } *avif_info; - int avif_info_size; - int interleaved_read; -+ -+ int found_iloc; ///< 'iloc' atom has been found -+ uint64_t idat_offset; ///< offset of 'idat' atom (non-zero if found) -+ int disable_avformat_decoding; -+ struct AVCodecContext *dec_ctx; -+ AVFrame *frame; ///< final decoded frame in HEIF/HEIC -+ AVFrame *tile; -+ HEICItem *item_list; ///< list of items in HEIF/HEIC -+ int nb_items; -+ int *tile_id_list; ///< list containing item IDs of all tiles -+ int nb_tiles; -+ int cur_item_id; -+ int grid_item_id; -+ //int primary_item_id; -+ int primary_rot; ///< rotation angle for primary item -+ uint8_t grid_rows; -+ uint8_t grid_cols; -+ uint32_t tile_width; -+ uint32_t tile_height; -+ uint32_t output_width; -+ uint32_t output_height; - } MOVContext; - - int ff_mp4_read_descr_len(AVIOContext *pb); -diff --git a/libavformat/mov.c b/libavformat/mov.c -index 833db70..c795923 100644 ---- a/libavformat/mov.c -+++ b/libavformat/mov.c -@@ -66,6 +66,10 @@ - #include "mov_chan.h" - #include "replaygain.h" - -+#include "libavutil/imgutils.h" -+#include "libavutil/display.h" -+#include "libavcodec/avcodec.h" -+ - #if CONFIG_ZLIB - #include - #endif -@@ -744,6 +748,24 @@ static int mov_read_hdlr(MOVContext *c, AVIOContext *pb, MOVAtom atom) - av_log(c->fc, AV_LOG_TRACE, "ctype=%s\n", av_fourcc2str(ctype)); - av_log(c->fc, AV_LOG_TRACE, "stype=%s\n", av_fourcc2str(type)); - -+ if (type == MKTAG('p','i','c','t')) { -+ MOVStreamContext *sc; -+ st = avformat_new_stream(c->fc, NULL); -+ if (!st) -+ return AVERROR(ENOMEM); -+ sc = av_mallocz(sizeof(*sc)); -+ if (!sc) -+ return AVERROR(ENOMEM); -+ st->priv_data = sc; -+ st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO; -+ sc->pb = c->fc->pb; -+ sc->pb_is_copied = 1; -+ sc->time_scale = 1; -+ -+ avpriv_set_pts_info(st, 32, 1, sc->time_scale); -+ return 0; -+ } -+ - if (c->trak_index < 0) { // meta not inside a trak - if (type == MKTAG('m','d','t','a')) { - c->found_hdlr_mdta = 1; -@@ -2124,6 +2146,10 @@ static int mov_read_glbl(MOVContext *c, AVIOContext *pb, MOVAtom atom) - if ((uint64_t)atom.size > (1<<30)) - return AVERROR_INVALIDDATA; - -+ /* if iloc is already found, assuming non-tiled image (unless dimg found) */ -+ if (!c->nb_tiles && c->found_iloc && c->cur_item_id != c->primary_item_id) -+ return 0; -+ - if (atom.size >= 10) { - // Broken files created by legacy versions of libavformat will - // wrap a whole fiel atom inside of a glbl atom. -@@ -7790,6 +7816,226 @@ static int mov_read_pitm(MOVContext *c, AVIOContext *pb, MOVAtom atom) - return atom.size; - } - -+static int mov_read_iinf(MOVContext *c, AVIOContext *pb, MOVAtom atom) -+{ -+ int entry_count; -+ int version = avio_r8(pb); -+ avio_rb24(pb); /* flags */ -+ atom.size -= 4; -+ if (!version) { -+ entry_count = avio_rb16(pb); -+ atom.size -= 2; -+ } else { -+ entry_count = avio_rb32(pb); -+ atom.size -= 4; -+ } -+ if (!c->item_list) { -+ c->item_list = av_calloc(entry_count, sizeof(HEICItem)); -+ if (!c->item_list) -+ return AVERROR(ENOMEM); -+ c->nb_items = entry_count; -+ } -+ c->cur_item_id = 0; -+ return mov_read_default(c, pb, atom); -+} -+ -+static int mov_read_infe(MOVContext *c, AVIOContext *pb, MOVAtom atom) -+{ -+ int item_id, item_type; -+ int version = avio_r8(pb); -+ avio_rb24(pb); /* flags */ -+ -+ if (!c->fc->nb_streams) { -+ av_log(c->fc, AV_LOG_ERROR, "hdlr box not found\n"); -+ return AVERROR_INVALIDDATA; -+ } -+ -+ item_id = (version >= 3) ? avio_rb32(pb) : avio_rb16(pb); -+ if (avio_rb16(pb) != 0) { -+ avpriv_request_sample(c->fc, "Protected HEIC"); -+ return AVERROR_PATCHWELCOME; -+ } -+ item_type = avio_rl32(pb); -+ avio_r8(pb); /* null terminated tag */ -+ -+ if (item_type == MKTAG('h','v','c','1')) { -+ AVStream *st = c->fc->streams[c->fc->nb_streams-1]; -+ st->codecpar->codec_id = mov_codec_id(st, item_type); -+ } else if (item_type == MKTAG('g','r','i','d')) { -+ c->grid_item_id = item_id; -+ } -+ -+ if (c->cur_item_id < c->nb_items) { -+ c->item_list[c->cur_item_id].item_id = item_id; -+ c->item_list[c->cur_item_id].type = item_type; -+ c->cur_item_id++; -+ } -+ return 0; -+} -+ -+static int mov_read_iref(MOVContext *c, AVIOContext *pb, MOVAtom atom) -+{ -+ avio_rb32(pb); /* version and flags */ -+ atom.size -= 4; -+ return mov_read_default(c, pb, atom); -+} -+ -+static int mov_read_dimg(MOVContext *c, AVIOContext *pb, MOVAtom atom) -+{ -+ int entries, i; -+ int from_item_id = avio_rb16(pb); -+ -+ if (from_item_id != c->grid_item_id) { -+ avpriv_request_sample(c->fc, "Derived item of type other than 'grid'"); -+ return AVERROR_PATCHWELCOME; -+ } -+ entries = avio_rb16(pb); -+ c->tile_id_list = av_malloc_array(entries, sizeof(int)); -+ if (!c->tile_id_list) -+ return AVERROR(ENOMEM); -+ /* 'to' item ids */ -+ for (i = 0; i < entries; i++) -+ c->tile_id_list[i] = avio_rb16(pb); -+ c->nb_tiles = entries; -+ return 0; -+} -+ -+static int mov_read_ispe(MOVContext *c, AVIOContext *pb, MOVAtom atom) -+{ -+ uint32_t width, height; -+ avio_rb32(pb); /* version and flags */ -+ width = avio_rb32(pb); -+ height = avio_rb32(pb); -+ -+ for (int i = 0; i < c->nb_items; i++) { -+ if (c->item_list[i].item_id == c->cur_item_id) { -+ c->item_list[i].width = width; -+ c->item_list[i].height = height; -+ break; -+ } -+ } -+ return 0; -+} -+ -+static int mov_read_irot(MOVContext *c, AVIOContext *pb, MOVAtom atom) -+{ -+ if (c->cur_item_id != c->primary_item_id) -+ return 0; -+ c->primary_rot = - (90 * (avio_r8(pb) & 0x3)); -+ return 0; -+} -+ -+static int mov_read_iprp(MOVContext *c, AVIOContext *pb, MOVAtom atom) -+{ -+ typedef struct AtomPos { -+ int64_t pos, size; -+ } AtomPos; -+ AtomPos *atoms = NULL; -+ int nb_atoms = 0; -+ int version, flags; -+ unsigned count, i, j; -+ int64_t old_pos, ret = 0; -+ MOVAtom a; -+ -+ if (!c->fc->nb_streams) { -+ av_log(c->fc, AV_LOG_ERROR, "hdlr box not found\n"); -+ return AVERROR_INVALIDDATA; -+ } -+ -+ a.size = avio_rb32(pb); -+ a.type = avio_rl32(pb); -+ -+ if (a.size < 8 || a.type != MKTAG('i','p','c','o')) -+ return AVERROR_INVALIDDATA; -+ a.size -= 8; -+ -+ while (a.size >= 8) { -+ AtomPos *ref = av_dynarray2_add((void**)&atoms, &nb_atoms, sizeof(AtomPos), NULL); -+ if (!ref) { -+ ret = AVERROR(ENOMEM); -+ goto fail; -+ } -+ ref->pos = avio_tell(pb); -+ ref->size = avio_rb32(pb); -+ if (ref->size > a.size || ref->size < 8) -+ break; -+ if ((ret = avio_seek(pb, ref->pos + ref->size, SEEK_SET)) < 0) -+ goto fail; -+ a.size -= ref->size; -+ } -+ -+ if (a.size) { -+ ret = AVERROR_INVALIDDATA; -+ goto fail; -+ } -+ -+ a.size = avio_rb32(pb); -+ a.type = avio_rl32(pb); -+ -+ if (a.size < 8 || a.type != MKTAG('i','p','m','a')) { -+ ret = AVERROR_INVALIDDATA; -+ goto fail; -+ } -+ -+ version = avio_r8(pb); -+ flags = avio_rb24(pb); -+ count = avio_rb32(pb); -+ -+ for (i = 0; i < count; i++) { -+ int item_id = (version >= 1) ? avio_rb32(pb) : avio_rb16(pb); -+ int assoc_count = avio_r8(pb); -+ -+ for (j = 0; j < assoc_count; j++) { -+ MOVAtom parentAtom; -+ AtomPos *atom; -+ int index = avio_r8(pb) & 0x7f; -+ if (flags & 1) { -+ index <<= 8; -+ index |= avio_r8(pb); -+ } -+ if (index > nb_atoms || index <= 0) { -+ ret = AVERROR_INVALIDDATA; -+ goto fail; -+ } -+ -+ atom = &atoms[--index]; -+ c->cur_item_id = item_id; -+ parentAtom = (MOVAtom){ .size = atom->size, .type = MKTAG('i','p','c','o') }; -+ -+ old_pos = avio_tell(pb); -+ if ((ret = avio_seek(pb, atom->pos, SEEK_SET)) < 0) -+ goto fail; -+ if ((ret = mov_read_default(c, pb, parentAtom)) < 0) -+ goto fail; -+ if ((ret = avio_seek(pb, old_pos, SEEK_SET)) < 0) -+ goto fail; -+ } -+ } -+ ret = 0; -+ -+fail: -+ av_free(atoms); -+ return ret; -+} -+ -+static int mov_read_idat(MOVContext *c, AVIOContext *pb, MOVAtom atom) -+{ -+ c->idat_offset = avio_tell(pb); -+ return 0; -+} -+ -+static int read_image_grid(MOVContext *c, AVIOContext *pb) { -+ uint8_t flags; -+ avio_r8(pb); /* version */ -+ flags = avio_r8(pb); -+ c->grid_rows = avio_r8(pb) + 1; -+ c->grid_cols = avio_r8(pb) + 1; -+ /* actual width and height of output image */ -+ c->output_width = (flags & 1) ? avio_rb32(pb) : avio_rb16(pb); -+ c->output_height = (flags & 1) ? avio_rb32(pb) : avio_rb16(pb); -+ return 0; -+} -+ - static int mov_read_iloc(MOVContext *c, AVIOContext *pb, MOVAtom atom) - { - int version, offset_size, length_size, base_offset_size, index_size; -@@ -8619,6 +8865,9 @@ static int mov_read_header(AVFormatContext *s) - - mov->fc = s; - mov->trak_index = -1; -+ mov->grid_item_id = -1; -+ mov->primary_item_id = -1; -+ - /* .mov and .mp4 aren't streamable anyway (only progressive download if moov is before mdat) */ - if (pb->seekable & AVIO_SEEKABLE_NORMAL) - atom.size = avio_size(pb); -@@ -8633,13 +8882,106 @@ static int mov_read_header(AVFormatContext *s) - av_log(s, AV_LOG_ERROR, "error reading header\n"); - return err; - } -- } while ((pb->seekable & AVIO_SEEKABLE_NORMAL) && !mov->found_moov && !mov->moov_retry++); -- if (!mov->found_moov) { -+ } while ((pb->seekable & AVIO_SEEKABLE_NORMAL) && !mov->found_moov && !mov->found_iloc && !mov->moov_retry++); -+ if (!mov->found_moov && !mov->found_iloc) { - av_log(s, AV_LOG_ERROR, "moov atom not found\n"); - return AVERROR_INVALIDDATA; - } - av_log(mov->fc, AV_LOG_TRACE, "on_parse_exit_offset=%"PRId64"\n", avio_tell(pb)); - -+ if (mov->found_iloc) { -+ /* For HEIF/HEIC pictures */ -+ AVStream *st = s->streams[s->nb_streams-1]; -+ MOVStreamContext *sc = st->priv_data; -+ int i, j, ret; -+ -+ if (mov->nb_tiles) { -+ -+ for (i = 0; i < mov->nb_tiles; i++) { -+ int tile_id = mov->tile_id_list[i]; -+ for (j = 0; j < mov->nb_items; j++) { -+ HEICItem *item = &mov->item_list[j]; -+ if (item->item_id == tile_id) { -+ if (item->is_idat_relative) -+ item->pos += mov->idat_offset; -+ if (add_index_entry(st, item->pos, i, item->size, 0, AVINDEX_KEYFRAME) < 0) -+ return AVERROR(ENOMEM); -+ if (!mov->tile_width || !mov->tile_height) { -+ mov->tile_width = item->width; -+ mov->tile_height = item->height; -+ } -+ break; -+ } -+ } -+ } -+ -+ for (i = 0; i < mov->nb_items; i++) { -+ HEICItem *item = &mov->item_list[i]; -+ if (item->item_id == mov->grid_item_id) { -+ if (item->is_idat_relative) -+ item->pos += mov->idat_offset; -+ if ((ret = avio_seek(pb, item->pos, SEEK_SET)) < 0) -+ return ret; -+ if ((ret = read_image_grid(mov, pb)) < 0) -+ return ret; -+ break; -+ } -+ } -+ -+ av_log(s, AV_LOG_INFO, "tile res %dx%d, grid res %dx%d, output res %dx%d\n", -+ mov->tile_width, mov->tile_height, mov->tile_width * mov->grid_cols, -+ mov->tile_height * mov->grid_rows, mov->output_width, mov->output_height); -+ -+ } else { -+ for (i = 0; i < mov->nb_items; i++) { -+ HEICItem *item = &mov->item_list[i]; -+ if (item->item_id == mov->primary_item_id) { -+ if (item->is_idat_relative) -+ item->pos += mov->idat_offset; -+ if (add_index_entry(st, item->pos, i, item->size, 0, AVINDEX_KEYFRAME) < 0) -+ return AVERROR(ENOMEM); -+ break; -+ } -+ } -+ } -+ -+ if (mov->nb_tiles && !mov->disable_avformat_decoding) { -+ const AVCodec *codec = avcodec_find_decoder(st->codecpar->codec_id); -+ mov->dec_ctx = avcodec_alloc_context3(codec); -+ if (!mov->dec_ctx) -+ return AVERROR(ENOMEM); -+ ret = avcodec_parameters_to_context(mov->dec_ctx, st->codecpar); -+ if (ret < 0) -+ return ret; -+ ret = avcodec_open2(mov->dec_ctx, codec, NULL); -+ if (ret < 0) { -+ av_log(s, AV_LOG_ERROR, "Error opening codec\n"); -+ return ret; -+ } -+ -+ if (mov->primary_rot) { -+ sc->display_matrix = av_malloc(sizeof(int32_t) * 9); -+ if (!sc->display_matrix) -+ return AVERROR(ENOMEM); -+ av_display_rotation_set(sc->display_matrix, mov->primary_rot); -+ } -+ -+ st->codecpar->width = mov->output_width; -+ st->codecpar->height = mov->output_height; -+ st->codecpar->format = AV_PIX_FMT_YUV420P; -+ st->codecpar->color_range = AVCOL_RANGE_JPEG; -+ st->codecpar->codec_id = AV_CODEC_ID_RAWVIDEO; -+ st->codecpar->codec_tag = 0; -+ } else if (!mov->nb_tiles) { -+ if (mov->primary_rot) { -+ sc->display_matrix = av_malloc(sizeof(int32_t) * 9); -+ if (!sc->display_matrix) -+ return AVERROR(ENOMEM); -+ av_display_rotation_set(sc->display_matrix, mov->primary_rot); -+ } -+ } -+ } -+ - if (pb->seekable & AVIO_SEEKABLE_NORMAL) { - if (mov->nb_chapter_tracks > 0 && !mov->ignore_chapters) - mov_read_chapters(s); -@@ -8926,6 +9268,98 @@ static int get_eia608_packet(AVIOContext *pb, AVPacket *pkt, int size) - return 0; - } - -+static int heic_decode_tile(MOVContext *c, AVPacket *pkt, int index) -+{ -+ const AVPixFmtDescriptor *desc; -+ unsigned plane, nb_planes = 0; -+ int ret; -+ -+ if (!c->tile) c->tile = av_frame_alloc(); -+ -+ ret = avcodec_send_packet(c->dec_ctx, pkt); -+ if (ret < 0) { -+ av_log(c->fc, AV_LOG_ERROR, "Error sending tile for decoding\n"); -+ return ret; -+ } -+ -+ ret = avcodec_receive_frame(c->dec_ctx, c->tile); -+ if (ret < 0) { -+ av_log(c->fc, AV_LOG_ERROR, "Error decoding tile\n"); -+ return ret; -+ } -+ -+ if (c->tile->format != AV_PIX_FMT_YUVJ420P && -+ c->tile->format != AV_PIX_FMT_YUV420P) { -+ avpriv_request_sample(c->fc, -+ "Unsupported pixel format '%d' for direct decoding heif/heic tiles", c->tile->format); -+ return AVERROR_PATCHWELCOME; -+ } -+ -+ if (!c->frame) { -+ c->frame = av_frame_alloc(); -+ av_frame_copy_props(c->frame, c->tile); -+ c->frame->width = c->tile_width * c->grid_cols; -+ c->frame->height = c->tile_height * c->grid_rows; -+ c->frame->format = c->tile->format; -+ ret = av_frame_get_buffer(c->frame, 1); -+ if (ret < 0) -+ return ret; -+ } -+ -+ desc = av_pix_fmt_desc_get(c->frame->format); -+ nb_planes = av_pix_fmt_count_planes(c->frame->format); -+ -+ for (plane = 0; plane < nb_planes; plane++) { -+ uint8_t *p, *q; -+ unsigned x, y, line, wp, hp; -+ hp = plane == 1 || plane == 2 ? -+ AV_CEIL_RSHIFT(c->tile->height, desc->log2_chroma_h) -+ : c->tile->height; -+ wp = plane == 1 || plane == 2 ? -+ AV_CEIL_RSHIFT(c->tile->width, desc->log2_chroma_w) -+ : c->tile->width; -+ x = (index % c->grid_cols) * wp; -+ y = (index / c->grid_cols) * hp; -+ p = &c->tile ->data[plane][0]; -+ q = &c->frame->data[plane][y * c->frame->linesize[plane] + x]; -+ for (line = 0; line < hp; line++) { -+ memcpy(q, p, wp); -+ p += c->tile ->linesize[plane]; -+ q += c->frame->linesize[plane]; -+ } -+ } -+ -+ return 0; -+} -+ -+static int heic_copy_frame_to_buffer(MOVContext *c, AVPacket *pkt, AVFrame *frame) -+{ -+ unsigned grid_width = c->tile_width * c->grid_cols; -+ unsigned grid_height = c->tile_height * c->grid_rows; -+ unsigned size; -+ int ret; -+ -+ frame->crop_right = grid_width - c->output_width; -+ frame->crop_bottom = grid_height - c->output_height; -+ av_frame_apply_cropping(frame, 0); -+ -+ size = av_image_get_buffer_size(frame->format, frame->width, -+ frame->height, 1); -+ -+ ret = av_new_packet(pkt, size); -+ if (ret < 0) -+ return ret; -+ -+ ret = av_image_copy_to_buffer(pkt->data, size, -+ (const uint8_t **)frame->data, -+ frame->linesize, frame->format, -+ frame->width, frame->height, 1); -+ if (ret < 0) -+ return ret; -+ -+ return size; -+} -+ - static int mov_read_packet(AVFormatContext *s, AVPacket *pkt) - { - MOVContext *mov = s->priv_data; -@@ -8978,6 +9412,47 @@ static int mov_read_packet(AVFormatContext *s, AVPacket *pkt) - current_index = sc->current_index; - mov_current_sample_inc(sc); - -+ if (mov->nb_tiles && !mov->disable_avformat_decoding) { -+ AVPacket avpkt; -+ -+ int64_t ret64 = avio_seek(sc->pb, sample->pos, SEEK_SET); -+ if (ret64 != sample->pos) { -+ av_log(mov->fc, AV_LOG_ERROR, "stream %d, offset 0x%"PRIx64": partial file\n", -+ sc->ffindex, sample->pos); -+ return AVERROR_INVALIDDATA; -+ } -+ -+ ret = av_get_packet(sc->pb, &avpkt, sample->size); -+ if (ret < 0) -+ return ret; -+ -+ ret = heic_decode_tile(mov, &avpkt, current_index); -+ av_packet_unref(&avpkt); -+ -+ if (ret < 0) -+ return ret; -+ -+ if (current_index == mov->nb_tiles-1) -+ return heic_copy_frame_to_buffer(mov, pkt, mov->frame); -+ -+ return 0; -+ } -+ -+ if (mov->nb_tiles) { -+ const uint32_t tile_info[8] = { current_index, mov->nb_tiles, -+ mov->grid_rows, mov->grid_cols, -+ mov->tile_width, mov->tile_height, -+ mov->output_width, mov->output_height }; -+ uint8_t *sd = av_packet_new_side_data(pkt, AV_PKT_DATA_TILE_INFO, sizeof(tile_info)); -+ if (!sd) -+ return AVERROR(ENOMEM); -+ memcpy(sd, tile_info, sizeof(tile_info)); -+ -+ av_log(mov->fc, AV_LOG_INFO, "frame %ld, tile %ld of %ld in row %ld\n", -+ (current_index+1), (current_index % mov->grid_cols)+1, (long)mov->grid_cols, -+ (current_index / mov->grid_cols)+1); -+ } -+ - if (mov->next_root_atom) { - sample->pos = FFMIN(sample->pos, mov->next_root_atom); - sample->size = FFMIN(sample->size, (mov->next_root_atom - sample->pos)); -@@ -9361,11 +9836,11 @@ static const AVClass mov_class = { - }; - - const AVInputFormat ff_mov_demuxer = { -- .name = "mov,mp4,m4a,3gp,3g2,mj2", -+ .name = "mov,mp4,m4a,3gp,3g2,mj2,heic,heif", - .long_name = NULL_IF_CONFIG_SMALL("QuickTime / MOV"), - .priv_class = &mov_class, - .priv_data_size = sizeof(MOVContext), -- .extensions = "mov,mp4,m4a,3gp,3g2,mj2,psp,m4b,ism,ismv,isma,f4v,avif", -+ .extensions = "mov,mp4,m4a,3gp,3g2,mj2,psp,m4b,ism,ismv,isma,f4v,avif,heic,heif", - .flags_internal = FF_FMT_INIT_CLEANUP, - .read_probe = mov_probe, - .read_header = mov_read_header, --- -2.39.3 (Apple Git-146) - diff --git a/patches/ffmpeg-n7.1.1/draft/0015-Adds-DVD-protocol-https-ffmpeg.org-pipermail-ffmpeg-.patch b/patches/ffmpeg-n7.1.1/draft/0015-Adds-DVD-protocol-https-ffmpeg.org-pipermail-ffmpeg-.patch deleted file mode 100644 index 7741710f9..000000000 --- a/patches/ffmpeg-n7.1.1/draft/0015-Adds-DVD-protocol-https-ffmpeg.org-pipermail-ffmpeg-.patch +++ /dev/null @@ -1,519 +0,0 @@ -From 8e39b2302f903277cf2d1e31726dd82823b1427e Mon Sep 17 00:00:00 2001 -From: qianlongxu -Date: Mon, 22 Jul 2024 14:38:12 +0800 -Subject: [PATCH 15] Adds DVD protocol - (https://ffmpeg.org/pipermail/ffmpeg-devel/2022-January/290879.html) - ---- - configure | 5 + - libavformat/Makefile | 1 + - libavformat/dvd.c | 433 ++++++++++++++++++++++++++++++++++++++++ - libavformat/protocols.c | 2 + - 4 files changed, 441 insertions(+) - create mode 100644 libavformat/dvd.c - -diff --git a/configure b/configure -index a89cfa6..3f2fd2d 100755 ---- a/configure -+++ b/configure -@@ -218,6 +218,7 @@ External library support: - --enable-libass enable libass subtitles rendering, - needed for subtitles and ass filter [no] - --enable-libbluray enable BluRay reading using libbluray [no] -+ --enable-libdvdread enable DVD reading using libdvdread [no] - --enable-libbs2b enable bs2b DSP library [no] - --enable-libcaca enable textual display using libcaca [no] - --enable-libcelt enable CELT decoding via libcelt [no] -@@ -1852,6 +1853,7 @@ EXTERNAL_LIBRARY_LIST=" - libdav1d - libdc1394 - libdrm -+ libdvdread - libflite - libfontconfig - libfreetype -@@ -3615,6 +3617,7 @@ xv_outdev_deps="xlib_xv xlib_x11 xlib_xext" - # protocols - async_protocol_deps="threads" - bluray_protocol_deps="libbluray" -+dvd_protocol_deps="libdvdread" - ffrtmpcrypt_protocol_conflict="librtmp_protocol" - ffrtmpcrypt_protocol_deps_any="gcrypt gmp openssl mbedtls" - ffrtmpcrypt_protocol_select="tcp_protocol" -@@ -6694,6 +6697,8 @@ enabled libdav1d && require_pkg_config libdav1d "dav1d >= 0.5.0" "dav1d - enabled libdavs2 && require_pkg_config libdavs2 "davs2 >= 1.6.0" davs2.h davs2_decoder_open - enabled libdc1394 && require_pkg_config libdc1394 libdc1394-2 dc1394/dc1394.h dc1394_new - enabled libdrm && require_pkg_config libdrm libdrm xf86drm.h drmGetVersion -+enabled libdvdread && enable dvdread -+enabled dvdread && require_pkg_config libdvdread dvdread "dvdread/dvd_reader.h" DVDOpen2 - enabled libfdk_aac && { check_pkg_config libfdk_aac fdk-aac "fdk-aac/aacenc_lib.h" aacEncOpen || - { require libfdk_aac fdk-aac/aacenc_lib.h aacEncOpen -lfdk-aac && - warn "using libfdk without pkg-config"; } } -diff --git a/libavformat/Makefile b/libavformat/Makefile -index 586aacd..dfcec9f 100644 ---- a/libavformat/Makefile -+++ b/libavformat/Makefile -@@ -668,6 +668,7 @@ OBJS-$(CONFIG_CONCAT_PROTOCOL) += concat.o - OBJS-$(CONFIG_CONCATF_PROTOCOL) += concat.o - OBJS-$(CONFIG_CRYPTO_PROTOCOL) += crypto.o - OBJS-$(CONFIG_DATA_PROTOCOL) += data_uri.o -+OBJS-$(CONFIG_DVD_PROTOCOL) += dvd.o - OBJS-$(CONFIG_FFRTMPCRYPT_PROTOCOL) += rtmpcrypt.o rtmpdigest.o rtmpdh.o - OBJS-$(CONFIG_FFRTMPHTTP_PROTOCOL) += rtmphttp.o - OBJS-$(CONFIG_FILE_PROTOCOL) += file.o -diff --git a/libavformat/dvd.c b/libavformat/dvd.c -new file mode 100644 -index 0000000..4f79064 ---- /dev/null -+++ b/libavformat/dvd.c -@@ -0,0 +1,433 @@ -+/* -+ * DVD (libdvdread) protocol -+ * Copyright (c) 2023 Stan Ionascu -+ * -+ * This file is part of FFmpeg. -+ * -+ * FFmpeg is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * FFmpeg is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with FFmpeg; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ */ -+ -+#include -+#include -+#include -+ -+#include "libavformat/avformat.h" -+#include "libavformat/url.h" -+#include "libavutil/avstring.h" -+#include "libavutil/opt.h" -+ -+#define DVD_PROTO_PREFIX "dvd:" -+#define DVD_SECTOR_SIZE 2048 -+ -+typedef struct -+{ -+ const AVClass *class; -+ -+ dvd_reader_t *dvd; -+ dvd_logger_cb dvd_logger; -+ -+ int title_nr; -+ int angle_nr; -+ dvd_file_t *dvd_title_file; -+ ifo_handle_t *vmg_ifo; -+ ifo_handle_t *vts_ifo; -+ pgc_t *current_pgc; -+ int current_cell; -+ -+ int start_sector; -+ int current_sector; -+ int end_sector; -+ -+ int duration; -+} DvdProtocolContext; -+ -+static int bcd2int(int bcd) -+{ -+ return (((bcd & 0xf0) >> 4) * 10 + (bcd & 0x0f)); -+} -+ -+static void dvd_logger_ff(void *opaque, dvd_logger_level_t dvd_level, const char *fmt, va_list args) -+{ -+ int level = AV_LOG_TRACE; -+ if (dvd_level == DVD_LOGGER_LEVEL_ERROR) -+ { -+ level = AV_LOG_ERROR; -+ } -+ else if (dvd_level == DVD_LOGGER_LEVEL_WARN) -+ { -+ level = AV_LOG_WARNING; -+ } -+ else if (dvd_level == DVD_LOGGER_LEVEL_INFO) -+ { -+ level = AV_LOG_INFO; -+ } -+ else if (dvd_level == DVD_LOGGER_LEVEL_DEBUG) -+ { -+ level = AV_LOG_DEBUG; -+ } -+ av_vlog(opaque, level, fmt, args); -+ /* add new line */ -+ av_log(opaque, level, "\n"); -+} -+ -+static int ff_dvd_get_title_set_length(ifo_handle_t *vts_ifo, tt_srpt_t *tt_srpt, int title_nr) -+{ -+ /* reindex 1 => 0 */ -+ int vts_title_number = tt_srpt->title[title_nr].vts_ttn - 1; -+ int pgc_number = vts_ifo->vts_ptt_srpt->title[vts_title_number].ptt[0].pgcn; -+ dvd_time_t *playback_time = &vts_ifo->vts_pgcit->pgci_srp[pgc_number - 1].pgc->playback_time; -+ -+ return (bcd2int(playback_time->hour) * 3600 + -+ bcd2int(playback_time->minute) * 60 + -+ bcd2int(playback_time->second)) * -+ 1000; -+} -+ -+static void ff_dvd_set_program_chain_info(DvdProtocolContext *ctx, int title_nr, int ptt_nr) -+{ -+ /* reindex 1 => 0 */ -+ int vts_title_number = ctx->vmg_ifo->tt_srpt->title[title_nr].vts_ttn - 1; -+ ptt_info_t *ptt = &ctx->vts_ifo->vts_ptt_srpt->title[vts_title_number].ptt[ptt_nr]; -+ int pgc_id = ptt->pgcn; -+ int pgn = ptt->pgn; -+ -+ ctx->current_pgc = ctx->vts_ifo->vts_pgcit->pgci_srp[pgc_id - 1].pgc; -+ ctx->current_cell = ctx->current_pgc->program_map[pgn - 1] - 1; -+ -+ /* change angle */ -+ if (ctx->current_pgc->cell_playback[ctx->current_cell].block_type == BLOCK_TYPE_ANGLE_BLOCK) -+ { -+ ctx->current_cell += ctx->angle_nr; -+ } -+ -+ ctx->current_sector = ctx->start_sector = ctx->current_pgc->cell_playback[ctx->current_cell].first_sector; -+ ctx->end_sector = ctx->current_pgc->cell_playback[ctx->current_cell].last_sector; -+} -+ -+static int ff_dvd_get_next_cell(DvdProtocolContext *ctx) -+{ -+ int next_cell = ctx->current_cell; -+ -+ /* fast-forward until last-cell */ -+ if (ctx->current_pgc->cell_playback[next_cell].block_type == BLOCK_TYPE_ANGLE_BLOCK) -+ { -+ ctx->current_cell += ctx->angle_nr; -+ while (next_cell < ctx->current_pgc->nr_of_cells && -+ ctx->current_pgc->cell_playback[next_cell].block_type != BLOCK_MODE_LAST_CELL) -+ { -+ next_cell++; -+ } -+ } -+ -+ /* take next cell */ -+ next_cell++; -+ if (next_cell >= ctx->current_pgc->nr_of_cells) -+ { -+ return -1; -+ } -+ -+ return next_cell; -+} -+ -+static int dvd_url_close(URLContext *h) -+{ -+ DvdProtocolContext *ctx = h->priv_data; -+ ifoClose(ctx->vts_ifo); -+ ifoClose(ctx->vmg_ifo); -+ DVDCloseFile(ctx->dvd_title_file); -+ DVDClose(ctx->dvd); -+ return 0; -+} -+ -+static int dvd_url_open(URLContext *h, const char *path, int flags) -+{ -+ DvdProtocolContext *ctx = h->priv_data; -+ const char *dvd_path = path; -+ ifo_handle_t *vmg_ifo, *vts_ifo; -+ tt_srpt_t *tt_srpt; -+ int num_vts, num_titles; -+ int longest_title_nr; -+ int64_t longest_title_length_ms = 0; -+ int vts_nr; -+ int title_set_nr; -+ char disc_volume_id[32]; -+ -+ ctx->vmg_ifo = ctx->vts_ifo = NULL; -+ ctx->dvd_logger.pf_log = &dvd_logger_ff; -+ -+ /* strip protocol from path */ -+ av_strstart(path, DVD_PROTO_PREFIX, &dvd_path); -+ -+ /* open dvd folder or disc */ -+ if ((ctx->dvd = DVDOpen2(h, &ctx->dvd_logger, dvd_path)) == NULL) -+ { -+ av_log(h, AV_LOG_ERROR, "DVDOpen(%s) failed\n", dvd_path); -+ return AVERROR(EIO); -+ } -+ -+ if (DVDUDFVolumeInfo(ctx->dvd, &disc_volume_id[0], 32, NULL, 0) == 0) -+ { -+ av_log(h, AV_LOG_INFO, "opened disc-volume-id: %s\n", disc_volume_id); -+ } -+ -+ /* read toc */ -+ if ((vmg_ifo = ifoOpen(ctx->dvd, 0)) == NULL) -+ { -+ av_log(h, AV_LOG_ERROR, "ifoOpen(0) failed\n"); -+ return AVERROR(EIO); -+ } -+ -+ /* read titles */ -+ num_vts = vmg_ifo->vts_atrt->nr_of_vtss; -+ num_titles = vmg_ifo->tt_srpt->nr_of_srpts; -+ av_log(h, AV_LOG_INFO, "there are %d usable titles\n", num_titles); -+ -+ /* get title-set info(s) */ -+ tt_srpt = vmg_ifo->tt_srpt; -+ if (ctx->title_nr >= num_titles) -+ { -+ av_log(h, AV_LOG_ERROR, "invalid title id %d\n", ctx->title_nr); -+ return AVERROR(EINVAL); -+ } -+ -+ for (vts_nr = 1; vts_nr <= num_vts; vts_nr++) -+ { -+ int title_nr; -+ for (title_nr = 0; title_nr < num_titles; title_nr++) -+ { -+ int title_length_ms; -+ -+ if (tt_srpt->title[title_nr].title_set_nr != vts_nr) -+ { -+ continue; -+ } -+ -+ /* describe the title(s) info */ -+ if ((vts_ifo = ifoOpen(ctx->dvd, vts_nr)) == NULL) -+ { -+ av_log(h, AV_LOG_ERROR, "ifoOpen(%d) failed\n", title_nr); -+ return AVERROR(ENOMEM); -+ } -+ -+ /* skip if video title set or program chain info is missing */ -+ if (vts_ifo->vtsi_mat == NULL || vts_ifo->vts_pgcit == NULL) -+ { -+ ifoClose(vts_ifo); -+ av_log(h, AV_LOG_TRACE, "skip title %d as no vts or pgc info is present\n", -+ title_nr); -+ continue; -+ } -+ -+ /* skip if vts_ttn is incorrect */ -+ if (tt_srpt->title[title_nr].vts_ttn < 1 || -+ tt_srpt->title[title_nr].vts_ttn > num_titles) -+ { -+ ifoClose(vts_ifo); -+ av_log(h, AV_LOG_WARNING, "skip title %d as vts_ttn is out of bounds\n", -+ title_nr); -+ continue; -+ } -+ -+ title_length_ms = ff_dvd_get_title_set_length(vts_ifo, tt_srpt, title_nr); -+ av_log(h, AV_LOG_INFO, "title %03d : (%d:%02d:%02d) and %d chapter(s)\n", -+ title_nr, -+ (title_length_ms / 3600000), -+ (title_length_ms % 3600000) / 60000, -+ (title_length_ms % 60000) / 1000, -+ tt_srpt->title[title_nr].nr_of_ptts); -+ -+ if (longest_title_length_ms <= title_length_ms) -+ { -+ longest_title_nr = title_nr; -+ longest_title_length_ms = title_length_ms; -+ } -+ -+ ifoClose(vts_ifo); -+ } -+ } -+ -+ if (ctx->title_nr < 0) -+ { -+ ctx->title_nr = longest_title_nr; -+ ctx->duration = longest_title_length_ms; -+ } -+ -+ av_log(NULL, AV_LOG_ERROR, "dvd dvd_url_open %lld\n", ctx->duration); -+ -+ /* check if title selection is valid */ -+ if (tt_srpt->title[ctx->title_nr].vts_ttn < 1 || -+ tt_srpt->title[ctx->title_nr].vts_ttn > num_titles) -+ { -+ av_log(h, AV_LOG_INFO, "selected title %d is not valid, vts_ttn is out of bounds\n", -+ ctx->title_nr); -+ ifoClose(vmg_ifo); -+ return AVERROR(EIO); -+ } -+ -+ av_log(h, AV_LOG_INFO, "selected title %d\n", ctx->title_nr); -+ -+ if (ctx->angle_nr > 0 && ctx->angle_nr >= tt_srpt->title[ctx->title_nr].nr_of_angles) -+ { -+ av_log(h, AV_LOG_ERROR, "incorrect angle selected %d out of %d angle(s)\n", -+ ctx->angle_nr, -+ tt_srpt->title[ctx->title_nr].nr_of_angles); -+ } -+ -+ /* open request title_set info */ -+ title_set_nr = tt_srpt->title[ctx->title_nr].title_set_nr; -+ if ((vts_ifo = ifoOpen(ctx->dvd, title_set_nr)) == NULL) -+ { -+ av_log(h, AV_LOG_INFO, "ifoOpen(%d) failed\n", title_set_nr); -+ return AVERROR(ENOMEM); -+ } -+ -+ /* open file */ -+ if ((ctx->dvd_title_file = DVDOpenFile(ctx->dvd, title_set_nr, DVD_READ_TITLE_VOBS)) == NULL) -+ { -+ av_log(h, AV_LOG_ERROR, "DVDOpenFile(%d) failed\n", title_set_nr); -+ return AVERROR(EIO); -+ } -+ -+ ctx->vmg_ifo = vmg_ifo; -+ ctx->vts_ifo = vts_ifo; -+ -+ ff_dvd_set_program_chain_info(ctx, ctx->title_nr, 0); -+ -+ //ifo_print(ctx->dvd, title_set_nr); -+ return 0; -+} -+ -+static int dvd_url_read(URLContext *h, unsigned char *buf, int size) -+{ -+ DvdProtocolContext *ctx = h->priv_data; -+ ssize_t blocks_got; -+ int num_blocks = size / DVD_SECTOR_SIZE; -+ -+ //av_log(h, AV_LOG_ERROR, "dvd_url_read start/current/end sector:%lld/%lld/%lld\n", ctx->start_sector, ctx->current_sector, ctx->end_sector); -+ if (ctx->current_sector >= ctx->end_sector) -+ { -+ int next_cell = ff_dvd_get_next_cell(ctx); -+ if (next_cell < 0) -+ { -+ return AVERROR_EOF; -+ } -+ -+ ctx->current_cell = next_cell; -+ ctx->start_sector = ctx->current_pgc->cell_playback[ctx->current_cell].first_sector; -+ ctx->end_sector = ctx->current_pgc->cell_playback[ctx->current_cell].last_sector; -+ ctx->current_sector = ctx->start_sector; -+ -+ av_log(h, AV_LOG_ERROR, "dvd_url_read reset to cell:%lld\n", ctx->current_cell); -+ av_log(h, AV_LOG_ERROR, "dvd_url_read reset start/current/end sector:%lld/%lld/%lld\n", ctx->start_sector, ctx->current_sector, ctx->end_sector); -+ } -+ -+ /* read all sectors that fit into buf */ -+ blocks_got = DVDReadBlocks(ctx->dvd_title_file, ctx->current_sector, num_blocks, buf); -+ if (blocks_got <= 0) -+ { -+ av_log(h, AV_LOG_ERROR, "failed to DVDReadBlocks() %d blocks at offset %d\n", -+ num_blocks, ctx->current_sector); -+ return AVERROR(EIO); -+ } -+ ctx->current_sector += blocks_got; -+ return blocks_got <= 0 ? AVERROR_EOF : blocks_got * DVD_SECTOR_SIZE; -+} -+ -+static int64_t dvd_url_seek(URLContext *h, int64_t pos, int whence) -+{ -+ DvdProtocolContext *ctx = h->priv_data; -+ if (!ctx || !ctx->dvd) -+ { -+ return AVERROR(EFAULT); -+ } -+ -+ switch (whence) -+ { -+ case SEEK_SET: -+ case SEEK_CUR: -+ case SEEK_END: -+ { -+ int32_t blocks = pos / DVD_SECTOR_SIZE; -+ av_log(h, AV_LOG_ERROR, "dvd seek blocks: %ld\n", blocks); -+ -+ int sum = 0; -+ cell_playback_t *cell_playback = ctx->current_pgc->cell_playback; -+ int i; -+ for (i = 0; i < ctx->current_pgc->nr_of_cells; i++) -+ { -+ int this_sector = cell_playback[i].last_sector - cell_playback[i].first_sector; -+ if (this_sector + sum > blocks) -+ { -+ break; -+ } -+ sum += this_sector; -+ } -+ if (i >= ctx->current_pgc->nr_of_cells) -+ { -+ i = ctx->current_pgc->nr_of_cells - 1; -+ } -+ ctx->current_cell = i; -+ ctx->start_sector = cell_playback[i].first_sector; -+ ctx->end_sector = cell_playback[i].last_sector; -+ ctx->current_sector = ctx->start_sector + (blocks - sum); -+ -+ av_log(h, AV_LOG_ERROR, "dvd_url_read seek to cell:%lld\n", ctx->current_cell); -+ av_log(h, AV_LOG_ERROR, "dvd_url_read seek start/current/end sector:%lld/%lld/%lld\n", ctx->start_sector, ctx->current_sector, ctx->end_sector); -+ -+ return DVDFileSeek(ctx->dvd_title_file, pos); -+ } -+ case AVSEEK_SIZE: -+ { -+ int64_t sum = 0; -+ cell_playback_t *cell_playback = ctx->current_pgc->cell_playback; -+ for (int i = 0; i < ctx->current_pgc->nr_of_cells; i++) -+ { -+ sum += cell_playback[i].last_sector - cell_playback[i].first_sector; -+ } -+ // 1534280 -+ // int64_t size = DVDFileSize(ctx->dvd_title_file) * DVD_SECTOR_SIZE; -+ int64_t size = sum * DVD_SECTOR_SIZE; -+ av_log(h, AV_LOG_ERROR, "dvd total blocks: %lld\n", sum); -+ return size; -+ } -+ } -+ -+ av_log(h, AV_LOG_ERROR, "dvd Unsupported whence operation %d\n", whence); -+ return AVERROR(EINVAL); -+} -+ -+#define OFFSET(x) offsetof(DvdProtocolContext, x) -+static const AVOption options[] = { -+ {"title", "", OFFSET(title_nr), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 9999, AV_OPT_FLAG_DECODING_PARAM}, -+ {"angle", "", OFFSET(angle_nr), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 256, AV_OPT_FLAG_DECODING_PARAM}, -+ {NULL}, -+}; -+static const AVClass dvd_context_class = { -+ .class_name = "dvd", -+ .item_name = av_default_item_name, -+ .option = options, -+ .version = LIBAVUTIL_VERSION_INT, -+}; -+ -+const URLProtocol ff_dvd_protocol = { -+ .name = "dvd", -+ .url_close = dvd_url_close, -+ .url_open = dvd_url_open, -+ .url_read = dvd_url_read, -+ .url_seek = dvd_url_seek, -+ .priv_data_size = sizeof(DvdProtocolContext), -+ .priv_data_class = &dvd_context_class, -+ .default_whitelist = "dvd" -+}; -\ No newline at end of file -diff --git a/libavformat/protocols.c b/libavformat/protocols.c -index fd64780..73df344 100644 ---- a/libavformat/protocols.c -+++ b/libavformat/protocols.c -@@ -84,6 +84,8 @@ extern const URLProtocol ff_ijksegment_protocol; - extern const URLProtocol ff_ijktcphook_protocol; - extern const URLProtocol ff_ijkio_protocol; - -+extern const URLProtocol ff_dvd_protocol; -+ - #include "libavformat/protocol_list.c" - - const AVClass *ff_urlcontext_child_class_iterate(void **iter) --- -2.39.3 (Apple Git-146) - diff --git a/patches/ffmpeg-n7.1.1/draft/0025-fix-ffmpeg-constructed-wrong-avcc-for-videotoolbox.patch b/patches/ffmpeg-n7.1.1/draft/0025-fix-ffmpeg-constructed-wrong-avcc-for-videotoolbox.patch deleted file mode 100644 index 139f3267f..000000000 --- a/patches/ffmpeg-n7.1.1/draft/0025-fix-ffmpeg-constructed-wrong-avcc-for-videotoolbox.patch +++ /dev/null @@ -1,58 +0,0 @@ -From 182364b5b9adb60cf07bd67c0712b5dae36dde79 Mon Sep 17 00:00:00 2001 -From: qianlongxu -Date: Thu, 29 May 2025 11:13:47 +0800 -Subject: [PATCH] fix ffmpeg constructed wrong avcc for videotoolbox - ---- - libavcodec/videotoolbox.c | 35 ++++++++++++++++++++++++++++++++++- - 1 file changed, 34 insertions(+), 1 deletion(-) - -diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c -index 505483e..525d455 100644 ---- a/libavcodec/videotoolbox.c -+++ b/libavcodec/videotoolbox.c -@@ -224,7 +224,40 @@ CFDataRef ff_videotoolbox_avcc_extradata_create(AVCodecContext *avctx) - if (vtctx) - memcpy(vtctx->sps, h->ps.sps->data + 1, 3); - -- data = CFDataCreate(kCFAllocatorDefault, vt_extradata, vt_extradata_size); -+ /* -+ ffmpeg constructed avcc is wrong,but i dont't why;eg: -+ ff constructed avcc: -+ 014d401effe1001b674d401eec806c1ef3fff8140013f88000000080000019078b16cb01000468ebec4c -+ avctx->extradata avcc: -+ 014d401effe1001c674d401eec806c1ef3fff8140013f8800000030080000019078b16cb01000568ebec4c80 -+ */ -+ if (avctx->extradata_size != vt_extradata_size) { -+ char msg[256]; -+ { -+ char buffer[128]; -+ sprintf(buffer, "%s", "ff avcc maybe wrong:"); -+ int len = (int)strlen(buffer); -+ int size = FFMIN(vt_extradata_size, 127 - len) / 2; -+ for (int i = 0; i < size; i++) { -+ len += sprintf(buffer + len, "%02X", vt_extradata[i]); -+ } -+ sprintf(msg, "%s", buffer); -+ } -+ { -+ char buffer[128]; -+ sprintf(buffer, "%s", "\nuse origin avcc:"); -+ int len = (int)strlen(buffer); -+ int size = FFMIN(avctx->extradata_size, 127 - len) / 2; -+ for (int i = 0; i < size; i++) { -+ len += sprintf(buffer + len, "%02X", avctx->extradata[i]); -+ } -+ sprintf(msg + strlen(msg), "%s", buffer); -+ } -+ av_log(avctx, AV_LOG_INFO, "%s\n", msg); -+ data = CFDataCreate(kCFAllocatorDefault, avctx->extradata, avctx->extradata_size); -+ } else { -+ data = CFDataCreate(kCFAllocatorDefault, vt_extradata, vt_extradata_size); -+ } - av_free(vt_extradata); - return data; - } --- -2.39.5 (Apple Git-154) - diff --git a/patches/ffmpeg-n7.1.1/draft/0033-add-AV1-hardware-acceleration.patch b/patches/ffmpeg-n7.1.1/draft/0033-add-AV1-hardware-acceleration.patch deleted file mode 100644 index ba9e30430..000000000 --- a/patches/ffmpeg-n7.1.1/draft/0033-add-AV1-hardware-acceleration.patch +++ /dev/null @@ -1,271 +0,0 @@ -From a9770e475398405ad4e91cb73369bf0e6a929e9f Mon Sep 17 00:00:00 2001 -From: qianlongxu -Date: Mon, 13 Oct 2025 14:17:36 +0800 -Subject: [PATCH] add AV1 hardware acceleration - ---- - configure | 4 ++ - libavcodec/Makefile | 1 + - libavcodec/av1dec.c | 10 ++++ - libavcodec/hwaccels.h | 1 + - libavcodec/videotoolbox.c | 14 +++++ - libavcodec/videotoolbox_av1.c | 99 +++++++++++++++++++++++++++++++++++ - libavcodec/vt_internal.h | 1 + - 7 files changed, 130 insertions(+) - create mode 100644 libavcodec/videotoolbox_av1.c - -diff --git a/configure b/configure -index fc5e423..9c56a4c 100755 ---- a/configure -+++ b/configure -@@ -2463,6 +2463,7 @@ TYPES_LIST=" - kCMVideoCodecType_HEVC - kCMVideoCodecType_HEVCWithAlpha - kCMVideoCodecType_VP9 -+ kCMVideoCodecType_AV1 - kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange - kCVPixelFormatType_422YpCbCr8BiPlanarVideoRange - kCVPixelFormatType_422YpCbCr10BiPlanarVideoRange -@@ -3168,6 +3169,8 @@ av1_vaapi_hwaccel_deps="vaapi VADecPictureParameterBufferAV1_bit_depth_idx" - av1_vaapi_hwaccel_select="av1_decoder" - av1_vdpau_hwaccel_deps="vdpau VdpPictureInfoAV1" - av1_vdpau_hwaccel_select="av1_decoder" -+av1_videotoolbox_hwaccel_deps="videotoolbox" -+av1_videotoolbox_hwaccel_select="av1_decoder" - av1_vulkan_hwaccel_deps="vulkan" - av1_vulkan_hwaccel_select="av1_decoder" - h263_vaapi_hwaccel_deps="vaapi" -@@ -6700,6 +6703,7 @@ enabled videotoolbox && { - check_func_headers CoreMedia/CMFormatDescription.h kCMVideoCodecType_HEVC "-framework CoreMedia" - check_func_headers CoreMedia/CMFormatDescription.h kCMVideoCodecType_HEVCWithAlpha "-framework CoreMedia" - check_func_headers CoreMedia/CMFormatDescription.h kCMVideoCodecType_VP9 "-framework CoreMedia" -+ check_func_headers CoreMedia/CMFormatDescription.h kCMVideoCodecType_AV1 "-framework CoreMedia" - check_func_headers CoreVideo/CVPixelBuffer.h kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange "-framework CoreVideo" - check_func_headers CoreVideo/CVPixelBuffer.h kCVPixelFormatType_422YpCbCr8BiPlanarVideoRange "-framework CoreVideo" - check_func_headers CoreVideo/CVPixelBuffer.h kCVPixelFormatType_422YpCbCr10BiPlanarVideoRange "-framework CoreVideo" -diff --git a/libavcodec/Makefile b/libavcodec/Makefile -index 441d4ee..d74c06b 100644 ---- a/libavcodec/Makefile -+++ b/libavcodec/Makefile -@@ -1010,6 +1010,7 @@ OBJS-$(CONFIG_AV1_D3D12VA_HWACCEL) += dxva2_av1.o d3d12va_av1.o - OBJS-$(CONFIG_AV1_NVDEC_HWACCEL) += nvdec_av1.o - OBJS-$(CONFIG_AV1_VAAPI_HWACCEL) += vaapi_av1.o - OBJS-$(CONFIG_AV1_VDPAU_HWACCEL) += vdpau_av1.o -+OBJS-$(CONFIG_AV1_VIDEOTOOLBOX_HWACCEL) += videotoolbox_av1.o - OBJS-$(CONFIG_AV1_VULKAN_HWACCEL) += vulkan_decode.o vulkan_av1.o - OBJS-$(CONFIG_H263_VAAPI_HWACCEL) += vaapi_mpeg4.o - OBJS-$(CONFIG_H263_VIDEOTOOLBOX_HWACCEL) += videotoolbox.o -diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c -index 1d5b9ef..0fad09a 100644 ---- a/libavcodec/av1dec.c -+++ b/libavcodec/av1dec.c -@@ -541,6 +541,7 @@ static int get_pixel_format(AVCodecContext *avctx) - CONFIG_AV1_NVDEC_HWACCEL + \ - CONFIG_AV1_VAAPI_HWACCEL + \ - CONFIG_AV1_VDPAU_HWACCEL + \ -+ CONFIG_AV1_VIDEOTOOLBOX_HWACCEL + \ - CONFIG_AV1_VULKAN_HWACCEL) - enum AVPixelFormat pix_fmts[HWACCEL_MAX + 2], *fmtp = pix_fmts; - -@@ -568,6 +569,9 @@ static int get_pixel_format(AVCodecContext *avctx) - #if CONFIG_AV1_VDPAU_HWACCEL - *fmtp++ = AV_PIX_FMT_VDPAU; - #endif -+#if CONFIG_AV1_VIDEOTOOLBOX_HWACCEL -+ *fmtp++ = AV_PIX_FMT_VIDEOTOOLBOX; -+#endif - #if CONFIG_AV1_VULKAN_HWACCEL - *fmtp++ = AV_PIX_FMT_VULKAN; - #endif -@@ -592,6 +596,9 @@ static int get_pixel_format(AVCodecContext *avctx) - #if CONFIG_AV1_VDPAU_HWACCEL - *fmtp++ = AV_PIX_FMT_VDPAU; - #endif -+#if CONFIG_AV1_VIDEOTOOLBOX_HWACCEL -+ *fmtp++ = AV_PIX_FMT_VIDEOTOOLBOX; -+#endif - #if CONFIG_AV1_VULKAN_HWACCEL - *fmtp++ = AV_PIX_FMT_VULKAN; - #endif -@@ -1594,6 +1601,9 @@ const FFCodec ff_av1_decoder = { - #if CONFIG_AV1_VDPAU_HWACCEL - HWACCEL_VDPAU(av1), - #endif -+#if CONFIG_AV1_VIDEOTOOLBOX_HWACCEL -+ HWACCEL_VIDEOTOOLBOX(av1), -+#endif - #if CONFIG_AV1_VULKAN_HWACCEL - HWACCEL_VULKAN(av1), - #endif -diff --git a/libavcodec/hwaccels.h b/libavcodec/hwaccels.h -index 5171e4c..2b9bdc8 100644 ---- a/libavcodec/hwaccels.h -+++ b/libavcodec/hwaccels.h -@@ -26,6 +26,7 @@ extern const struct FFHWAccel ff_av1_dxva2_hwaccel; - extern const struct FFHWAccel ff_av1_nvdec_hwaccel; - extern const struct FFHWAccel ff_av1_vaapi_hwaccel; - extern const struct FFHWAccel ff_av1_vdpau_hwaccel; -+extern const struct FFHWAccel ff_av1_videotoolbox_hwaccel; - extern const struct FFHWAccel ff_av1_vulkan_hwaccel; - extern const struct FFHWAccel ff_h263_vaapi_hwaccel; - extern const struct FFHWAccel ff_h263_videotoolbox_hwaccel; -diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c -index 505483e..392d7fb 100644 ---- a/libavcodec/videotoolbox.c -+++ b/libavcodec/videotoolbox.c -@@ -56,6 +56,10 @@ enum { kCMVideoCodecType_HEVC = 'hvc1' }; - enum { kCMVideoCodecType_VP9 = 'vp09' }; - #endif - -+#if !HAVE_KCMVIDEOCODECTYPE_AV1 -+enum { kCMVideoCodecType_AV1 = 'av01' }; -+#endif -+ - #define VIDEOTOOLBOX_ESDS_EXTRADATA_PADDING 12 - - typedef struct VTHWFrame { -@@ -846,6 +850,13 @@ static CFDictionaryRef videotoolbox_decoder_config_create(CMVideoCodecType codec - if (data) - CFDictionarySetValue(avc_info, CFSTR("vpcC"), data); - break; -+#endif -+#if CONFIG_AV1_VIDEOTOOLBOX_HWACCEL -+ case kCMVideoCodecType_AV1 : -+ data = ff_videotoolbox_av1c_extradata_create(avctx); -+ if (data) -+ CFDictionarySetValue(avc_info, CFSTR("av1C"), data); -+ break; - #endif - default: - break; -@@ -912,6 +923,9 @@ static int videotoolbox_start(AVCodecContext *avctx) - case AV_CODEC_ID_VP9 : - videotoolbox->cm_codec_type = kCMVideoCodecType_VP9; - break; -+ case AV_CODEC_ID_AV1 : -+ videotoolbox->cm_codec_type = kCMVideoCodecType_AV1; -+ break; - default : - break; - } -diff --git a/libavcodec/videotoolbox_av1.c b/libavcodec/videotoolbox_av1.c -new file mode 100644 -index 0000000..4bf0c73 ---- /dev/null -+++ b/libavcodec/videotoolbox_av1.c -@@ -0,0 +1,99 @@ -+/* -+ * Videotoolbox hardware acceleration for AV1 -+ * Copyright (c) 2023 Jan Ekström -+ * -+ * This file is part of FFmpeg. -+ * -+ * FFmpeg is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * FFmpeg is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with FFmpeg; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ */ -+ -+#include "libavformat/avio.h" -+#include "libavformat/avio_internal.h" -+#define CALLED_FROM_AVCODEC 1 -+#include "libavformat/av1.c" -+#undef CALLED_FROM_AVCODEC -+ -+#include "libavutil/avutil.h" -+#include "libavutil/frame.h" -+#include "libavutil/pixfmt.h" -+ -+#include "av1dec.h" -+#include "codec_id.h" -+#include "hwaccel_internal.h" -+#include "internal.h" -+#include "vt_internal.h" -+ -+CFDataRef ff_videotoolbox_av1c_extradata_create(AVCodecContext *avctx) -+{ -+ AVIOContext *pb; -+ uint8_t *buf; -+ CFDataRef data = NULL; -+ int buf_size = 0; -+ int ret = avio_open_dyn_buf(&pb); -+ if (ret < 0) -+ return NULL; -+ -+ ret = ff_isom_write_av1c(pb, avctx->extradata, avctx->extradata_size, 1); -+ if (ret < 0) -+ goto fail; -+ -+ buf_size = avio_get_dyn_buf(pb, &buf); -+ if (buf_size) -+ data = CFDataCreate(kCFAllocatorDefault, buf, buf_size); -+ -+fail: -+ ffio_free_dyn_buf(&pb); -+ -+ return data; -+} -+ -+static int videotoolbox_av1_start_frame(AVCodecContext *avctx, -+ const uint8_t *buffer, -+ uint32_t size) -+{ -+ return 0; -+} -+ -+static int videotoolbox_av1_decode_slice(AVCodecContext *avctx, -+ const uint8_t *buffer, -+ uint32_t size) -+{ -+ VTContext *vtctx = avctx->internal->hwaccel_priv_data; -+ -+ return ff_videotoolbox_buffer_copy(vtctx, buffer, size); -+} -+ -+static int videotoolbox_av1_end_frame(AVCodecContext *avctx) -+{ -+ const AV1DecContext *s = avctx->priv_data; -+ AVFrame *frame = s->cur_frame.f; -+ -+ return ff_videotoolbox_common_end_frame(avctx, frame); -+} -+ -+const FFHWAccel ff_av1_videotoolbox_hwaccel = { -+ .p.name = "av1_videotoolbox", -+ .p.type = AVMEDIA_TYPE_VIDEO, -+ .p.id = AV_CODEC_ID_AV1, -+ .p.pix_fmt = AV_PIX_FMT_VIDEOTOOLBOX, -+ .alloc_frame = ff_videotoolbox_alloc_frame, -+ .start_frame = videotoolbox_av1_start_frame, -+ .decode_slice = videotoolbox_av1_decode_slice, -+ .end_frame = videotoolbox_av1_end_frame, -+ .frame_params = ff_videotoolbox_frame_params, -+ .init = ff_videotoolbox_common_init, -+ .uninit = ff_videotoolbox_uninit, -+ .priv_data_size = sizeof(VTContext), -+}; -\ No newline at end of file -diff --git a/libavcodec/vt_internal.h b/libavcodec/vt_internal.h -index 9502d7c..427348f 100644 ---- a/libavcodec/vt_internal.h -+++ b/libavcodec/vt_internal.h -@@ -64,6 +64,7 @@ int ff_videotoolbox_h264_decode_slice(AVCodecContext *avctx, - const uint8_t *buffer, - uint32_t size); - int ff_videotoolbox_common_end_frame(AVCodecContext *avctx, AVFrame *frame); -+CFDataRef ff_videotoolbox_av1c_extradata_create(AVCodecContext *avctx); - CFDataRef ff_videotoolbox_avcc_extradata_create(AVCodecContext *avctx); - CFDataRef ff_videotoolbox_hvcc_extradata_create(AVCodecContext *avctx); - CFDataRef ff_videotoolbox_vpcc_extradata_create(AVCodecContext *avctx); --- -2.39.5 (Apple Git-154) - diff --git a/patches/ffmpeg-n7.1.1/draft/0042-Adapt-to-clang-16.patch b/patches/ffmpeg-n7.1.1/draft/0042-Adapt-to-clang-16.patch deleted file mode 100644 index a1c792743..000000000 --- a/patches/ffmpeg-n7.1.1/draft/0042-Adapt-to-clang-16.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 338d6fb305a992bc2a24347e4d7793e02b54345d Mon Sep 17 00:00:00 2001 -From: qianlongxu -Date: Thu, 31 Oct 2024 10:55:33 +0800 -Subject: [PATCH 21] Adapt to clang 16 - ---- - configure | 8 +++++++- - 1 file changed, 7 insertions(+), 1 deletion(-) - -diff --git a/configure b/configure -index 16d0177..edbb925 100755 ---- a/configure -+++ b/configure -@@ -5623,7 +5623,13 @@ case $target_os in - enabled x86_32 && append SHFLAGS -Wl,-read_only_relocs,suppress - strip="${strip} -x" - add_ldflags -Wl,-dynamic,-search_paths_first -- check_cflags -Werror=partial-availability -+ # https://gitlab.gnome.org/GNOME/gimp/-/issues/8649 -+ # from clang 15 int <-> pointer conversions now defaults as an error -+ check_cflags -Wno-int-conversion -+ # from clang 16 VTPixelTransferSessionCreate' has been marked as being introduced in tvOS 16.0 here, but the deployment target is tvOS 12.0.0 -+ check_cflags -Wno-unguarded-availability -Wno-unguarded-availability-new -+ -+ # check_cflags -Werror=partial-availability - SLIBSUF=".dylib" - SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)' - SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)' --- -2.39.5 (Apple Git-154) - From 6942780e59b9e4248abd7616a525ade4f4816a77 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Tue, 20 Jan 2026 13:28:02 +0800 Subject: [PATCH 193/359] fix ffmpeg7 patches --- ...er-and-Demuxer-but-av3a-Decoder-is-a.patch | 427 +++++++++--------- ...add-webp-demuxer-and-libwebp-decoder.patch | 45 +- 2 files changed, 225 insertions(+), 247 deletions(-) diff --git a/patches/ffmpeg-n7.1.1/0020-Audio-Vivid-Parser-and-Demuxer-but-av3a-Decoder-is-a.patch b/patches/ffmpeg-n7.1.1/0020-Audio-Vivid-Parser-and-Demuxer-but-av3a-Decoder-is-a.patch index 5585e97fc..6f62d5266 100644 --- a/patches/ffmpeg-n7.1.1/0020-Audio-Vivid-Parser-and-Demuxer-but-av3a-Decoder-is-a.patch +++ b/patches/ffmpeg-n7.1.1/0020-Audio-Vivid-Parser-and-Demuxer-but-av3a-Decoder-is-a.patch @@ -1,29 +1,27 @@ -From 5b534548ec28b006ca8ebf07c0cad8fe07b80833 Mon Sep 17 00:00:00 2001 +From 6ce40ee3d8219cb12d2a0e2f8bb1dd1a495dfab7 Mon Sep 17 00:00:00 2001 From: qianlongxu -Date: Thu, 29 May 2025 10:53:30 +0800 +Date: Tue, 20 Jan 2026 11:45:47 +0800 Subject: [PATCH] Audio Vivid Parser and Demuxer, but av3a Decoder is absent --- - libavcodec/Makefile | 1 + - libavcodec/av3a.h | 314 +++++++++++++++++++++++ - libavcodec/av3a_parser.c | 218 ++++++++++++++++ - libavcodec/codec_desc.c | 7 + - libavcodec/codec_id.h | 1 + - libavcodec/parsers.c | 1 + - libavcodec/utils.c | 1 + - libavformat/Makefile | 1 + - libavformat/allformats.c.rej | 9 + - libavformat/av3adec.c | 472 +++++++++++++++++++++++++++++++++++ - libavformat/isom_tags.c | 1 + - libavformat/mov.c.rej | 158 ++++++++++++ - libavformat/mpegts.c | 6 + - libavformat/mpegts.h | 2 +- - 14 files changed, 1191 insertions(+), 1 deletion(-) + libavcodec/Makefile | 1 + + libavcodec/av3a.h | 314 ++++++++++++++++++++++++++ + libavcodec/av3a_parser.c | 218 ++++++++++++++++++ + libavcodec/codec_desc.c | 7 + + libavcodec/codec_id.h | 1 + + libavcodec/parsers.c | 1 + + libavcodec/utils.c | 1 + + libavformat/Makefile | 1 + + libavformat/allformats.c | 3 + + libavformat/av3adec.c | 473 +++++++++++++++++++++++++++++++++++++++ + libavformat/isom_tags.c | 1 + + libavformat/mov.c | 135 +++++++++++ + libavformat/mpegts.c | 6 + + libavformat/mpegts.h | 2 +- + 14 files changed, 1163 insertions(+), 1 deletion(-) create mode 100644 libavcodec/av3a.h create mode 100644 libavcodec/av3a_parser.c - create mode 100644 libavformat/allformats.c.rej create mode 100644 libavformat/av3adec.c - create mode 100644 libavformat/mov.c.rej diff --git a/libavcodec/Makefile b/libavcodec/Makefile index ed5c705..03e80a2 100644 @@ -637,10 +635,10 @@ index 6909a5b..51074ba 100644 } diff --git a/libavformat/Makefile b/libavformat/Makefile -index 359781b..17222ee 100644 +index 5e88060..ada27f6 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile -@@ -158,6 +158,7 @@ OBJS-$(CONFIG_AVS2_DEMUXER) += avs2dec.o rawdec.o +@@ -159,6 +159,7 @@ OBJS-$(CONFIG_AVS2_DEMUXER) += avs2dec.o rawdec.o OBJS-$(CONFIG_AVS2_MUXER) += rawenc.o OBJS-$(CONFIG_AVS3_DEMUXER) += avs3dec.o rawdec.o OBJS-$(CONFIG_AVS3_MUXER) += rawenc.o @@ -648,27 +646,26 @@ index 359781b..17222ee 100644 OBJS-$(CONFIG_BETHSOFTVID_DEMUXER) += bethsoftvid.o OBJS-$(CONFIG_BFI_DEMUXER) += bfi.o OBJS-$(CONFIG_BINK_DEMUXER) += bink.o -diff --git a/libavformat/allformats.c.rej b/libavformat/allformats.c.rej -new file mode 100644 -index 0000000..623b4c4 ---- /dev/null -+++ b/libavformat/allformats.c.rej -@@ -0,0 +1,9 @@ -+diff a/libavformat/allformats.c b/libavformat/allformats.c (rejected hunks) -+@@ -86,6 +86,7 @@ extern const FFOutputFormat ff_asf_stream_muxer; -+ extern const AVInputFormat ff_au_demuxer; -+ extern const FFOutputFormat ff_au_muxer; -+ extern const AVInputFormat ff_av1_demuxer; -++extern const AVInputFormat ff_av3a_demuxer; -+ extern const AVInputFormat ff_avi_demuxer; -+ extern const FFOutputFormat ff_avi_muxer; -+ extern const FFOutputFormat ff_avif_muxer; +diff --git a/libavformat/allformats.c b/libavformat/allformats.c +index 31a9509..a3553bb 100644 +--- a/libavformat/allformats.c ++++ b/libavformat/allformats.c +@@ -576,6 +576,9 @@ extern const FFInputFormat ff_libmodplug_demuxer; + extern const FFInputFormat ff_libopenmpt_demuxer; + extern const FFInputFormat ff_vapoursynth_demuxer; + ++// custom AV3A demuxer ++extern const FFInputFormat ff_av3a_demuxer; ++ + // ijk custom demuxers + extern FFInputFormat ff_ijklivehook_demuxer; + extern FFInputFormat ff_ijklas_demuxer; diff --git a/libavformat/av3adec.c b/libavformat/av3adec.c new file mode 100644 -index 0000000..51f7ec9 +index 0000000..03f2181 --- /dev/null +++ b/libavformat/av3adec.c -@@ -0,0 +1,472 @@ +@@ -0,0 +1,473 @@ +/* + * AV3A Demuxer + * @@ -936,7 +933,7 @@ index 0000000..51f7ec9 + (channel_number_index < 0)) { + return AVERROR_INVALIDDATA; + } -+ ++ + bitrate_index = get_bits(&gb, 4); + if ((bitrate_index >= AV3A_BITRATE_TABLE_SIZE) || (bitrate_index < 0)) { + return AVERROR_INVALIDDATA; @@ -1104,7 +1101,7 @@ index 0000000..51f7ec9 + if (packet_size < 0) { + return packet_size; + } -+ ++ + if ((ret = av_new_packet(pkt, packet_size)) < 0) { + return ret; + } @@ -1129,18 +1126,20 @@ index 0000000..51f7ec9 + return 0; +} + -+const AVInputFormat ff_av3a_demuxer = { -+ .name = "av3a", -+ .long_name = NULL_IF_CONFIG_SMALL("Audio Vivid"), -+ .raw_codec_id = AV_CODEC_ID_AVS3DA, -+ .priv_data_size = sizeof(FFRawDemuxerContext), -+ .read_probe = av3a_probe, -+ .read_header = av3a_read_header, -+ .read_packet = av3a_read_packet, -+ .flags = AVFMT_GENERIC_INDEX, -+ .extensions = "av3a", -+ .mime_type = "audio/av3a", ++const FFInputFormat ff_av3a_demuxer = { ++ .p.name = "av3a", ++ .p.long_name = NULL_IF_CONFIG_SMALL("Audio Vivid"), ++ .raw_codec_id = AV_CODEC_ID_AVS3DA, ++ .p.priv_class = &ff_raw_demuxer_class, ++ .priv_data_size = sizeof(FFRawDemuxerContext), ++ .read_probe = av3a_probe, ++ .read_header = av3a_read_header, ++ .read_packet = av3a_read_packet, ++ .p.flags = AVFMT_GENERIC_INDEX, ++ .p.extensions = "av3a", ++ .p.mime_type = "audio/av3a", +}; +\ No newline at end of file diff --git a/libavformat/isom_tags.c b/libavformat/isom_tags.c index 5dd72d5..1c52d7c 100644 --- a/libavformat/isom_tags.c @@ -1153,170 +1152,166 @@ index 5dd72d5..1c52d7c 100644 { AV_CODEC_ID_NONE, 0 }, }; -diff --git a/libavformat/mov.c.rej b/libavformat/mov.c.rej -new file mode 100644 -index 0000000..db8f10c ---- /dev/null -+++ b/libavformat/mov.c.rej -@@ -0,0 +1,158 @@ -+diff a/libavformat/mov.c b/libavformat/mov.c (rejected hunks) -+@@ -69,7 +69,9 @@ -+ #include "libavutil/imgutils.h" -+ #include "libavutil/display.h" -+ #include "libavcodec/avcodec.h" -+- -++#if CONFIG_AV3A_DEMUXER -++#include "libavcodec/av3a.h" -++#endif -+ #if CONFIG_ZLIB -+ #include -+ #endif -+@@ -8105,6 +8107,135 @@ static int mov_read_iloc(MOVContext *c, AVIOContext *pb, MOVAtom atom) -+ return atom.size; -+ } -+ -++#if CONFIG_AV3A_DEMUXER -++static int mov_read_dca3(MOVContext *c, AVIOContext *pb, MOVAtom atom) -++{ -++ int ret = 0; -++ int i = 0; -++ int nb_channels = 0; -++ int nb_objects = 0; -++ AVStream *st = NULL; -++ GetBitContext gb; -++ uint8_t buffer[7]; -++ int audio_codec_id, sampling_frequency_index; -++ int nn_type, content_type, channel_number_index, number_objects; -++ int hoa_order, resolution_index, reserved; -++ int bitrate_kbps; -++ -++ if (atom.size < AV3A_DCA3_BOX_MIN_SIZE) { -++ return AVERROR_INVALIDDATA; -++ } -++ -++ init_get_bits8(&gb, buffer, sizeof(buffer)); -++ -++ if (c->fc->nb_streams < 1) { -++ return 0; -++ } -++ st = c->fc->streams[c->fc->nb_streams - 1]; -++ -++ if ((ret = avio_read(pb, buffer, sizeof(buffer))) < 0) { -++ return ret; -++ } -++ -++ audio_codec_id = get_bits(&gb, 4); -++ if (audio_codec_id != AV3A_LOSSY_CODEC_ID) { -++ return AVERROR_INVALIDDATA; -++ } -++ -++ st->codecpar->frame_size = AV3A_AUDIO_FRAME_SIZE; -++ sampling_frequency_index = get_bits(&gb, 4); -++ if ((sampling_frequency_index >= AV3A_FS_TABLE_SIZE) || (sampling_frequency_index < 0)) { -++ return AVERROR_INVALIDDATA; -++ } -++ st->codecpar->sample_rate = ff_av3a_sampling_rate_table[sampling_frequency_index]; -++ -++ nn_type = get_bits(&gb, 3); -++ if ((nn_type > AV3A_LC_NN_TYPE) || (nn_type < AV3A_BASELINE_NN_TYPE)) { -++ return AVERROR_INVALIDDATA; -++ } -++ -++ reserved = get_bits(&gb, 1); -++ content_type = get_bits(&gb, 4); -++ if (content_type == AV3A_CHANNEL_BASED_TYPE) { -++ channel_number_index = get_bits(&gb, 7); -++ reserved = get_bits(&gb, 1); -++ if ((channel_number_index >= CHANNEL_CONFIG_UNKNOWN) || -++ (channel_number_index == CHANNEL_CONFIG_MC_10_2) || -++ (channel_number_index == CHANNEL_CONFIG_MC_22_2) || -++ (channel_number_index < 0)) { -++ return AVERROR_INVALIDDATA; -++ } -++ nb_channels = ff_av3a_channels_map_table[channel_number_index].channels; -++ } else if (content_type == AV3A_OBJECT_BASED_TYPE) { -++ number_objects = get_bits(&gb, 7); -++ reserved = get_bits(&gb, 1); -++ nb_objects = number_objects; -++ if (nb_objects < 1) { -++ return AVERROR_INVALIDDATA; -++ } -++ } else if (content_type == AV3A_CHANNEL_OBJECT_TYPE) { -++ channel_number_index = get_bits(&gb, 7); -++ reserved = get_bits(&gb, 1); -++ if ((channel_number_index >= CHANNEL_CONFIG_UNKNOWN) || -++ (channel_number_index == CHANNEL_CONFIG_MC_10_2) || -++ (channel_number_index == CHANNEL_CONFIG_MC_22_2) || -++ (channel_number_index < 0)) { -++ return AVERROR_INVALIDDATA; -++ } -++ number_objects = get_bits(&gb, 7); -++ reserved = get_bits(&gb, 1); -++ nb_channels = ff_av3a_channels_map_table[channel_number_index].channels; -++ nb_objects = number_objects; -++ if (nb_objects < 1) { -++ return AVERROR_INVALIDDATA; -++ } -++ } else if (content_type == AV3A_AMBISONIC_TYPE) { -++ hoa_order = get_bits(&gb, 4); -++ if ((hoa_order < AV3A_AMBISONIC_FIRST_ORDER) || (hoa_order > AV3A_AMBISONIC_THIRD_ORDER)) { -++ return AVERROR_INVALIDDATA; -++ } -++ nb_channels = (hoa_order + 1) * (hoa_order + 1); -++ } else { -++ return AVERROR_INVALIDDATA; -++ } -++ -++ bitrate_kbps = get_bits(&gb, 16); -++ st->codecpar->bit_rate = bitrate_kbps * 1000; -++ -++ resolution_index = get_bits(&gb, 2); -++ if ((resolution_index >= AV3A_RESOLUTION_TABLE_SIZE) || (resolution_index < 0)) { -++ return AVERROR_INVALIDDATA; -++ } -++ st->codecpar->format = ff_av3a_sample_format_map_table[resolution_index].sample_format; -++ st->codecpar->bits_per_raw_sample = ff_av3a_sample_format_map_table[resolution_index].resolution; -++ -++ av_channel_layout_uninit(&st->codecpar->ch_layout); -++ if (content_type != AV3A_AMBISONIC_TYPE) { -++ st->codecpar->ch_layout.order = AV_CHANNEL_ORDER_CUSTOM; -++ st->codecpar->ch_layout.nb_channels = (nb_channels + nb_objects); -++ st->codecpar->ch_layout.u.map = av_calloc(st->codecpar->ch_layout.nb_channels, sizeof(AVChannelCustom)); -++ if (!st->codecpar->ch_layout.u.map) { -++ return AVERROR(ENOMEM); -++ } -++ -++ if (content_type != AV3A_OBJECT_BASED_TYPE) { -++ for (i = 0; i < nb_channels; i ++) { -++ st->codecpar->ch_layout.u.map[i].id = ff_av3a_channels_map_table[channel_number_index].channel_layout[i]; -++ } -++ } -++ -++ for (i = nb_channels; i < st->codecpar->ch_layout.nb_channels; i++) { -++ st->codecpar->ch_layout.u.map[i].id = AV3A_CH_AUDIO_OBJECT; -++ } -++ } else { -++ st->codecpar->ch_layout.order = AV_CHANNEL_ORDER_AMBISONIC; -++ st->codecpar->ch_layout.nb_channels = nb_channels; -++ } -++ -++ return 0; -++} -++#endif -++ -+ static const MOVParseTableEntry mov_default_parse_table[] = { -+ { MKTAG('A','C','L','R'), mov_read_aclr }, -+ { MKTAG('A','P','R','G'), mov_read_avid }, -+@@ -8212,6 +8343,9 @@ static const MOVParseTableEntry mov_default_parse_table[] = { -+ { MKTAG('p','c','m','C'), mov_read_pcmc }, /* PCM configuration box */ -+ { MKTAG('p','i','t','m'), mov_read_pitm }, -+ { MKTAG('e','v','c','C'), mov_read_glbl }, -++#if CONFIG_AV3A_DEMUXER -++{ MKTAG('d','c','a','3'), mov_read_dca3 }, -++#endif -+ { 0, NULL } -+ }; -+ +diff --git a/libavformat/mov.c b/libavformat/mov.c +index d9d7b80..51deb1a 100644 +--- a/libavformat/mov.c ++++ b/libavformat/mov.c +@@ -69,6 +69,10 @@ + #include "mov_chan.h" + #include "replaygain.h" + ++#if CONFIG_AV3A_DEMUXER ++#include "libavcodec/av3a.h" ++#endif ++ + #if CONFIG_ZLIB + #include + #endif +@@ -88,6 +92,134 @@ static void mov_free_stream_context(AVFormatContext *s, AVStream *st); + static int64_t add_ctts_entry(MOVCtts** ctts_data, unsigned int* ctts_count, unsigned int* allocated_size, + int count, int duration); + ++#if CONFIG_AV3A_DEMUXER ++static int mov_read_dca3(MOVContext *c, AVIOContext *pb, MOVAtom atom) ++{ ++ int ret = 0; ++ int i = 0; ++ int nb_channels = 0; ++ int nb_objects = 0; ++ AVStream *st = NULL; ++ GetBitContext gb; ++ uint8_t buffer[7]; ++ int audio_codec_id, sampling_frequency_index; ++ int nn_type, content_type, channel_number_index, number_objects; ++ int hoa_order, resolution_index, reserved; ++ int bitrate_kbps; ++ ++ if (atom.size < AV3A_DCA3_BOX_MIN_SIZE) { ++ return AVERROR_INVALIDDATA; ++ } ++ ++ init_get_bits8(&gb, buffer, sizeof(buffer)); ++ ++ if (c->fc->nb_streams < 1) { ++ return 0; ++ } ++ st = c->fc->streams[c->fc->nb_streams - 1]; ++ ++ if ((ret = avio_read(pb, buffer, sizeof(buffer))) < 0) { ++ return ret; ++ } ++ ++ audio_codec_id = get_bits(&gb, 4); ++ if (audio_codec_id != AV3A_LOSSY_CODEC_ID) { ++ return AVERROR_INVALIDDATA; ++ } ++ ++ st->codecpar->frame_size = AV3A_AUDIO_FRAME_SIZE; ++ sampling_frequency_index = get_bits(&gb, 4); ++ if ((sampling_frequency_index >= AV3A_FS_TABLE_SIZE) || (sampling_frequency_index < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ st->codecpar->sample_rate = ff_av3a_sampling_rate_table[sampling_frequency_index]; ++ ++ nn_type = get_bits(&gb, 3); ++ if ((nn_type > AV3A_LC_NN_TYPE) || (nn_type < AV3A_BASELINE_NN_TYPE)) { ++ return AVERROR_INVALIDDATA; ++ } ++ ++ reserved = get_bits(&gb, 1); ++ content_type = get_bits(&gb, 4); ++ if (content_type == AV3A_CHANNEL_BASED_TYPE) { ++ channel_number_index = get_bits(&gb, 7); ++ reserved = get_bits(&gb, 1); ++ if ((channel_number_index >= CHANNEL_CONFIG_UNKNOWN) || ++ (channel_number_index == CHANNEL_CONFIG_MC_10_2) || ++ (channel_number_index == CHANNEL_CONFIG_MC_22_2) || ++ (channel_number_index < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ nb_channels = ff_av3a_channels_map_table[channel_number_index].channels; ++ } else if (content_type == AV3A_OBJECT_BASED_TYPE) { ++ number_objects = get_bits(&gb, 7); ++ reserved = get_bits(&gb, 1); ++ nb_objects = number_objects; ++ if (nb_objects < 1) { ++ return AVERROR_INVALIDDATA; ++ } ++ } else if (content_type == AV3A_CHANNEL_OBJECT_TYPE) { ++ channel_number_index = get_bits(&gb, 7); ++ reserved = get_bits(&gb, 1); ++ if ((channel_number_index >= CHANNEL_CONFIG_UNKNOWN) || ++ (channel_number_index == CHANNEL_CONFIG_MC_10_2) || ++ (channel_number_index == CHANNEL_CONFIG_MC_22_2) || ++ (channel_number_index < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ number_objects = get_bits(&gb, 7); ++ reserved = get_bits(&gb, 1); ++ nb_channels = ff_av3a_channels_map_table[channel_number_index].channels; ++ nb_objects = number_objects; ++ if (nb_objects < 1) { ++ return AVERROR_INVALIDDATA; ++ } ++ } else if (content_type == AV3A_AMBISONIC_TYPE) { ++ hoa_order = get_bits(&gb, 4); ++ if ((hoa_order < AV3A_AMBISONIC_FIRST_ORDER) || (hoa_order > AV3A_AMBISONIC_THIRD_ORDER)) { ++ return AVERROR_INVALIDDATA; ++ } ++ nb_channels = (hoa_order + 1) * (hoa_order + 1); ++ } else { ++ return AVERROR_INVALIDDATA; ++ } ++ ++ bitrate_kbps = get_bits(&gb, 16); ++ st->codecpar->bit_rate = bitrate_kbps * 1000; ++ ++ resolution_index = get_bits(&gb, 2); ++ if ((resolution_index >= AV3A_RESOLUTION_TABLE_SIZE) || (resolution_index < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ st->codecpar->format = ff_av3a_sample_format_map_table[resolution_index].sample_format; ++ st->codecpar->bits_per_raw_sample = ff_av3a_sample_format_map_table[resolution_index].resolution; ++ ++ av_channel_layout_uninit(&st->codecpar->ch_layout); ++ if (content_type != AV3A_AMBISONIC_TYPE) { ++ st->codecpar->ch_layout.order = AV_CHANNEL_ORDER_CUSTOM; ++ st->codecpar->ch_layout.nb_channels = (nb_channels + nb_objects); ++ st->codecpar->ch_layout.u.map = av_calloc(st->codecpar->ch_layout.nb_channels, sizeof(AVChannelCustom)); ++ if (!st->codecpar->ch_layout.u.map) { ++ return AVERROR(ENOMEM); ++ } ++ ++ if (content_type != AV3A_OBJECT_BASED_TYPE) { ++ for (i = 0; i < nb_channels; i ++) { ++ st->codecpar->ch_layout.u.map[i].id = ff_av3a_channels_map_table[channel_number_index].channel_layout[i]; ++ } ++ } ++ ++ for (i = nb_channels; i < st->codecpar->ch_layout.nb_channels; i++) { ++ st->codecpar->ch_layout.u.map[i].id = AV3A_CH_AUDIO_OBJECT; ++ } ++ } else { ++ st->codecpar->ch_layout.order = AV_CHANNEL_ORDER_AMBISONIC; ++ st->codecpar->ch_layout.nb_channels = nb_channels; ++ } ++ return 0; ++} ++#endif ++ + static int mov_metadata_track_or_disc_number(MOVContext *c, AVIOContext *pb, + unsigned len, const char *key) + { +@@ -9204,6 +9336,9 @@ static const MOVParseTableEntry mov_default_parse_table[] = { + #if CONFIG_IAMFDEC + { MKTAG('i','a','c','b'), mov_read_iacb }, + #endif ++#if CONFIG_AV3A_DEMUXER ++{ MKTAG('d','c','a','3'), mov_read_dca3 }, ++#endif + { 0, NULL } + }; + diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index 58b50cb..59039ed 100644 --- a/libavformat/mpegts.c @@ -1355,5 +1350,5 @@ index 14ae312..8a45eef 100644 #define STREAM_TYPE_AUDIO_DTS 0x82 #define STREAM_TYPE_AUDIO_TRUEHD 0x83 -- -2.39.5 (Apple Git-154) +2.50.1 (Apple Git-155) diff --git a/patches/ffmpeg-n7.1.1/0032-add-webp-demuxer-and-libwebp-decoder.patch b/patches/ffmpeg-n7.1.1/0032-add-webp-demuxer-and-libwebp-decoder.patch index 74fbc1d72..74a5772bb 100644 --- a/patches/ffmpeg-n7.1.1/0032-add-webp-demuxer-and-libwebp-decoder.patch +++ b/patches/ffmpeg-n7.1.1/0032-add-webp-demuxer-and-libwebp-decoder.patch @@ -1,22 +1,20 @@ -From 83a84dc1fc30d9e48f486489299feb9be4cde432 Mon Sep 17 00:00:00 2001 +From ad3b9e537d7fba11e5d899c4987fd4e84ce9eb03 Mon Sep 17 00:00:00 2001 From: qianlongxu -Date: Thu, 9 Oct 2025 14:28:49 +0800 +Date: Tue, 20 Jan 2026 11:48:50 +0800 Subject: [PATCH] add webp demuxer and libwebp decoder --- - configure | 7 +- - libavcodec/Makefile | 1 + - libavcodec/allcodecs.c | 1 + - libavcodec/codec_desc.c | 9 + - libavcodec/codec_id.h | 1 + - libavcodec/libwebpdec.c | 376 +++++++++++++++++++++++++++++++++++ - libavformat/Makefile | 1 + - libavformat/allformats.c | 1 + - libavformat/allformats.c.rej | 9 - - libavformat/webpdec.c | 296 +++++++++++++++++++++++++++ - 10 files changed, 692 insertions(+), 10 deletions(-) + configure | 7 +- + libavcodec/Makefile | 1 + + libavcodec/allcodecs.c | 1 + + libavcodec/codec_desc.c | 9 + + libavcodec/codec_id.h | 1 + + libavcodec/libwebpdec.c | 376 +++++++++++++++++++++++++++++++++++++++ + libavformat/Makefile | 1 + + libavformat/allformats.c | 1 + + libavformat/webpdec.c | 296 ++++++++++++++++++++++++++++++ + 9 files changed, 692 insertions(+), 1 deletion(-) create mode 100644 libavcodec/libwebpdec.c - delete mode 100644 libavformat/allformats.c.rej create mode 100644 libavformat/webpdec.c diff --git a/configure b/configure @@ -488,7 +486,7 @@ index 1f32e4c..90aef47 100644 OBJS-$(CONFIG_WEBVTT_MUXER) += webvttenc.o OBJS-$(CONFIG_WSAUD_DEMUXER) += westwood_aud.o diff --git a/libavformat/allformats.c b/libavformat/allformats.c -index 31a9509..fbe7967 100644 +index a3553bb..e10385f 100644 --- a/libavformat/allformats.c +++ b/libavformat/allformats.c @@ -564,6 +564,7 @@ extern const FFInputFormat ff_image_svg_pipe_demuxer; @@ -499,21 +497,6 @@ index 31a9509..fbe7967 100644 extern const FFInputFormat ff_image_webp_pipe_demuxer; extern const FFInputFormat ff_image_xbm_pipe_demuxer; extern const FFInputFormat ff_image_xpm_pipe_demuxer; -diff --git a/libavformat/allformats.c.rej b/libavformat/allformats.c.rej -deleted file mode 100644 -index 623b4c4..0000000 ---- a/libavformat/allformats.c.rej -+++ /dev/null -@@ -1,9 +0,0 @@ --diff a/libavformat/allformats.c b/libavformat/allformats.c (rejected hunks) --@@ -86,6 +86,7 @@ extern const FFOutputFormat ff_asf_stream_muxer; -- extern const AVInputFormat ff_au_demuxer; -- extern const FFOutputFormat ff_au_muxer; -- extern const AVInputFormat ff_av1_demuxer; --+extern const AVInputFormat ff_av3a_demuxer; -- extern const AVInputFormat ff_avi_demuxer; -- extern const FFOutputFormat ff_avi_muxer; -- extern const FFOutputFormat ff_avif_muxer; diff --git a/libavformat/webpdec.c b/libavformat/webpdec.c new file mode 100644 index 0000000..df4a3af @@ -817,5 +800,5 @@ index 0000000..df4a3af + .p.priv_class = &webp_demuxer_class, +}; -- -2.39.5 (Apple Git-154) +2.50.1 (Apple Git-155) From 65d782b5eb8dbc986b0bfe43e028d4172c911d2b Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Tue, 20 Jan 2026 14:07:49 +0800 Subject: [PATCH 194/359] fix build error --- ...o-Vivid-Parser-and-Demuxer-but-av3a-Decoder-is-a.patch | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/patches/ffmpeg-n7.1.1/0020-Audio-Vivid-Parser-and-Demuxer-but-av3a-Decoder-is-a.patch b/patches/ffmpeg-n7.1.1/0020-Audio-Vivid-Parser-and-Demuxer-but-av3a-Decoder-is-a.patch index 6f62d5266..c25585560 100644 --- a/patches/ffmpeg-n7.1.1/0020-Audio-Vivid-Parser-and-Demuxer-but-av3a-Decoder-is-a.patch +++ b/patches/ffmpeg-n7.1.1/0020-Audio-Vivid-Parser-and-Demuxer-but-av3a-Decoder-is-a.patch @@ -1,6 +1,6 @@ -From 6ce40ee3d8219cb12d2a0e2f8bb1dd1a495dfab7 Mon Sep 17 00:00:00 2001 +From 1dddf06f8c49c6a1e362b492945cdd6bb5941c3b Mon Sep 17 00:00:00 2001 From: qianlongxu -Date: Tue, 20 Jan 2026 11:45:47 +0800 +Date: Tue, 20 Jan 2026 14:06:57 +0800 Subject: [PATCH] Audio Vivid Parser and Demuxer, but av3a Decoder is absent --- @@ -662,7 +662,7 @@ index 31a9509..a3553bb 100644 extern FFInputFormat ff_ijklas_demuxer; diff --git a/libavformat/av3adec.c b/libavformat/av3adec.c new file mode 100644 -index 0000000..03f2181 +index 0000000..9bb8729 --- /dev/null +++ b/libavformat/av3adec.c @@ -0,0 +1,473 @@ @@ -1034,7 +1034,7 @@ index 0000000..03f2181 + stream->start_time = 0; + ffstream(stream)->need_parsing = AVSTREAM_PARSE_FULL_RAW; + stream->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; -+ stream->codecpar->codec_id = s->iformat->raw_codec_id; ++ stream->codecpar->codec_id = ((const FFInputFormat*)(s->iformat))->raw_codec_id; + stream->codecpar->codec_tag = MKTAG('a', 'v', '3', 'a'); + + if ((ret = avio_read(s->pb, header, AV3A_MAX_NBYTES_HEADER)) != AV3A_MAX_NBYTES_HEADER) { From 23f0da1bb2cd46833692ef16783b409c642ef4ee Mon Sep 17 00:00:00 2001 From: Anka Date: Tue, 20 Jan 2026 06:34:11 +0000 Subject: [PATCH 195/359] upgrade ffmpeg7 to ffmpeg7-7.1.1-260120140857 for apple by cd --- configs/libs/ffmpeg7.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configs/libs/ffmpeg7.sh b/configs/libs/ffmpeg7.sh index 1490f9b49..36c661832 100644 --- a/configs/libs/ffmpeg7.sh +++ b/configs/libs/ffmpeg7.sh @@ -37,8 +37,8 @@ export GIT_REPO_VERSION=7.1.1 # pre compiled -export PRE_COMPILE_TAG_TVOS=ffmpeg7-7.1.1-251216203909 -export PRE_COMPILE_TAG_MACOS=ffmpeg7-7.1.1-251216203909 -export PRE_COMPILE_TAG_IOS=ffmpeg7-7.1.1-251216203909 +export PRE_COMPILE_TAG_TVOS=ffmpeg7-7.1.1-260120140857 +export PRE_COMPILE_TAG_MACOS=ffmpeg7-7.1.1-260120140857 +export PRE_COMPILE_TAG_IOS=ffmpeg7-7.1.1-260120140857 export PRE_COMPILE_TAG_ANDROID=ffmpeg7-7.1.1-250606143631 From cd620227b9804a81bfffee2a89bee9e5c20e26ef Mon Sep 17 00:00:00 2001 From: debugly Date: Fri, 27 Feb 2026 10:02:17 +0800 Subject: [PATCH 196/359] upgrade libs --- configs/libs/ass.sh | 4 ++-- configs/libs/dav1d.sh | 4 ++-- configs/libs/fontconfig.sh | 4 ++-- configs/libs/freetype.sh | 4 ++-- configs/libs/harfbuzz.sh | 4 ++-- configs/libs/openssl3.sh | 4 ++-- configs/libs/xml2.sh | 4 ++-- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/configs/libs/ass.sh b/configs/libs/ass.sh index bd00b1172..bbd2214dc 100644 --- a/configs/libs/ass.sh +++ b/configs/libs/ass.sh @@ -26,9 +26,9 @@ export LIB_NAME='ass' export LIPO_LIBS="libass" export LIB_DEPENDS_BIN="meson cmake pkg-config" export GIT_LOCAL_REPO=extra/ass -export GIT_COMMIT=0.17.3 +export GIT_COMMIT=0.17.4 export REPO_DIR=ass -export GIT_REPO_VERSION=0.17.3 +export GIT_REPO_VERSION=0.17.4 # you can export GIT_ASS_UPSTREAM=git@xx:yy/ASS.git use your mirror if [[ "$GIT_ASS_UPSTREAM" != "" ]] ;then diff --git a/configs/libs/dav1d.sh b/configs/libs/dav1d.sh index 5b4fb4092..59fddd000 100644 --- a/configs/libs/dav1d.sh +++ b/configs/libs/dav1d.sh @@ -20,10 +20,10 @@ export LIB_NAME='dav1d' export LIPO_LIBS="libdav1d" export LIB_DEPENDS_BIN="meson ninja nasm" export GIT_LOCAL_REPO=extra/dav1d -export GIT_COMMIT=1.5.1 +export GIT_COMMIT=1.5.3 export GIT_WITH_SUBMODULE=0 export REPO_DIR=dav1d -export GIT_REPO_VERSION=1.5.1 +export GIT_REPO_VERSION=1.5.3 # you can export GIT_DAV1D_UPSTREAM=git@xx:yy/dav1d.git use your mirror if [[ "$GIT_DAV1D_UPSTREAM" != "" ]] ;then diff --git a/configs/libs/fontconfig.sh b/configs/libs/fontconfig.sh index 5a3f03555..aef079675 100644 --- a/configs/libs/fontconfig.sh +++ b/configs/libs/fontconfig.sh @@ -21,9 +21,9 @@ export LIB_NAME='fontconfig' export LIPO_LIBS="libfontconfig" export LIB_DEPENDS_BIN="meson pkg-config" export GIT_LOCAL_REPO=extra/fontconfig -export GIT_COMMIT=2.16.0 +export GIT_COMMIT=2.17.1 export REPO_DIR=fontconfig -export GIT_REPO_VERSION=2.16.0 +export GIT_REPO_VERSION=2.17.1 # you can export GIT_FONTCONFIG_UPSTREAM=git@xx:yy/fontconfig.git use your mirror if [[ "$GIT_FONTCONFIG_UPSTREAM" != "" ]] ;then diff --git a/configs/libs/freetype.sh b/configs/libs/freetype.sh index 32ee12c47..8e86e7d07 100644 --- a/configs/libs/freetype.sh +++ b/configs/libs/freetype.sh @@ -23,9 +23,9 @@ export LIB_NAME='freetype' export LIPO_LIBS="libfreetype" export LIB_DEPENDS_BIN="meson pkg-config" export GIT_LOCAL_REPO=extra/freetype -export GIT_COMMIT=VER-2-13-3 +export GIT_COMMIT=VER-2-14-1 export REPO_DIR=freetype -export GIT_REPO_VERSION=2.13.3 +export GIT_REPO_VERSION=2.14.1 export GIT_WITH_SUBMODULE=1 # you can export GIT_FREETYPE_UPSTREAM=git@xx:yy/FREETYPE.git use your mirror diff --git a/configs/libs/harfbuzz.sh b/configs/libs/harfbuzz.sh index 3938a44a0..ffb09aae6 100644 --- a/configs/libs/harfbuzz.sh +++ b/configs/libs/harfbuzz.sh @@ -26,9 +26,9 @@ export LIB_NAME='harfbuzz' export LIPO_LIBS="libharfbuzz libharfbuzz-subset" export LIB_DEPENDS_BIN="meson pkg-config" export GIT_LOCAL_REPO=extra/harfbuzz -export GIT_COMMIT=10.2.0 +export GIT_COMMIT=12.3.2 export REPO_DIR=harfbuzz -export GIT_REPO_VERSION=10.2.0 +export GIT_REPO_VERSION=12.3.2 # you can export GIT_HARFBUZZ_UPSTREAM=git@xx:yy/HARFBUZZ.git use your mirror if [[ "$GIT_HARFBUZZ_UPSTREAM" != "" ]] ;then diff --git a/configs/libs/openssl3.sh b/configs/libs/openssl3.sh index 1c42cda54..64e6f7173 100644 --- a/configs/libs/openssl3.sh +++ b/configs/libs/openssl3.sh @@ -18,9 +18,9 @@ export LIB_NAME='openssl' export LIPO_LIBS="libssl libcrypto" export GIT_LOCAL_REPO=extra/openssl -export GIT_COMMIT=openssl-3.5.0 +export GIT_COMMIT=openssl-3.5.5 export REPO_DIR=openssl -export GIT_REPO_VERSION=3.5.0 +export GIT_REPO_VERSION=3.5.5 # you can export GIT_OPUS_UPSTREAM=git@xx:yy/openssl.git use your mirror if [[ "$GIT_OPENSSL_UPSTREAM" != "" ]] ;then diff --git a/configs/libs/xml2.sh b/configs/libs/xml2.sh index 557ae0651..97b8cfebd 100644 --- a/configs/libs/xml2.sh +++ b/configs/libs/xml2.sh @@ -26,9 +26,9 @@ export LIB_NAME='xml2' export LIPO_LIBS="libxml2" export LIB_DEPENDS_BIN="autoconf automake libtool" export GIT_LOCAL_REPO=extra/xml2 -export GIT_COMMIT=v2.13.6 +export GIT_COMMIT=v2.15.1 export REPO_DIR=xml2 -export GIT_REPO_VERSION=2.13.6 +export GIT_REPO_VERSION=2.15.1 # you can export GIT_XML2_UPSTREAM=git@xx:yy/xml2.git use your mirror if [[ "$GIT_XML2_UPSTREAM" != "" ]] ;then From 7d34740f4b5b20a77634d963ad5b954f6e9c1974 Mon Sep 17 00:00:00 2001 From: Anka Date: Fri, 27 Feb 2026 04:51:36 +0000 Subject: [PATCH 197/359] upgrade freetype to freetype-2.14.1-260227124901 for all by cd --- configs/libs/freetype.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/freetype.sh b/configs/libs/freetype.sh index 8e86e7d07..134662151 100644 --- a/configs/libs/freetype.sh +++ b/configs/libs/freetype.sh @@ -36,7 +36,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=freetype-2.13.3-251215231901 -export PRE_COMPILE_TAG_MACOS=freetype-2.13.3-251215231901 -export PRE_COMPILE_TAG_IOS=freetype-2.13.3-251215231901 -export PRE_COMPILE_TAG_ANDROID=freetype-2.13.3-251215231901 +export PRE_COMPILE_TAG_TVOS=freetype-2.14.1-260227124901 +export PRE_COMPILE_TAG_MACOS=freetype-2.14.1-260227124901 +export PRE_COMPILE_TAG_IOS=freetype-2.14.1-260227124901 +export PRE_COMPILE_TAG_ANDROID=freetype-2.14.1-260227124901 From be492c08550cecde7d9f5fa5f59fe12114b34d5e Mon Sep 17 00:00:00 2001 From: Anka Date: Fri, 27 Feb 2026 04:56:43 +0000 Subject: [PATCH 198/359] upgrade dav1d to dav1d-1.5.3-260227124949 for all by cd --- configs/libs/dav1d.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/dav1d.sh b/configs/libs/dav1d.sh index 59fddd000..79bf1fd1e 100644 --- a/configs/libs/dav1d.sh +++ b/configs/libs/dav1d.sh @@ -33,7 +33,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=dav1d-1.5.1-251216081428 -export PRE_COMPILE_TAG_MACOS=dav1d-1.5.1-251216081428 -export PRE_COMPILE_TAG_IOS=dav1d-1.5.1-251216081428 -export PRE_COMPILE_TAG_ANDROID=dav1d-1.5.1-251216081428 +export PRE_COMPILE_TAG_TVOS=dav1d-1.5.3-260227124949 +export PRE_COMPILE_TAG_MACOS=dav1d-1.5.3-260227124949 +export PRE_COMPILE_TAG_IOS=dav1d-1.5.3-260227124949 +export PRE_COMPILE_TAG_ANDROID=dav1d-1.5.3-260227124949 From a59b4148a6b834f78e294ff1e08e8703cfb42202 Mon Sep 17 00:00:00 2001 From: Anka Date: Fri, 27 Feb 2026 05:18:29 +0000 Subject: [PATCH 199/359] upgrade harfbuzz to harfbuzz-12.3.2-260227130743 for all by cd --- configs/libs/harfbuzz.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/harfbuzz.sh b/configs/libs/harfbuzz.sh index ffb09aae6..27b422aa8 100644 --- a/configs/libs/harfbuzz.sh +++ b/configs/libs/harfbuzz.sh @@ -38,7 +38,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=harfbuzz-10.2.0-251216071221 -export PRE_COMPILE_TAG_MACOS=harfbuzz-10.2.0-251216071221 -export PRE_COMPILE_TAG_IOS=harfbuzz-10.2.0-251216071221 -export PRE_COMPILE_TAG_ANDROID=harfbuzz-10.2.0-251216071221 +export PRE_COMPILE_TAG_TVOS=harfbuzz-12.3.2-260227130743 +export PRE_COMPILE_TAG_MACOS=harfbuzz-12.3.2-260227130743 +export PRE_COMPILE_TAG_IOS=harfbuzz-12.3.2-260227130743 +export PRE_COMPILE_TAG_ANDROID=harfbuzz-12.3.2-260227130743 From 12f2aef994412da93614bdb386d4a9564960c86c Mon Sep 17 00:00:00 2001 From: debugly Date: Fri, 27 Feb 2026 21:47:00 +0800 Subject: [PATCH 200/359] =?UTF-8?q?set=20macOS=20min=20target=2010.14?= =?UTF-8?q?=EF=BC=8CiOS/tvOS=20min=20target=2012.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../arm64-ios-simulator.meson | 12 ++++----- configs/meson-crossfiles/arm64-ios.meson | 12 ++++----- configs/meson-crossfiles/arm64-macos.meson | 12 ++++----- .../arm64-tvos-simulator.meson | 12 ++++----- configs/meson-crossfiles/arm64-tvos.meson | 12 ++++----- .../x86_64-ios-simulator.meson | 12 ++++----- configs/meson-crossfiles/x86_64-macos.meson | 12 ++++----- .../x86_64-tvos-simulator.meson | 12 ++++----- do-compile/apple/cmake-compatible.sh | 2 ++ do-compile/apple/meson-compatible.sh | 1 + tools/export-apple-build-env.sh | 27 +++++++++++-------- 11 files changed, 67 insertions(+), 59 deletions(-) diff --git a/configs/meson-crossfiles/arm64-ios-simulator.meson b/configs/meson-crossfiles/arm64-ios-simulator.meson index 0c22c5c91..85f5128b4 100644 --- a/configs/meson-crossfiles/arm64-ios-simulator.meson +++ b/configs/meson-crossfiles/arm64-ios-simulator.meson @@ -11,12 +11,12 @@ strip = 'strip' pkgconfig = 'pkg-config' [built-in options] -c_args = ['-arch', 'arm64', '-mios-simulator-version-min=9.0', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk'] -cpp_args = ['-arch', 'arm64', '-mios-simulator-version-min=9.0', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk'] -c_link_args = ['-arch', 'arm64', '-mios-simulator-version-min=9.0', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk'] -cpp_link_args = ['-arch', 'arm64', '-mios-simulator-version-min=9.0', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk'] -objc_args = ['-arch', 'arm64', '-mios-simulator-version-min=9.0', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk'] -objcpp_args = ['-arch', 'arm64', '-mios-simulator-version-min=9.0', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk'] +c_args = ['-arch', 'arm64', '__DEPLOYMENT_TARGET', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk'] +cpp_args = ['-arch', 'arm64', '__DEPLOYMENT_TARGET', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk'] +c_link_args = ['-arch', 'arm64', '__DEPLOYMENT_TARGET', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk'] +cpp_link_args = ['-arch', 'arm64', '__DEPLOYMENT_TARGET', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk'] +objc_args = ['-arch', 'arm64', '__DEPLOYMENT_TARGET', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk'] +objcpp_args = ['-arch', 'arm64', '__DEPLOYMENT_TARGET', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk'] [properties] root = '__XCODE_DEVELOPER/Platforms/iPhoneSimulator.platform/Developer' diff --git a/configs/meson-crossfiles/arm64-ios.meson b/configs/meson-crossfiles/arm64-ios.meson index daf9dc712..ad6ca5fd9 100644 --- a/configs/meson-crossfiles/arm64-ios.meson +++ b/configs/meson-crossfiles/arm64-ios.meson @@ -10,12 +10,12 @@ strip = 'strip' pkgconfig = 'pkg-config' [built-in options] -c_args = ['-arch', 'arm64', '-miphoneos-version-min=9.0', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk'] -cpp_args = ['-arch', 'arm64', '-miphoneos-version-min=9.0', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk'] -c_link_args = ['-arch', 'arm64', '-miphoneos-version-min=9.0', '-isysroot', '__XCODE_DEVELOPER/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk'] -cpp_link_args = ['-arch', 'arm64', '-miphoneos-version-min=9.0', '-isysroot', '__XCODE_DEVELOPER/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk'] -objc_args = ['-arch', 'arm64', '-miphoneos-version-min=9.0', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk'] -objcpp_args = ['-arch', 'arm64', '-miphoneos-version-min=9.0', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk'] +c_args = ['-arch', 'arm64', '__DEPLOYMENT_TARGET', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk'] +cpp_args = ['-arch', 'arm64', '__DEPLOYMENT_TARGET', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk'] +c_link_args = ['-arch', 'arm64', '__DEPLOYMENT_TARGET', '-isysroot', '__XCODE_DEVELOPER/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk'] +cpp_link_args = ['-arch', 'arm64', '__DEPLOYMENT_TARGET', '-isysroot', '__XCODE_DEVELOPER/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk'] +objc_args = ['-arch', 'arm64', '__DEPLOYMENT_TARGET', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk'] +objcpp_args = ['-arch', 'arm64', '__DEPLOYMENT_TARGET', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk'] [properties] root = '__XCODE_DEVELOPER/Platforms/iPhoneOS.platform/Developer' diff --git a/configs/meson-crossfiles/arm64-macos.meson b/configs/meson-crossfiles/arm64-macos.meson index 5ebc26c10..ac7ba1a73 100644 --- a/configs/meson-crossfiles/arm64-macos.meson +++ b/configs/meson-crossfiles/arm64-macos.meson @@ -10,12 +10,12 @@ strip = 'strip' pkgconfig = 'pkg-config' [built-in options] -c_args = ['-arch', 'arm64', '-mmacosx-version-min=10.11', '-Os'] -cpp_args = ['-arch', 'arm64', '-mmacosx-version-min=10.11', '-Os'] -c_link_args = ['-arch', 'arm64', '-mmacosx-version-min=10.11', '-Os'] -cpp_link_args = ['-arch', 'arm64', '-mmacosx-version-min=10.11', '-Os'] -objc_args = ['-arch', 'arm64', '-mmacosx-version-min=10.11', '-Os'] -objcpp_args = ['-arch', 'arm64', '-mmacosx-version-min=10.11', '-Os'] +c_args = ['-arch', 'arm64', '__DEPLOYMENT_TARGET', '-Os'] +cpp_args = ['-arch', 'arm64', '__DEPLOYMENT_TARGET', '-Os'] +c_link_args = ['-arch', 'arm64', '__DEPLOYMENT_TARGET', '-Os'] +cpp_link_args = ['-arch', 'arm64', '__DEPLOYMENT_TARGET', '-Os'] +objc_args = ['-arch', 'arm64', '__DEPLOYMENT_TARGET', '-Os'] +objcpp_args = ['-arch', 'arm64', '__DEPLOYMENT_TARGET', '-Os'] [properties] root = '__XCODE_DEVELOPER/Platforms/MacOSX.platform/Developer' diff --git a/configs/meson-crossfiles/arm64-tvos-simulator.meson b/configs/meson-crossfiles/arm64-tvos-simulator.meson index 560da2f96..1846d868b 100644 --- a/configs/meson-crossfiles/arm64-tvos-simulator.meson +++ b/configs/meson-crossfiles/arm64-tvos-simulator.meson @@ -10,12 +10,12 @@ strip = 'strip' pkgconfig = 'pkg-config' [built-in options] -c_args = ['-arch', 'arm64', '-mtvos-simulator-version-min=12.0', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk'] -cpp_args = ['-arch', 'arm64', '-mtvos-simulator-version-min=12.0', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk'] -c_link_args = ['-arch', 'arm64', '-mtvos-simulator-version-min=12.0', '-isysroot', '__XCODE_DEVELOPER/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk'] -cpp_link_args = ['-arch', 'arm64', '-mtvos-simulator-version-min=12.0', '-isysroot', '__XCODE_DEVELOPER/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk'] -objc_args = ['-arch', 'arm64', '-mtvos-simulator-version-min=12.0', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk'] -objcpp_args = ['-arch', 'arm64', '-mtvos-simulator-version-min=12.0', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk'] +c_args = ['-arch', 'arm64', '__DEPLOYMENT_TARGET', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk'] +cpp_args = ['-arch', 'arm64', '__DEPLOYMENT_TARGET', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk'] +c_link_args = ['-arch', 'arm64', '__DEPLOYMENT_TARGET', '-isysroot', '__XCODE_DEVELOPER/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk'] +cpp_link_args = ['-arch', 'arm64', '__DEPLOYMENT_TARGET', '-isysroot', '__XCODE_DEVELOPER/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk'] +objc_args = ['-arch', 'arm64', '__DEPLOYMENT_TARGET', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk'] +objcpp_args = ['-arch', 'arm64', '__DEPLOYMENT_TARGET', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk'] [properties] root = '__XCODE_DEVELOPER/Platforms/AppleTVSimulator.platform/Developer' diff --git a/configs/meson-crossfiles/arm64-tvos.meson b/configs/meson-crossfiles/arm64-tvos.meson index fc7a82cf0..367a34361 100644 --- a/configs/meson-crossfiles/arm64-tvos.meson +++ b/configs/meson-crossfiles/arm64-tvos.meson @@ -10,12 +10,12 @@ strip = 'strip' pkgconfig = 'pkg-config' [built-in options] -c_args = ['-arch', 'arm64', '-mtvos-version-min=12.0', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk'] -cpp_args = ['-arch', 'arm64', '-mtvos-version-min=12.0', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk'] -c_link_args = ['-arch', 'arm64', '-mtvos-version-min=12.0', '-isysroot', '__XCODE_DEVELOPER/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk'] -cpp_link_args = ['-arch', 'arm64', '-mtvos-version-min=12.0', '-isysroot', '__XCODE_DEVELOPER/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk'] -objc_args = ['-arch', 'arm64', '-mtvos-version-min=12.0', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk'] -objcpp_args = ['-arch', 'arm64', '-mtvos-version-min=12.0', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk'] +c_args = ['-arch', 'arm64', '__DEPLOYMENT_TARGET', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk'] +cpp_args = ['-arch', 'arm64', '__DEPLOYMENT_TARGET', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk'] +c_link_args = ['-arch', 'arm64', '__DEPLOYMENT_TARGET', '-isysroot', '__XCODE_DEVELOPER/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk'] +cpp_link_args = ['-arch', 'arm64', '__DEPLOYMENT_TARGET', '-isysroot', '__XCODE_DEVELOPER/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk'] +objc_args = ['-arch', 'arm64', '__DEPLOYMENT_TARGET', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk'] +objcpp_args = ['-arch', 'arm64', '__DEPLOYMENT_TARGET', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk'] [properties] root = '__XCODE_DEVELOPER/Platforms/AppleTVOS.platform/Developer' diff --git a/configs/meson-crossfiles/x86_64-ios-simulator.meson b/configs/meson-crossfiles/x86_64-ios-simulator.meson index 205dd0998..d8dbfc53b 100644 --- a/configs/meson-crossfiles/x86_64-ios-simulator.meson +++ b/configs/meson-crossfiles/x86_64-ios-simulator.meson @@ -10,12 +10,12 @@ strip = 'strip' pkgconfig = 'pkg-config' [built-in options] -c_args = ['-arch', 'x86_64', '-mios-simulator-version-min=9.0', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk'] -cpp_args = ['-arch', 'x86_64', '-mios-simulator-version-min=9.0', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk'] -c_link_args = ['-arch', 'x86_64', '-mios-simulator-version-min=9.0', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk'] -cpp_link_args = ['-arch', 'x86_64', '-mios-simulator-version-min=9.0', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk'] -objc_args = ['-arch', 'x86_64', '-mios-simulator-version-min=9.0', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk'] -objcpp_args = ['-arch', 'x86_64', '-mios-simulator-version-min=9.0', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk'] +c_args = ['-arch', 'x86_64', '__DEPLOYMENT_TARGET', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk'] +cpp_args = ['-arch', 'x86_64', '__DEPLOYMENT_TARGET', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk'] +c_link_args = ['-arch', 'x86_64', '__DEPLOYMENT_TARGET', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk'] +cpp_link_args = ['-arch', 'x86_64', '__DEPLOYMENT_TARGET', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk'] +objc_args = ['-arch', 'x86_64', '__DEPLOYMENT_TARGET', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk'] +objcpp_args = ['-arch', 'x86_64', '__DEPLOYMENT_TARGET', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk'] [properties] root = '__XCODE_DEVELOPER/Platforms/iPhoneSimulator.platform/Developer' diff --git a/configs/meson-crossfiles/x86_64-macos.meson b/configs/meson-crossfiles/x86_64-macos.meson index 6920d2555..3de2397e9 100644 --- a/configs/meson-crossfiles/x86_64-macos.meson +++ b/configs/meson-crossfiles/x86_64-macos.meson @@ -10,12 +10,12 @@ strip = 'strip' pkgconfig = 'pkg-config' [built-in options] -c_args = ['-arch', 'x86_64', '-mmacosx-version-min=10.11', '-Os'] -cpp_args = ['-arch', 'x86_64', '-mmacosx-version-min=10.11', '-Os'] -c_link_args = ['-arch', 'x86_64', '-mmacosx-version-min=10.11', '-Os'] -cpp_link_args = ['-arch', 'x86_64', '-mmacosx-version-min=10.11', '-Os'] -objc_args = ['-arch', 'x86_64', '-mmacosx-version-min=10.11', '-Os'] -objcpp_args = ['-arch', 'x86_64', '-mmacosx-version-min=10.11', '-Os'] +c_args = ['-arch', 'x86_64', '__DEPLOYMENT_TARGET', '-Os'] +cpp_args = ['-arch', 'x86_64', '__DEPLOYMENT_TARGET', '-Os'] +c_link_args = ['-arch', 'x86_64', '__DEPLOYMENT_TARGET', '-Os'] +cpp_link_args = ['-arch', 'x86_64', '__DEPLOYMENT_TARGET', '-Os'] +objc_args = ['-arch', 'x86_64', '__DEPLOYMENT_TARGET', '-Os'] +objcpp_args = ['-arch', 'x86_64', '__DEPLOYMENT_TARGET', '-Os'] [properties] root = '__XCODE_DEVELOPER/Platforms/MacOSX.platform/Developer' diff --git a/configs/meson-crossfiles/x86_64-tvos-simulator.meson b/configs/meson-crossfiles/x86_64-tvos-simulator.meson index e4089ad00..d6e0c1d9f 100644 --- a/configs/meson-crossfiles/x86_64-tvos-simulator.meson +++ b/configs/meson-crossfiles/x86_64-tvos-simulator.meson @@ -10,12 +10,12 @@ strip = 'strip' pkgconfig = 'pkg-config' [built-in options] -c_args = ['-arch', 'x86_64', '-mtvos-simulator-version-min=12.0', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk'] -cpp_args = ['-arch', 'x86_64', '-mtvos-simulator-version-min=12.0', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk'] -c_link_args = ['-arch', 'x86_64', '-mtvos-simulator-version-min=12.0', '-isysroot', '__XCODE_DEVELOPER/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk'] -cpp_link_args = ['-arch', 'x86_64', '-mtvos-simulator-version-min=12.0', '-isysroot', '__XCODE_DEVELOPER/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk'] -objc_args = ['-arch', 'x86_64', '-mtvos-simulator-version-min=12.0', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk'] -objcpp_args = ['-arch', 'x86_64', '-mtvos-simulator-version-min=12.0', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk'] +c_args = ['-arch', 'x86_64', '__DEPLOYMENT_TARGET', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk'] +cpp_args = ['-arch', 'x86_64', '__DEPLOYMENT_TARGET', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk'] +c_link_args = ['-arch', 'x86_64', '__DEPLOYMENT_TARGET', '-isysroot', '__XCODE_DEVELOPER/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk'] +cpp_link_args = ['-arch', 'x86_64', '__DEPLOYMENT_TARGET', '-isysroot', '__XCODE_DEVELOPER/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk'] +objc_args = ['-arch', 'x86_64', '__DEPLOYMENT_TARGET', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk'] +objcpp_args = ['-arch', 'x86_64', '__DEPLOYMENT_TARGET', '-Os', '-isysroot', '__XCODE_DEVELOPER/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk'] [properties] root = '__XCODE_DEVELOPER/Platforms/AppleTVSimulator.platform/Developer' diff --git a/do-compile/apple/cmake-compatible.sh b/do-compile/apple/cmake-compatible.sh index f8d6acf44..a97900743 100755 --- a/do-compile/apple/cmake-compatible.sh +++ b/do-compile/apple/cmake-compatible.sh @@ -28,6 +28,7 @@ echo "----------------------" echo "[*] configurate $LIB_NAME" echo "[*] cmake options: $CMAKE_OTHER_OPTS" echo "[*] cmake component: $CMAKE_COMPONENT" +echo "[*] deployment target:$MR_DEPLOYMENT_TARGET_VER" echo "----------------------" build="${MR_BUILD_SOURCE}/cmake_wksp" @@ -65,6 +66,7 @@ cmake -S ${MR_BUILD_SOURCE} \ -DCMAKE_INSTALL_PREFIX=${MR_BUILD_PREFIX} \ -DCMAKE_TOOLCHAIN_FILE="${MR_SHELL_TOOLS_DIR}/ios.toolchain.cmake" \ -DPLATFORM=$pf \ + -DDEPLOYMENT_TARGET=$MR_DEPLOYMENT_TARGET_VER \ ${CMAKE_OTHER_OPTS} \ -GXcode diff --git a/do-compile/apple/meson-compatible.sh b/do-compile/apple/meson-compatible.sh index 97240c71c..394c835ef 100755 --- a/do-compile/apple/meson-compatible.sh +++ b/do-compile/apple/meson-compatible.sh @@ -57,6 +57,7 @@ if [[ $(uname -m) != "$MR_ARCH" || "$MR_FORCE_CROSS" ]]; then cat "$raw_cross_file" > "$cross_file" my_sed_i "s|__XCODE_DEVELOPER|$MR_XCODE_DEVELOPER|" "$cross_file" + my_sed_i "s|__DEPLOYMENT_TARGET|$MR_DEPLOYMENT_TARGET|" "$cross_file" echo "[*] using cross compile, cross file: $cross_file" CFG_FLAGS="$CFG_FLAGS --cross-file $cross_file" diff --git a/tools/export-apple-build-env.sh b/tools/export-apple-build-env.sh index 3a4eb6329..eac44b2e0 100755 --- a/tools/export-apple-build-env.sh +++ b/tools/export-apple-build-env.sh @@ -38,16 +38,18 @@ export MR_XCODE_DEVELOPER="$XCODE_DEVELOPER" echo $(xcodebuild -version) +DEPLOYMENT_TARGET_KEY= if [[ "$MR_PLAT" == 'ios' ]]; then + export MR_DEPLOYMENT_TARGET_VER=12.0 case $_MR_ARCH in *_simulator) export XCRUN_PLATFORM='iPhoneSimulator' - DEPLOYMENT_TARGET='-mios-simulator-version-min=11.0' + DEPLOYMENT_TARGET_KEY='-mios-simulator-version-min' export MR_IS_SIMULATOR=1 ;; 'arm64') export XCRUN_PLATFORM='iPhoneOS' - DEPLOYMENT_TARGET='-miphoneos-version-min=11.0' + DEPLOYMENT_TARGET_KEY='-miphoneos-version-min' export MR_IS_SIMULATOR=0 ;; *) @@ -55,21 +57,23 @@ if [[ "$MR_PLAT" == 'ios' ]]; then exit 1 ;; esac - elif [[ "$MR_PLAT" == 'macos' ]]; then - export XCRUN_PLATFORM='MacOSX' - export MACOSX_DEPLOYMENT_TARGET=10.11 - DEPLOYMENT_TARGET="-mmacosx-version-min=$MACOSX_DEPLOYMENT_TARGET" - export MR_IS_SIMULATOR=0 - elif [[ "$MR_PLAT" == 'tvos' ]]; then +elif [[ "$MR_PLAT" == 'macos' ]]; then + export XCRUN_PLATFORM='MacOSX' + export MACOSX_DEPLOYMENT_TARGET=10.14 + export MR_DEPLOYMENT_TARGET_VER=10.14 + DEPLOYMENT_TARGET_KEY="-mmacosx-version-min" + export MR_IS_SIMULATOR=0 +elif [[ "$MR_PLAT" == 'tvos' ]]; then + export MR_DEPLOYMENT_TARGET_VER=12.0 case $_MR_ARCH in *_simulator) export XCRUN_PLATFORM='AppleTVSimulator' - DEPLOYMENT_TARGET="-mtvos-simulator-version-min=12.0" + DEPLOYMENT_TARGET_KEY="-mtvos-simulator-version-min" export MR_IS_SIMULATOR=1 ;; 'arm64') export XCRUN_PLATFORM='AppleTVOS' - DEPLOYMENT_TARGET="-mtvos-version-min=12.0" + DEPLOYMENT_TARGET_KEY="-mtvos-version-min" export MR_IS_SIMULATOR=0 ;; *) @@ -99,8 +103,9 @@ export MR_FF_ARCH="${MR_ARCH}" export MR_BUILD_SOURCE="${MR_SRC_ROOT}/${REPO_DIR}-${_MR_ARCH}" # ios/fftutorial-x86_64 export MR_BUILD_PREFIX="${MR_PRODUCT_ROOT}/${LIB_NAME}-${_MR_ARCH}" +export MR_DEPLOYMENT_TARGET="${DEPLOYMENT_TARGET_KEY}=${MR_DEPLOYMENT_TARGET_VER}" # -arch x86_64 -mios-simulator-version-min=11.0 -export MR_DEFAULT_CFLAGS="-arch $MR_ARCH $MR_INIT_CFLAGS $DEPLOYMENT_TARGET -D__APPLE__" +export MR_DEFAULT_CFLAGS="-arch $MR_ARCH $MR_INIT_CFLAGS $MR_DEPLOYMENT_TARGET -D__APPLE__" echo "MR_ARCH : [$MR_ARCH]" echo "MR_BUILD_SOURCE : [$MR_BUILD_SOURCE]" From 1f8bf57ade8a8229bbf96f8e33fdb10d2241746d Mon Sep 17 00:00:00 2001 From: Anka Date: Fri, 27 Feb 2026 13:57:36 +0000 Subject: [PATCH 201/359] upgrade dav1d to dav1d-1.5.3-260227215005 for all by cd --- configs/libs/dav1d.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/dav1d.sh b/configs/libs/dav1d.sh index 79bf1fd1e..857890df6 100644 --- a/configs/libs/dav1d.sh +++ b/configs/libs/dav1d.sh @@ -33,7 +33,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=dav1d-1.5.3-260227124949 -export PRE_COMPILE_TAG_MACOS=dav1d-1.5.3-260227124949 -export PRE_COMPILE_TAG_IOS=dav1d-1.5.3-260227124949 -export PRE_COMPILE_TAG_ANDROID=dav1d-1.5.3-260227124949 +export PRE_COMPILE_TAG_TVOS=dav1d-1.5.3-260227215005 +export PRE_COMPILE_TAG_MACOS=dav1d-1.5.3-260227215005 +export PRE_COMPILE_TAG_IOS=dav1d-1.5.3-260227215005 +export PRE_COMPILE_TAG_ANDROID=dav1d-1.5.3-260227215005 From 8932bdb4c72cb2395a5c2545ec1b0f1c7346d2e2 Mon Sep 17 00:00:00 2001 From: Anka Date: Fri, 27 Feb 2026 13:58:40 +0000 Subject: [PATCH 202/359] upgrade opus to opus-1.5.2-260227215113 for all by cd --- configs/libs/opus.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/opus.sh b/configs/libs/opus.sh index 1306de527..17c787a2c 100644 --- a/configs/libs/opus.sh +++ b/configs/libs/opus.sh @@ -39,7 +39,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=opus-1.5.2-251216073342 -export PRE_COMPILE_TAG_MACOS=opus-1.5.2-251216073342 -export PRE_COMPILE_TAG_IOS=opus-1.5.2-251216073342 -export PRE_COMPILE_TAG_ANDROID=opus-1.5.2-251216073342 +export PRE_COMPILE_TAG_TVOS=opus-1.5.2-260227215113 +export PRE_COMPILE_TAG_MACOS=opus-1.5.2-260227215113 +export PRE_COMPILE_TAG_IOS=opus-1.5.2-260227215113 +export PRE_COMPILE_TAG_ANDROID=opus-1.5.2-260227215113 From 8e4e24ff34491d5aeb2646258fc6e434e82355a9 Mon Sep 17 00:00:00 2001 From: debugly Date: Fri, 27 Feb 2026 22:03:01 +0800 Subject: [PATCH 203/359] use meson build system instead of make (try fix libxml2 build failed) --- do-compile/apple/xml2.sh | 104 +++++++++++++++++++++------------------ 1 file changed, 55 insertions(+), 49 deletions(-) diff --git a/do-compile/apple/xml2.sh b/do-compile/apple/xml2.sh index ad575cb6c..fbbbd945a 100755 --- a/do-compile/apple/xml2.sh +++ b/do-compile/apple/xml2.sh @@ -19,52 +19,58 @@ # ./cmake-compatible.sh "-DBUILD_SHARED_LIBS=0 -DLIBXML2_WITH_PROGRAMS=0 -DLIBXML2_WITH_ZLIB=1 -DLIBXML2_WITH_PYTHON=0 -DLIBXML2_WITH_ICONV=1" -CFLAGS="$MR_DEFAULT_CFLAGS" - -# prepare build config -CFG_FLAGS="--prefix=$MR_BUILD_PREFIX" - -# for cross compile -if [[ $(uname -m) != "$MR_ARCH" || "$MR_FORCE_CROSS" ]];then - echo "[*] cross compile, on $(uname -m) compile $MR_PLAT $MR_ARCH." - # https://www.gnu.org/software/automake/manual/html_node/Cross_002dCompilation.html - CFLAGS="$CFLAGS -isysroot $MR_SYS_ROOT" - # $MR_ARCH-apple-darwin - CFG_FLAGS="$CFG_FLAGS --host=$MR_ARCH-apple-darwin --with-sysroot=$MR_SYS_ROOT" -fi - -echo "----------------------" -echo "[*] configurate $LIB_NAME" -echo "----------------------" - -cd $MR_BUILD_SOURCE - -echo -echo "CC: $MR_CC" -echo "CFG_FLAGS: $CFG_FLAGS" -echo "CFLAGS: $CFLAGS" -echo - -export CFLAGS="$CFLAGS" -export LDFLAGS="$CFLAGS" - -export CC="$MR_CC" -export CXX="$MR_CXX" - -./autogen.sh \ - $CFG_FLAGS \ - --prefix=$MR_BUILD_PREFIX \ - --enable-static --disable-shared \ - --disable-fast-install \ - --without-python \ - --without-debug \ - --with-zlib \ - --with-pic \ - --without-lzma - -echo "----------------------" -echo "[*] compile $LIB_NAME" -echo "----------------------" - -make clean >/dev/null -make install -j${MR_HOST_NPROC} \ No newline at end of file +# CFLAGS="$MR_DEFAULT_CFLAGS" + +# # prepare build config +# CFG_FLAGS="--prefix=$MR_BUILD_PREFIX" + +# # for cross compile +# if [[ $(uname -m) != "$MR_ARCH" || "$MR_FORCE_CROSS" ]];then +# echo "[*] cross compile, on $(uname -m) compile $MR_PLAT $MR_ARCH." +# # https://www.gnu.org/software/automake/manual/html_node/Cross_002dCompilation.html +# CFLAGS="$CFLAGS -isysroot $MR_SYS_ROOT" +# # $MR_ARCH-apple-darwin +# CFG_FLAGS="$CFG_FLAGS --host=$MR_ARCH-apple-darwin --with-sysroot=$MR_SYS_ROOT" +# fi + +# echo "----------------------" +# echo "[*] configurate $LIB_NAME" +# echo "----------------------" + +# cd $MR_BUILD_SOURCE + +# echo +# echo "CC: $MR_CC" +# echo "CFG_FLAGS: $CFG_FLAGS" +# echo "CFLAGS: $CFLAGS" +# echo + +# export CFLAGS="$CFLAGS" +# export LDFLAGS="$CFLAGS" + +# export CC="$MR_CC" +# export CXX="$MR_CXX" + +# ./autogen.sh \ +# $CFG_FLAGS \ +# --prefix=$MR_BUILD_PREFIX \ +# --enable-static --disable-shared \ +# --disable-fast-install \ +# --without-python \ +# --without-debug \ +# --with-zlib \ +# --with-pic \ +# --without-lzma + +# echo "----------------------" +# echo "[*] compile $LIB_NAME" +# echo "----------------------" + +# make clean >/dev/null +# make install -j${MR_HOST_NPROC} + +set -e + +CFG_FLAGS="-Ddocs=disabled -Ddebugging=disabled -Dpython=disabled -Dzlib=enabled" + +./meson-compatible.sh "$CFG_FLAGS" \ No newline at end of file From 2d6ca057342e52cde73330aafe8fc750658877d0 Mon Sep 17 00:00:00 2001 From: debugly Date: Fri, 27 Feb 2026 22:11:11 +0800 Subject: [PATCH 204/359] fix libxml2 depends bin --- configs/libs/xml2.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/libs/xml2.sh b/configs/libs/xml2.sh index 97b8cfebd..e087cb960 100644 --- a/configs/libs/xml2.sh +++ b/configs/libs/xml2.sh @@ -24,7 +24,7 @@ export LIB_NAME='xml2' export LIPO_LIBS="libxml2" -export LIB_DEPENDS_BIN="autoconf automake libtool" +export LIB_DEPENDS_BIN="meson pkg-config" export GIT_LOCAL_REPO=extra/xml2 export GIT_COMMIT=v2.15.1 export REPO_DIR=xml2 From 35d0dca928a2ff7d1b26f5fe24fae86a02ffebbf Mon Sep 17 00:00:00 2001 From: debugly Date: Fri, 27 Feb 2026 22:18:27 +0800 Subject: [PATCH 205/359] fix android platform libxml2 build failed --- do-compile/android/xml2.sh | 52 +++----------------------------------- 1 file changed, 3 insertions(+), 49 deletions(-) diff --git a/do-compile/android/xml2.sh b/do-compile/android/xml2.sh index 79f2cbec7..5191e107b 100755 --- a/do-compile/android/xml2.sh +++ b/do-compile/android/xml2.sh @@ -19,54 +19,8 @@ # ./cmake-compatible.sh "-DBUILD_SHARED_LIBS=0 -DLIBXML2_WITH_PROGRAMS=0 -DLIBXML2_WITH_ZLIB=1 -DLIBXML2_WITH_PYTHON=0 -DLIBXML2_WITH_ICONV=1" -CFLAGS="$MR_DEFAULT_CFLAGS" +set -e -# prepare build config -CFG_FLAGS="--prefix=$MR_BUILD_PREFIX" -# for cross compile -if [[ $(uname -m) != "$MR_ARCH" || "$MR_FORCE_CROSS" ]];then - echo "[*] cross compile, on $(uname -m) compile $MR_PLAT $MR_ARCH." - # https://www.gnu.org/software/automake/manual/html_node/Cross_002dCompilation.html - CFLAGS="$CFLAGS -isysroot $MR_SYS_ROOT" - # aarch64-linux-android21 - CFG_FLAGS="$CFG_FLAGS --host=$MR_FF_ARCH-linux-android$MR_ANDROID_API --with-sysroot=$MR_SYS_ROOT" -fi +CFG_FLAGS="-Ddocs=disabled -Ddebugging=disabled -Dpython=disabled -Dzlib=enabled" -echo "----------------------" -echo "[*] configurate $LIB_NAME" -echo "----------------------" - -cd $MR_BUILD_SOURCE - -echo -echo "CC: $MR_TRIPLE_CC" -echo "CFG_FLAGS: $CFG_FLAGS" -echo "CFLAGS: $CFLAGS" -echo - -export CFLAGS="$CFLAGS" -export LDFLAGS="$CFLAGS" - -export CC="$MR_TRIPLE_CC" -export CXX="$MR_TRIPLE_CXX" -export AR="$MR_AR" -export AS="$MR_AS" -export RANLIB="$MR_RANLIB" -export STRIP="$MR_STRIP" -./autogen.sh \ - $CFG_FLAGS \ - --prefix=$MR_BUILD_PREFIX \ - --enable-static --disable-shared \ - --disable-fast-install \ - --without-python \ - --without-debug \ - --with-zlib \ - --with-pic \ - --without-lzma - -echo "----------------------" -echo "[*] compile $LIB_NAME" -echo "----------------------" - -make clean >/dev/null -make install -j${MR_HOST_NPROC} \ No newline at end of file +./meson-compatible.sh "$CFG_FLAGS" \ No newline at end of file From a4fab57ed9029e17549c45b0ba400453df159838 Mon Sep 17 00:00:00 2001 From: debugly Date: Fri, 27 Feb 2026 22:25:37 +0800 Subject: [PATCH 206/359] print more log for debug --- .github/workflows/onestep.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/onestep.sh b/.github/workflows/onestep.sh index b902dc6fd..ab236e9fe 100755 --- a/.github/workflows/onestep.sh +++ b/.github/workflows/onestep.sh @@ -77,7 +77,7 @@ function compile_tvos_platform function compile_android_platform { echo "---do compile android libs--------------------------------------" - ./main.sh compile -p android -c build -l ${LIB_NAME} >> $DIST_DIR/android-compile-log-$RELEASE_VERSION.md + ./main.sh compile -p android -c build -l ${LIB_NAME} #>> $DIST_DIR/android-compile-log-$RELEASE_VERSION.md cd build/product/android/universal zip -ryq $DIST_DIR/${LIB_NAME}-android-universal-${RELEASE_VERSION}.zip ./* cd $ROOT_DIR From afb741d252b9c67c2e30a768a266374901d22024 Mon Sep 17 00:00:00 2001 From: debugly Date: Fri, 27 Feb 2026 22:37:38 +0800 Subject: [PATCH 207/359] android platform not provide iconv --- do-compile/android/xml2.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/do-compile/android/xml2.sh b/do-compile/android/xml2.sh index 5191e107b..6c6eb4fb4 100755 --- a/do-compile/android/xml2.sh +++ b/do-compile/android/xml2.sh @@ -17,10 +17,10 @@ # can't use cmake,because ios undeclared function 'getentropy' # https://gitlab.gnome.org/GNOME/libxml2/-/issues/774#note_2174500 # ./cmake-compatible.sh "-DBUILD_SHARED_LIBS=0 -DLIBXML2_WITH_PROGRAMS=0 -DLIBXML2_WITH_ZLIB=1 -DLIBXML2_WITH_PYTHON=0 -DLIBXML2_WITH_ICONV=1" - +# android platform not provide iconv,apple platform provided. set -e -CFG_FLAGS="-Ddocs=disabled -Ddebugging=disabled -Dpython=disabled -Dzlib=enabled" +CFG_FLAGS="-Ddocs=disabled -Ddebugging=disabled -Dpython=disabled -Dzlib=enabled -Diconv=disabled" ./meson-compatible.sh "$CFG_FLAGS" \ No newline at end of file From 27f2942cfd82a3a78a46eba2895e8ed57d8667fe Mon Sep 17 00:00:00 2001 From: Anka Date: Fri, 27 Feb 2026 14:42:02 +0000 Subject: [PATCH 208/359] upgrade xml2 to xml2-2.15.1-260227223905 for all by cd --- configs/libs/xml2.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/xml2.sh b/configs/libs/xml2.sh index e087cb960..44e3cd570 100644 --- a/configs/libs/xml2.sh +++ b/configs/libs/xml2.sh @@ -38,7 +38,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=xml2-2.13.6-251215230743 -export PRE_COMPILE_TAG_MACOS=xml2-2.13.6-251215230743 -export PRE_COMPILE_TAG_IOS=xml2-2.13.6-251215230743 -export PRE_COMPILE_TAG_ANDROID=xml2-2.13.6-251215230743 +export PRE_COMPILE_TAG_TVOS=xml2-2.15.1-260227223905 +export PRE_COMPILE_TAG_MACOS=xml2-2.15.1-260227223905 +export PRE_COMPILE_TAG_IOS=xml2-2.15.1-260227223905 +export PRE_COMPILE_TAG_ANDROID=xml2-2.15.1-260227223905 From ddc465130fd53579bd9459047ca550845d5a33c2 Mon Sep 17 00:00:00 2001 From: Anka Date: Sat, 28 Feb 2026 04:53:01 +0000 Subject: [PATCH 209/359] upgrade unibreak to unibreak-6.1-260228124943 for all by cd --- configs/libs/unibreak.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/unibreak.sh b/configs/libs/unibreak.sh index 4ff26e66e..482089b2c 100644 --- a/configs/libs/unibreak.sh +++ b/configs/libs/unibreak.sh @@ -38,7 +38,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=unibreak-6.1-251215231407 -export PRE_COMPILE_TAG_MACOS=unibreak-6.1-251215231407 -export PRE_COMPILE_TAG_IOS=unibreak-6.1-251215231407 -export PRE_COMPILE_TAG_ANDROID=unibreak-6.1-251215231407 +export PRE_COMPILE_TAG_TVOS=unibreak-6.1-260228124943 +export PRE_COMPILE_TAG_MACOS=unibreak-6.1-260228124943 +export PRE_COMPILE_TAG_IOS=unibreak-6.1-260228124943 +export PRE_COMPILE_TAG_ANDROID=unibreak-6.1-260228124943 From 2300fc3b85a790da0e6d53feff104b4ecbc8d425 Mon Sep 17 00:00:00 2001 From: Anka Date: Sat, 28 Feb 2026 04:54:05 +0000 Subject: [PATCH 210/359] upgrade fribidi to fribidi-1.0.16-260228125305 for all by cd --- configs/libs/fribidi.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/fribidi.sh b/configs/libs/fribidi.sh index 436f3bdfc..29540b54f 100644 --- a/configs/libs/fribidi.sh +++ b/configs/libs/fribidi.sh @@ -38,7 +38,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=fribidi-1.0.16-251215231739 -export PRE_COMPILE_TAG_MACOS=fribidi-1.0.16-251215231739 -export PRE_COMPILE_TAG_IOS=fribidi-1.0.16-251215231739 -export PRE_COMPILE_TAG_ANDROID=fribidi-1.0.16-251215231739 +export PRE_COMPILE_TAG_TVOS=fribidi-1.0.16-260228125305 +export PRE_COMPILE_TAG_MACOS=fribidi-1.0.16-260228125305 +export PRE_COMPILE_TAG_IOS=fribidi-1.0.16-260228125305 +export PRE_COMPILE_TAG_ANDROID=fribidi-1.0.16-260228125305 From 1074b4a22f5f89d94f55f76fb153b73e8f62a212 Mon Sep 17 00:00:00 2001 From: Anka Date: Sat, 28 Feb 2026 04:55:39 +0000 Subject: [PATCH 211/359] upgrade freetype to freetype-2.14.1-260228125408 for all by cd --- configs/libs/freetype.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/freetype.sh b/configs/libs/freetype.sh index 134662151..e613d028d 100644 --- a/configs/libs/freetype.sh +++ b/configs/libs/freetype.sh @@ -36,7 +36,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=freetype-2.14.1-260227124901 -export PRE_COMPILE_TAG_MACOS=freetype-2.14.1-260227124901 -export PRE_COMPILE_TAG_IOS=freetype-2.14.1-260227124901 -export PRE_COMPILE_TAG_ANDROID=freetype-2.14.1-260227124901 +export PRE_COMPILE_TAG_TVOS=freetype-2.14.1-260228125408 +export PRE_COMPILE_TAG_MACOS=freetype-2.14.1-260228125408 +export PRE_COMPILE_TAG_IOS=freetype-2.14.1-260228125408 +export PRE_COMPILE_TAG_ANDROID=freetype-2.14.1-260228125408 From b6de0047325b533564e4b7a6be7c4e5b387a83c8 Mon Sep 17 00:00:00 2001 From: Anka Date: Sat, 28 Feb 2026 04:56:26 +0000 Subject: [PATCH 212/359] upgrade fontconfig to fontconfig-2.17.1-260228125544 for android by cd --- configs/libs/fontconfig.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/libs/fontconfig.sh b/configs/libs/fontconfig.sh index aef079675..08491581a 100644 --- a/configs/libs/fontconfig.sh +++ b/configs/libs/fontconfig.sh @@ -36,4 +36,4 @@ fi export PRE_COMPILE_TAG_IOS=fontconfig-2.16.0-250226074147 export PRE_COMPILE_TAG_TVOS=fontconfig-2.16.0-250226074147 export PRE_COMPILE_TAG_MACOS=fontconfig-2.16.0-250226074147 -export PRE_COMPILE_TAG_ANDROID=fontconfig-2.16.0-250310111812 +export PRE_COMPILE_TAG_ANDROID=fontconfig-2.17.1-260228125544 From 5477ac4719875407247814d2620112987b08701d Mon Sep 17 00:00:00 2001 From: Anka Date: Sat, 28 Feb 2026 05:00:34 +0000 Subject: [PATCH 213/359] upgrade harfbuzz to harfbuzz-12.3.2-260228125629 for android by cd --- configs/libs/harfbuzz.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/libs/harfbuzz.sh b/configs/libs/harfbuzz.sh index 27b422aa8..68b0ba41e 100644 --- a/configs/libs/harfbuzz.sh +++ b/configs/libs/harfbuzz.sh @@ -41,4 +41,4 @@ fi export PRE_COMPILE_TAG_TVOS=harfbuzz-12.3.2-260227130743 export PRE_COMPILE_TAG_MACOS=harfbuzz-12.3.2-260227130743 export PRE_COMPILE_TAG_IOS=harfbuzz-12.3.2-260227130743 -export PRE_COMPILE_TAG_ANDROID=harfbuzz-12.3.2-260227130743 +export PRE_COMPILE_TAG_ANDROID=harfbuzz-12.3.2-260228125629 From 7b635575674cbe2b8af4b3f08e7f3d8027abe8fd Mon Sep 17 00:00:00 2001 From: debugly Date: Sat, 28 Feb 2026 13:04:09 +0800 Subject: [PATCH 214/359] fix workflow bug --- .github/workflows/all.yml | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/.github/workflows/all.yml b/.github/workflows/all.yml index 8867ae5ff..745b0b667 100644 --- a/.github/workflows/all.yml +++ b/.github/workflows/all.yml @@ -91,31 +91,32 @@ jobs: compile_lib() { local lib_name=$1 - + local platform=$Platform + if [[ "$lib_name" == "fontconfig" ]]; then - if [[ "$Platform" == "all" ]]; then - echo "force Platform to android for fontconfig" - Platform='android' - elif [[ "$Platform" != "android" ]]; then - echo "Skip fontconfig for $Platform" + if [[ "$platform" == "all" ]]; then + echo "force platform to android for fontconfig" + platform='android' + elif [[ "$platform" != "android" ]]; then + echo "Skip fontconfig for $platform" return fi fi if [[ "$lib_name" == "webp" ]]; then - if [[ "$Platform" == "android" ]]; then + if [[ "$platform" == "android" ]]; then echo "Skip webp for android" return - elif [[ "$Platform" == "all" ]]; then + elif [[ "$platform" == "all" ]]; then echo "Skip webp for android" - Platform='apple' + platform='apple' fi fi - echo "------compile $Platform $lib_name------------------------------------" + echo "------compile $platform $lib_name------------------------------------" rm -rf build || git reset --hard || git pull origin - .github/workflows/install-dependencies.sh $lib_name $Platform # 补全依赖安装步骤 - .github/workflows/onestep.sh $lib_name $Platform $DryRun + .github/workflows/install-dependencies.sh $lib_name $platform # 补全依赖安装步骤 + .github/workflows/onestep.sh $lib_name $platform $DryRun } libs=( From 8e2aab103f0a0934df2bc635183ed3755d38bbb5 Mon Sep 17 00:00:00 2001 From: debugly Date: Sat, 28 Feb 2026 13:07:12 +0800 Subject: [PATCH 215/359] fix option "test" is not one of the choices --- do-compile/android/ass.sh | 2 +- do-compile/apple/ass.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/do-compile/android/ass.sh b/do-compile/android/ass.sh index 5f1ce351e..3db54866b 100755 --- a/do-compile/android/ass.sh +++ b/do-compile/android/ass.sh @@ -40,4 +40,4 @@ check_lib 'libunibreak' check_lib 'fontconfig' echo "----------------------" -./meson-compatible.sh "-Dtest=false -Dprofile=false -Dfontconfig=enabled -Dcoretext=disabled -Dasm=disabled -Dlibunibreak=enabled" +./meson-compatible.sh "-Dtest=disabled -Dprofile=false -Dfontconfig=enabled -Dcoretext=disabled -Dasm=disabled -Dlibunibreak=enabled" diff --git a/do-compile/apple/ass.sh b/do-compile/apple/ass.sh index ee7116777..7333d3a65 100755 --- a/do-compile/apple/ass.sh +++ b/do-compile/apple/ass.sh @@ -39,4 +39,4 @@ check_lib 'harfbuzz' check_lib 'libunibreak' echo "----------------------" -./meson-compatible.sh "-Dtest=false -Dprofile=false -Dfontconfig=disabled -Dcoretext=enabled -Dasm=disabled -Dlibunibreak=enabled" \ No newline at end of file +./meson-compatible.sh "-Dtest=disabled -Dprofile=false -Dfontconfig=disabled -Dcoretext=enabled -Dasm=disabled -Dlibunibreak=enabled" \ No newline at end of file From ee7e9f8a7c95d79cbddebd3cba1fd033740f7584 Mon Sep 17 00:00:00 2001 From: Anka Date: Sat, 28 Feb 2026 05:21:01 +0000 Subject: [PATCH 216/359] upgrade harfbuzz to harfbuzz-12.3.2-260228131003 for all by cd --- configs/libs/harfbuzz.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/harfbuzz.sh b/configs/libs/harfbuzz.sh index 68b0ba41e..58d1e15d3 100644 --- a/configs/libs/harfbuzz.sh +++ b/configs/libs/harfbuzz.sh @@ -38,7 +38,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=harfbuzz-12.3.2-260227130743 -export PRE_COMPILE_TAG_MACOS=harfbuzz-12.3.2-260227130743 -export PRE_COMPILE_TAG_IOS=harfbuzz-12.3.2-260227130743 -export PRE_COMPILE_TAG_ANDROID=harfbuzz-12.3.2-260228125629 +export PRE_COMPILE_TAG_TVOS=harfbuzz-12.3.2-260228131003 +export PRE_COMPILE_TAG_MACOS=harfbuzz-12.3.2-260228131003 +export PRE_COMPILE_TAG_IOS=harfbuzz-12.3.2-260228131003 +export PRE_COMPILE_TAG_ANDROID=harfbuzz-12.3.2-260228131003 From 6013e02f051da697c27182d56b67c3a49eddc6fc Mon Sep 17 00:00:00 2001 From: debugly Date: Sat, 28 Feb 2026 13:51:24 +0800 Subject: [PATCH 217/359] fix option "profile" is not one of the choices --- do-compile/android/ass.sh | 2 +- do-compile/apple/ass.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/do-compile/android/ass.sh b/do-compile/android/ass.sh index 3db54866b..c1853d43f 100755 --- a/do-compile/android/ass.sh +++ b/do-compile/android/ass.sh @@ -40,4 +40,4 @@ check_lib 'libunibreak' check_lib 'fontconfig' echo "----------------------" -./meson-compatible.sh "-Dtest=disabled -Dprofile=false -Dfontconfig=enabled -Dcoretext=disabled -Dasm=disabled -Dlibunibreak=enabled" +./meson-compatible.sh "-Dtest=disabled -Dprofile=disabled -Dfontconfig=enabled -Dcoretext=disabled -Dasm=disabled -Dlibunibreak=enabled" diff --git a/do-compile/apple/ass.sh b/do-compile/apple/ass.sh index 7333d3a65..a7fd5bd44 100755 --- a/do-compile/apple/ass.sh +++ b/do-compile/apple/ass.sh @@ -39,4 +39,4 @@ check_lib 'harfbuzz' check_lib 'libunibreak' echo "----------------------" -./meson-compatible.sh "-Dtest=disabled -Dprofile=false -Dfontconfig=disabled -Dcoretext=enabled -Dasm=disabled -Dlibunibreak=enabled" \ No newline at end of file +./meson-compatible.sh "-Dtest=disabled -Dprofile=disabled -Dfontconfig=disabled -Dcoretext=enabled -Dasm=disabled -Dlibunibreak=enabled" \ No newline at end of file From 512072d4849f12a875d9e338bfa7d334791d3a65 Mon Sep 17 00:00:00 2001 From: Anka Date: Sat, 28 Feb 2026 05:54:45 +0000 Subject: [PATCH 218/359] upgrade ass to ass-0.17.4-260228135313 for all by cd --- configs/libs/ass.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/ass.sh b/configs/libs/ass.sh index bbd2214dc..6464003b4 100644 --- a/configs/libs/ass.sh +++ b/configs/libs/ass.sh @@ -38,7 +38,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=ass-0.17.3-251216072625 -export PRE_COMPILE_TAG_MACOS=ass-0.17.3-251216072625 -export PRE_COMPILE_TAG_IOS=ass-0.17.3-251216072625 -export PRE_COMPILE_TAG_ANDROID=ass-0.17.3-251216072625 +export PRE_COMPILE_TAG_TVOS=ass-0.17.4-260228135313 +export PRE_COMPILE_TAG_MACOS=ass-0.17.4-260228135313 +export PRE_COMPILE_TAG_IOS=ass-0.17.4-260228135313 +export PRE_COMPILE_TAG_ANDROID=ass-0.17.4-260228135313 From 0f9db628c81cf3de2009f9a5fede7fa743ab79af Mon Sep 17 00:00:00 2001 From: Anka Date: Sat, 28 Feb 2026 05:56:57 +0000 Subject: [PATCH 219/359] upgrade yuv to yuv-main-f94b8cf7-260228135452 for all by cd --- configs/libs/yuv.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/yuv.sh b/configs/libs/yuv.sh index d467ca348..34a610591 100644 --- a/configs/libs/yuv.sh +++ b/configs/libs/yuv.sh @@ -45,7 +45,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=yuv-main-f94b8cf7-251216072752 -export PRE_COMPILE_TAG_MACOS=yuv-main-f94b8cf7-251216072752 -export PRE_COMPILE_TAG_IOS=yuv-main-f94b8cf7-251216072752 -export PRE_COMPILE_TAG_ANDROID=yuv-main-f94b8cf7-251216072752 \ No newline at end of file +export PRE_COMPILE_TAG_TVOS=yuv-main-f94b8cf7-260228135452 +export PRE_COMPILE_TAG_MACOS=yuv-main-f94b8cf7-260228135452 +export PRE_COMPILE_TAG_IOS=yuv-main-f94b8cf7-260228135452 +export PRE_COMPILE_TAG_ANDROID=yuv-main-f94b8cf7-260228135452 \ No newline at end of file From c9ff2edcb60d089358c4d1b0b5aad69b2bab6ae6 Mon Sep 17 00:00:00 2001 From: Anka Date: Sat, 28 Feb 2026 05:58:45 +0000 Subject: [PATCH 220/359] upgrade soundtouch to soundtouch-2.4.0-260228135702 for all by cd --- configs/libs/soundtouch.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/soundtouch.sh b/configs/libs/soundtouch.sh index ece0f8498..78518c44b 100644 --- a/configs/libs/soundtouch.sh +++ b/configs/libs/soundtouch.sh @@ -40,7 +40,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=soundtouch-2.4.0-251216073041 -export PRE_COMPILE_TAG_MACOS=soundtouch-2.4.0-251216073041 -export PRE_COMPILE_TAG_IOS=soundtouch-2.4.0-251216073041 -export PRE_COMPILE_TAG_ANDROID=soundtouch-2.4.0-251216073041 +export PRE_COMPILE_TAG_TVOS=soundtouch-2.4.0-260228135702 +export PRE_COMPILE_TAG_MACOS=soundtouch-2.4.0-260228135702 +export PRE_COMPILE_TAG_IOS=soundtouch-2.4.0-260228135702 +export PRE_COMPILE_TAG_ANDROID=soundtouch-2.4.0-260228135702 From cb6272f37cbd1a01860cf5449d0410c9d8e9d253 Mon Sep 17 00:00:00 2001 From: Anka Date: Sat, 28 Feb 2026 06:04:33 +0000 Subject: [PATCH 221/359] upgrade opus to opus-1.5.2-260228135851 for all by cd --- configs/libs/opus.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/opus.sh b/configs/libs/opus.sh index 17c787a2c..415c310bf 100644 --- a/configs/libs/opus.sh +++ b/configs/libs/opus.sh @@ -39,7 +39,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=opus-1.5.2-260227215113 -export PRE_COMPILE_TAG_MACOS=opus-1.5.2-260227215113 -export PRE_COMPILE_TAG_IOS=opus-1.5.2-260227215113 -export PRE_COMPILE_TAG_ANDROID=opus-1.5.2-260227215113 +export PRE_COMPILE_TAG_TVOS=opus-1.5.2-260228135851 +export PRE_COMPILE_TAG_MACOS=opus-1.5.2-260228135851 +export PRE_COMPILE_TAG_IOS=opus-1.5.2-260228135851 +export PRE_COMPILE_TAG_ANDROID=opus-1.5.2-260228135851 From 4bf8cae7ca7e42be91f23cba92483ab931cb34fc Mon Sep 17 00:00:00 2001 From: Anka Date: Sat, 28 Feb 2026 06:20:58 +0000 Subject: [PATCH 222/359] upgrade openssl3 to openssl3-3.5.5-260228140440 for all by cd --- configs/libs/openssl3.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/openssl3.sh b/configs/libs/openssl3.sh index 64e6f7173..7263f5af4 100644 --- a/configs/libs/openssl3.sh +++ b/configs/libs/openssl3.sh @@ -30,7 +30,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=openssl3-3.5.0-251216074256 -export PRE_COMPILE_TAG_MACOS=openssl3-3.5.0-251216074256 -export PRE_COMPILE_TAG_IOS=openssl3-3.5.0-251216074256 -export PRE_COMPILE_TAG_ANDROID=openssl3-3.5.0-251216074256 +export PRE_COMPILE_TAG_TVOS=openssl3-3.5.5-260228140440 +export PRE_COMPILE_TAG_MACOS=openssl3-3.5.5-260228140440 +export PRE_COMPILE_TAG_IOS=openssl3-3.5.5-260228140440 +export PRE_COMPILE_TAG_ANDROID=openssl3-3.5.5-260228140440 From 36748a7b26bf72ff6cb04da80163c26c6d468211 Mon Sep 17 00:00:00 2001 From: Anka Date: Sat, 28 Feb 2026 06:23:26 +0000 Subject: [PATCH 223/359] upgrade dvdread to dvdread-6.1.3-260228142110 for all by cd --- configs/libs/dvdread.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/dvdread.sh b/configs/libs/dvdread.sh index d33c23e64..dc2b684fe 100644 --- a/configs/libs/dvdread.sh +++ b/configs/libs/dvdread.sh @@ -38,7 +38,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=dvdread-6.1.3-251216080439 -export PRE_COMPILE_TAG_MACOS=dvdread-6.1.3-251216080439 -export PRE_COMPILE_TAG_IOS=dvdread-6.1.3-251216080439 -export PRE_COMPILE_TAG_ANDROID=dvdread-6.1.3-251216080439 +export PRE_COMPILE_TAG_TVOS=dvdread-6.1.3-260228142110 +export PRE_COMPILE_TAG_MACOS=dvdread-6.1.3-260228142110 +export PRE_COMPILE_TAG_IOS=dvdread-6.1.3-260228142110 +export PRE_COMPILE_TAG_ANDROID=dvdread-6.1.3-260228142110 From b6e27daec8e57a1f627f91db958bbf8a49828879 Mon Sep 17 00:00:00 2001 From: Anka Date: Sat, 28 Feb 2026 06:25:34 +0000 Subject: [PATCH 224/359] upgrade dvdnav to dvdnav-9831fe01-260228142335 for all by cd --- configs/libs/dvdnav.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/dvdnav.sh b/configs/libs/dvdnav.sh index 790abecf6..ddb0dcc97 100644 --- a/configs/libs/dvdnav.sh +++ b/configs/libs/dvdnav.sh @@ -38,7 +38,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=dvdnav-9831fe01-251216080712 -export PRE_COMPILE_TAG_MACOS=dvdnav-9831fe01-251216080712 -export PRE_COMPILE_TAG_IOS=dvdnav-9831fe01-251216080712 -export PRE_COMPILE_TAG_ANDROID=dvdnav-9831fe01-251216080712 +export PRE_COMPILE_TAG_TVOS=dvdnav-9831fe01-260228142335 +export PRE_COMPILE_TAG_MACOS=dvdnav-9831fe01-260228142335 +export PRE_COMPILE_TAG_IOS=dvdnav-9831fe01-260228142335 +export PRE_COMPILE_TAG_ANDROID=dvdnav-9831fe01-260228142335 From 6cbf8761f1ad3fd365d2b9093239bcf636007fc7 Mon Sep 17 00:00:00 2001 From: Anka Date: Sat, 28 Feb 2026 06:29:30 +0000 Subject: [PATCH 225/359] upgrade bluray to bluray-1.3.4-260228142542 for all by cd --- configs/libs/bluray.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/bluray.sh b/configs/libs/bluray.sh index 956cb95fa..25dc2001e 100644 --- a/configs/libs/bluray.sh +++ b/configs/libs/bluray.sh @@ -40,7 +40,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=bluray-1.3.4-251216080943 -export PRE_COMPILE_TAG_MACOS=bluray-1.3.4-251216080943 -export PRE_COMPILE_TAG_IOS=bluray-1.3.4-251216080943 -export PRE_COMPILE_TAG_ANDROID=bluray-1.3.4-251216080943 +export PRE_COMPILE_TAG_TVOS=bluray-1.3.4-260228142542 +export PRE_COMPILE_TAG_MACOS=bluray-1.3.4-260228142542 +export PRE_COMPILE_TAG_IOS=bluray-1.3.4-260228142542 +export PRE_COMPILE_TAG_ANDROID=bluray-1.3.4-260228142542 From d4321dcb98bc43729c91d82b3e3beeac3552f2b3 Mon Sep 17 00:00:00 2001 From: Anka Date: Sat, 28 Feb 2026 06:36:11 +0000 Subject: [PATCH 226/359] upgrade dav1d to dav1d-1.5.3-260228142936 for all by cd --- configs/libs/dav1d.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/dav1d.sh b/configs/libs/dav1d.sh index 857890df6..e54a7d966 100644 --- a/configs/libs/dav1d.sh +++ b/configs/libs/dav1d.sh @@ -33,7 +33,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=dav1d-1.5.3-260227215005 -export PRE_COMPILE_TAG_MACOS=dav1d-1.5.3-260227215005 -export PRE_COMPILE_TAG_IOS=dav1d-1.5.3-260227215005 -export PRE_COMPILE_TAG_ANDROID=dav1d-1.5.3-260227215005 +export PRE_COMPILE_TAG_TVOS=dav1d-1.5.3-260228142936 +export PRE_COMPILE_TAG_MACOS=dav1d-1.5.3-260228142936 +export PRE_COMPILE_TAG_IOS=dav1d-1.5.3-260228142936 +export PRE_COMPILE_TAG_ANDROID=dav1d-1.5.3-260228142936 From 7fae9cf35bd59cf47d837932738184354217542a Mon Sep 17 00:00:00 2001 From: Anka Date: Sat, 28 Feb 2026 06:38:55 +0000 Subject: [PATCH 227/359] upgrade uavs3d to uavs3d-1.2.1-260228143617 for all by cd --- configs/libs/uavs3d.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/uavs3d.sh b/configs/libs/uavs3d.sh index 90e3ecb10..3dd2dc367 100644 --- a/configs/libs/uavs3d.sh +++ b/configs/libs/uavs3d.sh @@ -38,7 +38,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_ANDROID=uavs3d-1.2.1-251216093159 -export PRE_COMPILE_TAG_TVOS=uavs3d-1.2.1-251216093159 -export PRE_COMPILE_TAG_MACOS=uavs3d-1.2.1-251216093159 -export PRE_COMPILE_TAG_IOS=uavs3d-1.2.1-251216093159 +export PRE_COMPILE_TAG_ANDROID=uavs3d-1.2.1-260228143617 +export PRE_COMPILE_TAG_TVOS=uavs3d-1.2.1-260228143617 +export PRE_COMPILE_TAG_MACOS=uavs3d-1.2.1-260228143617 +export PRE_COMPILE_TAG_IOS=uavs3d-1.2.1-260228143617 From bd9293265db873cbae6cc499c274368ec3a709a1 Mon Sep 17 00:00:00 2001 From: Anka Date: Sat, 28 Feb 2026 06:47:35 +0000 Subject: [PATCH 228/359] upgrade smb2 to smb2-6.2-260228143900 for all by cd --- configs/libs/smb2.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/smb2.sh b/configs/libs/smb2.sh index d8e144327..ae4e4313c 100644 --- a/configs/libs/smb2.sh +++ b/configs/libs/smb2.sh @@ -40,7 +40,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=smb2-6.2-251216093637 -export PRE_COMPILE_TAG_MACOS=smb2-6.2-251216093637 -export PRE_COMPILE_TAG_IOS=smb2-6.2-251216093637 -export PRE_COMPILE_TAG_ANDROID=smb2-6.2-251216093637 +export PRE_COMPILE_TAG_TVOS=smb2-6.2-260228143900 +export PRE_COMPILE_TAG_MACOS=smb2-6.2-260228143900 +export PRE_COMPILE_TAG_IOS=smb2-6.2-260228143900 +export PRE_COMPILE_TAG_ANDROID=smb2-6.2-260228143900 From 4e65b8102d3705641b1605f26a9ab5e591eae4bc Mon Sep 17 00:00:00 2001 From: Anka Date: Sat, 28 Feb 2026 06:57:03 +0000 Subject: [PATCH 229/359] upgrade webp to webp-v1.6.0-260228144739 for apple by cd --- configs/libs/webp.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configs/libs/webp.sh b/configs/libs/webp.sh index 74bdd6862..46775f9f5 100644 --- a/configs/libs/webp.sh +++ b/configs/libs/webp.sh @@ -34,7 +34,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=webp-v1.6.0-251216133036 -export PRE_COMPILE_TAG_MACOS=webp-v1.6.0-251216133036 -export PRE_COMPILE_TAG_IOS=webp-v1.6.0-251216133036 +export PRE_COMPILE_TAG_TVOS=webp-v1.6.0-260228144739 +export PRE_COMPILE_TAG_MACOS=webp-v1.6.0-260228144739 +export PRE_COMPILE_TAG_IOS=webp-v1.6.0-260228144739 export PRE_COMPILE_TAG_ANDROID= \ No newline at end of file From 0c36b44f5778dddb6b94eff58dc71f05699f3d6c Mon Sep 17 00:00:00 2001 From: Anka Date: Sat, 28 Feb 2026 07:14:45 +0000 Subject: [PATCH 230/359] upgrade ijkffmpeg to ijkffmpeg-4.0-260228145716 for all by cd --- configs/libs/ijkffmpeg.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/ijkffmpeg.sh b/configs/libs/ijkffmpeg.sh index d62b05bff..574433383 100644 --- a/configs/libs/ijkffmpeg.sh +++ b/configs/libs/ijkffmpeg.sh @@ -40,8 +40,8 @@ else fi # pre compiled -export PRE_COMPILE_TAG_ANDROID=ijkffmpeg-4.0-251216211157 -export PRE_COMPILE_TAG_TVOS=ijkffmpeg-4.0-251216134050 -export PRE_COMPILE_TAG_MACOS=ijkffmpeg-4.0-251216134050 -export PRE_COMPILE_TAG_IOS=ijkffmpeg-4.0-251216134050 +export PRE_COMPILE_TAG_ANDROID=ijkffmpeg-4.0-260228145716 +export PRE_COMPILE_TAG_TVOS=ijkffmpeg-4.0-260228145716 +export PRE_COMPILE_TAG_MACOS=ijkffmpeg-4.0-260228145716 +export PRE_COMPILE_TAG_IOS=ijkffmpeg-4.0-260228145716 From f3b60d0da6c4bba9451dafca4de6482ed22bd6ec Mon Sep 17 00:00:00 2001 From: Anka Date: Sat, 28 Feb 2026 10:18:55 +0000 Subject: [PATCH 231/359] upgrade ffmpeg4 to ffmpeg4-4.0.5-260228175651 for all by cd --- configs/libs/ffmpeg4.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/ffmpeg4.sh b/configs/libs/ffmpeg4.sh index c55f7248a..89f202c80 100644 --- a/configs/libs/ffmpeg4.sh +++ b/configs/libs/ffmpeg4.sh @@ -36,7 +36,7 @@ export GIT_COMMIT=n4.0.5 export GIT_REPO_VERSION=4.0.5 # pre compiled -export PRE_COMPILE_TAG_TVOS=ffmpeg4-4.0.5-251216184429 -export PRE_COMPILE_TAG_MACOS=ffmpeg4-4.0.5-251216184429 -export PRE_COMPILE_TAG_IOS=ffmpeg4-4.0.5-251216184429 -export PRE_COMPILE_TAG_ANDROID=ffmpeg4-4.0.5-251216184429 \ No newline at end of file +export PRE_COMPILE_TAG_TVOS=ffmpeg4-4.0.5-260228175651 +export PRE_COMPILE_TAG_MACOS=ffmpeg4-4.0.5-260228175651 +export PRE_COMPILE_TAG_IOS=ffmpeg4-4.0.5-260228175651 +export PRE_COMPILE_TAG_ANDROID=ffmpeg4-4.0.5-260228175651 \ No newline at end of file From 4ec2eea086b59bba4633f5ea3f0f0a0a609c4dbb Mon Sep 17 00:00:00 2001 From: Anka Date: Sat, 28 Feb 2026 10:41:02 +0000 Subject: [PATCH 232/359] upgrade ffmpeg5 to ffmpeg5-5.1.6-260228181929 for all by cd --- configs/libs/ffmpeg5.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/ffmpeg5.sh b/configs/libs/ffmpeg5.sh index dc401cd85..cbf096b20 100644 --- a/configs/libs/ffmpeg5.sh +++ b/configs/libs/ffmpeg5.sh @@ -36,7 +36,7 @@ export GIT_COMMIT=n5.1.6 export GIT_REPO_VERSION=5.1.6 # pre compiled -export PRE_COMPILE_TAG_TVOS=ffmpeg5-5.1.6-251216191558 -export PRE_COMPILE_TAG_MACOS=ffmpeg5-5.1.6-251216191558 -export PRE_COMPILE_TAG_IOS=ffmpeg5-5.1.6-251216191558 -export PRE_COMPILE_TAG_ANDROID=ffmpeg5-5.1.6-251216191558 \ No newline at end of file +export PRE_COMPILE_TAG_TVOS=ffmpeg5-5.1.6-260228181929 +export PRE_COMPILE_TAG_MACOS=ffmpeg5-5.1.6-260228181929 +export PRE_COMPILE_TAG_IOS=ffmpeg5-5.1.6-260228181929 +export PRE_COMPILE_TAG_ANDROID=ffmpeg5-5.1.6-260228181929 \ No newline at end of file From ff7c1661dd8fdc2b983a03dd3e1d84072b064218 Mon Sep 17 00:00:00 2001 From: Anka Date: Sat, 28 Feb 2026 11:03:43 +0000 Subject: [PATCH 233/359] upgrade ffmpeg6 to ffmpeg6-6.1.1-260228184138 for all by cd --- configs/libs/ffmpeg6.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/ffmpeg6.sh b/configs/libs/ffmpeg6.sh index 0f52650c1..c2108b591 100644 --- a/configs/libs/ffmpeg6.sh +++ b/configs/libs/ffmpeg6.sh @@ -36,7 +36,7 @@ export GIT_COMMIT=n6.1.1 #origin/release/5.1 export GIT_REPO_VERSION=6.1.1 # pre compiled -export PRE_COMPILE_TAG_TVOS=ffmpeg6-6.1.1-251216194428 -export PRE_COMPILE_TAG_MACOS=ffmpeg6-6.1.1-251216194428 -export PRE_COMPILE_TAG_IOS=ffmpeg6-6.1.1-251216194428 -export PRE_COMPILE_TAG_ANDROID=ffmpeg6-6.1.1-251216194428 \ No newline at end of file +export PRE_COMPILE_TAG_TVOS=ffmpeg6-6.1.1-260228184138 +export PRE_COMPILE_TAG_MACOS=ffmpeg6-6.1.1-260228184138 +export PRE_COMPILE_TAG_IOS=ffmpeg6-6.1.1-260228184138 +export PRE_COMPILE_TAG_ANDROID=ffmpeg6-6.1.1-260228184138 \ No newline at end of file From 2319959be25d9d3cea6f595e2d32ef32f20ac382 Mon Sep 17 00:00:00 2001 From: Anka Date: Sat, 28 Feb 2026 12:46:40 +0000 Subject: [PATCH 234/359] upgrade ffmpeg7 to ffmpeg7-7.1.1-260228202640 for apple by cd --- configs/libs/ffmpeg7.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configs/libs/ffmpeg7.sh b/configs/libs/ffmpeg7.sh index 36c661832..821df7b02 100644 --- a/configs/libs/ffmpeg7.sh +++ b/configs/libs/ffmpeg7.sh @@ -37,8 +37,8 @@ export GIT_REPO_VERSION=7.1.1 # pre compiled -export PRE_COMPILE_TAG_TVOS=ffmpeg7-7.1.1-260120140857 -export PRE_COMPILE_TAG_MACOS=ffmpeg7-7.1.1-260120140857 -export PRE_COMPILE_TAG_IOS=ffmpeg7-7.1.1-260120140857 +export PRE_COMPILE_TAG_TVOS=ffmpeg7-7.1.1-260228202640 +export PRE_COMPILE_TAG_MACOS=ffmpeg7-7.1.1-260228202640 +export PRE_COMPILE_TAG_IOS=ffmpeg7-7.1.1-260228202640 export PRE_COMPILE_TAG_ANDROID=ffmpeg7-7.1.1-250606143631 From 011d04404af1558384d7a616142a1597519df0eb Mon Sep 17 00:00:00 2001 From: debugly Date: Sat, 28 Feb 2026 22:23:23 +0800 Subject: [PATCH 235/359] fix start library logic --- .github/workflows/all.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/all.yml b/.github/workflows/all.yml index 745b0b667..6a94e350e 100644 --- a/.github/workflows/all.yml +++ b/.github/workflows/all.yml @@ -156,9 +156,10 @@ jobs: break fi done - # 如果找到了first_library,则调整数组顺序 + # 如果找到了 first_library,则截取数组 if [[ $start_index -ne -1 ]]; then - libs=("${libs[@]:$start_index}" "${libs[@]:0:$start_index}") + # 仅保留从 start_index 开始到最后的部分 + libs=("${libs[@]:$start_index}") else echo "Warning: first_library $first not found in the library list." fi From 4353d140e94137596551f6c4a0a2c2530807173a Mon Sep 17 00:00:00 2001 From: debugly Date: Sat, 28 Feb 2026 22:35:25 +0800 Subject: [PATCH 236/359] android ffmpeg7 disable webp --- configs/ffconfig/auto-detect-third-libs.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/configs/ffconfig/auto-detect-third-libs.sh b/configs/ffconfig/auto-detect-third-libs.sh index 073d8f8bb..cc8ba4df1 100644 --- a/configs/ffconfig/auto-detect-third-libs.sh +++ b/configs/ffconfig/auto-detect-third-libs.sh @@ -241,8 +241,13 @@ else fi echo "----------------------" - pkg-config --libs libwebp --silence-errors >/dev/null && enable_webp=1 + +if [[ $enable_webp && $MR_PLAT == 'android' ]];then + enable_webp= + echo "force disable libwebp on android platform" +fi + if [[ $enable_webp ]];then echo "[✅] --enable-libwebp --enable-decoder=webp : $(pkg-config --modversion libwebp)" THIRD_CFG_FLAGS="$THIRD_CFG_FLAGS --enable-libwebp --enable-demuxer=webp --enable-decoder=libwebp" From c3572170b380df4643af37cca6908fcec4c65e98 Mon Sep 17 00:00:00 2001 From: debugly Date: Sun, 1 Mar 2026 15:03:15 +0800 Subject: [PATCH 237/359] patches for fftutorial --- configs/libs/fftutorial.sh | 1 + ...s-only-available-on-iOS-13.0-or-newe.patch | 25 +++++++++++++++ .../fftutorial/0021-Adapt-to-clang-16.patch | 31 +++++++++++++++++++ 3 files changed, 57 insertions(+) create mode 100644 patches/fftutorial/0018-supportsFamily-is-only-available-on-iOS-13.0-or-newe.patch create mode 100644 patches/fftutorial/0021-Adapt-to-clang-16.patch diff --git a/configs/libs/fftutorial.sh b/configs/libs/fftutorial.sh index 5b14a96ff..75af0c09f 100644 --- a/configs/libs/fftutorial.sh +++ b/configs/libs/fftutorial.sh @@ -23,6 +23,7 @@ export LIPO_LIBS="libavcodec libavformat libavutil libswscale libswresample" export LIB_DEPENDS_BIN="nasm pkg-config" export GIT_LOCAL_REPO=extra/ffmpeg export REPO_DIR=ffmpeg +export PATCH_DIR=fftutorial # you can export GIT_FFMPEG_UPSTREAM=git@xx:yy/FFmpeg.git use your mirror if [[ "$GIT_FFMPEG_UPSTREAM" != "" ]] ;then diff --git a/patches/fftutorial/0018-supportsFamily-is-only-available-on-iOS-13.0-or-newe.patch b/patches/fftutorial/0018-supportsFamily-is-only-available-on-iOS-13.0-or-newe.patch new file mode 100644 index 000000000..1e5a4a6c8 --- /dev/null +++ b/patches/fftutorial/0018-supportsFamily-is-only-available-on-iOS-13.0-or-newe.patch @@ -0,0 +1,25 @@ +From 1ebd4c062a886049f3c3255c50fe56f6621b9844 Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Fri, 26 Jul 2024 16:11:14 +0800 +Subject: [PATCH 18] 'supportsFamily:' is only available on iOS 13.0 or newer + +--- + libavfilter/metal/utils.m | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libavfilter/metal/utils.m b/libavfilter/metal/utils.m +index f365d3c..bb1825a 100644 +--- a/libavfilter/metal/utils.m ++++ b/libavfilter/metal/utils.m +@@ -31,7 +31,7 @@ void ff_metal_compute_encoder_dispatch(id device, + BOOL fallback = YES; + // MAC_OS_X_VERSION_10_15 is only defined on SDKs new enough to include its functionality (including iOS, tvOS, etc) + #ifdef MAC_OS_X_VERSION_10_15 +- if (@available(macOS 10.15, iOS 11, tvOS 14.5, *)) { ++ if (@available(macOS 10.15, iOS 13, tvOS 14.5, *)) { + if ([device supportsFamily:MTLGPUFamilyCommon3]) { + MTLSize threadsPerGrid = MTLSizeMake(width, height, 1); + [encoder dispatchThreads:threadsPerGrid threadsPerThreadgroup:threadsPerThreadgroup]; +-- +2.39.3 (Apple Git-146) + diff --git a/patches/fftutorial/0021-Adapt-to-clang-16.patch b/patches/fftutorial/0021-Adapt-to-clang-16.patch new file mode 100644 index 000000000..a1c792743 --- /dev/null +++ b/patches/fftutorial/0021-Adapt-to-clang-16.patch @@ -0,0 +1,31 @@ +From 338d6fb305a992bc2a24347e4d7793e02b54345d Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Thu, 31 Oct 2024 10:55:33 +0800 +Subject: [PATCH 21] Adapt to clang 16 + +--- + configure | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/configure b/configure +index 16d0177..edbb925 100755 +--- a/configure ++++ b/configure +@@ -5623,7 +5623,13 @@ case $target_os in + enabled x86_32 && append SHFLAGS -Wl,-read_only_relocs,suppress + strip="${strip} -x" + add_ldflags -Wl,-dynamic,-search_paths_first +- check_cflags -Werror=partial-availability ++ # https://gitlab.gnome.org/GNOME/gimp/-/issues/8649 ++ # from clang 15 int <-> pointer conversions now defaults as an error ++ check_cflags -Wno-int-conversion ++ # from clang 16 VTPixelTransferSessionCreate' has been marked as being introduced in tvOS 16.0 here, but the deployment target is tvOS 12.0.0 ++ check_cflags -Wno-unguarded-availability -Wno-unguarded-availability-new ++ ++ # check_cflags -Werror=partial-availability + SLIBSUF=".dylib" + SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)' + SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)' +-- +2.39.5 (Apple Git-154) + From 8ac9db30db6e7a1c240d7956e9018845f901d321 Mon Sep 17 00:00:00 2001 From: debugly Date: Sun, 1 Mar 2026 15:22:07 +0800 Subject: [PATCH 238/359] support verbose log --- .github/workflows/all.yml | 12 +++++- .github/workflows/apple-android-common.yml | 10 ++++- .github/workflows/onestep.sh | 45 +++++++++++++++++++--- 3 files changed, 59 insertions(+), 8 deletions(-) diff --git a/.github/workflows/all.yml b/.github/workflows/all.yml index 6a94e350e..f2a1bb8f6 100644 --- a/.github/workflows/all.yml +++ b/.github/workflows/all.yml @@ -63,6 +63,14 @@ on: options: - true - false + verbose: + description: 'print detail logs' + required: false + type: choice + default: 'false' + options: + - true + - false pull_request: branches: [master] @@ -88,7 +96,7 @@ jobs: Platform=${{ inputs.platform }} DryRun=${{ inputs.dryrun }} - + Verbose=${{ inputs.verbose }} compile_lib() { local lib_name=$1 local platform=$Platform @@ -116,7 +124,7 @@ jobs: echo "------compile $platform $lib_name------------------------------------" rm -rf build || git reset --hard || git pull origin .github/workflows/install-dependencies.sh $lib_name $platform # 补全依赖安装步骤 - .github/workflows/onestep.sh $lib_name $platform $DryRun + .github/workflows/onestep.sh $lib_name $platform $DryRun $Verbose } libs=( diff --git a/.github/workflows/apple-android-common.yml b/.github/workflows/apple-android-common.yml index 70fbdf095..77e6c5d5f 100644 --- a/.github/workflows/apple-android-common.yml +++ b/.github/workflows/apple-android-common.yml @@ -35,6 +35,14 @@ on: options: - true - false + verbose: + description: 'print detail logs' + required: false + type: choice + default: 'false' + options: + - true + - false lib: description: 'choose a lib for compile' required: true @@ -89,6 +97,6 @@ jobs: - name: Install dependencies run: .github/workflows/install-dependencies.sh ${{ inputs.lib }} ${{ inputs.platform }} - name: One Step - run: .github/workflows/onestep.sh ${{ inputs.lib }} ${{ inputs.platform }} ${{ inputs.dryrun }} + run: .github/workflows/onestep.sh ${{ inputs.lib }} ${{ inputs.platform }} ${{ inputs.dryrun }} ${{ inputs.verbose }} env: ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} \ No newline at end of file diff --git a/.github/workflows/onestep.sh b/.github/workflows/onestep.sh index ab236e9fe..94e0d7ddb 100755 --- a/.github/workflows/onestep.sh +++ b/.github/workflows/onestep.sh @@ -15,6 +15,12 @@ else export DRYRUN= fi +if [[ -n $4 && "$4" == 'true' ]];then + export VERBOSE=1 +else + export VERBOSE= +fi + export HOMEBREW_NO_AUTO_UPDATE=1 export RELEASE_DATE=$(TZ=UTC-8 date +'%y%m%d%H%M%S') export RELEASE_VERSION=$(grep GIT_REPO_VERSION= ./configs/libs/${LIB_NAME}.sh | tail -n 1 | awk -F = '{printf "%s",$2}') @@ -40,8 +46,15 @@ function init_platform function compile_ios_platform { echo "---do compile ios libs--------------------------------------" - ./main.sh compile -p ios -c build -l ${LIB_NAME} --skip-fmwk >> $DIST_DIR/ios-compile-log-$RELEASE_VERSION.md - + + local log_file="$DIST_DIR/ios-compile-log-$RELEASE_VERSION.md" + + if [[ $VERBOSE ]];then + ./main.sh compile -p ios -c build -l ${LIB_NAME} --skip-fmwk 2>&1 | tee -a "$log_file" + else + ./main.sh compile -p ios -c build -l ${LIB_NAME} --skip-fmwk >> "$log_file" 2>&1 + fi + cd build/product/ios/universal zip -ryq $DIST_DIR/${LIB_NAME}-ios-universal-${RELEASE_VERSION}.zip ./* @@ -53,8 +66,15 @@ function compile_ios_platform function compile_macos_platform { echo "---do compile macos libs--------------------------------------" - ./main.sh compile -p macos -c build -l ${LIB_NAME} --skip-fmwk >> $DIST_DIR/macos-compile-log-$RELEASE_VERSION.md + local log_file="$DIST_DIR/macos-compile-log-$RELEASE_VERSION.md" + + if [[ $VERBOSE ]];then + ./main.sh compile -p macos -c build -l ${LIB_NAME} --skip-fmwk 2>&1 | tee -a "$log_file" + else + ./main.sh compile -p macos -c build -l ${LIB_NAME} --skip-fmwk >> "$log_file" 2>&1 + fi + cd build/product/macos/universal zip -ryq $DIST_DIR/${LIB_NAME}-macos-universal-${RELEASE_VERSION}.zip ./* cd $ROOT_DIR @@ -63,7 +83,14 @@ function compile_macos_platform function compile_tvos_platform { echo "---do compile tvos libs--------------------------------------" - ./main.sh compile -p tvos -c build -l ${LIB_NAME} --skip-fmwk >> $DIST_DIR/android-compile-log-$RELEASE_VERSION.md + + local log_file="$DIST_DIR/android-compile-log-$RELEASE_VERSION.md" + + if [[ $VERBOSE ]];then + ./main.sh compile -p tvos -c build -l ${LIB_NAME} --skip-fmwk 2>&1 | tee -a "$log_file" + else + ./main.sh compile -p tvos -c build -l ${LIB_NAME} --skip-fmwk >> "$log_file" 2>&1 + fi cd build/product/tvos/universal zip -ryq $DIST_DIR/${LIB_NAME}-tvos-universal-${RELEASE_VERSION}.zip ./* @@ -77,7 +104,15 @@ function compile_tvos_platform function compile_android_platform { echo "---do compile android libs--------------------------------------" - ./main.sh compile -p android -c build -l ${LIB_NAME} #>> $DIST_DIR/android-compile-log-$RELEASE_VERSION.md + + local log_file="$DIST_DIR/android-compile-log-$RELEASE_VERSION.md" + + if [[ $VERBOSE ]];then + ./main.sh compile -p android -c build -l ${LIB_NAME} 2>&1 | tee -a "$log_file" + else + ./main.sh compile -p android -c build -l ${LIB_NAME} >> "$log_file" 2>&1 + fi + cd build/product/android/universal zip -ryq $DIST_DIR/${LIB_NAME}-android-universal-${RELEASE_VERSION}.zip ./* cd $ROOT_DIR From 4d2b5668a94f91e0c7a02cb723e04e8b0a1d4191 Mon Sep 17 00:00:00 2001 From: debugly Date: Sun, 1 Mar 2026 15:31:18 +0800 Subject: [PATCH 239/359] fix Unknown option "--disable-avresample". --- configs/ffconfig/module-default.sh | 3 ++- configs/ffconfig/module-lite-hevc.sh | 3 ++- configs/ffconfig/module-lite.sh | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/configs/ffconfig/module-default.sh b/configs/ffconfig/module-default.sh index 9f02c4e43..284266a8b 100755 --- a/configs/ffconfig/module-default.sh +++ b/configs/ffconfig/module-default.sh @@ -41,7 +41,8 @@ export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-swresample" export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-swscale" export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-postproc" export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-avfilter" -export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-avresample" +#ffmpeg 5 has no avresample lib. +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-avresample" # export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-pthreads" # export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-w32threads" # export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-os2threads" diff --git a/configs/ffconfig/module-lite-hevc.sh b/configs/ffconfig/module-lite-hevc.sh index 1c30d2248..d942d1d38 100755 --- a/configs/ffconfig/module-lite-hevc.sh +++ b/configs/ffconfig/module-lite-hevc.sh @@ -41,7 +41,8 @@ export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-swresample" export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-swscale" export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-postproc" export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-avfilter" -export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-avresample" +#ffmpeg 5 has no avresample lib. +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-avresample" # export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-pthreads" # export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-w32threads" # export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-os2threads" diff --git a/configs/ffconfig/module-lite.sh b/configs/ffconfig/module-lite.sh index b839e10ca..ca02da303 100755 --- a/configs/ffconfig/module-lite.sh +++ b/configs/ffconfig/module-lite.sh @@ -41,7 +41,8 @@ export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-swresample" export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-swscale" export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-postproc" export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-avfilter" -export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-avresample" +#ffmpeg 5 has no avresample lib. +# export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-avresample" # export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-pthreads" # export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-w32threads" # export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-os2threads" From c08570350a6e0ad17adef2dd45ef170d063698f4 Mon Sep 17 00:00:00 2001 From: Anka Date: Sun, 1 Mar 2026 07:43:41 +0000 Subject: [PATCH 240/359] upgrade fftutorial to fftutorial-6.1.1-260301153347 for apple by cd --- configs/libs/fftutorial.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configs/libs/fftutorial.sh b/configs/libs/fftutorial.sh index 75af0c09f..a0fb2d19c 100644 --- a/configs/libs/fftutorial.sh +++ b/configs/libs/fftutorial.sh @@ -36,8 +36,8 @@ export GIT_COMMIT=n6.1.1 #origin/release/5.1 export GIT_REPO_VERSION=6.1.1 # pre compiled -export PRE_COMPILE_TAG_TVOS=fftutorial-6.1.1-250413171857 -export PRE_COMPILE_TAG_MACOS=fftutorial-6.1.1-250413171857 -export PRE_COMPILE_TAG_IOS=fftutorial-6.1.1-250413171857 +export PRE_COMPILE_TAG_TVOS=fftutorial-6.1.1-260301153347 +export PRE_COMPILE_TAG_MACOS=fftutorial-6.1.1-260301153347 +export PRE_COMPILE_TAG_IOS=fftutorial-6.1.1-260301153347 export PRE_COMPILE_TAG_ANDROID= From f3c63e4b6624431b52356153ac6a6962bd4a9476 Mon Sep 17 00:00:00 2001 From: debugly Date: Sun, 1 Mar 2026 19:56:06 +0800 Subject: [PATCH 241/359] update README --- README.md | 18 +++++++++--------- README_zh-CN.md | 18 +++++++++--------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 155cb667f..d0798409a 100644 --- a/README.md +++ b/README.md @@ -12,9 +12,9 @@ At present MRFFToolChain contained `ass、bluray、dav1d、dvdread、dvdnav、ff | platform | architectures | minimum deployment target | | -------- | --------------------------------------- | ------------------------- | -| iOS | arm64、arm64_simulator、x86_64_simulator | 11.0 | +| iOS | arm64、arm64_simulator、x86_64_simulator | 12.0 | | tvOS | arm64、arm64_simulator、x86_64_simulator | 12.0 | -| macOS | arm64、x86_64 | 10.11 | +| macOS | arm64、x86_64 | 10.14 | | Android | arm64、armv7a、x86_64、x86 | 21 | ## News @@ -124,23 +124,23 @@ If cloning repositories from GitHub is slow, or if you need to use an internal p | ffmpeg5 | 5.1.6 | https://github.com/FFmpeg/FFmpeg.git | export GIT_FFMPEG_UPSTREAM=git@xx:yy/FFmpeg.git | | ffmpeg4 | 4.0.5 | https://github.com/FFmpeg/FFmpeg.git | export GIT_FFMPEG_UPSTREAM=git@xx:yy/FFmpeg.git | | ijkffmpeg | ff4.0--ijk0.8.8--20210426--001 | https://github.com/bilibili/FFmpeg.git | export GIT_IJKFFMPEG_UPSTREAM=git@xx:yy/FFmpeg.git | -| ass | 0.17.3 | https://github.com/libass/libass.git | export GIT_ASS_UPSTREAM=git@xx:yy/libass.git | +| ass | 0.17.4 | https://github.com/libass/libass.git | export GIT_ASS_UPSTREAM=git@xx:yy/libass.git | | bluray | 1.3.4 | https://code.videolan.org/videolan/libbluray.git | export GIT_BLURAY_UPSTREAM=git@xx:yy/libbluray.git | -| dav1d | 1.5.1 | https://code.videolan.org/videolan/dav1d.git | export GIT_DAV1D_UPSTREAM=git@xx:yy/dav1d.git | +| dav1d | 1.5.3 | https://code.videolan.org/videolan/dav1d.git | export GIT_DAV1D_UPSTREAM=git@xx:yy/dav1d.git | | dvdread | 6.1.3 | https://code.videolan.org/videolan/libdvdread.git | export GIT_DVDREAD_UPSTREAM=git@xx:yy/libdvdread.git | | dvdnav | master-9831fe01 | https://code.videolan.org/videolan/libdvdnav.git | export GIT_DVDNAV_UPSTREAM=git@xx:yy/libdvdnav.git | -| fontconfig | 2.16.0 | https://gitlab.freedesktop.org/fontconfig/fontconfig.git | export GIT_FONTCONFIG_UPSTREAM=git@xx:yy/fontconfig.git | -| freetype | 2.13.3 | https://gitlab.freedesktop.org/freetype/freetype.git | export GIT_FREETYPE_UPSTREAM=git@xx:yy/freetype.git | +| fontconfig | 2.17.1 | https://gitlab.freedesktop.org/fontconfig/fontconfig.git | export GIT_FONTCONFIG_UPSTREAM=git@xx:yy/fontconfig.git | +| freetype | 2.14.1 | https://gitlab.freedesktop.org/freetype/freetype.git | export GIT_FREETYPE_UPSTREAM=git@xx:yy/freetype.git | | fribidi | 1.0.16 | https://github.com/fribidi/fribidi.git | export GIT_FRIBIDI_UPSTREAM=git@xx:yy/fribidi.git | -| harfbuzz | 10.2.0 | https://github.com/harfbuzz/harfbuzz.git | export GIT_HARFBUZZ_UPSTREAM=git@xx:yy/harfbuzz.git | +| harfbuzz | 12.3.2 | https://github.com/harfbuzz/harfbuzz.git | export GIT_HARFBUZZ_UPSTREAM=git@xx:yy/harfbuzz.git | | openssl | 1.1.1w | https://github.com/openssl/openssl.git | export GIT_OPENSSL_UPSTREAM=git@xx:yy/openssl.git | -| openssl3 | 3.5.0 | https://github.com/openssl/openssl.git | export GIT_OPENSSL_UPSTREAM=git@xx:yy/openssl.git | +| openssl3 | 3.5.5 | https://github.com/openssl/openssl.git | export GIT_OPENSSL_UPSTREAM=git@xx:yy/openssl.git | | opus | 1.5.2 | https://gitlab.xiph.org/xiph/opus.git | export GIT_OPUS_UPSTREAM=git@xx:yy/opus.git | | smb2 | 6.2 | https://github.com/sahlberg/libsmb2.git | export GIT_SMB2_UPSTREAM=git@xx:yy/libsmb2.git | | soundtouch | 2.4.0 | https://codeberg.org/soundtouch/soundtouch.git | export GIT_SOUNDTOUCH_UPSTREAM=git@xx:yy/soundtouch.git | | unibreak | 6.1 | https://github.com/adah1972/libunibreak.git | export GIT_UNIBREAK_UPSTREAM=git@xx:yy/libunibreak.git | | uavs3d | 1.2.1 | https://github.com/uavs3/uavs3d.git | export GIT_UAVS3D_UPSTREAM=git@xx:yy/UAVS3D.git | -| xml2 | 2.13.6 | https://github.com/GNOME/libxml2.git | export GIT_FONTCONFIG_UPSTREAM=git@xx:yy/fontconfig.git | +| xml2 | 2.15.1 | https://github.com/GNOME/libxml2.git | export GIT_FONTCONFIG_UPSTREAM=git@xx:yy/fontconfig.git | | yuv | main-f94b8cf7 | https://github.com/debugly/libyuv.git | export GIT_YUV_UPSTREAM=git@xx:yy/yuv.git | | webp | v1.6.0 | https://github.com/debugly/libwebp.git | export GIT_WEBP_UPSTREAM=git@xx:yy/webp.git | diff --git a/README_zh-CN.md b/README_zh-CN.md index d0f3a5960..e5aba256a 100644 --- a/README_zh-CN.md +++ b/README_zh-CN.md @@ -12,9 +12,9 @@ MRFFToolChain 是一套成熟的编译工具,专门用来编译 iOS、macOS、 | 平台 | 架构 | 最低部署目标版本 | | -------- | -------------------------------------- | ------------------------- | -| iOS | arm64、arm64_simulator、x86_64_simulator | 11.0 | +| iOS | arm64、arm64_simulator、x86_64_simulator | 12.0 | | tvOS | arm64、arm64_simulator、x86_64_simulator | 12.0 | -| macOS | arm64、x86_64 | 10.11 | +| macOS | arm64、x86_64 | 10.14 | | Android | arm64、armv7a、x86_64、x86 | 21 | ## 最新动态 @@ -126,23 +126,23 @@ MRFFToolChain 是一套成熟的编译工具,专门用来编译 iOS、macOS、 | ffmpeg5 | 5.1.6 | https://github.com/FFmpeg/FFmpeg.git | export GIT_FFMPEG_UPSTREAM=git@xx:yy/FFmpeg.git | | ffmpeg4 | 4.0.5 | https://github.com/FFmpeg/FFmpeg.git | export GIT_FFMPEG_UPSTREAM=git@xx:yy/FFmpeg.git | | ijkffmpeg | ff4.0--ijk0.8.8--20210426--001 | https://github.com/bilibili/FFmpeg.git | export GIT_IJKFFMPEG_UPSTREAM=git@xx:yy/FFmpeg.git | -| ass | 0.17.3 | https://github.com/libass/libass.git | export GIT_ASS_UPSTREAM=git@xx:yy/libass.git | +| ass | 0.17.4 | https://github.com/libass/libass.git | export GIT_ASS_UPSTREAM=git@xx:yy/libass.git | | bluray | 1.3.4 | https://code.videolan.org/videolan/libbluray.git | export GIT_BLURAY_UPSTREAM=git@xx:yy/libbluray.git | -| dav1d | 1.5.1 | https://code.videolan.org/videolan/dav1d.git | export GIT_DAV1D_UPSTREAM=git@xx:yy/dav1d.git | +| dav1d | 1.5.3 | https://code.videolan.org/videolan/dav1d.git | export GIT_DAV1D_UPSTREAM=git@xx:yy/dav1d.git | | dvdread | 6.1.3 | https://code.videolan.org/videolan/libdvdread.git | export GIT_DVDREAD_UPSTREAM=git@xx:yy/libdvdread.git | | dvdnav | master-9831fe01 | https://code.videolan.org/videolan/libdvdnav.git | export GIT_DVDNAV_UPSTREAM=git@xx:yy/libdvdnav.git | -| fontconfig | 2.16.0 | https://gitlab.freedesktop.org/fontconfig/fontconfig.git | export GIT_FONTCONFIG_UPSTREAM=git@xx:yy/fontconfig.git | -| freetype | 2.13.3 | https://gitlab.freedesktop.org/freetype/freetype.git | export GIT_FREETYPE_UPSTREAM=git@xx:yy/freetype.git | +| fontconfig | 2.17.1 | https://gitlab.freedesktop.org/fontconfig/fontconfig.git | export GIT_FONTCONFIG_UPSTREAM=git@xx:yy/fontconfig.git | +| freetype | 2.14.1 | https://gitlab.freedesktop.org/freetype/freetype.git | export GIT_FREETYPE_UPSTREAM=git@xx:yy/freetype.git | | fribidi | 1.0.16 | https://github.com/fribidi/fribidi.git | export GIT_FRIBIDI_UPSTREAM=git@xx:yy/fribidi.git | -| harfbuzz | 10.2.0 | https://github.com/harfbuzz/harfbuzz.git | export GIT_HARFBUZZ_UPSTREAM=git@xx:yy/harfbuzz.git | +| harfbuzz | 12.3.2 | https://github.com/harfbuzz/harfbuzz.git | export GIT_HARFBUZZ_UPSTREAM=git@xx:yy/harfbuzz.git | | openssl | 1.1.1w | https://github.com/openssl/openssl.git | export GIT_OPENSSL_UPSTREAM=git@xx:yy/openssl.git | -| openssl3 | 3.5.0 | https://github.com/openssl/openssl.git | export GIT_OPENSSL_UPSTREAM=git@xx:yy/openssl.git | +| openssl3 | 3.5.5 | https://github.com/openssl/openssl.git | export GIT_OPENSSL_UPSTREAM=git@xx:yy/openssl.git | | opus | 1.5.2 | https://gitlab.xiph.org/xiph/opus.git | export GIT_OPUS_UPSTREAM=git@xx:yy/opus.git | | smb2 | 6.2 | https://github.com/sahlberg/libsmb2.git | export GIT_SMB2_UPSTREAM=git@xx:yy/libsmb2.git | | soundtouch | 2.4.0 | https://codeberg.org/soundtouch/soundtouch.git | export GIT_SOUNDTOUCH_UPSTREAM=git@xx:yy/soundtouch.git | | unibreak | 6.1 | https://github.com/adah1972/libunibreak.git | export GIT_UNIBREAK_UPSTREAM=git@xx:yy/libunibreak.git | | uavs3d | 1.2.1 | https://github.com/uavs3/uavs3d.git | export GIT_UAVS3D_UPSTREAM=git@xx:yy/UAVS3D.git | -| xml2 | 2.13.6 | https://github.com/GNOME/libxml2.git | export GIT_FONTCONFIG_UPSTREAM=git@xx:yy/fontconfig.git | +| xml2 | 2.15.1 | https://github.com/GNOME/libxml2.git | export GIT_FONTCONFIG_UPSTREAM=git@xx:yy/fontconfig.git | | yuv | main-f94b8cf7 | https://github.com/debugly/libyuv.git | export GIT_YUV_UPSTREAM=git@xx:yy/yuv.git | | webp | v1.6.0 | https://github.com/debugly/libwebp.git | export GIT_WEBP_UPSTREAM=git@xx:yy/webp.git | From b5d50575fc372ffe4331af637c8a7e0692353c4e Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Wed, 11 Mar 2026 10:39:06 +0800 Subject: [PATCH 242/359] enable crypto and concat protocol --- configs/ffconfig/module-full.sh | 4 +- tools/list-all-feature.sh | 285 ++++++++++++++++++++++++++++++++ 2 files changed, 287 insertions(+), 2 deletions(-) create mode 100755 tools/list-all-feature.sh diff --git a/configs/ffconfig/module-full.sh b/configs/ffconfig/module-full.sh index fc93d54ad..4fac62fb1 100755 --- a/configs/ffconfig/module-full.sh +++ b/configs/ffconfig/module-full.sh @@ -424,8 +424,8 @@ export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-protocol=rtmp*" export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-protocol=rtp" export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-protocol=srtp" -export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-protocol=concat" -export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-protocol=crypto" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-protocol=concat" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-protocol=crypto" export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-protocol=ffrtmpcrypt" export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-protocol=ffrtmphttp" export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-protocol=gopher" diff --git a/tools/list-all-feature.sh b/tools/list-all-feature.sh new file mode 100755 index 000000000..73d62c1b0 --- /dev/null +++ b/tools/list-all-feature.sh @@ -0,0 +1,285 @@ + +SHELL_ROOT=$(cd "$(dirname "$0")" && pwd) + +cd "$SHELL_ROOT" + +cd ../build/src/macos + +echo "## FFmpeg 7.1.1 Supported Protocols:$(./ffmpeg7-arm64/configure --list-protocols | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" +echo '```' +./ffmpeg7-arm64/configure --list-protocols +echo '```' + +echo "## FFmpeg 6.1.1 Supported Protocols:$(./ffmpeg6-arm64/configure --list-protocols | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" +echo '```' +./ffmpeg6-arm64/configure --list-protocols +echo '```' + +echo "## FFmpeg 5.1.6 Supported Protocols:$(./ffmpeg5-arm64/configure --list-protocols | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" +echo '```' +./ffmpeg5-arm64/configure --list-protocols +echo '```' + +echo "## FFmpeg 4.0.5 Supported Protocols:$(./ffmpeg4-arm64/configure --list-protocols | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" +echo '```' +./ffmpeg4-arm64/configure --list-protocols +echo '```' + +echo "## FFmpeg 7.1.1 Supported Encoders:$(./ffmpeg7-arm64/configure --list-encoders | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" +echo '```' +./ffmpeg7-arm64/configure --list-encoders +echo '```' + +echo "## FFmpeg 6.1.1 Supported Encoders:$(./ffmpeg6-arm64/configure --list-encoders | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" +echo '```' +./ffmpeg6-arm64/configure --list-encoders +echo '```' + +echo "## FFmpeg 5.1.6 Supported Encoders:$(./ffmpeg5-arm64/configure --list-encoders | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" +echo '```' +./ffmpeg5-arm64/configure --list-encoders +echo '```' + +echo "## FFmpeg 4.0.5 Supported Encoders:$(./ffmpeg4-arm64/configure --list-encoders | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" +echo '```' +./ffmpeg4-arm64/configure --list-encoders +echo '```' + +echo "## FFmpeg 7.1.1 Supported Decoders:$(./ffmpeg7-arm64/configure --list-decoders | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" +echo '```' +./ffmpeg7-arm64/configure --list-decoders +echo '```' + +echo "## FFmpeg 6.1.1 Supported Decoders:$(./ffmpeg6-arm64/configure --list-decoders | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" +echo '```' +./ffmpeg6-arm64/configure --list-decoders +echo '```' + +echo "## FFmpeg 5.1.6 Supported Decoders:$(./ffmpeg5-arm64/configure --list-decoders | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" +echo '```' +./ffmpeg5-arm64/configure --list-decoders +echo '```' + +echo "## FFmpeg 4.0.5 Supported Decoders:$(./ffmpeg4-arm64/configure --list-decoders | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" +echo '```' +./ffmpeg4-arm64/configure --list-decoders +echo '```' + +echo "## FFmpeg 7.1.1 Supported Demuxers:$(./ffmpeg7-arm64/configure --list-demuxers | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" +echo '```' +./ffmpeg7-arm64/configure --list-demuxers +echo '```' + +echo "## FFmpeg 6.1.1 Supported Demuxers:$(./ffmpeg6-arm64/configure --list-demuxers | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" +echo '```' +./ffmpeg6-arm64/configure --list-demuxers +echo '```' + +echo "## FFmpeg 5.1.6 Supported Demuxers:$(./ffmpeg5-arm64/configure --list-demuxers | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" +echo '```' +./ffmpeg5-arm64/configure --list-demuxers +echo '```' + +echo "## FFmpeg 4.0.5 Supported Demuxers:$(./ffmpeg4-arm64/configure --list-demuxers | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" +echo '```' +./ffmpeg4-arm64/configure --list-demuxers +echo '```' + +echo "## FFmpeg 7.1.1 Supported Muxers:$(./ffmpeg7-arm64/configure --list-muxers | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" +echo '```' +./ffmpeg7-arm64/configure --list-muxers +echo '```' + +echo "## FFmpeg 6.1.1 Supported Muxers:$(./ffmpeg6-arm64/configure --list-muxers | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" +echo '```' +./ffmpeg6-arm64/configure --list-muxers +echo '```' + +echo "## FFmpeg 5.1.6 Supported Muxers:$(./ffmpeg5-arm64/configure --list-muxers | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" +echo '```' +./ffmpeg5-arm64/configure --list-muxers +echo '```' + +echo "## FFmpeg 4.0.5 Supported Muxers:$(./ffmpeg4-arm64/configure --list-muxers | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" +echo '```' +./ffmpeg4-arm64/configure --list-muxers +echo '```' + +echo "## FFmpeg 7.1.1 Supported Filters:$(./ffmpeg7-arm64/configure --list-filters | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" +echo '```' +./ffmpeg7-arm64/configure --list-filters +echo '```' + +echo "## FFmpeg 6.1.1 Supported Filters:$(./ffmpeg6-arm64/configure --list-filters | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" +echo '```' +./ffmpeg6-arm64/configure --list-filters +echo '```' + +echo "## FFmpeg 5.1.6 Supported Filters:$(./ffmpeg5-arm64/configure --list-filters | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" +echo '```' +./ffmpeg5-arm64/configure --list-filters +echo '```' + +echo "## FFmpeg 4.0.5 Supported Filters:$(./ffmpeg4-arm64/configure --list-filters | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" +echo '```' +./ffmpeg4-arm64/configure --list-filters +echo '```' + +echo "## FFmpeg 7.1.1 Supported Bitstream Filters:$(./ffmpeg7-arm64/configure --list-bsfs | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" +echo '```' +./ffmpeg7-arm64/configure --list-bsfs +echo '```' + +echo "## FFmpeg 6.1.1 Supported Bitstream Filters:$(./ffmpeg6-arm64/configure --list-bsfs | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" +echo '```' +./ffmpeg6-arm64/configure --list-bsfs + +echo "## FFmpeg 5.1.6 Supported Bitstream Filters:$(./ffmpeg5-arm64/configure --list-bsfs | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" +echo '```' +./ffmpeg5-arm64/configure --list-bsfs +echo '```' + +echo "## FFmpeg 4.0.5 Supported Bitstream Filters:$(./ffmpeg4-arm64/configure --list-bsfs | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" +echo '```' +./ffmpeg4-arm64/configure --list-bsfs +echo '```' + +echo "## FFmpeg 7.1.1 Supported Protocols:$(./ffmpeg7-arm64/configure --list-protocols | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" +echo '```' +./ffmpeg7-arm64/configure --list-protocols +echo '```' + +echo "## FFmpeg 6.1.1 Supported Protocols:$(./ffmpeg6-arm64/configure --list-protocols | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" +echo '```' +./ffmpeg6-arm64/configure --list-protocols +echo '```' + +echo "## FFmpeg 5.1.6 Supported Protocols:$(./ffmpeg5-arm64/configure --list-protocols | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" +echo '```' +./ffmpeg5-arm64/configure --list-protocols +echo '```' + +echo "## FFmpeg 4.0.5 Supported Protocols:$(./ffmpeg4-arm64/configure --list-protocols | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" +echo '```' +./ffmpeg4-arm64/configure --list-protocols +echo '```' + +echo "## FFmpeg 7.1.1 Supported Devices:$(./ffmpeg7-arm64/configure --list-devices | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" +echo '```' +./ffmpeg7-arm64/configure --list-devices +echo '```' + +echo "## FFmpeg 6.1.1 Supported Devices:$(./ffmpeg6-arm64/configure --list-devices | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" +echo '```' +./ffmpeg6-arm64/configure --list-devices +echo '```' + +echo "## FFmpeg 5.1.6 Supported Devices:$(./ffmpeg5-arm64/configure --list-devices | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" +echo '```' +./ffmpeg5-arm64/configure --list-devices +echo '```' + +echo "## FFmpeg 4.0.5 Supported Devices:$(./ffmpeg4-arm64/configure --list-devices | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" +echo '```' +./ffmpeg4-arm64/configure --list-devices +echo '```' + +echo "## FFmpeg 7.1.1 Supported Hardware Accelerators:$(./ffmpeg7-arm64/configure --list-hwaccels | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" +echo '```' +./ffmpeg7-arm64/configure --list-hwaccels +echo '```' + +echo "## FFmpeg 6.1.1 Supported Hardware Accelerators:$(./ffmpeg6-arm64/configure --list-hwaccels | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" +echo '```' +./ffmpeg6-arm64/configure --list-hwaccels +echo '```' + +echo "## FFmpeg 5.1.6 Supported Hardware Accelerators:$(./ffmpeg5-arm64/configure --list-hwaccels | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" +echo '```' +./ffmpeg5-arm64/configure --list-hwaccels +echo '```' + +echo "## FFmpeg 4.0.5 Supported Hardware Accelerators:$(./ffmpeg4-arm64/configure --list-hwaccels | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" +echo '```' +./ffmpeg4-arm64/configure --list-hwaccels +echo '```' + +echo "## FFmpeg 7.1.1 Supported Input Devices:$(./ffmpeg7-arm64/configure --list-indevs | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" +echo '```' +./ffmpeg7-arm64/configure --list-indevs +echo '```' + +echo "## FFmpeg 6.1.1 Supported Input Devices:$(./ffmpeg6-arm64/configure --list-indevs | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" +echo '```' +./ffmpeg6-arm64/configure --list-indevs +echo '```' + +echo "## FFmpeg 5.1.6 Supported Input Devices:$(./ffmpeg5-arm64/configure --list-indevs | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" +echo '```' +./ffmpeg5-arm64/configure --list-indevs +echo '```' + +echo "## FFmpeg 4.0.5 Supported Input Devices:$(./ffmpeg4-arm64/configure --list-indevs | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" +echo '```' +./ffmpeg4-arm64/configure --list-indevs +echo '```' + +echo "## FFmpeg 7.1.1 Supported Output Devices:$(./ffmpeg7-arm64/configure --list-outdevs | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" +echo '```' +./ffmpeg7-arm64/configure --list-outdevs +echo '```' + +echo "## FFmpeg 6.1.1 Supported Output Devices:$(./ffmpeg6-arm64/configure --list-outdevs | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" +echo '```' +./ffmpeg6-arm64/configure --list-outdevs +echo '```' + +echo "## FFmpeg 5.1.6 Supported Output Devices:$(./ffmpeg5-arm64/configure --list-outdevs | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" +echo '```' +./ffmpeg5-arm64/configure --list-outdevs +echo '```' + +echo "## FFmpeg 4.0.5 Supported Output Devices:$(./ffmpeg4-arm64/configure --list-outdevs | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" +echo '```' +./ffmpeg4-arm64/configure --list-outdevs +echo '```' + +echo "## FFmpeg 7.1.1 Supported Bitstream Filters:$(./ffmpeg7-arm64/configure --list-bsfs | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" +echo '```' +./ffmpeg7-arm64/configure --list-bsfs +echo '```' + +echo "## FFmpeg 6.1.1 Supported Bitstream Filters:$(./ffmpeg6-arm64/configure --list-bsfs | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" +echo '```' +./ffmpeg6-arm64/configure --list-bsfs +echo '```' + +echo "## FFmpeg 5.1.6 Supported Bitstream Filters:$(./ffmpeg5-arm64/configure --list-bsfs | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" +echo '```' +./ffmpeg5-arm64/configure --list-bsfs +echo '```' + +echo "## FFmpeg 4.0.5 Supported Bitstream Filters:$(./ffmpeg4-arm64/configure --list-bsfs | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" +echo '```' +./ffmpeg4-arm64/configure --list-bsfs +echo '```' + +echo "## FFmpeg 7.1.1 Supported Parsers:$(./ffmpeg7-arm64/configure --list-parsers | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" +echo '```' +./ffmpeg7-arm64/configure --list-parsers +echo '```' + +echo "## FFmpeg 6.1.1 Supported Parsers:$(./ffmpeg6-arm64/configure --list-parsers | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" +echo '```' +./ffmpeg6-arm64/configure --list-parsers +echo '```' + +echo "## FFmpeg 5.1.6 Supported Parsers:$(./ffmpeg5-arm64/configure --list-parsers | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" +echo '```' +./ffmpeg5-arm64/configure --list-parsers +echo '```' + +echo "## FFmpeg 4.0.5 Supported Parsers:$(./ffmpeg4-arm64/configure --list-parsers | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" +echo '```' +./ffmpeg4-arm64/configure --list-parsers +echo '```' From a3ae668883bc9d4ab53e92d2d0f29bc3bed0eb92 Mon Sep 17 00:00:00 2001 From: Anka Date: Wed, 11 Mar 2026 03:07:48 +0000 Subject: [PATCH 243/359] upgrade ffmpeg4 to ffmpeg4-4.0.5-260311104656 for all by cd --- configs/libs/ffmpeg4.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/ffmpeg4.sh b/configs/libs/ffmpeg4.sh index 89f202c80..d39642468 100644 --- a/configs/libs/ffmpeg4.sh +++ b/configs/libs/ffmpeg4.sh @@ -36,7 +36,7 @@ export GIT_COMMIT=n4.0.5 export GIT_REPO_VERSION=4.0.5 # pre compiled -export PRE_COMPILE_TAG_TVOS=ffmpeg4-4.0.5-260228175651 -export PRE_COMPILE_TAG_MACOS=ffmpeg4-4.0.5-260228175651 -export PRE_COMPILE_TAG_IOS=ffmpeg4-4.0.5-260228175651 -export PRE_COMPILE_TAG_ANDROID=ffmpeg4-4.0.5-260228175651 \ No newline at end of file +export PRE_COMPILE_TAG_TVOS=ffmpeg4-4.0.5-260311104656 +export PRE_COMPILE_TAG_MACOS=ffmpeg4-4.0.5-260311104656 +export PRE_COMPILE_TAG_IOS=ffmpeg4-4.0.5-260311104656 +export PRE_COMPILE_TAG_ANDROID=ffmpeg4-4.0.5-260311104656 \ No newline at end of file From 63b3a03438f59c9247969caa58267f8e3de8cfd7 Mon Sep 17 00:00:00 2001 From: Anka Date: Wed, 11 Mar 2026 03:28:59 +0000 Subject: [PATCH 244/359] upgrade ffmpeg5 to ffmpeg5-5.1.6-260311110835 for all by cd --- configs/libs/ffmpeg5.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/ffmpeg5.sh b/configs/libs/ffmpeg5.sh index cbf096b20..676a2863d 100644 --- a/configs/libs/ffmpeg5.sh +++ b/configs/libs/ffmpeg5.sh @@ -36,7 +36,7 @@ export GIT_COMMIT=n5.1.6 export GIT_REPO_VERSION=5.1.6 # pre compiled -export PRE_COMPILE_TAG_TVOS=ffmpeg5-5.1.6-260228181929 -export PRE_COMPILE_TAG_MACOS=ffmpeg5-5.1.6-260228181929 -export PRE_COMPILE_TAG_IOS=ffmpeg5-5.1.6-260228181929 -export PRE_COMPILE_TAG_ANDROID=ffmpeg5-5.1.6-260228181929 \ No newline at end of file +export PRE_COMPILE_TAG_TVOS=ffmpeg5-5.1.6-260311110835 +export PRE_COMPILE_TAG_MACOS=ffmpeg5-5.1.6-260311110835 +export PRE_COMPILE_TAG_IOS=ffmpeg5-5.1.6-260311110835 +export PRE_COMPILE_TAG_ANDROID=ffmpeg5-5.1.6-260311110835 \ No newline at end of file From 6b94102d654154311dc91f7efec205682eb527d3 Mon Sep 17 00:00:00 2001 From: Anka Date: Wed, 11 Mar 2026 03:51:05 +0000 Subject: [PATCH 245/359] upgrade ffmpeg6 to ffmpeg6-6.1.1-260311112947 for all by cd --- configs/libs/ffmpeg6.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/ffmpeg6.sh b/configs/libs/ffmpeg6.sh index c2108b591..76fb70b1f 100644 --- a/configs/libs/ffmpeg6.sh +++ b/configs/libs/ffmpeg6.sh @@ -36,7 +36,7 @@ export GIT_COMMIT=n6.1.1 #origin/release/5.1 export GIT_REPO_VERSION=6.1.1 # pre compiled -export PRE_COMPILE_TAG_TVOS=ffmpeg6-6.1.1-260228184138 -export PRE_COMPILE_TAG_MACOS=ffmpeg6-6.1.1-260228184138 -export PRE_COMPILE_TAG_IOS=ffmpeg6-6.1.1-260228184138 -export PRE_COMPILE_TAG_ANDROID=ffmpeg6-6.1.1-260228184138 \ No newline at end of file +export PRE_COMPILE_TAG_TVOS=ffmpeg6-6.1.1-260311112947 +export PRE_COMPILE_TAG_MACOS=ffmpeg6-6.1.1-260311112947 +export PRE_COMPILE_TAG_IOS=ffmpeg6-6.1.1-260311112947 +export PRE_COMPILE_TAG_ANDROID=ffmpeg6-6.1.1-260311112947 \ No newline at end of file From 3b465adbca3b707d99fcf06eea790995f6447380 Mon Sep 17 00:00:00 2001 From: Anka Date: Wed, 11 Mar 2026 07:01:04 +0000 Subject: [PATCH 246/359] upgrade ffmpeg7 to ffmpeg7-7.1.1-260311143950 for apple by cd --- configs/libs/ffmpeg7.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configs/libs/ffmpeg7.sh b/configs/libs/ffmpeg7.sh index 821df7b02..f8784e6d5 100644 --- a/configs/libs/ffmpeg7.sh +++ b/configs/libs/ffmpeg7.sh @@ -37,8 +37,8 @@ export GIT_REPO_VERSION=7.1.1 # pre compiled -export PRE_COMPILE_TAG_TVOS=ffmpeg7-7.1.1-260228202640 -export PRE_COMPILE_TAG_MACOS=ffmpeg7-7.1.1-260228202640 -export PRE_COMPILE_TAG_IOS=ffmpeg7-7.1.1-260228202640 +export PRE_COMPILE_TAG_TVOS=ffmpeg7-7.1.1-260311143950 +export PRE_COMPILE_TAG_MACOS=ffmpeg7-7.1.1-260311143950 +export PRE_COMPILE_TAG_IOS=ffmpeg7-7.1.1-260311143950 export PRE_COMPILE_TAG_ANDROID=ffmpeg7-7.1.1-250606143631 From ec80728e1acfacd342f76172c4529995d34112f2 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Fri, 13 Mar 2026 17:40:10 +0800 Subject: [PATCH 247/359] fix zlib link path in pkgconfig --- do-compile/apple/xml2.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/do-compile/apple/xml2.sh b/do-compile/apple/xml2.sh index fbbbd945a..fb98e7a17 100755 --- a/do-compile/apple/xml2.sh +++ b/do-compile/apple/xml2.sh @@ -73,4 +73,7 @@ set -e CFG_FLAGS="-Ddocs=disabled -Ddebugging=disabled -Dpython=disabled -Dzlib=enabled" -./meson-compatible.sh "$CFG_FLAGS" \ No newline at end of file +./meson-compatible.sh "$CFG_FLAGS" + +echo "fix zlib link path in pkgconfig" +my_sed_i 's|/Applications/Xcode[^ ]*/usr/lib/libz.tbd|-lz|g' ${MR_BUILD_PREFIX}/lib/pkgconfig/libxml-2.0.pc \ No newline at end of file From fc5891640cd11d604126798e00837851e6d33ac9 Mon Sep 17 00:00:00 2001 From: Anka Date: Fri, 13 Mar 2026 09:43:23 +0000 Subject: [PATCH 248/359] upgrade xml2 to xml2-2.15.1-260313174123 for all by cd --- configs/libs/xml2.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/xml2.sh b/configs/libs/xml2.sh index 44e3cd570..b850243b1 100644 --- a/configs/libs/xml2.sh +++ b/configs/libs/xml2.sh @@ -38,7 +38,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=xml2-2.15.1-260227223905 -export PRE_COMPILE_TAG_MACOS=xml2-2.15.1-260227223905 -export PRE_COMPILE_TAG_IOS=xml2-2.15.1-260227223905 -export PRE_COMPILE_TAG_ANDROID=xml2-2.15.1-260227223905 +export PRE_COMPILE_TAG_TVOS=xml2-2.15.1-260313174123 +export PRE_COMPILE_TAG_MACOS=xml2-2.15.1-260313174123 +export PRE_COMPILE_TAG_IOS=xml2-2.15.1-260313174123 +export PRE_COMPILE_TAG_ANDROID=xml2-2.15.1-260313174123 From 56880f89d4585632dddc5acdbf3e952c707f3087 Mon Sep 17 00:00:00 2001 From: Anka Date: Fri, 13 Mar 2026 09:51:22 +0000 Subject: [PATCH 249/359] upgrade bluray to bluray-1.3.4-260313174711 for all by cd --- configs/libs/bluray.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/bluray.sh b/configs/libs/bluray.sh index 25dc2001e..6557b34a0 100644 --- a/configs/libs/bluray.sh +++ b/configs/libs/bluray.sh @@ -40,7 +40,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=bluray-1.3.4-260228142542 -export PRE_COMPILE_TAG_MACOS=bluray-1.3.4-260228142542 -export PRE_COMPILE_TAG_IOS=bluray-1.3.4-260228142542 -export PRE_COMPILE_TAG_ANDROID=bluray-1.3.4-260228142542 +export PRE_COMPILE_TAG_TVOS=bluray-1.3.4-260313174711 +export PRE_COMPILE_TAG_MACOS=bluray-1.3.4-260313174711 +export PRE_COMPILE_TAG_IOS=bluray-1.3.4-260313174711 +export PRE_COMPILE_TAG_ANDROID=bluray-1.3.4-260313174711 From 8d56e2200c39562501d86ac6989c75d727a9d9b5 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Fri, 13 Mar 2026 17:57:30 +0800 Subject: [PATCH 250/359] add new workflow --- .../workflows/{all.yml => build all libs.yml} | 2 +- .github/workflows/build custom libs.yml | 110 ++++++++++++++++++ ...e-android-common.yml => build one lib.yml} | 2 +- 3 files changed, 112 insertions(+), 2 deletions(-) rename .github/workflows/{all.yml => build all libs.yml} (99%) create mode 100644 .github/workflows/build custom libs.yml rename .github/workflows/{apple-android-common.yml => build one lib.yml} (98%) diff --git a/.github/workflows/all.yml b/.github/workflows/build all libs.yml similarity index 99% rename from .github/workflows/all.yml rename to .github/workflows/build all libs.yml index f2a1bb8f6..964efe7f0 100644 --- a/.github/workflows/all.yml +++ b/.github/workflows/build all libs.yml @@ -74,7 +74,7 @@ on: pull_request: branches: [master] -name: Create all library Release +name: build all libs jobs: build: diff --git a/.github/workflows/build custom libs.yml b/.github/workflows/build custom libs.yml new file mode 100644 index 000000000..9ce108520 --- /dev/null +++ b/.github/workflows/build custom libs.yml @@ -0,0 +1,110 @@ +on: + # push: + # branches: [master] + workflow_dispatch: + inputs: + os: + description: 'macos version' + required: false + type: choice + default: 'macos-15' + options: + - macos-13 + - macos-14 + - macos-15 + - macos-26 + platform: + description: 'choose a platform for compile' + required: false + type: choice + default: 'all' + options: + - apple + - android + - ios + - tvos + - macos + - all + libraries: + description: 'input libraries for compile' + required: true + default: 'xml2' + dryrun: + description: 'just run workflow,but not deploy' + required: false + type: choice + default: 'false' + options: + - true + - false + verbose: + description: 'print detail logs' + required: false + type: choice + default: 'false' + options: + - true + - false + pull_request: + branches: [master] + +name: build custom libs + +jobs: + build: + name: compile all libs for ${{ inputs.platform }} then deploy + runs-on: ${{ inputs.os }} + env: + GH_TOKEN: ${{ github.token }} + steps: + - uses: nttld/setup-ndk@v1 + id: setup-ndk + with: + ndk-version: r27c + add-to-path: true + local-cache: false + - name: Checkout code + uses: actions/checkout@v4 + - name: One Step + run: | + + Platform=${{ inputs.platform }} + DryRun=${{ inputs.dryrun }} + Verbose=${{ inputs.verbose }} + compile_lib() { + local lib_name=$1 + local platform=$Platform + + if [[ "$lib_name" == "fontconfig" ]]; then + if [[ "$platform" == "all" ]]; then + echo "force platform to android for fontconfig" + platform='android' + elif [[ "$platform" != "android" ]]; then + echo "Skip fontconfig for $platform" + return + fi + fi + + if [[ "$lib_name" == "webp" ]]; then + if [[ "$platform" == "android" ]]; then + echo "Skip webp for android" + return + elif [[ "$platform" == "all" ]]; then + echo "Skip webp for android" + platform='apple' + fi + fi + + echo "------compile $platform $lib_name------------------------------------" + rm -rf build || git reset --hard || git pull origin + .github/workflows/install-dependencies.sh $lib_name $platform # 补全依赖安装步骤 + .github/workflows/onestep.sh $lib_name $platform $DryRun $Verbose + } + + # 将逗号分隔转为循环处理 + IFS=',' read -ra ADDR <<< "${{ inputs.libraries }}" + for lib in "${ADDR[@]}"; do + compile_lib "$lib" + done + env: + ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} diff --git a/.github/workflows/apple-android-common.yml b/.github/workflows/build one lib.yml similarity index 98% rename from .github/workflows/apple-android-common.yml rename to .github/workflows/build one lib.yml index 77e6c5d5f..fade6d391 100644 --- a/.github/workflows/apple-android-common.yml +++ b/.github/workflows/build one lib.yml @@ -77,7 +77,7 @@ on: pull_request: branches: [master] -name: apple-android-common +name: build a lib jobs: build: From 062a26f85e38411aef055ebd9deaa0537b07812c Mon Sep 17 00:00:00 2001 From: Anka Date: Fri, 13 Mar 2026 10:01:06 +0000 Subject: [PATCH 251/359] upgrade fontconfig to fontconfig-2.17.1-260313180009 for android by cd --- configs/libs/fontconfig.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/libs/fontconfig.sh b/configs/libs/fontconfig.sh index 08491581a..24ece5a73 100644 --- a/configs/libs/fontconfig.sh +++ b/configs/libs/fontconfig.sh @@ -36,4 +36,4 @@ fi export PRE_COMPILE_TAG_IOS=fontconfig-2.16.0-250226074147 export PRE_COMPILE_TAG_TVOS=fontconfig-2.16.0-250226074147 export PRE_COMPILE_TAG_MACOS=fontconfig-2.16.0-250226074147 -export PRE_COMPILE_TAG_ANDROID=fontconfig-2.17.1-260228125544 +export PRE_COMPILE_TAG_ANDROID=fontconfig-2.17.1-260313180009 From 572c654a32028b8c674c67bc8d23ad4aa0913125 Mon Sep 17 00:00:00 2001 From: Anka Date: Fri, 13 Mar 2026 10:05:33 +0000 Subject: [PATCH 252/359] upgrade ass to ass-0.17.4-260313180452 for android by cd --- configs/libs/ass.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/libs/ass.sh b/configs/libs/ass.sh index 6464003b4..57a659697 100644 --- a/configs/libs/ass.sh +++ b/configs/libs/ass.sh @@ -41,4 +41,4 @@ fi export PRE_COMPILE_TAG_TVOS=ass-0.17.4-260228135313 export PRE_COMPILE_TAG_MACOS=ass-0.17.4-260228135313 export PRE_COMPILE_TAG_IOS=ass-0.17.4-260228135313 -export PRE_COMPILE_TAG_ANDROID=ass-0.17.4-260228135313 +export PRE_COMPILE_TAG_ANDROID=ass-0.17.4-260313180452 From 4c3cf61b793e016e3e17fdecf104a8cd5d5dffcf Mon Sep 17 00:00:00 2001 From: Anka Date: Fri, 13 Mar 2026 11:16:24 +0000 Subject: [PATCH 253/359] upgrade bluray to bluray-1.3.4-260313191234 for all by cd --- configs/libs/bluray.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/bluray.sh b/configs/libs/bluray.sh index 6557b34a0..4c705672c 100644 --- a/configs/libs/bluray.sh +++ b/configs/libs/bluray.sh @@ -40,7 +40,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=bluray-1.3.4-260313174711 -export PRE_COMPILE_TAG_MACOS=bluray-1.3.4-260313174711 -export PRE_COMPILE_TAG_IOS=bluray-1.3.4-260313174711 -export PRE_COMPILE_TAG_ANDROID=bluray-1.3.4-260313174711 +export PRE_COMPILE_TAG_TVOS=bluray-1.3.4-260313191234 +export PRE_COMPILE_TAG_MACOS=bluray-1.3.4-260313191234 +export PRE_COMPILE_TAG_IOS=bluray-1.3.4-260313191234 +export PRE_COMPILE_TAG_ANDROID=bluray-1.3.4-260313191234 From 09694a9ebdeab001cc439bdeaa5a83f4a1bbacd2 Mon Sep 17 00:00:00 2001 From: Anka Date: Fri, 13 Mar 2026 11:38:14 +0000 Subject: [PATCH 254/359] upgrade ffmpeg4 to ffmpeg4-4.0.5-260313191646 for all by cd --- configs/libs/ffmpeg4.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/ffmpeg4.sh b/configs/libs/ffmpeg4.sh index d39642468..9f31471e0 100644 --- a/configs/libs/ffmpeg4.sh +++ b/configs/libs/ffmpeg4.sh @@ -36,7 +36,7 @@ export GIT_COMMIT=n4.0.5 export GIT_REPO_VERSION=4.0.5 # pre compiled -export PRE_COMPILE_TAG_TVOS=ffmpeg4-4.0.5-260311104656 -export PRE_COMPILE_TAG_MACOS=ffmpeg4-4.0.5-260311104656 -export PRE_COMPILE_TAG_IOS=ffmpeg4-4.0.5-260311104656 -export PRE_COMPILE_TAG_ANDROID=ffmpeg4-4.0.5-260311104656 \ No newline at end of file +export PRE_COMPILE_TAG_TVOS=ffmpeg4-4.0.5-260313191646 +export PRE_COMPILE_TAG_MACOS=ffmpeg4-4.0.5-260313191646 +export PRE_COMPILE_TAG_IOS=ffmpeg4-4.0.5-260313191646 +export PRE_COMPILE_TAG_ANDROID=ffmpeg4-4.0.5-260313191646 \ No newline at end of file From 3f3b32d9e097acfd21335e4be700bfe3a0af248a Mon Sep 17 00:00:00 2001 From: Anka Date: Fri, 13 Mar 2026 12:02:21 +0000 Subject: [PATCH 255/359] upgrade ffmpeg5 to ffmpeg5-5.1.6-260313193857 for all by cd --- configs/libs/ffmpeg5.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/ffmpeg5.sh b/configs/libs/ffmpeg5.sh index 676a2863d..6e0b9cfe0 100644 --- a/configs/libs/ffmpeg5.sh +++ b/configs/libs/ffmpeg5.sh @@ -36,7 +36,7 @@ export GIT_COMMIT=n5.1.6 export GIT_REPO_VERSION=5.1.6 # pre compiled -export PRE_COMPILE_TAG_TVOS=ffmpeg5-5.1.6-260311110835 -export PRE_COMPILE_TAG_MACOS=ffmpeg5-5.1.6-260311110835 -export PRE_COMPILE_TAG_IOS=ffmpeg5-5.1.6-260311110835 -export PRE_COMPILE_TAG_ANDROID=ffmpeg5-5.1.6-260311110835 \ No newline at end of file +export PRE_COMPILE_TAG_TVOS=ffmpeg5-5.1.6-260313193857 +export PRE_COMPILE_TAG_MACOS=ffmpeg5-5.1.6-260313193857 +export PRE_COMPILE_TAG_IOS=ffmpeg5-5.1.6-260313193857 +export PRE_COMPILE_TAG_ANDROID=ffmpeg5-5.1.6-260313193857 \ No newline at end of file From 26fb71fcf78187b63f1bae065020b26756f4b8cb Mon Sep 17 00:00:00 2001 From: Anka Date: Fri, 13 Mar 2026 12:31:59 +0000 Subject: [PATCH 256/359] upgrade ffmpeg6 to ffmpeg6-6.1.1-260313200314 for all by cd --- configs/libs/ffmpeg6.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/ffmpeg6.sh b/configs/libs/ffmpeg6.sh index 76fb70b1f..d3c97fb58 100644 --- a/configs/libs/ffmpeg6.sh +++ b/configs/libs/ffmpeg6.sh @@ -36,7 +36,7 @@ export GIT_COMMIT=n6.1.1 #origin/release/5.1 export GIT_REPO_VERSION=6.1.1 # pre compiled -export PRE_COMPILE_TAG_TVOS=ffmpeg6-6.1.1-260311112947 -export PRE_COMPILE_TAG_MACOS=ffmpeg6-6.1.1-260311112947 -export PRE_COMPILE_TAG_IOS=ffmpeg6-6.1.1-260311112947 -export PRE_COMPILE_TAG_ANDROID=ffmpeg6-6.1.1-260311112947 \ No newline at end of file +export PRE_COMPILE_TAG_TVOS=ffmpeg6-6.1.1-260313200314 +export PRE_COMPILE_TAG_MACOS=ffmpeg6-6.1.1-260313200314 +export PRE_COMPILE_TAG_IOS=ffmpeg6-6.1.1-260313200314 +export PRE_COMPILE_TAG_ANDROID=ffmpeg6-6.1.1-260313200314 \ No newline at end of file From b98890406912aad7d978192d04a1852f404980ad Mon Sep 17 00:00:00 2001 From: Anka Date: Fri, 13 Mar 2026 13:03:00 +0000 Subject: [PATCH 257/359] upgrade ffmpeg7 to ffmpeg7-7.1.1-260313204307 for apple by cd --- configs/libs/ffmpeg7.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configs/libs/ffmpeg7.sh b/configs/libs/ffmpeg7.sh index f8784e6d5..2d9f7951c 100644 --- a/configs/libs/ffmpeg7.sh +++ b/configs/libs/ffmpeg7.sh @@ -37,8 +37,8 @@ export GIT_REPO_VERSION=7.1.1 # pre compiled -export PRE_COMPILE_TAG_TVOS=ffmpeg7-7.1.1-260311143950 -export PRE_COMPILE_TAG_MACOS=ffmpeg7-7.1.1-260311143950 -export PRE_COMPILE_TAG_IOS=ffmpeg7-7.1.1-260311143950 +export PRE_COMPILE_TAG_TVOS=ffmpeg7-7.1.1-260313204307 +export PRE_COMPILE_TAG_MACOS=ffmpeg7-7.1.1-260313204307 +export PRE_COMPILE_TAG_IOS=ffmpeg7-7.1.1-260313204307 export PRE_COMPILE_TAG_ANDROID=ffmpeg7-7.1.1-250606143631 From c178ee7579122f9e3a0299ab2baae29ddc6dfedb Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Tue, 17 Mar 2026 15:25:06 +0800 Subject: [PATCH 258/359] upgrade ffmpeg to 7.1.3 --- configs/libs/ffmpeg7.sh | 4 ++-- do-compile/apple/main.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/configs/libs/ffmpeg7.sh b/configs/libs/ffmpeg7.sh index 2d9f7951c..354ab4670 100644 --- a/configs/libs/ffmpeg7.sh +++ b/configs/libs/ffmpeg7.sh @@ -32,8 +32,8 @@ else export GIT_UPSTREAM=https://github.com/FFmpeg/FFmpeg.git fi -export GIT_COMMIT=n7.1.1 #origin/release/5.1 -export GIT_REPO_VERSION=7.1.1 +export GIT_COMMIT=n7.1.3 #origin/release/5.1 +export GIT_REPO_VERSION=7.1.3 # pre compiled diff --git a/do-compile/apple/main.sh b/do-compile/apple/main.sh index 3d6784782..72bf2394f 100755 --- a/do-compile/apple/main.sh +++ b/do-compile/apple/main.sh @@ -38,7 +38,7 @@ do ./any.sh if [[ $? -eq 0 ]];then echo "🎉 Congrats" - echo "🚀 ${LIB_NAME} successfully $MR_CMD." + echo "🚀 ${LIB_NAME} ${GIT_COMMIT} successfully $MR_CMD." echo fi echo "====================================" From 7a64c35aacb176c73d19e3f73539bc7da8742b92 Mon Sep 17 00:00:00 2001 From: Anka Date: Tue, 17 Mar 2026 07:53:08 +0000 Subject: [PATCH 259/359] upgrade ffmpeg7 to ffmpeg7-7.1.3-260317152736 for apple by cd --- configs/libs/ffmpeg7.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configs/libs/ffmpeg7.sh b/configs/libs/ffmpeg7.sh index 354ab4670..bf556acd3 100644 --- a/configs/libs/ffmpeg7.sh +++ b/configs/libs/ffmpeg7.sh @@ -37,8 +37,8 @@ export GIT_REPO_VERSION=7.1.3 # pre compiled -export PRE_COMPILE_TAG_TVOS=ffmpeg7-7.1.1-260313204307 -export PRE_COMPILE_TAG_MACOS=ffmpeg7-7.1.1-260313204307 -export PRE_COMPILE_TAG_IOS=ffmpeg7-7.1.1-260313204307 +export PRE_COMPILE_TAG_TVOS=ffmpeg7-7.1.3-260317152736 +export PRE_COMPILE_TAG_MACOS=ffmpeg7-7.1.3-260317152736 +export PRE_COMPILE_TAG_IOS=ffmpeg7-7.1.3-260317152736 export PRE_COMPILE_TAG_ANDROID=ffmpeg7-7.1.1-250606143631 From 87132ce68cd459215206571664893aa512a27587 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Tue, 17 Mar 2026 16:08:21 +0800 Subject: [PATCH 260/359] update README --- README.md | 6 +++--- README_zh-CN.md | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index d0798409a..1d6cd784a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ## MRFFToolChain Build Shell [[中文版](./README_zh-CN.md)] -![](https://img.shields.io/github/downloads/debugly/MRFFToolChainBuildShell/total) +![](https://img.shields.io/github/downloads/debugly/MRFFToolChainBuildShell/total) **What's MRFFToolChain?** @@ -19,7 +19,7 @@ At present MRFFToolChain contained `ass、bluray、dav1d、dvdread、dvdnav、ff ## News -- FFmpeg **7.1.1** is already in use +- FFmpeg **7.1.3** is already in use - upgrade all libs to lastest,Improved optimizations - using macOS 15,Xcode_16.4 @@ -119,7 +119,7 @@ If cloning repositories from GitHub is slow, or if you need to use an internal p | Lib Name | Current Version | Repository URL | Mirror Repository URL | | ---------- | --------------- | -------------------------------------------------------- | -------------------------------------------------------- | -| ffmpeg7 | 7.1.1 | https://github.com/FFmpeg/FFmpeg.git | export GIT_FFMPEG_UPSTREAM=git@xx:yy/FFmpeg.git | +| ffmpeg7 | 7.1.3 | https://github.com/FFmpeg/FFmpeg.git | export GIT_FFMPEG_UPSTREAM=git@xx:yy/FFmpeg.git | | ffmpeg6 | 6.1.1 | https://github.com/FFmpeg/FFmpeg.git | export GIT_FFMPEG_UPSTREAM=git@xx:yy/FFmpeg.git | | ffmpeg5 | 5.1.6 | https://github.com/FFmpeg/FFmpeg.git | export GIT_FFMPEG_UPSTREAM=git@xx:yy/FFmpeg.git | | ffmpeg4 | 4.0.5 | https://github.com/FFmpeg/FFmpeg.git | export GIT_FFMPEG_UPSTREAM=git@xx:yy/FFmpeg.git | diff --git a/README_zh-CN.md b/README_zh-CN.md index e5aba256a..513383e24 100644 --- a/README_zh-CN.md +++ b/README_zh-CN.md @@ -1,6 +1,6 @@ ## MRFFToolChain 构建脚本 -![](https://img.shields.io/github/downloads/debugly/MRFFToolChainBuildShell/total) +![](https://img.shields.io/github/downloads/debugly/MRFFToolChainBuildShell/total) **MRFFToolChain 是什么?** @@ -19,7 +19,7 @@ MRFFToolChain 是一套成熟的编译工具,专门用来编译 iOS、macOS、 ## 最新动态 -- FFmpeg **7.1.1** 已投入使用 +- FFmpeg **7.1.3** 已投入使用 - 将所有库升级至最新版本,不少库提升了性能 - 使用 macOS 15,Xcode_16.4构建 @@ -121,7 +121,7 @@ MRFFToolChain 是一套成熟的编译工具,专门用来编译 iOS、macOS、 | 库名称 | 当前版本 | 仓库 URL | 镜像仓库 URL | | --------------- |----------- | ----------- | ------------ | -| ffmpeg7 | 7.1.1 | https://github.com/FFmpeg/FFmpeg.git | export GIT_FFMPEG_UPSTREAM=git@xx:yy/FFmpeg.git | +| ffmpeg7 | 7.1.3 | https://github.com/FFmpeg/FFmpeg.git | export GIT_FFMPEG_UPSTREAM=git@xx:yy/FFmpeg.git | | ffmpeg6 | 6.1.1 | https://github.com/FFmpeg/FFmpeg.git | export GIT_FFMPEG_UPSTREAM=git@xx:yy/FFmpeg.git | | ffmpeg5 | 5.1.6 | https://github.com/FFmpeg/FFmpeg.git | export GIT_FFMPEG_UPSTREAM=git@xx:yy/FFmpeg.git | | ffmpeg4 | 4.0.5 | https://github.com/FFmpeg/FFmpeg.git | export GIT_FFMPEG_UPSTREAM=git@xx:yy/FFmpeg.git | From fae8a42165d5f5255551b77620dbfb3c5e731208 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Tue, 24 Mar 2026 14:54:32 +0800 Subject: [PATCH 261/359] add MoltenVK --- configs/libs/moltenvk.sh | 37 +++++++++ do-compile/apple/moltenvk.sh | 149 +++++++++++++++++++++++++++++++++++ 2 files changed, 186 insertions(+) create mode 100644 configs/libs/moltenvk.sh create mode 100755 do-compile/apple/moltenvk.sh diff --git a/configs/libs/moltenvk.sh b/configs/libs/moltenvk.sh new file mode 100644 index 000000000..b88d40e62 --- /dev/null +++ b/configs/libs/moltenvk.sh @@ -0,0 +1,37 @@ +#! /usr/bin/env bash +# +# Copyright (C) 2021 Matt Reach + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# + +export LIB_NAME='MoltenVK' +export LIPO_LIBS="libMoltenVK" +export GIT_LOCAL_REPO=extra/MoltenVK +export GIT_COMMIT=v1.4.1 +export REPO_DIR=MoltenVK +export GIT_REPO_VERSION=v1.4.1 + +# you can export GIT_MOLTENVK_UPSTREAM=git@xx:yy/MoltenVK.git use your mirror +if [[ "$GIT_MOLTENVK_UPSTREAM" != "" ]] ;then + export GIT_UPSTREAM="$GIT_MOLTENVK_UPSTREAM" +else + export GIT_UPSTREAM=https://github.com/KhronosGroup/MoltenVK.git +fi + +# pre compiled +export PRE_COMPILE_TAG_TVOS= +export PRE_COMPILE_TAG_MACOS= +export PRE_COMPILE_TAG_IOS= +export PRE_COMPILE_TAG_ANDROID= diff --git a/do-compile/apple/moltenvk.sh b/do-compile/apple/moltenvk.sh new file mode 100755 index 000000000..ecb9f4b72 --- /dev/null +++ b/do-compile/apple/moltenvk.sh @@ -0,0 +1,149 @@ +#! /usr/bin/env bash +# +# Copyright (C) 2021 Matt Reach + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +set -e + +THIS_DIR=$(DIRNAME=$(dirname "$0"); cd "$DIRNAME"; pwd) +cd "$THIS_DIR" + +echo "----------------------" +echo "[*] fetch dependencies for $LIB_NAME" +echo "----------------------" + +cd $MR_BUILD_SOURCE +if [ -d "External" ]; then + echo "dependencies already exist" +else + if [ -f "./fetchDependencies" ]; then + echo "fetching dependencies..." + chmod +x ./fetchDependencies + ./fetchDependencies + else + echo "fetchDependencies script not found, trying with CMake..." + fi +fi + +cd "$THIS_DIR" + +pf= +dest= +scheme_suffix= +arch_param= +if [[ "$MR_PLAT" == 'ios' ]];then + if [[ $_MR_ARCH == 'arm64_simulator' ]];then + pf='SIMULATORARM64' + dest='iOS Simulator' + arch_param='arm64' + elif [[ $_MR_ARCH == 'x86_64_simulator' ]];then + pf='SIMULATOR64' + dest='iOS Simulator' + arch_param='x86_64' + else + pf='OS64' + dest='iOS' + arch_param='arm64' + fi + scheme_suffix='iOS only' + export MR_DEPLOYMENT_TARGET_VER=14.0 +elif [[ "$MR_PLAT" == 'tvos' ]];then + if [[ $_MR_ARCH == 'arm64_simulator' ]];then + pf='SIMULATORARM64_TVOS' + dest='tvOS Simulator' + arch_param='arm64' + elif [[ $_MR_ARCH == 'x86_64_simulator' ]];then + pf='SIMULATOR_TVOS' + dest='tvOS Simulator' + arch_param='x86_64' + else + pf='TVOS' + dest='tvOS' + arch_param='arm64' + fi + scheme_suffix='tvOS only' + export MR_DEPLOYMENT_TARGET_VER=14.0 +elif [[ "$MR_PLAT" == 'macos' ]];then + if [[ $_MR_ARCH == 'arm64' ]];then + pf='MAC_ARM64' + arch_param='arm64' + elif [[ $_MR_ARCH == 'x86_64' ]];then + pf='MAC' + arch_param='x86_64' + fi + dest='macOS' + scheme_suffix='macOS only' + export MR_DEPLOYMENT_TARGET_VER=11.0 +fi + +xc_proj="MoltenVKPackaging.xcodeproj" +scheme="MoltenVK Package ($scheme_suffix)" + +echo "----------------------" +echo "[*] configurate $LIB_NAME" +echo "[*] PLATFORM: $pf" +echo "[*] destination: $dest" +echo "[*] deployment target: $MR_DEPLOYMENT_TARGET_VER" +echo "----------------------" + +echo "----------------------" +echo "[*] compile $LIB_NAME" +echo "[*] arch: $arch_param" +echo "----------------------" + +mkdir -p "$MR_BUILD_PREFIX/lib" + +xcodebuild -project "$MR_BUILD_SOURCE/$xc_proj" \ + -scheme "$scheme" \ + -destination "generic/platform=$dest" \ + -configuration Release \ + -parallelizeTargets \ + ONLY_ACTIVE_ARCH=YES \ + ARCHS="$arch_param" \ + CODE_SIGNING_ALLOWED=NO \ + build || true + +dd_dir=$(find ~/Library/Developer/Xcode/DerivedData -maxdepth 1 -type d -name "MoltenVKPackaging-*" 2>/dev/null | head -1)/Build/Products/Release + +if [[ -f "$dd_dir/libMoltenVK.a" ]]; then + cp "$dd_dir/libMoltenVK.a" "$MR_BUILD_PREFIX/lib/" + echo "Copied libMoltenVK.a to $MR_BUILD_PREFIX/lib/" +else + echo "libMoltenVK.a not found in $dd_dir" + exit 1 +fi + +alt_header_dir="$MR_BUILD_SOURCE/MoltenVK/include" +if [[ -d "$alt_header_dir" ]]; then + mkdir -p "$MR_BUILD_PREFIX/include" + # -L: follow symbolic links, copy actual files instead of symlinks + # This is needed because the source includes symlinks to External dependencies + cp -RL "$alt_header_dir"/* "$MR_BUILD_PREFIX/include/" + echo "Copied headers from source to $MR_BUILD_PREFIX/include/" +fi + +vulkan_headers="$MR_BUILD_SOURCE/External/Vulkan-Headers/include/vulkan" +if [[ -d "$vulkan_headers" ]]; then + mkdir -p "$MR_BUILD_PREFIX/include/vulkan" + cp -RL "$vulkan_headers"/* "$MR_BUILD_PREFIX/include/vulkan/" + echo "Copied Vulkan headers to $MR_BUILD_PREFIX/include/vulkan/" +fi + +vk_video_headers="$MR_BUILD_SOURCE/External/Vulkan-Headers/include/vk_video" +if [[ -d "$vk_video_headers" ]]; then + mkdir -p "$MR_BUILD_PREFIX/include/vk_video" + cp -RL "$vk_video_headers"/* "$MR_BUILD_PREFIX/include/vk_video/" + echo "Copied vk_video headers to $MR_BUILD_PREFIX/include/vk_video/" +fi From 1b96a10bc6bd14921338a0c89b9ae759164ba10c Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Tue, 24 Mar 2026 18:35:09 +0800 Subject: [PATCH 262/359] add moltenvk to workflow --- .github/workflows/build all libs.yml | 12 ++++++++++++ .github/workflows/build one lib.yml | 1 + .github/workflows/install-dependencies.sh | 3 +++ 3 files changed, 16 insertions(+) diff --git a/.github/workflows/build all libs.yml b/.github/workflows/build all libs.yml index 964efe7f0..014ec9aa8 100644 --- a/.github/workflows/build all libs.yml +++ b/.github/workflows/build all libs.yml @@ -42,6 +42,7 @@ on: - soundtouch - opus - openssl3 + - moltenvk - dvdread - dvdnav - bluray @@ -121,6 +122,16 @@ jobs: fi fi + if [[ "$lib_name" == "moltenvk" ]]; then + if [[ "$platform" == "android" ]]; then + echo "Skip moltenvk for android" + return + elif [[ "$platform" == "all" ]]; then + echo "Skip moltenvk for android" + platform='apple' + fi + fi + echo "------compile $platform $lib_name------------------------------------" rm -rf build || git reset --hard || git pull origin .github/workflows/install-dependencies.sh $lib_name $platform # 补全依赖安装步骤 @@ -139,6 +150,7 @@ jobs: "soundtouch" "opus" "openssl3" + "moltenvk" "dvdread" "dvdnav" "bluray" diff --git a/.github/workflows/build one lib.yml b/.github/workflows/build one lib.yml index fade6d391..26945cdd9 100644 --- a/.github/workflows/build one lib.yml +++ b/.github/workflows/build one lib.yml @@ -64,6 +64,7 @@ on: - fontconfig - freetype - fribidi + - moltenvk - openssl3 - openssl - opus diff --git a/.github/workflows/install-dependencies.sh b/.github/workflows/install-dependencies.sh index e444be075..649e3bf81 100755 --- a/.github/workflows/install-dependencies.sh +++ b/.github/workflows/install-dependencies.sh @@ -185,6 +185,9 @@ case $LIB_NAME in ./main.sh install -l 'dvdread' -p $PLAT fi ;; + moltenvk) + echo "MoltenVK has no external dependencies, it fetches its own dependencies" + ;; *) ;; esac From 5c450b5cf3b0c5646836ac4b9088b9dccd96fa68 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Wed, 25 Mar 2026 10:34:48 +0800 Subject: [PATCH 263/359] fetchDependencies need platform parameter --- do-compile/apple/moltenvk.sh | 78 +++++++++++++++++------------------- 1 file changed, 37 insertions(+), 41 deletions(-) diff --git a/do-compile/apple/moltenvk.sh b/do-compile/apple/moltenvk.sh index ecb9f4b72..8acfd2603 100755 --- a/do-compile/apple/moltenvk.sh +++ b/do-compile/apple/moltenvk.sh @@ -20,80 +20,76 @@ set -e THIS_DIR=$(DIRNAME=$(dirname "$0"); cd "$DIRNAME"; pwd) cd "$THIS_DIR" -echo "----------------------" -echo "[*] fetch dependencies for $LIB_NAME" -echo "----------------------" - -cd $MR_BUILD_SOURCE -if [ -d "External" ]; then - echo "dependencies already exist" -else - if [ -f "./fetchDependencies" ]; then - echo "fetching dependencies..." - chmod +x ./fetchDependencies - ./fetchDependencies - else - echo "fetchDependencies script not found, trying with CMake..." - fi -fi - -cd "$THIS_DIR" - -pf= dest= scheme_suffix= arch_param= +fetch_deps_arg= + if [[ "$MR_PLAT" == 'ios' ]];then if [[ $_MR_ARCH == 'arm64_simulator' ]];then - pf='SIMULATORARM64' dest='iOS Simulator' arch_param='arm64' + fetch_deps_arg='--iossim' elif [[ $_MR_ARCH == 'x86_64_simulator' ]];then - pf='SIMULATOR64' dest='iOS Simulator' arch_param='x86_64' + fetch_deps_arg='--iossim' else - pf='OS64' dest='iOS' arch_param='arm64' + fetch_deps_arg='--ios' fi scheme_suffix='iOS only' export MR_DEPLOYMENT_TARGET_VER=14.0 elif [[ "$MR_PLAT" == 'tvos' ]];then if [[ $_MR_ARCH == 'arm64_simulator' ]];then - pf='SIMULATORARM64_TVOS' dest='tvOS Simulator' arch_param='arm64' + fetch_deps_arg='--tvossim' elif [[ $_MR_ARCH == 'x86_64_simulator' ]];then - pf='SIMULATOR_TVOS' dest='tvOS Simulator' arch_param='x86_64' + fetch_deps_arg='--tvossim' else - pf='TVOS' dest='tvOS' arch_param='arm64' + fetch_deps_arg='--tvos' fi scheme_suffix='tvOS only' export MR_DEPLOYMENT_TARGET_VER=14.0 elif [[ "$MR_PLAT" == 'macos' ]];then if [[ $_MR_ARCH == 'arm64' ]];then - pf='MAC_ARM64' arch_param='arm64' elif [[ $_MR_ARCH == 'x86_64' ]];then - pf='MAC' arch_param='x86_64' fi dest='macOS' scheme_suffix='macOS only' + fetch_deps_arg='--macos' export MR_DEPLOYMENT_TARGET_VER=11.0 fi -xc_proj="MoltenVKPackaging.xcodeproj" -scheme="MoltenVK Package ($scheme_suffix)" +echo "----------------------" +echo "[*] fetch dependencies for $LIB_NAME" +echo "----------------------" + +cd $MR_BUILD_SOURCE +if [ -d "External" ]; then + echo "dependencies already exist" +else + if [ -f "./fetchDependencies" ]; then + echo "fetching dependencies for $fetch_deps_arg..." + chmod +x ./fetchDependencies + ./fetchDependencies $fetch_deps_arg + else + echo "fetchDependencies script not found, trying with CMake..." + fi +fi + +cd "$THIS_DIR" echo "----------------------" echo "[*] configurate $LIB_NAME" -echo "[*] PLATFORM: $pf" echo "[*] destination: $dest" echo "[*] deployment target: $MR_DEPLOYMENT_TARGET_VER" echo "----------------------" @@ -105,8 +101,8 @@ echo "----------------------" mkdir -p "$MR_BUILD_PREFIX/lib" -xcodebuild -project "$MR_BUILD_SOURCE/$xc_proj" \ - -scheme "$scheme" \ +xcodebuild -project "$MR_BUILD_SOURCE/MoltenVKPackaging.xcodeproj" \ + -scheme "MoltenVK Package ($scheme_suffix)" \ -destination "generic/platform=$dest" \ -configuration Release \ -parallelizeTargets \ @@ -115,14 +111,14 @@ xcodebuild -project "$MR_BUILD_SOURCE/$xc_proj" \ CODE_SIGNING_ALLOWED=NO \ build || true -dd_dir=$(find ~/Library/Developer/Xcode/DerivedData -maxdepth 1 -type d -name "MoltenVKPackaging-*" 2>/dev/null | head -1)/Build/Products/Release - -if [[ -f "$dd_dir/libMoltenVK.a" ]]; then - cp "$dd_dir/libMoltenVK.a" "$MR_BUILD_PREFIX/lib/" - echo "Copied libMoltenVK.a to $MR_BUILD_PREFIX/lib/" -else - echo "libMoltenVK.a not found in $dd_dir" - exit 1 +pkg_static_dir="$MR_BUILD_SOURCE/Package/Release/MoltenVK/static" +if [[ -d "$pkg_static_dir/MoltenVK.xcframework" ]]; then + xcframework_dir="$pkg_static_dir/MoltenVK.xcframework" + archs_dir=$(ls "$xcframework_dir/" 2>/dev/null | grep -v Info.plist | head -1) + if [[ -n "$archs_dir" && -f "$xcframework_dir/$archs_dir/libMoltenVK.a" ]]; then + cp "$xcframework_dir/$archs_dir/libMoltenVK.a" "$MR_BUILD_PREFIX/lib/" + echo "Copied libMoltenVK.a from xcframework to $MR_BUILD_PREFIX/lib/" + fi fi alt_header_dir="$MR_BUILD_SOURCE/MoltenVK/include" From d6902bfe8f22da94218567937bb62480eca6a867 Mon Sep 17 00:00:00 2001 From: Anka Date: Wed, 25 Mar 2026 02:50:41 +0000 Subject: [PATCH 264/359] upgrade moltenvk to moltenvk-v1.4.1-260325103801 for macos by cd --- configs/libs/moltenvk.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/libs/moltenvk.sh b/configs/libs/moltenvk.sh index b88d40e62..9b659c700 100644 --- a/configs/libs/moltenvk.sh +++ b/configs/libs/moltenvk.sh @@ -32,6 +32,6 @@ fi # pre compiled export PRE_COMPILE_TAG_TVOS= -export PRE_COMPILE_TAG_MACOS= +export PRE_COMPILE_TAG_MACOS=moltenvk-v1.4.1-260325103801 export PRE_COMPILE_TAG_IOS= export PRE_COMPILE_TAG_ANDROID= From adb2780464db5ab33422f9e3862e811d2fbfd5eb Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Wed, 25 Mar 2026 15:04:51 +0800 Subject: [PATCH 265/359] add shaderc --- .github/workflows/build all libs.yml | 16 +++- .github/workflows/build one lib.yml | 1 + .github/workflows/install-dependencies.sh | 3 + configs/libs/shaderc.sh | 34 ++++++++ do-compile/apple/shaderc.sh | 96 +++++++++++++++++++++++ 5 files changed, 148 insertions(+), 2 deletions(-) create mode 100644 configs/libs/shaderc.sh create mode 100755 do-compile/apple/shaderc.sh diff --git a/.github/workflows/build all libs.yml b/.github/workflows/build all libs.yml index 014ec9aa8..15f158087 100644 --- a/.github/workflows/build all libs.yml +++ b/.github/workflows/build all libs.yml @@ -42,7 +42,6 @@ on: - soundtouch - opus - openssl3 - - moltenvk - dvdread - dvdnav - bluray @@ -50,6 +49,8 @@ on: - uavs3d - smb2 - webp + - shaderc + - moltenvk - ijkffmpeg - fftutorial - ffmpeg4 @@ -132,6 +133,16 @@ jobs: fi fi + if [[ "$lib_name" == "shaderc" ]]; then + if [[ "$platform" == "android" ]]; then + echo "Skip shaderc for android" + return + elif [[ "$platform" == "all" ]]; then + echo "Skip shaderc for android" + platform='apple' + fi + fi + echo "------compile $platform $lib_name------------------------------------" rm -rf build || git reset --hard || git pull origin .github/workflows/install-dependencies.sh $lib_name $platform # 补全依赖安装步骤 @@ -150,7 +161,6 @@ jobs: "soundtouch" "opus" "openssl3" - "moltenvk" "dvdread" "dvdnav" "bluray" @@ -158,6 +168,8 @@ jobs: "uavs3d" "smb2" "webp" + "shaderc" + "moltenvk" "ijkffmpeg" "fftutorial" "ffmpeg4" diff --git a/.github/workflows/build one lib.yml b/.github/workflows/build one lib.yml index 26945cdd9..44f541474 100644 --- a/.github/workflows/build one lib.yml +++ b/.github/workflows/build one lib.yml @@ -68,6 +68,7 @@ on: - openssl3 - openssl - opus + - shaderc - smb2 - soundtouch - uavs3d diff --git a/.github/workflows/install-dependencies.sh b/.github/workflows/install-dependencies.sh index 649e3bf81..6a5ce2dde 100755 --- a/.github/workflows/install-dependencies.sh +++ b/.github/workflows/install-dependencies.sh @@ -188,6 +188,9 @@ case $LIB_NAME in moltenvk) echo "MoltenVK has no external dependencies, it fetches its own dependencies" ;; + shaderc) + echo "shaderc has no external dependencies, it fetches its own dependencies via git-sync-deps" + ;; *) ;; esac diff --git a/configs/libs/shaderc.sh b/configs/libs/shaderc.sh new file mode 100644 index 000000000..35cf90c21 --- /dev/null +++ b/configs/libs/shaderc.sh @@ -0,0 +1,34 @@ +#! /usr/bin/env bash +# +# Copyright (C) 2021 Matt Reach + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +export LIB_NAME='shaderc' +export LIPO_LIBS="libshaderc libshaderc_combined" +export LIB_DEPENDS_BIN="cmake" +export GIT_LOCAL_REPO=extra/shaderc +export GIT_COMMIT=v2025.3 +export REPO_DIR=shaderc +export GIT_REPO_VERSION=v2025.3 + +# macOS deployment target must be 11.0+ for std::filesystem in glslang +export MR_DEPLOYMENT_TARGET_VER_MACOS=11.0 + +# you can export GIT_SHADERC_UPSTREAM=git@xx:yy/shaderc.git use your mirror +if [[ "$GIT_SHADERC_UPSTREAM" != "" ]] ;then + export GIT_UPSTREAM="$GIT_SHADERC_UPSTREAM" +else + export GIT_UPSTREAM=https://github.com/google/shaderc.git +fi diff --git a/do-compile/apple/shaderc.sh b/do-compile/apple/shaderc.sh new file mode 100755 index 000000000..59589e696 --- /dev/null +++ b/do-compile/apple/shaderc.sh @@ -0,0 +1,96 @@ +#! /usr/bin/env bash +# +# Copyright (C) 2021 Matt Reach + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +set -e + +THIS_DIR=$(DIRNAME=$(dirname "$0"); cd "$DIRNAME"; pwd) +cd "$THIS_DIR" + +echo "----------------------" +echo "[*] sync dependencies for $LIB_NAME" +echo "----------------------" + +cd $MR_BUILD_SOURCE +if [ -f "./utils/git-sync-deps" ]; then + echo "running git-sync-deps..." + chmod +x ./utils/git-sync-deps + ./utils/git-sync-deps +else + echo "git-sync-deps not found" + exit 1 +fi + +cd "$THIS_DIR" + +pf= +if [[ "$MR_PLAT" == 'ios' ]];then + if [[ $_MR_ARCH == 'arm64_simulator' ]];then + pf='SIMULATORARM64' + elif [[ $_MR_ARCH == 'x86_64_simulator' ]];then + pf='SIMULATOR64' + else + pf='OS64' + fi +elif [[ "$MR_PLAT" == 'tvos' ]];then + if [[ $_MR_ARCH == 'arm64_simulator' ]];then + pf='SIMULATORARM64_TVOS' + elif [[ $_MR_ARCH == 'x86_64_simulator' ]];then + pf='SIMULATOR_TVOS' + else + pf='TVOS' + fi +elif [[ "$MR_PLAT" == 'macos' ]];then + if [[ $_MR_ARCH == 'arm64' ]];then + pf='MAC_ARM64' + elif [[ $_MR_ARCH == 'x86_64' ]];then + pf='MAC' + fi + # glslang requires macOS 10.15+ for std::filesystem + export MR_DEPLOYMENT_TARGET_VER=11.0 +fi + +echo "----------------------" +echo "[*] configurate $LIB_NAME" +echo "----------------------" + +build="${MR_BUILD_SOURCE}/cmake_wksp" +rm -rf "$build" +mkdir -p "$build" +cd "$build" + +cmake -S ${MR_BUILD_SOURCE} \ + -DCMAKE_INSTALL_PREFIX=${MR_BUILD_PREFIX} \ + -DCMAKE_TOOLCHAIN_FILE="${MR_SHELL_TOOLS_DIR}/ios.toolchain.cmake" \ + -DPLATFORM=$pf \ + -DDEPLOYMENT_TARGET=$MR_DEPLOYMENT_TARGET_VER \ + -DCMAKE_BUILD_TYPE=Release \ + -DSHADERC_SKIP_TESTS=ON \ + -DBUILD_SHARED_LIBS=OFF \ + -DCMAKE_MACOSX_BUNDLE=OFF \ + -GNinja + +echo "----------------------" +echo "[*] compile $LIB_NAME" +echo "----------------------" + +cmake --build . --config Release --parallel + +echo "----------------------" +echo "[*] install $LIB_NAME" +echo "----------------------" + +cmake --install . From 72ee5a0a169a346eb0618e52b857e2142df99a6c Mon Sep 17 00:00:00 2001 From: Anka Date: Wed, 25 Mar 2026 07:14:52 +0000 Subject: [PATCH 266/359] upgrade shaderc to shaderc-v2025.3-260325150610 for macos by cd --- configs/libs/shaderc.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/libs/shaderc.sh b/configs/libs/shaderc.sh index 35cf90c21..d5d6b46f1 100644 --- a/configs/libs/shaderc.sh +++ b/configs/libs/shaderc.sh @@ -32,3 +32,4 @@ if [[ "$GIT_SHADERC_UPSTREAM" != "" ]] ;then else export GIT_UPSTREAM=https://github.com/google/shaderc.git fi +export PRE_COMPILE_TAG_MACOS=shaderc-v2025.3-260325150610 From f24cf212253f1b04b6bcb9d5dafa512beab73ea0 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Wed, 25 Mar 2026 15:25:06 +0800 Subject: [PATCH 267/359] add cms2 and placebo --- .github/workflows/build all libs.yml | 18 ++++- .github/workflows/build one lib.yml | 2 + .github/workflows/install-dependencies.sh | 25 +++++++ configs/libs/lcms2.sh | 31 +++++++++ configs/libs/libplacebo.sh | 33 +++++++++ do-compile/apple/lcms2.sh | 54 +++++++++++++++ do-compile/apple/libplacebo.sh | 84 +++++++++++++++++++++++ 7 files changed, 245 insertions(+), 2 deletions(-) create mode 100644 configs/libs/lcms2.sh create mode 100644 configs/libs/libplacebo.sh create mode 100755 do-compile/apple/lcms2.sh create mode 100755 do-compile/apple/libplacebo.sh diff --git a/.github/workflows/build all libs.yml b/.github/workflows/build all libs.yml index 15f158087..2f3f912ee 100644 --- a/.github/workflows/build all libs.yml +++ b/.github/workflows/build all libs.yml @@ -42,6 +42,10 @@ on: - soundtouch - opus - openssl3 + - lcms2 + - shaderc + - moltenvk + - libplacebo - dvdread - dvdnav - bluray @@ -49,8 +53,6 @@ on: - uavs3d - smb2 - webp - - shaderc - - moltenvk - ijkffmpeg - fftutorial - ffmpeg4 @@ -143,6 +145,16 @@ jobs: fi fi + if [[ "$lib_name" == "libplacebo" ]]; then + if [[ "$platform" == "android" ]]; then + echo "Skip libplacebo for android" + return + elif [[ "$platform" == "all" ]]; then + echo "Skip libplacebo for android" + platform='apple' + fi + fi + echo "------compile $platform $lib_name------------------------------------" rm -rf build || git reset --hard || git pull origin .github/workflows/install-dependencies.sh $lib_name $platform # 补全依赖安装步骤 @@ -168,8 +180,10 @@ jobs: "uavs3d" "smb2" "webp" + "lcms2" "shaderc" "moltenvk" + "libplacebo" "ijkffmpeg" "fftutorial" "ffmpeg4" diff --git a/.github/workflows/build one lib.yml b/.github/workflows/build one lib.yml index 44f541474..c37a7d199 100644 --- a/.github/workflows/build one lib.yml +++ b/.github/workflows/build one lib.yml @@ -64,6 +64,8 @@ on: - fontconfig - freetype - fribidi + - lcms2 + - libplacebo - moltenvk - openssl3 - openssl diff --git a/.github/workflows/install-dependencies.sh b/.github/workflows/install-dependencies.sh index 6a5ce2dde..9d27a0f24 100755 --- a/.github/workflows/install-dependencies.sh +++ b/.github/workflows/install-dependencies.sh @@ -191,6 +191,31 @@ case $LIB_NAME in shaderc) echo "shaderc has no external dependencies, it fetches its own dependencies via git-sync-deps" ;; + libplacebo) + if [[ $PLAT == all ]];then + ./main.sh install -l 'lcms2' -p ios + ./main.sh install -l 'lcms2' -p tvos + ./main.sh install -l 'lcms2' -p macos + ./main.sh install -l 'shaderc' -p ios + ./main.sh install -l 'shaderc' -p tvos + ./main.sh install -l 'shaderc' -p macos + ./main.sh install -l 'moltenvk' -p ios + ./main.sh install -l 'moltenvk' -p tvos + ./main.sh install -l 'moltenvk' -p macos + elif [[ $PLAT == apple ]];then + ./main.sh install -l 'lcms2' -p ios + ./main.sh install -l 'lcms2' -p tvos + ./main.sh install -l 'lcms2' -p macos + ./main.sh install -l 'shaderc' -p ios + ./main.sh install -l 'shaderc' -p tvos + ./main.sh install -l 'shaderc' -p macos + ./main.sh install -l 'moltenvk' -p ios + ./main.sh install -l 'moltenvk' -p tvos + ./main.sh install -l 'moltenvk' -p macos + else + ./main.sh install -l 'lcms2 shaderc moltenvk' -p $PLAT + fi + ;; *) ;; esac diff --git a/configs/libs/lcms2.sh b/configs/libs/lcms2.sh new file mode 100644 index 000000000..f6bbe2e4d --- /dev/null +++ b/configs/libs/lcms2.sh @@ -0,0 +1,31 @@ +#! /usr/bin/env bash +# +# Copyright (C) 2021 Matt Reach + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +export LIB_NAME='lcms2' +export LIPO_LIBS="liblcms2" +export LIB_DEPENDS_BIN="cmake" +export GIT_LOCAL_REPO=extra/lcms2 +export GIT_COMMIT=lcms2.17 +export REPO_DIR=lcms2 +export GIT_REPO_VERSION=lcms2.17 + +# you can export GIT_LCMS2_UPSTREAM=git@xx:yy/lcms2.git use your mirror +if [[ "$GIT_LCMS2_UPSTREAM" != "" ]] ;then + export GIT_UPSTREAM="$GIT_LCMS2_UPSTREAM" +else + export GIT_UPSTREAM=https://github.com/mm2/Little-CMS.git +fi diff --git a/configs/libs/libplacebo.sh b/configs/libs/libplacebo.sh new file mode 100644 index 000000000..de9bb66aa --- /dev/null +++ b/configs/libs/libplacebo.sh @@ -0,0 +1,33 @@ +#! /usr/bin/env bash +# +# Copyright (C) 2021 Matt Reach + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +export LIB_NAME='libplacebo' +export LIPO_LIBS="libplacebo" +export LIB_DEPENDS_BIN="meson ninja" +# libplacebo depends on lcms2 and shaderc (for SPIRV), vulkan backend uses MoltenVK +export LIB_DEPENDS='lcms2 shaderc moltenvk' +export GIT_LOCAL_REPO=extra/libplacebo +export GIT_COMMIT=v7.349.0 +export REPO_DIR=libplacebo +export GIT_REPO_VERSION=v7.349.0 + +# you can export GIT_LIBPLACEB0_UPSTREAM=git@xx:yy/libplacebo.git use your mirror +if [[ "$GIT_LIBPLACEB0_UPSTREAM" != "" ]] ;then + export GIT_UPSTREAM="$GIT_LIBPLACEB0_UPSTREAM" +else + export GIT_UPSTREAM=https://github.com/haasn/libplacebo.git +fi diff --git a/do-compile/apple/lcms2.sh b/do-compile/apple/lcms2.sh new file mode 100755 index 000000000..e6037da2d --- /dev/null +++ b/do-compile/apple/lcms2.sh @@ -0,0 +1,54 @@ +#! /usr/bin/env bash +# +# Copyright (C) 2021 Matt Reach + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +set -e + +THIS_DIR=$(DIRNAME=$(dirname "$0"); cd "$DIRNAME"; pwd) +cd "$THIS_DIR" + +CFG_FLAGS="--prefix=$MR_BUILD_PREFIX --enable-static --disable-shared" +CFLAGS="$MR_DEFAULT_CFLAGS" + +# for cross compile +if [[ $(uname -m) != "$MR_ARCH" || "$MR_FORCE_CROSS" ]]; then + echo "[*] cross compile, on $(uname -m) compile $MR_PLAT $MR_ARCH." + CFLAGS="$CFLAGS -isysroot $MR_SYS_ROOT" + CFG_FLAGS="$CFG_FLAGS --host=$MR_ARCH-apple-darwin --with-sysroot=$MR_SYS_ROOT" +fi + +cd $MR_BUILD_SOURCE + +echo +echo "CC: $MR_CC" +echo "CFG_FLAGS: $CFG_FLAGS" +echo "CFLAGS: $CFLAGS" +echo + +echo "----------------------" +echo "[*] configure $LIB_NAME" +echo "----------------------" + +./configure $CFG_FLAGS \ + CC="$MR_CC" \ + CFLAGS="$CFLAGS" \ + LDFLAGS="$CFLAGS" + +echo "----------------------" +echo "[*] compile $LIB_NAME" +echo "----------------------" + +make -j$MR_HOST_NPROC install diff --git a/do-compile/apple/libplacebo.sh b/do-compile/apple/libplacebo.sh new file mode 100755 index 000000000..745052477 --- /dev/null +++ b/do-compile/apple/libplacebo.sh @@ -0,0 +1,84 @@ +#! /usr/bin/env bash +# +# Copyright (C) 2021 Matt Reach + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +set -e + +THIS_DIR=$(DIRNAME=$(dirname "$0"); cd "$DIRNAME"; pwd) +cd "$THIS_DIR" + +echo "----------------------" +echo "[*] init submodules for $LIB_NAME" +echo "----------------------" + +cd $MR_BUILD_SOURCE +git submodule update --init --recursive + +cd "$THIS_DIR" + +echo "----------------------" +echo "[*] configure $LIB_NAME" +echo "----------------------" + +# libplacebo uses meson, and we need to specify MoltenVK as Vulkan ICD +# Only enable vulkan backend (no opengl/d3d11) +# Use shaderc for SPIRV compilation + +# Find lcms2 and shaderc from our build +PKG_CONFIG_PATH="${MR_BUILD_PREFIX}/lib/pkgconfig:$PKG_CONFIG_PATH" + +# Set deployment target for macOS +export MACOSX_DEPLOYMENT_TARGET=11.0 + +MESON_OPTS="--buildtype=release \ +--prefix=$MR_BUILD_PREFIX \ +--default-library=static \ +-Dvulkan=enabled \ +-Dshaderc=enabled \ +-Dglslang=disabled \ +-Dopengl=disabled \ +-Dd3d11=disabled \ +-Dlcms=enabled \ +-Dtests=false \ +-Dbench=false \ +-Ddemos=false \ +-Dxxhash=disabled" + +build="${MR_BUILD_SOURCE}/meson_build" +rm -rf "$build" +mkdir -p "$build" +cd "$build" + +# Set up environment for MoltenVK +export VK_ICD_FILENAMES="${MR_BUILD_PREFIX}/share/vulkan/icd.d/MoltenVK_icd.json" + +# Disable assertions to fix Xcode SDK compatibility issue +export CFLAGS="-U_LIBCPP_ENABLE_ASSERTIONS" +export CXXFLAGS="-U_LIBCPP_ENABLE_ASSERTIONS" + +meson setup . ${MR_BUILD_SOURCE} ${MESON_OPTS} + +echo "----------------------" +echo "[*] compile $LIB_NAME" +echo "----------------------" + +ninja + +echo "----------------------" +echo "[*] install $LIB_NAME" +echo "----------------------" + +meson install From da9ac0eacc813ce369e3471352638dacd54d839f Mon Sep 17 00:00:00 2001 From: Anka Date: Wed, 25 Mar 2026 07:27:45 +0000 Subject: [PATCH 268/359] upgrade lcms2 to lcms2-lcms2.17-260325152711 for macos by cd --- configs/libs/lcms2.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/libs/lcms2.sh b/configs/libs/lcms2.sh index f6bbe2e4d..b91a03b96 100644 --- a/configs/libs/lcms2.sh +++ b/configs/libs/lcms2.sh @@ -29,3 +29,4 @@ if [[ "$GIT_LCMS2_UPSTREAM" != "" ]] ;then else export GIT_UPSTREAM=https://github.com/mm2/Little-CMS.git fi +export PRE_COMPILE_TAG_MACOS=lcms2-lcms2.17-260325152711 From d3cd197ef9973b3a4ba00a8a388453ef87eb6870 Mon Sep 17 00:00:00 2001 From: Anka Date: Wed, 25 Mar 2026 07:31:08 +0000 Subject: [PATCH 269/359] upgrade libplacebo to libplacebo-v7.349.0-260325153025 for macos by cd --- configs/libs/libplacebo.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/libs/libplacebo.sh b/configs/libs/libplacebo.sh index de9bb66aa..3e9cfc341 100644 --- a/configs/libs/libplacebo.sh +++ b/configs/libs/libplacebo.sh @@ -31,3 +31,4 @@ if [[ "$GIT_LIBPLACEB0_UPSTREAM" != "" ]] ;then else export GIT_UPSTREAM=https://github.com/haasn/libplacebo.git fi +export PRE_COMPILE_TAG_MACOS=libplacebo-v7.349.0-260325153025 From 566e9ccc9d57b0c9fafc04791b30eb1c5a5676c1 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Wed, 25 Mar 2026 15:56:43 +0800 Subject: [PATCH 270/359] lib name use placebo --- .github/workflows/build all libs.yml | 10 +++--- .github/workflows/build one lib.yml | 2 +- .github/workflows/install-dependencies.sh | 2 +- configs/libs/placebo.sh | 33 +++++++++++++++++++ .../apple/{libplacebo.sh => placebo.sh} | 4 +++ 5 files changed, 44 insertions(+), 7 deletions(-) create mode 100644 configs/libs/placebo.sh rename do-compile/apple/{libplacebo.sh => placebo.sh} (89%) diff --git a/.github/workflows/build all libs.yml b/.github/workflows/build all libs.yml index 2f3f912ee..0840e2a80 100644 --- a/.github/workflows/build all libs.yml +++ b/.github/workflows/build all libs.yml @@ -45,7 +45,7 @@ on: - lcms2 - shaderc - moltenvk - - libplacebo + - placebo - dvdread - dvdnav - bluray @@ -145,12 +145,12 @@ jobs: fi fi - if [[ "$lib_name" == "libplacebo" ]]; then + if [[ "$lib_name" == "placebo" ]]; then if [[ "$platform" == "android" ]]; then - echo "Skip libplacebo for android" + echo "Skip placebo for android" return elif [[ "$platform" == "all" ]]; then - echo "Skip libplacebo for android" + echo "Skip placebo for android" platform='apple' fi fi @@ -183,7 +183,7 @@ jobs: "lcms2" "shaderc" "moltenvk" - "libplacebo" + "placebo" "ijkffmpeg" "fftutorial" "ffmpeg4" diff --git a/.github/workflows/build one lib.yml b/.github/workflows/build one lib.yml index c37a7d199..d95044edb 100644 --- a/.github/workflows/build one lib.yml +++ b/.github/workflows/build one lib.yml @@ -65,7 +65,7 @@ on: - freetype - fribidi - lcms2 - - libplacebo + - placebo - moltenvk - openssl3 - openssl diff --git a/.github/workflows/install-dependencies.sh b/.github/workflows/install-dependencies.sh index 9d27a0f24..adebf0408 100755 --- a/.github/workflows/install-dependencies.sh +++ b/.github/workflows/install-dependencies.sh @@ -191,7 +191,7 @@ case $LIB_NAME in shaderc) echo "shaderc has no external dependencies, it fetches its own dependencies via git-sync-deps" ;; - libplacebo) + placebo) if [[ $PLAT == all ]];then ./main.sh install -l 'lcms2' -p ios ./main.sh install -l 'lcms2' -p tvos diff --git a/configs/libs/placebo.sh b/configs/libs/placebo.sh new file mode 100644 index 000000000..fa1e68d52 --- /dev/null +++ b/configs/libs/placebo.sh @@ -0,0 +1,33 @@ +#! /usr/bin/env bash +# +# Copyright (C) 2021 Matt Reach + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +export LIB_NAME='placebo' +export LIPO_LIBS="libplacebo" +export LIB_DEPENDS_BIN="meson ninja" +# placebo depends on lcms2 and shaderc (for SPIRV), vulkan backend uses MoltenVK +export LIB_DEPENDS='lcms2 shaderc moltenvk' +export GIT_LOCAL_REPO=extra/libplacebo +export GIT_COMMIT=v7.349.0 +export REPO_DIR=libplacebo +export GIT_REPO_VERSION=v7.349.0 + +# you can export GIT_LIBPLACEB0_UPSTREAM=git@xx:yy/libplacebo.git use your mirror +if [[ "$GIT_LIBPLACEB0_UPSTREAM" != "" ]] ;then + export GIT_UPSTREAM="$GIT_LIBPLACEB0_UPSTREAM" +else + export GIT_UPSTREAM=https://github.com/haasn/libplacebo.git +fi diff --git a/do-compile/apple/libplacebo.sh b/do-compile/apple/placebo.sh similarity index 89% rename from do-compile/apple/libplacebo.sh rename to do-compile/apple/placebo.sh index 745052477..64385c9cc 100755 --- a/do-compile/apple/libplacebo.sh +++ b/do-compile/apple/placebo.sh @@ -27,6 +27,10 @@ echo "----------------------" cd $MR_BUILD_SOURCE git submodule update --init --recursive +# Fix Python 3.14 compatibility issue in utils_gen.py +# ET.parse() returns ElementTree, need to call .getroot() to get Element +sed -i '' 's/registry = VkXML(ET.parse(xmlfile))/registry = VkXML(ET.parse(xmlfile).getroot())/g' src/vulkan/utils_gen.py + cd "$THIS_DIR" echo "----------------------" From bd8bf742a595dae79e485333c5f4bc648d7d6fb6 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Thu, 26 Mar 2026 14:06:45 +0800 Subject: [PATCH 271/359] add libdovi --- .github/workflows/build all libs.yml | 12 ++++ .github/workflows/onestep.sh | 1 + configs/libs/dovi.sh | 31 ++++++++++ configs/libs/libplacebo.sh | 34 ----------- configs/libs/placebo.sh | 6 +- do-compile/apple/dovi.sh | 90 ++++++++++++++++++++++++++++ do-compile/apple/meson-compatible.sh | 2 +- 7 files changed, 138 insertions(+), 38 deletions(-) create mode 100644 configs/libs/dovi.sh delete mode 100644 configs/libs/libplacebo.sh create mode 100755 do-compile/apple/dovi.sh diff --git a/.github/workflows/build all libs.yml b/.github/workflows/build all libs.yml index 0840e2a80..db8e194eb 100644 --- a/.github/workflows/build all libs.yml +++ b/.github/workflows/build all libs.yml @@ -45,6 +45,7 @@ on: - lcms2 - shaderc - moltenvk + - dovi - placebo - dvdread - dvdnav @@ -145,6 +146,16 @@ jobs: fi fi + if [[ "$lib_name" == "dovi" ]]; then + if [[ "$platform" == "android" ]]; then + echo "Skip dovi for android" + return + elif [[ "$platform" == "all" ]]; then + echo "Skip dovi for android" + platform='apple' + fi + fi + if [[ "$lib_name" == "placebo" ]]; then if [[ "$platform" == "android" ]]; then echo "Skip placebo for android" @@ -183,6 +194,7 @@ jobs: "lcms2" "shaderc" "moltenvk" + "dovi" "placebo" "ijkffmpeg" "fftutorial" diff --git a/.github/workflows/onestep.sh b/.github/workflows/onestep.sh index 94e0d7ddb..5984764ec 100755 --- a/.github/workflows/onestep.sh +++ b/.github/workflows/onestep.sh @@ -5,6 +5,7 @@ # git describe --tags --always | awk -F - '{printf "RELEASE_VERSION=V1.0-%s",$NF}' | xargs > constants.env set -e +set -o pipefail export LIB_NAME=$1 export PLAT=$2 diff --git a/configs/libs/dovi.sh b/configs/libs/dovi.sh new file mode 100644 index 000000000..9f1cba94b --- /dev/null +++ b/configs/libs/dovi.sh @@ -0,0 +1,31 @@ +#! /usr/bin/env bash +# +# Copyright (C) 2021 Matt Reach + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +export LIB_NAME='dovi' +export LIPO_LIBS="libdovi" +export LIB_DEPENDS_BIN="rust cargo-c" +export GIT_LOCAL_REPO=extra/dovi +export GIT_COMMIT=libdovi-3.3.2 +export GIT_WITH_SUBMODULE=0 +export REPO_DIR=dovi +export GIT_REPO_VERSION=3.3.2 + +if [[ "$GIT_DOVI_UPSTREAM" != "" ]] ;then + export GIT_UPSTREAM="$GIT_DOVI_UPSTREAM" +else + export GIT_UPSTREAM=https://github.com/quietvoid/dovi_tool.git +fi \ No newline at end of file diff --git a/configs/libs/libplacebo.sh b/configs/libs/libplacebo.sh deleted file mode 100644 index 3e9cfc341..000000000 --- a/configs/libs/libplacebo.sh +++ /dev/null @@ -1,34 +0,0 @@ -#! /usr/bin/env bash -# -# Copyright (C) 2021 Matt Reach - -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -export LIB_NAME='libplacebo' -export LIPO_LIBS="libplacebo" -export LIB_DEPENDS_BIN="meson ninja" -# libplacebo depends on lcms2 and shaderc (for SPIRV), vulkan backend uses MoltenVK -export LIB_DEPENDS='lcms2 shaderc moltenvk' -export GIT_LOCAL_REPO=extra/libplacebo -export GIT_COMMIT=v7.349.0 -export REPO_DIR=libplacebo -export GIT_REPO_VERSION=v7.349.0 - -# you can export GIT_LIBPLACEB0_UPSTREAM=git@xx:yy/libplacebo.git use your mirror -if [[ "$GIT_LIBPLACEB0_UPSTREAM" != "" ]] ;then - export GIT_UPSTREAM="$GIT_LIBPLACEB0_UPSTREAM" -else - export GIT_UPSTREAM=https://github.com/haasn/libplacebo.git -fi -export PRE_COMPILE_TAG_MACOS=libplacebo-v7.349.0-260325153025 diff --git a/configs/libs/placebo.sh b/configs/libs/placebo.sh index fa1e68d52..6ab4bc103 100644 --- a/configs/libs/placebo.sh +++ b/configs/libs/placebo.sh @@ -19,10 +19,10 @@ export LIB_NAME='placebo' export LIPO_LIBS="libplacebo" export LIB_DEPENDS_BIN="meson ninja" # placebo depends on lcms2 and shaderc (for SPIRV), vulkan backend uses MoltenVK -export LIB_DEPENDS='lcms2 shaderc moltenvk' -export GIT_LOCAL_REPO=extra/libplacebo +export LIB_DEPENDS='lcms2 shaderc moltenvk dovi' +export GIT_LOCAL_REPO=extra/placebo export GIT_COMMIT=v7.349.0 -export REPO_DIR=libplacebo +export REPO_DIR=placebo export GIT_REPO_VERSION=v7.349.0 # you can export GIT_LIBPLACEB0_UPSTREAM=git@xx:yy/libplacebo.git use your mirror diff --git a/do-compile/apple/dovi.sh b/do-compile/apple/dovi.sh new file mode 100755 index 000000000..7b016e94d --- /dev/null +++ b/do-compile/apple/dovi.sh @@ -0,0 +1,90 @@ +#! /usr/bin/env bash +# +# Copyright (C) 2021 Matt Reach + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +set -e + +THIS_DIR=$(DIRNAME=$(dirname "$0"); cd "$DIRNAME"; pwd) +cd "$THIS_DIR" + +echo "----------------------" +echo "[*] configure $LIB_NAME" +echo "----------------------" + +cd $MR_BUILD_SOURCE + +cd dolby_vision + +build_dir="${MR_BUILD_SOURCE}/dolby_vision_build" +rm -rf "$build_dir" +mkdir -p "$build_dir" +cd "$build_dir" + +export CC="$MR_CC" +export CXX="$MR_CXX" +export CFLAGS="-fPIC $CFLAGS" +export CXXFLAGS="-fPIC $CXXFLAGS" + +if [[ "$MR_DEBUG" == "debug" ]]; then + build_type="debug" +else + build_type="release" +fi + +echo "----------------------" +echo "[*] compile $LIB_NAME" +echo "---------------------" +echo "CC: $MR_CC" +echo "CFLAGS: $CFLAGS" +echo "build_type: $build_type" +echo "prefix: $MR_BUILD_PREFIX" +echo "----------------------" + +MANIFEST_PATH="${MR_BUILD_SOURCE}/dolby_vision/Cargo.toml" + +arch_target() { + local arch="$1" + case "$arch" in + arm64) + echo "aarch64-apple-ios" + ;; + arm64_simulator) + echo "aarch64-apple-ios-sim" + ;; + x86_64_simulator) + echo "x86_64-apple-ios" + ;; + *) + echo "$arch-apple-ios" + ;; + esac +} + +target=$(arch_target "$MR_ARCH") + +cargo cinstall \ + --manifest-path="$MANIFEST_PATH" \ + --target="$target" \ + --prefix="$MR_BUILD_PREFIX" \ + --lib \ + --library-type=staticlib \ + --release \ + --no-default-features \ + --features capi + +echo "----------------------" +echo "[*] install $LIB_NAME" +echo "----------------------" \ No newline at end of file diff --git a/do-compile/apple/meson-compatible.sh b/do-compile/apple/meson-compatible.sh index 394c835ef..d45a313ac 100755 --- a/do-compile/apple/meson-compatible.sh +++ b/do-compile/apple/meson-compatible.sh @@ -28,7 +28,7 @@ echo "[*] other meson flags: $MESON_OTHER_FLAGS" echo "----------------------" # prepare build config -CFG_FLAGS="--prefix=$MR_BUILD_PREFIX --default-library static" +CFG_FLAGS="--prefix=${MR_BUILD_PREFIX} --default-library static --pkg-config-path=${PKG_CONFIG_LIBDIR}" if [[ "$MR_DEBUG" == "debug" ]]; then CFG_FLAGS="$CFG_FLAGS --buildtype=debug" From c2d8fee9d2b87f629982881b8b81d7ce2be10314 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Thu, 26 Mar 2026 14:11:48 +0800 Subject: [PATCH 272/359] add dovi to action --- .github/workflows/build one lib.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build one lib.yml b/.github/workflows/build one lib.yml index d95044edb..156763ce3 100644 --- a/.github/workflows/build one lib.yml +++ b/.github/workflows/build one lib.yml @@ -78,6 +78,7 @@ on: - yuv - xml2 - webp + - dovi pull_request: branches: [master] From 6a4bd8fe7d46a75b51c8c0e1e017fdda667e4aa5 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Thu, 26 Mar 2026 15:55:33 +0800 Subject: [PATCH 273/359] extracted rust c compatible --- configs/libs/dovi.sh | 2 +- do-compile/apple/dovi.sh | 68 ++----------- do-compile/apple/rust-c-compatible.sh | 136 ++++++++++++++++++++++++++ tools/export-apple-host-env.sh | 12 +++ 4 files changed, 155 insertions(+), 63 deletions(-) create mode 100644 do-compile/apple/rust-c-compatible.sh diff --git a/configs/libs/dovi.sh b/configs/libs/dovi.sh index 9f1cba94b..2d9671a12 100644 --- a/configs/libs/dovi.sh +++ b/configs/libs/dovi.sh @@ -17,7 +17,7 @@ export LIB_NAME='dovi' export LIPO_LIBS="libdovi" -export LIB_DEPENDS_BIN="rust cargo-c" +export LIB_DEPENDS_BIN="rustup cargo" export GIT_LOCAL_REPO=extra/dovi export GIT_COMMIT=libdovi-3.3.2 export GIT_WITH_SUBMODULE=0 diff --git a/do-compile/apple/dovi.sh b/do-compile/apple/dovi.sh index 7b016e94d..4e9b63716 100755 --- a/do-compile/apple/dovi.sh +++ b/do-compile/apple/dovi.sh @@ -24,67 +24,11 @@ echo "----------------------" echo "[*] configure $LIB_NAME" echo "----------------------" -cd $MR_BUILD_SOURCE - -cd dolby_vision - -build_dir="${MR_BUILD_SOURCE}/dolby_vision_build" -rm -rf "$build_dir" -mkdir -p "$build_dir" -cd "$build_dir" - -export CC="$MR_CC" -export CXX="$MR_CXX" -export CFLAGS="-fPIC $CFLAGS" -export CXXFLAGS="-fPIC $CXXFLAGS" +source ./rust-c-compatible.sh -if [[ "$MR_DEBUG" == "debug" ]]; then - build_type="debug" -else - build_type="release" -fi - -echo "----------------------" -echo "[*] compile $LIB_NAME" -echo "---------------------" -echo "CC: $MR_CC" -echo "CFLAGS: $CFLAGS" -echo "build_type: $build_type" -echo "prefix: $MR_BUILD_PREFIX" -echo "----------------------" - -MANIFEST_PATH="${MR_BUILD_SOURCE}/dolby_vision/Cargo.toml" - -arch_target() { - local arch="$1" - case "$arch" in - arm64) - echo "aarch64-apple-ios" - ;; - arm64_simulator) - echo "aarch64-apple-ios-sim" - ;; - x86_64_simulator) - echo "x86_64-apple-ios" - ;; - *) - echo "$arch-apple-ios" - ;; - esac -} - -target=$(arch_target "$MR_ARCH") - -cargo cinstall \ - --manifest-path="$MANIFEST_PATH" \ - --target="$target" \ - --prefix="$MR_BUILD_PREFIX" \ - --lib \ - --library-type=staticlib \ - --release \ - --no-default-features \ - --features capi +cd $MR_BUILD_SOURCE -echo "----------------------" -echo "[*] install $LIB_NAME" -echo "----------------------" \ No newline at end of file +rust_c_build \ + "${MR_BUILD_SOURCE}/dolby_vision/Cargo.toml" \ + "dolby_vision" \ + "--features capi" \ No newline at end of file diff --git a/do-compile/apple/rust-c-compatible.sh b/do-compile/apple/rust-c-compatible.sh new file mode 100644 index 000000000..fa56d4afc --- /dev/null +++ b/do-compile/apple/rust-c-compatible.sh @@ -0,0 +1,136 @@ +#! /usr/bin/env bash +# +# Copyright (C) 2021 Matt Reach + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +set -e + +if ! command -v rustup &> /dev/null; then + return 0 +fi + +case "$MR_PLAT" in +macos) + rustup target add aarch64-apple-darwin x86_64-apple-darwin + ;; +tvos) + rustup target add aarch64-apple-tvos aarch64-apple-tvos-sim x86_64-apple-tvos + ;; +ios) + rustup target add aarch64-apple-ios aarch64-apple-ios-sim x86_64-apple-ios + ;; +esac + +arch_target() { + local arch="$1" + local plat="$2" + case "$plat" in + macos) + case "$arch" in + arm64) + echo "aarch64-apple-darwin" + ;; + x86_64) + echo "x86_64-apple-darwin" + ;; + *) + echo "$arch-apple-darwin" + ;; + esac + ;; + tvos) + case "$arch" in + arm64) + echo "aarch64-apple-tvos" + ;; + arm64_simulator) + echo "aarch64-apple-tvos-sim" + ;; + x86_64_simulator) + echo "x86_64-apple-tvos" + ;; + *) + echo "$arch-apple-tvos" + ;; + esac + ;; + *) + case "$arch" in + arm64) + echo "aarch64-apple-ios" + ;; + arm64_simulator) + echo "aarch64-apple-ios-sim" + ;; + x86_64_simulator) + echo "x86_64-apple-ios" + ;; + *) + echo "$arch-apple-ios" + ;; + esac + ;; + esac +} + +rust_c_build() { + local manifest_path="$1" + local sub_dir="$2" + shift 2 + local extra_args="$@" + + if [[ -n "$sub_dir" && -d "${MR_BUILD_SOURCE}/${sub_dir}" ]]; then + cd "${MR_BUILD_SOURCE}/${sub_dir}" + fi + + local build_dir="${MR_BUILD_SOURCE}/${LIB_NAME}_build" + rm -rf "$build_dir" + mkdir -p "$build_dir" + cd "$build_dir" + + export CC="$MR_CC" + export CXX="$MR_CXX" + export CFLAGS="-fPIC $CFLAGS $MR_DEPLOYMENT_TARGET" + export CXXFLAGS="-fPIC $CXXFLAGS" + + local build_type="release" + if [[ "$MR_DEBUG" == "debug" ]]; then + build_type="debug" + fi + + local target + target=$(arch_target "$MR_ARCH" "$MR_PLAT") + + echo "----------------------" + echo "[*] compile $LIB_NAME" + echo "---------------------" + echo "CC: $MR_CC" + echo "CFLAGS: $CFLAGS" + echo "build_type: $build_type" + echo "prefix: $MR_BUILD_PREFIX" + echo "cargo target: $target" + echo "----------------------" + + + cargo cinstall \ + --manifest-path="$manifest_path" \ + --target="$target" \ + --prefix="$MR_BUILD_PREFIX" \ + --lib \ + --library-type=staticlib \ + --$build_type \ + --no-default-features \ + $extra_args +} diff --git a/tools/export-apple-host-env.sh b/tools/export-apple-host-env.sh index 692f54e59..6ce9dda2b 100644 --- a/tools/export-apple-host-env.sh +++ b/tools/export-apple-host-env.sh @@ -35,6 +35,18 @@ export DEBUG_INFORMATION_FORMAT=dwarf-with-dsym function install_depends() { local name="$1" + if [[ "$name" == "rustup" || "$name" == "cargo" ]]; then + local r=$(brew list | grep "$name") + if [[ -z $r ]]; then + echo "will install rustup-init." + brew install rustup-init + rustup-init -y + return 0 + else + echo "[✅] ${name}: $(eval $name --version)" + return 0 + fi + fi local r=$(brew list | grep "$name") if [[ -z $r ]]; then echo "will use brew install ${name}." From 290b7f62490d26725ed30c0a0b1a43fe0802e07f Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Thu, 26 Mar 2026 16:01:35 +0800 Subject: [PATCH 274/359] fix cmd test --- tools/export-apple-host-env.sh | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/tools/export-apple-host-env.sh b/tools/export-apple-host-env.sh index 6ce9dda2b..ff36c34c2 100644 --- a/tools/export-apple-host-env.sh +++ b/tools/export-apple-host-env.sh @@ -35,24 +35,20 @@ export DEBUG_INFORMATION_FORMAT=dwarf-with-dsym function install_depends() { local name="$1" - if [[ "$name" == "rustup" || "$name" == "cargo" ]]; then - local r=$(brew list | grep "$name") - if [[ -z $r ]]; then + if command -v "$name" &> /dev/null; then + echo "[✅] ${name}: $(eval $name --version)" + return 0 + else + if [[ "$name" == "rustup" || "$name" == "cargo" ]]; then echo "will install rustup-init." brew install rustup-init rustup-init -y - return 0 + return 0 else - echo "[✅] ${name}: $(eval $name --version)" - return 0 + echo "will use brew install ${name}." + brew install "$name" fi fi - local r=$(brew list | grep "$name") - if [[ -z $r ]]; then - echo "will use brew install ${name}." - brew install "$name" - fi - echo "[✅] ${name}: $(eval $name --version)" } # 定义跨平台sed函数 From 86babf913fc7cdb7767ad1f6a6f34180d84861eb Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Thu, 26 Mar 2026 17:48:38 +0800 Subject: [PATCH 275/359] install cargo-c --- .github/workflows/build all libs.yml | 2 ++ .github/workflows/build custom libs.yml | 2 ++ .github/workflows/build one lib.yml | 2 ++ .github/workflows/test.yml | 2 ++ 4 files changed, 8 insertions(+) diff --git a/.github/workflows/build all libs.yml b/.github/workflows/build all libs.yml index db8e194eb..9bc9fe020 100644 --- a/.github/workflows/build all libs.yml +++ b/.github/workflows/build all libs.yml @@ -96,6 +96,8 @@ jobs: local-cache: false - name: Checkout code uses: actions/checkout@v4 + - name: Install cargo-c + run: cargo install cargo-c - name: One Step run: | diff --git a/.github/workflows/build custom libs.yml b/.github/workflows/build custom libs.yml index 9ce108520..18575f2d2 100644 --- a/.github/workflows/build custom libs.yml +++ b/.github/workflows/build custom libs.yml @@ -65,6 +65,8 @@ jobs: local-cache: false - name: Checkout code uses: actions/checkout@v4 + - name: Install cargo-c + run: cargo install cargo-c - name: One Step run: | diff --git a/.github/workflows/build one lib.yml b/.github/workflows/build one lib.yml index 156763ce3..448aa9b63 100644 --- a/.github/workflows/build one lib.yml +++ b/.github/workflows/build one lib.yml @@ -99,6 +99,8 @@ jobs: local-cache: false - name: Checkout code uses: actions/checkout@v4 + - name: Install cargo-c + run: cargo install cargo-c - name: Install dependencies run: .github/workflows/install-dependencies.sh ${{ inputs.lib }} ${{ inputs.platform }} - name: One Step diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6e3de1b6b..8e38ad467 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,5 +16,7 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 + - name: Install cargo-c + run: cargo install cargo-c - name: One Step run: .github/workflows/onestep.sh test all \ No newline at end of file From 7b3e2f85dcf368b14ea5671e75bb246b90ab1bf7 Mon Sep 17 00:00:00 2001 From: Anka Date: Thu, 26 Mar 2026 09:55:46 +0000 Subject: [PATCH 276/359] upgrade dovi to dovi-3.3.2-260326175522 for macos by cd --- configs/libs/dovi.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/libs/dovi.sh b/configs/libs/dovi.sh index 2d9671a12..1d0710e6a 100644 --- a/configs/libs/dovi.sh +++ b/configs/libs/dovi.sh @@ -28,4 +28,4 @@ if [[ "$GIT_DOVI_UPSTREAM" != "" ]] ;then export GIT_UPSTREAM="$GIT_DOVI_UPSTREAM" else export GIT_UPSTREAM=https://github.com/quietvoid/dovi_tool.git -fi \ No newline at end of file +fiexport PRE_COMPILE_TAG_MACOS=dovi-3.3.2-260326175522 From c4b7faaca12398669d21ad99bdd91a5db926c0df Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Thu, 26 Mar 2026 17:57:50 +0800 Subject: [PATCH 277/359] install cargo-c only build dovi --- .github/workflows/build custom libs.yml | 1 + .github/workflows/build one lib.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/build custom libs.yml b/.github/workflows/build custom libs.yml index 18575f2d2..367d0ef92 100644 --- a/.github/workflows/build custom libs.yml +++ b/.github/workflows/build custom libs.yml @@ -66,6 +66,7 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - name: Install cargo-c + if: contains(inputs.libraries, 'dovi') run: cargo install cargo-c - name: One Step run: | diff --git a/.github/workflows/build one lib.yml b/.github/workflows/build one lib.yml index 448aa9b63..e9dde5d5d 100644 --- a/.github/workflows/build one lib.yml +++ b/.github/workflows/build one lib.yml @@ -100,6 +100,7 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - name: Install cargo-c + if: inputs.lib == 'dovi' run: cargo install cargo-c - name: Install dependencies run: .github/workflows/install-dependencies.sh ${{ inputs.lib }} ${{ inputs.platform }} From c811fc7950e105c17838287cc010ab0534439666 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Thu, 26 Mar 2026 18:44:03 +0800 Subject: [PATCH 278/359] fix replace_tag bug --- .github/workflows/onestep.sh | 3 ++- configs/libs/dovi.sh | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/onestep.sh b/.github/workflows/onestep.sh index 5984764ec..2a5cf1f25 100755 --- a/.github/workflows/onestep.sh +++ b/.github/workflows/onestep.sh @@ -139,7 +139,8 @@ function replace_tag() sed -i "" "s/^export $key=.*/export $key=$TAG/" $file else # PRE_COMPILE_TAG_IOS not found, append PRE_COMPILE_TAG_IOS - echo "export $key=$TAG" >> $file + [ -n "$(tail -c1 "$file")" ] && echo "" >> "$file" + echo "export $key=$TAG" >> "$file" fi } diff --git a/configs/libs/dovi.sh b/configs/libs/dovi.sh index 1d0710e6a..56aff043d 100644 --- a/configs/libs/dovi.sh +++ b/configs/libs/dovi.sh @@ -28,4 +28,6 @@ if [[ "$GIT_DOVI_UPSTREAM" != "" ]] ;then export GIT_UPSTREAM="$GIT_DOVI_UPSTREAM" else export GIT_UPSTREAM=https://github.com/quietvoid/dovi_tool.git -fiexport PRE_COMPILE_TAG_MACOS=dovi-3.3.2-260326175522 +fi + +export PRE_COMPILE_TAG_MACOS=dovi-3.3.2-260326175522 \ No newline at end of file From f633b80df18b740a2c002dc9696e5bd5a90d00db Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Fri, 27 Mar 2026 17:55:20 +0800 Subject: [PATCH 279/359] fix moltenvk build --- configs/libs/shaderc.sh | 2 +- do-compile/apple/moltenvk.sh | 52 ++++++++++++++++++++++++++++++---- do-compile/apple/placebo.sh | 28 ++++++++++++------ do-compile/apple/shaderc.sh | 7 +++++ tools/export-apple-host-env.sh | 16 ++++++++--- 5 files changed, 86 insertions(+), 19 deletions(-) diff --git a/configs/libs/shaderc.sh b/configs/libs/shaderc.sh index d5d6b46f1..096343b50 100644 --- a/configs/libs/shaderc.sh +++ b/configs/libs/shaderc.sh @@ -16,7 +16,7 @@ # export LIB_NAME='shaderc' -export LIPO_LIBS="libshaderc libshaderc_combined" +export LIPO_LIBS="libshaderc_combined" export LIB_DEPENDS_BIN="cmake" export GIT_LOCAL_REPO=extra/shaderc export GIT_COMMIT=v2025.3 diff --git a/do-compile/apple/moltenvk.sh b/do-compile/apple/moltenvk.sh index 8acfd2603..7c53b8001 100755 --- a/do-compile/apple/moltenvk.sh +++ b/do-compile/apple/moltenvk.sh @@ -16,6 +16,7 @@ # set -e +set -o pipefail THIS_DIR=$(DIRNAME=$(dirname "$0"); cd "$DIRNAME"; pwd) cd "$THIS_DIR" @@ -74,7 +75,7 @@ echo "[*] fetch dependencies for $LIB_NAME" echo "----------------------" cd $MR_BUILD_SOURCE -if [ -d "External" ]; then +if [ -d "External/build" ]; then echo "dependencies already exist" else if [ -f "./fetchDependencies" ]; then @@ -105,11 +106,8 @@ xcodebuild -project "$MR_BUILD_SOURCE/MoltenVKPackaging.xcodeproj" \ -scheme "MoltenVK Package ($scheme_suffix)" \ -destination "generic/platform=$dest" \ -configuration Release \ - -parallelizeTargets \ - ONLY_ACTIVE_ARCH=YES \ - ARCHS="$arch_param" \ CODE_SIGNING_ALLOWED=NO \ - build || true + build pkg_static_dir="$MR_BUILD_SOURCE/Package/Release/MoltenVK/static" if [[ -d "$pkg_static_dir/MoltenVK.xcframework" ]]; then @@ -143,3 +141,47 @@ if [[ -d "$vk_video_headers" ]]; then cp -RL "$vk_video_headers"/* "$MR_BUILD_PREFIX/include/vk_video/" echo "Copied vk_video headers to $MR_BUILD_PREFIX/include/vk_video/" fi + +echo "----------------------" +echo "[*] generate pkg-config files" +echo "----------------------" + +mkdir -p "$MR_BUILD_PREFIX/lib/pkgconfig" + +MOLTENVK_MAJOR=$(grep "MVK_VERSION_MAJOR" "$MR_BUILD_PREFIX/include/MoltenVK/mvk_private_api.h" | grep -oE "[0-9]+" | head -1) +MOLTENVK_MINOR=$(grep "MVK_VERSION_MINOR" "$MR_BUILD_PREFIX/include/MoltenVK/mvk_private_api.h" | grep -oE "[0-9]+" | head -1) +MOLTENVK_PATCH=$(grep "MVK_VERSION_PATCH" "$MR_BUILD_PREFIX/include/MoltenVK/mvk_private_api.h" | grep -oE "[0-9]+" | head -1) +MOLTENVK_VERSION="${MOLTENVK_MAJOR}.${MOLTENVK_MINOR}.${MOLTENVK_PATCH}" + +VULKAN_VERSION="1.3.250" + +cat > "$MR_BUILD_PREFIX/lib/pkgconfig/vulkan.pc" << EOF +prefix=${MR_BUILD_PREFIX} +exec_prefix=\${prefix} +libdir=\${exec_prefix}/lib +includedir=\${prefix}/include + +Name: Vulkan +Description: Vulkan loader (MoltenVK) +Version: ${VULKAN_VERSION} +Libs: -L\${libdir} -lMoltenVK +Libs.private: -framework Metal -framework Foundation -framework QuartzCore -framework IOKit -framework IOSurface -lc++ +Cflags: -I\${includedir} -I\${includedir}/vulkan +EOF + +cat > "$MR_BUILD_PREFIX/lib/pkgconfig/moltenvk.pc" << EOF +prefix=${MR_BUILD_PREFIX} +exec_prefix=\${prefix} +libdir=\${exec_prefix}/lib +includedir=\${prefix}/include + +Name: MoltenVK +Description: Vulkan implementation on Metal for macOS and iOS +Version: ${MOLTENVK_VERSION} +Libs: -L\${libdir} -lMoltenVK +Libs.private: -framework Metal -framework Foundation -framework QuartzCore -framework IOKit -framework IOSurface -lc++ +Cflags: -I\${includedir} -I\${includedir}/vulkan -I\${includedir}/MoltenVK +Requires: vulkan +EOF + +echo "Generated vulkan.pc (${VULKAN_VERSION}) and moltenvk.pc (${MOLTENVK_VERSION})" diff --git a/do-compile/apple/placebo.sh b/do-compile/apple/placebo.sh index 64385c9cc..bb65d8303 100755 --- a/do-compile/apple/placebo.sh +++ b/do-compile/apple/placebo.sh @@ -33,6 +33,10 @@ sed -i '' 's/registry = VkXML(ET.parse(xmlfile))/registry = VkXML(ET.parse(xmlfi cd "$THIS_DIR" +BUILD_DIR="${MR_BUILD_SOURCE}/meson_build" +rm -rf "$BUILD_DIR" +mkdir -p "$BUILD_DIR" + echo "----------------------" echo "[*] configure $LIB_NAME" echo "----------------------" @@ -42,7 +46,6 @@ echo "----------------------" # Use shaderc for SPIRV compilation # Find lcms2 and shaderc from our build -PKG_CONFIG_PATH="${MR_BUILD_PREFIX}/lib/pkgconfig:$PKG_CONFIG_PATH" # Set deployment target for macOS export MACOSX_DEPLOYMENT_TARGET=11.0 @@ -61,25 +64,32 @@ MESON_OPTS="--buildtype=release \ -Ddemos=false \ -Dxxhash=disabled" -build="${MR_BUILD_SOURCE}/meson_build" -rm -rf "$build" -mkdir -p "$build" -cd "$build" # Set up environment for MoltenVK export VK_ICD_FILENAMES="${MR_BUILD_PREFIX}/share/vulkan/icd.d/MoltenVK_icd.json" # Disable assertions to fix Xcode SDK compatibility issue -export CFLAGS="-U_LIBCPP_ENABLE_ASSERTIONS" -export CXXFLAGS="-U_LIBCPP_ENABLE_ASSERTIONS" +# IMPORTANT: Preserve original CFLAGS which contains -arch parameter +export CFLAGS="${MR_DEFAULT_CFLAGS} -U_LIBCPP_ENABLE_ASSERTIONS" +export CXXFLAGS="${MR_DEFAULT_CFLAGS} -U_LIBCPP_ENABLE_ASSERTIONS" + +# Add shaderc and MoltenVK pkgconfig paths +# SHADERC_PC_PATH="${MR_UNI_PROD_DIR}/shaderc/lib/pkgconfig" +# MOLTENVK_PC_PATH="${MR_UNI_PROD_DIR}/MoltenVK/lib/pkgconfig" +# export PKG_CONFIG_PATH="${SHADERC_PC_PATH}:${MOLTENVK_PC_PATH}:${PKG_CONFIG_PATH}" -meson setup . ${MR_BUILD_SOURCE} ${MESON_OPTS} +# # Configure with explicit PKG_CONFIG_LIBDIR to avoid system dependencies +# PKG_CONFIG_LIBDIR="${SHADERC_PC_PATH}:${MOLTENVK_PC_PATH}:$PKG_CONFIG_LIBDIR" \ +# PKG_CONFIG_ALLOW_SYSTEM_LIBS=0 \ +meson setup ${BUILD_DIR} ${MR_BUILD_SOURCE} ${MESON_OPTS} echo "----------------------" echo "[*] compile $LIB_NAME" echo "----------------------" -ninja +cd "$BUILD_DIR" + +meson compile echo "----------------------" echo "[*] install $LIB_NAME" diff --git a/do-compile/apple/shaderc.sh b/do-compile/apple/shaderc.sh index 59589e696..2257fb34e 100755 --- a/do-compile/apple/shaderc.sh +++ b/do-compile/apple/shaderc.sh @@ -73,6 +73,7 @@ mkdir -p "$build" cd "$build" cmake -S ${MR_BUILD_SOURCE} \ + -DCMAKE_PREFIX_PATH=${PKG_CONFIG_LIBDIR} \ -DCMAKE_INSTALL_PREFIX=${MR_BUILD_PREFIX} \ -DCMAKE_TOOLCHAIN_FILE="${MR_SHELL_TOOLS_DIR}/ios.toolchain.cmake" \ -DPLATFORM=$pf \ @@ -94,3 +95,9 @@ echo "[*] install $LIB_NAME" echo "----------------------" cmake --install . + +# clean up pkgconfig files +rm -f ${MR_BUILD_PREFIX}/lib/pkgconfig/SPIRV-Tools-shared.pc +rm -f ${MR_BUILD_PREFIX}/lib/pkgconfig/SPIRV-Tools.pc +rm -f ${MR_BUILD_PREFIX}/lib/pkgconfig/shaderc.pc +rm -f ${MR_BUILD_PREFIX}/lib/pkgconfig/shaderc_static.pc \ No newline at end of file diff --git a/tools/export-apple-host-env.sh b/tools/export-apple-host-env.sh index ff36c34c2..7fdf0fef9 100644 --- a/tools/export-apple-host-env.sh +++ b/tools/export-apple-host-env.sh @@ -19,12 +19,20 @@ if [[ "$MR_PLAT" != 'macos' ]]; then export MR_FORCE_CROSS=true fi -if [[ "$MR_PLAT" == 'ios' ]]; then - export MR_DEFAULT_ARCHS="arm64 arm64_simulator x86_64_simulator" +if [[ "$MR_VENDOR_LIBS" == *"moltenvk"* || "$MR_VENDOR_LIBS" == "moltenvk" ]]; then + if [[ "$MR_PLAT" == 'macos' ]]; then + export MR_DEFAULT_ARCHS="arm64" + elif [[ "$MR_PLAT" == 'ios' || "$MR_PLAT" == 'tvos' ]]; then + export MR_DEFAULT_ARCHS="arm64 arm64_simulator" + fi +else + if [[ "$MR_PLAT" == 'ios' ]]; then + export MR_DEFAULT_ARCHS="arm64 arm64_simulator x86_64_simulator" elif [[ "$MR_PLAT" == 'macos' ]]; then - export MR_DEFAULT_ARCHS="x86_64 arm64" + export MR_DEFAULT_ARCHS="x86_64 arm64" elif [[ "$MR_PLAT" == 'tvos' ]]; then - export MR_DEFAULT_ARCHS="arm64 arm64_simulator x86_64_simulator" + export MR_DEFAULT_ARCHS="arm64 arm64_simulator x86_64_simulator" + fi fi # Number of physical cores in the system to facilitate parallel assembling From f7a7544f2bf96edd0b5772a24da9713858aa1e5c Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Fri, 27 Mar 2026 18:01:32 +0800 Subject: [PATCH 280/359] clean for placebo.sh --- do-compile/apple/placebo.sh | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/do-compile/apple/placebo.sh b/do-compile/apple/placebo.sh index bb65d8303..efabebfb0 100755 --- a/do-compile/apple/placebo.sh +++ b/do-compile/apple/placebo.sh @@ -73,14 +73,6 @@ export VK_ICD_FILENAMES="${MR_BUILD_PREFIX}/share/vulkan/icd.d/MoltenVK_icd.json export CFLAGS="${MR_DEFAULT_CFLAGS} -U_LIBCPP_ENABLE_ASSERTIONS" export CXXFLAGS="${MR_DEFAULT_CFLAGS} -U_LIBCPP_ENABLE_ASSERTIONS" -# Add shaderc and MoltenVK pkgconfig paths -# SHADERC_PC_PATH="${MR_UNI_PROD_DIR}/shaderc/lib/pkgconfig" -# MOLTENVK_PC_PATH="${MR_UNI_PROD_DIR}/MoltenVK/lib/pkgconfig" -# export PKG_CONFIG_PATH="${SHADERC_PC_PATH}:${MOLTENVK_PC_PATH}:${PKG_CONFIG_PATH}" - -# # Configure with explicit PKG_CONFIG_LIBDIR to avoid system dependencies -# PKG_CONFIG_LIBDIR="${SHADERC_PC_PATH}:${MOLTENVK_PC_PATH}:$PKG_CONFIG_LIBDIR" \ -# PKG_CONFIG_ALLOW_SYSTEM_LIBS=0 \ meson setup ${BUILD_DIR} ${MR_BUILD_SOURCE} ${MESON_OPTS} echo "----------------------" @@ -95,4 +87,4 @@ echo "----------------------" echo "[*] install $LIB_NAME" echo "----------------------" -meson install +meson install \ No newline at end of file From db526ff8c942aee8be432766924d528c927b5d8b Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Fri, 27 Mar 2026 18:04:05 +0800 Subject: [PATCH 281/359] review code --- .github/workflows/install-dependencies.sh | 24 ++++++----------------- 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/.github/workflows/install-dependencies.sh b/.github/workflows/install-dependencies.sh index adebf0408..d0d52bdbc 100755 --- a/.github/workflows/install-dependencies.sh +++ b/.github/workflows/install-dependencies.sh @@ -193,25 +193,13 @@ case $LIB_NAME in ;; placebo) if [[ $PLAT == all ]];then - ./main.sh install -l 'lcms2' -p ios - ./main.sh install -l 'lcms2' -p tvos - ./main.sh install -l 'lcms2' -p macos - ./main.sh install -l 'shaderc' -p ios - ./main.sh install -l 'shaderc' -p tvos - ./main.sh install -l 'shaderc' -p macos - ./main.sh install -l 'moltenvk' -p ios - ./main.sh install -l 'moltenvk' -p tvos - ./main.sh install -l 'moltenvk' -p macos + ./main.sh install -l 'lcms2 shaderc moltenvk' -p ios + ./main.sh install -l 'lcms2 shaderc moltenvk' -p tvos + ./main.sh install -l 'lcms2 shaderc moltenvk' -p macos elif [[ $PLAT == apple ]];then - ./main.sh install -l 'lcms2' -p ios - ./main.sh install -l 'lcms2' -p tvos - ./main.sh install -l 'lcms2' -p macos - ./main.sh install -l 'shaderc' -p ios - ./main.sh install -l 'shaderc' -p tvos - ./main.sh install -l 'shaderc' -p macos - ./main.sh install -l 'moltenvk' -p ios - ./main.sh install -l 'moltenvk' -p tvos - ./main.sh install -l 'moltenvk' -p macos + ./main.sh install -l 'lcms2 shaderc moltenvk' -p ios + ./main.sh install -l 'lcms2 shaderc moltenvk' -p tvos + ./main.sh install -l 'lcms2 shaderc moltenvk' -p macos else ./main.sh install -l 'lcms2 shaderc moltenvk' -p $PLAT fi From b3059478c4e9d45c0546e5e24e5db0ba9f8ab9cd Mon Sep 17 00:00:00 2001 From: Anka Date: Fri, 27 Mar 2026 10:05:24 +0000 Subject: [PATCH 282/359] upgrade moltenvk to moltenvk-v1.4.1-260327175726 for macos by cd --- configs/libs/moltenvk.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/libs/moltenvk.sh b/configs/libs/moltenvk.sh index 9b659c700..b3cbd986a 100644 --- a/configs/libs/moltenvk.sh +++ b/configs/libs/moltenvk.sh @@ -32,6 +32,6 @@ fi # pre compiled export PRE_COMPILE_TAG_TVOS= -export PRE_COMPILE_TAG_MACOS=moltenvk-v1.4.1-260325103801 +export PRE_COMPILE_TAG_MACOS=moltenvk-v1.4.1-260327175726 export PRE_COMPILE_TAG_IOS= export PRE_COMPILE_TAG_ANDROID= From ee9cbe29bce1357ecb333c8552904ec8f251f253 Mon Sep 17 00:00:00 2001 From: Anka Date: Fri, 27 Mar 2026 10:27:00 +0000 Subject: [PATCH 283/359] upgrade shaderc to shaderc-v2025.3-260327181828 for macos by cd --- configs/libs/shaderc.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/libs/shaderc.sh b/configs/libs/shaderc.sh index 096343b50..aad17d71a 100644 --- a/configs/libs/shaderc.sh +++ b/configs/libs/shaderc.sh @@ -32,4 +32,4 @@ if [[ "$GIT_SHADERC_UPSTREAM" != "" ]] ;then else export GIT_UPSTREAM=https://github.com/google/shaderc.git fi -export PRE_COMPILE_TAG_MACOS=shaderc-v2025.3-260325150610 +export PRE_COMPILE_TAG_MACOS=shaderc-v2025.3-260327181828 From 68e2938c369c1841e356bb10d65e9acccc3a3b2b Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Fri, 27 Mar 2026 18:29:25 +0800 Subject: [PATCH 284/359] error: 'absolute' is unavailable: introduced in iOS 13.0 --- do-compile/apple/shaderc.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/do-compile/apple/shaderc.sh b/do-compile/apple/shaderc.sh index 2257fb34e..51ebf7d9e 100755 --- a/do-compile/apple/shaderc.sh +++ b/do-compile/apple/shaderc.sh @@ -45,6 +45,7 @@ if [[ "$MR_PLAT" == 'ios' ]];then else pf='OS64' fi + export MR_DEPLOYMENT_TARGET_VER=13.0 elif [[ "$MR_PLAT" == 'tvos' ]];then if [[ $_MR_ARCH == 'arm64_simulator' ]];then pf='SIMULATORARM64_TVOS' From d1e06cc0d351e5798e82a48ee48812f6500565a9 Mon Sep 17 00:00:00 2001 From: Anka Date: Fri, 27 Mar 2026 10:30:46 +0000 Subject: [PATCH 285/359] upgrade placebo to placebo-v7.349.0-260327182948 for macos by cd --- configs/libs/placebo.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/libs/placebo.sh b/configs/libs/placebo.sh index 6ab4bc103..33745c939 100644 --- a/configs/libs/placebo.sh +++ b/configs/libs/placebo.sh @@ -31,3 +31,4 @@ if [[ "$GIT_LIBPLACEB0_UPSTREAM" != "" ]] ;then else export GIT_UPSTREAM=https://github.com/haasn/libplacebo.git fi +export PRE_COMPILE_TAG_MACOS=placebo-v7.349.0-260327182948 From ff36ddea55e8f24a8ec86fec4a493b06bd472ca4 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Fri, 27 Mar 2026 19:01:25 +0800 Subject: [PATCH 286/359] error: 'absolute' is unavailable: introduced in tvOS 13.0 --- do-compile/apple/shaderc.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/do-compile/apple/shaderc.sh b/do-compile/apple/shaderc.sh index 51ebf7d9e..8bce6c6c6 100755 --- a/do-compile/apple/shaderc.sh +++ b/do-compile/apple/shaderc.sh @@ -54,6 +54,7 @@ elif [[ "$MR_PLAT" == 'tvos' ]];then else pf='TVOS' fi + export MR_DEPLOYMENT_TARGET_VER=13.0 elif [[ "$MR_PLAT" == 'macos' ]];then if [[ $_MR_ARCH == 'arm64' ]];then pf='MAC_ARM64' From 8eb40e5e84b6d08e0bf0d072c6a3fc9fa0d8de8f Mon Sep 17 00:00:00 2001 From: Anka Date: Mon, 30 Mar 2026 10:19:59 +0000 Subject: [PATCH 287/359] upgrade placebo to placebo-v7.349.0-260330181842 for macos by cd --- configs/libs/placebo.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/libs/placebo.sh b/configs/libs/placebo.sh index 33745c939..c2adac911 100644 --- a/configs/libs/placebo.sh +++ b/configs/libs/placebo.sh @@ -31,4 +31,4 @@ if [[ "$GIT_LIBPLACEB0_UPSTREAM" != "" ]] ;then else export GIT_UPSTREAM=https://github.com/haasn/libplacebo.git fi -export PRE_COMPILE_TAG_MACOS=placebo-v7.349.0-260327182948 +export PRE_COMPILE_TAG_MACOS=placebo-v7.349.0-260330181842 From 0518e01283d492b985795c5e4ec10a38d1a10bad Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Mon, 30 Mar 2026 18:16:18 +0800 Subject: [PATCH 288/359] placebo add dependency --- .github/workflows/install-dependencies.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/install-dependencies.sh b/.github/workflows/install-dependencies.sh index d0d52bdbc..06ffd7580 100755 --- a/.github/workflows/install-dependencies.sh +++ b/.github/workflows/install-dependencies.sh @@ -193,15 +193,15 @@ case $LIB_NAME in ;; placebo) if [[ $PLAT == all ]];then - ./main.sh install -l 'lcms2 shaderc moltenvk' -p ios - ./main.sh install -l 'lcms2 shaderc moltenvk' -p tvos - ./main.sh install -l 'lcms2 shaderc moltenvk' -p macos + ./main.sh install -l 'lcms2 shaderc moltenvk dovi' -p ios + ./main.sh install -l 'lcms2 shaderc moltenvk dovi' -p tvos + ./main.sh install -l 'lcms2 shaderc moltenvk dovi' -p macos elif [[ $PLAT == apple ]];then - ./main.sh install -l 'lcms2 shaderc moltenvk' -p ios - ./main.sh install -l 'lcms2 shaderc moltenvk' -p tvos - ./main.sh install -l 'lcms2 shaderc moltenvk' -p macos + ./main.sh install -l 'lcms2 shaderc moltenvk dovi' -p ios + ./main.sh install -l 'lcms2 shaderc moltenvk dovi' -p tvos + ./main.sh install -l 'lcms2 shaderc moltenvk dovi' -p macos else - ./main.sh install -l 'lcms2 shaderc moltenvk' -p $PLAT + ./main.sh install -l 'lcms2 shaderc moltenvk dovi' -p $PLAT fi ;; *) From 2a84bd6e9d7058aa853128c932afa3f38559cfa4 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Mon, 30 Mar 2026 18:28:44 +0800 Subject: [PATCH 289/359] update README --- README.md | 12 +++++++++--- README_zh-CN.md | 12 +++++++++--- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 1d6cd784a..7a91f358a 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ MRFFToolChain is a mature set of compilation tools specifically designed for compiling third-party libraries for iOS, macOS, tvOS, and Android platforms. It's products was built for [fsplayer](https://github.com/debugly/fsplayer) 、[ijkplayer](https://github.com/debugly/ijkplayer) 、[FFmpegTutorial](https://github.com/debugly/FFmpegTutorial). -At present MRFFToolChain contained `ass、bluray、dav1d、dvdread、dvdnav、ffmpeg、freetype、fribidi、harfbuzz、openssl、opus、unibreak、uavs3d、smb2、yuv、soundtouch、xml2、webp`. +At present MRFFToolChain contained `ass、bluray、dav1d、dovi、dvdread、dvdnav、ffmpeg、freetype、fribidi、harfbuzz、lcms2、placebo、moltenvk、openssl、opus、shaderc、smb2、soundtouch、unibreak、uavs3d、xml2、yuv、webp`. ## Supported Plat @@ -28,7 +28,8 @@ At present MRFFToolChain contained `ass、bluray、dav1d、dvdread、dvdnav、ff - Fontconfig: xml2,freetype - Bluray: xml2 - Harfbuzz: freetype -- dvdnav: dvdread +- Dvdnav: dvdread +- Placebo for Appple: shaderc,moltenvk,dovi,lcms2 - Ass for Appple: harfbuzz,fribidi,unibreak - Ass for Android: harfbuzz,fribidi,unibreak,fontconfig - IJKFFmpeg: openssl @@ -39,7 +40,7 @@ At present MRFFToolChain contained `ass、bluray、dav1d、dvdread、dvdnav、ff - FFmpeg4 for Android: openssl3,opus,bluray,soundtouch - FFmpeg5 for Android: openssl3,opus,bluray,dav1d,dvdread,uavs3d,soundtouch - FFmpeg6 for Android: openssl3,opus,bluray,dav1d,dvdread,uavs3d,smb2,soundtouch -- FFmpeg7 for Android: openssl3,opus,bluray,dav1d,dvdnav,uavs3d,smb2,soundtouch +- FFmpeg7 for Android: openssl3,opus,bluray,dav1d,dvdnav,uavs3d,smb2,soundtouch,libplacebo,shaderc,moltenvk,dovi,lcms2 Tips: @@ -143,6 +144,11 @@ If cloning repositories from GitHub is slow, or if you need to use an internal p | xml2 | 2.15.1 | https://github.com/GNOME/libxml2.git | export GIT_FONTCONFIG_UPSTREAM=git@xx:yy/fontconfig.git | | yuv | main-f94b8cf7 | https://github.com/debugly/libyuv.git | export GIT_YUV_UPSTREAM=git@xx:yy/yuv.git | | webp | v1.6.0 | https://github.com/debugly/libwebp.git | export GIT_WEBP_UPSTREAM=git@xx:yy/webp.git | +| placebo | 7.349.0 | https://github.com/haasn/libplacebo.git | export GIT_LIBPLACEBO_UPSTREAM=git@xx:yy/libplacebo.git | +| shaderc | 2025.1 | https://github.com/google/shaderc.git | export GIT_SHADERC_UPSTREAM=git@xx:yy/shaderc.git | +| moltenvk | 1.3.1 | https://github.com/KhronosGroup/MoltenVK.git | export GIT_MOLTENVK_UPSTREAM=git@xx:yy/MoltenVK.git | +| lcms2 | 2.16 | https://github.com/mm2/Little-CMS.git | export GIT_LCMS2_UPSTREAM=git@xx:yy/Little-CMS.git | +| dovi | 1.6.79 | https://github.com/AMDEXA/libdovi.git | export GIT_DOVI_UPSTREAM=git@xx:yy/libdovi.git | ## Tips diff --git a/README_zh-CN.md b/README_zh-CN.md index 513383e24..b24409b83 100644 --- a/README_zh-CN.md +++ b/README_zh-CN.md @@ -6,7 +6,7 @@ MRFFToolChain 是一套成熟的编译工具,专门用来编译 iOS、macOS、tvOS、Android 平台的三方库,其构建产物为 [fsplayer](https://github.com/debugly/fsplayer) 、 [ijkplayer](https://github.com/debugly/ijkplayer) 、[FFmpegTutorial](https://github.com/debugly/FFmpegTutorial) 所用. -目前包含了这些库:`ass、bluray、dav1d、dvdread、dvdnav、ffmpeg、freetype、fribidi、harfbuzz、openssl、opus、unibreak、uavs3d、smb2、yuv、soundtouch、xml2、webp`. +目前包含了这些库:`ass、bluray、dav1d、dovi、dvdread、dvdnav、ffmpeg、freetype、fribidi、harfbuzz、lcms2、placebo、moltenvk、openssl、opus、shaderc、smb2、soundtouch、unibreak、uavs3d、xml2、yuv、webp`. ## 支持的平台 @@ -32,16 +32,17 @@ MRFFToolChain 是一套成熟的编译工具,专门用来编译 iOS、macOS、 - Harfbuzz:freetype - dvdnav:dvdread - 适用于 ijkplayer 的 FFmpeg: openssl +- 适用于苹果的 Placebo: shaderc,moltenvk,dovi,lcms2 - 适用于苹果的 Ass:harfbuzz、fribidi、unibreak - 适用于安卓的 Ass:harfbuzz、fribidi、unibreak、fontconfig - 适用于苹果的 FFmpeg4:openssl3、opus、bluray - 适用于苹果的 FFmpeg5:openssl3、opus、bluray、dav1d、dvdread、uavs3d - 适用于苹果的 FFmpeg6:openssl3、opus、bluray、dav1d、dvdread、uavs3d、smb2 -- 适用于苹果的 FFmpeg7:openssl3、opus、bluray、dav1d、dvdnav、uavs3d、smb2、webp +- 适用于苹果的 FFmpeg7:openssl3、opus、bluray、dav1d、dvdnav、uavs3d、smb2、webp、libplacebo、shaderc、moltenvk、dovi、lcms2 - 适用于安卓的 FFmpeg4:openssl3、opus、bluray、soundtouch - 适用于安卓的 FFmpeg5:openssl3、opus、bluray、dav1d、dvdread、uavs3d、soundtouch - 适用于安卓的 FFmpeg6:openssl3、opus、bluray、dav1d、dvdread、uavs3d、smb2、soundtouch -- 适用于安卓的 FFmpeg7:openssl3、opus、bluray、dav1d、dvdnav、uavs3d、smb2、soundtouch +- 适用于安卓的 FFmpeg7:openssl3、opus、bluray、dav1d、dvdnav、uavs3d、smb2、soundtouch、libplacebo、shaderc、moltenvk、dovi、lcms2 提示: @@ -145,6 +146,11 @@ MRFFToolChain 是一套成熟的编译工具,专门用来编译 iOS、macOS、 | xml2 | 2.15.1 | https://github.com/GNOME/libxml2.git | export GIT_FONTCONFIG_UPSTREAM=git@xx:yy/fontconfig.git | | yuv | main-f94b8cf7 | https://github.com/debugly/libyuv.git | export GIT_YUV_UPSTREAM=git@xx:yy/yuv.git | | webp | v1.6.0 | https://github.com/debugly/libwebp.git | export GIT_WEBP_UPSTREAM=git@xx:yy/webp.git | +| placebo | 7.349.0 | https://github.com/haasn/libplacebo.git | export GIT_LIBPLACEBO_UPSTREAM=git@xx:yy/libplacebo.git | +| shaderc | 2025.1 | https://github.com/google/shaderc.git | export GIT_SHADERC_UPSTREAM=git@xx:yy/shaderc.git | +| moltenvk | 1.3.1 | https://github.com/KhronosGroup/MoltenVK.git | export GIT_MOLTENVK_UPSTREAM=git@xx:yy/MoltenVK.git | +| lcms2 | 2.16 | https://github.com/mm2/Little-CMS.git | export GIT_LCMS2_UPSTREAM=git@xx:yy/Little-CMS.git | +| dovi | 1.6.79 | https://github.com/AMDEXA/libdovi.git | export GIT_DOVI_UPSTREAM=git@xx:yy/libdovi.git | ## 提示 From 1d20fc31a61c2370bb1cab6241092034d92871c2 Mon Sep 17 00:00:00 2001 From: Anka Date: Mon, 30 Mar 2026 10:31:55 +0000 Subject: [PATCH 290/359] upgrade placebo to placebo-v7.349.0-260330183040 for macos by cd --- configs/libs/placebo.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/libs/placebo.sh b/configs/libs/placebo.sh index c2adac911..965ebff95 100644 --- a/configs/libs/placebo.sh +++ b/configs/libs/placebo.sh @@ -31,4 +31,4 @@ if [[ "$GIT_LIBPLACEB0_UPSTREAM" != "" ]] ;then else export GIT_UPSTREAM=https://github.com/haasn/libplacebo.git fi -export PRE_COMPILE_TAG_MACOS=placebo-v7.349.0-260330181842 +export PRE_COMPILE_TAG_MACOS=placebo-v7.349.0-260330183040 From 1dcea31dacac938aa3be649331026734c811fb33 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Thu, 2 Apr 2026 14:37:47 +0800 Subject: [PATCH 291/359] enable crypto protocol --- configs/ijk-ffmpeg-config/module-lite.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/configs/ijk-ffmpeg-config/module-lite.sh b/configs/ijk-ffmpeg-config/module-lite.sh index df340a811..82556ab57 100755 --- a/configs/ijk-ffmpeg-config/module-lite.sh +++ b/configs/ijk-ffmpeg-config/module-lite.sh @@ -79,7 +79,8 @@ export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-decoder=flac" export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-decoder=hevc" export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-decoder=vp8" export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-decoder=vp9" - +#117 +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-decoder=pcm_s16le --enable-decoder=pcm_s16be --enable-decoder=pcm_u16le --enable-decoder=pcm_u16be --enable-decoder=pcm_alaw --enable-decoder=pcm_mulaw" export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-hwaccels" # ./configure --list-muxers @@ -136,7 +137,7 @@ export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-protocols" export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-protocol=async" export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-protocol=bluray" export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-protocol=concat" -export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-protocol=crypto" +export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-protocol=crypto" export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-protocol=ffrtmpcrypt" export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-protocol=ffrtmphttp" export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-protocol=gopher" From bb127a2c8d534a6337e683ad1e1a55beb9c3ed7c Mon Sep 17 00:00:00 2001 From: Anka Date: Thu, 2 Apr 2026 06:45:11 +0000 Subject: [PATCH 292/359] upgrade ijkffmpeg to ijkffmpeg-4.0-260402143959 for android by cd --- configs/libs/ijkffmpeg.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/libs/ijkffmpeg.sh b/configs/libs/ijkffmpeg.sh index 574433383..1e86d0eef 100644 --- a/configs/libs/ijkffmpeg.sh +++ b/configs/libs/ijkffmpeg.sh @@ -40,7 +40,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_ANDROID=ijkffmpeg-4.0-260228145716 +export PRE_COMPILE_TAG_ANDROID=ijkffmpeg-4.0-260402143959 export PRE_COMPILE_TAG_TVOS=ijkffmpeg-4.0-260228145716 export PRE_COMPILE_TAG_MACOS=ijkffmpeg-4.0-260228145716 export PRE_COMPILE_TAG_IOS=ijkffmpeg-4.0-260228145716 From b7847f3b362f605085e38a0169f870bf98d0845f Mon Sep 17 00:00:00 2001 From: Anka Date: Thu, 2 Apr 2026 06:55:30 +0000 Subject: [PATCH 293/359] upgrade ijkffmpeg to ijkffmpeg-4.0-260402145042 for ios by cd --- configs/libs/ijkffmpeg.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/libs/ijkffmpeg.sh b/configs/libs/ijkffmpeg.sh index 1e86d0eef..d1a3e258b 100644 --- a/configs/libs/ijkffmpeg.sh +++ b/configs/libs/ijkffmpeg.sh @@ -43,5 +43,5 @@ fi export PRE_COMPILE_TAG_ANDROID=ijkffmpeg-4.0-260402143959 export PRE_COMPILE_TAG_TVOS=ijkffmpeg-4.0-260228145716 export PRE_COMPILE_TAG_MACOS=ijkffmpeg-4.0-260228145716 -export PRE_COMPILE_TAG_IOS=ijkffmpeg-4.0-260228145716 +export PRE_COMPILE_TAG_IOS=ijkffmpeg-4.0-260402145042 From 43631d9f7046ef9e8db04d405c66c6c5cf638cc5 Mon Sep 17 00:00:00 2001 From: debugly Date: Tue, 7 Apr 2026 20:31:41 +0800 Subject: [PATCH 294/359] upgrade openssl to 3.6.2 --- configs/libs/openssl3.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configs/libs/openssl3.sh b/configs/libs/openssl3.sh index 7263f5af4..fe6119589 100644 --- a/configs/libs/openssl3.sh +++ b/configs/libs/openssl3.sh @@ -18,9 +18,9 @@ export LIB_NAME='openssl' export LIPO_LIBS="libssl libcrypto" export GIT_LOCAL_REPO=extra/openssl -export GIT_COMMIT=openssl-3.5.5 +export GIT_COMMIT=openssl-3.6.2 export REPO_DIR=openssl -export GIT_REPO_VERSION=3.5.5 +export GIT_REPO_VERSION=3.6.2 # you can export GIT_OPUS_UPSTREAM=git@xx:yy/openssl.git use your mirror if [[ "$GIT_OPENSSL_UPSTREAM" != "" ]] ;then From b3b7341318d32af7c7316fd0a6431a32ba862e7a Mon Sep 17 00:00:00 2001 From: Anka Date: Tue, 7 Apr 2026 12:49:08 +0000 Subject: [PATCH 295/359] upgrade openssl3 to openssl3-3.6.2-260407203333 for all by cd --- configs/libs/openssl3.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/openssl3.sh b/configs/libs/openssl3.sh index fe6119589..755f83803 100644 --- a/configs/libs/openssl3.sh +++ b/configs/libs/openssl3.sh @@ -30,7 +30,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=openssl3-3.5.5-260228140440 -export PRE_COMPILE_TAG_MACOS=openssl3-3.5.5-260228140440 -export PRE_COMPILE_TAG_IOS=openssl3-3.5.5-260228140440 -export PRE_COMPILE_TAG_ANDROID=openssl3-3.5.5-260228140440 +export PRE_COMPILE_TAG_TVOS=openssl3-3.6.2-260407203333 +export PRE_COMPILE_TAG_MACOS=openssl3-3.6.2-260407203333 +export PRE_COMPILE_TAG_IOS=openssl3-3.6.2-260407203333 +export PRE_COMPILE_TAG_ANDROID=openssl3-3.6.2-260407203333 From 1df2ee9b14e667bc5b69e5befd3124b53166fcb0 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Wed, 8 Apr 2026 11:25:41 +0800 Subject: [PATCH 296/359] fix pc file lib path fault --- do-compile/apple/any.sh | 21 ++++++++++++++++++++- do-compile/apple/xml2.sh | 5 +---- do-install/correct-pc.sh | 16 ++++++++++++++-- 3 files changed, 35 insertions(+), 7 deletions(-) diff --git a/do-compile/apple/any.sh b/do-compile/apple/any.sh index 45ae909da..19008c13b 100755 --- a/do-compile/apple/any.sh +++ b/do-compile/apple/any.sh @@ -91,7 +91,9 @@ do_lipo_all() { #fix prefix path p="$uni_dir/$LIB_NAME" escaped_p=$(echo $p | sed 's/\//\\\//g') - sed -i "" "s/^prefix=.*/prefix=$escaped_p/" "$pc_dst_dir/"*.pc + my_sed_i "s|^prefix=.*|prefix=$escaped_p|" "$pc_dst_dir/"*.pc + my_sed_i "s|^libdir=.*|libdir=$escaped_p|" "$pc_dst_dir/"*.pc + my_sed_i "s|^includedir=.*|includedir=$escaped_p|" "$pc_dst_dir/"*.pc fi fi done @@ -143,6 +145,22 @@ function do_make_xcframework() { done } +function do_fix_pc() { + # fix tbd link path in pkgconfig + # matching: /path/to/libNAME.tbd or path/to/libNAME.tbd -> -lNAME + if [[ -d "${MR_BUILD_PREFIX}/lib/pkgconfig" ]]; then + for pc in "${MR_BUILD_PREFIX}/lib/pkgconfig/"*.pc; do + if [[ -f "$pc" ]]; then + echo "fix pkgconfig in $pc" + # fix tbd link path + my_sed_i 's|[^ ]*lib\([^ /]*\)\.tbd|-l\1|g' "$pc" + # remove xcode sdk include path + my_sed_i 's|-I/Applications/Xcode[^ ]*usr/include||g' "$pc" + fi + done + fi +} + function do_compile() { if [ ! -d $MR_BUILD_SOURCE ]; then echo "" @@ -155,6 +173,7 @@ function do_compile() { mkdir -p "$MR_BUILD_PREFIX" ./$LIB_NAME.sh + do_fix_pc } function resolve_dep() { diff --git a/do-compile/apple/xml2.sh b/do-compile/apple/xml2.sh index fb98e7a17..fbbbd945a 100755 --- a/do-compile/apple/xml2.sh +++ b/do-compile/apple/xml2.sh @@ -73,7 +73,4 @@ set -e CFG_FLAGS="-Ddocs=disabled -Ddebugging=disabled -Dpython=disabled -Dzlib=enabled" -./meson-compatible.sh "$CFG_FLAGS" - -echo "fix zlib link path in pkgconfig" -my_sed_i 's|/Applications/Xcode[^ ]*/usr/lib/libz.tbd|-lz|g' ${MR_BUILD_PREFIX}/lib/pkgconfig/libxml-2.0.pc \ No newline at end of file +./meson-compatible.sh "$CFG_FLAGS" \ No newline at end of file diff --git a/do-install/correct-pc.sh b/do-install/correct-pc.sh index e4d1f6b1b..98aa70ff9 100755 --- a/do-install/correct-pc.sh +++ b/do-install/correct-pc.sh @@ -39,8 +39,20 @@ function correct_pc_file(){ my_sed_i "s|^exec_prefix=[^$].*|exec_prefix=$bin_dir|" $pc my_sed_i "s|^libdir=[^$].*|libdir=$lib_dir|" "$pc" my_sed_i "s|^includedir=[^$].*include|includedir=$include_dir|" "$pc" - my_sed_i "s|-L/[^ ]*lib|-L$lib_dir|" "$pc" - my_sed_i "s|-I/[^ ]*include|-I$include_dir|" "$pc" + + # Fix absolute paths to other internal dependencies + # Pattern: -L/any/path/PRODUCT_NAME/PLATFORM/universal/LIB_NAME/lib + # We want to replace the "/any/path/PRODUCT_NAME/PLATFORM" part with the local equivalent. + # Since we know the local product root is the parent of 'universal', we can use that. + + local product_root=$(cd "$fix_path"; pwd) + # escaped for sed + local escaped_root=$(echo "$product_root" | sed 's/\//\\\//g') + + # 1. Fix -L/path/to/universal/LIB_NAME/lib -> -L/local/product/universal/LIB_NAME/lib + my_sed_i "s|-L/[^ ]*/universal/\([^ /]*\)/lib|-L$escaped_root/universal/\1/lib|g" "$pc" + # 2. Fix -I/path/to/universal/LIB_NAME/include -> -I/local/product/universal/LIB_NAME/include + my_sed_i "s|-I/[^ ]*/universal/\([^ /]*\)/include|-I$escaped_root/universal/\1/include|g" "$pc" done cd "$dir" From 4d0bf2f5175df3713fc7fecf63e2ecd65c1364c8 Mon Sep 17 00:00:00 2001 From: Anka Date: Wed, 8 Apr 2026 03:31:02 +0000 Subject: [PATCH 297/359] upgrade xml2 to xml2-2.15.1-260408112816 for all by cd --- configs/libs/xml2.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/xml2.sh b/configs/libs/xml2.sh index b850243b1..9006c6af3 100644 --- a/configs/libs/xml2.sh +++ b/configs/libs/xml2.sh @@ -38,7 +38,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=xml2-2.15.1-260313174123 -export PRE_COMPILE_TAG_MACOS=xml2-2.15.1-260313174123 -export PRE_COMPILE_TAG_IOS=xml2-2.15.1-260313174123 -export PRE_COMPILE_TAG_ANDROID=xml2-2.15.1-260313174123 +export PRE_COMPILE_TAG_TVOS=xml2-2.15.1-260408112816 +export PRE_COMPILE_TAG_MACOS=xml2-2.15.1-260408112816 +export PRE_COMPILE_TAG_IOS=xml2-2.15.1-260408112816 +export PRE_COMPILE_TAG_ANDROID=xml2-2.15.1-260408112816 From 0c2ad726758a017135db96b9d461f5728b8faeec Mon Sep 17 00:00:00 2001 From: Anka Date: Wed, 8 Apr 2026 03:33:13 +0000 Subject: [PATCH 298/359] upgrade freetype to freetype-2.14.1-260408113115 for all by cd --- configs/libs/freetype.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/freetype.sh b/configs/libs/freetype.sh index e613d028d..f66fe610a 100644 --- a/configs/libs/freetype.sh +++ b/configs/libs/freetype.sh @@ -36,7 +36,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=freetype-2.14.1-260228125408 -export PRE_COMPILE_TAG_MACOS=freetype-2.14.1-260228125408 -export PRE_COMPILE_TAG_IOS=freetype-2.14.1-260228125408 -export PRE_COMPILE_TAG_ANDROID=freetype-2.14.1-260228125408 +export PRE_COMPILE_TAG_TVOS=freetype-2.14.1-260408113115 +export PRE_COMPILE_TAG_MACOS=freetype-2.14.1-260408113115 +export PRE_COMPILE_TAG_IOS=freetype-2.14.1-260408113115 +export PRE_COMPILE_TAG_ANDROID=freetype-2.14.1-260408113115 From 5b0d21bb4c8c97dc330300a95921c0a79516eb84 Mon Sep 17 00:00:00 2001 From: Anka Date: Wed, 8 Apr 2026 03:43:08 +0000 Subject: [PATCH 299/359] upgrade fontconfig to fontconfig-2.17.1-260408114200 for android by cd --- configs/libs/fontconfig.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/libs/fontconfig.sh b/configs/libs/fontconfig.sh index 24ece5a73..98ec6ab59 100644 --- a/configs/libs/fontconfig.sh +++ b/configs/libs/fontconfig.sh @@ -36,4 +36,4 @@ fi export PRE_COMPILE_TAG_IOS=fontconfig-2.16.0-250226074147 export PRE_COMPILE_TAG_TVOS=fontconfig-2.16.0-250226074147 export PRE_COMPILE_TAG_MACOS=fontconfig-2.16.0-250226074147 -export PRE_COMPILE_TAG_ANDROID=fontconfig-2.17.1-260313180009 +export PRE_COMPILE_TAG_ANDROID=fontconfig-2.17.1-260408114200 From 8919da770e8c17d623709979b03a789912218394 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Wed, 8 Apr 2026 14:23:08 +0800 Subject: [PATCH 300/359] try fix "Makefile.am:37: error: Libtool library used but 'LIBTOOL' is undefined" --- do-compile/apple/bluray.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/do-compile/apple/bluray.sh b/do-compile/apple/bluray.sh index ea3f60ed4..d42bce5ce 100755 --- a/do-compile/apple/bluray.sh +++ b/do-compile/apple/bluray.sh @@ -51,7 +51,14 @@ if [[ -f 'configure' ]]; then echo "reuse configure" else echo "auto generate configure" - ./bootstrap >/dev/null + if [[ "$(uname)" == "Darwin" ]]; then + if command -v glibtoolize > /dev/null; then + glibtoolize --force --copy + elif command -v libtoolize > /dev/null; then + libtoolize --force --copy + fi + fi + ./bootstrap fi echo From 8d2bf03efe959392692feacc17a5c48e59c8fc55 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Wed, 8 Apr 2026 14:48:01 +0800 Subject: [PATCH 301/359] fix apple libtool macro path and install glibtool check --- do-compile/apple/bluray.sh | 7 +++++++ tools/export-apple-host-env.sh | 10 ++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/do-compile/apple/bluray.sh b/do-compile/apple/bluray.sh index d42bce5ce..e6b36ffe6 100755 --- a/do-compile/apple/bluray.sh +++ b/do-compile/apple/bluray.sh @@ -52,6 +52,13 @@ if [[ -f 'configure' ]]; then else echo "auto generate configure" if [[ "$(uname)" == "Darwin" ]]; then + # Homebrew may be in different locations depending on the CPU arch + if [[ -d "/opt/homebrew/share/aclocal" ]]; then + export ACLOCAL_PATH="/opt/homebrew/share/aclocal:$ACLOCAL_PATH" + elif [[ -d "/usr/local/share/aclocal" ]]; then + export ACLOCAL_PATH="/usr/local/share/aclocal:$ACLOCAL_PATH" + fi + if command -v glibtoolize > /dev/null; then glibtoolize --force --copy elif command -v libtoolize > /dev/null; then diff --git a/tools/export-apple-host-env.sh b/tools/export-apple-host-env.sh index 7fdf0fef9..35e1eb0b6 100644 --- a/tools/export-apple-host-env.sh +++ b/tools/export-apple-host-env.sh @@ -43,8 +43,14 @@ export DEBUG_INFORMATION_FORMAT=dwarf-with-dsym function install_depends() { local name="$1" - if command -v "$name" &> /dev/null; then - echo "[✅] ${name}: $(eval $name --version)" + local check_name="$name" + # On macOS, GNU libtool is installed as glibtool to avoid conflict with Apple's libtool + if [[ "$(uname)" == "Darwin" && "$name" == "libtool" ]]; then + check_name="glibtool" + fi + + if command -v "$check_name" &> /dev/null; then + echo "[✅] ${name}: $(eval $check_name --version | head -n 1)" return 0 else if [[ "$name" == "rustup" || "$name" == "cargo" ]]; then From c1a4d5b81781cd780701e6933bda9fbd77f601fb Mon Sep 17 00:00:00 2001 From: Anka Date: Wed, 8 Apr 2026 06:57:00 +0000 Subject: [PATCH 302/359] upgrade bluray to bluray-1.3.4-260408145206 for all by cd --- configs/libs/bluray.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/bluray.sh b/configs/libs/bluray.sh index 4c705672c..b54cada1a 100644 --- a/configs/libs/bluray.sh +++ b/configs/libs/bluray.sh @@ -40,7 +40,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=bluray-1.3.4-260313191234 -export PRE_COMPILE_TAG_MACOS=bluray-1.3.4-260313191234 -export PRE_COMPILE_TAG_IOS=bluray-1.3.4-260313191234 -export PRE_COMPILE_TAG_ANDROID=bluray-1.3.4-260313191234 +export PRE_COMPILE_TAG_TVOS=bluray-1.3.4-260408145206 +export PRE_COMPILE_TAG_MACOS=bluray-1.3.4-260408145206 +export PRE_COMPILE_TAG_IOS=bluray-1.3.4-260408145206 +export PRE_COMPILE_TAG_ANDROID=bluray-1.3.4-260408145206 From 7f6a27ef088606dd4d5c56238ddfec2edbcdf283 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Wed, 8 Apr 2026 15:13:09 +0800 Subject: [PATCH 303/359] fix apple universal pc file libdir and includedir suffix --- do-compile/apple/any.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/do-compile/apple/any.sh b/do-compile/apple/any.sh index 19008c13b..20209a4da 100755 --- a/do-compile/apple/any.sh +++ b/do-compile/apple/any.sh @@ -92,8 +92,8 @@ do_lipo_all() { p="$uni_dir/$LIB_NAME" escaped_p=$(echo $p | sed 's/\//\\\//g') my_sed_i "s|^prefix=.*|prefix=$escaped_p|" "$pc_dst_dir/"*.pc - my_sed_i "s|^libdir=.*|libdir=$escaped_p|" "$pc_dst_dir/"*.pc - my_sed_i "s|^includedir=.*|includedir=$escaped_p|" "$pc_dst_dir/"*.pc + my_sed_i "s|^libdir=.*|libdir=$escaped_p/lib|" "$pc_dst_dir/"*.pc + my_sed_i "s|^includedir=.*|includedir=$escaped_p/include|" "$pc_dst_dir/"*.pc fi fi done From c1c176d2f56832dd79db135d46ae1766a014672c Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Wed, 8 Apr 2026 15:18:53 +0800 Subject: [PATCH 304/359] upgrade opus to 1.6.1 --- README.md | 4 ++-- README_zh-CN.md | 4 ++-- configs/libs/opus.sh | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 7a91f358a..2cae2646d 100644 --- a/README.md +++ b/README.md @@ -135,8 +135,8 @@ If cloning repositories from GitHub is slow, or if you need to use an internal p | fribidi | 1.0.16 | https://github.com/fribidi/fribidi.git | export GIT_FRIBIDI_UPSTREAM=git@xx:yy/fribidi.git | | harfbuzz | 12.3.2 | https://github.com/harfbuzz/harfbuzz.git | export GIT_HARFBUZZ_UPSTREAM=git@xx:yy/harfbuzz.git | | openssl | 1.1.1w | https://github.com/openssl/openssl.git | export GIT_OPENSSL_UPSTREAM=git@xx:yy/openssl.git | -| openssl3 | 3.5.5 | https://github.com/openssl/openssl.git | export GIT_OPENSSL_UPSTREAM=git@xx:yy/openssl.git | -| opus | 1.5.2 | https://gitlab.xiph.org/xiph/opus.git | export GIT_OPUS_UPSTREAM=git@xx:yy/opus.git | +| openssl3 | 3.6.2 | https://github.com/openssl/openssl.git | export GIT_OPENSSL_UPSTREAM=git@xx:yy/openssl.git | +| opus | 1.6.1 | https://gitlab.xiph.org/xiph/opus.git | export GIT_OPUS_UPSTREAM=git@xx:yy/opus.git | | smb2 | 6.2 | https://github.com/sahlberg/libsmb2.git | export GIT_SMB2_UPSTREAM=git@xx:yy/libsmb2.git | | soundtouch | 2.4.0 | https://codeberg.org/soundtouch/soundtouch.git | export GIT_SOUNDTOUCH_UPSTREAM=git@xx:yy/soundtouch.git | | unibreak | 6.1 | https://github.com/adah1972/libunibreak.git | export GIT_UNIBREAK_UPSTREAM=git@xx:yy/libunibreak.git | diff --git a/README_zh-CN.md b/README_zh-CN.md index b24409b83..67a315fa6 100644 --- a/README_zh-CN.md +++ b/README_zh-CN.md @@ -137,8 +137,8 @@ MRFFToolChain 是一套成熟的编译工具,专门用来编译 iOS、macOS、 | fribidi | 1.0.16 | https://github.com/fribidi/fribidi.git | export GIT_FRIBIDI_UPSTREAM=git@xx:yy/fribidi.git | | harfbuzz | 12.3.2 | https://github.com/harfbuzz/harfbuzz.git | export GIT_HARFBUZZ_UPSTREAM=git@xx:yy/harfbuzz.git | | openssl | 1.1.1w | https://github.com/openssl/openssl.git | export GIT_OPENSSL_UPSTREAM=git@xx:yy/openssl.git | -| openssl3 | 3.5.5 | https://github.com/openssl/openssl.git | export GIT_OPENSSL_UPSTREAM=git@xx:yy/openssl.git | -| opus | 1.5.2 | https://gitlab.xiph.org/xiph/opus.git | export GIT_OPUS_UPSTREAM=git@xx:yy/opus.git | +| openssl3 | 3.6.2 | https://github.com/openssl/openssl.git | export GIT_OPENSSL_UPSTREAM=git@xx:yy/openssl.git | +| opus | 1.6.1 | https://gitlab.xiph.org/xiph/opus.git | export GIT_OPUS_UPSTREAM=git@xx:yy/opus.git | | smb2 | 6.2 | https://github.com/sahlberg/libsmb2.git | export GIT_SMB2_UPSTREAM=git@xx:yy/libsmb2.git | | soundtouch | 2.4.0 | https://codeberg.org/soundtouch/soundtouch.git | export GIT_SOUNDTOUCH_UPSTREAM=git@xx:yy/soundtouch.git | | unibreak | 6.1 | https://github.com/adah1972/libunibreak.git | export GIT_UNIBREAK_UPSTREAM=git@xx:yy/libunibreak.git | diff --git a/configs/libs/opus.sh b/configs/libs/opus.sh index 415c310bf..9ee448526 100644 --- a/configs/libs/opus.sh +++ b/configs/libs/opus.sh @@ -27,9 +27,9 @@ export LIPO_LIBS="libopus" export LIB_DEPENDS_BIN="cmake" export CMAKE_TARGETS_NAME=opus export GIT_LOCAL_REPO=extra/opus -export GIT_COMMIT=v1.5.2 +export GIT_COMMIT=v1.6.1 export REPO_DIR=opus -export GIT_REPO_VERSION=1.5.2 +export GIT_REPO_VERSION=1.6.1 # you can export GIT_OPUS_UPSTREAM=git@xx:yy/opusfile.git use your mirror if [[ "$GIT_OPUS_UPSTREAM" != "" ]] ;then From 3e6ebb4b7421eda03e0c17b47c872a17cd17fbb5 Mon Sep 17 00:00:00 2001 From: Anka Date: Wed, 8 Apr 2026 07:41:37 +0000 Subject: [PATCH 305/359] upgrade freetype to freetype-2.14.1-260408153927 for all by cd --- configs/libs/freetype.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/freetype.sh b/configs/libs/freetype.sh index f66fe610a..cc168450f 100644 --- a/configs/libs/freetype.sh +++ b/configs/libs/freetype.sh @@ -36,7 +36,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=freetype-2.14.1-260408113115 -export PRE_COMPILE_TAG_MACOS=freetype-2.14.1-260408113115 -export PRE_COMPILE_TAG_IOS=freetype-2.14.1-260408113115 -export PRE_COMPILE_TAG_ANDROID=freetype-2.14.1-260408113115 +export PRE_COMPILE_TAG_TVOS=freetype-2.14.1-260408153927 +export PRE_COMPILE_TAG_MACOS=freetype-2.14.1-260408153927 +export PRE_COMPILE_TAG_IOS=freetype-2.14.1-260408153927 +export PRE_COMPILE_TAG_ANDROID=freetype-2.14.1-260408153927 From 4296eb4b981d16fbeae1e788e7daa11d0634bb63 Mon Sep 17 00:00:00 2001 From: Anka Date: Wed, 8 Apr 2026 07:42:36 +0000 Subject: [PATCH 306/359] upgrade fontconfig to fontconfig-2.17.1-260408154148 for android by cd --- configs/libs/fontconfig.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/libs/fontconfig.sh b/configs/libs/fontconfig.sh index 98ec6ab59..34af4c71e 100644 --- a/configs/libs/fontconfig.sh +++ b/configs/libs/fontconfig.sh @@ -36,4 +36,4 @@ fi export PRE_COMPILE_TAG_IOS=fontconfig-2.16.0-250226074147 export PRE_COMPILE_TAG_TVOS=fontconfig-2.16.0-250226074147 export PRE_COMPILE_TAG_MACOS=fontconfig-2.16.0-250226074147 -export PRE_COMPILE_TAG_ANDROID=fontconfig-2.17.1-260408114200 +export PRE_COMPILE_TAG_ANDROID=fontconfig-2.17.1-260408154148 From 291dfa2c6e1a394835137e48c81f1ea173549ceb Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Wed, 8 Apr 2026 15:48:56 +0800 Subject: [PATCH 307/359] update ReadMe --- README.md | 4 ++-- README_zh-CN.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 2cae2646d..d50a77d11 100644 --- a/README.md +++ b/README.md @@ -45,8 +45,8 @@ At present MRFFToolChain contained `ass、bluray、dav1d、dovi、dvdread、dvdn Tips: ``` -1、ffmpeg is not denpendent on ass. -2、fsplayer is denpendent on ffmpeg and ass. +1、ffmpeg is not denpendent on ass and placebo. +2、fsplayer is denpendent on ffmpeg and ass and placebo. 3、ijkplayer is denpendent on ijkffmpeg. 4、FFmpegTutorial is denpendent on fftutorial. 5、when install pre-compiled lib, will containes it's denpendencies. diff --git a/README_zh-CN.md b/README_zh-CN.md index 67a315fa6..1e797818f 100644 --- a/README_zh-CN.md +++ b/README_zh-CN.md @@ -47,8 +47,8 @@ MRFFToolChain 是一套成熟的编译工具,专门用来编译 iOS、macOS、 提示: ``` -1、ffmpeg 不依赖 ass -2、fsplayer 依赖 ffmpeg 和 ass +1、ffmpeg 不依赖 ass 和 placebo +2、fsplayer 依赖 ffmpeg 和 ass 和 placebo 3、ijkplayer 依赖 ijkffmpeg 4、FFmpegTutorial 依赖 fftutorial 5、安装预编译库时,会包含其所有依赖项 From 7f5cfc002aef0a2a5d403738e42dc254447c4e61 Mon Sep 17 00:00:00 2001 From: Anka Date: Wed, 8 Apr 2026 07:53:43 +0000 Subject: [PATCH 308/359] upgrade harfbuzz to harfbuzz-12.3.2-260408154245 for all by cd --- configs/libs/harfbuzz.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/harfbuzz.sh b/configs/libs/harfbuzz.sh index 58d1e15d3..e9ae11bee 100644 --- a/configs/libs/harfbuzz.sh +++ b/configs/libs/harfbuzz.sh @@ -38,7 +38,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=harfbuzz-12.3.2-260228131003 -export PRE_COMPILE_TAG_MACOS=harfbuzz-12.3.2-260228131003 -export PRE_COMPILE_TAG_IOS=harfbuzz-12.3.2-260228131003 -export PRE_COMPILE_TAG_ANDROID=harfbuzz-12.3.2-260228131003 +export PRE_COMPILE_TAG_TVOS=harfbuzz-12.3.2-260408154245 +export PRE_COMPILE_TAG_MACOS=harfbuzz-12.3.2-260408154245 +export PRE_COMPILE_TAG_IOS=harfbuzz-12.3.2-260408154245 +export PRE_COMPILE_TAG_ANDROID=harfbuzz-12.3.2-260408154245 From 19a24840794e0ef1f2b76dee532cd1abb208fe24 Mon Sep 17 00:00:00 2001 From: Anka Date: Wed, 8 Apr 2026 07:55:14 +0000 Subject: [PATCH 309/359] upgrade ass to ass-0.17.4-260408155409 for all by cd --- configs/libs/ass.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/ass.sh b/configs/libs/ass.sh index 57a659697..c9a7e266a 100644 --- a/configs/libs/ass.sh +++ b/configs/libs/ass.sh @@ -38,7 +38,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=ass-0.17.4-260228135313 -export PRE_COMPILE_TAG_MACOS=ass-0.17.4-260228135313 -export PRE_COMPILE_TAG_IOS=ass-0.17.4-260228135313 -export PRE_COMPILE_TAG_ANDROID=ass-0.17.4-260313180452 +export PRE_COMPILE_TAG_TVOS=ass-0.17.4-260408155409 +export PRE_COMPILE_TAG_MACOS=ass-0.17.4-260408155409 +export PRE_COMPILE_TAG_IOS=ass-0.17.4-260408155409 +export PRE_COMPILE_TAG_ANDROID=ass-0.17.4-260408155409 From 9d9286623315a37b99ce6bae0896fbaa543f2894 Mon Sep 17 00:00:00 2001 From: Anka Date: Wed, 8 Apr 2026 08:02:49 +0000 Subject: [PATCH 310/359] upgrade opus to opus-1.6.1-260408155520 for all by cd --- configs/libs/opus.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/opus.sh b/configs/libs/opus.sh index 9ee448526..ec9a4d76e 100644 --- a/configs/libs/opus.sh +++ b/configs/libs/opus.sh @@ -39,7 +39,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=opus-1.5.2-260228135851 -export PRE_COMPILE_TAG_MACOS=opus-1.5.2-260228135851 -export PRE_COMPILE_TAG_IOS=opus-1.5.2-260228135851 -export PRE_COMPILE_TAG_ANDROID=opus-1.5.2-260228135851 +export PRE_COMPILE_TAG_TVOS=opus-1.6.1-260408155520 +export PRE_COMPILE_TAG_MACOS=opus-1.6.1-260408155520 +export PRE_COMPILE_TAG_IOS=opus-1.6.1-260408155520 +export PRE_COMPILE_TAG_ANDROID=opus-1.6.1-260408155520 From e15200db205c510b3d6a1afaa7affb4fbc0d2ae5 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Thu, 9 Apr 2026 16:20:23 +0800 Subject: [PATCH 311/359] fix: add local variable declarations in do_make_xcframework and fix pkgconfig arch suffix path --- do-compile/apple/any.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/do-compile/apple/any.sh b/do-compile/apple/any.sh index 20209a4da..be2abdcd1 100755 --- a/do-compile/apple/any.sh +++ b/do-compile/apple/any.sh @@ -113,6 +113,12 @@ function do_make_xcframework() { mkdir -p "$MR_XCFRMK_DIR" for lib in $LIPO_LIBS; do + local macos_inputs="" + local ios_inputs="" + local ios_sim_inputs="" + local tvos_inputs="" + local tvos_sim_inputs="" + # add macOS macos_lib=$MR_MACOS_PRODUCT_ROOT/universal/$LIB_NAME/lib/${lib}.a if [[ -f $macos_lib ]]; then @@ -156,6 +162,12 @@ function do_fix_pc() { my_sed_i 's|[^ ]*lib\([^ /]*\)\.tbd|-l\1|g' "$pc" # remove xcode sdk include path my_sed_i 's|-I/Applications/Xcode[^ ]*usr/include||g' "$pc" + + # fix absolute path which contains arch suffix bug,such as /path/to/opus-arch/lib + if [[ -n "$_MR_ARCH" ]]; then + # handle any remaining arch suffix in the path + my_sed_i "s|${LIB_NAME}-${_MR_ARCH}|${LIB_NAME}|g" "$pc" + fi fi done fi From 3a9beb4aaa5d2769010789bc10c68ba9c21ea1d9 Mon Sep 17 00:00:00 2001 From: Anka Date: Thu, 9 Apr 2026 08:33:26 +0000 Subject: [PATCH 312/359] upgrade opus to opus-1.6.1-260409162658 for all by cd --- configs/libs/opus.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/opus.sh b/configs/libs/opus.sh index ec9a4d76e..07d149dbc 100644 --- a/configs/libs/opus.sh +++ b/configs/libs/opus.sh @@ -39,7 +39,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=opus-1.6.1-260408155520 -export PRE_COMPILE_TAG_MACOS=opus-1.6.1-260408155520 -export PRE_COMPILE_TAG_IOS=opus-1.6.1-260408155520 -export PRE_COMPILE_TAG_ANDROID=opus-1.6.1-260408155520 +export PRE_COMPILE_TAG_TVOS=opus-1.6.1-260409162658 +export PRE_COMPILE_TAG_MACOS=opus-1.6.1-260409162658 +export PRE_COMPILE_TAG_IOS=opus-1.6.1-260409162658 +export PRE_COMPILE_TAG_ANDROID=opus-1.6.1-260409162658 From a6a4cac44417a7e8262567d7790ff2c4146acec9 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Thu, 9 Apr 2026 18:19:56 +0800 Subject: [PATCH 313/359] fix after lipo the pc file lib absolute path contains arch suffix bug --- do-compile/apple/any.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/do-compile/apple/any.sh b/do-compile/apple/any.sh index be2abdcd1..8e70fc761 100755 --- a/do-compile/apple/any.sh +++ b/do-compile/apple/any.sh @@ -88,6 +88,13 @@ do_lipo_all() { mkdir -p "$pc_dst_dir" echo "copy pkgconfig file to $pc_dst_dir" cp ${pc_src_dir}/*.pc "$pc_dst_dir" + + # fix absolute path which contains arch suffix bug,such as /path/to/opus-arch/lib + #-L/Users/runner/work/MRFFToolChainBuildShell/MRFFToolChainBuildShell/build/product/macos/opus-arch/lib + #-> + #-L/Users/runner/work/MRFFToolChainBuildShell/MRFFToolChainBuildShell/build/product/macos/universal/opus/lib + # my_sed_i "s|${LIB_NAME}-${arch}|universal/${LIB_NAME}|g" "$pc_dst_dir/"*.pc + #fix prefix path p="$uni_dir/$LIB_NAME" escaped_p=$(echo $p | sed 's/\//\\\//g') @@ -162,12 +169,6 @@ function do_fix_pc() { my_sed_i 's|[^ ]*lib\([^ /]*\)\.tbd|-l\1|g' "$pc" # remove xcode sdk include path my_sed_i 's|-I/Applications/Xcode[^ ]*usr/include||g' "$pc" - - # fix absolute path which contains arch suffix bug,such as /path/to/opus-arch/lib - if [[ -n "$_MR_ARCH" ]]; then - # handle any remaining arch suffix in the path - my_sed_i "s|${LIB_NAME}-${_MR_ARCH}|${LIB_NAME}|g" "$pc" - fi fi done fi From 48f138b7abb55f7dca8e674ab96b90fe35b0339f Mon Sep 17 00:00:00 2001 From: Anka Date: Thu, 9 Apr 2026 10:34:41 +0000 Subject: [PATCH 314/359] upgrade opus to opus-1.6.1-260409182634 for all by cd --- configs/libs/opus.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/libs/opus.sh b/configs/libs/opus.sh index 07d149dbc..70f76c938 100644 --- a/configs/libs/opus.sh +++ b/configs/libs/opus.sh @@ -39,7 +39,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=opus-1.6.1-260409162658 -export PRE_COMPILE_TAG_MACOS=opus-1.6.1-260409162658 -export PRE_COMPILE_TAG_IOS=opus-1.6.1-260409162658 -export PRE_COMPILE_TAG_ANDROID=opus-1.6.1-260409162658 +export PRE_COMPILE_TAG_TVOS=opus-1.6.1-260409182634 +export PRE_COMPILE_TAG_MACOS=opus-1.6.1-260409182634 +export PRE_COMPILE_TAG_IOS=opus-1.6.1-260409182634 +export PRE_COMPILE_TAG_ANDROID=opus-1.6.1-260409182634 From 8f38f43bfc7e934eb944557811e66c22f7eb8a15 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Sat, 9 May 2026 10:28:55 +0800 Subject: [PATCH 315/359] add ffmpeg8 --- README.md | 6 +- README_zh-CN.md | 13 +- configs/ffconfig/auto-detect-third-libs.sh | 29 +- configs/ffconfig/module-default.sh | 1 - configs/ffconfig/module-full.sh | 1 - configs/ffconfig/module-lite-hevc.sh | 1 - configs/ffconfig/module-lite.sh | 1 - configs/libs/ffmpeg8.sh | 38 + ...k-h264_ps-null-pointer-fault-toleran.patch | 52 + ...format-add-application-and-dns_cache.patch | 671 +++++++++ .../0003-restore-ijk-http-event-hooks.patch | 278 ++++ .../0004-restore-ijk-tcp-dns-cache.patch | 404 +++++ ...om-protocols-and-demuxers-except-lon.patch | 277 ++++ ...-add-4-dummy-ijkplaceholder-demuxers.patch | 41 + .../0007-add-3-dummy-ijkhttp-protocols.patch | 41 + ...ict_get-that-converts-the-value-to-a.patch | 91 ++ ...tp-impl-was-used-by-set-selected_htt.patch | 129 ++ ...kable-value-range-0-means-streamed-c.patch | 26 + ...0011-fix-lrcdec-read-line-bug-on-osx.patch | 43 + ...index-only-keyframes-to-ensure-accur.patch | 47 + ...o-00-00-bug-baidu-neddisk-hls-start_.patch | 29 + ...g-codecpar-codec_id-which-read-from-.patch | 60 + ...-transfer-get-wrong-size-cause-av_re.patch | 32 + ...-not-very-useful-log-use-trace-level.patch | 76 + ...er-and-Demuxer-but-av3a-Decoder-is-a.patch | 1340 +++++++++++++++++ ...8-http-add-reconnect_first_delay-opt.patch | 41 + ...d-http_seek-redirect-authentication-.patch | 102 ++ ...d-built-in-smb2-protocol-via-libsmb2.patch | 495 ++++++ ...-add-url_parse_priv-function-pointer.patch | 55 + ...022-bluray-protocol-add-dvd-fallback.patch | 54 + ...fs-for-network-Blu-ray-Disc-and-BDMV.patch | 673 +++++++++ ...find-the-right-m2ts-then-read-seek-i.patch | 70 + ...eg7-test.c-1-10-fatal-error-libxml2-.patch | 26 + ...ragment-url-is-invalid-truncated-bug.patch | 43 + ...add-webp-demuxer-and-libwebp-decoder.patch | 804 ++++++++++ 35 files changed, 6066 insertions(+), 24 deletions(-) create mode 100644 configs/libs/ffmpeg8.sh create mode 100644 patches/ffmpeg-n8.1.1/0001-PATCH-restore-ijk-h264_ps-null-pointer-fault-toleran.patch create mode 100644 patches/ffmpeg-n8.1.1/0002-restore-ijk-avformat-add-application-and-dns_cache.patch create mode 100644 patches/ffmpeg-n8.1.1/0003-restore-ijk-http-event-hooks.patch create mode 100644 patches/ffmpeg-n8.1.1/0004-restore-ijk-tcp-dns-cache.patch create mode 100644 patches/ffmpeg-n8.1.1/0005-restore-ijk-custom-protocols-and-demuxers-except-lon.patch create mode 100644 patches/ffmpeg-n8.1.1/0006-add-4-dummy-ijkplaceholder-demuxers.patch create mode 100644 patches/ffmpeg-n8.1.1/0007-add-3-dummy-ijkhttp-protocols.patch create mode 100644 patches/ffmpeg-n8.1.1/0008-restore-ijk-av_dict_get-that-converts-the-value-to-a.patch create mode 100644 patches/ffmpeg-n8.1.1/0009-control-which-http-impl-was-used-by-set-selected_htt.patch create mode 100644 patches/ffmpeg-n8.1.1/0010-correct-file-seekable-value-range-0-means-streamed-c.patch create mode 100644 patches/ffmpeg-n8.1.1/0011-fix-lrcdec-read-line-bug-on-osx.patch create mode 100644 patches/ffmpeg-n8.1.1/0012-avformat-mpegts-index-only-keyframes-to-ensure-accur.patch create mode 100644 patches/ffmpeg-n8.1.1/0013-fix-can-t-seek-to-00-00-bug-baidu-neddisk-hls-start_.patch create mode 100644 patches/ffmpeg-n8.1.1/0014-Correct-the-wrong-codecpar-codec_id-which-read-from-.patch create mode 100644 patches/ffmpeg-n8.1.1/0015-fix-http-chunked-transfer-get-wrong-size-cause-av_re.patch create mode 100644 patches/ffmpeg-n8.1.1/0016-not-very-useful-log-use-trace-level.patch create mode 100644 patches/ffmpeg-n8.1.1/0017-Audio-Vivid-Parser-and-Demuxer-but-av3a-Decoder-is-a.patch create mode 100644 patches/ffmpeg-n8.1.1/0018-http-add-reconnect_first_delay-opt.patch create mode 100644 patches/ffmpeg-n8.1.1/0019-fix-http-open-and-http_seek-redirect-authentication-.patch create mode 100644 patches/ffmpeg-n8.1.1/0020-add-built-in-smb2-protocol-via-libsmb2.patch create mode 100644 patches/ffmpeg-n8.1.1/0021-URLProtocol-add-url_parse_priv-function-pointer.patch create mode 100644 patches/ffmpeg-n8.1.1/0022-bluray-protocol-add-dvd-fallback.patch create mode 100644 patches/ffmpeg-n8.1.1/0023-custom-bluray-fs-for-network-Blu-ray-Disc-and-BDMV.patch create mode 100644 patches/ffmpeg-n8.1.1/0024-bluray-open-and-find-the-right-m2ts-then-read-seek-i.patch create mode 100644 patches/ffmpeg-n8.1.1/0025-fix-android-ffmpeg7-test.c-1-10-fatal-error-libxml2-.patch create mode 100644 patches/ffmpeg-n8.1.1/0026-fix-dash-init-fragment-url-is-invalid-truncated-bug.patch create mode 100644 patches/ffmpeg-n8.1.1/0027-add-webp-demuxer-and-libwebp-decoder.patch diff --git a/README.md b/README.md index d50a77d11..b0def8b91 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ## MRFFToolChain Build Shell [[中文版](./README_zh-CN.md)] -![](https://img.shields.io/github/downloads/debugly/MRFFToolChainBuildShell/total) +![](https://img.shields.io/github/downloads/debugly/MRFFToolChainBuildShell/total) **What's MRFFToolChain?** @@ -19,7 +19,7 @@ At present MRFFToolChain contained `ass、bluray、dav1d、dovi、dvdread、dvdn ## News -- FFmpeg **7.1.3** is already in use +- FFmpeg **8.1.1** is ready - upgrade all libs to lastest,Improved optimizations - using macOS 15,Xcode_16.4 @@ -37,6 +37,7 @@ At present MRFFToolChain contained `ass、bluray、dav1d、dovi、dvdread、dvdn - FFmpeg5 for Appple: openssl3,opus,bluray,dav1d,dvdread,uavs3d - FFmpeg6 for Appple: openssl3,opus,bluray,dav1d,dvdread,uavs3d,smb2 - FFmpeg7 for Appple: openssl3,opus,bluray,dav1d,dvdnav,uavs3d,smb2,webp +- FFmpeg8 for Appple: openssl3,opus,bluray,dav1d,dvdnav,uavs3d,smb2,webp - FFmpeg4 for Android: openssl3,opus,bluray,soundtouch - FFmpeg5 for Android: openssl3,opus,bluray,dav1d,dvdread,uavs3d,soundtouch - FFmpeg6 for Android: openssl3,opus,bluray,dav1d,dvdread,uavs3d,smb2,soundtouch @@ -120,6 +121,7 @@ If cloning repositories from GitHub is slow, or if you need to use an internal p | Lib Name | Current Version | Repository URL | Mirror Repository URL | | ---------- | --------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| ffmpeg8 | 8.1.1 | https://github.com/FFmpeg/FFmpeg.git | export GIT_FFMPEG_UPSTREAM=git@xx:yy/FFmpeg.git | | ffmpeg7 | 7.1.3 | https://github.com/FFmpeg/FFmpeg.git | export GIT_FFMPEG_UPSTREAM=git@xx:yy/FFmpeg.git | | ffmpeg6 | 6.1.1 | https://github.com/FFmpeg/FFmpeg.git | export GIT_FFMPEG_UPSTREAM=git@xx:yy/FFmpeg.git | | ffmpeg5 | 5.1.6 | https://github.com/FFmpeg/FFmpeg.git | export GIT_FFMPEG_UPSTREAM=git@xx:yy/FFmpeg.git | diff --git a/README_zh-CN.md b/README_zh-CN.md index 1e797818f..e7634eb6a 100644 --- a/README_zh-CN.md +++ b/README_zh-CN.md @@ -1,6 +1,7 @@ ## MRFFToolChain 构建脚本 -![](https://img.shields.io/github/downloads/debugly/MRFFToolChainBuildShell/total) +![](https://img.shields.io/github/downloads/debugly/MRFFToolChainBuildShell/total) + **MRFFToolChain 是什么?** @@ -19,13 +20,13 @@ MRFFToolChain 是一套成熟的编译工具,专门用来编译 iOS、macOS、 ## 最新动态 -- FFmpeg **7.1.3** 已投入使用 +- FFmpeg **8.1.1** 已经准备好了 - 将所有库升级至最新版本,不少库提升了性能 - 使用 macOS 15,Xcode_16.4构建 ## 依赖关系 -编译了适用于安卓和 iOS 平台的 FFmpeg4,FFmpeg5,FFmpeg6,FFmpeg7。 +编译了适用于安卓和 iOS 平台的 FFmpeg4,FFmpeg5,FFmpeg6,FFmpeg7,FFmpeg8。 - Fontconfig:xml2、freetype - Bluray:xml2 @@ -38,11 +39,12 @@ MRFFToolChain 是一套成熟的编译工具,专门用来编译 iOS、macOS、 - 适用于苹果的 FFmpeg4:openssl3、opus、bluray - 适用于苹果的 FFmpeg5:openssl3、opus、bluray、dav1d、dvdread、uavs3d - 适用于苹果的 FFmpeg6:openssl3、opus、bluray、dav1d、dvdread、uavs3d、smb2 -- 适用于苹果的 FFmpeg7:openssl3、opus、bluray、dav1d、dvdnav、uavs3d、smb2、webp、libplacebo、shaderc、moltenvk、dovi、lcms2 +- 适用于苹果的 FFmpeg7:openssl3、opus、bluray、dav1d、dvdnav、uavs3d、smb2、webp +- 适用于苹果的 FFmpeg8:openssl3、opus、bluray、dav1d、dvdnav、uavs3d、smb2、webp - 适用于安卓的 FFmpeg4:openssl3、opus、bluray、soundtouch - 适用于安卓的 FFmpeg5:openssl3、opus、bluray、dav1d、dvdread、uavs3d、soundtouch - 适用于安卓的 FFmpeg6:openssl3、opus、bluray、dav1d、dvdread、uavs3d、smb2、soundtouch -- 适用于安卓的 FFmpeg7:openssl3、opus、bluray、dav1d、dvdnav、uavs3d、smb2、soundtouch、libplacebo、shaderc、moltenvk、dovi、lcms2 +- 适用于安卓的 FFmpeg7:openssl3、opus、bluray、dav1d、dvdnav、uavs3d、smb2、soundtouch 提示: @@ -122,6 +124,7 @@ MRFFToolChain 是一套成熟的编译工具,专门用来编译 iOS、macOS、 | 库名称 | 当前版本 | 仓库 URL | 镜像仓库 URL | | --------------- |----------- | ----------- | ------------ | +| ffmpeg8 | 8.1.1 | https://github.com/FFmpeg/FFmpeg.git | export GIT_FFMPEG_UPSTREAM=git@xx:yy/FFmpeg.git | | ffmpeg7 | 7.1.3 | https://github.com/FFmpeg/FFmpeg.git | export GIT_FFMPEG_UPSTREAM=git@xx:yy/FFmpeg.git | | ffmpeg6 | 6.1.1 | https://github.com/FFmpeg/FFmpeg.git | export GIT_FFMPEG_UPSTREAM=git@xx:yy/FFmpeg.git | | ffmpeg5 | 5.1.6 | https://github.com/FFmpeg/FFmpeg.git | export GIT_FFMPEG_UPSTREAM=git@xx:yy/FFmpeg.git | diff --git a/configs/ffconfig/auto-detect-third-libs.sh b/configs/ffconfig/auto-detect-third-libs.sh index cc8ba4df1..ba8cfc578 100644 --- a/configs/ffconfig/auto-detect-third-libs.sh +++ b/configs/ffconfig/auto-detect-third-libs.sh @@ -231,6 +231,11 @@ if [[ $result ]]; then echo "----------------------" fi +result=$(gt_or_equal "8.1.1" "$GIT_REPO_VERSION") +if [[ ! $result ]]; then + THIRD_CFG_FLAGS="$THIRD_CFG_FLAGS --disable-postproc" +fi + pkg-config --libs libxml-2.0 --silence-errors >/dev/null && enable_xml2=1 if [[ $enable_xml2 ]];then @@ -241,22 +246,20 @@ else fi echo "----------------------" -pkg-config --libs libwebp --silence-errors >/dev/null && enable_webp=1 -if [[ $enable_webp && $MR_PLAT == 'android' ]];then - enable_webp= - echo "force disable libwebp on android platform" -fi - -if [[ $enable_webp ]];then - echo "[✅] --enable-libwebp --enable-decoder=webp : $(pkg-config --modversion libwebp)" - THIRD_CFG_FLAGS="$THIRD_CFG_FLAGS --enable-libwebp --enable-demuxer=webp --enable-decoder=libwebp" -else - echo "[❌] --disable-libwebp --disable-decoder=libwebp" +enable_webp= +if [[ $MR_PLAT != 'android' ]];then + pkg-config --libs libwebp --silence-errors >/dev/null && enable_webp=1 + if [[ $enable_webp ]];then + echo "[✅] --enable-libwebp --enable-decoder=webp : $(pkg-config --modversion libwebp)" + THIRD_CFG_FLAGS="$THIRD_CFG_FLAGS --enable-libwebp --enable-demuxer=webp --enable-decoder=libwebp" + else + echo "[❌] --disable-libwebp --disable-decoder=libwebp" + THIRD_CFG_FLAGS="$THIRD_CFG_FLAGS --disable-libwebp --disable-demuxer=webp --disable-decoder=libwebp" + fi + echo "----------------------" fi -echo "----------------------" - # export PKG_CONFIG_LIBDIR=$PKG_CONFIG_LIBDIR:/opt/homebrew/Cellar/shaderc/2024.0/lib/pkgconfig:/opt/homebrew/Cellar/little-cms2/2.16/lib/pkgconfig # pkg-config --libs libplacebo --silence-errors >/dev/null && enable_placebo=1 diff --git a/configs/ffconfig/module-default.sh b/configs/ffconfig/module-default.sh index 284266a8b..3f6403d6a 100755 --- a/configs/ffconfig/module-default.sh +++ b/configs/ffconfig/module-default.sh @@ -39,7 +39,6 @@ export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-avformat" export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-avutil" export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-swresample" export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-swscale" -export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-postproc" export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-avfilter" #ffmpeg 5 has no avresample lib. # export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-avresample" diff --git a/configs/ffconfig/module-full.sh b/configs/ffconfig/module-full.sh index 4fac62fb1..7fbfae1a2 100755 --- a/configs/ffconfig/module-full.sh +++ b/configs/ffconfig/module-full.sh @@ -41,7 +41,6 @@ export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-swresample" export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-swscale" export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-avfilter" export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-avdevice" -export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-postproc" #ffmpeg 5 has no avresample lib. # export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-avresample" # export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-pthreads" diff --git a/configs/ffconfig/module-lite-hevc.sh b/configs/ffconfig/module-lite-hevc.sh index d942d1d38..1999e0ae7 100755 --- a/configs/ffconfig/module-lite-hevc.sh +++ b/configs/ffconfig/module-lite-hevc.sh @@ -39,7 +39,6 @@ export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-avformat" export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-avutil" export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-swresample" export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-swscale" -export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-postproc" export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-avfilter" #ffmpeg 5 has no avresample lib. # export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-avresample" diff --git a/configs/ffconfig/module-lite.sh b/configs/ffconfig/module-lite.sh index ca02da303..7627f1cf2 100755 --- a/configs/ffconfig/module-lite.sh +++ b/configs/ffconfig/module-lite.sh @@ -39,7 +39,6 @@ export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-avformat" export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-avutil" export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-swresample" export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-swscale" -export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-postproc" export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-avfilter" #ffmpeg 5 has no avresample lib. # export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-avresample" diff --git a/configs/libs/ffmpeg8.sh b/configs/libs/ffmpeg8.sh new file mode 100644 index 000000000..2edfb670a --- /dev/null +++ b/configs/libs/ffmpeg8.sh @@ -0,0 +1,38 @@ +#! /usr/bin/env bash +# +# Copyright (C) 2021 Matt Reach + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# +# brew install nasm +# If you really want to compile without asm, configure with --disable-asm. + +export LIB_NAME='ffmpeg' +export LIPO_LIBS="libavcodec libavformat libavutil libswscale libswresample libavfilter libavdevice" +export LIB_DEPENDS_BIN="nasm pkg-config" +export GIT_LOCAL_REPO=extra/ffmpeg +export REPO_DIR=ffmpeg8 +export PATCH_DIR=ffmpeg-n8.1.1 +export GIT_COMMIT=n8.1.1 +export GIT_REPO_VERSION=8.1.1 + +# you can export GIT_FFMPEG_UPSTREAM=git@xx:yy/FFmpeg.git use your mirror +if [[ "$GIT_FFMPEG_UPSTREAM" != "" ]] ;then + export GIT_UPSTREAM="$GIT_FFMPEG_UPSTREAM" +else + export GIT_UPSTREAM=https://github.com/FFmpeg/FFmpeg.git +fi + + +# pre compiled diff --git a/patches/ffmpeg-n8.1.1/0001-PATCH-restore-ijk-h264_ps-null-pointer-fault-toleran.patch b/patches/ffmpeg-n8.1.1/0001-PATCH-restore-ijk-h264_ps-null-pointer-fault-toleran.patch new file mode 100644 index 000000000..b82653f0d --- /dev/null +++ b/patches/ffmpeg-n8.1.1/0001-PATCH-restore-ijk-h264_ps-null-pointer-fault-toleran.patch @@ -0,0 +1,52 @@ +From 23773b2fbcdd5f495622318db9a7cc5c35942cef Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Wed, 28 May 2025 17:28:22 +0800 +Subject: restore ijk h264_ps null pointer fault tolerant + +--- + libavcodec/h264_ps.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/libavcodec/h264_ps.c b/libavcodec/h264_ps.c +index ac204172cb..2c35e0d6f6 100644 +--- a/libavcodec/h264_ps.c ++++ b/libavcodec/h264_ps.c +@@ -437,7 +437,7 @@ int ff_h264_decode_seq_parameter_set(GetBitContext *gb, AVCodecContext *avctx, + } + + sps->ref_frame_count = get_ue_golomb_31(gb); +- if (avctx->codec_tag == MKTAG('S', 'M', 'V', '2')) ++ if (avctx && avctx->codec_tag == MKTAG('S', 'M', 'V', '2')) + sps->ref_frame_count = FFMAX(2, sps->ref_frame_count); + if (sps->ref_frame_count > H264_MAX_DPB_FRAMES) { + av_log(avctx, AV_LOG_ERROR, +@@ -480,7 +480,7 @@ int ff_h264_decode_seq_parameter_set(GetBitContext *gb, AVCodecContext *avctx, + int width = 16 * sps->mb_width; + int height = 16 * sps->mb_height; + +- if (avctx->flags2 & AV_CODEC_FLAG2_IGNORE_CROP) { ++ if (avctx && avctx->flags2 & AV_CODEC_FLAG2_IGNORE_CROP) { + av_log(avctx, AV_LOG_DEBUG, "discarding sps cropping, original " + "values are l:%d r:%d t:%d b:%d\n", + crop_left, crop_right, crop_top, crop_bottom); +@@ -552,7 +552,7 @@ int ff_h264_decode_seq_parameter_set(GetBitContext *gb, AVCodecContext *avctx, + if (!sps->vui.sar.den) + sps->vui.sar.den = 1; + +- if (avctx->debug & FF_DEBUG_PICT_INFO) { ++ if (avctx && avctx->debug & FF_DEBUG_PICT_INFO) { + static const char csp[4][5] = { "Gray", "420", "422", "444" }; + av_log(avctx, AV_LOG_DEBUG, + "sps:%u profile:%d/%d poc:%d ref:%d %dx%d %s %s crop:%u/%u/%u/%u %s %s %"PRId32"/%"PRId32" b%d reo:%d\n", +@@ -819,7 +819,7 @@ int ff_h264_decode_picture_parameter_set(GetBitContext *gb, AVCodecContext *avct + if (pps->chroma_qp_index_offset[0] != pps->chroma_qp_index_offset[1]) + pps->chroma_qp_diff = 1; + +- if (avctx->debug & FF_DEBUG_PICT_INFO) { ++ if (avctx && avctx->debug & FF_DEBUG_PICT_INFO) { + av_log(avctx, AV_LOG_DEBUG, + "pps:%u sps:%u %s slice_groups:%d ref:%u/%u %s qp:%d/%d/%d/%d %s %s %s %s\n", + pps_id, pps->sps_id, +-- +2.50.1 (Apple Git-155) + diff --git a/patches/ffmpeg-n8.1.1/0002-restore-ijk-avformat-add-application-and-dns_cache.patch b/patches/ffmpeg-n8.1.1/0002-restore-ijk-avformat-add-application-and-dns_cache.patch new file mode 100644 index 000000000..8b158734f --- /dev/null +++ b/patches/ffmpeg-n8.1.1/0002-restore-ijk-avformat-add-application-and-dns_cache.patch @@ -0,0 +1,671 @@ +From 886512c82e75af2e3ab48b8ebf5070995426c253 Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Fri, 8 May 2026 15:58:55 +0800 +Subject: restore ijk avformat add application and dns_cache + +--- + libavformat/Makefile | 5 + + libavformat/application.c | 213 ++++++++++++++++++++++++++++++++++ + libavformat/application.h | 120 ++++++++++++++++++++ + libavformat/dns_cache.c | 232 ++++++++++++++++++++++++++++++++++++++ + libavformat/dns_cache.h | 39 +++++++ + 5 files changed, 609 insertions(+) + create mode 100644 libavformat/application.c + create mode 100644 libavformat/application.h + create mode 100644 libavformat/dns_cache.c + create mode 100644 libavformat/dns_cache.h + +diff --git a/libavformat/Makefile b/libavformat/Makefile +index 4786a9345a..3c95fc4b7f 100644 +--- a/libavformat/Makefile ++++ b/libavformat/Makefile +@@ -5,6 +5,9 @@ HEADERS = avformat.h \ + avio.h \ + version.h \ + version_major.h \ ++ application.h \ ++ dns_cache.h \ ++ + + OBJS = allformats.o \ + av1.o \ +@@ -35,6 +38,8 @@ OBJS = allformats.o \ + utils.o \ + version.o \ + vpcc.o \ ++ application.o \ ++ dns_cache.o \ + + OBJS-$(HAVE_LIBC_MSVCRT) += file_open.o + +diff --git a/libavformat/application.c b/libavformat/application.c +new file mode 100644 +index 0000000000..de093b9c89 +--- /dev/null ++++ b/libavformat/application.c +@@ -0,0 +1,213 @@ ++/* ++ * copyright (c) 2016 Zhang Rui ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#include "application.h" ++#include "libavformat/network.h" ++#include "libavutil/avstring.h" ++#include "libavutil/mem.h" ++ ++static int av_application_alloc(AVApplicationContext **ph, void *opaque) ++{ ++ AVApplicationContext *h = NULL; ++ ++ h = av_mallocz(sizeof(AVApplicationContext)); ++ if (!h) ++ return AVERROR(ENOMEM); ++ ++ h->opaque = opaque; ++ ++ *ph = h; ++ return 0; ++} ++ ++int av_application_open(AVApplicationContext **ph, void *opaque) ++{ ++ int ret = av_application_alloc(ph, opaque); ++ if (ret) ++ return ret; ++ ++ return 0; ++} ++ ++static void av_application_close(AVApplicationContext *h) ++{ ++ av_free(h); ++} ++ ++void av_application_closep(AVApplicationContext **ph) ++{ ++ if (!ph || !*ph) ++ return; ++ ++ av_application_close(*ph); ++ *ph = NULL; ++} ++ ++void av_application_on_http_event(AVApplicationContext *h, int event_type, AVAppHttpEvent *event) ++{ ++ if (h && h->func_on_app_event) ++ h->func_on_app_event(h, event_type, (void *)event, sizeof(AVAppHttpEvent)); ++} ++ ++void av_application_will_http_open(AVApplicationContext *h, void *obj, const char *url) ++{ ++ AVAppHttpEvent event = {0}; ++ ++ if (!h || !obj || !url) ++ return; ++ ++ event.obj = obj; ++ av_strlcpy(event.url, url, sizeof(event.url)); ++ ++ av_application_on_http_event(h, AVAPP_EVENT_WILL_HTTP_OPEN, &event); ++} ++ ++void av_application_did_http_open(AVApplicationContext *h, void *obj, const char *url, int error, int http_code, int64_t filesize) ++{ ++ AVAppHttpEvent event = {0}; ++ ++ if (!h || !obj || !url) ++ return; ++ ++ event.obj = obj; ++ av_strlcpy(event.url, url, sizeof(event.url)); ++ event.error = error; ++ event.http_code = http_code; ++ event.filesize = filesize; ++ ++ av_application_on_http_event(h, AVAPP_EVENT_DID_HTTP_OPEN, &event); ++} ++ ++void av_application_will_http_seek(AVApplicationContext *h, void *obj, const char *url, int64_t offset) ++{ ++ AVAppHttpEvent event = {0}; ++ ++ if (!h || !obj || !url) ++ return; ++ ++ event.obj = obj; ++ event.offset = offset; ++ av_strlcpy(event.url, url, sizeof(event.url)); ++ ++ av_application_on_http_event(h, AVAPP_EVENT_WILL_HTTP_SEEK, &event); ++} ++ ++void av_application_did_http_seek(AVApplicationContext *h, void *obj, const char *url, int64_t offset, int error, int http_code) ++{ ++ AVAppHttpEvent event = {0}; ++ ++ if (!h || !obj || !url) ++ return; ++ ++ event.obj = obj; ++ event.offset = offset; ++ av_strlcpy(event.url, url, sizeof(event.url)); ++ event.error = error; ++ event.http_code = http_code; ++ ++ av_application_on_http_event(h, AVAPP_EVENT_DID_HTTP_SEEK, &event); ++} ++ ++static void av_application_on_io_traffic(AVApplicationContext *h, AVAppIOTraffic *event) ++{ ++ if (h && h->func_on_app_event) ++ h->func_on_app_event(h, AVAPP_EVENT_IO_TRAFFIC, (void *)event, sizeof(AVAppIOTraffic)); ++} ++ ++int av_application_on_io_control(AVApplicationContext *h, int event_type, AVAppIOControl *control) ++{ ++ if (h && h->func_on_app_event) ++ return h->func_on_app_event(h, event_type, (void *)control, sizeof(AVAppIOControl)); ++ return 0; ++} ++ ++int av_application_on_tcp_will_open(AVApplicationContext *h) ++{ ++ if (h && h->func_on_app_event) { ++ AVAppTcpIOControl control = {0}; ++ return h->func_on_app_event(h, AVAPP_CTRL_WILL_TCP_OPEN, (void *)&control, sizeof(AVAppTcpIOControl)); ++ } ++ return 0; ++} ++ ++// only callback returns error ++int av_application_on_tcp_did_open(AVApplicationContext *h, int error, int fd, AVAppTcpIOControl *control) ++{ ++ struct sockaddr_storage so_stg; ++ int ret = 0; ++ socklen_t so_len = sizeof(so_stg); ++ int so_family; ++ char *so_ip_name = control->ip; ++ ++ if (!h || !h->func_on_app_event || fd <= 0) ++ return 0; ++ ++ ret = getpeername(fd, (struct sockaddr *)&so_stg, &so_len); ++ if (ret) ++ return 0; ++ control->error = error; ++ control->fd = fd; ++ ++ so_family = ((struct sockaddr*)&so_stg)->sa_family; ++ switch (so_family) { ++ case AF_INET: { ++ struct sockaddr_in* in4 = (struct sockaddr_in*)&so_stg; ++ if (inet_ntop(AF_INET, &(in4->sin_addr), so_ip_name, sizeof(control->ip))) { ++ control->family = AF_INET; ++ control->port = in4->sin_port; ++ } ++ break; ++ } ++ case AF_INET6: { ++ struct sockaddr_in6* in6 = (struct sockaddr_in6*)&so_stg; ++ if (inet_ntop(AF_INET6, &(in6->sin6_addr), so_ip_name, sizeof(control->ip))) { ++ control->family = AF_INET6; ++ control->port = in6->sin6_port; ++ } ++ break; ++ } ++ } ++ ++ return h->func_on_app_event(h, AVAPP_CTRL_DID_TCP_OPEN, (void *)control, sizeof(AVAppTcpIOControl)); ++} ++ ++void av_application_on_async_statistic(AVApplicationContext *h, AVAppAsyncStatistic *statistic) ++{ ++ if (h && h->func_on_app_event) ++ h->func_on_app_event(h, AVAPP_EVENT_ASYNC_STATISTIC, (void *)statistic, sizeof(AVAppAsyncStatistic)); ++} ++ ++void av_application_on_async_read_speed(AVApplicationContext *h, AVAppAsyncReadSpeed *speed) ++{ ++ if (h && h->func_on_app_event) ++ h->func_on_app_event(h, AVAPP_EVENT_ASYNC_READ_SPEED, (void *)speed, sizeof(AVAppAsyncReadSpeed)); ++} ++ ++void av_application_did_io_tcp_read(AVApplicationContext *h, void *obj, int bytes) ++{ ++ AVAppIOTraffic event = {0}; ++ if (!h || !obj || bytes <= 0) ++ return; ++ ++ event.obj = obj; ++ event.bytes = bytes; ++ ++ av_application_on_io_traffic(h, &event); ++} +diff --git a/libavformat/application.h b/libavformat/application.h +new file mode 100644 +index 0000000000..b9e7f5b69a +--- /dev/null ++++ b/libavformat/application.h +@@ -0,0 +1,120 @@ ++/* ++ * copyright (c) 2016 Zhang Rui ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#ifndef AVUTIL_APPLICATION_H ++#define AVUTIL_APPLICATION_H ++ ++#include ++ ++#define AVAPP_EVENT_WILL_HTTP_OPEN 1 //AVAppHttpEvent ++#define AVAPP_EVENT_DID_HTTP_OPEN 2 //AVAppHttpEvent ++#define AVAPP_EVENT_WILL_HTTP_SEEK 3 //AVAppHttpEvent ++#define AVAPP_EVENT_DID_HTTP_SEEK 4 //AVAppHttpEvent ++ ++#define AVAPP_EVENT_ASYNC_STATISTIC 0x11000 //AVAppAsyncStatistic ++#define AVAPP_EVENT_ASYNC_READ_SPEED 0x11001 //AVAppAsyncReadSpeed ++#define AVAPP_EVENT_IO_TRAFFIC 0x12204 //AVAppIOTraffic ++ ++#define AVAPP_CTRL_WILL_TCP_OPEN 0x20001 //AVAppTcpIOControl ++#define AVAPP_CTRL_DID_TCP_OPEN 0x20002 //AVAppTcpIOControl ++ ++#define AVAPP_CTRL_WILL_HTTP_OPEN 0x20003 //AVAppIOControl ++#define AVAPP_CTRL_WILL_LIVE_OPEN 0x20005 //AVAppIOControl ++ ++#define AVAPP_CTRL_WILL_CONCAT_SEGMENT_OPEN 0x20007 //AVAppIOControl ++ ++typedef struct AVAppIOControl { ++ size_t size; ++ char url[4096]; /* in, out */ ++ int segment_index; /* in, default = 0 */ ++ int retry_counter; /* in */ ++ ++ int is_handled; /* out, default = false */ ++ int is_url_changed; /* out, default = false */ ++} AVAppIOControl; ++ ++typedef struct AVAppTcpIOControl { ++ int error; ++ int family; ++ char ip[96]; ++ int port; ++ int fd; ++} AVAppTcpIOControl; ++ ++typedef struct AVAppAsyncStatistic { ++ size_t size; ++ int64_t buf_backwards; ++ int64_t buf_forwards; ++ int64_t buf_capacity; ++} AVAppAsyncStatistic; ++ ++typedef struct AVAppAsyncReadSpeed { ++ size_t size; ++ int is_full_speed; ++ int64_t io_bytes; ++ int64_t elapsed_milli; ++} AVAppAsyncReadSpeed; ++ ++typedef struct AVAppHttpEvent ++{ ++ void *obj; ++ char url[4096]; ++ int64_t offset; ++ int error; ++ int http_code; ++ int64_t filesize; ++} AVAppHttpEvent; ++ ++typedef struct AVAppIOTraffic ++{ ++ void *obj; ++ int bytes; ++} AVAppIOTraffic; ++ ++typedef struct AVApplicationContext AVApplicationContext; ++typedef struct AVClass AVClass; ++struct AVApplicationContext { ++ const AVClass *av_class; /**< information for av_log(). Set by av_application_open(). */ ++ void *opaque; /**< user data. */ ++ int (*func_on_app_event)(AVApplicationContext *h, int event_type ,void *obj, size_t size); ++}; ++ ++// open/close ++int av_application_open(AVApplicationContext **ph, void *opaque); ++void av_application_closep(AVApplicationContext **ph); ++ ++// custom protocol invoke ++void av_application_on_http_event(AVApplicationContext *h, int event_type, AVAppHttpEvent *event); ++int av_application_on_io_control(AVApplicationContext *h, int event_type, AVAppIOControl *control); ++void av_application_on_async_statistic(AVApplicationContext *h, AVAppAsyncStatistic *statistic); ++void av_application_on_async_read_speed(AVApplicationContext *h, AVAppAsyncReadSpeed *speed); ++ ++// http event ++void av_application_will_http_open(AVApplicationContext *h, void *obj, const char *url); ++void av_application_did_http_open(AVApplicationContext *h, void *obj, const char *url, int error, int http_code, int64_t filesize); ++void av_application_will_http_seek(AVApplicationContext *h, void *obj, const char *url, int64_t offset); ++void av_application_did_http_seek(AVApplicationContext *h, void *obj, const char *url, int64_t offset, int error, int http_code); ++//tcp event ++int av_application_on_tcp_will_open(AVApplicationContext *h); ++int av_application_on_tcp_did_open(AVApplicationContext *h, int error, int fd, AVAppTcpIOControl *control); ++//tcp speed ++void av_application_did_io_tcp_read(AVApplicationContext *h, void *obj, int bytes); ++ ++#endif /* AVUTIL_APPLICATION_H */ +diff --git a/libavformat/dns_cache.c b/libavformat/dns_cache.c +new file mode 100644 +index 0000000000..aab2435b90 +--- /dev/null ++++ b/libavformat/dns_cache.c +@@ -0,0 +1,232 @@ ++/* ++ * copyright (c) 2017 Raymond Zheng ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#include "dns_cache.h" ++#include "libavutil/time.h" ++#include "libavutil/mem.h" ++#include "libavformat/network.h" ++#include ++#include ++ ++#if HAVE_PTHREADS ++#include ++#endif ++ ++typedef struct DnsCacheContext DnsCacheContext; ++typedef struct DnsCacheContext { ++ AVDictionary *dns_dictionary; ++ pthread_mutex_t dns_dictionary_mutex; ++ int initialized; ++} DnsCacheContext; ++ ++static DnsCacheContext *context = NULL; ++static pthread_once_t key_once = PTHREAD_ONCE_INIT; ++ ++static void inner_init(void) { ++ int ret = 0; ++ context = (DnsCacheContext *) av_mallocz(sizeof(DnsCacheContext)); ++ if (context) { ++ ret = pthread_mutex_init(&context->dns_dictionary_mutex, NULL); ++ if (!ret) { ++ context->initialized = 1; ++ } else { ++ av_freep(&context); ++ } ++ } ++} ++ ++static void free_private_addrinfo(struct addrinfo **p_ai) { ++ struct addrinfo *ai = *p_ai; ++ ++ if (ai) { ++ if (ai->ai_addr) { ++ av_freep(&ai->ai_addr); ++ } ++ av_freep(p_ai); ++ } ++} ++ ++static int inner_remove_dns_cache(const char *uri, DnsCacheEntry *dns_cache_entry) { ++ if (context && dns_cache_entry) { ++ if (dns_cache_entry->ref_count == 0) { ++ av_dict_set_int(&context->dns_dictionary, uri, 0, 0); ++ free_private_addrinfo(&dns_cache_entry->res); ++ av_freep(&dns_cache_entry); ++ } else { ++ dns_cache_entry->delete_flag = 1; ++ } ++ } ++ ++ return 0; ++} ++ ++static DnsCacheEntry *new_dns_cache_entry(const char *uri, struct addrinfo *cur_ai, int64_t timeout) { ++ DnsCacheEntry *new_entry = NULL; ++ int64_t cur_time = av_gettime_relative(); ++ ++ if (cur_time < 0) { ++ goto fail; ++ } ++ ++ new_entry = (DnsCacheEntry *) av_mallocz(sizeof(struct DnsCacheEntry)); ++ if (!new_entry) { ++ goto fail; ++ } ++ ++ new_entry->res = (struct addrinfo *) av_mallocz(sizeof(struct addrinfo)); ++ if (!new_entry->res) { ++ av_freep(&new_entry); ++ goto fail; ++ } ++ ++ memcpy(new_entry->res, cur_ai, sizeof(struct addrinfo)); ++ ++ new_entry->res->ai_addr = (struct sockaddr *) av_mallocz(sizeof(struct sockaddr)); ++ if (!new_entry->res->ai_addr) { ++ av_freep(&new_entry->res); ++ av_freep(&new_entry); ++ goto fail; ++ } ++ ++ memcpy(new_entry->res->ai_addr, cur_ai->ai_addr, sizeof(struct sockaddr)); ++ new_entry->res->ai_canonname = NULL; ++ new_entry->res->ai_next = NULL; ++ new_entry->ref_count = 0; ++ new_entry->delete_flag = 0; ++ new_entry->expired_time = cur_time + timeout * 1000; ++ ++ return new_entry; ++ ++fail: ++ return NULL; ++} ++ ++DnsCacheEntry *get_dns_cache_reference(const char *uri) { ++ AVDictionaryEntry *elem = NULL; ++ DnsCacheEntry *dns_cache_entry = NULL; ++ int64_t cur_time = av_gettime_relative(); ++ ++ if (cur_time < 0 || !uri || strlen(uri) == 0) { ++ return NULL; ++ } ++ ++ if (!context || !context->initialized) { ++#if HAVE_PTHREADS ++ pthread_once(&key_once, inner_init); ++#endif ++ } ++ ++ if (context && context->initialized) { ++ pthread_mutex_lock(&context->dns_dictionary_mutex); ++ elem = av_dict_get(context->dns_dictionary, uri, NULL, AV_DICT_MATCH_CASE); ++ if (elem) { ++ dns_cache_entry = (DnsCacheEntry *) (intptr_t) strtoll(elem->value, NULL, 10); ++ if (dns_cache_entry) { ++ if (dns_cache_entry->expired_time < cur_time) { ++ inner_remove_dns_cache(uri, dns_cache_entry); ++ dns_cache_entry = NULL; ++ } else { ++ dns_cache_entry->ref_count++; ++ } ++ } ++ } ++ pthread_mutex_unlock(&context->dns_dictionary_mutex); ++ } ++ ++ return dns_cache_entry; ++} ++ ++int release_dns_cache_reference(const char *uri, DnsCacheEntry **p_entry) { ++ DnsCacheEntry *entry = *p_entry; ++ ++ if (!uri || strlen(uri) == 0) { ++ return -1; ++ } ++ ++ if (context && context->initialized && entry) { ++ pthread_mutex_lock(&context->dns_dictionary_mutex); ++ entry->ref_count--; ++ if (entry->delete_flag && entry->ref_count == 0) { ++ inner_remove_dns_cache(uri, entry); ++ entry = NULL; ++ } ++ pthread_mutex_unlock(&context->dns_dictionary_mutex); ++ } ++ return 0; ++} ++ ++int remove_dns_cache_entry(const char *uri) { ++ AVDictionaryEntry *elem = NULL; ++ DnsCacheEntry *dns_cache_entry = NULL; ++ ++ if (!uri || strlen(uri) == 0) { ++ return -1; ++ } ++ ++ if (context && context->initialized) { ++ pthread_mutex_lock(&context->dns_dictionary_mutex); ++ elem = av_dict_get(context->dns_dictionary, uri, NULL, AV_DICT_MATCH_CASE); ++ if (elem) { ++ dns_cache_entry = (DnsCacheEntry *) (intptr_t) strtoll(elem->value, NULL, 10); ++ if (dns_cache_entry) { ++ inner_remove_dns_cache(uri, dns_cache_entry); ++ } ++ } ++ pthread_mutex_unlock(&context->dns_dictionary_mutex); ++ } ++ ++ return 0; ++} ++ ++int add_dns_cache_entry(const char *uri, struct addrinfo *cur_ai, int64_t timeout) { ++ DnsCacheEntry *new_entry = NULL; ++ DnsCacheEntry *old_entry = NULL; ++ AVDictionaryEntry *elem = NULL; ++ ++ if (!uri || strlen(uri) == 0 || timeout <= 0) { ++ goto fail; ++ } ++ ++ if (cur_ai == NULL || cur_ai->ai_addr == NULL) { ++ goto fail; ++ } ++ ++ if (context && context->initialized) { ++ pthread_mutex_lock(&context->dns_dictionary_mutex); ++ elem = av_dict_get(context->dns_dictionary, uri, NULL, AV_DICT_MATCH_CASE); ++ if (elem) { ++ old_entry = (DnsCacheEntry *) (intptr_t) strtoll(elem->value, NULL, 10); ++ if (old_entry) { ++ pthread_mutex_unlock(&context->dns_dictionary_mutex); ++ goto fail; ++ } ++ } ++ new_entry = new_dns_cache_entry(uri, cur_ai, timeout); ++ if (new_entry) { ++ av_dict_set_int(&context->dns_dictionary, uri, (int64_t) (intptr_t) new_entry, 0); ++ } ++ pthread_mutex_unlock(&context->dns_dictionary_mutex); ++ ++ return 0; ++ } ++ ++fail: ++ return -1; ++} +diff --git a/libavformat/dns_cache.h b/libavformat/dns_cache.h +new file mode 100644 +index 0000000000..23c695e827 +--- /dev/null ++++ b/libavformat/dns_cache.h +@@ -0,0 +1,39 @@ ++/* ++ * copyright (c) 2017 Raymond Zheng ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#ifndef AVUTIL_DNS_CACHE_H ++#define AVUTIL_DNS_CACHE_H ++ ++#include "libavutil/log.h" ++#include ++ ++typedef struct DnsCacheEntry { ++ volatile int ref_count; ++ volatile int delete_flag; ++ int64_t expired_time; ++ struct addrinfo *res; // construct by private function, not support ai_next and ai_canonname, can only be released using free_private_addrinfo ++} DnsCacheEntry; ++ ++DnsCacheEntry *get_dns_cache_reference(const char *uri); ++int release_dns_cache_reference(const char *uri, DnsCacheEntry **p_entry); ++int remove_dns_cache_entry(const char *uri); ++int add_dns_cache_entry(const char *uri, struct addrinfo *cur_ai, int64_t timeout); ++ ++#endif /* AVUTIL_DNS_CACHE_H */ +-- +2.50.1 (Apple Git-155) + diff --git a/patches/ffmpeg-n8.1.1/0003-restore-ijk-http-event-hooks.patch b/patches/ffmpeg-n8.1.1/0003-restore-ijk-http-event-hooks.patch new file mode 100644 index 000000000..1e4027247 --- /dev/null +++ b/patches/ffmpeg-n8.1.1/0003-restore-ijk-http-event-hooks.patch @@ -0,0 +1,278 @@ +From 45eb43659ad56bcf3aea1ab1f5358c1995c57089 Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Fri, 8 May 2026 16:30:34 +0800 +Subject: restore ijk http event hooks + +--- + libavformat/http.c | 32 +++++++++++++++++++++++-- + libavformat/tcp.c | 58 +++++++++++++++++++++++++++++++++++++++++----- + libavutil/error.h | 4 ++++ + 3 files changed, 86 insertions(+), 8 deletions(-) + +diff --git a/libavformat/http.c b/libavformat/http.c +index 52073ffcb6..f4bf225728 100644 +--- a/libavformat/http.c ++++ b/libavformat/http.c +@@ -48,6 +48,7 @@ + #include "os_support.h" + #include "url.h" + #include "version.h" ++#include "application.h" + + /* XXX: POST protocol is not completely implemented because ffmpeg uses + * only a subset of it. */ +@@ -158,6 +159,9 @@ typedef struct HTTPContext { + int64_t sum_latency; /* divide by nb_requests */ + int64_t max_latency; + int max_redirects; ++ char *tcp_hook; ++ char *app_ctx_intptr; ++ AVApplicationContext *app_ctx; + } HTTPContext; + + #define OFFSET(x) offsetof(HTTPContext, x) +@@ -206,6 +210,8 @@ static const AVOption options[] = { + { "reply_code", "The http status code to return to a client", OFFSET(reply_code), AV_OPT_TYPE_INT, { .i64 = 200}, INT_MIN, 599, E}, + { "short_seek_size", "Threshold to favor readahead over seek.", OFFSET(short_seek_size), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, D }, + { "max_redirects", "Maximum number of redirects", OFFSET(max_redirects), AV_OPT_TYPE_INT, { .i64 = MAX_REDIRECTS }, 0, INT_MAX, D }, ++ { "http-tcp-hook", "hook protocol on tcp", OFFSET(tcp_hook), AV_OPT_TYPE_STRING, { .str = "tcp" }, 0, 0, D | E }, ++ { "ijkapplication", "AVApplicationContext", OFFSET(app_ctx_intptr), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, .flags = D }, + { NULL } + }; + +@@ -236,6 +242,7 @@ static int http_open_cnx_internal(URLContext *h, AVDictionary **options) + char buf[1024], urlbuf[MAX_URL_SIZE]; + int port, use_proxy, err = 0; + HTTPContext *s = h->priv_data; ++ lower_proto = s->tcp_hook; + + av_url_split(proto, sizeof(proto), auth, sizeof(auth), + hostname, sizeof(hostname), &port, +@@ -313,6 +320,13 @@ static int http_open_cnx_internal(URLContext *h, AVDictionary **options) + + if (!s->hd) { + s->nb_connections++; ++ av_dict_set_intptr(options, "ijkapplication", (uintptr_t)s->app_ctx, 0); ++ ++ // AVDictionaryEntry *t = NULL; ++ // while ((t = av_dict_get(*options, "", t, AV_DICT_IGNORE_SUFFIX))) { ++ // av_log(NULL, AV_LOG_INFO, "%-*s: %-*s = %s\n", 12, "http open tcp", 28, t->key, t->value); ++ // } ++ + err = ffurl_open_whitelist(&s->hd, buf, AVIO_FLAG_READ_WRITE, + &h->interrupt_callback, options, + h->protocol_whitelist, h->protocol_blacklist, h); +@@ -771,6 +785,7 @@ static int http_open(URLContext *h, const char *uri, int flags, + { + HTTPContext *s = h->priv_data; + int ret; ++ s->app_ctx = (AVApplicationContext *)av_dict_strtoptr(s->app_ctx_intptr); + + if( s->seekable == 1 ) + h->is_streamed = 0; +@@ -808,7 +823,9 @@ static int http_open(URLContext *h, const char *uri, int flags, + if (s->listen) { + return http_listen(h, uri, flags, options); + } ++ av_application_will_http_open(s->app_ctx, (void*)h, uri); + ret = http_open_cnx(h, options); ++ av_application_did_http_open(s->app_ctx, (void*)h, uri, ret, s->http_code, s->filesize); + bail_out: + if (ret < 0) { + av_dict_free(&s->chained_options); +@@ -1763,7 +1780,14 @@ static int http_buf_read(URLContext *h, uint8_t *buf, int size) + return AVERROR_EOF; + if (s->off == target_end && target_end < file_end) + return AVERROR(EAGAIN); /* reached end of content range */ +- len = ffurl_read(s->hd, buf, size); ++ len = size; ++ if (s->filesize > 0 && s->filesize != UINT64_MAX && s->filesize != INT32_MAX) { ++ int64_t unread = s->filesize - s->off; ++ if (len > unread) ++ len = (int)unread; ++ } ++ if (len > 0) ++ len = ffurl_read(s->hd, buf, len); + if ((!len || len == AVERROR_EOF) && + (!s->willclose || s->chunksize == UINT64_MAX) && s->off < target_end) { + av_log(h, AV_LOG_ERROR, +@@ -2158,7 +2182,9 @@ static int64_t http_seek_internal(URLContext *h, int64_t off, int whence, int fo + } + + /* if it fails, continue on old connection */ ++ av_application_will_http_seek(s->app_ctx, (void*)h, s->location, off); + if ((ret = http_open_cnx(h, &options)) < 0) { ++ av_application_did_http_seek(s->app_ctx, (void*)h, s->location, off, ret, s->http_code); + av_dict_free(&options); + memcpy(s->buffer, old_buf, old_buf_size); + s->buf_ptr = s->buffer; +@@ -2167,6 +2193,7 @@ static int64_t http_seek_internal(URLContext *h, int64_t off, int whence, int fo + s->off = old_off; + return ret; + } ++ av_application_did_http_seek(s->app_ctx, (void*)h, s->location, off, ret, s->http_code); + av_dict_free(&options); + ffurl_close(old_hd); + return off; +@@ -2260,6 +2287,7 @@ static int http_proxy_open(URLContext *h, const char *uri, int flags) + HTTPAuthType cur_auth_type; + char *authstr; + ++ s->app_ctx = (AVApplicationContext *)av_dict_strtoptr(s->app_ctx_intptr); + if( s->seekable == 1 ) + h->is_streamed = 0; + else +@@ -2272,7 +2300,7 @@ static int http_proxy_open(URLContext *h, const char *uri, int flags) + if (*path == '/') + path++; + +- ff_url_join(lower_url, sizeof(lower_url), "tcp", NULL, hostname, port, ++ ff_url_join(lower_url, sizeof(lower_url), s->tcp_hook, NULL, hostname, port, + NULL); + redo: + ret = ffurl_open_whitelist(&s->hd, lower_url, AVIO_FLAG_READ_WRITE, +diff --git a/libavformat/tcp.c b/libavformat/tcp.c +index ce9f69a50b..69b1e12c49 100644 +--- a/libavformat/tcp.c ++++ b/libavformat/tcp.c +@@ -24,7 +24,8 @@ + #include "libavutil/parseutils.h" + #include "libavutil/opt.h" + #include "libavutil/time.h" +- ++#include "libavutil/avstring.h" ++#include "application.h" + #include "internal.h" + #include "network.h" + #include "os_support.h" +@@ -49,6 +50,9 @@ typedef struct TCPContext { + #if !HAVE_WINSOCK2_H + int tcp_mss; + #endif /* !HAVE_WINSOCK2_H */ ++ ++ char * app_ctx_intptr; ++ AVApplicationContext *app_ctx; + } TCPContext; + + #define OFFSET(x) offsetof(TCPContext, x) +@@ -67,6 +71,8 @@ static const AVOption options[] = { + #if !HAVE_WINSOCK2_H + { "tcp_mss", "Maximum segment size for outgoing TCP packets", OFFSET(tcp_mss), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, .flags = D|E }, + #endif /* !HAVE_WINSOCK2_H */ ++ { "ijkapplication", "AVApplicationContext", OFFSET(app_ctx_intptr), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, .flags = D }, ++ { "connect_timeout", "set connect timeout (in microseconds) of socket", OFFSET(open_timeout), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, .flags = D|E }, + { NULL } + }; + +@@ -155,7 +161,21 @@ static int tcp_open(URLContext *h, const char *uri, int flags) + int ret; + char hostname[1024],proto[1024],path[1024]; + char portstr[10]; +- s->open_timeout = 5000000; ++ AVAppTcpIOControl control = {0}; ++ ++ int ret2; ++ if (s->open_timeout < 0) { ++ s->open_timeout = 15000000; ++ } ++ // av_log(NULL, AV_LOG_INFO, "xql tcp_open uri %s", uri); ++ // av_log(NULL, AV_LOG_INFO, "%-*s: %-*s = %s\n", 12, "xql tcp_open verify", 28, "ijkapplication", s->app_ctx_intptr); ++ // av_log(NULL, AV_LOG_INFO, "%-*s: %-*s = %d\n", 12, "xql tcp_open verify", 28, "connect_timeout", s->open_timeout); ++ // av_log(NULL, AV_LOG_INFO, "%-*s: %-*s = %d\n", 12, "xql tcp_open verify", 28, "addrinfo_one_by_one", s->addrinfo_one_by_one); ++ // av_log(NULL, AV_LOG_INFO, "%-*s: %-*s = %d\n", 12, "xql tcp_open verify", 28, "addrinfo_timeout", s->addrinfo_timeout); ++ // av_log(NULL, AV_LOG_INFO, "%-*s: %-*s = %d\n", 12, "xql tcp_open verify", 28, "dns_cache_timeout", s->dns_cache_timeout); ++ // av_log(NULL, AV_LOG_INFO, "%-*s: %-*s = %d\n", 12, "xql tcp_open verify", 28, "dns_cache_clear", s->dns_cache_clear); ++ ++ s->app_ctx = (AVApplicationContext *)av_dict_strtoptr(s->app_ctx_intptr); + + av_url_split(proto, sizeof(proto), NULL, 0, hostname, sizeof(hostname), + &port, path, sizeof(path), uri); +@@ -172,7 +192,7 @@ static int tcp_open(URLContext *h, const char *uri, int flags) + return ret; + } + if (s->rw_timeout >= 0) { +- s->open_timeout = ++ //s->open_timeout = + h->rw_timeout = s->rw_timeout; + } + hints.ai_family = AF_UNSPEC; +@@ -230,9 +250,24 @@ static int tcp_open(URLContext *h, const char *uri, int flags) + // Socket descriptor already closed here. Safe to overwrite to client one. + fd = ret; + } else { +- ret = ff_connect_parallel(ai, s->open_timeout / 1000, 3, h, &fd, customize_fd, s); ++ ret = av_application_on_tcp_will_open(s->app_ctx); ++ if (ret) { ++ av_log(NULL, AV_LOG_WARNING, "terminated by application in AVAPP_CTRL_WILL_TCP_OPEN"); ++ goto fail1; ++ } ++ ret = ff_connect_parallel(cur_ai, s->open_timeout / 1000, 3, h, &fd, customize_fd, s); ++ ++ ret2 = av_application_on_tcp_did_open(s->app_ctx, ret, fd, &control); ++ + if (ret < 0) + goto fail1; ++ ++ if (ret2) { ++ av_log(NULL, AV_LOG_WARNING, "terminated by application in AVAPP_CTRL_DID_TCP_OPEN"); ++ ret = ret2; ++ goto fail1; ++ } ++ av_log(NULL, AV_LOG_INFO, "tcp did open uri = %s, ip = %s\n", uri , control.ip); + } + + h->is_streamed = 1; +@@ -273,12 +308,18 @@ static int tcp_read(URLContext *h, uint8_t *buf, int size) + + if (!(h->flags & AVIO_FLAG_NONBLOCK)) { + ret = ff_network_wait_fd_timeout(s->fd, 0, h->rw_timeout, &h->interrupt_callback); +- if (ret) ++ if (ret) { ++ if (ret == AVERROR(ETIMEDOUT)) { ++ ret = AVERROR_TCP_READ_TIMEOUT; ++ } + return ret; ++ } + } + ret = recv(s->fd, buf, size, 0); + if (ret == 0) + return AVERROR_EOF; ++ if (ret > 0) ++ av_application_did_io_tcp_read(s->app_ctx, (void*)h, ret); + return ret < 0 ? ff_neterrno() : ret; + } + +@@ -289,9 +330,14 @@ static int tcp_write(URLContext *h, const uint8_t *buf, int size) + + if (!(h->flags & AVIO_FLAG_NONBLOCK)) { + ret = ff_network_wait_fd_timeout(s->fd, 1, h->rw_timeout, &h->interrupt_callback); +- if (ret) ++ if (ret) { ++ if (ret == AVERROR(ETIMEDOUT)) { ++ ret = AVERROR_TCP_WRITE_TIMEOUT; ++ } + return ret; ++ } + } ++ + ret = send(s->fd, buf, size, MSG_NOSIGNAL); + return ret < 0 ? ff_neterrno() : ret; + } +diff --git a/libavutil/error.h b/libavutil/error.h +index 1efa86c4c1..9dee755c69 100644 +--- a/libavutil/error.h ++++ b/libavutil/error.h +@@ -85,6 +85,10 @@ + + #define AV_ERROR_MAX_STRING_SIZE 64 + ++#define AVERROR_TCP_CONNECT_TIMEOUT -1001 ++#define AVERROR_TCP_READ_TIMEOUT -1002 ++#define AVERROR_TCP_WRITE_TIMEOUT -1003 ++ + /** + * Put a description of the AVERROR code errnum in errbuf. + * In case of failure the global variable errno is set to indicate the +-- +2.50.1 (Apple Git-155) + diff --git a/patches/ffmpeg-n8.1.1/0004-restore-ijk-tcp-dns-cache.patch b/patches/ffmpeg-n8.1.1/0004-restore-ijk-tcp-dns-cache.patch new file mode 100644 index 000000000..ae78fd000 --- /dev/null +++ b/patches/ffmpeg-n8.1.1/0004-restore-ijk-tcp-dns-cache.patch @@ -0,0 +1,404 @@ +From e3804da4a5b88dabf071ad5070070489a9efb874 Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Fri, 8 May 2026 16:39:50 +0800 +Subject: restore ijk tcp dns cache + +--- + libavformat/tcp.c | 324 ++++++++++++++++++++++++++++++++++++++++++++-- + 1 file changed, 310 insertions(+), 14 deletions(-) + +diff --git a/libavformat/tcp.c b/libavformat/tcp.c +index 69b1e12c49..46b48e609d 100644 +--- a/libavformat/tcp.c ++++ b/libavformat/tcp.c +@@ -26,6 +26,7 @@ + #include "libavutil/time.h" + #include "libavutil/avstring.h" + #include "application.h" ++#include "dns_cache.h" + #include "internal.h" + #include "network.h" + #include "os_support.h" +@@ -33,6 +34,9 @@ + #if HAVE_POLL_H + #include + #endif ++#if HAVE_PTHREADS ++#include ++#endif + + typedef struct TCPContext { + const AVClass *class; +@@ -52,6 +56,10 @@ typedef struct TCPContext { + #endif /* !HAVE_WINSOCK2_H */ + + char * app_ctx_intptr; ++ int addrinfo_one_by_one; ++ int addrinfo_timeout; ++ int64_t dns_cache_timeout; ++ int dns_cache_clear; + AVApplicationContext *app_ctx; + } TCPContext; + +@@ -73,9 +81,261 @@ static const AVOption options[] = { + #endif /* !HAVE_WINSOCK2_H */ + { "ijkapplication", "AVApplicationContext", OFFSET(app_ctx_intptr), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, .flags = D }, + { "connect_timeout", "set connect timeout (in microseconds) of socket", OFFSET(open_timeout), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, .flags = D|E }, ++ { "addrinfo_one_by_one", "parse addrinfo one by one in getaddrinfo()", OFFSET(addrinfo_one_by_one), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, .flags = D|E }, ++ { "addrinfo_timeout", "set timeout (in microseconds) for getaddrinfo()", OFFSET(addrinfo_timeout), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, .flags = D|E }, ++ { "dns_cache_timeout", "dns cache TTL (in microseconds)", OFFSET(dns_cache_timeout), AV_OPT_TYPE_INT, { .i64 = 0 }, -1, INT64_MAX, .flags = D|E }, ++ { "dns_cache_clear", "clear dns cache", OFFSET(dns_cache_clear), AV_OPT_TYPE_INT, { .i64 = 0}, -1, INT_MAX, .flags = D|E }, + { NULL } + }; + ++int ijk_tcp_getaddrinfo_nonblock(const char *hostname, const char *servname, ++ const struct addrinfo *hints, struct addrinfo **res, ++ int64_t timeout, ++ const AVIOInterruptCB *int_cb, int one_by_one); ++#ifdef HAVE_PTHREADS ++ ++typedef struct TCPAddrinfoRequest ++{ ++ AVBufferRef *buffer; ++ ++ pthread_mutex_t mutex; ++ pthread_cond_t cond; ++ ++ AVIOInterruptCB interrupt_callback; ++ ++ char *hostname; ++ char *servname; ++ struct addrinfo hints; ++ struct addrinfo *res; ++ ++ volatile int finished; ++ int last_error; ++} TCPAddrinfoRequest; ++ ++static void tcp_getaddrinfo_request_free(TCPAddrinfoRequest *req) ++{ ++ av_assert0(req); ++ if (req->res) { ++ freeaddrinfo(req->res); ++ req->res = NULL; ++ } ++ ++ av_freep(&req->servname); ++ av_freep(&req->hostname); ++ pthread_cond_destroy(&req->cond); ++ pthread_mutex_destroy(&req->mutex); ++ av_freep(&req); ++} ++ ++static void tcp_getaddrinfo_request_free_buffer(void *opaque, uint8_t *data) ++{ ++ av_assert0(opaque); ++ TCPAddrinfoRequest *req = (TCPAddrinfoRequest *)opaque; ++ tcp_getaddrinfo_request_free(req); ++} ++ ++static int tcp_getaddrinfo_request_create(TCPAddrinfoRequest **request, ++ const char *hostname, ++ const char *servname, ++ const struct addrinfo *hints, ++ const AVIOInterruptCB *int_cb) ++{ ++ TCPAddrinfoRequest *req = (TCPAddrinfoRequest *) av_mallocz(sizeof(TCPAddrinfoRequest)); ++ if (!req) ++ return AVERROR(ENOMEM); ++ ++ if (pthread_mutex_init(&req->mutex, NULL)) { ++ av_freep(&req); ++ return AVERROR(ENOMEM); ++ } ++ ++ if (pthread_cond_init(&req->cond, NULL)) { ++ pthread_mutex_destroy(&req->mutex); ++ av_freep(&req); ++ return AVERROR(ENOMEM); ++ } ++ ++ if (int_cb) ++ req->interrupt_callback = *int_cb; ++ ++ if (hostname) { ++ req->hostname = av_strdup(hostname); ++ if (!req->hostname) ++ goto fail; ++ } ++ ++ if (servname) { ++ req->servname = av_strdup(servname); ++ if (!req->hostname) ++ goto fail; ++ } ++ ++ if (hints) { ++ req->hints.ai_family = hints->ai_family; ++ req->hints.ai_socktype = hints->ai_socktype; ++ req->hints.ai_protocol = hints->ai_protocol; ++ req->hints.ai_flags = hints->ai_flags; ++ } ++ ++ req->buffer = av_buffer_create(NULL, 0, tcp_getaddrinfo_request_free_buffer, req, 0); ++ if (!req->buffer) ++ goto fail; ++ ++ *request = req; ++ return 0; ++fail: ++ tcp_getaddrinfo_request_free(req); ++ return AVERROR(ENOMEM); ++} ++ ++static void *tcp_getaddrinfo_worker(void *arg) ++{ ++ TCPAddrinfoRequest *req = arg; ++ ++ getaddrinfo(req->hostname, req->servname, &req->hints, &req->res); ++ pthread_mutex_lock(&req->mutex); ++ req->finished = 1; ++ pthread_cond_signal(&req->cond); ++ pthread_mutex_unlock(&req->mutex); ++ av_buffer_unref(&req->buffer); ++ return NULL; ++} ++ ++static void *tcp_getaddrinfo_one_by_one_worker(void *arg) ++{ ++ struct addrinfo *temp_addrinfo = NULL; ++ struct addrinfo *cur = NULL; ++ int ret = EAI_FAIL; ++ int i = 0; ++ int option_length = 0; ++ ++ TCPAddrinfoRequest *req = (TCPAddrinfoRequest *)arg; ++ ++ int family_option[2] = {AF_INET, AF_INET6}; ++ ++ option_length = sizeof(family_option) / sizeof(family_option[0]); ++ ++ for (; i < option_length; ++i) { ++ struct addrinfo *hint = &req->hints; ++ hint->ai_family = family_option[i]; ++ ret = getaddrinfo(req->hostname, req->servname, hint, &temp_addrinfo); ++ if (ret) { ++ req->last_error = ret; ++ continue; ++ } ++ pthread_mutex_lock(&req->mutex); ++ if (!req->res) { ++ req->res = temp_addrinfo; ++ } else { ++ cur = req->res; ++ while (cur->ai_next) ++ cur = cur->ai_next; ++ cur->ai_next = temp_addrinfo; ++ } ++ pthread_mutex_unlock(&req->mutex); ++ } ++ pthread_mutex_lock(&req->mutex); ++ req->finished = 1; ++ pthread_cond_signal(&req->cond); ++ pthread_mutex_unlock(&req->mutex); ++ av_buffer_unref(&req->buffer); ++ return NULL; ++} ++ ++int ijk_tcp_getaddrinfo_nonblock(const char *hostname, const char *servname, ++ const struct addrinfo *hints, struct addrinfo **res, ++ int64_t timeout, ++ const AVIOInterruptCB *int_cb, int one_by_one) ++{ ++ int ret; ++ int64_t start; ++ int64_t now; ++ AVBufferRef *req_ref = NULL; ++ TCPAddrinfoRequest *req = NULL; ++ pthread_t work_thread; ++ ++ if (hostname && !hostname[0]) ++ hostname = NULL; ++ av_log(NULL, AV_LOG_DEBUG, "dns getaddrinfo uri = %s\n", hostname); ++ if (timeout <= 0) ++ return getaddrinfo(hostname, servname, hints, res); ++ av_log(NULL, AV_LOG_DEBUG, "dns tcp_getaddrinfo_request_create uri = %s\n", hostname); ++ ret = tcp_getaddrinfo_request_create(&req, hostname, servname, hints, int_cb); ++ if (ret) ++ goto fail; ++ ++ req_ref = av_buffer_ref(req->buffer); ++ if (req_ref == NULL) { ++ ret = AVERROR(ENOMEM); ++ goto fail; ++ } ++ ++ /* FIXME: using a thread pool would be better. */ ++ if (one_by_one) ++ ret = pthread_create(&work_thread, NULL, tcp_getaddrinfo_one_by_one_worker, req); ++ else ++ ret = pthread_create(&work_thread, NULL, tcp_getaddrinfo_worker, req); ++ ++ if (ret) { ++ ret = AVERROR(ret); ++ goto fail; ++ } ++ ++ pthread_detach(work_thread); ++ ++ start = av_gettime(); ++ now = start; ++ ++ pthread_mutex_lock(&req->mutex); ++ while (1) { ++ int64_t wait_time = now + 100000; ++ struct timespec tv = { .tv_sec = wait_time / 1000000, ++ .tv_nsec = (wait_time % 1000000) * 1000 }; ++ ++ if (req->finished || (start + timeout < now)) { ++ if (req->res) { ++ ret = 0; ++ *res = req->res; ++ req->res = NULL; ++ } else { ++ ret = req->last_error ? req->last_error : AVERROR_EXIT; ++ } ++ break; ++ } ++#if defined(__ANDROID__) && defined(HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC) ++ ret = pthread_cond_timedwait_monotonic_np(&req->cond, &req->mutex, &tv); ++#else ++ ret = pthread_cond_timedwait(&req->cond, &req->mutex, &tv); ++#endif ++ if (ret != 0 && ret != ETIMEDOUT) { ++ av_log(NULL, AV_LOG_ERROR, "pthread_cond_timedwait failed: %d\n", ret); ++ ret = AVERROR_EXIT; ++ break; ++ } ++ ++ if (ff_check_interrupt(&req->interrupt_callback)) { ++ ret = AVERROR_EXIT; ++ break; ++ } ++ ++ now = av_gettime(); ++ } ++ pthread_mutex_unlock(&req->mutex); ++fail: ++ av_buffer_unref(&req_ref); ++ return ret; ++} ++ ++#else ++int ijk_tcp_getaddrinfo_nonblock(const char *hostname, const char *servname, ++ const struct addrinfo *hints, struct addrinfo **res, ++ int64_t timeout, ++ const AVIOInterruptCB *int_cb) ++{ ++ return getaddrinfo(hostname, servname, hints, res); ++} ++#endif ++ + static const AVClass tcp_class = { + .class_name = "tcp", + .item_name = av_default_item_name, +@@ -162,7 +422,7 @@ static int tcp_open(URLContext *h, const char *uri, int flags) + char hostname[1024],proto[1024],path[1024]; + char portstr[10]; + AVAppTcpIOControl control = {0}; +- ++ DnsCacheEntry *dns_entry = NULL; + int ret2; + if (s->open_timeout < 0) { + s->open_timeout = 15000000; +@@ -200,18 +460,37 @@ static int tcp_open(URLContext *h, const char *uri, int flags) + snprintf(portstr, sizeof(portstr), "%d", port); + if (s->listen) + hints.ai_flags |= AI_PASSIVE; +- if (!hostname[0]) +- ret = getaddrinfo(NULL, portstr, &hints, &ai); +- else +- ret = getaddrinfo(hostname, portstr, &hints, &ai); +- if (ret) { +- av_log(h, AV_LOG_ERROR, +- "Failed to resolve hostname %s: %s\n", +- hostname, gai_strerror(ret)); +- return AVERROR(EIO); ++ if (s->dns_cache_timeout > 0) { ++ if (s->dns_cache_clear) { ++ remove_dns_cache_entry(uri); ++ } else { ++ dns_entry = get_dns_cache_reference(uri); ++ } + } + +- cur_ai = ai; ++ if (!dns_entry) { ++#ifdef HAVE_PTHREADS ++ ret = ijk_tcp_getaddrinfo_nonblock(hostname, portstr, &hints, &ai, s->addrinfo_timeout, &h->interrupt_callback, s->addrinfo_one_by_one); ++#else ++ if (s->addrinfo_timeout > 0) ++ av_log(h, AV_LOG_WARNING, "Ignore addrinfo_timeout without pthreads support.\n"); ++ if (!hostname[0]) ++ ret = getaddrinfo(NULL, portstr, &hints, &ai); ++ else ++ ret = getaddrinfo(hostname, portstr, &hints, &ai); ++#endif ++ if (ret) { ++ av_log(h, AV_LOG_ERROR, ++ "Failed to resolve hostname %s: %s\n", ++ hostname, gai_strerror(ret)); ++ return AVERROR(EIO); ++ } ++ ++ cur_ai = ai; ++ } else { ++ av_log(NULL, AV_LOG_DEBUG, "hit dns cache uri = %s\n", uri); ++ cur_ai = dns_entry->res; ++ } + + #if HAVE_STRUCT_SOCKADDR_IN6 + // workaround for IOS9 getaddrinfo in IPv6 only network use hardcode IPv4 address can not resolve port number. +@@ -267,19 +546,36 @@ static int tcp_open(URLContext *h, const char *uri, int flags) + ret = ret2; + goto fail1; + } +- av_log(NULL, AV_LOG_INFO, "tcp did open uri = %s, ip = %s\n", uri , control.ip); ++ ++ if (!dns_entry && !strstr(uri, control.ip) && s->dns_cache_timeout > 0) { ++ add_dns_cache_entry(uri, cur_ai, s->dns_cache_timeout); ++ av_log(NULL, AV_LOG_DEBUG, "add dns cache uri = %s, ip = %s\n", uri , control.ip); ++ } ++ av_log(NULL, AV_LOG_DEBUG, "tcp did open uri = %s, ip = %s\n", uri , control.ip); + } + + h->is_streamed = 1; + s->fd = fd; + +- freeaddrinfo(ai); ++ if (dns_entry) { ++ release_dns_cache_reference(uri, &dns_entry); ++ } else { ++ freeaddrinfo(ai); ++ } + return 0; + + fail1: + if (fd >= 0) + closesocket(fd); +- freeaddrinfo(ai); ++ ++ if (dns_entry) { ++ av_log(NULL, AV_LOG_ERROR, "hit dns cache but connect fail uri = %s, ip = %s\n", uri , control.ip); ++ release_dns_cache_reference(uri, &dns_entry); ++ remove_dns_cache_entry(uri); ++ } else { ++ freeaddrinfo(cur_ai); ++ } ++ + return ret; + } + +-- +2.50.1 (Apple Git-155) + diff --git a/patches/ffmpeg-n8.1.1/0005-restore-ijk-custom-protocols-and-demuxers-except-lon.patch b/patches/ffmpeg-n8.1.1/0005-restore-ijk-custom-protocols-and-demuxers-except-lon.patch new file mode 100644 index 000000000..892c44c78 --- /dev/null +++ b/patches/ffmpeg-n8.1.1/0005-restore-ijk-custom-protocols-and-demuxers-except-lon.patch @@ -0,0 +1,277 @@ +From 5f75c2d325ee7519854a826f85d7b97187052eae Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Fri, 8 May 2026 17:02:15 +0800 +Subject: restore ijk custom protocols and demuxers except long + url and async + +--- + libavcodec/Makefile | 1 + + libavformat/Makefile | 10 ++++ + libavformat/allformats.c | 3 ++ + libavformat/demux.c | 13 +++++ + libavformat/demux.h | 2 + + libavformat/ijkutils.c | 107 +++++++++++++++++++++++++++++++++++++++ + libavformat/protocols.c | 6 +++ + libavutil/Makefile | 3 +- + 8 files changed, 144 insertions(+), 1 deletion(-) + create mode 100644 libavformat/ijkutils.c + +diff --git a/libavcodec/Makefile b/libavcodec/Makefile +index 1410bd8142..4445d9ea61 100644 +--- a/libavcodec/Makefile ++++ b/libavcodec/Makefile +@@ -26,6 +26,7 @@ HEADERS = ac3_parser.h \ + version_major.h \ + videotoolbox.h \ + vorbis_parser.h \ ++ packet_internal.h \ + + OBJS = ac3_parser.o \ + adts_parser.o \ +diff --git a/libavformat/Makefile b/libavformat/Makefile +index 3c95fc4b7f..85ed05b0f2 100644 +--- a/libavformat/Makefile ++++ b/libavformat/Makefile +@@ -7,6 +7,15 @@ HEADERS = avformat.h \ + version_major.h \ + application.h \ + dns_cache.h \ ++ demux.h \ ++ avc.h \ ++ url.h \ ++ internal.h \ ++ avio_internal.h \ ++ flv.h \ ++ id3v2.h \ ++ os_support.h \ ++ metadata.h \ + + + OBJS = allformats.o \ +@@ -40,6 +49,7 @@ OBJS = allformats.o \ + vpcc.o \ + application.o \ + dns_cache.o \ ++ ijkutils.o \ + + OBJS-$(HAVE_LIBC_MSVCRT) += file_open.o + +diff --git a/libavformat/allformats.c b/libavformat/allformats.c +index 6ec361fb7b..0c2d5caf82 100644 +--- a/libavformat/allformats.c ++++ b/libavformat/allformats.c +@@ -584,6 +584,9 @@ extern const FFInputFormat ff_libmodplug_demuxer; + extern const FFInputFormat ff_libopenmpt_demuxer; + extern const FFInputFormat ff_vapoursynth_demuxer; + ++// ijk custom demuxers ++extern FFInputFormat ff_ijklivehook_demuxer; ++ + #include "libavformat/muxer_list.c" + #include "libavformat/demuxer_list.c" + +diff --git a/libavformat/demux.c b/libavformat/demux.c +index a1909237f0..05ab1e172d 100644 +--- a/libavformat/demux.c ++++ b/libavformat/demux.c +@@ -235,6 +235,7 @@ int avformat_open_input(AVFormatContext **ps, const char *filename, + AVFormatContext *s = *ps; + FFFormatContext *si; + AVDictionary *tmp = NULL; ++ AVDictionary *tmp2 = NULL; + ID3v2ExtraMeta *id3v2_extra_meta = NULL; + int ret = 0; + +@@ -318,6 +319,16 @@ int avformat_open_input(AVFormatContext **ps, const char *filename, + /* e.g. AVFMT_NOFILE formats will not have an AVIOContext */ + if (s->pb && is_id3v2_format(s->iformat)) + ff_id3v2_read_dict(s->pb, &si->id3v2_meta, ID3v2_DEFAULT_MAGIC, &id3v2_extra_meta); ++ ++ if (ffifmt(s->iformat)->read_header2) { ++ if (options) ++ av_dict_copy(&tmp2,*options, 0); ++ if ((ret = ffifmt(s->iformat)->read_header2(s, &tmp2)) < 0) { ++ if (ffifmt(s->iformat)->flags_internal & FF_INFMT_FLAG_INIT_CLEANUP) ++ goto close; ++ goto fail; ++ } ++ } else + + if (ffifmt(s->iformat)->read_header) + if ((ret = ffifmt(s->iformat)->read_header(s)) < 0) { +@@ -357,6 +368,7 @@ int avformat_open_input(AVFormatContext **ps, const char *filename, + if (options) { + av_dict_free(options); + *options = tmp; ++ av_dict_free(&tmp2); + } + *ps = s; + return 0; +@@ -367,6 +379,7 @@ close: + fail: + ff_id3v2_free_extra_meta(&id3v2_extra_meta); + av_dict_free(&tmp); ++ av_dict_free(&tmp2); + if (s->pb && !(s->flags & AVFMT_FLAG_CUSTOM_IO)) + avio_closep(&s->pb); + avformat_free_context(s); +diff --git a/libavformat/demux.h b/libavformat/demux.h +index f09afc849f..531c433968 100644 +--- a/libavformat/demux.h ++++ b/libavformat/demux.h +@@ -98,6 +98,8 @@ typedef struct FFInputFormat { + */ + int (*read_header)(struct AVFormatContext *); + ++ int (*read_header2)(struct AVFormatContext *, AVDictionary **options); ++ + /** + * Read one packet and put it in 'pkt'. pts and flags are also + * set. 'avformat_new_stream' can be called only if the flag +diff --git a/libavformat/ijkutils.c b/libavformat/ijkutils.c +new file mode 100644 +index 0000000000..0314c48d8b +--- /dev/null ++++ b/libavformat/ijkutils.c +@@ -0,0 +1,107 @@ ++/* ++ * utils.c ++ * ++ * Copyright (c) 2003 Fabrice Bellard ++ * Copyright (c) 2013 Zhang Rui ++ * ++ * This file is part of ijkPlayer. ++ * ++ * ijkPlayer is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * ijkPlayer is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with ijkPlayer; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#include ++#include "url.h" ++#include "demux.h" ++ ++ ++#define IJK_FF_PROTOCOL(x) \ ++extern URLProtocol ff_##x##_protocol; \ ++int ijkav_register_##x##_protocol(URLProtocol *protocol, int protocol_size); \ ++int ijkav_register_##x##_protocol(URLProtocol *protocol, int protocol_size) \ ++{ \ ++ if (protocol_size != sizeof(URLProtocol)) { \ ++ av_log(NULL, AV_LOG_ERROR, "ijkav_register_##x##_protocol: ABI mismatch.\n"); \ ++ return -1; \ ++ } \ ++ memcpy(&ff_##x##_protocol, protocol, protocol_size); \ ++ return 0; \ ++} ++ ++#define IJK_DUMMY_PROTOCOL(x) \ ++IJK_FF_PROTOCOL(x); \ ++static const AVClass ijk_##x##_context_class = { \ ++ .class_name = #x, \ ++ .item_name = av_default_item_name, \ ++ .version = LIBAVUTIL_VERSION_INT, \ ++ }; \ ++ \ ++URLProtocol ff_##x##_protocol = { \ ++ .name = #x, \ ++ .url_open2 = ijkdummy_open, \ ++ .priv_data_size = 1, \ ++ .priv_data_class = &ijk_##x##_context_class, \ ++}; ++ ++static int ijkdummy_open(URLContext *h, const char *arg, int flags, AVDictionary **options) ++{ ++ return -1; ++} ++ ++static int ijkdummy_probe(const AVProbeData *p) ++{ ++ return AVERROR_INVALIDDATA; ++} ++ ++IJK_DUMMY_PROTOCOL(ijkmediadatasource); ++IJK_DUMMY_PROTOCOL(ijkhttphook); ++IJK_DUMMY_PROTOCOL(ijksegment); ++IJK_DUMMY_PROTOCOL(ijktcphook); ++IJK_DUMMY_PROTOCOL(ijkio); ++ ++#define IJK_FF_DEMUXER(x) \ ++extern FFInputFormat ff_##x##_demuxer; \ ++int ijkav_register_##x##_demuxer(FFInputFormat *demuxer, int demuxer_size); \ ++int ijkav_register_##x##_demuxer(FFInputFormat *demuxer, int demuxer_size) \ ++{ \ ++ if (demuxer_size != sizeof(FFInputFormat)) { \ ++ av_log(NULL, AV_LOG_ERROR, "ijkav_register_##x##_demuxer: ABI mismatch.\n"); \ ++ return -1; \ ++ } \ ++ memcpy(&ff_##x##_demuxer, demuxer, demuxer_size); \ ++ return 0; \ ++} ++ ++#define IJK_DUMMY_DEMUXER(x) \ ++IJK_FF_DEMUXER(x); \ ++static const AVClass ijk_##x##_demuxer_class = { \ ++ .class_name = #x, \ ++ .item_name = av_default_item_name, \ ++ .version = LIBAVUTIL_VERSION_INT, \ ++ }; \ ++ \ ++FFInputFormat ff_##x##_demuxer = { \ ++ .p.name = #x, \ ++ .p.priv_class = &ijk_##x##_demuxer_class, \ ++ .priv_data_size = 1, \ ++ .flags_internal = FF_INFMT_FLAG_INIT_CLEANUP, \ ++ .read_probe = ijkdummy_probe, \ ++}; ++ ++/* ++ libavformat/ijkutils.c:99:1: error: field designator 'priv_data_size' does not refer to any field in type 'AVInputFormat' (aka 'struct AVInputFormat') ++ 99 | IJK_DUMMY_DEMUXER(ijklivehook); ++ ++ */ ++IJK_DUMMY_DEMUXER(ijklivehook); +diff --git a/libavformat/protocols.c b/libavformat/protocols.c +index 207b6bf8d9..de0926beea 100644 +--- a/libavformat/protocols.c ++++ b/libavformat/protocols.c +@@ -79,6 +79,12 @@ extern const URLProtocol ff_libzmq_protocol; + extern const URLProtocol ff_ipfs_gateway_protocol; + extern const URLProtocol ff_ipns_gateway_protocol; + ++extern const URLProtocol ff_ijkhttphook_protocol; ++extern const URLProtocol ff_ijkmediadatasource_protocol; ++extern const URLProtocol ff_ijksegment_protocol; ++extern const URLProtocol ff_ijktcphook_protocol; ++extern const URLProtocol ff_ijkio_protocol; ++ + #include "libavformat/protocol_list.c" + + const AVClass *ff_urlcontext_child_class_iterate(void **iter) +diff --git a/libavutil/Makefile b/libavutil/Makefile +index c5241895ff..a9fbf9923b 100644 +--- a/libavutil/Makefile ++++ b/libavutil/Makefile +@@ -99,7 +99,8 @@ HEADERS = adler32.h \ + xtea.h \ + tea.h \ + tx.h \ +- video_hint.h ++ video_hint.h \ ++ thread.h \ + + ARCH_HEADERS = bswap.h \ + intmath.h \ +-- +2.50.1 (Apple Git-155) + diff --git a/patches/ffmpeg-n8.1.1/0006-add-4-dummy-ijkplaceholder-demuxers.patch b/patches/ffmpeg-n8.1.1/0006-add-4-dummy-ijkplaceholder-demuxers.patch new file mode 100644 index 000000000..1934eb00d --- /dev/null +++ b/patches/ffmpeg-n8.1.1/0006-add-4-dummy-ijkplaceholder-demuxers.patch @@ -0,0 +1,41 @@ +From eb2b38cb1107ecaa18fef1594300f9700f64318a Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Fri, 8 May 2026 17:02:34 +0800 +Subject: add 4 dummy ijkplaceholder demuxers + +--- + libavformat/allformats.c | 4 ++++ + libavformat/ijkutils.c | 4 ++++ + 2 files changed, 8 insertions(+) + +diff --git a/libavformat/allformats.c b/libavformat/allformats.c +index 0c2d5caf82..e2f37da7a1 100644 +--- a/libavformat/allformats.c ++++ b/libavformat/allformats.c +@@ -586,6 +586,10 @@ extern const FFInputFormat ff_vapoursynth_demuxer; + + // ijk custom demuxers + extern FFInputFormat ff_ijklivehook_demuxer; ++extern FFInputFormat ff_ijkplaceholder1_demuxer; ++extern FFInputFormat ff_ijkplaceholder2_demuxer; ++extern FFInputFormat ff_ijkplaceholder3_demuxer; ++extern FFInputFormat ff_ijkplaceholder4_demuxer; + + #include "libavformat/muxer_list.c" + #include "libavformat/demuxer_list.c" +diff --git a/libavformat/ijkutils.c b/libavformat/ijkutils.c +index 0314c48d8b..ac80e548f4 100644 +--- a/libavformat/ijkutils.c ++++ b/libavformat/ijkutils.c +@@ -105,3 +105,7 @@ FFInputFormat ff_##x##_demuxer = { \ + + */ + IJK_DUMMY_DEMUXER(ijklivehook); ++IJK_DUMMY_DEMUXER(ijkplaceholder1); ++IJK_DUMMY_DEMUXER(ijkplaceholder2); ++IJK_DUMMY_DEMUXER(ijkplaceholder3); ++IJK_DUMMY_DEMUXER(ijkplaceholder4); +\ No newline at end of file +-- +2.50.1 (Apple Git-155) + diff --git a/patches/ffmpeg-n8.1.1/0007-add-3-dummy-ijkhttp-protocols.patch b/patches/ffmpeg-n8.1.1/0007-add-3-dummy-ijkhttp-protocols.patch new file mode 100644 index 000000000..2078848a3 --- /dev/null +++ b/patches/ffmpeg-n8.1.1/0007-add-3-dummy-ijkhttp-protocols.patch @@ -0,0 +1,41 @@ +From 637a50bedd7a8761f79f30f8fd1bd6bc212533a5 Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Fri, 8 May 2026 17:07:35 +0800 +Subject: add 3 dummy ijkhttp protocols + +--- + libavformat/ijkutils.c | 3 +++ + libavformat/protocols.c | 3 +++ + 2 files changed, 6 insertions(+) + +diff --git a/libavformat/ijkutils.c b/libavformat/ijkutils.c +index ac80e548f4..ba8eadd131 100644 +--- a/libavformat/ijkutils.c ++++ b/libavformat/ijkutils.c +@@ -69,6 +69,9 @@ IJK_DUMMY_PROTOCOL(ijkhttphook); + IJK_DUMMY_PROTOCOL(ijksegment); + IJK_DUMMY_PROTOCOL(ijktcphook); + IJK_DUMMY_PROTOCOL(ijkio); ++IJK_DUMMY_PROTOCOL(ijkhttp1); ++IJK_DUMMY_PROTOCOL(ijkhttp2); ++IJK_DUMMY_PROTOCOL(ijkhttp3); + + #define IJK_FF_DEMUXER(x) \ + extern FFInputFormat ff_##x##_demuxer; \ +diff --git a/libavformat/protocols.c b/libavformat/protocols.c +index de0926beea..d1c1095364 100644 +--- a/libavformat/protocols.c ++++ b/libavformat/protocols.c +@@ -84,6 +84,9 @@ extern const URLProtocol ff_ijkmediadatasource_protocol; + extern const URLProtocol ff_ijksegment_protocol; + extern const URLProtocol ff_ijktcphook_protocol; + extern const URLProtocol ff_ijkio_protocol; ++extern const URLProtocol ff_ijkhttp1_protocol; ++extern const URLProtocol ff_ijkhttp2_protocol; ++extern const URLProtocol ff_ijkhttp3_protocol; + + #include "libavformat/protocol_list.c" + +-- +2.50.1 (Apple Git-155) + diff --git a/patches/ffmpeg-n8.1.1/0008-restore-ijk-av_dict_get-that-converts-the-value-to-a.patch b/patches/ffmpeg-n8.1.1/0008-restore-ijk-av_dict_get-that-converts-the-value-to-a.patch new file mode 100644 index 000000000..ef23fdfe1 --- /dev/null +++ b/patches/ffmpeg-n8.1.1/0008-restore-ijk-av_dict_get-that-converts-the-value-to-a.patch @@ -0,0 +1,91 @@ +From aa354e9e139f7b028d71c92afe72dfef97c61dc0 Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Wed, 28 May 2025 18:33:27 +0800 +Subject: restore ijk av_dict_get that converts the value to a + pointer + +--- + libavutil/dict.c | 39 ++++++++++++++++++++++++++++++++++++++- + libavutil/dict.h | 9 +++++++++ + 2 files changed, 47 insertions(+), 1 deletion(-) + +diff --git a/libavutil/dict.c b/libavutil/dict.c +index fafb454fd3..db8ee05699 100644 +--- a/libavutil/dict.c ++++ b/libavutil/dict.c +@@ -63,7 +63,7 @@ AVDictionaryEntry *av_dict_get(const AVDictionary *m, const char *key, + const AVDictionaryEntry *entry = prev; + unsigned int j; + +- if (!key) ++ if (!m || !key) + return NULL; + + while ((entry = av_dict_iterate(m, entry))) { +@@ -183,6 +183,43 @@ int av_dict_set_int(AVDictionary **pm, const char *key, int64_t value, + return av_dict_set(pm, key, valuestr, flags); + } + ++int av_dict_set_intptr(AVDictionary **pm, const char *key, uintptr_t value, ++ int flags) ++{ ++ char valuestr[22]; ++ snprintf(valuestr, sizeof(valuestr), "%p", value); ++ flags &= ~AV_DICT_DONT_STRDUP_VAL; ++ return av_dict_set(pm, key, valuestr, flags); ++} ++ ++uintptr_t av_dict_get_intptr(const AVDictionary *m, const char* key) { ++ uintptr_t ptr = NULL; ++ AVDictionaryEntry *t = NULL; ++ if ((t = av_dict_get(m, key, NULL, 0))) { ++ return av_dict_strtoptr(t->value); ++ } ++ return NULL; ++} ++ ++uintptr_t av_dict_strtoptr(char * value) { ++ uintptr_t ptr = NULL; ++ char *next = NULL; ++ if(!value || value[0] !='0' || (value[1]|0x20)!='x') { ++ return NULL; ++ } ++ ptr = strtoull(value, &next, 16); ++ if (next == value) { ++ return NULL; ++ } ++ return ptr; ++} ++ ++char * av_dict_ptrtostr(uintptr_t value) { ++ char valuestr[22] = {0}; ++ snprintf(valuestr, sizeof(valuestr), "%p", value); ++ return av_strdup(valuestr); ++} ++ + static int parse_key_value_pair(AVDictionary **pm, const char **buf, + const char *key_val_sep, const char *pairs_sep, + int flags) +diff --git a/libavutil/dict.h b/libavutil/dict.h +index 93c7cbf128..d97a601f66 100644 +--- a/libavutil/dict.h ++++ b/libavutil/dict.h +@@ -173,6 +173,15 @@ int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags + */ + int av_dict_set_int(AVDictionary **pm, const char *key, int64_t value, int flags); + ++/** ++ * Convenience wrapper for av_dict_get that converts the value to a pointer ++ * and stores it. ++ */ ++int av_dict_set_intptr(AVDictionary **pm, const char *key, uintptr_t value, int flags); ++uintptr_t av_dict_get_intptr(const AVDictionary *m, const char* key); ++uintptr_t av_dict_strtoptr(char * value); ++char * av_dict_ptrtostr(uintptr_t value); ++ + /** + * Parse the key/value pairs list and add the parsed entries to a dictionary. + * +-- +2.50.1 (Apple Git-155) + diff --git a/patches/ffmpeg-n8.1.1/0009-control-which-http-impl-was-used-by-set-selected_htt.patch b/patches/ffmpeg-n8.1.1/0009-control-which-http-impl-was-used-by-set-selected_htt.patch new file mode 100644 index 000000000..5bc4d75bc --- /dev/null +++ b/patches/ffmpeg-n8.1.1/0009-control-which-http-impl-was-used-by-set-selected_htt.patch @@ -0,0 +1,129 @@ +From 453a18e73206f0074fe6cf94240b9066cf95f6d0 Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Wed, 28 May 2025 18:25:51 +0800 +Subject: control which http impl was used by set selected_http + option + +--- + libavformat/avio.c | 63 ++++++++++++++++++++++++++++++++++++++++++++-- + libavformat/url.h | 16 ++++++++++++ + 2 files changed, 77 insertions(+), 2 deletions(-) + +diff --git a/libavformat/avio.c b/libavformat/avio.c +index b146ac9f19..0287cc6092 100644 +--- a/libavformat/avio.c ++++ b/libavformat/avio.c +@@ -360,6 +360,65 @@ int ffurl_alloc(URLContext **puc, const char *filename, int flags, + return AVERROR_PROTOCOL_NOT_FOUND; + } + ++ ++static const struct URLProtocol *url_find_the_protocol(const char *proto_str) ++{ ++ const URLProtocol **protocols = ffurl_get_protocols(NULL, NULL); ++ if (!protocols) ++ return NULL; ++ for (int i = 0; protocols[i]; i++) { ++ const URLProtocol *up = protocols[i]; ++ if (!strcmp(proto_str, up->name)) { ++ av_freep(&protocols); ++ return up; ++ } ++ } ++ av_freep(&protocols); ++ return NULL; ++} ++ ++int ffurl_alloc2(URLContext **puc, const char *filename, int flags, ++ const AVIOInterruptCB *int_cb, AVDictionary **options) ++{ ++ if (options && *options) { ++ AVDictionaryEntry *e = av_dict_get(*options, "selected_http", NULL, 0); ++ const char *selected_http; ++ if (e && (selected_http = e->value)) { ++ ++ char proto_str[128] = {0}; ++ size_t proto_len = strspn(filename, URL_SCHEME_CHARS); ++ if (filename[proto_len] != ':' && ++ (strncmp(filename, "subfile,", 8) || !strchr(filename + proto_len + 1, ':')) || ++ is_dos_path(filename)) ++ strcpy(proto_str, "file"); ++ else ++ av_strlcpy(proto_str, filename, ++ FFMIN(proto_len + 1, sizeof(proto_str))); ++ //only apply http protocol ++ if (!strcmp(proto_str, "http") || !strcmp(proto_str, "https")) { ++ if (!strcmp(selected_http, "ijkhttp1") || !strcmp(selected_http, "ijkhttp2") || !strcmp(selected_http, "ijkhttp3")) { ++ const URLProtocol *p = url_find_the_protocol(selected_http); ++ if (p) { ++ av_log(NULL, AV_LOG_DEBUG, "%s use %s send request\n",proto_str,selected_http); ++ return url_alloc_for_protocol(puc, p, filename, flags, int_cb); ++ } ++ *puc = NULL; ++ av_log(NULL, AV_LOG_ERROR, "some thing is fault,check %s protocol\n", selected_http); ++ return AVERROR_PROTOCOL_NOT_FOUND; ++ } else { ++ av_log(NULL, AV_LOG_ERROR, "invalid selected_http value: %s\n", selected_http); ++ av_assert0(0); ++ return AVERROR_PROTOCOL_NOT_FOUND; ++ } ++ } else { ++ av_log(NULL, AV_LOG_DEBUG, "%s not use %s\n",proto_str,selected_http); ++ } ++ } ++ } ++ ++ return ffurl_alloc(puc, filename, flags, int_cb); ++} ++ + int ffurl_open_whitelist(URLContext **puc, const char *filename, int flags, + const AVIOInterruptCB *int_cb, AVDictionary **options, + const char *whitelist, const char* blacklist, +@@ -367,7 +426,7 @@ int ffurl_open_whitelist(URLContext **puc, const char *filename, int flags, + { + AVDictionary *tmp_opts = NULL; + AVDictionaryEntry *e; +- int ret = ffurl_alloc(puc, filename, flags, int_cb); ++ int ret = ffurl_alloc2(puc, filename, flags, int_cb, options); + if (ret < 0) + return ret; + if (parent) { +@@ -736,7 +795,7 @@ int avio_open_dir(AVIODirContext **s, const char *url, AVDictionary **options) + goto fail; + } + +- if ((ret = ffurl_alloc(&h, url, AVIO_FLAG_READ, NULL)) < 0) ++ if ((ret = ffurl_alloc2(&h, url, AVIO_FLAG_READ, NULL, options)) < 0) + goto fail; + + if (h->prot->url_open_dir && h->prot->url_read_dir && h->prot->url_close_dir) { +diff --git a/libavformat/url.h b/libavformat/url.h +index 0784d77b64..53c6f13d23 100644 +--- a/libavformat/url.h ++++ b/libavformat/url.h +@@ -112,6 +112,22 @@ typedef struct URLProtocol { + int ffurl_alloc(URLContext **puc, const char *filename, int flags, + const AVIOInterruptCB *int_cb); + ++ /** ++ * Create a URLContext for accessing to the resource indicated by ++ * url, but do not initiate the connection yet. ++ * ++ * @param puc pointer to the location where, in case of success, the ++ * function puts the pointer to the created URLContext ++ * @param flags flags which control how the resource indicated by url ++ * is to be opened ++ * @param int_cb interrupt callback to use for the URLContext, may be ++ * NULL ++ * @param options A dictionary filled with options for replace http protocol ++ * @return >= 0 in case of success, a negative value corresponding to an ++ * AVERROR code in case of failure ++ */ ++int ffurl_alloc2(URLContext **puc, const char *filename, int flags, ++ const AVIOInterruptCB *int_cb, AVDictionary **options); + /** + * Connect an URLContext that has been allocated by ffurl_alloc + * +-- +2.50.1 (Apple Git-155) + diff --git a/patches/ffmpeg-n8.1.1/0010-correct-file-seekable-value-range-0-means-streamed-c.patch b/patches/ffmpeg-n8.1.1/0010-correct-file-seekable-value-range-0-means-streamed-c.patch new file mode 100644 index 000000000..b32ef703e --- /dev/null +++ b/patches/ffmpeg-n8.1.1/0010-correct-file-seekable-value-range-0-means-streamed-c.patch @@ -0,0 +1,26 @@ +From f98ffd5b75b7c85f4f336f5a193357a2675e71e5 Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Fri, 8 May 2026 17:11:02 +0800 +Subject: correct file seekable value range, 0 means streamed + can't seek, 1 means not streamed can seek. + +--- + libavformat/file.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libavformat/file.c b/libavformat/file.c +index 3ceddc8c25..59a0442c5a 100644 +--- a/libavformat/file.c ++++ b/libavformat/file.c +@@ -106,7 +106,7 @@ static const AVOption file_options[] = { + { "truncate", "truncate existing files on write", offsetof(FileContext, trunc), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, AV_OPT_FLAG_ENCODING_PARAM }, + { "blocksize", "set I/O operation maximum block size", offsetof(FileContext, blocksize), AV_OPT_TYPE_INT, { .i64 = INT_MAX }, 1, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM }, + { "follow", "Follow a file as it is being written", offsetof(FileContext, follow), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, AV_OPT_FLAG_DECODING_PARAM }, +- { "seekable", "Sets if the file is seekable", offsetof(FileContext, seekable), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 0, AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_ENCODING_PARAM }, ++ { "seekable", "Sets if the file is seekable", offsetof(FileContext, seekable), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_ENCODING_PARAM }, + { "pkt_size", "Maximum packet size", offsetof(FileContext, pkt_size), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_ENCODING_PARAM }, + { NULL } + }; +-- +2.50.1 (Apple Git-155) + diff --git a/patches/ffmpeg-n8.1.1/0011-fix-lrcdec-read-line-bug-on-osx.patch b/patches/ffmpeg-n8.1.1/0011-fix-lrcdec-read-line-bug-on-osx.patch new file mode 100644 index 000000000..85a7af914 --- /dev/null +++ b/patches/ffmpeg-n8.1.1/0011-fix-lrcdec-read-line-bug-on-osx.patch @@ -0,0 +1,43 @@ +From 0edb5d3ffb56c75e2de6129b3ea8b22e746fbb66 Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Wed, 28 May 2025 18:39:38 +0800 +Subject: fix lrcdec read line bug on osx + +--- + libavformat/lrcdec.c | 20 +++++++++++--------- + 1 file changed, 11 insertions(+), 9 deletions(-) + +diff --git a/libavformat/lrcdec.c b/libavformat/lrcdec.c +index 1f96305693..b75866260d 100644 +--- a/libavformat/lrcdec.c ++++ b/libavformat/lrcdec.c +@@ -107,15 +107,17 @@ static int64_t read_line(AVBPrint *buf, AVIOContext *pb) + int64_t pos = avio_tell(pb); + + av_bprint_clear(buf); +- while(!avio_feof(pb)) { +- int c = avio_r8(pb); +- if(c != '\r') { +- av_bprint_chars(buf, c, 1); +- } +- if(c == '\n') { +- break; +- } +- } ++ ff_read_line_to_bprint_overwrite(pb, buf); ++ ++ // while(!avio_feof(pb)) { ++ // int c = avio_r8(pb); ++ // if(c != '\r') { ++ // av_bprint_chars(buf, c, 1); ++ // } ++ // if(c == '\n') { ++ // break; ++ // } ++ // } + return pos; + } + +-- +2.50.1 (Apple Git-155) + diff --git a/patches/ffmpeg-n8.1.1/0012-avformat-mpegts-index-only-keyframes-to-ensure-accur.patch b/patches/ffmpeg-n8.1.1/0012-avformat-mpegts-index-only-keyframes-to-ensure-accur.patch new file mode 100644 index 000000000..1eab93d4c --- /dev/null +++ b/patches/ffmpeg-n8.1.1/0012-avformat-mpegts-index-only-keyframes-to-ensure-accur.patch @@ -0,0 +1,47 @@ +From 60a55d7df18fb383b3f393a2648a5802020bd0a7 Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Wed, 28 May 2025 18:48:39 +0800 +Subject: avformat/mpegts: index only keyframes to ensure + accurate seeks by default + +--- + libavformat/mpegts.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c +index 4b326d309b..47944c7884 100644 +--- a/libavformat/mpegts.c ++++ b/libavformat/mpegts.c +@@ -158,6 +158,7 @@ struct MpegTSContext { + + int skip_changes; + int skip_clear; ++ int seek_flag_keyframe; + int skip_unknown_pmt; + + int scan_all_pmts; +@@ -211,6 +212,8 @@ static const AVOption options[] = { + {.i64 = 0}, 0, 1, 0 }, + {"max_packet_size", "maximum size of emitted packet", offsetof(MpegTSContext, max_packet_size), AV_OPT_TYPE_INT, + {.i64 = 204800}, 1, INT_MAX/2, AV_OPT_FLAG_DECODING_PARAM }, ++ {"seek_flag_keyframe", "seek use keyframe mode", offsetof(MpegTSContext, seek_flag_keyframe), AV_OPT_TYPE_BOOL, ++ {.i64 = 1}, 0, 1, AV_OPT_FLAG_DECODING_PARAM }, + { NULL }, + }; + +@@ -3582,9 +3585,10 @@ static int64_t mpegts_get_dts(AVFormatContext *s, int stream_index, + av_packet_free(&pkt); + return AV_NOPTS_VALUE; + } +- if (pkt->dts != AV_NOPTS_VALUE && pkt->pos >= 0) { ++ ++ if (pkt->dts != AV_NOPTS_VALUE && pkt->pos >= 0 && (!ts->seek_flag_keyframe || (pkt->flags & AV_PKT_FLAG_KEY))) { + ff_reduce_index(s, pkt->stream_index); +- av_add_index_entry(s->streams[pkt->stream_index], pkt->pos, pkt->dts, 0, 0, AVINDEX_KEYFRAME /* FIXME keyframe? */); ++ av_add_index_entry(s->streams[pkt->stream_index], pkt->pos, pkt->dts, 0, 0, AVINDEX_KEYFRAME); + if (pkt->stream_index == stream_index && pkt->pos >= *ppos) { + int64_t dts = pkt->dts; + *ppos = pkt->pos; +-- +2.50.1 (Apple Git-155) + diff --git a/patches/ffmpeg-n8.1.1/0013-fix-can-t-seek-to-00-00-bug-baidu-neddisk-hls-start_.patch b/patches/ffmpeg-n8.1.1/0013-fix-can-t-seek-to-00-00-bug-baidu-neddisk-hls-start_.patch new file mode 100644 index 000000000..dbb6aa99c --- /dev/null +++ b/patches/ffmpeg-n8.1.1/0013-fix-can-t-seek-to-00-00-bug-baidu-neddisk-hls-start_.patch @@ -0,0 +1,29 @@ +From 91d3904d4db1e5e4c1fbe7866566259cabcd018c Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Wed, 28 May 2025 18:49:48 +0800 +Subject: fix can't seek to 00:00 bug, baidu neddisk hls + start_time is less than first_timestamp + +--- + libavformat/hls.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/libavformat/hls.c b/libavformat/hls.c +index 28c883097a..14fa9da57c 100644 +--- a/libavformat/hls.c ++++ b/libavformat/hls.c +@@ -1923,7 +1923,10 @@ static int find_timestamp_in_playlist(HLSContext *c, struct playlist *pls, + + if (timestamp < pos) { + *seq_no = pls->start_seq_no; +- return 0; ++ if (seg_start_ts) { ++ *seg_start_ts = pos; ++ } ++ return 1; + } + + for (i = 0; i < pls->n_segments; i++) { +-- +2.50.1 (Apple Git-155) + diff --git a/patches/ffmpeg-n8.1.1/0014-Correct-the-wrong-codecpar-codec_id-which-read-from-.patch b/patches/ffmpeg-n8.1.1/0014-Correct-the-wrong-codecpar-codec_id-which-read-from-.patch new file mode 100644 index 000000000..ced8b16f6 --- /dev/null +++ b/patches/ffmpeg-n8.1.1/0014-Correct-the-wrong-codecpar-codec_id-which-read-from-.patch @@ -0,0 +1,60 @@ +From f34b1dde280aa3ece94b7b8a79d1bbd683429f1e Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Wed, 28 May 2025 18:52:01 +0800 +Subject: Correct the wrong codecpar->codec_id which read from + MIME of ID3tags, but the real data was encoded in PNG/JPEG/TIFF + +--- + libavformat/id3v2.c | 7 ++++++- + libavformat/img2dec.c | 2 +- + libavformat/mov.c | 2 +- + 3 files changed, 8 insertions(+), 3 deletions(-) + +diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c +index 5fc82ad9dc..4ae12b65e8 100644 +--- a/libavformat/id3v2.c ++++ b/libavformat/id3v2.c +@@ -1187,8 +1187,13 @@ int ff_id3v2_parse_apic(AVFormatContext *s, ID3v2ExtraMeta *extra_meta) + st = s->streams[s->nb_streams - 1]; + st->codecpar->codec_id = apic->id; + +- if (AV_RB64(st->attached_pic.data) == PNGSIG) ++ if (AV_RB64(st->attached_pic.data) == PNGSIG || AV_RB64(st->attached_pic.data) == MNGSIG) { + st->codecpar->codec_id = AV_CODEC_ID_PNG; ++ } else if (AV_RB24(st->attached_pic.data) == 0xffd8ff) { ++ st->codecpar->codec_id = AV_CODEC_ID_MJPEG; ++ } else if (AV_RB32(st->attached_pic.data) == 0x49492a00 || AV_RB32(st->attached_pic.data) == 0x4D4D002a) { ++ st->codecpar->codec_id = AV_CODEC_ID_TIFF; ++ } + + if (apic->description[0]) + av_dict_set(&st->metadata, "title", apic->description, 0); +diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c +index ecb7ea8946..0a26d5aa52 100644 +--- a/libavformat/img2dec.c ++++ b/libavformat/img2dec.c +@@ -892,7 +892,7 @@ static int png_probe(const AVProbeData *p) + { + const uint8_t *b = p->buf; + +- if (AV_RB64(b) == 0x89504e470d0a1a0a) ++ if (AV_RB64(b) == 0x89504e470d0a1a0a || AV_RB64(b) == 0x8a4d4e470d0a1a0a) + return AVPROBE_SCORE_MAX - 1; + return 0; + } +diff --git a/libavformat/mov.c b/libavformat/mov.c +index 222d79ec1f..e1147700d3 100644 +--- a/libavformat/mov.c ++++ b/libavformat/mov.c +@@ -259,7 +259,7 @@ static int mov_read_covr(MOVContext *c, AVIOContext *pb, int type, int len) + sc->refcount = 1; + + if (st->attached_pic.size >= 8 && id != AV_CODEC_ID_BMP) { +- if (AV_RB64(st->attached_pic.data) == 0x89504e470d0a1a0a) { ++ if (AV_RB64(st->attached_pic.data) == 0x89504e470d0a1a0a || AV_RB64(st->attached_pic.data) == 0x8a4d4e470d0a1a0a) { + id = AV_CODEC_ID_PNG; + } else { + id = AV_CODEC_ID_MJPEG; +-- +2.50.1 (Apple Git-155) + diff --git a/patches/ffmpeg-n8.1.1/0015-fix-http-chunked-transfer-get-wrong-size-cause-av_re.patch b/patches/ffmpeg-n8.1.1/0015-fix-http-chunked-transfer-get-wrong-size-cause-av_re.patch new file mode 100644 index 000000000..b600bb227 --- /dev/null +++ b/patches/ffmpeg-n8.1.1/0015-fix-http-chunked-transfer-get-wrong-size-cause-av_re.patch @@ -0,0 +1,32 @@ +From 2e1aa0b9b5baf39c29b6c4e85fd26776badaba55 Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Thu, 29 May 2025 08:56:02 +0800 +Subject: fix http chunked transfer get wrong size cause + av_read_frame can not return eof bug + +--- + libavformat/img2dec.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c +index 0a26d5aa52..088c21907d 100644 +--- a/libavformat/img2dec.c ++++ b/libavformat/img2dec.c +@@ -451,7 +451,13 @@ int ff_img_read_packet(AVFormatContext *s1, AVPacket *pkt) + if (s->frame_size > 0) { + size[0] = s->frame_size; + } else if (!ffstream(s1->streams[0])->parser) { +- size[0] = avio_size(s1->pb); ++ //http Transfer-Encoding: chunked the size is -78; ++ int64_t s = avio_size(s1->pb); ++ if (s < 0) { ++ size[0] = 4096; ++ } else { ++ size[0] = s; ++ } + } else { + size[0] = 4096; + } +-- +2.50.1 (Apple Git-155) + diff --git a/patches/ffmpeg-n8.1.1/0016-not-very-useful-log-use-trace-level.patch b/patches/ffmpeg-n8.1.1/0016-not-very-useful-log-use-trace-level.patch new file mode 100644 index 000000000..0951ba5cb --- /dev/null +++ b/patches/ffmpeg-n8.1.1/0016-not-very-useful-log-use-trace-level.patch @@ -0,0 +1,76 @@ +From b5ff5beaad904e0b4f896c434d8ecb86df3f858c Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Thu, 29 May 2025 09:02:16 +0800 +Subject: not very useful log use trace level + +--- + libavcodec/h2645_parse.c | 6 +++--- + libavcodec/h2645_vui.c | 2 +- + libavformat/demux.c | 4 ++-- + 3 files changed, 6 insertions(+), 6 deletions(-) + +diff --git a/libavcodec/h2645_parse.c b/libavcodec/h2645_parse.c +index 659e818393..63f3460926 100644 +--- a/libavcodec/h2645_parse.c ++++ b/libavcodec/h2645_parse.c +@@ -417,7 +417,7 @@ static int vvc_parse_nal_header(H2645NAL *nal, void *logctx) + if ((nal->type >= VVC_IDR_W_RADL && nal->type <= VVC_RSV_IRAP_11) && nal->temporal_id) + return AVERROR_INVALIDDATA; + +- av_log(logctx, AV_LOG_DEBUG, ++ av_log(logctx, AV_LOG_TRACE, + "nal_unit_type: %d(%s), nuh_layer_id: %d, temporal_id: %d\n", + nal->type, vvc_nal_unit_name(nal->type), nal->nuh_layer_id, nal->temporal_id); + +@@ -438,7 +438,7 @@ static int hevc_parse_nal_header(H2645NAL *nal, void *logctx) + if (nal->temporal_id < 0) + return AVERROR_INVALIDDATA; + +- av_log(logctx, AV_LOG_DEBUG, ++ av_log(logctx, AV_LOG_TRACE, + "nal_unit_type: %d(%s), nuh_layer_id: %d, temporal_id: %d\n", + nal->type, hevc_nal_unit_name(nal->type), nal->nuh_layer_id, nal->temporal_id); + +@@ -455,7 +455,7 @@ static int h264_parse_nal_header(H2645NAL *nal, void *logctx) + nal->ref_idc = get_bits(gb, 2); + nal->type = get_bits(gb, 5); + +- av_log(logctx, AV_LOG_DEBUG, ++ av_log(logctx, AV_LOG_TRACE, + "nal_unit_type: %d(%s), nal_ref_idc: %d\n", + nal->type, h264_nal_unit_name(nal->type), nal->ref_idc); + +diff --git a/libavcodec/h2645_vui.c b/libavcodec/h2645_vui.c +index 0e576c1563..445e471a2e 100644 +--- a/libavcodec/h2645_vui.c ++++ b/libavcodec/h2645_vui.c +@@ -36,7 +36,7 @@ + + void ff_h2645_decode_common_vui_params(GetBitContext *gb, H2645VUI *vui, void *logctx) + { +- av_log(logctx, AV_LOG_DEBUG, "Decoding VUI\n"); ++ av_log(logctx, AV_LOG_TRACE, "Decoding VUI\n"); + + vui->aspect_ratio_info_present_flag = get_bits1(gb); + if (vui->aspect_ratio_info_present_flag) { +diff --git a/libavformat/demux.c b/libavformat/demux.c +index 05ab1e172d..494e15f3c1 100644 +--- a/libavformat/demux.c ++++ b/libavformat/demux.c +@@ -2074,11 +2074,11 @@ static void estimate_timings(AVFormatContext *ic, int64_t old_offset) + for (unsigned i = 0; i < ic->nb_streams; i++) { + AVStream *const st = ic->streams[i]; + if (st->time_base.den) +- av_log(ic, AV_LOG_TRACE, "stream %u: start_time: %s duration: %s\n", i, ++ av_log(ic, AV_LOG_DEBUG, "stream %u: start_time: %s duration: %s\n", i, + av_ts2timestr(st->start_time, &st->time_base), + av_ts2timestr(st->duration, &st->time_base)); + } +- av_log(ic, AV_LOG_TRACE, ++ av_log(ic, AV_LOG_DEBUG, + "format: start_time: %s duration: %s (estimate from %s) bitrate=%"PRId64" kb/s\n", + av_ts2timestr(ic->start_time, &AV_TIME_BASE_Q), + av_ts2timestr(ic->duration, &AV_TIME_BASE_Q), +-- +2.50.1 (Apple Git-155) + diff --git a/patches/ffmpeg-n8.1.1/0017-Audio-Vivid-Parser-and-Demuxer-but-av3a-Decoder-is-a.patch b/patches/ffmpeg-n8.1.1/0017-Audio-Vivid-Parser-and-Demuxer-but-av3a-Decoder-is-a.patch new file mode 100644 index 000000000..66c017ce7 --- /dev/null +++ b/patches/ffmpeg-n8.1.1/0017-Audio-Vivid-Parser-and-Demuxer-but-av3a-Decoder-is-a.patch @@ -0,0 +1,1340 @@ +From 9b4c7ec47cc92c98729805d02d0a375821ecb5a8 Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Fri, 8 May 2026 19:00:36 +0800 +Subject: Audio Vivid Parser and Demuxer, but av3a Decoder is absent + +--- + libavcodec/Makefile | 1 + + libavcodec/av3a.h | 314 ++++++++++++++++++++++++++ + libavcodec/av3a_parser.c | 219 ++++++++++++++++++ + libavcodec/codec_desc.c | 7 + + libavcodec/codec_id.h | 1 + + libavcodec/parsers.c | 1 + + libavcodec/utils.c | 1 + + libavformat/Makefile | 1 + + libavformat/allformats.c | 1 + + libavformat/av3adec.c | 473 +++++++++++++++++++++++++++++++++++++++ + libavformat/isom_tags.c | 1 + + libavformat/mov.c | 124 ++++++++++ + libavformat/mpegts.c | 6 + + libavformat/mpegts.h | 1 + + 14 files changed, 1151 insertions(+) + create mode 100644 libavcodec/av3a.h + create mode 100644 libavcodec/av3a_parser.c + create mode 100644 libavformat/av3adec.c + +diff --git a/libavcodec/Makefile b/libavcodec/Makefile +index 4445d9e..c51a860 100644 +--- a/libavcodec/Makefile ++++ b/libavcodec/Makefile +@@ -1247,6 +1247,7 @@ OBJS-$(CONFIG_APV_PARSER) += apv_parser.o + OBJS-$(CONFIG_AV1_PARSER) += av1_parser.o av1_parse.o + OBJS-$(CONFIG_AVS2_PARSER) += avs2.o avs2_parser.o + OBJS-$(CONFIG_AVS3_PARSER) += avs3_parser.o ++OBJS-$(CONFIG_AV3A_PARSER) += av3a_parser.o + OBJS-$(CONFIG_BMP_PARSER) += bmp_parser.o + OBJS-$(CONFIG_CAVSVIDEO_PARSER) += cavs_parser.o + OBJS-$(CONFIG_COOK_PARSER) += cook_parser.o +diff --git a/libavcodec/av3a.h b/libavcodec/av3a.h +new file mode 100644 +index 0000000..14dc349 +--- /dev/null ++++ b/libavcodec/av3a.h +@@ -0,0 +1,314 @@ ++/* ++ * AV3A Common Header File ++ * ++ * Copyright (c) 2024 Shuai Liu ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#ifndef AVCODEC_AV3A_H ++#define AVCODEC_AV3A_H ++ ++#include "libavutil/samplefmt.h" ++#include "libavutil/channel_layout.h" ++ ++/* AATF header */ ++#define AV3A_MAX_NBYTES_HEADER 9 ++#define AV3A_AUDIO_SYNC_WORD 0xFFF ++#define AV3A_AUDIO_FRAME_SIZE 1024 ++#define AV3A_CHANNEL_LAYOUT_SIZE 15 ++#define AV3A_BITRATE_TABLE_SIZE 16 ++#define AV3A_FS_TABLE_SIZE 9 ++#define AV3A_RESOLUTION_TABLE_SIZE 3 ++#define AV3A_DCA3_BOX_MIN_SIZE 5 ++ ++/* Channel Layout */ ++#define AV3A_CH_LAYOUT_MONO (AV_CH_LAYOUT_MONO) ++#define AV3A_CH_LAYOUT_STEREO (AV_CH_LAYOUT_STEREO) ++#define AV3A_CH_LAYOUT_4POINT0 (AV3A_CH_LAYOUT_STEREO|AV_CH_FRONT_CENTER|AV_CH_BACK_CENTER) ++#define AV3A_CH_LAYOUT_5POINT1 (AV_CH_LAYOUT_5POINT1) ++#define AV3A_CH_LAYOUT_7POINT1 (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT) ++#define AV3A_CH_LAYOUT_5POINT1POINT2 (AV_CH_LAYOUT_5POINT1|AV_CH_TOP_SIDE_LEFT|AV_CH_TOP_SIDE_RIGHT) ++#define AV3A_CH_LAYOUT_7POINT1POINT2 (AV3A_CH_LAYOUT_7POINT1|AV_CH_TOP_SIDE_LEFT|AV_CH_TOP_SIDE_RIGHT) ++#define AV3A_CH_LAYOUT_5POINT1POINT4 (AV_CH_LAYOUT_5POINT1|AV_CH_TOP_FRONT_LEFT|AV_CH_TOP_FRONT_RIGHT|AV_CH_TOP_BACK_LEFT|AV_CH_TOP_BACK_RIGHT) ++#define AV3A_CH_LAYOUT_7POINT1POINT4 (AV3A_CH_LAYOUT_7POINT1|AV_CH_TOP_FRONT_LEFT|AV_CH_TOP_FRONT_RIGHT|AV_CH_TOP_BACK_LEFT|AV_CH_TOP_BACK_RIGHT) ++#define AV3A_CH_AUDIO_OBJECT (AV_CHAN_UNKNOWN) ++ ++/* AV3A Codec ID */ ++typedef enum { ++ AV3A_LOSSLESS_CODEC_ID = 1, ++ AV3A_LOSSY_CODEC_ID = 2 ++} Av3aCodecId; ++ ++/* Content Type */ ++typedef enum { ++ AV3A_CHANNEL_BASED_TYPE = 0, ++ AV3A_OBJECT_BASED_TYPE = 1, ++ AV3A_CHANNEL_OBJECT_TYPE = 2, ++ AV3A_AMBISONIC_TYPE = 3 ++} Av3aContentType; ++ ++/* Internal Coding Profile */ ++typedef enum { ++ AV3A_BASE_PROFILE = 0, ++ AV3A_OBJECT_METADATA_PROFILE = 1, ++ AV3A_AMBISONIC_PROFILE = 2 ++} Av3aCodingProfile; ++ ++/* NN Type */ ++typedef enum { ++ AV3A_BASELINE_NN_TYPE = 0, ++ AV3A_LC_NN_TYPE = 1 ++} Av3aNeuralNetworkType; ++ ++/* AV3A Channel Configuration */ ++typedef enum { ++ CHANNEL_CONFIG_MONO = 0, /* Mono = 0 */ ++ CHANNEL_CONFIG_STEREO = 1, /* Stereo = 1 */ ++ CHANNEL_CONFIG_MC_5_1 = 2, /* 5.1 = 2 */ ++ CHANNEL_CONFIG_MC_7_1 = 3, /* 7.1 = 3 */ ++ CHANNEL_CONFIG_MC_10_2 = 4, /* 10.2 = 4 */ ++ CHANNEL_CONFIG_MC_22_2 = 5, /* 22.2 = 5 */ ++ CHANNEL_CONFIG_MC_4_0 = 6, /* 4.0 = 6 */ ++ CHANNEL_CONFIG_MC_5_1_2 = 7, /* 5.1.2 = 7 */ ++ CHANNEL_CONFIG_MC_5_1_4 = 8, /* 5.1.4 = 8 */ ++ CHANNEL_CONFIG_MC_7_1_2 = 9, /* 7.1.2 = 9 */ ++ CHANNEL_CONFIG_MC_7_1_4 = 10, /* 7.1.4 = 10 */ ++ CHANNEL_CONFIG_HOA_ORDER1 = 11, /* HOA1 = 11 */ ++ CHANNEL_CONFIG_HOA_ORDER2 = 12, /* HOA2 = 12 */ ++ CHANNEL_CONFIG_HOA_ORDER3 = 13, /* HOA3 = 13 */ ++ CHANNEL_CONFIG_UNKNOWN = 14 /* UNKNOWN = 14 */ ++} Av3aChannelConfig; ++ ++typedef enum { ++ AV3A_AMBISONIC_FIRST_ORDER = 1, ++ AV3A_AMBISONIC_SECOND_ORDER = 2, ++ AV3A_AMBISONIC_THIRD_ORDER = 3 ++} Av3aAmbisonicOrder; ++ ++typedef struct { ++ int16_t sync_word; /* sync word */ ++ int16_t audio_codec_id; /* audio codec id */ ++ int16_t anc_data; /* anc data */ ++ int16_t nn_type; /* neural network type */ ++ int16_t coding_profile; /* coding profile */ ++ int16_t sampling_frequency_index; /* sampling frequency index */ ++ int16_t channel_number_index; /* channel number index */ ++ int16_t bitrate_index; /* bitrate index */ ++ int16_t soundbed_type; /* soundbed type */ ++ int16_t object_channel_number; /* object channel number */ ++ int16_t bitrate_index_per_channel; /* bitrate per object */ ++ int16_t order; /* ambisonics order */ ++ int16_t resolution_index; /* resolution index */ ++ ++ int32_t sampling_rate; /* sampling rate */ ++ int64_t total_bitrate; /* total bitrate */ ++ int16_t sample_format; /* sample format */ ++ int16_t resolution; /* resolution */ ++ int16_t content_type; /* internal content type */ ++ int16_t nb_channels; /* number of channels (channel configuration) */ ++ int16_t nb_objects; /* number of objects (object_channel_number + 1) */ ++ int16_t total_channels; /* total channels */ ++ int16_t hoa_order; /* ambisonic order (order + 1) */ ++ int32_t ch_layout_mask; /* channel layout mask */ ++} AATFHeaderInfo; ++ ++/* bitrate table for mono */ ++static const int64_t ff_av3a_mono_bitrate_table[AV3A_BITRATE_TABLE_SIZE] = { ++ 16000, 32000, 44000, 56000, 64000, 72000, 80000, 96000, 128000, 144000, ++ 164000, 192000, 0, 0, 0, 0 ++}; ++ ++/* bitrate table for stereo */ ++static const int64_t ff_av3a_stereo_bitrate_table[AV3A_BITRATE_TABLE_SIZE] = { ++ 24000, 32000, 48000, 64000, 80000, 96000, 128000, 144000, 192000, 256000, ++ 320000, 0, 0, 0, 0, 0 ++}; ++ ++/* bitrate table for MC 5.1 */ ++static const int64_t ff_av3a_mc5p1_bitrate_table[AV3A_BITRATE_TABLE_SIZE] = { ++ 192000, 256000, 320000, 384000, 448000, 512000, 640000, 720000, 144000, 96000, ++ 128000, 160000, 0, 0, 0, 0 ++}; ++ ++/* bitrate table for MC 7.1 */ ++static const int64_t ff_av3a_mc7p1_bitrate_table[AV3A_BITRATE_TABLE_SIZE] = { ++ 192000, 480000, 256000, 384000, 576000, 640000, 128000, 160000, 0, 0, ++ 0, 0, 0, 0, 0, 0 ++}; ++ ++/* bitrate table for MC 4.0 */ ++static const int64_t ff_av3a_mc4p0_bitrate_table[AV3A_BITRATE_TABLE_SIZE] = { ++ 48000, 96000, 128000, 192000, 256000, 0, 0, 0, 0, 0, ++ 0, 0, 0, 0, 0, 0 ++}; ++ ++/* bitrate table for MC 5.1.2 */ ++static const int64_t ff_av3a_mc5p1p2_bitrate_table[AV3A_BITRATE_TABLE_SIZE] = { ++ 152000, 320000, 480000, 576000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ++}; ++ ++/* bitrate table for MC 5.1.4 */ ++static const int64_t ff_av3a_mc5p1p4_bitrate_table[AV3A_BITRATE_TABLE_SIZE] = { ++ 176000, 384000, 576000, 704000, 256000, 448000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ++}; ++ ++/* bitrate table for MC 7.1.2 */ ++static const int64_t ff_av3a_mc7p1p2_bitrate_table[AV3A_BITRATE_TABLE_SIZE] = { ++ 216000, 480000, 576000, 384000, 768000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ++}; ++ ++/* bitrate table for MC 7.1.4 */ ++static const int64_t ff_av3a_mc7p1p4_bitrate_table[AV3A_BITRATE_TABLE_SIZE] = { ++ 240000, 608000, 384000, 512000, 832000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ++}; ++ ++/* bitrate table for FOA */ ++static const int64_t ff_av3a_foa_bitrate_table[AV3A_BITRATE_TABLE_SIZE] = { ++ 48000, 96000, 128000, 192000, 256000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ++}; ++ ++/* bitrate table for HOA2 */ ++static const int64_t ff_av3a_hoa2_bitrate_table[AV3A_BITRATE_TABLE_SIZE] = { ++ 192000, 256000, 320000, 384000, 480000, 512000, 640000, 0, 0, 0, 0, 0, 0, 0, 0, 0 ++}; ++ ++/* bitrate table for HOA3 */ ++static const int64_t ff_av3a_hoa3_bitrate_table[AV3A_BITRATE_TABLE_SIZE] = { ++ 256000, 320000, 384000, 512000, 640000, 896000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; ++ ++static const int32_t ff_av3a_sampling_rate_table[AV3A_FS_TABLE_SIZE] = { ++ 192000, 96000, 48000, 44100, 32000, 24000, 22050, 16000, 8000 ++}; ++ ++typedef struct { ++ int16_t resolution; ++ enum AVSampleFormat sample_format; ++} Av3aSampleFormatMap; ++ ++static const Av3aSampleFormatMap ff_av3a_sample_format_map_table[AV3A_RESOLUTION_TABLE_SIZE] = { ++ {8, AV_SAMPLE_FMT_U8 }, /* 0: 8 bits */ ++ {16, AV_SAMPLE_FMT_S16}, /* 1: 16 bits */ ++ {24, AV_SAMPLE_FMT_S32}, /* 2: 24 bits */ ++}; ++ ++typedef struct { ++ Av3aChannelConfig channel_number_index; ++ int16_t channels; ++ const enum AVChannel* channel_layout; ++ uint64_t mask; ++} Av3aChannelConfigMap; ++ ++static const enum AVChannel ff_av3a_default_channel_layout_mono[1] = { ++ AV_CHAN_FRONT_CENTER ++}; ++ ++static const enum AVChannel ff_av3a_default_channel_layout_stereo[2] = { ++ AV_CHAN_FRONT_LEFT, AV_CHAN_FRONT_RIGHT ++}; ++ ++static const enum AVChannel ff_av3a_channel_layout_mc_4_0[4] = { ++ AV_CHAN_FRONT_LEFT, AV_CHAN_FRONT_RIGHT, ++ AV_CHAN_FRONT_CENTER, AV_CHAN_BACK_CENTER ++}; ++ ++static const enum AVChannel ff_av3a_default_channel_layout_mc_5_1[6] = { ++ AV_CHAN_FRONT_LEFT, AV_CHAN_FRONT_RIGHT, AV_CHAN_FRONT_CENTER, ++ AV_CHAN_LOW_FREQUENCY, ++ AV_CHAN_SIDE_LEFT, AV_CHAN_SIDE_RIGHT ++}; ++ ++static const enum AVChannel ff_av3a_default_channel_layout_mc_5_1_2[8] = { ++ AV_CHAN_FRONT_LEFT, AV_CHAN_FRONT_RIGHT, AV_CHAN_FRONT_CENTER, ++ AV_CHAN_LOW_FREQUENCY, ++ AV_CHAN_SIDE_LEFT, AV_CHAN_SIDE_RIGHT, ++ AV_CHAN_TOP_SIDE_LEFT, AV_CHAN_TOP_SIDE_RIGHT ++}; ++ ++static const enum AVChannel ff_av3a_default_channel_layout_mc_7_1[8] = { ++ AV_CHAN_FRONT_LEFT, AV_CHAN_FRONT_RIGHT, AV_CHAN_FRONT_CENTER, ++ AV_CHAN_LOW_FREQUENCY, ++ AV_CHAN_SIDE_LEFT, AV_CHAN_SIDE_RIGHT, ++ AV_CHAN_BACK_LEFT, AV_CHAN_BACK_RIGHT ++}; ++ ++static const enum AVChannel ff_av3a_default_channel_layout_mc_5_1_4[10] = { ++ AV_CHAN_FRONT_LEFT, AV_CHAN_FRONT_RIGHT, AV_CHAN_FRONT_CENTER, ++ AV_CHAN_LOW_FREQUENCY, ++ AV_CHAN_SIDE_LEFT, AV_CHAN_SIDE_RIGHT, ++ AV_CHAN_TOP_FRONT_LEFT, AV_CHAN_TOP_FRONT_RIGHT, ++ AV_CHAN_TOP_BACK_LEFT, AV_CHAN_TOP_BACK_RIGHT ++}; ++ ++static const enum AVChannel ff_av3a_default_channel_layout_mc_7_1_2[10] = { ++ AV_CHAN_FRONT_LEFT, AV_CHAN_FRONT_RIGHT, AV_CHAN_FRONT_CENTER, ++ AV_CHAN_LOW_FREQUENCY, ++ AV_CHAN_SIDE_LEFT, AV_CHAN_SIDE_RIGHT, ++ AV_CHAN_BACK_LEFT, AV_CHAN_BACK_RIGHT, ++ AV_CHAN_TOP_SIDE_LEFT, AV_CHAN_TOP_SIDE_RIGHT ++}; ++ ++static const enum AVChannel ff_av3a_default_channel_layout_mc_7_1_4[12] = { ++ AV_CHAN_FRONT_LEFT, AV_CHAN_FRONT_RIGHT, AV_CHAN_FRONT_CENTER, ++ AV_CHAN_LOW_FREQUENCY, ++ AV_CHAN_SIDE_LEFT, AV_CHAN_SIDE_RIGHT, ++ AV_CHAN_BACK_LEFT, AV_CHAN_BACK_RIGHT, ++ AV_CHAN_TOP_FRONT_LEFT, AV_CHAN_TOP_FRONT_RIGHT, ++ AV_CHAN_TOP_BACK_LEFT, AV_CHAN_TOP_BACK_RIGHT ++}; ++ ++static const Av3aChannelConfigMap ff_av3a_channels_map_table[AV3A_CHANNEL_LAYOUT_SIZE] = { ++ { CHANNEL_CONFIG_MONO, 1, ff_av3a_default_channel_layout_mono, AV3A_CH_LAYOUT_MONO }, ++ { CHANNEL_CONFIG_STEREO, 2, ff_av3a_default_channel_layout_stereo, AV3A_CH_LAYOUT_STEREO }, ++ { CHANNEL_CONFIG_MC_5_1, 6, ff_av3a_default_channel_layout_mc_5_1, AV3A_CH_LAYOUT_5POINT1 }, ++ { CHANNEL_CONFIG_MC_7_1, 8, ff_av3a_default_channel_layout_mc_7_1, AV3A_CH_LAYOUT_7POINT1 }, ++ { CHANNEL_CONFIG_MC_10_2, 12, NULL, 0L }, /* reserved */ ++ { CHANNEL_CONFIG_MC_22_2, 24, NULL, 0L }, /* reserved */ ++ { CHANNEL_CONFIG_MC_4_0, 4, ff_av3a_channel_layout_mc_4_0, AV3A_CH_LAYOUT_4POINT0 }, ++ { CHANNEL_CONFIG_MC_5_1_2, 8, ff_av3a_default_channel_layout_mc_5_1_2, AV3A_CH_LAYOUT_5POINT1POINT2 }, ++ { CHANNEL_CONFIG_MC_5_1_4, 10, ff_av3a_default_channel_layout_mc_5_1_4, AV3A_CH_LAYOUT_5POINT1POINT4 }, ++ { CHANNEL_CONFIG_MC_7_1_2, 10, ff_av3a_default_channel_layout_mc_7_1_2, AV3A_CH_LAYOUT_7POINT1POINT2 }, ++ { CHANNEL_CONFIG_MC_7_1_4, 12, ff_av3a_default_channel_layout_mc_7_1_4, AV3A_CH_LAYOUT_7POINT1POINT4 }, ++ { CHANNEL_CONFIG_HOA_ORDER1, 4, NULL, 0L }, ++ { CHANNEL_CONFIG_HOA_ORDER2, 9, NULL, 0L }, ++ { CHANNEL_CONFIG_HOA_ORDER3, 16, NULL, 0L }, ++ { CHANNEL_CONFIG_UNKNOWN, 0, NULL, 0L }, ++}; ++ ++typedef struct { ++ Av3aChannelConfig channel_number_index; ++ const int64_t *bitrate_table; ++} Av3aBitrateMap; ++ ++static const Av3aBitrateMap ff_av3a_bitrate_map_table[15] = { ++ {CHANNEL_CONFIG_MONO, ff_av3a_mono_bitrate_table }, ++ {CHANNEL_CONFIG_STEREO, ff_av3a_stereo_bitrate_table }, ++ {CHANNEL_CONFIG_MC_5_1, ff_av3a_mc5p1_bitrate_table }, ++ {CHANNEL_CONFIG_MC_7_1, ff_av3a_mc7p1_bitrate_table }, ++ {CHANNEL_CONFIG_MC_10_2, NULL }, /* reserved */ ++ {CHANNEL_CONFIG_MC_22_2, NULL }, /* reserved */ ++ {CHANNEL_CONFIG_MC_4_0, ff_av3a_mc4p0_bitrate_table }, ++ {CHANNEL_CONFIG_MC_5_1_2, ff_av3a_mc5p1p2_bitrate_table }, ++ {CHANNEL_CONFIG_MC_5_1_4, ff_av3a_mc5p1p4_bitrate_table }, ++ {CHANNEL_CONFIG_MC_7_1_2, ff_av3a_mc7p1p2_bitrate_table }, ++ {CHANNEL_CONFIG_MC_7_1_4, ff_av3a_mc7p1p4_bitrate_table }, ++ {CHANNEL_CONFIG_HOA_ORDER1, ff_av3a_foa_bitrate_table }, ++ {CHANNEL_CONFIG_HOA_ORDER2, ff_av3a_hoa2_bitrate_table }, ++ {CHANNEL_CONFIG_HOA_ORDER3, ff_av3a_hoa3_bitrate_table }, ++ {CHANNEL_CONFIG_UNKNOWN, NULL }, ++}; ++#endif /* AVCODEC_AV3A_H */ +diff --git a/libavcodec/av3a_parser.c b/libavcodec/av3a_parser.c +new file mode 100644 +index 0000000..66d461e +--- /dev/null ++++ b/libavcodec/av3a_parser.c +@@ -0,0 +1,219 @@ ++/* ++ * AV3A Parser ++ * ++ * Copyright (c) 2024 Shuai Liu ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#include ++#include ++#include "libavutil/intreadwrite.h" ++#include "parser.h" ++#include "get_bits.h" ++#include "av3a.h" ++#include "parser_internal.h" ++ ++typedef struct { ++ int16_t audio_codec_id; ++ int16_t nn_type; ++ int16_t frame_size; ++ int16_t resolution; ++ int32_t sample_rate; ++ int64_t bit_rate; ++ ++ int16_t content_type; ++ int16_t channel_number_index; ++ int16_t nb_channels; ++ int16_t nb_objects; ++ int16_t total_channels; ++} Av3aParseContext; ++ ++static int ff_read_av3a_header_parse(GetBitContext *gb, AATFHeaderInfo *hdf) ++{ ++ int64_t soundbed_bitrate = 0L; ++ int64_t object_bitrate = 0L; ++ ++ hdf->nb_channels = 0; ++ hdf->nb_objects = 0; ++ ++ hdf->sync_word = get_bits(gb, 12); ++ if (hdf->sync_word != AV3A_AUDIO_SYNC_WORD) { ++ return AVERROR_INVALIDDATA; ++ } ++ ++ hdf->audio_codec_id = get_bits(gb, 4); ++ if (hdf->audio_codec_id != AV3A_LOSSY_CODEC_ID) { ++ return AVERROR_INVALIDDATA; ++ } ++ ++ skip_bits(gb, 1); /* skip anc_data 1 bit */ ++ ++ hdf->nn_type = get_bits(gb, 3); ++ if ((hdf->nn_type > AV3A_LC_NN_TYPE) || (hdf->nn_type < AV3A_BASELINE_NN_TYPE)) { ++ return AVERROR_INVALIDDATA; ++ } ++ ++ hdf->coding_profile = get_bits(gb, 3); ++ ++ hdf->sampling_frequency_index = get_bits(gb, 4); ++ if ((hdf->sampling_frequency_index >= AV3A_FS_TABLE_SIZE) || (hdf->sampling_frequency_index < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ hdf->sampling_rate = ff_av3a_sampling_rate_table[hdf->sampling_frequency_index]; ++ ++ skip_bits(gb, 8); /* skip CRC 8 bits */ ++ ++ if (hdf->coding_profile == AV3A_BASE_PROFILE) { ++ hdf->content_type = AV3A_CHANNEL_BASED_TYPE; ++ hdf->channel_number_index = get_bits(gb, 7); ++ if ((hdf->channel_number_index >= CHANNEL_CONFIG_UNKNOWN) || ++ (hdf->channel_number_index == CHANNEL_CONFIG_MC_10_2) || ++ (hdf->channel_number_index == CHANNEL_CONFIG_MC_22_2) || ++ (hdf->channel_number_index < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ hdf->nb_channels = ff_av3a_channels_map_table[hdf->channel_number_index].channels; ++ } else if (hdf->coding_profile == AV3A_OBJECT_METADATA_PROFILE) { ++ hdf->soundbed_type = get_bits(gb, 2); ++ if (hdf->soundbed_type == 0) { ++ hdf->content_type = AV3A_OBJECT_BASED_TYPE; ++ hdf->object_channel_number = get_bits(gb, 7); ++ if (hdf->object_channel_number < 0) { ++ return AVERROR_INVALIDDATA; ++ } ++ hdf->nb_objects = hdf->object_channel_number + 1; ++ ++ hdf->bitrate_index_per_channel = get_bits(gb, 4); ++ if ((hdf->bitrate_index_per_channel >= AV3A_BITRATE_TABLE_SIZE) || (hdf->bitrate_index_per_channel < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ object_bitrate = ff_av3a_bitrate_map_table[CHANNEL_CONFIG_MONO].bitrate_table[hdf->bitrate_index_per_channel]; ++ hdf->total_bitrate = object_bitrate * hdf->nb_objects; ++ } else if (hdf->soundbed_type == 1) { ++ hdf->content_type = AV3A_CHANNEL_OBJECT_TYPE; ++ hdf->channel_number_index = get_bits(gb, 7); ++ if ((hdf->channel_number_index >= CHANNEL_CONFIG_UNKNOWN) || ++ (hdf->channel_number_index == CHANNEL_CONFIG_MC_10_2) || ++ (hdf->channel_number_index == CHANNEL_CONFIG_MC_22_2) || ++ (hdf->channel_number_index < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ ++ hdf->bitrate_index = get_bits(gb, 4); ++ if ((hdf->bitrate_index >= AV3A_BITRATE_TABLE_SIZE) || (hdf->bitrate_index < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ hdf->nb_channels = ff_av3a_channels_map_table[hdf->channel_number_index].channels; ++ soundbed_bitrate = ff_av3a_bitrate_map_table[hdf->channel_number_index].bitrate_table[hdf->bitrate_index]; ++ ++ hdf->object_channel_number = get_bits(gb, 7); ++ if (hdf->object_channel_number < 0) { ++ return AVERROR_INVALIDDATA; ++ } ++ hdf->bitrate_index_per_channel = get_bits(gb, 4); ++ if ((hdf->bitrate_index_per_channel >= AV3A_BITRATE_TABLE_SIZE) || (hdf->bitrate_index_per_channel < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ hdf->nb_objects = hdf->object_channel_number + 1; ++ object_bitrate = ff_av3a_bitrate_map_table[CHANNEL_CONFIG_MONO].bitrate_table[hdf->bitrate_index_per_channel]; ++ hdf->total_bitrate = soundbed_bitrate + (object_bitrate * hdf->nb_objects); ++ } else { ++ return AVERROR_INVALIDDATA; ++ } ++ } else if (hdf->coding_profile == AV3A_AMBISONIC_PROFILE) { ++ hdf->content_type = AV3A_AMBISONIC_TYPE; ++ hdf->order = get_bits(gb, 4); ++ hdf->hoa_order = hdf->order + 1; ++ ++ switch (hdf->hoa_order) { ++ case AV3A_AMBISONIC_FIRST_ORDER: ++ hdf->channel_number_index = CHANNEL_CONFIG_HOA_ORDER1; ++ break; ++ case AV3A_AMBISONIC_SECOND_ORDER: ++ hdf->channel_number_index = CHANNEL_CONFIG_HOA_ORDER2; ++ break; ++ case AV3A_AMBISONIC_THIRD_ORDER: ++ hdf->channel_number_index = CHANNEL_CONFIG_HOA_ORDER3; ++ break; ++ default: ++ return AVERROR_INVALIDDATA; ++ } ++ hdf->nb_channels = ff_av3a_channels_map_table[hdf->channel_number_index].channels; ++ } else { ++ return AVERROR_INVALIDDATA; ++ } ++ hdf->total_channels = hdf->nb_channels + hdf->nb_objects; ++ ++ hdf->resolution_index = get_bits(gb, 2); ++ if ((hdf->resolution_index >= AV3A_RESOLUTION_TABLE_SIZE) || (hdf->resolution_index < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ hdf->resolution = ff_av3a_sample_format_map_table[hdf->resolution_index].resolution; ++ hdf->sample_format = ff_av3a_sample_format_map_table[hdf->resolution_index].sample_format; ++ ++ if (hdf->coding_profile != AV3A_OBJECT_METADATA_PROFILE) { ++ hdf->bitrate_index = get_bits(gb, 4); ++ if ((hdf->bitrate_index >= AV3A_BITRATE_TABLE_SIZE) || (hdf->bitrate_index < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ hdf->total_bitrate = ff_av3a_bitrate_map_table[hdf->channel_number_index].bitrate_table[hdf->bitrate_index]; ++ } ++ ++ skip_bits(gb, 8); /* skip CRC 8 bits */ ++ ++ return 0; ++} ++ ++static int raw_av3a_parse(AVCodecParserContext *s, AVCodecContext *avctx, const uint8_t **poutbuf, ++ int32_t *poutbuf_size, const uint8_t *buf, int32_t buf_size) ++{ ++ int ret = 0; ++ uint8_t header[AV3A_MAX_NBYTES_HEADER]; ++ AATFHeaderInfo hdf; ++ GetBitContext gb; ++ ++ if (buf_size < AV3A_MAX_NBYTES_HEADER) { ++ return buf_size; ++ } ++ memcpy(header, buf, AV3A_MAX_NBYTES_HEADER); ++ ++ init_get_bits8(&gb, buf, AV3A_MAX_NBYTES_HEADER); ++ if ((ret = ff_read_av3a_header_parse(&gb, &hdf)) != 0) { ++ return ret; ++ } ++ ++ avctx->codec_id = AV_CODEC_ID_AVS3DA; ++ avctx->frame_size = AV3A_AUDIO_FRAME_SIZE; ++ avctx->bits_per_raw_sample = hdf.resolution; ++ avctx->sample_rate = hdf.sampling_rate; ++ avctx->bit_rate = hdf.total_bitrate; ++ ++ avctx->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC; ++ avctx->ch_layout.nb_channels = hdf.total_channels; ++ ++ *poutbuf = buf; ++ *poutbuf_size = buf_size; ++ ++ return buf_size; ++} ++ ++const FFCodecParser ff_av3a_parser = { ++ PARSER_CODEC_LIST(AV_CODEC_ID_AVS3DA), ++ .priv_data_size = sizeof(Av3aParseContext), ++ .parse = raw_av3a_parse, ++}; +diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c +index a9f21f8..93877ed 100644 +--- a/libavcodec/codec_desc.c ++++ b/libavcodec/codec_desc.c +@@ -3863,6 +3863,13 @@ static const AVCodecDescriptor codec_descriptors[] = { + .long_name = NULL_IF_CONFIG_SMALL("AVFrame to AVPacket passthrough"), + .props = AV_CODEC_PROP_LOSSLESS, + }, ++ { ++ .id = AV_CODEC_ID_AVS3DA, ++ .type = AVMEDIA_TYPE_AUDIO, ++ .name = "av3a", ++ .long_name = NULL_IF_CONFIG_SMALL("Audio Vivid"), ++ .props = AV_CODEC_PROP_LOSSY, ++ }, + { + .id = AV_CODEC_ID_VNULL, + .type = AVMEDIA_TYPE_VIDEO, +diff --git a/libavcodec/codec_id.h b/libavcodec/codec_id.h +index 6529f0a..43f7549 100644 +--- a/libavcodec/codec_id.h ++++ b/libavcodec/codec_id.h +@@ -628,6 +628,7 @@ enum AVCodecID { + * Dummy null video codec, useful mainly for development and debugging. + * Null encoder/decoder discard all input and never return any output. + */ ++ AV_CODEC_ID_AVS3DA, + AV_CODEC_ID_VNULL, + /** + * Dummy null audio codec, useful mainly for development and debugging. +diff --git a/libavcodec/parsers.c b/libavcodec/parsers.c +index 162b96c..415c842 100644 +--- a/libavcodec/parsers.c ++++ b/libavcodec/parsers.c +@@ -47,6 +47,7 @@ extern const FFCodecParser ff_apv_parser; + extern const FFCodecParser ff_av1_parser; + extern const FFCodecParser ff_avs2_parser; + extern const FFCodecParser ff_avs3_parser; ++extern const FFCodecParser ff_av3a_parser; + extern const FFCodecParser ff_bmp_parser; + extern const FFCodecParser ff_cavsvideo_parser; + extern const FFCodecParser ff_cook_parser; +diff --git a/libavcodec/utils.c b/libavcodec/utils.c +index 615d60c..46f2123 100644 +--- a/libavcodec/utils.c ++++ b/libavcodec/utils.c +@@ -603,6 +603,7 @@ static int get_audio_frame_duration(enum AVCodecID id, int sr, int ch, int ba, + case AV_CODEC_ID_MP2: + case AV_CODEC_ID_MUSEPACK7: return 1152; + case AV_CODEC_ID_AC3: return 1536; ++ case AV_CODEC_ID_AVS3DA: return 1024; + case AV_CODEC_ID_FTR: return 1024; + } + +diff --git a/libavformat/Makefile b/libavformat/Makefile +index 85ed05b..158a11d 100644 +--- a/libavformat/Makefile ++++ b/libavformat/Makefile +@@ -169,6 +169,7 @@ OBJS-$(CONFIG_AVS2_DEMUXER) += avs2dec.o rawdec.o + OBJS-$(CONFIG_AVS2_MUXER) += rawenc.o + OBJS-$(CONFIG_AVS3_DEMUXER) += avs3dec.o rawdec.o + OBJS-$(CONFIG_AVS3_MUXER) += rawenc.o ++OBJS-$(CONFIG_AV3A_DEMUXER) += av3adec.o + OBJS-$(CONFIG_BETHSOFTVID_DEMUXER) += bethsoftvid.o + OBJS-$(CONFIG_BFI_DEMUXER) += bfi.o + OBJS-$(CONFIG_BINK_DEMUXER) += bink.o +diff --git a/libavformat/allformats.c b/libavformat/allformats.c +index e2f37da..1a05db9 100644 +--- a/libavformat/allformats.c ++++ b/libavformat/allformats.c +@@ -101,6 +101,7 @@ extern const FFInputFormat ff_avs2_demuxer; + extern const FFOutputFormat ff_avs2_muxer; + extern const FFInputFormat ff_avs3_demuxer; + extern const FFOutputFormat ff_avs3_muxer; ++extern const FFInputFormat ff_av3a_demuxer; + extern const FFInputFormat ff_bethsoftvid_demuxer; + extern const FFInputFormat ff_bfi_demuxer; + extern const FFInputFormat ff_bintext_demuxer; +diff --git a/libavformat/av3adec.c b/libavformat/av3adec.c +new file mode 100644 +index 0000000..9bb8729 +--- /dev/null ++++ b/libavformat/av3adec.c +@@ -0,0 +1,473 @@ ++/* ++ * AV3A Demuxer ++ * ++ * Copyright (c) 2024 Shuai Liu ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++#include "avformat.h" ++#include "avio_internal.h" ++#include "internal.h" ++#include "rawdec.h" ++#include "libavutil/opt.h" ++#include "libavutil/avassert.h" ++#include "libavutil/intreadwrite.h" ++#include "libavutil/channel_layout.h" ++#include "libavcodec/get_bits.h" ++#include "libavcodec/av3a.h" ++#include ++ ++typedef struct { ++ uint8_t audio_codec_id; ++ uint8_t sampling_frequency_index; ++ uint8_t nn_type; ++ uint8_t content_type; ++ uint8_t channel_number_index; ++ uint8_t number_objects; ++ uint8_t hoa_order; ++ uint8_t resolution_index; ++ uint16_t total_bitrate_kbps; ++} Av3aFormatContext; ++ ++static int av3a_read_aatf_frame_header(AATFHeaderInfo *hdf, const uint8_t *buf) ++{ ++ int16_t sync_word; ++ GetBitContext gb; ++ ++ hdf->nb_channels = 0; ++ hdf->nb_objects = 0; ++ ++ init_get_bits8(&gb, buf, AV3A_MAX_NBYTES_HEADER); ++ ++ sync_word = get_bits(&gb, 12); ++ if (sync_word != AV3A_AUDIO_SYNC_WORD) { ++ return AVERROR_INVALIDDATA; ++ } ++ ++ /* codec id */ ++ hdf->audio_codec_id = get_bits(&gb, 4); ++ if (hdf->audio_codec_id != AV3A_LOSSY_CODEC_ID) { ++ return AVERROR_INVALIDDATA; ++ } ++ ++ /* anc data */ ++ hdf->anc_data = get_bits(&gb, 1); ++ if (hdf->anc_data) { ++ return AVERROR_INVALIDDATA; ++ } ++ ++ /* neural network type */ ++ hdf->nn_type = get_bits(&gb, 3); ++ if ((hdf->nn_type > AV3A_LC_NN_TYPE) || (hdf->nn_type < AV3A_BASELINE_NN_TYPE)) { ++ return AVERROR_INVALIDDATA; ++ } ++ ++ /* coding profile */ ++ hdf->coding_profile = get_bits(&gb, 3); ++ ++ /* sampling rate */ ++ hdf->sampling_frequency_index = get_bits(&gb, 4); ++ if ((hdf->sampling_frequency_index >= AV3A_FS_TABLE_SIZE) || (hdf->sampling_frequency_index < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ hdf->sampling_rate = ff_av3a_sampling_rate_table[hdf->sampling_frequency_index]; ++ ++ skip_bits(&gb, 8); ++ ++ if (hdf->coding_profile == AV3A_BASE_PROFILE) { ++ hdf->content_type = AV3A_CHANNEL_BASED_TYPE; ++ hdf->channel_number_index = get_bits(&gb, 7); ++ if ((hdf->channel_number_index >= CHANNEL_CONFIG_UNKNOWN) || ++ (hdf->channel_number_index == CHANNEL_CONFIG_MC_10_2) || ++ (hdf->channel_number_index == CHANNEL_CONFIG_MC_22_2) || ++ (hdf->channel_number_index < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ hdf->nb_channels = ff_av3a_channels_map_table[hdf->channel_number_index].channels; ++ } else if (hdf->coding_profile == AV3A_OBJECT_METADATA_PROFILE) { ++ hdf->soundbed_type = get_bits(&gb, 2); ++ if (hdf->soundbed_type == 0) { ++ hdf->content_type = AV3A_OBJECT_BASED_TYPE; ++ hdf->object_channel_number = get_bits(&gb, 7); ++ if (hdf->object_channel_number < 0) { ++ return AVERROR_INVALIDDATA; ++ } ++ hdf->bitrate_index_per_channel = get_bits(&gb, 4); ++ if ((hdf->bitrate_index_per_channel >= AV3A_BITRATE_TABLE_SIZE) || (hdf->bitrate_index_per_channel < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ hdf->nb_objects = hdf->object_channel_number + 1; ++ hdf->total_bitrate = ff_av3a_bitrate_map_table[CHANNEL_CONFIG_MONO].bitrate_table[hdf->bitrate_index_per_channel] * hdf->nb_objects; ++ } else if (hdf->soundbed_type == 1) { ++ hdf->content_type = AV3A_CHANNEL_OBJECT_TYPE; ++ hdf->channel_number_index = get_bits(&gb, 7); ++ if ((hdf->channel_number_index >= CHANNEL_CONFIG_UNKNOWN) || ++ (hdf->channel_number_index == CHANNEL_CONFIG_MC_10_2) || ++ (hdf->channel_number_index == CHANNEL_CONFIG_MC_22_2) || ++ (hdf->channel_number_index < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ hdf->nb_channels = ff_av3a_channels_map_table[hdf->channel_number_index].channels; ++ hdf->bitrate_index = get_bits(&gb, 4); ++ if ((hdf->bitrate_index >= AV3A_BITRATE_TABLE_SIZE) || (hdf->bitrate_index < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ ++ hdf->object_channel_number = get_bits(&gb, 7); ++ if (hdf->object_channel_number < 0) { ++ return AVERROR_INVALIDDATA; ++ } ++ hdf->nb_objects = hdf->object_channel_number + 1; ++ hdf->bitrate_index_per_channel = get_bits(&gb, 4); ++ if ((hdf->bitrate_index_per_channel >= AV3A_BITRATE_TABLE_SIZE) || (hdf->bitrate_index_per_channel < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ ++ hdf->total_bitrate = ff_av3a_bitrate_map_table[hdf->channel_number_index].bitrate_table[hdf->bitrate_index] + ++ ff_av3a_bitrate_map_table[CHANNEL_CONFIG_MONO].bitrate_table[hdf->bitrate_index_per_channel] * hdf->nb_objects; ++ } else { ++ return AVERROR_INVALIDDATA; ++ } ++ } else if (hdf->coding_profile == AV3A_AMBISONIC_PROFILE) { ++ hdf->content_type = AV3A_AMBISONIC_TYPE; ++ hdf->order = get_bits(&gb, 4); ++ hdf->hoa_order = hdf->order + 1; ++ ++ switch (hdf->hoa_order) { ++ case AV3A_AMBISONIC_FIRST_ORDER: ++ hdf->channel_number_index = CHANNEL_CONFIG_HOA_ORDER1; ++ break; ++ case AV3A_AMBISONIC_SECOND_ORDER: ++ hdf->channel_number_index = CHANNEL_CONFIG_HOA_ORDER2; ++ break; ++ case AV3A_AMBISONIC_THIRD_ORDER: ++ hdf->channel_number_index = CHANNEL_CONFIG_HOA_ORDER3; ++ break; ++ default: ++ return AVERROR_INVALIDDATA; ++ } ++ hdf->nb_channels = ff_av3a_channels_map_table[hdf->channel_number_index].channels; ++ } else { ++ return AVERROR_INVALIDDATA; ++ } ++ ++ hdf->total_channels = hdf->nb_channels + hdf->nb_objects; ++ ++ /* resolution */ ++ hdf->resolution_index = get_bits(&gb, 2); ++ if ((hdf->resolution_index >= AV3A_RESOLUTION_TABLE_SIZE) || (hdf->resolution_index < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ hdf->resolution = ff_av3a_sample_format_map_table[hdf->resolution_index].resolution; ++ hdf->sample_format = ff_av3a_sample_format_map_table[hdf->resolution_index].sample_format; ++ ++ if (hdf->coding_profile != AV3A_OBJECT_METADATA_PROFILE) { ++ hdf->bitrate_index = get_bits(&gb, 4); ++ if ((hdf->bitrate_index >= AV3A_BITRATE_TABLE_SIZE) || (hdf->bitrate_index < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ hdf->total_bitrate = ff_av3a_bitrate_map_table[hdf->channel_number_index].bitrate_table[hdf->bitrate_index]; ++ } ++ ++ skip_bits(&gb, 8); ++ ++ return 0; ++} ++ ++static int av3a_get_packet_size(AVFormatContext *s) ++{ ++ int ret = 0; ++ int read_bytes = 0; ++ uint16_t sync_word = 0; ++ int payload_bytes = 0; ++ int payloud_bits = 0; ++ uint8_t header[AV3A_MAX_NBYTES_HEADER]; ++ GetBitContext gb; ++ int32_t sampling_rate; ++ int16_t coding_profile, sampling_frequency_index, channel_number_index; ++ int16_t bitrate_index, bitrate_index_per_channel; ++ int16_t objects, hoa_order; ++ int64_t total_bitrate; ++ ++ if (!s) { ++ return AVERROR(ENOMEM); ++ } ++ ++ if (!s->pb) { ++ return AVERROR(ENOMEM); ++ } ++ ++ read_bytes = avio_read(s->pb, header, AV3A_MAX_NBYTES_HEADER); ++ if (read_bytes != AV3A_MAX_NBYTES_HEADER) { ++ return (read_bytes < 0) ? read_bytes : AVERROR_EOF; ++ } ++ ++ init_get_bits8(&gb, header, AV3A_MAX_NBYTES_HEADER); ++ ++ sync_word = get_bits(&gb, 12); ++ if (sync_word != AV3A_AUDIO_SYNC_WORD) { ++ return AVERROR_INVALIDDATA; ++ } ++ ++ skip_bits(&gb, 8); ++ ++ coding_profile = get_bits(&gb, 3); ++ sampling_frequency_index = get_bits(&gb, 4); ++ if ((sampling_frequency_index >= AV3A_FS_TABLE_SIZE) || (sampling_frequency_index < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ sampling_rate = ff_av3a_sampling_rate_table[sampling_frequency_index]; ++ ++ skip_bits(&gb, 8); ++ ++ if (coding_profile == AV3A_BASE_PROFILE) { ++ channel_number_index = get_bits(&gb, 7); ++ if ((channel_number_index >= CHANNEL_CONFIG_UNKNOWN) || ++ (channel_number_index == CHANNEL_CONFIG_MC_10_2) || ++ (channel_number_index == CHANNEL_CONFIG_MC_22_2) || ++ (channel_number_index < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ } else if (coding_profile == AV3A_OBJECT_METADATA_PROFILE) { ++ int64_t soundbed_bitrate, objects_bitrate; ++ int16_t soundbed_type = get_bits(&gb, 2); ++ if (soundbed_type == 0) { ++ objects = get_bits(&gb, 7); ++ if (objects < 0) { ++ return AVERROR_INVALIDDATA; ++ } ++ objects += 1; ++ ++ bitrate_index_per_channel = get_bits(&gb, 4); ++ if ((bitrate_index_per_channel >= AV3A_BITRATE_TABLE_SIZE) || (bitrate_index_per_channel < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ total_bitrate = ff_av3a_bitrate_map_table[CHANNEL_CONFIG_MONO].bitrate_table[bitrate_index_per_channel] * objects; ++ } else if (soundbed_type == 1) { ++ channel_number_index = get_bits(&gb, 7); ++ if ((channel_number_index >= CHANNEL_CONFIG_UNKNOWN) || ++ (channel_number_index == CHANNEL_CONFIG_MC_10_2) || ++ (channel_number_index == CHANNEL_CONFIG_MC_22_2) || ++ (channel_number_index < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ ++ bitrate_index = get_bits(&gb, 4); ++ if ((bitrate_index >= AV3A_BITRATE_TABLE_SIZE) || (bitrate_index < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ soundbed_bitrate = ff_av3a_bitrate_map_table[channel_number_index].bitrate_table[bitrate_index]; ++ ++ objects = get_bits(&gb, 7); ++ if (objects < 0) { ++ return AVERROR_INVALIDDATA; ++ } ++ objects += 1; ++ bitrate_index_per_channel = get_bits(&gb, 4); ++ if ((bitrate_index_per_channel >= AV3A_BITRATE_TABLE_SIZE) || (bitrate_index_per_channel < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ ++ objects_bitrate = ff_av3a_bitrate_map_table[CHANNEL_CONFIG_MONO].bitrate_table[bitrate_index_per_channel]; ++ total_bitrate = soundbed_bitrate + (objects_bitrate * objects); ++ } else { ++ return AVERROR_INVALIDDATA; ++ } ++ } else if (coding_profile == AV3A_AMBISONIC_PROFILE) { ++ hoa_order = get_bits(&gb, 4); ++ hoa_order += 1; ++ ++ switch (hoa_order) { ++ case AV3A_AMBISONIC_FIRST_ORDER: ++ channel_number_index = CHANNEL_CONFIG_HOA_ORDER1; ++ break; ++ case AV3A_AMBISONIC_SECOND_ORDER: ++ channel_number_index = CHANNEL_CONFIG_HOA_ORDER2; ++ break; ++ case AV3A_AMBISONIC_THIRD_ORDER: ++ channel_number_index = CHANNEL_CONFIG_HOA_ORDER3; ++ break; ++ default: ++ return AVERROR_INVALIDDATA; ++ } ++ } else { ++ return AVERROR_INVALIDDATA; ++ } ++ ++ skip_bits(&gb, 2); ++ if (coding_profile != AV3A_OBJECT_METADATA_PROFILE) { ++ bitrate_index = get_bits(&gb, 4); ++ if ((bitrate_index >= AV3A_BITRATE_TABLE_SIZE) || (bitrate_index < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ total_bitrate = ff_av3a_bitrate_map_table[channel_number_index].bitrate_table[bitrate_index]; ++ } ++ ++ skip_bits(&gb, 8); ++ ++ if (sampling_rate == 44100) { ++ payloud_bits = (int)floor(((float) (total_bitrate) / sampling_rate) * AV3A_AUDIO_FRAME_SIZE); ++ payload_bytes = (int)ceil((float)payloud_bits / 8); ++ } else { ++ payload_bytes = (int)ceil((((float) (total_bitrate) / sampling_rate) * AV3A_AUDIO_FRAME_SIZE) / 8); ++ } ++ ++ if ((ret = avio_seek(s->pb, -read_bytes, SEEK_CUR)) < 0) { ++ return ret; ++ } ++ ++ return payload_bytes; ++} ++ ++static int av3a_probe(const AVProbeData *p) ++{ ++ uint16_t frame_sync_word; ++ uint16_t lval = ((uint16_t)(p->buf[0])); ++ uint16_t rval = ((uint16_t)(p->buf[1])); ++ frame_sync_word = ((lval << 8) | rval) >> 4; ++ ++ if (frame_sync_word == AV3A_AUDIO_SYNC_WORD && av_match_ext(p->filename, "av3a")) { ++ return AVPROBE_SCORE_MAX; ++ } ++ ++ return 0; ++} ++ ++static int av3a_read_header(AVFormatContext *s) ++{ ++ int ret = 0; ++ uint8_t header[AV3A_MAX_NBYTES_HEADER]; ++ AVStream *stream = NULL; ++ Av3aFormatContext av3afmtctx; ++ AATFHeaderInfo hdf; ++ ++ if (!s) { ++ return AVERROR(ENOMEM); ++ } ++ ++ if (!(stream = avformat_new_stream(s, NULL))) { ++ return AVERROR(ENOMEM); ++ } ++ ++ stream->start_time = 0; ++ ffstream(stream)->need_parsing = AVSTREAM_PARSE_FULL_RAW; ++ stream->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; ++ stream->codecpar->codec_id = ((const FFInputFormat*)(s->iformat))->raw_codec_id; ++ stream->codecpar->codec_tag = MKTAG('a', 'v', '3', 'a'); ++ ++ if ((ret = avio_read(s->pb, header, AV3A_MAX_NBYTES_HEADER)) != AV3A_MAX_NBYTES_HEADER) { ++ return (ret < 0) ? ret : AVERROR_EOF; ++ } ++ ++ ret = av3a_read_aatf_frame_header(&hdf, header); ++ if (ret) { ++ return ret; ++ } ++ ++ /* stream parameters */ ++ stream->codecpar->format = hdf.sample_format; ++ stream->codecpar->bits_per_raw_sample = hdf.resolution; ++ stream->codecpar->bit_rate = hdf.total_bitrate; ++ stream->codecpar->sample_rate = (int) (hdf.sampling_rate); ++ stream->codecpar->frame_size = AV3A_AUDIO_FRAME_SIZE; ++ stream->codecpar->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC; ++ stream->codecpar->ch_layout.nb_channels = hdf.total_channels; ++ ++ /* extradata */ ++ av3afmtctx.audio_codec_id = hdf.audio_codec_id; ++ av3afmtctx.sampling_frequency_index = hdf.sampling_frequency_index; ++ av3afmtctx.nn_type = hdf.nn_type; ++ av3afmtctx.content_type = hdf.content_type; ++ av3afmtctx.channel_number_index = hdf.channel_number_index; ++ av3afmtctx.number_objects = hdf.nb_objects; ++ av3afmtctx.hoa_order = hdf.hoa_order; ++ av3afmtctx.resolution_index = hdf.resolution_index; ++ av3afmtctx.total_bitrate_kbps = (int) (hdf.total_bitrate / 1000); ++ ++ if ((ret = ff_alloc_extradata(stream->codecpar, sizeof(Av3aFormatContext))) < 0) { ++ return ret; ++ } ++ memcpy(stream->codecpar->extradata, &av3afmtctx, sizeof(Av3aFormatContext)); ++ ++ if ((ret = avio_seek(s->pb, -AV3A_MAX_NBYTES_HEADER, SEEK_CUR)) < 0) { ++ return ret; ++ } ++ ++ return 0; ++} ++ ++static int av3a_read_packet(AVFormatContext *s, AVPacket *pkt) ++{ ++ int64_t pos; ++ int packet_size = 0; ++ int read_bytes = 0; ++ int ret = 0; ++ ++ if (!s) { ++ return AVERROR(ENOMEM); ++ } ++ ++ if (avio_feof(s->pb)) { ++ return AVERROR_EOF; ++ } ++ pos = avio_tell(s->pb); ++ ++ if (!(packet_size = av3a_get_packet_size(s))) { ++ return AVERROR_EOF; ++ } ++ ++ if (packet_size < 0) { ++ return packet_size; ++ } ++ ++ if ((ret = av_new_packet(pkt, packet_size)) < 0) { ++ return ret; ++ } ++ ++ if (!s->streams[0]) { ++ return AVERROR(ENOMEM); ++ } ++ ++ if (!s->streams[0]->codecpar) { ++ return AVERROR(ENOMEM); ++ } ++ ++ pkt->stream_index = 0; ++ pkt->pos = pos; ++ pkt->duration = s->streams[0]->codecpar->frame_size; ++ ++ read_bytes = avio_read(s->pb, pkt->data, packet_size); ++ if (read_bytes != packet_size) { ++ return (read_bytes < 0) ? read_bytes : AVERROR_EOF; ++ } ++ ++ return 0; ++} ++ ++const FFInputFormat ff_av3a_demuxer = { ++ .p.name = "av3a", ++ .p.long_name = NULL_IF_CONFIG_SMALL("Audio Vivid"), ++ .raw_codec_id = AV_CODEC_ID_AVS3DA, ++ .p.priv_class = &ff_raw_demuxer_class, ++ .priv_data_size = sizeof(FFRawDemuxerContext), ++ .read_probe = av3a_probe, ++ .read_header = av3a_read_header, ++ .read_packet = av3a_read_packet, ++ .p.flags = AVFMT_GENERIC_INDEX, ++ .p.extensions = "av3a", ++ .p.mime_type = "audio/av3a", ++}; +\ No newline at end of file +diff --git a/libavformat/isom_tags.c b/libavformat/isom_tags.c +index 1cd655b..528c518 100644 +--- a/libavformat/isom_tags.c ++++ b/libavformat/isom_tags.c +@@ -368,6 +368,7 @@ const AVCodecTag ff_codec_movaudio_tags[] = { + { AV_CODEC_ID_TRUEHD, MKTAG('m', 'l', 'p', 'a') }, /* mp4ra.org */ + { AV_CODEC_ID_OPUS, MKTAG('O', 'p', 'u', 's') }, /* mp4ra.org */ + { AV_CODEC_ID_MPEGH_3D_AUDIO, MKTAG('m', 'h', 'm', '1') }, /* MPEG-H 3D Audio bitstream */ ++ { AV_CODEC_ID_AVS3DA, MKTAG('a', 'v', '3', 'a') }, /* AVS3 Audio */ + { AV_CODEC_ID_NONE, 0 }, + }; + +diff --git a/libavformat/mov.c b/libavformat/mov.c +index e114770..b639fe1 100644 +--- a/libavformat/mov.c ++++ b/libavformat/mov.c +@@ -71,6 +71,10 @@ + #include "mov_chan.h" + #include "replaygain.h" + ++#if CONFIG_AV3A_DEMUXER ++#include "libavcodec/av3a.h" ++#endif ++ + #if CONFIG_ZLIB + #include + #endif +@@ -88,6 +92,123 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom); + static int mov_read_mfra(MOVContext *c, AVIOContext *f); + static void mov_free_stream_context(AVFormatContext *s, AVStream *st); + ++#if CONFIG_AV3A_DEMUXER ++static int mov_read_dca3(MOVContext *c, AVIOContext *pb, MOVAtom atom) ++{ ++ int ret; ++ int nb_channels = 0; ++ int nb_objects = 0; ++ AVStream *st; ++ GetBitContext gb; ++ uint8_t buffer[7]; ++ int audio_codec_id, sampling_frequency_index; ++ int nn_type, content_type, channel_number_index = 0, number_objects; ++ int hoa_order, resolution_index; ++ int bitrate_kbps; ++ ++ if (atom.size < AV3A_DCA3_BOX_MIN_SIZE) ++ return AVERROR_INVALIDDATA; ++ ++ if (c->fc->nb_streams < 1) ++ return 0; ++ st = c->fc->streams[c->fc->nb_streams - 1]; ++ ++ ret = avio_read(pb, buffer, sizeof(buffer)); ++ if (ret < 0) ++ return ret; ++ if (ret != (int)sizeof(buffer)) ++ return AVERROR_INVALIDDATA; ++ ++ init_get_bits8(&gb, buffer, sizeof(buffer)); ++ ++ audio_codec_id = get_bits(&gb, 4); ++ if (audio_codec_id != AV3A_LOSSY_CODEC_ID) ++ return AVERROR_INVALIDDATA; ++ ++ st->codecpar->frame_size = AV3A_AUDIO_FRAME_SIZE; ++ sampling_frequency_index = get_bits(&gb, 4); ++ if (sampling_frequency_index >= AV3A_FS_TABLE_SIZE) ++ return AVERROR_INVALIDDATA; ++ st->codecpar->sample_rate = ff_av3a_sampling_rate_table[sampling_frequency_index]; ++ ++ nn_type = get_bits(&gb, 3); ++ if (nn_type > AV3A_LC_NN_TYPE || nn_type < AV3A_BASELINE_NN_TYPE) ++ return AVERROR_INVALIDDATA; ++ ++ skip_bits(&gb, 1); ++ content_type = get_bits(&gb, 4); ++ if (content_type == AV3A_CHANNEL_BASED_TYPE) { ++ channel_number_index = get_bits(&gb, 7); ++ skip_bits(&gb, 1); ++ if (channel_number_index >= CHANNEL_CONFIG_UNKNOWN || ++ channel_number_index == CHANNEL_CONFIG_MC_10_2 || ++ channel_number_index == CHANNEL_CONFIG_MC_22_2) ++ return AVERROR_INVALIDDATA; ++ nb_channels = ff_av3a_channels_map_table[channel_number_index].channels; ++ } else if (content_type == AV3A_OBJECT_BASED_TYPE) { ++ number_objects = get_bits(&gb, 7); ++ skip_bits(&gb, 1); ++ nb_objects = number_objects; ++ if (nb_objects < 1) ++ return AVERROR_INVALIDDATA; ++ } else if (content_type == AV3A_CHANNEL_OBJECT_TYPE) { ++ channel_number_index = get_bits(&gb, 7); ++ skip_bits(&gb, 1); ++ if (channel_number_index >= CHANNEL_CONFIG_UNKNOWN || ++ channel_number_index == CHANNEL_CONFIG_MC_10_2 || ++ channel_number_index == CHANNEL_CONFIG_MC_22_2) ++ return AVERROR_INVALIDDATA; ++ number_objects = get_bits(&gb, 7); ++ skip_bits(&gb, 1); ++ nb_channels = ff_av3a_channels_map_table[channel_number_index].channels; ++ nb_objects = number_objects; ++ if (nb_objects < 1) ++ return AVERROR_INVALIDDATA; ++ } else if (content_type == AV3A_AMBISONIC_TYPE) { ++ hoa_order = get_bits(&gb, 4); ++ if (hoa_order < AV3A_AMBISONIC_FIRST_ORDER || ++ hoa_order > AV3A_AMBISONIC_THIRD_ORDER) ++ return AVERROR_INVALIDDATA; ++ nb_channels = (hoa_order + 1) * (hoa_order + 1); ++ } else { ++ return AVERROR_INVALIDDATA; ++ } ++ ++ bitrate_kbps = get_bits(&gb, 16); ++ st->codecpar->bit_rate = bitrate_kbps * 1000; ++ ++ resolution_index = get_bits(&gb, 2); ++ if (resolution_index >= AV3A_RESOLUTION_TABLE_SIZE) ++ return AVERROR_INVALIDDATA; ++ st->codecpar->format = ff_av3a_sample_format_map_table[resolution_index].sample_format; ++ st->codecpar->bits_per_raw_sample = ff_av3a_sample_format_map_table[resolution_index].resolution; ++ ++ av_channel_layout_uninit(&st->codecpar->ch_layout); ++ if (content_type != AV3A_AMBISONIC_TYPE) { ++ st->codecpar->ch_layout.order = AV_CHANNEL_ORDER_CUSTOM; ++ st->codecpar->ch_layout.nb_channels = nb_channels + nb_objects; ++ st->codecpar->ch_layout.u.map = av_calloc(st->codecpar->ch_layout.nb_channels, ++ sizeof(*st->codecpar->ch_layout.u.map)); ++ if (!st->codecpar->ch_layout.u.map) ++ return AVERROR(ENOMEM); ++ ++ if (content_type != AV3A_OBJECT_BASED_TYPE) { ++ for (int i = 0; i < nb_channels; i++) ++ st->codecpar->ch_layout.u.map[i].id = ++ ff_av3a_channels_map_table[channel_number_index].channel_layout[i]; ++ } ++ ++ for (int i = nb_channels; i < st->codecpar->ch_layout.nb_channels; i++) ++ st->codecpar->ch_layout.u.map[i].id = AV3A_CH_AUDIO_OBJECT; ++ } else { ++ st->codecpar->ch_layout.order = AV_CHANNEL_ORDER_AMBISONIC; ++ st->codecpar->ch_layout.nb_channels = nb_channels; ++ } ++ ++ return 0; ++} ++#endif ++ + static int mov_metadata_track_or_disc_number(MOVContext *c, AVIOContext *pb, + unsigned len, const char *key) + { +@@ -9640,6 +9761,9 @@ static const MOVParseTableEntry mov_default_parse_table[] = { + #if CONFIG_IAMFDEC + { MKTAG('i','a','c','b'), mov_read_iacb }, + #endif ++#if CONFIG_AV3A_DEMUXER ++{ MKTAG('d','c','a','3'), mov_read_dca3 }, ++#endif + { MKTAG('s','r','a','t'), mov_read_srat }, + { 0, NULL } + }; +diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c +index 47944c7..d682526 100644 +--- a/libavformat/mpegts.c ++++ b/libavformat/mpegts.c +@@ -825,6 +825,9 @@ static const StreamType ISO_types[] = { + { STREAM_TYPE_VIDEO_DIRAC, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_DIRAC }, + { STREAM_TYPE_VIDEO_AVS2, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_AVS2 }, + { STREAM_TYPE_VIDEO_AVS3, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_AVS3 }, ++#if CONFIG_AV3A_DEMUXER ++ { STREAM_TYPE_AUDIO_AV3A, AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_AVS3DA }, ++#endif + { STREAM_TYPE_VIDEO_VC1, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_VC1 }, + { 0 }, + }; +@@ -883,6 +886,9 @@ static const StreamType REGD_types[] = { + { MKTAG('I', 'D', '3', ' '), AVMEDIA_TYPE_DATA, AV_CODEC_ID_TIMED_ID3 }, + { MKTAG('V', 'C', '-', '1'), AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_VC1 }, + { MKTAG('O', 'p', 'u', 's'), AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_OPUS }, ++#if CONFIG_AV3A_DEMUXER ++ { MKTAG('a', 'v', '3', 'a'), AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_AVS3DA}, ++#endif + { 0 }, + }; + +diff --git a/libavformat/mpegts.h b/libavformat/mpegts.h +index 18f326b..92c95ef 100644 +--- a/libavformat/mpegts.h ++++ b/libavformat/mpegts.h +@@ -152,6 +152,7 @@ + #define STREAM_TYPE_VIDEO_AVS3 0xd4 + #define STREAM_TYPE_VIDEO_VC1 0xea + #define STREAM_TYPE_VIDEO_DIRAC 0xd1 ++#define STREAM_TYPE_AUDIO_AV3A 0xd5 + + /* stream_type values [0x80, 0xff] are User Private */ + #define STREAM_TYPE_BLURAY_AUDIO_PCM_BLURAY 0x80 +-- +2.50.1 (Apple Git-155) + diff --git a/patches/ffmpeg-n8.1.1/0018-http-add-reconnect_first_delay-opt.patch b/patches/ffmpeg-n8.1.1/0018-http-add-reconnect_first_delay-opt.patch new file mode 100644 index 000000000..99c7aa086 --- /dev/null +++ b/patches/ffmpeg-n8.1.1/0018-http-add-reconnect_first_delay-opt.patch @@ -0,0 +1,41 @@ +From c6578110a2bf027b1fff7eb263c80499f2179584 Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Thu, 29 May 2025 09:57:28 +0800 +Subject: http add reconnect_first_delay opt + +--- + libavformat/http.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/libavformat/http.c b/libavformat/http.c +index f4bf225728..cd39796ab3 100644 +--- a/libavformat/http.c ++++ b/libavformat/http.c +@@ -131,6 +131,7 @@ typedef struct HTTPContext { + int reconnect_on_network_error; + int reconnect_streamed; + int reconnect_delay_max; ++ int reconnect_first_delay; + char *reconnect_on_http_error; + int listen; + char *resource; +@@ -205,6 +206,7 @@ static const AVOption options[] = { + { "reconnect_max_retries", "the max number of times to retry a connection", OFFSET(reconnect_max_retries), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, D }, + { "reconnect_delay_total_max", "max total reconnect delay in seconds after which to give up", OFFSET(reconnect_delay_total_max), AV_OPT_TYPE_INT, { .i64 = 256 }, 0, UINT_MAX/1000/1000, D }, + { "respect_retry_after", "respect the Retry-After header when retrying connections", OFFSET(respect_retry_after), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, D }, ++ { "reconnect_first_delay", "first reconnect delay in seconds", OFFSET(reconnect_first_delay), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, UINT_MAX/1000/1000, D }, + { "listen", "listen on HTTP", OFFSET(listen), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 2, D | E }, + { "resource", "The resource requested by a client", OFFSET(resource), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, E }, + { "reply_code", "The http status code to return to a client", OFFSET(reply_code), AV_OPT_TYPE_INT, { .i64 = 200}, INT_MIN, 599, E}, +@@ -419,7 +421,7 @@ static int http_open_cnx(URLContext *h, AVDictionary **options) + HTTPAuthType cur_auth_type, cur_proxy_auth_type; + HTTPContext *s = h->priv_data; + int ret, conn_attempts = 1, auth_attempts = 0, redirects = 0; +- int reconnect_delay = 0; ++ int reconnect_delay = s->reconnect_first_delay; + int reconnect_delay_total = 0; + uint64_t off; + char *cached; +-- +2.50.1 (Apple Git-155) + diff --git a/patches/ffmpeg-n8.1.1/0019-fix-http-open-and-http_seek-redirect-authentication-.patch b/patches/ffmpeg-n8.1.1/0019-fix-http-open-and-http_seek-redirect-authentication-.patch new file mode 100644 index 000000000..c296957a2 --- /dev/null +++ b/patches/ffmpeg-n8.1.1/0019-fix-http-open-and-http_seek-redirect-authentication-.patch @@ -0,0 +1,102 @@ +From 637bd6415e37d86600aecb161d5a067cebc7cb69 Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Fri, 8 May 2026 17:47:08 +0800 +Subject: fix http open and http_seek (redirect) authentication + bug + +--- + libavformat/http.c | 32 +++++++++++++++++++++++++++----- + 1 file changed, 27 insertions(+), 5 deletions(-) + +diff --git a/libavformat/http.c b/libavformat/http.c +index cd39796ab3..b648596d77 100644 +--- a/libavformat/http.c ++++ b/libavformat/http.c +@@ -83,6 +83,7 @@ typedef struct HTTPContext { + char *uri; + char *location; + HTTPAuthState auth_state; ++ int auth_type2; + HTTPAuthState proxy_auth_state; + char *http_proxy; + char *headers; +@@ -190,6 +191,7 @@ static const AVOption options[] = { + { "icy_metadata_packet", "return current ICY metadata packet", OFFSET(icy_metadata_packet), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, AV_OPT_FLAG_EXPORT }, + { "metadata", "metadata read from the bitstream", OFFSET(metadata), AV_OPT_TYPE_DICT, {0}, 0, 0, AV_OPT_FLAG_EXPORT }, + { "auth_type", "HTTP authentication type", OFFSET(auth_state.auth_type), AV_OPT_TYPE_INT, { .i64 = HTTP_AUTH_NONE }, HTTP_AUTH_NONE, HTTP_AUTH_BASIC, D | E, .unit = "auth_type"}, ++ { "auth_type2", "backup HTTP authentication type for seek request", OFFSET(auth_type2), AV_OPT_TYPE_INT, { .i64 = HTTP_AUTH_NONE }, HTTP_AUTH_NONE, HTTP_AUTH_BASIC, D | E, "auth_type"}, + { "none", "No auth method set, autodetect", 0, AV_OPT_TYPE_CONST, { .i64 = HTTP_AUTH_NONE }, 0, 0, D | E, .unit = "auth_type"}, + { "basic", "HTTP basic authentication", 0, AV_OPT_TYPE_CONST, { .i64 = HTTP_AUTH_BASIC }, 0, 0, D | E, .unit = "auth_type"}, + { "send_expect_100", "Force sending an Expect: 100-continue header for POST", OFFSET(send_expect_100), AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, E }, +@@ -789,6 +791,11 @@ static int http_open(URLContext *h, const char *uri, int flags, + int ret; + s->app_ctx = (AVApplicationContext *)av_dict_strtoptr(s->app_ctx_intptr); + ++ if (s->auth_type2 == HTTP_AUTH_NONE) { ++ //backup the init auth_type, when not assign. ++ s->auth_type2 = s->auth_state.auth_type; ++ } ++ + if( s->seekable == 1 ) + h->is_streamed = 0; + else +@@ -1550,6 +1557,7 @@ static int http_connect(URLContext *h, const char *path, const char *local_path, + uint64_t off = s->off; + const char *method; + int send_expect_100 = 0; ++ int cur_auth_type = s->auth_state.auth_type; + + av_bprint_init_for_buffer(&request, s->buffer, sizeof(s->buffer)); + +@@ -1708,15 +1716,24 @@ static int http_connect(URLContext *h, const char *path, const char *local_path, + s->off = off; + + if (off != s->off) { +- av_log(h, AV_LOG_ERROR, +- "Unexpected offset: expected %"PRIu64", got %"PRIu64"\n", +- off, s->off); +- err = AVERROR(EIO); +- goto done; ++ if (cur_auth_type != s->auth_state.auth_type && s->http_code == 401) { ++ s->off = off; ++ av_log(h, AV_LOG_ERROR, ++ "HTTP 401 needs authentication: %s, offset=%"PRIu64"\n", ++ s->buffer, s->off); ++ } else { ++ av_log(h, AV_LOG_ERROR, ++ "Unexpected offset: expected %"PRIu64", got %"PRIu64"\n", ++ off, s->off); ++ err = AVERROR(EIO); ++ goto done; ++ } + } + + err = 0; + done: ++ if (err < 0) ++ av_log(h, AV_LOG_ERROR, "HTTP error %d: %s\n", s->http_code, s->buffer); + av_freep(&authstr); + av_freep(&proxyauthstr); + return err; +@@ -2148,6 +2165,8 @@ static int64_t http_seek_internal(URLContext *h, int64_t off, int whence, int fo + return s->off; + } + ++ // http_seek use lasest redirect location, because after redirect, reset the auth_state: `memset(&s->auth_state, 0, sizeof(s->auth_state));` ++ + /* if the location changed (redirect), revert to the original uri */ + if (strcmp(s->uri, s->location)) { + char *new_uri; +@@ -2156,6 +2175,9 @@ static int64_t http_seek_internal(URLContext *h, int64_t off, int whence, int fo + return AVERROR(ENOMEM); + av_free(s->location); + s->location = new_uri; ++ if (s->auth_type2 != HTTP_AUTH_NONE) { ++ s->auth_state.auth_type = s->auth_type2; ++ } + } + + /* we save the old context in case the seek fails */ +-- +2.50.1 (Apple Git-155) + diff --git a/patches/ffmpeg-n8.1.1/0020-add-built-in-smb2-protocol-via-libsmb2.patch b/patches/ffmpeg-n8.1.1/0020-add-built-in-smb2-protocol-via-libsmb2.patch new file mode 100644 index 000000000..3b3134af1 --- /dev/null +++ b/patches/ffmpeg-n8.1.1/0020-add-built-in-smb2-protocol-via-libsmb2.patch @@ -0,0 +1,495 @@ +From 08d684edc3dd2fe28dbda3beaff216e2a235369e Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Fri, 8 May 2026 17:58:33 +0800 +Subject: add built-in smb2 protocol via libsmb2 + +--- + configure | 5 + + libavformat/Makefile | 1 + + libavformat/libsmb2.c | 412 ++++++++++++++++++++++++++++++++++++++++ + libavformat/protocols.c | 1 + + 4 files changed, 419 insertions(+) + create mode 100644 libavformat/libsmb2.c + +diff --git a/configure b/configure +index 1759694274..10c688ca4e 100755 +--- a/configure ++++ b/configure +@@ -276,6 +276,7 @@ External library support: + --enable-libshaderc enable runtime GLSL->SPIRV compilation via libshaderc [no] + --enable-libshine enable fixed-point MP3 encoding via libshine [no] + --enable-libsmbclient enable Samba protocol via libsmbclient [no] ++ --enable-libsmb2 enable Samba protocol via libsmb2 [no] + --enable-libsnappy enable Snappy compression, needed for hap encoding [no] + --enable-libsoxr enable Include libsoxr resampling [no] + --enable-libspeex enable Speex de/encoding via libspeex [no] +@@ -2083,6 +2084,7 @@ EXTERNAL_LIBRARY_LIST=" + libshaderc + libshine + libsmbclient ++ libsmb2 + libsnappy + libsoxr + libspeex +@@ -4073,6 +4075,7 @@ librtmps_protocol_deps="librtmp" + librtmpt_protocol_deps="librtmp" + librtmpte_protocol_deps="librtmp" + libsmbclient_protocol_deps="libsmbclient gplv3" ++libsmb2_protocol_deps="libsmb2" + libsrt_protocol_deps="libsrt" + libsrt_protocol_select="network" + libssh_protocol_deps="libssh" +@@ -7369,6 +7372,8 @@ enabled libshaderc && require_pkg_config spirv_library "shaderc >= 2019.1 + enabled libshine && require_pkg_config libshine shine shine/layer3.h shine_encode_buffer + enabled libsmbclient && { check_pkg_config libsmbclient smbclient libsmbclient.h smbc_init || + require libsmbclient libsmbclient.h smbc_init -lsmbclient; } ++enabled libsmb2 && { check_pkg_config libsmb2 libsmb2 smb2/smb2-errors.h SMB2_STATUS_SUCCESS || ++ require libsmb2 smb2/smb2-errors.h SMB2_STATUS_SUCCESS -lsmb2; } + enabled libsnappy && require libsnappy snappy-c.h snappy_compress -lsnappy -lstdc++ + enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr + enabled libssh && require_pkg_config libssh "libssh >= 0.6.0" libssh/sftp.h sftp_init +diff --git a/libavformat/Makefile b/libavformat/Makefile +index 158a11d10f..6100e33b30 100644 +--- a/libavformat/Makefile ++++ b/libavformat/Makefile +@@ -751,6 +751,7 @@ OBJS-$(CONFIG_LIBRTMPS_PROTOCOL) += librtmp.o + OBJS-$(CONFIG_LIBRTMPT_PROTOCOL) += librtmp.o + OBJS-$(CONFIG_LIBRTMPTE_PROTOCOL) += librtmp.o + OBJS-$(CONFIG_LIBSMBCLIENT_PROTOCOL) += libsmbclient.o ++OBJS-$(CONFIG_LIBSMB2_PROTOCOL) += libsmb2.o + OBJS-$(CONFIG_LIBSRT_PROTOCOL) += libsrt.o + OBJS-$(CONFIG_LIBSSH_PROTOCOL) += libssh.o + OBJS-$(CONFIG_LIBZMQ_PROTOCOL) += libzmq.o +diff --git a/libavformat/libsmb2.c b/libavformat/libsmb2.c +new file mode 100644 +index 0000000000..408f9e1609 +--- /dev/null ++++ b/libavformat/libsmb2.c +@@ -0,0 +1,412 @@ ++/* ++ * Copyright (c) 2014 Lukasz Marek ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++ ++#include ++#include ++#include "libavutil/avstring.h" ++#include "libavutil/opt.h" ++#include "libavutil/mem.h" ++#include "application.h" ++#include "url.h" ++#include "urldecode.h" ++//smb2.h:37:9: error: unknown type name 'time_t'; ++#include ++#include ++#include ++#include ++ ++typedef struct ++{ ++ const AVClass *class; ++ ++ struct smb2_context *ctx; ++ struct smb2_url *url; ++ struct smb2fh *fh; ++ struct smb2dir *dir; ++ ++ uint64_t filesize; ++ char *app_ctx_intptr; ++ AVApplicationContext *app_ctx; ++ int smb2_seal; ++} LIBSMB2Context; ++ ++static void destroy_smb2(LIBSMB2Context *libsmb2) ++{ ++ if (libsmb2->fh && libsmb2->ctx) { ++ smb2_close(libsmb2->ctx, libsmb2->fh); ++ } ++ ++ if (libsmb2->ctx) { ++ smb2_disconnect_share(libsmb2->ctx); ++ smb2_destroy_context(libsmb2->ctx); ++ } ++ ++ if (libsmb2->url) { ++ smb2_destroy_url(libsmb2->url); ++ } ++ libsmb2->fh = NULL; ++ libsmb2->ctx = NULL; ++ libsmb2->url = NULL; ++} ++ ++static av_cold int libsmb2_close(URLContext *h) ++{ ++ LIBSMB2Context *libsmb2 = h->priv_data; ++ destroy_smb2(libsmb2); ++ return 0; ++} ++ ++static av_cold int libsmb2_open(URLContext *h, const char *uri, int flags) ++{ ++ int ret = 0; ++ LIBSMB2Context *libsmb2 = h->priv_data; ++ libsmb2->filesize = -1; ++ libsmb2->ctx = smb2_init_context(); ++ libsmb2->app_ctx = (AVApplicationContext *)av_dict_strtoptr(libsmb2->app_ctx_intptr); ++ ++ av_application_will_http_open(libsmb2->app_ctx, (void *)h, uri); ++ ++ if (!libsmb2->ctx) { ++ av_log(h, AV_LOG_ERROR, "smb2 create context failed: %s.\n", smb2_get_error(libsmb2->ctx)); ++ ret = AVERROR(ENOMEM); ++ goto failed; ++ } ++ ++ const char *smb_url = av_strireplace(uri, "smb2", "smb"); ++ struct smb2_url *url = smb2_parse_url(libsmb2->ctx, smb_url); ++ ++ if (url == NULL) { ++ av_log(h, AV_LOG_ERROR, "smb2 parse url failed: %s\n", smb2_get_error(libsmb2->ctx)); ++ ret = AVERROR(ENOMEM); ++ goto failed; ++ } else { ++ if (url->user) { ++ char *user = strchr(url->user, ':'); ++ if (user) { ++ *user = '\0'; ++ char *password = user + 1; ++ if (strlen(password) > 0) { ++ password = ff_urldecode(password, 0); ++ smb2_set_password(libsmb2->ctx, password); ++ } ++ } ++ } ++ ++ if (url->domain) { ++ smb2_set_domain(libsmb2->ctx, url->domain); ++ } ++ ++ if (url->share) { ++ char *share = ff_urldecode(url->share, 0); ++ memset(url->share, 0, strlen(url->share)); ++ memcpy(url->share, share, strlen(share)); ++ } ++ ++ if (url->path) { ++ char *path = ff_urldecode(url->path, 0); ++ memset(url->path, 0, strlen(url->path)); ++ memcpy(url->path, path, strlen(path)); ++ } ++ ++ libsmb2->url = url; ++ } ++ ++ //https://github.com/sahlberg/libsmb2/issues/271 ++ //fix Very slow performance w/MacOS SMB server ++ //smb2_set_security_mode(libsmb2->ctx, SMB2_NEGOTIATE_SIGNING_ENABLED); ++ smb2_set_seal(libsmb2->ctx, libsmb2->smb2_seal); ++ smb2_set_authentication(libsmb2->ctx, 1);//SMB2_SEC_NTLMSSP ++ smb2_set_timeout(libsmb2->ctx, 60); ++ ++ if (smb2_connect_share(libsmb2->ctx, url->server, url->share, url->user) != 0) { ++ av_log(h, AV_LOG_ERROR, "smb2 connect share failed: %s\n", smb2_get_error(libsmb2->ctx)); ++ ret = AVERROR(ECONNREFUSED); ++ goto failed; ++ } ++ ++ int access; ++ if ((flags & AVIO_FLAG_WRITE) && (flags & AVIO_FLAG_READ)) { ++ access = O_CREAT | O_RDWR; ++ } else if (flags & AVIO_FLAG_WRITE) { ++ access = O_CREAT | O_WRONLY; ++ } else { ++ access = O_RDONLY; ++ } ++ ++ if (flags & AVIO_FLAG_DIRECT) { ++ if ((libsmb2->dir = smb2_opendir(libsmb2->ctx, url->path)) == NULL) { ++ av_log(h, AV_LOG_ERROR, "smb2 open dir failed: %s, error: %s\n", url->path, smb2_get_error(libsmb2->ctx)); ++ ret = AVERROR(ENOTDIR); ++ goto failed; ++ } ++ } else { ++ if ((libsmb2->fh = smb2_open(libsmb2->ctx, url->path, access)) == NULL) { ++ av_log(h, AV_LOG_ERROR, "smb2 open file failed: %s, error: %s\n", url->path, smb2_get_error(libsmb2->ctx)); ++ ret = AVERROR(ENOENT); ++ goto failed; ++ } ++ } ++ ++ struct smb2_stat_64 st = {0}; ++ ++ if (smb2_stat(libsmb2->ctx, url->path, &st) < 0) ++ av_log(h, AV_LOG_WARNING, "Cannot stat file: %s\n", smb2_get_error(libsmb2->ctx)); ++ else ++ libsmb2->filesize = st.smb2_size; ++ av_application_did_http_open(libsmb2->app_ctx, (void *)h, uri, 0, 200, libsmb2->filesize); ++ return 0; ++failed: ++ av_application_did_http_open(libsmb2->app_ctx, (void *)h, uri, ret, 500, 0); ++ if (libsmb2->fh && libsmb2->ctx) { ++ smb2_close(libsmb2->ctx, libsmb2->fh); ++ } ++ if (libsmb2->ctx) { ++ smb2_disconnect_share(libsmb2->ctx); ++ smb2_destroy_context(libsmb2->ctx); ++ } ++ if (libsmb2->url) { ++ smb2_destroy_url(libsmb2->url); ++ } ++ libsmb2->fh = NULL; ++ libsmb2->ctx = NULL; ++ libsmb2->url = NULL; ++ return -1; ++} ++ ++static int64_t libsmb2_seek(URLContext *h, int64_t pos, int whence) ++{ ++ LIBSMB2Context *libsmb2 = h->priv_data; ++ int64_t newpos; ++ ++ if (whence == AVSEEK_SIZE) { ++ if (libsmb2->filesize == -1) { ++ av_log(h, AV_LOG_ERROR, "smb2 seek failed,filesize is unknown.\n"); ++ return AVERROR(EIO); ++ } else { ++ return libsmb2->filesize; ++ } ++ } ++ ++ av_application_will_http_seek(libsmb2->app_ctx, (void *)h, h->filename, pos); ++ ++ if ((newpos = smb2_lseek(libsmb2->ctx, libsmb2->fh, pos, whence, NULL)) < 0) { ++ av_log(h, AV_LOG_ERROR, "smb2 seek failed: %s\n", smb2_get_error(libsmb2->ctx)); ++ av_application_did_http_seek(libsmb2->app_ctx, (void *)h, h->filename, pos, AVERROR(errno), 500); ++ return AVERROR(errno); ++ } ++ av_application_did_http_seek(libsmb2->app_ctx, (void *)h, h->filename, pos, 0, 200); ++ return newpos; ++} ++ ++static int libsmb2_read(URLContext *h, unsigned char *buf, int size) ++{ ++ LIBSMB2Context *libsmb2 = h->priv_data; ++ ++ uint8_t *buf1 = buf; ++ int buf_size1 = size; ++ int has_error = 0; ++ ++ while (buf_size1 > 0) { ++ int read = smb2_read(libsmb2->ctx, libsmb2->fh, buf1, buf_size1); ++ if (read < 0) { ++ av_log(h, AV_LOG_ERROR, "smb2 read file failed: %s\n", ++ smb2_get_error(libsmb2->ctx)); ++ has_error = 1; ++ break; ++ } ++ if (read == 0) { ++ // eof ++ break; ++ } ++ buf1 += read; ++ buf_size1 -= read; ++ } ++ ++ int bytes_read = size - buf_size1; ++ if (bytes_read > 0) ++ av_application_did_io_tcp_read(libsmb2->app_ctx, (void*)h, bytes_read); ++ ++ return bytes_read ? bytes_read : (has_error ? AVERROR(ENOTCONN) : AVERROR_EOF); ++} ++ ++static int libsmb2_write(URLContext *h, const unsigned char *buf, int size) ++{ ++ LIBSMB2Context *libsmb2 = h->priv_data; ++ int bytes_written; ++ ++ if ((bytes_written = smb2_write(libsmb2->ctx, libsmb2->fh, buf, size)) < 0) { ++ int ret = AVERROR(errno); ++ av_log(h, AV_LOG_ERROR, "smb2 write failed: %s\n", strerror(errno)); ++ return ret; ++ } ++ ++ return bytes_written; ++} ++ ++static int libsmb2_delete(URLContext *h) ++{ ++ LIBSMB2Context *libsmb2 = h->priv_data; ++ ++ struct smb2_url *url = smb2_parse_url(libsmb2->ctx, h->filename); ++ if (url == NULL) { ++ av_log(h, AV_LOG_ERROR, "smb2 parse url failed: %s\n", ++ smb2_get_error(libsmb2->ctx)); ++ return -1; ++ } else { ++ char *path = ff_urldecode(url->path, 0); ++ return smb2_unlink(libsmb2->ctx, path); ++ } ++} ++ ++static int libsmb2_move(URLContext *h_src, URLContext *h_dst) ++{ ++ LIBSMB2Context *libsmb2 = h_src->priv_data; ++ if (!libsmb2) ++ { ++ return -1; ++ } ++ ++ struct smb2_url *src_url = smb2_parse_url(libsmb2->ctx, h_src->filename); ++ struct smb2_url *dst_url = smb2_parse_url(libsmb2->ctx, h_dst->filename); ++ ++ if (src_url == NULL || dst_url == NULL) { ++ av_log(h_src, AV_LOG_ERROR, "smb2 parse url failed: %s\n", smb2_get_error(libsmb2->ctx)); ++ return -2; ++ } else { ++ char *src_path = ff_urldecode(src_url->path, 0); ++ char *dst_path = ff_urldecode(dst_url->path, 0); ++ return smb2_rename(libsmb2->ctx, src_path, dst_path); ++ } ++} ++ ++static int libsmb2_open_dir(URLContext *h) ++{ ++ LIBSMB2Context *libsmb2 = h->priv_data; ++ struct smb2_url *url = smb2_parse_url(libsmb2->ctx, h->filename); ++ if (url == NULL) { ++ av_log(h, AV_LOG_ERROR, "smb2 parse url failed: %s\n", smb2_get_error(libsmb2->ctx)); ++ return -1; ++ } else { ++ char *path = ff_urldecode(url->path, 0); ++ libsmb2->dir = smb2_opendir(libsmb2->ctx, path); ++ if (!libsmb2->dir){ ++ av_log(h, AV_LOG_ERROR, "smb2 open dir failed: %s\n", smb2_get_error(libsmb2->ctx)); ++ return 0; ++ } ++ return AVERROR(ENOTDIR); ++ } ++} ++ ++static int libsmb2_read_dir(URLContext *h, AVIODirEntry **next) ++{ ++ LIBSMB2Context *libsmb2 = h->priv_data; ++ AVIODirEntry *entry; ++ struct smb2dirent *dirent = NULL; ++ int skip_entry; ++ ++ *next = entry = ff_alloc_dir_entry(); ++ if (!entry) ++ return AVERROR(ENOMEM); ++ do { ++ skip_entry = 0; ++ dirent = smb2_readdir(libsmb2->ctx, libsmb2->dir); ++ if (!dirent) { ++ av_freep(next); ++ return 0; ++ } ++ } while (skip_entry || !strcmp(dirent->name, ".") || ++ !strcmp(dirent->name, "..")); ++ ++ entry->name = av_strdup(dirent->name); ++ if (!entry->name) { ++ av_freep(next); ++ return AVERROR(ENOMEM); ++ } ++ ++ struct smb2_stat_64 st = dirent->st; ++ switch (st.smb2_type) { ++ case SMB2_TYPE_DIRECTORY: ++ entry->type = AVIO_ENTRY_DIRECTORY; ++ break; ++ case SMB2_TYPE_FILE: ++ entry->type = AVIO_ENTRY_FILE; ++ break; ++ case SMB2_TYPE_LINK: ++ entry->type = AVIO_ENTRY_SYMBOLIC_LINK; ++ break; ++ default: ++ entry->type = AVIO_ENTRY_UNKNOWN; ++ break; ++ } ++ ++ entry->group_id = -1; ++ entry->user_id = -1; ++ entry->filemode = -1; ++ entry->size = st.smb2_size; ++ entry->modification_timestamp = INT64_C(1000000) * st.smb2_mtime; ++ entry->access_timestamp = INT64_C(1000000) * st.smb2_atime; ++ entry->status_change_timestamp = INT64_C(1000000) * st.smb2_ctime; ++ ++ return 0; ++} ++ ++static int libsmb2_close_dir(URLContext *h) ++{ ++ LIBSMB2Context *libsmb2 = h->priv_data; ++ if (libsmb2->dir) { ++ smb2_closedir(libsmb2->ctx, libsmb2->dir); ++ libsmb2->dir = NULL; ++ } ++ return 0; ++} ++ ++#define OFFSET(x) offsetof(LIBSMB2Context, x) ++#define D AV_OPT_FLAG_DECODING_PARAM ++#define E AV_OPT_FLAG_ENCODING_PARAM ++static const AVOption options[] = { ++ { "ijkapplication", "AVApplicationContext", OFFSET(app_ctx_intptr), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, .flags = D }, ++ { "smb2_seal", "enable smb3 encrypted connection", OFFSET(smb2_seal), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, .flags = D }, ++ {NULL} ++}; ++ ++static const AVClass libsmb2lient_context_class = { ++ .class_name = "libsmb2", ++ .item_name = av_default_item_name, ++ .option = options, ++ .version = LIBAVUTIL_VERSION_INT, ++}; ++ ++const URLProtocol ff_libsmb2_protocol = { ++ .name = "smb2", ++ .flags = URL_PROTOCOL_FLAG_NETWORK, ++ .priv_data_size = sizeof(LIBSMB2Context), ++ .priv_data_class = &libsmb2lient_context_class, ++ .url_open = libsmb2_open, ++ .url_read = libsmb2_read, ++ .url_write = libsmb2_write, ++ .url_seek = libsmb2_seek, ++ .url_close = libsmb2_close, ++ .url_delete = libsmb2_delete, ++ .url_move = libsmb2_move, ++ .url_open_dir = libsmb2_open_dir, ++ .url_read_dir = libsmb2_read_dir, ++ .url_close_dir = libsmb2_close_dir, ++}; +diff --git a/libavformat/protocols.c b/libavformat/protocols.c +index d1c1095364..fb712a5128 100644 +--- a/libavformat/protocols.c ++++ b/libavformat/protocols.c +@@ -75,6 +75,7 @@ extern const URLProtocol ff_librtmpte_protocol; + extern const URLProtocol ff_libsrt_protocol; + extern const URLProtocol ff_libssh_protocol; + extern const URLProtocol ff_libsmbclient_protocol; ++extern const URLProtocol ff_libsmb2_protocol; + extern const URLProtocol ff_libzmq_protocol; + extern const URLProtocol ff_ipfs_gateway_protocol; + extern const URLProtocol ff_ipns_gateway_protocol; +-- +2.50.1 (Apple Git-155) + diff --git a/patches/ffmpeg-n8.1.1/0021-URLProtocol-add-url_parse_priv-function-pointer.patch b/patches/ffmpeg-n8.1.1/0021-URLProtocol-add-url_parse_priv-function-pointer.patch new file mode 100644 index 000000000..493479d08 --- /dev/null +++ b/patches/ffmpeg-n8.1.1/0021-URLProtocol-add-url_parse_priv-function-pointer.patch @@ -0,0 +1,55 @@ +From 6f63a6880358a91c79119e58cac80179a1d37a73 Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Thu, 29 May 2025 11:14:13 +0800 +Subject: URLProtocol add url_parse_priv function pointer + +--- + libavformat/demux.c | 11 +++++++++++ + libavformat/url.h | 2 ++ + 2 files changed, 13 insertions(+) + +diff --git a/libavformat/demux.c b/libavformat/demux.c +index 494e15f3c1..524018f1aa 100644 +--- a/libavformat/demux.c ++++ b/libavformat/demux.c +@@ -355,6 +355,17 @@ int avformat_open_input(AVFormatContext **ps, const char *filename, + ff_id3v2_free_extra_meta(&id3v2_extra_meta); + } + ++ //fill stream info ++ if (s->pb) { ++ URLContext *url_context = ffio_geturlcontext(s->pb); ++ if (url_context && url_context->prot) { ++ URLProtocol *prot = url_context->prot; ++ if (prot->url_parse_priv) { ++ prot->url_parse_priv(s, url_context); ++ } ++ } ++ } ++ + if ((ret = avformat_queue_attached_pictures(s)) < 0) + goto close; + +diff --git a/libavformat/url.h b/libavformat/url.h +index 53c6f13d23..f7e5bb2a95 100644 +--- a/libavformat/url.h ++++ b/libavformat/url.h +@@ -48,6 +48,7 @@ typedef struct URLContext { + int min_packet_size; /**< if non zero, the stream is packetized with this min packet size */ + } URLContext; + ++typedef struct AVFormatContext AVFormatContext; + typedef struct URLProtocol { + const char *name; + int (*url_open)( URLContext *h, const char *url, int flags); +@@ -93,6 +94,7 @@ typedef struct URLProtocol { + int (*url_close_dir)(URLContext *h); + int (*url_delete)(URLContext *h); + int (*url_move)(URLContext *h_src, URLContext *h_dst); ++ int (*url_parse_priv)(AVFormatContext *ic, URLContext *h); + const char *default_whitelist; + } URLProtocol; + +-- +2.50.1 (Apple Git-155) + diff --git a/patches/ffmpeg-n8.1.1/0022-bluray-protocol-add-dvd-fallback.patch b/patches/ffmpeg-n8.1.1/0022-bluray-protocol-add-dvd-fallback.patch new file mode 100644 index 000000000..d212a63ac --- /dev/null +++ b/patches/ffmpeg-n8.1.1/0022-bluray-protocol-add-dvd-fallback.patch @@ -0,0 +1,54 @@ +From a58c1231a04f47af13819d9091acd33ac5a8c991 Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Thu, 29 May 2025 11:15:16 +0800 +Subject: bluray protocol add dvd fallback + +--- + libavformat/demux.c | 23 +++++++++++++++++++---- + 1 file changed, 19 insertions(+), 4 deletions(-) + +diff --git a/libavformat/demux.c b/libavformat/demux.c +index 524018f1aa..531992f9d9 100644 +--- a/libavformat/demux.c ++++ b/libavformat/demux.c +@@ -161,7 +161,8 @@ static int init_input(AVFormatContext *s, const char *filename, + int ret; + AVProbeData pd = { filename, NULL, 0 }; + int score = AVPROBE_SCORE_RETRY; +- ++ AVDictionary *tmp_opts = NULL; ++ + if (s->pb) { + s->flags |= AVFMT_FLAG_CUSTOM_IO; + if (!s->iformat) +@@ -176,10 +177,24 @@ static int init_input(AVFormatContext *s, const char *filename, + if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) || + (!s->iformat && (s->iformat = av_probe_input_format2(&pd, 0, &score)))) + return score; ++ ++ if (options && av_stristart(filename, "bluray://", NULL)) { ++ av_dict_copy(&tmp_opts, *options, 0); ++ } + +- if ((ret = s->io_open(s, &s->pb, filename, AVIO_FLAG_READ | s->avio_flags, options)) < 0) +- return ret; +- ++ if ((ret = s->io_open(s, &s->pb, filename, AVIO_FLAG_READ | s->avio_flags, ++ options)) < 0) { ++ if (av_stristart(filename, "bluray://", NULL)) { ++ const char *a_name = av_strireplace(filename, "bluray://", ""); ++ ret = init_input(s, a_name, &tmp_opts); ++ av_dict_free(&tmp_opts); ++ return ret; ++ } else { ++ av_dict_free(&tmp_opts); ++ return ret; ++ } ++ } ++ av_dict_free(&tmp_opts); + if (s->iformat) + return 0; + return av_probe_input_buffer2(s->pb, &s->iformat, filename, +-- +2.50.1 (Apple Git-155) + diff --git a/patches/ffmpeg-n8.1.1/0023-custom-bluray-fs-for-network-Blu-ray-Disc-and-BDMV.patch b/patches/ffmpeg-n8.1.1/0023-custom-bluray-fs-for-network-Blu-ray-Disc-and-BDMV.patch new file mode 100644 index 000000000..939d045dd --- /dev/null +++ b/patches/ffmpeg-n8.1.1/0023-custom-bluray-fs-for-network-Blu-ray-Disc-and-BDMV.patch @@ -0,0 +1,673 @@ +From 3f5023db5a58a8be25a8c31c26b8107875f21e80 Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Fri, 8 May 2026 18:04:37 +0800 +Subject: custom bluray fs for network Blu-ray Disc and BDMV + +--- + libavformat/Makefile | 2 +- + libavformat/bluray.c | 118 +++++++++- + libavformat/bluray_custom_fs.c | 413 +++++++++++++++++++++++++++++++++ + libavformat/bluray_custom_fs.h | 29 +++ + 4 files changed, 553 insertions(+), 9 deletions(-) + create mode 100644 libavformat/bluray_custom_fs.c + create mode 100644 libavformat/bluray_custom_fs.h + +diff --git a/libavformat/Makefile b/libavformat/Makefile +index 6100e33b30..54e88cfdfd 100644 +--- a/libavformat/Makefile ++++ b/libavformat/Makefile +@@ -694,7 +694,7 @@ OBJS-$(CONFIG_VAPOURSYNTH_DEMUXER) += vapoursynth.o + # protocols I/O + OBJS-$(CONFIG_ANDROID_CONTENT_PROTOCOL) += file.o + OBJS-$(CONFIG_ASYNC_PROTOCOL) += async.o +-OBJS-$(CONFIG_BLURAY_PROTOCOL) += bluray.o ++OBJS-$(CONFIG_BLURAY_PROTOCOL) += bluray.o bluray_custom_fs.o + OBJS-$(CONFIG_CACHE_PROTOCOL) += cache.o + OBJS-$(CONFIG_CONCAT_PROTOCOL) += concat.o + OBJS-$(CONFIG_CONCATF_PROTOCOL) += concat.o +diff --git a/libavformat/bluray.c b/libavformat/bluray.c +index 1845551c34..cd50523ac6 100644 +--- a/libavformat/bluray.c ++++ b/libavformat/bluray.c +@@ -21,23 +21,27 @@ + */ + + #include +- ++#include "libavformat/urldecode.h" + #include "libavutil/avstring.h" + #include "libavformat/url.h" + #include "libavutil/opt.h" ++#include "bluray_custom_fs.h" ++#include "libavutil/dict.h" ++#include "libavformat/avformat.h" + +-#define BLURAY_PROTO_PREFIX "bluray:" ++#define BLURAY_PROTO_PREFIX "bluray://" + #define MIN_PLAYLIST_LENGTH 180 /* 3 min */ + + typedef struct { + const AVClass *class; + + BLURAY *bd; +- ++ fs_access *access; + int playlist; + int angle; + int chapter; + /*int region;*/ ++ int title_idx; + } BlurayContext; + + #define OFFSET(x) offsetof(BlurayContext, x) +@@ -106,23 +110,58 @@ static int bluray_close(URLContext *h) + if (bd->bd) { + bd_close(bd->bd); + } +- ++ destroy_bluray_custom_access(&bd->access); + return 0; + } + +-static int bluray_open(URLContext *h, const char *path, int flags) ++#ifdef DEBUG_BLURAY ++#include ++#define BLURAY_DEBUG_MASK 0xFFFFF //(0xFFFFF & ~DBG_STREAM) ++ ++static void bluray_DebugHandler(const char *psz) + { ++ size_t len = strlen(psz); ++ if(len < 1) return; ++ av_log(NULL, AV_LOG_INFO, "[bluray] %s\n",psz); ++} ++#endif ++ ++ ++static int bluray_open(URLContext *h, const char *path, int flags, AVDictionary **options) ++{ ++#ifdef DEBUG_BLURAY ++ bd_set_debug_mask(BLURAY_DEBUG_MASK); ++ bd_set_debug_handler(bluray_DebugHandler); ++#endif ++ + BlurayContext *bd = h->priv_data; + int num_title_idx; + const char *diskname = path; + + av_strstart(path, BLURAY_PROTO_PREFIX, &diskname); + +- bd->bd = bd_open(diskname, NULL); ++ fs_access *access = NULL; ++ ++ diskname = ff_urldecode(diskname, 0); ++ ++ if (av_strstart(diskname, "file://", NULL) || av_strstart(diskname, "/", NULL)) { ++ access = NULL; ++ } else { ++ //set read packet buffer size is important! the default packet size is 32768, when use smb2 protocol, download speed is limited to 2MB; but when set the size to 1048576, download speed is 16MB; ++ h->max_packet_size = 1048576; ++ access = create_bluray_custom_access(diskname, options); ++ } ++ ++ bd->bd = bd_open_fs(diskname, NULL, access); ++ + if (!bd->bd) { + av_log(h, AV_LOG_ERROR, "bd_open() failed\n"); ++ if (access) { ++ destroy_bluray_custom_access(&access); ++ } + return AVERROR(EIO); + } ++ bd->access = access; + + /* check if disc can be played */ + if (check_disc_info(h) < 0) { +@@ -159,12 +198,13 @@ static int bluray_open(URLContext *h, const char *path, int flags) + + if (info->duration > duration) { + bd->playlist = info->playlist; ++ bd->title_idx = i; + duration = info->duration; + } + + bd_free_title_info(info); + } +- av_log(h, AV_LOG_INFO, "selected %05d.mpls\n", bd->playlist); ++ av_log(h, AV_LOG_INFO, "select longest playlist: %05d.mpls\n", bd->playlist); + } + + /* select playlist */ +@@ -222,13 +262,75 @@ static int64_t bluray_seek(URLContext *h, int64_t pos, int whence) + return AVERROR(EINVAL); + } + ++static int bluray_parse_priv(AVFormatContext *ic, URLContext *h) ++{ ++ BlurayContext *bd = h->priv_data; ++ BLURAY_TITLE_INFO *title_info = NULL; ++ BLURAY_CLIP_INFO clip_info; ++ ++ int v_idx = 0; ++ int a_idx = 0; ++ int s_idx = 0; ++ int ret = 0; ++ ++ if (!bd || !bd->bd) { ++ return AVERROR(EFAULT); ++ } ++ ++ title_info = bd_get_title_info(bd->bd, bd->title_idx, 0); ++ if (!title_info) { ++ return AVERROR(EFAULT); ++ } ++ ++ if (title_info->clip_count <= 0) { ++ ret = EFAULT; ++ goto fail; ++ } ++ clip_info = title_info->clips[0]; ++ ++ for (int i = 0; i < ic->nb_streams; i++) { ++ if (ic->streams[i] && ic->streams[i]->codecpar) { ++ switch (ic->streams[i]->codecpar->codec_type) { ++ case AVMEDIA_TYPE_VIDEO: ++ if (v_idx < clip_info.video_stream_count) { ++ av_log(h, AV_LOG_INFO, "video stream %d lang = %s\n", v_idx, clip_info.video_streams[v_idx].lang); ++ av_dict_set(&ic->streams[i]->metadata, "language", clip_info.video_streams[v_idx].lang, AV_DICT_DONT_OVERWRITE); ++ v_idx++; ++ } ++ break; ++ case AVMEDIA_TYPE_AUDIO: ++ if (a_idx < clip_info.audio_stream_count) { ++ av_log(h, AV_LOG_INFO, "audio stream %d lang = %s\n", a_idx, clip_info.audio_streams[a_idx].lang); ++ av_dict_set(&ic->streams[i]->metadata, "language", clip_info.audio_streams[a_idx].lang, AV_DICT_DONT_OVERWRITE); ++ a_idx++; ++ } ++ break; ++ case AVMEDIA_TYPE_SUBTITLE: ++ if (s_idx < clip_info.pg_stream_count) { ++ av_log(h, AV_LOG_INFO, "subtitle stream %d lang = %s\n", s_idx, clip_info.pg_streams[s_idx].lang); ++ av_dict_set(&ic->streams[i]->metadata, "language", clip_info.pg_streams[s_idx].lang, AV_DICT_DONT_OVERWRITE); ++ s_idx++; ++ } ++ break; ++ default: ++ break; ++ } ++ } ++ } ++ ++fail: ++ bd_free_title_info(title_info); ++ ++ return ret != 0 ? AVERROR(ret) : 0; ++} + + const URLProtocol ff_bluray_protocol = { + .name = "bluray", + .url_close = bluray_close, +- .url_open = bluray_open, ++ .url_open2 = bluray_open, + .url_read = bluray_read, + .url_seek = bluray_seek, ++ .url_parse_priv = bluray_parse_priv, + .priv_data_size = sizeof(BlurayContext), + .priv_data_class = &bluray_context_class, + }; +diff --git a/libavformat/bluray_custom_fs.c b/libavformat/bluray_custom_fs.c +new file mode 100644 +index 0000000000..bdf2451ec0 +--- /dev/null ++++ b/libavformat/bluray_custom_fs.c +@@ -0,0 +1,413 @@ ++// ++// bluray_custom_fs_smb2.c ++// ++// Created by Reach Matt on 2024/9/13. ++// ++// ++// Copyright (C) 2021 Matt Reach// ++// Licensed under the Apache License, Version 2.0 (the "License"); ++// you may not use this file except in compliance with the License. ++// You may obtain a copy of the License at ++// ++// http://www.apache.org/licenses/LICENSE-2.0 ++// ++// Unless required by applicable law or agreed to in writing, software ++// distributed under the License is distributed on an "AS IS" BASIS, ++// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++// See the License for the specific language governing permissions and ++// limitations under the License. ++ ++#include "bluray_custom_fs.h" ++#include "url.h" ++#include "application.h" ++#include "libavutil/mem.h" ++#include "libavutil/error.h" ++#include "libavutil/avstring.h" ++#include ++#include ++ ++#ifndef UDF_BLOCK_SIZE ++# define UDF_BLOCK_SIZE 2048 ++#endif ++ ++typedef struct ff_builtin_io { ++ URLContext *url_context; ++ int64_t offset; ++ AVApplicationContext *app_ctx; ++} ff_builtin_io; ++ ++typedef struct ff_bluray_access { ++ const char *url; ++ AVDictionary *opts; ++ ff_builtin_io *io; ++} ff_bluray_access; ++ ++static int interrupt_cb(void *ctx) ++{ ++ return 0; ++} ++ ++static void close_builtin_io(ff_builtin_io *io) { ++ if (!io) { ++ return; ++ } ++ if (io->url_context) { ++ ffurl_closep(&io->url_context); ++ } ++} ++ ++static int create_builtin_io(ff_builtin_io **io, const char *url, AVDictionary **opts, int is_dir) ++{ ++ if (!io) { ++ return -1; ++ } ++ ++ ff_builtin_io * app = av_mallocz(sizeof(ff_builtin_io)); ++ if (!app) { ++ return -2; ++ } ++ ++ char *protocol_whitelist = NULL; ++ ++ if (opts) { ++ const AVDictionary *dict = *opts; ++ ++ if (!av_strstart(url, "http", NULL) && !av_strstart(url, "smb2", NULL)) { ++ AVDictionaryEntry *app_dict = av_dict_get(dict, "ijkapplication", NULL, 0); ++ if (app_dict) { ++ app->app_ctx = (AVApplicationContext *)av_dict_strtoptr(app_dict->value); ++ av_application_will_http_open(app->app_ctx, NULL, url); ++ } ++ } ++ ++ AVDictionaryEntry *proto_dict = av_dict_get(dict, "protocol_whitelist", NULL, 0); ++ if (proto_dict) { ++ protocol_whitelist = av_strdup(proto_dict->value); ++ } ++ } ++ ++ if (protocol_whitelist == NULL || strlen(protocol_whitelist) == 0) { ++ protocol_whitelist = "ijkio,ijkhttphook,http,tcp,https,tls,file,smb2"; ++ } ++ ++ AVIOInterruptCB cb = {&interrupt_cb, app}; ++ int flags = AVIO_FLAG_READ; ++ if (is_dir) { ++ flags |= AVIO_FLAG_DIRECT; ++ } ++ ++ int ret = ffurl_open_whitelist(&app->url_context, ++ url, ++ flags, ++ &cb, ++ opts, ++ protocol_whitelist, ++ NULL, ++ NULL); ++ ++ av_application_did_http_open(app->app_ctx, (void*)app->url_context, url, ret < 0 ? AVERROR(errno) : 0, ret < 0 ? 500 : 200, 0); ++ ++ if (ret < 0) { ++ close_builtin_io(app); ++ av_freep(&app); ++ } ++ *io = app; ++ return ret; ++} ++ ++static int64_t seek_builtin_io(ff_builtin_io *io, int64_t offset, int origin) ++{ ++ if (!io) { ++ return 0; ++ } ++ ++ if (io->offset == offset && origin == SEEK_SET) { ++ return offset; ++ } ++ ++ av_application_will_http_seek(io->app_ctx, (void*)io->url_context, io->url_context->filename, offset); ++ ++ int64_t pos = io->url_context->prot->url_seek(io->url_context, offset, origin); ++ if (pos < 0) { ++ av_application_did_http_seek(io->app_ctx, (void*)io->url_context, io->url_context->filename, offset, AVERROR(errno), 500); ++ return AVERROR(errno); ++ } ++ io->offset = pos; ++ ++ av_application_did_http_seek(io->app_ctx, (void*)io->url_context, io->url_context->filename, offset, 0, 200); ++ return pos; ++} ++ ++static int read_builtin_io(ff_builtin_io *io, uint8_t *buf, int buf_size) ++{ ++ if (!io) { ++ return 0; ++ } ++ ++ uint8_t *buf1 = buf; ++ int buf_size1 = buf_size; ++ int read = 0; ++ ++ while (buf_size1 > 0) { ++ read = io->url_context->prot->url_read(io->url_context, buf1, buf_size1); ++ if (read <= 0) { ++ //maybe AVERROR_EOF ++ break; ++ } ++ ++ io->offset += read; ++ buf1 += read; ++ buf_size1 -= read; ++ } ++ ++ int bytes = buf_size - buf_size1; ++ if (bytes == 0 && read == AVERROR_EOF) { ++ return AVERROR_EOF; ++ } else { ++ av_application_did_io_tcp_read(io->app_ctx, (void*)io->url_context, bytes); ++ return bytes; ++ } ++} ++ ++static int write_builtin_io(ff_builtin_io *io, uint8_t *buf, int buf_size) ++{ ++ if (!io) { ++ return 0; ++ } ++ ++ return io->url_context->prot->url_write(io->url_context, buf, buf_size); ++} ++ ++static int read_blocks(void * fs_handle, void *buf, int lba, int num_blocks) ++{ ++ ff_bluray_access *access = fs_handle; ++ ff_builtin_io *io = access->io; ++ if (!io) { ++ return -1; ++ } ++ int got = -1; ++ int64_t pos = (int64_t)lba * UDF_BLOCK_SIZE; ++ ++ seek_builtin_io(io, pos, SEEK_SET); ++ int bytes = read_builtin_io(io, (uint8_t*)buf, num_blocks * UDF_BLOCK_SIZE); ++ if (bytes > 0) { ++ got = (int)(bytes / UDF_BLOCK_SIZE); ++ } ++ return got; ++} ++ ++void destroy_bluray_custom_access(fs_access **p) ++{ ++ if (p) { ++ fs_access *access = *p; ++ if (access) { ++ ff_bluray_access* ba = access->fs_handle; ++ ff_builtin_io *io = ba->io; ++ if (io) { ++ close_builtin_io(io); ++ av_freep(&io); ++ } ++ av_free(ba->url); ++ av_dict_free(&ba->opts); ++ } ++ av_freep(p); ++ } ++} ++ ++// ------------------------------------------------------------------------------------------- ++// open_file for bdmv ++ ++static void _file_close(BD_FILE_H *file) ++{ ++ if (file) { ++ ff_builtin_io *io = file->internal; ++ if (io) { ++ close_builtin_io(io); ++ av_free(io); ++ file->internal = NULL; ++ } ++ av_freep(&file); ++ } ++} ++ ++static int64_t _file_read(BD_FILE_H *file, uint8_t *buf, int64_t size) ++{ ++ if (size <= 0) { ++ return 0; ++ } ++ ff_builtin_io *io = file->internal; ++ if (!io) { ++ return -1; ++ } ++ return read_builtin_io(io, buf, size); ++} ++ ++static int64_t _file_write(BD_FILE_H *file, const uint8_t *buf, int64_t size) ++{ ++ if (size <= 0) { ++ return 0; ++ } ++ ff_builtin_io *io = file->internal; ++ if (!io) { ++ return -1; ++ } ++ return write_builtin_io(io, buf, size); ++} ++ ++// origin: SEEK_SET, SEEK_CUR or SEEK_END ++static int64_t _file_seek(BD_FILE_H *file, int64_t offset, int32_t origin) ++{ ++ ff_builtin_io *io = file->internal; ++ if (!io) { ++ return -1; ++ } ++ return seek_builtin_io(io, offset, origin); ++} ++ ++static int64_t _file_tell(BD_FILE_H *file) ++{ ++ ff_builtin_io *io = file->internal; ++ if (!io) { ++ return -1; ++ } ++ return seek_builtin_io(io, 0, SEEK_CUR); ++} ++ ++static struct bd_file_s* open_file(void *fs_handle, const char *rel_path) ++{ ++ ff_bluray_access *access = fs_handle; ++ ++ char *url = NULL; ++ url = av_append_path_component(access->url, rel_path); ++ if (!url) { ++ return NULL; ++ } ++ AVDictionary *opts = NULL; ++ av_dict_copy(&opts, access->opts, 0); ++ ++ ff_builtin_io *io = NULL; ++ int ret = create_builtin_io(&io, url, &opts, 0); ++ av_dict_free(&opts); ++ av_free(url); ++ ++ if (0 != ret) { ++ av_log(NULL, AV_LOG_ERROR, "can't open url %s,error:%s", url, av_err2str(ret)); ++ return NULL; ++ } ++ ++ BD_FILE_H *file = av_malloc(sizeof(BD_FILE_H)); ++ if (!file) { ++ close_builtin_io(io); ++ av_free(io); ++ return NULL; ++ } ++ ++ file->internal = io; ++ file->close = _file_close; ++ file->seek = _file_seek; ++ file->read = _file_read; ++ file->write = _file_write; ++ file->tell = _file_tell; ++ ++ return file; ++} ++ ++// open_dir for bdmv ++static void _dir_close(BD_DIR_H *dir) ++{ ++ if (dir) { ++ ff_builtin_io *io = dir->internal; ++ if (!io) { ++ return; ++ } ++ close_builtin_io(io); ++ av_free(io); ++ dir->internal = NULL; ++ av_freep(&dir); ++ } ++} ++ ++static int _dir_read(BD_DIR_H *dir, BD_DIRENT *entry) ++{ ++ ff_builtin_io *io = dir->internal; ++ if (!io) { ++ return -1; ++ } ++ ++ AVIODirEntry *next = NULL; ++ ++ if (io->url_context->prot->url_read_dir(io->url_context, &next) < 0 || !next) { ++ return -2; ++ } ++ ++ strncpy(entry->d_name, next->name, sizeof(entry->d_name)); ++ entry->d_name[sizeof(entry->d_name) - 1] = 0; ++ ++ return 0; ++} ++ ++static struct bd_dir_s* open_dir (void *fs_handle, const char *rel_path) ++{ ++ ff_bluray_access *access = fs_handle; ++ ++ char *url = NULL; ++ url = av_append_path_component(access->url, rel_path); ++ if (!url) { ++ return NULL; ++ } ++ AVDictionary *opts = NULL; ++ av_dict_copy(&opts, access->opts, 0); ++ ++ ff_builtin_io *io = NULL; ++ int ret = create_builtin_io(&io, url, &opts, 1); ++ av_dict_free(&opts); ++ av_free(url); ++ ++ if (0 != ret) { ++ av_log(NULL, AV_LOG_ERROR, "can't open dir %s,error:%s", url, av_err2str(ret)); ++ return NULL; ++ } ++ ++ BD_DIR_H *dir = av_malloc(sizeof(BD_DIR_H)); ++ if (!dir) { ++ close_builtin_io(io); ++ av_free(io); ++ return NULL; ++ } ++ ++ dir->internal = io; ++ dir->close = _dir_close; ++ dir->read = _dir_read; ++ ++ return dir; ++} ++ ++// 构建fs_access结构体 ++fs_access * create_bluray_custom_access(const char *url, AVDictionary **options) ++{ ++ ff_bluray_access * opaque = av_mallocz(sizeof(ff_bluray_access)); ++ if (!opaque) { ++ return NULL; ++ } ++ ++ if (opaque) { ++ opaque->url = av_strdup(url); ++ if (options) { ++ av_dict_copy(&opaque->opts, *options, 0); ++ } ++ ++ int ret = create_builtin_io(&opaque->io, url, options, 0); ++ if (0 != ret) { ++ av_log(NULL, AV_LOG_ERROR, "can't open file %s,error:%s", url, av_err2str(ret)); ++ } ++ ++ fs_access *access = av_malloc(sizeof(fs_access)); ++ access->fs_handle = opaque; ++ access->read_blocks = read_blocks; ++ access->open_file = open_file; ++ access->open_dir = open_dir; ++ ++ return access; ++ } ++ return NULL; ++} +diff --git a/libavformat/bluray_custom_fs.h b/libavformat/bluray_custom_fs.h +new file mode 100644 +index 0000000000..806fe29cd0 +--- /dev/null ++++ b/libavformat/bluray_custom_fs.h +@@ -0,0 +1,29 @@ ++// ++// bluray_custom_fs.h ++// ++// Created by Reach Matt on 2024/9/13. ++// ++// ++// Copyright (C) 2021 Matt Reach// ++// Licensed under the Apache License, Version 2.0 (the "License"); ++// you may not use this file except in compliance with the License. ++// You may obtain a copy of the License at ++// ++// http://www.apache.org/licenses/LICENSE-2.0 ++// ++// Unless required by applicable law or agreed to in writing, software ++// distributed under the License is distributed on an "AS IS" BASIS, ++// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++// See the License for the specific language governing permissions and ++// limitations under the License. ++ ++#ifndef bluray_custom_fs_h ++#define bluray_custom_fs_h ++ ++#include ++ ++typedef struct fs_access fs_access; ++typedef struct AVDictionary AVDictionary; ++void destroy_bluray_custom_access(fs_access **p); ++fs_access * create_bluray_custom_access(const char *url, AVDictionary **options); ++#endif /* bluray_custom_fs_smb2_h */ +-- +2.50.1 (Apple Git-155) + diff --git a/patches/ffmpeg-n8.1.1/0024-bluray-open-and-find-the-right-m2ts-then-read-seek-i.patch b/patches/ffmpeg-n8.1.1/0024-bluray-open-and-find-the-right-m2ts-then-read-seek-i.patch new file mode 100644 index 000000000..99d8b4d1e --- /dev/null +++ b/patches/ffmpeg-n8.1.1/0024-bluray-open-and-find-the-right-m2ts-then-read-seek-i.patch @@ -0,0 +1,70 @@ +From 2c0a1a713d91440d6918ce10fe37a5eebc6add10 Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Thu, 29 May 2025 11:16:41 +0800 +Subject: bluray open and find the right m2ts, then read\seek it + direactly instread of bluray logic. + +--- + libavformat/bluray.c | 24 +++++++++++++++++++----- + 1 file changed, 19 insertions(+), 5 deletions(-) + +diff --git a/libavformat/bluray.c b/libavformat/bluray.c +index cd50523ac6..465ea9b63d 100644 +--- a/libavformat/bluray.c ++++ b/libavformat/bluray.c +@@ -42,6 +42,7 @@ typedef struct { + int chapter; + /*int region;*/ + int title_idx; ++ int stream_opened; + } BlurayContext; + + #define OFFSET(x) offsetof(BlurayContext, x) +@@ -222,7 +223,7 @@ static int bluray_open(URLContext *h, const char *path, int flags, AVDictionary + if (bd->chapter > 1) { + bd_seek_chapter(bd->bd, bd->chapter - 1); + } +- ++ bd->stream_opened = 1; + return 0; + } + +@@ -234,7 +235,13 @@ static int bluray_read(URLContext *h, unsigned char *buf, int size) + if (!bd || !bd->bd) { + return AVERROR(EFAULT); + } +- ++ if (bd->stream_opened) { ++ int read = (int)bd_file_read(bd->bd, buf, size); ++ if (read == 0) { ++ return AVERROR_EOF; ++ } ++ return read; ++ } + len = bd_read(bd->bd, buf, size); + + return len == 0 ? AVERROR_EOF : len; +@@ -252,10 +259,17 @@ static int64_t bluray_seek(URLContext *h, int64_t pos, int whence) + case SEEK_SET: + case SEEK_CUR: + case SEEK_END: +- return bd_seek(bd->bd, pos); +- ++ if (bd->stream_opened) { ++ return bd_file_seek(bd->bd, pos, whence); ++ } else { ++ return bd_seek(bd->bd, pos); ++ } + case AVSEEK_SIZE: +- return bd_get_title_size(bd->bd); ++ if (bd->stream_opened) { ++ return bd_file_size(bd->bd); ++ } else { ++ return bd_get_title_size(bd->bd); ++ } + } + + av_log(h, AV_LOG_ERROR, "Unsupported whence operation %d\n", whence); +-- +2.50.1 (Apple Git-155) + diff --git a/patches/ffmpeg-n8.1.1/0025-fix-android-ffmpeg7-test.c-1-10-fatal-error-libxml2-.patch b/patches/ffmpeg-n8.1.1/0025-fix-android-ffmpeg7-test.c-1-10-fatal-error-libxml2-.patch new file mode 100644 index 000000000..9c15a61f8 --- /dev/null +++ b/patches/ffmpeg-n8.1.1/0025-fix-android-ffmpeg7-test.c-1-10-fatal-error-libxml2-.patch @@ -0,0 +1,26 @@ +From 7bef6e629786e43b24ce6b91678de69be4153768 Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Fri, 6 Jun 2025 14:09:50 +0800 +Subject: fix android ffmpeg7 test.c:1:10: fatal error: + 'libxml2/libxml/xmlversion.h' + +--- + configure | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/configure b/configure +index 10c688ca4e..9761c84bd3 100755 +--- a/configure ++++ b/configure +@@ -7448,7 +7448,7 @@ enabled libzmq && require_pkg_config libzmq "libzmq >= 4.2.1" zmq.h z + enabled libzvbi && require_pkg_config libzvbi zvbi-0.2 libzvbi.h vbi_decoder_new && + { test_cpp_condition libzvbi.h "VBI_VERSION_MAJOR > 0 || VBI_VERSION_MINOR > 2 || VBI_VERSION_MINOR == 2 && VBI_VERSION_MICRO >= 28" || + enabled gpl || die "ERROR: libzvbi requires version 0.2.28 or --enable-gpl."; } +-enabled libxml2 && require_pkg_config libxml2 libxml-2.0 libxml2/libxml/xmlversion.h xmlCheckVersion ++enabled libxml2 && require_pkg_config libxml2 libxml-2.0 libxml/xmlversion.h xmlCheckVersion + enabled mbedtls && { check_pkg_config mbedtls mbedtls mbedtls/x509_crt.h mbedtls_x509_crt_init || + check_pkg_config mbedtls mbedtls mbedtls/ssl.h mbedtls_ssl_init || + check_lib mbedtls mbedtls/ssl.h mbedtls_ssl_init -lmbedtls -lmbedx509 -lmbedcrypto || +-- +2.50.1 (Apple Git-155) + diff --git a/patches/ffmpeg-n8.1.1/0026-fix-dash-init-fragment-url-is-invalid-truncated-bug.patch b/patches/ffmpeg-n8.1.1/0026-fix-dash-init-fragment-url-is-invalid-truncated-bug.patch new file mode 100644 index 000000000..5f23a4fe8 --- /dev/null +++ b/patches/ffmpeg-n8.1.1/0026-fix-dash-init-fragment-url-is-invalid-truncated-bug.patch @@ -0,0 +1,43 @@ +From 570be1565c563c878856ec79f6276ec66e7de24d Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Wed, 21 May 2025 18:05:52 +0800 +Subject: fix dash init fragment url is "invalid:truncated" bug + +--- + libavformat/dashdec.c | 12 +++++++++++- + 1 file changed, 11 insertions(+), 1 deletion(-) + +diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c +index 9a2ea78149..5927a6ee3b 100644 +--- a/libavformat/dashdec.c ++++ b/libavformat/dashdec.c +@@ -479,6 +479,10 @@ static char *get_content_url(xmlNodePtr *baseurl_nodes, + int i; + char *text; + char *url = NULL; ++ ++ if (strlen(val) >= max_url_size) { ++ max_url_size += 256; ++ } + char *tmp_str = av_mallocz(max_url_size); + + if (!tmp_str) +@@ -497,8 +501,14 @@ static char *get_content_url(xmlNodePtr *baseurl_nodes, + } + } + +- if (val) ++ if (val) { ++ int tmp_max_url_size = strlen(tmp_str) + strlen(val) + 1; ++ if (tmp_max_url_size > max_url_size) { ++ max_url_size = tmp_max_url_size; ++ tmp_str = av_realloc(tmp_str, max_url_size); ++ } + ff_make_absolute_url(tmp_str, max_url_size, tmp_str, val); ++ } + + if (rep_id_val) { + url = av_strireplace(tmp_str, "$RepresentationID$", rep_id_val); +-- +2.50.1 (Apple Git-155) + diff --git a/patches/ffmpeg-n8.1.1/0027-add-webp-demuxer-and-libwebp-decoder.patch b/patches/ffmpeg-n8.1.1/0027-add-webp-demuxer-and-libwebp-decoder.patch new file mode 100644 index 000000000..1166f15e2 --- /dev/null +++ b/patches/ffmpeg-n8.1.1/0027-add-webp-demuxer-and-libwebp-decoder.patch @@ -0,0 +1,804 @@ +From b47d0c10a29d73b1b01fa945998a590070dc2a79 Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Fri, 8 May 2026 19:02:39 +0800 +Subject: add webp demuxer and libwebp decoder + +--- + configure | 7 +- + libavcodec/Makefile | 1 + + libavcodec/allcodecs.c | 1 + + libavcodec/codec_desc.c | 9 + + libavcodec/codec_id.h | 1 + + libavcodec/libwebpdec.c | 376 +++++++++++++++++++++++++++++++++++++++ + libavformat/Makefile | 1 + + libavformat/allformats.c | 1 + + libavformat/webpdec.c | 296 ++++++++++++++++++++++++++++++ + 9 files changed, 692 insertions(+), 1 deletion(-) + create mode 100644 libavcodec/libwebpdec.c + create mode 100644 libavformat/webpdec.c + +diff --git a/configure b/configure +index 9761c84..0ecc99c 100755 +--- a/configure ++++ b/configure +@@ -7427,7 +7427,12 @@ enabled libvpx && { + enabled libvvenc && require_pkg_config libvvenc "libvvenc >= 1.6.1" "vvenc/vvenc.h" vvenc_get_version + 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 libwebp_anim_encoder && check_pkg_config libwebp_anim_encoder "libwebpmux >= 0.4.0" webp/mux.h WebPAnimEncoderOptionsInit ++ check_pkg_config libwebpdemux "libwebpdemux >= 1.0.0" webp/demux.h WebPDemux ++ if enabled libwebpdemux; then ++ enable webp_demuxer ++ enable libwebp_decoder ++ fi } + enabled libx264 && require_pkg_config libx264 x264 "stdint.h x264.h" x264_encoder_encode && + require_cpp_condition libx264 x264.h "X264_BUILD >= 155" && { + [ "$toolchain" != "msvc" ] || +diff --git a/libavcodec/Makefile b/libavcodec/Makefile +index c51a860..4ae36ed 100644 +--- a/libavcodec/Makefile ++++ b/libavcodec/Makefile +@@ -846,6 +846,7 @@ OBJS-$(CONFIG_WBMP_DECODER) += wbmpdec.o + OBJS-$(CONFIG_WBMP_ENCODER) += wbmpenc.o + OBJS-$(CONFIG_WCMV_DECODER) += wcmv.o + OBJS-$(CONFIG_WEBP_DECODER) += webp.o ++OBJS-$(CONFIG_LIBWEBP_DECODER) += libwebpdec.o + OBJS-$(CONFIG_WEBVTT_DECODER) += webvttdec.o ass.o + OBJS-$(CONFIG_WEBVTT_ENCODER) += webvttenc.o ass_split.o + OBJS-$(CONFIG_WMALOSSLESS_DECODER) += wmalosslessdec.o wma_common.o +diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c +index 695214f..ffc2494 100644 +--- a/libavcodec/allcodecs.c ++++ b/libavcodec/allcodecs.c +@@ -428,6 +428,7 @@ extern const FFCodec ff_zlib_encoder; + extern const FFCodec ff_zlib_decoder; + extern const FFCodec ff_zmbv_encoder; + extern const FFCodec ff_zmbv_decoder; ++extern const FFCodec ff_libwebp_decoder; + + /* audio codecs */ + extern const FFCodec ff_aac_encoder; +diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c +index 93877ed..46e5f8b 100644 +--- a/libavcodec/codec_desc.c ++++ b/libavcodec/codec_desc.c +@@ -3870,6 +3870,15 @@ static const AVCodecDescriptor codec_descriptors[] = { + .long_name = NULL_IF_CONFIG_SMALL("Audio Vivid"), + .props = AV_CODEC_PROP_LOSSY, + }, ++ { ++ .id = AV_CODEC_ID_LIBWEBP, ++ .type = AVMEDIA_TYPE_VIDEO, ++ .name = "libwebp", ++ .long_name = NULL_IF_CONFIG_SMALL("libWebP"), ++ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY | ++ AV_CODEC_PROP_LOSSLESS, ++ .mime_types= MT("image/webp"), ++ }, + { + .id = AV_CODEC_ID_VNULL, + .type = AVMEDIA_TYPE_VIDEO, +diff --git a/libavcodec/codec_id.h b/libavcodec/codec_id.h +index 43f7549..31bb7a6 100644 +--- a/libavcodec/codec_id.h ++++ b/libavcodec/codec_id.h +@@ -629,6 +629,7 @@ enum AVCodecID { + * Null encoder/decoder discard all input and never return any output. + */ + AV_CODEC_ID_AVS3DA, ++ AV_CODEC_ID_LIBWEBP, + AV_CODEC_ID_VNULL, + /** + * Dummy null audio codec, useful mainly for development and debugging. +diff --git a/libavcodec/libwebpdec.c b/libavcodec/libwebpdec.c +new file mode 100644 +index 0000000..17b69d0 +--- /dev/null ++++ b/libavcodec/libwebpdec.c +@@ -0,0 +1,376 @@ ++/* ++ * libwebpdec.c ++ * ++ * Copyright (c) 2025 debugly ++ * ++ * This file is part of FSPlayer. ++ * ++ * FSPlayer is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 3 of the License, or (at your option) any later version. ++ * ++ * FSPlayer is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FSPlayer; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#include "codec_internal.h" ++#include "decode.h" ++#include "internal.h" ++#include "libavutil/common.h" ++#include "libavutil/imgutils.h" ++#include "libavutil/mem.h" ++#include "libavutil/opt.h" ++#include "libavutil/pixdesc.h" ++#include ++#include ++ ++typedef struct MyImageRef { ++ int width; ++ int height; ++ uint8_t *data; ++} MyImageRef; ++ ++typedef struct MyRect { ++ int x; ++ int y; ++ int w; ++ int h; ++} MyRect; ++ ++typedef struct LibWebPDecoderContext { ++ AVClass *class; ++ MyImageRef *canvas; // The main compositing canvas ++} LibWebPDecoderContext; ++ ++static void release_image(MyImageRef *img) ++{ ++ if (img) { ++ if (img->data) ++ av_free(img->data); ++ free(img); ++ } ++} ++ ++static int alloc_image(MyImageRef **img, int width, int height) ++{ ++ if (!img || width <= 0 || height <= 0) ++ return AVERROR(EINVAL); ++ ++ *img = malloc(sizeof(MyImageRef)); ++ if (!*img) ++ return AVERROR(ENOMEM); ++ ++ (*img)->width = width; ++ (*img)->height = height; ++ (*img)->data = av_malloc(width * height * 4); // RGBA ++ if (!(*img)->data) { ++ free(*img); ++ *img = NULL; ++ return AVERROR(ENOMEM); ++ } ++ ++ memset((*img)->data, 0, width * height * 4); // 初始化为透明 ++ return 0; ++} ++ ++static void clear_rect(MyImageRef *img, MyRect rect) ++{ ++ if (!img || !img->data) ++ return; ++ ++ int img_width = img->width; ++ int img_height = img->height; ++ uint8_t *data = img->data; ++ ++ // 确保矩形在图像范围内 ++ int start_x = FFMAX(0, rect.x); ++ int start_y = FFMAX(0, rect.y); ++ int end_x = FFMIN(img_width, rect.x + rect.w); ++ int end_y = FFMIN(img_height, rect.y + rect.h); ++ ++ for (int y = start_y; y < end_y; y++) { ++ uint8_t *row = data + y * img_width * 4; ++ memset(row + start_x * 4, 0, (end_x - start_x) * 4); ++ } ++} ++ ++static void blend_pixel(uint8_t *dst, const uint8_t *src) ++{ ++ uint8_t sa = src[3]; ++ if (sa == 0) { ++ return; // 源像素完全透明,直接返回 ++ } else if (sa == 255) { ++ // 源像素完全不透明,直接覆盖 ++ memcpy(dst, src, 4); ++ return; ++ } ++ ++ uint8_t da = dst[3]; ++ uint8_t out_a = sa + ((da * (255 - sa)) / 255); ++ ++ if (out_a == 0) { ++ memset(dst, 0, 4); ++ return; ++ } ++ ++ dst[0] = (src[0] * sa + dst[0] * da * (255 - sa) / 255) / out_a; ++ dst[1] = (src[1] * sa + dst[1] * da * (255 - sa) / 255) / out_a; ++ dst[2] = (src[2] * sa + dst[2] * da * (255 - sa) / 255) / out_a; ++ dst[3] = out_a; ++} ++ ++static void draw_image(MyImageRef *canvas, MyImageRef *image, MyRect rect) ++{ ++ if (!canvas || !canvas->data || !image || !image->data) ++ return; ++ ++ int canvas_width = canvas->width; ++ int canvas_height = canvas->height; ++ uint8_t *canvas_data = canvas->data; ++ ++ int image_width = image->width; ++ int image_height = image->height; ++ uint8_t *image_data = image->data; ++ ++ // 计算绘制区域 ++ int start_x = FFMAX(0, rect.x); ++ int start_y = FFMAX(0, rect.y); ++ int end_x = FFMIN(canvas_width, rect.x + rect.w); ++ int end_y = FFMIN(canvas_height, rect.y + rect.h); ++ ++ for (int y = start_y; y < end_y; y++) { ++ uint8_t *canvas_row = canvas_data + y * canvas_width * 4; ++ uint8_t *image_row = image_data + (y - rect.y) * image_width * 4; ++ for (int x = start_x; x < end_x; x++) { ++ uint8_t *canvas_pixel = canvas_row + x * 4; ++ uint8_t *image_pixel = image_row + (x - rect.x) * 4; ++ ++ blend_pixel(canvas_pixel, image_pixel); ++ } ++ } ++} ++ ++static av_cold int libwebp_decode_init(AVCodecContext *avctx) ++{ ++ LibWebPDecoderContext *s = avctx->priv_data; ++ int canvas_size; ++ ++ if (avctx->width <= 0 || avctx->height <= 0) { ++ av_log(avctx, AV_LOG_ERROR, ++ "Invalid canvas dimensions from avctx: %dx%d\n", avctx->width, ++ avctx->height); ++ return AVERROR_INVALIDDATA; ++ } ++ ++ if (alloc_image(&s->canvas, avctx->width, avctx->height)) { ++ av_log(avctx, AV_LOG_ERROR, "Failed to allocate canvas buffer\n"); ++ return AVERROR(ENOMEM); ++ } ++ ++ avctx->pix_fmt = AV_PIX_FMT_RGBA; ++ ++ return 0; ++} ++ ++static int get_origin_from_pkt_side_data(AVPacket *pkt, int *offsetx, ++ int *offsety, int *blend, int *dispose) ++{ ++ if (!pkt || !offsetx || !offsety) { ++ return AVERROR(EINVAL); ++ } ++ ++ // 初始化输出参数 ++ *offsetx = 0; ++ *offsety = 0; ++ *blend = 0; ++ *dispose = 0; ++ ++ // 获取元数据 ++ size_t metadata_len = 0; ++ uint8_t *metadata_data = av_packet_get_side_data( ++ pkt, AV_PKT_DATA_STRINGS_METADATA, &metadata_len); ++ ++ if (!metadata_data || metadata_len == 0) { ++ return -1; // ++ } ++ ++ // 解包元数据到AVDictionary ++ AVDictionary *dict = NULL; ++ int ret = av_packet_unpack_dictionary(metadata_data, metadata_len, &dict); ++ if (ret < 0) { ++ av_log(NULL, AV_LOG_ERROR, "Failed to unpack metadata: %d\n", ret); ++ return ret; ++ } ++ ++ // 解析offsetx和offsety和blend ++ AVDictionaryEntry *entry = NULL; ++ entry = av_dict_get(dict, "offsetx", NULL, 0); ++ if (entry && entry->value) { ++ *offsetx = atoi(entry->value); // 转换字符串为整数 ++ } ++ ++ entry = av_dict_get(dict, "offsety", NULL, 0); ++ if (entry && entry->value) { ++ *offsety = atoi(entry->value); ++ } ++ ++ entry = av_dict_get(dict, "blend", NULL, 0); ++ if (entry && entry->value) { ++ *blend = atoi(entry->value); ++ } ++ ++ entry = av_dict_get(dict, "dispose", NULL, 0); ++ if (entry && entry->value) { ++ *dispose = atoi(entry->value); ++ } ++ ++ // 释放字典 ++ av_dict_free(&dict); ++ return 0; ++} ++ ++static int libwebp_do_decode_frame(AVPacket *pkt, MyImageRef **imgp) ++{ ++ WebPDecoderConfig config; ++ // 1. 解码当前帧并获取其属性 ++ if (!WebPInitDecoderConfig(&config)) ++ return AVERROR_UNKNOWN; ++ ++ if (WebPGetFeatures(pkt->data, pkt->size, &config.input) != VP8_STATUS_OK) ++ return AVERROR_INVALIDDATA; ++ ++ int hasAlpha = config.input.has_alpha; ++ int input_width = config.input.width; ++ int input_height = config.input.height; ++ if (input_width <= 0 || input_height <= 0) ++ return AVERROR_INVALIDDATA; ++ ++ config.output.colorspace = MODE_RGBA; ++ config.output.is_external_memory = 1; ++ ++ MyImageRef *img; ++ ++ if (alloc_image(&img, input_width, input_height)) { ++ return AVERROR(ENOMEM); ++ } ++ ++ int rgba_stride = img->width * 4; ++ uint8_t *rgba = img->data; ++ config.output.u.RGBA.rgba = rgba; ++ config.output.u.RGBA.stride = rgba_stride; ++ config.output.u.RGBA.size = input_height * rgba_stride; ++ ++ if (WebPDecode(pkt->data, pkt->size, &config) != VP8_STATUS_OK) { ++ release_image(img); ++ return AVERROR_INVALIDDATA; ++ } ++ *imgp = img; ++ return 0; ++} ++ ++static int libwebp_decode_frame(AVCodecContext *avctx, AVFrame *frame, ++ int *got_frame, const AVPacket *pkt) ++{ ++ LibWebPDecoderContext *s = avctx->priv_data; ++ ++ int offsetx, offsety, blend, dispose; ++ if (get_origin_from_pkt_side_data(pkt, &offsetx, &offsety, &blend, ++ &dispose) < 0) { ++ return AVERROR_INVALIDDATA; ++ } ++ ++ // 使用 libwebp 解码当前帧 ++ MyImageRef *img = NULL; ++ int ret = libwebp_do_decode_frame((AVPacket *)pkt, &img); ++ if (ret < 0) { ++ av_log(avctx, AV_LOG_ERROR, "Failed to decode WebP frame: %d\n", ret); ++ return ret; ++ } ++ ++ // 将当前帧渲染到已准备好的画布上 ++ MyRect rect = {offsetx, offsety, img->width, img->height}; ++ draw_image(s->canvas, img, rect); ++ release_image(img); ++ ++ frame->width = avctx->width; ++ frame->height = avctx->height; ++ frame->format = avctx->pix_fmt; ++ ++ // 为 frame 申请内存 ++ if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { ++ return ret; ++ } ++ ++ // 将合成好的画布复制到输出帧 ++ int canvas_linesize = s->canvas->width * 4; ++ av_image_copy_plane(frame->data[0], frame->linesize[0], s->canvas->data, ++ s->canvas->width * 4, s->canvas->width * 4, ++ s->canvas->height); ++ ++ // av_image_copy(frame->data, frame->linesize, ++ // (const uint8_t **)&s->canvas->data, &canvas_linesize, ++ // avctx->pix_fmt, output_width, output_height); ++ ++ // 执行 dispose 操作 ++ if (dispose == WEBP_MUX_DISPOSE_BACKGROUND) { ++ clear_rect(s->canvas, rect); ++ } ++ ++ *got_frame = 1; ++ ret = pkt->size; ++ ++ return ret; ++} ++ ++static int libwebp_decode_flush(AVCodecContext *avctx) ++{ ++ LibWebPDecoderContext *s = avctx->priv_data; ++ if (s->canvas && s->canvas->data) { ++ memset(s->canvas->data, 0, s->canvas->width * s->canvas->height * 4); ++ } ++ return 0; ++} ++ ++//when seek or seek to zero for loop,clear then canvas ++static av_cold int libwebp_decode_close(AVCodecContext *avctx) ++{ ++ LibWebPDecoderContext *s = avctx->priv_data; ++ release_image(s->canvas); ++ s->canvas = NULL; ++ return 0; ++} ++ ++#define OFFSET(x) offsetof(LibWebPDecoderContext, x) ++#define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM ++ ++static const AVOption options[] = {{NULL}}; ++ ++static const AVClass libwebp_decoder_class = { ++ .class_name = "libwebp decoder", ++ .item_name = av_default_item_name, ++ .option = options, ++ .version = LIBAVUTIL_VERSION_INT, ++}; ++ ++const FFCodec ff_libwebp_decoder = { ++ .p.name = "libwebp", ++ .p.long_name = NULL_IF_CONFIG_SMALL("libwebp WebP image decoder"), ++ .p.type = AVMEDIA_TYPE_VIDEO, ++ .p.id = AV_CODEC_ID_LIBWEBP, ++ .priv_data_size = sizeof(LibWebPDecoderContext), ++ .init = libwebp_decode_init, ++ .cb.decode = libwebp_decode_frame, ++ .flush = libwebp_decode_flush, ++ .close = libwebp_decode_close, ++ .p.capabilities = AV_CODEC_CAP_DR1, ++ .p.priv_class = &libwebp_decoder_class, ++ .p.wrapper_name = "libwebp", ++ .caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE, ++}; +diff --git a/libavformat/Makefile b/libavformat/Makefile +index 54e88cf..3081d27 100644 +--- a/libavformat/Makefile ++++ b/libavformat/Makefile +@@ -659,6 +659,7 @@ OBJS-$(CONFIG_WEBM_MUXER) += matroskaenc.o matroska.o \ + OBJS-$(CONFIG_WEBM_DASH_MANIFEST_MUXER) += webmdashenc.o + OBJS-$(CONFIG_WEBM_CHUNK_MUXER) += webm_chunk.o + OBJS-$(CONFIG_WEBP_MUXER) += webpenc.o ++OBJS-$(CONFIG_WEBP_DEMUXER) += webpdec.o + OBJS-$(CONFIG_WEBVTT_DEMUXER) += webvttdec.o subtitles.o + OBJS-$(CONFIG_WEBVTT_MUXER) += webvttenc.o + OBJS-$(CONFIG_WHIP_MUXER) += whip.o avc.o http.o srtp.o +diff --git a/libavformat/allformats.c b/libavformat/allformats.c +index 1a05db9..f69c550 100644 +--- a/libavformat/allformats.c ++++ b/libavformat/allformats.c +@@ -571,6 +571,7 @@ extern const FFInputFormat ff_image_svg_pipe_demuxer; + extern const FFInputFormat ff_image_sunrast_pipe_demuxer; + extern const FFInputFormat ff_image_tiff_pipe_demuxer; + extern const FFInputFormat ff_image_vbn_pipe_demuxer; ++extern const FFInputFormat ff_webp_demuxer; + extern const FFInputFormat ff_image_webp_pipe_demuxer; + extern const FFInputFormat ff_image_xbm_pipe_demuxer; + extern const FFInputFormat ff_image_xpm_pipe_demuxer; +diff --git a/libavformat/webpdec.c b/libavformat/webpdec.c +new file mode 100644 +index 0000000..078ac99 +--- /dev/null ++++ b/libavformat/webpdec.c +@@ -0,0 +1,296 @@ ++/* ++ * webpdec.c ++ * ++ * Copyright (c) 2025 debugly ++ * ++ * This file is part of FSPlayer. ++ * ++ * FSPlayer is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 3 of the License, or (at your option) any later version. ++ * ++ * FSPlayer is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FSPlayer; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#include "internal.h" ++#include "demux.h" ++#include "libavutil/intreadwrite.h" ++#include "libavutil/mem.h" ++#include "libavutil/common.h" ++#include ++ ++typedef struct WebPDemuxContext { ++ const AVClass *class; ++ WebPDemuxer *demuxer; ++ WebPIterator iter; // 帧迭代器 ++ int current_frame; // 当前帧索引 ++ int frame_count; // 总帧数 ++ int64_t duration; // 总时长(ms) ++ uint8_t *data; // 文件数据缓冲区 ++ size_t data_size; // 数据大小 ++ int64_t *frame_timestamps; // 帧时间戳数组(ms) ++ int *frame_durations; // 帧时长数组(ms) ++} WebPDemuxContext; ++ ++// 释放迭代器资源 ++static void webp_release_iterator(WebPIterator *iter) { ++ if (iter->fragment.bytes) { ++ WebPDemuxReleaseIterator(iter); ++ memset(iter, 0, sizeof(*iter)); ++ } ++} ++ ++// 探测WebP格式 ++static int webp_read_probe(const AVProbeData *p) { ++ // WebP文件格式以"RIFF"开头,后面跟着4字节大小和"WEBP"标识 ++ if (p->buf_size < 12) ++ return 0; ++ ++ // 检查RIFF标识和WEBP格式标识 ++ if (AV_RL32(p->buf) == MKTAG('R', 'I', 'F', 'F') && ++ AV_RL32(p->buf + 8) == MKTAG('W', 'E', 'B', 'P')) { ++ // 确定是WebP文件,返回较高的探测分数 ++ return AVPROBE_SCORE_MAX; ++ } ++ ++ return 0; ++} ++ ++static int webp_read_header(AVFormatContext *s) { ++ WebPDemuxContext *wp = s->priv_data; ++ AVIOContext *pb = s->pb; ++ AVStream *st; ++ int ret, i; ++ ++ // 读取文件到内存 ++ wp->data_size = avio_size(pb); ++ if (wp->data_size <= 0) { ++ av_log(s, AV_LOG_ERROR, "Invalid file size\n"); ++ return AVERROR_INVALIDDATA; ++ } ++ ++ wp->data = av_malloc(wp->data_size); ++ if (!wp->data) ++ return AVERROR(ENOMEM); ++ ++ if (avio_read(pb, wp->data, wp->data_size) != wp->data_size) { ++ av_log(s, AV_LOG_ERROR, "Failed to read file\n"); ++ ret = AVERROR(EIO); ++ goto fail; ++ } ++ ++ // 初始化WebP解复用器 ++ WebPData webp_data; ++ WebPDataInit(&webp_data); ++ webp_data.bytes = wp->data; ++ webp_data.size = wp->data_size; ++ ++ wp->demuxer = WebPDemux(&webp_data); ++ if (!wp->demuxer) { ++ av_log(s, AV_LOG_ERROR, "Failed to create WebP demuxer\n"); ++ ret = AVERROR_INVALIDDATA; ++ goto fail; ++ } ++ ++ wp->frame_count = WebPDemuxGetI(wp->demuxer, WEBP_FF_FRAME_COUNT); ++ // 获取画布尺寸 ++ int canvas_width = WebPDemuxGetI(wp->demuxer, WEBP_FF_CANVAS_WIDTH); ++ int canvas_height = WebPDemuxGetI(wp->demuxer, WEBP_FF_CANVAS_HEIGHT); ++ ++ // int loop_count = WebPDemuxGetI(wp->demuxer, WEBP_FF_LOOP_COUNT); ++ // uint32_t flags = WebPDemuxGetI(wp->demuxer, WEBP_FF_FORMAT_FLAGS); ++ ++ // int has_animation = flags & ANIMATION_FLAG; ++ // int has_alpha = flags & ALPHA_FLAG; ++ ++ // 分配帧时间戳和时长数组 ++ wp->frame_timestamps = av_malloc_array(wp->frame_count, sizeof(int64_t)); ++ wp->frame_durations = av_malloc_array(wp->frame_count, sizeof(int)); ++ if (!wp->frame_timestamps || !wp->frame_durations) { ++ ret = AVERROR(ENOMEM); ++ goto fail; ++ } ++ ++ memset(&wp->iter, 0, sizeof(wp->iter)); ++ // libwebp's index start with 1 ++ if (!WebPDemuxGetFrame(wp->demuxer, 1, &wp->iter)) { ++ av_log(s, AV_LOG_ERROR, "Failed to get first frame\n"); ++ ret = AVERROR_INVALIDDATA; ++ goto fail; ++ } ++ ++ wp->duration = 0; ++ for (i = 0; i < wp->frame_count; i++) { ++ int duration = wp->iter.duration; ++ if (duration <= 10) { ++ // WebP standard says 0 duration is used for canvas updating but not showing image, but actually Chrome and other implementations set it to 100ms if duration is lower or equal than 10ms ++ // Some animated WebP images also created without duration, we should keep compatibility ++ duration = 100; ++ } ++ wp->frame_durations[i] = duration; ++ wp->frame_timestamps[i] = wp->duration; ++ wp->duration += wp->frame_durations[i]; ++ if (i < wp->frame_count - 1) ++ WebPDemuxNextFrame(&wp->iter); ++ } ++ ++ // 重置迭代器到第一帧 ++ webp_release_iterator(&wp->iter); ++ if (!WebPDemuxGetFrame(wp->demuxer, 1, &wp->iter)) { ++ av_log(s, AV_LOG_ERROR, "Failed to reset to first frame\n"); ++ ret = AVERROR_INVALIDDATA; ++ goto fail; ++ } ++ ++ // 创建视频流 ++ st = avformat_new_stream(s, NULL); ++ if (!st) { ++ ret = AVERROR(ENOMEM); ++ goto fail; ++ } ++ ++ // 设置流参数 ++ st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO; ++ // 使用自定义解码器 ++ st->codecpar->codec_id = AV_CODEC_ID_LIBWEBP; ++ st->codecpar->width = canvas_width; ++ st->codecpar->height = canvas_height; ++ st->duration = wp->duration; ++ avpriv_set_pts_info(st, 64, 1, 1000); // 时基:1ms ++ ++ wp->current_frame = 0; ++ return 0; ++ ++fail: ++ webp_release_iterator(&wp->iter); ++ WebPDemuxDelete(wp->demuxer); ++ av_free(wp->data); ++ av_free(wp->frame_timestamps); ++ av_free(wp->frame_durations); ++ return ret; ++} ++ ++/** ++ * Add this frame's source path and basename to packet's sidedata ++ * as a dictionary, so it can be used by filters like 'drawtext'. ++ */ ++static int add_origin_as_pkt_side_data(int offsetx, int offsety, int blend, int dispose, AVPacket *pkt) { ++ AVDictionary *d = NULL; ++ char *packed_metadata = NULL; ++ size_t metadata_len; ++ int ret; ++ ++ av_dict_set_int(&d, "offsetx", offsetx, 0); ++ av_dict_set_int(&d, "offsety", offsety, 0); ++ av_dict_set_int(&d, "blend", blend, 0); ++ av_dict_set_int(&d, "dispose", dispose, 0); ++ ++ packed_metadata = av_packet_pack_dictionary(d, &metadata_len); ++ av_dict_free(&d); ++ if (!packed_metadata) ++ return AVERROR(ENOMEM); ++ ret = av_packet_add_side_data(pkt, AV_PKT_DATA_STRINGS_METADATA, ++ packed_metadata, metadata_len); ++ if (ret < 0) { ++ av_freep(&packed_metadata); ++ return ret; ++ } ++ return 0; ++} ++ ++static int webp_read_packet(AVFormatContext *s, AVPacket *pkt) { ++ WebPDemuxContext *wp = s->priv_data; ++ int ret; ++ ++ if (wp->current_frame >= wp->frame_count) ++ return AVERROR_EOF; ++ ++ // 分配并填充数据包 ++ if ((ret = av_new_packet(pkt, wp->iter.fragment.size)) < 0) ++ return ret; ++ memcpy(pkt->data, wp->iter.fragment.bytes, wp->iter.fragment.size); ++ ++ add_origin_as_pkt_side_data(wp->iter.x_offset, wp->iter.y_offset, wp->iter.blend_method == WEBP_MUX_BLEND, wp->iter.dispose_method == WEBP_MUX_DISPOSE_BACKGROUND, pkt); ++ // 设置数据包参数 ++ pkt->stream_index = 0; ++ pkt->pts = wp->frame_timestamps[wp->current_frame]; ++ pkt->duration = wp->frame_durations[wp->current_frame]; ++ pkt->flags |= AV_PKT_FLAG_KEY; ++ ++ // 准备下一帧 ++ wp->current_frame++; ++ if (wp->current_frame < wp->frame_count && !WebPDemuxNextFrame(&wp->iter)) ++ av_log(s, AV_LOG_WARNING, "Unexpected end of frames\n"); ++ ++ return 0; ++} ++ ++static int webp_read_seek(AVFormatContext *s, int stream_index, ++ int64_t timestamp, int flags) { ++ WebPDemuxContext *wp = s->priv_data; ++ int target_frame; ++ ++ if (stream_index != 0) ++ return -1; ++ ++ // 计算目标帧索引 ++ target_frame = av_rescale_rnd(timestamp, wp->frame_count, ++ wp->duration, flags & AVSEEK_FLAG_BACKWARD ? AV_ROUND_DOWN : AV_ROUND_UP); ++ ++ // 手动实现范围限制(替代av_clamp) ++ if (target_frame < 0) { ++ target_frame = 0; ++ } else if (target_frame >= wp->frame_count) { ++ target_frame = wp->frame_count - 1; ++ } ++ ++ // 定位到目标帧 ++ webp_release_iterator(&wp->iter); ++ if (!WebPDemuxGetFrame(wp->demuxer, target_frame + 1, &wp->iter)) { ++ av_log(s, AV_LOG_ERROR, "Failed to seek to frame %d\n", target_frame); ++ return AVERROR_INVALIDDATA; ++ } ++ ++ wp->current_frame = target_frame; ++ return 0; ++} ++ ++static int webp_read_close(AVFormatContext *s) { ++ WebPDemuxContext *wp = s->priv_data; ++ ++ webp_release_iterator(&wp->iter); ++ WebPDemuxDelete(wp->demuxer); ++ av_free(wp->data); ++ av_free(wp->frame_timestamps); ++ av_free(wp->frame_durations); ++ return 0; ++} ++ ++static const AVClass webp_demuxer_class = { ++ .class_name = "WebP demuxer", ++ .item_name = av_default_item_name, ++ .version = LIBAVUTIL_VERSION_INT, ++}; ++ ++// FFmpeg 7.x输入解复用器标准声明 ++const FFInputFormat ff_webp_demuxer = { ++ .p.name = "webp", ++ .p.long_name = NULL_IF_CONFIG_SMALL("WebP image format (libwebp 1.5.0+)"), ++ .p.flags = AVFMT_GENERIC_INDEX, ++ .p.extensions = "webp", ++ .read_probe = webp_read_probe, ++ .read_header = webp_read_header, ++ .read_packet = webp_read_packet, ++ .read_seek = webp_read_seek, ++ .read_close = webp_read_close, ++ .priv_data_size = sizeof(WebPDemuxContext), ++ .p.priv_class = &webp_demuxer_class, ++}; +-- +2.50.1 (Apple Git-155) + From 1466d9b5f1dec52e699b4883c92c25c7c3a7d19b Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Sat, 9 May 2026 10:33:31 +0800 Subject: [PATCH 316/359] workflow add ffmpeg8 --- .github/workflows/build all libs.yml | 2 ++ .github/workflows/build one lib.yml | 1 + .github/workflows/install-dependencies.sh | 19 +++++++++++++++++++ 3 files changed, 22 insertions(+) diff --git a/.github/workflows/build all libs.yml b/.github/workflows/build all libs.yml index 9bc9fe020..ef0b9a739 100644 --- a/.github/workflows/build all libs.yml +++ b/.github/workflows/build all libs.yml @@ -60,6 +60,7 @@ on: - ffmpeg5 - ffmpeg6 - ffmpeg7 + - ffmpeg8 dryrun: description: 'just run workflow,but not deploy' required: false @@ -204,6 +205,7 @@ jobs: "ffmpeg5" "ffmpeg6" "ffmpeg7" + "ffmpeg8" ) first=${{ inputs.first_library }} diff --git a/.github/workflows/build one lib.yml b/.github/workflows/build one lib.yml index e9dde5d5d..336ff1688 100644 --- a/.github/workflows/build one lib.yml +++ b/.github/workflows/build one lib.yml @@ -49,6 +49,7 @@ on: type: choice default: 'ffmpeg7' options: + - ffmpeg8 - ffmpeg7 - ffmpeg6 - ffmpeg5 diff --git a/.github/workflows/install-dependencies.sh b/.github/workflows/install-dependencies.sh index 06ffd7580..d8cfc454d 100755 --- a/.github/workflows/install-dependencies.sh +++ b/.github/workflows/install-dependencies.sh @@ -35,6 +35,25 @@ case $LIB_NAME in ./main.sh install -l 'xml2' -p $PLAT fi ;; + ffmpeg8) + if [[ $PLAT == all ]];then + ./main.sh install -l 'openssl3 opus bluray dav1d dvdnav uavs3d smb2 webp' -p ios + ./main.sh install -l 'openssl3 opus bluray dav1d dvdnav uavs3d smb2 webp' -p tvos + ./main.sh install -l 'openssl3 opus bluray dav1d dvdnav uavs3d smb2 webp' -p macos + ./main.sh install -l 'openssl3 opus bluray dav1d dvdnav uavs3d smb2 soundtouch' -p android + elif [[ $PLAT == apple ]];then + ./main.sh install -l 'openssl3 opus bluray dav1d dvdnav uavs3d smb2 webp' -p ios + ./main.sh install -l 'openssl3 opus bluray dav1d dvdnav uavs3d smb2 webp' -p tvos + ./main.sh install -l 'openssl3 opus bluray dav1d dvdnav uavs3d smb2 webp' -p macos + else + ./main.sh install -l 'openssl3 opus bluray dav1d dvdnav uavs3d smb2' -p $PLAT + if [[ $PLAT == android ]];then + ./main.sh install -l 'soundtouch' -p android + else + ./main.sh install -l 'webp' -p $PLAT + fi + fi + ;; ffmpeg7) if [[ $PLAT == all ]];then ./main.sh install -l 'openssl3 opus bluray dav1d dvdnav uavs3d smb2 webp' -p ios From 7565ec676cd35265674e1e58eb927840e7703557 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Sat, 9 May 2026 11:37:58 +0800 Subject: [PATCH 317/359] compatiable with ffmpeg5 no patch --- configs/ffconfig/auto-detect-third-libs.sh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/configs/ffconfig/auto-detect-third-libs.sh b/configs/ffconfig/auto-detect-third-libs.sh index ba8cfc578..948a92ec5 100644 --- a/configs/ffconfig/auto-detect-third-libs.sh +++ b/configs/ffconfig/auto-detect-third-libs.sh @@ -107,6 +107,13 @@ gt_or_equal() { return 0 } +has_feature() { + local feature=$1 + $MR_BUILD_SOURCE/configure --help | grep -q -- "$feature" && enable_feature=1 || enable_feature=0 + echo $enable_feature + return 0 +} + echo "----------------------" # use pkg-config fix ff4.0--ijk0.8.8--20210426--001 use openssl 1_1_1m occur can't find openssl error. @@ -204,8 +211,8 @@ if [[ $result ]]; then fi echo "----------------------" else - result=$(gt_or_equal "$GIT_REPO_VERSION" "5") - if [[ $result ]]; then + dvd_feature=$(has_feature "libdvdread") + if [[ $dvd_feature ]]; then pkg-config --libs dvdread --silence-errors >/dev/null && enable_dvdread=1 if [[ $enable_dvdread ]];then echo "[✅] --enable-libdvdread : $(pkg-config --modversion dvdread)" @@ -247,8 +254,9 @@ fi echo "----------------------" -enable_webp= -if [[ $MR_PLAT != 'android' ]];then +result=$(gt_or_equal "$GIT_REPO_VERSION" "7") +if [[ $result && $MR_PLAT != 'android' ]]; then + enable_webp= pkg-config --libs libwebp --silence-errors >/dev/null && enable_webp=1 if [[ $enable_webp ]];then echo "[✅] --enable-libwebp --enable-decoder=webp : $(pkg-config --modversion libwebp)" From 39530fef5d6079203afc7451bbee81e65df5e30c Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Sat, 9 May 2026 16:14:11 +0800 Subject: [PATCH 318/359] fix pc file lib path bug --- do-compile/apple/any.sh | 3 +-- do-install/correct-pc.sh | 28 +++++++++++++++++++++++----- do-install/install-pre-lib.sh | 2 ++ do-install/main.sh | 4 ---- 4 files changed, 26 insertions(+), 11 deletions(-) diff --git a/do-compile/apple/any.sh b/do-compile/apple/any.sh index 8e70fc761..6e6d19999 100755 --- a/do-compile/apple/any.sh +++ b/do-compile/apple/any.sh @@ -93,7 +93,7 @@ do_lipo_all() { #-L/Users/runner/work/MRFFToolChainBuildShell/MRFFToolChainBuildShell/build/product/macos/opus-arch/lib #-> #-L/Users/runner/work/MRFFToolChainBuildShell/MRFFToolChainBuildShell/build/product/macos/universal/opus/lib - # my_sed_i "s|${LIB_NAME}-${arch}|universal/${LIB_NAME}|g" "$pc_dst_dir/"*.pc + #my_sed_i "s|${LIB_NAME}-${arch}|universal/${LIB_NAME}|g" "$pc_dst_dir/"*.pc #fix prefix path p="$uni_dir/$LIB_NAME" @@ -186,7 +186,6 @@ function do_compile() { mkdir -p "$MR_BUILD_PREFIX" ./$LIB_NAME.sh - do_fix_pc } function resolve_dep() { diff --git a/do-install/correct-pc.sh b/do-install/correct-pc.sh index 98aa70ff9..629b47649 100755 --- a/do-install/correct-pc.sh +++ b/do-install/correct-pc.sh @@ -26,7 +26,6 @@ function correct_pc_file(){ echo "fix pc files in folder: $fix_path" cd "$fix_path" - for pc in `find . -type f -name "*.pc"` ; do local pkgconfig=$(cd $(dirname "$pc"); pwd) @@ -34,11 +33,30 @@ function correct_pc_file(){ local base_dir=$(cd $(dirname "$lib_dir"); pwd) local include_dir="${base_dir}/include" local bin_dir="${base_dir}/bin" + + # 全局替换 prefix= 开头后面的内容 + old_base=$(sed -n 's/^prefix=//p' "$pc") + my_sed_i "s|$old_base|$base_dir|g" "$pc" + + # 具有局限性,比如 includedir=/Users/matt/GitWorkspace/fsplayer/FFToolChain/build/product/ios/universal-simulator/bluray + # my_sed_i "s|^prefix=.*|prefix=$base_dir|" "$pc" + # my_sed_i "s|^exec_prefix=[^$].*|exec_prefix=$bin_dir|" $pc + # my_sed_i "s|^libdir=[^$].*|libdir=$lib_dir|" "$pc" + # my_sed_i "s|^includedir=[^$].*include|includedir=$include_dir|" "$pc" + + # fix absolute path which contains arch suffix bug,such as /path/to/opus-arch/lib + #-L/Users/runner/work/MRFFToolChainBuildShell/MRFFToolChainBuildShell/build/product/macos/opus-arch/lib + #-> + #-L/Users/runner/work/MRFFToolChainBuildShell/MRFFToolChainBuildShell/build/product/macos/universal/opus/lib + # my_sed_i "s|${LIB_NAME}-arm64[^/]*/|universal/${LIB_NAME}/|g" "$pc" + # 匹配逻辑: + # 1. 匹配 [^/]* -> 路径中最后一个斜杠后的字符(即 LIB_NAME) + # 2. 匹配 -(arm64|x86) -> 紧跟其后的架构标识 + # 3. 匹配 [^/]* -> 架构后的剩余后缀(如 _simulator) + # 4. 替换为 universal/\1 -> \1 就是第一对括号捕获到的 LIB_NAME - my_sed_i "s|^prefix=.*|prefix=$base_dir|" "$pc" - my_sed_i "s|^exec_prefix=[^$].*|exec_prefix=$bin_dir|" $pc - my_sed_i "s|^libdir=[^$].*|libdir=$lib_dir|" "$pc" - my_sed_i "s|^includedir=[^$].*include|includedir=$include_dir|" "$pc" + my_sed_i "s|\([^/]*\)-arm64[^/]*|universal/\1|g" "$pc" + my_sed_i "s|\([^/]*\)-x86[^/]*|universal/\1|g" "$pc" # Fix absolute paths to other internal dependencies # Pattern: -L/any/path/PRODUCT_NAME/PLATFORM/universal/LIB_NAME/lib diff --git a/do-install/install-pre-lib.sh b/do-install/install-pre-lib.sh index 93eca899f..cc24e1e97 100755 --- a/do-install/install-pre-lib.sh +++ b/do-install/install-pre-lib.sh @@ -38,6 +38,8 @@ function install_plat() { export MR_UNCOMPRESS_DIR="$MR_WORKSPACE/product/$MR_PLAT/universal${join}" ./download-uncompress.sh + #由于解压后可能包含依赖库,所以保险起见修正全部的pc文件 + ./correct-pc.sh "${MR_UNCOMPRESS_DIR}" } if [[ "$MR_PLAT" == 'ios' || "$MR_PLAT" == 'tvos' ]];then diff --git a/do-install/main.sh b/do-install/main.sh index 9a1c70acd..880d6227a 100755 --- a/do-install/main.sh +++ b/do-install/main.sh @@ -64,10 +64,6 @@ function install_libs() fi echo "====================================" done - - if [[ ! "$FORCE_XCFRAMEWORK" ]];then - ./correct-pc.sh "$MR_WORKSPACE/product/$MR_PLAT" - fi } if [[ -n $MR_PC_FILE_DIR ]];then From cebfcf5dae15507c768076fafd398e57921350b4 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Sat, 9 May 2026 16:21:23 +0800 Subject: [PATCH 319/359] replace arch to universal firstly --- do-install/correct-pc.sh | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/do-install/correct-pc.sh b/do-install/correct-pc.sh index 629b47649..3c24cab9b 100755 --- a/do-install/correct-pc.sh +++ b/do-install/correct-pc.sh @@ -34,16 +34,6 @@ function correct_pc_file(){ local include_dir="${base_dir}/include" local bin_dir="${base_dir}/bin" - # 全局替换 prefix= 开头后面的内容 - old_base=$(sed -n 's/^prefix=//p' "$pc") - my_sed_i "s|$old_base|$base_dir|g" "$pc" - - # 具有局限性,比如 includedir=/Users/matt/GitWorkspace/fsplayer/FFToolChain/build/product/ios/universal-simulator/bluray - # my_sed_i "s|^prefix=.*|prefix=$base_dir|" "$pc" - # my_sed_i "s|^exec_prefix=[^$].*|exec_prefix=$bin_dir|" $pc - # my_sed_i "s|^libdir=[^$].*|libdir=$lib_dir|" "$pc" - # my_sed_i "s|^includedir=[^$].*include|includedir=$include_dir|" "$pc" - # fix absolute path which contains arch suffix bug,such as /path/to/opus-arch/lib #-L/Users/runner/work/MRFFToolChainBuildShell/MRFFToolChainBuildShell/build/product/macos/opus-arch/lib #-> @@ -57,6 +47,18 @@ function correct_pc_file(){ my_sed_i "s|\([^/]*\)-arm64[^/]*|universal/\1|g" "$pc" my_sed_i "s|\([^/]*\)-x86[^/]*|universal/\1|g" "$pc" + + # 全局替换 prefix= 开头后面的内容 + old_base=$(sed -n 's/^prefix=//p' "$pc") + my_sed_i "s|$old_base|$base_dir|g" "$pc" + + # 具有局限性,比如 includedir=/Users/matt/GitWorkspace/fsplayer/FFToolChain/build/product/ios/universal-simulator/bluray + # my_sed_i "s|^prefix=.*|prefix=$base_dir|" "$pc" + # my_sed_i "s|^exec_prefix=[^$].*|exec_prefix=$bin_dir|" $pc + # my_sed_i "s|^libdir=[^$].*|libdir=$lib_dir|" "$pc" + # my_sed_i "s|^includedir=[^$].*include|includedir=$include_dir|" "$pc" + + # Fix absolute paths to other internal dependencies # Pattern: -L/any/path/PRODUCT_NAME/PLATFORM/universal/LIB_NAME/lib From f505f8a2b3db4feaa805ea248ec30e5e10ed4e6c Mon Sep 17 00:00:00 2001 From: Anka Date: Sat, 9 May 2026 08:29:39 +0000 Subject: [PATCH 320/359] upgrade bluray to bluray-1.3.4-260509162704 for apple by cd --- configs/libs/bluray.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configs/libs/bluray.sh b/configs/libs/bluray.sh index b54cada1a..bb599a0a8 100644 --- a/configs/libs/bluray.sh +++ b/configs/libs/bluray.sh @@ -40,7 +40,7 @@ else fi # pre compiled -export PRE_COMPILE_TAG_TVOS=bluray-1.3.4-260408145206 -export PRE_COMPILE_TAG_MACOS=bluray-1.3.4-260408145206 -export PRE_COMPILE_TAG_IOS=bluray-1.3.4-260408145206 +export PRE_COMPILE_TAG_TVOS=bluray-1.3.4-260509162704 +export PRE_COMPILE_TAG_MACOS=bluray-1.3.4-260509162704 +export PRE_COMPILE_TAG_IOS=bluray-1.3.4-260509162704 export PRE_COMPILE_TAG_ANDROID=bluray-1.3.4-260408145206 From 6c88c2659635cc9f48b34875e41ab94f3a319101 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Sat, 9 May 2026 17:10:26 +0800 Subject: [PATCH 321/359] =?UTF-8?q?fix=20opus=E3=80=81bluray=20pc=20file?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- do-install/correct-pc.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/do-install/correct-pc.sh b/do-install/correct-pc.sh index 3c24cab9b..9080e9c9d 100755 --- a/do-install/correct-pc.sh +++ b/do-install/correct-pc.sh @@ -44,28 +44,28 @@ function correct_pc_file(){ # 2. 匹配 -(arm64|x86) -> 紧跟其后的架构标识 # 3. 匹配 [^/]* -> 架构后的剩余后缀(如 _simulator) # 4. 替换为 universal/\1 -> \1 就是第一对括号捕获到的 LIB_NAME + + my_sed_i "s|universal-simulator|universal|g" "$pc" my_sed_i "s|\([^/]*\)-arm64[^/]*|universal/\1|g" "$pc" my_sed_i "s|\([^/]*\)-x86[^/]*|universal/\1|g" "$pc" # 全局替换 prefix= 开头后面的内容 old_base=$(sed -n 's/^prefix=//p' "$pc") my_sed_i "s|$old_base|$base_dir|g" "$pc" - + # 具有局限性,比如 includedir=/Users/matt/GitWorkspace/fsplayer/FFToolChain/build/product/ios/universal-simulator/bluray # my_sed_i "s|^prefix=.*|prefix=$base_dir|" "$pc" # my_sed_i "s|^exec_prefix=[^$].*|exec_prefix=$bin_dir|" $pc # my_sed_i "s|^libdir=[^$].*|libdir=$lib_dir|" "$pc" # my_sed_i "s|^includedir=[^$].*include|includedir=$include_dir|" "$pc" - - # Fix absolute paths to other internal dependencies # Pattern: -L/any/path/PRODUCT_NAME/PLATFORM/universal/LIB_NAME/lib # We want to replace the "/any/path/PRODUCT_NAME/PLATFORM" part with the local equivalent. # Since we know the local product root is the parent of 'universal', we can use that. - - local product_root=$(cd "$fix_path"; pwd) + # base_dir is lib folder, we need to go up two levels to get to product root,eg: ios + local product_root=$(cd "$base_dir";cd ..;cd ..;pwd) # escaped for sed local escaped_root=$(echo "$product_root" | sed 's/\//\\\//g') From 4913c0c4079aafb92f5d81651a67a6f073a84331 Mon Sep 17 00:00:00 2001 From: Anka Date: Sat, 9 May 2026 09:37:11 +0000 Subject: [PATCH 322/359] upgrade ffmpeg8 to ffmpeg8-8.1.1-260509171248 for apple by cd --- configs/libs/ffmpeg8.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/configs/libs/ffmpeg8.sh b/configs/libs/ffmpeg8.sh index 2edfb670a..373a5b695 100644 --- a/configs/libs/ffmpeg8.sh +++ b/configs/libs/ffmpeg8.sh @@ -36,3 +36,6 @@ fi # pre compiled +export PRE_COMPILE_TAG_IOS=ffmpeg8-8.1.1-260509171248 +export PRE_COMPILE_TAG_MACOS=ffmpeg8-8.1.1-260509171248 +export PRE_COMPILE_TAG_TVOS=ffmpeg8-8.1.1-260509171248 From d87f9a4b2cd6e662b0aa58fdcac9062d1ebba474 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Mon, 11 May 2026 17:36:06 +0800 Subject: [PATCH 323/359] init cmd support apply pro suffix patches --- README.md | 2 +- do-init/init-repo.sh | 25 ++++++++++++++----------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index b0def8b91..14a1d045c 100644 --- a/README.md +++ b/README.md @@ -157,5 +157,5 @@ If cloning repositories from GitHub is slow, or if you need to use an internal p - To download pre-compiled xcframework libraries, add the --fmwk parameter when using the install command. - To skip pulling remote repositories during initialization, add the --skip-pull-base parameter when using the init command. - To skip applying FFmpeg patches during initialization, add the --skip-patches parameter when using the init command. -- Currently, FFmpeg uses the module-full.sh configuration, resulting in slightly larger package sizes. +- Currently, FFmpeg uses the **module-full.sh** configuration, resulting in slightly larger package sizes. - You can download all pre-compiled GitHub libraries to your own server and specify your server address using MR_DOWNLOAD_BASEURL before running the install command. diff --git a/do-init/init-repo.sh b/do-init/init-repo.sh index b8653b22f..cd0ef4522 100755 --- a/do-init/init-repo.sh +++ b/do-init/init-repo.sh @@ -76,24 +76,27 @@ function apply_patches() { return fi - local plat="$MR_PLAT" local patch_dir="${THIS_DIR}/../patches/$PATCH_DIR" - - if [[ -d "${patch_dir}_${plat}" ]]; then - patch_dir="${patch_dir}_${plat}" - fi - - if [[ -d "$patch_dir" ]]; then + local patch_dirs=( + "$patch_dir" + "${patch_dir}_${MR_PLAT}" + "${patch_dir}_pro" + ) + + for patch_dir in "${patch_dirs[@]}"; do + if [[ ! -d "$patch_dir" ]]; then + continue + fi + echo - echo "== Applying patches: $(basename $patch_dir) → $(basename $PWD) ==" - git am --whitespace=fix --keep $patch_dir/*.patch - if [[ $? -ne 0 ]]; then + echo "== Applying patches: $(basename "$patch_dir") → $(basename "$PWD") ==" + if ! git am --whitespace=fix --keep "$patch_dir"/*.patch; then echo 'Apply patches failed!' git am --skip exit 1 fi echo - fi + done } function make_arch_repo() { From d09cc3c10196974084db15bcfb15e6f1ce073f82 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Mon, 11 May 2026 18:22:57 +0800 Subject: [PATCH 324/359] rm unused soft link --- patches/ffmpeg | 1 - patches/smb2 | 1 - 2 files changed, 2 deletions(-) delete mode 120000 patches/ffmpeg delete mode 120000 patches/smb2 diff --git a/patches/ffmpeg b/patches/ffmpeg deleted file mode 120000 index 25fd4ffeb..000000000 --- a/patches/ffmpeg +++ /dev/null @@ -1 +0,0 @@ -ffmpeg-n7.1.1 \ No newline at end of file diff --git a/patches/smb2 b/patches/smb2 deleted file mode 120000 index 6ec51ed2f..000000000 --- a/patches/smb2 +++ /dev/null @@ -1 +0,0 @@ -smb2-6.2 \ No newline at end of file From 7b5514fec4c428259f2e5e12cbb5b718c85ca03e Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Mon, 11 May 2026 18:39:27 +0800 Subject: [PATCH 325/359] patch dir use - join suffix --- do-init/init-repo.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/do-init/init-repo.sh b/do-init/init-repo.sh index cd0ef4522..982f82f4b 100755 --- a/do-init/init-repo.sh +++ b/do-init/init-repo.sh @@ -79,8 +79,8 @@ function apply_patches() { local patch_dir="${THIS_DIR}/../patches/$PATCH_DIR" local patch_dirs=( "$patch_dir" - "${patch_dir}_${MR_PLAT}" - "${patch_dir}_pro" + "${patch_dir}-${MR_PLAT}" + "${patch_dir}-pro" ) for patch_dir in "${patch_dirs[@]}"; do From 0320bd8647ac0174270b3069207dc9b632dfb327 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Tue, 12 May 2026 14:34:09 +0800 Subject: [PATCH 326/359] review ffmpeg7.1.1 patches --- ...om-protocols-and-demuxers-except-lon.patch | 50 ++-- ...-add-4-dummy-ijkplaceholder-demuxers.patch | 36 +-- .../0009-add-3-dummy-ijkhttp-protocols.patch | 74 +----- ...er-and-Demuxer-but-av3a-Decoder-is-a.patch | 71 +++-- ...fs-for-network-Blu-ray-Disc-and-BDMV.patch | 251 +++++++++++------- ...find-the-right-m2ts-then-read-seek-i.patch | 21 +- ...add-webp-demuxer-and-libwebp-decoder.patch | 42 +-- 7 files changed, 281 insertions(+), 264 deletions(-) diff --git a/patches/ffmpeg-n7.1.1/0006-restore-ijk-custom-protocols-and-demuxers-except-lon.patch b/patches/ffmpeg-n7.1.1/0006-restore-ijk-custom-protocols-and-demuxers-except-lon.patch index 3be5228ee..8fd50fae3 100644 --- a/patches/ffmpeg-n7.1.1/0006-restore-ijk-custom-protocols-and-demuxers-except-lon.patch +++ b/patches/ffmpeg-n7.1.1/0006-restore-ijk-custom-protocols-and-demuxers-except-lon.patch @@ -1,23 +1,23 @@ -From a8dc36d3060372153fe0cc93b2a9af3a50271aba Mon Sep 17 00:00:00 2001 +From c106612677559c49d3560a502077128b468d011f Mon Sep 17 00:00:00 2001 From: qianlongxu -Date: Fri, 30 May 2025 09:15:11 +0800 -Subject: [PATCH] restore ijk custom protocols and demuxers except long url and - async +Date: Tue, 12 May 2026 09:42:01 +0800 +Subject: [PATCH] restore ijk custom protocols and demuxers except long url + and async --- libavcodec/Makefile | 1 + libavformat/Makefile | 10 ++++ - libavformat/allformats.c | 4 ++ + libavformat/allformats.c | 3 ++ libavformat/demux.c | 13 +++++ libavformat/demux.h | 2 + - libavformat/ijkutils.c | 102 +++++++++++++++++++++++++++++++++++++++ + libavformat/ijkutils.c | 107 +++++++++++++++++++++++++++++++++++++++ libavformat/protocols.c | 6 +++ libavutil/Makefile | 1 + - 8 files changed, 139 insertions(+) + 8 files changed, 143 insertions(+) create mode 100644 libavformat/ijkutils.c diff --git a/libavcodec/Makefile b/libavcodec/Makefile -index a4fcce3..ed5c705 100644 +index 153a9e3881..79903a108d 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -25,6 +25,7 @@ HEADERS = ac3_parser.h \ @@ -29,7 +29,7 @@ index a4fcce3..ed5c705 100644 OBJS = ac3_parser.o \ adts_parser.o \ diff --git a/libavformat/Makefile b/libavformat/Makefile -index e5934e9..5e88060 100644 +index e5934e9f9d..5e880602e7 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -7,6 +7,15 @@ HEADERS = avformat.h \ @@ -57,22 +57,21 @@ index e5934e9..5e88060 100644 OBJS-$(HAVE_LIBC_MSVCRT) += file_open.o diff --git a/libavformat/allformats.c b/libavformat/allformats.c -index 305fa46..063be70 100644 +index 305fa46532..e5fea1d021 100644 --- a/libavformat/allformats.c +++ b/libavformat/allformats.c -@@ -576,6 +576,10 @@ extern const FFInputFormat ff_libmodplug_demuxer; +@@ -576,6 +576,9 @@ extern const FFInputFormat ff_libmodplug_demuxer; extern const FFInputFormat ff_libopenmpt_demuxer; extern const FFInputFormat ff_vapoursynth_demuxer; -+// ijk -+extern AVInputFormat ff_ijklivehook_demuxer; -+extern AVInputFormat ff_ijklas_demuxer; ++// ijk custom demuxers ++extern FFInputFormat ff_ijklivehook_demuxer; + #include "libavformat/muxer_list.c" #include "libavformat/demuxer_list.c" diff --git a/libavformat/demux.c b/libavformat/demux.c -index 4fd22c4..ff62292 100644 +index 2796209239..ae0532b1d5 100644 --- a/libavformat/demux.c +++ b/libavformat/demux.c @@ -218,6 +218,7 @@ int avformat_open_input(AVFormatContext **ps, const char *filename, @@ -117,7 +116,7 @@ index 4fd22c4..ff62292 100644 avio_closep(&s->pb); avformat_free_context(s); diff --git a/libavformat/demux.h b/libavformat/demux.h -index 9c76095..8b0af4c 100644 +index 9c76095662..8b0af4c9fe 100644 --- a/libavformat/demux.h +++ b/libavformat/demux.h @@ -69,6 +69,8 @@ typedef struct FFInputFormat { @@ -131,10 +130,10 @@ index 9c76095..8b0af4c 100644 * set. 'avformat_new_stream' can be called only if the flag diff --git a/libavformat/ijkutils.c b/libavformat/ijkutils.c new file mode 100644 -index 0000000..42cc77c +index 0000000000..f85eae90c7 --- /dev/null +++ b/libavformat/ijkutils.c -@@ -0,0 +1,102 @@ +@@ -0,0 +1,107 @@ +/* + * utils.c + * @@ -196,6 +195,11 @@ index 0000000..42cc77c + return -1; +} + ++static int ijkdummy_probe(const AVProbeData *p) ++{ ++ return AVERROR_INVALIDDATA; ++} ++ +IJK_DUMMY_PROTOCOL(ijkmediadatasource); +IJK_DUMMY_PROTOCOL(ijkhttphook); +IJK_DUMMY_PROTOCOL(ijksegment); @@ -226,8 +230,9 @@ index 0000000..42cc77c +FFInputFormat ff_##x##_demuxer = { \ + .p.name = #x, \ + .p.priv_class = &ijk_##x##_demuxer_class, \ -+ .priv_data_size = 1, \ ++ .priv_data_size = 1, \ + .flags_internal = FF_INFMT_FLAG_INIT_CLEANUP, \ ++ .read_probe = ijkdummy_probe, \ +}; + +/* @@ -236,9 +241,8 @@ index 0000000..42cc77c + + */ +IJK_DUMMY_DEMUXER(ijklivehook); -+IJK_DUMMY_DEMUXER(ijklas); diff --git a/libavformat/protocols.c b/libavformat/protocols.c -index 93a6d67..719caf8 100644 +index 93a6d67261..719caf8492 100644 --- a/libavformat/protocols.c +++ b/libavformat/protocols.c @@ -79,6 +79,12 @@ extern const URLProtocol ff_libzmq_protocol; @@ -255,7 +259,7 @@ index 93a6d67..719caf8 100644 const AVClass *ff_urlcontext_child_class_iterate(void **iter) diff --git a/libavutil/Makefile b/libavutil/Makefile -index 6e6fa8d..5f47b20 100644 +index 6e6fa8d800..5f47b2074e 100644 --- a/libavutil/Makefile +++ b/libavutil/Makefile @@ -82,6 +82,7 @@ HEADERS = adler32.h \ @@ -267,5 +271,5 @@ index 6e6fa8d..5f47b20 100644 timecode.h \ timestamp.h \ -- -2.39.5 (Apple Git-154) +2.50.1 (Apple Git-155) diff --git a/patches/ffmpeg-n7.1.1/0008-add-4-dummy-ijkplaceholder-demuxers.patch b/patches/ffmpeg-n7.1.1/0008-add-4-dummy-ijkplaceholder-demuxers.patch index 7a635660f..453be0aa0 100644 --- a/patches/ffmpeg-n7.1.1/0008-add-4-dummy-ijkplaceholder-demuxers.patch +++ b/patches/ffmpeg-n7.1.1/0008-add-4-dummy-ijkplaceholder-demuxers.patch @@ -1,41 +1,41 @@ -From b5b783a51493598c60536cbaf65614f27c3f29dd Mon Sep 17 00:00:00 2001 +From cf2c1717314379bc6a5d483eda64a6db7126a42d Mon Sep 17 00:00:00 2001 From: qianlongxu -Date: Thu, 29 May 2025 11:03:35 +0800 +Date: Tue, 12 May 2026 09:45:35 +0800 Subject: [PATCH] add 4 dummy ijkplaceholder demuxers --- - libavformat/allformats.c | 5 +++++ + libavformat/allformats.c | 4 ++++ libavformat/ijkutils.c | 4 ++++ - 2 files changed, 9 insertions(+) + 2 files changed, 8 insertions(+) diff --git a/libavformat/allformats.c b/libavformat/allformats.c -index 063be70..dbae42e 100644 +index e5fea1d021..311b4358af 100644 --- a/libavformat/allformats.c +++ b/libavformat/allformats.c -@@ -580,6 +580,11 @@ extern const FFInputFormat ff_vapoursynth_demuxer; - extern AVInputFormat ff_ijklivehook_demuxer; - extern AVInputFormat ff_ijklas_demuxer; +@@ -578,6 +578,10 @@ extern const FFInputFormat ff_vapoursynth_demuxer; + + // ijk custom demuxers + extern FFInputFormat ff_ijklivehook_demuxer; ++extern FFInputFormat ff_ijkplaceholder1_demuxer; ++extern FFInputFormat ff_ijkplaceholder2_demuxer; ++extern FFInputFormat ff_ijkplaceholder3_demuxer; ++extern FFInputFormat ff_ijkplaceholder4_demuxer; -+extern AVInputFormat ff_ijkplaceholder1_demuxer; -+extern AVInputFormat ff_ijkplaceholder2_demuxer; -+extern AVInputFormat ff_ijkplaceholder3_demuxer; -+extern AVInputFormat ff_ijkplaceholder4_demuxer; -+ #include "libavformat/muxer_list.c" #include "libavformat/demuxer_list.c" - diff --git a/libavformat/ijkutils.c b/libavformat/ijkutils.c -index 107b238..0534757 100644 +index f85eae90c7..bc851d2914 100644 --- a/libavformat/ijkutils.c +++ b/libavformat/ijkutils.c -@@ -99,3 +99,7 @@ AVInputFormat ff_##x##_demuxer = { \ +@@ -105,3 +105,7 @@ FFInputFormat ff_##x##_demuxer = { \ + */ IJK_DUMMY_DEMUXER(ijklivehook); - IJK_DUMMY_DEMUXER(ijklas); +IJK_DUMMY_DEMUXER(ijkplaceholder1); +IJK_DUMMY_DEMUXER(ijkplaceholder2); +IJK_DUMMY_DEMUXER(ijkplaceholder3); +IJK_DUMMY_DEMUXER(ijkplaceholder4); +\ No newline at end of file -- -2.39.5 (Apple Git-154) +2.50.1 (Apple Git-155) diff --git a/patches/ffmpeg-n7.1.1/0009-add-3-dummy-ijkhttp-protocols.patch b/patches/ffmpeg-n7.1.1/0009-add-3-dummy-ijkhttp-protocols.patch index 1443067f7..ce3b4f7c9 100644 --- a/patches/ffmpeg-n7.1.1/0009-add-3-dummy-ijkhttp-protocols.patch +++ b/patches/ffmpeg-n7.1.1/0009-add-3-dummy-ijkhttp-protocols.patch @@ -1,53 +1,18 @@ -From 7393491965cf7d321c16cd8409de1e51956e6ff7 Mon Sep 17 00:00:00 2001 +From e294f9626d50ce1808253f0ba28c4a60e6c78f0e Mon Sep 17 00:00:00 2001 From: qianlongxu -Date: Thu, 11 Sep 2025 15:27:28 +0800 +Date: Tue, 12 May 2026 09:46:53 +0800 Subject: [PATCH] add 3 dummy ijkhttp protocols --- - libavformat/allformats.c | 14 +++++++------- - libavformat/ijkutils.c | 11 +++++++++++ - libavformat/protocols.c | 3 +++ - 3 files changed, 21 insertions(+), 7 deletions(-) + libavformat/ijkutils.c | 3 +++ + libavformat/protocols.c | 3 +++ + 2 files changed, 6 insertions(+) -diff --git a/libavformat/allformats.c b/libavformat/allformats.c -index dbae42e..31a9509 100644 ---- a/libavformat/allformats.c -+++ b/libavformat/allformats.c -@@ -576,14 +576,14 @@ extern const FFInputFormat ff_libmodplug_demuxer; - extern const FFInputFormat ff_libopenmpt_demuxer; - extern const FFInputFormat ff_vapoursynth_demuxer; - --// ijk --extern AVInputFormat ff_ijklivehook_demuxer; --extern AVInputFormat ff_ijklas_demuxer; -+// ijk custom demuxers -+extern FFInputFormat ff_ijklivehook_demuxer; -+extern FFInputFormat ff_ijklas_demuxer; - --extern AVInputFormat ff_ijkplaceholder1_demuxer; --extern AVInputFormat ff_ijkplaceholder2_demuxer; --extern AVInputFormat ff_ijkplaceholder3_demuxer; --extern AVInputFormat ff_ijkplaceholder4_demuxer; -+extern FFInputFormat ff_ijkplaceholder1_demuxer; -+extern FFInputFormat ff_ijkplaceholder2_demuxer; -+extern FFInputFormat ff_ijkplaceholder3_demuxer; -+extern FFInputFormat ff_ijkplaceholder4_demuxer; - - #include "libavformat/muxer_list.c" - #include "libavformat/demuxer_list.c" diff --git a/libavformat/ijkutils.c b/libavformat/ijkutils.c -index 604e725..ddecc30 100644 +index bc851d2914..31e1e8064b 100644 --- a/libavformat/ijkutils.c +++ b/libavformat/ijkutils.c -@@ -56,6 +56,7 @@ URLProtocol ff_##x##_protocol = { \ - - static int ijkdummy_open(URLContext *h, const char *arg, int flags, AVDictionary **options) - { -+ av_log(NULL, AV_LOG_ERROR, "you called a dummp protocol:%s\n", h->prot->name); - return -1; - } - -@@ -64,6 +65,9 @@ IJK_DUMMY_PROTOCOL(ijkhttphook); +@@ -69,6 +69,9 @@ IJK_DUMMY_PROTOCOL(ijkhttphook); IJK_DUMMY_PROTOCOL(ijksegment); IJK_DUMMY_PROTOCOL(ijktcphook); IJK_DUMMY_PROTOCOL(ijkio); @@ -57,29 +22,8 @@ index 604e725..ddecc30 100644 #define IJK_FF_DEMUXER(x) \ extern FFInputFormat ff_##x##_demuxer; \ -@@ -78,6 +82,12 @@ int ijkav_register_##x##_demuxer(FFInputFormat *demuxer, int demuxer_size) - return 0; \ - } - -+static int ijkdummy_probe(const AVProbeData *p) -+{ -+ av_log(NULL, AV_LOG_ERROR, "you called a dummp demuxer\n"); -+ return AVERROR_INVALIDDATA; -+} -+ - #define IJK_DUMMY_DEMUXER(x) \ - IJK_FF_DEMUXER(x); \ - static const AVClass ijk_##x##_demuxer_class = { \ -@@ -91,6 +101,7 @@ FFInputFormat ff_##x##_demuxer = { \ - .p.priv_class = &ijk_##x##_demuxer_class, \ - .priv_data_size = 1, \ - .flags_internal = FF_INFMT_FLAG_INIT_CLEANUP, \ -+ .read_probe = ijkdummy_probe, \ - }; - - /* diff --git a/libavformat/protocols.c b/libavformat/protocols.c -index 719caf8..b291b9f 100644 +index 719caf8492..b291b9f97c 100644 --- a/libavformat/protocols.c +++ b/libavformat/protocols.c @@ -84,6 +84,9 @@ extern const URLProtocol ff_ijkmediadatasource_protocol; @@ -93,5 +37,5 @@ index 719caf8..b291b9f 100644 #include "libavformat/protocol_list.c" -- -2.39.5 (Apple Git-154) +2.50.1 (Apple Git-155) diff --git a/patches/ffmpeg-n7.1.1/0020-Audio-Vivid-Parser-and-Demuxer-but-av3a-Decoder-is-a.patch b/patches/ffmpeg-n7.1.1/0020-Audio-Vivid-Parser-and-Demuxer-but-av3a-Decoder-is-a.patch index c25585560..e0be786b1 100644 --- a/patches/ffmpeg-n7.1.1/0020-Audio-Vivid-Parser-and-Demuxer-but-av3a-Decoder-is-a.patch +++ b/patches/ffmpeg-n7.1.1/0020-Audio-Vivid-Parser-and-Demuxer-but-av3a-Decoder-is-a.patch @@ -1,6 +1,6 @@ -From 1dddf06f8c49c6a1e362b492945cdd6bb5941c3b Mon Sep 17 00:00:00 2001 +From 110f494ac101540119bee647af782b9effe63b41 Mon Sep 17 00:00:00 2001 From: qianlongxu -Date: Tue, 20 Jan 2026 14:06:57 +0800 +Date: Tue, 12 May 2026 10:02:14 +0800 Subject: [PATCH] Audio Vivid Parser and Demuxer, but av3a Decoder is absent --- @@ -12,19 +12,19 @@ Subject: [PATCH] Audio Vivid Parser and Demuxer, but av3a Decoder is absent libavcodec/parsers.c | 1 + libavcodec/utils.c | 1 + libavformat/Makefile | 1 + - libavformat/allformats.c | 3 + + libavformat/allformats.c | 1 + libavformat/av3adec.c | 473 +++++++++++++++++++++++++++++++++++++++ libavformat/isom_tags.c | 1 + libavformat/mov.c | 135 +++++++++++ libavformat/mpegts.c | 6 + - libavformat/mpegts.h | 2 +- - 14 files changed, 1163 insertions(+), 1 deletion(-) + libavformat/mpegts.h | 1 + + 14 files changed, 1161 insertions(+) create mode 100644 libavcodec/av3a.h create mode 100644 libavcodec/av3a_parser.c create mode 100644 libavformat/av3adec.c diff --git a/libavcodec/Makefile b/libavcodec/Makefile -index ed5c705..03e80a2 100644 +index 79903a1..6db860f 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -1185,6 +1185,7 @@ OBJS-$(CONFIG_AMR_PARSER) += amr_parser.o @@ -581,12 +581,12 @@ index 0000000..a563b55 +}; \ No newline at end of file diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c -index d58c3d8..38cab26 100644 +index d58c3d8..a91c0b5 100644 --- a/libavcodec/codec_desc.c +++ b/libavcodec/codec_desc.c -@@ -3728,6 +3728,13 @@ static const AVCodecDescriptor codec_descriptors[] = { - .name = "anull", - .long_name = NULL_IF_CONFIG_SMALL("Null audio codec"), +@@ -3716,6 +3716,13 @@ static const AVCodecDescriptor codec_descriptors[] = { + .long_name = NULL_IF_CONFIG_SMALL("AVFrame to AVPacket passthrough"), + .props = AV_CODEC_PROP_LOSSLESS, }, + { + .id = AV_CODEC_ID_AVS3DA, @@ -595,21 +595,21 @@ index d58c3d8..38cab26 100644 + .long_name = NULL_IF_CONFIG_SMALL("Audio Vivid"), + .props = AV_CODEC_PROP_LOSSY, + }, - }; - - static int descriptor_compare(const void *key, const void *member) + { + .id = AV_CODEC_ID_VNULL, + .type = AVMEDIA_TYPE_VIDEO, diff --git a/libavcodec/codec_id.h b/libavcodec/codec_id.h -index 0a8d3be..8c724a0 100644 +index 0a8d3be..a95f400 100644 --- a/libavcodec/codec_id.h +++ b/libavcodec/codec_id.h -@@ -590,6 +590,7 @@ enum AVCodecID { - AV_CODEC_ID_BIN_DATA, - AV_CODEC_ID_SMPTE_2038, - AV_CODEC_ID_LCEVC, +@@ -600,6 +600,7 @@ enum AVCodecID { + * stream (only used by libavformat) */ + AV_CODEC_ID_FFMETADATA = 0x21000, ///< Dummy codec for streams containing only metadata information. + AV_CODEC_ID_WRAPPED_AVFRAME = 0x21001, ///< Passthrough codec, AVFrames wrapped in AVPacket + AV_CODEC_ID_AVS3DA, - - - AV_CODEC_ID_PROBE = 0x19000, ///< codec_id is not known (like AV_CODEC_ID_NONE) but lavf should attempt to identify it + /** + * Dummy null video codec, useful mainly for development and debugging. + * Null encoder/decoder discard all input and never return any output. diff --git a/libavcodec/parsers.c b/libavcodec/parsers.c index 5128009..ad49461 100644 --- a/libavcodec/parsers.c @@ -647,19 +647,17 @@ index 5e88060..ada27f6 100644 OBJS-$(CONFIG_BFI_DEMUXER) += bfi.o OBJS-$(CONFIG_BINK_DEMUXER) += bink.o diff --git a/libavformat/allformats.c b/libavformat/allformats.c -index 31a9509..a3553bb 100644 +index 311b435..9d7a98a 100644 --- a/libavformat/allformats.c +++ b/libavformat/allformats.c -@@ -576,6 +576,9 @@ extern const FFInputFormat ff_libmodplug_demuxer; - extern const FFInputFormat ff_libopenmpt_demuxer; - extern const FFInputFormat ff_vapoursynth_demuxer; - -+// custom AV3A demuxer +@@ -99,6 +99,7 @@ extern const FFInputFormat ff_avs2_demuxer; + extern const FFOutputFormat ff_avs2_muxer; + extern const FFInputFormat ff_avs3_demuxer; + extern const FFOutputFormat ff_avs3_muxer; +extern const FFInputFormat ff_av3a_demuxer; -+ - // ijk custom demuxers - extern FFInputFormat ff_ijklivehook_demuxer; - extern FFInputFormat ff_ijklas_demuxer; + extern const FFInputFormat ff_bethsoftvid_demuxer; + extern const FFInputFormat ff_bfi_demuxer; + extern const FFInputFormat ff_bintext_demuxer; diff --git a/libavformat/av3adec.c b/libavformat/av3adec.c new file mode 100644 index 0000000..9bb8729 @@ -1153,7 +1151,7 @@ index 5dd72d5..1c52d7c 100644 }; diff --git a/libavformat/mov.c b/libavformat/mov.c -index d9d7b80..51deb1a 100644 +index 495e2e7..486e2a3 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -69,6 +69,10 @@ @@ -1302,7 +1300,7 @@ index d9d7b80..51deb1a 100644 static int mov_metadata_track_or_disc_number(MOVContext *c, AVIOContext *pb, unsigned len, const char *key) { -@@ -9204,6 +9336,9 @@ static const MOVParseTableEntry mov_default_parse_table[] = { +@@ -9211,6 +9343,9 @@ static const MOVParseTableEntry mov_default_parse_table[] = { #if CONFIG_IAMFDEC { MKTAG('i','a','c','b'), mov_read_iacb }, #endif @@ -1337,14 +1335,13 @@ index 58b50cb..59039ed 100644 }; diff --git a/libavformat/mpegts.h b/libavformat/mpegts.h -index 14ae312..8a45eef 100644 +index 14ae312..fdef48a 100644 --- a/libavformat/mpegts.h +++ b/libavformat/mpegts.h -@@ -134,7 +134,7 @@ - #define STREAM_TYPE_VIDEO_AVS3 0xd4 +@@ -135,6 +135,7 @@ #define STREAM_TYPE_VIDEO_VC1 0xea #define STREAM_TYPE_VIDEO_DIRAC 0xd1 -- + +#define STREAM_TYPE_AUDIO_AV3A 0xd5 #define STREAM_TYPE_AUDIO_AC3 0x81 #define STREAM_TYPE_AUDIO_DTS 0x82 diff --git a/patches/ffmpeg-n7.1.1/0027-custom-bluray-fs-for-network-Blu-ray-Disc-and-BDMV.patch b/patches/ffmpeg-n7.1.1/0027-custom-bluray-fs-for-network-Blu-ray-Disc-and-BDMV.patch index 8e02b5182..d2694da81 100644 --- a/patches/ffmpeg-n7.1.1/0027-custom-bluray-fs-for-network-Blu-ray-Disc-and-BDMV.patch +++ b/patches/ffmpeg-n7.1.1/0027-custom-bluray-fs-for-network-Blu-ray-Disc-and-BDMV.patch @@ -1,22 +1,22 @@ -From a0019b9ae6f4f9e2722f63dee3fc71170aadc251 Mon Sep 17 00:00:00 2001 +From 19b58c47ccc043355572fdcbce8c359b6dfc1057 Mon Sep 17 00:00:00 2001 From: qianlongxu -Date: Thu, 29 May 2025 11:16:11 +0800 +Date: Tue, 12 May 2026 14:20:38 +0800 Subject: [PATCH] custom bluray fs for network Blu-ray Disc and BDMV --- libavformat/Makefile | 2 +- - libavformat/bluray.c | 118 +++++++++- - libavformat/bluray_custom_fs.c | 413 +++++++++++++++++++++++++++++++++ - libavformat/bluray_custom_fs.h | 29 +++ - 4 files changed, 553 insertions(+), 9 deletions(-) + libavformat/bluray.c | 128 ++++++++- + libavformat/bluray_custom_fs.c | 459 +++++++++++++++++++++++++++++++++ + libavformat/bluray_custom_fs.h | 33 +++ + 4 files changed, 610 insertions(+), 12 deletions(-) create mode 100644 libavformat/bluray_custom_fs.c create mode 100644 libavformat/bluray_custom_fs.h diff --git a/libavformat/Makefile b/libavformat/Makefile -index 17222ee..08dc08c 100644 +index e299e72..1f32e4c 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile -@@ -678,7 +678,7 @@ OBJS-$(CONFIG_VAPOURSYNTH_DEMUXER) += vapoursynth.o +@@ -679,7 +679,7 @@ OBJS-$(CONFIG_VAPOURSYNTH_DEMUXER) += vapoursynth.o OBJS-$(CONFIG_ANDROID_CONTENT_PROTOCOL) += file.o OBJS-$(CONFIG_ASYNC_PROTOCOL) += async.o OBJS-$(CONFIG_APPLEHTTP_PROTOCOL) += hlsproto.o @@ -26,7 +26,7 @@ index 17222ee..08dc08c 100644 OBJS-$(CONFIG_CONCAT_PROTOCOL) += concat.o OBJS-$(CONFIG_CONCATF_PROTOCOL) += concat.o diff --git a/libavformat/bluray.c b/libavformat/bluray.c -index 1845551..cd50523 100644 +index 1845551..eb43340 100644 --- a/libavformat/bluray.c +++ b/libavformat/bluray.c @@ -21,23 +21,27 @@ @@ -97,21 +97,22 @@ index 1845551..cd50523 100644 av_strstart(path, BLURAY_PROTO_PREFIX, &diskname); - bd->bd = bd_open(diskname, NULL); -+ fs_access *access = NULL; -+ +- if (!bd->bd) { + diskname = ff_urldecode(diskname, 0); + -+ if (av_strstart(diskname, "file://", NULL) || av_strstart(diskname, "/", NULL)) { -+ access = NULL; -+ } else { ++ fs_access *access = NULL; ++ int is_file = av_strstart(diskname, "file://", NULL) || av_strstart(diskname, "/", NULL); ++ ++ // file protocl can't handle AVIO_FLAG_DIRECT flag,so file not create custom access ++ if (!is_file) { + //set read packet buffer size is important! the default packet size is 32768, when use smb2 protocol, download speed is limited to 2MB; but when set the size to 1048576, download speed is 16MB; + h->max_packet_size = 1048576; -+ access = create_bluray_custom_access(diskname, options); ++ access = create_bluray_custom_access(diskname, options, &h->interrupt_callback); + } + + bd->bd = bd_open_fs(diskname, NULL, access); + - if (!bd->bd) { ++ if (!bd->bd || is_bluray_custom_access_cancelled(access)) { av_log(h, AV_LOG_ERROR, "bd_open() failed\n"); + if (access) { + destroy_bluray_custom_access(&access); @@ -122,7 +123,17 @@ index 1845551..cd50523 100644 /* check if disc can be played */ if (check_disc_info(h) < 0) { -@@ -159,12 +198,13 @@ static int bluray_open(URLContext *h, const char *path, int flags) +@@ -150,6 +189,9 @@ static int bluray_open(URLContext *h, const char *path, int flags) + int i; + for (i = 0; i < num_title_idx; i++) { + BLURAY_TITLE_INFO *info = bd_get_title_info(bd->bd, i, 0); ++ if (!info) { ++ continue; ++ } + + av_log(h, AV_LOG_INFO, "playlist %05d.mpls (%d:%02d:%02d)\n", + info->playlist, +@@ -159,17 +201,19 @@ static int bluray_open(URLContext *h, const char *path, int flags) if (info->duration > duration) { bd->playlist = info->playlist; @@ -137,7 +148,15 @@ index 1845551..cd50523 100644 } /* select playlist */ -@@ -222,13 +262,75 @@ static int64_t bluray_seek(URLContext *h, int64_t pos, int whence) +- if (bd_select_playlist(bd->bd, bd->playlist) <= 0) { +- av_log(h, AV_LOG_ERROR, "bd_select_playlist(%05d.mpls) failed\n", bd->playlist); ++ if (bd->playlist >= 0 && bd_select_playlist(bd->bd, bd->playlist) <= 0) { ++ av_log(h, AV_LOG_ERROR, "bd_select_playlist(%05d.mpls) failed\n", ++ bd->playlist); + return AVERROR(EIO); + } + +@@ -222,13 +266,75 @@ static int64_t bluray_seek(URLContext *h, int64_t pos, int whence) return AVERROR(EINVAL); } @@ -216,10 +235,10 @@ index 1845551..cd50523 100644 }; diff --git a/libavformat/bluray_custom_fs.c b/libavformat/bluray_custom_fs.c new file mode 100644 -index 0000000..bdf2451 +index 0000000..8a8f377 --- /dev/null +++ b/libavformat/bluray_custom_fs.c -@@ -0,0 +1,413 @@ +@@ -0,0 +1,459 @@ +// +// bluray_custom_fs_smb2.c +// @@ -256,20 +275,19 @@ index 0000000..bdf2451 + URLContext *url_context; + int64_t offset; + AVApplicationContext *app_ctx; ++ int64_t last_read; +} ff_builtin_io; + +typedef struct ff_bluray_access { + const char *url; + AVDictionary *opts; + ff_builtin_io *io; ++ const AVIOInterruptCB *int_cb; ++ int cancel; +} ff_bluray_access; + -+static int interrupt_cb(void *ctx) ++static void close_builtin_io(ff_builtin_io *io) +{ -+ return 0; -+} -+ -+static void close_builtin_io(ff_builtin_io *io) { + if (!io) { + return; + } @@ -278,31 +296,37 @@ index 0000000..bdf2451 + } +} + -+static int create_builtin_io(ff_builtin_io **io, const char *url, AVDictionary **opts, int is_dir) ++static int create_builtin_io(ff_builtin_io **io, const char *url, ++ AVDictionary **opts, int is_dir, ++ const AVIOInterruptCB *int_cb) +{ + if (!io) { + return -1; + } + -+ ff_builtin_io * app = av_mallocz(sizeof(ff_builtin_io)); ++ ff_builtin_io *app = av_mallocz(sizeof(ff_builtin_io)); + if (!app) { + return -2; + } + -+ char *protocol_whitelist = NULL; ++ const char *protocol_whitelist = NULL; + + if (opts) { + const AVDictionary *dict = *opts; + -+ if (!av_strstart(url, "http", NULL) && !av_strstart(url, "smb2", NULL)) { -+ AVDictionaryEntry *app_dict = av_dict_get(dict, "ijkapplication", NULL, 0); ++ if (!av_strstart(url, "http", NULL) && ++ !av_strstart(url, "smb2", NULL)) { ++ AVDictionaryEntry *app_dict = ++ av_dict_get(dict, "ijkapplication", NULL, 0); + if (app_dict) { -+ app->app_ctx = (AVApplicationContext *)av_dict_strtoptr(app_dict->value); ++ app->app_ctx = ++ (AVApplicationContext *)av_dict_strtoptr(app_dict->value); + av_application_will_http_open(app->app_ctx, NULL, url); + } + } + -+ AVDictionaryEntry *proto_dict = av_dict_get(dict, "protocol_whitelist", NULL, 0); ++ AVDictionaryEntry *proto_dict = ++ av_dict_get(dict, "protocol_whitelist", NULL, 0); + if (proto_dict) { + protocol_whitelist = av_strdup(proto_dict->value); + } @@ -312,23 +336,17 @@ index 0000000..bdf2451 + protocol_whitelist = "ijkio,ijkhttphook,http,tcp,https,tls,file,smb2"; + } + -+ AVIOInterruptCB cb = {&interrupt_cb, app}; + int flags = AVIO_FLAG_READ; + if (is_dir) { + flags |= AVIO_FLAG_DIRECT; + } + -+ int ret = ffurl_open_whitelist(&app->url_context, -+ url, -+ flags, -+ &cb, -+ opts, -+ protocol_whitelist, -+ NULL, -+ NULL); -+ -+ av_application_did_http_open(app->app_ctx, (void*)app->url_context, url, ret < 0 ? AVERROR(errno) : 0, ret < 0 ? 500 : 200, 0); ++ int ret = ffurl_open_whitelist(&app->url_context, url, flags, int_cb, opts, ++ protocol_whitelist, NULL, NULL); + ++ av_application_did_http_open(app->app_ctx, (void *)app->url_context, url, ++ ret < 0 ? AVERROR(errno) : 0, ++ ret < 0 ? 500 : 200, 0); + if (ret < 0) { + close_builtin_io(app); + av_freep(&app); @@ -344,23 +362,39 @@ index 0000000..bdf2451 + } + + if (io->offset == offset && origin == SEEK_SET) { ++ io->last_read = offset; + return offset; + } + -+ av_application_will_http_seek(io->app_ctx, (void*)io->url_context, io->url_context->filename, offset); ++ av_application_will_http_seek(io->app_ctx, (void *)io->url_context, ++ io->url_context->filename, offset); + -+ int64_t pos = io->url_context->prot->url_seek(io->url_context, offset, origin); ++ int64_t pos = ++ io->url_context->prot->url_seek(io->url_context, offset, origin); + if (pos < 0) { -+ av_application_did_http_seek(io->app_ctx, (void*)io->url_context, io->url_context->filename, offset, AVERROR(errno), 500); ++ av_application_did_http_seek(io->app_ctx, (void *)io->url_context, ++ io->url_context->filename, offset, ++ AVERROR(errno), 500); + return AVERROR(errno); + } ++ io->last_read = pos; + io->offset = pos; -+ -+ av_application_did_http_seek(io->app_ctx, (void*)io->url_context, io->url_context->filename, offset, 0, 200); ++ av_application_did_http_seek(io->app_ctx, (void *)io->url_context, ++ io->url_context->filename, offset, 0, 200); + return pos; +} + -+static int read_builtin_io(ff_builtin_io *io, uint8_t *buf, int buf_size) ++static int write_builtin_io(ff_builtin_io *io, uint8_t *buf, int buf_size) ++{ ++ if (!io) { ++ return 0; ++ } ++ ++ return io->url_context->prot->url_write(io->url_context, buf, buf_size); ++} ++ ++static int read_builtin_io(ff_builtin_io *io, uint8_t *buf, int buf_size, ++ int64_t pos) +{ + if (!io) { + return 0; @@ -370,48 +404,52 @@ index 0000000..bdf2451 + int buf_size1 = buf_size; + int read = 0; + ++ seek_builtin_io(io, pos, SEEK_SET); ++ + while (buf_size1 > 0) { -+ read = io->url_context->prot->url_read(io->url_context, buf1, buf_size1); ++ read = ++ io->url_context->prot->url_read(io->url_context, buf1, buf_size1); + if (read <= 0) { -+ //maybe AVERROR_EOF ++ // maybe AVERROR_EOF + break; + } -+ + io->offset += read; + buf1 += read; + buf_size1 -= read; + } -+ ++ if (read == AVERROR_EXIT) { ++ return AVERROR_EXIT; ++ } + int bytes = buf_size - buf_size1; + if (bytes == 0 && read == AVERROR_EOF) { + return AVERROR_EOF; + } else { -+ av_application_did_io_tcp_read(io->app_ctx, (void*)io->url_context, bytes); ++ av_application_did_io_tcp_read(io->app_ctx, (void *)io->url_context, ++ bytes); + return bytes; + } +} + -+static int write_builtin_io(ff_builtin_io *io, uint8_t *buf, int buf_size) ++static int read_blocks(void *fs_handle, void *buf, int lba, int num_blocks) +{ -+ if (!io) { -+ return 0; ++ ff_bluray_access *access = fs_handle; ++ if (access->cancel == 1) { ++ return AVERROR_EXIT; + } + -+ return io->url_context->prot->url_write(io->url_context, buf, buf_size); -+} -+ -+static int read_blocks(void * fs_handle, void *buf, int lba, int num_blocks) -+{ -+ ff_bluray_access *access = fs_handle; + ff_builtin_io *io = access->io; + if (!io) { + return -1; + } + int got = -1; + int64_t pos = (int64_t)lba * UDF_BLOCK_SIZE; ++ int buf_size = num_blocks * UDF_BLOCK_SIZE; ++ int bytes = read_builtin_io(io, buf, buf_size, pos); ++ if (bytes == AVERROR_EXIT) { ++ access->cancel = 1; ++ return AVERROR_EXIT; ++ } + -+ seek_builtin_io(io, pos, SEEK_SET); -+ int bytes = read_builtin_io(io, (uint8_t*)buf, num_blocks * UDF_BLOCK_SIZE); + if (bytes > 0) { + got = (int)(bytes / UDF_BLOCK_SIZE); + } @@ -461,10 +499,17 @@ index 0000000..bdf2451 + if (!io) { + return -1; + } -+ return read_builtin_io(io, buf, size); ++ ++ int read = read_builtin_io(io, buf, size, io->last_read); ++ ++ if (read > 0) { ++ io->last_read += read; ++ } ++ ++ return read; +} + -+static int64_t _file_write(BD_FILE_H *file, const uint8_t *buf, int64_t size) ++static int64_t _file_write(BD_FILE_H *file, uint8_t *buf, int64_t size) +{ + if (size <= 0) { + return 0; @@ -492,15 +537,19 @@ index 0000000..bdf2451 + if (!io) { + return -1; + } -+ return seek_builtin_io(io, 0, SEEK_CUR); ++ return io->last_read; ++ // return seek_builtin_io(io, 0, SEEK_CUR); +} + -+static struct bd_file_s* open_file(void *fs_handle, const char *rel_path) ++static struct bd_file_s *open_file(void *fs_handle, const char *rel_path) +{ + ff_bluray_access *access = fs_handle; + -+ char *url = NULL; -+ url = av_append_path_component(access->url, rel_path); ++ if (access->cancel == 1) { ++ return NULL; ++ } ++ ++ const char *url = av_append_path_component(access->url, rel_path); + if (!url) { + return NULL; + } @@ -508,15 +557,16 @@ index 0000000..bdf2451 + av_dict_copy(&opts, access->opts, 0); + + ff_builtin_io *io = NULL; -+ int ret = create_builtin_io(&io, url, &opts, 0); ++ int ret = create_builtin_io(&io, url, &opts, 0, access->int_cb); + av_dict_free(&opts); -+ av_free(url); + + if (0 != ret) { -+ av_log(NULL, AV_LOG_ERROR, "can't open url %s,error:%s", url, av_err2str(ret)); ++ av_log(NULL, AV_LOG_ERROR, "[bluray] can't open %s,error:%s", url, ++ av_err2str(ret)); ++ av_free(url); + return NULL; + } -+ ++ av_free(url); + BD_FILE_H *file = av_malloc(sizeof(BD_FILE_H)); + if (!file) { + close_builtin_io(io); @@ -572,8 +622,11 @@ index 0000000..bdf2451 +{ + ff_bluray_access *access = fs_handle; + -+ char *url = NULL; -+ url = av_append_path_component(access->url, rel_path); ++ if (access->cancel == 1) { ++ return NULL; ++ } ++ ++ const char *url = av_append_path_component(access->url, rel_path); + if (!url) { + return NULL; + } @@ -581,15 +634,16 @@ index 0000000..bdf2451 + av_dict_copy(&opts, access->opts, 0); + + ff_builtin_io *io = NULL; -+ int ret = create_builtin_io(&io, url, &opts, 1); ++ int ret = create_builtin_io(&io, url, &opts, 1, access->int_cb); + av_dict_free(&opts); -+ av_free(url); -+ ++ + if (0 != ret) { -+ av_log(NULL, AV_LOG_ERROR, "can't open dir %s,error:%s", url, av_err2str(ret)); ++ av_log(NULL, AV_LOG_ERROR, "[bluray] can't open dir %s,error:%s", url, ++ av_err2str(ret)); ++ av_free(url); + return NULL; + } -+ ++ av_free(url); + BD_DIR_H *dir = av_malloc(sizeof(BD_DIR_H)); + if (!dir) { + close_builtin_io(io); @@ -604,6 +658,16 @@ index 0000000..bdf2451 + return dir; +} + ++int is_bluray_custom_access_cancelled(fs_access *access) ++{ ++ if (!access) { ++ return 0; ++ } ++ ++ ff_bluray_access *opaque = access->fs_handle; ++ return opaque->cancel; ++} ++ +// 构建fs_access结构体 +fs_access * create_bluray_custom_access(const char *url, AVDictionary **options) +{ @@ -617,10 +681,11 @@ index 0000000..bdf2451 + if (options) { + av_dict_copy(&opaque->opts, *options, 0); + } -+ -+ int ret = create_builtin_io(&opaque->io, url, options, 0); ++ opaque->int_cb = int_cb; ++ int ret = create_builtin_io(&opaque->io, url, options, 0, int_cb); + if (0 != ret) { -+ av_log(NULL, AV_LOG_ERROR, "can't open file %s,error:%s", url, av_err2str(ret)); ++ av_log(NULL, AV_LOG_ERROR, "[bluray] can't open file %s,error:%s", ++ url, av_err2str(ret)); + } + + fs_access *access = av_malloc(sizeof(fs_access)); @@ -633,12 +698,13 @@ index 0000000..bdf2451 + } + return NULL; +} +\ No newline at end of file diff --git a/libavformat/bluray_custom_fs.h b/libavformat/bluray_custom_fs.h new file mode 100644 -index 0000000..806fe29 +index 0000000..058d2da --- /dev/null +++ b/libavformat/bluray_custom_fs.h -@@ -0,0 +1,29 @@ +@@ -0,0 +1,33 @@ +// +// bluray_custom_fs.h +// @@ -665,9 +731,14 @@ index 0000000..806fe29 + +typedef struct fs_access fs_access; +typedef struct AVDictionary AVDictionary; ++typedef struct AVIOInterruptCB AVIOInterruptCB; ++ +void destroy_bluray_custom_access(fs_access **p); -+fs_access * create_bluray_custom_access(const char *url, AVDictionary **options); -+#endif /* bluray_custom_fs_smb2_h */ ++int is_bluray_custom_access_cancelled(fs_access *access); ++fs_access *create_bluray_custom_access(const char *url, AVDictionary **options, ++ const AVIOInterruptCB *int_cb); ++#endif /* bluray_custom_fs_h */ +\ No newline at end of file -- -2.39.5 (Apple Git-154) +2.50.1 (Apple Git-155) diff --git a/patches/ffmpeg-n7.1.1/0028-bluray-open-and-find-the-right-m2ts-then-read-seek-i.patch b/patches/ffmpeg-n7.1.1/0028-bluray-open-and-find-the-right-m2ts-then-read-seek-i.patch index 8ea78466d..a6591dfa4 100644 --- a/patches/ffmpeg-n7.1.1/0028-bluray-open-and-find-the-right-m2ts-then-read-seek-i.patch +++ b/patches/ffmpeg-n7.1.1/0028-bluray-open-and-find-the-right-m2ts-then-read-seek-i.patch @@ -1,15 +1,15 @@ -From 7346d485a6b495b6d46abc8b31ef7d2df56018ab Mon Sep 17 00:00:00 2001 +From 6e7abe54b59f8227df2c1149665b314cd2ac5892 Mon Sep 17 00:00:00 2001 From: qianlongxu -Date: Thu, 29 May 2025 11:16:41 +0800 -Subject: [PATCH] bluray open and find the right m2ts, then read\seek it +Date: Tue, 12 May 2026 11:45:56 +0800 +Subject: [PATCH] bluray open and find the right m2ts, then read/seek it direactly instread of bluray logic. --- - libavformat/bluray.c | 24 +++++++++++++++++++----- - 1 file changed, 19 insertions(+), 5 deletions(-) + libavformat/bluray.c | 25 ++++++++++++++++++++----- + 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/libavformat/bluray.c b/libavformat/bluray.c -index cd50523..465ea9b 100644 +index cd50523..7fdffdd 100644 --- a/libavformat/bluray.c +++ b/libavformat/bluray.c @@ -42,6 +42,7 @@ typedef struct { @@ -20,16 +20,17 @@ index cd50523..465ea9b 100644 } BlurayContext; #define OFFSET(x) offsetof(BlurayContext, x) -@@ -222,7 +223,7 @@ static int bluray_open(URLContext *h, const char *path, int flags, AVDictionary +@@ -222,7 +223,8 @@ static int bluray_open(URLContext *h, const char *path, int flags, AVDictionary if (bd->chapter > 1) { bd_seek_chapter(bd->bd, bd->chapter - 1); } - ++ /* will read ts soon */ + bd->stream_opened = 1; return 0; } -@@ -234,7 +235,13 @@ static int bluray_read(URLContext *h, unsigned char *buf, int size) +@@ -234,7 +236,13 @@ static int bluray_read(URLContext *h, unsigned char *buf, int size) if (!bd || !bd->bd) { return AVERROR(EFAULT); } @@ -44,7 +45,7 @@ index cd50523..465ea9b 100644 len = bd_read(bd->bd, buf, size); return len == 0 ? AVERROR_EOF : len; -@@ -252,10 +259,17 @@ static int64_t bluray_seek(URLContext *h, int64_t pos, int whence) +@@ -252,10 +260,17 @@ static int64_t bluray_seek(URLContext *h, int64_t pos, int whence) case SEEK_SET: case SEEK_CUR: case SEEK_END: @@ -66,5 +67,5 @@ index cd50523..465ea9b 100644 av_log(h, AV_LOG_ERROR, "Unsupported whence operation %d\n", whence); -- -2.39.5 (Apple Git-154) +2.50.1 (Apple Git-155) diff --git a/patches/ffmpeg-n7.1.1/0032-add-webp-demuxer-and-libwebp-decoder.patch b/patches/ffmpeg-n7.1.1/0032-add-webp-demuxer-and-libwebp-decoder.patch index 74a5772bb..7e1dc381c 100644 --- a/patches/ffmpeg-n7.1.1/0032-add-webp-demuxer-and-libwebp-decoder.patch +++ b/patches/ffmpeg-n7.1.1/0032-add-webp-demuxer-and-libwebp-decoder.patch @@ -1,6 +1,6 @@ -From ad3b9e537d7fba11e5d899c4987fd4e84ce9eb03 Mon Sep 17 00:00:00 2001 +From 7ff0d4ac7726a91ea3659dae6cea56c154a1172d Mon Sep 17 00:00:00 2001 From: qianlongxu -Date: Tue, 20 Jan 2026 11:48:50 +0800 +Date: Tue, 12 May 2026 10:06:39 +0800 Subject: [PATCH] add webp demuxer and libwebp decoder --- @@ -18,10 +18,10 @@ Subject: [PATCH] add webp demuxer and libwebp decoder create mode 100644 libavformat/webpdec.c diff --git a/configure b/configure -index 7daa9ff..fc5e423 100755 +index 0a4e28a..54493ff 100755 --- a/configure +++ b/configure -@@ -7044,7 +7044,12 @@ enabled libvpx && { +@@ -7065,7 +7065,12 @@ enabled libvpx && { enabled libvvenc && require_pkg_config libvvenc "libvvenc >= 1.6.1" "vvenc/vvenc.h" vvenc_get_version enabled libwebp && { enabled libwebp_encoder && require_pkg_config libwebp "libwebp >= 0.2.0" webp/encode.h WebPGetEncoderVersion @@ -36,7 +36,7 @@ index 7daa9ff..fc5e423 100755 require_cpp_condition libx264 x264.h "X264_BUILD >= 155" && { [ "$toolchain" != "msvc" ] || diff --git a/libavcodec/Makefile b/libavcodec/Makefile -index 03e80a2..441d4ee 100644 +index 6db860f..12ccbff 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -812,6 +812,7 @@ OBJS-$(CONFIG_WBMP_DECODER) += wbmpdec.o @@ -60,12 +60,12 @@ index aa0fc47..fa448b8 100644 /* audio codecs */ extern const FFCodec ff_aac_encoder; diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c -index 38cab26..9a56d7c 100644 +index a91c0b5..d1c4ed0 100644 --- a/libavcodec/codec_desc.c +++ b/libavcodec/codec_desc.c -@@ -1959,6 +1959,15 @@ static const AVCodecDescriptor codec_descriptors[] = { - .long_name = NULL_IF_CONFIG_SMALL("LEAD MCMP"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, +@@ -3723,6 +3723,15 @@ static const AVCodecDescriptor codec_descriptors[] = { + .long_name = NULL_IF_CONFIG_SMALL("Audio Vivid"), + .props = AV_CODEC_PROP_LOSSY, }, + { + .id = AV_CODEC_ID_LIBWEBP, @@ -76,21 +76,21 @@ index 38cab26..9a56d7c 100644 + AV_CODEC_PROP_LOSSLESS, + .mime_types= MT("image/webp"), + }, - - /* various PCM "codecs" */ { + .id = AV_CODEC_ID_VNULL, + .type = AVMEDIA_TYPE_VIDEO, diff --git a/libavcodec/codec_id.h b/libavcodec/codec_id.h -index 8c724a0..b0a9274 100644 +index a95f400..aff41f6 100644 --- a/libavcodec/codec_id.h +++ b/libavcodec/codec_id.h -@@ -323,6 +323,7 @@ enum AVCodecID { - AV_CODEC_ID_VMIX, - AV_CODEC_ID_LEAD, - +@@ -601,6 +601,7 @@ enum AVCodecID { + AV_CODEC_ID_FFMETADATA = 0x21000, ///< Dummy codec for streams containing only metadata information. + AV_CODEC_ID_WRAPPED_AVFRAME = 0x21001, ///< Passthrough codec, AVFrames wrapped in AVPacket + AV_CODEC_ID_AVS3DA, + AV_CODEC_ID_LIBWEBP, - /* various PCM "codecs" */ - AV_CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs - AV_CODEC_ID_PCM_S16LE = 0x10000, + /** + * Dummy null video codec, useful mainly for development and debugging. + * Null encoder/decoder discard all input and never return any output. diff --git a/libavcodec/libwebpdec.c b/libavcodec/libwebpdec.c new file mode 100644 index 0000000..17b69d0 @@ -486,10 +486,10 @@ index 1f32e4c..90aef47 100644 OBJS-$(CONFIG_WEBVTT_MUXER) += webvttenc.o OBJS-$(CONFIG_WSAUD_DEMUXER) += westwood_aud.o diff --git a/libavformat/allformats.c b/libavformat/allformats.c -index a3553bb..e10385f 100644 +index 9d7a98a..0a778a9 100644 --- a/libavformat/allformats.c +++ b/libavformat/allformats.c -@@ -564,6 +564,7 @@ extern const FFInputFormat ff_image_svg_pipe_demuxer; +@@ -565,6 +565,7 @@ extern const FFInputFormat ff_image_svg_pipe_demuxer; extern const FFInputFormat ff_image_sunrast_pipe_demuxer; extern const FFInputFormat ff_image_tiff_pipe_demuxer; extern const FFInputFormat ff_image_vbn_pipe_demuxer; From c36030256261923f0a6be033096b628fd4aac0a8 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Tue, 12 May 2026 15:41:01 +0800 Subject: [PATCH 327/359] init cmd support --smart-apply --- do-init/init-repo.sh | 77 +++++++++++++++++++++++++++++++++++++--- do-init/main.sh | 4 +-- main.sh | 6 ++-- tools/parse-arguments.sh | 9 +++-- 4 files changed, 83 insertions(+), 13 deletions(-) diff --git a/do-init/init-repo.sh b/do-init/init-repo.sh index 982f82f4b..5366763ec 100755 --- a/do-init/init-repo.sh +++ b/do-init/init-repo.sh @@ -21,6 +21,8 @@ set -e THIS_DIR=$(DIRNAME=$(dirname "$0"); cd "$DIRNAME"; pwd) cd "$THIS_DIR" +SMART_APPLY= + echo "=== [$0] check env begin===" env_assert "REPO_DIR" env_assert "GIT_COMMIT" @@ -65,6 +67,40 @@ function pull_common() { cd - >/dev/null } +# 用于合并ffmpeg的patch +apply_patch_smart() { + local patch_file=$1 + + if [ -z "$patch_file" ]; then + echo "Usage: apply_patch_smart " + return 1 + fi + + # 尝试静默执行 git am + if git am "$patch_file" > /dev/null 2>&1; then + echo "Successfully applied $(basename "$patch_file")" + else + echo "git am failed. Falling back to [git apply --reject]..." + + # 终止失败的 am 进程 + git am --abort + + # 尝试使用 --reject 强制应用 + if git apply --reject "$patch_file"; then + echo "----------------------------------------------------" + echo "Patch partially applied with --reject." + echo "Please check for .rej files and resolve them manually." + echo "----------------------------------------------------" + + # 列出生成的 .rej 文件提醒用户 + find . -name "*.rej" + else + echo "Error: [git apply --reject] also failed. Please check the patch file." + return 1 + fi + fi +} + function apply_patches() { if [[ "$SKIP_FFMPEG_PATHCHES" && $LIB_NAME == ffmpeg* ]]; then echo "⚠️ skip apply $REPO_DIR patches,because you set SKIP_FFMPEG_PATHCHES env." @@ -90,10 +126,19 @@ function apply_patches() { echo echo "== Applying patches: $(basename "$patch_dir") → $(basename "$PWD") ==" - if ! git am --whitespace=fix --keep "$patch_dir"/*.patch; then - echo 'Apply patches failed!' - git am --skip - exit 1 + if [[ "$SMART_APPLY" ]]; then + for patch_file in "$patch_dir"/*.patch; do + if ! apply_patch_smart "$patch_file"; then + echo "Apply patch failed: $patch_file" + exit 1 + fi + done + else + if ! git am --whitespace=fix --keep "$patch_dir"/*.patch; then + echo 'Apply patches failed!' + git am --skip + exit 1 + fi fi echo done @@ -118,7 +163,28 @@ function make_arch_repo() { function usage() { echo "usage:" - echo "$0 ios|macos|tvos|all [arm64|x86_64]" + echo "$0 ios|macos|tvos|all [arm64|x86_64] [--smart-apply]" + echo " --smart-apply apply patches with apply_patch_smart instead of git am" +} + +function parse_args() { + while [[ $# -gt 0 ]]; do + case "$1" in + --smart-apply) + SMART_APPLY=1 + ;; + -h | --help) + usage + exit 0 + ;; + --*) + echo "unknown option: $1" + usage + exit 1 + ;; + esac + shift + done } function main() { @@ -136,4 +202,5 @@ function main() { esac } +parse_args "$@" main diff --git a/do-init/main.sh b/do-init/main.sh index 7b065d5e7..6596aedb6 100755 --- a/do-init/main.sh +++ b/do-init/main.sh @@ -27,6 +27,6 @@ do echo "===[init $lib]===========" [[ ! -f "$MR_SHELL_CONFIGS_DIR/libs/${lib}.sh" ]] && (echo "❌$lib config not exist,init will stop.";exit 1;) source "$MR_SHELL_CONFIGS_DIR/libs/${lib}.sh" - ./init-repo.sh + ./init-repo.sh "$@" echo "=========================" -done \ No newline at end of file +done diff --git a/main.sh b/main.sh index e8a18d491..d5840a577 100755 --- a/main.sh +++ b/main.sh @@ -56,12 +56,12 @@ case $MR_PLAT in esac if [[ "$MR_ACTION" == "init" || "$MR_ACTION" == "install" ]];then - ./do-$MR_ACTION/main.sh "$@" + ./do-$MR_ACTION/main.sh "${MR_UNKNOWN_OPTIONS[@]}" else - ./do-$MR_ACTION/$plat/main.sh "$@" + ./do-$MR_ACTION/$plat/main.sh "${MR_UNKNOWN_OPTIONS[@]}" fi echo "---$MR_ACTION end-------------------------------" echo -elapsed \ No newline at end of file +elapsed diff --git a/tools/parse-arguments.sh b/tools/parse-arguments.sh index 15f43a8d5..39a845cce 100644 --- a/tools/parse-arguments.sh +++ b/tools/parse-arguments.sh @@ -22,7 +22,7 @@ function main_usage() cat << EOF usage: ./main.sh [options] -compile ijkplayer using libs for iOS、macOS、tvOS、Android platform, such as ass、ffmpeg... +compile fsplayer using libs for iOS、macOS、tvOS、Android platform, such as ass、ffmpeg... Commands: +help Show help banner of specified command @@ -47,6 +47,7 @@ OPTIONS: --help Show help banner of init command --skip-pull-base Skip pull base repo --skip-patches Skip apply FFmpeg patches + --smart-apply Apply patches with smart fallback EOF } @@ -124,6 +125,7 @@ libs= workspace= debug= pc_file_dir= +MR_UNKNOWN_OPTIONS=() case $1 in init | install) @@ -189,8 +191,8 @@ while [[ $# -gt 0 ]]; do shift pc_file_dir="$1" ;; - **) - echo "unkonwn option:$1" + *) + MR_UNKNOWN_OPTIONS+=("$1") ;; esac shift @@ -281,6 +283,7 @@ echo "MR_INIT_CFLAGS : [$MR_INIT_CFLAGS]" echo "SKIP_PULL_BASE : [$SKIP_PULL_BASE]" echo "SKIP_FFMPEG_PATHCHES : [$SKIP_FFMPEG_PATHCHES]" echo "MR_SKIP_MAKE_XCFRAMEWORK" : [$MR_SKIP_MAKE_XCFRAMEWORK] +[[ ${#MR_UNKNOWN_OPTIONS[@]} -gt 0 ]] && echo "MR_UNKNOWN_OPTIONS : [${MR_UNKNOWN_OPTIONS[*]}]" [[ -n $MR_PC_FILE_DIR ]] && echo "MR_PC_FILE_DIR : [$MR_PC_FILE_DIR]" unset platform cmd arch libs workspace debug action cflags pc_file_dir From c008fb6da0e0cbe3c7e1bd392b477b5401acd076 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Tue, 12 May 2026 16:15:43 +0800 Subject: [PATCH 328/359] install cmd drop --skip-fmwk and add --fmwk option --- .github/workflows/onestep.sh | 12 ++++++------ README.md | 4 ++-- do-compile/apple/any.sh | 6 +++--- tools/parse-arguments.sh | 8 ++++---- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/onestep.sh b/.github/workflows/onestep.sh index 2a5cf1f25..9d5ee0c29 100755 --- a/.github/workflows/onestep.sh +++ b/.github/workflows/onestep.sh @@ -51,9 +51,9 @@ function compile_ios_platform local log_file="$DIST_DIR/ios-compile-log-$RELEASE_VERSION.md" if [[ $VERBOSE ]];then - ./main.sh compile -p ios -c build -l ${LIB_NAME} --skip-fmwk 2>&1 | tee -a "$log_file" + ./main.sh compile -p ios -c build -l ${LIB_NAME} 2>&1 | tee -a "$log_file" else - ./main.sh compile -p ios -c build -l ${LIB_NAME} --skip-fmwk >> "$log_file" 2>&1 + ./main.sh compile -p ios -c build -l ${LIB_NAME} >> "$log_file" 2>&1 fi cd build/product/ios/universal @@ -71,9 +71,9 @@ function compile_macos_platform local log_file="$DIST_DIR/macos-compile-log-$RELEASE_VERSION.md" if [[ $VERBOSE ]];then - ./main.sh compile -p macos -c build -l ${LIB_NAME} --skip-fmwk 2>&1 | tee -a "$log_file" + ./main.sh compile -p macos -c build -l ${LIB_NAME} 2>&1 | tee -a "$log_file" else - ./main.sh compile -p macos -c build -l ${LIB_NAME} --skip-fmwk >> "$log_file" 2>&1 + ./main.sh compile -p macos -c build -l ${LIB_NAME} >> "$log_file" 2>&1 fi cd build/product/macos/universal @@ -88,9 +88,9 @@ function compile_tvos_platform local log_file="$DIST_DIR/android-compile-log-$RELEASE_VERSION.md" if [[ $VERBOSE ]];then - ./main.sh compile -p tvos -c build -l ${LIB_NAME} --skip-fmwk 2>&1 | tee -a "$log_file" + ./main.sh compile -p tvos -c build -l ${LIB_NAME} 2>&1 | tee -a "$log_file" else - ./main.sh compile -p tvos -c build -l ${LIB_NAME} --skip-fmwk >> "$log_file" 2>&1 + ./main.sh compile -p tvos -c build -l ${LIB_NAME} >> "$log_file" 2>&1 fi cd build/product/tvos/universal diff --git a/README.md b/README.md index 14a1d045c..345aee1ab 100644 --- a/README.md +++ b/README.md @@ -109,8 +109,8 @@ The following code demonstrates how to compile FFmpeg 7 for the iOS platform: ./main.sh install -p ios -l ffmpeg7 # other choice (you must know ffmpeg7's dependent lib name) ./main.sh install -p ios -l "openssl3 opus bluray dav1d dvdnav uavs3d smb2" -# Compile FFmpeg7 for the arm64 architecture on iOS -./main.sh compile -p ios -a arm64 -l ffmepg7 --skip-fmwk +# Compile FFmpeg7 for the arm64 architecture on iOS with xcframework +./main.sh compile -p ios -a arm64 -l ffmepg7 --fmwk ``` The order of these parameters does not matter; they can be arranged in any sequence. diff --git a/do-compile/apple/any.sh b/do-compile/apple/any.sh index 6e6d19999..2b4d2a633 100755 --- a/do-compile/apple/any.sh +++ b/do-compile/apple/any.sh @@ -106,11 +106,11 @@ do_lipo_all() { done echo '----------------------' - if [[ "$MR_SKIP_MAKE_XCFRAMEWORK" ]]; then - echo "⚠️ skip make xcframework" - else + if [[ "$MR_MAKE_XCFRAMEWORK" ]]; then echo '[*] make xcframework' do_make_xcframework + else + echo "⚠️ skip make xcframework" fi echo '----------------------' echo diff --git a/tools/parse-arguments.sh b/tools/parse-arguments.sh index 39a845cce..4a4342b9b 100644 --- a/tools/parse-arguments.sh +++ b/tools/parse-arguments.sh @@ -66,7 +66,7 @@ OPTIONS: -j Force number of cores to be used --help Show help banner of compile command --debug Enable debug mode (disable by default) - --skip-fmwk Skip make xcframework(apple platform only) + --fmwk Make xcframework(apple platform only) EOF } @@ -184,8 +184,8 @@ while [[ $# -gt 0 ]]; do --skip-ff-patches) export SKIP_FFMPEG_PATHCHES=1 ;; - --skip-fmwk) - export MR_SKIP_MAKE_XCFRAMEWORK=1 + --fmwk) + export MR_MAKE_XCFRAMEWORK=1 ;; -correct-pc) shift @@ -282,7 +282,7 @@ echo "MR_DEBUG : [$MR_DEBUG]" echo "MR_INIT_CFLAGS : [$MR_INIT_CFLAGS]" echo "SKIP_PULL_BASE : [$SKIP_PULL_BASE]" echo "SKIP_FFMPEG_PATHCHES : [$SKIP_FFMPEG_PATHCHES]" -echo "MR_SKIP_MAKE_XCFRAMEWORK" : [$MR_SKIP_MAKE_XCFRAMEWORK] +echo "MR_MAKE_XCFRAMEWORK" : [$MR_MAKE_XCFRAMEWORK] [[ ${#MR_UNKNOWN_OPTIONS[@]} -gt 0 ]] && echo "MR_UNKNOWN_OPTIONS : [${MR_UNKNOWN_OPTIONS[*]}]" [[ -n $MR_PC_FILE_DIR ]] && echo "MR_PC_FILE_DIR : [$MR_PC_FILE_DIR]" From 2ff25a6d227aa3a5851ef3ed7bd9150a1e2c2626 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Tue, 12 May 2026 16:28:16 +0800 Subject: [PATCH 329/359] fix use of undeclared identifier 'int_cb' --- ...m-bluray-fs-for-network-Blu-ray-Disc-and-BDMV.patch | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/patches/ffmpeg-n7.1.1/0027-custom-bluray-fs-for-network-Blu-ray-Disc-and-BDMV.patch b/patches/ffmpeg-n7.1.1/0027-custom-bluray-fs-for-network-Blu-ray-Disc-and-BDMV.patch index d2694da81..f0a7f70d1 100644 --- a/patches/ffmpeg-n7.1.1/0027-custom-bluray-fs-for-network-Blu-ray-Disc-and-BDMV.patch +++ b/patches/ffmpeg-n7.1.1/0027-custom-bluray-fs-for-network-Blu-ray-Disc-and-BDMV.patch @@ -1,6 +1,6 @@ -From 19b58c47ccc043355572fdcbce8c359b6dfc1057 Mon Sep 17 00:00:00 2001 +From 5582bd1c8aa667f9dc0ca6c14ffb916e7a666c0e Mon Sep 17 00:00:00 2001 From: qianlongxu -Date: Tue, 12 May 2026 14:20:38 +0800 +Date: Tue, 12 May 2026 16:26:37 +0800 Subject: [PATCH] custom bluray fs for network Blu-ray Disc and BDMV --- @@ -235,7 +235,7 @@ index 1845551..eb43340 100644 }; diff --git a/libavformat/bluray_custom_fs.c b/libavformat/bluray_custom_fs.c new file mode 100644 -index 0000000..8a8f377 +index 0000000..b82e0b2 --- /dev/null +++ b/libavformat/bluray_custom_fs.c @@ -0,0 +1,459 @@ @@ -636,7 +636,7 @@ index 0000000..8a8f377 + ff_builtin_io *io = NULL; + int ret = create_builtin_io(&io, url, &opts, 1, access->int_cb); + av_dict_free(&opts); -+ ++ + if (0 != ret) { + av_log(NULL, AV_LOG_ERROR, "[bluray] can't open dir %s,error:%s", url, + av_err2str(ret)); @@ -669,7 +669,7 @@ index 0000000..8a8f377 +} + +// 构建fs_access结构体 -+fs_access * create_bluray_custom_access(const char *url, AVDictionary **options) ++fs_access * create_bluray_custom_access(const char *url, AVDictionary **options, const AVIOInterruptCB *int_cb) +{ + ff_bluray_access * opaque = av_mallocz(sizeof(ff_bluray_access)); + if (!opaque) { From e08f425b6600ad6d4afbe6bfb33cd00ff3102d35 Mon Sep 17 00:00:00 2001 From: Anka Date: Tue, 12 May 2026 08:52:50 +0000 Subject: [PATCH 330/359] upgrade ffmpeg7 to ffmpeg7-7.1.3-260512163026 for apple by cd --- configs/libs/ffmpeg7.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configs/libs/ffmpeg7.sh b/configs/libs/ffmpeg7.sh index bf556acd3..4087d0094 100644 --- a/configs/libs/ffmpeg7.sh +++ b/configs/libs/ffmpeg7.sh @@ -37,8 +37,8 @@ export GIT_REPO_VERSION=7.1.3 # pre compiled -export PRE_COMPILE_TAG_TVOS=ffmpeg7-7.1.3-260317152736 -export PRE_COMPILE_TAG_MACOS=ffmpeg7-7.1.3-260317152736 -export PRE_COMPILE_TAG_IOS=ffmpeg7-7.1.3-260317152736 +export PRE_COMPILE_TAG_TVOS=ffmpeg7-7.1.3-260512163026 +export PRE_COMPILE_TAG_MACOS=ffmpeg7-7.1.3-260512163026 +export PRE_COMPILE_TAG_IOS=ffmpeg7-7.1.3-260512163026 export PRE_COMPILE_TAG_ANDROID=ffmpeg7-7.1.1-250606143631 From bd02f370dd7604693ff2b3ead85b50c4be7362f8 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Tue, 12 May 2026 16:52:18 +0800 Subject: [PATCH 331/359] clean unused option: --skip-patches --- README.md | 1 - README_zh-CN.md | 5 ++--- do-init/init-repo.sh | 6 +----- tools/parse-arguments.sh | 9 ++------- 4 files changed, 5 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 345aee1ab..42235d574 100644 --- a/README.md +++ b/README.md @@ -156,6 +156,5 @@ If cloning repositories from GitHub is slow, or if you need to use an internal p - To download pre-compiled xcframework libraries, add the --fmwk parameter when using the install command. - To skip pulling remote repositories during initialization, add the --skip-pull-base parameter when using the init command. -- To skip applying FFmpeg patches during initialization, add the --skip-patches parameter when using the init command. - Currently, FFmpeg uses the **module-full.sh** configuration, resulting in slightly larger package sizes. - You can download all pre-compiled GitHub libraries to your own server and specify your server address using MR_DOWNLOAD_BASEURL before running the install command. diff --git a/README_zh-CN.md b/README_zh-CN.md index e7634eb6a..fb7b0f403 100644 --- a/README_zh-CN.md +++ b/README_zh-CN.md @@ -112,8 +112,8 @@ MRFFToolChain 是一套成熟的编译工具,专门用来编译 iOS、macOS、 ./main.sh install -p ios -l ffmpeg7 # 另外一个选择,自己选择性地安装 FFmpeg7 的依赖库 ./main.sh install -p ios -l "openssl3 opus bluray dav1d dvdnav uavs3d smb2" -# 编译 iOS 平台 arm64 架构的 FFmpeg7,并且跳过生成 xcframework -./main.sh compile -p ios -a arm64 -l ffmepg7 --skip-fmwk +# 编译 iOS 平台 arm64 架构的 FFmpeg7,并且生成 xcframework +./main.sh compile -p ios -a arm64 -l ffmepg7 --fmwk ``` 这些参数的顺序无关紧要,可以按任意顺序排列。 @@ -159,6 +159,5 @@ MRFFToolChain 是一套成熟的编译工具,专门用来编译 iOS、macOS、 - 要下载预编译的 xcframework 库,使用 install 命令时添加 --fmwk 参数 - 初始化时要跳过拉取远程仓库,使用 init 命令时添加 --skip-pull-base 参数 -- 初始化时要跳过应用 FFmpeg 补丁,使用 init 命令时添加 --skip-patches 参数 - 目前 FFmpeg 使用 module-full.sh 配置,功能全但同时导致包体积略大 - 可以将所有预编译的 GitHub 库下载到自己的服务器,并在运行 install 命令前通过 MR\_DOWNLOAD\_BASEURL 指定你的服务器地址 diff --git a/do-init/init-repo.sh b/do-init/init-repo.sh index 5366763ec..05776294c 100755 --- a/do-init/init-repo.sh +++ b/do-init/init-repo.sh @@ -102,11 +102,7 @@ apply_patch_smart() { } function apply_patches() { - if [[ "$SKIP_FFMPEG_PATHCHES" && $LIB_NAME == ffmpeg* ]]; then - echo "⚠️ skip apply $REPO_DIR patches,because you set SKIP_FFMPEG_PATHCHES env." - return - fi - + if [[ -z "$PATCH_DIR" ]]; then echo "$REPO_DIR hasn't any patch" return diff --git a/tools/parse-arguments.sh b/tools/parse-arguments.sh index 4a4342b9b..082cdaec3 100644 --- a/tools/parse-arguments.sh +++ b/tools/parse-arguments.sh @@ -46,7 +46,6 @@ OPTIONS: -s Specify workspace dir --help Show help banner of init command --skip-pull-base Skip pull base repo - --skip-patches Skip apply FFmpeg patches --smart-apply Apply patches with smart fallback EOF } @@ -61,7 +60,7 @@ Compile libs, such as ass、ffmpeg... OPTIONS: -c Specify sub command (build,clean,rebuild) rebuild=clean+build, default is build -a Specify archs (x86_64,arm64,x86_64_simulator,arm64_simulator,all) all="x86_64,arm64,x86_64_simulator,arm64_simulator" - -l Specify which libs need 'cmd' (all|openssl|opus|bluray|dav1d|dvdread|freetype|fribidi|harfbuzz|unibreak|ass|ffmpeg), can't be nil + -l Specify which libs need 'cmd' (openssl|opus|bluray|dav1d|dvdread|freetype|fribidi|harfbuzz|unibreak|ass|ffmpeg), can't be nil -s Specify workspace dir -j Force number of cores to be used --help Show help banner of compile command @@ -79,7 +78,7 @@ Download and Install Pre-compile library to product dir OPTIONS: -p Specify platform (ios,macos,tvos), can't be nil - -l Specify which libs need 'cmd' (all|libyuv|openssl|opus|bluray|dav1d|dvdread|freetype|fribidi|harfbuzz|unibreak|ass|ffmpeg), can't be nil + -l Specify which libs need 'cmd' (libyuv|openssl|opus|bluray|dav1d|dvdread|freetype|fribidi|harfbuzz|unibreak|ass|ffmpeg), can't be nil -s Specify workspace dir -correct-pc Specify a path for correct the pc file prefix recursion --help Show intall help @@ -181,9 +180,6 @@ while [[ $# -gt 0 ]]; do --skip-pull-base) export SKIP_PULL_BASE=1 ;; - --skip-ff-patches) - export SKIP_FFMPEG_PATHCHES=1 - ;; --fmwk) export MR_MAKE_XCFRAMEWORK=1 ;; @@ -281,7 +277,6 @@ echo "MR_HOST_NPROC : [$MR_HOST_NPROC]" echo "MR_DEBUG : [$MR_DEBUG]" echo "MR_INIT_CFLAGS : [$MR_INIT_CFLAGS]" echo "SKIP_PULL_BASE : [$SKIP_PULL_BASE]" -echo "SKIP_FFMPEG_PATHCHES : [$SKIP_FFMPEG_PATHCHES]" echo "MR_MAKE_XCFRAMEWORK" : [$MR_MAKE_XCFRAMEWORK] [[ ${#MR_UNKNOWN_OPTIONS[@]} -gt 0 ]] && echo "MR_UNKNOWN_OPTIONS : [${MR_UNKNOWN_OPTIONS[*]}]" [[ -n $MR_PC_FILE_DIR ]] && echo "MR_PC_FILE_DIR : [$MR_PC_FILE_DIR]" From c278077d7d5b8099472c00221afb78e34e9c7f2c Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Tue, 12 May 2026 16:53:08 +0800 Subject: [PATCH 332/359] mv init cmd's option to init-repo.sh --- do-init/init-repo.sh | 12 ++++++------ tools/parse-arguments.sh | 6 +----- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/do-init/init-repo.sh b/do-init/init-repo.sh index 05776294c..3a7ec5f1d 100755 --- a/do-init/init-repo.sh +++ b/do-init/init-repo.sh @@ -157,15 +157,12 @@ function make_arch_repo() { cd - >/dev/null } -function usage() { - echo "usage:" - echo "$0 ios|macos|tvos|all [arm64|x86_64] [--smart-apply]" - echo " --smart-apply apply patches with apply_patch_smart instead of git am" -} - function parse_args() { while [[ $# -gt 0 ]]; do case "$1" in + --skip-pull-base) + SKIP_PULL_BASE=1 + ;; --smart-apply) SMART_APPLY=1 ;; @@ -199,4 +196,7 @@ function main() { } parse_args "$@" + +echo "SKIP_PULL_BASE : [$SKIP_PULL_BASE]" +echo "SMART_APPLY : [$SMART_APPLY]" main diff --git a/tools/parse-arguments.sh b/tools/parse-arguments.sh index 082cdaec3..cc394db81 100644 --- a/tools/parse-arguments.sh +++ b/tools/parse-arguments.sh @@ -46,7 +46,7 @@ OPTIONS: -s Specify workspace dir --help Show help banner of init command --skip-pull-base Skip pull base repo - --smart-apply Apply patches with smart fallback + --smart-apply Apply patches with git apply --reject instead of git am EOF } @@ -177,9 +177,6 @@ while [[ $# -gt 0 ]]; do --debug) export MR_DEBUG='debug' ;; - --skip-pull-base) - export SKIP_PULL_BASE=1 - ;; --fmwk) export MR_MAKE_XCFRAMEWORK=1 ;; @@ -276,7 +273,6 @@ echo "MR_ACTIVE_ARCHS : [$MR_ACTIVE_ARCHS]" echo "MR_HOST_NPROC : [$MR_HOST_NPROC]" echo "MR_DEBUG : [$MR_DEBUG]" echo "MR_INIT_CFLAGS : [$MR_INIT_CFLAGS]" -echo "SKIP_PULL_BASE : [$SKIP_PULL_BASE]" echo "MR_MAKE_XCFRAMEWORK" : [$MR_MAKE_XCFRAMEWORK] [[ ${#MR_UNKNOWN_OPTIONS[@]} -gt 0 ]] && echo "MR_UNKNOWN_OPTIONS : [${MR_UNKNOWN_OPTIONS[*]}]" [[ -n $MR_PC_FILE_DIR ]] && echo "MR_PC_FILE_DIR : [$MR_PC_FILE_DIR]" From 42b9600c47c733a2792b534c0bc15c3b72f1b8c4 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Tue, 12 May 2026 17:01:03 +0800 Subject: [PATCH 333/359] drop -correct-pc option --- do-init/init-repo.sh | 7 +------ do-install/main.sh | 6 +----- tools/parse-arguments.sh | 13 ++----------- 3 files changed, 4 insertions(+), 22 deletions(-) diff --git a/do-init/init-repo.sh b/do-init/init-repo.sh index 3a7ec5f1d..105a76019 100755 --- a/do-init/init-repo.sh +++ b/do-init/init-repo.sh @@ -166,13 +166,8 @@ function parse_args() { --smart-apply) SMART_APPLY=1 ;; - -h | --help) - usage - exit 0 - ;; - --*) + *) echo "unknown option: $1" - usage exit 1 ;; esac diff --git a/do-install/main.sh b/do-install/main.sh index 880d6227a..22338e739 100755 --- a/do-install/main.sh +++ b/do-install/main.sh @@ -66,8 +66,4 @@ function install_libs() done } -if [[ -n $MR_PC_FILE_DIR ]];then - ./correct-pc.sh "$MR_PC_FILE_DIR" -else - install_libs -fi +install_libs \ No newline at end of file diff --git a/tools/parse-arguments.sh b/tools/parse-arguments.sh index cc394db81..21feb7866 100644 --- a/tools/parse-arguments.sh +++ b/tools/parse-arguments.sh @@ -80,7 +80,6 @@ OPTIONS: -p Specify platform (ios,macos,tvos), can't be nil -l Specify which libs need 'cmd' (libyuv|openssl|opus|bluray|dav1d|dvdread|freetype|fribidi|harfbuzz|unibreak|ass|ffmpeg), can't be nil -s Specify workspace dir - -correct-pc Specify a path for correct the pc file prefix recursion --help Show intall help --fmwk Install xcframework bundle instead of .a EOF @@ -123,7 +122,6 @@ arch= libs= workspace= debug= -pc_file_dir= MR_UNKNOWN_OPTIONS=() case $1 in @@ -180,10 +178,6 @@ while [[ $# -gt 0 ]]; do --fmwk) export MR_MAKE_XCFRAMEWORK=1 ;; - -correct-pc) - shift - pc_file_dir="$1" - ;; *) MR_UNKNOWN_OPTIONS+=("$1") ;; @@ -202,9 +196,7 @@ if [[ "$platform" != 'ios' && "$platform" != 'macos' && "$platform" != 'tvos' && exit 1 fi -export MR_PC_FILE_DIR="$pc_file_dir" - -if [[ -z "$MR_PC_FILE_DIR" && -z "$libs" ]];then +if [[ -z "$libs" ]];then echo "libs can't be nil, use -l specify libs" exit 1 fi @@ -275,6 +267,5 @@ echo "MR_DEBUG : [$MR_DEBUG]" echo "MR_INIT_CFLAGS : [$MR_INIT_CFLAGS]" echo "MR_MAKE_XCFRAMEWORK" : [$MR_MAKE_XCFRAMEWORK] [[ ${#MR_UNKNOWN_OPTIONS[@]} -gt 0 ]] && echo "MR_UNKNOWN_OPTIONS : [${MR_UNKNOWN_OPTIONS[*]}]" -[[ -n $MR_PC_FILE_DIR ]] && echo "MR_PC_FILE_DIR : [$MR_PC_FILE_DIR]" -unset platform cmd arch libs workspace debug action cflags pc_file_dir +unset platform cmd arch libs workspace debug action cflags From 635216af7cb9a7f36930b753fa76ba3213c2b93e Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Tue, 12 May 2026 17:21:05 +0800 Subject: [PATCH 334/359] install cmd support -lib-config option --- do-init/init-repo.sh | 2 +- do-install/main.sh | 51 +++++++++++++++++++++++++++++++--------- tools/parse-arguments.sh | 3 ++- 3 files changed, 43 insertions(+), 13 deletions(-) diff --git a/do-init/init-repo.sh b/do-init/init-repo.sh index 105a76019..9b062a70b 100755 --- a/do-init/init-repo.sh +++ b/do-init/init-repo.sh @@ -168,7 +168,7 @@ function parse_args() { ;; *) echo "unknown option: $1" - exit 1 + sleep 2 ;; esac shift diff --git a/do-install/main.sh b/do-install/main.sh index 22338e739..45088f780 100755 --- a/do-install/main.sh +++ b/do-install/main.sh @@ -47,23 +47,52 @@ function parse_lib_config() { export LIB_NAME } +function do_install_a_lib() +{ + local lib_config="$1" + [[ ! -f "$lib_config" ]] && (echo "❌$lib_config config not exist,install will stop."; exit 1;) + + echo "===[install $lib_config]====================" + source "$lib_config" + parse_lib_config + if [[ $FORCE_XCFRAMEWORK ]];then + ./install-pre-xcf.sh + else + ./install-pre-lib.sh + fi + echo "====================================" +} + function install_libs() { # 循环安装所有的库 for lib in $MR_VENDOR_LIBS do - [[ ! -f "$MR_SHELL_CONFIGS_DIR/libs/${lib}.sh" ]] && (echo "❌$lib config not exist,install will stop.";exit 1;) - - echo "===[install $lib]====================" - source "$MR_SHELL_CONFIGS_DIR/libs/${lib}.sh" - parse_lib_config - if [[ $FORCE_XCFRAMEWORK ]];then - ./install-pre-xcf.sh - else - ./install-pre-lib.sh - fi - echo "====================================" + do_install_a_lib "$MR_SHELL_CONFIGS_DIR/libs/${lib}.sh" + done + + if [[ -n "$LIB_CONFIG_PATH" ]];then + echo + echo "install specific lib config : [$LIB_CONFIG_PATH]" + do_install_a_lib "$LIB_CONFIG_PATH" + fi +} + +function parse_args() { + while [[ $# -gt 0 ]]; do + case "$1" in + -lib-config) + shift + LIB_CONFIG_PATH="$1" + ;; + *) + echo "unknown option: $1" + sleep 2 + ;; + esac + shift done } +parse_args "$@" install_libs \ No newline at end of file diff --git a/tools/parse-arguments.sh b/tools/parse-arguments.sh index 21feb7866..abb2bfd8d 100644 --- a/tools/parse-arguments.sh +++ b/tools/parse-arguments.sh @@ -82,6 +82,7 @@ OPTIONS: -s Specify workspace dir --help Show intall help --fmwk Install xcframework bundle instead of .a + -lib-config Read library config from specified path,eg: -lib-path ~/matt/lib/ffmpeg.sh EOF } @@ -196,7 +197,7 @@ if [[ "$platform" != 'ios' && "$platform" != 'macos' && "$platform" != 'tvos' && exit 1 fi -if [[ -z "$libs" ]];then +if [[ -z "$libs" && "$action" != "install" ]];then echo "libs can't be nil, use -l specify libs" exit 1 fi From 460ef788eb7484ce0dc54def00bac839493daa52 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Tue, 12 May 2026 18:30:52 +0800 Subject: [PATCH 335/359] init cmd support -lib-config option --- do-init/init-repo.sh | 33 +++++-------------------- do-init/main.sh | 57 ++++++++++++++++++++++++++++++++++++++------ 2 files changed, 56 insertions(+), 34 deletions(-) diff --git a/do-init/init-repo.sh b/do-init/init-repo.sh index 9b062a70b..c5cb20a01 100755 --- a/do-init/init-repo.sh +++ b/do-init/init-repo.sh @@ -21,14 +21,15 @@ set -e THIS_DIR=$(DIRNAME=$(dirname "$0"); cd "$DIRNAME"; pwd) cd "$THIS_DIR" -SMART_APPLY= - echo "=== [$0] check env begin===" env_assert "REPO_DIR" env_assert "GIT_COMMIT" env_assert "GIT_LOCAL_REPO" env_assert "GIT_UPSTREAM" env_assert "MR_WORKSPACE" +env_assert "SKIP_PULL_BASE" +env_assert "SMART_APPLY" + echo "===check env end===" GIT_LOCAL_REPO="${MR_WORKSPACE}/${GIT_LOCAL_REPO}" @@ -46,13 +47,13 @@ function pull_common() { git remote add origin "$GIT_UPSTREAM" echo "force update origin to: $GIT_UPSTREAM" fi - if [[ "$SKIP_PULL_BASE" ]]; then + if [[ "$SKIP_PULL_BASE" == "1" ]]; then echo "⚠️ skip pull $REPO_DIR because you set SKIP_PULL_BASE env." else git fetch --all --tags fi else - if [[ "$SKIP_PULL_BASE" ]]; then + if [[ "$SKIP_PULL_BASE" == "1" ]]; then echo "== local repo $REPO_DIR not exist,must clone by net firstly. ==" echo "try:unset SKIP_PULL_BASE" exit -1 @@ -122,7 +123,7 @@ function apply_patches() { echo echo "== Applying patches: $(basename "$patch_dir") → $(basename "$PWD") ==" - if [[ "$SMART_APPLY" ]]; then + if [[ "$SMART_APPLY" == "1" ]]; then for patch_file in "$patch_dir"/*.patch; do if ! apply_patch_smart "$patch_file"; then echo "Apply patch failed: $patch_file" @@ -157,24 +158,6 @@ function make_arch_repo() { cd - >/dev/null } -function parse_args() { - while [[ $# -gt 0 ]]; do - case "$1" in - --skip-pull-base) - SKIP_PULL_BASE=1 - ;; - --smart-apply) - SMART_APPLY=1 - ;; - *) - echo "unknown option: $1" - sleep 2 - ;; - esac - shift - done -} - function main() { case "$MR_PLAT" in ios | macos | tvos | android) @@ -190,8 +173,4 @@ function main() { esac } -parse_args "$@" - -echo "SKIP_PULL_BASE : [$SKIP_PULL_BASE]" -echo "SMART_APPLY : [$SMART_APPLY]" main diff --git a/do-init/main.sh b/do-init/main.sh index 6596aedb6..1f8d31c3b 100755 --- a/do-init/main.sh +++ b/do-init/main.sh @@ -22,11 +22,54 @@ set -e THIS_DIR=$(DIRNAME=$(dirname "$0"); cd "$DIRNAME"; pwd) cd "$THIS_DIR" -for lib in $MR_VENDOR_LIBS -do - echo "===[init $lib]===========" - [[ ! -f "$MR_SHELL_CONFIGS_DIR/libs/${lib}.sh" ]] && (echo "❌$lib config not exist,init will stop.";exit 1;) - source "$MR_SHELL_CONFIGS_DIR/libs/${lib}.sh" - ./init-repo.sh "$@" +function parse_args() { + while [[ $# -gt 0 ]]; do + case "$1" in + --skip-pull-base) + SKIP_PULL_BASE=1 + ;; + --smart-apply) + SMART_APPLY=1 + ;; + -lib-config) + shift + LIB_CONFIG_PATH="$1" + ;; + *) + echo "unknown option: $1" + sleep 2 + ;; + esac + shift + done +} + +function do_init_a_lib() +{ + local lib_config="$1" + echo "===[init $lib_config]====================" + [[ ! -f "$lib_config" ]] && (echo "❌$lib_config config not exist,init will stop.";exit 1;) + source "$lib_config" + ./init-repo.sh echo "=========================" -done +} + +function main() { + + export SKIP_PULL_BASE=${SKIP_PULL_BASE:-0} + export SMART_APPLY=${SMART_APPLY:-0} + + for lib in $MR_VENDOR_LIBS + do + do_init_a_lib "$MR_SHELL_CONFIGS_DIR/libs/${lib}.sh" + done + + if [[ -n "$LIB_CONFIG_PATH" ]];then + echo + echo "init specific lib config : [$LIB_CONFIG_PATH]" + do_init_a_lib "$LIB_CONFIG_PATH" + fi +} + +parse_args "$@" +main \ No newline at end of file From aa8c3d55da36dcbc46b03b4435549bb1ca071ac0 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Tue, 12 May 2026 18:58:07 +0800 Subject: [PATCH 336/359] PATCH_DIR use relative path --- configs/libs/bluray.sh | 2 +- configs/libs/ffmpeg4.sh | 2 +- configs/libs/ffmpeg5.sh | 2 +- configs/libs/ffmpeg6.sh | 2 +- configs/libs/ffmpeg7.sh | 2 +- configs/libs/ffmpeg8.sh | 2 +- configs/libs/fftutorial.sh | 2 +- configs/libs/smb2.sh | 2 +- configs/libs/soundtouch.sh | 2 +- configs/libs/uavs3d.sh | 2 +- configs/libs/yuv.sh | 2 +- do-init/init-repo.sh | 9 ++++++--- do-init/main.sh | 1 + main.sh | 2 -- tools/parse-arguments.sh | 8 +++++++- 15 files changed, 25 insertions(+), 17 deletions(-) diff --git a/configs/libs/bluray.sh b/configs/libs/bluray.sh index bb599a0a8..0f6861fbb 100644 --- a/configs/libs/bluray.sh +++ b/configs/libs/bluray.sh @@ -30,7 +30,7 @@ export GIT_COMMIT=1.3.4 export GIT_WITH_SUBMODULE=1 export REPO_DIR=bluray export GIT_REPO_VERSION=1.3.4 -export PATCH_DIR=bluray +export PATCH_DIR=../../patches/bluray # you can export GIT_BLURAY_UPSTREAM=git@xx:yy/libbluray.git use your mirror if [[ "$GIT_BLURAY_UPSTREAM" != "" ]] ;then diff --git a/configs/libs/ffmpeg4.sh b/configs/libs/ffmpeg4.sh index 9f31471e0..90215e1b3 100644 --- a/configs/libs/ffmpeg4.sh +++ b/configs/libs/ffmpeg4.sh @@ -23,7 +23,7 @@ export LIPO_LIBS="libavcodec libavformat libavutil libswscale libswresample liba export LIB_DEPENDS_BIN="nasm pkg-config" export GIT_LOCAL_REPO=extra/ffmpeg export REPO_DIR=ffmpeg4 -export PATCH_DIR=ffmpeg-n4.0 +export PATCH_DIR=../../patches/ffmpeg-n4.0 # you can export GIT_FFMPEG_UPSTREAM=git@xx:yy/FFmpeg.git use your mirror if [[ "$GIT_FFMPEG_UPSTREAM" != "" ]] ;then diff --git a/configs/libs/ffmpeg5.sh b/configs/libs/ffmpeg5.sh index 6e0b9cfe0..697e44c19 100644 --- a/configs/libs/ffmpeg5.sh +++ b/configs/libs/ffmpeg5.sh @@ -23,7 +23,7 @@ export LIPO_LIBS="libavcodec libavformat libavutil libswscale libswresample liba export LIB_DEPENDS_BIN="nasm pkg-config" export GIT_LOCAL_REPO=extra/ffmpeg export REPO_DIR=ffmpeg5 -export PATCH_DIR=ffmpeg-n5.1 +export PATCH_DIR=../../patches/ffmpeg-n5.1 # you can export GIT_FFMPEG_UPSTREAM=git@xx:yy/FFmpeg.git use your mirror if [[ "$GIT_FFMPEG_UPSTREAM" != "" ]] ;then diff --git a/configs/libs/ffmpeg6.sh b/configs/libs/ffmpeg6.sh index d3c97fb58..9cbcb2031 100644 --- a/configs/libs/ffmpeg6.sh +++ b/configs/libs/ffmpeg6.sh @@ -23,7 +23,7 @@ export LIPO_LIBS="libavcodec libavformat libavutil libswscale libswresample liba export LIB_DEPENDS_BIN="nasm pkg-config" export GIT_LOCAL_REPO=extra/ffmpeg export REPO_DIR=ffmpeg6 -export PATCH_DIR=ffmpeg-n6.1 +export PATCH_DIR=../../patches/ffmpeg-n6.1 # you can export GIT_FFMPEG_UPSTREAM=git@xx:yy/FFmpeg.git use your mirror if [[ "$GIT_FFMPEG_UPSTREAM" != "" ]] ;then diff --git a/configs/libs/ffmpeg7.sh b/configs/libs/ffmpeg7.sh index 4087d0094..baae072e7 100644 --- a/configs/libs/ffmpeg7.sh +++ b/configs/libs/ffmpeg7.sh @@ -23,7 +23,7 @@ export LIPO_LIBS="libavcodec libavformat libavutil libswscale libswresample liba export LIB_DEPENDS_BIN="nasm pkg-config" export GIT_LOCAL_REPO=extra/ffmpeg export REPO_DIR=ffmpeg7 -export PATCH_DIR=ffmpeg-n7.1.1 +export PATCH_DIR=../../patches/ffmpeg-n7.1.1 # you can export GIT_FFMPEG_UPSTREAM=git@xx:yy/FFmpeg.git use your mirror if [[ "$GIT_FFMPEG_UPSTREAM" != "" ]] ;then diff --git a/configs/libs/ffmpeg8.sh b/configs/libs/ffmpeg8.sh index 373a5b695..e0c97527a 100644 --- a/configs/libs/ffmpeg8.sh +++ b/configs/libs/ffmpeg8.sh @@ -23,7 +23,7 @@ export LIPO_LIBS="libavcodec libavformat libavutil libswscale libswresample liba export LIB_DEPENDS_BIN="nasm pkg-config" export GIT_LOCAL_REPO=extra/ffmpeg export REPO_DIR=ffmpeg8 -export PATCH_DIR=ffmpeg-n8.1.1 +export PATCH_DIR=../../patches/ffmpeg-n8.1.1 export GIT_COMMIT=n8.1.1 export GIT_REPO_VERSION=8.1.1 diff --git a/configs/libs/fftutorial.sh b/configs/libs/fftutorial.sh index a0fb2d19c..02c822c88 100644 --- a/configs/libs/fftutorial.sh +++ b/configs/libs/fftutorial.sh @@ -23,7 +23,7 @@ export LIPO_LIBS="libavcodec libavformat libavutil libswscale libswresample" export LIB_DEPENDS_BIN="nasm pkg-config" export GIT_LOCAL_REPO=extra/ffmpeg export REPO_DIR=ffmpeg -export PATCH_DIR=fftutorial +export PATCH_DIR=../../patches/fftutorial # you can export GIT_FFMPEG_UPSTREAM=git@xx:yy/FFmpeg.git use your mirror if [[ "$GIT_FFMPEG_UPSTREAM" != "" ]] ;then diff --git a/configs/libs/smb2.sh b/configs/libs/smb2.sh index ae4e4313c..0ad213023 100644 --- a/configs/libs/smb2.sh +++ b/configs/libs/smb2.sh @@ -30,7 +30,7 @@ export GIT_LOCAL_REPO=extra/smb2 export GIT_COMMIT=libsmb2-6.2 export REPO_DIR=smb2 export GIT_REPO_VERSION=6.2 -export PATCH_DIR=smb2-6.2 +export PATCH_DIR=../../patches/smb2-6.2 # you can export GIT_SMB2_UPSTREAM=git@xx:yy/libsmb2.git use your mirror if [[ "$GIT_SMB2_UPSTREAM" != "" ]] ;then diff --git a/configs/libs/soundtouch.sh b/configs/libs/soundtouch.sh index 78518c44b..4d1c519f2 100644 --- a/configs/libs/soundtouch.sh +++ b/configs/libs/soundtouch.sh @@ -30,7 +30,7 @@ export GIT_LOCAL_REPO=extra/soundtouch export REPO_DIR=soundtouch export GIT_COMMIT=2.4.0 export GIT_REPO_VERSION=2.4.0 -export PATCH_DIR=soundtouch +export PATCH_DIR=../../patches/soundtouch # you can export GIT_SOUNDTOUCH_UPSTREAM=git@xx:yy/soundtouch.git use your mirror if [[ "$GIT_SOUNDTOUCH_UPSTREAM" != "" ]] ;then diff --git a/configs/libs/uavs3d.sh b/configs/libs/uavs3d.sh index 3dd2dc367..9ee7c2016 100644 --- a/configs/libs/uavs3d.sh +++ b/configs/libs/uavs3d.sh @@ -28,7 +28,7 @@ export GIT_LOCAL_REPO=extra/uavs3d export GIT_COMMIT=1fd0491 export REPO_DIR=uavs3d export GIT_REPO_VERSION=1.2.1 -export PATCH_DIR=uavs3d +export PATCH_DIR=../../patches/uavs3d # you can export GIT_UAVS3D_UPSTREAM=git@xx:yy/UAVS3D.git use your mirror if [[ "$GIT_UAVS3D_UPSTREAM" != "" ]] ;then diff --git a/configs/libs/yuv.sh b/configs/libs/yuv.sh index 34a610591..c324a7e36 100644 --- a/configs/libs/yuv.sh +++ b/configs/libs/yuv.sh @@ -35,7 +35,7 @@ export GIT_LOCAL_REPO=extra/yuv export GIT_COMMIT=f94b8cf7 export REPO_DIR=yuv export GIT_REPO_VERSION=main-f94b8cf7 -export PATCH_DIR=yuv +export PATCH_DIR=../../patches/yuv # you can export GIT_YUV_UPSTREAM=git@xx:yy/yuv.git use your mirror if [[ "$GIT_YUV_UPSTREAM" != "" ]] ;then diff --git a/do-init/init-repo.sh b/do-init/init-repo.sh index c5cb20a01..b797dff5b 100755 --- a/do-init/init-repo.sh +++ b/do-init/init-repo.sh @@ -29,13 +29,13 @@ env_assert "GIT_UPSTREAM" env_assert "MR_WORKSPACE" env_assert "SKIP_PULL_BASE" env_assert "SMART_APPLY" - +env_assert "MR_LIB_CONFIG_PATH" echo "===check env end===" GIT_LOCAL_REPO="${MR_WORKSPACE}/${GIT_LOCAL_REPO}" function pull_common() { - echo "== pull $REPO_DIR base ==" + if [[ -d "$GIT_LOCAL_REPO" ]]; then cd "$GIT_LOCAL_REPO" [[ -d .git/rebase-apply ]] && git am --skip @@ -50,6 +50,7 @@ function pull_common() { if [[ "$SKIP_PULL_BASE" == "1" ]]; then echo "⚠️ skip pull $REPO_DIR because you set SKIP_PULL_BASE env." else + echo "== pull $REPO_DIR base ==" git fetch --all --tags fi else @@ -109,7 +110,8 @@ function apply_patches() { return fi - local patch_dir="${THIS_DIR}/../patches/$PATCH_DIR" + local patch_base_dir=$(dirname "$MR_LIB_CONFIG_PATH") + local patch_dir="${patch_base_dir}/$PATCH_DIR" local patch_dirs=( "$patch_dir" "${patch_dir}-${MR_PLAT}" @@ -118,6 +120,7 @@ function apply_patches() { for patch_dir in "${patch_dirs[@]}"; do if [[ ! -d "$patch_dir" ]]; then + #echo "patch dir not exist: $patch_dir, skip." continue fi diff --git a/do-init/main.sh b/do-init/main.sh index 1f8d31c3b..61f598aec 100755 --- a/do-init/main.sh +++ b/do-init/main.sh @@ -50,6 +50,7 @@ function do_init_a_lib() echo "===[init $lib_config]====================" [[ ! -f "$lib_config" ]] && (echo "❌$lib_config config not exist,init will stop.";exit 1;) source "$lib_config" + export MR_LIB_CONFIG_PATH="$lib_config" ./init-repo.sh echo "=========================" } diff --git a/main.sh b/main.sh index d5840a577..8a3d6dc38 100755 --- a/main.sh +++ b/main.sh @@ -62,6 +62,4 @@ else fi echo "---$MR_ACTION end-------------------------------" -echo - elapsed diff --git a/tools/parse-arguments.sh b/tools/parse-arguments.sh index abb2bfd8d..db09632bf 100644 --- a/tools/parse-arguments.sh +++ b/tools/parse-arguments.sh @@ -47,6 +47,7 @@ OPTIONS: --help Show help banner of init command --skip-pull-base Skip pull base repo --smart-apply Apply patches with git apply --reject instead of git am + -lib-config Read library config from specified path,eg: -lib-path ~/matt/lib/ffmpeg.sh EOF } @@ -123,6 +124,7 @@ arch= libs= workspace= debug= +has_lib_config= MR_UNKNOWN_OPTIONS=() case $1 in @@ -179,6 +181,10 @@ while [[ $# -gt 0 ]]; do --fmwk) export MR_MAKE_XCFRAMEWORK=1 ;; + -lib-config) + MR_UNKNOWN_OPTIONS+=("$1") + has_lib_config=1 + ;; *) MR_UNKNOWN_OPTIONS+=("$1") ;; @@ -197,7 +203,7 @@ if [[ "$platform" != 'ios' && "$platform" != 'macos' && "$platform" != 'tvos' && exit 1 fi -if [[ -z "$libs" && "$action" != "install" ]];then +if [[ -z "$libs" && "$has_lib_config" != "1" ]];then echo "libs can't be nil, use -l specify libs" exit 1 fi From 67b757605ddf81880a1ca08eaacecbacc93745c2 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Thu, 14 May 2026 09:48:51 +0800 Subject: [PATCH 337/359] install cmd add -correct-pc feature --- do-install/main.sh | 12 +++++++++++- tools/parse-arguments.sh | 7 ++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/do-install/main.sh b/do-install/main.sh index 45088f780..95ca75244 100755 --- a/do-install/main.sh +++ b/do-install/main.sh @@ -85,6 +85,10 @@ function parse_args() { shift LIB_CONFIG_PATH="$1" ;; + -correct-pc) + shift + CORRECT_PC="$1" + ;; *) echo "unknown option: $1" sleep 2 @@ -95,4 +99,10 @@ function parse_args() { } parse_args "$@" -install_libs \ No newline at end of file + +if [[ -n "$CORRECT_PC" ]];then + echo "correct pc file : [$CORRECT_PC]" + ./correct-pc.sh "$CORRECT_PC" +else + install_libs +fi diff --git a/tools/parse-arguments.sh b/tools/parse-arguments.sh index db09632bf..fb6c494d9 100644 --- a/tools/parse-arguments.sh +++ b/tools/parse-arguments.sh @@ -84,6 +84,7 @@ OPTIONS: --help Show intall help --fmwk Install xcframework bundle instead of .a -lib-config Read library config from specified path,eg: -lib-path ~/matt/lib/ffmpeg.sh + -correct-pc Specify a path for correct the pc file prefix recursion EOF } @@ -185,6 +186,10 @@ while [[ $# -gt 0 ]]; do MR_UNKNOWN_OPTIONS+=("$1") has_lib_config=1 ;; + -correct-pc) + MR_UNKNOWN_OPTIONS+=("$1") + has_correct_pc=1 + ;; *) MR_UNKNOWN_OPTIONS+=("$1") ;; @@ -203,7 +208,7 @@ if [[ "$platform" != 'ios' && "$platform" != 'macos' && "$platform" != 'tvos' && exit 1 fi -if [[ -z "$libs" && "$has_lib_config" != "1" ]];then +if [[ -z "$libs" && "$has_lib_config" != "1" && "$has_correct_pc" != "1" ]];then echo "libs can't be nil, use -l specify libs" exit 1 fi From 28c65d0bed80301667737a596b1b1608d979aabc Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Thu, 14 May 2026 14:11:24 +0800 Subject: [PATCH 338/359] compile cmd support -lib-config option --- do-compile/apple/main.sh | 49 ++++++++++++++++++++++++++++++++++------ tools/parse-arguments.sh | 1 + 2 files changed, 43 insertions(+), 7 deletions(-) diff --git a/do-compile/apple/main.sh b/do-compile/apple/main.sh index 72bf2394f..e746d59be 100755 --- a/do-compile/apple/main.sh +++ b/do-compile/apple/main.sh @@ -22,14 +22,14 @@ set -e THIS_DIR=$(DIRNAME=$(dirname "$0"); cd "$DIRNAME"; pwd) cd "$THIS_DIR" -# 循环编译所有的库 -for lib in $MR_VENDOR_LIBS -do - [[ ! -f "$MR_SHELL_CONFIGS_DIR/libs/${lib}.sh" ]] && (echo "❌$lib config not exist, compile will stop.";exit 1;) +function do_compile_a_lib() +{ + local lib_config="$1" + [[ ! -f "$lib_config" ]] && (echo "❌$lib_config config not exist, compile will stop."; exit 1;) echo "===[$MR_CMD $lib]====================" - source "$MR_SHELL_CONFIGS_DIR/libs/${lib}.sh" - + source "$lib_config" + echo "LIB_NAME : [$LIB_NAME]" echo "GIT_COMMIT : [$GIT_COMMIT]" echo "LIPO_LIBS : [$LIPO_LIBS]" @@ -42,4 +42,39 @@ do echo fi echo "====================================" -done \ No newline at end of file +} + +function compile_libs() +{ + # 循环编译所有的库 + for lib in $MR_VENDOR_LIBS + do + do_compile_a_lib "$MR_SHELL_CONFIGS_DIR/libs/${lib}.sh" + done + + if [[ -n "$LIB_CONFIG_PATH" ]];then + echo + echo "install specific lib config : [$LIB_CONFIG_PATH]" + do_compile_a_lib "$LIB_CONFIG_PATH" + fi +} + +function parse_args() { + while [[ $# -gt 0 ]]; do + case "$1" in + -lib-config) + shift + LIB_CONFIG_PATH="$1" + ;; + *) + echo "unknown option: $1" + sleep 2 + ;; + esac + shift + done +} + +parse_args "$@" +echo "LIB_CONFIG_PATH:$LIB_CONFIG_PATH" +compile_libs \ No newline at end of file diff --git a/tools/parse-arguments.sh b/tools/parse-arguments.sh index fb6c494d9..c1cc9963d 100644 --- a/tools/parse-arguments.sh +++ b/tools/parse-arguments.sh @@ -64,6 +64,7 @@ OPTIONS: -l Specify which libs need 'cmd' (openssl|opus|bluray|dav1d|dvdread|freetype|fribidi|harfbuzz|unibreak|ass|ffmpeg), can't be nil -s Specify workspace dir -j Force number of cores to be used + -lib-config Read library config from specified path,eg: -lib-path ~/matt/lib/ffmpeg.sh --help Show help banner of compile command --debug Enable debug mode (disable by default) --fmwk Make xcframework(apple platform only) From 735304b61e21151b9b39e5dac0f6b50507dc6c09 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Thu, 14 May 2026 14:54:54 +0800 Subject: [PATCH 339/359] libavfilter depends libpostproc --- configs/libs/ffmpeg7.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/libs/ffmpeg7.sh b/configs/libs/ffmpeg7.sh index baae072e7..7520fbd40 100644 --- a/configs/libs/ffmpeg7.sh +++ b/configs/libs/ffmpeg7.sh @@ -19,7 +19,7 @@ # If you really want to compile without asm, configure with --disable-asm. export LIB_NAME='ffmpeg' -export LIPO_LIBS="libavcodec libavformat libavutil libswscale libswresample libavfilter libavdevice" +export LIPO_LIBS="libavcodec libavformat libavutil libswscale libswresample libavfilter libavdevice libpostproc" export LIB_DEPENDS_BIN="nasm pkg-config" export GIT_LOCAL_REPO=extra/ffmpeg export REPO_DIR=ffmpeg7 From a56dfebc032b5a171bc7c70d736b09f3d6e5e478 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Thu, 14 May 2026 15:14:45 +0800 Subject: [PATCH 340/359] export echo_env func --- do-init/init-repo.sh | 5 +++-- tools/parse-arguments.sh | 10 ++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/do-init/init-repo.sh b/do-init/init-repo.sh index b797dff5b..b50424e97 100755 --- a/do-init/init-repo.sh +++ b/do-init/init-repo.sh @@ -29,7 +29,8 @@ env_assert "GIT_UPSTREAM" env_assert "MR_WORKSPACE" env_assert "SKIP_PULL_BASE" env_assert "SMART_APPLY" -env_assert "MR_LIB_CONFIG_PATH" +echo_env "MR_LIB_CONFIG_PATH" +echo_env "PATCH_DIR" echo "===check env end===" GIT_LOCAL_REPO="${MR_WORKSPACE}/${GIT_LOCAL_REPO}" @@ -120,7 +121,7 @@ function apply_patches() { for patch_dir in "${patch_dirs[@]}"; do if [[ ! -d "$patch_dir" ]]; then - #echo "patch dir not exist: $patch_dir, skip." + echo "patch dir not exist: $patch_dir, skip." continue fi diff --git a/tools/parse-arguments.sh b/tools/parse-arguments.sh index c1cc9963d..3c1e33b49 100644 --- a/tools/parse-arguments.sh +++ b/tools/parse-arguments.sh @@ -112,7 +112,17 @@ function env_assert() fi } +function echo_env() +{ + name="$1" + value=$(eval echo "\$$name") + if [[ -n "$value" ]]; then + echo "$name : [${value}]" >&2 + fi +} + export -f env_assert +export -f echo_env function help() { From 3c32fb5d254bb295ddf54cd8e513d0094e4b63ee Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Fri, 15 May 2026 10:36:14 +0800 Subject: [PATCH 341/359] -lib-config option support relative path --- do-compile/apple/main.sh | 3 ++- do-init/init-repo.sh | 1 + do-init/main.sh | 6 ++++-- do-install/main.sh | 3 ++- tools/parse-arguments.sh | 11 +++++++++++ 5 files changed, 20 insertions(+), 4 deletions(-) diff --git a/do-compile/apple/main.sh b/do-compile/apple/main.sh index e746d59be..0ba1e9864 100755 --- a/do-compile/apple/main.sh +++ b/do-compile/apple/main.sh @@ -25,6 +25,7 @@ cd "$THIS_DIR" function do_compile_a_lib() { local lib_config="$1" + lib_config=$(make_absolute_path "$lib_config") [[ ! -f "$lib_config" ]] && (echo "❌$lib_config config not exist, compile will stop."; exit 1;) echo "===[$MR_CMD $lib]====================" @@ -49,7 +50,7 @@ function compile_libs() # 循环编译所有的库 for lib in $MR_VENDOR_LIBS do - do_compile_a_lib "$MR_SHELL_CONFIGS_DIR/libs/${lib}.sh" + do_compile_a_lib "configs/libs/${lib}.sh" done if [[ -n "$LIB_CONFIG_PATH" ]];then diff --git a/do-init/init-repo.sh b/do-init/init-repo.sh index b50424e97..2517f3ae7 100755 --- a/do-init/init-repo.sh +++ b/do-init/init-repo.sh @@ -113,6 +113,7 @@ function apply_patches() { local patch_base_dir=$(dirname "$MR_LIB_CONFIG_PATH") local patch_dir="${patch_base_dir}/$PATCH_DIR" + patch_dir=$(make_absolute_path "$patch_dir") local patch_dirs=( "$patch_dir" "${patch_dir}-${MR_PLAT}" diff --git a/do-init/main.sh b/do-init/main.sh index 61f598aec..d452306dc 100755 --- a/do-init/main.sh +++ b/do-init/main.sh @@ -46,7 +46,9 @@ function parse_args() { function do_init_a_lib() { - local lib_config="$1" + local lib_config="$1" + lib_config=$(make_absolute_path "$lib_config") + [[ ! -f "$lib_config" ]] && (echo "❌$lib_config config not exist,init will stop.";exit 1;) echo "===[init $lib_config]====================" [[ ! -f "$lib_config" ]] && (echo "❌$lib_config config not exist,init will stop.";exit 1;) source "$lib_config" @@ -62,7 +64,7 @@ function main() { for lib in $MR_VENDOR_LIBS do - do_init_a_lib "$MR_SHELL_CONFIGS_DIR/libs/${lib}.sh" + do_init_a_lib "configs/libs/${lib}.sh" done if [[ -n "$LIB_CONFIG_PATH" ]];then diff --git a/do-install/main.sh b/do-install/main.sh index 95ca75244..67a24aace 100755 --- a/do-install/main.sh +++ b/do-install/main.sh @@ -50,6 +50,7 @@ function parse_lib_config() { function do_install_a_lib() { local lib_config="$1" + lib_config=$(make_absolute_path "$lib_config") [[ ! -f "$lib_config" ]] && (echo "❌$lib_config config not exist,install will stop."; exit 1;) echo "===[install $lib_config]====================" @@ -68,7 +69,7 @@ function install_libs() # 循环安装所有的库 for lib in $MR_VENDOR_LIBS do - do_install_a_lib "$MR_SHELL_CONFIGS_DIR/libs/${lib}.sh" + do_install_a_lib "configs/libs/${lib}.sh" done if [[ -n "$LIB_CONFIG_PATH" ]];then diff --git a/tools/parse-arguments.sh b/tools/parse-arguments.sh index 3c1e33b49..3394e8974 100644 --- a/tools/parse-arguments.sh +++ b/tools/parse-arguments.sh @@ -121,8 +121,19 @@ function echo_env() fi } +function make_absolute_path() +{ + local p="$1" + if [[ $p == /* ]]; then + echo "$(cd "$(dirname "$p")" && pwd)/$(basename "$p")" + else + echo "$(cd "$(dirname "$MR_SHELL_ROOT_DIR/$p")" && pwd)/$(basename "$p")" + fi +} + export -f env_assert export -f echo_env +export -f make_absolute_path function help() { From 8b9d597a89cfc7dc54dbc71d0003c34ea25fd2dd Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Fri, 15 May 2026 17:03:16 +0800 Subject: [PATCH 342/359] review ffmpeg8 patches --- ...o-00-00-bug-baidu-neddisk-hls-start_.patch | 29 -- ...fs-for-network-Blu-ray-Disc-and-BDMV.patch | 249 +++++++++++------- ...find-the-right-m2ts-then-read-seek-i.patch | 19 +- 3 files changed, 170 insertions(+), 127 deletions(-) delete mode 100644 patches/ffmpeg-n8.1.1/0013-fix-can-t-seek-to-00-00-bug-baidu-neddisk-hls-start_.patch diff --git a/patches/ffmpeg-n8.1.1/0013-fix-can-t-seek-to-00-00-bug-baidu-neddisk-hls-start_.patch b/patches/ffmpeg-n8.1.1/0013-fix-can-t-seek-to-00-00-bug-baidu-neddisk-hls-start_.patch deleted file mode 100644 index dbb6aa99c..000000000 --- a/patches/ffmpeg-n8.1.1/0013-fix-can-t-seek-to-00-00-bug-baidu-neddisk-hls-start_.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 91d3904d4db1e5e4c1fbe7866566259cabcd018c Mon Sep 17 00:00:00 2001 -From: qianlongxu -Date: Wed, 28 May 2025 18:49:48 +0800 -Subject: fix can't seek to 00:00 bug, baidu neddisk hls - start_time is less than first_timestamp - ---- - libavformat/hls.c | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/libavformat/hls.c b/libavformat/hls.c -index 28c883097a..14fa9da57c 100644 ---- a/libavformat/hls.c -+++ b/libavformat/hls.c -@@ -1923,7 +1923,10 @@ static int find_timestamp_in_playlist(HLSContext *c, struct playlist *pls, - - if (timestamp < pos) { - *seq_no = pls->start_seq_no; -- return 0; -+ if (seg_start_ts) { -+ *seg_start_ts = pos; -+ } -+ return 1; - } - - for (i = 0; i < pls->n_segments; i++) { --- -2.50.1 (Apple Git-155) - diff --git a/patches/ffmpeg-n8.1.1/0023-custom-bluray-fs-for-network-Blu-ray-Disc-and-BDMV.patch b/patches/ffmpeg-n8.1.1/0023-custom-bluray-fs-for-network-Blu-ray-Disc-and-BDMV.patch index 939d045dd..457ec4be4 100644 --- a/patches/ffmpeg-n8.1.1/0023-custom-bluray-fs-for-network-Blu-ray-Disc-and-BDMV.patch +++ b/patches/ffmpeg-n8.1.1/0023-custom-bluray-fs-for-network-Blu-ray-Disc-and-BDMV.patch @@ -1,19 +1,19 @@ -From 3f5023db5a58a8be25a8c31c26b8107875f21e80 Mon Sep 17 00:00:00 2001 +From eb2726a246f316be45dc5b1b534e581c4d432592 Mon Sep 17 00:00:00 2001 From: qianlongxu -Date: Fri, 8 May 2026 18:04:37 +0800 -Subject: custom bluray fs for network Blu-ray Disc and BDMV +Date: Fri, 15 May 2026 17:00:02 +0800 +Subject: [PATCH] custom bluray fs for network Blu-ray Disc and BDMV --- libavformat/Makefile | 2 +- - libavformat/bluray.c | 118 +++++++++- - libavformat/bluray_custom_fs.c | 413 +++++++++++++++++++++++++++++++++ - libavformat/bluray_custom_fs.h | 29 +++ - 4 files changed, 553 insertions(+), 9 deletions(-) + libavformat/bluray.c | 128 ++++++++- + libavformat/bluray_custom_fs.c | 459 +++++++++++++++++++++++++++++++++ + libavformat/bluray_custom_fs.h | 33 +++ + 4 files changed, 610 insertions(+), 12 deletions(-) create mode 100644 libavformat/bluray_custom_fs.c create mode 100644 libavformat/bluray_custom_fs.h diff --git a/libavformat/Makefile b/libavformat/Makefile -index 6100e33b30..54e88cfdfd 100644 +index 6100e33..54e88cf 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -694,7 +694,7 @@ OBJS-$(CONFIG_VAPOURSYNTH_DEMUXER) += vapoursynth.o @@ -26,7 +26,7 @@ index 6100e33b30..54e88cfdfd 100644 OBJS-$(CONFIG_CONCAT_PROTOCOL) += concat.o OBJS-$(CONFIG_CONCATF_PROTOCOL) += concat.o diff --git a/libavformat/bluray.c b/libavformat/bluray.c -index 1845551c34..cd50523ac6 100644 +index 1845551..eb43340 100644 --- a/libavformat/bluray.c +++ b/libavformat/bluray.c @@ -21,23 +21,27 @@ @@ -97,21 +97,22 @@ index 1845551c34..cd50523ac6 100644 av_strstart(path, BLURAY_PROTO_PREFIX, &diskname); - bd->bd = bd_open(diskname, NULL); -+ fs_access *access = NULL; -+ +- if (!bd->bd) { + diskname = ff_urldecode(diskname, 0); + -+ if (av_strstart(diskname, "file://", NULL) || av_strstart(diskname, "/", NULL)) { -+ access = NULL; -+ } else { ++ fs_access *access = NULL; ++ int is_file = av_strstart(diskname, "file://", NULL) || av_strstart(diskname, "/", NULL); ++ ++ // file protocl can't handle AVIO_FLAG_DIRECT flag,so file not create custom access ++ if (!is_file) { + //set read packet buffer size is important! the default packet size is 32768, when use smb2 protocol, download speed is limited to 2MB; but when set the size to 1048576, download speed is 16MB; + h->max_packet_size = 1048576; -+ access = create_bluray_custom_access(diskname, options); ++ access = create_bluray_custom_access(diskname, options, &h->interrupt_callback); + } + + bd->bd = bd_open_fs(diskname, NULL, access); + - if (!bd->bd) { ++ if (!bd->bd || is_bluray_custom_access_cancelled(access)) { av_log(h, AV_LOG_ERROR, "bd_open() failed\n"); + if (access) { + destroy_bluray_custom_access(&access); @@ -122,7 +123,17 @@ index 1845551c34..cd50523ac6 100644 /* check if disc can be played */ if (check_disc_info(h) < 0) { -@@ -159,12 +198,13 @@ static int bluray_open(URLContext *h, const char *path, int flags) +@@ -150,6 +189,9 @@ static int bluray_open(URLContext *h, const char *path, int flags) + int i; + for (i = 0; i < num_title_idx; i++) { + BLURAY_TITLE_INFO *info = bd_get_title_info(bd->bd, i, 0); ++ if (!info) { ++ continue; ++ } + + av_log(h, AV_LOG_INFO, "playlist %05d.mpls (%d:%02d:%02d)\n", + info->playlist, +@@ -159,17 +201,19 @@ static int bluray_open(URLContext *h, const char *path, int flags) if (info->duration > duration) { bd->playlist = info->playlist; @@ -137,7 +148,15 @@ index 1845551c34..cd50523ac6 100644 } /* select playlist */ -@@ -222,13 +262,75 @@ static int64_t bluray_seek(URLContext *h, int64_t pos, int whence) +- if (bd_select_playlist(bd->bd, bd->playlist) <= 0) { +- av_log(h, AV_LOG_ERROR, "bd_select_playlist(%05d.mpls) failed\n", bd->playlist); ++ if (bd->playlist >= 0 && bd_select_playlist(bd->bd, bd->playlist) <= 0) { ++ av_log(h, AV_LOG_ERROR, "bd_select_playlist(%05d.mpls) failed\n", ++ bd->playlist); + return AVERROR(EIO); + } + +@@ -222,13 +266,75 @@ static int64_t bluray_seek(URLContext *h, int64_t pos, int whence) return AVERROR(EINVAL); } @@ -216,10 +235,10 @@ index 1845551c34..cd50523ac6 100644 }; diff --git a/libavformat/bluray_custom_fs.c b/libavformat/bluray_custom_fs.c new file mode 100644 -index 0000000000..bdf2451ec0 +index 0000000..b82e0b2 --- /dev/null +++ b/libavformat/bluray_custom_fs.c -@@ -0,0 +1,413 @@ +@@ -0,0 +1,459 @@ +// +// bluray_custom_fs_smb2.c +// @@ -256,20 +275,19 @@ index 0000000000..bdf2451ec0 + URLContext *url_context; + int64_t offset; + AVApplicationContext *app_ctx; ++ int64_t last_read; +} ff_builtin_io; + +typedef struct ff_bluray_access { + const char *url; + AVDictionary *opts; + ff_builtin_io *io; ++ const AVIOInterruptCB *int_cb; ++ int cancel; +} ff_bluray_access; + -+static int interrupt_cb(void *ctx) ++static void close_builtin_io(ff_builtin_io *io) +{ -+ return 0; -+} -+ -+static void close_builtin_io(ff_builtin_io *io) { + if (!io) { + return; + } @@ -278,31 +296,37 @@ index 0000000000..bdf2451ec0 + } +} + -+static int create_builtin_io(ff_builtin_io **io, const char *url, AVDictionary **opts, int is_dir) ++static int create_builtin_io(ff_builtin_io **io, const char *url, ++ AVDictionary **opts, int is_dir, ++ const AVIOInterruptCB *int_cb) +{ + if (!io) { + return -1; + } + -+ ff_builtin_io * app = av_mallocz(sizeof(ff_builtin_io)); ++ ff_builtin_io *app = av_mallocz(sizeof(ff_builtin_io)); + if (!app) { + return -2; + } + -+ char *protocol_whitelist = NULL; ++ const char *protocol_whitelist = NULL; + + if (opts) { + const AVDictionary *dict = *opts; + -+ if (!av_strstart(url, "http", NULL) && !av_strstart(url, "smb2", NULL)) { -+ AVDictionaryEntry *app_dict = av_dict_get(dict, "ijkapplication", NULL, 0); ++ if (!av_strstart(url, "http", NULL) && ++ !av_strstart(url, "smb2", NULL)) { ++ AVDictionaryEntry *app_dict = ++ av_dict_get(dict, "ijkapplication", NULL, 0); + if (app_dict) { -+ app->app_ctx = (AVApplicationContext *)av_dict_strtoptr(app_dict->value); ++ app->app_ctx = ++ (AVApplicationContext *)av_dict_strtoptr(app_dict->value); + av_application_will_http_open(app->app_ctx, NULL, url); + } + } + -+ AVDictionaryEntry *proto_dict = av_dict_get(dict, "protocol_whitelist", NULL, 0); ++ AVDictionaryEntry *proto_dict = ++ av_dict_get(dict, "protocol_whitelist", NULL, 0); + if (proto_dict) { + protocol_whitelist = av_strdup(proto_dict->value); + } @@ -312,23 +336,17 @@ index 0000000000..bdf2451ec0 + protocol_whitelist = "ijkio,ijkhttphook,http,tcp,https,tls,file,smb2"; + } + -+ AVIOInterruptCB cb = {&interrupt_cb, app}; + int flags = AVIO_FLAG_READ; + if (is_dir) { + flags |= AVIO_FLAG_DIRECT; + } + -+ int ret = ffurl_open_whitelist(&app->url_context, -+ url, -+ flags, -+ &cb, -+ opts, -+ protocol_whitelist, -+ NULL, -+ NULL); -+ -+ av_application_did_http_open(app->app_ctx, (void*)app->url_context, url, ret < 0 ? AVERROR(errno) : 0, ret < 0 ? 500 : 200, 0); ++ int ret = ffurl_open_whitelist(&app->url_context, url, flags, int_cb, opts, ++ protocol_whitelist, NULL, NULL); + ++ av_application_did_http_open(app->app_ctx, (void *)app->url_context, url, ++ ret < 0 ? AVERROR(errno) : 0, ++ ret < 0 ? 500 : 200, 0); + if (ret < 0) { + close_builtin_io(app); + av_freep(&app); @@ -344,23 +362,39 @@ index 0000000000..bdf2451ec0 + } + + if (io->offset == offset && origin == SEEK_SET) { ++ io->last_read = offset; + return offset; + } + -+ av_application_will_http_seek(io->app_ctx, (void*)io->url_context, io->url_context->filename, offset); ++ av_application_will_http_seek(io->app_ctx, (void *)io->url_context, ++ io->url_context->filename, offset); + -+ int64_t pos = io->url_context->prot->url_seek(io->url_context, offset, origin); ++ int64_t pos = ++ io->url_context->prot->url_seek(io->url_context, offset, origin); + if (pos < 0) { -+ av_application_did_http_seek(io->app_ctx, (void*)io->url_context, io->url_context->filename, offset, AVERROR(errno), 500); ++ av_application_did_http_seek(io->app_ctx, (void *)io->url_context, ++ io->url_context->filename, offset, ++ AVERROR(errno), 500); + return AVERROR(errno); + } ++ io->last_read = pos; + io->offset = pos; -+ -+ av_application_did_http_seek(io->app_ctx, (void*)io->url_context, io->url_context->filename, offset, 0, 200); ++ av_application_did_http_seek(io->app_ctx, (void *)io->url_context, ++ io->url_context->filename, offset, 0, 200); + return pos; +} + -+static int read_builtin_io(ff_builtin_io *io, uint8_t *buf, int buf_size) ++static int write_builtin_io(ff_builtin_io *io, uint8_t *buf, int buf_size) ++{ ++ if (!io) { ++ return 0; ++ } ++ ++ return io->url_context->prot->url_write(io->url_context, buf, buf_size); ++} ++ ++static int read_builtin_io(ff_builtin_io *io, uint8_t *buf, int buf_size, ++ int64_t pos) +{ + if (!io) { + return 0; @@ -370,48 +404,52 @@ index 0000000000..bdf2451ec0 + int buf_size1 = buf_size; + int read = 0; + ++ seek_builtin_io(io, pos, SEEK_SET); ++ + while (buf_size1 > 0) { -+ read = io->url_context->prot->url_read(io->url_context, buf1, buf_size1); ++ read = ++ io->url_context->prot->url_read(io->url_context, buf1, buf_size1); + if (read <= 0) { -+ //maybe AVERROR_EOF ++ // maybe AVERROR_EOF + break; + } -+ + io->offset += read; + buf1 += read; + buf_size1 -= read; + } -+ ++ if (read == AVERROR_EXIT) { ++ return AVERROR_EXIT; ++ } + int bytes = buf_size - buf_size1; + if (bytes == 0 && read == AVERROR_EOF) { + return AVERROR_EOF; + } else { -+ av_application_did_io_tcp_read(io->app_ctx, (void*)io->url_context, bytes); ++ av_application_did_io_tcp_read(io->app_ctx, (void *)io->url_context, ++ bytes); + return bytes; + } +} + -+static int write_builtin_io(ff_builtin_io *io, uint8_t *buf, int buf_size) ++static int read_blocks(void *fs_handle, void *buf, int lba, int num_blocks) +{ -+ if (!io) { -+ return 0; ++ ff_bluray_access *access = fs_handle; ++ if (access->cancel == 1) { ++ return AVERROR_EXIT; + } + -+ return io->url_context->prot->url_write(io->url_context, buf, buf_size); -+} -+ -+static int read_blocks(void * fs_handle, void *buf, int lba, int num_blocks) -+{ -+ ff_bluray_access *access = fs_handle; + ff_builtin_io *io = access->io; + if (!io) { + return -1; + } + int got = -1; + int64_t pos = (int64_t)lba * UDF_BLOCK_SIZE; ++ int buf_size = num_blocks * UDF_BLOCK_SIZE; ++ int bytes = read_builtin_io(io, buf, buf_size, pos); ++ if (bytes == AVERROR_EXIT) { ++ access->cancel = 1; ++ return AVERROR_EXIT; ++ } + -+ seek_builtin_io(io, pos, SEEK_SET); -+ int bytes = read_builtin_io(io, (uint8_t*)buf, num_blocks * UDF_BLOCK_SIZE); + if (bytes > 0) { + got = (int)(bytes / UDF_BLOCK_SIZE); + } @@ -461,10 +499,17 @@ index 0000000000..bdf2451ec0 + if (!io) { + return -1; + } -+ return read_builtin_io(io, buf, size); ++ ++ int read = read_builtin_io(io, buf, size, io->last_read); ++ ++ if (read > 0) { ++ io->last_read += read; ++ } ++ ++ return read; +} + -+static int64_t _file_write(BD_FILE_H *file, const uint8_t *buf, int64_t size) ++static int64_t _file_write(BD_FILE_H *file, uint8_t *buf, int64_t size) +{ + if (size <= 0) { + return 0; @@ -492,15 +537,19 @@ index 0000000000..bdf2451ec0 + if (!io) { + return -1; + } -+ return seek_builtin_io(io, 0, SEEK_CUR); ++ return io->last_read; ++ // return seek_builtin_io(io, 0, SEEK_CUR); +} + -+static struct bd_file_s* open_file(void *fs_handle, const char *rel_path) ++static struct bd_file_s *open_file(void *fs_handle, const char *rel_path) +{ + ff_bluray_access *access = fs_handle; + -+ char *url = NULL; -+ url = av_append_path_component(access->url, rel_path); ++ if (access->cancel == 1) { ++ return NULL; ++ } ++ ++ const char *url = av_append_path_component(access->url, rel_path); + if (!url) { + return NULL; + } @@ -508,15 +557,16 @@ index 0000000000..bdf2451ec0 + av_dict_copy(&opts, access->opts, 0); + + ff_builtin_io *io = NULL; -+ int ret = create_builtin_io(&io, url, &opts, 0); ++ int ret = create_builtin_io(&io, url, &opts, 0, access->int_cb); + av_dict_free(&opts); -+ av_free(url); + + if (0 != ret) { -+ av_log(NULL, AV_LOG_ERROR, "can't open url %s,error:%s", url, av_err2str(ret)); ++ av_log(NULL, AV_LOG_ERROR, "[bluray] can't open %s,error:%s", url, ++ av_err2str(ret)); ++ av_free(url); + return NULL; + } -+ ++ av_free(url); + BD_FILE_H *file = av_malloc(sizeof(BD_FILE_H)); + if (!file) { + close_builtin_io(io); @@ -572,8 +622,11 @@ index 0000000000..bdf2451ec0 +{ + ff_bluray_access *access = fs_handle; + -+ char *url = NULL; -+ url = av_append_path_component(access->url, rel_path); ++ if (access->cancel == 1) { ++ return NULL; ++ } ++ ++ const char *url = av_append_path_component(access->url, rel_path); + if (!url) { + return NULL; + } @@ -581,15 +634,16 @@ index 0000000000..bdf2451ec0 + av_dict_copy(&opts, access->opts, 0); + + ff_builtin_io *io = NULL; -+ int ret = create_builtin_io(&io, url, &opts, 1); ++ int ret = create_builtin_io(&io, url, &opts, 1, access->int_cb); + av_dict_free(&opts); -+ av_free(url); + + if (0 != ret) { -+ av_log(NULL, AV_LOG_ERROR, "can't open dir %s,error:%s", url, av_err2str(ret)); ++ av_log(NULL, AV_LOG_ERROR, "[bluray] can't open dir %s,error:%s", url, ++ av_err2str(ret)); ++ av_free(url); + return NULL; + } -+ ++ av_free(url); + BD_DIR_H *dir = av_malloc(sizeof(BD_DIR_H)); + if (!dir) { + close_builtin_io(io); @@ -604,8 +658,18 @@ index 0000000000..bdf2451ec0 + return dir; +} + ++int is_bluray_custom_access_cancelled(fs_access *access) ++{ ++ if (!access) { ++ return 0; ++ } ++ ++ ff_bluray_access *opaque = access->fs_handle; ++ return opaque->cancel; ++} ++ +// 构建fs_access结构体 -+fs_access * create_bluray_custom_access(const char *url, AVDictionary **options) ++fs_access * create_bluray_custom_access(const char *url, AVDictionary **options, const AVIOInterruptCB *int_cb) +{ + ff_bluray_access * opaque = av_mallocz(sizeof(ff_bluray_access)); + if (!opaque) { @@ -617,10 +681,11 @@ index 0000000000..bdf2451ec0 + if (options) { + av_dict_copy(&opaque->opts, *options, 0); + } -+ -+ int ret = create_builtin_io(&opaque->io, url, options, 0); ++ opaque->int_cb = int_cb; ++ int ret = create_builtin_io(&opaque->io, url, options, 0, int_cb); + if (0 != ret) { -+ av_log(NULL, AV_LOG_ERROR, "can't open file %s,error:%s", url, av_err2str(ret)); ++ av_log(NULL, AV_LOG_ERROR, "[bluray] can't open file %s,error:%s", ++ url, av_err2str(ret)); + } + + fs_access *access = av_malloc(sizeof(fs_access)); @@ -633,12 +698,13 @@ index 0000000000..bdf2451ec0 + } + return NULL; +} +\ No newline at end of file diff --git a/libavformat/bluray_custom_fs.h b/libavformat/bluray_custom_fs.h new file mode 100644 -index 0000000000..806fe29cd0 +index 0000000..058d2da --- /dev/null +++ b/libavformat/bluray_custom_fs.h -@@ -0,0 +1,29 @@ +@@ -0,0 +1,33 @@ +// +// bluray_custom_fs.h +// @@ -665,9 +731,14 @@ index 0000000000..806fe29cd0 + +typedef struct fs_access fs_access; +typedef struct AVDictionary AVDictionary; ++typedef struct AVIOInterruptCB AVIOInterruptCB; ++ +void destroy_bluray_custom_access(fs_access **p); -+fs_access * create_bluray_custom_access(const char *url, AVDictionary **options); -+#endif /* bluray_custom_fs_smb2_h */ ++int is_bluray_custom_access_cancelled(fs_access *access); ++fs_access *create_bluray_custom_access(const char *url, AVDictionary **options, ++ const AVIOInterruptCB *int_cb); ++#endif /* bluray_custom_fs_h */ +\ No newline at end of file -- 2.50.1 (Apple Git-155) diff --git a/patches/ffmpeg-n8.1.1/0024-bluray-open-and-find-the-right-m2ts-then-read-seek-i.patch b/patches/ffmpeg-n8.1.1/0024-bluray-open-and-find-the-right-m2ts-then-read-seek-i.patch index 99d8b4d1e..a6591dfa4 100644 --- a/patches/ffmpeg-n8.1.1/0024-bluray-open-and-find-the-right-m2ts-then-read-seek-i.patch +++ b/patches/ffmpeg-n8.1.1/0024-bluray-open-and-find-the-right-m2ts-then-read-seek-i.patch @@ -1,15 +1,15 @@ -From 2c0a1a713d91440d6918ce10fe37a5eebc6add10 Mon Sep 17 00:00:00 2001 +From 6e7abe54b59f8227df2c1149665b314cd2ac5892 Mon Sep 17 00:00:00 2001 From: qianlongxu -Date: Thu, 29 May 2025 11:16:41 +0800 -Subject: bluray open and find the right m2ts, then read\seek it +Date: Tue, 12 May 2026 11:45:56 +0800 +Subject: [PATCH] bluray open and find the right m2ts, then read/seek it direactly instread of bluray logic. --- - libavformat/bluray.c | 24 +++++++++++++++++++----- - 1 file changed, 19 insertions(+), 5 deletions(-) + libavformat/bluray.c | 25 ++++++++++++++++++++----- + 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/libavformat/bluray.c b/libavformat/bluray.c -index cd50523ac6..465ea9b63d 100644 +index cd50523..7fdffdd 100644 --- a/libavformat/bluray.c +++ b/libavformat/bluray.c @@ -42,6 +42,7 @@ typedef struct { @@ -20,16 +20,17 @@ index cd50523ac6..465ea9b63d 100644 } BlurayContext; #define OFFSET(x) offsetof(BlurayContext, x) -@@ -222,7 +223,7 @@ static int bluray_open(URLContext *h, const char *path, int flags, AVDictionary +@@ -222,7 +223,8 @@ static int bluray_open(URLContext *h, const char *path, int flags, AVDictionary if (bd->chapter > 1) { bd_seek_chapter(bd->bd, bd->chapter - 1); } - ++ /* will read ts soon */ + bd->stream_opened = 1; return 0; } -@@ -234,7 +235,13 @@ static int bluray_read(URLContext *h, unsigned char *buf, int size) +@@ -234,7 +236,13 @@ static int bluray_read(URLContext *h, unsigned char *buf, int size) if (!bd || !bd->bd) { return AVERROR(EFAULT); } @@ -44,7 +45,7 @@ index cd50523ac6..465ea9b63d 100644 len = bd_read(bd->bd, buf, size); return len == 0 ? AVERROR_EOF : len; -@@ -252,10 +259,17 @@ static int64_t bluray_seek(URLContext *h, int64_t pos, int whence) +@@ -252,10 +260,17 @@ static int64_t bluray_seek(URLContext *h, int64_t pos, int whence) case SEEK_SET: case SEEK_CUR: case SEEK_END: From 56ebf23b702fe7b58437d3662e1c9be9e321da0a Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Fri, 15 May 2026 17:29:41 +0800 Subject: [PATCH 343/359] format ffmpeg8 patches --- ...-h264_ps-null-pointer-fault-tolerant.patch} | 4 ++-- ...vformat-add-application-and-dns_cache.patch | 12 ++++++------ .../0003-restore-ijk-http-event-hooks.patch | 8 ++++---- .../0004-restore-ijk-tcp-dns-cache.patch | 4 ++-- ...tom-protocols-and-demuxers-except-lon.patch | 18 +++++++++--------- ...6-add-4-dummy-ijkplaceholder-demuxers.patch | 6 +++--- .../0007-add-3-dummy-ijkhttp-protocols.patch | 6 +++--- ...dict_get-that-converts-the-value-to-a.patch | 6 +++--- ...ttp-impl-was-used-by-set-selected_htt.patch | 6 +++--- ...ekable-value-range-0-means-streamed-c.patch | 4 ++-- .../0011-fix-lrcdec-read-line-bug-on-osx.patch | 4 ++-- ...-index-only-keyframes-to-ensure-accur.patch | 4 ++-- ...g-codecpar-codec_id-which-read-from-.patch} | 8 ++++---- ...-transfer-get-wrong-size-cause-av_re.patch} | 4 ++-- ...-not-very-useful-log-use-trace-level.patch} | 8 ++++---- ...er-and-Demuxer-but-av3a-Decoder-is-a.patch} | 5 +++-- ...7-http-add-reconnect_first_delay-opt.patch} | 4 ++-- ...d-http_seek-redirect-authentication-.patch} | 4 ++-- ...d-built-in-smb2-protocol-via-libsmb2.patch} | 10 +++++----- ...-add-url_parse_priv-function-pointer.patch} | 6 +++--- ...021-bluray-protocol-add-dvd-fallback.patch} | 4 ++-- ...fs-for-network-Blu-ray-Disc-and-BDMV.patch} | 4 ++-- ...find-the-right-m2ts-then-read-seek-i.patch} | 12 ++++++------ ...eg7-test.c-1-10-fatal-error-libxml2-.patch} | 4 ++-- ...ragment-url-is-invalid-truncated-bug.patch} | 4 ++-- ...add-webp-demuxer-and-libwebp-decoder.patch} | 2 +- 26 files changed, 81 insertions(+), 80 deletions(-) rename patches/ffmpeg-n8.1.1/{0001-PATCH-restore-ijk-h264_ps-null-pointer-fault-toleran.patch => 0001-restore-ijk-h264_ps-null-pointer-fault-tolerant.patch} (95%) rename patches/ffmpeg-n8.1.1/{0014-Correct-the-wrong-codecpar-codec_id-which-read-from-.patch => 0013-Correct-the-wrong-codecpar-codec_id-which-read-from-.patch} (92%) rename patches/ffmpeg-n8.1.1/{0015-fix-http-chunked-transfer-get-wrong-size-cause-av_re.patch => 0014-fix-http-chunked-transfer-get-wrong-size-cause-av_re.patch} (90%) rename patches/ffmpeg-n8.1.1/{0016-not-very-useful-log-use-trace-level.patch => 0015-not-very-useful-log-use-trace-level.patch} (94%) rename patches/ffmpeg-n8.1.1/{0017-Audio-Vivid-Parser-and-Demuxer-but-av3a-Decoder-is-a.patch => 0016-Audio-Vivid-Parser-and-Demuxer-but-av3a-Decoder-is-a.patch} (99%) rename patches/ffmpeg-n8.1.1/{0018-http-add-reconnect_first_delay-opt.patch => 0017-http-add-reconnect_first_delay-opt.patch} (95%) rename patches/ffmpeg-n8.1.1/{0019-fix-http-open-and-http_seek-redirect-authentication-.patch => 0018-fix-http-open-and-http_seek-redirect-authentication-.patch} (97%) rename patches/ffmpeg-n8.1.1/{0020-add-built-in-smb2-protocol-via-libsmb2.patch => 0019-add-built-in-smb2-protocol-via-libsmb2.patch} (98%) rename patches/ffmpeg-n8.1.1/{0021-URLProtocol-add-url_parse_priv-function-pointer.patch => 0020-URLProtocol-add-url_parse_priv-function-pointer.patch} (92%) rename patches/ffmpeg-n8.1.1/{0022-bluray-protocol-add-dvd-fallback.patch => 0021-bluray-protocol-add-dvd-fallback.patch} (94%) rename patches/ffmpeg-n8.1.1/{0023-custom-bluray-fs-for-network-Blu-ray-Disc-and-BDMV.patch => 0022-custom-bluray-fs-for-network-Blu-ray-Disc-and-BDMV.patch} (99%) rename patches/ffmpeg-n8.1.1/{0024-bluray-open-and-find-the-right-m2ts-then-read-seek-i.patch => 0023-bluray-open-and-find-the-right-m2ts-then-read-seek-i.patch} (82%) rename patches/ffmpeg-n8.1.1/{0025-fix-android-ffmpeg7-test.c-1-10-fatal-error-libxml2-.patch => 0024-fix-android-ffmpeg7-test.c-1-10-fatal-error-libxml2-.patch} (93%) rename patches/ffmpeg-n8.1.1/{0026-fix-dash-init-fragment-url-is-invalid-truncated-bug.patch => 0025-fix-dash-init-fragment-url-is-invalid-truncated-bug.patch} (92%) rename patches/ffmpeg-n8.1.1/{0027-add-webp-demuxer-and-libwebp-decoder.patch => 0026-add-webp-demuxer-and-libwebp-decoder.patch} (99%) diff --git a/patches/ffmpeg-n8.1.1/0001-PATCH-restore-ijk-h264_ps-null-pointer-fault-toleran.patch b/patches/ffmpeg-n8.1.1/0001-restore-ijk-h264_ps-null-pointer-fault-tolerant.patch similarity index 95% rename from patches/ffmpeg-n8.1.1/0001-PATCH-restore-ijk-h264_ps-null-pointer-fault-toleran.patch rename to patches/ffmpeg-n8.1.1/0001-restore-ijk-h264_ps-null-pointer-fault-tolerant.patch index b82653f0d..d7deded1d 100644 --- a/patches/ffmpeg-n8.1.1/0001-PATCH-restore-ijk-h264_ps-null-pointer-fault-toleran.patch +++ b/patches/ffmpeg-n8.1.1/0001-restore-ijk-h264_ps-null-pointer-fault-tolerant.patch @@ -1,4 +1,4 @@ -From 23773b2fbcdd5f495622318db9a7cc5c35942cef Mon Sep 17 00:00:00 2001 +From 21a946850b1be93508b3d2d4478e60d347d9993f Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Wed, 28 May 2025 17:28:22 +0800 Subject: restore ijk h264_ps null pointer fault tolerant @@ -8,7 +8,7 @@ Subject: restore ijk h264_ps null pointer fault tolerant 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavcodec/h264_ps.c b/libavcodec/h264_ps.c -index ac204172cb..2c35e0d6f6 100644 +index ac20417..2c35e0d 100644 --- a/libavcodec/h264_ps.c +++ b/libavcodec/h264_ps.c @@ -437,7 +437,7 @@ int ff_h264_decode_seq_parameter_set(GetBitContext *gb, AVCodecContext *avctx, diff --git a/patches/ffmpeg-n8.1.1/0002-restore-ijk-avformat-add-application-and-dns_cache.patch b/patches/ffmpeg-n8.1.1/0002-restore-ijk-avformat-add-application-and-dns_cache.patch index 8b158734f..9e2745720 100644 --- a/patches/ffmpeg-n8.1.1/0002-restore-ijk-avformat-add-application-and-dns_cache.patch +++ b/patches/ffmpeg-n8.1.1/0002-restore-ijk-avformat-add-application-and-dns_cache.patch @@ -1,4 +1,4 @@ -From 886512c82e75af2e3ab48b8ebf5070995426c253 Mon Sep 17 00:00:00 2001 +From c4bfe93521942a600c8ba3e477b74aca1d8c745d Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Fri, 8 May 2026 15:58:55 +0800 Subject: restore ijk avformat add application and dns_cache @@ -16,7 +16,7 @@ Subject: restore ijk avformat add application and dns_cache create mode 100644 libavformat/dns_cache.h diff --git a/libavformat/Makefile b/libavformat/Makefile -index 4786a9345a..3c95fc4b7f 100644 +index 4786a93..3c95fc4 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -5,6 +5,9 @@ HEADERS = avformat.h \ @@ -40,7 +40,7 @@ index 4786a9345a..3c95fc4b7f 100644 diff --git a/libavformat/application.c b/libavformat/application.c new file mode 100644 -index 0000000000..de093b9c89 +index 0000000..de093b9 --- /dev/null +++ b/libavformat/application.c @@ -0,0 +1,213 @@ @@ -259,7 +259,7 @@ index 0000000000..de093b9c89 +} diff --git a/libavformat/application.h b/libavformat/application.h new file mode 100644 -index 0000000000..b9e7f5b69a +index 0000000..b9e7f5b --- /dev/null +++ b/libavformat/application.h @@ -0,0 +1,120 @@ @@ -385,7 +385,7 @@ index 0000000000..b9e7f5b69a +#endif /* AVUTIL_APPLICATION_H */ diff --git a/libavformat/dns_cache.c b/libavformat/dns_cache.c new file mode 100644 -index 0000000000..aab2435b90 +index 0000000..aab2435 --- /dev/null +++ b/libavformat/dns_cache.c @@ -0,0 +1,232 @@ @@ -623,7 +623,7 @@ index 0000000000..aab2435b90 +} diff --git a/libavformat/dns_cache.h b/libavformat/dns_cache.h new file mode 100644 -index 0000000000..23c695e827 +index 0000000..23c695e --- /dev/null +++ b/libavformat/dns_cache.h @@ -0,0 +1,39 @@ diff --git a/patches/ffmpeg-n8.1.1/0003-restore-ijk-http-event-hooks.patch b/patches/ffmpeg-n8.1.1/0003-restore-ijk-http-event-hooks.patch index 1e4027247..de76b7df4 100644 --- a/patches/ffmpeg-n8.1.1/0003-restore-ijk-http-event-hooks.patch +++ b/patches/ffmpeg-n8.1.1/0003-restore-ijk-http-event-hooks.patch @@ -1,4 +1,4 @@ -From 45eb43659ad56bcf3aea1ab1f5358c1995c57089 Mon Sep 17 00:00:00 2001 +From 91b1bc44f636fd2c2a4a40fabffadfd6fa9d22e8 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Fri, 8 May 2026 16:30:34 +0800 Subject: restore ijk http event hooks @@ -10,7 +10,7 @@ Subject: restore ijk http event hooks 3 files changed, 86 insertions(+), 8 deletions(-) diff --git a/libavformat/http.c b/libavformat/http.c -index 52073ffcb6..f4bf225728 100644 +index 52073ff..f4bf225 100644 --- a/libavformat/http.c +++ b/libavformat/http.c @@ -48,6 +48,7 @@ @@ -132,7 +132,7 @@ index 52073ffcb6..f4bf225728 100644 redo: ret = ffurl_open_whitelist(&s->hd, lower_url, AVIO_FLAG_READ_WRITE, diff --git a/libavformat/tcp.c b/libavformat/tcp.c -index ce9f69a50b..69b1e12c49 100644 +index ce9f69a..69b1e12 100644 --- a/libavformat/tcp.c +++ b/libavformat/tcp.c @@ -24,7 +24,8 @@ @@ -259,7 +259,7 @@ index ce9f69a50b..69b1e12c49 100644 return ret < 0 ? ff_neterrno() : ret; } diff --git a/libavutil/error.h b/libavutil/error.h -index 1efa86c4c1..9dee755c69 100644 +index 1efa86c..9dee755 100644 --- a/libavutil/error.h +++ b/libavutil/error.h @@ -85,6 +85,10 @@ diff --git a/patches/ffmpeg-n8.1.1/0004-restore-ijk-tcp-dns-cache.patch b/patches/ffmpeg-n8.1.1/0004-restore-ijk-tcp-dns-cache.patch index ae78fd000..29a6b9611 100644 --- a/patches/ffmpeg-n8.1.1/0004-restore-ijk-tcp-dns-cache.patch +++ b/patches/ffmpeg-n8.1.1/0004-restore-ijk-tcp-dns-cache.patch @@ -1,4 +1,4 @@ -From e3804da4a5b88dabf071ad5070070489a9efb874 Mon Sep 17 00:00:00 2001 +From acffa5bb5305c8f28419c0f476e8d123f09d9bcd Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Fri, 8 May 2026 16:39:50 +0800 Subject: restore ijk tcp dns cache @@ -8,7 +8,7 @@ Subject: restore ijk tcp dns cache 1 file changed, 310 insertions(+), 14 deletions(-) diff --git a/libavformat/tcp.c b/libavformat/tcp.c -index 69b1e12c49..46b48e609d 100644 +index 69b1e12..46b48e6 100644 --- a/libavformat/tcp.c +++ b/libavformat/tcp.c @@ -26,6 +26,7 @@ diff --git a/patches/ffmpeg-n8.1.1/0005-restore-ijk-custom-protocols-and-demuxers-except-lon.patch b/patches/ffmpeg-n8.1.1/0005-restore-ijk-custom-protocols-and-demuxers-except-lon.patch index 892c44c78..220443a69 100644 --- a/patches/ffmpeg-n8.1.1/0005-restore-ijk-custom-protocols-and-demuxers-except-lon.patch +++ b/patches/ffmpeg-n8.1.1/0005-restore-ijk-custom-protocols-and-demuxers-except-lon.patch @@ -1,4 +1,4 @@ -From 5f75c2d325ee7519854a826f85d7b97187052eae Mon Sep 17 00:00:00 2001 +From 75225b69a8442347087c02a7ee24944e7c3b41e6 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Fri, 8 May 2026 17:02:15 +0800 Subject: restore ijk custom protocols and demuxers except long @@ -17,7 +17,7 @@ Subject: restore ijk custom protocols and demuxers except long create mode 100644 libavformat/ijkutils.c diff --git a/libavcodec/Makefile b/libavcodec/Makefile -index 1410bd8142..4445d9ea61 100644 +index 1410bd8..4445d9e 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -26,6 +26,7 @@ HEADERS = ac3_parser.h \ @@ -29,7 +29,7 @@ index 1410bd8142..4445d9ea61 100644 OBJS = ac3_parser.o \ adts_parser.o \ diff --git a/libavformat/Makefile b/libavformat/Makefile -index 3c95fc4b7f..85ed05b0f2 100644 +index 3c95fc4..85ed05b 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -7,6 +7,15 @@ HEADERS = avformat.h \ @@ -57,7 +57,7 @@ index 3c95fc4b7f..85ed05b0f2 100644 OBJS-$(HAVE_LIBC_MSVCRT) += file_open.o diff --git a/libavformat/allformats.c b/libavformat/allformats.c -index 6ec361fb7b..0c2d5caf82 100644 +index 6ec361f..0c2d5ca 100644 --- a/libavformat/allformats.c +++ b/libavformat/allformats.c @@ -584,6 +584,9 @@ extern const FFInputFormat ff_libmodplug_demuxer; @@ -71,7 +71,7 @@ index 6ec361fb7b..0c2d5caf82 100644 #include "libavformat/demuxer_list.c" diff --git a/libavformat/demux.c b/libavformat/demux.c -index a1909237f0..05ab1e172d 100644 +index a190923..05ab1e1 100644 --- a/libavformat/demux.c +++ b/libavformat/demux.c @@ -235,6 +235,7 @@ int avformat_open_input(AVFormatContext **ps, const char *filename, @@ -116,7 +116,7 @@ index a1909237f0..05ab1e172d 100644 avio_closep(&s->pb); avformat_free_context(s); diff --git a/libavformat/demux.h b/libavformat/demux.h -index f09afc849f..531c433968 100644 +index f09afc8..531c433 100644 --- a/libavformat/demux.h +++ b/libavformat/demux.h @@ -98,6 +98,8 @@ typedef struct FFInputFormat { @@ -130,7 +130,7 @@ index f09afc849f..531c433968 100644 * set. 'avformat_new_stream' can be called only if the flag diff --git a/libavformat/ijkutils.c b/libavformat/ijkutils.c new file mode 100644 -index 0000000000..0314c48d8b +index 0000000..0314c48 --- /dev/null +++ b/libavformat/ijkutils.c @@ -0,0 +1,107 @@ @@ -242,7 +242,7 @@ index 0000000000..0314c48d8b + */ +IJK_DUMMY_DEMUXER(ijklivehook); diff --git a/libavformat/protocols.c b/libavformat/protocols.c -index 207b6bf8d9..de0926beea 100644 +index 207b6bf..de0926b 100644 --- a/libavformat/protocols.c +++ b/libavformat/protocols.c @@ -79,6 +79,12 @@ extern const URLProtocol ff_libzmq_protocol; @@ -259,7 +259,7 @@ index 207b6bf8d9..de0926beea 100644 const AVClass *ff_urlcontext_child_class_iterate(void **iter) diff --git a/libavutil/Makefile b/libavutil/Makefile -index c5241895ff..a9fbf9923b 100644 +index c524189..a9fbf99 100644 --- a/libavutil/Makefile +++ b/libavutil/Makefile @@ -99,7 +99,8 @@ HEADERS = adler32.h \ diff --git a/patches/ffmpeg-n8.1.1/0006-add-4-dummy-ijkplaceholder-demuxers.patch b/patches/ffmpeg-n8.1.1/0006-add-4-dummy-ijkplaceholder-demuxers.patch index 1934eb00d..535f45598 100644 --- a/patches/ffmpeg-n8.1.1/0006-add-4-dummy-ijkplaceholder-demuxers.patch +++ b/patches/ffmpeg-n8.1.1/0006-add-4-dummy-ijkplaceholder-demuxers.patch @@ -1,4 +1,4 @@ -From eb2b38cb1107ecaa18fef1594300f9700f64318a Mon Sep 17 00:00:00 2001 +From 44ce37e539f1db0fce3804b192f2e48a7d72e040 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Fri, 8 May 2026 17:02:34 +0800 Subject: add 4 dummy ijkplaceholder demuxers @@ -9,7 +9,7 @@ Subject: add 4 dummy ijkplaceholder demuxers 2 files changed, 8 insertions(+) diff --git a/libavformat/allformats.c b/libavformat/allformats.c -index 0c2d5caf82..e2f37da7a1 100644 +index 0c2d5ca..e2f37da 100644 --- a/libavformat/allformats.c +++ b/libavformat/allformats.c @@ -586,6 +586,10 @@ extern const FFInputFormat ff_vapoursynth_demuxer; @@ -24,7 +24,7 @@ index 0c2d5caf82..e2f37da7a1 100644 #include "libavformat/muxer_list.c" #include "libavformat/demuxer_list.c" diff --git a/libavformat/ijkutils.c b/libavformat/ijkutils.c -index 0314c48d8b..ac80e548f4 100644 +index 0314c48..ac80e54 100644 --- a/libavformat/ijkutils.c +++ b/libavformat/ijkutils.c @@ -105,3 +105,7 @@ FFInputFormat ff_##x##_demuxer = { \ diff --git a/patches/ffmpeg-n8.1.1/0007-add-3-dummy-ijkhttp-protocols.patch b/patches/ffmpeg-n8.1.1/0007-add-3-dummy-ijkhttp-protocols.patch index 2078848a3..eefafb84e 100644 --- a/patches/ffmpeg-n8.1.1/0007-add-3-dummy-ijkhttp-protocols.patch +++ b/patches/ffmpeg-n8.1.1/0007-add-3-dummy-ijkhttp-protocols.patch @@ -1,4 +1,4 @@ -From 637a50bedd7a8761f79f30f8fd1bd6bc212533a5 Mon Sep 17 00:00:00 2001 +From 86da4f9eeb7824aa61cb59b690507a0772972a1d Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Fri, 8 May 2026 17:07:35 +0800 Subject: add 3 dummy ijkhttp protocols @@ -9,7 +9,7 @@ Subject: add 3 dummy ijkhttp protocols 2 files changed, 6 insertions(+) diff --git a/libavformat/ijkutils.c b/libavformat/ijkutils.c -index ac80e548f4..ba8eadd131 100644 +index ac80e54..ba8eadd 100644 --- a/libavformat/ijkutils.c +++ b/libavformat/ijkutils.c @@ -69,6 +69,9 @@ IJK_DUMMY_PROTOCOL(ijkhttphook); @@ -23,7 +23,7 @@ index ac80e548f4..ba8eadd131 100644 #define IJK_FF_DEMUXER(x) \ extern FFInputFormat ff_##x##_demuxer; \ diff --git a/libavformat/protocols.c b/libavformat/protocols.c -index de0926beea..d1c1095364 100644 +index de0926b..d1c1095 100644 --- a/libavformat/protocols.c +++ b/libavformat/protocols.c @@ -84,6 +84,9 @@ extern const URLProtocol ff_ijkmediadatasource_protocol; diff --git a/patches/ffmpeg-n8.1.1/0008-restore-ijk-av_dict_get-that-converts-the-value-to-a.patch b/patches/ffmpeg-n8.1.1/0008-restore-ijk-av_dict_get-that-converts-the-value-to-a.patch index ef23fdfe1..d4f4d3c69 100644 --- a/patches/ffmpeg-n8.1.1/0008-restore-ijk-av_dict_get-that-converts-the-value-to-a.patch +++ b/patches/ffmpeg-n8.1.1/0008-restore-ijk-av_dict_get-that-converts-the-value-to-a.patch @@ -1,4 +1,4 @@ -From aa354e9e139f7b028d71c92afe72dfef97c61dc0 Mon Sep 17 00:00:00 2001 +From 3da3f038de2cd4067263b69a06ac42ceb01b56d5 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Wed, 28 May 2025 18:33:27 +0800 Subject: restore ijk av_dict_get that converts the value to a @@ -10,7 +10,7 @@ Subject: restore ijk av_dict_get that converts the value to a 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/libavutil/dict.c b/libavutil/dict.c -index fafb454fd3..db8ee05699 100644 +index fafb454..db8ee05 100644 --- a/libavutil/dict.c +++ b/libavutil/dict.c @@ -63,7 +63,7 @@ AVDictionaryEntry *av_dict_get(const AVDictionary *m, const char *key, @@ -67,7 +67,7 @@ index fafb454fd3..db8ee05699 100644 const char *key_val_sep, const char *pairs_sep, int flags) diff --git a/libavutil/dict.h b/libavutil/dict.h -index 93c7cbf128..d97a601f66 100644 +index 93c7cbf..d97a601 100644 --- a/libavutil/dict.h +++ b/libavutil/dict.h @@ -173,6 +173,15 @@ int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags diff --git a/patches/ffmpeg-n8.1.1/0009-control-which-http-impl-was-used-by-set-selected_htt.patch b/patches/ffmpeg-n8.1.1/0009-control-which-http-impl-was-used-by-set-selected_htt.patch index 5bc4d75bc..f8ae3cb75 100644 --- a/patches/ffmpeg-n8.1.1/0009-control-which-http-impl-was-used-by-set-selected_htt.patch +++ b/patches/ffmpeg-n8.1.1/0009-control-which-http-impl-was-used-by-set-selected_htt.patch @@ -1,4 +1,4 @@ -From 453a18e73206f0074fe6cf94240b9066cf95f6d0 Mon Sep 17 00:00:00 2001 +From 5b78a77e4274c7aa8199ad5cc0aa1aa464b381c8 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Wed, 28 May 2025 18:25:51 +0800 Subject: control which http impl was used by set selected_http @@ -10,7 +10,7 @@ Subject: control which http impl was used by set selected_http 2 files changed, 77 insertions(+), 2 deletions(-) diff --git a/libavformat/avio.c b/libavformat/avio.c -index b146ac9f19..0287cc6092 100644 +index b146ac9..0287cc6 100644 --- a/libavformat/avio.c +++ b/libavformat/avio.c @@ -360,6 +360,65 @@ int ffurl_alloc(URLContext **puc, const char *filename, int flags, @@ -98,7 +98,7 @@ index b146ac9f19..0287cc6092 100644 if (h->prot->url_open_dir && h->prot->url_read_dir && h->prot->url_close_dir) { diff --git a/libavformat/url.h b/libavformat/url.h -index 0784d77b64..53c6f13d23 100644 +index 0784d77..53c6f13 100644 --- a/libavformat/url.h +++ b/libavformat/url.h @@ -112,6 +112,22 @@ typedef struct URLProtocol { diff --git a/patches/ffmpeg-n8.1.1/0010-correct-file-seekable-value-range-0-means-streamed-c.patch b/patches/ffmpeg-n8.1.1/0010-correct-file-seekable-value-range-0-means-streamed-c.patch index b32ef703e..f75a71451 100644 --- a/patches/ffmpeg-n8.1.1/0010-correct-file-seekable-value-range-0-means-streamed-c.patch +++ b/patches/ffmpeg-n8.1.1/0010-correct-file-seekable-value-range-0-means-streamed-c.patch @@ -1,4 +1,4 @@ -From f98ffd5b75b7c85f4f336f5a193357a2675e71e5 Mon Sep 17 00:00:00 2001 +From a238a10d136f21902de411f024536b43c87cae95 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Fri, 8 May 2026 17:11:02 +0800 Subject: correct file seekable value range, 0 means streamed @@ -9,7 +9,7 @@ Subject: correct file seekable value range, 0 means streamed 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/file.c b/libavformat/file.c -index 3ceddc8c25..59a0442c5a 100644 +index 3ceddc8..59a0442 100644 --- a/libavformat/file.c +++ b/libavformat/file.c @@ -106,7 +106,7 @@ static const AVOption file_options[] = { diff --git a/patches/ffmpeg-n8.1.1/0011-fix-lrcdec-read-line-bug-on-osx.patch b/patches/ffmpeg-n8.1.1/0011-fix-lrcdec-read-line-bug-on-osx.patch index 85a7af914..0e34977cc 100644 --- a/patches/ffmpeg-n8.1.1/0011-fix-lrcdec-read-line-bug-on-osx.patch +++ b/patches/ffmpeg-n8.1.1/0011-fix-lrcdec-read-line-bug-on-osx.patch @@ -1,4 +1,4 @@ -From 0edb5d3ffb56c75e2de6129b3ea8b22e746fbb66 Mon Sep 17 00:00:00 2001 +From becb7439eaa9ab67f5317a58dbe183bd94d4fcce Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Wed, 28 May 2025 18:39:38 +0800 Subject: fix lrcdec read line bug on osx @@ -8,7 +8,7 @@ Subject: fix lrcdec read line bug on osx 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/libavformat/lrcdec.c b/libavformat/lrcdec.c -index 1f96305693..b75866260d 100644 +index 1f96305..b758662 100644 --- a/libavformat/lrcdec.c +++ b/libavformat/lrcdec.c @@ -107,15 +107,17 @@ static int64_t read_line(AVBPrint *buf, AVIOContext *pb) diff --git a/patches/ffmpeg-n8.1.1/0012-avformat-mpegts-index-only-keyframes-to-ensure-accur.patch b/patches/ffmpeg-n8.1.1/0012-avformat-mpegts-index-only-keyframes-to-ensure-accur.patch index 1eab93d4c..6ccd438cd 100644 --- a/patches/ffmpeg-n8.1.1/0012-avformat-mpegts-index-only-keyframes-to-ensure-accur.patch +++ b/patches/ffmpeg-n8.1.1/0012-avformat-mpegts-index-only-keyframes-to-ensure-accur.patch @@ -1,4 +1,4 @@ -From 60a55d7df18fb383b3f393a2648a5802020bd0a7 Mon Sep 17 00:00:00 2001 +From 5aef56e86381c8151a63486524fd475536f64fe4 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Wed, 28 May 2025 18:48:39 +0800 Subject: avformat/mpegts: index only keyframes to ensure @@ -9,7 +9,7 @@ Subject: avformat/mpegts: index only keyframes to ensure 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c -index 4b326d309b..47944c7884 100644 +index 4b326d3..47944c7 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -158,6 +158,7 @@ struct MpegTSContext { diff --git a/patches/ffmpeg-n8.1.1/0014-Correct-the-wrong-codecpar-codec_id-which-read-from-.patch b/patches/ffmpeg-n8.1.1/0013-Correct-the-wrong-codecpar-codec_id-which-read-from-.patch similarity index 92% rename from patches/ffmpeg-n8.1.1/0014-Correct-the-wrong-codecpar-codec_id-which-read-from-.patch rename to patches/ffmpeg-n8.1.1/0013-Correct-the-wrong-codecpar-codec_id-which-read-from-.patch index ced8b16f6..609d2c426 100644 --- a/patches/ffmpeg-n8.1.1/0014-Correct-the-wrong-codecpar-codec_id-which-read-from-.patch +++ b/patches/ffmpeg-n8.1.1/0013-Correct-the-wrong-codecpar-codec_id-which-read-from-.patch @@ -1,4 +1,4 @@ -From f34b1dde280aa3ece94b7b8a79d1bbd683429f1e Mon Sep 17 00:00:00 2001 +From ccea039f4d65a0f46eaf8c316ed602b95b3f6b90 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Wed, 28 May 2025 18:52:01 +0800 Subject: Correct the wrong codecpar->codec_id which read from @@ -11,7 +11,7 @@ Subject: Correct the wrong codecpar->codec_id which read from 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c -index 5fc82ad9dc..4ae12b65e8 100644 +index 5fc82ad..4ae12b6 100644 --- a/libavformat/id3v2.c +++ b/libavformat/id3v2.c @@ -1187,8 +1187,13 @@ int ff_id3v2_parse_apic(AVFormatContext *s, ID3v2ExtraMeta *extra_meta) @@ -30,7 +30,7 @@ index 5fc82ad9dc..4ae12b65e8 100644 if (apic->description[0]) av_dict_set(&st->metadata, "title", apic->description, 0); diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c -index ecb7ea8946..0a26d5aa52 100644 +index ecb7ea8..0a26d5a 100644 --- a/libavformat/img2dec.c +++ b/libavformat/img2dec.c @@ -892,7 +892,7 @@ static int png_probe(const AVProbeData *p) @@ -43,7 +43,7 @@ index ecb7ea8946..0a26d5aa52 100644 return 0; } diff --git a/libavformat/mov.c b/libavformat/mov.c -index 222d79ec1f..e1147700d3 100644 +index 222d79e..e114770 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -259,7 +259,7 @@ static int mov_read_covr(MOVContext *c, AVIOContext *pb, int type, int len) diff --git a/patches/ffmpeg-n8.1.1/0015-fix-http-chunked-transfer-get-wrong-size-cause-av_re.patch b/patches/ffmpeg-n8.1.1/0014-fix-http-chunked-transfer-get-wrong-size-cause-av_re.patch similarity index 90% rename from patches/ffmpeg-n8.1.1/0015-fix-http-chunked-transfer-get-wrong-size-cause-av_re.patch rename to patches/ffmpeg-n8.1.1/0014-fix-http-chunked-transfer-get-wrong-size-cause-av_re.patch index b600bb227..8e52c2f14 100644 --- a/patches/ffmpeg-n8.1.1/0015-fix-http-chunked-transfer-get-wrong-size-cause-av_re.patch +++ b/patches/ffmpeg-n8.1.1/0014-fix-http-chunked-transfer-get-wrong-size-cause-av_re.patch @@ -1,4 +1,4 @@ -From 2e1aa0b9b5baf39c29b6c4e85fd26776badaba55 Mon Sep 17 00:00:00 2001 +From 74355a6170c59a122461ff0adeccaf178eeaf602 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Thu, 29 May 2025 08:56:02 +0800 Subject: fix http chunked transfer get wrong size cause @@ -9,7 +9,7 @@ Subject: fix http chunked transfer get wrong size cause 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c -index 0a26d5aa52..088c21907d 100644 +index 0a26d5a..088c219 100644 --- a/libavformat/img2dec.c +++ b/libavformat/img2dec.c @@ -451,7 +451,13 @@ int ff_img_read_packet(AVFormatContext *s1, AVPacket *pkt) diff --git a/patches/ffmpeg-n8.1.1/0016-not-very-useful-log-use-trace-level.patch b/patches/ffmpeg-n8.1.1/0015-not-very-useful-log-use-trace-level.patch similarity index 94% rename from patches/ffmpeg-n8.1.1/0016-not-very-useful-log-use-trace-level.patch rename to patches/ffmpeg-n8.1.1/0015-not-very-useful-log-use-trace-level.patch index 0951ba5cb..a729faba4 100644 --- a/patches/ffmpeg-n8.1.1/0016-not-very-useful-log-use-trace-level.patch +++ b/patches/ffmpeg-n8.1.1/0015-not-very-useful-log-use-trace-level.patch @@ -1,4 +1,4 @@ -From b5ff5beaad904e0b4f896c434d8ecb86df3f858c Mon Sep 17 00:00:00 2001 +From 6a0647fe06239adcca0d09afe5ac0e78cc0224aa Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Thu, 29 May 2025 09:02:16 +0800 Subject: not very useful log use trace level @@ -10,7 +10,7 @@ Subject: not very useful log use trace level 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/libavcodec/h2645_parse.c b/libavcodec/h2645_parse.c -index 659e818393..63f3460926 100644 +index 659e818..63f3460 100644 --- a/libavcodec/h2645_parse.c +++ b/libavcodec/h2645_parse.c @@ -417,7 +417,7 @@ static int vvc_parse_nal_header(H2645NAL *nal, void *logctx) @@ -41,7 +41,7 @@ index 659e818393..63f3460926 100644 nal->type, h264_nal_unit_name(nal->type), nal->ref_idc); diff --git a/libavcodec/h2645_vui.c b/libavcodec/h2645_vui.c -index 0e576c1563..445e471a2e 100644 +index 0e576c1..445e471 100644 --- a/libavcodec/h2645_vui.c +++ b/libavcodec/h2645_vui.c @@ -36,7 +36,7 @@ @@ -54,7 +54,7 @@ index 0e576c1563..445e471a2e 100644 vui->aspect_ratio_info_present_flag = get_bits1(gb); if (vui->aspect_ratio_info_present_flag) { diff --git a/libavformat/demux.c b/libavformat/demux.c -index 05ab1e172d..494e15f3c1 100644 +index 05ab1e1..494e15f 100644 --- a/libavformat/demux.c +++ b/libavformat/demux.c @@ -2074,11 +2074,11 @@ static void estimate_timings(AVFormatContext *ic, int64_t old_offset) diff --git a/patches/ffmpeg-n8.1.1/0017-Audio-Vivid-Parser-and-Demuxer-but-av3a-Decoder-is-a.patch b/patches/ffmpeg-n8.1.1/0016-Audio-Vivid-Parser-and-Demuxer-but-av3a-Decoder-is-a.patch similarity index 99% rename from patches/ffmpeg-n8.1.1/0017-Audio-Vivid-Parser-and-Demuxer-but-av3a-Decoder-is-a.patch rename to patches/ffmpeg-n8.1.1/0016-Audio-Vivid-Parser-and-Demuxer-but-av3a-Decoder-is-a.patch index 66c017ce7..2f94cc8b0 100644 --- a/patches/ffmpeg-n8.1.1/0017-Audio-Vivid-Parser-and-Demuxer-but-av3a-Decoder-is-a.patch +++ b/patches/ffmpeg-n8.1.1/0016-Audio-Vivid-Parser-and-Demuxer-but-av3a-Decoder-is-a.patch @@ -1,7 +1,8 @@ -From 9b4c7ec47cc92c98729805d02d0a375821ecb5a8 Mon Sep 17 00:00:00 2001 +From 0b9dacdb9282e956e0cecb0d7d5df7f5aa41f8cc Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Fri, 8 May 2026 19:00:36 +0800 -Subject: Audio Vivid Parser and Demuxer, but av3a Decoder is absent +Subject: Audio Vivid Parser and Demuxer, but av3a Decoder is + absent --- libavcodec/Makefile | 1 + diff --git a/patches/ffmpeg-n8.1.1/0018-http-add-reconnect_first_delay-opt.patch b/patches/ffmpeg-n8.1.1/0017-http-add-reconnect_first_delay-opt.patch similarity index 95% rename from patches/ffmpeg-n8.1.1/0018-http-add-reconnect_first_delay-opt.patch rename to patches/ffmpeg-n8.1.1/0017-http-add-reconnect_first_delay-opt.patch index 99c7aa086..23c0b615c 100644 --- a/patches/ffmpeg-n8.1.1/0018-http-add-reconnect_first_delay-opt.patch +++ b/patches/ffmpeg-n8.1.1/0017-http-add-reconnect_first_delay-opt.patch @@ -1,4 +1,4 @@ -From c6578110a2bf027b1fff7eb263c80499f2179584 Mon Sep 17 00:00:00 2001 +From 63de5ca190448e027cf758f548b2213095638bd6 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Thu, 29 May 2025 09:57:28 +0800 Subject: http add reconnect_first_delay opt @@ -8,7 +8,7 @@ Subject: http add reconnect_first_delay opt 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavformat/http.c b/libavformat/http.c -index f4bf225728..cd39796ab3 100644 +index f4bf225..cd39796 100644 --- a/libavformat/http.c +++ b/libavformat/http.c @@ -131,6 +131,7 @@ typedef struct HTTPContext { diff --git a/patches/ffmpeg-n8.1.1/0019-fix-http-open-and-http_seek-redirect-authentication-.patch b/patches/ffmpeg-n8.1.1/0018-fix-http-open-and-http_seek-redirect-authentication-.patch similarity index 97% rename from patches/ffmpeg-n8.1.1/0019-fix-http-open-and-http_seek-redirect-authentication-.patch rename to patches/ffmpeg-n8.1.1/0018-fix-http-open-and-http_seek-redirect-authentication-.patch index c296957a2..b5bfa7259 100644 --- a/patches/ffmpeg-n8.1.1/0019-fix-http-open-and-http_seek-redirect-authentication-.patch +++ b/patches/ffmpeg-n8.1.1/0018-fix-http-open-and-http_seek-redirect-authentication-.patch @@ -1,4 +1,4 @@ -From 637bd6415e37d86600aecb161d5a067cebc7cb69 Mon Sep 17 00:00:00 2001 +From 0eb8def6e29ed4193013c3f7c2a01acf7eb40b28 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Fri, 8 May 2026 17:47:08 +0800 Subject: fix http open and http_seek (redirect) authentication @@ -9,7 +9,7 @@ Subject: fix http open and http_seek (redirect) authentication 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/libavformat/http.c b/libavformat/http.c -index cd39796ab3..b648596d77 100644 +index cd39796..b648596 100644 --- a/libavformat/http.c +++ b/libavformat/http.c @@ -83,6 +83,7 @@ typedef struct HTTPContext { diff --git a/patches/ffmpeg-n8.1.1/0020-add-built-in-smb2-protocol-via-libsmb2.patch b/patches/ffmpeg-n8.1.1/0019-add-built-in-smb2-protocol-via-libsmb2.patch similarity index 98% rename from patches/ffmpeg-n8.1.1/0020-add-built-in-smb2-protocol-via-libsmb2.patch rename to patches/ffmpeg-n8.1.1/0019-add-built-in-smb2-protocol-via-libsmb2.patch index 3b3134af1..69938968f 100644 --- a/patches/ffmpeg-n8.1.1/0020-add-built-in-smb2-protocol-via-libsmb2.patch +++ b/patches/ffmpeg-n8.1.1/0019-add-built-in-smb2-protocol-via-libsmb2.patch @@ -1,4 +1,4 @@ -From 08d684edc3dd2fe28dbda3beaff216e2a235369e Mon Sep 17 00:00:00 2001 +From 633c6546e554aba1f6219f467b1759b6f39430a8 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Fri, 8 May 2026 17:58:33 +0800 Subject: add built-in smb2 protocol via libsmb2 @@ -12,7 +12,7 @@ Subject: add built-in smb2 protocol via libsmb2 create mode 100644 libavformat/libsmb2.c diff --git a/configure b/configure -index 1759694274..10c688ca4e 100755 +index 1759694..10c688c 100755 --- a/configure +++ b/configure @@ -276,6 +276,7 @@ External library support: @@ -49,7 +49,7 @@ index 1759694274..10c688ca4e 100755 enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr enabled libssh && require_pkg_config libssh "libssh >= 0.6.0" libssh/sftp.h sftp_init diff --git a/libavformat/Makefile b/libavformat/Makefile -index 158a11d10f..6100e33b30 100644 +index 158a11d..6100e33 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -751,6 +751,7 @@ OBJS-$(CONFIG_LIBRTMPS_PROTOCOL) += librtmp.o @@ -62,7 +62,7 @@ index 158a11d10f..6100e33b30 100644 OBJS-$(CONFIG_LIBZMQ_PROTOCOL) += libzmq.o diff --git a/libavformat/libsmb2.c b/libavformat/libsmb2.c new file mode 100644 -index 0000000000..408f9e1609 +index 0000000..408f9e1 --- /dev/null +++ b/libavformat/libsmb2.c @@ -0,0 +1,412 @@ @@ -479,7 +479,7 @@ index 0000000000..408f9e1609 + .url_close_dir = libsmb2_close_dir, +}; diff --git a/libavformat/protocols.c b/libavformat/protocols.c -index d1c1095364..fb712a5128 100644 +index d1c1095..fb712a5 100644 --- a/libavformat/protocols.c +++ b/libavformat/protocols.c @@ -75,6 +75,7 @@ extern const URLProtocol ff_librtmpte_protocol; diff --git a/patches/ffmpeg-n8.1.1/0021-URLProtocol-add-url_parse_priv-function-pointer.patch b/patches/ffmpeg-n8.1.1/0020-URLProtocol-add-url_parse_priv-function-pointer.patch similarity index 92% rename from patches/ffmpeg-n8.1.1/0021-URLProtocol-add-url_parse_priv-function-pointer.patch rename to patches/ffmpeg-n8.1.1/0020-URLProtocol-add-url_parse_priv-function-pointer.patch index 493479d08..1639144d4 100644 --- a/patches/ffmpeg-n8.1.1/0021-URLProtocol-add-url_parse_priv-function-pointer.patch +++ b/patches/ffmpeg-n8.1.1/0020-URLProtocol-add-url_parse_priv-function-pointer.patch @@ -1,4 +1,4 @@ -From 6f63a6880358a91c79119e58cac80179a1d37a73 Mon Sep 17 00:00:00 2001 +From 861f2778fd0f40ec42a2dd1827afe0fc11786e32 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Thu, 29 May 2025 11:14:13 +0800 Subject: URLProtocol add url_parse_priv function pointer @@ -9,7 +9,7 @@ Subject: URLProtocol add url_parse_priv function pointer 2 files changed, 13 insertions(+) diff --git a/libavformat/demux.c b/libavformat/demux.c -index 494e15f3c1..524018f1aa 100644 +index 494e15f..524018f 100644 --- a/libavformat/demux.c +++ b/libavformat/demux.c @@ -355,6 +355,17 @@ int avformat_open_input(AVFormatContext **ps, const char *filename, @@ -31,7 +31,7 @@ index 494e15f3c1..524018f1aa 100644 goto close; diff --git a/libavformat/url.h b/libavformat/url.h -index 53c6f13d23..f7e5bb2a95 100644 +index 53c6f13..f7e5bb2 100644 --- a/libavformat/url.h +++ b/libavformat/url.h @@ -48,6 +48,7 @@ typedef struct URLContext { diff --git a/patches/ffmpeg-n8.1.1/0022-bluray-protocol-add-dvd-fallback.patch b/patches/ffmpeg-n8.1.1/0021-bluray-protocol-add-dvd-fallback.patch similarity index 94% rename from patches/ffmpeg-n8.1.1/0022-bluray-protocol-add-dvd-fallback.patch rename to patches/ffmpeg-n8.1.1/0021-bluray-protocol-add-dvd-fallback.patch index d212a63ac..e95664bac 100644 --- a/patches/ffmpeg-n8.1.1/0022-bluray-protocol-add-dvd-fallback.patch +++ b/patches/ffmpeg-n8.1.1/0021-bluray-protocol-add-dvd-fallback.patch @@ -1,4 +1,4 @@ -From a58c1231a04f47af13819d9091acd33ac5a8c991 Mon Sep 17 00:00:00 2001 +From da901ac77bf2a238a947809aa1b276a13af6e055 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Thu, 29 May 2025 11:15:16 +0800 Subject: bluray protocol add dvd fallback @@ -8,7 +8,7 @@ Subject: bluray protocol add dvd fallback 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/libavformat/demux.c b/libavformat/demux.c -index 524018f1aa..531992f9d9 100644 +index 524018f..531992f 100644 --- a/libavformat/demux.c +++ b/libavformat/demux.c @@ -161,7 +161,8 @@ static int init_input(AVFormatContext *s, const char *filename, diff --git a/patches/ffmpeg-n8.1.1/0023-custom-bluray-fs-for-network-Blu-ray-Disc-and-BDMV.patch b/patches/ffmpeg-n8.1.1/0022-custom-bluray-fs-for-network-Blu-ray-Disc-and-BDMV.patch similarity index 99% rename from patches/ffmpeg-n8.1.1/0023-custom-bluray-fs-for-network-Blu-ray-Disc-and-BDMV.patch rename to patches/ffmpeg-n8.1.1/0022-custom-bluray-fs-for-network-Blu-ray-Disc-and-BDMV.patch index 457ec4be4..283624f95 100644 --- a/patches/ffmpeg-n8.1.1/0023-custom-bluray-fs-for-network-Blu-ray-Disc-and-BDMV.patch +++ b/patches/ffmpeg-n8.1.1/0022-custom-bluray-fs-for-network-Blu-ray-Disc-and-BDMV.patch @@ -1,7 +1,7 @@ -From eb2726a246f316be45dc5b1b534e581c4d432592 Mon Sep 17 00:00:00 2001 +From 016c42a6ca0b61fef87a703b7e71765af8abc501 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Fri, 15 May 2026 17:00:02 +0800 -Subject: [PATCH] custom bluray fs for network Blu-ray Disc and BDMV +Subject: custom bluray fs for network Blu-ray Disc and BDMV --- libavformat/Makefile | 2 +- diff --git a/patches/ffmpeg-n8.1.1/0024-bluray-open-and-find-the-right-m2ts-then-read-seek-i.patch b/patches/ffmpeg-n8.1.1/0023-bluray-open-and-find-the-right-m2ts-then-read-seek-i.patch similarity index 82% rename from patches/ffmpeg-n8.1.1/0024-bluray-open-and-find-the-right-m2ts-then-read-seek-i.patch rename to patches/ffmpeg-n8.1.1/0023-bluray-open-and-find-the-right-m2ts-then-read-seek-i.patch index a6591dfa4..28afb7341 100644 --- a/patches/ffmpeg-n8.1.1/0024-bluray-open-and-find-the-right-m2ts-then-read-seek-i.patch +++ b/patches/ffmpeg-n8.1.1/0023-bluray-open-and-find-the-right-m2ts-then-read-seek-i.patch @@ -1,7 +1,7 @@ -From 6e7abe54b59f8227df2c1149665b314cd2ac5892 Mon Sep 17 00:00:00 2001 +From afbd088c5f65683f1edb1383224eeddbc4bf718b Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Tue, 12 May 2026 11:45:56 +0800 -Subject: [PATCH] bluray open and find the right m2ts, then read/seek it +Subject: bluray open and find the right m2ts, then read/seek it direactly instread of bluray logic. --- @@ -9,7 +9,7 @@ Subject: [PATCH] bluray open and find the right m2ts, then read/seek it 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/libavformat/bluray.c b/libavformat/bluray.c -index cd50523..7fdffdd 100644 +index eb43340..254538f 100644 --- a/libavformat/bluray.c +++ b/libavformat/bluray.c @@ -42,6 +42,7 @@ typedef struct { @@ -20,7 +20,7 @@ index cd50523..7fdffdd 100644 } BlurayContext; #define OFFSET(x) offsetof(BlurayContext, x) -@@ -222,7 +223,8 @@ static int bluray_open(URLContext *h, const char *path, int flags, AVDictionary +@@ -226,7 +227,8 @@ static int bluray_open(URLContext *h, const char *path, int flags, AVDictionary if (bd->chapter > 1) { bd_seek_chapter(bd->bd, bd->chapter - 1); } @@ -30,7 +30,7 @@ index cd50523..7fdffdd 100644 return 0; } -@@ -234,7 +236,13 @@ static int bluray_read(URLContext *h, unsigned char *buf, int size) +@@ -238,7 +240,13 @@ static int bluray_read(URLContext *h, unsigned char *buf, int size) if (!bd || !bd->bd) { return AVERROR(EFAULT); } @@ -45,7 +45,7 @@ index cd50523..7fdffdd 100644 len = bd_read(bd->bd, buf, size); return len == 0 ? AVERROR_EOF : len; -@@ -252,10 +260,17 @@ static int64_t bluray_seek(URLContext *h, int64_t pos, int whence) +@@ -256,10 +264,17 @@ static int64_t bluray_seek(URLContext *h, int64_t pos, int whence) case SEEK_SET: case SEEK_CUR: case SEEK_END: diff --git a/patches/ffmpeg-n8.1.1/0025-fix-android-ffmpeg7-test.c-1-10-fatal-error-libxml2-.patch b/patches/ffmpeg-n8.1.1/0024-fix-android-ffmpeg7-test.c-1-10-fatal-error-libxml2-.patch similarity index 93% rename from patches/ffmpeg-n8.1.1/0025-fix-android-ffmpeg7-test.c-1-10-fatal-error-libxml2-.patch rename to patches/ffmpeg-n8.1.1/0024-fix-android-ffmpeg7-test.c-1-10-fatal-error-libxml2-.patch index 9c15a61f8..6095da59e 100644 --- a/patches/ffmpeg-n8.1.1/0025-fix-android-ffmpeg7-test.c-1-10-fatal-error-libxml2-.patch +++ b/patches/ffmpeg-n8.1.1/0024-fix-android-ffmpeg7-test.c-1-10-fatal-error-libxml2-.patch @@ -1,4 +1,4 @@ -From 7bef6e629786e43b24ce6b91678de69be4153768 Mon Sep 17 00:00:00 2001 +From 6e2fc211aad20c73775334f040fbab8543236672 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Fri, 6 Jun 2025 14:09:50 +0800 Subject: fix android ffmpeg7 test.c:1:10: fatal error: @@ -9,7 +9,7 @@ Subject: fix android ffmpeg7 test.c:1:10: fatal error: 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure -index 10c688ca4e..9761c84bd3 100755 +index 10c688c..9761c84 100755 --- a/configure +++ b/configure @@ -7448,7 +7448,7 @@ enabled libzmq && require_pkg_config libzmq "libzmq >= 4.2.1" zmq.h z diff --git a/patches/ffmpeg-n8.1.1/0026-fix-dash-init-fragment-url-is-invalid-truncated-bug.patch b/patches/ffmpeg-n8.1.1/0025-fix-dash-init-fragment-url-is-invalid-truncated-bug.patch similarity index 92% rename from patches/ffmpeg-n8.1.1/0026-fix-dash-init-fragment-url-is-invalid-truncated-bug.patch rename to patches/ffmpeg-n8.1.1/0025-fix-dash-init-fragment-url-is-invalid-truncated-bug.patch index 5f23a4fe8..c57a757ed 100644 --- a/patches/ffmpeg-n8.1.1/0026-fix-dash-init-fragment-url-is-invalid-truncated-bug.patch +++ b/patches/ffmpeg-n8.1.1/0025-fix-dash-init-fragment-url-is-invalid-truncated-bug.patch @@ -1,4 +1,4 @@ -From 570be1565c563c878856ec79f6276ec66e7de24d Mon Sep 17 00:00:00 2001 +From 83bd2fe0fa738f659c59d28cc484501d7260913a Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Wed, 21 May 2025 18:05:52 +0800 Subject: fix dash init fragment url is "invalid:truncated" bug @@ -8,7 +8,7 @@ Subject: fix dash init fragment url is "invalid:truncated" bug 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c -index 9a2ea78149..5927a6ee3b 100644 +index 9a2ea78..5927a6e 100644 --- a/libavformat/dashdec.c +++ b/libavformat/dashdec.c @@ -479,6 +479,10 @@ static char *get_content_url(xmlNodePtr *baseurl_nodes, diff --git a/patches/ffmpeg-n8.1.1/0027-add-webp-demuxer-and-libwebp-decoder.patch b/patches/ffmpeg-n8.1.1/0026-add-webp-demuxer-and-libwebp-decoder.patch similarity index 99% rename from patches/ffmpeg-n8.1.1/0027-add-webp-demuxer-and-libwebp-decoder.patch rename to patches/ffmpeg-n8.1.1/0026-add-webp-demuxer-and-libwebp-decoder.patch index 1166f15e2..2e6de76aa 100644 --- a/patches/ffmpeg-n8.1.1/0027-add-webp-demuxer-and-libwebp-decoder.patch +++ b/patches/ffmpeg-n8.1.1/0026-add-webp-demuxer-and-libwebp-decoder.patch @@ -1,4 +1,4 @@ -From b47d0c10a29d73b1b01fa945998a590070dc2a79 Mon Sep 17 00:00:00 2001 +From 2ca732722b9799c24fd1589ab960f18b1c8108fd Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Fri, 8 May 2026 19:02:39 +0800 Subject: add webp demuxer and libwebp decoder From 1c72b7bdd41dd29aba76fa10e96104e24b5cbcc9 Mon Sep 17 00:00:00 2001 From: Anka Date: Fri, 15 May 2026 12:47:53 +0000 Subject: [PATCH 344/359] upgrade ffmpeg8 to ffmpeg8-8.1.1-260515202139 for apple by cd --- configs/libs/ffmpeg8.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configs/libs/ffmpeg8.sh b/configs/libs/ffmpeg8.sh index e0c97527a..b1dfe8f2e 100644 --- a/configs/libs/ffmpeg8.sh +++ b/configs/libs/ffmpeg8.sh @@ -36,6 +36,6 @@ fi # pre compiled -export PRE_COMPILE_TAG_IOS=ffmpeg8-8.1.1-260509171248 -export PRE_COMPILE_TAG_MACOS=ffmpeg8-8.1.1-260509171248 -export PRE_COMPILE_TAG_TVOS=ffmpeg8-8.1.1-260509171248 +export PRE_COMPILE_TAG_IOS=ffmpeg8-8.1.1-260515202139 +export PRE_COMPILE_TAG_MACOS=ffmpeg8-8.1.1-260515202139 +export PRE_COMPILE_TAG_TVOS=ffmpeg8-8.1.1-260515202139 From c3dee932f7bd71e2b7a2492ce7955641ac02b423 Mon Sep 17 00:00:00 2001 From: debugly Date: Fri, 22 May 2026 22:59:37 +0800 Subject: [PATCH 345/359] fix android build error --- tools/export-android-build-env.sh | 9 +++++++++ tools/export-android-host-env.sh | 17 +++++++++++++---- tools/export-android-pkg-config-dir.sh | 2 +- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/tools/export-android-build-env.sh b/tools/export-android-build-env.sh index 8d2d6f3e8..f9a667fc3 100755 --- a/tools/export-android-build-env.sh +++ b/tools/export-android-build-env.sh @@ -32,11 +32,20 @@ case $_MR_ARCH in export MR_ANDROID_ABI=x86 ;; x86_64) + # -lt 代表 less than(小于) + if [[ $MR_ANDROID_API -lt 21 ]]; then + export MR_ANDROID_API=21 + fi export MR_TRIPLE=x86_64-linux-android$MR_ANDROID_API export MR_FF_ARCH=x86_64 export MR_ANDROID_ABI=x86_64 ;; arm64*) + # 64 位 ARM 架构是从 Android 5.0(API 21)才开始诞生的 + # -lt 代表 less than(小于) + if [[ $MR_ANDROID_API -lt 21 ]]; then + export MR_ANDROID_API=21 + fi export MR_TRIPLE=aarch64-linux-android$MR_ANDROID_API export MR_FF_ARCH=aarch64 export MR_ANDROID_ABI=arm64-v8a diff --git a/tools/export-android-host-env.sh b/tools/export-android-host-env.sh index 28dd54c42..e6fcd35a6 100644 --- a/tools/export-android-host-env.sh +++ b/tools/export-android-host-env.sh @@ -19,10 +19,19 @@ function install_depends() { local name="$1" - local r=$(brew list | grep "$name") - if [[ -z $r ]]; then - echo "will use brew install ${name}." - brew install "$name" + if command -v "$name" &> /dev/null; then + echo "[✅] ${name}: $(eval $name --version | head -n 1)" + return 0 + else + if [[ "$name" == "rustup" || "$name" == "cargo" ]]; then + echo "will install rustup-init." + brew install rustup-init + rustup-init -y + return 0 + else + echo "will use brew install ${name}." + brew install "$name" + fi fi echo "[✅] ${name}: $(eval $name --version)" } diff --git a/tools/export-android-pkg-config-dir.sh b/tools/export-android-pkg-config-dir.sh index 64d76a98f..74c428606 100644 --- a/tools/export-android-pkg-config-dir.sh +++ b/tools/export-android-pkg-config-dir.sh @@ -27,7 +27,7 @@ else uni_dir="${MR_UNI_PROD_DIR}" fi -for dir in `[ -d ${uni_dir} ] && find "${uni_dir}" -type f -name "*.pc" | grep "$_MR_ARCH\/" | xargs dirname | uniq` ; +for dir in `[ -d ${uni_dir} ] && find "${uni_dir}" -type f -name "*.pc" | grep "$_MR_ARCH\/" | xargs -n 1 dirname | uniq` ; do if [[ $pkg_cfg_dir ]];then pkg_cfg_dir="${pkg_cfg_dir}:${dir}" From e2dafb4843b2843abeed8cb5c769339241ee05af Mon Sep 17 00:00:00 2001 From: debugly Date: Wed, 3 Jun 2026 22:20:55 +0800 Subject: [PATCH 346/359] gradle read form sdkFolder only (cherry picked from commit 1f63da08ef5d07ac51142b232039dca83a32a96b) --- .github/workflows/build all libs.yml | 1 + .github/workflows/build custom libs.yml | 1 + .github/workflows/build one lib.yml | 1 + 3 files changed, 3 insertions(+) diff --git a/.github/workflows/build all libs.yml b/.github/workflows/build all libs.yml index ef0b9a739..2fad21cb1 100644 --- a/.github/workflows/build all libs.yml +++ b/.github/workflows/build all libs.yml @@ -94,6 +94,7 @@ jobs: with: ndk-version: r27c add-to-path: true + link-to-sdk: true local-cache: false - name: Checkout code uses: actions/checkout@v4 diff --git a/.github/workflows/build custom libs.yml b/.github/workflows/build custom libs.yml index 367d0ef92..9ff157dcc 100644 --- a/.github/workflows/build custom libs.yml +++ b/.github/workflows/build custom libs.yml @@ -62,6 +62,7 @@ jobs: with: ndk-version: r27c add-to-path: true + link-to-sdk: true local-cache: false - name: Checkout code uses: actions/checkout@v4 diff --git a/.github/workflows/build one lib.yml b/.github/workflows/build one lib.yml index 336ff1688..07c494b0a 100644 --- a/.github/workflows/build one lib.yml +++ b/.github/workflows/build one lib.yml @@ -97,6 +97,7 @@ jobs: with: ndk-version: r27c add-to-path: true + link-to-sdk: true local-cache: false - name: Checkout code uses: actions/checkout@v4 From 92e8f40cfc1afbfb0612795ecb581c9ae2908984 Mon Sep 17 00:00:00 2001 From: debugly Date: Wed, 24 Jun 2026 22:57:35 +0800 Subject: [PATCH 347/359] ffmpeg 8 try upgrade to n8.1.2 --- configs/libs/ffmpeg8.sh | 6 +++--- patches/ffmpeg-n8.1.2 | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) create mode 120000 patches/ffmpeg-n8.1.2 diff --git a/configs/libs/ffmpeg8.sh b/configs/libs/ffmpeg8.sh index b1dfe8f2e..b33d843ae 100644 --- a/configs/libs/ffmpeg8.sh +++ b/configs/libs/ffmpeg8.sh @@ -23,9 +23,9 @@ export LIPO_LIBS="libavcodec libavformat libavutil libswscale libswresample liba export LIB_DEPENDS_BIN="nasm pkg-config" export GIT_LOCAL_REPO=extra/ffmpeg export REPO_DIR=ffmpeg8 -export PATCH_DIR=../../patches/ffmpeg-n8.1.1 -export GIT_COMMIT=n8.1.1 -export GIT_REPO_VERSION=8.1.1 +export PATCH_DIR=../../patches/ffmpeg-n8.1.2 +export GIT_COMMIT=n8.1.2 +export GIT_REPO_VERSION=8.1.2 # you can export GIT_FFMPEG_UPSTREAM=git@xx:yy/FFmpeg.git use your mirror if [[ "$GIT_FFMPEG_UPSTREAM" != "" ]] ;then diff --git a/patches/ffmpeg-n8.1.2 b/patches/ffmpeg-n8.1.2 new file mode 120000 index 000000000..c0632a835 --- /dev/null +++ b/patches/ffmpeg-n8.1.2 @@ -0,0 +1 @@ +ffmpeg-n8.1.1 \ No newline at end of file From 0039fadda1b2e6e3cf01564f227cf136e96b7cd6 Mon Sep 17 00:00:00 2001 From: debugly Date: Wed, 24 Jun 2026 23:03:17 +0800 Subject: [PATCH 348/359] only build android need setup ndk --- .github/workflows/build all libs.yml | 3 +++ .github/workflows/build custom libs.yml | 3 +++ .github/workflows/build one lib.yml | 3 +++ 3 files changed, 9 insertions(+) diff --git a/.github/workflows/build all libs.yml b/.github/workflows/build all libs.yml index 2fad21cb1..bf027007d 100644 --- a/.github/workflows/build all libs.yml +++ b/.github/workflows/build all libs.yml @@ -91,6 +91,9 @@ jobs: steps: - uses: nttld/setup-ndk@v1 id: setup-ndk + if: | + github.event.inputs.platform == 'all' || + github.event.inputs.platform == 'android' with: ndk-version: r27c add-to-path: true diff --git a/.github/workflows/build custom libs.yml b/.github/workflows/build custom libs.yml index 9ff157dcc..58928d1c4 100644 --- a/.github/workflows/build custom libs.yml +++ b/.github/workflows/build custom libs.yml @@ -59,6 +59,9 @@ jobs: steps: - uses: nttld/setup-ndk@v1 id: setup-ndk + if: | + github.event.inputs.platform == 'all' || + github.event.inputs.platform == 'android' with: ndk-version: r27c add-to-path: true diff --git a/.github/workflows/build one lib.yml b/.github/workflows/build one lib.yml index 07c494b0a..f6eaaf8b6 100644 --- a/.github/workflows/build one lib.yml +++ b/.github/workflows/build one lib.yml @@ -94,6 +94,9 @@ jobs: steps: - uses: nttld/setup-ndk@v1 id: setup-ndk + if: | + github.event.inputs.platform == 'all' || + github.event.inputs.platform == 'android' with: ndk-version: r27c add-to-path: true From 6fbc95f7d7d2f4c5d16c409efcfd54848d6e8a94 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Thu, 25 Jun 2026 14:20:00 +0800 Subject: [PATCH 349/359] add ffmpeg n8.1.2 patches --- patches/ffmpeg-n8.1.2 | 1 - ...-h264_ps-null-pointer-fault-tolerant.patch | 52 + ...format-add-application-and-dns_cache.patch | 671 +++++++++ .../0003-restore-ijk-http-event-hooks.patch | 278 ++++ .../0004-restore-ijk-tcp-dns-cache.patch | 404 +++++ ...om-protocols-and-demuxers-except-lon.patch | 277 ++++ ...-add-4-dummy-ijkplaceholder-demuxers.patch | 41 + .../0007-add-3-dummy-ijkhttp-protocols.patch | 41 + ...ict_get-that-converts-the-value-to-a.patch | 91 ++ ...tp-impl-was-used-by-set-selected_htt.patch | 129 ++ ...kable-value-range-0-means-streamed-c.patch | 26 + ...0011-fix-lrcdec-read-line-bug-on-osx.patch | 43 + ...index-only-keyframes-to-ensure-accur.patch | 47 + ...g-codecpar-codec_id-which-read-from-.patch | 60 + ...-transfer-get-wrong-size-cause-av_re.patch | 32 + ...-not-very-useful-log-use-trace-level.patch | 76 + ...er-and-Demuxer-but-av3a-Decoder-is-a.patch | 1341 +++++++++++++++++ ...7-http-add-reconnect_first_delay-opt.patch | 41 + ...d-http_seek-redirect-authentication-.patch | 102 ++ ...d-built-in-smb2-protocol-via-libsmb2.patch | 495 ++++++ ...-add-url_parse_priv-function-pointer.patch | 55 + ...021-bluray-protocol-add-dvd-fallback.patch | 54 + ...fs-for-network-Blu-ray-Disc-and-BDMV.patch | 744 +++++++++ ...find-the-right-m2ts-then-read-seek-i.patch | 71 + ...eg7-test.c-1-10-fatal-error-libxml2-.patch | 26 + ...ragment-url-is-invalid-truncated-bug.patch | 43 + ...add-webp-demuxer-and-libwebp-decoder.patch | 804 ++++++++++ 27 files changed, 6044 insertions(+), 1 deletion(-) delete mode 120000 patches/ffmpeg-n8.1.2 create mode 100644 patches/ffmpeg-n8.1.2/0001-restore-ijk-h264_ps-null-pointer-fault-tolerant.patch create mode 100644 patches/ffmpeg-n8.1.2/0002-restore-ijk-avformat-add-application-and-dns_cache.patch create mode 100644 patches/ffmpeg-n8.1.2/0003-restore-ijk-http-event-hooks.patch create mode 100644 patches/ffmpeg-n8.1.2/0004-restore-ijk-tcp-dns-cache.patch create mode 100644 patches/ffmpeg-n8.1.2/0005-restore-ijk-custom-protocols-and-demuxers-except-lon.patch create mode 100644 patches/ffmpeg-n8.1.2/0006-add-4-dummy-ijkplaceholder-demuxers.patch create mode 100644 patches/ffmpeg-n8.1.2/0007-add-3-dummy-ijkhttp-protocols.patch create mode 100644 patches/ffmpeg-n8.1.2/0008-restore-ijk-av_dict_get-that-converts-the-value-to-a.patch create mode 100644 patches/ffmpeg-n8.1.2/0009-control-which-http-impl-was-used-by-set-selected_htt.patch create mode 100644 patches/ffmpeg-n8.1.2/0010-correct-file-seekable-value-range-0-means-streamed-c.patch create mode 100644 patches/ffmpeg-n8.1.2/0011-fix-lrcdec-read-line-bug-on-osx.patch create mode 100644 patches/ffmpeg-n8.1.2/0012-avformat-mpegts-index-only-keyframes-to-ensure-accur.patch create mode 100644 patches/ffmpeg-n8.1.2/0013-Correct-the-wrong-codecpar-codec_id-which-read-from-.patch create mode 100644 patches/ffmpeg-n8.1.2/0014-fix-http-chunked-transfer-get-wrong-size-cause-av_re.patch create mode 100644 patches/ffmpeg-n8.1.2/0015-not-very-useful-log-use-trace-level.patch create mode 100644 patches/ffmpeg-n8.1.2/0016-Audio-Vivid-Parser-and-Demuxer-but-av3a-Decoder-is-a.patch create mode 100644 patches/ffmpeg-n8.1.2/0017-http-add-reconnect_first_delay-opt.patch create mode 100644 patches/ffmpeg-n8.1.2/0018-fix-http-open-and-http_seek-redirect-authentication-.patch create mode 100644 patches/ffmpeg-n8.1.2/0019-add-built-in-smb2-protocol-via-libsmb2.patch create mode 100644 patches/ffmpeg-n8.1.2/0020-URLProtocol-add-url_parse_priv-function-pointer.patch create mode 100644 patches/ffmpeg-n8.1.2/0021-bluray-protocol-add-dvd-fallback.patch create mode 100644 patches/ffmpeg-n8.1.2/0022-custom-bluray-fs-for-network-Blu-ray-Disc-and-BDMV.patch create mode 100644 patches/ffmpeg-n8.1.2/0023-bluray-open-and-find-the-right-m2ts-then-read-seek-i.patch create mode 100644 patches/ffmpeg-n8.1.2/0024-fix-android-ffmpeg7-test.c-1-10-fatal-error-libxml2-.patch create mode 100644 patches/ffmpeg-n8.1.2/0025-fix-dash-init-fragment-url-is-invalid-truncated-bug.patch create mode 100644 patches/ffmpeg-n8.1.2/0026-add-webp-demuxer-and-libwebp-decoder.patch diff --git a/patches/ffmpeg-n8.1.2 b/patches/ffmpeg-n8.1.2 deleted file mode 120000 index c0632a835..000000000 --- a/patches/ffmpeg-n8.1.2 +++ /dev/null @@ -1 +0,0 @@ -ffmpeg-n8.1.1 \ No newline at end of file diff --git a/patches/ffmpeg-n8.1.2/0001-restore-ijk-h264_ps-null-pointer-fault-tolerant.patch b/patches/ffmpeg-n8.1.2/0001-restore-ijk-h264_ps-null-pointer-fault-tolerant.patch new file mode 100644 index 000000000..d7deded1d --- /dev/null +++ b/patches/ffmpeg-n8.1.2/0001-restore-ijk-h264_ps-null-pointer-fault-tolerant.patch @@ -0,0 +1,52 @@ +From 21a946850b1be93508b3d2d4478e60d347d9993f Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Wed, 28 May 2025 17:28:22 +0800 +Subject: restore ijk h264_ps null pointer fault tolerant + +--- + libavcodec/h264_ps.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/libavcodec/h264_ps.c b/libavcodec/h264_ps.c +index ac20417..2c35e0d 100644 +--- a/libavcodec/h264_ps.c ++++ b/libavcodec/h264_ps.c +@@ -437,7 +437,7 @@ int ff_h264_decode_seq_parameter_set(GetBitContext *gb, AVCodecContext *avctx, + } + + sps->ref_frame_count = get_ue_golomb_31(gb); +- if (avctx->codec_tag == MKTAG('S', 'M', 'V', '2')) ++ if (avctx && avctx->codec_tag == MKTAG('S', 'M', 'V', '2')) + sps->ref_frame_count = FFMAX(2, sps->ref_frame_count); + if (sps->ref_frame_count > H264_MAX_DPB_FRAMES) { + av_log(avctx, AV_LOG_ERROR, +@@ -480,7 +480,7 @@ int ff_h264_decode_seq_parameter_set(GetBitContext *gb, AVCodecContext *avctx, + int width = 16 * sps->mb_width; + int height = 16 * sps->mb_height; + +- if (avctx->flags2 & AV_CODEC_FLAG2_IGNORE_CROP) { ++ if (avctx && avctx->flags2 & AV_CODEC_FLAG2_IGNORE_CROP) { + av_log(avctx, AV_LOG_DEBUG, "discarding sps cropping, original " + "values are l:%d r:%d t:%d b:%d\n", + crop_left, crop_right, crop_top, crop_bottom); +@@ -552,7 +552,7 @@ int ff_h264_decode_seq_parameter_set(GetBitContext *gb, AVCodecContext *avctx, + if (!sps->vui.sar.den) + sps->vui.sar.den = 1; + +- if (avctx->debug & FF_DEBUG_PICT_INFO) { ++ if (avctx && avctx->debug & FF_DEBUG_PICT_INFO) { + static const char csp[4][5] = { "Gray", "420", "422", "444" }; + av_log(avctx, AV_LOG_DEBUG, + "sps:%u profile:%d/%d poc:%d ref:%d %dx%d %s %s crop:%u/%u/%u/%u %s %s %"PRId32"/%"PRId32" b%d reo:%d\n", +@@ -819,7 +819,7 @@ int ff_h264_decode_picture_parameter_set(GetBitContext *gb, AVCodecContext *avct + if (pps->chroma_qp_index_offset[0] != pps->chroma_qp_index_offset[1]) + pps->chroma_qp_diff = 1; + +- if (avctx->debug & FF_DEBUG_PICT_INFO) { ++ if (avctx && avctx->debug & FF_DEBUG_PICT_INFO) { + av_log(avctx, AV_LOG_DEBUG, + "pps:%u sps:%u %s slice_groups:%d ref:%u/%u %s qp:%d/%d/%d/%d %s %s %s %s\n", + pps_id, pps->sps_id, +-- +2.50.1 (Apple Git-155) + diff --git a/patches/ffmpeg-n8.1.2/0002-restore-ijk-avformat-add-application-and-dns_cache.patch b/patches/ffmpeg-n8.1.2/0002-restore-ijk-avformat-add-application-and-dns_cache.patch new file mode 100644 index 000000000..9e2745720 --- /dev/null +++ b/patches/ffmpeg-n8.1.2/0002-restore-ijk-avformat-add-application-and-dns_cache.patch @@ -0,0 +1,671 @@ +From c4bfe93521942a600c8ba3e477b74aca1d8c745d Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Fri, 8 May 2026 15:58:55 +0800 +Subject: restore ijk avformat add application and dns_cache + +--- + libavformat/Makefile | 5 + + libavformat/application.c | 213 ++++++++++++++++++++++++++++++++++ + libavformat/application.h | 120 ++++++++++++++++++++ + libavformat/dns_cache.c | 232 ++++++++++++++++++++++++++++++++++++++ + libavformat/dns_cache.h | 39 +++++++ + 5 files changed, 609 insertions(+) + create mode 100644 libavformat/application.c + create mode 100644 libavformat/application.h + create mode 100644 libavformat/dns_cache.c + create mode 100644 libavformat/dns_cache.h + +diff --git a/libavformat/Makefile b/libavformat/Makefile +index 4786a93..3c95fc4 100644 +--- a/libavformat/Makefile ++++ b/libavformat/Makefile +@@ -5,6 +5,9 @@ HEADERS = avformat.h \ + avio.h \ + version.h \ + version_major.h \ ++ application.h \ ++ dns_cache.h \ ++ + + OBJS = allformats.o \ + av1.o \ +@@ -35,6 +38,8 @@ OBJS = allformats.o \ + utils.o \ + version.o \ + vpcc.o \ ++ application.o \ ++ dns_cache.o \ + + OBJS-$(HAVE_LIBC_MSVCRT) += file_open.o + +diff --git a/libavformat/application.c b/libavformat/application.c +new file mode 100644 +index 0000000..de093b9 +--- /dev/null ++++ b/libavformat/application.c +@@ -0,0 +1,213 @@ ++/* ++ * copyright (c) 2016 Zhang Rui ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#include "application.h" ++#include "libavformat/network.h" ++#include "libavutil/avstring.h" ++#include "libavutil/mem.h" ++ ++static int av_application_alloc(AVApplicationContext **ph, void *opaque) ++{ ++ AVApplicationContext *h = NULL; ++ ++ h = av_mallocz(sizeof(AVApplicationContext)); ++ if (!h) ++ return AVERROR(ENOMEM); ++ ++ h->opaque = opaque; ++ ++ *ph = h; ++ return 0; ++} ++ ++int av_application_open(AVApplicationContext **ph, void *opaque) ++{ ++ int ret = av_application_alloc(ph, opaque); ++ if (ret) ++ return ret; ++ ++ return 0; ++} ++ ++static void av_application_close(AVApplicationContext *h) ++{ ++ av_free(h); ++} ++ ++void av_application_closep(AVApplicationContext **ph) ++{ ++ if (!ph || !*ph) ++ return; ++ ++ av_application_close(*ph); ++ *ph = NULL; ++} ++ ++void av_application_on_http_event(AVApplicationContext *h, int event_type, AVAppHttpEvent *event) ++{ ++ if (h && h->func_on_app_event) ++ h->func_on_app_event(h, event_type, (void *)event, sizeof(AVAppHttpEvent)); ++} ++ ++void av_application_will_http_open(AVApplicationContext *h, void *obj, const char *url) ++{ ++ AVAppHttpEvent event = {0}; ++ ++ if (!h || !obj || !url) ++ return; ++ ++ event.obj = obj; ++ av_strlcpy(event.url, url, sizeof(event.url)); ++ ++ av_application_on_http_event(h, AVAPP_EVENT_WILL_HTTP_OPEN, &event); ++} ++ ++void av_application_did_http_open(AVApplicationContext *h, void *obj, const char *url, int error, int http_code, int64_t filesize) ++{ ++ AVAppHttpEvent event = {0}; ++ ++ if (!h || !obj || !url) ++ return; ++ ++ event.obj = obj; ++ av_strlcpy(event.url, url, sizeof(event.url)); ++ event.error = error; ++ event.http_code = http_code; ++ event.filesize = filesize; ++ ++ av_application_on_http_event(h, AVAPP_EVENT_DID_HTTP_OPEN, &event); ++} ++ ++void av_application_will_http_seek(AVApplicationContext *h, void *obj, const char *url, int64_t offset) ++{ ++ AVAppHttpEvent event = {0}; ++ ++ if (!h || !obj || !url) ++ return; ++ ++ event.obj = obj; ++ event.offset = offset; ++ av_strlcpy(event.url, url, sizeof(event.url)); ++ ++ av_application_on_http_event(h, AVAPP_EVENT_WILL_HTTP_SEEK, &event); ++} ++ ++void av_application_did_http_seek(AVApplicationContext *h, void *obj, const char *url, int64_t offset, int error, int http_code) ++{ ++ AVAppHttpEvent event = {0}; ++ ++ if (!h || !obj || !url) ++ return; ++ ++ event.obj = obj; ++ event.offset = offset; ++ av_strlcpy(event.url, url, sizeof(event.url)); ++ event.error = error; ++ event.http_code = http_code; ++ ++ av_application_on_http_event(h, AVAPP_EVENT_DID_HTTP_SEEK, &event); ++} ++ ++static void av_application_on_io_traffic(AVApplicationContext *h, AVAppIOTraffic *event) ++{ ++ if (h && h->func_on_app_event) ++ h->func_on_app_event(h, AVAPP_EVENT_IO_TRAFFIC, (void *)event, sizeof(AVAppIOTraffic)); ++} ++ ++int av_application_on_io_control(AVApplicationContext *h, int event_type, AVAppIOControl *control) ++{ ++ if (h && h->func_on_app_event) ++ return h->func_on_app_event(h, event_type, (void *)control, sizeof(AVAppIOControl)); ++ return 0; ++} ++ ++int av_application_on_tcp_will_open(AVApplicationContext *h) ++{ ++ if (h && h->func_on_app_event) { ++ AVAppTcpIOControl control = {0}; ++ return h->func_on_app_event(h, AVAPP_CTRL_WILL_TCP_OPEN, (void *)&control, sizeof(AVAppTcpIOControl)); ++ } ++ return 0; ++} ++ ++// only callback returns error ++int av_application_on_tcp_did_open(AVApplicationContext *h, int error, int fd, AVAppTcpIOControl *control) ++{ ++ struct sockaddr_storage so_stg; ++ int ret = 0; ++ socklen_t so_len = sizeof(so_stg); ++ int so_family; ++ char *so_ip_name = control->ip; ++ ++ if (!h || !h->func_on_app_event || fd <= 0) ++ return 0; ++ ++ ret = getpeername(fd, (struct sockaddr *)&so_stg, &so_len); ++ if (ret) ++ return 0; ++ control->error = error; ++ control->fd = fd; ++ ++ so_family = ((struct sockaddr*)&so_stg)->sa_family; ++ switch (so_family) { ++ case AF_INET: { ++ struct sockaddr_in* in4 = (struct sockaddr_in*)&so_stg; ++ if (inet_ntop(AF_INET, &(in4->sin_addr), so_ip_name, sizeof(control->ip))) { ++ control->family = AF_INET; ++ control->port = in4->sin_port; ++ } ++ break; ++ } ++ case AF_INET6: { ++ struct sockaddr_in6* in6 = (struct sockaddr_in6*)&so_stg; ++ if (inet_ntop(AF_INET6, &(in6->sin6_addr), so_ip_name, sizeof(control->ip))) { ++ control->family = AF_INET6; ++ control->port = in6->sin6_port; ++ } ++ break; ++ } ++ } ++ ++ return h->func_on_app_event(h, AVAPP_CTRL_DID_TCP_OPEN, (void *)control, sizeof(AVAppTcpIOControl)); ++} ++ ++void av_application_on_async_statistic(AVApplicationContext *h, AVAppAsyncStatistic *statistic) ++{ ++ if (h && h->func_on_app_event) ++ h->func_on_app_event(h, AVAPP_EVENT_ASYNC_STATISTIC, (void *)statistic, sizeof(AVAppAsyncStatistic)); ++} ++ ++void av_application_on_async_read_speed(AVApplicationContext *h, AVAppAsyncReadSpeed *speed) ++{ ++ if (h && h->func_on_app_event) ++ h->func_on_app_event(h, AVAPP_EVENT_ASYNC_READ_SPEED, (void *)speed, sizeof(AVAppAsyncReadSpeed)); ++} ++ ++void av_application_did_io_tcp_read(AVApplicationContext *h, void *obj, int bytes) ++{ ++ AVAppIOTraffic event = {0}; ++ if (!h || !obj || bytes <= 0) ++ return; ++ ++ event.obj = obj; ++ event.bytes = bytes; ++ ++ av_application_on_io_traffic(h, &event); ++} +diff --git a/libavformat/application.h b/libavformat/application.h +new file mode 100644 +index 0000000..b9e7f5b +--- /dev/null ++++ b/libavformat/application.h +@@ -0,0 +1,120 @@ ++/* ++ * copyright (c) 2016 Zhang Rui ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#ifndef AVUTIL_APPLICATION_H ++#define AVUTIL_APPLICATION_H ++ ++#include ++ ++#define AVAPP_EVENT_WILL_HTTP_OPEN 1 //AVAppHttpEvent ++#define AVAPP_EVENT_DID_HTTP_OPEN 2 //AVAppHttpEvent ++#define AVAPP_EVENT_WILL_HTTP_SEEK 3 //AVAppHttpEvent ++#define AVAPP_EVENT_DID_HTTP_SEEK 4 //AVAppHttpEvent ++ ++#define AVAPP_EVENT_ASYNC_STATISTIC 0x11000 //AVAppAsyncStatistic ++#define AVAPP_EVENT_ASYNC_READ_SPEED 0x11001 //AVAppAsyncReadSpeed ++#define AVAPP_EVENT_IO_TRAFFIC 0x12204 //AVAppIOTraffic ++ ++#define AVAPP_CTRL_WILL_TCP_OPEN 0x20001 //AVAppTcpIOControl ++#define AVAPP_CTRL_DID_TCP_OPEN 0x20002 //AVAppTcpIOControl ++ ++#define AVAPP_CTRL_WILL_HTTP_OPEN 0x20003 //AVAppIOControl ++#define AVAPP_CTRL_WILL_LIVE_OPEN 0x20005 //AVAppIOControl ++ ++#define AVAPP_CTRL_WILL_CONCAT_SEGMENT_OPEN 0x20007 //AVAppIOControl ++ ++typedef struct AVAppIOControl { ++ size_t size; ++ char url[4096]; /* in, out */ ++ int segment_index; /* in, default = 0 */ ++ int retry_counter; /* in */ ++ ++ int is_handled; /* out, default = false */ ++ int is_url_changed; /* out, default = false */ ++} AVAppIOControl; ++ ++typedef struct AVAppTcpIOControl { ++ int error; ++ int family; ++ char ip[96]; ++ int port; ++ int fd; ++} AVAppTcpIOControl; ++ ++typedef struct AVAppAsyncStatistic { ++ size_t size; ++ int64_t buf_backwards; ++ int64_t buf_forwards; ++ int64_t buf_capacity; ++} AVAppAsyncStatistic; ++ ++typedef struct AVAppAsyncReadSpeed { ++ size_t size; ++ int is_full_speed; ++ int64_t io_bytes; ++ int64_t elapsed_milli; ++} AVAppAsyncReadSpeed; ++ ++typedef struct AVAppHttpEvent ++{ ++ void *obj; ++ char url[4096]; ++ int64_t offset; ++ int error; ++ int http_code; ++ int64_t filesize; ++} AVAppHttpEvent; ++ ++typedef struct AVAppIOTraffic ++{ ++ void *obj; ++ int bytes; ++} AVAppIOTraffic; ++ ++typedef struct AVApplicationContext AVApplicationContext; ++typedef struct AVClass AVClass; ++struct AVApplicationContext { ++ const AVClass *av_class; /**< information for av_log(). Set by av_application_open(). */ ++ void *opaque; /**< user data. */ ++ int (*func_on_app_event)(AVApplicationContext *h, int event_type ,void *obj, size_t size); ++}; ++ ++// open/close ++int av_application_open(AVApplicationContext **ph, void *opaque); ++void av_application_closep(AVApplicationContext **ph); ++ ++// custom protocol invoke ++void av_application_on_http_event(AVApplicationContext *h, int event_type, AVAppHttpEvent *event); ++int av_application_on_io_control(AVApplicationContext *h, int event_type, AVAppIOControl *control); ++void av_application_on_async_statistic(AVApplicationContext *h, AVAppAsyncStatistic *statistic); ++void av_application_on_async_read_speed(AVApplicationContext *h, AVAppAsyncReadSpeed *speed); ++ ++// http event ++void av_application_will_http_open(AVApplicationContext *h, void *obj, const char *url); ++void av_application_did_http_open(AVApplicationContext *h, void *obj, const char *url, int error, int http_code, int64_t filesize); ++void av_application_will_http_seek(AVApplicationContext *h, void *obj, const char *url, int64_t offset); ++void av_application_did_http_seek(AVApplicationContext *h, void *obj, const char *url, int64_t offset, int error, int http_code); ++//tcp event ++int av_application_on_tcp_will_open(AVApplicationContext *h); ++int av_application_on_tcp_did_open(AVApplicationContext *h, int error, int fd, AVAppTcpIOControl *control); ++//tcp speed ++void av_application_did_io_tcp_read(AVApplicationContext *h, void *obj, int bytes); ++ ++#endif /* AVUTIL_APPLICATION_H */ +diff --git a/libavformat/dns_cache.c b/libavformat/dns_cache.c +new file mode 100644 +index 0000000..aab2435 +--- /dev/null ++++ b/libavformat/dns_cache.c +@@ -0,0 +1,232 @@ ++/* ++ * copyright (c) 2017 Raymond Zheng ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#include "dns_cache.h" ++#include "libavutil/time.h" ++#include "libavutil/mem.h" ++#include "libavformat/network.h" ++#include ++#include ++ ++#if HAVE_PTHREADS ++#include ++#endif ++ ++typedef struct DnsCacheContext DnsCacheContext; ++typedef struct DnsCacheContext { ++ AVDictionary *dns_dictionary; ++ pthread_mutex_t dns_dictionary_mutex; ++ int initialized; ++} DnsCacheContext; ++ ++static DnsCacheContext *context = NULL; ++static pthread_once_t key_once = PTHREAD_ONCE_INIT; ++ ++static void inner_init(void) { ++ int ret = 0; ++ context = (DnsCacheContext *) av_mallocz(sizeof(DnsCacheContext)); ++ if (context) { ++ ret = pthread_mutex_init(&context->dns_dictionary_mutex, NULL); ++ if (!ret) { ++ context->initialized = 1; ++ } else { ++ av_freep(&context); ++ } ++ } ++} ++ ++static void free_private_addrinfo(struct addrinfo **p_ai) { ++ struct addrinfo *ai = *p_ai; ++ ++ if (ai) { ++ if (ai->ai_addr) { ++ av_freep(&ai->ai_addr); ++ } ++ av_freep(p_ai); ++ } ++} ++ ++static int inner_remove_dns_cache(const char *uri, DnsCacheEntry *dns_cache_entry) { ++ if (context && dns_cache_entry) { ++ if (dns_cache_entry->ref_count == 0) { ++ av_dict_set_int(&context->dns_dictionary, uri, 0, 0); ++ free_private_addrinfo(&dns_cache_entry->res); ++ av_freep(&dns_cache_entry); ++ } else { ++ dns_cache_entry->delete_flag = 1; ++ } ++ } ++ ++ return 0; ++} ++ ++static DnsCacheEntry *new_dns_cache_entry(const char *uri, struct addrinfo *cur_ai, int64_t timeout) { ++ DnsCacheEntry *new_entry = NULL; ++ int64_t cur_time = av_gettime_relative(); ++ ++ if (cur_time < 0) { ++ goto fail; ++ } ++ ++ new_entry = (DnsCacheEntry *) av_mallocz(sizeof(struct DnsCacheEntry)); ++ if (!new_entry) { ++ goto fail; ++ } ++ ++ new_entry->res = (struct addrinfo *) av_mallocz(sizeof(struct addrinfo)); ++ if (!new_entry->res) { ++ av_freep(&new_entry); ++ goto fail; ++ } ++ ++ memcpy(new_entry->res, cur_ai, sizeof(struct addrinfo)); ++ ++ new_entry->res->ai_addr = (struct sockaddr *) av_mallocz(sizeof(struct sockaddr)); ++ if (!new_entry->res->ai_addr) { ++ av_freep(&new_entry->res); ++ av_freep(&new_entry); ++ goto fail; ++ } ++ ++ memcpy(new_entry->res->ai_addr, cur_ai->ai_addr, sizeof(struct sockaddr)); ++ new_entry->res->ai_canonname = NULL; ++ new_entry->res->ai_next = NULL; ++ new_entry->ref_count = 0; ++ new_entry->delete_flag = 0; ++ new_entry->expired_time = cur_time + timeout * 1000; ++ ++ return new_entry; ++ ++fail: ++ return NULL; ++} ++ ++DnsCacheEntry *get_dns_cache_reference(const char *uri) { ++ AVDictionaryEntry *elem = NULL; ++ DnsCacheEntry *dns_cache_entry = NULL; ++ int64_t cur_time = av_gettime_relative(); ++ ++ if (cur_time < 0 || !uri || strlen(uri) == 0) { ++ return NULL; ++ } ++ ++ if (!context || !context->initialized) { ++#if HAVE_PTHREADS ++ pthread_once(&key_once, inner_init); ++#endif ++ } ++ ++ if (context && context->initialized) { ++ pthread_mutex_lock(&context->dns_dictionary_mutex); ++ elem = av_dict_get(context->dns_dictionary, uri, NULL, AV_DICT_MATCH_CASE); ++ if (elem) { ++ dns_cache_entry = (DnsCacheEntry *) (intptr_t) strtoll(elem->value, NULL, 10); ++ if (dns_cache_entry) { ++ if (dns_cache_entry->expired_time < cur_time) { ++ inner_remove_dns_cache(uri, dns_cache_entry); ++ dns_cache_entry = NULL; ++ } else { ++ dns_cache_entry->ref_count++; ++ } ++ } ++ } ++ pthread_mutex_unlock(&context->dns_dictionary_mutex); ++ } ++ ++ return dns_cache_entry; ++} ++ ++int release_dns_cache_reference(const char *uri, DnsCacheEntry **p_entry) { ++ DnsCacheEntry *entry = *p_entry; ++ ++ if (!uri || strlen(uri) == 0) { ++ return -1; ++ } ++ ++ if (context && context->initialized && entry) { ++ pthread_mutex_lock(&context->dns_dictionary_mutex); ++ entry->ref_count--; ++ if (entry->delete_flag && entry->ref_count == 0) { ++ inner_remove_dns_cache(uri, entry); ++ entry = NULL; ++ } ++ pthread_mutex_unlock(&context->dns_dictionary_mutex); ++ } ++ return 0; ++} ++ ++int remove_dns_cache_entry(const char *uri) { ++ AVDictionaryEntry *elem = NULL; ++ DnsCacheEntry *dns_cache_entry = NULL; ++ ++ if (!uri || strlen(uri) == 0) { ++ return -1; ++ } ++ ++ if (context && context->initialized) { ++ pthread_mutex_lock(&context->dns_dictionary_mutex); ++ elem = av_dict_get(context->dns_dictionary, uri, NULL, AV_DICT_MATCH_CASE); ++ if (elem) { ++ dns_cache_entry = (DnsCacheEntry *) (intptr_t) strtoll(elem->value, NULL, 10); ++ if (dns_cache_entry) { ++ inner_remove_dns_cache(uri, dns_cache_entry); ++ } ++ } ++ pthread_mutex_unlock(&context->dns_dictionary_mutex); ++ } ++ ++ return 0; ++} ++ ++int add_dns_cache_entry(const char *uri, struct addrinfo *cur_ai, int64_t timeout) { ++ DnsCacheEntry *new_entry = NULL; ++ DnsCacheEntry *old_entry = NULL; ++ AVDictionaryEntry *elem = NULL; ++ ++ if (!uri || strlen(uri) == 0 || timeout <= 0) { ++ goto fail; ++ } ++ ++ if (cur_ai == NULL || cur_ai->ai_addr == NULL) { ++ goto fail; ++ } ++ ++ if (context && context->initialized) { ++ pthread_mutex_lock(&context->dns_dictionary_mutex); ++ elem = av_dict_get(context->dns_dictionary, uri, NULL, AV_DICT_MATCH_CASE); ++ if (elem) { ++ old_entry = (DnsCacheEntry *) (intptr_t) strtoll(elem->value, NULL, 10); ++ if (old_entry) { ++ pthread_mutex_unlock(&context->dns_dictionary_mutex); ++ goto fail; ++ } ++ } ++ new_entry = new_dns_cache_entry(uri, cur_ai, timeout); ++ if (new_entry) { ++ av_dict_set_int(&context->dns_dictionary, uri, (int64_t) (intptr_t) new_entry, 0); ++ } ++ pthread_mutex_unlock(&context->dns_dictionary_mutex); ++ ++ return 0; ++ } ++ ++fail: ++ return -1; ++} +diff --git a/libavformat/dns_cache.h b/libavformat/dns_cache.h +new file mode 100644 +index 0000000..23c695e +--- /dev/null ++++ b/libavformat/dns_cache.h +@@ -0,0 +1,39 @@ ++/* ++ * copyright (c) 2017 Raymond Zheng ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#ifndef AVUTIL_DNS_CACHE_H ++#define AVUTIL_DNS_CACHE_H ++ ++#include "libavutil/log.h" ++#include ++ ++typedef struct DnsCacheEntry { ++ volatile int ref_count; ++ volatile int delete_flag; ++ int64_t expired_time; ++ struct addrinfo *res; // construct by private function, not support ai_next and ai_canonname, can only be released using free_private_addrinfo ++} DnsCacheEntry; ++ ++DnsCacheEntry *get_dns_cache_reference(const char *uri); ++int release_dns_cache_reference(const char *uri, DnsCacheEntry **p_entry); ++int remove_dns_cache_entry(const char *uri); ++int add_dns_cache_entry(const char *uri, struct addrinfo *cur_ai, int64_t timeout); ++ ++#endif /* AVUTIL_DNS_CACHE_H */ +-- +2.50.1 (Apple Git-155) + diff --git a/patches/ffmpeg-n8.1.2/0003-restore-ijk-http-event-hooks.patch b/patches/ffmpeg-n8.1.2/0003-restore-ijk-http-event-hooks.patch new file mode 100644 index 000000000..de76b7df4 --- /dev/null +++ b/patches/ffmpeg-n8.1.2/0003-restore-ijk-http-event-hooks.patch @@ -0,0 +1,278 @@ +From 91b1bc44f636fd2c2a4a40fabffadfd6fa9d22e8 Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Fri, 8 May 2026 16:30:34 +0800 +Subject: restore ijk http event hooks + +--- + libavformat/http.c | 32 +++++++++++++++++++++++-- + libavformat/tcp.c | 58 +++++++++++++++++++++++++++++++++++++++++----- + libavutil/error.h | 4 ++++ + 3 files changed, 86 insertions(+), 8 deletions(-) + +diff --git a/libavformat/http.c b/libavformat/http.c +index 52073ff..f4bf225 100644 +--- a/libavformat/http.c ++++ b/libavformat/http.c +@@ -48,6 +48,7 @@ + #include "os_support.h" + #include "url.h" + #include "version.h" ++#include "application.h" + + /* XXX: POST protocol is not completely implemented because ffmpeg uses + * only a subset of it. */ +@@ -158,6 +159,9 @@ typedef struct HTTPContext { + int64_t sum_latency; /* divide by nb_requests */ + int64_t max_latency; + int max_redirects; ++ char *tcp_hook; ++ char *app_ctx_intptr; ++ AVApplicationContext *app_ctx; + } HTTPContext; + + #define OFFSET(x) offsetof(HTTPContext, x) +@@ -206,6 +210,8 @@ static const AVOption options[] = { + { "reply_code", "The http status code to return to a client", OFFSET(reply_code), AV_OPT_TYPE_INT, { .i64 = 200}, INT_MIN, 599, E}, + { "short_seek_size", "Threshold to favor readahead over seek.", OFFSET(short_seek_size), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, D }, + { "max_redirects", "Maximum number of redirects", OFFSET(max_redirects), AV_OPT_TYPE_INT, { .i64 = MAX_REDIRECTS }, 0, INT_MAX, D }, ++ { "http-tcp-hook", "hook protocol on tcp", OFFSET(tcp_hook), AV_OPT_TYPE_STRING, { .str = "tcp" }, 0, 0, D | E }, ++ { "ijkapplication", "AVApplicationContext", OFFSET(app_ctx_intptr), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, .flags = D }, + { NULL } + }; + +@@ -236,6 +242,7 @@ static int http_open_cnx_internal(URLContext *h, AVDictionary **options) + char buf[1024], urlbuf[MAX_URL_SIZE]; + int port, use_proxy, err = 0; + HTTPContext *s = h->priv_data; ++ lower_proto = s->tcp_hook; + + av_url_split(proto, sizeof(proto), auth, sizeof(auth), + hostname, sizeof(hostname), &port, +@@ -313,6 +320,13 @@ static int http_open_cnx_internal(URLContext *h, AVDictionary **options) + + if (!s->hd) { + s->nb_connections++; ++ av_dict_set_intptr(options, "ijkapplication", (uintptr_t)s->app_ctx, 0); ++ ++ // AVDictionaryEntry *t = NULL; ++ // while ((t = av_dict_get(*options, "", t, AV_DICT_IGNORE_SUFFIX))) { ++ // av_log(NULL, AV_LOG_INFO, "%-*s: %-*s = %s\n", 12, "http open tcp", 28, t->key, t->value); ++ // } ++ + err = ffurl_open_whitelist(&s->hd, buf, AVIO_FLAG_READ_WRITE, + &h->interrupt_callback, options, + h->protocol_whitelist, h->protocol_blacklist, h); +@@ -771,6 +785,7 @@ static int http_open(URLContext *h, const char *uri, int flags, + { + HTTPContext *s = h->priv_data; + int ret; ++ s->app_ctx = (AVApplicationContext *)av_dict_strtoptr(s->app_ctx_intptr); + + if( s->seekable == 1 ) + h->is_streamed = 0; +@@ -808,7 +823,9 @@ static int http_open(URLContext *h, const char *uri, int flags, + if (s->listen) { + return http_listen(h, uri, flags, options); + } ++ av_application_will_http_open(s->app_ctx, (void*)h, uri); + ret = http_open_cnx(h, options); ++ av_application_did_http_open(s->app_ctx, (void*)h, uri, ret, s->http_code, s->filesize); + bail_out: + if (ret < 0) { + av_dict_free(&s->chained_options); +@@ -1763,7 +1780,14 @@ static int http_buf_read(URLContext *h, uint8_t *buf, int size) + return AVERROR_EOF; + if (s->off == target_end && target_end < file_end) + return AVERROR(EAGAIN); /* reached end of content range */ +- len = ffurl_read(s->hd, buf, size); ++ len = size; ++ if (s->filesize > 0 && s->filesize != UINT64_MAX && s->filesize != INT32_MAX) { ++ int64_t unread = s->filesize - s->off; ++ if (len > unread) ++ len = (int)unread; ++ } ++ if (len > 0) ++ len = ffurl_read(s->hd, buf, len); + if ((!len || len == AVERROR_EOF) && + (!s->willclose || s->chunksize == UINT64_MAX) && s->off < target_end) { + av_log(h, AV_LOG_ERROR, +@@ -2158,7 +2182,9 @@ static int64_t http_seek_internal(URLContext *h, int64_t off, int whence, int fo + } + + /* if it fails, continue on old connection */ ++ av_application_will_http_seek(s->app_ctx, (void*)h, s->location, off); + if ((ret = http_open_cnx(h, &options)) < 0) { ++ av_application_did_http_seek(s->app_ctx, (void*)h, s->location, off, ret, s->http_code); + av_dict_free(&options); + memcpy(s->buffer, old_buf, old_buf_size); + s->buf_ptr = s->buffer; +@@ -2167,6 +2193,7 @@ static int64_t http_seek_internal(URLContext *h, int64_t off, int whence, int fo + s->off = old_off; + return ret; + } ++ av_application_did_http_seek(s->app_ctx, (void*)h, s->location, off, ret, s->http_code); + av_dict_free(&options); + ffurl_close(old_hd); + return off; +@@ -2260,6 +2287,7 @@ static int http_proxy_open(URLContext *h, const char *uri, int flags) + HTTPAuthType cur_auth_type; + char *authstr; + ++ s->app_ctx = (AVApplicationContext *)av_dict_strtoptr(s->app_ctx_intptr); + if( s->seekable == 1 ) + h->is_streamed = 0; + else +@@ -2272,7 +2300,7 @@ static int http_proxy_open(URLContext *h, const char *uri, int flags) + if (*path == '/') + path++; + +- ff_url_join(lower_url, sizeof(lower_url), "tcp", NULL, hostname, port, ++ ff_url_join(lower_url, sizeof(lower_url), s->tcp_hook, NULL, hostname, port, + NULL); + redo: + ret = ffurl_open_whitelist(&s->hd, lower_url, AVIO_FLAG_READ_WRITE, +diff --git a/libavformat/tcp.c b/libavformat/tcp.c +index ce9f69a..69b1e12 100644 +--- a/libavformat/tcp.c ++++ b/libavformat/tcp.c +@@ -24,7 +24,8 @@ + #include "libavutil/parseutils.h" + #include "libavutil/opt.h" + #include "libavutil/time.h" +- ++#include "libavutil/avstring.h" ++#include "application.h" + #include "internal.h" + #include "network.h" + #include "os_support.h" +@@ -49,6 +50,9 @@ typedef struct TCPContext { + #if !HAVE_WINSOCK2_H + int tcp_mss; + #endif /* !HAVE_WINSOCK2_H */ ++ ++ char * app_ctx_intptr; ++ AVApplicationContext *app_ctx; + } TCPContext; + + #define OFFSET(x) offsetof(TCPContext, x) +@@ -67,6 +71,8 @@ static const AVOption options[] = { + #if !HAVE_WINSOCK2_H + { "tcp_mss", "Maximum segment size for outgoing TCP packets", OFFSET(tcp_mss), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, .flags = D|E }, + #endif /* !HAVE_WINSOCK2_H */ ++ { "ijkapplication", "AVApplicationContext", OFFSET(app_ctx_intptr), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, .flags = D }, ++ { "connect_timeout", "set connect timeout (in microseconds) of socket", OFFSET(open_timeout), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, .flags = D|E }, + { NULL } + }; + +@@ -155,7 +161,21 @@ static int tcp_open(URLContext *h, const char *uri, int flags) + int ret; + char hostname[1024],proto[1024],path[1024]; + char portstr[10]; +- s->open_timeout = 5000000; ++ AVAppTcpIOControl control = {0}; ++ ++ int ret2; ++ if (s->open_timeout < 0) { ++ s->open_timeout = 15000000; ++ } ++ // av_log(NULL, AV_LOG_INFO, "xql tcp_open uri %s", uri); ++ // av_log(NULL, AV_LOG_INFO, "%-*s: %-*s = %s\n", 12, "xql tcp_open verify", 28, "ijkapplication", s->app_ctx_intptr); ++ // av_log(NULL, AV_LOG_INFO, "%-*s: %-*s = %d\n", 12, "xql tcp_open verify", 28, "connect_timeout", s->open_timeout); ++ // av_log(NULL, AV_LOG_INFO, "%-*s: %-*s = %d\n", 12, "xql tcp_open verify", 28, "addrinfo_one_by_one", s->addrinfo_one_by_one); ++ // av_log(NULL, AV_LOG_INFO, "%-*s: %-*s = %d\n", 12, "xql tcp_open verify", 28, "addrinfo_timeout", s->addrinfo_timeout); ++ // av_log(NULL, AV_LOG_INFO, "%-*s: %-*s = %d\n", 12, "xql tcp_open verify", 28, "dns_cache_timeout", s->dns_cache_timeout); ++ // av_log(NULL, AV_LOG_INFO, "%-*s: %-*s = %d\n", 12, "xql tcp_open verify", 28, "dns_cache_clear", s->dns_cache_clear); ++ ++ s->app_ctx = (AVApplicationContext *)av_dict_strtoptr(s->app_ctx_intptr); + + av_url_split(proto, sizeof(proto), NULL, 0, hostname, sizeof(hostname), + &port, path, sizeof(path), uri); +@@ -172,7 +192,7 @@ static int tcp_open(URLContext *h, const char *uri, int flags) + return ret; + } + if (s->rw_timeout >= 0) { +- s->open_timeout = ++ //s->open_timeout = + h->rw_timeout = s->rw_timeout; + } + hints.ai_family = AF_UNSPEC; +@@ -230,9 +250,24 @@ static int tcp_open(URLContext *h, const char *uri, int flags) + // Socket descriptor already closed here. Safe to overwrite to client one. + fd = ret; + } else { +- ret = ff_connect_parallel(ai, s->open_timeout / 1000, 3, h, &fd, customize_fd, s); ++ ret = av_application_on_tcp_will_open(s->app_ctx); ++ if (ret) { ++ av_log(NULL, AV_LOG_WARNING, "terminated by application in AVAPP_CTRL_WILL_TCP_OPEN"); ++ goto fail1; ++ } ++ ret = ff_connect_parallel(cur_ai, s->open_timeout / 1000, 3, h, &fd, customize_fd, s); ++ ++ ret2 = av_application_on_tcp_did_open(s->app_ctx, ret, fd, &control); ++ + if (ret < 0) + goto fail1; ++ ++ if (ret2) { ++ av_log(NULL, AV_LOG_WARNING, "terminated by application in AVAPP_CTRL_DID_TCP_OPEN"); ++ ret = ret2; ++ goto fail1; ++ } ++ av_log(NULL, AV_LOG_INFO, "tcp did open uri = %s, ip = %s\n", uri , control.ip); + } + + h->is_streamed = 1; +@@ -273,12 +308,18 @@ static int tcp_read(URLContext *h, uint8_t *buf, int size) + + if (!(h->flags & AVIO_FLAG_NONBLOCK)) { + ret = ff_network_wait_fd_timeout(s->fd, 0, h->rw_timeout, &h->interrupt_callback); +- if (ret) ++ if (ret) { ++ if (ret == AVERROR(ETIMEDOUT)) { ++ ret = AVERROR_TCP_READ_TIMEOUT; ++ } + return ret; ++ } + } + ret = recv(s->fd, buf, size, 0); + if (ret == 0) + return AVERROR_EOF; ++ if (ret > 0) ++ av_application_did_io_tcp_read(s->app_ctx, (void*)h, ret); + return ret < 0 ? ff_neterrno() : ret; + } + +@@ -289,9 +330,14 @@ static int tcp_write(URLContext *h, const uint8_t *buf, int size) + + if (!(h->flags & AVIO_FLAG_NONBLOCK)) { + ret = ff_network_wait_fd_timeout(s->fd, 1, h->rw_timeout, &h->interrupt_callback); +- if (ret) ++ if (ret) { ++ if (ret == AVERROR(ETIMEDOUT)) { ++ ret = AVERROR_TCP_WRITE_TIMEOUT; ++ } + return ret; ++ } + } ++ + ret = send(s->fd, buf, size, MSG_NOSIGNAL); + return ret < 0 ? ff_neterrno() : ret; + } +diff --git a/libavutil/error.h b/libavutil/error.h +index 1efa86c..9dee755 100644 +--- a/libavutil/error.h ++++ b/libavutil/error.h +@@ -85,6 +85,10 @@ + + #define AV_ERROR_MAX_STRING_SIZE 64 + ++#define AVERROR_TCP_CONNECT_TIMEOUT -1001 ++#define AVERROR_TCP_READ_TIMEOUT -1002 ++#define AVERROR_TCP_WRITE_TIMEOUT -1003 ++ + /** + * Put a description of the AVERROR code errnum in errbuf. + * In case of failure the global variable errno is set to indicate the +-- +2.50.1 (Apple Git-155) + diff --git a/patches/ffmpeg-n8.1.2/0004-restore-ijk-tcp-dns-cache.patch b/patches/ffmpeg-n8.1.2/0004-restore-ijk-tcp-dns-cache.patch new file mode 100644 index 000000000..29a6b9611 --- /dev/null +++ b/patches/ffmpeg-n8.1.2/0004-restore-ijk-tcp-dns-cache.patch @@ -0,0 +1,404 @@ +From acffa5bb5305c8f28419c0f476e8d123f09d9bcd Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Fri, 8 May 2026 16:39:50 +0800 +Subject: restore ijk tcp dns cache + +--- + libavformat/tcp.c | 324 ++++++++++++++++++++++++++++++++++++++++++++-- + 1 file changed, 310 insertions(+), 14 deletions(-) + +diff --git a/libavformat/tcp.c b/libavformat/tcp.c +index 69b1e12..46b48e6 100644 +--- a/libavformat/tcp.c ++++ b/libavformat/tcp.c +@@ -26,6 +26,7 @@ + #include "libavutil/time.h" + #include "libavutil/avstring.h" + #include "application.h" ++#include "dns_cache.h" + #include "internal.h" + #include "network.h" + #include "os_support.h" +@@ -33,6 +34,9 @@ + #if HAVE_POLL_H + #include + #endif ++#if HAVE_PTHREADS ++#include ++#endif + + typedef struct TCPContext { + const AVClass *class; +@@ -52,6 +56,10 @@ typedef struct TCPContext { + #endif /* !HAVE_WINSOCK2_H */ + + char * app_ctx_intptr; ++ int addrinfo_one_by_one; ++ int addrinfo_timeout; ++ int64_t dns_cache_timeout; ++ int dns_cache_clear; + AVApplicationContext *app_ctx; + } TCPContext; + +@@ -73,9 +81,261 @@ static const AVOption options[] = { + #endif /* !HAVE_WINSOCK2_H */ + { "ijkapplication", "AVApplicationContext", OFFSET(app_ctx_intptr), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, .flags = D }, + { "connect_timeout", "set connect timeout (in microseconds) of socket", OFFSET(open_timeout), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, .flags = D|E }, ++ { "addrinfo_one_by_one", "parse addrinfo one by one in getaddrinfo()", OFFSET(addrinfo_one_by_one), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, .flags = D|E }, ++ { "addrinfo_timeout", "set timeout (in microseconds) for getaddrinfo()", OFFSET(addrinfo_timeout), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, .flags = D|E }, ++ { "dns_cache_timeout", "dns cache TTL (in microseconds)", OFFSET(dns_cache_timeout), AV_OPT_TYPE_INT, { .i64 = 0 }, -1, INT64_MAX, .flags = D|E }, ++ { "dns_cache_clear", "clear dns cache", OFFSET(dns_cache_clear), AV_OPT_TYPE_INT, { .i64 = 0}, -1, INT_MAX, .flags = D|E }, + { NULL } + }; + ++int ijk_tcp_getaddrinfo_nonblock(const char *hostname, const char *servname, ++ const struct addrinfo *hints, struct addrinfo **res, ++ int64_t timeout, ++ const AVIOInterruptCB *int_cb, int one_by_one); ++#ifdef HAVE_PTHREADS ++ ++typedef struct TCPAddrinfoRequest ++{ ++ AVBufferRef *buffer; ++ ++ pthread_mutex_t mutex; ++ pthread_cond_t cond; ++ ++ AVIOInterruptCB interrupt_callback; ++ ++ char *hostname; ++ char *servname; ++ struct addrinfo hints; ++ struct addrinfo *res; ++ ++ volatile int finished; ++ int last_error; ++} TCPAddrinfoRequest; ++ ++static void tcp_getaddrinfo_request_free(TCPAddrinfoRequest *req) ++{ ++ av_assert0(req); ++ if (req->res) { ++ freeaddrinfo(req->res); ++ req->res = NULL; ++ } ++ ++ av_freep(&req->servname); ++ av_freep(&req->hostname); ++ pthread_cond_destroy(&req->cond); ++ pthread_mutex_destroy(&req->mutex); ++ av_freep(&req); ++} ++ ++static void tcp_getaddrinfo_request_free_buffer(void *opaque, uint8_t *data) ++{ ++ av_assert0(opaque); ++ TCPAddrinfoRequest *req = (TCPAddrinfoRequest *)opaque; ++ tcp_getaddrinfo_request_free(req); ++} ++ ++static int tcp_getaddrinfo_request_create(TCPAddrinfoRequest **request, ++ const char *hostname, ++ const char *servname, ++ const struct addrinfo *hints, ++ const AVIOInterruptCB *int_cb) ++{ ++ TCPAddrinfoRequest *req = (TCPAddrinfoRequest *) av_mallocz(sizeof(TCPAddrinfoRequest)); ++ if (!req) ++ return AVERROR(ENOMEM); ++ ++ if (pthread_mutex_init(&req->mutex, NULL)) { ++ av_freep(&req); ++ return AVERROR(ENOMEM); ++ } ++ ++ if (pthread_cond_init(&req->cond, NULL)) { ++ pthread_mutex_destroy(&req->mutex); ++ av_freep(&req); ++ return AVERROR(ENOMEM); ++ } ++ ++ if (int_cb) ++ req->interrupt_callback = *int_cb; ++ ++ if (hostname) { ++ req->hostname = av_strdup(hostname); ++ if (!req->hostname) ++ goto fail; ++ } ++ ++ if (servname) { ++ req->servname = av_strdup(servname); ++ if (!req->hostname) ++ goto fail; ++ } ++ ++ if (hints) { ++ req->hints.ai_family = hints->ai_family; ++ req->hints.ai_socktype = hints->ai_socktype; ++ req->hints.ai_protocol = hints->ai_protocol; ++ req->hints.ai_flags = hints->ai_flags; ++ } ++ ++ req->buffer = av_buffer_create(NULL, 0, tcp_getaddrinfo_request_free_buffer, req, 0); ++ if (!req->buffer) ++ goto fail; ++ ++ *request = req; ++ return 0; ++fail: ++ tcp_getaddrinfo_request_free(req); ++ return AVERROR(ENOMEM); ++} ++ ++static void *tcp_getaddrinfo_worker(void *arg) ++{ ++ TCPAddrinfoRequest *req = arg; ++ ++ getaddrinfo(req->hostname, req->servname, &req->hints, &req->res); ++ pthread_mutex_lock(&req->mutex); ++ req->finished = 1; ++ pthread_cond_signal(&req->cond); ++ pthread_mutex_unlock(&req->mutex); ++ av_buffer_unref(&req->buffer); ++ return NULL; ++} ++ ++static void *tcp_getaddrinfo_one_by_one_worker(void *arg) ++{ ++ struct addrinfo *temp_addrinfo = NULL; ++ struct addrinfo *cur = NULL; ++ int ret = EAI_FAIL; ++ int i = 0; ++ int option_length = 0; ++ ++ TCPAddrinfoRequest *req = (TCPAddrinfoRequest *)arg; ++ ++ int family_option[2] = {AF_INET, AF_INET6}; ++ ++ option_length = sizeof(family_option) / sizeof(family_option[0]); ++ ++ for (; i < option_length; ++i) { ++ struct addrinfo *hint = &req->hints; ++ hint->ai_family = family_option[i]; ++ ret = getaddrinfo(req->hostname, req->servname, hint, &temp_addrinfo); ++ if (ret) { ++ req->last_error = ret; ++ continue; ++ } ++ pthread_mutex_lock(&req->mutex); ++ if (!req->res) { ++ req->res = temp_addrinfo; ++ } else { ++ cur = req->res; ++ while (cur->ai_next) ++ cur = cur->ai_next; ++ cur->ai_next = temp_addrinfo; ++ } ++ pthread_mutex_unlock(&req->mutex); ++ } ++ pthread_mutex_lock(&req->mutex); ++ req->finished = 1; ++ pthread_cond_signal(&req->cond); ++ pthread_mutex_unlock(&req->mutex); ++ av_buffer_unref(&req->buffer); ++ return NULL; ++} ++ ++int ijk_tcp_getaddrinfo_nonblock(const char *hostname, const char *servname, ++ const struct addrinfo *hints, struct addrinfo **res, ++ int64_t timeout, ++ const AVIOInterruptCB *int_cb, int one_by_one) ++{ ++ int ret; ++ int64_t start; ++ int64_t now; ++ AVBufferRef *req_ref = NULL; ++ TCPAddrinfoRequest *req = NULL; ++ pthread_t work_thread; ++ ++ if (hostname && !hostname[0]) ++ hostname = NULL; ++ av_log(NULL, AV_LOG_DEBUG, "dns getaddrinfo uri = %s\n", hostname); ++ if (timeout <= 0) ++ return getaddrinfo(hostname, servname, hints, res); ++ av_log(NULL, AV_LOG_DEBUG, "dns tcp_getaddrinfo_request_create uri = %s\n", hostname); ++ ret = tcp_getaddrinfo_request_create(&req, hostname, servname, hints, int_cb); ++ if (ret) ++ goto fail; ++ ++ req_ref = av_buffer_ref(req->buffer); ++ if (req_ref == NULL) { ++ ret = AVERROR(ENOMEM); ++ goto fail; ++ } ++ ++ /* FIXME: using a thread pool would be better. */ ++ if (one_by_one) ++ ret = pthread_create(&work_thread, NULL, tcp_getaddrinfo_one_by_one_worker, req); ++ else ++ ret = pthread_create(&work_thread, NULL, tcp_getaddrinfo_worker, req); ++ ++ if (ret) { ++ ret = AVERROR(ret); ++ goto fail; ++ } ++ ++ pthread_detach(work_thread); ++ ++ start = av_gettime(); ++ now = start; ++ ++ pthread_mutex_lock(&req->mutex); ++ while (1) { ++ int64_t wait_time = now + 100000; ++ struct timespec tv = { .tv_sec = wait_time / 1000000, ++ .tv_nsec = (wait_time % 1000000) * 1000 }; ++ ++ if (req->finished || (start + timeout < now)) { ++ if (req->res) { ++ ret = 0; ++ *res = req->res; ++ req->res = NULL; ++ } else { ++ ret = req->last_error ? req->last_error : AVERROR_EXIT; ++ } ++ break; ++ } ++#if defined(__ANDROID__) && defined(HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC) ++ ret = pthread_cond_timedwait_monotonic_np(&req->cond, &req->mutex, &tv); ++#else ++ ret = pthread_cond_timedwait(&req->cond, &req->mutex, &tv); ++#endif ++ if (ret != 0 && ret != ETIMEDOUT) { ++ av_log(NULL, AV_LOG_ERROR, "pthread_cond_timedwait failed: %d\n", ret); ++ ret = AVERROR_EXIT; ++ break; ++ } ++ ++ if (ff_check_interrupt(&req->interrupt_callback)) { ++ ret = AVERROR_EXIT; ++ break; ++ } ++ ++ now = av_gettime(); ++ } ++ pthread_mutex_unlock(&req->mutex); ++fail: ++ av_buffer_unref(&req_ref); ++ return ret; ++} ++ ++#else ++int ijk_tcp_getaddrinfo_nonblock(const char *hostname, const char *servname, ++ const struct addrinfo *hints, struct addrinfo **res, ++ int64_t timeout, ++ const AVIOInterruptCB *int_cb) ++{ ++ return getaddrinfo(hostname, servname, hints, res); ++} ++#endif ++ + static const AVClass tcp_class = { + .class_name = "tcp", + .item_name = av_default_item_name, +@@ -162,7 +422,7 @@ static int tcp_open(URLContext *h, const char *uri, int flags) + char hostname[1024],proto[1024],path[1024]; + char portstr[10]; + AVAppTcpIOControl control = {0}; +- ++ DnsCacheEntry *dns_entry = NULL; + int ret2; + if (s->open_timeout < 0) { + s->open_timeout = 15000000; +@@ -200,18 +460,37 @@ static int tcp_open(URLContext *h, const char *uri, int flags) + snprintf(portstr, sizeof(portstr), "%d", port); + if (s->listen) + hints.ai_flags |= AI_PASSIVE; +- if (!hostname[0]) +- ret = getaddrinfo(NULL, portstr, &hints, &ai); +- else +- ret = getaddrinfo(hostname, portstr, &hints, &ai); +- if (ret) { +- av_log(h, AV_LOG_ERROR, +- "Failed to resolve hostname %s: %s\n", +- hostname, gai_strerror(ret)); +- return AVERROR(EIO); ++ if (s->dns_cache_timeout > 0) { ++ if (s->dns_cache_clear) { ++ remove_dns_cache_entry(uri); ++ } else { ++ dns_entry = get_dns_cache_reference(uri); ++ } + } + +- cur_ai = ai; ++ if (!dns_entry) { ++#ifdef HAVE_PTHREADS ++ ret = ijk_tcp_getaddrinfo_nonblock(hostname, portstr, &hints, &ai, s->addrinfo_timeout, &h->interrupt_callback, s->addrinfo_one_by_one); ++#else ++ if (s->addrinfo_timeout > 0) ++ av_log(h, AV_LOG_WARNING, "Ignore addrinfo_timeout without pthreads support.\n"); ++ if (!hostname[0]) ++ ret = getaddrinfo(NULL, portstr, &hints, &ai); ++ else ++ ret = getaddrinfo(hostname, portstr, &hints, &ai); ++#endif ++ if (ret) { ++ av_log(h, AV_LOG_ERROR, ++ "Failed to resolve hostname %s: %s\n", ++ hostname, gai_strerror(ret)); ++ return AVERROR(EIO); ++ } ++ ++ cur_ai = ai; ++ } else { ++ av_log(NULL, AV_LOG_DEBUG, "hit dns cache uri = %s\n", uri); ++ cur_ai = dns_entry->res; ++ } + + #if HAVE_STRUCT_SOCKADDR_IN6 + // workaround for IOS9 getaddrinfo in IPv6 only network use hardcode IPv4 address can not resolve port number. +@@ -267,19 +546,36 @@ static int tcp_open(URLContext *h, const char *uri, int flags) + ret = ret2; + goto fail1; + } +- av_log(NULL, AV_LOG_INFO, "tcp did open uri = %s, ip = %s\n", uri , control.ip); ++ ++ if (!dns_entry && !strstr(uri, control.ip) && s->dns_cache_timeout > 0) { ++ add_dns_cache_entry(uri, cur_ai, s->dns_cache_timeout); ++ av_log(NULL, AV_LOG_DEBUG, "add dns cache uri = %s, ip = %s\n", uri , control.ip); ++ } ++ av_log(NULL, AV_LOG_DEBUG, "tcp did open uri = %s, ip = %s\n", uri , control.ip); + } + + h->is_streamed = 1; + s->fd = fd; + +- freeaddrinfo(ai); ++ if (dns_entry) { ++ release_dns_cache_reference(uri, &dns_entry); ++ } else { ++ freeaddrinfo(ai); ++ } + return 0; + + fail1: + if (fd >= 0) + closesocket(fd); +- freeaddrinfo(ai); ++ ++ if (dns_entry) { ++ av_log(NULL, AV_LOG_ERROR, "hit dns cache but connect fail uri = %s, ip = %s\n", uri , control.ip); ++ release_dns_cache_reference(uri, &dns_entry); ++ remove_dns_cache_entry(uri); ++ } else { ++ freeaddrinfo(cur_ai); ++ } ++ + return ret; + } + +-- +2.50.1 (Apple Git-155) + diff --git a/patches/ffmpeg-n8.1.2/0005-restore-ijk-custom-protocols-and-demuxers-except-lon.patch b/patches/ffmpeg-n8.1.2/0005-restore-ijk-custom-protocols-and-demuxers-except-lon.patch new file mode 100644 index 000000000..db346dd66 --- /dev/null +++ b/patches/ffmpeg-n8.1.2/0005-restore-ijk-custom-protocols-and-demuxers-except-lon.patch @@ -0,0 +1,277 @@ +From 44cd4ed4535a755207505e1dbe2c8f06091c4af7 Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Thu, 25 Jun 2026 14:18:13 +0800 +Subject: [PATCH] restore ijk custom protocols and demuxers except long url and + async + +--- + libavcodec/Makefile | 1 + + libavformat/Makefile | 10 ++++ + libavformat/allformats.c | 3 ++ + libavformat/demux.c | 13 +++++ + libavformat/demux.h | 2 + + libavformat/ijkutils.c | 107 +++++++++++++++++++++++++++++++++++++++ + libavformat/protocols.c | 6 +++ + libavutil/Makefile | 3 +- + 8 files changed, 144 insertions(+), 1 deletion(-) + create mode 100644 libavformat/ijkutils.c + +diff --git a/libavcodec/Makefile b/libavcodec/Makefile +index 1410bd8..4445d9e 100644 +--- a/libavcodec/Makefile ++++ b/libavcodec/Makefile +@@ -26,6 +26,7 @@ HEADERS = ac3_parser.h \ + version_major.h \ + videotoolbox.h \ + vorbis_parser.h \ ++ packet_internal.h \ + + OBJS = ac3_parser.o \ + adts_parser.o \ +diff --git a/libavformat/Makefile b/libavformat/Makefile +index 3c95fc4..85ed05b 100644 +--- a/libavformat/Makefile ++++ b/libavformat/Makefile +@@ -7,6 +7,15 @@ HEADERS = avformat.h \ + version_major.h \ + application.h \ + dns_cache.h \ ++ demux.h \ ++ avc.h \ ++ url.h \ ++ internal.h \ ++ avio_internal.h \ ++ flv.h \ ++ id3v2.h \ ++ os_support.h \ ++ metadata.h \ + + + OBJS = allformats.o \ +@@ -40,6 +49,7 @@ OBJS = allformats.o \ + vpcc.o \ + application.o \ + dns_cache.o \ ++ ijkutils.o \ + + OBJS-$(HAVE_LIBC_MSVCRT) += file_open.o + +diff --git a/libavformat/allformats.c b/libavformat/allformats.c +index 6ec361f..0c2d5ca 100644 +--- a/libavformat/allformats.c ++++ b/libavformat/allformats.c +@@ -584,6 +584,9 @@ extern const FFInputFormat ff_libmodplug_demuxer; + extern const FFInputFormat ff_libopenmpt_demuxer; + extern const FFInputFormat ff_vapoursynth_demuxer; + ++// ijk custom demuxers ++extern FFInputFormat ff_ijklivehook_demuxer; ++ + #include "libavformat/muxer_list.c" + #include "libavformat/demuxer_list.c" + +diff --git a/libavformat/demux.c b/libavformat/demux.c +index 5553997..fdecbd9 100644 +--- a/libavformat/demux.c ++++ b/libavformat/demux.c +@@ -235,6 +235,7 @@ int avformat_open_input(AVFormatContext **ps, const char *filename, + AVFormatContext *s = *ps; + FFFormatContext *si; + AVDictionary *tmp = NULL; ++ AVDictionary *tmp2 = NULL; + ID3v2ExtraMeta *id3v2_extra_meta = NULL; + int ret = 0; + +@@ -318,6 +319,16 @@ int avformat_open_input(AVFormatContext **ps, const char *filename, + /* e.g. AVFMT_NOFILE formats will not have an AVIOContext */ + if (s->pb && is_id3v2_format(s->iformat)) + ff_id3v2_read_dict(s->pb, &si->id3v2_meta, ID3v2_DEFAULT_MAGIC, &id3v2_extra_meta); ++ ++ if (ffifmt(s->iformat)->read_header2) { ++ if (options) ++ av_dict_copy(&tmp2,*options, 0); ++ if ((ret = ffifmt(s->iformat)->read_header2(s, &tmp2)) < 0) { ++ if (ffifmt(s->iformat)->flags_internal & FF_INFMT_FLAG_INIT_CLEANUP) ++ goto close; ++ goto fail; ++ } ++ } else + + if (ffifmt(s->iformat)->read_header) + if ((ret = ffifmt(s->iformat)->read_header(s)) < 0) { +@@ -357,6 +368,7 @@ int avformat_open_input(AVFormatContext **ps, const char *filename, + if (options) { + av_dict_free(options); + *options = tmp; ++ av_dict_free(&tmp2); + } + *ps = s; + return 0; +@@ -367,6 +379,7 @@ close: + fail: + ff_id3v2_free_extra_meta(&id3v2_extra_meta); + av_dict_free(&tmp); ++ av_dict_free(&tmp2); + if (s->pb && !(s->flags & AVFMT_FLAG_CUSTOM_IO)) + ff_format_io_close(s, &s->pb); + avformat_free_context(s); +diff --git a/libavformat/demux.h b/libavformat/demux.h +index f09afc8..531c433 100644 +--- a/libavformat/demux.h ++++ b/libavformat/demux.h +@@ -98,6 +98,8 @@ typedef struct FFInputFormat { + */ + int (*read_header)(struct AVFormatContext *); + ++ int (*read_header2)(struct AVFormatContext *, AVDictionary **options); ++ + /** + * Read one packet and put it in 'pkt'. pts and flags are also + * set. 'avformat_new_stream' can be called only if the flag +diff --git a/libavformat/ijkutils.c b/libavformat/ijkutils.c +new file mode 100644 +index 0000000..0314c48 +--- /dev/null ++++ b/libavformat/ijkutils.c +@@ -0,0 +1,107 @@ ++/* ++ * utils.c ++ * ++ * Copyright (c) 2003 Fabrice Bellard ++ * Copyright (c) 2013 Zhang Rui ++ * ++ * This file is part of ijkPlayer. ++ * ++ * ijkPlayer is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * ijkPlayer is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with ijkPlayer; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#include ++#include "url.h" ++#include "demux.h" ++ ++ ++#define IJK_FF_PROTOCOL(x) \ ++extern URLProtocol ff_##x##_protocol; \ ++int ijkav_register_##x##_protocol(URLProtocol *protocol, int protocol_size); \ ++int ijkav_register_##x##_protocol(URLProtocol *protocol, int protocol_size) \ ++{ \ ++ if (protocol_size != sizeof(URLProtocol)) { \ ++ av_log(NULL, AV_LOG_ERROR, "ijkav_register_##x##_protocol: ABI mismatch.\n"); \ ++ return -1; \ ++ } \ ++ memcpy(&ff_##x##_protocol, protocol, protocol_size); \ ++ return 0; \ ++} ++ ++#define IJK_DUMMY_PROTOCOL(x) \ ++IJK_FF_PROTOCOL(x); \ ++static const AVClass ijk_##x##_context_class = { \ ++ .class_name = #x, \ ++ .item_name = av_default_item_name, \ ++ .version = LIBAVUTIL_VERSION_INT, \ ++ }; \ ++ \ ++URLProtocol ff_##x##_protocol = { \ ++ .name = #x, \ ++ .url_open2 = ijkdummy_open, \ ++ .priv_data_size = 1, \ ++ .priv_data_class = &ijk_##x##_context_class, \ ++}; ++ ++static int ijkdummy_open(URLContext *h, const char *arg, int flags, AVDictionary **options) ++{ ++ return -1; ++} ++ ++static int ijkdummy_probe(const AVProbeData *p) ++{ ++ return AVERROR_INVALIDDATA; ++} ++ ++IJK_DUMMY_PROTOCOL(ijkmediadatasource); ++IJK_DUMMY_PROTOCOL(ijkhttphook); ++IJK_DUMMY_PROTOCOL(ijksegment); ++IJK_DUMMY_PROTOCOL(ijktcphook); ++IJK_DUMMY_PROTOCOL(ijkio); ++ ++#define IJK_FF_DEMUXER(x) \ ++extern FFInputFormat ff_##x##_demuxer; \ ++int ijkav_register_##x##_demuxer(FFInputFormat *demuxer, int demuxer_size); \ ++int ijkav_register_##x##_demuxer(FFInputFormat *demuxer, int demuxer_size) \ ++{ \ ++ if (demuxer_size != sizeof(FFInputFormat)) { \ ++ av_log(NULL, AV_LOG_ERROR, "ijkav_register_##x##_demuxer: ABI mismatch.\n"); \ ++ return -1; \ ++ } \ ++ memcpy(&ff_##x##_demuxer, demuxer, demuxer_size); \ ++ return 0; \ ++} ++ ++#define IJK_DUMMY_DEMUXER(x) \ ++IJK_FF_DEMUXER(x); \ ++static const AVClass ijk_##x##_demuxer_class = { \ ++ .class_name = #x, \ ++ .item_name = av_default_item_name, \ ++ .version = LIBAVUTIL_VERSION_INT, \ ++ }; \ ++ \ ++FFInputFormat ff_##x##_demuxer = { \ ++ .p.name = #x, \ ++ .p.priv_class = &ijk_##x##_demuxer_class, \ ++ .priv_data_size = 1, \ ++ .flags_internal = FF_INFMT_FLAG_INIT_CLEANUP, \ ++ .read_probe = ijkdummy_probe, \ ++}; ++ ++/* ++ libavformat/ijkutils.c:99:1: error: field designator 'priv_data_size' does not refer to any field in type 'AVInputFormat' (aka 'struct AVInputFormat') ++ 99 | IJK_DUMMY_DEMUXER(ijklivehook); ++ ++ */ ++IJK_DUMMY_DEMUXER(ijklivehook); +diff --git a/libavformat/protocols.c b/libavformat/protocols.c +index 207b6bf..de0926b 100644 +--- a/libavformat/protocols.c ++++ b/libavformat/protocols.c +@@ -79,6 +79,12 @@ extern const URLProtocol ff_libzmq_protocol; + extern const URLProtocol ff_ipfs_gateway_protocol; + extern const URLProtocol ff_ipns_gateway_protocol; + ++extern const URLProtocol ff_ijkhttphook_protocol; ++extern const URLProtocol ff_ijkmediadatasource_protocol; ++extern const URLProtocol ff_ijksegment_protocol; ++extern const URLProtocol ff_ijktcphook_protocol; ++extern const URLProtocol ff_ijkio_protocol; ++ + #include "libavformat/protocol_list.c" + + const AVClass *ff_urlcontext_child_class_iterate(void **iter) +diff --git a/libavutil/Makefile b/libavutil/Makefile +index c524189..a9fbf99 100644 +--- a/libavutil/Makefile ++++ b/libavutil/Makefile +@@ -99,7 +99,8 @@ HEADERS = adler32.h \ + xtea.h \ + tea.h \ + tx.h \ +- video_hint.h ++ video_hint.h \ ++ thread.h \ + + ARCH_HEADERS = bswap.h \ + intmath.h \ +-- +2.50.1 (Apple Git-155) + diff --git a/patches/ffmpeg-n8.1.2/0006-add-4-dummy-ijkplaceholder-demuxers.patch b/patches/ffmpeg-n8.1.2/0006-add-4-dummy-ijkplaceholder-demuxers.patch new file mode 100644 index 000000000..535f45598 --- /dev/null +++ b/patches/ffmpeg-n8.1.2/0006-add-4-dummy-ijkplaceholder-demuxers.patch @@ -0,0 +1,41 @@ +From 44ce37e539f1db0fce3804b192f2e48a7d72e040 Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Fri, 8 May 2026 17:02:34 +0800 +Subject: add 4 dummy ijkplaceholder demuxers + +--- + libavformat/allformats.c | 4 ++++ + libavformat/ijkutils.c | 4 ++++ + 2 files changed, 8 insertions(+) + +diff --git a/libavformat/allformats.c b/libavformat/allformats.c +index 0c2d5ca..e2f37da 100644 +--- a/libavformat/allformats.c ++++ b/libavformat/allformats.c +@@ -586,6 +586,10 @@ extern const FFInputFormat ff_vapoursynth_demuxer; + + // ijk custom demuxers + extern FFInputFormat ff_ijklivehook_demuxer; ++extern FFInputFormat ff_ijkplaceholder1_demuxer; ++extern FFInputFormat ff_ijkplaceholder2_demuxer; ++extern FFInputFormat ff_ijkplaceholder3_demuxer; ++extern FFInputFormat ff_ijkplaceholder4_demuxer; + + #include "libavformat/muxer_list.c" + #include "libavformat/demuxer_list.c" +diff --git a/libavformat/ijkutils.c b/libavformat/ijkutils.c +index 0314c48..ac80e54 100644 +--- a/libavformat/ijkutils.c ++++ b/libavformat/ijkutils.c +@@ -105,3 +105,7 @@ FFInputFormat ff_##x##_demuxer = { \ + + */ + IJK_DUMMY_DEMUXER(ijklivehook); ++IJK_DUMMY_DEMUXER(ijkplaceholder1); ++IJK_DUMMY_DEMUXER(ijkplaceholder2); ++IJK_DUMMY_DEMUXER(ijkplaceholder3); ++IJK_DUMMY_DEMUXER(ijkplaceholder4); +\ No newline at end of file +-- +2.50.1 (Apple Git-155) + diff --git a/patches/ffmpeg-n8.1.2/0007-add-3-dummy-ijkhttp-protocols.patch b/patches/ffmpeg-n8.1.2/0007-add-3-dummy-ijkhttp-protocols.patch new file mode 100644 index 000000000..eefafb84e --- /dev/null +++ b/patches/ffmpeg-n8.1.2/0007-add-3-dummy-ijkhttp-protocols.patch @@ -0,0 +1,41 @@ +From 86da4f9eeb7824aa61cb59b690507a0772972a1d Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Fri, 8 May 2026 17:07:35 +0800 +Subject: add 3 dummy ijkhttp protocols + +--- + libavformat/ijkutils.c | 3 +++ + libavformat/protocols.c | 3 +++ + 2 files changed, 6 insertions(+) + +diff --git a/libavformat/ijkutils.c b/libavformat/ijkutils.c +index ac80e54..ba8eadd 100644 +--- a/libavformat/ijkutils.c ++++ b/libavformat/ijkutils.c +@@ -69,6 +69,9 @@ IJK_DUMMY_PROTOCOL(ijkhttphook); + IJK_DUMMY_PROTOCOL(ijksegment); + IJK_DUMMY_PROTOCOL(ijktcphook); + IJK_DUMMY_PROTOCOL(ijkio); ++IJK_DUMMY_PROTOCOL(ijkhttp1); ++IJK_DUMMY_PROTOCOL(ijkhttp2); ++IJK_DUMMY_PROTOCOL(ijkhttp3); + + #define IJK_FF_DEMUXER(x) \ + extern FFInputFormat ff_##x##_demuxer; \ +diff --git a/libavformat/protocols.c b/libavformat/protocols.c +index de0926b..d1c1095 100644 +--- a/libavformat/protocols.c ++++ b/libavformat/protocols.c +@@ -84,6 +84,9 @@ extern const URLProtocol ff_ijkmediadatasource_protocol; + extern const URLProtocol ff_ijksegment_protocol; + extern const URLProtocol ff_ijktcphook_protocol; + extern const URLProtocol ff_ijkio_protocol; ++extern const URLProtocol ff_ijkhttp1_protocol; ++extern const URLProtocol ff_ijkhttp2_protocol; ++extern const URLProtocol ff_ijkhttp3_protocol; + + #include "libavformat/protocol_list.c" + +-- +2.50.1 (Apple Git-155) + diff --git a/patches/ffmpeg-n8.1.2/0008-restore-ijk-av_dict_get-that-converts-the-value-to-a.patch b/patches/ffmpeg-n8.1.2/0008-restore-ijk-av_dict_get-that-converts-the-value-to-a.patch new file mode 100644 index 000000000..d4f4d3c69 --- /dev/null +++ b/patches/ffmpeg-n8.1.2/0008-restore-ijk-av_dict_get-that-converts-the-value-to-a.patch @@ -0,0 +1,91 @@ +From 3da3f038de2cd4067263b69a06ac42ceb01b56d5 Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Wed, 28 May 2025 18:33:27 +0800 +Subject: restore ijk av_dict_get that converts the value to a + pointer + +--- + libavutil/dict.c | 39 ++++++++++++++++++++++++++++++++++++++- + libavutil/dict.h | 9 +++++++++ + 2 files changed, 47 insertions(+), 1 deletion(-) + +diff --git a/libavutil/dict.c b/libavutil/dict.c +index fafb454..db8ee05 100644 +--- a/libavutil/dict.c ++++ b/libavutil/dict.c +@@ -63,7 +63,7 @@ AVDictionaryEntry *av_dict_get(const AVDictionary *m, const char *key, + const AVDictionaryEntry *entry = prev; + unsigned int j; + +- if (!key) ++ if (!m || !key) + return NULL; + + while ((entry = av_dict_iterate(m, entry))) { +@@ -183,6 +183,43 @@ int av_dict_set_int(AVDictionary **pm, const char *key, int64_t value, + return av_dict_set(pm, key, valuestr, flags); + } + ++int av_dict_set_intptr(AVDictionary **pm, const char *key, uintptr_t value, ++ int flags) ++{ ++ char valuestr[22]; ++ snprintf(valuestr, sizeof(valuestr), "%p", value); ++ flags &= ~AV_DICT_DONT_STRDUP_VAL; ++ return av_dict_set(pm, key, valuestr, flags); ++} ++ ++uintptr_t av_dict_get_intptr(const AVDictionary *m, const char* key) { ++ uintptr_t ptr = NULL; ++ AVDictionaryEntry *t = NULL; ++ if ((t = av_dict_get(m, key, NULL, 0))) { ++ return av_dict_strtoptr(t->value); ++ } ++ return NULL; ++} ++ ++uintptr_t av_dict_strtoptr(char * value) { ++ uintptr_t ptr = NULL; ++ char *next = NULL; ++ if(!value || value[0] !='0' || (value[1]|0x20)!='x') { ++ return NULL; ++ } ++ ptr = strtoull(value, &next, 16); ++ if (next == value) { ++ return NULL; ++ } ++ return ptr; ++} ++ ++char * av_dict_ptrtostr(uintptr_t value) { ++ char valuestr[22] = {0}; ++ snprintf(valuestr, sizeof(valuestr), "%p", value); ++ return av_strdup(valuestr); ++} ++ + static int parse_key_value_pair(AVDictionary **pm, const char **buf, + const char *key_val_sep, const char *pairs_sep, + int flags) +diff --git a/libavutil/dict.h b/libavutil/dict.h +index 93c7cbf..d97a601 100644 +--- a/libavutil/dict.h ++++ b/libavutil/dict.h +@@ -173,6 +173,15 @@ int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags + */ + int av_dict_set_int(AVDictionary **pm, const char *key, int64_t value, int flags); + ++/** ++ * Convenience wrapper for av_dict_get that converts the value to a pointer ++ * and stores it. ++ */ ++int av_dict_set_intptr(AVDictionary **pm, const char *key, uintptr_t value, int flags); ++uintptr_t av_dict_get_intptr(const AVDictionary *m, const char* key); ++uintptr_t av_dict_strtoptr(char * value); ++char * av_dict_ptrtostr(uintptr_t value); ++ + /** + * Parse the key/value pairs list and add the parsed entries to a dictionary. + * +-- +2.50.1 (Apple Git-155) + diff --git a/patches/ffmpeg-n8.1.2/0009-control-which-http-impl-was-used-by-set-selected_htt.patch b/patches/ffmpeg-n8.1.2/0009-control-which-http-impl-was-used-by-set-selected_htt.patch new file mode 100644 index 000000000..f8ae3cb75 --- /dev/null +++ b/patches/ffmpeg-n8.1.2/0009-control-which-http-impl-was-used-by-set-selected_htt.patch @@ -0,0 +1,129 @@ +From 5b78a77e4274c7aa8199ad5cc0aa1aa464b381c8 Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Wed, 28 May 2025 18:25:51 +0800 +Subject: control which http impl was used by set selected_http + option + +--- + libavformat/avio.c | 63 ++++++++++++++++++++++++++++++++++++++++++++-- + libavformat/url.h | 16 ++++++++++++ + 2 files changed, 77 insertions(+), 2 deletions(-) + +diff --git a/libavformat/avio.c b/libavformat/avio.c +index b146ac9..0287cc6 100644 +--- a/libavformat/avio.c ++++ b/libavformat/avio.c +@@ -360,6 +360,65 @@ int ffurl_alloc(URLContext **puc, const char *filename, int flags, + return AVERROR_PROTOCOL_NOT_FOUND; + } + ++ ++static const struct URLProtocol *url_find_the_protocol(const char *proto_str) ++{ ++ const URLProtocol **protocols = ffurl_get_protocols(NULL, NULL); ++ if (!protocols) ++ return NULL; ++ for (int i = 0; protocols[i]; i++) { ++ const URLProtocol *up = protocols[i]; ++ if (!strcmp(proto_str, up->name)) { ++ av_freep(&protocols); ++ return up; ++ } ++ } ++ av_freep(&protocols); ++ return NULL; ++} ++ ++int ffurl_alloc2(URLContext **puc, const char *filename, int flags, ++ const AVIOInterruptCB *int_cb, AVDictionary **options) ++{ ++ if (options && *options) { ++ AVDictionaryEntry *e = av_dict_get(*options, "selected_http", NULL, 0); ++ const char *selected_http; ++ if (e && (selected_http = e->value)) { ++ ++ char proto_str[128] = {0}; ++ size_t proto_len = strspn(filename, URL_SCHEME_CHARS); ++ if (filename[proto_len] != ':' && ++ (strncmp(filename, "subfile,", 8) || !strchr(filename + proto_len + 1, ':')) || ++ is_dos_path(filename)) ++ strcpy(proto_str, "file"); ++ else ++ av_strlcpy(proto_str, filename, ++ FFMIN(proto_len + 1, sizeof(proto_str))); ++ //only apply http protocol ++ if (!strcmp(proto_str, "http") || !strcmp(proto_str, "https")) { ++ if (!strcmp(selected_http, "ijkhttp1") || !strcmp(selected_http, "ijkhttp2") || !strcmp(selected_http, "ijkhttp3")) { ++ const URLProtocol *p = url_find_the_protocol(selected_http); ++ if (p) { ++ av_log(NULL, AV_LOG_DEBUG, "%s use %s send request\n",proto_str,selected_http); ++ return url_alloc_for_protocol(puc, p, filename, flags, int_cb); ++ } ++ *puc = NULL; ++ av_log(NULL, AV_LOG_ERROR, "some thing is fault,check %s protocol\n", selected_http); ++ return AVERROR_PROTOCOL_NOT_FOUND; ++ } else { ++ av_log(NULL, AV_LOG_ERROR, "invalid selected_http value: %s\n", selected_http); ++ av_assert0(0); ++ return AVERROR_PROTOCOL_NOT_FOUND; ++ } ++ } else { ++ av_log(NULL, AV_LOG_DEBUG, "%s not use %s\n",proto_str,selected_http); ++ } ++ } ++ } ++ ++ return ffurl_alloc(puc, filename, flags, int_cb); ++} ++ + int ffurl_open_whitelist(URLContext **puc, const char *filename, int flags, + const AVIOInterruptCB *int_cb, AVDictionary **options, + const char *whitelist, const char* blacklist, +@@ -367,7 +426,7 @@ int ffurl_open_whitelist(URLContext **puc, const char *filename, int flags, + { + AVDictionary *tmp_opts = NULL; + AVDictionaryEntry *e; +- int ret = ffurl_alloc(puc, filename, flags, int_cb); ++ int ret = ffurl_alloc2(puc, filename, flags, int_cb, options); + if (ret < 0) + return ret; + if (parent) { +@@ -736,7 +795,7 @@ int avio_open_dir(AVIODirContext **s, const char *url, AVDictionary **options) + goto fail; + } + +- if ((ret = ffurl_alloc(&h, url, AVIO_FLAG_READ, NULL)) < 0) ++ if ((ret = ffurl_alloc2(&h, url, AVIO_FLAG_READ, NULL, options)) < 0) + goto fail; + + if (h->prot->url_open_dir && h->prot->url_read_dir && h->prot->url_close_dir) { +diff --git a/libavformat/url.h b/libavformat/url.h +index 0784d77..53c6f13 100644 +--- a/libavformat/url.h ++++ b/libavformat/url.h +@@ -112,6 +112,22 @@ typedef struct URLProtocol { + int ffurl_alloc(URLContext **puc, const char *filename, int flags, + const AVIOInterruptCB *int_cb); + ++ /** ++ * Create a URLContext for accessing to the resource indicated by ++ * url, but do not initiate the connection yet. ++ * ++ * @param puc pointer to the location where, in case of success, the ++ * function puts the pointer to the created URLContext ++ * @param flags flags which control how the resource indicated by url ++ * is to be opened ++ * @param int_cb interrupt callback to use for the URLContext, may be ++ * NULL ++ * @param options A dictionary filled with options for replace http protocol ++ * @return >= 0 in case of success, a negative value corresponding to an ++ * AVERROR code in case of failure ++ */ ++int ffurl_alloc2(URLContext **puc, const char *filename, int flags, ++ const AVIOInterruptCB *int_cb, AVDictionary **options); + /** + * Connect an URLContext that has been allocated by ffurl_alloc + * +-- +2.50.1 (Apple Git-155) + diff --git a/patches/ffmpeg-n8.1.2/0010-correct-file-seekable-value-range-0-means-streamed-c.patch b/patches/ffmpeg-n8.1.2/0010-correct-file-seekable-value-range-0-means-streamed-c.patch new file mode 100644 index 000000000..f75a71451 --- /dev/null +++ b/patches/ffmpeg-n8.1.2/0010-correct-file-seekable-value-range-0-means-streamed-c.patch @@ -0,0 +1,26 @@ +From a238a10d136f21902de411f024536b43c87cae95 Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Fri, 8 May 2026 17:11:02 +0800 +Subject: correct file seekable value range, 0 means streamed + can't seek, 1 means not streamed can seek. + +--- + libavformat/file.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libavformat/file.c b/libavformat/file.c +index 3ceddc8..59a0442 100644 +--- a/libavformat/file.c ++++ b/libavformat/file.c +@@ -106,7 +106,7 @@ static const AVOption file_options[] = { + { "truncate", "truncate existing files on write", offsetof(FileContext, trunc), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, AV_OPT_FLAG_ENCODING_PARAM }, + { "blocksize", "set I/O operation maximum block size", offsetof(FileContext, blocksize), AV_OPT_TYPE_INT, { .i64 = INT_MAX }, 1, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM }, + { "follow", "Follow a file as it is being written", offsetof(FileContext, follow), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, AV_OPT_FLAG_DECODING_PARAM }, +- { "seekable", "Sets if the file is seekable", offsetof(FileContext, seekable), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 0, AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_ENCODING_PARAM }, ++ { "seekable", "Sets if the file is seekable", offsetof(FileContext, seekable), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_ENCODING_PARAM }, + { "pkt_size", "Maximum packet size", offsetof(FileContext, pkt_size), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_ENCODING_PARAM }, + { NULL } + }; +-- +2.50.1 (Apple Git-155) + diff --git a/patches/ffmpeg-n8.1.2/0011-fix-lrcdec-read-line-bug-on-osx.patch b/patches/ffmpeg-n8.1.2/0011-fix-lrcdec-read-line-bug-on-osx.patch new file mode 100644 index 000000000..0e34977cc --- /dev/null +++ b/patches/ffmpeg-n8.1.2/0011-fix-lrcdec-read-line-bug-on-osx.patch @@ -0,0 +1,43 @@ +From becb7439eaa9ab67f5317a58dbe183bd94d4fcce Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Wed, 28 May 2025 18:39:38 +0800 +Subject: fix lrcdec read line bug on osx + +--- + libavformat/lrcdec.c | 20 +++++++++++--------- + 1 file changed, 11 insertions(+), 9 deletions(-) + +diff --git a/libavformat/lrcdec.c b/libavformat/lrcdec.c +index 1f96305..b758662 100644 +--- a/libavformat/lrcdec.c ++++ b/libavformat/lrcdec.c +@@ -107,15 +107,17 @@ static int64_t read_line(AVBPrint *buf, AVIOContext *pb) + int64_t pos = avio_tell(pb); + + av_bprint_clear(buf); +- while(!avio_feof(pb)) { +- int c = avio_r8(pb); +- if(c != '\r') { +- av_bprint_chars(buf, c, 1); +- } +- if(c == '\n') { +- break; +- } +- } ++ ff_read_line_to_bprint_overwrite(pb, buf); ++ ++ // while(!avio_feof(pb)) { ++ // int c = avio_r8(pb); ++ // if(c != '\r') { ++ // av_bprint_chars(buf, c, 1); ++ // } ++ // if(c == '\n') { ++ // break; ++ // } ++ // } + return pos; + } + +-- +2.50.1 (Apple Git-155) + diff --git a/patches/ffmpeg-n8.1.2/0012-avformat-mpegts-index-only-keyframes-to-ensure-accur.patch b/patches/ffmpeg-n8.1.2/0012-avformat-mpegts-index-only-keyframes-to-ensure-accur.patch new file mode 100644 index 000000000..6ccd438cd --- /dev/null +++ b/patches/ffmpeg-n8.1.2/0012-avformat-mpegts-index-only-keyframes-to-ensure-accur.patch @@ -0,0 +1,47 @@ +From 5aef56e86381c8151a63486524fd475536f64fe4 Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Wed, 28 May 2025 18:48:39 +0800 +Subject: avformat/mpegts: index only keyframes to ensure + accurate seeks by default + +--- + libavformat/mpegts.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c +index 4b326d3..47944c7 100644 +--- a/libavformat/mpegts.c ++++ b/libavformat/mpegts.c +@@ -158,6 +158,7 @@ struct MpegTSContext { + + int skip_changes; + int skip_clear; ++ int seek_flag_keyframe; + int skip_unknown_pmt; + + int scan_all_pmts; +@@ -211,6 +212,8 @@ static const AVOption options[] = { + {.i64 = 0}, 0, 1, 0 }, + {"max_packet_size", "maximum size of emitted packet", offsetof(MpegTSContext, max_packet_size), AV_OPT_TYPE_INT, + {.i64 = 204800}, 1, INT_MAX/2, AV_OPT_FLAG_DECODING_PARAM }, ++ {"seek_flag_keyframe", "seek use keyframe mode", offsetof(MpegTSContext, seek_flag_keyframe), AV_OPT_TYPE_BOOL, ++ {.i64 = 1}, 0, 1, AV_OPT_FLAG_DECODING_PARAM }, + { NULL }, + }; + +@@ -3582,9 +3585,10 @@ static int64_t mpegts_get_dts(AVFormatContext *s, int stream_index, + av_packet_free(&pkt); + return AV_NOPTS_VALUE; + } +- if (pkt->dts != AV_NOPTS_VALUE && pkt->pos >= 0) { ++ ++ if (pkt->dts != AV_NOPTS_VALUE && pkt->pos >= 0 && (!ts->seek_flag_keyframe || (pkt->flags & AV_PKT_FLAG_KEY))) { + ff_reduce_index(s, pkt->stream_index); +- av_add_index_entry(s->streams[pkt->stream_index], pkt->pos, pkt->dts, 0, 0, AVINDEX_KEYFRAME /* FIXME keyframe? */); ++ av_add_index_entry(s->streams[pkt->stream_index], pkt->pos, pkt->dts, 0, 0, AVINDEX_KEYFRAME); + if (pkt->stream_index == stream_index && pkt->pos >= *ppos) { + int64_t dts = pkt->dts; + *ppos = pkt->pos; +-- +2.50.1 (Apple Git-155) + diff --git a/patches/ffmpeg-n8.1.2/0013-Correct-the-wrong-codecpar-codec_id-which-read-from-.patch b/patches/ffmpeg-n8.1.2/0013-Correct-the-wrong-codecpar-codec_id-which-read-from-.patch new file mode 100644 index 000000000..609d2c426 --- /dev/null +++ b/patches/ffmpeg-n8.1.2/0013-Correct-the-wrong-codecpar-codec_id-which-read-from-.patch @@ -0,0 +1,60 @@ +From ccea039f4d65a0f46eaf8c316ed602b95b3f6b90 Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Wed, 28 May 2025 18:52:01 +0800 +Subject: Correct the wrong codecpar->codec_id which read from + MIME of ID3tags, but the real data was encoded in PNG/JPEG/TIFF + +--- + libavformat/id3v2.c | 7 ++++++- + libavformat/img2dec.c | 2 +- + libavformat/mov.c | 2 +- + 3 files changed, 8 insertions(+), 3 deletions(-) + +diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c +index 5fc82ad..4ae12b6 100644 +--- a/libavformat/id3v2.c ++++ b/libavformat/id3v2.c +@@ -1187,8 +1187,13 @@ int ff_id3v2_parse_apic(AVFormatContext *s, ID3v2ExtraMeta *extra_meta) + st = s->streams[s->nb_streams - 1]; + st->codecpar->codec_id = apic->id; + +- if (AV_RB64(st->attached_pic.data) == PNGSIG) ++ if (AV_RB64(st->attached_pic.data) == PNGSIG || AV_RB64(st->attached_pic.data) == MNGSIG) { + st->codecpar->codec_id = AV_CODEC_ID_PNG; ++ } else if (AV_RB24(st->attached_pic.data) == 0xffd8ff) { ++ st->codecpar->codec_id = AV_CODEC_ID_MJPEG; ++ } else if (AV_RB32(st->attached_pic.data) == 0x49492a00 || AV_RB32(st->attached_pic.data) == 0x4D4D002a) { ++ st->codecpar->codec_id = AV_CODEC_ID_TIFF; ++ } + + if (apic->description[0]) + av_dict_set(&st->metadata, "title", apic->description, 0); +diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c +index ecb7ea8..0a26d5a 100644 +--- a/libavformat/img2dec.c ++++ b/libavformat/img2dec.c +@@ -892,7 +892,7 @@ static int png_probe(const AVProbeData *p) + { + const uint8_t *b = p->buf; + +- if (AV_RB64(b) == 0x89504e470d0a1a0a) ++ if (AV_RB64(b) == 0x89504e470d0a1a0a || AV_RB64(b) == 0x8a4d4e470d0a1a0a) + return AVPROBE_SCORE_MAX - 1; + return 0; + } +diff --git a/libavformat/mov.c b/libavformat/mov.c +index 222d79e..e114770 100644 +--- a/libavformat/mov.c ++++ b/libavformat/mov.c +@@ -259,7 +259,7 @@ static int mov_read_covr(MOVContext *c, AVIOContext *pb, int type, int len) + sc->refcount = 1; + + if (st->attached_pic.size >= 8 && id != AV_CODEC_ID_BMP) { +- if (AV_RB64(st->attached_pic.data) == 0x89504e470d0a1a0a) { ++ if (AV_RB64(st->attached_pic.data) == 0x89504e470d0a1a0a || AV_RB64(st->attached_pic.data) == 0x8a4d4e470d0a1a0a) { + id = AV_CODEC_ID_PNG; + } else { + id = AV_CODEC_ID_MJPEG; +-- +2.50.1 (Apple Git-155) + diff --git a/patches/ffmpeg-n8.1.2/0014-fix-http-chunked-transfer-get-wrong-size-cause-av_re.patch b/patches/ffmpeg-n8.1.2/0014-fix-http-chunked-transfer-get-wrong-size-cause-av_re.patch new file mode 100644 index 000000000..8e52c2f14 --- /dev/null +++ b/patches/ffmpeg-n8.1.2/0014-fix-http-chunked-transfer-get-wrong-size-cause-av_re.patch @@ -0,0 +1,32 @@ +From 74355a6170c59a122461ff0adeccaf178eeaf602 Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Thu, 29 May 2025 08:56:02 +0800 +Subject: fix http chunked transfer get wrong size cause + av_read_frame can not return eof bug + +--- + libavformat/img2dec.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c +index 0a26d5a..088c219 100644 +--- a/libavformat/img2dec.c ++++ b/libavformat/img2dec.c +@@ -451,7 +451,13 @@ int ff_img_read_packet(AVFormatContext *s1, AVPacket *pkt) + if (s->frame_size > 0) { + size[0] = s->frame_size; + } else if (!ffstream(s1->streams[0])->parser) { +- size[0] = avio_size(s1->pb); ++ //http Transfer-Encoding: chunked the size is -78; ++ int64_t s = avio_size(s1->pb); ++ if (s < 0) { ++ size[0] = 4096; ++ } else { ++ size[0] = s; ++ } + } else { + size[0] = 4096; + } +-- +2.50.1 (Apple Git-155) + diff --git a/patches/ffmpeg-n8.1.2/0015-not-very-useful-log-use-trace-level.patch b/patches/ffmpeg-n8.1.2/0015-not-very-useful-log-use-trace-level.patch new file mode 100644 index 000000000..a729faba4 --- /dev/null +++ b/patches/ffmpeg-n8.1.2/0015-not-very-useful-log-use-trace-level.patch @@ -0,0 +1,76 @@ +From 6a0647fe06239adcca0d09afe5ac0e78cc0224aa Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Thu, 29 May 2025 09:02:16 +0800 +Subject: not very useful log use trace level + +--- + libavcodec/h2645_parse.c | 6 +++--- + libavcodec/h2645_vui.c | 2 +- + libavformat/demux.c | 4 ++-- + 3 files changed, 6 insertions(+), 6 deletions(-) + +diff --git a/libavcodec/h2645_parse.c b/libavcodec/h2645_parse.c +index 659e818..63f3460 100644 +--- a/libavcodec/h2645_parse.c ++++ b/libavcodec/h2645_parse.c +@@ -417,7 +417,7 @@ static int vvc_parse_nal_header(H2645NAL *nal, void *logctx) + if ((nal->type >= VVC_IDR_W_RADL && nal->type <= VVC_RSV_IRAP_11) && nal->temporal_id) + return AVERROR_INVALIDDATA; + +- av_log(logctx, AV_LOG_DEBUG, ++ av_log(logctx, AV_LOG_TRACE, + "nal_unit_type: %d(%s), nuh_layer_id: %d, temporal_id: %d\n", + nal->type, vvc_nal_unit_name(nal->type), nal->nuh_layer_id, nal->temporal_id); + +@@ -438,7 +438,7 @@ static int hevc_parse_nal_header(H2645NAL *nal, void *logctx) + if (nal->temporal_id < 0) + return AVERROR_INVALIDDATA; + +- av_log(logctx, AV_LOG_DEBUG, ++ av_log(logctx, AV_LOG_TRACE, + "nal_unit_type: %d(%s), nuh_layer_id: %d, temporal_id: %d\n", + nal->type, hevc_nal_unit_name(nal->type), nal->nuh_layer_id, nal->temporal_id); + +@@ -455,7 +455,7 @@ static int h264_parse_nal_header(H2645NAL *nal, void *logctx) + nal->ref_idc = get_bits(gb, 2); + nal->type = get_bits(gb, 5); + +- av_log(logctx, AV_LOG_DEBUG, ++ av_log(logctx, AV_LOG_TRACE, + "nal_unit_type: %d(%s), nal_ref_idc: %d\n", + nal->type, h264_nal_unit_name(nal->type), nal->ref_idc); + +diff --git a/libavcodec/h2645_vui.c b/libavcodec/h2645_vui.c +index 0e576c1..445e471 100644 +--- a/libavcodec/h2645_vui.c ++++ b/libavcodec/h2645_vui.c +@@ -36,7 +36,7 @@ + + void ff_h2645_decode_common_vui_params(GetBitContext *gb, H2645VUI *vui, void *logctx) + { +- av_log(logctx, AV_LOG_DEBUG, "Decoding VUI\n"); ++ av_log(logctx, AV_LOG_TRACE, "Decoding VUI\n"); + + vui->aspect_ratio_info_present_flag = get_bits1(gb); + if (vui->aspect_ratio_info_present_flag) { +diff --git a/libavformat/demux.c b/libavformat/demux.c +index 05ab1e1..494e15f 100644 +--- a/libavformat/demux.c ++++ b/libavformat/demux.c +@@ -2074,11 +2074,11 @@ static void estimate_timings(AVFormatContext *ic, int64_t old_offset) + for (unsigned i = 0; i < ic->nb_streams; i++) { + AVStream *const st = ic->streams[i]; + if (st->time_base.den) +- av_log(ic, AV_LOG_TRACE, "stream %u: start_time: %s duration: %s\n", i, ++ av_log(ic, AV_LOG_DEBUG, "stream %u: start_time: %s duration: %s\n", i, + av_ts2timestr(st->start_time, &st->time_base), + av_ts2timestr(st->duration, &st->time_base)); + } +- av_log(ic, AV_LOG_TRACE, ++ av_log(ic, AV_LOG_DEBUG, + "format: start_time: %s duration: %s (estimate from %s) bitrate=%"PRId64" kb/s\n", + av_ts2timestr(ic->start_time, &AV_TIME_BASE_Q), + av_ts2timestr(ic->duration, &AV_TIME_BASE_Q), +-- +2.50.1 (Apple Git-155) + diff --git a/patches/ffmpeg-n8.1.2/0016-Audio-Vivid-Parser-and-Demuxer-but-av3a-Decoder-is-a.patch b/patches/ffmpeg-n8.1.2/0016-Audio-Vivid-Parser-and-Demuxer-but-av3a-Decoder-is-a.patch new file mode 100644 index 000000000..2f94cc8b0 --- /dev/null +++ b/patches/ffmpeg-n8.1.2/0016-Audio-Vivid-Parser-and-Demuxer-but-av3a-Decoder-is-a.patch @@ -0,0 +1,1341 @@ +From 0b9dacdb9282e956e0cecb0d7d5df7f5aa41f8cc Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Fri, 8 May 2026 19:00:36 +0800 +Subject: Audio Vivid Parser and Demuxer, but av3a Decoder is + absent + +--- + libavcodec/Makefile | 1 + + libavcodec/av3a.h | 314 ++++++++++++++++++++++++++ + libavcodec/av3a_parser.c | 219 ++++++++++++++++++ + libavcodec/codec_desc.c | 7 + + libavcodec/codec_id.h | 1 + + libavcodec/parsers.c | 1 + + libavcodec/utils.c | 1 + + libavformat/Makefile | 1 + + libavformat/allformats.c | 1 + + libavformat/av3adec.c | 473 +++++++++++++++++++++++++++++++++++++++ + libavformat/isom_tags.c | 1 + + libavformat/mov.c | 124 ++++++++++ + libavformat/mpegts.c | 6 + + libavformat/mpegts.h | 1 + + 14 files changed, 1151 insertions(+) + create mode 100644 libavcodec/av3a.h + create mode 100644 libavcodec/av3a_parser.c + create mode 100644 libavformat/av3adec.c + +diff --git a/libavcodec/Makefile b/libavcodec/Makefile +index 4445d9e..c51a860 100644 +--- a/libavcodec/Makefile ++++ b/libavcodec/Makefile +@@ -1247,6 +1247,7 @@ OBJS-$(CONFIG_APV_PARSER) += apv_parser.o + OBJS-$(CONFIG_AV1_PARSER) += av1_parser.o av1_parse.o + OBJS-$(CONFIG_AVS2_PARSER) += avs2.o avs2_parser.o + OBJS-$(CONFIG_AVS3_PARSER) += avs3_parser.o ++OBJS-$(CONFIG_AV3A_PARSER) += av3a_parser.o + OBJS-$(CONFIG_BMP_PARSER) += bmp_parser.o + OBJS-$(CONFIG_CAVSVIDEO_PARSER) += cavs_parser.o + OBJS-$(CONFIG_COOK_PARSER) += cook_parser.o +diff --git a/libavcodec/av3a.h b/libavcodec/av3a.h +new file mode 100644 +index 0000000..14dc349 +--- /dev/null ++++ b/libavcodec/av3a.h +@@ -0,0 +1,314 @@ ++/* ++ * AV3A Common Header File ++ * ++ * Copyright (c) 2024 Shuai Liu ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#ifndef AVCODEC_AV3A_H ++#define AVCODEC_AV3A_H ++ ++#include "libavutil/samplefmt.h" ++#include "libavutil/channel_layout.h" ++ ++/* AATF header */ ++#define AV3A_MAX_NBYTES_HEADER 9 ++#define AV3A_AUDIO_SYNC_WORD 0xFFF ++#define AV3A_AUDIO_FRAME_SIZE 1024 ++#define AV3A_CHANNEL_LAYOUT_SIZE 15 ++#define AV3A_BITRATE_TABLE_SIZE 16 ++#define AV3A_FS_TABLE_SIZE 9 ++#define AV3A_RESOLUTION_TABLE_SIZE 3 ++#define AV3A_DCA3_BOX_MIN_SIZE 5 ++ ++/* Channel Layout */ ++#define AV3A_CH_LAYOUT_MONO (AV_CH_LAYOUT_MONO) ++#define AV3A_CH_LAYOUT_STEREO (AV_CH_LAYOUT_STEREO) ++#define AV3A_CH_LAYOUT_4POINT0 (AV3A_CH_LAYOUT_STEREO|AV_CH_FRONT_CENTER|AV_CH_BACK_CENTER) ++#define AV3A_CH_LAYOUT_5POINT1 (AV_CH_LAYOUT_5POINT1) ++#define AV3A_CH_LAYOUT_7POINT1 (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT) ++#define AV3A_CH_LAYOUT_5POINT1POINT2 (AV_CH_LAYOUT_5POINT1|AV_CH_TOP_SIDE_LEFT|AV_CH_TOP_SIDE_RIGHT) ++#define AV3A_CH_LAYOUT_7POINT1POINT2 (AV3A_CH_LAYOUT_7POINT1|AV_CH_TOP_SIDE_LEFT|AV_CH_TOP_SIDE_RIGHT) ++#define AV3A_CH_LAYOUT_5POINT1POINT4 (AV_CH_LAYOUT_5POINT1|AV_CH_TOP_FRONT_LEFT|AV_CH_TOP_FRONT_RIGHT|AV_CH_TOP_BACK_LEFT|AV_CH_TOP_BACK_RIGHT) ++#define AV3A_CH_LAYOUT_7POINT1POINT4 (AV3A_CH_LAYOUT_7POINT1|AV_CH_TOP_FRONT_LEFT|AV_CH_TOP_FRONT_RIGHT|AV_CH_TOP_BACK_LEFT|AV_CH_TOP_BACK_RIGHT) ++#define AV3A_CH_AUDIO_OBJECT (AV_CHAN_UNKNOWN) ++ ++/* AV3A Codec ID */ ++typedef enum { ++ AV3A_LOSSLESS_CODEC_ID = 1, ++ AV3A_LOSSY_CODEC_ID = 2 ++} Av3aCodecId; ++ ++/* Content Type */ ++typedef enum { ++ AV3A_CHANNEL_BASED_TYPE = 0, ++ AV3A_OBJECT_BASED_TYPE = 1, ++ AV3A_CHANNEL_OBJECT_TYPE = 2, ++ AV3A_AMBISONIC_TYPE = 3 ++} Av3aContentType; ++ ++/* Internal Coding Profile */ ++typedef enum { ++ AV3A_BASE_PROFILE = 0, ++ AV3A_OBJECT_METADATA_PROFILE = 1, ++ AV3A_AMBISONIC_PROFILE = 2 ++} Av3aCodingProfile; ++ ++/* NN Type */ ++typedef enum { ++ AV3A_BASELINE_NN_TYPE = 0, ++ AV3A_LC_NN_TYPE = 1 ++} Av3aNeuralNetworkType; ++ ++/* AV3A Channel Configuration */ ++typedef enum { ++ CHANNEL_CONFIG_MONO = 0, /* Mono = 0 */ ++ CHANNEL_CONFIG_STEREO = 1, /* Stereo = 1 */ ++ CHANNEL_CONFIG_MC_5_1 = 2, /* 5.1 = 2 */ ++ CHANNEL_CONFIG_MC_7_1 = 3, /* 7.1 = 3 */ ++ CHANNEL_CONFIG_MC_10_2 = 4, /* 10.2 = 4 */ ++ CHANNEL_CONFIG_MC_22_2 = 5, /* 22.2 = 5 */ ++ CHANNEL_CONFIG_MC_4_0 = 6, /* 4.0 = 6 */ ++ CHANNEL_CONFIG_MC_5_1_2 = 7, /* 5.1.2 = 7 */ ++ CHANNEL_CONFIG_MC_5_1_4 = 8, /* 5.1.4 = 8 */ ++ CHANNEL_CONFIG_MC_7_1_2 = 9, /* 7.1.2 = 9 */ ++ CHANNEL_CONFIG_MC_7_1_4 = 10, /* 7.1.4 = 10 */ ++ CHANNEL_CONFIG_HOA_ORDER1 = 11, /* HOA1 = 11 */ ++ CHANNEL_CONFIG_HOA_ORDER2 = 12, /* HOA2 = 12 */ ++ CHANNEL_CONFIG_HOA_ORDER3 = 13, /* HOA3 = 13 */ ++ CHANNEL_CONFIG_UNKNOWN = 14 /* UNKNOWN = 14 */ ++} Av3aChannelConfig; ++ ++typedef enum { ++ AV3A_AMBISONIC_FIRST_ORDER = 1, ++ AV3A_AMBISONIC_SECOND_ORDER = 2, ++ AV3A_AMBISONIC_THIRD_ORDER = 3 ++} Av3aAmbisonicOrder; ++ ++typedef struct { ++ int16_t sync_word; /* sync word */ ++ int16_t audio_codec_id; /* audio codec id */ ++ int16_t anc_data; /* anc data */ ++ int16_t nn_type; /* neural network type */ ++ int16_t coding_profile; /* coding profile */ ++ int16_t sampling_frequency_index; /* sampling frequency index */ ++ int16_t channel_number_index; /* channel number index */ ++ int16_t bitrate_index; /* bitrate index */ ++ int16_t soundbed_type; /* soundbed type */ ++ int16_t object_channel_number; /* object channel number */ ++ int16_t bitrate_index_per_channel; /* bitrate per object */ ++ int16_t order; /* ambisonics order */ ++ int16_t resolution_index; /* resolution index */ ++ ++ int32_t sampling_rate; /* sampling rate */ ++ int64_t total_bitrate; /* total bitrate */ ++ int16_t sample_format; /* sample format */ ++ int16_t resolution; /* resolution */ ++ int16_t content_type; /* internal content type */ ++ int16_t nb_channels; /* number of channels (channel configuration) */ ++ int16_t nb_objects; /* number of objects (object_channel_number + 1) */ ++ int16_t total_channels; /* total channels */ ++ int16_t hoa_order; /* ambisonic order (order + 1) */ ++ int32_t ch_layout_mask; /* channel layout mask */ ++} AATFHeaderInfo; ++ ++/* bitrate table for mono */ ++static const int64_t ff_av3a_mono_bitrate_table[AV3A_BITRATE_TABLE_SIZE] = { ++ 16000, 32000, 44000, 56000, 64000, 72000, 80000, 96000, 128000, 144000, ++ 164000, 192000, 0, 0, 0, 0 ++}; ++ ++/* bitrate table for stereo */ ++static const int64_t ff_av3a_stereo_bitrate_table[AV3A_BITRATE_TABLE_SIZE] = { ++ 24000, 32000, 48000, 64000, 80000, 96000, 128000, 144000, 192000, 256000, ++ 320000, 0, 0, 0, 0, 0 ++}; ++ ++/* bitrate table for MC 5.1 */ ++static const int64_t ff_av3a_mc5p1_bitrate_table[AV3A_BITRATE_TABLE_SIZE] = { ++ 192000, 256000, 320000, 384000, 448000, 512000, 640000, 720000, 144000, 96000, ++ 128000, 160000, 0, 0, 0, 0 ++}; ++ ++/* bitrate table for MC 7.1 */ ++static const int64_t ff_av3a_mc7p1_bitrate_table[AV3A_BITRATE_TABLE_SIZE] = { ++ 192000, 480000, 256000, 384000, 576000, 640000, 128000, 160000, 0, 0, ++ 0, 0, 0, 0, 0, 0 ++}; ++ ++/* bitrate table for MC 4.0 */ ++static const int64_t ff_av3a_mc4p0_bitrate_table[AV3A_BITRATE_TABLE_SIZE] = { ++ 48000, 96000, 128000, 192000, 256000, 0, 0, 0, 0, 0, ++ 0, 0, 0, 0, 0, 0 ++}; ++ ++/* bitrate table for MC 5.1.2 */ ++static const int64_t ff_av3a_mc5p1p2_bitrate_table[AV3A_BITRATE_TABLE_SIZE] = { ++ 152000, 320000, 480000, 576000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ++}; ++ ++/* bitrate table for MC 5.1.4 */ ++static const int64_t ff_av3a_mc5p1p4_bitrate_table[AV3A_BITRATE_TABLE_SIZE] = { ++ 176000, 384000, 576000, 704000, 256000, 448000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ++}; ++ ++/* bitrate table for MC 7.1.2 */ ++static const int64_t ff_av3a_mc7p1p2_bitrate_table[AV3A_BITRATE_TABLE_SIZE] = { ++ 216000, 480000, 576000, 384000, 768000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ++}; ++ ++/* bitrate table for MC 7.1.4 */ ++static const int64_t ff_av3a_mc7p1p4_bitrate_table[AV3A_BITRATE_TABLE_SIZE] = { ++ 240000, 608000, 384000, 512000, 832000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ++}; ++ ++/* bitrate table for FOA */ ++static const int64_t ff_av3a_foa_bitrate_table[AV3A_BITRATE_TABLE_SIZE] = { ++ 48000, 96000, 128000, 192000, 256000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ++}; ++ ++/* bitrate table for HOA2 */ ++static const int64_t ff_av3a_hoa2_bitrate_table[AV3A_BITRATE_TABLE_SIZE] = { ++ 192000, 256000, 320000, 384000, 480000, 512000, 640000, 0, 0, 0, 0, 0, 0, 0, 0, 0 ++}; ++ ++/* bitrate table for HOA3 */ ++static const int64_t ff_av3a_hoa3_bitrate_table[AV3A_BITRATE_TABLE_SIZE] = { ++ 256000, 320000, 384000, 512000, 640000, 896000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; ++ ++static const int32_t ff_av3a_sampling_rate_table[AV3A_FS_TABLE_SIZE] = { ++ 192000, 96000, 48000, 44100, 32000, 24000, 22050, 16000, 8000 ++}; ++ ++typedef struct { ++ int16_t resolution; ++ enum AVSampleFormat sample_format; ++} Av3aSampleFormatMap; ++ ++static const Av3aSampleFormatMap ff_av3a_sample_format_map_table[AV3A_RESOLUTION_TABLE_SIZE] = { ++ {8, AV_SAMPLE_FMT_U8 }, /* 0: 8 bits */ ++ {16, AV_SAMPLE_FMT_S16}, /* 1: 16 bits */ ++ {24, AV_SAMPLE_FMT_S32}, /* 2: 24 bits */ ++}; ++ ++typedef struct { ++ Av3aChannelConfig channel_number_index; ++ int16_t channels; ++ const enum AVChannel* channel_layout; ++ uint64_t mask; ++} Av3aChannelConfigMap; ++ ++static const enum AVChannel ff_av3a_default_channel_layout_mono[1] = { ++ AV_CHAN_FRONT_CENTER ++}; ++ ++static const enum AVChannel ff_av3a_default_channel_layout_stereo[2] = { ++ AV_CHAN_FRONT_LEFT, AV_CHAN_FRONT_RIGHT ++}; ++ ++static const enum AVChannel ff_av3a_channel_layout_mc_4_0[4] = { ++ AV_CHAN_FRONT_LEFT, AV_CHAN_FRONT_RIGHT, ++ AV_CHAN_FRONT_CENTER, AV_CHAN_BACK_CENTER ++}; ++ ++static const enum AVChannel ff_av3a_default_channel_layout_mc_5_1[6] = { ++ AV_CHAN_FRONT_LEFT, AV_CHAN_FRONT_RIGHT, AV_CHAN_FRONT_CENTER, ++ AV_CHAN_LOW_FREQUENCY, ++ AV_CHAN_SIDE_LEFT, AV_CHAN_SIDE_RIGHT ++}; ++ ++static const enum AVChannel ff_av3a_default_channel_layout_mc_5_1_2[8] = { ++ AV_CHAN_FRONT_LEFT, AV_CHAN_FRONT_RIGHT, AV_CHAN_FRONT_CENTER, ++ AV_CHAN_LOW_FREQUENCY, ++ AV_CHAN_SIDE_LEFT, AV_CHAN_SIDE_RIGHT, ++ AV_CHAN_TOP_SIDE_LEFT, AV_CHAN_TOP_SIDE_RIGHT ++}; ++ ++static const enum AVChannel ff_av3a_default_channel_layout_mc_7_1[8] = { ++ AV_CHAN_FRONT_LEFT, AV_CHAN_FRONT_RIGHT, AV_CHAN_FRONT_CENTER, ++ AV_CHAN_LOW_FREQUENCY, ++ AV_CHAN_SIDE_LEFT, AV_CHAN_SIDE_RIGHT, ++ AV_CHAN_BACK_LEFT, AV_CHAN_BACK_RIGHT ++}; ++ ++static const enum AVChannel ff_av3a_default_channel_layout_mc_5_1_4[10] = { ++ AV_CHAN_FRONT_LEFT, AV_CHAN_FRONT_RIGHT, AV_CHAN_FRONT_CENTER, ++ AV_CHAN_LOW_FREQUENCY, ++ AV_CHAN_SIDE_LEFT, AV_CHAN_SIDE_RIGHT, ++ AV_CHAN_TOP_FRONT_LEFT, AV_CHAN_TOP_FRONT_RIGHT, ++ AV_CHAN_TOP_BACK_LEFT, AV_CHAN_TOP_BACK_RIGHT ++}; ++ ++static const enum AVChannel ff_av3a_default_channel_layout_mc_7_1_2[10] = { ++ AV_CHAN_FRONT_LEFT, AV_CHAN_FRONT_RIGHT, AV_CHAN_FRONT_CENTER, ++ AV_CHAN_LOW_FREQUENCY, ++ AV_CHAN_SIDE_LEFT, AV_CHAN_SIDE_RIGHT, ++ AV_CHAN_BACK_LEFT, AV_CHAN_BACK_RIGHT, ++ AV_CHAN_TOP_SIDE_LEFT, AV_CHAN_TOP_SIDE_RIGHT ++}; ++ ++static const enum AVChannel ff_av3a_default_channel_layout_mc_7_1_4[12] = { ++ AV_CHAN_FRONT_LEFT, AV_CHAN_FRONT_RIGHT, AV_CHAN_FRONT_CENTER, ++ AV_CHAN_LOW_FREQUENCY, ++ AV_CHAN_SIDE_LEFT, AV_CHAN_SIDE_RIGHT, ++ AV_CHAN_BACK_LEFT, AV_CHAN_BACK_RIGHT, ++ AV_CHAN_TOP_FRONT_LEFT, AV_CHAN_TOP_FRONT_RIGHT, ++ AV_CHAN_TOP_BACK_LEFT, AV_CHAN_TOP_BACK_RIGHT ++}; ++ ++static const Av3aChannelConfigMap ff_av3a_channels_map_table[AV3A_CHANNEL_LAYOUT_SIZE] = { ++ { CHANNEL_CONFIG_MONO, 1, ff_av3a_default_channel_layout_mono, AV3A_CH_LAYOUT_MONO }, ++ { CHANNEL_CONFIG_STEREO, 2, ff_av3a_default_channel_layout_stereo, AV3A_CH_LAYOUT_STEREO }, ++ { CHANNEL_CONFIG_MC_5_1, 6, ff_av3a_default_channel_layout_mc_5_1, AV3A_CH_LAYOUT_5POINT1 }, ++ { CHANNEL_CONFIG_MC_7_1, 8, ff_av3a_default_channel_layout_mc_7_1, AV3A_CH_LAYOUT_7POINT1 }, ++ { CHANNEL_CONFIG_MC_10_2, 12, NULL, 0L }, /* reserved */ ++ { CHANNEL_CONFIG_MC_22_2, 24, NULL, 0L }, /* reserved */ ++ { CHANNEL_CONFIG_MC_4_0, 4, ff_av3a_channel_layout_mc_4_0, AV3A_CH_LAYOUT_4POINT0 }, ++ { CHANNEL_CONFIG_MC_5_1_2, 8, ff_av3a_default_channel_layout_mc_5_1_2, AV3A_CH_LAYOUT_5POINT1POINT2 }, ++ { CHANNEL_CONFIG_MC_5_1_4, 10, ff_av3a_default_channel_layout_mc_5_1_4, AV3A_CH_LAYOUT_5POINT1POINT4 }, ++ { CHANNEL_CONFIG_MC_7_1_2, 10, ff_av3a_default_channel_layout_mc_7_1_2, AV3A_CH_LAYOUT_7POINT1POINT2 }, ++ { CHANNEL_CONFIG_MC_7_1_4, 12, ff_av3a_default_channel_layout_mc_7_1_4, AV3A_CH_LAYOUT_7POINT1POINT4 }, ++ { CHANNEL_CONFIG_HOA_ORDER1, 4, NULL, 0L }, ++ { CHANNEL_CONFIG_HOA_ORDER2, 9, NULL, 0L }, ++ { CHANNEL_CONFIG_HOA_ORDER3, 16, NULL, 0L }, ++ { CHANNEL_CONFIG_UNKNOWN, 0, NULL, 0L }, ++}; ++ ++typedef struct { ++ Av3aChannelConfig channel_number_index; ++ const int64_t *bitrate_table; ++} Av3aBitrateMap; ++ ++static const Av3aBitrateMap ff_av3a_bitrate_map_table[15] = { ++ {CHANNEL_CONFIG_MONO, ff_av3a_mono_bitrate_table }, ++ {CHANNEL_CONFIG_STEREO, ff_av3a_stereo_bitrate_table }, ++ {CHANNEL_CONFIG_MC_5_1, ff_av3a_mc5p1_bitrate_table }, ++ {CHANNEL_CONFIG_MC_7_1, ff_av3a_mc7p1_bitrate_table }, ++ {CHANNEL_CONFIG_MC_10_2, NULL }, /* reserved */ ++ {CHANNEL_CONFIG_MC_22_2, NULL }, /* reserved */ ++ {CHANNEL_CONFIG_MC_4_0, ff_av3a_mc4p0_bitrate_table }, ++ {CHANNEL_CONFIG_MC_5_1_2, ff_av3a_mc5p1p2_bitrate_table }, ++ {CHANNEL_CONFIG_MC_5_1_4, ff_av3a_mc5p1p4_bitrate_table }, ++ {CHANNEL_CONFIG_MC_7_1_2, ff_av3a_mc7p1p2_bitrate_table }, ++ {CHANNEL_CONFIG_MC_7_1_4, ff_av3a_mc7p1p4_bitrate_table }, ++ {CHANNEL_CONFIG_HOA_ORDER1, ff_av3a_foa_bitrate_table }, ++ {CHANNEL_CONFIG_HOA_ORDER2, ff_av3a_hoa2_bitrate_table }, ++ {CHANNEL_CONFIG_HOA_ORDER3, ff_av3a_hoa3_bitrate_table }, ++ {CHANNEL_CONFIG_UNKNOWN, NULL }, ++}; ++#endif /* AVCODEC_AV3A_H */ +diff --git a/libavcodec/av3a_parser.c b/libavcodec/av3a_parser.c +new file mode 100644 +index 0000000..66d461e +--- /dev/null ++++ b/libavcodec/av3a_parser.c +@@ -0,0 +1,219 @@ ++/* ++ * AV3A Parser ++ * ++ * Copyright (c) 2024 Shuai Liu ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#include ++#include ++#include "libavutil/intreadwrite.h" ++#include "parser.h" ++#include "get_bits.h" ++#include "av3a.h" ++#include "parser_internal.h" ++ ++typedef struct { ++ int16_t audio_codec_id; ++ int16_t nn_type; ++ int16_t frame_size; ++ int16_t resolution; ++ int32_t sample_rate; ++ int64_t bit_rate; ++ ++ int16_t content_type; ++ int16_t channel_number_index; ++ int16_t nb_channels; ++ int16_t nb_objects; ++ int16_t total_channels; ++} Av3aParseContext; ++ ++static int ff_read_av3a_header_parse(GetBitContext *gb, AATFHeaderInfo *hdf) ++{ ++ int64_t soundbed_bitrate = 0L; ++ int64_t object_bitrate = 0L; ++ ++ hdf->nb_channels = 0; ++ hdf->nb_objects = 0; ++ ++ hdf->sync_word = get_bits(gb, 12); ++ if (hdf->sync_word != AV3A_AUDIO_SYNC_WORD) { ++ return AVERROR_INVALIDDATA; ++ } ++ ++ hdf->audio_codec_id = get_bits(gb, 4); ++ if (hdf->audio_codec_id != AV3A_LOSSY_CODEC_ID) { ++ return AVERROR_INVALIDDATA; ++ } ++ ++ skip_bits(gb, 1); /* skip anc_data 1 bit */ ++ ++ hdf->nn_type = get_bits(gb, 3); ++ if ((hdf->nn_type > AV3A_LC_NN_TYPE) || (hdf->nn_type < AV3A_BASELINE_NN_TYPE)) { ++ return AVERROR_INVALIDDATA; ++ } ++ ++ hdf->coding_profile = get_bits(gb, 3); ++ ++ hdf->sampling_frequency_index = get_bits(gb, 4); ++ if ((hdf->sampling_frequency_index >= AV3A_FS_TABLE_SIZE) || (hdf->sampling_frequency_index < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ hdf->sampling_rate = ff_av3a_sampling_rate_table[hdf->sampling_frequency_index]; ++ ++ skip_bits(gb, 8); /* skip CRC 8 bits */ ++ ++ if (hdf->coding_profile == AV3A_BASE_PROFILE) { ++ hdf->content_type = AV3A_CHANNEL_BASED_TYPE; ++ hdf->channel_number_index = get_bits(gb, 7); ++ if ((hdf->channel_number_index >= CHANNEL_CONFIG_UNKNOWN) || ++ (hdf->channel_number_index == CHANNEL_CONFIG_MC_10_2) || ++ (hdf->channel_number_index == CHANNEL_CONFIG_MC_22_2) || ++ (hdf->channel_number_index < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ hdf->nb_channels = ff_av3a_channels_map_table[hdf->channel_number_index].channels; ++ } else if (hdf->coding_profile == AV3A_OBJECT_METADATA_PROFILE) { ++ hdf->soundbed_type = get_bits(gb, 2); ++ if (hdf->soundbed_type == 0) { ++ hdf->content_type = AV3A_OBJECT_BASED_TYPE; ++ hdf->object_channel_number = get_bits(gb, 7); ++ if (hdf->object_channel_number < 0) { ++ return AVERROR_INVALIDDATA; ++ } ++ hdf->nb_objects = hdf->object_channel_number + 1; ++ ++ hdf->bitrate_index_per_channel = get_bits(gb, 4); ++ if ((hdf->bitrate_index_per_channel >= AV3A_BITRATE_TABLE_SIZE) || (hdf->bitrate_index_per_channel < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ object_bitrate = ff_av3a_bitrate_map_table[CHANNEL_CONFIG_MONO].bitrate_table[hdf->bitrate_index_per_channel]; ++ hdf->total_bitrate = object_bitrate * hdf->nb_objects; ++ } else if (hdf->soundbed_type == 1) { ++ hdf->content_type = AV3A_CHANNEL_OBJECT_TYPE; ++ hdf->channel_number_index = get_bits(gb, 7); ++ if ((hdf->channel_number_index >= CHANNEL_CONFIG_UNKNOWN) || ++ (hdf->channel_number_index == CHANNEL_CONFIG_MC_10_2) || ++ (hdf->channel_number_index == CHANNEL_CONFIG_MC_22_2) || ++ (hdf->channel_number_index < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ ++ hdf->bitrate_index = get_bits(gb, 4); ++ if ((hdf->bitrate_index >= AV3A_BITRATE_TABLE_SIZE) || (hdf->bitrate_index < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ hdf->nb_channels = ff_av3a_channels_map_table[hdf->channel_number_index].channels; ++ soundbed_bitrate = ff_av3a_bitrate_map_table[hdf->channel_number_index].bitrate_table[hdf->bitrate_index]; ++ ++ hdf->object_channel_number = get_bits(gb, 7); ++ if (hdf->object_channel_number < 0) { ++ return AVERROR_INVALIDDATA; ++ } ++ hdf->bitrate_index_per_channel = get_bits(gb, 4); ++ if ((hdf->bitrate_index_per_channel >= AV3A_BITRATE_TABLE_SIZE) || (hdf->bitrate_index_per_channel < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ hdf->nb_objects = hdf->object_channel_number + 1; ++ object_bitrate = ff_av3a_bitrate_map_table[CHANNEL_CONFIG_MONO].bitrate_table[hdf->bitrate_index_per_channel]; ++ hdf->total_bitrate = soundbed_bitrate + (object_bitrate * hdf->nb_objects); ++ } else { ++ return AVERROR_INVALIDDATA; ++ } ++ } else if (hdf->coding_profile == AV3A_AMBISONIC_PROFILE) { ++ hdf->content_type = AV3A_AMBISONIC_TYPE; ++ hdf->order = get_bits(gb, 4); ++ hdf->hoa_order = hdf->order + 1; ++ ++ switch (hdf->hoa_order) { ++ case AV3A_AMBISONIC_FIRST_ORDER: ++ hdf->channel_number_index = CHANNEL_CONFIG_HOA_ORDER1; ++ break; ++ case AV3A_AMBISONIC_SECOND_ORDER: ++ hdf->channel_number_index = CHANNEL_CONFIG_HOA_ORDER2; ++ break; ++ case AV3A_AMBISONIC_THIRD_ORDER: ++ hdf->channel_number_index = CHANNEL_CONFIG_HOA_ORDER3; ++ break; ++ default: ++ return AVERROR_INVALIDDATA; ++ } ++ hdf->nb_channels = ff_av3a_channels_map_table[hdf->channel_number_index].channels; ++ } else { ++ return AVERROR_INVALIDDATA; ++ } ++ hdf->total_channels = hdf->nb_channels + hdf->nb_objects; ++ ++ hdf->resolution_index = get_bits(gb, 2); ++ if ((hdf->resolution_index >= AV3A_RESOLUTION_TABLE_SIZE) || (hdf->resolution_index < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ hdf->resolution = ff_av3a_sample_format_map_table[hdf->resolution_index].resolution; ++ hdf->sample_format = ff_av3a_sample_format_map_table[hdf->resolution_index].sample_format; ++ ++ if (hdf->coding_profile != AV3A_OBJECT_METADATA_PROFILE) { ++ hdf->bitrate_index = get_bits(gb, 4); ++ if ((hdf->bitrate_index >= AV3A_BITRATE_TABLE_SIZE) || (hdf->bitrate_index < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ hdf->total_bitrate = ff_av3a_bitrate_map_table[hdf->channel_number_index].bitrate_table[hdf->bitrate_index]; ++ } ++ ++ skip_bits(gb, 8); /* skip CRC 8 bits */ ++ ++ return 0; ++} ++ ++static int raw_av3a_parse(AVCodecParserContext *s, AVCodecContext *avctx, const uint8_t **poutbuf, ++ int32_t *poutbuf_size, const uint8_t *buf, int32_t buf_size) ++{ ++ int ret = 0; ++ uint8_t header[AV3A_MAX_NBYTES_HEADER]; ++ AATFHeaderInfo hdf; ++ GetBitContext gb; ++ ++ if (buf_size < AV3A_MAX_NBYTES_HEADER) { ++ return buf_size; ++ } ++ memcpy(header, buf, AV3A_MAX_NBYTES_HEADER); ++ ++ init_get_bits8(&gb, buf, AV3A_MAX_NBYTES_HEADER); ++ if ((ret = ff_read_av3a_header_parse(&gb, &hdf)) != 0) { ++ return ret; ++ } ++ ++ avctx->codec_id = AV_CODEC_ID_AVS3DA; ++ avctx->frame_size = AV3A_AUDIO_FRAME_SIZE; ++ avctx->bits_per_raw_sample = hdf.resolution; ++ avctx->sample_rate = hdf.sampling_rate; ++ avctx->bit_rate = hdf.total_bitrate; ++ ++ avctx->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC; ++ avctx->ch_layout.nb_channels = hdf.total_channels; ++ ++ *poutbuf = buf; ++ *poutbuf_size = buf_size; ++ ++ return buf_size; ++} ++ ++const FFCodecParser ff_av3a_parser = { ++ PARSER_CODEC_LIST(AV_CODEC_ID_AVS3DA), ++ .priv_data_size = sizeof(Av3aParseContext), ++ .parse = raw_av3a_parse, ++}; +diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c +index a9f21f8..93877ed 100644 +--- a/libavcodec/codec_desc.c ++++ b/libavcodec/codec_desc.c +@@ -3863,6 +3863,13 @@ static const AVCodecDescriptor codec_descriptors[] = { + .long_name = NULL_IF_CONFIG_SMALL("AVFrame to AVPacket passthrough"), + .props = AV_CODEC_PROP_LOSSLESS, + }, ++ { ++ .id = AV_CODEC_ID_AVS3DA, ++ .type = AVMEDIA_TYPE_AUDIO, ++ .name = "av3a", ++ .long_name = NULL_IF_CONFIG_SMALL("Audio Vivid"), ++ .props = AV_CODEC_PROP_LOSSY, ++ }, + { + .id = AV_CODEC_ID_VNULL, + .type = AVMEDIA_TYPE_VIDEO, +diff --git a/libavcodec/codec_id.h b/libavcodec/codec_id.h +index 6529f0a..43f7549 100644 +--- a/libavcodec/codec_id.h ++++ b/libavcodec/codec_id.h +@@ -628,6 +628,7 @@ enum AVCodecID { + * Dummy null video codec, useful mainly for development and debugging. + * Null encoder/decoder discard all input and never return any output. + */ ++ AV_CODEC_ID_AVS3DA, + AV_CODEC_ID_VNULL, + /** + * Dummy null audio codec, useful mainly for development and debugging. +diff --git a/libavcodec/parsers.c b/libavcodec/parsers.c +index 162b96c..415c842 100644 +--- a/libavcodec/parsers.c ++++ b/libavcodec/parsers.c +@@ -47,6 +47,7 @@ extern const FFCodecParser ff_apv_parser; + extern const FFCodecParser ff_av1_parser; + extern const FFCodecParser ff_avs2_parser; + extern const FFCodecParser ff_avs3_parser; ++extern const FFCodecParser ff_av3a_parser; + extern const FFCodecParser ff_bmp_parser; + extern const FFCodecParser ff_cavsvideo_parser; + extern const FFCodecParser ff_cook_parser; +diff --git a/libavcodec/utils.c b/libavcodec/utils.c +index 615d60c..46f2123 100644 +--- a/libavcodec/utils.c ++++ b/libavcodec/utils.c +@@ -603,6 +603,7 @@ static int get_audio_frame_duration(enum AVCodecID id, int sr, int ch, int ba, + case AV_CODEC_ID_MP2: + case AV_CODEC_ID_MUSEPACK7: return 1152; + case AV_CODEC_ID_AC3: return 1536; ++ case AV_CODEC_ID_AVS3DA: return 1024; + case AV_CODEC_ID_FTR: return 1024; + } + +diff --git a/libavformat/Makefile b/libavformat/Makefile +index 85ed05b..158a11d 100644 +--- a/libavformat/Makefile ++++ b/libavformat/Makefile +@@ -169,6 +169,7 @@ OBJS-$(CONFIG_AVS2_DEMUXER) += avs2dec.o rawdec.o + OBJS-$(CONFIG_AVS2_MUXER) += rawenc.o + OBJS-$(CONFIG_AVS3_DEMUXER) += avs3dec.o rawdec.o + OBJS-$(CONFIG_AVS3_MUXER) += rawenc.o ++OBJS-$(CONFIG_AV3A_DEMUXER) += av3adec.o + OBJS-$(CONFIG_BETHSOFTVID_DEMUXER) += bethsoftvid.o + OBJS-$(CONFIG_BFI_DEMUXER) += bfi.o + OBJS-$(CONFIG_BINK_DEMUXER) += bink.o +diff --git a/libavformat/allformats.c b/libavformat/allformats.c +index e2f37da..1a05db9 100644 +--- a/libavformat/allformats.c ++++ b/libavformat/allformats.c +@@ -101,6 +101,7 @@ extern const FFInputFormat ff_avs2_demuxer; + extern const FFOutputFormat ff_avs2_muxer; + extern const FFInputFormat ff_avs3_demuxer; + extern const FFOutputFormat ff_avs3_muxer; ++extern const FFInputFormat ff_av3a_demuxer; + extern const FFInputFormat ff_bethsoftvid_demuxer; + extern const FFInputFormat ff_bfi_demuxer; + extern const FFInputFormat ff_bintext_demuxer; +diff --git a/libavformat/av3adec.c b/libavformat/av3adec.c +new file mode 100644 +index 0000000..9bb8729 +--- /dev/null ++++ b/libavformat/av3adec.c +@@ -0,0 +1,473 @@ ++/* ++ * AV3A Demuxer ++ * ++ * Copyright (c) 2024 Shuai Liu ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++#include "avformat.h" ++#include "avio_internal.h" ++#include "internal.h" ++#include "rawdec.h" ++#include "libavutil/opt.h" ++#include "libavutil/avassert.h" ++#include "libavutil/intreadwrite.h" ++#include "libavutil/channel_layout.h" ++#include "libavcodec/get_bits.h" ++#include "libavcodec/av3a.h" ++#include ++ ++typedef struct { ++ uint8_t audio_codec_id; ++ uint8_t sampling_frequency_index; ++ uint8_t nn_type; ++ uint8_t content_type; ++ uint8_t channel_number_index; ++ uint8_t number_objects; ++ uint8_t hoa_order; ++ uint8_t resolution_index; ++ uint16_t total_bitrate_kbps; ++} Av3aFormatContext; ++ ++static int av3a_read_aatf_frame_header(AATFHeaderInfo *hdf, const uint8_t *buf) ++{ ++ int16_t sync_word; ++ GetBitContext gb; ++ ++ hdf->nb_channels = 0; ++ hdf->nb_objects = 0; ++ ++ init_get_bits8(&gb, buf, AV3A_MAX_NBYTES_HEADER); ++ ++ sync_word = get_bits(&gb, 12); ++ if (sync_word != AV3A_AUDIO_SYNC_WORD) { ++ return AVERROR_INVALIDDATA; ++ } ++ ++ /* codec id */ ++ hdf->audio_codec_id = get_bits(&gb, 4); ++ if (hdf->audio_codec_id != AV3A_LOSSY_CODEC_ID) { ++ return AVERROR_INVALIDDATA; ++ } ++ ++ /* anc data */ ++ hdf->anc_data = get_bits(&gb, 1); ++ if (hdf->anc_data) { ++ return AVERROR_INVALIDDATA; ++ } ++ ++ /* neural network type */ ++ hdf->nn_type = get_bits(&gb, 3); ++ if ((hdf->nn_type > AV3A_LC_NN_TYPE) || (hdf->nn_type < AV3A_BASELINE_NN_TYPE)) { ++ return AVERROR_INVALIDDATA; ++ } ++ ++ /* coding profile */ ++ hdf->coding_profile = get_bits(&gb, 3); ++ ++ /* sampling rate */ ++ hdf->sampling_frequency_index = get_bits(&gb, 4); ++ if ((hdf->sampling_frequency_index >= AV3A_FS_TABLE_SIZE) || (hdf->sampling_frequency_index < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ hdf->sampling_rate = ff_av3a_sampling_rate_table[hdf->sampling_frequency_index]; ++ ++ skip_bits(&gb, 8); ++ ++ if (hdf->coding_profile == AV3A_BASE_PROFILE) { ++ hdf->content_type = AV3A_CHANNEL_BASED_TYPE; ++ hdf->channel_number_index = get_bits(&gb, 7); ++ if ((hdf->channel_number_index >= CHANNEL_CONFIG_UNKNOWN) || ++ (hdf->channel_number_index == CHANNEL_CONFIG_MC_10_2) || ++ (hdf->channel_number_index == CHANNEL_CONFIG_MC_22_2) || ++ (hdf->channel_number_index < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ hdf->nb_channels = ff_av3a_channels_map_table[hdf->channel_number_index].channels; ++ } else if (hdf->coding_profile == AV3A_OBJECT_METADATA_PROFILE) { ++ hdf->soundbed_type = get_bits(&gb, 2); ++ if (hdf->soundbed_type == 0) { ++ hdf->content_type = AV3A_OBJECT_BASED_TYPE; ++ hdf->object_channel_number = get_bits(&gb, 7); ++ if (hdf->object_channel_number < 0) { ++ return AVERROR_INVALIDDATA; ++ } ++ hdf->bitrate_index_per_channel = get_bits(&gb, 4); ++ if ((hdf->bitrate_index_per_channel >= AV3A_BITRATE_TABLE_SIZE) || (hdf->bitrate_index_per_channel < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ hdf->nb_objects = hdf->object_channel_number + 1; ++ hdf->total_bitrate = ff_av3a_bitrate_map_table[CHANNEL_CONFIG_MONO].bitrate_table[hdf->bitrate_index_per_channel] * hdf->nb_objects; ++ } else if (hdf->soundbed_type == 1) { ++ hdf->content_type = AV3A_CHANNEL_OBJECT_TYPE; ++ hdf->channel_number_index = get_bits(&gb, 7); ++ if ((hdf->channel_number_index >= CHANNEL_CONFIG_UNKNOWN) || ++ (hdf->channel_number_index == CHANNEL_CONFIG_MC_10_2) || ++ (hdf->channel_number_index == CHANNEL_CONFIG_MC_22_2) || ++ (hdf->channel_number_index < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ hdf->nb_channels = ff_av3a_channels_map_table[hdf->channel_number_index].channels; ++ hdf->bitrate_index = get_bits(&gb, 4); ++ if ((hdf->bitrate_index >= AV3A_BITRATE_TABLE_SIZE) || (hdf->bitrate_index < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ ++ hdf->object_channel_number = get_bits(&gb, 7); ++ if (hdf->object_channel_number < 0) { ++ return AVERROR_INVALIDDATA; ++ } ++ hdf->nb_objects = hdf->object_channel_number + 1; ++ hdf->bitrate_index_per_channel = get_bits(&gb, 4); ++ if ((hdf->bitrate_index_per_channel >= AV3A_BITRATE_TABLE_SIZE) || (hdf->bitrate_index_per_channel < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ ++ hdf->total_bitrate = ff_av3a_bitrate_map_table[hdf->channel_number_index].bitrate_table[hdf->bitrate_index] + ++ ff_av3a_bitrate_map_table[CHANNEL_CONFIG_MONO].bitrate_table[hdf->bitrate_index_per_channel] * hdf->nb_objects; ++ } else { ++ return AVERROR_INVALIDDATA; ++ } ++ } else if (hdf->coding_profile == AV3A_AMBISONIC_PROFILE) { ++ hdf->content_type = AV3A_AMBISONIC_TYPE; ++ hdf->order = get_bits(&gb, 4); ++ hdf->hoa_order = hdf->order + 1; ++ ++ switch (hdf->hoa_order) { ++ case AV3A_AMBISONIC_FIRST_ORDER: ++ hdf->channel_number_index = CHANNEL_CONFIG_HOA_ORDER1; ++ break; ++ case AV3A_AMBISONIC_SECOND_ORDER: ++ hdf->channel_number_index = CHANNEL_CONFIG_HOA_ORDER2; ++ break; ++ case AV3A_AMBISONIC_THIRD_ORDER: ++ hdf->channel_number_index = CHANNEL_CONFIG_HOA_ORDER3; ++ break; ++ default: ++ return AVERROR_INVALIDDATA; ++ } ++ hdf->nb_channels = ff_av3a_channels_map_table[hdf->channel_number_index].channels; ++ } else { ++ return AVERROR_INVALIDDATA; ++ } ++ ++ hdf->total_channels = hdf->nb_channels + hdf->nb_objects; ++ ++ /* resolution */ ++ hdf->resolution_index = get_bits(&gb, 2); ++ if ((hdf->resolution_index >= AV3A_RESOLUTION_TABLE_SIZE) || (hdf->resolution_index < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ hdf->resolution = ff_av3a_sample_format_map_table[hdf->resolution_index].resolution; ++ hdf->sample_format = ff_av3a_sample_format_map_table[hdf->resolution_index].sample_format; ++ ++ if (hdf->coding_profile != AV3A_OBJECT_METADATA_PROFILE) { ++ hdf->bitrate_index = get_bits(&gb, 4); ++ if ((hdf->bitrate_index >= AV3A_BITRATE_TABLE_SIZE) || (hdf->bitrate_index < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ hdf->total_bitrate = ff_av3a_bitrate_map_table[hdf->channel_number_index].bitrate_table[hdf->bitrate_index]; ++ } ++ ++ skip_bits(&gb, 8); ++ ++ return 0; ++} ++ ++static int av3a_get_packet_size(AVFormatContext *s) ++{ ++ int ret = 0; ++ int read_bytes = 0; ++ uint16_t sync_word = 0; ++ int payload_bytes = 0; ++ int payloud_bits = 0; ++ uint8_t header[AV3A_MAX_NBYTES_HEADER]; ++ GetBitContext gb; ++ int32_t sampling_rate; ++ int16_t coding_profile, sampling_frequency_index, channel_number_index; ++ int16_t bitrate_index, bitrate_index_per_channel; ++ int16_t objects, hoa_order; ++ int64_t total_bitrate; ++ ++ if (!s) { ++ return AVERROR(ENOMEM); ++ } ++ ++ if (!s->pb) { ++ return AVERROR(ENOMEM); ++ } ++ ++ read_bytes = avio_read(s->pb, header, AV3A_MAX_NBYTES_HEADER); ++ if (read_bytes != AV3A_MAX_NBYTES_HEADER) { ++ return (read_bytes < 0) ? read_bytes : AVERROR_EOF; ++ } ++ ++ init_get_bits8(&gb, header, AV3A_MAX_NBYTES_HEADER); ++ ++ sync_word = get_bits(&gb, 12); ++ if (sync_word != AV3A_AUDIO_SYNC_WORD) { ++ return AVERROR_INVALIDDATA; ++ } ++ ++ skip_bits(&gb, 8); ++ ++ coding_profile = get_bits(&gb, 3); ++ sampling_frequency_index = get_bits(&gb, 4); ++ if ((sampling_frequency_index >= AV3A_FS_TABLE_SIZE) || (sampling_frequency_index < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ sampling_rate = ff_av3a_sampling_rate_table[sampling_frequency_index]; ++ ++ skip_bits(&gb, 8); ++ ++ if (coding_profile == AV3A_BASE_PROFILE) { ++ channel_number_index = get_bits(&gb, 7); ++ if ((channel_number_index >= CHANNEL_CONFIG_UNKNOWN) || ++ (channel_number_index == CHANNEL_CONFIG_MC_10_2) || ++ (channel_number_index == CHANNEL_CONFIG_MC_22_2) || ++ (channel_number_index < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ } else if (coding_profile == AV3A_OBJECT_METADATA_PROFILE) { ++ int64_t soundbed_bitrate, objects_bitrate; ++ int16_t soundbed_type = get_bits(&gb, 2); ++ if (soundbed_type == 0) { ++ objects = get_bits(&gb, 7); ++ if (objects < 0) { ++ return AVERROR_INVALIDDATA; ++ } ++ objects += 1; ++ ++ bitrate_index_per_channel = get_bits(&gb, 4); ++ if ((bitrate_index_per_channel >= AV3A_BITRATE_TABLE_SIZE) || (bitrate_index_per_channel < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ total_bitrate = ff_av3a_bitrate_map_table[CHANNEL_CONFIG_MONO].bitrate_table[bitrate_index_per_channel] * objects; ++ } else if (soundbed_type == 1) { ++ channel_number_index = get_bits(&gb, 7); ++ if ((channel_number_index >= CHANNEL_CONFIG_UNKNOWN) || ++ (channel_number_index == CHANNEL_CONFIG_MC_10_2) || ++ (channel_number_index == CHANNEL_CONFIG_MC_22_2) || ++ (channel_number_index < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ ++ bitrate_index = get_bits(&gb, 4); ++ if ((bitrate_index >= AV3A_BITRATE_TABLE_SIZE) || (bitrate_index < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ soundbed_bitrate = ff_av3a_bitrate_map_table[channel_number_index].bitrate_table[bitrate_index]; ++ ++ objects = get_bits(&gb, 7); ++ if (objects < 0) { ++ return AVERROR_INVALIDDATA; ++ } ++ objects += 1; ++ bitrate_index_per_channel = get_bits(&gb, 4); ++ if ((bitrate_index_per_channel >= AV3A_BITRATE_TABLE_SIZE) || (bitrate_index_per_channel < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ ++ objects_bitrate = ff_av3a_bitrate_map_table[CHANNEL_CONFIG_MONO].bitrate_table[bitrate_index_per_channel]; ++ total_bitrate = soundbed_bitrate + (objects_bitrate * objects); ++ } else { ++ return AVERROR_INVALIDDATA; ++ } ++ } else if (coding_profile == AV3A_AMBISONIC_PROFILE) { ++ hoa_order = get_bits(&gb, 4); ++ hoa_order += 1; ++ ++ switch (hoa_order) { ++ case AV3A_AMBISONIC_FIRST_ORDER: ++ channel_number_index = CHANNEL_CONFIG_HOA_ORDER1; ++ break; ++ case AV3A_AMBISONIC_SECOND_ORDER: ++ channel_number_index = CHANNEL_CONFIG_HOA_ORDER2; ++ break; ++ case AV3A_AMBISONIC_THIRD_ORDER: ++ channel_number_index = CHANNEL_CONFIG_HOA_ORDER3; ++ break; ++ default: ++ return AVERROR_INVALIDDATA; ++ } ++ } else { ++ return AVERROR_INVALIDDATA; ++ } ++ ++ skip_bits(&gb, 2); ++ if (coding_profile != AV3A_OBJECT_METADATA_PROFILE) { ++ bitrate_index = get_bits(&gb, 4); ++ if ((bitrate_index >= AV3A_BITRATE_TABLE_SIZE) || (bitrate_index < 0)) { ++ return AVERROR_INVALIDDATA; ++ } ++ total_bitrate = ff_av3a_bitrate_map_table[channel_number_index].bitrate_table[bitrate_index]; ++ } ++ ++ skip_bits(&gb, 8); ++ ++ if (sampling_rate == 44100) { ++ payloud_bits = (int)floor(((float) (total_bitrate) / sampling_rate) * AV3A_AUDIO_FRAME_SIZE); ++ payload_bytes = (int)ceil((float)payloud_bits / 8); ++ } else { ++ payload_bytes = (int)ceil((((float) (total_bitrate) / sampling_rate) * AV3A_AUDIO_FRAME_SIZE) / 8); ++ } ++ ++ if ((ret = avio_seek(s->pb, -read_bytes, SEEK_CUR)) < 0) { ++ return ret; ++ } ++ ++ return payload_bytes; ++} ++ ++static int av3a_probe(const AVProbeData *p) ++{ ++ uint16_t frame_sync_word; ++ uint16_t lval = ((uint16_t)(p->buf[0])); ++ uint16_t rval = ((uint16_t)(p->buf[1])); ++ frame_sync_word = ((lval << 8) | rval) >> 4; ++ ++ if (frame_sync_word == AV3A_AUDIO_SYNC_WORD && av_match_ext(p->filename, "av3a")) { ++ return AVPROBE_SCORE_MAX; ++ } ++ ++ return 0; ++} ++ ++static int av3a_read_header(AVFormatContext *s) ++{ ++ int ret = 0; ++ uint8_t header[AV3A_MAX_NBYTES_HEADER]; ++ AVStream *stream = NULL; ++ Av3aFormatContext av3afmtctx; ++ AATFHeaderInfo hdf; ++ ++ if (!s) { ++ return AVERROR(ENOMEM); ++ } ++ ++ if (!(stream = avformat_new_stream(s, NULL))) { ++ return AVERROR(ENOMEM); ++ } ++ ++ stream->start_time = 0; ++ ffstream(stream)->need_parsing = AVSTREAM_PARSE_FULL_RAW; ++ stream->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; ++ stream->codecpar->codec_id = ((const FFInputFormat*)(s->iformat))->raw_codec_id; ++ stream->codecpar->codec_tag = MKTAG('a', 'v', '3', 'a'); ++ ++ if ((ret = avio_read(s->pb, header, AV3A_MAX_NBYTES_HEADER)) != AV3A_MAX_NBYTES_HEADER) { ++ return (ret < 0) ? ret : AVERROR_EOF; ++ } ++ ++ ret = av3a_read_aatf_frame_header(&hdf, header); ++ if (ret) { ++ return ret; ++ } ++ ++ /* stream parameters */ ++ stream->codecpar->format = hdf.sample_format; ++ stream->codecpar->bits_per_raw_sample = hdf.resolution; ++ stream->codecpar->bit_rate = hdf.total_bitrate; ++ stream->codecpar->sample_rate = (int) (hdf.sampling_rate); ++ stream->codecpar->frame_size = AV3A_AUDIO_FRAME_SIZE; ++ stream->codecpar->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC; ++ stream->codecpar->ch_layout.nb_channels = hdf.total_channels; ++ ++ /* extradata */ ++ av3afmtctx.audio_codec_id = hdf.audio_codec_id; ++ av3afmtctx.sampling_frequency_index = hdf.sampling_frequency_index; ++ av3afmtctx.nn_type = hdf.nn_type; ++ av3afmtctx.content_type = hdf.content_type; ++ av3afmtctx.channel_number_index = hdf.channel_number_index; ++ av3afmtctx.number_objects = hdf.nb_objects; ++ av3afmtctx.hoa_order = hdf.hoa_order; ++ av3afmtctx.resolution_index = hdf.resolution_index; ++ av3afmtctx.total_bitrate_kbps = (int) (hdf.total_bitrate / 1000); ++ ++ if ((ret = ff_alloc_extradata(stream->codecpar, sizeof(Av3aFormatContext))) < 0) { ++ return ret; ++ } ++ memcpy(stream->codecpar->extradata, &av3afmtctx, sizeof(Av3aFormatContext)); ++ ++ if ((ret = avio_seek(s->pb, -AV3A_MAX_NBYTES_HEADER, SEEK_CUR)) < 0) { ++ return ret; ++ } ++ ++ return 0; ++} ++ ++static int av3a_read_packet(AVFormatContext *s, AVPacket *pkt) ++{ ++ int64_t pos; ++ int packet_size = 0; ++ int read_bytes = 0; ++ int ret = 0; ++ ++ if (!s) { ++ return AVERROR(ENOMEM); ++ } ++ ++ if (avio_feof(s->pb)) { ++ return AVERROR_EOF; ++ } ++ pos = avio_tell(s->pb); ++ ++ if (!(packet_size = av3a_get_packet_size(s))) { ++ return AVERROR_EOF; ++ } ++ ++ if (packet_size < 0) { ++ return packet_size; ++ } ++ ++ if ((ret = av_new_packet(pkt, packet_size)) < 0) { ++ return ret; ++ } ++ ++ if (!s->streams[0]) { ++ return AVERROR(ENOMEM); ++ } ++ ++ if (!s->streams[0]->codecpar) { ++ return AVERROR(ENOMEM); ++ } ++ ++ pkt->stream_index = 0; ++ pkt->pos = pos; ++ pkt->duration = s->streams[0]->codecpar->frame_size; ++ ++ read_bytes = avio_read(s->pb, pkt->data, packet_size); ++ if (read_bytes != packet_size) { ++ return (read_bytes < 0) ? read_bytes : AVERROR_EOF; ++ } ++ ++ return 0; ++} ++ ++const FFInputFormat ff_av3a_demuxer = { ++ .p.name = "av3a", ++ .p.long_name = NULL_IF_CONFIG_SMALL("Audio Vivid"), ++ .raw_codec_id = AV_CODEC_ID_AVS3DA, ++ .p.priv_class = &ff_raw_demuxer_class, ++ .priv_data_size = sizeof(FFRawDemuxerContext), ++ .read_probe = av3a_probe, ++ .read_header = av3a_read_header, ++ .read_packet = av3a_read_packet, ++ .p.flags = AVFMT_GENERIC_INDEX, ++ .p.extensions = "av3a", ++ .p.mime_type = "audio/av3a", ++}; +\ No newline at end of file +diff --git a/libavformat/isom_tags.c b/libavformat/isom_tags.c +index 1cd655b..528c518 100644 +--- a/libavformat/isom_tags.c ++++ b/libavformat/isom_tags.c +@@ -368,6 +368,7 @@ const AVCodecTag ff_codec_movaudio_tags[] = { + { AV_CODEC_ID_TRUEHD, MKTAG('m', 'l', 'p', 'a') }, /* mp4ra.org */ + { AV_CODEC_ID_OPUS, MKTAG('O', 'p', 'u', 's') }, /* mp4ra.org */ + { AV_CODEC_ID_MPEGH_3D_AUDIO, MKTAG('m', 'h', 'm', '1') }, /* MPEG-H 3D Audio bitstream */ ++ { AV_CODEC_ID_AVS3DA, MKTAG('a', 'v', '3', 'a') }, /* AVS3 Audio */ + { AV_CODEC_ID_NONE, 0 }, + }; + +diff --git a/libavformat/mov.c b/libavformat/mov.c +index e114770..b639fe1 100644 +--- a/libavformat/mov.c ++++ b/libavformat/mov.c +@@ -71,6 +71,10 @@ + #include "mov_chan.h" + #include "replaygain.h" + ++#if CONFIG_AV3A_DEMUXER ++#include "libavcodec/av3a.h" ++#endif ++ + #if CONFIG_ZLIB + #include + #endif +@@ -88,6 +92,123 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom); + static int mov_read_mfra(MOVContext *c, AVIOContext *f); + static void mov_free_stream_context(AVFormatContext *s, AVStream *st); + ++#if CONFIG_AV3A_DEMUXER ++static int mov_read_dca3(MOVContext *c, AVIOContext *pb, MOVAtom atom) ++{ ++ int ret; ++ int nb_channels = 0; ++ int nb_objects = 0; ++ AVStream *st; ++ GetBitContext gb; ++ uint8_t buffer[7]; ++ int audio_codec_id, sampling_frequency_index; ++ int nn_type, content_type, channel_number_index = 0, number_objects; ++ int hoa_order, resolution_index; ++ int bitrate_kbps; ++ ++ if (atom.size < AV3A_DCA3_BOX_MIN_SIZE) ++ return AVERROR_INVALIDDATA; ++ ++ if (c->fc->nb_streams < 1) ++ return 0; ++ st = c->fc->streams[c->fc->nb_streams - 1]; ++ ++ ret = avio_read(pb, buffer, sizeof(buffer)); ++ if (ret < 0) ++ return ret; ++ if (ret != (int)sizeof(buffer)) ++ return AVERROR_INVALIDDATA; ++ ++ init_get_bits8(&gb, buffer, sizeof(buffer)); ++ ++ audio_codec_id = get_bits(&gb, 4); ++ if (audio_codec_id != AV3A_LOSSY_CODEC_ID) ++ return AVERROR_INVALIDDATA; ++ ++ st->codecpar->frame_size = AV3A_AUDIO_FRAME_SIZE; ++ sampling_frequency_index = get_bits(&gb, 4); ++ if (sampling_frequency_index >= AV3A_FS_TABLE_SIZE) ++ return AVERROR_INVALIDDATA; ++ st->codecpar->sample_rate = ff_av3a_sampling_rate_table[sampling_frequency_index]; ++ ++ nn_type = get_bits(&gb, 3); ++ if (nn_type > AV3A_LC_NN_TYPE || nn_type < AV3A_BASELINE_NN_TYPE) ++ return AVERROR_INVALIDDATA; ++ ++ skip_bits(&gb, 1); ++ content_type = get_bits(&gb, 4); ++ if (content_type == AV3A_CHANNEL_BASED_TYPE) { ++ channel_number_index = get_bits(&gb, 7); ++ skip_bits(&gb, 1); ++ if (channel_number_index >= CHANNEL_CONFIG_UNKNOWN || ++ channel_number_index == CHANNEL_CONFIG_MC_10_2 || ++ channel_number_index == CHANNEL_CONFIG_MC_22_2) ++ return AVERROR_INVALIDDATA; ++ nb_channels = ff_av3a_channels_map_table[channel_number_index].channels; ++ } else if (content_type == AV3A_OBJECT_BASED_TYPE) { ++ number_objects = get_bits(&gb, 7); ++ skip_bits(&gb, 1); ++ nb_objects = number_objects; ++ if (nb_objects < 1) ++ return AVERROR_INVALIDDATA; ++ } else if (content_type == AV3A_CHANNEL_OBJECT_TYPE) { ++ channel_number_index = get_bits(&gb, 7); ++ skip_bits(&gb, 1); ++ if (channel_number_index >= CHANNEL_CONFIG_UNKNOWN || ++ channel_number_index == CHANNEL_CONFIG_MC_10_2 || ++ channel_number_index == CHANNEL_CONFIG_MC_22_2) ++ return AVERROR_INVALIDDATA; ++ number_objects = get_bits(&gb, 7); ++ skip_bits(&gb, 1); ++ nb_channels = ff_av3a_channels_map_table[channel_number_index].channels; ++ nb_objects = number_objects; ++ if (nb_objects < 1) ++ return AVERROR_INVALIDDATA; ++ } else if (content_type == AV3A_AMBISONIC_TYPE) { ++ hoa_order = get_bits(&gb, 4); ++ if (hoa_order < AV3A_AMBISONIC_FIRST_ORDER || ++ hoa_order > AV3A_AMBISONIC_THIRD_ORDER) ++ return AVERROR_INVALIDDATA; ++ nb_channels = (hoa_order + 1) * (hoa_order + 1); ++ } else { ++ return AVERROR_INVALIDDATA; ++ } ++ ++ bitrate_kbps = get_bits(&gb, 16); ++ st->codecpar->bit_rate = bitrate_kbps * 1000; ++ ++ resolution_index = get_bits(&gb, 2); ++ if (resolution_index >= AV3A_RESOLUTION_TABLE_SIZE) ++ return AVERROR_INVALIDDATA; ++ st->codecpar->format = ff_av3a_sample_format_map_table[resolution_index].sample_format; ++ st->codecpar->bits_per_raw_sample = ff_av3a_sample_format_map_table[resolution_index].resolution; ++ ++ av_channel_layout_uninit(&st->codecpar->ch_layout); ++ if (content_type != AV3A_AMBISONIC_TYPE) { ++ st->codecpar->ch_layout.order = AV_CHANNEL_ORDER_CUSTOM; ++ st->codecpar->ch_layout.nb_channels = nb_channels + nb_objects; ++ st->codecpar->ch_layout.u.map = av_calloc(st->codecpar->ch_layout.nb_channels, ++ sizeof(*st->codecpar->ch_layout.u.map)); ++ if (!st->codecpar->ch_layout.u.map) ++ return AVERROR(ENOMEM); ++ ++ if (content_type != AV3A_OBJECT_BASED_TYPE) { ++ for (int i = 0; i < nb_channels; i++) ++ st->codecpar->ch_layout.u.map[i].id = ++ ff_av3a_channels_map_table[channel_number_index].channel_layout[i]; ++ } ++ ++ for (int i = nb_channels; i < st->codecpar->ch_layout.nb_channels; i++) ++ st->codecpar->ch_layout.u.map[i].id = AV3A_CH_AUDIO_OBJECT; ++ } else { ++ st->codecpar->ch_layout.order = AV_CHANNEL_ORDER_AMBISONIC; ++ st->codecpar->ch_layout.nb_channels = nb_channels; ++ } ++ ++ return 0; ++} ++#endif ++ + static int mov_metadata_track_or_disc_number(MOVContext *c, AVIOContext *pb, + unsigned len, const char *key) + { +@@ -9640,6 +9761,9 @@ static const MOVParseTableEntry mov_default_parse_table[] = { + #if CONFIG_IAMFDEC + { MKTAG('i','a','c','b'), mov_read_iacb }, + #endif ++#if CONFIG_AV3A_DEMUXER ++{ MKTAG('d','c','a','3'), mov_read_dca3 }, ++#endif + { MKTAG('s','r','a','t'), mov_read_srat }, + { 0, NULL } + }; +diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c +index 47944c7..d682526 100644 +--- a/libavformat/mpegts.c ++++ b/libavformat/mpegts.c +@@ -825,6 +825,9 @@ static const StreamType ISO_types[] = { + { STREAM_TYPE_VIDEO_DIRAC, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_DIRAC }, + { STREAM_TYPE_VIDEO_AVS2, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_AVS2 }, + { STREAM_TYPE_VIDEO_AVS3, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_AVS3 }, ++#if CONFIG_AV3A_DEMUXER ++ { STREAM_TYPE_AUDIO_AV3A, AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_AVS3DA }, ++#endif + { STREAM_TYPE_VIDEO_VC1, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_VC1 }, + { 0 }, + }; +@@ -883,6 +886,9 @@ static const StreamType REGD_types[] = { + { MKTAG('I', 'D', '3', ' '), AVMEDIA_TYPE_DATA, AV_CODEC_ID_TIMED_ID3 }, + { MKTAG('V', 'C', '-', '1'), AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_VC1 }, + { MKTAG('O', 'p', 'u', 's'), AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_OPUS }, ++#if CONFIG_AV3A_DEMUXER ++ { MKTAG('a', 'v', '3', 'a'), AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_AVS3DA}, ++#endif + { 0 }, + }; + +diff --git a/libavformat/mpegts.h b/libavformat/mpegts.h +index 18f326b..92c95ef 100644 +--- a/libavformat/mpegts.h ++++ b/libavformat/mpegts.h +@@ -152,6 +152,7 @@ + #define STREAM_TYPE_VIDEO_AVS3 0xd4 + #define STREAM_TYPE_VIDEO_VC1 0xea + #define STREAM_TYPE_VIDEO_DIRAC 0xd1 ++#define STREAM_TYPE_AUDIO_AV3A 0xd5 + + /* stream_type values [0x80, 0xff] are User Private */ + #define STREAM_TYPE_BLURAY_AUDIO_PCM_BLURAY 0x80 +-- +2.50.1 (Apple Git-155) + diff --git a/patches/ffmpeg-n8.1.2/0017-http-add-reconnect_first_delay-opt.patch b/patches/ffmpeg-n8.1.2/0017-http-add-reconnect_first_delay-opt.patch new file mode 100644 index 000000000..23c0b615c --- /dev/null +++ b/patches/ffmpeg-n8.1.2/0017-http-add-reconnect_first_delay-opt.patch @@ -0,0 +1,41 @@ +From 63de5ca190448e027cf758f548b2213095638bd6 Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Thu, 29 May 2025 09:57:28 +0800 +Subject: http add reconnect_first_delay opt + +--- + libavformat/http.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/libavformat/http.c b/libavformat/http.c +index f4bf225..cd39796 100644 +--- a/libavformat/http.c ++++ b/libavformat/http.c +@@ -131,6 +131,7 @@ typedef struct HTTPContext { + int reconnect_on_network_error; + int reconnect_streamed; + int reconnect_delay_max; ++ int reconnect_first_delay; + char *reconnect_on_http_error; + int listen; + char *resource; +@@ -205,6 +206,7 @@ static const AVOption options[] = { + { "reconnect_max_retries", "the max number of times to retry a connection", OFFSET(reconnect_max_retries), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, D }, + { "reconnect_delay_total_max", "max total reconnect delay in seconds after which to give up", OFFSET(reconnect_delay_total_max), AV_OPT_TYPE_INT, { .i64 = 256 }, 0, UINT_MAX/1000/1000, D }, + { "respect_retry_after", "respect the Retry-After header when retrying connections", OFFSET(respect_retry_after), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, D }, ++ { "reconnect_first_delay", "first reconnect delay in seconds", OFFSET(reconnect_first_delay), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, UINT_MAX/1000/1000, D }, + { "listen", "listen on HTTP", OFFSET(listen), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 2, D | E }, + { "resource", "The resource requested by a client", OFFSET(resource), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, E }, + { "reply_code", "The http status code to return to a client", OFFSET(reply_code), AV_OPT_TYPE_INT, { .i64 = 200}, INT_MIN, 599, E}, +@@ -419,7 +421,7 @@ static int http_open_cnx(URLContext *h, AVDictionary **options) + HTTPAuthType cur_auth_type, cur_proxy_auth_type; + HTTPContext *s = h->priv_data; + int ret, conn_attempts = 1, auth_attempts = 0, redirects = 0; +- int reconnect_delay = 0; ++ int reconnect_delay = s->reconnect_first_delay; + int reconnect_delay_total = 0; + uint64_t off; + char *cached; +-- +2.50.1 (Apple Git-155) + diff --git a/patches/ffmpeg-n8.1.2/0018-fix-http-open-and-http_seek-redirect-authentication-.patch b/patches/ffmpeg-n8.1.2/0018-fix-http-open-and-http_seek-redirect-authentication-.patch new file mode 100644 index 000000000..b5bfa7259 --- /dev/null +++ b/patches/ffmpeg-n8.1.2/0018-fix-http-open-and-http_seek-redirect-authentication-.patch @@ -0,0 +1,102 @@ +From 0eb8def6e29ed4193013c3f7c2a01acf7eb40b28 Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Fri, 8 May 2026 17:47:08 +0800 +Subject: fix http open and http_seek (redirect) authentication + bug + +--- + libavformat/http.c | 32 +++++++++++++++++++++++++++----- + 1 file changed, 27 insertions(+), 5 deletions(-) + +diff --git a/libavformat/http.c b/libavformat/http.c +index cd39796..b648596 100644 +--- a/libavformat/http.c ++++ b/libavformat/http.c +@@ -83,6 +83,7 @@ typedef struct HTTPContext { + char *uri; + char *location; + HTTPAuthState auth_state; ++ int auth_type2; + HTTPAuthState proxy_auth_state; + char *http_proxy; + char *headers; +@@ -190,6 +191,7 @@ static const AVOption options[] = { + { "icy_metadata_packet", "return current ICY metadata packet", OFFSET(icy_metadata_packet), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, AV_OPT_FLAG_EXPORT }, + { "metadata", "metadata read from the bitstream", OFFSET(metadata), AV_OPT_TYPE_DICT, {0}, 0, 0, AV_OPT_FLAG_EXPORT }, + { "auth_type", "HTTP authentication type", OFFSET(auth_state.auth_type), AV_OPT_TYPE_INT, { .i64 = HTTP_AUTH_NONE }, HTTP_AUTH_NONE, HTTP_AUTH_BASIC, D | E, .unit = "auth_type"}, ++ { "auth_type2", "backup HTTP authentication type for seek request", OFFSET(auth_type2), AV_OPT_TYPE_INT, { .i64 = HTTP_AUTH_NONE }, HTTP_AUTH_NONE, HTTP_AUTH_BASIC, D | E, "auth_type"}, + { "none", "No auth method set, autodetect", 0, AV_OPT_TYPE_CONST, { .i64 = HTTP_AUTH_NONE }, 0, 0, D | E, .unit = "auth_type"}, + { "basic", "HTTP basic authentication", 0, AV_OPT_TYPE_CONST, { .i64 = HTTP_AUTH_BASIC }, 0, 0, D | E, .unit = "auth_type"}, + { "send_expect_100", "Force sending an Expect: 100-continue header for POST", OFFSET(send_expect_100), AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, E }, +@@ -789,6 +791,11 @@ static int http_open(URLContext *h, const char *uri, int flags, + int ret; + s->app_ctx = (AVApplicationContext *)av_dict_strtoptr(s->app_ctx_intptr); + ++ if (s->auth_type2 == HTTP_AUTH_NONE) { ++ //backup the init auth_type, when not assign. ++ s->auth_type2 = s->auth_state.auth_type; ++ } ++ + if( s->seekable == 1 ) + h->is_streamed = 0; + else +@@ -1550,6 +1557,7 @@ static int http_connect(URLContext *h, const char *path, const char *local_path, + uint64_t off = s->off; + const char *method; + int send_expect_100 = 0; ++ int cur_auth_type = s->auth_state.auth_type; + + av_bprint_init_for_buffer(&request, s->buffer, sizeof(s->buffer)); + +@@ -1708,15 +1716,24 @@ static int http_connect(URLContext *h, const char *path, const char *local_path, + s->off = off; + + if (off != s->off) { +- av_log(h, AV_LOG_ERROR, +- "Unexpected offset: expected %"PRIu64", got %"PRIu64"\n", +- off, s->off); +- err = AVERROR(EIO); +- goto done; ++ if (cur_auth_type != s->auth_state.auth_type && s->http_code == 401) { ++ s->off = off; ++ av_log(h, AV_LOG_ERROR, ++ "HTTP 401 needs authentication: %s, offset=%"PRIu64"\n", ++ s->buffer, s->off); ++ } else { ++ av_log(h, AV_LOG_ERROR, ++ "Unexpected offset: expected %"PRIu64", got %"PRIu64"\n", ++ off, s->off); ++ err = AVERROR(EIO); ++ goto done; ++ } + } + + err = 0; + done: ++ if (err < 0) ++ av_log(h, AV_LOG_ERROR, "HTTP error %d: %s\n", s->http_code, s->buffer); + av_freep(&authstr); + av_freep(&proxyauthstr); + return err; +@@ -2148,6 +2165,8 @@ static int64_t http_seek_internal(URLContext *h, int64_t off, int whence, int fo + return s->off; + } + ++ // http_seek use lasest redirect location, because after redirect, reset the auth_state: `memset(&s->auth_state, 0, sizeof(s->auth_state));` ++ + /* if the location changed (redirect), revert to the original uri */ + if (strcmp(s->uri, s->location)) { + char *new_uri; +@@ -2156,6 +2175,9 @@ static int64_t http_seek_internal(URLContext *h, int64_t off, int whence, int fo + return AVERROR(ENOMEM); + av_free(s->location); + s->location = new_uri; ++ if (s->auth_type2 != HTTP_AUTH_NONE) { ++ s->auth_state.auth_type = s->auth_type2; ++ } + } + + /* we save the old context in case the seek fails */ +-- +2.50.1 (Apple Git-155) + diff --git a/patches/ffmpeg-n8.1.2/0019-add-built-in-smb2-protocol-via-libsmb2.patch b/patches/ffmpeg-n8.1.2/0019-add-built-in-smb2-protocol-via-libsmb2.patch new file mode 100644 index 000000000..69938968f --- /dev/null +++ b/patches/ffmpeg-n8.1.2/0019-add-built-in-smb2-protocol-via-libsmb2.patch @@ -0,0 +1,495 @@ +From 633c6546e554aba1f6219f467b1759b6f39430a8 Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Fri, 8 May 2026 17:58:33 +0800 +Subject: add built-in smb2 protocol via libsmb2 + +--- + configure | 5 + + libavformat/Makefile | 1 + + libavformat/libsmb2.c | 412 ++++++++++++++++++++++++++++++++++++++++ + libavformat/protocols.c | 1 + + 4 files changed, 419 insertions(+) + create mode 100644 libavformat/libsmb2.c + +diff --git a/configure b/configure +index 1759694..10c688c 100755 +--- a/configure ++++ b/configure +@@ -276,6 +276,7 @@ External library support: + --enable-libshaderc enable runtime GLSL->SPIRV compilation via libshaderc [no] + --enable-libshine enable fixed-point MP3 encoding via libshine [no] + --enable-libsmbclient enable Samba protocol via libsmbclient [no] ++ --enable-libsmb2 enable Samba protocol via libsmb2 [no] + --enable-libsnappy enable Snappy compression, needed for hap encoding [no] + --enable-libsoxr enable Include libsoxr resampling [no] + --enable-libspeex enable Speex de/encoding via libspeex [no] +@@ -2083,6 +2084,7 @@ EXTERNAL_LIBRARY_LIST=" + libshaderc + libshine + libsmbclient ++ libsmb2 + libsnappy + libsoxr + libspeex +@@ -4073,6 +4075,7 @@ librtmps_protocol_deps="librtmp" + librtmpt_protocol_deps="librtmp" + librtmpte_protocol_deps="librtmp" + libsmbclient_protocol_deps="libsmbclient gplv3" ++libsmb2_protocol_deps="libsmb2" + libsrt_protocol_deps="libsrt" + libsrt_protocol_select="network" + libssh_protocol_deps="libssh" +@@ -7369,6 +7372,8 @@ enabled libshaderc && require_pkg_config spirv_library "shaderc >= 2019.1 + enabled libshine && require_pkg_config libshine shine shine/layer3.h shine_encode_buffer + enabled libsmbclient && { check_pkg_config libsmbclient smbclient libsmbclient.h smbc_init || + require libsmbclient libsmbclient.h smbc_init -lsmbclient; } ++enabled libsmb2 && { check_pkg_config libsmb2 libsmb2 smb2/smb2-errors.h SMB2_STATUS_SUCCESS || ++ require libsmb2 smb2/smb2-errors.h SMB2_STATUS_SUCCESS -lsmb2; } + enabled libsnappy && require libsnappy snappy-c.h snappy_compress -lsnappy -lstdc++ + enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr + enabled libssh && require_pkg_config libssh "libssh >= 0.6.0" libssh/sftp.h sftp_init +diff --git a/libavformat/Makefile b/libavformat/Makefile +index 158a11d..6100e33 100644 +--- a/libavformat/Makefile ++++ b/libavformat/Makefile +@@ -751,6 +751,7 @@ OBJS-$(CONFIG_LIBRTMPS_PROTOCOL) += librtmp.o + OBJS-$(CONFIG_LIBRTMPT_PROTOCOL) += librtmp.o + OBJS-$(CONFIG_LIBRTMPTE_PROTOCOL) += librtmp.o + OBJS-$(CONFIG_LIBSMBCLIENT_PROTOCOL) += libsmbclient.o ++OBJS-$(CONFIG_LIBSMB2_PROTOCOL) += libsmb2.o + OBJS-$(CONFIG_LIBSRT_PROTOCOL) += libsrt.o + OBJS-$(CONFIG_LIBSSH_PROTOCOL) += libssh.o + OBJS-$(CONFIG_LIBZMQ_PROTOCOL) += libzmq.o +diff --git a/libavformat/libsmb2.c b/libavformat/libsmb2.c +new file mode 100644 +index 0000000..408f9e1 +--- /dev/null ++++ b/libavformat/libsmb2.c +@@ -0,0 +1,412 @@ ++/* ++ * Copyright (c) 2014 Lukasz Marek ++ * ++ * This file is part of FFmpeg. ++ * ++ * FFmpeg is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * FFmpeg is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FFmpeg; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++ ++#include ++#include ++#include "libavutil/avstring.h" ++#include "libavutil/opt.h" ++#include "libavutil/mem.h" ++#include "application.h" ++#include "url.h" ++#include "urldecode.h" ++//smb2.h:37:9: error: unknown type name 'time_t'; ++#include ++#include ++#include ++#include ++ ++typedef struct ++{ ++ const AVClass *class; ++ ++ struct smb2_context *ctx; ++ struct smb2_url *url; ++ struct smb2fh *fh; ++ struct smb2dir *dir; ++ ++ uint64_t filesize; ++ char *app_ctx_intptr; ++ AVApplicationContext *app_ctx; ++ int smb2_seal; ++} LIBSMB2Context; ++ ++static void destroy_smb2(LIBSMB2Context *libsmb2) ++{ ++ if (libsmb2->fh && libsmb2->ctx) { ++ smb2_close(libsmb2->ctx, libsmb2->fh); ++ } ++ ++ if (libsmb2->ctx) { ++ smb2_disconnect_share(libsmb2->ctx); ++ smb2_destroy_context(libsmb2->ctx); ++ } ++ ++ if (libsmb2->url) { ++ smb2_destroy_url(libsmb2->url); ++ } ++ libsmb2->fh = NULL; ++ libsmb2->ctx = NULL; ++ libsmb2->url = NULL; ++} ++ ++static av_cold int libsmb2_close(URLContext *h) ++{ ++ LIBSMB2Context *libsmb2 = h->priv_data; ++ destroy_smb2(libsmb2); ++ return 0; ++} ++ ++static av_cold int libsmb2_open(URLContext *h, const char *uri, int flags) ++{ ++ int ret = 0; ++ LIBSMB2Context *libsmb2 = h->priv_data; ++ libsmb2->filesize = -1; ++ libsmb2->ctx = smb2_init_context(); ++ libsmb2->app_ctx = (AVApplicationContext *)av_dict_strtoptr(libsmb2->app_ctx_intptr); ++ ++ av_application_will_http_open(libsmb2->app_ctx, (void *)h, uri); ++ ++ if (!libsmb2->ctx) { ++ av_log(h, AV_LOG_ERROR, "smb2 create context failed: %s.\n", smb2_get_error(libsmb2->ctx)); ++ ret = AVERROR(ENOMEM); ++ goto failed; ++ } ++ ++ const char *smb_url = av_strireplace(uri, "smb2", "smb"); ++ struct smb2_url *url = smb2_parse_url(libsmb2->ctx, smb_url); ++ ++ if (url == NULL) { ++ av_log(h, AV_LOG_ERROR, "smb2 parse url failed: %s\n", smb2_get_error(libsmb2->ctx)); ++ ret = AVERROR(ENOMEM); ++ goto failed; ++ } else { ++ if (url->user) { ++ char *user = strchr(url->user, ':'); ++ if (user) { ++ *user = '\0'; ++ char *password = user + 1; ++ if (strlen(password) > 0) { ++ password = ff_urldecode(password, 0); ++ smb2_set_password(libsmb2->ctx, password); ++ } ++ } ++ } ++ ++ if (url->domain) { ++ smb2_set_domain(libsmb2->ctx, url->domain); ++ } ++ ++ if (url->share) { ++ char *share = ff_urldecode(url->share, 0); ++ memset(url->share, 0, strlen(url->share)); ++ memcpy(url->share, share, strlen(share)); ++ } ++ ++ if (url->path) { ++ char *path = ff_urldecode(url->path, 0); ++ memset(url->path, 0, strlen(url->path)); ++ memcpy(url->path, path, strlen(path)); ++ } ++ ++ libsmb2->url = url; ++ } ++ ++ //https://github.com/sahlberg/libsmb2/issues/271 ++ //fix Very slow performance w/MacOS SMB server ++ //smb2_set_security_mode(libsmb2->ctx, SMB2_NEGOTIATE_SIGNING_ENABLED); ++ smb2_set_seal(libsmb2->ctx, libsmb2->smb2_seal); ++ smb2_set_authentication(libsmb2->ctx, 1);//SMB2_SEC_NTLMSSP ++ smb2_set_timeout(libsmb2->ctx, 60); ++ ++ if (smb2_connect_share(libsmb2->ctx, url->server, url->share, url->user) != 0) { ++ av_log(h, AV_LOG_ERROR, "smb2 connect share failed: %s\n", smb2_get_error(libsmb2->ctx)); ++ ret = AVERROR(ECONNREFUSED); ++ goto failed; ++ } ++ ++ int access; ++ if ((flags & AVIO_FLAG_WRITE) && (flags & AVIO_FLAG_READ)) { ++ access = O_CREAT | O_RDWR; ++ } else if (flags & AVIO_FLAG_WRITE) { ++ access = O_CREAT | O_WRONLY; ++ } else { ++ access = O_RDONLY; ++ } ++ ++ if (flags & AVIO_FLAG_DIRECT) { ++ if ((libsmb2->dir = smb2_opendir(libsmb2->ctx, url->path)) == NULL) { ++ av_log(h, AV_LOG_ERROR, "smb2 open dir failed: %s, error: %s\n", url->path, smb2_get_error(libsmb2->ctx)); ++ ret = AVERROR(ENOTDIR); ++ goto failed; ++ } ++ } else { ++ if ((libsmb2->fh = smb2_open(libsmb2->ctx, url->path, access)) == NULL) { ++ av_log(h, AV_LOG_ERROR, "smb2 open file failed: %s, error: %s\n", url->path, smb2_get_error(libsmb2->ctx)); ++ ret = AVERROR(ENOENT); ++ goto failed; ++ } ++ } ++ ++ struct smb2_stat_64 st = {0}; ++ ++ if (smb2_stat(libsmb2->ctx, url->path, &st) < 0) ++ av_log(h, AV_LOG_WARNING, "Cannot stat file: %s\n", smb2_get_error(libsmb2->ctx)); ++ else ++ libsmb2->filesize = st.smb2_size; ++ av_application_did_http_open(libsmb2->app_ctx, (void *)h, uri, 0, 200, libsmb2->filesize); ++ return 0; ++failed: ++ av_application_did_http_open(libsmb2->app_ctx, (void *)h, uri, ret, 500, 0); ++ if (libsmb2->fh && libsmb2->ctx) { ++ smb2_close(libsmb2->ctx, libsmb2->fh); ++ } ++ if (libsmb2->ctx) { ++ smb2_disconnect_share(libsmb2->ctx); ++ smb2_destroy_context(libsmb2->ctx); ++ } ++ if (libsmb2->url) { ++ smb2_destroy_url(libsmb2->url); ++ } ++ libsmb2->fh = NULL; ++ libsmb2->ctx = NULL; ++ libsmb2->url = NULL; ++ return -1; ++} ++ ++static int64_t libsmb2_seek(URLContext *h, int64_t pos, int whence) ++{ ++ LIBSMB2Context *libsmb2 = h->priv_data; ++ int64_t newpos; ++ ++ if (whence == AVSEEK_SIZE) { ++ if (libsmb2->filesize == -1) { ++ av_log(h, AV_LOG_ERROR, "smb2 seek failed,filesize is unknown.\n"); ++ return AVERROR(EIO); ++ } else { ++ return libsmb2->filesize; ++ } ++ } ++ ++ av_application_will_http_seek(libsmb2->app_ctx, (void *)h, h->filename, pos); ++ ++ if ((newpos = smb2_lseek(libsmb2->ctx, libsmb2->fh, pos, whence, NULL)) < 0) { ++ av_log(h, AV_LOG_ERROR, "smb2 seek failed: %s\n", smb2_get_error(libsmb2->ctx)); ++ av_application_did_http_seek(libsmb2->app_ctx, (void *)h, h->filename, pos, AVERROR(errno), 500); ++ return AVERROR(errno); ++ } ++ av_application_did_http_seek(libsmb2->app_ctx, (void *)h, h->filename, pos, 0, 200); ++ return newpos; ++} ++ ++static int libsmb2_read(URLContext *h, unsigned char *buf, int size) ++{ ++ LIBSMB2Context *libsmb2 = h->priv_data; ++ ++ uint8_t *buf1 = buf; ++ int buf_size1 = size; ++ int has_error = 0; ++ ++ while (buf_size1 > 0) { ++ int read = smb2_read(libsmb2->ctx, libsmb2->fh, buf1, buf_size1); ++ if (read < 0) { ++ av_log(h, AV_LOG_ERROR, "smb2 read file failed: %s\n", ++ smb2_get_error(libsmb2->ctx)); ++ has_error = 1; ++ break; ++ } ++ if (read == 0) { ++ // eof ++ break; ++ } ++ buf1 += read; ++ buf_size1 -= read; ++ } ++ ++ int bytes_read = size - buf_size1; ++ if (bytes_read > 0) ++ av_application_did_io_tcp_read(libsmb2->app_ctx, (void*)h, bytes_read); ++ ++ return bytes_read ? bytes_read : (has_error ? AVERROR(ENOTCONN) : AVERROR_EOF); ++} ++ ++static int libsmb2_write(URLContext *h, const unsigned char *buf, int size) ++{ ++ LIBSMB2Context *libsmb2 = h->priv_data; ++ int bytes_written; ++ ++ if ((bytes_written = smb2_write(libsmb2->ctx, libsmb2->fh, buf, size)) < 0) { ++ int ret = AVERROR(errno); ++ av_log(h, AV_LOG_ERROR, "smb2 write failed: %s\n", strerror(errno)); ++ return ret; ++ } ++ ++ return bytes_written; ++} ++ ++static int libsmb2_delete(URLContext *h) ++{ ++ LIBSMB2Context *libsmb2 = h->priv_data; ++ ++ struct smb2_url *url = smb2_parse_url(libsmb2->ctx, h->filename); ++ if (url == NULL) { ++ av_log(h, AV_LOG_ERROR, "smb2 parse url failed: %s\n", ++ smb2_get_error(libsmb2->ctx)); ++ return -1; ++ } else { ++ char *path = ff_urldecode(url->path, 0); ++ return smb2_unlink(libsmb2->ctx, path); ++ } ++} ++ ++static int libsmb2_move(URLContext *h_src, URLContext *h_dst) ++{ ++ LIBSMB2Context *libsmb2 = h_src->priv_data; ++ if (!libsmb2) ++ { ++ return -1; ++ } ++ ++ struct smb2_url *src_url = smb2_parse_url(libsmb2->ctx, h_src->filename); ++ struct smb2_url *dst_url = smb2_parse_url(libsmb2->ctx, h_dst->filename); ++ ++ if (src_url == NULL || dst_url == NULL) { ++ av_log(h_src, AV_LOG_ERROR, "smb2 parse url failed: %s\n", smb2_get_error(libsmb2->ctx)); ++ return -2; ++ } else { ++ char *src_path = ff_urldecode(src_url->path, 0); ++ char *dst_path = ff_urldecode(dst_url->path, 0); ++ return smb2_rename(libsmb2->ctx, src_path, dst_path); ++ } ++} ++ ++static int libsmb2_open_dir(URLContext *h) ++{ ++ LIBSMB2Context *libsmb2 = h->priv_data; ++ struct smb2_url *url = smb2_parse_url(libsmb2->ctx, h->filename); ++ if (url == NULL) { ++ av_log(h, AV_LOG_ERROR, "smb2 parse url failed: %s\n", smb2_get_error(libsmb2->ctx)); ++ return -1; ++ } else { ++ char *path = ff_urldecode(url->path, 0); ++ libsmb2->dir = smb2_opendir(libsmb2->ctx, path); ++ if (!libsmb2->dir){ ++ av_log(h, AV_LOG_ERROR, "smb2 open dir failed: %s\n", smb2_get_error(libsmb2->ctx)); ++ return 0; ++ } ++ return AVERROR(ENOTDIR); ++ } ++} ++ ++static int libsmb2_read_dir(URLContext *h, AVIODirEntry **next) ++{ ++ LIBSMB2Context *libsmb2 = h->priv_data; ++ AVIODirEntry *entry; ++ struct smb2dirent *dirent = NULL; ++ int skip_entry; ++ ++ *next = entry = ff_alloc_dir_entry(); ++ if (!entry) ++ return AVERROR(ENOMEM); ++ do { ++ skip_entry = 0; ++ dirent = smb2_readdir(libsmb2->ctx, libsmb2->dir); ++ if (!dirent) { ++ av_freep(next); ++ return 0; ++ } ++ } while (skip_entry || !strcmp(dirent->name, ".") || ++ !strcmp(dirent->name, "..")); ++ ++ entry->name = av_strdup(dirent->name); ++ if (!entry->name) { ++ av_freep(next); ++ return AVERROR(ENOMEM); ++ } ++ ++ struct smb2_stat_64 st = dirent->st; ++ switch (st.smb2_type) { ++ case SMB2_TYPE_DIRECTORY: ++ entry->type = AVIO_ENTRY_DIRECTORY; ++ break; ++ case SMB2_TYPE_FILE: ++ entry->type = AVIO_ENTRY_FILE; ++ break; ++ case SMB2_TYPE_LINK: ++ entry->type = AVIO_ENTRY_SYMBOLIC_LINK; ++ break; ++ default: ++ entry->type = AVIO_ENTRY_UNKNOWN; ++ break; ++ } ++ ++ entry->group_id = -1; ++ entry->user_id = -1; ++ entry->filemode = -1; ++ entry->size = st.smb2_size; ++ entry->modification_timestamp = INT64_C(1000000) * st.smb2_mtime; ++ entry->access_timestamp = INT64_C(1000000) * st.smb2_atime; ++ entry->status_change_timestamp = INT64_C(1000000) * st.smb2_ctime; ++ ++ return 0; ++} ++ ++static int libsmb2_close_dir(URLContext *h) ++{ ++ LIBSMB2Context *libsmb2 = h->priv_data; ++ if (libsmb2->dir) { ++ smb2_closedir(libsmb2->ctx, libsmb2->dir); ++ libsmb2->dir = NULL; ++ } ++ return 0; ++} ++ ++#define OFFSET(x) offsetof(LIBSMB2Context, x) ++#define D AV_OPT_FLAG_DECODING_PARAM ++#define E AV_OPT_FLAG_ENCODING_PARAM ++static const AVOption options[] = { ++ { "ijkapplication", "AVApplicationContext", OFFSET(app_ctx_intptr), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, .flags = D }, ++ { "smb2_seal", "enable smb3 encrypted connection", OFFSET(smb2_seal), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, .flags = D }, ++ {NULL} ++}; ++ ++static const AVClass libsmb2lient_context_class = { ++ .class_name = "libsmb2", ++ .item_name = av_default_item_name, ++ .option = options, ++ .version = LIBAVUTIL_VERSION_INT, ++}; ++ ++const URLProtocol ff_libsmb2_protocol = { ++ .name = "smb2", ++ .flags = URL_PROTOCOL_FLAG_NETWORK, ++ .priv_data_size = sizeof(LIBSMB2Context), ++ .priv_data_class = &libsmb2lient_context_class, ++ .url_open = libsmb2_open, ++ .url_read = libsmb2_read, ++ .url_write = libsmb2_write, ++ .url_seek = libsmb2_seek, ++ .url_close = libsmb2_close, ++ .url_delete = libsmb2_delete, ++ .url_move = libsmb2_move, ++ .url_open_dir = libsmb2_open_dir, ++ .url_read_dir = libsmb2_read_dir, ++ .url_close_dir = libsmb2_close_dir, ++}; +diff --git a/libavformat/protocols.c b/libavformat/protocols.c +index d1c1095..fb712a5 100644 +--- a/libavformat/protocols.c ++++ b/libavformat/protocols.c +@@ -75,6 +75,7 @@ extern const URLProtocol ff_librtmpte_protocol; + extern const URLProtocol ff_libsrt_protocol; + extern const URLProtocol ff_libssh_protocol; + extern const URLProtocol ff_libsmbclient_protocol; ++extern const URLProtocol ff_libsmb2_protocol; + extern const URLProtocol ff_libzmq_protocol; + extern const URLProtocol ff_ipfs_gateway_protocol; + extern const URLProtocol ff_ipns_gateway_protocol; +-- +2.50.1 (Apple Git-155) + diff --git a/patches/ffmpeg-n8.1.2/0020-URLProtocol-add-url_parse_priv-function-pointer.patch b/patches/ffmpeg-n8.1.2/0020-URLProtocol-add-url_parse_priv-function-pointer.patch new file mode 100644 index 000000000..1639144d4 --- /dev/null +++ b/patches/ffmpeg-n8.1.2/0020-URLProtocol-add-url_parse_priv-function-pointer.patch @@ -0,0 +1,55 @@ +From 861f2778fd0f40ec42a2dd1827afe0fc11786e32 Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Thu, 29 May 2025 11:14:13 +0800 +Subject: URLProtocol add url_parse_priv function pointer + +--- + libavformat/demux.c | 11 +++++++++++ + libavformat/url.h | 2 ++ + 2 files changed, 13 insertions(+) + +diff --git a/libavformat/demux.c b/libavformat/demux.c +index 494e15f..524018f 100644 +--- a/libavformat/demux.c ++++ b/libavformat/demux.c +@@ -355,6 +355,17 @@ int avformat_open_input(AVFormatContext **ps, const char *filename, + ff_id3v2_free_extra_meta(&id3v2_extra_meta); + } + ++ //fill stream info ++ if (s->pb) { ++ URLContext *url_context = ffio_geturlcontext(s->pb); ++ if (url_context && url_context->prot) { ++ URLProtocol *prot = url_context->prot; ++ if (prot->url_parse_priv) { ++ prot->url_parse_priv(s, url_context); ++ } ++ } ++ } ++ + if ((ret = avformat_queue_attached_pictures(s)) < 0) + goto close; + +diff --git a/libavformat/url.h b/libavformat/url.h +index 53c6f13..f7e5bb2 100644 +--- a/libavformat/url.h ++++ b/libavformat/url.h +@@ -48,6 +48,7 @@ typedef struct URLContext { + int min_packet_size; /**< if non zero, the stream is packetized with this min packet size */ + } URLContext; + ++typedef struct AVFormatContext AVFormatContext; + typedef struct URLProtocol { + const char *name; + int (*url_open)( URLContext *h, const char *url, int flags); +@@ -93,6 +94,7 @@ typedef struct URLProtocol { + int (*url_close_dir)(URLContext *h); + int (*url_delete)(URLContext *h); + int (*url_move)(URLContext *h_src, URLContext *h_dst); ++ int (*url_parse_priv)(AVFormatContext *ic, URLContext *h); + const char *default_whitelist; + } URLProtocol; + +-- +2.50.1 (Apple Git-155) + diff --git a/patches/ffmpeg-n8.1.2/0021-bluray-protocol-add-dvd-fallback.patch b/patches/ffmpeg-n8.1.2/0021-bluray-protocol-add-dvd-fallback.patch new file mode 100644 index 000000000..e95664bac --- /dev/null +++ b/patches/ffmpeg-n8.1.2/0021-bluray-protocol-add-dvd-fallback.patch @@ -0,0 +1,54 @@ +From da901ac77bf2a238a947809aa1b276a13af6e055 Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Thu, 29 May 2025 11:15:16 +0800 +Subject: bluray protocol add dvd fallback + +--- + libavformat/demux.c | 23 +++++++++++++++++++---- + 1 file changed, 19 insertions(+), 4 deletions(-) + +diff --git a/libavformat/demux.c b/libavformat/demux.c +index 524018f..531992f 100644 +--- a/libavformat/demux.c ++++ b/libavformat/demux.c +@@ -161,7 +161,8 @@ static int init_input(AVFormatContext *s, const char *filename, + int ret; + AVProbeData pd = { filename, NULL, 0 }; + int score = AVPROBE_SCORE_RETRY; +- ++ AVDictionary *tmp_opts = NULL; ++ + if (s->pb) { + s->flags |= AVFMT_FLAG_CUSTOM_IO; + if (!s->iformat) +@@ -176,10 +177,24 @@ static int init_input(AVFormatContext *s, const char *filename, + if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) || + (!s->iformat && (s->iformat = av_probe_input_format2(&pd, 0, &score)))) + return score; ++ ++ if (options && av_stristart(filename, "bluray://", NULL)) { ++ av_dict_copy(&tmp_opts, *options, 0); ++ } + +- if ((ret = s->io_open(s, &s->pb, filename, AVIO_FLAG_READ | s->avio_flags, options)) < 0) +- return ret; +- ++ if ((ret = s->io_open(s, &s->pb, filename, AVIO_FLAG_READ | s->avio_flags, ++ options)) < 0) { ++ if (av_stristart(filename, "bluray://", NULL)) { ++ const char *a_name = av_strireplace(filename, "bluray://", ""); ++ ret = init_input(s, a_name, &tmp_opts); ++ av_dict_free(&tmp_opts); ++ return ret; ++ } else { ++ av_dict_free(&tmp_opts); ++ return ret; ++ } ++ } ++ av_dict_free(&tmp_opts); + if (s->iformat) + return 0; + return av_probe_input_buffer2(s->pb, &s->iformat, filename, +-- +2.50.1 (Apple Git-155) + diff --git a/patches/ffmpeg-n8.1.2/0022-custom-bluray-fs-for-network-Blu-ray-Disc-and-BDMV.patch b/patches/ffmpeg-n8.1.2/0022-custom-bluray-fs-for-network-Blu-ray-Disc-and-BDMV.patch new file mode 100644 index 000000000..283624f95 --- /dev/null +++ b/patches/ffmpeg-n8.1.2/0022-custom-bluray-fs-for-network-Blu-ray-Disc-and-BDMV.patch @@ -0,0 +1,744 @@ +From 016c42a6ca0b61fef87a703b7e71765af8abc501 Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Fri, 15 May 2026 17:00:02 +0800 +Subject: custom bluray fs for network Blu-ray Disc and BDMV + +--- + libavformat/Makefile | 2 +- + libavformat/bluray.c | 128 ++++++++- + libavformat/bluray_custom_fs.c | 459 +++++++++++++++++++++++++++++++++ + libavformat/bluray_custom_fs.h | 33 +++ + 4 files changed, 610 insertions(+), 12 deletions(-) + create mode 100644 libavformat/bluray_custom_fs.c + create mode 100644 libavformat/bluray_custom_fs.h + +diff --git a/libavformat/Makefile b/libavformat/Makefile +index 6100e33..54e88cf 100644 +--- a/libavformat/Makefile ++++ b/libavformat/Makefile +@@ -694,7 +694,7 @@ OBJS-$(CONFIG_VAPOURSYNTH_DEMUXER) += vapoursynth.o + # protocols I/O + OBJS-$(CONFIG_ANDROID_CONTENT_PROTOCOL) += file.o + OBJS-$(CONFIG_ASYNC_PROTOCOL) += async.o +-OBJS-$(CONFIG_BLURAY_PROTOCOL) += bluray.o ++OBJS-$(CONFIG_BLURAY_PROTOCOL) += bluray.o bluray_custom_fs.o + OBJS-$(CONFIG_CACHE_PROTOCOL) += cache.o + OBJS-$(CONFIG_CONCAT_PROTOCOL) += concat.o + OBJS-$(CONFIG_CONCATF_PROTOCOL) += concat.o +diff --git a/libavformat/bluray.c b/libavformat/bluray.c +index 1845551..eb43340 100644 +--- a/libavformat/bluray.c ++++ b/libavformat/bluray.c +@@ -21,23 +21,27 @@ + */ + + #include +- ++#include "libavformat/urldecode.h" + #include "libavutil/avstring.h" + #include "libavformat/url.h" + #include "libavutil/opt.h" ++#include "bluray_custom_fs.h" ++#include "libavutil/dict.h" ++#include "libavformat/avformat.h" + +-#define BLURAY_PROTO_PREFIX "bluray:" ++#define BLURAY_PROTO_PREFIX "bluray://" + #define MIN_PLAYLIST_LENGTH 180 /* 3 min */ + + typedef struct { + const AVClass *class; + + BLURAY *bd; +- ++ fs_access *access; + int playlist; + int angle; + int chapter; + /*int region;*/ ++ int title_idx; + } BlurayContext; + + #define OFFSET(x) offsetof(BlurayContext, x) +@@ -106,23 +110,58 @@ static int bluray_close(URLContext *h) + if (bd->bd) { + bd_close(bd->bd); + } +- ++ destroy_bluray_custom_access(&bd->access); + return 0; + } + +-static int bluray_open(URLContext *h, const char *path, int flags) ++#ifdef DEBUG_BLURAY ++#include ++#define BLURAY_DEBUG_MASK 0xFFFFF //(0xFFFFF & ~DBG_STREAM) ++ ++static void bluray_DebugHandler(const char *psz) + { ++ size_t len = strlen(psz); ++ if(len < 1) return; ++ av_log(NULL, AV_LOG_INFO, "[bluray] %s\n",psz); ++} ++#endif ++ ++ ++static int bluray_open(URLContext *h, const char *path, int flags, AVDictionary **options) ++{ ++#ifdef DEBUG_BLURAY ++ bd_set_debug_mask(BLURAY_DEBUG_MASK); ++ bd_set_debug_handler(bluray_DebugHandler); ++#endif ++ + BlurayContext *bd = h->priv_data; + int num_title_idx; + const char *diskname = path; + + av_strstart(path, BLURAY_PROTO_PREFIX, &diskname); + +- bd->bd = bd_open(diskname, NULL); +- if (!bd->bd) { ++ diskname = ff_urldecode(diskname, 0); ++ ++ fs_access *access = NULL; ++ int is_file = av_strstart(diskname, "file://", NULL) || av_strstart(diskname, "/", NULL); ++ ++ // file protocl can't handle AVIO_FLAG_DIRECT flag,so file not create custom access ++ if (!is_file) { ++ //set read packet buffer size is important! the default packet size is 32768, when use smb2 protocol, download speed is limited to 2MB; but when set the size to 1048576, download speed is 16MB; ++ h->max_packet_size = 1048576; ++ access = create_bluray_custom_access(diskname, options, &h->interrupt_callback); ++ } ++ ++ bd->bd = bd_open_fs(diskname, NULL, access); ++ ++ if (!bd->bd || is_bluray_custom_access_cancelled(access)) { + av_log(h, AV_LOG_ERROR, "bd_open() failed\n"); ++ if (access) { ++ destroy_bluray_custom_access(&access); ++ } + return AVERROR(EIO); + } ++ bd->access = access; + + /* check if disc can be played */ + if (check_disc_info(h) < 0) { +@@ -150,6 +189,9 @@ static int bluray_open(URLContext *h, const char *path, int flags) + int i; + for (i = 0; i < num_title_idx; i++) { + BLURAY_TITLE_INFO *info = bd_get_title_info(bd->bd, i, 0); ++ if (!info) { ++ continue; ++ } + + av_log(h, AV_LOG_INFO, "playlist %05d.mpls (%d:%02d:%02d)\n", + info->playlist, +@@ -159,17 +201,19 @@ static int bluray_open(URLContext *h, const char *path, int flags) + + if (info->duration > duration) { + bd->playlist = info->playlist; ++ bd->title_idx = i; + duration = info->duration; + } + + bd_free_title_info(info); + } +- av_log(h, AV_LOG_INFO, "selected %05d.mpls\n", bd->playlist); ++ av_log(h, AV_LOG_INFO, "select longest playlist: %05d.mpls\n", bd->playlist); + } + + /* select playlist */ +- if (bd_select_playlist(bd->bd, bd->playlist) <= 0) { +- av_log(h, AV_LOG_ERROR, "bd_select_playlist(%05d.mpls) failed\n", bd->playlist); ++ if (bd->playlist >= 0 && bd_select_playlist(bd->bd, bd->playlist) <= 0) { ++ av_log(h, AV_LOG_ERROR, "bd_select_playlist(%05d.mpls) failed\n", ++ bd->playlist); + return AVERROR(EIO); + } + +@@ -222,13 +266,75 @@ static int64_t bluray_seek(URLContext *h, int64_t pos, int whence) + return AVERROR(EINVAL); + } + ++static int bluray_parse_priv(AVFormatContext *ic, URLContext *h) ++{ ++ BlurayContext *bd = h->priv_data; ++ BLURAY_TITLE_INFO *title_info = NULL; ++ BLURAY_CLIP_INFO clip_info; ++ ++ int v_idx = 0; ++ int a_idx = 0; ++ int s_idx = 0; ++ int ret = 0; ++ ++ if (!bd || !bd->bd) { ++ return AVERROR(EFAULT); ++ } ++ ++ title_info = bd_get_title_info(bd->bd, bd->title_idx, 0); ++ if (!title_info) { ++ return AVERROR(EFAULT); ++ } ++ ++ if (title_info->clip_count <= 0) { ++ ret = EFAULT; ++ goto fail; ++ } ++ clip_info = title_info->clips[0]; ++ ++ for (int i = 0; i < ic->nb_streams; i++) { ++ if (ic->streams[i] && ic->streams[i]->codecpar) { ++ switch (ic->streams[i]->codecpar->codec_type) { ++ case AVMEDIA_TYPE_VIDEO: ++ if (v_idx < clip_info.video_stream_count) { ++ av_log(h, AV_LOG_INFO, "video stream %d lang = %s\n", v_idx, clip_info.video_streams[v_idx].lang); ++ av_dict_set(&ic->streams[i]->metadata, "language", clip_info.video_streams[v_idx].lang, AV_DICT_DONT_OVERWRITE); ++ v_idx++; ++ } ++ break; ++ case AVMEDIA_TYPE_AUDIO: ++ if (a_idx < clip_info.audio_stream_count) { ++ av_log(h, AV_LOG_INFO, "audio stream %d lang = %s\n", a_idx, clip_info.audio_streams[a_idx].lang); ++ av_dict_set(&ic->streams[i]->metadata, "language", clip_info.audio_streams[a_idx].lang, AV_DICT_DONT_OVERWRITE); ++ a_idx++; ++ } ++ break; ++ case AVMEDIA_TYPE_SUBTITLE: ++ if (s_idx < clip_info.pg_stream_count) { ++ av_log(h, AV_LOG_INFO, "subtitle stream %d lang = %s\n", s_idx, clip_info.pg_streams[s_idx].lang); ++ av_dict_set(&ic->streams[i]->metadata, "language", clip_info.pg_streams[s_idx].lang, AV_DICT_DONT_OVERWRITE); ++ s_idx++; ++ } ++ break; ++ default: ++ break; ++ } ++ } ++ } ++ ++fail: ++ bd_free_title_info(title_info); ++ ++ return ret != 0 ? AVERROR(ret) : 0; ++} + + const URLProtocol ff_bluray_protocol = { + .name = "bluray", + .url_close = bluray_close, +- .url_open = bluray_open, ++ .url_open2 = bluray_open, + .url_read = bluray_read, + .url_seek = bluray_seek, ++ .url_parse_priv = bluray_parse_priv, + .priv_data_size = sizeof(BlurayContext), + .priv_data_class = &bluray_context_class, + }; +diff --git a/libavformat/bluray_custom_fs.c b/libavformat/bluray_custom_fs.c +new file mode 100644 +index 0000000..b82e0b2 +--- /dev/null ++++ b/libavformat/bluray_custom_fs.c +@@ -0,0 +1,459 @@ ++// ++// bluray_custom_fs_smb2.c ++// ++// Created by Reach Matt on 2024/9/13. ++// ++// ++// Copyright (C) 2021 Matt Reach// ++// Licensed under the Apache License, Version 2.0 (the "License"); ++// you may not use this file except in compliance with the License. ++// You may obtain a copy of the License at ++// ++// http://www.apache.org/licenses/LICENSE-2.0 ++// ++// Unless required by applicable law or agreed to in writing, software ++// distributed under the License is distributed on an "AS IS" BASIS, ++// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++// See the License for the specific language governing permissions and ++// limitations under the License. ++ ++#include "bluray_custom_fs.h" ++#include "url.h" ++#include "application.h" ++#include "libavutil/mem.h" ++#include "libavutil/error.h" ++#include "libavutil/avstring.h" ++#include ++#include ++ ++#ifndef UDF_BLOCK_SIZE ++# define UDF_BLOCK_SIZE 2048 ++#endif ++ ++typedef struct ff_builtin_io { ++ URLContext *url_context; ++ int64_t offset; ++ AVApplicationContext *app_ctx; ++ int64_t last_read; ++} ff_builtin_io; ++ ++typedef struct ff_bluray_access { ++ const char *url; ++ AVDictionary *opts; ++ ff_builtin_io *io; ++ const AVIOInterruptCB *int_cb; ++ int cancel; ++} ff_bluray_access; ++ ++static void close_builtin_io(ff_builtin_io *io) ++{ ++ if (!io) { ++ return; ++ } ++ if (io->url_context) { ++ ffurl_closep(&io->url_context); ++ } ++} ++ ++static int create_builtin_io(ff_builtin_io **io, const char *url, ++ AVDictionary **opts, int is_dir, ++ const AVIOInterruptCB *int_cb) ++{ ++ if (!io) { ++ return -1; ++ } ++ ++ ff_builtin_io *app = av_mallocz(sizeof(ff_builtin_io)); ++ if (!app) { ++ return -2; ++ } ++ ++ const char *protocol_whitelist = NULL; ++ ++ if (opts) { ++ const AVDictionary *dict = *opts; ++ ++ if (!av_strstart(url, "http", NULL) && ++ !av_strstart(url, "smb2", NULL)) { ++ AVDictionaryEntry *app_dict = ++ av_dict_get(dict, "ijkapplication", NULL, 0); ++ if (app_dict) { ++ app->app_ctx = ++ (AVApplicationContext *)av_dict_strtoptr(app_dict->value); ++ av_application_will_http_open(app->app_ctx, NULL, url); ++ } ++ } ++ ++ AVDictionaryEntry *proto_dict = ++ av_dict_get(dict, "protocol_whitelist", NULL, 0); ++ if (proto_dict) { ++ protocol_whitelist = av_strdup(proto_dict->value); ++ } ++ } ++ ++ if (protocol_whitelist == NULL || strlen(protocol_whitelist) == 0) { ++ protocol_whitelist = "ijkio,ijkhttphook,http,tcp,https,tls,file,smb2"; ++ } ++ ++ int flags = AVIO_FLAG_READ; ++ if (is_dir) { ++ flags |= AVIO_FLAG_DIRECT; ++ } ++ ++ int ret = ffurl_open_whitelist(&app->url_context, url, flags, int_cb, opts, ++ protocol_whitelist, NULL, NULL); ++ ++ av_application_did_http_open(app->app_ctx, (void *)app->url_context, url, ++ ret < 0 ? AVERROR(errno) : 0, ++ ret < 0 ? 500 : 200, 0); ++ if (ret < 0) { ++ close_builtin_io(app); ++ av_freep(&app); ++ } ++ *io = app; ++ return ret; ++} ++ ++static int64_t seek_builtin_io(ff_builtin_io *io, int64_t offset, int origin) ++{ ++ if (!io) { ++ return 0; ++ } ++ ++ if (io->offset == offset && origin == SEEK_SET) { ++ io->last_read = offset; ++ return offset; ++ } ++ ++ av_application_will_http_seek(io->app_ctx, (void *)io->url_context, ++ io->url_context->filename, offset); ++ ++ int64_t pos = ++ io->url_context->prot->url_seek(io->url_context, offset, origin); ++ if (pos < 0) { ++ av_application_did_http_seek(io->app_ctx, (void *)io->url_context, ++ io->url_context->filename, offset, ++ AVERROR(errno), 500); ++ return AVERROR(errno); ++ } ++ io->last_read = pos; ++ io->offset = pos; ++ av_application_did_http_seek(io->app_ctx, (void *)io->url_context, ++ io->url_context->filename, offset, 0, 200); ++ return pos; ++} ++ ++static int write_builtin_io(ff_builtin_io *io, uint8_t *buf, int buf_size) ++{ ++ if (!io) { ++ return 0; ++ } ++ ++ return io->url_context->prot->url_write(io->url_context, buf, buf_size); ++} ++ ++static int read_builtin_io(ff_builtin_io *io, uint8_t *buf, int buf_size, ++ int64_t pos) ++{ ++ if (!io) { ++ return 0; ++ } ++ ++ uint8_t *buf1 = buf; ++ int buf_size1 = buf_size; ++ int read = 0; ++ ++ seek_builtin_io(io, pos, SEEK_SET); ++ ++ while (buf_size1 > 0) { ++ read = ++ io->url_context->prot->url_read(io->url_context, buf1, buf_size1); ++ if (read <= 0) { ++ // maybe AVERROR_EOF ++ break; ++ } ++ io->offset += read; ++ buf1 += read; ++ buf_size1 -= read; ++ } ++ if (read == AVERROR_EXIT) { ++ return AVERROR_EXIT; ++ } ++ int bytes = buf_size - buf_size1; ++ if (bytes == 0 && read == AVERROR_EOF) { ++ return AVERROR_EOF; ++ } else { ++ av_application_did_io_tcp_read(io->app_ctx, (void *)io->url_context, ++ bytes); ++ return bytes; ++ } ++} ++ ++static int read_blocks(void *fs_handle, void *buf, int lba, int num_blocks) ++{ ++ ff_bluray_access *access = fs_handle; ++ if (access->cancel == 1) { ++ return AVERROR_EXIT; ++ } ++ ++ ff_builtin_io *io = access->io; ++ if (!io) { ++ return -1; ++ } ++ int got = -1; ++ int64_t pos = (int64_t)lba * UDF_BLOCK_SIZE; ++ int buf_size = num_blocks * UDF_BLOCK_SIZE; ++ int bytes = read_builtin_io(io, buf, buf_size, pos); ++ if (bytes == AVERROR_EXIT) { ++ access->cancel = 1; ++ return AVERROR_EXIT; ++ } ++ ++ if (bytes > 0) { ++ got = (int)(bytes / UDF_BLOCK_SIZE); ++ } ++ return got; ++} ++ ++void destroy_bluray_custom_access(fs_access **p) ++{ ++ if (p) { ++ fs_access *access = *p; ++ if (access) { ++ ff_bluray_access* ba = access->fs_handle; ++ ff_builtin_io *io = ba->io; ++ if (io) { ++ close_builtin_io(io); ++ av_freep(&io); ++ } ++ av_free(ba->url); ++ av_dict_free(&ba->opts); ++ } ++ av_freep(p); ++ } ++} ++ ++// ------------------------------------------------------------------------------------------- ++// open_file for bdmv ++ ++static void _file_close(BD_FILE_H *file) ++{ ++ if (file) { ++ ff_builtin_io *io = file->internal; ++ if (io) { ++ close_builtin_io(io); ++ av_free(io); ++ file->internal = NULL; ++ } ++ av_freep(&file); ++ } ++} ++ ++static int64_t _file_read(BD_FILE_H *file, uint8_t *buf, int64_t size) ++{ ++ if (size <= 0) { ++ return 0; ++ } ++ ff_builtin_io *io = file->internal; ++ if (!io) { ++ return -1; ++ } ++ ++ int read = read_builtin_io(io, buf, size, io->last_read); ++ ++ if (read > 0) { ++ io->last_read += read; ++ } ++ ++ return read; ++} ++ ++static int64_t _file_write(BD_FILE_H *file, uint8_t *buf, int64_t size) ++{ ++ if (size <= 0) { ++ return 0; ++ } ++ ff_builtin_io *io = file->internal; ++ if (!io) { ++ return -1; ++ } ++ return write_builtin_io(io, buf, size); ++} ++ ++// origin: SEEK_SET, SEEK_CUR or SEEK_END ++static int64_t _file_seek(BD_FILE_H *file, int64_t offset, int32_t origin) ++{ ++ ff_builtin_io *io = file->internal; ++ if (!io) { ++ return -1; ++ } ++ return seek_builtin_io(io, offset, origin); ++} ++ ++static int64_t _file_tell(BD_FILE_H *file) ++{ ++ ff_builtin_io *io = file->internal; ++ if (!io) { ++ return -1; ++ } ++ return io->last_read; ++ // return seek_builtin_io(io, 0, SEEK_CUR); ++} ++ ++static struct bd_file_s *open_file(void *fs_handle, const char *rel_path) ++{ ++ ff_bluray_access *access = fs_handle; ++ ++ if (access->cancel == 1) { ++ return NULL; ++ } ++ ++ const char *url = av_append_path_component(access->url, rel_path); ++ if (!url) { ++ return NULL; ++ } ++ AVDictionary *opts = NULL; ++ av_dict_copy(&opts, access->opts, 0); ++ ++ ff_builtin_io *io = NULL; ++ int ret = create_builtin_io(&io, url, &opts, 0, access->int_cb); ++ av_dict_free(&opts); ++ ++ if (0 != ret) { ++ av_log(NULL, AV_LOG_ERROR, "[bluray] can't open %s,error:%s", url, ++ av_err2str(ret)); ++ av_free(url); ++ return NULL; ++ } ++ av_free(url); ++ BD_FILE_H *file = av_malloc(sizeof(BD_FILE_H)); ++ if (!file) { ++ close_builtin_io(io); ++ av_free(io); ++ return NULL; ++ } ++ ++ file->internal = io; ++ file->close = _file_close; ++ file->seek = _file_seek; ++ file->read = _file_read; ++ file->write = _file_write; ++ file->tell = _file_tell; ++ ++ return file; ++} ++ ++// open_dir for bdmv ++static void _dir_close(BD_DIR_H *dir) ++{ ++ if (dir) { ++ ff_builtin_io *io = dir->internal; ++ if (!io) { ++ return; ++ } ++ close_builtin_io(io); ++ av_free(io); ++ dir->internal = NULL; ++ av_freep(&dir); ++ } ++} ++ ++static int _dir_read(BD_DIR_H *dir, BD_DIRENT *entry) ++{ ++ ff_builtin_io *io = dir->internal; ++ if (!io) { ++ return -1; ++ } ++ ++ AVIODirEntry *next = NULL; ++ ++ if (io->url_context->prot->url_read_dir(io->url_context, &next) < 0 || !next) { ++ return -2; ++ } ++ ++ strncpy(entry->d_name, next->name, sizeof(entry->d_name)); ++ entry->d_name[sizeof(entry->d_name) - 1] = 0; ++ ++ return 0; ++} ++ ++static struct bd_dir_s* open_dir (void *fs_handle, const char *rel_path) ++{ ++ ff_bluray_access *access = fs_handle; ++ ++ if (access->cancel == 1) { ++ return NULL; ++ } ++ ++ const char *url = av_append_path_component(access->url, rel_path); ++ if (!url) { ++ return NULL; ++ } ++ AVDictionary *opts = NULL; ++ av_dict_copy(&opts, access->opts, 0); ++ ++ ff_builtin_io *io = NULL; ++ int ret = create_builtin_io(&io, url, &opts, 1, access->int_cb); ++ av_dict_free(&opts); ++ ++ if (0 != ret) { ++ av_log(NULL, AV_LOG_ERROR, "[bluray] can't open dir %s,error:%s", url, ++ av_err2str(ret)); ++ av_free(url); ++ return NULL; ++ } ++ av_free(url); ++ BD_DIR_H *dir = av_malloc(sizeof(BD_DIR_H)); ++ if (!dir) { ++ close_builtin_io(io); ++ av_free(io); ++ return NULL; ++ } ++ ++ dir->internal = io; ++ dir->close = _dir_close; ++ dir->read = _dir_read; ++ ++ return dir; ++} ++ ++int is_bluray_custom_access_cancelled(fs_access *access) ++{ ++ if (!access) { ++ return 0; ++ } ++ ++ ff_bluray_access *opaque = access->fs_handle; ++ return opaque->cancel; ++} ++ ++// 构建fs_access结构体 ++fs_access * create_bluray_custom_access(const char *url, AVDictionary **options, const AVIOInterruptCB *int_cb) ++{ ++ ff_bluray_access * opaque = av_mallocz(sizeof(ff_bluray_access)); ++ if (!opaque) { ++ return NULL; ++ } ++ ++ if (opaque) { ++ opaque->url = av_strdup(url); ++ if (options) { ++ av_dict_copy(&opaque->opts, *options, 0); ++ } ++ opaque->int_cb = int_cb; ++ int ret = create_builtin_io(&opaque->io, url, options, 0, int_cb); ++ if (0 != ret) { ++ av_log(NULL, AV_LOG_ERROR, "[bluray] can't open file %s,error:%s", ++ url, av_err2str(ret)); ++ } ++ ++ fs_access *access = av_malloc(sizeof(fs_access)); ++ access->fs_handle = opaque; ++ access->read_blocks = read_blocks; ++ access->open_file = open_file; ++ access->open_dir = open_dir; ++ ++ return access; ++ } ++ return NULL; ++} +\ No newline at end of file +diff --git a/libavformat/bluray_custom_fs.h b/libavformat/bluray_custom_fs.h +new file mode 100644 +index 0000000..058d2da +--- /dev/null ++++ b/libavformat/bluray_custom_fs.h +@@ -0,0 +1,33 @@ ++// ++// bluray_custom_fs.h ++// ++// Created by Reach Matt on 2024/9/13. ++// ++// ++// Copyright (C) 2021 Matt Reach// ++// Licensed under the Apache License, Version 2.0 (the "License"); ++// you may not use this file except in compliance with the License. ++// You may obtain a copy of the License at ++// ++// http://www.apache.org/licenses/LICENSE-2.0 ++// ++// Unless required by applicable law or agreed to in writing, software ++// distributed under the License is distributed on an "AS IS" BASIS, ++// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++// See the License for the specific language governing permissions and ++// limitations under the License. ++ ++#ifndef bluray_custom_fs_h ++#define bluray_custom_fs_h ++ ++#include ++ ++typedef struct fs_access fs_access; ++typedef struct AVDictionary AVDictionary; ++typedef struct AVIOInterruptCB AVIOInterruptCB; ++ ++void destroy_bluray_custom_access(fs_access **p); ++int is_bluray_custom_access_cancelled(fs_access *access); ++fs_access *create_bluray_custom_access(const char *url, AVDictionary **options, ++ const AVIOInterruptCB *int_cb); ++#endif /* bluray_custom_fs_h */ +\ No newline at end of file +-- +2.50.1 (Apple Git-155) + diff --git a/patches/ffmpeg-n8.1.2/0023-bluray-open-and-find-the-right-m2ts-then-read-seek-i.patch b/patches/ffmpeg-n8.1.2/0023-bluray-open-and-find-the-right-m2ts-then-read-seek-i.patch new file mode 100644 index 000000000..28afb7341 --- /dev/null +++ b/patches/ffmpeg-n8.1.2/0023-bluray-open-and-find-the-right-m2ts-then-read-seek-i.patch @@ -0,0 +1,71 @@ +From afbd088c5f65683f1edb1383224eeddbc4bf718b Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Tue, 12 May 2026 11:45:56 +0800 +Subject: bluray open and find the right m2ts, then read/seek it + direactly instread of bluray logic. + +--- + libavformat/bluray.c | 25 ++++++++++++++++++++----- + 1 file changed, 20 insertions(+), 5 deletions(-) + +diff --git a/libavformat/bluray.c b/libavformat/bluray.c +index eb43340..254538f 100644 +--- a/libavformat/bluray.c ++++ b/libavformat/bluray.c +@@ -42,6 +42,7 @@ typedef struct { + int chapter; + /*int region;*/ + int title_idx; ++ int stream_opened; + } BlurayContext; + + #define OFFSET(x) offsetof(BlurayContext, x) +@@ -226,7 +227,8 @@ static int bluray_open(URLContext *h, const char *path, int flags, AVDictionary + if (bd->chapter > 1) { + bd_seek_chapter(bd->bd, bd->chapter - 1); + } +- ++ /* will read ts soon */ ++ bd->stream_opened = 1; + return 0; + } + +@@ -238,7 +240,13 @@ static int bluray_read(URLContext *h, unsigned char *buf, int size) + if (!bd || !bd->bd) { + return AVERROR(EFAULT); + } +- ++ if (bd->stream_opened) { ++ int read = (int)bd_file_read(bd->bd, buf, size); ++ if (read == 0) { ++ return AVERROR_EOF; ++ } ++ return read; ++ } + len = bd_read(bd->bd, buf, size); + + return len == 0 ? AVERROR_EOF : len; +@@ -256,10 +264,17 @@ static int64_t bluray_seek(URLContext *h, int64_t pos, int whence) + case SEEK_SET: + case SEEK_CUR: + case SEEK_END: +- return bd_seek(bd->bd, pos); +- ++ if (bd->stream_opened) { ++ return bd_file_seek(bd->bd, pos, whence); ++ } else { ++ return bd_seek(bd->bd, pos); ++ } + case AVSEEK_SIZE: +- return bd_get_title_size(bd->bd); ++ if (bd->stream_opened) { ++ return bd_file_size(bd->bd); ++ } else { ++ return bd_get_title_size(bd->bd); ++ } + } + + av_log(h, AV_LOG_ERROR, "Unsupported whence operation %d\n", whence); +-- +2.50.1 (Apple Git-155) + diff --git a/patches/ffmpeg-n8.1.2/0024-fix-android-ffmpeg7-test.c-1-10-fatal-error-libxml2-.patch b/patches/ffmpeg-n8.1.2/0024-fix-android-ffmpeg7-test.c-1-10-fatal-error-libxml2-.patch new file mode 100644 index 000000000..6095da59e --- /dev/null +++ b/patches/ffmpeg-n8.1.2/0024-fix-android-ffmpeg7-test.c-1-10-fatal-error-libxml2-.patch @@ -0,0 +1,26 @@ +From 6e2fc211aad20c73775334f040fbab8543236672 Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Fri, 6 Jun 2025 14:09:50 +0800 +Subject: fix android ffmpeg7 test.c:1:10: fatal error: + 'libxml2/libxml/xmlversion.h' + +--- + configure | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/configure b/configure +index 10c688c..9761c84 100755 +--- a/configure ++++ b/configure +@@ -7448,7 +7448,7 @@ enabled libzmq && require_pkg_config libzmq "libzmq >= 4.2.1" zmq.h z + enabled libzvbi && require_pkg_config libzvbi zvbi-0.2 libzvbi.h vbi_decoder_new && + { test_cpp_condition libzvbi.h "VBI_VERSION_MAJOR > 0 || VBI_VERSION_MINOR > 2 || VBI_VERSION_MINOR == 2 && VBI_VERSION_MICRO >= 28" || + enabled gpl || die "ERROR: libzvbi requires version 0.2.28 or --enable-gpl."; } +-enabled libxml2 && require_pkg_config libxml2 libxml-2.0 libxml2/libxml/xmlversion.h xmlCheckVersion ++enabled libxml2 && require_pkg_config libxml2 libxml-2.0 libxml/xmlversion.h xmlCheckVersion + enabled mbedtls && { check_pkg_config mbedtls mbedtls mbedtls/x509_crt.h mbedtls_x509_crt_init || + check_pkg_config mbedtls mbedtls mbedtls/ssl.h mbedtls_ssl_init || + check_lib mbedtls mbedtls/ssl.h mbedtls_ssl_init -lmbedtls -lmbedx509 -lmbedcrypto || +-- +2.50.1 (Apple Git-155) + diff --git a/patches/ffmpeg-n8.1.2/0025-fix-dash-init-fragment-url-is-invalid-truncated-bug.patch b/patches/ffmpeg-n8.1.2/0025-fix-dash-init-fragment-url-is-invalid-truncated-bug.patch new file mode 100644 index 000000000..c57a757ed --- /dev/null +++ b/patches/ffmpeg-n8.1.2/0025-fix-dash-init-fragment-url-is-invalid-truncated-bug.patch @@ -0,0 +1,43 @@ +From 83bd2fe0fa738f659c59d28cc484501d7260913a Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Wed, 21 May 2025 18:05:52 +0800 +Subject: fix dash init fragment url is "invalid:truncated" bug + +--- + libavformat/dashdec.c | 12 +++++++++++- + 1 file changed, 11 insertions(+), 1 deletion(-) + +diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c +index 9a2ea78..5927a6e 100644 +--- a/libavformat/dashdec.c ++++ b/libavformat/dashdec.c +@@ -479,6 +479,10 @@ static char *get_content_url(xmlNodePtr *baseurl_nodes, + int i; + char *text; + char *url = NULL; ++ ++ if (strlen(val) >= max_url_size) { ++ max_url_size += 256; ++ } + char *tmp_str = av_mallocz(max_url_size); + + if (!tmp_str) +@@ -497,8 +501,14 @@ static char *get_content_url(xmlNodePtr *baseurl_nodes, + } + } + +- if (val) ++ if (val) { ++ int tmp_max_url_size = strlen(tmp_str) + strlen(val) + 1; ++ if (tmp_max_url_size > max_url_size) { ++ max_url_size = tmp_max_url_size; ++ tmp_str = av_realloc(tmp_str, max_url_size); ++ } + ff_make_absolute_url(tmp_str, max_url_size, tmp_str, val); ++ } + + if (rep_id_val) { + url = av_strireplace(tmp_str, "$RepresentationID$", rep_id_val); +-- +2.50.1 (Apple Git-155) + diff --git a/patches/ffmpeg-n8.1.2/0026-add-webp-demuxer-and-libwebp-decoder.patch b/patches/ffmpeg-n8.1.2/0026-add-webp-demuxer-and-libwebp-decoder.patch new file mode 100644 index 000000000..2e6de76aa --- /dev/null +++ b/patches/ffmpeg-n8.1.2/0026-add-webp-demuxer-and-libwebp-decoder.patch @@ -0,0 +1,804 @@ +From 2ca732722b9799c24fd1589ab960f18b1c8108fd Mon Sep 17 00:00:00 2001 +From: qianlongxu +Date: Fri, 8 May 2026 19:02:39 +0800 +Subject: add webp demuxer and libwebp decoder + +--- + configure | 7 +- + libavcodec/Makefile | 1 + + libavcodec/allcodecs.c | 1 + + libavcodec/codec_desc.c | 9 + + libavcodec/codec_id.h | 1 + + libavcodec/libwebpdec.c | 376 +++++++++++++++++++++++++++++++++++++++ + libavformat/Makefile | 1 + + libavformat/allformats.c | 1 + + libavformat/webpdec.c | 296 ++++++++++++++++++++++++++++++ + 9 files changed, 692 insertions(+), 1 deletion(-) + create mode 100644 libavcodec/libwebpdec.c + create mode 100644 libavformat/webpdec.c + +diff --git a/configure b/configure +index 9761c84..0ecc99c 100755 +--- a/configure ++++ b/configure +@@ -7427,7 +7427,12 @@ enabled libvpx && { + enabled libvvenc && require_pkg_config libvvenc "libvvenc >= 1.6.1" "vvenc/vvenc.h" vvenc_get_version + 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 libwebp_anim_encoder && check_pkg_config libwebp_anim_encoder "libwebpmux >= 0.4.0" webp/mux.h WebPAnimEncoderOptionsInit ++ check_pkg_config libwebpdemux "libwebpdemux >= 1.0.0" webp/demux.h WebPDemux ++ if enabled libwebpdemux; then ++ enable webp_demuxer ++ enable libwebp_decoder ++ fi } + enabled libx264 && require_pkg_config libx264 x264 "stdint.h x264.h" x264_encoder_encode && + require_cpp_condition libx264 x264.h "X264_BUILD >= 155" && { + [ "$toolchain" != "msvc" ] || +diff --git a/libavcodec/Makefile b/libavcodec/Makefile +index c51a860..4ae36ed 100644 +--- a/libavcodec/Makefile ++++ b/libavcodec/Makefile +@@ -846,6 +846,7 @@ OBJS-$(CONFIG_WBMP_DECODER) += wbmpdec.o + OBJS-$(CONFIG_WBMP_ENCODER) += wbmpenc.o + OBJS-$(CONFIG_WCMV_DECODER) += wcmv.o + OBJS-$(CONFIG_WEBP_DECODER) += webp.o ++OBJS-$(CONFIG_LIBWEBP_DECODER) += libwebpdec.o + OBJS-$(CONFIG_WEBVTT_DECODER) += webvttdec.o ass.o + OBJS-$(CONFIG_WEBVTT_ENCODER) += webvttenc.o ass_split.o + OBJS-$(CONFIG_WMALOSSLESS_DECODER) += wmalosslessdec.o wma_common.o +diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c +index 695214f..ffc2494 100644 +--- a/libavcodec/allcodecs.c ++++ b/libavcodec/allcodecs.c +@@ -428,6 +428,7 @@ extern const FFCodec ff_zlib_encoder; + extern const FFCodec ff_zlib_decoder; + extern const FFCodec ff_zmbv_encoder; + extern const FFCodec ff_zmbv_decoder; ++extern const FFCodec ff_libwebp_decoder; + + /* audio codecs */ + extern const FFCodec ff_aac_encoder; +diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c +index 93877ed..46e5f8b 100644 +--- a/libavcodec/codec_desc.c ++++ b/libavcodec/codec_desc.c +@@ -3870,6 +3870,15 @@ static const AVCodecDescriptor codec_descriptors[] = { + .long_name = NULL_IF_CONFIG_SMALL("Audio Vivid"), + .props = AV_CODEC_PROP_LOSSY, + }, ++ { ++ .id = AV_CODEC_ID_LIBWEBP, ++ .type = AVMEDIA_TYPE_VIDEO, ++ .name = "libwebp", ++ .long_name = NULL_IF_CONFIG_SMALL("libWebP"), ++ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY | ++ AV_CODEC_PROP_LOSSLESS, ++ .mime_types= MT("image/webp"), ++ }, + { + .id = AV_CODEC_ID_VNULL, + .type = AVMEDIA_TYPE_VIDEO, +diff --git a/libavcodec/codec_id.h b/libavcodec/codec_id.h +index 43f7549..31bb7a6 100644 +--- a/libavcodec/codec_id.h ++++ b/libavcodec/codec_id.h +@@ -629,6 +629,7 @@ enum AVCodecID { + * Null encoder/decoder discard all input and never return any output. + */ + AV_CODEC_ID_AVS3DA, ++ AV_CODEC_ID_LIBWEBP, + AV_CODEC_ID_VNULL, + /** + * Dummy null audio codec, useful mainly for development and debugging. +diff --git a/libavcodec/libwebpdec.c b/libavcodec/libwebpdec.c +new file mode 100644 +index 0000000..17b69d0 +--- /dev/null ++++ b/libavcodec/libwebpdec.c +@@ -0,0 +1,376 @@ ++/* ++ * libwebpdec.c ++ * ++ * Copyright (c) 2025 debugly ++ * ++ * This file is part of FSPlayer. ++ * ++ * FSPlayer is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 3 of the License, or (at your option) any later version. ++ * ++ * FSPlayer is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FSPlayer; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#include "codec_internal.h" ++#include "decode.h" ++#include "internal.h" ++#include "libavutil/common.h" ++#include "libavutil/imgutils.h" ++#include "libavutil/mem.h" ++#include "libavutil/opt.h" ++#include "libavutil/pixdesc.h" ++#include ++#include ++ ++typedef struct MyImageRef { ++ int width; ++ int height; ++ uint8_t *data; ++} MyImageRef; ++ ++typedef struct MyRect { ++ int x; ++ int y; ++ int w; ++ int h; ++} MyRect; ++ ++typedef struct LibWebPDecoderContext { ++ AVClass *class; ++ MyImageRef *canvas; // The main compositing canvas ++} LibWebPDecoderContext; ++ ++static void release_image(MyImageRef *img) ++{ ++ if (img) { ++ if (img->data) ++ av_free(img->data); ++ free(img); ++ } ++} ++ ++static int alloc_image(MyImageRef **img, int width, int height) ++{ ++ if (!img || width <= 0 || height <= 0) ++ return AVERROR(EINVAL); ++ ++ *img = malloc(sizeof(MyImageRef)); ++ if (!*img) ++ return AVERROR(ENOMEM); ++ ++ (*img)->width = width; ++ (*img)->height = height; ++ (*img)->data = av_malloc(width * height * 4); // RGBA ++ if (!(*img)->data) { ++ free(*img); ++ *img = NULL; ++ return AVERROR(ENOMEM); ++ } ++ ++ memset((*img)->data, 0, width * height * 4); // 初始化为透明 ++ return 0; ++} ++ ++static void clear_rect(MyImageRef *img, MyRect rect) ++{ ++ if (!img || !img->data) ++ return; ++ ++ int img_width = img->width; ++ int img_height = img->height; ++ uint8_t *data = img->data; ++ ++ // 确保矩形在图像范围内 ++ int start_x = FFMAX(0, rect.x); ++ int start_y = FFMAX(0, rect.y); ++ int end_x = FFMIN(img_width, rect.x + rect.w); ++ int end_y = FFMIN(img_height, rect.y + rect.h); ++ ++ for (int y = start_y; y < end_y; y++) { ++ uint8_t *row = data + y * img_width * 4; ++ memset(row + start_x * 4, 0, (end_x - start_x) * 4); ++ } ++} ++ ++static void blend_pixel(uint8_t *dst, const uint8_t *src) ++{ ++ uint8_t sa = src[3]; ++ if (sa == 0) { ++ return; // 源像素完全透明,直接返回 ++ } else if (sa == 255) { ++ // 源像素完全不透明,直接覆盖 ++ memcpy(dst, src, 4); ++ return; ++ } ++ ++ uint8_t da = dst[3]; ++ uint8_t out_a = sa + ((da * (255 - sa)) / 255); ++ ++ if (out_a == 0) { ++ memset(dst, 0, 4); ++ return; ++ } ++ ++ dst[0] = (src[0] * sa + dst[0] * da * (255 - sa) / 255) / out_a; ++ dst[1] = (src[1] * sa + dst[1] * da * (255 - sa) / 255) / out_a; ++ dst[2] = (src[2] * sa + dst[2] * da * (255 - sa) / 255) / out_a; ++ dst[3] = out_a; ++} ++ ++static void draw_image(MyImageRef *canvas, MyImageRef *image, MyRect rect) ++{ ++ if (!canvas || !canvas->data || !image || !image->data) ++ return; ++ ++ int canvas_width = canvas->width; ++ int canvas_height = canvas->height; ++ uint8_t *canvas_data = canvas->data; ++ ++ int image_width = image->width; ++ int image_height = image->height; ++ uint8_t *image_data = image->data; ++ ++ // 计算绘制区域 ++ int start_x = FFMAX(0, rect.x); ++ int start_y = FFMAX(0, rect.y); ++ int end_x = FFMIN(canvas_width, rect.x + rect.w); ++ int end_y = FFMIN(canvas_height, rect.y + rect.h); ++ ++ for (int y = start_y; y < end_y; y++) { ++ uint8_t *canvas_row = canvas_data + y * canvas_width * 4; ++ uint8_t *image_row = image_data + (y - rect.y) * image_width * 4; ++ for (int x = start_x; x < end_x; x++) { ++ uint8_t *canvas_pixel = canvas_row + x * 4; ++ uint8_t *image_pixel = image_row + (x - rect.x) * 4; ++ ++ blend_pixel(canvas_pixel, image_pixel); ++ } ++ } ++} ++ ++static av_cold int libwebp_decode_init(AVCodecContext *avctx) ++{ ++ LibWebPDecoderContext *s = avctx->priv_data; ++ int canvas_size; ++ ++ if (avctx->width <= 0 || avctx->height <= 0) { ++ av_log(avctx, AV_LOG_ERROR, ++ "Invalid canvas dimensions from avctx: %dx%d\n", avctx->width, ++ avctx->height); ++ return AVERROR_INVALIDDATA; ++ } ++ ++ if (alloc_image(&s->canvas, avctx->width, avctx->height)) { ++ av_log(avctx, AV_LOG_ERROR, "Failed to allocate canvas buffer\n"); ++ return AVERROR(ENOMEM); ++ } ++ ++ avctx->pix_fmt = AV_PIX_FMT_RGBA; ++ ++ return 0; ++} ++ ++static int get_origin_from_pkt_side_data(AVPacket *pkt, int *offsetx, ++ int *offsety, int *blend, int *dispose) ++{ ++ if (!pkt || !offsetx || !offsety) { ++ return AVERROR(EINVAL); ++ } ++ ++ // 初始化输出参数 ++ *offsetx = 0; ++ *offsety = 0; ++ *blend = 0; ++ *dispose = 0; ++ ++ // 获取元数据 ++ size_t metadata_len = 0; ++ uint8_t *metadata_data = av_packet_get_side_data( ++ pkt, AV_PKT_DATA_STRINGS_METADATA, &metadata_len); ++ ++ if (!metadata_data || metadata_len == 0) { ++ return -1; // ++ } ++ ++ // 解包元数据到AVDictionary ++ AVDictionary *dict = NULL; ++ int ret = av_packet_unpack_dictionary(metadata_data, metadata_len, &dict); ++ if (ret < 0) { ++ av_log(NULL, AV_LOG_ERROR, "Failed to unpack metadata: %d\n", ret); ++ return ret; ++ } ++ ++ // 解析offsetx和offsety和blend ++ AVDictionaryEntry *entry = NULL; ++ entry = av_dict_get(dict, "offsetx", NULL, 0); ++ if (entry && entry->value) { ++ *offsetx = atoi(entry->value); // 转换字符串为整数 ++ } ++ ++ entry = av_dict_get(dict, "offsety", NULL, 0); ++ if (entry && entry->value) { ++ *offsety = atoi(entry->value); ++ } ++ ++ entry = av_dict_get(dict, "blend", NULL, 0); ++ if (entry && entry->value) { ++ *blend = atoi(entry->value); ++ } ++ ++ entry = av_dict_get(dict, "dispose", NULL, 0); ++ if (entry && entry->value) { ++ *dispose = atoi(entry->value); ++ } ++ ++ // 释放字典 ++ av_dict_free(&dict); ++ return 0; ++} ++ ++static int libwebp_do_decode_frame(AVPacket *pkt, MyImageRef **imgp) ++{ ++ WebPDecoderConfig config; ++ // 1. 解码当前帧并获取其属性 ++ if (!WebPInitDecoderConfig(&config)) ++ return AVERROR_UNKNOWN; ++ ++ if (WebPGetFeatures(pkt->data, pkt->size, &config.input) != VP8_STATUS_OK) ++ return AVERROR_INVALIDDATA; ++ ++ int hasAlpha = config.input.has_alpha; ++ int input_width = config.input.width; ++ int input_height = config.input.height; ++ if (input_width <= 0 || input_height <= 0) ++ return AVERROR_INVALIDDATA; ++ ++ config.output.colorspace = MODE_RGBA; ++ config.output.is_external_memory = 1; ++ ++ MyImageRef *img; ++ ++ if (alloc_image(&img, input_width, input_height)) { ++ return AVERROR(ENOMEM); ++ } ++ ++ int rgba_stride = img->width * 4; ++ uint8_t *rgba = img->data; ++ config.output.u.RGBA.rgba = rgba; ++ config.output.u.RGBA.stride = rgba_stride; ++ config.output.u.RGBA.size = input_height * rgba_stride; ++ ++ if (WebPDecode(pkt->data, pkt->size, &config) != VP8_STATUS_OK) { ++ release_image(img); ++ return AVERROR_INVALIDDATA; ++ } ++ *imgp = img; ++ return 0; ++} ++ ++static int libwebp_decode_frame(AVCodecContext *avctx, AVFrame *frame, ++ int *got_frame, const AVPacket *pkt) ++{ ++ LibWebPDecoderContext *s = avctx->priv_data; ++ ++ int offsetx, offsety, blend, dispose; ++ if (get_origin_from_pkt_side_data(pkt, &offsetx, &offsety, &blend, ++ &dispose) < 0) { ++ return AVERROR_INVALIDDATA; ++ } ++ ++ // 使用 libwebp 解码当前帧 ++ MyImageRef *img = NULL; ++ int ret = libwebp_do_decode_frame((AVPacket *)pkt, &img); ++ if (ret < 0) { ++ av_log(avctx, AV_LOG_ERROR, "Failed to decode WebP frame: %d\n", ret); ++ return ret; ++ } ++ ++ // 将当前帧渲染到已准备好的画布上 ++ MyRect rect = {offsetx, offsety, img->width, img->height}; ++ draw_image(s->canvas, img, rect); ++ release_image(img); ++ ++ frame->width = avctx->width; ++ frame->height = avctx->height; ++ frame->format = avctx->pix_fmt; ++ ++ // 为 frame 申请内存 ++ if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { ++ return ret; ++ } ++ ++ // 将合成好的画布复制到输出帧 ++ int canvas_linesize = s->canvas->width * 4; ++ av_image_copy_plane(frame->data[0], frame->linesize[0], s->canvas->data, ++ s->canvas->width * 4, s->canvas->width * 4, ++ s->canvas->height); ++ ++ // av_image_copy(frame->data, frame->linesize, ++ // (const uint8_t **)&s->canvas->data, &canvas_linesize, ++ // avctx->pix_fmt, output_width, output_height); ++ ++ // 执行 dispose 操作 ++ if (dispose == WEBP_MUX_DISPOSE_BACKGROUND) { ++ clear_rect(s->canvas, rect); ++ } ++ ++ *got_frame = 1; ++ ret = pkt->size; ++ ++ return ret; ++} ++ ++static int libwebp_decode_flush(AVCodecContext *avctx) ++{ ++ LibWebPDecoderContext *s = avctx->priv_data; ++ if (s->canvas && s->canvas->data) { ++ memset(s->canvas->data, 0, s->canvas->width * s->canvas->height * 4); ++ } ++ return 0; ++} ++ ++//when seek or seek to zero for loop,clear then canvas ++static av_cold int libwebp_decode_close(AVCodecContext *avctx) ++{ ++ LibWebPDecoderContext *s = avctx->priv_data; ++ release_image(s->canvas); ++ s->canvas = NULL; ++ return 0; ++} ++ ++#define OFFSET(x) offsetof(LibWebPDecoderContext, x) ++#define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM ++ ++static const AVOption options[] = {{NULL}}; ++ ++static const AVClass libwebp_decoder_class = { ++ .class_name = "libwebp decoder", ++ .item_name = av_default_item_name, ++ .option = options, ++ .version = LIBAVUTIL_VERSION_INT, ++}; ++ ++const FFCodec ff_libwebp_decoder = { ++ .p.name = "libwebp", ++ .p.long_name = NULL_IF_CONFIG_SMALL("libwebp WebP image decoder"), ++ .p.type = AVMEDIA_TYPE_VIDEO, ++ .p.id = AV_CODEC_ID_LIBWEBP, ++ .priv_data_size = sizeof(LibWebPDecoderContext), ++ .init = libwebp_decode_init, ++ .cb.decode = libwebp_decode_frame, ++ .flush = libwebp_decode_flush, ++ .close = libwebp_decode_close, ++ .p.capabilities = AV_CODEC_CAP_DR1, ++ .p.priv_class = &libwebp_decoder_class, ++ .p.wrapper_name = "libwebp", ++ .caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE, ++}; +diff --git a/libavformat/Makefile b/libavformat/Makefile +index 54e88cf..3081d27 100644 +--- a/libavformat/Makefile ++++ b/libavformat/Makefile +@@ -659,6 +659,7 @@ OBJS-$(CONFIG_WEBM_MUXER) += matroskaenc.o matroska.o \ + OBJS-$(CONFIG_WEBM_DASH_MANIFEST_MUXER) += webmdashenc.o + OBJS-$(CONFIG_WEBM_CHUNK_MUXER) += webm_chunk.o + OBJS-$(CONFIG_WEBP_MUXER) += webpenc.o ++OBJS-$(CONFIG_WEBP_DEMUXER) += webpdec.o + OBJS-$(CONFIG_WEBVTT_DEMUXER) += webvttdec.o subtitles.o + OBJS-$(CONFIG_WEBVTT_MUXER) += webvttenc.o + OBJS-$(CONFIG_WHIP_MUXER) += whip.o avc.o http.o srtp.o +diff --git a/libavformat/allformats.c b/libavformat/allformats.c +index 1a05db9..f69c550 100644 +--- a/libavformat/allformats.c ++++ b/libavformat/allformats.c +@@ -571,6 +571,7 @@ extern const FFInputFormat ff_image_svg_pipe_demuxer; + extern const FFInputFormat ff_image_sunrast_pipe_demuxer; + extern const FFInputFormat ff_image_tiff_pipe_demuxer; + extern const FFInputFormat ff_image_vbn_pipe_demuxer; ++extern const FFInputFormat ff_webp_demuxer; + extern const FFInputFormat ff_image_webp_pipe_demuxer; + extern const FFInputFormat ff_image_xbm_pipe_demuxer; + extern const FFInputFormat ff_image_xpm_pipe_demuxer; +diff --git a/libavformat/webpdec.c b/libavformat/webpdec.c +new file mode 100644 +index 0000000..078ac99 +--- /dev/null ++++ b/libavformat/webpdec.c +@@ -0,0 +1,296 @@ ++/* ++ * webpdec.c ++ * ++ * Copyright (c) 2025 debugly ++ * ++ * This file is part of FSPlayer. ++ * ++ * FSPlayer is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 3 of the License, or (at your option) any later version. ++ * ++ * FSPlayer is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with FSPlayer; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#include "internal.h" ++#include "demux.h" ++#include "libavutil/intreadwrite.h" ++#include "libavutil/mem.h" ++#include "libavutil/common.h" ++#include ++ ++typedef struct WebPDemuxContext { ++ const AVClass *class; ++ WebPDemuxer *demuxer; ++ WebPIterator iter; // 帧迭代器 ++ int current_frame; // 当前帧索引 ++ int frame_count; // 总帧数 ++ int64_t duration; // 总时长(ms) ++ uint8_t *data; // 文件数据缓冲区 ++ size_t data_size; // 数据大小 ++ int64_t *frame_timestamps; // 帧时间戳数组(ms) ++ int *frame_durations; // 帧时长数组(ms) ++} WebPDemuxContext; ++ ++// 释放迭代器资源 ++static void webp_release_iterator(WebPIterator *iter) { ++ if (iter->fragment.bytes) { ++ WebPDemuxReleaseIterator(iter); ++ memset(iter, 0, sizeof(*iter)); ++ } ++} ++ ++// 探测WebP格式 ++static int webp_read_probe(const AVProbeData *p) { ++ // WebP文件格式以"RIFF"开头,后面跟着4字节大小和"WEBP"标识 ++ if (p->buf_size < 12) ++ return 0; ++ ++ // 检查RIFF标识和WEBP格式标识 ++ if (AV_RL32(p->buf) == MKTAG('R', 'I', 'F', 'F') && ++ AV_RL32(p->buf + 8) == MKTAG('W', 'E', 'B', 'P')) { ++ // 确定是WebP文件,返回较高的探测分数 ++ return AVPROBE_SCORE_MAX; ++ } ++ ++ return 0; ++} ++ ++static int webp_read_header(AVFormatContext *s) { ++ WebPDemuxContext *wp = s->priv_data; ++ AVIOContext *pb = s->pb; ++ AVStream *st; ++ int ret, i; ++ ++ // 读取文件到内存 ++ wp->data_size = avio_size(pb); ++ if (wp->data_size <= 0) { ++ av_log(s, AV_LOG_ERROR, "Invalid file size\n"); ++ return AVERROR_INVALIDDATA; ++ } ++ ++ wp->data = av_malloc(wp->data_size); ++ if (!wp->data) ++ return AVERROR(ENOMEM); ++ ++ if (avio_read(pb, wp->data, wp->data_size) != wp->data_size) { ++ av_log(s, AV_LOG_ERROR, "Failed to read file\n"); ++ ret = AVERROR(EIO); ++ goto fail; ++ } ++ ++ // 初始化WebP解复用器 ++ WebPData webp_data; ++ WebPDataInit(&webp_data); ++ webp_data.bytes = wp->data; ++ webp_data.size = wp->data_size; ++ ++ wp->demuxer = WebPDemux(&webp_data); ++ if (!wp->demuxer) { ++ av_log(s, AV_LOG_ERROR, "Failed to create WebP demuxer\n"); ++ ret = AVERROR_INVALIDDATA; ++ goto fail; ++ } ++ ++ wp->frame_count = WebPDemuxGetI(wp->demuxer, WEBP_FF_FRAME_COUNT); ++ // 获取画布尺寸 ++ int canvas_width = WebPDemuxGetI(wp->demuxer, WEBP_FF_CANVAS_WIDTH); ++ int canvas_height = WebPDemuxGetI(wp->demuxer, WEBP_FF_CANVAS_HEIGHT); ++ ++ // int loop_count = WebPDemuxGetI(wp->demuxer, WEBP_FF_LOOP_COUNT); ++ // uint32_t flags = WebPDemuxGetI(wp->demuxer, WEBP_FF_FORMAT_FLAGS); ++ ++ // int has_animation = flags & ANIMATION_FLAG; ++ // int has_alpha = flags & ALPHA_FLAG; ++ ++ // 分配帧时间戳和时长数组 ++ wp->frame_timestamps = av_malloc_array(wp->frame_count, sizeof(int64_t)); ++ wp->frame_durations = av_malloc_array(wp->frame_count, sizeof(int)); ++ if (!wp->frame_timestamps || !wp->frame_durations) { ++ ret = AVERROR(ENOMEM); ++ goto fail; ++ } ++ ++ memset(&wp->iter, 0, sizeof(wp->iter)); ++ // libwebp's index start with 1 ++ if (!WebPDemuxGetFrame(wp->demuxer, 1, &wp->iter)) { ++ av_log(s, AV_LOG_ERROR, "Failed to get first frame\n"); ++ ret = AVERROR_INVALIDDATA; ++ goto fail; ++ } ++ ++ wp->duration = 0; ++ for (i = 0; i < wp->frame_count; i++) { ++ int duration = wp->iter.duration; ++ if (duration <= 10) { ++ // WebP standard says 0 duration is used for canvas updating but not showing image, but actually Chrome and other implementations set it to 100ms if duration is lower or equal than 10ms ++ // Some animated WebP images also created without duration, we should keep compatibility ++ duration = 100; ++ } ++ wp->frame_durations[i] = duration; ++ wp->frame_timestamps[i] = wp->duration; ++ wp->duration += wp->frame_durations[i]; ++ if (i < wp->frame_count - 1) ++ WebPDemuxNextFrame(&wp->iter); ++ } ++ ++ // 重置迭代器到第一帧 ++ webp_release_iterator(&wp->iter); ++ if (!WebPDemuxGetFrame(wp->demuxer, 1, &wp->iter)) { ++ av_log(s, AV_LOG_ERROR, "Failed to reset to first frame\n"); ++ ret = AVERROR_INVALIDDATA; ++ goto fail; ++ } ++ ++ // 创建视频流 ++ st = avformat_new_stream(s, NULL); ++ if (!st) { ++ ret = AVERROR(ENOMEM); ++ goto fail; ++ } ++ ++ // 设置流参数 ++ st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO; ++ // 使用自定义解码器 ++ st->codecpar->codec_id = AV_CODEC_ID_LIBWEBP; ++ st->codecpar->width = canvas_width; ++ st->codecpar->height = canvas_height; ++ st->duration = wp->duration; ++ avpriv_set_pts_info(st, 64, 1, 1000); // 时基:1ms ++ ++ wp->current_frame = 0; ++ return 0; ++ ++fail: ++ webp_release_iterator(&wp->iter); ++ WebPDemuxDelete(wp->demuxer); ++ av_free(wp->data); ++ av_free(wp->frame_timestamps); ++ av_free(wp->frame_durations); ++ return ret; ++} ++ ++/** ++ * Add this frame's source path and basename to packet's sidedata ++ * as a dictionary, so it can be used by filters like 'drawtext'. ++ */ ++static int add_origin_as_pkt_side_data(int offsetx, int offsety, int blend, int dispose, AVPacket *pkt) { ++ AVDictionary *d = NULL; ++ char *packed_metadata = NULL; ++ size_t metadata_len; ++ int ret; ++ ++ av_dict_set_int(&d, "offsetx", offsetx, 0); ++ av_dict_set_int(&d, "offsety", offsety, 0); ++ av_dict_set_int(&d, "blend", blend, 0); ++ av_dict_set_int(&d, "dispose", dispose, 0); ++ ++ packed_metadata = av_packet_pack_dictionary(d, &metadata_len); ++ av_dict_free(&d); ++ if (!packed_metadata) ++ return AVERROR(ENOMEM); ++ ret = av_packet_add_side_data(pkt, AV_PKT_DATA_STRINGS_METADATA, ++ packed_metadata, metadata_len); ++ if (ret < 0) { ++ av_freep(&packed_metadata); ++ return ret; ++ } ++ return 0; ++} ++ ++static int webp_read_packet(AVFormatContext *s, AVPacket *pkt) { ++ WebPDemuxContext *wp = s->priv_data; ++ int ret; ++ ++ if (wp->current_frame >= wp->frame_count) ++ return AVERROR_EOF; ++ ++ // 分配并填充数据包 ++ if ((ret = av_new_packet(pkt, wp->iter.fragment.size)) < 0) ++ return ret; ++ memcpy(pkt->data, wp->iter.fragment.bytes, wp->iter.fragment.size); ++ ++ add_origin_as_pkt_side_data(wp->iter.x_offset, wp->iter.y_offset, wp->iter.blend_method == WEBP_MUX_BLEND, wp->iter.dispose_method == WEBP_MUX_DISPOSE_BACKGROUND, pkt); ++ // 设置数据包参数 ++ pkt->stream_index = 0; ++ pkt->pts = wp->frame_timestamps[wp->current_frame]; ++ pkt->duration = wp->frame_durations[wp->current_frame]; ++ pkt->flags |= AV_PKT_FLAG_KEY; ++ ++ // 准备下一帧 ++ wp->current_frame++; ++ if (wp->current_frame < wp->frame_count && !WebPDemuxNextFrame(&wp->iter)) ++ av_log(s, AV_LOG_WARNING, "Unexpected end of frames\n"); ++ ++ return 0; ++} ++ ++static int webp_read_seek(AVFormatContext *s, int stream_index, ++ int64_t timestamp, int flags) { ++ WebPDemuxContext *wp = s->priv_data; ++ int target_frame; ++ ++ if (stream_index != 0) ++ return -1; ++ ++ // 计算目标帧索引 ++ target_frame = av_rescale_rnd(timestamp, wp->frame_count, ++ wp->duration, flags & AVSEEK_FLAG_BACKWARD ? AV_ROUND_DOWN : AV_ROUND_UP); ++ ++ // 手动实现范围限制(替代av_clamp) ++ if (target_frame < 0) { ++ target_frame = 0; ++ } else if (target_frame >= wp->frame_count) { ++ target_frame = wp->frame_count - 1; ++ } ++ ++ // 定位到目标帧 ++ webp_release_iterator(&wp->iter); ++ if (!WebPDemuxGetFrame(wp->demuxer, target_frame + 1, &wp->iter)) { ++ av_log(s, AV_LOG_ERROR, "Failed to seek to frame %d\n", target_frame); ++ return AVERROR_INVALIDDATA; ++ } ++ ++ wp->current_frame = target_frame; ++ return 0; ++} ++ ++static int webp_read_close(AVFormatContext *s) { ++ WebPDemuxContext *wp = s->priv_data; ++ ++ webp_release_iterator(&wp->iter); ++ WebPDemuxDelete(wp->demuxer); ++ av_free(wp->data); ++ av_free(wp->frame_timestamps); ++ av_free(wp->frame_durations); ++ return 0; ++} ++ ++static const AVClass webp_demuxer_class = { ++ .class_name = "WebP demuxer", ++ .item_name = av_default_item_name, ++ .version = LIBAVUTIL_VERSION_INT, ++}; ++ ++// FFmpeg 7.x输入解复用器标准声明 ++const FFInputFormat ff_webp_demuxer = { ++ .p.name = "webp", ++ .p.long_name = NULL_IF_CONFIG_SMALL("WebP image format (libwebp 1.5.0+)"), ++ .p.flags = AVFMT_GENERIC_INDEX, ++ .p.extensions = "webp", ++ .read_probe = webp_read_probe, ++ .read_header = webp_read_header, ++ .read_packet = webp_read_packet, ++ .read_seek = webp_read_seek, ++ .read_close = webp_read_close, ++ .priv_data_size = sizeof(WebPDemuxContext), ++ .p.priv_class = &webp_demuxer_class, ++}; +-- +2.50.1 (Apple Git-155) + From 0c27ed18e2cda2c39be708557ef138a99ba950d9 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Thu, 25 Jun 2026 15:26:58 +0800 Subject: [PATCH 350/359] only for ffmpeg 8.1.1 need disable postproc module --- configs/ffconfig/auto-detect-third-libs.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configs/ffconfig/auto-detect-third-libs.sh b/configs/ffconfig/auto-detect-third-libs.sh index 948a92ec5..0acbfbb47 100644 --- a/configs/ffconfig/auto-detect-third-libs.sh +++ b/configs/ffconfig/auto-detect-third-libs.sh @@ -238,8 +238,8 @@ if [[ $result ]]; then echo "----------------------" fi -result=$(gt_or_equal "8.1.1" "$GIT_REPO_VERSION") -if [[ ! $result ]]; then +# only for ffmpeg 8.1.1 need disable postproc module +if [[ "8.1.1" == "$GIT_REPO_VERSION" ]]; then THIRD_CFG_FLAGS="$THIRD_CFG_FLAGS --disable-postproc" fi From 63ba4405dce8bc3a61d8cb1aa408d647b0e17971 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Thu, 25 Jun 2026 15:27:32 +0800 Subject: [PATCH 351/359] Compare FFmpeg Features --- .../workflows/compare ffmpeg features.yaml | 46 ++ tools/list-all-feature.sh | 437 +++++++----------- tools/publish-feature-doc.sh | 39 ++ 3 files changed, 242 insertions(+), 280 deletions(-) create mode 100644 .github/workflows/compare ffmpeg features.yaml create mode 100755 tools/publish-feature-doc.sh diff --git a/.github/workflows/compare ffmpeg features.yaml b/.github/workflows/compare ffmpeg features.yaml new file mode 100644 index 000000000..df1b443a4 --- /dev/null +++ b/.github/workflows/compare ffmpeg features.yaml @@ -0,0 +1,46 @@ +name: Compare FFmpeg Features + +on: + push: + branches: + - master # 或者 main,根据你的主分支名字修改 + +# 给 Action 赋予修改 Pages 的权限 +permissions: + contents: read + pages: write + id-token: write + +# 确保同一时间只有一个部署任务在运行 +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + build-and-deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: macos-latest # 因为你的工具链是 build/src/macos,必须在 Mac 环境下运行才能生成 macos-arm64 的配置 + + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Setup Pages + uses: actions/configure-pages@v4 + + - name: Run Toolchain and Generate Matrix + run: | + chmod +x ./tools/publish-feature-doc.sh + chmod +x ./tools/list-all-feature.sh + ./tools/publish-feature-doc.sh + + - name: Upload Artifact + uses: actions/upload-pages-artifact@v3 + with: + path: './docs' # 指定刚才在脚本里创建的输出目录 + + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 \ No newline at end of file diff --git a/tools/list-all-feature.sh b/tools/list-all-feature.sh index 73d62c1b0..dac1f5c43 100755 --- a/tools/list-all-feature.sh +++ b/tools/list-all-feature.sh @@ -1,285 +1,162 @@ +#!/bin/bash +# 获取当前脚本所在目录并切换 SHELL_ROOT=$(cd "$(dirname "$0")" && pwd) - cd "$SHELL_ROOT" - cd ../build/src/macos -echo "## FFmpeg 7.1.1 Supported Protocols:$(./ffmpeg7-arm64/configure --list-protocols | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" -echo '```' -./ffmpeg7-arm64/configure --list-protocols -echo '```' - -echo "## FFmpeg 6.1.1 Supported Protocols:$(./ffmpeg6-arm64/configure --list-protocols | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" -echo '```' -./ffmpeg6-arm64/configure --list-protocols -echo '```' - -echo "## FFmpeg 5.1.6 Supported Protocols:$(./ffmpeg5-arm64/configure --list-protocols | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" -echo '```' -./ffmpeg5-arm64/configure --list-protocols -echo '```' - -echo "## FFmpeg 4.0.5 Supported Protocols:$(./ffmpeg4-arm64/configure --list-protocols | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" -echo '```' -./ffmpeg4-arm64/configure --list-protocols -echo '```' - -echo "## FFmpeg 7.1.1 Supported Encoders:$(./ffmpeg7-arm64/configure --list-encoders | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" -echo '```' -./ffmpeg7-arm64/configure --list-encoders -echo '```' - -echo "## FFmpeg 6.1.1 Supported Encoders:$(./ffmpeg6-arm64/configure --list-encoders | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" -echo '```' -./ffmpeg6-arm64/configure --list-encoders -echo '```' - -echo "## FFmpeg 5.1.6 Supported Encoders:$(./ffmpeg5-arm64/configure --list-encoders | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" -echo '```' -./ffmpeg5-arm64/configure --list-encoders -echo '```' - -echo "## FFmpeg 4.0.5 Supported Encoders:$(./ffmpeg4-arm64/configure --list-encoders | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" -echo '```' -./ffmpeg4-arm64/configure --list-encoders -echo '```' - -echo "## FFmpeg 7.1.1 Supported Decoders:$(./ffmpeg7-arm64/configure --list-decoders | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" -echo '```' -./ffmpeg7-arm64/configure --list-decoders -echo '```' - -echo "## FFmpeg 6.1.1 Supported Decoders:$(./ffmpeg6-arm64/configure --list-decoders | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" -echo '```' -./ffmpeg6-arm64/configure --list-decoders -echo '```' - -echo "## FFmpeg 5.1.6 Supported Decoders:$(./ffmpeg5-arm64/configure --list-decoders | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" -echo '```' -./ffmpeg5-arm64/configure --list-decoders -echo '```' - -echo "## FFmpeg 4.0.5 Supported Decoders:$(./ffmpeg4-arm64/configure --list-decoders | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" -echo '```' -./ffmpeg4-arm64/configure --list-decoders -echo '```' - -echo "## FFmpeg 7.1.1 Supported Demuxers:$(./ffmpeg7-arm64/configure --list-demuxers | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" -echo '```' -./ffmpeg7-arm64/configure --list-demuxers -echo '```' - -echo "## FFmpeg 6.1.1 Supported Demuxers:$(./ffmpeg6-arm64/configure --list-demuxers | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" -echo '```' -./ffmpeg6-arm64/configure --list-demuxers -echo '```' - -echo "## FFmpeg 5.1.6 Supported Demuxers:$(./ffmpeg5-arm64/configure --list-demuxers | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" -echo '```' -./ffmpeg5-arm64/configure --list-demuxers -echo '```' - -echo "## FFmpeg 4.0.5 Supported Demuxers:$(./ffmpeg4-arm64/configure --list-demuxers | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" -echo '```' -./ffmpeg4-arm64/configure --list-demuxers -echo '```' - -echo "## FFmpeg 7.1.1 Supported Muxers:$(./ffmpeg7-arm64/configure --list-muxers | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" -echo '```' -./ffmpeg7-arm64/configure --list-muxers -echo '```' - -echo "## FFmpeg 6.1.1 Supported Muxers:$(./ffmpeg6-arm64/configure --list-muxers | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" -echo '```' -./ffmpeg6-arm64/configure --list-muxers -echo '```' - -echo "## FFmpeg 5.1.6 Supported Muxers:$(./ffmpeg5-arm64/configure --list-muxers | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" -echo '```' -./ffmpeg5-arm64/configure --list-muxers -echo '```' - -echo "## FFmpeg 4.0.5 Supported Muxers:$(./ffmpeg4-arm64/configure --list-muxers | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" -echo '```' -./ffmpeg4-arm64/configure --list-muxers -echo '```' - -echo "## FFmpeg 7.1.1 Supported Filters:$(./ffmpeg7-arm64/configure --list-filters | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" -echo '```' -./ffmpeg7-arm64/configure --list-filters -echo '```' - -echo "## FFmpeg 6.1.1 Supported Filters:$(./ffmpeg6-arm64/configure --list-filters | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" -echo '```' -./ffmpeg6-arm64/configure --list-filters -echo '```' - -echo "## FFmpeg 5.1.6 Supported Filters:$(./ffmpeg5-arm64/configure --list-filters | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" -echo '```' -./ffmpeg5-arm64/configure --list-filters -echo '```' - -echo "## FFmpeg 4.0.5 Supported Filters:$(./ffmpeg4-arm64/configure --list-filters | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" -echo '```' -./ffmpeg4-arm64/configure --list-filters -echo '```' - -echo "## FFmpeg 7.1.1 Supported Bitstream Filters:$(./ffmpeg7-arm64/configure --list-bsfs | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" -echo '```' -./ffmpeg7-arm64/configure --list-bsfs -echo '```' - -echo "## FFmpeg 6.1.1 Supported Bitstream Filters:$(./ffmpeg6-arm64/configure --list-bsfs | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" -echo '```' -./ffmpeg6-arm64/configure --list-bsfs - -echo "## FFmpeg 5.1.6 Supported Bitstream Filters:$(./ffmpeg5-arm64/configure --list-bsfs | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" -echo '```' -./ffmpeg5-arm64/configure --list-bsfs -echo '```' - -echo "## FFmpeg 4.0.5 Supported Bitstream Filters:$(./ffmpeg4-arm64/configure --list-bsfs | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" -echo '```' -./ffmpeg4-arm64/configure --list-bsfs -echo '```' - -echo "## FFmpeg 7.1.1 Supported Protocols:$(./ffmpeg7-arm64/configure --list-protocols | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" -echo '```' -./ffmpeg7-arm64/configure --list-protocols -echo '```' - -echo "## FFmpeg 6.1.1 Supported Protocols:$(./ffmpeg6-arm64/configure --list-protocols | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" -echo '```' -./ffmpeg6-arm64/configure --list-protocols -echo '```' - -echo "## FFmpeg 5.1.6 Supported Protocols:$(./ffmpeg5-arm64/configure --list-protocols | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" -echo '```' -./ffmpeg5-arm64/configure --list-protocols -echo '```' - -echo "## FFmpeg 4.0.5 Supported Protocols:$(./ffmpeg4-arm64/configure --list-protocols | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" -echo '```' -./ffmpeg4-arm64/configure --list-protocols -echo '```' - -echo "## FFmpeg 7.1.1 Supported Devices:$(./ffmpeg7-arm64/configure --list-devices | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" -echo '```' -./ffmpeg7-arm64/configure --list-devices -echo '```' - -echo "## FFmpeg 6.1.1 Supported Devices:$(./ffmpeg6-arm64/configure --list-devices | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" -echo '```' -./ffmpeg6-arm64/configure --list-devices -echo '```' - -echo "## FFmpeg 5.1.6 Supported Devices:$(./ffmpeg5-arm64/configure --list-devices | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" -echo '```' -./ffmpeg5-arm64/configure --list-devices -echo '```' - -echo "## FFmpeg 4.0.5 Supported Devices:$(./ffmpeg4-arm64/configure --list-devices | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" -echo '```' -./ffmpeg4-arm64/configure --list-devices -echo '```' - -echo "## FFmpeg 7.1.1 Supported Hardware Accelerators:$(./ffmpeg7-arm64/configure --list-hwaccels | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" -echo '```' -./ffmpeg7-arm64/configure --list-hwaccels -echo '```' - -echo "## FFmpeg 6.1.1 Supported Hardware Accelerators:$(./ffmpeg6-arm64/configure --list-hwaccels | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" -echo '```' -./ffmpeg6-arm64/configure --list-hwaccels -echo '```' - -echo "## FFmpeg 5.1.6 Supported Hardware Accelerators:$(./ffmpeg5-arm64/configure --list-hwaccels | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" -echo '```' -./ffmpeg5-arm64/configure --list-hwaccels -echo '```' - -echo "## FFmpeg 4.0.5 Supported Hardware Accelerators:$(./ffmpeg4-arm64/configure --list-hwaccels | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" -echo '```' -./ffmpeg4-arm64/configure --list-hwaccels -echo '```' - -echo "## FFmpeg 7.1.1 Supported Input Devices:$(./ffmpeg7-arm64/configure --list-indevs | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" -echo '```' -./ffmpeg7-arm64/configure --list-indevs -echo '```' - -echo "## FFmpeg 6.1.1 Supported Input Devices:$(./ffmpeg6-arm64/configure --list-indevs | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" -echo '```' -./ffmpeg6-arm64/configure --list-indevs -echo '```' - -echo "## FFmpeg 5.1.6 Supported Input Devices:$(./ffmpeg5-arm64/configure --list-indevs | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" -echo '```' -./ffmpeg5-arm64/configure --list-indevs -echo '```' - -echo "## FFmpeg 4.0.5 Supported Input Devices:$(./ffmpeg4-arm64/configure --list-indevs | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" -echo '```' -./ffmpeg4-arm64/configure --list-indevs -echo '```' - -echo "## FFmpeg 7.1.1 Supported Output Devices:$(./ffmpeg7-arm64/configure --list-outdevs | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" -echo '```' -./ffmpeg7-arm64/configure --list-outdevs -echo '```' - -echo "## FFmpeg 6.1.1 Supported Output Devices:$(./ffmpeg6-arm64/configure --list-outdevs | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" -echo '```' -./ffmpeg6-arm64/configure --list-outdevs -echo '```' - -echo "## FFmpeg 5.1.6 Supported Output Devices:$(./ffmpeg5-arm64/configure --list-outdevs | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" -echo '```' -./ffmpeg5-arm64/configure --list-outdevs -echo '```' - -echo "## FFmpeg 4.0.5 Supported Output Devices:$(./ffmpeg4-arm64/configure --list-outdevs | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" -echo '```' -./ffmpeg4-arm64/configure --list-outdevs -echo '```' - -echo "## FFmpeg 7.1.1 Supported Bitstream Filters:$(./ffmpeg7-arm64/configure --list-bsfs | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" -echo '```' -./ffmpeg7-arm64/configure --list-bsfs -echo '```' - -echo "## FFmpeg 6.1.1 Supported Bitstream Filters:$(./ffmpeg6-arm64/configure --list-bsfs | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" -echo '```' -./ffmpeg6-arm64/configure --list-bsfs -echo '```' - -echo "## FFmpeg 5.1.6 Supported Bitstream Filters:$(./ffmpeg5-arm64/configure --list-bsfs | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" -echo '```' -./ffmpeg5-arm64/configure --list-bsfs -echo '```' - -echo "## FFmpeg 4.0.5 Supported Bitstream Filters:$(./ffmpeg4-arm64/configure --list-bsfs | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" -echo '```' -./ffmpeg4-arm64/configure --list-bsfs -echo '```' - -echo "## FFmpeg 7.1.1 Supported Parsers:$(./ffmpeg7-arm64/configure --list-parsers | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" -echo '```' -./ffmpeg7-arm64/configure --list-parsers -echo '```' - -echo "## FFmpeg 6.1.1 Supported Parsers:$(./ffmpeg6-arm64/configure --list-parsers | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" -echo '```' -./ffmpeg6-arm64/configure --list-parsers -echo '```' - -echo "## FFmpeg 5.1.6 Supported Parsers:$(./ffmpeg5-arm64/configure --list-parsers | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" -echo '```' -./ffmpeg5-arm64/configure --list-parsers -echo '```' - -echo "## FFmpeg 4.0.5 Supported Parsers:$(./ffmpeg4-arm64/configure --list-parsers | tr -s '[:space:]' '\n' | grep -v '^$' | wc -l | tr -s '[:space:]' ' ')" -echo '```' -./ffmpeg4-arm64/configure --list-parsers -echo '```' +# 定义 FFmpeg 版本及其对应的配置路径 +# 顺序必须从新到旧:左边最新,右边最老 +VERSIONS=( + "8.1.2|./ffmpeg8-arm64/configure" + "7.1.3|./ffmpeg7-arm64/configure" + "6.1.1|./ffmpeg6-arm64/configure" + "5.1.6|./ffmpeg5-arm64/configure" + "4.0.5|./ffmpeg4-arm64/configure" +) + +# 创建临时文件夹 +TMP_DIR=$(mktemp -d /tmp/ffmpeg_perfect.XXXXXX) +trap 'rm -rf "$TMP_DIR"' EXIT + +# ========================================== +# 特征处理主函数(采用全局大列表对齐算法) +# ========================================== +process_feature() { + local list_cmd="$1" + local title_name="$2" + + local headers=() + local raw_files=() + local total_versions=${#VERSIONS[@]} + + # 1. 收集所有版本的数据(单行、排序、去重) + for i in "${!VERSIONS[@]}"; do + local version="${VERSIONS[i]%%|*}" + local config_path="${VERSIONS[i]##*|}" + local raw_file="$TMP_DIR/raw_$i" + + if [ ! -x "$config_path" ]; then + touch "$raw_file" + headers+=("$version (N/A)") + else + local raw_output + raw_output=$($config_path "$list_cmd" 2>/dev/null) + echo "$raw_output" | tr -s '[:space:]' '\n' | grep -v '^$' | sort -u > "$raw_file" + + local count + count=$(wc -l < "$raw_file" | tr -d ' ') + headers+=("$version ($count)") + fi + raw_files+=("$raw_file") + done + + # 2. 构建完美的全局统一基准列表 (Master List) + local master_list="$TMP_DIR/master_list" + local left_items="$TMP_DIR/left_items" + local deleted_items="$TMP_DIR/deleted_items" + + # 2.1 优先以最左边最新版 (raw_0) 的内容作为上半部分基准 + cat "${raw_files[0]}" > "$left_items" + + # 2.2 把其他所有老版本里有、但新版里没有的遗留/废弃项收集起来 + > "$deleted_items" + for (( i=1; i> "$deleted_items" + done + + # 2.3 对废弃项进行去重和排序,确保表格下半部分也整齐美观 + local cleaned_deleted="$TMP_DIR/cleaned_deleted" + sort -u "$deleted_items" | while IFS= read -r old_item; do + if ! grep -Fqx "$old_item" "$left_items"; then + echo "$old_item" + fi + done | sort > "$cleaned_deleted" + + # 2.4 合体:上半部分是新版有序列表,下半部分是旧版废弃有序列表 + cat "$left_items" "$cleaned_deleted" > "$master_list" + + # 3. 打印 Markdown 表格头部 + echo "## $title_name" + echo "" + + local header_line="|" + local divider_line="|" + for h in "${headers[@]}"; do + header_line="$header_line $h |" + divider_line="$divider_line --- |" + done + echo "$header_line" + echo "$divider_line" + + # 4. 遍历全局基准大列表,进行多版本精准查岗并输出 + while IFS= read -r feature_name || [[ -n "$feature_name" ]]; do + # 确保不处理空白行 + [ -z "$feature_name" ] && continue + + local row_output="|" + # 检查每个版本中是否存在这个特征 + for i in "${!VERSIONS[@]}"; do + if grep -Fqx "$feature_name" "${raw_files[$i]}"; then + row_output="$row_output $feature_name |" + else + row_output="$row_output |" + fi + done + echo "$row_output" + done < "$master_list" + + echo "" +} + +# ========================================== +# 各功能模块的独立路由函数 +# ========================================== +show_protocols() { process_feature "--list-protocols" "Protocols"; } +show_encoders() { process_feature "--list-encoders" "Encoders"; } +show_decoders() { process_feature "--list-decoders" "Decoders"; } +show_demuxers() { process_feature "--list-demuxers" "Demuxers"; } +show_muxers() { process_feature "--list-muxers" "Muxers"; } +show_filters() { process_feature "--list-filters" "Filters"; } +show_bsfs() { process_feature "--list-bsfs" "Bitstream Filters"; } +show_hwaccels() { process_feature "--list-hwaccels" "Hardware Accelerators"; } +show_indevs() { process_feature "--list-indevs" "Input Devices"; } +show_outdevs() { process_feature "--list-outdevs" "Output Devices"; } +show_parsers() { process_feature "--list-parsers" "Parsers"; } + +show_usage() { + echo "Usage: $0 [feature]" + echo "Available features:" + echo " protocols, encoders, decoders, demuxers, muxers, filters," + echo " bsfs, hwaccels, indevs, outdevs, parsers, all" +} + +# ========================================== +# Main 主控入口 +# ========================================== +main() { + local action="${1:-all}" + case "$action" in + protocols) show_protocols ;; + encoders) show_encoders ;; + decoders) show_decoders ;; + demuxers) show_demuxers ;; + muxers) show_muxers ;; + filters) show_filters ;; + bsfs) show_bsfs ;; + hwaccels) show_hwaccels ;; + indevs) show_indevs ;; + outdevs) show_outdevs ;; + parsers) show_parsers ;; + all) + echo "# FFmpeg Evolution Comparison" + show_protocols; show_encoders; show_decoders; show_demuxers + show_muxers; show_filters; show_bsfs; show_hwaccels + show_indevs; show_outdevs; show_parsers + ;; + -h|--help) show_usage; exit 0 ;; + *) echo "Error: Unknown feature '$action'" >&2; show_usage; exit 1 ;; + esac +} + +main "$@" \ No newline at end of file diff --git a/tools/publish-feature-doc.sh b/tools/publish-feature-doc.sh new file mode 100755 index 000000000..ee2cbf386 --- /dev/null +++ b/tools/publish-feature-doc.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +# 确保脚本遇到错误时立即停止 +set -e + +echo "=== 1. 初始化并编译/配置各个 FFmpeg 版本 ===" +./main.sh init -p macos -l 'ffmpeg4,ffmpeg5,ffmpeg6,ffmpeg7,ffmpeg8' -a arm64 --skip-pull-base + +echo "=== 2. 创建发布目录 ===" +# GitHub Pages 默认支持根目录或 docs 目录,这里我们统一生成到 docs/ +OUTPUT_DIR="docs" +mkdir -p "$OUTPUT_DIR" + +echo "=== 3. 生成带 Front Matter 的 index.md ===" +# 写入 GitHub Pages / Jekyll 所需的元数据头部 +cat << 'EOF' > "$OUTPUT_DIR/index.md" +--- +layout: default +title: FFmpeg Evolution Matrix (macOS arm64) +description: A comprehensive feature comparison matrix between FFmpeg 4.x, 5.x, 6.x, 7.x, and 8.x. +permalink: / +--- + +# FFmpeg Feature Evolution Matrix (macOS arm64) + +> [!NOTE] +> This page is automatically generated. It compares the availability of protocols, codecs, filters, and other features across different FFmpeg versions. +> **Columns from left to right:** Newest (8.1.2) to Oldest (4.0.5). Blanks on the right indicate newly added features in that version. + +EOF + +# 追加原有的矩阵表格生成脚本的输出 +./tools/list-all-feature.sh >> "$OUTPUT_DIR/index.md" + +echo "=== 4. 生成附加说明文件 ===" +# 顺手生成一个简易的本地预览配置文件(防止 Jekyll 忽略下划线文件) +echo "include: [_pages, _columns]" > "$OUTPUT_DIR/_config.yml" + +echo "🎉 完善成功!内容已生成至 ./$OUTPUT_DIR/index.md" \ No newline at end of file From c46640fa0c17e19b0a4bff98c3527178cf848c9d Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Thu, 25 Jun 2026 15:34:02 +0800 Subject: [PATCH 352/359] exploring the `enablement` parameter for this action --- .github/workflows/compare ffmpeg features.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/compare ffmpeg features.yaml b/.github/workflows/compare ffmpeg features.yaml index df1b443a4..f4fca504b 100644 --- a/.github/workflows/compare ffmpeg features.yaml +++ b/.github/workflows/compare ffmpeg features.yaml @@ -26,10 +26,10 @@ jobs: steps: - name: Checkout Repository uses: actions/checkout@v4 - - name: Setup Pages - uses: actions/configure-pages@v4 - + uses: actions/configure-pages@v5 + with: + enablement: true - name: Run Toolchain and Generate Matrix run: | chmod +x ./tools/publish-feature-doc.sh From d1eaea571ad5e11c6a5aa16ec4d83035a87c15d2 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Thu, 25 Jun 2026 15:36:55 +0800 Subject: [PATCH 353/359] fix wrong separator --- tools/publish-feature-doc.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/publish-feature-doc.sh b/tools/publish-feature-doc.sh index ee2cbf386..2216d490f 100755 --- a/tools/publish-feature-doc.sh +++ b/tools/publish-feature-doc.sh @@ -4,7 +4,7 @@ set -e echo "=== 1. 初始化并编译/配置各个 FFmpeg 版本 ===" -./main.sh init -p macos -l 'ffmpeg4,ffmpeg5,ffmpeg6,ffmpeg7,ffmpeg8' -a arm64 --skip-pull-base +./main.sh init -p macos -l 'ffmpeg4 ffmpeg5 ffmpeg6 ffmpeg7 ffmpeg8' -a arm64 --skip-pull-base echo "=== 2. 创建发布目录 ===" # GitHub Pages 默认支持根目录或 docs 目录,这里我们统一生成到 docs/ From e96c4d281de601501713fd9e39eafb247b0e057c Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Thu, 25 Jun 2026 15:38:59 +0800 Subject: [PATCH 354/359] rm '--skip-pull-base' --- tools/publish-feature-doc.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/publish-feature-doc.sh b/tools/publish-feature-doc.sh index 2216d490f..7056e390a 100755 --- a/tools/publish-feature-doc.sh +++ b/tools/publish-feature-doc.sh @@ -4,7 +4,7 @@ set -e echo "=== 1. 初始化并编译/配置各个 FFmpeg 版本 ===" -./main.sh init -p macos -l 'ffmpeg4 ffmpeg5 ffmpeg6 ffmpeg7 ffmpeg8' -a arm64 --skip-pull-base +./main.sh init -p macos -l 'ffmpeg4 ffmpeg5 ffmpeg6 ffmpeg7 ffmpeg8' -a arm64 echo "=== 2. 创建发布目录 ===" # GitHub Pages 默认支持根目录或 docs 目录,这里我们统一生成到 docs/ From eccbcd05368c0e472018346d3d079628b8e2a990 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Thu, 25 Jun 2026 15:48:04 +0800 Subject: [PATCH 355/359] fix Page not found --- tools/publish-feature-doc.sh | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/tools/publish-feature-doc.sh b/tools/publish-feature-doc.sh index 7056e390a..99ab47c97 100755 --- a/tools/publish-feature-doc.sh +++ b/tools/publish-feature-doc.sh @@ -7,20 +7,20 @@ echo "=== 1. 初始化并编译/配置各个 FFmpeg 版本 ===" ./main.sh init -p macos -l 'ffmpeg4 ffmpeg5 ffmpeg6 ffmpeg7 ffmpeg8' -a arm64 echo "=== 2. 创建发布目录 ===" -# GitHub Pages 默认支持根目录或 docs 目录,这里我们统一生成到 docs/ OUTPUT_DIR="docs" mkdir -p "$OUTPUT_DIR" -echo "=== 3. 生成带 Front Matter 的 index.md ===" -# 写入 GitHub Pages / Jekyll 所需的元数据头部 -cat << 'EOF' > "$OUTPUT_DIR/index.md" ---- -layout: default -title: FFmpeg Evolution Matrix (macOS arm64) -description: A comprehensive feature comparison matrix between FFmpeg 4.x, 5.x, 6.x, 7.x, and 8.x. -permalink: / ---- +echo "=== 3. 解决自定义域名与路由冲突 (关键修复) ===" +# 1. 彻底禁用 Jekyll 编译,防止它乱动 permalink 路由 +touch "$OUTPUT_DIR/.nojekyll" + +# 2. 【核心】如果你的当前仓库在 Settings 绑定了自定义域名,请把下面这行的注释解开,并换成你的域名: +# echo "debugly.github.io" > "$OUTPUT_DIR/CNAME" + +echo "=== 4. 生成 index.md (去掉了干扰路由的 Front Matter) ===" +# 回归最纯粹的 Markdown 头部,靠 GitHub 原生渲染,不再加任何 permalink +cat << 'EOF' > "$OUTPUT_DIR/index.md" # FFmpeg Feature Evolution Matrix (macOS arm64) > [!NOTE] @@ -32,8 +32,4 @@ EOF # 追加原有的矩阵表格生成脚本的输出 ./tools/list-all-feature.sh >> "$OUTPUT_DIR/index.md" -echo "=== 4. 生成附加说明文件 ===" -# 顺手生成一个简易的本地预览配置文件(防止 Jekyll 忽略下划线文件) -echo "include: [_pages, _columns]" > "$OUTPUT_DIR/_config.yml" - -echo "🎉 完善成功!内容已生成至 ./$OUTPUT_DIR/index.md" \ No newline at end of file +echo "🎉 针对自定义域名优化成功!内容已生成至 ./$OUTPUT_DIR/index.md" \ No newline at end of file From 255af76a57bd7d39874a7b12c12751b681c58706 Mon Sep 17 00:00:00 2001 From: Anka Date: Thu, 25 Jun 2026 07:53:32 +0000 Subject: [PATCH 356/359] upgrade ffmpeg8 to ffmpeg8-8.1.2-260625152857 for apple by cd --- configs/libs/ffmpeg8.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configs/libs/ffmpeg8.sh b/configs/libs/ffmpeg8.sh index b33d843ae..953fd6d71 100644 --- a/configs/libs/ffmpeg8.sh +++ b/configs/libs/ffmpeg8.sh @@ -36,6 +36,6 @@ fi # pre compiled -export PRE_COMPILE_TAG_IOS=ffmpeg8-8.1.1-260515202139 -export PRE_COMPILE_TAG_MACOS=ffmpeg8-8.1.1-260515202139 -export PRE_COMPILE_TAG_TVOS=ffmpeg8-8.1.1-260515202139 +export PRE_COMPILE_TAG_IOS=ffmpeg8-8.1.2-260625152857 +export PRE_COMPILE_TAG_MACOS=ffmpeg8-8.1.2-260625152857 +export PRE_COMPILE_TAG_TVOS=ffmpeg8-8.1.2-260625152857 From 77ac2e6dc2d53995dd5460f3a96f9e60075e4769 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Thu, 25 Jun 2026 18:17:11 +0800 Subject: [PATCH 357/359] try fix "There isn't a GitHub Pages site here" --- .../workflows/compare ffmpeg features.yaml | 8 ++- tools/publish-feature-html.sh | 72 +++++++++++++++++++ 2 files changed, 78 insertions(+), 2 deletions(-) create mode 100644 tools/publish-feature-html.sh diff --git a/.github/workflows/compare ffmpeg features.yaml b/.github/workflows/compare ffmpeg features.yaml index f4fca504b..bd12e485c 100644 --- a/.github/workflows/compare ffmpeg features.yaml +++ b/.github/workflows/compare ffmpeg features.yaml @@ -30,11 +30,15 @@ jobs: uses: actions/configure-pages@v5 with: enablement: true + # custom domain cause 404 There isn't a GitHub Pages site here. + - name: Install Markdown Parser + run: pip3 install markdown + - name: Run Toolchain and Generate Matrix run: | - chmod +x ./tools/publish-feature-doc.sh + chmod +x ./tools/publish-feature-html.sh chmod +x ./tools/list-all-feature.sh - ./tools/publish-feature-doc.sh + ./tools/publish-feature-html.sh - name: Upload Artifact uses: actions/upload-pages-artifact@v3 diff --git a/tools/publish-feature-html.sh b/tools/publish-feature-html.sh new file mode 100644 index 000000000..5d2756ca9 --- /dev/null +++ b/tools/publish-feature-html.sh @@ -0,0 +1,72 @@ +#!/bin/bash +set -e + +echo "=== 1. 初始化并配置各个 FFmpeg 版本 ===" +./main.sh init -p macos -l 'ffmpeg4 ffmpeg5 ffmpeg6 ffmpeg7 ffmpeg8' -a arm64 + +echo "=== 2. 创建发布目录 ===" +OUTPUT_DIR="docs" +mkdir -p "$OUTPUT_DIR" + +# 强制禁用 Jekyll,全面拥抱纯静态 +touch "$OUTPUT_DIR/.nojekyll" + +echo "=== 3. 生成临时 Markdown 矩阵 ===" +TMP_MD="$OUTPUT_DIR/raw_matrix.md" + +cat << 'EOF' > "$TMP_MD" +# FFmpeg Feature Evolution Matrix (macOS arm64) + +> **Columns from left to right:** Newest (8.1.2) to Oldest (4.0.5). Blanks on the right indicate newly added features in that version. + +EOF + +# 追加原有的矩阵表格生成脚本的输出 +./tools/list-all-feature.sh >> "$TMP_MD" + + +echo "=== 4. 【核心修复】将 Markdown 转换为原生的 index.html ===" +# 使用 python3 将 Markdown 渲染为标准 HTML,并套上一个精美的、支持 Markdown 表格的 CSS 主题 +python3 -c " +import markdown +with open('$TMP_MD', 'r', encoding='utf-8') as f: + html_content = markdown.markdown(f.read(), extensions=['tables']) + +full_html = f''' + + + + FFmpeg Evolution Matrix + + + + +
+ {html_content} +
+ +''' + +with open('$OUTPUT_DIR/index.html', 'w', encoding='utf-8') as f: + f.write(full_html) +" + +# 打扫战场,删掉临时的 md 文件 +rm -f "$TMP_MD" + +echo "🎉 终极优化成功!标准网页已生成至 ./$OUTPUT_DIR/index.html" \ No newline at end of file From 23c04bf3b832e85a1aeff2fbf09d54af111a36b9 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Thu, 25 Jun 2026 18:42:59 +0800 Subject: [PATCH 358/359] fix PEP 668 --- .github/workflows/compare ffmpeg features.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/compare ffmpeg features.yaml b/.github/workflows/compare ffmpeg features.yaml index bd12e485c..c557ee831 100644 --- a/.github/workflows/compare ffmpeg features.yaml +++ b/.github/workflows/compare ffmpeg features.yaml @@ -32,7 +32,7 @@ jobs: enablement: true # custom domain cause 404 There isn't a GitHub Pages site here. - name: Install Markdown Parser - run: pip3 install markdown + run: pip3 install markdown --break-system-packages - name: Run Toolchain and Generate Matrix run: | From b025a653adad0230cbcc84d8e8c942e6db8bd32c Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Thu, 25 Jun 2026 18:53:49 +0800 Subject: [PATCH 359/359] use GitHub-2025.css --- tools/GitHub-2025.css | 1372 +++++++++++++++++++++++++++++++++ tools/publish-feature-html.sh | 78 +- 2 files changed, 1413 insertions(+), 37 deletions(-) create mode 100644 tools/GitHub-2025.css diff --git a/tools/GitHub-2025.css b/tools/GitHub-2025.css new file mode 100644 index 000000000..ca470a6d5 --- /dev/null +++ b/tools/GitHub-2025.css @@ -0,0 +1,1372 @@ +/* github-markdown-css --light=light */ +body { + color-scheme: light; + /* Ideal for movement that starts on the page and ends off the page. */ + /* Ideal for movement that starts and ends on the page. */ + /* Ideal for movement that starts off the page and ends on the page. */ + /* Ideal for non-movement properties, like opacity or background color. */ + -ms-text-size-adjust: 100%; + -webkit-text-size-adjust: 100%; + margin: 0; + color: #1f2328; + background-color: #ffffff; + font-family: -apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji"; + font-size: 16px; + line-height: 1.5; + word-wrap: break-word; + padding: 30px; +} + +body .octicon { + display: inline-block; + fill: currentColor; + vertical-align: text-bottom; +} + +body h1:hover .anchor .octicon-link:before, +body h2:hover .anchor .octicon-link:before, +body h3:hover .anchor .octicon-link:before, +body h4:hover .anchor .octicon-link:before, +body h5:hover .anchor .octicon-link:before, +body h6:hover .anchor .octicon-link:before { + width: 16px; + height: 16px; + content: ' '; + display: inline-block; + background-color: currentColor; + -webkit-mask-image: url("data:image/svg+xml,"); + mask-image: url("data:image/svg+xml,"); +} + +body details, +body figcaption, +body figure { + display: block; +} + +body summary { + display: list-item; +} + +body [hidden] { + display: none !important; +} + +body a { + background-color: transparent; + color: #0969da; + text-decoration: none; +} + +body abbr[title] { + border-bottom: none; + -webkit-text-decoration: underline dotted; + text-decoration: underline dotted; +} + +body b, +body strong { + font-weight: 600; +} + +body dfn { + font-style: italic; +} + +body h1 { + margin: .67em 0; + font-weight: 600; + padding-bottom: .3em; + font-size: 2em; + border-bottom: 1px solid #d1d9e0b3; +} + +body mark { + background-color: #fff8c5; + color: #1f2328; +} + +body small { + font-size: 90%; +} + +body sub, +body sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; +} + +body sub { + bottom: -0.25em; +} + +body sup { + top: -0.5em; +} + +body img { + border-style: none; + max-width: 100%; + box-sizing: content-box; +} + +body code, +body kbd, +body pre, +body samp { + font-family: monospace; + font-size: 1em; +} + +body figure { + margin: 1em 2.5rem; +} + +body hr { + box-sizing: content-box; + overflow: hidden; + background: transparent; + border-bottom: 1px solid #d1d9e0b3; + height: .25em; + padding: 0; + margin: 1.5rem 0; + background-color: #d1d9e0; + border: 0; +} + +body input { + font: inherit; + margin: 0; + overflow: visible; + font-family: inherit; + font-size: inherit; + line-height: inherit; +} + +body [type=button], +body [type=reset], +body [type=submit] { + -webkit-appearance: button; + appearance: button; +} + +body [type=checkbox], +body [type=radio] { + box-sizing: border-box; + padding: 0; +} + +body [type=number]::-webkit-inner-spin-button, +body [type=number]::-webkit-outer-spin-button { + height: auto; +} + +body [type=search]::-webkit-search-cancel-button, +body [type=search]::-webkit-search-decoration { + -webkit-appearance: none; + appearance: none; +} + +body ::-webkit-input-placeholder { + color: inherit; + opacity: .54; +} + +body ::-webkit-file-upload-button { + -webkit-appearance: button; + appearance: button; + font: inherit; +} + +body a:hover { + text-decoration: underline; +} + +body ::placeholder { + color: #59636e; + opacity: 1; +} + +body hr::before { + display: table; + content: ""; +} + +body hr::after { + display: table; + clear: both; + content: ""; +} + +body table { + border-spacing: 0; + border-collapse: collapse; + display: block; + width: max-content; + max-width: 100%; + overflow: auto; + font-variant: tabular-nums; +} + +body td, +body th { + padding: 0; +} + +body details summary { + cursor: pointer; +} + +body a:focus, +body [role=button]:focus, +body input[type=radio]:focus, +body input[type=checkbox]:focus { + outline: 2px solid var(--borderColor-accent-emphasis); + outline-offset: -2px; + box-shadow: none; +} + +body a:focus:not(:focus-visible), +body [role=button]:focus:not(:focus-visible), +body input[type=radio]:focus:not(:focus-visible), +body input[type=checkbox]:focus:not(:focus-visible) { + outline: solid 1px transparent; +} + +body a:focus-visible, +body [role=button]:focus-visible, +body input[type=radio]:focus-visible, +body input[type=checkbox]:focus-visible { + outline: 2px solid var(--borderColor-accent-emphasis); + outline-offset: -2px; + box-shadow: none; +} + +body a:not([class]):focus, +body a:not([class]):focus-visible, +body input[type=radio]:focus, +body input[type=radio]:focus-visible, +body input[type=checkbox]:focus, +body input[type=checkbox]:focus-visible { + outline-offset: 0; +} + +body kbd { + display: inline-block; + padding: 0.25rem; + font: 11px ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace; + line-height: 10px; + color: #1f2328; + vertical-align: middle; + background-color: #f6f8fa; + border: solid 1px var(--borderColor-muted); + border-bottom-color: var(--borderColor-muted); + border-radius: 6px; + box-shadow: inset 0 -1px 0 var(--borderColor-muted); +} + +body h1, +body h2, +body h3, +body h4, +body h5, +body h6 { + margin-top: 1.5rem; + margin-bottom: 1rem; + font-weight: 600; + line-height: 1.25; +} + +body h2 { + font-weight: 600; + padding-bottom: .3em; + font-size: 1.5em; + border-bottom: 1px solid #d1d9e0b3; +} + +body h3 { + font-weight: 600; + font-size: 1.25em; +} + +body h4 { + font-weight: 600; + font-size: 1em; +} + +body h5 { + font-weight: 600; + font-size: .875em; +} + +body h6 { + font-weight: 600; + font-size: .85em; + color: #59636e; +} + +body p { + margin-top: 0; + margin-bottom: 10px; +} + +body blockquote { + margin: 0; + padding: 0 1em; + color: #59636e; + border-left: .25em solid #d1d9e0; +} + +body ul, +body ol { + margin-top: 0; + margin-bottom: 0; + padding-left: 2em; +} + +body ol ol, +body ul ol { + list-style-type: lower-roman; +} + +body ul ul ol, +body ul ol ol, +body ol ul ol, +body ol ol ol { + list-style-type: lower-alpha; +} + +body dd { + margin-left: 0; +} + +body tt, +body code, +body samp { + font-family: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace; + font-size: 12px; +} + +body pre { + margin-top: 0; + margin-bottom: 0; + font-family: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace; + font-size: 12px; + word-wrap: normal; +} + +body .octicon { + display: inline-block; + overflow: visible !important; + vertical-align: text-bottom; + fill: currentColor; +} + +body .Box-body.scrollable-overlay { + max-height: 400px; + overflow-y: scroll; +} + +body .Box-body .help { + padding-top: 0.5rem; + margin: 0; + color: #59636e; + text-align: center; +} + +body input::-webkit-outer-spin-button, +body input::-webkit-inner-spin-button { + margin: 0; + appearance: none; +} + +body .border-0 { + border: 0 !important; +} + +body .color-fg-muted { + color: #59636e !important; +} + +body .color-bg-default { + background-color: #ffffff !important; +} + +body .mb-0 { + margin-bottom: 0 !important; +} + +body .mr-2 { + margin-right: 0.5rem !important; +} + +body .my-2 { + margin-top: 0.5rem !important; + margin-bottom: 0.5rem !important; +} + +body .p-0 { + padding: 0 !important; +} + +body .py-0 { + padding-top: 0 !important; + padding-bottom: 0 !important; +} + +body .px-3 { + padding-right: 1rem !important; + padding-left: 1rem !important; +} + +body .f6 { + font-size: 0.75rem !important; +} + +body .text-bold { + font-weight: 600 !important; +} + +body .sr-only { + position: absolute; + width: 1px; + height: 1px; + padding: 0; + overflow: hidden; + clip-path: rect(0 0 0 0); + overflow-wrap: normal; + border: 0; +} + +body::before { + display: table; + content: ""; +} + +body::after { + display: table; + clear: both; + content: ""; +} + +body>*:first-child { + margin-top: 0 !important; +} + +body>*:last-child { + margin-bottom: 0 !important; +} + +body a:not([href]) { + color: inherit; + text-decoration: none; +} + +body .absent { + color: #d1242f; +} + +body .anchor { + float: left; + padding-right: 0.25rem; + margin-left: -20px; + line-height: 1; +} + +body .anchor:focus { + outline: none; +} + +body p, +body blockquote, +body ul, +body ol, +body dl, +body table, +body pre, +body details { + margin-top: 0; + margin-bottom: 1rem; +} + +body blockquote>:first-child { + margin-top: 0; +} + +body blockquote>:last-child { + margin-bottom: 0; +} + +body h1 .octicon-link, +body h2 .octicon-link, +body h3 .octicon-link, +body h4 .octicon-link, +body h5 .octicon-link, +body h6 .octicon-link { + color: #1f2328; + vertical-align: middle; + visibility: hidden; +} + +body h1:hover .anchor, +body h2:hover .anchor, +body h3:hover .anchor, +body h4:hover .anchor, +body h5:hover .anchor, +body h6:hover .anchor { + text-decoration: none; +} + +body h1:hover .anchor .octicon-link, +body h2:hover .anchor .octicon-link, +body h3:hover .anchor .octicon-link, +body h4:hover .anchor .octicon-link, +body h5:hover .anchor .octicon-link, +body h6:hover .anchor .octicon-link { + visibility: visible; +} + +body h1 tt, +body h1 code, +body h2 tt, +body h2 code, +body h3 tt, +body h3 code, +body h4 tt, +body h4 code, +body h5 tt, +body h5 code, +body h6 tt, +body h6 code { + padding: 0 .2em; + font-size: inherit; +} + +body summary h1, +body summary h2, +body summary h3, +body summary h4, +body summary h5, +body summary h6 { + display: inline-block; +} + +body summary h1 .anchor, +body summary h2 .anchor, +body summary h3 .anchor, +body summary h4 .anchor, +body summary h5 .anchor, +body summary h6 .anchor { + margin-left: -40px; +} + +body summary h1, +body summary h2 { + padding-bottom: 0; + border-bottom: 0; +} + +body ul.no-list, +body ol.no-list { + padding: 0; + list-style-type: none; +} + +body ol[type="a s"] { + list-style-type: lower-alpha; +} + +body ol[type="A s"] { + list-style-type: upper-alpha; +} + +body ol[type="i s"] { + list-style-type: lower-roman; +} + +body ol[type="I s"] { + list-style-type: upper-roman; +} + +body ol[type="1"] { + list-style-type: decimal; +} + +body div>ol:not([type]) { + list-style-type: decimal; +} + +body ul ul, +body ul ol, +body ol ol, +body ol ul { + margin-top: 0; + margin-bottom: 0; +} + +body li>p { + margin-top: 1rem; +} + +body li+li { + margin-top: .25em; +} + +body dl { + padding: 0; +} + +body dl dt { + padding: 0; + margin-top: 1rem; + font-size: 1em; + font-style: italic; + font-weight: 600; +} + +body dl dd { + padding: 0 1rem; + margin-bottom: 1rem; +} + +body table th { + font-weight: 600; +} + +body table th, +body table td { + padding: 6px 13px; + border: 1px solid #d1d9e0; +} + +body table td>:last-child { + margin-bottom: 0; +} + +body table tr { + background-color: #ffffff; + border-top: 1px solid #d1d9e0b3; +} + +body table tr:nth-child(2n) { + background-color: #f6f8fa; +} + +body table img { + background-color: transparent; +} + +body img[align=right] { + padding-left: 20px; +} + +body img[align=left] { + padding-right: 20px; +} + +body .emoji { + max-width: none; + vertical-align: text-top; + background-color: transparent; +} + +body span.frame { + display: block; + overflow: hidden; +} + +body span.frame>span { + display: block; + float: left; + width: auto; + padding: 7px; + margin: 13px 0 0; + overflow: hidden; + border: 1px solid #d1d9e0; +} + +body span.frame span img { + display: block; + float: left; +} + +body span.frame span span { + display: block; + padding: 5px 0 0; + clear: both; + color: #1f2328; +} + +body span.align-center { + display: block; + overflow: hidden; + clear: both; +} + +body span.align-center>span { + display: block; + margin: 13px auto 0; + overflow: hidden; + text-align: center; +} + +body span.align-center span img { + margin: 0 auto; + text-align: center; +} + +body span.align-right { + display: block; + overflow: hidden; + clear: both; +} + +body span.align-right>span { + display: block; + margin: 13px 0 0; + overflow: hidden; + text-align: right; +} + +body span.align-right span img { + margin: 0; + text-align: right; +} + +body span.float-left { + display: block; + float: left; + margin-right: 13px; + overflow: hidden; +} + +body span.float-left span { + margin: 13px 0 0; +} + +body span.float-right { + display: block; + float: right; + margin-left: 13px; + overflow: hidden; +} + +body span.float-right>span { + display: block; + margin: 13px auto 0; + overflow: hidden; + text-align: right; +} + +body code, +body tt { + padding: .2em .4em; + margin: 0; + font-size: 85%; + white-space: break-spaces; + background-color: #818b981f; + border-radius: 6px; +} + +body code br, +body tt br { + display: none; +} + +body del code { + text-decoration: inherit; +} + +body samp { + font-size: 85%; +} + +body pre code { + font-size: 100%; +} + +body pre>code { + padding: 0; + margin: 0; + word-break: normal; + white-space: pre; + background: transparent; + border: 0; +} + +body .highlight { + margin-bottom: 1rem; +} + +body .highlight pre { + margin-bottom: 0; + word-break: normal; +} + +body .highlight pre, +body pre { + padding: 1rem; + overflow: auto; + font-size: 85%; + line-height: 1.45; + color: #1f2328; + background-color: #f6f8fa; + border-radius: 6px; +} + +body pre code, +body pre tt { + display: inline; + max-width: auto; + padding: 0; + margin: 0; + overflow: visible; + line-height: inherit; + word-wrap: normal; + background-color: transparent; + border: 0; +} + +body .csv-data td, +body .csv-data th { + padding: 5px; + overflow: hidden; + font-size: 12px; + line-height: 1; + text-align: left; + white-space: nowrap; +} + +body .csv-data .blob-num { + padding: 10px 0.5rem 9px; + text-align: right; + background: #ffffff; + border: 0; +} + +body .csv-data tr { + border-top: 0; +} + +body .csv-data th { + font-weight: 600; + background: #f6f8fa; + border-top: 0; +} + +body [data-footnote-ref]::before { + content: "["; +} + +body [data-footnote-ref]::after { + content: "]"; +} + +body .footnotes { + font-size: 12px; + color: #59636e; + border-top: 1px solid #d1d9e0; +} + +body .footnotes ol { + padding-left: 1rem; +} + +body .footnotes ol ul { + display: inline-block; + padding-left: 1rem; + margin-top: 1rem; +} + +body .footnotes li { + position: relative; +} + +body .footnotes li:target::before { + position: absolute; + top: calc(0.5rem*-1); + right: calc(0.5rem*-1); + bottom: calc(0.5rem*-1); + left: calc(1.5rem*-1); + pointer-events: none; + content: ""; + border: 2px solid #0969da; + border-radius: 6px; +} + +body .footnotes li:target { + color: #1f2328; +} + +body .footnotes .data-footnote-backref g-emoji { + font-family: monospace; +} + +body .Box { + background-color: #ffffff; + border-color: #d1d9e0; + border-radius: 0.375rem; + border-style: solid; + border-width: 0.0625rem; +} + +body .Box--condensed { + line-height: 1.25; +} + +body .Box--condensed .Box-body, +body .Box--condensed .Box-footer, +body .Box--condensed .Box-header { + padding: 0.5rem 1rem; +} + +body .Box--condensed .Box-row { + padding: 0.5rem 1rem; +} + +body .Box-header { + background-color: #f6f8fa; + border-color: #d1d9e0; + border-style: solid; + border-top-left-radius: 0.375rem; + border-top-right-radius: 0.375rem; + border-width: 0.0625rem; + margin: calc(0.0625rem*-1) calc(0.0625rem*-1) 0; + padding: 1rem; +} + +body .Box-body { + border-bottom: 0.0625rem solid #d1d9e0; + padding: 1rem; +} + +body .Box-body:last-of-type { + border-bottom-left-radius: 0.375rem; + border-bottom-right-radius: 0.375rem; + margin-bottom: calc(0.0625rem*-1); +} + +body .pl-c { + color: #59636e; +} + +body .pl-c1, +body .pl-s .pl-v { + color: #0550ae; +} + +body .pl-e, +body .pl-en { + color: #6639ba; +} + +body .pl-smi, +body .pl-s .pl-s1 { + color: #1f2328; +} + +body .pl-ent { + color: #0550ae; +} + +body .pl-k { + color: #cf222e; +} + +body .pl-s, +body .pl-pds, +body .pl-s .pl-pse .pl-s1, +body .pl-sr, +body .pl-sr .pl-cce, +body .pl-sr .pl-sre, +body .pl-sr .pl-sra { + color: #0a3069; +} + +body .pl-v, +body .pl-smw { + color: #953800; +} + +body .pl-bu { + color: #82071e; +} + +body .pl-ii { + color: #f6f8fa; + background-color: #82071e; +} + +body .pl-c2 { + color: #f6f8fa; + background-color: #cf222e; +} + +body .pl-sr .pl-cce { + font-weight: bold; + color: #116329; +} + +body .pl-ml { + color: #3b2300; +} + +body .pl-mh, +body .pl-mh .pl-en, +body .pl-ms { + font-weight: bold; + color: #0550ae; +} + +body .pl-mi { + font-style: italic; + color: #1f2328; +} + +body .pl-mb { + font-weight: bold; + color: #1f2328; +} + +body .pl-md { + color: #82071e; + background-color: #ffebe9; +} + +body .pl-mi1 { + color: #116329; + background-color: #dafbe1; +} + +body .pl-mc { + color: #953800; + background-color: #ffd8b5; +} + +body .pl-mi2 { + color: #d1d9e0; + background-color: #0550ae; +} + +body .pl-mdr { + font-weight: bold; + color: #8250df; +} + +body .pl-ba { + color: #59636e; +} + +body .pl-sg { + color: #818b98; +} + +body .pl-corl { + text-decoration: underline; + color: #0a3069; +} + +body [role=button]:focus:not(:focus-visible), +body [role=tabpanel][tabindex="0"]:focus:not(:focus-visible), +body button:focus:not(:focus-visible), +body summary:focus:not(:focus-visible), +body a:focus:not(:focus-visible) { + outline: none; + box-shadow: none; +} + +body [tabindex="0"]:focus:not(:focus-visible), +body details-dialog:focus:not(:focus-visible) { + outline: none; +} + +body g-emoji { + display: inline-block; + min-width: 1ch; + font-family: "Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"; + font-size: 1em; + font-style: normal !important; + font-weight: 400; + line-height: 1; + vertical-align: -0.075em; +} + +body g-emoji img { + width: 1em; + height: 1em; +} + +body .commit-tease-sha { + display: inline-block; + font-family: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace; + font-size: 90%; + color: #1f2328; +} + +body .blob-wrapper { + overflow-x: auto; + overflow-y: hidden; +} + +body .blob-wrapper table tr:nth-child(2n) { + background-color: transparent; +} + +body .blob-wrapper-embedded { + max-height: 240px; + overflow-y: auto; +} + +body .blob-num { + position: relative; + width: 1%; + min-width: 50px; + padding-right: 10px; + padding-left: 10px; + font-family: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace; + font-size: 12px; + line-height: 20px; + color: #59636e; + text-align: right; + white-space: nowrap; + vertical-align: top; + cursor: pointer; + -webkit-user-select: none; + user-select: none; +} + +body .blob-num:hover { + color: #1f2328; +} + +body .blob-num::before { + content: attr(data-line-number); +} + +body .blob-num.non-expandable { + cursor: default; +} + +body .blob-num.non-expandable:hover { + color: #59636e; +} + +body .blob-code { + position: relative; + padding-right: 10px; + padding-left: 10px; + line-height: 20px; + vertical-align: top; +} + +body .blob-code-inner { + display: table-cell; + overflow: visible; + font-family: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace; + font-size: 12px; + color: #1f2328; + word-wrap: anywhere; + white-space: pre; +} + +body .blob-code-inner .x-first { + border-top-left-radius: .2em; + border-bottom-left-radius: .2em; +} + +body .blob-code-inner .x-last { + border-top-right-radius: .2em; + border-bottom-right-radius: .2em; +} + +body .blob-code-inner.highlighted, +body .blob-code-inner .highlighted { + background-color: #fff8c5; + box-shadow: inset 2px 0 0 #d4a72c66; +} + +body .blob-code-inner::selection, +body .blob-code-inner *::selection { + background-color: #0969da33; +} + +body .blob-code-inner.blob-code-addition, +body .blob-code-inner.blob-code-deletion { + position: relative; + padding-left: 22px !important; +} + +body .task-list-item { + list-style-type: none; +} + +body .task-list-item label { + font-weight: 400; +} + +body .task-list-item.enabled label { + cursor: pointer; +} + +body .task-list-item+.task-list-item { + margin-top: 0.25rem; +} + +body .task-list-item .handle { + display: none; +} + +/* body .task-list-item-checkbox { */ +.task-list-item > input { + margin: 0 .2em .25em -1.4em; + vertical-align: middle; +} + +body ul:dir(rtl) .task-list-item-checkbox { + margin: 0 -1.6em .25em .2em; +} + +body ol:dir(rtl) .task-list-item-checkbox { + margin: 0 -1.6em .25em .2em; +} + +body .contains-task-list:hover .task-list-item-convert-container, +body .contains-task-list:focus-within .task-list-item-convert-container { + display: block; + width: auto; + height: 24px; + overflow: visible; + clip: auto; +} + +body ::-webkit-calendar-picker-indicator { + filter: invert(50%); +} + +body .markdown-alert { + padding: 0.5rem 1rem; + margin-bottom: 1rem; + color: inherit; + border-left: .25em solid #d1d9e0; +} + +body .markdown-alert>:first-child { + margin-top: 0; +} + +body .markdown-alert>:last-child { + margin-bottom: 0; +} + +body .markdown-alert .markdown-alert-title { + display: flex; + font-weight: 500; + align-items: center; + line-height: 1; +} + +body .markdown-alert.markdown-alert-note { + border-left-color: #0969da; +} + +body .markdown-alert.markdown-alert-note .markdown-alert-title { + color: #0969da; +} + +body .markdown-alert.markdown-alert-important { + border-left-color: #8250df; +} + +body .markdown-alert.markdown-alert-important .markdown-alert-title { + color: #8250df; +} + +body .markdown-alert.markdown-alert-warning { + border-left-color: #9a6700; +} + +body .markdown-alert.markdown-alert-warning .markdown-alert-title { + color: #9a6700; +} + +body .markdown-alert.markdown-alert-tip { + border-left-color: #1a7f37; +} + +body .markdown-alert.markdown-alert-tip .markdown-alert-title { + color: #1a7f37; +} + +body .markdown-alert.markdown-alert-caution { + border-left-color: #cf222e; +} + +body .markdown-alert.markdown-alert-caution .markdown-alert-title { + color: #d1242f; +} + +body>*:first-child>.heading-element:first-child { + margin-top: 0 !important; +} + +body .tab-size[data-tab-size="1"] { + tab-size: 1; +} + +body .tab-size[data-tab-size="2"] { + tab-size: 2; +} + +body .tab-size[data-tab-size="3"] { + tab-size: 3; +} + +body .tab-size[data-tab-size="4"] { + tab-size: 4; +} + +body .tab-size[data-tab-size="5"] { + tab-size: 5; +} + +body .tab-size[data-tab-size="6"] { + tab-size: 6; +} + +body .tab-size[data-tab-size="7"] { + tab-size: 7; +} + +body .tab-size[data-tab-size="8"] { + tab-size: 8; +} + +body .tab-size[data-tab-size="9"] { + tab-size: 9; +} + +body .tab-size[data-tab-size="10"] { + tab-size: 10; +} + +body .tab-size[data-tab-size="11"] { + tab-size: 11; +} + +body .tab-size[data-tab-size="12"] { + tab-size: 12; +} + +body .Box .section-focus .preview-section { + display: none; +} + +body .Box .section-focus .edit-section { + display: block; +} + +body .highlight pre:has(+.zeroclipboard-container) { + min-height: 52px; +} \ No newline at end of file diff --git a/tools/publish-feature-html.sh b/tools/publish-feature-html.sh index 5d2756ca9..79ebce2c2 100644 --- a/tools/publish-feature-html.sh +++ b/tools/publish-feature-html.sh @@ -7,66 +7,70 @@ echo "=== 1. 初始化并配置各个 FFmpeg 版本 ===" echo "=== 2. 创建发布目录 ===" OUTPUT_DIR="docs" mkdir -p "$OUTPUT_DIR" - -# 强制禁用 Jekyll,全面拥抱纯静态 touch "$OUTPUT_DIR/.nojekyll" -echo "=== 3. 生成临时 Markdown 矩阵 ===" -TMP_MD="$OUTPUT_DIR/raw_matrix.md" +echo "=== 3. 生成临时 Markdown 矩阵数据 ===" +TMP_MD_DATA=$(mktemp /tmp/ffmpeg_md.XXXXXX) -cat << 'EOF' > "$TMP_MD" +cat << 'EOF' > "$TMP_MD_DATA" # FFmpeg Feature Evolution Matrix (macOS arm64) +> [!NOTE] +> This page is automatically generated. It compares the availability of protocols, codecs, filters, and other features across different FFmpeg versions. > **Columns from left to right:** Newest (8.1.2) to Oldest (4.0.5). Blanks on the right indicate newly added features in that version. - EOF -# 追加原有的矩阵表格生成脚本的输出 -./tools/list-all-feature.sh >> "$TMP_MD" +# 追加原本的对齐矩阵 +./tools/list-all-feature.sh >> "$TMP_MD_DATA" +echo "=== 4. 完美融入 GitHub-2025.css 生成原生 index.html ===" +MD_CONTENT=$(cat "$TMP_MD_DATA") -echo "=== 4. 【核心修复】将 Markdown 转换为原生的 index.html ===" -# 使用 python3 将 Markdown 渲染为标准 HTML,并套上一个精美的、支持 Markdown 表格的 CSS 主题 -python3 -c " -import markdown -with open('$TMP_MD', 'r', encoding='utf-8') as f: - html_content = markdown.markdown(f.read(), extensions=['tables']) - -full_html = f''' +# 直接利用本地的 GitHub-2025.css 拼接出最终网页 +cat << EOF > "$OUTPUT_DIR/index.html" + - + FFmpeg Evolution Matrix - + - -
- {html_content} -
- -''' + + +
+
-with open('$OUTPUT_DIR/index.html', 'w', encoding='utf-8') as f: - f.write(full_html) -" + -# 打扫战场,删掉临时的 md 文件 -rm -f "$TMP_MD" + + + +EOF -echo "🎉 终极优化成功!标准网页已生成至 ./$OUTPUT_DIR/index.html" \ No newline at end of file +rm -f "$TMP_MD_DATA" +echo "🎉 融合 GitHub-2025.css 成功!完美的原生体验网页已生成至 ./$OUTPUT_DIR/index.html" \ No newline at end of file