Skip to content

Commit

Permalink
Sync mingw-w64-ffmpeg with AUR version and disable glslang
Browse files Browse the repository at this point in the history
The build with glslang fails with `ERROR: spirv_compiler not found` and
adding `spirv-tools` to `makedepends` doesn't help.
  • Loading branch information
Martchus committed Dec 23, 2024
1 parent 225d793 commit 2a1a0f2
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 56 deletions.
96 changes: 68 additions & 28 deletions ffmpeg/mingw-w64/PKGBUILD
Original file line number Diff line number Diff line change
@@ -1,65 +1,81 @@
# Maintainer : Karl-Felix Glatzer <karl[dot]glatzer[at]gmx[dot]de>
# Maintainer of AUR version: Karl-Felix Glatzer <karl[dot]glatzer[at]gmx[dot]de>
# Contributor: Martchus <[email protected]>

pkgname=mingw-w64-ffmpeg
pkgver=5.0.1
pkgver=7.1
pkgrel=1
epoch=1
pkgdesc="Complete solution to record, convert and stream audio and video (mingw-w64)"
arch=('any')
url="https://ffmpeg.org/"
license=('GPL3')
url="https://ffmpeg.org"
license=('GPL-3.0-only')
depends=(
'mingw-w64-aom'
'mingw-w64-crt'
'mingw-w64-bzip2'
'mingw-w64-crt'
'mingw-w64-cairo'
'mingw-w64-dav1d'
'mingw-w64-fontconfig'
'mingw-w64-fribidi'
'mingw-w64-glslang'
'mingw-w64-gmp'
'mingw-w64-gnutls'
'mingw-w64-gsm'
'mingw-w64-harfbuzz'
'mingw-w64-lame'
'mingw-w64-libass'
'mingw-w64-libbluray'
'mingw-w64-dav1d'
'mingw-w64-libbs2b'
'mingw-w64-libdvdnav'
'mingw-w64-libdvdread'
'mingw-w64-libjxl'
'mingw-w64-libmodplug'
'mingw-w64-libopenmpt'
'mingw-w64-libplacebo'
'mingw-w64-librsvg'
'mingw-w64-libsoxr'
'mingw-w64-libssh'
'mingw-w64-libtheora'
'mingw-w64-vid.stab'
'mingw-w64-libwebp'
'mingw-w64-libxml2'
'mingw-w64-libvorbis'
'mingw-w64-libvpx'
'mingw-w64-libwebp'
'mingw-w64-libxml2'
'mingw-w64-vid.stab'
'mingw-w64-vmaf'
'mingw-w64-opencore-amr'
'mingw-w64-openjpeg2'
'mingw-w64-opus'
'mingw-w64-rav1e'
'mingw-w64-librsvg'
'mingw-w64-libssh'
'mingw-w64-sdl2'
'mingw-w64-snappy'
'mingw-w64-speex'
#'mingw-w64-spirv-tools' # required by glslang
'mingw-w64-srt'
'mingw-w64-vulkan-icd-loader'
'mingw-w64-x264'
'mingw-w64-x265'
'mingw-w64-xvidcore'
'mingw-w64-zimg'
'mingw-w64-zlib'
'mingw-w64-x265'
)
# TODO: Add vmaf dependency
#'mingw-w64-vmaf'

# 'mingw-w64-zeromq'
# 'mingw-w64-rubberband'
# 'mingw-w64-vapoursynth'
# 'mingw-w64-opencl-icd'
#'mingw-w64-svt-av1' (only 64 bit support)
options=(!strip !buildflags staticlibs)
makedepends=('mingw-w64-amf-headers' 'mingw-w64-avisynthplus' 'mingw-w64-gcc' 'mingw-w64-pkg-config' 'git' 'yasm')
_tag=9687cae2b468e09e35df4cea92cc2e6a0e6c93b3
options=(!strip !buildflags staticlibs !debug)
makedepends=('mingw-w64-amf-headers' 'mingw-w64-avisynthplus' 'mingw-w64-frei0r-plugins' 'mingw-w64-gcc' 'mingw-w64-pkg-config' 'mingw-w64-vulkan-headers' 'git' 'yasm')
# 'mingw-w64-opencl-headers'
_tag=507a51fbe9732f0f6f12f43ce12431e8faa834b7
#source=("git+https://git.ffmpeg.org/ffmpeg.git#tag=n${pkgver}"
source=(git+https://git.ffmpeg.org/ffmpeg.git#tag=${_tag}
ffmpeg-vmaf2.x.patch
source=(git+https://git.ffmpeg.org/ffmpeg.git?signed#tag=${_tag}
add-av_stream_get_first_dts-for-chromium.patch
configure.patch)
b2sums=('SKIP'
'65039aac811bfd143359e32720cd6ca64124f1789c1b624bd28a5bd75b37362b2a3b6b402203c4e9d137fb1d00895114f3789df40f8381091d38c98e7876cc8a'
'3f2ee7606500fa9444380d138959cd2bccfbba7d34629a17f4f6288c6bde29e931bbe922a7c25d861f057ddd4ba0b095bbd675c1930754746d5dd476b3ccbc13'
'600ce3b6c87378f6d0827ba837484c859a84595f63f6ffdc8d6f5d989ebab4b661b3d15810bdd1192b983119e131fec7421f18fb0ed642b965554d2f9e5efc64')
b2sums=('c7ec6b1db61608195117b79f3f0c8f6323c3abeb39721359da0f10e7d739da8301e04ff5fa83c022f86fc760f66e00066f9a50d97b771f797ccc679f9d912c40'
'555274228e09a233d92beb365d413ff5c718a782008075552cafb2130a3783cf976b51dfe4513c15777fb6e8397a34122d475080f2c4483e8feea5c0d878e6de'
'7171cf5055c4356f9aeb42a5bb550b3380cad20fff8dc4e9114d4fbb17e95bfe40c1057c3b7188641a1d7b9d026105e3eb0175789d7af30c5999793dfddf97fb')
validpgpkeys=(DD1EC9E8DE085C629B3E1846B18E8928B3948D64) # Michael Niedermayer <[email protected]>

_architectures="i686-w64-mingw32 x86_64-w64-mingw32"

Expand All @@ -68,9 +84,6 @@ prepare() {

patch -Np1 -i "${srcdir}/configure.patch"

# TODO: Add vmaf dependency
# patch -Np1 -i "${srcdir}"/ffmpeg-vmaf2.x.patch # vmaf 2.x support

patch -Np1 -i "${srcdir}"/add-av_stream_get_first_dts-for-chromium.patch # https://crbug.com/1251779
}

Expand All @@ -87,6 +100,11 @@ build() {
# avoid multiple definitions error
export LDFLAGS="$LDFLAGS -Wl,--allow-multiple-definition"

# Fix for GCC 14
export CFLAGS="$CFLAGS -Wno-error=int-conversion"

export PKG_CONFIG_PATH_CUSTOM="/usr/${_arch}/lib/mbedtls2/pkgconfig"

"${srcdir}"/ffmpeg/configure \
--prefix="/usr/${_arch}" \
--enable-cross-compile \
Expand All @@ -106,24 +124,34 @@ build() {
--enable-libaom \
--enable-libass \
--enable-libbluray \
--enable-libbs2b \
--enable-libdav1d \
--enable-libdvdnav \
--enable-libdvdread \
--enable-libfreetype \
--enable-frei0r \
--enable-libfribidi \
--enable-libgsm \
--enable-libharfbuzz \
--enable-libjxl \
--enable-libmodplug \
--enable-libmp3lame \
--enable-libopencore_amrnb \
--enable-libopencore_amrwb \
--enable-libopenjpeg \
--enable-libopenmpt \
--enable-libopus \
--enable-libplacebo \
--enable-librav1e \
--enable-librsvg \
--enable-libsnappy \
--enable-libsoxr \
--enable-libspeex \
--enable-libsrt \
--enable-libssh \
--enable-libtheora \
--enable-libvidstab \
--enable-libvmaf \
--enable-libvorbis \
--enable-libvpx \
--enable-libwebp \
Expand All @@ -132,14 +160,26 @@ build() {
--enable-libxml2 \
--enable-libxvid \
--enable-libzimg \
--enable-opengl \
--enable-zlib \
--enable-shared \
--enable-version3 \
--enable-vulkan \
--disable-libglslang \
--disable-doc \
--disable-w32threads \
--x86asmexe=yasm

# TODO: Add vmaf dependency
# --enable-libvmaf \
# fix linking of mbedtls
sed -i -e 's/-lmbedtls/-lmbedtls -lmbedx509 -lmbedcrypto/' ./ffbuild/config.mak
sed -i -e 's/-lmbedtls/-lmbedtls -lmbedx509 -lmbedcrypto/' ./ffbuild/config.sh

# TODO: mingw-w64-zeromq static library missing from package (also out-of-date)
# --enable-libzmq \
# Requires vsscript (which depends on cross compiling vapoursynth python modules)
# --enable-vapoursynth \
# Enable opencl if mingw-w64-opencl-icd works
# --enable-opencl \
# (only 64 bit support)
# --enable-libsvtav1 \

Expand Down
33 changes: 10 additions & 23 deletions ffmpeg/mingw-w64/add-av_stream_get_first_dts-for-chromium.patch
Original file line number Diff line number Diff line change
@@ -1,19 +1,7 @@
From 95aab0fd83619408995720ce53d7a74790580220 Mon Sep 17 00:00:00 2001
From: "[email protected]" <[email protected]>
Date: Wed, 7 Jul 2021 19:01:22 -0700
Subject: [PATCH] Add av_stream_get_first_dts for Chromium

[foutrelis: adjust for new FFStream struct replacing AVStreamInternal]
---
libavformat/avformat.h | 4 ++++
libavformat/utils.c | 7 +++++++
2 files changed, 11 insertions(+)

diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index cd7b0d941c..b4a6dce885 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -1010,6 +1010,10 @@ struct AVCodecParserContext *av_stream_get_parser(const AVStream *s);
diff '--color=auto' -rupN ffmpeg.orig/libavformat/avformat.h ffmpeg/libavformat/avformat.h
--- ffmpeg.orig/libavformat/avformat.h 2022-08-19 17:42:47.323422603 +0200
+++ ffmpeg/libavformat/avformat.h 2022-08-19 17:42:51.347130436 +0200
@@ -1128,6 +1128,10 @@ struct AVCodecParserContext *av_stream_g
*/
int64_t av_stream_get_end_pts(const AVStream *st);

Expand All @@ -24,11 +12,10 @@ index cd7b0d941c..b4a6dce885 100644
#define AV_PROGRAM_RUNNING 1

/**
diff --git a/libavformat/utils.c b/libavformat/utils.c
index de7580c32d..0ef0fe530e 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -121,6 +121,13 @@ int64_t av_stream_get_end_pts(const AVStream *st)
diff '--color=auto' -rupN ffmpeg.orig/libavformat/mux_utils.c ffmpeg/libavformat/mux_utils.c
--- ffmpeg.orig/libavformat/mux_utils.c 2022-08-19 17:42:47.346758108 +0200
+++ ffmpeg/libavformat/mux_utils.c 2022-08-19 17:47:28.549589002 +0200
@@ -37,6 +37,13 @@ int64_t av_stream_get_end_pts(const AVSt
return AV_NOPTS_VALUE;
}

Expand All @@ -39,6 +26,6 @@ index de7580c32d..0ef0fe530e 100644
+}
+// Chromium: We use the internal field first_dts ^^^
+
struct AVCodecParserContext *av_stream_get_parser(const AVStream *st)
int avformat_query_codec(const AVOutputFormat *ofmt, enum AVCodecID codec_id,
int std_compliance)
{
return st->internal->parser;
9 changes: 4 additions & 5 deletions ffmpeg/mingw-w64/configure.patch
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
diff -ruN ffmpeg-4.0/configure patched/configure
--- ffmpeg-4.0/configure 2018-04-20 12:02:55.000000000 +0200
+++ patched/configure 2018-05-13 10:55:23.199869611 +0200
@@ -5101,10 +5101,10 @@
--- ffmpeg/configure 2023-03-03 16:09:27.129999842 +0100
+++ patched/configure 2023-03-03 16:11:44.793333176 +0100
@@ -5583,10 +5583,10 @@
elif enabled aarch64; then
LIBTARGET="arm64"
fi
Expand All @@ -12,6 +11,6 @@ diff -ruN ffmpeg-4.0/configure patched/configure
- fi
+ # disable static
+ #fi
enabled shared && ! enabled small && test_cmd $windres --version && enable gnu_windres
! enabled small && test_cmd $windres --version && enable gnu_windres
enabled x86_32 && check_ldflags -Wl,--large-address-aware
shlibdir_default="$bindir_default"

0 comments on commit 2a1a0f2

Please sign in to comment.