From b3cfba90d45ccf7fdd58a4e0fa79e6527890b58d Mon Sep 17 00:00:00 2001 From: Neal Gompa Date: Sat, 11 Nov 2023 09:10:58 -0500 Subject: [PATCH] Update to 6.0.1 - Add ffmpeg chromium support patch (#2240127) - Use git to apply patches --- ...ops-clip-constants-used-with-shift-i.patch | 76 ------------------- ffmpeg-chromium.patch | 46 +++++++++++ ffmpeg.spec | 23 ++++-- sources | 4 +- 4 files changed, 64 insertions(+), 85 deletions(-) delete mode 100644 0001-avcodec-x86-mathops-clip-constants-used-with-shift-i.patch create mode 100644 ffmpeg-chromium.patch diff --git a/0001-avcodec-x86-mathops-clip-constants-used-with-shift-i.patch b/0001-avcodec-x86-mathops-clip-constants-used-with-shift-i.patch deleted file mode 100644 index f47e827..0000000 --- a/0001-avcodec-x86-mathops-clip-constants-used-with-shift-i.patch +++ /dev/null @@ -1,76 +0,0 @@ -From effadce6c756247ea8bae32dc13bb3e6f464f0eb Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?R=C3=A9mi=20Denis-Courmont?= -Date: Sun, 16 Jul 2023 18:18:02 +0300 -Subject: [PATCH] avcodec/x86/mathops: clip constants used with shift - instructions within inline assembly - -Fixes assembling with binutil as >= 2.41 - -Signed-off-by: James Almer ---- - libavcodec/x86/mathops.h | 26 +++++++++++++++++++++++--- - 1 file changed, 23 insertions(+), 3 deletions(-) - -diff --git a/libavcodec/x86/mathops.h b/libavcodec/x86/mathops.h -index 6298f5ed19..ca7e2dffc1 100644 ---- a/libavcodec/x86/mathops.h -+++ b/libavcodec/x86/mathops.h -@@ -35,12 +35,20 @@ - static av_always_inline av_const int MULL(int a, int b, unsigned shift) - { - int rt, dummy; -+ if (__builtin_constant_p(shift)) - __asm__ ( - "imull %3 \n\t" - "shrdl %4, %%edx, %%eax \n\t" - :"=a"(rt), "=d"(dummy) -- :"a"(a), "rm"(b), "ci"((uint8_t)shift) -+ :"a"(a), "rm"(b), "i"(shift & 0x1F) - ); -+ else -+ __asm__ ( -+ "imull %3 \n\t" -+ "shrdl %4, %%edx, %%eax \n\t" -+ :"=a"(rt), "=d"(dummy) -+ :"a"(a), "rm"(b), "c"((uint8_t)shift) -+ ); - return rt; - } - -@@ -113,19 +121,31 @@ __asm__ volatile(\ - // avoid +32 for shift optimization (gcc should do that ...) - #define NEG_SSR32 NEG_SSR32 - static inline int32_t NEG_SSR32( int32_t a, int8_t s){ -+ if (__builtin_constant_p(s)) - __asm__ ("sarl %1, %0\n\t" - : "+r" (a) -- : "ic" ((uint8_t)(-s)) -+ : "i" (-s & 0x1F) - ); -+ else -+ __asm__ ("sarl %1, %0\n\t" -+ : "+r" (a) -+ : "c" ((uint8_t)(-s)) -+ ); - return a; - } - - #define NEG_USR32 NEG_USR32 - static inline uint32_t NEG_USR32(uint32_t a, int8_t s){ -+ if (__builtin_constant_p(s)) - __asm__ ("shrl %1, %0\n\t" - : "+r" (a) -- : "ic" ((uint8_t)(-s)) -+ : "i" (-s & 0x1F) - ); -+ else -+ __asm__ ("shrl %1, %0\n\t" -+ : "+r" (a) -+ : "c" ((uint8_t)(-s)) -+ ); - return a; - } - --- -2.41.0 - diff --git a/ffmpeg-chromium.patch b/ffmpeg-chromium.patch new file mode 100644 index 0000000..2160609 --- /dev/null +++ b/ffmpeg-chromium.patch @@ -0,0 +1,46 @@ +From d32aacab65a322b66d6a1b48f6cdb03e42bde0f9 Mon Sep 17 00:00:00 2001 +From: Frank Liberato +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 + diff --git a/ffmpeg.spec b/ffmpeg.spec index 4a20644..0ad6eac 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -91,8 +91,8 @@ Name: ffmpeg %global pkg_name %{name}%{?pkg_suffix} -Version: 6.0 -Release: 16%{?dist} +Version: 6.0.1 +Release: 1%{?dist} Summary: A complete solution to record, convert and stream audio and video License: GPL-3.0-or-later URL: https://ffmpeg.org/ @@ -122,9 +122,6 @@ Patch3: ffmpeg-allow-fdk-aac-free.patch Patch4: 0001-avfilter-vf_libplacebo-wrap-deprecated-opts-in-FF_AP.patch Patch5: 0001-avfilter-vf_libplacebo-remove-deprecated-field.patch -# Fix assembly with binutils 2.41 https://fftrac-bg.ffmpeg.org/ticket/10405 -Patch6: 0001-avcodec-x86-mathops-clip-constants-used-with-shift-i.patch - # Backport fix for segfault when passing non-existent filter option # See: https://bugzilla.rpmfusion.org/show_bug.cgi?id=6773 Patch7: 0001-fftools-ffmpeg_filter-initialize-the-o-to-silence-th.patch @@ -142,6 +139,12 @@ Patch9: ffmpeg-ge-av1-vaapi-encode-support.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} @@ -158,6 +161,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 @@ -554,10 +558,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 @@ -871,6 +875,11 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples %{_mandir}/man3/libswscale.3* %changelog +* Sat Nov 11 2023 Neal Gompa - 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 - 6.0-16 - Add patches to support enhanced RTMP and AV1 encoding through VA-API - Force AAC decoding through fdk-aac-free diff --git a/sources b/sources index b9b9241..c3587ce 100644 --- a/sources +++ b/sources @@ -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