From 47ea963da8cf87c3637a85cf0c8a84320d0d33a2 Mon Sep 17 00:00:00 2001 From: Kadir Date: Sat, 8 Aug 2026 00:53:21 +0300 Subject: [PATCH] [ffmpeg] Update to version 9.0 (#53207) Co-authored-by: Billy Robert O'Neal III Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- ports/ffmpeg-bin2c/portfile.cmake | 42 ++-- ports/ffmpeg-bin2c/vcpkg.json | 4 +- ports/ffmpeg/0002-fix-msvc-link.patch | 11 - ports/ffmpeg/0004-dependencies.patch | 12 +- ports/ffmpeg/0005-fix-nasm.patch | 20 +- ports/ffmpeg/0048-backport-23039.patch | 226 ------------------ ports/ffmpeg/0051-fix-msvc-undef-flags.patch | 12 + ...52-fix-disable-unstable-swscale-link.patch | 40 ++++ ports/ffmpeg/portfile.cmake | 25 +- ports/ffmpeg/vcpkg.json | 3 +- ports/opencv4/0028-ffmpeg9-support.patch | 52 ++++ ports/opencv4/portfile.cmake | 1 + ports/opencv4/vcpkg.json | 2 +- versions/baseline.json | 8 +- versions/f-/ffmpeg-bin2c.json | 5 + versions/f-/ffmpeg.json | 5 + versions/o-/opencv4.json | 5 + 17 files changed, 183 insertions(+), 290 deletions(-) delete mode 100644 ports/ffmpeg/0002-fix-msvc-link.patch delete mode 100644 ports/ffmpeg/0048-backport-23039.patch create mode 100644 ports/ffmpeg/0051-fix-msvc-undef-flags.patch create mode 100644 ports/ffmpeg/0052-fix-disable-unstable-swscale-link.patch create mode 100644 ports/opencv4/0028-ffmpeg9-support.patch diff --git a/ports/ffmpeg-bin2c/portfile.cmake b/ports/ffmpeg-bin2c/portfile.cmake index f4a8554fc2..e92d78a2d6 100644 --- a/ports/ffmpeg-bin2c/portfile.cmake +++ b/ports/ffmpeg-bin2c/portfile.cmake @@ -1,21 +1,21 @@ -set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled) -set(VCPKG_BUILD_TYPE release) # host tool for building ffmpeg - -vcpkg_from_github( - OUT_SOURCE_PATH SOURCE_PATH - REPO ffmpeg/ffmpeg - REF "n${VERSION}" - SHA512 e858e92e5eb08d562302cde371af55917df6e1fe53994e18462a3c929a40ede1828c2bd53c2a7d65a2cfd791782ead3cd94efb2def904f49cb5dd8ab5cd4256f - HEAD_REF master -) - -file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}/ffbuild") - -vcpkg_cmake_configure( - SOURCE_PATH "${SOURCE_PATH}/ffbuild" -) - -vcpkg_cmake_install() -vcpkg_copy_pdbs() - -vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING.LGPLv2.1") +set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled) +set(VCPKG_BUILD_TYPE release) # host tool for building ffmpeg + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO ffmpeg/ffmpeg + REF "n${VERSION}" + SHA512 4327d259b2ed9cc35a6139606643bf9c9db5fb0372a9eb259fed61af50505a2b59f0c3d94c51fec89d2e0cd552a413c5f50514683931c94c429824198d56ec56 + HEAD_REF master +) + +file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}/ffbuild") + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}/ffbuild" +) + +vcpkg_cmake_install() +vcpkg_copy_pdbs() + +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/ffbuild/bin2c.c") diff --git a/ports/ffmpeg-bin2c/vcpkg.json b/ports/ffmpeg-bin2c/vcpkg.json index 8eaef0d02c..a6ba6921ff 100644 --- a/ports/ffmpeg-bin2c/vcpkg.json +++ b/ports/ffmpeg-bin2c/vcpkg.json @@ -1,8 +1,8 @@ { "name": "ffmpeg-bin2c", - "version": "8.1.1", + "version": "9.0", "description": "Host tool bin2c for FFmpeg build", - "license": "LGPL-2.1-or-later", + "license": "MIT", "supports": "native", "dependencies": [ { diff --git a/ports/ffmpeg/0002-fix-msvc-link.patch b/ports/ffmpeg/0002-fix-msvc-link.patch deleted file mode 100644 index c9aa7e7523..0000000000 --- a/ports/ffmpeg/0002-fix-msvc-link.patch +++ /dev/null @@ -1,11 +0,0 @@ -diff --git a/configure b/configure ---- a/configure -+++ b/configure -@@ -6162,6 +6162,7 @@ EOF - test -n "$extern_prefix" && append X86ASMFLAGS "-DPREFIX" - case "$objformat" in - elf*) enabled debug && append X86ASMFLAGS $x86asm_debug ;; -+ win*) enabled debug && append X86ASMFLAGS "-g" ;; - esac - - enabled avx512 && check_x86asm avx512_external "vmovdqa32 [eax]{k1}{z}, zmm0" diff --git a/ports/ffmpeg/0004-dependencies.patch b/ports/ffmpeg/0004-dependencies.patch index de78a6351e..1033ec80c7 100644 --- a/ports/ffmpeg/0004-dependencies.patch +++ b/ports/ffmpeg/0004-dependencies.patch @@ -18,8 +18,8 @@ index 1759694..fcbae49 100644 enabled libmodplug && require_pkg_config libmodplug libmodplug libmodplug/modplug.h ModPlug_Load -enabled libmp3lame && require "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame $libm_extralibs -+enabled libmp3lame && { check_lib libmp3lame lame/lame.h lame_set_VBR_quality -lmp3lame $libm_extralibs || -+ require libmp3lame lame/lame.h lame_set_VBR_quality -llibmp3lame-static -llibmpghip-static $libm_extralibs; } ++enabled libmp3lame && { check_lib libmp3lame lame/lame.h lame_set_VBR_quality -lmp3lame $libm_extralibs || ++ require libmp3lame lame/lame.h lame_set_VBR_quality -llibmp3lame-static -llibmpghip-static $libm_extralibs; } enabled libmpeghdec && require_pkg_config libmpeghdec "mpeghdec >= 3.0.0" mpeghdec/mpeghdecoder.h mpeghdecoder_init enabled libmysofa && { check_pkg_config libmysofa libmysofa mysofa.h mysofa_neighborhood_init_withstepdefine || require libmysofa mysofa.h mysofa_neighborhood_init_withstepdefine -lmysofa $zlib_extralibs; } @@ -47,14 +47,12 @@ index 1759694..fcbae49 100644 enabled opencl && { check_pkg_config opencl OpenCL CL/cl.h clEnqueueNDRangeKernel || check_lib opencl OpenCL/cl.h clEnqueueNDRangeKernel "-framework OpenCL" || check_lib opencl CL/cl.h clEnqueueNDRangeKernel -lOpenCL || -+ check_lib opencl CL/cl.h clEnqueueNDRangeKernel -lOpenCL -lAdvapi32 -lOle32 -lCfgmgr32|| -+ check_lib opencl CL/cl.h clEnqueueNDRangeKernel -lOpenCL -pthread -ldl || ++ check_lib opencl CL/cl.h clEnqueueNDRangeKernel -lOpenCL -lAdvapi32 -lOle32 -lCfgmgr32|| ++ check_lib opencl CL/cl.h clEnqueueNDRangeKernel -lOpenCL -pthread -ldl || die "ERROR: opencl not found"; } && { test_cpp_condition "OpenCL/cl.h" "defined(CL_VERSION_1_2)" || test_cpp_condition "CL/cl.h" "defined(CL_VERSION_1_2)" || -@@ -7835,10 +7838,10 @@ enabled amf && - "(AMF_VERSION_MAJOR << 48 | AMF_VERSION_MINOR << 32 | AMF_VERSION_RELEASE << 16 | AMF_VERSION_BUILD_NUM) >= 0x0001000400240000" - +@@ -7838,7 +7841,7 @@ enabled amf && # Funny iconv installations are not unusual, so check it after all flags have been set -if enabled libc_iconv; then +if enabled libc_iconv && disabled iconv; then diff --git a/ports/ffmpeg/0005-fix-nasm.patch b/ports/ffmpeg/0005-fix-nasm.patch index a0fe575a6c..e7e1cc62ce 100644 --- a/ports/ffmpeg/0005-fix-nasm.patch +++ b/ports/ffmpeg/0005-fix-nasm.patch @@ -33,7 +33,7 @@ diff --git a/libavcodec/x86/proresdsp.asm b/libavcodec/x86/proresdsp.asm index 65c9fad..5ad73f3 100644 --- a/libavcodec/x86/proresdsp.asm +++ b/libavcodec/x86/proresdsp.asm -@@ -24,7 +24,10 @@ +@@ -24,6 +24,9 @@ %include "libavutil/x86/x86util.asm" @@ -44,12 +44,11 @@ index 65c9fad..5ad73f3 100644 +%else SECTION_RODATA - diff --git a/libavcodec/x86/vp9itxfm_16bpp_avx512.asm b/libavcodec/x86/vp9itxfm_16bpp_avx512.asm index 1924233..17a0ce4 100644 --- a/libavcodec/x86/vp9itxfm_16bpp_avx512.asm +++ b/libavcodec/x86/vp9itxfm_16bpp_avx512.asm -@@ -22,7 +22,10 @@ +@@ -22,6 +22,9 @@ %include "libavutil/x86/x86util.asm" @@ -60,7 +59,6 @@ index 1924233..17a0ce4 100644 +%else SECTION_RODATA 64 - diff --git a/libavcodec/x86/vp9itxfm_avx2.asm b/libavcodec/x86/vp9itxfm_avx2.asm index c5ee242..5fe077f 100644 --- a/libavcodec/x86/vp9itxfm_avx2.asm @@ -109,12 +107,11 @@ index 4f078ea..5cf095b 100644 %if HAVE_AVX2_EXTERNAL diff --git a/libavfilter/x86/vf_atadenoise.asm b/libavfilter/x86/vf_atadenoise.asm -index 4945ad3..748b65a 100644 +index 059605d..4e47e89 100644 --- a/libavfilter/x86/vf_atadenoise.asm +++ b/libavfilter/x86/vf_atadenoise.asm -@@ -20,7 +20,10 @@ - ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - ;****************************************************************************** +@@ -21,6 +21,9 @@ + %include "libavutil/x86/x86util.asm" -%if ARCH_X86_64 +%ifn ARCH_X86_64 @@ -122,13 +119,13 @@ index 4945ad3..748b65a 100644 +vf_atadenoise_placeholder: times 4 db 0 +%else - %include "libavutil/x86/x86util.asm" - + SECTION_RODATA + pw_one: times 8 dw 1 diff --git a/libavfilter/x86/vf_nlmeans.asm b/libavfilter/x86/vf_nlmeans.asm index 8f57801..9aef3a4 100644 --- a/libavfilter/x86/vf_nlmeans.asm +++ b/libavfilter/x86/vf_nlmeans.asm -@@ -21,7 +21,10 @@ +@@ -21,6 +21,9 @@ %include "libavutil/x86/x86util.asm" @@ -139,4 +136,3 @@ index 8f57801..9aef3a4 100644 +%else SECTION_RODATA 32 - diff --git a/ports/ffmpeg/0048-backport-23039.patch b/ports/ffmpeg/0048-backport-23039.patch deleted file mode 100644 index abc133d3c5..0000000000 --- a/ports/ffmpeg/0048-backport-23039.patch +++ /dev/null @@ -1,226 +0,0 @@ -diff --git a/configure b/configure -index 9bce658932..18be80a243 100755 ---- a/configure -+++ b/configure -@@ -2746,7 +2746,9 @@ CONFIG_EXTRA=" - cabac - cbs - cbs_apv -+ cbs_apv_lavf - cbs_av1 -+ cbs_av1_lavf - cbs_h264 - cbs_h265 - cbs_h266 -@@ -3963,7 +3965,7 @@ mlp_demuxer_select="mlp_parser" - mmf_muxer_select="riffenc" - mov_demuxer_select="iso_media riffdec" - mov_demuxer_suggest="iamfdec zlib" --mov_muxer_select="iso_media iso_writer riffenc rtpenc_chain vp9_superframe_bsf aac_adtstoasc_bsf ac3_parser" -+mov_muxer_select="cbs_apv_lavf cbs_av1_lavf iso_media iso_writer riffenc rtpenc_chain vp9_superframe_bsf aac_adtstoasc_bsf ac3_parser" - mov_muxer_suggest="iamfenc" - mp3_demuxer_select="mpegaudio_parser" - mp3_muxer_select="mpegaudioheader" -diff --git a/libavformat/Makefile b/libavformat/Makefile -index c020e77c15..ac56e54aa8 100644 ---- a/libavformat/Makefile -+++ b/libavformat/Makefile -@@ -40,6 +40,8 @@ OBJS = allformats.o \ - OBJS-$(HAVE_LIBC_MSVCRT) += file_open.o - - # subsystems -+OBJS-$(CONFIG_CBS_APV_LAVF) += cbs_apv.o cbs.o -+OBJS-$(CONFIG_CBS_AV1_LAVF) += cbs_av1.o cbs.o - OBJS-$(CONFIG_ISO_MEDIA) += isom.o - OBJS-$(CONFIG_ISO_WRITER) += avc.o hevc.o vvc.o - OBJS-$(CONFIG_IAMFDEC) += iamf_reader.o iamf_parse.o iamf.o -@@ -390,7 +392,7 @@ OBJS-$(CONFIG_MOV_DEMUXER) += mov.o mov_chan.o mov_esds.o \ - OBJS-$(CONFIG_MOV_MUXER) += movenc.o \ - movenchint.o mov_chan.o rtp.o \ - movenccenc.o movenc_ttml.o rawutils.o \ -- apv.o dovi_isom.o evc.o cbs.o cbs_av1.o cbs_apv.o -+ apv.o dovi_isom.o evc.o - OBJS-$(CONFIG_MP2_MUXER) += rawenc.o - OBJS-$(CONFIG_MP3_DEMUXER) += mp3dec.o replaygain.o - OBJS-$(CONFIG_MP3_MUXER) += mp3enc.o rawenc.o id3v2enc.o -diff --git a/libavformat/cbs.h b/libavformat/cbs.h -index dffd0e9206..e4c0f33f6a 100644 ---- a/libavformat/cbs.h -+++ b/libavformat/cbs.h -@@ -19,9 +19,13 @@ - #ifndef AVFORMAT_CBS_H - #define AVFORMAT_CBS_H - -+#include "config.h" -+ - #define CBS_PREFIX lavf_cbs - #define CBS_WRITE 0 - #define CBS_TRACE 0 -+#define CBS_APV CONFIG_CBS_APV_LAVF -+#define CBS_AV1 CONFIG_CBS_AV1_LAVF - #define CBS_H264 0 - #define CBS_H265 0 - #define CBS_H266 0 -diff --git a/configure b/configure -index 18be80a243..39a522e7e8 100755 ---- a/configure -+++ b/configure -@@ -3751,6 +3751,7 @@ vvc_parser_select="cbs_h266" - # bitstream_filters - aac_adtstoasc_bsf_select="adts_header mpeg4audio" - ahx_to_mp2_bsf_deps="lgpl_gpl" -+apv_metadata_bsf_select="cbs_apv" - av1_frame_merge_bsf_select="cbs_av1" - av1_frame_split_bsf_select="cbs_av1" - av1_metadata_bsf_select="cbs_av1" -diff --git a/libavcodec/bsf/filter_units.c b/libavcodec/bsf/filter_units.c -index 696a1f37c4..2514c66fd6 100644 ---- a/libavcodec/bsf/filter_units.c -+++ b/libavcodec/bsf/filter_units.c -@@ -25,6 +25,7 @@ - #include "bsf.h" - #include "bsf_internal.h" - #include "cbs.h" -+#include "cbs_bsf.h" - - - typedef struct FilterUnitsContext { -diff --git a/libavcodec/bsf/trace_headers.c b/libavcodec/bsf/trace_headers.c -index 8781f5f100..c026a426d9 100644 ---- a/libavcodec/bsf/trace_headers.c -+++ b/libavcodec/bsf/trace_headers.c -@@ -25,6 +25,7 @@ - #include "bsf.h" - #include "bsf_internal.h" - #include "cbs.h" -+#include "cbs_bsf.h" - - - typedef struct TraceHeadersContext { -diff --git a/libavcodec/cbs.c b/libavcodec/cbs.c -index 7ff0f89aa5..aabddedeb2 100644 ---- a/libavcodec/cbs.c -+++ b/libavcodec/cbs.c -@@ -63,40 +63,6 @@ static const CodedBitstreamType *const cbs_type_table[] = { - #endif - }; - --const enum AVCodecID CBS_FUNC(all_codec_ids)[] = { --#if CBS_APV -- AV_CODEC_ID_APV, --#endif --#if CBS_AV1 -- AV_CODEC_ID_AV1, --#endif --#if CBS_H264 -- AV_CODEC_ID_H264, --#endif --#if CBS_H265 -- AV_CODEC_ID_H265, --#endif --#if CBS_H266 -- AV_CODEC_ID_H266, --#endif --#if CBS_LCEVC -- AV_CODEC_ID_LCEVC, --#endif --#if CBS_JPEG -- AV_CODEC_ID_MJPEG, --#endif --#if CBS_MPEG2 -- AV_CODEC_ID_MPEG2VIDEO, --#endif --#if CBS_VP8 -- AV_CODEC_ID_VP8, --#endif --#if CBS_VP9 -- AV_CODEC_ID_VP9, --#endif -- AV_CODEC_ID_NONE --}; -- - av_cold int CBS_FUNC(init)(CodedBitstreamContext **ctx_ptr, - enum AVCodecID codec_id, void *log_ctx) - { -diff --git a/libavcodec/cbs.h b/libavcodec/cbs.h -index 8c4614479f..b56dddd842 100644 ---- a/libavcodec/cbs.h -+++ b/libavcodec/cbs.h -@@ -296,14 +296,6 @@ typedef struct CodedBitstreamContext { - } CodedBitstreamContext; - - --/** -- * Table of all supported codec IDs. -- * -- * Terminated by AV_CODEC_ID_NONE. -- */ --extern const enum AVCodecID CBS_FUNC(all_codec_ids)[]; -- -- - /** - * Create and initialise a new context for the given codec. - */ -diff --git a/libavcodec/cbs_bsf.c b/libavcodec/cbs_bsf.c -index f342e5489e..3a9dbad17c 100644 ---- a/libavcodec/cbs_bsf.c -+++ b/libavcodec/cbs_bsf.c -@@ -22,6 +22,40 @@ - - #include "libavutil/attributes.h" - -+const enum AVCodecID ff_cbs_all_codec_ids[] = { -+#if CONFIG_CBS_APV -+ AV_CODEC_ID_APV, -+#endif -+#if CONFIG_CBS_AV1 -+ AV_CODEC_ID_AV1, -+#endif -+#if CONFIG_CBS_H264 -+ AV_CODEC_ID_H264, -+#endif -+#if CONFIG_CBS_H265 -+ AV_CODEC_ID_H265, -+#endif -+#if CONFIG_CBS_H266 -+ AV_CODEC_ID_H266, -+#endif -+#if CONFIG_CBS_LCEVC -+ AV_CODEC_ID_LCEVC, -+#endif -+#if CONFIG_CBS_JPEG -+ AV_CODEC_ID_MJPEG, -+#endif -+#if CONFIG_CBS_MPEG2 -+ AV_CODEC_ID_MPEG2VIDEO, -+#endif -+#if CONFIG_CBS_VP8 -+ AV_CODEC_ID_VP8, -+#endif -+#if CONFIG_CBS_VP9 -+ AV_CODEC_ID_VP9, -+#endif -+ AV_CODEC_ID_NONE -+}; -+ - static int cbs_bsf_update_side_data(AVBSFContext *bsf, AVPacket *pkt) - { - CBSBSFContext *ctx = bsf->priv_data; -diff --git a/libavcodec/cbs_bsf.h b/libavcodec/cbs_bsf.h -index 26bd448b87..f6f7ae05df 100644 ---- a/libavcodec/cbs_bsf.h -+++ b/libavcodec/cbs_bsf.h -@@ -59,6 +59,13 @@ typedef struct CBSBSFContext { - CodedBitstreamFragment fragment; - } CBSBSFContext; - -+/** -+ * Table of all supported codec IDs. -+ * -+ * Terminated by AV_CODEC_ID_NONE. -+ */ -+extern const enum AVCodecID ff_cbs_all_codec_ids[]; -+ - /** - * Initialise generic CBS BSF setup. - * diff --git a/ports/ffmpeg/0051-fix-msvc-undef-flags.patch b/ports/ffmpeg/0051-fix-msvc-undef-flags.patch new file mode 100644 index 0000000000..c78b1d20ec --- /dev/null +++ b/ports/ffmpeg/0051-fix-msvc-undef-flags.patch @@ -0,0 +1,12 @@ +diff --git a/configure b/configure +index 1759694..0ac07ba 100755 +--- a/configure ++++ b/configure +@@ -5019,6 +5019,7 @@ msvc_common_flags(){ + -L*) [ "$_flags_type" != "link" ] || echo -libpath:${flag#-L} ;; + -I*) [ "$_flags_type" = "link" ] || echo $flag ;; + -D*) [ "$_flags_type" = "link" ] || echo $flag ;; ++ -U*) [ "$_flags_type" = "link" ] || echo $flag ;; + -Wl,*) ;; + *) echo $flag ;; + esac diff --git a/ports/ffmpeg/0052-fix-disable-unstable-swscale-link.patch b/ports/ffmpeg/0052-fix-disable-unstable-swscale-link.patch new file mode 100644 index 0000000000..cdee3bb9e4 --- /dev/null +++ b/ports/ffmpeg/0052-fix-disable-unstable-swscale-link.patch @@ -0,0 +1,40 @@ +diff --git a/libswscale/format.c b/libswscale/format.c +index 0f0639f..30cb3cc 100644 +--- a/libswscale/format.c ++++ b/libswscale/format.c +@@ -1339,6 +1339,8 @@ linear_mat3(const AVRational m00, const AVRational m01, const AVRational m02, + return c; + } + ++#endif ++ + void ff_sws_chroma_pos(const SwsFormat *fmt, bool *incomplete, + int *out_x_pos, int *out_y_pos) + { +@@ -1375,6 +1377,8 @@ void ff_sws_chroma_pos(const SwsFormat *fmt, bool *incomplete, + *out_x_pos = x_pos; + *out_y_pos = y_pos; + } ++ ++#if CONFIG_UNSTABLE + + int ff_sws_decode_colors(SwsContext *ctx, SwsPixelType type, + SwsOpList *ops, const SwsFormat *fmt, bool *incomplete) +diff --git a/libswscale/graph.c b/libswscale/graph.c +index 5b14a9c..e3e0736 100644 +--- a/libswscale/graph.c ++++ b/libswscale/graph.c +@@ -36,6 +36,13 @@ + #include "graph.h" + #include "ops.h" + #include "ops_dispatch.h" ++ ++/* The Vulkan swscale objects are built only when unstable is enabled. */ ++#if CONFIG_VULKAN && !CONFIG_UNSTABLE ++#undef CONFIG_VULKAN ++#define CONFIG_VULKAN 0 ++#endif ++ + #if CONFIG_VULKAN + #include "vulkan/ops.h" + #endif diff --git a/ports/ffmpeg/portfile.cmake b/ports/ffmpeg/portfile.cmake index fa73a16e0f..b2efdf7191 100644 --- a/ports/ffmpeg/portfile.cmake +++ b/ports/ffmpeg/portfile.cmake @@ -2,10 +2,9 @@ vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO ffmpeg/ffmpeg REF "n${VERSION}" - SHA512 c72f4062aecc16d8b2b1e8678d5efe3af4cfaa0cc7c0997052248f9e499e60c2463acf07877cf3b78b246ce3e8078cb043e8d97e90a6b50d06af32ff7369a788 + SHA512 4327d259b2ed9cc35a6139606643bf9c9db5fb0372a9eb259fed61af50505a2b59f0c3d94c51fec89d2e0cd552a413c5f50514683931c94c429824198d56ec56 HEAD_REF master PATCHES - 0002-fix-msvc-link.patch 0003-fix-windowsinclude.patch 0004-dependencies.patch 0005-fix-nasm.patch @@ -16,9 +15,10 @@ vcpkg_from_github( 0045-use-prebuilt-bin2c.patch 0046-fix-msvc-detection.patch 0047-fix-msvc-utf8.patch - 0048-backport-23039.patch 0049-fix-twolame-pkgconfig.patch 0050-fix-test-ld-absolute-lib-paths.patch + 0051-fix-msvc-undef-flags.patch + 0052-fix-disable-unstable-swscale-link.patch ) if(SOURCE_PATH MATCHES " ") @@ -85,6 +85,19 @@ if(VCPKG_DETECTED_CMAKE_C_COMPILER) get_filename_component(CC_filename "${VCPKG_DETECTED_CMAKE_C_COMPILER}" NAME) set(ENV{CC} "${CC_filename}") string(APPEND OPTIONS " --cc=${CC_filename}") + + # FFmpeg 9.0 builds a native helper for the unstable AArch64 swscale + # backend. Using the target cl.exe as HOSTCC produces an ARM64 executable + # that cannot run on the x64 build host. Disable only that unstable backend + # for Windows ARM64; 0052 keeps the legacy swscale path linkable. + if(VCPKG_HOST_IS_WINDOWS AND VCPKG_DETECTED_MSVC) + if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64") + string(APPEND OPTIONS " --disable-unstable") + else() + string(APPEND OPTIONS " --host-cc=${CC_filename}") + endif() + endif() + list(APPEND prog_env "${CC_path}") endif() @@ -1082,4 +1095,8 @@ you may need to add the following link option for your library: ") endif() -vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/${LICENSE_FILE}") +vcpkg_install_copyright( + FILE_LIST + "${SOURCE_PATH}/${LICENSE_FILE}" + "${SOURCE_PATH}/LICENSE.md" +) diff --git a/ports/ffmpeg/vcpkg.json b/ports/ffmpeg/vcpkg.json index c880e29092..f7ef346004 100644 --- a/ports/ffmpeg/vcpkg.json +++ b/ports/ffmpeg/vcpkg.json @@ -1,7 +1,6 @@ { "name": "ffmpeg", - "version": "8.1.2", - "port-version": 3, + "version": "9.0", "description": [ "A library to decode, encode, transcode, mux, demux, stream, filter and play pretty much anything that humans and machines have created.", "FFmpeg is the leading multimedia framework, able to decode, encode, transcode, mux, demux, stream, filter and play pretty much anything that humans and machines have created. It supports the most obscure ancient formats up to the cutting edge. No matter if they were designed by some standards committee, the community or a corporation. It is also highly portable: FFmpeg compiles, runs, and passes our testing infrastructure FATE across Linux, Mac OS X, Microsoft Windows, the BSDs, Solaris, etc. under a wide variety of build environments, machine architectures, and configurations." diff --git a/ports/opencv4/0028-ffmpeg9-support.patch b/ports/opencv4/0028-ffmpeg9-support.patch new file mode 100644 index 0000000000..93ed537b5b --- /dev/null +++ b/ports/opencv4/0028-ffmpeg9-support.patch @@ -0,0 +1,52 @@ +diff --git a/modules/videoio/src/cap_ffmpeg_hw.hpp b/modules/videoio/src/cap_ffmpeg_hw.hpp +index e9d9fb4..1678f80 100644 +--- a/modules/videoio/src/cap_ffmpeg_hw.hpp ++++ b/modules/videoio/src/cap_ffmpeg_hw.hpp +@@ -700,9 +700,18 @@ AVCodec *hw_find_codec(AVCodecID id, AVHWDeviceType hw_type, int (*check_catego + #endif + if (hw_type == AV_HWDEVICE_TYPE_CUDA) // CUDA encoders don't support avcodec_get_hw_config() + hw_native_fmt = AV_PIX_FMT_CUDA; +- if (av_codec_is_encoder(c) && hw_native_fmt != AV_PIX_FMT_NONE && c->pix_fmts) { +- for (int i = 0; c->pix_fmts[i] != AV_PIX_FMT_NONE; i++) { +- if (c->pix_fmts[i] == hw_native_fmt) { ++#if LIBAVCODEC_VERSION_MICRO >= 100 && \ ++ LIBAVCODEC_BUILD >= CALC_FFMPEG_VERSION(61, 13, 100) ++ const enum AVPixelFormat *pix_fmts = NULL; ++ if (avcodec_get_supported_config(NULL, c, AV_CODEC_CONFIG_PIX_FORMAT, 0, ++ (const void **)&pix_fmts, NULL) < 0) ++ pix_fmts = NULL; ++#else ++ const enum AVPixelFormat *pix_fmts = c->pix_fmts; ++#endif ++ if (av_codec_is_encoder(c) && hw_native_fmt != AV_PIX_FMT_NONE && pix_fmts) { ++ for (int i = 0; pix_fmts[i] != AV_PIX_FMT_NONE; i++) { ++ if (pix_fmts[i] == hw_native_fmt) { + *hw_pix_fmt = hw_native_fmt; + if (hw_check_codec(c, hw_type, disabled_codecs)) + return c; +diff --git a/modules/videoio/src/cap_ffmpeg_impl.hpp b/modules/videoio/src/cap_ffmpeg_impl.hpp +index d2359b0..93d65aa 100644 +--- a/modules/videoio/src/cap_ffmpeg_impl.hpp ++++ b/modules/videoio/src/cap_ffmpeg_impl.hpp +@@ -2193,9 +2193,19 @@ static AVCodecContext * icv_configure_video_stream_FFMPEG(AVFormatContext *oc, + } + c->time_base.den = frame_rate; + c->time_base.num = frame_rate_base; ++ const AVRational *supported_framerates = NULL; ++#if LIBAVCODEC_VERSION_MICRO >= 100 && \ ++ LIBAVCODEC_BUILD >= CALC_FFMPEG_VERSION(61, 13, 100) ++ if (codec && avcodec_get_supported_config(c, codec, AV_CODEC_CONFIG_FRAME_RATE, 0, ++ (const void **)&supported_framerates, NULL) < 0) ++ supported_framerates = NULL; ++#else ++ if (codec) ++ supported_framerates = codec->supported_framerates; ++#endif + /* adjust time base for supported framerates */ +- if(codec && codec->supported_framerates){ +- const AVRational *p= codec->supported_framerates; ++ if(supported_framerates){ ++ const AVRational *p = supported_framerates; + AVRational req = {frame_rate, frame_rate_base}; + const AVRational *best=NULL; + AVRational best_error= {INT_MAX, 1}; diff --git a/ports/opencv4/portfile.cmake b/ports/opencv4/portfile.cmake index 9f0a8df1eb..5966e5aa8e 100644 --- a/ports/opencv4/portfile.cmake +++ b/ports/opencv4/portfile.cmake @@ -40,6 +40,7 @@ vcpkg_from_github( 0024-openvino-const-tensor-data.patch 0025-fix-cuda-host-std-flag-forwarding.patch 0026-cuda-msvc-preprocessor.patch + 0028-ffmpeg9-support.patch "${PATCH1_FILE}" "${CUDA_13_SUPPORT_PATCH}" ) diff --git a/ports/opencv4/vcpkg.json b/ports/opencv4/vcpkg.json index afefa8cbf5..8b4a16f222 100644 --- a/ports/opencv4/vcpkg.json +++ b/ports/opencv4/vcpkg.json @@ -1,7 +1,7 @@ { "name": "opencv4", "version": "4.12.0", - "port-version": 7, + "port-version": 8, "description": "Open Source Computer Vision Library", "homepage": "https://opencv.org/", "documentation": "https://docs.opencv.org/4.12.0/", diff --git a/versions/baseline.json b/versions/baseline.json index 2e12f6c26f..e44f0a8e96 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -3045,11 +3045,11 @@ "port-version": 0 }, "ffmpeg": { - "baseline": "8.1.2", - "port-version": 3 + "baseline": "9.0", + "port-version": 0 }, "ffmpeg-bin2c": { - "baseline": "8.1.1", + "baseline": "9.0", "port-version": 0 }, "ffnvcodec": { @@ -7442,7 +7442,7 @@ }, "opencv4": { "baseline": "4.12.0", - "port-version": 7 + "port-version": 8 }, "openexr": { "baseline": "3.4.13", diff --git a/versions/f-/ffmpeg-bin2c.json b/versions/f-/ffmpeg-bin2c.json index 9d52505295..ddb37dec51 100644 --- a/versions/f-/ffmpeg-bin2c.json +++ b/versions/f-/ffmpeg-bin2c.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "cf5cb6340d532f3fbe5e64ea27060703fc1520f6", + "version": "9.0", + "port-version": 0 + }, { "git-tree": "6e6514f93f5593a20e79004587333509b11d071e", "version": "8.1.1", diff --git a/versions/f-/ffmpeg.json b/versions/f-/ffmpeg.json index c7d9456769..07fa4dfb3c 100644 --- a/versions/f-/ffmpeg.json +++ b/versions/f-/ffmpeg.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "a716d32cde40e16a962dd0e016a6aebf849ca079", + "version": "9.0", + "port-version": 0 + }, { "git-tree": "c40aaa40e075d25ef1e812daa7333778890b6b0d", "version": "8.1.2", diff --git a/versions/o-/opencv4.json b/versions/o-/opencv4.json index 5b020e923a..23211665ed 100644 --- a/versions/o-/opencv4.json +++ b/versions/o-/opencv4.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "f80b6738877e07cf6c0624a40686a4d060adb29e", + "version": "4.12.0", + "port-version": 8 + }, { "git-tree": "023accb4d65ee6957a61c2795030ca725517fbb2", "version": "4.12.0",