Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows MINGW update ffmpeg, libraw, OpencolorIO. #943

Draft
wants to merge 13 commits into
base: RB-2.5
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions tools/MINGW-packages/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ mingw-w64-shiboken
mingw-w64-pyside
mingw-w64-imath
mingw-w64-openexr
mingw-w64-libraw-gpl2
mingw-w64-opencolorio2-git
mingw-w64-libraw
mingw-w64-opencolorio
mingw-w64-openimageio
mingw-w64-seexpr-git
mingw-w64-x264-git
mingw-w64-ffmpeg-gpl2
mingw-w64-ffmpeg
mingw-w64-sox
mingw-w64-poppler
mingw-w64-imagemagick
Expand Down
6 changes: 3 additions & 3 deletions tools/MINGW-packages/build_natron_package_repo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ PKGS="
mingw-w64-natron-setup
mingw-w64-imath
mingw-w64-openexr
mingw-w64-libraw-gpl2
mingw-w64-opencolorio2-git
mingw-w64-libraw
mingw-w64-opencolorio
mingw-w64-openimageio
mingw-w64-seexpr-git
mingw-w64-x264-git
mingw-w64-ffmpeg-gpl2
mingw-w64-ffmpeg
mingw-w64-sox
mingw-w64-poppler
mingw-w64-imagemagick
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 03998dc064..c8c16a9332 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -19,6 +19,7 @@
framequeue.o \
graphdump.o \
graphparser.o \
+ pathtools.o \
version.o \
video.o \

--- ffmpeg-6.0/libavfilter/vf_frei0r.c.orig 2023-02-27 21:43:45.000000000 +0100
+++ ffmpeg-6.0/libavfilter/vf_frei0r.c 2023-11-06 19:53:02.978838800 +0100
@@ -42,6 +42,7 @@
#include "formats.h"
#include "internal.h"
#include "video.h"
+#include "pathtools.h"

typedef f0r_instance_t (*f0r_construct_f)(unsigned int width, unsigned int height);
typedef void (*f0r_destruct_f)(f0r_instance_t instance);
@@ -192,12 +193,22 @@
char *path;
int ret = 0;
int i;
+#ifdef _WIN32
+ static char pathlist_entry[PATH_MAX];
+ static const char* const frei0r_pathlist[] = {
+ &pathlist_entry[0]
+ };
+ char *plugin_path = single_path_relocation_lib("/prefix/bin/", "/prefix/lib/frei0r-1/");
+ av_strlcpy(pathlist_entry, plugin_path, sizeof (pathlist_entry) / sizeof (pathlist_entry[0]));
+ free(plugin_path);
+#else
static const char* const frei0r_pathlist[] = {
"/usr/local/lib/frei0r-1/",
"/usr/lib/frei0r-1/",
"/usr/local/lib64/frei0r-1/",
"/usr/lib64/frei0r-1/"
};
+#endif

if (!dl_name) {
av_log(ctx, AV_LOG_ERROR, "No filter name provided.\n");
66 changes: 66 additions & 0 deletions tools/MINGW-packages/mingw-w64-ffmpeg/0009-wrong-null-type.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
diff -Nur ffmpeg-6.1-orig/libavcodec/vulkan_av1.c ffmpeg-6.1/libavcodec/vulkan_av1.c
--- ffmpeg-6.1-orig/libavcodec/vulkan_av1.c 2023-11-11 01:25:17.000000000 +0100
+++ ffmpeg-6.1/libavcodec/vulkan_av1.c 2023-11-11 10:45:06.826832600 +0100
@@ -180,7 +180,7 @@
.sType = VK_STRUCTURE_TYPE_VIDEO_SESSION_PARAMETERS_CREATE_INFO_KHR,
.pNext = &av1_params,
.videoSession = ctx->common.session,
- .videoSessionParametersTemplate = NULL,
+ .videoSessionParametersTemplate = VK_NULL_HANDLE,
};

err = ff_vk_decode_create_params(buf, avctx, ctx, &session_params_create);
diff -Nur ffmpeg-6.1-orig/libavcodec/vulkan_decode.c ffmpeg-6.1/libavcodec/vulkan_decode.c
--- ffmpeg-6.1-orig/libavcodec/vulkan_decode.c 2023-11-11 01:25:17.000000000 +0100
+++ ffmpeg-6.1/libavcodec/vulkan_decode.c 2023-11-11 10:47:06.921322700 +0100
@@ -187,10 +187,10 @@
if (vkpic->img_view_ref)
return 0;

- vkpic->dpb_frame = NULL;
- vkpic->img_view_ref = NULL;
- vkpic->img_view_out = NULL;
- vkpic->img_view_dest = NULL;
+ vkpic->dpb_frame = VK_NULL_HANDLE;
+ vkpic->img_view_ref = VK_NULL_HANDLE;
+ vkpic->img_view_out = VK_NULL_HANDLE;
+ vkpic->img_view_dest = VK_NULL_HANDLE;

vkpic->destroy_image_view = vk->DestroyImageView;
vkpic->wait_semaphores = vk->WaitSemaphores;
diff -Nur ffmpeg-6.1-orig/libavcodec/vulkan_h264.c ffmpeg-6.1/libavcodec/vulkan_h264.c
--- ffmpeg-6.1-orig/libavcodec/vulkan_h264.c 2023-11-11 01:25:17.000000000 +0100
+++ ffmpeg-6.1/libavcodec/vulkan_h264.c 2023-11-11 10:45:57.371334900 +0100
@@ -315,7 +315,7 @@
.sType = VK_STRUCTURE_TYPE_VIDEO_SESSION_PARAMETERS_CREATE_INFO_KHR,
.pNext = &h264_params,
.videoSession = ctx->common.session,
- .videoSessionParametersTemplate = NULL,
+ .videoSessionParametersTemplate = VK_NULL_HANDLE,
};

/* SPS list */
diff -Nur ffmpeg-6.1-orig/libavcodec/vulkan_hevc.c ffmpeg-6.1/libavcodec/vulkan_hevc.c
--- ffmpeg-6.1-orig/libavcodec/vulkan_hevc.c 2023-11-11 01:25:17.000000000 +0100
+++ ffmpeg-6.1/libavcodec/vulkan_hevc.c 2023-11-11 10:46:24.663058100 +0100
@@ -653,7 +653,7 @@
.sType = VK_STRUCTURE_TYPE_VIDEO_SESSION_PARAMETERS_CREATE_INFO_KHR,
.pNext = &h265_params,
.videoSession = ctx->common.session,
- .videoSessionParametersTemplate = NULL,
+ .videoSessionParametersTemplate = VK_NULL_HANDLE,
};

HEVCHeaderSet *hdr;
diff -Nur ffmpeg-6.1-orig/libavcodec/vulkan_video.c ffmpeg-6.1/libavcodec/vulkan_video.c
--- ffmpeg-6.1-orig/libavcodec/vulkan_video.c 2023-11-11 01:25:17.000000000 +0100
+++ ffmpeg-6.1/libavcodec/vulkan_video.c 2023-11-11 10:47:38.629188400 +0100
@@ -287,7 +287,7 @@
if (common->session) {
vk->DestroyVideoSessionKHR(s->hwctx->act_dev, common->session,
s->hwctx->alloc);
- common->session = NULL;
+ common->session = VK_NULL_HANDLE;
}

if (common->nb_mem && common->mem)
218 changes: 218 additions & 0 deletions tools/MINGW-packages/mingw-w64-ffmpeg/PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,218 @@
# Maintainer: Alexey Pavlov <[email protected]>
# Contributor: Zach Bacon <[email protected]>
# Contributor: wirx6 <[email protected]>
# Contributor: Ray Donnelly <[email protected]>

_realname=ffmpeg
pkgbase="mingw-w64-natron_${_realname}"
pkgname="${MINGW_PACKAGE_PREFIX}-natron_${_realname}"
pkgver=6.1.1
pkgrel=99.1
pkgdesc="Complete solution to record, convert and stream audio and video (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32' 'clangarm64')
url="https://ffmpeg.org/"
license=('spdx:GPL-3.0-or-later')
depends=("${MINGW_PACKAGE_PREFIX}-aom"
"${MINGW_PACKAGE_PREFIX}-bzip2"
"${MINGW_PACKAGE_PREFIX}-frei0r-plugins"
"${MINGW_PACKAGE_PREFIX}-fribidi"
"${MINGW_PACKAGE_PREFIX}-fontconfig"
"${MINGW_PACKAGE_PREFIX}-dav1d"
"${MINGW_PACKAGE_PREFIX}-gmp"
"${MINGW_PACKAGE_PREFIX}-gnutls"
"${MINGW_PACKAGE_PREFIX}-gsm"
"${MINGW_PACKAGE_PREFIX}-lame"
"${MINGW_PACKAGE_PREFIX}-libass"
"${MINGW_PACKAGE_PREFIX}-libbluray"
"${MINGW_PACKAGE_PREFIX}-libcaca"
"${MINGW_PACKAGE_PREFIX}-libexif"
"${MINGW_PACKAGE_PREFIX}-libgme"
"${MINGW_PACKAGE_PREFIX}-libiconv"
"${MINGW_PACKAGE_PREFIX}-libmodplug"
"${MINGW_PACKAGE_PREFIX}-libssh"
"${MINGW_PACKAGE_PREFIX}-libplacebo"
"${MINGW_PACKAGE_PREFIX}-librsvg"
"${MINGW_PACKAGE_PREFIX}-libsoxr"
"${MINGW_PACKAGE_PREFIX}-libtheora"
"${MINGW_PACKAGE_PREFIX}-libva"
"${MINGW_PACKAGE_PREFIX}-libvorbis"
"${MINGW_PACKAGE_PREFIX}-libvpx"
"${MINGW_PACKAGE_PREFIX}-libwebp"
"${MINGW_PACKAGE_PREFIX}-libxml2"
"${MINGW_PACKAGE_PREFIX}-libvpl"
"${MINGW_PACKAGE_PREFIX}-openal"
"${MINGW_PACKAGE_PREFIX}-opencore-amr"
"${MINGW_PACKAGE_PREFIX}-openjpeg2"
"${MINGW_PACKAGE_PREFIX}-opus"
"${MINGW_PACKAGE_PREFIX}-rav1e"
"${MINGW_PACKAGE_PREFIX}-rtmpdump"
"${MINGW_PACKAGE_PREFIX}-SDL2"
"${MINGW_PACKAGE_PREFIX}-speex"
"${MINGW_PACKAGE_PREFIX}-srt"
$([[ "${CARCH}" == "i686" ]] || echo "${MINGW_PACKAGE_PREFIX}-svt-av1")
"${MINGW_PACKAGE_PREFIX}-vid.stab"
"${MINGW_PACKAGE_PREFIX}-vulkan"
"${MINGW_PACKAGE_PREFIX}-libx264"
"${MINGW_PACKAGE_PREFIX}-x265"
"${MINGW_PACKAGE_PREFIX}-xvidcore"
"${MINGW_PACKAGE_PREFIX}-zimg"
"${MINGW_PACKAGE_PREFIX}-zlib")
makedepends=("${MINGW_PACKAGE_PREFIX}-cc"
"${MINGW_PACKAGE_PREFIX}-autotools"
"${MINGW_PACKAGE_PREFIX}-pkgconf"
"${MINGW_PACKAGE_PREFIX}-dlfcn"
$([[ ${MINGW_PACKAGE_PREFIX} == *-clang-aarch64* ]] || echo "${MINGW_PACKAGE_PREFIX}-amf-headers")
$([[ ${MINGW_PACKAGE_PREFIX} == *-clang-aarch64* ]] || echo "${MINGW_PACKAGE_PREFIX}-ffnvcodec-headers")
$([[ ${MINGW_PACKAGE_PREFIX} == *-clang-aarch64* ]] || echo "${MINGW_PACKAGE_PREFIX}-nasm"))
source=(https://ffmpeg.org/releases/${_realname}-${pkgver}.tar.xz{,.asc}
"pathtools.c"
"pathtools.h"
"0005-Win32-Add-path-relocation-to-frei0r-plugins-search.patch"
"0009-wrong-null-type.patch")
validpgpkeys=('FCF986EA15E6E293A5644F10B4322F04D67658D8')
sha256sums=('8684f4b00f94b85461884c3719382f1261f0d9eb3d59640a1f4ac0873616f968'
'SKIP'
'ebf471173f5ee9c4416c10a78760cea8afaf1a4a6e653977321e8547ce7bf3c0'
'1585ef1b61cf53a2ca27049c11d49e0834683dfda798f03547761375df482a90'
'8c74e9b5800dbb41c33a60114712726ec768ad6de8f147c2eb30656fd4c899cc'
'f76048e6e1944e15f646a52b75e75bc8906ca80f2a3124fba6a2050722750447')

# Helper macros to help make tasks easier #
apply_patch_with_msg() {
for _fname in "$@"
do
msg2 "Applying ${_fname}"
patch -Nbp1 -i "${srcdir}"/${_fname}
done
}

prepare() {
test ! -d "${startdir}/../mingw-w64-pathtools" || {
cmp "${startdir}/../mingw-w64-pathtools/pathtools.c" "${srcdir}/pathtools.c" &&
cmp "${startdir}/../mingw-w64-pathtools/pathtools.h" "${srcdir}/pathtools.h"
} || exit 1

cd "${srcdir}/${_realname}-${pkgver}"
cp -fHv "${srcdir}"/pathtools.[ch] libavfilter/

apply_patch_with_msg \
0005-Win32-Add-path-relocation-to-frei0r-plugins-search.patch

apply_patch_with_msg 0009-wrong-null-type.patch
}

build() {
local -a common_config
common_config+=(
--disable-debug
--disable-stripping
--disable-doc
--enable-dxva2
--enable-d3d11va
--enable-fontconfig
--enable-frei0r
--enable-gmp
--enable-gnutls
--enable-gpl
--enable-iconv
--enable-libaom
--enable-libass
--enable-libbluray
--enable-libcaca
--enable-libdav1d
--enable-libfreetype
--enable-libfribidi
--enable-libgme
--enable-libgsm
--enable-libmodplug
--enable-libmp3lame
--enable-libopencore_amrnb
--enable-libopencore_amrwb
--enable-libopenjpeg
--enable-libopus
--enable-libplacebo
--enable-librsvg
--enable-librtmp
--enable-libssh
--enable-libsoxr
--enable-libspeex
--enable-libsrt
--enable-libtheora
--enable-libvidstab
--enable-libvorbis
--enable-libx264
--enable-libx265
--enable-libxvid
--enable-libvpx
--enable-libwebp
--enable-libxml2
--enable-libzimg
--enable-openal
--enable-pic
--enable-postproc
--enable-runtime-cpudetect
--enable-swresample
--enable-version3
--enable-vulkan
--enable-zlib
--enable-librav1e
--enable-libvpl
)

if [[ "${CARCH}" != "i686" ]]; then
common_config+=(
--enable-libsvtav1
)
fi

if [[ "${MINGW_PACKAGE_PREFIX}" != *clang-aarch64* ]]; then
common_config+=(
--enable-amf
--enable-nvenc
)
fi

for _variant in -static -shared; do
[[ -d "${srcdir}/build-${MSYSTEM}${_variant}" ]] && rm -rf "${srcdir}/build-${MSYSTEM}${_variant}"
mkdir -p "${srcdir}/build-${MSYSTEM}${_variant}" && cd "${srcdir}/build-${MSYSTEM}${_variant}"
if [[ ${_variant} == -static ]]; then
ENABLE_VARIANT="--enable-static --pkg-config-flags=--static"
else
ENABLE_VARIANT=--enable-shared
fi
../${_realname}-${pkgver}/configure \
--prefix=${MINGW_PREFIX} \
--target-os=mingw32 \
--arch=${CARCH%%-*} \
--cc=${CC} \
--cxx=${CXX} \
"${common_config[@]}" \
--logfile=config.log \
${ENABLE_VARIANT}

make
done
}

check() {
for _variant in -static -shared; do
cd "${srcdir}/build-${MSYSTEM}${_variant}"
# workaround for conflict with SDL main(), use it if you have SDL installed
# make check CC_C="-c -Umain"
make check || true
done
}

package() {
for _variant in -static -shared; do
cd "${srcdir}/build-${MSYSTEM}${_variant}"
make DESTDIR="${pkgdir}" install
done

rm -f ${pkgdir}/${MINGW_PREFIX}/lib/*.def
rm -f ${pkgdir}/${MINGW_PREFIX}/bin/*.lib

local PREFIX_DEPS=$(cygpath -am ${MINGW_PREFIX})
find ${pkgdir}${MINGW_PREFIX}/lib/pkgconfig -name *.pc -exec sed -i -e"s|${PREFIX_DEPS}|${MINGW_PREFIX}|g" {} \;
}
Loading
Loading