Compare commits

...
Sign in to create a new pull request.

6 commits

Author SHA1 Message Date
Kalev Lember
187b050f07 Backport upstream patch to drop openh264 runtime version checks
... in order to make it possible for us to update openh264 without
having to recompile ffmpeg against the new version every time. As
openh264 is distributed by Cisco and ffmpeg is in Fedora, it's difficult
to coordinate lock step updates. Drop the version check to make this
easier.

https://patchwork.ffmpeg.org/project/ffmpeg/list/?series=10211

This also rebases downstream ffmpeg-dlopen-openh264.patch on top of
the new patch.
2023-12-08 13:09:10 -05:00
Kalev Lember
73f1d91714 Prefer openh264 over noopenh264
Add "Suggests: openh264" so that dnf picks openh264 over noopenh264 that
both provide the same library.
2023-12-08 13:09:10 -05:00
Neal Gompa
7207d79858 Fix ffmpeg-allow-fdk-aac-free.patch to apply with git-am 2023-11-11 09:53:13 -05:00
Neal Gompa
84a6385f06 Update to 6.0.1
- Add ffmpeg chromium support patch (#2240127)
- Use git to apply patches
2023-11-11 09:46:31 -05:00
Neal Gompa
3739445cff Add patches to support enhanced RTMP and AV1 encoding through VA-API
- Force AAC decoding through fdk-aac-free
2023-11-10 08:18:38 -05:00
Dominik Mierzejewski
88ff89db5b Backport upstream patch to fix segfault when passing non-existent filter
option (rfbz#6773)
2023-10-09 10:04:19 +02:00
11 changed files with 5464 additions and 41 deletions

View file

@ -0,0 +1,30 @@
From a0a0a804998da8d1a397479c9bafeb000e6be088 Mon Sep 17 00:00:00 2001
From: Jun Zhao <barryjzhao@tencent.com>
Date: Sat, 25 Feb 2023 21:54:00 +0800
Subject: [PATCH] fftools/ffmpeg_filter: initialize the 'o' to silence the
warning
silence the warning: variable 'o' is used uninitialized whenever
'&&' condition is false
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
---
fftools/ffmpeg_filter.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index 1f5bbf6c4d..3504a3cc0a 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -362,7 +362,7 @@ fail:
static int filter_opt_apply(AVFilterContext *f, const char *key, const char *val)
{
- const AVOption *o;
+ const AVOption *o = NULL;
int ret;
ret = av_opt_set(f, key, val, AV_OPT_SEARCH_CHILDREN);
--
2.41.0

View file

@ -0,0 +1,109 @@
From a641e629591d68bd3edd99bddec623dc31295f6b Mon Sep 17 00:00:00 2001
From: Kalev Lember <klember@redhat.com>
Date: Wed, 6 Dec 2023 14:37:34 +0100
Subject: [PATCH] lavc/libopenh264: Drop openh264 runtime version checks
Years ago, openh264 releases often changed their ABI without changing
the library soname. To avoid running into ABI issues, a version check
was added to lavc libopenh264 code to error out at runtime in case the
build time and runtime openh264 versions don't match.
This should no longer be an issue with newer openh264 releases and we
can drop the runtime version check and rely on upstream doing the right
thing and bump the library soname if the ABI changes, similar to how
other libraries are consumed in ffmpeg.
Almost all major distributions now include openh264 and this means there
are more eyes on ABI changes and issues are discovered and reported
quickly. See e.g. https://github.com/cisco/openh264/issues/3564 where an
ABI issue was quickly discovered and fixed.
Relaxing the check allows downstream distributions to build ffmpeg
against e.g. openh264 2.3.1 and ship an update to ABI-compatible
openh264 2.4.0, without needing to coordinate a lock step update between
ffmpeg and openh264 (which can be difficult if openh264 is distributed
by Cisco and ffmpeg comes from the distro, such as is the case for
Fedora).
Signed-off-by: Kalev Lember <klember@redhat.com>
---
libavcodec/libopenh264.c | 15 ---------------
libavcodec/libopenh264.h | 2 --
libavcodec/libopenh264dec.c | 4 ----
libavcodec/libopenh264enc.c | 4 ----
4 files changed, 25 deletions(-)
diff --git a/libavcodec/libopenh264.c b/libavcodec/libopenh264.c
index 0f6d28ed88..c80c85ea8b 100644
--- a/libavcodec/libopenh264.c
+++ b/libavcodec/libopenh264.c
@@ -46,18 +46,3 @@ void ff_libopenh264_trace_callback(void *ctx, int level, const char *msg)
int equiv_ffmpeg_log_level = libopenh264_to_ffmpeg_log_level(level);
av_log(ctx, equiv_ffmpeg_log_level, "%s\n", msg);
}
-
-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
- // configurations.
-#if !defined(_WIN32) || !defined(__GNUC__) || !ARCH_X86_32 || AV_GCC_VERSION_AT_LEAST(4, 7)
- OpenH264Version libver = WelsGetCodecVersion();
- if (memcmp(&libver, &g_stCodecVersion, sizeof(libver))) {
- av_log(logctx, AV_LOG_ERROR, "Incorrect library version loaded\n");
- return AVERROR(EINVAL);
- }
-#endif
- return 0;
-}
diff --git a/libavcodec/libopenh264.h b/libavcodec/libopenh264.h
index dbb9c5d429..0b462d6fdc 100644
--- a/libavcodec/libopenh264.h
+++ b/libavcodec/libopenh264.h
@@ -34,6 +34,4 @@
void ff_libopenh264_trace_callback(void *ctx, int level, const char *msg);
-int ff_libopenh264_check_version(void *logctx);
-
#endif /* AVCODEC_LIBOPENH264_H */
diff --git a/libavcodec/libopenh264dec.c b/libavcodec/libopenh264dec.c
index 7d650ae03e..b6a9bba2dc 100644
--- a/libavcodec/libopenh264dec.c
+++ b/libavcodec/libopenh264dec.c
@@ -52,13 +52,9 @@ static av_cold int svc_decode_init(AVCodecContext *avctx)
{
SVCContext *s = avctx->priv_data;
SDecodingParam param = { 0 };
- int err;
int log_level;
WelsTraceCallback callback_function;
- if ((err = ff_libopenh264_check_version(avctx)) < 0)
- return AVERROR_DECODER_NOT_FOUND;
-
if (WelsCreateDecoder(&s->decoder)) {
av_log(avctx, AV_LOG_ERROR, "Unable to create decoder\n");
return AVERROR_UNKNOWN;
diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c
index f518d0894e..6f231d22b2 100644
--- a/libavcodec/libopenh264enc.c
+++ b/libavcodec/libopenh264enc.c
@@ -110,14 +110,10 @@ static av_cold int svc_encode_init(AVCodecContext *avctx)
{
SVCContext *s = avctx->priv_data;
SEncParamExt param = { 0 };
- int err;
int log_level;
WelsTraceCallback callback_function;
AVCPBProperties *props;
- if ((err = ff_libopenh264_check_version(avctx)) < 0)
- return AVERROR_ENCODER_NOT_FOUND;
-
if (WelsCreateSVCEncoder(&s->encoder)) {
av_log(avctx, AV_LOG_ERROR, "Unable to create encoder\n");
return AVERROR_UNKNOWN;
--
2.43.0

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,4 @@
## module name # reason for enablement in ffmpeg (usually there is another package that already got legal review)
aac
aasc
libfdk_aac # fdk-aac-free
ac3

View file

@ -30,6 +30,7 @@ asv2
av1_amf
av1_nvenc
av1_qsv
av1_vaapi
ayuv # trival
bitpacked # trivial
bmp # trivial

View file

@ -1,3 +1,5 @@
From: Andreas Schneider <asn@cryptomilk.org>
fdk-aac-free-devel is GPL compatible
See https://bugzilla.redhat.com/show_bug.cgi?id=1501522#c112

46
ffmpeg-chromium.patch Normal file
View file

@ -0,0 +1,46 @@
From d32aacab65a322b66d6a1b48f6cdb03e42bde0f9 Mon Sep 17 00:00:00 2001
From: Frank Liberato <liberato@chromium.org>
Date: Wed, 7 Jul 2021 19:01:22 -0700
Subject: [PATCH] Add av_stream_get_first_dts for Chromium
---
libavformat/avformat.h | 4 ++++
libavformat/utils.c | 7 +++++++
2 files changed, 11 insertions(+)
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 1916aa2dc5..e6682849fa 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -1019,6 +1019,10 @@ attribute_deprecated
int64_t av_stream_get_end_pts(const AVStream *st);
#endif
+// Chromium: We use the internal field first_dts vvv
+int64_t av_stream_get_first_dts(const AVStream *st);
+// Chromium: We use the internal field first_dts ^^^
+
#define AV_PROGRAM_RUNNING 1
/**
diff --git a/libavformat/utils.c b/libavformat/utils.c
index cf4d68bff9..7d750abf88 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -55,6 +55,13 @@ int ff_unlock_avformat(void)
return ff_mutex_unlock(&avformat_mutex) ? -1 : 0;
}
+// Chromium: We use the internal field first_dts vvv
+int64_t av_stream_get_first_dts(const AVStream *st)
+{
+ return cffstream(st)->first_dts;
+}
+// Chromium: We use the internal field first_dts ^^^
+
/* an arbitrarily chosen "sane" max packet size -- 50M */
#define SANE_CHUNK_SIZE (50000000)
--
2.41.0

View file

@ -1,4 +1,4 @@
From 4739b0c97b3378bdaf737171777fe9a71a53eff1 Mon Sep 17 00:00:00 2001
From 1f48740db0dda8d6ec1b97a7f4a794e381a65636 Mon Sep 17 00:00:00 2001
From: Neal Gompa <ngompa@fedoraproject.org>
Date: Wed, 12 Oct 2022 09:41:27 -0400
Subject: [PATCH] avcodec/openh264: Add the ability to dlopen() OpenH264
@ -14,12 +14,12 @@ Signed-off-by: Neal Gompa <ngompa@fedoraproject.org>
---
configure | 3 +
libavcodec/Makefile | 1 +
libavcodec/libopenh264.c | 18 +++-
libavcodec/libopenh264.c | 5 ++
libavcodec/libopenh264_dlopen.c | 147 ++++++++++++++++++++++++++++++++
libavcodec/libopenh264_dlopen.h | 58 +++++++++++++
libavcodec/libopenh264dec.c | 10 +++
libavcodec/libopenh264enc.c | 10 +++
7 files changed, 245 insertions(+), 2 deletions(-)
7 files changed, 234 insertions(+)
create mode 100644 libavcodec/libopenh264_dlopen.c
create mode 100644 libavcodec/libopenh264_dlopen.h
@ -64,7 +64,7 @@ index 457ec58377..08a26fba5f 100644
OBJS-$(CONFIG_LIBOPENH264_ENCODER) += libopenh264enc.o libopenh264.o
OBJS-$(CONFIG_LIBOPENJPEG_DECODER) += libopenjpegdec.o
diff --git a/libavcodec/libopenh264.c b/libavcodec/libopenh264.c
index 0f6d28ed88..a124c3fa1e 100644
index c80c85ea8b..128c3d9846 100644
--- a/libavcodec/libopenh264.c
+++ b/libavcodec/libopenh264.c
@@ -20,8 +20,13 @@
@ -81,26 +81,6 @@ index 0f6d28ed88..a124c3fa1e 100644
#include "libavutil/error.h"
#include "libavutil/log.h"
@@ -52,8 +57,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
// configurations.
-#if !defined(_WIN32) || !defined(__GNUC__) || !ARCH_X86_32 || AV_GCC_VERSION_AT_LEAST(4, 7)
- 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;
+
+#ifdef CONFIG_LIBOPENH264_DLOPEN
+ if (loadLibOpenH264(logctx)) {
+ return AVERROR_EXTERNAL;
+ }
+#endif
+
+ libver = WelsGetCodecVersion();
if (memcmp(&libver, &g_stCodecVersion, sizeof(libver))) {
av_log(logctx, AV_LOG_ERROR, "Incorrect library version loaded\n");
return AVERROR(EINVAL);
diff --git a/libavcodec/libopenh264_dlopen.c b/libavcodec/libopenh264_dlopen.c
new file mode 100644
index 0000000000..49ea8ff44f
@ -319,7 +299,7 @@ index 0000000000..d7d8bb7cad
+
+#endif /* HAVE_LIBOPENH264_DLOPEN_H */
diff --git a/libavcodec/libopenh264dec.c b/libavcodec/libopenh264dec.c
index 007f86b619..57aa3bc1d1 100644
index 7e14d4dd7d..a805598446 100644
--- a/libavcodec/libopenh264dec.c
+++ b/libavcodec/libopenh264dec.c
@@ -19,8 +19,12 @@
@ -335,7 +315,7 @@ index 007f86b619..57aa3bc1d1 100644
#include "libavutil/common.h"
#include "libavutil/fifo.h"
@@ -56,6 +60,12 @@ static av_cold int svc_decode_init(AVCodecContext *avctx)
@@ -55,6 +59,12 @@ static av_cold int svc_decode_init(AVCodecContext *avctx)
int log_level;
WelsTraceCallback callback_function;
@ -345,11 +325,11 @@ index 007f86b619..57aa3bc1d1 100644
+ }
+#endif
+
if ((err = ff_libopenh264_check_version(avctx)) < 0)
return AVERROR_DECODER_NOT_FOUND;
if (WelsCreateDecoder(&s->decoder)) {
av_log(avctx, AV_LOG_ERROR, "Unable to create decoder\n");
return AVERROR_UNKNOWN;
diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c
index db252aace1..75289678da 100644
index 5257906567..80481f3d0a 100644
--- a/libavcodec/libopenh264enc.c
+++ b/libavcodec/libopenh264enc.c
@@ -19,8 +19,12 @@
@ -365,7 +345,7 @@ index db252aace1..75289678da 100644
#include "libavutil/attributes.h"
#include "libavutil/common.h"
@@ -137,6 +141,12 @@ static av_cold int svc_encode_init(AVCodecContext *avctx)
@@ -114,6 +118,12 @@ static av_cold int svc_encode_init(AVCodecContext *avctx)
WelsTraceCallback callback_function;
AVCPBProperties *props;
@ -375,9 +355,9 @@ index db252aace1..75289678da 100644
+ }
+#endif
+
if ((err = ff_libopenh264_check_version(avctx)) < 0)
return AVERROR_ENCODER_NOT_FOUND;
if (WelsCreateSVCEncoder(&s->encoder)) {
av_log(avctx, AV_LOG_ERROR, "Unable to create encoder\n");
return AVERROR_UNKNOWN;
--
2.36.1

File diff suppressed because it is too large Load diff

View file

@ -91,8 +91,8 @@
Name: ffmpeg
%global pkg_name %{name}%{?pkg_suffix}
Version: 6.0
Release: 4%{?dist}
Version: 6.0.1
Release: 2%{?dist}
Summary: A complete solution to record, convert and stream audio and video
License: GPL-3.0-or-later
URL: https://ffmpeg.org/
@ -121,10 +121,33 @@ Patch3: ffmpeg-allow-fdk-aac-free.patch
# Backport upstream patches for libplacebo v5.264
Patch4: 0001-avfilter-vf_libplacebo-wrap-deprecated-opts-in-FF_AP.patch
Patch5: 0001-avfilter-vf_libplacebo-remove-deprecated-field.patch
# Backport fix for segfault when passing non-existent filter option
# See: https://bugzilla.rpmfusion.org/show_bug.cgi?id=6773
Patch6: 0001-fftools-ffmpeg_filter-initialize-the-o-to-silence-th.patch
# Backport patches for enhanced rtmp support
# Cf. https://patchwork.ffmpeg.org/project/ffmpeg/list/?series=8926
## From: https://patchwork.ffmpeg.org/series/8926/mbox/
Patch8: FFmpeg-devel-v10-Support-enhanced-flv-in-FFmpeg.patch
# Backport AV1 VA-API encode support
# Courtesy of GloriousEggroll
## Adapted from: https://patchwork.ffmpeg.org/project/ffmpeg/list/?series=9594
Patch9: ffmpeg-ge-av1-vaapi-encode-support.patch
# Drop openh264 runtime version checks
# https://patchwork.ffmpeg.org/project/ffmpeg/list/?series=10211
Patch10: 0001-lavc-libopenh264-Drop-openh264-runtime-version-check.patch
# Set up dlopen for openh264
Patch1001: ffmpeg-dlopen-openh264.patch
# Add first_dts getter to libavformat for Chromium
# See: https://bugzilla.redhat.com/show_bug.cgi?id=2240127
# Reference: https://crbug.com/1306560
Patch1002: ffmpeg-chromium.patch
Requires: libavcodec%{?pkg_suffix}%{_isa} = %{version}-%{release}
Requires: libavdevice%{?pkg_suffix}%{_isa} = %{version}-%{release}
Requires: libavfilter%{?pkg_suffix}%{_isa} = %{version}-%{release}
@ -141,6 +164,7 @@ BuildRequires: flite-devel >= 2.2
%endif
BuildRequires: game-music-emu-devel
BuildRequires: gcc
BuildRequires: git-core
BuildRequires: gnupg2
BuildRequires: gsm-devel
BuildRequires: ladspa-devel
@ -331,6 +355,7 @@ Requires: libswresample%{?pkg_suffix}%{_isa} = %{version}-%{release}
## Note, we can do this because openh264 is provided in a default-enabled
## third party repository provided by Cisco.
Recommends: libopenh264.so.%{openh264_soversion}%{?lib64_suffix}
Suggests: openh264%{_isa}
%description -n libavcodec%{?pkg_suffix}
The libavcodec library provides a generic encoding/decoding framework
@ -537,10 +562,10 @@ This subpackage contains the headers for FFmpeg libswscale.
%prep
%if %{with upstream_tarball}
gpgv2 --quiet --keyring %{SOURCE3} %{SOURCE2} %{SOURCE0}
%{gpgverify} --keyring='%{SOURCE3}' --signature='%{SOURCE2}' --data='%{SOURCE0}'
%endif
%autosetup -a1 -p1
%autosetup -a1 -S git_am
install -m 0644 %{SOURCE20} enable_decoders
install -m 0644 %{SOURCE21} enable_encoders
# fix -O3 -g in host_cflags
@ -854,6 +879,23 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples
%{_mandir}/man3/libswscale.3*
%changelog
* Wed Dec 06 2023 Kalev Lember <klember@redhat.com> - 6.0.1-2
- Prefer openh264 over noopenh264
- Backport upstream patch to drop openh264 runtime version checks
* Sat Nov 11 2023 Neal Gompa <ngompa@fedoraproject.org> - 6.0.1-1
- Update to 6.0.1
- Add ffmpeg chromium support patch (#2240127)
- Use git to apply patches
* Fri Nov 10 2023 Neal Gompa <ngompa@fedoraproject.org> - 6.0-6
- Add patches to support enhanced RTMP and AV1 encoding through VA-API
- Force AAC decoding through fdk-aac-free
* Sun Oct 08 2023 Dominik Mierzejewski <dominik@greysector.net> - 6.0-5
- Backport upstream patch to fix segfault when passing non-existent filter
option (rfbz#6773)
* Mon Apr 03 2023 Neal Gompa <ngompa@fedoraproject.org> - 6.0-4
- Include RISC-V support sources in the tarball

View file

@ -1,4 +1,4 @@
SHA512 (ffmpeg-free-6.0.tar.xz) = 5e806529f45311d94a81401d8951135e84361a81d158ed030aeee9812b399dd28b25c5d3e1a4abe0665d5838e0954626de538b10cebf34f8669963b1974a3910
SHA512 (ffmpeg-6.0.tar.xz.asc) = a64cd0f8578fcea4537f5a38634c930d66c8ba4abd3e8e9dcffaeb95c3ad2e754d7bc4fbb5272409d4d32abf8180ef83f7204c6a570b52a37e635efd96cb94ed
SHA512 (ffmpeg-free-6.0.1.tar.xz) = da4aa6db92fbbfdda9fc64249a0c826ae5de33cacbed5ebbfbbe9a30d57ae6f79b61496fcf151dc504d646efd44ba63722220be0b718dd8ffdaa5b2510d92a97
SHA512 (ffmpeg-6.0.1.tar.xz.asc) = 314f9ef996b85bc93c9fb823d582697c7415ac35f56bfc9cd906893491c8076df90bd852cf6e5e757b1fa94bd415ed108488c1220add49eb1f4854fc253c178c
SHA512 (ffmpeg-dlopen-headers.tar.xz) = 97e6986fc2bb9dfa4516135a76b04d27ceb52ff96f0af21a6169919aeefefb4d2e2e24a771959689cdbec385f5d71614ba661223c67c0e94089a6dd823a30099
SHA512 (ffmpeg.keyring) = 9b36506835db36f776b7ddb53ad6fa9e915e6ca2f9c7cfebe8eb45513e1036a985283590a840ca313a111bf35dc3731f68885aaafb1fb7011ec433cc119e5165