From fbc02376ef8b4460010dea946da89afec16e7b1a Mon Sep 17 00:00:00 2001 From: Matt Oliver Date: Sun, 10 May 2020 02:56:49 +1000 Subject: [PATCH] [ffmpeg] Add iconv, fdk-aac, mp3lame, opus, soxr, theora support. Closes #9671 --- ports/ffmpeg/0007-fix-lib-naming.patch | 5 +- ports/ffmpeg/CONTROL | 78 ++++++++++++------- ports/ffmpeg/portfile.cmake | 100 +++++++++++++++++-------- 3 files changed, 123 insertions(+), 60 deletions(-) diff --git a/ports/ffmpeg/0007-fix-lib-naming.patch b/ports/ffmpeg/0007-fix-lib-naming.patch index d2a688cf5068bc..f4cc5e94efcbbd 100644 --- a/ports/ffmpeg/0007-fix-lib-naming.patch +++ b/ports/ffmpeg/0007-fix-lib-naming.patch @@ -2,11 +2,14 @@ diff --git a/configure b/configure index d6c4388..75b96c3 100644 --- a/configure +++ b/configure -@@ -4378,6 +4378,7 @@ msvc_common_flags(){ +@@ -4378,6 +4378,10 @@ msvc_common_flags(){ -march=*) ;; -lz) echo zlib.lib ;; + -lzd) echo zlibd.lib ;; -lx264) echo libx264.lib ;; ++ -lx265) echo libx265.lib ;; ++ -lmp3lame) echo libmp3lame.lib ;; ++ -liconv) echo libiconv.lib ;; -lstdc++) ;; -l*) echo ${flag#-l}.lib ;; -LARGEADDRESSAWARE) echo $flag ;; diff --git a/ports/ffmpeg/CONTROL b/ports/ffmpeg/CONTROL index a1306babd99c88..d669ede748b3b6 100644 --- a/ports/ffmpeg/CONTROL +++ b/ports/ffmpeg/CONTROL @@ -18,49 +18,73 @@ Description: ffplay appplication support in ffmpeg Feature: ffprobe Description: ffprobe appplication support in ffmpeg -Feature: openssl -Build-Depends: openssl, ffmpeg[nonfree] -Description: openssl support in ffmpeg +Feature: avresample +Description: Libav audio resampling library support in ffmpeg -Feature: lzma -Build-Depends: liblzma -Description: lzma support in ffmpeg +Feature: nonfree +Description: allow nonfree and unredistributable libraries + +Feature: gpl +Description: allow GPL licensed libraries + +Feature: version3 +Description: upgrade (L)GPL to version 3 + +Feature: avisynthplus +Build-Depends: avisynthplus, ffmpeg[gpl] +Description: avisynthplus support in ffmpeg Feature: bzip2 Build-Depends: bzip2 Description: bzip2 support in ffmpeg -Feature: vpx -Build-Depends: libvpx -Description: WebM VP8/VP9 support in ffmpeg +Feature: iconv +Build-Depends: libiconv +Description: iconv support in ffmpeg -Feature: x264 -Build-Depends: x264, ffmpeg[gpl] -Description: x264 support in ffmpeg +Feature: fdk-aac +Build-Depends: fdk-aac, ffmpeg[nonfree] +Description: AAC de/encoding via libfdk-aac support in ffmpeg + +Feature: lzma +Build-Depends: liblzma +Description: lzma support in ffmpeg + +Feature: mp3lame +Build-Depends: mp3lame +Description: MP3 encoding via libmp3lame support in ffmpeg + +Feature: nvcodec +Build-Depends: ffnvcodec, cuda +Description: Hardware accelerated codecs Feature: opencl Build-Depends: opencl -Description: opencl support in ffmpeg +Description: OpenCL processing support in ffmpeg -Feature: nonfree -Description: allow nonfree and unredistributable libraries +Feature: openssl +Build-Depends: openssl, ffmpeg[nonfree] +Description: openssl support in ffmpeg -Feature: gpl -Description: allow GPL licensed libraries +Feature: opus +Build-Depends: opus +Description: Opus de/encoding via libopus support in ffmpeg -Feature: version3 -Description: upgrade (L)GPL to version 3 +Feature: soxr +Build-Depends: soxr +Description: libsoxr resampling support in ffmpeg -Feature: avresample -Description: Libav audio resampling library support in ffmpeg +Feature: theora +Build-Depends: libtheora +Description: Theora encoding via libtheora support in ffmpeg -Feature: nvcodec -Build-Depends: ffnvcodec, cuda -Description: Hardware accelerated codecs +Feature: vpx +Build-Depends: libvpx +Description: VP8 and VP9 de/encoding via libvpx support in ffmpeg -Feature: avisynthplus -Build-Depends: avisynthplus, ffmpeg[gpl] -Description: avisynthplus support in ffmpeg +Feature: x264 +Build-Depends: x264, ffmpeg[gpl] +Description: H.264 encoding via x264 support in ffmpeg Feature: zlib Build-Depends: zlib diff --git a/ports/ffmpeg/portfile.cmake b/ports/ffmpeg/portfile.cmake index 727042af023cdd..5bb7d21cc2fca5 100644 --- a/ports/ffmpeg/portfile.cmake +++ b/ports/ffmpeg/portfile.cmake @@ -37,9 +37,9 @@ if(VCPKG_TARGET_IS_WINDOWS) set(BUILD_SCRIPT ${CMAKE_CURRENT_LIST_DIR}\\build.sh) if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm" OR VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64") - vcpkg_acquire_msys(MSYS_ROOT PACKAGES perl gcc diffutils make) + vcpkg_acquire_msys(MSYS_ROOT PACKAGES perl gcc diffutils make pkg-config) else() - vcpkg_acquire_msys(MSYS_ROOT PACKAGES diffutils make) + vcpkg_acquire_msys(MSYS_ROOT PACKAGES diffutils make pkg-config) endif() set(BASH ${MSYS_ROOT}/usr/bin/bash.exe) @@ -70,12 +70,6 @@ if("version3" IN_LIST FEATURES) set(OPTIONS "${OPTIONS} --enable-version3") endif() -if("openssl" IN_LIST FEATURES) - set(OPTIONS "${OPTIONS} --enable-openssl") -else() - set(OPTIONS "${OPTIONS} --disable-openssl") -endif() - if("ffmpeg" IN_LIST FEATURES) set(OPTIONS "${OPTIONS} --enable-ffmpeg") else() @@ -94,22 +88,34 @@ else() set(OPTIONS "${OPTIONS} --disable-ffprobe") endif() -if("vpx" IN_LIST FEATURES) - set(OPTIONS "${OPTIONS} --enable-libvpx") +if("avresample" IN_LIST FEATURES) + set(OPTIONS "${OPTIONS} --enable-avresample") +endif() + +if("avisynthplus" IN_LIST FEATURES) + set(OPTIONS "${OPTIONS} --enable-avisynth") else() - set(OPTIONS "${OPTIONS} --disable-libvpx") + set(OPTIONS "${OPTIONS} --disable-avisynth") endif() -if("x264" IN_LIST FEATURES) - set(OPTIONS "${OPTIONS} --enable-libx264") +set (ENABLE_BZIP2 OFF) +if("bzip2" IN_LIST FEATURES) + set(OPTIONS "${OPTIONS} --enable-bzlib") + set (ENABLE_BZIP2 ON) #necessary for configuring FFMPEG CMake Module else() - set(OPTIONS "${OPTIONS} --disable-libx264") + set(OPTIONS "${OPTIONS} --disable-bzlib") endif() -if("opencl" IN_LIST FEATURES) - set(OPTIONS "${OPTIONS} --enable-opencl") +if("iconv" IN_LIST FEATURES) + set(OPTIONS "${OPTIONS} --enable-iconv") else() - set(OPTIONS "${OPTIONS} --disable-opencl") + set(OPTIONS "${OPTIONS} --disable-iconv") +endif() + +if("fdk-aac" IN_LIST FEATURES) + set(OPTIONS "${OPTIONS} --enable-libfdk-aac") +else() + set(OPTIONS "${OPTIONS} --disable-libfdk-aac") endif() set (ENABLE_LZMA OFF) @@ -120,32 +126,58 @@ else() set(OPTIONS "${OPTIONS} --disable-lzma") endif() -set (ENABLE_BZIP2 OFF) -if("bzip2" IN_LIST FEATURES) - set(OPTIONS "${OPTIONS} --enable-bzlib") - set (ENABLE_BZIP2 ON) #necessary for configuring FFMPEG CMake Module +if("mp3lame" IN_LIST FEATURES) + set(OPTIONS "${OPTIONS} --enable-libmp3lame") else() - set(OPTIONS "${OPTIONS} --disable-bzlib") + set(OPTIONS "${OPTIONS} --disable-libmp3lame") endif() -if("avresample" IN_LIST FEATURES) - set(OPTIONS "${OPTIONS} --enable-avresample") +if("nvcodec" IN_LIST FEATURES) + set(OPTIONS "${OPTIONS} --enable-cuda --enable-nvenc --enable-cuvid --disable-libnpp") +else() + set(OPTIONS "${OPTIONS} --disable-cuda --disable-nvenc --disable-cuvid --disable-libnpp") endif() -if (VCPKG_TARGET_IS_OSX) - set(OPTIONS "${OPTIONS} --disable-vdpau") # disable vdpau in OSX +if("opencl" IN_LIST FEATURES) + set(OPTIONS "${OPTIONS} --enable-opencl") +else() + set(OPTIONS "${OPTIONS} --disable-opencl") endif() -if("nvcodec" IN_LIST FEATURES) - set(OPTIONS "${OPTIONS} --enable-cuda --enable-nvenc --enable-cuvid --disable-libnpp") +if("openssl" IN_LIST FEATURES) + set(OPTIONS "${OPTIONS} --enable-openssl") else() - set(OPTIONS "${OPTIONS} --disable-cuda --disable-nvenc --disable-cuvid --disable-libnpp") + set(OPTIONS "${OPTIONS} --disable-openssl") endif() -if("avisynthplus" IN_LIST FEATURES) - set(OPTIONS "${OPTIONS} --enable-avisynth") +if("opus" IN_LIST FEATURES) + set(OPTIONS "${OPTIONS} --enable-libopus") else() - set(OPTIONS "${OPTIONS} --disable-avisynth") + set(OPTIONS "${OPTIONS} --disable-libopus") +endif() + +if("soxr" IN_LIST FEATURES) + set(OPTIONS "${OPTIONS} --enable-libsoxr") +else() + set(OPTIONS "${OPTIONS} --disable-libsoxr") +endif() + +if("theora" IN_LIST FEATURES) + set(OPTIONS "${OPTIONS} --enable-libtheora") +else() + set(OPTIONS "${OPTIONS} --disable-libtheora") +endif() + +if("vpx" IN_LIST FEATURES) + set(OPTIONS "${OPTIONS} --enable-libvpx") +else() + set(OPTIONS "${OPTIONS} --disable-libvpx") +endif() + +if("x264" IN_LIST FEATURES) + set(OPTIONS "${OPTIONS} --enable-libx264") +else() + set(OPTIONS "${OPTIONS} --disable-libx264") endif() if("zlib" IN_LIST FEATURES) @@ -154,6 +186,10 @@ else() set(OPTIONS "${OPTIONS} --disable-zlib") endif() +if (VCPKG_TARGET_IS_OSX) + set(OPTIONS "${OPTIONS} --disable-vdpau") # disable vdpau in OSX +endif() + set(OPTIONS_CROSS "") if (VCPKG_TARGET_ARCHITECTURE STREQUAL "arm" OR VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")