Refresh dlopen headers and patch for OpenH264 2.3.1

Backport patches to fix building with newer SDL2 versions
This commit is contained in:
Neal Gompa 2022-10-12 11:17:43 -04:00
parent 6c78504a94
commit af350001d8
5 changed files with 94 additions and 15 deletions

View File

@ -0,0 +1,35 @@
From 32f9a3e0c23c403cd6c6dc812939253227001f88 Mon Sep 17 00:00:00 2001
From: Christopher Degawa <ccom@randomderp.com>
Date: Wed, 11 May 2022 15:11:04 -0500
Subject: [PATCH 1/2] configure: extend SDL check to accept all 2.x versions
sdl2 recently changed their versioning, moving the patch level to minor level
https://github.com/libsdl-org/SDL/commit/cd7c2f1de7d9e418bb554047d714dd7cacc020ff
and have said that they will instead ship sdl3.pc for 3.0.0
Fixes ticket 9768
Signed-off-by: Christopher Degawa <ccom@randomderp.com>
Signed-off-by: Gyan Doshi <ffmpeg@gyani.pro>
(cherry picked from commit e5163b1d34381a3319214a902ef1df923dd2eeba)
---
configure | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configure b/configure
index 2369ea0240..e731a9d3ff 100755
--- a/configure
+++ b/configure
@@ -6742,7 +6742,7 @@ fi
if enabled sdl2; then
SDL2_CONFIG="${cross_prefix}sdl2-config"
- test_pkg_config sdl2 "sdl2 >= 2.0.1 sdl2 < 2.1.0" SDL_events.h SDL_PollEvent
+ test_pkg_config sdl2 "sdl2 >= 2.0.1 sdl2 < 3.0.0" SDL_events.h SDL_PollEvent
if disabled sdl2 && "${SDL2_CONFIG}" --version > /dev/null 2>&1; then
sdl2_cflags=$("${SDL2_CONFIG}" --cflags)
sdl2_extralibs=$("${SDL2_CONFIG}" --libs)
--
2.36.1

View File

@ -0,0 +1,33 @@
From fc7fb12f22180d03428310da7eca55403a123322 Mon Sep 17 00:00:00 2001
From: dvhh <dvhh-at-yahoo.com@ffmpeg.org>
Date: Sat, 18 Jun 2022 01:46:12 +0900
Subject: [PATCH 2/2] configure: fix SDL2 version check for pkg_config fallback
pkg_config fallback for SDL2 use 2.1.0 as max (excluded) version
where the pkg_config specify 3.0.0
Correcting fallback version to be in line with the pkg_config version
Signed-off-by: dvhh <dvhh@yahoo.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
(cherry picked from commit c6fdbe26ef30fff817581e5ed6e078d96111248a)
---
configure | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configure b/configure
index e731a9d3ff..596be632c4 100755
--- a/configure
+++ b/configure
@@ -6747,7 +6747,7 @@ if enabled sdl2; then
sdl2_cflags=$("${SDL2_CONFIG}" --cflags)
sdl2_extralibs=$("${SDL2_CONFIG}" --libs)
test_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x020001" $sdl2_cflags &&
- test_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x020100" $sdl2_cflags &&
+ test_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x030000" $sdl2_cflags &&
check_func_headers SDL_events.h SDL_PollEvent $sdl2_extralibs $sdl2_cflags &&
enable sdl2
fi
--
2.36.1

View File

@ -1,6 +1,6 @@
From 081b35c5b598fef0a2e47753752f7607ff90a2d3 Mon Sep 17 00:00:00 2001 From b8886826f44b4562aa2fbae3715ca6aa9e1b15e1 Mon Sep 17 00:00:00 2001
From: Neal Gompa <ngompa@fedoraproject.org> From: Neal Gompa <ngompa@fedoraproject.org>
Date: Fri, 18 Feb 2022 08:12:54 -0500 Date: Wed, 12 Oct 2022 10:26:35 -0400
Subject: [PATCH] avcodec/openh264: Add the ability to dlopen() OpenH264 Subject: [PATCH] avcodec/openh264: Add the ability to dlopen() OpenH264
We can't directly depend on OpenH264, but we can weakly link to it We can't directly depend on OpenH264, but we can weakly link to it
@ -14,17 +14,17 @@ Signed-off-by: Neal Gompa <ngompa@fedoraproject.org>
--- ---
configure | 3 + configure | 3 +
libavcodec/Makefile | 1 + libavcodec/Makefile | 1 +
libavcodec/libopenh264.c | 15 +++- libavcodec/libopenh264.c | 18 +++-
libavcodec/libopenh264_dlopen.c | 147 ++++++++++++++++++++++++++++++++ libavcodec/libopenh264_dlopen.c | 147 ++++++++++++++++++++++++++++++++
libavcodec/libopenh264_dlopen.h | 58 +++++++++++++ libavcodec/libopenh264_dlopen.h | 58 +++++++++++++
libavcodec/libopenh264dec.c | 10 +++ libavcodec/libopenh264dec.c | 10 +++
libavcodec/libopenh264enc.c | 10 +++ libavcodec/libopenh264enc.c | 10 +++
7 files changed, 243 insertions(+), 1 deletion(-) 7 files changed, 245 insertions(+), 2 deletions(-)
create mode 100644 libavcodec/libopenh264_dlopen.c create mode 100644 libavcodec/libopenh264_dlopen.c
create mode 100644 libavcodec/libopenh264_dlopen.h create mode 100644 libavcodec/libopenh264_dlopen.h
diff --git a/configure b/configure diff --git a/configure b/configure
index 6b5ef6332e..f08e566e98 100755 index 7a62f0c248..2369ea0240 100755
--- a/configure --- a/configure
+++ b/configure +++ b/configure
@@ -250,6 +250,7 @@ External library support: @@ -250,6 +250,7 @@ External library support:
@ -43,7 +43,7 @@ index 6b5ef6332e..f08e566e98 100755
libopenjpeg libopenjpeg
libopenmpt libopenmpt
libopenvino libopenvino
@@ -6575,6 +6577,7 @@ enabled libopencv && { check_headers opencv2/core/core_c.h && @@ -6582,6 +6584,7 @@ enabled libopencv && { check_headers opencv2/core/core_c.h &&
require libopencv opencv2/core/core_c.h cvCreateImageHeader -lopencv_core -lopencv_imgproc; } || require libopencv opencv2/core/core_c.h cvCreateImageHeader -lopencv_core -lopencv_imgproc; } ||
require_pkg_config libopencv opencv opencv/cxcore.h cvCreateImageHeader; } require_pkg_config libopencv opencv opencv/cxcore.h cvCreateImageHeader; }
enabled libopenh264 && require_pkg_config libopenh264 openh264 wels/codec_api.h WelsGetCodecVersion enabled libopenh264 && require_pkg_config libopenh264 openh264 wels/codec_api.h WelsGetCodecVersion
@ -64,7 +64,7 @@ index 3adf1536d8..9dc8389ce2 100644
OBJS-$(CONFIG_LIBOPENH264_ENCODER) += libopenh264enc.o libopenh264.o OBJS-$(CONFIG_LIBOPENH264_ENCODER) += libopenh264enc.o libopenh264.o
OBJS-$(CONFIG_LIBOPENJPEG_DECODER) += libopenjpegdec.o OBJS-$(CONFIG_LIBOPENJPEG_DECODER) += libopenjpegdec.o
diff --git a/libavcodec/libopenh264.c b/libavcodec/libopenh264.c diff --git a/libavcodec/libopenh264.c b/libavcodec/libopenh264.c
index 59c61a3a4c..9b7dfc59be 100644 index 59c61a3a4c..14d83e27df 100644
--- a/libavcodec/libopenh264.c --- a/libavcodec/libopenh264.c
+++ b/libavcodec/libopenh264.c +++ b/libavcodec/libopenh264.c
@@ -20,8 +20,13 @@ @@ -20,8 +20,13 @@
@ -81,11 +81,14 @@ index 59c61a3a4c..9b7dfc59be 100644
#include "libavutil/log.h" #include "libavutil/log.h"
@@ -52,7 +57,15 @@ int ff_libopenh264_check_version(void *logctx) @@ -51,8 +56,17 @@ int ff_libopenh264_check_version(void *logctx)
// Mingw GCC < 4.7 on x86_32 uses an incorrect/buggy ABI for the WelsGetCodecVersion
// function (for functions returning larger structs), thus skip the check in those // function (for functions returning larger structs), thus skip the check in those
// configurations. // configurations.
#if !defined(_WIN32) || !defined(__GNUC__) || !ARCH_X86_32 || AV_GCC_VERSION_AT_LEAST(4, 7) -#if !defined(_WIN32) || !defined(__GNUC__) || !ARCH_X86_32 || AV_GCC_VERSION_AT_LEAST(4, 7)
- OpenH264Version libver = WelsGetCodecVersion(); - OpenH264Version libver = WelsGetCodecVersion();
+ // Also, for dlopened OpenH264, we should not do the version check. It's too punitive.
+#if !defined(_WIN32) || !defined(__GNUC__) || !ARCH_X86_32 || AV_GCC_VERSION_AT_LEAST(4, 7) || !defined(CONFIG_LIBOPENH264_DLOPEN)
+ OpenH264Version libver; + OpenH264Version libver;
+ +
+#ifdef CONFIG_LIBOPENH264_DLOPEN +#ifdef CONFIG_LIBOPENH264_DLOPEN
@ -100,7 +103,7 @@ index 59c61a3a4c..9b7dfc59be 100644
return AVERROR(EINVAL); return AVERROR(EINVAL);
diff --git a/libavcodec/libopenh264_dlopen.c b/libavcodec/libopenh264_dlopen.c diff --git a/libavcodec/libopenh264_dlopen.c b/libavcodec/libopenh264_dlopen.c
new file mode 100644 new file mode 100644
index 0000000000..b350679f18 index 0000000000..49ea8ff44f
--- /dev/null --- /dev/null
+++ b/libavcodec/libopenh264_dlopen.c +++ b/libavcodec/libopenh264_dlopen.c
@@ -0,0 +1,147 @@ @@ -0,0 +1,147 @@
@ -225,7 +228,7 @@ index 0000000000..b350679f18
+ return 0; + return 0;
+ } + }
+ +
+#define OPENH264_LIB "libopenh264.so.6" +#define OPENH264_LIB "libopenh264.so.7"
+ libopenh264 = dlopen(OPENH264_LIB, RTLD_LAZY); + libopenh264 = dlopen(OPENH264_LIB, RTLD_LAZY);
+ err = dlerror(); + err = dlerror();
+ if (err != NULL) { + if (err != NULL) {
@ -376,5 +379,5 @@ index 2001dc22b4..c8b1348df2 100644
return AVERROR_ENCODER_NOT_FOUND; return AVERROR_ENCODER_NOT_FOUND;
-- --
2.34.1 2.36.1

View File

@ -71,6 +71,7 @@
%if "%{__isa_bits}" == "64" %if "%{__isa_bits}" == "64"
%global lib64_suffix ()(64bit) %global lib64_suffix ()(64bit)
%endif %endif
%global openh264_soversion 7
%global av_codec_soversion 59 %global av_codec_soversion 59
%global av_device_soversion 59 %global av_device_soversion 59
@ -85,7 +86,7 @@ Name: ffmpeg
%global pkg_name %{name}%{?pkg_suffix} %global pkg_name %{name}%{?pkg_suffix}
Version: 5.0.1 Version: 5.0.1
Release: 11%{?dist} Release: 12%{?dist}
Summary: A complete solution to record, convert and stream audio and video Summary: A complete solution to record, convert and stream audio and video
License: GPLv3+ License: GPLv3+
URL: https://ffmpeg.org/ URL: https://ffmpeg.org/
@ -119,6 +120,9 @@ Patch5: ffmpeg-allow-fdk-aac-free.patch
Patch6: ffmpeg-fix-gnutls-priority.patch Patch6: ffmpeg-fix-gnutls-priority.patch
# http://ffmpeg.org/pipermail/ffmpeg-devel/2022-February/293194.html # http://ffmpeg.org/pipermail/ffmpeg-devel/2022-February/293194.html
Patch7: ffmpeg-openh264-averr-on-bad-version.patch Patch7: ffmpeg-openh264-averr-on-bad-version.patch
# Backport fixes to recognize sdl2 with new versioning scheme
Patch8: 0001-configure-extend-SDL-check-to-accept-all-2.x-version.patch
Patch9: 0002-configure-fix-SDL2-version-check-for-pkg_config-fall.patch
# Set up dlopen for openh264 # Set up dlopen for openh264
Patch1001: ffmpeg-dlopen-openh264.patch Patch1001: ffmpeg-dlopen-openh264.patch
@ -323,7 +327,7 @@ Requires: libswresample%{?pkg_suffix}%{_isa} = %{version}-%{release}
# We dlopen() openh264, so weak-depend on it... # We dlopen() openh264, so weak-depend on it...
## Note, we can do this because openh264 is provided in a default-enabled ## Note, we can do this because openh264 is provided in a default-enabled
## third party repository provided by Cisco. ## third party repository provided by Cisco.
Recommends: libopenh264.so.6%{?lib64_suffix} Recommends: libopenh264.so.%{openh264_soversion}%{?lib64_suffix}
%description -n libavcodec%{?pkg_suffix} %description -n libavcodec%{?pkg_suffix}
The libavcodec library provides a generic encoding/decoding framework The libavcodec library provides a generic encoding/decoding framework
@ -836,6 +840,10 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples
%{_mandir}/man3/libswscale.3* %{_mandir}/man3/libswscale.3*
%changelog %changelog
* Wed Oct 12 2022 Neal Gompa <ngompa@fedoraproject.org> - 5.0.1-12
- Refresh dlopen headers and patch for OpenH264 2.3.1
- Backport patches to fix building with newer SDL2 versions
* Thu Jun 09 2022 Neal Gompa <ngompa@fedoraproject.org> - 5.0.1-11 * Thu Jun 09 2022 Neal Gompa <ngompa@fedoraproject.org> - 5.0.1-11
- Ensure libavdevice-devel is pulled in with devel metapackage - Ensure libavdevice-devel is pulled in with devel metapackage

View File

@ -1,4 +1,4 @@
SHA512 (ffmpeg-free-5.0.1.tar.xz) = 313277c2fb62829606c3434f03392351b7964734bef188f7838f754a383d8ad8b890ddd615aa7360ba2a72755fa54a6b967ff2f5a30da7a5490d31b562028e19 SHA512 (ffmpeg-free-5.0.1.tar.xz) = 313277c2fb62829606c3434f03392351b7964734bef188f7838f754a383d8ad8b890ddd615aa7360ba2a72755fa54a6b967ff2f5a30da7a5490d31b562028e19
SHA512 (ffmpeg-5.0.1.tar.xz.asc) = 9c4bd404196c3a3808bae92873aefc77f8c26a9419cc6130a3f2359a75c8e83189d206e9aee8ff85c5a7fe4a98da24e11cf607ec351386c18979ec2d5ad3b3ad SHA512 (ffmpeg-5.0.1.tar.xz.asc) = 9c4bd404196c3a3808bae92873aefc77f8c26a9419cc6130a3f2359a75c8e83189d206e9aee8ff85c5a7fe4a98da24e11cf607ec351386c18979ec2d5ad3b3ad
SHA512 (ffmpeg-dlopen-headers.tar.xz) = b6f62a96e5b199bb52bf7c9c934c5d194a1486f350513dda68c47439d2653605400228a98e289d3bce8b8c0c2a5d95fde2813e238d2bd17d049887df4a7c947a SHA512 (ffmpeg-dlopen-headers.tar.xz) = 97e6986fc2bb9dfa4516135a76b04d27ceb52ff96f0af21a6169919aeefefb4d2e2e24a771959689cdbec385f5d71614ba661223c67c0e94089a6dd823a30099
SHA512 (ffmpeg.keyring) = 9b36506835db36f776b7ddb53ad6fa9e915e6ca2f9c7cfebe8eb45513e1036a985283590a840ca313a111bf35dc3731f68885aaafb1fb7011ec433cc119e5165 SHA512 (ffmpeg.keyring) = 9b36506835db36f776b7ddb53ad6fa9e915e6ca2f9c7cfebe8eb45513e1036a985283590a840ca313a111bf35dc3731f68885aaafb1fb7011ec433cc119e5165