ffmpeg: work around missing stdout flush in some cases (#26709)
See https://github.com/msys2/MINGW-packages/issues/26646#issuecomment-3599269090
This commit is contained in:
65
mingw-w64-ffmpeg/0006-atexit-fflush.patch
Normal file
65
mingw-w64-ffmpeg/0006-atexit-fflush.patch
Normal file
@@ -0,0 +1,65 @@
|
||||
--- ffmpeg-8.0.1/fftools/cmdutils.c.orig 2025-12-04 12:02:39.048902000 +0100
|
||||
+++ ffmpeg-8.0.1/fftools/cmdutils.c 2025-12-04 12:03:09.025919500 +0100
|
||||
@@ -72,6 +72,21 @@
|
||||
vfprintf(stdout, fmt, vl);
|
||||
}
|
||||
|
||||
+#if defined(_WIN32)
|
||||
+static void
|
||||
+exit_flush(void)
|
||||
+{
|
||||
+ fflush(NULL);
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
+void init_atexit(void)
|
||||
+{
|
||||
+#if defined(_WIN32)
|
||||
+ atexit(exit_flush);
|
||||
+#endif
|
||||
+}
|
||||
+
|
||||
void init_dynload(void)
|
||||
{
|
||||
#if HAVE_SETDLLDIRECTORY && defined(_WIN32)
|
||||
--- ffmpeg-8.0.1/fftools/cmdutils.h.oriig 2025-12-04 12:03:14.817855900 +0100
|
||||
+++ ffmpeg-8.0.1/fftools/cmdutils.h 2025-12-04 12:01:19.917757800 +0100
|
||||
@@ -54,6 +54,8 @@
|
||||
*/
|
||||
void init_dynload(void);
|
||||
|
||||
+void init_atexit(void);
|
||||
+
|
||||
/**
|
||||
* Uninitialize the cmdutils option system, in particular
|
||||
* free the *_opts contexts and their contents.
|
||||
--- ffmpeg-8.0.1/fftools/ffmpeg.c.orig 2025-12-04 11:58:38.637191900 +0100
|
||||
+++ ffmpeg-8.0.1/fftools/ffmpeg.c 2025-12-04 12:05:01.143673400 +0100
|
||||
@@ -968,6 +968,7 @@
|
||||
int ret;
|
||||
BenchmarkTimeStamps ti;
|
||||
|
||||
+ init_atexit();
|
||||
init_dynload();
|
||||
|
||||
setvbuf(stderr,NULL,_IONBF,0); /* win32 runtime needs this */
|
||||
--- ffmpeg-8.0.1/fftools/ffplay.c.orig 2025-11-20 03:31:18.000000000 +0100
|
||||
+++ ffmpeg-8.0.1/fftools/ffplay.c 2025-12-04 12:04:57.040537600 +0100
|
||||
@@ -3759,6 +3759,7 @@
|
||||
int flags, ret;
|
||||
VideoState *is;
|
||||
|
||||
+ init_atexit();
|
||||
init_dynload();
|
||||
|
||||
av_log_set_flags(AV_LOG_SKIP_REPEATED);
|
||||
--- ffmpeg-8.0.1/fftools/ffprobe.c.orig 2025-11-20 03:31:18.000000000 +0100
|
||||
+++ ffmpeg-8.0.1/fftools/ffprobe.c 2025-12-04 12:04:51.566511900 +0100
|
||||
@@ -3067,6 +3067,7 @@
|
||||
char *f_name = NULL, *f_args = NULL;
|
||||
int ret, input_ret, i;
|
||||
|
||||
+ init_atexit();
|
||||
init_dynload();
|
||||
|
||||
setvbuf(stderr, NULL, _IONBF, 0); /* win32 runtime needs this */
|
||||
@@ -7,7 +7,7 @@ _realname=ffmpeg
|
||||
pkgbase="mingw-w64-${_realname}"
|
||||
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
|
||||
pkgver=8.0.1
|
||||
pkgrel=1
|
||||
pkgrel=2
|
||||
pkgdesc="Complete solution to record, convert and stream audio and video (mingw-w64)"
|
||||
arch=('any')
|
||||
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clangarm64')
|
||||
@@ -79,13 +79,15 @@ makedepends=("${MINGW_PACKAGE_PREFIX}-cc"
|
||||
source=(https://ffmpeg.org/releases/${_realname}-${pkgver}.tar.xz{,.asc}
|
||||
"pathtools.c"
|
||||
"pathtools.h"
|
||||
"0005-Win32-Add-path-relocation-to-frei0r-plugins-search.patch")
|
||||
"0005-Win32-Add-path-relocation-to-frei0r-plugins-search.patch"
|
||||
"0006-atexit-fflush.patch")
|
||||
validpgpkeys=('FCF986EA15E6E293A5644F10B4322F04D67658D8')
|
||||
sha256sums=('05ee0b03119b45c0bdb4df654b96802e909e0a752f72e4fe3794f487229e5a41'
|
||||
'SKIP'
|
||||
'ebf471173f5ee9c4416c10a78760cea8afaf1a4a6e653977321e8547ce7bf3c0'
|
||||
'1585ef1b61cf53a2ca27049c11d49e0834683dfda798f03547761375df482a90'
|
||||
'8c74e9b5800dbb41c33a60114712726ec768ad6de8f147c2eb30656fd4c899cc')
|
||||
'8c74e9b5800dbb41c33a60114712726ec768ad6de8f147c2eb30656fd4c899cc'
|
||||
'd38cd99535300d8a37937ebad6e4dba6fe496bba6102d91794b29d94de4db7ed')
|
||||
|
||||
# Helper macros to help make tasks easier #
|
||||
apply_patch_with_msg() {
|
||||
@@ -107,6 +109,11 @@ prepare() {
|
||||
|
||||
apply_patch_with_msg \
|
||||
0005-Win32-Add-path-relocation-to-frei0r-plugins-search.patch
|
||||
|
||||
# https://github.com/msys2/MINGW-packages/issues/26646
|
||||
# Work around streams not being flushed on exit in some cases
|
||||
apply_patch_with_msg \
|
||||
0006-atexit-fflush.patch
|
||||
}
|
||||
|
||||
build() {
|
||||
|
||||
Reference in New Issue
Block a user