Initial commit: RustDesk 1.4.7 macOS desktop port
- Filled empty libs/hbb_common/ submodule (cloned from rustdesk/hbb_common) - Patched Flutter 3.44 / Dart 3.12 compatibility: * flutter/lib/generated_bridge.dart: asTypedList with cast<>, DartPort=Int64 * flutter/lib/common.dart: DialogTheme->DialogThemeData, TabBarTheme->TabBarThemeData * flutter/pubspec.yaml: extended_text 14.0.0->15.0.2, google_fonts override 5.0.0 * flutter/macos/Runner/Configs/Release.xcconfig: EXCLUDED_ARCHS=x86_64 - Build verified: cargo check + cargo build --features flutter + cargo build --release --features flutter - Verified flutter build macos --debug and --release both produce working .app - Verified .dmg installer (27MB arm64) created via hdiutil - Build deps: Xcode 26.5, CocoaPods 1.16.2, Flutter 3.44, VCPKG arm64-osx
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
diff --git a/build/cmake/cpu.cmake b/build/cmake/cpu.cmake
|
||||
index acebe20..8c67d89 100644
|
||||
--- a/build/cmake/cpu.cmake
|
||||
+++ b/build/cmake/cpu.cmake
|
||||
@@ -120,6 +120,19 @@ elseif("${AOM_TARGET_CPU}" MATCHES "^x86")
|
||||
set(RTCD_ARCH_X86_64 "yes")
|
||||
endif()
|
||||
|
||||
+ # AVX2 requires __m256i definition starting v3.9.0
|
||||
+
|
||||
+ if(ENABLE_AVX2)
|
||||
+ aom_check_source_compiles("x86_64_avx2_m256i_available" "
|
||||
+#include <emmintrin.h>
|
||||
+#ifndef __m256i
|
||||
+#error 1
|
||||
+#endif" HAVE_AVX2_M256I)
|
||||
+ if(HAVE_AVX2_M256I EQUAL 0)
|
||||
+ set(ENABLE_AVX2 0)
|
||||
+ endif()
|
||||
+ endif()
|
||||
+
|
||||
set(X86_FLAVORS "MMX;SSE;SSE2;SSE3;SSSE3;SSE4_1;SSE4_2;AVX;AVX2")
|
||||
foreach(flavor ${X86_FLAVORS})
|
||||
if(ENABLE_${flavor} AND NOT disable_remaining_flavors)
|
||||
diff --git a/aom_dsp/x86/synonyms.h b/aom_dsp/x86/synonyms.h
|
||||
index 0d51cdf..6744ec5 100644
|
||||
--- a/aom_dsp/x86/synonyms.h
|
||||
+++ b/aom_dsp/x86/synonyms.h
|
||||
@@ -46,13 +46,6 @@ static INLINE __m128i xx_loadu_128(const void *a) {
|
||||
return _mm_loadu_si128((const __m128i *)a);
|
||||
}
|
||||
|
||||
-// Load 64 bits from each of hi and low, and pack into an SSE register
|
||||
-// Since directly loading as `int64_t`s and using _mm_set_epi64 may violate
|
||||
-// the strict aliasing rule, this takes a different approach
|
||||
-static INLINE __m128i xx_loadu_2x64(const void *hi, const void *lo) {
|
||||
- return _mm_unpacklo_epi64(_mm_loadu_si64(lo), _mm_loadu_si64(hi));
|
||||
-}
|
||||
-
|
||||
static INLINE void xx_storel_32(void *const a, const __m128i v) {
|
||||
const int val = _mm_cvtsi128_si32(v);
|
||||
memcpy(a, &val, sizeof(val));
|
||||
diff --git a/aom_dsp/x86/synonyms_avx2.h b/aom_dsp/x86/synonyms_avx2.h
|
||||
index d4e8f69..45be17e 100644
|
||||
--- a/aom_dsp/x86/synonyms_avx2.h
|
||||
+++ b/aom_dsp/x86/synonyms_avx2.h
|
||||
@@ -25,6 +25,13 @@
|
||||
* Intrinsics prefixed with yy_ operate on or return 256bit YMM registers.
|
||||
*/
|
||||
|
||||
+// Load 64 bits from each of hi and low, and pack into an SSE register
|
||||
+// Since directly loading as `int64_t`s and using _mm_set_epi64 may violate
|
||||
+// the strict aliasing rule, this takes a different approach
|
||||
+static INLINE __m128i xx_loadu_2x64(const void *hi, const void *lo) {
|
||||
+ return _mm_unpacklo_epi64(_mm_loadu_si64(lo), _mm_loadu_si64(hi));
|
||||
+}
|
||||
+
|
||||
// Loads and stores to do away with the tedium of casting the address
|
||||
// to the right type.
|
||||
static INLINE __m256i yy_load_256(const void *a) {
|
||||
@@ -0,0 +1,75 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 18190f647..f4b1b359d 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -23,6 +23,9 @@ endif()
|
||||
|
||||
project(AOM C CXX)
|
||||
|
||||
+include(GNUInstallDirs)
|
||||
+include(CMakePackageConfigHelpers)
|
||||
+
|
||||
# GENERATED source property global visibility.
|
||||
if(POLICY CMP0118)
|
||||
cmake_policy(SET CMP0118 NEW)
|
||||
@@ -302,6 +305,52 @@ if(BUILD_SHARED_LIBS)
|
||||
set(AOM_LIB_TARGETS ${AOM_LIB_TARGETS} aom_static)
|
||||
endif()
|
||||
|
||||
+set(PUBLIC_HEADERS
|
||||
+ aom/aom.h
|
||||
+ aom/aom_codec.h
|
||||
+ aom/aom_decoder.h
|
||||
+ aom/aom_encoder.h
|
||||
+ aom/aom_frame_buffer.h
|
||||
+ aom/aom_image.h
|
||||
+ aom/aom_integer.h
|
||||
+ aom/aomcx.h
|
||||
+ aom/aomdx.h
|
||||
+)
|
||||
+
|
||||
+set_target_properties(aom PROPERTIES
|
||||
+ PUBLIC_HEADER "${PUBLIC_HEADERS}")
|
||||
+
|
||||
+
|
||||
+target_include_directories(aom
|
||||
+ PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||
+ $<INSTALL_INTERFACE:include>)
|
||||
+
|
||||
+install(TARGETS aom
|
||||
+ EXPORT unofficial-aom-targets
|
||||
+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||
+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||
+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
||||
+ PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/aom")
|
||||
+
|
||||
+install(EXPORT unofficial-aom-targets
|
||||
+ FILE unofficial-aom-targets.cmake
|
||||
+ NAMESPACE unofficial::
|
||||
+ DESTINATION lib/cmake/aom)
|
||||
+
|
||||
+configure_package_config_file(cmake/aom-config.cmake.in
|
||||
+ ${CMAKE_CURRENT_BINARY_DIR}/aom-config.cmake
|
||||
+ INSTALL_DESTINATION lib/cmake/aom
|
||||
+ NO_SET_AND_CHECK_MACRO
|
||||
+ NO_CHECK_REQUIRED_COMPONENTS_MACRO)
|
||||
+
|
||||
+write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/aom-config-version.cmake
|
||||
+ VERSION ${SO_FILE_VERSION}
|
||||
+ COMPATIBILITY SameMajorVersion)
|
||||
+
|
||||
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/aom-config.cmake
|
||||
+ ${CMAKE_CURRENT_BINARY_DIR}/aom-config-version.cmake
|
||||
+ DESTINATION lib/cmake/aom)
|
||||
+
|
||||
# Setup dependencies.
|
||||
if(CONFIG_THREE_PASS)
|
||||
setup_ivf_dec_targets()
|
||||
diff --git a/cmake/aom-config.cmake.in b/cmake/aom-config.cmake.in
|
||||
new file mode 100644
|
||||
index 000000000..91cac3b5b
|
||||
--- /dev/null
|
||||
+++ b/cmake/aom-config.cmake.in
|
||||
@@ -0,0 +1,2 @@
|
||||
+@PACKAGE_INIT@
|
||||
+include(${CMAKE_CURRENT_LIST_DIR}/unofficial-aom-targets.cmake)
|
||||
@@ -0,0 +1,13 @@
|
||||
diff --git a/build/cmake/aom_configure.cmake b/build/cmake/aom_configure.cmake
|
||||
index aaef2c310..5500ad4a3 100644
|
||||
--- a/build/cmake/aom_configure.cmake
|
||||
+++ b/build/cmake/aom_configure.cmake
|
||||
@@ -309,6 +309,8 @@ if(MSVC)
|
||||
|
||||
# Disable MSVC warnings that suggest making code non-portable.
|
||||
add_compiler_flag_if_supported("/wd4996")
|
||||
+ # Disable MSVC warnings for potentially uninitialized local pointer variable.
|
||||
+ add_compiler_flag_if_supported("/wd4703")
|
||||
if(ENABLE_WERROR)
|
||||
add_compiler_flag_if_supported("/WX")
|
||||
endif()
|
||||
@@ -0,0 +1,79 @@
|
||||
# NASM is required to build AOM
|
||||
vcpkg_find_acquire_program(NASM)
|
||||
get_filename_component(NASM_EXE_PATH ${NASM} DIRECTORY)
|
||||
vcpkg_add_to_path(${NASM_EXE_PATH})
|
||||
|
||||
# Perl is required to build AOM
|
||||
vcpkg_find_acquire_program(PERL)
|
||||
get_filename_component(PERL_PATH ${PERL} DIRECTORY)
|
||||
vcpkg_add_to_path(${PERL_PATH})
|
||||
|
||||
if(DEFINED ENV{USE_AOM_391})
|
||||
vcpkg_from_git(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
URL "https://aomedia.googlesource.com/aom"
|
||||
REF 8ad484f8a18ed1853c094e7d3a4e023b2a92df28 # 3.9.1
|
||||
PATCHES
|
||||
aom-uninitialized-pointer.diff
|
||||
aom-avx2.diff
|
||||
aom-install.diff
|
||||
)
|
||||
else()
|
||||
vcpkg_from_git(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
URL "https://aomedia.googlesource.com/aom"
|
||||
REF 10aece4157eb79315da205f39e19bf6ab3ee30d0 # 3.12.1
|
||||
PATCHES
|
||||
aom-uninitialized-pointer.diff
|
||||
# aom-avx2.diff
|
||||
# Can be dropped when https://bugs.chromium.org/p/aomedia/issues/detail?id=3029 is merged into the upstream
|
||||
aom-install.diff
|
||||
)
|
||||
endif()
|
||||
|
||||
set(aom_target_cpu "")
|
||||
if(VCPKG_TARGET_IS_UWP OR (VCPKG_TARGET_IS_WINDOWS AND VCPKG_TARGET_ARCHITECTURE MATCHES "^arm"))
|
||||
# UWP + aom's assembler files result in weirdness and build failures
|
||||
# Also, disable assembly on ARM and ARM64 Windows to fix compilation issues.
|
||||
set(aom_target_cpu "-DAOM_TARGET_CPU=generic")
|
||||
endif()
|
||||
|
||||
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm" AND VCPKG_TARGET_IS_LINUX)
|
||||
set(aom_target_cpu "-DENABLE_NEON=OFF")
|
||||
endif()
|
||||
|
||||
vcpkg_cmake_configure(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
OPTIONS
|
||||
${aom_target_cpu}
|
||||
-DENABLE_DOCS=OFF
|
||||
-DENABLE_EXAMPLES=OFF
|
||||
-DENABLE_TESTDATA=OFF
|
||||
-DENABLE_TESTS=OFF
|
||||
-DENABLE_TOOLS=OFF
|
||||
)
|
||||
|
||||
vcpkg_cmake_install()
|
||||
|
||||
vcpkg_copy_pdbs()
|
||||
|
||||
vcpkg_fixup_pkgconfig()
|
||||
|
||||
if(VCPKG_TARGET_IS_WINDOWS)
|
||||
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/aom.pc" " -lm" "")
|
||||
if(NOT VCPKG_BUILD_TYPE)
|
||||
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/aom.pc" " -lm" "")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Move cmake configs
|
||||
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/${PORT})
|
||||
|
||||
# Remove duplicate files
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include
|
||||
${CURRENT_PACKAGES_DIR}/debug/share)
|
||||
|
||||
# Handle copyright
|
||||
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
|
||||
|
||||
vcpkg_fixup_pkgconfig()
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"name": "aom",
|
||||
"version-semver": "3.12.1",
|
||||
"port-version": 0,
|
||||
"description": "AV1 codec library",
|
||||
"homepage": "https://aomedia.googlesource.com/aom",
|
||||
"license": "BSD-2-Clause",
|
||||
"dependencies": [
|
||||
{
|
||||
"name": "vcpkg-cmake",
|
||||
"host": true
|
||||
},
|
||||
{
|
||||
"name": "vcpkg-cmake-config",
|
||||
"host": true
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
diff --git a/configure b/configure
|
||||
index 1f0b9497cb..3243e23021 100644
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -5697,17 +5697,19 @@ case $target_os in
|
||||
;;
|
||||
win32|win64)
|
||||
disable symver
|
||||
- if enabled shared; then
|
||||
+# if enabled shared; then
|
||||
# Link to the import library instead of the normal static library
|
||||
# for shared libs.
|
||||
LD_LIB='%.lib'
|
||||
# Cannot build both shared and static libs with MSVC or icl.
|
||||
- disable static
|
||||
- fi
|
||||
+# disable static
|
||||
+# fi
|
||||
! enabled small && test_cmd $windres --version && enable gnu_windres
|
||||
enabled x86_32 && check_ldflags -LARGEADDRESSAWARE
|
||||
add_cppflags -DWIN32_LEAN_AND_MEAN
|
||||
shlibdir_default="$bindir_default"
|
||||
+ LIBPREF=""
|
||||
+ LIBSUF=".lib"
|
||||
SLIBPREF=""
|
||||
SLIBSUF=".dll"
|
||||
SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
|
||||
@@ -0,0 +1,11 @@
|
||||
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"
|
||||
@@ -0,0 +1,13 @@
|
||||
diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
|
||||
--- a/fftools/cmdutils.c
|
||||
+++ b/fftools/cmdutils.c
|
||||
@@ -51,6 +51,8 @@
|
||||
#include "fopen_utf8.h"
|
||||
#include "opt_common.h"
|
||||
#ifdef _WIN32
|
||||
+#define _WIN32_WINNT 0x0502
|
||||
+#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include "compat/w32dlfcn.h"
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
diff --git a/configure b/configure
|
||||
index a8b74e0..c99f41c 100755
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -6633,7 +6633,7 @@ fi
|
||||
|
||||
enabled zlib && { check_pkg_config zlib zlib "zlib.h" zlibVersion ||
|
||||
check_lib zlib zlib.h zlibVersion -lz; }
|
||||
-enabled bzlib && check_lib bzlib bzlib.h BZ2_bzlibVersion -lbz2
|
||||
+enabled bzlib && require_pkg_config bzlib bzip2 bzlib.h BZ2_bzlibVersion
|
||||
enabled lzma && check_lib lzma lzma.h lzma_version_number -llzma
|
||||
|
||||
enabled zlib && test_exec $zlib_extralibs <<EOF && enable zlib_gzip
|
||||
@@ -6757,7 +6757,8 @@ if enabled libmfx; then
|
||||
fi
|
||||
|
||||
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 libmysofa && { check_pkg_config libmysofa libmysofa mysofa.h mysofa_neighborhood_init_withstepdefine ||
|
||||
require libmysofa mysofa.h mysofa_neighborhood_init_withstepdefine -lmysofa $zlib_extralibs; }
|
||||
enabled libnpp && { check_lib libnpp npp.h nppGetLibVersion -lnppig -lnppicc -lnppc -lnppidei -lnppif ||
|
||||
@@ -6772,7 +6773,7 @@ require_pkg_config libopencv opencv opencv/cxcore.h cvCreateImageHeader; }
|
||||
enabled libopenh264 && require_pkg_config libopenh264 "openh264 >= 1.3.0" wels/codec_api.h WelsGetCodecVersion
|
||||
enabled libopenjpeg && { check_pkg_config libopenjpeg "libopenjp2 >= 2.1.0" openjpeg.h opj_version ||
|
||||
{ require_pkg_config libopenjpeg "libopenjp2 >= 2.1.0" openjpeg.h opj_version -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } }
|
||||
-enabled libopenmpt && require_pkg_config libopenmpt "libopenmpt >= 0.2.6557" libopenmpt/libopenmpt.h openmpt_module_create -lstdc++ && append libopenmpt_extralibs "-lstdc++"
|
||||
+enabled libopenmpt && require_pkg_config libopenmpt "libopenmpt >= 0.2.6557" libopenmpt/libopenmpt.h openmpt_module_create
|
||||
enabled libopenvino && { { check_pkg_config libopenvino openvino openvino/c/openvino.h ov_core_create && enable openvino2; } ||
|
||||
{ check_pkg_config libopenvino openvino c_api/ie_c_api.h ie_c_api_version ||
|
||||
require libopenvino c_api/ie_c_api.h ie_c_api_version -linference_engine_c_api; } }
|
||||
@@ -6796,8 +6797,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 libsnappy && require libsnappy snappy-c.h snappy_compress -lsnappy -lstdc++
|
||||
-enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr
|
||||
+enabled libsnappy && require_pkg_config libsnappy snappy snappy-c.h snappy_compress
|
||||
+enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr $libm_extralibs
|
||||
enabled libssh && require_pkg_config libssh "libssh >= 0.6.0" libssh/sftp.h sftp_init
|
||||
enabled libspeex && require_pkg_config libspeex speex speex/speex.h speex_decoder_init
|
||||
enabled libsrt && require_pkg_config libsrt "srt >= 1.3.0" srt/srt.h srt_socket
|
||||
@@ -6880,6 +6881,8 @@ enabled openal && { check_pkg_config openal "openal >= 1.1" "AL/al.h"
|
||||
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 ||
|
||||
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)" ||
|
||||
@@ -7204,10 +7207,10 @@ enabled amf &&
|
||||
"(AMF_VERSION_MAJOR << 48 | AMF_VERSION_MINOR << 32 | AMF_VERSION_RELEASE << 16 | AMF_VERSION_BUILD_NUM) >= 0x0001000400210000"
|
||||
|
||||
# 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
|
||||
check_func_headers iconv.h iconv
|
||||
elif enabled iconv; then
|
||||
- check_func_headers iconv.h iconv || check_lib iconv iconv.h iconv -liconv
|
||||
+ check_func_headers iconv.h iconv || check_lib iconv iconv.h iconv -liconv || check_lib iconv iconv.h iconv -liconv -lcharset
|
||||
fi
|
||||
|
||||
enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel"
|
||||
@@ -0,0 +1,78 @@
|
||||
diff --git a/libavcodec/x86/mlpdsp.asm b/libavcodec/x86/mlpdsp.asm
|
||||
index 3dc641e..609b834 100644
|
||||
--- a/libavcodec/x86/mlpdsp.asm
|
||||
+++ b/libavcodec/x86/mlpdsp.asm
|
||||
@@ -23,7 +23,9 @@
|
||||
|
||||
SECTION .text
|
||||
|
||||
-%if ARCH_X86_64
|
||||
+%ifn ARCH_X86_64
|
||||
+mlpdsp_placeholder: times 4 db 0
|
||||
+%else
|
||||
|
||||
%macro SHLX 2
|
||||
%if cpuflag(bmi2)
|
||||
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 @@
|
||||
|
||||
%include "libavutil/x86/x86util.asm"
|
||||
|
||||
-%if ARCH_X86_64
|
||||
+%ifn ARCH_X86_64
|
||||
+SECTION .rdata
|
||||
+proresdsp_placeholder: times 4 db 0
|
||||
+%else
|
||||
|
||||
SECTION_RODATA
|
||||
|
||||
diff --git a/libavcodec/x86/vvc/vvc_mc.asm b/libavcodec/x86/vvc/vvc_mc.asm
|
||||
index 30aa97c..3975f98 100644
|
||||
--- a/libavcodec/x86/vvc/vvc_mc.asm
|
||||
+++ b/libavcodec/x86/vvc/vvc_mc.asm
|
||||
@@ -31,7 +31,9 @@
|
||||
|
||||
SECTION_RODATA 32
|
||||
|
||||
-%if ARCH_X86_64
|
||||
+%ifn ARCH_X86_64
|
||||
+vvc_mc_placeholder: times 4 db 0
|
||||
+%else
|
||||
|
||||
%if HAVE_AVX2_EXTERNAL
|
||||
|
||||
diff --git a/libavfilter/x86/vf_atadenoise.asm b/libavfilter/x86/vf_atadenoise.asm
|
||||
index 4945ad3..748b65a 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
|
||||
;******************************************************************************
|
||||
|
||||
-%if ARCH_X86_64
|
||||
+%ifn ARCH_X86_64
|
||||
+SECTION .rdata
|
||||
+vf_atadenoise_placeholder: times 4 db 0
|
||||
+%else
|
||||
|
||||
%include "libavutil/x86/x86util.asm"
|
||||
|
||||
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 @@
|
||||
|
||||
%include "libavutil/x86/x86util.asm"
|
||||
|
||||
-%if HAVE_AVX2_EXTERNAL && ARCH_X86_64
|
||||
+%ifn HAVE_AVX2_EXTERNAL && ARCH_X86_64
|
||||
+SECTION .rdata
|
||||
+vf_nlmeans_placeholder: times 4 db 0
|
||||
+%else
|
||||
|
||||
SECTION_RODATA 32
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
diff --git a/configure b/configure
|
||||
index d6c4388..75b96c3 100644
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -4781,6 +4781,7 @@ msvc_common_flags(){
|
||||
-mfp16-format=*) ;;
|
||||
-lz) echo zlib.lib ;;
|
||||
-lx264) echo libx264.lib ;;
|
||||
+ -lmp3lame) echo libmp3lame.lib ;;
|
||||
-lstdc++) ;;
|
||||
-l*) echo ${flag#-l}.lib ;;
|
||||
-LARGEADDRESSAWARE) echo $flag ;;
|
||||
@@ -0,0 +1,15 @@
|
||||
diff --color -Naur src_old/libavcodec/mf_utils.c src/libavcodec/mf_utils.c
|
||||
--- src_old/libavcodec/mf_utils.c 2020-07-11 05:26:17.000000000 +0700
|
||||
+++ src/libavcodec/mf_utils.c 2020-11-13 12:55:57.226976400 +0700
|
||||
@@ -22,6 +22,11 @@
|
||||
#define _WIN32_WINNT 0x0602
|
||||
#endif
|
||||
|
||||
+#if !defined(WINVER) || WINVER < 0x0602
|
||||
+#undef WINVER
|
||||
+#define WINVER 0x0602
|
||||
+#endif
|
||||
+
|
||||
#include "mf_utils.h"
|
||||
#include "libavutil/pixdesc.h"
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
diff --git a/libswscale/aarch64/yuv2rgb_neon.S b/libswscale/aarch64/yuv2rgb_neon.S
|
||||
index 89d69e7f6c..4bc1607a7a 100644
|
||||
--- a/libswscale/aarch64/yuv2rgb_neon.S
|
||||
+++ b/libswscale/aarch64/yuv2rgb_neon.S
|
||||
@@ -169,19 +169,19 @@ function ff_\ifmt\()_to_\ofmt\()_neon, export=1
|
||||
sqdmulh v26.8h, v26.8h, v0.8h // ((Y1*(1<<3) - y_offset) * y_coeff) >> 15
|
||||
sqdmulh v27.8h, v27.8h, v0.8h // ((Y2*(1<<3) - y_offset) * y_coeff) >> 15
|
||||
|
||||
-.ifc \ofmt,argb // 1 2 3 0
|
||||
+.ifc \ofmt,argb
|
||||
compute_rgba v5.8b,v6.8b,v7.8b,v4.8b, v17.8b,v18.8b,v19.8b,v16.8b
|
||||
.endif
|
||||
|
||||
-.ifc \ofmt,rgba // 0 1 2 3
|
||||
+.ifc \ofmt,rgba
|
||||
compute_rgba v4.8b,v5.8b,v6.8b,v7.8b, v16.8b,v17.8b,v18.8b,v19.8b
|
||||
.endif
|
||||
|
||||
-.ifc \ofmt,abgr // 3 2 1 0
|
||||
+.ifc \ofmt,abgr
|
||||
compute_rgba v7.8b,v6.8b,v5.8b,v4.8b, v19.8b,v18.8b,v17.8b,v16.8b
|
||||
.endif
|
||||
|
||||
-.ifc \ofmt,bgra // 2 1 0 3
|
||||
+.ifc \ofmt,bgra
|
||||
compute_rgba v6.8b,v5.8b,v4.8b,v7.8b, v18.8b,v17.8b,v16.8b,v19.8b
|
||||
.endif
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
diff --git a/configure b/configure
|
||||
index 4f5353f84b..dd9147c677 100755
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -5607,8 +5607,8 @@ check_cppflags -D_FILE_OFFSET_BITS=64
|
||||
check_cppflags -D_LARGEFILE_SOURCE
|
||||
|
||||
add_host_cppflags -D_ISOC11_SOURCE
|
||||
check_host_cflags_cc -std=$stdc ctype.h "__STDC_VERSION__ >= 201112L" ||
|
||||
- check_host_cflags_cc -std=c11 ctype.h "__STDC_VERSION__ >= 201112L" || die "Host compiler lacks C11 support"
|
||||
+ check_host_cflags_cc -std=c11 ctype.h "__STDC_VERSION__ >= 201112L"
|
||||
|
||||
check_host_cflags -Wall
|
||||
check_host_cflags $host_cflags_speed
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
|
||||
index cd7b0d941c..b4a6dce885 100644
|
||||
--- a/libavformat/avformat.h
|
||||
+++ b/libavformat/avformat.h
|
||||
@@ -1169,7 +1169,11 @@ typedef struct AVStreamGroup {
|
||||
} AVStreamGroup;
|
||||
|
||||
struct AVCodecParserContext *av_stream_get_parser(const AVStream *s);
|
||||
|
||||
+// Chromium: We use the internal field first_dts vvv
|
||||
+int64_t av_stream_get_first_dts(const AVStream *st);
|
||||
+// Chromium: We use the internal field first_dts ^^^
|
||||
+
|
||||
#define AV_PROGRAM_RUNNING 1
|
||||
|
||||
/**
|
||||
diff --git a/libavformat/mux_utils.c b/libavformat/mux_utils.c
|
||||
index de7580c32d..0ef0fe530e 100644
|
||||
--- a/libavformat/mux_utils.c
|
||||
+++ b/libavformat/mux_utils.c
|
||||
@@ -29,7 +29,14 @@ #include "avformat.h"
|
||||
#include "avio.h"
|
||||
#include "internal.h"
|
||||
#include "mux.h"
|
||||
|
||||
+// Chromium: We use the internal field first_dts vvv
|
||||
+int64_t av_stream_get_first_dts(const AVStream *st)
|
||||
+{
|
||||
+ return cffstream(st)->first_dts;
|
||||
+}
|
||||
+// Chromium: We use the internal field first_dts ^^^
|
||||
+
|
||||
int avformat_query_codec(const AVOutputFormat *ofmt, enum AVCodecID codec_id,
|
||||
int std_compliance)
|
||||
{
|
||||
@@ -0,0 +1,13 @@
|
||||
diff --git a/libavdevice/opengl_enc.c b/libavdevice/opengl_enc.c
|
||||
index b2ac6eb..6351614 100644
|
||||
--- a/libavdevice/opengl_enc.c
|
||||
+++ b/libavdevice/opengl_enc.c
|
||||
@@ -116,7 +116,7 @@ typedef void (APIENTRY *FF_PFNGLATTACHSHADERPROC) (GLuint program, GLuint shad
|
||||
typedef GLuint (APIENTRY *FF_PFNGLCREATESHADERPROC) (GLenum type);
|
||||
typedef void (APIENTRY *FF_PFNGLDELETESHADERPROC) (GLuint shader);
|
||||
typedef void (APIENTRY *FF_PFNGLCOMPILESHADERPROC) (GLuint shader);
|
||||
-typedef void (APIENTRY *FF_PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const char* *string, const GLint *length);
|
||||
+typedef void (APIENTRY *FF_PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const char* const *string, const GLint *length);
|
||||
typedef void (APIENTRY *FF_PFNGLGETSHADERIVPROC) (GLuint shader, GLenum pname, GLint *params);
|
||||
typedef void (APIENTRY *FF_PFNGLGETSHADERINFOLOGPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, char *infoLog);
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
diff --git a/ffbuild/libversion.sh b/ffbuild/libversion.sh
|
||||
index a94ab58..ecaa90c 100644
|
||||
--- a/ffbuild/libversion.sh
|
||||
+++ b/ffbuild/libversion.sh
|
||||
@@ -1,3 +1,4 @@
|
||||
+#!/bin/sh
|
||||
toupper(){
|
||||
echo "$@" | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
diff --git a/libavfilter/textutils.c b/libavfilter/textutils.c
|
||||
index ef658d0..c61b0ad 100644
|
||||
--- a/libavfilter/textutils.c
|
||||
+++ b/libavfilter/textutils.c
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "libavutil/file.h"
|
||||
#include "libavutil/mem.h"
|
||||
#include "libavutil/time.h"
|
||||
+#include "libavutil/time_internal.h"
|
||||
|
||||
static int ff_expand_text_function_internal(FFExpandTextContext *expand_text, AVBPrint *bp,
|
||||
char *name, unsigned argc, char **argv)
|
||||
@@ -0,0 +1,152 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
export PATH="$PATH:/usr/bin"
|
||||
|
||||
command -v cygpath >/dev/null && have_cygpath=1
|
||||
|
||||
cygpath() {
|
||||
if [ -n "$have_cygpath" ]; then
|
||||
command cygpath "$@"
|
||||
else
|
||||
eval _p='$'$#
|
||||
printf '%s\n' "$_p"
|
||||
fi
|
||||
}
|
||||
|
||||
move_binary() {
|
||||
SOURCE=$1
|
||||
TARGET=$2
|
||||
BINARY=$3
|
||||
|
||||
# run lipo over the command to check whether it really
|
||||
# is a binary that we need to merge architectures
|
||||
lipo $SOURCE/$BINARY -info &> /dev/null || return 0
|
||||
|
||||
# get the directory name the file is in
|
||||
DIRNAME=$(dirname $BINARY)
|
||||
|
||||
# ensure the directory to move the binary to exists
|
||||
mkdir -p $TARGET/$DIRNAME
|
||||
|
||||
# now finally move the binary
|
||||
mv $SOURCE/$BINARY $TARGET/$BINARY
|
||||
}
|
||||
|
||||
move_binaries() {
|
||||
SOURCE=$1
|
||||
TARGET=$2
|
||||
|
||||
[ ! -d $SOURCE ] && return 0
|
||||
pushd $SOURCE
|
||||
|
||||
for BINARY in $(find . -type f); do
|
||||
move_binary $SOURCE $TARGET $BINARY
|
||||
done
|
||||
|
||||
popd
|
||||
}
|
||||
|
||||
merge_binaries() {
|
||||
TARGET=$1
|
||||
SOURCE=$2
|
||||
|
||||
shift
|
||||
shift
|
||||
|
||||
pushd $SOURCE/$1
|
||||
BINARIES=$(find . -type f)
|
||||
popd
|
||||
|
||||
for BINARY in $BINARIES; do
|
||||
COMMAND="lipo -create -output $TARGET/$BINARY"
|
||||
|
||||
for ARCH in $@; do
|
||||
COMMAND="$COMMAND -arch $ARCH $SOURCE/$ARCH/$BINARY"
|
||||
done
|
||||
|
||||
$($COMMAND)
|
||||
done
|
||||
}
|
||||
|
||||
export PKG_CONFIG_PATH="$(cygpath -p "${PKG_CONFIG_PATH}")"
|
||||
|
||||
# Export HTTP(S)_PROXY as http(s)_proxy:
|
||||
[ -n "$HTTP_PROXY" ] && export http_proxy="$HTTP_PROXY"
|
||||
[ -n "$HTTPS_PROXY" ] && export https_proxy="$HTTPS_PROXY"
|
||||
|
||||
PATH_TO_BUILD_DIR=$( cygpath "@BUILD_DIR@")
|
||||
PATH_TO_SRC_DIR=$( cygpath "@SOURCE_PATH@")
|
||||
PATH_TO_PACKAGE_DIR=$(cygpath "@INST_PREFIX@")
|
||||
|
||||
JOBS=@VCPKG_CONCURRENCY@
|
||||
|
||||
OSX_ARCHS="@OSX_ARCHS@"
|
||||
OSX_ARCH_COUNT=0@OSX_ARCH_COUNT@
|
||||
|
||||
# Default to hardware concurrency if unset.
|
||||
: ${JOBS:=$(nproc)}
|
||||
|
||||
# Disable asm and x86asm on all android targets because they trigger build failures:
|
||||
# arm64 Android build fails with 'relocation R_AARCH64_ADR_PREL_PG_HI21 cannot be used against symbol ff_cos_32; recompile with -fPIC'
|
||||
# x86 Android build fails with 'error: inline assembly requires more registers than available'.
|
||||
# x64 Android build fails with 'relocation R_X86_64_PC32 cannot be used against symbol ff_h264_cabac_tables; recompile with -fPIC'
|
||||
if [ "@VCPKG_CMAKE_SYSTEM_NAME@" = "Android" ]; then
|
||||
OPTIONS_arm=" --disable-asm --disable-x86asm"
|
||||
OPTIONS_arm64=" --disable-asm --disable-x86asm"
|
||||
OPTIONS_x86=" --disable-asm --disable-x86asm"
|
||||
OPTIONS_x86_64="${OPTIONS_x86}"
|
||||
else
|
||||
OPTIONS_arm=" --disable-asm --disable-x86asm"
|
||||
OPTIONS_arm64=" --enable-asm --disable-x86asm"
|
||||
OPTIONS_x86=" --enable-asm --enable-x86asm"
|
||||
OPTIONS_x86_64="${OPTIONS_x86}"
|
||||
fi
|
||||
|
||||
build_ffmpeg() {
|
||||
# extract build architecture
|
||||
BUILD_ARCH=$1
|
||||
shift
|
||||
|
||||
echo "BUILD_ARCH=${BUILD_ARCH}"
|
||||
|
||||
# get architecture-specific options
|
||||
OPTION_VARIABLE="OPTIONS_${BUILD_ARCH}"
|
||||
echo "OPTION_VARIABLE=${OPTION_VARIABLE}"
|
||||
|
||||
echo "=== CONFIGURING ==="
|
||||
|
||||
sh "$PATH_TO_SRC_DIR/configure" "--prefix=$PATH_TO_PACKAGE_DIR" @CONFIGURE_OPTIONS@ --arch=${BUILD_ARCH} ${!OPTION_VARIABLE} $@
|
||||
|
||||
echo "=== BUILDING ==="
|
||||
|
||||
make -j${JOBS} V=1
|
||||
|
||||
echo "=== INSTALLING ==="
|
||||
|
||||
make install
|
||||
}
|
||||
|
||||
cd "$PATH_TO_BUILD_DIR"
|
||||
|
||||
if [ $OSX_ARCH_COUNT -gt 0 ]; then
|
||||
for ARCH in $OSX_ARCHS; do
|
||||
echo "=== CLEANING FOR $ARCH ==="
|
||||
|
||||
make clean && make distclean
|
||||
|
||||
build_ffmpeg $ARCH --extra-cflags=-arch --extra-cflags=$ARCH --extra-ldflags=-arch --extra-ldflags=$ARCH
|
||||
|
||||
echo "=== COLLECTING BINARIES FOR $ARCH ==="
|
||||
|
||||
move_binaries $PATH_TO_PACKAGE_DIR/lib $PATH_TO_BUILD_DIR/stage/$ARCH/lib
|
||||
move_binaries $PATH_TO_PACKAGE_DIR/bin $PATH_TO_BUILD_DIR/stage/$ARCH/bin
|
||||
done
|
||||
|
||||
echo "=== MERGING ARCHITECTURES ==="
|
||||
|
||||
merge_binaries $PATH_TO_PACKAGE_DIR $PATH_TO_BUILD_DIR/stage $OSX_ARCHS
|
||||
else
|
||||
build_ffmpeg @BUILD_ARCH@
|
||||
fi
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
From da6921d5bcb50961193526f47aa2dbe71ee5fe81 Mon Sep 17 00:00:00 2001
|
||||
From: 21pages <sunboeasy@gmail.com>
|
||||
Date: Tue, 10 Dec 2024 13:40:46 +0800
|
||||
Subject: [PATCH 1/5] avcodec/amfenc: add query_timeout option for h264/hevc
|
||||
|
||||
Signed-off-by: 21pages <sunboeasy@gmail.com>
|
||||
---
|
||||
libavcodec/amfenc.h | 1 +
|
||||
libavcodec/amfenc_h264.c | 4 ++++
|
||||
libavcodec/amfenc_hevc.c | 4 ++++
|
||||
3 files changed, 9 insertions(+)
|
||||
|
||||
diff --git a/libavcodec/amfenc.h b/libavcodec/amfenc.h
|
||||
index d985d01bb1..320c66919e 100644
|
||||
--- a/libavcodec/amfenc.h
|
||||
+++ b/libavcodec/amfenc.h
|
||||
@@ -91,6 +91,7 @@ typedef struct AmfContext {
|
||||
int quality;
|
||||
int b_frame_delta_qp;
|
||||
int ref_b_frame_delta_qp;
|
||||
+ int64_t query_timeout;
|
||||
|
||||
// Dynamic options, can be set after Init() call
|
||||
|
||||
diff --git a/libavcodec/amfenc_h264.c b/libavcodec/amfenc_h264.c
|
||||
index 8edd39c633..6ad4961b2f 100644
|
||||
--- a/libavcodec/amfenc_h264.c
|
||||
+++ b/libavcodec/amfenc_h264.c
|
||||
@@ -137,6 +137,7 @@ static const AVOption options[] = {
|
||||
|
||||
|
||||
{ "log_to_dbg", "Enable AMF logging to debug output", OFFSET(log_to_dbg) , AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
|
||||
+ { "query_timeout", "Timeout for QueryOutput call in ms", OFFSET(query_timeout), AV_OPT_TYPE_INT64, { .i64 = -1 }, -1, 1000, VE },
|
||||
|
||||
//Pre Analysis options
|
||||
{ "preanalysis", "Enable preanalysis", OFFSET(preanalysis), AV_OPT_TYPE_BOOL, {.i64 = -1 }, -1, 1, VE },
|
||||
@@ -228,6 +229,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
||||
|
||||
AMF_ASSIGN_PROPERTY_RATE(res, ctx->encoder, AMF_VIDEO_ENCODER_FRAMERATE, framerate);
|
||||
|
||||
+ if (ctx->query_timeout >= 0)
|
||||
+ AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_QUERY_TIMEOUT, ctx->query_timeout);
|
||||
+
|
||||
switch (avctx->profile) {
|
||||
case AV_PROFILE_H264_BASELINE:
|
||||
profile = AMF_VIDEO_ENCODER_PROFILE_BASELINE;
|
||||
diff --git a/libavcodec/amfenc_hevc.c b/libavcodec/amfenc_hevc.c
|
||||
index 4898824f3a..22cb95c7ce 100644
|
||||
--- a/libavcodec/amfenc_hevc.c
|
||||
+++ b/libavcodec/amfenc_hevc.c
|
||||
@@ -104,6 +104,7 @@ static const AVOption options[] = {
|
||||
|
||||
|
||||
{ "log_to_dbg", "Enable AMF logging to debug output", OFFSET(log_to_dbg), AV_OPT_TYPE_BOOL,{ .i64 = 0 }, 0, 1, VE },
|
||||
+ { "query_timeout", "Timeout for QueryOutput call in ms", OFFSET(query_timeout), AV_OPT_TYPE_INT64, { .i64 = -1 }, -1, 1000, VE },
|
||||
|
||||
//Pre Analysis options
|
||||
{ "preanalysis", "Enable preanalysis", OFFSET(preanalysis), AV_OPT_TYPE_BOOL, {.i64 = -1 }, -1, 1, VE },
|
||||
@@ -194,6 +195,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
||||
|
||||
AMF_ASSIGN_PROPERTY_RATE(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_FRAMERATE, framerate);
|
||||
|
||||
+ if (ctx->query_timeout >= 0)
|
||||
+ AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_QUERY_TIMEOUT, ctx->query_timeout);
|
||||
+
|
||||
switch (avctx->profile) {
|
||||
case AV_PROFILE_HEVC_MAIN:
|
||||
profile = AMF_VIDEO_ENCODER_HEVC_PROFILE_MAIN;
|
||||
--
|
||||
2.43.0.windows.1
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
From 8d061adb7b00fc765b8001307c025437ef1cad88 Mon Sep 17 00:00:00 2001
|
||||
From: 21pages <sunboeasy@gmail.com>
|
||||
Date: Thu, 5 Sep 2024 16:32:16 +0800
|
||||
Subject: [PATCH 2/5] libavcodec/amfenc: reconfig when bitrate change
|
||||
|
||||
Signed-off-by: 21pages <sunboeasy@gmail.com>
|
||||
---
|
||||
libavcodec/amfenc.c | 20 ++++++++++++++++++++
|
||||
libavcodec/amfenc.h | 1 +
|
||||
2 files changed, 21 insertions(+)
|
||||
|
||||
diff --git a/libavcodec/amfenc.c b/libavcodec/amfenc.c
|
||||
index a47aea6108..f70f0109f6 100644
|
||||
--- a/libavcodec/amfenc.c
|
||||
+++ b/libavcodec/amfenc.c
|
||||
@@ -275,6 +275,7 @@ static int amf_init_context(AVCodecContext *avctx)
|
||||
|
||||
ctx->hwsurfaces_in_queue = 0;
|
||||
ctx->hwsurfaces_in_queue_max = 16;
|
||||
+ ctx->av_bitrate = avctx->bit_rate;
|
||||
|
||||
// configure AMF logger
|
||||
// the return of these functions indicates old state and do not affect behaviour
|
||||
@@ -640,6 +641,23 @@ static void amf_release_buffer_with_frame_ref(AMFBuffer *frame_ref_storage_buffe
|
||||
frame_ref_storage_buffer->pVtbl->Release(frame_ref_storage_buffer);
|
||||
}
|
||||
|
||||
+static int reconfig_encoder(AVCodecContext *avctx)
|
||||
+{
|
||||
+ AmfContext *ctx = avctx->priv_data;
|
||||
+ AMF_RESULT res = AMF_OK;
|
||||
+
|
||||
+ if (ctx->av_bitrate != avctx->bit_rate) {
|
||||
+ av_log(ctx, AV_LOG_INFO, "change bitrate from %d to %d\n", ctx->av_bitrate, avctx->bit_rate);
|
||||
+ ctx->av_bitrate = avctx->bit_rate;
|
||||
+ if (avctx->codec->id == AV_CODEC_ID_H264) {
|
||||
+ AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_TARGET_BITRATE, avctx->bit_rate);
|
||||
+ } else if (avctx->codec->id == AV_CODEC_ID_HEVC) {
|
||||
+ AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_TARGET_BITRATE, avctx->bit_rate);
|
||||
+ }
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
int ff_amf_receive_packet(AVCodecContext *avctx, AVPacket *avpkt)
|
||||
{
|
||||
AmfContext *ctx = avctx->priv_data;
|
||||
@@ -653,6 +671,8 @@ int ff_amf_receive_packet(AVCodecContext *avctx, AVPacket *avpkt)
|
||||
int query_output_data_flag = 0;
|
||||
AMF_RESULT res_resubmit;
|
||||
|
||||
+ reconfig_encoder(avctx);
|
||||
+
|
||||
if (!ctx->encoder)
|
||||
return AVERROR(EINVAL);
|
||||
|
||||
diff --git a/libavcodec/amfenc.h b/libavcodec/amfenc.h
|
||||
index 320c66919e..481e0fb75d 100644
|
||||
--- a/libavcodec/amfenc.h
|
||||
+++ b/libavcodec/amfenc.h
|
||||
@@ -115,6 +115,7 @@ typedef struct AmfContext {
|
||||
int max_b_frames;
|
||||
int qvbr_quality_level;
|
||||
int hw_high_motion_quality_boost;
|
||||
+ int64_t av_bitrate;
|
||||
|
||||
// HEVC - specific options
|
||||
|
||||
--
|
||||
2.43.0.windows.1
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
From d74de94b49efcf7a0b25673ace6016938d1b9272 Mon Sep 17 00:00:00 2001
|
||||
From: 21pages <sunboeasy@gmail.com>
|
||||
Date: Tue, 10 Dec 2024 14:12:01 +0800
|
||||
Subject: [PATCH 3/5] videotoolbox changing bitrate
|
||||
|
||||
Signed-off-by: 21pages <sunboeasy@gmail.com>
|
||||
---
|
||||
libavcodec/videotoolboxenc.c | 40 ++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 40 insertions(+)
|
||||
|
||||
diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
|
||||
index da7b291b03..3c866177f5 100644
|
||||
--- a/libavcodec/videotoolboxenc.c
|
||||
+++ b/libavcodec/videotoolboxenc.c
|
||||
@@ -279,6 +279,8 @@ typedef struct VTEncContext {
|
||||
int max_slice_bytes;
|
||||
int power_efficient;
|
||||
int max_ref_frames;
|
||||
+
|
||||
+ int last_bit_rate;
|
||||
} VTEncContext;
|
||||
|
||||
static void vtenc_free_buf_node(BufNode *info)
|
||||
@@ -1180,6 +1182,7 @@ static int vtenc_create_encoder(AVCodecContext *avctx,
|
||||
int64_t one_second_value = 0;
|
||||
void *nums[2];
|
||||
|
||||
+ vtctx->last_bit_rate = bit_rate;
|
||||
int status = VTCompressionSessionCreate(kCFAllocatorDefault,
|
||||
avctx->width,
|
||||
avctx->height,
|
||||
@@ -2638,6 +2641,42 @@ out:
|
||||
return status;
|
||||
}
|
||||
|
||||
+static void update_config(AVCodecContext *avctx)
|
||||
+{
|
||||
+ VTEncContext *vtctx = avctx->priv_data;
|
||||
+
|
||||
+ if (avctx->codec_id != AV_CODEC_ID_PRORES) {
|
||||
+ if (avctx->bit_rate != vtctx->last_bit_rate) {
|
||||
+ av_log(avctx, AV_LOG_INFO, "Setting bit rate to %d\n", avctx->bit_rate);
|
||||
+ vtctx->last_bit_rate = avctx->bit_rate;
|
||||
+ SInt32 bit_rate = avctx->bit_rate;
|
||||
+ CFNumberRef bit_rate_num = CFNumberCreate(kCFAllocatorDefault,
|
||||
+ kCFNumberSInt32Type,
|
||||
+ &bit_rate);
|
||||
+ if (!bit_rate_num) return;
|
||||
+
|
||||
+ if (vtctx->constant_bit_rate) {
|
||||
+ int status = VTSessionSetProperty(vtctx->session,
|
||||
+ compat_keys.kVTCompressionPropertyKey_ConstantBitRate,
|
||||
+ bit_rate_num);
|
||||
+ if (status == kVTPropertyNotSupportedErr) {
|
||||
+ av_log(avctx, AV_LOG_ERROR, "Error: -constant_bit_rate true is not supported by the encoder.\n");
|
||||
+ }
|
||||
+ } else {
|
||||
+ int status = VTSessionSetProperty(vtctx->session,
|
||||
+ kVTCompressionPropertyKey_AverageBitRate,
|
||||
+ bit_rate_num);
|
||||
+ if (status) {
|
||||
+ av_log(avctx, AV_LOG_ERROR, "Error: cannot set average bit rate: %d\n", status);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ CFRelease(bit_rate_num);
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+
|
||||
static av_cold int vtenc_frame(
|
||||
AVCodecContext *avctx,
|
||||
AVPacket *pkt,
|
||||
@@ -2650,6 +2689,7 @@ static av_cold int vtenc_frame(
|
||||
CMSampleBufferRef buf = NULL;
|
||||
ExtraSEI sei = {0};
|
||||
|
||||
+ update_config(avctx);
|
||||
if (frame) {
|
||||
status = vtenc_send_frame(avctx, vtctx, frame);
|
||||
|
||||
--
|
||||
2.43.0.windows.1
|
||||
|
||||
@@ -0,0 +1,246 @@
|
||||
From 7323bd68c1b34e9298ea557ff7a3e1883b653957 Mon Sep 17 00:00:00 2001
|
||||
From: 21pages <sunboeasy@gmail.com>
|
||||
Date: Tue, 10 Dec 2024 14:28:16 +0800
|
||||
Subject: [PATCH 4/5] mediacodec changing bitrate
|
||||
|
||||
Signed-off-by: 21pages <sunboeasy@gmail.com>
|
||||
---
|
||||
libavcodec/mediacodec_wrapper.c | 98 +++++++++++++++++++++++++++++++++
|
||||
libavcodec/mediacodec_wrapper.h | 7 +++
|
||||
libavcodec/mediacodecenc.c | 18 ++++++
|
||||
3 files changed, 123 insertions(+)
|
||||
|
||||
diff --git a/libavcodec/mediacodec_wrapper.c b/libavcodec/mediacodec_wrapper.c
|
||||
index 96c886666a..06b8504304 100644
|
||||
--- a/libavcodec/mediacodec_wrapper.c
|
||||
+++ b/libavcodec/mediacodec_wrapper.c
|
||||
@@ -35,6 +35,8 @@
|
||||
#include "ffjni.h"
|
||||
#include "mediacodec_wrapper.h"
|
||||
|
||||
+#define PARAMETER_KEY_VIDEO_BITRATE "video-bitrate"
|
||||
+
|
||||
struct JNIAMediaCodecListFields {
|
||||
|
||||
jclass mediacodec_list_class;
|
||||
@@ -195,6 +197,8 @@ struct JNIAMediaCodecFields {
|
||||
jmethodID set_input_surface_id;
|
||||
jmethodID signal_end_of_input_stream_id;
|
||||
|
||||
+ jmethodID set_parameters_id;
|
||||
+
|
||||
jclass mediainfo_class;
|
||||
|
||||
jmethodID init_id;
|
||||
@@ -248,6 +252,8 @@ static const struct FFJniField jni_amediacodec_mapping[] = {
|
||||
{ "android/media/MediaCodec", "setInputSurface", "(Landroid/view/Surface;)V", FF_JNI_METHOD, OFFSET(set_input_surface_id), 0 },
|
||||
{ "android/media/MediaCodec", "signalEndOfInputStream", "()V", FF_JNI_METHOD, OFFSET(signal_end_of_input_stream_id), 0 },
|
||||
|
||||
+ { "android/media/MediaCodec", "setParameters", "(Landroid/os/Bundle;)V", FF_JNI_METHOD, OFFSET(set_parameters_id), 0 },
|
||||
+
|
||||
{ "android/media/MediaCodec$BufferInfo", NULL, NULL, FF_JNI_CLASS, OFFSET(mediainfo_class), 1 },
|
||||
|
||||
{ "android/media/MediaCodec.BufferInfo", "<init>", "()V", FF_JNI_METHOD, OFFSET(init_id), 1 },
|
||||
@@ -292,6 +298,24 @@ typedef struct FFAMediaCodecJni {
|
||||
|
||||
static const FFAMediaCodec media_codec_jni;
|
||||
|
||||
+struct JNIABundleFields
|
||||
+{
|
||||
+ jclass bundle_class;
|
||||
+ jmethodID init_id;
|
||||
+ jmethodID put_int_id;
|
||||
+};
|
||||
+
|
||||
+#define OFFSET(x) offsetof(struct JNIABundleFields, x)
|
||||
+static const struct FFJniField jni_abundle_mapping[] = {
|
||||
+ { "android/os/Bundle", NULL, NULL, FF_JNI_CLASS, OFFSET(bundle_class), 1 },
|
||||
+
|
||||
+ { "android/os/Bundle", "<init>", "()V", FF_JNI_METHOD, OFFSET(init_id), 1 },
|
||||
+ { "android/os/Bundle", "putInt", "(Ljava/lang/String;I)V", FF_JNI_METHOD, OFFSET(put_int_id), 1 },
|
||||
+
|
||||
+ { NULL }
|
||||
+};
|
||||
+#undef OFFSET
|
||||
+
|
||||
#define JNI_GET_ENV_OR_RETURN(env, log_ctx, ret) do { \
|
||||
(env) = ff_jni_get_env(log_ctx); \
|
||||
if (!(env)) { \
|
||||
@@ -1762,6 +1786,70 @@ static int mediacodec_jni_signalEndOfInputStream(FFAMediaCodec *ctx)
|
||||
return 0;
|
||||
}
|
||||
|
||||
+
|
||||
+static int mediacodec_jni_setParameter(FFAMediaCodec *ctx, const char* name, int value)
|
||||
+{
|
||||
+ JNIEnv *env = NULL;
|
||||
+ struct JNIABundleFields jfields = { 0 };
|
||||
+ jobject object = NULL;
|
||||
+ jstring key = NULL;
|
||||
+ FFAMediaCodecJni *codec = (FFAMediaCodecJni *)ctx;
|
||||
+ void *log_ctx = codec;
|
||||
+ int ret = -1;
|
||||
+
|
||||
+ JNI_GET_ENV_OR_RETURN(env, codec, AVERROR_EXTERNAL);
|
||||
+
|
||||
+ if (ff_jni_init_jfields(env, &jfields, jni_abundle_mapping, 0, log_ctx) < 0) {
|
||||
+ av_log(log_ctx, AV_LOG_ERROR, "Failed to init jfields\n");
|
||||
+ goto fail;
|
||||
+ }
|
||||
+
|
||||
+ object = (*env)->NewObject(env, jfields.bundle_class, jfields.init_id);
|
||||
+ if (!object) {
|
||||
+ av_log(log_ctx, AV_LOG_ERROR, "Failed to create bundle object\n");
|
||||
+ goto fail;
|
||||
+ }
|
||||
+
|
||||
+ key = ff_jni_utf_chars_to_jstring(env, name, log_ctx);
|
||||
+ if (!key) {
|
||||
+ av_log(log_ctx, AV_LOG_ERROR, "Failed to convert key to jstring\n");
|
||||
+ goto fail;
|
||||
+ }
|
||||
+
|
||||
+ (*env)->CallVoidMethod(env, object, jfields.put_int_id, key, value);
|
||||
+ if (ff_jni_exception_check(env, 1, log_ctx) < 0) {
|
||||
+ goto fail;
|
||||
+ }
|
||||
+
|
||||
+ if (!codec->jfields.set_parameters_id) {
|
||||
+ av_log(log_ctx, AV_LOG_ERROR, "System doesn't support setParameters\n");
|
||||
+ goto fail;
|
||||
+ }
|
||||
+
|
||||
+ (*env)->CallVoidMethod(env, codec->object, codec->jfields.set_parameters_id, object);
|
||||
+ if (ff_jni_exception_check(env, 1, log_ctx) < 0) {
|
||||
+ goto fail;
|
||||
+ }
|
||||
+
|
||||
+ ret = 0;
|
||||
+
|
||||
+fail:
|
||||
+ if (key) {
|
||||
+ (*env)->DeleteLocalRef(env, key);
|
||||
+ }
|
||||
+ if (object) {
|
||||
+ (*env)->DeleteLocalRef(env, object);
|
||||
+ }
|
||||
+ ff_jni_reset_jfields(env, &jfields, jni_abundle_mapping, 0, log_ctx);
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static int mediacodec_jni_setDynamicBitrate(FFAMediaCodec *ctx, int bitrate)
|
||||
+{
|
||||
+ return mediacodec_jni_setParameter(ctx, PARAMETER_KEY_VIDEO_BITRATE, bitrate);
|
||||
+}
|
||||
+
|
||||
static const FFAMediaFormat media_format_jni = {
|
||||
.class = &amediaformat_class,
|
||||
|
||||
@@ -1821,6 +1909,8 @@ static const FFAMediaCodec media_codec_jni = {
|
||||
.getConfigureFlagEncode = mediacodec_jni_getConfigureFlagEncode,
|
||||
.cleanOutputBuffers = mediacodec_jni_cleanOutputBuffers,
|
||||
.signalEndOfInputStream = mediacodec_jni_signalEndOfInputStream,
|
||||
+
|
||||
+ .setDynamicBitrate = mediacodec_jni_setDynamicBitrate,
|
||||
};
|
||||
|
||||
typedef struct FFAMediaFormatNdk {
|
||||
@@ -2335,6 +2425,12 @@ static int mediacodec_ndk_signalEndOfInputStream(FFAMediaCodec *ctx)
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static int mediacodec_ndk_setDynamicBitrate(FFAMediaCodec *ctx, int bitrate)
|
||||
+{
|
||||
+ av_log(ctx, AV_LOG_ERROR, "ndk setDynamicBitrate unavailable\n");
|
||||
+ return -1;
|
||||
+}
|
||||
+
|
||||
static const FFAMediaFormat media_format_ndk = {
|
||||
.class = &amediaformat_ndk_class,
|
||||
|
||||
@@ -2396,6 +2492,8 @@ static const FFAMediaCodec media_codec_ndk = {
|
||||
.getConfigureFlagEncode = mediacodec_ndk_getConfigureFlagEncode,
|
||||
.cleanOutputBuffers = mediacodec_ndk_cleanOutputBuffers,
|
||||
.signalEndOfInputStream = mediacodec_ndk_signalEndOfInputStream,
|
||||
+
|
||||
+ .setDynamicBitrate = mediacodec_ndk_setDynamicBitrate,
|
||||
};
|
||||
|
||||
FFAMediaFormat *ff_AMediaFormat_new(int ndk)
|
||||
diff --git a/libavcodec/mediacodec_wrapper.h b/libavcodec/mediacodec_wrapper.h
|
||||
index 11a4260497..86c64556ad 100644
|
||||
--- a/libavcodec/mediacodec_wrapper.h
|
||||
+++ b/libavcodec/mediacodec_wrapper.h
|
||||
@@ -219,6 +219,8 @@ struct FFAMediaCodec {
|
||||
|
||||
// For encoder with FFANativeWindow as input.
|
||||
int (*signalEndOfInputStream)(FFAMediaCodec *);
|
||||
+
|
||||
+ int (*setDynamicBitrate)(FFAMediaCodec *codec, int bitrate);
|
||||
};
|
||||
|
||||
static inline char *ff_AMediaCodec_getName(FFAMediaCodec *codec)
|
||||
@@ -343,6 +345,11 @@ static inline int ff_AMediaCodec_signalEndOfInputStream(FFAMediaCodec *codec)
|
||||
return codec->signalEndOfInputStream(codec);
|
||||
}
|
||||
|
||||
+static inline int ff_AMediaCodec_setDynamicBitrate(FFAMediaCodec *codec, int bitrate)
|
||||
+{
|
||||
+ return codec->setDynamicBitrate(codec, bitrate);
|
||||
+}
|
||||
+
|
||||
int ff_Build_SDK_INT(AVCodecContext *avctx);
|
||||
|
||||
enum FFAMediaFormatColorRange {
|
||||
diff --git a/libavcodec/mediacodecenc.c b/libavcodec/mediacodecenc.c
|
||||
index 6ca3968a24..221f7360f4 100644
|
||||
--- a/libavcodec/mediacodecenc.c
|
||||
+++ b/libavcodec/mediacodecenc.c
|
||||
@@ -76,6 +76,8 @@ typedef struct MediaCodecEncContext {
|
||||
int level;
|
||||
int pts_as_dts;
|
||||
int extract_extradata;
|
||||
+
|
||||
+ int last_bit_rate;
|
||||
} MediaCodecEncContext;
|
||||
|
||||
enum {
|
||||
@@ -193,6 +195,8 @@ static av_cold int mediacodec_init(AVCodecContext *avctx)
|
||||
int ret;
|
||||
int gop;
|
||||
|
||||
+ s->last_bit_rate = avctx->bit_rate;
|
||||
+
|
||||
if (s->use_ndk_codec < 0)
|
||||
s->use_ndk_codec = !av_jni_get_java_vm(avctx);
|
||||
|
||||
@@ -542,11 +546,25 @@ static int mediacodec_send(AVCodecContext *avctx,
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static void update_config(AVCodecContext *avctx)
|
||||
+{
|
||||
+ MediaCodecEncContext *s = avctx->priv_data;
|
||||
+ if (avctx->bit_rate != s->last_bit_rate) {
|
||||
+ s->last_bit_rate = avctx->bit_rate;
|
||||
+ if (0 != ff_AMediaCodec_setDynamicBitrate(s->codec, avctx->bit_rate)) {
|
||||
+ av_log(avctx, AV_LOG_ERROR, "Failed to set bitrate to %d\n", avctx->bit_rate);
|
||||
+ } else {
|
||||
+ av_log(avctx, AV_LOG_INFO, "Set bitrate to %d\n", avctx->bit_rate);
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static int mediacodec_encode(AVCodecContext *avctx, AVPacket *pkt)
|
||||
{
|
||||
MediaCodecEncContext *s = avctx->priv_data;
|
||||
int ret;
|
||||
|
||||
+ update_config(avctx);
|
||||
// Return on three case:
|
||||
// 1. Serious error
|
||||
// 2. Got a packet success
|
||||
--
|
||||
2.43.0.windows.1
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,30 @@
|
||||
From 595f0468e127f204741b6c37a479d71daaf571eb Mon Sep 17 00:00:00 2001
|
||||
From: 21pages <sunboeasy@gmail.com>
|
||||
Date: Tue, 10 Dec 2024 21:17:14 +0800
|
||||
Subject: [PATCH] fix linux configure
|
||||
|
||||
Signed-off-by: 21pages <sunboeasy@gmail.com>
|
||||
---
|
||||
configure | 6 ------
|
||||
1 file changed, 6 deletions(-)
|
||||
|
||||
diff --git a/configure b/configure
|
||||
index d77a55b653..48ca90ac5e 100755
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -7071,12 +7071,6 @@ enabled mmal && { check_lib mmal interface/mmal/mmal.h mmal_port_co
|
||||
check_lib mmal interface/mmal/mmal.h mmal_port_connect -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host; } ||
|
||||
die "ERROR: mmal not found" &&
|
||||
check_func_headers interface/mmal/mmal.h "MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS"; }
|
||||
-enabled openal && { check_pkg_config openal "openal >= 1.1" "AL/al.h" alGetError ||
|
||||
- { for al_extralibs in "${OPENAL_LIBS}" "-lopenal" "-lOpenAL32"; do
|
||||
- check_lib openal 'AL/al.h' alGetError "${al_extralibs}" && break; done } ||
|
||||
- die "ERROR: openal not found"; } &&
|
||||
- { test_cpp_condition "AL/al.h" "defined(AL_VERSION_1_1)" ||
|
||||
- die "ERROR: openal must be installed and version must be 1.1 or compatible"; }
|
||||
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 ||
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
From 1440f556234d135ce58a2ef38916c6a63b05870e Mon Sep 17 00:00:00 2001
|
||||
From: 21pages <sunboeasy@gmail.com>
|
||||
Date: Sat, 14 Dec 2024 21:39:44 +0800
|
||||
Subject: [PATCH] remove amf loop query
|
||||
|
||||
Signed-off-by: 21pages <sunboeasy@gmail.com>
|
||||
---
|
||||
libavcodec/amfenc.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libavcodec/amfenc.c b/libavcodec/amfenc.c
|
||||
index f70f0109f6..a53a05b16b 100644
|
||||
--- a/libavcodec/amfenc.c
|
||||
+++ b/libavcodec/amfenc.c
|
||||
@@ -886,7 +886,7 @@ int ff_amf_receive_packet(AVCodecContext *avctx, AVPacket *avpkt)
|
||||
av_usleep(1000);
|
||||
}
|
||||
}
|
||||
- } while (block_and_wait);
|
||||
+ } while (false); // already set query timeout
|
||||
|
||||
if (res_query == AMF_EOF) {
|
||||
ret = AVERROR_EOF;
|
||||
--
|
||||
2.43.0.windows.1
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
From bec8d49e75b37806e1cff39c75027860fde0bfa2 Mon Sep 17 00:00:00 2001
|
||||
From: 21pages <sunboeasy@gmail.com>
|
||||
Date: Fri, 27 Dec 2024 08:43:12 +0800
|
||||
Subject: [PATCH] fix nvenc reconfigure blur
|
||||
|
||||
Signed-off-by: 21pages <sunboeasy@gmail.com>
|
||||
---
|
||||
libavcodec/nvenc.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
|
||||
index 2cce478be0..f4c559b7ce 100644
|
||||
--- a/libavcodec/nvenc.c
|
||||
+++ b/libavcodec/nvenc.c
|
||||
@@ -2741,8 +2741,8 @@ static void reconfig_encoder(AVCodecContext *avctx, const AVFrame *frame)
|
||||
}
|
||||
|
||||
if (reconfig_bitrate) {
|
||||
- params.resetEncoder = 1;
|
||||
- params.forceIDR = 1;
|
||||
+ params.resetEncoder = 0;
|
||||
+ params.forceIDR = 0;
|
||||
|
||||
needs_encode_config = 1;
|
||||
needs_reconfig = 1;
|
||||
--
|
||||
2.43.0.windows.1
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
diff --git a/compat/w32dlfcn.h b/compat/w32dlfcn.h
|
||||
index ac20e83..1e83aa6 100644
|
||||
--- a/compat/w32dlfcn.h
|
||||
+++ b/compat/w32dlfcn.h
|
||||
@@ -76,6 +76,7 @@ static inline HMODULE win32_dlopen(const char *name)
|
||||
if (!name_w)
|
||||
goto exit;
|
||||
namelen = wcslen(name_w);
|
||||
+ /*
|
||||
// Try local directory first
|
||||
path = get_module_filename(NULL);
|
||||
if (!path)
|
||||
@@ -91,6 +92,7 @@ static inline HMODULE win32_dlopen(const char *name)
|
||||
path = new_path;
|
||||
wcscpy(path + pathlen + 1, name_w);
|
||||
module = LoadLibraryExW(path, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
|
||||
+ */
|
||||
if (module == NULL) {
|
||||
// Next try System32 directory
|
||||
pathlen = GetSystemDirectoryW(path, pathsize);
|
||||
@@ -131,7 +133,9 @@ exit:
|
||||
return NULL;
|
||||
module = LoadPackagedLibrary(name_w, 0);
|
||||
#else
|
||||
-#define LOAD_FLAGS (LOAD_LIBRARY_SEARCH_APPLICATION_DIR | LOAD_LIBRARY_SEARCH_SYSTEM32)
|
||||
+// #define LOAD_FLAGS (LOAD_LIBRARY_SEARCH_APPLICATION_DIR | LOAD_LIBRARY_SEARCH_SYSTEM32)
|
||||
+// Don't dynamic-link libraries from the application directory.
|
||||
+ #define LOAD_FLAGS LOAD_LIBRARY_SEARCH_SYSTEM32
|
||||
/* filename may be be in CP_ACP */
|
||||
if (!name_w)
|
||||
return LoadLibraryExA(name, NULL, LOAD_FLAGS);
|
||||
@@ -0,0 +1,42 @@
|
||||
From a609e1666c79ccce4faf7aa61d509bf202df9149 Mon Sep 17 00:00:00 2001
|
||||
From: 21pages <sunboeasy@gmail.com>
|
||||
Date: Fri, 5 Sep 2025 21:35:37 +0800
|
||||
Subject: [PATCH] android mediacodec encode align 64
|
||||
|
||||
Signed-off-by: 21pages <sunboeasy@gmail.com>
|
||||
---
|
||||
libavcodec/mediacodecenc.c | 11 ++++++-----
|
||||
1 file changed, 6 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/libavcodec/mediacodecenc.c b/libavcodec/mediacodecenc.c
|
||||
index 221f7360f4..768c8151df 100644
|
||||
--- a/libavcodec/mediacodecenc.c
|
||||
+++ b/libavcodec/mediacodecenc.c
|
||||
@@ -242,18 +242,19 @@ static av_cold int mediacodec_init(AVCodecContext *avctx)
|
||||
ff_AMediaFormat_setString(format, "mime", codec_mime);
|
||||
// Workaround the alignment requirement of mediacodec. We can't do it
|
||||
// silently for AV_PIX_FMT_MEDIACODEC.
|
||||
+ const int align = 64;
|
||||
if (avctx->pix_fmt != AV_PIX_FMT_MEDIACODEC &&
|
||||
(avctx->codec_id == AV_CODEC_ID_H264 ||
|
||||
avctx->codec_id == AV_CODEC_ID_HEVC)) {
|
||||
- s->width = FFALIGN(avctx->width, 16);
|
||||
- s->height = FFALIGN(avctx->height, 16);
|
||||
+ s->width = FFALIGN(avctx->width, align);
|
||||
+ s->height = FFALIGN(avctx->height, align);
|
||||
} else {
|
||||
s->width = avctx->width;
|
||||
s->height = avctx->height;
|
||||
- if (s->width % 16 || s->height % 16)
|
||||
+ if (s->width % align || s->height % align)
|
||||
av_log(avctx, AV_LOG_WARNING,
|
||||
- "Video size %dx%d isn't align to 16, it may have device compatibility issue\n",
|
||||
- s->width, s->height);
|
||||
+ "Video size %dx%d isn't align to %d, it may have device compatibility issue\n",
|
||||
+ s->width, s->height, align);
|
||||
}
|
||||
ff_AMediaFormat_setInt32(format, "width", s->width);
|
||||
ff_AMediaFormat_setInt32(format, "height", s->height);
|
||||
--
|
||||
2.43.0.windows.1
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: RustDesk <support@rustdesk.com>
|
||||
Date: Fri, 1 Nov 2025 08:00:00 +0000
|
||||
Subject: [PATCH] Fix CVBufferCopyAttachments crash on macOS Big Sur
|
||||
|
||||
Use weak linking for CVBufferCopyAttachments to avoid symbol resolution
|
||||
crash on macOS < 12. The function will be NULL on older systems and the
|
||||
code will fall back to the deprecated CVBufferGetAttachments.
|
||||
|
||||
This fixes a crash on macOS Big Sur (11.x) where CVBufferCopyAttachments
|
||||
is not available. The runtime check with __builtin_available is not enough
|
||||
because the symbol is still resolved at load time, causing a dyld error.
|
||||
|
||||
Fixes: https://github.com/rustdesk/rustdesk/issues/13377
|
||||
---
|
||||
libavutil/hwcontext_videotoolbox.c | 21 ++++++++++++++++++++-
|
||||
1 file changed, 20 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libavutil/hwcontext_videotoolbox.c b/libavutil/hwcontext_videotoolbox.c
|
||||
index 0000000000..1111111111 100644
|
||||
--- a/libavutil/hwcontext_videotoolbox.c
|
||||
+++ b/libavutil/hwcontext_videotoolbox.c
|
||||
@@ -33,6 +33,25 @@
|
||||
#include "pixfmt.h"
|
||||
#include "pixdesc.h"
|
||||
|
||||
+// Weak import CVBufferCopyAttachments to support macOS < 12
|
||||
+// The runtime check with __builtin_available is not enough because
|
||||
+// the symbol is still resolved at load time, causing dyld errors on Big Sur.
|
||||
+// With weak_import, the function pointer will be NULL on older systems.
|
||||
+#if TARGET_OS_OSX && defined(__MAC_12_0) && __MAC_OS_X_VERSION_MAX_ALLOWED >= __MAC_12_0
|
||||
+extern CFDictionaryRef CVBufferCopyAttachments(CVBufferRef buffer, CVAttachmentMode mode)
|
||||
+ __attribute__((weak_import));
|
||||
+#endif
|
||||
+#if TARGET_OS_IOS && defined(__IPHONE_15_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_15_0
|
||||
+extern CFDictionaryRef CVBufferCopyAttachments(CVBufferRef buffer, CVAttachmentMode mode)
|
||||
+ __attribute__((weak_import));
|
||||
+#endif
|
||||
+#if TARGET_OS_TV && defined(__TVOS_15_0) && __TV_OS_VERSION_MAX_ALLOWED >= __TVOS_15_0
|
||||
+extern CFDictionaryRef CVBufferCopyAttachments(CVBufferRef buffer, CVAttachmentMode mode)
|
||||
+ __attribute__((weak_import));
|
||||
+#endif
|
||||
+
|
||||
+// End of weak import section
|
||||
+
|
||||
typedef struct VTFramesContext {
|
||||
/**
|
||||
* The public AVVTFramesContext. See hwcontext_videotoolbox.h for it.
|
||||
@@ -547,7 +566,7 @@ static CFDictionaryRef vt_cv_buffer_copy_attachments(CVBufferRef buffer,
|
||||
(TARGET_OS_TV && defined(__TVOS_15_0) && __TV_OS_VERSION_MAX_ALLOWED >= __TVOS_15_0)
|
||||
// On recent enough versions, just use the respective API
|
||||
if (__builtin_available(macOS 12.0, iOS 15.0, tvOS 15.0, *))
|
||||
- return CVBufferCopyAttachments(buffer, attachment_mode);
|
||||
+ if (CVBufferCopyAttachments != NULL) return CVBufferCopyAttachments(buffer, attachment_mode);
|
||||
#endif
|
||||
|
||||
// Check that the target is lower than macOS 12 / iOS 15 / tvOS 15
|
||||
--
|
||||
2.43.0
|
||||
|
||||
@@ -0,0 +1,705 @@
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO ffmpeg/ffmpeg
|
||||
REF "n${VERSION}"
|
||||
SHA512 3b273769ef1a1b63aed0691eef317a760f8c83b1d0e1c232b67bbee26db60b4864aafbc88df0e86d6bebf07185bbd057f33e2d5258fde6d97763b9994cd48b6f
|
||||
HEAD_REF master
|
||||
PATCHES
|
||||
0001-create-lib-libraries.patch
|
||||
0002-fix-msvc-link.patch
|
||||
0003-fix-windowsinclude.patch
|
||||
0004-dependencies.patch
|
||||
0005-fix-nasm.patch
|
||||
0007-fix-lib-naming.patch
|
||||
0013-define-WINVER.patch
|
||||
0020-fix-aarch64-libswscale.patch
|
||||
0024-fix-osx-host-c11.patch
|
||||
0040-ffmpeg-add-av_stream_get_first_dts-for-chromium.patch # Do not remove this patch. It is required by chromium
|
||||
0041-add-const-for-opengl-definition.patch
|
||||
0043-fix-miss-head.patch
|
||||
patch/0001-avcodec-amfenc-add-query_timeout-option-for-h264-hev.patch
|
||||
patch/0002-libavcodec-amfenc-reconfig-when-bitrate-change.patch
|
||||
patch/0004-videotoolbox-changing-bitrate.patch
|
||||
patch/0005-mediacodec-changing-bitrate.patch
|
||||
patch/0006-dlopen-libva.patch
|
||||
patch/0007-fix-linux-configure.patch
|
||||
patch/0008-remove-amf-loop-query.patch
|
||||
patch/0009-fix-nvenc-reconfigure-blur.patch
|
||||
patch/0010.disable-loading-DLLs-from-app-dir.patch
|
||||
patch/0011-android-mediacodec-encode-align-64.patch
|
||||
patch/0012-fix-macos-big-sur-CVBufferCopyAttachments.patch
|
||||
)
|
||||
|
||||
if(SOURCE_PATH MATCHES " ")
|
||||
message(FATAL_ERROR "Error: ffmpeg will not build with spaces in the path. Please use a directory with no spaces")
|
||||
endif()
|
||||
|
||||
if(NOT VCPKG_TARGET_ARCHITECTURE STREQUAL "wasm32")
|
||||
vcpkg_find_acquire_program(NASM)
|
||||
get_filename_component(NASM_EXE_PATH "${NASM}" DIRECTORY)
|
||||
vcpkg_add_to_path("${NASM_EXE_PATH}")
|
||||
endif()
|
||||
|
||||
set(OPTIONS "\
|
||||
--disable-shared \
|
||||
--enable-static \
|
||||
--enable-pic \
|
||||
--disable-everything \
|
||||
--disable-programs \
|
||||
--disable-doc \
|
||||
--disable-htmlpages \
|
||||
--disable-manpages \
|
||||
--disable-podpages \
|
||||
--disable-txtpages \
|
||||
--disable-network \
|
||||
--disable-appkit \
|
||||
--disable-coreimage \
|
||||
--disable-metal \
|
||||
--disable-sdl2 \
|
||||
--disable-securetransport \
|
||||
--disable-vulkan \
|
||||
--disable-audiotoolbox \
|
||||
--disable-v4l2-m2m \
|
||||
--disable-debug \
|
||||
--disable-valgrind-backtrace \
|
||||
--disable-large-tests \
|
||||
--disable-bzlib \
|
||||
--disable-avdevice \
|
||||
--enable-avcodec \
|
||||
--enable-avformat \
|
||||
--disable-avfilter \
|
||||
--disable-swresample \
|
||||
--disable-swscale \
|
||||
--disable-postproc \
|
||||
--enable-decoder=h264 \
|
||||
--enable-decoder=hevc \
|
||||
--enable-parser=h264 \
|
||||
--enable-parser=hevc \
|
||||
--enable-bsf=h264_mp4toannexb \
|
||||
--enable-bsf=hevc_mp4toannexb \
|
||||
--enable-bsf=h264_metadata \
|
||||
--enable-bsf=hevc_metadata \
|
||||
--enable-muxer=mp4 \
|
||||
--enable-protocol=file \
|
||||
")
|
||||
|
||||
if(VCPKG_HOST_IS_WINDOWS)
|
||||
vcpkg_acquire_msys(MSYS_ROOT PACKAGES automake1.16)
|
||||
set(SHELL "${MSYS_ROOT}/usr/bin/bash.exe")
|
||||
vcpkg_add_to_path("${MSYS_ROOT}/usr/share/automake-1.16")
|
||||
string(APPEND OPTIONS " --pkg-config=${CURRENT_HOST_INSTALLED_DIR}/tools/pkgconf/pkgconf${VCPKG_HOST_EXECUTABLE_SUFFIX}")
|
||||
else()
|
||||
find_program(SHELL bash)
|
||||
endif()
|
||||
|
||||
if(VCPKG_TARGET_IS_LINUX)
|
||||
string(APPEND OPTIONS "\
|
||||
--target-os=linux \
|
||||
--enable-pthreads \
|
||||
--disable-vdpau \
|
||||
")
|
||||
|
||||
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm")
|
||||
else()
|
||||
string(APPEND OPTIONS "\
|
||||
--enable-cuda \
|
||||
--enable-ffnvcodec \
|
||||
--enable-encoder=h264_nvenc \
|
||||
--enable-encoder=hevc_nvenc \
|
||||
--enable-hwaccel=h264_nvdec \
|
||||
--enable-hwaccel=hevc_nvdec \
|
||||
--enable-amf \
|
||||
--enable-encoder=h264_amf \
|
||||
--enable-encoder=hevc_amf \
|
||||
--enable-hwaccel=h264_vaapi \
|
||||
--enable-hwaccel=hevc_vaapi \
|
||||
--enable-encoder=h264_vaapi \
|
||||
--enable-encoder=hevc_vaapi \
|
||||
")
|
||||
|
||||
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
|
||||
string(APPEND OPTIONS "\
|
||||
--enable-cuda_llvm \
|
||||
")
|
||||
endif()
|
||||
endif()
|
||||
elseif(VCPKG_TARGET_IS_WINDOWS)
|
||||
string(APPEND OPTIONS "\
|
||||
--target-os=win32 \
|
||||
--toolchain=msvc \
|
||||
--cc=cl \
|
||||
--enable-gpl \
|
||||
--enable-d3d11va \
|
||||
--enable-cuda \
|
||||
--enable-ffnvcodec \
|
||||
--enable-hwaccel=h264_nvdec \
|
||||
--enable-hwaccel=hevc_nvdec \
|
||||
--enable-hwaccel=h264_d3d11va \
|
||||
--enable-hwaccel=hevc_d3d11va \
|
||||
--enable-hwaccel=h264_d3d11va2 \
|
||||
--enable-hwaccel=hevc_d3d11va2 \
|
||||
--enable-amf \
|
||||
--enable-encoder=h264_amf \
|
||||
--enable-encoder=hevc_amf \
|
||||
--enable-encoder=h264_nvenc \
|
||||
--enable-encoder=hevc_nvenc \
|
||||
--enable-libmfx \
|
||||
--enable-encoder=h264_qsv \
|
||||
--enable-encoder=hevc_qsv \
|
||||
")
|
||||
|
||||
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86")
|
||||
set(LIB_MACHINE_ARG /machine:x86)
|
||||
string(APPEND OPTIONS " --arch=i686 --enable-cross-compile")
|
||||
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
|
||||
set(LIB_MACHINE_ARG /machine:x64)
|
||||
string(APPEND OPTIONS " --arch=x86_64")
|
||||
else()
|
||||
message(FATAL_ERROR "Unsupported target architecture")
|
||||
endif()
|
||||
elseif(VCPKG_TARGET_IS_OSX)
|
||||
string(APPEND OPTIONS "\
|
||||
--disable-autodetect \
|
||||
--enable-videotoolbox \
|
||||
--enable-encoder=h264_videotoolbox,hevc_videotoolbox \
|
||||
--enable-hwaccel=h264_videotoolbox,hevc_videotoolbox \
|
||||
")
|
||||
elseif(VCPKG_TARGET_IS_IOS)
|
||||
string(APPEND OPTIONS "\
|
||||
--arch=arm64 \
|
||||
--disable-autodetect \
|
||||
--disable-hwaccels \
|
||||
--disable-encoders \
|
||||
--disable-videotoolbox \
|
||||
--extra-cflags=\"-arch arm64 -mios-version-min=8.0 -fembed-bitcode\" \
|
||||
--extra-ldflags=\"-arch arm64 -mios-version-min=8.0 -fembed-bitcode\" \
|
||||
")
|
||||
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Android")
|
||||
string(APPEND OPTIONS "\
|
||||
--target-os=android \
|
||||
--disable-asm \
|
||||
--disable-iconv \
|
||||
--enable-jni \
|
||||
--enable-mediacodec \
|
||||
--disable-hwaccels \
|
||||
--enable-encoder=h264_mediacodec \
|
||||
--enable-encoder=hevc_mediacodec \
|
||||
--enable-decoder=h264_mediacodec \
|
||||
--enable-decoder=hevc_mediacodec \
|
||||
")
|
||||
endif()
|
||||
|
||||
if(VCPKG_TARGET_IS_OSX)
|
||||
list(JOIN VCPKG_OSX_ARCHITECTURES " " OSX_ARCHS)
|
||||
list(LENGTH VCPKG_OSX_ARCHITECTURES OSX_ARCH_COUNT)
|
||||
endif()
|
||||
|
||||
vcpkg_cmake_get_vars(cmake_vars_file)
|
||||
include("${cmake_vars_file}")
|
||||
|
||||
if(VCPKG_DETECTED_MSVC)
|
||||
string(APPEND OPTIONS " --disable-inline-asm") # clang-cl has inline assembly but this leads to undefined symbols.
|
||||
set(OPTIONS "--toolchain=msvc ${OPTIONS}")
|
||||
|
||||
# This is required because ffmpeg depends upon optimizations to link correctly
|
||||
string(APPEND VCPKG_COMBINED_C_FLAGS_DEBUG " -O2")
|
||||
string(REGEX REPLACE "(^| )-RTC1( |$)" " " VCPKG_COMBINED_C_FLAGS_DEBUG "${VCPKG_COMBINED_C_FLAGS_DEBUG}")
|
||||
string(REGEX REPLACE "(^| )-Od( |$)" " " VCPKG_COMBINED_C_FLAGS_DEBUG "${VCPKG_COMBINED_C_FLAGS_DEBUG}")
|
||||
string(REGEX REPLACE "(^| )-Ob0( |$)" " " VCPKG_COMBINED_C_FLAGS_DEBUG "${VCPKG_COMBINED_C_FLAGS_DEBUG}")
|
||||
endif()
|
||||
|
||||
string(APPEND VCPKG_COMBINED_C_FLAGS_DEBUG " -I \"${CURRENT_INSTALLED_DIR}/include\"")
|
||||
string(APPEND VCPKG_COMBINED_C_FLAGS_RELEASE " -I \"${CURRENT_INSTALLED_DIR}/include\"")
|
||||
|
||||
if(VCPKG_TARGET_IS_WINDOWS)
|
||||
string(APPEND VCPKG_COMBINED_C_FLAGS_DEBUG " -I \"${CURRENT_INSTALLED_DIR}/include/mfx\"")
|
||||
string(APPEND VCPKG_COMBINED_C_FLAGS_RELEASE " -I \"${CURRENT_INSTALLED_DIR}/include/mfx\"")
|
||||
endif()
|
||||
|
||||
# # Setup vcpkg toolchain
|
||||
set(prog_env "")
|
||||
|
||||
if(VCPKG_DETECTED_CMAKE_C_COMPILER)
|
||||
get_filename_component(CC_path "${VCPKG_DETECTED_CMAKE_C_COMPILER}" DIRECTORY)
|
||||
get_filename_component(CC_filename "${VCPKG_DETECTED_CMAKE_C_COMPILER}" NAME)
|
||||
set(ENV{CC} "${CC_filename}")
|
||||
string(APPEND OPTIONS " --cc=${CC_filename}")
|
||||
|
||||
if(VCPKG_HOST_IS_WINDOWS)
|
||||
string(APPEND OPTIONS " --host_cc=${CC_filename}")
|
||||
endif()
|
||||
|
||||
list(APPEND prog_env "${CC_path}")
|
||||
endif()
|
||||
|
||||
if(VCPKG_DETECTED_CMAKE_CXX_COMPILER)
|
||||
get_filename_component(CXX_path "${VCPKG_DETECTED_CMAKE_CXX_COMPILER}" DIRECTORY)
|
||||
get_filename_component(CXX_filename "${VCPKG_DETECTED_CMAKE_CXX_COMPILER}" NAME)
|
||||
set(ENV{CXX} "${CXX_filename}")
|
||||
string(APPEND OPTIONS " --cxx=${CXX_filename}")
|
||||
|
||||
# string(APPEND OPTIONS " --host_cxx=${CC_filename}")
|
||||
list(APPEND prog_env "${CXX_path}")
|
||||
endif()
|
||||
|
||||
if(VCPKG_DETECTED_CMAKE_RC_COMPILER)
|
||||
get_filename_component(RC_path "${VCPKG_DETECTED_CMAKE_RC_COMPILER}" DIRECTORY)
|
||||
get_filename_component(RC_filename "${VCPKG_DETECTED_CMAKE_RC_COMPILER}" NAME)
|
||||
set(ENV{WINDRES} "${RC_filename}")
|
||||
string(APPEND OPTIONS " --windres=${RC_filename}")
|
||||
list(APPEND prog_env "${RC_path}")
|
||||
endif()
|
||||
|
||||
if(VCPKG_DETECTED_CMAKE_LINKER AND VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
|
||||
get_filename_component(LD_path "${VCPKG_DETECTED_CMAKE_LINKER}" DIRECTORY)
|
||||
get_filename_component(LD_filename "${VCPKG_DETECTED_CMAKE_LINKER}" NAME)
|
||||
set(ENV{LD} "${LD_filename}")
|
||||
string(APPEND OPTIONS " --ld=${LD_filename}")
|
||||
|
||||
# string(APPEND OPTIONS " --host_ld=${LD_filename}")
|
||||
list(APPEND prog_env "${LD_path}")
|
||||
endif()
|
||||
|
||||
if(VCPKG_DETECTED_CMAKE_NM)
|
||||
get_filename_component(NM_path "${VCPKG_DETECTED_CMAKE_NM}" DIRECTORY)
|
||||
get_filename_component(NM_filename "${VCPKG_DETECTED_CMAKE_NM}" NAME)
|
||||
set(ENV{NM} "${NM_filename}")
|
||||
string(APPEND OPTIONS " --nm=${NM_filename}")
|
||||
list(APPEND prog_env "${NM_path}")
|
||||
endif()
|
||||
|
||||
if(VCPKG_DETECTED_CMAKE_AR)
|
||||
get_filename_component(AR_path "${VCPKG_DETECTED_CMAKE_AR}" DIRECTORY)
|
||||
get_filename_component(AR_filename "${VCPKG_DETECTED_CMAKE_AR}" NAME)
|
||||
|
||||
if(AR_filename MATCHES [[^(llvm-)?lib\.exe$]])
|
||||
set(ENV{AR} "ar-lib ${AR_filename}")
|
||||
string(APPEND OPTIONS " --ar='ar-lib ${AR_filename}'")
|
||||
else()
|
||||
set(ENV{AR} "${AR_filename}")
|
||||
string(APPEND OPTIONS " --ar='${AR_filename}'")
|
||||
endif()
|
||||
|
||||
list(APPEND prog_env "${AR_path}")
|
||||
endif()
|
||||
|
||||
if(VCPKG_DETECTED_CMAKE_RANLIB)
|
||||
get_filename_component(RANLIB_path "${VCPKG_DETECTED_CMAKE_RANLIB}" DIRECTORY)
|
||||
get_filename_component(RANLIB_filename "${VCPKG_DETECTED_CMAKE_RANLIB}" NAME)
|
||||
set(ENV{RANLIB} "${RANLIB_filename}")
|
||||
string(APPEND OPTIONS " --ranlib=${RANLIB_filename}")
|
||||
list(APPEND prog_env "${RANLIB_path}")
|
||||
endif()
|
||||
|
||||
if(VCPKG_DETECTED_CMAKE_STRIP)
|
||||
get_filename_component(STRIP_path "${VCPKG_DETECTED_CMAKE_STRIP}" DIRECTORY)
|
||||
get_filename_component(STRIP_filename "${VCPKG_DETECTED_CMAKE_STRIP}" NAME)
|
||||
set(ENV{STRIP} "${STRIP_filename}")
|
||||
string(APPEND OPTIONS " --strip=${STRIP_filename}")
|
||||
list(APPEND prog_env "${STRIP_path}")
|
||||
endif()
|
||||
|
||||
if(VCPKG_HOST_IS_WINDOWS)
|
||||
vcpkg_acquire_msys(MSYS_ROOT PACKAGES automake1.16)
|
||||
set(SHELL "${MSYS_ROOT}/usr/bin/bash.exe")
|
||||
list(APPEND prog_env "${MSYS_ROOT}/usr/bin" "${MSYS_ROOT}/usr/share/automake-1.16")
|
||||
else()
|
||||
# find_program(SHELL bash)
|
||||
endif()
|
||||
|
||||
list(REMOVE_DUPLICATES prog_env)
|
||||
vcpkg_add_to_path(PREPEND ${prog_env})
|
||||
|
||||
# More? OBJCC BIN2C
|
||||
file(REMOVE_RECURSE "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg" "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel")
|
||||
|
||||
set(FFMPEG_PKGCONFIG_MODULES libavutil)
|
||||
|
||||
set(OPTIONS_CROSS "--enable-cross-compile")
|
||||
|
||||
# ffmpeg needs --cross-prefix option to use appropriate tools for cross-compiling.
|
||||
if(VCPKG_DETECTED_CMAKE_C_COMPILER MATCHES "([^\/]*-)gcc$")
|
||||
string(APPEND OPTIONS_CROSS " --cross-prefix=${CMAKE_MATCH_1}")
|
||||
endif()
|
||||
|
||||
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
|
||||
set(BUILD_ARCH "x86_64")
|
||||
else()
|
||||
set(BUILD_ARCH ${VCPKG_TARGET_ARCHITECTURE})
|
||||
endif()
|
||||
|
||||
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm" OR VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
|
||||
if(VCPKG_TARGET_IS_WINDOWS)
|
||||
vcpkg_find_acquire_program(GASPREPROCESSOR)
|
||||
|
||||
foreach(GAS_PATH ${GASPREPROCESSOR})
|
||||
get_filename_component(GAS_ITEM_PATH ${GAS_PATH} DIRECTORY)
|
||||
vcpkg_add_to_path("${GAS_ITEM_PATH}")
|
||||
endforeach(GAS_PATH)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(OPTIONS_DEBUG "--disable-optimizations")
|
||||
set(OPTIONS_RELEASE "--enable-optimizations")
|
||||
|
||||
set(OPTIONS "${OPTIONS} ${OPTIONS_CROSS}")
|
||||
|
||||
if(VCPKG_TARGET_IS_MINGW)
|
||||
set(OPTIONS "${OPTIONS} --extra_cflags=-D_WIN32_WINNT=0x0601")
|
||||
elseif(VCPKG_TARGET_IS_WINDOWS)
|
||||
set(OPTIONS "${OPTIONS} --extra-cflags=-DHAVE_UNISTD_H=0")
|
||||
endif()
|
||||
|
||||
vcpkg_find_acquire_program(PKGCONFIG)
|
||||
set(OPTIONS "${OPTIONS} --pkg-config=${PKGCONFIG}")
|
||||
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
|
||||
set(OPTIONS "${OPTIONS} --pkg-config-flags=--static")
|
||||
endif()
|
||||
|
||||
message(STATUS "Building Options: ${OPTIONS}")
|
||||
|
||||
# Release build
|
||||
if(NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
|
||||
if(VCPKG_DETECTED_MSVC)
|
||||
set(OPTIONS_RELEASE "${OPTIONS_RELEASE} --extra-ldflags=-libpath:\"${CURRENT_INSTALLED_DIR}/lib\"")
|
||||
else()
|
||||
set(OPTIONS_RELEASE "${OPTIONS_RELEASE} --extra-ldflags=-L\"${CURRENT_INSTALLED_DIR}/lib\"")
|
||||
endif()
|
||||
|
||||
message(STATUS "Building Release Options: ${OPTIONS_RELEASE}")
|
||||
set(ENV{PKG_CONFIG_PATH} "${CURRENT_INSTALLED_DIR}/lib/pkgconfig")
|
||||
message(STATUS "Building ${PORT} for Release")
|
||||
file(MAKE_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel")
|
||||
|
||||
# We use response files here as the only known way to handle spaces in paths
|
||||
set(crsp "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/cflags.rsp")
|
||||
string(REGEX REPLACE "-arch [A-Za-z0-9_]+" "" VCPKG_COMBINED_C_FLAGS_RELEASE_SANITIZED "${VCPKG_COMBINED_C_FLAGS_RELEASE}")
|
||||
file(WRITE "${crsp}" "${VCPKG_COMBINED_C_FLAGS_RELEASE_SANITIZED}")
|
||||
set(ldrsp "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/ldflags.rsp")
|
||||
string(REGEX REPLACE "-arch [A-Za-z0-9_]+" "" VCPKG_COMBINED_SHARED_LINKER_FLAGS_RELEASE_SANITIZED "${VCPKG_COMBINED_SHARED_LINKER_FLAGS_RELEASE}")
|
||||
file(WRITE "${ldrsp}" "${VCPKG_COMBINED_SHARED_LINKER_FLAGS_RELEASE_SANITIZED}")
|
||||
set(ENV{CFLAGS} "@${crsp}")
|
||||
|
||||
# All tools except the msvc arm{,64} assembler accept @... as response file syntax.
|
||||
# For that assembler, there is no known way to pass in flags. We must hope that not passing flags will work acceptably.
|
||||
if(NOT VCPKG_DETECTED_MSVC OR NOT VCPKG_TARGET_ARCHITECTURE MATCHES "^arm")
|
||||
set(ENV{ASFLAGS} "@${crsp}")
|
||||
endif()
|
||||
|
||||
set(ENV{LDFLAGS} "@${ldrsp}")
|
||||
set(ENV{ARFLAGS} "${VCPKG_COMBINED_STATIC_LINKER_FLAGS_RELEASE}")
|
||||
|
||||
set(BUILD_DIR "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel")
|
||||
set(CONFIGURE_OPTIONS "${OPTIONS} ${OPTIONS_RELEASE}")
|
||||
set(INST_PREFIX "${CURRENT_PACKAGES_DIR}")
|
||||
|
||||
configure_file("${CMAKE_CURRENT_LIST_DIR}/build.sh.in" "${BUILD_DIR}/build.sh" @ONLY)
|
||||
|
||||
z_vcpkg_setup_pkgconfig_path(CONFIG RELEASE)
|
||||
|
||||
vcpkg_execute_required_process(
|
||||
COMMAND "${SHELL}" ./build.sh
|
||||
WORKING_DIRECTORY "${BUILD_DIR}"
|
||||
LOGNAME "build-${TARGET_TRIPLET}-rel"
|
||||
SAVE_LOG_FILES ffbuild/config.log
|
||||
)
|
||||
|
||||
z_vcpkg_restore_pkgconfig_path()
|
||||
endif()
|
||||
|
||||
# Debug build
|
||||
if(NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
|
||||
if(VCPKG_DETECTED_MSVC)
|
||||
set(OPTIONS_DEBUG "${OPTIONS_DEBUG} --extra-ldflags=-libpath:\"${CURRENT_INSTALLED_DIR}/debug/lib\"")
|
||||
else()
|
||||
set(OPTIONS_DEBUG "${OPTIONS_DEBUG} --extra-ldflags=-L\"${CURRENT_INSTALLED_DIR}/debug/lib\"")
|
||||
endif()
|
||||
|
||||
message(STATUS "Building Debug Options: ${OPTIONS_DEBUG}")
|
||||
set(ENV{LDFLAGS} "${VCPKG_COMBINED_SHARED_LINKER_FLAGS_DEBUG}")
|
||||
set(ENV{PKG_CONFIG_PATH} "${CURRENT_INSTALLED_DIR}/debug/lib/pkgconfig")
|
||||
message(STATUS "Building ${PORT} for Debug")
|
||||
file(MAKE_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg")
|
||||
set(crsp "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/cflags.rsp")
|
||||
string(REGEX REPLACE "-arch [A-Za-z0-9_]+" "" VCPKG_COMBINED_C_FLAGS_DEBUG_SANITIZED "${VCPKG_COMBINED_C_FLAGS_DEBUG}")
|
||||
file(WRITE "${crsp}" "${VCPKG_COMBINED_C_FLAGS_DEBUG_SANITIZED}")
|
||||
set(ldrsp "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/ldflags.rsp")
|
||||
string(REGEX REPLACE "-arch [A-Za-z0-9_]+" "" VCPKG_COMBINED_SHARED_LINKER_FLAGS_DEBUG_SANITIZED "${VCPKG_COMBINED_SHARED_LINKER_FLAGS_DEBUG}")
|
||||
file(WRITE "${ldrsp}" "${VCPKG_COMBINED_SHARED_LINKER_FLAGS_DEBUG_SANITIZED}")
|
||||
set(ENV{CFLAGS} "@${crsp}")
|
||||
|
||||
if(NOT VCPKG_DETECTED_MSVC OR NOT VCPKG_TARGET_ARCHITECTURE MATCHES "^arm")
|
||||
set(ENV{ASFLAGS} "@${crsp}")
|
||||
endif()
|
||||
|
||||
set(ENV{LDFLAGS} "@${ldrsp}")
|
||||
set(ENV{ARFLAGS} "${VCPKG_COMBINED_STATIC_LINKER_FLAGS_DEBUG}")
|
||||
|
||||
set(BUILD_DIR "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg")
|
||||
set(CONFIGURE_OPTIONS "${OPTIONS} ${OPTIONS_DEBUG}")
|
||||
set(INST_PREFIX "${CURRENT_PACKAGES_DIR}/debug")
|
||||
|
||||
configure_file("${CMAKE_CURRENT_LIST_DIR}/build.sh.in" "${BUILD_DIR}/build.sh" @ONLY)
|
||||
|
||||
z_vcpkg_setup_pkgconfig_path(CONFIG DEBUG)
|
||||
|
||||
vcpkg_execute_required_process(
|
||||
COMMAND "${SHELL}" ./build.sh
|
||||
WORKING_DIRECTORY "${BUILD_DIR}"
|
||||
LOGNAME "build-${TARGET_TRIPLET}-dbg"
|
||||
SAVE_LOG_FILES ffbuild/config.log
|
||||
)
|
||||
|
||||
z_vcpkg_restore_pkgconfig_path()
|
||||
endif()
|
||||
|
||||
if(VCPKG_TARGET_IS_WINDOWS)
|
||||
file(GLOB DEF_FILES "${CURRENT_PACKAGES_DIR}/lib/*.def" "${CURRENT_PACKAGES_DIR}/debug/lib/*.def")
|
||||
|
||||
if(NOT VCPKG_TARGET_IS_MINGW)
|
||||
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm")
|
||||
set(LIB_MACHINE_ARG /machine:ARM)
|
||||
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
|
||||
set(LIB_MACHINE_ARG /machine:ARM64)
|
||||
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86")
|
||||
set(LIB_MACHINE_ARG /machine:x86)
|
||||
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
|
||||
set(LIB_MACHINE_ARG /machine:x64)
|
||||
else()
|
||||
message(FATAL_ERROR "Unsupported target architecture")
|
||||
endif()
|
||||
|
||||
foreach(DEF_FILE ${DEF_FILES})
|
||||
get_filename_component(DEF_FILE_DIR "${DEF_FILE}" DIRECTORY)
|
||||
get_filename_component(DEF_FILE_NAME "${DEF_FILE}" NAME)
|
||||
string(REGEX REPLACE "-[0-9]*\\.def" "${VCPKG_TARGET_STATIC_LIBRARY_SUFFIX}" OUT_FILE_NAME "${DEF_FILE_NAME}")
|
||||
file(TO_NATIVE_PATH "${DEF_FILE}" DEF_FILE_NATIVE)
|
||||
file(TO_NATIVE_PATH "${DEF_FILE_DIR}/${OUT_FILE_NAME}" OUT_FILE_NATIVE)
|
||||
message(STATUS "Generating ${OUT_FILE_NATIVE}")
|
||||
vcpkg_execute_required_process(
|
||||
COMMAND lib.exe "/def:${DEF_FILE_NATIVE}" "/out:${OUT_FILE_NATIVE}" ${LIB_MACHINE_ARG}
|
||||
WORKING_DIRECTORY "${CURRENT_PACKAGES_DIR}"
|
||||
LOGNAME "libconvert-${TARGET_TRIPLET}"
|
||||
)
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
file(GLOB EXP_FILES "${CURRENT_PACKAGES_DIR}/lib/*.exp" "${CURRENT_PACKAGES_DIR}/debug/lib/*.exp")
|
||||
file(GLOB LIB_FILES "${CURRENT_PACKAGES_DIR}/bin/*${VCPKG_TARGET_STATIC_LIBRARY_SUFFIX}" "${CURRENT_PACKAGES_DIR}/debug/bin/*${VCPKG_TARGET_STATIC_LIBRARY_SUFFIX}")
|
||||
|
||||
if(VCPKG_TARGET_IS_MINGW)
|
||||
file(GLOB LIB_FILES_2 "${CURRENT_PACKAGES_DIR}/bin/*.lib" "${CURRENT_PACKAGES_DIR}/debug/bin/*.lib")
|
||||
endif()
|
||||
|
||||
set(files_to_remove ${EXP_FILES} ${LIB_FILES} ${LIB_FILES_2} ${DEF_FILES})
|
||||
|
||||
if(files_to_remove)
|
||||
file(REMOVE ${files_to_remove})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" "${CURRENT_PACKAGES_DIR}/debug/share")
|
||||
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
|
||||
endif()
|
||||
|
||||
vcpkg_copy_pdbs()
|
||||
|
||||
if(VCPKG_TARGET_IS_WINDOWS)
|
||||
set(_dirs "/")
|
||||
|
||||
if(NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
|
||||
list(APPEND _dirs "/debug/")
|
||||
endif()
|
||||
|
||||
foreach(_debug IN LISTS _dirs)
|
||||
foreach(PKGCONFIG_MODULE IN LISTS FFMPEG_PKGCONFIG_MODULES)
|
||||
set(PKGCONFIG_FILE "${CURRENT_PACKAGES_DIR}${_debug}lib/pkgconfig/${PKGCONFIG_MODULE}.pc")
|
||||
|
||||
# remove redundant cygwin style -libpath entries
|
||||
execute_process(
|
||||
COMMAND "${MSYS_ROOT}/usr/bin/cygpath.exe" -u "${CURRENT_INSTALLED_DIR}"
|
||||
OUTPUT_VARIABLE CYG_INSTALLED_DIR
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
vcpkg_replace_string("${PKGCONFIG_FILE}" "-libpath:${CYG_INSTALLED_DIR}${_debug}lib/pkgconfig/../../lib " "")
|
||||
|
||||
# transform libdir, includedir, and prefix paths from cygwin style to windows style
|
||||
file(READ "${PKGCONFIG_FILE}" PKGCONFIG_CONTENT)
|
||||
|
||||
foreach(PATH_NAME prefix libdir includedir)
|
||||
string(REGEX MATCH "${PATH_NAME}=[^\n]*" PATH_VALUE "${PKGCONFIG_CONTENT}")
|
||||
string(REPLACE "${PATH_NAME}=" "" PATH_VALUE "${PATH_VALUE}")
|
||||
|
||||
if(NOT PATH_VALUE)
|
||||
message(FATAL_ERROR "failed to find pkgconfig variable ${PATH_NAME}")
|
||||
endif()
|
||||
|
||||
execute_process(
|
||||
COMMAND "${MSYS_ROOT}/usr/bin/cygpath.exe" -w "${PATH_VALUE}"
|
||||
OUTPUT_VARIABLE FIXED_PATH
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
file(TO_CMAKE_PATH "${FIXED_PATH}" FIXED_PATH)
|
||||
vcpkg_replace_string("${PKGCONFIG_FILE}" "${PATH_NAME}=${PATH_VALUE}" "${PATH_NAME}=${FIXED_PATH}")
|
||||
endforeach()
|
||||
|
||||
# list libraries with -l flag (so pkgconf knows they are libraries and not just linker flags)
|
||||
foreach(LIBS_ENTRY Libs Libs.private)
|
||||
string(REGEX MATCH "${LIBS_ENTRY}: [^\n]*" LIBS_VALUE "${PKGCONFIG_CONTENT}")
|
||||
|
||||
if(NOT LIBS_VALUE)
|
||||
message(FATAL_ERROR "failed to find pkgconfig entry ${LIBS_ENTRY}")
|
||||
endif()
|
||||
|
||||
string(REPLACE "${LIBS_ENTRY}: " "" LIBS_VALUE "${LIBS_VALUE}")
|
||||
|
||||
if(LIBS_VALUE)
|
||||
set(LIBS_VALUE_OLD "${LIBS_VALUE}")
|
||||
string(REGEX REPLACE "([^ ]+)[.]lib" "-l\\1" LIBS_VALUE "${LIBS_VALUE}")
|
||||
set(LIBS_VALUE_NEW "${LIBS_VALUE}")
|
||||
vcpkg_replace_string("${PKGCONFIG_FILE}" "${LIBS_ENTRY}: ${LIBS_VALUE_OLD}" "${LIBS_ENTRY}: ${LIBS_VALUE_NEW}")
|
||||
endif()
|
||||
endforeach()
|
||||
endforeach()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
vcpkg_fixup_pkgconfig()
|
||||
|
||||
# Handle dependencies
|
||||
x_vcpkg_pkgconfig_get_modules(PREFIX FFMPEG_PKGCONFIG MODULES ${FFMPEG_PKGCONFIG_MODULES} LIBS)
|
||||
|
||||
function(append_dependencies_from_libs out)
|
||||
cmake_parse_arguments(PARSE_ARGV 1 "arg" "" "LIBS" "")
|
||||
string(REGEX REPLACE "[ ]+" ";" contents "${arg_LIBS}")
|
||||
list(FILTER contents EXCLUDE REGEX "^-F.+")
|
||||
list(FILTER contents EXCLUDE REGEX "^-framework$")
|
||||
list(FILTER contents EXCLUDE REGEX "^-L.+")
|
||||
list(FILTER contents EXCLUDE REGEX "^-libpath:.+")
|
||||
list(TRANSFORM contents REPLACE "^-Wl,-framework," "-l")
|
||||
list(FILTER contents EXCLUDE REGEX "^-Wl,.+")
|
||||
list(TRANSFORM contents REPLACE "^-l" "")
|
||||
list(FILTER contents EXCLUDE REGEX "^avutil$")
|
||||
list(FILTER contents EXCLUDE REGEX "^avcodec$")
|
||||
list(FILTER contents EXCLUDE REGEX "^avdevice$")
|
||||
list(FILTER contents EXCLUDE REGEX "^avfilter$")
|
||||
list(FILTER contents EXCLUDE REGEX "^avformat$")
|
||||
list(FILTER contents EXCLUDE REGEX "^postproc$")
|
||||
list(FILTER contents EXCLUDE REGEX "^swresample$")
|
||||
list(FILTER contents EXCLUDE REGEX "^swscale$")
|
||||
|
||||
if(VCPKG_TARGET_IS_WINDOWS)
|
||||
list(TRANSFORM contents TOLOWER)
|
||||
endif()
|
||||
|
||||
if(contents)
|
||||
list(APPEND "${out}" "${contents}")
|
||||
set("${out}" "${${out}}" PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
append_dependencies_from_libs(FFMPEG_DEPENDENCIES_RELEASE LIBS "${FFMPEG_PKGCONFIG_LIBS_RELEASE}")
|
||||
append_dependencies_from_libs(FFMPEG_DEPENDENCIES_DEBUG LIBS "${FFMPEG_PKGCONFIG_LIBS_DEBUG}")
|
||||
|
||||
# must remove duplicates from the front to respect link order so reverse first
|
||||
list(REVERSE FFMPEG_DEPENDENCIES_RELEASE)
|
||||
list(REVERSE FFMPEG_DEPENDENCIES_DEBUG)
|
||||
list(REMOVE_DUPLICATES FFMPEG_DEPENDENCIES_RELEASE)
|
||||
list(REMOVE_DUPLICATES FFMPEG_DEPENDENCIES_DEBUG)
|
||||
list(REVERSE FFMPEG_DEPENDENCIES_RELEASE)
|
||||
list(REVERSE FFMPEG_DEPENDENCIES_DEBUG)
|
||||
|
||||
message(STATUS "Dependencies (release): ${FFMPEG_DEPENDENCIES_RELEASE}")
|
||||
message(STATUS "Dependencies (debug): ${FFMPEG_DEPENDENCIES_DEBUG}")
|
||||
|
||||
# Handle version strings
|
||||
function(extract_regex_from_file out)
|
||||
cmake_parse_arguments(PARSE_ARGV 1 "arg" "MAJOR" "FILE_WITHOUT_EXTENSION;REGEX" "")
|
||||
file(READ "${arg_FILE_WITHOUT_EXTENSION}.h" contents)
|
||||
|
||||
if(contents MATCHES "${arg_REGEX}")
|
||||
if(NOT CMAKE_MATCH_COUNT EQUAL 1)
|
||||
message(FATAL_ERROR "Could not identify match group in regular expression \"${arg_REGEX}\"")
|
||||
endif()
|
||||
else()
|
||||
if(arg_MAJOR)
|
||||
file(READ "${arg_FILE_WITHOUT_EXTENSION}_major.h" contents)
|
||||
|
||||
if(contents MATCHES "${arg_REGEX}")
|
||||
if(NOT CMAKE_MATCH_COUNT EQUAL 1)
|
||||
message(FATAL_ERROR "Could not identify match group in regular expression \"${arg_REGEX}\"")
|
||||
endif()
|
||||
else()
|
||||
message(WARNING "Could not find line matching \"${arg_REGEX}\" in file \"${arg_FILE_WITHOUT_EXTENSION}_major.h\"")
|
||||
endif()
|
||||
else()
|
||||
message(WARNING "Could not find line matching \"${arg_REGEX}\" in file \"${arg_FILE_WITHOUT_EXTENSION}.h\"")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set("${out}" "${CMAKE_MATCH_1}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(extract_version_from_component out)
|
||||
cmake_parse_arguments(PARSE_ARGV 1 "arg" "" "COMPONENT" "")
|
||||
string(TOLOWER "${arg_COMPONENT}" component_lower)
|
||||
string(TOUPPER "${arg_COMPONENT}" component_upper)
|
||||
extract_regex_from_file(major_version
|
||||
FILE_WITHOUT_EXTENSION "${SOURCE_PATH}/${component_lower}/version"
|
||||
MAJOR
|
||||
REGEX "#define ${component_upper}_VERSION_MAJOR[ ]+([0-9]+)"
|
||||
)
|
||||
extract_regex_from_file(minor_version
|
||||
FILE_WITHOUT_EXTENSION "${SOURCE_PATH}/${component_lower}/version"
|
||||
REGEX "#define ${component_upper}_VERSION_MINOR[ ]+([0-9]+)"
|
||||
)
|
||||
extract_regex_from_file(micro_version
|
||||
FILE_WITHOUT_EXTENSION "${SOURCE_PATH}/${component_lower}/version"
|
||||
REGEX "#define ${component_upper}_VERSION_MICRO[ ]+([0-9]+)"
|
||||
)
|
||||
set("${out}" "${major_version}.${minor_version}.${micro_version}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
extract_regex_from_file(FFMPEG_VERSION
|
||||
FILE_WITHOUT_EXTENSION "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/libavutil/ffversion"
|
||||
REGEX "#define FFMPEG_VERSION[ ]+\"(.+)\""
|
||||
)
|
||||
|
||||
extract_version_from_component(LIBAVUTIL_VERSION
|
||||
COMPONENT libavutil)
|
||||
extract_version_from_component(LIBAVCODEC_VERSION
|
||||
COMPONENT libavcodec)
|
||||
extract_version_from_component(LIBAVDEVICE_VERSION
|
||||
COMPONENT libavdevice)
|
||||
extract_version_from_component(LIBAVFILTER_VERSION
|
||||
COMPONENT libavfilter)
|
||||
extract_version_from_component(LIBAVFORMAT_VERSION
|
||||
COMPONENT libavformat)
|
||||
extract_version_from_component(LIBSWRESAMPLE_VERSION
|
||||
COMPONENT libswresample)
|
||||
extract_version_from_component(LIBSWSCALE_VERSION
|
||||
COMPONENT libswscale)
|
||||
|
||||
# Handle copyright
|
||||
file(STRINGS "${CURRENT_BUILDTREES_DIR}/build-${TARGET_TRIPLET}-rel-out.log" LICENSE_STRING REGEX "License: .*" LIMIT_COUNT 1)
|
||||
|
||||
if(LICENSE_STRING STREQUAL "License: LGPL version 2.1 or later")
|
||||
set(LICENSE_FILE "COPYING.LGPLv2.1")
|
||||
elseif(LICENSE_STRING STREQUAL "License: LGPL version 3 or later")
|
||||
set(LICENSE_FILE "COPYING.LGPLv3")
|
||||
elseif(LICENSE_STRING STREQUAL "License: GPL version 2 or later")
|
||||
set(LICENSE_FILE "COPYING.GPLv2")
|
||||
elseif(LICENSE_STRING STREQUAL "License: GPL version 3 or later")
|
||||
set(LICENSE_FILE "COPYING.GPLv3")
|
||||
elseif(LICENSE_STRING STREQUAL "License: nonfree and unredistributable")
|
||||
set(LICENSE_FILE "COPYING.NONFREE")
|
||||
file(WRITE "${SOURCE_PATH}/${LICENSE_FILE}" "${LICENSE_STRING}")
|
||||
else()
|
||||
message(FATAL_ERROR "Failed to identify license (${LICENSE_STRING})")
|
||||
endif()
|
||||
|
||||
configure_file("${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake" "${CURRENT_PACKAGES_DIR}/share/${PORT}/vcpkg-cmake-wrapper.cmake" @ONLY)
|
||||
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/${LICENSE_FILE}")
|
||||
@@ -0,0 +1,47 @@
|
||||
set(FFMPEG_PREV_MODULE_PATH ${CMAKE_MODULE_PATH})
|
||||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
|
||||
|
||||
include(SelectLibraryConfigurations)
|
||||
|
||||
cmake_policy(SET CMP0012 NEW)
|
||||
|
||||
set(vcpkg_no_avcodec_target ON)
|
||||
set(vcpkg_no_avformat_target ON)
|
||||
set(vcpkg_no_avutil_target ON)
|
||||
if(TARGET FFmpeg::avcodec)
|
||||
set(vcpkg_no_avcodec_target OFF)
|
||||
endif()
|
||||
if(TARGET FFmpeg::avformat)
|
||||
set(vcpkg_no_avformat_target OFF)
|
||||
endif()
|
||||
if(TARGET FFmpeg::avutil)
|
||||
set(vcpkg_no_avutil_target OFF)
|
||||
endif()
|
||||
|
||||
_find_package(${ARGS})
|
||||
|
||||
if(WIN32)
|
||||
set(PKG_CONFIG_EXECUTABLE "${CMAKE_CURRENT_LIST_DIR}/../../../@_HOST_TRIPLET@/tools/pkgconf/pkgconf.exe" CACHE STRING "" FORCE)
|
||||
endif()
|
||||
|
||||
set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH ON) # Required for CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 3.1 which otherwise ignores CMAKE_PREFIX_PATH
|
||||
|
||||
if(@WITH_MFX@)
|
||||
find_package(PkgConfig )
|
||||
pkg_check_modules(libmfx IMPORTED_TARGET libmfx)
|
||||
list(APPEND FFMPEG_LIBRARIES PkgConfig::libmfx)
|
||||
if(vcpkg_no_avcodec_target AND TARGET FFmpeg::avcodec)
|
||||
target_link_libraries(FFmpeg::avcodec INTERFACE PkgConfig::libmfx)
|
||||
endif()
|
||||
if(vcpkg_no_avutil_target AND TARGET FFmpeg::avutil)
|
||||
target_link_libraries(FFmpeg::avutil INTERFACE PkgConfig::libmfx)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(FFMPEG_LIBRARY ${FFMPEG_LIBRARIES})
|
||||
|
||||
set(CMAKE_MODULE_PATH ${FFMPEG_PREV_MODULE_PATH})
|
||||
|
||||
unset(vcpkg_no_avformat_target)
|
||||
unset(vcpkg_no_avcodec_target)
|
||||
unset(vcpkg_no_avutil_target)
|
||||
@@ -0,0 +1,44 @@
|
||||
{
|
||||
"name": "ffmpeg",
|
||||
"version": "7.1",
|
||||
"port-version": 1,
|
||||
"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."
|
||||
],
|
||||
"homepage": "https://ffmpeg.org",
|
||||
"license": null,
|
||||
"dependencies": [
|
||||
{
|
||||
"name": "vcpkg-cmake-get-vars",
|
||||
"host": true
|
||||
},
|
||||
{
|
||||
"name": "vcpkg-pkgconfig-get-modules",
|
||||
"host": true
|
||||
}
|
||||
],
|
||||
"default-features": [
|
||||
],
|
||||
"features": {
|
||||
"amf": {
|
||||
"description": "AMD AMF codec support",
|
||||
"dependencies": [
|
||||
"amd-amf"
|
||||
]
|
||||
},
|
||||
"nvcodec": {
|
||||
"description": "Nvidia video decoding/encoding acceleration",
|
||||
"supports": "linux | (!osx & !uwp & !(arm64 & windows))",
|
||||
"dependencies": [
|
||||
"ffnvcodec"
|
||||
]
|
||||
},
|
||||
"qsv": {
|
||||
"description": "Intel QSV Codec",
|
||||
"dependencies": [
|
||||
"mfx-dispatch"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,168 @@
|
||||
diff --git a/build/make/configure.sh b/build/make/configure.sh
|
||||
index cc5bf6ce4..9380e87a7 100644
|
||||
--- a/build/make/configure.sh
|
||||
+++ b/build/make/configure.sh
|
||||
@@ -1092,7 +1092,7 @@ EOF
|
||||
# A number of ARM-based Windows platforms are constrained by their
|
||||
# respective SDKs' limitations. Fortunately, these are all 32-bit ABIs
|
||||
# and so can be selected as 'win32'.
|
||||
- if [ ${tgt_os} = "win32" ]; then
|
||||
+ if [ ${tgt_os} = "win32" ] || [ ${tgt_isa} = "armv7" ]; then
|
||||
asm_conversion_cmd="${source_path_mk}/build/make/ads2armasm_ms.pl"
|
||||
AS_SFX=.S
|
||||
msvs_arch_dir=arm-msvs
|
||||
@@ -1366,6 +1366,9 @@ EOF
|
||||
android)
|
||||
soft_enable realtime_only
|
||||
;;
|
||||
+ uwp)
|
||||
+ enabled gcc && add_cflags -fno-common
|
||||
+ ;;
|
||||
win*)
|
||||
enabled gcc && add_cflags -fno-common
|
||||
;;
|
||||
@@ -1484,14 +1487,26 @@ EOF
|
||||
fi
|
||||
AS_SFX=.asm
|
||||
case ${tgt_os} in
|
||||
+ uwp)
|
||||
+ if [ ${tgt_isa} = "x86" ] || [ ${tgt_isa} = "armv7" ]; then
|
||||
+ add_asflags -f win32
|
||||
+ else
|
||||
+ add_asflags -f win64
|
||||
+ fi
|
||||
+ enabled debug && [ "${AS}" = yasm ] && add_asflags -g cv8
|
||||
+ enabled debug && [ "${AS}" = nasm ] && add_asflags -gcv8
|
||||
+ EXE_SFX=.exe
|
||||
+ ;;
|
||||
win32)
|
||||
add_asflags -f win32
|
||||
- enabled debug && add_asflags -g cv8
|
||||
+ enabled debug && [ "${AS}" = yasm ] && add_asflags -g cv8
|
||||
+ enabled debug && [ "${AS}" = nasm ] && add_asflags -gcv8
|
||||
EXE_SFX=.exe
|
||||
;;
|
||||
win64)
|
||||
add_asflags -f win64
|
||||
- enabled debug && add_asflags -g cv8
|
||||
+ enabled debug && [ "${AS}" = yasm ] && add_asflags -g cv8
|
||||
+ enabled debug && [ "${AS}" = nasm ] && add_asflags -gcv8
|
||||
EXE_SFX=.exe
|
||||
;;
|
||||
linux*|solaris*|android*)
|
||||
@@ -1622,6 +1637,8 @@ EOF
|
||||
# Almost every platform uses pthreads.
|
||||
if enabled multithread; then
|
||||
case ${toolchain} in
|
||||
+ *-uwp-vs*)
|
||||
+ ;;
|
||||
*-win*-vs*)
|
||||
;;
|
||||
*-android-gcc)
|
||||
diff --git a/build/make/gen_msvs_vcxproj.sh b/build/make/gen_msvs_vcxproj.sh
|
||||
index 1e1db05bb..543eb37b2 100755
|
||||
--- a/build/make/gen_msvs_vcxproj.sh
|
||||
+++ b/build/make/gen_msvs_vcxproj.sh
|
||||
@@ -310,7 +310,22 @@ generate_vcxproj() {
|
||||
tag_content ProjectGuid "{${guid}}"
|
||||
tag_content RootNamespace ${name}
|
||||
tag_content Keyword ManagedCProj
|
||||
- if [ $vs_ver -ge 12 ] && [ "${platforms[0]}" = "ARM" ]; then
|
||||
+ if [ $vs_ver -ge 16 ]; then
|
||||
+ if [[ $target =~ [^-]*-uwp-.* ]]; then
|
||||
+ # Universal Windows Applications
|
||||
+ tag_content AppContainerApplication true
|
||||
+ tag_content ApplicationType "Windows Store"
|
||||
+ tag_content ApplicationTypeRevision 10.0
|
||||
+ fi
|
||||
+ if [[ $target =~ [^-]*-uwp-.* ]] || [ "${platforms[0]}" = "ARM" ] || [ "${platforms[0]}" = "ARM64" ]; then
|
||||
+ # Default to the latest Windows 10 SDK
|
||||
+ tag_content WindowsTargetPlatformVersion 10.0
|
||||
+ else
|
||||
+ # Minimum supported version of Windows for the desktop
|
||||
+ tag_content WindowsTargetPlatformVersion 8.1
|
||||
+ fi
|
||||
+ tag_content MinimumVisualStudioVersion 16.0
|
||||
+ elif [ $vs_ver -ge 12 ] && [ "${platforms[0]}" = "ARM" ]; then
|
||||
tag_content AppContainerApplication true
|
||||
# The application type can be one of "Windows Store",
|
||||
# "Windows Phone" or "Windows Phone Silverlight". The
|
||||
@@ -412,7 +427,7 @@ generate_vcxproj() {
|
||||
Condition="'\$(Configuration)|\$(Platform)'=='$config|$plat'"
|
||||
if [ "$name" == "vpx" ]; then
|
||||
hostplat=$plat
|
||||
- if [ "$hostplat" == "ARM" ]; then
|
||||
+ if [ "$hostplat" == "ARM" ] && [ $vs_ver -le 15 ]; then
|
||||
hostplat=Win32
|
||||
fi
|
||||
fi
|
||||
diff --git a/configure b/configure
|
||||
index 457bd6b38..fa4bce71b 100755
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -105,6 +105,8 @@ all_platforms="${all_platforms} arm64-darwin22-gcc"
|
||||
all_platforms="${all_platforms} arm64-darwin23-gcc"
|
||||
all_platforms="${all_platforms} arm64-darwin24-gcc"
|
||||
all_platforms="${all_platforms} arm64-linux-gcc"
|
||||
+all_platforms="${all_platforms} arm64-uwp-vs16"
|
||||
+all_platforms="${all_platforms} arm64-uwp-vs17"
|
||||
all_platforms="${all_platforms} arm64-win64-gcc"
|
||||
all_platforms="${all_platforms} arm64-win64-vs15"
|
||||
all_platforms="${all_platforms} arm64-win64-vs16"
|
||||
@@ -116,6 +118,8 @@ all_platforms="${all_platforms} armv7-darwin-gcc" #neon Cortex-A8
|
||||
all_platforms="${all_platforms} armv7-linux-rvct" #neon Cortex-A8
|
||||
all_platforms="${all_platforms} armv7-linux-gcc" #neon Cortex-A8
|
||||
all_platforms="${all_platforms} armv7-none-rvct" #neon Cortex-A8
|
||||
+all_platforms="${all_platforms} armv7-uwp-vs16"
|
||||
+all_platforms="${all_platforms} armv7-uwp-vs17"
|
||||
all_platforms="${all_platforms} armv7-win32-gcc"
|
||||
all_platforms="${all_platforms} armv7-win32-vs14"
|
||||
all_platforms="${all_platforms} armv7-win32-vs15"
|
||||
@@ -147,6 +151,8 @@ all_platforms="${all_platforms} x86-linux-gcc"
|
||||
all_platforms="${all_platforms} x86-linux-icc"
|
||||
all_platforms="${all_platforms} x86-os2-gcc"
|
||||
all_platforms="${all_platforms} x86-solaris-gcc"
|
||||
+all_platforms="${all_platforms} x86-uwp-vs16"
|
||||
+all_platforms="${all_platforms} x86-uwp-vs17"
|
||||
all_platforms="${all_platforms} x86-win32-gcc"
|
||||
all_platforms="${all_platforms} x86-win32-vs14"
|
||||
all_platforms="${all_platforms} x86-win32-vs15"
|
||||
@@ -173,6 +179,8 @@ all_platforms="${all_platforms} x86_64-iphonesimulator-gcc"
|
||||
all_platforms="${all_platforms} x86_64-linux-gcc"
|
||||
all_platforms="${all_platforms} x86_64-linux-icc"
|
||||
all_platforms="${all_platforms} x86_64-solaris-gcc"
|
||||
+all_platforms="${all_platforms} x86_64-uwp-vs16"
|
||||
+all_platforms="${all_platforms} x86_64-uwp-vs17"
|
||||
all_platforms="${all_platforms} x86_64-win64-gcc"
|
||||
all_platforms="${all_platforms} x86_64-win64-vs14"
|
||||
all_platforms="${all_platforms} x86_64-win64-vs15"
|
||||
@@ -507,11 +515,10 @@ process_targets() {
|
||||
! enabled multithread && DIST_DIR="${DIST_DIR}-nomt"
|
||||
! enabled install_docs && DIST_DIR="${DIST_DIR}-nodocs"
|
||||
DIST_DIR="${DIST_DIR}-${tgt_isa}-${tgt_os}"
|
||||
- case "${tgt_os}" in
|
||||
- win*) enabled static_msvcrt && DIST_DIR="${DIST_DIR}mt" || DIST_DIR="${DIST_DIR}md"
|
||||
- DIST_DIR="${DIST_DIR}-${tgt_cc}"
|
||||
- ;;
|
||||
- esac
|
||||
+ if [[ ${tgt_os} =~ win.* ]] || [ "${tgt_os}" = "uwp" ]; then
|
||||
+ enabled static_msvcrt && DIST_DIR="${DIST_DIR}mt" || DIST_DIR="${DIST_DIR}md"
|
||||
+ DIST_DIR="${DIST_DIR}-${tgt_cc}"
|
||||
+ fi
|
||||
if [ -f "${source_path}/build/make/version.sh" ]; then
|
||||
ver=`"$source_path/build/make/version.sh" --bare "$source_path"`
|
||||
DIST_DIR="${DIST_DIR}-${ver}"
|
||||
@@ -600,6 +607,10 @@ process_detect() {
|
||||
|
||||
# Specialize windows and POSIX environments.
|
||||
case $toolchain in
|
||||
+ *-uwp-*)
|
||||
+ # Don't check for any headers in UWP builds.
|
||||
+ false
|
||||
+ ;;
|
||||
*-win*-*)
|
||||
# Don't check for any headers in Windows builds.
|
||||
false
|
||||
--
|
||||
2.49.0
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
diff --git a/build/make/gen_msvs_vcxproj.sh b/build/make/gen_msvs_vcxproj.sh
|
||||
index 916851662..e60405bc9 100755
|
||||
--- a/build/make/gen_msvs_vcxproj.sh
|
||||
+++ b/build/make/gen_msvs_vcxproj.sh
|
||||
@@ -394,7 +394,7 @@ generate_vcxproj() {
|
||||
else
|
||||
config_suffix=""
|
||||
fi
|
||||
- tag_content TargetName "${name}${lib_sfx}${config_suffix}"
|
||||
+ tag_content TargetName "${name}"
|
||||
fi
|
||||
close_tag PropertyGroup
|
||||
done
|
||||
@@ -0,0 +1,316 @@
|
||||
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
|
||||
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO webmproject/libvpx
|
||||
REF "v${VERSION}"
|
||||
SHA512 824fe8719e4115ec359ae0642f5e1cea051d458f09eb8c24d60858cf082f66e411215e23228173ab154044bafbdfbb2d93b589bb726f55b233939b91f928aae0
|
||||
HEAD_REF master
|
||||
PATCHES
|
||||
0003-add-uwp-v142-and-v143-support.patch
|
||||
0004-remove-library-suffixes.patch
|
||||
)
|
||||
|
||||
if(CMAKE_HOST_WIN32)
|
||||
vcpkg_acquire_msys(MSYS_ROOT PACKAGES make perl)
|
||||
set(ENV{PATH} "${MSYS_ROOT}/usr/bin;$ENV{PATH}")
|
||||
else()
|
||||
vcpkg_find_acquire_program(PERL)
|
||||
get_filename_component(PERL_EXE_PATH ${PERL} DIRECTORY)
|
||||
set(ENV{PATH} "${MSYS_ROOT}/usr/bin:$ENV{PATH}:${PERL_EXE_PATH}")
|
||||
endif()
|
||||
|
||||
find_program(BASH NAME bash HINTS ${MSYS_ROOT}/usr/bin REQUIRED NO_CACHE)
|
||||
|
||||
vcpkg_find_acquire_program(NASM)
|
||||
get_filename_component(NASM_EXE_PATH ${NASM} DIRECTORY)
|
||||
vcpkg_add_to_path(${NASM_EXE_PATH})
|
||||
|
||||
if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
|
||||
|
||||
file(REMOVE_RECURSE "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-tmp")
|
||||
|
||||
if(VCPKG_CRT_LINKAGE STREQUAL static)
|
||||
set(LIBVPX_CRT_LINKAGE --enable-static-msvcrt)
|
||||
set(LIBVPX_CRT_SUFFIX mt)
|
||||
else()
|
||||
set(LIBVPX_CRT_SUFFIX md)
|
||||
endif()
|
||||
|
||||
if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL WindowsStore AND (VCPKG_PLATFORM_TOOLSET STREQUAL v142 OR VCPKG_PLATFORM_TOOLSET STREQUAL v143))
|
||||
set(LIBVPX_TARGET_OS "uwp")
|
||||
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL x86 OR VCPKG_TARGET_ARCHITECTURE STREQUAL arm)
|
||||
set(LIBVPX_TARGET_OS "win32")
|
||||
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL x64 OR VCPKG_TARGET_ARCHITECTURE STREQUAL arm64)
|
||||
set(LIBVPX_TARGET_OS "win64")
|
||||
endif()
|
||||
|
||||
if(VCPKG_TARGET_ARCHITECTURE STREQUAL x86)
|
||||
set(LIBVPX_TARGET_ARCH "x86-${LIBVPX_TARGET_OS}")
|
||||
set(LIBVPX_ARCH_DIR "Win32")
|
||||
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL x64)
|
||||
set(LIBVPX_TARGET_ARCH "x86_64-${LIBVPX_TARGET_OS}")
|
||||
set(LIBVPX_ARCH_DIR "x64")
|
||||
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL arm64)
|
||||
set(LIBVPX_TARGET_ARCH "arm64-${LIBVPX_TARGET_OS}")
|
||||
set(LIBVPX_ARCH_DIR "ARM64")
|
||||
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL arm)
|
||||
set(LIBVPX_TARGET_ARCH "armv7-${LIBVPX_TARGET_OS}")
|
||||
set(LIBVPX_ARCH_DIR "ARM")
|
||||
endif()
|
||||
|
||||
if(VCPKG_PLATFORM_TOOLSET STREQUAL v143)
|
||||
set(LIBVPX_TARGET_VS "vs17")
|
||||
elseif(VCPKG_PLATFORM_TOOLSET STREQUAL v142)
|
||||
set(LIBVPX_TARGET_VS "vs16")
|
||||
else()
|
||||
set(LIBVPX_TARGET_VS "vs15")
|
||||
endif()
|
||||
|
||||
set(OPTIONS "--disable-examples --disable-tools --disable-docs --enable-pic")
|
||||
|
||||
if("realtime" IN_LIST FEATURES)
|
||||
set(OPTIONS "${OPTIONS} --enable-realtime-only")
|
||||
endif()
|
||||
|
||||
if("highbitdepth" IN_LIST FEATURES)
|
||||
set(OPTIONS "${OPTIONS} --enable-vp9-highbitdepth")
|
||||
endif()
|
||||
|
||||
message(STATUS "Generating makefile")
|
||||
file(MAKE_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-tmp")
|
||||
vcpkg_execute_required_process(
|
||||
COMMAND
|
||||
${BASH} --noprofile --norc
|
||||
"${SOURCE_PATH}/configure"
|
||||
--target=${LIBVPX_TARGET_ARCH}-${LIBVPX_TARGET_VS}
|
||||
${LIBVPX_CRT_LINKAGE}
|
||||
${OPTIONS}
|
||||
--as=nasm
|
||||
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-tmp"
|
||||
LOGNAME configure-${TARGET_TRIPLET})
|
||||
|
||||
message(STATUS "Generating MSBuild projects")
|
||||
vcpkg_execute_required_process(
|
||||
COMMAND
|
||||
${BASH} --noprofile --norc -c "make dist"
|
||||
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-tmp"
|
||||
LOGNAME generate-${TARGET_TRIPLET})
|
||||
|
||||
vcpkg_msbuild_install(
|
||||
SOURCE_PATH "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-tmp"
|
||||
PROJECT_SUBPATH vpx.vcxproj
|
||||
)
|
||||
|
||||
if (VCPKG_TARGET_ARCHITECTURE STREQUAL arm64)
|
||||
set(LIBVPX_INCLUDE_DIR "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/vpx-vp8-vp9-nopost-nodocs-${LIBVPX_TARGET_ARCH}${LIBVPX_CRT_SUFFIX}-${LIBVPX_TARGET_VS}-v${VERSION}/include/vpx")
|
||||
elseif (VCPKG_TARGET_ARCHITECTURE STREQUAL arm)
|
||||
set(LIBVPX_INCLUDE_DIR "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/vpx-vp8-vp9-nopost-nomt-nodocs-${LIBVPX_TARGET_ARCH}${LIBVPX_CRT_SUFFIX}-${LIBVPX_TARGET_VS}-v${VERSION}/include/vpx")
|
||||
else()
|
||||
set(LIBVPX_INCLUDE_DIR "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/vpx-vp8-vp9-nodocs-${LIBVPX_TARGET_ARCH}${LIBVPX_CRT_SUFFIX}-${LIBVPX_TARGET_VS}-v${VERSION}/include/vpx")
|
||||
endif()
|
||||
file(
|
||||
INSTALL
|
||||
"${LIBVPX_INCLUDE_DIR}"
|
||||
DESTINATION
|
||||
"${CURRENT_PACKAGES_DIR}/include"
|
||||
RENAME
|
||||
"vpx")
|
||||
if (NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
|
||||
set(LIBVPX_PREFIX "${CURRENT_INSTALLED_DIR}")
|
||||
configure_file("${CMAKE_CURRENT_LIST_DIR}/vpx.pc.in" "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/vpx.pc" @ONLY)
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
|
||||
set(LIBVPX_PREFIX "${CURRENT_INSTALLED_DIR}/debug")
|
||||
configure_file("${CMAKE_CURRENT_LIST_DIR}/vpx.pc.in" "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/vpx.pc" @ONLY)
|
||||
endif()
|
||||
|
||||
else()
|
||||
|
||||
set(OPTIONS "--disable-examples --disable-tools --disable-docs --disable-unit-tests --enable-pic")
|
||||
|
||||
set(OPTIONS_DEBUG "--enable-debug-libs --enable-debug --prefix=${CURRENT_PACKAGES_DIR}/debug")
|
||||
set(OPTIONS_RELEASE "--prefix=${CURRENT_PACKAGES_DIR}")
|
||||
set(AS_NASM "--as=nasm")
|
||||
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
|
||||
set(OPTIONS "${OPTIONS} --disable-static --enable-shared")
|
||||
else()
|
||||
set(OPTIONS "${OPTIONS} --enable-static --disable-shared")
|
||||
endif()
|
||||
|
||||
if("realtime" IN_LIST FEATURES)
|
||||
set(OPTIONS "${OPTIONS} --enable-realtime-only")
|
||||
endif()
|
||||
|
||||
if("highbitdepth" IN_LIST FEATURES)
|
||||
set(OPTIONS "${OPTIONS} --enable-vp9-highbitdepth")
|
||||
endif()
|
||||
|
||||
if(VCPKG_TARGET_ARCHITECTURE STREQUAL x86)
|
||||
set(LIBVPX_TARGET_ARCH "x86")
|
||||
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL x64)
|
||||
set(LIBVPX_TARGET_ARCH "x86_64")
|
||||
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL arm)
|
||||
set(LIBVPX_TARGET_ARCH "armv7")
|
||||
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL arm64)
|
||||
set(LIBVPX_TARGET_ARCH "arm64")
|
||||
else()
|
||||
message(FATAL_ERROR "libvpx does not support architecture ${VCPKG_TARGET_ARCHITECTURE}")
|
||||
endif()
|
||||
|
||||
vcpkg_cmake_get_vars(cmake_vars_file)
|
||||
include("${cmake_vars_file}")
|
||||
|
||||
# Set environment variables for configure
|
||||
if(VCPKG_DETECTED_CMAKE_C_COMPILER MATCHES "([^\/]*-)gcc$")
|
||||
message(STATUS "Cross-building for ${TARGET_TRIPLET} with ${CMAKE_MATCH_1}")
|
||||
set(ENV{CROSS} ${CMAKE_MATCH_1})
|
||||
unset(AS_NASM)
|
||||
else()
|
||||
set(ENV{CC} ${VCPKG_DETECTED_CMAKE_C_COMPILER})
|
||||
set(ENV{CXX} ${VCPKG_DETECTED_CMAKE_CXX_COMPILER})
|
||||
set(ENV{AR} ${VCPKG_DETECTED_CMAKE_AR})
|
||||
set(ENV{LD} ${VCPKG_DETECTED_CMAKE_LINKER})
|
||||
set(ENV{RANLIB} ${VCPKG_DETECTED_CMAKE_RANLIB})
|
||||
set(ENV{STRIP} ${VCPKG_DETECTED_CMAKE_STRIP})
|
||||
endif()
|
||||
|
||||
if(VCPKG_TARGET_IS_MINGW)
|
||||
if(LIBVPX_TARGET_ARCH STREQUAL "x86")
|
||||
set(LIBVPX_TARGET "x86-win32-gcc")
|
||||
else()
|
||||
set(LIBVPX_TARGET "x86_64-win64-gcc")
|
||||
endif()
|
||||
elseif(VCPKG_TARGET_IS_LINUX)
|
||||
set(LIBVPX_TARGET "${LIBVPX_TARGET_ARCH}-linux-gcc")
|
||||
elseif(VCPKG_TARGET_IS_ANDROID)
|
||||
set(LIBVPX_TARGET "generic-gnu")
|
||||
# Settings
|
||||
if(VCPKG_TARGET_ARCHITECTURE STREQUAL x86)
|
||||
set(OPTIONS "${OPTIONS} --disable-sse4_1 --disable-avx --disable-avx2 --disable-avx512")
|
||||
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL x64)
|
||||
set(OPTIONS "${OPTIONS} --disable-avx --disable-avx2 --disable-avx512")
|
||||
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL arm)
|
||||
set(OPTIONS "${OPTIONS} --enable-thumb --disable-neon")
|
||||
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL arm64)
|
||||
set(OPTIONS "${OPTIONS} --enable-thumb")
|
||||
endif()
|
||||
# Set environment variables for configure
|
||||
set(ENV{AS} ${VCPKG_DETECTED_CMAKE_C_COMPILER})
|
||||
set(ENV{LDFLAGS} "${LDFLAGS} --target=${VCPKG_DETECTED_CMAKE_C_COMPILER_TARGET}")
|
||||
# Set clang target
|
||||
set(OPTIONS "${OPTIONS} --extra-cflags=--target=${VCPKG_DETECTED_CMAKE_C_COMPILER_TARGET} --extra-cxxflags=--target=${VCPKG_DETECTED_CMAKE_CXX_COMPILER_TARGET}")
|
||||
# Unset nasm and let AS do its job
|
||||
unset(AS_NASM)
|
||||
elseif(VCPKG_TARGET_IS_OSX)
|
||||
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
|
||||
set(LIBVPX_TARGET "arm64-darwin20-gcc")
|
||||
if(DEFINED VCPKG_OSX_DEPLOYMENT_TARGET)
|
||||
set(MAC_OSX_MIN_VERSION_CFLAGS --extra-cflags=-mmacosx-version-min=${VCPKG_OSX_DEPLOYMENT_TARGET} --extra-cxxflags=-mmacosx-version-min=${VCPKG_OSX_DEPLOYMENT_TARGET})
|
||||
endif()
|
||||
else()
|
||||
set(LIBVPX_TARGET "${LIBVPX_TARGET_ARCH}-darwin17-gcc") # enable latest CPU instructions for best performance and less CPU usage on MacOS
|
||||
endif()
|
||||
elseif(VCPKG_TARGET_IS_IOS)
|
||||
if(VCPKG_TARGET_ARCHITECTURE STREQUAL arm)
|
||||
set(LIBVPX_TARGET "armv7-darwin-gcc")
|
||||
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL arm64)
|
||||
set(LIBVPX_TARGET "arm64-darwin-gcc")
|
||||
else()
|
||||
message(FATAL_ERROR "libvpx does not support architecture ${VCPKG_TARGET_ARCHITECTURE} on iOS")
|
||||
endif()
|
||||
else()
|
||||
set(LIBVPX_TARGET "generic-gnu") # use default target
|
||||
endif()
|
||||
|
||||
if (VCPKG_HOST_IS_OPENBSD OR VCPKG_HOST_IS_FREEBSD)
|
||||
set(MAKE_BINARY "gmake")
|
||||
else()
|
||||
set(MAKE_BINARY "make")
|
||||
endif()
|
||||
|
||||
message(STATUS "Build info. Target: ${LIBVPX_TARGET}; Options: ${OPTIONS}")
|
||||
|
||||
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
|
||||
message(STATUS "Configuring libvpx for Release")
|
||||
file(MAKE_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel")
|
||||
vcpkg_execute_required_process(
|
||||
COMMAND
|
||||
${BASH} --noprofile --norc
|
||||
"${SOURCE_PATH}/configure"
|
||||
--target=${LIBVPX_TARGET}
|
||||
${OPTIONS}
|
||||
${OPTIONS_RELEASE}
|
||||
${MAC_OSX_MIN_VERSION_CFLAGS}
|
||||
${AS_NASM}
|
||||
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel"
|
||||
LOGNAME configure-${TARGET_TRIPLET}-rel)
|
||||
|
||||
message(STATUS "Building libvpx for Release")
|
||||
vcpkg_execute_required_process(
|
||||
COMMAND
|
||||
${BASH} --noprofile --norc -c "${MAKE_BINARY} -j${VCPKG_CONCURRENCY}"
|
||||
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel"
|
||||
LOGNAME build-${TARGET_TRIPLET}-rel
|
||||
)
|
||||
|
||||
message(STATUS "Installing libvpx for Release")
|
||||
vcpkg_execute_required_process(
|
||||
COMMAND
|
||||
${BASH} --noprofile --norc -c "${MAKE_BINARY} install"
|
||||
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel"
|
||||
LOGNAME install-${TARGET_TRIPLET}-rel
|
||||
)
|
||||
endif()
|
||||
|
||||
# --- --- ---
|
||||
|
||||
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
|
||||
message(STATUS "Configuring libvpx for Debug")
|
||||
file(MAKE_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg")
|
||||
vcpkg_execute_required_process(
|
||||
COMMAND
|
||||
${BASH} --noprofile --norc
|
||||
"${SOURCE_PATH}/configure"
|
||||
--target=${LIBVPX_TARGET}
|
||||
${OPTIONS}
|
||||
${OPTIONS_DEBUG}
|
||||
${MAC_OSX_MIN_VERSION_CFLAGS}
|
||||
${AS_NASM}
|
||||
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg"
|
||||
LOGNAME configure-${TARGET_TRIPLET}-dbg)
|
||||
|
||||
message(STATUS "Building libvpx for Debug")
|
||||
vcpkg_execute_required_process(
|
||||
COMMAND
|
||||
${BASH} --noprofile --norc -c "${MAKE_BINARY} -j${VCPKG_CONCURRENCY}"
|
||||
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg"
|
||||
LOGNAME build-${TARGET_TRIPLET}-dbg
|
||||
)
|
||||
|
||||
message(STATUS "Installing libvpx for Debug")
|
||||
vcpkg_execute_required_process(
|
||||
COMMAND
|
||||
${BASH} --noprofile --norc -c "${MAKE_BINARY} install"
|
||||
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg"
|
||||
LOGNAME install-${TARGET_TRIPLET}-dbg
|
||||
)
|
||||
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
|
||||
file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/lib/libvpx_g.a")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
vcpkg_fixup_pkgconfig()
|
||||
|
||||
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
|
||||
set(LIBVPX_CONFIG_DEBUG ON)
|
||||
else()
|
||||
set(LIBVPX_CONFIG_DEBUG OFF)
|
||||
endif()
|
||||
|
||||
configure_file("${CMAKE_CURRENT_LIST_DIR}/unofficial-libvpx-config.cmake.in" "${CURRENT_PACKAGES_DIR}/share/unofficial-libvpx/unofficial-libvpx-config.cmake" @ONLY)
|
||||
|
||||
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
|
||||
@@ -0,0 +1,49 @@
|
||||
if(NOT TARGET unofficial::libvpx::libvpx)
|
||||
# Compute the installation prefix relative to this file.
|
||||
get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
|
||||
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
|
||||
|
||||
# Add library target (note: vpx always has a static build in vcpkg).
|
||||
add_library(unofficial::libvpx::libvpx STATIC IMPORTED)
|
||||
|
||||
# Add interface include directories and link interface languages (applies to all configurations).
|
||||
set_target_properties(unofficial::libvpx::libvpx PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
||||
)
|
||||
list(APPEND _IMPORT_CHECK_FILES "${_IMPORT_PREFIX}/include/vpx/vpx_codec.h")
|
||||
|
||||
# Add release configuration properties.
|
||||
find_library(_LIBFILE_RELEASE NAMES vpx PATHS "${_IMPORT_PREFIX}/lib/" NO_DEFAULT_PATH)
|
||||
set_property(TARGET unofficial::libvpx::libvpx
|
||||
APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
|
||||
set_target_properties(unofficial::libvpx::libvpx PROPERTIES
|
||||
IMPORTED_LOCATION_RELEASE ${_LIBFILE_RELEASE})
|
||||
list(APPEND _IMPORT_CHECK_FILES ${_LIBFILE_RELEASE})
|
||||
unset(_LIBFILE_RELEASE CACHE)
|
||||
|
||||
# Add debug configuration properties.
|
||||
if(@LIBVPX_CONFIG_DEBUG@)
|
||||
find_library(_LIBFILE_DEBUG NAMES vpx PATHS "${_IMPORT_PREFIX}/debug/lib/" NO_DEFAULT_PATH)
|
||||
set_property(TARGET unofficial::libvpx::libvpx
|
||||
APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
|
||||
set_target_properties(unofficial::libvpx::libvpx PROPERTIES
|
||||
IMPORTED_LOCATION_DEBUG ${_LIBFILE_DEBUG})
|
||||
list(APPEND _IMPORT_CHECK_FILES ${_LIBFILE_DEBUG})
|
||||
unset(_LIBFILE_DEBUG CACHE)
|
||||
endif()
|
||||
|
||||
# Check header and library files are present.
|
||||
foreach(file ${_IMPORT_CHECK_FILES} )
|
||||
if(NOT EXISTS "${file}" )
|
||||
message(FATAL_ERROR "unofficial::libvpx::libvpx references the file
|
||||
\"${file}\"
|
||||
but this file does not exist. Possible reasons include:
|
||||
* The file was deleted, renamed, or moved to another location.
|
||||
* An install or uninstall procedure did not complete successfully.
|
||||
")
|
||||
endif()
|
||||
endforeach()
|
||||
unset(_IMPORT_CHECK_FILES)
|
||||
endif()
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"name": "libvpx",
|
||||
"version": "1.15.2",
|
||||
"description": "The reference software implementation for the video coding formats VP8 and VP9.",
|
||||
"homepage": "https://github.com/webmproject/libvpx",
|
||||
"license": "BSD-3-Clause",
|
||||
"dependencies": [
|
||||
{
|
||||
"name": "vcpkg-cmake-get-vars",
|
||||
"host": true
|
||||
},
|
||||
{
|
||||
"name": "vcpkg-msbuild",
|
||||
"host": true,
|
||||
"platform": "windows & !mingw"
|
||||
}
|
||||
],
|
||||
"features": {
|
||||
"highbitdepth": {
|
||||
"description": "use VP9 high bit depth (10/12) profiles"
|
||||
},
|
||||
"realtime": {
|
||||
"description": "enable this option while building for real-time encoding"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
prefix=@LIBVPX_PREFIX@
|
||||
exec_prefix=${prefix}
|
||||
libdir=${prefix}/lib
|
||||
includedir=${prefix}/include
|
||||
|
||||
Name: vpx
|
||||
Description: WebM Project VPx codec implementation
|
||||
Version: @VERSION@
|
||||
Requires:
|
||||
Conflicts:
|
||||
Libs: -L"${libdir}" -lvpx
|
||||
Cflags: -I"${includedir}"
|
||||
@@ -0,0 +1,80 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index bc641685..42e72a39 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -1,19 +1,22 @@
|
||||
+CMAKE_MINIMUM_REQUIRED( VERSION 3.12 )
|
||||
+
|
||||
# CMakeLists for libyuv
|
||||
# Originally created for "roxlu build system" to compile libyuv on windows
|
||||
# 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 )
|
||||
OPTION( TEST "Built unit tests" OFF )
|
||||
|
||||
+SET( CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON )
|
||||
+
|
||||
SET ( ly_base_dir ${PROJECT_SOURCE_DIR} )
|
||||
SET ( ly_src_dir ${ly_base_dir}/source )
|
||||
SET ( ly_inc_dir ${ly_base_dir}/include )
|
||||
SET ( ly_tst_dir ${ly_base_dir}/unit_test )
|
||||
SET ( ly_lib_name yuv )
|
||||
SET ( ly_lib_static ${ly_lib_name} )
|
||||
-SET ( ly_lib_shared ${ly_lib_name}_shared )
|
||||
|
||||
+FILE ( GLOB_RECURSE ly_include_files ${ly_inc_dir}/libyuv/*.h )
|
||||
FILE ( GLOB_RECURSE ly_source_files ${ly_src_dir}/*.cc )
|
||||
LIST ( SORT ly_source_files )
|
||||
|
||||
@@ -28,27 +31,20 @@ endif()
|
||||
|
||||
# this creates the static library (.a)
|
||||
ADD_LIBRARY ( ${ly_lib_static} STATIC ${ly_source_files} )
|
||||
-
|
||||
-# 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" )
|
||||
-if(WIN32)
|
||||
- SET_TARGET_PROPERTIES ( ${ly_lib_shared} PROPERTIES IMPORT_PREFIX "lib" )
|
||||
-endif()
|
||||
+SET_TARGET_PROPERTIES ( ${ly_lib_static} PROPERTIES PUBLIC_HEADER include/libyuv.h )
|
||||
|
||||
# this creates the conversion tool
|
||||
ADD_EXECUTABLE ( yuvconvert ${ly_base_dir}/util/yuvconvert.cc )
|
||||
-TARGET_LINK_LIBRARIES ( yuvconvert ${ly_lib_static} )
|
||||
+TARGET_LINK_LIBRARIES ( yuvconvert ${ly_lib_static} )
|
||||
|
||||
# this creates the yuvconstants tool
|
||||
-ADD_EXECUTABLE ( yuvconstants ${ly_base_dir}/util/yuvconstants.c )
|
||||
-TARGET_LINK_LIBRARIES ( yuvconstants ${ly_lib_static} )
|
||||
+ADD_EXECUTABLE ( yuvconstants ${ly_base_dir}/util/yuvconstants.c )
|
||||
+TARGET_LINK_LIBRARIES ( yuvconstants ${ly_lib_static} )
|
||||
|
||||
find_package ( JPEG )
|
||||
if (JPEG_FOUND)
|
||||
- include_directories( ${JPEG_INCLUDE_DIR} )
|
||||
- target_link_libraries( ${ly_lib_shared} ${JPEG_LIBRARY} )
|
||||
+ include_directories( ${JPEG_INCLUDE_DIR})
|
||||
+ target_link_libraries(${ly_lib_static} PUBLIC ${JPEG_LIBRARY})
|
||||
add_definitions( -DHAVE_JPEG )
|
||||
endif()
|
||||
|
||||
@@ -89,12 +85,11 @@ if(TEST)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
-
|
||||
# install the conversion tool, .so, .a, and all the header files
|
||||
-INSTALL ( PROGRAMS ${CMAKE_BINARY_DIR}/yuvconvert DESTINATION bin )
|
||||
-INSTALL ( TARGETS ${ly_lib_static} DESTINATION lib )
|
||||
-INSTALL ( TARGETS ${ly_lib_shared} LIBRARY DESTINATION lib RUNTIME DESTINATION bin )
|
||||
-INSTALL ( DIRECTORY ${PROJECT_SOURCE_DIR}/include/ DESTINATION include )
|
||||
+INSTALL ( TARGETS yuvconvert DESTINATION tools )
|
||||
+INSTALL ( FILES ${ly_include_files} DESTINATION include/libyuv )
|
||||
+INSTALL ( TARGETS ${ly_lib_static} EXPORT libyuv-targets DESTINATION lib INCLUDES DESTINATION include PUBLIC_HEADER DESTINATION include )
|
||||
+INSTALL( EXPORT libyuv-targets DESTINATION share/cmake/libyuv/ EXPORT_LINK_INTERFACE_LIBRARIES )
|
||||
|
||||
# create the .deb and .rpm packages using cpack
|
||||
INCLUDE ( CM_linux_packages.cmake )
|
||||
@@ -0,0 +1,5 @@
|
||||
include(CMakeFindDependencyMacro)
|
||||
find_dependency(JPEG)
|
||||
|
||||
set(libyuv_INCLUDE_DIRS "${CMAKE_CURRENT_LIST_DIR}/../../include")
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/libyuv-targets.cmake")
|
||||
@@ -0,0 +1,81 @@
|
||||
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
|
||||
|
||||
vcpkg_from_git(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
URL https://chromium.googlesource.com/libyuv/libyuv
|
||||
REF 0faf8dd0e004520a61a603a4d2996d5ecc80dc3f
|
||||
# Check https://chromium.googlesource.com/libyuv/libyuv/+/refs/heads/main/include/libyuv/version.h for a version!
|
||||
PATCHES
|
||||
fix-cmakelists.patch
|
||||
)
|
||||
|
||||
vcpkg_cmake_get_vars(cmake_vars_file)
|
||||
include("${cmake_vars_file}")
|
||||
if (VCPKG_DETECTED_CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" AND NOT VCPKG_TARGET_IS_UWP)
|
||||
# Most of libyuv accelerated features need to be compiled by clang/gcc, so force use clang-cl, otherwise the performance is too poor.
|
||||
# Manually build the port with clang-cl when using MSVC as compiler
|
||||
|
||||
message(STATUS "Set compiler to clang-cl when using MSVC")
|
||||
|
||||
# https://github.com/microsoft/vcpkg/pull/10398
|
||||
set(VCPKG_POLICY_SKIP_ARCHITECTURE_CHECK enabled)
|
||||
|
||||
vcpkg_find_acquire_program(CLANG)
|
||||
if (CLANG MATCHES "-NOTFOUND")
|
||||
message(FATAL_ERROR "Clang is required.")
|
||||
endif ()
|
||||
get_filename_component(CLANG "${CLANG}" DIRECTORY)
|
||||
|
||||
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm")
|
||||
set(CLANG_TARGET "arm")
|
||||
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
|
||||
set(CLANG_TARGET "aarch64")
|
||||
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86")
|
||||
set(CLANG_TARGET "i686")
|
||||
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
|
||||
set(CLANG_TARGET "x86_64")
|
||||
else()
|
||||
message(FATAL_ERROR "Unsupported target architecture")
|
||||
endif()
|
||||
|
||||
set(CLANG_TARGET "${CLANG_TARGET}-pc-windows-msvc")
|
||||
|
||||
message(STATUS "Using clang target ${CLANG_TARGET}")
|
||||
string(APPEND VCPKG_DETECTED_CMAKE_CXX_FLAGS --target=${CLANG_TARGET})
|
||||
string(APPEND VCPKG_DETECTED_CMAKE_C_FLAGS --target=${CLANG_TARGET})
|
||||
|
||||
set(BUILD_OPTIONS
|
||||
-DCMAKE_CXX_COMPILER=${CLANG}/clang-cl.exe
|
||||
-DCMAKE_C_COMPILER=${CLANG}/clang-cl.exe
|
||||
-DCMAKE_CXX_FLAGS=${VCPKG_DETECTED_CMAKE_CXX_FLAGS}
|
||||
-DCMAKE_C_FLAGS=${VCPKG_DETECTED_CMAKE_C_FLAGS})
|
||||
endif ()
|
||||
|
||||
vcpkg_cmake_configure(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
DISABLE_PARALLEL_CONFIGURE
|
||||
OPTIONS
|
||||
${BUILD_OPTIONS}
|
||||
OPTIONS_DEBUG
|
||||
-DCMAKE_DEBUG_POSTFIX=d
|
||||
)
|
||||
|
||||
vcpkg_cmake_install()
|
||||
vcpkg_copy_pdbs()
|
||||
|
||||
vcpkg_cmake_config_fixup(CONFIG_PATH share/cmake/libyuv)
|
||||
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
|
||||
|
||||
configure_file(${CMAKE_CURRENT_LIST_DIR}/libyuv-config.cmake ${CURRENT_PACKAGES_DIR}/share/${PORT} COPYONLY)
|
||||
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
|
||||
|
||||
vcpkg_cmake_get_vars(cmake_vars_file)
|
||||
include("${cmake_vars_file}")
|
||||
if (VCPKG_DETECTED_CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
message(WARNING "Use MSVC to compile libyuv results in a very slow library. (https://github.com/microsoft/vcpkg/issues/28446)")
|
||||
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage-msvc" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME "usage")
|
||||
else ()
|
||||
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
|
||||
endif ()
|
||||
@@ -0,0 +1,4 @@
|
||||
libyuv provides CMake targets:
|
||||
|
||||
find_package(libyuv CONFIG REQUIRED)
|
||||
target_link_libraries(main PRIVATE yuv)
|
||||
@@ -0,0 +1,9 @@
|
||||
libyuv provides CMake targets:
|
||||
|
||||
find_package(libyuv CONFIG REQUIRED)
|
||||
target_link_libraries(main PRIVATE yuv)
|
||||
|
||||
# WARNING
|
||||
# You are using MSVC to compile libyuv, which results in a very slow library.
|
||||
# MSVC won't compile any of the acceleration codes.
|
||||
# See workarounds: https://github.com/microsoft/vcpkg/issues/28446
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"name": "libyuv",
|
||||
"version": "1857",
|
||||
"description": "libyuv is an open source project that includes YUV scaling and conversion functionality",
|
||||
"homepage": "https://chromium.googlesource.com/libyuv/libyuv",
|
||||
"license": null,
|
||||
"dependencies": [
|
||||
"libjpeg-turbo",
|
||||
{
|
||||
"name": "vcpkg-cmake",
|
||||
"host": true
|
||||
},
|
||||
{
|
||||
"name": "vcpkg-cmake-config",
|
||||
"host": true
|
||||
},
|
||||
{
|
||||
"name": "vcpkg-cmake-get-vars",
|
||||
"host": true
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index a8a3288..7d01d97 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -1,4 +1,4 @@
|
||||
-cmake_minimum_required(VERSION 2.6)
|
||||
+cmake_minimum_required(VERSION 3.14)
|
||||
|
||||
project( libmfx )
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 9446bc4..a8a3288 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -3,16 +3,7 @@ cmake_minimum_required(VERSION 2.6)
|
||||
project( libmfx )
|
||||
|
||||
# FIXME Adds support for using system/other install of intel media sdk
|
||||
-find_path ( INTELMEDIASDK_PATH mfx/mfxvideo.h
|
||||
- HINTS "${CMAKE_SOURCE_DIR}"
|
||||
-)
|
||||
-
|
||||
-if (INTELMEDIASDK_PATH_NOTFOUND)
|
||||
- message( FATAL_ERROR "Intel MEDIA SDK include not found" )
|
||||
-else (INTELMEDIASDK_PATH_NOTFOUND)
|
||||
- message(STATUS "Intel Media SDK is here: ${INTELMEDIASDK_PATH}")
|
||||
-endif (INTELMEDIASDK_PATH_NOTFOUND)
|
||||
-
|
||||
+set(INTELMEDIASDK_PATH "${CMAKE_CURRENT_LIST_DIR}")
|
||||
|
||||
set(SOURCES
|
||||
src/main.cpp
|
||||
diff --git a/libmfx.pc.cmake b/libmfx.pc.cmake
|
||||
index fabb541..5d248fe 100644
|
||||
--- a/libmfx.pc.cmake
|
||||
+++ b/libmfx.pc.cmake
|
||||
@@ -6,9 +6,9 @@ Requires.private:
|
||||
Name: libmfx
|
||||
Description: Intel Media SDK Dispatched static library
|
||||
-Version: 2013
|
||||
+Version: 1.35
|
||||
Requires:
|
||||
Requires.private:
|
||||
Conflicts:
|
||||
-Libs: -L${libdir} -lsupc++ ${libdir}/libmfx.lib
|
||||
+Libs: -L${libdir} -llibmfx
|
||||
Libs.private:
|
||||
-Cflags: -I${includedir} -I@INTELMEDIASDK_PATH@
|
||||
+Cflags: -I${includedir}
|
||||
@@ -0,0 +1,66 @@
|
||||
Subject: [PATCH] fix for vcpkg
|
||||
fix missing mfx_driver_store_loader related symbols
|
||||
---
|
||||
Index: CMakeLists.txt
|
||||
IDEA additional info:
|
||||
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
||||
<+>UTF-8
|
||||
===================================================================
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
--- a/CMakeLists.txt (revision 7e4d221c36c630c1250b23a5dfa15657bc04c10c)
|
||||
+++ b/CMakeLists.txt (revision 5ebef171699530ca01594a5cef10a68811f4d105)
|
||||
@@ -40,6 +39,7 @@
|
||||
src/mfx_load_plugin.cpp
|
||||
src/mfx_plugin_hive.cpp
|
||||
src/mfx_win_reg_key.cpp
|
||||
+ src/mfx_driver_store_loader.cpp
|
||||
)
|
||||
endif (CMAKE_SYSTEM_NAME MATCHES "Windows")
|
||||
|
||||
@@ -56,6 +56,12 @@
|
||||
configure_file (${CMAKE_SOURCE_DIR}/libmfx.pc.cmake ${CMAKE_BINARY_DIR}/libmfx.pc @ONLY)
|
||||
|
||||
add_library( mfx STATIC ${SOURCES} )
|
||||
+
|
||||
+if (CMAKE_SYSTEM_NAME MATCHES "Windows")
|
||||
+ set_target_properties(mfx
|
||||
+ PROPERTIES PREFIX lib)
|
||||
+endif (CMAKE_SYSTEM_NAME MATCHES "Windows")
|
||||
+
|
||||
install (DIRECTORY ${CMAKE_SOURCE_DIR}/mfx DESTINATION ${CMAKE_INSTALL_PREFIX}/include FILES_MATCHING PATTERN "*.h")
|
||||
install (FILES ${CMAKE_BINARY_DIR}/libmfx.pc DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/pkgconfig)
|
||||
install (TARGETS mfx ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
|
||||
Index: libmfx.pc.cmake
|
||||
IDEA additional info:
|
||||
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
||||
<+>UTF-8
|
||||
===================================================================
|
||||
diff --git a/libmfx.pc.cmake b/libmfx.pc.cmake
|
||||
--- a/libmfx.pc.cmake (revision 7e4d221c36c630c1250b23a5dfa15657bc04c10c)
|
||||
+++ b/libmfx.pc.cmake (revision 388559e9e8234eb0989e1598a9beea4035a04132)
|
||||
@@ -9,6 +9,6 @@
|
||||
Requires:
|
||||
Requires.private:
|
||||
Conflicts:
|
||||
-Libs: -L${libdir} -lsupc++ ${libdir}/libmfx.a
|
||||
+Libs: -L${libdir} -lsupc++ ${libdir}/libmfx.lib
|
||||
Libs.private:
|
||||
Cflags: -I${includedir} -I@INTELMEDIASDK_PATH@
|
||||
Index: src/mfx_driver_store_loader.cpp
|
||||
IDEA additional info:
|
||||
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
||||
<+>UTF-8
|
||||
===================================================================
|
||||
diff --git a/src/mfx_driver_store_loader.cpp b/src/mfx_driver_store_loader.cpp
|
||||
--- a/src/mfx_driver_store_loader.cpp (revision 388559e9e8234eb0989e1598a9beea4035a04132)
|
||||
+++ b/src/mfx_driver_store_loader.cpp (revision 5ebef171699530ca01594a5cef10a68811f4d105)
|
||||
@@ -24,6 +24,9 @@
|
||||
#include "mfx_dispatcher_log.h"
|
||||
#include "mfx_load_dll.h"
|
||||
|
||||
+#pragma comment(lib, "Ole32.lib")
|
||||
+#pragma comment(lib, "Advapi32.lib")
|
||||
+
|
||||
namespace MFX
|
||||
{
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
vcpkg_download_distfile(
|
||||
MISSING_CSTDINT_IMPORT_PATCH
|
||||
URLS https://github.com/lu-zero/mfx_dispatch/commit/d6241243f85a0d947bdfe813006686a930edef24.patch?full_index=1
|
||||
FILENAME fix-missing-cstdint-import-d6241243f85a0d947bdfe813006686a930edef24.patch
|
||||
SHA512 5d2ffc4ec2ba0e5859d01d2e072f75436ebc3e62e0f6580b5bb8b9f82fe588e7558a46a1fdfa0297a782c0eeb8f50322258d0dd9e41d927cc9be496727b61e44
|
||||
)
|
||||
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO lu-zero/mfx_dispatch
|
||||
REF "${VERSION}"
|
||||
SHA512 12517338342d3e653043a57e290eb9cffd190aede0c3a3948956f1c7f12f0ea859361cf3e534ab066b96b1c211f68409c67ef21fd6d76b68cc31daef541941b0
|
||||
HEAD_REF master
|
||||
PATCHES
|
||||
fix-unresolved-symbol.patch
|
||||
fix-pkgconf.patch
|
||||
0003-upgrade-cmake-3.14.patch
|
||||
${MISSING_CSTDINT_IMPORT_PATCH}
|
||||
)
|
||||
|
||||
if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
|
||||
vcpkg_cmake_configure(
|
||||
SOURCE_PATH "${SOURCE_PATH}"
|
||||
)
|
||||
vcpkg_cmake_install()
|
||||
vcpkg_copy_pdbs()
|
||||
else()
|
||||
if(VCPKG_TARGET_IS_MINGW)
|
||||
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
|
||||
endif()
|
||||
vcpkg_configure_make(
|
||||
SOURCE_PATH "${SOURCE_PATH}"
|
||||
AUTOCONFIG
|
||||
)
|
||||
vcpkg_install_make()
|
||||
endif()
|
||||
vcpkg_fixup_pkgconfig()
|
||||
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
|
||||
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"name": "mfx-dispatch",
|
||||
"version": "1.35.1",
|
||||
"port-version": 5,
|
||||
"description": "Open source Intel media sdk dispatcher",
|
||||
"homepage": "https://github.com/lu-zero/mfx_dispatch",
|
||||
"license": "BSD-3-Clause",
|
||||
"supports": "((x86 | x64) & (android | linux)) | (windows & !uwp)",
|
||||
"dependencies": [
|
||||
{
|
||||
"name": "vcpkg-cmake",
|
||||
"host": true,
|
||||
"platform": "windows & !mingw"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
diff --git a/cmake/OpusPackageVersion.cmake b/cmake/OpusPackageVersion.cmake
|
||||
index 447ce3b..15ebd8e 100644
|
||||
--- a/cmake/OpusPackageVersion.cmake
|
||||
+++ b/cmake/OpusPackageVersion.cmake
|
||||
@@ -4,7 +4,9 @@ endif()
|
||||
set(__opus_version INCLUDED)
|
||||
|
||||
function(get_package_version PACKAGE_VERSION PROJECT_VERSION)
|
||||
-
|
||||
+ set(PACKAGE_VERSION "0" CACHE STRING "opus package version")
|
||||
+ set(PROJECT_VERSION "0" CACHE STRING "opus project version")
|
||||
+ return()
|
||||
find_package(Git)
|
||||
if(GIT_FOUND AND EXISTS "${CMAKE_CURRENT_LIST_DIR}/.git")
|
||||
execute_process(COMMAND ${GIT_EXECUTABLE}
|
||||
@@ -0,0 +1,61 @@
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO xiph/opus
|
||||
REF "v${VERSION}"
|
||||
SHA512 4ffefd9c035671024f9720c5129bfe395dea04f0d6b730041c2804e89b1db6e4d19633ad1ae58855afc355034233537361e707f26dc53adac916554830038fab
|
||||
HEAD_REF main
|
||||
PATCHES fix-pkgconfig-version.patch
|
||||
)
|
||||
|
||||
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
|
||||
FEATURES
|
||||
avx2 AVX2_SUPPORTED
|
||||
)
|
||||
|
||||
set(ADDITIONAL_OPUS_OPTIONS "")
|
||||
if(VCPKG_TARGET_IS_MINGW)
|
||||
set(STACK_PROTECTOR OFF)
|
||||
string(APPEND VCPKG_C_FLAGS "-D_FORTIFY_SOURCE=0")
|
||||
string(APPEND VCPKG_CXX_FLAGS "-D_FORTIFY_SOURCE=0")
|
||||
if(VCPKG_TARGET_ARCHITECTURE MATCHES "^(ARM|arm)64$")
|
||||
list(APPEND ADDITIONAL_OPUS_OPTIONS "-DOPUS_USE_NEON=OFF") # for version 1.3.1 (remove for future Opus release)
|
||||
list(APPEND ADDITIONAL_OPUS_OPTIONS "-DOPUS_DISABLE_INTRINSICS=ON") # for HEAD (and future Opus release)
|
||||
endif()
|
||||
elseif(VCPKG_TARGET_IS_EMSCRIPTEN)
|
||||
set(STACK_PROTECTOR OFF)
|
||||
else()
|
||||
set(STACK_PROTECTOR ON)
|
||||
endif()
|
||||
|
||||
if((VCPKG_TARGET_IS_LINUX AND VCPKG_TARGET_ARCHITECTURE STREQUAL "arm") OR
|
||||
(VCPKG_TARGET_IS_ANDROID AND VCPKG_TARGET_ARCHITECTURE STREQUAL "arm" AND VCPKG_CMAKE_CONFIGURE_OPTIONS MATCHES "ANDROID_ARM_NEON"))
|
||||
message(STATUS "Disabling ARM NEON and intrinsics on ${TARGET_TRIPLET}")
|
||||
list(APPEND ADDITIONAL_OPUS_OPTIONS "-DOPUS_DISABLE_INTRINSICS=ON -DCOMPILER_SUPPORTS_NEON=OFF") # for HEAD (and future Opus release)
|
||||
endif()
|
||||
|
||||
vcpkg_cmake_configure(
|
||||
SOURCE_PATH "${SOURCE_PATH}"
|
||||
OPTIONS ${FEATURE_OPTIONS}
|
||||
-DPACKAGE_VERSION=${VERSION}
|
||||
-DOPUS_STACK_PROTECTOR=${STACK_PROTECTOR}
|
||||
-DOPUS_INSTALL_PKG_CONFIG_MODULE=ON
|
||||
-DOPUS_INSTALL_CMAKE_CONFIG_MODULE=ON
|
||||
-DOPUS_BUILD_PROGRAMS=OFF
|
||||
-DOPUS_BUILD_TESTING=OFF
|
||||
${ADDITIONAL_OPUS_OPTIONS}
|
||||
MAYBE_UNUSED_VARIABLES
|
||||
OPUS_USE_NEON
|
||||
OPUS_DISABLE_INTRINSICS
|
||||
)
|
||||
vcpkg_cmake_install()
|
||||
vcpkg_copy_pdbs()
|
||||
|
||||
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/Opus)
|
||||
vcpkg_fixup_pkgconfig(SYSTEM_LIBRARIES m)
|
||||
|
||||
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/lib/cmake"
|
||||
"${CURRENT_PACKAGES_DIR}/lib/cmake"
|
||||
"${CURRENT_PACKAGES_DIR}/debug/include")
|
||||
|
||||
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING")
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"name": "opus",
|
||||
"version": "1.5.2",
|
||||
"description": "Totally open, royalty-free, highly versatile audio codec",
|
||||
"homepage": "https://github.com/xiph/opus",
|
||||
"license": "BSD-3-Clause",
|
||||
"dependencies": [
|
||||
{
|
||||
"name": "vcpkg-cmake",
|
||||
"host": true
|
||||
},
|
||||
{
|
||||
"name": "vcpkg-cmake-config",
|
||||
"host": true
|
||||
}
|
||||
],
|
||||
"features": {
|
||||
"avx2": {
|
||||
"description": "Builds the library with avx2 instruction set"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user